diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..26245e9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# use glob syntax. +syntax: glob + +CMakeFiles/ +build/ +src/server/shared/revision.h +build/ +bin/ +.directory +*.orig +*.rej +*~ +.git/ +.hg/ +win/VC90/*/ +*.ncb +*.suo +src/tools/map_extractor/VC90/*/ +src/tools/vmap3_assembler/VC90/*/ +src/tools/vmap3_extractor/VC90/*/ +#externals/lib/*/ +*.*-* +*.patch +.hgignore +.hgtags + +# use regexp syntax. +syntax: regexp + +^src/shared/server/shared/revision\.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..91a8e3d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,271 @@ +# Copyright (C) 2005-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +project(Trinity) + +# CMake policies +cmake_minimum_required(VERSION 2.6) +cmake_policy(SET CMP0005 OLD) + +# +# Override configuration-types - we don't use anything else than debug and release +# + +if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES Debug Release) + set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING + "Reset the configurations to what we need" + FORCE) +endif() + +# Force out-of-source build +string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" BUILDING_IN_SOURCE) + +if( BUILDING_IN_SOURCE ) + message(FATAL_ERROR " + This project requires an out of source build. Remove the file 'CMakeCache.txt' + found in this directory before continuing, create a separate build directory + and run 'cmake path_to_project [options]' from there. + ") +endif() + +# +# Basic packagesearching and setup (further support will be needed, this is a preliminary release!) +# + +include(CheckIncludeFiles) +include(cmake/FindPlatform.cmake) +include(cmake/FindPCHSupport.cmake) + +if(WIN32) + set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/externals) +endif() + +include(cmake/FindACE.cmake) +include(cmake/FindMySQL.cmake) +include(cmake/FindOpenSSL.cmake) + +# +# *nix-specific packages ( zlib and bzip2 libraries will be built from sourcetree on WIN32-platforms) +# + +if( UNIX ) + include(cmake/FindReadline.cmake) + include(cmake/FindTermcap.cmake) + include(FindZLIB) + include(FindBZip2) +endif() + +# Select the Release build configuration by default. +if( NOT CMAKE_BUILD_TYPE ) + set(CMAKE_BUILD_TYPE "Release") +endif() + +if( UNIX ) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY +) + +add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" +) +endif() + +option(DO_AUTHSERVER "Build authserver" 1) +option(DO_WORLDSERVER "Build worldserver" 1) +option(DO_CLI "With CLI" 1) +option(DO_DEBUG "Debug mode" 0) +option(DO_PCH "Use precompiled headers" 1) +option(DO_RA "With RA" 0) +option(DO_SCRIPTS "With trinityscripts" 1) +option(DO_SQL "Copy SQL files" 0) +option(DO_TOOLS "Build tools" 0) +option(DO_WARN "Enable all compile warnings" 0) + +if( UNIX ) + option(CENTOS "CENTOS" 0) + if( CENTOS ) + add_definitions(-DCENTOS) + find_termcap() + else() + find_readline() + endif() +endif() + +# Set up the installation-prefix +if( PREFIX ) + set(CMAKE_INSTALL_PREFIX ${PREFIX}) +endif() + +set(GENREV_SRC + src/genrevision/genrevision.cpp +) + +# Handle debugmode compiles (this will require further work for proper WIN32-setups) +if( DO_DEBUG ) + set(CMAKE_BUILD_TYPE Debug) +endif() + +# +# Generate revision-extractor +# +add_executable(genrev + ${GENREV_SRC} +) + +if( CMAKE_GENERATOR MATCHES "Visual Studio" ) + add_custom_target("revision.h" ALL + COMMAND "${CMAKE_BINARY_DIR}/$(ConfigurationName)/genrev" + ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + DEPENDS genrev + ) +else() + add_custom_target("revision.h" ALL + COMMAND "${CMAKE_BINARY_DIR}/genrev" + ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + DEPENDS genrev + ) +endif() + +execute_process( + COMMAND hg tip --template {rev} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE HG_REVISION +) + +message("") +message("* TrinityCore revision : ${HG_REVISION}") +message("* Build binaries in : ${CMAKE_BUILD_TYPE} mode") +message("") + +if( NOT CONF_DIR ) + set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc) +endif() + +set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib) + +message("* Install core to : ${CMAKE_INSTALL_PREFIX}") +message("* Install libraries to : ${LIBSDIR}") +message("* Install configs to : ${CONF_DIR}") +message("") + +if( DO_AUTHSERVER ) + message("* Build authserver : Yes (default)") +else() + message("* Build authserver : No") +endif() + +if( DO_WORLDSERVER ) + message("* Build worldserver : Yes (default)") +else() + message("* Build worldserver : No") +endif() + +if( DO_SCRIPTS ) + message("* Build Trinityscripts : Yes (default)") + add_definitions(-DDO_SCRIPTS) +else() + message("* Build Trinityscripts : No") +endif() + +if( DO_TOOLS ) + message("* Build map/vmap tools : Yes") +else() + message("* Build map/vmap tools : No (default)") +endif() + +if( DO_CLI ) + message("* Build with CLI : Yes (default)") + add_definitions(-DENABLE_CLI) +else() + message("* Build with CLI : No") +endif() + +if( DO_RA ) + message("* Build with RA : Yes") + add_definitions(-DENABLE_RA) +else() + message("* Build with RA : No (default)") +endif() + +if( DO_DEBUG ) + message("* Build in debug-mode : Yes") + add_definitions(-g -DTRINITY_DEBUG) +else() + message("* Build in debug-mode : No (default)") +endif() + +if( DO_PCH ) + message("* Use PCH : Yes (default)") +else() + message("* Use PCH : No") +endif() + +if( DO_WARN ) + message("* Show all warnings : Yes") + if( UNIX ) + add_definitions(-Wall -Wfatal-errors -Wextra) + endif() +else() + message("* Show compile-warnings : No (default)") + if( UNIX ) + add_definitions(--no-warnings) # makes build look nice, no warnings shown at all, only errors + elseif( WIN32 ) + # Disable warnings in Visual Studio 8 and above + if(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996 /wd4355 /wd4244 /wd4267") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267") + endif() + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + endif() +endif() + +if( DO_SQL ) + message("* Install SQL-files : Yes") +else() + message("* Install SQL-files : No (default)") +endif() + +message("") + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +# Little tweak for OS X +if( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) + set(MACOSX 1) + set(OSX_LIBS /opt/local/lib/libcrypto.dylib) + add_definitions(-D__ASSERTMACROS__) +endif() + +# Some small tweaks for Visual Studio 7 and above. +if( MSVC ) + # Mark 32 bit executables large address aware so they can use > 2GB address space + if(CMAKE_SIZEOF_VOID_P MATCHES 4) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") + endif() +endif() + +set(CMAKE_SKIP_BUILD_RPATH 0) +set(CMAKE_BUILD_WITH_INSTALL_RPATH 0) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1) + +add_subdirectory(externals) +add_subdirectory(src) +if( DO_SQL ) + add_subdirectory(sql) +endif() + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..cdfdede --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..8fc3994 --- /dev/null +++ b/THANKS @@ -0,0 +1,67 @@ += TrinityCore -- Thanks/credits file = + +TrinityCore is a derivation/rewrite of MaNGOS, which was originally written +by Team Python and the WoW Daemon Team. Many people further helped Trinity Core +by submitting bug reports, code patches, and suggestions. Thanks to the +community! + +Special thanks should go out to the WowwoW team. We have gained help from +them many times in the creation of this project. Keep up the good work guys. + +Thanks to the ScriptDev2 team (http://www.scriptdev2.com) for scripts. + +Thanks to the WCell team (especially Ralek) for research on realm reconnect +sequence, item scaling stats algorithm, gameobject rotation issues. + +Thanks go out to the following people for various patches/code (listed in the +order they were added): w12x, dythzer, XEQT, death420, balrok, TOM_RUS, +runningnak3d, Seline, KingPin, raczman, bogie, Neo2003, NoFantasy, Derex, +freghar, toilet1, megamage, MadJack, WarHead, gvcoman, Ntsc, arrai, jrkpote, +Seraphim, vagoth, KerchumA222, Rognar, Blaymoira, DragonHunter, Molius, ApoC, +SeT, hunuza, Wyk3d, VladimirMangos, rj686, Arthorius, QAston, Muhaha, dereka, +Kaldorei, NuRRi, Biglad, Machiavelli, Nivelo, Paradox, Aokromes, EleGoS, +Visagalis, reno, Cybrax, GriffonHeart, fgenesis, rilex, XTElite1, Anubisss, eL, +Iskander, arclite, Bladex, EIFEL, Klaimmore, XTZGZoReX, panaut0lordv, DearScorpion, +BlueSteel, AlexDereka, Drahy, krz, Xeptor, Sethoso, Sarjuuk, pasdVn, nissen, +Triply, `win, Fog, emsy, McBitter, Lukaasm, maikash, Wormheart, DonTomika, +DiSlord, Tiretunderl, Ramses_II, cccyril, Cha0S2, miebaik, Trazom, KiriX, +darkEvil, Sorken, Kudlaty, Charlie2025, Medwise, Rat, Lutik, domingo, +TrullyONE, rastikzzz, Tassader, Lightguard, KAPATEJIb, Tux`Volant, zhanhang03, +Asael, Elron, False, nos4r2zod, Disassembler, thumsoul, rvnth, throneinc, +MrTux, Luniz2k1, Dani, BroodWyrm, raven_coda, Bagsac, Thraxx, Trogvar, +teacher4, zhenya, Albrecht de Endrau, Phacops, Naicisum, thenecromancer, shax, +cryingcloud, freeganja, Foks, daveh, Az@zel, evilstar, Corfen, Astellar, Maxxie, +DEN_North, StarJoker, Nezemnoy, X-Savior, subhuman_bob, Ambal, Brueggus, sparc, +jojo, Trojan, tvaroh, Genars, BombermaG, Bulkin, nesocip, xILOSWag, SilverIce, +Uruviel, timmit, SeT, Seizerkiller, Stokrotka, JoN0, Tanatos, Hunteee, Alyen, +Farah, Them, DaGNU, arthurcik, BudIcePenguin, Amok, Amit86, onkelz28, Azrael, +Larva, Roland, DerDyddye, Vicos, PSZ, CRAZyBUg, irish, Sephiroth1984, hunuza, +mike753, Xlybriem, Paytheo, ArticDevil, FearX, Beaste, bufferoverflow, Jeniczek, +Den, bobaz, crackm, seirge, D_Skywalk, mknjc, Christyan, Saeba, Nevan, tlexii, +liszt, duckman, Joro, Charlie, smellbee, bigjohnson4, maxdestroyer, Destalker, +ckegg, Drethek, yad02, Win32, NetSky, Zcuron, Necroo, ogeraisi, Coldblooded, +Edder, riddick, Craker, NeoLithicX, srounet, SLG, Tidus, neo0608, SyRiOCoP, +F636y623, Patro, mobel, simak, hectolight, Riccardo, GodsdoG, Gomez, kamir86, fredi, +qubix, Deafboy, Authorius, DarkRabbit, mrbungle, netoya, peldor, eumario, Alex, +Moandor, ebx, DasBlub, guenex, Brats, Lucy, arcx, Enril, oiler2112, +Wizz, Elminster, 123qwe, NeatElves, Turk3y, deicide, vladonix, nugu100, +Skystar, Reve, jorooo, FrozenDB, miranda.conrado, Tequila, Gommes, Zerg2000, +aerione_alt, Rastik, FrenchW, wilibald09, Velorien, kancaras, fisherman, +Aviram, Mufik, loop69, multiplexer, Koani, rechapa79, kozelo, MeanMachine, +fregh, adrycasillo, IncoGnito, Alez, Itch, Kuteur, MaS0n, peaceman, manuel, +Gendalph, Lynx3d, raftom, Infinity, Ebrithil, Sorya, HP1, Prince, redcore, +Boogie, Necro, Thyros, simon, MrSmite, horogandris, Stryker, MaXiMiUS, kaell, +totoro, Forgiven, Big, Oculus, Lorac, Nemesis, Epsik, iadus3, durotar, hoshie, +fukifat, imbecile, Nafsih, Meldanor, Turok, Naturamen, Themris, Sundark, +Azuritus, jotapdiez, EnderGT, Curuad, oc_redfox, rockzOr, Darkshines, +BlackYoghurt, McLovin, Gyullo, kaxap, Hawthorne, nanouniko, new001, Opterman, +Typhoon, Cleave, HiZed, The_Game_Master, Athor, Veras, Menia, Jolan, BlackOne, +johnholiver, Spp, Drevi, kb_z, Tartalo, Shendor, Demonx, Taliesin, defacer, +SoulForge, Jackpoz, Cass, QuaLiT1, exul182, sunwell, AniRB, clotza, Tommassino, +dracula70, alexsot, RedSonja, Cnillidan, Proofzor, aqs999, Sony, amsjunior123, +Sisif, Joshh, alex_1983, arez, RammboNr5, Insider, bodompelle, lobuz, Azazel, +footman, elron103, make_the_king, destros, MetaphysicalDrama, disassebler, +Malcrom, Vladmimír Lipták, retriman, hyriuu, Smakapotatis, PainKiller, +bkhorizon, n0n4m3, Chesterfield, Frankir, Wowka321, Morpheux, p0wer, +Ouden, toshik, laise, yavi, Splinter, Syntec, Arthas, denyde, unholy, +Vaughner, blackmanos, edrinn, Supabad, click, silverice, SupaBad, Xanadu diff --git a/cmake/FindACE.cmake b/cmake/FindACE.cmake new file mode 100644 index 0000000..4ade5f6 --- /dev/null +++ b/cmake/FindACE.cmake @@ -0,0 +1,65 @@ +# +# Find the ACE client includes and library +# + +# This module defines +# ACE_INCLUDE_DIR, where to find ace.h +# ACE_LIBRARIES, the libraries to link against +# ACE_FOUND, if false, you cannot build anything that requires ACE + +# also defined, but not for general use are +# ACE_LIBRARY, where to find the ACE library. + +set( ACE_FOUND 0 ) + +if ( UNIX ) + FIND_PATH( ACE_INCLUDE_DIR + NAMES + ace/ACE.h + PATHS + /usr/include + /usr/include/ace + /usr/local/include + /usr/local/include/ace + $ENV{ACE_ROOT} + $ENV{ACE_ROOT}/include + ${CMAKE_SOURCE_DIR}/externals/ace + DOC + "Specify include-directories that might contain ace.h here." + ) + FIND_LIBRARY( ACE_LIBRARY + NAMES + ace ACE + PATHS + /usr/lib + /usr/lib/ace + /usr/local/lib + /usr/local/lib/ace + /usr/local/ace/lib + $ENV{ACE_ROOT}/lib + $ENV{ACE_ROOT} + DOC "Specify library-locations that might contain the ACE library here." + ) + +# FIND_LIBRARY( ACE_EXTRA_LIBRARIES +# NAMES +# z zlib +# PATHS +# /usr/lib +# /usr/local/lib +# DOC +# "if more libraries are necessary to link into ACE, specify them here." +# ) + + if ( ACE_LIBRARY ) + if ( ACE_INCLUDE_DIR ) + set( ACE_FOUND 1 ) + message( STATUS "Found ACE library: ${ACE_LIBRARY}") + message( STATUS "Found ACE headers: ${ACE_INCLUDE_DIR}") + else ( ACE_INCLUDE_DIR ) + message(FATAL_ERROR "Could not find ACE headers! Please install ACE libraries and headers") + endif ( ACE_INCLUDE_DIR ) + endif ( ACE_LIBRARY ) + + mark_as_advanced( ACE_FOUND ACE_LIBRARY ACE_EXTRA_LIBRARIES ACE_INCLUDE_DIR ) +endif (UNIX) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake new file mode 100644 index 0000000..aa62d89 --- /dev/null +++ b/cmake/FindMySQL.cmake @@ -0,0 +1,152 @@ +# +# Find the MySQL client includes and library +# + +# This module defines +# MYSQL_INCLUDE_DIR, where to find mysql.h +# MYSQL_LIBRARIES, the libraries to link against to connect to MySQL +# MYSQL_FOUND, if false, you cannot build anything that requires MySQL. + +# also defined, but not for general use are +# MYSQL_LIBRARY, where to find the MySQL library. + +set( MYSQL_FOUND 0 ) + +if( UNIX ) + set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH + "preferred path to MySQL (mysql_config)" + ) + + find_program(MYSQL_CONFIG mysql_config + ${MYSQL_CONFIG_PREFER_PATH} + /usr/local/mysql/bin/ + /usr/local/bin/ + /usr/bin/ + ) + + if( MYSQL_CONFIG ) + message(STATUS "Using mysql-config: ${MYSQL_CONFIG}") + # set INCLUDE_DIR + exec_program(${MYSQL_CONFIG} + ARGS --include + OUTPUT_VARIABLE MY_TMP + ) + + string(REGEX REPLACE "-I([^ ]*)( .*)?" "\\1" MY_TMP "${MY_TMP}") + set(MYSQL_ADD_INCLUDE_PATH ${MY_TMP} CACHE FILEPATH INTERNAL) + #message("[DEBUG] MYSQL ADD_INCLUDE_PATH : ${MYSQL_ADD_INCLUDE_PATH}") + # set LIBRARY_DIR + exec_program(${MYSQL_CONFIG} + ARGS --libs_r + OUTPUT_VARIABLE MY_TMP + ) + set(MYSQL_ADD_LIBRARIES "") + string(REGEX MATCHALL "-l[^ ]*" MYSQL_LIB_LIST "${MY_TMP}") + foreach(LIB ${MYSQL_LIB_LIST}) + string(REGEX REPLACE "[ ]*-l([^ ]*)" "\\1" LIB "${LIB}") + list(APPEND MYSQL_ADD_LIBRARIES "${LIB}") + #message("[DEBUG] MYSQL ADD_LIBRARIES : ${MYSQL_ADD_LIBRARIES}") + endforeach(LIB ${MYSQL_LIB_LIST}) + + set(MYSQL_ADD_LIBRARIES_PATH "") + string(REGEX MATCHALL "-L[^ ]*" MYSQL_LIBDIR_LIST "${MY_TMP}") + foreach(LIB ${MYSQL_LIBDIR_LIST}) + string(REGEX REPLACE "[ ]*-L([^ ]*)" "\\1" LIB "${LIB}") + list(APPEND MYSQL_ADD_LIBRARIES_PATH "${LIB}") + #message("[DEBUG] MYSQL ADD_LIBRARIES_PATH : ${MYSQL_ADD_LIBRARIES_PATH}") + endforeach(LIB ${MYSQL_LIBS}) + + else( MYSQL_CONFIG ) + set(MYSQL_ADD_LIBRARIES "") + list(APPEND MYSQL_ADD_LIBRARIES "mysqlclient_r") + endif( MYSQL_CONFIG ) +endif( UNIX ) + +find_path(MYSQL_INCLUDE_DIR + NAMES + mysql.h + PATHS + ${MYSQL_ADD_INCLUDE_PATH} + /usr/include + /usr/include/mysql + /usr/local/include + /usr/local/include/mysql + /usr/local/mysql/include + "C:/Program Files/MySQL/include" + "C:/Program Files/MySQL/MySQL Server 5.0/include" + "C:/Program Files/MySQL/MySQL Server 5.1/include" + "C:/MySQL/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.0;Location]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.1;Location]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\MySQL AB\\MySQL Server 5.0;Location]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\MySQL AB\\MySQL Server 5.1;Location]/include" + "c:/msys/local/include" + DOC + "Specify the directory containing mysql.h." +) + +if( UNIX ) +foreach(LIB ${MYSQL_ADD_LIBRARIES}) + find_library( MYSQL_LIBRARY + NAMES + mysql libmysql ${LIB} + PATHS + ${MYSQL_ADD_LIBRARIES_PATH} + /usr/lib + /usr/lib/mysql + /usr/local/lib + /usr/local/lib/mysql + /usr/local/mysql/lib + DOC "Specify the location of the mysql library here." + ) +endforeach(LIB ${MYSQL_ADD_LIBRARY}) +endif( UNIX ) + +if( WIN32 ) + find_library( MYSQL_LIBRARY + NAMES + mysql libmysql ${LIB} + PATHS + ${MYSQL_ADD_LIBRARIES_PATH} + "C:/Program Files/MySQL/lib" + "C:/Program Files/MySQL/MySQL Server 5.0/lib/opt" + "C:/Program Files/MySQL/MySQL Server 5.1/lib/opt" + "C:/MySQL/lib/debug" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.0;Location]/lib/opt" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.1;Location]/lib/opt" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\MySQL AB\\MySQL Server 5.0;Location]/lib/opt" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\MySQL AB\\MySQL Server 5.1;Location]/lib/opt" + "c:/msys/local/include" + DOC "Specify the location of the mysql library here." + ) +endif( WIN32 ) + +# On Windows you typically don't need to include any extra libraries +# to build MYSQL stuff. + +if( NOT WIN32 ) + find_library( MYSQL_EXTRA_LIBRARIES + NAMES + z zlib + PATHS + /usr/lib + /usr/local/lib + DOC + "if more libraries are necessary to link in a MySQL client (typically zlib), specify them here." + ) +else( NOT WIN32 ) + set( MYSQL_EXTRA_LIBRARIES "" ) +endif( NOT WIN32 ) + +if( MYSQL_LIBRARY ) + if( MYSQL_INCLUDE_DIR ) + set( MYSQL_FOUND 1 ) + message(STATUS "Found MySQL library: ${MYSQL_LIBRARY}") + message(STATUS "Found MySQL headers: ${MYSQL_INCLUDE_DIR}") + else( MYSQL_INCLUDE_DIR ) + message(FATAL_ERROR "Could not find MySQL headers! Please install the development-libraries and headers.") + endif( MYSQL_INCLUDE_DIR ) + mark_as_advanced( MYSQL_FOUND MYSQL_LIBRARY MYSQL_EXTRA_LIBRARIES MYSQL_INCLUDE_DIR ) +else( MYSQL_LIBRARY ) + message(FATAL_ERROR "Could not find the MySQL libraries! Please install the development-libraries and headers.") +endif( MYSQL_LIBRARY ) diff --git a/cmake/FindOpenSSL.cmake b/cmake/FindOpenSSL.cmake new file mode 100644 index 0000000..d045b53 --- /dev/null +++ b/cmake/FindOpenSSL.cmake @@ -0,0 +1,92 @@ +# +# Find the OpenSSL client includes and library +# + +# This module defines +# OPENSSL_INCLUDE_DIR, where to find openssl.h +# OPENSSL_LIBRARIES, the libraries to link against to connect to MySQL +# OPENSSL_FOUND, if false, you cannot build anything that requires MySQL. + +# also defined, but not for general use are +# OPENSSL_LIBRARY, where to find the MySQL library. + +if( OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES ) + # in cache already + set(OPENSSL_FOUND 1) +else( OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES ) + set(OPENSSL_FOUND 0) + + if(WIN32) + if(PLATFORM MATCHES X64) + set(TMP_OPENSSL_INCLUDE_DIR + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/include/openssl" + ) + set(TMP_OPENSSL_LIBRARIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/lib" + ) + else() + set(TMP_OPENSSL_INCLUDE_DIR + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/include/openssl" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/include/openssl" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/include/openssl" + ) + set(TMP_OPENSSL_LIBRARIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib" + ) + endif() + endif() + + find_path(OPENSSL_INCLUDE_DIR + NAMES + ssl.h + PATHS + /usr/include + /usr/include/openssl + /usr/local/include + /usr/local/include/openssl + /usr/local/openssl/include + ${TMP_OPENSSL_INCLUDE_DIR} + DOC + "Specify the directory containing openssl.h." + ) + + find_library(OPENSSL_LIBRARIES + NAMES + ssleay32 + ssl + PATHS + /usr/lib + /usr/lib/ssl + /usr/local/lib + /usr/local/lib/ssl + /usr/local/ssl/lib + ${TMP_OPENSSL_LIBRARIES} + DOC "Specify the OpenSSL library here." + ) + + if( WIN32 ) + find_library(OPENSSL_EXTRA_LIBRARIES + NAMES + libeay32 + PATHS + ${TMP_OPENSSL_LIBRARIES} + DOC + "if more libraries are necessary to link in a OpenSSL client, specify them here." + ) + endif( WIN32 ) + + if( OPENSSL_LIBRARIES ) + if( OPENSSL_INCLUDE_DIR ) + set( OPENSSL_FOUND 1 ) + message(STATUS "Found OpenSSL library: ${OPENSSL_LIBRARIES}") + message(STATUS "Found OpenSSL headers: ${OPENSSL_INCLUDE_DIR}") + else ( OPENSSL_INCLUDE_DIR ) + message(FATAL_ERROR "Could not find OpenSSL headers! Please install the development-headers") + endif( OPENSSL_INCLUDE_DIR ) + else( OPENSSL_LIBRARIES ) + message(FATAL_ERROR "Could not find OpenSSL libraries! Please install the library before continuing") + endif( OPENSSL_LIBRARIES ) + mark_as_advanced( OPENSSL_FOUND OPENSSL_LIBRARIES OPENSSL_EXTRA_LIBRARIES OPENSSL_INCLUDE_DIR ) +endif( OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES ) diff --git a/cmake/FindPCHSupport.cmake b/cmake/FindPCHSupport.cmake new file mode 100644 index 0000000..d96a287 --- /dev/null +++ b/cmake/FindPCHSupport.cmake @@ -0,0 +1,315 @@ +# - Try to find precompiled headers support for GCC 3.4 and 4.x (and MSVC) +# Once done this will define: +# +# Variable: +# PCHSupport_FOUND +# +# Macro: +# ADD_PRECOMPILED_HEADER _targetName _input _dowarn +# ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use _dowarn +# ADD_NATIVE_PRECOMPILED_HEADER _targetName _input _dowarn +# GET_NATIVE_PRECOMPILED_HEADER _targetName _input + +IF(CMAKE_COMPILER_IS_GNUCXX) + + EXEC_PROGRAM( + ${CMAKE_CXX_COMPILER} + ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE gcc_compiler_version + ) + #MESSAGE("GCC Version: ${gcc_compiler_version}") + IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") + SET(PCHSupport_FOUND TRUE) + ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") + IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") + SET(PCHSupport_FOUND TRUE) + ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") + ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") + + SET(_PCH_include_prefix "-I") + +ELSE(CMAKE_COMPILER_IS_GNUCXX) + + IF(WIN32) + SET(PCHSupport_FOUND TRUE) # for experimental msvc support + SET(_PCH_include_prefix "/I") + ELSE(WIN32) + SET(PCHSupport_FOUND FALSE) + ENDIF(WIN32) + +ENDIF(CMAKE_COMPILER_IS_GNUCXX) + +MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) + + STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) + SET(${_out_compile_flags} ${${_flags_var_name}} ) + + IF(CMAKE_COMPILER_IS_GNUCXX) + GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) + IF(${_targetType} STREQUAL SHARED_LIBRARY AND NOT WIN32) + LIST(APPEND ${_out_compile_flags} "${${_out_compile_flags}} -fPIC") + ENDIF() + + ELSE(CMAKE_COMPILER_IS_GNUCXX) + ## TODO ... ? or does it work out of the box + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + + GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) + FOREACH(item ${DIRINC}) + LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}${item}") + ENDFOREACH(item) + + GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) + GET_DIRECTORY_PROPERTY(_global_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) + #MESSAGE("_directory_flags ${_directory_flags} ${_global_definitions}" ) + LIST(APPEND ${_out_compile_flags} ${_directory_flags}) + LIST(APPEND ${_out_compile_flags} ${_global_definitions}) + LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS} ) + + SEPARATE_ARGUMENTS(${_out_compile_flags}) + +ENDMACRO(_PCH_GET_COMPILE_FLAGS) + +MACRO(_PCH_WRITE_PCHDEP_CXX _targetName _include_file _dephelp) + + SET(${_dephelp} ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch_dephelp.cxx) + FILE(WRITE ${${_dephelp}} +"#include \"${_include_file}\" +int testfunction() +{ + return 0; +} +" + ) + +ENDMACRO(_PCH_WRITE_PCHDEP_CXX ) + +MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output) + + FILE(TO_NATIVE_PATH ${_input} _native_input) + FILE(TO_NATIVE_PATH ${_output} _native_output) + + + IF(CMAKE_COMPILER_IS_GNUCXX) + IF(CMAKE_CXX_COMPILER_ARG1) + # remove leading space in compiler argument + STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1}) + + SET(${out_command} + ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input} + ) + ELSE(CMAKE_CXX_COMPILER_ARG1) + SET(${out_command} + ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input} + ) + ENDIF(CMAKE_CXX_COMPILER_ARG1) + ELSE(CMAKE_COMPILER_IS_GNUCXX) + + SET(_dummy_str "#include <${_input}>") + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch_dummy.cpp ${_dummy_str}) + + SET(${out_command} + ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} /c /Fp${_native_output} /Yc${_native_input} pch_dummy.cpp + ) + #/out:${_output} + + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + +ENDMACRO(_PCH_GET_COMPILE_COMMAND ) + + + +MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn ) + + FILE(TO_NATIVE_PATH ${_pch_path} _native_pch_path) + + IF(CMAKE_COMPILER_IS_GNUCXX) + # for use with distcc and gcc >4.0.1 if preprocessed files are accessible + # on all remote machines set + # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess + # if you want warnings for invalid header files (which is very inconvenient + # if you have different versions of the headers for different build types + # you may set _pch_dowarn + IF (_dowarn) + SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include ${CMAKE_CURRENT_BINARY_DIR}/${_header_name} -Winvalid-pch " ) + ELSE (_dowarn) + SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include ${CMAKE_CURRENT_BINARY_DIR}/${_header_name} " ) + ENDIF (_dowarn) + ELSE(CMAKE_COMPILER_IS_GNUCXX) + + set(${_cflags} "/Fp${_native_pch_path} /Yu${_header_name}" ) + + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + +ENDMACRO(_PCH_GET_TARGET_COMPILE_FLAGS ) + +MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output) + GET_FILENAME_COMPONENT(_name ${_input} NAME) + GET_FILENAME_COMPONENT(_path ${_input} PATH) + SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch/${_targetName}_${CMAKE_BUILD_TYPE}.gch") +ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input) + + +MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use ) + + # to do: test whether compiler flags match between target _targetName + # and _pch_output_to_use + GET_FILENAME_COMPONENT(_name ${_input} NAME) + + IF( "${ARGN}" STREQUAL "0") + SET(_dowarn 0) + ELSE( "${ARGN}" STREQUAL "0") + SET(_dowarn 1) + ENDIF("${ARGN}" STREQUAL "0") + + + _PCH_GET_TARGET_COMPILE_FLAGS(_target_cflags ${_name} ${_pch_output_to_use} ${_dowarn}) + # MESSAGE("Add flags ${_target_cflags} to ${_targetName} " ) + SET_TARGET_PROPERTIES(${_targetName} + PROPERTIES + COMPILE_FLAGS ${_target_cflags} + ) + + ADD_CUSTOM_TARGET(pch_Generate_${_targetName} + DEPENDS ${_pch_output_to_use} + ) + + ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName} ) + +ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET) + +MACRO(ADD_PRECOMPILED_HEADER _targetName _input) + + SET(_PCH_current_target ${_targetName}) + + IF(NOT CMAKE_BUILD_TYPE) + MESSAGE(FATAL_ERROR + "This is the ADD_PRECOMPILED_HEADER macro. " + "You must set CMAKE_BUILD_TYPE!" + ) + ENDIF(NOT CMAKE_BUILD_TYPE) + + IF( "${ARGN}" STREQUAL "0") + SET(_dowarn 0) + ELSE( "${ARGN}" STREQUAL "0") + SET(_dowarn 1) + ENDIF("${ARGN}" STREQUAL "0") + + GET_FILENAME_COMPONENT(_name ${_input} NAME) + GET_FILENAME_COMPONENT(_path ${_input} PATH) + GET_PRECOMPILED_HEADER_OUTPUT( ${_targetName} ${_input} _output) + + GET_FILENAME_COMPONENT(_outdir ${_output} PATH ) + + GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) + _PCH_WRITE_PCHDEP_CXX(${_targetName} ${_input} _pch_dephelp_cxx) + + IF(${_targetType} STREQUAL SHARED_LIBRARY) + ADD_LIBRARY(${_targetName}_pch_dephelp STATIC ${_pch_dephelp_cxx} ) + ELSE(${_targetType} STREQUAL SHARED_LIBRARY) + ADD_LIBRARY(${_targetName}_pch_dephelp STATIC ${_pch_dephelp_cxx}) + ENDIF(${_targetType} STREQUAL SHARED_LIBRARY) + + FILE(MAKE_DIRECTORY ${_outdir}) + + _PCH_GET_COMPILE_FLAGS(_compile_FLAGS) + + #MESSAGE("_compile_FLAGS: ${_compile_FLAGS}") + #message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}") + SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${_name} PROPERTIES GENERATED 1) + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name} + COMMAND ${CMAKE_COMMAND} -E copy ${_input} ${CMAKE_CURRENT_BINARY_DIR}/${_name} # ensure same directory! Required by gcc + DEPENDS ${_input} + ) + + #message("_command ${_input} ${_output}") + _PCH_GET_COMPILE_COMMAND(_command ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_output} ) + + #message(${_input} ) + #message("_output ${_output}") + + ADD_CUSTOM_COMMAND( + OUTPUT ${_output} + COMMAND ${_command} + DEPENDS ${_input} ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_targetName}_pch_dephelp + ) + + ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_input} ${_output} ${_dowarn}) +ENDMACRO(ADD_PRECOMPILED_HEADER) + +# Generates the use of precompiled in a target, +# without using depency targets (2 extra for each target) +# Using Visual, must also add ${_targetName}_pch to sources +# Not needed by Xcode + +MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input) + + if(CMAKE_GENERATOR MATCHES Visual*) + + SET(_dummy_str "#include \"${_input}\"\n" + "// This is required to suppress LNK4221. Very annoying.\n" + "void *g_${_targetName}Dummy = 0\;\n") + + # Use of cxx extension for generated files (as Qt does) + SET(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cxx) + if(EXISTS ${${_targetName}_pch}) + # Check if contents is the same, if not rewrite + # todo + else(EXISTS ${${_targetName}_pch}) + FILE(WRITE ${${_targetName}_pch} ${_dummy_str}) + endif(EXISTS ${${_targetName}_pch}) + endif(CMAKE_GENERATOR MATCHES Visual*) + +ENDMACRO(GET_NATIVE_PRECOMPILED_HEADER) + +MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input) + + IF( "${ARGN}" STREQUAL "0") + SET(_dowarn 0) + ELSE( "${ARGN}" STREQUAL "0") + SET(_dowarn 1) + ENDIF("${ARGN}" STREQUAL "0") + + if(CMAKE_GENERATOR MATCHES Visual*) + # Auto include the precompile (useful for moc processing, since the use of + # precompiled is specified at the target level + # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) + + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + if (${oldProps} MATCHES NOTFOUND) + SET(oldProps "") + endif(${oldProps} MATCHES NOTFOUND) + + SET(newProperties "${oldProps} /Yu\"${_input}.h\" /FI\"${_input}.h\"") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") + + #also inlude ${oldProps} to have the same compile options + SET_SOURCE_FILES_PROPERTIES(${_input}.cpp PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}.h\"") + + else(CMAKE_GENERATOR MATCHES Visual*) + + if (CMAKE_GENERATOR MATCHES Xcode) + # For Xcode, cmake needs my patch to process + # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties + + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + if (${oldProps} MATCHES NOTFOUND) + SET(oldProps "") + endif(${oldProps} MATCHES NOTFOUND) + + # When buiding out of the tree, precompiled may not be located + # Use full path instead. + GET_FILENAME_COMPONENT(fullPath ${_input} ABSOLUTE) + + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") + + else (CMAKE_GENERATOR MATCHES Xcode) + + #Fallback to the "old" precompiled suppport + #ADD_PRECOMPILED_HEADER(${_targetName} ${_input} ${_dowarn}) + endif(CMAKE_GENERATOR MATCHES Xcode) + endif(CMAKE_GENERATOR MATCHES Visual*) + +ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) \ No newline at end of file diff --git a/cmake/FindPlatform.cmake b/cmake/FindPlatform.cmake new file mode 100644 index 0000000..60ce001 --- /dev/null +++ b/cmake/FindPlatform.cmake @@ -0,0 +1,16 @@ +# default to x86 platform. We'll check for X64 in a bit +SET(PLATFORM X86) + +# This definition is necessary to work around a bug with Intellisense described +# here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper +# debugger functionality. + +IF(CMAKE_SIZEOF_VOID_P MATCHES 8) + MESSAGE(STATUS "Detected 64-bit platform.") + if(WIN32) + ADD_DEFINITIONS("-D_WIN64") + ENDIF() + SET (PLATFORM X64) +ELSE() + MESSAGE(STATUS "Detected 32-bit platform.") +ENDIF() diff --git a/cmake/FindReadline.cmake b/cmake/FindReadline.cmake new file mode 100644 index 0000000..993ac51 --- /dev/null +++ b/cmake/FindReadline.cmake @@ -0,0 +1,22 @@ +# find Readline (terminal input library) includes and library +# +# READLINE_INCLUDE_DIR - where the directory containing the READLINE headers can be found +# READLINE_LIBRARY - full path to the READLINE library +# READLINE_FOUND - TRUE if READLINE was found + +MACRO(FIND_READLINE) + +FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h) +FIND_LIBRARY(READLINE_LIBRARY NAMES readline) + +IF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY) + SET(READLINE_FOUND TRUE) + MESSAGE(STATUS "Found Readline library: ${READLINE_LIBRARY}") + MESSAGE(STATUS "Include dir is: ${READLINE_INCLUDE_DIR}") + INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR}) +ELSE (READLINE_INCLUDE_DIR AND READLINE_LIBRARY) + SET(READLINE_FOUND FALSE) + MESSAGE(FATAL_ERROR "** Readline library not found!\n** Your distro may provide a binary for Readline e.g. for ubuntu try apt-get install libreadline5-dev") +ENDIF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY) + +ENDMACRO(FIND_READLINE) diff --git a/cmake/FindTermcap.cmake b/cmake/FindTermcap.cmake new file mode 100644 index 0000000..b3780d3 --- /dev/null +++ b/cmake/FindTermcap.cmake @@ -0,0 +1,33 @@ +# find Terrmcap (terminal input library) includes and library +# +# TERMCAP_INCLUDE_DIR - where the directory containing the TERMCAP headers can be found +# TERMCAP_LIBRARY - full path to the TERMCAP library +# TERMCAP_FOUND - TRUE if TERMCAP was found + +MACRO(FIND_TERMCAP) + +FIND_PATH(TERMCAP_INCLUDE_DIR termcap.h + /usr/include + /usr/local/include + + /opt/local/include +) + +FIND_LIBRARY(TERMCAP_LIBRARY NAMES termcap PATH + /usr/lib + /usr/local/lib + /opt/local/lib + /usr/lib64 +) + +IF (TERMCAP_INCLUDE_DIR AND TERMCAP_LIBRARY) + SET(TERMCAP_FOUND TRUE) + MESSAGE(STATUS "Found GNU termcap: ${TERMCAP_LIBRARY}") + MESSAGE(STATUS "Include dir is: ${TERMCAP_INCLUDE_DIR}") + INCLUDE_DIRECTORIES(${TERMCAP_INCLUDE_DIR}) +ELSE (TERMCAP_INCLUDE_DIR AND TERMCAP_LIBRARY) + SET(TERMCAP_FOUND FALSE) + MESSAGE(FATAL_ERROR "Could not find GNU termcap") +ENDIF (TERMCAP_INCLUDE_DIR AND TERMCAP_LIBRARY) + +ENDMACRO(FIND_TERMCAP) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 0000000..06f9c82 --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,23 @@ +# from cmake wiki +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"${file}\"") + IF(EXISTS "${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF("${rm_retval}" STREQUAL 0) + ELSE("${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") + ENDIF("${rm_retval}" STREQUAL 0) + ELSE(EXISTS "${file}") + MESSAGE(STATUS "File \"${file}\" does not exist.") + ENDIF(EXISTS "${file}") +ENDFOREACH(file) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..b017c89 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,8 @@ +#ifndef HAVE_CONFIG_H +#define HAVE_CONFIG_H + +#cmakedefine HAVE_ACE_STACK_TRACE_H + +#cmakedefine USE_MULTI_THREAD_MAP + +#endif /* HAVE_CONFIG_H */ diff --git a/contrib/cleanup/tab2spaces.sh b/contrib/cleanup/tab2spaces.sh new file mode 100644 index 0000000..1022be7 --- /dev/null +++ b/contrib/cleanup/tab2spaces.sh @@ -0,0 +1,2 @@ +# Be sure to specify files instead of * when running the script. +perl -p -i -e "s/\t/ /g" * diff --git a/contrib/cleanup/whitespace.sh b/contrib/cleanup/whitespace.sh new file mode 100644 index 0000000..a351e25 --- /dev/null +++ b/contrib/cleanup/whitespace.sh @@ -0,0 +1,2 @@ +# Be sure to specify files instead of * when running the script. +perl -p -i -e "s/ +$//g" * diff --git a/contrib/conf_merge/README b/contrib/conf_merge/README new file mode 100644 index 0000000..3d027b7 --- /dev/null +++ b/contrib/conf_merge/README @@ -0,0 +1,6 @@ +This is a PHP script for merging a new .dist file with your existing .conf file (trinitycore and trinityrealm) +It should also work with mangos dist/conf files as well. + +It uses sessions so it is multi user safe, it adds any options that are removed to the bottom of the file, +commented out, just in case it removes something it shouldn't, +and, if you add all of your custom patch configs below "# Custom" they will be copied exactly as they are. diff --git a/contrib/conf_merge/index.php b/contrib/conf_merge/index.php new file mode 100644 index 0000000..537937c --- /dev/null +++ b/contrib/conf_merge/index.php @@ -0,0 +1,40 @@ + + +
+Dist File +
+ +
+Current Conf File +
+ +
+Win32 - +UNIX/Linux +
+ +
+If you have any custom settings, such as from patches, +
+make sure they are at the bottom of the file following +
+this block (add it if it's not there) +
+############################################################################### +
+# Custom +
+############################################################################### +
+
+ +
diff --git a/contrib/conf_merge/merge.php b/contrib/conf_merge/merge.php new file mode 100644 index 0000000..6d8bedb --- /dev/null +++ b/contrib/conf_merge/merge.php @@ -0,0 +1,159 @@ + $v) + { + if (array_key_exists($k, $array1)) + { + $array1[$k] = $v; + unset($array2[$k]); + } + } + $in_file1 = fopen($upload1,r); + $line = trim(fgets($in_file1)); + while (!feof($in_file1)) + { + if (substr($line,0,1) != '#' && substr($line,0,1) != '') + { + $array = array(); + while (substr($line,0,1) != '#' && substr($line,0,1) != '') + { + list($key, $val) = explode("=",$line); + $key = trim($key); + $val = trim($val); + $array[$key] = $val; + $line = trim(fgets($in_file1)); + } + foreach($array as $k => $v) + { + if (array_key_exists($k, $array1)) + fwrite($out_file, $k."=".$array1[$k].$eol); + else + continue; + } + unset($array); + if (!feof($in_file1)) + fwrite($out_file, $line.$eol); + } + else + fwrite($out_file, $line.$eol); + $line = trim(fgets($in_file1)); + } + if ($custom_found) + { + fwrite($out_file, $eol); + fwrite($out_file, "###############################################################################".$eol); + fwrite($out_file, "# Custom".$eol); + $line = trim(fgets($in_file2)); + while (!feof($in_file2)) + { + fwrite($out_file, $line.$eol); + $line = trim(fgets($in_file2)); + } + } + $first = true; + foreach($array2 as $k => $v) + { + if ($first) + { + fwrite($out_file, $eol); + fwrite($out_file, "###############################################################################".$eol); + fwrite($out_file, "# The Following values were removed from the config.".$eol); + $first = false; + } + fwrite($out_file, "# ".$k."=".$v.$eol); + } + unset($array1); + unset($array2); + fclose($in_file1); + fclose($in_file2); + fclose($out_file); + unlink($upload1); + unlink($upload2); + + echo "Process done"; + echo "
Click here to retrieve your merged conf"; + } +} +else +{ + echo "An error has occurred"; +} +?> diff --git a/docs/AuctionHouseBot.txt b/docs/AuctionHouseBot.txt new file mode 100644 index 0000000..cc15a08 --- /dev/null +++ b/docs/AuctionHouseBot.txt @@ -0,0 +1,236 @@ +Populates the auction houses with items. It can make the game feel a bit more +like official on small servers. Items and prices are chosen randomly based on +the parameters you define. If an auction expires, auctions are deleted quietly. +AHBot will not buy it's own items, and will not receive mail from the AH +or get returned mail. + +=============================================================================== +~~HOW TO CONFIGURE~~ +=============================================================================== +Step 1.) Create a character that you are going to use as the auction house bot + character. This character will be the auction's owner for all the + items created by the bot. +Step 2.) Go into the realm database and note the account number for the + character. +Step 3.) Go into the characters database and note the character's GUID. +Step 4.) Log in at least once with this character. + (Do not change the configuration before this) +Step 5.) Tune the configuration options in the configuration file and the + Database. + +#These are the settings in the configuration file: +AuctionHouseBot.DEBUG = 0 +AuctionHouseBot.EnableSeller = 0 +AuctionHouseBot.EnableBuyer = 0 +AuctionHouseBot.UseBuyPriceForSeller = 0 +AuctionHouseBot.UseBuyPriceForBuyer = 0 +AuctionHouseBot.Account = 0 +AuctionHouseBot.GUID = 0 +AuctionHouseBot.ItemsPerCycle = 200 + +AuctionHouseBot.DEBUG enables (1) or disables (0) Debug output +AuctionHouseBot.EnableSeller enables (1) or disables (0) the Seller +AuctionHouseBot.EnableBuyer enables (1) or disables (0) the Buyer +AuctionHouseBot.UseBuyPriceForSeller Use SellPrice (0) or BuyPrice (1) for determining prices +AuctionHouseBot.UseBuyPriceForBuyer Use SellPrice (0) or BuyPrice (1) for determining prices +AuctionHouseBot.Account is the account number (in realmd->account table) of the player you want to run as the auction bot. Note: a value of 0 will disable the bot. +AuctionHouseBot.GUID is the GUID (in characters->characters table) of the player you want to run as the auction bot. Note: a value of 0 will disable the bot. +AuctionHouseBot.ItemsPerCycle determines how many items are added each time AHBot is run (once per minute, by default) + +#These are the Filters For filtering certain items/trade goods from the AH +AuctionHouseBot.VendorItems = 0 +AuctionHouseBot.VendorTradeGoods = 0 +AuctionHouseBot.LootItems = 1 +AuctionHouseBot.LootTradeGoods = 1 +AuctionHouseBot.OtherItems = 0 +AuctionHouseBot.OtherTradeGoods = 0 +AuctionHouseBot.No_Bind = 1 +AuctionHouseBot.Bind_When_Picked_Up = 0 +AuctionHouseBot.Bind_When_Equipped = 1 +AuctionHouseBot.Bind_When_Use = 1 +AuctionHouseBot.Bind_Quest_Item = 0 +AuctionHouseBot.DisableBeta_PTR_Unused = 0 +AuctionHouseBot.DisablePermEnchant = 0 +AuctionHouseBot.DisableConjured = 0 +AuctionHouseBot.DisableGems = 0 +AuctionHouseBot.DisableMoney = 0 +AuctionHouseBot.DisableMoneyLoot = 0 +AuctionHouseBot.DisableLootable = 0 +AuctionHouseBot.DisableKeys = 0 +AuctionHouseBot.DisableDuration = 0 +AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel = 0 + +AuctionHouseBot.VendorItems is a boolean value (0 or 1) that indicates whether to include Vendor only items +AuctionHouseBot.VendorTradeGoods is a boolean value (0 or 1) that indicates whether to include Vendor only Trade Goods +AuctionHouseBot.LootItems is a boolean value (0 or 1) that indicates whether to include Loot/Fish/Skin/etc. only items +AuctionHouseBot.LootTradeGoods is a boolean value (0 or 1) that indicates whether to include Loot/Fish/Skin/etc. only Trade Goods +AuctionHouseBot.OtherItems is a boolean value (0 or 1) that indicates whether to include Other items not covered by the first 2 +AuctionHouseBot.OtherTradeGoods is a boolean value (0 or 1) that indicates whether to include Other Trade Goods not covered by the first 2 +AuctionHouseBot.No_Bind is a boolean value (0 or 1) that indicates whether to include items with a bonding of 0 +AuctionHouseBot.Bind_When_Picked_Up = is a boolean value (0 or 1) that indicates whether to include items with a bonding of 1 +AuctionHouseBot.Bind_When_Equipped = is a boolean value (0 or 1) that indicates whether to include items with a bonding of 2 +AuctionHouseBot.Bind_When_Use = is a boolean value (0 or 1) that indicates whether to include items with a bonding of 3 +AuctionHouseBot.Bind_Quest_Item = is a boolean value (0 or 1) that indicates whether to include items with a bonding of 4 +AuctionHouseBot.DisableBeta_PTR_Unused is a boolean value (0 or 1) that will Disable certain items that are usually unavailable to Players +AuctionHouseBot.DisablePermEnchant is a boolean value (0 or 1) that will Disable Items with a Permanent Enchantment +AuctionHouseBot.DisableConjured is a boolean value (0 or 1) that will Disable Conjured Items +AuctionHouseBot.DisableGems is a boolean value (0 or 1) that will Disable Gems +AuctionHouseBot.DisableMoney is a boolean value (0 or 1) that will Disable Items that are used as money +AuctionHouseBot.DisableMoneyLoot is a boolean value (0 or 1) that will Disable Items that have Money as a loot +AuctionHouseBot.DisableLootable is a boolean value (0 or 1) that will Disable Items that have other items as loot +AuctionHouseBot.DisableKeys is a boolean value (0 or 1) that will Disable Items that are keys +AuctionHouseBot.DisableDuration is a boolean value (0 or 1) that will Disable Items with a duration +AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel is a boolean value (0 or 1) that will Disable items that are BOP or Quest Item with a Required level that is less than the Item Level + +#These Filters are boolean (0 or 1) and will disable items that are +#specifically meant for the Class named. +#(UnusedClass is Class 10, which was skipped for some reason) +AuctionHouseBot.DisableWarriorItems = 0 +AuctionHouseBot.DisablePaladinItems = 0 +AuctionHouseBot.DisableHunterItems = 0 +AuctionHouseBot.DisableRogueItems = 0 +AuctionHouseBot.DisablePriestItems = 0 +AuctionHouseBot.DisableDKItems = 0 +AuctionHouseBot.DisableShamanItems = 0 +AuctionHouseBot.DisableMageItems = 0 +AuctionHouseBot.DisableWarlockItems = 0 +AuctionHouseBot.DisableUnusedClassItems = 0 +AuctionHouseBot.DisableDruidItems = 0 + +#These are the Filters For filtering certain items/trade goods from the AH +AuctionHouseBot.DisableItemsBelowLevel = 0 +AuctionHouseBot.DisableItemsAboveLevel = 0 +AuctionHouseBot.DisableTGsBelowLevel = 0 +AuctionHouseBot.DisableTGsAboveLevel = 0 +AuctionHouseBot.DisableItemsBelowGUID = 0 +AuctionHouseBot.DisableItemsAboveGUID = 0 +AuctionHouseBot.DisableTGsBelowGUID = 0 +AuctionHouseBot.DisableTGsAboveGUID = 0 +AuctionHouseBot.DisableItemsBelowReqLevel = 0 +AuctionHouseBot.DisableItemsAboveReqLevel = 0 +AuctionHouseBot.DisableTGsBelowReqLevel = 0 +AuctionHouseBot.DisableTGsAboveReqLevel = 0 +AuctionHouseBot.DisableItemsBelowReqSkillRank = 0 +AuctionHouseBot.DisableItemsAboveReqSkillRank = 0 +AuctionHouseBot.DisableTGsBelowReqSkillRank = 0 +AuctionHouseBot.DisableTGsAboveReqSkillRank = 0 + +#These are the settings in the Database: +#Each Auctionhouse has it's own set of these + +MinItems = 0 +#The Minimum number of items you want to keep in the auction houses. +#(default 0 - minimum will be the same as maximum). +#If it is higher than the value of the corresponding maxItems setting, +#it will be set down to match the maxItems setting. + +MaxItems = 0 +#The Maximum number of items you want to keep in the auction houses. + +#These must add up to 100 each one is the percentage +#of the auction items that should be trade goods of +#that quality. A value of 0 will disable. + +PercentGreyTradeGoods = 0 +PercentWhiteTradeGoods = 27 +PercentGreenTradeGoods = 12 +PercentBlueTradeGoods = 10 +PercentPurpleTradeGoods = 1 +PercentOrangeTradeGoods = 0 +PercentYellowTradeGoods = 0 + +PercentGreyItems = 0 +PercentWhiteItems = 10 +PercentGreenItems = 30 +PercentBlueItems = 8 +PercentPurpleItems = 2 +PercentOrangeItems = 0 +PercentYellowItems = 0 + +#MinPrice(Color) is the minimum price adjustment for items. For example the default is 150, which means 150%. So if an item vendors for 1g it would go to auction for a minimum of 1.5g. +#MaxPrice(Color) is the maximum price adjustment for items. +#MinBidPrice(Color) these two control the starting bid as a percent of the buyout price. For example, if MinBidPrice is 30 and MaxBidPrice is 80 the starting bid for the auction will randomly be between 30-80% of the randomly chosen buyout price. +#MaxBidPrice(Color) these two control the starting bid as a percent of the buyout price. For example, if MinBidPrice is 30 and MaxBidPrice is 80 the starting bid for the auction will randomly be between 30-80% of the randomly chosen buyout price. +#MaxStack(Color) is maximum stack size to create for this quality type. A value of zero will disable the maximum stack size for this quality allowing the bot to create stacks (of random size) of items as big as the item type allows. + +MinPriceGrey = 100 +MaxPriceGrey = 150 +MinBidPriceGrey = 70 +MaxBidPriceGrey = 100 +MaxStackGrey = 0 +MinPriceWhite = 150 +MaxPriceWhite = 250 +MinBidPriceWhite = 70 +MaxBidPriceWhite = 100 +MaxStackWhite = 0 +MinPriceGreen = 800 +MaxPriceGreen = 1400 +MinBidPriceGreen = 80 +MaxBidPriceGreen = 100 +MaxStackGreen = 0 +MinPriceBlue = 1250 +MaxPriceBlue = 1750 +MinBidPriceBlue = 75 +MaxBidPriceBlue = 100 +MaxStackBlue = 0 +MinPricePurple = 2250 +MaxPricePurple = 4550 +MinBidPricePurple = 80 +MaxBidPricePurple = 100 +MaxStackPurple = 0 +MinPriceOrange = 4250 +MaxPriceOrange = 5550 +MinBidPriceOrange = 80 +MaxBidPriceOrange = 100 +MaxStackOrange = 0 +MinPriceYellow = 5250 +MaxPriceYellow = 6550 +MinBidPriceYellow = 80 +MaxBidPriceYellow = 100 +MaxStackYellow = 0 + +#These are the multipliers that are applied to the vendor price for an item, that determines if AHBot will buy it or not. +#1 means AHBot will pay the same as (or less than) a vendor would pay, 2 means up to twice as much, etc. + +BuyerPriceGrey = 1 +BuyerPriceWhite = 3 +BuyerPriceGreen = 5 +BuyerPriceBlue = 12 +BuyerPricePurple = 15 +BuyerPriceOrange = 20 +BuyerPriceYellow = 22 + +#BuyerBiddingInterval is the time (in minutes) between bids. +#BuyerBidsPerInterval is the number of bids the buyer will make in a cycle + +BuyerBiddingInterval = 1 +BuyerBidsPerInterval = 1 + + + +How to use ahcommands from the console (CLI) or in game with GM level 3 players: +ahbotoptions - will display usage instructions +ahbotoptions help - will display the list of commands + +ahexpire - will expire all the auctions in the requested auction house that were created by AHBot. +minitems - will set the minimum number of items in the AH before it starts being filled again. +maxitems - will set the maximum number of items in the AH. +percentages - will set the percentage of each quality in the AH +minprice - will set the minimum price multiplier for auctions. +maxprice - will set the maximum price multiplier for auctions. +minbidprice - will set the minimum starting bid as a percent of the buyout price for auctions. +maxbidprice - will set the maximum starting bid as a percent of the buyout price for auctions. +maxstack - will set the maximum number of items in stacks for auctions. 0 will set the maximum to the maximum for that item type. +buyerprice - will set the bid price multiplier for auctions. +biddinginterval - will set the number of minutes between bids on auctions. +bidsperinterval - will set the number of bids to enter per cycle. + +The auction house IDs are: +2 - Alliance +6 - Horde +7 - Neutral + + +AHBot Originally made by Chris K. Currently maintained by Paradox +Much thanks to Chris K, grether and Dolomit6! +AHBot Now includes AHBuyer created by Kerbe as a derivative of AHBot, and later modified by Paradox diff --git a/docs/DocStructure.dox b/docs/DocStructure.dox new file mode 100644 index 0000000..dee8b5a --- /dev/null +++ b/docs/DocStructure.dox @@ -0,0 +1,31 @@ +/*! \mainpage + * + * \section intro_sec Introduction and links + * This is the source documentation for the \b %MaNGOS (Massive Network Game %Object Server) project.\n + * %MaNGOS is an object-oriented Massively Multiplayer Online Role-Playing Game Server (MMORPGS).\n + * The project documentation and the bug tracker can be found on the %MaNGOS wiki. + * + * \section begin Where to begin? + * If you are interested in understanding the source code of this project you can begin + * - On the wiki to get an overview of the different modules of the server + * - In this source doumentation, starting at the module hierarchy + */ + +/*! \defgroup realmd Realm Daemon + */ + +/*! \defgroup mangos Mangos Deamon + */ + +/*! \defgroup mangosd Daemon starter + \ingroup mangos + */ + +/*! \defgroup u2w User Connections + \ingroup mangos + */ + +/*! \defgroup world The World + \ingroup mangos + */ + diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in new file mode 100644 index 0000000..9893593 --- /dev/null +++ b/docs/Doxyfile.in @@ -0,0 +1,1314 @@ +# Doxyfile 1.5.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = @PACKAGE@ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = @VERSION@ + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = @top_srcdir@/ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = "memo=\par Note:\n " \ + "draft=\xrefitem draft \"Draft\" \"Draft List\" This API may be changed in the future versions and was introduced in " \ + "stable=\xrefitem stable \"Stable\" \"Stable List\" " \ + "deprecated=\xrefitem deprecated \"Deprecated\" \"Deprecated List\" " \ + "obsolete=\xrefitem obsolete \"Obsolete\" \"Obsolete List\" " \ + "system=\xrefitem system \"System\" \"System List\" \n Do not use unless you know what you are doing. " \ + "internal=\xrefitem internal \"Internal\" \"Internal List\" Do not use. This API is for interal use only. " + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text " + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = @top_srcdir@/src/shared/ \ + @top_srcdir@/src/shared/Auth/ \ + @top_srcdir@/src/shared/Database/ \ + @top_srcdir@/src/game/ \ + @top_srcdir@/src/realmd/ \ + @top_srcdir@/src/mangosd/ \ + DocStructure.dox + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = *.cpp \ + *.h \ + *.hpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = config*.h + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = YES + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = YES + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = U_EXPORT2 \ + U_STABLE \ + U_DRAFT \ + U_INTERNAL \ + U_SYSTEM \ + U_DEPRECATED \ + U_OBSOLETE + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = "@srcdir@/html/mangos-ng-docs.tag " + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = YES diff --git a/docs/EventAI.txt b/docs/EventAI.txt new file mode 100644 index 0000000..7d0294d --- /dev/null +++ b/docs/EventAI.txt @@ -0,0 +1,868 @@ +============================================= +EventAI documentation: (updated May 19, 2009) +============================================= + +EventAI allows users to create new creature scripts entierly within the database. + +For the AI to be used, you must first make sure to set AIname for each creature that should use this AI. +UPDATE creature_template SET AIName = 'EventAI' WHERE entry IN (...); + + +========================================= +Basic structure of EventAI +========================================= + +EventAI follows a basic if (Event) then do (Action) format. +Below is the list of current fields of the creature_ai_scripts table. + +(Field_Name) (Description) +id This value is merely an incrementing counter of the current Event number. Required for sql queries. +creature_id Creature id which should trigger this event. + +event_type The type of event (see "Event types" below) +event_inverse_phase_mask Mask with phases this event should NOT trigger in* +event_chance Percentage chance of triggering the event (1 - 100) +event_flags Event flags (repeatable, ... (see below)) +event_param1 Variables for the event (depends on event_type) +event_param2 +event_param3 +event_param4 + +action1_type An action to take when the event occurs (see "Action types" below) +action1_param1 Variables used by Action1 (depends on action_type) +action1_param2 +action1_param3 + +action2_type +action2_param1 +action2_param2 +action2_param3 + +action3_type +action3_param1 +action3_param2 +action3_param3 + +All params are signed 32-bit values (+/- 2147483647). Time values are always in milliseconds. +In case of a percentage value, use value/100 (ie. param = 500 then that means 500%, -50 = -50%) + +[*] Phase mask is a bitmask of phases which shouldn't trigger this event. (ie. Phase mask of value 12 (binary 1100) results in triggering this event in phases 0, 1 and all others with exception for phases 2 and 3 (counting from 0). + + +========================================= +Event types +========================================= + +A list of event types EventAI is able to handle. +Each event type has its own specific interpretation of the params that accompany it. +Params are always read in the ascending order (from Param1 to Param3). +Events will not repeat until the creature exits combat or unless EFLAG_REPEATABLE is set. +Some events such as EVENT_T_AGGRO, EVENT_T_DEATH, EVENT_T_SPAWNED, and EVENT_T_EVADE cannot repeat. + +# Internal name Param usage Description +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +0 EVENT_T_TIMER InitialMin, InitialMax, RepeatMin, RepeatMax Expires at first between (Param1) and (Param2) and then between every (Param3) and (Param4), but only in combat. +1 EVENT_T_TIMER_OOC InitialMin, InitialMax, RepeatMin, RepeatMax Expires at first between (Param1) and (Param2) and then between every (Param3) and (Param4), but only out of combat. +2 EVENT_T_HP HPMax%, HPMin%, RepeatMin, RepeatMax Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +3 EVENT_T_MANA ManaMax%,ManaMin% RepeatMin, RepeatMax Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +4 EVENT_T_AGGRO NONE Expires upon initial aggro (does not repeat). +5 EVENT_T_KILL RepeatMin, RepeatMax Expires upon killing a player. Will repeat between (Param1) and (Param2). +6 EVENT_T_DEATH NONE Expires upon creature death. +7 EVENT_T_EVADE NONE Expires upon creature EnterEvadeMode(). +8 EVENT_T_SPELLHIT SpellID, Schoolmask, RepeatMin, RepeatMax Expires upon a spell hit. When (param1) is set, it will be used as a trigger. With (param2) specified, the expiration is limited to specific spell schools (-1 for all). Will repeat every (Param3) and (Param4). +9 EVENT_T_RANGE MinDist, MaxDist, RepeatMin, RepeatMax Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4). +10 EVENT_T_OOC_LOS Hostile-or-Not, MaxAllowedRange, RepeatMin, RepeatMax Expires when a unit moves within distance (MaxAllowedRange) of a creature. If (Param1) is zero it will expire only when unit is hostile, friendly otherwise (Param1 = 1), depends generally on faction. Will repeat every (Param3) and (Param4). Does not expire when the creature is in combat. +11 EVENT_T_SPAWNED NONE Expires on initial spawn and on creature respawn (useful for setting ranged movement type). +12 EVENT_T_TARGET_HP HPMax%, HPMin%, RepeatMin, RepeatMax Expires when current target's HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +13 EVENT_T_TARGET_CASTING RepeatMin, RepeatatMax Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2). +14 EVENT_T_FRIENDLY_HP HPDeficit, Radius, RepeatMin, RepeatMax Expires when a friendly unit in radius has at least (Param1) HP missing. Will repeat every (Param3) and (Param4). +15 EVENT_T_FRIENDLY_IS_CC DispelType, Radius, RepeatMin, RepeatMax Expires when a friendly unit is crowd controlled within the given radius (Param2). Will repeat every (Param3) and (Param4). +16 EVENT_T_MISSING_BUFF SpellId, Radius, RepeatMin, RepeatMax Expires when a friendly unit is missing aura(s) given by a spell (Param1) within radius (Param2). Will repeat every (Param3) and (Param4). +17 EVENT_T_SUMMONED_UNIT CreatureId, RepeatMin, RepeatMax Expires after creature with entry = (Param1) is spawned (Param1 = 0 means all spawns). Will repeat every (Param2) and (Param3). +18 EVENT_T_TARGET_MANA ManaMax%, ManaMin%, RepeatMin, RepeatMax +21 EVENT_T_REACHED_HOME NONE Expires when a creature reach it's home(spawn) location after evade. +22 EVENT_T_RECEIVE_EMOTE EmoteId, Condition, CondValue1, CondValue2 Expires when a creature receives an emote with emote text id (enum TextEmotes) in (Param1). Conditions can be defined (Param2) with optional values (Param3,Param4), see enum ConditionType. +23 EVENT_T_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a creature has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4). +24 EVENT_T_TARGET_BUFFED SpellID, AmmountInStack, RepeatMin, RepeatMax Expires when a target unit has spell (Param1) auras applied in a stack greater or equal to value provided in (Param2). Will repeat every (Param3) and (Param4). +35 EVENT_T_RESET NONE Expires when creature leaves combat, spawns or respawns. + +========================================= +Action Types +========================================= + +A list of action types that EventAI can handle. +Each event type has its own specific interpretation of it's params, like every event type. + +# Internal name Param usage Description +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +0 ACTION_T_NONE No Action Does nothing. +1 ACTION_T_TEXT -TextId1, -TextId2, -TextId3 Simply displays the specified -TextId. When -TextId2 and -TextId3 are specified, the selection will be randomized. Text types are defined, along with other options for the text, in a table below. All values needs to be negative. +2 ACTION_T_SET_FACTION FactionId Changes faction for a creature. When param1 is zero, creature will revert to it's default faction. +3 ACTION_T_MORPH_TO_ENTRY_OR_MODEL CreatureEntry, ModelId Set either model from creature_template.entry (Param1) OR explicit modelId (Param2). If (Param1) AND (Param2) are both 0, demorph and revert to the default model. +4 ACTION_T_SOUND SoundId Plays a sound +5 ACTION_T_EMOTE EmoteId Does an emote +6 ACTION_T_RANDOM_SAY UNUSED +7 ACTION_T_RANDOM_YELL UNUSED +8 ACTION_T_RANDOM_TEXTEMOTE UNUSED +9 ACTION_T_RANDOM_SOUND SoundId1, SoundId2, SoundId3 Plays a random sound * +10 ACTION_T_RANDOM_EMOTE EmoteId1, EmoteId2, EmoteId3 Emotes a random emote +11 ACTION_T_CAST SpellId, Target, CastFlags Casts spell (Param1) on a target (Param2) using cast flags (specified below). +12 ACTION_T_SUMMON CreatureID, Target, Duration Summons a creature (Param1) for (Param3) duration and orders it to attach (Param2) target. Spawns on top of current creature. +13 ACTION_T_THREAT_SINGLE_PCT Threat%, Target Modifies a threat by (Param1) percent on a target (Param2). +14 ACTION_T_THREAT_ALL_PCT Threat% Modifies a threat by (Param1) on all targets in the threat list (using -100% here will result in full aggro dump). +15 ACTION_T_QUEST_EVENT QuestID, Target Calls AreaExploredOrEventHappens with (Param1) for a target in (Param2). +16 ACTION_T_QUEST_CASTCREATUREGO CreatureID, SpellId, Target Sends CastCreatureOrGo for a creature specified by CreatureId (Param1) with provided spell id (Param2) for a target in (Param3). +17 ACTION_T_SET_UNIT_FIELD Field_Number, Value, Target Sets a unit field (Param1) to provided value (Param2) on a target in (Param3). +18 ACTION_T_SET_UNIT_FLAG Flags, Target Sets flag (flags can be used together to modify multiple flags at once) on a target (Param2). +19 ACTION_T_REMOVE_UNIT_FLAG Flags, Target Removes flag on a target (Param2). +20 ACTION_T_AUTO_ATTACK AllowAutoAttack Stop melee attack when (Param1) is zero, otherwise continue attacking / allow melee attack. +21 ACTION_T_COMBAT_MOVEMENT AllowCombatMovement Stop combat based movement when (Param1) is zero, otherwise continue/allow combat based movement (targeted movement generator). +22 ACTION_T_SET_PHASE Phase Sets the current phase to (Param1). +23 ACTION_T_INC_PHASE Value Increments the phase by (Param1). May be negative to decrement, but should not be zero. +24 ACTION_T_EVADE No Params Forces the creature to evade, wiping all threat and dropping combat. +25 ACTION_T_FLEE_FOR_ASSIST No Params Causes the creature to flee for assistence (often at low health). +26 ACTION_T_QUEST_EVENT_ALL QuestId Calls GroupEventHappens with (Param1). Only used if it's _expected_ event should call quest completion for all players in a current party. +27 ACTION_T_CASTCREATUREGO_ALL QuestId, SpellId Calls CastedCreatureOrGo for all players on the threat list with quest id specified in (Param1) and spell id in (Param2). +28 ACTION_T_REMOVEAURASFROMSPELL Target, Spellid Removes all auras on a target (Param1) caused by a spell (Param2). +29 ACTION_T_RANGED_MOVEMENT Distance, Angle Changes the movement generator to a ranged type. (note: default melee type can still be set by using 0 as angle and 0 as distance). +30 ACTION_T_RANDOM_PHASE PhaseId1, PhaseId2, PhaseId3 Sets a phase to a specified id(s)* +31 ACTION_T_RANDOM_PHASE_RANGE PhaseMin, PhaseMax Sets a phase to a random id (Phase = PhaseMin + rnd % PhaseMin-PhaseMax). PhaseMax must be greater than PhaseMin. +32 ACTION_T_SUMMON CreatureID, Target, SummonID Summons a creature (Param1) to attack target (Param2) at location specified by EventAI_Summons (Param3). +33 ACTION_T_KILLED_MONSTER CreatureID, Target Calls KilledMonster (Param1) for a target (Param2). +34 ACTION_T_SET_INST_DATA Field, Data Calls ScriptedInstance::SetData with field (Param1) and data (Param2). +35 ACTION_T_SET_INST_DATA64 Field, Target Calls ScriptedInstance::SetData64 with field (Param1) and target's GUID (Param2). +36 ACTION_T_UPDATE_TEMPLATE TemplateId, Team Changes a creature's template to (Param1) with team = Alliance or Horde when (Param2) is either false or true respectively. +37 ACTION_T_DIE No Params Kills the creature +38 ACTION_T_ZONE_COMBAT_PULSE No Params Puts all players within an instance into combat with the creature. Only works when a creature is already in combat. Doesn't work outside instances. +39 ACTION_T_CALL_FOR_HELP Radius Call any friendly out-of-combat creatures in a radius (Param1) to attack current creature's target. +40 ACTION_T_SET_SHEATH Sheath Sets sheath state for a creature (0 = no weapon, 1 = melee weapon, 2 = ranged weapon). +41 ACTION_T_FORCE_DESPAWN No Params Despawns the creature +42 ACTION_T_SET_INVINCIBILITY_HP_LEVEL hp_level, is_percent Set min. health level for creature that can be set at damage as flat value or percent from max health + +* = Use -1 where the param is expected to do nothing. Random constant is generated for each event, so if you have a random yell and a random sound, they will be linked up with each other (ie. param2 with param2). + + +========================================= +Event Types +========================================= +Note: +COMBAT ONLY - Means that this event will only trigger durring combat. +OUT OF COMBAT ONLY - Means that this event will only trigger while out of combat. +BOTH - This event can trigger both in and out of combat. + +Events that do not have lables on them are events that are directly involved with the in and out of combat state. + +------------------ +0 = EVENT_T_TIMER: +------------------ +Parameter 1: InitialMin - Minumum Time used to calculate Random Initial Expire +Parameter 2: InitialMax - Maximum Time used to calculate Random Initial Expire +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +COMBAT ONLY! - Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4) from then on. +This is commonly used for spells that repeat cast during combat (Simulate Spell Cooldown). + +---------------------- +1 = EVENT_T_TIMER_OOC: +---------------------- +Parameter 1: InitialMin - Minumum Time used to calculate Random Initial Expire +Parameter 2: InitialMax - Maximum Time used to calculate Random Initial Expire +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +OUT OF COMBAT ONLY! - Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4) from then on. +This is commonly used for events that occur and repeat outside of combat. + +--------------- +2 = EVENT_T_HP: +--------------- +Parameter 1: HPMax% - Maximum HP% That this Event will Expire +Parameter 2: HPMin% - Minimum HP% That this Event will Expire +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +BOTH - Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +This is commonly used for events that trigger at a specific HP% (Such as Heal/Enrage Spells or NPC's that Flee). + +----------------- +3 = EVENT_T_MANA: +----------------- +Parameter 1: ManaMax% - Maximum Mana% That this Event will Expire +Parameter 2: ManaMin% - Minimum Mana% That this Event will Expire +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +BOTH - Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +This is commonly used for events where an NPC low on Mana will do something (Such as stop casting spells and switch to melee). + +------------------ +4 = EVENT_T_AGGRO: +------------------ +This Event Expires upon initial aggro (does not repeat). + +----------------- +5 = EVENT_T_KILL: +----------------- +Parameter 1: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 2: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +COMBAT ONLY! - Expires upon killing a player. Will repeat every (Param1) and (Param2). +This Event Expires upon killing a player. It is commonly used for NPC's who yell or do something after killing a player. + +------------------ +6 = EVENT_T_DEATH: +------------------ +This Event Expires upon Death of the Scripted NPC. +This is commonly used for NPC's who have a yell on death or cast some kind if summon spell when they die. + +------------------ +7 = EVENT_T_EVADE: +------------------ +This Event Expires upon the creature EnterEvadeMode(). +This is commonly used for NPC's who use phases, allows you to reset their phase to 0 upon evade to prevent possible strange behavior. + +--------------------- +8 = EVENT_T_SPELLHIT: +--------------------- +Parameter 1: SpellID - The Spell ID that will trigger the event to occur (NOTE: If you use Spell School as the trigger set this value to 0) +Parameter 2: School - Spell School to trigger the event (NOTE: If you use a SpellID then set this value to -1) - *See Below for Spell School Bitmask Values* +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +BOTH - Expires upon Spell hit. If (param1) is set will only expire on that spell OR If (param2) is set it will only expire on spells of that school. Will repeat every (Param3) and (Param4). +This Event is commonly used for NPC's who can do special things when you cast a spell (Or specific spell) on them. + +(name, school, schoolmask) +SPELL_SCHOOL_NORMAL = 0, ==> 1 +SPELL_SCHOOL_HOLY = 1, ==> 2 +SPELL_SCHOOL_FIRE = 2, ==> 4 +SPELL_SCHOOL_NATURE = 3, ==> 8 +SPELL_SCHOOL_FROST = 4, ==> 16 +SPELL_SCHOOL_SHADOW = 5, ==> 32 +SPELL_SCHOOL_ARCANE = 6, ==> 64 +Use These Values For Schoolmask (Param2) or Any Combinations Of These Schoolmasks for Multiple Schools. + +------------------ +9 = EVENT_T_RANGE: +------------------ +Parameter 1: MinDist - This Distance is the Minimum Distance between the NPC and it's target to allow this Event to Expire +Parameter 2: MaxDist - This Distance is the Maximum Distance between the NPC and it's target to allow this Event to Expire +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +COMBAT ONLY! - Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4). +This Event is commonly used for NPC's who have Ranged Combat and will Throw/Shoot between a certian distance. + +--------------------- +10 = EVENT_T_OOC_LOS: +--------------------- +Parameter 1: Hostile-or-Not - This will expire if Unit are hostile. If Param1=1 it will only expire if Unit are not Hostile(generally determined by faction) +Parameter 2: MaxAllowedRange - Expires when a Unit moves within this distance to creature +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +OUT OF COMBAT! +This Event is commonly used for NPC's who do something or say something to you when you walk past them Out of Combat. + +--------------------- +11 = EVENT_T_SPAWNED: +--------------------- +Expires at initial spawn and at creature respawn. +This Event is commonly used for setting ranged movement type or Summoning a Pet on Spawn +Parameter 1: 0: works always, 1: works on map in Parameter 2, 2: works on zone/subzone in Parameter 2 +Parameter 2: depends on Parameter 1: for 1 it is map ID, for 2 it is area ID to check + +----------------------- +12 = EVENT_T_TARGET_HP: +----------------------- +Parameter 1: HPMax% - Maximum HP% That this Event will Expire +Parameter 2: HPMin% - Minimum HP% That this Event will Expire +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +COMBAT ONLY! - Expires when Current NPC's Target's HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4). +This Event is commonly used for NPC's who have a special ability (Like Execute) that only casts when a Player HP is low. + +---------------------------- +13 = EVENT_T_TARGET_CASTING: +---------------------------- +Parameter 1: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 2: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +COMBAT ONLY! - Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2). +This event is commonly used for NPC's who will cast a counter spell when their target starts to cast a spell. + +------------------------- +14 = EVENT_T_FRIENDLY_HP: +------------------------- +Parameter 1: HPDeficit - This is the Amount of HP Missing from Full HP to trigger this event (You would need to calculate the amount of HP the event happens and subtract that from Full HP Value to get this number) +Parameter 2: Radius - This is the Range in Yards the NPC will scan for nearby Friendlies (Faction is Friendly To) for the missing amount of HP in Param1. +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +COMBAT ONLY! - Expires when a friendly unit in radius(param2) has at least (param1) hp missing. Will repeat every (Param3) and (Param4). +This is commonly used when an NPC in Combat will heal a nearby Friendly NPC in Combat with a Heal/Renew Spell. + +---------------------------- +15 = EVENT_T_FRIENDLY_IS_CC: +---------------------------- +Parameter 1: DispelType - Dispel Type to trigger the event - *See Below for Dispel Bitmask Values* +Parameter 2: Radius - This is the Range in Yards the NPC will scan for nearby Friendlies being Crowd Controlled +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +COMBAT ONLY! - Expires when a friendly unit is Crowd controlled within the given radius (param2). Will repeat every (Param3) and (Param4). +This is commonly used for NPC's who can come to the resule of other Friendly NPC's if being Crowd Controlled + +-------------------------- +16 = EVENT_T_MISSING_BUFF: +-------------------------- +Parameter 1: SpellId - This is the SpellID That the Aura Check will look for (If it is missing this Aura) +Parameter 2: Radius - This is the Range in Yards the NPC will scan for nearby Friendlies (Faction is Friendly To) for the missing Aura. +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +BOTH - Expires when a friendly unit is missing aura's given by spell (param1) within radius (param2). Will repeat every (Param3) and (Param4). +This is commonly used for NPC's who watch friendly units for a debuff to end so they can recast it on them again. + +--------------------------- +17 = EVENT_T_SUMMONED_UNIT: +--------------------------- +Parameter 1: CreatureId - The CreatureID that the NPC is watching to spawn to trigger this event +Parameter 2: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 3: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +BOTH - Expires after creature with entry(Param1) is spawned or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) . +This is commonly used for NPC's who will do something special once another NPC is summoned. Usually used is Complex Scripts or Special Events. + +--------------------------- +21 = EVENT_T_REACHED_HOME: +--------------------------- +Expires only when creature has returned to it's home location after Evade. Out of combat event. +Most commonly used to cast spells that can not be casted in EVENT_T_EVADE and other effects that does not fit in while still running back to spawn/home location. + +--------------------------- +22 = EVENT_T_RECEIVE_EMOTE: +--------------------------- +Expires only when creature receive emote from player. Valid text emote id's are in Mangos source (enum TextEmotes) +Event does not require any conditions to process, however many are ecpected to have condition. + +--------------------------- +23 = EVENT_T_BUFFED : +--------------------------- +Parameter 1: SpellId - This is the SpellID That the Aura Check will look for +Parameter 2: Amount - This is the amount of SpellID's auras at creature required for event expire. +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +--------------------------- +24 = EVENT_T_TARGET_BUFFED: +--------------------------- +Parameter 1: SpellId - This is the SpellID That the Aura Check will look for +Parameter 2: Amount - This is the amount of SpellID's auras at target unit required for event expire. +Parameter 3: RepeatMin - Minimum Time used to calculate Random Repeat Expire +Parameter 4: RepeatMax - Maximum Time used to calculate Random Repeat Expire + +EventAI use conditions from available in Mangos (enum ConditionType) +Current implemented conditions: +CONDITION_NONE (0) 0 0 +CONDITION_AURA (1) spell_id effindex +CONDITION_ITEM (2) item_id count +CONDITION_ITEM_EQUIPPED (3) item_id count +CONDITION_ZONEID (4) zone_id 0 +CONDITION_REPUTATION_RANK (5) faction_id min_rank +CONDITION_TEAM (6) player_team 0 (469-Alliance / 67-Horde) +CONDITION_SKILL (7) skill_id min_skill_value +CONDITION_QUESTREWARDED (8) quest_id 0, if quest are rewarded +CONDITION_QUESTTAKEN (9) quest_id 0, while quest active(incomplete) +CONDITION_ACTIVE_EVENT (12) event_id 0, note this is id from dbc, also defined in Mangos source(enum HolidayIds) NOT id of game_event in database + +========================================= +Action Types +========================================= + +----------------- +1 = ACTION_T_TEXT: +----------------- +Parameter 1: The entry of the text that the NPC should use from eventai_texts table. Optionally a entry from other tables can be used (such as custom_texts). + Entry are required to be negative and exist in a *_texts-table. The type text to be displayed are defined in the texts-table itself (Say, Yell, Whisper, Emote Text, Boss Whisper, Boss Emote) + Other options are also to be defined in the texts-table, such as a sound to be heard with the text and the language used in output (common, dwarvish, etc). + In case this entry has a localized version of the text, the localized text will be displayed in client that support this locale. + +Parameter 2: Optional. TextId can be defined in addition. The same apply to this as explained above, however eventAI will randomize between the two. +Parameter 3: Optional, if Parameter 2 exist. In this case, eventAI will randomize between three. + +Read at bottom for documentation of creature_ai_texts-table. + +------------------ +2 = ACTION_T_SET_FACTION: +------------------ +Parameter 1: FactionId from Faction.dbc OR 0. Changes faction for creature. If 0, creature will revert to it's default faction if previously changed. + +----------------------- +3 = ACTION_T_MORPH_TO_ENTRY_OR_MODEL: +----------------------- +Parameter 1: Creature entry from creature_template. Action will then change to the model this creature are using. +Parameter 2: If parameter 1 is 0, then this modelId will be used (in case parameter 1 exist, parameter 2 will not be used) + +If both parameter 1 and 2 is 0, the creature will DeMorph, and use it's default model. + +------------------- +4 = ACTION_T_SOUND: +------------------- +Parameter 1: The Sound ID to be played. (Sound IDs are contained in the DBC files.) + +The creature will play the specified sound. +This is commonly used for Bosses who Yell and then also have a Voice for the same thing. + +------------------- +5 = ACTION_T_EMOTE: +------------------- +Parameter 1: The Emote ID that the creature should perform. (Emote IDs are also contained in the DBC but they can be found in the mangos source as well). + +The creature will perform a visual emote. Unlike a text emote, a visual emote is one where the creature will actually move or perform a gesture. +This is commonly used for NPC's who may perform a special action (Salute, Roar, ect...). Not all player emotes work for creature models. + +------------------------ +6 = ACTION_T_RANDOM_SAY: +------------------------ +UNUSED Can be reused to create new action type + +------------------------- +7 = ACTION_T_RANDOM_YELL: +------------------------- +UNUSED Can be reused to create new action type + +------------------------------ +8 = ACTION_T_RANDOM_TEXTEMOTE: +------------------------------ +UNUSED Can be reused to create new action type + +-------------------------- +9 = ACTION_T_RANDOM_SOUND: +-------------------------- +Parameter 1: The Sound ID to be played as Random Choice #1. +Parameter 2: The Sound ID to be played as Random Choice #2. +Parameter 3: The Sound ID to be played as Random Choice #3. + +Similar to the ACTION_T_SOUND action, it will choose at random a sound to play. + +--------------------------- +10 = ACTION_T_RANDOM_EMOTE: +--------------------------- +Parameter 1: The Emote ID to be played as Random Choice #1. +Parameter 2: The Emote ID to be played as Random Choice #2. +Parameter 3: The Emote ID to be played as Random Choice #3. + +Similar to the ACTION_T_EMOTE action, it will choose at random an Emote to Visually Perform. + +------------------- +11 = ACTION_T_CAST: +------------------- +Parameter 1: SpellId - The Spell ID to use for the NPC to cast. The value used in this field needs to be a valid Spell ID. +Parameter 2: Target - The Target Type defining who the creature should cast the spell at. The value in this field needs to be a valid Target Type as specified in the reference tables below. +Parameter 3: CastFlags - See Table Below for Cast Flag Bitmask Values. If you are unsure what to set this value at leave it at 0. + +The creature will cast a spell specified by a spell ID on a target specified by the target type. +This is commonly used for NPC's who cast spells. + +--------------------- +12 = ACTION_T_SUMMON: +--------------------- +Parameter 1: CreatureID - The Creature Template ID to be Summoned. The value here needs to be a valid Creature Template ID. +Parameter 2: Target - The Target Type defining who the Summoned creature will attack once spawned. The value in this field needs to be a valid Target Type as specified in the reference tables below. +Parameter 3: Duration - The duration until the summoned creature should be unsummoned AFTER Combat ends. The value in this field is in milliseconds or 0. + +The NPC will Summon another creature at the same spot as itself that will attack the specified target. +NOTE: Almost all Creature Summons have proper Summon Spells that should be used when possible. This Action is a powerful last resort option only to be used if nothing else works. +NOTE: Using Target Type 0 will cause the Summoned creature to not attack anyone. +NOTE: If Duration is set at 0, then the summoned creature will not despawn until it has died. +This is used as a manual way to force an NPC to Summon. +-------------------------------- +13 = ACTION_T_THREAT_SINGLE_PCT: +-------------------------------- +Parameter 1: Threat% - Threat percent that should be modified. The value in this field can range from -100 to +100. If it is negative, threat will be taken away and if positive, threat will be added. +Parameter 2: Target - The Target Type defining on whom the threat change should occur. The value in this field needs to be a valid target type as specified in the reference tables below. + +This action will modify the threat of a target in the creature's threat list by the specified percent. +This is commonly used to allow an NPC to adjust the Threat to a single player. + +----------------------------- +14 = ACTION_T_THREAT_ALL_PCT: +----------------------------- +Parameter 1: Threat% - The percent that should be used in modifying everyone's threat in the creature's threat list. The value here can range from -100 to +100. + +This action will modify the threat for everyone in the creature's threat list by the specified percent. +NOTE: Using -100 will cause the creature to reset everyone's threat to 0 so that everyone has the same amount of threat. It will NOT remove anyone from the threat list. +This is commonly used to allow an NPC to drop threat for all players to zero. + +-------------------------- +15 = ACTION_T_QUEST_EVENT: +-------------------------- +Parameter 1: QuestID - The Quest Template ID. The value here must be a valid quest template ID. Furthermore, the quest should have SpecialFlags | 2 as it would need to be completed by an external event which is the activation of this action. +Parameter 2: Target - The Target Type defining whom the quest should be completed for. The value in this field needs to be a valid target type as specified in the reference tables below. + +This action will satisfy the external completion requirement for the quest for the specified target defined by the target type. +NOTE: This action can only be used with player targets so it must be ensured that the target type will point to a player. +This is commonly used for Quests where only ONE player will gain credit for the quest. + +----------------------------- +16 = ACTION_T_CASTCREATUREGO: +----------------------------- +Parameter 1: CreatureID - The Creature Template ID to be Summoned. The value here needs to be a valid Creature Template ID. +Parameter 2: SpellId - The Spell ID to use to simulate the cast. The value used in this field needs to be a valid Spell ID. +Parameter 3: Target - The Target Type defining whom the quest credit should be given to. The value in this field needs to be a valid target type as specified in the reference tables below. + +This action will call CastedCreatureOrGO() function for the player. It can be used to give quest credit for casting a spell on the creature. +This is commonly used for NPC's who have a special requirement to have a Spell cast on them to complete a quest. + +----------------------------- +17 = ACTION_T_SET_UNIT_FIELD: +----------------------------- +Parameter 1: Field_Number - The index of the Field Number to be changed. Use (http://wiki.udbforums.org/index.php/Character_data) for a list of indeces and what they control. Creatures only contain the OBJECT_FIELD_* and UNIT_FIELD_* fields. They do not contain the PLAYER_FIELD_* fields. +Parameter 2: Value - The new value to be put in the field. +Parameter 3: Target - The Target Type defining for whom the unit field should be changed. The value in this field needs to be a valid target type as specified in the reference tables below. + +When activated, this action can change the target's unit field values. More information on the field value indeces can be found at (http://wiki.udbforums.org/index.php/Character_data) + +---------------------------- +18 = ACTION_T_SET_UNIT_FLAG: +---------------------------- +Parameter 1: Flags - The flag(s) to be set. Multiple flags can be set by using bitwise-OR on them (adding them together). +Parameter 2: Target - The Target Type defining for whom the flags should be changed. The value in this field needs to be a valid Target Type as specified in the reference tables below. + +When activated, this action changes the target's flags by adding (turning on) more flags. For example, this action can make the creature unattackable/unselectable if the right flags are used. + +------------------------------- +19 = ACTION_T_REMOVE_UNIT_FLAG: +------------------------------- +Parameter 1: Flags - The flag(s) to be removed. Multiple flags can be set by using bitwise-OR on them (adding them together). +Parameter 2: Target - The target type defining for whom the flags should be changed. The value in this field needs to be a valid Target Type as specified in the reference tables below. + +When activated, this action changes the target's flags by removing (turning off) flags. For example, this action can make the creature normal after it was unattackable/unselectable if the right flags are used. + +-------------------------- +20 = ACTION_T_AUTO_ATTACK: +-------------------------- +Parameter 1: AllowAutoAttack - If zero, then the creature will stop its melee attacks. If non-zero, then the creature will either continue its melee attacks (the action would then have no effect) or it will start its melee attacks on the target with the top threat if its melee attacks were previously stopped. + +This action controls whether or not the creature should stop or start the auto melee attack. +NOTE: The ACID Dev Team has conformed to using either 0 or 1 for the Param values (0 = Stop Melee, 1 = Start Melee). +This is commonly used in combination with EVENT_T_RANGE and ACTION_T_COMBAT_MOVEMENT for Ranged Combat for Mages and Spell Casters. + +------------------------------ +21 = ACTION_T_COMBAT_MOVEMENT: +------------------------------ +Parameter 1: If zero, then the creature will stop moving towards its victim (if its victim gets out of melee range) and will be stationary. If non-zero, then the creature will either continue to follow its victim (the action would have no effect) or it will start to follow the target with the top threat if its movement was disabled before. +Parameter 2: If non-zero, then stop melee combat state (if param1=0) or start melee combat state (if param1!=0) and creature in combat with selected target. + +This action controls whether or not the creature will always move towards its target. +NOTE: The ACID Dev Team has conformed to using either 0 or 1 for the Param values. (0 = Stop Movement, 1 = Start Movement) +This is commonly used with EVENT_T_RANGE and ACTION_T_AUTO_ATTACK for NPC's who engage in Ranged Comabt (Either Spells or Ranged Attacks) +Parameter 2 specialy used for ranged combat proper client side visual show ranged weapon in proper state. + +------------------------ +22 = ACTION_T_SET_PHASE: +------------------------ +Parameter 1: The new phase to set the creature in. This number must be an integer between 0 and 31. Numbers outside of that range will result in an error. + +When activated, this action sets the creature's event to the specified value. +NOTE: The creature's current Phase is NOT reset at creature evade. You must manually set the phase back to 0 at EVENT_T_RESET. +NOTE: The value used for the Param is the actual Phase Number (Not The Event_Inverse_Phase_Mask) +This is commonly used for complex scripts with several phases and you need to switch to a different phase. + +------------------------ +23 = ACTION_T_INC_PHASE: +------------------------ +Parameter 1: Value - The number of phases to increase or decrease. Use negative values to decrease the current phase. + +When activated, this action will increase (or decrease) the current creature's phase. +NOTE: After increasing or decreasing the phase by this action, the current phase must NOT be lower than 0 or exceed 31. +This can be used instead of ACTION_T_SET_PHASE to change phases in scripts. Just a user friendly option for changing phases. + +-------------------- +24 = ACTION_T_EVADE: +-------------------- +When activated, the creature will immediately exit out of combat, clear its threat list, and move back to its spawn point. Basically, this action will reset the whole encounter. +NOTE: All Param Values Are 0 for this Action. + +------------------- +25 = ACTION_T_FLEE: +------------------- +When activated, the creature will try to flee from combat. Currently this is done by it casting a fear-like spell on itself called "Run Away". +A Better Flee system is in Development. +NOTE: All Param Values Are 0 for this Action. + +------------------------------ +26 = ACTION_T_QUEST_EVENT_ALL: +------------------------------ +Parameter 1: QuestId - The quest ID to finish for everyone. + +This action does the same thing as the ACTION_T_QUEST_EVENT does but it does it for all players in the creature's threat list. +NOTE: If a player is not in the NPC's threat list for whatever reason, he/she won't get the quest completed. + +--------------------------------- +27 = ACTION_T_CASTCREATUREGO_ALL: +--------------------------------- +Parameter 1: QuestId - The quest template ID. +Parameter 2: SpellId - The spell ID used to simulate the cast. + +This action does the same thing as the ACTION_T_CASTCREATUREGO does but it does it for all players in the creature's threat list. +NOTE: If a player is not in its threat list for whatever reason, he/she won't receive the cast emulation. + +----------------------------------- +28 = ACTION_T_REMOVEAURASFROMSPELL: +----------------------------------- +Parameter 1: Target - The target type defining for whom the unit field should be changed. The value in this field needs to be a valid target type as specified in the reference tables below. +Parameter 2: SpellId - The spell ID whose auras will be removed. + +This action will remove all auras from a specific spell from the target. +This is commonly used for NPC's who have an OOC Aura that is removed at combat start or a similar idea (Like Stealth or Shape Shift) + +------------------------------ +29 = ACTION_T_RANGED_MOVEMENT: +------------------------------ +Parameter 1: Distance - The distance the mob should keep between it and its target. +Parameter 2: Angle - The angle the mob should use. + +This action changes the movement type generator to ranged type using the specified values for angle and distance. +NOTE: Specifying zero angle and distance will make it just melee instead. +This is commonly used for NPC's who always attack at range and you can specify the distance they will maintain from the target. + +--------------------------- +30 = ACTION_T_RANDOM_PHASE: +--------------------------- +Parameter 1: PhaseId1 - A possible random phase choice. +Parameter 2: PhaseId2 - A possible random phase choice. +Parameter 3: PhaseId3 - A possible random phase choice. + +Randomly sets the phase to one from the three parameter choices. +NOTE: Use -1 to specify that if this param is picked to do nothing. Random is constant between actions within an event. So if you have a random Yell and a random Sound they will match up (ex: param2 with param2) +NOTE 2: PLEASE NOTE THAT EACH OF THE PARAM VALUES ARE ACTUAL PHASE NUMBERS NOT THE INVERSE PHASE MASK VALUE. +This is commonly used for Spellcasting NPC's who on Aggro may select at random a school of spells to use for the fight. Use this if you have up to 3 phases used, otherwise use Action 31 for more then 3 phases. + +--------------------------------- +31 = ACTION_T_RANDOM_PHASE_RANGE: +--------------------------------- +Parameter 1: PhaseMin - The minimum of the phase range. +Parameter 2: PhaseMax - The maximum of the phase range. The number here must be greater than PhaseMin. + +Randomly sets the phase between a range of phases controlled by the parameters. Sets the phase to a random id (Phase = PhaseMin + rnd % PhaseMin-PhaseMax). +NOTE: PhaseMax must be greater than PhaseMin. +NOTE 2: PLEASE NOTE THAT EACH OF THE PARAM VALUES ARE ACTUAL PHASE NUMBERS NOT THE INVERSE PHASE MASK VALUE. +This is commonly used for Spellcasting NPC's who on Aggro may select at random a school of spells to use for the fight. Use this if you have MORE then 3 phases used, otherwise use Action 30. + +--------------------- +32 = ACTION_T_SUMMON: +--------------------- +Parameter 1: CreatureID - The creature template ID to be summoned. The value here needs to be a valid creature template ID. +Parameter 2: Target - The target type defining who the summoned creature will attack. The value in this field needs to be a valid target type as specified in the reference tables below. NOTE: Using target type 0 will cause the summoned creature to not attack anyone. +Parameter 3: SummonID - The summon ID from the creature_ai_summons table controlling the position (and spawntime) where the summoned mob should be spawned at. + +Summons creature (param1) to attack target (param2) at location specified by creature_ai_summons (param3). +NOTE: Param3 Value is the ID Value used for the entry used in creature_ai_summons for this action. You MUST have an creature_ai_summons entry to use this action. +This is commonly used for NPC's who need to Summon a creature at a specific location. (Normally used for complex events) + +----------------------------- +33 = ACTION_T_KILLED_MONSTER: +----------------------------- +Parameter 1: CreatureID - The creature template ID. The value here must be a valid creature template ID. +Parameter 2: Target - The target type defining whom the quest kill count should be given to. The value in this field needs to be a valid target type as specified in the reference tables below. + +When activated, this action will call KilledMonster() function for the player. It can be used to give creature credit for killing a creature. In general if the quest is set to be accompished on different creatures (e.g. "Credit" templates). +NOTE: It can be ANY creature including certain quest specific triggers +This is commonly used for giving the player Quest Credits for NPC kills (Many NPC's may use the same CreatureID for the Kill Credit) + +---------------------------- +34 = ACTION_T_SET_INST_DATA: +---------------------------- +Parameter 1: Field - The field to change in the instance script. Again, this field needs to be a valid field that has been already defined in the instance's script. +Parameter 2: Data - The value to put at that field index. + +Sets data for the instance. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned. +This is commonly used to link an EventAI script with a existing Script Library C++ Script. You make make things happen like opening doors on specific events that happen. + +------------------------------ +35 = ACTION_T_SET_INST_DATA64: +------------------------------ +Parameter 1: Field - The field to change in the instance script. Again, this field needs to be a valid field that has been already defined in the instance's script. +Parameter 2: Target - The target type to use to get the GUID that will be stored at the field index. The value in this field needs to be a valid target type as specified in the reference tables below. + +Sets GUID (64 bits) data for the instance based on the target. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned. +Calls ScriptedInstance::SetData64 with field (param1) and data (param2) target's GUID. + +------------------------------ +36 = ACTION_T_UPDATE_TEMPLATE: +------------------------------ +Parameter 1: TemplateId - The creature template ID. The value here must be a valid creature template ID. +Parameter 2: Team - Use model_id from team : Alliance(0) or Horde (1). + +This function temporarily changes creature entry to new entry, display is changed, loot is changed, but AI is not changed. At respawn creature will be reverted to original entry. +Changes the creature to a new creature template of (param1) with team = Alliance if (param2) = false or Horde if (param2) = true + +------------------ +37 = ACTION_T_DIE: +------------------ +Kills the creature +This is commonly used if you need to Instakill the creature for one reason or another. + +-------------------------------- +38 = ACTION_T_ZONE_COMBAT_PULSE: +-------------------------------- +Places all players within the instance into combat with the creature. Only works in combat and only works inside of instances. + +---------------------------- +39 = ACTION_T_CALL_FOR_HELP: +---------------------------- +Parameter 1: Radius - All friendly (not only same faction) creatures will go to help + +Call any friendly creatures (if its not in combat/etc) in radius attack creature target. +Mostly used when call to help more wide that normal aggro radius or auto-used call for assistance, and need apply at some event. + +------------------------- +40 ACTION_T_SET_SHEATH: +------------------------- +Parameter 1: Sheath state +0 SHEATH_STATE_UNARMED not prepared weapon show (not used mostly by creatures) +1 SHEATH_STATE_MELEE melee weapon prepared show +2 SHEATH_STATE_RANGED ranged weapon prepared show + +Let set sheath state for creature. +Note: SHEATH_STATE_RANGED case work in combat state only if combat not start as melee commands. +This possible setup by set ar event AI start (single used EVENT_T_TIMER_OOC set ACTION_T_COMBAT_MOVEMENT 0 for creature that prefered ranged attack) + +------------------------- +41 ACTION_T_FORCE_DESPAWN +------------------------- +Despawns the creature (in or out of combat) +No parameters + +------------------------- +42 ACTION_T_SET_INVINCIBILITY_HP_LEVEL +------------------------- +Parameter 1: min. health level for creature that can be set at damage, 0 used as absent min. health value for apply damage. +Parameter 2: format of paramater 1 value +0 paramater 1 used as flat value +1 paramater 1 used as percent (0..100) from creature max health + +========================================= +Target Types +========================================= +Below is the list of current Target types that EventAI can handle. +Target types are used by certain actions and may effect actions differently + +(# Internal Name Discription) +0 TARGET_T_SELF Self cast +1 TARGET_T_HOSTILE Our current target (ie: highest aggro) +2 TARGET_T_HOSTILE_SECOND_AGGRO Second highest aggro (generaly used for cleaves and some special attacks) +3 TARGET_T_HOSTILE_LAST_AGGRO Dead last on aggro (no idea what this could be used for) +4 TARGET_T_HOSTILE_RANDOM Just any random target on our threat list +5 TARGET_T_HOSTILE_RANDOM_NOT_TOP Any random target except top threat +6 TARGET_T_ACTION_INVOKER Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP) + +========================================= +Cast Flags +========================================= +Below is the list of current Cast Flags that EventAI's spell casting can handle. +Cast flags are handled bitwise. Bit 0 is Interrupt Previous, bit 1 is triggered, etc. +So for example the number "3" (11 in Binary, selecting first 2 options) would mean that this cast has both CAST_INTURRUPT_PREVIOUS and CAST_TRIGGERED. +Another example: the number "5" (101 in Binary, selecting first and third options) would mean that this cast has CAST_INTURRUPT_PREVIOUS and CAST_FORCE_CAST. + +(bit# Decimal Internal Name Discription) +0 1 CAST_INTURRUPT_PREVIOUS Interrupts any previous spell casting (basicaly makes sure that this spell goes off) +1 2 CAST_TRIGGERED Forces the spell to be instant cast and require no mana/reagents. +2 4 CAST_FORCE_CAST Forces spell to cast even if the target is possibly out of range or the creature is possibly out of mana +3 8 CAST_NO_MELEE_IF_OOM Prevents creature from entering melee if out of mana or out of range +4 16 CAST_FORCE_TARGET_SELF Forces the target to cast this spell on itself +5 32 CAST_AURA_NOT_PRESENT Only casts the spell on the target if the target does not have the aura from that spell on itself already. + +NOTE: You can add the numbers in the decimal column to combine flags. + For example if you wanted to use CAST_NO_MELEE_IF_OOM(8) and CAST_TRIGGERED(2) you would simply use 10 in the cast flags field (8 + 2 = 10). + +========================================= +Event Flags +========================================= +Below is the list of current Event Flags that EventAI can handle. Event flags are handled bitwise. + +(bit# Decimal Internal Name Discription) +0 1 EFLAG_REPEATABLE Event repeats (Does not repeat if this flag is not set) +1 2 EFLAG_NORMAL Event occurs in Normal instance difficulty (will not occur in Normal if not set) +2 4 EFLAG_HEROIC Event occurs in Heroic instance difficulty (will not occur in Heroic if not set) +3 8 +4 16 +5 32 +6 64 +7 128 EFLAG_DEBUG_ONLY Prevents events from occuring on Release builds. Useful for testing new features. + +NOTE: You can add the numbers in the decimal column to combine flags. + + +========================================= +Basic Structure of creature_ai_texts +========================================= +Below is a the list of current fields within the texts tables. + +Field_Name Description +----------------------------------------------------------- +entry This value is mearly an NEGATIVE identifier of the current text number. Required for sql queries. Valid range are -1 to -999999 +content_default This is the actual text presented in the default language (English). + +content_loc1 This is the actual text presented in the Localization #1 Clients (Korean) +content_loc2 This is the actual text presented in the Localization #2 Clients (French) +content_loc3 This is the actual text presented in the Localization #3 Clients (German) +content_loc4 This is the actual text presented in the Localization #4 Clients (Chinese) +content_loc5 This is the actual text presented in the Localization #5 Clients (Taiwanese) +content_loc6 This is the actual text presented in the Localization #6 Clients (Spanish) +content_loc7 This is the actual text presented in the Localization #7 Clients (Spanish Mexico) +content_loc8 This is the actual text presented in the Localization #8 Clients (Russian) + +sound This value is the Sound ID that corresponds to the actual text used. +type Variables used to define type of text (Say/Yell/Textemote/Whisper). +language This value is the Language that the text is native in. +emote Value from enum Emote. Only source of text will play this emote (not target, if target are defined in DoScriptText) +comment This is a comment regarding the text entry + +Note: Fields `content_loc1` to `content_loc8` are NULL values by default and are normally handled by seperate localization projects. + +========================================= +Text Types (type) +========================================= +Below is the list of current Text types that texts tables can handle. These were previously seperate Actions in ACID. + +# Internal Name Description +----------------------------------------------------------- +0 CHAT_TYPE_SAY This type sets the text to be displayed as a Say (Speech Bubble). +1 CHAT_TYPE_YELL This type sets the text to be displayed as a Yell (Red Speech Bubble) and usually has a matching Sound ID. +2 CHAT_TYPE_TEXT_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log. +3 CHAT_TYPE_BOSS_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log (Used only for specific Bosses). +4 CHAT_TYPE_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log. +5 CHAT_TYPE_BOSS_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log (Used only for specific Bosses). +6 CHAT_TYPE_ZONE_YELL Same as CHAT_TYPE_YELL but will display to all players in current zone. + +========================================= +Language Types (language) +========================================= +Below is the list of current Language types that are allowed. +This is the Race Language that the text is native to (So it will display properly) + +# Internal Name Description +----------------------------------------------------------- +0 UNIVERSAL Text in this language is understood by ALL Races. +1 ORCISH Text in this language is understood ONLY by Horde Races. +2 DARNASSIAN Text in this language is understood ONLY by the Night Elf Race. +3 TAURAHE Text in this language is understood ONLY by the Tauren Race. +6 DWARVISH Text in this language is understood ONLY by the Dwarf Race. +7 COMMON Text in this language is understood ONLY by Alliance Races. +8 DEMONIC Text in this language is understood ONLY by the Demon Race (Not Implimented). +9 TITAN This language was used by Sargeras to speak with other Titians (Not Implemented). +10 THALASSIAN Text in this language is understood ONLY by the Blood Elf Race. +11 DRACONIC Text in this language is understood ONLY by the Dragon Race. +12 KALIMAG Text will display as Kalimag (not readable by players, language of all elementals) +13 GNOMISH Text in this language is understood ONLY by the Gnome Race. +14 TROLL Text in this language is understood ONLY by the Troll Race. +33 GUTTERSPEAK Text in this language is understood ONLY by the Undead Race. +35 DRAENEI Text in this language is understood ONLY by the Draenai Race. +36 ZOMBIE (not currently used?) +37 GNOMISH BINARY Binary language used by Alliance when drinking Binary Brew +38 GOBLIN BINARY Binary language used by Horce when drinking Binary Brew diff --git a/docs/HowToScript.txt b/docs/HowToScript.txt new file mode 100644 index 0000000..73968a0 --- /dev/null +++ b/docs/HowToScript.txt @@ -0,0 +1,27 @@ + +** HOW TO SCRIPT IN C++ ** + +1 - create a file myscript.cpp in scripts folder. +2 - copy the content of script_default.cpp, it as the structure on how the scripting fuctions are organized. + dont forget to change the name of fuctions, like GossipHello_default to GossipHello_myscript. + +3 - in fuction AddSC_default change to AddSC_myscript. +4 - newscript->Name="default"; change the string to "myscript" this name is the one to be called from the db +5 - dont forget to change the name in here to newscript->pGossipHello = &GossipHello_default; this is where the scripted fuctions are stored. +6 - and last thing is in ScriptMgr.cpp + +add your AddSC_myscript in here + +// -- Scripts to be added -- +extern void AddSC_default(); +// ------------------- + +and here + +// -- Inicialize the Scripts to be Added -- + AddSC_default(); +// ---------------------------------------- + +now start using the player fuctions to script ;) + +hope it helps, any question use our forum. \ No newline at end of file diff --git a/docs/TextTables.txt b/docs/TextTables.txt new file mode 100644 index 0000000..eac6338 --- /dev/null +++ b/docs/TextTables.txt @@ -0,0 +1,87 @@ +========================================= +Texts Documentation +========================================= + +Scriptdev2 Revision 695 introduces a new format for using texts in EventAI and SD2 Scripts. +This information relates to the *_texts tables located in the ScriptDev Database. + +Any script can at any time access and use text from any of the three text tables, as long as the entry does in fact exist. +Custom scripters are adviced to store their text data in custom_texts. + +The different tables has ranges of entries allowed for that table. +Reserved EventAI in Mangos entry -1 -> -999999 +script_texts: entry -1000000 -> -1999999 +custom_texts: entry -2000000 -> -2999999 +Any entry out of range for that table will display a startup error. + + +========================================= +Basic Structure of script_texts and custom_texts +========================================= +Below is a the list of current fields within the texts tables. + +Field_Name Description +----------------------------------------------------------- +entry This value is mearly an NEGATIVE identifier of the current text number. Required for sql queries. +content_default This is the actual text presented in the default language (English). + +content_loc1 This is the actual text presented in the Localization #1 Clients (Korean) +content_loc2 This is the actual text presented in the Localization #2 Clients (French) +content_loc3 This is the actual text presented in the Localization #3 Clients (German) +content_loc4 This is the actual text presented in the Localization #4 Clients (Chinese) +content_loc5 This is the actual text presented in the Localization #5 Clients (Taiwanese) +content_loc6 This is the actual text presented in the Localization #6 Clients (Spanish) +content_loc7 This is the actual text presented in the Localization #7 Clients (Spanish Mexico) +content_loc8 This is the actual text presented in the Localization #8 Clients (Russian) + +sound This value is the Sound ID that corresponds to the actual text used (Defined in SoundEntries.dbc). +type Variables used to define type of text (Say/Yell/Textemote/Whisper). +language This value is the Language that the text is native in (Defined in Languages.dbc). +emote Value from enum Emote (defined in Emotes.dbc). Only source of text will play this emote (not target, if target are defined in DoScriptText) +comment This is a comment regarding the text entry (For ACID, accepted format is to use Creature ID of NPC using it). + +Note: Fields `content_loc1` to `content_loc8` are NULL values by default and are handled by seperate localization projects. + + +========================================= +Text Types (type) +========================================= +Below is the list of current Text types that texts tables can handle. These were previously seperate Actions in ACID. + +# Internal Name Description +----------------------------------------------------------- +0 CHAT_TYPE_SAY This type sets the text to be displayed as a Say (Speech Bubble). +1 CHAT_TYPE_YELL This type sets the text to be displayed as a Yell (Red Speech Bubble) and usually has a matching Sound ID. +2 CHAT_TYPE_TEXT_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log. +3 CHAT_TYPE_BOSS_EMOTE This type sets the text to be displayed as a text emote in orange in the chat log (Used only for specific Bosses). +4 CHAT_TYPE_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log. +5 CHAT_TYPE_BOSS_WHISPER This type sets the text to be displayed as a whisper to the player in the chat log (Used only for specific Bosses). +6 CHAT_TYPE_ZONE_YELL Same as CHAT_TYPE_YELL but will display to all players in current zone. + + +========================================= +Language Types (language) +========================================= +Below is the list of current Language types that are allowed. +This is the Race Language that the text is native to (So it will display properly) + +# Internal Name Description +----------------------------------------------------------- +0 UNIVERSAL Text in this language is understood by ALL Races. +1 ORCISH Text in this language is understood ONLY by Horde Races. +2 DARNASSIAN Text in this language is understood ONLY by the Night Elf Race. +3 TAURAHE Text in this language is understood ONLY by the Tauren Race. +6 DWARVISH Text in this language is understood ONLY by the Dwarf Race. +7 COMMON Text in this language is understood ONLY by Alliance Races. +8 DEMONIC Text in this language is understood ONLY by the Demon Race (Not Implimented). +9 TITAN This language was used by Sargeras to speak with other Titians (Not Implemented). +10 THALASSIAN Text in this language is understood ONLY by the Blood Elf Race. +11 DRACONIC Text in this language is understood ONLY by the Dragon Race. +12 KALIMAG Text will display as Kalimag (not readable by players, language of all elementals) +13 GNOMISH Text in this language is understood ONLY by the Gnome Race. +14 TROLL Text in this language is understood ONLY by the Troll Race. +33 GUTTERSPEAK Text in this language is understood ONLY by the Undead Race. +35 DRAENEI Text in this language is understood ONLY by the Draenai Race. +36 ZOMBIE (not currently used?) +37 GNOMISH BINARY Binary language used by Alliance when drinking Binary Brew +38 GOBLIN BINARY Binary language used by Horce when drinking Binary Brew \ No newline at end of file diff --git a/docs/UnixInstall.txt b/docs/UnixInstall.txt new file mode 100644 index 0000000..0509c84 --- /dev/null +++ b/docs/UnixInstall.txt @@ -0,0 +1,61 @@ += TrinityCore -- Linux installation = + +Copyright (C) Trinity Core (http://www.trinitycore.org) + +CHECK http://www.trinitycore.info/w/Linux_Build_HOWTO FOR FURTHER HELP + +Installing Trinity Core is fairly simple on a Linux machine, assuming +you have all required applications + +The most important ones are: + + g++ + gcc + make + cmake version 2.6.x or greater + libmysql++-dev + subversion (for checking out Trinity Database) + mercurial (for checking out the core) + openssl + libssl-dev + zlib1g-dev + libtool + libmysqlclient15-dev + patch + build-essential + mysql-client + +Most of these are included on common Linux distros, others you may have to install by your self. +Please check your distro's repos. + +Make a directory to build in, you can call it anything you want like build or bin etc, then go into +the directory and cmake and make. E.G. you created a dir named build ad want to have your final + compiled product installed in /home/trinity/server, an example sequence of commands can be : + + cmake /root/wow/ -DPREFIX=/opt/trinity -DDO_DEBUG=1 -DCMAKE_C_FLAGS="-m32 -D_LARGEFILE_SOURCE -DFD_SETSIZE=131072 -march=prescott -ggdb3 -g3 -pipe -fno-strength-reduce -fno-delete-null-pointer-checks -fno-strict-aliasing -frename-registers" + make + make install + +Thats just about all thats needed. You can however tweak more settings than where to install using flags built into our cmake files. Just open up CMakeLists.txt in the main folder and take a look at some of the flags like + + DO_MYSQL --mysql database support (enabled or disabled by a 1 or 0, enabled by default) + DO_SCRIPTS --enable or disable trinity script (enabled or disabled by a 1 or 0, enabled by default) + DO_RA --remote administration (enabled or disabled by a 1 or 0) + DO_DEBUG --enable debugging (enabled or disabled by a 1 or 0) + DO_CLI --enable command line support (enabled or disabled by a 1 or 0, enabled by default) + LARGE_CELL --enable large cells (enabled or disabled by a 1 or 0, disabled by default, enabling can cause CPU spikes) + SHORT_SLEEP --changes sleep time from 100ms to 50ms + PREFIX --prefix directory for install (see example for use) + CONF_DIR --location for your trinity config files + CMAKE_C_FLAGS --advanced users only + CMAKE_CXX_FLAGS --advanced users only + + +Of course, replace the paths in prefix, conf_dir with the directories you wish to install +Trinity Core to. The datadir is where maps, DBCs, and SQLs are stored. The sysconfdir +is where configuration files are stored. + +Once Trinity Core is installed you will need to +apply database updates where necessary. Furthermore, you must +configure your installation by editing the config files in the +sysconfdir. diff --git a/docs/UnixRestarter/restarter b/docs/UnixRestarter/restarter new file mode 100755 index 0000000..1428f1f --- /dev/null +++ b/docs/UnixRestarter/restarter @@ -0,0 +1,2 @@ +#!/bin/bash +screen -A -m -d -S restarter ./restarter-bin diff --git a/docs/UnixRestarter/restarter-bin b/docs/UnixRestarter/restarter-bin new file mode 100755 index 0000000..b86de50 --- /dev/null +++ b/docs/UnixRestarter/restarter-bin @@ -0,0 +1,10 @@ +#! /bin/bash +while true +do + PID2=$(pidof authserver) + if (( PID2 < 1 )) + then + ./startl + fi + sleep 20 +done diff --git a/docs/UnixRestarter/start b/docs/UnixRestarter/start new file mode 100755 index 0000000..435f01a --- /dev/null +++ b/docs/UnixRestarter/start @@ -0,0 +1,10 @@ +#!/bin/sh +# exit # Comment this in if you are working on your server and don't want it to boot +cd /opt/trinity/bin # Adjust this to the binary directory of the realm to be run +pidof restarter >/dev/null # Grap the process ID +PID1=$? +if [ $PID1 -eq 1 ] # If not running boot the server in a dedicated screen session and log + then + echo "Re-/Starting the logonserver on "`date` >> ../restarter.log + ./restarter && screen -A -m -d -S worldserver ./startw +fi diff --git a/docs/UnixRestarter/startl b/docs/UnixRestarter/startl new file mode 100755 index 0000000..285e1e8 --- /dev/null +++ b/docs/UnixRestarter/startl @@ -0,0 +1 @@ +screen -A -m -d -S authserver ./authserver diff --git a/docs/UnixRestarter/startw b/docs/UnixRestarter/startw new file mode 100755 index 0000000..c2f3922 --- /dev/null +++ b/docs/UnixRestarter/startw @@ -0,0 +1,35 @@ +#!/bin/sh + +############### +# About: Auto restart worldserver on crash & generate crash report into crash_log_(DATE_TIME).log +############### +# 1. Compile TrinityCore with the following command: cmake /root/wow/ -DPREFIX=/opt/trinity -DDO_DEBUG=1 -DCMAKE_C_FLAGS="-m32 -D_LARGEFILE_SOURCE -DFD_SETSIZE=131072 -march=prescott -ggdb3 -g3 -pipe -fno-strength-reduce -fno-delete-null-pointer-checks -fno-strict-aliasing -frename-registers" +# 2. Put these files: start, startw, startl, restarter, restarter-bin, in /opt/trinity/bin folder. +# 3. (Only once): cd /opt/trinity/bin && chmod +x start startw startl restarter restarter-bin +# 4. Usage: ./start or /opt/trinity/bin/start +# p.s. Make sure you have "gdb" installed. +############### + +# config: +# path to worldserver binary +daemon=/opt/trinity/bin/worldserver + +# system +export LD_LIBRARY_PATH=.:lib:$LD_LIBRARY_PATH + +if [ "`ulimit -c`" -eq 0 ]; then + ulimit -c unlimited +fi + +while true +do + $daemon $* + if [ $? -eq 0 ]; then + break; + fi + sleep 10 + dte=`date +%F_%H-%M-%S` + gdb $daemon core.* --batch --eval-command="bt ful" > crash_log_$dte.log + rm core.* + sleep 5 +done diff --git a/docs/gpl-2.0.txt b/docs/gpl-2.0.txt new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/docs/gpl-2.0.txt @@ -0,0 +1,339 @@ + 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 Lesser 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 Lesser General +Public License instead of this License. diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt new file mode 100644 index 0000000..e39a61a --- /dev/null +++ b/externals/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + add_subdirectory(jemalloc) +endif() + +if(CMAKE_SYSTEM_NAME MATCHES "Windows") + add_subdirectory(ace) + add_subdirectory(zlib) + add_subdirectory(bzip2) +endif() + +add_subdirectory(g3dlite) +add_subdirectory(sockets) + +# temporary disable libmpq building (through CMake at least) for now +# - needs a proper CMakeLists.txt +#add_subdirectory(libmpq) diff --git a/externals/PackageList.txt b/externals/PackageList.txt new file mode 100644 index 0000000..2954f91 --- /dev/null +++ b/externals/PackageList.txt @@ -0,0 +1,53 @@ +TrinityCore uses (parts of or in whole) the following opensource software : + +ACE (ADAPTIVE Communication Environment) + http://www.cs.wustl.edu/~schmidt/ACE.html + Version: 5.7.9 + +bzip2 (a freely available, patent free, high-quality data compressor) + http://www.bzip.org/ + Version: 1.0.5 + +G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License) + http://g3d.sourceforge.net/ + Version: 6.09 + +jemalloc (a general-purpose scalable concurrent malloc-implementation) + http://www.canonware.com/jemalloc/ + Version: 1.0.0 + +libMPQ (a library for reading MPQ files) + https://libmpq.org/ + Version: 1.0.4 + +MersenneTwister (a very fast random number generator) + http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html + Version: 0.4.2 + +SFMT (SIMD-oriented Fast Mersenne Twister) + http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html + Version: 1.3.3 + +MySQL (the world's most popular open source database software) + http://www.mysql.com/about/ + Version: 6.0.2 + +OpenSSL (an opensource toolkit implementing SSL v2/v3 and TLS v1 protocols) + http://www.openssl.org/ + Version: UNKNOWN + +sockets (a GPL licensed C++ class library wrapping the berkeley sockets C API) + http://www.alhem.net/Sockets/ + Version: UNKNOWN + +utf8-cpp (UTF-8 with C++ in a Portable Way) + http://utfcpp.sourceforge.net/ + Version: 2.3 + +vld (a free open-source memory leak detection system for Visual C++) + http://sites.google.com/site/dmoulding/vld + Version: 1.0 + +zlib (A Massively Spiffy Yet Delicately Unobtrusive Compression Library) + http://www.zlib.net/ + Version: 1.2.5 diff --git a/externals/SFMT/SFMT-alti.h b/externals/SFMT/SFMT-alti.h new file mode 100644 index 0000000..df3186c --- /dev/null +++ b/externals/SFMT/SFMT-alti.h @@ -0,0 +1,156 @@ +/** + * @file SFMT-alti.h + * + * @brief SIMD oriented Fast Mersenne Twister(SFMT) + * pseudorandom number generator + * + * @author Mutsuo Saito (Hiroshima University) + * @author Makoto Matsumoto (Hiroshima University) + * + * Copyright (C) 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * + * The new BSD License is applied to this software. + * see LICENSE.txt + */ + +#ifndef SFMT_ALTI_H +#define SFMT_ALTI_H + +inline static vector unsigned int vec_recursion(vector unsigned int a, + vector unsigned int b, + vector unsigned int c, + vector unsigned int d) + ALWAYSINLINE; + +/** + * This function represents the recursion formula in AltiVec and BIG ENDIAN. + * @param a a 128-bit part of the interal state array + * @param b a 128-bit part of the interal state array + * @param c a 128-bit part of the interal state array + * @param d a 128-bit part of the interal state array + * @return output + */ +inline static vector unsigned int vec_recursion(vector unsigned int a, + vector unsigned int b, + vector unsigned int c, + vector unsigned int d) { + + const vector unsigned int sl1 = ALTI_SL1; + const vector unsigned int sr1 = ALTI_SR1; +#ifdef ONLY64 + const vector unsigned int mask = ALTI_MSK64; + const vector unsigned char perm_sl = ALTI_SL2_PERM64; + const vector unsigned char perm_sr = ALTI_SR2_PERM64; +#else + const vector unsigned int mask = ALTI_MSK; + const vector unsigned char perm_sl = ALTI_SL2_PERM; + const vector unsigned char perm_sr = ALTI_SR2_PERM; +#endif + vector unsigned int v, w, x, y, z; + x = vec_perm(a, (vector unsigned int)perm_sl, perm_sl); + v = a; + y = vec_sr(b, sr1); + z = vec_perm(c, (vector unsigned int)perm_sr, perm_sr); + w = vec_sl(d, sl1); + z = vec_xor(z, w); + y = vec_and(y, mask); + v = vec_xor(v, x); + z = vec_xor(z, y); + z = vec_xor(z, v); + return z; +} + +/** + * This function fills the internal state array with pseudorandom + * integers. + */ +inline static void gen_rand_all(void) { + int i; + vector unsigned int r, r1, r2; + + r1 = sfmt[N - 2].s; + r2 = sfmt[N - 1].s; + for (i = 0; i < N - POS1; i++) { + r = vec_recursion(sfmt[i].s, sfmt[i + POS1].s, r1, r2); + sfmt[i].s = r; + r1 = r2; + r2 = r; + } + for (; i < N; i++) { + r = vec_recursion(sfmt[i].s, sfmt[i + POS1 - N].s, r1, r2); + sfmt[i].s = r; + r1 = r2; + r2 = r; + } +} + +/** + * This function fills the user-specified array with pseudorandom + * integers. + * + * @param array an 128-bit array to be filled by pseudorandom numbers. + * @param size number of 128-bit pesudorandom numbers to be generated. + */ +inline static void gen_rand_array(w128_t *array, int size) { + int i, j; + vector unsigned int r, r1, r2; + + r1 = sfmt[N - 2].s; + r2 = sfmt[N - 1].s; + for (i = 0; i < N - POS1; i++) { + r = vec_recursion(sfmt[i].s, sfmt[i + POS1].s, r1, r2); + array[i].s = r; + r1 = r2; + r2 = r; + } + for (; i < N; i++) { + r = vec_recursion(sfmt[i].s, array[i + POS1 - N].s, r1, r2); + array[i].s = r; + r1 = r2; + r2 = r; + } + /* main loop */ + for (; i < size - N; i++) { + r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2); + array[i].s = r; + r1 = r2; + r2 = r; + } + for (j = 0; j < 2 * N - size; j++) { + sfmt[j].s = array[j + size - N].s; + } + for (; i < size; i++) { + r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2); + array[i].s = r; + sfmt[j++].s = r; + r1 = r2; + r2 = r; + } +} + +#ifndef ONLY64 +#if defined(__APPLE__) +#define ALTI_SWAP (vector unsigned char) \ + (4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11) +#else +#define ALTI_SWAP {4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11} +#endif +/** + * This function swaps high and low 32-bit of 64-bit integers in user + * specified array. + * + * @param array an 128-bit array to be swaped. + * @param size size of 128-bit array. + */ +inline static void swap(w128_t *array, int size) { + int i; + const vector unsigned char perm = ALTI_SWAP; + + for (i = 0; i < size; i++) { + array[i].s = vec_perm(array[i].s, (vector unsigned int)perm, perm); + } +} +#endif + +#endif diff --git a/externals/SFMT/SFMT-params.h b/externals/SFMT/SFMT-params.h new file mode 100644 index 0000000..661bbf2 --- /dev/null +++ b/externals/SFMT/SFMT-params.h @@ -0,0 +1,97 @@ +#ifndef SFMT_PARAMS_H +#define SFMT_PARAMS_H + +#if !defined(MEXP) +#ifdef __GNUC__ + #warning "MEXP is not defined. I assume MEXP is 19937." +#endif + #define MEXP 19937 +#endif +/*----------------- + BASIC DEFINITIONS + -----------------*/ +/** Mersenne Exponent. The period of the sequence + * is a multiple of 2^MEXP-1. + * #define MEXP 19937 */ +/** SFMT generator has an internal state array of 128-bit integers, + * and N is its size. */ +#define N (MEXP / 128 + 1) +/** N32 is the size of internal state array when regarded as an array + * of 32-bit integers.*/ +#define N32 (N * 4) +/** N64 is the size of internal state array when regarded as an array + * of 64-bit integers.*/ +#define N64 (N * 2) + +/*---------------------- + the parameters of SFMT + following definitions are in paramsXXXX.h file. + ----------------------*/ +/** the pick up position of the array. +#define POS1 122 +*/ + +/** the parameter of shift left as four 32-bit registers. +#define SL1 18 + */ + +/** the parameter of shift left as one 128-bit register. + * The 128-bit integer is shifted by (SL2 * 8) bits. +#define SL2 1 +*/ + +/** the parameter of shift right as four 32-bit registers. +#define SR1 11 +*/ + +/** the parameter of shift right as one 128-bit register. + * The 128-bit integer is shifted by (SL2 * 8) bits. +#define SR2 1 +*/ + +/** A bitmask, used in the recursion. These parameters are introduced + * to break symmetry of SIMD. +#define MSK1 0xdfffffefU +#define MSK2 0xddfecb7fU +#define MSK3 0xbffaffffU +#define MSK4 0xbffffff6U +*/ + +/** These definitions are part of a 128-bit period certification vector. +#define PARITY1 0x00000001U +#define PARITY2 0x00000000U +#define PARITY3 0x00000000U +#define PARITY4 0xc98e126aU +*/ + +#if MEXP == 607 + #include "SFMT-params607.h" +#elif MEXP == 1279 + #include "SFMT-params1279.h" +#elif MEXP == 2281 + #include "SFMT-params2281.h" +#elif MEXP == 4253 + #include "SFMT-params4253.h" +#elif MEXP == 11213 + #include "SFMT-params11213.h" +#elif MEXP == 19937 + #include "SFMT-params19937.h" +#elif MEXP == 44497 + #include "SFMT-params44497.h" +#elif MEXP == 86243 + #include "SFMT-params86243.h" +#elif MEXP == 132049 + #include "SFMT-params132049.h" +#elif MEXP == 216091 + #include "SFMT-params216091.h" +#else +#ifdef __GNUC__ + #error "MEXP is not valid." + #undef MEXP +#else + #undef MEXP +#endif + +#endif + +#endif /* SFMT_PARAMS_H */ diff --git a/externals/SFMT/SFMT-sse2.h b/externals/SFMT/SFMT-sse2.h new file mode 100644 index 0000000..4e91d9c --- /dev/null +++ b/externals/SFMT/SFMT-sse2.h @@ -0,0 +1,121 @@ +/** + * @file SFMT-sse2.h + * @brief SIMD oriented Fast Mersenne Twister(SFMT) for Intel SSE2 + * + * @author Mutsuo Saito (Hiroshima University) + * @author Makoto Matsumoto (Hiroshima University) + * + * @note We assume LITTLE ENDIAN in this file + * + * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * + * The new BSD License is applied to this software, see LICENSE.txt + */ + +#ifndef SFMT_SSE2_H +#define SFMT_SSE2_H + +PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b, __m128i c, + __m128i d, __m128i mask) ALWAYSINLINE; + +/** + * This function represents the recursion formula. + * @param a a 128-bit part of the interal state array + * @param b a 128-bit part of the interal state array + * @param c a 128-bit part of the interal state array + * @param d a 128-bit part of the interal state array + * @param mask 128-bit mask + * @return output + */ +PRE_ALWAYS static __m128i mm_recursion(__m128i *a, __m128i *b, + __m128i c, __m128i d, __m128i mask) { + __m128i v, x, y, z; + + x = _mm_load_si128(a); + y = _mm_srli_epi32(*b, SR1); + z = _mm_srli_si128(c, SR2); + v = _mm_slli_epi32(d, SL1); + z = _mm_xor_si128(z, x); + z = _mm_xor_si128(z, v); + x = _mm_slli_si128(x, SL2); + y = _mm_and_si128(y, mask); + z = _mm_xor_si128(z, x); + z = _mm_xor_si128(z, y); + return z; +} + +/** + * This function fills the internal state array with pseudorandom + * integers. + */ +inline static void gen_rand_all(void) { + int i; + __m128i r, r1, r2, mask; + mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1); + + r1 = _mm_load_si128(&sfmt[N - 2].si); + r2 = _mm_load_si128(&sfmt[N - 1].si); + for (i = 0; i < N - POS1; i++) { + r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1].si, r1, r2, mask); + _mm_store_si128(&sfmt[i].si, r); + r1 = r2; + r2 = r; + } + for (; i < N; i++) { + r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1 - N].si, r1, r2, mask); + _mm_store_si128(&sfmt[i].si, r); + r1 = r2; + r2 = r; + } +} + +/** + * This function fills the user-specified array with pseudorandom + * integers. + * + * @param array an 128-bit array to be filled by pseudorandom numbers. + * @param size number of 128-bit pesudorandom numbers to be generated. + */ +inline static void gen_rand_array(w128_t *array, int size) { + int i, j; + __m128i r, r1, r2, mask; + mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1); + + r1 = _mm_load_si128(&sfmt[N - 2].si); + r2 = _mm_load_si128(&sfmt[N - 1].si); + for (i = 0; i < N - POS1; i++) { + r = mm_recursion(&sfmt[i].si, &sfmt[i + POS1].si, r1, r2, mask); + _mm_store_si128(&array[i].si, r); + r1 = r2; + r2 = r; + } + for (; i < N; i++) { + r = mm_recursion(&sfmt[i].si, &array[i + POS1 - N].si, r1, r2, mask); + _mm_store_si128(&array[i].si, r); + r1 = r2; + r2 = r; + } + /* main loop */ + for (; i < size - N; i++) { + r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2, + mask); + _mm_store_si128(&array[i].si, r); + r1 = r2; + r2 = r; + } + for (j = 0; j < 2 * N - size; j++) { + r = _mm_load_si128(&array[j + size - N].si); + _mm_store_si128(&sfmt[j].si, r); + } + for (; i < size; i++) { + r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2, + mask); + _mm_store_si128(&array[i].si, r); + _mm_store_si128(&sfmt[j++].si, r); + r1 = r2; + r2 = r; + } +} + +#endif diff --git a/externals/SFMT/SFMT.c b/externals/SFMT/SFMT.c new file mode 100644 index 0000000..d36465d --- /dev/null +++ b/externals/SFMT/SFMT.c @@ -0,0 +1,620 @@ +/** + * @file SFMT.c + * @brief SIMD oriented Fast Mersenne Twister(SFMT) + * + * @author Mutsuo Saito (Hiroshima University) + * @author Makoto Matsumoto (Hiroshima University) + * + * Copyright (C) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * + * The new BSD License is applied to this software, see LICENSE.txt + */ +#include +#include +#include "SFMT.h" +#include "SFMT-params.h" + +#if defined(__BIG_ENDIAN__) && !defined(__amd64) && !defined(BIG_ENDIAN64) +#define BIG_ENDIAN64 1 +#endif +#if defined(HAVE_ALTIVEC) && !defined(BIG_ENDIAN64) +#define BIG_ENDIAN64 1 +#endif +#if defined(ONLY64) && !defined(BIG_ENDIAN64) + #if defined(__GNUC__) + #error "-DONLY64 must be specified with -DBIG_ENDIAN64" + #endif +#undef ONLY64 +#endif +/*------------------------------------------------------ + 128-bit SIMD data type for Altivec, SSE2 or standard C + ------------------------------------------------------*/ +#if defined(HAVE_ALTIVEC) + #if !defined(__APPLE__) + #include + #endif +/** 128-bit data structure */ +union W128_T { + vector unsigned int s; + uint32_t u[4]; +}; +/** 128-bit data type */ +typedef union W128_T w128_t; + +#elif defined(HAVE_SSE2) + #include + +/** 128-bit data structure */ +union W128_T { + __m128i si; + uint32_t u[4]; +}; +/** 128-bit data type */ +typedef union W128_T w128_t; + +#else + +/** 128-bit data structure */ +struct W128_T { + uint32_t u[4]; +}; +/** 128-bit data type */ +typedef struct W128_T w128_t; + +#endif + +/*-------------------------------------- + FILE GLOBAL VARIABLES + internal state, index counter and flag + --------------------------------------*/ +/** the 128-bit internal state array */ +static w128_t sfmt[N]; +/** the 32bit integer pointer to the 128-bit internal state array */ +static uint32_t *psfmt32 = &sfmt[0].u[0]; +#if !defined(BIG_ENDIAN64) || defined(ONLY64) +/** the 64bit integer pointer to the 128-bit internal state array */ +static uint64_t *psfmt64 = (uint64_t *)&sfmt[0].u[0]; +#endif +/** index counter to the 32-bit internal state array */ +static int idx; +/** a flag: it is 0 if and only if the internal state is not yet + * initialized. */ +static int initialized = 0; +/** a parity check vector which certificate the period of 2^{MEXP} */ +static uint32_t parity[4] = {PARITY1, PARITY2, PARITY3, PARITY4}; + +/*---------------- + STATIC FUNCTIONS + ----------------*/ +inline static int idxof(int i); +inline static void rshift128(w128_t *out, w128_t const *in, int shift); +inline static void lshift128(w128_t *out, w128_t const *in, int shift); +inline static void gen_rand_all(void); +inline static void gen_rand_array(w128_t *array, int size); +inline static uint32_t func1(uint32_t x); +inline static uint32_t func2(uint32_t x); +static void period_certification(void); +#if defined(BIG_ENDIAN64) && !defined(ONLY64) +inline static void swap(w128_t *array, int size); +#endif + +#if defined(HAVE_ALTIVEC) + #include "SFMT-alti.h" +#elif defined(HAVE_SSE2) + #include "SFMT-sse2.h" +#endif + +/** + * This function simulate a 64-bit index of LITTLE ENDIAN + * in BIG ENDIAN machine. + */ +#ifdef ONLY64 +inline static int idxof(int i) { + return i ^ 1; +} +#else +inline static int idxof(int i) { + return i; +} +#endif +/** + * This function simulates SIMD 128-bit right shift by the standard C. + * The 128-bit integer given in in is shifted by (shift * 8) bits. + * This function simulates the LITTLE ENDIAN SIMD. + * @param out the output of this function + * @param in the 128-bit data to be shifted + * @param shift the shift value + */ +#ifdef ONLY64 +inline static void rshift128(w128_t *out, w128_t const *in, int shift) { + uint64_t th, tl, oh, ol; + + th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]); + tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]); + + oh = th >> (shift * 8); + ol = tl >> (shift * 8); + ol |= th << (64 - shift * 8); + out->u[0] = (uint32_t)(ol >> 32); + out->u[1] = (uint32_t)ol; + out->u[2] = (uint32_t)(oh >> 32); + out->u[3] = (uint32_t)oh; +} +#else +inline static void rshift128(w128_t *out, w128_t const *in, int shift) { + uint64_t th, tl, oh, ol; + + th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]); + tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]); + + oh = th >> (shift * 8); + ol = tl >> (shift * 8); + ol |= th << (64 - shift * 8); + out->u[1] = (uint32_t)(ol >> 32); + out->u[0] = (uint32_t)ol; + out->u[3] = (uint32_t)(oh >> 32); + out->u[2] = (uint32_t)oh; +} +#endif +/** + * This function simulates SIMD 128-bit left shift by the standard C. + * The 128-bit integer given in in is shifted by (shift * 8) bits. + * This function simulates the LITTLE ENDIAN SIMD. + * @param out the output of this function + * @param in the 128-bit data to be shifted + * @param shift the shift value + */ +#ifdef ONLY64 +inline static void lshift128(w128_t *out, w128_t const *in, int shift) { + uint64_t th, tl, oh, ol; + + th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]); + tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]); + + oh = th << (shift * 8); + ol = tl << (shift * 8); + oh |= tl >> (64 - shift * 8); + out->u[0] = (uint32_t)(ol >> 32); + out->u[1] = (uint32_t)ol; + out->u[2] = (uint32_t)(oh >> 32); + out->u[3] = (uint32_t)oh; +} +#else +inline static void lshift128(w128_t *out, w128_t const *in, int shift) { + uint64_t th, tl, oh, ol; + + th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]); + tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]); + + oh = th << (shift * 8); + ol = tl << (shift * 8); + oh |= tl >> (64 - shift * 8); + out->u[1] = (uint32_t)(ol >> 32); + out->u[0] = (uint32_t)ol; + out->u[3] = (uint32_t)(oh >> 32); + out->u[2] = (uint32_t)oh; +} +#endif + +/** + * This function represents the recursion formula. + * @param r output + * @param a a 128-bit part of the internal state array + * @param b a 128-bit part of the internal state array + * @param c a 128-bit part of the internal state array + * @param d a 128-bit part of the internal state array + */ +#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2)) +#ifdef ONLY64 +inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c, + w128_t *d) { + w128_t x; + w128_t y; + + lshift128(&x, a, SL2); + rshift128(&y, c, SR2); + r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SR1) & MSK2) ^ y.u[0] + ^ (d->u[0] << SL1); + r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SR1) & MSK1) ^ y.u[1] + ^ (d->u[1] << SL1); + r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SR1) & MSK4) ^ y.u[2] + ^ (d->u[2] << SL1); + r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SR1) & MSK3) ^ y.u[3] + ^ (d->u[3] << SL1); +} +#else +inline static void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c, + w128_t *d) { + w128_t x; + w128_t y; + + lshift128(&x, a, SL2); + rshift128(&y, c, SR2); + r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SR1) & MSK1) ^ y.u[0] + ^ (d->u[0] << SL1); + r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SR1) & MSK2) ^ y.u[1] + ^ (d->u[1] << SL1); + r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SR1) & MSK3) ^ y.u[2] + ^ (d->u[2] << SL1); + r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SR1) & MSK4) ^ y.u[3] + ^ (d->u[3] << SL1); +} +#endif +#endif + +#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2)) +/** + * This function fills the internal state array with pseudorandom + * integers. + */ +inline static void gen_rand_all(void) { + int i; + w128_t *r1, *r2; + + r1 = &sfmt[N - 2]; + r2 = &sfmt[N - 1]; + for (i = 0; i < N - POS1; i++) { + do_recursion(&sfmt[i], &sfmt[i], &sfmt[i + POS1], r1, r2); + r1 = r2; + r2 = &sfmt[i]; + } + for (; i < N; i++) { + do_recursion(&sfmt[i], &sfmt[i], &sfmt[i + POS1 - N], r1, r2); + r1 = r2; + r2 = &sfmt[i]; + } +} + +/** + * This function fills the user-specified array with pseudorandom + * integers. + * + * @param array an 128-bit array to be filled by pseudorandom numbers. + * @param size number of 128-bit pseudorandom numbers to be generated. + */ +inline static void gen_rand_array(w128_t *array, int size) { + int i, j; + w128_t *r1, *r2; + + r1 = &sfmt[N - 2]; + r2 = &sfmt[N - 1]; + for (i = 0; i < N - POS1; i++) { + do_recursion(&array[i], &sfmt[i], &sfmt[i + POS1], r1, r2); + r1 = r2; + r2 = &array[i]; + } + for (; i < N; i++) { + do_recursion(&array[i], &sfmt[i], &array[i + POS1 - N], r1, r2); + r1 = r2; + r2 = &array[i]; + } + for (; i < size - N; i++) { + do_recursion(&array[i], &array[i - N], &array[i + POS1 - N], r1, r2); + r1 = r2; + r2 = &array[i]; + } + for (j = 0; j < 2 * N - size; j++) { + sfmt[j] = array[j + size - N]; + } + for (; i < size; i++, j++) { + do_recursion(&array[i], &array[i - N], &array[i + POS1 - N], r1, r2); + r1 = r2; + r2 = &array[i]; + sfmt[j] = array[i]; + } +} +#endif + +#if defined(BIG_ENDIAN64) && !defined(ONLY64) && !defined(HAVE_ALTIVEC) +inline static void swap(w128_t *array, int size) { + int i; + uint32_t x, y; + + for (i = 0; i < size; i++) { + x = array[i].u[0]; + y = array[i].u[2]; + array[i].u[0] = array[i].u[1]; + array[i].u[2] = array[i].u[3]; + array[i].u[1] = x; + array[i].u[3] = y; + } +} +#endif +/** + * This function represents a function used in the initialization + * by init_by_array + * @param x 32-bit integer + * @return 32-bit integer + */ +static uint32_t func1(uint32_t x) { + return (x ^ (x >> 27)) * (uint32_t)1664525UL; +} + +/** + * This function represents a function used in the initialization + * by init_by_array + * @param x 32-bit integer + * @return 32-bit integer + */ +static uint32_t func2(uint32_t x) { + return (x ^ (x >> 27)) * (uint32_t)1566083941UL; +} + +/** + * This function certificate the period of 2^{MEXP} + */ +static void period_certification(void) { + int inner = 0; + int i, j; + uint32_t work; + + for (i = 0; i < 4; i++) + inner ^= psfmt32[idxof(i)] & parity[i]; + for (i = 16; i > 0; i >>= 1) + inner ^= inner >> i; + inner &= 1; + /* check OK */ + if (inner == 1) { + return; + } + /* check NG, and modification */ + for (i = 0; i < 4; i++) { + work = 1; + for (j = 0; j < 32; j++) { + if ((work & parity[i]) != 0) { + psfmt32[idxof(i)] ^= work; + return; + } + work = work << 1; + } + } +} + +/*---------------- + PUBLIC FUNCTIONS + ----------------*/ +/** + * This function returns the identification string. + * The string shows the word size, the Mersenne exponent, + * and all parameters of this generator. + */ +const char *get_idstring(void) { + return IDSTR; +} + +/** + * This function returns the minimum size of array used for \b + * fill_array32() function. + * @return minimum size of array used for fill_array32() function. + */ +int get_min_array_size32(void) { + return N32; +} + +/** + * This function returns the minimum size of array used for \b + * fill_array64() function. + * @return minimum size of array used for fill_array64() function. + */ +int get_min_array_size64(void) { + return N64; +} + +#ifndef ONLY64 +/** + * This function generates and returns 32-bit pseudorandom number. + * init_gen_rand or init_by_array must be called before this function. + * @return 32-bit pseudorandom number + */ +uint32_t gen_rand32(void) { + uint32_t r; + + assert(initialized); + if (idx >= N32) { + gen_rand_all(); + idx = 0; + } + r = psfmt32[idx++]; + return r; +} +#endif +/** + * This function generates and returns 64-bit pseudorandom number. + * init_gen_rand or init_by_array must be called before this function. + * The function gen_rand64 should not be called after gen_rand32, + * unless an initialization is again executed. + * @return 64-bit pseudorandom number + */ +uint64_t gen_rand64(void) { +#if defined(BIG_ENDIAN64) && !defined(ONLY64) + uint32_t r1, r2; +#else + uint64_t r; +#endif + + assert(initialized); + assert(idx % 2 == 0); + + if (idx >= N32) { + gen_rand_all(); + idx = 0; + } +#if defined(BIG_ENDIAN64) && !defined(ONLY64) + r1 = psfmt32[idx]; + r2 = psfmt32[idx + 1]; + idx += 2; + return ((uint64_t)r2 << 32) | r1; +#else + r = psfmt64[idx / 2]; + idx += 2; + return r; +#endif +} + +#ifndef ONLY64 +/** + * This function generates pseudorandom 32-bit integers in the + * specified array[] by one call. The number of pseudorandom integers + * is specified by the argument size, which must be at least 624 and a + * multiple of four. The generation by this function is much faster + * than the following gen_rand function. + * + * For initialization, init_gen_rand or init_by_array must be called + * before the first call of this function. This function can not be + * used after calling gen_rand function, without initialization. + * + * @param array an array where pseudorandom 32-bit integers are filled + * by this function. The pointer to the array must be \b "aligned" + * (namely, must be a multiple of 16) in the SIMD version, since it + * refers to the address of a 128-bit integer. In the standard C + * version, the pointer is arbitrary. + * + * @param size the number of 32-bit pseudorandom integers to be + * generated. size must be a multiple of 4, and greater than or equal + * to (MEXP / 128 + 1) * 4. + * + * @note \b memalign or \b posix_memalign is available to get aligned + * memory. Mac OSX doesn't have these functions, but \b malloc of OSX + * returns the pointer to the aligned memory block. + */ +void fill_array32(uint32_t *array, int size) { + assert(initialized); + assert(idx == N32); + assert(size % 4 == 0); + assert(size >= N32); + + gen_rand_array((w128_t *)array, size / 4); + idx = N32; +} +#endif + +/** + * This function generates pseudorandom 64-bit integers in the + * specified array[] by one call. The number of pseudorandom integers + * is specified by the argument size, which must be at least 312 and a + * multiple of two. The generation by this function is much faster + * than the following gen_rand function. + * + * For initialization, init_gen_rand or init_by_array must be called + * before the first call of this function. This function can not be + * used after calling gen_rand function, without initialization. + * + * @param array an array where pseudorandom 64-bit integers are filled + * by this function. The pointer to the array must be "aligned" + * (namely, must be a multiple of 16) in the SIMD version, since it + * refers to the address of a 128-bit integer. In the standard C + * version, the pointer is arbitrary. + * + * @param size the number of 64-bit pseudorandom integers to be + * generated. size must be a multiple of 2, and greater than or equal + * to (MEXP / 128 + 1) * 2 + * + * @note \b memalign or \b posix_memalign is available to get aligned + * memory. Mac OSX doesn't have these functions, but \b malloc of OSX + * returns the pointer to the aligned memory block. + */ +void fill_array64(uint64_t *array, int size) { + assert(initialized); + assert(idx == N32); + assert(size % 2 == 0); + assert(size >= N64); + + gen_rand_array((w128_t *)array, size / 2); + idx = N32; + +#if defined(BIG_ENDIAN64) && !defined(ONLY64) + swap((w128_t *)array, size /2); +#endif +} + +/** + * This function initializes the internal state array with a 32-bit + * integer seed. + * + * @param seed a 32-bit integer used as the seed. + */ +void init_gen_rand(uint32_t seed) { + int i; + + psfmt32[idxof(0)] = seed; + for (i = 1; i < N32; i++) { + psfmt32[idxof(i)] = 1812433253UL * (psfmt32[idxof(i - 1)] + ^ (psfmt32[idxof(i - 1)] >> 30)) + + i; + } + idx = N32; + period_certification(); + initialized = 1; +} + +/** + * This function initializes the internal state array, + * with an array of 32-bit integers used as the seeds + * @param init_key the array of 32-bit integers, used as a seed. + * @param key_length the length of init_key. + */ +void init_by_array(uint32_t *init_key, int key_length) { + int i, j, count; + uint32_t r; + int lag; + int mid; + int size = N * 4; + + if (size >= 623) { + lag = 11; + } else if (size >= 68) { + lag = 7; + } else if (size >= 39) { + lag = 5; + } else { + lag = 3; + } + mid = (size - lag) / 2; + + memset(sfmt, 0x8b, sizeof(sfmt)); + if (key_length + 1 > N32) { + count = key_length + 1; + } else { + count = N32; + } + r = func1(psfmt32[idxof(0)] ^ psfmt32[idxof(mid)] + ^ psfmt32[idxof(N32 - 1)]); + psfmt32[idxof(mid)] += r; + r += key_length; + psfmt32[idxof(mid + lag)] += r; + psfmt32[idxof(0)] = r; + + count--; + for (i = 1, j = 0; (j < count) && (j < key_length); j++) { + r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % N32)] + ^ psfmt32[idxof((i + N32 - 1) % N32)]); + psfmt32[idxof((i + mid) % N32)] += r; + r += init_key[j] + i; + psfmt32[idxof((i + mid + lag) % N32)] += r; + psfmt32[idxof(i)] = r; + i = (i + 1) % N32; + } + for (; j < count; j++) { + r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % N32)] + ^ psfmt32[idxof((i + N32 - 1) % N32)]); + psfmt32[idxof((i + mid) % N32)] += r; + r += i; + psfmt32[idxof((i + mid + lag) % N32)] += r; + psfmt32[idxof(i)] = r; + i = (i + 1) % N32; + } + for (j = 0; j < N32; j++) { + r = func2(psfmt32[idxof(i)] + psfmt32[idxof((i + mid) % N32)] + + psfmt32[idxof((i + N32 - 1) % N32)]); + psfmt32[idxof((i + mid) % N32)] ^= r; + r -= i; + psfmt32[idxof((i + mid + lag) % N32)] ^= r; + psfmt32[idxof(i)] = r; + i = (i + 1) % N32; + } + + idx = N32; + period_certification(); + initialized = 1; +} diff --git a/externals/SFMT/SFMT.h b/externals/SFMT/SFMT.h new file mode 100644 index 0000000..7c8b35e --- /dev/null +++ b/externals/SFMT/SFMT.h @@ -0,0 +1,157 @@ +/** + * @file SFMT.h + * + * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom + * number generator + * + * @author Mutsuo Saito (Hiroshima University) + * @author Makoto Matsumoto (Hiroshima University) + * + * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima + * University. All rights reserved. + * + * The new BSD License is applied to this software. + * see LICENSE.txt + * + * @note We assume that your system has inttypes.h. If your system + * doesn't have inttypes.h, you have to typedef uint32_t and uint64_t, + * and you have to define PRIu64 and PRIx64 in this file as follows: + * @verbatim + typedef unsigned int uint32_t + typedef unsigned long long uint64_t + #define PRIu64 "llu" + #define PRIx64 "llx" +@endverbatim + * uint32_t must be exactly 32-bit unsigned integer type (no more, no + * less), and uint64_t must be exactly 64-bit unsigned integer type. + * PRIu64 and PRIx64 are used for printf function to print 64-bit + * unsigned int and 64-bit unsigned int in hexadecimal format. + */ + +#ifndef SFMT_H +#define SFMT_H + +#include + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) + #include +#elif defined(_MSC_VER) || defined(__BORLANDC__) + typedef unsigned int uint32_t; + typedef unsigned __int64 uint64_t; + #define inline __inline +#else + #include + #if defined(__GNUC__) + #define inline __inline__ + #endif +#endif + +#ifndef PRIu64 + #if defined(_MSC_VER) || defined(__BORLANDC__) + #define PRIu64 "I64u" + #define PRIx64 "I64x" + #else + #define PRIu64 "llu" + #define PRIx64 "llx" + #endif +#endif + +#if defined(__GNUC__) +#define ALWAYSINLINE __attribute__((always_inline)) +#else +#define ALWAYSINLINE +#endif + +#if defined(_MSC_VER) + #if _MSC_VER >= 1200 + #define PRE_ALWAYS __forceinline + #else + #define PRE_ALWAYS inline + #endif +#else + #define PRE_ALWAYS inline +#endif + +uint32_t gen_rand32(void); +uint64_t gen_rand64(void); +void fill_array32(uint32_t *array, int size); +void fill_array64(uint64_t *array, int size); +void init_gen_rand(uint32_t seed); +void init_by_array(uint32_t *init_key, int key_length); +const char *get_idstring(void); +int get_min_array_size32(void); +int get_min_array_size64(void); + +/* These real versions are due to Isaku Wada */ +/** generates a random number on [0,1]-real-interval */ +inline static double to_real1(uint32_t v) +{ + return v * (1.0/4294967295.0); + /* divided by 2^32-1 */ +} + +/** generates a random number on [0,1]-real-interval */ +inline static double genrand_real1(void) +{ + return to_real1(gen_rand32()); +} + +/** generates a random number on [0,1)-real-interval */ +inline static double to_real2(uint32_t v) +{ + return v * (1.0/4294967296.0); + /* divided by 2^32 */ +} + +/** generates a random number on [0,1)-real-interval */ +inline static double genrand_real2(void) +{ + return to_real2(gen_rand32()); +} + +/** generates a random number on (0,1)-real-interval */ +inline static double to_real3(uint32_t v) +{ + return (((double)v) + 0.5)*(1.0/4294967296.0); + /* divided by 2^32 */ +} + +/** generates a random number on (0,1)-real-interval */ +inline static double genrand_real3(void) +{ + return to_real3(gen_rand32()); +} +/** These real versions are due to Isaku Wada */ + +/** generates a random number on [0,1) with 53-bit resolution*/ +inline static double to_res53(uint64_t v) +{ + return v * (1.0/18446744073709551616.0L); +} + +/** generates a random number on [0,1) with 53-bit resolution from two + * 32 bit integers */ +inline static double to_res53_mix(uint32_t x, uint32_t y) +{ + return to_res53(x | ((uint64_t)y << 32)); +} + +/** generates a random number on [0,1) with 53-bit resolution + */ +inline static double genrand_res53(void) +{ + return to_res53(gen_rand64()); +} + +/** generates a random number on [0,1) with 53-bit resolution + using 32bit integer. + */ +inline static double genrand_res53_mix(void) +{ + uint32_t x, y; + + x = gen_rand32(); + y = gen_rand32(); + return to_res53_mix(x, y); +} +#endif diff --git a/externals/ace/ACE.cpp b/externals/ace/ACE.cpp new file mode 100644 index 0000000..24fb383 --- /dev/null +++ b/externals/ace/ACE.cpp @@ -0,0 +1,3543 @@ +// $Id: ACE.cpp 88193 2009-12-16 09:14:06Z mcorino $ + +#include "ace/ACE.h" + +#include "ace/Basic_Types.h" +#include "ace/Handle_Set.h" +#include "ace/Auto_Ptr.h" +#include "ace/SString.h" +#include "ace/Version.h" +#include "ace/Message_Block.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_sys_select.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_strings.h" +#include "ace/OS_NS_signal.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_sys_resource.h" +#include "ace/OS_NS_sys_wait.h" +#include "ace/OS_NS_sys_time.h" +#include "ace/OS_NS_time.h" +#include "ace/OS_NS_sys_uio.h" +#include "ace/OS_NS_sys_stat.h" +#include "ace/OS_NS_ctype.h" +#include "ace/OS_NS_fcntl.h" +#include "ace/OS_TLI.h" +#include "ace/Truncate.h" + +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) +extern "C" int maxFiles; +#endif /* ACE_VXWORKS */ + +#if !defined (__ACE_INLINE__) +#include "ace/ACE.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) +# include "ace/OS_NS_poll.h" +#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ + + +ACE_RCSID (ace, + ACE, + "$Id: ACE.cpp 88193 2009-12-16 09:14:06Z mcorino $") + + +// Open versioned namespace, if enabled by the user. + ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + // private: + // Used internally so not exported. + + // Size of allocation granularity. + size_t allocation_granularity_ = 0; + + // Size of a VM page. + size_t pagesize_ = 0; + + // Are we debugging ACE? + // Keeps track of whether we're in some global debug mode. + char debug_; +} + + +int +ACE::out_of_handles (int error) +{ + // EMFILE is common to all platforms. + if (error == EMFILE || +#if defined (ACE_WIN32) + // On Win32, we need to check for ENOBUFS also. + error == ENOBUFS || +#elif defined (HPUX) + // On HPUX, we need to check for EADDRNOTAVAIL also. + error == EADDRNOTAVAIL || +#elif defined (linux) + // On linux, we need to check for ENOENT also. + error == ENOENT || + // For RedHat5.2, need to check for EINVAL too. + error == EINVAL || + // Without threads check for EOPNOTSUPP + error == EOPNOTSUPP || +#elif defined (sun) + // On sun, we need to check for ENOSR also. + error == ENOSR || + // Without threads check for ENOTSUP + error == ENOTSUP || +#elif defined (__FreeBSD__) + // On FreeBSD we need to check for EOPNOTSUPP (LinuxThreads) or + // ENOSYS (libc_r threads) also. + error == EOPNOTSUPP || + error == ENOSYS || +#elif defined (__OpenBSD__) + // OpenBSD appears to return EBADF. + error == EBADF || +#elif defined (__sgi) // irix + error == ENOTSUP || +#elif defined (DIGITAL_UNIX) // osf1 + error == ENOTSUP || +#endif /* ACE_WIN32 */ + error == ENFILE) + return 1; + else + return 0; +} + +u_int +ACE::major_version (void) +{ + return ACE_MAJOR_VERSION; +} + +u_int +ACE::minor_version (void) +{ + return ACE_MINOR_VERSION; +} + +u_int +ACE::beta_version (void) +{ + return ACE_BETA_VERSION; +} + +const ACE_TCHAR * +ACE::compiler_name (void) +{ +#ifdef ACE_CC_NAME + return ACE_CC_NAME; +#else + return ACE_TEXT (""); +#endif +} + +u_int +ACE::compiler_major_version (void) +{ +#ifdef ACE_CC_MAJOR_VERSION + return ACE_CC_MAJOR_VERSION; +#else + return 0; +#endif +} + +u_int +ACE::compiler_minor_version (void) +{ +#ifdef ACE_CC_MINOR_VERSION + return ACE_CC_MINOR_VERSION; +#else + return 0; +#endif +} + +u_int +ACE::compiler_beta_version (void) +{ +#ifdef ACE_CC_BETA_VERSION + return ACE_CC_BETA_VERSION; +#else + return 0; +#endif +} + +ACE_TCHAR +ACE::nibble2hex (u_int n) +{ + // Yes, this works for UNICODE + return ACE_TEXT ("0123456789abcdef")[n & 0x0f]; +} + +bool +ACE::debug (void) +{ + static const char* debug = ACE_OS::getenv ("ACE_DEBUG"); + return (ACE::debug_ != 0) ? ACE::debug_ : (debug != 0 ? (*debug != '0') : false); +} + +void +ACE::debug (bool onoff) +{ + ACE::debug_ = onoff; +} + +int +ACE::select (int width, + ACE_Handle_Set *readfds, + ACE_Handle_Set *writefds, + ACE_Handle_Set *exceptfds, + const ACE_Time_Value *timeout) +{ + int result = ACE_OS::select (width, + readfds ? readfds->fdset () : 0, + writefds ? writefds->fdset () : 0, + exceptfds ? exceptfds->fdset () : 0, + timeout); + if (result > 0) + { +# if !defined (ACE_WIN32) + // This isn't needed for Windows... it's a no-op anyway. + if (readfds) + readfds->sync ((ACE_HANDLE) width); + if (writefds) + writefds->sync ((ACE_HANDLE) width); + if (exceptfds) + exceptfds->sync ((ACE_HANDLE) width); +#endif /* ACE_WIN32 */ + } + return result; +} + +int +ACE::select (int width, + ACE_Handle_Set &readfds, + const ACE_Time_Value *timeout) +{ + int result = ACE_OS::select (width, + readfds.fdset (), + 0, + 0, + timeout); + +#if !defined (ACE_WIN32) + if (result > 0) + readfds.sync ((ACE_HANDLE) width); +#endif /* ACE_WIN32 */ + return result; +} + +int +ACE::terminate_process (pid_t pid) +{ +#if defined (ACE_HAS_PHARLAP) + ACE_UNUSED_ARG (pid); + ACE_NOTSUP_RETURN (-1); +#elif defined (ACE_WIN32) + // Create a handle for the given process id. + ACE_HANDLE process_handle = + ::OpenProcess (PROCESS_TERMINATE, + FALSE, // New handle is not inheritable. + pid); + + if (process_handle == ACE_INVALID_HANDLE + || process_handle == 0) + return -1; + else + { + // Kill the process associated with process_handle. + BOOL terminate_result = + ::TerminateProcess (process_handle, 0); + // Free up the kernel resources. + ACE_OS::close (process_handle); + return terminate_result ? 0 : -1; + } +#else + return ACE_OS::kill (pid, 9); +#endif /* ACE_HAS_PHARLAP */ +} + +int +ACE::process_active (pid_t pid) +{ +#if !defined(ACE_WIN32) + if (ACE_OS::kill (pid, 0) == 0) + return 1; + else if (errno == ESRCH) + return 0; + else + return -1; +#else + // Create a handle for the given process id. + ACE_HANDLE process_handle = + ::OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, pid); + if (process_handle == ACE_INVALID_HANDLE || process_handle == 0) + return 0; + else + { + DWORD status; + int result = 1; + if (::GetExitCodeProcess (process_handle, + &status) == 0 + || status != STILL_ACTIVE) + result = 0; + + ::CloseHandle (process_handle); + return result; + } +#endif /* !ACE_WIN32 */ +} + +const ACE_TCHAR * +ACE::execname (const ACE_TCHAR *old_name) +{ +#if defined (ACE_WIN32) + const ACE_TCHAR *suffix = ACE_OS::strrchr (old_name, ACE_TEXT ('.')); + if (suffix == 0 || ACE_OS::strcasecmp (suffix, ACE_TEXT (".exe")) != 0) + { + ACE_TCHAR *new_name = 0; + + size_t size = + ACE_OS::strlen (old_name) + + ACE_OS::strlen (ACE_TEXT (".exe")) + + 1; + + ACE_NEW_RETURN (new_name, + ACE_TCHAR[size], + 0); + ACE_TCHAR *end = new_name; + + end = ACE_OS::strecpy (new_name, old_name); + + // Concatenate the .exe suffix onto the end of the executable. + // end points _after_ the terminating nul. + ACE_OS::strcpy (end - 1, ACE_TEXT (".exe")); + + return new_name; + } +#endif /* ACE_WIN32 */ + return old_name; +} + +u_long +ACE::hash_pjw (const char *str, size_t len) +{ + u_long hash = 0; + + for (size_t i = 0; i < len; i++) + { + const char temp = str[i]; + hash = (hash << 4) + (temp * 13); + + u_long g = hash & 0xf0000000; + + if (g) + { + hash ^= (g >> 24); + hash ^= g; + } + } + + return hash; +} + +u_long +ACE::hash_pjw (const char *str) +{ + return ACE::hash_pjw (str, ACE_OS::strlen (str)); +} + +#if defined (ACE_HAS_WCHAR) +u_long +ACE::hash_pjw (const wchar_t *str, size_t len) +{ + u_long hash = 0; + + for (size_t i = 0; i < len; i++) + { + // @@ UNICODE: Does this function do the correct thing with wchar's? + + const wchar_t temp = str[i]; + hash = (hash << 4) + (temp * 13); + + u_long g = hash & 0xf0000000; + + if (g) + { + hash ^= (g >> 24); + hash ^= g; + } + } + + return hash; +} + +u_long +ACE::hash_pjw (const wchar_t *str) +{ + return ACE::hash_pjw (str, ACE_OS::strlen (str)); +} +#endif /* ACE_HAS_WCHAR */ + +ACE_TCHAR * +ACE::strenvdup (const ACE_TCHAR *str) +{ + ACE_TRACE ("ACE::strenvdup"); + + return ACE_OS::strenvdup (str); +} + +/* + +Examples: + +Source NT UNIX +================================================================== +netsvc netsvc.dll libnetsvc.so +(PATH will be (LD_LIBRARY_PATH +evaluated) evaluated) + +libnetsvc.dll libnetsvc.dll libnetsvc.dll + warning +netsvc.so netsvc.so + warning libnetsvc.so + +..\../libs/netsvc ..\..\libs\netsvc.dll ../../libs/netsvc.so +(absolute path used) (absolute path used) + +*/ + +const ACE_TCHAR * +ACE::basename (const ACE_TCHAR *pathname, ACE_TCHAR delim) +{ + ACE_TRACE ("ACE::basename"); + const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim); + + if (temp == 0) + return pathname; + else + return temp + 1; +} + +const ACE_TCHAR * +ACE::dirname (const ACE_TCHAR *pathname, ACE_TCHAR delim) +{ + ACE_TRACE ("ACE::dirname"); + static ACE_TCHAR return_dirname[MAXPATHLEN + 1]; + + const ACE_TCHAR *temp = ACE_OS::strrchr (pathname, delim); + + if (temp == 0) + { + return_dirname[0] = '.'; + return_dirname[1] = '\0'; + + return return_dirname; + } + else + { + // When the len is truncated, there are problems! This should + // not happen in normal circomstances + size_t len = temp - pathname + 1; + if (len > (sizeof return_dirname / sizeof (ACE_TCHAR))) + len = sizeof return_dirname / sizeof (ACE_TCHAR); + + ACE_OS::strsncpy (return_dirname, + pathname, + len); + return return_dirname; + } +} + +ssize_t +ACE::recv (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::recv (handle, (char *) buf, len, flags); + else + { + int val = 0; + if (ACE::enter_recv_timedwait (handle, timeout, val) ==-1) + return -1; + else + { + ssize_t bytes_transferred = + ACE_OS::recv (handle, (char *) buf, len, flags); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +#if defined (ACE_HAS_TLI) + +ssize_t +ACE::t_rcv (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::t_rcv (handle, (char *) buf, len, flags); + else + { + int val = 0; + if (ACE::enter_recv_timedwait (handle, timeout, val) ==-1) + return -1; + else + { + ssize_t bytes_transferred = + ACE_OS::t_rcv (handle, (char *) buf, len, flags); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +#endif /* ACE_HAS_TLI */ + +ssize_t +ACE::recv (ACE_HANDLE handle, + void *buf, + size_t n, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::recv_i (handle, buf, n); + else + { + int val = 0; + if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE::recv_i (handle, buf, n); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::recvmsg (ACE_HANDLE handle, + struct msghdr *msg, + int flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::recvmsg (handle, msg, flags); + else + { + int val = 0; + if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE_OS::recvmsg (handle, msg, flags); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::recvfrom (ACE_HANDLE handle, + char *buf, + int len, + int flags, + struct sockaddr *addr, + int *addrlen, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::recvfrom (handle, buf, len, flags, addr, addrlen); + else + { + int val = 0; + if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = + ACE_OS::recvfrom (handle, buf, len, flags, addr, addrlen); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + n = ACE_OS::recv (handle, + static_cast (buf) + bytes_transferred, + len - bytes_transferred, + flags); + // Check EOF. + if (n == 0) + return 0; + + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. + if (errno == EWOULDBLOCK) + { + // Wait for the blocking to subside. + int const result = ACE::handle_read_ready (handle, 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + } + + return static_cast (bytes_transferred); +} + +ssize_t +ACE::recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + n = ACE_OS::recv (handle, + static_cast (buf) + bytes_transferred, + len - bytes_transferred, + flags); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + errno == EWOULDBLOCK) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_read_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + return result; + else + return static_cast (bytes_transferred); +} + +#if defined (ACE_HAS_TLI) + +ssize_t +ACE::t_rcv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + n = ACE_OS::t_rcv (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred, + flags); + // Check EOF. + if (n == 0) + return 0; + + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. + if (errno == EWOULDBLOCK) + { + // Wait for the blocking to subside. + int result = ACE::handle_read_ready (handle, + 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + } + + return bytes_transferred; +} + +ssize_t +ACE::t_rcv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + n = ACE_OS::t_rcv (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred, + flags); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + errno == EWOULDBLOCK) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_read_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + return result; + else + return bytes_transferred; +} + +#endif /* ACE_HAS_TLI */ + +ssize_t +ACE::recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + n = ACE::recv_i (handle, + static_cast (buf) + bytes_transferred, + len - bytes_transferred); + // Check EOF. + if (n == 0) + { + return 0; + } + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. + if (errno == EWOULDBLOCK) + { + // Wait for the blocking to subside. + int result = ACE::handle_read_ready (handle, + 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + } + + return static_cast (bytes_transferred); +} + +ssize_t +ACE::recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + n = ACE::recv_i (handle, + static_cast (buf) + bytes_transferred, + len - bytes_transferred); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + errno == EWOULDBLOCK) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_read_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + return result; + else + return static_cast (bytes_transferred); +} + +// This is basically an interface to ACE_OS::readv, that doesn't use +// the struct iovec explicitly. The ... can be passed as an arbitrary +// number of (char *ptr, int len) tuples. However, the count N is the +// *total* number of trailing arguments, *not* a couple of the number +// of tuple pairs! + +ssize_t +ACE::recv (ACE_HANDLE handle, size_t n, ...) +{ + va_list argp; + int total_tuples = static_cast (n / 2); + iovec *iovp; +#if defined (ACE_HAS_ALLOCA) + iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); +#else + ACE_NEW_RETURN (iovp, + iovec[total_tuples], + -1); +#endif /* !defined (ACE_HAS_ALLOCA) */ + + va_start (argp, n); + + for (int i = 0; i < total_tuples; i++) + { + iovp[i].iov_base = va_arg (argp, char *); + iovp[i].iov_len = va_arg (argp, int); + } + + ssize_t result = ACE_OS::recvv (handle, iovp, total_tuples); +#if !defined (ACE_HAS_ALLOCA) + delete [] iovp; +#endif /* !defined (ACE_HAS_ALLOCA) */ + va_end (argp); + return result; +} + +ssize_t +ACE::recvv (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::recvv (handle, iov, iovcnt); + else + { + int val = 0; + if (ACE::enter_recv_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE_OS::recvv (handle, iov, iovcnt); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::recvv_n_i (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + + for (int s = 0; + s < iovcnt; + ) + { + // Try to transfer as much of the remaining data as possible. + ssize_t n = ACE_OS::recvv (handle, + iov + s, + iovcnt - s); + // Check EOF. + if (n == 0) + return 0; + + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. + if (errno == EWOULDBLOCK) + { + // Wait for the blocking to subside. + int result = ACE::handle_read_ready (handle, + 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + + for (bytes_transferred += n; + s < iovcnt + && n >= static_cast (iov[s].iov_len); + s++) + n -= iov[s].iov_len; + + if (n != 0) + { + char *base = static_cast (iov[s].iov_base); + iov[s].iov_base = base + n; + iov[s].iov_len = iov[s].iov_len - n; + } + } + + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::recvv_n_i (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + for (int s = 0; + s < iovcnt; + ) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + ssize_t n = ACE_OS::recvv (handle, + iov + s, + iovcnt - s); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + errno == EWOULDBLOCK) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_read_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + + for (bytes_transferred += n; + s < iovcnt + && n >= static_cast (iov[s].iov_len); + s++) + n -= iov[s].iov_len; + + if (n != 0) + { + char *base = reinterpret_cast (iov[s].iov_base); + iov[s].iov_base = base + n; + iov[s].iov_len = iov[s].iov_len - n; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + { + return result; + } + else + { + return ACE_Utils::truncate_cast (bytes_transferred); + } +} + +ssize_t +ACE::recv_n (ACE_HANDLE handle, + ACE_Message_Block *message_block, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + + iovec iov[ACE_IOV_MAX]; + int iovcnt = 0; + + while (message_block != 0) + { + // Our current message block chain. + const ACE_Message_Block *current_message_block = message_block; + + while (current_message_block != 0) + { + size_t current_message_block_length = + current_message_block->length (); + char *this_rd_ptr = current_message_block->rd_ptr (); + + // Check if this block has any space for incoming data. + while (current_message_block_length > 0) + { + u_long const this_chunk_length = + ACE_Utils::truncate_cast ( + current_message_block_length); + + // Collect the data in the iovec. + iov[iovcnt].iov_base = this_rd_ptr; + iov[iovcnt].iov_len = this_chunk_length; + current_message_block_length -= this_chunk_length; + this_rd_ptr += this_chunk_length; + + // Increment iovec counter. + ++iovcnt; + + // The buffer is full make a OS call. @@ TODO find a way to + // find ACE_IOV_MAX for platforms that do not define it rather + // than simply setting ACE_IOV_MAX to some arbitrary value such + // as 16. + if (iovcnt == ACE_IOV_MAX) + { + size_t current_transfer = 0; + + ssize_t const result = ACE::recvv_n (handle, + iov, + iovcnt, + timeout, + ¤t_transfer); + + // Add to total bytes transferred. + bytes_transferred += current_transfer; + + // Errors. + if (result == -1 || result == 0) + return result; + + // Reset iovec counter. + iovcnt = 0; + } + } + + // Select the next message block in the chain. + current_message_block = current_message_block->cont (); + } + + // Selection of the next message block chain. + message_block = message_block->next (); + } + + // Check for remaining buffers to be sent. This will happen when + // ACE_IOV_MAX is not a multiple of the number of message blocks. + if (iovcnt != 0) + { + size_t current_transfer = 0; + + ssize_t const result = ACE::recvv_n (handle, + iov, + iovcnt, + timeout, + ¤t_transfer); + + // Add to total bytes transferred. + bytes_transferred += current_transfer; + + // Errors. + if (result == -1 || result == 0) + { + return result; + } + } + + // Return total bytes transferred. + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::send (ACE_HANDLE handle, + const void *buf, + size_t n, + int flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::send (handle, (const char *) buf, n, flags); + else + { + int val = 0; + if (ACE::enter_send_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE_OS::send (handle, (const char *) buf, n, flags); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +#if defined (ACE_HAS_TLI) + +ssize_t +ACE::t_snd (ACE_HANDLE handle, + const void *buf, + size_t n, + int flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::t_snd (handle, (const char *) buf, n, flags); + else + { + int val = 0; + if (ACE::enter_send_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE_OS::t_snd (handle, (const char *) buf, n, flags); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +#endif /* ACE_HAS_TLI */ + +ssize_t +ACE::send (ACE_HANDLE handle, + const void *buf, + size_t n, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::send_i (handle, buf, n); + else + { + int val = 0; + if (ACE::enter_send_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE::send_i (handle, buf, n); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::sendmsg (ACE_HANDLE handle, + const struct msghdr *msg, + int flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::sendmsg (handle, msg, flags); + else + { + int val = 0; + if (ACE::enter_send_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE_OS::sendmsg (handle, msg, flags); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::sendto (ACE_HANDLE handle, + const char *buf, + int len, + int flags, + const struct sockaddr *addr, + int addrlen, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::sendto (handle, buf, len, flags, addr, addrlen); + else + { + int val = 0; + if (ACE::enter_send_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = + ACE_OS::sendto (handle, buf, len, flags, addr, addrlen); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + n = ACE_OS::send (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred, + flags); + // Check EOF. + if (n == 0) + return 0; + + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. +#if defined (ACE_WIN32) + if (errno == EWOULDBLOCK) // If enobufs no need to loop +#else + if (errno == EWOULDBLOCK || errno == ENOBUFS) +#endif /* ACE_WIN32 */ + { + // Wait for the blocking to subside. + int result = ACE::handle_write_ready (handle, + 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + } + + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + n = ACE_OS::send (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred, + flags); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + (errno == EWOULDBLOCK || errno == ENOBUFS)) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_write_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + { + return result; + } + else + { + return ACE_Utils::truncate_cast (bytes_transferred); + } +} + +#if defined (ACE_HAS_TLI) + +ssize_t +ACE::t_snd_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + n = ACE_OS::t_snd (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred, + flags); + // Check EOF. + if (n == 0) + return 0; + + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. + if (errno == EWOULDBLOCK || errno == ENOBUFS) + { + // Wait for the blocking to subside. + int result = ACE::handle_write_ready (handle, + 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + } + + return bytes_transferred; +} + +ssize_t +ACE::t_snd_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + n = ACE_OS::t_snd (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred, + flags); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + errno == EWOULDBLOCK || errno == ENOBUFS) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_write_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + return result; + else + return bytes_transferred; +} + +#endif /* ACE_HAS_TLI */ + +ssize_t +ACE::send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + n = ACE::send_i (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred); + // Check EOF. + if (n == 0) + { + return 0; + } + + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. + if (errno == EWOULDBLOCK || errno == ENOBUFS) + { + // Wait for the blocking to subside. + int result = ACE::handle_write_ready (handle, + 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + } + + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + ssize_t n; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + for (bytes_transferred = 0; + bytes_transferred < len; + bytes_transferred += n) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + n = ACE::send_i (handle, + (char *) buf + bytes_transferred, + len - bytes_transferred); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + (errno == EWOULDBLOCK || errno == ENOBUFS)) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_write_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + { + return result; + } + else + { + return ACE_Utils::truncate_cast (bytes_transferred); + } +} + +// Send N char *ptrs and int lengths. Note that the char *'s precede +// the ints (basically, an varargs version of writev). The count N is +// the *total* number of trailing arguments, *not* a couple of the +// number of tuple pairs! + +ssize_t +ACE::send (ACE_HANDLE handle, size_t n, ...) +{ + va_list argp; + int total_tuples = static_cast (n / 2); + iovec *iovp; +#if defined (ACE_HAS_ALLOCA) + iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); +#else + ACE_NEW_RETURN (iovp, + iovec[total_tuples], + -1); +#endif /* !defined (ACE_HAS_ALLOCA) */ + + va_start (argp, n); + + for (int i = 0; i < total_tuples; i++) + { + iovp[i].iov_base = va_arg (argp, char *); + iovp[i].iov_len = va_arg (argp, int); + } + + ssize_t result = ACE_OS::sendv (handle, iovp, total_tuples); +#if !defined (ACE_HAS_ALLOCA) + delete [] iovp; +#endif /* !defined (ACE_HAS_ALLOCA) */ + va_end (argp); + return result; +} + +ssize_t +ACE::sendv (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE_OS::sendv (handle, iov, iovcnt); + else + { + int val = 0; + if (ACE::enter_send_timedwait (handle, timeout, val) == -1) + return -1; + else + { + ssize_t bytes_transferred = ACE_OS::sendv (handle, iov, iovcnt); + ACE::restore_non_blocking_mode (handle, val); + return bytes_transferred; + } + } +} + +ssize_t +ACE::sendv_n_i (ACE_HANDLE handle, + const iovec *i, + int iovcnt, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + + iovec *iov = const_cast (i); + + for (int s = 0; + s < iovcnt; + ) + { + // Try to transfer as much of the remaining data as possible. + ssize_t n = ACE_OS::sendv (handle, + iov + s, + iovcnt - s); + // Check EOF. + if (n == 0) + return 0; + + // Check for other errors. + if (n == -1) + { + // Check for possible blocking. + if (errno == EWOULDBLOCK || errno == ENOBUFS) + { + // Wait for the blocking to subside. + int result = ACE::handle_write_ready (handle, + 0); + + // Did select() succeed? + if (result != -1) + { + // Blocking subsided. Continue data transfer. + n = 0; + continue; + } + } + + // Other data transfer or select() failures. + return -1; + } + + for (bytes_transferred += n; + s < iovcnt + && n >= static_cast (iov[s].iov_len); + s++) + n -= iov[s].iov_len; + + if (n != 0) + { + char *base = reinterpret_cast (iov[s].iov_base); + iov[s].iov_base = base + n; + iov[s].iov_len = iov[s].iov_len - n; + } + } + + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::sendv_n_i (ACE_HANDLE handle, + const iovec *i, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + ssize_t result = 0; + int error = 0; + + int val = 0; + ACE::record_and_set_non_blocking_mode (handle, val); + + iovec *iov = const_cast (i); + + for (int s = 0; + s < iovcnt; + ) + { + // Try to transfer as much of the remaining data as possible. + // Since the socket is in non-blocking mode, this call will not + // block. + ssize_t n = ACE_OS::sendv (handle, + iov + s, + iovcnt - s); + + // Check for errors. + if (n == 0 || + n == -1) + { + // Check for possible blocking. + if (n == -1 && + (errno == EWOULDBLOCK || errno == ENOBUFS)) + { + // Wait upto for the blocking to subside. + int rtn = ACE::handle_write_ready (handle, + timeout); + + // Did select() succeed? + if (rtn != -1) + { + // Blocking subsided in period. Continue + // data transfer. + n = 0; + continue; + } + } + + // Wait in select() timed out or other data transfer or + // select() failures. + error = 1; + result = n; + break; + } + + for (bytes_transferred += n; + s < iovcnt + && n >= static_cast (iov[s].iov_len); + s++) + n -= iov[s].iov_len; + + if (n != 0) + { + char *base = reinterpret_cast (iov[s].iov_base); + iov[s].iov_base = base + n; + iov[s].iov_len = iov[s].iov_len - n; + } + } + + ACE::restore_non_blocking_mode (handle, val); + + if (error) + { + return result; + } + else + { + return ACE_Utils::truncate_cast (bytes_transferred); + } +} + +ssize_t +ACE::write_n (ACE_HANDLE handle, + const ACE_Message_Block *message_block, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + + iovec iov[ACE_IOV_MAX]; + int iovcnt = 0; + + while (message_block != 0) + { + // Our current message block chain. + const ACE_Message_Block *current_message_block = message_block; + + while (current_message_block != 0) + { + size_t current_message_block_length = + current_message_block->length (); + char *this_block_ptr = current_message_block->rd_ptr (); + + // Check if this block has any data to be sent. + while (current_message_block_length > 0) + { + u_long const this_chunk_length = + ACE_Utils::truncate_cast ( + current_message_block_length); + + // Collect the data in the iovec. + iov[iovcnt].iov_base = this_block_ptr; + iov[iovcnt].iov_len = this_chunk_length; + current_message_block_length -= this_chunk_length; + this_block_ptr += this_chunk_length; + + // Increment iovec counter. + ++iovcnt; + + // The buffer is full make a OS call. @@ TODO find a way to + // find ACE_IOV_MAX for platforms that do not define it rather + // than simply setting ACE_IOV_MAX to some arbitrary value such + // as 16. + if (iovcnt == ACE_IOV_MAX) + { + size_t current_transfer = 0; + + ssize_t const result = ACE::writev_n (handle, + iov, + iovcnt, + ¤t_transfer); + + // Add to total bytes transferred. + bytes_transferred += current_transfer; + + // Errors. + if (result == -1 || result == 0) + return result; + + // Reset iovec counter. + iovcnt = 0; + } + } + + // Select the next message block in the chain. + current_message_block = current_message_block->cont (); + } + + // Selection of the next message block chain. + message_block = message_block->next (); + } + + // Check for remaining buffers to be sent. This will happen when + // ACE_IOV_MAX is not a multiple of the number of message blocks. + if (iovcnt != 0) + { + size_t current_transfer = 0; + + ssize_t const result = ACE::writev_n (handle, + iov, + iovcnt, + ¤t_transfer); + + // Add to total bytes transferred. + bytes_transferred += current_transfer; + + // Errors. + if (result == -1 || result == 0) + return result; + } + + // Return total bytes transferred. + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::send_n (ACE_HANDLE handle, + const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + + iovec iov[ACE_IOV_MAX]; + int iovcnt = 0; + + while (message_block != 0) + { + // Our current message block chain. + const ACE_Message_Block *current_message_block = message_block; + + while (current_message_block != 0) + { + char *this_block_ptr = current_message_block->rd_ptr (); + size_t current_message_block_length = + current_message_block->length (); + + // Check if this block has any data to be sent. + while (current_message_block_length > 0) + { + u_long const this_chunk_length = + ACE_Utils::truncate_cast ( + current_message_block_length); + + // Collect the data in the iovec. + iov[iovcnt].iov_base = this_block_ptr; + iov[iovcnt].iov_len = this_chunk_length; + current_message_block_length -= this_chunk_length; + this_block_ptr += this_chunk_length; + + // Increment iovec counter. + ++iovcnt; + + // The buffer is full make a OS call. @@ TODO find a way to + // find ACE_IOV_MAX for platforms that do not define it rather + // than simply setting ACE_IOV_MAX to some arbitrary value such + // as 16. + if (iovcnt == ACE_IOV_MAX) + { + size_t current_transfer = 0; + + ssize_t const result = ACE::sendv_n (handle, + iov, + iovcnt, + timeout, + ¤t_transfer); + + // Add to total bytes transferred. + bytes_transferred += current_transfer; + + // Errors. + if (result == -1 || result == 0) + return result; + + // Reset iovec counter. + iovcnt = 0; + } + } + + // Select the next message block in the chain. + current_message_block = current_message_block->cont (); + } + + // Selection of the next message block chain. + message_block = message_block->next (); + } + + // Check for remaining buffers to be sent. This will happen when + // ACE_IOV_MAX is not a multiple of the number of message blocks. + if (iovcnt != 0) + { + size_t current_transfer = 0; + + ssize_t const result = ACE::sendv_n (handle, + iov, + iovcnt, + timeout, + ¤t_transfer); + + // Add to total bytes transferred. + bytes_transferred += current_transfer; + + // Errors. + if (result == -1 || result == 0) + { + return result; + } + } + + // Return total bytes transferred. + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::readv_n (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + + for (int s = 0; + s < iovcnt; + ) + { + ssize_t n = ACE_OS::readv (handle, + iov + s, + iovcnt - s); + + if (n == -1 || n == 0) + return n; + + for (bytes_transferred += n; + s < iovcnt + && n >= static_cast (iov[s].iov_len); + s++) + n -= iov[s].iov_len; + + if (n != 0) + { + char *base = reinterpret_cast (iov[s].iov_base); + iov[s].iov_base = base + n; + iov[s].iov_len = iov[s].iov_len - n; + } + } + + return ACE_Utils::truncate_cast (bytes_transferred); +} + +ssize_t +ACE::writev_n (ACE_HANDLE handle, + const iovec *i, + int iovcnt, + size_t *bt) +{ + size_t temp; + size_t &bytes_transferred = bt == 0 ? temp : *bt; + bytes_transferred = 0; + + iovec *iov = const_cast (i); + + for (int s = 0; + s < iovcnt; + ) + { + ssize_t n = ACE_OS::writev (handle, + iov + s, + iovcnt - s); + + if (n == -1 || n == 0) + { + return n; + } + + for (bytes_transferred += n; + s < iovcnt + && n >= static_cast (iov[s].iov_len); + s++) + n -= iov[s].iov_len; + + if (n != 0) + { + char *base = reinterpret_cast (iov[s].iov_base); + iov[s].iov_base = base + n; + iov[s].iov_len = iov[s].iov_len - n; + } + } + + return ACE_Utils::truncate_cast (bytes_transferred); +} + +int +ACE::handle_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout, + int read_ready, + int write_ready, + int exception_ready) +{ +#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) + ACE_UNUSED_ARG (write_ready); + ACE_UNUSED_ARG (exception_ready); + + struct pollfd fds; + + fds.fd = handle; + fds.events = read_ready ? POLLIN : POLLOUT; + fds.revents = 0; + + int result = ACE_OS::poll (&fds, 1, timeout); +#else + ACE_Handle_Set handle_set; + handle_set.set_bit (handle); + + // Wait for data or for the timeout to elapse. + int select_width; +# if defined (ACE_WIN32) + // This arg is ignored on Windows and causes pointer truncation + // warnings on 64-bit compiles. + select_width = 0; +# else + select_width = int (handle) + 1; +# endif /* ACE_WIN64 */ + int result = ACE_OS::select (select_width, + read_ready ? handle_set.fdset () : 0, // read_fds. + write_ready ? handle_set.fdset () : 0, // write_fds. + exception_ready ? handle_set.fdset () : 0, // exception_fds. + timeout); + +#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ + + switch (result) + { + case 0: // Timer expired. + errno = ETIME; + /* FALLTHRU */ + case -1: // we got here directly - select() returned -1. + return -1; + case 1: // Handle has data. + /* FALLTHRU */ + default: // default is case result > 0; return a + // ACE_ASSERT (result == 1); + return result; + } +} + +int +ACE::enter_recv_timedwait (ACE_HANDLE handle, + const ACE_Time_Value *timeout, + int &val) +{ + int result = ACE::handle_read_ready (handle, + timeout); + + if (result == -1) + return -1; + + ACE::record_and_set_non_blocking_mode (handle, + val); + + return result; +} + +int +ACE::enter_send_timedwait (ACE_HANDLE handle, + const ACE_Time_Value *timeout, + int &val) +{ + int result = ACE::handle_write_ready (handle, + timeout); + + if (result == -1) + return -1; + + ACE::record_and_set_non_blocking_mode (handle, + val); + + return result; +} + +void +ACE::record_and_set_non_blocking_mode (ACE_HANDLE handle, + int &val) +{ + // We need to record whether we are already *in* nonblocking mode, + // so that we can correctly reset the state when we're done. + val = ACE::get_flags (handle); + + if (ACE_BIT_DISABLED (val, ACE_NONBLOCK)) + // Set the handle into non-blocking mode if it's not already in + // it. + ACE::set_flags (handle, ACE_NONBLOCK); +} + +void +ACE::restore_non_blocking_mode (ACE_HANDLE handle, + int val) +{ + if (ACE_BIT_DISABLED (val, + ACE_NONBLOCK)) + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + // Only disable ACE_NONBLOCK if we weren't in non-blocking mode + // originally. + ACE::clr_flags (handle, ACE_NONBLOCK); + } +} + + +// Format buffer into printable format. This is useful for debugging. +// Portions taken from mdump by J.P. Knight (J.P.Knight@lut.ac.uk) +// Modifications by Todd Montgomery. + +size_t +ACE::format_hexdump (const char *buffer, + size_t size, + ACE_TCHAR *obuf, + size_t obuf_sz) +{ + ACE_TRACE ("ACE::format_hexdump"); + + u_char c; + ACE_TCHAR textver[16 + 1]; + + // We can fit 16 bytes output in text mode per line, 4 chars per byte. + size_t maxlen = (obuf_sz / 68) * 16; + + if (size > maxlen) + size = maxlen; + + size_t i; + + size_t const lines = size / 16; + for (i = 0; i < lines; i++) + { + size_t j; + + for (j = 0 ; j < 16; j++) + { + c = (u_char) buffer[(i << 4) + j]; // or, buffer[i*16+j] + ACE_OS::sprintf (obuf, + ACE_TEXT ("%02x "), + c); + obuf += 3; + if (j == 7) + { + ACE_OS::sprintf (obuf, + ACE_TEXT (" ")); + ++obuf; + } + textver[j] = ACE_OS::ace_isprint (c) ? c : '.'; + } + + textver[j] = 0; + + ACE_OS::sprintf (obuf, +#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) + ACE_TEXT (" %ls\n"), +#else + ACE_TEXT (" %s\n"), +#endif + textver); + + while (*obuf != '\0') + ++obuf; + } + + if (size % 16) + { + for (i = 0 ; i < size % 16; i++) + { + c = (u_char) buffer[size - size % 16 + i]; + ACE_OS::sprintf (obuf, + ACE_TEXT ("%02x "), + c); + obuf += 3; + if (i == 7) + { + ACE_OS::sprintf (obuf, + ACE_TEXT (" ")); + ++obuf; + } + textver[i] = ACE_OS::ace_isprint (c) ? c : '.'; + } + + for (i = size % 16; i < 16; i++) + { + ACE_OS::sprintf (obuf, + ACE_TEXT (" ")); + obuf += 3; + if (i == 7) + { + ACE_OS::sprintf (obuf, + ACE_TEXT (" ")); + ++obuf; + } + textver[i] = ' '; + } + + textver[i] = 0; + ACE_OS::sprintf (obuf, +#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) + ACE_TEXT (" %ls\n"), +#else + ACE_TEXT (" %s\n"), +#endif + textver); + } + return size; +} + +// Returns the current timestamp in the form +// "hour:minute:second:microsecond." The month, day, and year are +// also stored in the beginning of the date_and_time array. + +ACE_TCHAR * +ACE::timestamp (ACE_TCHAR date_and_time[], + size_t date_and_timelen, + bool return_pointer_to_first_digit) +{ + return ACE::timestamp (ACE_Time_Value::zero, + date_and_time, + date_and_timelen, + return_pointer_to_first_digit); +} + +// Returns the given timestamp in the form +// "hour:minute:second:microsecond." The month, day, and year are +// also stored in the beginning of the date_and_time array. + +ACE_TCHAR * +ACE::timestamp (const ACE_Time_Value& time_value, + ACE_TCHAR date_and_time[], + size_t date_and_timelen, + bool return_pointer_to_first_digit) +{ + //ACE_TRACE ("ACE::timestamp"); + + if (date_and_timelen < 35) + { + errno = EINVAL; + return 0; + } + +#if defined (WIN32) + if (time_value == ACE_Time_Value::zero) + { + // Emulate Unix. Win32 does NOT support all the UNIX versions + // below, so DO we need this ifdef. + static const ACE_TCHAR *day_of_week_name[] = + { + ACE_TEXT ("Sun"), + ACE_TEXT ("Mon"), + ACE_TEXT ("Tue"), + ACE_TEXT ("Wed"), + ACE_TEXT ("Thu"), + ACE_TEXT ("Fri"), + ACE_TEXT ("Sat") + }; + + static const ACE_TCHAR *month_name[] = + { + ACE_TEXT ("Jan"), + ACE_TEXT ("Feb"), + ACE_TEXT ("Mar"), + ACE_TEXT ("Apr"), + ACE_TEXT ("May"), + ACE_TEXT ("Jun"), + ACE_TEXT ("Jul"), + ACE_TEXT ("Aug"), + ACE_TEXT ("Sep"), + ACE_TEXT ("Oct"), + ACE_TEXT ("Nov"), + ACE_TEXT ("Dec") + }; + + SYSTEMTIME local; + ::GetLocalTime (&local); + + ACE_OS::sprintf (date_and_time, + ACE_TEXT ("%3s %3s %2d %04d %02d:%02d:%02d.%06d"), + day_of_week_name[local.wDayOfWeek], + month_name[local.wMonth - 1], + (int) local.wDay, + (int) local.wYear, + (int) local.wHour, + (int) local.wMinute, + (int) local.wSecond, + (int) (local.wMilliseconds * 1000)); + return &date_and_time[15 + (return_pointer_to_first_digit != 0)]; + } +#endif /* WIN32 */ + ACE_TCHAR timebuf[26]; // This magic number is based on the ctime(3c) man page. + ACE_Time_Value cur_time = + (time_value == ACE_Time_Value::zero) ? + ACE_Time_Value (ACE_OS::gettimeofday ()) : time_value; + time_t secs = cur_time.sec (); + + ACE_OS::ctime_r (&secs, + timebuf, + sizeof timebuf / sizeof (ACE_TCHAR)); + // date_and_timelen > sizeof timebuf! + ACE_OS::strsncpy (date_and_time, + timebuf, + date_and_timelen); + ACE_TCHAR yeartmp[5]; + ACE_OS::strsncpy (yeartmp, + &date_and_time[20], + 5); + ACE_TCHAR timetmp[9]; + ACE_OS::strsncpy (timetmp, + &date_and_time[11], + 9); + ACE_OS::sprintf (&date_and_time[11], +# if defined (ACE_USES_WCHAR) + ACE_TEXT ("%ls %ls.%06ld"), +# else + ACE_TEXT ("%s %s.%06ld"), +# endif /* ACE_USES_WCHAR */ + yeartmp, + timetmp, + cur_time.usec ()); + date_and_time[33] = '\0'; + return &date_and_time[15 + (return_pointer_to_first_digit != 0)]; +} + +// This function rounds the request to a multiple of the page size. + +size_t +ACE::round_to_pagesize (size_t len) +{ + ACE_TRACE ("ACE::round_to_pagesize"); + + if (ACE::pagesize_ == 0) + ACE::pagesize_ = ACE_OS::getpagesize (); + + return (len + (ACE::pagesize_ - 1)) & ~(ACE::pagesize_ - 1); +} + +size_t +ACE::round_to_allocation_granularity (size_t len) +{ + ACE_TRACE ("ACE::round_to_allocation_granularity"); + + if (ACE::allocation_granularity_ == 0) + ACE::allocation_granularity_ = ACE_OS::allocation_granularity (); + + return (len + (ACE::allocation_granularity_ - 1)) & ~(ACE::allocation_granularity_ - 1); +} + +ACE_HANDLE +ACE::handle_timed_complete (ACE_HANDLE h, + const ACE_Time_Value *timeout, + int is_tli) +{ + ACE_TRACE ("ACE::handle_timed_complete"); + +#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) + + struct pollfd fds; + + fds.fd = h; + fds.events = POLLIN | POLLOUT; + fds.revents = 0; + +#else + ACE_Handle_Set rd_handles; + ACE_Handle_Set wr_handles; + rd_handles.set_bit (h); + wr_handles.set_bit (h); +#endif /* !ACE_WIN32 && ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ + +#if defined (ACE_WIN32) + // Winsock is different - it sets the exception bit for failed connect, + // unlike other platforms, where the write bit is set for both success + // and fail. + ACE_Handle_Set ex_handles; + ex_handles.set_bit (h); +#endif /* ACE_WIN32 */ + + bool need_to_check = false; + bool known_failure = false; + +#if defined (ACE_WIN32) + int n = ACE_OS::select (0, // Ignored on Windows: int (h) + 1, + 0, + wr_handles, + ex_handles, + timeout); +#else +# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) + + int n = ACE_OS::poll (&fds, 1, timeout); + +# else + int n = 0; + if (is_tli) + n = ACE_OS::select (int (h) + 1, + rd_handles, + wr_handles, + 0, + timeout); + else + n = ACE_OS::select (int (h) + 1, + 0, + wr_handles, + 0, + timeout); +# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ +#endif /* ACE_WIN32 */ + + // If we failed to connect within the time period allocated by the + // caller, then we fail (e.g., the remote host might have been too + // busy to accept our call). + if (n <= 0) + { + if (n == 0 && timeout != 0) + errno = ETIME; + return ACE_INVALID_HANDLE; + } + + // On Windows, a ready-for-write handle is successfully connected, and + // ready-for-exception is a failure. On fails, we need to grab the error + // code via getsockopt. + // On BSD sockets using select(), the handle becomes writable on + // completion either success or fail, so if the select() does not time + // out, we need to check for success/fail. + // It is believed that TLI sockets use the readable=fail, writeable=success + // but that hasn't been as well tested. +#if defined (ACE_WIN32) + ACE_UNUSED_ARG (is_tli); + + // On Win32, ex_handle set indicates a failure. We'll do the check + // to try and get an errno value, but the connect failed regardless of + // what getsockopt says about the error. + if (ex_handles.is_set (h)) + { + need_to_check = true; + known_failure = true; + } +#else + if (is_tli) +# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) + need_to_check = (fds.revents & POLLIN) && !(fds.revents & POLLOUT); +# else + need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h); +# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ + + else +# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) + need_to_check = (fds.revents & POLLIN); +# else + need_to_check = true; +# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ +#endif /* ACE_WIN32 */ + + if (need_to_check) + { +#if defined (SOL_SOCKET) && defined (SO_ERROR) + int sock_err = 0; + int sock_err_len = sizeof (sock_err); + int sockopt_ret = ACE_OS::getsockopt (h, SOL_SOCKET, SO_ERROR, + (char *)&sock_err, &sock_err_len); + if (sockopt_ret < 0) + { + h = ACE_INVALID_HANDLE; + } + + if (sock_err != 0 || known_failure) + { + h = ACE_INVALID_HANDLE; + errno = sock_err; + } +#else + char dummy; + + // The following recv() won't block provided that the + // ACE_NONBLOCK flag has not been turned off . + n = ACE::recv (h, &dummy, 1, MSG_PEEK); + + // If no data was read/peeked at, check to see if it's because + // of a non-connected socket (and therefore an error) or there's + // just no data yet. + if (n <= 0) + { + if (n == 0) + { + errno = ECONNREFUSED; + h = ACE_INVALID_HANDLE; + } + else if (errno != EWOULDBLOCK && errno != EAGAIN) + h = ACE_INVALID_HANDLE; + } +#endif + } + + // 1. The HANDLE is ready for writing and doesn't need to be checked or + // 2. recv() returned an indication of the state of the socket - if there is + // either data present, or a recv is legit but there's no data yet, + // the connection was successfully established. + return h; +} + +// Wait up to amount of time to accept a connection. + +int +ACE::handle_timed_accept (ACE_HANDLE listener, + ACE_Time_Value *timeout, + bool restart) +{ + ACE_TRACE ("ACE::handle_timed_accept"); + // Make sure we don't bomb out on erroneous values. + if (listener == ACE_INVALID_HANDLE) + return -1; + +#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) + + struct pollfd fds; + + fds.fd = listener; + fds.events = POLLIN; + fds.revents = 0; + +#else + // Use the select() implementation rather than poll(). + ACE_Handle_Set rd_handle; + rd_handle.set_bit (listener); +#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ + + // We need a loop here if is enabled. + + for (;;) + { +#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) + + int n = ACE_OS::poll (&fds, 1, timeout); + +#else + int select_width; +# if defined (ACE_WIN32) + // This arg is ignored on Windows and causes pointer truncation + // warnings on 64-bit compiles. + select_width = 0; +# else + select_width = int (listener) + 1; +# endif /* ACE_WIN32 */ + int n = ACE_OS::select (select_width, + rd_handle, 0, 0, + timeout); +#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ + + switch (n) + { + case -1: + if (errno == EINTR && restart) + continue; + else + return -1; + /* NOTREACHED */ + case 0: + if (timeout != 0 && *timeout == ACE_Time_Value::zero) + errno = EWOULDBLOCK; + else + errno = ETIMEDOUT; + return -1; + /* NOTREACHED */ + case 1: + return 0; + /* NOTREACHED */ + default: + errno = EINVAL; + return -1; + /* NOTREACHED */ + } + } +} + +// Make the current process a UNIX daemon. This is based on Stevens +// code from APUE. + +int +ACE::daemonize (const ACE_TCHAR pathname[], + bool close_all_handles, + const ACE_TCHAR program_name[]) +{ + ACE_TRACE ("ACE::daemonize"); +#if !defined (ACE_LACKS_FORK) + pid_t pid = ACE_OS::fork (); + + if (pid == -1) + return -1; + else if (pid != 0) + ACE_OS::exit (0); // Parent exits. + + // 1st child continues. + ACE_OS::setsid (); // Become session leader. + + ACE_OS::signal (SIGHUP, SIG_IGN); + + pid = ACE_OS::fork (program_name); + + if (pid != 0) + ACE_OS::exit (0); // First child terminates. + + // Second child continues. + + if (pathname != 0) + // change working directory. + ACE_OS::chdir (pathname); + + ACE_OS::umask (0); // clear our file mode creation mask. + + // Close down the I/O handles. + if (close_all_handles) + { + for (int i = ACE::max_handles () - 1; i >= 0; i--) + ACE_OS::close (i); + + int fd = ACE_OS::open ("/dev/null", O_RDWR, 0); + if (fd != -1) + { + ACE_OS::dup2 (fd, ACE_STDIN); + ACE_OS::dup2 (fd, ACE_STDOUT); + ACE_OS::dup2 (fd, ACE_STDERR); + + if (fd > ACE_STDERR) + ACE_OS::close (fd); + } + } + + return 0; +#else + ACE_UNUSED_ARG (pathname); + ACE_UNUSED_ARG (close_all_handles); + ACE_UNUSED_ARG (program_name); + + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_LACKS_FORK */ +} + +pid_t +ACE::fork (const ACE_TCHAR *program_name, + int avoid_zombies) +{ + if (avoid_zombies == 0) + return ACE_OS::fork (program_name); + else + { + // This algorithm is adapted from an example in the Stevens book + // "Advanced Programming in the Unix Environment" and an item in + // Andrew Gierth's Unix Programming FAQ. It creates an orphan + // process that's inherited by the init process; init cleans up + // when the orphan process terminates. + // + // Another way to avoid zombies is to ignore or catch the + // SIGCHLD signal; we don't use that approach here. + + pid_t pid = ACE_OS::fork (); + if (pid == 0) + { + // The child process forks again to create a grandchild. + switch (ACE_OS::fork (program_name)) + { + case 0: // grandchild returns 0. + return 0; + case -1: // assumes all errnos are < 256 + ACE_OS::_exit (errno); + default: // child terminates, orphaning grandchild + ACE_OS::_exit (0); + } + } + + // Parent process waits for child to terminate. + ACE_exitcode status; + if (pid < 0 || ACE_OS::waitpid (pid, &status, 0) < 0) + return -1; + + // child terminated by calling exit()? + if (WIFEXITED ((status))) + { + // child terminated normally? + if (WEXITSTATUS ((status)) == 0) + return 1; + else + errno = WEXITSTATUS ((status)); + } + else + // child didn't call exit(); perhaps it received a signal? + errno = EINTR; + + return -1; + } +} + +int +ACE::max_handles (void) +{ + ACE_TRACE ("ACE::max_handles"); +#if defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT) + rlimit rl; + int const r = ACE_OS::getrlimit (RLIMIT_NOFILE, &rl); +# if !defined (RLIM_INFINITY) + if (r == 0) + return rl.rlim_cur; +# else + if (r == 0 && rl.rlim_cur != RLIM_INFINITY) + return rl.rlim_cur; + // If == RLIM_INFINITY, fall through to the ACE_LACKS_RLIMIT sections +# endif /* RLIM_INFINITY */ +#endif /* RLIMIT_NOFILE && !ACE_LACKS_RLIMIT */ + +#if defined (_SC_OPEN_MAX) + return ACE_OS::sysconf (_SC_OPEN_MAX); +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) + return maxFiles; +#elif defined (FD_SETSIZE) + return FD_SETSIZE; +#else + ACE_NOTSUP_RETURN (-1); +#endif /* _SC_OPEN_MAX */ +} + +// Set the number of currently open handles in the process. +// +// If NEW_LIMIT == -1 set the limit to the maximum allowable. +// Otherwise, set it to be the value of NEW_LIMIT. + +int +ACE::set_handle_limit (int new_limit, + int increase_limit_only) +{ + ACE_TRACE ("ACE::set_handle_limit"); + int cur_limit = ACE::max_handles (); + int max_limit = cur_limit; + + if (cur_limit == -1) + return -1; + +#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) + struct rlimit rl; + + ACE_OS::memset ((void *) &rl, 0, sizeof rl); + int r = ACE_OS::getrlimit (RLIMIT_NOFILE, &rl); + if (r == 0) + max_limit = rl.rlim_max; +#endif /* ACE_LACKS_RLIMIT */ + + if (new_limit == -1) + new_limit = max_limit; + + if (new_limit < 0) + { + errno = EINVAL; + return -1; + } + else if (new_limit > cur_limit) + { + // Increase the limit. +#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) + rl.rlim_cur = new_limit; + return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); +#elif defined (ACE_LACKS_RLIMIT_NOFILE) + return 0; +#else + // Must return EINVAL errno. + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_LACKS_RLIMIT */ + } + else if (increase_limit_only == 0) + { + // Decrease the limit. +#if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) + rl.rlim_cur = new_limit; + return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); +#else + // We give a chance to platforms without RLIMIT to work. + // Instead of ACE_NOTSUP_RETURN (0), just return 0 because + // new_limit is <= cur_limit, so it's a no-op. + return 0; +#endif /* ACE_LACKS_RLIMIT */ + } + + return 0; +} + +// Euclid's greatest common divisor algorithm. +u_long +ACE::gcd (u_long x, u_long y) +{ + while (y != 0) + { + u_long r = x % y; + x = y; + y = r; + } + + return x; +} + + +// Calculates the minimum enclosing frame size for the given values. +u_long +ACE::minimum_frame_size (u_long period1, u_long period2) +{ + // if one of the periods is zero, treat it as though it as + // uninitialized and return the other period as the frame size + if (0 == period1) + { + return period2; + } + if (0 == period2) + { + return period1; + } + + // if neither is zero, find the greatest common divisor of the two periods + u_long greatest_common_divisor = ACE::gcd (period1, period2); + + // explicitly consider cases to reduce risk of possible overflow errors + if (greatest_common_divisor == 1) + { + // periods are relative primes: just multiply them together + return period1 * period2; + } + else if (greatest_common_divisor == period1) + { + // the first period divides the second: return the second + return period2; + } + else if (greatest_common_divisor == period2) + { + // the second period divides the first: return the first + return period1; + } + else + { + // the current frame size and the entry's effective period + // have a non-trivial greatest common divisor: return the + // product of factors divided by those in their gcd. + return (period1 * period2) / greatest_common_divisor; + } +} + + +u_long +ACE::is_prime (const u_long n, + const u_long min_factor, + const u_long max_factor) +{ + if (n > 3) + for (u_long factor = min_factor; + factor <= max_factor; + ++factor) + if (n / factor * factor == n) + return factor; + + return 0; +} + +const ACE_TCHAR * +ACE::sock_error (int error) +{ +#if defined (ACE_WIN32) + static ACE_TCHAR unknown_msg[64]; + + switch (error) + { + case WSAVERNOTSUPPORTED: + return ACE_TEXT ("version of WinSock not supported"); + /* NOTREACHED */ + case WSASYSNOTREADY: + return ACE_TEXT ("WinSock not present or not responding"); + /* NOTREACHED */ + case WSAEINVAL: + return ACE_TEXT ("app version not supported by DLL"); + /* NOTREACHED */ + case WSAHOST_NOT_FOUND: + return ACE_TEXT ("Authoritive: Host not found"); + /* NOTREACHED */ + case WSATRY_AGAIN: + return ACE_TEXT ("Non-authoritive: host not found or server failure"); + /* NOTREACHED */ + case WSANO_RECOVERY: + return ACE_TEXT ("Non-recoverable: refused or not implemented"); + /* NOTREACHED */ + case WSANO_DATA: + return ACE_TEXT ("Valid name, no data record for type"); + /* NOTREACHED */ + /* + case WSANO_ADDRESS: + return "Valid name, no MX record"; + */ + case WSANOTINITIALISED: + return ACE_TEXT ("WSA Startup not initialized"); + /* NOTREACHED */ + case WSAENETDOWN: + return ACE_TEXT ("Network subsystem failed"); + /* NOTREACHED */ + case WSAEINPROGRESS: + return ACE_TEXT ("Blocking operation in progress"); + /* NOTREACHED */ + case WSAEINTR: + return ACE_TEXT ("Blocking call cancelled"); + /* NOTREACHED */ + case WSAEAFNOSUPPORT: + return ACE_TEXT ("address family not supported"); + /* NOTREACHED */ + case WSAEMFILE: + return ACE_TEXT ("no file handles available"); + /* NOTREACHED */ + case WSAENOBUFS: + return ACE_TEXT ("no buffer space available"); + /* NOTREACHED */ + case WSAEPROTONOSUPPORT: + return ACE_TEXT ("specified protocol not supported"); + /* NOTREACHED */ + case WSAEPROTOTYPE: + return ACE_TEXT ("protocol wrong type for this socket"); + /* NOTREACHED */ + case WSAESOCKTNOSUPPORT: + return ACE_TEXT ("socket type not supported for address family"); + /* NOTREACHED */ + case WSAENOTSOCK: + return ACE_TEXT ("handle is not a socket"); + /* NOTREACHED */ + case WSAEWOULDBLOCK: + return ACE_TEXT ("resource temporarily unavailable"); + /* NOTREACHED */ + case WSAEADDRINUSE: + return ACE_TEXT ("address already in use"); + /* NOTREACHED */ + case WSAECONNABORTED: + return ACE_TEXT ("connection aborted"); + /* NOTREACHED */ + case WSAECONNRESET: + return ACE_TEXT ("connection reset"); + /* NOTREACHED */ + case WSAENOTCONN: + return ACE_TEXT ("not connected"); + /* NOTREACHED */ + case WSAETIMEDOUT: + return ACE_TEXT ("connection timed out"); + /* NOTREACHED */ + case WSAECONNREFUSED: + return ACE_TEXT ("connection refused"); + /* NOTREACHED */ + case WSAEHOSTDOWN: + return ACE_TEXT ("host down"); + /* NOTREACHED */ + case WSAEHOSTUNREACH: + return ACE_TEXT ("host unreachable"); + /* NOTREACHED */ + case WSAEADDRNOTAVAIL: + return ACE_TEXT ("address not available"); + /* NOTREACHED */ + case WSAEISCONN: + return ACE_TEXT ("socket is already connected"); + /* NOTREACHED */ + case WSAENETRESET: + return ACE_TEXT ("network dropped connection on reset"); + /* NOTREACHED */ + case WSAEMSGSIZE: + return ACE_TEXT ("message too long"); + /* NOTREACHED */ + case WSAENETUNREACH: + return ACE_TEXT ("network is unreachable"); + /* NOTREACHED */ + case WSAEFAULT: + return ACE_TEXT ("bad address"); + /* NOTREACHED */ + case WSAEDISCON: + return ACE_TEXT ("graceful shutdown in progress"); + /* NOTREACHED */ + case WSAEACCES: + return ACE_TEXT ("permission denied"); + /* NOTREACHED */ + case WSAESHUTDOWN: + return ACE_TEXT ("cannot send after socket shutdown"); + /* NOTREACHED */ + case WSAEPROCLIM: + return ACE_TEXT ("too many processes"); + /* NOTREACHED */ + case WSAEALREADY: + return ACE_TEXT ("operation already in progress"); + /* NOTREACHED */ + case WSAEPFNOSUPPORT: + return ACE_TEXT ("protocol family not supported"); + /* NOTREACHED */ + case WSAENOPROTOOPT: + return ACE_TEXT ("bad protocol option"); + /* NOTREACHED */ + case WSATYPE_NOT_FOUND: + return ACE_TEXT ("class type not found"); + /* NOTREACHED */ + case WSAEOPNOTSUPP: + return ACE_TEXT ("operation not supported"); + /* NOTREACHED */ + case WSAEDESTADDRREQ: + return ACE_TEXT ("destination address required"); + /* NOTREACHED */ + default: + ACE_OS::sprintf (unknown_msg, ACE_TEXT ("unknown error: %d"), error); + return unknown_msg; + /* NOTREACHED */ + } +#else + ACE_UNUSED_ARG (error); + ACE_NOTSUP_RETURN (0); +#endif /* ACE_WIN32 */ +} + +bool +ACE::is_sock_error (int error) +{ +#if defined (ACE_WIN32) + switch (error) + { + case WSAVERNOTSUPPORTED: + case WSASYSNOTREADY: + case WSAEINVAL: + case WSAHOST_NOT_FOUND: + case WSATRY_AGAIN: + case WSANO_RECOVERY: + case WSANO_DATA: + /* + case WSANO_ADDRESS: + */ + case WSANOTINITIALISED: + case WSAENETDOWN: + case WSAEINPROGRESS: + case WSAEINTR: + case WSAEAFNOSUPPORT: + case WSAEMFILE: + case WSAENOBUFS: + case WSAEPROTONOSUPPORT: + case WSAEPROTOTYPE: + case WSAESOCKTNOSUPPORT: + case WSAENOTSOCK: + case WSAEWOULDBLOCK: + case WSAEADDRINUSE: + case WSAECONNABORTED: + case WSAECONNRESET: + case WSAENOTCONN: + case WSAETIMEDOUT: + case WSAECONNREFUSED: + case WSAEHOSTDOWN: + case WSAEHOSTUNREACH: + case WSAEADDRNOTAVAIL: + case WSAEISCONN: + case WSAENETRESET: + case WSAEMSGSIZE: + case WSAENETUNREACH: + case WSAEFAULT: + case WSAEDISCON: + case WSAEACCES: + case WSAESHUTDOWN: + case WSAEPROCLIM: + case WSAEALREADY: + case WSAEPFNOSUPPORT: + case WSAENOPROTOOPT: + case WSATYPE_NOT_FOUND: + case WSAEOPNOTSUPP: + return true; + } +#else + ACE_UNUSED_ARG (error); +#endif /* ACE_WIN32 */ + return false; +} + +char * +ACE::strndup (const char *str, size_t n) +{ + const char *t = str; + size_t len; + + // Figure out how long this string is (remember, it might not be + // NUL-terminated). + + for (len = 0; + len < n && *t++ != '\0'; + len++) + continue; + + char *s; + ACE_ALLOCATOR_RETURN (s, + (char *) ACE_OS::malloc (len + 1), + 0); + return ACE_OS::strsncpy (s, str, len + 1); +} + +#if defined (ACE_HAS_WCHAR) +wchar_t * +ACE::strndup (const wchar_t *str, size_t n) +{ + const wchar_t *t = str; + size_t len; + + // Figure out how long this string is (remember, it might not be + // NUL-terminated). + + for (len = 0; + len < n && *t++ != '\0'; + len++) + continue; + + wchar_t *s; + ACE_ALLOCATOR_RETURN (s, + static_cast ( + ACE_OS::malloc ((len + 1) * sizeof (wchar_t))), + 0); + return ACE_OS::strsncpy (s, str, len + 1); +} +#endif /* ACE_HAS_WCHAR */ + +char * +ACE::strnnew (const char *str, size_t n) +{ + const char *t = str; + size_t len; + + // Figure out how long this string is (remember, it might not be + // NUL-terminated). + + for (len = 0; + len < n && *t++ != L'\0'; + len++) + continue; + + char *s; + ACE_NEW_RETURN (s, + char[len + 1], + 0); + return ACE_OS::strsncpy (s, str, len + 1); +} + +#if defined (ACE_HAS_WCHAR) +wchar_t * +ACE::strnnew (const wchar_t *str, size_t n) +{ + const wchar_t *t = str; + size_t len; + + // Figure out how long this string is (remember, it might not be + // NUL-terminated). + + for (len = 0; + len < n && *t++ != ACE_TEXT_WIDE ('\0'); + len++) + continue; + + wchar_t *s; + ACE_NEW_RETURN (s, + wchar_t[len + 1], + 0); + return ACE_OS::strsncpy (s, str, len + 1); +} +#endif /* ACE_HAS_WCHAR */ + +const char * +ACE::strend (const char *s) +{ + while (*s++ != '\0') + continue; + + return s; +} + +#if defined ACE_HAS_WCHAR +const wchar_t * +ACE::strend (const wchar_t *s) +{ + while (*s++ != ACE_TEXT_WIDE ('\0')) + continue; + + return s; +} +#endif + +char * +ACE::strnew (const char *s) +{ + if (s == 0) + return 0; + char *t = 0; + ACE_NEW_RETURN (t, + char [ACE_OS::strlen (s) + 1], + 0); + if (t == 0) + return 0; + else + return ACE_OS::strcpy (t, s); +} + +#if defined (ACE_HAS_WCHAR) +wchar_t * +ACE::strnew (const wchar_t *s) +{ + if (s == 0) + return 0; + wchar_t *t = 0; + ACE_NEW_RETURN (t, + wchar_t[ACE_OS::strlen (s) + 1], + 0); + if (t == 0) + return 0; + else + return ACE_OS::strcpy (t, s); +} +#endif /* ACE_HAS_WCHAR */ + +// helper functions for ACE::wild_match() +namespace +{ + + inline bool equal_char (char a, char b, bool case_sensitive) + { + if (case_sensitive) + return a == b; + return ACE_OS::ace_tolower (a) == ACE_OS::ace_tolower (b); + } + + // precond: *p == '[' start of char class + // postcond: *p == ']' end of the char class + inline bool equal_class (char s, const char *&p, bool case_sensitive) + { + ++p; + bool negate = false; + if (*p == '!') + { + negate = true; + ++p; + } + // ] and - are regular in 1st position + for (bool first = true; *p && (first || *p != ']'); ++p) + { + if (!first && *p == '-' && p[1] != ']') + { + if (!p[1] || p[1] <= p[-1]) // invalid range + { + continue; + } + // Since we are in the POSIX locale, only the basic ASCII + // characters are allowed as the range endpoints. These characters + // are the same values in both signed and unsigned chars so we + // don't have to account for any "pathological cases." + for (char range = p[-1] + 1; range <= p[1]; ++range) + { + if (equal_char (s, range, case_sensitive)) + { + while (*++p != ']') {} + return !negate; + } + } + ++p; // consume the character 1 past the - + } + else if (equal_char (s, *p, case_sensitive)) + { + while (*++p != ']') {} + return !negate; + } + first = false; + } + return negate; + } +} + +bool +ACE::wild_match(const char *str, const char *pat, bool case_sensitive, + bool character_classes) +{ + if (str == pat) + return true; + if (pat == 0 || str == 0) + return false; + + bool star = false, escape = false; + const char *s = str; + const char *p = pat; + while (*s != '\0') + { + if (!escape && *p == '\\') + { + ++p; + escape = true; + } + else if (!escape && *p == '*') + { + star = true; + pat = p; + while (*++pat == '*') {} + + if (*pat == '\0') + return true; + p = pat; + } + else if (!escape && *p == '?') + { + ++s; + ++p; + } + else if (!escape && character_classes && *p == '[') + { + if (equal_class (*s, p, case_sensitive)) + { + ++p; + } + else + { + if (!star) + return false; + p = pat; + } + ++s; + } + else if (!equal_char (*s, *p, case_sensitive)) + { + if (!star) + return false; + ++s; + p = pat; + escape = false; + } + else + { + ++s; + ++p; + escape = false; + } + } + if (*p == '*') + while (*++p == '*') {} + + return *p == '\0'; +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ACE.h b/externals/ace/ACE.h new file mode 100644 index 0000000..56ce13c --- /dev/null +++ b/externals/ace/ACE.h @@ -0,0 +1,849 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ACE.h + * + * $Id: ACE.h 88193 2009-12-16 09:14:06Z mcorino $ + * + * This file contains value added ACE functions that extend the + * behavior of the UNIX and Win32 OS calls. + * + * All these ACE static functions are consolidated in a single place + * in order to manage the namespace better. These functions are put + * here rather than in @c ACE_OS in order to separate concerns. + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ACE_H +#define ACE_ACE_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_math.h" +#include "ace/Flag_Manip.h" +#include "ace/Handle_Ops.h" +#include "ace/Lib_Find.h" +#include "ace/Init_ACE.h" +#include "ace/Sock_Connect.h" +#include "ace/Default_Constants.h" + +#if defined (ACE_EXPORT_MACRO) +# undef ACE_EXPORT_MACRO +#endif +#define ACE_EXPORT_MACRO ACE_Export + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations. +class ACE_Time_Value; +class ACE_Message_Block; +class ACE_Handle_Set; + +/** + * @namespace ACE + * + * @brief The namespace containing the ACE framework itself. + * + * The ACE namespace contains all types (classes, structures, + * typedefs, etc), and global functions and variables in the ACE + * framework. + */ +namespace ACE +{ + // = ACE version information. + /// e.g., the "5" in ACE 5.1.12. + extern ACE_Export u_int major_version (void); + + /// e.g., the "1" in ACE 5.1.12. + extern ACE_Export u_int minor_version (void); + + /// e.g., the "12" in ACE 5.1.12. + /// Returns 0 for "stable" (non-beta) releases. + extern ACE_Export u_int beta_version (void); + + // = C++ compiler version information. + /// E.g., the "SunPro C++" in SunPro C++ 4.32.0 + extern ACE_Export const ACE_TCHAR * compiler_name (void); + + /// E.g., the "4" in SunPro C++ 4.32.0 + extern ACE_Export u_int compiler_major_version (void); + + /// E.g., the "32" in SunPro C++ 4.32.0 + extern ACE_Export u_int compiler_minor_version (void); + + /// E.g., the "0" in SunPro C++ 4.32.0 + extern ACE_Export u_int compiler_beta_version (void); + + /// Check if error indicates the process being out of handles (file + /// descriptors). + extern ACE_Export int out_of_handles (int error); + + /// Simple wildcard matching function supporting '*' and '?' + /// return true if string s matches pattern. + /// If character_classes is true, '[' is treated as a wildcard character + /// as described in the fnmatch() POSIX API. The following POSIX "bracket + /// expression" features are not implemented: collating symbols, equivalence + /// class expressions, and character class expressions. The POSIX locale is + /// assumed. + extern ACE_Export bool wild_match(const char* s, const char* pattern, + bool case_sensitive = true, bool character_classes = false); + + /** + * @name I/O operations + * + * Notes on common parameters: + * + * @a handle is the connected endpoint that will be used for I/O. + * + * @a buf is the buffer to write from or receive into. + * + * @a len is the number of bytes to transfer. + * + * The @a timeout parameter in the following methods indicates how + * long to blocking trying to transfer data. If @a timeout == 0, + * then the call behaves as a normal send/recv call, i.e., for + * blocking sockets, the call will block until action is possible; + * for non-blocking sockets, @c EWOULDBLOCK will be returned if no + * action is immediately possible. + * + * If @a timeout != 0, the call will wait until the relative time + * specified in @a *timeout elapses. + * + * The "_n()" I/O methods keep looping until all the data has been + * transferred. These methods also work for sockets in non-blocking + * mode i.e., they keep looping on @c EWOULDBLOCK. @a timeout is + * used to make sure we keep making progress, i.e., the same timeout + * value is used for every I/O operation in the loop and the timeout + * is not counted down. + * + * The return values for the "*_n()" methods match the return values + * from the non "_n()" methods and are specified as follows: + * + * - On complete transfer, the number of bytes transferred is returned. + * - On timeout, -1 is returned, @c errno == @c ETIME. + * - On error, -1 is returned, @c errno is set to appropriate error. + * - On @c EOF, 0 is returned, @c errno is irrelevant. + * + * On partial transfers, i.e., if any data is transferred before + * timeout / error / @c EOF, @a bytes_transferred> will contain the + * number of bytes transferred. + * + * Methods with @a iovec parameter are I/O vector variants of the + * I/O operations. + * + * Methods with the extra @a flags argument will always result in + * @c send getting called. Methods without the extra @a flags + * argument will result in @c send getting called on Win32 + * platforms, and @c write getting called on non-Win32 platforms. + */ + //@{ + extern ACE_Export ssize_t recv (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0); + +#if defined (ACE_HAS_TLI) + + extern ACE_Export ssize_t t_rcv (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout = 0); + +#endif /* ACE_HAS_TLI */ + + extern ACE_Export ssize_t recv (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t recvmsg (ACE_HANDLE handle, + struct msghdr *msg, + int flags, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t recvfrom (ACE_HANDLE handle, + char *buf, + int len, + int flags, + struct sockaddr *addr, + int *addrlen, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + +#if defined (ACE_HAS_TLI) + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t t_rcv_n (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + +#endif /* ACE_HAS_TLI */ + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + /// Receive into a variable number of pieces. + /** + * Accepts a variable, caller-specified, number of pointer/length + * pairs. Arguments following @a n are char *, size_t pairs. + * + * @param handle The I/O handle to receive on + * @param n The total number of char *, size_t pairs following @a n. + * + * @return -1 on error, else total number of bytes received. + */ + extern ACE_Export ssize_t recv (ACE_HANDLE handle, size_t n, ...); + + extern ACE_Export ssize_t recvv (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t recvv_n (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t recv_n (ACE_HANDLE handle, + ACE_Message_Block *message_block, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t send (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0); + +#if defined (ACE_HAS_TLI) + + extern ACE_Export ssize_t t_snd (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0); + +#endif /* ACE_HAS_TLI */ + + extern ACE_Export ssize_t send (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t sendmsg (ACE_HANDLE handle, + const struct msghdr *msg, + int flags, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t sendto (ACE_HANDLE handle, + const char *buf, + int len, + int flags, + const struct sockaddr *addr, + int addrlen, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + +#if defined (ACE_HAS_TLI) + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t t_snd_n (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + +#endif /* ACE_HAS_TLI */ + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + /// Varargs variant. + extern ACE_Export ssize_t send (ACE_HANDLE handle, size_t n, ...); + + extern ACE_Export ssize_t sendv (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t sendv_n (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + /// Send all the @a message_blocks chained through their @c next and + /// @c cont pointers. This call uses the underlying OS gather-write + /// operation to reduce the domain-crossing penalty. + extern ACE_Export ssize_t send_n (ACE_HANDLE handle, + const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + // = File system I/O functions (these don't support timeouts). + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t read_n (ACE_HANDLE handle, + void *buf, + size_t len, + size_t *bytes_transferred = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t write_n (ACE_HANDLE handle, + const void *buf, + size_t len, + size_t *bytes_transferred = 0); + + /// Write all the @a message_blocks chained through their @c next + /// and @c cont pointers. This call uses the underlying OS + /// gather-write operation to reduce the domain-crossing penalty. + extern ACE_Export ssize_t write_n (ACE_HANDLE handle, + const ACE_Message_Block *message_block, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t readv_n (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t writev_n (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + size_t *bytes_transferred = 0); + //@} + + /** + * Wait up to @a timeout amount of time to passively establish a + * connection. This method doesn't perform the @c accept, it just + * does the timed wait. + */ + extern ACE_Export int handle_timed_accept (ACE_HANDLE listener, + ACE_Time_Value *timeout, + bool restart); + + /** + * Wait up to @a timeout amount of time to complete an actively + * established non-blocking connection. If @a is_tli is non-0 then + * we are being called by a TLI wrapper (which behaves slightly + * differently from a socket wrapper). + */ + extern ACE_Export ACE_HANDLE handle_timed_complete ( + ACE_HANDLE listener, + const ACE_Time_Value *timeout, + int is_tli = 0); + + /** + * Reset the limit on the number of open handles. If @a new_limit + * == -1 set the limit to the maximum allowable. Otherwise, set + * the limit value to @a new_limit. If @a increase_limit_only is + * non-0 then only allow increases to the limit. + */ + extern ACE_Export int set_handle_limit (int new_limit = -1, + int increase_limit_only = 0); + + /** + * Returns the maximum number of open handles currently permitted in + * this process. This maximum may be extended using + * @c ACE::set_handle_limit. + */ + extern ACE_Export int max_handles (void); + + // = String functions + /** + * Return a dynamically allocated duplicate of @a str, substituting + * the environment variable if @c str[0] @c == @c '$'. Note that + * the pointer is allocated with @c ACE_OS::malloc and must be freed + * by @c ACE_OS::free. + */ + extern ACE_Export ACE_TCHAR *strenvdup (const ACE_TCHAR *str); + + /// Returns a pointer to the "end" of the string, i.e., the character + /// past the '\0'. + extern ACE_Export const char *strend (const char *s); + + /// This method is just like @c strdup, except that it uses + /// @c operator @c new rather than @c malloc. If @a s is NULL + /// returns NULL rather than segfaulting. + extern ACE_Export char *strnew (const char *s); + + /// Delete the memory allocated by @c strnew. + ACE_NAMESPACE_INLINE_FUNCTION void strdelete (char *s); + + /// Create a fresh new copy of @a str, up to @a n chars long. Uses + /// @c ACE_OS::malloc to allocate the new string. + extern ACE_Export char *strndup (const char *str, size_t n); + + /// Create a fresh new copy of @a str, up to @a n chars long. Uses + /// @c ACE_OS::malloc to allocate the new string. + extern ACE_Export char *strnnew (const char *str, size_t n); + + /// Determine if a specified pathname is "dot dir" (ie. "." or ".."). + ACE_NAMESPACE_INLINE_FUNCTION bool isdotdir (const char *s); + +#if defined (ACE_HAS_WCHAR) + extern ACE_Export const wchar_t *strend (const wchar_t *s); + + extern ACE_Export wchar_t *strnew (const wchar_t *s); + + ACE_NAMESPACE_INLINE_FUNCTION void strdelete (wchar_t *s); + + extern ACE_Export wchar_t *strndup (const wchar_t *str, size_t n); + + extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n); + + ACE_NAMESPACE_INLINE_FUNCTION bool isdotdir (const wchar_t *s); + +#endif /* ACE_HAS_WCHAR */ + + /** + * On Windows, determines if a specified pathname ends with ".exe" + * (not case sensitive). If on Windows and there is no ".exe" suffix, + * a new ACE_TCHAR array is allocated and a copy of @c pathname with + * the ".exe" suffix is copied into it. In this case, the caller is + * responsible for calling delete [] on the returned pointer. + * + * @param pathname The name to check for a proper suffix. + * + * @retval @c pathname if there is a proper suffix for Windows. This is + * always the return value for non-Windows platforms. + * @retval If a suffix needs to be added, returns a pointer to new[] + * allocated memory containing the original @c pathname plus + * a ".exe" suffix. The caller is responsible for freeing the + * memory using delete []. + */ + extern ACE_Export const ACE_TCHAR *execname (const ACE_TCHAR *pathname); + + /** + * Returns the "basename" of a @a pathname separated by @a delim. + * For instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when + * @a delim is @a '/'. + */ + extern ACE_Export const ACE_TCHAR *basename (const ACE_TCHAR *pathname, + ACE_TCHAR delim = + ACE_DIRECTORY_SEPARATOR_CHAR); + + /** + * Returns the "dirname" of a @a pathname. For instance, the + * dirname of "/tmp/foo.cpp" is "/tmp" when @a delim is @a '/'. If + * @a pathname has no @a delim ".\0" is returned. This method does + * not modify @a pathname and is not reentrant. + */ + extern ACE_Export const ACE_TCHAR *dirname (const ACE_TCHAR *pathname, + ACE_TCHAR delim = + ACE_DIRECTORY_SEPARATOR_CHAR); + + /** + * Returns the given timestamp in the form + * "hour:minute:second:microsecond." The month, day, and year are + * also stored in the beginning of the @a date_and_time array, which + * is a user-supplied array of size @a time_len> @c ACE_TCHARs. + * Returns 0 if unsuccessful, else returns pointer to beginning of the + * "time" portion of @a date_and_time. If @a + * return_pointer_to_first_digit is 0 then return a pointer to the + * space before the time, else return a pointer to the beginning of + * the time portion. + */ + extern ACE_Export ACE_TCHAR *timestamp (const ACE_Time_Value& time_value, + ACE_TCHAR date_and_time[], + size_t time_len, + bool return_pointer_to_first_digit = false); + + /** + * Returns the current timestamp in the form + * "hour:minute:second:microsecond." The month, day, and year are + * also stored in the beginning of the @a date_and_time array, which + * is a user-supplied array of size @a time_len> @c ACE_TCHARs. + * Returns 0 if unsuccessful, else returns pointer to beginning of the + * "time" portion of @a date_and_time. If @a + * return_pointer_to_first_digit is 0 then return a pointer to the + * space before the time, else return a pointer to the beginning of + * the time portion. + */ + extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[], + size_t time_len, + bool return_pointer_to_first_digit = false); + + /** + * if @a avoid_zombies == 0 call @c ACE_OS::fork directly, else + * create an orphan process that's inherited by the init process; + * init cleans up when the orphan process terminates so we don't + * create zombies. Returns -1 on failure and either the child PID + * on success if @a avoid_zombies == 0 or 1 on success if @a + * avoid_zombies != 0 (this latter behavior is a known bug that + * needs to be fixed). + */ + extern ACE_Export pid_t fork ( + const ACE_TCHAR *program_name = ACE_TEXT (""), + int avoid_zombies = 0); + + /** + * Become a daemon process using the algorithm in Richard Stevens + * "Advanced Programming in the UNIX Environment." If + * @a close_all_handles is non-zero then all open file handles are + * closed. + */ + extern ACE_Export int daemonize ( + const ACE_TCHAR pathname[] = ACE_TEXT ("/"), + bool close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES, + const ACE_TCHAR program_name[] = ACE_TEXT ("")); + + // = Miscellaneous functions. + /// Rounds the request to a multiple of the page size. + extern ACE_Export size_t round_to_pagesize (size_t len); + + /// Rounds the request to a multiple of the allocation granularity. + extern ACE_Export size_t round_to_allocation_granularity (size_t len); + + // @@ UNICODE what about buffer? + /// Format buffer into printable format. This is useful for + /// debugging. + extern ACE_Export size_t format_hexdump (const char *buffer, size_t size, + ACE_TCHAR *obuf, size_t obuf_sz); + + /// Computes the hash value of {str} using the "Hash PJW" routine. + extern ACE_Export u_long hash_pjw (const char *str); + + /// Computes the hash value of {str} using the "Hash PJW" routine. + extern ACE_Export u_long hash_pjw (const char *str, size_t len); + +#if defined (ACE_HAS_WCHAR) + /// Computes the hash value of {str} using the "Hash PJW" routine. + extern ACE_Export u_long hash_pjw (const wchar_t *str); + + /// Computes the hash value of {str} using the "Hash PJW" routine. + extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len); +#endif /* ACE_HAS_WCHAR */ + + /// Computes CRC-CCITT for the string. + extern ACE_Export ACE_UINT16 crc_ccitt(const char *str); + + /// Computes CRC-CCITT for the buffer. + extern ACE_Export ACE_UINT16 crc_ccitt(const void *buf, size_t len, + ACE_UINT16 crc = 0); + + /// Computes CRC-CCITT for the @ len iovec buffers. + extern ACE_Export ACE_UINT16 crc_ccitt(const iovec *iov, int len, + ACE_UINT16 crc = 0); + + /// Computes the ISO 8802-3 standard 32 bits CRC for the string. + extern ACE_Export ACE_UINT32 crc32 (const char *str); + + /// Computes the ISO 8802-3 standard 32 bits CRC for the buffer. + extern ACE_Export ACE_UINT32 crc32 (const void *buf, size_t len, + ACE_UINT32 crc = 0); + + /// Computes the ISO 8802-3 standard 32 bits CRC for the + /// @ len iovec buffers. + extern ACE_Export ACE_UINT32 crc32 (const iovec *iov, int len, + ACE_UINT32 crc = 0); + + /// Euclid's greatest common divisor algorithm. + extern ACE_Export u_long gcd (u_long x, u_long y); + + /// Calculates the minimum enclosing frame size for the given values. + extern ACE_Export u_long minimum_frame_size (u_long period1, u_long period2); + + /** + * Function that can burn up noticeable CPU time: brute-force + * determination of whether number @a n is prime. Returns 0 if + * it is prime, or the smallest factor if it is not prime. + * @a min_factor and @a max_factor can be used to partition the work + * among threads. For just one thread, typical values are 2 and + * n/2. + */ + extern ACE_Export u_long is_prime (const u_long n, + const u_long min_factor, + const u_long max_factor); + + /// Map troublesome win32 errno values to values that standard C + /// strerr function understands. Thank you Microsoft. + extern ACE_Export int map_errno (int error); + + /// Returns a string containing the error message corresponding to a + /// WinSock error. This works around an omission in the Win32 API. + /// @internal + extern ACE_Export const ACE_TCHAR * sock_error (int error); + + /// Determins whether the given error code corresponds to to a + /// WinSock error. If so returns true, false otherwise. + /// @internal + extern ACE_Export bool is_sock_error (int error); + + /** + * Checks if process with {pid} is still alive. Returns 1 if it is + * still alive, 0 if it isn't alive, and -1 if something weird + * happened. + */ + extern ACE_Export int process_active (pid_t pid); + + /** + * Terminate the process abruptly with id @a pid. On Win32 platforms + * this uses {TerminateProcess} and on POSIX platforms is uses + * {kill} with the -9 (SIGKILL) signal, which cannot be caught or + * ignored. Note that this call is potentially dangerous to use + * since the process being terminated may not have a chance to + * cleanup before it shuts down. + */ + extern ACE_Export int terminate_process (pid_t pid); + + /** + * This method uses process id and object pointer to come up with a + * machine wide unique name. The process ID will provide uniqueness + * between processes on the same machine. The "this" pointer of the + * {object} will provide uniqueness between other "live" objects in + * the same process. The uniqueness of this name is therefore only + * valid for the life of {object}. + */ + ACE_NAMESPACE_INLINE_FUNCTION void unique_name (const void *object, + ACE_TCHAR *name, + size_t length); + + /// Computes the base 2 logarithm of {num}. + ACE_NAMESPACE_INLINE_FUNCTION u_long log2 (u_long num); + + /// Hex conversion utility. + extern ACE_Export ACE_TCHAR nibble2hex (u_int n); + + /// Convert a hex character to its byte representation. + ACE_NAMESPACE_INLINE_FUNCTION u_char hex2byte (ACE_TCHAR c); + + // = Set/get the debug level. + extern ACE_Export bool debug (void); + extern ACE_Export void debug (bool onoff); + + /// Wrapper facade for @c select that uses @c ACE_Handle_Sets. + extern ACE_Export int select (int width, + ACE_Handle_Set *readfds, + ACE_Handle_Set *writefds = 0, + ACE_Handle_Set *exceptfds = 0, + const ACE_Time_Value *timeout = 0); + + /// Wrapper facade for the most common use of @c select that uses + /// @c ACE_Handle_Sets. + extern ACE_Export int select (int width, + ACE_Handle_Set &readfds, + const ACE_Time_Value *timeout = 0); + + /// Timed wait for handle to get read ready. + ACE_NAMESPACE_INLINE_FUNCTION + int handle_read_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout); + + /// Timed wait for handle to get write ready. + ACE_NAMESPACE_INLINE_FUNCTION + int handle_write_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout); + + /// Timed wait for handle to get exception ready. + ACE_NAMESPACE_INLINE_FUNCTION + int handle_exception_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout); + + /// Timed wait for handle to get read, write, or exception ready. + extern ACE_Export int handle_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout, + int read_ready, + int write_ready, + int exception_ready); + + /// Wait for @a timeout before proceeding to a @c recv operation. + /// @a val keeps track of whether we're in non-blocking mode or + /// not. + extern ACE_Export int enter_recv_timedwait (ACE_HANDLE handle, + const ACE_Time_Value *timeout, + int &val); + + /// Wait for @a timeout before proceeding to a @c send operation. + /// @a val keeps track of whether we're in non-blocking mode or + /// not. + extern ACE_Export int enter_send_timedwait (ACE_HANDLE handle, + const ACE_Time_Value* timeout, + int &val); + + /// This makes sure that @a handle is set into non-blocking mode. + /// @a val keeps track of whether were in non-blocking mode or not. + extern ACE_Export void record_and_set_non_blocking_mode (ACE_HANDLE handle, + int &val); + + /// Cleanup after a timed operation, restore the appropriate + /// non-blocking status of @a handle. + extern ACE_Export void restore_non_blocking_mode (ACE_HANDLE handle, + int val); + + // private: + // These functions aren't meant to be used internally, so they are + // not exported. + + // + // = Recv_n helpers + // + + ACE_NAMESPACE_INLINE_FUNCTION ssize_t recv_i (ACE_HANDLE handle, + void *buf, + size_t len); + + extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + size_t *bytes_transferred); + + extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + +#if defined (ACE_HAS_TLI) + + extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + size_t *bytes_transferred); + + extern ACE_Export ssize_t t_rcv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + +#endif /* ACE_HAS_TLI */ + + extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + size_t *bytes_transferred); + + extern ACE_Export ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + + extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + size_t *bytes_transferred); + + extern ACE_Export ssize_t recvv_n_i (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + + // + // = Send_n helpers + // + + ACE_NAMESPACE_INLINE_FUNCTION ssize_t send_i (ACE_HANDLE handle, + const void *buf, + size_t len); + + extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + size_t *bytes_transferred); + + extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + +#if defined (ACE_HAS_TLI) + + extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + size_t *bytes_transferred); + + extern ACE_Export ssize_t t_snd_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + +#endif /* ACE_HAS_TLI */ + + extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + size_t *bytes_transferred); + + extern ACE_Export ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + + extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + size_t *bytes_transferred); + + extern ACE_Export ssize_t sendv_n_i (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); + +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/ACE.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ACE_H */ diff --git a/externals/ace/ACE.inl b/externals/ace/ACE.inl new file mode 100644 index 0000000..4be80bf --- /dev/null +++ b/externals/ace/ACE.inl @@ -0,0 +1,348 @@ +// -*- C++ -*- +// +// $Id: ACE.inl 87366 2009-11-05 20:16:30Z olli $ + +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_Thread.h" +#include "ace/OS_NS_ctype.h" +#include "ace/OS_NS_sys_socket.h" + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + +// Wrappers for methods that have been moved to ACE_OS. + +ACE_INLINE ssize_t +ACE::read_n (ACE_HANDLE handle, + void *buf, + size_t len, + size_t *bytes_transferred) +{ + return ACE_OS::read_n (handle, + buf, + len, + bytes_transferred); +} + +ACE_INLINE ssize_t +ACE::write_n (ACE_HANDLE handle, + const void *buf, + size_t len, + size_t *bytes_transferred) +{ + return ACE_OS::write_n (handle, + buf, + len, + bytes_transferred); +} + +ACE_INLINE ssize_t +ACE::recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::recv_n_i (handle, + buf, + len, + flags, + bytes_transferred); + else + return ACE::recv_n_i (handle, + buf, + len, + flags, + timeout, + bytes_transferred); +} + +#if defined (ACE_HAS_TLI) + +ACE_INLINE ssize_t +ACE::t_rcv_n (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::t_rcv_n_i (handle, + buf, + len, + flags, + bytes_transferred); + else + return ACE::t_rcv_n_i (handle, + buf, + len, + flags, + timeout, + bytes_transferred); +} + +#endif /* ACE_HAS_TLI */ + +ACE_INLINE ssize_t +ACE::recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::recv_n_i (handle, + buf, + len, + bytes_transferred); + else + return ACE::recv_n_i (handle, + buf, + len, + timeout, + bytes_transferred); +} + +ACE_INLINE ssize_t +ACE::recvv_n (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::recvv_n_i (handle, + iov, + iovcnt, + bytes_transferred); + else + return ACE::recvv_n_i (handle, + iov, + iovcnt, + timeout, + bytes_transferred); +} + +ACE_INLINE ssize_t +ACE::send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::send_n_i (handle, + buf, + len, + flags, + bytes_transferred); + else + return ACE::send_n_i (handle, + buf, + len, + flags, + timeout, + bytes_transferred); +} + +#if defined (ACE_HAS_TLI) + +ACE_INLINE ssize_t +ACE::t_snd_n (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::t_snd_n_i (handle, + buf, + len, + flags, + bytes_transferred); + else + return ACE::t_snd_n_i (handle, + buf, + len, + flags, + timeout, + bytes_transferred); +} + +#endif /* ACE_HAS_TLI */ + +ACE_INLINE ssize_t +ACE::send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::send_n_i (handle, + buf, + len, + bytes_transferred); + else + return ACE::send_n_i (handle, + buf, + len, + timeout, + bytes_transferred); +} + +ACE_INLINE ssize_t +ACE::sendv_n (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + if (timeout == 0) + return ACE::sendv_n_i (handle, + iov, + iovcnt, + bytes_transferred); + else + return ACE::sendv_n_i (handle, + iov, + iovcnt, + timeout, + bytes_transferred); +} + +ACE_INLINE ssize_t +ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len) +{ +#if defined (ACE_WIN32) || defined (HPUX) + return ACE_OS::send (handle, (const char *) buf, len); +#else + return ACE_OS::write (handle, (const char *) buf, len); +#endif /* ACE_WIN32 */ +} + +ACE_INLINE ssize_t +ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len) +{ +#if defined (ACE_WIN32) || defined (ACE_OPENVMS) || defined (ACE_TANDEM_T1248_PTHREADS) + return ACE_OS::recv (handle, (char *) buf, len); +#else + return ACE_OS::read (handle, (char *) buf, len); +#endif /* ACE_WIN32 */ +} + +ACE_INLINE int +ACE::handle_read_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout) +{ + return ACE::handle_ready (handle, + timeout, + 1, + 0, + 0); +} + +ACE_INLINE int +ACE::handle_write_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout) +{ + return ACE::handle_ready (handle, + timeout, + 0, + 1, + 0); +} + +ACE_INLINE int +ACE::handle_exception_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout) +{ + return ACE::handle_ready (handle, + timeout, + 0, + 0, + 1); +} + +ACE_INLINE void +ACE::strdelete (char *s) +{ + delete [] s; +} + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE void +ACE::strdelete (wchar_t *s) +{ + delete [] s; +} +#endif /* ACE_HAS_WCHAR */ + +ACE_INLINE bool +ACE::isdotdir (const char *s) +{ + return (s[0] == '.' && + ((s[1] == 0) || (s[1] == '.' && s[2] == 0))); +} + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE bool +ACE::isdotdir (const wchar_t *s) +{ + return (s[0] == ACE_TEXT ('.') && + ((s[1] == 0) || (s[1] == ACE_TEXT ('.') && s[2] == 0))); +} +#endif /* ACE_HAS_WCHAR */ + +ACE_INLINE void +ACE::unique_name (const void *object, + ACE_TCHAR *name, + size_t length) +{ + ACE_OS::unique_name (object, name, length); +} + +ACE_INLINE u_long +ACE::log2 (u_long num) +{ + u_long log = 0; + + for (; num > 1; ++log) + num >>= 1; + + return log; +} + +ACE_INLINE int +ACE::map_errno (int error) +{ +#if defined (ACE_WIN32) + switch (error) + { + case WSAEWOULDBLOCK: + return EAGAIN; // Same as UNIX errno EWOULDBLOCK. + } +#endif /* ACE_WIN32 */ + + return error; +} + +ACE_INLINE u_char +ACE::hex2byte (ACE_TCHAR c) +{ + if (ACE_OS::ace_isdigit (c)) + return (u_char) (c - ACE_TEXT ('0')); + else if (ACE_OS::ace_islower (c)) + return (u_char) (10 + c - ACE_TEXT ('a')); + else + return (u_char) (10 + c - ACE_TEXT ('A')); +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ACE.pc.in b/externals/ace/ACE.pc.in new file mode 100644 index 0000000..90b2a9e --- /dev/null +++ b/externals/ace/ACE.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: ACE +Description: ADAPTIVE Communication Environment +Version: @VERSION@ +Libs: -L${libdir} -lACE @LIBS@ +Cflags: -I${includedir} diff --git a/externals/ace/ACE_crc32.cpp b/externals/ace/ACE_crc32.cpp new file mode 100644 index 0000000..70d93e6 --- /dev/null +++ b/externals/ace/ACE_crc32.cpp @@ -0,0 +1,161 @@ +// $Id: ACE_crc32.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ACE.h" + +ACE_RCSID (ace, + ACE_crc32, + "$Id: ACE_crc32.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +namespace +{ + /*****************************************************************/ + /* */ + /* CRC LOOKUP TABLE */ + /* ================ */ + /* The following CRC lookup table was generated automagically */ + /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ + /* Program V1.0 using the following model parameters: */ + /* */ + /* Width : 4 bytes. */ + /* Poly : 0x04C11DB7L */ + /* Reverse : TRUE. */ + /* */ + /* For more information on the Rocksoft^tm Model CRC Algorithm, */ + /* see the document titled "A Painless Guide to CRC Error */ + /* Detection Algorithms" by Ross Williams */ + /* (ross@guest.adelaide.edu.au.). This document is likely to be */ + /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ + /* */ + /*****************************************************************/ + + const ACE_UINT32 crc_table[] = + { + 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, + 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, + 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, + 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, + 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, + 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, + 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, + 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, + 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, + 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, + 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, + 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, + 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, + 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, + 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, + 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, + 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, + 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, + 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, + 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, + 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, + 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, + 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, + 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, + 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, + 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, + 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, + 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, + 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, + 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, + 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, + 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, + 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, + 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, + 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, + 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, + 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, + 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, + 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, + 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, + 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, + 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, + 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, + 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, + 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, + 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, + 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, + 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, + 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, + 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, + 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, + 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, + 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, + 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, + 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, + 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, + 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, + 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, + 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, + 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, + 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, + 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, + 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, + 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL + }; + + /*****************************************************************/ + /* End of CRC Lookup Table */ + /*****************************************************************/ +} + +#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_UINT32 +ACE::crc32 (const char *string) +{ + ACE_UINT32 crc = 0xFFFFFFFF; + + for (const char *p = string; + *p != 0; + ++p) + { + COMPUTE (crc, *p); + } + + return ~crc; +} + +ACE_UINT32 +ACE::crc32 (const void *buffer, size_t len, ACE_UINT32 crc) +{ + crc = ~crc; + + for (const char *p = (const char *) buffer, + *e = (const char *) buffer + len; + p != e; + ++p) + { + COMPUTE (crc, *p); + } + + return ~crc; +} + +ACE_UINT32 +ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc) +{ + crc = ~crc; + + for (int i = 0; i < len; ++i) + { + for (const char *p = (const char *) iov[i].iov_base, + *e = (const char *) iov[i].iov_base + iov[i].iov_len; + p != e; + ++p) + COMPUTE (crc, *p); + } + + return ~crc; +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#undef COMPUTE diff --git a/externals/ace/ACE_crc_ccitt.cpp b/externals/ace/ACE_crc_ccitt.cpp new file mode 100644 index 0000000..ef7f5d6 --- /dev/null +++ b/externals/ace/ACE_crc_ccitt.cpp @@ -0,0 +1,128 @@ +// $Id: ACE_crc_ccitt.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ACE.h" + +ACE_RCSID (ace, + ACE_crc_ccitt, + "$Id: ACE_crc_ccitt.cpp 80826 2008-03-04 14:51:23Z wotte $") + +namespace +{ + /*****************************************************************/ + /* */ + /* CRC LOOKUP TABLE */ + /* ================ */ + /* The following CRC lookup table was generated automagically */ + /* by the Rocksoft^tm Model CRC Algorithm Table Generation */ + /* Program V1.0 using the following model parameters: */ + /* */ + /* Width : 2 bytes. */ + /* Poly : 0x1021 */ + /* Reverse : TRUE. */ + /* */ + /* For more information on the Rocksoft^tm Model CRC Algorithm, */ + /* see the document titled "A Painless Guide to CRC Error */ + /* Detection Algorithms" by Ross Williams */ + /* (ross@guest.adelaide.edu.au.). This document is likely to be */ + /* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */ + /* */ + /*****************************************************************/ + + const ACE_UINT16 crc_table[] = + { + 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, + 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, + 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, + 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, + 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, + 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, + 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, + 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, + 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, + 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, + 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, + 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, + 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, + 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, + 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, + 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, + 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, + 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, + 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, + 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, + 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, + 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, + 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, + 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, + 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, + 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, + 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, + 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, + 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, + 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, + 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, + 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 + }; + + /*****************************************************************/ + /* End of CRC Lookup Table */ + /*****************************************************************/ +} + +#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_UINT16 +ACE::crc_ccitt (const char *string) +{ + ACE_UINT16 crc = 0xFFFF; + + for (const char *p = string; + *p != 0; + ++p) + { + COMPUTE (crc, *p); + } + + return ~crc; +} + +ACE_UINT16 +ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc) +{ + crc = ~crc; + + for (const char *p = (const char *) buffer, + *e = (const char *) buffer + len; + p != e; + ++p) + { + COMPUTE (crc, *p); + } + + return ~crc; +} + +ACE_UINT16 +ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc) +{ + crc = ~crc; + + for (int i = 0; i < len; ++i) + { + for (const char *p = (const char *) iov[i].iov_base, + *e = (const char *) iov[i].iov_base + iov[i].iov_len; + p != e; + ++p) + COMPUTE (crc, *p); + } + + return ~crc; +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#undef COMPUTE diff --git a/externals/ace/ACE_export.h b/externals/ace/ACE_export.h new file mode 100644 index 0000000..8ad2a33 --- /dev/null +++ b/externals/ace/ACE_export.h @@ -0,0 +1,76 @@ +// -*- C++ -*- +// $Id: ACE_export.h 80826 2008-03-04 14:51:23Z wotte $ +// Definition for Win32 Export directives. +// This file is generated automatically by +// generate_export_file.pl +// ------------------------------ + +#ifndef ACE_EXPORT_H +#define ACE_EXPORT_H + +#include "ace/config-lite.h" + +#if defined (ACE_AS_STATIC_LIBS) + +# if !defined (ACE_HAS_DLL) +# define ACE_HAS_DLL 0 +# endif /* ! ACE_HAS_DLL */ +#else +# if !defined (ACE_HAS_DLL) +# define ACE_HAS_DLL 1 +# endif /* ! ACE_HAS_DLL */ +#endif /* ACE_AS_STATIC_LIB */ + +#if defined (ACE_HAS_DLL) +# if (ACE_HAS_DLL == 1) +# if defined (ACE_BUILD_DLL) +# define ACE_Export ACE_Proper_Export_Flag +# define ACE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else +# define ACE_Export ACE_Proper_Import_Flag +# define ACE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_BUILD_DLL */ +# else +# define ACE_Export +# define ACE_SINGLETON_DECLARATION(T) +# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ! ACE_HAS_DLL == 1 */ +#else +# define ACE_Export +# define ACE_SINGLETON_DECLARATION(T) +# define ACE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_HAS_DLL */ + +// Added by hand to help with ACE_OS namespace +#if defined (__TANDEM) && defined (USE_EXPLICIT_EXPORT) +#define ACE_NAMESPACE_STORAGE_CLASS ACE_EXPORT_MACRO extern +#else +#define ACE_NAMESPACE_STORAGE_CLASS extern ACE_EXPORT_MACRO +#endif + +#if defined (__ACE_INLINE__) +# if defined (_MSC_VER) || defined (__MINGW32__) || defined (CYGWIN32) || \ + (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x560) || \ + (defined (__HP_aCC) && (__HP_aCC >= 60500)) || \ + (defined (__sgi) && \ + defined (_COMPILER_VERSION) && _COMPILER_VERSION <= 730) +# define ACE_NAMESPACE_INLINE_FUNCTION inline +# else +# define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS inline +# endif +# define ACE_INLINE_TEMPLATE_FUNCTION inline +#else +# define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS +// Microsoft Visual C++ will accept 'extern'; others refuse. +# if defined (_MSC_VER) || defined (__BORLANDC__) +# define ACE_INLINE_TEMPLATE_FUNCTION ACE_Export +# else +# define ACE_INLINE_TEMPLATE_FUNCTION +# endif +#endif + +#endif /* ACE_EXPORT_H */ + +// End of auto generated file. diff --git a/externals/ace/ARGV.cpp b/externals/ace/ARGV.cpp new file mode 100644 index 0000000..edfd4ef --- /dev/null +++ b/externals/ace/ARGV.cpp @@ -0,0 +1,383 @@ +// $Id: ARGV.cpp 81374 2008-04-16 13:07:47Z iliyan $ + +#ifndef ACE_ARGV_CPP +#define ACE_ARGV_CPP + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_Memory.h" + +#if !defined (__ACE_INLINE__) +#include "ace/ARGV.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, ARGV, "$Id: ARGV.cpp 81374 2008-04-16 13:07:47Z iliyan $") + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE (ACE_ARGV_Queue_Entry) +ACE_ALLOC_HOOK_DEFINE (ACE_ARGV) + +template +void +ACE_ARGV_Queue_Entry_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ARGV_Queue_Entry_T::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("arg_ = %s"), this->arg_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("quote_arg_ = %d"), (int)this->quote_arg_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template +void +ACE_ARGV_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ARGV_T::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("argc_ = %d"), this->argc_)); + + ACE_ARGV *this_obj = const_cast (this); + + for (int i = 0; i < this->argc_; i++) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\nargv_[%i] = %s"), + i, + this_obj->argv ()[i])); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nbuf = %s\n"), this->buf_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// Creates this->argv_ out of this->buf_. New memory is allocated for +// each element of the array. This is used by the array-to-string +// style constructor and for creating this->argv_ when in iterative +// mode. + +template +int +ACE_ARGV_T::string_to_argv (void) +{ + ACE_TRACE ("ACE_ARGV_T::string_to_argv"); + + return ACE_OS::string_to_argv (this->buf_, + this->argc_, + this->argv_, + this->substitute_env_args_); +} + +template +ACE_ARGV_T::ACE_ARGV_T (const CHAR_TYPE buf[], + bool substitute_env_args) + : substitute_env_args_ (substitute_env_args), + iterative_ (false), + argc_ (0), + argv_ (0), + buf_ (0), + length_ (0), + queue_ () +{ + ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE[] to CHAR_TYPE *[]"); + + if (buf == 0 || buf[0] == 0) + return; + + // Make an internal copy of the string. + ACE_NEW (this->buf_, + CHAR_TYPE[ACE_OS::strlen (buf) + 1]); + ACE_OS::strcpy (this->buf_, buf); + + // Create this->argv_. + if (this->string_to_argv () == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("string_to_argv"))); +} + +template +ACE_ARGV_T::ACE_ARGV_T (CHAR_TYPE *argv[], + bool substitute_env_args, + bool quote_arg) + : substitute_env_args_ (substitute_env_args), + iterative_ (false), + argc_ (0), + argv_ (0), + buf_ (0), + length_ (0), + queue_ () +{ + ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] to CHAR_TYPE[]"); + + if (argv == 0 || argv[0] == 0) + return; + + this->argc_ = ACE_OS::argv_to_string (argv, + this->buf_, + substitute_env_args, + quote_arg); +} + +template +ACE_ARGV_T::ACE_ARGV_T (int argc, + CHAR_TYPE *argv[], + bool substitute_env_args, + bool quote_arg) + : substitute_env_args_ (substitute_env_args), + iterative_ (false), + argc_ (0), + argv_ (0), + buf_ (0), + length_ (0), + queue_ () +{ + ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T int,CHAR_TYPE*[] to CHAR_TYPE[]"); + + this->argc_ = ACE_OS::argv_to_string (argc, + argv, + this->buf_, + substitute_env_args, + quote_arg); +} + + +template +ACE_ARGV_T::ACE_ARGV_T (CHAR_TYPE *first_argv[], + CHAR_TYPE *second_argv[], + bool substitute_env_args, + bool quote_args) + : substitute_env_args_ (substitute_env_args), + iterative_ (false), + argc_ (0), + argv_ (0), + buf_ (0), + length_ (0), + queue_ () +{ + ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] + CHAR_TYPE *[] to CHAR_TYPE[]"); + + int first_argc = 0; + int second_argc = 0; + + CHAR_TYPE *first_buf = 0; + CHAR_TYPE *second_buf = 0; + + // convert the first argv to a string + if (first_argv != 0 && first_argv[0] != 0) + { + first_argc = ACE_OS::argv_to_string (first_argv, + first_buf, + substitute_env_args, + quote_args); + } + + // convert the second argv to a string + if (second_argv != 0 && second_argv[0] != 0) + { + second_argc = ACE_OS::argv_to_string (second_argv, + second_buf, + substitute_env_args, + quote_args); + } + + // Add the number of arguments in both the argvs. + this->argc_ = first_argc + second_argc; + + size_t buf_len = + ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1; + + // Allocate memory to the lenght of the combined argv string. + ACE_NEW (this->buf_, + CHAR_TYPE[buf_len + 1]); + + // copy the first argv string to the buffer + ACE_OS::strcpy (this->buf_, first_buf); + + // concatenate the second argv string to the buffer + ACE_OS::strcat (this->buf_, second_buf); + + // Delete the first and second buffers + delete [] first_buf; + delete [] second_buf; +} + +template +ACE_ARGV_T::ACE_ARGV_T (bool substitute_env_args) + : substitute_env_args_ (substitute_env_args), + iterative_ (true), + argc_ (0), + argv_ (0), + buf_ (0), + length_ (0), + queue_ () +{ + ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T Iterative"); + + // Nothing to do yet -- the user puts in arguments via add () +} + +template +int +ACE_ARGV_T::add (const CHAR_TYPE *next_arg, bool quote_arg) +{ + // Only allow this to work in the "iterative" verion -- the + // ACE_ARGVs created with the one argument constructor. + if (!this->iterative_) + { + errno = EINVAL; + return -1; + } + + this->length_ += ACE_OS::strlen (next_arg); + if (quote_arg && ACE_OS::strchr (next_arg, ' ') != 0) + { + this->length_ += 2; + if (ACE_OS::strchr (next_arg, '"') != 0) + for (const CHAR_TYPE * p = next_arg; *p != '\0'; ++p) + if (*p == '"') ++this->length_; + } + else + { + quote_arg = false; + } + + // Put the new argument at the end of the queue. + if (this->queue_.enqueue_tail (ACE_ARGV_Queue_Entry_T (next_arg, quote_arg)) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Can't add more to ARGV queue")), + -1); + + ++this->argc_; + + // Wipe argv_ and buf_ away so that they will be recreated if the + // user calls argv () or buf (). + if (this->argv_ != 0) + { + for (int i = 0; this->argv_[i] != 0; i++) + ACE_OS::free ((void *) this->argv_[i]); + + delete [] this->argv_; + this->argv_ = 0; + } + + delete [] this->buf_; + this->buf_ = 0; + + return 0; +} + +template +int +ACE_ARGV_T::add (CHAR_TYPE *argv[], bool quote_args) +{ + for (int i = 0; argv[i] != 0; i++) + if (this->add (argv[i], quote_args) == -1) + return -1; + + return 0; +} + +// Free up argv_ and buf_ + +template +ACE_ARGV_T::~ACE_ARGV_T (void) +{ + ACE_TRACE ("ACE_ARGV_T::~ACE_ARGV_T"); + + if (this->argv_ != 0) + for (int i = 0; this->argv_[i] != 0; i++) + ACE_OS::free ((void *) this->argv_[i]); + + delete [] this->argv_; + delete [] this->buf_; +} + +// Create buf_ out of the queue_. This is only used in the +// "iterative" mode. + +template +int +ACE_ARGV_T::create_buf_from_queue (void) +{ + ACE_TRACE ("ACE_ARGV_T::create_buf_from_queue"); + + // If the are no arguments, don't do anything + if (this->argc_ <= 0) + return -1; + + delete [] this->buf_; + + ACE_NEW_RETURN (this->buf_, + CHAR_TYPE[this->length_ + this->argc_], + -1); + + // Get an iterator over the queue + ACE_Unbounded_Queue_Iterator > iter (this->queue_); + + ACE_ARGV_Queue_Entry_T *arg = 0; + CHAR_TYPE *ptr = this->buf_; + size_t len; + + while (!iter.done ()) + { + // Get next argument from the queue. + iter.next (arg); + iter.advance (); + + if (arg->quote_arg_) + { + *ptr++ = '"'; + if (ACE_OS::strchr (arg->arg_, '"') != 0) + { + CHAR_TYPE prev = 0; + for (const CHAR_TYPE * p = arg->arg_; *p != '\0'; ++p) + { + if (*p == '"' && prev != '\\') *ptr++ = '\\'; + prev = *ptr++ = *p; + } + } + else + { + len = ACE_OS::strlen (arg->arg_); + // Copy the argument into buf_ + ACE_OS::memcpy ((void *) ptr, + (const void *) (arg->arg_), + len * sizeof (CHAR_TYPE)); + // Move the pointer down. + ptr += len; + } + *ptr++ = '"'; + } + else + { + len = ACE_OS::strlen (arg->arg_); + // Copy the argument into buf_ + ACE_OS::memcpy ((void *) ptr, + (const void *) (arg->arg_), + len * sizeof (CHAR_TYPE)); + // Move the pointer down. + ptr += len; + } + + // Put in an argument separating space. + *ptr++ = ' '; + } + + // Put in the NUL terminator + ptr[-1] = '\0'; + + return 0; +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ARGV_CPP */ diff --git a/externals/ace/ARGV.h b/externals/ace/ARGV.h new file mode 100644 index 0000000..66e7181 --- /dev/null +++ b/externals/ace/ARGV.h @@ -0,0 +1,333 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file ARGV.h + * + * $Id: ARGV.h 81156 2008-03-30 20:56:47Z iliyan $ + * + * @author Doug Schmidt + * @author Everett Anderson + */ +//========================================================================== + +#ifndef ACE_ARGUMENT_VECTOR_H +#define ACE_ARGUMENT_VECTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/Unbounded_Queue.h" + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_ARGV_Queue_Entry_T + * + * @brief An entry in the queue which keeps user supplied arguments. + */ +template +class ACE_ARGV_Queue_Entry_T +{ +public: + // = Initialization and termination. + /// Initialize a ACE_ARGV_Queue_Entry_T. + ACE_ARGV_Queue_Entry_T (void); + + /** + * Initialize a ACE_ARGV_Queue_Entry_T. + * + * @param arg Pointer to an argument + * + * @param quote_arg The argument @a arg need to be quoted + * while adding to the vector. + */ + ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg, + bool quote_arg); + + /** + * Initialize a ACE_ARGV_Queue_Entry_T. + * + * @param entry Pointer to a queue entry + */ + ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T &entry); + + /// We need this destructor to keep some compilers from complaining. + /// It's just a no-op, however. + ~ACE_ARGV_Queue_Entry_T (void); + + /// Dump the state of this object. + void dump (void) const; + + // Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /// Pointer to the argument. + const CHAR_TYPE * arg_; + + /// The argument need to be quoted while adding to the vector. + bool quote_arg_; +}; + +/** + * @class ACE_ARGV_T + * + * @brief Builds a counted argument vector (ala argc/argv) from either + * a string or a set of separate tokens. This class preserves whitespace + * within tokens only if the whitespace-containing token is enclosed in + * either single (') or double (") quotes. This is consistent with the + * expected behavior if an argument vector obtained using this class is + * passed to, for example, ACE_Get_Opt. + * + * This class can substitute environment variable values for tokens that + * are environment variable references (e.g., @c $VAR). This only works + * if the token is an environment variable reference and nothing else; it + * doesn't substitute environment variable references within a token. + * For example, @c $HOME/file will not substitute the value of the HOME + * environment variable. + */ +template +class ACE_ARGV_T +{ +public: + // = Initialization and termination. + /** + * Splits the specified string into an argument vector. Arguments in the + * string are delimited by whitespace. Whitespace-containing arguments + * must be enclosed in quotes, either single (') or double ("). + * + * @param buf A nul-terminated CHAR_TYPE array to split into arguments + * for the vector. + * + * @param substitute_env_args If non-zero, any token that is an + * environment variable reference (e.g., @c $VAR) will have + * its environment variable value in the resultant vector + * in place of the environment variable name. + */ + explicit ACE_ARGV_T (const CHAR_TYPE buf[], + bool substitute_env_args = true); + + /** + * Initializes the argument vector from a set of arguments. Any environment + * variable references are translated (if applicable) during execution of + * this method. In contrast with ACE_ARGV_T(CHAR_TYPE *[], bool, bool), this + * ctor does not require argv to be 0-terminated as the number of arguments + * is provided explicitely. + * + * @param argc The number of arguments in the argv array. + * + * @param argv An array of tokens to initialize the object with. All needed + * data is copied from @a argv during this call; the pointers + * in @a argv are not needed after this call, and the memory + * referred to by @a argv is not referenced by this object. + * + * @param substitute_env_args If non-zero, any element of @a argv that is + * an environment variable reference (e.g., @c $VAR) will have + * its environment variable value in the resultant vector + * in place of the environment variable name. + * + * @param quote_args If non-zero each argument @a argv[i] needs to + * be enclosed in double quotes ('"'). + */ + explicit ACE_ARGV_T (int argc, + CHAR_TYPE *argv[], + bool substitute_env_args = true, + bool quote_args = false); + + /** + * Initializes the argument vector from a set of arguments. Any environment + * variable references are translated (if applicable) during execution of + * this method. + * + * @param argv An array of tokens to initialize the object with. The + * array must be terminated with a 0 pointer. All needed + * data is copied from @a argv during this call; the pointers + * in @a argv are not needed after this call, and the memory + * referred to by @a argv is not referenced by this object. + * + * @param substitute_env_args If non-zero, any element of @a argv that is + * an environment variable reference (e.g., @c $VAR) will have + * its environment variable value in the resultant vector + * in place of the environment variable name. + * + * @param quote_args If non-zero each argument @a argv[i] needs to + * be enclosed in double quotes ('"'). + */ + explicit ACE_ARGV_T (CHAR_TYPE *argv[], + bool substitute_env_args = true, + bool quote_args = false); + + /** + * Initializes the argument vector from two combined argument vectors. + * + * @param first_argv An array of tokens to initialize the object with. + * The array must be terminated with a 0 pointer. + * @param second_argv An array of tokens that is concatenated with the + * the tokens in @a first_argv. The array must be + * terminated with a 0 pointer. + * @param substitute_env_args If non-zero, any element of @a first_argv + * or @a second_argv that is an environment variable + * reference (e.g., @c $VAR) will have its environment + * variable value in the resultant vector in place + * of the environment variable name. + * + * @param quote_args If non-zero each arguments @a first_argv[i] and + * @a second_argv[i] needs to be enclosed + * in double quotes ('"'). + */ + ACE_ARGV_T (CHAR_TYPE *first_argv[], + CHAR_TYPE *second_argv[], + bool substitute_env_args = true, + bool quote_args = false); + + /** + * Initialize this object so arguments can be added later using one + * of the add methods. This is referred to as the @i iterative method + * of adding arguments to this object. + */ + explicit ACE_ARGV_T (bool substitute_env_args = true); + + /// Destructor. + ~ACE_ARGV_T (void); + + /** @name Accessor methods + * + * These methods access the argument vector contained in this object. + */ + //@{ + /** + * Returns the specified element of the current argument vector. + * + * @param index Index to the desired element. + * + * @retval Pointer to the indexed string. + * @retval 0 if @a index is out of bounds. + */ + const CHAR_TYPE *operator[] (size_t index); + + /** + * Returns the current argument vector. The returned pointers are to data + * maintained internally to this class. Do not change or delete either the + * pointers or the memory to which they refer. + */ + CHAR_TYPE **argv (void); + + /// Returns the current number of arguments. + int argc (void) const; + + /** + * Returns a single string form of the current arguments. The returned + * pointer refers to memory maintained internally to this class. Do not + * change or delete it. + */ + const CHAR_TYPE *buf (void); + + //@} + + /// Dump the state of this object. + void dump (void) const; + + // Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /** + * Add another argument. This only works in the iterative mode. + * + * @note This method copies the specified pointer, but not the data + * contained in the referenced memory. Thus, if the content of + * the memory referred to by @a next_arg are changed after this + * method returns, the results are undefined. + * + * @param next_arg Pointer to the next argument to add to the vector. + * + * @param quote_arg The argument @a next_arg need to be quoted while + * adding to the vector. + * + * @retval 0 on success; -1 on failure. Most likely @c errno values are: + * - EINVAL: This object is not in iterative mode. + * - ENOMEM: Not enough memory available to save @a next_arg. + */ + int add (const CHAR_TYPE *next_arg, bool quote_arg = false); + + /** + * Add an array of arguments. This only works in the iterative mode. + * + * @note This method copies the specified pointers, but not the data + * contained in the referenced memory. Thus, if the content of + * the memory referred to by any of the @a argv elements is + * changed after this method returns, the results are undefined. + * + * @param argv Pointers to the arguments to add to the vector. + * @a argv must be terminated by a 0 pointer. + * + * @param quote_args If non-zero each argument @a argv[i] needs to + * be enclosed in double quotes ('"'). + * + * @retval 0 on success; -1 on failure. Most likely @c errno values are: + * - EINVAL: This object is not in iterative mode. + * - ENOMEM: Not enough memory available to save @a next_arg. + */ + int add (CHAR_TYPE *argv[], bool quote_args = false); + +private: + /// Copy constructor not implemented. + ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T (const ACE_ARGV_T&)) + + /// Assignment operator not implemented. + ACE_UNIMPLEMENTED_FUNC (ACE_ARGV_T operator= (const ACE_ARGV_T&)) + + /// Creates buf_ from the queue of added args, deletes previous buf_. + int create_buf_from_queue (void); + + /// Converts buf_ into the CHAR_TYPE *argv[] format. + int string_to_argv (void); + + /// Replace args with environment variable values? + bool substitute_env_args_; + + bool iterative_; + + /// Number of arguments in the ARGV array. + int argc_; + + /// The array of string arguments. + CHAR_TYPE **argv_; + + /// Buffer containing the contents. + CHAR_TYPE *buf_; + + /// Total length of the arguments in the queue, not counting + /// separating spaces + size_t length_; + + /// Queue which keeps user supplied arguments. This is only + /// active in the "iterative" mode. + ACE_Unbounded_Queue > queue_; +}; + +typedef ACE_ARGV_Queue_Entry_T ACE_ARGV_Queue_Entry; +typedef ACE_ARGV_T ACE_ARGV; + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/ARGV.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/ARGV.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("ARGV.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_ARGUMENT_VECTOR_H */ diff --git a/externals/ace/ARGV.inl b/externals/ace/ARGV.inl new file mode 100644 index 0000000..fdc5b13 --- /dev/null +++ b/externals/ace/ARGV.inl @@ -0,0 +1,104 @@ +/* -*- C++ -*- */ +// $Id: ARGV.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Global_Macros.h" + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE +ACE_ARGV_Queue_Entry_T::ACE_ARGV_Queue_Entry_T (void) + : arg_(0), + quote_arg_(false) +{ + // No-op +} + +template ACE_INLINE +ACE_ARGV_Queue_Entry_T::ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg, + bool quote_arg) + : arg_(arg), + quote_arg_(quote_arg) +{ + // No-op +} + +template ACE_INLINE +ACE_ARGV_Queue_Entry_T::ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T &entry) + : arg_(entry.arg_), + quote_arg_(entry.quote_arg_) +{ + // No-op +} + +template ACE_INLINE +ACE_ARGV_Queue_Entry_T::~ACE_ARGV_Queue_Entry_T (void) +{ + // No-op just to keep some compilers happy... +} + +// Return the number of args +template +ACE_INLINE int +ACE_ARGV_T::argc (void) const +{ + ACE_TRACE ("ACE_ARGV_T::argc"); + // Try to create the argv_ if it isn't there + ACE_ARGV_T *nonconst_this = + const_cast *> (this); + (void) nonconst_this->argv (); + return this->argc_; +} + +// Return the arguments in a space-separated string +template +ACE_INLINE const CHAR_TYPE * +ACE_ARGV_T::buf (void) +{ + ACE_TRACE ("ACE_ARGV_T::buf"); + + if (this->buf_ == 0 && this->iterative_) + this->create_buf_from_queue (); + + return (const CHAR_TYPE *) this->buf_; +} + +// Return the arguments in an entry-per-argument array + +template +ACE_INLINE CHAR_TYPE ** +ACE_ARGV_T::argv (void) +{ + ACE_TRACE ("ACE_ARGV_T::argv"); + + // Try to create the argv_ if it isn't there + if (this->argv_ == 0) + { + if (this->iterative_ && this->buf_ == 0) + this->create_buf_from_queue (); + + // Convert buf_ to argv_ + if (this->string_to_argv () == -1) + return (CHAR_TYPE **) 0; + } + + return (CHAR_TYPE **) this->argv_; +} + +// Subscript operator. + +template +ACE_INLINE const CHAR_TYPE * +ACE_ARGV_T::operator[] (size_t i) +{ + ACE_TRACE ("ACE_ARGV_T::operator[]"); + + // Don't go out of bounds. + if (i >= static_cast (this->argc_)) + return 0; + + return (const CHAR_TYPE *) this->argv ()[i]; +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ATM_Acceptor.cpp b/externals/ace/ATM_Acceptor.cpp new file mode 100644 index 0000000..7e83565 --- /dev/null +++ b/externals/ace/ATM_Acceptor.cpp @@ -0,0 +1,309 @@ +// $Id: ATM_Acceptor.cpp 84262 2009-01-29 10:34:33Z johnnyw $ + +#include "ace/ATM_Acceptor.h" + +ACE_RCSID(ace, ATM_Acceptor, "$Id: ATM_Acceptor.cpp 84262 2009-01-29 10:34:33Z johnnyw $") + +#if defined (ACE_HAS_ATM) + +#if defined (ACE_HAS_LINUX_ATM) +#include /**/ "linux/atmdev.h" +#endif /* ACE_HAS_LINUX_ATM */ + +#if !defined (__ACE_INLINE__) +#include "ace/ATM_Acceptor.inl" +#endif /* __ACE_INLINE__ */ + + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Put the actual definitions of the ACE_ATM_Request and +// ACE_ATM_Request_Queue classes here to hide them from clients... + +ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Acceptor) + +ACE_ATM_Acceptor::ACE_ATM_Acceptor (void) +{ + ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"); +} + +ACE_ATM_Acceptor::~ACE_ATM_Acceptor (void) +{ + ACE_TRACE ("ACE_ATM_Acceptor::~ACE_ATM_Acceptor"); +} + +int +ACE_ATM_Acceptor::get_local_addr (ACE_ATM_Addr &local_addr) +{ + ACE_TRACE ("ACE_ATM_Acceptor::get_local_addr"); + +#if defined (ACE_HAS_FORE_ATM_WS2) + unsigned long ret = 0; + DWORD deviceID = 0; + ATM_ADDRESS addr; + struct sockaddr_atm *laddr; + + if (::WSAIoctl ((int) ((ACE_SOCK_Acceptor *)this) -> get_handle (), + SIO_GET_ATM_ADDRESS, + (LPVOID) &deviceID, + sizeof (DWORD), + (LPVOID)&addr, + sizeof (ATM_ADDRESS), + &ret, + 0, + 0) == SOCKET_ERROR) { + ACE_OS::printf ("ATM_Acceptor (get_local_addr): WSIoctl: %d\n", + ::WSAGetLastError ()); + return -1; + } + + laddr = (struct sockaddr_atm *)local_addr.get_addr (); + ACE_OS::memcpy ((void *)& (laddr -> satm_number), + (void *)&addr, + ATM_ADDR_SIZE - 1); + + return 0; +#elif defined (ACE_HAS_FORE_ATM_XTI) + ACE_UNUSED_ARG (local_addr); + + return 0; +#elif defined (ACE_HAS_LINUX_ATM) + ATM_Addr *myaddr = (ATM_Addr *)local_addr.get_addr (); + int addrlen = sizeof (myaddr->sockaddratmsvc); + + if (ACE_OS::getsockname (acceptor_.get_handle (), + (struct sockaddr *) & (myaddr->sockaddratmsvc), + &addrlen) < 0) { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ATM_Acceptor (get_local_addr): ioctl: %d\n"), + errno)); + return -1; + } + + return 0; +#else + ACE_UNUSED_ARG (local_addr); + + return 0; +#endif /* ACE_HAS_FORE_ATM_WS2 && ACE_HAS_FORE_ATM_XTI */ +} + +ACE_HANDLE +ACE_ATM_Acceptor::open (const ACE_Addr &remote_sap, + int backlog, + ACE_ATM_Params params) +{ + ACE_TRACE ("ACE_ATM_Acceptor::open"); +#if defined (ACE_HAS_FORE_ATM_XTI) + ACE_HANDLE handle = acceptor_.open (remote_sap, + params.get_reuse_addr (), + params.get_oflag (), + params.get_info (), + backlog, + params.get_device ()); + return (handle == ACE_INVALID_HANDLE ? -1 : 0); +#elif defined (ACE_HAS_FORE_ATM_WS2) + struct sockaddr_atm local_atm_addr; + ACE_HANDLE ret; + DWORD flags = 0; + + /* Create a local endpoint of communication */ + + // Only leaves can listen. + flags = ACE_FLAG_MULTIPOINT_C_LEAF | ACE_FLAG_MULTIPOINT_D_LEAF; + + if ((ret = ACE_OS::socket (AF_ATM, + SOCK_RAW, + ATMPROTO_AAL5, + 0, + 0, + flags)) + == ACE_INVALID_HANDLE) { + ACE_OS::printf ("Acceptor (open): socket %d\n", + ::WSAGetLastError ()); + return (ret); + } + + ((ACE_SOCK_Acceptor *)this) -> set_handle (ret); + + /* Set up the address information to become a server */ + ACE_OS::memset ((void *) &local_atm_addr, 0, sizeof local_atm_addr); + local_atm_addr.satm_family = AF_ATM; + local_atm_addr.satm_number.AddressType = SAP_FIELD_ANY_AESA_REST; + local_atm_addr.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] + = ((ACE_ATM_Addr *)&remote_sap) -> get_selector (); + local_atm_addr.satm_blli.Layer2Protocol = SAP_FIELD_ANY; + local_atm_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; + local_atm_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; + + /* Associate address with endpoint */ + if (ACE_OS::bind (((ACE_SOCK_Acceptor *)this) -> get_handle (), + reinterpret_cast (&local_atm_addr), + sizeof local_atm_addr) == -1) { + ACE_OS::printf ("Acceptor (open): bind %d\n", ::WSAGetLastError ()); + return (ACE_INVALID_HANDLE); + } + + /* Make endpoint listen for service requests */ + if (ACE_OS::listen (( (ACE_SOCK_Acceptor *)this) -> get_handle (), + backlog) + == -1) { + ACE_OS::printf ("Acceptor (open): listen %d\n", ::WSAGetLastError ()); + return (ACE_INVALID_HANDLE); + } + + return 0; +#elif defined (ACE_HAS_LINUX_ATM) + //we need to set the qos before binding to the socket + //use remote_sap as local_sap + + ACE_ATM_Addr local_sap; + ATM_Addr *local_sap_addr = (ATM_Addr*)local_sap.get_addr (); + ACE_ATM_QoS def_qos; + ATM_QoS qos = def_qos.get_qos (); + + ACE_HANDLE handle; + if ((handle = ACE_OS::socket (params.get_protocol_family (), + params.get_type (), + params.get_protocol (), + params.get_protocol_info (), + params.get_sock_group (), + params.get_flags () + )) + == ACE_INVALID_HANDLE) { + ACE_DEBUG (LM_DEBUG, + ACE_TEXT ("Acceptor (socket): socket %d\n"), + errno); + return (ACE_INVALID_HANDLE); + } + + ((ACE_SOCK_Acceptor *)this) -> set_handle (handle); + if (ACE_OS::setsockopt (handle, + SOL_ATM, + SO_ATMQOS, + reinterpret_cast (&qos), + sizeof (qos)) < 0) { + ACE_OS::printf ("Acceptor (setsockopt): setsockopt:%d\n", + errno); + } + + struct atmif_sioc req; + struct sockaddr_atmsvc aux_addr[1024]; + + req.number = 0; + req.arg = aux_addr; + req.length = sizeof (aux_addr); + if (ACE_OS::ioctl (handle, + ATM_GETADDR, + &req) < 0) { + ACE_OS::perror ("Acceptor (setsockopt): ioctl:"); + } + else { + local_sap_addr->sockaddratmsvc = aux_addr[0]; + } + local_sap.set_selector (( (ACE_ATM_Addr*)&remote_sap)->get_selector ()); + + if (ACE_OS::bind (handle, + reinterpret_cast ( + &(local_sap_addr->sockaddratmsvc)), + sizeof (local_sap_addr->sockaddratmsvc) + ) == -1) { + ACE_DEBUG (LM_DEBUG, + ACE_TEXT ("Acceptor (open): bind %d\n"), + errno); + return -1; + } + // Make endpoint listen for service requests + if (ACE_OS::listen (handle, + backlog) + == -1) { + ACE_DEBUG (LM_DEBUG, + ACE_TEXT ("Acceptor (listen): listen %d\n"), + errno); + return -1; + } + + return 0; +#else + ACE_UNUSED_ARG (remote_sap); + ACE_UNUSED_ARG (backlog); + ACE_UNUSED_ARG (params); +#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */ +} + +int +ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap, + ACE_Addr *remote_addr, + ACE_Time_Value *timeout, + bool restart, + bool reset_new_handle, + ACE_ATM_Params params, + ACE_ATM_QoS qos) +{ + ACE_TRACE ("ACE_ATM_Acceptor::accept"); +#if defined (ACE_HAS_FORE_ATM_XTI) + ATM_QoS optbuf = qos.get_qos (); + + return (acceptor_.accept (new_sap.get_stream (), + remote_addr, + timeout, + restart, + reset_new_handle, + params.get_rw_flag (), + params.get_user_data (), + &optbuf)); +#elif defined (ACE_HAS_FORE_ATM_WS2) + ACE_HANDLE n_handle; + ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle (); + struct sockaddr_atm *cli_addr + = (struct sockaddr_atm *)remote_addr -> get_addr (); + int caddr_len = sizeof (struct sockaddr_atm); + + do { + n_handle = ACE_OS::accept (s_handle, + reinterpret_cast (cli_addr), + &caddr_len); + } while (n_handle == ACE_INVALID_HANDLE && errno == EINTR); + + ((ACE_ATM_Addr *)remote_addr) -> set (cli_addr, + ((ACE_ATM_Addr *)remote_addr) -> get_selector ()); + ((ACE_IPC_SAP *)&new_sap) -> set_handle (n_handle); + + return 0; +#elif defined (ACE_HAS_LINUX_ATM) + ACE_UNUSED_ARG (params); + + ACE_HANDLE s_handle = ((ACE_SOCK_Acceptor *) this) -> get_handle (); + struct atm_qos accept_qos = qos.get_qos (); + + if (ACE_OS::setsockopt (s_handle, + SOL_ATM, + SO_ATMQOS, + reinterpret_cast (&accept_qos), + sizeof (accept_qos)) < 0) { + ACE_OS::printf ("Acceptor (accept): error setting Qos"); + } + + return (acceptor_.accept (new_sap.get_stream (), + remote_addr, + timeout, + restart, + reset_new_handle)); +#else + ACE_UNUSED_ARG (new_sap); + ACE_UNUSED_ARG (remote_addr); + ACE_UNUSED_ARG (timeout); + ACE_UNUSED_ARG (restart); + ACE_UNUSED_ARG (reset_new_handle); + ACE_UNUSED_ARG (params); + ACE_UNUSED_ARG (qos); + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI */ +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + + +#endif /* ACE_HAS_ATM */ diff --git a/externals/ace/ATM_Acceptor.h b/externals/ace/ATM_Acceptor.h new file mode 100644 index 0000000..1241a22 --- /dev/null +++ b/externals/ace/ATM_Acceptor.h @@ -0,0 +1,123 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ATM_Acceptor.h + * + * $Id: ATM_Acceptor.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Joe Hoffert + */ +//============================================================================= + + +#ifndef ACE_ATM_ACCEPTOR_H +#define ACE_ATM_ACCEPTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_ATM) + +#include "ace/ATM_Stream.h" +#include "ace/ATM_Params.h" +#include "ace/ATM_QoS.h" + +#if defined (ACE_HAS_LINUX_ATM) +#include /**/ "atm.h" +#endif /* ACE_HAS_LINUX_ATM */ + +#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) +#include "ace/SOCK_Acceptor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef ACE_SOCK_Acceptor ATM_Acceptor; +ACE_END_VERSIONED_NAMESPACE_DECL +#elif defined (ACE_HAS_FORE_ATM_XTI) +#include "ace/TLI_Acceptor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef ACE_TLI_Acceptor ATM_Acceptor; +ACE_END_VERSIONED_NAMESPACE_DECL +#endif // ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations. +class ACE_Time_Value; + +/** + * @class ACE_ATM_Acceptor + * + * @brief Defines the member functions for ACE_ATM_Acceptor abstraction. + * + * This class wraps up the ACE_SOCK_Acceptor and ACE_TLI_Acceptor + * to make the mechanism for the ATM protocol transparent. + */ +class ACE_Export ACE_ATM_Acceptor +{ + +public: + // = Initialization and termination methods. + /// Default constructor. + ACE_ATM_Acceptor (void); + + ~ACE_ATM_Acceptor (); + + /// Initiate a passive mode connection. + ACE_ATM_Acceptor (const ACE_Addr &remote_sap, + int backlog = ACE_DEFAULT_BACKLOG, + ACE_ATM_Params params = ACE_ATM_Params()); + + /// Initiate a passive mode socket. + ACE_HANDLE open (const ACE_Addr &remote_sap, + int backlog = ACE_DEFAULT_BACKLOG, + ACE_ATM_Params params = ACE_ATM_Params()); + + /// Close down the acceptor and release resources. + int close (void); + + // = Passive connection acceptance method. + + /// Accept a new data transfer connection. A @a timeout of 0 means + /// block forever, a @a timeout of {0, 0} means poll. @a restart == 1 + /// means "restart if interrupted." + int accept (ACE_ATM_Stream &new_sap, + ACE_Addr *remote_addr = 0, + ACE_Time_Value *timeout = 0, + bool restart = true, + bool reset_new_handle = false, + ACE_ATM_Params params = ACE_ATM_Params(), + ACE_ATM_QoS qos = ACE_ATM_QoS()); + + /// Get the local address currently listening on + int get_local_addr( ACE_ATM_Addr &local_addr ); + + // = Meta-type info + typedef ACE_ATM_Addr PEER_ADDR; + typedef ACE_ATM_Stream PEER_STREAM; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + ATM_Acceptor acceptor_; +}; + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + + +#if defined (__ACE_INLINE__) +#include "ace/ATM_Acceptor.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_ATM */ +#include /**/ "ace/post.h" +#endif /* ACE_ATM_ACCEPTOR_H */ diff --git a/externals/ace/ATM_Acceptor.inl b/externals/ace/ATM_Acceptor.inl new file mode 100644 index 0000000..fa60c4a --- /dev/null +++ b/externals/ace/ATM_Acceptor.inl @@ -0,0 +1,43 @@ +// -*- C++ -*- +// +// $Id: ATM_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $ + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void +ACE_ATM_Acceptor::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ATM_Acceptor::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_INLINE +ACE_ATM_Acceptor::ACE_ATM_Acceptor (const ACE_Addr &remote_sap, + int backlog, + ACE_ATM_Params params) +{ + ACE_TRACE ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"); + + //FUZZ: disable check_for_lack_ACE_OS + if (open (remote_sap, backlog, params) < 0) + //FUZZ: enable check_for_lack_ACE_OS + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_ATM_Acceptor::ACE_ATM_Acceptor"))); +} + +ACE_INLINE +int +ACE_ATM_Acceptor::close (void) +{ +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) + return (acceptor_.close()); +#else + return 0; +#endif // ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ATM_Addr.cpp b/externals/ace/ATM_Addr.cpp new file mode 100644 index 0000000..991498d --- /dev/null +++ b/externals/ace/ATM_Addr.cpp @@ -0,0 +1,522 @@ +// $Id: ATM_Addr.cpp 84565 2009-02-23 08:20:39Z johnnyw $ + +// Defines the Internet domain address family address format. + +#include "ace/ATM_Addr.h" +#if defined (ACE_HAS_ATM) + +#include "ace/Log_Msg.h" + +#if defined (ACE_HAS_FORE_ATM_WS2) +#include /**/ "forews2.h" +#endif /* ACE_HAS_FORE_ATM_WS2 */ + +#if !defined (__ACE_INLINE__) +#include "ace/ATM_Addr.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, ATM_Addr, "$Id: ATM_Addr.cpp 84565 2009-02-23 08:20:39Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Addr) + +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) +#define BHLI_MAGIC "FORE_ATM" +// This is line rate in cells/s for an OC-3 MM interface. +const long ACE_ATM_Addr::LINE_RATE = 353207; +const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0x1; +const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0x2; +const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x99; +#elif defined (ACE_HAS_LINUX_ATM) +//pbrandao:for Linux: +//pbrandao:for now stick with current definitions +//pbrandao:see if later need to change +const long ACE_ATM_Addr::LINE_RATE = 353207; +const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0; +const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0; +const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x99; +#else +const long ACE_ATM_Addr::LINE_RATE = 0L; +const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0; +const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0; +const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + +// Default constructor + +ACE_ATM_Addr::ACE_ATM_Addr (u_char selector) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + : ACE_Addr (AF_ATM, +#elif defined (ACE_HAS_LINUX_ATM) + : ACE_Addr (PF_ATMSVC, +#else + : ACE_Addr (AF_UNSPEC, +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + sizeof this->atm_addr_) +{ + // ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); + (void) ACE_OS::memset ((void *) &this->atm_addr_, + 0, + sizeof this->atm_addr_); + this->init (selector); +} + +// Copy constructor. + +ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap, + u_char selector) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + : ACE_Addr (AF_ATM, +#elif defined (ACE_HAS_LINUX_ATM) + : ACE_Addr (PF_ATMSVC, +#else + : ACE_Addr (AF_UNSPEC, +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + sizeof this->atm_addr_) +{ + ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); + this->set (sap, selector); +#if defined (ACE_HAS_LINUX_ATM) + this->atm_addr_.sockaddratmsvc.sas_family = PF_ATMSVC; + this->atm_addr_.atmsap.blli[0].l3_proto = ATM_L3_NONE; + this->atm_addr_.atmsap.blli[0].l2_proto = ATM_L2_NONE; + this->atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE; +#endif /* ACE_HAS_LINUX_ATM */ +} + +ACE_ATM_Addr::ACE_ATM_Addr (const ATM_Addr *sap, + u_char selector) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + : ACE_Addr (AF_ATM, +#elif defined (ACE_HAS_LINUX_ATM) + : ACE_Addr (PF_ATMSVC, +#else + : ACE_Addr (AF_UNSPEC, +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + sizeof this->atm_addr_) +{ + ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); + this->set (sap, selector); +} + + +ACE_ATM_Addr::ACE_ATM_Addr (const ACE_TCHAR sap[], + u_char selector) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + : ACE_Addr (AF_ATM, +#elif defined (ACE_HAS_LINUX_ATM) + : ACE_Addr (PF_ATMSVC, +#else + : ACE_Addr (AF_UNSPEC, +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + sizeof this->atm_addr_) +{ + ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); + this->set (sap, selector); +} + +ACE_ATM_Addr::~ACE_ATM_Addr (void) +{ +} + +// Return the address. + +void * +ACE_ATM_Addr::get_addr (void) const +{ + ACE_TRACE ("ACE_ATM_Addr::get_addr"); + return (void *) &this->atm_addr_; +} + +void +ACE_ATM_Addr::init (u_char selector) +{ +#if defined (ACE_HAS_FORE_ATM_XTI) + // Note: this approach may be FORE implementation-specific. When we + // bind with tag_addr ABSENT and tag_selector PRESENT, only the + // selector (i.e. address[19]) is used by the TP. The rest of the + // local address is filled in by the TP and can be obtained via the + // 'ret' parameter or with t_getname ()/t_getprotaddr (). + + atm_addr_.addressType = (u_int16_t) AF_ATM; + + atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = (int8_t) T_ATM_ABSENT; + atm_addr_.sap.t_atm_sap_addr.SVE_tag_selector = (int8_t) T_ATM_PRESENT; + + atm_addr_.sap.t_atm_sap_addr.address_format = (u_int8_t) T_ATM_ENDSYS_ADDR; + atm_addr_.sap.t_atm_sap_addr.address_length = ATMNSAP_ADDR_LEN; + atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector; + + atm_addr_.sap.t_atm_sap_layer2.SVE_tag = (int8_t) T_ATM_ABSENT; + atm_addr_.sap.t_atm_sap_layer3.SVE_tag = (int8_t) T_ATM_ABSENT; + + atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT; + atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID; + + ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, + BHLI_MAGIC, + sizeof atm_addr_.sap.t_atm_sap_appl.ID); +#elif defined (ACE_HAS_FORE_ATM_WS2) + ACE_OS::memset ((void *)&atm_addr_, 0, sizeof atm_addr_); + atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = (char)selector; + atm_addr_.satm_family = AF_ATM; + atm_addr_.satm_number.AddressType = ATM_NSAP; + atm_addr_.satm_number.NumofDigits = ATM_ADDR_SIZE; + atm_addr_.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT; + atm_addr_.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; + atm_addr_.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; + + // Need to know the correspondence. + //atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT; + //atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID; + //ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, + // BHLI_MAGIC, + // sizeof atm_addr_.sap.t_atm_sap_appl.ID); +#elif defined (ACE_HAS_LINUX_ATM) + atm_addr_.sockaddratmsvc.sas_family = AF_ATMSVC; + atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1] = (char)selector; + atm_addr_.atmsap.blli[0].l3_proto = ATM_L3_NONE; + atm_addr_.atmsap.blli[0].l2_proto = ATM_L2_NONE; + atm_addr_.atmsap.bhli.hl_type = ATM_HL_NONE; +#else + ACE_UNUSED_ARG (selector); +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +} + +int +ACE_ATM_Addr::set (const ACE_ATM_Addr &sap, + u_char selector) +{ + ACE_TRACE ("ACE_ATM_Addr::set"); + + this->init (selector); + + this->ACE_Addr::base_set (sap.get_type (), + sap.get_size ()); + +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + ACE_ASSERT (sap.get_type () == AF_ATM); +#elif defined (ACE_HAS_LINUX_ATM) + ACE_ASSERT (sap.get_type () == PF_ATMSVC); +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ + + (void) ACE_OS::memcpy ((void *) &this->atm_addr_, + (void *) &sap.atm_addr_, + sizeof this->atm_addr_); + return 0; +} + +int +ACE_ATM_Addr::set (const ATM_Addr *sap, + u_char selector) +{ + ACE_TRACE ("ACE_ATM_Addr::set"); + + this->init (selector); + +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + this->ACE_Addr::base_set (AF_ATM, +#elif defined (ACE_HAS_LINUX_ATM) + this->ACE_Addr::base_set (PF_ATMSVC, +#else + this->ACE_Addr::base_set (AF_UNSPEC, +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ + sizeof (*sap)); + + (void) ACE_OS::memcpy ((void *) &this->atm_addr_, + (void *) sap, + sizeof this->atm_addr_); + return 0; +} + +int +ACE_ATM_Addr::set (const ACE_TCHAR address[], + u_char selector) +{ + ACE_TRACE ("ACE_ATM_Addr::set"); + int ret; + + this->init (selector); + +#if defined (ACE_HAS_FORE_ATM_XTI) + atm_addr_.sap.t_atm_sap_addr.SVE_tag_addr = + (int8_t) T_ATM_PRESENT; +#endif /* ACE_HAS_FORE_ATM_XTI */ + + ret = this -> string_to_addr (address); + this -> set_selector (selector); + return ret; +} + +// Transform the string into the current addressing format. + +int +ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[]) +{ + ACE_TRACE ("ACE_ATM_Addr::string_to_addr"); + +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + this->ACE_Addr::base_set (AF_ATM, +#elif defined (ACE_HAS_LINUX_ATM) + this->ACE_Addr::base_set (PF_ATMSVC, +#else + this->ACE_Addr::base_set (AF_UNSPEC, +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + sizeof this->atm_addr_); +#if defined (ACE_HAS_FORE_ATM_XTI) + struct hostent *entry; + struct atmnsap_addr *nsap; + + // Yow, someone gave us a NULL ATM address! + if (sap == 0) + { + errno = EINVAL; + return -1; + } + else if ((entry = gethostbyname_atmnsap ((ACE_TCHAR *)sap)) != 0) + { + ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_addr.address, + entry->h_addr_list[0], + ATMNSAP_ADDR_LEN - 1); + } + else if ((nsap = atmnsap_addr (sap)) != 0) + { + ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_addr.address, + nsap->atmnsap, + ATMNSAP_ADDR_LEN); + } + else { + errno = EINVAL; + return -1; + } +#elif defined (ACE_HAS_FORE_ATM_WS2) + DWORD dwValue; + HANDLE hLookup; + WSAQUERYSETW qsRestrictions; + CSADDR_INFO csaBuffer; + WCHAR tmpWStr[100]; + + MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, sap, -1, tmpWStr, 100); + + csaBuffer.LocalAddr.iSockaddrLength = sizeof (struct sockaddr_atm); + csaBuffer.LocalAddr.lpSockaddr = (struct sockaddr *)&atm_addr_; + csaBuffer.RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_atm); + csaBuffer.RemoteAddr.lpSockaddr = (struct sockaddr *)&atm_addr_; + + qsRestrictions.dwSize = sizeof (WSAQUERYSETW); + qsRestrictions.lpszServiceInstanceName = 0; + qsRestrictions.lpServiceClassId = &FORE_NAME_CLASS; + qsRestrictions.lpVersion = 0; + qsRestrictions.lpszComment = 0; + qsRestrictions.dwNameSpace = FORE_NAME_SPACE; + qsRestrictions.lpNSProviderId = 0; + qsRestrictions.lpszContext = L""; + qsRestrictions.dwNumberOfProtocols = 0; + qsRestrictions.lpafpProtocols = 0; + qsRestrictions.lpszQueryString = tmpWStr; + qsRestrictions.dwNumberOfCsAddrs = 1; + qsRestrictions.lpcsaBuffer = &csaBuffer; + qsRestrictions.lpBlob = 0; //&blob; + + if (::WSALookupServiceBeginW (&qsRestrictions, LUP_RETURN_ALL, &hLookup) + == SOCKET_ERROR) { + ACE_OS::printf ("Error: WSALookupServiceBeginW failed! %d\n", + ::WSAGetLastError ()); + return -1; + } + + dwValue = sizeof (WSAQUERYSETW); + + if (::WSALookupServiceNextW (hLookup, 0, &dwValue, &qsRestrictions) + == SOCKET_ERROR) { + if (WSAGetLastError () != WSA_E_NO_MORE) { + ACE_OS::printf ("Error: WSALookupServiceNextW failed! %d\n", + ::WSAGetLastError ()); + return -1; + } + } + + if (WSALookupServiceEnd (hLookup) == SOCKET_ERROR) { + ACE_OS::printf ("Error : WSALookupServiceEnd failed! %d\n", + ::WSAGetLastError ()); + errno = EINVAL; + return -1; + } +#elif defined (ACE_HAS_LINUX_ATM) + if (sap == 0 || !ACE_OS::strcmp (sap,"")) { + errno = EINVAL; + return -1; + } + + if (text2atm ((ACE_TCHAR *)sap, + (struct sockaddr *)& (atm_addr_.sockaddratmsvc), + sizeof (atm_addr_.sockaddratmsvc), + T2A_SVC | T2A_NAME) < 0) { + ACE_DEBUG (LM_DEBUG, + "Error : text2atm failed!\n"); + errno = EINVAL; + return -1; + } +#else + ACE_UNUSED_ARG (sap); + + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ +} + +// Transform the current address into string format. + +int +ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[], + size_t addrlen) const +{ + ACE_TRACE ("ACE_ATM_Addr::addr_to_string"); + +#if defined (ACE_HAS_FORE_ATM_XTI) + ACE_TCHAR buffer[MAXNAMELEN + 1]; + struct atmnsap_addr nsap; + ACE_OS::memcpy (nsap.atmnsap, + atm_addr_.sap.t_atm_sap_addr.address, + ATMNSAP_ADDR_LEN); + ACE_OS::sprintf (buffer, + ACE_TEXT ("%s"), + atmnsap_ntoa (nsap)); + + size_t total_len = ACE_OS::strlen (buffer) + sizeof ('\0'); + + if (addrlen < total_len) + return -1; + else + ACE_OS::strcpy (addr, buffer); + + return 0; +#elif defined (ACE_HAS_FORE_ATM_WS2) + ACE_TCHAR buffer[MAXNAMELEN + 1]; + int i; + + if (addrlen < ATM_ADDR_SIZE + 1) + return -1; + + for (i = 0; i < ATM_ADDR_SIZE; i++) { + buffer[ i * 3 ] = '\0'; + ACE_OS::sprintf (buffer, ACE_TEXT ("%s%02x."), + buffer, + atm_addr_.satm_number.Addr[ i ]); + } + + buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0'; + ACE_OS::strcpy (addr, buffer); + + return 0; +#elif defined (ACE_HAS_LINUX_ATM) + ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1]; + int total_len; + if ((total_len = atm2text (buffer, + sizeof buffer, + (struct sockaddr *)& (atm_addr_.sockaddratmsvc), + A2T_PRETTY)) < 0) { + ACE_DEBUG ((LM_DEBUG,"ACE_ATM_Addr (addr_to_string): atm2text failed\n")); + return -1; + } + if (addrlen < (size_t)total_len) + return -1; + else + ACE_OS::strcpy (addr, + buffer); + + return 0; +#else + ACE_UNUSED_ARG (addr); + ACE_UNUSED_ARG (addrlen); + return -1; +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ +} + +const ACE_TCHAR * +ACE_ATM_Addr::addr_to_string (void) const +{ + ACE_TRACE ("ACE_ATM_Addr::addr_to_string"); + + static ACE_TCHAR addr[MAXHOSTNAMELEN + 1]; + if (this->addr_to_string (addr, + MAXHOSTNAMELEN + 1) < 0) + return 0; + + return addr; +} + +// Set a pointer to the address. +void +ACE_ATM_Addr::set_addr (void *addr, int len) +{ + ACE_TRACE ("ACE_ATM_Addr::set_addr"); + +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + this->ACE_Addr::base_set (AF_ATM, +#elif defined (ACE_HAS_LINUX_ATM) + this->ACE_Addr::base_set (PF_ATMSVC, +#else + this->ACE_Addr::base_set (AF_UNSPEC, +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_WS2 */ + len); + ACE_OS::memcpy ((void *) &this->atm_addr_, + (void *) addr, len); +} + +// Compare two addresses for inequality. + +bool +ACE_ATM_Addr::operator != (const ACE_ATM_Addr &sap) const +{ + ACE_TRACE ("ACE_ATM_Addr::operator !="); + return ! ((*this) == sap); +} + +// Compare two addresses for equality. + +bool +ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const +{ + ACE_TRACE ("ACE_ATM_Addr::operator =="); + +#if defined (ACE_HAS_LINUX_ATM) + return (atm_equal ((const struct sockaddr *)& (this->atm_addr_.sockaddratmsvc), + (const struct sockaddr *)& (sap.atm_addr_.sockaddratmsvc), + 0, + 0) + && + sap_equal (& (this->atm_addr_.atmsap), + & (sap.atm_addr_.atmsap), + 0)); +#else + return ACE_OS::memcmp (&atm_addr_, + &sap.atm_addr_, + sizeof (ATM_Addr)) == 0; +#endif /* ACE_HAS_LINUX_ATM */ +} + +void +ACE_ATM_Addr::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ATM_Addr::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_TCHAR s[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16]; + ACE_OS::sprintf (s, + ACE_TEXT ("%s"), + this->addr_to_string ()); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s"), s)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_ATM */ diff --git a/externals/ace/ATM_Addr.h b/externals/ace/ATM_Addr.h new file mode 100644 index 0000000..7fa93f1 --- /dev/null +++ b/externals/ace/ATM_Addr.h @@ -0,0 +1,197 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file ATM_Addr.h + * + * $Id: ATM_Addr.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Joe Hoffert + */ +//========================================================================== + +#ifndef ACE_ATM_ADDR_H +#define ACE_ATM_ADDR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_ATM) + +#include /**/ "ace/ACE_export.h" +#include "ace/Addr.h" + +#if defined (ACE_HAS_FORE_ATM_XTI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef ATMSAPAddress ATM_Addr; +ACE_END_VERSIONED_NAMESPACE_DECL +#elif defined (ACE_HAS_FORE_ATM_WS2) +#define FORE_NAME_SPACE NS_ALL +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef struct sockaddr_atm ATM_Addr; +ACE_END_VERSIONED_NAMESPACE_DECL +#elif defined (ACE_HAS_LINUX_ATM) + +#include /**/ "atm.h" + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +//pbrandao:as Linux has this 2 structs separeted we "link it" here +typedef struct _linux_atm_addr +{ + struct sockaddr_atmsvc sockaddratmsvc; + struct atm_sap atmsap; +} ATM_Addr; +#else +typedef int ATM_Addr; +#endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */ + +/** + * @class ACE_ATM_Addr + * + * @brief Defines the ATM domain address family address format. + */ +class ACE_Export ACE_ATM_Addr : public ACE_Addr +{ +public: + // Constants used for ATM options + static const long LINE_RATE; + static const int OPT_FLAGS_CPID; + static const int OPT_FLAGS_PMP; + static const int DEFAULT_SELECTOR; + + // = Initialization methods. + /// Default constructor. + ACE_ATM_Addr (u_char selector = DEFAULT_SELECTOR); + + /// Copy constructor. + ACE_ATM_Addr (const ACE_ATM_Addr &, + u_char selector = DEFAULT_SELECTOR); + + /** + * Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This + * is vendor specific (FORE systems). May need to change when other + * vendors are supported. + */ + ACE_ATM_Addr (const ATM_Addr *, + u_char selector = DEFAULT_SELECTOR); + + /** + * Initializes an ACE_ATM_Addr from the which can be + * "atm-address" (e.g., + * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" + * (e.g., "frisbee.cs.wustl.edu"). + */ + ACE_ATM_Addr (const ACE_TCHAR sap[], + u_char selector = DEFAULT_SELECTOR); + + /// Default dtor. + ~ACE_ATM_Addr (void); + + // = Initialization methods (useful after object construction). + /// Default initialization for non-address values (e.g., + /// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector) + void init (u_char selector = DEFAULT_SELECTOR); + + /// Initializes from another ACE_ATM_Addr. + int set (const ACE_ATM_Addr &, + u_char selector = DEFAULT_SELECTOR); + + /** + * Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm + * structure. This is vendor specific (FORE systems). May need to + * change when other vendors are supported. + */ + int set (const ATM_Addr *, + u_char selector = DEFAULT_SELECTOR); + + /** + * Initializes an ACE_ATM_Addr from the which can be + * "atm-address" (e.g., + * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" + * (e.g., "frisbee.cs.wustl.edu"). + */ + int set (const ACE_TCHAR sap[], + u_char selector = DEFAULT_SELECTOR); + + /** + * Initializes an ACE_ATM_Addr from the which can be + * "atm-address" (e.g., + * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname" + * (e.g., "frisbee.cs.wustl.edu"). + */ + virtual int string_to_addr (const ACE_TCHAR sap[]); + + /** + * Return the character representation of the ATM address (e.g., + * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") storing it in + * the @a addr (which is assumed to be bytes long). This + * version is reentrant. Returns -1 if the of the @a addr + * is too small, else 0. + */ + virtual int addr_to_string (ACE_TCHAR addr[], + size_t addrlen) const; + + /** + * Return the character representation of the ATM address (e.g., + * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00"). Returns -1 + * if the of the is too small, else 0.(This version + * is non-reentrant since it returns a pointer to a static data + * area.) + */ + const ACE_TCHAR *addr_to_string (void) const; + + /// Return a pointer to the underlying network address. + virtual void *get_addr (void) const; + + /// Set a pointer to the address. + virtual void set_addr (void *, int); + + /// Return the selector for network address. + u_char get_selector (void) const; + + /// Set the selector for the network address. + void set_selector (u_char selector); + + /** + * Compare two addresses for equality. The addresses are considered + * equal if they contain the same ATM address. Q: Is there any + * other check for equality needed for ATM? + */ + bool operator == (const ACE_ATM_Addr &SAP) const; + + /// Compare two addresses for inequality. + bool operator != (const ACE_ATM_Addr &SAP) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +// char *construct_options (ACE_HANDLE fd, +// int qos_kb, +// int flags, +// long *optsize); +// // Construct options for ATM connections + +private: + ATM_Addr atm_addr_; +}; + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + + +#if defined (__ACE_INLINE__) +#include "ace/ATM_Addr.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_ATM */ +#include /**/ "ace/post.h" +#endif /* ACE_ATM_ADDR_H */ diff --git a/externals/ace/ATM_Addr.inl b/externals/ace/ATM_Addr.inl new file mode 100644 index 0000000..55f43d6 --- /dev/null +++ b/externals/ace/ATM_Addr.inl @@ -0,0 +1,37 @@ +// -*- C++ -*- +// +// $Id: ATM_Addr.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE u_char +ACE_ATM_Addr::get_selector (void) const +{ + ACE_TRACE ("ACE_ATM_Addr::get_selector"); +#if defined (ACE_HAS_FORE_ATM_XTI) + return atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1]; +#elif defined (ACE_HAS_FORE_ATM_WS2) + return atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ]; +#elif defined (ACE_HAS_LINUX_ATM) + return atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1]; +#else + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +} + +ACE_INLINE void +ACE_ATM_Addr::set_selector (u_char selector) +{ + ACE_TRACE ("ACE_ATM_Addr::set_selector"); +#if defined (ACE_HAS_FORE_ATM_XTI) + atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector; +#elif defined (ACE_HAS_FORE_ATM_WS2) + atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = selector; +#elif defined (ACE_HAS_LINUX_ATM) + atm_addr_.sockaddratmsvc.sas_addr.prv[ATM_ESA_LEN - 1] = selector; +#else + ACE_UNUSED_ARG (selector); +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ATM_Connector.cpp b/externals/ace/ATM_Connector.cpp new file mode 100644 index 0000000..c1ce226 --- /dev/null +++ b/externals/ace/ATM_Connector.cpp @@ -0,0 +1,138 @@ +// ATM_Connector.cpp +// $Id: ATM_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ATM_Connector.h" +#if defined (ACE_HAS_ATM) + +#include "ace/Handle_Set.h" + +ACE_RCSID(ace, ATM_Connector, "$Id: ATM_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if !defined (__ACE_INLINE__) +#include "ace/ATM_Connector.inl" +#endif /* __ACE_INLINE__ */ + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Connector) + +ACE_ATM_Connector::ACE_ATM_Connector (void) +{ + ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); +} + +// Actively connect and produce a new ACE_ATM_Stream if things go well... +// Connect the to the , waiting up to +// amount of time if necessary. + +int +ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream, + const ACE_ATM_Addr &remote_sap, + ACE_ATM_Params params, + ACE_ATM_QoS options, + ACE_Time_Value *timeout, + const ACE_ATM_Addr &local_sap, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_ATM_Connector::connect"); +#if defined (ACE_HAS_FORE_ATM_XTI) + return connector_.connect(new_stream.get_stream(), + remote_sap, + timeout, + local_sap, + reuse_addr, + flags, + perms, + params.get_device(), + params.get_info(), + params.get_rw_flag(), + params.get_user_data(), + &options.get_qos()); +#elif defined (ACE_HAS_FORE_ATM_WS2) + ACE_DEBUG(LM_DEBUG, + ACE_TEXT ("ATM_Connector(connect): set QoS parameters\n" )); + + ACE_HANDLE s = new_stream.get_handle(); + struct sockaddr_atm *saddr = ( struct sockaddr_atm *)remote_sap.get_addr(); + ACE_QoS cqos = options.get_qos(); + + ACE_QoS_Params qos_params = ACE_QoS_Params(0, + 0, + &cqos, + 0, + 0); + + ACE_DEBUG(LM_DEBUG, + ACE_TEXT ("ATM_Connector(connect): connecting...\n")); + + int result = ACE_OS::connect( s, + ( struct sockaddr *)saddr, + sizeof( struct sockaddr_atm ), + qos_params ); + + if ( result != 0 ) + ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n", + ::WSAGetLastError()); + + return result; +#elif defined (ACE_HAS_LINUX_ATM) + ACE_UNUSED_ARG (params); + ACE_UNUSED_ARG (timeout); + ACE_UNUSED_ARG (reuse_addr); + ACE_UNUSED_ARG (perms); + ACE_UNUSED_ARG (flags); + + ACE_HANDLE handle = new_stream.get_handle(); + ATM_QoS qos =options.get_qos(); + ATM_Addr *local_addr=(ATM_Addr*)local_sap.get_addr(), + *remote_addr=(ATM_Addr*)remote_sap.get_addr(); + + if (ACE_OS::setsockopt(handle, + SOL_ATM, + SO_ATMSAP, + reinterpret_cast (&(local_addr->atmsap)), + sizeof(local_addr->atmsap)) < 0) { + ACE_OS::printf( "ATM_Connector(connect): unable to set atmsap %d\nContinuing...", + errno); + } + if (ACE_OS::setsockopt(handle, + SOL_ATM, + SO_ATMQOS, + reinterpret_cast (&qos), + sizeof(qos)) < 0) { + ACE_DEBUG((LM_DEBUG,ACE_TEXT ("ATM_Connector(connect): unable to set qos %d\n"), + errno)); + return -1; + } + + int result = ACE_OS::connect(handle, + (struct sockaddr *)&(remote_addr->sockaddratmsvc), + sizeof( remote_addr->sockaddratmsvc)); + + if ( result != 0 ) + ACE_DEBUG(LM_DEBUG, + ACE_TEXT ("ATM_Connector(connect): connection failed, %d\n"), + errno); + + return result; +#else + ACE_UNUSED_ARG (new_stream); + ACE_UNUSED_ARG (remote_sap); + ACE_UNUSED_ARG (params); + ACE_UNUSED_ARG (options); + ACE_UNUSED_ARG (timeout); + ACE_UNUSED_ARG (local_sap); + ACE_UNUSED_ARG (reuse_addr); + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (perms); + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_ATM */ diff --git a/externals/ace/ATM_Connector.h b/externals/ace/ATM_Connector.h new file mode 100644 index 0000000..940fc5a --- /dev/null +++ b/externals/ace/ATM_Connector.h @@ -0,0 +1,164 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ATM_Connector.h + * + * $Id: ATM_Connector.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Joe Hoffert + */ +//============================================================================= + +#ifndef ACE_ATM_CONNECTOR_H +#define ACE_ATM_CONNECTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_ATM) + +#include "ace/ATM_Stream.h" +#include "ace/ATM_Params.h" +#include "ace/ATM_QoS.h" + +#if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM) +#include "ace/SOCK_Connector.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef ACE_SOCK_Connector ATM_Connector; +ACE_END_VERSIONED_NAMESPACE_DECL +#else +#include "ace/XTI_ATM_Mcast.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef ACE_XTI_ATM_Mcast ATM_Connector; +// Open versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL +#endif + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_ATM_Connector + * + * @brief Defines an active connection factory for the ACE_ATM C++ + * wrappers. + */ +class ACE_Export ACE_ATM_Connector +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_ATM_Connector (void); + + /** + * Actively connect and produce a @a new_stream if things go well. + * The @a remote_sap is the address that we are trying to connect + * with. The are the parameters needed for either socket + * or XTI/ATM connections. The @a timeout is the amount of time to + * wait to connect. If it's 0 then we block indefinitely. If + * *timeout == {0, 0} then the connection is done using non-blocking + * mode. In this case, if the connection can't be made immediately + * the value of -1 is returned with @c errno == EWOULDBLOCK. If + * *timeout > {0, 0} then this is the maximum amount of time to wait before + * timing out. If the time expires before the connection is made + * @c errno == ETIME. The @a local_sap is the value of local address + * to bind to. If it's the default value of then + * the user is letting the OS do the binding. If @a reuse_addr == 1 + * then the is reused, even if it hasn't been cleanedup yet. + */ + ACE_ATM_Connector (ACE_ATM_Stream &new_stream, + const ACE_ATM_Addr &remote_sap, + ACE_ATM_Params params = ACE_ATM_Params(), + ACE_ATM_QoS options = ACE_ATM_QoS(), + ACE_Time_Value *timeout = 0, + const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", 0 ), + int reuse_addr = 0, +#if defined (ACE_WIN32) + int flags = 0, +#else + int flags = O_RDWR, +#endif /* ACE_WIN32 */ + int perms = 0); + + /** + * Actively connect and produce a @a new_stream if things go well. + * The @a remote_sap is the address that we are trying to connect + * with. The are the parameters needed for either socket + * or XTI/ATM connections. The @a timeout is the amount of time to + * wait to connect. If it's 0 then we block indefinitely. If + * *timeout == {0, 0} then the connection is done using non-blocking + * mode. In this case, if the connection can't be made immediately + * the value of -1 is returned with @c errno == EWOULDBLOCK. If + * *timeout > {0, 0} then this is the maximum amount of time to wait before + * timing out. If the time expires before the connection is made + * @c errno == ETIME. The @a local_sap is the value of local address + * to bind to. If it's the default value of then + * the user is letting the OS do the binding. If @a reuse_addr == 1 + * then the is reused, even if it hasn't been cleanedup yet. + */ + int connect (ACE_ATM_Stream &new_stream, + const ACE_ATM_Addr &remote_sap, + ACE_ATM_Params params = ACE_ATM_Params(), + ACE_ATM_QoS options = ACE_ATM_QoS(), + ACE_Time_Value *timeout = 0, + const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", + 0 ), + int reuse_addr = 0, +#if defined (ACE_WIN32) + int flags = 0, +#else + int flags = O_RDWR, +#endif /* ACE_WIN32 */ + int perms = 0); + + /** + * Try to complete a non-blocking connection. + * If connection completion is successful then @a new_stream contains + * the connected ACE_SOCK_Stream. If @a remote_sap is non-NULL then it + * will contain the address of the connected peer. + */ + int complete (ACE_ATM_Stream &new_stream, + ACE_ATM_Addr *remote_sap, + ACE_Time_Value *tv); + + /** + * Actively add a leaf to the root (i.e., point-to-multipoint). The + * @a remote_sap is the address of the leaf that we + * are trying to add. + */ + int add_leaf (ACE_ATM_Stream ¤t_stream, + const ACE_Addr &remote_sap, + ACE_ATM_QoS &qos); + + /// Resets any event associations on this handle + bool reset_new_handle (ACE_HANDLE handle); + + // = Meta-type info + typedef ACE_ATM_Addr PEER_ADDR; + typedef ACE_ATM_Stream PEER_STREAM; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + ATM_Connector connector_; +}; + +// Open versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/ATM_Connector.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_ATM */ +#include /**/ "ace/post.h" +#endif /* ACE_ATM_CONNECTOR_H */ diff --git a/externals/ace/ATM_Connector.inl b/externals/ace/ATM_Connector.inl new file mode 100644 index 0000000..10d1623 --- /dev/null +++ b/externals/ace/ATM_Connector.inl @@ -0,0 +1,132 @@ +// -*- C++ -*- +// +// $Id: ATM_Connector.inl 84565 2009-02-23 08:20:39Z johnnyw $ + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void +ACE_ATM_Connector::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ATM_Connector::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_INLINE +ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, + const ACE_ATM_Addr &remote_sap, + ACE_ATM_Params params, + ACE_ATM_QoS options, + ACE_Time_Value *timeout, + const ACE_ATM_Addr &local_sap, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector"); + if ((ACE_HANDLE)this->connect (new_stream, + remote_sap, + params, + options, + timeout, + local_sap, + reuse_addr, + flags, + perms) == ACE_INVALID_HANDLE + && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream"))); +} + +// Try to complete a non-blocking connection. + +ACE_INLINE +int +ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream, + ACE_ATM_Addr *remote_sap, + ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_ATM_Connector::complete"); +#if defined (ACE_HAS_ATM) + return connector_.complete(new_stream.get_stream(), + remote_sap, + tv); +#else + ACE_UNUSED_ARG(new_stream); + ACE_UNUSED_ARG(remote_sap); + ACE_UNUSED_ARG(tv); + return 0; +#endif +} + +ACE_INLINE +int +ACE_ATM_Connector::add_leaf (ACE_ATM_Stream ¤t_stream, + const ACE_Addr &remote_sap, + ACE_ATM_QoS &qos) +{ + ACE_TRACE ("ACE_ATM_Connector::add_leaf"); +#if defined (ACE_HAS_FORE_ATM_XTI) + return connector_.add_leaf(current_stream.get_stream(), + remote_sap, + leaf_id, + timeout); +#elif defined (ACE_HAS_FORE_ATM_WS2) + struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr(); + ACE_QoS cqos = qos.get_qos(); + int addr_len = sizeof( struct sockaddr_atm ); + + ACE_QoS_Params qos_params(0, + 0, + &cqos, + 0, + (JL_SENDER_ONLY)); + + ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" ); + + ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(), + (struct sockaddr *)saddr, + addr_len, + qos_params); + + if ( result == ACE_INVALID_HANDLE ) + ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n", + ::WSAGetLastError()); + + return (result != ACE_INVALID_HANDLE); +#elif defined (ACE_HAS_LINUX_ATM) + ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux\n"); + + ACE_UNUSED_ARG(current_stream); + ACE_UNUSED_ARG(remote_sap); + ACE_UNUSED_ARG(leaf_id); + ACE_UNUSED_ARG(timeout); + + return 0; +#else + ACE_UNUSED_ARG(current_stream); + ACE_UNUSED_ARG(remote_sap); + ACE_UNUSED_ARG(leaf_id); + ACE_UNUSED_ARG(timeout); + return 0; +#endif +} + +ACE_INLINE +bool +ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle) +{ +#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) + // Reset the event association + return ::WSAEventSelect ((SOCKET) handle, + 0, + 0); +#else /* !defined ACE_HAS_WINSOCK2 */ + ACE_UNUSED_ARG (handle); + return false; +#endif /* ACE_WIN32 */ +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ATM_Params.cpp b/externals/ace/ATM_Params.cpp new file mode 100644 index 0000000..70a05f1 --- /dev/null +++ b/externals/ace/ATM_Params.cpp @@ -0,0 +1,20 @@ +// $Id: ATM_Params.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ATM_Params.h" + +#if defined (ACE_HAS_ATM) + +ACE_RCSID(ace, ATM_Params, "$Id: ATM_Params.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if !defined (__ACE_INLINE__) +#include "ace/ATM_Params.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Params) + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_ATM */ + diff --git a/externals/ace/ATM_Params.h b/externals/ace/ATM_Params.h new file mode 100644 index 0000000..d1e8c92 --- /dev/null +++ b/externals/ace/ATM_Params.h @@ -0,0 +1,214 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file ATM_Params.h + * + * $Id: ATM_Params.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Joe Hoffert + */ +//========================================================================== + + +#ifndef ACE_ATM_PARAMS_H +#define ACE_ATM_PARAMS_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_ATM) + +#include /**/ "ace/ACE_export.h" + +#if defined (ACE_HAS_FORE_ATM_XTI) +#include "ace/TLI.h" +#define ATM_PROTOCOL_DEFAULT 0 +typedef struct t_info Param_Info; +typedef struct netbuf Param_Udata; +#elif defined (ACE_HAS_FORE_ATM_WS2) +#include "ace/SOCK.h" +#define ATM_PROTOCOL_DEFAULT ATMPROTO_AAL5 +#define ACE_XTI_ATM_DEVICE "" +typedef int Param_Info; +typedef int Param_Udata; +#elif defined (ACE_HAS_LINUX_ATM) +#include /**/ "atm.h" +#define AF_ATM PF_ATMSVC +#define ACE_XTI_ATM_DEVICE "" +#define ATM_PROTOCOL_DEFAULT ATM_AAL5 +typedef int Param_Info; +typedef int Param_Udata; +#else +#define ACE_XTI_ATM_DEVICE "" +typedef int Param_Info; +typedef int Param_Udata; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_ATM_Params + * + * @brief Wrapper class that simplifies the information passed to the ATM + * enabled ACE_ATM_Connector class. + */ +class ACE_Export ACE_ATM_Params +{ +public: + /** + * Initialize the data members. This class combines options from + * ACE_SOCK_Connector (@a protocol_family, @a protocol, , + * @a protocol_info, , and @a flags) and + * ACE_TLI_Connector (, , , , and ) + * so that either mechanism can be used transparently for ATM. + */ + ACE_ATM_Params (int rw_flag = 1, + const char device[] = ACE_XTI_ATM_DEVICE, + Param_Info *info = 0, + Param_Udata *udata = 0, + int oflag = O_RDWR, + int protocol_family = AF_ATM, + int protocol = ATM_PROTOCOL_DEFAULT, + int type = +#if defined (ACE_HAS_LINUX_ATM) + SOCK_DGRAM, +#else + SOCK_RAW, +#endif /* ACE_HAS_LINUX_ATM */ + ACE_Protocol_Info *protocol_info = 0, + ACE_SOCK_GROUP g = 0, + u_long flags + = ACE_FLAG_MULTIPOINT_C_ROOT + | ACE_FLAG_MULTIPOINT_D_ROOT, // connector by default + int reuse_addr = 0); + + /// Destructor. + ~ACE_ATM_Params (); + + /// Get protocol family. + int get_protocol_family (void) const; + + /// Set protocol family. + void set_protocol_family (int); + + /// Get protocol. + int get_protocol (void) const; + + /// Set protocol. + void set_protocol (int); + + /// Get type. + int get_type (void) const; + + /// Set type. + void set_type (int); + + /// Get protocol info. + ACE_Protocol_Info *get_protocol_info( void ); + + /// Set protocol info. + void set_protocol_info( ACE_Protocol_Info *); + + /// Get socket group. + ACE_SOCK_GROUP get_sock_group( void ); + + /// Set socket group. + void set_sock_group( ACE_SOCK_GROUP ); + + /// Get socket flags. + u_long get_flags( void ); + + /// Set socket flags. + void set_flags( u_long ); + + /// Get reuse_addr flag. + int get_reuse_addr (void) const; + + /// Set reuse_addr flag. + void set_reuse_addr (int); + + /// Get device. + const char* get_device (void) const; + + /// Get info. + Param_Info* get_info (void) const; + + /// Set info. + void set_info (Param_Info *); + + /// Get r/w flag. + int get_rw_flag (void) const; + + /// Set r/w flag. + void set_rw_flag (int); + + /// Get user data. + Param_Udata* get_user_data (void) const; + + /// Set user data. + void set_user_data (Param_Udata*); + + /// Get open flag. + int get_oflag (void) const; + + /// Set open flag. + void set_oflag (int); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Protocol family for sockets connections. + int protocol_family_; + + /// Protocol for sockets connections. + int protocol_; + + /// Type for opening sockets. + int type_; + + /// Information about the protocol. + ACE_Protocol_Info *protocol_info_; + + /// Socket group used (for sockets only). + ACE_SOCK_GROUP group_; + + /// Flags for sockets (for sockets only). + u_long flags_; + + /// Flag for reusing address for opening sockets. + int reuse_addr_; + + /// Device name for XTI/ATM connections. + const char *device_; + + /// Info for XTI/ATM connections. + Param_Info *info_; + + /// R/W flag for XTI/ATM connections. + int rw_flag_; + + /// User data for XTI/ATM connections. + Param_Udata *udata_; + + /// Open flag for XTI/ATM connections. + int oflag_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/ATM_Params.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_ATM */ +#include /**/ "ace/post.h" +#endif /* ACE_ATM_PARAMS_H */ diff --git a/externals/ace/ATM_Params.inl b/externals/ace/ATM_Params.inl new file mode 100644 index 0000000..de2a4d4 --- /dev/null +++ b/externals/ace/ATM_Params.inl @@ -0,0 +1,235 @@ +// -*- C++ -*- +// +// $Id: ATM_Params.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void +ACE_ATM_Params::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ATM_Params::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_INLINE +ACE_ATM_Params::ACE_ATM_Params (int rw_flag, + const char device[], + Param_Info *info, + Param_Udata *udata, + int oflag, + int protocol_family, + int protocol, + int type, + ACE_Protocol_Info *protocol_info, + ACE_SOCK_GROUP g, + u_long flags, + int reuse_addr) + : protocol_family_(protocol_family), + protocol_(protocol), + type_(type), + protocol_info_(protocol_info), + group_(g), + flags_(flags), + reuse_addr_(reuse_addr), + device_(device), + info_(info), + rw_flag_(rw_flag), + udata_(udata), + oflag_(oflag) +{ + ACE_TRACE ("ACE_ATM_Params::ACE_ATM_Params"); +} + +// Default dtor. +ACE_INLINE +ACE_ATM_Params::~ACE_ATM_Params (void) +{ + ACE_TRACE ("ACE_ATM_Params::~ACE_ATM_Params"); +} + +ACE_INLINE +int +ACE_ATM_Params::get_protocol_family (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_protocol_family"); + return protocol_family_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_protocol_family (int family) +{ + ACE_TRACE ("ACE_ATM_Params::set_protocol_family"); + protocol_family_ = family; +} + +ACE_INLINE +int +ACE_ATM_Params::get_protocol (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_protocol"); + return protocol_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_protocol (int protocol) +{ + ACE_TRACE ("ACE_ATM_Params::set_protocol"); + protocol_ = protocol; +} + +ACE_INLINE +int +ACE_ATM_Params::get_type (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_type"); + return type_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_type (int type) +{ + ACE_TRACE ("ACE_ATM_Params::set_type"); + type_ = type; +} + +ACE_INLINE +ACE_Protocol_Info* +ACE_ATM_Params::get_protocol_info( void ) +{ + ACE_TRACE ("ACE_ATM_Params::get_protocol_info"); + return protocol_info_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info ) +{ + ACE_TRACE ("ACE_ATM_Params::set_protocol_info"); + protocol_info_ = protocol_info; +} + +ACE_INLINE +ACE_SOCK_GROUP +ACE_ATM_Params::get_sock_group( void ) +{ + ACE_TRACE ("ACE_ATM_Params::get_sock_group"); + return group_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g ) +{ + ACE_TRACE ("ACE_ATM_Params::set_sock_group"); + group_ = g; +} + +ACE_INLINE +u_long +ACE_ATM_Params::get_flags( void ) +{ + ACE_TRACE ("ACE_ATM_Params::get_flags"); + return flags_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_flags( u_long flags) +{ + ACE_TRACE ("ACE_ATM_Params::set_flags"); + flags_ = flags; +} + +ACE_INLINE +int +ACE_ATM_Params::get_reuse_addr (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_reuse_addr"); + return reuse_addr_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_reuse_addr (int reuse_addr) +{ + ACE_TRACE ("ACE_ATM_Params::set_reuse_addr"); + reuse_addr_ = reuse_addr; +} + +ACE_INLINE +const char* +ACE_ATM_Params::get_device (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_device"); + return device_; +} + +ACE_INLINE +Param_Info* +ACE_ATM_Params::get_info (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_info"); + return info_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_info (Param_Info* info) +{ + ACE_TRACE ("ACE_ATM_Params::set_info"); + info_ = info; +} + +ACE_INLINE +int +ACE_ATM_Params::get_rw_flag (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_rw_flag"); + return rw_flag_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_rw_flag (int rw_flag) +{ + ACE_TRACE ("ACE_ATM_Params::set_rw_flag"); + rw_flag_ = rw_flag; +} + +ACE_INLINE +Param_Udata* +ACE_ATM_Params::get_user_data (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_user_data"); + return udata_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_user_data (Param_Udata *udata) +{ + ACE_TRACE ("ACE_ATM_Params::set_user_data"); + udata_ = udata; +} + +ACE_INLINE +int +ACE_ATM_Params::get_oflag (void) const +{ + ACE_TRACE ("ACE_ATM_Params::get_oflag"); + return oflag_; +} + +ACE_INLINE +void +ACE_ATM_Params::set_oflag (int oflag) +{ + ACE_TRACE ("ACE_ATM_Params::set_oflag"); + oflag_ = oflag; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ATM_QoS.cpp b/externals/ace/ATM_QoS.cpp new file mode 100644 index 0000000..5f83d3a --- /dev/null +++ b/externals/ace/ATM_QoS.cpp @@ -0,0 +1,631 @@ +// $Id: ATM_QoS.cpp 84262 2009-01-29 10:34:33Z johnnyw $ + +#include "ace/ATM_QoS.h" + +ACE_RCSID(ace, ATM_QoS, "$Id: ATM_QoS.cpp 84262 2009-01-29 10:34:33Z johnnyw $") + +#if defined (ACE_HAS_ATM) + +#if !defined (__ACE_INLINE__) +#include "ace/ATM_QoS.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) +#define BHLI_MAGIC "FORE_ATM" +// This is line rate in cells/s for an OC-3 MM interface. +const long ACE_ATM_QoS::LINE_RATE = 353207; +const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0x1; +const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0x2; +const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x99; +const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 8192; +#elif defined (ACE_HAS_LINUX_ATM) +//pbrandao:for Linux: +//pbrandao:for now stick with current definitions +//pbrandao:see if later need to change +const long ACE_ATM_QoS::LINE_RATE = 353207; +const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0x1; +const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0x2; +const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x99; +const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 8192; +#else +const long ACE_ATM_QoS::LINE_RATE = 0L; +const int ACE_ATM_QoS::OPT_FLAGS_CPID = 0; +const int ACE_ATM_QoS::OPT_FLAGS_PMP = 0; +const int ACE_ATM_QoS::DEFAULT_SELECTOR = 0x0; +const int ACE_ATM_QoS::DEFAULT_PKT_SIZE = 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ + +ACE_ALLOC_HOOK_DEFINE(ACE_ATM_QoS) + +ACE_ATM_QoS::ACE_ATM_QoS (int pktSize) +{ + ACE_TRACE ("ACE_ATM_QoS::ACE_ATM_QoS"); +#if defined (ACE_HAS_LINUX_ATM) + ACE_OS::memset(&qos_, 0, sizeof(qos_)); + qos_.aal = ATM_PROTOCOL_DEFAULT; + qos_.rxtp.traffic_class = ATM_ANYCLASS; + qos_.rxtp.max_sdu = pktSize; + qos_.txtp.traffic_class = ATM_ANYCLASS; + qos_.txtp.max_sdu = pktSize; +#else + ACE_UNUSED_ARG (pktSize); +#endif /* ACE_HAS_LINUX_ATM */ +} + +ACE_ATM_QoS::ACE_ATM_QoS(int rate, + int pktSize) +{ + ACE_TRACE( "ACE_ATM_QoS::ACE_ATM_QoS" ); +#if defined (ACE_HAS_FORE_ATM_WS2) + AAL_PARAMETERS_IE ie_aalparams; + ATM_TRAFFIC_DESCRIPTOR_IE ie_td; + ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc; + ATM_QOS_CLASS_IE ie_qos; + Q2931_IE *ie_ptr; + int size; + + // Setting up cbr parameters ... + ie_aalparams.AALType = AALTYPE_5; + ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize + = pktSize; // was 1516; + ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize + = pktSize; // was 1516; + ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE; + ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL; + + size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE); + + ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.PeakCellRate_CLP01 = rate; + ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; + ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; + ie_td.Forward.Tagging = SAP_FIELD_ABSENT; + + ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.PeakCellRate_CLP01 = rate; + ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; + ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; + ie_td.Backward.Tagging = SAP_FIELD_ABSENT; + + ie_td.BestEffort = 0; // Note: this must be set to zero for CBR. + + size += sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); + + ie_bbc.BearerClass = BCOB_X; + ie_bbc.TrafficType = TT_CBR; + ie_bbc.TimingRequirements = TR_END_TO_END; + ie_bbc.ClippingSusceptability = CLIP_NOT; + ie_bbc.UserPlaneConnectionConfig = UP_P2P; + + size += sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); + + ie_qos.QOSClassForward = QOS_CLASS1; + ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used + // since we do only simplex data xfer. + + size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); + + qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size); + if (qos_.ProviderSpecific.buf == 0) { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"), + size)); + return; + } + qos_.ProviderSpecific.len = size; + ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size); + + ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf; + ie_ptr->IEType = IE_AALParameters; + ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( AAL_PARAMETERS_IE ); + ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_TrafficDescriptor; + ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); + ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_BroadbandBearerCapability; + ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); + ACE_OS::memcpy(ie_ptr->IE, + &ie_bbc, + sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_QOSClass; + ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_QOS_CLASS_IE ); + ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); + + // qos_.SendingFlowspec.TokenRate = 0xffffffff; + // qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; + // qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; + // qos_.SendingFlowspec.Latency = 0xffffffff; + // qos_.SendingFlowspec.DelayVariation = 0xffffffff; + // qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; + // This will most probably be ignored by the service provider. + // qos_.SendingFlowspec.MaxSduSize = 0xffffffff; + // qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; + + // qos_.ReceivingFlowspec.TokenRate = 0xffffffff; + // qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; + // qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; + // qos_.ReceivingFlowspec.Latency = 0xffffffff; + // qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; + // qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; + // This will most probably be ignored by the service provider. + // qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; + // qos_.ReceivingFlowspec.MinimumPolicedSize = 0; + + ACE_Flow_Spec send_fspec( 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + SERVICETYPE_BESTEFFORT, + // This will most probably ignored by SP. + 0xffffffff, + 0xffffffff, + 15, + ACE_DEFAULT_THREAD_PRIORITY ), + recv_fspec( 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + SERVICETYPE_BESTEFFORT, + // This will most probably ignored by SP. + 0xffffffff, + 0, + 15, + ACE_DEFAULT_THREAD_PRIORITY ); + + qos_.sending_flowspec (send_fspec); + qos_.receiving_flowspec (recv_fspec); +#elif defined (ACE_HAS_FORE_ATM_XTI) + ACE_UNUSED_ARG (rate); + ACE_UNUSED_ARG (pktSize); +#elif defined (ACE_HAS_LINUX_ATM) + ACE_OS::memset(&qos_, + 0, + sizeof(qos_)); + qos_.aal = ATM_PROTOCOL_DEFAULT; + qos_.rxtp.max_sdu = pktSize; + + if (rate > 0) { + qos_.rxtp.pcr = rate; + qos_.rxtp.traffic_class = ATM_CBR; + qos_.txtp.traffic_class = ATM_CBR; + qos_.txtp.pcr = rate; + } + else { + qos_.rxtp.traffic_class = ATM_UBR; + qos_.txtp.traffic_class = ATM_UBR; + } + + qos_.txtp.max_sdu = pktSize; +#else + ACE_UNUSED_ARG (rate); +#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ +} + +void +ACE_ATM_QoS::set_cbr_rate (int rate, + int pktSize) +{ + ACE_TRACE ("ACE_ATM_QoS::set_cbr_rate"); +#if defined (ACE_HAS_FORE_ATM_WS2) + /* + AAL_PARAMETERS_IE ie_aalparams; + ATM_TRAFFIC_DESCRIPTOR_IE ie_td; + ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc; + ATM_QOS_CLASS_IE ie_qos; + Q2931_IE *ie_ptr; + int size; + */ + + ACE_OS::printf( "ATM_QoS(set_cbr_rate): set rate to %d c/s\n", rate ); + + // Setting up cbr parameters ... + /* + FORE has changed this - we no longer specify QoS this way + ie_aalparams.AALType = AALTYPE_5; + ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize + = pktSize; // was 1516; + ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize + = pktSize; // was 1516; + ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE; + ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL; + + size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE); + + ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.PeakCellRate_CLP01 = rate; + ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; + ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; + ie_td.Forward.Tagging = SAP_FIELD_ABSENT; + + ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.PeakCellRate_CLP01 = rate; + ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; + ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; + ie_td.Backward.Tagging = SAP_FIELD_ABSENT; + + ie_td.BestEffort = 0; // Note: this must be set to zero for CBR. + + size += sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); + + ie_bbc.BearerClass = BCOB_X; + ie_bbc.TrafficType = TT_CBR; + ie_bbc.TimingRequirements = TR_END_TO_END; + ie_bbc.ClippingSusceptability = CLIP_NOT; + ie_bbc.UserPlaneConnectionConfig = UP_P2P; + + size += sizeof(Q2931_IE_TYPE) + + sizeof(ULONG) + + sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE); + + ie_qos.QOSClassForward = QOS_CLASS1; + ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used + // since we only simplex data xfer. + + size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); + + qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size); + if (qos_.ProviderSpecific.buf == 0) { + ACE_ERROR((LM_ERROR, + ACE_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"), + size)); + return; + } + qos_.ProviderSpecific.len = size; + ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size); + + ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf; + ie_ptr->IEType = IE_AALParameters; + ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( AAL_PARAMETERS_IE ); + ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_TrafficDescriptor; + ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE ); + ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_BroadbandBearerCapability; + ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) + + sizeof( ULONG ) + + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ); + ACE_OS::memcpy( ie_ptr->IE, + &ie_bbc, + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE )); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_QOSClass; + ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + + sizeof(ATM_QOS_CLASS_IE); + ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); + */ + + const int BYTES_PER_ATM_CELL = 53; + ACE_OS::memset(&qos_, 0, sizeof(ATM_QoS)); + // Setting the token rate sets the minimum rate. 3 Mbits/sec seems too high. + // Certainly for Vaudeville audio, we only need about 1000 c/s which is + // 424000 bits/sec which is 53000 bytes/sec. + //qos_.SendingFlowspec.TokenRate = 3*(1024*128); // 3Mbits/sec + qos_.SendingFlowspec.TokenRate = 53000; // 1000 cells/sec + qos_.SendingFlowspec.TokenBucketSize = 32*1024; // our block size + //ourQos.SendingFlowspec.PeakBandwidth = ourQos.SendingFlowspec.TokenRate; + qos_.SendingFlowspec.ServiceType = SERVICETYPE_GUARANTEED; + // Peak bandwidth is in bytes/sec. The rate is specified in cells/sec so + // we need to convert from cells/sec to bytes/sec (i.e., multiply by 53). + qos_.SendingFlowspec.PeakBandwidth = rate * BYTES_PER_ATM_CELL; + qos_.SendingFlowspec.Latency = -1; // we don't care too much + qos_.SendingFlowspec.DelayVariation = -1; // we don't care too much + // no provider-specific data allowed on ATM + qos_.ProviderSpecific.buf=0; + qos_.ProviderSpecific.len=0; + // unidirectional P2MP; we don't need to setup the Receiving flowspec + + //qos_.SendingFlowspec.TokenRate = 0xffffffff; + //qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; + //qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; + //qos_.SendingFlowspec.Latency = 0xffffffff; + //qos_.SendingFlowspec.DelayVariation = 0xffffffff; + //qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; + // This will most probably be ignored by the service provider. + //qos_.SendingFlowspec.MaxSduSize = 0xffffffff; + //qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; + + //qos_.ReceivingFlowspec.TokenRate = 0xffffffff; + //qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; + //qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; + //qos_.ReceivingFlowspec.Latency = 0xffffffff; + //qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; + //qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; + // This will most probably be ignored by the service provider. + //qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; + //qos_.ReceivingFlowspec.MinimumPolicedSize = 0; + + /* + ACE_Flow_Spec send_fspec( 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + SERVICETYPE_BESTEFFORT, + // This will most probably ignored by SP. + 0xffffffff, + 0xffffffff, + 15, + ACE_DEFAULT_THREAD_PRIORITY ), + recv_fspec( 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff, + SERVICETYPE_BESTEFFORT, + // This will most probably ignored by SP. + 0xffffffff, + 0, + 15, + ACE_DEFAULT_THREAD_PRIORITY ); + + qos_.sending_flowspec( send_fspec ); + qos_.receiving_flowspec( recv_fspec ); + */ +#elif defined (ACE_HAS_FORE_ATM_XTI) + ACE_UNUSED_ARG (rate); + ACE_UNUSED_ARG (pktSize); +#elif defined (ACE_HAS_LINUX_ATM) + ACE_UNUSED_ARG (pktSize); + + qos_.rxtp.traffic_class = ATM_CBR; + qos_.rxtp.pcr = rate; + qos_.txtp.traffic_class = ATM_CBR; + qos_.txtp.pcr = rate; +#else + ACE_UNUSED_ARG (rate); +#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ +} + +void +ACE_ATM_QoS::set_rate (ACE_HANDLE fd, + int rate, + int flags) +{ + ACE_TRACE ("ACE_ATM_QoS::set_rate"); +#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) + set_cbr_rate( rate ); + + ACE_UNUSED_ARG( fd ); + ACE_UNUSED_ARG( flags ); +#elif defined (ACE_HAS_FORE_ATM_XTI) + long optlen = 0; + qos_.buf = construct_options(fd, + rate, + flags, + &optlen); + qos_.len = optlen; +#else + ACE_UNUSED_ARG (rate); +#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM || ACE_HAS_FORE_ATM_XTI */ +} + +char* +ACE_ATM_QoS::construct_options (ACE_HANDLE fd, + int rate, + int flags, + long *len) +{ +#if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) + ACE_UNUSED_ARG (fd); + ACE_UNUSED_ARG (rate); + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (len); + return 0; +#elif defined (ACE_HAS_FORE_ATM_XTI) + struct t_opthdr *popt; + char *buf; + int qos_cells; + struct t_info info; + + if (ACE_OS::t_getinfo (fd, &info) == -1) + { + ACE_OS::t_error ("t_getinfo"); + return 0; + } + + buf = (char *) ACE_OS::malloc (info.options); + + if (buf == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Unable to allocate %d bytes for options\n"), + info.options), + 0); + + popt = (struct t_opthdr *) buf; + + if (flags & OPT_FLAGS_CPID) + { + // This constructs the T_ATM_ORIG_ADDR option, which is used to + // signal the UNI 3.1 Calling Party ID Information Element. + t_atm_addr *source_addr; + + popt->len = sizeof (struct t_opthdr) + sizeof (t_atm_addr); + popt->level = T_ATM_SIGNALING; + popt->name = T_ATM_ORIG_ADDR; + popt->status = 0; + + source_addr = + (t_atm_addr *)((char *) popt + sizeof (struct t_opthdr)); + + source_addr->address_format = T_ATM_ENDSYS_ADDR; + source_addr->address_length = ATMNSAP_ADDR_LEN; + + ATMSAPAddress local_addr; + struct t_bind boundaddr; + + boundaddr.addr.maxlen = sizeof(local_addr); + boundaddr.addr.buf = (char *) &local_addr; + + //if (ACE_OS::t_getprotaddr(fd, &boundaddr, 0) < 0) { + if (ACE_OS::t_getname(fd, + &boundaddr.addr, + LOCALNAME) < 0) + { + ACE_OS::t_error("t_getname (local_address)"); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Can't get local address!\n"))); + ACE_OS::free (buf); + return 0; + } + + ACE_OS::memcpy(source_addr->address, + local_addr.sap.t_atm_sap_addr.address, + ATMNSAP_ADDR_LEN); + + popt = T_OPT_NEXTHDR (buf, info.options , popt); + } + + // This constructs all options necessary (bearer cap., QoS, and + // Traffic Descriptor) to signal for a CBR connection with the + // specified QoS in kbit/sec., and/or specify a PMP connection. + + // For FORE 200e cards, the adapter shapes traffic to CBR with rate + // equal to PCR CLP=0+1 (traffic.forward.PCR_all_traffic) + + qos_cells = (rate * 1000) / (48*8); + + if ((qos_cells > 0 && qos_cells < LINE_RATE) + || (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP))) + { + struct t_atm_bearer *bearer; + struct t_atm_traffic *traffic; + + // T_ATM_BEARER_CAP: Broadband bearer capability + popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_bearer); + popt->level = T_ATM_SIGNALING; + popt->name = T_ATM_BEARER_CAP; + popt->status = 0; + + bearer = (struct t_atm_bearer *)((char *) popt + + sizeof (struct t_opthdr)); + bearer->bearer_class = T_ATM_CLASS_X; + + if (qos_cells) + { + bearer->traffic_type = T_ATM_CBR; + bearer->timing_requirements = T_ATM_END_TO_END; + } + else + { + bearer->traffic_type = 0; // UBR + bearer->timing_requirements = 0; + } + bearer->clipping_susceptibility = T_ATM_NULL; + + if (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)) + bearer->connection_configuration = T_ATM_1_TO_MANY; + else + bearer->connection_configuration = T_ATM_1_TO_1; + + popt = T_OPT_NEXTHDR (buf, info.options, popt); + + // T_ATM_TRAFFIC: traffic descriptor + popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_traffic); + popt->level = T_ATM_SIGNALING; + popt->name = T_ATM_TRAFFIC; + popt->status = 0; + + traffic = (struct t_atm_traffic *)((char *) popt + + sizeof (struct t_opthdr)); + + traffic->forward.PCR_high_priority = T_ATM_ABSENT; + traffic->forward.PCR_all_traffic = qos_cells ? qos_cells : LINE_RATE; + traffic->forward.SCR_high_priority = T_ATM_ABSENT; + traffic->forward.SCR_all_traffic = T_ATM_ABSENT; + traffic->forward.MBS_high_priority = T_ATM_ABSENT; + traffic->forward.MBS_all_traffic = T_ATM_ABSENT; + traffic->forward.tagging = T_NO; + + traffic->backward.PCR_high_priority = T_ATM_ABSENT; + traffic->backward.PCR_all_traffic = + (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)) + ? 0 : qos_cells ? qos_cells : LINE_RATE; + traffic->backward.SCR_high_priority = T_ATM_ABSENT; + traffic->backward.SCR_all_traffic = T_ATM_ABSENT; + traffic->backward.MBS_high_priority = T_ATM_ABSENT; + traffic->backward.MBS_all_traffic = T_ATM_ABSENT; + traffic->backward.tagging = T_NO; + + traffic->best_effort = qos_cells ? T_NO : T_YES; + + popt = T_OPT_NEXTHDR (buf, + info.options, + popt); + } + + if (qos_cells > 0 && qos_cells < LINE_RATE) + { + struct t_atm_qos *qos; + + // T_ATM_QOS: Quality of Service + popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_qos); + popt->level = T_ATM_SIGNALING; + popt->name = T_ATM_QOS; + popt->status = 0; + + qos = (struct t_atm_qos *)((char *) popt + sizeof (struct t_opthdr)); + qos->coding_standard = T_ATM_ITU_CODING; + qos->forward.qos_class = T_ATM_QOS_CLASS_1; + qos->backward.qos_class = T_ATM_QOS_CLASS_1; + + popt = T_OPT_NEXTHDR (buf, info.options, popt); + } + + // Return actual size of options and option buffer to user. + *len = (char *) popt - buf; + + return buf; +#else + ACE_UNUSED_ARG (fd); + ACE_UNUSED_ARG (rate); + ACE_UNUSED_ARG (flag); + ACE_UNUSED_ARG (len); + return 0; +#endif /* ACE_HAS_FORE_ATM_WS2 */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_ATM */ + diff --git a/externals/ace/ATM_QoS.h b/externals/ace/ATM_QoS.h new file mode 100644 index 0000000..4e35f3f --- /dev/null +++ b/externals/ace/ATM_QoS.h @@ -0,0 +1,115 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file ATM_QoS.h + * + * $Id: ATM_QoS.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Joe Hoffert + */ +//========================================================================== + + +#ifndef ACE_ATM_QoS_H +#define ACE_ATM_QoS_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined(ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_ATM) + +#if defined (ACE_HAS_FORE_ATM_WS2) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +// just map to WS2 GQOS struct +typedef ACE_QoS ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL +#elif defined (ACE_HAS_FORE_ATM_XTI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef struct netbuf ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL +#elif defined (ACE_HAS_LINUX_ATM) +#include /**/ "atm.h" +#include "ace/ATM_Params.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef struct atm_qos ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL +#else +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef int ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_ATM_QoS + * + * @brief Define the QoS parameters for ATM + * + * This class wraps up QoS parameters for both ATM/XTI and + * ATM/WinSock2 to make the mechanism for the ATM protocol + * transparent. + */ +class ACE_Export ACE_ATM_QoS +{ +public: + // Constants used for ATM options + static const long LINE_RATE; + static const int OPT_FLAGS_CPID; + static const int OPT_FLAGS_PMP; + static const int DEFAULT_SELECTOR; + static const int DEFAULT_PKT_SIZE; + + // = Initializattion and termination methods. + /// Default constructor. + ACE_ATM_QoS(int = DEFAULT_PKT_SIZE); + + /// Constructor with a CBR rate. + ACE_ATM_QoS(int, + int = DEFAULT_PKT_SIZE); + + ~ACE_ATM_QoS (); + + /// Set the rate. + void set_rate (ACE_HANDLE, + int, + int); + + /// Set CBR rate in cells per second. + void set_cbr_rate (int, + int = DEFAULT_PKT_SIZE); + + /// Get ATM_QoS struct. + ATM_QoS get_qos (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Construct QoS options. + char* construct_options(ACE_HANDLE, + int, + int, + long*); + +private: + ATM_QoS qos_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/ATM_QoS.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_ATM */ +#include /**/ "ace/post.h" +#endif /* ACE_ATM_QoS_H */ diff --git a/externals/ace/ATM_QoS.inl b/externals/ace/ATM_QoS.inl new file mode 100644 index 0000000..52b5211 --- /dev/null +++ b/externals/ace/ATM_QoS.inl @@ -0,0 +1,29 @@ +// -*- C++ -*- +// +// $Id: ATM_QoS.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void +ACE_ATM_QoS::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ATM_QoS::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_INLINE +ACE_ATM_QoS::~ACE_ATM_QoS () +{ + ACE_TRACE ("ACE_ATM_QoS::~ACE_ATM_QoS"); +} + +ACE_INLINE +ATM_QoS +ACE_ATM_QoS::get_qos (void) +{ + ACE_TRACE ("ACE_ATM_QoS::get_qos"); + return qos_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ATM_Stream.cpp b/externals/ace/ATM_Stream.cpp new file mode 100644 index 0000000..a9dc046 --- /dev/null +++ b/externals/ace/ATM_Stream.cpp @@ -0,0 +1,290 @@ +// $Id: ATM_Stream.cpp 84262 2009-01-29 10:34:33Z johnnyw $ + +#include "ace/ATM_Stream.h" + +ACE_RCSID (ace, ATM_Stream, "$Id: ATM_Stream.cpp 84262 2009-01-29 10:34:33Z johnnyw $") + +#if defined (ACE_HAS_ATM) + +#if !defined (__ACE_INLINE__) +#include "ace/ATM_Stream.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE (ACE_ATM_Stream) + +char* +ACE_ATM_Stream::get_peer_name (void) const +{ + ACE_TRACE ("ACE_ATM_Stream::get_peer_name"); +#if defined (ACE_HAS_FORE_ATM_XTI) + // // Use t_getprotaddr for XTI/ATM + // struct t_bind *localaddr + // = (struct t_bind *) ACE_OS::t_alloc (get_handle (), + // T_BIND, + // T_ADDR); + // struct t_bind *peeraddr + // = (struct t_bind *) ACE_OS::t_alloc (get_handle (), + // T_BIND, + // T_ADDR); + // ::t_getprotaddr (get_handle (), + // localaddr, + // peeraddr); + + // char* connected_name = (char*) ACE_OS::malloc (peeraddr->addr.len + 1); + // ACE_OS::strcpy (connected_name, + // peeraddr->addr.buf); + // ACE_OS::t_free ((char *) localaddr, + // T_BIND); + // ACE_OS::t_free ((char *) peeraddr, + // T_BIND); + // return (connected_name); + +#error "This doesn't seem to work. May need to jimmy-rig something with the" +#error "/etc/xti_hosts file - Ugh!" + + ACE_ATM_Addr sa; + struct netbuf name; + name.maxlen = sa.get_size (); + name.buf = (char *) sa.get_addr (); + ACE_OS::t_getname (this->get_handle (), &name, REMOTENAME); + // ACE_OS::ioctl (this->get_handle (), + // TI_GETPEERNAME, + // &name); + return (name.buf); + +#elif defined (ACE_HAS_FORE_ATM_WS2) + // Use getpeername for WinSock2. + struct sockaddr_atm name; + ACE_OS::memset (&name, 0, sizeof (name)); + int nameSize = sizeof (name); + + if (ACE_OS::getpeername (this->get_handle (), + (struct sockaddr *) &name, + &nameSize) != 0) { + return 0; + } + + char buffer[256]; + for (unsigned int index = 0; index < ATM_ADDR_SIZE - 1; index++) { + buffer[ index * 3 ] = '\0'; + ACE_OS::sprintf (buffer, "%s%02x.", buffer, name.satm_number.Addr[ index ]); + } + buffer[ (ATM_ADDR_SIZE - 1) * 3 ] = '\0'; + ACE_OS::sprintf (buffer, "%s%02x.", buffer, 0); + buffer[ ATM_ADDR_SIZE * 3 - 1 ] = '\0'; + for (index = 0; index < ACE_OS::strlen (buffer); ++index) + buffer[index] = ACE_OS::ace_tolower (buffer[index]); + + ifstream atm_hosts ("C:/WINNT/atmhosts"); + assert (atm_hosts.is_open ()); + + // Find the host address in the ATM hosts file and return the + // host name + char line[256]; + char *host_ptr, *host_name = 0; + ACE_NEW_RETURN (host_name, char[256], 0); + while (!atm_hosts.eof ()) { + atm_hosts.getline (line, 256); + // Convert the line to lower case to ease comparison + for (index = 0; index < ACE_OS::strlen (line); ++index) + line[index] = ACE_OS::ace_tolower (line[index]); + if (ACE_OS::strstr (line, buffer) != 0) + { + char *strtok_p; + // Grab the second token which is the host name + ACE_OS::strtok_r (line, " \t", &strtok_p); + host_ptr = ACE_OS::strtok (0, " \t", &strtok_p); + ACE_OS::strcpy (host_name, host_ptr); + break; + } + } + + return host_name; +#elif defined (ACE_HAS_LINUX_ATM) + ATM_Addr name; + int nameSize = sizeof (name.sockaddratmsvc); + + if (ACE_OS::getpeername (this->get_handle (), + (struct sockaddr *) & (name.sockaddratmsvc), + &nameSize) < 0) { + ACE_OS::perror ("ACE_ATM_Stream (get_peer_name) : "); + return 0; + } + + static ACE_TCHAR buffer[MAX_ATM_ADDR_LEN + 1]; + int total_len; + if ((total_len = atm2text (buffer,sizeof buffer, + (struct sockaddr *) & (name.sockaddratmsvc), + A2T_PRETTY|A2T_NAME)) < 0) { + ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("ACE_ATM_Stream (get_peer_name) :%d"),errno)); + return 0; + } + + return (char*) buffer; +#else + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +} + +ACE_HANDLE +ACE_ATM_Stream::get_handle (void) const +{ + ACE_TRACE ("ACE_ATM_Stream::get_handle"); +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) + return stream_.get_handle (); +#else + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +} + +int +ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi, + ACE_UINT16 &vci) const +{ + ACE_TRACE ("ACE_ATM_Stream::get_vpi_vci"); +#if defined (ACE_HAS_FORE_ATM_XTI) + struct t_atm_conn_prop conn_prop; + char* connect_opts = (char *) &conn_prop; + int opt_size = sizeof (t_atm_conn_prop); + struct t_info info; + struct t_optmgmt opt_req, opt_ret; + + if (ACE_OS::t_getinfo (stream_.get_handle (), + &info) < 0) + { + ACE_OS::t_error ("t_getinfo"); + return -1; + } + + char *buf_req = (char *) ACE_OS::malloc (info.options); + if (buf_req == 0) + { + ACE_OS::fprintf (stderr, + "Unable to allocate %ld bytes for options\n", + info.options); + return -1; + } + + char *buf_ret = (char *) ACE_OS::malloc (info.options); + if (buf_ret == 0) + { + ACE_OS::fprintf (stderr, + "Unable to allocate %ld bytes for options\n", + info.options); + return -1; + } + + ACE_OS::memset (&opt_req, 0, sizeof (opt_req)); + ACE_OS::memset (&opt_ret, 0, sizeof (opt_ret)); + + struct t_opthdr *popt = (struct t_opthdr *) buf_req; + struct t_opthdr *popt_ret = (struct t_opthdr *) buf_ret; + + popt->len= sizeof (struct t_opthdr) + opt_size; + + // We are only concerned with SVCs so no other check or values are needed + // here. + popt->level = T_ATM_SIGNALING; + popt->name = T_ATM_CONN_PROP; + popt->status = 0; + + opt_req.opt.len = popt->len; + opt_req.opt.buf = (char *) popt; + opt_req.flags = T_CURRENT; + + popt = T_OPT_NEXTHDR (buf_req, + info.options, + popt); + opt_ret.opt.maxlen = info.options; + opt_ret.opt.buf = (char *) popt_ret; + + if (ACE_OS::t_optmgmt (stream_.get_handle (), + &opt_req, + &opt_ret) < 0) { + ACE_OS::t_error ("t_optmgmt"); + return -1; + } + + ACE_OS::memcpy (connect_opts, + (char *) popt_ret + sizeof (struct t_opthdr), + opt_size); + + ACE_OS::free (buf_ret); + ACE_OS::free (buf_req); + + vpi = conn_prop.vpi; + vci = conn_prop.vci; + return 0; +#elif defined (ACE_HAS_FORE_ATM_WS2) + ATM_CONNECTION_ID connID; + DWORD bytes = 0; + + if (::WSAIoctl ((int) this -> get_handle (), + SIO_GET_ATM_CONNECTION_ID, + 0, + 0, + (LPVOID) &connID, + sizeof (ATM_CONNECTION_ID), + &bytes, + 0, + 0) + == SOCKET_ERROR) { + ACE_OS::printf ("Error: WSAIoctl %d\n", WSAGetLastError ()); + } + + vpi = (ACE_UINT16) connID.VPI; + vci = (ACE_UINT16) connID.VCI; + + return 0; +#elif defined (ACE_HAS_LINUX_ATM) +#if defined (SO_ATMPVC) /* atm version>=0.62 */ + struct sockaddr_atmpvc mypvcaddr; + int addrpvclen = sizeof (mypvcaddr); + if (ACE_OS::getsockopt (stream_.get_handle (), + SOL_ATM, + SO_ATMPVC, + reinterpret_cast (&mypvcaddr), + &addrpvclen) < 0) { + ACE_DEBUG (LM_DEBUG, + ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: getsockopt %d\n"), + errno); + return -1; + } + vpi = (ACE_UINT16) mypvcaddr.sap_addr.vpi; + vci = (ACE_UINT16) mypvcaddr.sap_addr.vci; + + return 0; +#elif defined (SO_VCID) /* patch for atm version 0.59 */ + struct atm_vcid mypvcid; + int pvcidlen = sizeof (mypvcid); + if (ACE_OS::getsockopt (stream_.get_handle (), + SOL_ATM,SO_VCID, + reinterpret_cast (&mypvcid), + &pvcidlen) < 0) { + ACE_DEBUG (LM_DEBUG, + ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: getsockopt %d\n"), + errno); + return -1; + } + vpi = (ACE_UINT16) mypvcid.vpi; + vci = (ACE_UINT16) mypvcid.vci; + + return 0; +#else + ACE_DEBUG (LM_DEBUG, + ACE_TEXT ("ACE_ATM_Stream::get_vpi_vci: Not implemented in this ATM version. Update to >= 0.62\n Or patch 0.59")); + ACE_UNUSED_ARG (vci); + ACE_UNUSED_ARG (vpi); + + return -1; +#endif /* SO_ATMPVC || SO_VCID */ +#else + return -1; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_ATM */ diff --git a/externals/ace/ATM_Stream.h b/externals/ace/ATM_Stream.h new file mode 100644 index 0000000..41ffb0d --- /dev/null +++ b/externals/ace/ATM_Stream.h @@ -0,0 +1,107 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file ATM_Stream.h + * + * $Id: ATM_Stream.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Joe Hoffert + */ +//============================================================================= + + +#ifndef ACE_ATM_STREAM_H +#define ACE_ATM_STREAM_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_ATM) + +#include "ace/ATM_Addr.h" +#include "ace/ATM_Params.h" + +#if defined (ACE_WIN32) +#include "ace/SOCK_Stream.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef ACE_SOCK_Stream ATM_Stream; +ACE_END_VERSIONED_NAMESPACE_DECL +#else +#include "ace/TLI_Stream.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +typedef ACE_TLI_Stream ATM_Stream; +ACE_END_VERSIONED_NAMESPACE_DECL +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_ATM_Stream + * + * @brief Defines the member functions for ACE_ATM_Stream abstraction. + */ +class ACE_Export ACE_ATM_Stream +{ +public: + // = Initialization and termination methods. + /// Default constructor. + ACE_ATM_Stream (void); + + // = ATM-specific open and shutdown operations. + /// open the stream. + int open (ACE_ATM_Params params = ACE_ATM_Params()); + + /// Close down and release resources. + int close (void); + + /// Get the underlying handle. + ACE_HANDLE get_handle (void) const; + + /// Get the underlying stream. + ATM_Stream& get_stream (void); + + /// Get the name of the connected host. + char* get_peer_name (void) const; + + /// Get the VPI and VCI of the stream. + int get_vpi_vci (ACE_UINT16 &vpi, + ACE_UINT16 &vci) const; + + /// Recv an n byte buffer from the connected transport mechanism. + ssize_t recv (void *buf, + size_t n, + int *flags = 0) const; + + /// Send exactly n bytes to the connected transport mechanism. + ssize_t send_n (const void *buf, + size_t n, + int flags) const; + + // = Meta-type info + typedef ACE_ATM_Addr PEER_ADDR; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Typedef'd to the appropriate stream mechanism above. + ATM_Stream stream_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/ATM_Stream.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_ATM */ +#include /**/ "ace/post.h" +#endif /* ACE_ATM_STREAM_H */ diff --git a/externals/ace/ATM_Stream.inl b/externals/ace/ATM_Stream.inl new file mode 100644 index 0000000..007e258 --- /dev/null +++ b/externals/ace/ATM_Stream.inl @@ -0,0 +1,133 @@ +// -*- C++ -*- +// +// $Id: ATM_Stream.inl 84262 2009-01-29 10:34:33Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void +ACE_ATM_Stream::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_ATM_Stream::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_INLINE +ACE_ATM_Stream::ACE_ATM_Stream (void) +{ + ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream"); +} + +ACE_INLINE +int +ACE_ATM_Stream::open (ACE_ATM_Params params) +{ + ACE_TRACE ("ACE_ATM_Stream::open"); +#if defined (ACE_HAS_FORE_ATM_XTI) + ACE_HANDLE handle = stream_.open (params.get_device(), + params.get_oflag(), + params.get_info()); + return (handle == ACE_INVALID_HANDLE ? -1 : 0); +#elif defined (ACE_HAS_FORE_ATM_WS2) + params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT ); + + int retval = stream_.open (params.get_type(), + params.get_protocol_family(), + params.get_protocol(), + params.get_protocol_info(), + params.get_sock_group(), + params.get_flags(), + params.get_reuse_addr()); + if (retval == -1) + return -1; + + struct sockaddr_atm sock_addr; + + ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm)); + sock_addr.satm_family = AF_ATM; + sock_addr.satm_number.AddressType=ADDR_ANY; + sock_addr.satm_number.NumofDigits = ATM_ADDR_SIZE; + sock_addr.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT; + sock_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; + sock_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; + if (ACE_OS::bind(get_handle(), + (struct sockaddr FAR *)&sock_addr, + sizeof(struct sockaddr_atm)) < 0) + { + ACE_OS::printf("Error binding local address: %d",WSAGetLastError()); + return -1; + } + + return 0; +#else + ACE_UNUSED_ARG(params); + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI */ +} + +ACE_INLINE +int +ACE_ATM_Stream::close (void) +{ + ACE_TRACE ("ACE_ATM_Stream::close"); +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) + return stream_.close (); +#else + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ +} + +ACE_INLINE +ATM_Stream& +ACE_ATM_Stream::get_stream (void) +{ + ACE_TRACE ("ACE_ATM_Stream::get_stream"); + return stream_; +} + +ACE_INLINE +ssize_t +ACE_ATM_Stream::recv (void *buf, + size_t n, + int *flags) const +{ + ACE_TRACE ("ACE_ATM_Stream::recv"); +#if defined (ACE_HAS_FORE_ATM_XTI) + return stream_.recv (buf, + n, + flags); +#elif defined (ACE_HAS_FORE_ATM_WS2) + return stream_.recv (buf, + n); +#else + ACE_UNUSED_ARG(buf); + ACE_UNUSED_ARG(n); + ACE_UNUSED_ARG(flags); + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI */ +} + +ACE_INLINE +ssize_t +ACE_ATM_Stream::send_n (const void *buf, + size_t n, + int flags) const +{ + ACE_TRACE ("ACE_ATM_Stream::send_n"); +#if defined (ACE_HAS_FORE_ATM_XTI) + return stream_.send_n (buf, + n, + flags); +#elif defined (ACE_HAS_FORE_ATM_WS2) + return stream_.send_n (buf, + n, + flags); +#else + ACE_UNUSED_ARG(buf); + ACE_UNUSED_ARG(n); + ACE_UNUSED_ARG(flags); + return 0; +#endif /* ACE_HAS_FORE_ATM_XTI */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Acceptor.cpp b/externals/ace/Acceptor.cpp new file mode 100644 index 0000000..e2e1ad7 --- /dev/null +++ b/externals/ace/Acceptor.cpp @@ -0,0 +1,1246 @@ +#ifndef ACE_ACCEPTOR_CPP +#define ACE_ACCEPTOR_CPP + +#include "ace/ACE.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Acceptor.h" +#include "ace/Handle_Set.h" +#include "ace/Svc_Handler.h" +#include "ace/WFMO_Reactor.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_sys_select.h" + +ACE_RCSID (ace, + Acceptor, + "$Id: Acceptor.cpp 84935 2009-03-22 19:21:58Z schmidt $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Acceptor) + +template void +ACE_Acceptor::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Acceptor::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->peer_acceptor_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Acceptor::operator ACE_PEER_ACCEPTOR & () const +{ + ACE_TRACE ("ACE_Acceptor::operator ACE_PEER_ACCEPTOR &"); + return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; +} + +template ACE_PEER_ACCEPTOR & +ACE_Acceptor::acceptor (void) const +{ + ACE_TRACE ("ACE_Acceptor::acceptor"); + return const_cast (this->peer_acceptor_); +} + +// Returns ACE_HANDLE of the underlying Acceptor_Strategy. + +template ACE_HANDLE +ACE_Acceptor::get_handle (void) const +{ + ACE_TRACE ("ACE_Acceptor::get_handle"); + return this->peer_acceptor_.get_handle (); +} + +// Initialize the appropriate strategies for creation, passive +// connection acceptance, and concurrency, and then register +// with the Reactor and listen for connection requests at the +// designated . + +template int +ACE_Acceptor::open + (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor *reactor, + int flags, + int use_select, + int reuse_addr) +{ + ACE_TRACE ("ACE_Acceptor::open"); + this->flags_ = flags; + this->use_select_ = use_select; + this->reuse_addr_ = reuse_addr; + this->peer_acceptor_addr_ = local_addr; + + // Must supply a valid Reactor to Acceptor::open()... + + if (reactor == 0) + { + errno = EINVAL; + return -1; + } + + if (this->peer_acceptor_.open (local_addr, reuse_addr) == -1) + return -1; + + // Set the peer acceptor's handle into non-blocking mode. This is a + // safe-guard against the race condition that can otherwise occur + // between the time when indicates that a passive-mode + // socket handle is "ready" and when we call . During this + // interval, the client can shutdown the connection, in which case, + // the call can hang! + if (this->accept_strategy_->acceptor ().enable (ACE_NONBLOCK) != 0) + return -1; + + // Initialize the concurrency strategy. + + if (con_s == 0) + { + ACE_NEW_RETURN (con_s, + CONCURRENCY_STRATEGY, + -1); + this->delete_concurrency_strategy_ = true; + } + this->concurrency_strategy_ = con_s; + + // Initialize the scheduling strategy. + + if (sch_s == 0) + { + ACE_NEW_RETURN (sch_s, + SCHEDULING_STRATEGY, + -1); + this->delete_scheduling_strategy_ = true; + } + this->scheduling_strategy_ = sch_s; + + this->use_select_ = use_select; + + return this->reactor ()->register_handler + (this, + ACE_Event_Handler::ACCEPT_MASK); +} + +// Simple constructor. + +template +ACE_Strategy_Acceptor::ACE_Strategy_Acceptor + (const ACE_TCHAR service_name[], + const ACE_TCHAR service_description[], + int use_select, + int reuse_addr) + : creation_strategy_ (0), + delete_creation_strategy_ (false), + accept_strategy_ (0), + delete_accept_strategy_ (false), + concurrency_strategy_ (0), + delete_concurrency_strategy_ (false), + scheduling_strategy_ (0), + delete_scheduling_strategy_ (false), + service_name_ (0), + service_description_ (0) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"); + + if (service_name != 0) + ACE_ALLOCATOR (this->service_name_, + ACE_OS::strdup (service_name)); + if (service_description != 0) + ACE_ALLOCATOR (this->service_description_, + ACE_OS::strdup (service_description)); + this->use_select_ = use_select; + this->reuse_addr_ = reuse_addr; +} + +template +ACE_Strategy_Acceptor::ACE_Strategy_Acceptor + (const ACE_PEER_ACCEPTOR_ADDR &addr, + ACE_Reactor *reactor, + ACE_Creation_Strategy *cre_s, + ACE_Accept_Strategy *acc_s, + ACE_Concurrency_Strategy *con_s, + ACE_Scheduling_Strategy *sch_s, + const ACE_TCHAR service_name[], + const ACE_TCHAR service_description[], + int use_select, + int reuse_addr) + : creation_strategy_ (0), + delete_creation_strategy_ (false), + accept_strategy_ (0), + delete_accept_strategy_ (false), + concurrency_strategy_ (0), + delete_concurrency_strategy_ (false), + scheduling_strategy_ (0), + delete_scheduling_strategy_ (false), + service_name_ (0), + service_description_ (0) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"); + + if (this->open (addr, + reactor, + cre_s, + acc_s, + con_s, + sch_s, + service_name, + service_description, + use_select, + reuse_addr) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Strategy_Acceptor::ACE_Strategy_Acceptor"))); +} + +// Perform termination activities when is removed from the +// . + +template int +ACE_Strategy_Acceptor::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::handle_close"); + // Guard against multiple closes. + if (this->reactor () != 0) + { + ACE_HANDLE handle = this->get_handle (); + + if (this->delete_creation_strategy_) + delete this->creation_strategy_; + this->delete_creation_strategy_ = false; + this->creation_strategy_ = 0; + + if (this->delete_accept_strategy_) + delete this->accept_strategy_; + this->delete_accept_strategy_ = false; + this->accept_strategy_ = 0; + + if (this->delete_concurrency_strategy_) + delete this->concurrency_strategy_; + this->delete_concurrency_strategy_ = false; + this->concurrency_strategy_ = 0; + + if (this->delete_scheduling_strategy_) + delete this->scheduling_strategy_; + this->delete_scheduling_strategy_ = false; + this->scheduling_strategy_ = 0; + + // We must use the obtained *before* we deleted the + // accept_strategy_... + + this->reactor ()->remove_handler + (handle, + ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); + + // Set the Reactor to 0 so that we don't try to close down + // again. + this->reactor (0); + } + return 0; +} + +// Bridge method for creating a . The strategy for +// creating a are configured into the Acceptor via it's +// . The default is to create a new +// . However, subclasses can override this strategy to +// perform creation in any way that they like (such as +// creating subclass instances of , using a singleton, +// dynamically linking the handler, etc.). + +template int +ACE_Strategy_Acceptor::make_svc_handler (SVC_HANDLER *&sh) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::make_svc_handler"); + return this->creation_strategy_->make_svc_handler (sh); +} + +// Bridge method for accepting the new connection into the +// . The default behavior delegates to the +// in the Acceptor_Strategy. + +template int +ACE_Strategy_Acceptor::accept_svc_handler + (SVC_HANDLER *svc_handler) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::accept_svc_handler"); + return this->accept_strategy_->accept_svc_handler (svc_handler); +} + +// Bridge method for activating a with the appropriate +// concurrency strategy. The default behavior of this method is to +// activate the SVC_HANDLER by calling its open() method (which allows +// the SVC_HANDLER to define its own concurrency strategy). However, +// subclasses can override this strategy to do more sophisticated +// concurrency activations (such as creating the SVC_HANDLER as an +// "active object" via multi-threading or multi-processing). + +template int +ACE_Strategy_Acceptor::activate_svc_handler + (SVC_HANDLER *svc_handler) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::activate_svc_handler"); + return this->concurrency_strategy_->activate_svc_handler + (svc_handler, + (void *) this); +} + +template +ACE_Strategy_Acceptor::~ACE_Strategy_Acceptor (void) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::~ACE_Strategy_Acceptor"); + ACE_OS::free ((void *) this->service_name_); + ACE_OS::free ((void *) this->service_description_); + this->handle_close (); +} + +// Signal the server to shutdown gracefully. + +template int +ACE_Strategy_Acceptor::handle_signal (int, siginfo_t *, ucontext_t *) +{ + ACE_Reactor::instance()->end_reactor_event_loop (); + return 0; +} + +template int +ACE_Strategy_Acceptor::info (ACE_TCHAR **strp, + size_t length) const +{ + ACE_TRACE ("ACE_Strategy_Acceptor::info"); + + ACE_TCHAR buf[BUFSIZ]; + ACE_TCHAR service_addr_str[BUFSIZ]; + ACE_PEER_ACCEPTOR_ADDR addr; + + if (this->acceptor ().get_local_addr (addr) == -1) + return -1; + else if (addr.addr_to_string (service_addr_str, + sizeof service_addr_str) == -1) + return -1; + + // @@ Should add the protocol in... + ACE_OS::sprintf (buf, + ACE_TEXT ("%s\t %s #%s\n"), + this->service_name_ == 0 + ? ACE_TEXT ("") + : this->service_name_, + service_addr_str, + this->service_description_ == 0 + ? ACE_TEXT ("") + : this->service_description_); + + if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) + return -1; + else + ACE_OS::strsncpy (*strp, buf, length); + return static_cast (ACE_OS::strlen (buf)); +} + +template int +ACE_Strategy_Acceptor::fini (void) +{ + ACE_TRACE ("ACE_Strategy_Acceptor::fini"); + return this->ACE_Strategy_Acceptor::handle_close (); +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Oneshot_Acceptor) + +template void +ACE_Oneshot_Acceptor::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Oneshot_Acceptor::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsvc_handler_ = %x"), this->svc_handler_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nrestart_ = %d"), this->restart_)); + this->peer_acceptor_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_concurrency_strategy_ = %d"), + delete_concurrency_strategy_)); + this->concurrency_strategy_->dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template int +ACE_Oneshot_Acceptor::open + (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor *reactor, + ACE_Concurrency_Strategy *con_s) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::open"); + this->reactor (reactor); + + // Initialize the concurrency strategy. + + if (con_s == 0) + { + ACE_NEW_RETURN (con_s, + ACE_Concurrency_Strategy, + -1); + this->delete_concurrency_strategy_ = true; + } + this->concurrency_strategy_ = con_s; + + // Reuse the addr, even if it is already in use...! + return this->peer_acceptor_.open (local_addr, 1); +} + +template +ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor (void) + : delete_concurrency_strategy_ (false) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"); + this->reactor (0); +} + +template +ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor + (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor *reactor, + ACE_Concurrency_Strategy *cs) + : delete_concurrency_strategy_ (false) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"); + if (this->open (local_addr, reactor, cs) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Oneshot_Acceptor::ACE_Oneshot_Acceptor"))); +} + +template +ACE_Oneshot_Acceptor::~ACE_Oneshot_Acceptor (void) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::~ACE_Oneshot_Acceptor"); + this->handle_close (); +} + +template int +ACE_Oneshot_Acceptor::close (void) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::close"); + return this->handle_close (); +} + +template int +ACE_Oneshot_Acceptor::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::handle_close"); + + // Guard against multiple closes. + if (this->delete_concurrency_strategy_) + { + delete this->concurrency_strategy_; + this->delete_concurrency_strategy_ = false; + this->concurrency_strategy_ = 0; + } + // Note that if we aren't actually registered with the + // ACE_Reactor then it's ok for this call to fail... + + if (this->reactor ()) + this->reactor ()->remove_handler + (this, + ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); + + if (this->peer_acceptor_.close () == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("close\n"))); + return 0; +} + +template int +ACE_Oneshot_Acceptor::handle_timeout + (const ACE_Time_Value &tv, + const void *arg) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::handle_timeout"); + errno = ETIME; + + if (this->svc_handler_->handle_timeout (tv, arg) == -1) + this->svc_handler_->handle_close (this->svc_handler_->get_handle (), + ACE_Event_Handler::TIMER_MASK); + + // Since we aren't necessarily registered with the Reactor, don't + // bother to check the return value here... + if (this->reactor ()) + this->reactor ()->remove_handler (this, + ACE_Event_Handler::ACCEPT_MASK); + return 0; +} + +template int +ACE_Oneshot_Acceptor::cancel (void) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::cancel"); + return this->reactor () && this->reactor ()->cancel_timer (this); +} + +template int +ACE_Oneshot_Acceptor::register_handler + (SVC_HANDLER *svc_handler, + const ACE_Synch_Options &synch_options, + bool restart) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::register_handler"); + // Can't do this if we don't have a Reactor. + if (this->reactor () == 0) + { + errno = EINVAL; + return -1; + } + else + { + this->svc_handler_ = svc_handler; + this->restart_ = restart; + ACE_Time_Value *tv = (ACE_Time_Value *) synch_options.time_value (); + + if (tv != 0 + && this->reactor ()->schedule_timer (this, + synch_options.arg (), + *tv) == 0) + return -1; + else + return this->reactor ()->register_handler + (this, + ACE_Event_Handler::ACCEPT_MASK); + } +} + +// Bridge method for activating a with the appropriate +// concurrency strategy. The default behavior of this method is to +// activate the SVC_HANDLER by calling its open() method (which allows +// the SVC_HANDLER to define its own concurrency strategy). However, +// subclasses can override this strategy to do more sophisticated +// concurrency activations (such as creating the SVC_HANDLER as an +// "active object" via multi-threading or multi-processing). + +template int +ACE_Oneshot_Acceptor::activate_svc_handler + (SVC_HANDLER *svc_handler) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::activate_svc_handler"); + return this->concurrency_strategy_->activate_svc_handler + (svc_handler, + (void *) this); +} + +// Factors out the code shared between the and +// methods. + +template int +ACE_Oneshot_Acceptor::shared_accept + (SVC_HANDLER *svc_handler, + ACE_PEER_ACCEPTOR_ADDR *remote_addr, + ACE_Time_Value *timeout, + bool restart, + bool reset_new_handle) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::shared_accept"); + if (svc_handler == 0) + return -1; + + // Accept connection into the Svc_Handler. + else if (this->peer_acceptor_.accept (svc_handler->peer (), // stream + remote_addr, // remote address + timeout, // timeout + restart, // restart + reset_new_handle // reset new handle + ) == -1) + { + // Check whether we just timed out or whether we failed... + if (!(errno == EWOULDBLOCK || errno == ETIME)) + // Close down handler to avoid memory leaks. + svc_handler->close (CLOSE_DURING_NEW_CONNECTION); + return -1; + } + // Activate the using the designated concurrency + // strategy (note that this method becomes responsible for handling + // errors and freeing up the memory if things go awry...) + else + return this->activate_svc_handler (svc_handler); +} + +// Make a SVC_HANDLER, accept the connection into the SVC_HANDLER, and +// then activate the SVC_HANDLER. Note that SVC_HANDLER::open() +// decides what type of concurrency strategy to use. + +template int +ACE_Oneshot_Acceptor::accept + (SVC_HANDLER *svc_handler, + ACE_PEER_ACCEPTOR_ADDR *remote_addr, + const ACE_Synch_Options &synch_options, + bool restart, + bool reset_new_handle) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::accept"); + // Note that if timeout == ACE_Time_Value (x, y) where (x > 0 || y > + // 0) then this->connector_.connect() will block synchronously. If + // is set then we don't want this to happen (since we + // want the ACE_Reactor to do the timeout asynchronously). + // Therefore, we'll force this->connector_ to use ACE_Time_Value (0, + // 0) in this case... + + ACE_Time_Value *timeout; + int use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; + + if (use_reactor) + timeout = (ACE_Time_Value *) &ACE_Time_Value::zero; + else + timeout = (ACE_Time_Value *) synch_options.time_value (); + + if (this->shared_accept (svc_handler, // stream + remote_addr, // remote address + timeout, // timeout + restart, // restart + reset_new_handle // reset new handler + ) == -1) + { + if (use_reactor && errno == EWOULDBLOCK) + // We couldn't accept right away, so let's wait in the + // . + this->register_handler (svc_handler, + synch_options, + restart); + return -1; + } + return 0; +} + +// Accepts one pending connection from a client (since we're the +// "oneshot" Acceptor). + +template int +ACE_Oneshot_Acceptor::handle_input (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::handle_input"); + int result = 0; + + // Cancel any timer that might be pending. + this->cancel (); + + // Try to find out if the implementation of the reactor that we are + // using requires us to reset the event association for the newly + // created handle. This is because the newly created handle will + // inherit the properties of the listen handle, including its event + // associations. + bool const reset_new_handle = this->reactor ()->uses_event_associations (); + + // There is a use-case whereby this object will be gone upon return + // from shared_accept - if the Svc_Handler deletes this Oneshot_Acceptor + // during the shared_accept/activation steps. So, do whatever we need + // to do with this object before calling shared_accept. + if (this->reactor ()) + this->reactor ()->remove_handler + (this, + ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); + + if (this->shared_accept (this->svc_handler_, // stream + 0, // remote address + 0, // timeout + this->restart_, // restart + reset_new_handle // reset new handle + ) == -1) + result = -1; + + return result; +} + +// Hook called by the explicit dynamic linking facility. + +template int +ACE_Oneshot_Acceptor::init (int, ACE_TCHAR *[]) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::init"); + return -1; +} + +template int +ACE_Oneshot_Acceptor::fini (void) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::fini"); + return this->handle_close (); +} + +template int +ACE_Oneshot_Acceptor::info (ACE_TCHAR **strp, + size_t length) const +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::info"); + ACE_TCHAR buf[BUFSIZ]; + ACE_TCHAR addr_str[BUFSIZ]; + ACE_PEER_ACCEPTOR_ADDR addr; + + if (this->peer_acceptor_.get_local_addr (addr) == -1) + return -1; + else if (addr.addr_to_string (addr_str, sizeof addr_str) == -1) + return -1; + + ACE_OS::sprintf (buf, + ACE_TEXT ("%s\t %s %s"), + ACE_TEXT ("ACE_Oneshot_Acceptor"), + addr_str, + ACE_TEXT ("#oneshot acceptor factory\n")); + + if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) + return -1; + else + ACE_OS::strsncpy (*strp, buf, length); + return static_cast (ACE_OS::strlen (buf)); +} + +template int +ACE_Oneshot_Acceptor::suspend (void) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::suspend"); + return this->reactor () && this->reactor ()->suspend_handler (this); +} + +template int +ACE_Oneshot_Acceptor::resume (void) +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::resume"); + return this->reactor () && this->reactor ()->resume_handler (this); +} + +// Returns ACE_HANDLE of the underlying peer_acceptor. + +template ACE_HANDLE +ACE_Oneshot_Acceptor::get_handle (void) const +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::get_handle"); + return this->peer_acceptor_.get_handle (); +} + +template ACE_PEER_ACCEPTOR & +ACE_Oneshot_Acceptor::acceptor (void) const +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::acceptor"); + return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; +} + +template +ACE_Oneshot_Acceptor::operator ACE_PEER_ACCEPTOR & () const +{ + ACE_TRACE ("ACE_Oneshot_Acceptor::operator ACE_PEER_ACCEPTOR &"); + return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ACCEPTOR_CPP */ diff --git a/externals/ace/Acceptor.h b/externals/ace/Acceptor.h new file mode 100644 index 0000000..64cf488 --- /dev/null +++ b/externals/ace/Acceptor.h @@ -0,0 +1,695 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Acceptor.h + * + * $Id: Acceptor.h 88800 2010-02-01 23:18:34Z shuston $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ACCEPTOR_H +#define ACE_ACCEPTOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Service_Object.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Strategies_T.h" +#include "ace/Synch_Options.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Acceptor + * + * @brief Abstract factory for creating a service handler + * (SVC_HANDLER), accepting into the SVC_HANDLER, and + * activating the SVC_HANDLER. + * + * Implements the basic strategy for passively establishing + * connections with clients. An ACE_Acceptor is parameterized + * by concrete types that conform to the interfaces of + * PEER_ACCEPTOR and SVC_HANDLER. The PEER_ACCEPTOR is + * instantiated with a transport mechanism that passively + * establishes connections. The SVC_HANDLER is instantiated + * with a concrete type that performs the application-specific + * service. An ACE_Acceptor inherits from ACE_Service_Object, + * which in turn inherits from ACE_Event_Handler. This enables + * the ACE_Reactor to dispatch the ACE_Acceptor's handle_input + * method when connection events occur. The handle_input method + * performs the ACE_Acceptor's default creation, connection + * establishment, and service activation strategies. These + * strategies can be overridden by subclasses individually or as + * a group. + */ +template +class ACE_Acceptor : public ACE_Service_Object +{ +public: + + // Useful STL-style traits. + typedef ACE_PEER_ACCEPTOR_ADDR addr_type; + typedef ACE_PEER_ACCEPTOR acceptor_type; + typedef SVC_HANDLER handler_type; + typedef typename SVC_HANDLER::stream_type stream_type; + + /// "Do-nothing" constructor. + ACE_Acceptor (ACE_Reactor * = 0, + int use_select = 1); + + /** + * Open the contained @c PEER_ACCEPTOR object to begin listening, and + * register with the specified reactor for accept events. An + * acceptor can only listen to one port at a time, so make sure to + * @c close() the acceptor before calling @c open() again. + * + * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a + * safeguard against the race condition that can otherwise occur + * between the time when the passive-mode socket handle is "ready" + * and when the actual @c accept() call is made. During this + * interval, the client can shutdown the connection, in which case, + * the @c accept() call can hang. + * + * @param local_addr The address to listen at. + * @param reactor Pointer to the ACE_Reactor instance to register + * this object with. The default is the singleton. + * @param flags Flags to control what mode an accepted socket + * will be put into after it is accepted. The only + * legal value for this argument is @c ACE_NONBLOCK, + * which enables non-blocking mode on the accepted + * peer stream object in @c SVC_HANDLER. The default + * is 0. + * @param use_select Affects behavior when called back by the reactor + * when a connection can be accepted. If non-zero, + * this object will accept all pending connections, + * instead of just the one that triggered the reactor + * callback. Uses ACE_OS::select() internally to + * detect any remaining acceptable connections. + * The default is 1. + * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with + * @p local_addr. Generally used to request that the + * OS allow reuse of the listen port. The default is 1. + */ + ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor *reactor = ACE_Reactor::instance (), + int flags = 0, + int use_select = 1, + int reuse_addr = 1); + + /** + * Open the contained @c PEER_ACCEPTOR object to begin listening, and + * register with the specified reactor for accept events. An + * acceptor can only listen to one port at a time, so make sure to + * @c close() the acceptor before calling @c open() again. + * + * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a + * safeguard against the race condition that can otherwise occur + * between the time when the passive-mode socket handle is "ready" + * and when the actual @c accept() call is made. During this + * interval, the client can shutdown the connection, in which case, + * the @c accept() call can hang. + * + * @param local_addr The address to listen at. + * @param reactor Pointer to the ACE_Reactor instance to register + * this object with. The default is the singleton. + * @param flags Flags to control what mode an accepted socket + * will be put into after it is accepted. The only + * legal value for this argument is @c ACE_NONBLOCK, + * which enables non-blocking mode on the accepted + * peer stream object in @c SVC_HANDLER. The default + * is 0. + * @param use_select Affects behavior when called back by the reactor + * when a connection can be accepted. If non-zero, + * this object will accept all pending connections, + * instead of just the one that triggered the reactor + * callback. Uses ACE_OS::select() internally to + * detect any remaining acceptable connections. + * The default is 1. + * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with + * @p local_addr. Generally used to request that the + * OS allow reuse of the listen port. The default is 1. + * + * @retval 0 Success + * @retval -1 Failure, @c errno contains an error code. + */ + virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor *reactor = ACE_Reactor::instance (), + int flags = 0, + int use_select = 1, + int reuse_addr = 1); + + /// Close down the Acceptor's resources. + virtual ~ACE_Acceptor (void); + + /// Return the underlying PEER_ACCEPTOR object. + virtual operator ACE_PEER_ACCEPTOR &() const; + + /// Return the underlying PEER_ACCEPTOR object. + virtual ACE_PEER_ACCEPTOR &acceptor (void) const; + + /// Returns the listening acceptor's {ACE_HANDLE}. + virtual ACE_HANDLE get_handle (void) const; + + /// Close down the Acceptor + virtual int close (void); + + /// In the event that an accept fails, this method will be called and + /// the return value will be returned from handle_input(). + virtual int handle_accept_error (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = The following three methods define the Acceptor's strategies + // for creating, accepting, and activating SVC_HANDLER's, + // respectively. + + /** + * Bridge method for creating a SVC_HANDLER. The default is to + * create a new {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. + * However, subclasses can override this policy to perform + * SVC_HANDLER creation in any way that they like (such as creating + * subclass instances of SVC_HANDLER, using a singleton, dynamically + * linking the handler, etc.). Returns -1 on failure, else 0. + */ + virtual int make_svc_handler (SVC_HANDLER *&sh); + + /** + * Bridge method for accepting the new connection into the + * @a svc_handler. The default behavior delegates to the + * PEER_ACCEPTOR::accept. + */ + virtual int accept_svc_handler (SVC_HANDLER *svc_handler); + + /** + * Bridge method for activating a {svc_handler} with the appropriate + * concurrency strategy. The default behavior of this method is to + * activate the SVC_HANDLER by calling its {open} method (which + * allows the SVC_HANDLER to define its own concurrency strategy). + * However, subclasses can override this strategy to do more + * sophisticated concurrency activations (such as making the + * SVC_HANDLER as an "active object" via multi-threading or + * multi-processing). + */ + virtual int activate_svc_handler (SVC_HANDLER *svc_handler); + + // = Demultiplexing hooks. + /// Perform termination activities when {this} is removed from the + /// {reactor}. + virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + /// Accepts all pending connections from clients, and creates and + /// activates SVC_HANDLERs. + virtual int handle_input (ACE_HANDLE); + + // = Dynamic linking hooks. + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int init (int argc, ACE_TCHAR *argv[]); + + /// Calls {handle_close}. + virtual int fini (void); + + /// Default version returns address info in {buf}. + virtual int info (ACE_TCHAR **buf, size_t) const; + +public: + // = Service management hooks. + /// This method calls {Reactor::suspend}. + virtual int suspend (void); + + /// This method calls {Reactor::resume}. + virtual int resume (void); + +protected: + /// Concrete factory for accepting connections from clients... + ACE_PEER_ACCEPTOR peer_acceptor_; + + /// Needed to reopen the socket if {accept} fails. + ACE_PEER_ACCEPTOR_ADDR peer_acceptor_addr_; + + /** + * Flags that indicate how {SVC_HANDLER}'s should be initialized + * prior to being activated. Right now, the only flag that is + * processed is {ACE_NONBLOCK}, which enabled non-blocking I/O on + * the {SVC_HANDLER} when it is opened. + */ + int flags_; + + /// Flag that indicates whether it shall use {select} in the + /// {accept}-loop. + int use_select_; + + /// Needed to reopen the socket if {accept} fails. + int reuse_addr_; +}; + +/** + * @class ACE_Strategy_Acceptor + * + * @brief Abstract factory for creating a service handler + * (SVC_HANDLER), accepting into the SVC_HANDLER, and activating + * the SVC_HANDLER. + * + * Implements a flexible and extensible set of strategies for + * passively establishing connections with clients. There are + * three main strategies: (1) creating a SVC_HANDLER, (2) + * passively accepting a new connection from a client into the + * SVC_HANDLER, and (3) activating the SVC_HANDLER with a + * particular concurrency mechanism. + */ +template +class ACE_Strategy_Acceptor + : public ACE_Acceptor +{ +public: + + // Useful STL-style traits. + typedef ACE_Creation_Strategy + creation_strategy_type; + typedef ACE_Accept_Strategy + accept_strategy_type; + typedef ACE_Concurrency_Strategy + concurrency_strategy_type; + typedef ACE_Scheduling_Strategy scheduling_strategy_type; + typedef ACE_Acceptor + base_type; + + // = Define some useful (old style) traits. + typedef ACE_Creation_Strategy CREATION_STRATEGY; + typedef ACE_Accept_Strategy ACCEPT_STRATEGY; + typedef ACE_Concurrency_Strategy CONCURRENCY_STRATEGY; + typedef ACE_Scheduling_Strategy SCHEDULING_STRATEGY; + + /// Default constructor. + ACE_Strategy_Acceptor (const ACE_TCHAR service_name[] = 0, + const ACE_TCHAR service_description[] = 0, + int use_select = 1, + int reuse_addr = 1); + + /** + * Initialize the appropriate strategies for creation, passive + * connection acceptance, and concurrency, and then register {this} + * with the Reactor and listen for connection requests at the + * designated {local_addr}. + */ + ACE_Strategy_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor * = ACE_Reactor::instance (), + ACE_Creation_Strategy * = 0, + ACE_Accept_Strategy * = 0, + ACE_Concurrency_Strategy * = 0, + ACE_Scheduling_Strategy * = 0, + const ACE_TCHAR service_name[] = 0, + const ACE_TCHAR service_description[] = 0, + int use_select = 1, + int reuse_addr = 1); + + /** + * Open the contained @c PEER_ACCEPTOR object to begin listening, and + * register with the specified reactor for accept events. + * + * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a + * safeguard against the race condition that can otherwise occur + * between the time when the passive-mode socket handle is "ready" + * and when the actual @c accept call is made. During this + * interval, the client can shutdown the connection, in which case, + * the {accept} call can hang. + * + * @param local_addr The address to listen at. + * @param reactor Pointer to the ACE_Reactor instance to register + * this object with. The default is the singleton. + * @param flags Flags to control what mode an accepted socket + * will be put into after it is accepted. The only + * legal value for this argument is @c ACE_NONBLOCK, + * which enables non-blocking mode on the accepted + * peer stream object in @c SVC_HANDLER. The default + * is 0. + * @param use_select Affects behavior when called back by the reactor + * when a connection can be accepted. If non-zero, + * this object will accept all pending connections, + * instead of just the one that triggered the reactor + * callback. Uses ACE_OS::select() internally to + * detect any remaining acceptable connections. + * The default is 1. + * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with + * @p local_addr. Generally used to request that the + * OS allow reuse of the listen port. The default is 1. + * + * @retval 0 Success + * @retval -1 Failure, @c errno contains an error code. + */ + virtual int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor *reactor, + int flags = 0, + int use_select = 1, + int reuse_addr = 1); + + /** + * Initialize the appropriate strategies for creation, passive + * connection acceptance, and concurrency, and then register {this} + * with the Reactor and listen for connection requests at the + * designated {local_addr}. + */ + virtual int open (const ACE_PEER_ACCEPTOR_ADDR &, + ACE_Reactor * = ACE_Reactor::instance (), + ACE_Creation_Strategy * = 0, + ACE_Accept_Strategy * =0, + ACE_Concurrency_Strategy * = 0, + ACE_Scheduling_Strategy * = 0, + const ACE_TCHAR *service_name = 0, + const ACE_TCHAR *service_description = 0, + int use_select = 1, + int reuse_addr = 1); + + /// Close down the Strategy_Acceptor's resources. + virtual ~ACE_Strategy_Acceptor (void); + + /// Return the underlying PEER_ACCEPTOR object. + virtual operator ACE_PEER_ACCEPTOR &() const; + + /// Return the underlying PEER_ACCEPTOR object. + virtual ACE_PEER_ACCEPTOR &acceptor (void) const; + + /// Returns the listening acceptor's {ACE_HANDLE}. + virtual ACE_HANDLE get_handle (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + // = Service management hooks. + + /// This method delegates to the {Scheduling_Strategy}'s {suspend} + /// method. + virtual int suspend (void); + + /// This method delegates to the {Scheduling_Strategy}'s {resume} + /// method. + virtual int resume (void); + +protected: + + /// Calls {handle_close} when dynamically unlinked. + virtual int fini (void); + + /// Default version returns address info in {buf}. + virtual int info (ACE_TCHAR **buf, size_t) const; + + // = The following three methods define the {Acceptor}'s strategies + // for creating, accepting, and activating {SVC_HANDLER}'s, + // respectively. + + /** + * Bridge method for creating a {SVC_HANDLER}. The strategy for + * creating a {SVC_HANDLER} are configured into the Acceptor via + * it's {creation_strategy_}. The default is to create a new + * {SVC_HANDLER} if {sh} == 0, else {sh} is unchanged. However, + * subclasses can override this policy to perform {SVC_HANDLER} + * creation in any way that they like (such as creating subclass + * instances of {SVC_HANDLER}, using a singleton, dynamically + * linking the handler, etc.). Returns -1 on failure, else 0. + */ + virtual int make_svc_handler (SVC_HANDLER *&); + + /** + * Bridge method for accepting the new connection into the + * {SVC_HANDLER}. The default behavior delegates to the + * {PEER_ACCEPTOR::accept} in the {Acceptor_Strategy}. + */ + virtual int accept_svc_handler (SVC_HANDLER *svc_handler); + + /** + * Bridge method for activating a {SVC_HANDLER} with the appropriate + * concurrency strategy. The default behavior of this method is to + * activate the {SVC_HANDLER} by calling its {open} method (which + * allows the {SVC_HANDLER} to define its own concurrency strategy). + * However, subclasses can override this strategy to do more + * sophisticated concurrency activations (such as creating the + * {SVC_HANDLER} as an "active object" via multi-threading or + * multi-processing). + */ + virtual int activate_svc_handler (SVC_HANDLER *svc_handler); + + // = Demultiplexing hooks. + /// Perform termination activities when {this} is removed from the + /// {Reactor}. + virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + /// Handle SIGINT. + virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); + + // = These data members are "logically private" but are put in the + // protected part in case subclasses want to access them. + + // = Strategy objects. + + /// Creation strategy for an Acceptor. + CREATION_STRATEGY *creation_strategy_; + + /// true if {Acceptor} created the creation strategy and thus should + /// delete it, else false. + bool delete_creation_strategy_; + + /// Accept strategy for an {Acceptor}. + ACCEPT_STRATEGY *accept_strategy_; + + /// true if {Acceptor} created the accept strategy and thus should delete + /// it, else false. + bool delete_accept_strategy_; + + /// Concurrency strategy for an {Acceptor}. + CONCURRENCY_STRATEGY *concurrency_strategy_; + + /// true if {Acceptor} created the concurrency strategy and thus should + /// delete it, else false. + bool delete_concurrency_strategy_; + + /// Scheduling strategy for an {Acceptor}. + SCHEDULING_STRATEGY *scheduling_strategy_; + + /// true if {Acceptor} created the scheduling strategy and thus should + /// delete it, else false. + bool delete_scheduling_strategy_; + + // = Service information objects. + + /// Name of the service. + ACE_TCHAR *service_name_; + + /// Description of the service. + ACE_TCHAR *service_description_; + + /// Address that the {Strategy_Acceptor} uses to listen for + /// connections. + ACE_PEER_ACCEPTOR_ADDR service_addr_; +}; + +/** + * @class ACE_Oneshot_Acceptor + * + * @brief Generic factory for passively connecting clients and creating + * exactly one service handler of the type SVC_HANDLER specified in the + * template. + * + * This class works similarly to the regular ACE_Acceptor, but + * with the following differences: + * -# ACE_Oneshot_Acceptor doesn't automatically register itself with the + * ACE_Reactor; the caller is expected to call the accept() method + * directly. Since a later call to accept() may require a reactor, + * the constructor and open() methods both accept an ACE_Reactor pointer + * which is saved in case it's needed in accept(). + * -# ACE_Oneshot_Acceptor doesn't need an ACE_Creation_Strategy (because + * the user supplies the SVC_HANDLER) or an ACE_Accept_Strategy (because + * this class only accepts one connection and then removes all traces of + * itself from the ACE_Reactor if it was registered for asynchronous + * accepts). + * + * The usage model for ACE_Oneshot_Acceptor is: + * - Instantiate an object and establish its local address to listen at. + * This can be accomplished using either the address-accepting constructor + * (but there's no error indication) or the default constructor followed + * by a call to open(). + * - Call the accept() method. This will attempt to accept a connection + * immediately. If there is no immediately available connection to accept, + * behavior is governed by the ACE_Synch_Options argument passed to open(). + */ +template +class ACE_Oneshot_Acceptor : public ACE_Service_Object +{ +public: + + // Useful STL-style traits. + typedef ACE_PEER_ACCEPTOR_ADDR addr_type; + typedef ACE_PEER_ACCEPTOR acceptor_type; + typedef SVC_HANDLER handler_type; + typedef typename SVC_HANDLER::stream_type stream_type; + + /// Constructor. + ACE_Oneshot_Acceptor (void); + + /** + * Initialize the appropriate strategies for concurrency and then + * open the acceptor at the designated @a local_addr. Note + * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this + * method does NOT register this acceptor with the @a reactor at + * this point -- the @a reactor parameter is saved in case it's + * needed later. + */ + ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + ACE_Reactor *reactor = ACE_Reactor::instance (), + ACE_Concurrency_Strategy * = 0); + + /** + * Initialize the appropriate strategies for concurrency and then + * open the acceptor at the designated @a local_addr. Note + * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this + * method does NOT register this acceptor with the @a reactor at + * this point -- the @a reactor parameter is saved in case it's + * needed later. + */ + int open (const ACE_PEER_ACCEPTOR_ADDR &, + ACE_Reactor *reactor = ACE_Reactor::instance (), + ACE_Concurrency_Strategy * = 0); + + /// Close down the {Oneshot_Acceptor}. + virtual ~ACE_Oneshot_Acceptor (void); + + // = Explicit factory operation. + /// Create a {SVC_HANDLER}, accept the connection into the + /// {SVC_HANDLER}, and activate the {SVC_HANDLER}. + virtual int accept (SVC_HANDLER * = 0, + ACE_PEER_ACCEPTOR_ADDR *remote_addr = 0, + const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, + bool restart = true, + bool reset_new_handle = false); + + /// Cancel a oneshot acceptor that was started asynchronously. + virtual int cancel (void); + + /// Return the underlying {PEER_ACCEPTOR} object. + virtual operator ACE_PEER_ACCEPTOR &() const; + + /// Return the underlying {PEER_ACCEPTOR} object. + virtual ACE_PEER_ACCEPTOR &acceptor (void) const; + + /// Close down the {Oneshot_Acceptor}. + virtual int close (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /** + * Bridge method for activating a {svc_handler} with the appropriate + * concurrency strategy. Default behavior is to activate the + * {SVC_HANDLER} as a "passive object." However, subclasses can + * override this strategy to do more sophisticated concurrency + * activations (such as creating the {SVC_HANDLER} as an "active + * object" via multi-threading or multi-processing). + */ + virtual int activate_svc_handler (SVC_HANDLER *svc_handler); + + /// Factors out the code shared between the {accept} and + /// {handle_input} methods. + int shared_accept (SVC_HANDLER *svc_handler, + ACE_PEER_ACCEPTOR_ADDR *remote_addr, + ACE_Time_Value *timeout, + bool restart, + bool reset_new_handle); + + // = Demultiplexing hooks. + /// Returns the listening acceptor's {ACE_HANDLE}. + virtual ACE_HANDLE get_handle (void) const; + + /// Perform termination activities when {this} is removed from the + /// {reactor}. + virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + /// Accept one connection from a client and activates the + /// SVC_HANDLER. + virtual int handle_input (ACE_HANDLE); + + /// Called when an acceptor times out... + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + // = Dynamic linking hooks. + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int init (int argc, ACE_TCHAR *argv[]); + + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int fini (void); + + /// Default version returns address info in {buf}. + virtual int info (ACE_TCHAR **, size_t) const; + + // = Service management hooks. + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int suspend (void); + + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int resume (void); + +private: + /** + * Insert ourselves into the {ACE_Reactor} so that we can continue + * accepting this connection asynchronously. This method should NOT + * be called by developers directly. + */ + int register_handler (SVC_HANDLER *svc_handler, + const ACE_Synch_Options &options, + bool restart); + + /// Hold the svc_handler_ across asynchrony boundaries. + SVC_HANDLER *svc_handler_; + + /// Hold the restart flag across asynchrony boundaries. + bool restart_; + + /// Factory that establishes connections passively. + ACE_PEER_ACCEPTOR peer_acceptor_; + + /// Concurrency strategy for an Acceptor. + ACE_Concurrency_Strategy *concurrency_strategy_; + + /// true if Acceptor created the concurrency strategy and thus should + /// delete it, else false. + bool delete_concurrency_strategy_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Acceptor.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Acceptor.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ACCEPTOR_H */ diff --git a/externals/ace/Activation_Queue.cpp b/externals/ace/Activation_Queue.cpp new file mode 100644 index 0000000..37be7a4 --- /dev/null +++ b/externals/ace/Activation_Queue.cpp @@ -0,0 +1,138 @@ +#include "ace/Activation_Queue.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Activation_Queue.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" +#include "ace/Method_Request.h" +#include "ace/Malloc_Base.h" +#include "ace/Time_Value.h" + +ACE_RCSID (ace, + Activation_Queue, + "$Id: Activation_Queue.cpp 84565 2009-02-23 08:20:39Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +void +ACE_Activation_Queue::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("delete_queue_ = %d\n"), + this->delete_queue_)); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("queue_:\n"))); + if (this->queue_) + this->queue_->dump(); + else + //FUZZ: disable check_for_NULL + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(NULL)\n"))); + //FUZZ: enable check_for_NULL + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Activation_Queue::ACE_Activation_Queue (ACE_Message_Queue *new_queue, + ACE_Allocator *alloc, + ACE_Allocator *db_alloc) + : delete_queue_ (false) + , allocator_(alloc) + , data_block_allocator_(db_alloc) +{ + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + if (new_queue) + this->queue_ = new_queue; + else + { + ACE_NEW (this->queue_, + ACE_Message_Queue); + this->delete_queue_ = true; + } +} + +void +ACE_Activation_Queue::queue (ACE_Message_Queue *q) +{ + // Destroy the internal queue if one exist. + if (this->delete_queue_) + { + // Destroy the current queue. + delete this->queue_; + + // Set the flag to false. NOTE that the delete_queue_ flag is a + // flag used to only indicate whether or not if an internal + // ACE_Message_Queue has been created, therefore, it will not + // affect the user if the user decided to replace the queue with + // their own queue no matter how many time they call on this + // function. + this->delete_queue_ = false; + } + + queue_ = q; +} + +ACE_Activation_Queue::~ACE_Activation_Queue (void) +{ + if (this->delete_queue_) + delete this->queue_; +} + +ACE_Method_Request * +ACE_Activation_Queue::dequeue (ACE_Time_Value *tv) +{ + ACE_Message_Block *mb = 0; + + // Dequeue the message. + if (this->queue_->dequeue_head (mb, tv) != -1) + { + // Get the next . + ACE_Method_Request *mr = + reinterpret_cast (mb->base ()); + // Delete the message block. + mb->release (); + return mr; + } + else + return 0; +} + +int +ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, + ACE_Time_Value *tv) +{ + ACE_Message_Block *mb = 0; + + // We pass sizeof (*mr) here so that flow control will work + // correctly. Since we also pass note that no unnecessary + // memory is actually allocated -- just the size field is set. + ACE_NEW_MALLOC_RETURN (mb, + static_cast (this->allocator_->malloc (sizeof (ACE_Message_Block))), + ACE_Message_Block (sizeof (*mr), // size + ACE_Message_Block::MB_DATA, // type + 0, // cont + (char *) mr, // data + 0, // allocator + 0, // locking strategy + mr->priority (), // priority + ACE_Time_Value::zero, // execution time + ACE_Time_Value::max_time, // absolute time of deadline + this->data_block_allocator_, // data_block allocator + this->allocator_), // message_block allocator + -1); + + // Enqueue in priority order. + int const result = this->queue_->enqueue_prio (mb, tv); + + // Free ACE_Message_Block if enqueue_prio failed. + if (result == -1) + ACE_DES_FREE (mb, this->allocator_->free, ACE_Message_Block); + + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Activation_Queue.h b/externals/ace/Activation_Queue.h new file mode 100644 index 0000000..4546404 --- /dev/null +++ b/externals/ace/Activation_Queue.h @@ -0,0 +1,173 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Activation_Queue.h + * + * $Id: Activation_Queue.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Andres Kruse + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ACTIVATION_QUEUE_H +#define ACE_ACTIVATION_QUEUE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Message_Queue.h" +#include "ace/Condition_Thread_Mutex.h" + +/// Define to be compatible with the terminology in the POSA2 book! +#define ACE_Activation_List ACE_Activation_Queue + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Method_Request; + +/** + * @class ACE_Activation_Queue + * + * @brief Reifies a method into a request. Subclasses typically + * represent necessary state and behavior. + * + * Maintains a priority-ordered queue of ACE_Method_Request objects. + * A scheduler class (often derived from ACE_Task) subsequently removes + * each method request and invokes its @c call() method. + * + * This class is discussed in depth in the Active Object chapter + * of POSA2. In that book, it is referred to as an Activation List. + * + * @sa ACE_Method_Request + */ +class ACE_Export ACE_Activation_Queue +{ +public: + // = Initialization and termination methods. + /// Constructor. + /** + * Initializes a new activation queue. + * + * @param new_queue The activation queue uses an ACE_Message_Queue to + * queue and order the method requests. If this argument + * is 0, a new ACE_Message_Queue is created for this + * object's use and will be deleted when this object is + * destroyed. If a non-zero pointer is supplied, the + * passed object will be used and will not be deleted when + * this object is destroyed. If an ACE_Task is being created + * to act as the scheduler, for instance, its + * ACE_Message_Queue pointer can be passed to this object. + * @param alloc Optional, the allocator to use when allocating + * ACE_Message_Block instances that wrap the method requests + * queued to this activation queue. Defaults to + * ACE_Allocator::instance(). + * @param db_alloc Optional, the allocator to use when allocating + * data blocks for the ACE_Message_Block instances that + * wrap the method requests queued to this activation queue. + * Defaults to ACE_Allocator::instance(). + */ + ACE_Activation_Queue (ACE_Message_Queue *new_queue = 0, + ACE_Allocator *alloc = 0, + ACE_Allocator *db_alloc = 0); + + /// Destructor. + virtual ~ACE_Activation_Queue (void); + + // = Activate Queue operations. + + /// Dequeue the next available ACE_Method_Request. + /** + * @param tv If 0, the method will block until a method request is + * available, else will wait until the absolute time specified + * in the referenced ACE_Time_Value. This method will return, + * earlier, however, if queue is closed, deactivated, or when + * a signal occurs. + * + * @retval Pointer to the dequeued ACE_Method_Request object. + * @retval 0 an error occurs; errno contains further information. If + * the specified timeout elapses, errno will be @c EWOULDBLOCK. + */ + ACE_Method_Request *dequeue (ACE_Time_Value *tv = 0); + + /// Enqueue the ACE_Method_Request in priority order. + /** + * The priority of the method request is obtained via the @c priority() + * method of the queued method request. Priority ordering is determined + * by the ACE_Message_Queue class; 0 is the lowest priority. + * + * @param new_method_request Pointer to the ACE_Method_Request object to + * queue. This object's @c priority() method is called to obtain + * the priority. + * @param tv If 0, the method will block until the method request can + * be queued, else will wait until the absolute time specified + * in the referenced ACE_Time_Value. This method will return, + * earlier, however, if queue is closed, deactivated, or when + * a signal occurs. + * + * @retval >0 The number of method requests on the queue after adding + * the specified request. + * @retval -1 if an error occurs; errno contains further information. If + * the specified timeout elapses, errno will be @c EWOULDBLOCK. + */ + int enqueue (ACE_Method_Request *new_method_request, ACE_Time_Value *tv = 0); + + /// Get the current number of method objects in the queue. + size_t method_count (void) const; + + /// Returns 1 if the queue is empty, 0 otherwise. + int is_empty (void) const; + + /// Returns 1 if the queue is full, 0 otherwise. + int is_full (void) const; + + /// Dump the state of an request. + void dump (void) const; + + /// Get a pointer to the underlying queue. + ACE_Message_Queue *queue (void) const; + + /// Set the pointer to the underlying queue. + void queue (ACE_Message_Queue *q); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + // = Prevent copying and assignment. + ACE_Activation_Queue (const ACE_Activation_Queue &); + void operator= (const ACE_Activation_Queue &); + +protected: + + /// Stores the Method_Requests. + ACE_Message_Queue *queue_; + + /// Keeps track of whether we need to delete the queue. + bool delete_queue_; + +private: + + /// Allocation strategy of the queue. + ACE_Allocator *allocator_; + + /// Allocation strategy of the message blocks. + ACE_Allocator *data_block_allocator_; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Activation_Queue.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_ACTIVATION_QUEUE_H */ diff --git a/externals/ace/Activation_Queue.inl b/externals/ace/Activation_Queue.inl new file mode 100644 index 0000000..4c0ffc0 --- /dev/null +++ b/externals/ace/Activation_Queue.inl @@ -0,0 +1,31 @@ +// -*- C++ -*- +// +// $Id: Activation_Queue.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE size_t +ACE_Activation_Queue::method_count (void) const +{ + return queue_->message_count (); +} + +ACE_INLINE int +ACE_Activation_Queue::is_full (void) const +{ + return queue_->is_full (); +} + +ACE_INLINE int +ACE_Activation_Queue::is_empty (void) const +{ + return queue_->is_empty (); +} + +ACE_INLINE ACE_Message_Queue * +ACE_Activation_Queue::queue (void) const +{ + return queue_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Active_Map_Manager.cpp b/externals/ace/Active_Map_Manager.cpp new file mode 100644 index 0000000..6ec891b --- /dev/null +++ b/externals/ace/Active_Map_Manager.cpp @@ -0,0 +1,9 @@ +// $Id: Active_Map_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Active_Map_Manager.h" + +ACE_RCSID(ace, Active_Map_Manager, "$Id: Active_Map_Manager.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if !defined (__ACE_INLINE__) +#include "ace/Active_Map_Manager.inl" +#endif /* __ACE_INLINE__ */ diff --git a/externals/ace/Active_Map_Manager.h b/externals/ace/Active_Map_Manager.h new file mode 100644 index 0000000..744abc0 --- /dev/null +++ b/externals/ace/Active_Map_Manager.h @@ -0,0 +1,116 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Active_Map_Manager.h + * + * $Id: Active_Map_Manager.h 83956 2008-12-03 07:57:38Z johnnyw $ + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#ifndef ACE_ACTIVE_MAP_MANAGER_H +#define ACE_ACTIVE_MAP_MANAGER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Basic_Types.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Active_Map_Manager_Key + * + * @brief Key used in the Active Object Map. + * + * This key keeps information of the index and the generation + * count of the slot it represents. Since the index information + * is part of the key, lookups are super fast and predictable, + */ +class ACE_Export ACE_Active_Map_Manager_Key +{ +public: + /// Default constructor. + ACE_Active_Map_Manager_Key (void); + + /** + * Constructor given the @a slot_index and @a slot_generation number. + * This is useful once the user has somehow recovered the + * @a slot_index and @a slot_generation number from the client. + */ + ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index, + ACE_UINT32 slot_generation); + + /// Get the slot_index. + ACE_UINT32 slot_index (void) const; + + /// Set the slot_index. + void slot_index (ACE_UINT32 i); + + /// Get the slot_generation number. + ACE_UINT32 slot_generation (void) const; + + /// Set the slot_generation number. + void slot_generation (ACE_UINT32 g); + + /// Size required to store information about active key. + static size_t size (void); + + /// Recover state of active key from @a data. User must make sure + /// that @a data encoded using the encode() method. + void decode (const void *data); + + /// Encode state of the active key into @a data. @a data must be as + /// big as the value returned from . + void encode (void *data) const; + + /// Compare keys. + bool operator== (const ACE_Active_Map_Manager_Key &rhs) const; + bool operator!= (const ACE_Active_Map_Manager_Key &rhs) const; + + // = This really should be protected but because of template + // friends, they are not. + + /// Increment the slot_generation number. + void increment_slot_generation_count (void); + +private: + + /** + * @brief Data for the Active Object Map Key. + * + * This separate structure makes it easier to manage copying + * the index and the generation to and from the user buffer. + * + */ + struct key_data + { + /// Slot index in the active map. + ACE_UINT32 slot_index_; + + /// Slot generation number of slot in the active map. + ACE_UINT32 slot_generation_; + }; + + /// Data for the Active Object Map Key. + key_data key_data_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Active_Map_Manager.inl" +#endif /* __ACE_INLINE__ */ + +// Include the templates here. +#include "ace/Active_Map_Manager_T.h" + +#include /**/ "ace/post.h" +#endif /* ACE_ACTIVE_MAP_MANAGER_H */ diff --git a/externals/ace/Active_Map_Manager.inl b/externals/ace/Active_Map_Manager.inl new file mode 100644 index 0000000..df90ada --- /dev/null +++ b/externals/ace/Active_Map_Manager.inl @@ -0,0 +1,95 @@ +// -*- C++ -*- +// +// $Id: Active_Map_Manager.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void) +{ + // If you change ~0, please change ACE_Map_Manager::free_list_id() + // accordingly. + this->key_data_.slot_index_ = (ACE_UINT32) ~0; + this->key_data_.slot_generation_ = 0; +} + +ACE_INLINE +ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index, + ACE_UINT32 slot_generation) +{ + this->key_data_.slot_index_ = slot_index; + this->key_data_.slot_generation_ = slot_generation; +} + +ACE_INLINE ACE_UINT32 +ACE_Active_Map_Manager_Key::slot_index (void) const +{ + return this->key_data_.slot_index_; +} + +ACE_INLINE ACE_UINT32 +ACE_Active_Map_Manager_Key::slot_generation (void) const +{ + return this->key_data_.slot_generation_; +} + +ACE_INLINE bool +ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) const +{ + return + this->key_data_.slot_index_ == rhs.key_data_.slot_index_ && + this->key_data_.slot_generation_ == rhs.key_data_.slot_generation_; +} + +ACE_INLINE bool +ACE_Active_Map_Manager_Key::operator!= (const ACE_Active_Map_Manager_Key &rhs) const +{ + return !this->operator== (rhs); +} + +ACE_INLINE void +ACE_Active_Map_Manager_Key::slot_index (ACE_UINT32 i) +{ + this->key_data_.slot_index_ = i; +} + +ACE_INLINE void +ACE_Active_Map_Manager_Key::slot_generation (ACE_UINT32 g) +{ + this->key_data_.slot_generation_ = g; +} + +ACE_INLINE void +ACE_Active_Map_Manager_Key::increment_slot_generation_count (void) +{ + ++this->key_data_.slot_generation_; +} + +/* static */ +ACE_INLINE size_t +ACE_Active_Map_Manager_Key::size (void) +{ + return sizeof (ACE_UINT32) + sizeof (ACE_UINT32); +} + +ACE_INLINE void +ACE_Active_Map_Manager_Key::decode (const void *data) +{ + // Copy the information from the user buffer into the key. + ACE_OS::memcpy (&this->key_data_, + data, + sizeof this->key_data_); +} + +ACE_INLINE void +ACE_Active_Map_Manager_Key::encode (void *data) const +{ + // Copy the key data to the user buffer. + ACE_OS::memcpy (data, + &this->key_data_, + sizeof this->key_data_); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Active_Map_Manager_T.cpp b/externals/ace/Active_Map_Manager_T.cpp new file mode 100644 index 0000000..732cc29 --- /dev/null +++ b/externals/ace/Active_Map_Manager_T.cpp @@ -0,0 +1,22 @@ +// $Id: Active_Map_Manager_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_ACTIVE_MAP_MANAGER_T_CPP +#define ACE_ACTIVE_MAP_MANAGER_T_CPP + +#include "ace/Active_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Active_Map_Manager_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Active_Map_Manager) + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ACTIVE_MAP_MANAGER_T_CPP */ diff --git a/externals/ace/Active_Map_Manager_T.h b/externals/ace/Active_Map_Manager_T.h new file mode 100644 index 0000000..80eaada --- /dev/null +++ b/externals/ace/Active_Map_Manager_T.h @@ -0,0 +1,211 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Active_Map_Manager_T.h + * + * $Id: Active_Map_Manager_T.h 84316 2009-02-03 19:46:05Z johnnyw $ + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#ifndef ACE_ACTIVE_MAP_MANAGER_T_H +#define ACE_ACTIVE_MAP_MANAGER_T_H +#include /**/ "ace/pre.h" + +#include "ace/Map_Manager.h" +#include "ace/Active_Map_Manager.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Null_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Active_Map_Manager + * + * @brief Define a map abstraction that associates system generated + * keys with user specified values. + * + * Since the key is system generated, searches are very fast and + * take a constant amount of time. + */ +template +class ACE_Active_Map_Manager : public ACE_Map_Manager +{ +public: + + // = Traits. + typedef ACE_Active_Map_Manager_Key key_type; + typedef T mapped_type; + + typedef ACE_Map_Entry ENTRY; + typedef ACE_Map_Iterator ITERATOR; + typedef ACE_Map_Reverse_Iterator REVERSE_ITERATOR; + + typedef ENTRY entry; + typedef ITERATOR iterator; + typedef REVERSE_ITERATOR reverse_iterator; + + // = Initialization and termination methods. + /// Initialize a Active_Map_Manager with the ACE_DEFAULT_MAP_SIZE. + ACE_Active_Map_Manager (ACE_Allocator *alloc = 0); + + /// Initialize a Active_Map_Manager with @a size entries. + ACE_Active_Map_Manager (size_t size, + ACE_Allocator *alloc = 0); + + /// Close down a Active_Map_Manager and release dynamically + /// allocated resources. + ~ACE_Active_Map_Manager (void); + + /// Initialize a Active_Map_Manager with size @a length. + int open (size_t length = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + + /// Close down a Active_Map_Manager and release dynamically + /// allocated resources. + int close (void); + + /// Add @a value to the map, and the corresponding key produced by the + /// Active_Map_Manager is returned through @a key. + int bind (const T &value, + ACE_Active_Map_Manager_Key &key); + + /// Add @a value to the map. The user does not care about the + /// corresponding key produced by the Active_Map_Manager. + int bind (const T &value); + + /** + * Reserves a slot in the internal structure and returns the key and + * a pointer to the value. User should place their @a value into + * @a internal_value. This method is useful in reducing the number + * of copies required in some cases. Note that @a internal_value is + * only a temporary pointer and will change when the map resizes. + * Therefore, the user should use the pointer immediately and not + * hold on to it. + */ + int bind (ACE_Active_Map_Manager_Key &key, + T *&internal_value); + + /// Reassociate @a key with @a value. The function fails if @a key is + /// not in the map. + int rebind (const ACE_Active_Map_Manager_Key &key, + const T &value); + + /** + * Reassociate @a key with @a value, storing the old value into the + * "out" parameter @a old_value. The function fails if @a key is not + * in the map. + */ + int rebind (const ACE_Active_Map_Manager_Key &key, + const T &value, + T &old_value); + + /** + * Reassociate @a key with @a value, storing the old key and value + * into the "out" parameter @a old_key and @a old_value. The function + * fails if @a key is not in the map. + */ + int rebind (const ACE_Active_Map_Manager_Key &key, + const T &value, + ACE_Active_Map_Manager_Key &old_key, + T &old_value); + + /// Locate @a value associated with @a key. + int find (const ACE_Active_Map_Manager_Key &key, + T &value) const; + + /// Is @a key in the map? + int find (const ACE_Active_Map_Manager_Key &key) const; + + /** + * Locate @a value associated with @a key. The value is returned via + * @a internal_value and hence a copy is saved. Note that + * @a internal_value is only a temporary pointer and will change when + * the map resizes. Therefore, the user should use the pointer + * immediately and not hold on to it. + */ + int find (const ACE_Active_Map_Manager_Key &key, + T *&internal_value) const; + + // Creates a key. User should place their @a value into + // <*internal_value>. This method is useful in reducing the number + // of copies required in some cases. + + /// Remove @a key from the map. + int unbind (const ACE_Active_Map_Manager_Key &key); + + /// Remove @a key from the map, and return the @a value associated with + /// @a key. + int unbind (const ACE_Active_Map_Manager_Key &key, + T &value); + + /** + * Locate @a value associated with @a key. The value is returned via + * @a internal_value and hence a copy is saved. Note that + * @a internal_value is only a temporary pointer and will change when + * the map resizes or when this slot is reused. Therefore, the user + * should use the pointer immediately and not hold on to it. + */ + int unbind (const ACE_Active_Map_Manager_Key &key, + T *&internal_value); + + /// Return the current size of the map. + size_t current_size (void) const; + + /// Return the total size of the map. + size_t total_size (void) const; + + /// Returns a key that cannot be found in the map. + static const ACE_Active_Map_Manager_Key npos (void); + + /// Dump the state of an object. + void dump (void) const; + + // = STL styled iterator factory functions. + + /// Return forward iterator. + ACE_Map_Iterator begin (void); + ACE_Map_Iterator end (void); + + /// Return reverse iterator. + ACE_Map_Reverse_Iterator rbegin (void); + ACE_Map_Reverse_Iterator rend (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + + /// Private base class + typedef ACE_Map_Manager ACE_AMM_BASE; + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager (const ACE_Active_Map_Manager &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Active_Map_Manager_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Active_Map_Manager_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Active_Map_Manager_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_ACTIVE_MAP_MANAGER_T_H */ diff --git a/externals/ace/Active_Map_Manager_T.inl b/externals/ace/Active_Map_Manager_T.inl new file mode 100644 index 0000000..647b55e --- /dev/null +++ b/externals/ace/Active_Map_Manager_T.inl @@ -0,0 +1,311 @@ +// -*- C++ -*- +// +// $Id: Active_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE int +ACE_Active_Map_Manager::bind (ACE_Active_Map_Manager_Key &key, + T *&internal_value) +{ + ACE_UINT32 slot_index; + int result = this->next_free (slot_index); + + if (result == 0) + { + // Move from free list to occupied list + this->move_from_free_list_to_occupied_list (slot_index); + + // Reset the key. + this->search_structure_[slot_index].ext_id_.increment_slot_generation_count (); + this->search_structure_[slot_index].ext_id_.slot_index (slot_index); + + // Copy the key for the user. + key = this->search_structure_[slot_index].ext_id_; + + // This is where the user should place the value. + internal_value = &this->search_structure_[slot_index].int_id_; + + // Update the current size. + ++this->cur_size_; + } + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::bind (const T &value, + ACE_Active_Map_Manager_Key &key) +{ + T *internal_value = 0; + int result = this->bind (key, + internal_value); + + if (result == 0) + { + // Store new value. + *internal_value = value; + } + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::bind (const T &value) +{ + ACE_Active_Map_Manager_Key key; + return this->bind (value, key); +} + +template ACE_INLINE int +ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key, + T *&internal_value) const +{ + ACE_UINT32 slot_index = key.slot_index (); + ACE_UINT32 slot_generation = key.slot_generation (); + + if (slot_index > this->total_size_ || +#if defined (ACE_HAS_LAZY_MAP_MANAGER) + this->search_structure_[slot_index].free_ || +#endif /* ACE_HAS_LAZY_MAP_MANAGER */ + this->search_structure_[slot_index].ext_id_.slot_generation () != slot_generation || + this->search_structure_[slot_index].ext_id_.slot_index () == + (ACE_UINT32)this->free_list_id ()) + { + return -1; + } + else + { + // This is where the user value is. + internal_value = &this->search_structure_[slot_index].int_id_; + } + + return 0; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key) const +{ + T *internal_value = 0; + return this->find (key, + internal_value); +} + +template ACE_INLINE int +ACE_Active_Map_Manager::find (const ACE_Active_Map_Manager_Key &key, + T &value) const +{ + T *internal_value = 0; + int result = this->find (key, + internal_value); + + if (result == 0) + value = *internal_value; + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, + const T &value) +{ + int result = this->find (key); + + if (result == 0) + { + // Store new value. + this->search_structure_[key.slot_index ()].int_id_ = value; + } + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, + const T &value, + T &old_value) +{ + int result = this->find (key); + + if (result == 0) + { + // Copy old value. + old_value = this->search_structure_[key.slot_index ()].int_id_; + + // Store new value. + this->search_structure_[key.slot_index ()].int_id_ = value; + } + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::rebind (const ACE_Active_Map_Manager_Key &key, + const T &value, + ACE_Active_Map_Manager_Key &old_key, + T &old_value) +{ + int result = this->find (key); + + if (result == 0) + { + // Copy old key. + old_key = this->search_structure_[key.slot_index ()].ext_id_; + + // Copy old value. + old_value = this->search_structure_[key.slot_index ()].int_id_; + + // Store new value. + this->search_structure_[key.slot_index ()].int_id_ = value; + } + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key, + T *&internal_value) +{ + int result = this->find (key, + internal_value); + + if (result == 0) + { + ACE_UINT32 slot_index = key.slot_index (); + +#if defined (ACE_HAS_LAZY_MAP_MANAGER) + + // + // In the case of lazy map managers, the movement of free slots + // from the occupied list to the free list is delayed until we + // run out of free slots in the free list. + // + + this->search_structure_[slot_index].free_ = 1; + +#else + + // Move from occupied list to free list. + this->move_from_occupied_list_to_free_list (slot_index); + +#endif /* ACE_HAS_LAZY_MAP_MANAGER */ + + // Reset the slot_index. This will tell us that this entry is free. + this->search_structure_[slot_index].ext_id_.slot_index (this->free_list_id ()); + + // Update the current size. + --this->cur_size_; + } + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key, + T &value) +{ + T *internal_value; + int result = this->unbind (key, + internal_value); + + if (result == 0) + { + // Copy old value. + value = *internal_value; + } + + return result; +} + +template ACE_INLINE int +ACE_Active_Map_Manager::unbind (const ACE_Active_Map_Manager_Key &key) +{ + T *internal_value; + return this->unbind (key, + internal_value); +} + +template ACE_INLINE +ACE_Active_Map_Manager::ACE_Active_Map_Manager (ACE_Allocator *alloc) + : ACE_AMM_BASE (alloc) +{ +} + +template ACE_INLINE +ACE_Active_Map_Manager::ACE_Active_Map_Manager (size_t size, + ACE_Allocator *alloc) + : ACE_AMM_BASE (size, + alloc) +{ +} + +template ACE_INLINE +ACE_Active_Map_Manager::~ACE_Active_Map_Manager (void) +{ +} + +template ACE_INLINE int +ACE_Active_Map_Manager::open (size_t length, + ACE_Allocator *alloc) +{ + return ACE_AMM_BASE::open (length, alloc); +} + +template ACE_INLINE int +ACE_Active_Map_Manager::close (void) +{ + return ACE_AMM_BASE::close (); +} + +template ACE_INLINE size_t +ACE_Active_Map_Manager::current_size (void) const +{ + return ACE_AMM_BASE::current_size (); +} + +template ACE_INLINE size_t +ACE_Active_Map_Manager::total_size (void) const +{ + return ACE_AMM_BASE::total_size (); +} + +/* static */ +template ACE_INLINE const ACE_Active_Map_Manager_Key +ACE_Active_Map_Manager::npos (void) +{ + return ACE_Active_Map_Manager_Key (~0, ~0); +} + +template ACE_INLINE void +ACE_Active_Map_Manager::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_AMM_BASE::dump (); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_Map_Iterator +ACE_Active_Map_Manager::begin (void) +{ + return ACE_AMM_BASE::begin (); +} + +template ACE_INLINE ACE_Map_Iterator +ACE_Active_Map_Manager::end (void) +{ + return ACE_AMM_BASE::end (); +} + +template ACE_INLINE ACE_Map_Reverse_Iterator +ACE_Active_Map_Manager::rbegin (void) +{ + return ACE_AMM_BASE::rbegin (); +} + +template ACE_INLINE ACE_Map_Reverse_Iterator +ACE_Active_Map_Manager::rend (void) +{ + return ACE_AMM_BASE::rend (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Addr.cpp b/externals/ace/Addr.cpp new file mode 100644 index 0000000..af78d91 --- /dev/null +++ b/externals/ace/Addr.cpp @@ -0,0 +1,71 @@ +// $Id: Addr.cpp 84619 2009-02-26 12:26:16Z johnnyw $ + +#include "ace/Addr.h" + +ACE_RCSID (ace, + Addr, + "$Id: Addr.cpp 84619 2009-02-26 12:26:16Z johnnyw $") + +#if !defined (__ACE_INLINE__) +#include "ace/Addr.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" +#include "ace/os_include/sys/os_socket.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Note: this object requires static construction and destruction. +/* static */ +const ACE_Addr ACE_Addr::sap_any (AF_ANY, -1); + +ACE_ALLOC_HOOK_DEFINE(ACE_Addr) + + +// Initializes instance variables. Note that 0 is an unspecified +// protocol family type... + +ACE_Addr::ACE_Addr (int type, int size) : + addr_type_ (type), + addr_size_ (size) +{ +} + +ACE_Addr::~ACE_Addr (void) +{ +} + +void * +ACE_Addr::get_addr (void) const +{ + return 0; +} + +void +ACE_Addr::set_addr (void *, int) +{ +} + +// Initializes instance variables. + +void +ACE_Addr::base_set (int type, int size) +{ + this->addr_type_ = type; + this->addr_size_ = size; +} + +void +ACE_Addr::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Addr::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("addr_type_ = %d"), this->addr_type_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\naddr_size_ = %d"), this->addr_size_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Addr.h b/externals/ace/Addr.h new file mode 100644 index 0000000..e58ffe2 --- /dev/null +++ b/externals/ace/Addr.h @@ -0,0 +1,103 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Addr.h + * + * $Id: Addr.h 81030 2008-03-20 12:43:29Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ADDR_H +#define ACE_ADDR_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Addr + * + * @brief Defines the base class for the "address family independent" + * address format. + */ +class ACE_Export ACE_Addr +{ +public: + // = Initialization and termination methods. + /// Initializes instance variables. + ACE_Addr (int type = -1, int size = -1); + + /// Destructor. + virtual ~ACE_Addr (void); + + // = Get/set the size of the address. + + /// Return the size of the address. + int get_size (void) const; + + /// Sets the size of the address. + void set_size (int size); + + // = Get/set the type of the address. + + /// Get the type of the address. + int get_type (void) const; + + /// Set the type of the address. + void set_type (int type); + + /// Return a pointer to the address. + virtual void *get_addr (void) const; + + /// Set a pointer to the address. + virtual void set_addr (void *, int len); + + // = Equality/inequality tests + /// Check for address equality. + bool operator == (const ACE_Addr &sap) const; + + /// Check for address inequality. + bool operator != (const ACE_Addr &sap) const; + + /// Initializes instance variables. + void base_set (int type, int size); + + /// Wild-card address. + static const ACE_Addr sap_any; + + /// Returns a hash value. This should be overwritten by a subclass + /// that can produce a better hash value. + virtual unsigned long hash (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// e.g., AF_UNIX, AF_INET, AF_SPIPE, etc. + int addr_type_; + + /// Number of bytes in the address. + int addr_size_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Addr.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ADDR_H */ diff --git a/externals/ace/Addr.inl b/externals/ace/Addr.inl new file mode 100644 index 0000000..0ff355e --- /dev/null +++ b/externals/ace/Addr.inl @@ -0,0 +1,57 @@ +// -*- C++ -*- +// +// $Id: Addr.inl 87295 2009-11-02 14:45:59Z johnnyw $ + +// Return the address of the address. + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE bool +ACE_Addr::operator == (const ACE_Addr &sap) const +{ + return (sap.addr_type_ == this->addr_type_ && + sap.addr_size_ == this->addr_size_ ); +} + +ACE_INLINE bool +ACE_Addr::operator != (const ACE_Addr &sap) const +{ + return (sap.addr_type_ != this->addr_type_ || + sap.addr_size_ != this->addr_size_ ); +} + +/// Return the size of the address. +ACE_INLINE int +ACE_Addr::get_size (void) const +{ + return this->addr_size_; +} + +/// Sets the size of the address. +ACE_INLINE void +ACE_Addr::set_size (int size) +{ + this->addr_size_ = size; +} + +/// Return the type of the address. +ACE_INLINE int +ACE_Addr::get_type (void) const +{ + return this->addr_type_; +} + +/// Set the type of the address. +ACE_INLINE void +ACE_Addr::set_type (int type) +{ + this->addr_type_ = type; +} + +ACE_INLINE unsigned long +ACE_Addr::hash (void) const +{ + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Arg_Shifter.cpp b/externals/ace/Arg_Shifter.cpp new file mode 100644 index 0000000..5a7182c --- /dev/null +++ b/externals/ace/Arg_Shifter.cpp @@ -0,0 +1,229 @@ +#ifndef ACE_ARG_SHIFTER_T_CPP +#define ACE_ARG_SHIFTER_T_CPP + +#include "ace/Arg_Shifter.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_strings.h" +#include "ace/OS_Errno.h" +#include "ace/OS_Memory.h" + +ACE_RCSID (ace, + Arg_Shifter, + "$Id: Arg_Shifter.cpp 83749 2008-11-14 18:39:10Z johnnyw $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int& argc, + const CHAR_TYPE** argv, + const CHAR_TYPE** temp) + : argc_ (argc), + total_size_ (argc), + temp_ (temp), + argv_ (argv), + current_index_ (0), + back_ (argc - 1), + front_ (0) +{ + this->init (); +} + +template +ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int& argc, + CHAR_TYPE** argv, + CHAR_TYPE** temp) + : argc_ (argc), + total_size_ (argc), + temp_ ((const CHAR_TYPE **) temp), + argv_ ((const CHAR_TYPE **) argv), + current_index_ (0), + back_ (argc - 1), + front_ (0) +{ + this->init (); +} + +template +void +ACE_Arg_Shifter_T::init (void) +{ + // If not provided with one, allocate a temporary array. + if (this->temp_ == 0) + ACE_NEW (this->temp_, + const CHAR_TYPE *[this->total_size_]); + + if (this->temp_ != 0) + { + // Fill the temporary array. + this->argc_ = 0; + for (int i = 0; i < this->total_size_; i++) + { + this->temp_[i] = this->argv_[i]; + this->argv_[i] = 0; + } + } + else + { + // Allocation failed, prohibit iteration. + this->current_index_ = this->argc_; + this->front_ = this->argc_; + } +} + +template +ACE_Arg_Shifter_T::~ACE_Arg_Shifter_T (void) +{ + // Delete the temporary vector. + delete [] temp_; +} + +template +const CHAR_TYPE * +ACE_Arg_Shifter_T::get_current (void) const +{ + const CHAR_TYPE * retval = 0; + + if (this->is_anything_left ()) + retval = this->temp_[current_index_]; + + return retval; +} + +template +const CHAR_TYPE * +ACE_Arg_Shifter_T::get_the_parameter (const CHAR_TYPE *flag) +{ + // the return 0's abound because this method + // would otherwise be a deep if { } else { } + + // check to see if any arguments still exist + if (!this->is_anything_left()) + return 0; + + // check to see if the flag is the argument + int const offset = this->cur_arg_strncasecmp (flag); + if (offset == -1) + return 0; + + if (offset == 0) + { + this->consume_arg (); + + if (!this->is_parameter_next()) + { + return 0; + } + } + // the parameter is in the middle somewhere... + return this->temp_[current_index_] + offset; +} + +template +int +ACE_Arg_Shifter_T::cur_arg_strncasecmp (const CHAR_TYPE *flag) +{ + // Check for a current argument + if (this->is_anything_left()) + { + size_t const flag_length = ACE_OS::strlen (flag); + + // Check for presence of the flag + if (ACE_OS::strncasecmp(this->temp_[current_index_], + flag, + flag_length) == 0) + { + if (ACE_OS::strlen(temp_[current_index_]) == flag_length) + { + // match and lengths are equal + return 0; + } + else + { + // matches, with more info to boot! + size_t const remaining = ACE_OS::strspn + (this->temp_[current_index_] + flag_length, + ACE_TEXT (" ")) + flag_length; + return static_cast (remaining); + } + } + } + // failure + return -1; +} + +template +int +ACE_Arg_Shifter_T::consume_arg (int number) +{ + int retval = 0; + + // Stick knowns at the end of the vector (consumed). + if (this->is_anything_left() >= number) + { + for (int i = 0, j = this->back_ - (number - 1); + i < number; + ++i, ++j, ++this->current_index_) + this->argv_[j] = this->temp_[this->current_index_]; + + this->back_ -= number; + retval = 1; + } + + return retval; +} + +template +int +ACE_Arg_Shifter_T::ignore_arg (int number) +{ + int retval = 0; + + // Keep unknowns at the head of the vector. + if (this->is_anything_left () >= number) + { + for (int i = 0; + i < number; + i++, this->current_index_++, this->front_++) + this->argv_[this->front_] = this->temp_[this->current_index_]; + + retval = 1; + this->argc_ += number; + } + + return retval; +} + +template +int +ACE_Arg_Shifter_T::is_anything_left (void) const +{ + return this->total_size_ - this->current_index_; +} + +template +int +ACE_Arg_Shifter_T::is_option_next (void) const +{ + return this->is_anything_left () && + this->temp_[this->current_index_][0] == '-'; +} + +template +int +ACE_Arg_Shifter_T::is_parameter_next (void) const +{ + return this->is_anything_left () + && this->temp_[this->current_index_][0] != '-'; +} + +template +int +ACE_Arg_Shifter_T::num_ignored_args (void) const +{ + return this->front_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ATOMIC_OP_T_CPP */ diff --git a/externals/ace/Arg_Shifter.h b/externals/ace/Arg_Shifter.h new file mode 100644 index 0000000..2e5f0b0 --- /dev/null +++ b/externals/ace/Arg_Shifter.h @@ -0,0 +1,221 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Arg_Shifter.h + * + * $Id: Arg_Shifter.h 83891 2008-11-28 11:01:50Z johnnyw $ + * + * @author Seth Widoff + */ +//============================================================================= + +#ifndef ACE_ARG_SHIFTER_H +#define ACE_ARG_SHIFTER_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Arg_Shifter_T + * + * @brief This ADT operates on a specified set of arguments (@a argv). + * As known arguments are scanned, they are shifted to the back of the + * @a argv vector, so deeper levels of argument parsing can locate the yet + * unprocessed arguments at the beginning of the vector. + * + * The @c ACE_Arg_Shifter copies the pointers of the @a argv vector + * into a temporary array. As the @c ACE_Arg_Shifter iterates over + * the copied vector, it places known arguments in the rear of the + * vector, leaving the unknown ones in the beginning. So, after having + * visited all the arguments in the temporary vector, @c ACE_Arg_Shifter + * has placed all the unknown arguments in their original order at + * the front of original @a argv. + */ +template +class ACE_Arg_Shifter_T +{ +public: + // = Initialization and termination methods. + /** + * Initialize the ACE_Arg_Shifter to the vector over which to + * iterate. Optionally, also provide the temporary array for + * use in shifting the arguments. If ACE_Arg_Shifter must allocate + * the temporary vector internally and dynamic allocation fails, the + * ACE_Arg_Shifter will set all indicators to end of the vector, + * forbidding iteration. Following iteration over @a argv, the + * @a argc value will be updated to contain the number of + * unconsumed arguments. + * @param argc The number of strings in @a argv. @a argc will be + * updated to reflect the number of unconsumed arguments. + * @param argv The argument vector to shift. The string pointers in + * the vector will be reordered to place the @a argc unconsumed + * arguments at the front of the vector. + * @param temp A vector of @c CHAR_TYPE pointers at least @a argc + * elements long. The vector will be used for argument shifting as + * the specified @a argv vector is consumed. The vector must not + * be modified while this object exists. If this argument is 0 + * (the default) the object will allocate and free the temporary + * vector transparently. + */ + ACE_Arg_Shifter_T (int& argc, + const CHAR_TYPE **argv, + const CHAR_TYPE **temp = 0); + + /// Same behavior as the preceding constructor, but without the + /// "const" qualifier. + ACE_Arg_Shifter_T (int& argc, + CHAR_TYPE **argv, + CHAR_TYPE **temp = 0); + + /// Destructor. + ~ACE_Arg_Shifter_T (void); + + /// Get the current head of the vector. + const CHAR_TYPE *get_current (void) const; + + /** + * If the @a flag matches the current_arg of arg shifter + * this method will attempt to return the associated + * parameter value + * + * Safe to call without checking that a current arg exists + * + * In the following examples, a pointer to the char* "value" is ret + * + * eg: main -foobar value, main -FooBar value + * main -FOOBARvalue + * + * all of the above will all match the @a flag == -FooBar + * and will return a char* to "value" + * + * main -foobar 4 would succeed and return a char* to "4" + * main -foobar -4 does not succeed (-4 is not a parameter) + * but instead, would return 0 + * + * 0 is returned: + * If the current argument does not match flag + * If there is no parameter found after a 'matched' flag + * + * If the flag is matched and the flag and parameter DO NOT RUN + * together, the flag is consumed, the parameter is returned, + * and the new current argument is the parameter value. + * ie '-foobarflag VALUE' leaves the new cur arg == "VALUE" + * + * If the flag is matched and the flag and parameter RUN + * together '-foobarflagVALUE', the flag is NOT consumed + * and the cur arg is left pointing to the entire flag/value pair + */ + const CHAR_TYPE *get_the_parameter (const CHAR_TYPE* flag); + + /** + * Check if the current argument matches (case insensitive) @a flag + * + * ------------------------------------------------------------ + * + * Case A: Perfect Match (case insensitive) + * 0 is returned. + * + * ie: when current_arg = "-foobar" or "-FOOBAR" or "-fooBAR" + * this->cur_arg_strncasecmp ("-FooBar); + * will return 0 + * + * ------------------------------------------------------------ + * + * Case B: Perfect Match (case insensitive) but the current_arg + * is longer than the flag. Returns a number equal to the index + * in the char* indicating the start of the extra characters + * + * ie: when current_arg = "-foobar98023" + * this->cur_arg_strncasecmp ("-FooBar); + * will return 7 + * + * Notice: this number will always be > 0 + * + * ------------------------------------------------------------ + * + * Case C: If neither of Case A or B is met (no match) + * then -1 is returned + */ + int cur_arg_strncasecmp (const CHAR_TYPE *flag); + + /// Consume @a number argument(s) by sticking them/it on the end of + /// the vector. + int consume_arg (int number = 1); + + /// Place @a number arguments in the same relative order ahead of the + /// known arguments in the vector. + int ignore_arg (int number = 1); + + /// Returns the number of args left to see in the vector. + int is_anything_left (void) const; + + /// Returns 1 if there's a next item in the vector and it begins with + /// '-'. + int is_option_next (void) const; + + /// Returns 1 if there's a next item in the vector and it doesn't + /// begin with '-'. + int is_parameter_next (void) const; + + /// Returns the number of irrelevant args seen. + int num_ignored_args (void) const; + +private: + /// Copy Constructor should not be used. + ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T (const ACE_Arg_Shifter_T&)) + + /// Assignment '=' operator should not be used. + ACE_UNIMPLEMENTED_FUNC (ACE_Arg_Shifter_T operator= (const ACE_Arg_Shifter_T&)) + + /// Refactor the constructor logic. + void init (void); + + /// The size of the argument vector. + int& argc_; + + /// The size of argv_. + int total_size_; + + /// The temporary array over which we traverse. + const CHAR_TYPE **temp_; + + /// The array in which the arguments are reordered. + const CHAR_TYPE **argv_; + + /// The element in we're currently examining. + int current_index_; + + /// The index of in which we'll stick the next unknown + /// argument. + int back_; + + /// The index of in which we'll stick the next known + /// argument. + int front_; +}; + +typedef ACE_Arg_Shifter_T ACE_Arg_Shifter; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Arg_Shifter.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Arg_Shifter.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ARG_SHIFTER_H */ diff --git a/externals/ace/Argv_Type_Converter.cpp b/externals/ace/Argv_Type_Converter.cpp new file mode 100644 index 0000000..1ebeeb4 --- /dev/null +++ b/externals/ace/Argv_Type_Converter.cpp @@ -0,0 +1,196 @@ +// $Id: Argv_Type_Converter.cpp 85772 2009-06-23 20:14:18Z mitza $ + +#include "ace/Argv_Type_Converter.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Argv_Type_Converter.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (ace, + Argv_Type_Converter, + "$Id: Argv_Type_Converter.cpp 85772 2009-06-23 20:14:18Z mitza $") + +#include "ace/OS_NS_string.h" +#include "ace/OS_Errno.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_USES_WCHAR) +ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv) + : saved_argc_ (argc), + char_argv_ (0), + wchar_argv_ (argv), + before_pass_argc_ (argc), + original_type_ (true), + wchar_passed_ (false), + char_passed_ (false) +{ + this->initialize (); + + for (int i = 0; i < argc; ++i) + this->char_argv_[i] = ACE_OS::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i])); +} +#endif // ACE_USES_WCHAR + + +ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char **argv) + : saved_argc_(argc), + char_argv_(argv) +#if defined (ACE_USES_WCHAR) + , wchar_argv_(0), + before_pass_argc_(argc), + original_type_(false), + wchar_passed_(false), + char_passed_(false) +{ + this->initialize(); + + for (int i = 0; i < argc; ++i) + this->wchar_argv_[i] = ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i])); +} +#else +{ +} +#endif // ACE_USES_WCHAR + +ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void) +{ +#if defined (ACE_USES_WCHAR) + // selectively delete the 'copy' of argv + if (this->original_type_) + { + // if original type is wchar_t + if (this->char_passed_) + this->align_wchar_with_char (); + + for (int i = 0; i < this->before_pass_argc_; ++i) + ACE_OS::free (this->char_argv_[i]); + + delete [] this->char_argv_; + } + else + { + // if original type is char + if (this->wchar_passed_) + this->align_char_with_wchar (); + + for (int i = 0; i < this->before_pass_argc_; ++i) + ACE_OS::free (this->wchar_argv_[i]); + + delete [] this->wchar_argv_; + } +#endif // ACE_USES_WCHAR +} + +#if defined (ACE_USES_WCHAR) +void +ACE_Argv_Type_Converter::initialize (void) +{ + if (this->original_type_) + { + // Make a copy of argv in 'char'. type Create one more argv entry + // than original argc for the NULL. + ACE_NEW (char_argv_, + char *[this->saved_argc_ + 1]); + this->char_argv_[saved_argc_] = 0; // last entry of argv is + // always a NULL + } + else + { + // make a copy of argv in 'wchar_t' type + ACE_NEW (this->wchar_argv_, + wchar_t*[this->saved_argc_ + 1]); + this->wchar_argv_[saved_argc_] = 0; + } +} + + +void +ACE_Argv_Type_Converter::align_char_with_wchar (void) +{ + for (int wchar_argv_index = 0; wchar_argv_index < this->saved_argc_; + ++wchar_argv_index) + { + wchar_t *match_argv = this->wchar_argv_[wchar_argv_index]; + // if n'th entries of both argv lists are different + if (ACE_OS::strcmp (this->char_argv_[wchar_argv_index], + ACE_TEXT_ALWAYS_CHAR (match_argv)) != 0) + { + // loop through the wchar argv list entries that are after + // wchar_argv_index + for (int i = wchar_argv_index + 1; i < before_pass_argc_; ++i) + { + if (ACE_OS::strcmp (this->char_argv_[i], + ACE_TEXT_ALWAYS_CHAR (match_argv)) == 0) + { + // swap the pointers in the char argv list + char *temp = this->char_argv_[wchar_argv_index]; + this->char_argv_[wchar_argv_index] = this->char_argv_[i]; + this->char_argv_[i] = temp; + break; + } + } + } + } + + this->cleanup (); +} + +void +ACE_Argv_Type_Converter::align_wchar_with_char (void) +{ + for (int char_argv_index = 0; char_argv_index < saved_argc_; + ++char_argv_index) + { + char* match_argv = this->char_argv_[char_argv_index]; + // if n'th entries of both argv lists are different + if (ACE_OS::strcmp ( + ACE_TEXT_ALWAYS_CHAR (this->wchar_argv_[char_argv_index]), + match_argv) != 0) + { + // loop through the wchar argv list entries that are after + // wchar_argv_index + for (int i = char_argv_index + 1; i < this->before_pass_argc_; ++i) + { + if (ACE_OS::strcmp ( + ACE_TEXT_ALWAYS_CHAR(this->wchar_argv_[i]), + match_argv) == 0) { + // swap the pointers in the char argv list + wchar_t* temp = this->wchar_argv_[char_argv_index]; + this->wchar_argv_[char_argv_index] = this->wchar_argv_[i]; + this->wchar_argv_[i] = temp; + break; + } + } + } + } + + this->cleanup(); +} + +void +ACE_Argv_Type_Converter::cleanup (void) +{ + for (int i = this->saved_argc_; i < this->before_pass_argc_; ++i) + { + // Check whether it's ours to delete. + if (original_type_) + { + ACE_OS::free (this->char_argv_[i]); + this->char_argv_[i] = 0; + } + else + { + ACE_OS::free (this->wchar_argv_[i]); + this->wchar_argv_[i] = 0; + } + } + + this->before_pass_argc_ = this->saved_argc_; + + this->wchar_passed_ = false; + this->char_passed_ = false; +} +#endif // ACE_USES_WCHAR + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Argv_Type_Converter.h b/externals/ace/Argv_Type_Converter.h new file mode 100644 index 0000000..d41d839 --- /dev/null +++ b/externals/ace/Argv_Type_Converter.h @@ -0,0 +1,119 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Argv_Type_Converter.h + * + * $Id: Argv_Type_Converter.h 83891 2008-11-28 11:01:50Z johnnyw $ + * + * @author Si Mong Park + */ +//============================================================================= + +#ifndef ACE_ARGV_TYPE_CONVERTER_H +#define ACE_ARGV_TYPE_CONVERTER_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" +#include "ace/OS_Memory.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Argv_Type_Converter + * + * @brief To convert 'char' input/command line parameter to 'wchar_t'. + * + * This class is to convert 'char' type command line parameter to + * wide-character (wchar_t) format and stores the copy of it. + * This is useful for all classes that use 'char**' argv but cannot + * be converted into 'ACE_TCHAR**' version. + * Note that the converted data will be lost upon destruction, so + * classes should use this class as their data member. + */ +class ACE_Export ACE_Argv_Type_Converter +{ +public: + + ACE_Argv_Type_Converter (int &argc, char** argv); + +#if defined (ACE_USES_WCHAR) + ACE_Argv_Type_Converter (int &argc, wchar_t** argv); +#endif // ACE_USES_WCHAR + + ~ACE_Argv_Type_Converter (void); + + /// Returns the pointer of converted command line. + ACE_TCHAR** get_TCHAR_argv (void); + + /// Returns the pointer of ASCII (char) command line. + char** get_ASCII_argv (void); + + /// Returns the number of sub parameters (argc). + int& get_argc (void); + +private: + + /// Copy Constructor should not be used. + ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter&); + + /// Assignment '=' operator should not be used. + ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&); + +#if defined (ACE_USES_WCHAR) + + /// Perform common initialization for two Ctor's. + void initialize (void); + + /// Align all entries in the char type argv list with wchar_t type + /// argv list. + void align_char_with_wchar (void); + + /// Align all entries in the wchar_t type argv list with char type + /// argv list. + void align_wchar_with_char (void); + + /// Clean up removed (comsumed) argv entries and reset the pass flags. + void cleanup (void); +#endif // ACE_USES_WCHAR + +private: + /// Original number of input parameter, same as 'argc'. + int &saved_argc_; + + /// Data member pointer that contains converted argv in ACE_ANTI_TCHAR. + char** char_argv_; + +#if defined (ACE_USES_WCHAR) + /// Data member pointer that contains converted argv in ACE_TCHAR. + wchar_t** wchar_argv_; + + /// argc value before any argv has been passed. + int before_pass_argc_; + + /// false represents original argv passed in is char, and true + /// represents wchar_t. + bool const original_type_; + + /// true indicates wchar_t type argv has been passed. + bool wchar_passed_; + + /// true indicates char type argv has been passed. + bool char_passed_; +#endif /* ACE_USES_WCHAR */ +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Argv_Type_Converter.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ARGV_TYPE_CONVERTER_H */ diff --git a/externals/ace/Argv_Type_Converter.inl b/externals/ace/Argv_Type_Converter.inl new file mode 100644 index 0000000..e4b0ed5 --- /dev/null +++ b/externals/ace/Argv_Type_Converter.inl @@ -0,0 +1,44 @@ +// -*- C++ -*- +// +// $Id: Argv_Type_Converter.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_TCHAR** +ACE_Argv_Type_Converter::get_TCHAR_argv (void) +{ +#if defined (ACE_USES_WCHAR) + if (this->char_passed_) + { + this->align_wchar_with_char (); + } + + this->wchar_passed_ = true; + return this->wchar_argv_; +#else + return this->char_argv_; +#endif // ACE_USES_WCHAR +} + +ACE_INLINE char** +ACE_Argv_Type_Converter::get_ASCII_argv (void) +{ +#if defined (ACE_USES_WCHAR) + if (this->wchar_passed_) + { + this->align_char_with_wchar (); + } + + this->char_passed_ = true; +#endif // ACE_USES_WCHAR + + return this->char_argv_; +} + +ACE_INLINE int& +ACE_Argv_Type_Converter::get_argc (void) +{ + return this->saved_argc_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Array.h b/externals/ace/Array.h new file mode 100644 index 0000000..3caaa7b --- /dev/null +++ b/externals/ace/Array.h @@ -0,0 +1,29 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Array.h + * + * $Id: Array.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @deprecated + * + * @note This file has been deprecated and will soon go away. You + * should directly include "Containers_T.h" instead. + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ARRAY_H +#define ACE_ARRAY_H +#include /**/ "ace/pre.h" + +#include "ace/Containers_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/post.h" +#endif /* ACE_ARRAY_H */ diff --git a/externals/ace/Array_Base.cpp b/externals/ace/Array_Base.cpp new file mode 100644 index 0000000..49e42e1 --- /dev/null +++ b/externals/ace/Array_Base.cpp @@ -0,0 +1,235 @@ +// $Id: Array_Base.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_ARRAY_BASE_CPP +#define ACE_ARRAY_BASE_CPP + +#include "ace/Array_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Array_Base.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Malloc_Base.h" +#include "ace/os_include/os_errno.h" + +#include + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Dynamically initialize an array. +template +ACE_Array_Base::ACE_Array_Base (typename ACE_Array_Base::size_type size, + ACE_Allocator *alloc) + : max_size_ (size), + cur_size_ (size), + allocator_ (alloc) +{ + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + if (size != 0) + { + ACE_ALLOCATOR (this->array_, + (T *) this->allocator_->malloc (size * sizeof (T))); + for (size_type i = 0; i < size; ++i) + new (&array_[i]) T; + } + else + this->array_ = 0; +} + +template +ACE_Array_Base::ACE_Array_Base (typename ACE_Array_Base::size_type size, + const T &default_value, + ACE_Allocator *alloc) + : max_size_ (size), + cur_size_ (size), + allocator_ (alloc) +{ + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + if (size != 0) + { + ACE_ALLOCATOR (this->array_, + (T *) this->allocator_->malloc (size * sizeof (T))); + for (size_type i = 0; i < size; ++i) + new (&array_[i]) T (default_value); + } + else + this->array_ = 0; +} + +// The copy constructor (performs initialization). + +template +ACE_Array_Base::ACE_Array_Base (const ACE_Array_Base &s) + : max_size_ (s.size ()), + cur_size_ (s.size ()), + allocator_ (s.allocator_) +{ + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_ALLOCATOR (this->array_, + (T *) this->allocator_->malloc (s.size () * sizeof (T))); + for (size_type i = 0; i < this->size (); ++i) + new (&this->array_[i]) T (s.array_[i]); +} + +// Assignment operator (performs assignment). + +template void +ACE_Array_Base::operator= (const ACE_Array_Base &s) +{ + // Check for "self-assignment". + + if (this != &s) + { + if (this->max_size_ < s.size ()) + { + // Need to reallocate memory. + + // Strongly exception-safe assignment. + // + // Note that we're swapping the allocators here, too. + // Should we? Probably. "*this" should be a duplicate of + // the "right hand side". + ACE_Array_Base tmp (s); + this->swap (tmp); + } + else + { + // Underlying array is large enough. No need to reallocate + // memory. + // + // "*this" still owns the memory for the underlying array. + // Do not swap out the allocator. + // + // @@ Why don't we just drop the explicit destructor and + // placement operator new() calls with a straight + // element-by-element assignment? Is the existing + // approach more efficient? + // -Ossama + + ACE_DES_ARRAY_NOFREE (this->array_, + s.size (), + T); + + this->cur_size_ = s.size (); + + for (size_type i = 0; i < this->size (); ++i) + new (&this->array_[i]) T (s.array_[i]); + } + } +} + +// Set an item in the array at location slot. + +template int +ACE_Array_Base::set (const T &new_item, + typename ACE_Array_Base::size_type slot) +{ + if (this->in_range (slot)) + { + this->array_[slot] = new_item; + return 0; + } + else + return -1; +} + +// Get an item in the array at location slot. + +template int +ACE_Array_Base::get (T &item, + typename ACE_Array_Base::size_type slot) const +{ + if (this->in_range (slot)) + { + // Copies the item. If you don't want to copy, use operator [] + // instead (but then you'll be responsible for range checking). + item = this->array_[slot]; + return 0; + } + else + return -1; +} + +template int +ACE_Array_Base::max_size (typename ACE_Array_Base::size_type new_size) +{ + if (new_size > this->max_size_) + { + T *tmp = 0; + + ACE_ALLOCATOR_RETURN (tmp, + (T *) this->allocator_->malloc (new_size * sizeof (T)), + -1); + for (size_type i = 0; i < this->cur_size_; ++i) + new (&tmp[i]) T (this->array_[i]); + + // Initialize the new portion of the array that exceeds the + // previously allocated section. + for (size_type j = this->cur_size_; j < new_size; ++j) + new (&tmp[j]) T; + + ACE_DES_ARRAY_FREE (this->array_, + this->max_size_, + this->allocator_->free, + T); + this->array_ = tmp; + this->max_size_ = new_size; + this->cur_size_ = new_size; + } + + return 0; +} + +template int +ACE_Array_Base::size (typename ACE_Array_Base::size_type new_size) +{ + int const r = this->max_size (new_size); + + if (r == 0) + this->cur_size_ = new_size; + + return r; +} + +template +void +ACE_Array_Base::swap (ACE_Array_Base & rhs) +{ + std::swap (this->max_size_ , rhs.max_size_); + std::swap (this->cur_size_ , rhs.cur_size_); + std::swap (this->array_ , rhs.array_); + std::swap (this->allocator_, rhs.allocator_); +} + +// **************************************************************** + +template int +ACE_Array_Iterator::next (T *&item) +{ + // ACE_TRACE ("ACE_Array_Iterator::next"); + + if (this->done ()) + { + item = 0; + return 0; + } + else + { + item = &array_[current_]; + return 1; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ARRAY_BASE_CPP */ diff --git a/externals/ace/Array_Base.h b/externals/ace/Array_Base.h new file mode 100644 index 0000000..0d6620a --- /dev/null +++ b/externals/ace/Array_Base.h @@ -0,0 +1,256 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Array_Base.h + * + * $Id: Array_Base.h 84477 2009-02-16 13:30:38Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ARRAY_BASE_H +#define ACE_ARRAY_BASE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/Malloc_Base.h" +#include /* For reverse_iterator adapters */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration. +template class ACE_Array_Iterator; + +/** + * @class ACE_Array_Base + * + * @brief Implement a simple dynamic array + * + * This parametric class implements a simple dynamic array; + * resizing must be controlled by the user. No comparison or find + * operations are implemented. + */ +template +class ACE_Array_Base +{ +public: + + // Old/ACE-style traits. + typedef T TYPE; + typedef ACE_Array_Iterator ITERATOR; + + // STL-style typedefs/traits. + typedef T value_type; + typedef value_type * iterator; + typedef value_type const * const_iterator; + typedef value_type & reference; + typedef value_type const & const_reference; + typedef value_type * pointer; + typedef value_type const * const_pointer; + typedef ptrdiff_t difference_type; + typedef ACE_Allocator::size_type size_type; + + ACE_DECLARE_STL_REVERSE_ITERATORS + + // = Initialization and termination methods. + + /// Dynamically create an uninitialized array. + ACE_Array_Base (size_type size = 0, + ACE_Allocator * the_allocator = 0); + + /// Dynamically initialize the entire array to the . + ACE_Array_Base (size_type size, + T const & default_value, + ACE_Allocator * the_allocator = 0); + + /** + * The copy constructor performs initialization by making an exact + * copy of the contents of parameter , i.e., *this == s will + * return true. + */ + ACE_Array_Base (ACE_Array_Base const & s); + + /** + * Assignment operator performs an assignment by making an exact + * copy of the contents of parameter , i.e., *this == s will + * return true. Note that if the of is >= than + * we can copy it without reallocating. However, if + * is < we must delete the , + * reallocate a new , and then copy the contents of . + */ + void operator= (ACE_Array_Base const & s); + + /// Clean up the array (e.g., delete dynamically allocated memory). + ~ACE_Array_Base (void); + + // = Set/get methods. + + /// Set item in the array at location @a slot. Doesn't + /// perform range checking. + T & operator[] (size_type slot); + + /// Get item in the array at location @a slot. Doesn't + /// perform range checking. + T const & operator[] (size_type slot) const; + + /// Set an item in the array at location @a slot. Returns + /// -1 if @a slot is not in range, else returns 0. + int set (T const & new_item, size_type slot); + + /** + * Get an item in the array at location @a slot. Returns -1 if + * @a slot is not in range, else returns 0. Note that this function + * copies the item. If you want to avoid the copy, you can use + * the const operator [], but then you'll be responsible for range checking. + */ + int get (T & item, size_type slot) const; + + /// Returns the of the array. + size_type size (void) const; + + /** + * Changes the size of the array to match @a new_size. + * It copies the old contents into the new array. + * Return -1 on failure. + */ + int size (size_type new_size); + + /// Returns the of the array. + size_type max_size (void) const; + + /** + * Changes the size of the array to match @a new_size. + * It copies the old contents into the new array. + * Return -1 on failure. + * It does not affect new_size + */ + int max_size (size_type new_size); + + /** + * @name Forward Iterator Accessors + * + * Forward iterator accessors. + */ + //@{ + iterator begin (void); + iterator end (void); + const_iterator begin (void) const; + const_iterator end (void) const; + //@} + + /** + * @name Reverse Iterator Accessors + * + * Reverse iterator accessors. + */ + //@{ + reverse_iterator rbegin (void); + reverse_iterator rend (void); + const_reverse_iterator rbegin (void) const; + const_reverse_iterator rend (void) const; + //@} + + /// Swap the contents of this array with the given @a array in + /// an exception-safe manner. + void swap (ACE_Array_Base & array); + +protected: + + /// Returns 1 if @a slot is within range, i.e., 0 >= @a slot < + /// @c cur_size_, else returns 0. + bool in_range (size_type slot) const; + + /// Maximum size of the array, i.e., the total number of @c T elements + /// in @c array_. + size_type max_size_; + + /** + * Current size of the array. This starts out being == to + * . However, if we are assigned a smaller array, then + * will become less than . The purpose of + * keeping track of both sizes is to avoid reallocating memory if we + * don't have to. + */ + size_type cur_size_; + + /// Pointer to the array's storage buffer. + value_type * array_; + + /// Allocation strategy of the ACE_Array_Base. + ACE_Allocator * allocator_; + + friend class ACE_Array_Iterator; +}; + +// **************************************************************** + +/** + * @class ACE_Array_Iterator + * + * @brief Implement an iterator over an ACE_Array. + * + * This iterator is safe in the face of array element deletions. + * But it is NOT safe if the array is resized (via the ACE_Array + * assignment operator) during iteration. That would be very + * odd, and dangerous. + */ +template +class ACE_Array_Iterator +{ +public: + // = Initialization method. + ACE_Array_Iterator (ACE_Array_Base &); + + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the Array. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the Array. Returns 0 when all the + /// items in the Array have been seen, else 1. + int advance (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the current item in the iteration. + size_t current_; + + /// Pointer to the Array we're iterating over. + ACE_Array_Base &array_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Array_Base.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Array_Base.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Array_Base.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ARRAY_BASE_H */ diff --git a/externals/ace/Array_Base.inl b/externals/ace/Array_Base.inl new file mode 100644 index 0000000..046c1bf --- /dev/null +++ b/externals/ace/Array_Base.inl @@ -0,0 +1,146 @@ +// -*- C++ -*- +// +// $Id: Array_Base.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Clean up the array (e.g., delete dynamically allocated memory). +template ACE_INLINE +ACE_Array_Base::~ACE_Array_Base (void) +{ + ACE_DES_ARRAY_FREE (this->array_, + this->max_size_, + this->allocator_->free, + T); +} + +template +ACE_INLINE typename ACE_Array_Base::iterator +ACE_Array_Base::begin (void) +{ + return this->array_; +} + +template +ACE_INLINE typename ACE_Array_Base::iterator +ACE_Array_Base::end (void) +{ + return this->array_ + this->cur_size_; +} + +template +ACE_INLINE typename ACE_Array_Base::const_iterator +ACE_Array_Base::begin (void) const +{ + return this->array_; +} + +template +ACE_INLINE typename ACE_Array_Base::const_iterator +ACE_Array_Base::end (void) const +{ + return this->array_ + this->cur_size_; +} + +template +ACE_INLINE typename ACE_Array_Base::reverse_iterator +ACE_Array_Base::rbegin (void) +{ + return reverse_iterator (this->end ()); +} + +template +ACE_INLINE typename ACE_Array_Base::reverse_iterator +ACE_Array_Base::rend (void) +{ + return reverse_iterator (this->begin ()); +} + +template +ACE_INLINE typename ACE_Array_Base::const_reverse_iterator +ACE_Array_Base::rbegin (void) const +{ + return const_reverse_iterator (this->end ()); +} + +template +ACE_INLINE typename ACE_Array_Base::const_reverse_iterator +ACE_Array_Base::rend (void) const +{ + return const_reverse_iterator (this->begin ()); +} + +template ACE_INLINE typename ACE_Array_Base::size_type +ACE_Array_Base::size (void) const +{ + return this->cur_size_; +} + +template ACE_INLINE typename ACE_Array_Base::size_type +ACE_Array_Base::max_size (void) const +{ + return this->max_size_; +} + +template ACE_INLINE bool +ACE_Array_Base::in_range (typename ACE_Array_Base::size_type index) const +{ + return index < this->cur_size_; +} + +template ACE_INLINE T & +ACE_Array_Base::operator[] (typename ACE_Array_Base::size_type index) +{ + return this->array_[index]; +} + +template ACE_INLINE const T & +ACE_Array_Base::operator[] (typename ACE_Array_Base::size_type index) const +{ + return this->array_[index]; +} + +// **************************************************************** + +template ACE_INLINE void +ACE_Array_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Array_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_INLINE +ACE_Array_Iterator::ACE_Array_Iterator (ACE_Array_Base &a) + : current_ (0), + array_ (a) +{ + // ACE_TRACE ("ACE_Array_Iterator::ACE_Array_Iterator"); +} + +template ACE_INLINE int +ACE_Array_Iterator::advance (void) +{ + // ACE_TRACE ("ACE_Array_Iterator::advance"); + + if (this->current_ < array_.size ()) + { + ++this->current_; + return 1; + } + else + { + // Already finished iterating. + return 0; + } +} + +template ACE_INLINE int +ACE_Array_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Array_Iterator::done"); + + return this->current_ >= array_.size (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Array_Map.cpp b/externals/ace/Array_Map.cpp new file mode 100644 index 0000000..5530a8b --- /dev/null +++ b/externals/ace/Array_Map.cpp @@ -0,0 +1,299 @@ +// $Id: Array_Map.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_ARRAY_MAP_CPP +#define ACE_ARRAY_MAP_CPP + +#include "ace/Array_Map.h" + +#ifndef __ACE_INLINE__ +# include "ace/Array_Map.inl" +#endif /* !__ACE_INLINE__ */ + +#include "ace/checked_iterator.h" + +#include + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#ifndef ACE_LACKS_MEMBER_TEMPLATES +template +template +ACE_Array_Map::ACE_Array_Map (InputIterator f, + InputIterator l) + : size_ (l - f) + , capacity_ (size_) + , nodes_ (size_ == 0 ? 0 : new value_type[size_]) +{ + (void) std::copy (f, + l, + ACE_make_checked_array_iterator (this->begin (), + this->size_)); + +// iterator n = this->begin (); + +// for (InputIterator i = f; i != l; ++i, ++n) +// *n = *i; +} +#else +template +ACE_Array_Map::ACE_Array_Map ( + typename ACE_Array_Map::const_iterator f, + typename ACE_Array_Map::const_iterator l) + : size_ (l - f) + , capacity_ (size_) + , nodes_ (size_ == 0 ? 0 : new value_type[size_]) +{ + (void) std::copy (f, + l, + ACE_make_checked_array_iterator (this->begin (), + this->size_)); + +// iterator n = this->begin (); + +// for (const_iterator i = f; i != l; ++i, ++n) +// *n = *i; +} +#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ + +template +ACE_Array_Map::ACE_Array_Map ( + ACE_Array_Map const & map) + : size_ (map.size_) + , capacity_ (map.size_) + , nodes_ (size_ == 0 ? 0 : new value_type[size_]) +{ + std::copy (map.begin (), + map.end (), + ACE_make_checked_array_iterator (this->begin (), + this->size_)); + +// iterator f = map.begin (); +// iterator l = map.end (); +// iterator n = this->begin (); + +// for (iterator i = f; i != l; ++i, ++n) +// *n = *i; +} + +template +ACE_Array_Map::~ACE_Array_Map (void) +{ + delete[] this->nodes_; +} + +template +void +ACE_Array_Map::swap ( + ACE_Array_Map & map) +{ + std::swap (this->size_, map.size_); + std::swap (this->capacity_, map.capacity_); + std::swap (this->nodes_, map.nodes_); +} + +template +std::pair::iterator, bool> +ACE_Array_Map::insert ( + typename ACE_Array_Map::value_type const & x) +{ + // Linear insertion due to linear duplicate key search. + + bool inserted = false; + iterator i = this->find (x.first); + + if (i == this->end ()) + { + // Add the element to the array. + + size_type const old_size = this->size (); + this->grow (1); // Increase size by at least one. + + i = this->begin () + old_size; + *i = x; + + ++this->size_; + + inserted = true; + } + + return std::make_pair (i, inserted); +} + +#ifndef ACE_LACKS_MEMBER_TEMPLATES +template +template +void +ACE_Array_Map::insert (InputIterator f, InputIterator l) +{ + this->grow (l - f); // Preallocate storage. + + for (InputIterator i = f; i != l; ++i) + { + (void) this->insert (*i); + } +} +#else +template +void +ACE_Array_Map::insert ( + typename ACE_Array_Map::const_iterator f, + typename ACE_Array_Map::const_iterator l) +{ + this->grow (l - f); // Preallocate storage. + + for (const_iterator i = f; i != l; ++i) + { + (void) this->insert (*i); + } +} +#endif /* ACE_LACKS_MEMBER_TEMPLATES */ + +template +void +ACE_Array_Map::erase ( + typename ACE_Array_Map::iterator pos) +{ + iterator const first = this->begin (); + iterator const last = this->end (); + + if (pos >= first && pos < last) + { + if (pos != last - 1) + { + // Relocate the tail element to the location of the erased + // element to prevent introduction of "holes" in the + // underlying array. + *pos = *(last - 1); + } + + // Explicitly destroy the tail element by assigning a default + // constructed instance to it. Note that this also works for + // the case of a map of size 1. + *(last - 1) = value_type (); + + --this->size_; + } +} + +template +typename ACE_Array_Map::size_type +ACE_Array_Map::erase ( + typename ACE_Array_Map::key_type const & k) +{ + iterator pos = this->find (k); + + size_type const old_size = this->size_; + + this->erase (pos); + + return old_size - this->size_; +} + +template +void +ACE_Array_Map::erase ( + typename ACE_Array_Map::iterator first, + typename ACE_Array_Map::iterator last) +{ + if (this->begin () <= first && first < last && last < this->end ()) + for (iterator i = first; i != last; ++i) + this->erase (i); +} + +template +void +ACE_Array_Map::clear (void) +{ + this->size_ = 0; // No need to deallocate array nor destroy elements. +} + +template +typename ACE_Array_Map::iterator +ACE_Array_Map::find ( + typename ACE_Array_Map::key_type const & k) +{ + iterator const the_end = this->end (); + + EqualTo eq; + + for (iterator i = this->begin (); i != the_end; ++i) + if (eq (k, i->first)) + return i; + + return this->end (); +} + +template +typename ACE_Array_Map::const_iterator +ACE_Array_Map::find ( + typename ACE_Array_Map::key_type const & k) const +{ + const_iterator const the_end = this->end (); + + EqualTo eq; + + for (const_iterator i = this->begin (); i != the_end; ++i) + if (eq (k, i->first)) + return i; + + return this->end (); +} + +template +void +ACE_Array_Map::grow ( + typename ACE_Array_Map::size_type s) +{ + if (this->size () + s > this->capacity_) + { + // This implementation focuses more on static footprint than + // speed. + + // Strongly exception safe. + + ACE_Array_Map temp (this->size () + s); + + std::copy (this->begin (), + this->end (), + ACE_make_checked_array_iterator (temp.begin (), + temp.capacity_)); + + size_type const n = this->size (); // Do not swap out the size + // since we bypassed the + // temporary map's element + // counting code. + this->swap (temp); + + this->size_ = n; + } +} + +// --------------------------------------------------------------- + +template +bool +operator== (ACE_Array_Map const & lhs, + ACE_Array_Map const & rhs) +{ + // Do not include Array_Map capacity in comparison. It isn't useful + // in this case. + + return (lhs.size () == rhs.size () + && std::equal (lhs.begin (), + lhs.end (), + ACE_make_checked_array_iterator (rhs.begin (), + rhs.size ()))); +} + +template +bool +operator< (ACE_Array_Map const & lhs, + ACE_Array_Map const & rhs) +{ + return std::lexicographical_compare (lhs.begin (), lhs.end (), + rhs.begin (), rhs.end ()); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ARRAY_MAP_CPP */ diff --git a/externals/ace/Array_Map.h b/externals/ace/Array_Map.h new file mode 100644 index 0000000..1515ea4 --- /dev/null +++ b/externals/ace/Array_Map.h @@ -0,0 +1,300 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Array_Map.h + * + * $Id: Array_Map.h 84136 2009-01-12 11:01:17Z johnnyw $ + * + * Light weight array-based map with fast iteration but linear + * (i.e. O(n)) search times. STL-style interface is exposed. + * + * @note This class requires the STL generic algorithms and + * reverse_iterator adapter. + * + * @author Ossama Othman + */ +//============================================================================= + + +#ifndef ACE_ARRAY_MAP_H +#define ACE_ARRAY_MAP_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include +#include +#include + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Array_Map + * + * @brief Light weight array-based map with fast iteration, but linear + * (i.e. O(n)) search times. + * + * Map implementation that focuses on small footprint and fast + * iteration. Search times are, however, linear (O(n)) meaning that + * this map isn't suitable for large data sets that will be searched + * in performance critical areas of code. Iteration over large data + * sets, however, is faster than linked list-based maps, for example, + * since spatial locality is maximized through the use of contiguous + * arrays as the underlying storage. + * @par + * An @c ACE_Array_Map is a unique associative container, meaning that + * duplicate values may not be added to the map. It is also pair + * associative (value_type is a std::pair<>). It is not a sorted + * container. + * @par + * An STL @c std::map -like interface is exposed by this class + * portability. Furthermore, this map's iterators are compatible with + * STL algorithms. + * @par + * Requirements and Performance Characteristics + * - Internal Structure + * Array + * - Duplicates allowed? + * No + * - Random access allowed? + * Yes + * - Search speed + * O(n) + * - Insert/replace speed + * O(n), can be longer if the map has to resize + * - Iterator still valid after change to container? + * No + * - Frees memory for removed elements? + * Yes + * - Items inserted by + * Value + * - Requirements for key type + * -# Default constructor + * -# Copy constructor + * -# operator= + * -# operator== + * - Requirements for object type + * -# Default constructor + * -# Copy constructor + * -# operator= + */ +template > +class ACE_Array_Map +{ +public: + + // STL-style typedefs/traits. + typedef Key key_type; + typedef Value data_type; + typedef std::pair value_type; + typedef value_type * iterator; + typedef value_type const * const_iterator; + typedef value_type & reference; + typedef value_type const & const_reference; + typedef value_type * pointer; + typedef value_type const * const_pointer; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + + ACE_DECLARE_STL_REVERSE_ITERATORS + + /// Default Constructor. + /** + * Create an empty map with a preallocated buffer of size @a s. + */ + ACE_Array_Map (size_type s = 0); + +#ifndef ACE_LACKS_MEMBER_TEMPLATES + template + ACE_Array_Map (InputIterator f, InputIterator l); +#else + ACE_Array_Map (const_iterator f, const_iterator l); +#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ + + ACE_Array_Map (ACE_Array_Map const & map); + ACE_Array_Map & operator= (ACE_Array_Map const & map); + + /// Destructor. + ~ACE_Array_Map (void); + + /** + * @name Forward Iterator Accessors + * + * Forward iterator accessors. + */ + //@{ + iterator begin (void); + iterator end (void); + const_iterator begin (void) const; + const_iterator end (void) const; + //@} + + /** + * @name Reverse Iterator Accessors + * + * Reverse iterator accessors. + */ + //@{ + reverse_iterator rbegin (void); + reverse_iterator rend (void); + const_reverse_iterator rbegin (void) const; + const_reverse_iterator rend (void) const; + //@} + + /// Return current size of map. + /** + * @return The number of elements in the map. + */ + size_type size (void) const; + + /// Maximum number of elements the map can hold. + size_type max_size (void) const; + + /// Return @c true if the map is empty, else @c false. + bool is_empty (void) const; // ACE style + + /** + * Return @c true if the map is empty, else @c false. We recommend + * using @c is_empty() instead since it's more consistent with the + * ACE container naming conventions. + */ + bool empty (void) const; // STL style + + /// Swap the contents of this map with the given @a map in an + /// exception-safe manner. + void swap (ACE_Array_Map & map); + + /// Insert the value @a x into the map. + /** + * STL-style map insertion method. + * + * @param x @c std::pair containing key and datum. + * + * @return @c std::pair::second will be @c false if the map already + * contains a value with the same key as @a x. + */ + std::pair insert (value_type const & x); + +#ifndef ACE_LACKS_MEMBER_TEMPLATES + /// Insert range of elements into map. + template + void insert (InputIterator f, InputIterator l); +#else + /// Insert range of elements into map. + void insert (const_iterator f, const_iterator l); +#endif /* ACE_LACKS_MEMBER_TEMPLATES */ + + /// Remove element at position @a pos from the map. + void erase (iterator pos); + + /// Remove element corresponding to key @a k from the map. + /** + * @return Number of elements that were erased. + */ + size_type erase (key_type const & k); + + /// Remove range of elements [@a first, @a last) from the map. + /** + * @note [@a first, @a last) must be valid range within the map. + */ + void erase (iterator first, iterator last); + + /// Clear contents of map. + /** + * @note This a constant time (O(1)) operation. + */ + void clear (void); + + /** + * @name Search Operations + * + * Search the map for data corresponding to key @a k. + */ + //@{ + /** + * @return @c end() if data corresponding to key @a k is not in the + * map. + */ + iterator find (key_type const & k); + + /** + * @return @c end() if data corresponding to key @a k is not in the + * map. + */ + const_iterator find (key_type const & k) const; + //@} + + /// Count the number of elements corresponding to key @a k. + /** + * @return In the case of this map, the count will always be one if + * such exists in the map. + */ + size_type count (key_type const & k); + + /// Convenience array index operator. + /** + * Array index operator that allows insertion and retrieval of + * elements using an array index syntax, such as: + * @par + * map["Foo"] = 12; + */ + data_type & operator[] (key_type const & k); + +private: + + /// Increase size of underlying buffer by @a s. + void grow (size_type s); + +private: + + /// Number of elements in the map. + size_type size_; + + /// Current size of underlying array. + /** + * @note @c capacity_ is always greater than or equal to @c size_; + */ + size_type capacity_; + + /// Underlying array containing keys and data. + value_type * nodes_; + +}; + +// -------------------------------------------------------------- + +/// @c ACE_Array_Map equality operator. +template +bool operator== (ACE_Array_Map const & lhs, + ACE_Array_Map const & rhs); + +/// @c ACE_Array_Map lexicographical comparison operator. +template +bool operator< (ACE_Array_Map const & lhs, + ACE_Array_Map const & rhs); + +// -------------------------------------------------------------- + +ACE_END_VERSIONED_NAMESPACE_DECL + +#ifdef __ACE_INLINE__ +# include "ace/Array_Map.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +# include "ace/Array_Map.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Array_Map.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ARRAY_MAP_H */ diff --git a/externals/ace/Array_Map.inl b/externals/ace/Array_Map.inl new file mode 100644 index 0000000..b053dc0 --- /dev/null +++ b/externals/ace/Array_Map.inl @@ -0,0 +1,133 @@ +// -*- C++ -*- +// +// $Id: Array_Map.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_INLINE +ACE_Array_Map::ACE_Array_Map ( + typename ACE_Array_Map::size_type s) + : size_ (0) + , capacity_ (s) + , nodes_ (s == 0 ? 0 : new value_type[s]) +{ +} + +template +ACE_INLINE ACE_Array_Map & +ACE_Array_Map::operator= ( + ACE_Array_Map const & map) +{ + // Strongly exception-safe assignment. + + ACE_Array_Map temp (map); + this->swap (temp); + return *this; +} + +template +ACE_INLINE typename ACE_Array_Map::iterator +ACE_Array_Map::begin (void) +{ + return this->nodes_; +} + +template +ACE_INLINE typename ACE_Array_Map::iterator +ACE_Array_Map::end (void) +{ + return this->nodes_ + this->size_; +} + +template +ACE_INLINE typename ACE_Array_Map::const_iterator +ACE_Array_Map::begin (void) const +{ + return this->nodes_; +} + +template +ACE_INLINE typename ACE_Array_Map::const_iterator +ACE_Array_Map::end (void) const +{ + return this->nodes_ + this->size_; +} + +template +ACE_INLINE typename ACE_Array_Map::reverse_iterator +ACE_Array_Map::rbegin (void) +{ + return reverse_iterator (this->end ()); +} + +template +ACE_INLINE typename ACE_Array_Map::reverse_iterator +ACE_Array_Map::rend (void) +{ + return reverse_iterator (this->begin ()); +} + +template +ACE_INLINE typename ACE_Array_Map::const_reverse_iterator +ACE_Array_Map::rbegin (void) const +{ + return const_reverse_iterator (this->end ()); +} + +template +ACE_INLINE typename ACE_Array_Map::const_reverse_iterator +ACE_Array_Map::rend (void) const +{ + return const_reverse_iterator (this->begin ()); +} + +template +ACE_INLINE typename ACE_Array_Map::size_type +ACE_Array_Map::size (void) const +{ + return this->size_; +} + +template +ACE_INLINE typename ACE_Array_Map::size_type +ACE_Array_Map::max_size (void) const +{ + return size_type (-1) / sizeof (value_type); +} + +template +ACE_INLINE bool +ACE_Array_Map::is_empty (void) const +{ + return this->size_ == 0; +} + +// The following method is deprecated. + +template +ACE_INLINE bool +ACE_Array_Map::empty (void) const +{ + return this->is_empty (); +} + +template +ACE_INLINE typename ACE_Array_Map::size_type +ACE_Array_Map::count ( + typename ACE_Array_Map::key_type const & k) +{ + return + (this->find (k) == this->end () ? 0 : 1); // Only one datum per key. +} + +template +ACE_INLINE typename ACE_Array_Map::data_type & +ACE_Array_Map::operator[] ( + typename ACE_Array_Map::key_type const & k) +{ + iterator i = (this->insert (value_type (k, data_type ()))).first; + return (*i).second; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Assert.cpp b/externals/ace/Assert.cpp new file mode 100644 index 0000000..4a71c9e --- /dev/null +++ b/externals/ace/Assert.cpp @@ -0,0 +1,24 @@ +// $Id: Assert.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Assert.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, Assert, "$Id: Assert.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following ASSERT macro is courtesy of Alexandre Karev +// . +void +__ace_assert(const char *file, int line, const ACE_TCHAR *expression) +{ + int error = ACE_Log_Msg::last_error_adapter (); + ACE_Log_Msg *log = ACE_Log_Msg::instance (); + + log->set (file, line, -1, error, log->restart (), + log->msg_ostream (), log->msg_callback ()); + + log->log (LM_ERROR, ACE_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), expression, -1); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Assert.h b/externals/ace/Assert.h new file mode 100644 index 0000000..89363d4 --- /dev/null +++ b/externals/ace/Assert.h @@ -0,0 +1,40 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Assert.h + * + * $Id: Assert.h 82808 2008-09-23 11:27:27Z smcqueen $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ASSERT_H +#define ACE_ASSERT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#include /**/ "ace/config-all.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_Export void __ace_assert(const char *file, int line, const ACE_TCHAR *expression); +ACE_END_VERSIONED_NAMESPACE_DECL + +#define ACE_TEST_ASSERT(X) \ + ((X) \ + ? static_cast(0) \ + : ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X))) + +#if defined (ACE_NDEBUG) +#define ACE_ASSERT(x) \ + (static_cast(0)) +#else +#define ACE_ASSERT(X) ACE_TEST_ASSERT(X) +#endif /* ACE_NDEBUG */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ASSERT */ diff --git a/externals/ace/Asynch_Acceptor.cpp b/externals/ace/Asynch_Acceptor.cpp new file mode 100644 index 0000000..3afb27c --- /dev/null +++ b/externals/ace/Asynch_Acceptor.cpp @@ -0,0 +1,514 @@ +/* -*- C++ -*- */ +// $Id: Asynch_Acceptor.cpp 85213 2009-04-29 16:34:20Z shuston $ + +#ifndef ACE_ASYNCH_ACCEPTOR_C +#define ACE_ASYNCH_ACCEPTOR_C + +#include "ace/Asynch_Acceptor.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_RCSID(ace, Asynch_Acceptor, "$Id: Asynch_Acceptor.cpp 85213 2009-04-29 16:34:20Z shuston $") + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) +// This only works on platforms that support async i/o. + +#include "ace/OS_Errno.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_sys_socket.h" +#include "ace/Log_Msg.h" +#include "ace/Message_Block.h" +#include "ace/INET_Addr.h" +#include "ace/SOCK_Stream.h" +#include "ace/Sock_Connect.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Asynch_Acceptor::ACE_Asynch_Acceptor (void) + : listen_handle_ (ACE_INVALID_HANDLE), + pass_addresses_ (false), + validate_new_connection_ (false), + reissue_accept_ (1), + bytes_to_read_ (0) +{ +} + +template +ACE_Asynch_Acceptor::~ACE_Asynch_Acceptor (void) +{ + // Close down the listen socket + if (this->listen_handle_ != ACE_INVALID_HANDLE) + { + ACE_OS::closesocket (this->listen_handle_); + this->listen_handle_ = ACE_INVALID_HANDLE; + } +} + +template int +ACE_Asynch_Acceptor::open (const ACE_INET_Addr &address, + size_t bytes_to_read, + bool pass_addresses, + int backlog, + int reuse_addr, + ACE_Proactor *proactor, + bool validate_new_connection, + int reissue_accept, + int number_of_initial_accepts) +{ + ACE_TRACE ("ACE_Asynch_Acceptor<>::open"); + + this->proactor (proactor); + this->pass_addresses_ = pass_addresses; + this->bytes_to_read_ = bytes_to_read; + this->validate_new_connection_ = validate_new_connection; + this->reissue_accept_ = reissue_accept; + this->addr_family_ = address.get_type (); + + // Create the listener socket + this->listen_handle_ = ACE_OS::socket (address.get_type (), SOCK_STREAM, 0); + if (this->listen_handle_ == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_OS::socket")), + -1); + // Initialize the ACE_Asynch_Accept + if (this->asynch_accept_.open (*this, + this->listen_handle_, + 0, + this->proactor ()) == -1) + { + ACE_Errno_Guard g (errno); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Accept::open"))); + ACE_OS::closesocket (this->listen_handle_); + this->listen_handle_ = ACE_INVALID_HANDLE; + return -1; + } + + if (reuse_addr) + { + // Reuse the address + int one = 1; + if (ACE_OS::setsockopt (this->listen_handle_, + SOL_SOCKET, + SO_REUSEADDR, + (const char*) &one, + sizeof one) == -1) + { + ACE_Errno_Guard g (errno); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_OS::setsockopt"))); + ACE_OS::closesocket (this->listen_handle_); + this->listen_handle_ = ACE_INVALID_HANDLE; + return -1; + } + } + + // If port is not specified, bind to any port. + static ACE_INET_Addr sa (ACE_sap_any_cast (const ACE_INET_Addr &)); + + if (address == sa && + ACE::bind_port (this->listen_handle_, + INADDR_ANY, + address.get_type()) == -1) + { + ACE_Errno_Guard g (errno); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::bind_port"))); + ACE_OS::closesocket (this->listen_handle_); + this->listen_handle_ = ACE_INVALID_HANDLE; + return -1; + } + + // Bind to the specified port. + if (ACE_OS::bind (this->listen_handle_, + reinterpret_cast (address.get_addr ()), + address.get_size ()) == -1) + { + ACE_Errno_Guard g (errno); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_OS::bind"))); + ACE_OS::closesocket (this->listen_handle_); + this->listen_handle_ = ACE_INVALID_HANDLE; + return -1; + } + + // Start listening. + if (ACE_OS::listen (this->listen_handle_, backlog) == -1) + { + ACE_Errno_Guard g (errno); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_OS::listen"))); + ACE_OS::closesocket (this->listen_handle_); + this->listen_handle_ = ACE_INVALID_HANDLE; + return -1; + } + + // For the number of . + if (number_of_initial_accepts == -1) + number_of_initial_accepts = backlog; + + for (int i = 0; i < number_of_initial_accepts; i++) + { + // Initiate accepts. + if (this->accept (bytes_to_read) == -1) + { + ACE_Errno_Guard g (errno); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Acceptor::accept"))); + ACE_OS::closesocket (this->listen_handle_); + this->listen_handle_ = ACE_INVALID_HANDLE; + return -1; + } + } + + return 0; +} + +template int +ACE_Asynch_Acceptor::set_handle (ACE_HANDLE listen_handle) +{ + ACE_TRACE ("ACE_Asynch_Acceptor<>::set_handle"); + + // Take ownership of the + this->listen_handle_ = listen_handle; + + // Reinitialize the ACE_Asynch_Accept + if (this->asynch_accept_.open (*this, + this->listen_handle_, + 0, + this->proactor ()) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Accept::open")), + -1); + return 0; +} + +template ACE_HANDLE +ACE_Asynch_Acceptor::get_handle (void) const +{ + return this->listen_handle_; +} + +template int +ACE_Asynch_Acceptor::accept (size_t bytes_to_read, const void *act) +{ + ACE_TRACE ("ACE_Asynch_Acceptor<>::accept"); + + ACE_Message_Block *message_block = 0; + // The space_needed calculation is drive by needs of Windows. POSIX doesn't + // need to extra 16 bytes, but it doesn't hurt. + size_t space_needed = sizeof (sockaddr_in) + 16; +#if defined (ACE_HAS_IPV6) + if (PF_INET6 == this->addr_family_) + space_needed = sizeof (sockaddr_in6) + 16; +#endif /* ACE_HAS_IPV6 */ + space_needed = (2 * space_needed) + bytes_to_read; + + // Create a new message block big enough for the addresses and data + ACE_NEW_RETURN (message_block, + ACE_Message_Block (space_needed), + -1); + + // Initiate asynchronous accepts + if (this->asynch_accept_.accept (*message_block, + bytes_to_read, + ACE_INVALID_HANDLE, + act, + 0, + ACE_SIGRTMIN, + this->addr_family_) == -1) + { + // Cleanup on error + message_block->release (); + return -1; + } + return 0; +} + +template void +ACE_Asynch_Acceptor::handle_accept (const ACE_Asynch_Accept::Result &result) +{ + ACE_TRACE ("ACE_Asynch_Acceptor<>::handle_accept"); + + // Variable for error tracking + int error = 0; + + // If the asynchronous accept fails. + if (!result.success () || result.accept_handle () == ACE_INVALID_HANDLE) + { + error = 1; + } + +#if defined (ACE_WIN32) + // In order to use accept handle with other Window Sockets 1.1 + // functions, we call the setsockopt function with the + // SO_UPDATE_ACCEPT_CONTEXT option. This option initializes the + // socket so that other Windows Sockets routines to access the + // socket correctly. + if (!error && + ACE_OS::setsockopt (result.accept_handle (), + SOL_SOCKET, + SO_UPDATE_ACCEPT_CONTEXT, + (char *) &this->listen_handle_, + sizeof (this->listen_handle_)) == -1) + { + error = 1; + } +#endif /* ACE_WIN32 */ + + // Parse address. + ACE_INET_Addr local_address; + ACE_INET_Addr remote_address; + if (!error && + (this->validate_new_connection_ || this->pass_addresses_)) + // Parse the addresses. + this->parse_address (result, + remote_address, + local_address); + + // Validate remote address + if (!error && + this->validate_new_connection_ && + (this->validate_connection (result, remote_address, local_address) == -1)) + { + error = 1; + } + + HANDLER *new_handler = 0; + if (!error) + { + // The Template method + new_handler = this->make_handler (); + if (new_handler == 0) + { + error = 1; + } + } + + // If no errors + if (!error) + { + // Update the Proactor. + new_handler->proactor (this->proactor ()); + + // Pass the addresses + if (this->pass_addresses_) + new_handler->addresses (remote_address, + local_address); + + // Pass the ACT + if (result.act () != 0) + new_handler->act (result.act ()); + + // Set up the handler's new handle value + new_handler->handle (result.accept_handle ()); + + // Initiate the handler + new_handler->open (result.accept_handle (), + result.message_block ()); + } + + // On failure, no choice but to close the socket + if (error && + result.accept_handle() != ACE_INVALID_HANDLE ) + ACE_OS::closesocket (result.accept_handle ()); + + // Delete the dynamically allocated message_block + result.message_block ().release (); + + // Start off another asynchronous accept to keep the backlog going, + // unless we closed the listen socket already (from the destructor), + // or this callback is the result of a canceled/aborted accept. + if (this->should_reissue_accept () && + this->listen_handle_ != ACE_INVALID_HANDLE +#if defined (ACE_WIN32) + && result.error () != ERROR_OPERATION_ABORTED +#else + && result.error () != ECANCELED +#endif + ) + this->accept (this->bytes_to_read_, result.act ()); +} + +template int +ACE_Asynch_Acceptor::validate_connection + (const ACE_Asynch_Accept::Result& /* result */, + const ACE_INET_Addr& /* remote */, + const ACE_INET_Addr& /* local */) +{ + // Default implementation always validates the remote address. + return 0; +} + +template int +ACE_Asynch_Acceptor::cancel (void) +{ + ACE_TRACE ("ACE_Asynch_Acceptor<>::cancel"); + + // All I/O operations that are canceled will complete with the error + // ERROR_OPERATION_ABORTED. All completion notifications for the I/O + // operations will occur normally. +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) + return (int) ::CancelIo (this->listen_handle_); +#else + // Supported now + return this->asynch_accept_.cancel(); +#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */ +} + +template void +ACE_Asynch_Acceptor::parse_address (const + ACE_Asynch_Accept::Result &result, + ACE_INET_Addr &remote_address, + ACE_INET_Addr &local_address) +{ + ACE_TRACE ("ACE_Asynch_Acceptor<>::parse_address"); + +#if defined (ACE_HAS_AIO_CALLS) + + // Use an ACE_SOCK to get the addresses - it knows how to deal with + // ACE_INET_Addr objects and get IPv4/v6 addresses. + ACE_SOCK_Stream str (result.accept_handle ()); + str.get_local_addr (local_address); + str.get_remote_addr (remote_address); + +#elif defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) + + ACE_Message_Block &message_block = result.message_block (); + + sockaddr *local_addr = 0; + sockaddr *remote_addr = 0; + int local_size = 0; + int remote_size = 0; + // This matches setup in accept(). + size_t addr_size = sizeof (sockaddr_in) + 16; +#if defined (ACE_HAS_IPV6) + if (this->addr_family_ == PF_INET6) + addr_size = sizeof (sockaddr_in6) + 16; +#endif /* ACE_HAS_IPV6 */ + + ::GetAcceptExSockaddrs (message_block.rd_ptr (), + static_cast (this->bytes_to_read_), + static_cast (addr_size), + static_cast (addr_size), + &local_addr, + &local_size, + &remote_addr, + &remote_size); + + local_address.set (reinterpret_cast (local_addr), + local_size); + remote_address.set (reinterpret_cast (remote_addr), + remote_size); +#else + // just in case + errno = ENOTSUP; +#endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */ + return; +} + +template ACE_HANDLE +ACE_Asynch_Acceptor::handle (void) const +{ + return this->listen_handle_; +} + +template void +ACE_Asynch_Acceptor::handle (ACE_HANDLE h) +{ + ACE_Handler::handle (h); +} + +template ACE_Asynch_Accept & +ACE_Asynch_Acceptor::asynch_accept (void) +{ + return this->asynch_accept_; +} + +template HANDLER * +ACE_Asynch_Acceptor::make_handler (void) +{ + // Default behavior + HANDLER *handler = 0; + ACE_NEW_RETURN (handler, + HANDLER, + 0); + return handler; +} + +/* static */ +template size_t +ACE_Asynch_Acceptor::address_size (void) +{ + return sizeof (sockaddr) + sizeof (sockaddr_in); +} + +template bool +ACE_Asynch_Acceptor::pass_addresses (void) const +{ + return this->pass_addresses_; +} + +template void +ACE_Asynch_Acceptor::pass_addresses (bool new_value) +{ + this->pass_addresses_ = new_value; +} + +template bool +ACE_Asynch_Acceptor::validate_new_connection (void) const +{ + return this->validate_new_connection_; +} + +template void +ACE_Asynch_Acceptor::validate_new_connection (bool new_value) +{ + this->validate_new_connection_ = new_value; +} + +template int +ACE_Asynch_Acceptor::reissue_accept (void) const +{ + return this->reissue_accept_; +} + +template void +ACE_Asynch_Acceptor::reissue_accept (int new_value) +{ + this->reissue_accept_ = new_value; +} + +template size_t +ACE_Asynch_Acceptor::bytes_to_read (void) const +{ + return this->bytes_to_read_; +} + +template void +ACE_Asynch_Acceptor::bytes_to_read (size_t new_value) +{ + this->bytes_to_read_ = new_value; +} + +template int +ACE_Asynch_Acceptor::should_reissue_accept (void) +{ + return this->reissue_accept_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ +#endif /* ACE_ASYNCH_ACCEPTOR_C */ diff --git a/externals/ace/Asynch_Acceptor.h b/externals/ace/Asynch_Acceptor.h new file mode 100644 index 0000000..29872d5 --- /dev/null +++ b/externals/ace/Asynch_Acceptor.h @@ -0,0 +1,281 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Asynch_Acceptor.h + * + * $Id: Asynch_Acceptor.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Irfan Pyarali (irfan@cs.wustl.edu) + */ +//============================================================================= + +#ifndef ACE_ASYNCH_ACCEPTOR_H +#define ACE_ASYNCH_ACCEPTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) +// This only works on platforms that support async i/o. + +#include "ace/Default_Constants.h" +#include "ace/Asynch_IO.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations +class ACE_Message_Block; +class ACE_INET_Addr; + +/** + * @class ACE_Asynch_Acceptor + * + * @brief This class is an example of the Acceptor Pattern. This class + * will accept new connections and create new HANDLER to handle + * the new connections. + * + * Unlike the ACE_Acceptor, however, this class is designed to + * be used asynchronously. + */ +template +class ACE_Asynch_Acceptor : public ACE_Handler +{ +public: + /// A do nothing constructor. + ACE_Asynch_Acceptor (void); + + /// Virtual destruction + virtual ~ACE_Asynch_Acceptor (void); + + /** + * @c open starts one or more asynchronous accept requests on a + * @a address. Each accept operation may optionally read an + * initial buffer from the new connection when accepted. + * + * @param address The address to listen/accept connections on. + * If the address does not specify a port, a random + * port is selected and bound. + * @param bytes_to_read Optional, specifies the maximum number of bytes + * to read with the accept. The buffer for the initial + * data is allocated internally and passed to the + * @c ACE_Service_Handler::open() hook method. It is + * legitimate only during the @c open() method and must + * be copied if required after @c open() returns. + * This pre-read function works only on Windows. + * @param pass_addresses Optional, a non-zero value indicates that + * the local and peer addresses should be passed to the + * associated @c ACE_Service_Handler::addresses() method + * after any call to @c validate_new_connection() and prior + * to the @c open() hook method call. + * @param backlog Optional, defaulting to @c ACE_DEFAULT_ASYNCH_BACKLOG (which + * can be adjusted in your platform's @c config.h file). + * Specifies the listening backlog for the listening socket. + * @param reuse_addr Optional, indicates whether the @c SO_REUSEADDR + * option is set on the listening socket or not. + * @param proactor Optional, pointer to the @c ACE_Proactor to use for + * demultiplexing asynchronous accepts. If 0, the + * process's singleton @c ACE_Proactor is used. + * @param validate_new_connection Optional, if true, this object's + * @c validate_connection() method is called after + * the accept completes, but before the service handler's + * @c open() hook method is called. If @c + * validate_connection() returns -1, the newly-accepted + * socket is immediately closed, and the @c addresses() + * method is not called. + * @param reissue_accept Optional, if non-zero (the default), a new + * asynchronous accept operation is started after each + * completion, whether the completion is for success or + * failure, and whether or not a successfully-accepted + * connection is subsequently refused. + * @param number_of_initial_accepts Optional, the number of asynchronous + * accepts that are started immediately. If -1 (the + * default), the value of @a backlog is used. + * + * @note On Windows, the peer address is only available at the time + * the connection is accepted. Therefore, if you require the peer + * address on Windows, do not rely on the + * @c ACE_SOCK::get_remote_addr() method - it won't work. You must + * supply a non-zero value for @a pass_addresses and obtain the + * peer address in the @c ACE_Service_Handler::addresses() method. + * + * @see ACE_INET_Addr + * @see ACE_Service_Handler + */ + virtual int open (const ACE_INET_Addr &address, + size_t bytes_to_read = 0, + bool pass_addresses = false, + int backlog = ACE_DEFAULT_ASYNCH_BACKLOG, + int reuse_addr = 1, + ACE_Proactor *proactor = 0, + bool validate_new_connection = false, + int reissue_accept = 1, + int number_of_initial_accepts = -1); + + /// Get the underlying handle. + virtual ACE_HANDLE get_handle (void) const; + + /** + * Set the underlying listen handle. It is the user's responsibility + * to make sure that the old listen handle has been appropriately + * closed and the all outstanding asynchronous operations have + * either completed or have been canceled on the old listen handle. + */ + virtual int set_handle (ACE_HANDLE handle); + + /// This initiates a new asynchronous accept operation. + /** + * You need only call this method if the @a reissue_accept argument + * passed to @c open() was 0. + */ + virtual int accept (size_t bytes_to_read = 0, const void *act = 0); + + /** + * Cancels all pending accepts operations issued by this object. + * + * @note On Windows, only accept operations initiated by the calling thread + * are canceled. + */ + virtual int cancel (void); + + /** + * Template method to validate peer before service is opened. + * This method is called after a new connection is accepted if the + * @a validate_connection argument to @c open() was non-zero or + * the @c validate_new_connection() method is called to turn this + * feature on. The default implementation returns 0. Users can + * reimplement this method to perform validation of the peer + * using it's address, running an authentication procedure (such as + * SSL) or anything else necessary or desireable. The return value + * from this method determines whether or not ACE will continue + * opening the service or abort the connection. + * + * @param result Result of the connection acceptance. + * @param remote Peer's address. + * @param local Local address connection was accepted at. + * + * @retval -1 ACE_Asynch_Acceptor will close the connection, and + * the service will not be opened. + * @retval 0 Service opening will proceeed. + */ + virtual int validate_connection (const ACE_Asynch_Accept::Result& result, + const ACE_INET_Addr &remote, + const ACE_INET_Addr& local); + + /** + * Template method for deciding whether to reissue accept. + * + * This hook method is called after each accept completes to decide if + * another accept should be initiated. If the method returns a non-zero + * value, another accept is initiated. + * + * The default implemenation always returns the value passed as the + * @c open() method's @a reissue_accept argument. That value can also + * be changed using the @c reissue_accept() method. + */ + virtual int should_reissue_accept (void); + + // + // These are low level tweaking methods + // + + /// Get flag that indicates if parsing and passing of addresses to + /// the service_handler is necessary. + virtual bool pass_addresses (void) const; + + /// Set flag that indicates if parsing and passing of addresses to + /// the service_handler is necessary. + virtual void pass_addresses (bool new_value); + + /// Get flag that indicates if address validation is required. + virtual bool validate_new_connection (void) const; + + /// Set flag that indicates if address validation is required. + virtual void validate_new_connection (bool new_value); + + /// Get flag that indicates if a new accept should be reissued when a accept + /// completes. + virtual int reissue_accept (void) const; + + /// Set flag that indicates if a new accept should be reissued when a accept + /// completes. + virtual void reissue_accept (int new_value); + + /// Get bytes to be read with the call. + virtual size_t bytes_to_read (void) const; + + /// Set bytes to be read with the call. + virtual void bytes_to_read (size_t new_value); + + /// @deprecated address_size() assumes IPv4 use, so is not always valid. + /// This method will be removed after ACE 5.5. Internal uses have been + /// changes to base needed sizes on the addr_family_ member. + static size_t address_size (void); + +protected: + + /// This is called when an outstanding accept completes. + virtual void handle_accept (const ACE_Asynch_Accept::Result &result); + + /// Return the listen handle. + ACE_HANDLE handle (void) const; + /// Set the listen handle. + void handle (ACE_HANDLE h); + + /// This parses the address from read buffer. + void parse_address (const ACE_Asynch_Accept::Result &result, + ACE_INET_Addr &remote_address, + ACE_INET_Addr &local_address); + + /// Return the asynch accept object. + ACE_Asynch_Accept &asynch_accept (void); + + /** + * This is the template method used to create new handler. + * Subclasses must overwrite this method if a new handler creation + * strategy is required. + */ + virtual HANDLER *make_handler (void); + +private: + /// Handle used to listen for new connections. + ACE_HANDLE listen_handle_; + + /// Asynch_Accept used to make life easier :-) + ACE_Asynch_Accept asynch_accept_; + + /// Flag that indicates if parsing of addresses is necessary. + bool pass_addresses_; + + /// Flag that indicates if address validation is required. + bool validate_new_connection_; + + /// Flag that indicates if a new accept should be reissued when a + /// accept completes. + int reissue_accept_; + + /// Bytes to be read with the call. + size_t bytes_to_read_; + + /// Address family used to open this object. Obtained from @a address passed + /// to @c open(). + int addr_family_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Asynch_Acceptor.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Asynch_Acceptor.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ +#include /**/ "ace/post.h" +#endif /* ACE_ASYNCH_ACCEPTOR_H */ diff --git a/externals/ace/Asynch_Connector.cpp b/externals/ace/Asynch_Connector.cpp new file mode 100644 index 0000000..3d49306 --- /dev/null +++ b/externals/ace/Asynch_Connector.cpp @@ -0,0 +1,296 @@ +// $Id: Asynch_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_ASYNCH_CONNECTOR_CPP +#define ACE_ASYNCH_CONNECTOR_CPP + +#include "ace/Asynch_Connector.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) +// This only works on platforms that support async I/O. + +#include "ace/OS_NS_sys_socket.h" +#include "ace/OS_Memory.h" +#include "ace/Flag_Manip.h" +#include "ace/Log_Msg.h" +#include "ace/Message_Block.h" +#include "ace/INET_Addr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Asynch_Connector::ACE_Asynch_Connector (void) + : pass_addresses_ (false), + validate_new_connection_ (false) +{ +} + +template +ACE_Asynch_Connector::~ACE_Asynch_Connector (void) +{ + //this->asynch_connect_.close (); +} + +template int +ACE_Asynch_Connector::open (bool pass_addresses, + ACE_Proactor *proactor, + bool validate_new_connection) +{ + this->proactor (proactor); + this->pass_addresses_ = pass_addresses; + this->validate_new_connection_ = validate_new_connection; + + // Initialize the ACE_Asynch_Connect + if (this->asynch_connect_.open (*this, + ACE_INVALID_HANDLE, + 0, + this->proactor ()) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Connect::open")), + -1); + return 0; +} + +template int +ACE_Asynch_Connector::connect (const ACE_INET_Addr & remote_sap, + const ACE_INET_Addr & local_sap, + int reuse_addr, + const void *act) +{ + // Initiate asynchronous connect + if (this->asynch_connect_.connect (ACE_INVALID_HANDLE, + remote_sap, + local_sap, + reuse_addr, + act) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Connect::connect")), + -1); + return 0; +} + +template void +ACE_Asynch_Connector::handle_connect (const ACE_Asynch_Connect::Result &result) +{ + // Variable for error tracking + int error = 0; + + // If the asynchronous connect fails. + if (!result.success () || + result.connect_handle () == ACE_INVALID_HANDLE) + { + error = 1; + } + + if (result.error () != 0) + { + error = 1; + } + + // set blocking mode + if (!error && + ACE::clr_flags + (result.connect_handle (), ACE_NONBLOCK) != 0) + { + error = 1; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Connector::handle_connect : Set blocking mode"))); + } + + // Parse the addresses. + ACE_INET_Addr local_address; + ACE_INET_Addr remote_address; + if (!error && + (this->validate_new_connection_ || this->pass_addresses_)) + this->parse_address (result, + remote_address, + local_address); + + // Call validate_connection even if there was an error - it's the only + // way the application can learn the connect disposition. + if (this->validate_new_connection_ && + this->validate_connection (result, remote_address, local_address) == -1) + { + error = 1; + } + + HANDLER *new_handler = 0; + if (!error) + { + // The Template method + new_handler = this->make_handler (); + if (new_handler == 0) + { + error = 1; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Connector::handle_connect : Making of new handler failed"))); + } + } + + // If no errors + if (!error) + { + // Update the Proactor. + new_handler->proactor (this->proactor ()); + + // Pass the addresses + if (this->pass_addresses_) + new_handler->addresses (remote_address, + local_address); + + // Pass the ACT + if (result.act () != 0) + new_handler->act (result.act ()); + + // Set up the handler's new handle value + new_handler->handle (result.connect_handle ()); + + ACE_Message_Block mb; + + // Initiate the handler with empty message block; + new_handler->open (result.connect_handle (), mb); + } + + // On failure, no choice but to close the socket + if (error && + result.connect_handle() != ACE_INVALID_HANDLE) + ACE_OS::closesocket (result.connect_handle ()); +} + +template int +ACE_Asynch_Connector::validate_connection + (const ACE_Asynch_Connect::Result &, + const ACE_INET_Addr & /* remote_address */, + const ACE_INET_Addr & /* local_address */) +{ + // Default implementation always validates the remote address. + return 0; +} + +template int +ACE_Asynch_Connector::cancel (void) +{ + return this->asynch_connect_.cancel (); +} + +template void +ACE_Asynch_Connector::parse_address (const ACE_Asynch_Connect::Result &result, + ACE_INET_Addr &remote_address, + ACE_INET_Addr &local_address) +{ +#if defined (ACE_HAS_IPV6) + // Getting the addresses. + sockaddr_in6 local_addr; + sockaddr_in6 remote_addr; +#else + // Getting the addresses. + sockaddr_in local_addr; + sockaddr_in remote_addr; +#endif /* ACE_HAS_IPV6 */ + + // Get the length. + int local_size = sizeof (local_addr); + int remote_size = sizeof (remote_addr); + + // Get the local address. + if (ACE_OS::getsockname (result.connect_handle (), + reinterpret_cast (&local_addr), + &local_size) < 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT("%p\n"), + ACE_TEXT("ACE_Asynch_Connector:: failed"))); + + // Get the remote address. + if (ACE_OS::getpeername (result.connect_handle (), + reinterpret_cast (&remote_addr), + &remote_size) < 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT("%p\n"), + ACE_TEXT("ACE_Asynch_Connector:: failed"))); + + // Set the addresses. + local_address.set (reinterpret_cast (&local_addr), + local_size); + remote_address.set (reinterpret_cast (&remote_addr), + remote_size); + +#if 0 + // @@ Just debugging. + char local_address_buf [BUFSIZ]; + char remote_address_buf [BUFSIZ]; + + if (local_address.addr_to_string (local_address_buf, + sizeof local_address_buf) == -1) + ACE_ERROR ((LM_ERROR, + "Error:%m:can't obtain local_address's address string")); + + ACE_DEBUG ((LM_DEBUG, + "ACE_Asynch_Connector::parse_address : " + "Local address %s\n", + local_address_buf)); + + if (remote_address.addr_to_string (remote_address_buf, + sizeof remote_address_buf) == -1) + ACE_ERROR ((LM_ERROR, + "Error:%m:can't obtain remote_address's address string")); + + ACE_DEBUG ((LM_DEBUG, + "ACE_Asynch_Connector::parse_address : " + "Remote address %s\n", + remote_address_buf)); +#endif /* 0 */ + + return; +} + + +template ACE_Asynch_Connect & +ACE_Asynch_Connector::asynch_connect (void) +{ + return this->asynch_connect_; +} + +template HANDLER * +ACE_Asynch_Connector::make_handler (void) +{ + // Default behavior + HANDLER *handler = 0; + ACE_NEW_RETURN (handler, HANDLER, 0); + return handler; +} + +template bool +ACE_Asynch_Connector::pass_addresses (void) const +{ + return this->pass_addresses_; +} + +template void +ACE_Asynch_Connector::pass_addresses (bool new_value) +{ + this->pass_addresses_ = new_value; +} + +template bool +ACE_Asynch_Connector::validate_new_connection (void) const +{ + return this->validate_new_connection_; +} + +template void +ACE_Asynch_Connector::validate_new_connection (bool new_value) +{ + this->validate_new_connection_ = new_value; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ +#endif /* ACE_ASYNCH_CONNECTOR_CPP */ diff --git a/externals/ace/Asynch_Connector.h b/externals/ace/Asynch_Connector.h new file mode 100644 index 0000000..7c7969c --- /dev/null +++ b/externals/ace/Asynch_Connector.h @@ -0,0 +1,171 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Asynch_Connector.h + * + * $Id: Asynch_Connector.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Alexander Libman + */ +//============================================================================= + +#ifndef ACE_ASYNCH_CONNECTOR_H +#define ACE_ASYNCH_CONNECTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) +// This only works on platforms that support async i/o. + +#include "ace/Asynch_IO.h" +#include "ace/INET_Addr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations +class ACE_Message_Block; + +/** + * @class ACE_Asynch_Connector + * + * @brief This class is an example of the Connector pattern. This class + * will establish new connections and create new HANDLER objects to handle + * the new connections. + * + * Unlike the ACE_Connector, however, this class is designed to + * be used asynchronously with the ACE Proactor framework. + */ + +template +class ACE_Asynch_Connector : public ACE_Handler +{ +public: + /// A do nothing constructor. + ACE_Asynch_Connector (void); + + /// Virtual destruction + virtual ~ACE_Asynch_Connector (void); + + /** + * This opens asynch connector + */ + virtual int open (bool pass_addresses = false, + ACE_Proactor *proactor = 0, + bool validate_new_connection = true); + + /// This initiates a new asynchronous connect + virtual int connect (const ACE_INET_Addr &remote_sap, + const ACE_INET_Addr &local_sap = + (const ACE_INET_Addr &)ACE_Addr::sap_any, + int reuse_addr = 1, + const void *act = 0); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. + * + * @note On Windows, this method does not cancel connect operations + * issued by other threads. + * + * @note On POSIX, delegates cancelation to ACE_POSIX_Asynch_Connect. + */ + virtual int cancel (void); + + + /** + * Template method to validate peer before service is opened. + * This method is called when the connection attempt completes, + * whether it succeeded or failed, if the @a validate_connection + * argument to @c open() was non-zero or the @c validate_new_connection() + * method is called to turn this feature on. The default implementation + * returns 0. Users can (and probably should) reimplement this method + * to learn about the success or failure of the connection attempt. + * If the connection completed successfully, this method can be used to + * perform validation of the peer using it's address, running an + * authentication procedure (such as SSL) or anything else necessary or + * desireable. The return value from this method determines whether or + * not ACE will continue opening the service or abort the connection. + * + * @param result Result of the connection acceptance. Use + * result.success() to determine success or failure of + * the connection attempt. + * @param remote Peer's address. If the connection failed, this object + * is undefined. + * @param local Local address connection was completed from. If the + * connection failed, this object is undefined. + * + * @retval -1 ACE_Asynch_Connector will close the connection, and + * the service will not be opened. + * @retval 0 Service opening will proceeed. + * @return Return value is ignored if the connection attempt failed. + */ + virtual int validate_connection (const ACE_Asynch_Connect::Result& result, + const ACE_INET_Addr &remote, + const ACE_INET_Addr& local); + + // + // These are low level tweaking methods + // + + /// Set and get flag that indicates if parsing and passing of + /// addresses to the service_handler is necessary. + virtual bool pass_addresses (void) const; + virtual void pass_addresses (bool new_value); + + /// Set and get flag that indicates if address validation is + /// required. + virtual bool validate_new_connection (void) const; + virtual void validate_new_connection (bool new_value); + +protected: + + /// This is called when an outstanding accept completes. + virtual void handle_connect (const ACE_Asynch_Connect::Result &result); + + + /// This parses the address from read buffer. + void parse_address (const ACE_Asynch_Connect::Result &result, + ACE_INET_Addr &remote_address, + ACE_INET_Addr &local_address); + + /// Return the asynch Connect object. + ACE_Asynch_Connect & asynch_connect (void); + + /** + * This is the template method used to create new handler. + * Subclasses must overwrite this method if a new handler creation + * strategy is required. + */ + virtual HANDLER *make_handler (void); + +private: + + /// Asynch_Connect used to make life easier :-) + ACE_Asynch_Connect asynch_connect_; + + /// Flag that indicates if parsing of addresses is necessary. + bool pass_addresses_; + + /// Flag that indicates if address validation is required. + bool validate_new_connection_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Asynch_Connector.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Asynch_Connector.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ +#include /**/ "ace/post.h" +#endif /* ACE_ASYNCH_CONNECTOR_H */ diff --git a/externals/ace/Asynch_IO.cpp b/externals/ace/Asynch_IO.cpp new file mode 100644 index 0000000..26bba31 --- /dev/null +++ b/externals/ace/Asynch_IO.cpp @@ -0,0 +1,1414 @@ +// $Id: Asynch_IO.cpp 82559 2008-08-07 20:23:07Z parsons $ + +#include "ace/Asynch_IO.h" + +ACE_RCSID(ace, Asynch_IO, "$Id: Asynch_IO.cpp 82559 2008-08-07 20:23:07Z parsons $") + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) +// This only works on platforms with Asynchronous IO + +#include "ace/Proactor.h" +#include "ace/Message_Block.h" +#include "ace/INET_Addr.h" +#include "ace/Asynch_IO_Impl.h" +#include "ace/os_include/os_errno.h" +#include "ace/Truncate.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +size_t +ACE_Asynch_Result::bytes_transferred (void) const +{ + return this->implementation ()->bytes_transferred (); +} + +const void * +ACE_Asynch_Result::act (void) const +{ + return this->implementation ()->act (); +} + +int +ACE_Asynch_Result::success (void) const +{ + return this->implementation ()->success (); +} + +const void * +ACE_Asynch_Result::completion_key (void) const +{ + return this->implementation ()->completion_key (); +} + +unsigned long +ACE_Asynch_Result::error (void) const +{ + return this->implementation ()->error (); +} + +ACE_HANDLE +ACE_Asynch_Result::event (void) const +{ + return this->implementation ()->event (); +} + +unsigned long +ACE_Asynch_Result::offset (void) const +{ + return this->implementation ()->offset (); +} + +unsigned long +ACE_Asynch_Result::offset_high (void) const +{ + return this->implementation ()->offset_high (); +} + +int +ACE_Asynch_Result::priority (void) const +{ + return this->implementation ()->priority (); +} + +int +ACE_Asynch_Result::signal_number (void) const +{ + return this->implementation ()->signal_number (); +} + +ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation) + : implementation_ (implementation) +{ +} + +ACE_Asynch_Result::~ACE_Asynch_Result (void) +{ + // Proactor deletes the implementation when the finishes. +} + +ACE_Asynch_Result_Impl * +ACE_Asynch_Result::implementation (void) const +{ + return this->implementation_; +} + +// ********************************************************************* + +int +ACE_Asynch_Operation::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return this->implementation ()->open (handler.proxy (), + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Operation::cancel (void) +{ + if (0 == this->implementation ()) + { + errno = EFAULT; + return -1; + } + return this->implementation ()->cancel (); +} + +ACE_Proactor * +ACE_Asynch_Operation::proactor (void) const +{ + if (0 == this->implementation ()) + { + errno = EFAULT; + return 0; + } + return this->implementation ()->proactor (); +} + +ACE_Asynch_Operation::ACE_Asynch_Operation (void) +{ +} + +ACE_Asynch_Operation::~ACE_Asynch_Operation (void) +{ +} + +ACE_Proactor * +ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor, + ACE_Handler &handler) const +{ + if (user_proactor == 0) + { + // Grab the singleton proactor if proactor> is zero + user_proactor = handler.proactor (); + if (user_proactor == 0) + user_proactor = ACE_Proactor::instance (); + } + + return user_proactor; +} + +// ************************************************************ + +ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Read_Stream::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_read_stream ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->read (message_block, + bytes_to_read, + act, + priority, + signal_number); +} + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) +int +ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->readv (message_block, + bytes_to_read, + act, + priority, + signal_number); +} +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Read_Stream::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +size_t +ACE_Asynch_Read_Stream::Result::bytes_to_read (void) const +{ + return this->implementation ()->bytes_to_read (); +} + +ACE_Message_Block & +ACE_Asynch_Read_Stream::Result::message_block (void) const +{ + return this->implementation ()->message_block (); +} + +ACE_HANDLE +ACE_Asynch_Read_Stream::Result::handle (void) const +{ + return this->implementation ()->handle (); +} + +ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl *implementation) + : ACE_Asynch_Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Read_Stream::Result::~Result (void) +{ + // Proactor will delete the implementation after is + // finished. +} + +ACE_Asynch_Read_Stream_Result_Impl * +ACE_Asynch_Read_Stream::Result::implementation (void) const +{ + return this->implementation_; +} + +// *************************************************** + +ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Write_Stream::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_write_stream ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->write (message_block, + bytes_to_write, + act, + priority, + signal_number); +} + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) +int +ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->writev (message_block, + bytes_to_write, + act, + priority, + signal_number); +} +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Write_Stream::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +size_t +ACE_Asynch_Write_Stream::Result::bytes_to_write (void) const +{ + return this->implementation ()->bytes_to_write (); +} + +ACE_Message_Block & +ACE_Asynch_Write_Stream::Result::message_block (void) const +{ + return this->implementation ()->message_block (); +} + +ACE_HANDLE +ACE_Asynch_Write_Stream::Result::handle (void) const +{ + return this->implementation ()->handle (); +} + +ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl *implementation) + : ACE_Asynch_Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Write_Stream::Result::~Result (void) +{ + // Proactor will delte the implementation when the call + // finishes. +} + +ACE_Asynch_Write_Stream_Result_Impl * +ACE_Asynch_Write_Stream::Result::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +ACE_Asynch_Read_File::ACE_Asynch_Read_File (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Read_File::~ACE_Asynch_Read_File (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Read_File::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_read_file ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Read_File::read (ACE_Message_Block &message_block, + size_t bytes_to_read, + unsigned long offset, + unsigned long offset_high, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->read (message_block, + bytes_to_read, + offset, + offset_high, + act, + priority, + signal_number); +} + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) +int +ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + unsigned long offset, + unsigned long offset_high, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->readv (message_block, + bytes_to_read, + offset, + offset_high, + act, + priority, + signal_number); +} +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Read_File::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl *implementation) + : ACE_Asynch_Read_Stream::Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Read_File::Result::~Result (void) +{ + // Proactor will delete the implementation when call + // completes. +} + +ACE_Asynch_Read_File_Result_Impl * +ACE_Asynch_Read_File::Result::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +ACE_Asynch_Write_File::ACE_Asynch_Write_File (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Write_File::~ACE_Asynch_Write_File (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Write_File::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_write_file ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Write_File::write (ACE_Message_Block &message_block, + size_t bytes_to_write, + unsigned long offset, + unsigned long offset_high, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->write (message_block, + bytes_to_write, + offset, + offset_high, + act, + priority, + signal_number); +} + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) +int +ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + unsigned long offset, + unsigned long offset_high, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->writev (message_block, + bytes_to_write, + offset, + offset_high, + act, + priority, + signal_number); +} +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Write_File::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl *implementation) + : ACE_Asynch_Write_Stream::Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Write_File::Result::~Result (void) +{ + // Proactor will delete the implementation when the call + // completes. +} + +ACE_Asynch_Write_File_Result_Impl * +ACE_Asynch_Write_File::Result::implementation (void) const +{ + return this->implementation_; +} + +// ********************************************************************* + +ACE_Asynch_Accept::ACE_Asynch_Accept (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Accept::~ACE_Asynch_Accept (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Accept::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_accept ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Accept::accept (ACE_Message_Block &message_block, + size_t bytes_to_read, + ACE_HANDLE accept_handle, + const void *act, + int priority, + int signal_number, + int addr_family) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->accept (message_block, + bytes_to_read, + accept_handle, + act, + priority, + signal_number, + addr_family); +} + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Accept::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +size_t +ACE_Asynch_Accept::Result::bytes_to_read (void) const +{ + return this->implementation ()->bytes_to_read (); +} + +ACE_Message_Block & +ACE_Asynch_Accept::Result::message_block (void) const +{ + return this->implementation ()->message_block (); +} + +ACE_HANDLE +ACE_Asynch_Accept::Result::listen_handle (void) const +{ + return this->implementation ()->listen_handle (); +} + +ACE_HANDLE +ACE_Asynch_Accept::Result::accept_handle (void) const +{ + return this->implementation ()->accept_handle (); +} + +ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl *implementation) + : ACE_Asynch_Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Accept::Result::~Result (void) +{ + // Proactor will delete the implementation when the call + // completes. +} + +ACE_Asynch_Accept_Result_Impl * +ACE_Asynch_Accept::Result::implementation (void) const +{ + return this->implementation_; +} + + + +// ********************************************************************* + +ACE_Asynch_Connect::ACE_Asynch_Connect (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Connect::~ACE_Asynch_Connect (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Connect::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_connect ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle, + const ACE_Addr & remote_sap, + const ACE_Addr & local_sap, + int reuse_addr, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->connect (connect_handle, + remote_sap, + local_sap, + reuse_addr, + act, + priority, + signal_number); +} + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Connect::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl *implementation) + : ACE_Asynch_Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Connect::Result::~Result (void) +{ + // Proactor will delete the implementation when the call + // completes. +} + +ACE_HANDLE +ACE_Asynch_Connect::Result::connect_handle (void) const +{ + return this->implementation ()->connect_handle (); +} + + +ACE_Asynch_Connect_Result_Impl * +ACE_Asynch_Connect::Result::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Transmit_File::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_transmit_file ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +int +ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, + Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + unsigned long offset, + unsigned long offset_high, + size_t bytes_per_send, + unsigned long flags, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->transmit_file (file, + header_and_trailer, + bytes_to_write, + offset, + offset_high, + bytes_per_send, + flags, + act, + priority, + signal_number); +} + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Transmit_File::implementation (void) const +{ + return this->implementation_; +} + +// **************************************************************************** + +ACE_HANDLE +ACE_Asynch_Transmit_File::Result::socket (void) const +{ + return this->implementation ()->socket (); +} + +ACE_HANDLE +ACE_Asynch_Transmit_File::Result::file (void) const +{ + return this->implementation ()->file (); +} + +ACE_Asynch_Transmit_File::Header_And_Trailer * +ACE_Asynch_Transmit_File::Result::header_and_trailer (void) const +{ + return this->implementation ()->header_and_trailer (); +} + +size_t +ACE_Asynch_Transmit_File::Result::bytes_to_write (void) const +{ + return this->implementation ()->bytes_to_write (); +} + +size_t +ACE_Asynch_Transmit_File::Result::bytes_per_send (void) const +{ + return this->implementation ()->bytes_per_send (); +} + +unsigned long +ACE_Asynch_Transmit_File::Result::flags (void) const +{ + return this->implementation ()->flags (); +} + +ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl *implementation) + : ACE_Asynch_Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Transmit_File::Result::~Result (void) +{ +} + +ACE_Asynch_Transmit_File_Result_Impl * +ACE_Asynch_Transmit_File::Result::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block *header, + size_t header_bytes, + ACE_Message_Block *trailer, + size_t trailer_bytes) + : header_ (header), + header_bytes_ (header_bytes), + trailer_ (trailer), + trailer_bytes_ (trailer_bytes) +{ +} + +ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer (void) +{ +} + +void +ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block *header, + size_t header_bytes, + ACE_Message_Block *trailer, + size_t trailer_bytes) +{ + this->header (header); + this->header_bytes (header_bytes); + this->trailer (trailer); + this->trailer_bytes (trailer_bytes); +} + +ACE_Message_Block * +ACE_Asynch_Transmit_File::Header_And_Trailer::header (void) const +{ + return this->header_; +} + +void +ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block *message_block) +{ + this->header_ = message_block; +} + +size_t +ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (void) const +{ + return this->header_bytes_; +} + +void +ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes) +{ + this->header_bytes_ = bytes; +} + +ACE_Message_Block * +ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (void) const +{ + return this->trailer_; +} + +void +ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block *message_block) +{ + this->trailer_ = message_block; +} + +size_t +ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (void) const +{ + return this->trailer_bytes_; +} + +void +ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes) +{ + this->trailer_bytes_ = bytes; +} + +ACE_LPTRANSMIT_FILE_BUFFERS +ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers (void) +{ + // If both are zero, return zero + if (this->header_ == 0 && this->trailer_ == 0) + { + return 0; + } + else + { + // Something is valid + + // If header is valid, set the fields + if (this->header_ != 0) + { + this->transmit_buffers_.Head = this->header_->rd_ptr (); +#if defined (ACE_WIN64) || defined (ACE_WIN32) + this->transmit_buffers_.HeadLength = + ACE_Utils::truncate_cast (this->header_bytes_); +#else + this->transmit_buffers_.HeadLength = this->header_bytes_; +#endif /* ACE_WIN64 || ACE_WIN32 */ + } + else + { + this->transmit_buffers_.Head = 0; + this->transmit_buffers_.HeadLength = 0; + } + + // If trailer is valid, set the fields + if (this->trailer_ != 0) + { + this->transmit_buffers_.Tail = this->trailer_->rd_ptr (); +#if defined(ACE_WIN64) || defined (ACE_WIN32) + this->transmit_buffers_.TailLength = + ACE_Utils::truncate_cast (this->trailer_bytes_); +#else + this->transmit_buffers_.TailLength = this->trailer_bytes_; +#endif /* ACE_WIN64 || ACE_WIN32 */ + } + else + { + this->transmit_buffers_.Tail = 0; + this->transmit_buffers_.TailLength = 0; + } + + // Return the transmit buffers + return &this->transmit_buffers_; + } +} + +// ********************************************************************* + +ACE_Handler::ACE_Handler (void) + : proactor_ (0), handle_ (ACE_INVALID_HANDLE) +{ + ACE_Handler::Proxy *p; + ACE_NEW (p, ACE_Handler::Proxy (this)); + this->proxy_.reset (p); +} + +ACE_Handler::ACE_Handler (ACE_Proactor *d) + : proactor_ (d), handle_ (ACE_INVALID_HANDLE) +{ + ACE_Handler::Proxy *p; + ACE_NEW (p, ACE_Handler::Proxy (this)); + this->proxy_.reset (p); +} + +ACE_Handler::~ACE_Handler (void) +{ + ACE_Handler::Proxy *p = this->proxy_.get (); + if (p) + p->reset (); +} + +void +ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & /* result */) +{ +} + +void +ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & /* result */) +{ +} + +void +ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result & /* result */) +{ +} + +void +ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result & /* result */) +{ +} + +void +ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & /* result */) +{ +} + +void +ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result & /* result */) +{ +} + +void +ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & /* result */) +{ +} + +void +ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & /* result */) +{ +} + +void +ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & /* result */) +{ +} + +void +ACE_Handler::handle_time_out (const ACE_Time_Value & /* tv */, + const void * /* act */) +{ +} + +void +ACE_Handler::handle_wakeup (void) +{ +} + +ACE_Proactor * +ACE_Handler::proactor (void) +{ + return this->proactor_; +} + +void +ACE_Handler::proactor (ACE_Proactor *p) +{ + this->proactor_ = p; +} + +ACE_HANDLE +ACE_Handler::handle (void) const +{ + return this->handle_; +} + +void +ACE_Handler::handle (ACE_HANDLE h) +{ + this->handle_ = h; +} + +ACE_Refcounted_Auto_Ptr & +ACE_Handler::proxy (void) +{ + return this->proxy_; +} + +// ************************************************************ + +ACE_Service_Handler::ACE_Service_Handler (void) +{ +} + +ACE_Service_Handler::~ACE_Service_Handler (void) +{ +} + +void +ACE_Service_Handler::addresses (const ACE_INET_Addr & /* remote_address */, + const ACE_INET_Addr & /* local_address */ ) +{ +} + +void +ACE_Service_Handler::act (const void *) +{ +} + +void +ACE_Service_Handler::open (ACE_HANDLE, + ACE_Message_Block &) +{ +} + + +// ************************************************************ + +ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Read_Dgram::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_read_dgram ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +ssize_t +ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, + size_t &number_of_bytes_recvd, + int flags, + int protocol_family, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->recv (message_block, + number_of_bytes_recvd, + flags, + protocol_family, + act, + priority, + signal_number); +} + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Read_Dgram::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +int +ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr& addr) const +{ + return this->implementation ()->remote_address (addr); +} + +ACE_Message_Block* +ACE_Asynch_Read_Dgram::Result::message_block (void) const +{ + return this->implementation ()->message_block (); +} + +int +ACE_Asynch_Read_Dgram::Result::flags (void) const +{ + return this->implementation ()->flags (); +} + +size_t +ACE_Asynch_Read_Dgram::Result::bytes_to_read (void) const +{ + return this->implementation ()->bytes_to_read (); +} + +ACE_HANDLE +ACE_Asynch_Read_Dgram::Result::handle (void) const +{ + return this->implementation ()->handle(); +} + +ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation) +: ACE_Asynch_Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Read_Dgram::Result::~Result (void) +{ +} + +ACE_Asynch_Read_Dgram_Result_Impl * +ACE_Asynch_Read_Dgram::Result::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + + +ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram (void) + : implementation_ (0) +{ +} + +ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram (void) +{ + // Delete the implementation. + delete this->implementation_; + this->implementation_ = 0; +} + +int +ACE_Asynch_Write_Dgram::open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + // Get a proactor for/from the user. + proactor = this->get_proactor (proactor, handler); + + // Now let us get the implementation initialized. + if ((this->implementation_ = proactor->create_asynch_write_dgram ()) == 0) + return -1; + + // Call the method of the base class. + return ACE_Asynch_Operation::open (handler, + handle, + completion_key, + proactor); +} + +ssize_t +ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, + size_t &number_of_bytes_sent, + int flags, + const ACE_Addr& remote_addr, + const void *act, + int priority, + int signal_number) +{ + if (0 == this->implementation_) + { + errno = EFAULT; + return -1; + } + return this->implementation_->send (message_block, + number_of_bytes_sent, + flags, + remote_addr, + act, + priority, + signal_number); +} + +ACE_Asynch_Operation_Impl * +ACE_Asynch_Write_Dgram::implementation (void) const +{ + return this->implementation_; +} + +// ************************************************************ + +size_t +ACE_Asynch_Write_Dgram::Result::bytes_to_write (void) const +{ + return this->implementation ()->bytes_to_write (); +} + +ACE_Message_Block* +ACE_Asynch_Write_Dgram::Result::message_block () const +{ + return this->implementation ()->message_block (); +} + +int +ACE_Asynch_Write_Dgram::Result::flags (void) const +{ + return this->implementation ()->flags (); +} + +ACE_HANDLE +ACE_Asynch_Write_Dgram::Result::handle (void) const +{ + return this->implementation ()->handle (); +} + +ACE_Asynch_Write_Dgram_Result_Impl * +ACE_Asynch_Write_Dgram::Result::implementation (void) const +{ + return this->implementation_; +} + +ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation) +: ACE_Asynch_Result (implementation), + implementation_ (implementation) +{ +} + +ACE_Asynch_Write_Dgram::Result::~Result (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ diff --git a/externals/ace/Asynch_IO.h b/externals/ace/Asynch_IO.h new file mode 100644 index 0000000..641e22a --- /dev/null +++ b/externals/ace/Asynch_IO.h @@ -0,0 +1,1761 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Asynch_IO.h + * + * $Id: Asynch_IO.h 84837 2009-03-16 13:01:15Z johnnyw $ + * + * This works on Win32 (defined (ACE_WIN32) && !defined + * (ACE_HAS_WINCE)) platforms and on POSIX4 platforms with {aio_*} + * routines (defined (ACE_HAS_AIO_CALLS)) + * + * On Win32 platforms, the implementation of + * {ACE_Asynch_Transmit_File} and {ACE_Asynch_Accept} are only + * supported if ACE_HAS_WINSOCK2 is defined or you are on WinNT 4.0 + * or higher. + * + * @author Irfan Pyarali + * @author Tim Harrison + * @author Alexander Babu Arulanthu + * @author Roger Tragin + * @author Alexander Libman + */ +//============================================================================= + +#ifndef ACE_ASYNCH_IO_H +#define ACE_ASYNCH_IO_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) + +#include "ace/Synch_Traits.h" +#if defined (ACE_HAS_THREADS) +# include "ace/Thread_Mutex.h" +#else +# include "ace/Null_Mutex.h" +#endif /* ACE_HAS_THREADS */ +#include "ace/Refcounted_Auto_Ptr.h" + +#include "ace/os_include/os_signal.h" +#include "ace/os_include/sys/os_socket.h" +#include "ace/os_include/sys/os_types.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_HAS_WIN32_OVERLAPPED_IO) +typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS; +typedef LPTRANSMIT_FILE_BUFFERS ACE_LPTRANSMIT_FILE_BUFFERS; +typedef PTRANSMIT_FILE_BUFFERS ACE_PTRANSMIT_FILE_BUFFERS; + +# define ACE_INFINITE INFINITE +# define ACE_STATUS_TIMEOUT STATUS_TIMEOUT +# define ACE_WAIT_FAILED WAIT_FAILED +# define ACE_WAIT_TIMEOUT WAIT_TIMEOUT +# else /* ACE_HAS_WIN32_OVERLAPPED_IO */ +struct ACE_TRANSMIT_FILE_BUFFERS +{ + void *Head; + size_t HeadLength; + void *Tail; + size_t TailLength; +}; +typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_PTRANSMIT_FILE_BUFFERS; +typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS; + +# if !defined (ACE_INFINITE) +# define ACE_INFINITE LONG_MAX +# endif /* ACE_INFINITE */ +# define ACE_STATUS_TIMEOUT LONG_MAX +# define ACE_WAIT_FAILED LONG_MAX +# define ACE_WAIT_TIMEOUT LONG_MAX +# endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ + +// Forward declarations +class ACE_Proactor; +class ACE_Handler; +class ACE_Message_Block; +class ACE_INET_Addr; +class ACE_Addr; + +// Forward declarations +class ACE_Asynch_Result_Impl; +class ACE_Time_Value; + +/** + * @class ACE_Asynch_Result + * + * @brief An interface base class which allows users access to common + * information related to an asynchronous operation. + * + * An interface base class from which you can obtain some basic + * information like the number of bytes transferred, the ACT + * associated with the asynchronous operation, indication of + * success or failure, etc. Subclasses may want to store more + * information that is particular to the asynchronous operation + * it represents. + */ +class ACE_Export ACE_Asynch_Result +{ + +public: + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This is the ACT associated with the handle on which the + * Asynch_Operation takes place. + * + * On WIN32, this returns the ACT associated with the handle when it + * was registered with the I/O completion port. + * + * @@ This is not implemented for POSIX4 platforms. Returns 0. + */ + const void *completion_key (void) const; + + /// Error value if the operation fails. + unsigned long error (void) const; + + /** + * On WIN32, this returns the event associated with the OVERLAPPED + * structure. + * + * This returns ACE_INVALID_HANDLE on POSIX4-Unix platforms. + */ + ACE_HANDLE event (void) const; + + /** + * This really makes sense only when doing file I/O. + * + * On WIN32, these are represented in the OVERLAPPED datastructure. + * + * @@ On POSIX4-Unix, offset_high should be supported using + * aiocb64. + */ + unsigned long offset (void) const; + unsigned long offset_high (void) const; + + /** + * Priority of the operation. + * + * On POSIX4-Unix, this is supported. Priority works like {nice} in + * Unix. Negative values are not allowed. 0 means priority of the + * operation same as the process priority. 1 means priority of the + * operation is one less than process. And so forth. + * + * On Win32, this is a no-op. + */ + int priority (void) const; + + /** + * POSIX4 real-time signal number to be used for the + * operation. {signal_number} ranges from ACE_SIGRTMIN to ACE_SIGRTMAX. By + * default, ACE_SIGRTMIN is used to issue {aio_} calls. This is a no-op + * on non-POSIX4 systems and returns 0. + */ + int signal_number (void) const; + + + /// Destructor. + virtual ~ACE_Asynch_Result (void); + +protected: + /// Constructor. This implementation will not be deleted. The + /// implementation will be deleted by the Proactor. + ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation); + + /// Get the implementation class. + ACE_Asynch_Result_Impl *implementation (void) const; + + /// Implementation class. + ACE_Asynch_Result_Impl *implementation_; +}; + +// Forward declarations +class ACE_Asynch_Operation_Impl; + +/** + * @class ACE_Asynch_Operation + * + * @brief This is an interface base class for all asynch + * operations. The resposiblility of this class is to forward + * all methods to its delegation/implementation class, e.g., + * ACE_WIN32_Asynch_Operation or ACE_POSIX_Asynch_Operation. + * + * There are some attributes and functionality which is common + * to all asychronous operations. The delegation classes of this + * class will factor out this code. + */ +class ACE_Export ACE_Asynch_Operation +{ + +public: + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), + * {ACE_Handler::handle} will be called on the {handler} to get the + * correct handle. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * (Attempts to) cancel the asynchronous operation pending against + * the {handle} registered with this Operation. + * + * All completion notifications for the I/O operations will occur + * normally. + * + * = Return Values: + * + * -1 : Operation failed. (can get only in POSIX). + * 0 : All the operations were cancelled. + * 1 : All the operations were already finished in this + * handle. Unable to cancel them. + * 2 : Atleast one of the requested operations cannot be + * cancelled. + * + * There is slight difference in the semantics between NT and POSIX + * platforms which is given below. + * + * = Win32 : + * + * cancels all pending accepts operations that were issued by the + * calling thread. The function does not cancel asynchronous + * operations issued by other threads. + * All I/O operations that are canceled will complete with the + * error ERROR_OPERATION_ABORTED. + * + * = POSIX: + * + * Attempts to cancel one or more asynchronous I/O requests + * currently outstanding against the {handle} registered in this + * operation. + * For requested operations that are successfully canceled, the + * associated error status is set to ECANCELED. + */ + int cancel (void); + + + // = Access methods. + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + + /// Destructor. + virtual ~ACE_Asynch_Operation (void); + +protected: + /// Constructor. + ACE_Asynch_Operation (void); + + /// Return the underlying implementation class. + virtual ACE_Asynch_Operation_Impl *implementation (void) const = 0; + + /// Get a proactor for/from the user + ACE_Proactor *get_proactor (ACE_Proactor *user_proactor, + ACE_Handler &handler) const; +}; + +// Forward declarations +class ACE_Asynch_Read_Stream_Result_Impl; +class ACE_Asynch_Read_Stream_Impl; + +/** + * @class ACE_Asynch_Read_Stream + * + * @brief This class is a factory for starting off asynchronous reads + * on a stream. This class forwards all methods to its + * implementation class. + * + * Once {open} is called, multiple asynchronous {read}s can + * started using this class. An ACE_Asynch_Read_Stream::Result + * will be passed back to the {handler} when the asynchronous + * reads completes through the {ACE_Handler::handle_read_stream} + * callback. + */ +class ACE_Export ACE_Asynch_Read_Stream : public ACE_Asynch_Operation +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Read_Stream (void); + + /// Destructor + virtual ~ACE_Asynch_Read_Stream (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. + * + * @param handler The ACE_Handler that will be called to handle completions + * for operations initiated using this factory. + * @param handle The handle that future read operations will use. + * If handle == @c ACE_INVALID_HANDLE, + * ACE_Handler::handle() will be called on @ handler + * to get the correct handle. + * + * @retval 0 for success. + * @retval -1 for failure; consult @c errno for further information. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** + * Initiate an asynchronous read operation. + * + * @param message_block The ACE_Message_Block to receive the data. + * Received bytes will be placed in the block + * beginning at its current write pointer. + * If data is read, the message block's write + * pointer will be advanced by the number of + * bytes read. + * @param num_bytes_to_read The maximum number of bytes to read. + * @param act Asynchronous Completion Token; passed through to + * the completion handler in the Result object. + * @param priority Priority of the operation. On POSIX4-Unix, + * this is supported. Works like @c nice in Unix. + * Negative values are not allowed. 0 means + * priority of the operation same as the process + * priority. 1 means priority of the operation is + * one less than process priority, etc. + * Ignored on Windows. + * @param signal_number The POSIX4 real-time signal number to be used + * to signal completion of the operation. Values + * range from ACE_SIGRTMIN to ACE_SIGRTMAX. + * This argument is ignored on non-POSIX4 systems. + */ + int read (ACE_Message_Block &message_block, + size_t num_bytes_to_read, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) + /** + * Same as above but with scatter support, through chaining of composite + * message blocks using the continuation field. + */ + int readv (ACE_Message_Block &message_block, + size_t num_bytes_to_read, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); +#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */ + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Implementation class that all methods will be forwarded to. + ACE_Asynch_Read_Stream_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is the class which will be passed back to the + * ACE_Handler::handle_read_stream when the asynchronous read completes. + * This class forwards all the methods to the implementation classes. + * + * This class has all the information necessary for the + * handler to uniquiely identify the completion of the + * asynchronous read. + */ + class ACE_Export Result : public ACE_Asynch_Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Read_Stream_Result; + friend class ACE_WIN32_Asynch_Read_Stream_Result; + + public: + /// The number of bytes which were requested at the start of the + /// asynchronous read. + size_t bytes_to_read (void) const; + + /// Message block which contains the read data. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for reading. + ACE_HANDLE handle (void) const; + + /// Get the implementation class. + ACE_Asynch_Read_Stream_Result_Impl *implementation (void) const; + + protected: + /// Constructor. + Result (ACE_Asynch_Read_Stream_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// The implementation class. + ACE_Asynch_Read_Stream_Result_Impl *implementation_; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Read_Stream &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Read_Stream (const ACE_Asynch_Read_Stream &)) +}; + +// Forward declarations +class ACE_Asynch_Write_Stream_Impl; +class ACE_Asynch_Write_Stream_Result_Impl; + +/** + * @class ACE_Asynch_Write_Stream + * + * @brief This class is a factory for initiating asynchronous writes + * on a connected TCP/IP stream. This class forwards all methods to its + * implementation class. + * + * Once open() is called, multiple asynchronous writes can be + * started using this class. An ACE_Asynch_Write_Stream::Result + * will be passed to the ACE_Handler::handle_write_stream() method on the + * opened ACE_Handler object when the asynchronous write completes. + */ +class ACE_Export ACE_Asynch_Write_Stream : public ACE_Asynch_Operation +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Write_Stream (void); + + /// Destructor. + virtual ~ACE_Asynch_Write_Stream (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous operation. + * + * @param handler ACE_Handler to be notified when operations initiated + * via this factory complete. The handle_write_stream() + * method will be called on this object. + * @param handle The socket handle to initiate write operations on. + * If handle is @c ACE_INVALID_HANDLE, + * ACE_Handler::handle() will be called on handler to + * get the handle value. + * @param completion_key A token that is passed to the completion handler. + * @param proactor The ACE_Proactor object which will control operation + * completion and dispatching the results to handler. + * If this is 0, the process's singleton ACE_Proactor + * will be used. + * + * @retval 0 for success. + * @retval -1 for failure; consult @c errno for further information. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** + * Initiates an asynchronous write on a socket. If the operation completes + * the ACE_Handler object registered in open() will receive a completion + * callback via its handle_write_stream() method. + * + * @param bytes_to_write The number of bytes to write. + * @param message_block The ACE_Message_Block containing data to write. + * Data is written to the socket beginning at the + * block's rd_ptr. Upon successful completion + * of the write operation, the message_block rd_ptr + * is updated to reflect the data that was written. + * @param act Token that is passed through to the completion + * handler. + * @param priority Priority of the operation. This argument only has + * an affect on POSIX4-Unix. Works like @c nice in + * Unix; negative values are not allowed. 0 means + * priority of the operation same as the process + * priority. 1 means priority of the operation is one + * less than the process, and so forth. + * @param signal_number The POSIX4 real-time signal number to be used + * for the operation. signal_number ranges from + * ACE_SIGRTMIN to ACE_SIGRTMAX. This argument is + * not used on other platforms. + * + * @retval 0 for success, and the handle_write_stream associated + * with the opened ACE_Handler will be called. An + * instance of ACE_Asynch_Write_Stream::Result will be + * passed to the completion handler. + * @retval -1 for failure; consult @c errno for further information. + */ + int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) + /** + * Same as above but with gather support, through chaining of composite + * message blocks using the continuation field. + */ + int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); +#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) */ + + /// Return the underlying implementation class. + /// @todo (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Implementation class that all methods will be forwarded to. + ACE_Asynch_Write_Stream_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is that class which will be passed back to the + * ACE_Handler when the asynchronous write completes. This class + * forwards all the methods to the implementation class. + * + * This class has all the information necessary for the + * handler to uniquiely identify the completion of the + * asynchronous write. + */ + class ACE_Export Result : public ACE_Asynch_Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Write_Stream_Result; + friend class ACE_WIN32_Asynch_Write_Stream_Result; + + public: + /// The number of bytes which were requested at the start of the + /// asynchronous write. + size_t bytes_to_write (void) const; + + /// Message block that contains the data to be written. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for writing. + ACE_HANDLE handle (void) const; + + /// Get the implementation class. + ACE_Asynch_Write_Stream_Result_Impl *implementation (void) const; + + protected: + /// Constructor. + Result (ACE_Asynch_Write_Stream_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// Implementation class. + ACE_Asynch_Write_Stream_Result_Impl *implementation_; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Write_Stream &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Write_Stream (const ACE_Asynch_Write_Stream &)) +}; + +// Forward declarations +class ACE_Asynch_Read_File_Impl; +class ACE_Asynch_Read_File_Result_Impl; + +/** + * @class ACE_Asynch_Read_File + * + * @brief This class is a factory for starting off asynchronous reads + * on a file. This class forwards all methods to its + * implementation class. + * + * Once open() is called, multiple asynchronous reads can + * started using this class. An ACE_Asynch_Read_File::Result + * will be passed back to the completion handler's + * ACE_Handler::handle_read_file() method when each asynchronous + * read completes. + * This class differs slightly from ACE_Asynch_Read_Stream as it + * allows the user to specify an offset for the read. + */ +class ACE_Export ACE_Asynch_Read_File : public ACE_Asynch_Read_Stream +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Read_File (void); + + /// Destructor. + virtual ~ACE_Asynch_Read_File (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous operation. + * + * @param handler ACE_Handler to be notified when operations initiated + * via this factory complete. The + * ACE_Handler::handle_read_file() method will be + * called on this object. + * @param handle The file handle to initiate read operations on. + * If handle is @c ACE_INVALID_HANDLE, + * ACE_Handler::handle() will be called on handler to + * get the handle value. + * @param completion_key A token that is passed to the completion handler. + * @param proactor The ACE_Proactor object which will control operation + * completion and dispatching the results to handler. + * If this is 0, the process's singleton ACE_Proactor + * will be used. + * + * @retval 0 for success. + * @retval -1 for failure; consult @c errno for further information. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** + * This starts off an asynchronous read. Upto {bytes_to_read} will + * be read and stored in the {message_block}. The read will start + * at {offset} from the beginning of the file. Priority of the + * operation is specified by {priority}. On POSIX4-Unix, this is + * supported. Works like {nice} in Unix. Negative values are not + * allowed. 0 means priority of the operation same as the process + * priority. 1 means priority of the operation is one less than + * process. And so forth. On Win32, this argument is a no-op. + * {signal_number} is the POSIX4 real-time signal number to be used + * for the operation. {signal_number} ranges from ACE_SIGRTMIN to + * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. + */ + int read (ACE_Message_Block &message_block, + size_t bytes_to_read, + unsigned long offset = 0, + unsigned long offset_high = 0, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with scatter support, through chaining of composite + * message blocks using the continuation field. + * @note In win32 Each data block payload must be at least the size of a system + * memory page and must be aligned on a system memory page size boundary + */ + int readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + unsigned long offset = 0, + unsigned long offset_high = 0, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Delegation/implementation class that all methods will be + /// forwarded to. + ACE_Asynch_Read_File_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is that class which will be passed back to the + * {handler} when the asynchronous read completes. This class + * forwards all the methods to the implementation class. + * + * This class has all the information necessary for the + * {handler} to uniquiely identify the completion of the + * asynchronous read. + * This class differs slightly from + * ACE_Asynch_Read_Stream::Result as it calls back + * {ACE_Handler::handle_read_file} on the {handler} instead of + * {ACE_Handler::handle_read_stream}. No additional state is + * required by this class as ACE_Asynch_Result can store the + * {offset}. + */ + class ACE_Export Result : public ACE_Asynch_Read_Stream::Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Read_File_Result; + friend class ACE_WIN32_Asynch_Read_File_Result; + + public: + /// Get the implementation class. + ACE_Asynch_Read_File_Result_Impl *implementation (void) const; + + protected: + /// Constructor. This implementation will not be deleted. + Result (ACE_Asynch_Read_File_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// The implementation class. + ACE_Asynch_Read_File_Result_Impl *implementation_; + + private: + /// Here just to provide an dummpy implementation, since the + /// one auto generated by MSVC is flagged as infinitely recursive + void operator= (Result &) {} + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Read_File &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Read_File (const ACE_Asynch_Read_File &)) +}; + +// Forward declarations +class ACE_Asynch_Write_File_Impl; +class ACE_Asynch_Write_File_Result_Impl; + +/** + * @class ACE_Asynch_Write_File + * + * @brief This class is a factory for starting off asynchronous writes + * on a file. This class forwards all methods to its + * implementation class. + * + * Once {open} is called, multiple asynchronous {write}s can be + * started using this class. A ACE_Asynch_Write_File::Result + * will be passed back to the {handler} when the asynchronous + * writes completes through the {ACE_Handler::handle_write_file} + * callback. + * This class differs slightly from ACE_Asynch_Write_Stream as + * it allows the user to specify an offset for the write. + */ +class ACE_Export ACE_Asynch_Write_File : public ACE_Asynch_Write_Stream +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Write_File (void); + + /// Destructor. + virtual ~ACE_Asynch_Write_File (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), + * {ACE_Handler::handle} will be called on the {handler} to get the + * correct handle. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** + * This starts off an asynchronous write. Upto {bytes_to_write} + * will be written from the {message_block}, starting at the + * block's {rd_ptr}. The write will go to the file, starting + * {offset} bytes from the beginning of the file. Priority of the + * operation is specified by {priority}. On POSIX4-Unix, this is + * supported. Works like {nice} in Unix. Negative values are not + * allowed. 0 means priority of the operation same as the process + * priority. 1 means priority of the operation is one less than + * process. And so forth. On Win32, this is a no-op. + * {signal_number} is the POSIX4 real-time signal number to be used + * for the operation. {signal_number} ranges from ACE_SIGRTMIN to + * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. + */ + int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + unsigned long offset = 0, + unsigned long offset_high = 0, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with gather support, through chaining of composite + * message blocks using the continuation field. + * @note In win32 Each data block payload must be at least the size of a system + * memory page and must be aligned on a system memory page size boundary + */ + int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + unsigned long offset = 0, + unsigned long offset_high = 0, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Implementation object. + ACE_Asynch_Write_File_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is that class which will be passed back to the + * {handler} when the asynchronous write completes. This class + * forwards all the methods to the implementation class. + * + * This class has all the information necessary for the + * {handler} to uniquiely identify the completion of the + * asynchronous write. + * This class differs slightly from + * ACE_Asynch_Write_Stream::Result as it calls back + * {ACE_Handler::handle_write_file} on the {handler} instead + * of {ACE_Handler::handle_write_stream}. No additional state + * is required by this class as ACE_Asynch_Result can store + * the {offset}. + */ + class ACE_Export Result : public ACE_Asynch_Write_Stream::Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Write_File_Result; + friend class ACE_WIN32_Asynch_Write_File_Result; + + public: + /// Get the implementation class. + ACE_Asynch_Write_File_Result_Impl *implementation (void) const; + + protected: + /// Constructor. This implementation will not be deleted. + Result (ACE_Asynch_Write_File_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// The implementation class. + ACE_Asynch_Write_File_Result_Impl *implementation_; + + private: + /// Here just to provide an dummpy implementation, since the + /// one auto generated by MSVC is flagged as infinitely recursive + void operator= (Result &) {}; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Write_File &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Write_File (const ACE_Asynch_Write_File &)) +}; + +// Forward declarations +class ACE_Asynch_Accept_Result_Impl; +class ACE_Asynch_Accept_Impl; + +/** + * @class ACE_Asynch_Accept + * + * @brief This class is a factory for starting off asynchronous accepts + * on a listen handle. This class forwards all methods to its + * implementation class. + * + * Once {open} is called, multiple asynchronous {accept}s can + * started using this class. A ACE_Asynch_Accept::Result will + * be passed back to the {handler} when the asynchronous accept + * completes through the {ACE_Handler::handle_accept} + * callback. + */ +class ACE_Export ACE_Asynch_Accept : public ACE_Asynch_Operation +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Accept (void); + + /// Destructor. + virtual ~ACE_Asynch_Accept (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), + * {ACE_Handler::handle} will be called on the {handler} to get the + * correct handle. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** + * This starts off an asynchronous accept. The asynchronous accept + * call also allows any initial data to be returned to the + * handler specified to @c open(). + * @param message_block A message block to receive initial data, as well + * as the local and remote addresses when the + * connection is made. Since the block receives + * the addresses regardless of whether or not + * initial data is available or requested, the + * message block size must be at least + * @a bytes_to_read plus two times the size of + * the addresses used (IPv4 or IPv6). + * @param bytes_to_read The maximum number of bytes of initial data + * to read into @a message_block. + * @param accept_handle The handle that the new connection will be + * accepted on. If @c INVALID_HANDLE, a new + * handle will be created using @a addr_family. + * @param act Value to be passed in result when operation + * completes. + * @param priority Priority of the operation. On POSIX4-Unix, this + * is supported. Works like @c nice in Unix. + * Negative values are not allowed. 0 means + * priority of the operation same as the process + * priority. 1 means priority of the operation is + * one less than process. And so forth. + * On Win32, this argument is ignored. + * @param signal_number The POSIX4 real-time signal number to be used + * for the operation. Value range is from + * @c ACE_SIGRTMIN to @c ACE_SIGRTMAX. + * This argument is ignored on non-POSIX4 systems. + * @param addr_family The address family to use if @a accept_handle + * is @c ACE_INVALID_HANDLE and a new handle must + * be opened. Values are @c AF_INET and @c PF_INET6. + */ + int accept (ACE_Message_Block &message_block, + size_t bytes_to_read, + ACE_HANDLE accept_handle = ACE_INVALID_HANDLE, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN, + int addr_family = AF_INET); + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Delegation/implementation class that all methods will be + /// forwarded to. + ACE_Asynch_Accept_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is that class which will be passed back to the + * {handler} when the asynchronous accept completes. + * + * This class has all the information necessary for the + * {handler} to uniquiely identify the completion of the + * asynchronous accept. + */ + class ACE_Export Result : public ACE_Asynch_Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Accept_Result; + friend class ACE_WIN32_Asynch_Accept_Result; + + public: + /// The number of bytes which were requested at the start of the + /// asynchronous accept. + size_t bytes_to_read (void) const; + + /// Message block which contains the read data. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for accepting new connections. + ACE_HANDLE listen_handle (void) const; + + /// I/O handle for the new connection. + ACE_HANDLE accept_handle (void) const; + + /// Get the implementation. + ACE_Asynch_Accept_Result_Impl *implementation (void) const; + + protected: + /// Contructor. Implementation will not be deleted. + Result (ACE_Asynch_Accept_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// Impelmentation class. + ACE_Asynch_Accept_Result_Impl *implementation_; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Accept &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Accept (const ACE_Asynch_Accept &)) +}; +// Forward declarations +class ACE_Asynch_Connect_Result_Impl; +class ACE_Asynch_Connect_Impl; + +/** + * @class ACE_Asynch_Connect + * + * @brief This class is a factory for starting off asynchronous connects + * This class forwards all methods to its implementation class. + * + * Once @c open is called, multiple asynchronous connect operationss can + * started using this class. A ACE_Asynch_Connect::Result will + * be passed back to the associated ACE_Handler when the asynchronous connect + * completes through the ACE_Handler::handle_connect() callback. + */ +class ACE_Export ACE_Asynch_Connect : public ACE_Asynch_Operation +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Connect (void); + + /// Destructor. + virtual ~ACE_Asynch_Connect (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. + * + * @note @arg handle is ignored and should be @c ACE_INVALID_HANDLE. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** + * This starts off an asynchronous Connect. + */ + int connect (ACE_HANDLE connect_handle, + const ACE_Addr & remote_sap, + const ACE_Addr & local_sap, + int reuse_addr, + const void *act=0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Delegation/implementation class that all methods will be + /// forwarded to. + ACE_Asynch_Connect_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is that class which will be passed back to the + * handler when the asynchronous connect completes. + * + * This class has all the information necessary for the + * handler to uniquely identify the completion of the + * asynchronous connect. + */ + class ACE_Export Result : public ACE_Asynch_Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Connect_Result; + friend class ACE_WIN32_Asynch_Connect_Result; + + public: + + /// I/O handle for the connection. + ACE_HANDLE connect_handle (void) const; + + /// Get the implementation. + ACE_Asynch_Connect_Result_Impl *implementation (void) const; + + protected: + /// Contructor. Implementation will not be deleted. + Result (ACE_Asynch_Connect_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// Impelmentation class. + ACE_Asynch_Connect_Result_Impl *implementation_; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Connect &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Connect (const ACE_Asynch_Connect &)) +}; + +// Forward declarations +class ACE_Asynch_Transmit_File_Result_Impl; +class ACE_Asynch_Transmit_File_Impl; + +/** + * @class ACE_Asynch_Transmit_File + * + * @brief This class is a factory for starting off asynchronous + * transmit files on a stream. + * + * Once {open} is called, multiple asynchronous {transmit_file}s + * can started using this class. A + * ACE_Asynch_Transmit_File::Result will be passed back to the + * {handler} when the asynchronous transmit file completes + * through the {ACE_Handler::handle_transmit_file} callback. + * The transmit_file function transmits file data over a + * connected network connection. The function uses the operating + * system's cache manager to retrieve the file data. This + * function provides high-performance file data transfer over + * network connections. This function would be of great use in + * a Web Server, Image Server, etc. + */ +class ACE_Export ACE_Asynch_Transmit_File : public ACE_Asynch_Operation +{ + +public: + // Forward declarations + class Header_And_Trailer; + + /// A do nothing constructor. + ACE_Asynch_Transmit_File (void); + + /// Destructor. + virtual ~ACE_Asynch_Transmit_File (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), + * {ACE_Handler::handle} will be called on the {handler} to get the + * correct handle. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** + * This starts off an asynchronous transmit file. The {file} is a + * handle to an open file. {header_and_trailer} is a pointer to a + * data structure that contains pointers to data to send before and + * after the file data is sent. Set this parameter to 0 if you only + * want to transmit the file data. Upto {bytes_to_write} will be + * written to the {socket}. If you want to send the entire file, + * let {bytes_to_write} = 0. {bytes_per_send} is the size of each + * block of data sent per send operation. Please read the Win32 + * documentation on what the flags should be. Priority of the + * operation is specified by {priority}. On POSIX4-Unix, this is + * supported. Works like {nice} in Unix. Negative values are not + * allowed. 0 means priority of the operation same as the process + * priority. 1 means priority of the operation is one less than + * process. And so forth. On Win32, this is a no-op. + * {signal_number} is the POSIX4 real-time signal number to be used + * for the operation. {signal_number} ranges from ACE_SIGRTMIN to + * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. + */ + int transmit_file (ACE_HANDLE file, + Header_And_Trailer *header_and_trailer = 0, + size_t bytes_to_write = 0, + unsigned long offset = 0, + unsigned long offset_high = 0, + size_t bytes_per_send = 0, + unsigned long flags = 0, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// The implementation class. + ACE_Asynch_Transmit_File_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is that class which will be passed back to the + * {handler} when the asynchronous transmit file completes. + * + * This class has all the information necessary for the + * {handler} to uniquiely identify the completion of the + * asynchronous transmit file. + */ + class ACE_Export Result : public ACE_Asynch_Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Transmit_File_Result; + friend class ACE_WIN32_Asynch_Transmit_File_Result; + + public: + /// Socket used for transmitting the file. + ACE_HANDLE socket (void) const; + + /// File from which the data is read. + ACE_HANDLE file (void) const; + + /// Header and trailer data associated with this transmit file. + Header_And_Trailer *header_and_trailer (void) const; + + /// The number of bytes which were requested at the start of the + /// asynchronous transmit file. + size_t bytes_to_write (void) const; + + /// Number of bytes per send requested at the start of the transmit + /// file. + size_t bytes_per_send (void) const; + + /// Flags which were passed into transmit file. + unsigned long flags (void) const; + + /// Get the implementation class. + ACE_Asynch_Transmit_File_Result_Impl *implementation (void) const; + + protected: + /// Constructor. + Result (ACE_Asynch_Transmit_File_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// The implementation class. + ACE_Asynch_Transmit_File_Result_Impl *implementation_; + }; + +/** + * @class Header_And_Trailer + * + * @brief The class defines a data structure that contains pointers + * to data to send before and after the file data is sent. + * + * This class provides a wrapper over TRANSMIT_FILE_BUFFERS + * and provided a consistent use of ACE_Message_Blocks. + */ + class ACE_Export Header_And_Trailer + { + + public: + /// Constructor. + Header_And_Trailer (ACE_Message_Block *header = 0, + size_t header_bytes = 0, + ACE_Message_Block *trailer = 0, + size_t trailer_bytes = 0); + + /// Destructor + virtual ~Header_And_Trailer (void); + + /// This method allows all the member to be set in one fell swoop. + void header_and_trailer (ACE_Message_Block *header = 0, + size_t header_bytes = 0, + ACE_Message_Block *trailer = 0, + size_t trailer_bytes = 0); + + /// Get header which goes before the file data. + ACE_Message_Block *header (void) const; + + /// Set header which goes before the file data. + void header (ACE_Message_Block *message_block); + + /// Get size of the header data. + size_t header_bytes (void) const; + + /// Set size of the header data. + void header_bytes (size_t bytes); + + /// Get trailer which goes after the file data. + ACE_Message_Block *trailer (void) const; + + /// Set trailer which goes after the file data. + void trailer (ACE_Message_Block *message_block); + + /// Get size of the trailer data. + size_t trailer_bytes (void) const; + + /// Set size of the trailer data. + void trailer_bytes (size_t bytes); + + /// Conversion routine. + ACE_LPTRANSMIT_FILE_BUFFERS transmit_buffers (void); + + protected: + /// Header data. + ACE_Message_Block *header_; + + /// Size of header data. + size_t header_bytes_; + + /// Trailer data. + ACE_Message_Block *trailer_; + + /// Size of trailer data. + size_t trailer_bytes_; + + /// Target data structure. + ACE_TRANSMIT_FILE_BUFFERS transmit_buffers_; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Transmit_File &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Transmit_File (const ACE_Asynch_Transmit_File &)) +}; + + +// Forward declarations +class ACE_Asynch_Read_Dgram_Result_Impl; +class ACE_Asynch_Read_Dgram_Impl; +class ACE_Addr; + +/** + * @class ACE_Asynch_Read_Dgram + * + * @brief This class is a factory for starting off asynchronous reads + * on a UDP socket. This class forwards all methods to its + * implementation class. + * + * Once {open} is called, multiple asynchronous {read}s can be + * started using this class. An ACE_Asynch_Read_Dgram::Result + * will be passed back to the {handler} when the asynchronous + * reads completes through the {ACE_Handler::handle_read_dgram} + * callback. + */ +class ACE_Export ACE_Asynch_Read_Dgram : public ACE_Asynch_Operation +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Read_Dgram (void); + + /// Destructor + virtual ~ACE_Asynch_Read_Dgram (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), + * {ACE_Handler::handle} will be called on the {handler} to get the + * correct handle. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** This starts off an asynchronous read. Upto + * {message_block->total_size()} will be read and stored in the + * {message_block}. {message_block}'s {wr_ptr} will be updated to reflect + * the added bytes if the read operation is successfully completed. + * Return code of 1 means immediate success and {number_of_bytes_recvd} + * will contain number of bytes read. The {ACE_Handler::handle_read_dgram} + * method will still be called. Return code of 0 means the IO will + * complete proactively. Return code of -1 means there was an error, use + * errno to get the error code. + * + * Scatter/gather is supported on WIN32 by using the {message_block->cont()} + * method. Up to ACE_IOV_MAX {message_block}'s are supported. Upto + * {message_block->size()} bytes will be read into each {message block} for + * a total of {message_block->total_size()} bytes. All {message_block}'s + * {wr_ptr}'s will be updated to reflect the added bytes for each + * {message_block} + * + * Priority of the operation is specified by {priority}. On POSIX4-Unix, + * this is supported. Works like {nice} in Unix. Negative values are not + * allowed. 0 means priority of the operation same as the process + * priority. 1 means priority of the operation is one less than + * process. And so forth. On Win32, {priority} is a no-op. + * {signal_number} is the POSIX4 real-time signal number to be used + * for the operation. {signal_number} ranges from ACE_SIGRTMIN to + * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. + */ + ssize_t recv (ACE_Message_Block *message_block, + size_t &number_of_bytes_recvd, + int flags, + int protocol_family = PF_INET, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Implementation class that all methods will be forwarded to. + ACE_Asynch_Read_Dgram_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is the class which will be passed back to the + * {handler} when the asynchronous read completes. This class + * forwards all the methods to the implementation classes. + * + * This class has all the information necessary for the + * {handler} to uniquiely identify the completion of the + * asynchronous read. + */ + class ACE_Export Result : public ACE_Asynch_Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Read_Dgram_Result; + friend class ACE_WIN32_Asynch_Read_Dgram_Result; + + public: + + /// The number of bytes which were requested at the start of the + /// asynchronous read. + size_t bytes_to_read (void) const; + + /// Message block which contains the read data + ACE_Message_Block *message_block (void) const; + + /// The flags used in the read + int flags (void) const; + + /// The address of where the packet came from + int remote_address (ACE_Addr& addr) const; + + /// I/O handle used for reading. + ACE_HANDLE handle (void) const; + + /// Get the implementation class. + ACE_Asynch_Read_Dgram_Result_Impl *implementation (void) const; + + protected: + /// Constructor. + Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// The implementation class. + ACE_Asynch_Read_Dgram_Result_Impl *implementation_; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Read_Dgram &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Read_Dgram (const ACE_Asynch_Read_Dgram &)) +}; + +// Forward declarations +class ACE_Asynch_Write_Dgram_Impl; +class ACE_Asynch_Write_Dgram_Result_Impl; + +/** + * @class ACE_Asynch_Write_Dgram + * + * @brief This class is a factory for starting off asynchronous writes + * on a UDP socket. This class forwards all methods to its + * implementation class. + * + * Once {open} is called, multiple asynchronous {writes}s can + * started using this class. An ACE_Asynch_Write_Dgram::Result + * will be passed back to the {handler} when the asynchronous + * write completes through the + * {ACE_Handler::handle_write_dgram} callback. + */ +class ACE_Export ACE_Asynch_Write_Dgram : public ACE_Asynch_Operation +{ + +public: + /// A do nothing constructor. + ACE_Asynch_Write_Dgram (void); + + /// Destructor. + virtual ~ACE_Asynch_Write_Dgram (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), + * {ACE_Handler::handle} will be called on the {handler} to get the + * correct handle. + */ + int open (ACE_Handler &handler, + ACE_HANDLE handle = ACE_INVALID_HANDLE, + const void *completion_key = 0, + ACE_Proactor *proactor = 0); + + /** This starts off an asynchronous send. Upto + * {message_block->total_length()} will be sent. {message_block}'s + * {rd_ptr} will be updated to reflect the sent bytes if the send operation + * is successfully completed. + * Return code of 1 means immediate success and {number_of_bytes_sent} + * is updated to number of bytes sent. The {ACE_Handler::handle_write_dgram} + * method will still be called. Return code of 0 means the IO will + * complete proactively. Return code of -1 means there was an error, use + * errno to get the error code. + * + * Scatter/gather is supported on WIN32 by using the {message_block->cont()} + * method. Up to ACE_IOV_MAX {message_block}'s are supported. Upto + * {message_block->length()} bytes will be sent from each {message block} + * for a total of {message_block->total_length()} bytes. All + * {message_block}'s {rd_ptr}'s will be updated to reflect the bytes sent + * from each {message_block}. + * + * Priority of the operation is specified by {priority}. On POSIX4-Unix, + * this is supported. Works like {nice} in Unix. Negative values are not + * allowed. 0 means priority of the operation same as the process + * priority. 1 means priority of the operation is one less than + * process. And so forth. On Win32, this argument is a no-op. + * {signal_number} is the POSIX4 real-time signal number to be used + * for the operation. {signal_number} ranges from ACE_SIGRTMIN to + * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. + */ + ssize_t send (ACE_Message_Block *message_block, + size_t &number_of_bytes_sent, + int flags, + const ACE_Addr& remote_addr, + const void *act = 0, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Return the underlying implementation class. + // (this should be protected...) + virtual ACE_Asynch_Operation_Impl *implementation (void) const; + +protected: + /// Implementation class that all methods will be forwarded to. + ACE_Asynch_Write_Dgram_Impl *implementation_; + +public: +/** + * @class Result + * + * @brief This is that class which will be passed back to the + * {handler} when the asynchronous write completes. This class + * forwards all the methods to the implementation class. + * + * This class has all the information necessary for the + * {handler} to uniquiely identify the completion of the + * asynchronous write. + */ + class ACE_Export Result : public ACE_Asynch_Result + { + + /// The concrete implementation result classes only construct this + /// class. + friend class ACE_POSIX_Asynch_Write_Dgram_Result; + friend class ACE_WIN32_Asynch_Write_Dgram_Result; + + public: + + /// The number of bytes which were requested at the start of the + /// asynchronous write. + size_t bytes_to_write (void) const; + + /// Message block which contains the sent data + ACE_Message_Block *message_block (void) const; + + /// The flags using in the write + int flags (void) const; + + /// I/O handle used for writing. + ACE_HANDLE handle (void) const; + + /// Get the implementation class. + ACE_Asynch_Write_Dgram_Result_Impl *implementation (void) const; + + protected: + /// Constructor. + Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation); + + /// Destructor. + virtual ~Result (void); + + /// Implementation class. + ACE_Asynch_Write_Dgram_Result_Impl *implementation_; + }; +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Asynch_Write_Dgram &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Asynch_Write_Dgram (const ACE_Asynch_Write_Dgram &)) +}; + + +/** + * @class ACE_Handler + * + * @brief This base class defines the interface for receiving the + * results of asynchronous operations. + * + * Subclasses of this class will fill in appropriate methods. + */ +class ACE_Export ACE_Handler +{ +public: + /// A do nothing constructor. + ACE_Handler (void); + + /// A do nothing constructor which allows proactor to be set to \. + ACE_Handler (ACE_Proactor *p); + + /// Virtual destruction. + virtual ~ACE_Handler (void); + + /// This method will be called when an asynchronous read completes on + /// a stream. + virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); + + /// This method will be called when an asynchronous write completes + /// on a UDP socket. + virtual void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result); + + /// This method will be called when an asynchronous read completes on + /// a UDP socket. + virtual void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result); + + /// This method will be called when an asynchronous write completes + /// on a stream. + virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); + + /// This method will be called when an asynchronous read completes on + /// a file. + virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); + + /// This method will be called when an asynchronous write completes + /// on a file. + virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); + + /// This method will be called when an asynchronous accept completes. + virtual void handle_accept (const ACE_Asynch_Accept::Result &result); + + /// This method will be called when an asynchronous connect completes. + virtual void handle_connect (const ACE_Asynch_Connect::Result &result); + + /// This method will be called when an asynchronous transmit file + /// completes. + virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); + + /// Called when timer expires. {tv} was the requested time value and + /// {act} is the ACT passed when scheduling the timer. + virtual void handle_time_out (const ACE_Time_Value &tv, + const void *act = 0); + + /** + * This is method works with the {run_event_loop} of the + * ACE_Proactor. A special {Wake_Up_Completion} is used to wake up + * all the threads that are blocking for completions. + */ + virtual void handle_wakeup (void); + + /// Get the proactor associated with this handler. + ACE_Proactor *proactor (void); + + /// Set the proactor. + void proactor (ACE_Proactor *p); + + /** + * Get the I/O handle used by this {handler}. This method will be + * called by the ACE_Asynch_* classes when an ACE_INVALID_HANDLE is + * passed to {open}. + */ + virtual ACE_HANDLE handle (void) const; + + /// Set the ACE_HANDLE value for this Handler. + virtual void handle (ACE_HANDLE); + + /** + * @class Proxy + * + * @brief The Proxy class acts as a proxy for dispatch of completions + * to operations issued for the associated handler. It allows the handler + * to be deleted while operations are outstanding. The proxy must be used + * to get the ACE_Handler pointer for dispatching, and if it's 0, the + * handler is no longer valid and the result should not be dispatched. + */ + class ACE_Export Proxy + { + public: + Proxy (ACE_Handler *handler) : handler_ (handler) {}; + void reset (void) { this->handler_ = 0; }; + ACE_Handler *handler (void) { return this->handler_; }; + private: + ACE_Handler *handler_; + }; + typedef ACE_Refcounted_Auto_Ptr + Proxy_Ptr; + + Proxy_Ptr &proxy (void); + +protected: + /// The proactor associated with this handler. + ACE_Proactor *proactor_; + + /// The ACE_HANDLE in use with this handler. + ACE_HANDLE handle_; + + /// Refers to proxy for this handler. + ACE_Refcounted_Auto_Ptr proxy_; + + ACE_UNIMPLEMENTED_FUNC (ACE_Handler (const ACE_Handler &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Handler operator= (const ACE_Handler &)) +}; + +// Forward declarations +class ACE_INET_Addr; + +// Forward declarations +template +class ACE_Asynch_Acceptor; + +/** + * @class ACE_Service_Handler + * + * @brief This base class defines the interface for the + * ACE_Asynch_Acceptor to call into when new connection are + * accepted. + * + * Subclasses of this class will fill in appropriate methods to + * define application specific behavior. + */ +class ACE_Export ACE_Service_Handler : public ACE_Handler +{ + + /// The Acceptor is the factory and therefore should have special + /// privileges. + friend class ACE_Asynch_Acceptor; + +public: + /// A do nothing constructor. + ACE_Service_Handler (void); + + /// Virtual destruction. + virtual ~ACE_Service_Handler (void); + + /** + * {open} is called by ACE_Asynch_Acceptor to initialize a new + * instance of ACE_Service_Handler that has been created after the + * new connection is accepted. The handle for the new connection is + * passed along with the initial data that may have shown up. + */ + virtual void open (ACE_HANDLE new_handle, + ACE_Message_Block &message_block); + + // protected: + // This should be corrected after the correct semantics of the + // friend has been figured out. + + /// Called by ACE_Asynch_Acceptor to pass the addresses of the new + /// connections. + virtual void addresses (const ACE_INET_Addr &remote_address, + const ACE_INET_Addr &local_address); + + /// Called by ACE_Asynch_Acceptor to pass the act. + virtual void act (const void *); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS*/ +#include /**/ "ace/post.h" +#endif /* ACE_ASYNCH_IO_H */ diff --git a/externals/ace/Asynch_IO_Impl.cpp b/externals/ace/Asynch_IO_Impl.cpp new file mode 100644 index 0000000..b4b47ed --- /dev/null +++ b/externals/ace/Asynch_IO_Impl.cpp @@ -0,0 +1,117 @@ +// $Id: Asynch_IO_Impl.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Asynch_IO_Impl.h" + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) +// This only works on Win32 platforms and on Unix platforms supporting +// aio calls. + +#if !defined (__ACE_INLINE__) +#include "ace/Asynch_IO_Impl.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Asynch_Result_Impl::~ACE_Asynch_Result_Impl (void) +{ +} + +ACE_Asynch_Operation_Impl::~ACE_Asynch_Operation_Impl (void) +{ +} + +ACE_Asynch_Read_Stream_Impl::~ACE_Asynch_Read_Stream_Impl (void) +{ +} + +ACE_Asynch_Read_Stream_Result_Impl::~ACE_Asynch_Read_Stream_Result_Impl (void) +{ +} + +ACE_Asynch_Write_Stream_Impl::~ACE_Asynch_Write_Stream_Impl (void) +{ +} + +ACE_Asynch_Write_Stream_Result_Impl::~ACE_Asynch_Write_Stream_Result_Impl (void) +{ +} + +ACE_Asynch_Read_File_Impl::~ACE_Asynch_Read_File_Impl (void) +{ +} + +ACE_Asynch_Write_File_Impl::~ACE_Asynch_Write_File_Impl (void) +{ +} + +ACE_Asynch_Read_File_Result_Impl::~ACE_Asynch_Read_File_Result_Impl (void) +{ +} + +ACE_Asynch_Write_File_Result_Impl::~ACE_Asynch_Write_File_Result_Impl (void) +{ +} + +ACE_Asynch_Accept_Result_Impl::~ACE_Asynch_Accept_Result_Impl (void) +{ +} + +ACE_Asynch_Connect_Result_Impl::~ACE_Asynch_Connect_Result_Impl (void) +{ +} + +ACE_Asynch_Accept_Impl::~ACE_Asynch_Accept_Impl (void) +{ +} + +ACE_Asynch_Connect_Impl::~ACE_Asynch_Connect_Impl (void) +{ +} + +ACE_Asynch_Transmit_File_Impl::~ACE_Asynch_Transmit_File_Impl (void) +{ +} + +ACE_Asynch_Transmit_File_Result_Impl::~ACE_Asynch_Transmit_File_Result_Impl (void) +{ +} + +ACE_Asynch_Read_Dgram_Impl::~ACE_Asynch_Read_Dgram_Impl (void) +{ +} + +ACE_Asynch_Read_Dgram_Impl::ACE_Asynch_Read_Dgram_Impl (void) +{ +} + +ACE_Asynch_Write_Dgram_Impl::~ACE_Asynch_Write_Dgram_Impl (void) +{ +} + +ACE_Asynch_Write_Dgram_Impl::ACE_Asynch_Write_Dgram_Impl (void) +{ +} + +//*********************************************** + +ACE_Asynch_Read_Dgram_Result_Impl::~ACE_Asynch_Read_Dgram_Result_Impl (void) +{ +} + +ACE_Asynch_Read_Dgram_Result_Impl::ACE_Asynch_Read_Dgram_Result_Impl (void) +{ +} + +//*********************************************** + +ACE_Asynch_Write_Dgram_Result_Impl::~ACE_Asynch_Write_Dgram_Result_Impl (void) +{ +} + +ACE_Asynch_Write_Dgram_Result_Impl::ACE_Asynch_Write_Dgram_Result_Impl (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ diff --git a/externals/ace/Asynch_IO_Impl.h b/externals/ace/Asynch_IO_Impl.h new file mode 100644 index 0000000..06eb5c1 --- /dev/null +++ b/externals/ace/Asynch_IO_Impl.h @@ -0,0 +1,816 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Asynch_IO_Impl.h + * + * $Id: Asynch_IO_Impl.h 80826 2008-03-04 14:51:23Z wotte $ + * + * + * This class contains asbtract base classes for all the concrete + * implementation classes for the various asynchronous operations + * that are used with the Praoctor. + * + * + * @author Irfan Pyarali (irfan@cs.wustl.edu) + * @author Tim Harrison (harrison@cs.wustl.edu) + * @author Alexander Babu Arulanthu + * @author Roger Tragin + * @author Alexander Libman + */ +//============================================================================= + +#ifndef ACE_ASYNCH_IO_IMPL_H +#define ACE_ASYNCH_IO_IMPL_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) +// This only works on Win32 platforms and on Unix platforms supporting +// aio calls. + +#include "ace/Asynch_IO.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration. +class ACE_Proactor_Impl; + +/** + * @class ACE_Asynch_Result_Impl + * + * @brief Abstract base class for the all the classes that provide + * concrete implementations for ACE_Asynch_Result. + * + */ +class ACE_Export ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Result_Impl (void); + + /// Number of bytes transferred by the operation. + virtual size_t bytes_transferred (void) const = 0; + + /// ACT associated with the operation. + virtual const void *act (void) const = 0; + + /// Did the operation succeed? + virtual int success (void) const = 0; + + /// This ACT is not the same as the ACT associated with the + /// asynchronous operation. + virtual const void *completion_key (void) const = 0; + + /// Error value if the operation fail. + virtual u_long error (void) const = 0; + + /// Event associated with the OVERLAPPED structure. + virtual ACE_HANDLE event (void) const = 0; + + /// This really make sense only when doing file I/O. + virtual u_long offset (void) const = 0; + virtual u_long offset_high (void) const = 0; + + /// Priority of the operation. + virtual int priority (void) const = 0; + + /** + * POSIX4 real-time signal number to be used for the + * operation. ranges from SIGRTMIN to SIGRTMAX. By + * default, SIGRTMIN is used to issue calls. This is a no-op + * on non-POSIX4 systems and returns 0. + */ + virtual int signal_number (void) const = 0; + + // protected: + // + // These two should really be protected. But sometimes it + // simplifies code to be able to "fake" a result. Use carefully. + /// This is called when the asynchronous operation completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error = 0) = 0; + + /// Post @c this to the Proactor's completion port. + virtual int post_completion (ACE_Proactor_Impl *proactor) = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Result_Impl (void); +}; + +/** + * @class ACE_Asynch_Operation_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Operation. + */ +class ACE_Export ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Operation_Impl (void); + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If @a handle == ACE_INVALID_HANDLE, + * ACE_Handler::handle() will be called on the proxied handler to get the + * correct handle. + */ + virtual int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) = 0; + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + virtual int cancel (void) = 0; + + // = Access methods. + + /// Return the underlying proactor. + virtual ACE_Proactor* proactor (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Operation_Impl (void); +}; + +/** + * @class ACE_Asynch_Read_Stream_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Read_Stream + * + */ +class ACE_Export ACE_Asynch_Read_Stream_Impl : public virtual ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Read_Stream_Impl (void); + + /// This starts off an asynchronous read. Upto @a bytes_to_read will + /// be read and stored in the @a message_block. + virtual int read (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) = 0; + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with scatter support, through chaining of composite + * message blocks using the continuation field. + */ + virtual int readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) = 0; +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + +protected: + /// Do-nothing constructor. + ACE_Asynch_Read_Stream_Impl (void); +}; + +/** + * @class ACE_Asynch_Read_Stream_Result_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Read_Stream::Result class. + * + */ +class ACE_Export ACE_Asynch_Read_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Read_Stream_Result_Impl (void); + + /// The number of bytes which were requested at the start of the + /// asynchronous read. + virtual size_t bytes_to_read (void) const = 0; + + /// Message block which contains the read data. + virtual ACE_Message_Block &message_block (void) const = 0; + + /// I/O handle used for reading. + virtual ACE_HANDLE handle (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Read_Stream_Result_Impl (void); +}; + +/** + * @class ACE_Asynch_Write_Stream_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Write_Stream class. + * + */ +class ACE_Export ACE_Asynch_Write_Stream_Impl : public virtual ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Write_Stream_Impl (void); + + /// This starts off an asynchronous write. Upto @a bytes_to_write + /// will be written from the @a message_block. + virtual int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) = 0; + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with gather support, through chaining of composite + * message blocks using the continuation field. + */ + virtual int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) = 0; +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + +protected: + /// Do-nothing constructor. + ACE_Asynch_Write_Stream_Impl (void); +}; + +/** + * @class ACE_Asynch_Write_Stream_Result_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Write_Stream::Result. + * + */ +class ACE_Export ACE_Asynch_Write_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Write_Stream_Result_Impl (void); + + /// The number of bytes which were requested at the start of the + /// asynchronous write. + virtual size_t bytes_to_write (void) const = 0; + + /// Message block that contains the data to be written. + virtual ACE_Message_Block &message_block (void) const = 0; + + /// I/O handle used for writing. + virtual ACE_HANDLE handle (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Write_Stream_Result_Impl (void); +}; + +/** + * @class ACE_Asynch_Read_File_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Read_File::Result. + * + */ +class ACE_Export ACE_Asynch_Read_File_Impl : public virtual ACE_Asynch_Read_Stream_Impl +{ +public: + virtual ~ACE_Asynch_Read_File_Impl (void); + + /** + * This starts off an asynchronous read. Upto @a bytes_to_read will + * be read and stored in the @a message_block. The read will start + * at @a offset from the beginning of the file. + */ + virtual int read (ACE_Message_Block &message_block, + size_t bytes_to_read, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) = 0; + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with scatter support, through chaining of composite + * message blocks using the continuation field. + * @note In win32 Each data block payload must be at least the size of a system + * memory page and must be aligned on a system memory page size boundary + */ + virtual int readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) = 0; +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + + /// This starts off an asynchronous read. Upto @a bytes_to_read will + /// be read and stored in the @a message_block. + virtual int read (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) = 0; + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with scatter support, through chaining of composite + * message blocks using the continuation field. + */ + virtual int readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) = 0; +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + +protected: + /// Do-nothing constructor. + ACE_Asynch_Read_File_Impl (void); +}; + +/** + * @class ACE_Asynch_Read_File_Result_Impl + * + * @brief This is the abstract base class for all the concrete + * implementation classes for ACE_Asynch_Read_File::Result. + * + */ +class ACE_Export ACE_Asynch_Read_File_Result_Impl : public virtual ACE_Asynch_Read_Stream_Result_Impl +{ +public: + /// Destructor. + virtual ~ACE_Asynch_Read_File_Result_Impl (void); + +protected: + /// Do-nothing constructor. + ACE_Asynch_Read_File_Result_Impl (void); +}; + +/** + * @class ACE_Asynch_Write_File_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Write_File. + * + */ +class ACE_Export ACE_Asynch_Write_File_Impl : public virtual ACE_Asynch_Write_Stream_Impl +{ +public: + virtual ~ACE_Asynch_Write_File_Impl (void); + + /** + * This starts off an asynchronous write. Upto @a bytes_to_write + * will be write and stored in the @a message_block. The write will + * start at @a offset from the beginning of the file. + */ + virtual int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) = 0; + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with gather support, through chaining of composite + * message blocks using the continuation field. + * @note In win32 Each data block payload must be at least the size of a system + * memory page and must be aligned on a system memory page size boundary + */ + virtual int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) = 0; +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + + /// This starts off an asynchronous write. Upto @a bytes_to_write + /// will be written from the @a message_block. + virtual int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) = 0; + +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) + /** + * Same as above but with gather support, through chaining of composite + * message blocks using the continuation field. + */ + virtual int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) = 0; +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ + +protected: + /// Do-nothing constructor. + ACE_Asynch_Write_File_Impl (void); +}; + +/** + * @class ACE_Asynch_Write_File_Result_Impl + * + * @brief This is the abstract base class for all the concrete + * implementation classes that provide different implementations + * for the ACE_Asynch_Write_File::Result. + * + */ +class ACE_Export ACE_Asynch_Write_File_Result_Impl : public virtual ACE_Asynch_Write_Stream_Result_Impl +{ +public: + virtual ~ACE_Asynch_Write_File_Result_Impl (void); + +protected: + /// Do-nothing constructor. + ACE_Asynch_Write_File_Result_Impl (void); +}; + +/** + * @class ACE_Asynch_Accept_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Accept. + * + */ +class ACE_Export ACE_Asynch_Accept_Impl : public virtual ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Accept_Impl (void); + + /** + * This starts off an asynchronous accept. The asynchronous accept + * call also allows any initial data to be returned to the + * . Upto @a bytes_to_read will be read and stored in the + * @a message_block. The @a accept_handle will be used for the + * call. If (@a accept_handle == INVALID_HANDLE), a new + * handle will be created. + * + * @a message_block must be specified. This is because the address of + * the new connection is placed at the end of this buffer. + */ + virtual int accept (ACE_Message_Block &message_block, + size_t bytes_to_read, + ACE_HANDLE accept_handle, + const void *act, + int priority, + int signal_number, + int addr_family) = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Accept_Impl (void); +}; + +/** + * @class ACE_Asynch_Accept_Result_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Accept. + * + */ +class ACE_Export ACE_Asynch_Accept_Result_Impl : public virtual ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Accept_Result_Impl (void); + + /// The number of bytes which were requested at the start of the + /// asynchronous accept. + virtual size_t bytes_to_read (void) const = 0; + + /// Message block which contains the read data. + virtual ACE_Message_Block &message_block (void) const = 0; + + /// I/O handle used for accepting new connections. + virtual ACE_HANDLE listen_handle (void) const = 0; + + /// I/O handle for the new connection. + virtual ACE_HANDLE accept_handle (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Accept_Result_Impl (void); +}; + + +/** + * @class ACE_Asynch_Connect_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Connect. + * + */ +class ACE_Export ACE_Asynch_Connect_Impl : public virtual ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Connect_Impl (void); + + /** + * This starts off an asynchronous connect + */ + virtual int connect (ACE_HANDLE connect_handle, + const ACE_Addr & remote_sap, + const ACE_Addr & local_sap, + int reuse_addr, + const void *act, + int priority, + int signal_number) = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Connect_Impl (void); +}; + +/** + * @class ACE_Asynch_Connect_Result_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Connect. + * + */ +class ACE_Export ACE_Asynch_Connect_Result_Impl : public virtual ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Connect_Result_Impl (void); + + /// I/O handle for the connection. + virtual ACE_HANDLE connect_handle (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Connect_Result_Impl (void); +}; + + +/** + * @class ACE_Asynch_Transmit_File_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Transmit_File. + * + */ +class ACE_Asynch_Transmit_File_Impl : public virtual ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Transmit_File_Impl (void); + + /// This starts off an asynchronous transmit file. + virtual int transmit_file (ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + int priority, + int signal_number) = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Transmit_File_Impl (void); +}; + +/** + * @class ACE_Asynch_Transmit_File_Result_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Transmit_File::Result. + * + */ +class ACE_Export ACE_Asynch_Transmit_File_Result_Impl : public virtual ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Transmit_File_Result_Impl (void); + + /// Socket used for transmitting the file. + virtual ACE_HANDLE socket (void) const = 0; + + /// File from which the data is read. + virtual ACE_HANDLE file (void) const = 0; + + /// Header and trailer data associated with this transmit file. + virtual ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const = 0; + + /// The number of bytes which were requested at the start of the + /// asynchronous transmit file. + virtual size_t bytes_to_write (void) const = 0; + + /// Number of bytes per send requested at the start of the transmit + /// file. + virtual size_t bytes_per_send (void) const = 0; + + /// Flags which were passed into transmit file. + virtual u_long flags (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Transmit_File_Result_Impl (void); +}; + + +/** + * @class ACE_Asynch_Read_Dgram_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Read_Dgram + * + */ +class ACE_Export ACE_Asynch_Read_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Read_Dgram_Impl (void); + + /** This starts off an asynchronous read. Upto + * total_size()> will be read and stored in the + * @a message_block. @a message_block's will be updated to reflect + * the added bytes if the read operation is successful completed. + * Return code of 1 means immediate success and + * will contain number of bytes read. The + * method will still be called. Return code of 0 means the IO will + * complete proactively. Return code of -1 means there was an error, use + * errno to get the error code. + * + * Scatter/gather is supported on WIN32 by using the cont()> + * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto + * size()> bytes will be read into each for + * a total of total_size()> bytes. All @a message_block's + * 's will be updated to reflect the added bytes for each + * @a message_block + * + * Priority of the operation is specified by @a priority. On POSIX4-Unix, + * this is supported. Works like in Unix. Negative values are not + * allowed. 0 means priority of the operation same as the process + * priority. 1 means priority of the operation is one less than + * process. And so forth. On Win32, @a priority is a no-op. + * @a signal_number is the POSIX4 real-time signal number to be used + * for the operation. @a signal_number ranges from ACE_SIGRTMIN to + * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. + */ + virtual ssize_t recv (ACE_Message_Block *message_block, + size_t &number_of_bytes_recvd, + int flags, + int protocol_family, + const void *act, + int priority, + int signal_number) = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Read_Dgram_Impl (void); +}; + +/** + * @class ACE_Asynch_Read_Dgram_Result_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Read_Dgram::Result class. + * + */ +class ACE_Export ACE_Asynch_Read_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Read_Dgram_Result_Impl (void); + + /// Message block which contains the read data + virtual ACE_Message_Block *message_block (void) const = 0; + + /// The number of bytes which were requested at the start of the + /// asynchronous read. + virtual size_t bytes_to_read (void) const = 0; + + /// The address of where the packet came from + virtual int remote_address (ACE_Addr& addr) const = 0; + + /// The flags used in the read + virtual int flags (void) const = 0; + + /// I/O handle used for reading. + virtual ACE_HANDLE handle (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Read_Dgram_Result_Impl (void); +}; + +/** + * @class ACE_Asynch_Write_Dgram_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Write_Dgram class. + * + */ +class ACE_Export ACE_Asynch_Write_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl +{ +public: + virtual ~ACE_Asynch_Write_Dgram_Impl (void); + + /** This starts off an asynchronous send. Upto + * total_length()> will be sent. @a message_block's + * will be updated to reflect the sent bytes if the send operation + * is successful completed. + * Return code of 1 means immediate success and + * is updated to number of bytes sent. The + * method will still be called. Return code of 0 means the IO will + * complete proactively. Return code of -1 means there was an error, use + * errno to get the error code. + * + * Scatter/gather is supported on WIN32 by using the cont()> + * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto + * length()> bytes will be sent from each + * for a total of total_length()> bytes. All + * @a message_block's 's will be updated to reflect the bytes sent + * from each @a message_block. + * + * Priority of the operation is specified by @a priority. On POSIX4-Unix, + * this is supported. Works like in Unix. Negative values are not + * allowed. 0 means priority of the operation same as the process + * priority. 1 means priority of the operation is one less than + * process. And so forth. On Win32, this argument is a no-op. + * @a signal_number is the POSIX4 real-time signal number to be used + * for the operation. @a signal_number ranges from ACE_SIGRTMIN to + * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. + */ + virtual ssize_t send (ACE_Message_Block *message_block, + size_t &number_of_bytes_sent, + int flags, + const ACE_Addr &addr, + const void *act, + int priority, + int signal_number) = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Write_Dgram_Impl (void); +}; + +/** + * @class ACE_Asynch_Write_Dgram_Result_Impl + * + * @brief Abstract base class for all the concrete implementation + * classes that provide different implementations for the + * ACE_Asynch_Write_Dgram::Result class. + * + */ +class ACE_Export ACE_Asynch_Write_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl +{ +public: + virtual ~ACE_Asynch_Write_Dgram_Result_Impl (void); + + /// The number of bytes which were requested at the start of the + /// asynchronous write. + virtual size_t bytes_to_write (void) const = 0; + + /// Message block which contains the sent data + virtual ACE_Message_Block *message_block (void) const = 0; + + /// The flags using in the write + virtual int flags (void) const = 0; + + /// I/O handle used for writing. + virtual ACE_HANDLE handle (void) const = 0; + +protected: + /// Do-nothing constructor. + ACE_Asynch_Write_Dgram_Result_Impl (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Asynch_IO_Impl.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ +#include /**/ "ace/post.h" +#endif /* ACE_ASYNCH_IO_IMPL_H */ diff --git a/externals/ace/Asynch_IO_Impl.inl b/externals/ace/Asynch_IO_Impl.inl new file mode 100644 index 0000000..60dc69d --- /dev/null +++ b/externals/ace/Asynch_IO_Impl.inl @@ -0,0 +1,106 @@ +// -*- C++ -*- +// +// $Id: Asynch_IO_Impl.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Asynch_Result_Impl::ACE_Asynch_Result_Impl (void) +{ +} + +ACE_INLINE +ACE_Asynch_Operation_Impl::ACE_Asynch_Operation_Impl (void) +{ +} + +ACE_INLINE +ACE_Asynch_Read_Stream_Impl::ACE_Asynch_Read_Stream_Impl (void) + : ACE_Asynch_Operation_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Read_Stream_Result_Impl::ACE_Asynch_Read_Stream_Result_Impl (void) + : ACE_Asynch_Result_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Write_Stream_Impl::ACE_Asynch_Write_Stream_Impl (void) + : ACE_Asynch_Operation_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Write_Stream_Result_Impl::ACE_Asynch_Write_Stream_Result_Impl (void) + : ACE_Asynch_Result_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Read_File_Impl::ACE_Asynch_Read_File_Impl (void) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Read_Stream_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Read_File_Result_Impl::ACE_Asynch_Read_File_Result_Impl (void) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Read_Stream_Result_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Write_File_Impl::ACE_Asynch_Write_File_Impl (void) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Write_Stream_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Write_File_Result_Impl::ACE_Asynch_Write_File_Result_Impl (void) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Write_Stream_Result_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Accept_Impl::ACE_Asynch_Accept_Impl (void) + : ACE_Asynch_Operation_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Accept_Result_Impl::ACE_Asynch_Accept_Result_Impl (void) + : ACE_Asynch_Result_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Connect_Impl::ACE_Asynch_Connect_Impl (void) + : ACE_Asynch_Operation_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Connect_Result_Impl::ACE_Asynch_Connect_Result_Impl (void) + : ACE_Asynch_Result_Impl () +{ +} + + +ACE_INLINE +ACE_Asynch_Transmit_File_Impl::ACE_Asynch_Transmit_File_Impl (void) + : ACE_Asynch_Operation_Impl () +{ +} + +ACE_INLINE +ACE_Asynch_Transmit_File_Result_Impl::ACE_Asynch_Transmit_File_Result_Impl (void) + : ACE_Asynch_Result_Impl () +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Asynch_Pseudo_Task.cpp b/externals/ace/Asynch_Pseudo_Task.cpp new file mode 100644 index 0000000..94f0d69 --- /dev/null +++ b/externals/ace/Asynch_Pseudo_Task.cpp @@ -0,0 +1,130 @@ +// $Id: Asynch_Pseudo_Task.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Asynch_Pseudo_Task.h" + +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_signal.h" + +ACE_RCSID(ace, Asynch_Pseudo_Task, "$Id: Asynch_Pseudo_Task.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task () + : select_reactor_ (), // should be initialized before reactor_ + reactor_ (&select_reactor_, 0) // don't delete implementation +{ +} + +ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task () +{ + this->stop (); +} + +int +ACE_Asynch_Pseudo_Task::start (void) +{ + if (this->reactor_.initialized () == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%N:%l:%p\n"), + ACE_TEXT ("start reactor is not initialized")), + -1); + + return this->activate () == -1 ? -1 : 0; // If started, return 0 +} + +int +ACE_Asynch_Pseudo_Task::stop (void) +{ + if (this->thr_count () == 0) // already stopped + return 0; + + if (this->reactor_.end_reactor_event_loop () == -1) + return -1; + + this->wait (); + this->reactor_.close (); + return 0; +} + +int +ACE_Asynch_Pseudo_Task::svc (void) +{ +#if !defined (ACE_WIN32) + + sigset_t RT_signals; + + sigemptyset (&RT_signals); + for (int si = ACE_SIGRTMIN; si <= ACE_SIGRTMAX; si++) + sigaddset (&RT_signals, si); + + if (ACE_OS::pthread_sigmask (SIG_BLOCK, &RT_signals, 0) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Error:(%P | %t):%p\n"), + ACE_TEXT ("pthread_sigmask"))); +#endif + + reactor_.owner (ACE_Thread::self ()); + reactor_.run_reactor_event_loop (); + + return 0; +} + + + +int +ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask, + int flg_suspend) +{ + // Register the handler with the reactor. + if (-1 == this->reactor_.register_handler (handle, handler, mask)) + return -1; + + if (flg_suspend == 0) + return 0; + + // Suspend the handle now. Enable only when the accept is issued + // by the application. + if (this->reactor_.suspend_handler (handle) == -1) + { + ACE_ERROR + ((LM_ERROR, + ACE_TEXT ("%N:%l:%p\n"), + ACE_TEXT ("register_io_handler (suspended)"))); + this->reactor_.remove_handler (handle, ACE_Event_Handler::ALL_EVENTS_MASK + | ACE_Event_Handler::DONT_CALL); + return -1; + } + + return 0; +} + +int +ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_HANDLE handle) +{ + return this->reactor_.remove_handler (handle, + ACE_Event_Handler::ALL_EVENTS_MASK + | ACE_Event_Handler::DONT_CALL); +} + +int +ACE_Asynch_Pseudo_Task::remove_io_handler (ACE_Handle_Set &set) +{ + return this->reactor_.remove_handler (set, ACE_Event_Handler::ALL_EVENTS_MASK + | ACE_Event_Handler::DONT_CALL); +} + +int +ACE_Asynch_Pseudo_Task::suspend_io_handler (ACE_HANDLE handle) +{ + return this->reactor_.suspend_handler (handle); +} + +int +ACE_Asynch_Pseudo_Task::resume_io_handler (ACE_HANDLE handle) +{ + return this->reactor_.resume_handler (handle); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Asynch_Pseudo_Task.h b/externals/ace/Asynch_Pseudo_Task.h new file mode 100644 index 0000000..6e2c3a1 --- /dev/null +++ b/externals/ace/Asynch_Pseudo_Task.h @@ -0,0 +1,73 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Asynch_Pseudo_Task.h + * + * $Id: Asynch_Pseudo_Task.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Alexander Libman + */ +//============================================================================= + +#ifndef ACE_ASYNCH_PSEUDO_TASK_H +#define ACE_ASYNCH_PSEUDO_TASK_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Reactor.h" +#include "ace/Select_Reactor.h" +#include "ace/Task.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/* + * Specialization hook to replace the Reactor with the + * concrete Reactor implementation, e.g., select_st, + * select_mt etc. + */ +//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK + +/** + * @class ACE_Asynch_Pseudo_Task + * + */ +class ACE_Export ACE_Asynch_Pseudo_Task : public ACE_Task +{ +public: + ACE_Asynch_Pseudo_Task(); + virtual ~ACE_Asynch_Pseudo_Task(); + + int start (void); + int stop (void); + + int register_io_handler (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask, + int flg_suspend); + + int remove_io_handler (ACE_HANDLE handle); + int remove_io_handler (ACE_Handle_Set &set); + int resume_io_handler (ACE_HANDLE handle); + int suspend_io_handler (ACE_HANDLE handle); + +protected: + virtual int svc (void); + + /// Should be initialized before reactor_ + ACE_Select_Reactor select_reactor_; + + ACE_Reactor reactor_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_ASYNCH_PSEUDO_TASK_H */ diff --git a/externals/ace/Atomic_Op.cpp b/externals/ace/Atomic_Op.cpp new file mode 100644 index 0000000..10731e3 --- /dev/null +++ b/externals/ace/Atomic_Op.cpp @@ -0,0 +1,310 @@ +// $Id: Atomic_Op.cpp 89905 2010-04-16 13:04:47Z johnnyw $ + +#include "ace/Atomic_Op.h" +#include "ace/OS_NS_unistd.h" + +ACE_RCSID (ace, + Atomic_Op, + "$Id: Atomic_Op.cpp 89905 2010-04-16 13:04:47Z johnnyw $") + +#if !defined (__ACE_INLINE__) +#include "ace/Atomic_Op.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) + +#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC) +# include "ace/Atomic_Op_Sparc.h" +#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */ + +namespace { + +#if defined (_MSC_VER) +// Disable "no return value" warning, as we will be putting +// the return values directly into the EAX register. +#pragma warning (push) +#pragma warning (disable: 4035) +#endif /* _MSC_VER */ + +long +single_cpu_increment (volatile long *value) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + long tmp = 1; + unsigned long addr = reinterpret_cast (value); + asm( "xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); + return tmp + 1; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_add_long ( + reinterpret_cast (value), 1); +#elif defined(__GNUC__) && defined(PPC) + long tmp; + asm("lwz %0,%1" : "=r" (tmp) : "m" (*value) ); + asm("addi %0,%0,1" : "+r" (tmp) ); + asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); + return tmp; +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +long +single_cpu_decrement (volatile long *value) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + long tmp = -1; + unsigned long addr = reinterpret_cast (value); + asm( "xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); + return tmp - 1; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_add_long ( + reinterpret_cast (value), -1); +#elif defined(__GNUC__) && defined(PPC) + long tmp; + asm("lwz %0,%1" : "=r" (tmp) : "m" (*value) ); + asm("addi %0,%0,-1" : "+r" (tmp) ); + asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); + return tmp; +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +long +single_cpu_exchange (volatile long *value, long rhs) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + unsigned long addr = reinterpret_cast (value); + asm( "xchg %0, (%1)" : "+r"(rhs) : "r"(addr) ); + return rhs; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_swap_long ( + reinterpret_cast (value), rhs); +#elif defined(__GNUC__) && defined(PPC) + long tmp; + asm("lwz %0,%1" : "=r" (tmp) : "m" (rhs) ); + asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); + return tmp; +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_UNUSED_ARG (rhs); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +long +single_cpu_exchange_add (volatile long *value, long rhs) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + unsigned long addr = reinterpret_cast (value); + asm( "xadd %0, (%1)" : "+r"(rhs) : "r"(addr) ); + return rhs; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_swap_add_long ( + reinterpret_cast (value), rhs); +#elif defined(__GNUC__) && defined(PPC) + long tmp; + asm("add %0,%1,%2" : "=r" (tmp) : "r" (*value), "r" (rhs) ); + asm("stw %0,%1" : "+r" (tmp), "=m" (*value) ); + return tmp; +#elif defined (WIN32) && !defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) +# if defined (_MSC_VER) + __asm + { + mov eax, rhs + mov edx, value + xadd [edx], eax + } + // Return value is already in EAX register. +# elif defined (__BORLANDC__) + _EAX = rhs; + _EDX = reinterpret_cast (value); + __emit__(0x0F, 0xC1, 0x02); // xadd [edx], eax + // Return value is already in EAX register. +# else /* _MSC_VER */ + ACE_UNUSED_ARG (value); + ACE_UNUSED_ARG (rhs); + ACE_NOTSUP_RETURN (-1); +# endif /* _MSC_VER */ +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_UNUSED_ARG (rhs); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +long +multi_cpu_increment (volatile long *value) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + long tmp = 1; + unsigned long addr = reinterpret_cast (value); + asm( "lock ; xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); + return tmp + 1; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_add_long ( + reinterpret_cast (value), 1); +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +long +multi_cpu_decrement (volatile long *value) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + long tmp = -1; + unsigned long addr = reinterpret_cast (value); + asm( "lock ; xadd %0, (%1)" : "+r"(tmp) : "r"(addr) ); + return tmp - 1; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_add_long ( + reinterpret_cast (value), -1); +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +long +multi_cpu_exchange (volatile long *value, long rhs) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + unsigned long addr = reinterpret_cast (value); + // The XCHG instruction automatically follows LOCK semantics + asm( "xchg %0, (%1)" : "+r"(rhs) : "r"(addr) ); + return rhs; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_swap_long ( + reinterpret_cast (value), rhs); +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_UNUSED_ARG (rhs); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +long +multi_cpu_exchange_add (volatile long *value, long rhs) +{ +#if defined (ACE_HAS_INTEL_ASSEMBLY) + unsigned long addr = reinterpret_cast (value); + asm( "lock ; xadd %0, (%1)" : "+r"(rhs) : "r"(addr) ); + return rhs; +#elif !defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && (defined (sun) || \ + (defined (__SUNPRO_CC) && (defined (__i386) || defined (__x86_64)))) + return ace_atomic_swap_add_long ( + reinterpret_cast (value), rhs); +#elif defined (WIN32) && !defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) +# if defined (_MSC_VER) + __asm + { + mov eax, rhs + mov edx, value + lock xadd [edx], eax + } + // Return value is already in EAX register. +# elif defined (__BORLANDC__) + _EAX = rhs; + _EDX = reinterpret_cast (value); + __emit__(0xF0, 0x0F, 0xC1, 0x02); // lock xadd [edx], eax + // Return value is already in EAX register. +# else /* _MSC_VER */ + ACE_UNUSED_ARG (value); + ACE_UNUSED_ARG (rhs); + ACE_NOTSUP_RETURN (-1); +# endif /* _MSC_VER */ +#else /* ACE_HAS_INTEL_ASSEMBLY*/ + ACE_UNUSED_ARG (value); + ACE_UNUSED_ARG (rhs); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_INTEL_ASSEMBLY*/ +} + +#if defined (_MSC_VER) +#pragma warning (pop) +#endif /* _MSC_VER */ + +} // end namespace + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +long (*ACE_Atomic_Op::increment_fn_) (volatile long *) = multi_cpu_increment; +long (*ACE_Atomic_Op::decrement_fn_) (volatile long *) = multi_cpu_decrement; +long (*ACE_Atomic_Op::exchange_fn_) (volatile long *, long) = multi_cpu_exchange; +long (*ACE_Atomic_Op::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add; + +void +ACE_Atomic_Op::init_functions (void) +{ + if (ACE_OS::num_processors () == 1) + { + increment_fn_ = single_cpu_increment; + decrement_fn_ = single_cpu_decrement; + exchange_fn_ = single_cpu_exchange; + exchange_add_fn_ = single_cpu_exchange_add; + } + else + { + increment_fn_ = multi_cpu_increment; + decrement_fn_ = multi_cpu_decrement; + exchange_fn_ = multi_cpu_exchange; + exchange_add_fn_ = multi_cpu_exchange_add; + } +} + +void +ACE_Atomic_Op::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +long (*ACE_Atomic_Op::increment_fn_) (volatile long *) = multi_cpu_increment; +long (*ACE_Atomic_Op::decrement_fn_) (volatile long *) = multi_cpu_decrement; +long (*ACE_Atomic_Op::exchange_fn_) (volatile long *, long) = multi_cpu_exchange; +long (*ACE_Atomic_Op::exchange_add_fn_) (volatile long *, long) = multi_cpu_exchange_add; + +void +ACE_Atomic_Op::init_functions (void) +{ + if (ACE_OS::num_processors () == 1) + { + increment_fn_ = single_cpu_increment; + decrement_fn_ = single_cpu_decrement; + exchange_fn_ = single_cpu_exchange; + exchange_add_fn_ = single_cpu_exchange_add; + } + else + { + increment_fn_ = multi_cpu_increment; + decrement_fn_ = multi_cpu_decrement; + exchange_fn_ = multi_cpu_exchange; + exchange_add_fn_ = multi_cpu_exchange_add; + } +} + +void +ACE_Atomic_Op::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ diff --git a/externals/ace/Atomic_Op.h b/externals/ace/Atomic_Op.h new file mode 100644 index 0000000..8ebc6c6 --- /dev/null +++ b/externals/ace/Atomic_Op.h @@ -0,0 +1,355 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Atomic_Op.h + * + * $Id: Atomic_Op.h 89936 2010-04-20 13:04:53Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ATOMIC_OP_H +#define ACE_ATOMIC_OP_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Thread_Mutex.h" + +// Include the templates here. +#include "ace/Atomic_Op_T.h" + +// Determine whether builtin atomic op support is +// available on this platform. +#if defined (ACE_HAS_THREADS) +# if defined (WIN32) +# if defined (ACE_HAS_INTRINSIC_INTERLOCKED) +# define ACE_HAS_BUILTIN_ATOMIC_OP +# endif /* ACE_HAS_INTRINSIC_INTERLOCKED */ +# if defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) +# define ACE_HAS_BUILTIN_ATOMIC_OP +# else /* ACE_HAS_INTERLOCKED_EXCHANGEADD */ + // Inline assembly emulation of InterlockedExchangeAdd + // is currently only implemented for MSVC (x86 only) and Borland. +# if (defined (_MSC_VER) && defined (_M_IX86)) || defined (__BORLANDC__) +# define ACE_HAS_BUILTIN_ATOMIC_OP +# endif /* _MSC_VER || __BORLANDC__ */ +# endif /* ACE_HAS_INTERLOCKED_EXCHANGEADD */ +# elif defined (ACE_HAS_INTEL_ASSEMBLY) +# define ACE_HAS_BUILTIN_ATOMIC_OP +# elif defined (ACE_HAS_VXATOMICLIB) +# define ACE_HAS_BUILTIN_ATOMIC_OP +# elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) && !defined (ACE_HAS_BUILTIN_ATOMIC_OP) +# define ACE_HAS_BUILTIN_ATOMIC_OP +# endif /* WIN32 */ +#endif /* ACE_HAS_THREADS */ + +// If we have the GCC Atomic builtin support, use it +#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) +# undef ACE_HAS_BUILTIN_ATOMIC_OP +#endif + +// Include the templates here. +#include "ace/Atomic_Op_GCC_T.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) + +/** + * @brief Specialization of ACE_Atomic_Op for platforms that + * support atomic integer operations. + * + * Specialization of ACE_Atomic_Op for platforms that support atomic + * integer operations. + */ +template<> +class ACE_Export ACE_Atomic_Op +{ +public: + /// Initialize @c value_ to 0. + ACE_Atomic_Op (void); + + /// Initialize @c value_ to c. + ACE_Atomic_Op (long c); + + /// Manage copying... + ACE_Atomic_Op (const ACE_Atomic_Op &c); + + /// Atomically pre-increment @c value_. + long operator++ (void); + + /// Atomically post-increment @c value_. + long operator++ (int); + + /// Atomically increment @c value_ by rhs. + long operator+= (long rhs); + + /// Atomically pre-decrement @c value_. + long operator-- (void); + + /// Atomically post-decrement @c value_. + long operator-- (int); + + /// Atomically decrement @c value_ by rhs. + long operator-= (long rhs); + + /// Atomically compare @c value_ with rhs. + bool operator== (long rhs) const; + + /// Atomically compare @c value_ with rhs. + bool operator!= (long rhs) const; + + /// Atomically check if @c value_ greater than or equal to rhs. + bool operator>= (long rhs) const; + + /// Atomically check if @c value_ greater than rhs. + bool operator> (long rhs) const; + + /// Atomically check if @c value_ less than or equal to rhs. + bool operator<= (long rhs) const; + + /// Atomically check if @c value_ less than rhs. + bool operator< (long rhs) const; + + /// Atomically assign rhs to @c value_. + ACE_Atomic_Op &operator= (long rhs); + + /// Atomically assign to @c value_. + ACE_Atomic_Op &operator= (const ACE_Atomic_Op &rhs); + + /// Explicitly return @c value_. + long value (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Explicitly return @c value_ (by reference). + volatile long &value_i (void); + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + + /// Used during ACE object manager initialization to optimize the fast + /// atomic op implementation according to the number of CPUs. + static void init_functions (void); + +private: + + // This function cannot be supported by this template specialization. + // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex + // template instead. + ACE_Thread_Mutex &mutex (void); + +private: + + /// Current object decorated by the atomic op. + volatile long value_; + + // Pointers to selected atomic op implementations. + static long (*increment_fn_) (volatile long *); + static long (*decrement_fn_) (volatile long *); + static long (*exchange_fn_) (volatile long *, long); + static long (*exchange_add_fn_) (volatile long *, long); +}; + +/** + * @brief Specialization of ACE_Atomic_Op for platforms that + * support atomic integer operations. + * + * Specialization of ACE_Atomic_Op for platforms that support atomic + * integer operations. + */ +template<> +class ACE_Export ACE_Atomic_Op +{ +public: + /// Initialize @c value_ to 0. + ACE_Atomic_Op (void); + + /// Initialize @c value_ to c. + ACE_Atomic_Op (unsigned long c); + + /// Manage copying... + ACE_Atomic_Op (const ACE_Atomic_Op &c); + + /// Atomically pre-increment @c value_. + unsigned long operator++ (void); + + /// Atomically post-increment @c value_. + unsigned long operator++ (int); + + /// Atomically increment @c value_ by rhs. + unsigned long operator+= (unsigned long rhs); + + /// Atomically pre-decrement @c value_. + unsigned long operator-- (void); + + /// Atomically post-decrement @c value_. + unsigned long operator-- (int); + + /// Atomically decrement @c value_ by rhs. + unsigned long operator-= (unsigned long rhs); + + /// Atomically compare @c value_ with rhs. + bool operator== (unsigned long rhs) const; + + /// Atomically compare @c value_ with rhs. + bool operator!= (unsigned long rhs) const; + + /// Atomically check if @c value_ greater than or equal to rhs. + bool operator>= (unsigned long rhs) const; + + /// Atomically check if @c value_ greater than rhs. + bool operator> (unsigned long rhs) const; + + /// Atomically check if @c value_ less than or equal to rhs. + bool operator<= (unsigned long rhs) const; + + /// Atomically check if @c value_ less than rhs. + bool operator< (unsigned long rhs) const; + + /// Atomically assign rhs to @c value_. + ACE_Atomic_Op &operator= (unsigned long rhs); + + /// Atomically assign to @c value_. + ACE_Atomic_Op &operator= (const ACE_Atomic_Op &rhs); + + /// Explicitly return @c value_. + unsigned long value (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Explicitly return @c value_ (by reference). + volatile unsigned long &value_i (void); + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + + /// Used during ACE object manager initialization to optimize the fast + /// atomic op implementation according to the number of CPUs. + static void init_functions (void); + +private: + + /// This function cannot be supported by this template specialization. + /// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex + /// template instead. + ACE_Thread_Mutex &mutex (void); + +private: + + /// Current object decorated by the atomic op. + volatile unsigned long value_; + + // Pointers to selected atomic op implementations. + static long (*increment_fn_) (volatile long *); + static long (*decrement_fn_) (volatile long *); + static long (*exchange_fn_) (volatile long *, long); + static long (*exchange_add_fn_) (volatile long *, long); +}; + +#endif /* !ACE_HAS_BUILTIN_ATOMIC_OP */ + +#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) + +template<> +class ACE_Export ACE_Atomic_Op +: public ACE_Atomic_Op_GCC +{ +public: + ACE_Atomic_Op (void); + ACE_Atomic_Op (int c); + ACE_Atomic_Op (const ACE_Atomic_Op &c); + ACE_Atomic_Op &operator= (int rhs); +}; + +template<> +class ACE_Export ACE_Atomic_Op +: public ACE_Atomic_Op_GCC +{ +public: + ACE_Atomic_Op (void); + ACE_Atomic_Op (unsigned int c); + ACE_Atomic_Op (const ACE_Atomic_Op &c); + ACE_Atomic_Op &operator= (unsigned int rhs); +}; + +// If we have built in atomic op, use that, the assignment operator +// is faster for a long/unsinged long +template<> +class ACE_Export ACE_Atomic_Op +: public ACE_Atomic_Op_GCC +{ +public: + ACE_Atomic_Op (void); + ACE_Atomic_Op (long c); + ACE_Atomic_Op (const ACE_Atomic_Op &c); + ACE_Atomic_Op &operator= (long rhs); +}; + +template<> +class ACE_Export ACE_Atomic_Op +: public ACE_Atomic_Op_GCC +{ +public: + ACE_Atomic_Op (void); + ACE_Atomic_Op (unsigned long c); + ACE_Atomic_Op (const ACE_Atomic_Op &c); + ACE_Atomic_Op &operator= (unsigned long rhs); +}; + +#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_2) +template<> +class ACE_Export ACE_Atomic_Op +: public ACE_Atomic_Op_GCC +{ +public: + ACE_Atomic_Op (void); + ACE_Atomic_Op (short c); + ACE_Atomic_Op (const ACE_Atomic_Op &c); + ACE_Atomic_Op &operator= (short rhs); +}; + +template<> +class ACE_Export ACE_Atomic_Op +: public ACE_Atomic_Op_GCC +{ +public: + ACE_Atomic_Op (void); + ACE_Atomic_Op (unsigned short c); + ACE_Atomic_Op (const ACE_Atomic_Op &c); + ACE_Atomic_Op &operator= (unsigned short rhs); +}; +#endif + +#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_1) +template<> +class ACE_Export ACE_Atomic_Op +: public ACE_Atomic_Op_GCC +{ +public: + ACE_Atomic_Op (void); + ACE_Atomic_Op (bool c); + ACE_Atomic_Op (const ACE_Atomic_Op &c); + ACE_Atomic_Op &operator= (bool rhs); +}; +#endif + +#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Atomic_Op.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /*ACE_ATOMIC_OP_H*/ diff --git a/externals/ace/Atomic_Op.inl b/externals/ace/Atomic_Op.inl new file mode 100644 index 0000000..6dcade6 --- /dev/null +++ b/externals/ace/Atomic_Op.inl @@ -0,0 +1,582 @@ +// -*- C++ -*- +// +// $Id: Atomic_Op.inl 89905 2010-04-16 13:04:47Z johnnyw $ + +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) +# include "ace/os_include/os_intrin.h" +# pragma intrinsic (_InterlockedExchange, _InterlockedExchangeAdd, _InterlockedIncrement, _InterlockedDecrement) +#endif /* ACE_HAS_INTRINSIC_INTERLOCKED */ + +#if defined (ACE_HAS_VXATOMICLIB) +# include +#endif + +#if defined (ACE_HAS_SOLARIS_ATOMIC_LIB) +# include +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_HAS_BUILTIN_ATOMIC_OP) + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) + : value_ (0) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (long c) + : value_ (c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op ( + const ACE_Atomic_Op &rhs) + : value_ (rhs.value_) +{ +} + +ACE_INLINE long +ACE_Atomic_Op::operator++ (void) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return ::_InterlockedIncrement (const_cast (&this->value_)); +#elif defined (WIN32) + return ::InterlockedIncrement (const_cast (&this->value_)); +#elif defined (ACE_HAS_VXATOMICLIB) + return ::vxAtomicInc (reinterpret_cast (const_cast (&this->value_))) + 1; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_inc_ulong_nv (reinterpret_cast(&this->value_)); +#else /* WIN32 */ + return (*increment_fn_) (&this->value_); +#endif /* WIN32 */ +} + +ACE_INLINE long +ACE_Atomic_Op::operator++ (int) +{ + return ++*this - 1; +} + +ACE_INLINE long +ACE_Atomic_Op::operator-- (void) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return ::_InterlockedDecrement (const_cast (&this->value_)); +#elif defined (WIN32) + return ::InterlockedDecrement (const_cast (&this->value_)); +#elif defined (ACE_HAS_VXATOMICLIB) + return ::vxAtomicDec (reinterpret_cast (const_cast (&this->value_))) - 1; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_dec_ulong_nv (reinterpret_cast(&this->value_)); +#else /* WIN32 */ + return (*decrement_fn_) (&this->value_); +#endif /* WIN32 */ +} + +ACE_INLINE long +ACE_Atomic_Op::operator-- (int) +{ + return --*this + 1; +} + +ACE_INLINE long +ACE_Atomic_Op::operator+= (long rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return ::_InterlockedExchangeAdd (const_cast (&this->value_), + rhs) + rhs; +#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) + return ::InterlockedExchangeAdd (const_cast (&this->value_), + rhs) + rhs; +#elif defined (ACE_HAS_VXATOMICLIB) + return ::vxAtomicAdd (reinterpret_cast (const_cast (&this->value_)), rhs) + rhs; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_add_long_nv (reinterpret_cast(&this->value_), rhs); +#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ + return (*exchange_add_fn_) (&this->value_, rhs) + rhs; +#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ +} + +ACE_INLINE long +ACE_Atomic_Op::operator-= (long rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return ::_InterlockedExchangeAdd (const_cast (&this->value_), + -rhs) - rhs; +#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) + return ::InterlockedExchangeAdd (const_cast (&this->value_), + -rhs) - rhs; +#elif defined (ACE_HAS_VXATOMICLIB) + return ::vxAtomicSub (reinterpret_cast (const_cast (&this->value_)), rhs) - rhs; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_add_long_nv (reinterpret_cast(&this->value_), -rhs); +#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ + return (*exchange_add_fn_) (&this->value_, -rhs) - rhs; +#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ +} + +ACE_INLINE bool +ACE_Atomic_Op::operator== (long rhs) const +{ + return (this->value_ == rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator!= (long rhs) const +{ + return (this->value_ != rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator>= (long rhs) const +{ + return (this->value_ >= rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator> (long rhs) const +{ + return (this->value_ > rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator<= (long rhs) const +{ + return (this->value_ <= rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator< (long rhs) const +{ + return (this->value_ < rhs); +} + +ACE_INLINE ACE_Atomic_Op & +ACE_Atomic_Op::operator= (long rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + ::_InterlockedExchange (const_cast (&this->value_), rhs); +#elif defined (WIN32) + ::InterlockedExchange (const_cast (&this->value_), rhs); +#elif defined (ACE_HAS_VXATOMICLIB) + ::vxAtomicSet (reinterpret_cast (const_cast (&this->value_)), rhs); +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + ::atomic_swap_ulong (reinterpret_cast(&this->value_), rhs); +#else /* WIN32 */ + (*exchange_fn_) (&this->value_, rhs); +#endif /* WIN32 */ + return *this; +} + +ACE_INLINE ACE_Atomic_Op & +ACE_Atomic_Op::operator= ( + const ACE_Atomic_Op &rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + ::_InterlockedExchange (const_cast (&this->value_), rhs.value_); +#elif defined (WIN32) + ::InterlockedExchange (const_cast (&this->value_), rhs.value_); +#elif defined (ACE_HAS_VXATOMICLIB) + ::vxAtomicSet (reinterpret_cast (const_cast (&this->value_)), rhs.value_); +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + ::atomic_swap_ulong (reinterpret_cast(&this->value_), rhs.value_); +#else /* WIN32 */ + (*exchange_fn_) (&this->value_, rhs.value_); +#endif /* WIN32 */ + return *this; +} + +ACE_INLINE long +ACE_Atomic_Op::value (void) const +{ + return this->value_; +} + +ACE_INLINE volatile long & +ACE_Atomic_Op::value_i (void) +{ + return this->value_; +} + + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) + : value_ (0) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (unsigned long c) + : value_ (c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op ( + const ACE_Atomic_Op &rhs) + : value_ (rhs.value_) +{ +} + +ACE_INLINE unsigned long +ACE_Atomic_Op::operator++ (void) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return static_cast (::_InterlockedIncrement (const_cast (reinterpret_cast(&this->value_)))); +#elif defined (WIN32) + return static_cast (::InterlockedIncrement (const_cast (reinterpret_cast(&this->value_)))); +#elif defined (ACE_HAS_VXATOMICLIB) + return static_cast (::vxAtomicInc (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))))) + 1; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_inc_ulong_nv (&this->value_); +#else /* WIN32 */ + return static_cast ((*increment_fn_) (reinterpret_cast (&this->value_))); +#endif /* WIN32 */ +} + +ACE_INLINE unsigned long +ACE_Atomic_Op::operator++ (int) +{ + return ++*this - 1; +} + +ACE_INLINE unsigned long +ACE_Atomic_Op::operator-- (void) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return static_cast (::_InterlockedDecrement (const_cast (reinterpret_cast(&this->value_)))); +#elif defined (WIN32) + return static_cast (::InterlockedDecrement (const_cast (reinterpret_cast(&this->value_)))); +#elif defined (ACE_HAS_VXATOMICLIB) + return static_cast (::vxAtomicDec (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))))) - 1; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_dec_ulong_nv (&this->value_); +#else /* WIN32 */ + return static_cast ((*decrement_fn_) (reinterpret_cast (&this->value_))); +#endif /* WIN32 */ +} + +ACE_INLINE unsigned long +ACE_Atomic_Op::operator-- (int) +{ + return --*this + 1; +} + +ACE_INLINE unsigned long +ACE_Atomic_Op::operator+= (unsigned long rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return static_cast (::_InterlockedExchangeAdd (const_cast (reinterpret_cast (&this->value_)), + rhs)) + rhs; +#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) + return static_cast (::InterlockedExchangeAdd (const_cast (reinterpret_cast (&this->value_)), + rhs)) + rhs; +#elif defined (ACE_HAS_VXATOMICLIB) + return static_cast (::vxAtomicAdd (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))), rhs)) + rhs; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_add_long_nv (&this->value_, rhs); +#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ + return static_cast ((*exchange_add_fn_) (reinterpret_cast (&this->value_), rhs)) + rhs; +#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ +} + +ACE_INLINE unsigned long +ACE_Atomic_Op::operator-= (unsigned long rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return static_cast (::_InterlockedExchangeAdd (const_cast (reinterpret_cast(&this->value_)), + -static_cast(rhs))) - rhs; +#elif defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD) + return static_cast (::InterlockedExchangeAdd (const_cast (reinterpret_cast(&this->value_)), + -static_cast(rhs))) - rhs; +#elif defined (ACE_HAS_VXATOMICLIB) + return static_cast (::vxAtomicSub (reinterpret_cast (const_cast (reinterpret_cast(&this->value_))), rhs)) - rhs; +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_add_long_nv (&this->value_, -rhs); +#else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ + long l_rhs = static_cast (rhs); + return static_cast ((*exchange_add_fn_) (reinterpret_cast (&this->value_), -l_rhs)) - rhs; +#endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ +} + +ACE_INLINE bool +ACE_Atomic_Op::operator== (unsigned long rhs) const +{ + return (this->value_ == rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator!= (unsigned long rhs) const +{ + return (this->value_ != rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator>= (unsigned long rhs) const +{ + return (this->value_ >= rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator> (unsigned long rhs) const +{ + return (this->value_ > rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator<= (unsigned long rhs) const +{ + return (this->value_ <= rhs); +} + +ACE_INLINE bool +ACE_Atomic_Op::operator< (unsigned long rhs) const +{ + return (this->value_ < rhs); +} + +ACE_INLINE ACE_Atomic_Op & +ACE_Atomic_Op::operator= (unsigned long rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + ::_InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs); +#elif defined (WIN32) + ::InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs); +#elif defined (ACE_HAS_VXATOMICLIB) + ::vxAtomicSet (reinterpret_cast (const_cast (reinterpret_cast (&this->value_))), rhs); +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + ::atomic_swap_ulong (&this->value_, rhs); +#else /* WIN32 */ + (*exchange_fn_) (reinterpret_cast (&this->value_), rhs); +#endif /* WIN32 */ + return *this; +} + +ACE_INLINE ACE_Atomic_Op & +ACE_Atomic_Op::operator= ( + const ACE_Atomic_Op &rhs) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + ::_InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs.value_); +#elif defined (WIN32) + ::InterlockedExchange (const_cast (reinterpret_cast (&this->value_)), rhs.value_); +#elif defined (ACE_HAS_VXATOMICLIB) + ::vxAtomicSet (reinterpret_cast (const_cast (reinterpret_cast (&this->value_))), rhs.value_); +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + ::atomic_swap_ulong (&this->value_, rhs.value_); +#else /* WIN32 */ + (*exchange_fn_) (reinterpret_cast (&this->value_), rhs.value_); +#endif /* WIN32 */ + return *this; +} + +ACE_INLINE unsigned long +ACE_Atomic_Op::value (void) const +{ + return this->value_; +} + +ACE_INLINE volatile unsigned long & +ACE_Atomic_Op::value_i (void) +{ + return this->value_; +} + +#endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ + +#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) : + ACE_Atomic_Op_GCC () +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (int c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op& +ACE_Atomic_Op::operator= (int rhs) +{ + ACE_Atomic_Op_GCC::operator= (rhs); + return *this; +} + + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) : + ACE_Atomic_Op_GCC() +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (unsigned int c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op& +ACE_Atomic_Op::operator= (unsigned int rhs) +{ + ACE_Atomic_Op_GCC::operator= (rhs); + return *this; +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) : + ACE_Atomic_Op_GCC() +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (long c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op& +ACE_Atomic_Op::operator= (long rhs) +{ + ACE_Atomic_Op_GCC::operator= (rhs); + return *this; +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) : + ACE_Atomic_Op_GCC () +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (unsigned long c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op& +ACE_Atomic_Op::operator= (unsigned long rhs) +{ + ACE_Atomic_Op_GCC::operator= (rhs); + return *this; +} + +#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_2) +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) : + ACE_Atomic_Op_GCC() +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (short c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op& +ACE_Atomic_Op::operator= (short rhs) +{ + ACE_Atomic_Op_GCC::operator= (rhs); + return *this; +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) : + ACE_Atomic_Op_GCC () +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (unsigned short c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op& +ACE_Atomic_Op::operator= (unsigned short rhs) +{ + ACE_Atomic_Op_GCC::operator= (rhs); + return *this; +} +#endif + +#if !defined (ACE_LACKS_GCC_ATOMIC_BUILTINS_1) +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (void) : + ACE_Atomic_Op_GCC () +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (bool c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op (const ACE_Atomic_Op &c) : + ACE_Atomic_Op_GCC(c) +{ +} + +ACE_INLINE +ACE_Atomic_Op& +ACE_Atomic_Op::operator= (bool rhs) +{ + ACE_Atomic_Op_GCC::operator= (rhs); + return *this; +} +#endif + +#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS==1 */ + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/externals/ace/Atomic_Op_GCC_T.cpp b/externals/ace/Atomic_Op_GCC_T.cpp new file mode 100644 index 0000000..bbe6ec6 --- /dev/null +++ b/externals/ace/Atomic_Op_GCC_T.cpp @@ -0,0 +1,29 @@ +// $Id: Atomic_Op_GCC_T.cpp 89345 2010-03-05 13:04:51Z johnnyw $ + +#include "ace/OS_NS_unistd.h" + +ACE_RCSID (ace, + Atomic_Op_GCC, + "$Id: Atomic_Op_GCC_T.cpp 89345 2010-03-05 13:04:51Z johnnyw $") + +#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) + +#if !defined (__ACE_INLINE__) +#include "ace/Atomic_Op_GCC_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +void +ACE_Atomic_Op_GCC::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS */ diff --git a/externals/ace/Atomic_Op_GCC_T.h b/externals/ace/Atomic_Op_GCC_T.h new file mode 100644 index 0000000..92bc771 --- /dev/null +++ b/externals/ace/Atomic_Op_GCC_T.h @@ -0,0 +1,136 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Atomic_Op_GCC_T.h + * + * $Id: Atomic_Op_GCC_T.h 89339 2010-03-05 12:20:47Z johnnyw $ + * + * @author Johnny Willemsen +class ACE_Export ACE_Atomic_Op_GCC +{ +public: + /// Atomically pre-increment @c value_. + T operator++ (void); + + /// Atomically post-increment @c value_. + T operator++ (int); + + /// Atomically increment @c value_ by rhs. + T operator+= (T rhs); + + /// Atomically pre-decrement @c value_. + T operator-- (void); + + /// Atomically post-decrement @c value_. + T operator-- (int); + + /// Atomically decrement @c value_ by rhs. + T operator-= (T rhs); + + /// Atomically compare @c value_ with rhs. + bool operator== (T rhs) const; + + /// Atomically compare @c value_ with rhs. + bool operator!= (T rhs) const; + + /// Atomically check if @c value_ greater than or equal to rhs. + bool operator>= (T rhs) const; + + /// Atomically check if @c value_ greater than rhs. + bool operator> (T rhs) const; + + /// Atomically check if @c value_ less than or equal to rhs. + bool operator<= (T rhs) const; + + /// Atomically check if @c value_ less than rhs. + bool operator< (T rhs) const; + + /// Explicitly return @c value_. + T value (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Explicitly return @c value_ (by reference). + volatile T &value_i (void); + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + /// Atomically assign rhs to @c value_. + ACE_Atomic_Op_GCC &operator= (T rhs); + + /// Atomically assign to @c value_. + ACE_Atomic_Op_GCC &operator= (const ACE_Atomic_Op_GCC &rhs); + + /// Initialize @c value_ to 0. + ACE_Atomic_Op_GCC (void); + + /// Initialize @c value_ to c. + ACE_Atomic_Op_GCC (T c); + + /// Manage copying... + ACE_Atomic_Op_GCC (const ACE_Atomic_Op_GCC &c); + +private: + + // This function cannot be supported by this template specialization. + // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex + // template instead. + ACE_Thread_Mutex &mutex (void); + +private: + + /// Current object decorated by the atomic op. + volatile T value_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Atomic_Op_GCC_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Atomic_Op_GCC_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Atomic_Op_GCC_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + + +#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS */ + +#include /**/ "ace/post.h" +#endif /*ACE_ATOMIC_OP_GCC_T_H*/ diff --git a/externals/ace/Atomic_Op_GCC_T.inl b/externals/ace/Atomic_Op_GCC_T.inl new file mode 100644 index 0000000..c6fe027 --- /dev/null +++ b/externals/ace/Atomic_Op_GCC_T.inl @@ -0,0 +1,148 @@ +// -*- C++ -*- +// +// $Id: Atomic_Op_GCC_T.inl 89391 2010-03-08 13:53:30Z johnnyw $ + +#if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_INLINE +ACE_Atomic_Op_GCC::ACE_Atomic_Op_GCC (void) + : value_ (0) +{ +} + +template +ACE_INLINE +ACE_Atomic_Op_GCC::ACE_Atomic_Op_GCC (T c) + : value_ (c) +{ +} + +template +ACE_INLINE +ACE_Atomic_Op_GCC::ACE_Atomic_Op_GCC ( + const ACE_Atomic_Op_GCC &rhs) + : value_ (rhs.value_) +{ +} + +template +ACE_INLINE T +ACE_Atomic_Op_GCC::operator++ (void) +{ + return __sync_add_and_fetch (&this->value_, 1); +} + +template +ACE_INLINE T +ACE_Atomic_Op_GCC::operator++ (int) +{ + return __sync_fetch_and_add (&this->value_, 1); +} + +template +ACE_INLINE T +ACE_Atomic_Op_GCC::operator-- (void) +{ + return __sync_sub_and_fetch (&this->value_, 1); +} + +template +ACE_INLINE T +ACE_Atomic_Op_GCC::operator-- (int) +{ + return __sync_fetch_and_sub (&this->value_, 1); +} + +template +ACE_INLINE T +ACE_Atomic_Op_GCC::operator+= (T rhs) +{ + return __sync_add_and_fetch (&this->value_, rhs); +} + +template +ACE_INLINE T +ACE_Atomic_Op_GCC::operator-= (T rhs) +{ + return __sync_sub_and_fetch (&this->value_, rhs); +} + +template +ACE_INLINE bool +ACE_Atomic_Op_GCC::operator== (T rhs) const +{ + return (this->value_ == rhs); +} + +template +ACE_INLINE bool +ACE_Atomic_Op_GCC::operator!= (T rhs) const +{ + return (this->value_ != rhs); +} + +template +ACE_INLINE bool +ACE_Atomic_Op_GCC::operator>= (T rhs) const +{ + return (this->value_ >= rhs); +} + +template +ACE_INLINE bool +ACE_Atomic_Op_GCC::operator> (T rhs) const +{ + return (this->value_ > rhs); +} + +template +ACE_INLINE bool +ACE_Atomic_Op_GCC::operator<= (T rhs) const +{ + return (this->value_ <= rhs); +} + +template +ACE_INLINE bool +ACE_Atomic_Op_GCC::operator< (T rhs) const +{ + return (this->value_ < rhs); +} + +template +ACE_INLINE ACE_Atomic_Op_GCC & +ACE_Atomic_Op_GCC::operator= (T rhs) +{ + (void) __sync_lock_test_and_set (&this->value_, rhs); + return *this; +} + +template +ACE_INLINE ACE_Atomic_Op_GCC & +ACE_Atomic_Op_GCC::operator= ( + const ACE_Atomic_Op_GCC &rhs) +{ + (void) __sync_lock_test_and_set (&this->value_, rhs.value_); + return *this; +} + +template +ACE_INLINE T +ACE_Atomic_Op_GCC::value (void) const +{ + return this->value_; +} + +template +ACE_INLINE volatile T & +ACE_Atomic_Op_GCC::value_i (void) +{ + return this->value_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_GCC_ATOMIC_BUILTINS */ diff --git a/externals/ace/Atomic_Op_Sparc.c b/externals/ace/Atomic_Op_Sparc.c new file mode 100644 index 0000000..842673e --- /dev/null +++ b/externals/ace/Atomic_Op_Sparc.c @@ -0,0 +1,187 @@ +/* $Id: Atomic_Op_Sparc.c 80826 2008-03-04 14:51:23Z wotte $ + * + * This is a C file for a reason. The Sun C++ compiler does not accept + * inline assembler. + * + * Portions of this code are based on atomic operations found in the + * linux kernel source code. + */ + +#if defined (ACE_INCLUDE_ATOMIC_OP_SPARC) + +#if defined(__i386) && defined(__SUNPRO_C) +static void +__sunpro_asm_code() { + __asm("\n\ + .globl ace_atomic_add_long \n\ + .type ace_atomic_add_long,@function \n\ + .align 4 \n\ +ace_atomic_add_long: \n\ + movl 0x00000004(%esp), %edx \n\ + movl 0x00000008(%esp), %eax \n\ + lock; xadd %eax, (%edx) \n\ + addl 0x00000008(%esp), %eax \n\ + ret \n\ + "); + + __asm("\n\ + .globl ace_atomic_swap_long \n\ + .type ace_atomic_swap_long,@function \n\ + .align 4 \n\ +ace_atomic_swap_long: \n\ + movl 0x00000004(%esp), %edx \n\ + movl 0x00000008(%esp), %eax \n\ + xchg %eax, (%edx) \n\ + ret \n\ + "); + + __asm("\n\ + .globl ace_atomic_swap_add_long \n\ + .type ace_atomic_swap_add_long,@function \n\ + .align 4 \n\ +ace_atomic_swap_add_long: \n\ + movl 0x00000004(%esp), %edx \n\ + movl 0x00000008(%esp), %eax \n\ + lock; xadd %eax, (%edx) \n\ + ret \n\ + "); +} + +#elif defined(__x86_64) && defined(__SUNPRO_C) + +static void +__sunpro_asm_code() { + __asm("\n\ + .globl ace_atomic_add_long \n\ + .type ace_atomic_add_long,@function \n\ + .align 16 \n\ +ace_atomic_add_long: \n\ + movq %rsi, %rax \n\ + lock; xaddq %rax, (%rdi) \n\ + addq %rsi, %rax \n\ + ret \n\ + "); + + __asm("\n\ + .globl ace_atomic_swap_long \n\ + .type ace_atomic_swap_long,@function \n\ + .align 16 \n\ +ace_atomic_swap_long: \n\ + xchgq %rsi, (%rdi) \n\ + movq %rsi, %rax \n\ + ret \n\ + "); + + __asm("\n\ + .globl ace_atomic_swap_add_long \n\ + .type ace_atomic_swap_add_long,@function \n\ + .align 16 \n\ +ace_atomic_swap_add_long: \n\ + lock; xaddq %rsi, (%rdi) \n\ + movq %rsi, %rax \n\ + ret \n\ + "); +} + +#elif defined (__sparcv9) + +unsigned long +ace_atomic_add_long (volatile unsigned long *dest, long rhs) +{ + __asm ("restore\n" + "ldx [%o0], %o2\n" + ".again_add:\n" + "add %o2, %o1, %o3\n" + "casx [%o0], %o2, %o3\n" + "cmp %o2, %o3\n" + "bne,pn %xcc, .again_add\n" + "mov %o3, %o2\n" + "retl\n" + "add %o2, %o1, %o0\n"); +} + +unsigned long +ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs) +{ + __asm ("restore\n" + "ldx [%o0], %o2\n" + ".again_swap:\n" + "mov %o1, %o3\n" + "casx [%o0], %o2, %o3\n" + "cmp %o2, %o3\n" + "bne,pn %xcc, .again_swap\n" + "mov %o3, %o2\n" + "retl\n" + "mov %o3, %o0\n"); +} + +unsigned long +ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs) +{ + __asm ("restore\n" + "ldx [%o0], %o2\n" + ".again_swap_add:\n" + "mov %o2, %o4\n" + "add %o2, %o1, %o3\n" + "casx [%o0], %o2, %o3\n" + "cmp %o2, %o3\n" + "bne,pn %xcc, .again_swap_add\n" + "mov %o3, %o2\n" + "retl\n" + "mov %o4, %o0\n"); +} + +#else + +unsigned long +ace_atomic_add_long (volatile unsigned long *dest, long rhs) +{ + __asm ("restore\n" + "ld [%o0], %o2\n" + ".again_add:\n" + "add %o2, %o1, %o3\n" + "cas [%o0], %o2, %o3\n" + "cmp %o2, %o3\n" + "bne,pn %icc, .again_add\n" + "mov %o3, %o2\n" + "retl\n" + "add %o2, %o1, %o0\n"); +} + +unsigned long +ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs) +{ + __asm ("restore\n" + "ld [%o0], %o2\n" + ".again_swap:\n" + "mov %o1, %o3\n" + "cas [%o0], %o2, %o3\n" + "cmp %o2, %o3\n" + "bne,pn %icc, .again_swap\n" + "mov %o3, %o2\n" + "retl\n" + "mov %o3, %o0\n"); +} + +unsigned long +ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs) +{ + __asm ("restore\n" + "ld [%o0], %o2\n" + ".again_swap_add:\n" + "mov %o2, %o4\n" + "add %o2, %o1, %o3\n" + "cas [%o0], %o2, %o3\n" + "cmp %o2, %o3\n" + "bne,pn %icc, .again_swap_add\n" + "mov %o3, %o2\n" + "retl\n" + "mov %o4, %o0\n"); +} + +# endif /* __sparcv9 */ + +#elif !defined (__GNUC__) && !defined (__INTEL_COMPILER) +/* Make compilers stop complaining about an empty translation unit */ +static int shut_up_compiler = 0; +#endif /* ACE_INCLUDE_ATOMIC_OP_SPARC */ diff --git a/externals/ace/Atomic_Op_Sparc.h b/externals/ace/Atomic_Op_Sparc.h new file mode 100644 index 0000000..75b9ad6 --- /dev/null +++ b/externals/ace/Atomic_Op_Sparc.h @@ -0,0 +1,14 @@ +/* -*- C++ -*- */ +// $Id: Atomic_Op_Sparc.h 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_ATOMIC_OP_SPARC_H +#define ACE_ATOMIC_OP_SPARC_H + +extern "C" +{ + unsigned long ace_atomic_add_long (volatile unsigned long *dest, long rhs); + unsigned long ace_atomic_swap_long (volatile unsigned long *dest, unsigned long rhs); + unsigned long ace_atomic_swap_add_long (volatile unsigned long *dest, long rhs); +} + +#endif /* ACE_ATOMIC_OP_SPARC_H */ diff --git a/externals/ace/Atomic_Op_T.cpp b/externals/ace/Atomic_Op_T.cpp new file mode 100644 index 0000000..fcaa529 --- /dev/null +++ b/externals/ace/Atomic_Op_T.cpp @@ -0,0 +1,82 @@ +#ifndef ACE_ATOMIC_OP_T_CPP +#define ACE_ATOMIC_OP_T_CPP + +#include "ace/Atomic_Op_T.h" + +#ifdef ACE_HAS_DUMP +# include "ace/Log_Msg.h" +#endif /* ACE_HAS_DUMP */ + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Atomic_Op_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op_Ex) +ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op) + +ACE_RCSID(ace, Atomic_Op_T, "$Id: Atomic_Op_T.cpp 85141 2009-04-22 08:48:30Z johnnyw $") + +// ************************************************* +template ACE_LOCK & +ACE_Atomic_Op_Ex::mutex (void) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::mutex"); + return this->mutex_; +} + +template +void +ACE_Atomic_Op_Ex::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Atomic_Op_Ex::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->mutex_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP, this)); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex (ACE_LOCK & mtx) + : mutex_ (mtx) + , value_ (0) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); +} + +template +ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex ( + ACE_LOCK & mtx, + typename ACE_Atomic_Op_Ex::arg_type c) + : mutex_ (mtx) + , value_ (c) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); +} + +// **************************************************************** + +template +ACE_Atomic_Op::ACE_Atomic_Op (void) + : impl_ (this->own_mutex_) +{ + // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); +} + +template +ACE_Atomic_Op::ACE_Atomic_Op ( + typename ACE_Atomic_Op::arg_type c) + : impl_ (own_mutex_, c) +{ + // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ATOMIC_OP_T_CPP */ diff --git a/externals/ace/Atomic_Op_T.h b/externals/ace/Atomic_Op_T.h new file mode 100644 index 0000000..13bd7db --- /dev/null +++ b/externals/ace/Atomic_Op_T.h @@ -0,0 +1,369 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Atomic_Op_T.h + * + * $Id: Atomic_Op_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_ATOMIC_OP_T_H +#define ACE_ATOMIC_OP_T_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +struct ACE_Type_Traits +{ + typedef TYPE const & parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef bool parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef char parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef signed char parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef unsigned char parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef short parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef unsigned short parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef int parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef unsigned int parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef long parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef unsigned long parameter_type; +}; + +#ifndef ACE_LACKS_LONGLONG_T +template<> +struct ACE_Type_Traits +{ + typedef long long parameter_type; +}; +#endif /* !ACE_LACKS_LONGLONG_T */ + +#if !defined (ACE_LACKS_LONGLONG_T) \ + && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +template<> +struct ACE_Type_Traits +{ + typedef unsigned long long parameter_type; +}; +#endif /* !ACE_LACKS_LONGLONG_T && !ACE_LACKS_UNSIGNEDLONGLONG_T */ + +template<> +struct ACE_Type_Traits +{ + typedef float parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef double parameter_type; +}; + +template<> +struct ACE_Type_Traits +{ + typedef long double parameter_type; +}; + +template +struct ACE_Type_Traits +{ + typedef TYPE* parameter_type; +}; + +/** + * @class ACE_Atomic_Op_Ex + * + * @brief Transparently parameterizes synchronization into basic + * arithmetic operations. + * + * This class is described in an article in the July/August 1994 + * issue of the C++ Report magazine. It implements a + * templatized version of the Decorator pattern from the GoF book. + * + * ACE_Atomic_Op_Ex objects must be constructed with a reference + * to an existing lock. A single lock can be shared between + * multiple ACE_Atomic_Op_Ex objects. If you do not require this + * ability consider using the ACE_Atomic_Op class instead, which + * may be able to take advantage of platform-specific + * optimisations to provide atomic operations without requiring a + * lock. + */ +template +class ACE_Atomic_Op_Ex +{ +public: + + typedef typename ACE_Type_Traits::parameter_type arg_type; + + // = Initialization methods. + + /// Initialize @c value_ to 0. + ACE_Atomic_Op_Ex (ACE_LOCK & mtx); + + /// Initialize @c value_ to c. + ACE_Atomic_Op_Ex (ACE_LOCK & mtx, arg_type c); + + // = Accessors. + + /// Atomically pre-increment @c value_. + TYPE operator++ (void); + + /// Atomically post-increment @c value_. + TYPE operator++ (int); + + /// Atomically increment @c value_ by rhs. + TYPE operator+= (arg_type rhs); + + /// Atomically pre-decrement @c value_. + TYPE operator-- (void); + + /// Atomically post-decrement @c value_. + TYPE operator-- (int); + + /// Atomically decrement @c value_ by rhs. + TYPE operator-= (arg_type rhs); + + /// Atomically compare @c value_ with rhs. + bool operator== (arg_type rhs) const; + + /// Atomically compare @c value_ with rhs. + bool operator!= (arg_type rhs) const; + + /// Atomically check if @c value_ greater than or equal to rhs. + bool operator>= (arg_type rhs) const; + + /// Atomically check if @c value_ greater than rhs. + bool operator> (arg_type rhs) const; + + /// Atomically check if @c value_ less than or equal to rhs. + bool operator<= (arg_type rhs) const; + + /// Atomically check if @c value_ less than rhs. + bool operator< (arg_type rhs) const; + + /// Atomically assign rhs to @c value_. + ACE_Atomic_Op_Ex &operator= (arg_type rhs); + + /// Atomically assign to @c value_. + ACE_Atomic_Op_Ex &operator= ( + ACE_Atomic_Op_Ex const & rhs); + + /// Explicitly return @c value_. + TYPE value (void) const; + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + + /// Manage copying... + ACE_Atomic_Op_Ex (ACE_Atomic_Op_Ex const &); + + /** + * Returns a reference to the underlying . This makes it + * possible to acquire the lock explicitly, which can be useful in + * some cases if you instantiate the with an + * ACE_Recursive_Mutex or ACE_Process_Mutex. @note the right + * name would be lock_, but HP/C++ will choke on that! + */ + ACE_LOCK & mutex (void); + + /** + * Explicitly return @c value_ (by reference). This gives the user + * full, unrestricted access to the underlying value. This method + * will usually be used in conjunction with explicit access to the + * lock. Use with care ;-) + */ + TYPE & value_i (void); + +private: + /// Type of synchronization mechanism. + ACE_LOCK & mutex_; + + /// Current object decorated by the atomic op. + TYPE value_; +}; + +/** + * @class ACE_Atomic_Op + * + * @brief Transparently parameterizes synchronization into basic + * arithmetic operations. + * + * This class is described in an article in the July/August 1994 + * issue of the C++ Report magazine. It implements a + * templatized version of the Decorator pattern from the GoF book. + * + * Certain platforms may provide a template specialization for + * ACE_Atomic_Op that provides optimized + * atomic integer operations without actually requiring a mutex. + */ +template +class ACE_Atomic_Op +{ +public: + + typedef typename ACE_Type_Traits::parameter_type arg_type; + + /// Initialize @c value_ to 0. + ACE_Atomic_Op (void); + + /// Initialize @c value_ to c. + ACE_Atomic_Op (arg_type c); + + /// Manage copying... + ACE_Atomic_Op (ACE_Atomic_Op const & c); + + /// Atomically assign rhs to @c value_. + ACE_Atomic_Op & operator= (arg_type rhs); + + /// Atomically assign to @c value_. + ACE_Atomic_Op & operator= ( + ACE_Atomic_Op const & rhs); + + /// Atomically pre-increment @c value_. + TYPE operator++ (void); + + /// Atomically post-increment @c value_. + TYPE operator++ (int); + + /// Atomically increment @c value_ by rhs. + TYPE operator+= (arg_type rhs); + + /// Atomically pre-decrement @c value_. + TYPE operator-- (void); + + /// Atomically post-decrement @c value_. + TYPE operator-- (int); + + /// Atomically decrement @c value_ by rhs. + TYPE operator-= (arg_type rhs); + + /// Atomically compare @c value_ with rhs. + bool operator== (arg_type rhs) const; + + /// Atomically compare @c value_ with rhs. + bool operator!= (arg_type rhs) const; + + /// Atomically check if @c value_ greater than or equal to rhs. + bool operator>= (arg_type rhs) const; + + /// Atomically check if @c value_ greater than rhs. + bool operator> (arg_type rhs) const; + + /// Atomically check if @c value_ less than or equal to rhs. + bool operator<= (arg_type rhs) const; + + /// Atomically check if @c value_ less than rhs. + bool operator< (arg_type rhs) const; + + /// Explicitly return @c value_. + TYPE value (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /** + * Returns a reference to the underlying . This makes it + * possible to acquire the lock explicitly, which can be useful in + * some cases if you instantiate the ACE_Atomic_Op with an + * ACE_Recursive_Mutex or ACE_Process_Mutex. + * + * @deprecated This member function is deprecated and so may go away in + * the future. If you need access to the underlying mutex, consider + * using the ACE_Atomic_Op_Ex template instead. + */ + ACE_LOCK & mutex (void); + + /** + * Explicitly return @c value_ (by reference). This gives the user + * full, unrestricted access to the underlying value. This method + * will usually be used in conjunction with explicit access to the + * lock. Use with care ;-) + */ + TYPE & value_i (void); + +private: + /// Type of synchronization mechanism. + ACE_LOCK own_mutex_; + + /// Underlying atomic op implementation. + ACE_Atomic_Op_Ex impl_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Atomic_Op_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Atomic_Op_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Atomic_Op_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /*ACE_ATOMIC_OP_T_H*/ diff --git a/externals/ace/Atomic_Op_T.inl b/externals/ace/Atomic_Op_T.inl new file mode 100644 index 0000000..ff051b0 --- /dev/null +++ b/externals/ace/Atomic_Op_T.inl @@ -0,0 +1,340 @@ +// -*- C++ -*- +// +// $Id: Atomic_Op_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Guard_T.h" + +#include + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// +// ACE_Atomic_Op_Ex inline functions +// + +template +ACE_INLINE TYPE +ACE_Atomic_Op_Ex::operator++ (void) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + return ++this->value_; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op_Ex::operator+= ( + typename ACE_Atomic_Op_Ex::arg_type rhs) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator+="); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + return this->value_ += rhs; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op_Ex::operator-- (void) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + return --this->value_; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op_Ex::operator-= ( + typename ACE_Atomic_Op_Ex::arg_type rhs) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator-="); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + return this->value_ -= rhs; +} + +template +ACE_INLINE +ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex ( + ACE_Atomic_Op_Ex const & rhs) + : mutex_ (rhs.mutex_) + , value_ (rhs.value ()) // rhs.value() returns atomically +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op_Ex::operator++ (int) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + return this->value_++; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op_Ex::operator-- (int) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + return this->value_--; +} + +template +ACE_INLINE bool +ACE_Atomic_Op_Ex::operator== ( + typename ACE_Atomic_Op_Ex::arg_type rhs) const +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator=="); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); + return this->value_ == rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op_Ex::operator!= ( + typename ACE_Atomic_Op_Ex::arg_type rhs) const +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator!="); + return !(*this == rhs); +} + +template +ACE_INLINE bool +ACE_Atomic_Op_Ex::operator>= ( + typename ACE_Atomic_Op_Ex::arg_type rhs) const +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>="); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); + return this->value_ >= rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op_Ex::operator> ( + typename ACE_Atomic_Op_Ex::arg_type rhs) const +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); + return this->value_ > rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op_Ex::operator<= ( + typename ACE_Atomic_Op_Ex::arg_type rhs) const +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<="); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); + return this->value_ <= rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op_Ex::operator< ( + typename ACE_Atomic_Op_Ex::arg_type rhs) const +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); + return this->value_ < rhs; +} + +template +ACE_INLINE ACE_Atomic_Op_Ex & +ACE_Atomic_Op_Ex::operator= ( + ACE_Atomic_Op_Ex const & rhs) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); + + ACE_Atomic_Op_Ex tmp (rhs); + + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); + std::swap (this->value_, tmp.value_); + + return *this; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op_Ex::value (void) const +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::value"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + return this->value_; +} + +template +ACE_INLINE TYPE & +ACE_Atomic_Op_Ex::value_i (void) +{ + // Explicitly return (by reference). This gives the user + // full, unrestricted access to the underlying value. This method + // will usually be used in conjunction with explicit access to the + // lock. Use with care ;-) + return this->value_; +} + +template +ACE_INLINE ACE_Atomic_Op_Ex & +ACE_Atomic_Op_Ex::operator= ( + typename ACE_Atomic_Op_Ex::arg_type rhs) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); + this->value_ = rhs; + return *this; +} + +// +// ACE_Atomic_Op inline functions +// + +template ACE_INLINE +ACE_Atomic_Op::ACE_Atomic_Op ( + ACE_Atomic_Op const & rhs) + : impl_ (own_mutex_, rhs.value ()) +{ + // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); +} + + +template +ACE_INLINE ACE_Atomic_Op & +ACE_Atomic_Op::operator= ( + typename ACE_Atomic_Op::arg_type i) +{ + this->impl_ = i; + return *this; +} + +template +ACE_INLINE ACE_Atomic_Op & +ACE_Atomic_Op::operator= ( + ACE_Atomic_Op const & rhs) +{ + this->impl_ = rhs.impl_; + return *this; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op::operator++ (void) +{ + return ++this->impl_; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op::operator++ (int) +{ + return this->impl_++; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op::operator+= ( + typename ACE_Atomic_Op::arg_type rhs) +{ + return this->impl_ += rhs; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op::operator-- (void) +{ + return --this->impl_; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op::operator-- (int) +{ + return this->impl_--; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op::operator-= ( + typename ACE_Atomic_Op::arg_type rhs) +{ + return this->impl_ -= rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op::operator== ( + typename ACE_Atomic_Op::arg_type rhs) const +{ + return this->impl_ == rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op::operator!= ( + typename ACE_Atomic_Op::arg_type rhs) const +{ + return this->impl_ != rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op::operator>= ( + typename ACE_Atomic_Op::arg_type rhs) const +{ + return this->impl_ >= rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op::operator> ( + typename ACE_Atomic_Op::arg_type rhs) const +{ + return this->impl_ > rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op::operator<= ( + typename ACE_Atomic_Op::arg_type rhs) const +{ + return this->impl_ <= rhs; +} + +template +ACE_INLINE bool +ACE_Atomic_Op::operator< ( + typename ACE_Atomic_Op::arg_type rhs) const +{ + return this->impl_ < rhs; +} + +template +ACE_INLINE TYPE +ACE_Atomic_Op::value (void) const +{ + return this->impl_.value (); +} + +template +ACE_INLINE void +ACE_Atomic_Op::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->impl_.dump (); +#endif /* ACE_HAS_DUMP */ + return; +} + +template +ACE_INLINE ACE_LOCK & +ACE_Atomic_Op::mutex (void) +{ + return this->own_mutex_; +} + +template +ACE_INLINE TYPE & +ACE_Atomic_Op::value_i (void) +{ + return this->impl_.value_i (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Auto_Event.cpp b/externals/ace/Auto_Event.cpp new file mode 100644 index 0000000..51efcf7 --- /dev/null +++ b/externals/ace/Auto_Event.cpp @@ -0,0 +1,49 @@ +// $Id: Auto_Event.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Auto_Event.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Auto_Event.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (ace, + Auto_Event, + "$Id: Auto_Event.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Auto_Event::ACE_Auto_Event (int initial_state, + int type, + const char *name, + void *arg) + : ACE_Event (0, + initial_state, + type, + ACE_TEXT_CHAR_TO_TCHAR (name), + arg) +{ +} + +#if defined (ACE_HAS_WCHAR) +ACE_Auto_Event::ACE_Auto_Event (int initial_state, + int type, + const wchar_t *name, + void *arg) + : ACE_Event (0, + initial_state, + type, + ACE_TEXT_WCHAR_TO_TCHAR (name), + arg) +{ +} +#endif /* ACE_HAS_WCHAR */ + +void +ACE_Auto_Event::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_Event::dump (); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Auto_Event.h b/externals/ace/Auto_Event.h new file mode 100644 index 0000000..042f82e --- /dev/null +++ b/externals/ace/Auto_Event.h @@ -0,0 +1,73 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Auto_Event.h + * + * $Id: Auto_Event.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_AUTO_EVENT_H +#define ACE_AUTO_EVENT_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Event.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Auto_Event + * + * @brief Auto Events. + * + * Specialization of Event mechanism which wakes up one waiting + * thread on . All platforms support process-scope locking + * support. However, only Win32 platforms support global naming and + * system-scope locking support. + */ +class ACE_Export ACE_Auto_Event : public ACE_Event +{ +public: + /// Constructor which will create auto event + ACE_Auto_Event (int initial_state = 0, + int type = USYNC_THREAD, + const char *name = 0, + void *arg = 0); + +#if defined (ACE_HAS_WCHAR) + /// Constructor which will create auto event (wchar_t version) + ACE_Auto_Event (int initial_state, + int type, + const wchar_t *name, + void *arg = 0); +#endif /* ACE_HAS_WCHAR */ + + /// Default dtor. + ~ACE_Auto_Event (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Auto_Event.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_AUTO_EVENT_H */ diff --git a/externals/ace/Auto_Event.inl b/externals/ace/Auto_Event.inl new file mode 100644 index 0000000..b614e0b --- /dev/null +++ b/externals/ace/Auto_Event.inl @@ -0,0 +1,12 @@ +// -*- C++ -*- +// +// $Id: Auto_Event.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Auto_Event::~ACE_Auto_Event (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Auto_Functor.cpp b/externals/ace/Auto_Functor.cpp new file mode 100644 index 0000000..9d0dc79 --- /dev/null +++ b/externals/ace/Auto_Functor.cpp @@ -0,0 +1,39 @@ +// $Id: Auto_Functor.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_AUTO_FUNCTOR_CPP +#define ACE_AUTO_FUNCTOR_CPP + +#include "ace/Auto_Functor.h" + +#if !defined(__ACE_INLINE__) +# include "ace/Auto_Functor.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Utils::Auto_Functor::~Auto_Functor() +{ + reset(0); +} + +template void +ACE_Utils::Auto_Functor::reset(X * p) +{ + if(p_ != 0) + { + f_(p_); + } + p_ = p; +} + +templatevoid +ACE_Utils::Auto_Functor::reset(X * p, Functor f) +{ + reset(p); + f_ = f; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /*ACE_AUTO_FUNCTOR_CPP*/ diff --git a/externals/ace/Auto_Functor.h b/externals/ace/Auto_Functor.h new file mode 100644 index 0000000..2c2b81e --- /dev/null +++ b/externals/ace/Auto_Functor.h @@ -0,0 +1,127 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Auto_Functor.h + * + * $Id: Auto_Functor.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ +//============================================================================= +#ifndef ACE_AUTO_FUNCTOR_H +#define ACE_AUTO_FUNCTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_Utils +{ +/** + * @class Auto_Functor_Ref + * + * @brief Helper class to implement assignment and copy-construction + * as expected + */ +template +struct Auto_Functor_Ref +{ + X * p_; + Functor f_; + + Auto_Functor_Ref(X * p, Functor f); +}; + +/** + * @class Auto_Functor + * + * @brief Helper template to implement auto_ptr<>-like classes, but + * executing a functor in the destructor, instead of always + * deleting things. + * + * The functor is called in the destructor, and it must implement: + * + * Functor() throw();
+ * Functor(Functor const &) throw();
+ * Functor & operator=(Functor const &) throw();
+ * void operator()(X * p) throw();
+ * + */ +template +class Auto_Functor +{ +public: + typedef X element_type; + typedef Functor functor_type; + + /// Constructor + explicit Auto_Functor (X * p = 0, + Functor functor = Functor()); // throw() + + Auto_Functor (Auto_Functor & rhs); // throw() + + Auto_Functor& operator= (Auto_Functor & rhs); // throw() + +#if !defined(ACE_LACKS_MEMBER_TEMPLATES) + template + Auto_Functor(Auto_Functor& rhs); // throw() + + template + Auto_Functor& operator= (Auto_Functor& rhs); // throw() +#endif /* ACE_LACKS_MEMBER_TEMPLATES */ + + ~Auto_Functor(); // throw() + + X & operator*() const; // throw() + + X * operator->() const; // throw() + + X * get(); // throw() + + X * release(); // throw() + + void reset (X * p = 0); // throw() + + void reset (X * p, Functor f); // throw() + + Functor const & functor() const; // throw() + + Auto_Functor(Auto_Functor_Ref rhs); // throw() + + Auto_Functor & operator=(Auto_Functor_Ref rhs); // throw() + +#if !defined(ACE_LACKS_MEMBER_TEMPLATES) + template operator Auto_Functor_Ref(); // throw() + + template operator Auto_Functor(); // throw() +#else + operator Auto_Functor_Ref(); // throw() +#endif /* ACE_LACKS_MEMBER_TEMPLATES */ + +private: + X * p_; + + Functor f_; +}; + +} // namespace ACE_Utils + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined(__ACE_INLINE__) +# include "ace/Auto_Functor.inl" +#endif /* __ACE_INLINE__ */ + +#if defined(ACE_TEMPLATES_REQUIRE_SOURCE) +# include "ace/Auto_Functor.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#include /**/ "ace/post.h" +#endif /* ACE_AUTO_FUNCTOR_H*/ diff --git a/externals/ace/Auto_Functor.inl b/externals/ace/Auto_Functor.inl new file mode 100644 index 0000000..d4cb2cc --- /dev/null +++ b/externals/ace/Auto_Functor.inl @@ -0,0 +1,134 @@ +// -*- C++ -*- +// +// $Id: Auto_Functor.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE +ACE_Utils::Auto_Functor_Ref:: +Auto_Functor_Ref(X * p, Functor f) + : p_(p) + , f_(f) +{ +} + +template ACE_INLINE +ACE_Utils::Auto_Functor::Auto_Functor(X * p, Functor f) + : p_(p) + , f_(f) +{ +} + +template ACE_INLINE +ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor & rhs) + : p_(rhs.release()) + , f_(rhs.f_) +{ +} + +template +ACE_INLINE ACE_Utils::Auto_Functor& +ACE_Utils::Auto_Functor:: operator=(Auto_Functor & rhs) +{ + reset(rhs.release()); + f_ = rhs.f_; + return *this; +} + +#if !defined(ACE_LACKS_MEMBER_TEMPLATES) +template template ACE_INLINE +ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor& rhs) + : p_(rhs.release()) + , f_(rhs.f_) +{ +} + +template template +ACE_INLINE ACE_Utils::Auto_Functor& +ACE_Utils::Auto_Functor::operator=(Auto_Functor& rhs) +{ + reset(rhs.release()); + return *this; +} +#endif /* ACE_LACKS_MEMBER_TEMPLATES */ + +template ACE_INLINE X & +ACE_Utils::Auto_Functor::operator*() const +{ + return *p_; +} + +template +ACE_INLINE X * +ACE_Utils::Auto_Functor::operator->() const +{ + return p_; +} + +template +ACE_INLINE X * +ACE_Utils::Auto_Functor::get() +{ + return p_; +} + +template +ACE_INLINE X * +ACE_Utils::Auto_Functor::release() +{ + X * tmp = p_; + p_ = 0; + return tmp; +} + +template +ACE_INLINE Functor const & +ACE_Utils::Auto_Functor::functor() const +{ + return f_; +} + +template ACE_INLINE +ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor_Ref rhs) + : p_(rhs.p_) + , f_(rhs.f_) +{ +} + +template +ACE_INLINE ACE_Utils::Auto_Functor & +ACE_Utils::Auto_Functor::operator=(Auto_Functor_Ref rhs) +{ + if(rhs.p_ != p_) + { + reset(rhs.p_); + f_ = rhs.f_; + } + return *this; +} + +#if !defined(ACE_LACKS_MEMBER_TEMPLATES) + +template template ACE_INLINE +ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor_Ref() +{ + return ACE_Utils::Auto_Functor_Ref(release(), f_); +} + +template template ACE_INLINE +ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor() +{ + return ACE_Utils::Auto_Functor(release(), f_); +} + +#else + +templateACE_INLINE +ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor_Ref() +{ + return ACE_Utils::Auto_Functor_Ref(release(), f_); +} + +#endif /* ACE_LACKS_MEMBER_TEMPLATES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Auto_IncDec_T.cpp b/externals/ace/Auto_IncDec_T.cpp new file mode 100644 index 0000000..ccef122 --- /dev/null +++ b/externals/ace/Auto_IncDec_T.cpp @@ -0,0 +1,34 @@ +// $Id: Auto_IncDec_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_AUTO_INCDEC_T_CPP +#define ACE_AUTO_INCDEC_T_CPP + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Auto_IncDec_T.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Auto_IncDec_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Auto_IncDec) + +template void +ACE_Auto_IncDec::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Auto_IncDec::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_AUTO_INCDEC_T_CPP */ diff --git a/externals/ace/Auto_IncDec_T.h b/externals/ace/Auto_IncDec_T.h new file mode 100644 index 0000000..8fcdb0b --- /dev/null +++ b/externals/ace/Auto_IncDec_T.h @@ -0,0 +1,91 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Auto_IncDec_T.h + * + * $Id: Auto_IncDec_T.h 84675 2009-03-02 11:44:35Z johnnyw $ + * + * @author Edan Ayal + */ +//============================================================================= + + +#ifndef ACE_AUTO_INCDEC_T_H +#define ACE_AUTO_INCDEC_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Auto_IncDec + * + * @brief This class automatically increments and decrements a + * parameterized counter. + * + * This data structure is meant to be used within a method, + * function, or scope. The actual parameter given for the + * template parameter + * must provide at least operators ++ and --. + */ +template +class ACE_Auto_IncDec +{ +public: + + /// Implicitly increment the counter. + ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter); + + /// Implicitly decrement the counter. + ~ACE_Auto_IncDec (void); + + /// Dump the state of an object. + void dump (void) const; + +protected: + /// Reference to the counter + /// we're incrementing/decrementing. + ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter_; + +private: + // = Prevent assignment and initialization. + ACE_UNIMPLEMENTED_FUNC (void operator= (const + ACE_Auto_IncDec &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const + ACE_Auto_IncDec &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Auto_IncDec_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Auto_IncDec_T.cpp" +// On Win32 platforms, this code will be included as template source +// code and will not be inlined. Therefore, we first turn off +// ACE_INLINE, set it to be nothing, include the code, and then turn +// ACE_INLINE back to its original setting. All this nonsense is +// necessary, since the generic template code that needs to be +// specialized cannot be inlined, else the compiler will ignore the +// specialization code. Also, the specialization code *must* be +// inlined or the compiler will ignore the specializations. +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Auto_IncDec_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_AUTO_INCDEC_T_H */ diff --git a/externals/ace/Auto_IncDec_T.inl b/externals/ace/Auto_IncDec_T.inl new file mode 100644 index 0000000..e61980e --- /dev/null +++ b/externals/ace/Auto_IncDec_T.inl @@ -0,0 +1,25 @@ +// -*- C++ -*- +// +// $Id: Auto_IncDec_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Implicitly and automatically increment the counter. + +template ACE_INLINE +ACE_Auto_IncDec::ACE_Auto_IncDec + (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter) + : counter_ (counter) +{ + ++this->counter_; +} + +// Implicitly and automatically decrement the counter. + +template ACE_INLINE +ACE_Auto_IncDec::~ACE_Auto_IncDec (void) +{ + --this->counter_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Auto_Ptr.cpp b/externals/ace/Auto_Ptr.cpp new file mode 100644 index 0000000..791bd48 --- /dev/null +++ b/externals/ace/Auto_Ptr.cpp @@ -0,0 +1,21 @@ +// $Id: Auto_Ptr.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_AUTO_PTR_CPP +#define ACE_AUTO_PTR_CPP + +#include "ace/Auto_Ptr.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Auto_Ptr.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Auto_Ptr, "$Id: Auto_Ptr.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Ptr) +ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Array_Ptr) + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_AUTO_PTR_CPP */ diff --git a/externals/ace/Auto_Ptr.h b/externals/ace/Auto_Ptr.h new file mode 100644 index 0000000..3183019 --- /dev/null +++ b/externals/ace/Auto_Ptr.h @@ -0,0 +1,242 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Auto_Ptr.h + * + * $Id: Auto_Ptr.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + * @author Irfan Pyarali + * @author Jack Reeves + * @author Dr. Harald M. Mueller + */ +//============================================================================= + +#ifndef ACE_AUTO_PTR_H +#define ACE_AUTO_PTR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (_MSC_VER) +// Suppress warning e.g. "return type for +// 'ACE_Auto_Array_Pointer::operator ->' is 'type *' (i.e., not a UDT +// or reference to a UDT. Will produce errors if applied using infix +// notation)" +# pragma warning(push) +# pragma warning(disable: 4284) +#endif /* _MSC_VER */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Auto_Basic_Ptr + * + * @brief Implements the draft C++ standard auto_ptr abstraction. + * This class allows one to work on non-object (basic) types + */ +template +class ACE_Auto_Basic_Ptr +{ +public: + typedef X element_type; + + // = Initialization and termination methods + explicit ACE_Auto_Basic_Ptr (X * p = 0) : p_ (p) {} + + ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr & ap); + ACE_Auto_Basic_Ptr &operator= (ACE_Auto_Basic_Ptr & rhs); + ~ACE_Auto_Basic_Ptr (void); + + // = Accessor methods. + X &operator *() const; + X *get (void) const; + X *release (void); + void reset (X * p = 0); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + X *p_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if !defined (ACE_LACKS_AUTO_PTR) && \ + defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ + (ACE_HAS_STANDARD_CPP_LIBRARY != 0) +#include +#if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ + (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) +using std::auto_ptr; +#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ +#else /* ACE_HAS_STANDARD_CPP_LIBRARY */ + +/** + * @class auto_ptr + * + * @brief Implements the draft C++ standard auto_ptr abstraction. + */ +template +class auto_ptr : public ACE_Auto_Basic_Ptr +{ +public: + typedef X element_type; + + // = Initialization and termination methods + explicit auto_ptr (X * p = 0) : ACE_Auto_Basic_Ptr (p) {} + auto_ptr (auto_ptr & ap) : ACE_Auto_Basic_Ptr (ap.release ()) {} + + X *operator-> () const; +}; + +#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @brief Implements the draft C++ standard auto_ptr abstraction. + * This version can be used instead of auto_ptr, and obviates + * the need for the ACE_AUTO_PTR_RESET macro on platforms like + * VC6 where the auto_ptr is broken. + */ +template +class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr +{ +public: + typedef X element_type; + + // = Initialization and termination methods + explicit ACE_Auto_Ptr (X * p = 0) : ACE_Auto_Basic_Ptr (p) {} + + X *operator-> () const; +}; + +/** + * @class ACE_Auto_Basic_Array_Ptr + * + * @brief Implements an extension to the draft C++ standard auto_ptr + * abstraction. This class allows one to work on non-object + * (basic) types that must be treated as an array, e.g., + * deallocated via "delete [] foo". + */ +template +class ACE_Auto_Basic_Array_Ptr +{ +public: + typedef X element_type; + + // = Initialization and termination methods. + explicit ACE_Auto_Basic_Array_Ptr (X * p = 0) : p_ (p) {} + + ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr & ap); + ACE_Auto_Basic_Array_Ptr &operator= (ACE_Auto_Basic_Array_Ptr & rhs); + ~ACE_Auto_Basic_Array_Ptr (void); + + // = Accessor methods. + X & operator* () const; + X & operator[] (int i) const; + X * get (void) const; + X * release (void); + void reset (X * p = 0); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + X * p_; +}; + +/** + * @class ACE_Auto_Array_Ptr + * + * @brief Implements an extension to the draft C++ standard auto_ptr + * abstraction. + */ +template +class ACE_Auto_Array_Ptr : public ACE_Auto_Basic_Array_Ptr +{ +public: + typedef X element_type; + + // = Initialization and termination methods. + explicit ACE_Auto_Array_Ptr (X *p = 0) + : ACE_Auto_Basic_Array_Ptr (p) {} + + X *operator-> () const; +}; + + +/** + * @brief Reset given @c auto_ptr element to new element. + * + * Some platforms have an older version of auto_ptr support, which + * lacks reset, and cannot be disabled easily. Portability to these + * platforms requires use of this function template. This function + * template also works for the @c ACE_Auto_{Basic_}Array_Ptr class + * template, as well. + */ +template +inline void +ACE_auto_ptr_reset (AUTO_PTR_TYPE & ap, + PTR_TYPE * p) +{ +#if defined (ACE_AUTO_PTR_LACKS_RESET) + // Allow compiler to adjust pointer to potential base class pointer + // of element type found in auto_ptr. + typename AUTO_PTR_TYPE::element_type * const tp = p; + if (tp != ap.get ()) + { + ap = AUTO_PTR_TYPE (tp); + } +#else + ap.reset (p); +#endif /* ACE_AUTO_PTR_LACKS_RESET */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +// Some platforms have an older version of auto_ptr +// support, which lacks reset, and cannot be disabled +// easily. Portability to these platforms requires +// use of the following ACE_AUTO_PTR_RESET macro. +// +// The TYPE macro parameter is no longer necessary but we leave it +// around for backward compatibility. This is also the reason why the +// ACE_auto_ptr_reset function template is not called +// ACE_AUTO_PTR_RESET. +# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \ + ACE_auto_ptr_reset (AUTOPTR, NEWPTR); + +#if defined (__ACE_INLINE__) +#include "ace/Auto_Ptr.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Auto_Ptr.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Auto_Ptr.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#if defined (_MSC_VER) +// Restore the warning state to what it was before entry. +# pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /* ACE_AUTO_PTR_H */ diff --git a/externals/ace/Auto_Ptr.inl b/externals/ace/Auto_Ptr.inl new file mode 100644 index 0000000..9ea47c3 --- /dev/null +++ b/externals/ace/Auto_Ptr.inl @@ -0,0 +1,171 @@ +// -*- C++ -*- +// +// $Id: Auto_Ptr.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE void +ACE_Auto_Basic_Ptr::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Auto_Basic_Ptr::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_INLINE void +ACE_Auto_Basic_Array_Ptr::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_INLINE +ACE_Auto_Basic_Ptr::ACE_Auto_Basic_Ptr (ACE_Auto_Basic_Ptr &rhs) + : p_ (rhs.release ()) +{ + ACE_TRACE ("ACE_Auto_Basic_Ptr::ACE_Auto_Basic_Ptr"); +} + +template ACE_INLINE X * +ACE_Auto_Basic_Ptr::get (void) const +{ + ACE_TRACE ("ACE_Auto_Basic_Ptr::get"); + return this->p_; +} + +template ACE_INLINE X * +ACE_Auto_Basic_Ptr::release (void) +{ + ACE_TRACE ("ACE_Auto_Basic_Ptr::release"); + X *old = this->p_; + this->p_ = 0; + return old; +} + +template ACE_INLINE void +ACE_Auto_Basic_Ptr::reset (X *p) +{ + ACE_TRACE ("ACE_Auto_Basic_Ptr::reset"); + if (this->get () != p) + delete this->get (); + this->p_ = p; +} + +template ACE_INLINE ACE_Auto_Basic_Ptr & +ACE_Auto_Basic_Ptr::operator= (ACE_Auto_Basic_Ptr &rhs) +{ + ACE_TRACE ("ACE_Auto_Basic_Ptr::operator="); + if (this != &rhs) + { + this->reset (rhs.release ()); + } + return *this; +} + +template ACE_INLINE +ACE_Auto_Basic_Ptr::~ACE_Auto_Basic_Ptr (void) +{ + ACE_TRACE ("ACE_Auto_Basic_Ptr::~ACE_Auto_Basic_Ptr"); + delete this->get (); +} + +template ACE_INLINE X & +ACE_Auto_Basic_Ptr::operator *() const +{ + ACE_TRACE ("ACE_Auto_Basic_Ptr::operator *()"); + return *this->get (); +} + +#if defined (ACE_LACKS_AUTO_PTR) || \ + !defined (ACE_HAS_STANDARD_CPP_LIBRARY) || \ + (ACE_HAS_STANDARD_CPP_LIBRARY == 0) + +template ACE_INLINE X * +auto_ptr::operator-> () const +{ + ACE_TRACE ("auto_ptr::operator->"); + return this->get (); +} + +#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ + +template ACE_INLINE X * +ACE_Auto_Ptr::operator-> () const +{ + ACE_TRACE ("ACE_Auto_Ptr::operator->"); + return this->get (); +} + +template ACE_INLINE X * +ACE_Auto_Basic_Array_Ptr::get (void) const +{ + ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::get"); + return this->p_; +} + +template ACE_INLINE X * +ACE_Auto_Basic_Array_Ptr::release (void) +{ + ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::release"); + X *old = this->p_; + this->p_ = 0; + return old; +} + +template ACE_INLINE void +ACE_Auto_Basic_Array_Ptr::reset (X *p) +{ + ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::reset"); + if (this->get () != p) + delete [] this->get (); + this->p_ = p; +} + +template ACE_INLINE +ACE_Auto_Basic_Array_Ptr::ACE_Auto_Basic_Array_Ptr (ACE_Auto_Basic_Array_Ptr &rhs) + : p_ (rhs.release ()) +{ + ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::ACE_Auto_Basic_Array_Ptr"); +} + +template ACE_INLINE ACE_Auto_Basic_Array_Ptr & +ACE_Auto_Basic_Array_Ptr::operator= (ACE_Auto_Basic_Array_Ptr &rhs) +{ + ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::operator="); + if (this != &rhs) + { + this->reset (rhs.release ()); + } + return *this; +} + +template ACE_INLINE +ACE_Auto_Basic_Array_Ptr::~ACE_Auto_Basic_Array_Ptr (void) +{ + ACE_TRACE ("ACE_Auto_Basic_Array_Ptr::~ACE_Auto_Basic_Array_Ptr"); + delete [] this->get (); +} + +template ACE_INLINE X & +ACE_Auto_Basic_Array_Ptr::operator *() const +{ + return *this->get (); +} + +template ACE_INLINE X & +ACE_Auto_Basic_Array_Ptr::operator[](int i) const +{ + X *array = this->get (); + return array[i]; +} + +template ACE_INLINE X * +ACE_Auto_Array_Ptr::operator->() const +{ + return this->get (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Barrier.cpp b/externals/ace/Barrier.cpp new file mode 100644 index 0000000..29e7422 --- /dev/null +++ b/externals/ace/Barrier.cpp @@ -0,0 +1,196 @@ +// $Id: Barrier.cpp 84282 2009-01-30 15:04:29Z msmit $ + +#include "ace/Barrier.h" + +#if defined (ACE_HAS_THREADS) + +#if !defined (__ACE_INLINE__) +#include "ace/Barrier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Guard_T.h" +#include "ace/OS_NS_errno.h" + +#if defined (ACE_HAS_DUMP) +# include "ace/Log_Msg.h" +#endif /* ACE_HAS_DUMP */ + +ACE_RCSID (ace, + Barrier, + "$Id: Barrier.cpp 84282 2009-01-30 15:04:29Z msmit $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Sub_Barrier) + +void +ACE_Sub_Barrier::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Sub_Barrier::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->barrier_finished_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("running_threads_ = %d\n"), this->running_threads_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count, + ACE_Thread_Mutex &lock, + const ACE_TCHAR *name, + void *arg) + : barrier_finished_ (lock, name, arg), + running_threads_ (count) +{ +// ACE_TRACE ("ACE_Sub_Barrier::ACE_Sub_Barrier"); +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Barrier) + +void +ACE_Barrier::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Barrier::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_generation_ = %d"), this->current_generation_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncount_ = %d"), this->count_)); + this->sub_barrier_1_.dump (); + this->sub_barrier_2_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Barrier::ACE_Barrier (unsigned int count, + const ACE_TCHAR *name, + void *arg) + : lock_ (name, (ACE_mutexattr_t *) arg), + current_generation_ (0), + count_ (count), + sub_barrier_1_ (count, lock_, name, arg), + sub_barrier_2_ (count, lock_, name, arg) +{ + ACE_TRACE ("ACE_Barrier::ACE_Barrier"); + this->sub_barrier_[0] = &this->sub_barrier_1_; + this->sub_barrier_[1] = &this->sub_barrier_2_; +} + +int +ACE_Barrier::wait (void) +{ + ACE_TRACE ("ACE_Barrier::wait"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + + ACE_Sub_Barrier *sbp = + this->sub_barrier_[this->current_generation_]; + + // Check for shutdown... + if (sbp == 0) + { + errno = ESHUTDOWN; + return -1; + } + + int retval = 0; + + if (sbp->running_threads_ == 1) + { + // We're the last running thread, so swap generations and tell + // all the threads waiting on the barrier to continue on their + // way. + sbp->running_threads_ = this->count_; + // Swap generations. + this->current_generation_ = 1 - this->current_generation_; + sbp->barrier_finished_.broadcast (); + } + else + { + --sbp->running_threads_; + + // Block until all the other threads wait(). + while (sbp->running_threads_ != this->count_) + sbp->barrier_finished_.wait (); + + // We're awake and the count has completed. See if it completed + // because all threads hit the barrier, or because the barrier + // was shut down. + if (this->sub_barrier_[this->current_generation_] == 0) + { + errno = ESHUTDOWN; + retval = -1; + } + } + + return retval; +} + +int +ACE_Barrier::shutdown (void) +{ + ACE_TRACE ("ACE_Barrier::shutdown"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + + ACE_Sub_Barrier *sbp = + this->sub_barrier_[this->current_generation_]; + + // Check for shutdown... + if (sbp == 0) + { + errno = ESHUTDOWN; + return -1; + } + + // Flag the shutdown + this->sub_barrier_[0] = 0; + this->sub_barrier_[1] = 0; + // Tell all the threads waiting on the barrier to continue on their way. + sbp->running_threads_ = this->count_; + sbp->barrier_finished_.broadcast (); + + return 0; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Barrier) + +ACE_Thread_Barrier::ACE_Thread_Barrier (unsigned int count, + const ACE_TCHAR *name) + : ACE_Barrier (count, name) +{ +// ACE_TRACE ("ACE_Thread_Barrier::ACE_Thread_Barrier"); +} + +void +ACE_Thread_Barrier::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Thread_Barrier::dump"); + ACE_Barrier::dump (); +#endif /* ACE_HAS_DUMP */ +} + +#if 0 +ACE_ALLOC_HOOK_DEFINE(ACE_Process_Barrier) + +ACE_Process_Barrier::ACE_Process_Barrier (u_int count, + const ACE_TCHAR *name) + : ACE_Barrier (count, USYNC_PROCESS, name) +{ +// ACE_TRACE ("ACE_Process_Barrier::ACE_Process_Barrier"); +} + +void +ACE_Process_Barrier::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Process_Barrier::dump"); + ACE_Barrier::dump (); +#endif /* ACE_HAS_DUMP */ +} +#endif /* 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/Barrier.h b/externals/ace/Barrier.h new file mode 100644 index 0000000..189ff07 --- /dev/null +++ b/externals/ace/Barrier.h @@ -0,0 +1,215 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Barrier.h + * + * $Id: Barrier.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_BARRIER_H +#define ACE_BARRIER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/config-all.h" + +// ACE platform supports some form of threading. +#if !defined (ACE_HAS_THREADS) + +#include "ace/OS_NS_errno.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Barrier + * + * @brief This is a no-op to make ACE "syntactically consistent." + */ +class ACE_Export ACE_Barrier +{ +public: + ACE_Barrier (unsigned int, const ACE_TCHAR * = 0, void * = 0) {} + ~ACE_Barrier (void) {} + int wait (void) { ACE_NOTSUP_RETURN (-1); } + void dump (void) const {} +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#else /* ACE_HAS_THREADS */ + +#include "ace/Condition_Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +struct ACE_Export ACE_Sub_Barrier +{ + // = Initialization. + ACE_Sub_Barrier (unsigned int count, + ACE_Thread_Mutex &lock, + const ACE_TCHAR *name = 0, + void *arg = 0); + + ~ACE_Sub_Barrier (void); + + /// True if this generation of the barrier is done. + ACE_Condition_Thread_Mutex barrier_finished_; + + /// Number of threads that are still running. + int running_threads_; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +/** + * @class ACE_Barrier + * + * @brief Implements "barrier synchronization". + * + * This class allows number of threads to synchronize + * their completion of (one round of) a task, which is known as + * "barrier synchronization". After all the threads call + * on the barrier they are all atomically released and can begin a new + * round. + * + * This implementation uses a "sub-barrier generation numbering" + * scheme to avoid overhead and to ensure that all threads wait to + * leave the barrier correct. This code is based on an article from + * SunOpsis Vol. 4, No. 1 by Richard Marejka + * (Richard.Marejka@canada.sun.com). + */ +class ACE_Export ACE_Barrier +{ +public: + /// Initialize the barrier to synchronize @a count threads. + ACE_Barrier (unsigned int count, + const ACE_TCHAR *name = 0, + void *arg = 0); + + /// Default dtor. + ~ACE_Barrier (void); + + /// Block the caller until all @c count threads have called @c wait and + /// then allow all the caller threads to continue in parallel. + /// + /// @retval 0 after successfully waiting for all threads to wait. + /// @retval -1 if an error occurs or the barrier is shut + /// down (@sa shutdown ()). + int wait (void); + + /// Shut the barrier down, aborting the wait of all waiting threads. + /// Any threads waiting on the barrier when it is shut down will return with + /// value -1, errno ESHUTDOWN. + /// + /// @retval 0 for success, -1 if already shut down. + /// + /// @since ACE beta 5.4.9. + int shutdown (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Serialize access to the barrier state. + ACE_Thread_Mutex lock_; + + /// Either 0 or 1, depending on whether we are the first generation + /// of waiters or the next generation of waiters. + int current_generation_; + + /// Total number of threads that can be waiting at any one time. + int count_; + + /** + * We keep two @c sub_barriers, one for the first "generation" of + * waiters, and one for the next "generation" of waiters. This + * efficiently solves the problem of what to do if all the first + * generation waiters don't leave the barrier before one of the + * threads calls wait() again (i.e., starts up the next generation + * barrier). + */ + ACE_Sub_Barrier sub_barrier_1_; + ACE_Sub_Barrier sub_barrier_2_; + ACE_Sub_Barrier *sub_barrier_[2]; + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Barrier &); + ACE_Barrier (const ACE_Barrier &); +}; + +#if 0 +/** + * @class ACE_Process_Barrier + * + * @brief Implements "barrier synchronization" using ACE_Process_Mutexes! + * + * This class is just a simple wrapper for ACE_Barrier that + * selects the USYNC_PROCESS variant for the locks. + */ +class ACE_Export ACE_Process_Barrier : public ACE_Barrier +{ +public: + /// Create a Process_Barrier, passing in the optional @a name. + ACE_Process_Barrier (unsigned int count, const ACE_TCHAR *name = 0); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; +#endif /* 0 */ + +/** + * @class ACE_Thread_Barrier + * + * @brief Implements "barrier synchronization" using ACE_Thread_Mutexes! + * + * This class is just a simple wrapper for ACE_Barrier that + * selects the USYNC_THREAD variant for the locks. + */ +class ACE_Export ACE_Thread_Barrier : public ACE_Barrier +{ +public: + /// Create a Thread_Barrier, passing in the optional @a name. + ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name = 0); + + /// Default dtor. + ~ACE_Thread_Barrier (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Barrier.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* !ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_BARRIER_H */ diff --git a/externals/ace/Barrier.inl b/externals/ace/Barrier.inl new file mode 100644 index 0000000..10430d9 --- /dev/null +++ b/externals/ace/Barrier.inl @@ -0,0 +1,22 @@ +// -*- C++ -*- +// +// $Id: Barrier.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Sub_Barrier::~ACE_Sub_Barrier (void) +{ +} + +ACE_INLINE +ACE_Barrier::~ACE_Barrier (void) +{ +} + +ACE_INLINE +ACE_Thread_Barrier::~ACE_Thread_Barrier (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Base_Thread_Adapter.cpp b/externals/ace/Base_Thread_Adapter.cpp new file mode 100644 index 0000000..eac2c14 --- /dev/null +++ b/externals/ace/Base_Thread_Adapter.cpp @@ -0,0 +1,128 @@ +// $Id: Base_Thread_Adapter.cpp 84340 2009-02-05 22:28:08Z stallions $ + +#include "ace/Base_Thread_Adapter.h" + +ACE_RCSID (ace, + Base_Thread_Adapter, + "$Id: Base_Thread_Adapter.cpp 84340 2009-02-05 22:28:08Z stallions $") + +#if !defined (ACE_HAS_INLINED_OSCALLS) +# include "ace/Base_Thread_Adapter.inl" +#endif /* ACE_HAS_INLINED_OSCALLS */ + +#if defined (ACE_HAS_TSS_EMULATION) +# include "ace/OS_NS_Thread.h" +#endif /* ACE_HAS_TSS_EMULATION */ + +#include "ace/Service_Config.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ = 0; +ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = 0; +ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0; +ACE_SYNC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::sync_log_msg_hook_ = 0; +ACE_THR_DESC_LOG_MSG_HOOK ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = 0; + +ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter ( + ACE_THR_FUNC user_func, + void *arg, + ACE_THR_C_FUNC entry_point, + ACE_OS_Thread_Descriptor *td +#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , ACE_SEH_EXCEPT_HANDLER selector + , ACE_SEH_EXCEPT_HANDLER handler +#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + ) + : user_func_ (user_func) + , arg_ (arg) + , entry_point_ (entry_point) + , thr_desc_ (td) + , ctx_ (ACE_Service_Config::current()) +{ + ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter"); + + if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0) + (*ACE_Base_Thread_Adapter::init_log_msg_hook_) ( + this->log_msg_attributes_ +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , selector + , handler +# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + ); +#ifdef ACE_USES_GPROF + getitimer (ITIMER_PROF, &itimer_); +#endif // ACE_USES_GPROF +} + +ACE_Base_Thread_Adapter::~ACE_Base_Thread_Adapter (void) +{ +} + +void +ACE_Base_Thread_Adapter::inherit_log_msg (void) +{ + if (ACE_Base_Thread_Adapter::inherit_log_msg_hook_ != 0) + (*ACE_Base_Thread_Adapter::inherit_log_msg_hook_)( + this->thr_desc_, + this->log_msg_attributes_); + + // Initialize the proper configuration context for the new thread + // Placed here since inherit_log_msg() gets called from any of our + // descendants (before self-destructing) + ACE_Service_Config::current (this->ctx_); +} + +void +ACE_Base_Thread_Adapter::close_log_msg (void) +{ + if (ACE_Base_Thread_Adapter::close_log_msg_hook_ != 0) + (*ACE_Base_Thread_Adapter::close_log_msg_hook_) (); +} + +void +ACE_Base_Thread_Adapter::sync_log_msg (const ACE_TCHAR *prg) +{ + if (ACE_Base_Thread_Adapter::sync_log_msg_hook_ != 0) + (*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg); +} + +ACE_OS_Thread_Descriptor * +ACE_Base_Thread_Adapter::thr_desc_log_msg (void) +{ + if (ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ != 0) + return (*ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_) (); + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +// Run the thread entry point for the . This must +// be an extern "C" to make certain compilers happy... + +extern "C" ACE_THR_FUNC_RETURN +ACE_THREAD_ADAPTER_NAME (void *args) +{ + ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME"); + +#if defined (ACE_HAS_TSS_EMULATION) + // As early as we can in the execution of the new thread, allocate + // its local TS storage. Allocate it on the stack, to save dynamic + // allocation/dealloction. + void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX]; + ACE_TSS_Emulation::tss_open (ts_storage); +#endif /* ACE_HAS_TSS_EMULATION */ + + ACE_Base_Thread_Adapter * const thread_args = + static_cast (args); + +#ifdef ACE_USES_GPROF + setitimer (ITIMER_PROF, thread_args->timerval (), 0); +#endif // ACE_USES_GPROF + + // Invoke the user-supplied function with the args. + ACE_THR_FUNC_RETURN status = thread_args->invoke (); + + return status; +} + diff --git a/externals/ace/Base_Thread_Adapter.h b/externals/ace/Base_Thread_Adapter.h new file mode 100644 index 0000000..b36d18e --- /dev/null +++ b/externals/ace/Base_Thread_Adapter.h @@ -0,0 +1,195 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Base_Thread_Adapter.h + * + * $Id: Base_Thread_Adapter.h 81239 2008-04-04 22:28:48Z iliyan $ + * + * @author Nanbor Wang + */ +//============================================================================= + +#ifndef ACE_BASE_THREAD_ADAPTER_H +#define ACE_BASE_THREAD_ADAPTER_H +#include /**/ "ace/pre.h" + +#include "ace/OS_Log_Msg_Attributes.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/ACE_export.h" +#include "ace/OS_Log_Msg_Attributes.h" + +#ifdef ACE_USES_GPROF +#include "os_include/sys/os_time.h" +#endif // ACE_USES_GPROF + +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter) +#else +# define ACE_THREAD_ADAPTER_NAME ace_thread_adapter +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + +// Run the thread entry point for the ACE_Thread_Adapter. This must +// be an extern "C" to make certain compilers happy... + +extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args); + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_OS_Thread_Descriptor + * + * @brief Parent class of all ACE_Thread_Descriptor classes. + * = + * Container for ACE_Thread_Descriptor members that are + * used in ACE_OS. + */ +class ACE_Export ACE_OS_Thread_Descriptor +{ +public: + /// Get the thread creation flags. + long flags (void) const; + +protected: + /// For use by ACE_Thread_Descriptor. + ACE_OS_Thread_Descriptor (long flags = 0); + + /** + * Keeps track of whether this thread was created "detached" or not. + * If a thread is *not* created detached then if someone calls + * , we need to join with that thread (and + * close down the handle). + */ + long flags_; +}; + + + +class ACE_Service_Gestalt; + + +/** + * @class ACE_Base_Thread_Adapter + * + * @brief Base class for all the Thread_Adapters. + * + * Converts a C++ function into a function that can be + * called from a thread creation routine + * (e.g., pthread_create() or _beginthreadex()) that expects an + * extern "C" entry point. This class also makes it possible to + * transparently provide hooks to register a thread with an + * ACE_Thread_Manager. + * This class is used in ACE_OS::thr_create(). In general, the + * thread that creates an object of this class is different from + * the thread that calls @c invoke() on this object. Therefore, + * the @c invoke() method is responsible for deleting itself. + */ +class ACE_Export ACE_Base_Thread_Adapter +{ +public: + + virtual ~ACE_Base_Thread_Adapter (void); + + /// Virtual method invoked by the thread entry point. + virtual ACE_THR_FUNC_RETURN invoke (void) = 0; + + /// Accessor for the C entry point function to the OS thread creation + /// routine. + ACE_THR_C_FUNC entry_point (void); + +#ifdef ACE_USES_GPROF + /// Accessor to the itimer_ + /// followed http://sam.zoy.org/writings/programming/gprof.html + struct itimerval* timerval (void); +#endif // ACE_USES_PROF + + /// Invoke the close_log_msg_hook, if it is present + static void close_log_msg (void); + + /// Invoke the sync_log_msg_hook, if it is present + static void sync_log_msg (const ACE_TCHAR *prog_name); + + /// Invoke the thr_desc_log_msg_hook, if it is present + static ACE_OS_Thread_Descriptor *thr_desc_log_msg (void); + +protected: + /// Constructor. + ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func, + void *arg, + ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, + ACE_OS_Thread_Descriptor *td = 0 +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , ACE_SEH_EXCEPT_HANDLER selector = 0 + , ACE_SEH_EXCEPT_HANDLER handler = 0 +# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + ); + /// Inherit the logging features if the parent thread has an + /// ACE_Log_Msg. + void inherit_log_msg (void); + +private: + /// The hooks to inherit and cleanup the Log_Msg attributes + static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_; + static ACE_INHERIT_LOG_MSG_HOOK inherit_log_msg_hook_; + static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_; + static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_; + static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_; + + /// Set the Log_Msg hooks + static void set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook, + ACE_INHERIT_LOG_MSG_HOOK inherit_hook, + ACE_CLOSE_LOG_MSG_HOOK close_hook, + ACE_SYNC_LOG_MSG_HOOK sync_hook, + ACE_THR_DESC_LOG_MSG_HOOK thr_desc); + + /// Allow the ACE_Log_Msg class to set its hooks. + friend class ACE_Log_Msg; + +protected: + /// Thread startup function passed in by the user (C++ linkage). + ACE_THR_FUNC user_func_; + + /// Argument to thread startup function. + void *arg_; + + /// Entry point to the underlying OS thread creation call (C + /// linkage). + ACE_THR_C_FUNC entry_point_; + + /** + * Optional thread descriptor. Passing this pointer in will force + * the spawned thread to cache this location in and wait + * until fills in all information in thread + * descriptor. + */ + ACE_OS_Thread_Descriptor *thr_desc_; + + /// The ACE_Log_Msg attributes. + ACE_OS_Log_Msg_Attributes log_msg_attributes_; + + /// That is usefull for gprof, define itimerval +#ifdef ACE_USES_GPROF + struct itimerval itimer_; +#endif // ACE_USES_GPROF + + /// Keep a reference to the configuration context that spawns the + /// thread so the child can inherit it. + ACE_Service_Gestalt * const ctx_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_HAS_INLINED_OSCALLS) +# if defined (ACE_INLINE) +# undef ACE_INLINE +# endif /* ACE_INLINE */ +# define ACE_INLINE inline +# include "ace/Base_Thread_Adapter.inl" +# endif /* ACE_HAS_INLINED_OSCALLS */ + +#include /**/ "ace/post.h" +#endif /* ACE_BASE_THREAD_ADAPTER_H */ diff --git a/externals/ace/Base_Thread_Adapter.inl b/externals/ace/Base_Thread_Adapter.inl new file mode 100644 index 0000000..3bac802 --- /dev/null +++ b/externals/ace/Base_Thread_Adapter.inl @@ -0,0 +1,48 @@ +// -*- C++ -*- +// +// $Id: Base_Thread_Adapter.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE long +ACE_OS_Thread_Descriptor::flags (void) const +{ + return flags_; +} + +ACE_INLINE +ACE_OS_Thread_Descriptor::ACE_OS_Thread_Descriptor (long flags) + : flags_ (flags) +{ +} + +ACE_INLINE void +ACE_Base_Thread_Adapter::set_log_msg_hooks ( + ACE_INIT_LOG_MSG_HOOK init_hook, + ACE_INHERIT_LOG_MSG_HOOK inherit_hook, + ACE_CLOSE_LOG_MSG_HOOK close_hook, + ACE_SYNC_LOG_MSG_HOOK sync_hook, + ACE_THR_DESC_LOG_MSG_HOOK thr_desc_hook) +{ + ACE_Base_Thread_Adapter::init_log_msg_hook_ = init_hook; + ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = inherit_hook; + ACE_Base_Thread_Adapter::close_log_msg_hook_ = close_hook; + ACE_Base_Thread_Adapter::sync_log_msg_hook_ = sync_hook; + ACE_Base_Thread_Adapter::thr_desc_log_msg_hook_ = thr_desc_hook; +} + +ACE_INLINE ACE_THR_C_FUNC +ACE_Base_Thread_Adapter::entry_point (void) +{ + return this->entry_point_; +} + +#ifdef ACE_USES_GPROF +ACE_INLINE itimerval* +ACE_Base_Thread_Adapter::timerval (void) +{ + return &(this->itimer_); +} +#endif // ACE_USES_GPROF + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Based_Pointer_Repository.cpp b/externals/ace/Based_Pointer_Repository.cpp new file mode 100644 index 0000000..4ebe8b8 --- /dev/null +++ b/externals/ace/Based_Pointer_Repository.cpp @@ -0,0 +1,119 @@ +// $Id: Based_Pointer_Repository.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Map_Manager.h" +#include "ace/Based_Pointer_Repository.h" +#include "ace/Guard_T.h" +#include "ace/Null_Mutex.h" +#include "ace/Synch_Traits.h" +#include "ace/RW_Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Based_Pointer_Repository_Rep + * + * @brief Implementation for the ACE_Based_Pointer_Repository. + * + * Every memory pool in ACE binds it's mapping base address and + * the mapped size to this repository every time it maps/remaps a + * new chunk of memory successfully. + */ +class ACE_Based_Pointer_Repository_Rep +{ +public: + // Useful typedefs. + typedef ACE_Map_Manager MAP_MANAGER; + typedef ACE_Map_Iterator MAP_ITERATOR; + typedef ACE_Map_Entry MAP_ENTRY; + + /// Keeps track of the mapping between addresses and their associated + /// values. + MAP_MANAGER addr_map_; + + /// Synchronize concurrent access to the map. + ACE_SYNCH_MUTEX lock_; +}; + +ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository (void) +{ + ACE_TRACE ("ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository"); + ACE_NEW (this->rep_, + ACE_Based_Pointer_Repository_Rep); +} + +ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository (void) +{ + ACE_TRACE ("ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository"); + delete this->rep_; +} + +// Search for appropriate base address in repository + +int +ACE_Based_Pointer_Repository::find (void *addr, void *&base_addr) +{ + ACE_TRACE ("ACE_Based_Pointer_Repository::find"); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); + ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0; + + for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_); + iter.next (ce) != 0; + iter.advance ()) + // Check to see if is within any of the regions. + if (addr >= ce->ext_id_ + && addr < ((char *)ce->ext_id_ + ce->int_id_)) + { + // Assign the base address. + base_addr = ce->ext_id_; + return 1; + } + + // Assume base address 0 (e.g., if new'ed). + base_addr = 0; + return 0; +} + +// Bind a new entry to the repository or update the size of an +// existing entry. + +int +ACE_Based_Pointer_Repository::bind (void *addr, size_t size) +{ + ACE_TRACE ("ACE_Based_Pointer_Repository::bind"); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); + + return this->rep_->addr_map_.rebind (addr, size); +} + +// Unbind a base from the repository. + +int +ACE_Based_Pointer_Repository::unbind (void *addr) +{ + ACE_TRACE ("ACE_Based_Pointer_Repository::unbind"); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1); + ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0; + + // Search for service handlers that requested notification. + + for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_); + iter.next (ce) != 0; + iter.advance ()) + { + // Check to see if is within any of the regions and if + // so, unbind the key from the map. + if (addr >= ce->ext_id_ + && addr < ((char *)ce->ext_id_ + ce->int_id_)) + // Unbind base address. + return this->rep_->addr_map_.unbind (ce->ext_id_); + } + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +template ACE_Singleton * + ACE_Singleton::singleton_; +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Based_Pointer_Repository.h b/externals/ace/Based_Pointer_Repository.h new file mode 100644 index 0000000..d549ce1 --- /dev/null +++ b/externals/ace/Based_Pointer_Repository.h @@ -0,0 +1,94 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Based_Pointer_Repository.h + * + * $Id: Based_Pointer_Repository.h 84837 2009-03-16 13:01:15Z johnnyw $ + * + * @author Dietrich Quehl + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_BASED_POINTER_REPOSITORY_H +#define ACE_BASED_POINTER_REPOSITORY_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Singleton.h" +#include "ace/Synch_Traits.h" +#include "ace/os_include/os_stddef.h" + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decl., using the "Cheshire Cat" technique. +class ACE_Based_Pointer_Repository_Rep; + +/** + * @class ACE_Based_Pointer_Repository + * + * @brief Maps pointers to the base address of the region to which each + * pointer belongs. + */ +class ACE_Export ACE_Based_Pointer_Repository +{ +public: + // = Use ACE_Null_Mutex to allow locking while iterating. + + // = Initialization and termination methods. + ACE_Based_Pointer_Repository (void); + ~ACE_Based_Pointer_Repository (void); + + // = Search structure methods. + /** + * Return the appropriate @a base_addr region that contains @a addr. + * Returns 1 on success and 0 if the @a addr isn't contained in any + * @a base_addr region. + */ + int find (void *addr, + void *&base_addr); + + /// Bind a new entry to the repository or update the size of an + /// existing entry. Returns 0 on success and -1 on failure. + int bind (void *addr, + size_t size); + + /// Unbind from the repository the that @a addr is + /// contained within. + int unbind (void *addr); + +private: + + /// Use the "Cheshire-Cat" technique to hide the implementation in + /// order to avoid circular #include dependencies. + ACE_Based_Pointer_Repository_Rep *rep_; + +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Based_Pointer_Repository &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Based_Pointer_Repository (const ACE_Based_Pointer_Repository &)) +}; + +// ---------------------------------- + +/// Declare a process wide singleton +ACE_SINGLETON_DECLARE (ACE_Singleton, + ACE_Based_Pointer_Repository, + ACE_SYNCH_RW_MUTEX) + +/// Provide a Singleton access point to the based pointer repository. +typedef ACE_Singleton + ACE_BASED_POINTER_REPOSITORY; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_BASED_POINTER_REPOSITORY_H */ diff --git a/externals/ace/Based_Pointer_T.cpp b/externals/ace/Based_Pointer_T.cpp new file mode 100644 index 0000000..b85774d --- /dev/null +++ b/externals/ace/Based_Pointer_T.cpp @@ -0,0 +1,121 @@ +// $Id: Based_Pointer_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_BASED_POINTER_T_CPP +#define ACE_BASED_POINTER_T_CPP + +#include "ace/Based_Pointer_T.h" +#include "ace/Based_Pointer_Repository.h" +#include "ace/Log_Msg.h" + +# define ACE_TRACEX(X) ACE_Trace ____ (ACE_TEXT (X), __LINE__, ACE_TEXT (__FILE__)) + +#if !defined (__ACE_INLINE__) +#include "ace/Based_Pointer_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Based_Pointer::ACE_Based_Pointer (void) +{ + ACE_TRACE ("ACE_Based_Pointer::ACE_Based_Pointer"); +} + +template void +ACE_Based_Pointer_Basic::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Based_Pointer_Basic::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntarget_ = %d\n"), this->target_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("base_offset_ = %d\n"), this->base_offset_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("computed pointer = %x\n"), + (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Based_Pointer::ACE_Based_Pointer (CONCRETE *initial) + : ACE_Based_Pointer_Basic (initial) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); +} + +template +ACE_Based_Pointer::ACE_Based_Pointer (const void* base_addr, int) + : ACE_Based_Pointer_Basic (base_addr, 0) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); +} + +template +ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (void) + : target_ (0), + base_offset_ (0) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); + void *base_addr = 0; + + // Find the base address associated with our pointer. Note + // that it's ok for to return 0, which simply indicates that + // the address is not in memory-mapped virtual address space. + ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, + base_addr); + this->base_offset_ = (char *) this - (char *) base_addr; +} + +template +ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (const void *base_addr, int) + : target_ (0), + base_offset_ (0) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); + this->base_offset_ = (char *) this - (char *) base_addr; +} + +template +ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (CONCRETE *rhs) + : target_ (0), + base_offset_ (0) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); + + if (rhs == 0) + // Store a value of that indicate "NULL" pointer. + this->target_ = -1; + else + { + void *base_addr = 0; + + // Find the base address associated with the pointer. + // Note that it's ok for to return 0, which simply + // indicates that the address is not in memory-mapped virtual + // address space. + ACE_BASED_POINTER_REPOSITORY::instance ()->find (this, + base_addr); + this->base_offset_ = (char *) this - (char *) base_addr; + this->target_ = ((char *) rhs - (char *) base_addr); + } +} + +template +ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic &) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::ACE_Based_Pointer_Basic"); + + ACE_ASSERT (0); // not implemented. +} + +template +ACE_Based_Pointer::ACE_Based_Pointer (const ACE_Based_Pointer &rhs) + : ACE_Based_Pointer_Basic (rhs) +{ + ACE_TRACE ("ACE_Based_Pointer::ACE_Based_Pointer"); + ACE_ASSERT (0); // not implemented. +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_BASED_POINTER_T_CPP */ diff --git a/externals/ace/Based_Pointer_T.h b/externals/ace/Based_Pointer_T.h new file mode 100644 index 0000000..802e73c --- /dev/null +++ b/externals/ace/Based_Pointer_T.h @@ -0,0 +1,205 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Based_Pointer_T.h + * + * $Id: Based_Pointer_T.h 81705 2008-05-15 14:02:02Z johnnyw $ + * + * @author Dietrich Quehl + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_BASED_POINTER_T_H +#define ACE_BASED_POINTER_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/Basic_Types.h" + +#if defined (_MSC_VER) +// Suppress warning e.g. "return type for +// 'ACE_Based_Pointer::operator ->' is 'long *' (i.e., not a UDT +// or reference to a UDT. Will produce errors if applied using infix +// notation)" +#pragma warning(disable: 4284) +#endif /* _MSC_VER */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Based_Pointer_Basic + * + * @brief A proxy that keeps track of the relative offset of a "pointer" + * from its base address. + * This class makes it possible to transparently use "pointers" in + * shared memory as easily as programming with pointers to local + * memory. In particular, we don't need to ensure that the base + * addresses of all the pointers are mapped into separate + * processes at the same absolute memory base address. + */ +template +class ACE_Based_Pointer_Basic +{ +public: + /** + * This constructor initializes the by asking the + * Singleton for the base address of + * the memory region within which it is instantiated. Two results + * are possible: + * + * 1. An has stored a base address/size pair and the + * new based-pointer instance is located between the base address and + * the base address + size - 1. In this case, the repository + * returns the base address. + * + * 2. No suitable address/size pair was found. The repository + * assumes an address in the regular (not mapped) virtual address + * space of the process and returns 0. In this case, the + * based-pointer uses its address as an offset to it's base + * address 0. + */ + ACE_Based_Pointer_Basic (void); + + /** + * Initialize this object using the @a initial pointer. This + * constructor initializes the by asking the + * Singleton for the base address of + * the memory region within which it is instantiated. Three results + * are possible: + * + * 1. An has stored a base address/size pair and the + * new based-pointer instance is located between the base address and + * the base address + size - 1. In this case, the repository + * returns the base address. + * + * 2. No suitable address/size pair was found. The repository + * assumes an address in the regular (not mapped) virtual address + * space of the process and returns 0. In this case, the + * based-pointer uses its address as an offset to its base + * address 0. + * + * 3. If @a initial is 0 then set the value of to -1, which + * indicates a "NULL" pointer. + */ + ACE_Based_Pointer_Basic (CONCRETE *initial); + + /// Copy constructor. + ACE_Based_Pointer_Basic (const ACE_Based_Pointer_Basic &); + + /// Constructor for know base address. @a o is only used to + /// resolve overload ambiguity. + ACE_Based_Pointer_Basic (const void *base_addr, int o); + + /// Pseudo-assignment operator. + void operator = (CONCRETE *from); + + /// Pseudo-assignment operator. + void operator = (const ACE_Based_Pointer_Basic &); + + /// Dereference operator. + CONCRETE operator * (void) const; + + /// Less than operator. + bool operator < (const ACE_Based_Pointer_Basic &) const; + + /// Less than or equal operator. + bool operator <= (const ACE_Based_Pointer_Basic &) const; + + /// Greater than operator. + bool operator > (const ACE_Based_Pointer_Basic &) const; + + /// Greater than or equal operator. + bool operator >= (const ACE_Based_Pointer_Basic &) const; + + /// Equality operator. + bool operator == (const ACE_Based_Pointer_Basic &) const; + + /// Inequality operator. + bool operator != (const ACE_Based_Pointer_Basic &) const; + + /// Subscript operator. + CONCRETE operator [](int index) const; + + /// Increment operator. + void operator+= (int index); + + /// Returns the underlying memory address of the smart pointer. + operator CONCRETE *() const; + + /// Returns the underlying memory address of the smart pointer. + CONCRETE *addr (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /// Dump the state of the object. + void dump (void) const; + +protected: + ptrdiff_t target_; + + /// Keep track of our offset from the base pointer. + ptrdiff_t base_offset_; +}; + +/** + * @class ACE_Based_Pointer + * + * @brief A smart proxy that keeps track of the relative offset of a + * "pointer" from its base address. + * + * This class makes it possible to transparently use "pointers" in + * shared memory as easily as programming with pointers to local + * memory by overloading the C++ delegation operator ->(). + */ +template +class ACE_Based_Pointer : public ACE_Based_Pointer_Basic +{ +public: + // = Initialization method. + /// Constructor. See constructor for ACE_Based_Pointer_Basic for + /// details. + ACE_Based_Pointer (void); + + /// Initialize this object using the pointer. See + /// constructor for ACE_Based_Pointer_Basic for details. + ACE_Based_Pointer (CONCRETE *initial); + + /// Initialize this object with known @a base_addr. @a dummy is + /// a dummy value used to resolve overload ambiguity and it + /// otherwise ignored. + ACE_Based_Pointer (const void *base_addr, int dummy); + + /// Copy constructor (not implemented yet). + ACE_Based_Pointer (const ACE_Based_Pointer &); + + /// Assignment operator. + void operator = (const ACE_Based_Pointer &); + + /// Pseudo-assignment operator. + void operator = (CONCRETE *from); + + /// The C++ "delegation operator". + CONCRETE *operator-> (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Based_Pointer_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Based_Pointer_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Based_Pointer_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_BASED_POINTER_T_H */ diff --git a/externals/ace/Based_Pointer_T.inl b/externals/ace/Based_Pointer_T.inl new file mode 100644 index 0000000..ba6a5aa --- /dev/null +++ b/externals/ace/Based_Pointer_T.inl @@ -0,0 +1,139 @@ +// -*- C++ -*- +// +// $Id: Based_Pointer_T.inl 81705 2008-05-15 14:02:02Z johnnyw $ + +#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_) +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE CONCRETE * +ACE_Based_Pointer::operator->(void) +{ + ACE_TRACE ("ACE_Based_Pointer::operator->"); + return reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); +} + +template ACE_INLINE void +ACE_Based_Pointer_Basic::operator = (CONCRETE *rhs) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator ="); + if (rhs == 0) + // Store a value of that indicate "NULL" pointer. + this->target_ = -1; + else + this->target_ = ((char *) rhs + - ((char *) this - this->base_offset_)); +} + +template ACE_INLINE void +ACE_Based_Pointer::operator = (CONCRETE *rhs) +{ + ACE_TRACE ("ACE_Based_Pointer::operator ="); + if (rhs == 0) + // Store a value of that indicate "NULL" pointer. + this->target_ = -1; + else + this->target_ = ((char *) rhs + - ((char *) this - this->base_offset_)); +} + +template ACE_INLINE CONCRETE +ACE_Based_Pointer_Basic::operator *(void) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator *"); + return *reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); +} + +template ACE_INLINE CONCRETE * +ACE_Based_Pointer_Basic::addr (void) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::addr"); + + if (this->target_ == -1) + return 0; + else + return reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); +} + +template ACE_INLINE +ACE_Based_Pointer_Basic::operator CONCRETE *() const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator CONCRETE *()"); + + return this->addr (); +} + +template ACE_INLINE CONCRETE +ACE_Based_Pointer_Basic::operator [] (int index) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator []"); + CONCRETE *c = + reinterpret_cast (ACE_COMPUTE_BASED_POINTER (this)); + return c[index]; +} + +template ACE_INLINE void +ACE_Based_Pointer_Basic::operator += (int index) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator +="); + this->base_offset_ += (index * sizeof (CONCRETE)); +} + +template ACE_INLINE bool +ACE_Based_Pointer_Basic::operator == (const ACE_Based_Pointer_Basic &rhs) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator =="); + return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs); +} + +template ACE_INLINE bool +ACE_Based_Pointer_Basic::operator != (const ACE_Based_Pointer_Basic &rhs) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator !="); + return !(*this == rhs); +} + +template ACE_INLINE bool +ACE_Based_Pointer_Basic::operator < (const ACE_Based_Pointer_Basic &rhs) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator <"); + return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs); +} + +template ACE_INLINE bool +ACE_Based_Pointer_Basic::operator <= (const ACE_Based_Pointer_Basic &rhs) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator <="); + return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs); +} + +template ACE_INLINE bool +ACE_Based_Pointer_Basic::operator > (const ACE_Based_Pointer_Basic &rhs) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator >"); + return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs); +} + +template ACE_INLINE bool +ACE_Based_Pointer_Basic::operator >= (const ACE_Based_Pointer_Basic &rhs) const +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator >="); + return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs); +} + +template ACE_INLINE void +ACE_Based_Pointer_Basic::operator= (const ACE_Based_Pointer_Basic &rhs) +{ + ACE_TRACE ("ACE_Based_Pointer_Basic::operator="); + *this = rhs.addr (); +} + +template ACE_INLINE void +ACE_Based_Pointer::operator= (const ACE_Based_Pointer &rhs) +{ + ACE_TRACE ("ACE_Based_Pointer::operator="); + *this = rhs.addr (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Basic_Stats.cpp b/externals/ace/Basic_Stats.cpp new file mode 100644 index 0000000..fe67833 --- /dev/null +++ b/externals/ace/Basic_Stats.cpp @@ -0,0 +1,78 @@ +// $Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Basic_Stats.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Basic_Stats.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, + Basic_Stats, + "$Id: Basic_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +void +ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs) +{ + if (rhs.samples_count_ == 0) + return; + + if (this->samples_count_ == 0) + { + this->min_ = rhs.min_; + this->min_at_ = rhs.min_at_; + + this->max_ = rhs.max_; + this->max_at_ = rhs.max_at_; + } + else + { + if (this->min_ > rhs.min_) + { + this->min_ = rhs.min_; + this->min_at_ = rhs.min_at_; + } + if (this->max_ < rhs.max_) + { + this->max_ = rhs.max_; + this->max_at_ = rhs.max_at_; + } + } + + this->samples_count_ += rhs.samples_count_; + this->sum_ += rhs.sum_; +} + +void +ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, ACE_UINT32 sf) const +{ +#ifndef ACE_NLOGGING + if (this->samples_count () == 0u) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s : no data collected\n"), msg)); + return; + } + + ACE_UINT64 avg = this->sum_ / this->samples_count_; + + ACE_UINT64 l_min = this->min_ / sf; + ACE_UINT64 l_max = this->max_ / sf; + ACE_UINT64 l_avg = avg / sf; + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"), + msg, + l_min, this->min_at_, + l_avg, + l_max, this->max_at_)); + +#else + ACE_UNUSED_ARG (msg); + ACE_UNUSED_ARG (sf); +#endif /* ACE_NLOGGING */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Basic_Stats.h b/externals/ace/Basic_Stats.h new file mode 100644 index 0000000..bff1ff2 --- /dev/null +++ b/externals/ace/Basic_Stats.h @@ -0,0 +1,87 @@ + +//============================================================================= +/** + * @file Basic_Stats.h + * + * $Id: Basic_Stats.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ +//============================================================================= + + +#ifndef ACE_BASIC_STATS_H +#define ACE_BASIC_STATS_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/Basic_Types.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/// Collect basic stats about a series of samples +/** + * Compute the average and standard deviation (aka jitter) for an + * arbitrary number of samples, using constant space. + * Normally used for latency statistics. + */ +class ACE_Export ACE_Basic_Stats +{ +public: + /// Constructor + /** + * The number of samples is pre-allocated, and cannot changes once + * the class is initialized. + */ + ACE_Basic_Stats (void); + + /// The number of samples received so far + ACE_UINT32 samples_count (void) const; + + /// Record one sample. + void sample (ACE_UINT64 value); + + /// Update the values to reflect the stats in @a rhs. + void accumulate (const ACE_Basic_Stats &rhs); + + /// Dump all the samples + /** + * Prints out the results, using @a msg as a prefix for each message and + * scaling all the numbers by @a scale_factor. The latter is useful because + * high resolution timer samples are acquired in clock ticks, but often + * presented in microseconds. + */ + void dump_results (const ACE_TCHAR *msg, + ACE_UINT32 scale_factor) const; + + /// The number of samples + ACE_UINT32 samples_count_; + + /// The minimum value + ACE_UINT64 min_; + + /// The number of the sample that had the minimum value + ACE_UINT32 min_at_; + + /// The maximum value + ACE_UINT64 max_; + + /// The number of the sample that had the maximum value + ACE_UINT32 max_at_; + + /// The sum of all the values + ACE_UINT64 sum_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Basic_Stats.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_BASIC_STATS_H */ diff --git a/externals/ace/Basic_Stats.inl b/externals/ace/Basic_Stats.inl new file mode 100644 index 0000000..e2f1538 --- /dev/null +++ b/externals/ace/Basic_Stats.inl @@ -0,0 +1,53 @@ +// -*- C++ -*- +// +// $Id: Basic_Stats.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Basic_Stats::ACE_Basic_Stats (void) + : samples_count_ (0) + , min_ (0) + , min_at_ (0) + , max_ (0) + , max_at_ (0) + , sum_ (0) +{ +} + +ACE_INLINE ACE_UINT32 +ACE_Basic_Stats::samples_count (void) const +{ + return this->samples_count_; +} + +ACE_INLINE void +ACE_Basic_Stats::sample (ACE_UINT64 value) +{ + ++this->samples_count_; + + if (this->samples_count_ == 1u) + { + this->min_ = value; + this->min_at_ = this->samples_count_; + this->max_ = value; + this->max_at_ = this->samples_count_; + } + else + { + if (this->min_ > value) + { + this->min_ = value; + this->min_at_ = this->samples_count_; + } + if (this->max_ < value) + { + this->max_ = value; + this->max_at_ = this->samples_count_; + } + } + + this->sum_ += value; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Basic_Types.cpp b/externals/ace/Basic_Types.cpp new file mode 100644 index 0000000..42ae83c --- /dev/null +++ b/externals/ace/Basic_Types.cpp @@ -0,0 +1,139 @@ +#include "ace/Basic_Types.h" + +#if !defined (__ACE_INLINE__) +# include "ace/Basic_Types.inl" +#endif /* ! __ACE_INLINE__ */ + + +ACE_RCSID (ace, + Basic_Types, + "$Id: Basic_Types.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +#if defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +# include "ace/Log_Msg.h" +# include "ace/OS_NS_stdio.h" +# include "ace/OS_NS_string.h" +# if !defined (ACE_LACKS_IOSTREAM_TOTALLY) +// FUZZ: disable check_for_streams_include +# include "ace/streams.h" +# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +void +ACE_U_LongLong::output (FILE *file) const +{ + if (h_ () > 0) + ACE_OS::fprintf (file, "0x%lx%0*lx", h_ (), 2 * sizeof l_ (), l_ ()); + else + ACE_OS::fprintf (file, "0x%lx", l_ ()); +} + + +ACE_TCHAR * +ACE_U_LongLong::as_string (ACE_TCHAR *output, + unsigned int base, + unsigned int uppercase) const +{ + if (*this == 0) + { + ACE_OS::strcpy(output, "0"); + } + else + { + switch(base) + { + case 8: + { + unsigned int index = 0; + int bshift = 31; + while(bshift >= 1) + { + unsigned int sval = (this->h_ () >> bshift) & 7; + if (sval > 0 || index != 0) + { + output[index] = sval + '0'; + ++index; + } + bshift -= 3; + } + bshift = 30; + while(bshift >= 0) + { + unsigned int sval = (this->l_ () >> bshift) & 7; + // Combine the last bit of hi with the first 3-bit digit + if (bshift == 30) + { + sval |= (this->h_ () & 1) << 2; + } + if (sval > 0 || index != 0) + { + output[index] = sval + '0'; + ++index; + } + bshift -= 3; + } + output[index] = '\0'; + break; + } + case 10: + { + ACE_OS::sprintf(output, "%.0f", *this / 1.0); + break; + } + case 16: + { + if (this->h_ () != 0) + { + ACE_OS::sprintf(output, + (uppercase ? "%lX%0*lX" : "%lx%0*lx"), + this->h_ (), 2 * sizeof this->l_ (), + this->l_ ()); + } + else + { + ACE_OS::sprintf(output, + (uppercase ? "%lX" : "%lx"), this->l_ ()); + + } + break; + } + default: + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Unsupported base = %u\n"), base)); + output[0] = '\0'; + } + } + } + + return output; +} + + +# if !defined (ACE_LACKS_IOSTREAM_TOTALLY) +ostream& +operator<< (ostream& os, const ACE_U_LongLong& ll) +{ +#ifdef __TANDEM && (__CPLUSPLUS_VERSION >= 3) + unsigned long flags = os.flags(); +#else + unsigned long flags = os.setf(0); +#endif + char buffer[32]; + + if ((flags & ios::oct) != 0) + os << ll.as_string (buffer, 8); + else if ((flags & ios::hex) != 0) + os << ll.as_string (buffer, 16, (flags & ios::uppercase)); + else + os << ll.as_string (buffer); + return os; +} +# endif + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_LACKS_LONGLONG_T */ + diff --git a/externals/ace/Basic_Types.h b/externals/ace/Basic_Types.h new file mode 100644 index 0000000..a4f819a --- /dev/null +++ b/externals/ace/Basic_Types.h @@ -0,0 +1,962 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Basic_Types.h + * + * $Id: Basic_Types.h 87392 2009-11-07 09:32:06Z johnnyw $ + * + * @author David L. Levine + * + * #defines the list of preprocessor macros below. The config.h file can + * pre-define any of these to short-cut the definitions. This is usually + * only necessary if the preprocessor does all of its math using integers. + * + * Sizes of built-in types: + * - ACE_SIZEOF_CHAR + * - ACE_SIZEOF_WCHAR + * - ACE_SIZEOF_SHORT + * - ACE_SIZEOF_INT + * - ACE_SIZEOF_LONG + * - ACE_SIZEOF_LONG_LONG + * - ACE_SIZEOF_VOID_P + * - ACE_SIZEOF_FLOAT + * - ACE_SIZEOF_DOUBLE + * - ACE_SIZEOF_LONG_DOUBLE + * + * Wrappers for built-in types of specific sizes: + * - ACE_USHORT16 (For backward compatibility. Use ACE_UINT16 instead.) + * - ACE_INT8 + * - ACE_UINT8 + * - ACE_INT16 + * - ACE_UINT16 + * - ACE_INT32 + * - ACE_UINT32 + * - ACE_UINT64 + * (@note ACE_INT64 is partly defined, there is no ACE_LongLong for + * platforms that don't have a native 8-byte integer type.) + * + * Byte-order (endian-ness) determination: + * ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN + * + * + */ +//============================================================================= + +#include "ace/config-lite.h" + +#ifndef ACE_BASIC_TYPES_H +# define ACE_BASIC_TYPES_H + +# include /**/ "ace/pre.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Pull in definitions +# include "ace/os_include/os_limits.h" // Integer limits +# include "ace/os_include/os_float.h" // Floating point limits +# include "ace/os_include/os_stdlib.h" // Other types +# include "ace/os_include/os_stddef.h" // Get ptrdiff_t - see further comments below + +# if defined(ACE_LACKS_LONGLONG_T) +# include "ace/os_include/os_stdio.h" // For long long emulation +# endif /* ACE_LACKS_LONGLONG_T */ + +# include "ace/os_include/sys/os_types.h" + +# if !defined (ACE_LACKS_SYS_PARAM_H) +# include /**/ +# endif /* ACE_LACKS_SYS_PARAM_H */ + +# include "ace/ACE_export.h" + +# if !defined (ACE_LACKS_STDINT_H) +# include +# endif +# if !defined (ACE_LACKS_INTTYPES_H) +# include +# endif + +#ifdef ACE_LACKS_INTPTR_T +# include "ace/If_Then_Else.h" + +// This intptr_t typedef is here instead of +// since it depends on the template +// metaprogramming in . + +// We could compare ACE_SIZEOF_VOID_P against ACE_SIZEOF_LONG, etc. +// However, that depends on the ACE preprocessor symbol definitions in +// the platform-specific configuration header being correct. +// The template meta-programming approach we take below, +// i.e. determining the type at compile-time rather than at +// preprocessing-time, will work for all platforms, and does not +// depend on ACE developer-defined configuration parameters. + +typedef ACE::If_Then_Else< + (sizeof (void*) == sizeof (signed int)), + signed int, + ACE::If_Then_Else< + (sizeof (void*) == sizeof (signed long)), + signed long, +#ifdef ACE_LACKS_LONGLONG_T + void /* Unknown. Force an invalid type */ +#else + ACE::If_Then_Else< + (sizeof (void*) == sizeof (signed long long)), + signed long long, + void /* Unknown. Force an invalid type */ + >::result_type +#endif /* ACE_LACKS_LONGLONG_T */ + >::result_type + >::result_type intptr_t; + +typedef ACE::If_Then_Else< + (sizeof (void*) == sizeof (unsigned int)), + unsigned int, + ACE::If_Then_Else< + (sizeof (void*) == sizeof (unsigned long)), + unsigned long, +#ifdef ACE_LACKS_UNSIGNEDLONGLONG_T + void /* Unknown. Force an invalid type */ +#else + ACE::If_Then_Else< + (sizeof (void*) == sizeof (unsigned long long)), + unsigned long long, + void /* Unknown. Force an invalid type */ + >::result_type +#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */ + >::result_type + >::result_type uintptr_t; + +#endif /* ACE_LACKS_INTPTR_T */ + +// A char always has 1 byte, by definition. +# define ACE_SIZEOF_CHAR 1 + +// Unfortunately, there isn't a portable way to determine the size of a wchar. +// So we just define them on a platform basis. If the platform doesn't +// define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code +// uses ACE_SIZEOF_WCHAR in preprocessor statements, so sizeof() isn't valid. +// If the platform config doesn't set this, and this guess is wrong, +// Basic_Types_Test should catch the inconsistency. +# if defined (ACE_HAS_WCHAR) +# if !defined (ACE_SIZEOF_WCHAR) +# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) +# define ACE_SIZEOF_WCHAR 4 +# else +// 0 so the Basic_Types test will catch this. +# define ACE_SIZEOF_WCHAR 0 +# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ +# endif /* !ACE_SIZEOF_WCHAR */ +# endif /* ACE_HAS_WCHAR */ + +// The number of bytes in a short. +# if !defined (ACE_SIZEOF_SHORT) +# if (USHRT_MAX) == 255U +# define ACE_SIZEOF_SHORT 1 +# elif (USHRT_MAX) == 65535U +# define ACE_SIZEOF_SHORT 2 +# elif (USHRT_MAX) == 4294967295U +# define ACE_SIZEOF_SHORT 4 +# elif (USHRT_MAX) == 18446744073709551615U +# define ACE_SIZEOF_SHORT 8 +# else +# error: unsupported short size, must be updated for this platform! +# endif /* USHRT_MAX */ +# endif /* !defined (ACE_SIZEOF_SHORT) */ + +// The number of bytes in an int. +# if !defined (ACE_SIZEOF_INT) +# if (UINT_MAX) == 65535U +# define ACE_SIZEOF_INT 2 +# elif (UINT_MAX) == 4294967295U +# define ACE_SIZEOF_INT 4 +# elif (UINT_MAX) == 18446744073709551615U +# define ACE_SIZEOF_INT 8 +# else +# error: unsupported int size, must be updated for this platform! +# endif /* UINT_MAX */ +# endif /* !defined (ACE_SIZEOF_INT) */ + +// The number of bytes in a long. +# if !defined (ACE_SIZEOF_LONG) +# if (ULONG_MAX) == 65535UL +# define ACE_SIZEOF_LONG 2 +# elif ((ULONG_MAX) == 4294967295UL) +# define ACE_SIZEOF_LONG 4 +# elif ((ULONG_MAX) == 18446744073709551615UL) +# define ACE_SIZEOF_LONG 8 +# else +# error: unsupported long size, must be updated for this platform! +# endif /* ULONG_MAX */ +# endif /* !defined (ACE_SIZEOF_LONG) */ + +// The number of bytes in a long long. +# if !defined (ACE_SIZEOF_LONG_LONG) +# if defined (ACE_LACKS_LONGLONG_T) +# define ACE_SIZEOF_LONG_LONG 8 +# elif defined (ULLONG_MAX) +# if ((ULLONG_MAX) == 4294967295ULL) +# define ACE_SIZEOF_LONG_LONG 4 +# elif ((ULLONG_MAX) == 18446744073709551615ULL) +# define ACE_SIZEOF_LONG_LONG 8 +# endif +# elif defined (ULONGLONG_MAX) +# if ((ULONGLONG_MAX) == 4294967295ULL) +# define ACE_SIZEOF_LONG_LONG 4 +# elif ((ULONGLONG_MAX) == 18446744073709551615ULL) +# define ACE_SIZEOF_LONG_LONG 8 +# endif +# endif +# // If we can't determine the size of long long, assume it is 8 +# // instead of erroring out. (Either ULLONG_MAX and ULONGLONG_MAX +# // may not be supported; or an extended C/C++ dialect may need to +# // be selected. If this assumption is wrong, it can be addressed +# // in the platform-specific config header. +# if !defined (ACE_SIZEOF_LONG_LONG) +# define ACE_SIZEOF_LONG_LONG 8 +# endif +# endif /* !defined (ACE_SIZEOF_LONG_LONG) */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The sizes of the commonly implemented types are now known. Set up +// typedefs for whatever we can. Some of these are needed for certain +// cases of ACE_UINT64, so do them before the 64-bit stuff. + +#if defined (ACE_INT8_TYPE) + typedef ACE_INT8_TYPE ACE_INT8; +#elif defined (ACE_HAS_INT8_T) + typedef int8_t ACE_INT8; +#elif !defined (ACE_LACKS_SIGNED_CHAR) + typedef signed char ACE_INT8; +#else + typedef char ACE_INT8; +#endif /* defined (ACE_INT8_TYPE) */ + +#if defined (ACE_UINT8_TYPE) + typedef ACE_UINT8_TYPE ACE_UINT8; +#elif defined (ACE_HAS_UINT8_T) + typedef uint8_t ACE_UINT8; +#else + typedef unsigned char ACE_UINT8; +#endif /* defined (ACE_UINT8_TYPE) */ + +#if defined (ACE_INT16_TYPE) + typedef ACE_INT16_TYPE ACE_INT16; +#elif defined (ACE_HAS_INT16_T) + typedef int16_t ACE_INT16; +#elif ACE_SIZEOF_SHORT == 2 + typedef short ACE_INT16; +#elif ACE_SIZEOF_INT == 2 + typedef int ACE_INT16; +#else +# error Have to add to the ACE_INT16 type setting +#endif /* defined (ACE_INT16_TYPE) */ + +#if defined (ACE_UINT16_TYPE) + typedef ACE_UINT16_TYPE ACE_UINT16; +#elif defined (ACE_HAS_UINT16_T) + typedef uint16_t ACE_UINT16; +#elif ACE_SIZEOF_SHORT == 2 + typedef unsigned short ACE_UINT16; +#elif ACE_SIZEOF_INT == 2 + typedef unsigned int ACE_UINT16; +#else +# error Have to add to the ACE_UINT16 type setting +#endif /* defined (ACE_UINT16_TYPE) */ + +#if defined (ACE_INT32_TYPE) + typedef ACE_INT32_TYPE ACE_INT32; +#elif defined (ACE_HAS_INT32_T) + typedef int32_t ACE_INT32; +#elif ACE_SIZEOF_INT == 4 + typedef int ACE_INT32; +#elif ACE_SIZEOF_LONG == 4 + typedef long ACE_INT32; +#else +# error Have to add to the ACE_INT32 type setting +#endif /* defined (ACE_INT32_TYPE) */ + +#if defined (ACE_UINT32_TYPE) + typedef ACE_UINT32_TYPE ACE_UINT32; +#elif defined (ACE_HAS_UINT32_T) + typedef uint32_t ACE_UINT32; +#elif ACE_SIZEOF_INT == 4 + typedef unsigned int ACE_UINT32; +#elif ACE_SIZEOF_LONG == 4 + typedef unsigned long ACE_UINT32; +#else +# error Have to add to the ACE_UINT32 type setting +#endif /* defined (ACE_UINT32_TYPE) */ + +#if defined (ACE_INT64_TYPE) + typedef ACE_INT64_TYPE ACE_INT64; +#elif defined (ACE_HAS_INT64_T) + typedef int64_t ACE_INT64; +#elif ACE_SIZEOF_LONG == 8 + typedef long ACE_INT64; +#elif !defined (ACE_LACKS_LONGLONG_T) && ACE_SIZEOF_LONG_LONG == 8 +# ifdef __GNUC__ + // Silence g++ "-pedantic" warnings regarding use of "long long" + // type. + __extension__ +# endif /* __GNUC__ */ + typedef long long ACE_INT64; +#endif /* defined (ACE_INT64_TYPE) */ + +#if !(defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)) +/* See matching #if around ACE_U_LongLong class declaration below */ + +# if defined (ACE_UINT64_TYPE) + typedef ACE_UINT64_TYPE ACE_UINT64; +# elif defined (ACE_HAS_UINT64_T) + typedef uint64_t ACE_UINT64; +# elif ACE_SIZEOF_LONG == 8 + typedef unsigned long ACE_UINT64; +# elif ACE_SIZEOF_LONG_LONG == 8 +# ifdef __GNUC__ + // Silence g++ "-pedantic" warnings regarding use of "long long" + // type. + __extension__ +# endif /* __GNUC__ */ + typedef unsigned long long ACE_UINT64; +# endif /* defined (ACE_UINT64_TYPE) */ +#endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */ + + +typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility. + +// Define a generic byte for use in codecs +typedef unsigned char ACE_Byte; + +// Define a pseudo wide character type when wchar is not supported so we +// can support basic wide character string operations. + +# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) +# define ACE_WINT_T wint_t +# define ACE_WCHAR_T wchar_t +# else +# define ACE_WINT_T ACE_UINT16 +# define ACE_WCHAR_T ACE_UINT16 +# endif /* ACE_HAS_WCHAR */ + +// The number of bytes in a void *. +# ifndef ACE_SIZEOF_VOID_P +# define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG +# endif /* ACE_SIZEOF_VOID_P */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +// Byte-order (endian-ness) determination. +# if defined (BYTE_ORDER) +# if (BYTE_ORDER == LITTLE_ENDIAN) +# define ACE_LITTLE_ENDIAN 0x0123 +# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN +# elif (BYTE_ORDER == BIG_ENDIAN) +# define ACE_BIG_ENDIAN 0x3210 +# define ACE_BYTE_ORDER ACE_BIG_ENDIAN +# else +# error: unknown BYTE_ORDER! +# endif /* BYTE_ORDER */ +# elif defined (_BYTE_ORDER) +# if (_BYTE_ORDER == _LITTLE_ENDIAN) +# define ACE_LITTLE_ENDIAN 0x0123 +# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN +# elif (_BYTE_ORDER == _BIG_ENDIAN) +# define ACE_BIG_ENDIAN 0x3210 +# define ACE_BYTE_ORDER ACE_BIG_ENDIAN +# else +# error: unknown _BYTE_ORDER! +# endif /* _BYTE_ORDER */ +# elif defined (__BYTE_ORDER) +# if (__BYTE_ORDER == __LITTLE_ENDIAN) +# define ACE_LITTLE_ENDIAN 0x0123 +# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN +# elif (__BYTE_ORDER == __BIG_ENDIAN) +# define ACE_BIG_ENDIAN 0x3210 +# define ACE_BYTE_ORDER ACE_BIG_ENDIAN +# else +# error: unknown __BYTE_ORDER! +# endif /* __BYTE_ORDER */ +# else /* ! BYTE_ORDER && ! __BYTE_ORDER */ + // We weren't explicitly told, so we have to figure it out . . . + // Note that Itanium hardware (IA64) can run in either byte order. It's + // selected by the OS when loading; Windows runs little, HP-UX runs big. +# if defined (i386) || defined (__i386__) || defined (_M_IX86) || \ + defined (vax) || defined (__alpha) || defined (__LITTLE_ENDIAN__) || \ + defined (ARM) || defined (_M_IA64) || defined (_M_AMD64) || \ + defined (__amd64) || \ + ((defined (__ia64__) || defined (__ia64)) && !defined (__hpux)) + // We know these are little endian. +# define ACE_LITTLE_ENDIAN 0x0123 +# define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN +# else + // Otherwise, we assume big endian. +# define ACE_BIG_ENDIAN 0x3210 +# define ACE_BYTE_ORDER ACE_BIG_ENDIAN +# endif +# endif /* ! BYTE_ORDER && ! __BYTE_ORDER */ + +// Byte swapping macros to deal with differences between little endian +// and big endian machines. Note that "long" here refers to 32 bit +// quantities. +# define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \ + | ACE_SWAP_WORD(((L) >> 16) & 0xFFFF)) +# define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8)) + +# if defined (ACE_LITTLE_ENDIAN) +# define ACE_HTONL(X) ACE_SWAP_LONG (X) +# define ACE_NTOHL(X) ACE_SWAP_LONG (X) +# define ACE_IDL_NCTOHL(X) (X) +# define ACE_IDL_NSTOHL(X) (X) +# else +# define ACE_HTONL(X) X +# define ACE_NTOHL(X) X +# define ACE_IDL_NCTOHL(X) (X << 24) +# define ACE_IDL_NSTOHL(X) ((X) << 16) +# endif /* ACE_LITTLE_ENDIAN */ + +# if defined (ACE_LITTLE_ENDIAN) +# define ACE_HTONS(x) ACE_SWAP_WORD(x) +# define ACE_NTOHS(x) ACE_SWAP_WORD(x) +# else +# define ACE_HTONS(x) x +# define ACE_NTOHS(x) x +# endif /* ACE_LITTLE_ENDIAN */ + +#if defined (ACE_LACKS_LONGLONG_T) + // This throws away the high 32 bits. It's very unlikely that a + // pointer will be more than 32 bits wide if the platform does not + // support 64-bit integers. +# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ + reinterpret_cast (L.lo ()) +#elif defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64)) +# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ + reinterpret_cast (static_cast (L)) +#else /* ! ACE_LACKS_LONGLONG_T */ +# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ + reinterpret_cast (static_cast (L)) +#endif /* ! ACE_LACKS_LONGLONG_T */ + +// If the platform lacks an unsigned long long, define one. +#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +// Forward declaration for streams +# include "ace/iosfwd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_U_LongLong + * + * @brief Unsigned long long for platforms that don't have one. + * + * Provide our own unsigned long long. This is intended to be + * use with ACE_High_Res_Timer, so the division operator assumes + * that the quotient fits into a u_long. + * Please note that the constructor takes (optionally) two values. + * The high one contributes 0x100000000 times its value. So, + * for example, (0, 2) is _not_ 20000000000, but instead + * 0x200000000. To emphasize this, the default values are expressed + * in hex, and output () dumps the value in hex. + */ + class ACE_Export ACE_U_LongLong + { + public: + // = Initialization and termination methods. +#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + ACE_U_LongLong (const long long value = 0x0); +#else + ACE_U_LongLong (const ACE_UINT32 lo = 0x0, const ACE_UINT32 hi = 0x0); +#endif + ACE_U_LongLong (const ACE_U_LongLong &); + ACE_U_LongLong &operator= (const ACE_U_LongLong &); + ACE_U_LongLong &operator= (const ACE_INT32 &); + ACE_U_LongLong &operator= (const ACE_UINT32 &); + ~ACE_U_LongLong (void); + + // = Overloaded relation operators. + bool operator== (const ACE_U_LongLong &) const; + bool operator== (const ACE_UINT32) const; + bool operator!= (const ACE_U_LongLong &) const; + bool operator!= (const ACE_UINT32) const; + bool operator< (const ACE_U_LongLong &) const; + bool operator< (const ACE_UINT32) const; + bool operator<= (const ACE_U_LongLong &) const; + bool operator<= (const ACE_UINT32) const; + bool operator> (const ACE_U_LongLong &) const; + bool operator> (const ACE_UINT32) const; + bool operator>= (const ACE_U_LongLong &) const; + bool operator>= (const ACE_UINT32) const; + + ACE_U_LongLong operator+ (const ACE_U_LongLong &) const; + ACE_U_LongLong operator+ (const ACE_UINT32) const; + ACE_U_LongLong operator- (const ACE_U_LongLong &) const; + ACE_U_LongLong operator- (const ACE_UINT32) const; + ACE_U_LongLong operator* (const ACE_UINT32) const; + ACE_U_LongLong &operator*= (const ACE_UINT32); + + ACE_U_LongLong operator<< (const unsigned int) const; + ACE_U_LongLong &operator<<= (const unsigned int); + ACE_U_LongLong operator>> (const unsigned int) const; + ACE_U_LongLong &operator>>= (const unsigned int); + + double operator/ (const double) const; + + ACE_U_LongLong &operator+= (const ACE_U_LongLong &); + ACE_U_LongLong &operator+= (const ACE_UINT32); + ACE_U_LongLong &operator-= (const ACE_U_LongLong &); + ACE_U_LongLong &operator-= (const ACE_UINT32); + ACE_U_LongLong &operator++ (); + ACE_U_LongLong &operator-- (); + const ACE_U_LongLong operator++ (int); + const ACE_U_LongLong operator-- (int); + ACE_U_LongLong &operator|= (const ACE_U_LongLong); + ACE_U_LongLong &operator|= (const ACE_UINT32); + ACE_U_LongLong &operator&= (const ACE_U_LongLong); + ACE_U_LongLong &operator&= (const ACE_UINT32); + + // Note that the following take ACE_UINT32 arguments. These are + // typical use cases, and easy to implement. But, they limit the + // return values to 32 bits as well. There are no checks for + // overflow. + ACE_UINT32 operator/ (const ACE_UINT32) const; + ACE_UINT32 operator% (const ACE_UINT32) const; + + // The following only operate on the lower 32 bits (they take only + // 32 bit arguments). + ACE_UINT32 operator| (const ACE_INT32) const; + ACE_UINT32 operator& (const ACE_INT32) const; + + // The following operators convert their arguments to + // ACE_UINT32. So, there may be information loss if they are + // used. + ACE_U_LongLong operator* (const ACE_INT32) const; + ACE_U_LongLong &operator*= (const ACE_INT32); + ACE_UINT32 operator/ (const ACE_INT32) const; +# if ACE_SIZEOF_INT == 4 + ACE_UINT32 operator/ (const unsigned long) const; + ACE_UINT32 operator/ (const long) const; +# else /* ACE_SIZEOF_INT != 4 */ + ACE_UINT32 operator/ (const unsigned int) const; + ACE_UINT32 operator/ (const int) const; +# endif /* ACE_SIZEOF_INT != 4 */ + + // = Helper methods. + /// Outputs the value to the FILE, in hex. + void output (FILE * = stdout) const; + + ACE_TCHAR *as_string (ACE_TCHAR *string, + unsigned int base = 10, + unsigned int uppercase = 0) const; + + ACE_UINT32 hi (void) const; + ACE_UINT32 lo (void) const; + + void hi (const ACE_UINT32 hi); + void lo (const ACE_UINT32 lo); + +#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + long long to_int64 (void) const; +# endif + + private: + +#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + long long data_; +#else + public: + struct ace_hi_lo_correct_endian + { +# if defined (ACE_BIG_ENDIAN) + /// High 32 bits. + ACE_UINT32 hi_; + /// Low 32 bits. + ACE_UINT32 lo_; + +# else + + /// Low 32 bits. + ACE_UINT32 lo_; + /// High 32 bits. + ACE_UINT32 hi_; +# endif /* ! ACE_BIG_ENDIAN */ + }; + private: + union + { + struct ace_hi_lo_correct_endian data_; + + /// To ensure alignment on 8-byte boundary. + double for_alignment_; + }; + + // @note the following four accessors are inlined here in + // order to minimize the extent of the data_ struct. It's + // only used here; the .i and .cpp files use the accessors. + + /// Internal utility function to hide access through struct. + const ACE_UINT32 &h_ () const { return data_.hi_; } + + /// Internal utility function to hide access through struct. + ACE_UINT32 &h_ () { return data_.hi_; } + + /// Internal utility function to hide access through struct. + const ACE_UINT32 &l_ () const { return data_.lo_; } + + /// Internal utility function to hide access through struct. + ACE_UINT32 &l_ () { return data_.lo_; } + + // @note the above four accessors are inlined here in + // order to minimize the extent of the data_ struct. It's + // only used here; the .inl and .cpp files use the accessors. + + /// These functions are used to implement multiplication. + ACE_UINT32 ul_shift (ACE_UINT32 a, + ACE_UINT32 c_in, + ACE_UINT32 *c_out) const; + ACE_U_LongLong ull_shift (ACE_U_LongLong a, + ACE_UINT32 c_in, + ACE_UINT32 *c_out) const; + ACE_U_LongLong ull_add (ACE_U_LongLong a, + ACE_U_LongLong b, + ACE_UINT32 *carry) const; + ACE_U_LongLong ull_mult (ACE_U_LongLong a, + ACE_UINT32 b, + ACE_UINT32 *carry) const; +#endif // ACE_LACKS_UNSIGNEDLONGLONG_T + }; + + typedef ACE_U_LongLong ACE_UINT64; + +#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) + ostream &operator<< (ostream &, const ACE_U_LongLong &); +#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +# endif /* ACE_LACKS_LONGLONG_T */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Conversions from ACE_UINT64 to ACE_UINT32. ACE_CU64_TO_CU32 should +// be used on const ACE_UINT64's. +# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +inline ACE_UINT32 +ACE_U64_TO_U32 (ACE_U_LongLong const & n) +{ + /** + * @note We could add a cast operator to ACE_U_LongLong but that may + * cause more problems than it solves. Force users to perform + * an explicit cast via ACE_{C}U64_TO_{C}U32. + */ + return n.lo (); +} + +inline ACE_UINT32 +ACE_CU64_TO_CU32 (ACE_U_LongLong const & n) +{ + return ACE_U64_TO_U32 (n); +} +# else /* ! ACE_LACKS_LONGLONG_T */ +inline ACE_UINT32 +ACE_U64_TO_U32 (ACE_UINT64 n) +{ + return static_cast (n); +} + +inline ACE_UINT32 +ACE_CU64_TO_CU32 (ACE_UINT64 n) +{ + return static_cast (n); +} +# endif /* ! ACE_LACKS_LONGLONG_T */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +// 64-bit literals require special marking on some platforms. +# if defined (ACE_LACKS_LONGLONG_T) + // Can only specify 32-bit arguments. +# define ACE_UINT64_LITERAL(n) n ## UL + // This one won't really work, but it'll keep + // some compilers happy until we have better support +# define ACE_INT64_LITERAL(n) n ## L +# elif defined (ACE_WIN32) +# if defined (__MINGW32__) +# define ACE_UINT64_LITERAL(n) n ## ull +# define ACE_INT64_LITERAL(n) n ## ll +# else +# define ACE_UINT64_LITERAL(n) n ## ui64 +# define ACE_INT64_LITERAL(n) n ## i64 +# endif /* defined (__MINGW32__) */ +# elif defined (__TANDEM) +# define ACE_UINT64_LITERAL(n) n ## LL +# define ACE_INT64_LITERAL(n) n ## LL +# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ +# define ACE_UINT64_LITERAL(n) n ## ull +# define ACE_INT64_LITERAL(n) n ## ll +# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ + +#if !defined (ACE_INT8_FORMAT_SPECIFIER_ASCII) +# if defined (PRId8) +# define ACE_INT8_FORMAT_SPECIFIER_ASCII "%" PRId8 +# else +# define ACE_INT8_FORMAT_SPECIFIER_ASCII "%d" +# endif /* defined (PRId8) */ +#endif /* ACE_INT8_FORMAT_SPECIFIER_ASCII */ + +#if !defined (ACE_INT8_FORMAT_SPECIFIER) +# if defined (PRId8) +# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId8) +# else +# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT (ACE_INT8_FORMAT_SPECIFIER) +# endif /* defined (PRId8) */ +#endif /* ACE_INT8_FORMAT_SPECIFIER */ + +#if !defined (ACE_UINT8_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu8) +# define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%" PRIu8 +# else +# define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%u" +# endif /* defined (PRIu8) */ +#endif /* ACE_UINT8_FORMAT_SPECIFIER */ + +#if !defined (ACE_UINT8_FORMAT_SPECIFIER) +# if defined (PRIu8) +# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu8) +# else +# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT8_FORMAT_SPECIFIER_ASCII) +# endif /* defined (PRIu8) */ +#endif /* ACE_UINT8_FORMAT_SPECIFIER */ + +#if !defined (ACE_INT16_FORMAT_SPECIFIER_ASCII) +# if defined (PRId16) +# define ACE_INT16_FORMAT_SPECIFIER_ASCII "%" PRId16 +# else +# define ACE_INT16_FORMAT_SPECIFIER_ASCII "%d" +# endif /* defined (PRId16) */ +#endif /* ACE_INT16_FORMAT_SPECIFIER */ + +#if !defined (ACE_INT16_FORMAT_SPECIFIER) +# if defined (PRId16) +# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId16) +# else +# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT (ACE_INT16_FORMAT_SPECIFIER_ASCII) +# endif /* defined (PRId16) */ +#endif /* ACE_INT16_FORMAT_SPECIFIER */ + +#if !defined (ACE_UINT16_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu16) +# define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%" PRIu16 +# else +# define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%u" +# endif /* defined (PRIu16) */ +#endif /* ACE_UINT16_FORMAT_SPECIFIER */ + +#if !defined (ACE_UINT16_FORMAT_SPECIFIER) +# if defined (PRIu16) +# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu16) +# else +# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT16_FORMAT_SPECIFIER_ASCII) +# endif /* defined (PRIu16) */ +#endif /* ACE_UINT16_FORMAT_SPECIFIER */ + +#if !defined (ACE_INT32_FORMAT_SPECIFIER_ASCII) +# if defined (PRId32) +# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%" PRId32 +# elif ACE_SIZEOF_INT == 4 +# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%d" +# else +# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%ld" +# endif /* defined (PRId32) */ +#endif /* ACE_INT32_FORMAT_SPECIFIER */ + +#if !defined (ACE_INT32_FORMAT_SPECIFIER) +# if defined (PRId32) +# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId32) +# else +# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT (ACE_INT32_FORMAT_SPECIFIER_ASCII) +# endif /* defined (PRId32) */ +#endif /* ACE_INT32_FORMAT_SPECIFIER */ + +#if !defined (ACE_UINT32_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu32) +# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%" PRIu32 +# elif ACE_SIZEOF_INT == 4 +# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%u" +# else +# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%lu" +# endif /* defined (PRIu32) */ +#endif /* ACE_UINT32_FORMAT_SPECIFIER */ + +#if !defined (ACE_UINT32_FORMAT_SPECIFIER) +# if defined (PRIu32) +# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu32) +# else +# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT32_FORMAT_SPECIFIER_ASCII) +# endif /* defined (PRIu32) */ +#endif /* ACE_UINT32_FORMAT_SPECIFIER */ + +#if !defined (ACE_INT64_FORMAT_SPECIFIER_ASCII) +# if defined (PRId64) +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%" PRId64 +# elif ACE_SIZEOF_LONG == 8 +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%ld" +# else +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%lld" +# endif /* defined (PRId64) */ +#endif /* ACE_INT64_FORMAT_SPECIFIER */ + +#if !defined (ACE_INT64_FORMAT_SPECIFIER) +# if defined (PRId64) +# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId64) +# else +# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT (ACE_INT64_FORMAT_SPECIFIER_ASCII) +# endif /* defined (PRId64) */ +#endif /* ACE_INT64_FORMAT_SPECIFIER */ + +#if !defined (ACE_UINT64_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu64) +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%" PRIu64 +# elif ACE_SIZEOF_LONG == 8 +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" +# else +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%llu" +# endif /* defined (PRIu64) */ +#endif /* ACE_UINT64_FORMAT_SPECIFIER_ASCII */ + +#if !defined (ACE_UINT64_FORMAT_SPECIFIER) +# if defined (PRIu64) +# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu64) +# else +# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT64_FORMAT_SPECIFIER_ASCII) +# endif /* defined (PRIu64) */ +#endif /* ACE_UINT64_FORMAT_SPECIFIER */ + +#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) +# if defined (ACE_WIN64) +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%I64d" +# else +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%d" +# endif /* ACE_WIN64 */ +#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ + +#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER) +#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) +#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ + +#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) +# if defined (ACE_WIN64) +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%I64u" +# else +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%u" +# endif /* ACE_WIN64 */ +#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ + +#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER) +#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) +#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ + +// Cast from UINT64 to a double requires an intermediate cast to INT64 +// on some platforms. +# if defined (ACE_LACKS_LONGLONG_T) + // Only use the low 32 bits. +# define ACE_UINT64_DBLCAST_ADAPTER(n) ACE_U64_TO_U32 (n) +# elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +# define ACE_UINT64_DBLCAST_ADAPTER(n) ((n).to_int64 ()) +# elif defined (ACE_WIN32) +# define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n) +# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ +# define ACE_UINT64_DBLCAST_ADAPTER(n) (n) +# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ + + +// The number of bytes in a float. +# ifndef ACE_SIZEOF_FLOAT +# if FLT_MAX_EXP == 128 +# define ACE_SIZEOF_FLOAT 4 +# elif FLT_MAX_EXP == 1024 +# define ACE_SIZEOF_FLOAT 8 +# else +# error: unsupported float size, must be updated for this platform! +# endif /* FLT_MAX_EXP */ +# endif /* ACE_SIZEOF_FLOAT */ + +// The number of bytes in a double. +# ifndef ACE_SIZEOF_DOUBLE +# if DBL_MAX_EXP == 128 +# define ACE_SIZEOF_DOUBLE 4 +# elif DBL_MAX_EXP == 1024 +# define ACE_SIZEOF_DOUBLE 8 +# else +# error: unsupported double size, must be updated for this platform! +# endif /* DBL_MAX_EXP */ +# endif /* ACE_SIZEOF_DOUBLE */ + +// The number of bytes in a long double. +# ifndef ACE_SIZEOF_LONG_DOUBLE +# if LDBL_MAX_EXP == 128 +# define ACE_SIZEOF_LONG_DOUBLE 4 +# elif LDBL_MAX_EXP == 1024 +# if defined (__powerpc64__) +# define ACE_SIZEOF_LONG_DOUBLE 16 +# else +# define ACE_SIZEOF_LONG_DOUBLE 8 +# endif +# elif LDBL_MAX_EXP == 16384 +# if defined (LDBL_DIG) && LDBL_DIG == 18 +# if defined (__ia64) || defined (__x86_64) +# define ACE_SIZEOF_LONG_DOUBLE 16 +# else /* ! __ia64 || __x86_64 */ +# define ACE_SIZEOF_LONG_DOUBLE 12 +# endif /* __ia64 */ +# else /* ! LDBL_DIG || LDBL_DIG != 18 */ +# define ACE_SIZEOF_LONG_DOUBLE 16 +# endif /* ! LDBL_DIG || LDBL_DIG != 18 */ +# else +# error: unsupported double size, must be updated for this platform! +# endif /* LDBL_MAX_EXP */ +# endif /* ACE_SIZEOF_LONG_DOUBLE */ + +// Max and min sizes for the ACE integer types. +#define ACE_CHAR_MAX 0x7F +#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1 +#define ACE_OCTET_MAX 0xFF +#define ACE_INT16_MAX 0x7FFF +#define ACE_INT16_MIN -(ACE_INT16_MAX)-1 +#define ACE_UINT16_MAX 0xFFFF +#define ACE_WCHAR_MAX ACE_UINT16_MAX +#define ACE_INT32_MAX 0x7FFFFFFF +#define ACE_INT32_MIN -(ACE_INT32_MAX)-1 +#define ACE_UINT32_MAX 0xFFFFFFFF +#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF) +#define ACE_INT64_MIN -(ACE_INT64_MAX)-1 + +#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +// ACE_U_LongLong's constructor accepts a "long long" in this +// case. Set it to ACE_U_LongLong (-1) since the bit pattern for long +// long (-1) is the same as the maximum unsigned long long value. +# define ACE_UINT64_MAX ACE_U_LongLong (ACE_INT64_LITERAL (0xFFFFFFFFFFFFFFFF)) +#elif defined (ACE_LACKS_LONGLONG_T) +// ACE_U_LongLong's constructor accepts an ACE_UINT32 low and high +// pair of parameters. +# define ACE_UINT64_MAX ACE_U_LongLong (0xFFFFFFFFu, 0xFFFFFFFFu) +#else +# define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF) +#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */ + +// These use ANSI/IEEE format. +#define ACE_FLT_MAX 3.402823466e+38F +#define ACE_FLT_MIN 1.175494351e-38F +#define ACE_DBL_MAX 1.7976931348623158e+308 +#define ACE_DBL_MIN 2.2250738585072014e-308 + +# if defined (__ACE_INLINE__) +# include "ace/Basic_Types.inl" +# endif /* __ACE_INLINE__ */ + +# include /**/ "ace/post.h" +#endif /* ACE_BASIC_TYPES_H */ diff --git a/externals/ace/Basic_Types.inl b/externals/ace/Basic_Types.inl new file mode 100644 index 0000000..c6f0013 --- /dev/null +++ b/externals/ace/Basic_Types.inl @@ -0,0 +1,954 @@ +// -*- C++ -*- +// +// $Id: Basic_Types.inl 80826 2008-03-04 14:51:23Z wotte $ + +# if !defined (ACE_LACKS_LONGLONG_T) && defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Implementation for ACE_U_LongLong when we have signed long long +// but no unsigned long long. + +ACE_INLINE +ACE_U_LongLong::ACE_U_LongLong (const long long value) + : data_ (value) +{ +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::hi (void) const +{ + return (data_ >> 32) & 0xFFFFFFFF; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::lo (void) const +{ + return data_ & 0xFFFFFFFF; +} + +ACE_INLINE void +ACE_U_LongLong::hi (const ACE_UINT32 hi) +{ + data_ = hi; + data_ <<= 32; +} + +ACE_INLINE void +ACE_U_LongLong::lo (const ACE_UINT32 lo) +{ + data_ = lo; +} + +ACE_INLINE long long +ACE_U_LongLong::to_int64 (void) const +{ + return data_; +} + +ACE_INLINE +ACE_U_LongLong::~ACE_U_LongLong (void) +{ +} + +ACE_INLINE bool +ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const +{ + return data_ == n.data_; +} + +ACE_INLINE bool +ACE_U_LongLong::operator== (const ACE_UINT32 n) const +{ + return data_ == n; +} + +ACE_INLINE bool +ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const +{ + return ! (*this == n); +} + +ACE_INLINE bool +ACE_U_LongLong::operator!= (const ACE_UINT32 n) const +{ + return ! (*this == n); +} + +ACE_INLINE bool +ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const +{ + if (data_ > 0) + if (n.data_ > 0) + return data_ < n.data_; + else + return true; + else + if (n.data_ > 0) + return false; + else + return data_ < n.data_; +} + +ACE_INLINE bool +ACE_U_LongLong::operator< (const ACE_UINT32 n) const +{ + return operator< (static_cast (n)); +} + +ACE_INLINE bool +ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const +{ + if (data_ == n.data_) return true; + + return data_ < n.data_; +} + +ACE_INLINE bool +ACE_U_LongLong::operator<= (const ACE_UINT32 n) const +{ + return operator<= (static_cast (n)); +} + +ACE_INLINE bool +ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const +{ + if (data_ > 0) + if (n.data_ > 0) + return data_ > n.data_; + else + return false; + else + if (n.data_ > 0) + return true; + else + return data_ > n.data_; +} + +ACE_INLINE bool +ACE_U_LongLong::operator> (const ACE_UINT32 n) const +{ + return operator> (static_cast (n)); +} + +ACE_INLINE bool +ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const +{ + if (data_ == n.data_) return true; + + return data_ > n.data_; +} + +ACE_INLINE bool +ACE_U_LongLong::operator>= (const ACE_UINT32 n) const +{ + return operator>= (static_cast (n)); +} + +ACE_INLINE +ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n) + : data_ (n.data_) +{ +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator= (const ACE_U_LongLong &n) +{ + data_ = n.data_; + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator= (const ACE_INT32 &rhs) +{ + if (rhs >= 0) + { + data_ = rhs; + data_ &= 0xFFFFFFFF; + } + else + { + // We do not handle the case where a negative 32 bit integer is + // assigned to this representation of a 64 bit unsigned integer. + // The "undefined behavior" behavior performed by this + // implementation is to simply set all bits to zero. + data_ = 0; + } + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator= (const ACE_UINT32 &rhs) +{ + data_ = rhs; + + return *this; +} + + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const +{ + return data_ + n.data_; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator+ (const ACE_UINT32 n) const +{ + return operator+ (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const +{ + return data_ - n.data_; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator- (const ACE_UINT32 n) const +{ + return operator- (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator<< (const u_int n) const +{ + return data_ << n; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator<<= (const u_int n) +{ + data_ <<= n; + + return *this; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator>> (const u_int n) const +{ + return data_ >> n; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator>>= (const u_int n) +{ + data_ >>= n; + + return *this; +} + +ACE_INLINE double +ACE_U_LongLong::operator/ (const double n) const +{ + return data_ / n; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator+= (const ACE_U_LongLong &n) +{ + data_ += n.data_; + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator+= (const ACE_UINT32 n) +{ + return operator+= (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator* (const ACE_UINT32 n) const +{ + return data_ * n; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator*= (const ACE_UINT32 n) +{ + data_ *= n; + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator-= (const ACE_U_LongLong &n) +{ + data_ -= n.data_; + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator-= (const ACE_UINT32 n) +{ + return operator-= (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator++ () +{ + ++data_; + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator-- () +{ + --data_; + + return *this; +} + +ACE_INLINE const ACE_U_LongLong +ACE_U_LongLong::operator++ (int) +{ + // Post-increment operator should always be implemented in terms of + // the pre-increment operator to enforce consistent semantics. + ACE_U_LongLong temp (*this); + ++*this; + return temp; +} + +ACE_INLINE const ACE_U_LongLong +ACE_U_LongLong::operator-- (int) +{ + // Post-decrement operator should always be implemented in terms of + // the pre-decrement operator to enforce consistent semantics. + ACE_U_LongLong temp (*this); + --*this; + return temp; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator|= (const ACE_U_LongLong n) +{ + data_ |= n.data_; + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator|= (const ACE_UINT32 n) +{ + return operator|= (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator&= (const ACE_U_LongLong n) +{ + data_ &= n.data_; + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator&= (const ACE_UINT32 n) +{ + return operator&= (static_cast (n)); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const ACE_UINT32 n) const +{ + return data_ / n; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator% (const ACE_UINT32 n) const +{ + return data_ % n; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator| (const ACE_INT32 n) const +{ + return data_ | n; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator& (const ACE_INT32 n) const +{ + return data_ & n; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator* (const ACE_INT32 n) const +{ + return operator* ((ACE_UINT32) n); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator*= (const ACE_INT32 n) +{ + return operator*= ((ACE_UINT32) n); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const ACE_INT32 n) const +{ + return operator/ ((ACE_UINT32) n); +} + +#if ACE_SIZEOF_INT == 4 +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const u_long n) const +{ + return operator/ ((ACE_UINT32) n); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const long n) const +{ + return operator/ ((ACE_UINT32) n); +} + +#else /* ACE_SIZEOF_INT != 4 */ +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const u_int n) const +{ + return operator/ ((ACE_UINT32) n); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const int n) const +{ + return operator/ ((ACE_UINT32) n); +} +#endif + +ACE_END_VERSIONED_NAMESPACE_DECL + +#elif defined (ACE_LACKS_LONGLONG_T) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_U_LongLong::ACE_U_LongLong (const ACE_UINT32 lo, const ACE_UINT32 hi) +{ + h_ () = hi; + l_ () = lo; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::hi (void) const +{ + return h_ (); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::lo (void) const +{ + return l_ (); +} + +ACE_INLINE void +ACE_U_LongLong::hi (const ACE_UINT32 hi) +{ + h_ () = hi; +} + +ACE_INLINE void +ACE_U_LongLong::lo (const ACE_UINT32 lo) +{ + l_ () = lo; +} + +ACE_INLINE +ACE_U_LongLong::~ACE_U_LongLong (void) +{ +} + +ACE_INLINE bool +ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const +{ + return h_ () == n.h_ () && l_ () == n.l_ (); +} + +ACE_INLINE bool +ACE_U_LongLong::operator== (const ACE_UINT32 n) const +{ + return h_ () == 0 && l_ () == n; +} + +ACE_INLINE bool +ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const +{ + return ! (*this == n); +} + +ACE_INLINE bool +ACE_U_LongLong::operator!= (const ACE_UINT32 n) const +{ + return ! (*this == n); +} + +ACE_INLINE bool +ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const +{ + return h_ () < n.h_ () ? 1 + : h_ () > n.h_ () ? 0 + : l_ () < n.l_ (); +} + +ACE_INLINE bool +ACE_U_LongLong::operator< (const ACE_UINT32 n) const +{ + return operator< (static_cast (n)); +} + +ACE_INLINE bool +ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const +{ + return h_ () < n.h_ () ? 1 + : h_ () > n.h_ () ? 0 + : l_ () <= n.l_ (); +} + +ACE_INLINE bool +ACE_U_LongLong::operator<= (const ACE_UINT32 n) const +{ + return operator<= (static_cast (n)); +} + +ACE_INLINE bool +ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const +{ + return h_ () > n.h_ () ? 1 + : h_ () < n.h_ () ? 0 + : l_ () > n.l_ (); +} + +ACE_INLINE bool +ACE_U_LongLong::operator> (const ACE_UINT32 n) const +{ + return operator> (static_cast (n)); +} + +ACE_INLINE bool +ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const +{ + return h_ () > n.h_ () ? 1 + : h_ () < n.h_ () ? 0 + : l_ () >= n.l_ (); +} + +ACE_INLINE bool +ACE_U_LongLong::operator>= (const ACE_UINT32 n) const +{ + return operator>= (static_cast (n)); +} + +ACE_INLINE +ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n) +{ + h_ () = n.h_ (); + l_ () = n.l_ (); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator= (const ACE_U_LongLong &n) +{ + h_ () = n.h_ (); + l_ () = n.l_ (); + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator= (const ACE_INT32 &rhs) +{ + if (rhs >= 0) + { + l_ () = static_cast (rhs); + h_ () = 0; + } + else + { + // We do not handle the case where a negative 32 bit integer is + // assigned to this representation of a 64 bit unsigned integer. + // The "undefined behavior" behavior performed by this + // implementation is to simply set all bits to zero. + l_ () = 0; + h_ () = 0; + } + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator= (const ACE_UINT32 &rhs) +{ + l_ () = rhs; + h_ () = 0; + + return *this; +} + + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const +{ + ACE_U_LongLong ret (l_ () + n.l_ (), h_ () + n.h_ ()); + if (ret.l_ () < n.l_ ()) /* carry */ ++ret.h_ (); + + return ret; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator+ (const ACE_UINT32 n) const +{ + return operator+ (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const +{ + ACE_U_LongLong ret (l_ () - n.l_ (), h_ () - n.h_ ()); + if (l_ () < n.l_ ()) /* borrow */ --ret.h_ (); + + return ret; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator- (const ACE_UINT32 n) const +{ + return operator- (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator<< (const u_int n) const +{ + const ACE_UINT32 carry_mask = l_ () >> (32 - n); + ACE_U_LongLong ret (n < 32 ? l_ () << n : 0, + n < 32 ? (h_ () << n) | carry_mask : carry_mask); + + return ret; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator<<= (const u_int n) +{ + const ACE_UINT32 carry_mask = l_ () >> (32 - n); + h_ () = n < 32 ? (h_ () << n) | carry_mask : carry_mask; + + // g++ 2.7.2.3/Solaris 2.5.1 doesn't modify l_ () if shifted by 32. + l_ () = n < 32 ? l_ () << n : 0; + + return *this; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator>> (const u_int n) const +{ + const ACE_UINT32 carry_mask = h_ () << (32 - n); + ACE_U_LongLong ret (n < 32 ? (l_ () >> n) | carry_mask : 0, + n < 32 ? h_ () >> n : 0); + + return ret; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator>>= (const u_int n) +{ + const ACE_UINT32 carry_mask = h_ () << (32 - n); + l_ () = n < 32 ? (l_ () >> n) | carry_mask : carry_mask; + h_ () = n < 32 ? h_ () >> n : 0; + + return *this; +} + +ACE_INLINE double +ACE_U_LongLong::operator/ (const double n) const +{ + // See the derivation above in operator/ (const ACE_UINT32). + + return ((double) 0xffffffffu - n + 1.0) / n * h_ () + + (double) h_ () + (double) l_ () / n; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator+= (const ACE_U_LongLong &n) +{ + h_ () += n.h_ (); + l_ () += n.l_ (); + if (l_ () < n.l_ ()) /* carry */ ++h_ (); + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator+= (const ACE_UINT32 n) +{ + return operator+= (static_cast (n)); +} + +#define ACE_HIGHBIT (~(~0UL >> 1)) + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::ul_shift (ACE_UINT32 a, ACE_UINT32 c_in, ACE_UINT32 *c_out) const +{ + const ACE_UINT32 b = (a << 1) | c_in; + *c_out = (*c_out << 1) + ((a & ACE_HIGHBIT) > 0); + + return b; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::ull_shift (ACE_U_LongLong a, + ACE_UINT32 c_in, + ACE_UINT32 *c_out) const +{ + ACE_U_LongLong b; + + b.l_ () = (a.l_ () << 1) | c_in; + c_in = ((a.l_ () & ACE_HIGHBIT) > 0); + b.h_ () = (a.h_ () << 1) | c_in; + *c_out = (*c_out << 1) + ((a.h_ () & ACE_HIGHBIT) > 0); + + return b; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::ull_add (ACE_U_LongLong a, ACE_U_LongLong b, ACE_UINT32 *carry) const +{ + ACE_U_LongLong r (0, 0); + ACE_UINT32 c1, c2, c3, c4; + + c1 = a.l_ () % 2; + c2 = b.l_ () % 2; + c3 = 0; + + r.l_ () = a.l_ ()/2 + b.l_ ()/2 + (c1+c2)/2; + r.l_ () = ul_shift (r.l_ (), (c1+c2)%2, &c3); + + c1 = a.h_ () % 2; + c2 = b.h_ () % 2; + c4 = 0; + + r.h_ () = a.h_ ()/2 + b.h_ ()/2 + (c1+c2+c3)/2; + r.h_ () = ul_shift (r.h_ (), (c1+c2+c3)%2, &c4); + + *carry = c4; + + return r; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) const +{ + register ACE_UINT32 mask = ACE_HIGHBIT; + const ACE_U_LongLong zero (0, 0); + ACE_U_LongLong accum (0, 0); + ACE_UINT32 c; + + *carry = 0; + if (b > 0) + do + { + accum = ull_shift (accum, 0U, carry); + if (b & mask) + accum = ull_add (accum, a, &c); + else + accum = ull_add (accum, zero, &c); + *carry += c; + mask >>= 1; + } + while (mask > 0); + + return accum; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator* (const ACE_UINT32 n) const +{ + ACE_UINT32 carry; // will throw the carry away + + return ull_mult (*this, n, &carry); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator*= (const ACE_UINT32 n) +{ + ACE_UINT32 carry; // will throw the carry away + + return *this = ull_mult (*this, n, &carry); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator-= (const ACE_U_LongLong &n) +{ + h_ () -= n.h_ (); + if (l_ () < n.l_ ()) /* borrow */ --h_ (); + l_ () -= n.l_ (); + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator-= (const ACE_UINT32 n) +{ + return operator-= (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator++ () +{ + ++l_ (); + if (l_ () == 0) /* carry */ ++h_ (); + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator-- () +{ + if (l_ () == 0) /* borrow */ --h_ (); + --l_ (); + + return *this; +} + +ACE_INLINE const ACE_U_LongLong +ACE_U_LongLong::operator++ (int) +{ + // Post-increment operator should always be implemented in terms of + // the pre-increment operator to enforce consistent semantics. + ACE_U_LongLong temp (*this); + ++*this; + return temp; +} + +ACE_INLINE const ACE_U_LongLong +ACE_U_LongLong::operator-- (int) +{ + // Post-decrement operator should always be implemented in terms of + // the pre-decrement operator to enforce consistent semantics. + ACE_U_LongLong temp (*this); + --*this; + return temp; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator|= (const ACE_U_LongLong n) +{ + l_ () |= n.l_ (); + h_ () |= n.h_ (); + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator|= (const ACE_UINT32 n) +{ + return operator|= (static_cast (n)); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator&= (const ACE_U_LongLong n) +{ + l_ () &= n.l_ (); + h_ () &= n.h_ (); + + return *this; +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator&= (const ACE_UINT32 n) +{ + return operator&= (static_cast (n)); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const ACE_UINT32 n) const +{ + // This takes advantage of the fact that the return type has only 32 + // bits. Replace 0x100000000 with 0xffffffff + 1 because the former + // has 33 bits. + // Quotient = (0x100000000u * hi_ + lo_) / n + // = ((0x100000000u - n + n) * hi_ + lo_) / n + // = ((0x100000000u - n) / n * hi_ + hi_ * n / n + lo_ / n + // = (0x100000000u - n) / n * hi_ + hi_ + lo_ / n + // = (0xffffffffu - n + 1) / n * hi_ + hi_ + lo_ / n + + return (0xffffffffu - n + 1) / n * h_ () + h_ () + l_ () / n; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator% (const ACE_UINT32 n) const +{ + // Because the argument is an ACE_UINT32, the result can never be + // bigger than 32 bits. Replace 0x100000000 with 0xffffffff + 1 + // because the former has 33 bits. + // Mod = (0x100000000u * hi_ + lo_) % n + // = (0x100000000u % n * hi_ + lo_ % n) % n + // = ((0x100000000u - n) % n * hi_ + lo_ % n) % n + // = ((0xffffffffu - n + 1) % n * hi_ + lo_ % n) % n + + return ((0xffffffff - n + 1) % n * h_ () + l_ () % n) % n; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator| (const ACE_INT32 n) const +{ + return l_ () | n; +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator& (const ACE_INT32 n) const +{ + return l_ () & n; +} + +ACE_INLINE ACE_U_LongLong +ACE_U_LongLong::operator* (const ACE_INT32 n) const +{ + return operator* ((ACE_UINT32) n); +} + +ACE_INLINE ACE_U_LongLong & +ACE_U_LongLong::operator*= (const ACE_INT32 n) +{ + return operator*= ((ACE_UINT32) n); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const ACE_INT32 n) const +{ + return operator/ ((ACE_UINT32) n); +} + +#if ACE_SIZEOF_INT == 4 +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const u_long n) const +{ + return operator/ ((ACE_UINT32) n); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const long n) const +{ + return operator/ ((ACE_UINT32) n); +} + +#else /* ACE_SIZEOF_INT != 4 */ +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const u_int n) const +{ + return operator/ ((ACE_UINT32) n); +} + +ACE_INLINE ACE_UINT32 +ACE_U_LongLong::operator/ (const int n) const +{ + return operator/ ((ACE_UINT32) n); +} +#endif /* ACE_SIZEOF_INT != 4 */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ diff --git a/externals/ace/Bound_Ptr.h b/externals/ace/Bound_Ptr.h new file mode 100644 index 0000000..5176ff9 --- /dev/null +++ b/externals/ace/Bound_Ptr.h @@ -0,0 +1,388 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Bound_Ptr.h + * + * $Id: Bound_Ptr.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Christopher Kohlhoff + * @author Boris Kolpackov + */ +//============================================================================= + +#ifndef ACE_BOUND_PTR_H +#define ACE_BOUND_PTR_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Auto_Ptr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Bound_Ptr_Counter + * + * @brief An ACE_Bound_Ptr_Counter object encapsulates an + * object reference count. + * + * Do not use this class directly, use ACE_Strong_Bound_Ptr or + * ACE_Weak_Bound_Ptr instead. + */ +template +class ACE_Bound_Ptr_Counter +{ +public: + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + ACE_Bound_Ptr_Counter (long init_obj_ref_count = 0); + ~ACE_Bound_Ptr_Counter (void); + + /// Create a ACE_Bound_Ptr_Counter and initialize the + /// reference count to indicate ownership by a strong pointer. + static ACE_Bound_Ptr_Counter *create_strong (void); + + /// Increase both the object and counter reference counts and return + /// the new object reference count. A return value of -1 indicates + /// that the object has already been destroyed. + static long attach_strong (ACE_Bound_Ptr_Counter *counter); + + /// Decreases both the object and counter reference counts and + /// deletes whichever has no more references. Returns the new object + /// reference count. + static long detach_strong (ACE_Bound_Ptr_Counter *counter); + + /// Create a ACE_Bound_Ptr_Counter and initialize the + /// reference count to indicate no ownership. + static ACE_Bound_Ptr_Counter *create_weak (void); + + /// Increase the counter reference count and return argument. + static void attach_weak (ACE_Bound_Ptr_Counter *counter); + + /// Decreases the counter reference count and deletes the counter if + /// it has no more references. + static void detach_weak (ACE_Bound_Ptr_Counter *counter); + + /// Determine whether the object has been deleted. + static bool object_was_deleted (ACE_Bound_Ptr_Counter *counter); + +private: + + /// Allocate a new ACE_Bound_Ptr_Counter instance, + /// returning NULL if it cannot be created. + static ACE_Bound_Ptr_Counter *internal_create (long init_obj_ref_count); + +private: + + /// Reference count of underlying object. Is set to -1 once the + /// object has been destroyed to indicate to all weak pointers that + /// it is no longer valid. + long obj_ref_count_; + + /// Reference count of this counter. + long self_ref_count_; + + /// Mutex variable to synchronize access to the reference counts. + ACE_LOCK lock_; +}; + +// Forward decl. +template class ACE_Weak_Bound_Ptr; + +/** + * @class ACE_Strong_Bound_Ptr + * + * @brief This class implements support for a reference counted + * pointer. + * + * Assigning or copying instances of an ACE_Strong_Bound_Ptr will + * automatically increment the reference count of the underlying object. + * When the last instance of an ACE_Strong_Bound_Ptr that references a + * particular object is destroyed or overwritten, it will invoke delete + * on its underlying pointer. + */ +template +class ACE_Strong_Bound_Ptr +{ +public: + /// Constructor that initializes an ACE_Strong_Bound_Ptr to point to the + /// object \ immediately. + explicit ACE_Strong_Bound_Ptr (X *p = 0); + + /// Constructor that initializes an ACE_Strong_Bound_Ptr by stealing + /// ownership of an object from an auto_ptr. + explicit ACE_Strong_Bound_Ptr (auto_ptr p); + + /// Copy constructor binds @c this and @a r to the same object. + ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r); + + /// Constructor binds @c this and @a r to the same object. + ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr &r); + + /// Copy constructor binds @c this and @a r to the same object if + /// Y* can be implicitly converted to X*. + template + ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) + : counter_ (r.counter_), + ptr_ (dynamic_cast(r.ptr_)) + { + // This ctor is temporarily defined here to increase our chances + // of being accepted by broken compilers. + // + COUNTER::attach_strong (this->counter_); + } + + /// Destructor. + ~ACE_Strong_Bound_Ptr (void); + + /// Assignment operator that binds @c this and @a r to the same object. + void operator = (const ACE_Strong_Bound_Ptr &r); + + /// Assignment operator that binds @c this and @a r to the same object. + void operator = (const ACE_Weak_Bound_Ptr &r); + + /// Assignment operator that binds @c this and @a r to the same object + /// if Y* can be implicitly converted to X*. + template + ACE_Weak_Bound_Ptr& + operator= (const ACE_Strong_Bound_Ptr &r) + { + // This operator is temporarily defined here to increase our chances + // of being accepted by broken compilers. + // + + // This will work if &r == this, by first increasing the ref count + + COUNTER *new_counter = r.counter_; + X* new_ptr = dynamic_cast (r.ptr_); + COUNTER::attach_strong (new_counter); + if (COUNTER::detach_strong (this->counter_) == 0) + delete this->ptr_; + this->counter_ = new_counter; + this->ptr_ = new_ptr; + + return *this; + } + + /// Equality operator that returns @c true if both + /// ACE_Strong_Bound_Ptr instances point to the same underlying + /// object. + /** + * @note It also returns @c true if both objects have just been + * instantiated and not used yet. + */ + bool operator == (const ACE_Strong_Bound_Ptr &r) const; + + /// Equality operator that returns true if the ACE_Strong_Bound_Ptr + /// and ACE_Weak_Bound_Ptr objects point to the same underlying + /// object. + /** + * @note It also returns @c true if both objects have just been + * instantiated and not used yet. + */ + bool operator == (const ACE_Weak_Bound_Ptr &r) const; + + /// Equality operator that returns @c true if the + /// ACE_Strong_Bound_Ptr and the raw pointer point to the same + /// underlying object. + bool operator == (X *p) const; + + /// Inequality operator, which is the opposite of equality. + bool operator != (const ACE_Strong_Bound_Ptr &r) const; + + /// Inequality operator, which is the opposite of equality. + bool operator != (const ACE_Weak_Bound_Ptr &r) const; + + /// Inequality operator, which is the opposite of equality. + bool operator != (X *p) const; + + /// Redirection operator + X *operator-> (void) const; + + /// Dereference operator + X &operator * (void) const; + + /// Get the pointer value. + X *get (void) const; + + /// Resets the ACE_Strong_Bound_Ptr to refer to a different + /// underlying object. + void reset (X *p = 0); + + /// Resets the ACE_Strong_Bound_Ptr to refer to a different + /// underlying object, ownership of which is stolen from the + /// auto_ptr. + void reset (auto_ptr p); + + /// Allows us to check for NULL on all ACE_Strong_Bound_Ptr + /// objects. + bool null (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + typedef X X_t; // This indirection is for Borland C++. + + friend class ACE_Weak_Bound_Ptr; + + template + friend class ACE_Strong_Bound_Ptr; + + /// The ACE_Bound_Ptr_Counter type. + typedef ACE_Bound_Ptr_Counter COUNTER; + + /// The reference counter. + COUNTER *counter_; + + /// The underlying object. + X *ptr_; +}; + +/** + * @class ACE_Weak_Bound_Ptr + * + * @brief This class implements support for a weak pointer that complements + * ACE_Strong_Bound_Ptr. + * + * Unlike ACE_Strong_Bound_Ptr, assigning or copying instances of an + * ACE_Weak_Bound_Ptr will not automatically increment the reference + * count of the underlying object. What ACE_Weak_Bound_Ptr does is + * preserve the knowledge that the object is in fact reference + * counted, and thus provides an alternative to raw pointers where + * non-ownership associations must be maintained. When the last + * instance of an ACE_Strong_Bound_Ptr that references a particular + * object is destroyed or overwritten, the corresponding + * ACE_Weak_Bound_Ptr instances are set to NULL. + */ +template +class ACE_Weak_Bound_Ptr +{ +public: + /// Constructor that initializes an ACE_Weak_Bound_Ptr to point to + /// the object \ immediately. + explicit ACE_Weak_Bound_Ptr (X *p = 0); + + /// Copy constructor binds @c this and @a r to the same object. + ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr &r); + + /// Constructor binds @c this and @a r to the same object. + ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr &r); + + /// Destructor. + ~ACE_Weak_Bound_Ptr (void); + + /// Assignment operator that binds @c this and @a r to the same object. + void operator = (const ACE_Weak_Bound_Ptr &r); + + /// Assignment operator that binds @c this and @a r to the same object. + void operator = (const ACE_Strong_Bound_Ptr &r); + + /// Equality operator that returns @c true if both + /// ACE_Weak_Bound_Ptr objects point to the same underlying object. + /** + * @note It also returns @c true if both objects have just been + * instantiated and not used yet. + */ + bool operator == (const ACE_Weak_Bound_Ptr &r) const; + + /// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr + /// and ACE_Strong_Bound_Ptr objects point to the same underlying + /// object. + /** + * @note It also returns @c true if both objects have just been + * instantiated and not used yet. + */ + bool operator == (const ACE_Strong_Bound_Ptr &r) const; + + /// Equality operator that returns @c true if the ACE_Weak_Bound_Ptr + /// and the raw pointer point to the same underlying object. + bool operator == (X *p) const; + + /// Inequality operator, which is the opposite of equality. + bool operator != (const ACE_Weak_Bound_Ptr &r) const; + + /// Inequality operator, which is the opposite of equality. + bool operator != (const ACE_Strong_Bound_Ptr &r) const; + + /// Inequality operator, which is the opposite of equality. + bool operator != (X *p) const; + + /// Redirection operator. + /** + * It returns a temporary strong pointer and makes use of the + * chaining properties of operator-> to ensure that the underlying + * object does not disappear while you are using it. If you are + * certain of the lifetimes of the object, and do not want to incur + * the locking overhead, then use the unsafe_get method instead. + */ + ACE_Strong_Bound_Ptr operator-> (void) const; + + /// Obtain a strong pointer corresponding to this weak pointer. This + /// function is useful to create a temporary strong pointer for + /// conversion to a reference. + ACE_Strong_Bound_Ptr strong (void) const; + + /// Get the pointer value. Warning: this does not affect the + /// reference count of the underlying object, so it may disappear on + /// you while you are using it if you are not careful. + X *unsafe_get (void) const; + + /// Resets the ACE_Weak_Bound_Ptr to refer to a different underlying + /// object. + void reset (X *p = 0); + + /// Increment the reference count on the underlying object. + /** + * Returns the new reference count on the object. This function may + * be used to integrate the bound pointers into an external + * reference counting mechanism such as those used by COM or CORBA + * servants. + */ + long add_ref (void); + + /// Decrement the reference count on the underlying object, which is deleted + /// if the count has reached zero. + /** + * Returns the new reference count on the object. This function may + * be used to integrate the bound pointers into an external + * reference counting mechanism such as those used by COM or CORBA + * servants. + */ + long remove_ref (void); + + /// Allows us to check for NULL on all ACE_Weak_Bound_Ptr objects. + bool null (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + typedef X X_t; // This indirection is for Borland C++. + + friend class ACE_Strong_Bound_Ptr; + + /// The ACE_Bound_Ptr_Counter type. + typedef ACE_Bound_Ptr_Counter COUNTER; + + /// The reference counter. + COUNTER *counter_; + + /// The underlying object. + X *ptr_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include "ace/Bound_Ptr.inl" + +#include /**/ "ace/post.h" + +#endif /* ACE_BOUND_PTR_H */ diff --git a/externals/ace/Bound_Ptr.inl b/externals/ace/Bound_Ptr.inl new file mode 100644 index 0000000..399a7bc --- /dev/null +++ b/externals/ace/Bound_Ptr.inl @@ -0,0 +1,494 @@ +/* -*- C++ -*- */ +// $Id: Bound_Ptr.inl 82723 2008-09-16 09:35:44Z johnnyw $ + +// Bound_Ptr.i + +#include "ace/Guard_T.h" +#if !defined (ACE_NEW_THROWS_EXCEPTIONS) +# include "ace/Log_Msg.h" +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template inline ACE_Bound_Ptr_Counter * +ACE_Bound_Ptr_Counter::internal_create (long init_obj_ref_count) +{ + ACE_Bound_Ptr_Counter *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Bound_Ptr_Counter (init_obj_ref_count), + 0); + return temp; +} + +template inline ACE_Bound_Ptr_Counter * +ACE_Bound_Ptr_Counter::create_strong (void) +{ + // Set initial object reference count to 1. + ACE_Bound_Ptr_Counter *temp = internal_create (1); +#if defined (ACE_NEW_THROWS_EXCEPTIONS) + if (temp == 0) + ACE_throw_bad_alloc; +#else + ACE_ASSERT (temp != 0); +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + return temp; +} + + + +template inline long +ACE_Bound_Ptr_Counter::attach_strong (ACE_Bound_Ptr_Counter* counter) +{ + ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1); + + // Can't attach a strong pointer to an object that has already been deleted. + if (counter->obj_ref_count_ == -1) + return -1; + + long new_obj_ref_count = ++counter->obj_ref_count_; + ++counter->self_ref_count_; + + return new_obj_ref_count; +} + +template inline long +ACE_Bound_Ptr_Counter::detach_strong (ACE_Bound_Ptr_Counter* counter) +{ + ACE_Bound_Ptr_Counter *counter_del = 0; + long new_obj_ref_count; + + { + ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, -1); + + if ((new_obj_ref_count = --counter->obj_ref_count_) == 0) + // Change the object reference count to -1 to indicate that the + // object has been deleted, as opposed to a weak pointer that + // simply hasn't had any strong pointers created from it yet. + counter->obj_ref_count_ = -1; + + if (--counter->self_ref_count_ == 0) + // Since counter contains the lock held by the ACE_Guard, the + // guard needs to be released before freeing the memory holding + // the lock. So save the pointer to free, then release, then + // free. + counter_del = counter; + + } // Release the lock + + delete counter_del; + + return new_obj_ref_count; +} + +template inline ACE_Bound_Ptr_Counter * +ACE_Bound_Ptr_Counter::create_weak (void) +{ + // Set initial object reference count to 0. + + ACE_Bound_Ptr_Counter *temp = internal_create (0); +#if defined (ACE_NEW_THROWS_EXCEPTIONS) + if (temp == 0) + ACE_throw_bad_alloc; +#else + ACE_ASSERT (temp != 0); +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + return temp; +} + +template inline void +ACE_Bound_Ptr_Counter::attach_weak (ACE_Bound_Ptr_Counter* counter) +{ + ACE_GUARD (ACE_LOCK, guard, counter->lock_); + + ++counter->self_ref_count_; +} + +template inline void +ACE_Bound_Ptr_Counter::detach_weak (ACE_Bound_Ptr_Counter* counter) +{ + ACE_Bound_Ptr_Counter *counter_del = 0; + + { + ACE_GUARD (ACE_LOCK, guard, counter->lock_); + + if (--counter->self_ref_count_ == 0) + // Since counter contains the lock held by the ACE_Guard, the + // guard needs to be released before freeing the memory holding + // the lock. So save the pointer to free, then release, then + // free. + counter_del = counter; + + } // Release the lock + + delete counter_del; +} + +template inline bool +ACE_Bound_Ptr_Counter::object_was_deleted (ACE_Bound_Ptr_Counter *counter) +{ + ACE_GUARD_RETURN (ACE_LOCK, guard, counter->lock_, 0); + + return counter->obj_ref_count_ == -1; +} + +template inline +ACE_Bound_Ptr_Counter::ACE_Bound_Ptr_Counter (long init_obj_ref_count) + : obj_ref_count_ (init_obj_ref_count), + self_ref_count_ (1) +{ +} + +template inline +ACE_Bound_Ptr_Counter::~ACE_Bound_Ptr_Counter (void) +{ +} + +template inline +ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (X *p) + : counter_ (COUNTER::create_strong ()), + ptr_ (p) +{ +} + +template inline +ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (auto_ptr p) + : counter_ (COUNTER::create_strong ()), + ptr_ (p.release()) +{ +} + +template inline +ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) + : counter_ (r.counter_), + ptr_ (r.ptr_) +{ + COUNTER::attach_strong (this->counter_); +} + +template inline +ACE_Strong_Bound_Ptr::ACE_Strong_Bound_Ptr (const ACE_Weak_Bound_Ptr &r) + : counter_ (r.counter_), + ptr_ (r.ptr_) +{ + // When creating a strong pointer from a weak one we can't assume that the + // underlying object still exists. Therefore we must check for a return value + // of -1, which indicates that the object has been destroyed. + if (COUNTER::attach_strong (this->counter_) == -1) + { + // Underlying object has already been deleted, so set this pointer to null. + this->counter_ = COUNTER::create_strong (); + this->ptr_ = 0; + } +} + +template inline +ACE_Strong_Bound_Ptr::~ACE_Strong_Bound_Ptr (void) +{ + if (COUNTER::detach_strong (this->counter_) == 0) + delete this->ptr_; +} + +template inline void +ACE_Strong_Bound_Ptr::operator = (const ACE_Strong_Bound_Ptr &rhs) +{ + // This will work if &r == this, by first increasing the ref count, but + // why go through all that? + if (&rhs == this) + return; + + COUNTER *new_counter = rhs.counter_; + X_t *new_ptr = rhs.ptr_; + COUNTER::attach_strong (new_counter); + if (COUNTER::detach_strong (this->counter_) == 0) + delete this->ptr_; + this->counter_ = new_counter; + this->ptr_ = new_ptr; +} + +template inline void +ACE_Strong_Bound_Ptr::operator = (const ACE_Weak_Bound_Ptr &rhs) +{ + // This will work if &r == this, by first increasing the ref count, but + // why go through all that? + if (&rhs == this) + return; + + COUNTER *new_counter = rhs.counter_; + X_t *new_ptr = rhs.ptr_; + + // When creating a strong pointer from a weak one we can't assume that the + // underlying object still exists. Therefore we must check for a return value + // of -1, which indicates that the object has been destroyed. + if (COUNTER::attach_strong (new_counter) == -1) + { + // Underlying object has already been deleted, so set this pointer to null. + new_counter = COUNTER::create_strong (); + new_ptr = 0; + } + + if (COUNTER::detach_strong (this->counter_) == 0) + delete this->ptr_; + this->counter_ = new_counter; + this->ptr_ = new_ptr; +} + +template inline bool +ACE_Strong_Bound_Ptr::operator== (const ACE_Strong_Bound_Ptr &r) const +{ + return this->ptr_ == r.ptr_; +} + +template inline bool +ACE_Strong_Bound_Ptr::operator== (const ACE_Weak_Bound_Ptr &r) const +{ + // Use the weak pointer's operator== since it will check for null. + return r == *this; +} + +template inline bool +ACE_Strong_Bound_Ptr::operator== (X *p) const +{ + return this->ptr_ == p; +} + +template inline bool +ACE_Strong_Bound_Ptr::operator!= (const ACE_Strong_Bound_Ptr &r) const +{ + return this->ptr_ != r.ptr_; +} + +template inline bool +ACE_Strong_Bound_Ptr::operator!= (const ACE_Weak_Bound_Ptr &r) const +{ + // Use the weak pointer's operator!= since it will check for null. + return r != *this; +} + +template inline bool +ACE_Strong_Bound_Ptr::operator!= (X *p) const +{ + return this->ptr_ != p; +} + +template inline X * +ACE_Strong_Bound_Ptr::operator-> (void) const +{ + return this->ptr_; +} + +template inline X & +ACE_Strong_Bound_Ptr::operator *() const +{ + return *this->ptr_; +} + +template inline X* +ACE_Strong_Bound_Ptr::get (void) const +{ + return this->ptr_; +} + +template inline bool +ACE_Strong_Bound_Ptr::null (void) const +{ + return this->ptr_ == 0; +} + +template inline void +ACE_Strong_Bound_Ptr::reset (X *p) +{ + COUNTER *old_counter = this->counter_; + X_t *old_ptr = this->ptr_; + this->counter_ = COUNTER::create_strong (); + this->ptr_ = p; + if (COUNTER::detach_strong (old_counter) == 0) + delete old_ptr; +} + +template inline void +ACE_Strong_Bound_Ptr::reset (auto_ptr p) +{ + COUNTER *old_counter = this->counter_; + X_t *old_ptr = this->ptr_; + this->counter_ = COUNTER::create_strong (); + this->ptr_ = p.release (); + if (COUNTER::detach_strong (old_counter) == 0) + delete old_ptr; +} + +template inline +ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (X *p) + : counter_ (COUNTER::create_weak ()), + ptr_ (p) +{ +} + +template inline +ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (const ACE_Weak_Bound_Ptr &r) + : counter_ (r.counter_), + ptr_ (r.ptr_) +{ + COUNTER::attach_weak (this->counter_); +} + +template inline +ACE_Weak_Bound_Ptr::ACE_Weak_Bound_Ptr (const ACE_Strong_Bound_Ptr &r) + : counter_ (r.counter_), + ptr_ (r.ptr_) +{ + COUNTER::attach_weak (this->counter_); +} + +template inline +ACE_Weak_Bound_Ptr::~ACE_Weak_Bound_Ptr (void) +{ + COUNTER::detach_weak (this->counter_); +} + +template inline void +ACE_Weak_Bound_Ptr::operator = (const ACE_Weak_Bound_Ptr &rhs) +{ + // This will work if &rhs == this, by first increasing the ref count + COUNTER *new_counter = rhs.counter_; + COUNTER::attach_weak (new_counter); + COUNTER::detach_weak (this->counter_); + this->counter_ = new_counter; + this->ptr_ = rhs.ptr_; +} + +template inline void +ACE_Weak_Bound_Ptr::operator = (const ACE_Strong_Bound_Ptr &rhs) +{ + // This will work if &rhs == this, by first increasing the ref count + COUNTER *new_counter = rhs.counter_; + COUNTER::attach_weak (new_counter); + COUNTER::detach_weak (this->counter_); + this->counter_ = new_counter; + this->ptr_ = rhs.ptr_; +} + +template inline bool +ACE_Weak_Bound_Ptr::operator== (const ACE_Weak_Bound_Ptr &r) const +{ + // A weak pointer must behave as though it is automatically set to null + // if the underlying object has been deleted. + if (COUNTER::object_was_deleted (this->counter_)) + return r.ptr_ == 0; + + return this->ptr_ == r.ptr_; +} + +template inline bool +ACE_Weak_Bound_Ptr::operator== (const ACE_Strong_Bound_Ptr &r) const +{ + // A weak pointer must behave as though it is automatically set to null + // if the underlying object has been deleted. + if (COUNTER::object_was_deleted (this->counter_)) + return r.ptr_ == 0; + + return this->ptr_ == r.ptr_; +} + +template inline bool +ACE_Weak_Bound_Ptr::operator== (X *p) const +{ + // A weak pointer must behave as though it is automatically set to null + // if the underlying object has been deleted. + if (COUNTER::object_was_deleted (this->counter_)) + return p == 0; + + return this->ptr_ == p; +} + +template inline bool +ACE_Weak_Bound_Ptr::operator!= (const ACE_Weak_Bound_Ptr &r) const +{ + // A weak pointer must behave as though it is automatically set to null + // if the underlying object has been deleted. + if (COUNTER::object_was_deleted (this->counter_)) + return r.ptr_ != 0; + + return this->ptr_ != r.ptr_; +} + +template inline bool +ACE_Weak_Bound_Ptr::operator!= (const ACE_Strong_Bound_Ptr &r) const +{ + // A weak pointer must behave as though it is automatically set to null + // if the underlying object has been deleted. + if (COUNTER::object_was_deleted (this->counter_)) + return r.ptr_ != 0; + + return this->ptr_ != r.ptr_; +} + +template inline bool +ACE_Weak_Bound_Ptr::operator!= (X *p) const +{ + // A weak pointer must behave as though it is automatically set to null + // if the underlying object has been deleted. + if (COUNTER::object_was_deleted (this->counter_)) + return p != 0; + + return this->ptr_ != p; +} + +template inline ACE_Strong_Bound_Ptr +ACE_Weak_Bound_Ptr::operator-> (void) const +{ + return ACE_Strong_Bound_Ptr (*this); +} + +template inline ACE_Strong_Bound_Ptr +ACE_Weak_Bound_Ptr::strong (void) const +{ + return ACE_Strong_Bound_Ptr (*this); +} + +template inline X* +ACE_Weak_Bound_Ptr::unsafe_get (void) const +{ + // We do not check if the object has been deleted, since this operation + // is defined to be unsafe! + return this->ptr_; +} + +template inline bool +ACE_Weak_Bound_Ptr::null (void) const +{ + // A weak pointer must behave as though it is automatically set to null + // if the underlying object has been deleted. + if (COUNTER::object_was_deleted (this->counter_)) + return true; + + return this->ptr_ == 0; +} + +template inline void +ACE_Weak_Bound_Ptr::reset (X *p) +{ + COUNTER *old_counter = this->counter_; + this->counter_ = COUNTER::create_weak (); + this->ptr_ = p; + COUNTER::detach_weak (old_counter); +} + +template inline long +ACE_Weak_Bound_Ptr::add_ref () +{ + return COUNTER::attach_strong (counter_); +} + +template inline long +ACE_Weak_Bound_Ptr::remove_ref () +{ + long new_obj_ref_count = COUNTER::detach_strong (counter_); + if (new_obj_ref_count == 0) + { + delete this->ptr_; + this->ptr_ = 0; + } + return new_obj_ref_count; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/CDR_Base.cpp b/externals/ace/CDR_Base.cpp new file mode 100644 index 0000000..35393c3 --- /dev/null +++ b/externals/ace/CDR_Base.cpp @@ -0,0 +1,802 @@ +#include "ace/CDR_Base.h" + +#if !defined (__ACE_INLINE__) +# include "ace/CDR_Base.inl" +#endif /* ! __ACE_INLINE__ */ + +#include "ace/Message_Block.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ace, + CDR_Base, + "$Id: CDR_Base.cpp 86825 2009-09-28 17:45:23Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (NONNATIVE_LONGDOUBLE) +static const ACE_INT16 max_eleven_bit = 0x3ff; +static const ACE_INT16 max_fifteen_bit = 0x3fff; +#endif /* NONNATIVE_LONGDOUBLE */ + +// +// See comments in CDR_Base.inl about optimization cases for swap_XX_array. +// + +void +ACE_CDR::swap_2_array (char const * orig, char* target, size_t n) +{ + // ACE_ASSERT(n > 0); The caller checks that n > 0 + + // We pretend that AMD64/GNU G++ systems have a Pentium CPU to + // take advantage of the inline assembly implementation. + + // Later, we try to read in 32 or 64 bit chunks, + // so make sure we don't do that for unaligned addresses. +#if ACE_SIZEOF_LONG == 8 && \ + !((defined(__amd64__) || defined (__x86_64__)) && defined(__GNUG__)) + char const * const o8 = ACE_ptr_align_binary (orig, 8); + while (orig < o8 && n > 0) + { + ACE_CDR::swap_2 (orig, target); + orig += 2; + target += 2; + --n; + } +#else + char const * const o4 = ACE_ptr_align_binary (orig, 4); + // this is an _if_, not a _while_. The mistmatch can only be by 2. + if (orig != o4) + { + ACE_CDR::swap_2 (orig, target); + orig += 2; + target += 2; + --n; + } +#endif + if (n == 0) + return; + + // + // Loop unrolling. Here be dragons. + // + + // (n & (~3)) is the greatest multiple of 4 not bigger than n. + // In the while loop ahead, orig will move over the array by 8 byte + // increments (4 elements of 2 bytes). + // end marks our barrier for not falling outside. + char const * const end = orig + 2 * (n & (~3)); + + // See if we're aligned for writting in 64 or 32 bit chunks... +#if ACE_SIZEOF_LONG == 8 && \ + !((defined(__amd64__) || defined (__x86_64__)) && defined(__GNUG__)) + if (target == ACE_ptr_align_binary (target, 8)) +#else + if (target == ACE_ptr_align_binary (target, 4)) +#endif + { + while (orig < end) + { +#if defined (ACE_HAS_INTEL_ASSEMBLY) + unsigned int a = + * reinterpret_cast (orig); + unsigned int b = + * reinterpret_cast (orig + 4); + asm ( "bswap %1" : "=r" (a) : "0" (a) ); + asm ( "bswap %1" : "=r" (b) : "0" (b) ); + asm ( "rol $16, %1" : "=r" (a) : "0" (a) ); + asm ( "rol $16, %1" : "=r" (b) : "0" (b) ); + * reinterpret_cast (target) = a; + * reinterpret_cast (target + 4) = b; +#elif defined(ACE_HAS_PENTIUM) \ + && (defined(_MSC_VER) || defined(__BORLANDC__)) \ + && !defined(ACE_LACKS_INLINE_ASSEMBLY) + __asm mov ecx, orig; + __asm mov edx, target; + __asm mov eax, [ecx]; + __asm mov ebx, 4[ecx]; + __asm bswap eax; + __asm bswap ebx; + __asm rol eax, 16; + __asm rol ebx, 16; + __asm mov [edx], eax; + __asm mov 4[edx], ebx; +#elif ACE_SIZEOF_LONG == 8 + // 64 bit architecture. + register unsigned long a = + * reinterpret_cast (orig); + + register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8; + register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8; + + a = (a1 | a2); + + * reinterpret_cast (target) = a; +#else + register ACE_UINT32 a = + * reinterpret_cast (orig); + register ACE_UINT32 b = + * reinterpret_cast (orig + 4); + + register ACE_UINT32 a1 = (a & 0x00ff00ffU) << 8; + register ACE_UINT32 b1 = (b & 0x00ff00ffU) << 8; + register ACE_UINT32 a2 = (a & 0xff00ff00U) >> 8; + register ACE_UINT32 b2 = (b & 0xff00ff00U) >> 8; + + a = (a1 | a2); + b = (b1 | b2); + + * reinterpret_cast (target) = a; + * reinterpret_cast (target + 4) = b; +#endif + orig += 8; + target += 8; + } + } + else + { + // We're out of luck. We have to write in 2 byte chunks. + while (orig < end) + { +#if defined (ACE_HAS_INTEL_ASSEMBLY) + unsigned int a = + * reinterpret_cast (orig); + unsigned int b = + * reinterpret_cast (orig + 4); + asm ( "bswap %1" : "=r" (a) : "0" (a) ); + asm ( "bswap %1" : "=r" (b) : "0" (b) ); + // We're little endian. + * reinterpret_cast (target + 2) + = (unsigned short) (a & 0xffff); + * reinterpret_cast (target + 6) + = (unsigned short) (b & 0xffff); + asm ( "shrl $16, %1" : "=r" (a) : "0" (a) ); + asm ( "shrl $16, %1" : "=r" (b) : "0" (b) ); + * reinterpret_cast (target + 0) + = (unsigned short) (a & 0xffff); + * reinterpret_cast (target + 4) + = (unsigned short) (b & 0xffff); +#elif defined (ACE_HAS_PENTIUM) \ + && (defined (_MSC_VER) || defined (__BORLANDC__)) \ + && !defined (ACE_LACKS_INLINE_ASSEMBLY) + __asm mov ecx, orig; + __asm mov edx, target; + __asm mov eax, [ecx]; + __asm mov ebx, 4[ecx]; + __asm bswap eax; + __asm bswap ebx; + // We're little endian. + __asm mov 2[edx], ax; + __asm mov 6[edx], bx; + __asm shr eax, 16; + __asm shr ebx, 16; + __asm mov 0[edx], ax; + __asm mov 4[edx], bx; +#elif ACE_SIZEOF_LONG == 8 + // 64 bit architecture. + register unsigned long a = + * reinterpret_cast (orig); + + register unsigned long a1 = (a & 0x00ff00ff00ff00ffUL) << 8; + register unsigned long a2 = (a & 0xff00ff00ff00ff00UL) >> 8; + + a = (a1 | a2); + + ACE_UINT16 b1 = static_cast (a >> 48); + ACE_UINT16 b2 = static_cast ((a >> 32) & 0xffff); + ACE_UINT16 b3 = static_cast ((a >> 16) & 0xffff); + ACE_UINT16 b4 = static_cast (a & 0xffff); + +#if defined(ACE_LITTLE_ENDIAN) + * reinterpret_cast (target) = b4; + * reinterpret_cast (target + 2) = b3; + * reinterpret_cast (target + 4) = b2; + * reinterpret_cast (target + 6) = b1; +#else + * reinterpret_cast (target) = b1; + * reinterpret_cast (target + 2) = b2; + * reinterpret_cast (target + 4) = b3; + * reinterpret_cast (target + 6) = b4; +#endif +#else + register ACE_UINT32 a = + * reinterpret_cast (orig); + register ACE_UINT32 b = + * reinterpret_cast (orig + 4); + + register ACE_UINT32 a1 = (a & 0x00ff00ff) << 8; + register ACE_UINT32 b1 = (b & 0x00ff00ff) << 8; + register ACE_UINT32 a2 = (a & 0xff00ff00) >> 8; + register ACE_UINT32 b2 = (b & 0xff00ff00) >> 8; + + a = (a1 | a2); + b = (b1 | b2); + + ACE_UINT32 c1 = static_cast (a >> 16); + ACE_UINT32 c2 = static_cast (a & 0xffff); + ACE_UINT32 c3 = static_cast (b >> 16); + ACE_UINT32 c4 = static_cast (b & 0xffff); + +#if defined(ACE_LITTLE_ENDIAN) + * reinterpret_cast (target) = c2; + * reinterpret_cast (target + 2) = c1; + * reinterpret_cast (target + 4) = c4; + * reinterpret_cast (target + 6) = c3; +#else + * reinterpret_cast (target) = c1; + * reinterpret_cast (target + 2) = c2; + * reinterpret_cast (target + 4) = c3; + * reinterpret_cast (target + 6) = c4; +#endif +#endif + + orig += 8; + target += 8; + } + } + + // (n & 3) == (n % 4). + switch (n&3) { + case 3: + ACE_CDR::swap_2 (orig, target); + orig += 2; + target += 2; + case 2: + ACE_CDR::swap_2 (orig, target); + orig += 2; + target += 2; + case 1: + ACE_CDR::swap_2 (orig, target); + } +} + +void +ACE_CDR::swap_4_array (char const * orig, char* target, size_t n) +{ + // ACE_ASSERT (n > 0); The caller checks that n > 0 + +#if ACE_SIZEOF_LONG == 8 + // Later, we read from *orig in 64 bit chunks, + // so make sure we don't generate unaligned readings. + char const * const o8 = ACE_ptr_align_binary (orig, 8); + // The mismatch can only be by 4. + if (orig != o8) + { + ACE_CDR::swap_4 (orig, target); + orig += 4; + target += 4; + --n; + } +#endif /* ACE_SIZEOF_LONG == 8 */ + + if (n == 0) + return; + + // + // Loop unrolling. Here be dragons. + // + + // (n & (~3)) is the greatest multiple of 4 not bigger than n. + // In the while loop, orig will move over the array by 16 byte + // increments (4 elements of 4 bytes). + // ends marks our barrier for not falling outside. + char const * const end = orig + 4 * (n & (~3)); + +#if ACE_SIZEOF_LONG == 8 + // 64 bits architecture. + // See if we can write in 8 byte chunks. + if (target == ACE_ptr_align_binary (target, 8)) + { + while (orig < end) + { + register unsigned long a = + * reinterpret_cast (orig); + register unsigned long b = + * reinterpret_cast (orig + 8); + +#if defined(ACE_HAS_INTEL_ASSEMBLY) + asm ("bswapq %1" : "=r" (a) : "0" (a)); + asm ("bswapq %1" : "=r" (b) : "0" (b)); + asm ("rol $32, %1" : "=r" (a) : "0" (a)); + asm ("rol $32, %1" : "=r" (b) : "0" (b)); +#else + register unsigned long a84 = (a & 0x000000ff000000ffL) << 24; + register unsigned long b84 = (b & 0x000000ff000000ffL) << 24; + register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8; + register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8; + register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8; + register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8; + register unsigned long a51 = (a & 0xff000000ff000000L) >> 24; + register unsigned long b51 = (b & 0xff000000ff000000L) >> 24; + + a = (a84 | a73 | a62 | a51); + b = (b84 | b73 | b62 | b51); +#endif + + * reinterpret_cast (target) = a; + * reinterpret_cast (target + 8) = b; + + orig += 16; + target += 16; + } + } + else + { + // We are out of luck, we have to write in 4 byte chunks. + while (orig < end) + { + register unsigned long a = + * reinterpret_cast (orig); + register unsigned long b = + * reinterpret_cast (orig + 8); + +#if defined(ACE_HAS_INTEL_ASSEMBLY) + asm ("bswapq %1" : "=r" (a) : "0" (a)); + asm ("bswapq %1" : "=r" (b) : "0" (b)); + asm ("rol $32, %1" : "=r" (a) : "0" (a)); + asm ("rol $32, %1" : "=r" (b) : "0" (b)); +#else + register unsigned long a84 = (a & 0x000000ff000000ffL) << 24; + register unsigned long b84 = (b & 0x000000ff000000ffL) << 24; + register unsigned long a73 = (a & 0x0000ff000000ff00L) << 8; + register unsigned long b73 = (b & 0x0000ff000000ff00L) << 8; + register unsigned long a62 = (a & 0x00ff000000ff0000L) >> 8; + register unsigned long b62 = (b & 0x00ff000000ff0000L) >> 8; + register unsigned long a51 = (a & 0xff000000ff000000L) >> 24; + register unsigned long b51 = (b & 0xff000000ff000000L) >> 24; + + a = (a84 | a73 | a62 | a51); + b = (b84 | b73 | b62 | b51); +#endif + + ACE_UINT32 c1 = static_cast (a >> 32); + ACE_UINT32 c2 = static_cast (a & 0xffffffff); + ACE_UINT32 c3 = static_cast (b >> 32); + ACE_UINT32 c4 = static_cast (b & 0xffffffff); + +#if defined (ACE_LITTLE_ENDIAN) + * reinterpret_cast (target + 0) = c2; + * reinterpret_cast (target + 4) = c1; + * reinterpret_cast (target + 8) = c4; + * reinterpret_cast (target + 12) = c3; +#else + * reinterpret_cast (target + 0) = c1; + * reinterpret_cast (target + 4) = c2; + * reinterpret_cast (target + 8) = c3; + * reinterpret_cast (target + 12) = c4; +#endif + orig += 16; + target += 16; + } + } + +#else /* ACE_SIZEOF_LONG != 8 */ + + while (orig < end) + { +#if defined (ACE_HAS_PENTIUM) && defined (__GNUG__) + register unsigned int a = + *reinterpret_cast (orig); + register unsigned int b = + *reinterpret_cast (orig + 4); + register unsigned int c = + *reinterpret_cast (orig + 8); + register unsigned int d = + *reinterpret_cast (orig + 12); + + asm ("bswap %1" : "=r" (a) : "0" (a)); + asm ("bswap %1" : "=r" (b) : "0" (b)); + asm ("bswap %1" : "=r" (c) : "0" (c)); + asm ("bswap %1" : "=r" (d) : "0" (d)); + + *reinterpret_cast (target) = a; + *reinterpret_cast (target + 4) = b; + *reinterpret_cast (target + 8) = c; + *reinterpret_cast (target + 12) = d; +#elif defined (ACE_HAS_PENTIUM) \ + && (defined (_MSC_VER) || defined (__BORLANDC__)) \ + && !defined (ACE_LACKS_INLINE_ASSEMBLY) + __asm mov eax, orig + __asm mov esi, target + __asm mov edx, [eax] + __asm mov ecx, 4[eax] + __asm mov ebx, 8[eax] + __asm mov eax, 12[eax] + __asm bswap edx + __asm bswap ecx + __asm bswap ebx + __asm bswap eax + __asm mov [esi], edx + __asm mov 4[esi], ecx + __asm mov 8[esi], ebx + __asm mov 12[esi], eax +#else + register ACE_UINT32 a = + * reinterpret_cast (orig); + register ACE_UINT32 b = + * reinterpret_cast (orig + 4); + register ACE_UINT32 c = + * reinterpret_cast (orig + 8); + register ACE_UINT32 d = + * reinterpret_cast (orig + 12); + + // Expect the optimizer reordering this A LOT. + // We leave it this way for clarity. + a = (a << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) | (a >> 24); + b = (b << 24) | ((b & 0xff00) << 8) | ((b & 0xff0000) >> 8) | (b >> 24); + c = (c << 24) | ((c & 0xff00) << 8) | ((c & 0xff0000) >> 8) | (c >> 24); + d = (d << 24) | ((d & 0xff00) << 8) | ((d & 0xff0000) >> 8) | (d >> 24); + + * reinterpret_cast (target) = a; + * reinterpret_cast (target + 4) = b; + * reinterpret_cast (target + 8) = c; + * reinterpret_cast (target + 12) = d; +#endif + + orig += 16; + target += 16; + } + +#endif /* ACE_SIZEOF_LONG == 8 */ + + // (n & 3) == (n % 4). + switch (n & 3) { + case 3: + ACE_CDR::swap_4 (orig, target); + orig += 4; + target += 4; + case 2: + ACE_CDR::swap_4 (orig, target); + orig += 4; + target += 4; + case 1: + ACE_CDR::swap_4 (orig, target); + } +} + +// +// We don't benefit from unrolling in swap_8_array and swap_16_array +// (swap_8 and swap_16 are big enough). +// +void +ACE_CDR::swap_8_array (char const * orig, char* target, size_t n) +{ + // ACE_ASSERT(n > 0); The caller checks that n > 0 + + char const * const end = orig + 8*n; + while (orig < end) + { + swap_8 (orig, target); + orig += 8; + target += 8; + } +} + +void +ACE_CDR::swap_16_array (char const * orig, char* target, size_t n) +{ + // ACE_ASSERT(n > 0); The caller checks that n > 0 + + char const * const end = orig + 16*n; + while (orig < end) + { + swap_16 (orig, target); + orig += 16; + target += 16; + } +} + +void +ACE_CDR::mb_align (ACE_Message_Block *mb) +{ +#if !defined (ACE_CDR_IGNORE_ALIGNMENT) + char * const start = ACE_ptr_align_binary (mb->base (), + ACE_CDR::MAX_ALIGNMENT); +#else + char * const start = mb->base (); +#endif /* ACE_CDR_IGNORE_ALIGNMENT */ + mb->rd_ptr (start); + mb->wr_ptr (start); +} + +int +ACE_CDR::grow (ACE_Message_Block *mb, size_t minsize) +{ + size_t newsize = + ACE_CDR::first_size (minsize + ACE_CDR::MAX_ALIGNMENT); + + if (newsize <= mb->size ()) + return 0; + + ACE_Data_Block *db = + mb->data_block ()->clone_nocopy (0, newsize); + + if (db == 0) + return -1; + + // Do the equivalent of ACE_CDR::mb_align() here to avoid having + // to allocate an ACE_Message_Block on the stack thereby avoiding + // the manipulation of the data blocks reference count + size_t mb_len = mb->length (); + char *start = ACE_ptr_align_binary (db->base (), + ACE_CDR::MAX_ALIGNMENT); + + ACE_OS::memcpy (start, mb->rd_ptr (), mb_len); + mb->data_block (db); + + // Setting the data block on the mb resets the read and write + // pointers back to the beginning. We must set the rd_ptr to the + // aligned start and adjust the write pointer to the end + mb->rd_ptr (start); + mb->wr_ptr (start + mb_len); + + // Remove the DONT_DELETE flags from mb + mb->clr_self_flags (ACE_Message_Block::DONT_DELETE); + + return 0; +} + +size_t +ACE_CDR::total_length (const ACE_Message_Block* begin, + const ACE_Message_Block* end) +{ + size_t l = 0; + // Compute the total size. + for (const ACE_Message_Block *i = begin; + i != end; + i = i->cont ()) + l += i->length (); + return l; +} + +int +ACE_CDR::consolidate (ACE_Message_Block *dst, + const ACE_Message_Block *src) +{ + if (src == 0) + return 0; + + size_t const newsize = + ACE_CDR::first_size (ACE_CDR::total_length (src, 0) + + ACE_CDR::MAX_ALIGNMENT); + + if (dst->size (newsize) == -1) + return -1; + +#if !defined (ACE_CDR_IGNORE_ALIGNMENT) + // We must copy the contents of src into the new buffer, but + // respecting the alignment. + ptrdiff_t srcalign = + ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t dstalign = + ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t offset = srcalign - dstalign; + if (offset < 0) + offset += ACE_CDR::MAX_ALIGNMENT; + dst->rd_ptr (static_cast (offset)); + dst->wr_ptr (dst->rd_ptr ()); +#endif /* ACE_CDR_IGNORE_ALIGNMENT */ + + for (const ACE_Message_Block* i = src; + i != 0; + i = i->cont ()) + { + // If the destination and source are the same, do not + // attempt to copy the data. Just update the write pointer. + if (dst->wr_ptr () != i->rd_ptr ()) + dst->copy (i->rd_ptr (), i->length ()); + else + dst->wr_ptr (i->length ()); + } + return 0; +} + +#if defined (NONNATIVE_LONGLONG) +bool +ACE_CDR::LongLong::operator== (const ACE_CDR::LongLong &rhs) const +{ + return this->h == rhs.h && this->l == rhs.l; +} + +bool +ACE_CDR::LongLong::operator!= (const ACE_CDR::LongLong &rhs) const +{ + return this->l != rhs.l || this->h != rhs.h; +} + +#endif /* NONNATIVE_LONGLONG */ + +#if defined (NONNATIVE_LONGDOUBLE) +ACE_CDR::LongDouble& +ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs) +{ + ACE_OS::memset (this->ld, 0, sizeof (this->ld)); + + if (sizeof (rhs) == 8) + { +#if defined (ACE_LITTLE_ENDIAN) + static const size_t byte_zero = 1; + static const size_t byte_one = 0; + char rhs_ptr[16]; + ACE_CDR::swap_8 (reinterpret_cast (&rhs), rhs_ptr); +#else + static const size_t byte_zero = 0; + static const size_t byte_one = 1; + const char* rhs_ptr = reinterpret_cast (&rhs); +#endif + ACE_INT16 sign = static_cast ( + static_cast (rhs_ptr[0])) & 0x8000; + ACE_INT16 exponent = ((rhs_ptr[0] & 0x7f) << 4) | + ((rhs_ptr[1] >> 4) & 0xf); + const char* exp_ptr = reinterpret_cast (&exponent); + + // Infinity and NaN have an exponent of 0x7ff in 64-bit IEEE + if (exponent == 0x7ff) + { + exponent = 0x7fff; + } + else + { + exponent = (exponent - max_eleven_bit) + max_fifteen_bit; + } + exponent |= sign; + + // Store the sign bit and exponent + this->ld[0] = exp_ptr[byte_zero]; + this->ld[1] = exp_ptr[byte_one]; + + // Store the mantissa. In an 8 byte double, it is split by + // 4 bits (because of the 12 bits for sign and exponent), so + // we have to shift and or the rhs to get the right bytes. + size_t li = 2; + bool direction = true; + for (size_t ri = 1; ri < sizeof (rhs);) + { + if (direction) + { + this->ld[li] |= ((rhs_ptr[ri] << 4) & 0xf0); + direction = false; + ++ri; + } + else + { + this->ld[li] |= ((rhs_ptr[ri] >> 4) & 0xf); + direction = true; + ++li; + } + } +#if defined (ACE_LITTLE_ENDIAN) + ACE_OS::memcpy (rhs_ptr, this->ld, sizeof (this->ld)); + ACE_CDR::swap_16 (rhs_ptr, this->ld); +#endif + } + else + { + ACE_OS::memcpy(this->ld, + reinterpret_cast (&rhs), sizeof (rhs)); + } + return *this; +} + +ACE_CDR::LongDouble& +ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble& rhs) +{ + if (this != &rhs) + *this = rhs; + return *this; +} + +bool +ACE_CDR::LongDouble::operator== (const ACE_CDR::LongDouble &rhs) const +{ + return ACE_OS::memcmp (this->ld, rhs.ld, 16) == 0; +} + +bool +ACE_CDR::LongDouble::operator!= (const ACE_CDR::LongDouble &rhs) const +{ + return ACE_OS::memcmp (this->ld, rhs.ld, 16) != 0; +} + +ACE_CDR::LongDouble::operator ACE_CDR::LongDouble::NativeImpl () const +{ + ACE_CDR::LongDouble::NativeImpl ret = 0.0; + char* lhs_ptr = reinterpret_cast (&ret); + + if (sizeof (ret) == 8) + { +#if defined (ACE_LITTLE_ENDIAN) + static const size_t byte_zero = 1; + static const size_t byte_one = 0; + char copy[16]; + ACE_CDR::swap_16 (this->ld, copy); +#else + static const size_t byte_zero = 0; + static const size_t byte_one = 1; + const char* copy = this->ld; +#endif + ACE_INT16 exponent = 0; + char* exp_ptr = reinterpret_cast (&exponent); + exp_ptr[byte_zero] = copy[0]; + exp_ptr[byte_one] = copy[1]; + + ACE_INT16 sign = (exponent & 0x8000); + exponent &= 0x7fff; + + // Infinity and NaN have an exponent of 0x7fff in 128-bit IEEE + if (exponent == 0x7fff) + { + exponent = 0x7ff; + } + else + { + exponent = (exponent - max_fifteen_bit) + max_eleven_bit; + } + exponent = (exponent << 4) | sign; + + // Store the sign and exponent + lhs_ptr[0] = exp_ptr[byte_zero]; + lhs_ptr[1] = exp_ptr[byte_one]; + + // Store the mantissa. In an 8 byte double, it is split by + // 4 bits (because of the 12 bits for sign and exponent), so + // we have to shift and or the rhs to get the right bytes. + size_t li = 1; + bool direction = true; + for (size_t ri = 2; li < sizeof (ret);) { + if (direction) + { + lhs_ptr[li] |= ((copy[ri] >> 4) & 0xf); + direction = false; + ++li; + } + else + { + lhs_ptr[li] |= ((copy[ri] & 0xf) << 4); + direction = true; + ++ri; + } + } + +#if defined (ACE_LITTLE_ENDIAN) + ACE_CDR::swap_8 (lhs_ptr, lhs_ptr); +#endif + } + else + { + ACE_OS::memcpy(lhs_ptr, this->ld, sizeof (ret)); + } + + // This bit of code is unnecessary. However, this code is + // necessary to work around a bug in the gcc 4.1.1 optimizer. + ACE_CDR::LongDouble tmp; + tmp.assign (ret); + + return ret; +} +#endif /* NONNATIVE_LONGDOUBLE */ + +#if defined(_UNICOS) && !defined(_CRAYMPP) +// placeholders to get things compiling +ACE_CDR::Float::Float (void) +{ +} + +ACE_CDR::Float::Float (const float & /* init */) +{ +} + +ACE_CDR::Float & +ACE_CDR::Float::operator= (const float & /* rhs */) +{ + return *this; +} + +bool +ACE_CDR::Float::operator!= (const ACE_CDR::Float & /* rhs */) const +{ + return false; +} +#endif /* _UNICOS */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/CDR_Base.h b/externals/ace/CDR_Base.h new file mode 100644 index 0000000..12b4a49 --- /dev/null +++ b/externals/ace/CDR_Base.h @@ -0,0 +1,382 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CDR_Base.h + * + * $Id: CDR_Base.h 88488 2010-01-12 14:20:13Z olli $ + * + * ACE Common Data Representation (CDR) basic types. + * + * The current implementation assumes that the host has 1-byte, + * 2-byte and 4-byte integral types, and that it has single + * precision and double precision IEEE floats. + * Those assumptions are pretty good these days, with Crays being + * the only known exception. + * + * + * @author TAO version by + * @author Aniruddha Gokhale + * @author Carlos O'Ryan + * @author ACE version by + * @author Jeff Parsons + * @author Istvan Buki + */ +//============================================================================= + + +#ifndef ACE_CDR_BASE_H +#define ACE_CDR_BASE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Basic_Types.h" +#include "ace/Default_Constants.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Stuff used by the ACE CDR classes. Watch these values... they're also used +// in the ACE_CDR Byte_Order enum below. +#if defined ACE_LITTLE_ENDIAN +# define ACE_CDR_BYTE_ORDER 1 +// little endian encapsulation byte order has value = 1 +#else /* ! ACE_LITTLE_ENDIAN */ +# define ACE_CDR_BYTE_ORDER 0 +// big endian encapsulation byte order has value = 0 +#endif /* ! ACE_LITTLE_ENDIAN */ + +class ACE_Message_Block; + +/** + * @class ACE_CDR + * + * @brief Keep constants and some routines common to both Output and + * Input CDR streams. + */ +class ACE_Export ACE_CDR +{ +public: + // = Constants defined by the CDR protocol. + // By defining as many of these constants as possible as enums we + // ensure they get inlined and avoid pointless static memory + // allocations. + + enum + { + // Note that some of these get reused as part of the standard + // binary format: unsigned is the same size as its signed cousin, + // float is LONG_SIZE, and double is LONGLONG_SIZE. + + OCTET_SIZE = 1, + SHORT_SIZE = 2, + LONG_SIZE = 4, + LONGLONG_SIZE = 8, + LONGDOUBLE_SIZE = 16, + + OCTET_ALIGN = 1, + SHORT_ALIGN = 2, + LONG_ALIGN = 4, + LONGLONG_ALIGN = 8, + /// @note the CORBA LongDouble alignment requirements do not + /// match its size... + LONGDOUBLE_ALIGN = 8, + + /// Maximal CDR 1.1 alignment: "quad precision" FP (i.e. "CDR::Long + /// double", size as above). + MAX_ALIGNMENT = 8, + + /// The default buffer size. + /** + * @todo We want to add options to control this + * default value, so this constant should be read as the default + * default value ;-) + */ + DEFAULT_BUFSIZE = ACE_DEFAULT_CDR_BUFSIZE, + + /// The buffer size grows exponentially until it reaches this size; + /// afterwards it grows linearly using the next constant + EXP_GROWTH_MAX = ACE_DEFAULT_CDR_EXP_GROWTH_MAX, + + /// Once exponential growth is ruled out the buffer size increases + /// in chunks of this size, note that this constants have the same + /// value right now, but it does not need to be so. + LINEAR_GROWTH_CHUNK = ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK + }; + + /** + * @enum Byte_Order + * + * Defines values for the byte_order argument to ACE_OutputCDR and + * ACE_InputCDR. + */ + enum Byte_Order + { + /// Use big-endian order (also known as network byte order). + BYTE_ORDER_BIG_ENDIAN = 0, + /// Use little-endian order. + BYTE_ORDER_LITTLE_ENDIAN = 1, + /// Use whichever byte order is native to this machine. + BYTE_ORDER_NATIVE = ACE_CDR_BYTE_ORDER + }; + + /** + * Do byte swapping for each basic IDL type size. There exist only + * routines to put byte, halfword (2 bytes), word (4 bytes), + * doubleword (8 bytes) and quadword (16 byte); because those are + * the IDL basic type sizes. + */ + static void swap_2 (char const *orig, char *target); + static void swap_4 (char const *orig, char *target); + static void swap_8 (char const *orig, char *target); + static void swap_16 (char const *orig, char *target); + static void swap_2_array (char const *orig, + char *target, + size_t length); + static void swap_4_array (char const *orig, + char *target, + size_t length); + static void swap_8_array (char const *orig, + char *target, + size_t length); + static void swap_16_array (char const *orig, + char *target, + size_t length); + + /// Align the message block to ACE_CDR::MAX_ALIGNMENT, + /// set by the CORBA spec at 8 bytes. + static void mb_align (ACE_Message_Block *mb); + + /** + * Compute the size of the smallest buffer that can contain at least + * @a minsize bytes. + * To understand how a "best fit" is computed look at the + * algorithm in the code. + * Basically the buffers grow exponentially, up to a certain point, + * then the buffer size grows linearly. + * The advantage of this algorithm is that is rapidly grows to a + * large value, but does not explode at the end. + */ + static size_t first_size (size_t minsize); + + /// Compute not the smallest, but the second smallest buffer that + /// will fir @a minsize bytes. + static size_t next_size (size_t minsize); + + /** + * Increase the capacity of mb to contain at least @a minsize bytes. + * If @a minsize is zero the size is increased by an amount at least + * large enough to contain any of the basic IDL types. + * @retval -1 Failure + * @retval 0 Success. + */ + static int grow (ACE_Message_Block *mb, size_t minsize); + + /** + * Copy a message block chain into a single message block, + * preserving the alignment of the first message block of the + * original stream, not the following message blocks. + * @retval -1 Failure + * @retval 0 Success. + */ + static int consolidate (ACE_Message_Block *dst, + const ACE_Message_Block *src); + + static size_t total_length (const ACE_Message_Block *begin, + const ACE_Message_Block *end); + + /** + * @name Basic OMG IDL Types + * + * These types are for use in the CDR classes. The cleanest way to + * avoid complaints from all compilers is to define them all. + */ + //@{ + typedef bool Boolean; + typedef unsigned char Octet; + typedef char Char; + typedef ACE_WCHAR_T WChar; + typedef ACE_INT16 Short; + typedef ACE_UINT16 UShort; + typedef ACE_INT32 Long; + typedef ACE_UINT32 ULong; + typedef ACE_UINT64 ULongLong; + +# if (defined (_MSC_VER)) || (defined (__BORLANDC__)) + typedef __int64 LongLong; +# elif ACE_SIZEOF_LONG == 8 && !defined(_CRAYMPP) + typedef long LongLong; +# elif defined(__TANDEM) + typedef long long LongLong; +# elif ACE_SIZEOF_LONG_LONG == 8 && !defined (ACE_LACKS_LONGLONG_T) +# if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T) + // sun #defines u_longlong_t, maybe other platforms do also. + // Use it, at least with g++, so that its -pedantic doesn't + // complain about no ANSI C++ long long. + typedef longlong_t LongLong; +# else + typedef long long LongLong; +# endif /* sun */ +# else /* no native 64 bit integer type */ +# define NONNATIVE_LONGLONG + struct ACE_Export LongLong + { +# if defined (ACE_BIG_ENDIAN) + ACE_CDR::Long h; + ACE_CDR::Long l; +# else + ACE_CDR::Long l; + ACE_CDR::Long h; +# endif /* ! ACE_BIG_ENDIAN */ + + /** + * @name Overloaded Relation Operators. + * + * The canonical comparison operators. + */ + //@{ + bool operator== (const LongLong &rhs) const; + bool operator!= (const LongLong &rhs) const; + //@} + }; +# endif /* no native 64 bit integer type */ + +# if defined (NONNATIVE_LONGLONG) +# define ACE_CDR_LONGLONG_INITIALIZER {0,0} +# else +# define ACE_CDR_LONGLONG_INITIALIZER 0 +# endif /* NONNATIVE_LONGLONG */ + +# if ACE_SIZEOF_FLOAT == 4 + typedef float Float; +# else /* ACE_SIZEOF_FLOAT != 4 */ + struct Float + { +# if ACE_SIZEOF_INT == 4 + // Use unsigned int to get word alignment. + unsigned int f; +# else /* ACE_SIZEOF_INT != 4 */ + // Applications will probably have trouble with this. + char f[4]; +# if defined(_UNICOS) && !defined(_CRAYMPP) + Float (void); + Float (const float &init); + Float & operator= (const float &rhs); + bool operator!= (const Float &rhs) const; +# endif /* _UNICOS */ +# endif /* ACE_SIZEOF_INT != 4 */ + }; +# endif /* ACE_SIZEOF_FLOAT != 4 */ + +# if ACE_SIZEOF_DOUBLE == 8 + typedef double Double; +# else /* ACE_SIZEOF_DOUBLE != 8 */ + struct Double + { +# if ACE_SIZEOF_LONG == 8 + // Use u long to get word alignment. + unsigned long f; +# else /* ACE_SIZEOF_INT != 8 */ + // Applications will probably have trouble with this. + char f[8]; +# endif /* ACE_SIZEOF_INT != 8 */ + }; +# endif /* ACE_SIZEOF_DOUBLE != 8 */ + + // 94-9-32 Appendix A defines a 128 bit floating point "long + // double" data type, with greatly extended precision and four + // more bits of exponent (compared to "double"). This is an IDL + // extension, not yet standard. + +# if ACE_SIZEOF_LONG_DOUBLE == 16 + typedef long double LongDouble; +# define ACE_CDR_LONG_DOUBLE_INITIALIZER 0 +# define ACE_CDR_LONG_DOUBLE_ASSIGNMENT(LHS, RHS) LHS = RHS +# else +# define NONNATIVE_LONGDOUBLE +# define ACE_CDR_LONG_DOUBLE_INITIALIZER {{0}} +# define ACE_CDR_LONG_DOUBLE_ASSIGNMENT(LHS, RHS) LHS.assign (RHS) + struct ACE_Export LongDouble + { + // VxWorks' compiler (gcc 2.96) gets confused by the operator long + // double, so we avoid using long double as the NativeImpl. + // Linux's x86 long double format (12 or 16 bytes) is incompatible + // with Windows, Solaris, AIX, MacOS X and HP-UX (and probably others) + // long double format (8 or 16 bytes). If you need 32-bit Linux to + // inter-operate with 64-bit Linux you will want to define this + // macro to 0 so that "long double" is used. Otherwise, do not define + // this macro. +# if defined (ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE) && \ + (ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE == 1) + typedef double NativeImpl; +# else + typedef long double NativeImpl; +# endif /* ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE==1 */ + + char ld[16]; + + LongDouble& assign (const NativeImpl& rhs); + LongDouble& assign (const LongDouble& rhs); + + bool operator== (const LongDouble &rhs) const; + bool operator!= (const LongDouble &rhs) const; + + LongDouble& operator*= (const NativeImpl rhs) { + return this->assign (static_cast (*this) * rhs); + } + LongDouble& operator/= (const NativeImpl rhs) { + return this->assign (static_cast (*this) / rhs); + } + LongDouble& operator+= (const NativeImpl rhs) { + return this->assign (static_cast (*this) + rhs); + } + LongDouble& operator-= (const NativeImpl rhs) { + return this->assign (static_cast (*this) - rhs); + } + LongDouble& operator++ () { + return this->assign (static_cast (*this) + 1); + } + LongDouble& operator-- () { + return this->assign (static_cast (*this) - 1); + } + LongDouble operator++ (int) { + LongDouble ldv = *this; + this->assign (static_cast (*this) + 1); + return ldv; + } + LongDouble operator-- (int) { + LongDouble ldv = *this; + this->assign (static_cast (*this) - 1); + return ldv; + } + + operator NativeImpl () const; + }; +# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */ + + //@} + +#if !defined (ACE_CDR_GIOP_MAJOR_VERSION) +# define ACE_CDR_GIOP_MAJOR_VERSION 1 +#endif /*ACE_CDR_GIOP_MAJOR_VERSION */ + +#if !defined (ACE_CDR_GIOP_MINOR_VERSION) +# define ACE_CDR_GIOP_MINOR_VERSION 2 +#endif /* ACE_CDR_GIOP_MINOR_VERSION */ +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +# include "ace/CDR_Base.inl" +#endif /* __ACE_INLINE__ */ + + +#include /**/ "ace/post.h" + +#endif /* ACE_CDR_BASE_H */ diff --git a/externals/ace/CDR_Base.inl b/externals/ace/CDR_Base.inl new file mode 100644 index 0000000..8537317 --- /dev/null +++ b/externals/ace/CDR_Base.inl @@ -0,0 +1,255 @@ +// -*- C++ -*- +// +// $Id: CDR_Base.inl 80826 2008-03-04 14:51:23Z wotte $ + +#if defined (ACE_HAS_INTRINSIC_BYTESWAP) +// Take advantage of MSVC++ byte swapping compiler intrinsics (found +// in ). +# pragma intrinsic (_byteswap_ushort, _byteswap_ulong, _byteswap_uint64) +#endif /* ACE_HAS_INTRINSIC_BYTESWAP */ + +#if defined (ACE_HAS_BSWAP_16) || defined (ACE_HAS_BSWAP_32) || defined (ACE_HAS_BSWAP_64) +# include "ace/os_include/os_byteswap.h" +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// +// The ACE_CDR::swap_X and ACE_CDR::swap_X_array routines are broken +// in 5 cases for optimization: +// +// * MSVC++ 7.1 or better +// => Compiler intrinsics +// +// * AMD64 CPU + gnu g++ +// => gcc amd64 inline assembly. +// +// * x86 Pentium CPU + gnu g++ +// (ACE_HAS_PENTIUM && __GNUG__) +// => gcc x86 inline assembly. +// +// * x86 Pentium CPU and (_MSC_VER) or BORLAND C++) +// (ACE_HAS_PENTIUM && ( _MSC_VER || __BORLANDC__ ) +// => MSC x86 inline assembly. +// +// * 64 bit architecture +// (ACE_SIZEOF_LONG == 8) +// => shift/masks using 64bit words. +// +// * default +// (none of the above) +// => shift/masks using 32bit words. +// +// +// Some things you could find useful to know if you intend to mess +// with this optimizations for swaps: +// +// * MSVC++ don't assume register values are conserved between +// statements. So you can clobber any register you want, +// whenever you want (well not *anyone* really, see manual). +// The MSVC++ optimizer will try to pick different registers +// for the C++ statements sorrounding your asm block, and if +// it's not possible will use the stack. +// +// * If you clobber registers with asm statements in gcc, you +// better do it in an asm-only function, or save/restore them +// before/after in the stack. If not, sorrounding C statements +// could end using the same registers and big-badda-bum (been +// there, done that...). The big-badda-bum could happen *even +// if you specify the clobbered register in your asm's*. +// Even better, use gcc asm syntax for detecting the register +// asigned to a certain variable so you don't have to clobber any +// register directly. +// + +ACE_INLINE void +ACE_CDR::swap_2 (const char *orig, char* target) +{ +#if defined (ACE_HAS_INTRINSIC_BYTESWAP) + // Take advantage of MSVC++ compiler intrinsic byte swapping + // function. + *reinterpret_cast (target) = + _byteswap_ushort (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BSWAP16) + *reinterpret_cast (target) = + bswap16 (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BSWAP_16) + *reinterpret_cast (target) = + bswap_16 (*reinterpret_cast (orig)); +#elif defined(ACE_HAS_INTEL_ASSEMBLY) + unsigned short a = + *reinterpret_cast (orig); + asm( "rolw $8, %0" : "=r" (a) : "0" (a) ); + *reinterpret_cast (target) = a; +#elif defined (ACE_HAS_PENTIUM) \ + && (defined(_MSC_VER) || defined(__BORLANDC__)) \ + && !defined(ACE_LACKS_INLINE_ASSEMBLY) + __asm mov ebx, orig; + __asm mov ecx, target; + __asm mov ax, [ebx]; + __asm rol ax, 8; + __asm mov [ecx], ax; +#else + register ACE_UINT16 usrc = * reinterpret_cast (orig); + register ACE_UINT16* udst = reinterpret_cast (target); + *udst = (usrc << 8) | (usrc >> 8); +#endif /* ACE_HAS_PENTIUM */ +} + +ACE_INLINE void +ACE_CDR::swap_4 (const char* orig, char* target) +{ +#if defined (ACE_HAS_INTRINSIC_BYTESWAP) + // Take advantage of MSVC++ compiler intrinsic byte swapping + // function. + *reinterpret_cast (target) = + _byteswap_ulong (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BSWAP32) + *reinterpret_cast (target) = + bswap32 (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BSWAP_32) + *reinterpret_cast (target) = + bswap_32 (*reinterpret_cast (orig)); +#elif defined(ACE_HAS_INTEL_ASSEMBLY) + // We have ACE_HAS_PENTIUM, so we know the sizeof's. + register unsigned int j = + *reinterpret_cast (orig); + asm ("bswap %1" : "=r" (j) : "0" (j)); + *reinterpret_cast (target) = j; +#elif defined(ACE_HAS_PENTIUM) \ + && (defined(_MSC_VER) || defined(__BORLANDC__)) \ + && !defined(ACE_LACKS_INLINE_ASSEMBLY) + __asm mov ebx, orig; + __asm mov ecx, target; + __asm mov eax, [ebx]; + __asm bswap eax; + __asm mov [ecx], eax; +#else + register ACE_UINT32 x = * reinterpret_cast (orig); + x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); + * reinterpret_cast (target) = x; +#endif /* ACE_HAS_INTRINSIC_BYTESWAP */ +} + +ACE_INLINE void +ACE_CDR::swap_8 (const char* orig, char* target) +{ +#if defined (ACE_HAS_INTRINSIC_BYTESWAP) + // Take advantage of MSVC++ compiler intrinsic byte swapping + // function. + *reinterpret_cast (target) = + _byteswap_uint64 (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BSWAP64) + *reinterpret_cast (target) = + bswap64 (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BSWAP_64) + *reinterpret_cast (target) = + bswap_64 (*reinterpret_cast (orig)); +#elif (defined (__amd64__) || defined (__x86_64__)) && defined(__GNUG__) + register unsigned long x = + * reinterpret_cast (orig); + asm ("bswapq %1" : "=r" (x) : "0" (x)); + *reinterpret_cast (target) = x; +#elif defined(ACE_HAS_PENTIUM) && defined(__GNUG__) + register unsigned int i = + *reinterpret_cast (orig); + register unsigned int j = + *reinterpret_cast (orig + 4); + asm ("bswap %1" : "=r" (i) : "0" (i)); + asm ("bswap %1" : "=r" (j) : "0" (j)); + *reinterpret_cast (target + 4) = i; + *reinterpret_cast (target) = j; +#elif defined(ACE_HAS_PENTIUM) \ + && (defined(_MSC_VER) || defined(__BORLANDC__)) \ + && !defined(ACE_LACKS_INLINE_ASSEMBLY) + __asm mov ecx, orig; + __asm mov edx, target; + __asm mov eax, [ecx]; + __asm mov ebx, 4[ecx]; + __asm bswap eax; + __asm bswap ebx; + __asm mov 4[edx], eax; + __asm mov [edx], ebx; +#elif ACE_SIZEOF_LONG == 8 + // 64 bit architecture. + register unsigned long x = + * reinterpret_cast (orig); + register unsigned long x84 = (x & 0x000000ff000000ffUL) << 24; + register unsigned long x73 = (x & 0x0000ff000000ff00UL) << 8; + register unsigned long x62 = (x & 0x00ff000000ff0000UL) >> 8; + register unsigned long x51 = (x & 0xff000000ff000000UL) >> 24; + x = (x84 | x73 | x62 | x51); + x = (x << 32) | (x >> 32); + *reinterpret_cast (target) = x; +#else + register ACE_UINT32 x = + * reinterpret_cast (orig); + register ACE_UINT32 y = + * reinterpret_cast (orig + 4); + x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); + y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24); + * reinterpret_cast (target) = y; + * reinterpret_cast (target + 4) = x; +#endif /* ACE_HAS_INTRINSIC_BYTESWAP */ +} + +ACE_INLINE void +ACE_CDR::swap_16 (const char* orig, char* target) +{ + swap_8 (orig + 8, target); + swap_8 (orig, target + 8); +} + +ACE_INLINE size_t +ACE_CDR::first_size (size_t minsize) +{ + if (minsize == 0) + return ACE_CDR::DEFAULT_BUFSIZE; + + size_t newsize = ACE_CDR::DEFAULT_BUFSIZE; + while (newsize < minsize) + { + if (newsize < ACE_CDR::EXP_GROWTH_MAX) + { + // We grow exponentially at the beginning, this is fast and + // reduces the number of allocations. + + // Quickly multiply by two using a bit shift. This is + // guaranteed to work since the variable is an unsigned + // integer. + newsize <<= 1; + } + else + { + // but continuing with exponential growth can result in over + // allocations and easily yield an allocation failure. + // So we grow linearly when the buffer is too big. + newsize += ACE_CDR::LINEAR_GROWTH_CHUNK; + } + } + return newsize; +} + +ACE_INLINE size_t +ACE_CDR::next_size (size_t minsize) +{ + size_t newsize = ACE_CDR::first_size (minsize); + + if (newsize == minsize) + { + // If necessary increment the size + if (newsize < ACE_CDR::EXP_GROWTH_MAX) + // Quickly multiply by two using a bit shift. This is + // guaranteed to work since the variable is an unsigned + // integer. + newsize <<= 1; + else + newsize += ACE_CDR::LINEAR_GROWTH_CHUNK; + } + + return newsize; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +// **************************************************************** diff --git a/externals/ace/CDR_Size.cpp b/externals/ace/CDR_Size.cpp new file mode 100644 index 0000000..9697092 --- /dev/null +++ b/externals/ace/CDR_Size.cpp @@ -0,0 +1,262 @@ +#include "ace/CDR_Size.h" +#include "ace/SString.h" +#include "ace/OS_Memory.h" +#include "ace/Truncate.h" + +#if !defined (__ACE_INLINE__) +# include "ace/CDR_Size.inl" +#endif /* ! __ACE_INLINE__ */ + +ACE_RCSID (ace, + CDR_Size, + "$Id: CDR_Size.cpp 82559 2008-08-07 20:23:07Z parsons $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_CDR::Boolean +ACE_SizeCDR::write_wchar (ACE_CDR::WChar x) +{ + // Note: translator framework is not supported. + // + if (ACE_OutputCDR::wchar_maxbytes () == 0) + { + errno = EACCES; + return (this->good_bit_ = false); + } + + if (static_cast (major_version_) == 1 + && static_cast (minor_version_) == 2) + { + ACE_CDR::Octet len = + static_cast (ACE_OutputCDR::wchar_maxbytes ()); + + if (this->write_1 (&len)) + { + if (ACE_OutputCDR::wchar_maxbytes () == sizeof(ACE_CDR::WChar)) + { + return + this->write_octet_array ( + reinterpret_cast (&x), + static_cast (len)); + } + else + { + if (ACE_OutputCDR::wchar_maxbytes () == 2) + { + ACE_CDR::Short sx = static_cast (x); + return + this->write_octet_array ( + reinterpret_cast (&sx), + static_cast (len)); + } + else + { + ACE_CDR::Octet ox = static_cast (x); + return + this->write_octet_array ( + reinterpret_cast (&ox), + static_cast (len)); + } + } + } + } + else if (static_cast (minor_version_) == 0) + { // wchar is not allowed with GIOP 1.0. + errno = EINVAL; + return (this->good_bit_ = false); + } + + if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) + { + const void *temp = &x; + return this->write_4 (reinterpret_cast (temp)); + } + else if (ACE_OutputCDR::wchar_maxbytes () == 2) + { + ACE_CDR::Short sx = static_cast (x); + return this->write_2 (reinterpret_cast (&sx)); + } + + ACE_CDR::Octet ox = static_cast (x); + return this->write_1 (reinterpret_cast (&ox)); +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_string (ACE_CDR::ULong len, + const ACE_CDR::Char *x) +{ + // Note: translator framework is not supported. + // + if (len != 0) + { + if (this->write_ulong (len + 1)) + return this->write_char_array (x, len + 1); + } + else + { + // Be nice to programmers: treat nulls as empty strings not + // errors. (OMG-IDL supports languages that don't use the C/C++ + // notion of null v. empty strings; nulls aren't part of the OMG-IDL + // string model.) + if (this->write_ulong (1)) + return this->write_char (0); + } + + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_string (const ACE_CString &x) +{ + // @@ Leave this method in here, not the `.i' file so that we don't + // have to unnecessarily pull in the `ace/SString.h' header. + return this->write_string (static_cast (x.length ()), + x.c_str()); +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_wstring (ACE_CDR::ULong len, + const ACE_CDR::WChar *x) +{ + // Note: translator framework is not supported. + // + if (ACE_OutputCDR::wchar_maxbytes () == 0) + { + errno = EACCES; + return (this->good_bit_ = false); + } + + if (static_cast (this->major_version_) == 1 + && static_cast (this->minor_version_) == 2) + { + if (x != 0) + { + //In GIOP 1.2 the length field contains the number of bytes + //the wstring occupies rather than number of wchars + //Taking sizeof might not be a good way! This is a temporary fix. + ACE_CDR::Boolean good_ulong = + this->write_ulong ( + ACE_Utils::truncate_cast ( + ACE_OutputCDR::wchar_maxbytes () * len)); + + if (good_ulong) + { + return this->write_wchar_array (x, len); + } + } + else + { + //In GIOP 1.2 zero length wstrings are legal + return this->write_ulong (0); + } + } + + else + if (x != 0) + { + if (this->write_ulong (len + 1)) + return this->write_wchar_array (x, len + 1); + } + else if (this->write_ulong (1)) + return this->write_wchar (0); + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_1 (const ACE_CDR::Octet *) +{ + this->adjust (1); + return true; +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_2 (const ACE_CDR::UShort *) +{ + this->adjust (ACE_CDR::SHORT_SIZE); + return true; +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_4 (const ACE_CDR::ULong *) +{ + this->adjust (ACE_CDR::LONG_SIZE); + return true; +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_8 (const ACE_CDR::ULongLong *) +{ + this->adjust (ACE_CDR::LONGLONG_SIZE); + return true; +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_16 (const ACE_CDR::LongDouble *) +{ + this->adjust (ACE_CDR::LONGDOUBLE_SIZE, + ACE_CDR::LONGDOUBLE_ALIGN); + return true; +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_wchar_array_i (const ACE_CDR::WChar *, + ACE_CDR::ULong length) +{ + if (length == 0) + return true; + + size_t const align = (ACE_OutputCDR::wchar_maxbytes () == 2) ? + ACE_CDR::SHORT_ALIGN : + ACE_CDR::OCTET_ALIGN; + + this->adjust (ACE_OutputCDR::wchar_maxbytes () * length, align); + return true; +} + + +ACE_CDR::Boolean +ACE_SizeCDR::write_array (const void *, + size_t size, + size_t align, + ACE_CDR::ULong length) +{ + if (length == 0) + return true; + + this->adjust (size * length, align); + return true; +} + +ACE_CDR::Boolean +ACE_SizeCDR::write_boolean_array (const ACE_CDR::Boolean*, + ACE_CDR::ULong length) +{ + this->adjust (length, 1); + return true; +} + +void +ACE_SizeCDR::adjust (size_t size) +{ + adjust (size, size); +} + +void +ACE_SizeCDR::adjust (size_t size, + size_t align) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + const size_t offset = ACE_align_binary (size_, align) - size_; + size_ += offset; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + size_ += size; +} + +ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, const ACE_CString &x) +{ + ss.write_string (x); + return ss.good_bit (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/CDR_Size.h b/externals/ace/CDR_Size.h new file mode 100644 index 0000000..a0b3c46 --- /dev/null +++ b/externals/ace/CDR_Size.h @@ -0,0 +1,241 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CDR_Size.h + * + * $Id: CDR_Size.h 80826 2008-03-04 14:51:23Z wotte $ + * + * + * ACE Common Data Representation (CDR) size-calculating stream. + * + * + * The current implementation assumes that the host has 1-byte, + * 2-byte and 4-byte integral types, and that it has single + * precision and double precision IEEE floats. + * Those assumptions are pretty good these days, with Crays beign + * the only known exception. + * + * + * @author Boris Kolpackov + * + */ +//============================================================================= + +#ifndef ACE_CDR_SIZE_H +#define ACE_CDR_SIZE_H + +#include /**/ "ace/pre.h" + +#include "ace/CDR_Base.h" +#include "ace/CDR_Stream.h" // for ACE_OutputCDR::from_* + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SStringfwd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_SizeCDR + * + * @brief A CDR stream for calculating size of the representation. + * + */ +class ACE_Export ACE_SizeCDR +{ +public: + /// Default constructor. + ACE_SizeCDR (ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// Returns @c false if an error has ocurred. + bool good_bit (void) const; + + + /// Reset current size. + void reset (void); + + + /// Return current size. + size_t total_length (void) const; + + + // Return 0 on failure and 1 on success. + //@{ @name Size-calculating pseudo-write operations + ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x); + ACE_CDR::Boolean write_char (ACE_CDR::Char x); + ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x); + ACE_CDR::Boolean write_octet (ACE_CDR::Octet x); + ACE_CDR::Boolean write_short (ACE_CDR::Short x); + ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x); + ACE_CDR::Boolean write_long (ACE_CDR::Long x); + ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x); + ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x); + ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x); + ACE_CDR::Boolean write_float (ACE_CDR::Float x); + ACE_CDR::Boolean write_double (const ACE_CDR::Double &x); + ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x); + + /// For string we offer methods that accept a precomputed length. + ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); + ACE_CDR::Boolean write_string (ACE_CDR::ULong len, + const ACE_CDR::Char *x); + ACE_CDR::Boolean write_string (const ACE_CString &x); + ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x); + ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, + const ACE_CDR::WChar *x); + //@} + + /// @note the portion written starts at and ends + /// at . + /// The length is *NOT* stored into the CDR stream. + //@{ @name Array write operations + ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x, + ACE_CDR::ULong length); + + /// + /// Adjust to @a size and count octets. + void adjust (size_t size); + + /// As above, but now the size and alignment requirements may be + /// different. + void adjust (size_t size, + size_t align); + +private: + /// disallow copying... + ACE_SizeCDR (const ACE_SizeCDR& rhs); + ACE_SizeCDR& operator= (const ACE_SizeCDR& rhs); + + ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x); + ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x); + ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x); + ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x); + ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x); + + /** + * write an array of @a length elements, each of @a size bytes and the + * start aligned at a multiple of . The elements are assumed + * to be packed with the right alignment restrictions. It is mostly + * designed for buffers of the basic types. + * + * This operation uses ; as explained above it is expected + * that using assignment is faster that for one element, + * but for several elements should be more efficient, it + * could be interesting to find the break even point and optimize + * for that case, but that would be too platform dependent. + */ + ACE_CDR::Boolean write_array (const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length); + + + ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x, + ACE_CDR::ULong length); + +private: + /// Set to false when an error ocurrs. + bool good_bit_; + + /// Current size. + size_t size_; + +protected: + /// GIOP version information + ACE_CDR::Octet major_version_; + ACE_CDR::Octet minor_version_; +}; + +// @@ This operator should not be inlined since they force SString.h +// to be included in this header. +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + const ACE_CString &x); + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +# include "ace/CDR_Size.inl" +#else /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Not used by CORBA or TAO +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::Char x); + +// CDR size-calculating output operators for primitive types + +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::Short x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::UShort x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::Long x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::ULong x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::LongLong x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::ULongLong x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR& ss, + ACE_CDR::LongDouble x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::Float x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_CDR::Double x); + +// CDR size-calculating output operator from helper classes + +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_OutputCDR::from_boolean x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_OutputCDR::from_char x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_OutputCDR::from_wchar x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_OutputCDR::from_octet x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_OutputCDR::from_string x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + ACE_OutputCDR::from_wstring x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + const ACE_CDR::Char* x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, + const ACE_CDR::WChar* x); + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* __ACE_INLINE__ */ + + +#include /**/ "ace/post.h" + +#endif /* ACE_CDR_SIZE_H */ diff --git a/externals/ace/CDR_Size.inl b/externals/ace/CDR_Size.inl new file mode 100644 index 0000000..4ea8152 --- /dev/null +++ b/externals/ace/CDR_Size.inl @@ -0,0 +1,424 @@ +// -*- C++ -*- +// +// $Id: CDR_Size.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_SizeCDR::ACE_SizeCDR (ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : good_bit_ (true), + size_ (0), + major_version_ (major_version), + minor_version_ (minor_version) +{ +} + +ACE_INLINE bool +ACE_SizeCDR::good_bit (void) const +{ + return this->good_bit_; +} + +ACE_INLINE void +ACE_SizeCDR::reset (void) +{ + this->size_ = 0; +} + +ACE_INLINE size_t +ACE_SizeCDR::total_length (void) const +{ + return this->size_; +} + + +// Encode the CDR stream. + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_octet (ACE_CDR::Octet x) +{ + return this->write_1 (reinterpret_cast (&x)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_boolean (ACE_CDR::Boolean x) +{ + return (ACE_CDR::Boolean) this->write_octet (x ? (ACE_CDR::Octet) 1 : (ACE_CDR::Octet) 0); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_char (ACE_CDR::Char x) +{ + // Note: translator framework is not supported. + // + return this->write_1 (reinterpret_cast (&x)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_short (ACE_CDR::Short x) +{ + return this->write_2 (reinterpret_cast (&x)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_ushort (ACE_CDR::UShort x) +{ + return this->write_2 (reinterpret_cast (&x)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_long (ACE_CDR::Long x) +{ + return this->write_4 (reinterpret_cast (&x)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_ulong (ACE_CDR::ULong x) +{ + return this->write_4 (reinterpret_cast (&x)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_longlong (const ACE_CDR::LongLong &x) +{ + return this->write_8 (reinterpret_cast (&x)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_ulonglong (const ACE_CDR::ULongLong &x) +{ + const void *temp = &x; + return this->write_8 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_float (ACE_CDR::Float x) +{ + const void *temp = &x; + return this->write_4 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_double (const ACE_CDR::Double &x) +{ + const void *temp = &x; + return this->write_8 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_longdouble (const ACE_CDR::LongDouble &x) +{ + const void *temp = &x; + return this->write_16 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_string (const ACE_CDR::Char *x) +{ + if (x != 0) + { + const ACE_CDR::ULong len = + static_cast (ACE_OS::strlen (x)); + return this->write_string (len, x); + } + return this->write_string (0, 0); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_wstring (const ACE_CDR::WChar *x) +{ + if (x != 0) + { + ACE_CDR::ULong len = + static_cast (ACE_OS::strlen (x)); + return this->write_wstring (len, x); + } + return this->write_wstring (0, 0); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_char_array (const ACE_CDR::Char *x, + ACE_CDR::ULong length) +{ + // Note: translator framework is not supported. + // + return this->write_array (x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_wchar_array (const ACE_CDR::WChar* x, + ACE_CDR::ULong length) +{ + // Note: translator framework is not supported. + // + if (ACE_OutputCDR::wchar_maxbytes () == 0) + { + errno = EACCES; + return (ACE_CDR::Boolean) (this->good_bit_ = false); + } + if (ACE_OutputCDR::wchar_maxbytes () == sizeof (ACE_CDR::WChar)) + return this->write_array (x, + sizeof (ACE_CDR::WChar), + sizeof (ACE_CDR::WChar) == 2 + ? ACE_CDR::SHORT_ALIGN + : ACE_CDR::LONG_ALIGN, + length); + return this->write_wchar_array_i (x,length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_octet_array (const ACE_CDR::Octet* x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_short_array (const ACE_CDR::Short *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::SHORT_SIZE, + ACE_CDR::SHORT_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_ushort_array (const ACE_CDR::UShort *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::SHORT_SIZE, + ACE_CDR::SHORT_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_long_array (const ACE_CDR::Long *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_ulong_array (const ACE_CDR::ULong *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_longlong_array (const ACE_CDR::LongLong *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_float_array (const ACE_CDR::Float *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_double_array (const ACE_CDR::Double *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_SizeCDR::write_longdouble_array (const ACE_CDR::LongDouble* x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGDOUBLE_SIZE, + ACE_CDR::LONGDOUBLE_ALIGN, + length); +} + + +// **************************************************************** + + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::Char x) +{ + ss.write_char (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::Short x) +{ + ss.write_short (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::UShort x) +{ + ss.write_ushort (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::Long x) +{ + ss.write_long (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::ULong x) +{ + ss.write_ulong (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::LongLong x) +{ + ss.write_longlong (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::ULongLong x) +{ + ss.write_ulonglong (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::LongDouble x) +{ + ss.write_longdouble (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::Float x) +{ + ss.write_float (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_CDR::Double x) +{ + ss.write_double (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, const ACE_CDR::Char *x) +{ + ss.write_string (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, const ACE_CDR::WChar *x) +{ + ss.write_wstring (x); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +// The following use the helper classes +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_boolean x) +{ + ss.write_boolean (x.val_); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_char x) +{ + ss.write_char (x.val_); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wchar x) +{ + ss.write_wchar (x.val_); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_octet x) +{ + ss.write_octet (x.val_); + return (ACE_CDR::Boolean) ss.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_string x) +{ + ACE_CDR::ULong len = 0; + + if (x.val_ != 0) + { + len = static_cast (ACE_OS::strlen (x.val_)); + } + + ss.write_string (len, x.val_); + return + (ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_)); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wstring x) +{ + ACE_CDR::ULong len = 0; + + if (x.val_ != 0) + { + len = static_cast (ACE_OS::strlen (x.val_)); + } + + ss.write_wstring (len, x.val_); + return + (ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_)); +} + + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/CDR_Stream.cpp b/externals/ace/CDR_Stream.cpp new file mode 100644 index 0000000..74d33be --- /dev/null +++ b/externals/ace/CDR_Stream.cpp @@ -0,0 +1,2063 @@ +#include "ace/CDR_Stream.h" +#include "ace/SString.h" +#include "ace/Auto_Ptr.h" +#include "ace/Truncate.h" + +#if !defined (__ACE_INLINE__) +# include "ace/CDR_Stream.inl" +#endif /* ! __ACE_INLINE__ */ + +ACE_RCSID (ace, + CDR_Stream, + "$Id: CDR_Stream.cpp 88653 2010-01-21 23:19:50Z sowayaa $") + +// **************************************************************** + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +size_t ACE_OutputCDR::wchar_maxbytes_ = sizeof (ACE_CDR::WChar); + +ACE_OutputCDR::ACE_OutputCDR (size_t size, + int byte_order, + ACE_Allocator *buffer_allocator, + ACE_Allocator *data_block_allocator, + ACE_Allocator *message_block_allocator, + size_t memcpy_tradeoff, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ ((size ? size : (size_t) ACE_CDR::DEFAULT_BUFSIZE) + ACE_CDR::MAX_ALIGNMENT, + ACE_Message_Block::MB_DATA, + 0, + 0, + buffer_allocator, + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + data_block_allocator, + message_block_allocator), +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + current_alignment_ (0), +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + current_is_writable_ (true), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + memcpy_tradeoff_ (memcpy_tradeoff), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) + +{ + ACE_CDR::mb_align (&this->start_); + this->current_ = &this->start_; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->total_length ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_OutputCDR::ACE_OutputCDR (char *data, + size_t size, + int byte_order, + ACE_Allocator *buffer_allocator, + ACE_Allocator *data_block_allocator, + ACE_Allocator *message_block_allocator, + size_t memcpy_tradeoff, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ (size, + ACE_Message_Block::MB_DATA, + 0, + data, + buffer_allocator, + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + data_block_allocator, + message_block_allocator), +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + current_alignment_ (0), +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + current_is_writable_ (true), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + memcpy_tradeoff_ (memcpy_tradeoff), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ + // We cannot trust the buffer to be properly aligned + ACE_CDR::mb_align (&this->start_); + this->current_ = &this->start_; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->total_length ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_OutputCDR::ACE_OutputCDR (ACE_Data_Block *data_block, + int byte_order, + ACE_Allocator *message_block_allocator, + size_t memcpy_tradeoff, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ (data_block, + ACE_Message_Block::DONT_DELETE, + message_block_allocator), +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + current_alignment_ (0), +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + current_is_writable_ (true), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + memcpy_tradeoff_ (memcpy_tradeoff), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ + // We cannot trust the buffer to be properly aligned + ACE_CDR::mb_align (&this->start_); + this->current_ = &this->start_; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->total_length ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data, + int byte_order, + size_t memcpy_tradeoff, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ (data->data_block ()->duplicate ()), +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + current_alignment_ (0), +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + current_is_writable_ (true), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + memcpy_tradeoff_ (memcpy_tradeoff), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ + // We cannot trust the buffer to be properly aligned + ACE_CDR::mb_align (&this->start_); + this->current_ = &this->start_; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->total_length ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +/*static*/ void +ACE_OutputCDR::wchar_maxbytes (size_t maxbytes) +{ + ACE_OutputCDR::wchar_maxbytes_ = maxbytes; +} + +/*static*/ size_t +ACE_OutputCDR::wchar_maxbytes () +{ + return ACE_OutputCDR::wchar_maxbytes_; +} + +int +ACE_OutputCDR::grow_and_adjust (size_t size, + size_t align, + char*& buf) +{ + if (!this->current_is_writable_ + || this->current_->cont () == 0 + || this->current_->cont ()->size () < size + ACE_CDR::MAX_ALIGNMENT) + { + // Calculate the new buffer's length; if growing for encode, we + // don't grow in "small" chunks because of the cost. + size_t cursize = this->current_->size (); + if (this->current_->cont () != 0) + cursize = this->current_->cont ()->size (); + size_t minsize = size; + +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + minsize += ACE_CDR::MAX_ALIGNMENT; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + // Make sure that there is enough room for bytes, but + // also make it bigger than whatever our current size is. + if (minsize < cursize) + minsize = cursize; + + size_t const newsize = ACE_CDR::next_size (minsize); + + this->good_bit_ = false; + ACE_Message_Block* tmp = 0; + ACE_NEW_RETURN (tmp, + ACE_Message_Block (newsize, + ACE_Message_Block::MB_DATA, + 0, + 0, + this->current_->data_block ()->allocator_strategy (), + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + this->current_->data_block ()->data_block_allocator ()), + -1); + + // Message block initialization may fail while the construction + // succeds. Since as a matter of policy, ACE may throw no + // exceptions, we have to do a separate check like this. + if (tmp != 0 && tmp->size () < newsize) + { + delete tmp; + errno = ENOMEM; + return -1; + } + + this->good_bit_ = true; + +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + // The new block must start with the same alignment as the + // previous block finished. + ptrdiff_t const tmpalign = + reinterpret_cast (tmp->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t const curalign = + static_cast (this->current_alignment_) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t offset = curalign - tmpalign; + if (offset < 0) + offset += ACE_CDR::MAX_ALIGNMENT; + tmp->rd_ptr (static_cast (offset)); + tmp->wr_ptr (tmp->rd_ptr ()); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + // grow the chain and set the current block. + tmp->cont (this->current_->cont ()); + this->current_->cont (tmp); + } + this->current_ = this->current_->cont (); + this->current_is_writable_ = true; + + return this->adjust (size, align, buf); +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) +{ + if (this->wchar_translator_ != 0) + return (this->good_bit_ = this->wchar_translator_->write_wchar (*this, x)); + if (ACE_OutputCDR::wchar_maxbytes_ == 0) + { + errno = EACCES; + return (this->good_bit_ = false); + } + if (static_cast (major_version_) == 1 + && static_cast (minor_version_) == 2) + { + ACE_CDR::Octet len = + static_cast (ACE_OutputCDR::wchar_maxbytes_); + if (this->write_1 (&len)) + { + if (ACE_OutputCDR::wchar_maxbytes_ == sizeof(ACE_CDR::WChar)) + return + this->write_octet_array ( + reinterpret_cast (&x), + static_cast (len)); + else + if (ACE_OutputCDR::wchar_maxbytes_ == 2) + { + ACE_CDR::Short sx = static_cast (x); + return + this->write_octet_array ( + reinterpret_cast (&sx), + static_cast (len)); + } + else + { + ACE_CDR::Octet ox = static_cast (x); + return + this->write_octet_array ( + reinterpret_cast (&ox), + static_cast (len)); + } + } + } + else if (static_cast (minor_version_) == 0) + { // wchar is not allowed with GIOP 1.0. + errno = EINVAL; + return (this->good_bit_ = false); + } + if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) + { + void const * const temp = &x; + return + this->write_4 (reinterpret_cast (temp)); + } + else if (ACE_OutputCDR::wchar_maxbytes_ == 2) + { + ACE_CDR::Short sx = static_cast (x); + return this->write_2 (reinterpret_cast (&sx)); + } + ACE_CDR::Octet ox = static_cast (x); + return this->write_1 (reinterpret_cast (&ox)); +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_string (ACE_CDR::ULong len, + const ACE_CDR::Char *x) +{ + // @@ This is a slight violation of "Optimize for the common case", + // i.e. normally the translator will be 0, but OTOH the code is + // smaller and should be better for the cache ;-) ;-) + if (this->char_translator_ != 0) + return this->char_translator_->write_string (*this, len, x); + + if (len != 0) + { + if (this->write_ulong (len + 1)) + return this->write_char_array (x, len + 1); + } + else + { + // Be nice to programmers: treat nulls as empty strings not + // errors. (OMG-IDL supports languages that don't use the C/C++ + // notion of null v. empty strings; nulls aren't part of the OMG-IDL + // string model.) + if (this->write_ulong (1)) + return this->write_char (0); + } + + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_string (const ACE_CString &x) +{ + // @@ Leave this method in here, not the `.i' file so that we don't + // have to unnecessarily pull in the `ace/SString.h' header. + return this->write_string (static_cast (x.length ()), + x.c_str()); +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, + const ACE_CDR::WChar *x) +{ + // @@ This is a slight violation of "Optimize for the common case", + // i.e. normally the translator will be 0, but OTOH the code is + // smaller and should be better for the cache ;-) ;-) + // What do we do for GIOP 1.2??? + if (this->wchar_translator_ != 0) + return this->wchar_translator_->write_wstring (*this, len, x); + if (ACE_OutputCDR::wchar_maxbytes_ == 0) + { + errno = EACCES; + return (this->good_bit_ = false); + } + + if (static_cast (this->major_version_) == 1 + && static_cast (this->minor_version_) == 2) + { + if (x != 0) + { + //In GIOP 1.2 the length field contains the number of bytes + //the wstring occupies rather than number of wchars + //Taking sizeof might not be a good way! This is a temporary fix. + ACE_CDR::Boolean good_ulong = + this->write_ulong ( + ACE_Utils::truncate_cast ( + ACE_OutputCDR::wchar_maxbytes_ * len)); + + if (good_ulong) + { + return this->write_wchar_array (x, len); + } + } + else + { + //In GIOP 1.2 zero length wstrings are legal + return this->write_ulong (0); + } + } + + else + if (x != 0) + { + if (this->write_ulong (len + 1)) + return this->write_wchar_array (x, len + 1); + } + else if (this->write_ulong (1)) + return this->write_wchar (0); + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) +{ + // If the buffer is small and it fits in the current message + // block it is be cheaper just to copy the buffer. + for (const ACE_Message_Block* i = mb; + i != 0; + i = i->cont ()) + { + size_t const length = i->length (); + + // If the mb does not own its data we are forced to make a copy. + if (ACE_BIT_ENABLED (i->flags (), + ACE_Message_Block::DONT_DELETE)) + { + if (! this->write_array (i->rd_ptr (), + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + static_cast (length))) + return (this->good_bit_ = false); + continue; + } + + if (length < this->memcpy_tradeoff_ + && this->current_->wr_ptr () + length < this->current_->end ()) + { + if (! this->write_array (i->rd_ptr (), + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + static_cast (length))) + return (this->good_bit_ = false); + continue; + } + + ACE_Message_Block* cont = 0; + this->good_bit_ = false; + ACE_NEW_RETURN (cont, + ACE_Message_Block (i->data_block ()->duplicate ()), + false); + this->good_bit_ = true; + + if (this->current_->cont () != 0) + ACE_Message_Block::release (this->current_->cont ()); + cont->rd_ptr (i->rd_ptr ()); + cont->wr_ptr (i->wr_ptr ()); + + this->current_->cont (cont); + this->current_ = cont; + this->current_is_writable_ = false; +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + this->current_alignment_ = + (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + } + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x) +{ + char *buf = 0; + if (this->adjust (1, buf) == 0) + { + *reinterpret_cast (buf) = *x; + return true; + } + + return false; +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) + { +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast (buf) = *x; + return true; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast (buf) = *x; + return true; + } + else + { + ACE_CDR::swap_2 (reinterpret_cast (x), buf); + return true; + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + } + + return false; +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) + { +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast (buf) = *x; + return true; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast (buf) = *x; + return true; + } + else + { + ACE_CDR::swap_4 (reinterpret_cast (x), buf); + return true; + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + } + + return false; +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x) +{ + char *buf = 0; + + if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) + { +#if defined (__arm__) && !defined (ACE_HAS_IPHONE) + // Convert to Intel format (12345678 => 56781234) + const char *orig = reinterpret_cast (x); + char *target = buf; + register ACE_UINT32 x = + *reinterpret_cast (orig); + register ACE_UINT32 y = + *reinterpret_cast (orig + 4); + *reinterpret_cast (target) = y; + *reinterpret_cast (target + 4) = x; + return true; +#else +# if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast (buf) = *x; + return true; +# else + if (!this->do_byte_swap_) + { + *reinterpret_cast (buf) = *x; + return true; + } + else + { + ACE_CDR::swap_8 (reinterpret_cast (x), buf); + return true; + } +# endif /* ACE_ENABLE_SWAP_ON_WRITE */ +#endif /* !__arm__ */ + } + + return false; +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_16 (const ACE_CDR::LongDouble *x) +{ + char* buf = 0; + if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, + ACE_CDR::LONGDOUBLE_ALIGN, + buf) == 0) + { +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast (buf) = *x; + return 1; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast (buf) = *x; + return true; + } + else + { + ACE_CDR::swap_16 (reinterpret_cast (x), buf); + return true; + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + } + + return false; +} + +ACE_CDR::Boolean +ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x, + ACE_CDR::ULong length) +{ + if (length == 0) + return true; + char* buf = 0; + size_t const align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? + ACE_CDR::SHORT_ALIGN : + ACE_CDR::OCTET_ALIGN; + + if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0) + { + if (ACE_OutputCDR::wchar_maxbytes_ == 2) + { + ACE_CDR::UShort *sb = reinterpret_cast (buf); + for (size_t i = 0; i < length; ++i) +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + sb[i] = static_cast (x[i]); +#else + if (!this->do_byte_swap_) + sb[i] = static_cast (x[i]); + else + { + ACE_CDR::UShort sx = static_cast (x[i]); + ACE_CDR::swap_2 (reinterpret_cast (&sx), &buf[i * 2]); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + } + else + { + for (size_t i = 0; i < length; ++i) + buf[i] = static_cast (x[i]); + } + return this->good_bit_; + } + return false; +} + + +ACE_CDR::Boolean +ACE_OutputCDR::write_array (const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length) +{ + if (length == 0) + return true; + char *buf = 0; + if (this->adjust (size * length, align, buf) == 0) + { +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + ACE_OS::memcpy (buf, x, size*length); + return true; +#else + if (!this->do_byte_swap_ || size == 1) + { + ACE_OS::memcpy (buf, x, size*length); + return true; + } + else + { + const char *source = reinterpret_cast (x); + switch (size) + { + case 2: + ACE_CDR::swap_2_array (source, buf, length); + return true; + case 4: + ACE_CDR::swap_4_array (source, buf, length); + return true; + case 8: + ACE_CDR::swap_8_array (source, buf, length); + return true; + case 16: + ACE_CDR::swap_16_array (source, buf, length); + return true; + default: + // TODO: print something? + this->good_bit_ = false; + return false; + } + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + } + this->good_bit_ = false; + return false; +} + + +ACE_CDR::Boolean +ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x, + ACE_CDR::ULong length) +{ + // It is hard to optimize this, the spec requires that on the wire + // booleans be represented as a byte with value 0 or 1, but in + // memory it is possible (though very unlikely) that a boolean has + // a non-zero value (different from 1). + // We resort to a simple loop. + ACE_CDR::Boolean const * const end = x + length; + + for (ACE_CDR::Boolean const * i = x; + i != end && this->good_bit (); + ++i) + (void) this->write_boolean (*i); + + return this->good_bit (); +} + +char * +ACE_OutputCDR::write_long_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) + *reinterpret_cast (buf) = 0; + else + buf = 0; + return buf; +} + +char * +ACE_OutputCDR::write_short_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) + *reinterpret_cast (buf) = 0; + else + buf = 0; + return buf; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast (loc) = x; + } + else + { + ACE_CDR::swap_4 (reinterpret_cast (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} + + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast (loc) = x; + } + else + { + ACE_CDR::swap_2 (reinterpret_cast (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} + + +int +ACE_OutputCDR::consolidate (void) +{ + // Optimize by only doing something if we need to + if (this->current_ != &this->start_) + { + // Set the number of bytes in the top-level block, reallocating + // if necessary. The rd_ptr and wr_ptr remain at the original offsets + // into the buffer, even if it is reallocated. + // Return an error if the allocation failed. + size_t const newsize = + ACE_CDR::first_size (this->total_length () + + ACE_CDR::MAX_ALIGNMENT); + if (this->start_.size (newsize) < 0) + { + return -1; + } + + // Consolidate the chain into the first block. NOTE that + // ACE_CDR::consolidate can not be used since we don't want to + // overwrite what is already in the first block. We just append it since + // the read and write pointers weren't affected by the resizing above. + // We also don't have to worry about alignment since the start block is + // already aligned. + // NOTE also we know there is a continuation since we checked for it + // above. There is therefore no reason to check for a 0 continuation + // field here. + ACE_Message_Block *cont = this->start_.cont (); + for (const ACE_Message_Block* i = cont; i != 0; i = i->cont ()) + { + this->start_.copy (i->rd_ptr (), i->length ()); + } + + // Release the old blocks that were consolidated and reset the + // current_ and current_is_writable_ to reflect the single used block. + ACE_Message_Block::release (cont); + this->start_.cont (0); + this->current_ = &this->start_; + this->current_is_writable_ = true; + } + + return 0; +} + + +ACE_Message_Block* +ACE_OutputCDR::find (char* loc) +{ + ACE_Message_Block* mb = 0; + for (mb = &this->start_; mb != 0; mb = mb->cont ()) + { + if (loc <= mb->wr_ptr () && loc >= mb->rd_ptr ()) + { + break; + } + } + + return mb; +} + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + +void +ACE_OutputCDR::register_monitor (const char *id) +{ + this->monitor_->name (id); + this->monitor_->add_to_registry (); +} + +void +ACE_OutputCDR::unregister_monitor (void) +{ + this->monitor_->remove_from_registry (); +} + +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + +// **************************************************************** + +ACE_InputCDR::ACE_InputCDR (const char *buf, + size_t bufsiz, + int byte_order, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ (buf, bufsiz), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ + this->start_.wr_ptr (bufsiz); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (bufsiz); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR::ACE_InputCDR (size_t bufsiz, + int byte_order, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ (bufsiz), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (bufsiz); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR::ACE_InputCDR (const ACE_Message_Block *data, + int byte_order, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version, + ACE_Lock* lock) + : start_ (0, ACE_Message_Block::MB_DATA, 0, 0, 0, lock), + good_bit_ (true), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + + this->reset (data, byte_order); +} + +ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, + ACE_Message_Block::Message_Flags flag, + int byte_order, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ (data, flag), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (data->size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR::ACE_InputCDR (ACE_Data_Block *data, + ACE_Message_Block::Message_Flags flag, + size_t rd_pos, + size_t wr_pos, + int byte_order, + ACE_CDR::Octet major_version, + ACE_CDR::Octet minor_version) + : start_ (data, flag), + do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), + good_bit_ (true), + major_version_ (major_version), + minor_version_ (minor_version), + char_translator_ (0), + wchar_translator_ (0) +{ + // Set the read pointer + this->start_.rd_ptr (rd_pos); + + // Set the write pointer after doing a sanity check. + char* wrpos = this->start_.base () + wr_pos; + + if (this->start_.end () >= wrpos) + { + this->start_.wr_ptr (wr_pos); + } + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (data->size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, + size_t size, + ACE_CDR::Long offset) + : start_ (rhs.start_, + ACE_CDR::MAX_ALIGNMENT), + do_byte_swap_ (rhs.do_byte_swap_), + good_bit_ (true), + major_version_ (rhs.major_version_), + minor_version_ (rhs.minor_version_), + char_translator_ (rhs.char_translator_), + wchar_translator_ (rhs.wchar_translator_) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + // Align the base pointer assuming that the incoming stream is also + // aligned the way we are aligned + char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), + ACE_CDR::MAX_ALIGNMENT); +#else + char *incoming_start = rhs.start_.base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + const size_t newpos = + (rhs.start_.rd_ptr() - incoming_start) + offset; + + if (newpos <= this->start_.space () + && newpos + size <= this->start_.space ()) + { + this->start_.rd_ptr (newpos); + this->start_.wr_ptr (newpos + size); + } + else + { + this->good_bit_ = false; + } + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, + size_t size) + : start_ (rhs.start_, + ACE_CDR::MAX_ALIGNMENT), + do_byte_swap_ (rhs.do_byte_swap_), + good_bit_ (true), + major_version_ (rhs.major_version_), + minor_version_ (rhs.minor_version_), + char_translator_ (rhs.char_translator_), + wchar_translator_ (rhs.wchar_translator_) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + // Align the base pointer assuming that the incoming stream is also + // aligned the way we are aligned + char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), + ACE_CDR::MAX_ALIGNMENT); +#else + char *incoming_start = rhs.start_.base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + const size_t newpos = + rhs.start_.rd_ptr() - incoming_start; + + if (newpos <= this->start_.space () + && newpos + size <= this->start_.space ()) + { + // Notice that ACE_Message_Block::duplicate may leave the + // wr_ptr() with a higher value than what we actually want. + this->start_.rd_ptr (newpos); + this->start_.wr_ptr (newpos + size); + + ACE_CDR::Octet byte_order = 0; + (void) this->read_octet (byte_order); + this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); + } + else + { + this->good_bit_ = false; + } + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs) + : start_ (rhs.start_, + ACE_CDR::MAX_ALIGNMENT), + do_byte_swap_ (rhs.do_byte_swap_), + good_bit_ (true), + major_version_ (rhs.major_version_), + minor_version_ (rhs.minor_version_), + char_translator_ (rhs.char_translator_), + wchar_translator_ (rhs.wchar_translator_) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + char *buf = ACE_ptr_align_binary (rhs.start_.base (), + ACE_CDR::MAX_ALIGNMENT); +#else + char *buf = rhs.start_.base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + size_t rd_offset = rhs.start_.rd_ptr () - buf; + size_t wr_offset = rhs.start_.wr_ptr () - buf; + this->start_.rd_ptr (rd_offset); + this->start_.wr_ptr (wr_offset); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR::ACE_InputCDR (ACE_InputCDR::Transfer_Contents x) + : start_ (x.rhs_.start_.data_block ()), + do_byte_swap_ (x.rhs_.do_byte_swap_), + good_bit_ (true), + major_version_ (x.rhs_.major_version_), + minor_version_ (x.rhs_.minor_version_), + char_translator_ (x.rhs_.char_translator_), + wchar_translator_ (x.rhs_.wchar_translator_) +{ + this->start_.rd_ptr (x.rhs_.start_.rd_ptr ()); + this->start_.wr_ptr (x.rhs_.start_.wr_ptr ()); + + ACE_Data_Block* db = this->start_.data_block ()->clone_nocopy (); + (void) x.rhs_.start_.replace_data_block (db); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_InputCDR& +ACE_InputCDR::operator= (const ACE_InputCDR& rhs) +{ + if (this != &rhs) + { + this->start_.data_block (rhs.start_.data_block ()->duplicate ()); + this->start_.rd_ptr (rhs.start_.rd_ptr ()); + this->start_.wr_ptr (rhs.start_.wr_ptr ()); + this->do_byte_swap_ = rhs.do_byte_swap_; + this->good_bit_ = true; + this->char_translator_ = rhs.char_translator_; + this->major_version_ = rhs.major_version_; + this->minor_version_ = rhs.minor_version_; + } + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + + return *this; +} + +ACE_InputCDR::ACE_InputCDR (const ACE_OutputCDR& rhs, + ACE_Allocator* buffer_allocator, + ACE_Allocator* data_block_allocator, + ACE_Allocator* message_block_allocator) + : start_ (rhs.total_length () + ACE_CDR::MAX_ALIGNMENT, + ACE_Message_Block::MB_DATA, + 0, + 0, + buffer_allocator, + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + data_block_allocator, + message_block_allocator), + do_byte_swap_ (rhs.do_byte_swap_), + good_bit_ (true), + major_version_ (rhs.major_version_), + minor_version_ (rhs.minor_version_), + char_translator_ (rhs.char_translator_), + wchar_translator_ (rhs.wchar_translator_) +{ + ACE_CDR::mb_align (&this->start_); + for (const ACE_Message_Block *i = rhs.begin (); + i != rhs.end (); + i = i->cont ()) + { + this->start_.copy (i->rd_ptr (), i->length ()); + } + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE_NEW (this->monitor_, + ACE::Monitor_Control::Size_Monitor); + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_CDR::Boolean +ACE_InputCDR::skip_wchar (void) +{ + if (static_cast (major_version_) == 1 + && static_cast (minor_version_) == 2) + { + ACE_CDR::Octet len; + if (this->read_1 (&len)) + return this->skip_bytes (static_cast (len)); + } + else + { + ACE_CDR::WChar x; + void * const temp = &x; + if (ACE_OutputCDR::wchar_maxbytes_ == 2) + return this->read_2 (reinterpret_cast (temp)); + else + return this->read_4 (reinterpret_cast (temp)); + } + + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_InputCDR::read_wchar (ACE_CDR::WChar& x) +{ + if (this->wchar_translator_ != 0) + { + this->good_bit_ = this->wchar_translator_->read_wchar (*this,x); + return this->good_bit_; + } + if (ACE_OutputCDR::wchar_maxbytes_ == 0) + { + errno = EACCES; + return (this->good_bit_ = false); + } + + if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) + { + if (static_cast (major_version_) == 1 + && static_cast (minor_version_) == 2) + { + ACE_CDR::Octet len; + + if (this->read_1 (&len)) + return this->read_array + (reinterpret_cast (&x), + static_cast (len), + ACE_CDR::OCTET_ALIGN, + 1); + + else + return (this->good_bit_ = false); + } + + void * const temp = &x; + if (sizeof (ACE_CDR::WChar) == 2) + return this->read_2 (reinterpret_cast (temp)); + else + return this->read_4 (reinterpret_cast (temp)); + } + + if (static_cast (major_version_) == 1 + && static_cast (minor_version_) == 2) + { + ACE_CDR::Octet len; + + if (this->read_1 (&len)) + { + if (len == 2) + { + ACE_CDR::Short sx; + if (this->read_array + (reinterpret_cast (&sx), + static_cast (len), + ACE_CDR::OCTET_ALIGN, + 1)) + { + x = static_cast (sx); + return true; + } + } + else + { + ACE_CDR::Octet ox; + if (this->read_array + (reinterpret_cast (&ox), + static_cast (len), + ACE_CDR::OCTET_ALIGN, + 1)) + { + x = static_cast (ox); + return true; + } + } + } + } + else + { + if (ACE_OutputCDR::wchar_maxbytes_ == 2) + { + ACE_CDR::UShort sx; + if (this->read_2 (reinterpret_cast (&sx))) + { + x = static_cast (sx); + return true; + } + } + else + { + ACE_CDR::Octet ox; + if (this->read_1 (&ox)) + { + x = static_cast (ox); + return true; + } + + } + } + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_InputCDR::read_string (ACE_CDR::Char *&x) +{ + // @@ This is a slight violation of "Optimize for the common case", + // i.e. normally the translator will be 0, but OTOH the code is + // smaller and should be better for the cache ;-) ;-) + if (this->char_translator_ != 0) + { + this->good_bit_ = this->char_translator_->read_string (*this, x); + return this->good_bit_; + } + + ACE_CDR::ULong len = 0; + + if (!this->read_ulong (len)) + return false; + + // A check for the length being too great is done later in the + // call to read_char_array but we want to have it done before + // the memory is allocated. + if (len > 0 && len <= this->length()) + { + ACE_NEW_RETURN (x, + ACE_CDR::Char[len], + 0); + + ACE_Auto_Basic_Array_Ptr safe_data (x); + + if (this->read_char_array (x, len)) + { + (void) safe_data.release (); + return true; + } + } + else if (len == 0) + { + // Convert any null strings to empty strings since empty + // strings can cause crashes. (See bug 58.) + ACE_NEW_RETURN (x, + ACE_CDR::Char[1], + 0); + ACE_OS::strcpy (const_cast (x), ""); + return true; + } + + x = 0; + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_InputCDR::read_string (ACE_CString &x) +{ + ACE_CDR::Char * data = 0; + if (this->read_string (data)) + { + ACE_Auto_Basic_Array_Ptr safe_data (data); + x = data; + return true; + } + + x = ""; + return (this->good_bit_ = false); +} + +ACE_CDR::Boolean +ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) +{ + // @@ This is a slight violation of "Optimize for the common case", + // i.e. normally the translator will be 0, but OTOH the code is + // smaller and should be better for the cache ;-) ;-) + if (this->wchar_translator_ != 0) + { + this->good_bit_ = this->wchar_translator_->read_wstring (*this, x); + return this->good_bit_; + } + if (ACE_OutputCDR::wchar_maxbytes_ == 0) + { + errno = EACCES; + return (this->good_bit_ = false); + } + + ACE_CDR::ULong len = 0; + + if (!this->read_ulong (len)) + { + return false; + } + + // A check for the length being too great is done later in the + // call to read_char_array but we want to have it done before + // the memory is allocated. + if (len > 0 && len <= this->length ()) + { + ACE_Auto_Basic_Array_Ptr safe_data; + + if (static_cast (this->major_version_) == 1 + && static_cast (this->minor_version_) == 2) + { + len /= + ACE_Utils::truncate_cast ( + ACE_OutputCDR::wchar_maxbytes_); + + //allocating one extra for the null character needed by applications + ACE_NEW_RETURN (x, + ACE_CDR::WChar [len + 1], + false); + + ACE_auto_ptr_reset (safe_data, x); + + if (this->read_wchar_array (x, len)) + { + + //Null character used by applications to find the end of + //the wstring + //Is this okay with the GIOP 1.2 spec?? + x[len] = '\x00'; + + (void) safe_data.release (); + + return true; + } + } + else + { + ACE_NEW_RETURN (x, + ACE_CDR::WChar [len], + false); + + ACE_auto_ptr_reset (safe_data, x); + + if (this->read_wchar_array (x, len)) + { + (void) safe_data.release (); + + return true; + } + } + } + else if (len == 0) + { + // Convert any null strings to empty strings since empty + // strings can cause crashes. (See bug 58.) + ACE_NEW_RETURN (x, + ACE_CDR::WChar[1], + false); + x[0] = '\x00'; + return true; + } + + this->good_bit_ = false; + x = 0; + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::read_array (void* x, + size_t size, + size_t align, + ACE_CDR::ULong length) +{ + if (length == 0) + return true; + char* buf = 0; + + if (this->adjust (size * length, align, buf) == 0) + { +#if defined (ACE_DISABLE_SWAP_ON_READ) + ACE_OS::memcpy (x, buf, size*length); +#else + if (!this->do_byte_swap_ || size == 1) + ACE_OS::memcpy (x, buf, size*length); + else + { + char *target = reinterpret_cast (x); + switch (size) + { + case 2: + ACE_CDR::swap_2_array (buf, target, length); + break; + case 4: + ACE_CDR::swap_4_array (buf, target, length); + break; + case 8: + ACE_CDR::swap_8_array (buf, target, length); + break; + case 16: + ACE_CDR::swap_16_array (buf, target, length); + break; + default: + // TODO: print something? + this->good_bit_ = false; + return false; + } + } +#endif /* ACE_DISABLE_SWAP_ON_READ */ + return this->good_bit_; + } + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x, + ACE_CDR::ULong length) +{ + if (length == 0) + return true; + char* buf = 0; + size_t const align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? + ACE_CDR::SHORT_ALIGN : + ACE_CDR::OCTET_ALIGN; + + if (this->adjust (ACE_OutputCDR::wchar_maxbytes_ * length, align, buf) == 0) + { + if (ACE_OutputCDR::wchar_maxbytes_ == 2) + { + ACE_CDR::UShort *sb = reinterpret_cast (buf); + for (size_t i = 0; i < length; ++i) +#if defined (ACE_DISABLE_SWAP_ON_READ) + x[i] = static_cast (sb[i]); +#else + if (!this->do_byte_swap_) + x[i] = static_cast (sb[i]); + else + { + ACE_CDR::UShort sx; + ACE_CDR::swap_2 (&buf[i * 2], reinterpret_cast (&sx)); + x[i] = static_cast (sx); + } +#endif /* ACE_DISABLE_SWAP_ON_READ */ + } + else + { + for (size_t i = 0; i < length; ++i) + x[i] = static_cast (buf[i]); + } + return this->good_bit_; + } + return false; +} + + +ACE_CDR::Boolean +ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length > this->length ()) + { + this->good_bit_ = false; + return false; + } + + // It is hard to optimize this, the spec requires that on the wire + // booleans be represented as a byte with value 0 or 1, but in + // memory it is possible (though very unlikely) that a boolean has + // a non-zero value (different from 1). + // We resort to a simple loop. + for (ACE_CDR::ULong i = 0; i != length && this->good_bit_; ++i) + (void) this->read_boolean (x[i]); + + return this->good_bit_; +} + +ACE_CDR::Boolean +ACE_InputCDR::read_1 (ACE_CDR::Octet *x) +{ + if (this->rd_ptr () < this->wr_ptr ()) + { + *x = *reinterpret_cast (this->rd_ptr ()); + this->start_.rd_ptr (1); + return true; + } + + this->good_bit_ = false; + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::read_2 (ACE_CDR::UShort *x) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) + { +#if !defined (ACE_DISABLE_SWAP_ON_READ) + if (!this->do_byte_swap_) + *x = *reinterpret_cast (buf); + else + ACE_CDR::swap_2 (buf, reinterpret_cast (x)); +#else + *x = *reinterpret_cast (buf); +#endif /* ACE_DISABLE_SWAP_ON_READ */ + return true; + } + this->good_bit_ = false; + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::read_4 (ACE_CDR::ULong *x) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) + { +#if !defined (ACE_DISABLE_SWAP_ON_READ) + if (!this->do_byte_swap_) + *x = *reinterpret_cast (buf); + else + ACE_CDR::swap_4 (buf, reinterpret_cast (x)); +#else + *x = *reinterpret_cast (buf); +#endif /* ACE_DISABLE_SWAP_ON_READ */ + return true; + } + this->good_bit_ = false; + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x) +{ + char *buf = 0; + + if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) + { +#if !defined (ACE_DISABLE_SWAP_ON_READ) +# if defined (__arm__) && !defined (ACE_HAS_IPHONE) + if (!this->do_byte_swap_) + { + // Convert from Intel format (12345678 => 56781234) + const char *orig = buf; + char *target = reinterpret_cast (x); + register ACE_UINT32 x = + *reinterpret_cast (orig); + register ACE_UINT32 y = + *reinterpret_cast (orig + 4); + *reinterpret_cast (target) = y; + *reinterpret_cast (target + 4) = x; + } + else + { + // Convert from Sparc format (12345678 => 43218765) + const char *orig = buf; + char *target = reinterpret_cast (x); + register ACE_UINT32 x = + *reinterpret_cast (orig); + register ACE_UINT32 y = + *reinterpret_cast (orig + 4); + x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24); + y = (y << 24) | ((y & 0xff00) << 8) | ((y & 0xff0000) >> 8) | (y >> 24); + *reinterpret_cast (target) = x; + *reinterpret_cast (target + 4) = y; + } +# else + if (!this->do_byte_swap_) + *x = *reinterpret_cast (buf); + else + ACE_CDR::swap_8 (buf, reinterpret_cast (x)); +# endif /* !__arm__ */ +#else + *x = *reinterpret_cast (buf); +#endif /* ACE_DISABLE_SWAP_ON_READ */ + return true; + } + + this->good_bit_ = false; + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::read_16 (ACE_CDR::LongDouble *x) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, + ACE_CDR::LONGDOUBLE_ALIGN, + buf) == 0) + { +#if !defined (ACE_DISABLE_SWAP_ON_READ) + if (!this->do_byte_swap_) + *x = *reinterpret_cast (buf); + else + ACE_CDR::swap_16 (buf, reinterpret_cast (x)); +#else + *x = *reinterpret_cast (buf); +#endif /* ACE_DISABLE_SWAP_ON_READ */ + return true; + } + + this->good_bit_ = false; + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::skip_string (void) +{ + ACE_CDR::ULong len = 0; + if (this->read_ulong (len)) + { + if (this->rd_ptr () + len <= this->wr_ptr ()) + { + this->rd_ptr (len); + return true; + } + this->good_bit_ = false; + } + return false; +} + +ACE_CDR::Boolean +ACE_InputCDR::skip_wstring (void) +{ + ACE_CDR::ULong len = 0; + ACE_CDR::Boolean continue_skipping = read_ulong (len); + + if (continue_skipping && len != 0) + { + if (static_cast (this->major_version_) == 1 + && static_cast (this->minor_version_) == 2) + continue_skipping = this->skip_bytes ((size_t)len); + else + while (continue_skipping && len--) + continue_skipping = this->skip_wchar (); + } + return continue_skipping; +} + +ACE_CDR::Boolean +ACE_InputCDR::skip_bytes (size_t len) +{ + if (this->rd_ptr () + len <= this->wr_ptr ()) + { + this->rd_ptr (len); + return true; + } + this->good_bit_ = false; + return false; +} + +int +ACE_InputCDR::grow (size_t newsize) +{ + if (ACE_CDR::grow (&this->start_, newsize) == -1) + return -1; + + ACE_CDR::mb_align (&this->start_); + this->start_.wr_ptr (newsize); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + if (newsize > this->start_.total_size ()) + { + this->monitor_->receive (newsize); + } +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + + return 0; +} + +void +ACE_InputCDR::reset (const ACE_Message_Block* data, + int byte_order) +{ + this->reset_byte_order (byte_order); + ACE_CDR::consolidate (&this->start_, data); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +void +ACE_InputCDR::steal_from (ACE_InputCDR &cdr) +{ + this->do_byte_swap_ = cdr.do_byte_swap_; + this->start_.data_block (cdr.start_.data_block ()->duplicate ()); + + // If the message block had a DONT_DELETE flags, just clear it off.. + this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); + this->start_.rd_ptr (cdr.start_.rd_ptr ()); + + this->start_.wr_ptr (cdr.start_.wr_ptr ()); + this->major_version_ = cdr.major_version_; + this->minor_version_ = cdr.minor_version_; + cdr.reset_contents (); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +void +ACE_InputCDR::exchange_data_blocks (ACE_InputCDR &cdr) +{ + // Exchange byte orders + int const byte_order = cdr.do_byte_swap_; + cdr.do_byte_swap_ = this->do_byte_swap_; + this->do_byte_swap_ = byte_order; + + // Get the destination read and write pointers + size_t const drd_pos = + cdr.start_.rd_ptr () - cdr.start_.base (); + size_t const dwr_pos = + cdr.start_.wr_ptr () - cdr.start_.base (); + + // Get the source read & write pointers + size_t const srd_pos = + this->start_.rd_ptr () - this->start_.base (); + size_t const swr_pos = + this->start_.wr_ptr () - this->start_.base (); + + // Exchange data_blocks. Dont release any of the data blocks. + ACE_Data_Block *dnb = + this->start_.replace_data_block (cdr.start_.data_block ()); + cdr.start_.replace_data_block (dnb); + + // Exchange the flags information.. + ACE_Message_Block::Message_Flags df = cdr.start_.self_flags (); + ACE_Message_Block::Message_Flags sf = this->start_.self_flags (); + + cdr.start_.clr_self_flags (df); + this->start_.clr_self_flags (sf); + + cdr.start_.set_self_flags (sf); + this->start_.set_self_flags (df); + + // Reset the pointers to zero before it is set again. + cdr.start_.reset (); + this->start_.reset (); + + // Set the read and write pointers. + if (cdr.start_.size () >= srd_pos) + { + cdr.start_.rd_ptr (srd_pos); + } + + if (cdr.start_.size () >= swr_pos) + { + cdr.start_.wr_ptr (swr_pos); + } + + if (this->start_.size () >= drd_pos) + { + this->start_.rd_ptr (drd_pos); + } + + if (this->start_.size () >= dwr_pos) + { + this->start_.wr_ptr (dwr_pos); + } + + ACE_CDR::Octet const dmajor = cdr.major_version_; + ACE_CDR::Octet const dminor = cdr.minor_version_; + + // Exchange the GIOP version info + cdr.major_version_ = this->major_version_; + cdr.minor_version_ = this->minor_version_; + + this->major_version_ = dmajor; + this->minor_version_ = dminor; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_Data_Block * +ACE_InputCDR::clone_from (ACE_InputCDR &cdr) +{ + this->do_byte_swap_ = cdr.do_byte_swap_; + + // Get the read & write pointer positions in the incoming CDR + // streams + char *rd_ptr = cdr.start_.rd_ptr (); + char *wr_ptr = cdr.start_.wr_ptr (); + + // Now reset the incoming CDR stream + cdr.start_.reset (); + + // As we have reset the stream, try to align the underlying message + // block in the incoming stream + ACE_CDR::mb_align (&cdr.start_); + + // Get the read & write pointer positions again + char *nrd_ptr = cdr.start_.rd_ptr (); + char *nwr_ptr = cdr.start_.wr_ptr (); + + // Actual length of the stream is.. + // @todo: This will look idiotic, but we dont seem to have much of a + // choice. How do we calculate the length of the incoming stream? + // Calling the method before calling reset () would give us the + // wrong length of the stream that needs copying. So we do the + // calulation like this + // (1) We get the and positions of the incoming + // stream. + // (2) Then we reset the stream and then align it. + // (3) We get the and positions again. (Points #1 + // thru #3 has been done already) + // (4) The difference in the and positions gives + // us the following, the actual bytes traversed by the and + // . + // (5) The bytes traversed by the is the actual length of + // the stream. + + // Actual bytes traversed + size_t rd_bytes = rd_ptr - nrd_ptr; + size_t wr_bytes = wr_ptr - nwr_ptr; + + ACE_CDR::mb_align (&this->start_); + + ACE_Data_Block *db = this->start_.data_block (); + + // If the size of the data that needs to be copied are higher than + // what is available, then do a reallocation. + if (wr_bytes > (this->start_.size () - ACE_CDR::MAX_ALIGNMENT)) + { + // @@NOTE: We need to probably add another method to the message + // block interface to simplify this + db = cdr.start_.data_block ()->clone_nocopy (); + + if (db == 0 || db->size ((wr_bytes) + + ACE_CDR::MAX_ALIGNMENT) == -1) + return 0; + + // Replace our data block by using the incoming CDR stream. + db = this->start_.replace_data_block (db); + + // Align the start_ message block. + ACE_CDR::mb_align (&this->start_); + + // Clear the DONT_DELETE flag if it has been set + this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); + } + + // Now do the copy + (void) ACE_OS::memcpy (this->start_.wr_ptr (), + cdr.start_.rd_ptr (), + wr_bytes); + + // Set the read pointer position to the same point as that was in + // cdr. + this->start_.rd_ptr (rd_bytes); + this->start_.wr_ptr (wr_bytes); + + // We have changed the read & write pointers for the incoming + // stream. Set them back to the positions that they were before.. + cdr.start_.rd_ptr (rd_bytes); + cdr.start_.wr_ptr (wr_bytes); + + this->major_version_ = cdr.major_version_; + this->minor_version_ = cdr.minor_version_; + + // Copy the char/wchar translators + this->char_translator_ = cdr.char_translator_; + this->wchar_translator_ = cdr.wchar_translator_; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + + return db; +} + +ACE_Message_Block* +ACE_InputCDR::steal_contents (void) +{ + ACE_Message_Block* block = this->start_.clone (); + this->start_.data_block (block->data_block ()->clone ()); + + // If at all our message had a DONT_DELETE flag set, just clear it + // off. + this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); + + ACE_CDR::mb_align (&this->start_); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + + return block; +} + +void +ACE_InputCDR::reset_contents (void) +{ + this->start_.data_block (this->start_.data_block ()->clone_nocopy ()); + + // Reset the flags... + this->start_.clr_self_flags (ACE_Message_Block::DONT_DELETE); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + +void +ACE_InputCDR::register_monitor (const char *id) +{ + this->monitor_->name (id); + this->monitor_->add_to_registry (); +} + +void +ACE_InputCDR::unregister_monitor (void) +{ + this->monitor_->remove_from_registry (); +} + +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + +// -------------------------------------------------------------- + +ACE_Char_Codeset_Translator::~ACE_Char_Codeset_Translator (void) +{ +} + +// -------------------------------------------------------------- + +ACE_WChar_Codeset_Translator::~ACE_WChar_Codeset_Translator (void) +{ +} + +// -------------------------------------------------------------- + +ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, const ACE_CString &x) +{ + os.write_string (x); + return os.good_bit (); +} + +ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CString &x) +{ + is.read_string (x); + return is.good_bit (); +} + +#if defined (GEN_OSTREAM_OPS) + +std::ostream& +operator<< (std::ostream &os, ACE_OutputCDR::from_boolean x) +{ + return (x.val_ ? os << "true" : os << "false"); +} + +std::ostream& +operator<< (std::ostream &os, ACE_OutputCDR::from_char x) +{ + return os << '\'' << x.val_ << '\''; +} + +std::ostream& +operator<< (std::ostream &os, ACE_OutputCDR::from_wchar x) +{ + os.setf (ios_base::showbase); + os.setf (ios_base::hex, ios_base::basefield); + os << x.val_; + os.unsetf (ios_base::showbase); + os.setf (ios_base::dec, ios_base::basefield); + return os; +} + +std::ostream& +operator<< (std::ostream &os, ACE_OutputCDR::from_octet x) +{ + // Same format (hex) and no risk of overflow. + ACE_CDR::WChar w = static_cast (x.val_); + ACE_OutputCDR::from_wchar tmp (w); + return os << tmp; +} + +#endif /* GEN_OSTREAM_OPS */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/CDR_Stream.h b/externals/ace/CDR_Stream.h new file mode 100644 index 0000000..0a200dc --- /dev/null +++ b/externals/ace/CDR_Stream.h @@ -0,0 +1,1402 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CDR_Stream.h + * + * $Id: CDR_Stream.h 84527 2009-02-19 14:01:42Z johnnyw $ + * + * ACE Common Data Representation (CDR) marshaling and demarshaling + * classes. + * + * This implementation was inspired in the CDR class in SunSoft's + * IIOP engine, but has a completely different implementation and a + * different interface too. + * + * The current implementation assumes that the host has 1-byte, + * 2-byte and 4-byte integral types, and that it has single + * precision and double precision IEEE floats. + * Those assumptions are pretty good these days, with Crays being + * the only known exception. + * + * Optimizations + * ------------- + * ACE_LACKS_CDR_ALIGNMENT + * @author Arvind S. Krishna + * + * CDR stream ignores alignment when marshaling data. Use this option + * only when ACE_DISABLE_SWAP_ON_READ can be enabled. This option requires + * ACE CDR engine to do both marshaling and demarshaling. + * + * + * @author TAO version by Aniruddha Gokhale + * @author Carlos O'Ryan + * @author ACE version by Jeff Parsons + * @author Istvan Buki + * @author Codeset translation by Jim Rogers + */ +//============================================================================= + +#ifndef ACE_CDR_STREAM_H +#define ACE_CDR_STREAM_H + +#include /**/ "ace/pre.h" + +#include "ace/CDR_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SStringfwd.h" +#include "ace/Message_Block.h" + +#if defined (GEN_OSTREAM_OPS) +#include "ace/streams.h" +#endif /* GEN_OSTREAM_OPS */ + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) +#include "Monitor_Size.h" +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Char_Codeset_Translator; +class ACE_WChar_Codeset_Translator; + +class ACE_InputCDR; + +/** + * @class ACE_OutputCDR + * + * @brief A CDR stream for marshalling data, most often for transmission to + * another system which may or may not have the same byte order. + * + * This class is based on the the CORBA spec for Java (98-02-29), + * java class omg.org.CORBA.portable.OutputStream. It diverts in + * a few ways: + * @li Operations taking arrays don't have offsets, because in C++ + * it is easier to describe an array starting from x+offset. + * @li Operations return an error status, because exceptions are + * not widely available in C++ (yet). + */ +class ACE_Export ACE_OutputCDR +{ +public: + /** + * The Codeset translators need access to some private members to + * efficiently marshal arrays + * For reading from an output CDR stream. + */ + friend class ACE_Char_Codeset_Translator; + friend class ACE_WChar_Codeset_Translator; + friend class ACE_InputCDR; + + /** + * Default constructor; allows one to set byte ordering, allocators, and + * tuning information. + * + * @param size Causes constructor to preallocate @a size bytes; if + * @a size is 0 it allocates the default size. + * + * @param byte_order The byte order that data will have within this + * object. Unless otherwise specified, the byte order + * will be the order native to the hardware this is + * executed on. To force the marshalled data to have + * a specific order, specify one of the values defined + * in ACE_CDR::Byte_Order. + * @note The @c ACE_ENABLE_SWAP_ON_WRITE config macro + * must be set for any local byte swapping to occur + * as data is inserted into an ACE_OutputCDR object. + */ + ACE_OutputCDR (size_t size = 0, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0, + ACE_Allocator* message_block_allocator = 0, + size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, + ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// Build a CDR stream with an initial buffer, it will *not* remove + /// @a data, since it did not allocated it. It's important to be careful + /// with the alignment of @a data. + /** + * Create an output stream from an arbitrary buffer, care must be + * exercised with alignment, because this contructor will align if + * needed. In this case @a data will not point to the start of the + * output stream. @c begin()->rd_ptr() points to the start of the + * output stream. See @c ACE_ptr_align_binary() to properly align a + * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment. + */ + ACE_OutputCDR (char *data, + size_t size, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0, + ACE_Allocator* message_block_allocator = 0, + size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, + ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// Build a CDR stream with an initial data block, it will *not* remove + /// , since it did not allocated it. It's important to be + // careful with the alignment of . + /** + * Create an output stream from an arbitrary data block, care must be + * exercised with alignment, because this contructor will align if + * needed. In this case @a data_block will not point to the + * start of the output stream. begin()->rd_ptr() points to the start + * off the output stream. See ACE_ptr_align_binary() to properly align a + * pointer and use ACE_CDR::MAX_ALIGNMENT for the correct alignment. + */ + ACE_OutputCDR (ACE_Data_Block *data_block, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_Allocator* message_block_allocator = 0, + size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, + ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// Build a CDR stream with an initial Message_Block chain, it will + /// *not* remove @a data, since it did not allocate it. + ACE_OutputCDR (ACE_Message_Block *data, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + size_t memcpy_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, + ACE_CDR::Octet giop_major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet giop_minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// destructor + ~ACE_OutputCDR (void); + + /** + * Disambiguate overload when inserting booleans, octets, chars, and + * bounded strings. + */ + //@{ @name Helper classes + + struct ACE_Export from_boolean + { + explicit from_boolean (ACE_CDR::Boolean b); + ACE_CDR::Boolean val_; + }; + + struct ACE_Export from_octet + { + explicit from_octet (ACE_CDR::Octet o); + ACE_CDR::Octet val_; + }; + + struct ACE_Export from_char + { + explicit from_char (ACE_CDR::Char c); + ACE_CDR::Char val_; + }; + + struct ACE_Export from_wchar + { + explicit from_wchar (ACE_CDR::WChar wc); + ACE_CDR::WChar val_; + }; + + struct ACE_Export from_string + { + from_string (ACE_CDR::Char* s, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); + from_string (const ACE_CDR::Char* s, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); + ACE_CDR::Char *val_; + ACE_CDR::ULong bound_; + ACE_CDR::Boolean nocopy_; + }; + + struct ACE_Export from_wstring + { + from_wstring (ACE_CDR::WChar* ws, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); + from_wstring (const ACE_CDR::WChar* ws, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy = 0); + ACE_CDR::WChar *val_; + ACE_CDR::ULong bound_; + ACE_CDR::Boolean nocopy_; + }; + //@} + + /** + * @{ @name Write operations + * Return 0 on failure and 1 on success. + */ + ACE_CDR::Boolean write_boolean (ACE_CDR::Boolean x); + ACE_CDR::Boolean write_char (ACE_CDR::Char x); + ACE_CDR::Boolean write_wchar (ACE_CDR::WChar x); + ACE_CDR::Boolean write_octet (ACE_CDR::Octet x); + ACE_CDR::Boolean write_short (ACE_CDR::Short x); + ACE_CDR::Boolean write_ushort (ACE_CDR::UShort x); + ACE_CDR::Boolean write_long (ACE_CDR::Long x); + ACE_CDR::Boolean write_ulong (ACE_CDR::ULong x); + ACE_CDR::Boolean write_longlong (const ACE_CDR::LongLong &x); + ACE_CDR::Boolean write_ulonglong (const ACE_CDR::ULongLong &x); + ACE_CDR::Boolean write_float (ACE_CDR::Float x); + ACE_CDR::Boolean write_double (const ACE_CDR::Double &x); + ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x); + + /// For string we offer methods that accept a precomputed length. + ACE_CDR::Boolean write_string (const ACE_CDR::Char *x); + ACE_CDR::Boolean write_string (ACE_CDR::ULong len, + const ACE_CDR::Char *x); + ACE_CDR::Boolean write_string (const ACE_CString &x); + ACE_CDR::Boolean write_wstring (const ACE_CDR::WChar *x); + ACE_CDR::Boolean write_wstring (ACE_CDR::ULong length, + const ACE_CDR::WChar *x); + //@} + + /// @note the portion written starts at @a x and ends + /// at @a x + @a length. + /// The length is *NOT* stored into the CDR stream. + //@{ @name Array write operations + ACE_CDR::Boolean write_boolean_array (const ACE_CDR::Boolean *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_char_array (const ACE_CDR::Char *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_wchar_array (const ACE_CDR::WChar* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_octet_array (const ACE_CDR::Octet* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_short_array (const ACE_CDR::Short *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_ushort_array (const ACE_CDR::UShort *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_long_array (const ACE_CDR::Long *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_ulong_array (const ACE_CDR::ULong *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_longlong_array (const ACE_CDR::LongLong* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_ulonglong_array (const ACE_CDR::ULongLong *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_float_array (const ACE_CDR::Float *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_double_array (const ACE_CDR::Double *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x, + ACE_CDR::ULong length); + + /// Write an octet array contained inside a MB, this can be optimized + /// to minimize copies. + ACE_CDR::Boolean write_octet_array_mb (const ACE_Message_Block* mb); + //@} + + /** + * @{ @name Placeholder/replace operations + * Facilitates writing a placeholder into a CDR stream to be replaced + * later with a different value. + * + * @note An example use for this facility is: + * @code + ACE_OutputCDR strm; + ... // insert values... + char *pos = strm.write_long_placeholder (); + ... // insert more values + ACE_CDR::Long real_val; // Somehow assign the "correct" value + strm.replace (real_val, pos); // Replace earlier placeholder + @endcode + */ + + /** + * Write a placeholder into the stream. The placeholder's pointer + * is returned so it may later be passed as the @a loc argument to + * replace (). + * These methods align the stream's write pointer properly prior to + * writing the placeholder. + * + * @retval Pointer to the placeholder; 0 if there is not enough space + * in the stream and memory could not be allocated. + */ + char* write_long_placeholder (void); + char* write_short_placeholder (void); + + /** + * Writes a new value into a specific location. This is commonly + * used to update a prior "placeholder" location in the stream. + * The specified location is assumed to have proper CDR alignment for the + * type to insert. This requirement is satisfied by using one of the + * placeholder-writing methods to align the stream for the anticipated + * value and obtain the correct location. + * Treatment of @a x with repect to byte swapping is the same as for when + * any value is inserted. + * + * @param x The value to insert into the specified location. + * @param loc The location at which to insert @a x. @a loc must be a valid + * position within the stream's current set of message blocks. + * + * @sa write_long_placeholder(), write_short_placeholder () + */ + ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::Short x, char* loc); + //@} + + /** + * Return 0 on failure and 1 on success. + */ + //@{ @name Append contents of own CDR stream to another + ACE_CDR::Boolean append_boolean (ACE_InputCDR &); + ACE_CDR::Boolean append_char (ACE_InputCDR &); + ACE_CDR::Boolean append_wchar (ACE_InputCDR &); + ACE_CDR::Boolean append_octet (ACE_InputCDR &); + ACE_CDR::Boolean append_short (ACE_InputCDR &); + ACE_CDR::Boolean append_ushort (ACE_InputCDR &); + ACE_CDR::Boolean append_long (ACE_InputCDR &); + ACE_CDR::Boolean append_ulong (ACE_InputCDR &); + ACE_CDR::Boolean append_longlong (ACE_InputCDR &); + ACE_CDR::Boolean append_ulonglong (ACE_InputCDR &); + ACE_CDR::Boolean append_float (ACE_InputCDR &); + ACE_CDR::Boolean append_double (ACE_InputCDR &); + ACE_CDR::Boolean append_longdouble (ACE_InputCDR &); + + ACE_CDR::Boolean append_wstring (ACE_InputCDR &); + ACE_CDR::Boolean append_string (ACE_InputCDR &); + //@} + + /// Returns @c false if an error has ocurred. + /** + * @note The only expected error is to run out of memory. + */ + bool good_bit (void) const; + + /// Reuse the CDR stream to write on the old buffer. + void reset (void); + + /// Add the length of each message block in the chain. + size_t total_length (void) const; + + /** + * Return the start of the message block chain for this CDR stream. + * @note The complete CDR stream is represented by a chain of + * message blocks. + */ + const ACE_Message_Block *begin (void) const; + + /// Return the last message in the chain that is is use. + const ACE_Message_Block *end (void) const; + + /// Return the message block in chain. + const ACE_Message_Block *current (void) const; + + /// Replace the message block chain with a single message block. + /** + * Upon successful completion, there will be a single message block + * containing the data from the complete message block chain. + * + * @note The only expected error is to run out of memory. + */ + int consolidate (void); + + /** + * Access the underlying buffer (read only). @note This + * method only returns a pointer to the first block in the + * chain. + */ + const char *buffer (void) const; + + /** + * Return the size of first message block in the block chain. @note This + * method only returns information about the first block in the + * chain. + */ + size_t length (void) const; + + /** + * Utility function to allow the user more flexibility. + * Pads the stream up to the nearest -byte boundary. + * Argument MUST be a power of 2. + * Returns 0 on success and -1 on failure. + */ + int align_write_ptr (size_t alignment); + + /// Access the codeset translators. They can be null! + ACE_Char_Codeset_Translator *char_translator (void) const; + ACE_WChar_Codeset_Translator *wchar_translator (void) const; + + /// Set the char codeset translator. + void char_translator (ACE_Char_Codeset_Translator *); + /// Set the wchar codeset translator. + void wchar_translator (ACE_WChar_Codeset_Translator *); + + /// set the global size of serialized wchars. This may be different + /// than the size of a wchar_t. + static void wchar_maxbytes (size_t max_bytes); + + /// access the serialized size of wchars. + static size_t wchar_maxbytes (void); + + /** + * Return alignment of the wr_ptr(), with respect to the start of + * the CDR stream. This is not the same as the alignment of + * current->wr_ptr()! + */ + size_t current_alignment (void) const; + + void current_alignment (size_t current_alignment); + + /** + * Returns (in @a buf) the next position in the buffer aligned to + * @a size, it advances the Message_Block wr_ptr past the data + * (i.e., @a buf + @a size). If necessary it grows the Message_Block + * buffer. Sets the good_bit to false and returns a -1 on failure. + */ + int adjust (size_t size, + char *&buf); + + /// As above, but now the size and alignment requirements may be + /// different. + int adjust (size_t size, + size_t align, + char *&buf); + + /// Returns true if this stream is writing in non-native byte order + /// and false otherwise. For example, it would be true if either + /// ACE_ENABLE_SWAP_ON_WRITE is defined or a specific byte order was + /// specified for this stream. + bool do_byte_swap (void) const; + + /// Returns the byte order this stream is marshaling data in. Will be one + /// of the values in ACE_CDR::Byte_Order. + int byte_order (void) const; + + /// For use by a gateway, which creates the output stream for the + /// reply to the client in its native byte order, but which must + /// send the reply in the byte order of the target's reply to the + /// gateway. + void reset_byte_order (int byte_order); + + /// set GIOP version info + void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor); + + /// Set the underlying GIOP version.. + void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + /// Register and unregister our buffer size monitor. + void register_monitor (const char* id); + void unregister_monitor (void); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + +private: + + // Find the message block in the chain of message blocks + // that the provide location locates. + ACE_Message_Block* find (char* loc); + + /// disallow copying... + ACE_OutputCDR (const ACE_OutputCDR& rhs); + ACE_OutputCDR& operator= (const ACE_OutputCDR& rhs); + + ACE_CDR::Boolean write_1 (const ACE_CDR::Octet *x); + ACE_CDR::Boolean write_2 (const ACE_CDR::UShort *x); + ACE_CDR::Boolean write_4 (const ACE_CDR::ULong *x); + ACE_CDR::Boolean write_8 (const ACE_CDR::ULongLong *x); + ACE_CDR::Boolean write_16 (const ACE_CDR::LongDouble *x); + + /** + * write an array of @a length elements, each of @a size bytes and the + * start aligned at a multiple of . The elements are assumed + * to be packed with the right alignment restrictions. It is mostly + * designed for buffers of the basic types. + * + * This operation uses ; as explained above it is expected + * that using assignment is faster that for one element, + * but for several elements should be more efficient, it + * could be interesting to find the break even point and optimize + * for that case, but that would be too platform dependent. + */ + ACE_CDR::Boolean write_array (const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length); + + + ACE_CDR::Boolean write_wchar_array_i (const ACE_CDR::WChar* x, + ACE_CDR::ULong length); + + + /** + * Grow the CDR stream. When it returns @a buf contains a pointer to + * memory in the CDR stream, with at least @a size bytes ahead of it + * and aligned to an boundary. It moved the to . + */ + int grow_and_adjust (size_t size, + size_t align, + char *&buf); + +private: + /// The start of the chain of message blocks. + ACE_Message_Block start_; + + /// The current block in the chain where we are writing. + ACE_Message_Block *current_; + +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + /** + * The current alignment as measured from the start of the buffer. + * Usually this coincides with the alignment of the buffer in + * memory, but, when we chain another buffer this "quasi invariant" + * is broken. + * The current_alignment is used to readjust the buffer following + * the stolen message block. + */ + size_t current_alignment_; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + /** + * Is the current block writable. When we steal a buffer from the + * user and just chain it into the message block we are not supposed + * to write on it, even if it is past the start and end of the + * buffer. + */ + bool current_is_writable_; + + /** + * If not zero swap bytes at writing so the created CDR stream byte + * order does *not* match the machine byte order. The motivation + * for such a beast is that in some setting a few (fast) machines + * can be serving hundreds of slow machines with the opposite byte + * order, so it makes sense (as a load balancing device) to put the + * responsibility in the writers. THIS IS NOT A STANDARD IN CORBA, + * USE AT YOUR OWN RISK + */ + bool do_byte_swap_; + + /// Set to false when an error ocurrs. + bool good_bit_; + + /// Break-even point for copying. + size_t const memcpy_tradeoff_; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE::Monitor_Control::Size_Monitor *monitor_; +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + +protected: + /// GIOP version information + ACE_CDR::Octet major_version_; + ACE_CDR::Octet minor_version_; + + /// If not nil, invoke for translation of character and string data. + ACE_Char_Codeset_Translator *char_translator_; + ACE_WChar_Codeset_Translator *wchar_translator_; + + /** + * Some wide char codesets may be defined with a maximum number + * of bytes that is smaller than the size of a wchar_t. This means + * that the CDR cannot simply memcpy a block of wchars to and from + * the stream, but must instead realign the bytes appropriately. + * In cases when wchar i/o is not allowed, such as with GIOP 1.0, + * or not having a native wchar codeset defined, the maxbytes is + * set to zero, indicating no wchar data is allowed. + */ + static size_t wchar_maxbytes_; +}; + + +// **************************************************************** + +/** + * @class ACE_InputCDR + * + * @brief A CDR stream for demarshalling CDR-encoded data. + * + * This class is based on the the CORBA spec for Java (98-02-29), + * java class omg.org.CORBA.portable.InputStream. It diverts in a + * few ways: + * @li Operations to retrieve basic types take parameters by + * reference. + * @li Operations taking arrays don't have offsets, because in C++ + * it is easier to describe an array starting from x+offset. + * @li Operations return an error status, because exceptions are + * not widely available in C++ (yet). + */ +class ACE_Export ACE_InputCDR +{ +public: + // The translators need privileged access to efficiently demarshal + // arrays and such. + friend class ACE_Char_Codeset_Translator; + friend class ACE_WChar_Codeset_Translator; + + /** + * Create an input stream from an arbitrary buffer. The buffer must + * be properly aligned because this contructor will *not* work if + * the buffer is aligned unproperly.See ACE_ptr_align_binary() for + * instructions on how to align a pointer properly and use + * ACE_CDR::MAX_ALIGNMENT for the correct alignment. + */ + ACE_InputCDR (const char *buf, + size_t bufsiz, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// Create an empty input stream. The caller is responsible for + /// putting the right data and providing the right alignment. + ACE_InputCDR (size_t bufsiz, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// Create an input stream from an ACE_Message_Block + /** + * The alignment of the @a data block is carried into the new + * ACE_InputCDR object. This constructor either increments the + * @a data reference count, or copies the data (if it's a compound + * message block) so the caller can release the block immediately + * upon return. + */ + ACE_InputCDR (const ACE_Message_Block *data, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION, + ACE_Lock* lock = 0); + + /// Create an input stream from an ACE_Data_Block. The + /// indicates whether the @a data can be deleted by the CDR stream + /// or not + ACE_InputCDR (ACE_Data_Block *data, + ACE_Message_Block::Message_Flags flag = 0, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /// Create an input stream from an ACE_Data_Block. It also sets the + /// read and write pointers at the desired positions. This would be + /// helpful if the applications desires to create a new CDR stream + /// from a semi-processed datablock. + ACE_InputCDR (ACE_Data_Block *data, + ACE_Message_Block::Message_Flags flag, + size_t read_pointer_position, + size_t write_pointer_position, + int byte_order = ACE_CDR::BYTE_ORDER_NATIVE, + ACE_CDR::Octet major_version = ACE_CDR_GIOP_MAJOR_VERSION, + ACE_CDR::Octet minor_version = ACE_CDR_GIOP_MINOR_VERSION); + + /** + * These make a copy of the current stream state, but do not copy + * the internal buffer, so the same stream can be read multiple + * times efficiently. + */ + ACE_InputCDR (const ACE_InputCDR& rhs); + + ACE_InputCDR& operator= (const ACE_InputCDR& rhs); + + /// When interpreting indirected TypeCodes it is useful to make a + /// "copy" of the stream starting in the new position. + ACE_InputCDR (const ACE_InputCDR& rhs, + size_t size, + ACE_CDR::Long offset); + + /// This creates an encapsulated stream, the first byte must be (per + /// the spec) the byte order of the encapsulation. + ACE_InputCDR (const ACE_InputCDR& rhs, + size_t size); + + /// Create an input CDR from an output CDR. + ACE_InputCDR (const ACE_OutputCDR& rhs, + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0, + ACE_Allocator* message_block_allocator = 0); + + /// Helper class to transfer the contents from one input CDR to + /// another without requiring any extra memory allocations, data + /// copies or too many temporaries. + struct ACE_Export Transfer_Contents + { + Transfer_Contents (ACE_InputCDR &rhs); + + ACE_InputCDR &rhs_; + }; + /// Transfer the contents from to a new CDR + ACE_InputCDR (Transfer_Contents rhs); + + /// Destructor + ~ACE_InputCDR (void); + + /// Disambiguate overloading when extracting octets, chars, + /// booleans, and bounded strings + //@{ @name Helper classes + + struct ACE_Export to_boolean + { + explicit to_boolean (ACE_CDR::Boolean &b); + ACE_CDR::Boolean &ref_; + }; + + struct ACE_Export to_char + { + explicit to_char (ACE_CDR::Char &c); + ACE_CDR::Char &ref_; + }; + + struct ACE_Export to_wchar + { + explicit to_wchar (ACE_CDR::WChar &wc); + ACE_CDR::WChar &ref_; + }; + + struct ACE_Export to_octet + { + explicit to_octet (ACE_CDR::Octet &o); + ACE_CDR::Octet &ref_; + }; + + struct ACE_Export to_string + { + /** + * @deprecated The constructor taking a non-const string is now + * deprecated (C++ mapping 00-01-02), but we keep it + * around for backward compatibility. + */ + to_string (ACE_CDR::Char *&s, + ACE_CDR::ULong b); + to_string (const ACE_CDR::Char *&s, + ACE_CDR::ULong b); + const ACE_CDR::Char *&val_; + ACE_CDR::ULong bound_; + }; + + struct ACE_Export to_wstring + { + /// The constructor taking a non-const wstring is + /// now deprecated (C++ mapping 00-01-02), but we + /// keep it around for backward compatibility. + to_wstring (ACE_CDR::WChar *&ws, + ACE_CDR::ULong b); + to_wstring (const ACE_CDR::WChar *&ws, + ACE_CDR::ULong b); + const ACE_CDR::WChar *&val_; + ACE_CDR::ULong bound_; + }; + //@} + + /** + * Return @c false on failure and @c true on success. + */ + //@{ @name Read basic IDL types + ACE_CDR::Boolean read_boolean (ACE_CDR::Boolean& x); + ACE_CDR::Boolean read_char (ACE_CDR::Char &x); + ACE_CDR::Boolean read_wchar (ACE_CDR::WChar& x); + ACE_CDR::Boolean read_octet (ACE_CDR::Octet& x); + ACE_CDR::Boolean read_short (ACE_CDR::Short &x); + ACE_CDR::Boolean read_ushort (ACE_CDR::UShort &x); + ACE_CDR::Boolean read_long (ACE_CDR::Long &x); + ACE_CDR::Boolean read_ulong (ACE_CDR::ULong &x); + ACE_CDR::Boolean read_longlong (ACE_CDR::LongLong& x); + ACE_CDR::Boolean read_ulonglong (ACE_CDR::ULongLong& x); + ACE_CDR::Boolean read_float (ACE_CDR::Float &x); + ACE_CDR::Boolean read_double (ACE_CDR::Double &x); + ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x); + + ACE_CDR::Boolean read_string (ACE_CDR::Char *&x); + ACE_CDR::Boolean read_string (ACE_CString &x); + ACE_CDR::Boolean read_wstring (ACE_CDR::WChar*& x); + //@} + + /** + * The buffer @a x must be large enough to contain @a length + * elements. + * Return @c false on failure and @c true on success. + */ + //@{ @name Read basic IDL types arrays + ACE_CDR::Boolean read_boolean_array (ACE_CDR::Boolean* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_char_array (ACE_CDR::Char *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_wchar_array (ACE_CDR::WChar* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_octet_array (ACE_CDR::Octet* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_short_array (ACE_CDR::Short *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_ushort_array (ACE_CDR::UShort *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_long_array (ACE_CDR::Long *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_ulong_array (ACE_CDR::ULong *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_longlong_array (ACE_CDR::LongLong* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_ulonglong_array (ACE_CDR::ULongLong* x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_float_array (ACE_CDR::Float *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_double_array (ACE_CDR::Double *x, + ACE_CDR::ULong length); + ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x, + ACE_CDR::ULong length); + //@} + + /** + * Return @c false on failure and @c true on success. + */ + //@{ @name Skip elements + ACE_CDR::Boolean skip_boolean (void); + ACE_CDR::Boolean skip_char (void); + ACE_CDR::Boolean skip_wchar (void); + ACE_CDR::Boolean skip_octet (void); + ACE_CDR::Boolean skip_short (void); + ACE_CDR::Boolean skip_ushort (void); + ACE_CDR::Boolean skip_long (void); + ACE_CDR::Boolean skip_ulong (void); + ACE_CDR::Boolean skip_longlong (void); + ACE_CDR::Boolean skip_ulonglong (void); + ACE_CDR::Boolean skip_float (void); + ACE_CDR::Boolean skip_double (void); + ACE_CDR::Boolean skip_longdouble (void); + //@} + + /** + * The next field must be a string, this method skips it. It is + * useful in parsing a TypeCode. + * @return @c false on failure and @c true on success. + */ + ACE_CDR::Boolean skip_wstring (void); + ACE_CDR::Boolean skip_string (void); + + /// Skip @a n bytes in the CDR stream. + /** + * @return @c false on failure and @c true on success. + */ + ACE_CDR::Boolean skip_bytes (size_t n); + + /// returns @c false if a problem has been detected. + bool good_bit (void) const; + + /** + * @return The start of the message block chain for this CDR + * stream. + * + * @note In the current implementation the chain has length 1, but + * we are planning to change that. + */ + const ACE_Message_Block* start (void) const; + + // = The following functions are useful to read the contents of the + // CDR stream from a socket or file. + + /** + * Grow the internal buffer, reset @c rd_ptr to the first byte in + * the new buffer that is properly aligned, and set @c wr_ptr to @c + * rd_ptr @c + @c newsize + */ + int grow (size_t newsize); + + /** + * After reading and partially parsing the contents the user can + * detect a change in the byte order, this method will let him/her + * change it. + */ + void reset_byte_order (int byte_order); + + /// Re-initialize the CDR stream, copying the contents of the chain + /// of message_blocks starting from @a data. + void reset (const ACE_Message_Block *data, + int byte_order); + + /// Steal the contents from the current CDR. + ACE_Message_Block *steal_contents (void); + + /// Steal the contents of @a cdr and make a shallow copy into this + /// stream. + void steal_from (ACE_InputCDR &cdr); + + /// Exchange data blocks with the caller of this method. The read + /// and write pointers are also exchanged. + /** + * @note We now do only with the start_ message block. + */ + void exchange_data_blocks (ACE_InputCDR &cdr); + + /// Copy the data portion from the @a cdr to this cdr and return the + /// data content (ie. the ACE_Data_Block) from this CDR to the + /// caller. + /** + * @note The caller is responsible for managing the memory of the + * returned ACE_Data_Block. + */ + ACE_Data_Block* clone_from (ACE_InputCDR &cdr); + + /// Re-initialize the CDR stream, forgetting about the old contents + /// of the stream and allocating a new buffer (from the allocators). + void reset_contents (void); + + /// Returns the current position for the @c rd_ptr. + char* rd_ptr (void); + + /// Returns the current position for the @c wr_ptr. + char* wr_ptr (void); + + /// Return how many bytes are left in the stream. + size_t length (void) const; + + /** + * Utility function to allow the user more flexibility. + * Skips up to the nearest @a alignment-byte boundary. + * Argument MUST be a power of 2. + * + * @return 0 on success and -1 on failure. + */ + int align_read_ptr (size_t alignment); + + /// If @c true then this stream is writing in non-native byte order. + /// This is only meaningful if ACE_ENABLE_SWAP_ON_WRITE is defined. + bool do_byte_swap (void) const; + + /// If @c do_byte_swap() returns @c false, this returns + /// ACE_CDR_BYTE_ORDER else it returns !ACE_CDR_BYTE_ORDER. + int byte_order (void) const; + + /// Access the codeset translators. They can be nil! + ACE_Char_Codeset_Translator *char_translator (void) const; + ACE_WChar_Codeset_Translator *wchar_translator (void) const; + + /// Set the codeset translators. + void char_translator (ACE_Char_Codeset_Translator *); + void wchar_translator (ACE_WChar_Codeset_Translator *); + + /** + * Returns (in @a buf) the next position in the buffer aligned to + * @a size. It advances the Message_Block @c rd_ptr past the data + * (i.e., @c buf @c + @c size). Sets the good_bit to @c false and + * returns a -1 on failure. + */ + int adjust (size_t size, + char *&buf); + + /// As above, but now the size and alignment requirements may be + /// different. + int adjust (size_t size, + size_t align, + char *&buf); + + /// Set the underlying GIOP version.. + void set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor); + + /// Set the underlying GIOP version.. + void get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + /// Register and unregister our buffer size monitor. + void register_monitor (const char* id); + void unregister_monitor (void); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + +protected: + + /// The start of the chain of message blocks, even though in the + /// current version the chain always has length 1. + ACE_Message_Block start_; + + /// The CDR stream byte order does not match the one on the machine, + /// swapping is needed while reading. + bool do_byte_swap_; + + /// set to @c false when an error occurs. + bool good_bit_; + + /// The GIOP versions for this stream + ACE_CDR::Octet major_version_; + ACE_CDR::Octet minor_version_; + + /// If not nil, invoke for translation of character and string data. + ACE_Char_Codeset_Translator *char_translator_; + ACE_WChar_Codeset_Translator *wchar_translator_; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + ACE::Monitor_Control::Size_Monitor *monitor_; +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + +private: + + ACE_CDR::Boolean read_1 (ACE_CDR::Octet *x); + ACE_CDR::Boolean read_2 (ACE_CDR::UShort *x); + ACE_CDR::Boolean read_4 (ACE_CDR::ULong *x); + ACE_CDR::Boolean read_8 (ACE_CDR::ULongLong *x); + ACE_CDR::Boolean read_16 (ACE_CDR::LongDouble *x); + + // Several types can be read using the same routines, since TAO + // tries to use native types with known size for each CORBA type. + // We could use void* or char* to make the interface more + // consistent, but using native types let us exploit the strict + // alignment requirements of CDR streams and implement the + // operations using asignment. + + /** + * Read an array of @a length elements, each of @a size bytes and the + * start aligned at a multiple of . The elements are assumed + * to be packed with the right alignment restrictions. It is mostly + * designed for buffers of the basic types. + * + * This operation uses ; as explained above it is expected + * that using assignment is faster that for one element, + * but for several elements should be more efficient, it + * could be interesting to find the break even point and optimize + * for that case, but that would be too platform dependent. + */ + ACE_CDR::Boolean read_array (void* x, + size_t size, + size_t align, + ACE_CDR::ULong length); + + /** + * On those occasions when the native codeset for wchar is smaller than + * the size of a wchar_t, such as using UTF-16 with a 4-byte wchar_t, a + * special form of reading the array is needed. Actually, this should be + * a default translator. + */ + ACE_CDR::Boolean read_wchar_array_i (ACE_CDR::WChar * x, + ACE_CDR::ULong length); + + /// Move the rd_ptr ahead by @a offset bytes. + void rd_ptr (size_t offset); + + /// Points to the continuation field of the current message block. + char* end (void); +}; + +// **************************************************************** + +/** + * @class ACE_Char_Codeset_Translator + * + * @brief Codeset translation routines common to both Output and Input + * CDR streams. + * + * This class is a base class for defining codeset translation + * routines to handle the character set translations required by + * both CDR Input streams and CDR Output streams. + * + * Translators are reference counted. This allows for stateful as well + * as stateless translators. Stateless translators will be allocated + * once whereas CDR Streams own their own copy of a stateful translator. + */ +class ACE_Export ACE_Char_Codeset_Translator +{ +public: + virtual ~ACE_Char_Codeset_Translator (); + + /// Read a single character from the stream, converting from the + /// stream codeset to the native codeset + virtual ACE_CDR::Boolean read_char (ACE_InputCDR&, + ACE_CDR::Char&) = 0; + + /// Read a string from the stream, including the length, converting + /// the characters from the stream codeset to the native codeset + virtual ACE_CDR::Boolean read_string (ACE_InputCDR&, + ACE_CDR::Char *&) = 0; + + /// Read an array of characters from the stream, converting the + /// characters from the stream codeset to the native codeset. + virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR&, + ACE_CDR::Char*, + ACE_CDR::ULong) = 0; + + /// Write a single character to the stream, converting from the + /// native codeset to the stream codeset + virtual ACE_CDR::Boolean write_char (ACE_OutputCDR&, + ACE_CDR::Char) = 0; + + /// Write a string to the stream, including the length, converting + /// from the native codeset to the stream codeset + virtual ACE_CDR::Boolean write_string (ACE_OutputCDR&, + ACE_CDR::ULong, + const ACE_CDR::Char*) = 0; + + /// Write an array of characters to the stream, converting from the + /// native codeset to the stream codeset + virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR&, + const ACE_CDR::Char*, + ACE_CDR::ULong) = 0; + + virtual ACE_CDR::ULong ncs () = 0; + virtual ACE_CDR::ULong tcs () = 0; +protected: + /// Children have access to low-level routines because they cannot + /// use read_char or something similar (it would recurse). + ACE_CDR::Boolean read_1 (ACE_InputCDR& input, + ACE_CDR::Octet *x); + ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, + const ACE_CDR::Octet *x); + + /// Efficiently read @a length elements of size @a size each from + /// into ; the data must be aligned to . + ACE_CDR::Boolean read_array (ACE_InputCDR& input, + void* x, + size_t size, + size_t align, + ACE_CDR::ULong length); + + /** + * Efficiently write @a length elements of size @a size from into + * . Before inserting the elements enough padding is added + * to ensure that the elements will be aligned to in the + * stream. + */ + ACE_CDR::Boolean write_array (ACE_OutputCDR& output, + const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length); + + /** + * Exposes the stream implementation of , this is useful in + * many cases to minimize memory allocations during marshaling. + * On success @a buf will contain a contiguous area in the CDR stream + * that can hold @a size bytes aligned to . + * Results + */ + int adjust (ACE_OutputCDR& out, + size_t size, + size_t align, + char *&buf); + + /// Used by derived classes to set errors in the CDR stream. + void good_bit (ACE_OutputCDR& out, bool bit); + + /// Obtain the CDR Stream's major & minor version values. + ACE_CDR::Octet major_version (ACE_InputCDR& input); + ACE_CDR::Octet minor_version (ACE_InputCDR& input); + ACE_CDR::Octet major_version (ACE_OutputCDR& output); + ACE_CDR::Octet minor_version (ACE_OutputCDR& output); +}; + +// **************************************************************** + +/** + * @class ACE_WChar_Codeset_Translator + * + * @brief Codeset translation routines common to both Output and Input + * CDR streams. + * + * This class is a base class for defining codeset translation + * routines to handle the character set translations required by + * both CDR Input streams and CDR Output streams. + */ +class ACE_Export ACE_WChar_Codeset_Translator +{ +public: + virtual ~ACE_WChar_Codeset_Translator (); + + virtual ACE_CDR::Boolean read_wchar (ACE_InputCDR&, + ACE_CDR::WChar&) = 0; + virtual ACE_CDR::Boolean read_wstring (ACE_InputCDR&, + ACE_CDR::WChar *&) = 0; + virtual ACE_CDR::Boolean read_wchar_array (ACE_InputCDR&, + ACE_CDR::WChar*, + ACE_CDR::ULong) = 0; + virtual ACE_CDR::Boolean write_wchar (ACE_OutputCDR&, + ACE_CDR::WChar) = 0; + virtual ACE_CDR::Boolean write_wstring (ACE_OutputCDR&, + ACE_CDR::ULong, + const ACE_CDR::WChar*) = 0; + virtual ACE_CDR::Boolean write_wchar_array (ACE_OutputCDR&, + const ACE_CDR::WChar*, + ACE_CDR::ULong) = 0; + + virtual ACE_CDR::ULong ncs () = 0; + virtual ACE_CDR::ULong tcs () = 0; +protected: + /// Children have access to low-level routines because they cannot + /// use read_char or something similar (it would recurse). + ACE_CDR::Boolean read_1 (ACE_InputCDR& input, + ACE_CDR::Octet *x); + ACE_CDR::Boolean read_2 (ACE_InputCDR& input, + ACE_CDR::UShort *x); + ACE_CDR::Boolean read_4 (ACE_InputCDR& input, + ACE_CDR::ULong *x); + ACE_CDR::Boolean write_1 (ACE_OutputCDR& output, + const ACE_CDR::Octet *x); + ACE_CDR::Boolean write_2 (ACE_OutputCDR& output, + const ACE_CDR::UShort *x); + ACE_CDR::Boolean write_4 (ACE_OutputCDR& output, + const ACE_CDR::ULong *x); + + /// Efficiently read @a length elements of size @a size each from + /// into ; the data must be aligned to . + ACE_CDR::Boolean read_array (ACE_InputCDR& input, + void* x, + size_t size, + size_t align, + ACE_CDR::ULong length); + + /** + * Efficiently write @a length elements of size @a size from into + * . Before inserting the elements enough padding is added + * to ensure that the elements will be aligned to in the + * stream. + */ + ACE_CDR::Boolean write_array (ACE_OutputCDR& output, + const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length); + + /** + * Exposes the stream implementation of , this is useful in + * many cases to minimize memory allocations during marshaling. + * On success @a buf will contain a contiguous area in the CDR stream + * that can hold @a size bytes aligned to . + * Results + */ + int adjust (ACE_OutputCDR& out, + size_t size, + size_t align, + char *&buf); + + /// Used by derived classes to set errors in the CDR stream. + void good_bit (ACE_OutputCDR& out, bool bit); + + /// Obtain the CDR Stream's major & minor version values. + ACE_CDR::Octet major_version (ACE_InputCDR& input); + ACE_CDR::Octet minor_version (ACE_InputCDR& input); + ACE_CDR::Octet major_version (ACE_OutputCDR& output); + ACE_CDR::Octet minor_version (ACE_OutputCDR& output); + +}; + +// @@ These operators should not be inlined since they force SString.h +// to be included in this header. +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + const ACE_CString &x); + +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CString &x); + + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +# include "ace/CDR_Stream.inl" +#else /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Not used by CORBA or TAO +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::Char x); +// CDR output operators for primitive types + +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::Short x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::UShort x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::Long x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::ULong x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::LongLong x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::ULongLong x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR& os, + ACE_CDR::LongDouble x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::Float x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_CDR::Double x); + +// CDR output operator from helper classes + +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_OutputCDR::from_boolean x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_OutputCDR::from_char x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_OutputCDR::from_wchar x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_OutputCDR::from_octet x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_OutputCDR::from_string x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + ACE_OutputCDR::from_wstring x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + const ACE_CDR::Char* x); +extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, + const ACE_CDR::WChar* x); + +// Not used by CORBA or TAO +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::Char &x); +// CDR input operators for primitive types + +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::Short &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::UShort &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::Long &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::ULong &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::LongLong &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::ULongLong &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::LongDouble &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::Float &x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::Double &x); + +// CDR input operator from helper classes + +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_InputCDR::to_boolean x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_InputCDR::to_char x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_InputCDR::to_wchar x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_InputCDR::to_octet x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_InputCDR::to_string x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_InputCDR::to_wstring x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::Char*& x); +extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, + ACE_CDR::WChar*& x); + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* __ACE_INLINE__ */ + +#if defined (GEN_OSTREAM_OPS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// ostream insertion operators for debugging code generated from IDL. All +// but these below are either in generated code itself or are unambiguous +// primitive types. + +ACE_Export std::ostream& operator<< (std::ostream &os, + ACE_OutputCDR::from_boolean x); + +ACE_Export std::ostream& operator<< (std::ostream &os, + ACE_OutputCDR::from_char x); + +ACE_Export std::ostream& operator<< (std::ostream &os, + ACE_OutputCDR::from_wchar x); + +ACE_Export std::ostream& operator<< (std::ostream &os, + ACE_OutputCDR::from_octet x); + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* GEN_OSTREAM_OPS */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CDR_STREAM_H */ diff --git a/externals/ace/CDR_Stream.inl b/externals/ace/CDR_Stream.inl new file mode 100644 index 0000000..2be60c1 --- /dev/null +++ b/externals/ace/CDR_Stream.inl @@ -0,0 +1,1727 @@ +// -*- C++ -*- +// +// $Id: CDR_Stream.inl 84206 2009-01-21 02:49:26Z schmidt $ + +#include "ace/OS_NS_string.h" +#include "ace/OS_Memory.h" + +// **************************************************************** + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// implementing the special types +ACE_INLINE +ACE_OutputCDR::from_boolean::from_boolean (ACE_CDR::Boolean b) + : val_ (b) +{ +} + +ACE_INLINE +ACE_InputCDR::to_boolean::to_boolean (ACE_CDR::Boolean &b) + : ref_ (b) +{ +} + +ACE_INLINE +ACE_OutputCDR::from_octet::from_octet (ACE_CDR::Octet o) + : val_ (o) +{ +} + +ACE_INLINE +ACE_InputCDR::to_octet::to_octet (ACE_CDR::Octet &o) + : ref_ (o) +{ +} + +ACE_INLINE +ACE_OutputCDR::from_char::from_char (ACE_CDR::Char c) + : val_ (c) +{ +} + +ACE_INLINE +ACE_InputCDR::to_char::to_char (ACE_CDR::Char &c) + : ref_ (c) +{ +} + +ACE_INLINE +ACE_OutputCDR::from_wchar::from_wchar (ACE_CDR::WChar wc) + : val_ (wc) +{ +} + +ACE_INLINE +ACE_InputCDR::to_wchar::to_wchar (ACE_CDR::WChar &wc) + : ref_ (wc) +{ +} + +ACE_INLINE +ACE_OutputCDR::from_string::from_string (ACE_CDR::Char *s, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy) + : val_ (s), + bound_ (b), + nocopy_ (nocopy) +{ +} + +ACE_INLINE +ACE_OutputCDR::from_string::from_string (const ACE_CDR::Char *s, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy) + : val_ (const_cast (s)), + bound_ (b), + nocopy_ (nocopy) +{ +} + +ACE_INLINE +ACE_InputCDR::to_string::to_string (ACE_CDR::Char *&s, + ACE_CDR::ULong b) + : val_ (const_cast (s)), + bound_ (b) +{ +} + +ACE_INLINE +ACE_InputCDR::to_string::to_string (const ACE_CDR::Char *&s, + ACE_CDR::ULong b) + : val_ (s), + bound_ (b) +{ +} + +ACE_INLINE +ACE_OutputCDR::from_wstring::from_wstring (ACE_CDR::WChar *ws, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy) + : val_ (ws), + bound_ (b), + nocopy_ (nocopy) +{ +} + +ACE_INLINE +ACE_OutputCDR::from_wstring::from_wstring (const ACE_CDR::WChar *ws, + ACE_CDR::ULong b, + ACE_CDR::Boolean nocopy) + : val_ (const_cast (ws)), + bound_ (b), + nocopy_ (nocopy) +{ +} + +ACE_INLINE +ACE_InputCDR::to_wstring::to_wstring (ACE_CDR::WChar *&ws, + ACE_CDR::ULong b) + : val_ (const_cast (ws)), + bound_ (b) +{ +} + +ACE_INLINE +ACE_InputCDR::to_wstring::to_wstring (const ACE_CDR::WChar *&ws, + ACE_CDR::ULong b) + : val_ (ws), + bound_ (b) +{ +} + +ACE_INLINE +ACE_InputCDR::Transfer_Contents::Transfer_Contents (ACE_InputCDR &rhs) + : rhs_ (rhs) +{ +} + +// **************************************************************** + +ACE_INLINE +ACE_OutputCDR::~ACE_OutputCDR (void) +{ + if (this->start_.cont () != 0) + { + ACE_Message_Block::release (this->start_.cont ()); + this->start_.cont (0); + } + + this->current_ = 0; + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->remove_ref (); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_INLINE void +ACE_OutputCDR::reset (void) +{ + this->current_ = &this->start_; + this->current_is_writable_ = true; + ACE_CDR::mb_align (&this->start_); + +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + this->current_alignment_ = 0; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + // It is tempting not to remove the memory, but we need to do so to + // release any potential user buffers chained in the continuation + // field. + + ACE_Message_Block * const cont = this->start_.cont (); + if (cont) + { + ACE_Message_Block::release (cont); + this->start_.cont (0); + } + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->start_.total_size ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +// Encode the CDR stream. + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_octet (ACE_CDR::Octet x) +{ + return this->write_1 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_boolean (ACE_CDR::Boolean x) +{ + return + static_cast ( + this->write_octet ( + x + ? static_cast (1) + : static_cast (0))); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_char (ACE_CDR::Char x) +{ + if (this->char_translator_ == 0) + { + ACE_CDR::Octet temp = static_cast (x); + return this->write_1 (&temp); + } + return this->char_translator_->write_char (*this, x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_short (ACE_CDR::Short x) +{ + ACE_CDR::UShort temp = static_cast (x); + return this->write_2 (&temp); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_ushort (ACE_CDR::UShort x) +{ + return this->write_2 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_long (ACE_CDR::Long x) +{ + ACE_CDR::ULong temp = static_cast (x); + return this->write_4 (&temp); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_ulong (ACE_CDR::ULong x) +{ + return this->write_4 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_longlong (const ACE_CDR::LongLong &x) +{ + void const * const temp = &x; + return this->write_8 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_ulonglong (const ACE_CDR::ULongLong &x) +{ + return this->write_8 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_float (ACE_CDR::Float x) +{ + void const * const temp = &x; + return this->write_4 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_double (const ACE_CDR::Double &x) +{ + void const * const temp = &x; + return this->write_8 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x) +{ + return this->write_16 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_string (const ACE_CDR::Char *x) +{ + if (x) + { + ACE_CDR::ULong const len = + static_cast (ACE_OS::strlen (x)); + return this->write_string (len, x); + } + + return this->write_string (0, 0); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_wstring (const ACE_CDR::WChar *x) +{ + if (x) + { + ACE_CDR::ULong const len = + static_cast (ACE_OS::strlen (x)); + return this->write_wstring (len, x); + } + + return this->write_wstring (0, 0); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x, + ACE_CDR::ULong length) +{ + if (this->char_translator_ == 0) + return this->write_array (x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + length); + return this->char_translator_->write_char_array (*this, x, length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_wchar_array (const ACE_CDR::WChar* x, + ACE_CDR::ULong length) +{ + if (this->wchar_translator_) + return this->wchar_translator_->write_wchar_array (*this, x, length); + + if (ACE_OutputCDR::wchar_maxbytes_ == 0) + { + errno = EACCES; + return (ACE_CDR::Boolean) (this->good_bit_ = false); + } + + if (ACE_OutputCDR::wchar_maxbytes_ == sizeof (ACE_CDR::WChar)) + return this->write_array (x, + sizeof (ACE_CDR::WChar), + sizeof (ACE_CDR::WChar) == 2 + ? ACE_CDR::SHORT_ALIGN + : ACE_CDR::LONG_ALIGN, + length); + return this->write_wchar_array_i (x,length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_octet_array (const ACE_CDR::Octet* x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_short_array (const ACE_CDR::Short *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::SHORT_SIZE, + ACE_CDR::SHORT_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_ushort_array (const ACE_CDR::UShort *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::SHORT_SIZE, + ACE_CDR::SHORT_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_long_array (const ACE_CDR::Long *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_ulong_array (const ACE_CDR::ULong *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_longlong_array (const ACE_CDR::LongLong *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_ulonglong_array (const ACE_CDR::ULongLong *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_float_array (const ACE_CDR::Float *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_double_array (const ACE_CDR::Double *x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x, + ACE_CDR::ULong length) +{ + return this->write_array (x, + ACE_CDR::LONGDOUBLE_SIZE, + ACE_CDR::LONGDOUBLE_ALIGN, + length); +} + +ACE_INLINE bool +ACE_OutputCDR::good_bit (void) const +{ + return this->good_bit_; +} + +ACE_INLINE int +ACE_OutputCDR::adjust (size_t size, + size_t align, + char*& buf) +{ + if (!this->current_is_writable_) + return this->grow_and_adjust (size, align, buf); + +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + size_t const offset = + ACE_align_binary (this->current_alignment_, align) + - this->current_alignment_; + + buf = this->current_->wr_ptr () + offset; +#else + buf = this->current_->wr_ptr (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + char * const end = buf + size; + + if (end <= this->current_->end () && + end >= buf) + { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + this->current_alignment_ += offset + size; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + this->current_->wr_ptr (end); + +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->receive (this->total_length ()); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ + + return 0; + } + + return this->grow_and_adjust (size, align, buf); +} + +ACE_INLINE int +ACE_OutputCDR::adjust (size_t size, char*& buf) +{ + return this->adjust (size, size, buf); +} + +ACE_INLINE void +ACE_OutputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor) +{ + this->major_version_ = major; + this->minor_version_ = minor; +} + +ACE_INLINE void +ACE_OutputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor) +{ + major = this->major_version_; + minor = this->minor_version_; +} + + +ACE_INLINE const ACE_Message_Block* +ACE_OutputCDR::begin (void) const +{ + return &this->start_; +} + +ACE_INLINE const ACE_Message_Block* +ACE_OutputCDR::end (void) const +{ + return this->current_->cont (); +} + +ACE_INLINE const ACE_Message_Block* +ACE_OutputCDR::current (void) const +{ + return this->current_; +} + +ACE_INLINE size_t +ACE_OutputCDR::total_length (void) const +{ + return ACE_CDR::total_length (this->begin (), this->end ()); +} + +ACE_INLINE const char* +ACE_OutputCDR::buffer (void) const +{ + return this->start_.rd_ptr (); +} + +ACE_INLINE size_t +ACE_OutputCDR::length (void) const +{ + return this->start_.length (); +} + +ACE_INLINE bool +ACE_OutputCDR::do_byte_swap (void) const +{ + return this->do_byte_swap_; +} + +ACE_INLINE int +ACE_OutputCDR::byte_order (void) const +{ + if (this->do_byte_swap ()) + return !ACE_CDR_BYTE_ORDER; + else + return ACE_CDR_BYTE_ORDER; +} + +ACE_INLINE void +ACE_OutputCDR::reset_byte_order (int byte_order) +{ + this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); +} + +ACE_INLINE size_t +ACE_OutputCDR::current_alignment (void) const +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + return this->current_alignment_; +#else + // Default value set to 0 + return 0; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ +} + +ACE_INLINE void +ACE_OutputCDR::current_alignment (size_t current_alignment) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + this->current_alignment_ = current_alignment; +#else + ACE_UNUSED_ARG (current_alignment); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ +} + +ACE_INLINE int +ACE_OutputCDR::align_write_ptr (size_t alignment) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + char *dummy; + return this->adjust (0, alignment, dummy); +#else + ACE_UNUSED_ARG (alignment); + // A return value of -1 from this function is used + // to indicate failure, returning 0 + return 0; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ +} + +ACE_INLINE ACE_Char_Codeset_Translator * +ACE_OutputCDR::char_translator (void) const +{ + return this->char_translator_; +} + +ACE_INLINE ACE_WChar_Codeset_Translator * +ACE_OutputCDR::wchar_translator (void) const +{ + return this->wchar_translator_; +} + +ACE_INLINE void +ACE_OutputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) +{ + this->char_translator_ = ctran; +} + +ACE_INLINE void +ACE_OutputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) +{ + this->wchar_translator_ = wctran; +} + +// **************************************************************** + +ACE_INLINE +ACE_InputCDR::~ACE_InputCDR (void) +{ +#if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) + this->monitor_->remove_ref (); +#endif /* ACE_HAS_MONITOR_POINTS==1 */ +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_octet (ACE_CDR::Octet& x) +{ + return this->read_1 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x) +{ + ACE_CDR::Octet tmp = 0; + (void) this->read_octet (tmp); + x = tmp ? true : false; + return (ACE_CDR::Boolean) this->good_bit_; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_char (ACE_CDR::Char &x) +{ + if (this->char_translator_ == 0) + { + void *temp = &x; + return this->read_1 (reinterpret_cast (temp)); + } + return this->char_translator_->read_char (*this, x); +} + + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_short (ACE_CDR::Short &x) +{ + void *temp = &x; + return this->read_2 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_ushort (ACE_CDR::UShort &x) +{ + return this->read_2 (&x); +} + + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_long (ACE_CDR::Long &x) +{ + void *temp = &x; + return this->read_4 (reinterpret_cast (temp)); +} + + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_ulong (ACE_CDR::ULong &x) +{ + return this->read_4 (&x); +} + + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_longlong (ACE_CDR::LongLong &x) +{ + void *temp = &x; + return this->read_8 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_ulonglong (ACE_CDR::ULongLong &x) +{ + return this->read_8 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_float (ACE_CDR::Float &x) +{ + void *temp = &x; + return this->read_4 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_double (ACE_CDR::Double &x) +{ + void *temp = &x; + return this->read_8 (reinterpret_cast (temp)); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x) +{ + return this->read_16 (&x); +} + +ACE_INLINE size_t +ACE_InputCDR::length (void) const +{ + return this->start_.length (); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_char_array (ACE_CDR::Char* x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length > this->length ()) + { + this->good_bit_ = false; + return false; + } + + if (this->char_translator_ == 0) + return this->read_array (x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + length); + return this->char_translator_->read_char_array (*this, x, length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_wchar_array (ACE_CDR::WChar* x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_OutputCDR::wchar_maxbytes_ > this->length ()) + { + this->good_bit_ = false; + return false; + } + + if (this->wchar_translator_ != 0) + return this->wchar_translator_->read_wchar_array (*this, x, length); + if (ACE_OutputCDR::wchar_maxbytes_ != sizeof (ACE_CDR::WChar)) + return this->read_wchar_array_i (x, length); + return this->read_array (x, + sizeof (ACE_CDR::WChar), + sizeof (ACE_CDR::WChar) == 2 + ? ACE_CDR::SHORT_ALIGN + : ACE_CDR::LONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_octet_array (ACE_CDR::Octet* x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::OCTET_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_short_array (ACE_CDR::Short *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::SHORT_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::SHORT_SIZE, + ACE_CDR::SHORT_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_ushort_array (ACE_CDR::UShort *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::SHORT_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::SHORT_SIZE, + ACE_CDR::SHORT_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_long_array (ACE_CDR::Long *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::LONG_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_ulong_array (ACE_CDR::ULong *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::LONG_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_longlong_array (ACE_CDR::LongLong *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_ulonglong_array (ACE_CDR::ULongLong *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_float_array (ACE_CDR::Float *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::LONG_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::LONG_SIZE, + ACE_CDR::LONG_ALIGN, + length); +} + + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_double_array (ACE_CDR::Double *x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::LONGLONG_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + + return this->read_array (x, + ACE_CDR::LONGLONG_SIZE, + ACE_CDR::LONGLONG_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x, + ACE_CDR::ULong length) +{ + // Make sure the length of the array isn't greater than the length of + // the stream. + if (length * ACE_CDR::LONGDOUBLE_SIZE > this->length ()) + { + this->good_bit_ = false; + return false; + } + return this->read_array (x, + ACE_CDR::LONGDOUBLE_SIZE, + ACE_CDR::LONGDOUBLE_ALIGN, + length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_octet (void) +{ + ACE_CDR::Octet x; + return this->read_1 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_char (void) +{ + return this->skip_octet (); // sizeof (Char) == sizeof (Octet) +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_boolean (void) +{ + return this->skip_octet () && this->good_bit_; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_ushort (void) +{ + ACE_CDR::UShort x; + return this->read_2 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_short (void) +{ + return this->skip_ushort (); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_ulong (void) +{ + ACE_CDR::ULong x; + return this->read_4 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_long (void) +{ + return this->skip_ulong (); // sizeof (Long) == sizeof (ULong) +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_ulonglong (void) +{ + ACE_CDR::ULongLong x; + return this->read_8 (&x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_longlong (void) +{ + return this->skip_ulonglong (); // sizeof (LongLong) == sizeof (ULongLong) +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_float (void) +{ + return this->skip_ulong (); // sizeof(Float) == sizeof (ULong) +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_double (void) +{ + return this->skip_ulonglong (); // sizeof(Double) == sizeof (ULongLong) +} + +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_longdouble (void) +{ + ACE_CDR::LongDouble x; + return this->read_16 (&x); +} + +ACE_INLINE char* +ACE_InputCDR::end (void) +{ + return this->start_.end (); +} + +ACE_INLINE void +ACE_InputCDR::rd_ptr (size_t offset) +{ + this->start_.rd_ptr (offset); +} + +ACE_INLINE char* +ACE_InputCDR::rd_ptr (void) +{ + return this->start_.rd_ptr (); +} + +ACE_INLINE char* +ACE_InputCDR::wr_ptr (void) +{ + return this->start_.wr_ptr (); +} + +ACE_INLINE int +ACE_InputCDR::adjust (size_t size, + size_t align, + char*& buf) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + buf = ACE_ptr_align_binary (this->rd_ptr (), align); +#else + buf = this->rd_ptr (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + char * const end = buf + size; + if (end <= this->wr_ptr ()) + { + this->start_.rd_ptr (end); + return 0; + } + + this->good_bit_ = false; + return -1; +#if defined (ACE_LACKS_CDR_ALIGNMENT) + ACE_UNUSED_ARG (align); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ +} + +ACE_INLINE int +ACE_InputCDR::adjust (size_t size, + char*& buf) +{ + return this->adjust (size, size, buf); +} + +ACE_INLINE const ACE_Message_Block* +ACE_InputCDR::start (void) const +{ + return &this->start_; +} + +ACE_INLINE bool +ACE_InputCDR::good_bit (void) const +{ + return this->good_bit_; +} + +// **************************************************************** + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::Char x) +{ + os.write_char (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::Short x) +{ + os.write_short (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::UShort x) +{ + os.write_ushort (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::Long x) +{ + os.write_long (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::ULong x) +{ + os.write_ulong (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::LongLong x) +{ + os.write_longlong (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::ULongLong x) +{ + os.write_ulonglong (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::LongDouble x) +{ + os.write_longdouble (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::Float x) +{ + os.write_float (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_CDR::Double x) +{ + os.write_double (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, const ACE_CDR::Char *x) +{ + os.write_string (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, const ACE_CDR::WChar *x) +{ + os.write_wstring (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +// The following use the helper classes +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x) +{ + (void) os.write_boolean (x.val_); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_char x) +{ + os.write_char (x.val_); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wchar x) +{ + os.write_wchar (x.val_); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_octet x) +{ + os.write_octet (x.val_); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_string x) +{ + ACE_CDR::ULong len = 0; + + if (x.val_ != 0) + { + len = static_cast (ACE_OS::strlen (x.val_)); + } + + os.write_string (len, x.val_); + return + (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_)); +} + +ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x) +{ + ACE_CDR::ULong len = 0; + + if (x.val_ != 0) + { + len = static_cast (ACE_OS::strlen (x.val_)); + } + + os.write_wstring (len, x.val_); + return + (ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_)); +} + +// **************************************************************** + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::Char &x) +{ + return is.read_char (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::Short &x) +{ + return is.read_short (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::UShort &x) +{ + return is.read_ushort (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>>(ACE_InputCDR &is, ACE_CDR::Long &x) +{ + return is.read_long (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::ULong &x) +{ + return is.read_ulong (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR& is, ACE_CDR::LongLong &x) +{ + return is.read_longlong (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR& is, ACE_CDR::ULongLong &x) +{ + return is.read_ulonglong (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR& is, ACE_CDR::LongDouble &x) +{ + return is.read_longdouble (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::Float &x) +{ + return is.read_float (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::Double &x) +{ + return is.read_double (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x) +{ + return is.read_string (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::WChar *&x) +{ + return is.read_wstring (x) && is.good_bit (); +} + +// The following use the helper classes +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_InputCDR::to_boolean x) +{ + return is.read_boolean (x.ref_); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_InputCDR::to_char x) +{ + return is.read_char (x.ref_) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wchar x) +{ + return is.read_wchar (x.ref_) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_InputCDR::to_octet x) +{ + return is.read_octet (x.ref_) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x) +{ + // check if the bounds are satisfied + return + (is.read_string (const_cast (x.val_)) + && is.good_bit () + && (!x.bound_ + || ACE_OS::strlen (x.val_) <= x.bound_)); +} + +ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x) +{ + // check if the bounds are satisfied + return + (is.read_wstring (const_cast (x.val_)) + && is.good_bit () + && (!x.bound_ + || ACE_OS::strlen (x.val_) <= x.bound_)); +} + +// *************************************************************************** +// We must define these methods here because they use the "read_*" inlined +// methods of the ACE_InputCDR class +// *************************************************************************** + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_boolean (ACE_InputCDR &stream) +{ + ACE_CDR::Boolean x; + return stream.read_boolean (x) ? this->write_boolean (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_char (ACE_InputCDR &stream) +{ + ACE_CDR::Char x; + return stream.read_char (x) ? this->write_char (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_wchar (ACE_InputCDR &stream) +{ + ACE_CDR::WChar x; + return stream.read_wchar (x) ? this->write_wchar (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_octet (ACE_InputCDR &stream) +{ + ACE_CDR::Octet x; + return stream.read_octet (x) ? this->write_octet (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_short (ACE_InputCDR &stream) +{ + ACE_CDR::Short x; + return stream.read_short (x) ? this->write_short (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_ushort (ACE_InputCDR &stream) +{ + ACE_CDR::UShort x; + return stream.read_ushort (x) ? this->write_ushort (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_long (ACE_InputCDR &stream) +{ + ACE_CDR::Long x; + return stream.read_long (x) ? this->write_long (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_ulong (ACE_InputCDR &stream) +{ + ACE_CDR::ULong x; + return stream.read_ulong (x) ? this->write_ulong (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_longlong (ACE_InputCDR &stream) +{ + ACE_CDR::LongLong x; + return stream.read_longlong (x) ? this->write_longlong (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_ulonglong (ACE_InputCDR &stream) +{ + ACE_CDR::ULongLong x; + return stream.read_ulonglong (x) ? this->write_ulonglong (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_float (ACE_InputCDR &stream) +{ + ACE_CDR::Float x; + return stream.read_float (x) ? this->write_float (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_double (ACE_InputCDR &stream) +{ + ACE_CDR::Double x; + return stream.read_double (x) ? this->write_double (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_longdouble (ACE_InputCDR &stream) +{ + ACE_CDR::LongDouble x; + return stream.read_longdouble (x) ? this->write_longdouble (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_string (ACE_InputCDR &stream) +{ + ACE_CDR::Char *x = 0; + ACE_CDR::Boolean const flag = + (stream.read_string (x) ? this->write_string (x) : false); + delete [] x; + return flag; +} + +ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_wstring (ACE_InputCDR &stream) +{ + ACE_CDR::WChar *x = 0; + ACE_CDR::Boolean const flag = + (stream.read_wstring (x) ? this->write_wstring (x) : false); + delete [] x; + return flag; +} + +ACE_INLINE void +ACE_InputCDR::reset_byte_order (int byte_order) +{ + this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER); +} + +ACE_INLINE bool +ACE_InputCDR::do_byte_swap (void) const +{ + return this->do_byte_swap_; +} + +ACE_INLINE int +ACE_InputCDR::byte_order (void) const +{ + return this->do_byte_swap () ? !ACE_CDR_BYTE_ORDER : ACE_CDR_BYTE_ORDER; +} + +ACE_INLINE int +ACE_InputCDR::align_read_ptr (size_t alignment) +{ +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + char *buf = ACE_ptr_align_binary (this->rd_ptr (), + alignment); +#else + char *buf = this->rd_ptr (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + + if (buf <= this->wr_ptr ()) + { + this->start_.rd_ptr (buf); + return 0; + } + + this->good_bit_ = false; + return -1; +} + +ACE_INLINE void +ACE_InputCDR::set_version (ACE_CDR::Octet major, ACE_CDR::Octet minor) +{ + this->major_version_ = major; + this->minor_version_ = minor; +} + +ACE_INLINE void +ACE_InputCDR::get_version (ACE_CDR::Octet &major, ACE_CDR::Octet &minor) +{ + major = this->major_version_; + minor = this->minor_version_; +} + +ACE_INLINE ACE_Char_Codeset_Translator * +ACE_InputCDR::char_translator (void) const +{ + return this->char_translator_; +} + +ACE_INLINE ACE_WChar_Codeset_Translator * +ACE_InputCDR::wchar_translator (void) const +{ + return this->wchar_translator_; +} + + +ACE_INLINE void +ACE_InputCDR::char_translator (ACE_Char_Codeset_Translator * ctran) +{ + this->char_translator_ = ctran; +} + +ACE_INLINE void +ACE_InputCDR::wchar_translator (ACE_WChar_Codeset_Translator * wctran) +{ + this->wchar_translator_ = wctran; +} + +// **************************************************************** + +ACE_INLINE ACE_CDR::Boolean +ACE_Char_Codeset_Translator::read_1 (ACE_InputCDR& input, + ACE_CDR::Octet *x) +{ + return input.read_1 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_Char_Codeset_Translator::write_1 (ACE_OutputCDR& output, + const ACE_CDR::Octet *x) +{ + return output.write_1 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_Char_Codeset_Translator::read_array (ACE_InputCDR& in, + void* x, + size_t size, + size_t align, + ACE_CDR::ULong length) +{ + return in.read_array (x, size, align, length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_Char_Codeset_Translator::write_array (ACE_OutputCDR& out, + const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length) +{ + return out.write_array(x, size, align, length); +} + +ACE_INLINE int +ACE_Char_Codeset_Translator::adjust (ACE_OutputCDR& out, + size_t size, + size_t align, + char *&buf) +{ + return out.adjust(size, align, buf); +} + +ACE_INLINE void +ACE_Char_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) +{ + out.good_bit_ = bit; +} + +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::major_version (ACE_InputCDR& input) +{ + return input.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::minor_version (ACE_InputCDR& input) +{ + return input.minor_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::major_version (ACE_OutputCDR& output) +{ + return output.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_Char_Codeset_Translator::minor_version (ACE_OutputCDR& output) +{ + return output.minor_version_; +} + +// **************************************************************** + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::read_1 (ACE_InputCDR& input, + ACE_CDR::Octet *x) +{ + return input.read_1 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::read_2 (ACE_InputCDR& input, + ACE_CDR::UShort *x) +{ + return input.read_2 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::read_4 (ACE_InputCDR& input, + ACE_CDR::ULong *x) +{ + return input.read_4 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::write_1 (ACE_OutputCDR& output, + const ACE_CDR::Octet *x) +{ + return output.write_1 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::write_2 (ACE_OutputCDR& output, + const ACE_CDR::UShort *x) +{ + return output.write_2 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::write_4 (ACE_OutputCDR& output, + const ACE_CDR::ULong *x) +{ + return output.write_4 (x); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::read_array (ACE_InputCDR& in, + void* x, + size_t size, + size_t align, + ACE_CDR::ULong length) +{ + return in.read_array (x, size, align, length); +} + +ACE_INLINE ACE_CDR::Boolean +ACE_WChar_Codeset_Translator::write_array (ACE_OutputCDR& out, + const void *x, + size_t size, + size_t align, + ACE_CDR::ULong length) +{ + return out.write_array(x, size, align, length); +} + +ACE_INLINE int +ACE_WChar_Codeset_Translator::adjust (ACE_OutputCDR& out, + size_t size, + size_t align, + char *&buf) +{ + return out.adjust(size, align, buf); +} + +ACE_INLINE void +ACE_WChar_Codeset_Translator::good_bit (ACE_OutputCDR& out, bool bit) +{ + out.good_bit_ = bit; +} + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::major_version (ACE_InputCDR& input) +{ + return input.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::minor_version (ACE_InputCDR& input) +{ + return input.minor_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::major_version (ACE_OutputCDR& output) +{ + return output.major_version_; +} + +ACE_INLINE ACE_CDR::Octet +ACE_WChar_Codeset_Translator::minor_version (ACE_OutputCDR& output) +{ + return output.minor_version_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/CE_Screen_Output.cpp b/externals/ace/CE_Screen_Output.cpp new file mode 100644 index 0000000..dfd3d71 --- /dev/null +++ b/externals/ace/CE_Screen_Output.cpp @@ -0,0 +1,158 @@ +// $Id: CE_Screen_Output.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/CE_Screen_Output.h" +#if defined (ACE_HAS_WINCE) + +#include "ace/Log_Msg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_CE_Screen_Output::ACE_CE_Screen_Output(HWND hEdit) +: handler_(hEdit) +, pFile_(0) +{ +} + +ACE_CE_Screen_Output::ACE_CE_Screen_Output() +: handler_(0) +, pFile_(0) +{ +} + +ACE_CE_Screen_Output::~ACE_CE_Screen_Output() +{ + if (pFile_ != 0) { + fclose(pFile_); + } +} + +void ACE_CE_Screen_Output::log(ACE_Log_Record &log_record) +{ + ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN]; + int result = log_record.format_msg (ACE_TEXT("WindozeCE"), // host name + 0, // verbose flag + verbose_msg); + + if (result == 0) + { + verbose_msg[ ACE_OS::strlen(verbose_msg) - 1 ] = 0; // CE does not like '\n' by itself. + *this << verbose_msg << endl; + } +} + +void ACE_CE_Screen_Output::SetOutputWindow(HWND hEdit) +{ + handler_ = hEdit; +} + +void ACE_CE_Screen_Output::clear() +{ + SetWindowText(handler_, 0); +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_TCHAR* output) +{ + int length = GetWindowTextLength(handler_); + SendMessage(handler_, EM_SETSEL, length, length); + SendMessage(handler_, EM_REPLACESEL, 0, (LPARAM)output); + + if (pFile_ != 0) + { + fwprintf(pFile_, L"%s", output); + } + + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_TCHAR* output) +{ + ACE_TCHAR* buffer = ACE_OS::strdup(output); + if (buffer != 0) + { + *this << buffer; + delete buffer; + } + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_ANTI_TCHAR* output) +{ + *this << ACE_TEXT_CHAR_TO_TCHAR(output); + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_ANTI_TCHAR* output) +{ + *this << ACE_TEXT_CHAR_TO_TCHAR(output); + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (char output) +{ + *this << (int)output; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned char output) +{ + *this << (int)output; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned short output) +{ + ACE_TCHAR buffer[20]; + wsprintf(buffer, ACE_TEXT("%u"), output); + *this << buffer; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (int output) +{ + ACE_TCHAR buffer[20]; + wsprintf(buffer, ACE_TEXT("%d"), output); + *this << buffer; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned int output) +{ + ACE_TCHAR buffer[20]; + wsprintf(buffer, ACE_TEXT("%du"), output); + *this << buffer; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (float output) +{ + ACE_TCHAR buffer[20]; + swprintf(buffer, ACE_TEXT("%f"), output); + *this << buffer; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (long output) +{ + ACE_TCHAR buffer[20]; + wsprintf(buffer, ACE_TEXT("%l"), output); + *this << buffer; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned long output) +{ + ACE_TCHAR buffer[20]; + wsprintf(buffer, ACE_TEXT("%lu"), output); + *this << buffer; + return *this; +} + +ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (FILE* pFile) +{ + pFile_ = pFile; + return *this; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif // ACE_HAS_WINCE diff --git a/externals/ace/CE_Screen_Output.h b/externals/ace/CE_Screen_Output.h new file mode 100644 index 0000000..ba2bc7c --- /dev/null +++ b/externals/ace/CE_Screen_Output.h @@ -0,0 +1,109 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CE_Screen_Output.h + * + * $Id: CE_Screen_Output.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Si Mong Park + */ +//============================================================================= + +#ifndef ACE_CE_SCREEN_OUTPUT_H +#define ACE_CE_SCREEN_OUTPUT_H + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_WINCE) + +#include "ace/Log_Msg_Callback.h" +#include "ace/Log_Record.h" + +namespace +{ + const ACE_TCHAR endl[] = ACE_TEXT("\r\n"); + const ACE_TCHAR tab[] = ACE_TEXT("\t"); +} + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_CE_Screen_Output + * + * @brief Replacement of text output for Windows CE. + * + * This class allows standard text output to be displayed on + * text window for Windows CE. Generally, all ACE output will + * go through under CE if and only if user uses WindozeCE + * implementation by using main_ce instead of main. + * Also, for the easier debugging purpose, object pointer of + * this class can be gotten from ACE_Log_Msg::msg_callback() + * and then can be used directly by user just like cout stream. + */ +class ACE_Export ACE_CE_Screen_Output : public ACE_Log_Msg_Callback +{ +public: + + ACE_CE_Screen_Output (HWND hEdit); + + ACE_CE_Screen_Output (void); + + virtual ~ACE_CE_Screen_Output(); + + /// Implementation of pure virtual function from ACE_Log_Msg_Callback. + virtual void log (ACE_Log_Record &log_record); + + /// Interface to specify active window handle. + void SetOutputWindow (HWND hWnd); + + void clear (void); + + /// Stream insertion operator that performs actual print out. + /** + * @note This is the only one operator that performs output. All + * other perators convert the type and use this operator + * underneath. + */ + ACE_CE_Screen_Output& operator << (ACE_TCHAR*); + ACE_CE_Screen_Output& operator << (const ACE_TCHAR*); + + ACE_CE_Screen_Output& operator << (ACE_ANTI_TCHAR* output); + ACE_CE_Screen_Output& operator << (const ACE_ANTI_TCHAR* output); + + ACE_CE_Screen_Output& operator << (char output); + ACE_CE_Screen_Output& operator << (unsigned char output); + + ACE_CE_Screen_Output& operator << (unsigned short output); + + ACE_CE_Screen_Output& operator << (int output); + ACE_CE_Screen_Output& operator << (unsigned int output); + + ACE_CE_Screen_Output& operator << (float output); + + ACE_CE_Screen_Output& operator << (long output); + ACE_CE_Screen_Output& operator << (unsigned long output); + + ACE_CE_Screen_Output& operator << (FILE* pFile); + +private: + + ACE_CE_Screen_Output (ACE_CE_Screen_Output&); + +private: + + HWND handler_; + + /// FILE pointer that used to save output to file. This class does + /// not own the file handler pointer. + FILE* pFile_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif // ACE_HAS_WINCE +#endif // ACE_CE_SCREEN_OUTPUT_H diff --git a/externals/ace/CMakeLists.txt b/externals/ace/CMakeLists.txt new file mode 100644 index 0000000..db0dc7c --- /dev/null +++ b/externals/ace/CMakeLists.txt @@ -0,0 +1,337 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# NOTE: Do not use glob here, it would include files we don't want +set(ace_STAT_SRCS + PrecompiledHeaders/WinAcePCH.cpp + ACE.cpp + ACE_crc32.cpp + ACE_crc_ccitt.cpp + ace_wchar.cpp + Activation_Queue.cpp + Active_Map_Manager.cpp + Addr.cpp + Argv_Type_Converter.cpp + Assert.cpp + Asynch_IO.cpp + Asynch_IO_Impl.cpp + Asynch_Pseudo_Task.cpp + ATM_Acceptor.cpp + ATM_Addr.cpp + ATM_Connector.cpp + ATM_Params.cpp + ATM_QoS.cpp + ATM_Stream.cpp + Atomic_Op.cpp + Atomic_Op_Sparc.c + Auto_Event.cpp + Barrier.cpp + Base_Thread_Adapter.cpp + Based_Pointer_Repository.cpp + Basic_Stats.cpp + Basic_Types.cpp + Capabilities.cpp + CDR_Base.cpp + CDR_Size.cpp + CDR_Stream.cpp + Cleanup.cpp + Codecs.cpp + Codeset_IBM1047.cpp + Codeset_Registry.cpp + Codeset_Registry_db.cpp + Condition_Recursive_Thread_Mutex.cpp + Condition_Thread_Mutex.cpp + Configuration.cpp + Configuration_Import_Export.cpp + Connection_Recycling_Strategy.cpp + Containers.cpp + Copy_Disabled.cpp + Countdown_Time.cpp + Date_Time.cpp + DEV.cpp + DEV_Addr.cpp + DEV_Connector.cpp + DEV_IO.cpp + Dev_Poll_Reactor.cpp + Dirent.cpp + Dirent_Selector.cpp + DLL.cpp + DLL_Manager.cpp + Dump.cpp + Dynamic.cpp + Dynamic_Message_Strategy.cpp + Dynamic_Service_Base.cpp + Dynamic_Service_Dependency.cpp + Encoding_Converter.cpp + Encoding_Converter_Factory.cpp + Event.cpp + Event_Handler.cpp + FIFO.cpp + FIFO_Recv.cpp + FIFO_Recv_Msg.cpp + FIFO_Send.cpp + FIFO_Send_Msg.cpp + FILE.cpp + FILE_Addr.cpp + FILE_Connector.cpp + FILE_IO.cpp + File_Lock.cpp + Filecache.cpp + Flag_Manip.cpp + Framework_Component.cpp + Functor.cpp + Functor_String.cpp + Get_Opt.cpp + gethrtime.cpp + Handle_Ops.cpp + Handle_Set.cpp + Hashable.cpp + High_Res_Timer.cpp + ICMP_Socket.cpp + INET_Addr.cpp + Init_ACE.cpp + IO_Cntl_Msg.cpp + IO_SAP.cpp + IOStream.cpp + IPC_SAP.cpp + Lib_Find.cpp + Local_Memory_Pool.cpp + Local_Name_Space.cpp + Local_Tokens.cpp + Lock.cpp + Log_Msg.cpp + Log_Msg_Backend.cpp + Log_Msg_Callback.cpp + Log_Msg_IPC.cpp + Log_Msg_NT_Event_Log.cpp + Log_Msg_UNIX_Syslog.cpp + Log_Record.cpp + Logging_Strategy.cpp + LSOCK.cpp + LSOCK_Acceptor.cpp + LSOCK_CODgram.cpp + LSOCK_Connector.cpp + LSOCK_Dgram.cpp + LSOCK_Stream.cpp + Malloc.cpp + Malloc_Allocator.cpp + Manual_Event.cpp + MEM_Acceptor.cpp + MEM_Addr.cpp + MEM_Connector.cpp + MEM_IO.cpp + Mem_Map.cpp + MEM_SAP.cpp + MEM_Stream.cpp + Message_Block.cpp + Message_Queue.cpp + Message_Queue_NT.cpp + Message_Queue_Vx.cpp + Method_Request.cpp + MMAP_Memory_Pool.cpp + Monitor_Admin.cpp + Monitor_Admin_Manager.cpp + Monitor_Base.cpp + Monitor_Control_Action.cpp + Monitor_Control_Types.cpp + Monitor_Point_Registry.cpp + Monitor_Size.cpp + Msg_WFMO_Reactor.cpp + Multihomed_INET_Addr.cpp + Mutex.cpp + Name_Proxy.cpp + Name_Request_Reply.cpp + Name_Space.cpp + Naming_Context.cpp + Netlink_Addr.cpp + Notification_Queue.cpp + Notification_Strategy.cpp + NT_Service.cpp + Obchunk.cpp + Object_Manager.cpp + Object_Manager_Base.cpp + OS_Errno.cpp + OS_Log_Msg_Attributes.cpp + OS_main.cpp + OS_NS_arpa_inet.cpp + OS_NS_ctype.cpp + OS_NS_dirent.cpp + OS_NS_dlfcn.cpp + OS_NS_errno.cpp + OS_NS_fcntl.cpp + OS_NS_math.cpp + OS_NS_netdb.cpp + OS_NS_poll.cpp + OS_NS_pwd.cpp + OS_NS_regex.cpp + OS_NS_signal.cpp + OS_NS_stdio.cpp + OS_NS_stdlib.cpp + OS_NS_string.cpp + OS_NS_strings.cpp + OS_NS_stropts.cpp + OS_NS_sys_mman.cpp + OS_NS_sys_msg.cpp + OS_NS_sys_resource.cpp + OS_NS_sys_select.cpp + OS_NS_sys_sendfile.cpp + OS_NS_sys_shm.cpp + OS_NS_sys_socket.cpp + OS_NS_sys_stat.cpp + OS_NS_sys_time.cpp + OS_NS_sys_uio.cpp + OS_NS_sys_utsname.cpp + OS_NS_sys_wait.cpp + OS_NS_Thread.cpp + OS_NS_time.cpp + OS_NS_unistd.cpp + OS_NS_wchar.cpp + OS_QoS.cpp + OS_Thread_Adapter.cpp + OS_TLI.cpp + Pagefile_Memory_Pool.cpp + Parse_Node.cpp + PI_Malloc.cpp + Ping_Socket.cpp + Pipe.cpp + POSIX_Asynch_IO.cpp + POSIX_CB_Proactor.cpp + POSIX_Proactor.cpp + Priority_Reactor.cpp + Proactor.cpp + Proactor_Impl.cpp + Process.cpp + Process_Manager.cpp + Process_Mutex.cpp + Process_Semaphore.cpp + Profile_Timer.cpp + Reactor.cpp + Reactor_Impl.cpp + Reactor_Notification_Strategy.cpp + Reactor_Timer_Interface.cpp + Read_Buffer.cpp + Recursive_Thread_Mutex.cpp + Recyclable.cpp + Registry.cpp + Registry_Name_Space.cpp + Remote_Name_Space.cpp + Remote_Tokens.cpp + Rtems_init.c + RW_Mutex.cpp + RW_Process_Mutex.cpp + RW_Thread_Mutex.cpp + Sample_History.cpp + Sbrk_Memory_Pool.cpp + Sched_Params.cpp + Select_Reactor_Base.cpp + Semaphore.cpp + Service_Config.cpp + Service_Gestalt.cpp + Service_Manager.cpp + Service_Object.cpp + Service_Repository.cpp + Service_Types.cpp + Shared_Memory.cpp + Shared_Memory_MM.cpp + Shared_Memory_Pool.cpp + Shared_Memory_SV.cpp + Shared_Object.cpp + Sig_Adapter.cpp + Sig_Handler.cpp + Signal.cpp + SOCK.cpp + SOCK_Acceptor.cpp + SOCK_CODgram.cpp + Sock_Connect.cpp + SOCK_Connector.cpp + SOCK_Dgram.cpp + SOCK_Dgram_Bcast.cpp + SOCK_Dgram_Mcast.cpp + SOCK_IO.cpp + SOCK_Netlink.cpp + SOCK_SEQPACK_Acceptor.cpp + SOCK_SEQPACK_Association.cpp + SOCK_SEQPACK_Connector.cpp + SOCK_Stream.cpp + SPIPE.cpp + SPIPE_Acceptor.cpp + SPIPE_Addr.cpp + SPIPE_Connector.cpp + SPIPE_Stream.cpp + SString.cpp + Stack_Trace.cpp + Stats.cpp + String_Base_Const.cpp + SUN_Proactor.cpp + SV_Message.cpp + SV_Message_Queue.cpp + SV_Semaphore_Complex.cpp + SV_Semaphore_Simple.cpp + SV_Shared_Memory.cpp + Svc_Conf_Lexer.cpp + Svc_Conf_y.cpp + Synch_Options.cpp + System_Time.cpp + Task.cpp + Thread.cpp + Thread_Adapter.cpp + Thread_Control.cpp + Thread_Exit.cpp + Thread_Hook.cpp + Thread_Manager.cpp + Thread_Mutex.cpp + Thread_Semaphore.cpp + Throughput_Stats.cpp + Time_Value.cpp + Timeprobe.cpp + TLI.cpp + TLI_Acceptor.cpp + TLI_Connector.cpp + TLI_Stream.cpp + Token.cpp + Token_Collection.cpp + Token_Invariants.cpp + Token_Manager.cpp + Token_Request_Reply.cpp + TP_Reactor.cpp + Trace.cpp + TSS_Adapter.cpp + TTY_IO.cpp + UNIX_Addr.cpp + UPIPE_Acceptor.cpp + UPIPE_Connector.cpp + UPIPE_Stream.cpp + UTF16_Encoding_Converter.cpp + UTF32_Encoding_Converter.cpp + UTF8_Encoding_Converter.cpp + UUID.cpp + WFMO_Reactor.cpp + WIN32_Asynch_IO.cpp + WIN32_Proactor.cpp + XML_Svc_Conf.cpp + XTI_ATM_Mcast.cpp +) + +include_directories( + ${CMAKE_SOURCE_DIR}/externals + ${CMAKE_SOURCE_DIR}/externals/ace/PrecompiledHeaders + ${CMAKE_SOURCE_DIR}/externals/zlib +) + +# Needed for PCH support +set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX) + +add_definitions(-DACE_BUILD_DLL) + +add_library(ace SHARED ${ace_STAT_SRCS}) + +if(DO_PCH) + add_native_precompiled_header(ace ${CMAKE_SOURCE_DIR}/externals/ace/PrecompiledHeaders/WinAcePCH) +endif() \ No newline at end of file diff --git a/externals/ace/CORBA_macros.h b/externals/ace/CORBA_macros.h new file mode 100644 index 0000000..beab26b --- /dev/null +++ b/externals/ace/CORBA_macros.h @@ -0,0 +1,575 @@ +// -*- C++ -*- + +// ============================================================================ +/** + * @file CORBA_macros.h + * + * $Id: CORBA_macros.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Writing code that is portable between platforms with or without + * native C++ exceptions is hard. The following macros offer some + * help on this task, mostly oriented to making the ORB code and the + * IDL generated code portable. + * + * @author Nanbor Wang + * @author Aniruddha Gokhale + * @author Carlos O'Ryan , et al. + */ +// ============================================================================ + +// Macros for handling CORBA exceptions. + +#ifndef ACE_CORBA_MACROS_H +#define ACE_CORBA_MACROS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +#define ACE_ENV_POLLUTE_NAMES + +#include "ace/Exception_Macros.h" + +// The Windows MFC exception mechanism requires that a caught CException +// (including the CMemoryException in use here) be freed using its Delete() +// method. Thus, when MFC is in use and we're catching exceptions as a result +// of new(), the exception's Delete() method has to be called. No other +// platform imposes this sort of restriction/requirement. The Windows +// config stuff (at least for MSVC/MFC) defines a ACE_del_bad_alloc macro +// that works with its ACE_bad_alloc macro to implement this cleanup +// requirement. Since no other platform requires this, define it as +// empty here. +#if !defined (ACE_del_bad_alloc) +# define ACE_del_bad_alloc +#endif + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + +// If you wish to you use these macros for emulating exceptions on +// platforms which lack native exception support, you need to do the +// following: +// 1. Define a class Exception. You can name it as you please. This class +// should be at the root of the inheritance hierarchy of all the +// exceptions used in your application. It should define at a minimum +// the following pure virtual methods: +// a) _downcast () - Which allows narrowing of the base exception type to a +// derived type. +// b) _raise() - Which throws an exception of type Exception. +// +// Classes which derive from these should implement these operations. +// +// 2. Define a class Environment. You can name it as you please. This class +// is an exception holder. This class is always on the stack. It should +// support at a minimum the following methods: +// a) exception() - Which returns the Exception held in the current +// Environment. +// b) exception (Exception* foo) - Which replaces/sets the Exception +// held in the current Environment with foo. +// b) clear() - Which resets a particular instance of Environment. +// c) A copy constructor and an assignment operator. +// +// Note that the above description assumes that you use the following +// macros only within a particular domain. For example, if your +// application has to interoperate across domains, then you need to define +// an exception adapter to translate exceptions from one domain to +// exceptions in the other. Please refer to Stroustrup's book on how to do +// this. If your use case is this complex, you would be better off with +// going with native exceptions rather than emulated exceptions, though +// the macros should still work if you defined your adapter class as +// ACE_EXCEPTION_TYPE. + + +// The following macros assume that an environment variable is passed +// in/out of each function that can throw an exception. The type of the +// environment variable is defined by ACE_ENV_TYPE. + +#if !defined (ACE_ENV_TYPE) +# define ACE_ENV_TYPE CORBA::Environment +#endif /* ACE_ENV_TYPE */ + +// The name of the variable is defined by ACE_TRY_ENV. Below is the name +// that we use by default. If you wish to change it you can redefine +// ACE_TRY_ENV to change the default name. Also ACE_ADOPT_ENV allows the +// use of non-standard name within a scope. + +#if !defined (ACE_TRY_ENV) +# define ACE_TRY_ENV _ACE_CORBA_Environment_variable +#endif /* ACE_TRY_ENV */ + +// The base type of Exception from which all the other exception types are +// derived. You can set this to any type as you please. By default, it is +// set to CORBA::Exception. + +#if !defined (ACE_EXCEPTION_TYPE) +# define ACE_EXCEPTION_TYPE CORBA::Exception +#endif /* ACE_EXCEPTION_TYPE */ + +// This method is used to get the default value of the Environment +// variable. In the case of TAO, this variable is part of the TSS ORB +// resources and the method TAO_default_environment() returns the +// Environment variable. + +#if !defined (ACE_DEFAULT_GET_ENV_METHOD) +# define ACE_DEFAULT_GET_ENV_METHOD TAO_default_environment +#endif /* ACE_DEFAULT_GET_ENV_METHOD */ + +// This is the exception caught by ACE_CATCHANY. +#if !defined (ACE_ANY_EXCEPTION) +# define ACE_ANY_EXCEPTION ex +#endif /* ACE_ANY_EXCEPTION */ + +// Declare a new environment variable on the stack. The type of the +// environment variable is determined by ACE_ENV_TYPE. +#if defined (ACE_USES_NATIVE_EXCEPTIONS) +// Don't instantiate an emulated exception environment at all when +// using native C++ exception support. It won't be used. +# define ACE_DECLARE_NEW_ENV +#else +# define ACE_DECLARE_NEW_ENV \ + ACE_ENV_TYPE ACE_TRY_ENV +#endif /* ACE_USES_NATIVE_EXCEPTIONS */ + +// Provided for backward compatibility purposes. Don't use it in new code. +// Use the definition above along with defining ACE_ENV_TYPE. + +#if defined (ACE_ENV_POLLUTE_NAMES) +# define ACE_DECLARE_NEW_CORBA_ENV ACE_DECLARE_NEW_ENV +#endif /* ACE_ENV_POLLUTE_NAMES */ + +#if defined (ACE_USES_NATIVE_EXCEPTIONS) +// ----------------------------------------------------------------- + +// Provided for backward compatibility purposes. Don't use it in new code. +#if defined (ACE_ENV_POLLUTE_NAMES) +# define ACE_ADOPT_CORBA_ENV(ENV) +#endif /* ACE_ENV_POLLUTE_NAMES */ + +#define ACE_ADOPT_ENV (ENV) + +// No need to check. Native exceptions handle the control flow +// automatically when an exception occurs. +# define ACE_CHECK + +// Used when the function requires a return value. +# define ACE_CHECK_RETURN(RETV) + +// ACE_THROW_INT should not be used by the user. +# define ACE_THROW_INT(EXCEPTION) \ + throw EXCEPTION + +// Throwing an exception is easy. These two macros should _NOT_ be +// used within try blocks. +# define ACE_THROW(EXCEPTION) \ + throw EXCEPTION + +// Throwing an exception when the function requires a return value. +# define ACE_THROW_RETURN(EXCEPTION,RETV) \ + throw EXCEPTION + +// For compilers with native exceptions, we can simply use try to try. ;-) +// do {} while (0) is required to avoid compilation warnings. +# define ACE_TRY \ + do \ + { \ + try \ + { +# define ACE_TRY_NEW_ENV \ + do \ + { \ + try \ + { +# define ACE_TRY_EX(LABEL) \ + do \ + { \ + try \ + { + +// No need to check for exceptions within try block for compilers with +// native exceptions. +# define ACE_TRY_CHECK +# define ACE_TRY_CHECK_EX(LABEL) + +// Likewise, throwing exceptions within try blocks is easy. +# define ACE_TRY_THROW(EXCEPTION) throw EXCEPTION +# define ACE_TRY_THROW_EX(EXCEPTION,LABEL) throw EXCEPTION + +// Same thing for catch. +# define ACE_CATCH(EXCEPTION,VAR) \ + } \ + catch (EXCEPTION & VAR) \ + { \ + ACE_UNUSED_ARG (VAR); + +# define ACE_CATCHANY \ + ACE_CATCH(ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION) + +# define ACE_CATCHALL \ + } \ + catch (...) \ + { + +# if defined (ACE_HAS_DEPRECATED_ACE_RETHROW) +# define ACE_RETHROW throw +# endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */ + +// Rethrowing the exception from catch blocks. +# define ACE_RE_THROW throw +# define ACE_RE_THROW_EX(LABEL) throw + +// Close the catch block. +# define ACE_ENDTRY \ + } \ + } while (0) + +#else /* ! ACE_USES_NATIVE_EXCEPTIONS */ +// ----------------------------------------------------------------- + +// When handling compilers without native exceptions, things get a bit +// hairy. Exceptions are simulated using ACE_ENV_TYPE. The trick here is to +// make sure the flow-of-control can simulate the case when native +// exceptions occur... + +#if defined (ACE_ENV_POLLUTE_NAMES) +# define ACE_ADOPT_CORBA_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV +#endif /* ACE_ENV_POLLUTE_NAMES */ + +# define ACE_ADOPT_ENV(ENV) ACE_ENV_TYPE &ACE_TRY_ENV = ENV + +// Follow every statement that could throw exceptions with ACE_CHECK or +// ACE_CHECK_RETURN. These two macros should _NOT_ be used within try +// blocks. Use ACE_TRY_CHECK or ACE_TRY_CHECK_EX instead. +# define ACE_CHECK \ + if (ACE_TRY_ENV . exception () != 0) \ + return +// When function requires a return value +# define ACE_CHECK_RETURN(RETV) \ + if (ACE_TRY_ENV . exception () != 0) \ + return RETV + +// ACE_THROW_INT should not be used by the user. +# define ACE_THROW_INT(EXCEPTION) ACE_TRY_ENV.exception (new EXCEPTION) + +// Throwing exceptions will inevitably cause a return from the current +// function. These two macros should _NOT_ be used within try blocks. Use +// ACE_TRY_THROW or ACE_TRY_THROW_EX instead. +# define ACE_THROW(EXCEPTION) \ + do \ + { \ + ACE_TRY_ENV.exception (new EXCEPTION); \ + return; \ + } while (0) + +# define ACE_THROW_RETURN(EXCEPTION,RETV) \ + do \ + { \ + ACE_TRY_ENV.exception (new EXCEPTION); \ + return RETV; \ + } while (0) + +// ACE_TRY sets up flags to control program flow. ACE_TRY_FLAG acts like a +// one-shot flip-flop. When an exception occurs (detected using +// ACE_TRY_CHECK,) ACE_TRY_FLAG will be reset and the control goes back +// into ACE_TRY_LABEL. Since ACE_TRY_FLAG is reset, the try block won't get +// executed again and the control proceeds to the following catch blocks. +// ACE_EXCEPTION_NOT_CAUGHT flag is used to prevent catching an exception +// twice. This macro assumes there's already an ACE_ENV_TYPE variable +// ACE_TRY_ENV defined (which should be the case normally) +# define ACE_TRY \ + do { \ + int ACE_TRY_FLAG = 1; \ + int ACE_EXCEPTION_NOT_CAUGHT = 1; \ + ACE_TRY_LABEL: \ + if (ACE_TRY_FLAG) \ + do { + +// ACE_TRY_NEW_ENV functions like the macro ACE_TRY but defines a new +// ACE_ENV_TYPE variable ACE_TRY_ENV. It is most often used in the outer +// most function where no ACE_TRY_ENV is available. +# define ACE_TRY_NEW_ENV \ + do { \ + ACE_DECLARE_NEW_ENV;\ + int ACE_TRY_FLAG = 1; \ + int ACE_EXCEPTION_NOT_CAUGHT = 1; \ + ACE_TRY_LABEL: \ + if (ACE_TRY_FLAG) \ + do { + +// ACE_TRY_EX works exactly like ACE_TRY macro except the label used in the +// try block is customizable to avoid name clashing. It should be used when +// nested try blocks or multiple try blocks are required, in the same +// function. +# define ACE_TRY_EX(LABEL) \ + do { \ + int ACE_TRY_FLAG = 1; \ + int ACE_EXCEPTION_NOT_CAUGHT = 1; \ + ACE_TRY_LABEL ## LABEL: \ + if (ACE_TRY_FLAG) \ + do { + +// Check for exceptions within try blocks. +# define ACE_TRY_CHECK \ + { \ + if (ACE_TRY_ENV.exception () != 0) \ + { \ + ACE_TRY_FLAG = 0; \ + goto ACE_TRY_LABEL; \ + } \ + } + +// Checking exception within EX try blocks. +# define ACE_TRY_CHECK_EX(LABEL) \ + { \ + if (ACE_TRY_ENV.exception () != 0) \ + { \ + ACE_TRY_FLAG = 0; \ + goto ACE_TRY_LABEL ## LABEL; \ + } \ + } + +// Throwing exception within TRY blocks. +# define ACE_TRY_THROW(EXCEPTION) \ + { \ + ACE_TRY_ENV.exception (new EXCEPTION); \ + ACE_TRY_FLAG = 0; \ + goto ACE_TRY_LABEL; \ + } + +# define ACE_TRY_THROW_EX(EXCEPTION,LABEL) \ + { \ + ACE_TRY_ENV.exception (new EXCEPTION); \ + ACE_TRY_FLAG = 0; \ + goto ACE_TRY_LABEL ## LABEL; \ + } + +// When exceptions occur or try block finishes execution without exception, +// control will continue in the catch block. This macro first checks if +// there's any uncaught exception left. If all the conditions are met, we +// have caught an exception. It then resets ACE_EXCEPTION_NOT_CAUGHT to +// prevent subsequent catch blocks from catching the same exception again, +// and extracts out the underlying exception in ACE_TRY_ENV. We also make a +// copy of ACE_TRY_ENV in ACE_CAUGHT_ENV, in case we want to rethrow the +// exception. ACE_TRY_ENV is cleared out after the exception is caught so +// you should not use ACE_TRY_ENV within the catch block(You should use the +// exception directly). +# define ACE_CATCH(TYPE,VAR) \ + } while (0); \ + do \ + if (ACE_TRY_ENV.exception () != 0 && ACE_EXCEPTION_NOT_CAUGHT && \ + TYPE::_downcast(ACE_TRY_ENV.exception ()) != 0) \ + { \ + ACE_ENV_TYPE ACE_CAUGHT_ENV = ACE_TRY_ENV;\ + ACE_EXCEPTION_NOT_CAUGHT = 0; \ + TYPE &VAR = *TYPE::_downcast (ACE_CAUGHT_ENV.exception ()); \ + ACE_UNUSED_ARG (VAR); \ + ACE_TRY_ENV.clear (); + +// ACE_CATCHANY uses ACE_CATCH to catch all exceptions derived from +// ACE_EXCEPTION_TYPE +# define ACE_CATCHANY ACE_CATCH (ACE_EXCEPTION_TYPE, ACE_ANY_EXCEPTION) + +// Since there's no other exception for compilers without exception +// support, we simply catch all ACE_EXCEPTION_TYPE exceptions for +// ACE_CATCHALL. +# define ACE_CATCHALL ACE_CATCHANY + +# if defined (ACE_HAS_DEPRECATED_ACE_RETHROW) +# define ACE_RETHROW \ + do \ + ACE_TRY_ENV = ACE_CAUGHT_ENV; \ + while (0) +# endif /* ACE_HAS_DEPRECATED_ACE_RETHROW */ + +// Rethrowing exception within catch blocks. Notice that we depend on the +// ACE_CHECK/ACE_CHECK_RETURN following the ACE_ENDTRY, or ACE_TRY_CHECK/ +// ACE_TRY_CHECK_EX following the ACE_ENDTRY when the catch block is within +// another try block, to do the "Right Thing[TM]." +# define ACE_RE_THROW \ + do {\ + ACE_TRY_ENV = ACE_CAUGHT_ENV; \ + goto ACE_TRY_LABEL; \ + } while (0) +# define ACE_RE_THROW_EX(LABEL) \ + do {\ + ACE_TRY_ENV = ACE_CAUGHT_ENV; \ + goto ACE_TRY_LABEL ## LABEL; \ + } while (0) + +// Close the try block. Since exceptions may not get caught, and exceptions +// can also be rethrown from the catch block, it's always a good idea to +// follow ACE_ENDTRY with ACE_CHECK or ACE_TRY_CHECK (depending on the +// context.) +# define ACE_ENDTRY \ + } while (0); \ + } while (0) + +#endif /* ! ACE_USES_NATIVE_EXCEPTIONS */ + +#endif /* !ACE_LACKS_DEPRECATED_MACROS */ + +// ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS. +#if defined(ACE_NEW_THROWS_EXCEPTIONS) + +# if defined (ACE_HAS_NEW_NOTHROW) + +# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \ + if (POINTER == 0) { throw EXCEPTION; } \ + } while (0) + +# else + +# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { ACE_del_bad_alloc throw EXCEPTION; } \ + } while (0) + +# endif /* ACE_HAS_NEW_NOTHROW */ + +#else /* ! ACE_NEW_THROWS_EXCEPTIONS */ + +# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { throw EXCEPTION; } \ + } while (0) + +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + +# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ + ACE_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) throw EXCEPTION; + +# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ + ACE_Read_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) throw EXCEPTION; + +# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ + ACE_Write_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) throw EXCEPTION; + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + +//@{ +/** + * @name Native C++ exceptions portability macros. + * + * The following macros are used to write code portable between platforms + * with and without native C++ exception support. Their main goal is to + * hide the presence of the ACE_ENV_TYPE argument, but they collaborate + * with the ACE_TRY_* macros to emulate the try/catch blocks. + */ + +/// Define a macro to emit code only when ACE_ENV_TYPE is used +#if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT) +# define ACE_ENV_EMIT_CODE(X) X +#else +# define ACE_ENV_EMIT_CODE(X) +#endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */ + +/// Another macro to emit code only when ACE_ENV_TYPE is used +#if !defined (ACE_USES_NATIVE_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT) +# define ACE_ENV_EMIT_CODE2(X,Y) X,Y +#else +# define ACE_ENV_EMIT_CODE2(X,Y) +#endif /* ACE_USES_NATIVE_EXCEPTIONS && ! ACE_ENV_BKWD_COMPAT */ + +/// Helper macro +#define ACE_ENV_EMIT_DUMMY + +/// Declare a ACE_ENV_TYPE argument as the last argument of a +/// function +/** + * Normally this macro is used as follows: + * + * void my_funct (int x, int y ACE_ENV_ARG_DECL); + * + * Its purpose is to provide developers (and users) with a mechanism to + * write code that is portable to platforms with and without native C++ + * exceptions. + */ +#define ACE_ENV_ARG_DECL \ + ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ + ACE_ENV_TYPE &ACE_TRY_ENV) + +/// Declare a ACE_ENV_TYPE argument with the default value obtained from +/// the ORB/application. +/** + * It is similar to ACE_ENV_ARG_DECL. The name of the default environment + * getter method needs to be changed when switching ORBs or when used with + * another application. + */ +#define ACE_ENV_ARG_DECL_WITH_DEFAULTS \ + ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ + ACE_ENV_TYPE &ACE_TRY_ENV = \ + ACE_DEFAULT_GET_ENV_METHOD ()) + +/// Declare a ACE_ENV_TYPE argument that is not used by the +/// function definition. +/** + * Similar to ACE_ENV_ARG_DECL, but the formal parameter name is dropped to + * avoid warnings about unused parameters + */ +#define ACE_ENV_ARG_DECL_NOT_USED \ + ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ + ACE_ENV_TYPE &) + +/// Declare a ACE_ENV_TYPE argument for methods that do not take any other +/// parameters +#define ACE_ENV_SINGLE_ARG_DECL \ + ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV) + +/// Declare a ACE_ENV_TYPE argument with a default value for methods that +/// do not take any other parameters. The name of the default environment +/// getter method needs to be changed when switching ORBs or when used in +/// another application. +#define ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS \ + ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &ACE_TRY_ENV = \ + ACE_DEFAULT_GET_ENV_METHOD ()) + +/// Declare a ACE_ENV_TYPE argument for methods which don't use it. +#define ACE_ENV_SINGLE_ARG_DECL_NOT_USED \ + ACE_ENV_EMIT_CODE(ACE_ENV_TYPE &) + +/// Use the ACE_ENV_TYPE argument in a nested call +#define ACE_ENV_ARG_PARAMETER \ + ACE_ENV_EMIT_CODE2(ACE_ENV_EMIT_DUMMY, \ + ACE_TRY_ENV) + +/// Use the ACE_ENV_TYPE argument in a nested call, assuming that the +/// called function takes only the ACE_TRY_ENV argument. +#define ACE_ENV_SINGLE_ARG_PARAMETER \ + ACE_ENV_EMIT_CODE(ACE_TRY_ENV) + +/// Eliminate unused argument warnings about ACE_TRY_ENV +#define ACE_ENV_ARG_NOT_USED \ + ACE_ENV_EMIT_CODE(ACE_UNUSED_ARG(ACE_TRY_ENV)) +//@} + +#if !defined (ACE_USES_NATIVE_EXCEPTIONS) +// This thing can be moved above when we drop ACE_ENV_BKWD_COMPAT. +# define ACE_ENV_RAISE(ex) ACE_TRY_ENV.exception (ex) +#else +# define ACE_ENV_RAISE(ex) (ex)->_raise () +#endif /* ACE_USES_NATIVE_EXCEPTIONS */ + +// ============================================================ + +// Print out a TAO exception. This is not CORBA compliant. +# define ACE_PRINT_TAO_EXCEPTION(EX,INFO) \ + EX._tao_print_exception (INFO) + +// Print out a CORBA exception. There is not portable way to +// dump a CORBA exception. If you are using other ORB implementation, +// redefine the macro to get what you want. +# if !defined ACE_PRINT_EXCEPTION +# define ACE_PRINT_EXCEPTION(EX,INFO) ACE_PRINT_TAO_EXCEPTION(EX,INFO) +# endif /* ACE_PRINT_EXCEPTION */ + +#endif /* !ACE_LACKS_DEPRECATED_MACROS */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CORBA_MACROS_H */ diff --git a/externals/ace/Cache_Map_Manager_T.cpp b/externals/ace/Cache_Map_Manager_T.cpp new file mode 100644 index 0000000..f87031e --- /dev/null +++ b/externals/ace/Cache_Map_Manager_T.cpp @@ -0,0 +1,420 @@ +// $Id: Cache_Map_Manager_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_CACHE_MAP_MANAGER_T_CPP +#define ACE_CACHE_MAP_MANAGER_T_CPP + +#include "ace/Cache_Map_Manager_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Log_Msg.h" +#include "ace/Malloc_Base.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Cache_Map_Manager_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Manager) + +ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Iterator) + +ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Reverse_Iterator) + +#define ACE_T1 class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES +#define ACE_T2 KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES + +template +ACE_Cache_Map_Manager::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s, + size_t size, + ACE_Allocator *alloc) + : caching_strategy_ (caching_s) +{ + if (this->open (size, alloc) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Cache_Map_Manager::ACE_Cache_Map_Manager"))); + +} + +template +ACE_Cache_Map_Manager::~ACE_Cache_Map_Manager (void) +{ + this->close (); +} + +template int +ACE_Cache_Map_Manager::open (size_t length, + ACE_Allocator *alloc) +{ + return this->map_.open (length, + alloc); +} + +template int +ACE_Cache_Map_Manager::close (void) +{ + return this->map_.close (); +} + +template int +ACE_Cache_Map_Manager::bind (const KEY &key, + const VALUE &value) +{ + // Insert an entry which has the and the which + // is the combination of the and the attributes of the + // caching strategy. + CACHE_VALUE cache_value (value, + this->caching_strategy_.attributes ()); + + int bind_result = this->map_.bind (key, + cache_value); + + if (bind_result != -1) + { + + int result = this->caching_strategy_.notify_bind (bind_result, + cache_value.second ()); + + if (result == -1) + { + + this->map_.unbind (key); + + // Unless the notification goes thru the bind operation is + // not complete. + bind_result = -1; + + } + + } + + return bind_result; +} + + +template int +ACE_Cache_Map_Manager::rebind (const KEY &key, + const VALUE &value) +{ + CACHE_VALUE cache_value (value, + this->caching_strategy_.attributes ()); + + int rebind_result = this->map_.rebind (key, + cache_value); + + if (rebind_result != -1) + { + + int result = this->caching_strategy_.notify_rebind (rebind_result, + cache_value.second ()); + + if (result == -1) + { + + // Make sure the unbind operation is done only when the + // notification fails after a bind which is denoted by + // rebind_result = 0 + if (rebind_result == 0) + this->map_.unbind (key); + + // Unless the notification goes thru the rebind operation is + // not complete. + rebind_result = -1; + + } + + } + + return rebind_result; +} + + +template int +ACE_Cache_Map_Manager::rebind (const KEY &key, + const VALUE &value, + VALUE &old_value) +{ + CACHE_VALUE cache_value (value, + this->caching_strategy_.attributes ()); + + CACHE_VALUE old_cache_value (old_value, + this->caching_strategy_.attributes ()); + + int rebind_result = this->map_.rebind (key, + cache_value, + old_cache_value); + + if (rebind_result != -1) + { + + int result = this->caching_strategy_.notify_rebind (rebind_result, + cache_value.second ()); + + if (result == -1) + { + + // Make sure the unbind operation is done only when the + // notification fails after a bind which is denoted by + // rebind_result = 0 + if (rebind_result == 0) + this->map_.unbind (key); + + // Unless the notification goes thru the rebind operation is + // not complete. + rebind_result = -1; + + } + else + { + + old_value = old_cache_value.first (); + + } + + } + + return rebind_result; +} + +template int +ACE_Cache_Map_Manager::rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value) +{ + CACHE_VALUE cache_value (value, + this->caching_strategy_.attributes ()); + + CACHE_VALUE old_cache_value (old_value, + this->caching_strategy_.attributes ()); + + int rebind_result = this->map_.rebind (key, + cache_value, + old_key, + old_cache_value); + + if (rebind_result != -1) + { + + int result = this->caching_strategy_.notify_rebind (rebind_result, + cache_value.second ()); + + if (result == -1) + { + + // Make sure the unbind operation is done only when the + // notification fails after a bind which is denoted by + // rebind_result = 0 + if (rebind_result == 0) + this->map_.unbind (key); + + // Unless the notification goes thru the rebind operation is + // not complete. + rebind_result = -1; + + } + else + { + + old_value = old_cache_value.first (); + + } + + } + + return rebind_result; +} + +template int +ACE_Cache_Map_Manager::trybind (const KEY &key, + VALUE &value) +{ + CACHE_VALUE cache_value (value, + this->caching_strategy_.attributes ()); + + int trybind_result = this->map_.trybind (key, + cache_value); + + if (trybind_result != -1) + { + + int result = this->caching_strategy_.notify_trybind (trybind_result, + cache_value.second ()); + + if (result == -1) + { + + // If the entry has got inserted into the map, it is removed + // due to failure. + if (trybind_result == 0) + this->map_.unbind (key); + + trybind_result = -1; + + } + else + { + + // If an attempt is made to bind an existing entry the value + // is overwritten with the value from the map. + if (trybind_result == 1) + value = cache_value.first (); + + } + + } + + return trybind_result; +} + +template int +ACE_Cache_Map_Manager::find (const KEY &key, + VALUE &value) +{ + // Lookup the key and populate the . + CACHE_VALUE cache_value; + + int find_result = this->map_.find (key, + cache_value); + + if (find_result != -1) + { + + int result = this->caching_strategy_.notify_find (find_result, + cache_value.second ()); + + // Unless the find and notification operations go thru, this + // method is not successful. + if (result == -1) + find_result = -1; + else + { + + // Since the has now changed after the + // notification, we need to bind to the map again. + int rebind_result = this->map_.rebind (key, + cache_value); + if (rebind_result == -1) + find_result = -1; + else + value = cache_value.first (); + + } + + } + + return find_result; +} + +template int +ACE_Cache_Map_Manager::find (const KEY &key) +{ + // Lookup the key and populate the . + CACHE_VALUE cache_value; + + int find_result = this->map_.find (key, + cache_value); + + if (find_result != -1) + { + + int result = this->caching_strategy_.notify_find (find_result, + cache_value.second ()); + + // Unless the find and notification operations go thru, this + // method is not successful. + if (result == -1) + find_result = -1; + else + { + + // Since the has now changed after the + // notification, we need to bind to the map again. + int rebind_result = this->map_.rebind (key, + cache_value); + + if (rebind_result == -1) + find_result = -1; + + } + + } + + return find_result; +} + + +template int +ACE_Cache_Map_Manager::unbind (const KEY &key) +{ + // Remove the entry from the cache. + CACHE_VALUE cache_value; + + int unbind_result = this->map_.unbind (key, + cache_value); + + if (unbind_result != -1) + { + + int result = this->caching_strategy_.notify_unbind (unbind_result, + cache_value.second ()); + + if (result == -1) + unbind_result = -1; + + } + + return unbind_result; +} + +template int +ACE_Cache_Map_Manager::unbind (const KEY &key, + VALUE &value) +{ + // Remove the entry from the cache. + CACHE_VALUE cache_value; + + int unbind_result = this->map_.unbind (key, + cache_value); + + if (unbind_result != -1) + { + + int result = this->caching_strategy_.notify_unbind (unbind_result, + cache_value.second ()); + + if (result == -1) + unbind_result = -1; + else + value = cache_value.first (); + + } + + return unbind_result; +} + +template void +ACE_Cache_Map_Manager::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->map_.dump (); + + this->caching_strategy_.dump (); +#endif /* ACE_HAS_DUMP */ +} + +#undef ACE_T1 +#undef ACE_T2 + +template +ACE_Cache_Map_Iterator::~ACE_Cache_Map_Iterator (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CACHE_MAP_MANAGER_T_CPP */ diff --git a/externals/ace/Cache_Map_Manager_T.h b/externals/ace/Cache_Map_Manager_T.h new file mode 100644 index 0000000..060a8b3 --- /dev/null +++ b/externals/ace/Cache_Map_Manager_T.h @@ -0,0 +1,405 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Cache_Map_Manager_T.h + * + * $Id: Cache_Map_Manager_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Kirthika Parameswaran + */ +//============================================================================= + +#ifndef ACE_CACHE_MAP_MANAGER_T_H +#define ACE_CACHE_MAP_MANAGER_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Default_Constants.h" +#include "ace/Global_Macros.h" +#include "ace/Pair_T.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration. +class ACE_Allocator; + +#define ACE_Cache_Map_Iterator ACMI +#define ACE_Cache_Map_Reverse_Iterator ACMRI + +template +class ACE_Cache_Map_Iterator; + +template +class ACE_Cache_Map_Reverse_Iterator; + +// For linkers that cant grok long names. +#define ACE_Cache_Map_Manager ACMM + +/** + * @class ACE_Cache_Map_Manager + * + * @brief Defines a abstraction that will purge entries from a map. + * + * The will manage the map it contains + * and provide purging on demand from the map. The strategy for + * caching is decided by the user and provided to the Cache + * Manager. The Cache Manager acts as a agent and communicates + * between the Map and the Strategy for purging entries from the + * map. + * No locking mechanism provided since locking at this level + * isn't efficient. Locking has to be provided by the + * application. + */ +template +class ACE_Cache_Map_Manager +{ +public: + + // = Traits. + typedef KEY key_type; + typedef VALUE mapped_type; + typedef CMAP_TYPE map_type; + typedef CACHING_STRATEGY caching_strategy_type; + + typedef ITERATOR_IMPL ITERATOR_IMPLEMENTATION; + typedef REVERSE_ITERATOR_IMPL REVERSE_ITERATOR_IMPLEMENTATION; + + friend class ACE_Cache_Map_Iterator; + friend class ACE_Cache_Map_Reverse_Iterator; + + // = ACE-style iterator typedefs. + typedef ACE_Cache_Map_Iterator + ITERATOR; + typedef ACE_Cache_Map_Reverse_Iterator + REVERSE_ITERATOR; + + // = STL-style iterator typedefs. + typedef ITERATOR + iterator; + typedef REVERSE_ITERATOR + reverse_iterator; + + /** + * The actual value mapped to the key in the map. The + * are used by the strategy and is transparent to the user of this + * class. + */ + typedef ACE_Pair CACHE_VALUE; + + // = Initialization and termination methods. + + /// Initialize a with and + /// @a size entries. + ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_strategy, + size_t size = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + + /// Close down a and release dynamically allocated + /// resources. + virtual ~ACE_Cache_Map_Manager (void); + + /// Initialize a cache with size @a length. + int open (size_t length = ACE_DEFAULT_MAP_SIZE, + ACE_Allocator *alloc = 0); + + /// Close down a cache and release dynamically allocated resources. + int close (void); + + /** + * Associate @a key with @a value. If @a key is already in the CMAP_TYPE + * then the ENTRY is not changed. Returns 0 if a new entry is bound + * successfully, returns 1 if an attempt is made to bind an existing + * entry, and returns -1 if failures occur. + */ + int bind (const KEY &key, + const VALUE &value); + + /** + * Lookup entry in the cache. If it is not found, returns -1. + * If the @a key is located in the CMAP_TYPE object, the CACHING_STRATEGY is + * notified of it via notify_find (int result, ATTRIBUTES &attribute). + * If notify_find also returns 0 (success), then this function returns + * 0 (success) and sets the cached value in @a value. + */ + int find (const KEY &key, + VALUE &value); + + /** + * Lookup entry in the cache. If it is not found, returns -1. + * If the @a key is located in the CMAP_TYPE object, the CACHING_STRATEGY is + * notified of it via notify_find (int result, ATTRIBUTES &attribute). + * If notify_find also returns 0 (success), then this function returns + * 0 (success). + */ + int find (const KEY &key); + + /** + * Reassociate the @a key with @a value. If the @a key already exists + * in the cache then returns 1, on a new bind returns 0 and returns + * -1 in case of any failures. + */ + int rebind (const KEY &key, + const VALUE &value); + + /** + * Reassociate @a key with @a value, storing the old value into the + * "out" parameter @a old_value. The function fails if @a key is not + * in the cache for caches that do not allow user specified keys. + * However, for caches that allow user specified keys, if the key is + * not in the cache, a new @a key / @a value association is created. + */ + int rebind (const KEY &key, + const VALUE &value, + VALUE &old_value); + + /** + * Reassociate @a key with @a value, storing the old key and value + * into the "out" parameters @a old_key and @a old_value. The + * function fails if @a key is not in the cache for caches that do + * not allow user specified keys. However, for caches that allow + * user specified keys, if the key is not in the cache, a new + * @a key / @a value association is created. + */ + int rebind (const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value); + + /** + * Associate @a key with @a value if and only if @a key is not in the + * cache. If @a key is already in the cache, then the @a value + * parameter is overwritten with the existing value in the + * cache. Returns 0 if a new @a key / @a value association is created. + * Returns 1 if an attempt is made to bind an existing entry. This + * function fails for maps that do not allow user specified keys. + */ + int trybind (const KEY &key, + VALUE &value); + + /// Remove @a key from the cache. + int unbind (const KEY &key); + + /// Remove @a key from the cache, and return the @a value associated with + /// @a key. + int unbind (const KEY &key, + VALUE &value); + + /// Remove entries from the cache depending upon the strategy. + int purge (void); + + /// Return the current size of the cache. + size_t current_size (void) const; + + /// Return the total size of the cache. + size_t total_size (void) const; + + /// Dumps the state of the object. + void dump (void) const; + + // = STL styled iterator factory functions. + + /// Return forward iterator. + ITERATOR begin (void); + ITERATOR end (void); + + /// Return reverse iterator. + REVERSE_ITERATOR rbegin (void); + REVERSE_ITERATOR rend (void); + + /// The map managed by the Cache_Map_Manager. + CMAP_TYPE &map (void); + + /// The caching strategy used on the cache. + CACHING_STRATEGY &caching_strategy (void); + +protected: + + /// The underlying map which needs to be cached. + CMAP_TYPE map_; + + /// The strategy to be followed for caching entries in the map. + CACHING_STRATEGY &caching_strategy_; + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager &)) + +}; + +/** + * @class ACE_Cache_Map_Iterator + * + * @brief Defines a iterator for the Cache_Map_Manager. + * + * Implementation to be provided by the iterator of the map + * managed by the ACE_Cache_Map_Manager. + */ +template +class ACE_Cache_Map_Iterator +{ + +public: + + // = Traits. + /// The actual value mapped to the key in the cache. The + /// are used by the strategy and is transperant to the cache user. + typedef ACE_Reference_Pair + value_type; + typedef ACE_Pair + CACHE_VALUE; + + // = Initialisation and termination methods. + + ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl); + + /// Copy constructor. + ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator &rhs); + + virtual ~ACE_Cache_Map_Iterator (void); + + // = Iteration methods. + + /// assignment operator. + ACE_Cache_Map_Iterator &operator= + (const ACE_Cache_Map_Iterator &rhs); + + /// Comparision operators. + bool operator== (const ACE_Cache_Map_Iterator &rhs) const; + bool operator!= (const ACE_Cache_Map_Iterator &rhs) const; + + /// Returns a reference to the internal element @c this is pointing + /// to. + ACE_Reference_Pair operator* (void) const; + + // = STL styled iteration, compare, and reference functions. + + /// Prefix advance + ACE_Cache_Map_Iterator &operator++ (void); + + /// Postfix advance. + ACE_Cache_Map_Iterator operator++ (int); + + /// Prefix reverse. + ACE_Cache_Map_Iterator &operator-- (void); + + /// Postfix reverse. + ACE_Cache_Map_Iterator operator-- (int); + + /// Returns the iterator of the internal map in the custody of the + /// Cache_Map_Manager. + IMPLEMENTATION &iterator_implementation (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// The actual iterator which iterates internally on the map + /// belonging to the Cache_Map_Manager. + IMPLEMENTATION iterator_implementation_; +}; + +/** + * @class ACE_Cache_Map_Reverse_Iterator + * + * @brief Defines a reverse iterator for the Cache_Map_Manager. + * + * Implementation to be provided by the reverse iterator of the map + * managed by thr Cache_Map_manager. + */ +template +class ACE_Cache_Map_Reverse_Iterator +{ +public: + + // = Traits. + /// The actual value mapped to the key in the cache. The + /// are used by the strategy and is transperant to the cache user. + typedef ACE_Reference_Pair value_type; + typedef ACE_Pair CACHE_VALUE; + + // = Initialisation and termination methods. + + ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl); + + /// Copy constructor. + ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator &rhs); + + ~ACE_Cache_Map_Reverse_Iterator (void); + + // = Iteration methods. + + /// Assignment operator. + ACE_Cache_Map_Reverse_Iterator &operator= + (const ACE_Cache_Map_Reverse_Iterator &rhs); + + /// Comparision operators. + bool operator== (const ACE_Cache_Map_Reverse_Iterator &rhs) const; + bool operator!= (const ACE_Cache_Map_Reverse_Iterator &rhs) const; + + /// Returns a reference to the internal element @c this is pointing + /// to. + ACE_Reference_Pair operator* (void) const; + + // = STL styled iteration, compare, and reference functions. + + /// Prefix advance + ACE_Cache_Map_Reverse_Iterator &operator++ (void); + + /// Postfix advance. + ACE_Cache_Map_Reverse_Iterator operator++ (int); + + /// Prefix reverse. + ACE_Cache_Map_Reverse_Iterator &operator-- (void); + + /// Postfix reverse. + ACE_Cache_Map_Reverse_Iterator operator-- (int); + + /// Returns the iterator of the internal map in the custody of the + /// Cache_Map_Manager. + REVERSE_IMPLEMENTATION &iterator_implementation (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// The actual iterator which iterates internally on the map + /// belonging to the Cache_Map_Manager. + REVERSE_IMPLEMENTATION reverse_iterator_implementation_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Cache_Map_Manager_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Cache_Map_Manager_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Cache_Map_Manager_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CACHE_MAP_MANAGER_T_H */ diff --git a/externals/ace/Cache_Map_Manager_T.inl b/externals/ace/Cache_Map_Manager_T.inl new file mode 100644 index 0000000..bcd48bd --- /dev/null +++ b/externals/ace/Cache_Map_Manager_T.inl @@ -0,0 +1,245 @@ +// -*- C++ -*- +// +//$Id: Cache_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE int +ACE_Cache_Map_Manager::purge (void) +{ + return this->caching_strategy ().caching_utility ().clear_cache (this->map_, + this->caching_strategy ().purge_percent ()); +} + +template ACE_INLINE size_t +ACE_Cache_Map_Manager::current_size (void) const +{ + return this->map_.current_size (); +} + +template ACE_INLINE size_t +ACE_Cache_Map_Manager::total_size (void) const +{ + return this->map_.total_size (); +} + +template ACE_INLINE CMAP_TYPE & +ACE_Cache_Map_Manager::map (void) +{ + return this->map_; +} + +template ACE_INLINE CACHING_STRATEGY & +ACE_Cache_Map_Manager::caching_strategy (void) +{ + return this->caching_strategy_; +} + +template ACE_INLINE ACE_Cache_Map_Iterator +ACE_Cache_Map_Manager::begin (void) +{ + return ITERATOR (this->map_.begin ()); +} + +template ACE_INLINE ACE_Cache_Map_Iterator +ACE_Cache_Map_Manager::end (void) +{ + return ITERATOR (this->map_.end ()); +} + +template ACE_INLINE ACE_Cache_Map_Reverse_Iterator +ACE_Cache_Map_Manager::rbegin (void) +{ + return REVERSE_ITERATOR (this->map_.rbegin ()); +} +template ACE_INLINE ACE_Cache_Map_Reverse_Iterator +ACE_Cache_Map_Manager::rend (void) +{ + return REVERSE_ITERATOR (this->map_.rend ()); +} + +//////////////////////////////////////////////////////////////////////////////// + +template ACE_INLINE +ACE_Cache_Map_Iterator::ACE_Cache_Map_Iterator (const ACE_Cache_Map_Iterator &rhs) + : iterator_implementation_ (rhs.iterator_implementation_) +{ +} + +template ACE_INLINE ACE_Cache_Map_Iterator & +ACE_Cache_Map_Iterator::operator= (const ACE_Cache_Map_Iterator &rhs) +{ + this->iterator_implementation_ = rhs.iterator_implementation_; + return *this; +} + +template ACE_INLINE bool +ACE_Cache_Map_Iterator::operator== (const ACE_Cache_Map_Iterator &rhs) const +{ + return this->iterator_implementation_ == rhs.iterator_implementation_; +} + +template ACE_INLINE bool +ACE_Cache_Map_Iterator::operator!= (const ACE_Cache_Map_Iterator &rhs) const +{ + return this->iterator_implementation_ != rhs.iterator_implementation_; +} + +template ACE_INLINE ACE_Reference_Pair +ACE_Cache_Map_Iterator::operator* (void) const +{ + value_type retn ((*this->iterator_implementation_).ext_id_, + (*this->iterator_implementation_).int_id_.first ()); + return retn; +} + +template ACE_INLINE +ACE_Cache_Map_Iterator & +ACE_Cache_Map_Iterator::operator++ (void) +{ + ++this->iterator_implementation_; + return *this; +} + +template ACE_INLINE +ACE_Cache_Map_Iterator +ACE_Cache_Map_Iterator::operator++ (int) +{ + ACE_Cache_Map_Iterator retn = *this; + ++this->iterator_implementation_; + return retn; +} + +template ACE_INLINE +ACE_Cache_Map_Iterator & +ACE_Cache_Map_Iterator::operator-- (void) +{ + --this->iterator_implementation_; + return *this; +} + +template ACE_INLINE +ACE_Cache_Map_Iterator +ACE_Cache_Map_Iterator::operator-- (int) +{ + ACE_Cache_Map_Iterator retn = *this; + --this->iterator_implementation_; + return retn; +} + +template ACE_INLINE void +ACE_Cache_Map_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->iterator_implementation_.dump (); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_INLINE +ACE_Cache_Map_Iterator::ACE_Cache_Map_Iterator (const IMPLEMENTATION &iterator_impl) + : iterator_implementation_ (iterator_impl) +{ +} + +template ACE_INLINE IMPLEMENTATION & +ACE_Cache_Map_Iterator::iterator_implementation (void) +{ + return this->iterator_implementation_; +} + +//////////////////////////////////////////////////////////////////////////////// + +template ACE_INLINE +ACE_Cache_Map_Reverse_Iterator::ACE_Cache_Map_Reverse_Iterator (const ACE_Cache_Map_Reverse_Iterator &rhs) + : reverse_iterator_implementation_ (rhs.reverse_iterator_implementation_) +{ +} + +template ACE_INLINE +ACE_Cache_Map_Reverse_Iterator::~ACE_Cache_Map_Reverse_Iterator (void) +{ +} + +template ACE_INLINE ACE_Cache_Map_Reverse_Iterator & +ACE_Cache_Map_Reverse_Iterator::operator= (const ACE_Cache_Map_Reverse_Iterator &rhs) +{ + this->reverse_iterator_implementation_ = rhs.reverse_iterator_implementation_; + return *this; +} + +template ACE_INLINE bool +ACE_Cache_Map_Reverse_Iterator::operator== (const ACE_Cache_Map_Reverse_Iterator &rhs) const +{ + return this->reverse_iterator_implementation_ == rhs.reverse_iterator_implementation_; +} + +template ACE_INLINE bool +ACE_Cache_Map_Reverse_Iterator::operator!= (const ACE_Cache_Map_Reverse_Iterator &rhs) const +{ + return this->reverse_iterator_implementation_ != rhs.reverse_iterator_implementation_; +} + +template ACE_INLINE ACE_Reference_Pair +ACE_Cache_Map_Reverse_Iterator::operator* (void) const +{ + value_type retv ((*this->reverse_iterator_implementation_).ext_id_, + (*this->reverse_iterator_implementation_).int_id_.first ()); + return retv; +} + +template ACE_INLINE +ACE_Cache_Map_Reverse_Iterator & +ACE_Cache_Map_Reverse_Iterator::operator++ (void) +{ + ++this->reverse_iterator_implementation_; + return *this; +} + +template ACE_INLINE +ACE_Cache_Map_Reverse_Iterator +ACE_Cache_Map_Reverse_Iterator::operator++ (int) +{ + ACE_Cache_Map_Reverse_Iterator retn = *this; + ++this->reverse_iterator_implementation_; + return retn; +} + +template ACE_INLINE +ACE_Cache_Map_Reverse_Iterator & +ACE_Cache_Map_Reverse_Iterator::operator-- (void) +{ + --this->reverse_iterator_implementation_; + return *this; +} + +template ACE_INLINE +ACE_Cache_Map_Reverse_Iterator +ACE_Cache_Map_Reverse_Iterator::operator-- (int) +{ + ACE_Cache_Map_Reverse_Iterator retn = *this; + --this->reverse_iterator_implementation_; + return retn; +} + + +template ACE_INLINE void +ACE_Cache_Map_Reverse_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->reverse_iterator_implementation_.dump (); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_INLINE +ACE_Cache_Map_Reverse_Iterator::ACE_Cache_Map_Reverse_Iterator (const REVERSE_IMPLEMENTATION &iterator_impl) + : reverse_iterator_implementation_(iterator_impl) +{ +} + +template ACE_INLINE REVERSE_IMPLEMENTATION & +ACE_Cache_Map_Reverse_Iterator::iterator_implementation (void) +{ + return this->reverse_iterator_implementation_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Cached_Connect_Strategy_T.cpp b/externals/ace/Cached_Connect_Strategy_T.cpp new file mode 100644 index 0000000..077c6d6 --- /dev/null +++ b/externals/ace/Cached_Connect_Strategy_T.cpp @@ -0,0 +1,734 @@ +//$Id: Cached_Connect_Strategy_T.cpp 82771 2008-09-17 18:47:48Z johnnyw $ + +#ifndef ACE_CACHED_CONNECT_STRATEGY_T_CPP +#define ACE_CACHED_CONNECT_STRATEGY_T_CPP + +#include "ace/Cached_Connect_Strategy_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/ACE.h" +#include "ace/Service_Repository.h" +#include "ace/Service_Types.h" +#include "ace/Thread_Manager.h" +#include "ace/WFMO_Reactor.h" +#include "ace/Pair_T.h" + +#define ACE_T1 class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX +#define ACE_T2 SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Cached_Connect_Strategy_Ex::ACE_Cached_Connect_Strategy_Ex +(CACHING_STRATEGY &caching_s, + ACE_Creation_Strategy *cre_s, + ACE_Concurrency_Strategy *con_s, + ACE_Recycling_Strategy *rec_s, + MUTEX *lock, + int delete_lock) + : CCSBASE (cre_s, con_s, rec_s, lock, delete_lock), + connection_cache_ (caching_s) +{ + if (this->open (cre_s, con_s, rec_s) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Cached_Connect_Strategy_Ex\n"))); +} + +template +ACE_Cached_Connect_Strategy_Ex::~ACE_Cached_Connect_Strategy_Ex (void) +{ + cleanup (); +} + + +template int +ACE_Cached_Connect_Strategy_Ex::check_hint_i +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + ACE_Hash_Map_Entry, ACE_Pair > *&entry, + int &found) +{ + ACE_UNUSED_ARG (remote_addr); + ACE_UNUSED_ARG (timeout); + ACE_UNUSED_ARG (local_addr); + ACE_UNUSED_ARG (reuse_addr); + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (perms); + + found = 0; + + // Get the recycling act for the svc_handler + CONNECTION_CACHE_ENTRY *possible_entry = + (CONNECTION_CACHE_ENTRY *) sh->recycling_act (); + + // Check to see if the hint svc_handler has been closed down + if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED) + { + // If close, decrement refcount + if (possible_entry->ext_id_.decrement () == 0) + { + // If refcount goes to zero, close down the svc_handler + possible_entry->int_id_.first ()->recycler (0, 0); + possible_entry->int_id_.first ()->close (); + this->purge_i (possible_entry); + } + + // Hint not successful + found = 0; + + // Reset hint + sh = 0; + } + + // If hint is not closed, see if it is connected to the correct + // address and is recyclable + else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || + possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) && + possible_entry->ext_id_.subject () == remote_addr) + { + // Hint successful + found = 1; + + // Tell the that it should prepare itself for + // being recycled. + this->prepare_for_recycling (sh); + + // + // Update the caching attributes directly since we don't do a + // find() on the cache map. + // + + // Indicates successful find. + int find_result = 0; + + int result = this->caching_strategy ().notify_find (find_result, + possible_entry->int_id_.second ()); + + if (result == -1) + return result; + } + else + { + // This hint will not be used. + possible_entry->ext_id_.decrement (); + + // Hint not successful + found = 0; + + // If is not connected to the correct address or is busy, + // we will not use it. + sh = 0; + } + + if (found) + entry = possible_entry; + + return 0; +} + +template int +ACE_Cached_Connect_Strategy_Ex::find_or_create_svc_handler_i +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + ACE_Hash_Map_Entry, ACE_Pair > *&entry, + int &found) +{ + REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); + + // Try to find the address in the cache. Only if we don't find it + // do we create a new and connect it with the server. + while (this->find (search_addr, entry) != -1) + { + // We found a cached svc_handler. + // Get the cached + sh = entry->int_id_.first (); + + // Is the connection clean? + int state_result = + ACE::handle_ready (sh->peer ().get_handle (), + &ACE_Time_Value::zero, + 1, // read ready + 0, // write ready + 1);// exception ready + + if (state_result == 1) + { + + if (sh->close () == -1) + return -1; + + sh = 0; + + // Cycle it once again.. + } + else if ((state_result == -1) && (errno == ETIME)) + { + // Found!!! + // Set the flag + found = 1; + + // Tell the that it should prepare itself for + // being recycled. + if (this->prepare_for_recycling (sh) == -1) + return -1; + + return 0; + } + else + { + return -1; + } + } + + // Not found... + + // Set the flag + found = 0; + + // We need to use a temporary variable here since we are not + // allowed to change because other threads may use this + // when we let go of the lock during the OS level connect. + // + // Note that making a new svc_handler, connecting remotely, + // binding to the map, and assigning of the hint and recycler + // should be atomic to the outside world. + SVC_HANDLER *potential_handler = 0; + + // Create a new svc_handler + if (this->make_svc_handler (potential_handler) == -1) + return -1; + + // Connect using the svc_handler. + if (this->cached_connect (potential_handler, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms) == -1) + { + // Close the svc handler. + potential_handler->close (0); + + return -1; + } + else + { + // Insert the new SVC_HANDLER instance into the cache. + if (this->connection_cache_.bind (search_addr, + potential_handler, + entry) == -1) + { + // Close the svc handler and reset . + potential_handler->close (0); + + return -1; + } + + // Everything succeeded as planned. Assign to + // . + sh = potential_handler; + + // Set the recycler and the recycling act + + this->assign_recycler (sh, this, entry); + } + + return 0; +} + +template int +ACE_Cached_Connect_Strategy_Ex::cached_connect (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms) +{ + // Actively establish the connection. This is a timed blocking + // connect. + if (this->new_connection (sh, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms) == -1) + { + // If connect() failed because of timeouts, we have to reject + // the connection entirely. This is necessary since currently + // there is no way for the non-blocking connects to complete and + // for the to notify the cache of the completion of + // connect(). + + if (errno == EWOULDBLOCK || errno == ETIMEDOUT) + errno = ENOTSUP; + else if (ACE::out_of_handles (errno) || errno == EADDRINUSE) + { + // If the connect failed due to the process running out of + // file descriptors then, auto_purging of some connections + // are done from the CONNECTION_CACHE. This frees the + // descriptors which get used in the connect process and + // hence the same method is called again! + if (this->purge_connections () == -1) + return -1; + + // Try connecting again. + if (this->new_connection (sh, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms) == -1) + { + if (errno == EWOULDBLOCK || errno == ETIMEDOUT) + errno = ENOTSUP; + return -1; + } + } + else + { + return -1; + } + } + + return 0; + +} + + +template int +ACE_Cached_Connect_Strategy_Ex::connect_svc_handler_i +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + int& found) +{ + CONNECTION_CACHE_ENTRY *entry = 0; + + // Check if the user passed a hint svc_handler + if (sh != 0) + { + int result = this->check_hint_i (sh, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms, + entry, + found); + if (result != 0) + return result; + } + + // If not found + if (!found) + { + int result = this->find_or_create_svc_handler_i (sh, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms, + entry, + found); + + if (result != 0) + return result; + + // Increment the refcount + entry->ext_id_.increment (); + } + + // For all successful cases: mark the in the cache + // as being . Therefore recyclable is BUSY. + entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); + + return 0; +} + + +template int +ACE_Cached_Connect_Strategy_Ex::cache_i (const void *recycling_act) +{ + // The wonders and perils of ACT + CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; + + // Mark the in the cache as not being . + // Therefore recyclable is IDLE. + entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE); + + return 0; +} + +template int +ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act, + ACE_Recyclable_State new_state) +{ + // The wonders and perils of ACT + CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; + + // Mark the in the cache as not being . + // Therefore recyclable is IDLE. + entry->ext_id_.recycle_state (new_state); + + return 0; +} + +template ACE_Recyclable_State +ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act) const +{ + // The wonders and perils of ACT + CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; + + // Mark the in the cache as not being . + // Therefore recyclable is IDLE. + return entry->ext_id_.recycle_state (); +} + +template int +ACE_Cached_Connect_Strategy_Ex::purge_i (const void *recycling_act) +{ + // The wonders and perils of ACT + CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; + + return this->connection_cache_.unbind (entry); +} + + +template int +ACE_Cached_Connect_Strategy_Ex::mark_as_closed_i (const void *recycling_act) +{ + // The wonders and perils of ACT + CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; + + // Mark the in the cache as CLOSED. + entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED); + + return 0; +} + +template int +ACE_Cached_Connect_Strategy_Ex::cleanup_hint_i (const void *recycling_act, + void **act_holder) +{ + // Reset the <*act_holder> in the confines and protection of the + // lock. + if (act_holder) + *act_holder = 0; + + // The wonders and perils of ACT + CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; + + // Decrement the refcount on the . + int refcount = entry->ext_id_.decrement (); + + // If the svc_handler state is closed and the refcount == 0, call + // close() on svc_handler. + if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED && + refcount == 0) + { + entry->int_id_.first ()->recycler (0, 0); + entry->int_id_.first ()->close (); + this->purge_i (entry); + } + + return 0; +} + +template int +ACE_Cached_Connect_Strategy_Ex::purge_connections (void) +{ + return this->connection_cache_.purge (); +} + +template CACHING_STRATEGY & +ACE_Cached_Connect_Strategy_Ex::caching_strategy (void) +{ + return this->connection_cache_.caching_strategy (); +} + +template int +ACE_Cached_Connect_Strategy_Ex::find (ACE_Refcounted_Hash_Recyclable &search_addr, + ACE_Hash_Map_Entry, ACE_Pair > *&entry) +{ + typedef ACE_Hash_Map_Bucket_Iterator, + ACE_Hash, + ACE_Equal_To, + ACE_Null_Mutex> + CONNECTION_CACHE_BUCKET_ITERATOR; + + CONNECTION_CACHE_BUCKET_ITERATOR iterator (this->connection_cache_.map (), + search_addr); + + CONNECTION_CACHE_BUCKET_ITERATOR end (this->connection_cache_.map (), + search_addr, + 1); + + for (; + iterator != end; + ++iterator) + { + REFCOUNTED_HASH_RECYCLABLE_ADDRESS &addr = (*iterator).ext_id_; + + if (addr.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE && + addr.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) + continue; + + if (addr.subject () != search_addr.subject ()) + continue; + + entry = &(*iterator); + + // + // Update the caching attributes directly since we don't do a + // find() on the cache map. + // + + // Indicates successful find. + int find_result = 0; + + int result = this->caching_strategy ().notify_find (find_result, + entry->int_id_.second ()); + + if (result == -1) + return result; + + return 0; + } + + return -1; +} + +template void +ACE_Cached_Connect_Strategy_Ex::cleanup (void) +{ + // Excluded other threads from changing the cache while we cleanup + ACE_GUARD (MUTEX, ace_mon, *this->lock_); + + // Close down all cached service handlers. + typename CONNECTION_CACHE::ITERATOR iter = this->connection_cache_.begin (); + while (iter != this->connection_cache_.end ()) + { + if ((*iter).second () != 0) + { + // save entry for future use + CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) + (*iter).second ()->recycling_act (); + + // close handler + (*iter).second ()->recycler (0, 0); + (*iter).second ()->close (); + + // remember next iter + typename CONNECTION_CACHE::ITERATOR next_iter = iter; + ++next_iter; + + // purge the item from the hash + this->purge_i (entry); + + // assign next iter + iter = next_iter; + } + else + ++iter; + } +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Cached_Connect_Strategy_Ex) +///////////////////////////////////////////////////////////////////////// + +template +ACE_Bounded_Cached_Connect_Strategy::ACE_Bounded_Cached_Connect_Strategy +(size_t max_size, + CACHING_STRATEGY &caching_s, + ACE_Creation_Strategy *cre_s, + ACE_Concurrency_Strategy *con_s, + ACE_Recycling_Strategy *rec_s, + MUTEX *lock, + int delete_lock) + : CCSEBASE (caching_s, cre_s, con_s, rec_s, lock, delete_lock), + max_size_ (max_size) +{ +} + +template +ACE_Bounded_Cached_Connect_Strategy::~ACE_Bounded_Cached_Connect_Strategy(void) +{ +} + +template +int +ACE_Bounded_Cached_Connect_Strategy::find_or_create_svc_handler_i +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + ACE_Hash_Map_Entry, + ACE_Pair > *&entry, + int &found) +{ + + REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); + + // Try to find the address in the cache. Only if we don't find it + // do we create a new and connect it with the server. + while (this->find (search_addr, entry) != -1) + { + // We found a cached svc_handler. + // Get the cached + sh = entry->int_id_.first (); + + // Is the connection clean? + int state_result= ACE::handle_ready (sh->peer ().get_handle (), + &ACE_Time_Value::zero, + 1, // read ready + 0, // write ready + 1);// exception ready + + if (state_result == 1) + { + // The connection was disconnected during idle. + // close the svc_handler down. + if (sh->close () == -1) + { + ACE_ASSERT (0); + return -1; + } + sh = 0; + // and rotate once more... + } + else if ((state_result == -1) && (errno == ETIME)) + { + // Found!!! + // Set the flag + found = 1; + + // Tell the that it should prepare itself for + // being recycled. + if (this->prepare_for_recycling (sh) == -1) + { + ACE_ASSERT (0); + return -1; + } + + return 0; + } + else // some other return value or error... + { + ACE_ASSERT (0); // just to see it coming + + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%t)ACE_Bounded_Cached_Connect_Strategy<>::") + ACE_TEXT ("find_or_create_svc_handler_i - ") + ACE_TEXT ("error polling server socket state.\n"))); + + return -1; + } + } + + // Not found... + + // Set the flag + found = 0; + + // Check the limit of handlers... + if ((this->max_size_ > 0) && + (this->connection_cache_.current_size () >= this->max_size_)) + { + // Try to purge idle connections + if (this->purge_connections () == -1) + return -1; + + // Check limit again. + if (this->connection_cache_.current_size () >= this->max_size_) + // still too much! + return -1; + + // OK, we have room now... + } + + // We need to use a temporary variable here since we are not + // allowed to change because other threads may use this + // when we let go of the lock during the OS level connect. + // + // Note that making a new svc_handler, connecting remotely, + // binding to the map, and assigning of the hint and recycler + // should be atomic to the outside world. + SVC_HANDLER *potential_handler = 0; + + // Create a new svc_handler + if (this->make_svc_handler (potential_handler) == -1) + return -1; + + // Connect using the svc_handler. + if (this->cached_connect (potential_handler, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms) == -1) + { + // Close the svc handler. + potential_handler->close (0); + return -1; + } + else + { + // Insert the new SVC_HANDLER instance into the cache. + if (this->connection_cache_.bind (search_addr, + potential_handler, + entry) == -1) + { + // Close the svc handler and reset . + potential_handler->close (0); + + return -1; + } + + // Everything succeeded as planned. Assign to + // . + sh = potential_handler; + + // Set the recycler and the recycling act + this->assign_recycler (sh, this, entry); + } + + return 0; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Cached_Connect_Strategy) + +ACE_END_VERSIONED_NAMESPACE_DECL + +#undef ACE_T1 +#undef ACE_T2 + +#endif /* ACE_CACHED_CONNECT_STRATEGY_T_CPP */ diff --git a/externals/ace/Cached_Connect_Strategy_T.h b/externals/ace/Cached_Connect_Strategy_T.h new file mode 100644 index 0000000..d062e1e --- /dev/null +++ b/externals/ace/Cached_Connect_Strategy_T.h @@ -0,0 +1,262 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Cached_Connect_Strategy_T.h + * + * $Id: Cached_Connect_Strategy_T.h 82771 2008-09-17 18:47:48Z johnnyw $ + * + * @author Kirthika Parameswaran + */ +//============================================================================= + +#ifndef CACHED_CONNECT_STRATEGY_T_H +#define CACHED_CONNECT_STRATEGY_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Strategies_T.h" +#include "ace/Hash_Cache_Map_Manager_T.h" +#include "ace/Caching_Strategies_T.h" +#include "ace/Functor_T.h" +#include "ace/Pair_T.h" + +// For linkers which cant grok long names... +#define ACE_Cached_Connect_Strategy_Ex ACCSE + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Cached_Connect_Strategy_Ex + * + * @brief A connection strategy which caches connections to peers + * (represented by SVC_HANDLER instances), thereby allowing + * subsequent re-use of unused, but available, connections. + * + * is intended to be used as a + * plug-in connection strategy for ACE_Strategy_Connector. + * It's added value is re-use of established connections and + * tweaking the role of the cache as per the caching strategy. + */ +template +class ACE_Cached_Connect_Strategy_Ex + : public ACE_Cached_Connect_Strategy +{ +public: + /// Constructor + ACE_Cached_Connect_Strategy_Ex ( + CACHING_STRATEGY &caching_s, + ACE_Creation_Strategy *cre_s = 0, + ACE_Concurrency_Strategy *con_s = 0, + ACE_Recycling_Strategy *rec_s = 0, + MUTEX *lock = 0, + int delete_lock = 0); + + /// Destructor + virtual ~ACE_Cached_Connect_Strategy_Ex (void); + + /// Explicit purging of connection entries from the connection cache. + virtual int purge_connections (void); + + /// Mark as closed (non-locking version). This is used during the cleanup of the + /// connections purged. + virtual int mark_as_closed_i (const void *recycling_act); + + /** + * Since g++ version < 2.8 arent happy with templates, this special + * method had to be devised to avoid memory leaks and perform + * cleanup of the . + */ + void cleanup (void); + + // = Typedefs for managing the map + typedef ACE_Refcounted_Hash_Recyclable + REFCOUNTED_HASH_RECYCLABLE_ADDRESS; + typedef ACE_Hash_Cache_Map_Manager, + ACE_Equal_To, + CACHING_STRATEGY, + ATTRIBUTES> + CONNECTION_CACHE; + typedef typename CONNECTION_CACHE::CACHE_ENTRY CONNECTION_CACHE_ENTRY; + typedef typename CONNECTION_CACHE::key_type KEY; + typedef typename CONNECTION_CACHE::mapped_type VALUE; + + typedef ACE_Recyclable_Handler_Cleanup_Strategy, + ACE_Hash_Map_Manager_Ex, + ACE_Hash, + ACE_Equal_To, + MUTEX> > + CLEANUP_STRATEGY; + + typedef ACE_Cached_Connect_Strategy + CCSBASE; + + // = Accessor. + CACHING_STRATEGY &caching_strategy (void); + +protected: + + /// Find an idle handle. + int find (ACE_Refcounted_Hash_Recyclable &search_addr, + ACE_Hash_Map_Entry, ACE_Pair > *&entry); + + /// Remove from cache (non-locking version). + virtual int purge_i (const void *recycling_act); + + /// Add to cache (non-locking version). + virtual int cache_i (const void *recycling_act); + + /// Get/Set (non-locking version). + virtual int recycle_state_i (const void *recycling_act, + ACE_Recyclable_State new_state); + virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const; + + /// Cleanup hint and reset <*act_holder> to zero if . + virtual int cleanup_hint_i (const void *recycling_act, + void **act_holder); + + // = Helpers + int check_hint_i (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + ACE_Hash_Map_Entry, ACE_Pair > *&entry, + int &found); + + virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + ACE_Hash_Map_Entry, ACE_Pair > *&entry, + int &found); + + virtual int connect_svc_handler_i (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + int &found); + + /** + * Connection of the svc_handler with the remote host. This method + * also encapsulates the connection done with auto_purging under the + * hood. If the connect failed due to the process running out of + * file descriptors then, auto_purging of some connections are done + * from the CONNECTION_CACHE. This frees the descriptors which get + * used in the connect process and hence the connect operation can + * succeed. + */ + virtual int cached_connect (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms); + + /// Table that maintains the cache of connected SVC_HANDLERs. + CONNECTION_CACHE connection_cache_; +}; + +///////////////////////////////////////////////////////////////////////////// + +// For linkers which cant grok long names... +#define ACE_Bounded_Cached_Connect_Strategy ABCCS + +/** + * @class ACE_Bounded_Cached_Connect_Strategy + * + * @brief A connection strategy which caches connections to peers + * (represented by SVC_HANDLER instances), thereby allowing + * subsequent re-use of unused, but available, connections. + * This strategy should be used when the cache is bounded by + * maximum size. + * + * is intended to be used as a + * plug-in connection strategy for ACE_Strategy_Connector. + * It's added value is re-use of established connections and + * tweaking the role of the cache as per the caching strategy. + * Thanks to Edan Ayal for contributing this + * class and Susan Liebeskind for + * brainstorming about it. + */ +template +class ACE_Bounded_Cached_Connect_Strategy + : public ACE_Cached_Connect_Strategy_Ex +{ + + typedef ACE_Cached_Connect_Strategy_Ex + CCSEBASE; + + // = Typedefs for managing the map + typedef ACE_Refcounted_Hash_Recyclable + REFCOUNTED_HASH_RECYCLABLE_ADDRESS; + +public: + + /// Constructor + ACE_Bounded_Cached_Connect_Strategy (size_t max_size, + CACHING_STRATEGY &caching_s, + ACE_Creation_Strategy *cre_s = 0, + ACE_Concurrency_Strategy *con_s = 0, + ACE_Recycling_Strategy *rec_s = 0, + MUTEX *lock = 0, + int delete_lock = 0); + + /// Destructor + virtual ~ACE_Bounded_Cached_Connect_Strategy (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + + virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + bool reuse_addr, + int flags, + int perms, + ACE_Hash_Map_Entry, + ACE_Pair > *&entry, + int &found); + +protected: + + /// max items in the cache, used as a bound for the creation of svc_handlers. + size_t max_size_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Cached_Connect_Strategy_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Cached_Connect_Strategy_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* CACHED_CONNECT_STRATEGY_T_H */ diff --git a/externals/ace/Caching_Strategies_T.cpp b/externals/ace/Caching_Strategies_T.cpp new file mode 100644 index 0000000..2b0fd4e --- /dev/null +++ b/externals/ace/Caching_Strategies_T.cpp @@ -0,0 +1,59 @@ +//$Id: Caching_Strategies_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_CACHING_STRATEGIES_T_CPP +#define ACECACHING_STRATEGIES_T_CPP + +#include "ace/Caching_Strategies_T.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Caching_Strategies_T.inl" +#endif /* __ACE_INLINE__ */ + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Caching_Strategy::~ACE_Caching_Strategy (void) +{ +} + +////////////////////////////////////////////////////////////////////////////////// + +template +ACE_LRU_Caching_Strategy::ACE_LRU_Caching_Strategy (void) + : timer_ (0), + purge_percent_ (10) +{ +} + +//////////////////////////////////////////////////////////////////////////////////////////////// + +template +ACE_LFU_Caching_Strategy::ACE_LFU_Caching_Strategy (void) + : purge_percent_ (10) +{ +} + +//////////////////////////////////////////////////////////////////////////////////////////////// + +template +ACE_FIFO_Caching_Strategy::ACE_FIFO_Caching_Strategy (void) + : order_ (0), + purge_percent_ (10) +{ +} + +//////////////////////////////////////////////////////////////////////////////////////////////// + +ACE_ALLOC_HOOK_DEFINE(ACE_LRU_Caching_Strategy) +ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy) +ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy) +ACE_ALLOC_HOOK_DEFINE(ACE_Null_Caching_Strategy) + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CACHING_STRATEGIES_T_CPP */ diff --git a/externals/ace/Caching_Strategies_T.h b/externals/ace/Caching_Strategies_T.h new file mode 100644 index 0000000..e4b0817 --- /dev/null +++ b/externals/ace/Caching_Strategies_T.h @@ -0,0 +1,552 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Caching_Strategies_T.h + * + * $Id: Caching_Strategies_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Kirthika Parameswaran + */ +//============================================================================= + +#ifndef ACE_CACHING_STRATEGIES_H +#define ACE_CACHING_STRATEGIES_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/Caching_Utility_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined(_MSC_VER) +#pragma warning(disable:4503) +#endif /* _MSC_VER */ + +// For linkers that cant grok long names. +#define ACE_Caching_Strategy ACS + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Caching_Strategy + * + * @brief This class is an abstract base class for a caching strategy. + * + * This class consists of all the interfaces a caching strategy should + * have and is used in association with the + * ACE_Caching_Strategy_Adaptor. + */ +template +class ACE_Caching_Strategy +{ +public: + /// Destructor. + virtual ~ACE_Caching_Strategy (void); + + /// Accessor method for the timer attributes. + virtual ATTRIBUTES attributes (void) = 0; + + /// Get the percentage of entries to purge. + virtual double purge_percent (void) = 0; + + /// Set the percentage of entries to purge. + virtual void purge_percent (double percentage) = 0; + + // = Strategy related Operations + + /// This method acts as a notification about the CONTAINERs bind + /// method call. + virtual int notify_bind (int result, + const ATTRIBUTES &attr) = 0; + + /// This method acts as a notification about the CONTAINERs find + /// method call + virtual int notify_find (int result, + ATTRIBUTES &attr) = 0; + + /// This method acts as a notification about the CONTAINERs unbind + /// method call + virtual int notify_unbind (int result, + const ATTRIBUTES &attr) = 0; + + /// This method acts as a notification about the CONTAINERs trybind + /// method call + virtual int notify_trybind (int result, + ATTRIBUTES &attr) = 0; + + /// This method acts as a notification about the CONTAINERs rebind + /// method call + virtual int notify_rebind (int result, + const ATTRIBUTES &attr) = 0; + + /// Purge the cache. + virtual CACHING_UTILITY &caching_utility (void) = 0; + + /// Dumps the state of the object. + virtual void dump (void) const = 0; +}; + +////////////////////////////////////////////////////////////////////////// + +#define ACE_Caching_Strategy_Adapter ACSA + +/** + * @class ACE_Caching_Strategy_Adapter + * + * @brief This class follows the Adaptor pattern and is used to provide + * External Polymorphism by deriving from ACE_Caching_Strategy. + * + * This class simply delegates all requests to the + * IMPLEMNETATION object within. This class should be passed in + * place of the the abstract base ACE_Caching_Strategy class as + * part of the External Polymorphism pattern. + */ +template +class ACE_Caching_Strategy_Adapter + : public ACE_Caching_Strategy +{ + +public: + + /// Constructor. + ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation = 0, + bool delete_implementation = false); + + /// Destructor. + ~ACE_Caching_Strategy_Adapter (void); + + /// Accessor method for the timer attributes. + ATTRIBUTES attributes (void); + + /// Get the percentage of entries to purge. + double purge_percent (void); + + /// Set the percentage of entries to purge. + void purge_percent (double percentage); + + // = Strategy related Operations + + /// This method acts as a notification about the CONTAINERs bind + /// method call. + int notify_bind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs find + /// method call + int notify_find (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs unbind + /// method call + int notify_unbind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs trybind + /// method call + int notify_trybind (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs rebind + /// method call + int notify_rebind (int result, + const ATTRIBUTES &attr); + + /// Accessor to the implementation. + IMPLEMENTATION &implementation (void); + + /// Purge the cache. + CACHING_UTILITY &caching_utility (void); + + /// Dumps the state of the object. + void dump (void) const; + +private: + + /// Implementation class. + IMPLEMENTATION *implementation_; + + /// Do we need to delete the implementation? + bool delete_implementation_; +}; + +////////////////////////////////////////////////////////////////////////// +#define ACE_LRU_Caching_Strategy ALRU + +/** + * @class ACE_LRU_Caching_Strategy + * + * @brief Defines a Least Recently Used strategy which will decide on + * the item to be removed from the cache. + * + * This is a strategy which makes use of a virtual timer which + * is updated whenever an item is inserted or looked up in the + * container. When the need of purging entries arises, the items + * with the lowest timer values are removed. + * Explanation of the template parameter list: + * CONTAINER is any map with entries of type . + * The ATTRIBUTES are the deciding factor for purging of entries + * and should logically be included with the VALUE. Some ways of + * doing this are: As being a member of the VALUE or VALUE being + * ACE_Pair. The CACHING_UTILITY is the + * class which can be plugged in and which decides the entries + * to purge. + */ +template +class ACE_LRU_Caching_Strategy +{ +public: + + // Traits. + typedef ATTRIBUTES CACHING_ATTRIBUTES; + + // = Initialisation and termination. + + /** + * The is the map in which the entries reside. The + * timer attribute is initialed to zero in this constructor. And + * the field denotes the percentage of the entries + * in the cache which can be purged automagically and by default is + * set to 10%. + */ + ACE_LRU_Caching_Strategy (void); + + // = Operations of the strategy. + + /// Accessor method for the timer attributes. + ATTRIBUTES attributes (void); + + /// Get the percentage of entries to purge. + double purge_percent (void); + + /// Set the percentage of entries to purge. + void purge_percent (double percentage); + + // = Strategy related Operations + + /// This method acts as a notification about the CONTAINERs bind + /// method call. + int notify_bind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs find + /// method call + int notify_find (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs unbind + /// method call + int notify_unbind (int result, + const ATTRIBUTES &attr); + + + /// This method acts as a notification about the CONTAINERs trybind + /// method call + int notify_trybind (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs rebind + /// method call + int notify_rebind (int result, + const ATTRIBUTES &attr); + + /// Purge the cache. + CACHING_UTILITY &caching_utility (void); + + /// Dumps the state of the object. + void dump (void) const; + +private: + + /// This element is the one which is the deciding factor for purging + /// of an ITEM. + ATTRIBUTES timer_; + + /// The level about which the purging will happen automagically. + double purge_percent_; + + /// This is the helper class which will decide and expunge entries + /// from the cache. + CACHING_UTILITY caching_utility_; +}; + +////////////////////////////////////////////////////////////////////////// +#define ACE_LFU_Caching_Strategy ALFU + +/** + * @class ACE_LFU_Caching_Strategy + * + * @brief Defines a Least Frequently Used strategy for which will decide on + * the item to be removed from the cache. + * + * A attribute is tagged to each item which increments whenever + * the item is bound or looked up in the cache. Thus it denotes + * the frequency of use. According to the value of the attribute + * the item is removed from the CONTAINER i.e cache. + * Explanation of the template parameter list: + * CONTAINER is any map with entries of type . + * The ATTRIBUTES are the deciding factor for purging of entries + * and should logically be included with the VALUE. Some ways of + * doing this are: As being a member of the VALUE or VALUE being + * ACE_Pair. The CACHING_UTILITY is the + * class which can be plugged in and which decides the entries + * to purge. + */ +template +class ACE_LFU_Caching_Strategy +{ + +public: + + // Traits. + typedef ATTRIBUTES CACHING_ATTRIBUTES; + + // = Initialisation and termination methods. + + /** + * The is the map in which the entries reside. The + * timer attribute is initialed to zero in this constructor. And + * the field denotes the percentage of the entries + * in the cache which can be purged automagically and by default is + * set to 10%. + */ + ACE_LFU_Caching_Strategy (void); + + // = Strategy methods. + + /// Access the attributes. + ATTRIBUTES attributes (void); + + /// Get the percentage of entries to purge. + double purge_percent (void); + + /// Set the percentage of entries to purge. + void purge_percent (double percentage); + + // = Strategy related Operations + + /// This method acts as a notification about the CONTAINERs bind + /// method call. + int notify_bind (int result, + const ATTRIBUTES &attr); + + /// Lookup notification. + int notify_find (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs unbind + /// method call + int notify_unbind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs trybind + /// method call + int notify_trybind (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs rebind + /// method call + int notify_rebind (int result, + const ATTRIBUTES &attr); + + /// Purge the cache. + CACHING_UTILITY &caching_utility (void); + + /// Dumps the state of the object. + void dump (void) const; + +private: + + /// The level about which the purging will happen automagically. + double purge_percent_; + + /// This is the helper class which will decide and expunge entries + /// from the cache. + CACHING_UTILITY caching_utility_; +}; + +///////////////////////////////////////////////////////////// +#define ACE_FIFO_Caching_Strategy AFIFO + +/** + * @class ACE_FIFO_Caching_Strategy + * + * @brief The First In First Out strategy is implemented wherein each + * item is ordered. + * + * The order tag of each item is used to decide the item to be + * removed from the cache. The items with least order are removed. + * Explanation of the template parameter list: + * CONTAINER is any map with entries of type . + * The ATTRIBUTES are the deciding factor for purging of entries + * and should logically be included with the VALUE. Some ways of + * doing this are: As being a member of the VALUE or VALUE being + * ACE_Pair. The CACHING_UTILITY is the + * class which can be plugged in and which decides the entries + * to purge. + */ +template +class ACE_FIFO_Caching_Strategy +{ + +public: + + typedef ATTRIBUTES CACHING_ATTRIBUTES; + + // = Initialisation and termination. + + /** + * The is the map in which the entries reside. The + * timer attribute is initialed to zero in this constructor. And + * the field denotes the percentage of the entries + * in the cache which can be purged automagically and by default is + * set to 10%. + */ + ACE_FIFO_Caching_Strategy (void); + + // = Strategy methods. + + /// Accessor method. + ATTRIBUTES attributes (void); + + /// Get the percentage of entries to purge. + double purge_percent (void); + + /// Set the percentage of entries to purge. + void purge_percent (double percentage); + + // = Strategy related Operations + + /// Notification for an item getting bound into the cache. + int notify_bind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs find + /// method call + int notify_find (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs unbind + /// method call + int notify_unbind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs trybind + /// method call + int notify_trybind (int result, + ATTRIBUTES &attr); + + /// Notification for an item getting bound again into the cache. + int notify_rebind (int result, + const ATTRIBUTES &attr); + + /// Purge the cache. + CACHING_UTILITY &caching_utility (void); + + /// Dumps the state of the object. + void dump (void) const; + +private: + + /// The order is the deciding factor for the item to be removed from + /// the cache. + ATTRIBUTES order_; + + /// The level about which the purging will happen automagically. + double purge_percent_; + + /// This is the helper class which will decide and expunge entries + /// from the cache. + CACHING_UTILITY caching_utility_; +}; + +////////////////////////////////////////////////////////////////////// +#define ACE_Null_Caching_Strategy ANULL + +/** + * @class ACE_Null_Caching_Strategy + * + * @brief The is a special caching strategy which doesnt have the purging + * feature. + * + * No purging provided. To be used when purging might be too expensive + * an operation. + */ +template +class ACE_Null_Caching_Strategy +{ + +public: + + // = Traits. + typedef ATTRIBUTES CACHING_ATTRIBUTES; + + // = Strategy methods. All are NO_OP methods!!! + + /// Accessor method. + ATTRIBUTES attributes (void); + + /// Get the percentage of entries to purge. + double purge_percent (void); + + /// Set the percentage of entries to purge. + void purge_percent (double percentage); + + // = Strategy related Operations + + /// Notification for an item getting bound into the cache. + int notify_bind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs find + /// method call + int notify_find (int result, + ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs unbind + /// method call + int notify_unbind (int result, + const ATTRIBUTES &attr); + + /// This method acts as a notification about the CONTAINERs trybind + /// method call + int notify_trybind (int result, + ATTRIBUTES &attr); + + /// Notification for an item getting bound again into the cache. + int notify_rebind (int result, + const ATTRIBUTES &attr); + + /// Purge the cache. + CACHING_UTILITY &caching_utility (void); + + /// Dumps the state of the object. + void dump (void) const; + +private: + + /// This is the helper class which will decide and expunge entries + /// from the cache. + CACHING_UTILITY caching_utility_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Caching_Strategies_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Caching_Strategies_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Caching_Strategies_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CACHING_STRATEGIES_H */ diff --git a/externals/ace/Caching_Strategies_T.inl b/externals/ace/Caching_Strategies_T.inl new file mode 100644 index 0000000..41fa2d3 --- /dev/null +++ b/externals/ace/Caching_Strategies_T.inl @@ -0,0 +1,456 @@ +// -*-C++-*- +// +//$Id: Caching_Strategies_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +////////////////////////////////////////////////////////////////////////////////// + +#include "ace/OS_Memory.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE +ACE_Caching_Strategy_Adapter::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation, + bool delete_implementation) + : implementation_ (implementation), + delete_implementation_ (delete_implementation) +{ + if (this->implementation_ == 0) + { + ACE_NEW (this->implementation_, + IMPLEMENTATION); + this->delete_implementation_ = true; + } +} + +template ACE_INLINE +ACE_Caching_Strategy_Adapter::~ACE_Caching_Strategy_Adapter (void) +{ + if (this->delete_implementation_) + { + delete this->implementation_; + this->delete_implementation_ = false; + this->implementation_ = 0; + } +} + +template ACE_INLINE ATTRIBUTES +ACE_Caching_Strategy_Adapter::attributes (void) +{ + return this->implementation_->attributes (); +} + +template ACE_INLINE double +ACE_Caching_Strategy_Adapter::purge_percent (void) +{ + return this->implementation_->purge_percent (); +} + +template ACE_INLINE void +ACE_Caching_Strategy_Adapter::purge_percent (double percentage) +{ + this->implementation_->purge_percent (percentage); +} + +template ACE_INLINE int +ACE_Caching_Strategy_Adapter::notify_bind (int result, + const ATTRIBUTES &attr) +{ + return this->implementation_->notify_bind (result, + attr); +} + +template ACE_INLINE int +ACE_Caching_Strategy_Adapter::notify_find (int result, + ATTRIBUTES &attr) +{ + return this->implementation_->notify_find (result, + attr); +} + +template ACE_INLINE int +ACE_Caching_Strategy_Adapter::notify_unbind (int result, + const ATTRIBUTES &attr) +{ + return this->implementation_->notify_unbind (result, + attr); +} + +template ACE_INLINE int +ACE_Caching_Strategy_Adapter::notify_trybind (int result, + ATTRIBUTES &attr) +{ + return this->implementation_->notify_trybind (result, + attr); +} + +template ACE_INLINE int +ACE_Caching_Strategy_Adapter::notify_rebind (int result, + const ATTRIBUTES &attr) +{ + return this->implementation_->notify_rebind (result, + attr); +} + +template ACE_INLINE IMPLEMENTATION & +ACE_Caching_Strategy_Adapter::implementation (void) +{ + return *this->implementation_; +} + +template ACE_INLINE CACHING_UTILITY & +ACE_Caching_Strategy_Adapter::caching_utility (void) +{ + return this->implementation_->caching_utility (); +} + +template ACE_INLINE void +ACE_Caching_Strategy_Adapter::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Caching_Strategy_Adapter::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +////////////////////////////////////////////////////////////////////////////////// + +template ACE_INLINE ATTRIBUTES +ACE_LRU_Caching_Strategy::attributes (void) +{ + return this->timer_; +} + +template ACE_INLINE double +ACE_LRU_Caching_Strategy::purge_percent (void) +{ + return this->purge_percent_; +} + +template ACE_INLINE void +ACE_LRU_Caching_Strategy::purge_percent (double percentage) +{ + this->purge_percent_ = percentage; +} + +template ACE_INLINE int +ACE_LRU_Caching_Strategy::notify_bind ( + int result, + const ATTRIBUTES & /* attr */) +{ + if (result == 0) + ++this->timer_; + + return result; +} + +template ACE_INLINE int +ACE_LRU_Caching_Strategy::notify_find ( + int result, + ATTRIBUTES &attr) +{ + if (result == 0) + { + attr = this->timer_; + ++this->timer_; + } + + return result; +} + +template ACE_INLINE int +ACE_LRU_Caching_Strategy::notify_unbind ( + int result, + const ATTRIBUTES & /* attr */) +{ + return result; +} + +template ACE_INLINE int +ACE_LRU_Caching_Strategy::notify_trybind ( + int result, + ATTRIBUTES & /* attr */) +{ + return result; +} + +template ACE_INLINE int +ACE_LRU_Caching_Strategy::notify_rebind ( + int result, + const ATTRIBUTES & /* attr */) +{ + if (result == 0) + ++this->timer_; + + return result; +} + +template ACE_INLINE CACHING_UTILITY & +ACE_LRU_Caching_Strategy::caching_utility (void) +{ + return this->caching_utility_; +} + +template ACE_INLINE void +ACE_LRU_Caching_Strategy::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_LRU_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("timer_ = %d "), this->timer_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +////////////////////////////////////////////////////////////////////////////////// + +template ACE_INLINE ATTRIBUTES +ACE_LFU_Caching_Strategy::attributes (void) +{ + return 0; +} + +template ACE_INLINE double +ACE_LFU_Caching_Strategy::purge_percent (void) +{ + return this->purge_percent_; +} + +template ACE_INLINE void +ACE_LFU_Caching_Strategy::purge_percent (double percentage) +{ + this->purge_percent_ = percentage; +} + +template ACE_INLINE int +ACE_LFU_Caching_Strategy::notify_bind (int result, + const ATTRIBUTES & /* attr */) +{ + + return result; +} + +template ACE_INLINE int +ACE_LFU_Caching_Strategy::notify_find (int result, + ATTRIBUTES &attr) +{ + if (result == 0) + ++attr; + + return result; +} + +template ACE_INLINE int +ACE_LFU_Caching_Strategy::notify_trybind (int result, + ATTRIBUTES & /* attr */) +{ + return result; +} + +template ACE_INLINE int +ACE_LFU_Caching_Strategy::notify_rebind (int result, + const ATTRIBUTES & /* attr */) +{ + return result; +} + +template ACE_INLINE int +ACE_LFU_Caching_Strategy::notify_unbind (int result, + const ATTRIBUTES & /* attr */) +{ + return result; +} + +template ACE_INLINE CACHING_UTILITY & +ACE_LFU_Caching_Strategy::caching_utility (void) +{ + return this->caching_utility_; +} + +template ACE_INLINE void +ACE_LFU_Caching_Strategy::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_LFU_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +////////////////////////////////////////////////////////////////////////////////////// + +template ACE_INLINE ATTRIBUTES +ACE_FIFO_Caching_Strategy::attributes (void) +{ + return this->order_; +} + +template ACE_INLINE double +ACE_FIFO_Caching_Strategy::purge_percent (void) +{ + return this->purge_percent_; +} + +template ACE_INLINE void +ACE_FIFO_Caching_Strategy::purge_percent (double percentage) +{ + this->purge_percent_ = percentage; +} + +template ACE_INLINE int +ACE_FIFO_Caching_Strategy::notify_bind (int result, + const ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + if (result == 0) + ++this->order_; + + return result; +} + +template ACE_INLINE int +ACE_FIFO_Caching_Strategy::notify_find (int result, + ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE int +ACE_FIFO_Caching_Strategy::notify_unbind (int result, + const ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE int +ACE_FIFO_Caching_Strategy::notify_trybind (int result, + ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE int +ACE_FIFO_Caching_Strategy::notify_rebind (int result, + const ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + if (result == 0) + ++this->order_; + + return result; +} + +template ACE_INLINE CACHING_UTILITY & +ACE_FIFO_Caching_Strategy::caching_utility (void) +{ + return this->caching_utility_; +} + +template ACE_INLINE void +ACE_FIFO_Caching_Strategy::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("order_ = %d "), this->order_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +////////////////////////////////////////////////////////////////////////////////// + +template ACE_INLINE ATTRIBUTES +ACE_Null_Caching_Strategy::attributes (void) +{ + return 0; +} + +template ACE_INLINE double +ACE_Null_Caching_Strategy::purge_percent (void) +{ + return 0; +} + +template ACE_INLINE void +ACE_Null_Caching_Strategy::purge_percent (double percentage) +{ + ACE_UNUSED_ARG (percentage); +} + +template ACE_INLINE int +ACE_Null_Caching_Strategy::notify_bind (int result, + const ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE int +ACE_Null_Caching_Strategy::notify_find (int result, + ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE int +ACE_Null_Caching_Strategy::notify_unbind (int result, + const ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE int +ACE_Null_Caching_Strategy::notify_trybind (int result, + ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE int +ACE_Null_Caching_Strategy::notify_rebind (int result, + const ATTRIBUTES &attr) +{ + ACE_UNUSED_ARG (attr); + + return result; +} + +template ACE_INLINE CACHING_UTILITY & +ACE_Null_Caching_Strategy::caching_utility (void) +{ + return this->caching_utility_; +} + +template ACE_INLINE void +ACE_Null_Caching_Strategy::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Null_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +////////////////////////////////////////////////////////////////////////////////// diff --git a/externals/ace/Caching_Utility_T.cpp b/externals/ace/Caching_Utility_T.cpp new file mode 100644 index 0000000..a03a457 --- /dev/null +++ b/externals/ace/Caching_Utility_T.cpp @@ -0,0 +1,499 @@ +// $Id: Caching_Utility_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_CACHING_UTILITY_T_CPP +#define ACE_CACHING_UTILITY_T_CPP + +#include "ace/Caching_Utility_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Min_Max.h" +#include "ace/OS_Memory.h" +#include "ace/Recyclable.h" + +////////////////////////////////////////////////////////////////////////////// + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Pair_Caching_Utility::ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, + int delete_cleanup_strategy) + : cleanup_strategy_ (cleanup_strategy), + delete_cleanup_strategy_ (delete_cleanup_strategy) +{ + if (cleanup_strategy == 0) + { + ACE_NEW (this->cleanup_strategy_, + CLEANUP_STRATEGY); + this->delete_cleanup_strategy_ = 1; + } +} + +template +ACE_Pair_Caching_Utility::~ACE_Pair_Caching_Utility (void) +{ + if (this->delete_cleanup_strategy_) + delete this->cleanup_strategy_; +} + +template int +ACE_Pair_Caching_Utility::clear_cache (CONTAINER &container, + double purge_percent) +{ + // Check that the purge_percent is non-zero. + if (purge_percent == 0) + return 0; + + // Get the number of entries in the container. + size_t current_map_size = container.current_size (); + + // Also whether the number of entries in the cache! + // Oops! then there is no way out but exiting. So return an error. + if (current_map_size == 0) + return 0; + + // Calculate the no of entries to remove from the cache depending + // upon the . + size_t const entries_to_remove + = ACE_MAX (static_cast (1), + static_cast (static_cast (purge_percent) + / 100 * current_map_size)); + KEY *key_to_remove = 0; + VALUE *value_to_remove = 0; + + for (size_t i = 0; i < entries_to_remove ; ++i) + { + this->minimum (container, + key_to_remove, + value_to_remove); + + // Simply verifying that the key is non-zero. + // This is important for strategies where the minimum + // entry cant be found due to constraints on the type of entry + // to remove. + if (key_to_remove == 0) + return 0; + + if (this->cleanup_strategy_->cleanup (container, + key_to_remove, + value_to_remove) == -1) + return -1; + + } + + return 0; +} + +template void +ACE_Pair_Caching_Utility::minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove) +{ + // Starting values. + ITERATOR iter = container.begin (); + ITERATOR end = container.end (); + ATTRIBUTES min = (*iter).int_id_.second (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + + // The iterator moves thru the container searching for the entry + // with the lowest ATTRIBUTES. + for (++iter; + iter != end; + ++iter) + { + if (min > (*iter).int_id_.second ()) + { + // Ah! an item with lower ATTTRIBUTES... + min = (*iter).int_id_.second (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// + +template +ACE_Recyclable_Handler_Caching_Utility::ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, + int delete_cleanup_strategy) + : cleanup_strategy_ (cleanup_strategy), + delete_cleanup_strategy_ (delete_cleanup_strategy) +{ + if (cleanup_strategy == 0) + { + ACE_NEW (this->cleanup_strategy_, + CLEANUP_STRATEGY); + this->delete_cleanup_strategy_ = 1; + } +} + +template +ACE_Recyclable_Handler_Caching_Utility::~ACE_Recyclable_Handler_Caching_Utility (void) +{ + if (this->delete_cleanup_strategy_) + delete this->cleanup_strategy_; +} + +template int +ACE_Recyclable_Handler_Caching_Utility::clear_cache (CONTAINER &container, + double purge_percent) +{ + // Check that the purge_percent is non-zero. + if (purge_percent == 0) + return 0; + + // Get the number of entries in the container. + size_t current_map_size = container.current_size (); + + // Also whether the number of entries in the cache is just one! + // Oops! then there is no way out but exiting. So return an error. + // if (current_map_size <= 1) + if (current_map_size == 0) + return 0; + + // Calculate the no of entries to remove from the cache depending + // upon the . + size_t const entries_to_remove + = ACE_MAX (static_cast (1), + static_cast (static_cast (purge_percent) + / 100 * current_map_size)); + + KEY *key_to_remove = 0; + VALUE *value_to_remove = 0; + + for (size_t i = 0; i < entries_to_remove ; ++i) + { + this->minimum (container, + key_to_remove, + value_to_remove); + + // Simply verifying that the key is non-zero. + // This is important for strategies where the minimum + // entry cant be found due to constraints on the type of entry + // to remove. + if (key_to_remove == 0) + return 0; + + if (this->cleanup_strategy_->cleanup (container, + key_to_remove, + value_to_remove) == -1) + return -1; + } + + return 0; +} + +template void +ACE_Recyclable_Handler_Caching_Utility::minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove) +{ + // Starting values. + ITERATOR end = container.end (); + ITERATOR iter = container.begin (); + ATTRIBUTES min = (*iter).int_id_.second (); + key_to_remove = 0; + value_to_remove = 0; + // Found the minimum entry to be purged? + int found = 0; + + // The iterator moves thru the container searching for the entry + // with the lowest ATTRIBUTES. + for (; + iter != end; + ++iter) + { + // If the entry isnt IDLE_AND_PURGABLE continue until you reach + // the first entry which can be purged. This is the minimum with + // which you will compare the rest of the purgable entries. + if ((*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || + (*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE) + { + if (found == 0) + { + min = (*iter).int_id_.second (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + found = 1; + } + else + { + // Ah! an entry with lower ATTTRIBUTES... + if (min > (*iter).int_id_.second ()) + { + min = (*iter).int_id_.second (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + } + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +template +ACE_Refcounted_Recyclable_Handler_Caching_Utility::ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, + int delete_cleanup_strategy) + : cleanup_strategy_ (cleanup_strategy), + delete_cleanup_strategy_ (delete_cleanup_strategy), + marked_as_closed_entries_ (0) +{ + if (cleanup_strategy == 0) + { + ACE_NEW (this->cleanup_strategy_, + CLEANUP_STRATEGY); + this->delete_cleanup_strategy_ = 1; + } +} + +template +ACE_Refcounted_Recyclable_Handler_Caching_Utility::~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void) +{ + if (this->delete_cleanup_strategy_) + delete this->cleanup_strategy_; +} + +template int +ACE_Refcounted_Recyclable_Handler_Caching_Utility::clear_cache (CONTAINER &container, + double purge_percent) +{ + // Check that the purge_percent is non-zero. + if (purge_percent == 0) + return 0; + + // Get the number of entries in the container which can be considered for purging. + size_t const available_entries = + container.current_size () - this->marked_as_closed_entries_; + + // Also whether the number of entries in the cache zero. + // Oops! then there is no way out but exiting. + if (available_entries <= 0) + return 0; + + // Calculate the no of entries to remove from the cache depending + // upon the . + size_t entries_to_remove + = ACE_MAX (static_cast (1), + static_cast (static_cast (purge_percent) + / 100 * available_entries)); + + if (entries_to_remove >= available_entries || entries_to_remove == 0) + entries_to_remove = available_entries - 1; + + KEY *key_to_remove = 0; + VALUE *value_to_remove = 0; + + for (size_t i = 0; i < entries_to_remove ; ++i) + { + this->minimum (container, + key_to_remove, + value_to_remove); + + // Simply verifying that the key is non-zero. + // This is important for strategies where the minimum + // entry cant be found due to constraints on the type of entry + // to remove. + if (key_to_remove == 0) + return 0; + + if (this->cleanup_strategy_->cleanup (container, + key_to_remove, + value_to_remove) == -1) + return -1; + + ++this->marked_as_closed_entries_; + } + + return 0; +} + +template void +ACE_Refcounted_Recyclable_Handler_Caching_Utility::minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove) +{ + // Starting values. + ITERATOR end = container.end (); + ITERATOR iter = container.begin (); + ATTRIBUTES min = (*iter).int_id_.second (); + key_to_remove = 0; + value_to_remove = 0; + // Found the minimum entry to be purged? + int found = 0; + + // The iterator moves thru the container searching for the entry + // with the lowest ATTRIBUTES. + for (; + iter != end; + ++iter) + { + // If the entry isnt IDLE_AND_PURGABLE continue until you reach + // the first entry which can be purged. This is the minimum with + // which you will compare the rest of the purgable entries. + if ((*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || + (*iter).ext_id_.recycle_state () == ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE) + { + if (found == 0) + { + min = (*iter).int_id_.second (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + found = 1; + } + else + { + // Ah! an entry with lower ATTTRIBUTES... + if (min > (*iter).int_id_.second ()) + { + min = (*iter).int_id_.second (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + } + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +template +ACE_Handler_Caching_Utility::ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, + int delete_cleanup_strategy) + : cleanup_strategy_ (cleanup_strategy), + delete_cleanup_strategy_ (delete_cleanup_strategy) +{ + if (cleanup_strategy == 0) + { + ACE_NEW (this->cleanup_strategy_, + CLEANUP_STRATEGY); + this->delete_cleanup_strategy_ = 1; + } +} + +template +ACE_Handler_Caching_Utility::~ACE_Handler_Caching_Utility (void) +{ + if (this->delete_cleanup_strategy_) + delete this->cleanup_strategy_; +} + +template int +ACE_Handler_Caching_Utility::clear_cache (CONTAINER &container, + double purge_percent) +{ + // Check that the purge_percent is non-zero. + if (purge_percent == 0) + return 0; + + // Get the number of entries in the container. + size_t current_map_size = container.current_size (); + + // Also whether the number of entries in the cache is just one! + // Oops! then there is no way out but exiting. So return an error. + if (current_map_size == 0) + return 0; + + // Calculate the no of entries to remove from the cache depending + // upon the . + size_t entries_to_remove + = ACE_MAX (static_cast (1), + static_cast (static_cast (purge_percent) + / 100 * current_map_size)); + + KEY *key_to_remove = 0; + VALUE *value_to_remove = 0; + + for (size_t i = 0; i < entries_to_remove ; ++i) + { + this->minimum (container, + key_to_remove, + value_to_remove); + + if (this->cleanup_strategy_->cleanup (container, + key_to_remove, + value_to_remove) == -1) + return -1; + } + + return 0; +} + +template void +ACE_Handler_Caching_Utility::minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove) +{ + // Starting values. + ITERATOR iter = container.begin (); + ITERATOR end = container.end (); + ATTRIBUTES min = (*iter).int_id_->caching_attributes (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + + // The iterator moves thru the container searching for the entry + // with the lowest ATTRIBUTES. + for (++iter; + iter != end; + ++iter) + { + if (min > (*iter).int_id_->caching_attributes () && + (*iter).int_id_->active () != 1) + { + // Ah! an item with lower ATTTRIBUTES... + min = (*iter).int_id_->caching_attributes (); + key_to_remove = &(*iter).ext_id_; + value_to_remove = &(*iter).int_id_; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////// + +template +ACE_Null_Caching_Utility::ACE_Null_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy, + int delete_cleanup_strategy) + : cleanup_strategy_ (cleanup_strategy), + delete_cleanup_strategy_ (delete_cleanup_strategy) +{ + if (cleanup_strategy == 0) + { + ACE_NEW (this->cleanup_strategy_, + CLEANUP_STRATEGY); + this->delete_cleanup_strategy_ = 1; + } +} + +template +ACE_Null_Caching_Utility::~ACE_Null_Caching_Utility (void) +{ + if (this->delete_cleanup_strategy_) + delete this->cleanup_strategy_; +} + +template int +ACE_Null_Caching_Utility::clear_cache (CONTAINER &container, + double purge_percent) +{ + ACE_UNUSED_ARG (container); + ACE_UNUSED_ARG (purge_percent); + + return 0; +} + +template void +ACE_Null_Caching_Utility::minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove) +{ + ACE_UNUSED_ARG (container); + ACE_UNUSED_ARG (key_to_remove); + ACE_UNUSED_ARG (value_to_remove); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CACHING_UTILITY_T_CPP */ diff --git a/externals/ace/Caching_Utility_T.h b/externals/ace/Caching_Utility_T.h new file mode 100644 index 0000000..5428682 --- /dev/null +++ b/externals/ace/Caching_Utility_T.h @@ -0,0 +1,347 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Caching_Utility_T.h + * + * $Id: Caching_Utility_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Kirthika Parameswaran + */ +//============================================================================= + +#ifndef ACE_CACHING_UTILITY_H +#define ACE_CACHING_UTILITY_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/Cleanup_Strategies_T.h" + +// For linkers that cant grok long names. +#define ACE_Pair_Caching_Utility APUTIL + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Pair_Caching_Utility + * + * @brief Defines a helper class for the Caching Strategies. + * + * This class defines the methods commonly used by the different + * caching strategies. For instance: method which + * decides and purges the entry from the container. @note This + * class helps in the caching_strategies using a container + * containing entries of > + * kind. The attributes helps in deciding the entries to be + * purged. The Cleanup_Strategy is the callback class to which the + * entries to be cleaned up will be delegated. + */ +template +class ACE_Pair_Caching_Utility +{ +public: + + typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY; + + /// Constructor. + ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, + int delete_cleanup_strategy = 0); + + /// Destructor. + ~ACE_Pair_Caching_Utility (void); + + /** + * Purge entries from the @a container. The Cleanup_Strategy will do the + * actual job of cleanup once the entries to be cleaned up are decided. + */ + int clear_cache (CONTAINER &container, + double purge_percent); + +protected: + + /// Find the entry with minimum caching attributes. + void minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove); + + /// The cleanup strategy which can be used to destroy the entries of + /// the container. + CLEANUP_STRATEGY *cleanup_strategy_; + + /// Whether the cleanup_strategy should be destroyed or not. + int delete_cleanup_strategy_; + + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Pair_Caching_Utility &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Pair_Caching_Utility (const ACE_Pair_Caching_Utility &)) +}; + +//////////////////////////////////////////////////////////////////////////////// +#define ACE_Recyclable_Handler_Caching_Utility ARHUTIL + +/** + * @class ACE_Recyclable_Handler_Caching_Utility + * + * @brief Defines a helper class for the Caching Strategies. + * + * This class defines the methods commonly used by the different + * caching strategies. For instance: method which + * decides and purges the entry from the container. @note This + * class helps in the caching_strategies using a container + * containing entries of kind. The attributes + * helps in deciding the entries to be purged. The + * Cleanup_Strategy is the callback class to which the entries to + * be cleaned up will be delegated. + */ +template +class ACE_Recyclable_Handler_Caching_Utility +{ + +public: + + typedef ACE_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; + typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; + + /// Constructor. + ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, + int delete_cleanup_strategy = 0); + + /// Destructor. + ~ACE_Recyclable_Handler_Caching_Utility (void); + + /** + * Purge entries from the . The Cleanup_Strategy will do + * the actual job of cleanup once the entries to be cleaned up are + * decided. + */ + int clear_cache (CONTAINER &container, + double purge_percent); + +protected: + + /// Find the entry with minimum caching attributes. + void minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove); + + /// This is the default Cleanup Strategy for this utility. + CLEANUP_STRATEGY_BASE *cleanup_strategy_; + + /// Whether the cleanup_strategy should be destroyed or not. + int delete_cleanup_strategy_; + +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Recyclable_Handler_Caching_Utility &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Recyclable_Handler_Caching_Utility (const ACE_Recyclable_Handler_Caching_Utility &)) +}; + +/////////////////////////////////////////////////////////////////////////// +#define ACE_Refcounted_Recyclable_Handler_Caching_Utility ARRHUTIL + +/** + * @class ACE_Refcounted_Recyclable_Handler_Caching_Utility + * + * @brief Defines a helper class for the Caching Strategies. + * + * This class defines the methods commonly used by the different + * caching strategies. For instance: clear_cache () method which + * decides and purges the entry from the container. @note This + * class helps in the caching_strategies using a container + * containing entries of kind. The attributes helps in + * deciding the entries to be purged. The Cleanup_Strategy is the + * callback class to which the entries to be cleaned up will be + * delegated. + */ +template +class ACE_Refcounted_Recyclable_Handler_Caching_Utility +{ + +public: + + typedef ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; + typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; + + /// Constructor. + ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, + int delete_cleanup_strategy = 0); + + /// Destructor. + ~ACE_Refcounted_Recyclable_Handler_Caching_Utility (void); + + /** + * Purge entries from the . The Cleanup_Strategy will do + * the actual job of cleanup once the entries to be cleaned up are + * decided. + */ + int clear_cache (CONTAINER &container, + double purge_percent); + +protected: + + /// Find the entry with minimum caching attributes. + void minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove); + + /// This is the default Cleanup Strategy for this utility. + CLEANUP_STRATEGY_BASE *cleanup_strategy_; + + /// Whether the cleanup_strategy should be destroyed or not. + int delete_cleanup_strategy_; + + /** + * This figure denotes the number of entries are there in the + * container which have been marked as closed already but might + * not have been unbound from the container. + */ + size_t marked_as_closed_entries_; + +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Refcounted_Recyclable_Handler_Caching_Utility &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Refcounted_Recyclable_Handler_Caching_Utility (const ACE_Refcounted_Recyclable_Handler_Caching_Utility &)) +}; + +//////////////////////////////////////////////////////////////////////////////////////// + +/** + * @class ACE_Handler_Caching_Utility + * + * @brief Defines a helper class for the Caching Strategies. + * + * This class defines the methods commonly used by the different + * caching strategies. For instance: method which + * decides and purges the entry from the container. @note This + * class helps in the caching_strategies using a container + * containing entries of kind where the HANDLER + * contains the caching attributes which help in deciding the + * entries to be purged. The Cleanup_Strategy is the callback + * class to which the entries to be cleaned up will be delegated. + */ +template +class ACE_Handler_Caching_Utility +{ +public: + + typedef ACE_Handler_Cleanup_Strategy CLEANUP_STRATEGY; + typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; + + /// Constructor. + ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, + int delete_cleanup_strategy = 0); + + /// Destructor. + ~ACE_Handler_Caching_Utility (void); + + /** + * Purge entries from the . The Cleanup_Strategy will do + * the actual job of cleanup once the entries to be cleaned up are + * decided. + */ + int clear_cache (CONTAINER &container, + double purge_percent); + +protected: + + /** + * Find the entry with minimum caching attributes. This is handler + * specific since this utility is to be used very specifically for + * handler who have caching_attributes for server side acched + * connection management. + */ + void minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove); + + /// The cleanup strategy which can be used to destroy the entries of + /// the container. + CLEANUP_STRATEGY_BASE *cleanup_strategy_; + + /// Whether the cleanup_strategy should be destroyed or not. + int delete_cleanup_strategy_; + +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Handler_Caching_Utility &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Handler_Caching_Utility (const ACE_Handler_Caching_Utility &)) +}; + +/////////////////////////////////////////////////////////////////////////// +#define ACE_Null_Caching_Utility ANUTIL +/** + * @class ACE_Null_Caching_Utility + * + * @brief Defines a dummy helper class for the Caching Strategies. + * + * This class defines the methods commonly used by the different + * caching strategies. For instance: method which + * decides and purges the entry from the container. @note This + * class is be used with the Null_Caching_Strategy. The + * Cleanup_Strategy is the callback class to which the entries to + * be cleaned up will be delegated. + */ +template +class ACE_Null_Caching_Utility +{ +public: + + typedef ACE_Null_Cleanup_Strategy CLEANUP_STRATEGY; + typedef ACE_Cleanup_Strategy CLEANUP_STRATEGY_BASE; + + /// Constructor. + ACE_Null_Caching_Utility (ACE_Cleanup_Strategy *cleanup_strategy = 0, + int delete_cleanup_strategy = 0); + + /// Destructor. + ~ACE_Null_Caching_Utility (void); + + /** + * Purge entries from the . The Cleanup_Strategy will do + * the actual job of cleanup once the entries to be cleaned up are + * decided. @note Here it is a no-op. + */ + int clear_cache (CONTAINER &container, + double purge_percent); + +protected: + + /** + * Find the entry with minimum caching attributes. This is handler + * specific since this utility is to be used very specifically for + * handler who have caching_attributes for server side acched + * connection management.@note Here it is a no-op. + */ + void minimum (CONTAINER &container, + KEY *&key_to_remove, + VALUE *&value_to_remove); + + /// The cleanup strategy which can be used to destroy the entries of + /// the container. + CLEANUP_STRATEGY_BASE *cleanup_strategy_; + + /// Whether the cleanup_strategy should be destroyed or not. + int delete_cleanup_strategy_; + +private: + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Null_Caching_Utility &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Null_Caching_Utility (const ACE_Null_Caching_Utility &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Caching_Utility_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Caching_Utility_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CACHING_UTILITY_H */ diff --git a/externals/ace/Capabilities.cpp b/externals/ace/Capabilities.cpp new file mode 100644 index 0000000..5d46e75 --- /dev/null +++ b/externals/ace/Capabilities.cpp @@ -0,0 +1,355 @@ +#include "ace/Capabilities.h" +#include "ace/OS_NS_ctype.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Capabilities.inl" +#endif /* !__ACE_INLINE__ */ + +#include "ace/OS_NS_stdio.h" + +ACE_RCSID (ace, + Capabilities, + "$Id: Capabilities.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +#define ACE_ESC ((ACE_TCHAR)0x1b) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_CapEntry::~ACE_CapEntry (void) +{ +} + +ACE_Capabilities::ACE_Capabilities (void) + : caps_ () +{ +} + +ACE_Capabilities::~ACE_Capabilities (void) +{ + this->resetcaps (); +} + +const ACE_TCHAR * +ACE_Capabilities::parse (const ACE_TCHAR *buf, ACE_TString &cap) +{ + while (*buf != ACE_TEXT ('\0') && *buf != ACE_TEXT (',')) + { + if (*buf == ACE_TEXT ('\\')) + { + ++buf; + if (*buf == ACE_TEXT ('E') || *buf == ACE_TEXT ('e')) + { + cap += ACE_ESC; + ++buf; + continue; + } + else if (*buf == ACE_TEXT ('r')) + { + cap += ACE_TEXT ('\r'); + ++buf; + continue; + } + else if (*buf == ACE_TEXT ('n')) + { + cap += ACE_TEXT ('\n'); + ++buf; + continue; + } + else if (*buf == ACE_TEXT ('t')) + { + cap += ACE_TEXT ('\t'); + ++buf; + continue; + } + else if (*buf == ACE_TEXT ('\\')) + { + cap += *buf++; + continue; + } + if (ACE_OS::ace_isdigit(*buf)) + { + // @@ UNICODE Does this work with unicode? + int oc = 0; + for (int i = 0; + i < 3 && *buf && ACE_OS::ace_isdigit (*buf); + i++) + oc = oc * 8 + (*buf++ - ACE_TEXT ('0')); + + cap += (ACE_TCHAR) oc; + continue; + } + } + cap += *buf++; + } + return buf; +} + +const ACE_TCHAR * +ACE_Capabilities::parse (const ACE_TCHAR *buf, int &cap) +{ + int n = 0; + + while (*buf && ACE_OS::ace_isdigit (*buf)) + n = n * 10 + (*buf++ - ACE_TEXT ('0')); + + cap = n; + + return buf; +} + +void +ACE_Capabilities::resetcaps (void) +{ + for (CAPABILITIES_MAP::ITERATOR iter (this->caps_); + !iter.done (); + iter.advance ()) + { + CAPABILITIES_MAP::ENTRY *entry = 0; + iter.next (entry); + delete entry->int_id_; + } + + this->caps_.close (); + this->caps_.open (); +} + +int +ACE_Capabilities::fillent (const ACE_TCHAR *buf) +{ + this->resetcaps (); + while (*buf) + { + ACE_TString s; + int n; + ACE_TString name; + ACE_CapEntry *ce; + + // Skip blanks + while (*buf && ACE_OS::ace_isspace(*buf)) buf++; + // If we get end of line return + + if (*buf == ACE_TEXT ('\0')) + break; + + if (*buf == ACE_TEXT ('#')) + { + while (*buf && *buf != ACE_TEXT ('\n')) + buf++; + if (*buf == ACE_TEXT ('\n')) + buf++; + continue; + } + while(*buf && *buf != ACE_TEXT ('=') + && *buf!= ACE_TEXT ('#') + && *buf != ACE_TEXT (',')) + name += *buf++; + + // If name is null. + switch (*buf) + { + case ACE_TEXT ('='): + // String property + buf = this->parse (buf + 1, s); + ACE_NEW_RETURN (ce, + ACE_StringCapEntry (s), + -1); + if (this->caps_.bind (name, ce) == -1) + { + delete ce; + return -1; + } + break; + case ACE_TEXT ('#'): + // Integer property + buf = this->parse (buf + 1, n); + ACE_NEW_RETURN (ce, + ACE_IntCapEntry (n), + -1); + if (this->caps_.bind (name, ce) == -1) + { + delete ce; + return -1; + } + break; + case ACE_TEXT (','): + // Boolean + ACE_NEW_RETURN (ce, + ACE_BoolCapEntry (1), + -1); + if (this->caps_.bind (name, ce) == -1) + { + delete ce; + return -1; + } + break; + default: + return 0; + } + + if (*buf++ != ACE_TEXT (',')) + return -1; + } + + return 0; +} + +int +ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line) +{ + for (;;) + { + // Skip blanks or irrelevant characters + while (*line && ACE_OS::ace_isspace(*line)) + ++line; + + // End of line reached + if (*line == ACE_TEXT ('\0')) + break; + + // Build the entry name + ACE_TString nextname; + while (*line && *line != ACE_TEXT ('|') && *line != ACE_TEXT (',')) + nextname += *line++; + + // We have found the required entry? + if (ACE_OS::strcmp (nextname.c_str (), name) == 0) + return 1; + + // Skip puntuaction char if neccesary. + if (*line == ACE_TEXT ('|') || *line == ACE_TEXT (',')) + ++line; + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Invalid entry\n"))); + break; + } + } + return 0; +} + +int +ACE_Capabilities::getline (FILE *fp, ACE_TString &line) +{ + int ch; + + line.set (0, 0); + + while ((ch = ACE_OS::fgetc (fp)) != EOF && ch != ACE_TEXT ('\n')) + line += (ACE_TCHAR) ch; + + if (ch == EOF && line.length () == 0) + return -1; + else + return 0; +} + +int +ACE_Capabilities::getval (const ACE_TCHAR *keyname, ACE_TString &val) +{ + ACE_CapEntry* cap = 0; + if (this->caps_.find (keyname, cap) == -1) + return -1; + + ACE_StringCapEntry *scap = + dynamic_cast (cap); + if (scap == 0) + return -1; + + val = scap->getval (); + return 0; +} + +int +ACE_Capabilities::getval (const ACE_TCHAR *keyname, int &val) +{ + ACE_CapEntry *cap = 0; + if (this->caps_.find (keyname, cap) == -1) + return -1; + + ACE_IntCapEntry *icap = + dynamic_cast (cap); + if (icap != 0) + { + val = icap->getval (); + return 0; + } + + ACE_BoolCapEntry *bcap = + dynamic_cast (cap); + + if (bcap == 0) + return -1; + + val = bcap->getval (); + return 0; +} + +#if !defined (ACE_IS_SPLITTING) +static int +is_empty (const ACE_TCHAR *line) +{ + while (*line && ACE_OS::ace_isspace (*line)) + ++line; + + return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#'); +} + +static int +is_line (const ACE_TCHAR *line) +{ + while (*line && ACE_OS::ace_isspace (*line)) + ++line; + + return *line != ACE_TEXT ('\0'); +} +#endif /* !ACE_IS_SPLITTING */ + +int +ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name) +{ + FILE *fp = ACE_OS::fopen (fname, ACE_TEXT ("r")); + + if (fp == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Can't open %s file\n"), + fname), + -1); + + int done; + ACE_TString line; + + while (0 == (done = (this->getline (fp, line) == -1)) + && is_empty (line.c_str ())) + continue; + + while (!done) + { + ACE_TString newline; + ACE_TString description; + + while (0 == (done = (this->getline (fp, newline) == -1))) + if (is_line (newline.c_str ())) + description += newline; + else + break; + + if (this->is_entry (name, line.c_str())) + { + ACE_OS::fclose (fp); + return this->fillent (description.c_str ()); + } + + line = newline; + while (!done && is_empty (line.c_str ())) + done = this->getline (fp, line) == -1; + } + + ACE_OS::fclose (fp); + return -1; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Capabilities.h b/externals/ace/Capabilities.h new file mode 100644 index 0000000..e893d98 --- /dev/null +++ b/externals/ace/Capabilities.h @@ -0,0 +1,221 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Capabilities.h + * + * $Id: Capabilities.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Arturo Montes + */ +//============================================================================= + + +#ifndef ACE_CAPABILITIES_H +#define ACE_CAPABILITIES_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Null_Mutex.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Containers.h" +#include "ace/SString.h" +#include "ace/Functor_String.h" + +#if defined (ACE_IS_SPLITTING) +# include "ace/OS_NS_ctype.h" +#endif /* ACE_IS_SPLITTING */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_CapEntry + * + * @brief This class is the base class for all ACE Capabilities entry + * subclasses. + * + * This class is not instantiable and does not provide accessors + * or methods. If you want to add a new kind of attribute subclass + * this class and dynamic_cast to proper subclass. + */ +class ACE_Export ACE_CapEntry +{ +public: + + virtual ~ACE_CapEntry (void); + +protected: + + enum + { + ACE_INTCAP = 0, + ACE_STRINGCAP = 1, + ACE_BOOLCAP = 2 + }; + + ACE_CapEntry (int captype); + +protected: + + int captype_; + +}; + +/** + * @class ACE_IntCapEntry + * + * @brief This class implement the ACE Integer Capability subclass. + * + * This is a container class for ACE Capabilities integer container + * values. + */ +class ACE_Export ACE_IntCapEntry : public ACE_CapEntry +{ +public: + ACE_IntCapEntry (int val); + int getval (void) const; + +protected: + int val_; +}; + +/** + * @class ACE_StringCapEntry + * + * @brief This class implement the ACE String Capability subclass. + * + * This is a container class for ACE Capabilities String container + * values. + */ +class ACE_Export ACE_StringCapEntry : public ACE_CapEntry +{ +public: + ACE_StringCapEntry (const ACE_TString &val); + ACE_TString getval (void) const; + +protected: + ACE_TString val_; +}; + +/** + * @class ACE_BoolCapEntry + * + * @brief This class implement the ACE Bool Capability subclass. + * + * This is a container class for ACE Capabilities bool container + * values. + */ +class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry +{ +public: + ACE_BoolCapEntry (int val); + int getval (void) const; + +protected: + int val_; +}; + +/** + * @class ACE_Capabilities + * + * @brief This class implement the ACE Capabilities. + * + * This is a container class for ACE Capabilities + * values. Currently exist three different capability values: + * (integer), (bool) and + * (String). An ACE_Capabilities is a + * unordered set of pair = (, *). Where + * the first component is the name of capability and the second + * component is a pointer to the capability value container. A + * is a container for ACE_Capabilities, the + * ACE_Capabilities has a name in the file, as a termcap file. + */ +class ACE_Export ACE_Capabilities +{ +public: + + typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> CAPABILITIES_MAP; + + /// The Constructor + ACE_Capabilities (void); + + /// The Destructor + ~ACE_Capabilities(void); + +public: + + /// Get a string entry. + int getval (const ACE_TCHAR *ent, ACE_TString &val); + + /// Get an integer entry. + int getval (const ACE_TCHAR *ent, int &val); + + /// Get the ACE_Capabilities name from FILE fname and load the + /// associated capabitily entries in map. + int getent (const ACE_TCHAR *fname, const ACE_TCHAR *name); + +protected: + + /// Parse an integer property + const ACE_TCHAR *parse (const ACE_TCHAR *buf, int &cap); + + /// Parse a string property + const ACE_TCHAR *parse (const ACE_TCHAR *buf, ACE_TString &cap); + + /// Fill the ACE_Capabilities with description in ent. + int fillent(const ACE_TCHAR *ent); + + /// Parse a cap entry + int parseent (const ACE_TCHAR *name, ACE_TCHAR *line); + + /// Get a line from FILE input stream + int getline (FILE* fp, + ACE_TString &line); + + /// Is a valid entry + int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line); + + /// Reset the set of capabilities + void resetcaps (void); + +private: + + /// This is the set of ACE_CapEntry. + CAPABILITIES_MAP caps_; + +}; + +#if defined (ACE_IS_SPLITTING) +int +is_empty (const ACE_TCHAR *line) +{ + while (*line && ACE_OS::ace_isspace (*line)) + ++line; + + return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#'); +} + +int +is_line (const ACE_TCHAR *line) +{ + while (*line && ACE_OS::ace_isspace (*line)) + ++line; + + return *line != ACE_TEXT ('\0'); +} +#endif /* ACE_IS_SPLITTING */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Capabilities.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* __ACE_CAPABILITIES_H__ */ diff --git a/externals/ace/Capabilities.inl b/externals/ace/Capabilities.inl new file mode 100644 index 0000000..37284b2 --- /dev/null +++ b/externals/ace/Capabilities.inl @@ -0,0 +1,52 @@ +// -*- C++ -*- +// +// $Id: Capabilities.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_CapEntry::ACE_CapEntry (int captype) + : captype_ (captype) +{ +} + +ACE_INLINE +ACE_IntCapEntry::ACE_IntCapEntry (int val) + : ACE_CapEntry (ACE_INTCAP), + val_ (val) +{ +} + +ACE_INLINE int +ACE_IntCapEntry::getval (void) const +{ + return val_; +} + +ACE_INLINE +ACE_StringCapEntry::ACE_StringCapEntry (const ACE_TString &val) + : ACE_CapEntry (ACE_STRINGCAP), + val_ (val) +{ +} + +ACE_INLINE ACE_TString +ACE_StringCapEntry::getval (void) const +{ + return val_; +} + +ACE_INLINE +ACE_BoolCapEntry::ACE_BoolCapEntry (int val) + : ACE_CapEntry (ACE_BOOLCAP), + val_(val) +{ +} + +ACE_INLINE int +ACE_BoolCapEntry::getval (void) const +{ + return val_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Cleanup.cpp b/externals/ace/Cleanup.cpp new file mode 100644 index 0000000..5c7317e --- /dev/null +++ b/externals/ace/Cleanup.cpp @@ -0,0 +1,181 @@ +// $Id: Cleanup.cpp 84201 2009-01-20 06:26:02Z johnnyw $ + +#include "ace/Cleanup.h" + +ACE_RCSID (ace, + Cleanup, + "$Id: Cleanup.cpp 84201 2009-01-20 06:26:02Z johnnyw $") + +#if !defined (ACE_HAS_INLINED_OSCALLS) +# include "ace/Cleanup.inl" +#endif /* ACE_HAS_INLINED_OSCALLS */ + +#include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" +#include "ace/os_include/os_typeinfo.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +void +ACE_Cleanup::cleanup (void *) +{ + delete this; +} + +ACE_Cleanup::~ACE_Cleanup (void) +{ +} + +/*****************************************************************************/ + +extern "C" void +ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *object, void *param) +{ + object->cleanup (param); +} + +/*****************************************************************************/ + +ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void) + : object_ (0), + cleanup_hook_ (0), + param_ (0), + name_ (0) +{ +} + +ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param, + const char *name) + : object_ (object), + cleanup_hook_ (cleanup_hook), + param_ (param), + name_ (name ? ACE_OS::strdup (name) : 0) +{ +} + +ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void) +{ + if (this->name_) + ACE_OS::free ((void *) name_); +} + +bool +ACE_Cleanup_Info_Node::operator== (const ACE_Cleanup_Info_Node &o) const +{ + return o.object_ == this->object_ + && o.cleanup_hook_ == this->cleanup_hook_ + && o.param_ == this->param_; +} + +bool +ACE_Cleanup_Info_Node::operator!= (const ACE_Cleanup_Info_Node &o) const +{ + return !(*this == o); +} + + +/*****************************************************************************/ + +ACE_OS_Exit_Info::ACE_OS_Exit_Info (void) +{ +} + +ACE_OS_Exit_Info::~ACE_OS_Exit_Info (void) +{ +} + +int +ACE_OS_Exit_Info::at_exit_i (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param, + const char* name) +{ + // Return -1 and sets errno if unable to allocate storage. Enqueue + // at the head and dequeue from the head to get LIFO ordering. + ACE_Cleanup_Info_Node *new_node = 0; + + ACE_NEW_RETURN (new_node, + ACE_Cleanup_Info_Node (object, cleanup_hook, param, name), + -1); + + registered_objects_.push_front (new_node); + + return 0; +} + +bool +ACE_OS_Exit_Info::find (void *object) +{ + for (ACE_Cleanup_Info_Node *iter = registered_objects_.head (); + iter != 0; + iter = iter->next ()) + { + if (iter->object () == object) + { + // The object has already been registered. + return true; + } + } + + return false; +} + +bool +ACE_OS_Exit_Info::remove (void *object) +{ + ACE_Cleanup_Info_Node *node = 0; + for (ACE_Cleanup_Info_Node *iter = registered_objects_.head (); + iter != 0; + iter = iter->next ()) + { + if (iter->object () == object) + { + node = iter; + break; + } + } + + if (node) + { + registered_objects_.remove (node); + delete node; + return true; + } + + return false; +} + + +void +ACE_OS_Exit_Info::call_hooks (void) +{ + // Call all registered cleanup hooks, in reverse order of + // registration. + for (ACE_Cleanup_Info_Node *iter = registered_objects_.pop_front (); + iter != 0; + iter = registered_objects_.pop_front ()) + { + if (iter->cleanup_hook () == reinterpret_cast ( + ACE_CLEANUP_DESTROYER_NAME)) + { + // The object is an ACE_Cleanup. + ACE_CLEANUP_DESTROYER_NAME ( + reinterpret_cast (iter->object ()), + iter->param ()); + } + else if (iter->object () == &ace_exit_hook_marker) + { + // The hook is an ACE_EXIT_HOOK. + (* reinterpret_cast (iter->cleanup_hook ())) (); + } + else + { + (*iter->cleanup_hook ()) (iter->object (), iter->param ()); + } + delete iter; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Cleanup.h b/externals/ace/Cleanup.h new file mode 100644 index 0000000..bd75072 --- /dev/null +++ b/externals/ace/Cleanup.h @@ -0,0 +1,160 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Cleanup.h + * + * $Id: Cleanup.h 84163 2009-01-15 07:57:27Z johnnyw $ + * + * @author Douglas C. Schmidt + * @author Jesper S. M|ller + * @author and a cast of thousands... + * + * Originally in OS.h. + */ +//============================================================================= + +#ifndef ACE_CLEANUP_H +# define ACE_CLEANUP_H + +# include /**/ "ace/pre.h" + +# include "ace/config-lite.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/ACE_export.h" + +# include "ace/Intrusive_List.h" +# include "ace/Intrusive_List_Node.h" + +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# include "ace/Global_Macros.h" +# define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer) +#else +# define ACE_CLEANUP_DESTROYER_NAME ace_cleanup_destroyer +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Cleanup + * + * @brief Base class for objects that are cleaned by ACE_Object_Manager. + */ +class ACE_Export ACE_Cleanup +{ +public: + /// No-op constructor. + ACE_Cleanup (void); + + /// Destructor. + virtual ~ACE_Cleanup (void); + + /// Cleanup method that, by default, simply deletes itself. + virtual void cleanup (void *param = 0); +}; + +/// Adapter for cleanup, used by ACE_Object_Manager. +extern "C" ACE_Export +void ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *, void *param = 0); + +/** + * @class ACE_Cleanup_Info_Node + * + * @brief For maintaining a list of ACE_Cleanup_Info items. + * + * For internal use by ACE_Object_Manager. + */ +class ACE_Cleanup_Info_Node : public ACE_Intrusive_List_Node +{ +public: + ACE_Cleanup_Info_Node (void); + ACE_Cleanup_Info_Node (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param, + const char *name); + ~ACE_Cleanup_Info_Node (void); + + /// Equality operator. + bool operator== (const ACE_Cleanup_Info_Node &o) const; + + /// Inequality operator. + bool operator!= (const ACE_Cleanup_Info_Node &o) const; + + void* object(void); + + ACE_CLEANUP_FUNC cleanup_hook (void); + + void *param (void); +private: + /// Point to object that gets passed into the . + void *object_; + + /// Cleanup hook that gets called back. + ACE_CLEANUP_FUNC cleanup_hook_; + + /// Parameter passed to the . + void *param_; + + /// Name of the cleanup object + const char *name_; +}; + +typedef ACE_Intrusive_List ACE_Cleanup_Info_Node_List; + +/** + * @class ACE_OS_Exit_Info + * + * @brief Hold Object Manager cleanup (exit) information. + * + * @internal + * + * For internal use by the ACE library, only. + */ +class ACE_Export ACE_OS_Exit_Info +{ +public: + /// Default constructor. + ACE_OS_Exit_Info (void); + + /// Destructor. + ~ACE_OS_Exit_Info (void); + + /// Use to register a cleanup hook. + int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param, const char* name = 0); + + /// Look for a registered cleanup hook object. Returns true if already + /// registered, false if not. + bool find (void *object); + + /// Remove a registered cleanup hook object. Returns true if removed + /// false if not. + bool remove (void *object); + + /// Call all registered cleanup hooks, in reverse order of + /// registration. + void call_hooks (); + +private: + /** + * Keeps track of all registered objects. + */ + ACE_Cleanup_Info_Node_List registered_objects_; +}; + + +ACE_END_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_HAS_INLINED_OSCALLS) +# if defined (ACE_INLINE) +# undef ACE_INLINE +# endif /* ACE_INLINE */ +# define ACE_INLINE inline +# include "ace/Cleanup.inl" +# endif /* ACE_HAS_INLINED_OSCALLS */ + +# include /**/ "ace/post.h" +#endif /* ACE_CLEANUP_H */ diff --git a/externals/ace/Cleanup.inl b/externals/ace/Cleanup.inl new file mode 100644 index 0000000..196a9f4 --- /dev/null +++ b/externals/ace/Cleanup.inl @@ -0,0 +1,30 @@ +// -*- C++ -*- +// +// $Id: Cleanup.inl 83956 2008-12-03 07:57:38Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Cleanup::ACE_Cleanup (void) +{ +} + +ACE_INLINE void* +ACE_Cleanup_Info_Node::object(void) +{ + return this->object_; +} + +ACE_INLINE ACE_CLEANUP_FUNC +ACE_Cleanup_Info_Node::cleanup_hook (void) +{ + return this->cleanup_hook_; +} + +ACE_INLINE void * +ACE_Cleanup_Info_Node::param (void) +{ + return this->param_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Cleanup_Strategies_T.cpp b/externals/ace/Cleanup_Strategies_T.cpp new file mode 100644 index 0000000..3296599 --- /dev/null +++ b/externals/ace/Cleanup_Strategies_T.cpp @@ -0,0 +1,95 @@ +//$Id: Cleanup_Strategies_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_CLEANUP_STRATEGIES_T_CPP +#define ACE_CLEANUP_STRATEGIES_T_CPP + +#include "ace/Cleanup_Strategies_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +//////////////////////////////////////////////////////////////////////////// + +template +ACE_Cleanup_Strategy::~ACE_Cleanup_Strategy (void) +{ +} + +template int +ACE_Cleanup_Strategy::cleanup (CONTAINER &container, + KEY *key, + VALUE *) +{ + return container.unbind (*key); +} + +//////////////////////////////////////////////////////////////////////////// + +template int +ACE_Recyclable_Handler_Cleanup_Strategy::cleanup ( + CONTAINER &container, + KEY *key, + VALUE *) +{ + VALUE value; + + if (container.unbind (*key, value) == -1) + return -1; + + value.first ()->recycler (0, 0); + + value.first ()->close (); + + return 0; +} + +///////////////////////////////////////////////////////////////////////////// + +template int +ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy::cleanup ( + CONTAINER &, + KEY *, + VALUE *value) +{ + return value->first ()->handle_close_i (); +} + +//////////////////////////////////////////////////////////////////////////// + +template int +ACE_Handler_Cleanup_Strategy::cleanup ( + CONTAINER &container, + KEY *key, + VALUE *value) +{ + // Remove the item from cache only if the handler isnt in use. + if ((*value)->active () == 0) + { + (*value)->close (); + + if (container.unbind (*key) == -1) + return -1; + + } + + return 0; +} + +//////////////////////////////////////////////////////////////////////////// + +template int +ACE_Null_Cleanup_Strategy::cleanup (CONTAINER &, + KEY *, + VALUE *) +{ + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CLEANUP_STRATEGIES_T_CPP */ diff --git a/externals/ace/Cleanup_Strategies_T.h b/externals/ace/Cleanup_Strategies_T.h new file mode 100644 index 0000000..ca51b47 --- /dev/null +++ b/externals/ace/Cleanup_Strategies_T.h @@ -0,0 +1,149 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Cleanup_Strategies_T.h + * + * $Id: Cleanup_Strategies_T.h 81388 2008-04-23 14:02:05Z johnnyw $ + * + * @author Kirthika Parameswaran + */ +//============================================================================= + + +#ifndef CLEANUP_STRATEGIES_H +#define CLEANUP_STRATEGIES_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// For linkers that cant grok long names. +#define ACE_Cleanup_Strategy ACLE + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Cleanup_Strategy + * + * @brief Defines a default strategy to be followed for cleaning up + * entries from a map which is the container. + * + * By default the entry to be cleaned up is removed from the + * container. + */ +template +class ACE_Cleanup_Strategy +{ + +public: + + /// Destructor. + virtual ~ACE_Cleanup_Strategy (void); + + /// The method which will do the cleanup of the entry in the container. + virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); +}; + +////////////////////////////////////////////////////////////////////// +#define ACE_Recyclable_Handler_Cleanup_Strategy ARHCLE + +/** + * @class ACE_Recyclable_Handler_Cleanup_Strategy + * + * @brief Defines a strategy to be followed for cleaning up + * entries which are svc_handlers from a container. + * + * The entry to be cleaned up is removed from the container. + * Here, since we are dealing with svc_handlers specifically, we + * perform a couple of extra operations. @note To be used when + * the handler is recyclable. + */ +template +class ACE_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy +{ + +public: + + /// The method which will do the cleanup of the entry in the container. + virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); +}; + +////////////////////////////////////////////////////////////////////// +#define ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy ARRHCLE + +/** + * @class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy + * + * @brief Defines a strategy to be followed for cleaning up + * entries which are svc_handlers from a container. + * + * The entry to be cleaned up is removed from the container. + * Here, since we are dealing with recyclable svc_handlers with + * addresses which are refcountable specifically, we perform a + * couple of extra operations and do so without any locking. + */ +template +class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy +{ +public: + /// The method which will do the cleanup of the entry in the container. + virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); +}; + +////////////////////////////////////////////////////////////////////// + +/** + * @class ACE_Handler_Cleanup_Strategy + * + * @brief Defines a strategy to be followed for cleaning up + * entries which are svc_handlers from a container. + * + * The entry to be cleaned up is removed from the container. + * Here, since we are dealing with svc_handlers specifically, we + * perform a couple of extra operations. @note This cleanup strategy + * should be used in the case when the handler has the caching + * attributes. + */ +template +class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy +{ +public: + /// The method which will do the cleanup of the entry in the container. + virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); +}; + +////////////////////////////////////////////////////////////////////// +#define ACE_Null_Cleanup_Strategy ANCLE + +/** + * @class ACE_Null_Cleanup_Strategy + * + * @brief Defines a do-nothing implementation of the cleanup strategy. + * + * This class simply does nothing at all! Can be used to nullify + * the effect of the Cleanup Strategy. + */ +template +class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy +{ +public: + /// The dummy cleanup method. + virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Cleanup_Strategies_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Cleanup_Strategies_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* CLEANUP_STRATEGIES_H */ diff --git a/externals/ace/Codecs.cpp b/externals/ace/Codecs.cpp new file mode 100644 index 0000000..71491fe --- /dev/null +++ b/externals/ace/Codecs.cpp @@ -0,0 +1,234 @@ +#include "ace/Codecs.h" +#include "ace/Log_Msg.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_ctype.h" + +ACE_RCSID (ace, + Codecs, + "$Id: Codecs.cpp 80826 2008-03-04 14:51:23Z wotte $") + +namespace +{ + // Just in case ... +#undef alphabet +#undef pad +#undef max_columns + + // Symbols which form the Base64 alphabet (Defined as per RFC 2045) + ACE_Byte const alphabet[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + // The padding character used in the encoding + ACE_Byte const pad = '='; + + // Number of columns per line of encoded output (Can have a maximum + // value of 76). + int const max_columns = 72; +} + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +bool ACE_Base64::init_ = false; + +ACE_Byte ACE_Base64::decoder_[256]; + +ACE_Byte ACE_Base64::member_[256]; + +ACE_Byte* +ACE_Base64::encode (const ACE_Byte* input, + const size_t input_len, + size_t* output_len, + bool is_chunked) +{ + if (!ACE_Base64::init_) + ACE_Base64::init(); + + if (!input) + return 0; + + ACE_Byte* result = 0; + + size_t length = ((input_len + 2) / 3) * 4; + size_t num_lines = length / max_columns + 1; + length += num_lines + 1; + ACE_NEW_RETURN (result, ACE_Byte[length], 0); + + int char_count = 0; + int bits = 0; + size_t pos = 0; + int cols = 0; + + for (size_t i = 0; i < input_len; ++i) + { + bits += input[i]; + ++char_count; + + if (char_count == 3) + { + result[pos++] = alphabet[bits >> 18]; + result[pos++] = alphabet[(bits >> 12) & 0x3f]; + result[pos++] = alphabet[(bits >> 6) & 0x3f]; + result[pos++] = alphabet[bits & 0x3f]; + cols += 4; + if (cols == max_columns) { + if (is_chunked) + result[pos++] = '\n'; + cols = 0; + } + bits = 0; + char_count = 0; + } + else + { + bits <<= 8; + } + } + + if (char_count != 0) + { + bits <<= (16 - (8 * char_count)); + result[pos++] = alphabet[bits >> 18]; + result[pos++] = alphabet[(bits >> 12) & 0x3f]; + cols += 2; + if (char_count == 1) + { + result[pos++] = pad; + result[pos++] = pad; + cols += 2; + } + else + { + result[pos++] = alphabet[(bits >> 6) & 0x3f]; + result[pos++] = pad; + cols += 2; + } + } + + if (cols > 0 && is_chunked) + result[pos++] = '\n'; + + result[pos] = 0; + *output_len = pos; + return result; +} + +size_t +ACE_Base64::length (const ACE_Byte* input) +{ + if (!ACE_Base64::init_) + ACE_Base64::init(); + + ACE_Byte* ptr = const_cast (input); + while (*ptr != 0 && + (member_[*(ptr)] == 1 || *ptr == pad + || ACE_OS::ace_isspace (*ptr))) + ++ptr; + size_t len = ptr - input; + len = ((len + 3) / 4) * 3 + 1 ; + return len; +} + +ACE_Byte* +ACE_Base64::decode (const ACE_Byte* input, size_t* output_len) +{ + if (!ACE_Base64::init_) + ACE_Base64::init(); + + if (!input) + return 0; + + size_t result_len = ACE_Base64::length (input); + ACE_Byte* result = 0; + ACE_NEW_RETURN (result, ACE_Byte[result_len], 0); + + ACE_Byte* ptr = const_cast (input); + while (*ptr != 0 && + (member_[*(ptr)] == 1 || *ptr == pad + || ACE_OS::ace_isspace (*ptr))) + ++ptr; + size_t input_len = ptr - input; + + int char_count = 0; + int bits = 0; + size_t pos = 0; + + size_t i = 0; + for (; i < input_len; ++i) + { + if (input[i] == pad) + break; + if (!ACE_Base64::member_[input[i]]) + continue; + bits += decoder_[input[i]]; + ++char_count; + + if (char_count == 4) + { + result[pos++] = static_cast (bits >> 16); + result[pos++] = static_cast ((bits >> 8) & 0xff); + result[pos++] = static_cast (bits & 0xff); + bits = 0; + char_count = 0; + } + else + { + bits <<= 6; + } + } + + int errors = 0; + if ( i == input_len) + { + if (char_count) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Decoding incomplete: atleast %d bits truncated\n"), + (4 - char_count) * 6)); + ++errors; + } + } + else + { + switch (char_count) + { + case 1: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Decoding incomplete: atleast 2 bits missing\n"))); + ++errors; + break; + case 2: + result[pos++] = static_cast (bits >> 10); + break; + case 3: + result[pos++] = static_cast (bits >> 16); + result[pos++] = static_cast ((bits >> 8) & 0xff); + break; + } + } + + if (errors) + { + delete[] result; + return 0; + } + result[pos] = 0; + *output_len = pos; + return result; +} + +void +ACE_Base64::init () +{ + if (!ACE_Base64::init_) + { + for (ACE_Byte i = 0; i < sizeof (alphabet); ++i) + { + ACE_Base64::decoder_[alphabet[i]] = i; + ACE_Base64::member_ [alphabet[i]] = 1; + } + ACE_Base64::init_ = true; + } + return; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Codecs.h b/externals/ace/Codecs.h new file mode 100644 index 0000000..2c4227d --- /dev/null +++ b/externals/ace/Codecs.h @@ -0,0 +1,121 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Codecs.h + * + * $Id: Codecs.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Krishnakumar B + * + * Codecs is a generic wrapper for various encoding and decoding + * mechanisms. Currently it includes Base64 content transfer-encoding as + * specified by RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part + * One: Format of Internet Message Bodies. + * + */ +//============================================================================= + +#ifndef ACE_CODECS_H +#define ACE_CODECS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Basic_Types.h" +#include "ace/Global_Macros.h" + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Base64 + * + * @brief Encode/Decode a stream of bytes according to Base64 encoding. + * + * This class provides methods to encode or decode a stream of bytes + * to/from Base64 encoding. It doesn't convert the input stream to a + * canonical form before encoding. + * + */ +class ACE_Export ACE_Base64 +{ +public: + + //@{ + + /** + * Encodes a stream of bytes to Base64 data + * + * @param input Binary data in byte stream. + * @param input_len Length of the byte stream. + * @param output_len Length of the encoded Base64 byte stream. + * @param is_chunked If true, terminate 72 character blocks with newline + * @return Encoded Base64 data in byte stream or NULL if input data cannot + * be encoded. + */ + + static ACE_Byte* encode (const ACE_Byte* input, + const size_t input_len, + size_t* output_len, + bool is_chunked = true); + /** + * Decodes a stream of Base64 to bytes data + * + * @param input Encoded Base64 data in byte stream. + * @param output_len Length of the binary byte stream. + * @return Binary data in byte stream or NULL if input data cannot + * be encoded. + */ + static ACE_Byte* decode (const ACE_Byte* input, + size_t* output_len); + + /** + * Return the length of the encoded input data + * + * @param input Encoded Base64 data in byte stream. + * @return Length of the encoded Base64 data. + * + */ + static size_t length (const ACE_Byte* input); + + //@} + +protected: + + // Prevent default construction. + ACE_Base64 (void) {} + +private: + + // Preventing copying and assignment. + ACE_Base64 (ACE_Base64 const &); + ACE_Base64 & operator= (ACE_Base64 const &); + + /// Initialize the tables for encoding/decoding. + static void init (void); + +private: + + /// Alphabet used for decoding i.e decoder_[alphabet_[i = 0..63]] = i + static ACE_Byte decoder_[]; + + /// Alphabet used to check valid range of encoded input i.e + /// member_[alphabet_[0..63]] = 1 + static ACE_Byte member_[]; + + /// Boolean to denote whether initialization is complete + static bool init_; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_CODECS_H */ diff --git a/externals/ace/Codeset_IBM1047.cpp b/externals/ace/Codeset_IBM1047.cpp new file mode 100644 index 0000000..91582cf --- /dev/null +++ b/externals/ace/Codeset_IBM1047.cpp @@ -0,0 +1,309 @@ + +//============================================================================= +/** + * @file Codeset_IBM1047.cpp + * + * $Id: Codeset_IBM1047.cpp 81661 2008-05-09 12:05:34Z johnnyw $ + * + * Defines the arrays required to convert between ISO8859 (aka + * Latin/1) and IBM1047 (aka EBCDIC). + * + * + * @author Jim Rogers (jrogers@viasoft.com) + */ +//============================================================================= + + +#include "ace/Codeset_IBM1047.h" + +#if defined (ACE_HAS_EBCDIC) + +ACE_RCSID (ace, + Codeset_IBM1047, + "$Id: Codeset_IBM1047.cpp 81661 2008-05-09 12:05:34Z johnnyw $") + +#include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" + +namespace +{ + char const to_IBM1047[] = + { + "\x00\x01\x02\x03\x37\x2D\x2E\x2F\x16\x05\x25\x0B\x0C\x0D\x0E\x0F" // 00-0F + "\x10\x11\x12\x13\x3C\x3D\x32\x26\x18\x19\x3F\x27\x22\x1D\x35\x1F" // 10-1F + "\x40\x5A\x7F\x7B\x5B\x6C\x50\x7D\x4D\x5D\x5C\x4E\x6B\x60\x4B\x61" // 20-2F + "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\x7A\x5E\x4C\x7E\x6E\x6F" // 30-3F + "\x7C\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xD1\xD2\xD3\xD4\xD5\xD6" // 40-4F + "\xD7\xD8\xD9\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xAD\xE0\xBD\x5F\x6D" // 50-5F + "\x79\x81\x82\x83\x84\x85\x86\x87\x88\x89\x91\x92\x93\x94\x95\x96" // 60-6F + "\x97\x98\x99\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xC0\x4F\xD0\xA1\x07" // 70-7F + "\x43\x20\x21\x1C\x23\xEB\x24\x9B\x71\x28\x38\x49\x90\xBA\xEC\xDF" // 80-8F + "\x45\x29\x2A\x9D\x72\x2B\x8A\x9A\x67\x56\x64\x4A\x53\x68\x59\x46" // 90-9F + "\xEA\xDA\x2C\xDE\x8B\x55\x41\xFE\x58\x51\x52\x48\x69\xDB\x8E\x8D" // A0-AF + "\x73\x74\x75\xFA\x15\xB0\xB1\xB3\xB4\xB5\x6A\xB7\xB8\xB9\xCC\xBC" // B0-BF + "\xAB\x3E\x3B\x0A\xBF\x8F\x3A\x14\xA0\x17\xCB\xCA\x1A\x1B\x9C\x04" // C0-CF + "\x34\xEF\x1E\x06\x08\x09\x77\x70\xBE\xBB\xAC\x54\x63\x65\x66\x62" // D0-DF + "\x30\x42\x47\x57\xEE\x33\xB6\xE1\xCD\xED\x36\x44\xCE\xCF\x31\xAA" // E0-EF + "\xFC\x9E\xAE\x8C\xDD\xDC\x39\xFB\x80\xAF\xFD\x78\x76\xB2\x9F\xFF" // F0-FF +}; + + char const from_IBM1047[] = + { + "\x00\x01\x02\x03\xCF\x09\xD3\x7F\xD4\xD5\xC3\x0B\x0C\x0D\x0E\x0F" // 00-0F + "\x10\x11\x12\x13\xC7\xB4\x08\xC9\x18\x19\xCC\xCD\x83\x1D\xD2\x1F" // 10-1F + "\x81\x82\x1C\x84\x86\x0A\x17\x1B\x89\x91\x92\x95\xA2\x05\x06\x07" // 20-2F + "\x20\xEE\x16\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xC1\x1A" // 30-3F + "\x20\xA6\xE1\x80\xEB\x90\x9F\xE2\xAB\x8B\x9B\x2E\x3C\x28\x2B\x7C" // 40-4F + "\x26\xA9\xAA\x9C\xDB\xA5\x99\xE3\xA8\x9E\x21\x24\x2A\x29\x3B\x5E" // 50-5F + "\x2D\x2F\xDF\xDC\x9A\xDD\xDE\x98\x9D\xAC\xBA\x2C\x25\x5F\x3E\x3F" // 60-6F + "\xD7\x88\x94\xB0\xB1\xB2\xFC\xD6\xFB\x60\x3A\x23\x40\x27\x3D\x22" // 70-7F + "\xF8\x61\x62\x63\x64\x65\x66\x67\x68\x69\x96\xA4\xF3\xAF\xAE\xC5" // 80-8F + "\x8C\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x97\x87\xCE\x93\xF1\xFE" // 90-9F + "\xC8\x7E\x73\x74\x75\x76\x77\x78\x79\x7A\xEF\xC0\xDA\x5B\xF2\xF9" // A0-AF + "\xB5\xB6\xFD\xB7\xB8\xB9\xE6\xBB\xBC\xBD\x8D\xD9\xBF\x5D\xD8\xC4" // B0-BF + "\x7B\x41\x42\x43\x44\x45\x46\x47\x48\x49\xCB\xCA\xBE\xE8\xEC\xED" // C0-CF + "\x7D\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\xA1\xAD\xF5\xF4\xA3\x8F" // D0-DF + "\x5C\xE7\x53\x54\x55\x56\x57\x58\x59\x5A\xA0\x85\x8E\xE9\xE4\xD1" // E0-EF + "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\xB3\xF7\xF0\xFA\xA7\xFF" // F0-FF + }; +} + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_IBM1047_ISO8859::ACE_IBM1047_ISO8859 (void) +{ +} + +ACE_IBM1047_ISO8859::~ACE_IBM1047_ISO8859 (void) +{ +} + +ACE_CDR::ULong +ACE_IBM1047_ISO8859::ncs () +{ + return 0x10020417; +} + +ACE_CDR::ULong +ACE_IBM1047_ISO8859::tcs () +{ + return 0x00010001; +} + +ACE_CDR::Boolean +ACE_IBM1047_ISO8859::read_char (ACE_InputCDR &in, + ACE_CDR::Char &x) +{ + if (this->read_1 (in, reinterpret_cast (&x))) + { + x = to_IBM1047[x]; + return 1; + } + return 0; +} + +ACE_CDR::Boolean +ACE_IBM1047_ISO8859::read_string (ACE_InputCDR& in, + ACE_CDR::Char *& x) +{ + ACE_CDR::ULong len; + + in.read_ulong (len); + + if (len > 0) + { + ACE_NEW_RETURN (x, + ACE_CDR::Char[len], + 0); + + if (this->read_char_array (in, x, len)) + return 1; + + delete [] x; + } + + x = 0; + return 0; +} + +ACE_CDR::Boolean +ACE_IBM1047_ISO8859::read_char_array (ACE_InputCDR& in, + ACE_CDR::Char* x, + ACE_CDR::ULong len) +{ + if (this->read_array (in, + x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + len)) + { + for (ACE_CDR::ULong i = 0; i != len; ++i) + x[i] = to_IBM1047[x[i]]; + + return 1; + } + + return 0; +} + +ACE_CDR::Boolean +ACE_IBM1047_ISO8859::write_char (ACE_OutputCDR& out, + ACE_CDR::Char x) +{ + return + this->write_1 (out, + reinterpret_cast (&from_IBM1047[x])); +} + +ACE_CDR::Boolean +ACE_IBM1047_ISO8859::write_string (ACE_OutputCDR& out, + ACE_CDR::ULong len, + const ACE_CDR::Char* x) +{ + if (out.write_ulong (len + 1)) + return this->write_char_array (out, x, len + 1); + return 0; +} + +ACE_CDR::Boolean +ACE_IBM1047_ISO8859::write_char_array (ACE_OutputCDR& out, + const ACE_CDR::Char* x, + ACE_CDR::ULong len) +{ + char *buf = 0; + if (this->adjust (out, len, 1, buf) == 0) + { + ACE_OS::memcpy (buf, x, len); + + for (ACE_CDR::ULong i = 0; i != len; ++i) + buf[i] = from_IBM1047[buf[i]]; + + return 1; + } + + this->good_bit(out, 0); + return 0; +} + +// **************************************************************** + +ACE_ISO8859_IBM1047::ACE_ISO8859_IBM1047 (void) +{ +} + +ACE_ISO8859_IBM1047::~ACE_ISO8859_IBM1047 (void) +{ +} + +ACE_CDR::ULong +ACE_ISO8859_IBM1047::ncs () +{ + return 0x00010001; +} + +ACE_CDR::ULong +ACE_ISO8859_IBM1047::tcs () +{ + return 0x10020417; +} + +ACE_CDR::Boolean +ACE_ISO8859_IBM1047::read_char (ACE_InputCDR& in, + ACE_CDR::Char& x) +{ + if (this->read_1 (in, reinterpret_cast (&x))) + { + x = from_IBM1047[x]; + return 1; + } + return 0; +} + +ACE_CDR::Boolean +ACE_ISO8859_IBM1047::read_string (ACE_InputCDR &in, + ACE_CDR::Char *&x) +{ + ACE_CDR::ULong len; + + in.read_ulong (len); + + if (len > 0) + { + ACE_NEW_RETURN (x, + ACE_CDR::Char[len], + 0); + + if (this->read_char_array (in, x, len)) + return 1; + + delete [] x; + } + + x = 0; + return 0; +} + +ACE_CDR::Boolean +ACE_ISO8859_IBM1047::read_char_array (ACE_InputCDR &in, + ACE_CDR::Char *x, + ACE_CDR::ULong len) +{ + if (this->read_array (in, + x, + ACE_CDR::OCTET_SIZE, + ACE_CDR::OCTET_ALIGN, + len)) + { + for (ACE_CDR::ULong i = 0; i != len; ++i) + x[i] = from_IBM1047[x[i]]; + + return 1; + } + + return 0; +} + +ACE_CDR::Boolean +ACE_ISO8859_IBM1047::write_char (ACE_OutputCDR &out, + ACE_CDR::Char x) +{ + return + this->write_1 (out, + reinterpret_cast (&to_IBM1047[x])); +} + +ACE_CDR::Boolean +ACE_ISO8859_IBM1047::write_string (ACE_OutputCDR& out, + ACE_CDR::ULong len, + const ACE_CDR::Char* x) +{ + if (out.write_ulong (len + 1)) + return this->write_char_array (out, x, len + 1); + else + return 0; +} + +ACE_CDR::Boolean +ACE_ISO8859_IBM1047::write_char_array (ACE_OutputCDR &out, + const ACE_CDR::Char *x, + ACE_CDR::ULong len) +{ + char *buf = 0; + + if (this->adjust (out, len, 1, buf) == 0) + { + ACE_OS::memcpy (buf, x, len); + + for (ACE_CDR::ULong i = 0; i != len; ++i) + buf[i] = to_IBM1047[buf[i]]; + + return 1; + } + + this->good_bit (out, 0); + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_EBCDIC */ diff --git a/externals/ace/Codeset_IBM1047.h b/externals/ace/Codeset_IBM1047.h new file mode 100644 index 0000000..3caa888 --- /dev/null +++ b/externals/ace/Codeset_IBM1047.h @@ -0,0 +1,127 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Codeset_IBM1047.h + * + * $Id: Codeset_IBM1047.h 81388 2008-04-23 14:02:05Z johnnyw $ + * + * Declares the arrays required to convert between ISO8859 (aka + * Latin/1) and IBM1047 (aka EBCDIC). + * + * @author Jim Rogers (jrogers@viasoft.com) + */ +//============================================================================= + + +#ifndef ACE_CODESET_IMB1047_H +#define ACE_CODESET_IMB1047_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_EBCDIC) + +#include "ace/CDR_Stream.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// **************************************************************** + +/** + * @class ACE_IBM1047_ISO8859 + * + * @brief Codeset translation specialization. + * + * This class performs the codeset translation: + * - Native: IBM_1047 (i.e. EBCDIC) + * - Stream: ISO-8859 (i.e. Latin/1) + */ +class ACE_Export ACE_IBM1047_ISO8859 : public ACE_Char_Codeset_Translator +{ +public: + /// A do nothing constructor. + ACE_IBM1047_ISO8859 (void); + + /// Virtual destruction + virtual ~ACE_IBM1047_ISO8859 (void); + + // = Documented in $ACE_ROOT/ace/CDR_Stream.h + virtual ACE_CDR::Boolean read_char (ACE_InputCDR &, + ACE_CDR::Char &); + virtual ACE_CDR::Boolean read_string (ACE_InputCDR &, + ACE_CDR::Char *&); + virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &, + ACE_CDR::Char *, + ACE_CDR::ULong); + virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &, + ACE_CDR::Char); + virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &, + ACE_CDR::ULong, + const ACE_CDR::Char *); + virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, + const ACE_CDR::Char *, + ACE_CDR::ULong); + + /// Return the native codeset ID as defined in the OSF code and character + /// set registry, 0x10020417 + virtual ACE_CDR::ULong ncs (); + /// Return the translated codeset ID as defined in the OSF code and character + /// set registry, 0x00010001 + virtual ACE_CDR::ULong tcs (); +}; + +/** + * @class ACE_ISO8859_IBM1047 + * + * @brief Codeset translation specialization. + * + * This class performs the codeset translation: + * - Native: ISO-8859 (i.e. Latin/1) + * - Stream: IBM-1047 (i.e. EBCDIC) + */ +class ACE_Export ACE_ISO8859_IBM1047 : public ACE_Char_Codeset_Translator +{ +public: + /// A do nothing constructor. + ACE_ISO8859_IBM1047 (void); + + /// Virtual destruction + virtual ~ACE_ISO8859_IBM1047 (void); + + // = Documented in $ACE_ROOT/ace/CDR_Stream.h + virtual ACE_CDR::Boolean read_char (ACE_InputCDR &, + ACE_CDR::Char &); + virtual ACE_CDR::Boolean read_string (ACE_InputCDR &, + ACE_CDR::Char *&); + virtual ACE_CDR::Boolean read_char_array (ACE_InputCDR &, + ACE_CDR::Char *, + ACE_CDR::ULong); + virtual ACE_CDR::Boolean write_char (ACE_OutputCDR &, + ACE_CDR::Char); + virtual ACE_CDR::Boolean write_string (ACE_OutputCDR &, + ACE_CDR::ULong, + const ACE_CDR::Char *); + virtual ACE_CDR::Boolean write_char_array (ACE_OutputCDR &, + const ACE_CDR::Char *, + ACE_CDR::ULong); + + /// Return the native codeset ID as defined in the OSF code and character + /// set registry, 0x00010001 + virtual ACE_CDR::ULong ncs (); + /// Return the translated codeset ID as defined in the OSF code and character + /// set registry, 0x10020417 + virtual ACE_CDR::ULong tcs (); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_EBCDIC */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CODESET_IMB1047_H */ diff --git a/externals/ace/Codeset_Registry.cpp b/externals/ace/Codeset_Registry.cpp new file mode 100644 index 0000000..c23ef37 --- /dev/null +++ b/externals/ace/Codeset_Registry.cpp @@ -0,0 +1,111 @@ +//============================================================================= +/** + * @file Codeset_Registry.cpp + * + * $Id: Codeset_Registry.cpp 80826 2008-03-04 14:51:23Z wotte $ + * + * emulated codset regstry functions + * + * + * @author Phil Mesnier + */ +//============================================================================= + +#include "ace/Codeset_Registry.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" + +// $Id: Codeset_Registry.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#if !defined (__ACE_INLINE__) +#include "ace/Codeset_Registry.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (ace, + Codeset_Registry, + "$Id: Codeset_Registry.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +int +ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale, + ACE_CDR::ULong &codeset_id, + ACE_CDR::UShort *num_sets, + ACE_CDR::UShort **char_sets) +{ + registry_entry const *element = 0; + for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) + if (ACE_OS::strcmp (registry_db_[i].loc_name_, locale.c_str ()) == 0) + element = ®istry_db_[i]; + if (element == 0) + return 0; + codeset_id = element->codeset_id_; + if (num_sets != 0) + *num_sets = element->num_sets_; + if (char_sets != 0) + { + ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); + ACE_OS::memcpy (*char_sets, element->char_sets_, + element->num_sets_ * sizeof (ACE_CDR::UShort)); + } + return 1; +} + +int +ACE_Codeset_Registry::registry_to_locale_i (ACE_CDR::ULong codeset_id, + ACE_CString &locale, + ACE_CDR::UShort *num_sets, + ACE_CDR::UShort **char_sets) +{ + registry_entry const *element = 0; + for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) + if (codeset_id == registry_db_[i].codeset_id_) + element = ®istry_db_[i]; + if (element == 0) + return 0; + locale.set (element->loc_name_); + if (num_sets != 0) + *num_sets = element->num_sets_; + if (char_sets != 0) + { + ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); + ACE_OS::memcpy (*char_sets, element->char_sets_, + element->num_sets_ * sizeof (ACE_CDR::UShort)); + } + return 1; +} + +int +ACE_Codeset_Registry::is_compatible_i (ACE_CDR::ULong codeset_id, + ACE_CDR::ULong other) +{ + registry_entry const *lhs = 0; + registry_entry const *rhs = 0; + for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++) + { + if (codeset_id == registry_db_[i].codeset_id_) + lhs = ®istry_db_[i]; + if (other == registry_db_[i].codeset_id_) + rhs = ®istry_db_[i]; + } + + if (lhs == 0 || rhs == 0) + return 0; + + for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++) + for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++) + if (rhs->char_sets_[r] == lhs->char_sets_[l]) + return 1; + return 0; +} + +ACE_CDR::Short +ACE_Codeset_Registry::get_max_bytes_i (ACE_CDR::ULong codeset_id) +{ + for (size_t i = 0; i < num_registry_entries_; i++) + if (codeset_id == registry_db_[i].codeset_id_) + return registry_db_[i].max_bytes_; + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Codeset_Registry.h b/externals/ace/Codeset_Registry.h new file mode 100644 index 0000000..e72c435 --- /dev/null +++ b/externals/ace/Codeset_Registry.h @@ -0,0 +1,104 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Codeset_Registry.h + * + * $Id: Codeset_Registry.h 81348 2008-04-14 09:00:32Z johnnyw $ + * + * ACE wrapper around access functions for the OSF's DCE codeset registry + * access functions + * + * For environments that intrinsicly support the DCE defined access functions, + * the methods in this class are simply wrappers. On other platforms, emulation + * is provided. The motivation for this class is to support interoperability + * via translators and the CDR streams, primarily in TAO, but this capability + * is not restricted to CORBA. + * + * The emulated functionality supports Open Group RFC #40, currently RFC 40.2, + * www.opengroup.org/tech/rfc/rfc40.2.html + * + * @author Phil Mesnier + */ +//============================================================================= + +#ifndef ACE_CODESET_REGISTRY_H +#define ACE_CODESET_REGISTRY_H + +#include /**/ "ace/pre.h" +#include "ace/SString.h" +#include "ace/CDR_Base.h" +#include "ace/Codeset_Symbols.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_DCE_CODESET_REGISTRY) +#include /**/ +#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Export ACE_Codeset_Registry +{ +public: + + /// Based on a locale string, find the registry value and optional codeset + /// collection. This wraps the dce_cs_loc_to_rgy function, or emulates it. + static int locale_to_registry (const ACE_CString &locale, + ACE_CDR::ULong &codeset_id, + ACE_CDR::UShort * = 0, + ACE_CDR::UShort ** = 0); + + /// Based on a registry value, find the locale string and optional codeset + /// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. + static int registry_to_locale (ACE_CDR::ULong codeset_id, + ACE_CString &locale, + ACE_CDR::UShort * = 0, + ACE_CDR::UShort ** = 0); + + /// Tell if two codesets are compatible. This wraps the + /// rpc_cs_char_set_compat_check function. + static int is_compatible (ACE_CDR::ULong codeset_id, + ACE_CDR::ULong other); + + /// Return the max number of bytes required to represent a single character. + /// This wraps the rpc_rgy_get_max_bytes function. + static ACE_CDR::Short get_max_bytes (ACE_CDR::ULong codeset_id); + + enum {max_charsets_ = 5}; +protected: + typedef struct { + const char * desc_; + const char * loc_name_; + ACE_CDR::ULong codeset_id_; + ACE_CDR::UShort num_sets_; + ACE_CDR::UShort char_sets_[max_charsets_]; + ACE_CDR::UShort max_bytes_; + } registry_entry; + +private: + static size_t const num_registry_entries_; + static registry_entry const registry_db_[]; + + static int locale_to_registry_i (const ACE_CString &locale, + ACE_CDR::ULong &codeset_id, + ACE_CDR::UShort * = 0, + ACE_CDR::UShort ** = 0); + static int registry_to_locale_i (ACE_CDR::ULong codeset_id, + ACE_CString &locale, + ACE_CDR::UShort * = 0, + ACE_CDR::UShort ** = 0); + static int is_compatible_i (ACE_CDR::ULong codeset_id, + ACE_CDR::ULong other); + static ACE_CDR::Short get_max_bytes_i (ACE_CDR::ULong codeset_id); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Codeset_Registry.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_CODESET_REGISTRY_H */ diff --git a/externals/ace/Codeset_Registry.inl b/externals/ace/Codeset_Registry.inl new file mode 100644 index 0000000..4419cf5 --- /dev/null +++ b/externals/ace/Codeset_Registry.inl @@ -0,0 +1,102 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Codeset_Registry.inl + * + * $Id: Codeset_Registry.inl 80826 2008-03-04 14:51:23Z wotte $ + * + * ACE wrapper around access functions for the OSF's DCE codeset registry + * access functions - the inline functions either call the system supplied + * DCE based codeset regsitry function, or calls the emulation + * + * + * @author Phil Mesnier + */ +//============================================================================= + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +int +ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale, + ACE_CDR::ULong &codeset_id, + ACE_CDR::UShort *num_sets, + ACE_CDR::UShort **char_sets) +{ +#if defined (ACE_HAS_DCE_CODESET_REGISTRY) + error_status_t result; + dce_cs_loc_to_rgy (locale.c_str(), + &codeset_id, + num_sets, + char_sets, + &result); + return (result == dce_cs_c_ok) ? 1 : 0; +#else + return ACE_Codeset_Registry::locale_to_registry_i (locale, + codeset_id, + num_sets, + char_sets); +#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ +} + +// based on a registry value, find the locale string and optional codeset +// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. +ACE_INLINE +int +ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id, + ACE_CString &locale, + ACE_CDR::UShort *num_sets, + ACE_CDR::UShort **char_sets) +{ +#if defined (ACE_HAS_DCE_CODESET_REGISTRY) + error_status_t result; + char *buffer; + dce_cs_rgy_to_loc (codeset_id, + &buffer, + num_sets, + char_sets, + &result); + locale.set(buffer); // does a copy :-( + free (buffer); + return (result == dce_cs_c_ok) ? 1 : 0; +#else + return ACE_Codeset_Registry::registry_to_locale_i (codeset_id, + locale, + num_sets, + char_sets); +#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ +} + +// Tell if two codesets are compatible. This wraps the +// rpc_cs_char_set_compat_check function. +ACE_INLINE +int +ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id, + ACE_CDR::ULong other) +{ +#if defined (ACE_HAS_DCE_CODESET_REGISTRY) + error_status_t result; + rpc_cs_char_set_compat_check(codeset_id,other,&result); + return (result == rpc_s_ok) ? 1 : 0; +#else + return ACE_Codeset_Registry::is_compatible_i (codeset_id,other); +#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ +} + +// Return the max number of bytes required to represent a single character. +// This wraps the rpc_rgy_get_max_bytes function. +ACE_INLINE +ACE_CDR::Short +ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id) +{ +#if defined (ACE_HAS_DCE_CODESET_REGISTRY) + error_status_t result; + short max_bytes; + rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result); + return (result == rpc_s_ok) ? (short)max_bytes : 0; +#else + return ACE_Codeset_Registry::get_max_bytes_i (codeset_id); +#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Codeset_Registry_db.cpp b/externals/ace/Codeset_Registry_db.cpp new file mode 100644 index 0000000..32b3863 --- /dev/null +++ b/externals/ace/Codeset_Registry_db.cpp @@ -0,0 +1,33 @@ +/* $Id: Codeset_Registry_db.cpp 81756 2008-05-22 09:47:33Z johnnyw $ + * Codeset registry DB, generated Fri Feb 28 21:01:30 2003 + * source: code_set_registry1.2g.txt + * + * To populate the registry_db, construct a codeset registry text file based + * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details + * on obtaining the full text for the current registry. Once you have composed + * a text file containing all the desired codeset information, build and run + * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new + * copy of this file, with the registry_db_ array properly initialized. + */ + +#include "ace/Codeset_Registry.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Codeset_Registry::registry_entry const +ACE_Codeset_Registry::registry_db_[] = +{ + {"ISO/IEC 10646-1:1993; UCS-2, Level 1","UCS-2",0x00010100,1,{0x1000},2}, + {"ISO 8859-1:1987; Latin Alphabet No. 1","ISO8859_1",0x00010001,1,{0x0011},1}, + {"IBM-1047 (CCSID 01047); Latin-1 Open System","EBCDIC",0x10020417,1,{0x0011},1}, + {"ISO/IEC 10646-1:1993; UCS-4, Level 1","UCS-4",0x00010104,1,{0x1000},4}, + {"ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form","UTF-16",0x00010109,1,{0x1000},2}, + {"X/Open UTF-8; UCS Transformation Format 8 (UTF-8)","UTF-8",0x05010001,1,{0x1000},6}, + {"ISO/IEC 8859-5:1988; Latin-Cyrillic Alphabet","ISO-8859-5",0x00010005,1,{0x0015},1}, + {"IBM-1251 (CCSID 01251); MS Windows Cyrillic","CP1251",0x100204e3,1,{0x0015},1}, + {"IBM-855 (CCSID 04951); Cyrillic Personal Computer","CP855",0x10021357,1,{0x0015},1} +}; + +size_t const ACE_Codeset_Registry::num_registry_entries_ = 9; + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Codeset_Symbols.h b/externals/ace/Codeset_Symbols.h new file mode 100644 index 0000000..6ffe198 --- /dev/null +++ b/externals/ace/Codeset_Symbols.h @@ -0,0 +1,220 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Codeset_Symbols.h + * + * $Id: Codeset_Symbols.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Symbolic names for codeset ids. + * + * @author Dale Wilson (wilson_d@ociweb.com) + */ +//============================================================================= +#ifndef CODESET_SYMBOLS_H +#define CODESET_SYMBOLS_H + +// These numbers are assigned by the OpenGroup, a database is +// available at +// +// ftp://ftp.opengroup.org/pub/code_set_registry/ +// +// Alas, the database is in a semi-regular text file -- difficult to use. +// The following C/C++-friendly version of the codeset ids was captured +// from Version 1.2g of the registry. +// +#define ACE_CODESET_ID_ISO_8859_1 0x00010001U +#define ACE_CODESET_ID_ISO_8859_2 0x00010002U +#define ACE_CODESET_ID_ISO_8859_3 0x00010003U +#define ACE_CODESET_ID_ISO_8859_4 0x00010004U +#define ACE_CODESET_ID_ISO_8859_5 0x00010005U +#define ACE_CODESET_ID_ISO_8859_6 0x00010006U +#define ACE_CODESET_ID_ISO_8859_7 0x00010007U +#define ACE_CODESET_ID_ISO_8859_8 0x00010008U +#define ACE_CODESET_ID_ISO_8859_9 0x00010009U +#define ACE_CODESET_ID_ISO_8859_10 0x0001000AU +#define ACE_CODESET_ID_ISO_8859_15 0x0001000FU +#define ACE_CODESET_ID_ISO_646 0x00010020U +#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_1 0x00010100U +#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_2 0x00010101U +#define ACE_CODESET_ID_ISO_UCS_2_LEVEL_3 0x00010102U +#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_1 0x00010104U +#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_2 0x00010105U +#define ACE_CODESET_ID_ISO_UCS_4_LEVEL_3 0x00010106U +#define ACE_CODESET_ID_ISO_UTF_8 0x00010108U +#define ACE_CODESET_ID_ISO_UTF_16 0x00010109U +#define ACE_CODESET_ID_JIS_X0201 0x00030001U +#define ACE_CODESET_ID_JIS_X0208_1978 0x00030004U +#define ACE_CODESET_ID_JIS_X0208_1983 0x00030005U +#define ACE_CODESET_ID_JIS_X0208_1990 0x00030006U +#define ACE_CODESET_ID_JIS_X0212 0x0003000AU +#define ACE_CODESET_ID_JIS_EUCJP 0x00030010U +#define ACE_CODESET_ID_KS_C5601 0x00040001U +#define ACE_CODESET_ID_KS_C5657 0x00040002U +#define ACE_CODESET_ID_KS_EUCKR 0x0004000AU +#define ACE_CODESET_ID_CNS_11643_1986 0x00050001U +#define ACE_CODESET_ID_CNS_11643_1992 0x00050002U +#define ACE_CODESET_ID_CNS_EUCTW_1991 0x0005000AU +#define ACE_CODESET_ID_CNS_EUCTW_1993 0x00050010U +#define ACE_CODESET_ID_TIS_620_25290X000B0001U +#define ACE_CODESET_ID_TTB_CCDC 0x000D0001U +#define ACE_CODESET_ID_OSF_JAPANESE_UJIS 0x05000010U +#define ACE_CODESET_ID_OSF_JAPANESE_SJIS_1 0x05000011U +#define ACE_CODESET_ID_OSF_JAPANESE_SJIS_2 0x05000012U +#define ACE_CODESET_ID_XOPEN_UTF_8 0x05010001U +#define ACE_CODESET_ID_JVC_EUCJP 0x05020001U +#define ACE_CODESET_ID_JVC_SJIS 0x05020002U +#define ACE_CODESET_ID_DEC_KANJI 0x10000001U +#define ACE_CODESET_ID_SUPER_DEC_KANJI 0x10000002U +#define ACE_CODESET_ID_DEC_SHIFT_JIS 0x10000003U +#define ACE_CODESET_ID_HP_ROMAN8 0x10010001U +#define ACE_CODESET_ID_HP_KANA8 0x10010002U +#define ACE_CODESET_ID_HP_ARABIC8 0x10010003U +#define ACE_CODESET_ID_HP_GREEK8 0x10010004U +#define ACE_CODESET_ID_HP_HEBREW8 0x10010005U +#define ACE_CODESET_ID_HP_TURKISH8 0x10010006U +#define ACE_CODESET_ID_HP15CN 0x10010007U +#define ACE_CODESET_ID_HP_BIG5 0x10010008U +#define ACE_CODESET_ID_HP_JAPANESE15__SJIS_ 0x10010009U +#define ACE_CODESET_ID_HP_SJISHI 0x1001000AU +#define ACE_CODESET_ID_HP_SJISPC 0x1001000BU +#define ACE_CODESET_ID_HP_UJIS 0x1001000CU +#define ACE_CODESET_ID_IBM_037 0x10020025U +#define ACE_CODESET_ID_IBM_273 0x10020111U +#define ACE_CODESET_ID_IBM_277 0x10020115U +#define ACE_CODESET_ID_IBM_278 0x10020116U +#define ACE_CODESET_ID_IBM_280 0x10020118U +#define ACE_CODESET_ID_IBM_282 0x1002011AU +#define ACE_CODESET_ID_IBM_284 0x1002011CU +#define ACE_CODESET_ID_IBM_285 0x1002011DU +#define ACE_CODESET_ID_IBM_290 0x10020122U +#define ACE_CODESET_ID_IBM_297 0x10020129U +#define ACE_CODESET_ID_IBM_300 0x1002012CU +#define ACE_CODESET_ID_IBM_301 0x1002012DU +#define ACE_CODESET_ID_IBM_420 0x100201A4U +#define ACE_CODESET_ID_IBM_424 0x100201A8U +#define ACE_CODESET_ID_IBM_437 0x100201B5U +#define ACE_CODESET_ID_IBM_500 0x100201F4U +#define ACE_CODESET_ID_IBM_833 0x10020341U +#define ACE_CODESET_ID_IBM_834 0x10020342U +#define ACE_CODESET_ID_IBM_835 0x10020343U +#define ACE_CODESET_ID_IBM_836 0x10020344U +#define ACE_CODESET_ID_IBM_837 0x10020345U +#define ACE_CODESET_ID_IBM_838 0x10020346U +#define ACE_CODESET_ID_IBM_839 0x10020347U +#define ACE_CODESET_ID_IBM_850 0x10020352U +#define ACE_CODESET_ID_IBM_852 0x10020354U +#define ACE_CODESET_ID_IBM_855 0x10020357U +#define ACE_CODESET_ID_IBM_856 0x10020358U +#define ACE_CODESET_ID_IBM_857 0x10020359U +#define ACE_CODESET_ID_IBM_861 0x1002035DU +#define ACE_CODESET_ID_IBM_862 0x1002035EU +#define ACE_CODESET_ID_IBM_863 0x1002035FU +#define ACE_CODESET_ID_IBM_864 0x10020360U +#define ACE_CODESET_ID_IBM_866 0x10020362U +#define ACE_CODESET_ID_IBM_868 0x10020364U +#define ACE_CODESET_ID_IBM_869 0x10020365U +#define ACE_CODESET_ID_IBM_870 0x10020366U +#define ACE_CODESET_ID_IBM_871 0x10020367U +#define ACE_CODESET_ID_IBM_874 0x1002036AU +#define ACE_CODESET_ID_IBM_875 0x1002036BU +#define ACE_CODESET_ID_IBM_880 0x10020370U +#define ACE_CODESET_ID_IBM_891 0x1002037BU +#define ACE_CODESET_ID_IBM_896 0x10020380U +#define ACE_CODESET_ID_IBM_897 0x10020381U +#define ACE_CODESET_ID_IBM_903 0x10020387U +#define ACE_CODESET_ID_IBM_904 0x10020388U +#define ACE_CODESET_ID_IBM_918 0x10020396U +#define ACE_CODESET_ID_IBM_921 0x10020399U +#define ACE_CODESET_ID_IBM_922 0x1002039AU +#define ACE_CODESET_ID_IBM_926 0x1002039EU +#define ACE_CODESET_ID_IBM_927 0x1002039FU +#define ACE_CODESET_ID_IBM_928 0x100203A0U +#define ACE_CODESET_ID_IBM_929 0x100203A1U +#define ACE_CODESET_ID_IBM_930 0x100203A2U +#define ACE_CODESET_ID_IBM_932 0x100203A4U +#define ACE_CODESET_ID_IBM_933 0x100203A5U +#define ACE_CODESET_ID_IBM_934 0x100203A6U +#define ACE_CODESET_ID_IBM_935 0x100203A7U +#define ACE_CODESET_ID_IBM_936 0x100203A8U +#define ACE_CODESET_ID_IBM_937 0x100203A9U +#define ACE_CODESET_ID_IBM_938 0x100203AAU +#define ACE_CODESET_ID_IBM_939 0x100203ABU +#define ACE_CODESET_ID_IBM_941 0x100203ADU +#define ACE_CODESET_ID_IBM_942 0x100203AEU +#define ACE_CODESET_ID_IBM_943 0x100203AFU +#define ACE_CODESET_ID_IBM_946 0x100203B2U +#define ACE_CODESET_ID_IBM_947 0x100203B3U +#define ACE_CODESET_ID_IBM_948 0x100203B4U +#define ACE_CODESET_ID_IBM_949 0x100203B5U +#define ACE_CODESET_ID_IBM_950 0x100203B6U +#define ACE_CODESET_ID_IBM_951 0x100203B7U +#define ACE_CODESET_ID_IBM_955 0x100203BBU +#define ACE_CODESET_ID_IBM_964 0x100203C4U +#define ACE_CODESET_ID_IBM_970 0x100203CAU +#define ACE_CODESET_ID_IBM_1006 0x100203EEU +#define ACE_CODESET_ID_IBM_1025 0x10020401U +#define ACE_CODESET_ID_IBM_1026 0x10020402U +#define ACE_CODESET_ID_IBM_1027 0x10020403U +#define ACE_CODESET_ID_IBM_1040 0x10020410U +#define ACE_CODESET_ID_IBM_1041 0x10020411U +#define ACE_CODESET_ID_IBM_1043 0x10020413U +#define ACE_CODESET_ID_IBM_1046 0x10020416U +#define ACE_CODESET_ID_IBM_1047 0x10020417U +#define ACE_CODESET_ID_IBM_1088 0x10020440U +#define ACE_CODESET_ID_IBM_1097 0x10020449U +#define ACE_CODESET_ID_IBM_1098 0x1002044AU +#define ACE_CODESET_ID_IBM_1112 0x10020458U +#define ACE_CODESET_ID_IBM_1114 0x1002045AU +#define ACE_CODESET_ID_IBM_1115 0x1002045BU +#define ACE_CODESET_ID_IBM_1122 0x10020462U +#define ACE_CODESET_ID_IBM_1250 0x100204E2U +#define ACE_CODESET_ID_IBM_1251 0x100204E3U +#define ACE_CODESET_ID_IBM_1252 0x100204E4U +#define ACE_CODESET_ID_IBM_1253 0x100204E5U +#define ACE_CODESET_ID_IBM_1254 0x100204E6U +#define ACE_CODESET_ID_IBM_1255 0x100204E7U +#define ACE_CODESET_ID_IBM_1256 0x100204E8U +#define ACE_CODESET_ID_IBM_1257 0x100204E9U +#define ACE_CODESET_ID_IBM_1380 0x10020564U +#define ACE_CODESET_ID_IBM_1381 0x10020565U +#define ACE_CODESET_ID_IBM_1383 0x10020567U +#define ACE_CODESET_ID_IBM_4396 0x1002112CU +#define ACE_CODESET_ID_IBM_4946 0x10021352U +#define ACE_CODESET_ID_IBM_4948 0x10021354U +#define ACE_CODESET_ID_IBM_4951 0x10021357U +#define ACE_CODESET_ID_IBM_4952 0x10021358U +#define ACE_CODESET_ID_IBM_4953 0x10021359U +#define ACE_CODESET_ID_IBM_4960 0x10021360U +#define ACE_CODESET_ID_IBM_4964 0x10021364U +#define ACE_CODESET_ID_IBM_4965 0x10021365U +#define ACE_CODESET_ID_IBM_5026 0x100213A2U +#define ACE_CODESET_ID_IBM_5031 0x100213A7U +#define ACE_CODESET_ID_IBM_5035 0x100213ABU +#define ACE_CODESET_ID_IBM_5048 0x100213B8U +#define ACE_CODESET_ID_IBM_5049 0x100213B9U +#define ACE_CODESET_ID_IBM_5067 0x100213CBU +#define ACE_CODESET_ID_IBM_8612 0x100221A4U +#define ACE_CODESET_ID_IBM_9025 0x10022341U +#define ACE_CODESET_ID_IBM_9026 0x10022342U +#define ACE_CODESET_ID_IBM_9030 0x10022346U +#define ACE_CODESET_ID_IBM_9056 0x10022360U +#define ACE_CODESET_ID_IBM_9066 0x1002236AU +#define ACE_CODESET_ID_IBM_9125 0x100223A5U +#define ACE_CODESET_ID_IBM_25426 0x10026352U +#define ACE_CODESET_ID_IBM_25432 0x10026358U +#define ACE_CODESET_ID_IBM_1042 0x10026412U +#define ACE_CODESET_ID_IBM_28709 0x10027025U +#define ACE_CODESET_ID_IBM_33624 0x10028358U +#define ACE_CODESET_ID_IBM_33722 0x100283BAU +#define ACE_CODESET_ID_HTCSJIS 0x10030001U +#define ACE_CODESET_ID_HTCUJIS 0x10030002U +#define ACE_CODESET_ID_FUJITSU_U90 0x10040001U +#define ACE_CODESET_ID_FUJITSU_S90 0x10040002U +#define ACE_CODESET_ID_FUJITSU_R90 0x10040003U +#define ACE_CODESET_ID_EBCDIC_ASCII_AND_JEF 0x10040004U +#define ACE_CODESET_ID_EBCDIC_KATAKANA_AND_JEF 0x10040005U +#define ACE_CODESET_ID_EBCDIC_JAPANESE_ENGLISH_AND_JEF 0x10040006U + +#define ACE_CODESET_ID_TAO_BACKWARD_COMPATIBLE 0xf54414F0U +#endif // CODESET_SYMBOLS_H diff --git a/externals/ace/Condition_Recursive_Thread_Mutex.cpp b/externals/ace/Condition_Recursive_Thread_Mutex.cpp new file mode 100644 index 0000000..1f35758 --- /dev/null +++ b/externals/ace/Condition_Recursive_Thread_Mutex.cpp @@ -0,0 +1,129 @@ +// -*- C++ -*- + +/** + * @file Condition_Recursive_Thread_Mutex.cpp + * + * $Id: Condition_Recursive_Thread_Mutex.cpp 89127 2010-02-22 19:58:18Z schmidt $ + * + * Originally in Synch.cpp + * + * @author Douglas C. Schmidt + */ + +#include "ace/Condition_Recursive_Thread_Mutex.h" + +#if defined (ACE_HAS_THREADS) + +#if defined (ACE_HAS_DUMP) +# include "ace/Log_Msg.h" +#endif /* ACE_HAS_DUMP */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +int +ACE_Condition::remove (void) +{ + return ACE_OS::cond_destroy (&this->cond_); +} + +void +ACE_Condition::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Condition::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + // No dump method for ACE_cond_t even in emulated mode. + // cond_.dump (); + this->mutex_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Condition::~ACE_Condition (void) +{ + this->remove (); +} + +ACE_Condition::ACE_Condition (ACE_Recursive_Thread_Mutex &m) + : mutex_ (m) +{ + ACE_OS::cond_init (&this->cond_); +} + +int +ACE_Condition::wait (const ACE_Time_Value *abstime) +{ + return this->wait (this->mutex_, abstime); +} + +int +ACE_Condition::wait (ACE_Recursive_Thread_Mutex &mutex, + const ACE_Time_Value *abstime) +{ + ACE_recursive_mutex_state mutex_state_holder; + ACE_recursive_thread_mutex_t &recursive_mutex = mutex.lock (); + + if (ACE_OS::recursive_mutex_cond_unlock (&recursive_mutex, + mutex_state_holder) == -1) + return -1; + + // We wait on the condition, specifying the nesting mutex. For platforms + // with ACE_HAS_RECURSIVE_MUTEXES, this is the recursive mutex itself, + // and is the same as recursive_mutex, above. The caller should have been + // holding the lock on entry to this method, and it is still held. + // For other platforms, this is the nesting mutex that guards the + // ACE_recursive_mutex_t internals, and recursive_mutex_cond_unlock() + // returned with the lock held, but waiters primed and waiting to be + // released. At cond_wait below, the mutex will be released. + // On return, it will be reacquired. + int const result = abstime == 0 + ? ACE_OS::cond_wait (&this->cond_, + &mutex.get_nesting_mutex ()) + : ACE_OS::cond_timedwait (&this->cond_, + &mutex.get_nesting_mutex (), + const_cast (abstime)); + // We are holding the mutex, whether the wait succeeded or failed. + // Stash errno (in case it failed) and then we need to reset the + // recursive mutex state to what it was on entry to this method. + // Resetting it may require a wait for another thread to release + // the ACE_recursive_thread_mutex_t if this is a platform without + // ACE_HAS_RECURSIVE_MUTEXES, and recursive_mutex_cond_relock() takes + // care of that. + { + ACE_Errno_Guard error (errno); + ACE_OS::recursive_mutex_cond_relock (&recursive_mutex, + mutex_state_holder); + } + + return result; +} + +int +ACE_Condition::signal (void) +{ + return ACE_OS::cond_signal (&this->cond_); +} + +int +ACE_Condition::broadcast (void) +{ + return ACE_OS::cond_broadcast (&this->cond_); +} + +ACE_Recursive_Thread_Mutex & +ACE_Condition::mutex (void) +{ + return this->mutex_; +} + +ACE_Condition_Recursive_Thread_Mutex::ACE_Condition_Recursive_Thread_Mutex ( + ACE_Recursive_Thread_Mutex &m) : + ACE_Condition (m) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/Condition_Recursive_Thread_Mutex.h b/externals/ace/Condition_Recursive_Thread_Mutex.h new file mode 100644 index 0000000..ac3177d --- /dev/null +++ b/externals/ace/Condition_Recursive_Thread_Mutex.h @@ -0,0 +1,116 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Condition_Recursive_Thread_Mutex.h + * + * $Id: Condition_Recursive_Thread_Mutex.h 86731 2009-09-17 12:23:48Z johnnyw $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H +#define ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_HAS_THREADS) +# include "ace/Null_Condition.h" +#else /* ACE_HAS_THREADS */ +#include "ace/Recursive_Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template class ACE_Condition; + +/** + * @brief ACE_Condition template specialization written using + * @a ACE_Recursive_Thread_Mutex. This allows threads to block until + * shared data changes state using recursive mutexes. + */ +template<> +class ACE_Export ACE_Condition +{ +public: + /// Initialize the condition variable with a recursive mutex. + ACE_Condition (ACE_Recursive_Thread_Mutex &m); + + /// Implicitly destroy the condition variable. + ~ACE_Condition (void); + + /** + * Explicitly destroy the condition variable. Note that only one + * thread should call this method since it doesn't protect against + * race conditions. + */ + int remove (void); + + /** + * Block on condition, or until absolute time-of-day has passed. If + * abstime == 0 use "blocking" semantics. Else, if @a abstime + * != 0 and the call times out before the condition is signaled + * returns -1 and sets errno to ETIME. + */ + int wait (const ACE_Time_Value *abstime = 0); + + /** + * Block on condition or until absolute time-of-day has passed. If + * abstime == 0 use "blocking" wait() semantics on the recursive @a mutex + * passed as a parameter (this is useful if you need to store the + * in shared memory). Else, if != 0 and the + * call times out before the condition is signaled returns -1 + * and sets errno to ETIME. + */ + int wait (ACE_Recursive_Thread_Mutex &mutex, + const ACE_Time_Value *abstime = 0); + + /// Signal one waiting thread. + int signal (void); + + /// Signal *all* waiting threads. + int broadcast (void); + + /// Returns a reference to the underlying mutex; + ACE_Recursive_Thread_Mutex &mutex (void); + + /// Dump the state of an object. + void dump (void) const; + +private: + + // = Prevent assignment and copying. + void operator= (const ACE_Condition &); + ACE_Condition (const ACE_Condition &); + +private: + + /// A normal (i.e., non-recursive) condition variable. + ACE_cond_t cond_; + + /// Reference to the recursive mutex. + ACE_Recursive_Thread_Mutex &mutex_; + +}; + +class ACE_Export ACE_Condition_Recursive_Thread_Mutex + : public ACE_Condition +{ +public: + /// Initialize the condition variable with a recursive mutex. + ACE_Condition_Recursive_Thread_Mutex (ACE_Recursive_Thread_Mutex &m); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* !ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONDITION_RECURSIVE_THREAD_MUTEX_H */ diff --git a/externals/ace/Condition_T.cpp b/externals/ace/Condition_T.cpp new file mode 100644 index 0000000..ae75d9f --- /dev/null +++ b/externals/ace/Condition_T.cpp @@ -0,0 +1,127 @@ +// $Id: Condition_T.cpp 89127 2010-02-22 19:58:18Z schmidt $ + +#ifndef ACE_CONDITION_T_CPP +#define ACE_CONDITION_T_CPP + +#include "ace/Condition_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Condition_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Condition) + +template void +ACE_Condition::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Condition::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Thread_Condition::ACE_Thread_Condition (MUTEX &m, + const ACE_TCHAR *name, + void *arg) + : ACE_Condition (m, USYNC_THREAD, name, arg) +{ +// ACE_TRACE ("ACE_Thread_Condition::ACE_Thread_Condition"); +} + +template void +ACE_Thread_Condition::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Thread_Condition::dump"); + + ACE_Condition::dump (); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Condition::ACE_Condition (MUTEX &m, + int type, + const ACE_TCHAR *name, + void *arg) + : + mutex_ (m) +{ + // ACE_TRACE ("ACE_Condition::ACE_Condition"); + + if (ACE_OS::cond_init (&this->cond_, + (short) type, + name, + arg) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Condition::ACE_Condition"))); +} + +template +ACE_Condition::~ACE_Condition (void) +{ + // ACE_TRACE ("ACE_Condition::~ACE_Condition"); + + if (this->remove () == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Condition::~ACE_Condition"))); +} + +template int +ACE_Condition::wait (void) +{ + // ACE_TRACE ("ACE_Condition::wait"); + return ACE_OS::cond_wait (&this->cond_, + &this->mutex_.lock ()); +} + +template int +ACE_Condition::wait (MUTEX &mutex, + const ACE_Time_Value *abstime) +{ +// ACE_TRACE ("ACE_Condition::wait"); + if (abstime == 0) + { + return ACE_OS::cond_wait (&this->cond_, + &mutex.lock ()); + } + else + { + ACE_Time_Value tv = *abstime; + return ACE_OS::cond_timedwait (&this->cond_, + &mutex.lock (), + &tv); + } +} + +// Peform an "alertable" timed wait. If the argument ABSTIME == 0 +// then we do a regular cond_wait(), else we do a timed wait for up to +// ABSTIME using the Solaris cond_timedwait() function. + +template int +ACE_Condition::wait (const ACE_Time_Value *abstime) +{ +// ACE_TRACE ("ACE_Condition::wait"); + return this->wait (this->mutex_, abstime); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ + +#endif /* ACE_CONDITION_T_CPP */ diff --git a/externals/ace/Condition_T.h b/externals/ace/Condition_T.h new file mode 100644 index 0000000..936ce82 --- /dev/null +++ b/externals/ace/Condition_T.h @@ -0,0 +1,167 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Condition_T.h + * + * $Id: Condition_T.h 81462 2008-04-28 11:39:40Z johnnyw $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_CONDITION_T_H +#define ACE_CONDITION_T_H + +#include /**/ "ace/pre.h" + +#include "ace/OS_NS_Thread.h" +#include "ace/Lock.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) /* ACE platform supports some form of threading. */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +/** + * @class ACE_Condition + * + * @brief ACE_Condition variable wrapper, which allows threads to block + * until shared data changes state. + * + * A condition variable enables threads to atomically block and + * test the condition under the protection of a mutual exclu- + * sion lock (mutex) until the condition is satisfied. That is, + * the mutex must have been held by the thread before calling + * wait or signal on the condition. If the condition is false, + * a thread blocks on a condition variable and atomically + * releases the mutex that is waiting for the condition to + * change. If another thread changes the condition, it may wake + * up waiting threads by signaling the associated condition + * variable. The waiting threads, upon awakening, reacquire the + * mutex and re-evaluate the condition. + * Note, you can only parameterize with + * @a ACE_Thread_Mutex, @a ACE_Recursive_Thread_Mutex, or @a ACE_Null_Mutex. + */ +template +class ACE_Condition +{ +public: + // = Initialiation and termination methods. + /// Initialize the condition variable. + ACE_Condition (MUTEX &m, int type = USYNC_THREAD, + const ACE_TCHAR *name = 0, void *arg = 0); + + /// Implicitly destroy the condition variable. + ~ACE_Condition (void); + + // = Lock accessors. + /** + * Block on condition, or until absolute time-of-day has passed. If + * @a abstime == 0 use "blocking" semantics. Else, if @a abstime + * != 0 and the call times out before the condition is signaled + * returns -1 and sets errno to ETIME. + */ + int wait (const ACE_Time_Value *abstime); + + /// Block on condition. + int wait (void); + + /** + * Block on condition or until absolute time-of-day has passed. If + * abstime == 0 use "blocking" wait() semantics on the + * passed as a parameter (this is useful if you need to store the + * in shared memory). Else, if != 0 and the + * call times out before the condition is signaled returns -1 + * and sets errno to ETIME. + */ + int wait (MUTEX &mutex, const ACE_Time_Value *abstime = 0); + + /// Signal one waiting thread. + int signal (void); + + /// Signal *all* waiting threads. + int broadcast (void); + + // = Utility methods. + /// Explicitly destroy the condition variable. + int remove (void); + + /// Returns a reference to the underlying mutex_; + MUTEX &mutex (void); + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + /// Condition variable. + ACE_cond_t cond_; + + /// Reference to mutex lock. + MUTEX &mutex_; + +private: + // = Prevent assignment and initialization. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Condition &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Condition (const ACE_Condition &)) +}; + +/** + * @class ACE_Thread_Condition + * + * @brief ACE_Condition variable wrapper that works within processes. + * + * A condition variable enables threads to atomically block and + * test the condition under the protection of a mutual exclu- + * sion lock (mutex) until the condition is satisfied. That is, + * the mutex must have been held by the thread before calling + * wait or signal on the condition. If the condition is false, + * a thread blocks on a condition variable and atomically + * releases the mutex that is waiting for the condition to + * change. If another thread changes the condition, it may wake + * up waiting threads by signaling the associated condition + * variable. The waiting threads, upon awakening, reacquire the + * mutex and re-evaluate the condition. + */ +template +class ACE_Thread_Condition : public ACE_Condition +{ +public: + // = Initialization method. + ACE_Thread_Condition (MUTEX &m, const ACE_TCHAR *name = 0, void *arg = 0); + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Condition_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Condition_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Condition_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONDITION_T_H */ diff --git a/externals/ace/Condition_T.inl b/externals/ace/Condition_T.inl new file mode 100644 index 0000000..e3b4527 --- /dev/null +++ b/externals/ace/Condition_T.inl @@ -0,0 +1,51 @@ +// -*- C++ -*- +// +// $Id: Condition_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE int +ACE_Condition::remove (void) +{ + // ACE_TRACE ("ACE_Condition::remove"); + + // cond_destroy() is called in a loop if the condition variable is + // BUSY. This avoids a condition where a condition is signaled and + // because of some timing problem, the thread that is to be signaled + // has called the cond_wait routine after the signal call. Since + // the condition signal is not queued in any way, deadlock occurs. + + int result = 0; + + while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 + && errno == EBUSY) + { + ACE_OS::cond_broadcast (&this->cond_); + ACE_OS::thr_yield (); + } + + return result; +} + +template ACE_INLINE MUTEX & +ACE_Condition::mutex (void) +{ + // ACE_TRACE ("ACE_Condition::mutex"); + return this->mutex_; +} + +template ACE_INLINE int +ACE_Condition::signal (void) +{ +// ACE_TRACE ("ACE_Condition::signal"); + return ACE_OS::cond_signal (&this->cond_); +} + +template ACE_INLINE int +ACE_Condition::broadcast (void) +{ +// ACE_TRACE ("ACE_Condition::broadcast"); + return ACE_OS::cond_broadcast (&this->cond_); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Condition_Thread_Mutex.cpp b/externals/ace/Condition_Thread_Mutex.cpp new file mode 100644 index 0000000..c9f2620 --- /dev/null +++ b/externals/ace/Condition_Thread_Mutex.cpp @@ -0,0 +1,126 @@ +/* -*- C++ -*- */ +/** + * @file Condition_Thread_Mutex.cpp + * + * $Id: Condition_Thread_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $ + * + * Originally in Synch.cpp + * + * @author Douglas C. Schmidt + */ + +#include "ace/Condition_Thread_Mutex.h" + +#if defined (ACE_HAS_THREADS) + +#if !defined (__ACE_INLINE__) +#include "ace/Condition_Thread_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, Condition_Thread_Mutex, "$Id: Condition_Thread_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Condition_Thread_Mutex) + +void +ACE_Condition_Thread_Mutex::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Condition_Thread_Mutex::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); +#if defined (ACE_WIN32) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("waiters = %d\n"), + this->cond_.waiters ())); +#endif /* ACE_WIN32 */ + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, + const ACE_TCHAR *name, + void *arg) + : mutex_ (m), + removed_ (false) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); + if (ACE_OS::cond_init (&this->cond_, + (short) USYNC_THREAD, + name, + arg) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); +} + +ACE_Condition_Thread_Mutex:: +ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, + ACE_Condition_Attributes &attributes, + const ACE_TCHAR *name, + void *arg) + : mutex_ (m), + removed_ (false) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); + if (ACE_OS::cond_init (&this->cond_, attributes.attributes_, + name, arg) != 0) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); +} + +ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex (void) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex"); + this->remove (); +} + +// Peform an "alertable" timed wait. If the argument == 0 +// then we do a regular , else we do a timed wait for up to +// using the function. + +int +ACE_Condition_Thread_Mutex::wait (void) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); + return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock_); +} + +int +ACE_Condition_Thread_Mutex::wait (ACE_Thread_Mutex &mutex, + const ACE_Time_Value *abstime) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); + return ACE_OS::cond_timedwait (&this->cond_, + &mutex.lock_, + const_cast (abstime)); +} + +int +ACE_Condition_Thread_Mutex::wait (const ACE_Time_Value *abstime) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); + return this->wait (this->mutex_, abstime); +} + +int +ACE_Condition_Thread_Mutex::signal (void) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::signal"); + return ACE_OS::cond_signal (&this->cond_); +} + +int +ACE_Condition_Thread_Mutex::broadcast (void) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::broadcast"); + return ACE_OS::cond_broadcast (&this->cond_); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/Condition_Thread_Mutex.h b/externals/ace/Condition_Thread_Mutex.h new file mode 100644 index 0000000..693ff08 --- /dev/null +++ b/externals/ace/Condition_Thread_Mutex.h @@ -0,0 +1,190 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Condition_Thread_Mutex.h + * + * $Id: Condition_Thread_Mutex.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_CONDITION_THREAD_MUTEX_H +#define ACE_CONDITION_THREAD_MUTEX_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_HAS_THREADS) +# include "ace/Null_Condition.h" +#else /* ACE_HAS_THREADS */ +// ACE platform supports some form of threading. + +#include "ace/Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +class ACE_Export ACE_Condition_Attributes +{ +public: + /// Constructor + ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE); + + /// Destructor + ~ACE_Condition_Attributes (void); + +private: + friend class ACE_Condition_Thread_Mutex; + + /// The attributes + ACE_condattr_t attributes_; + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Condition_Attributes &); + ACE_Condition_Attributes (const ACE_Condition_Attributes &); +}; + +/** + * @class ACE_Condition_Thread_Mutex + * + * @brief ACE_Condition variable wrapper written using ACE_Mutexes This + * allows threads to block until shared data changes state. + * A condition variable enables threads to atomically block and + * test the condition under the protection of a mutual exclu- + * sion lock (mutex) until the condition is satisfied. That is, + * the mutex must have been held by the thread before calling + * wait or signal on the condition. If the condition is false, + * a thread blocks on a condition variable and atomically + * releases the mutex that is waiting for the condition to + * change. If another thread changes the condition, it may wake + * up waiting threads by signaling the associated condition + * variable. The waiting threads, upon awakening, reacquire the + * mutex and re-evaluate the condition. + * + * This should be an instantiation of ACE_Condition but problems + * with compilers precludes this... + */ +class ACE_Export ACE_Condition_Thread_Mutex +{ +public: + /// Initialize the condition variable. + ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, + const ACE_TCHAR *name = 0, + void *arg = 0); + + /// Initialize the condition variable. + ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, + ACE_Condition_Attributes &attributes, + const ACE_TCHAR *name = 0, + void *arg = 0); + + /// Implicitly destroy the condition variable. + ~ACE_Condition_Thread_Mutex (void); + + /** + * Explicitly destroy the condition variable. Note that only one + * thread should call this method since it doesn't protect against + * race conditions. + */ + int remove (void); + + /** + * Block on condition, or until absolute time-of-day has passed. If + * abstime == 0 use "blocking" semantics. Else, if @a abstime + * != 0 and the call times out before the condition is signaled + * returns -1 and sets errno to ETIME. + */ + int wait (const ACE_Time_Value *abstime); + + /// Block on condition. + int wait (void); + + /** + * Block on condition or until absolute time-of-day has passed. If + * abstime == 0 use "blocking" wait() semantics on the + * passed as a parameter (this is useful if you need to store the + * in shared memory). Else, if @a abstime != 0 and the + * call times out before the condition is signaled returns -1 + * and sets errno to ETIME. + */ + int wait (ACE_Thread_Mutex &mutex, const ACE_Time_Value *abstime = 0); + + /// Signal one waiting thread. + int signal (void); + + /// Signal *all* waiting threads. + int broadcast (void); + + /// Returns a reference to the underlying mutex; + ACE_Thread_Mutex &mutex (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Condition variable. + ACE_cond_t cond_; + + /// Reference to mutex lock. + ACE_Thread_Mutex &mutex_; + + /// Keeps track of whether has been called yet to avoid + /// multiple calls, e.g., explicitly and implicitly in the + /// destructor. This flag isn't protected by a lock, so make sure + /// that you don't have multiple threads simultaneously calling + /// on the same object, which is a bad idea anyway... + bool removed_; + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Condition_Thread_Mutex &); + ACE_Condition_Thread_Mutex (const ACE_Condition_Thread_Mutex &); +}; + +#if 0 +// The following class is commented out since there doesn't +// appear to be a portable and robust means of implementing this +// functionality across platforms. If you know of a portable and +// robust way to implement this functionality please let us know. + +/** + * @class ACE_Process_Condition + * + * @brief ACE_Condition variable wrapper that works across processes. + */ +class ACE_Export ACE_Process_Condition +{ +public: + ACE_Process_Condition (MUTEX &m, const ACE_TCHAR *name = 0, void *arg = 0); + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; +#endif /* 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Condition_Thread_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* !ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONDITION_THREAD_MUTEX_H */ diff --git a/externals/ace/Condition_Thread_Mutex.inl b/externals/ace/Condition_Thread_Mutex.inl new file mode 100644 index 0000000..851269e --- /dev/null +++ b/externals/ace/Condition_Thread_Mutex.inl @@ -0,0 +1,74 @@ +// -*- C++ -*- +// +// $Id: Condition_Thread_Mutex.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Condition_Attributes::ACE_Condition_Attributes (int type) +{ + (void) ACE_OS::condattr_init (this->attributes_, type); +} + +ACE_INLINE +ACE_Condition_Attributes::~ACE_Condition_Attributes (void) +{ + ACE_OS::condattr_destroy (this->attributes_); +} + +ACE_INLINE int +ACE_Condition_Thread_Mutex::remove (void) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::remove"); + + // is called in a loop if the condition variable is + // BUSY. This avoids a condition where a condition is signaled and + // because of some timing problem, the thread that is to be signaled + // has called the cond_wait routine after the signal call. Since + // the condition signal is not queued in any way, deadlock occurs. + + int result = 0; + + if (!this->removed_) + { + this->removed_ = true; + + while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 + && errno == EBUSY) + { + ACE_OS::cond_broadcast (&this->cond_); + ACE_OS::thr_yield (); + } + } + return result; +} + +ACE_INLINE ACE_Thread_Mutex & +ACE_Condition_Thread_Mutex::mutex (void) +{ +// ACE_TRACE ("ACE_Condition_Thread_Mutex::mutex"); + return this->mutex_; +} + +#if 0 +template void +ACE_Process_Condition::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Process_Condition::dump"); + + ACE_Condition::dump (); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Process_Condition::ACE_Process_Condition (MUTEX &m, + const ACE_TCHAR *name, + void *arg) + : ACE_Condition (m, USYNC_PROCESS, name, arg) +{ +// ACE_TRACE ("ACE_Process_Condition::ACE_Process_Condition"); +} +#endif /* 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Configuration.cpp b/externals/ace/Configuration.cpp new file mode 100644 index 0000000..1914f2d --- /dev/null +++ b/externals/ace/Configuration.cpp @@ -0,0 +1,2152 @@ +// $Id: Configuration.cpp 86348 2009-08-04 14:45:29Z shuston $ +#include "ace/Configuration.h" +#include "ace/Auto_Ptr.h" +#include "ace/SString.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_strings.h" +#include "ace/Tokenizer_T.h" + +// Can remove this when import_config and export_config are removed from +// ACE_Configuration. They're deprecated at ACE 5.2. +#include "ace/Configuration_Import_Export.h" + +#if !defined (ACE_LACKS_ACCESS) +# include "ace/OS_NS_unistd.h" +#endif /* ACE_LACKS_ACCESS */ + +#if !defined (__ACE_INLINE__) +#include "ace/Configuration.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Section_Key_Internal::ACE_Section_Key_Internal (void) + : ref_count_ (0) +{ +} + +ACE_Section_Key_Internal::~ACE_Section_Key_Internal (void) +{ +} + +int +ACE_Section_Key_Internal::add_ref (void) +{ + ++ref_count_; + return 0; +} + +int +ACE_Section_Key_Internal::dec_ref (void) +{ + if (!--ref_count_) + delete this; + return 0; +} + +ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (void) + : key_ (0) +{ +} + +ACE_Configuration_Section_Key::~ACE_Configuration_Section_Key (void) +{ + if (key_) + key_->dec_ref (); +} + +ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (ACE_Section_Key_Internal* key) + : key_ (key) +{ + if (key_) + key_->add_ref (); +} + +ACE_Configuration_Section_Key::ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key& rhs) + : key_ (rhs.key_) +{ + if (key_) + key_->add_ref (); +} + +ACE_Configuration_Section_Key& +ACE_Configuration_Section_Key::operator= (const ACE_Configuration_Section_Key& rhs) +{ + if (this != &rhs) + { + if (key_) + key_->dec_ref (); + + key_ = rhs.key_; + + if (key_) + key_->add_ref (); + } + return *this; +} + +////////////////////////////////////////////////////////////////////////////// + +ACE_TCHAR ACE_Configuration::NULL_String_ = '\0'; + +ACE_Configuration::ACE_Configuration (void) + : root_ () +{ +} + +ACE_Configuration::~ACE_Configuration (void) +{ +} + +ACE_Section_Key_Internal* +ACE_Configuration::get_internal_key (const ACE_Configuration_Section_Key& key) +{ + return key.key_; +} + +int +ACE_Configuration::expand_path (const ACE_Configuration_Section_Key& key, + const ACE_TString& path_in, + ACE_Configuration_Section_Key& key_out, + int create) +{ + // Make a copy of key + ACE_Configuration_Section_Key current_section = key; + ACE_Auto_Basic_Array_Ptr pData (path_in.rep ()); + ACE_Tokenizer parser (pData.get ()); + parser.delimiter_replace ('\\', '\0'); + parser.delimiter_replace ('/', '\0'); + + for (ACE_TCHAR *temp = parser.next (); + temp != 0; + temp = parser.next ()) + { + // Open the section + if (open_section (current_section, + temp, + create, + key_out)) + return -1; + + current_section = key_out; + } + + return 0; + +} + +// import_config and export_config are here for backward compatibility, +// and have been deprecated. +int +ACE_Configuration::export_config (const ACE_TCHAR* filename) +{ + ACE_Registry_ImpExp exporter (*this); + return exporter.export_config (filename); +} + +int +ACE_Configuration::import_config (const ACE_TCHAR* filename) +{ + ACE_Registry_ImpExp importer (*this); + return importer.import_config (filename); +} + +int +ACE_Configuration::validate_name (const ACE_TCHAR* name, int allow_path) +{ + // Invalid character set + const ACE_TCHAR* reject = + allow_path ? ACE_TEXT ("][") : ACE_TEXT ("\\]["); + + // Position of the first invalid character or terminating null. + size_t const pos = ACE_OS::strcspn (name, reject); + + // Check if it is an invalid character. + if (name[pos] != ACE_TEXT ('\0')) + { + errno = EINVAL; + return -1; + } + + // The first character can never be a path separator. + if (name[0] == ACE_TEXT ('\\')) + { + errno = EINVAL; + return -1; + } + + // Validate length. + if (pos == 0 || pos > 255) + { + errno = ENAMETOOLONG; + return -1; + } + + return 0; +} + +int +ACE_Configuration::validate_value_name (const ACE_TCHAR* name) +{ + if (name == 0 || *name == this->NULL_String_) + return 0; + + return this->validate_name (name); +} + +const ACE_Configuration_Section_Key& +ACE_Configuration::root_section (void) const +{ + return root_; +} + +/** + * Determine if the contents of this object is the same as the + * contents of the object on the right hand side. + * Returns 1 (True) if they are equal and 0 (False) if they are not equal + */ +bool +ACE_Configuration::operator== (const ACE_Configuration& rhs) const +{ + bool rc = true; + int sectionIndex = 0; + ACE_TString sectionName; + ACE_Configuration *nonconst_this = const_cast (this); + ACE_Configuration &nonconst_rhs = const_cast (rhs); + + const ACE_Configuration_Section_Key& rhsRoot = rhs.root_section (); + ACE_Configuration_Section_Key rhsSection; + ACE_Configuration_Section_Key thisSection; + + // loop through each section in this object + while ((rc) && (nonconst_this->enumerate_sections (this->root_, + sectionIndex, + sectionName) == 0)) + { + // find that section in the rhs object + if (nonconst_rhs.open_section (rhsRoot, + sectionName.c_str (), + 0, + rhsSection) != 0) + { + // If the rhs object does not contain the section then we are + // not equal. + rc = false; + } + else if (nonconst_this->open_section (this->root_, + sectionName.c_str (), + 0, + thisSection) != 0) + { + // if there is some error opening the section in this object + rc = false; + } + else + { + // Well the sections match + int valueIndex = 0; + ACE_TString valueName; + VALUETYPE valueType; + VALUETYPE rhsType; + + // Enumerate each value in this section + while ((rc) && nonconst_this->enumerate_values (thisSection, + valueIndex, + valueName, + valueType) == 0) + { + // look for the same value in the rhs section + if (nonconst_rhs.find_value (rhsSection, + valueName.c_str (), + rhsType) != 0) + { + // We're not equal if the same value cannot + // be found in the rhs object. + rc = false; + } + else if (valueType != rhsType) + { + // we're not equal if the types do not match. + rc = false; + } + else + { + // finally compare values. + if (valueType == STRING) + { + ACE_TString thisString, rhsString; + if (nonconst_this->get_string_value (thisSection, + valueName.c_str (), + thisString) != 0) + { + // we're not equal if we cannot get this string + rc = false; + } + else if (nonconst_rhs.get_string_value ( + rhsSection, + valueName.c_str (), + rhsString) != 0) + { + // we're not equal if we cannot get rhs string + rc = false; + } + rc = (thisString == rhsString); + } + else if (valueType == INTEGER) + { + u_int thisInt = 0; + u_int rhsInt = 0; + if (nonconst_this->get_integer_value ( + thisSection, + valueName.c_str (), + thisInt) != 0) + { + // we're not equal if we cannot get this int + rc = false; + } + else if (nonconst_rhs.get_integer_value ( + rhsSection, + valueName.c_str (), + rhsInt) != 0) + { + // we're not equal if we cannot get rhs int + rc = false; + } + rc = (thisInt == rhsInt); + } + else if (valueType == BINARY) + { + void* thisData = 0; + void* rhsData = 0; + size_t thisLength = 0; + size_t rhsLength = 0; + if (nonconst_this->get_binary_value (thisSection, + valueName.c_str (), + thisData, + thisLength) != 0) + { + // we're not equal if we cannot get this data + rc = false; + } + else if (nonconst_rhs.get_binary_value ( + rhsSection, + valueName.c_str (), + rhsData, + rhsLength) != 0) + { + // we're not equal if we cannot get this data + rc = false; + } + + rc = (thisLength == rhsLength); + // are the length's the same? + + if (rc) + { + unsigned char* thisCharData = + (unsigned char*)thisData; + unsigned char* rhsCharData = (unsigned char*)rhsData; + // yes, then check each element + for (size_t count = 0; + (rc) && (count < thisLength); + count++) + { + rc = (* (thisCharData + count) == * (rhsCharData + count)); + } + + delete [] thisCharData; + delete [] rhsCharData; + }// end if the length's match + } + // We should never have valueTypes of INVALID, therefore + // we're not comparing them. How would we since we have + // no get operation for invalid types. + // So, if we have them, we guess they are equal. + + }// end else if values match. + + ++valueIndex; + + }// end value while loop + + // look in the rhs for values not in this + valueIndex = 0; + while ((rc) && (nonconst_rhs.enumerate_values (rhsSection, + valueIndex, + valueName, + rhsType) == 0)) + { + // look for the same value in this section + if (nonconst_this->find_value (thisSection, + valueName.c_str (), + valueType) != 0) + { + // We're not equal if the same value cannot + // be found in the rhs object. + rc = false; + } + ++valueIndex; + }// end while for rhs values not in this. + + }// end else if sections match. + + ++sectionIndex; + + }// end section while loop + + // Finally, make sure that there are no sections in rhs that do not + // exist in this + sectionIndex = 0; + while ((rc) + && (nonconst_rhs.enumerate_sections (rhsRoot, + sectionIndex, + sectionName) == 0)) + { + // find the section in this + if (nonconst_this->open_section (this->root_, + sectionName.c_str (), + 0, + thisSection) != 0) + { + // if there is some error opening the section in this object + rc = false; + } + else if (nonconst_rhs.open_section (rhsRoot, + sectionName.c_str (), + 0, + rhsSection) != 0) + { + // If the rhs object does not contain the section then we + // are not equal. + rc = false; + } + ++sectionIndex; + } + return rc; +} + +bool +ACE_Configuration::operator!= (const ACE_Configuration& rhs) const +{ + return !(*this == rhs); +} + +////////////////////////////////////////////////////////////////////////////// + +#if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_REGISTRY) + +static const int ACE_DEFAULT_BUFSIZE = 256; + +static const ACE_TCHAR *temp_name (const ACE_TCHAR *name) +{ + if (name && *name == ACE_Configuration::NULL_String_) + return 0; + return name; +} + +ACE_Section_Key_Win32::ACE_Section_Key_Win32 (HKEY hKey) + : hKey_ (hKey) +{ +} + +ACE_Section_Key_Win32::~ACE_Section_Key_Win32 (void) +{ + ::RegCloseKey (hKey_); +} + +////////////////////////////////////////////////////////////////////////////// + +bool +ACE_Configuration_Win32Registry::operator== (const ACE_Configuration_Win32Registry &rhs) const +{ + ACE_UNUSED_ARG (rhs); + return true; +} + +bool +ACE_Configuration_Win32Registry::operator!= (const ACE_Configuration_Win32Registry &rhs) const +{ + ACE_UNUSED_ARG (rhs); + return true; +} + +ACE_Configuration_Win32Registry::ACE_Configuration_Win32Registry (HKEY hKey) +{ + ACE_Section_Key_Win32 *temp = 0; + + ACE_NEW (temp, ACE_Section_Key_Win32 (hKey)); + + root_ = ACE_Configuration_Section_Key (temp); +} + + +ACE_Configuration_Win32Registry::~ACE_Configuration_Win32Registry (void) +{ +} + +int +ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_Key& base, + const ACE_TCHAR* sub_section, + int create, + ACE_Configuration_Section_Key& result) +{ + if (validate_name (sub_section, 1)) + return -1; + + HKEY base_key; + if (load_key (base, base_key)) + return -1; + + int errnum; + HKEY result_key; + if ((errnum = ACE_TEXT_RegOpenKeyEx (base_key, + sub_section, + 0, + KEY_ALL_ACCESS, + &result_key)) != ERROR_SUCCESS) + { + if (!create) + { + errno = errnum; + return -1; + } + + if ((errnum = ACE_TEXT_RegCreateKeyEx (base_key, + sub_section, + 0, + 0, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + 0, + &result_key, + (PDWORD) 0 + )) != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + } + + ACE_Section_Key_Win32 *temp; + + ACE_NEW_RETURN (temp, ACE_Section_Key_Win32 (result_key), -1); + result = ACE_Configuration_Section_Key (temp); + return 0; +} + +int +ACE_Configuration_Win32Registry::remove_section (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* sub_section, + bool recursive) +{ + if (validate_name (sub_section)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + if (recursive) + { + ACE_Configuration_Section_Key section; + if (open_section (key, sub_section, 0, section)) + return -1; + + HKEY sub_key; + if (load_key (section, sub_key)) + return -1; + + ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; + DWORD buffer_size = ACE_DEFAULT_BUFSIZE; + // Note we don't increment the index because the + // enumeration becomes invalid if we change the + // subkey, which we do when we delete it. By leaving + // it 0, we always delete the top entry + while (ACE_TEXT_RegEnumKeyEx (sub_key, + 0, + name_buffer, + &buffer_size, + 0, + 0, + 0, + 0) == ERROR_SUCCESS) + { + remove_section (section, name_buffer, true); + buffer_size = ACE_DEFAULT_BUFSIZE; + } + } + + int const errnum = ACE_TEXT_RegDeleteKey (base_key, sub_section); + if (errnum != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + return 0; +} + +int +ACE_Configuration_Win32Registry::enumerate_values (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name, + VALUETYPE& type) +{ + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; + DWORD buffer_size = ACE_DEFAULT_BUFSIZE; + DWORD value_type; + + int rc = ACE_TEXT_RegEnumValue (base_key, + index, + name_buffer, + &buffer_size, + 0, + &value_type, + 0, + 0); + if (rc == ERROR_NO_MORE_ITEMS) + return 1; + else if (rc != ERROR_SUCCESS) + { + errno = rc; + return -1; + } + + name = name_buffer; + + switch (value_type) + { + case REG_BINARY: + type = BINARY; + break; + case REG_SZ: + type = STRING; + break; + case REG_DWORD: + type = INTEGER; + break; + default: + type = INVALID; + } + + return 0; +} + +int +ACE_Configuration_Win32Registry::enumerate_sections (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name) +{ + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + ACE_TCHAR name_buffer[ACE_DEFAULT_BUFSIZE]; + DWORD buffer_size = ACE_DEFAULT_BUFSIZE; + int rc = ACE_TEXT_RegEnumKeyEx (base_key, + index, + name_buffer, + &buffer_size, + 0, + 0, + 0, + 0); + if (rc == ERROR_NO_MORE_ITEMS) + return 1; + else if (rc != ERROR_MORE_DATA && rc != ERROR_SUCCESS) + { + errno = rc; + return -1; + } + + name = name_buffer; + + return 0; +} + +int +ACE_Configuration_Win32Registry::set_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const ACE_TString& value) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + int errnum; + DWORD len = static_cast (value.length () + 1); + len *= sizeof (ACE_TCHAR); + if ((errnum = ACE_TEXT_RegSetValueEx (base_key, + t_name, + 0, + REG_SZ, + (BYTE *) value.fast_rep (), + len)) + != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + return 0; +} + +int +ACE_Configuration_Win32Registry::set_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int value) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + int errnum; + if ((errnum = ACE_TEXT_RegSetValueEx (base_key, + t_name, + 0, + REG_DWORD, + (BYTE *) &value, + sizeof (value))) != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + return 0; +} + +int +ACE_Configuration_Win32Registry::set_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const void* data, + size_t length) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + int errnum; + if ((errnum = ACE_TEXT_RegSetValueEx (base_key, + t_name, + 0, + REG_BINARY, + (BYTE *) data, + static_cast (length))) + != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + return 0; +} + +int +ACE_Configuration_Win32Registry::get_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + ACE_TString& value) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + // Get the size of the binary data from windows + int errnum; + DWORD buffer_length = 0; + DWORD type; + if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, + t_name, + 0, + &type, + (BYTE *) 0, + &buffer_length)) != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + if (type != REG_SZ) + { + errno = ERROR_INVALID_DATATYPE; + return -1; + } + + ACE_TCHAR *temp = 0; + ACE_NEW_RETURN (temp, + ACE_TCHAR[buffer_length], + -1); + + ACE_Auto_Basic_Array_Ptr buffer (temp); + + if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, + t_name, + 0, + &type, + (BYTE *) buffer.get (), + &buffer_length)) != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + value = buffer.get (); + return 0; +} + +int +ACE_Configuration_Win32Registry::get_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int& value) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + int errnum; + DWORD length = sizeof (value); + DWORD type; + if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, + t_name, + 0, + &type, + (BYTE *) &value, + &length)) != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + if (type != REG_DWORD) + { + errno = ERROR_INVALID_DATATYPE; + return -1; + } + + return 0; +} + +int +ACE_Configuration_Win32Registry::get_binary_value ( + const ACE_Configuration_Section_Key &key, + const ACE_TCHAR *name, + void *&data, + size_t &length) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + // Get the size of the binary data from windows + int errnum; + DWORD buffer_length = 0; + DWORD type; + if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, + t_name, + 0, + &type, + (BYTE *) 0, + &buffer_length)) != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + if (type != REG_BINARY) + { + errno = ERROR_INVALID_DATATYPE; + return -1; + } + + length = buffer_length; + + BYTE * the_data = 0; + ACE_NEW_RETURN (the_data, BYTE[length], -1); + ACE_Auto_Basic_Array_Ptr safe_data (the_data); + + if ((errnum = ACE_TEXT_RegQueryValueEx (base_key, + t_name, + 0, + &type, + the_data, + &buffer_length)) != ERROR_SUCCESS) + { + data = 0; + errno = errnum; + return -1; + } + + data = safe_data.release (); + + return 0; +} + +int +ACE_Configuration_Win32Registry::find_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + VALUETYPE& type_out) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + DWORD buffer_length=0; + DWORD type; + int result=ACE_TEXT_RegQueryValueEx (base_key, + t_name, + 0, + &type, + 0, + &buffer_length); + if (result != ERROR_SUCCESS) + { + errno = result; + return -1; + } + + switch (type) + { + case REG_SZ: + type_out = STRING; + break; + case REG_DWORD: + type_out = INTEGER; + break; + case REG_BINARY: + type_out = BINARY; + break; + default: + return -1; // unknown type + } + + return 0; +} + +int +ACE_Configuration_Win32Registry::remove_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name) +{ + const ACE_TCHAR *t_name = temp_name (name); + if (validate_value_name (t_name)) + return -1; + + HKEY base_key; + if (load_key (key, base_key)) + return -1; + + int errnum; + if ((errnum = ACE_TEXT_RegDeleteValue (base_key, t_name)) != ERROR_SUCCESS) + { + errno = errnum; + return -1; + } + + return 0; +} + + +int +ACE_Configuration_Win32Registry::load_key (const ACE_Configuration_Section_Key& key, + HKEY& hKey) +{ + ACE_Section_Key_Win32* pKey = dynamic_cast (get_internal_key (key)); + if (!pKey) + return -1; + + hKey = pKey->hKey_; + return 0; +} + +HKEY +ACE_Configuration_Win32Registry::resolve_key (HKEY hKey, + const ACE_TCHAR* path, + int create) +{ + HKEY result = 0; + // Make a copy of hKey + int errnum; +#if defined (ACE_HAS_WINCE) + if ((errnum = RegOpenKeyEx (hKey, 0, 0, 0, &result)) != ERROR_SUCCESS) +#else + if ((errnum = RegOpenKey (hKey, 0, &result)) != ERROR_SUCCESS) +#endif // ACE_HAS_WINCE + { + errno = errnum; + return 0; + } + + // recurse through the path + ACE_TCHAR *temp_path = 0; + ACE_NEW_RETURN (temp_path, + ACE_TCHAR[ACE_OS::strlen (path) + 1], + 0); + ACE_Auto_Basic_Array_Ptr pData (temp_path); + ACE_OS::strcpy (pData.get (), path); + ACE_Tokenizer parser (pData.get ()); + parser.delimiter_replace ('\\', '\0'); + parser.delimiter_replace ('/', '\0'); + + for (ACE_TCHAR *temp = parser.next (); + temp != 0; + temp = parser.next ()) + { + // Open the key + HKEY subkey; + +#if defined (ACE_HAS_WINCE) + if ((errnum = ACE_TEXT_RegOpenKeyEx (result, + temp, + 0, + 0, + &subkey)) != ERROR_SUCCESS) +#else + if ((errnum = ACE_TEXT_RegOpenKey (result, + temp, + &subkey)) != ERROR_SUCCESS) +#endif // ACE_HAS_WINCE + { + // try creating it + if (!create || (errnum = ACE_TEXT_RegCreateKeyEx (result, + temp, + 0, + 0, + 0, + KEY_ALL_ACCESS, + 0, + &subkey, + (PDWORD) 0 + )) !=ERROR_SUCCESS) + { + errno = errnum; + // error + ::RegCloseKey (result); + return 0; + } + } + // release our open key handle + ::RegCloseKey (result); + result = subkey; + } + + return result; +} + +#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */ + +/////////////////////////////////////////////////////////////// + +ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void) + : type_ (ACE_Configuration::INVALID), + length_ (0) +{ + this->data_.ptr_ = 0; +} + +ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (ACE_TCHAR* string) + : type_ (ACE_Configuration::STRING), + length_ (0) +{ + this->data_.ptr_ = string; +} + +ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (u_int integer) + : type_ (ACE_Configuration::INTEGER), + length_ (0) +{ + this->data_.int_ = integer; +} + +ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void* data, size_t length) + : type_ (ACE_Configuration::BINARY), + length_ (length) +{ + this->data_.ptr_ = data; +} + +ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs) + : type_ (rhs.type_), + data_ (rhs.data_), + length_ (rhs.length_) +{ +} + +ACE_Configuration_Value_IntId::~ACE_Configuration_Value_IntId (void) +{ +} + +ACE_Configuration_Value_IntId& ACE_Configuration_Value_IntId::operator= (const ACE_Configuration_Value_IntId& rhs) +{ + if (this != &rhs) + { + type_ = rhs.type_; + data_ = rhs.data_; + length_ = rhs.length_; + } + return *this; +} + +void +ACE_Configuration_Value_IntId::free (ACE_Allocator *alloc) +{ + if (this->type_ == ACE_Configuration::STRING + || this->type_ == ACE_Configuration::BINARY) + alloc->free (data_.ptr_); + // Do nothing in other cases... +} + +ACE_Configuration_ExtId::ACE_Configuration_ExtId (void) + : name_ (0) +{ +} + +ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_TCHAR* name) + : name_ (name) +{ +} + +ACE_Configuration_ExtId::ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs) + : name_ (rhs.name_) +{ +} + +ACE_Configuration_ExtId::~ACE_Configuration_ExtId (void) +{ +} + +ACE_Configuration_ExtId& ACE_Configuration_ExtId::operator= (const ACE_Configuration_ExtId& rhs) +{ + if (this != &rhs) + name_ = rhs.name_; + + return *this; +} + +bool +ACE_Configuration_ExtId::operator== (const ACE_Configuration_ExtId& rhs) const +{ + return (ACE_OS::strcasecmp (name_, rhs.name_) == 0); +} + +bool +ACE_Configuration_ExtId::operator!= (const ACE_Configuration_ExtId& rhs) const +{ + return !this->operator== (rhs); +} + +u_long +ACE_Configuration_ExtId::hash (void) const +{ + ACE_TString temp (name_, 0, false); + return temp.hash (); +} + +void +ACE_Configuration_ExtId::free (ACE_Allocator *alloc) +{ + alloc->free ((void *) (name_)); +} + +/////////////////////////////////////////////////////////////////////// + +ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (void) + : value_hash_map_ (0), + section_hash_map_ (0) +{ +} + +ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, SUBSECTION_MAP* section_hash_map) + : value_hash_map_ (value_hash_map), + section_hash_map_ (section_hash_map) +{ +} + +ACE_Configuration_Section_IntId::ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs) + : value_hash_map_ (rhs.value_hash_map_), + section_hash_map_ (rhs.section_hash_map_) +{ + +} + +ACE_Configuration_Section_IntId::~ACE_Configuration_Section_IntId () +{ +} + +ACE_Configuration_Section_IntId& +ACE_Configuration_Section_IntId::operator= (const ACE_Configuration_Section_IntId& rhs) +{ + if (this != &rhs) + { + value_hash_map_ = rhs.value_hash_map_; + section_hash_map_ = rhs.section_hash_map_; + } + return *this; +} + +void +ACE_Configuration_Section_IntId::free (ACE_Allocator *alloc) +{ + alloc->free ((void *) (value_hash_map_)); + alloc->free ((void *) (section_hash_map_)); +} + +ACE_Configuration_Section_Key_Heap::ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path) + : path_ (0), + value_iter_ (0), + section_iter_ (0) +{ + path_ = ACE_OS::strdup (path); +} + +ACE_Configuration_Section_Key_Heap::~ACE_Configuration_Section_Key_Heap () +{ + delete value_iter_; + delete section_iter_; + ACE_OS::free (path_); +} + +////////////////////////////////////////////////////////////////////////////// + +ACE_Configuration_Heap::ACE_Configuration_Heap (void) + : allocator_ (0), + index_ (0), + default_map_size_ (0) +{ + ACE_Configuration_Section_Key_Heap *temp = 0; + + ACE_NEW (temp, ACE_Configuration_Section_Key_Heap (ACE_TEXT (""))); + root_ = ACE_Configuration_Section_Key (temp); +} + +ACE_Configuration_Heap::~ACE_Configuration_Heap (void) +{ + if (allocator_) + allocator_->sync (); + + delete allocator_; +} + +int +ACE_Configuration_Heap::open (size_t default_map_size) +{ + if (this->allocator_ != 0) + { + errno = EBUSY; + return -1; + } + + default_map_size_ = default_map_size; + // Create the allocator with the appropriate options. + // The name used for the lock is the same as one used + // for the file. + ACE_NEW_RETURN (this->allocator_, + HEAP_ALLOCATOR (), + -1); + return create_index (); +} + + +int +ACE_Configuration_Heap::open (const ACE_TCHAR* file_name, + void* base_address, + size_t default_map_size) +{ + if (this->allocator_ != 0) + { + errno = EBUSY; + return -1; + } + + default_map_size_ = default_map_size; + + // Make sure that the file name is of the legal length. + if (ACE_OS::strlen (file_name) >= MAXNAMELEN + MAXPATHLEN) + { + errno = ENAMETOOLONG; + return -1; + } + + ACE_MMAP_Memory_Pool::OPTIONS options (base_address); + + // Create the allocator with the appropriate options. The name used + // for the lock is the same as one used for the file. + ACE_NEW_RETURN (this->allocator_, + PERSISTENT_ALLOCATOR (file_name, + file_name, + &options), + -1); + +#if !defined (ACE_LACKS_ACCESS) + // Now check if the backing store has been created successfully. + if (ACE_OS::access (file_name, F_OK) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("create_index\n")), + -1); +#endif /* ACE_LACKS_ACCESS */ + + return create_index (); +} + +int +ACE_Configuration_Heap::create_index (void) +{ + void *section_index = 0; + + // This is the easy case since if we find hash table in the + // memory-mapped file we know it's already initialized. + if (this->allocator_->find (ACE_CONFIG_SECTION_INDEX, section_index) == 0) + this->index_ = (SECTION_MAP *) section_index; + + // Create a new (because we've just created a new + // memory-mapped file). + else + { + size_t index_size = sizeof (SECTION_MAP); + section_index = this->allocator_->malloc (index_size); + + if (section_index == 0 + || create_index_helper (section_index) == -1 + || this->allocator_->bind (ACE_CONFIG_SECTION_INDEX, + section_index) == -1) + { + // Attempt to clean up. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("create_index failed\n"))); + this->allocator_->remove (); + return -1; + } + // Add the root section + return new_section (ACE_TEXT (""), root_); + } + return 0; +} + +int +ACE_Configuration_Heap::create_index_helper (void *buffer) +{ + ACE_ASSERT (this->allocator_); + this->index_ = new (buffer) SECTION_MAP (this->allocator_); + return 0; +} + +int +ACE_Configuration_Heap::load_key (const ACE_Configuration_Section_Key& key, + ACE_TString& name) +{ + ACE_ASSERT (this->allocator_); + ACE_Configuration_Section_Key_Heap* pKey = + dynamic_cast (get_internal_key (key)); + + if (!pKey) + { + return -1; + } + + ACE_TString temp (pKey->path_, 0, false); + name.assign_nocopy (temp); + return 0; +} + + +int +ACE_Configuration_Heap::add_section (const ACE_Configuration_Section_Key& base, + const ACE_TCHAR* sub_section, + ACE_Configuration_Section_Key& result) +{ + ACE_ASSERT (this->allocator_); + ACE_TString section; + if (load_key (base, section)) + return -1; + + // Find the base section + ACE_Configuration_ExtId ExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId IntId; + if (index_->find (ExtId, IntId, allocator_)) + return -1; + + // See if this section already exists + ACE_Configuration_ExtId SubSectionExtId (sub_section); + int ignored = 0; + + if (!IntId.section_hash_map_->find (SubSectionExtId, ignored, allocator_)) + { + // already exists! + errno = EEXIST; + return -1; + } + + // Create the new section name + // only prepend a separater if were not at the root + if (section.length ()) + section += ACE_TEXT ("\\"); + + section += sub_section; + + // Add it to the base section + ACE_TCHAR* pers_name = (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (sub_section) + 1) * sizeof (ACE_TCHAR)); + ACE_OS::strcpy (pers_name, sub_section); + ACE_Configuration_ExtId SSExtId (pers_name); + if (IntId.section_hash_map_->bind (SSExtId, ignored, allocator_)) + { + allocator_->free (pers_name); + return -1; + } + return (new_section (section, result)); +} + +int +ACE_Configuration_Heap::new_section (const ACE_TString& section, + ACE_Configuration_Section_Key& result) +{ + ACE_ASSERT (this->allocator_); + // Create a new section and add it to the global list + + // Allocate memory for items to be stored in the table. + size_t section_len = section.length () + 1; + ACE_TCHAR *ptr = (ACE_TCHAR*) this->allocator_->malloc (section_len * sizeof (ACE_TCHAR)); + + int return_value = -1; + + if (ptr == 0) + return -1; + else + { + // Populate memory with data. + ACE_OS::strcpy (ptr, section.fast_rep ()); + + void *value_hash_map = 0; + size_t map_size = sizeof (VALUE_MAP); + value_hash_map = this->allocator_->malloc (map_size); + + // If allocation failed ... + if (value_hash_map == 0) + return -1; + + // Initialize allocated hash map through placement new. + if (value_open_helper (default_map_size_, value_hash_map ) == -1) + { + this->allocator_->free (value_hash_map ); + return -1; + } + + // create the section map + void* section_hash_map = 0; + map_size = sizeof (SUBSECTION_MAP); + section_hash_map = this->allocator_->malloc (map_size); + + // If allocation failed + if (section_hash_map == 0) + return -1; + + // initialize allocated hash map through placement new + if (section_open_helper (default_map_size_, section_hash_map) == -1) + { + this->allocator_->free (value_hash_map ); + this->allocator_->free (section_hash_map); + return -1; + } + + ACE_Configuration_ExtId name (ptr); + ACE_Configuration_Section_IntId entry ((VALUE_MAP*) value_hash_map, + (SUBSECTION_MAP*) section_hash_map); + + // Do a normal bind. This will fail if there's already an + // entry with the same name. + return_value = this->index_->bind (name, entry, this->allocator_); + + if (return_value == 1 /* Entry already existed so bind failed. */ + || return_value == -1 /* Unable to bind for other reasons. */) + { + // Free our dynamically allocated memory. + this->allocator_->free (static_cast (ptr)); + return return_value; + } + + // If bind () succeed, it will automatically sync + // up the map manager entry. However, we must sync up our + // name/value memory. + this->allocator_->sync (ptr, section_len); + } + + // set the result + ACE_Configuration_Section_Key_Heap *temp; + ACE_NEW_RETURN (temp, + ACE_Configuration_Section_Key_Heap (ptr), + -1); + result = ACE_Configuration_Section_Key (temp); + return return_value; +} + +int +ACE_Configuration_Heap::value_open_helper (size_t hash_table_size, + void *buffer) +{ + ACE_ASSERT (this->allocator_); + new (buffer) VALUE_MAP (hash_table_size, this->allocator_); + return 0; +} + +int +ACE_Configuration_Heap::section_open_helper (size_t hash_table_size, + void *buffer) +{ + ACE_ASSERT (this->allocator_); + new (buffer) SUBSECTION_MAP (hash_table_size, this->allocator_); + return 0; +} + +int +ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base, + const ACE_TCHAR* sub_section, + int create, + ACE_Configuration_Section_Key& result) +{ + ACE_ASSERT (this->allocator_); + if (validate_name (sub_section, 1)) // 1 == allow_path + return -1; + + result = base; + + for (const ACE_TCHAR* separator; + (separator = ACE_OS::strchr (sub_section, ACE_TEXT ('\\'))) != 0; + ) + { + ACE_TString simple_section (sub_section, separator - sub_section); + int ret_val = + open_simple_section (result, simple_section.c_str (), create, result); + if (ret_val) + return ret_val; + sub_section = separator + 1; + } + + return open_simple_section (result, sub_section, create, result); +} + +int +ACE_Configuration_Heap::open_simple_section (const ACE_Configuration_Section_Key& base, + const ACE_TCHAR* sub_section, + int create, + ACE_Configuration_Section_Key& result) +{ + ACE_TString section (0, 0, false); + + if (load_key (base, section)) + { + return -1; + } + + // Only add the \\ if were not at the root + if (section.length ()) + { + section += ACE_TEXT ("\\"); + } + + section += sub_section; + + // resolve the section + ACE_Configuration_ExtId ExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId IntId; + + if (index_->find (ExtId, IntId, allocator_)) + { + if (!create) + { + errno = ENOENT; + return -1; + } + + return add_section (base, sub_section, result); + } + + ACE_Configuration_Section_Key_Heap *temp; + ACE_NEW_RETURN (temp, + ACE_Configuration_Section_Key_Heap (section.fast_rep ()), + -1); + result = ACE_Configuration_Section_Key (temp); + return 0; +} + +int +ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* sub_section, + bool recursive) +{ + ACE_ASSERT (this->allocator_); + if (validate_name (sub_section)) + return -1; + + ACE_TString section; + if (load_key (key, section)) + return -1; + + // Find this key + ACE_Configuration_ExtId ParentExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId ParentIntId; + if (index_->find (ParentExtId, ParentIntId, allocator_)) + return -1;// no parent key + + // Find this subkey + if (section.length ()) + section += ACE_TEXT ("\\"); + + section += sub_section; + ACE_Configuration_ExtId SectionExtId (section.fast_rep ()); + SECTION_HASH::ENTRY* section_entry = 0; + SECTION_HASH* hashmap = index_; + if (hashmap->find (SectionExtId, section_entry)) + return -1; + + if (recursive) + { + ACE_Configuration_Section_Key section; + if (open_section (key, sub_section, 0, section)) + return -1; + + int index = 0; + ACE_TString name; + while (!enumerate_sections (section, index, name)) + { + if (remove_section (section, name.fast_rep (), true)) + return -1; + + ++index; + } + } + + // Now make sure we dont have any subkeys + if (section_entry->int_id_.section_hash_map_->current_size ()) + { + errno = ENOTEMPTY; + return -1; + } + + // Now remove subkey from parent key + ACE_Configuration_ExtId SubSExtId (sub_section); + SUBSECTION_HASH::ENTRY* subsection_entry; + if (((SUBSECTION_HASH*)ParentIntId.section_hash_map_)-> + find (SubSExtId, subsection_entry)) + return -1; + + if (ParentIntId.section_hash_map_->unbind (SubSExtId, allocator_)) + return -1; + + subsection_entry->ext_id_.free (allocator_); + + // Remember the pointers so we can free them after we unbind + ACE_Configuration_ExtId ExtIdToFree (section_entry->ext_id_); + ACE_Configuration_Section_IntId IntIdToFree (section_entry->int_id_); + + // iterate over all values and free memory + VALUE_HASH* value_hash_map = section_entry->int_id_.value_hash_map_; + VALUE_HASH::ITERATOR value_iter = value_hash_map->begin (); + while (!value_iter.done ()) + { + VALUE_HASH::ENTRY* value_entry = 0; + if (!value_iter.next (value_entry)) + return 1; + + value_entry->ext_id_.free (allocator_); + value_entry->int_id_.free (allocator_); + + value_iter.advance (); + } + + // remove it + if (index_->unbind (SectionExtId, allocator_)) + return -1; + + value_hash_map->close (); + section_entry->int_id_.section_hash_map_->close (allocator_); + + // Free the memory + ExtIdToFree.free (allocator_); + IntIdToFree.free (allocator_); + + return 0; +} + +int +ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name, + VALUETYPE& type) +{ + ACE_ASSERT (this->allocator_); + ACE_Configuration_Section_Key_Heap* pKey = + dynamic_cast (get_internal_key (key)); + if (!pKey) + return -1; + + name = pKey->path_; + + // resolve the section + ACE_Configuration_ExtId ExtId (pKey->path_); + ACE_Configuration_Section_IntId IntId; + if (index_->find (ExtId, IntId, allocator_)) + return -1; + + // Handle iterator resets + if (index == 0) + { + ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex>* hash_map = IntId.value_hash_map_; + delete pKey->value_iter_; + + ACE_NEW_RETURN (pKey->value_iter_, + VALUE_HASH::ITERATOR (hash_map->begin ()), + -1); + } + + // Get the next entry + ACE_Hash_Map_Entry* entry = 0; + + if (!pKey->value_iter_->next (entry)) + return 1; + + // Return the value of the iterator and advance it + name = entry->ext_id_.name_; + type = entry->int_id_.type_; + pKey->value_iter_->advance (); + + return 0; +} + +int +ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name) +{ + ACE_ASSERT (this->allocator_); + // cast to a heap section key + ACE_Configuration_Section_Key_Heap* pKey = + dynamic_cast (get_internal_key (key)); + if (!pKey) + return -1; // not a heap key! + + // resolve the section + ACE_Configuration_ExtId ExtId (pKey->path_); + ACE_Configuration_Section_IntId IntId; + if (index_->find (ExtId, IntId, allocator_)) + return -1; // unknown section + + // Handle iterator resets + if (index == 0) + { + if (pKey->section_iter_) + delete pKey->section_iter_; + + ACE_NEW_RETURN (pKey->section_iter_, + SUBSECTION_HASH::ITERATOR (IntId.section_hash_map_->begin ()), + -1); + } + + // Get the next entry + ACE_Hash_Map_Entry* entry = 0; + if (!pKey->section_iter_->next (entry)) + return 1; + + // Return the value of the iterator and advance it + pKey->section_iter_->advance (); + name = entry->ext_id_.name_; + + return 0; +} + +int +ACE_Configuration_Heap::set_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const ACE_TString& value) +{ + ACE_ASSERT (this->allocator_); + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + ACE_TString section; + if (load_key (key, section)) + return -1; + + ACE_Configuration_ExtId section_ext (section.fast_rep ()); + ACE_Configuration_Section_IntId section_int; + if (index_->find (section_ext, section_int, allocator_)) + return -1; + + // Get the entry for this item (if it exists) + VALUE_HASH::ENTRY* entry = 0; + ACE_Configuration_ExtId item_name (t_name); + if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) + { + // found item, replace it + // Free the old value + entry->int_id_.free (allocator_); + // Allocate the new value in this heap + ACE_TCHAR* pers_value = + (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR)); + ACE_OS::strcpy (pers_value, value.fast_rep ()); + ACE_Configuration_Value_IntId new_value_int (pers_value); + entry->int_id_ = new_value_int; + } + else + { + // it doesn't exist, bind it + ACE_TCHAR* pers_name = + (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); + ACE_OS::strcpy (pers_name, t_name); + ACE_TCHAR* pers_value = + (ACE_TCHAR *) allocator_->malloc ((value.length () + 1) * sizeof (ACE_TCHAR)); + ACE_OS::strcpy (pers_value, value.fast_rep ()); + ACE_Configuration_ExtId item_name (pers_name); + ACE_Configuration_Value_IntId item_value (pers_value); + if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) + { + allocator_->free (pers_value); + allocator_->free (pers_name); + return -1; + } + return 0; + } + + return 0; +} + +int +ACE_Configuration_Heap::set_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int value) +{ + ACE_ASSERT (this->allocator_); + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + // Get the section name from the key + ACE_TString section; + if (load_key (key, section)) + return -1; + + // Find this section + ACE_Configuration_ExtId section_ext (section.fast_rep ()); + ACE_Configuration_Section_IntId section_int; + if (index_->find (section_ext, section_int, allocator_)) + return -1; // section does not exist + + // Get the entry for this item (if it exists) + VALUE_HASH::ENTRY* entry = 0; + ACE_Configuration_ExtId item_name (t_name); + if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) + { + // found item, replace it + ACE_Configuration_Value_IntId new_value_int (value); + entry->int_id_ = new_value_int; + } + else + { + // it doesn't exist, bind it + ACE_TCHAR* pers_name = + (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); + ACE_OS::strcpy (pers_name, t_name); + ACE_Configuration_ExtId item_name (pers_name); + ACE_Configuration_Value_IntId item_value (value); + if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) + { + allocator_->free (pers_name); + return -1; + } + return 0; + } + + return 0; +} + +int +ACE_Configuration_Heap::set_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const void* data, + size_t length) +{ + ACE_ASSERT (this->allocator_); + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + // Get the section name from the key + ACE_TString section; + if (load_key (key, section)) + return -1; + + // Find this section + ACE_Configuration_ExtId section_ext (section.fast_rep ()); + ACE_Configuration_Section_IntId section_int; + if (index_->find (section_ext, section_int, allocator_)) + return -1; // section does not exist + + // Get the entry for this item (if it exists) + VALUE_HASH::ENTRY* entry = 0; + ACE_Configuration_ExtId item_name (t_name); + if (section_int.value_hash_map_->VALUE_HASH::find (item_name, entry) == 0) + { + // found item, replace it + // Free the old value + entry->int_id_.free (allocator_); + // Allocate the new value in this heap + ACE_TCHAR* pers_value = (ACE_TCHAR *) allocator_->malloc (length); + ACE_OS::memcpy (pers_value, data, length); + ACE_Configuration_Value_IntId new_value_int (pers_value, length); + entry->int_id_ = new_value_int; + } + else + { + // it doesn't exist, bind it + ACE_TCHAR* pers_name = + (ACE_TCHAR *) allocator_->malloc ((ACE_OS::strlen (t_name) + 1) * sizeof (ACE_TCHAR)); + ACE_OS::strcpy (pers_name, t_name); + ACE_TCHAR* pers_value = (ACE_TCHAR *) allocator_->malloc (length); + ACE_OS::memcpy (pers_value, data, length); + ACE_Configuration_ExtId item_name (pers_name); + ACE_Configuration_Value_IntId item_value (pers_value, length); + if (section_int.value_hash_map_->bind (item_name, item_value, allocator_)) + { + allocator_->free (pers_value); + allocator_->free (pers_name); + return -1; + } + return 0; + } + + return 0; +} + +int +ACE_Configuration_Heap::get_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + ACE_TString& value) +{ + ACE_ASSERT (this->allocator_); + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + // Get the section name from the key + ACE_TString section; + if (load_key (key, section)) + return -1; + + // Find this section + ACE_Configuration_ExtId ExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId IntId; + if (index_->find (ExtId, IntId, allocator_)) + return -1; // section does not exist + + // See if it exists first + ACE_Configuration_ExtId VExtId (t_name); + ACE_Configuration_Value_IntId VIntId; + if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_)) + return -1; // unknown value + + // Check type + if (VIntId.type_ != ACE_Configuration::STRING) + { + errno = ENOENT; + return -1; + } + + // everythings ok, return the data + value = static_cast (VIntId.data_.ptr_); + return 0; +} + +int +ACE_Configuration_Heap::get_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int& value) +{ + ACE_ASSERT (this->allocator_); + + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + // Get the section name from the key + ACE_TString section (0, 0, false); + + if (this->load_key (key, section) != 0) + { + return -1; + } + + // Find this section + ACE_Configuration_ExtId ExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId IntId; + + if (index_->find (ExtId, IntId, allocator_) != 0) + { + return -1; // section does not exist + } + + + // See if it exists first + ACE_Configuration_ExtId VExtId (t_name); + ACE_Configuration_Value_IntId VIntId; + + if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_) != 0) + { + return -1; // unknown value + } + + // Check type + if (VIntId.type_ != ACE_Configuration::INTEGER) + { + errno = ENOENT; + return -1; + } + + // Everythings ok, return the data + value = VIntId.data_.int_; + return 0; +} + +int +ACE_Configuration_Heap::get_binary_value ( + const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + void*& data, + size_t& length) +{ + ACE_ASSERT (this->allocator_); + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + // Get the section name from the key + ACE_TString section; + if (load_key (key, section)) + return -1; + + // Find this section + ACE_Configuration_ExtId ExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId IntId; + if (index_->find (ExtId, IntId, allocator_)) + return -1; // section does not exist + + ACE_Configuration_ExtId VExtId (t_name); + ACE_Configuration_Value_IntId VIntId; + // See if it exists first + if (IntId.value_hash_map_->find (VExtId, VIntId, allocator_)) + return -1; // unknown value + + // Check type + if (VIntId.type_ != ACE_Configuration::BINARY) + { + errno = ENOENT; + return -1; + } + + // Make a copy + ACE_NEW_RETURN (data, char[VIntId.length_], -1); + ACE_OS::memcpy (data, VIntId.data_.ptr_, VIntId.length_); + length = VIntId.length_; + return 0; +} + +int +ACE_Configuration_Heap::find_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + VALUETYPE& type_out) +{ + ACE_ASSERT (this->allocator_); + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + // Get the section name from the key + ACE_TString section; + if (load_key (key, section)) + return -1; + + // Find this section + ACE_Configuration_ExtId ExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId IntId; + if (index_->find (ExtId, IntId, allocator_)) + return -1; // section does not exist + + // Find it + ACE_Configuration_ExtId ValueExtId (t_name); + VALUE_HASH::ENTRY* value_entry = 0; + if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry)) + return -1; // value does not exist + + type_out = value_entry->int_id_.type_; + return 0; +} + +int +ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name) +{ + ACE_ASSERT (this->allocator_); + const ACE_TCHAR *t_name = name ? name : &this->NULL_String_; + if (validate_value_name (t_name)) + return -1; + + // Get the section name from the key + ACE_TString section; + if (load_key (key, section)) + return -1; + + // Find this section + ACE_Configuration_ExtId ExtId (section.fast_rep ()); + ACE_Configuration_Section_IntId IntId; + if (index_->find (ExtId, IntId, allocator_)) + return -1; // section does not exist + + // Find it + ACE_Configuration_ExtId ValueExtId (t_name); + VALUE_HASH::ENTRY* value_entry = 0; + if (((VALUE_HASH *) IntId.value_hash_map_)->find (ValueExtId, value_entry)) + return -1; + + // free it + value_entry->ext_id_.free (allocator_); + value_entry->int_id_.free (allocator_); + + // Unbind it + if (IntId.value_hash_map_->unbind (ValueExtId, allocator_)) + return -1; + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Configuration.h b/externals/ace/Configuration.h new file mode 100644 index 0000000..3543619 --- /dev/null +++ b/externals/ace/Configuration.h @@ -0,0 +1,919 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Configuration.h + * + * $Id: Configuration.h 86348 2009-08-04 14:45:29Z shuston $ + * + * @author Chris Hafey + * + * The ACE configuration API provides a portable abstraction for + * program configuration similar to the Microsoft Windows registry. + * The API supports a tree based hierarchy of configuration sections. Each + * section contains other sections or values. Values may contain string, + * unsigned integer and binary data. + * + * @note These classes are not thread safe, if multiple threads use these + * classes, you are responsible for serializing access. + * + * For examples of using this class, see: + * -# The test code in ACE_wrappers/test + * -# wxConfigViewer, a Windows like Registry Editor for ACE_Configuration + * -# TAO's IFR, it makes extensive use of ACE_Configuration + * + * @todo Templatize this class with an ACE_LOCK to provide thread safety + */ +//============================================================================= + +#ifndef ACE_CONFIGURATION_H +#define ACE_CONFIGURATION_H +#include /**/ "ace/pre.h" + +#include "ace/SStringfwd.h" +#include "ace/Hash_Map_With_Allocator_T.h" +#include "ace/Malloc_T.h" +#include "ace/MMAP_Memory_Pool.h" +#include "ace/Local_Memory_Pool.h" +#include "ace/Synch_Traits.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// configurable parameters + +#if !defined (ACE_CONFIG_SECTION_INDEX) +# define ACE_CONFIG_SECTION_INDEX "Config_Section_Index" +#endif /* ! ACE_CONFIG_SECTION_INDEX */ + +#if !defined (ACE_DEFAULT_CONFIG_SECTION_SIZE) +#define ACE_DEFAULT_CONFIG_SECTION_SIZE 16 +#endif /* ACE_DEFAULT_CONFIG_SECTION_SIZE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Section_Key_Internal + * + * @internal + * + * @brief A base class for internal handles to section keys for + * configuration implementations + * + * Implementations subclass this base class to represent a + * section key. + */ +class ACE_Export ACE_Section_Key_Internal +{ +public: + /// Virtual destructor, make sure descendants are virtual! + virtual ~ACE_Section_Key_Internal (void); + + /// Increment reference count + virtual int add_ref (void); + + /// Decrement reference count. Will delete this if count gets to 0 + virtual int dec_ref (void); +protected: + ACE_Section_Key_Internal (void); + ACE_Section_Key_Internal (const ACE_Section_Key_Internal& rhs); + ACE_Section_Key_Internal& operator= (ACE_Section_Key_Internal& rhs); + + u_int ref_count_; +}; + +/** + * @class ACE_Configuration_Section_Key + * + * @brief Reference counted wrapper for ACE_Section_Key_Internal. + * + * Reference counted wrapper class for the abstract internal + * section key. A user gets one of these to represent a section + * in the configuration database. + */ +class ACE_Export ACE_Configuration_Section_Key +{ + friend class ACE_Configuration; +public: + /// Default constructor. + ACE_Configuration_Section_Key (void); + + /// Constructor that initializes to a pointer to a concrete internal key. + /** + * @param key The section key to reference. Calls add_ref() with @a key. + */ + explicit ACE_Configuration_Section_Key (ACE_Section_Key_Internal *key); + + /// Copy constructor, increments the reference count on the key. + ACE_Configuration_Section_Key (const ACE_Configuration_Section_Key &rhs); + + /// Destructor, decrements reference count on the referenced key. + ~ACE_Configuration_Section_Key (void); + + /// Assignment operator, increments reference count for this object + /// and decrements it on @a rhs. + ACE_Configuration_Section_Key & + operator= (const ACE_Configuration_Section_Key &rhs); +private: + ACE_Section_Key_Internal *key_; +}; + +/** + * @class ACE_Configuration + * + * @internal + * + * @brief Base class for configuration databases + * + * This class provides an interface for configuration databases. A concrete + * class is required that implements the interface. + * + * @sa ACE_Configuration_Heap + * @sa ACE_Configuration_Win32Registry + */ +class ACE_Export ACE_Configuration +{ +public: + /// Enumeration for the various types of values we can store. + enum VALUETYPE + { + STRING, + INTEGER, + BINARY, + INVALID + }; + + /// Destructor + virtual ~ACE_Configuration (void); + + /// Obtain a reference to the root section of this configuration. + /* + * @return Reference to the configuration's root section. Note that + * it is a const reference. + */ + virtual const ACE_Configuration_Section_Key& root_section (void) const; + + /** + * Opens a named section in an existing section. + * + * @param base Existing section in which to open the named section. + * @param sub_section Name of the section to open. + * @param create If zero, the named section must exist. If non-zero, + * the named section will be created if it does not exist. + * @param result Reference; receives the section key for the new + * section. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int open_section (const ACE_Configuration_Section_Key &base, + const ACE_TCHAR *sub_section, + int create, + ACE_Configuration_Section_Key& result) = 0; + + /// Removes a named section. + /** + * @param key Section key to remove the named section from. + * @param sub_section Name of the section to remove. + * @param recursive If true, any subkeys below @a sub_section are + * removed as well. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int remove_section (const ACE_Configuration_Section_Key &key, + const ACE_TCHAR *sub_section, + bool recursive) = 0; + + /** + * Enumerates through the values in a section. + * + * @param key Section key to iterate through. + * @param index Iteration position. Must be zero on the first call to + * iterate through @a key. Increment @a index by one on each + * successive call to this method. + * @param name Receives the value's name. + * @param type Receives the value's data type. + * + * @note You may not delete or add values while enumerating. If the + * section is modified during enumeration, results are undefined; + * you must restart the enumeration from index 0. + * + * @retval 0 for success, @a name and @a type are valid. + * @retval 1 there are no more values in the section. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int enumerate_values (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name, + VALUETYPE& type) = 0; + + /** + * Enumerates through the subsections in a section. + * + * @param key Section key to iterate through. + * @param index Iteration position. Must be zero on the first call to + * iterate through @a key. Increment @a index by one on each + * successive call to this method. + * @param name Receives the subsection's name. + * + * @note You may not modify the @a key section while enumerating. If the + * section is modified during enumeration, results are undefined; + * you must restart the enumeration from index 0. + * + * @retval 0 for success, @a name has a valid name. + * @retval 1 there are no more subsections in the section. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, + int index, ACE_TString& name) = 0; + + /// Sets a string-typed value. + /** + * @param key Configuration section to set the value in. + * @param name Name of the configuration value to set. If a value with + * the specified name exists, it is replaced. + * @param value The string to set the configuration value to. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int set_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const ACE_TString& value) = 0; + + /// Sets a integer-typed value. + /** + * @param key Configuration section to set the value in. + * @param name Name of the configuration value to set. If a value with + * the specified name exists, it is replaced. + * @param value The integer to set the configuration value to. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int set_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int value) = 0; + + /// Sets a binary-typed value. + /** + * @param key Configuration section to set the value in. + * @param name Name of the configuration value to set. If a value with + * the specified name exists, it is replaced. + * @param data Pointer to the binary data for the value. + * @param length Number of bytes for the new value. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int set_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const void* data, + size_t length) = 0; + + /// Gets a string-typed value. + /** + * @param key Configuration section to get the value from. + * @param name Name of the configuration value to get. + * @param value Receives the configuration value if it exists and + * has type STRING. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int get_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + ACE_TString& value) = 0; + + /// Gets an integer-typed value. + /** + * @param key Configuration section to get the value from. + * @param name Name of the configuration value to get. + * @param value Receives the configuration value if it exists and + * has type INTEGER. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int get_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int& value) = 0; + + /// Gets a binary-typed value. + /** + * @param key Configuration section to get the value from. + * @param name Name of the configuration value to get. + * @param data Receives a pointer to memory holding the binary data + * for the value. This method allocates the memory pointed + * to using operator new[]. The caller is responsible for + * freeing the memory using operator delete[]. + * @param length Receives the number of bytes in the value. + * + * @retval 0 for success; caller is responsible for freeing the + * returned memory. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int get_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + void*& data, + size_t& length) = 0; + + /** + * Retrieves the type of a named configuration value. + * + * @param key Configuration section to look up the name in. + * @param name Name of the configuration value to get the type of. + * @param type Receives the data type of the named value, if it exists. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int find_value(const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + VALUETYPE& type) = 0; + + /// Removes a named value. + /** + * @param key Configuration section to remove the named value from. + * @param name Name of the configuration value to remove. + * + * @retval 0 for success. + * @retval -1 for error; ACE_OS::last_error() retrieves error code. + */ + virtual int remove_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name) = 0; + + /** + * Expands @a path_in to @a key_out from @a key. If create is true, + * the subsections are created. Returns 0 on success, non zero on + * error The path consists of sections separated by the backslash + * '\' or forward slash '/'. + * Returns 0 on success, -1 if + virtual ~ACE_Section_Key_Win32 (void); + + // Not used + ACE_Section_Key_Win32 (const ACE_Section_Key_Win32& rhs); + ACE_Section_Key_Win32& operator= (const ACE_Section_Key_Win32& rhs); +}; + +/** + * @class ACE_Configuration_Win32Registry + * + * @brief The win32 registry implementation of a configuration database + * + * The win32 implementation basically makes calls through to the + * registry functions. The API is very similar so very little + * work must be done + */ +class ACE_Export ACE_Configuration_Win32Registry : public ACE_Configuration +{ +public: + + /** + * Constructor for registry configuration database. hKey is the + * base registry key to attach to. This class takes ownership of + * hKey, it will invoke on it upon destruction. + */ + explicit ACE_Configuration_Win32Registry (HKEY hKey); + + /// Destructor + virtual ~ACE_Configuration_Win32Registry (void); + + virtual int open_section (const ACE_Configuration_Section_Key& base, + const ACE_TCHAR* sub_section, + int create, + ACE_Configuration_Section_Key& result); + + virtual int remove_section (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* sub_section, + bool recursive); + + virtual int enumerate_values (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name, + VALUETYPE& type); + + virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name); + + virtual int set_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const ACE_TString& value); + + virtual int set_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int value); + + virtual int set_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const void* data, + size_t length); + + virtual int get_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + ACE_TString& value); + + virtual int get_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int& value); + + virtual int get_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + void*& data, + size_t& length); + + virtual int find_value(const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + VALUETYPE& type); + + /// Removes the the value @a name from @a key. returns non zero on error + virtual int remove_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name); + + /** + * This method traverses through . It is useful when + * you want the HKEY for a specific registry key, especially when + * initializing this implementation. Caller is responsible for + * closeing this key when it is no longer used. If create is 1 + * (default) the keys are create if they don't already exist. + * Returns 0 on error + */ + static HKEY resolve_key (HKEY hKey, + const ACE_TCHAR* path, + int create = 1); + virtual bool operator== (const ACE_Configuration_Win32Registry &rhs) const; + virtual bool operator!= (const ACE_Configuration_Win32Registry &rhs) const; + +protected: + + /// Gets the HKEY for a configuration section + int load_key (const ACE_Configuration_Section_Key& key, HKEY& hKey); + + // Not used + ACE_Configuration_Win32Registry (void); + ACE_Configuration_Win32Registry (const ACE_Configuration_Win32Registry& rhs); + ACE_Configuration_Win32Registry& operator= (const ACE_Configuration_Win32Registry& rhs); +}; +#endif /* ACE_WIN32 && !ACE_LACKS_WIN32_REGISTRY */ + +// ACE_Allocator version + +typedef ACE_Allocator_Adapter > + PERSISTENT_ALLOCATOR; +typedef ACE_Allocator_Adapter > + HEAP_ALLOCATOR; + +/** + * @class ACE_Configuration_ExtId + * + * @brief External ID for the section and value hash + * + * Contains a pointer to the section or value name. + */ +class ACE_Export ACE_Configuration_ExtId +{ +public: + /// Defeault ctor + ACE_Configuration_ExtId (void); + + /// Named constructor + explicit ACE_Configuration_ExtId (const ACE_TCHAR* name); + + /// Copy ctor + ACE_Configuration_ExtId (const ACE_Configuration_ExtId& rhs); + + /// destructor + ~ACE_Configuration_ExtId (void); + + /// Assignment operator + ACE_Configuration_ExtId& operator= (const ACE_Configuration_ExtId& rhs); + + /// Equality comparison operator (must match name_). + bool operator== (const ACE_Configuration_ExtId &rhs) const; + + /// Inequality comparison operator. + bool operator!= (const ACE_Configuration_ExtId &rhs) const; + + /// Frees the name of the value. needed since we don't know the + /// allocator name_ was created in + void free (ACE_Allocator *alloc); + + /// hash function is required in order for this class to be usable by + /// ACE_Hash_Map_Manager. + u_long hash (void) const; + + // = Data members. + + const ACE_TCHAR * name_; + + // Accessors + const ACE_TCHAR *name (void); +}; + +typedef ACE_Hash_Map_With_Allocator + SUBSECTION_MAP; +typedef ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex> + SUBSECTION_HASH; + +/// @deprecated Deprecated typedef. Use the SUBSECTION_HASH::ENTRY trait instead. +typedef SUBSECTION_HASH::ENTRY SUBSECTION_ENTRY; + +/** + * @class ACE_Configuration_Value_IntId + * + * @brief The section hash table internal value class + * + * This class is present as the internal portion of a section's + * value hash table It may store string, integer or binary data. + */ +class ACE_Export ACE_Configuration_Value_IntId +{ +public: + /// Default constructor + ACE_Configuration_Value_IntId (void); + + /// String constructor, takes ownership of string + explicit ACE_Configuration_Value_IntId (ACE_TCHAR* string); + + /// Integer constructor + explicit ACE_Configuration_Value_IntId (u_int integer); + + /// Binary constructor, takes ownership of data + ACE_Configuration_Value_IntId (void* data, size_t length); + + /// Copy ctor + ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs); + + /// Destructor + ~ACE_Configuration_Value_IntId (void); + + /// Assignment operator + ACE_Configuration_Value_IntId& operator= ( + const ACE_Configuration_Value_IntId& rhs); + + void free (ACE_Allocator *alloc); + + // = Data members. + + /** + * Points to the string value or binary data or IS the integer + * Length is only used when type_ == BINARY + */ + ACE_Configuration::VALUETYPE type_; + union { + void * ptr_; + u_int int_; + } data_; + size_t length_; +}; + +typedef ACE_Hash_Map_With_Allocator + VALUE_MAP; +typedef ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex> + VALUE_HASH; + +// Deprecated typedef. Use the VALUE_HASH::ENTRY trait instead. +typedef VALUE_HASH::ENTRY VALUE_ENTRY; + +/** + * @class ACE_Configuration_Section_IntId + * + * @brief The internal ID for a section hash table + * + * Contains a hash table containing value name/values + */ +class ACE_Export ACE_Configuration_Section_IntId +{ +public: + /// Default ctor + ACE_Configuration_Section_IntId (void); + + /// Named ctor + ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, + SUBSECTION_MAP* section_hash_map); + + /// Copy ctor + ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs); + + /// Destructor + ~ACE_Configuration_Section_IntId (void); + + /// Assignment operator + ACE_Configuration_Section_IntId& operator= ( + const ACE_Configuration_Section_IntId& rhs); + + /// Frees the hash table and all its values + void free (ACE_Allocator *alloc); + + // = Data Members. + VALUE_MAP* value_hash_map_; + + SUBSECTION_MAP* section_hash_map_; +}; + +typedef ACE_Hash_Map_With_Allocator + SECTION_MAP; +typedef ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex> + SECTION_HASH; + +// Deprecated typedef. Use the SECTION_HASH::ENTRY trait instead. +typedef SECTION_HASH::ENTRY SECTION_ENTRY; + +/** + * @class ACE_Configuration_Section_Key_Heap + * + * @brief Internal section key class for heap based configuration + * database. + * + * Contains a value iterator and full path name of section. + */ +class ACE_Export ACE_Configuration_Section_Key_Heap + : public ACE_Section_Key_Internal +{ +public: + /// Constructor based on the full path of the section + ACE_Configuration_Section_Key_Heap (const ACE_TCHAR* path); + + /// The path itself + ACE_TCHAR* path_; + + /// The value iterator + VALUE_HASH::ITERATOR* value_iter_; + + /// The sub section iterator + SUBSECTION_HASH::ITERATOR* section_iter_; +protected: + /// Destructor - will delete the iterators + virtual ~ACE_Configuration_Section_Key_Heap (void); + + // Not used + ACE_Configuration_Section_Key_Heap (const ACE_Configuration_Section_Key_Heap& rhs); + ACE_Configuration_Section_Key_Heap& operator= (const ACE_Configuration_Section_Key_Heap& rhs); +}; + +/** + * @class ACE_Configuration_Heap + * + * @brief The concrete implementation of a allocator based + * configuration database + * + * This class uses ACE's Allocators to manage a memory + * representation of a configuration database. A persistent heap + * may be used to store configurations persistently + * + * @note Before using this class you must call one of the open methods. + * + * @todo + * - Need to investigate what happens if memory mapped file gets mapped to + * a location different than it was created with. + */ +class ACE_Export ACE_Configuration_Heap : public ACE_Configuration +{ +public: + + /// Default ctor + ACE_Configuration_Heap (void); + + /// Destructor + virtual ~ACE_Configuration_Heap (void); + + /** + * Opens a configuration that allocates its memory from a memory-mapped file. + * This makes it possible to persist a configuration to permanent storage. + * This is not the same as exporting the configuration to a file; the + * memory-mapped file is not likely to be very readable by humans. + * + * @param file_name Name of the file to map into memory. + * + * @param base_address Address to map the base of @a file_name to. + * + * @param default_map_size Starting size for the internal hash tables that + * contain configuration information. + * + * @retval 0 for success. + * @retval -1 for error, with errno set to indicate the cause. If open() + * is called multiple times, errno will be @c EBUSY. + */ + int open (const ACE_TCHAR* file_name, + void* base_address = ACE_DEFAULT_BASE_ADDR, + size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE); + + /** + * Opens a configuration that allocates memory from the heap. + * + * @param default_map_size Starting size for the internal hash tables that + * contain configuration information. + * + * @retval 0 for success. + * @retval -1 for error, with errno set to indicate the cause. If open() + * is called multiple times, errno will be @c EBUSY. + */ + int open (size_t default_map_size = ACE_DEFAULT_CONFIG_SECTION_SIZE); + + virtual int open_section (const ACE_Configuration_Section_Key& base, + const ACE_TCHAR* sub_section, + int create, ACE_Configuration_Section_Key& result); + + virtual int remove_section (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* sub_section, + bool recursive); + + virtual int enumerate_values (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name, + VALUETYPE& type); + + virtual int enumerate_sections (const ACE_Configuration_Section_Key& key, + int index, + ACE_TString& name); + + virtual int set_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const ACE_TString& value); + + virtual int set_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int value); + + virtual int set_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + const void* data, + size_t length); + + virtual int get_string_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + ACE_TString& value); + + virtual int get_integer_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + u_int& value); + + virtual int get_binary_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + void* &data, + size_t &length); + + virtual int find_value(const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name, + VALUETYPE& type); + + /// Removes the the value @a name from @a key. returns non zero on error + virtual int remove_value (const ACE_Configuration_Section_Key& key, + const ACE_TCHAR* name); + +private: + /// @a sub_section may not contain path separators + int open_simple_section (const ACE_Configuration_Section_Key &base, + const ACE_TCHAR *sub_section, + int create, ACE_Configuration_Section_Key &result); + /// Adds a new section + int add_section (const ACE_Configuration_Section_Key &base, + const ACE_TCHAR *sub_section, + ACE_Configuration_Section_Key &result); + + /// Helper for the method. + int create_index (void); + + /// Helper for create_index() method: places hash table into an + /// allocated space. + int create_index_helper (void *buffer); + + int value_open_helper (size_t hash_table_size, void *buffer); + + int section_open_helper (size_t hash_table_size, void *buffer); + + int load_key (const ACE_Configuration_Section_Key& key, ACE_TString& name); + + int new_section (const ACE_TString& section, + ACE_Configuration_Section_Key& result); + + ACE_Configuration_Heap (const ACE_Configuration_Heap& rhs); + ACE_Configuration_Heap& operator= (const ACE_Configuration_Heap& rhs); + + ACE_Allocator *allocator_; + SECTION_MAP *index_; + size_t default_map_size_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Configuration.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIGURATION_H */ diff --git a/externals/ace/Configuration.inl b/externals/ace/Configuration.inl new file mode 100644 index 0000000..19c2c59 --- /dev/null +++ b/externals/ace/Configuration.inl @@ -0,0 +1,13 @@ +// -*- C++ -*- +// +// $Id: Configuration.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE const ACE_TCHAR* +ACE_Configuration_ExtId::name (void) +{ + return name_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Configuration_Import_Export.cpp b/externals/ace/Configuration_Import_Export.cpp new file mode 100644 index 0000000..ae489f0 --- /dev/null +++ b/externals/ace/Configuration_Import_Export.cpp @@ -0,0 +1,670 @@ +// $Id: Configuration_Import_Export.cpp 84565 2009-02-23 08:20:39Z johnnyw $ + +#include "ace/Configuration_Import_Export.h" +#include "ace/OS_Errno.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_ctype.h" +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Config_ImpExp_Base::ACE_Config_ImpExp_Base (ACE_Configuration& config) + : config_ (config) +{ +} + +ACE_Config_ImpExp_Base::~ACE_Config_ImpExp_Base (void) +{ +} + +ACE_Registry_ImpExp::ACE_Registry_ImpExp (ACE_Configuration& config) + : ACE_Config_ImpExp_Base (config) +{ +} + +ACE_Registry_ImpExp::~ACE_Registry_ImpExp (void) +{ +} + +// Imports the configuration database from filename. +// No existing data is removed. +int +ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) +{ + if (0 == filename) + { + errno = EINVAL; + return -1; + } + FILE* in = ACE_OS::fopen (filename, ACE_TEXT ("r")); + if (!in) + return -1; + + u_int buffer_size = 4096; + u_int read_pos = 0; + ACE_TCHAR *buffer = 0; + ACE_NEW_NORETURN (buffer, ACE_TCHAR[buffer_size]); + if (!buffer) + { + ACE_Errno_Guard guard (errno); + (void) ACE_OS::fclose (in); + return -1; + } + ACE_Configuration_Section_Key section; + ACE_TCHAR *end = 0; + + while (ACE_OS::fgets (buffer+read_pos, buffer_size - read_pos, in)) + { + // Check if we got all the line. + end = ACE_OS::strrchr (buffer + read_pos, + ACE_TEXT ('\n')); // look for end of line + if (!end) // we havn't reach the end of the line yet + { + // allocate a new buffer - double size the previous one + ACE_TCHAR *temp_buffer; + ACE_NEW_NORETURN (temp_buffer, ACE_TCHAR[buffer_size * 2]); + if (!temp_buffer) + { + ACE_Errno_Guard guard (errno); + delete [] buffer; + (void) ACE_OS::fclose (in); + return -1; + } + + // copy the beginnning of the line + ACE_OS::memcpy (temp_buffer, buffer, buffer_size); + read_pos = buffer_size - 1; + buffer_size *= 2; + delete [] buffer; + buffer = temp_buffer; + continue; + } + read_pos = 0; + + // Check for a comment + if (buffer[0] == ACE_TEXT (';') || buffer[0] == ACE_TEXT ('#')) + continue; + + if (buffer[0] == ACE_TEXT ('[')) + { + // We have a new section here, strip out the section name + end = ACE_OS::strrchr (buffer, ACE_TEXT (']')); + if (!end) + { + ACE_OS::fclose (in); + delete [] buffer; + return -3; + } + *end = 0; + + if (config_.expand_path (config_.root_section (), buffer + 1, section, 1)) + { + ACE_OS::fclose (in); + delete [] buffer; + return -3; + } + continue; + } // end if firs char is a [ + + if (buffer[0] == ACE_TEXT ('"')) + { + // we have a value + end = ACE_OS::strchr (buffer+1, '"'); + if (!end) // no closing quote, not a value so just skip it + continue; + + // null terminate the name + *end = 0; + ACE_TCHAR* name = buffer + 1; + end+=2; + // determine the type + if (*end == '\"') + { + // string type + // truncate trailing " + ++end; + ACE_TCHAR* trailing = ACE_OS::strrchr (end, '"'); + if (trailing) + *trailing = 0; + if (config_.set_string_value (section, name, end)) + { + ACE_OS::fclose (in); + delete [] buffer; + return -4; + } + } + else if (ACE_OS::strncmp (end, ACE_TEXT ("dword:"), 6) == 0) + { + // number type + ACE_TCHAR* endptr = 0; + unsigned long value = ACE_OS::strtoul (end + 6, &endptr, 16); + if (config_.set_integer_value (section, name, value)) + { + ACE_OS::fclose (in); + delete [] buffer; + return -4; + } + } + else if (ACE_OS::strncmp (end, ACE_TEXT ("hex:"), 4) == 0) + { + // binary type + size_t string_length = ACE_OS::strlen (end + 4); + // divide by 3 to get the actual buffer length + size_t length = string_length / 3; + size_t remaining = length; + u_char* data = 0; + ACE_NEW_RETURN (data, + u_char[length], + -1); + u_char* out = data; + ACE_TCHAR* inb = end + 4; + ACE_TCHAR* endptr = 0; + while (remaining) + { + u_char charin = (u_char) ACE_OS::strtoul (inb, &endptr, 16); + *out = charin; + ++out; + --remaining; + inb += 3; + } + if (config_.set_binary_value (section, name, data, length)) + { + ACE_OS::fclose (in); + delete [] data; + delete [] buffer; + return -4; + } + else + delete [] data; + } + else + { + // invalid type, ignore + continue; + } + }// end if first char is a " + else + { + // if the first character is not a ", [, ;, or # we may be + // processing a file in the old format. + // Try and process the line as such and if it fails, + // return an error + int rc = process_previous_line_format (buffer, section); + if (rc != 0) + { + ACE_OS::fclose (in); + delete [] buffer; + return rc; + } + } // end if maybe old format + } // end while fgets + + if (ferror (in)) + { + ACE_OS::fclose (in); + delete [] buffer; + return -1; + } + + ACE_OS::fclose (in); + delete [] buffer; + return 0; +} + +// This method exports the entire configuration database to . +// Once the file is opened this method calls 'export_section' passing +// the root section. +int +ACE_Registry_ImpExp::export_config (const ACE_TCHAR* filename) +{ + if (0 == filename) + { + errno = EINVAL; + return -1; + } + int result = -1; + + FILE* out = ACE_OS::fopen (filename, ACE_TEXT ("w")); + if (out) + { + result = this->export_section (config_.root_section (), + ACE_TEXT (""), + out); + // The data may have been buffered and will be flush on close, + // so we need to check that the close succeeds. + if (ACE_OS::fclose (out) < 0) + result = -7; + } + return result; +} + +// Method provided by derived classes in order to write one section +// to the file specified. Called by export_config when exporting +// the entire configuration object. + +int +ACE_Registry_ImpExp::export_section (const ACE_Configuration_Section_Key& section, + const ACE_TString& path, + FILE* out) +{ + // don't export the root + if (path.length ()) + { + // Write out the section header + ACE_TString header = ACE_TEXT ("["); + header += path; + header += ACE_TEXT ("]"); + header += ACE_TEXT ("\n"); + if (ACE_OS::fputs (header.fast_rep (), out) < 0) + return -1; + // Write out each value + int index = 0; + ACE_TString name; + ACE_Configuration::VALUETYPE type; + ACE_TString line; + ACE_TCHAR int_value[32]; + ACE_TCHAR bin_value[3]; + void* binary_data; + size_t binary_length; + ACE_TString string_value; + while (!config_.enumerate_values (section, index, name, type)) + { + line = ACE_TEXT ("\"") + name + ACE_TEXT ("\"="); + switch (type) + { + case ACE_Configuration::INTEGER: + { + u_int value; + if (config_.get_integer_value (section, name.fast_rep (), value)) + return -2; + ACE_OS::sprintf (int_value, ACE_TEXT ("%08x"), value); + line += ACE_TEXT ("dword:"); + line += int_value; + break; + } + case ACE_Configuration::STRING: + { + if (config_.get_string_value (section, + name.fast_rep (), + string_value)) + return -2; + line += ACE_TEXT ("\""); + line += string_value + ACE_TEXT ("\""); + break; + } +#ifdef _WIN32 + case ACE_Configuration::INVALID: + break; // JDO added break. Otherwise INVALID is processed + // like BINARY. If that's correct, please remove the + // break and these comments +#endif + case ACE_Configuration::BINARY: + { + // not supported yet - maybe use BASE64 codeing? + if (config_.get_binary_value (section, + name.fast_rep (), + binary_data, + binary_length)) + return -2; + line += ACE_TEXT ("hex:"); + unsigned char* ptr = (unsigned char*)binary_data; + while (binary_length) + { + if (ptr != binary_data) + { + line += ACE_TEXT (","); + } + ACE_OS::sprintf (bin_value, ACE_TEXT ("%02x"), *ptr); + line += bin_value; + --binary_length; + ++ptr; + } + delete [] (char*) binary_data; + break; + } + default: + return -3; + } + line += ACE_TEXT ("\n"); + if (ACE_OS::fputs (line.fast_rep (), out) < 0) + return -4; + ++index; + } + } + // Export all sub sections + int index = 0; + ACE_TString name; + ACE_Configuration_Section_Key sub_key; + ACE_TString sub_section; + while (!config_.enumerate_sections (section, index, name)) + { + ACE_TString sub_section (path); + if (path.length ()) + sub_section += ACE_TEXT ("\\"); + sub_section += name; + if (config_.open_section (section, name.fast_rep (), 0, sub_key)) + return -5; + if (export_section (sub_key, sub_section.fast_rep (), out)) + return -6; + ++index; + } + return 0; +} + +// +// This method read the line format origionally used in ACE 5.1 +// +int +ACE_Registry_ImpExp::process_previous_line_format (ACE_TCHAR* buffer, + ACE_Configuration_Section_Key& section) +{ + // Chop any cr/lf at the end of the line. + ACE_TCHAR *endp = ACE_OS::strpbrk (buffer, ACE_TEXT ("\r\n")); + if (endp != 0) + *endp = '\0'; + + // assume this is a value, read in the value name + ACE_TCHAR* end = ACE_OS::strchr (buffer, '='); + if (end) // no =, not a value so just skip it + { + // null terminate the name + *end = 0; + ++end; + // determine the type + if (*end == '\"') + { + // string type + if(config_.set_string_value (section, buffer, end + 1)) + return -4; + } + else if (*end == '#') + { + // number type + u_int value = ACE_OS::atoi (end + 1); + if (config_.set_integer_value (section, buffer, value)) + return -4; + } + } + return 0; +} // end read_previous_line_format + + +ACE_Ini_ImpExp::ACE_Ini_ImpExp (ACE_Configuration& config) + : ACE_Config_ImpExp_Base (config) +{ +} + +ACE_Ini_ImpExp::~ACE_Ini_ImpExp (void) +{ +} + +// Method to read file and populate object. +int +ACE_Ini_ImpExp::import_config (const ACE_TCHAR* filename) +{ + if (0 == filename) + { + errno = EINVAL; + return -1; + } + FILE* in = ACE_OS::fopen (filename, ACE_TEXT ("r")); + if (!in) + return -1; + + // @@ Make this a dynamic size! + ACE_TCHAR buffer[4096]; + ACE_Configuration_Section_Key section; + while (ACE_OS::fgets (buffer, sizeof buffer, in)) + { + ACE_TCHAR *line = this->squish (buffer); + // Check for a comment and blank line + if (line[0] == ACE_TEXT (';') || + line[0] == ACE_TEXT ('#') || + line[0] == '\0') + continue; + + if (line[0] == ACE_TEXT ('[')) + { + // We have a new section here, strip out the section name + ACE_TCHAR* end = ACE_OS::strrchr (line, ACE_TEXT (']')); + if (!end) + { + ACE_OS::fclose (in); + return -3; + } + *end = 0; + + if (config_.expand_path (config_.root_section (), + line + 1, + section, + 1)) + { + ACE_OS::fclose (in); + return -3; + } + + continue; + } + + // We have a line; name ends at equal sign. + ACE_TCHAR *end = ACE_OS::strchr (line, ACE_TEXT ('=')); + if (end == 0) // No '=' + { + ACE_OS::fclose (in); + return -3; + } + *end++ = '\0'; + ACE_TCHAR *name = this->squish (line); +#if 0 + if (ACE_OS::strlen (name) == 0) // No name; just an '=' + { + ACE_OS::fclose (in); + return -3; + } +#endif + // Now find the start of the value + ACE_TCHAR *value = this->squish (end); + size_t value_len = ACE_OS::strlen (value); + if (value_len > 0) + { + // ACE 5.2 (and maybe earlier) exported strings may be enclosed + // in quotes. If string is quote-delimited, strip the quotes. + // Newer exported files don't have quote delimiters. + if (value[0] == ACE_TEXT ('"') && + value[value_len - 1] == ACE_TEXT ('"')) + { + // Strip quotes off both ends. + value[value_len - 1] = '\0'; + ++value; + } + } + + if (config_.set_string_value (section, name, value)) + { + ACE_OS::fclose (in); + return -4; + } + } // end while fgets + + if (ferror (in)) + { + ACE_OS::fclose (in); + return -1; + } + + ACE_OS::fclose (in); + return 0; +} + +// This method exports the entire configuration database to . +// Once the file is opened this method calls 'export_section' passing +// the root section. +int +ACE_Ini_ImpExp::export_config (const ACE_TCHAR* filename) +{ + if (0 == filename) + { + errno = EINVAL; + return -1; + } + int result = -1; + + FILE* out = ACE_OS::fopen (filename, ACE_TEXT ("w")); + if (out) + { + result = this->export_section (config_.root_section (), + ACE_TEXT (""), + out); + // The data may have been buffered and will be flush on close, + // so we need to check that the close succeeds. + if (ACE_OS::fclose (out) < 0) + result = -7; + } + return result; +} + +// Method provided by derived classes in order to write one section to the +// file specified. Called by export_config when exporting the entire +// configuration objet + +int +ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section, + const ACE_TString& path, + FILE* out) +{ + // don't export the root + if (path.length ()) + { + // Write out the section header + ACE_TString header = ACE_TEXT ("["); + header += path; + header += ACE_TEXT ("]\n"); + if (ACE_OS::fputs (header.fast_rep (), out) < 0) + return -1; + // Write out each value + int index = 0; + ACE_TString name; + ACE_Configuration::VALUETYPE type; + ACE_TString line; + ACE_TCHAR int_value[32]; + ACE_TCHAR bin_value[3]; + void* binary_data; + size_t binary_length; + ACE_TString string_value; + while (!config_.enumerate_values (section, index, name, type)) + { + line = name + ACE_TEXT ("="); + switch (type) + { + case ACE_Configuration::INTEGER: + { + u_int value; + if (config_.get_integer_value (section, name.fast_rep (), value)) + return -2; + ACE_OS::sprintf (int_value, ACE_TEXT ("%08x"), value); + line += int_value; + break; + } + case ACE_Configuration::STRING: + { + if (config_.get_string_value (section, + name.fast_rep (), + string_value)) + return -2; + line += string_value; + break; + } +#ifdef _WIN32 + case ACE_Configuration::INVALID: + break; // JDO added break. Otherwise INVALID is processed + // like BINARY. If that's correct, please remove the + // break and these comments +#endif + case ACE_Configuration::BINARY: + { + // not supported yet - maybe use BASE64 codeing? + if (config_.get_binary_value (section, + name.fast_rep (), + binary_data, + binary_length)) + return -2; + line += ACE_TEXT ("\""); + unsigned char* ptr = (unsigned char*)binary_data; + while (binary_length) + { + if (ptr != binary_data) + { + line += ACE_TEXT (","); + } + ACE_OS::sprintf (bin_value, ACE_TEXT ("%02x"), *ptr); + line += bin_value; + --binary_length; + ++ptr; + } + line += ACE_TEXT ("\""); + delete [] (char *) binary_data; + break; + } + default: + return -3; + + }// end switch on type + + line += ACE_TEXT ("\n"); + if (ACE_OS::fputs (line.fast_rep (), out) < 0) + return -4; + ++index; + }// end while enumerating values + } + // Export all sub sections + int index = 0; + ACE_TString name; + ACE_Configuration_Section_Key sub_key; + ACE_TString sub_section; + while (!config_.enumerate_sections (section, index, name)) + { + ACE_TString sub_section (path); + if (path.length ()) + sub_section += ACE_TEXT ("\\"); + sub_section += name; + if (config_.open_section (section, name.fast_rep (), 0, sub_key)) + return -5; + if (export_section (sub_key, sub_section.fast_rep (), out)) + return -6; + ++index; + } + return 0; + +} + +// Method to squish leading and trailing whitespaces from a string. +// Whitespace is defined as: spaces (' '), tabs ('\t') or end-of-line +// (cr/lf). The terminating nul is moved up to expunge trailing +// whitespace and the returned pointer points at the first +// non-whitespace character in the string, which may be the nul +// terminator if the string is all whitespace. + +ACE_TCHAR * +ACE_Ini_ImpExp::squish (ACE_TCHAR *src) +{ + ACE_TCHAR *cp = 0; + + if (src == 0) + return 0; + + // Start at the end and work backwards over all whitespace. + for (cp = src + ACE_OS::strlen (src) - 1; + cp != src; + --cp) + if (!ACE_OS::ace_isspace (*cp)) + break; + cp[1] = '\0'; // Chop trailing whitespace + + // Now start at the beginning and move over all whitespace. + for (cp = src; ACE_OS::ace_isspace (*cp); ++cp) + continue; + + return cp; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Configuration_Import_Export.h b/externals/ace/Configuration_Import_Export.h new file mode 100644 index 0000000..e93544b --- /dev/null +++ b/externals/ace/Configuration_Import_Export.h @@ -0,0 +1,215 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Configuration_Import_Export.h + * + * $Id: Configuration_Import_Export.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Jerry D. Odenwelder Jr. + * Chris Hafey + * + * Classes defined in this file provide the ability to import and export + * ACE Configuration objects to/from disk files. The base class + * ACE_Config_ImpExp_Base provides the common functionality and the derived + * classes implement the import/export functionality for the specific format. + * + * @todo + * - Add locking for thread safety. + * - Provide ability to read file in one format and write in another. + * - See todo's in each class + */ +//============================================================================= + +#ifndef ACE_CONFIGURATION_IMPORT_EXPORT_H +#define ACE_CONFIGURATION_IMPORT_EXPORT_H +#include /**/ "ace/pre.h" + +#include "ace/Configuration.h" +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Config_ImpExp_Base + * + * @brief Base class for file import/export configuration. + * + * This class provides base functionality for configuration objects + * that are persisted in files. It takes an ACE_Configuration + * object that it populates with the data read. + * + */ +class ACE_Export ACE_Config_ImpExp_Base +{ +public: + /// Constructor taking the ACE_Configuration to import/export to + ACE_Config_ImpExp_Base (ACE_Configuration& config); + + /** + * Destructor + */ + virtual ~ACE_Config_ImpExp_Base (void); + + /** + * Imports the configuration database from @a filename. + * No existing data is removed. + */ + virtual int import_config (const ACE_TCHAR* filename) = 0; + + /** + * This method exports the entire configuration database to @a filename. + * Once the file is opened this method calls 'export_section' passing + * the root section. + */ + virtual int export_config (const ACE_TCHAR* filename) = 0; + +protected: + ACE_Configuration &config_; + +private: + ACE_Config_ImpExp_Base (const ACE_Config_ImpExp_Base&); + ACE_Config_ImpExp_Base& operator= (const ACE_Config_ImpExp_Base&); +}; + +/** + * @class ACE_Registry_ImpExp + * + * @brief Configuration object that imports/exports data to a file formatted + * using the Win32 Registry file export format. This format looks like + * [Section] + * "key"="String Data" + * "key"=dword: numeric data in hexidecimal format + * "key"=hex: binary data + * + * @todo + * - Add dynamic buffer when importing. currently it will not allow + * importing of values greater than a fixed ammount (4096 bytes) + * + */ +class ACE_Export ACE_Registry_ImpExp : public ACE_Config_ImpExp_Base +{ +public: + /// Construction + ACE_Registry_ImpExp (ACE_Configuration&); + + /// Destruction. + virtual ~ACE_Registry_ImpExp (void); + + /** + * Imports the configuration database from filename. + * No existing data is removed. + */ + virtual int import_config (const ACE_TCHAR* filename); + + /** + * This method exports the entire configuration database to @a filename. + * Once the file is opened this method calls export_section() passing + * the root section. + */ + virtual int export_config (const ACE_TCHAR* filename); + +private: + int export_section (const ACE_Configuration_Section_Key& section, + const ACE_TString& path, + FILE* out); + + int process_previous_line_format (ACE_TCHAR* buffer, + ACE_Configuration_Section_Key& section); + + ACE_Registry_ImpExp ( const ACE_Registry_ImpExp&); + ACE_Registry_ImpExp& operator= ( const ACE_Registry_ImpExp&); +}; + +/** + * @class ACE_Ini_ImpExp + * + * @brief Imports the configuration database from filename as strings. + * Allows non-typed values. (no #, dword: hex:, etc. prefixes) and + * skips whitespace (tabs and spaces) as in standard .ini and .conf + * files. Values (to right of equal sign) can be double quote + * delimited to embed tabs and spaces in the string. + * Caller must convert string to type. + * + * This method allows for lines in the .ini or .conf file like this: + * + * TimeToLive = 100 + * Delay = FALSE + * Flags = FF34 + * Heading = "ACE - Adaptive Communication Environment" + * + * (note leading whitespace (tabs) in examples below) + * + * SeekIndex = 14 + * TraceLevel = 6 # Can comment lines like this + * Justification = left_justified + * + * The caller can then retrieve the string with the regular + * function and convert the string to the + * desired data type. + * + * @todo + * - Strings with embedded newlines cause the import to fail + * - Strings with embedded quotes " cause the import to fail + * - Importing/exporting for values in the root section does not work + * - Add dynamic buffer when importing. currently it will not allow + * importing of values greater than a fixed ammount (4096 bytes) +*/ +class ACE_Export ACE_Ini_ImpExp : public ACE_Config_ImpExp_Base +{ +public: + /** + * Construction + */ + ACE_Ini_ImpExp (ACE_Configuration&); + + /** + * Destructor + */ + virtual ~ACE_Ini_ImpExp (void); + + /** + * Imports the configuration database from filename. + * No existing data is removed. + */ + virtual int import_config (const ACE_TCHAR* filename); + + /** + * This method exports the entire configuration database to @a filename. + * Once the file is opened this method calls export_section() passing + * the root section. + */ + virtual int export_config (const ACE_TCHAR* filename); + +private: + /** + * Method provided by derived classes in order to write one section + * to the file specified. Called by export_config() when exporting + * the entire configuration object. + */ + int export_section (const ACE_Configuration_Section_Key& section, + const ACE_TString& path, + FILE* out); + + /** + * Method to squish leading and trailing whitespaces in a string. + * Whitespace is defined as: spaces (' '), tabs ('\\t') or cr/lf. + * Returns a pointer to the first non-whitespace character in the + * buffer provided, or a pointer to the terminating null if the string + * is all whitespace. The terminating null is moved forward to the + * first character past the last non-whitespace. + */ + ACE_TCHAR *squish (ACE_TCHAR *src); + + ACE_Ini_ImpExp (const ACE_Ini_ImpExp&); + ACE_Ini_ImpExp& operator= (const ACE_Ini_ImpExp&); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIGURATION_IMPORT_EXPORT_H */ diff --git a/externals/ace/Connection_Recycling_Strategy.cpp b/externals/ace/Connection_Recycling_Strategy.cpp new file mode 100644 index 0000000..78b0888 --- /dev/null +++ b/externals/ace/Connection_Recycling_Strategy.cpp @@ -0,0 +1,13 @@ +#include "ace/Connection_Recycling_Strategy.h" + + +ACE_RCSID(ace, Connection_Recycling_Strategy, "$Id: Connection_Recycling_Strategy.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Connection_Recycling_Strategy::~ACE_Connection_Recycling_Strategy (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Connection_Recycling_Strategy.h b/externals/ace/Connection_Recycling_Strategy.h new file mode 100644 index 0000000..7516963 --- /dev/null +++ b/externals/ace/Connection_Recycling_Strategy.h @@ -0,0 +1,63 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Connection_Recycling_Strategy.h + * + * $Id: Connection_Recycling_Strategy.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//============================================================================= +#ifndef ACE_CONNECTION_RECYCLING_STRATEGY_H +#define ACE_CONNECTION_RECYCLING_STRATEGY_H +#include /**/ "ace/pre.h" + +#include "ace/Recyclable.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Connection_Recycling_Strategy + * + * @brief Defines the interface for a connection recycler. + */ +class ACE_Export ACE_Connection_Recycling_Strategy +{ +public: + /// Virtual Destructor + virtual ~ACE_Connection_Recycling_Strategy (void); + + /// Remove from cache. + virtual int purge (const void *recycling_act) = 0; + + /// Add to cache. + virtual int cache (const void *recycling_act) = 0; + + virtual int recycle_state (const void *recycling_act, + ACE_Recyclable_State new_state) = 0; + + /// Get/Set recycle_state. + virtual ACE_Recyclable_State recycle_state (const void *recycling_act) const = 0; + + /// Mark as closed. + virtual int mark_as_closed (const void *recycling_act) = 0; + + /// Mark as closed.(non-locking version) + virtual int mark_as_closed_i (const void *recycling_act) = 0; + + /// Cleanup hint and reset @a act_holder to zero if @a act_holder != 0. + virtual int cleanup_hint (const void *recycling_act, + void **act_holder = 0) = 0; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /*ACE_CONNECTION_RECYCLING_STRATEGY*/ diff --git a/externals/ace/Connector.cpp b/externals/ace/Connector.cpp new file mode 100644 index 0000000..820ca87 --- /dev/null +++ b/externals/ace/Connector.cpp @@ -0,0 +1,991 @@ +// $Id: Connector.cpp 89510 2010-03-17 12:21:14Z vzykov $ + +#ifndef ACE_CONNECTOR_CPP +#define ACE_CONNECTOR_CPP + +#include "ace/Connector.h" +#include "ace/ACE.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" +#include "ace/os_include/os_fcntl.h" /* Has ACE_NONBLOCK */ + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Connector) + +template +ACE_NonBlocking_Connect_Handler::ACE_NonBlocking_Connect_Handler +(ACE_Connector_Base &connector, + SVC_HANDLER *sh, + long id) + : connector_ (connector) + , svc_handler_ (sh) + , cleanup_svc_handler_ (0) + , timer_id_ (id) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::ACE_NonBlocking_Connect_Handler"); + + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + if (this->svc_handler_ != 0 && + this->svc_handler_->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED) + { + // If SVC_HANDLER is reference counted then NBCH holds a reference + // in cleanup_svc_handle_ which is both a pointer to SVC_HANDLER + // and a flag that triggers remove_reference in NBCH destructor. + this->cleanup_svc_handler_ = sh; + this->cleanup_svc_handler_->add_reference (); + } +} + +template +ACE_NonBlocking_Connect_Handler::~ACE_NonBlocking_Connect_Handler (void) +{ + if (this->cleanup_svc_handler_) + { + this->cleanup_svc_handler_->remove_reference (); + } +} + +template SVC_HANDLER * +ACE_NonBlocking_Connect_Handler::svc_handler (void) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::svc_handler"); + return this->svc_handler_; +} + +template long +ACE_NonBlocking_Connect_Handler::timer_id (void) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::timer_id"); + return this->timer_id_; +} + +template void +ACE_NonBlocking_Connect_Handler::timer_id (long id) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::timer_id"); + this->timer_id_ = id; +} + +template void +ACE_NonBlocking_Connect_Handler::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("svc_handler_ = %x"), this->svc_handler_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntimer_id_ = %d"), this->timer_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template bool +ACE_NonBlocking_Connect_Handler::close (SVC_HANDLER *&sh) +{ + // Make sure that we haven't already initialized the Svc_Handler. + if (!this->svc_handler_) + return false; + + { + // Exclusive access to the Reactor. + ACE_GUARD_RETURN (ACE_Lock, + ace_mon, + this->reactor ()->lock (), + 0); + + // Double check. + if (!this->svc_handler_) + return false; + + // Remember the Svc_Handler. + sh = this->svc_handler_; + ACE_HANDLE h = sh->get_handle (); + this->svc_handler_ = 0; + + // Remove this handle from the set of non-blocking handles + // in the Connector. + this->connector_.non_blocking_handles ().remove (h); + + // Cancel timer. + if (this->reactor ()->cancel_timer (this->timer_id (), + 0, + 0) == -1) + return false; + + // Remove from Reactor. + if (this->reactor ()->remove_handler ( + h, + ACE_Event_Handler::ALL_EVENTS_MASK) == -1) + return false; + } + + return true; +} + + +template int +ACE_NonBlocking_Connect_Handler::handle_timeout +(const ACE_Time_Value &tv, + const void *arg) +{ + // This method is called if a connection times out before completing. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_timeout"); + + SVC_HANDLER *svc_handler = 0; + int const retval = this->close (svc_handler) ? 0 : -1; + + // Forward to the SVC_HANDLER the that was passed in as a + // magic cookie during ACE_Connector::connect(). This gives the + // SVC_HANDLER an opportunity to take corrective action (e.g., wait + // a few milliseconds and try to reconnect again. + if (svc_handler != 0 && svc_handler->handle_timeout (tv, arg) == -1) + svc_handler->handle_close (svc_handler->get_handle (), + ACE_Event_Handler::TIMER_MASK); + + return retval; +} + + +template int +ACE_NonBlocking_Connect_Handler::handle_input (ACE_HANDLE) +{ + // Called when a failure occurs during asynchronous connection + // establishment. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_input"); + + SVC_HANDLER *svc_handler = 0; + int const retval = this->close (svc_handler) ? 0 : -1; + + // Close Svc_Handler. + if (svc_handler != 0) + { + svc_handler->close (NORMAL_CLOSE_OPERATION); + } + + return retval; +} + +template int +ACE_NonBlocking_Connect_Handler::handle_output (ACE_HANDLE handle) +{ + // Called when a connection is establishment asynchronous. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_output"); + + // Grab the connector ref before smashing ourselves in close(). + ACE_Connector_Base &connector = this->connector_; + SVC_HANDLER *svc_handler = 0; + int const retval = this->close (svc_handler) ? 0 : -1; + + if (svc_handler != 0) + { + connector.initialize_svc_handler (handle, svc_handler); + } + + return retval; +} + +template int +ACE_NonBlocking_Connect_Handler::handle_exception (ACE_HANDLE h) +{ + // On Win32, the except mask must also be set for asynchronous + // connects. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler::handle_exception"); + return this->handle_output (h); +} + +template int +ACE_NonBlocking_Connect_Handler::resume_handler (void) +{ + return ACE_Event_Handler::ACE_EVENT_HANDLER_NOT_RESUMED; +} + +template void +ACE_Connector::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Connector::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags_ = %d"), this->flags_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template int +ACE_Connector::make_svc_handler (SVC_HANDLER *&sh) +{ + ACE_TRACE ("ACE_Connector::make_svc_handler"); + + if (sh == 0) + ACE_NEW_RETURN (sh, + SVC_HANDLER, + -1); + + // Set the reactor of the newly created to the same + // reactor that this is using. + sh->reactor (this->reactor ()); + return 0; +} + +template int +ACE_Connector::activate_svc_handler (SVC_HANDLER *svc_handler) +{ + ACE_TRACE ("ACE_Connector::activate_svc_handler"); + // No errors initially + int error = 0; + + // See if we should enable non-blocking I/O on the 's + // peer. + if (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0) + { + if (svc_handler->peer ().enable (ACE_NONBLOCK) == -1) + error = 1; + } + // Otherwise, make sure it's disabled by default. + else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) + error = 1; + + // We are connected now, so try to open things up. + if (error || svc_handler->open ((void *) this) == -1) + { + // Make sure to close down the to avoid descriptor + // leaks. + // The connection was already made; so this close is a "normal" + // close operation. + svc_handler->close (NORMAL_CLOSE_OPERATION); + return -1; + } + else + return 0; +} + +template ACE_PEER_CONNECTOR & +ACE_Connector::connector (void) const +{ + return const_cast (this->connector_); +} + +template int +ACE_Connector::connect_svc_handler +(SVC_HANDLER *&svc_handler, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_Connector::connect_svc_handler"); + + return this->connector_.connect (svc_handler->peer (), + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms); +} + +template int +ACE_Connector::connect_svc_handler +(SVC_HANDLER *&svc_handler, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_Connector::connect_svc_handler"); + + sh_copy = svc_handler; + return this->connector_.connect (svc_handler->peer (), + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms); +} + +template int +ACE_Connector::open (ACE_Reactor *r, int flags) +{ + ACE_TRACE ("ACE_Connector::open"); + this->reactor (r); + this->flags_ = flags; + return 0; +} + +template +ACE_Connector::ACE_Connector (ACE_Reactor *r, + int flags) +{ + ACE_TRACE ("ACE_Connector::ACE_Connector"); + (void) this->open (r, flags); +} + +template int +ACE_Connector::connect +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + // Initiate connection to peer. + return this->connect_i (sh, + 0, + remote_addr, + synch_options, + local_addr, + reuse_addr, + flags, + perms); +} + +template int +ACE_Connector::connect +(SVC_HANDLER *&sh, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + // Initiate connection to peer. + return this->connect_i (sh, + &sh_copy, + remote_addr, + synch_options, + local_addr, + reuse_addr, + flags, + perms); +} + +template int +ACE_Connector::connect_i +(SVC_HANDLER *&sh, + SVC_HANDLER **sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_Connector::connect_i"); + + // If the user hasn't supplied us with a we'll use the + // factory method to create one. Otherwise, things will remain as + // they are... + if (this->make_svc_handler (sh) == -1) + return -1; + + ACE_Time_Value *timeout = 0; + int const use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; + + if (use_reactor) + timeout = const_cast (&ACE_Time_Value::zero); + else + timeout = const_cast (synch_options.time_value ()); + + int result; + if (sh_copy == 0) + result = this->connect_svc_handler (sh, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms); + else + result = this->connect_svc_handler (sh, + *sh_copy, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms); + + // Activate immediately if we are connected. + if (result != -1) + return this->activate_svc_handler (sh); + + // Delegate to connection strategy. + if (use_reactor && ACE_OS::last_error () == EWOULDBLOCK) + { + // If the connection hasn't completed and we are using + // non-blocking semantics then register + // ACE_NonBlocking_Connect_Handler with the ACE_Reactor so that + // it will call us back when the connection is complete or we + // timeout, whichever comes first... + int result; + + if (sh_copy == 0) + result = this->nonblocking_connect (sh, synch_options); + else + result = this->nonblocking_connect (*sh_copy, synch_options); + + // If for some reason the call failed, then + // will be set to the new error. If the call succeeds, however, + // we need to make sure that remains set to + // . + if (result == 0) + errno = EWOULDBLOCK; + } + else + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + // Make sure to close down the service handler to avoid handle + // leaks. + if (sh_copy == 0) + { + if (sh) + sh->close (CLOSE_DURING_NEW_CONNECTION); + } + else if (*sh_copy) + (*sh_copy)->close (CLOSE_DURING_NEW_CONNECTION); + } + + return -1; +} + +template int +ACE_Connector::connect_n +(size_t n, + SVC_HANDLER *sh[], + ACE_PEER_CONNECTOR_ADDR remote_addrs[], + ACE_TCHAR *failed_svc_handlers, + const ACE_Synch_Options &synch_options) +{ + int result = 0; + + for (size_t i = 0; i < n; i++) + { + if (this->connect (sh[i], remote_addrs[i], synch_options) == -1 + && !(synch_options[ACE_Synch_Options::USE_REACTOR] + && errno == EWOULDBLOCK)) + { + result = -1; + if (failed_svc_handlers != 0) + // Mark this entry as having failed. + failed_svc_handlers[i] = 1; + } + else if (failed_svc_handlers != 0) + // Mark this entry as having succeeded. + failed_svc_handlers[i] = 0; + } + + return result; +} + +// Cancel a that was started asynchronously. +template int +ACE_Connector::cancel (SVC_HANDLER *sh) +{ + ACE_TRACE ("ACE_Connector::cancel"); + + ACE_Event_Handler *handler = + this->reactor ()->find_handler (sh->get_handle ()); + + if (handler == 0) + return -1; + + // find_handler() increments handler's refcount; ensure we decrement it. + ACE_Event_Handler_var safe_handler (handler); + + NBCH *nbch = + dynamic_cast (handler); + + if (nbch == 0) + return -1; + + SVC_HANDLER *tmp_sh = 0; + + if (nbch->close (tmp_sh) == false) + return -1; + + return 0; +} + +template int +ACE_Connector::nonblocking_connect +(SVC_HANDLER *sh, + const ACE_Synch_Options &synch_options) +{ + ACE_TRACE ("ACE_Connector::nonblocking_connect"); + + // Must have a valid Reactor for non-blocking connects to work. + if (this->reactor () == 0) + return -1; + + // Register the pending SVC_HANDLER so that it can be activated + // later on when the connection completes. + + ACE_HANDLE handle = sh->get_handle (); + long timer_id = -1; + ACE_Time_Value *tv = 0; + NBCH *nbch = 0; + + ACE_NEW_RETURN (nbch, + NBCH (*this, + sh, + -1), + -1); + + ACE_Event_Handler_var safe_nbch (nbch); + + // Exclusive access to the Reactor. + ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); + + // Register handle with the reactor for connection events. + ACE_Reactor_Mask mask = ACE_Event_Handler::CONNECT_MASK; + if (this->reactor ()->register_handler (handle, + nbch, + mask) == -1) + goto reactor_registration_failure; + + // Add handle to non-blocking handle set. + this->non_blocking_handles ().insert (handle); + + // If we're starting connection under timer control then we need to + // schedule a timeout with the ACE_Reactor. + tv = const_cast (synch_options.time_value ()); + if (tv != 0) + { + timer_id = + this->reactor ()->schedule_timer (nbch, + synch_options.arg (), + *tv); + if (timer_id == -1) + goto timer_registration_failure; + + // Remember timer id. + nbch->timer_id (timer_id); + } + + return 0; + + // Undo previous actions using the ol' "goto label and fallthru" + // trick... + timer_registration_failure: + + // Remove from Reactor. + this->reactor ()->remove_handler (handle, mask); + + // Remove handle from the set of non-blocking handles. + this->non_blocking_handles ().remove (handle); + + /* FALLTHRU */ + + reactor_registration_failure: + // Close the svc_handler + + sh->close (CLOSE_DURING_NEW_CONNECTION); + + return -1; +} + +template +ACE_Connector::~ACE_Connector (void) +{ + ACE_TRACE ("ACE_Connector::~ACE_Connector"); + + this->close (); +} + +template void +ACE_Connector::initialize_svc_handler +(ACE_HANDLE handle, + SVC_HANDLER *svc_handler) +{ + // Try to find out if the reactor uses event associations for the + // handles it waits on. If so we need to reset it. + bool reset_new_handle = + this->reactor ()->uses_event_associations (); + + if (reset_new_handle) + this->connector_.reset_new_handle (handle); + + // Transfer ownership of the ACE_HANDLE to the SVC_HANDLER. + svc_handler->set_handle (handle); + + ACE_PEER_CONNECTOR_ADDR raddr; + + // Check to see if we're connected. + if (svc_handler->peer ().get_remote_addr (raddr) != -1) + this->activate_svc_handler (svc_handler); + else // Somethings gone wrong, so close down... + { +#if defined (ACE_WIN32) + // Win32 (at least prior to Windows 2000) has a timing problem. + // If you check to see if the connection has completed too fast, + // it will fail - so wait 35 milliseconds to let it catch up. + ACE_Time_Value tv (0, ACE_NON_BLOCKING_BUG_DELAY); + ACE_OS::sleep (tv); + if (svc_handler->peer ().get_remote_addr (raddr) != -1) + this->activate_svc_handler (svc_handler); + else // do the svc handler close below... +#endif /* ACE_WIN32 */ + svc_handler->close (NORMAL_CLOSE_OPERATION); + } +} + +template void +ACE_Connector::reactor (ACE_Reactor *reactor) +{ + this->reactor_ = reactor; +} + +template ACE_Reactor * +ACE_Connector::reactor (void) const +{ + return this->reactor_; +} + +template ACE_Unbounded_Set & +ACE_Connector::non_blocking_handles (void) +{ + return this->non_blocking_handles_; +} + +template int +ACE_Connector::close (void) +{ + // If there are no non-blocking handle pending, return immediately. + if (this->non_blocking_handles ().size () == 0) + return 0; + + // Exclusive access to the Reactor. + ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); + + // Go through all the non-blocking handles. It is necessary to + // create a new iterator each time because we remove from the handle + // set when we cancel the Svc_Handler. + ACE_HANDLE *handle = 0; + while (1) + { + ACE_Unbounded_Set_Iterator + iterator (this->non_blocking_handles ()); + if (!iterator.next (handle)) + break; + + ACE_Event_Handler *handler = + this->reactor ()->find_handler (*handle); + if (handler == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%t: Connector::close h %d, no handler\n"), + *handle)); + // Remove handle from the set of non-blocking handles. + this->non_blocking_handles ().remove (*handle); + continue; + } + + // find_handler() incremented handler's refcount; ensure it's decremented + ACE_Event_Handler_var safe_handler (handler); + NBCH *nbch = dynamic_cast (handler); + if (nbch == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%t: Connector::close h %d handler %@ ") + ACE_TEXT ("not a legit handler\n"), + *handle, + handler)); + // Remove handle from the set of non-blocking handles. + this->non_blocking_handles ().remove (*handle); + continue; + } + SVC_HANDLER *svc_handler = nbch->svc_handler (); + + // Cancel the non-blocking connection. + this->cancel (svc_handler); + + // Close the associated Svc_Handler. + svc_handler->close (NORMAL_CLOSE_OPERATION); + } + + return 0; +} + +template int +ACE_Connector::fini (void) +{ + ACE_TRACE ("ACE_Connector::fini"); + + return this->close (); +} + +// Hook called by the explicit dynamic linking facility. + +template int +ACE_Connector::init (int, ACE_TCHAR *[]) +{ + ACE_TRACE ("ACE_Connector::init"); + return -1; +} + +template int +ACE_Connector::suspend (void) +{ + ACE_TRACE ("ACE_Connector::suspend"); + return -1; +} + +template int +ACE_Connector::resume (void) +{ + ACE_TRACE ("ACE_Connector::resume"); + return -1; +} + +template int +ACE_Connector::info (ACE_TCHAR **strp, size_t length) const +{ + ACE_TRACE ("ACE_Connector::info"); + ACE_TCHAR buf[BUFSIZ]; + + ACE_OS::sprintf (buf, + ACE_TEXT ("%s\t %s"), + ACE_TEXT ("ACE_Connector"), + ACE_TEXT ("# connector factory\n")); + + if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) + return -1; + else + ACE_OS::strsncpy (*strp, buf, length); + return static_cast (ACE_OS::strlen (buf)); +} + +template int +ACE_Strategy_Connector::open (ACE_Reactor *r, + int flags) +{ + ACE_TRACE ("ACE_Strategy_Connector::open"); + return this->open (r, 0, 0, 0, flags); +} + +template int +ACE_Strategy_Connector::open +(ACE_Reactor *r, + ACE_Creation_Strategy *cre_s, + ACE_Connect_Strategy *conn_s, + ACE_Concurrency_Strategy *con_s, + int flags) +{ + ACE_TRACE ("ACE_Strategy_Connector::open"); + + this->reactor (r); + + // @@ Not implemented yet. + // this->flags_ = flags; + ACE_UNUSED_ARG (flags); + + // Initialize the creation strategy. + + // First we decide if we need to clean up. + if (this->creation_strategy_ != 0 && + this->delete_creation_strategy_ && + cre_s != 0) + { + delete this->creation_strategy_; + this->creation_strategy_ = 0; + this->delete_creation_strategy_ = false; + } + + if (cre_s != 0) + this->creation_strategy_ = cre_s; + else if (this->creation_strategy_ == 0) + { + ACE_NEW_RETURN (this->creation_strategy_, + CREATION_STRATEGY, + -1); + this->delete_creation_strategy_ = true; + } + + + // Initialize the accept strategy. + + if (this->connect_strategy_ != 0 && + this->delete_connect_strategy_ && + conn_s != 0) + { + delete this->connect_strategy_; + this->connect_strategy_ = 0; + this->delete_connect_strategy_ = false; + } + + if (conn_s != 0) + this->connect_strategy_ = conn_s; + else if (this->connect_strategy_ == 0) + { + ACE_NEW_RETURN (this->connect_strategy_, + CONNECT_STRATEGY, + -1); + this->delete_connect_strategy_ = true; + } + + // Initialize the concurrency strategy. + + if (this->concurrency_strategy_ != 0 && + this->delete_concurrency_strategy_ && + con_s != 0) + { + delete this->concurrency_strategy_; + this->concurrency_strategy_ = 0; + this->delete_concurrency_strategy_ = false; + } + + if (con_s != 0) + this->concurrency_strategy_ = con_s; + else if (this->concurrency_strategy_ == 0) + { + ACE_NEW_RETURN (this->concurrency_strategy_, + CONCURRENCY_STRATEGY, + -1); + this->delete_concurrency_strategy_ = true; + } + + return 0; +} + +template +ACE_Strategy_Connector::ACE_Strategy_Connector +(ACE_Reactor *reactor, + ACE_Creation_Strategy *cre_s, + ACE_Connect_Strategy *conn_s, + ACE_Concurrency_Strategy *con_s, + int flags) + : creation_strategy_ (0), + delete_creation_strategy_ (false), + connect_strategy_ (0), + delete_connect_strategy_ (false), + concurrency_strategy_ (0), + delete_concurrency_strategy_ (false) +{ + ACE_TRACE ("ACE_Connector::ACE_Strategy_Connector"); + + if (this->open (reactor, cre_s, conn_s, con_s, flags) == -1) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Strategy_Connector::ACE_Strategy_Connector"))); +} + +template +ACE_Strategy_Connector::~ACE_Strategy_Connector (void) +{ + ACE_TRACE ("ACE_Strategy_Connector::~ACE_Strategy_Connector"); + + // Close down + this->close (); +} + +template int +ACE_Strategy_Connector::close (void) +{ + if (this->delete_creation_strategy_) + delete this->creation_strategy_; + this->delete_creation_strategy_ = false; + this->creation_strategy_ = 0; + + if (this->delete_connect_strategy_) + delete this->connect_strategy_; + this->delete_connect_strategy_ = false; + this->connect_strategy_ = 0; + + if (this->delete_concurrency_strategy_) + delete this->concurrency_strategy_; + this->delete_concurrency_strategy_ = false; + this->concurrency_strategy_ = 0; + + return SUPER::close (); +} + +template int +ACE_Strategy_Connector::make_svc_handler (SVC_HANDLER *&sh) +{ + return this->creation_strategy_->make_svc_handler (sh); +} + +template int +ACE_Strategy_Connector::connect_svc_handler +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + return this->connect_strategy_->connect_svc_handler (sh, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms); +} + +template int +ACE_Strategy_Connector::connect_svc_handler +(SVC_HANDLER *&sh, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + return this->connect_strategy_->connect_svc_handler (sh, + sh_copy, + remote_addr, + timeout, + local_addr, + reuse_addr, + flags, + perms); +} + +template int +ACE_Strategy_Connector::activate_svc_handler (SVC_HANDLER *svc_handler) +{ + return this->concurrency_strategy_->activate_svc_handler (svc_handler, this); +} + +template ACE_Creation_Strategy * +ACE_Strategy_Connector::creation_strategy (void) const +{ + return this->creation_strategy_; +} + +template ACE_Connect_Strategy * +ACE_Strategy_Connector::connect_strategy (void) const +{ + return this->connect_strategy_; +} + +template ACE_Concurrency_Strategy * +ACE_Strategy_Connector::concurrency_strategy (void) const +{ + return this->concurrency_strategy_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CONNECTOR_C */ diff --git a/externals/ace/Connector.h b/externals/ace/Connector.h new file mode 100644 index 0000000..08ef2aa --- /dev/null +++ b/externals/ace/Connector.h @@ -0,0 +1,569 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Connector.h + * + * $Id: Connector.h 89510 2010-03-17 12:21:14Z vzykov $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_CONNECTOR_H +#define ACE_CONNECTOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Service_Object.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Strategies_T.h" +#include "ace/Synch_Options.h" +#include "ace/Unbounded_Set.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Connector_Base + * + * @brief This base interface allows ACE_NonBlocking_Connect_Handler + * to only care about the SVC_HANDLER template parameter of the + * ACE_Connector. Otherwise, ACE_NonBlocking_Connect_Handler would + * have to be configured with all the template parameters that + * ACE_Connector is configured with. + */ +template +class ACE_Connector_Base +{ +public: + + virtual ~ACE_Connector_Base (void) {} + + /// Initialize the Svc_Handler. + virtual void initialize_svc_handler (ACE_HANDLE handle, + SVC_HANDLER *svc_handler) = 0; + + /// Return the handle set representing the non-blocking connects in + /// progress. + virtual ACE_Unbounded_Set &non_blocking_handles (void) = 0; +}; + +/** + * @class ACE_NonBlocking_Connect_Handler + * + * @brief Performs non-blocking connects on behalf of the Connector. + */ +template +class ACE_NonBlocking_Connect_Handler : public ACE_Event_Handler +{ +public: + + /// Constructor. + ACE_NonBlocking_Connect_Handler (ACE_Connector_Base &connector, + SVC_HANDLER *, + long timer_id); + + /// Destructor. + ~ACE_NonBlocking_Connect_Handler (void); + + /// Close up and return underlying SVC_HANDLER through @c sh. + /** + * If the return value is true the close was performed succesfully, + * implying that this object was removed from the reactor and thereby + * (by means of reference counting decremented to 0) deleted. + * If the return value is false, the close was not successful. + * The @c sh does not have any connection to the return + * value. The argument will return a valid svc_handler object if a + * valid one exists within the object. Returning a valid svc_handler + * pointer also invalidates the svc_handler contained in this + * object. + */ + bool close (SVC_HANDLER *&sh); + + /// Get SVC_HANDLER. + SVC_HANDLER *svc_handler (void); + + /// Get handle. + ACE_HANDLE handle (void); + + /// Set handle. + void handle (ACE_HANDLE); + + /// Get timer id. + long timer_id (void); + + /// Set timer id. + void timer_id (long timer_id); + + /// Called by ACE_Reactor when asynchronous connections fail. + virtual int handle_input (ACE_HANDLE); + + /// Called by ACE_Reactor when asynchronous connections succeed. + virtual int handle_output (ACE_HANDLE); + + /// Called by ACE_Reactor when asynchronous connections suceeds (on + /// some platforms only). + virtual int handle_exception (ACE_HANDLE fd); + + /// This method is called if a connection times out before + /// completing. + virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); + + /// Should Reactor resume us if we have been suspended before the upcall? + virtual int resume_handler (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + /// Connector base. + ACE_Connector_Base &connector_; + + /// Associated SVC_HANDLER. + SVC_HANDLER *svc_handler_; + + /// Same as svc_handler_ if svc_handler_ is reference counted. + SVC_HANDLER *cleanup_svc_handler_; + + /// Associated timer id. + long timer_id_; +}; + +/** + * @class ACE_Connector + * + * @brief Generic factory for actively connecting clients and creating + * service handlers (SVC_HANDLERs). + * + * Implements the strategy for actively establishing connections with + * clients. An ACE_Connector is parameterized by concrete types that + * conform to the interfaces of PEER_CONNECTOR and SVC_HANDLER. The + * PEER_CONNECTOR is instantiated with a transport mechanism that + * actively establishes connections. The SVC_HANDLER is instantiated + * with a concrete type that performs the application-specific + * service. Both blocking and non-blocking connects are supported. + * Further, non-blocking connects support timeouts. + */ +template +class ACE_Connector : public ACE_Connector_Base, public ACE_Service_Object +{ +public: + + // Useful STL-style traits. + typedef typename SVC_HANDLER::addr_type addr_type; + typedef ACE_PEER_CONNECTOR connector_type; + typedef SVC_HANDLER handler_type; + typedef typename SVC_HANDLER::stream_type stream_type; + typedef typename ACE_PEER_CONNECTOR::PEER_ADDR peer_addr_type; + typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; + + /** + * Initialize a connector. @a flags indicates how SVC_HANDLER's + * should be initialized prior to being activated. Right now, the + * only flag that is processed is ACE_NONBLOCK, which enabled + * non-blocking I/O on the SVC_HANDLER when it is opened. + */ + ACE_Connector (ACE_Reactor *r = ACE_Reactor::instance (), + int flags = 0); + + /** + * Initialize a connector. @a flags indicates how SVC_HANDLER's + * should be initialized prior to being activated. Right now, the + * only flag that is processed is ACE_NONBLOCK, which enabled + * non-blocking I/O on the SVC_HANDLER when it is opened. + */ + virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), + int flags = 0); + + /// Shutdown a connector and release resources. + virtual ~ACE_Connector (void); + + // = Connection establishment methods. + + /** + * Initiate connection of @a svc_handler to peer at @a remote_addr + * using @a synch_options. If the caller wants to designate the + * selected @a local_addr they can (and can also insist that the + * @a local_addr be reused by passing a value @a reuse_addr == + * 1). @a flags and @a perms can be used to pass any flags that are + * needed to perform specific operations such as opening a file + * within connect with certain permissions. If the connection fails + * the hook on the @a svc_handler will be called + * automatically to prevent resource leaks. + */ + virtual int connect (SVC_HANDLER *&svc_handler, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, + const ACE_PEER_CONNECTOR_ADDR &local_addr + = (peer_addr_type &) ACE_PEER_CONNECTOR_ADDR_ANY, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0); + + /** + * This is a variation on the previous method. On cached + * connectors the @a svc_handler_hint variable can be used as a hint + * for future lookups. Since this variable is modified in the + * context of the internal cache its use is thread-safe. But the + * actual svc_handler for the current connection is returned in the + * second parameter @a svc_handler. If the connection fails the + * hook on the @a svc_handler will be called automatically to + * prevent resource leaks. + */ + virtual int connect (SVC_HANDLER *&svc_handler_hint, + SVC_HANDLER *&svc_handler, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, + const ACE_PEER_CONNECTOR_ADDR &local_addr + = (peer_addr_type &) ACE_PEER_CONNECTOR_ADDR_ANY, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0); + + /** + * Initiate connection of @a n @a svc_handlers to peers at + * @a remote_addrs using @a synch_options. Returns -1 if failure + * occurs and 0 otherwise. If @a failed_svc_handlers is non-NULL, a + * 1 is placed in the corresponding index of @a failed_svc_handlers + * for each that failed to connect, else a 0 is + * placed in that index. + */ + virtual int connect_n (size_t n, + SVC_HANDLER *svc_handlers[], + ACE_PEER_CONNECTOR_ADDR remote_addrs[], + ACE_TCHAR *failed_svc_handlers = 0, + const ACE_Synch_Options &synch_options = + ACE_Synch_Options::defaults); + + /** + * Cancel the @a svc_handler that was started asynchronously. Note that + * this is the only case when the Connector does not actively close + * the @a svc_handler. It is left up to the caller of to + * decide the fate of the @a svc_handler. + */ + virtual int cancel (SVC_HANDLER *svc_handler); + + /// Close down the Connector. All pending non-blocking connects are + /// canceled and the corresponding svc_handler is closed. + virtual int close (void); + + /// Return the underlying PEER_CONNECTOR object. + virtual ACE_PEER_CONNECTOR &connector (void) const; + + /// Initialize Svc_Handler. + virtual void initialize_svc_handler (ACE_HANDLE handle, + SVC_HANDLER *svc_handler); + + /// Set Reactor. + virtual void reactor (ACE_Reactor *reactor); + + /// Get Reactor. + virtual ACE_Reactor *reactor (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = Helpful typedefs. + typedef ACE_NonBlocking_Connect_Handler NBCH; + + // = The following two methods define the Connector's strategies for + // creating, connecting, and activating SVC_HANDLER's, respectively. + + /** + * Bridge method for creating a SVC_HANDLER. The default is to + * create a new SVC_HANDLER only if @a sh == 0, else @a sh is + * unchanged. However, subclasses can override this policy to + * perform SVC_HANDLER creation in any way that they like (such as + * creating subclass instances of SVC_HANDLER, using a singleton, + * dynamically linking the handler, etc.). Returns -1 if failure, + * else 0. + */ + virtual int make_svc_handler (SVC_HANDLER *&sh); + + /** + * Bridge method for connecting the @a svc_handler to the + * @a remote_addr. The default behavior delegates to the + * . + */ + virtual int connect_svc_handler (SVC_HANDLER *&svc_handler, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms); + virtual int connect_svc_handler (SVC_HANDLER *&svc_handler, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms); + + /** + * Bridge method for activating a @a svc_handler with the appropriate + * concurrency strategy. The default behavior of this method is to + * activate the SVC_HANDLER by calling its method (which + * allows the SVC_HANDLER to define its own concurrency strategy). + * However, subclasses can override this strategy to do more + * sophisticated concurrency activations (such as creating the + * SVC_HANDLER as an "active object" via multi-threading or + * multi-processing). + */ + virtual int activate_svc_handler (SVC_HANDLER *svc_handler); + + /// Creates and registers ACE_NonBlocking_Connect_Handler. + int nonblocking_connect (SVC_HANDLER *, + const ACE_Synch_Options &); + + /// Implementation of the connect methods. + virtual int connect_i (SVC_HANDLER *&svc_handler, + SVC_HANDLER **sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms); + + /// Return the handle set representing the non-blocking connects in + /// progress. + ACE_Unbounded_Set &non_blocking_handles (void); + + // = Dynamic linking hooks. + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int init (int argc, ACE_TCHAR *argv[]); + + /// Calls handle_close() to shutdown the Connector gracefully. + virtual int fini (void); + + /// Default version returns address info in @a buf. + virtual int info (ACE_TCHAR **strp, size_t length) const; + + // = Service management hooks. + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int suspend (void); + + /// Default version does no work and returns -1. Must be overloaded + /// by application developer to do anything meaningful. + virtual int resume (void); + +private: + /// This is the peer connector factory. + ACE_PEER_CONNECTOR connector_; + + /** + * Flags that indicate how SVC_HANDLER's should be initialized + * prior to being activated. Right now, the only flag that is + * processed is ACE_NONBLOCK, which enabled non-blocking I/O on + * the SVC_HANDLER when it is opened. + */ + int flags_; + + /// Pointer to the Reactor. + ACE_Reactor *reactor_; + + /// Handle set representing the non-blocking connects in progress. + ACE_Unbounded_Set non_blocking_handles_; + +}; + +/** + * @class ACE_Strategy_Connector + * + * @brief Abstract factory for creating a service handler + * (SVC_HANDLER), connecting the SVC_HANDLER, and activating the + * SVC_HANDLER. + * + * Implements a flexible and extensible set of strategies for + * actively establishing connections with clients. There are + * three main strategies: (1) creating a SVC_HANDLER, (2) + * actively initiating a new connection from the client, + * and (3) activating the SVC_HANDLER with a + * particular concurrency mechanism after the connection is established. + */ +template +class ACE_Strategy_Connector + : public ACE_Connector +{ +public: + + // Useful STL-style traits. + typedef ACE_Creation_Strategy + creation_strategy_type; + typedef ACE_Connect_Strategy + connect_strategy_type; + typedef ACE_Concurrency_Strategy + concurrency_strategy_type; + typedef ACE_Connector + base_type; + + // = Define some useful (old style) traits. + typedef ACE_Creation_Strategy + CREATION_STRATEGY; + typedef ACE_Connect_Strategy + CONNECT_STRATEGY; + typedef ACE_Concurrency_Strategy + CONCURRENCY_STRATEGY; + typedef ACE_Connector + SUPER; + + /** + * Initialize a connector. @a flags indicates how 's + * should be initialized prior to being activated. Right now, the + * only flag that is processed is ACE_NONBLOCK, which enabled + * non-blocking I/O on the SVC_HANDLER when it is opened. + */ + ACE_Strategy_Connector (ACE_Reactor *r = ACE_Reactor::instance (), + ACE_Creation_Strategy * = 0, + ACE_Connect_Strategy * = 0, + ACE_Concurrency_Strategy * = 0, + int flags = 0); + + /** + * Initialize a connector. @a flags indicates how SVC_HANDLER's + * should be initialized prior to being activated. Right now, the + * only flag that is processed is ACE_NONBLOCK, which enabled + * non-blocking I/O on the SVC_HANDLER when it is opened. + * Default strategies would be created and used. + */ + virtual int open (ACE_Reactor *r, + int flags); + + /** + * Initialize a connector. @a flags indicates how SVC_HANDLER's + * should be initialized prior to being activated. Right now, the + * only flag that is processed is ACE_NONBLOCK, which enabled + * non-blocking I/O on the SVC_HANDLER when it is opened. + */ + virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), + ACE_Creation_Strategy * = 0, + ACE_Connect_Strategy * = 0, + ACE_Concurrency_Strategy * = 0, + int flags = 0); + + /// Shutdown a connector and release resources. + virtual ~ACE_Strategy_Connector (void); + + /// Close down the Connector + virtual int close (void); + + // = Strategies accessors + virtual ACE_Creation_Strategy *creation_strategy (void) const; + virtual ACE_Connect_Strategy *connect_strategy (void) const; + virtual ACE_Concurrency_Strategy *concurrency_strategy (void) const; + +protected: + // = The following three methods define the 's strategies + // for creating, connecting, and activating SVC_HANDLER's, + // respectively. + + /** + * Bridge method for creating a SVC_HANDLER. The strategy for + * creating a SVC_HANDLER are configured into the Connector via + * it's . The default is to create a new + * SVC_HANDLER only if @a sh == 0, else @a sh is unchanged. + * However, subclasses can override this policy to perform + * SVC_HANDLER creation in any way that they like (such as + * creating subclass instances of SVC_HANDLER, using a singleton, + * dynamically linking the handler, etc.). Returns -1 if failure, + * else 0. + */ + virtual int make_svc_handler (SVC_HANDLER *&sh); + + /** + * Bridge method for connecting the new connection into the + * SVC_HANDLER. The default behavior delegates to the + * in the . + */ + virtual int connect_svc_handler (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms); + + /** + * Bridge method for connecting the new connection into the + * SVC_HANDLER. The default behavior delegates to the + * in the . + * @a sh_copy is used to obtain a copy of the @a sh pointer, but that + * can be kept in the stack; the motivation is a bit too long to + * include here, but basically we want to modify @a sh safely, using + * the internal locks in the Connect_Strategy, while saving a TSS + * copy in @a sh_copy, usually located in the stack. + */ + virtual int connect_svc_handler (SVC_HANDLER *&sh, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms); + + /** + * Bridge method for activating a SVC_HANDLER with the appropriate + * concurrency strategy. The default behavior of this method is to + * activate the SVC_HANDLER by calling its method (which + * allows the SVC_HANDLER to define its own concurrency strategy). + * However, subclasses can override this strategy to do more + * sophisticated concurrency activations (such as creating the + * SVC_HANDLER as an "active object" via multi-threading or + * multi-processing). + */ + virtual int activate_svc_handler (SVC_HANDLER *svc_handler); + + // = Strategy objects. + + /// Creation strategy for an Connector. + CREATION_STRATEGY *creation_strategy_; + + /// true if Connector created the creation strategy and thus should + /// delete it, else false. + bool delete_creation_strategy_; + + /// Connect strategy for a Connector. + CONNECT_STRATEGY *connect_strategy_; + + /// true if Connector created the connect strategy and thus should + /// delete it, else false. + bool delete_connect_strategy_; + + /// Concurrency strategy for an . + CONCURRENCY_STRATEGY *concurrency_strategy_; + + /// true if Connector created the concurrency strategy and thus should + /// delete it, else false. + bool delete_concurrency_strategy_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Connector.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Connector.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CONNECTOR_H */ diff --git a/externals/ace/Containers.cpp b/externals/ace/Containers.cpp new file mode 100644 index 0000000..244a9ad --- /dev/null +++ b/externals/ace/Containers.cpp @@ -0,0 +1,12 @@ +// $Id: Containers.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Containers.h" + +ACE_RCSID (ace, + Containers, + "$Id: Containers.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if !defined (__ACE_INLINE__) +#include "ace/Containers.inl" +#endif /* __ACE_INLINE__ */ + diff --git a/externals/ace/Containers.h b/externals/ace/Containers.h new file mode 100644 index 0000000..ecff8e3 --- /dev/null +++ b/externals/ace/Containers.h @@ -0,0 +1,71 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Containers.h + * + * $Id: Containers.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_CONTAINERS_H +#define ACE_CONTAINERS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template class ACE_Double_Linked_List; +template class ACE_Double_Linked_List_Iterator_Base; +template class ACE_Double_Linked_List_Iterator; +template class ACE_Double_Linked_List_Reverse_Iterator; + +/** + * @class ACE_DLList_Node + * + * @brief Base implementation of element in a DL list. Needed for + * ACE_Double_Linked_List. + */ +class ACE_Export ACE_DLList_Node +{ +public: + friend class ACE_Double_Linked_List; + friend class ACE_Double_Linked_List_Iterator_Base; + friend class ACE_Double_Linked_List_Iterator; + friend class ACE_Double_Linked_List_Reverse_Iterator; + + ACE_DLList_Node (void *i, + ACE_DLList_Node *n = 0, + ACE_DLList_Node *p = 0); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + void *item_; + + ACE_DLList_Node *next_; + ACE_DLList_Node *prev_; + +protected: + ACE_DLList_Node (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Containers.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Containers_T.h" + +#include /**/ "ace/post.h" + +#endif /* ACE_CONTAINERS_H */ diff --git a/externals/ace/Containers.inl b/externals/ace/Containers.inl new file mode 100644 index 0000000..8094672 --- /dev/null +++ b/externals/ace/Containers.inl @@ -0,0 +1,25 @@ +// -*- C++ -*- +// +// $Id: Containers.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_DLList_Node::ACE_DLList_Node (void) + : item_ (0), + next_ (0), + prev_ (0) +{ +} + +ACE_INLINE +ACE_DLList_Node::ACE_DLList_Node (void *i, + ACE_DLList_Node *n, + ACE_DLList_Node *p) + : item_ (i), + next_ (n), + prev_ (p) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Containers_T.cpp b/externals/ace/Containers_T.cpp new file mode 100644 index 0000000..f4b6bd8 --- /dev/null +++ b/externals/ace/Containers_T.cpp @@ -0,0 +1,1932 @@ +// $Id: Containers_T.cpp 82588 2008-08-11 13:37:41Z johnnyw $ + +#ifndef ACE_CONTAINERS_T_CPP +#define ACE_CONTAINERS_T_CPP + +#include "ace/Log_Msg.h" +#include "ace/Malloc_Base.h" +#include "ace/OS_Memory.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Containers.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Containers_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Stack) + +template void +ACE_Bounded_Stack::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Bounded_Stack::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Bounded_Stack::ACE_Bounded_Stack (size_t size) + : size_ (size), + top_ (0) +{ + ACE_NEW (this->stack_, + T[size]); + ACE_TRACE ("ACE_Bounded_Stack::ACE_Bounded_Stack"); +} + +template +ACE_Bounded_Stack::ACE_Bounded_Stack (const ACE_Bounded_Stack &s) + : size_ (s.size_), + top_ (s.top_) +{ + ACE_NEW (this->stack_, + T[s.size_]); + + ACE_TRACE ("ACE_Bounded_Stack::ACE_Bounded_Stack"); + + for (size_t i = 0; i < this->top_; i++) + this->stack_[i] = s.stack_[i]; +} + +template void +ACE_Bounded_Stack::operator= (const ACE_Bounded_Stack &s) +{ + ACE_TRACE ("ACE_Bounded_Stack::operator="); + + if (&s != this) + { + if (this->size_ < s.size_) + { + delete [] this->stack_; + ACE_NEW (this->stack_, + T[s.size_]); + this->size_ = s.size_; + } + this->top_ = s.top_; + + for (size_t i = 0; i < this->top_; i++) + this->stack_[i] = s.stack_[i]; + } +} + +template +ACE_Bounded_Stack::~ACE_Bounded_Stack (void) +{ + ACE_TRACE ("ACE_Bounded_Stack::~ACE_Bounded_Stack"); + delete [] this->stack_; +} + +// ---------------------------------------- + +ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Stack) + +template void +ACE_Fixed_Stack::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Fixed_Stack::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Fixed_Stack::ACE_Fixed_Stack (void) + : size_ (ACE_SIZE), + top_ (0) +{ + ACE_TRACE ("ACE_Fixed_Stack::ACE_Fixed_Stack"); +} + +template +ACE_Fixed_Stack::ACE_Fixed_Stack (const ACE_Fixed_Stack &s) + : size_ (s.size_), + top_ (s.top_) +{ + ACE_TRACE ("ACE_Fixed_Stack::ACE_Fixed_Stack"); + for (size_t i = 0; i < this->top_; i++) + this->stack_[i] = s.stack_[i]; +} + +template void +ACE_Fixed_Stack::operator= (const ACE_Fixed_Stack &s) +{ + ACE_TRACE ("ACE_Fixed_Stack::operator="); + + if (&s != this) + { + this->top_ = s.top_; + + for (size_t i = 0; i < this->top_; i++) + this->stack_[i] = s.stack_[i]; + } +} + +template +ACE_Fixed_Stack::~ACE_Fixed_Stack (void) +{ + ACE_TRACE ("ACE_Fixed_Stack::~ACE_Fixed_Stack"); +} + +//---------------------------------------- + +ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Stack) + +template void +ACE_Unbounded_Stack::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Unbounded_Stack::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unbounded_Stack::ACE_Unbounded_Stack (ACE_Allocator *alloc) + : head_ (0), + cur_size_ (0), + allocator_ (alloc) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::ACE_Unbounded_Stack"); + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), + ACE_Node); + this->head_->next_ = this->head_; +} + +template void +ACE_Unbounded_Stack::delete_all_nodes (void) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::delete_all_nodes"); + + while (this->is_empty () == 0) + { + ACE_Node *temp = this->head_->next_; + this->head_->next_ = temp->next_; + ACE_DES_FREE_TEMPLATE (temp, this->allocator_->free, + ACE_Node, ); + } + + this->cur_size_ = 0; + + ACE_ASSERT (this->head_ == this->head_->next_ + && this->is_empty ()); +} + +template void +ACE_Unbounded_Stack::copy_all_nodes (const ACE_Unbounded_Stack &s) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::copy_all_nodes"); + + ACE_ASSERT (this->head_ == this->head_->next_); + + ACE_Node *temp = this->head_; + + for (ACE_Node *s_temp = s.head_->next_; + s_temp != s.head_; + s_temp = s_temp->next_) + { + ACE_Node *nptr = temp->next_; + ACE_NEW_MALLOC (temp->next_, + (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), + ACE_Node (s_temp->item_, nptr)); + temp = temp->next_; + } + this->cur_size_ = s.cur_size_; +} + +template +ACE_Unbounded_Stack::ACE_Unbounded_Stack (const ACE_Unbounded_Stack &s) + : head_ (0), + cur_size_ (0), + allocator_ (s.allocator_) +{ + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), + ACE_Node); + this->head_->next_ = this->head_; + + // ACE_TRACE ("ACE_Unbounded_Stack::ACE_Unbounded_Stack"); + this->copy_all_nodes (s); +} + +template void +ACE_Unbounded_Stack::operator= (const ACE_Unbounded_Stack &s) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::operator="); + + if (this != &s) + { + this->delete_all_nodes (); + this->copy_all_nodes (s); + } +} + +template +ACE_Unbounded_Stack::~ACE_Unbounded_Stack (void) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::~ACE_Unbounded_Stack"); + + this->delete_all_nodes (); + ACE_DES_FREE_TEMPLATE (head_, + this->allocator_->free, + ACE_Node, + ); +} + +template int +ACE_Unbounded_Stack::push (const T &new_item) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::push"); + + ACE_Node *temp = 0; + + ACE_NEW_MALLOC_RETURN (temp, + static_cast *> (this->allocator_->malloc (sizeof (ACE_Node))), + ACE_Node (new_item, this->head_->next_), + -1); + this->head_->next_ = temp; + ++this->cur_size_; + return 0; +} + +template int +ACE_Unbounded_Stack::pop (T &item) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::pop"); + + if (this->is_empty ()) + return -1; + else + { + ACE_Node *temp = this->head_->next_; + item = temp->item_; + this->head_->next_ = temp->next_; + + ACE_DES_FREE_TEMPLATE (temp, + this->allocator_->free, + ACE_Node, + ); + --this->cur_size_; + return 0; + } +} + +template int +ACE_Unbounded_Stack::find (const T &item) const +{ + // ACE_TRACE ("ACE_Unbounded_Stack::find"); + // Set into the dummy node. + this->head_->item_ = item; + + ACE_Node *temp = this->head_->next_; + + // Keep looping until we find the item. + while (!(temp->item_ == item)) + temp = temp->next_; + + // If we found the dummy node then it's not really there, otherwise, + // it is there. + return temp == this->head_ ? -1 : 0; +} + +template int +ACE_Unbounded_Stack::insert (const T &item) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::insert"); + + if (this->find (item) == 0) + return 1; + else + return this->push (item); +} + +template int +ACE_Unbounded_Stack::remove (const T &item) +{ + // ACE_TRACE ("ACE_Unbounded_Stack::remove"); + + // Insert the item to be founded into the dummy node. + this->head_->item_ = item; + + ACE_Node *curr = this->head_; + + while (!(curr->next_->item_ == item)) + curr = curr->next_; + + if (curr->next_ == this->head_) + return -1; // Item was not found. + else + { + ACE_Node *temp = curr->next_; + // Skip over the node that we're deleting. + curr->next_ = temp->next_; + --this->cur_size_; + ACE_DES_FREE_TEMPLATE (temp, + this->allocator_->free, + ACE_Node, + ); + return 0; + } +} + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Iterator_Base) + +template +ACE_Double_Linked_List_Iterator_Base::ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List &dll) + : current_ (0), dllist_ (&dll) +{ + // Do nothing +} + +template +ACE_Double_Linked_List_Iterator_Base::ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List_Iterator_Base &iter) + : current_ (iter.current_), + dllist_ (iter.dllist_) +{ + // Do nothing +} + + +template T * +ACE_Double_Linked_List_Iterator_Base::next (void) const +{ + return this->not_done (); +} + +template int +ACE_Double_Linked_List_Iterator_Base::next (T *&ptr) const +{ + ptr = this->not_done (); + return ptr ? 1 : 0; +} + + +template int +ACE_Double_Linked_List_Iterator_Base::done (void) const +{ + return this->not_done () ? 0 : 1; +} + +template T & +ACE_Double_Linked_List_Iterator_Base::operator* (void) const +{ + return *(this->not_done ()); +} + +// @@ Is this a valid retasking? Make sure to check with Purify and +// whatnot that we're not leaking memory or doing any other screwing things. +template void +ACE_Double_Linked_List_Iterator_Base::reset (ACE_Double_Linked_List &dll) +{ + current_ = 0; + dllist_ = &dll; +} + + template int +ACE_Double_Linked_List_Iterator_Base::go_head (void) +{ + this->current_ = static_cast (dllist_->head_->next_); + return this->current_ ? 1 : 0; +} + +template int +ACE_Double_Linked_List_Iterator_Base::go_tail (void) +{ + this->current_ = static_cast (dllist_->head_->prev_); + return this->current_ ? 1 : 0; +} + +template T * +ACE_Double_Linked_List_Iterator_Base::not_done (void) const +{ + if (this->current_ != this->dllist_->head_) + return this->current_; + else + return 0; +} + +template T * +ACE_Double_Linked_List_Iterator_Base::do_advance (void) +{ + if (this->not_done ()) + { + this->current_ = static_cast (this->current_->next_); + return this->not_done (); + } + else + return 0; +} + +template T * +ACE_Double_Linked_List_Iterator_Base::do_retreat (void) +{ + if (this->not_done ()) + { + this->current_ = static_cast (this->current_->prev_); + return this->not_done (); + } + else + return 0; +} + +template void +ACE_Double_Linked_List_Iterator_Base::dump_i (void) const +{ + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("current_ = %x"), this->current_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Iterator) + +template +ACE_Double_Linked_List_Iterator::ACE_Double_Linked_List_Iterator (const ACE_Double_Linked_List &dll) + : ACE_Double_Linked_List_Iterator_Base (dll) +{ + this->current_ = static_cast (dll.head_->next_); + // Advance current_ out of the null area and onto the first item in + // the list +} + +template void +ACE_Double_Linked_List_Iterator::reset (ACE_Double_Linked_List &dll) +{ + this->ACE_Double_Linked_List_Iterator_Base ::reset (dll); + this->current_ = static_cast (dll.head_->next_); + // Advance current_ out of the null area and onto the first item in + // the list +} + +template int +ACE_Double_Linked_List_Iterator::first (void) +{ + return this->go_head (); +} + +template int +ACE_Double_Linked_List_Iterator::advance (void) +{ + return this->do_advance () ? 1 : 0; +} + +template T* +ACE_Double_Linked_List_Iterator::advance_and_remove (bool dont_remove) +{ + T* item = 0; + if (dont_remove) + this->do_advance (); + else + { + item = this->next (); + this->do_advance (); + // It seems dangerous to remove nodes in an iterator, but so it goes... + ACE_Double_Linked_List *dllist = + const_cast *> (this->dllist_); + dllist->remove (item); + } + return item; +} + +template void +ACE_Double_Linked_List_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->dump_i (); +#endif /* ACE_HAS_DUMP */ +} + +// Prefix advance. + +template +ACE_Double_Linked_List_Iterator & +ACE_Double_Linked_List_Iterator::operator++ (void) +{ + this->do_advance (); + return *this; +} + + +// Postfix advance. + +template +ACE_Double_Linked_List_Iterator +ACE_Double_Linked_List_Iterator::operator++ (int) +{ + ACE_Double_Linked_List_Iterator retv (*this); + this->do_advance (); + return retv; +} + + +// Prefix reverse. + +template +ACE_Double_Linked_List_Iterator & +ACE_Double_Linked_List_Iterator::operator-- (void) +{ + this->do_retreat (); + return *this; +} + + +// Postfix reverse. + +template +ACE_Double_Linked_List_Iterator +ACE_Double_Linked_List_Iterator::operator-- (int) +{ + ACE_Double_Linked_List_Iterator retv (*this); + this->do_retreat (); + return retv; +} + + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List_Reverse_Iterator) + + template +ACE_Double_Linked_List_Reverse_Iterator::ACE_Double_Linked_List_Reverse_Iterator (ACE_Double_Linked_List &dll) + : ACE_Double_Linked_List_Iterator_Base (dll) +{ + this->current_ = static_cast (dll.head_->prev_); + // Advance current_ out of the null area and onto the last item in + // the list +} + +template void +ACE_Double_Linked_List_Reverse_Iterator::reset (ACE_Double_Linked_List &dll) +{ + this->ACE_Double_Linked_List_Iterator_Base ::reset (dll); + this->current_ = static_cast (dll.head_->prev_); + // Advance current_ out of the null area and onto the last item in + // the list +} + +template int +ACE_Double_Linked_List_Reverse_Iterator::first (void) +{ + return this->go_tail (); +} + +template int +ACE_Double_Linked_List_Reverse_Iterator::advance (void) +{ + return this->do_retreat () ? 1 : 0; +} + +template T* +ACE_Double_Linked_List_Reverse_Iterator::advance_and_remove (bool dont_remove) +{ + T* item = 0; + if (dont_remove) + { + this->do_retreat (); + } + else + { + item = this->next (); + this->do_retreat (); + // It seems dangerous to remove nodes in an iterator, but so it goes... + ACE_Double_Linked_List *dllist = + const_cast *> (this->dllist_); + dllist->remove (item); + } + return item; +} + +template void +ACE_Double_Linked_List_Reverse_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->dump_i (); +#endif /* ACE_HAS_DUMP */ +} + +// Prefix advance. + +template +ACE_Double_Linked_List_Reverse_Iterator & +ACE_Double_Linked_List_Reverse_Iterator::operator++ (void) +{ + this->do_retreat (); + return *this; +} + + +// Postfix advance. + +template +ACE_Double_Linked_List_Reverse_Iterator +ACE_Double_Linked_List_Reverse_Iterator::operator++ (int) +{ + ACE_Double_Linked_List_Reverse_Iterator retv (*this); + this->do_retreat (); + return retv; +} + + +// Prefix reverse. + +template +ACE_Double_Linked_List_Reverse_Iterator & +ACE_Double_Linked_List_Reverse_Iterator::operator-- (void) +{ + this->do_advance (); + return *this; +} + + +// Postfix reverse. + +template +ACE_Double_Linked_List_Reverse_Iterator +ACE_Double_Linked_List_Reverse_Iterator::operator-- (int) +{ + ACE_Double_Linked_List_Reverse_Iterator retv (*this); + this->do_advance (); + return retv; +} + + +ACE_ALLOC_HOOK_DEFINE(ACE_Double_Linked_List) + + template +ACE_Double_Linked_List:: ACE_Double_Linked_List (ACE_Allocator *alloc) + : size_ (0), allocator_ (alloc) +{ + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (T *) this->allocator_->malloc (sizeof (T)), + T); + this->init_head (); +} + +template +ACE_Double_Linked_List::ACE_Double_Linked_List (const ACE_Double_Linked_List &cx) + : allocator_ (cx.allocator_) +{ + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (T *) this->allocator_->malloc (sizeof (T)), + T); + this->init_head (); + this->copy_nodes (cx); + this->size_ = cx.size_; +} + +template void +ACE_Double_Linked_List::operator= (const ACE_Double_Linked_List &cx) +{ + if (this != &cx) + { + this->delete_nodes (); + this->copy_nodes (cx); + } +} + +template +ACE_Double_Linked_List::~ACE_Double_Linked_List (void) +{ + this->delete_nodes (); + + ACE_DES_FREE (head_, + this->allocator_->free, + T); + + this->head_ = 0; +} + +template int +ACE_Double_Linked_List::is_empty (void) const +{ + return this->size () ? 0 : 1; +} + +template int +ACE_Double_Linked_List::is_full (void) const +{ + return 0; // We have no bound. +} + +template T * +ACE_Double_Linked_List::insert_tail (T *new_item) +{ + // Insert it before , i.e., at tail. + this->insert_element (new_item, 1); + return new_item; +} + +template T * +ACE_Double_Linked_List::insert_head (T *new_item) +{ + this->insert_element (new_item); // Insert it after , i.e., at head. + return new_item; +} + +template T * +ACE_Double_Linked_List::delete_head (void) +{ + if (this->is_empty ()) + return 0; + + T *temp = static_cast (this->head_->next_); + // Detach it from the list. + this->remove_element (temp); + return temp; +} + +template T * +ACE_Double_Linked_List::delete_tail (void) +{ + if (this->is_empty ()) + return 0; + + T *temp = static_cast (this->head_->prev_); + // Detach it from the list. + this->remove_element (temp); + return temp; +} + +template void +ACE_Double_Linked_List::reset (void) +{ + this->delete_nodes (); +} + +template int +ACE_Double_Linked_List::get (T *&item, size_t slot) +{ + ACE_Double_Linked_List_Iterator iter (*this); + + for (size_t i = 0; + i < slot && !iter.done (); + i++) + iter.advance (); + + item = iter.next (); + return item ? 0 : -1; +} + +template size_t +ACE_Double_Linked_List::size (void) const +{ + return this->size_; +} + +template void +ACE_Double_Linked_List::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // Dump the state of an object. +#endif /* ACE_HAS_DUMP */ +} + +#if 0 +template T * +ACE_Double_Linked_List::find (const T &item) +{ + for (ACE_Double_Linked_List_Iterator iter (*this); + !iter.done (); + iter.advance ()) + { + T *temp = iter.next (); + + if (*temp == item) + return temp; + } + + return 0; +} + +template int +ACE_Double_Linked_List::remove (const T &item) +{ + T *temp = this->find (item); + + if (temp != 0) + return this->remove (temp); + else + return -1; +} +#endif /* 0 */ + +template int +ACE_Double_Linked_List::remove (T *n) +{ + return this->remove_element (n); +} + +template void +ACE_Double_Linked_List::delete_nodes (void) +{ + while (! this->is_empty ()) + { + T * temp = static_cast (this->head_->next_); + this->remove_element (temp); + ACE_DES_FREE (temp, + this->allocator_->free, + T); + } +} + +template void +ACE_Double_Linked_List::copy_nodes (const ACE_Double_Linked_List &c) +{ + for (ACE_Double_Linked_List_Iterator iter (c); + !iter.done (); + iter.advance ()) + { + T* temp = 0; + ACE_NEW_MALLOC (temp, + (T *)this->allocator_->malloc (sizeof (T)), + T (*iter.next ())); + this->insert_tail (temp); + } +} + +template void +ACE_Double_Linked_List::init_head (void) +{ + this->head_->next_ = this->head_; + this->head_->prev_ = this->head_; +} + +template int +ACE_Double_Linked_List::insert_element (T *new_item, + int before, + T *old_item) +{ + if (old_item == 0) + old_item = this->head_; + + if (before) + old_item = static_cast (old_item->prev_); + + new_item->next_ = old_item->next_; + new_item->next_->prev_ = new_item; + new_item->prev_ = old_item; + old_item->next_ = new_item; + ++this->size_; + return 0; // Well, what will cause errors here? +} + +template int +ACE_Double_Linked_List::remove_element (T *item) +{ + // Notice that you have to ensure that item is an element of this + // list. We can't do much checking here. + + if (item == this->head_ || item->next_ == 0 + || item->prev_ == 0 || this->size () == 0) // Can't remove head + return -1; + + item->prev_->next_ = item->next_; + item->next_->prev_ = item->prev_; + item->next_ = item->prev_ = 0; // reset pointers to prevent double removal. + --this->size_; + return 0; +} + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set) + +template size_t +ACE_Fixed_Set::size (void) const +{ + ACE_TRACE ("ACE_Fixed_Set::size"); + return this->cur_size_; +} + +template void +ACE_Fixed_Set::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Fixed_Set::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Fixed_Set::~ACE_Fixed_Set (void) +{ + ACE_TRACE ("ACE_Fixed_Set::~ACE_Fixed_Set"); + this->cur_size_ = 0; +} + +template +ACE_Fixed_Set::ACE_Fixed_Set (const ACE_Fixed_Set &fs) + : cur_size_ (fs.cur_size_) +{ + ACE_TRACE ("ACE_Fixed_Set::ACE_Fixed_Set"); + + for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i) + if (fs.search_structure_[i].is_free_ == 0) + this->search_structure_[j++] = fs.search_structure_[i]; +} + +template void +ACE_Fixed_Set::operator= (const ACE_Fixed_Set &fs) +{ + ACE_TRACE ("ACE_Fixed_Set::operator="); + + if (this != &fs) + { + this->cur_size_ = fs.cur_size_; + + for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i) + if (fs.search_structure_[i].is_free_ == 0) + this->search_structure_[j++] = fs.search_structure_[i]; + } +} + +template +ACE_Fixed_Set::ACE_Fixed_Set (void) + : cur_size_ (0), + max_size_ (ACE_SIZE) +{ + ACE_TRACE ("ACE_Fixed_Set::ACE_Fixed_Set"); + for (size_t i = 0; i < this->max_size_; i++) + this->search_structure_[i].is_free_ = 1; +} + +template int +ACE_Fixed_Set::find (const T &item) const +{ + ACE_TRACE ("ACE_Fixed_Set::find"); + + for (size_t i = 0, j = 0; i < this->max_size_ && j < this->cur_size_; ++i) + if (this->search_structure_[i].is_free_ == 0) + { + if (this->search_structure_[i].item_ == item) + return 0; + ++j; + } + + return -1; +} + +template int +ACE_Fixed_Set::insert (const T &item) +{ + ACE_TRACE ("ACE_Fixed_Set::insert"); + ssize_t first_free = -1; // Keep track of first free slot. + size_t i; + + for (i = 0; + i < this->max_size_ && first_free == -1; + ++i) + + // First, make sure we don't allow duplicates. + + if (this->search_structure_[i].is_free_ == 0) + { + if (this->search_structure_[i].item_ == item) + return 1; + } + else + first_free = static_cast (i); + + // If we found a free spot let's reuse it. + + if (first_free > -1) + { + this->search_structure_[first_free].item_ = item; + this->search_structure_[first_free].is_free_ = 0; + this->cur_size_++; + return 0; + } + else /* No more room! */ + { + errno = ENOMEM; + return -1; + } +} + +template int +ACE_Fixed_Set::remove (const T &item) +{ + ACE_TRACE ("ACE_Fixed_Set::remove"); + + for (size_t i = 0, j = 0; + i < this->max_size_ && j < this->cur_size_; + ++i) + if (this->search_structure_[i].is_free_ == 0) + { + if (this->search_structure_[i].item_ == item) + { + // Mark this entry as being free. + this->search_structure_[i].is_free_ = 1; + + --this->cur_size_; + return 0; + } + else + ++j; + } + + return -1; +} + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Iterator_Base) + +template void +ACE_Fixed_Set_Iterator_Base::dump_i (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::dump_i"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Fixed_Set_Iterator_Base::ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set &s) + : s_ (s), + next_ (-1), + iterated_items_ (0) +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::ACE_Fixed_Set_Iterator_Base"); + this->advance (); +} + +template int +ACE_Fixed_Set_Iterator_Base::advance (void) +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::advance"); + + if (this->iterated_items_ < this->s_.cur_size_) + { + for (++this->next_; + static_cast (this->next_) < this->s_.max_size_; + ++this->next_) + if (this->s_.search_structure_[this->next_].is_free_ == 0) + { + ++this->iterated_items_; + return 1; + } + } + else + ++this->next_; + + return 0; +} + +template int +ACE_Fixed_Set_Iterator_Base::first (void) +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::first"); + + next_ = -1; + iterated_items_ = 0; + return this->advance (); +} + +template int +ACE_Fixed_Set_Iterator_Base::done (void) const +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::done"); + + return ! (this->iterated_items_ < this->s_.cur_size_); +} + +template int +ACE_Fixed_Set_Iterator_Base::next_i (T *&item) +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator_Base::next_i"); + + if (static_cast (this->next_) < this->s_.max_size_) + do + { + if (this->s_.search_structure_[this->next_].is_free_ == 0) + { + item = &this->s_.search_structure_[this->next_].item_; + this->advance (); + return 1; + } + } + while (this->advance () == 1); + + return 0; +} + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Iterator) + +template void +ACE_Fixed_Set_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->dump_i (); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Fixed_Set_Iterator::ACE_Fixed_Set_Iterator (ACE_Fixed_Set &s) + : ACE_Fixed_Set_Iterator_Base (s) +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator::ACE_Fixed_Set_Iterator"); +} + +template int +ACE_Fixed_Set_Iterator::next (T *&item) +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator::next"); + return this->next_i (item); +} + +template int +ACE_Fixed_Set_Iterator::remove (T *&item) +{ + ACE_TRACE ("ACE_Fixed_Set_Iterator::remove"); + + if (this->s_.search_structure_[this->next_].is_free_ == 0) + { + item = &this->s_.search_structure_[this->next_].item_; + this->s_.remove (*item); + --(this->iterated_items_); + return 1; + } + + return 0; +} + +template T& +ACE_Fixed_Set_Iterator::operator* (void) +{ + T *retv = 0; + + if (this->s_.search_structure_[this->next_].is_free_ == 0) + retv = &this->s_.search_structure_[this->next_].item_; + + ACE_ASSERT (retv != 0); + + return *retv; +} + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set_Const_Iterator) + +template void +ACE_Fixed_Set_Const_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + this->dump_i (); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Fixed_Set_Const_Iterator::ACE_Fixed_Set_Const_Iterator (const ACE_Fixed_Set &s) + : ACE_Fixed_Set_Iterator_Base (s) +{ + ACE_TRACE ("ACE_Fixed_Set_Const_Iterator::ACE_Fixed_Set_Const_Iterator"); +} + +template int +ACE_Fixed_Set_Const_Iterator::next (const T *&item) +{ + ACE_TRACE ("ACE_Fixed_Set_Const_Iterator::next"); + + return this->next_i (item); +} + +template const T& +ACE_Fixed_Set_Const_Iterator::operator* (void) const +{ + const T *retv = 0; + + if (this->s_.search_structure_[this->next_].is_free_ == 0) + retv = &this->s_.search_structure_[this->next_].item_; + + ACE_ASSERT (retv != 0); + + return *retv; +} + +//-------------------------------------------------- +ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Set) + +template void +ACE_Bounded_Set::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Bounded_Set::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Bounded_Set::~ACE_Bounded_Set (void) +{ + ACE_TRACE ("ACE_Bounded_Set::~ACE_Bounded_Set"); + delete [] this->search_structure_; +} + +template +ACE_Bounded_Set::ACE_Bounded_Set (void) + : cur_size_ (0), + max_size_ (static_cast (ACE_Bounded_Set::DEFAULT_SIZE)) +{ + ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); + + ACE_NEW (this->search_structure_, + typename ACE_Bounded_Set::Search_Structure[this->max_size_]); + + for (size_t i = 0; i < this->max_size_; ++i) + this->search_structure_[i].is_free_ = 1; +} + +template size_t +ACE_Bounded_Set::size (void) const +{ + ACE_TRACE ("ACE_Bounded_Set::size"); + return this->cur_size_; +} + +template +ACE_Bounded_Set::ACE_Bounded_Set (const ACE_Bounded_Set &bs) + : cur_size_ (bs.cur_size_), + max_size_ (bs.max_size_) +{ + ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); + + ACE_NEW (this->search_structure_, + typename ACE_Bounded_Set::Search_Structure[this->max_size_]); + + for (size_t i = 0; i < this->cur_size_; i++) + this->search_structure_[i] = bs.search_structure_[i]; +} + +template void +ACE_Bounded_Set::operator= (const ACE_Bounded_Set &bs) +{ + ACE_TRACE ("ACE_Bounded_Set::operator="); + + if (this != &bs) + { + if (this->max_size_ < bs.cur_size_) + { + delete [] this->search_structure_; + ACE_NEW (this->search_structure_, + typename ACE_Bounded_Set::Search_Structure[bs.cur_size_]); + this->max_size_ = bs.cur_size_; + } + + this->cur_size_ = bs.cur_size_; + + for (size_t i = 0; i < this->cur_size_; i++) + this->search_structure_[i] = bs.search_structure_[i]; + } +} + +template +ACE_Bounded_Set::ACE_Bounded_Set (size_t size) + : cur_size_ (0), + max_size_ (size) +{ + ACE_TRACE ("ACE_Bounded_Set::ACE_Bounded_Set"); + ACE_NEW (this->search_structure_, + typename ACE_Bounded_Set::Search_Structure[size]); + + for (size_t i = 0; i < this->max_size_; i++) + this->search_structure_[i].is_free_ = 1; +} + +template int +ACE_Bounded_Set::find (const T &item) const +{ + ACE_TRACE ("ACE_Bounded_Set::find"); + + for (size_t i = 0; i < this->cur_size_; i++) + if (this->search_structure_[i].item_ == item + && this->search_structure_[i].is_free_ == 0) + return 0; + + return -1; +} + +template int +ACE_Bounded_Set::insert (const T &item) +{ + ACE_TRACE ("ACE_Bounded_Set::insert"); + int first_free = -1; // Keep track of first free slot. + size_t i; + + for (i = 0; i < this->cur_size_; i++) + // First, make sure we don't allow duplicates. + + if (this->search_structure_[i].item_ == item + && this->search_structure_[i].is_free_ == 0) + return 1; + else if (this->search_structure_[i].is_free_ && first_free == -1) + first_free = static_cast (i); + + if (first_free > -1) // If we found a free spot let's reuse it. + { + this->search_structure_[first_free].item_ = item; + this->search_structure_[first_free].is_free_ = 0; + return 0; + } + else if (i < this->max_size_) // Insert at the end of the active portion. + { + this->search_structure_[i].item_ = item; + this->search_structure_[i].is_free_ = 0; + this->cur_size_++; + return 0; + } + else /* No more room! */ + { + errno = ENOMEM; + return -1; + } +} + +template int +ACE_Bounded_Set::remove (const T &item) +{ + ACE_TRACE ("ACE_Bounded_Set::remove"); + for (size_t i = 0; i < this->cur_size_; i++) + if (this->search_structure_[i].item_ == item) + { + // Mark this entry as being free. + this->search_structure_[i].is_free_ = 1; + + // If we just unbound the highest entry, then we need to + // figure out where the next highest active entry is. + if (i + 1 == this->cur_size_) + { + while (i > 0 && this->search_structure_[--i].is_free_) + continue; + + if (i == 0 && this->search_structure_[i].is_free_) + this->cur_size_ = 0; + else + this->cur_size_ = i + 1; + } + return 0; + } + + return -1; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Set_Iterator) + + template void +ACE_Bounded_Set_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Bounded_Set_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Bounded_Set_Iterator::ACE_Bounded_Set_Iterator (ACE_Bounded_Set &s) + : s_ (s), + next_ (-1) +{ + ACE_TRACE ("ACE_Bounded_Set_Iterator::ACE_Bounded_Set_Iterator"); + this->advance (); +} + +template int +ACE_Bounded_Set_Iterator::advance (void) +{ + ACE_TRACE ("ACE_Bounded_Set_Iterator::advance"); + + for (++this->next_; + static_cast (this->next_) < this->s_.cur_size_ + && this->s_.search_structure_[this->next_].is_free_; + ++this->next_) + continue; + + return static_cast (this->next_) < this->s_.cur_size_; +} + +template int +ACE_Bounded_Set_Iterator::first (void) +{ + ACE_TRACE ("ACE_Bounded_Set_Iterator::first"); + + next_ = -1; + return this->advance (); +} + +template int +ACE_Bounded_Set_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Bounded_Set_Iterator::done"); + + return static_cast (this->next_) >= + this->s_.cur_size_; +} + +template int +ACE_Bounded_Set_Iterator::next (T *&item) +{ + ACE_TRACE ("ACE_Bounded_Set_Iterator::next"); + if (static_cast (this->next_) < this->s_.cur_size_) + { + item = &this->s_.search_structure_[this->next_].item_; + return 1; + } + else + return 0; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_DNode) + + template +ACE_DNode::ACE_DNode (const T &i, ACE_DNode *n, ACE_DNode *p) + : next_ (n), prev_ (p), item_ (i) +{ +} + +template +ACE_DNode::~ACE_DNode (void) +{ +} + +// **************************************************************** + +template void +ACE_Unbounded_Stack_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unbounded_Stack_Iterator::ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack &q) + : current_ (q.head_->next_), + stack_ (q) +{ + // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::ACE_Unbounded_Stack_Iterator"); +} + +template int +ACE_Unbounded_Stack_Iterator::advance (void) +{ + // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::advance"); + this->current_ = this->current_->next_; + return this->current_ != this->stack_.head_; +} + +template int +ACE_Unbounded_Stack_Iterator::first (void) +{ + // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::first"); + this->current_ = this->stack_.head_->next_; + return this->current_ != this->stack_.head_; +} + +template int +ACE_Unbounded_Stack_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Unbounded_Stack_Iterator::done"); + + return this->current_ == this->stack_.head_; +} + +template int +ACE_Unbounded_Stack_Iterator::next (T *&item) +{ + // ACE_TRACE ("ACE_Unbounded_Stack_Iterator::next"); + if (this->current_ == this->stack_.head_) + return 0; + else + { + item = &this->current_->item_; + return 1; + } +} + + +ACE_ALLOC_HOOK_DEFINE(ACE_Ordered_MultiSet) + + + template +ACE_Ordered_MultiSet::ACE_Ordered_MultiSet (ACE_Allocator *alloc) + : head_ (0) + , tail_ (0) + , cur_size_ (0) + , allocator_ (alloc) +{ + // ACE_TRACE ("ACE_Ordered_MultiSet::ACE_Ordered_MultiSet"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); +} + +template +ACE_Ordered_MultiSet::ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet &us) + : head_ (0) + , tail_ (0) + , cur_size_ (0) + , allocator_ (us.allocator_) +{ + ACE_TRACE ("ACE_Ordered_MultiSet::ACE_Ordered_MultiSet"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + this->copy_nodes (us); +} + +template +ACE_Ordered_MultiSet::~ACE_Ordered_MultiSet (void) +{ + // ACE_TRACE ("ACE_Ordered_MultiSet::~ACE_Ordered_MultiSet"); + + this->delete_nodes (); +} + + +template void +ACE_Ordered_MultiSet::operator= (const ACE_Ordered_MultiSet &us) +{ + ACE_TRACE ("ACE_Ordered_MultiSet::operator="); + + if (this != &us) + { + this->delete_nodes (); + this->copy_nodes (us); + } +} + + +template int +ACE_Ordered_MultiSet::insert (const T &item) +{ + // ACE_TRACE ("ACE_Ordered_MultiSet::insert"); + + return this->insert_from (item, this->head_, 0); +} + +template int +ACE_Ordered_MultiSet::insert (const T &new_item, + ITERATOR &iter) +{ + // ACE_TRACE ("ACE_Ordered_MultiSet::insert using iterator"); + + return this->insert_from (new_item, iter.current_, &iter.current_); +} + +template int +ACE_Ordered_MultiSet::remove (const T &item) +{ + // ACE_TRACE ("ACE_Ordered_MultiSet::remove"); + + ACE_DNode *node = 0; + + int result = locate (item, 0, node); + + // if we found the node, remove from list and free it + if (node && (result == 0)) + { + if (node->prev_) + node->prev_->next_ = node->next_; + else + head_ = node->next_; + + if (node->next_) + node->next_->prev_ = node->prev_; + else + tail_ = node->prev_; + + --this->cur_size_; + + ACE_DES_FREE_TEMPLATE (node, + this->allocator_->free, + ACE_DNode, + ); + return 0; + } + + return -1; +} + +template int +ACE_Ordered_MultiSet::find (const T &item, + ITERATOR &iter) const +{ + // search an occurance of item, using iterator's current position as a hint + ACE_DNode *node = iter.current_; + int const result = locate (item, node, node); + + // if we found the node, update the iterator and indicate success + if (node && (result == 0)) + { + iter.current_ = node; + return 0; + } + + return -1; +} + + + +template void +ACE_Ordered_MultiSet::reset (void) +{ + ACE_TRACE ("reset"); + + this->delete_nodes (); +} + +template void +ACE_Ordered_MultiSet::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Ordered_MultiSet::dump"); + // + // ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_ = %u"), this->head_)); + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); + // + // T *item = 0; + // size_t count = 1; + // + // for (ACE_Ordered_MultiSet_Iterator iter (*(ACE_Ordered_MultiSet *) this); + // iter.next (item) != 0; + // iter.advance ()) + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("count = %d\n"), count++)); + // + // ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template int +ACE_Ordered_MultiSet::insert_from (const T &item, ACE_DNode *position, + ACE_DNode **new_position) +{ + // ACE_TRACE ("ACE_Ordered_MultiSet::insert_from"); + + // create a new node + ACE_DNode *temp = 0; + ACE_NEW_MALLOC_RETURN (temp, + static_cast*> (this->allocator_->malloc (sizeof (ACE_DNode))), + ACE_DNode (item), + -1); + // obtain approximate location of the node + int result = locate (item, position, position); + + // if there are nodes in the multiset + if (position) + { + switch (result) + { + // insert after the approximate position + case -1: + + // if there is a following node + if (position->next_) + { + // link up with the following node + position->next_->prev_ = temp; + temp->next_ = position->next_; + } + else + // appending to the end of the set + tail_ = temp; + + // link up with the preceeding node + temp->prev_ = position; + position->next_ = temp; + + break; + + // insert before the position + case 0: + case 1: + + // if there is a preceeding node + if (position->prev_) + { + // link up with the preceeding node + position->prev_->next_ = temp; + temp->prev_ = position->prev_; + } + else + // prepending to the start of the set + head_ = temp; + + // link up with the preceeding node + temp->next_ = position; + position->prev_ = temp; + + break; + + default: + return -1; + } + } + else + { + // point the head and tail to the new node. + this->head_ = temp; + this->tail_ = temp; + } + + ++this->cur_size_; + if (new_position) + *new_position = temp; + + return 0; +} + +template int +ACE_Ordered_MultiSet::locate (const T &item, ACE_DNode *start_position, + ACE_DNode *&new_position) const +{ + if (! start_position) + start_position = this->head_; + + // If starting before the item, move forward until at or just before + // item. + while (start_position && start_position->item_ < item && + start_position->next_) + start_position = start_position->next_; + + // If starting after the item, move back until at or just after item + while (start_position && item < start_position->item_ && + start_position->prev_) + start_position = start_position->prev_; + + // Save the (approximate) location in the passed pointer. + new_position = start_position; + + // Show the location is after (1), before (-1) , or at (0) the item + if (!new_position) + return 1; + else if (item < new_position->item_) + return 1; + else if (new_position->item_ < item) + return -1; + else + return 0; +} + +// Looks for first occurance of in the ordered set, using the +// passed starting position as a hint: if there is such an instance, +// it updates the new_position pointer to point to one such node and +// returns 0; if there is no such node, then if there is a node before +// where the item would have been, it updates the new_position pointer +// to point to this node and returns -1; if there is no such node, +// then if there is a node after where the item would have been, it +// updates the new_position pointer to point to this node (or 0 if +// there is no such node) and returns 1; + +template void +ACE_Ordered_MultiSet::copy_nodes (const ACE_Ordered_MultiSet &us) +{ + ACE_DNode *insertion_point = this->head_; + + for (ACE_DNode *curr = us.head_; + curr != 0; + curr = curr->next_) + this->insert_from (curr->item_, insertion_point, &insertion_point); +} + +template void +ACE_Ordered_MultiSet::delete_nodes (void) +{ + // iterate through list, deleting nodes + for (ACE_DNode *curr = this->head_; + curr != 0; + ) + { + ACE_DNode *temp = curr; + curr = curr->next_; + ACE_DES_FREE_TEMPLATE (temp, + this->allocator_->free, + ACE_DNode, + ); + } + + this->head_ = 0; + this->tail_ = 0; + this->cur_size_ = 0; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Ordered_MultiSet_Iterator) + +template +ACE_Ordered_MultiSet_Iterator::ACE_Ordered_MultiSet_Iterator (ACE_Ordered_MultiSet &s) + : current_ (s.head_), + set_ (s) +{ + // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::ACE_Ordered_MultiSet_Iterator"); +} + +template int +ACE_Ordered_MultiSet_Iterator::next (T *&item) const +{ + // ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::next"); + if (this->current_) + { + item = &this->current_->item_; + return 1; + } + + return 0; +} + +template T& +ACE_Ordered_MultiSet_Iterator::operator* (void) +{ + //ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::operator*"); + T *retv = 0; + + int const result = this->next (retv); + ACE_ASSERT (result != 0); + ACE_UNUSED_ARG (result); + + return *retv; +} + +ACE_ALLOC_HOOK_DEFINE (ACE_DLList_Node) + +template T * +ACE_DLList::insert_tail (T *new_item) +{ + ACE_DLList_Node *temp1 = 0; + ACE_NEW_MALLOC_RETURN (temp1, + static_cast (this->allocator_->malloc (sizeof (ACE_DLList_Node))), + ACE_DLList_Node (new_item), + 0); + ACE_DLList_Node *temp2 = ACE_DLList_Base::insert_tail (temp1); + return (T *) (temp2 ? temp2->item_ : 0); +} + +template T * +ACE_DLList::insert_head (T *new_item) +{ + ACE_DLList_Node *temp1 = 0; + ACE_NEW_MALLOC_RETURN (temp1, + (ACE_DLList_Node *) this->allocator_->malloc (sizeof (ACE_DLList_Node)), + ACE_DLList_Node (new_item), 0); + ACE_DLList_Node *temp2 = ACE_DLList_Base::insert_head (temp1); + return (T *) (temp2 ? temp2->item_ : 0); +} + +template T * +ACE_DLList::delete_head (void) +{ + ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_head (); + T *temp2 = (T *) (temp1 ? temp1->item_ : 0); + ACE_DES_FREE (temp1, + this->allocator_->free, + ACE_DLList_Node); + + return temp2; +} + +template T * +ACE_DLList::delete_tail (void) +{ + ACE_DLList_Node *temp1 = ACE_DLList_Base::delete_tail (); + T *temp2 = (T *) (temp1 ? temp1->item_ : 0); + ACE_DES_FREE (temp1, + this->allocator_->free, + ACE_DLList_Node); + return temp2; +} + +// **************************************************************** + +// Compare this array with for equality. + +template bool +ACE_Array::operator== (const ACE_Array &s) const +{ + if (this == &s) + return true; + else if (this->size () != s.size ()) + return false; + + const size_t len = s.size (); + for (size_t slot = 0; slot < len; ++slot) + if ((*this)[slot] != s[slot]) + return false; + + return true; +} + +// **************************************************************** + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CONTAINERS_T_CPP */ diff --git a/externals/ace/Containers_T.h b/externals/ace/Containers_T.h new file mode 100644 index 0000000..3f5463f --- /dev/null +++ b/externals/ace/Containers_T.h @@ -0,0 +1,2068 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Containers_T.h + * + * $Id: Containers_T.h 88975 2010-02-12 19:19:38Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_CONTAINERS_T_H +#define ACE_CONTAINERS_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Need by ACE_DLList_Node. +#include "ace/Containers.h" + +// Shared with "ace/Unbounded_Set.h" +#include "ace/Node.h" + +// Backwards compatibility, please include "ace/Array_Base.h" directly. +#include "ace/Array_Base.h" + +// Backwards compatibility, please include "ace/Unbounded_Set.h" directly. +#include "ace/Unbounded_Set.h" + +// Backwards compatibility, please include "ace/Unbounded_Queue.h" directly. +#include "ace/Unbounded_Queue.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Allocator; + + +/** + * @class ACE_Bounded_Stack + * + * @brief Implement a generic LIFO abstract data type. + * + * This implementation of a Stack uses a bounded array + * that is allocated dynamically. The Stack interface + * provides the standard constant time push, pop, and top + * operations. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Dynamic array + * - Duplicates allowed? + * Yes + * - Random access allowed? + * No + * - Search speed + * N/A + * - Insert/replace speed + * N/A + * - Iterator still valid after change to container? + * N/A + * - Frees memory for removed elements? + * No + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * + */ +template +class ACE_Bounded_Stack +{ +public: + // = Initialization, assignment, and termination methods. + + /// Initialize a new empty stack with the provided size.. + /** + * Initialize and allocate space for a new Bounded_Stack with the provided + * size. + */ + ACE_Bounded_Stack (size_t size); + + /// Initialize the stack to be a copy of the stack provided. + /** + * Initialize the stack to be an exact copy of the Bounded_Stack provided + * as a parameter. + */ + ACE_Bounded_Stack (const ACE_Bounded_Stack &s); + + /// Assignment operator + /** + * Perform a deep copy operation using the Bounded_Stack parameter. If the + * capacity of the lhs isn't sufficient for the rhs, then the underlying data + * structure will be reallocated to accomadate the larger number of elements. + */ + void operator= (const ACE_Bounded_Stack &s); + + /// Perform actions needed when stack goes out of scope. + /** + * Deallocate the memory used by the Bounded_Stack. + */ + ~ACE_Bounded_Stack (void); + + // = Classic Stack operations. + + ///Add an element to the top of the stack. + /** + * Place a new item on top of the stack. Returns -1 if the stack + * is already full, 0 if the stack is not already full, and -1 if + * failure occurs. + */ + int push (const T &new_item); + + ///Remove an item from the top of stack. + /** + * Remove and return the top stack item. Returns -1 if the stack is + * already empty, 0 if the stack is not already empty, and -1 if + * failure occurs. + */ + int pop (T &item); + + ///Examine the contents of the top of stack. + /** + * Return top stack item without removing it. Returns -1 if the + * stack is already empty, 0 if the stack is not already empty, and + * -1 if failure occurs. + */ + int top (T &item) const; + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, otherwise returns 0. + /** + * Performs constant time check to determine if the stack is empty. + */ + int is_empty (void) const; + + /// Returns 1 if the container is full, otherwise returns 0. + /** + * Performs constant time check to determine if the stack is at capacity. + */ + int is_full (void) const; + + /// The number of items in the stack. + /** + * Return the number of items currently in the stack. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Size of the dynamically allocated data. + size_t size_; + + /// Keeps track of the current top of stack. + size_t top_; + + /// Holds the stack's contents. + T *stack_; +}; + +//---------------------------------------- + + +/** + * @class ACE_Fixed_Stack + * + * @brief Implement a generic LIFO abstract data type. + * + * This implementation of a Stack uses a fixed array + * with the size fixed at instantiation time. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Fixed array + * - Duplicates allowed? + * Yes + * - Random access allowed? + * No + * - Search speed + * N/A + * - Insert/replace speed + * N/A + * - Iterator still valid after change to container? + * N/A + * - Frees memory for removed elements? + * No + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * + */ +template +class ACE_Fixed_Stack +{ +public: + // = Initialization, assignment, and termination methods. + /// Initialize a new stack so that it is empty. + /** + * Initialize an empty stack. + */ + ACE_Fixed_Stack (void); + + /// The copy constructor (performs initialization). + /** + * Initialize the stack and copy the provided stack into the current stack. + */ + ACE_Fixed_Stack (const ACE_Fixed_Stack &s); + + /// Assignment operator (performs assignment). + /** + * Perform a deep copy of the provided stack. + */ + void operator= (const ACE_Fixed_Stack &s); + + /// Perform actions needed when stack goes out of scope. + /** + * Destroy the stack. + */ + ~ACE_Fixed_Stack (void); + + // = Classic Stack operations. + + ///Constant time placement of element on top of stack. + /** + * Place a new item on top of the stack. Returns -1 if the stack + * is already full, 0 if the stack is not already full, and -1 if + * failure occurs. + */ + int push (const T &new_item); + + ///Constant time removal of top of stack. + /** + * Remove and return the top stack item. Returns -1 if the stack is + * already empty, 0 if the stack is not already empty, and -1 if + * failure occurs. + */ + int pop (T &item); + + ///Constant time examination of top of stack. + /** + * Return top stack item without removing it. Returns -1 if the + * stack is already empty, 0 if the stack is not already empty, and + * -1 if failure occurs. + */ + int top (T &item) const; + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, otherwise returns 0. + /** + * Performs constant time check to see if stack is empty. + */ + int is_empty (void) const; + + /// Returns 1 if the container is full, otherwise returns 0. + /** + * Performs constant time check to see if stack is full. + */ + int is_full (void) const; + + /// The number of items in the stack. + /** + * Constant time access to the current size of the stack. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Size of the allocated data. + size_t size_; + + /// Keeps track of the current top of stack. + size_t top_; + + /// Holds the stack's contents. + T stack_[ACE_SIZE]; +}; + +//---------------------------------------- + +template class ACE_Ordered_MultiSet; +template class ACE_Ordered_MultiSet_Iterator; + +/** + * @class ACE_DNode + * + * @brief Implementation element in a bilinked list. + */ +template +class ACE_DNode +{ + friend class ACE_Ordered_MultiSet; + friend class ACE_Ordered_MultiSet_Iterator; + +public: + + /// This isn't necessary, but it keeps some compilers happy. + ~ACE_DNode (void); + +private: + + // = Initialization methods + ACE_DNode (const T &i, ACE_DNode *n = 0, ACE_DNode *p = 0); + + /// Pointer to next element in the list of {ACE_DNode}s. + ACE_DNode *next_; + + /// Pointer to previous element in the list of {ACE_DNode}s. + ACE_DNode *prev_; + + /// Current value of the item in this node. + T item_; +}; + + + +/** + * @class ACE_Unbounded_Stack + * + * @brief Implement a generic LIFO abstract data type. + * + * This implementation of an unbounded Stack uses a linked list. + * If you use the {insert} or {remove} methods you should keep + * in mind that duplicate entries aren't allowed. In general, + * therefore, you should avoid the use of these methods since + * they aren't really part of the ADT stack. The stack is implemented + * as a doubly linked list. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Double linked list + * - Duplicates allowed? + * No + * - Random access allowed? + * No + * - Search speed + * Linear + * - Insert/replace speed + * Linear + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * Yes + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * + */ +template +class ACE_Unbounded_Stack +{ +public: + friend class ACE_Unbounded_Stack_Iterator; + + // Trait definition. + typedef ACE_Unbounded_Stack_Iterator ITERATOR; + + // = Initialization, assignment, and termination methods. + /// Initialize a new stack so that it is empty. Use user defined + /// allocation strategy if specified. + /** + * Initialize an empty stack using the user specified allocation strategy + * if provided. + */ + ACE_Unbounded_Stack (ACE_Allocator *the_allocator = 0); + + /// The copy constructor (performs initialization). + /** + * Initialize this stack to be an exact copy of {s}. + */ + ACE_Unbounded_Stack (const ACE_Unbounded_Stack &s); + + /// Assignment operator (performs assignment). + /** + * Perform a deep copy of the rhs into the lhs. + */ + void operator= (const ACE_Unbounded_Stack &s); + + /// Perform actions needed when stack goes out of scope. + /** + * Destroy the underlying list for the stack. + */ + ~ACE_Unbounded_Stack (void); + + // = Classic Stack operations. + + + ///Push an element onto the top of stack. + /** + * Place a new item on top of the stack. Returns -1 if the stack + * is already full, 0 if the stack is not already full, and -1 if + * failure occurs. + */ + int push (const T &new_item); + + ///Pop the top element of the stack. + /** + * Remove and return the top stack item. Returns -1 if the stack is + * already empty, 0 if the stack is not already empty, and -1 if + * failure occurs. + */ + int pop (T &item); + + ///Examine the top of the stack. + /** + * Return top stack item without removing it. Returns -1 if the + * stack is already empty, 0 if the stack is not already empty, and + * -1 if failure occurs. + */ + int top (T &item) const; + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, otherwise returns 0. + /** + * Constant time check to see if the stack is empty. + */ + int is_empty (void) const; + + /// Returns 1 if the container is full, otherwise returns 0. + /** + * Always resturns 0 since the stack is unbounded. + */ + int is_full (void) const; + + // = Auxiliary methods (not strictly part of the Stack ADT). + + ///Linear Insert of an item. + /** + * Insert {new_item} into the Stack at the head (but doesn't allow + * duplicates). Returns -1 if failures occur, 1 if item is already + * present (i.e., no duplicates are allowed), else 0. + */ + int insert (const T &new_item); + + /// Remove @a item from the Stack. Returns 0 if it removes the item, + /// -1 if it can't find the item, and -1 if a failure occurs. + /** + * Linear remove operation. + */ + int remove (const T &item); + + /// Finds if @a item occurs the set. Returns 0 if finds, else -1. + /** + * Linear find operation. + */ + int find (const T &item) const; + + /// The number of items in the stack. + /** + * Constant time access to the current stack size. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Delete all the nodes in the stack. + void delete_all_nodes (void); + + /// Copy all nodes from {s} to {this}. + void copy_all_nodes (const ACE_Unbounded_Stack &s); + + /// Head of the linked list of Nodes. + ACE_Node *head_; + + /// Current size of the stack. + size_t cur_size_; + + /// Allocation strategy of the stack. + ACE_Allocator *allocator_; +}; + +/** + * @class ACE_Unbounded_Stack_Iterator + * + * @brief Implement an iterator over an unbounded Stack. + */ +template +class ACE_Unbounded_Stack_Iterator +{ +public: + // = Initialization method. + /// Move to the first element in the {stack}. + ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack &stack); + + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the Stack. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the Stack. Returns 0 when all the + /// items in the Stack have been seen, else 1. + int advance (void); + + /// Move to the first element in the Stack. Returns 0 if the + /// Stack is empty, else 1. + int first (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the current node in the iteration. + ACE_Node *current_; + + /// Pointer to the Stack we're iterating over. + ACE_Unbounded_Stack &stack_; +}; + +template +class ACE_Double_Linked_List; + +/** + * @class ACE_Double_Linked_List_Iterator_Base + * + * @brief Implements a common base class for iterators for a double + * linked list ADT + */ +template +class ACE_Double_Linked_List_Iterator_Base +{ +public: + // = Iteration methods. + + /// Passes back the {entry} under the iterator. Returns 0 if the + /// iteration has completed, otherwise 1 + int next (T *&) const; + + /** + * @deprecated Return the address of next (current) unvisited item in + * the list. 0 if there is no more element available. + */ + T *next (void) const; + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// STL-like iterator dereference operator: returns a reference + /// to the node underneath the iterator. + T & operator* (void) const ; + + /** + * Retasks the iterator to iterate over a new + * Double_Linked_List. This allows clients to reuse an iterator + * without incurring the constructor overhead. If you do use this, + * be aware that if there are more than one reference to this + * iterator, the other "clients" may be very bothered when their + * iterator changes. @@ Here be dragons. Comments? + */ + void reset (ACE_Double_Linked_List &); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = Initialization methods. + + /// Constructor + ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List &); + + /// Copy constructor. + ACE_Double_Linked_List_Iterator_Base (const + ACE_Double_Linked_List_Iterator_Base + &iter); + + // = Iteration methods. + /** + * Move to the first element of the list. Returns 0 if the list is + * empty, else 1. + * @note the head of the ACE_DLList is actually a null entry, so the + * first element is actually the 2n'd entry + */ + int go_head (void); + + /// Move to the last element of the list. Returns 0 if the list is + /// empty, else 1. + int go_tail (void); + + /** + * Check if we reach the end of the list. Can also be used to get + * the *current* element in the list. Return the address of the + * current item if there are still elements left , 0 if we run out + * of element. + */ + T *not_done (void) const ; + + /// Advance to the next element in the list. Return the address of the + /// next element if there are more, 0 otherwise. + T *do_advance (void); + + /// Retreat to the previous element in the list. Return the address + /// of the previous element if there are more, 0 otherwise. + T *do_retreat (void); + + /// Dump the state of an object. + void dump_i (void) const; + + /// Remember where we are. + T *current_; + + const ACE_Double_Linked_List *dllist_; +}; + +/** + * @class ACE_Double_Linked_List_Iterator + * + * @brief Implements an iterator for a double linked list ADT + * + * Iterate thru the double-linked list. This class provides + * an interface that let users access the internal element + * addresses directly. Notice {class T} must declare + * ACE_Double_Linked_List<T>, + * ACE_Double_Linked_List_Iterator_Base <T> and + * ACE_Double_Linked_List_Iterator as friend classes and class T + * should also have data members T* next_ and T* prev_. + */ +template +class ACE_Double_Linked_List_Iterator : public ACE_Double_Linked_List_Iterator_Base +{ +public: + // = Initialization method. + ACE_Double_Linked_List_Iterator (const ACE_Double_Linked_List &); + + /** + * Retasks the iterator to iterate over a new + * Double_Linked_List. This allows clients to reuse an iterator + * without incurring the constructor overhead. If you do use this, + * be aware that if there are more than one reference to this + * iterator, the other "clients" may be very bothered when their + * iterator changes. + * @@ Here be dragons. Comments? + */ + void reset (ACE_Double_Linked_List &); + + /// Move to the first element in the list. Returns 0 if the + /// list is empty, else 1. + int first (void); + + /// Move forward by one element in the list. Returns 0 when all the + /// items in the list have been seen, else 1. + int advance (void); + + /** + * Advance the iterator while removing the original item from the + * list. Return a pointer points to the original (removed) item. + * If @a dont_remove equals false, this function behaves like {advance} + * but return 0 (NULL) instead. + */ + T* advance_and_remove (bool dont_remove); + + // = STL-style iteration methods + + /// Prefix advance. + ACE_Double_Linked_List_Iterator & operator++ (void); + + /// Postfix advance. + ACE_Double_Linked_List_Iterator operator++ (int); + + /// Prefix reverse. + ACE_Double_Linked_List_Iterator & operator-- (void); + + /// Postfix reverse. + ACE_Double_Linked_List_Iterator operator-- (int); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +/** + * @class ACE_Double_Linked_List_Reverse_Iterator + * + * @brief Implements a reverse iterator for a double linked list ADT + * + * Iterate backwards over the double-linked list. This class + * provide an interface that let users access the internal + * element addresses directly, which seems to break the + * encapsulation. Notice {class T} must declare + * ACE_Double_Linked_List<T>, + * ACE_Double_Linked_List_Iterator_Base <T> and + * ACE_Double_Linked_List_Iterator as friend classes and class T + * should also have data members T* next_ and T* prev_. + */ +template +class ACE_Double_Linked_List_Reverse_Iterator : public ACE_Double_Linked_List_Iterator_Base +{ +public: + // = Initialization method. + ACE_Double_Linked_List_Reverse_Iterator (ACE_Double_Linked_List &); + + /** + * Retasks the iterator to iterate over a new + * Double_Linked_List. This allows clients to reuse an iterator + * without incurring the constructor overhead. If you do use this, + * be aware that if there are more than one reference to this + * iterator, the other "clients" may be very bothered when their + * iterator changes. + * @@ Here be dragons. Comments? + */ + void reset (ACE_Double_Linked_List &); + + /// Move to the first element in the list. Returns 0 if the + /// list is empty, else 1. + int first (void); + + /// Move forward by one element in the list. Returns 0 when all the + /// items in the list have been seen, else 1. + int advance (void); + + /** + * Advance the iterator while removing the original item from the + * list. Return a pointer points to the original (removed) item. + * If @a dont_remove equals false, this function behaves like {advance} + * but return 0 (NULL) instead. + */ + T* advance_and_remove (bool dont_remove); + + // = STL-style iteration methods + + /// Prefix advance. + ACE_Double_Linked_List_Reverse_Iterator & operator++ (void); + + /// Postfix advance. + ACE_Double_Linked_List_Reverse_Iterator operator++ (int); + + /// Prefix reverse. + ACE_Double_Linked_List_Reverse_Iterator & operator-- (void); + + /// Postfix reverse. + ACE_Double_Linked_List_Reverse_Iterator operator-- (int); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + + +/** + * @class ACE_Double_Linked_List + * + * @brief A double-linked list implementation. + * + * This implementation of an unbounded double-linked list uses a + * circular linked list with a dummy node. It is pretty much + * like the {ACE_Unbounded_Queue} except that it allows removing + * of a specific element from a specific location. + * Notice that this class is an implementation of a very simple + * data structure. This is *NOT* a container class. You can use the + * class to implement other contains classes but it is *NOT* a + * general purpose container class. + * The parameter class *MUST* have members T* prev and T* next + * and users of this class are responsible to follow the general + * rules of using double-linked lists to maintaining the list + * integrity. + * If you need a double linked container class, use the DLList + * class which is a container but delegates to the Double_Linked_List + * class. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Double Linked List + * - Duplicates allowed? + * Yes + * - Random access allowed? + * No + * - Search speed + * N/A + * - Insert/replace speed + * Linear + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * No + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * + */ +template +class ACE_Double_Linked_List +{ +public: + friend class ACE_Double_Linked_List_Iterator_Base; + friend class ACE_Double_Linked_List_Iterator; + friend class ACE_Double_Linked_List_Reverse_Iterator; + + // Trait definition. + typedef ACE_Double_Linked_List_Iterator ITERATOR; + typedef ACE_Double_Linked_List_Reverse_Iterator REVERSE_ITERATOR; + + // = Initialization and termination methods. + /// construction. Use user specified allocation strategy + /// if specified. + /** + * Initialize an empy list using the allocation strategy specified by the user. + * If none is specified, then use default allocation strategy. + */ + ACE_Double_Linked_List (ACE_Allocator *the_allocator = 0); + + /// Copy constructor. + /** + * Create a double linked list that is a copy of the provided + * parameter. + */ + ACE_Double_Linked_List (const ACE_Double_Linked_List &); + + /// Assignment operator. + /** + * Perform a deep copy of the provided list by first deleting the nodes of the + * lhs and then copying the nodes of the rhs. + */ + void operator= (const ACE_Double_Linked_List &); + + /// Destructor. + /** + * Clean up the memory allocated for the nodes of the list. + */ + ~ACE_Double_Linked_List (void); + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, 0 otherwise. + /** + * Performs constant time check to determine if the list is empty. + */ + int is_empty (void) const; + + /// The list is unbounded, so this always returns 0. + /** + * Since the list is unbounded, the method simply returns 0. + */ + int is_full (void) const; + + // = Classic queue operations. + + /// Adds @a new_item to the tail of the list. Returns the new item + /// that was inserted. + /** + * Provides constant time insertion at the end of the list structure. + */ + T *insert_tail (T *new_item); + + /// Adds @a new_item to the head of the list.Returns the new item that + /// was inserted. + /** + * Provides constant time insertion at the head of the list. + */ + T *insert_head (T *new_item); + + /// Removes the head of the list and returns a pointer to that item. + /** + * Removes and returns the first {item} in the list. Returns + * internal node's address on success, 0 if the queue was empty. + * This method will *not* free the internal node. + */ + T* delete_head (void); + + /// Removes the tail of the list and returns a pointer to that item. + /** + * Removes and returns the last {item} in the list. Returns + * internal nodes's address on success, 0 if the queue was + * empty. This method will *not* free the internal node. + */ + T *delete_tail (void); + + // = Additional utility methods. + + ///Empty the list. + /** + * Reset the {ACE_Double_Linked_List} to be empty. + * Notice that since no one is interested in the items within, + * This operation will delete all items. + */ + void reset (void); + + /// Get the {slot}th element in the set. Returns -1 if the element + /// isn't in the range {0..{size} - 1}, else 0. + /** + * Iterates through the list to the desired index and assigns the provides pointer + * with the address of the node occupying that index. + */ + int get (T *&item, size_t slot = 0); + + /// The number of items in the queue. + /** + * Constant time call to return the current size of the list. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Use DNode address directly. + /** + * Constant time removal of an item from the list using it's address. + */ + int remove (T *n); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Delete all the nodes in the list. + /** + * Removes and deallocates memory for all of the list nodes. + */ + void delete_nodes (void); + + /// Copy nodes from {rhs} into this list. + /** + * Copy the elements of the provided list by allocated new nodes and assigning + * them with the proper data. + */ + void copy_nodes (const ACE_Double_Linked_List &rhs); + + /// Setup header pointer. Called after we create the head node in ctor. + /** + * Initialize the head pointer so that the list has a dummy node. + */ + void init_head (void); + + ///Constant time insert a new item into the list structure. + /** + * Insert a @a new_item into the list. It will be added before + * or after @a old_item. Default is to insert the new item *after* + * {head_}. Return 0 if succeed, -1 if error occured. + */ + int insert_element (T *new_item, + int before = 0, + T *old_item = 0); + + ///Constant time delete an item from the list structure. + /** + * Remove @a item from the list. Return 0 if succeed, -1 otherwise. + * Notice that this function checks if item is {head_} and either its + * {next_} or {prev_} is NULL. The function resets item's {next_} and + * {prev_} to 0 to prevent clobbering the double-linked list if a user + * tries to remove the same node again. + */ + int remove_element (T *item); + + /// Head of the circular double-linked list. + T *head_; + + /// Size of this list. + size_t size_; + + /// Allocation Strategy of the queue. + ACE_Allocator *allocator_; +}; + + +template class ACE_DLList; +template class ACE_DLList_Iterator; +template class ACE_DLList_Reverse_Iterator; + +typedef ACE_Double_Linked_List ACE_DLList_Base; + +//typedef ACE_Double_Linked_List_Iterator +// ACE_DLList_Iterator_Base; +//typedef ACE_Double_Linked_List_Reverse_Iterator +// ACE_DLList_Reverse_Iterator_Base; +//@@ These two typedefs (inherited from James Hu's original design) +// have been removed because Sun CC 4.2 had problems with it. I guess +// having the DLList_Iterators inheriting from a class which is +// actually a typedef leads to problems. #define'ing rather than +// typedef'ing worked, but as per Carlos's reccomendation, I'm just +// replacing all references to the base classes with their actual +// type. Matt Braun (6/15/99) + +/** + * @class ACE_DLList + * + * @brief A double-linked list container class. + * + * ACE_DLList is a simple, unbounded container implemented using a + * double-linked list. It is critical to remember that ACE_DLList inherits + * from ACE_Double_Linked_List, wrapping each T pointer in a ACE_DLList_Node + * object which satisfies the next/prev pointer requirements imposed by + * ACE_Double_Linked_List. + * + * Each item inserted to an ACE_DLList is a pointer to a T object. The + * caller is responsible for lifetime of the T object. ACE_DLList takes no + * action on the T object; it is not copied on insertion and it is not + * deleted on removal from the ACE_DLList. + */ +template +class ACE_DLList : public ACE_DLList_Base +{ + friend class ACE_DLList_Node; + friend class ACE_Double_Linked_List_Iterator; + friend class ACE_DLList_Iterator; + friend class ACE_DLList_Reverse_Iterator; + +public: + + /// Delegates to ACE_Double_Linked_List. + void operator= (const ACE_DLList &l); + + /** + * @name Queue-like insert and delete methods + */ + //@{ + + /** + * Insert pointer for a new item at the tail of the list. + * + * @return Pointer to item inserted; 0 on error. + */ + T *insert_tail (T *new_item); + + /** + * Insert pointer for a new item at the head of the list. + * + * @return Pointer to item inserted; 0 on error. + */ + T *insert_head (T *new_item); + + /** + * Removes the item at the head of the list and returns its pointer. + * + * @return Pointer to previously inserted item; 0 if the list is empty, + * an error occurred, or the original pointer inserted was 0. + */ + T *delete_head (void); + + /** + * Removes the item at the tail of the list and returns its pointer. + * + * @return Pointer to previously inserted item; 0 if the list is empty, + * an error occurred, or the original pointer inserted was 0. + */ + T *delete_tail (void); + //@} + + /** + * Provide random access to any item in the list. + * + * @param item Receives a pointer to the T object pointer held at the + * specified position in the list. + * @param slot Position in the list to access. The first position is 0. + * + * @retval 0 Success; T pointer returned in item. + * @retval -1 Error, most likely slot is outside the range of the list. + */ + int get (T *&item, size_t slot = 0); + + /// Delegates to ACE_Double_Linked_List. + void dump (void) const; + + /// Delegates to ACE_Double_Linked_List. + int remove (ACE_DLList_Node *n); + + /** + * Constructor. + * + * @param the_allocator Allocator to use for allocating ACE_DLList_Node + * objects that wrap T objects for inclusion in the + * list. If 0, ACE_Allocator::instance() is used. + */ + ACE_DLList (ACE_Allocator *the_allocator = 0); + + /// Delegates to ACE_Double_Linked_List. + ACE_DLList (const ACE_DLList &l); + + /** + * Deletes all ACE_DLList_Node objects in the list starting from the head. + * No T objects referred to by the deleted ACE_DLList_Node objects are + * modified or freed. If you desire all of the T objects in the list to + * be deleted as well, code such as this should be used prior to destroying + * the ACE_DLList: + * @code + ACE_DLList list; + ... // insert dynamically allocated Items... + Item *p; + while ((p = list.delete_head()) != 0) + delete *p; + @endcode + */ + ~ACE_DLList (void); +}; + +/** + * @class ACE_DLList_Iterator + * + * @brief A double-linked list container class iterator. + * + * This implementation uses ACE_Double_Linked_List_Iterator to + * perform the logic behind this container class. It delegates + * all of its calls to ACE_Double_Linked_List_Iterator. + */ +template +class ACE_DLList_Iterator : public ACE_Double_Linked_List_Iterator +{ + + friend class ACE_DLList; + friend class ACE_DLList_Node; + +public: + + // = Initialization method. + ACE_DLList_Iterator (ACE_DLList &l); + + /** + * Retasks the iterator to iterate over a new + * Double_Linked_List. This allows clients to reuse an iterator + * without incurring the constructor overhead. If you do use this, + * be aware that if there are more than one reference to this + * iterator, the other "clients" may be very bothered when their + * iterator changes. + * @@ Here be dragons. Comments? + */ + void reset (ACE_DLList &l); + + // = Iteration methods. + /// Move forward by one element in the list. Returns 0 when all the + /// items in the list have been seen, else 1. + int advance (void); + + /// Pass back the {next_item} that hasn't been seen in the list. + /// Returns 0 when all items have been seen, else 1. + int next (T *&); + + /** + * @deprecated Delegates to ACE_Double_Linked_List_Iterator, except that + * whereas the Double_Linked_List version of next returns the node, this next + * returns the contents of the node + */ + T *next (void) const; + + /** + * Removes the current item (i.e., {next}) from the list. + * Note that DLList iterators do not support {advance_and_remove} + * directly (defined in its base class) and you will need to + * release the element returned by it. + */ + int remove (void); + + /// Delegates to ACE_Double_Linked_List_Iterator. + void dump (void) const; + +private: + ACE_DLList *list_; +}; + +/** + * @class ACE_DLList_Reverse_Iterator + * + * @brief A double-linked list container class iterator. + * + * This implementation uses ACE_Double_Linked_List_Iterator to + * perform the logic behind this container class. It delegates + * all of its calls to ACE_Double_Linked_List_Iterator. + */ +template +class ACE_DLList_Reverse_Iterator : public ACE_Double_Linked_List_Reverse_Iterator +{ + + friend class ACE_DLList; + friend class ACE_DLList_Node; + +public: + + // = Initialization method. + ACE_DLList_Reverse_Iterator (ACE_DLList &l); + + /** + * Retasks the iterator to iterate over a new + * Double_Linked_List. This allows clients to reuse an iterator + * without incurring the constructor overhead. If you do use this, + * be aware that if there are more than one reference to this + * iterator, the other "clients" may be very bothered when their + * iterator changes. + * @@ Here be dragons. Comments? + */ + void reset (ACE_DLList &l); + + // = Iteration methods. + /// Move forward by one element in the list. Returns 0 when all the + /// items in the list have been seen, else 1. + int advance (void); + + /// Pass back the {next_item} that hasn't been seen in the list. + /// Returns 0 when all items have been seen, else 1. + int next (T *&); + + /// @deprecated Delegates to ACE_Double_Linked_List_Iterator. + T *next (void) const; + + /// Removes the current item (i.e., {next}) from the list. + /// Note that DLList iterators do not support {advance_and_remove} + /// directly (defined in its base class) and you will need to + /// release the element returned by it. + int remove (void); + + /// Delegates to ACE_Double_Linked_List_Iterator. + void dump (void) const; + +private: + ACE_DLList *list_; +}; + +// Forward declaration. +template +class ACE_Fixed_Set; + +/** + * @class ACE_Fixed_Set_Iterator_Base + * + * @brief Implements a common base class for iterators for a unordered set. + */ +template +class ACE_Fixed_Set_Iterator_Base +{ +public: + // = Iteration methods. + + /// Pass back the {next_item} that hasn't been seen in the Set. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the set. Returns 0 when all the + /// items in the set have been seen, else 1. + int advance (void); + + /// Move to the first element in the set. Returns 0 if the + /// set is empty, else 1. + int first (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = Initialization method. + ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set &s); + + /// Set we are iterating over. + ACE_Fixed_Set &s_; + + /// How far we've advanced over the set. + ssize_t next_; + + /// The number of non free items that the iterator had pointed at. + size_t iterated_items_; + + /// Dump the state of an object. + void dump_i (void) const; + + /// Pass back the {next_item} that hasn't been seen in the Set. + /// Returns 0 when all items have been seen, else 1. + int next_i (T *&next_item); +}; + +/** + * @class ACE_Fixed_Set_Iterator + * + * @brief Iterates through an unordered set. + * + * This implementation of an unordered set uses a fixed array. + * Allows deletions while iteration is occurring. + */ +template +class ACE_Fixed_Set_Iterator : public ACE_Fixed_Set_Iterator_Base +{ +public: + // = Initialization method. + ACE_Fixed_Set_Iterator (ACE_Fixed_Set &s); + + // = Iteration methods. + + /// Pass back the {next_item} that hasn't been seen in the Set. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Dump the state of an object. + void dump (void) const; + + /// Remove the item where the itearetor is located at. + /// Returns 1 if it removes a item, else 0. + /// Pass back the removed {item}. + int remove (T *&item); + + /// STL-like iterator dereference operator: returns a reference + /// to the node underneath the iterator. + T & operator* (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +/** + * @class ACE_Fixed_Set_Const_Iterator + * + * @brief Iterates through a const unordered set. + * + * This implementation of an unordered set uses a fixed array. + */ +template +class ACE_Fixed_Set_Const_Iterator : public ACE_Fixed_Set_Iterator_Base +{ +public: + // = Initialization method. + ACE_Fixed_Set_Const_Iterator (const ACE_Fixed_Set &s); + + // = Iteration methods. + + /// Pass back the {next_item} that hasn't been seen in the Set. + /// Returns 0 when all items have been seen, else 1. + int next (const T *&next_item); + + /// Dump the state of an object. + void dump (void) const; + + /// STL-like iterator dereference operator: returns a reference + /// to the node underneath the iterator. + const T & operator* (void) const ; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +/** + * @class ACE_Fixed_Set + * + * @brief Implement a simple unordered set of {T} with maximum {ACE_SIZE}. + * + * This implementation of an unordered set uses a fixed array. + * It does not allow duplicate members. The set provides linear insertion/deletion + * operations. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Fixed array + * - Duplicates allowed? + * No + * - Random access allowed? + * No + * - Search speed + * Linear + * - Insert/replace speed + * Linear + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * No + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * -# operator== + * + */ +template +class ACE_Fixed_Set +{ +public: + friend class ACE_Fixed_Set_Iterator_Base; + friend class ACE_Fixed_Set_Iterator; + friend class ACE_Fixed_Set_Const_Iterator; + + // Trait definitions. + typedef ACE_Fixed_Set_Iterator ITERATOR; + typedef ACE_Fixed_Set_Const_Iterator CONST_ITERATOR; + + // = Initialization and termination methods. + /// Default Constructor. + /** + * Creates an empy set + */ + ACE_Fixed_Set (void); + + /// Copy constructor. + /** + * Initializes a set to be a copy of the set parameter. + */ + ACE_Fixed_Set (const ACE_Fixed_Set &); + + /// Assignment operator. + /** + * Deep copy of one set to another. + */ + void operator= (const ACE_Fixed_Set &); + + /// Destructor. + /** + * Destroys a set. + */ + ~ACE_Fixed_Set (void); + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, otherwise returns 0. + /** + * Performs constant time check to determine if a set is empty. + */ + int is_empty (void) const; + + /// Returns 1 if the container is full, otherwise returns 0. + /** + * Performs a constant time check to see if the set is full. + */ + int is_full (void) const; + + // = Classic unordered set operations. + + ///Linear time insertion of an item unique to the set. + /** + * Insert @a new_item into the set (doesn't allow duplicates). + * Returns -1 if failures occur, 1 if item is already present, else + * 0. + */ + int insert (const T &new_item); + + ///Linear time removal operation of an item. + /** + * Remove first occurrence of {item} from the set. Returns 0 if + * it removes the item, -1 if it can't find the item, and -1 if a + * failure occurs. Removal doesn't reclaim memory for the @a item. + */ + int remove (const T &item); + + /// Finds if @a item occurs in the set. Returns 0 if finds, else -1. + /** + * Performs a linear find operation for the specified @a item. + */ + int find (const T &item) const; + + /// Size of the set. + /** + * Returns the current size of the set. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Holds the contents of the set. + struct + { + /// Item in the set. + T item_; + + /// Keeps track of whether this item is in use or not. + int is_free_; + } search_structure_[ACE_SIZE]; + + /// Current size of the set. + size_t cur_size_; + + /// Maximum size of the set. + size_t max_size_; +}; + +// Forward declaration. +template +class ACE_Bounded_Set; + +/** + * @class ACE_Bounded_Set_Iterator + * + * @brief Iterates through an unordered set. + * + * This implementation of an unordered set uses a Bounded array. + * Allows deletions while iteration is occurring. + */ +template +class ACE_Bounded_Set_Iterator +{ +public: + // = Initialization method. + ACE_Bounded_Set_Iterator (ACE_Bounded_Set &s); + + // = Iteration methods. + + /// Pass back the {next_item} that hasn't been seen in the Set. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the set. Returns 0 when all the + /// items in the set have been seen, else 1. + int advance (void); + + /// Move to the first element in the set. Returns 0 if the + /// set is empty, else 1. + int first (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Set we are iterating over. + ACE_Bounded_Set &s_; + + /// How far we've advanced over the set. + ssize_t next_; +}; + + +/** + * @class ACE_Bounded_Set + * + * @brief Implement a simple unordered set of {T} with maximum + * set at creation time. + * + * This implementation of an unordered set uses a Bounded array. + * This implementation does not allow duplicates. It provides + * linear insert/remove/find operations. Insertion/removal does not + * invalidate iterators, but caution should be taken to ensure + * expected behavior. Once initialized, the object has a maximum size + * which can only be increased by the assignment of another larger Bounded_Set. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Bounded array which can grow via assignment + * - Duplicates allowed? + * No + * - Random access allowed? + * No + * - Search speed + * Linear + * - Insert/replace speed + * Linear + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * No + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * -# operator== + * + */ +template +class ACE_Bounded_Set +{ +public: + friend class ACE_Bounded_Set_Iterator; + + // Trait definition. + typedef ACE_Bounded_Set_Iterator ITERATOR; + + enum + { + DEFAULT_SIZE = 10 + }; + + // = Initialization and termination methods. + /// Construct a Bounded_Set using the default size. + /** + * The default constructor initializes the Bounded_Set to a maximum size + * specified by the DEFAULT_SIZE. + */ + ACE_Bounded_Set (void); + + /// Construct a Bounded_Set with the provided sizeB. + /** + * Initialize the Bounded_Set to have a maximum size equal to the size + * parameter specified. + */ + ACE_Bounded_Set (size_t size); + + /// Construct a Bounded_Set that is a copy of the provides Bounded_Set. + /** + * Initialize the Bounded_Set to be a copy of the Bounded_Set parameter. + */ + ACE_Bounded_Set (const ACE_Bounded_Set &); + + /// Assignment operator. + /** + * The assignment will make a deep copy of the Bounded_Set provided. If the + * rhs has more elements than the capacity of the lhs, then the lhs will be + * deleted and reallocated to accomadate the larger number of elements. + */ + void operator= (const ACE_Bounded_Set &); + + /// Destructor + /** + * Clean up the underlying dynamically allocated memory that is used by + * the Bounded_Set. + */ + ~ACE_Bounded_Set (void); + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, otherwise returns 0. + /** + * A constant time check is performed to determine if the Bounded_Set is + * empty. + */ + int is_empty (void) const; + + /// Returns 1 if the container is full, otherwise returns 0. + /** + * Performs a constant time check to determine if the Bounded_Set is at + * capacity. + */ + int is_full (void) const; + + // = Classic unordered set operations. + + ///Inserts a new element unique to the set. + /** + * Insert @a new_item into the set (doesn't allow duplicates) in linear + * time. + * Returns -1 if failures occur, 1 if item is already present, else + * 0. + */ + int insert (const T &new_item); + + ///Finds the specified element and removes it from the set. + /** + * Remove first occurrence of @a item from the set. Returns 0 if it + * removes the item, -1 if it can't find the item, and -1 if a + * failure occurs. The linear remove operation does not reclaim the + * memory associated with the removed item. + */ + int remove (const T &item); + + /// Finds if @a item occurs in the set. Returns 0 if finds, else -1. + /** + * find preforms a linear search for {item} and returns 0 on successful + * find and -1 otherwise. + */ + int find (const T &item) const; + + /// Size of the set. + /** + * Returns a size_t representing the current size of the set. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + struct Search_Structure + { + /// Item in the set. + T item_; + + /// Keeps track of whether this item is in use or not. + int is_free_; + }; + + /// Holds the contents of the set. + Search_Structure *search_structure_; + + /// Current size of the set. + size_t cur_size_; + + /// Maximum size of the set. + size_t max_size_; +}; + +/** + * @class ACE_Ordered_MultiSet_Iterator + * + * @brief Implement a bidirectional iterator over an ordered multiset. + * This class template requires that < operator semantics be + * defined for the parameterized type {T}, but does not impose + * any restriction on how that ordering operator is implemented. + */ +template +class ACE_Ordered_MultiSet_Iterator +{ +public: + friend class ACE_Ordered_MultiSet; + + // = Initialization method. + ACE_Ordered_MultiSet_Iterator (ACE_Ordered_MultiSet &s); + + // = Iteration methods. + + /// Pass back the {next_item} that hasn't been seen in the ordered multiset. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item) const; + + /// Repositions the iterator at the first item in the ordered multiset + /// Returns 0 if the list is empty else 1. + int first (void); + + /// Repositions the iterator at the last item in the ordered multiset + /// Returns 0 if the list is empty else 1. + int last (void); + + /// Move forward by one element in the set. Returns 0 when all the + /// items in the set have been seen, else 1. + int advance (void); + + /// Move backward by one element in the set. Returns 0 when all the + /// items in the set have been seen, else 1. + int retreat (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Returns a reference to the internal element {this} is pointing to. + T& operator* (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + /// Pointer to the current node in the iteration. + ACE_DNode *current_; + + /// Pointer to the set we're iterating over. + ACE_Ordered_MultiSet &set_; +}; + + +/** + * @class ACE_Ordered_MultiSet + * + * @brief Implement a simple ordered multiset of {T} of unbounded size + * that allows duplicates. This class template requires that < + * operator semantics be defined for the parameterized type {T}, but + * does not impose any restriction on how that ordering operator is + * implemented. The set is implemented as a linked list. + * + * + * Requirements and Performance Characteristics + * - Internal Structure + * Double linked list + * - Duplicates allowed? + * Yes + * - Random access allowed? + * No + * - Search speed + * Linear + * - Insert/replace speed + * Linear + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * Yes + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * -# operator== + * -# operator< + * + * + */ +template +class ACE_Ordered_MultiSet +{ +public: + friend class ACE_Ordered_MultiSet_Iterator; + + // Trait definition. + typedef ACE_Ordered_MultiSet_Iterator ITERATOR; + + // = Initialization and termination methods. + /// Constructor. Use user specified allocation strategy + /// if specified. + /** + * Initialize the set using the allocation strategy specified. If none, use the + * default strategy. + */ + ACE_Ordered_MultiSet (ACE_Allocator *the_allocator = 0); + + /// Copy constructor. + /** + * Initialize the set to be a copy of the provided set. + */ + ACE_Ordered_MultiSet (const ACE_Ordered_MultiSet &); + + /// Destructor. + /** + * Delete the nodes of the set. + */ + ~ACE_Ordered_MultiSet (void); + + /// Assignment operator. + /** + * Delete the nodes in lhs, and copy the nodes from the rhs. + */ + void operator= (const ACE_Ordered_MultiSet &); + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, otherwise returns 0. + /** + * Constant time check to determine if the set is empty. + */ + int is_empty (void) const; + + /// Size of the set. + /** + * Constant time check to determine the size of the set. + */ + size_t size (void) const; + + // = Classic unordered set operations. + + /// Insert @a new_item into the ordered multiset. + /// Returns -1 if failures occur, else 0. + /** + * Linear time, order preserving insert into the set beginning at the head. + */ + int insert (const T &new_item); + + ///Linear time insert beginning at the point specified by the provided iterator. + /** + * Insert @a new_item into the ordered multiset, starting its search at + * the node pointed to by the iterator, and if insertion was successful, + * updates the iterator to point to the newly inserted node. + * Returns -1 if failures occur, else 0. + */ + int insert (const T &new_item, ITERATOR &iter); + + /// Remove first occurrence of @a item from the set. Returns 0 if + /// it removes the item, -1 if it can't find the item. + /** + * Linear time search operation which removes the item from the set if found . + */ + int remove (const T &item); + + ///Linear find operation. + /** + * Finds first occurrence of @a item in the multiset, using the iterator's + * current position as a hint to improve performance. If find succeeds, + * it positions the iterator at that node and returns 0, or if it cannot + * locate the node, it leaves the iterator alone and just returns -1. + */ + int find (const T &item, ITERATOR &iter) const; + + /// Reset the ACE_Ordered_MultiSet to be empty. + /** + * Delete the nodes inside the set. + */ + void reset (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + /** + * Insert @a item, starting its search at the position given, + * and if successful updates the passed pointer to point to + * the newly inserted item's node. + */ + int insert_from (const T &item, ACE_DNode *start_position, + ACE_DNode **new_position); + + /** + * Looks for first occurance of @a item in the ordered set, using the + * passed starting position as a hint: if there is such an instance, it + * updates the new_position pointer to point to this node and returns 0; + * if there is no such node, then if there is a node before where the + * item would have been, it updates the new_position pointer to point + * to this node and returns -1; if there is no such node, then if there + * is a node after where the item would have been, it updates the + * new_position pointer to point to this node (or 0 if there is no such + * node) and returns 1; + */ + int locate (const T &item, ACE_DNode *start_position, + ACE_DNode *&new_position) const; + + /// Delete all the nodes in the Set. + void delete_nodes (void); + + /// Copy nodes into this set. + void copy_nodes (const ACE_Ordered_MultiSet &); + + /// Head of the bilinked list of Nodes. + ACE_DNode *head_; + + /// Head of the bilinked list of Nodes. + ACE_DNode *tail_; + + /// Current size of the set. + size_t cur_size_; + + /// Allocation strategy of the set. + ACE_Allocator *allocator_; +}; + +// **************************************************************** + +/** + * @class ACE_Array + * + * @brief A dynamic array class. + * + * This class extends ACE_Array_Base, adding comparison operators. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Dynamic array + * - Duplicates allowed? + * Yes + * - Random access allowed? + * Yes + * - Search speed + * N/A + * - Insert/replace speed + * O(1) + * - Iterator still valid after change to container? + * - In general, yes. + * - If array size is changed during iteration, no. + * - Frees memory for removed elements? + * No + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * -# operator!= + * + * @sa ACE_Array_Base. This class inherits its operations and requirements. + */ +template +class ACE_Array : public ACE_Array_Base +{ +public: + // Define a "trait" + typedef T TYPE; + typedef ACE_Array_Iterator ITERATOR; + + /// Dynamically create an uninitialized array. + /** + * Initialize an empty array of the specified size using the provided + * allocation strategy. + */ + ACE_Array (size_t size = 0, + ACE_Allocator* alloc = 0); + + /// Dynamically initialize the entire array to the {default_value}. + /** + * Initialize an array the given size placing the default_value in each index. + */ + ACE_Array (size_t size, + const T &default_value, + ACE_Allocator* alloc = 0); + + ///Copy constructor. + /** + * The copy constructor performs initialization by making an exact + * copy of the contents of parameter {s}, i.e., *this == s will + * return true. + */ + ACE_Array (const ACE_Array &s); + + ///Assignment operator + /** + * Assignment operator performs an assignment by making an exact + * copy of the contents of parameter {s}, i.e., *this == s will + * return true. Note that if the {max_size_} of {array_} is >= than + * {s.max_size_} we can copy it without reallocating. However, if + * {max_size_} is < {s.max_size_} we must delete the {array_}, + * reallocate a new {array_}, and then copy the contents of {s}. + */ + void operator= (const ACE_Array &s); + + // = Compare operators + + ///Equality comparison operator. + /** + * Compare this array with {s} for equality. Two arrays are equal + * if their {size}'s are equal and all the elements from 0 .. {size} + * are equal. + */ + bool operator== (const ACE_Array &s) const; + + ///Inequality comparison operator. + /** + * Compare this array with {s} for inequality such that {*this} != + * {s} is always the complement of the boolean return value of + * {*this} == {s}. + */ + bool operator!= (const ACE_Array &s) const; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Containers_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Containers_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Containers_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CONTAINERS_T_H */ diff --git a/externals/ace/Containers_T.inl b/externals/ace/Containers_T.inl new file mode 100644 index 0000000..912c9df --- /dev/null +++ b/externals/ace/Containers_T.inl @@ -0,0 +1,479 @@ +// -*- C++ -*- +// +// $Id: Containers_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE int +ACE_Bounded_Stack::is_empty (void) const +{ + ACE_TRACE ("ACE_Bounded_Stack::is_empty"); + return this->top_ == 0; +} + +template ACE_INLINE int +ACE_Bounded_Stack::is_full (void) const +{ + ACE_TRACE ("ACE_Bounded_Stack::is_full"); + return this->top_ >= this->size_; +} + +template ACE_INLINE int +ACE_Bounded_Stack::push (const T &new_item) +{ + ACE_TRACE ("ACE_Bounded_Stack::push"); + if (this->is_full () == 0) + { + this->stack_[this->top_++] = new_item; + return 0; + } + else + return -1; +} + +template ACE_INLINE int +ACE_Bounded_Stack::pop (T &item) +{ + ACE_TRACE ("ACE_Bounded_Stack::pop"); + if (this->is_empty () == 0) + { + item = this->stack_[--this->top_]; + return 0; + } + else + return -1; +} + +template ACE_INLINE int +ACE_Bounded_Stack::top (T &item) const +{ + ACE_TRACE ("ACE_Bounded_Stack::top"); + if (this->is_empty () == 0) + { + item = this->stack_[this->top_ - 1]; + return 0; + } + else + return -1; +} + +template ACE_INLINE size_t +ACE_Bounded_Stack::size (void) const +{ + return this->size_; +} + +//---------------------------------------- + +template ACE_INLINE int +ACE_Fixed_Stack::is_empty (void) const +{ + ACE_TRACE ("ACE_Fixed_Stack::is_empty"); + return this->top_ == 0; +} + +template ACE_INLINE int +ACE_Fixed_Stack::is_full (void) const +{ + ACE_TRACE ("ACE_Fixed_Stack::is_full"); + return this->top_ >= this->size_; +} + +template ACE_INLINE int +ACE_Fixed_Stack::push (const T &new_item) +{ + ACE_TRACE ("ACE_Fixed_Stack::push"); + if (this->is_full () == 0) + { + this->stack_[this->top_++] = new_item; + return 0; + } + else + return -1; +} + +template ACE_INLINE int +ACE_Fixed_Stack::pop (T &item) +{ + ACE_TRACE ("ACE_Fixed_Stack::pop"); + if (this->is_empty () == 0) + { + item = this->stack_[--this->top_]; + return 0; + } + else + return -1; +} + +template ACE_INLINE int +ACE_Fixed_Stack::top (T &item) const +{ + ACE_TRACE ("ACE_Fixed_Stack::top"); + if (this->is_empty () == 0) + { + item = this->stack_[this->top_ - 1]; + return 0; + } + else + return -1; +} + +template ACE_INLINE size_t +ACE_Fixed_Stack::size (void) const +{ + return this->size_; +} + +template ACE_INLINE int +ACE_Unbounded_Stack::is_empty (void) const +{ + // ACE_TRACE ("ACE_Unbounded_Stack::is_empty"); + return this->head_ == this->head_->next_; +} + +template ACE_INLINE int +ACE_Unbounded_Stack::top (T &item) const +{ + ACE_TRACE ("ACE_Unbounded_Stack::top"); + if (this->is_empty () == 0) + { + item = this->head_->next_->item_; + return 0; + } + else + return -1; +} + +template ACE_INLINE int +ACE_Unbounded_Stack::is_full (void) const +{ + ACE_TRACE ("ACE_Unbounded_Stack::is_full"); + return 0; // ??? +} + +template ACE_INLINE size_t +ACE_Unbounded_Stack::size (void) const +{ + return this->cur_size_; +} + +// --- + + +// --- + +template ACE_INLINE int +ACE_Fixed_Set::is_empty (void) const +{ + ACE_TRACE ("ACE_Fixed_Set::is_empty"); + return this->cur_size_ == 0; +} + +template ACE_INLINE int +ACE_Fixed_Set::is_full (void) const +{ + ACE_TRACE ("ACE_Fixed_Set::is_full"); + return this->cur_size_ == this->max_size_; +} + +// --- + +template ACE_INLINE int +ACE_Bounded_Set::is_empty (void) const +{ + ACE_TRACE ("ACE_Bounded_Set::is_empty"); + return this->cur_size_ == 0; +} + +template ACE_INLINE int +ACE_Bounded_Set::is_full (void) const +{ + ACE_TRACE ("ACE_Bounded_Set::is_full"); + return this->cur_size_ == this->max_size_; +} + +// -- + +template ACE_INLINE int +ACE_Ordered_MultiSet_Iterator::first (void) +{ + ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::first"); + current_ = set_.head_; + + return (current_ ? 1 : 0); +} + +template ACE_INLINE int +ACE_Ordered_MultiSet_Iterator::last (void) +{ + ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::last"); + current_ = set_.tail_; + + return (current_ ? 1 : 0); +} + +template ACE_INLINE int +ACE_Ordered_MultiSet_Iterator::advance (void) +{ + ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::advance"); + + current_ = current_ ? current_->next_ : 0; + + return (current_ ? 1 : 0); +} + +template ACE_INLINE int +ACE_Ordered_MultiSet_Iterator::retreat (void) +{ + ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::retreat"); + + current_ = current_ ? current_->prev_ : 0; + + return (current_ ? 1 : 0); +} + +template ACE_INLINE int +ACE_Ordered_MultiSet_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::done"); + + return (current_ ? 0 : 1); +} + +template ACE_INLINE void +ACE_Ordered_MultiSet_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Ordered_MultiSet_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + + + +// -- + +template ACE_INLINE int +ACE_Ordered_MultiSet::is_empty (void) const +{ + ACE_TRACE ("ACE_Ordered_MultiSet::is_empty"); + return this->cur_size_ > 0 ? 0 : 1; +} + +template ACE_INLINE size_t +ACE_Ordered_MultiSet::size (void) const +{ +// ACE_TRACE ("ACE_Ordered_MultiSet::size"); + return this->cur_size_; +} + +// **************************************************************** + +template ACE_INLINE +ACE_Array::ACE_Array (size_t size, + ACE_Allocator *alloc) + : ACE_Array_Base (size, alloc) +{ +} + +template ACE_INLINE +ACE_Array::ACE_Array (size_t size, + const T &default_value, + ACE_Allocator *alloc) + : ACE_Array_Base (size, default_value, alloc) +{ +} + +// The copy constructor (performs initialization). + +template ACE_INLINE +ACE_Array::ACE_Array (const ACE_Array &s) + : ACE_Array_Base (s) +{ +} + +// Assignment operator (performs assignment). + +template ACE_INLINE void +ACE_Array::operator= (const ACE_Array &s) +{ + // Check for "self-assignment". + + if (this != &s) + this->ACE_Array_Base::operator= (s); +} + +// Compare this array with for inequality. + +template ACE_INLINE bool +ACE_Array::operator!= (const ACE_Array &s) const +{ + return !(*this == s); +} + +// **************************************************************** + + +// **************************************************************** + +template ACE_INLINE void +ACE_DLList::operator= (const ACE_DLList &l) +{ + *(ACE_DLList_Base *) this = l; +} + +template ACE_INLINE int +ACE_DLList::get (T *&item, size_t index) +{ + ACE_DLList_Node *node; + int result = ACE_DLList_Base::get (node, index); + if (result != -1) + item = (T *) node->item_; + return result; +} + +template ACE_INLINE void +ACE_DLList::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DLList_Base::dump (); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_INLINE int +ACE_DLList::remove (ACE_DLList_Node *n) +{ + int result = ACE_DLList_Base::remove (n); + ACE_DES_FREE (n, + this->allocator_->free, + ACE_DLList_Node); + return result; +} + +template ACE_INLINE +ACE_DLList::ACE_DLList (ACE_Allocator *alloc) + : ACE_DLList_Base (alloc) +{ +} + +template ACE_INLINE +ACE_DLList::ACE_DLList (const ACE_DLList &l) + : ACE_DLList_Base ((ACE_DLList &) l) +{ +} + +template ACE_INLINE +ACE_DLList::~ACE_DLList (void) +{ + while (this->delete_head ()) ; +} + +template ACE_INLINE int +ACE_DLList_Iterator::remove (void) +{ + ACE_DLList_Node *temp = this->ACE_Double_Linked_List_Iterator ::next (); + this->ACE_Double_Linked_List_Iterator ::advance (); + return list_->remove (temp); +} + +template ACE_INLINE +ACE_DLList_Iterator::ACE_DLList_Iterator (ACE_DLList &l) + : ACE_Double_Linked_List_Iterator ((ACE_DLList_Base &)l), + list_ (&l) +{ +} + +template ACE_INLINE void +ACE_DLList_Iterator::reset (ACE_DLList &l) +{ + list_ = &l; + this->ACE_Double_Linked_List_Iterator ::reset ((ACE_DLList_Base &)l); +} + +template ACE_INLINE int +ACE_DLList_Iterator::next (T *&ptr) +{ + ACE_DLList_Node *temp = + ACE_Double_Linked_List_Iterator ::next (); + if (temp) + ptr = (T *) temp->item_; + return temp ? 1 : 0; +} + +template ACE_INLINE T * +ACE_DLList_Iterator::next (void) const +{ + ACE_DLList_Node *temp = ACE_Double_Linked_List_Iterator ::next (); + return (T *) (temp ? temp->item_ : 0); +} + +template ACE_INLINE int +ACE_DLList_Iterator::advance (void) +{ + return this->ACE_Double_Linked_List_Iterator ::advance (); +} + +template ACE_INLINE void +ACE_DLList_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_Double_Linked_List_Iterator ::dump (); +#endif /* ACE_HAS_DUMP */ +} + + +template ACE_INLINE int +ACE_DLList_Reverse_Iterator::remove (void) +{ + ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); + this->ACE_Double_Linked_List_Reverse_Iterator ::advance (); + return list_->remove (temp); +} + +template ACE_INLINE +ACE_DLList_Reverse_Iterator::ACE_DLList_Reverse_Iterator (ACE_DLList &l) + : ACE_Double_Linked_List_Reverse_Iterator ((ACE_DLList_Base &)l), + list_ (&l) +{ +} + +template ACE_INLINE void +ACE_DLList_Reverse_Iterator::reset (ACE_DLList &l) +{ + list_ = &l; + this->ACE_Double_Linked_List_Reverse_Iterator ::reset ((ACE_DLList_Base &)l); +} + +template ACE_INLINE int +ACE_DLList_Reverse_Iterator::advance (void) +{ + return ACE_Double_Linked_List_Reverse_Iterator ::advance (); +} + +template ACE_INLINE int +ACE_DLList_Reverse_Iterator::next (T *&ptr) +{ + ACE_DLList_Node *temp = + ACE_Double_Linked_List_Reverse_Iterator ::next (); + if (temp == 0) + return 0; + ptr = (T *) temp->item_; + return 1; +} + +template ACE_INLINE T * +ACE_DLList_Reverse_Iterator::next (void) const +{ + ACE_DLList_Node *temp = ACE_Double_Linked_List_Reverse_Iterator ::next (); + return (T *) (temp ? temp->item_ : 0); +} + + +template ACE_INLINE void +ACE_DLList_Reverse_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_Double_Linked_List_Reverse_Iterator ::dump (); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Copy_Disabled.cpp b/externals/ace/Copy_Disabled.cpp new file mode 100644 index 0000000..6878311 --- /dev/null +++ b/externals/ace/Copy_Disabled.cpp @@ -0,0 +1,23 @@ +/** + * @file Copy_Disabled.cpp + * + * $Id: Copy_Disabled.cpp 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ + +#include "ace/Copy_Disabled.h" + + +ACE_RCSID (ace, + Copy_Disabled, + "$Id: Copy_Disabled.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Copy_Disabled::ACE_Copy_Disabled (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Copy_Disabled.h b/externals/ace/Copy_Disabled.h new file mode 100644 index 0000000..f7b40e2 --- /dev/null +++ b/externals/ace/Copy_Disabled.h @@ -0,0 +1,65 @@ +// -*- C++ -*- + +//=========================================================================== +/** + * @file Copy_Disabled.h + * + * $Id: Copy_Disabled.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ +//=========================================================================== + +#ifndef ACE_COPY_DISABLED_H +#define ACE_COPY_DISABLED_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Copy_Disabled + * + * @brief Helper class to disable copy construction and assignment + * + * Classes used to control OS and other resources are not "canonical", + * i.e. they have their copy constructor and assignment operators + * disabled. + * This is often done by making the copy constructor and assignment + * operators private, effectively disallowing copying by clients of + * the class (including derived classes). If the copy constructor and + * assingment operators are left unimplemented then the class itself + * cannot make any copies of its instances, because it would result in + * link errors. + * + * To use this class simply use private inheritance: + * + * class Foo : private ACE_Copy_Disabled + * { + * // code here + * }; + * + */ +class ACE_Export ACE_Copy_Disabled +{ +public: + + /// Default constructor + ACE_Copy_Disabled (void); + +private: + ACE_Copy_Disabled (const ACE_Copy_Disabled &); + ACE_Copy_Disabled &operator= (const ACE_Copy_Disabled &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_COPY_DISABLED_H */ diff --git a/externals/ace/Countdown_Time.cpp b/externals/ace/Countdown_Time.cpp new file mode 100644 index 0000000..d76a0fa --- /dev/null +++ b/externals/ace/Countdown_Time.cpp @@ -0,0 +1,59 @@ +#include "ace/Countdown_Time.h" +#include "ace/OS_NS_sys_time.h" + +ACE_RCSID (ace, + Countdown_Time, + "$Id: Countdown_Time.cpp 85382 2009-05-19 06:52:56Z johnnyw $") + +#if !defined (__ACE_INLINE__) +#include "ace/Countdown_Time.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time) + : max_wait_time_ (max_wait_time), + stopped_ (false) +{ + this->start (); +} + +ACE_Countdown_Time::~ACE_Countdown_Time (void) +{ + this->stop (); +} + +void +ACE_Countdown_Time::start (void) +{ + if (this->max_wait_time_ != 0) + { + this->start_time_ = ACE_OS::gettimeofday (); + this->stopped_ = false; + } +} + +void +ACE_Countdown_Time::stop (void) +{ + if (this->max_wait_time_ != 0 && !this->stopped_) + { + ACE_Time_Value const elapsed_time = + ACE_OS::gettimeofday () - this->start_time_; + + if (elapsed_time >= ACE_Time_Value::zero && + *this->max_wait_time_ > elapsed_time) + { + *this->max_wait_time_ -= elapsed_time; + } + else + { + // Used all of timeout. + *this->max_wait_time_ = ACE_Time_Value::zero; + // errno = ETIME; + } + this->stopped_ = true; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Countdown_Time.h b/externals/ace/Countdown_Time.h new file mode 100644 index 0000000..b9c9a46 --- /dev/null +++ b/externals/ace/Countdown_Time.h @@ -0,0 +1,81 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Countdown_Time.h + * + * $Id: Countdown_Time.h 85365 2009-05-18 08:27:42Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_COUNTDOWN_TIME_H +#define ACE_COUNTDOWN_TIME_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Time_Value.h" +#include "ace/Copy_Disabled.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Countdown_Time + * + * @brief Keeps track of the amount of elapsed time. + * + * This class has a side-effect on the @c max_wait_time -- every + * time the stop() method is called the @c max_wait_time is + * updated. + */ +class ACE_Export ACE_Countdown_Time : private ACE_Copy_Disabled +{ +public: + /// Cache the @a max_wait_time and call @c start(). + ACE_Countdown_Time (ACE_Time_Value *max_wait_time); + + /// Destructor, makes sure the max_wait_time that got passed as pointer + /// to the constructor is updated with the time elapsed. + ~ACE_Countdown_Time (void); + + /// Cache the current time and enter a start state. + void start (void); + + /// Subtract the elapsed time from max_wait_time_ and enter a stopped + /// state. + void stop (void); + + /// Calls stop and then start. max_wait_time_ is modified by the + /// call to stop. + void update (void); + + /// Returns true if we've already been stopped, else false. + bool stopped (void) const; + +private: + /// Maximum time we were willing to wait. + ACE_Time_Value *max_wait_time_; + + /// Beginning of the start time. + ACE_Time_Value start_time_; + + /// Keeps track of whether we've already been stopped. + bool stopped_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#if defined (__ACE_INLINE__) +#include "ace/Countdown_Time.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_COUNTDOWN_TIME_H */ diff --git a/externals/ace/Countdown_Time.inl b/externals/ace/Countdown_Time.inl new file mode 100644 index 0000000..4a9eb8e --- /dev/null +++ b/externals/ace/Countdown_Time.inl @@ -0,0 +1,20 @@ +// -*- C++ -*- +// +// $Id: Countdown_Time.inl 85368 2009-05-18 10:23:19Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE bool +ACE_Countdown_Time::stopped (void) const +{ + return stopped_; +} + +ACE_INLINE void +ACE_Countdown_Time::update (void) +{ + this->stop (); + this->start (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV.cpp b/externals/ace/DEV.cpp new file mode 100644 index 0000000..42178a6 --- /dev/null +++ b/externals/ace/DEV.cpp @@ -0,0 +1,43 @@ +// $Id: DEV.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/DEV.h" + +#include "ace/OS_NS_unistd.h" + +#if !defined (__ACE_INLINE__) +#include "ace/DEV.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, DEV, "$Id: DEV.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_DEV) + +void +ACE_DEV::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_DEV::dump"); +#endif /* ACE_HAS_DUMP */ +} + +// This is the do-nothing constructor. + +ACE_DEV::ACE_DEV (void) +{ + ACE_TRACE ("ACE_DEV::ACE_DEV"); +} + +// Close the device + +int +ACE_DEV::close (void) +{ + ACE_TRACE ("ACE_DEV::close"); + int result = ACE_OS::close (this->get_handle ()); + this->set_handle (ACE_INVALID_HANDLE); + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV.h b/externals/ace/DEV.h new file mode 100644 index 0000000..86f8d5d --- /dev/null +++ b/externals/ace/DEV.h @@ -0,0 +1,78 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file DEV.h + * + * $Id: DEV.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Gerhard Lenzer + */ +//============================================================================= + + +#ifndef ACE_DEV_H +#define ACE_DEV_H +#include /**/ "ace/pre.h" + +#include "ace/IO_SAP.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/DEV_Addr.h" + +// The following is necessary since many C++ compilers don't support +// typedef'd types inside of classes used as formal template +// arguments... ;-(. Luckily, using the C++ preprocessor I can hide +// most of this nastiness! + +#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) +#define ACE_DEV_CONNECTOR ACE_DEV_Connector +#define ACE_DEV_STREAM ACE_DEV_IO +#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ +#define ACE_DEV_CONNECTOR ACE_DEV_Connector, ACE_DEV_Addr +#define ACE_DEV_STREAM ACE_DEV_IO, ACE_DEV_Addr +#endif /* ACE_TEMPLATE_TYPEDEFS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_DEV + * + * @brief Defines the member functions for the base class of the + * ACE_DEV abstraction. + */ +class ACE_Export ACE_DEV : public ACE_IO_SAP +{ +public: + /// Close down the DEVICE + int close (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /** + * Disable signal @a signum + * This is here to prevent Win32 from + * disabling SPIPE using socket calls + */ + int disable (int signum) const ; + +protected: + /// Ensure that this class is an abstract base class + ACE_DEV (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/DEV.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_DEV_H */ diff --git a/externals/ace/DEV.inl b/externals/ace/DEV.inl new file mode 100644 index 0000000..4d97a73 --- /dev/null +++ b/externals/ace/DEV.inl @@ -0,0 +1,18 @@ +// -*- C++ -*- +// +// $Id: DEV.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_DEV::disable (int signum) const +{ +#if defined (ACE_WIN32) + ACE_UNUSED_ARG (signum) ; + return 0 ; +#else /* ACE_WIN32 */ + return ACE_IO_SAP::disable (signum) ; +#endif /* ACE_WIN32 */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV_Addr.cpp b/externals/ace/DEV_Addr.cpp new file mode 100644 index 0000000..64bbb50 --- /dev/null +++ b/externals/ace/DEV_Addr.cpp @@ -0,0 +1,108 @@ +// $Id: DEV_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/DEV_Addr.h" +#if !defined (__ACE_INLINE__) +#include "ace/DEV_Addr.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ace, + DEV_Addr, + "$Id: DEV_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Addr) + +// Transform the current address into string format. + +int +ACE_DEV_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const +{ + ACE_TRACE ("ACE_DEV_Addr::addr_to_string"); + + ACE_OS::strsncpy (s, this->devname_, len); + return 0; +} + +// Return a pointer to the address. + +void * +ACE_DEV_Addr::get_addr (void) const +{ + ACE_TRACE ("ACE_DEV_Addr::get_addr"); + + return (void *) &this->devname_; +} + +void +ACE_DEV_Addr::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_DEV_Addr::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("devname_ = %s"), this->devname_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// Do nothing constructor. + +ACE_DEV_Addr::ACE_DEV_Addr (void) + : ACE_Addr (AF_DEV, sizeof this->devname_) +{ + ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); + + (void) ACE_OS::memset ((void *) &this->devname_, + 0, sizeof this->devname_); +} + +int +ACE_DEV_Addr::set (const ACE_DEV_Addr &sa) +{ + this->base_set (sa.get_type (), sa.get_size ()); + + if (sa.get_type () == AF_ANY) + (void) ACE_OS::memset ((void *) &this->devname_, + 0, + sizeof this->devname_); + else + (void) ACE_OS::strsncpy (this->devname_, + sa.devname_, + ACE_DEV_Addr::DEVNAME_LENGTH); + return 0; +} + +// Copy constructor. + +ACE_DEV_Addr::ACE_DEV_Addr (const ACE_DEV_Addr &sa) + : ACE_Addr (AF_DEV, sizeof this->devname_) +{ + ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); + + this->set (sa); +} + +ACE_DEV_Addr::ACE_DEV_Addr (const ACE_TCHAR *devname) + : ACE_Addr (AF_DEV, sizeof this->devname_) +{ + ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); + + this->set (devname); +} + +ACE_DEV_Addr & +ACE_DEV_Addr::operator= (const ACE_DEV_Addr &sa) +{ + ACE_TRACE ("ACE_DEV_Addr::operator="); + + if (this != &sa) + this->set (sa); + + return *this; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV_Addr.h b/externals/ace/DEV_Addr.h new file mode 100644 index 0000000..49ec502 --- /dev/null +++ b/externals/ace/DEV_Addr.h @@ -0,0 +1,90 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file DEV_Addr.h + * + * $Id: DEV_Addr.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Gerhard Lenzer and Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_DEV_ADDR_H +#define ACE_DEV_ADDR_H + +#include /**/ "ace/pre.h" + +#include "ace/Addr.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_dirent.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_DEV_Addr + * + * @brief Defines device address family address format. + */ +class ACE_Export ACE_DEV_Addr : public ACE_Addr +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_DEV_Addr (void); + + /// Copy constructor. + ACE_DEV_Addr (const ACE_DEV_Addr &sa); + + /// Acts like a copy constructor. + int set (const ACE_DEV_Addr &sa); + + /// Create a ACE_DEV_Addr from a device name. + explicit ACE_DEV_Addr (const ACE_TCHAR *devname); + + /// Create a ACE_Addr from a ACE_DEV pathname. + void set (const ACE_TCHAR *devname); + + /// Assignment operator. + ACE_DEV_Addr &operator= (const ACE_DEV_Addr &); + + /// Return a pointer to the address. + virtual void *get_addr (void) const; + + /// Transform the current address into string format. + virtual int addr_to_string (ACE_TCHAR *addr, size_t) const; + + /// Compare two addresses for equality. + bool operator == (const ACE_DEV_Addr &SAP) const; + + /// Compare two addresses for inequality. + bool operator != (const ACE_DEV_Addr &SAP) const; + + /// Return the path name used for the rendezvous point. + const ACE_TCHAR *get_path_name (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + enum { DEVNAME_LENGTH = MAXPATHLEN + 1 }; + /// Name of the device. + ACE_TCHAR devname_[DEVNAME_LENGTH]; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/DEV_Addr.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_DEV_ADDR_H */ diff --git a/externals/ace/DEV_Addr.inl b/externals/ace/DEV_Addr.inl new file mode 100644 index 0000000..5c1da68 --- /dev/null +++ b/externals/ace/DEV_Addr.inl @@ -0,0 +1,51 @@ +// -*- C++ -*- +// +// $Id: DEV_Addr.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_string.h" +#include "ace/Global_Macros.h" +#include "ace/os_include/sys/os_socket.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void +ACE_DEV_Addr::set (const ACE_TCHAR *devname) +{ + ACE_TRACE ("ACE_DEV_Addr::set"); + + this->ACE_Addr::base_set + (AF_DEV, static_cast (ACE_OS::strlen (devname))); + ACE_OS::strsncpy (this->devname_, devname, ACE_DEV_Addr::DEVNAME_LENGTH); +} + +// Compare two addresses for equality. + +ACE_INLINE bool +ACE_DEV_Addr::operator == (const ACE_DEV_Addr &sap) const +{ + ACE_TRACE ("ACE_DEV_Addr::operator =="); + + return ACE_OS::strcmp (this->devname_, sap.devname_) == 0; +} + +// Compare two addresses for inequality. + +ACE_INLINE bool +ACE_DEV_Addr::operator != (const ACE_DEV_Addr &sap) const +{ + ACE_TRACE ("ACE_DEV_Addr::operator !="); + + return !((*this) == sap); // This is lazy, of course... ;-). +} + +// Return the path name used for the rendezvous point. + +ACE_INLINE const ACE_TCHAR * +ACE_DEV_Addr::get_path_name (void) const +{ + ACE_TRACE ("ACE_DEV_Addr::get_path_name"); + + return this->devname_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV_Connector.cpp b/externals/ace/DEV_Connector.cpp new file mode 100644 index 0000000..bdc2530 --- /dev/null +++ b/externals/ace/DEV_Connector.cpp @@ -0,0 +1,53 @@ +// $Id: DEV_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/DEV_Connector.h" + +#include "ace/Handle_Ops.h" + +#if !defined (__ACE_INLINE__) +#include "ace/DEV_Connector.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_RCSID (ace, + DEV_Connector, + "$Id: DEV_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Connector) + +void +ACE_DEV_Connector::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_DEV_Connector::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_DEV_Connector::ACE_DEV_Connector (void) +{ + ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); +} + +int +ACE_DEV_Connector::connect (ACE_DEV_IO &new_io, + const ACE_DEV_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &, + int, + int flags, + int perms) +{ + ACE_TRACE ("ACE_DEV_Connector::connect"); + + ACE_HANDLE handle = ACE::handle_timed_open (timeout, + remote_sap.get_path_name (), + flags, perms); + new_io.set_handle (handle); + new_io.addr_ = remote_sap; // class copy. + return handle == ACE_INVALID_HANDLE ? -1 : 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV_Connector.h b/externals/ace/DEV_Connector.h new file mode 100644 index 0000000..2f71f60 --- /dev/null +++ b/externals/ace/DEV_Connector.h @@ -0,0 +1,110 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file DEV_Connector.h + * + * $Id: DEV_Connector.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Gerhard Lenzer and Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_DEV_CONNECTOR_H +#define ACE_DEV_CONNECTOR_H +#include /**/ "ace/pre.h" + +#include "ace/DEV_IO.h" +#include "ace/Log_Msg.h" +#include "ace/os_include/os_fcntl.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_DEV_Connector + * + * @brief Defines an active connection factory for the ACE_DEV wrappers. + */ +class ACE_Export ACE_DEV_Connector +{ +public: + /// Default constructor. + ACE_DEV_Connector (void); + + /** + * Actively connect and produce a @a new_io if things go well. + * The @a remote_sap is the address that we are trying to connect + * with. The @a timeout is the amount of time to wait to connect. + * If it's 0 then we block indefinitely. If *timeout == {0, 0} then + * the connection is done using non-blocking mode. In this case, if + * the connection can't be made immediately the value of -1 is + * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then + * this is the maximum amount of time to wait before timing out. If the + * time expires before the connection is made @c errno == ETIME. The + * @a local_sap is the value of local address to bind to. If it's + * the default value of ACE_Addr::sap_any then the user is letting + * the OS do the binding. If @a reuse_addr == 1 then the + * is reused, even if it hasn't been cleanedup yet. + * The @a flags and @a perms arguments are passed down to the + * method. + */ + ACE_DEV_Connector (ACE_DEV_IO &new_io, + const ACE_DEV_Addr &remote_sap, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0); + + /** + * Actively connect and produce a @a new_io if things go well. + * The @a remote_sap is the address that we are trying to connect + * with. The @a timeout is the amount of time to wait to connect. + * If it's 0 then we block indefinitely. If *timeout == {0, 0} then + * the connection is done using non-blocking mode. In this case, if + * the connection can't be made immediately the value of -1 is + * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then + * this is the maximum amount of time to wait before timing out. If the + * time expires before the connection is made @c errno == ETIME. The + * @a local_sap is the value of local address to bind to. If it's + * the default value of ACE_Addr::sap_any then the user is letting + * the OS do the binding. If @a reuse_addr == 1 then the + * is reused, even if it hasn't been cleanedup yet. + * The @a flags and @a perms arguments are passed down to the + * method. + */ + int connect (ACE_DEV_IO &new_io, + const ACE_DEV_Addr &remote_sap, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0); + + /// Resets any event associations on this handle + bool reset_new_handle (ACE_HANDLE handle); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + // = Meta-type info + typedef ACE_DEV_Addr PEER_ADDR; + typedef ACE_DEV_IO PEER_STREAM; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/DEV_Connector.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_DEV_CONNECTOR_H */ diff --git a/externals/ace/DEV_Connector.inl b/externals/ace/DEV_Connector.inl new file mode 100644 index 0000000..a57a38b --- /dev/null +++ b/externals/ace/DEV_Connector.inl @@ -0,0 +1,33 @@ +// -*- C++ -*- +// +// $Id: DEV_Connector.inl 82723 2008-09-16 09:35:44Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Creates a Local ACE_DEV. + +ACE_INLINE +ACE_DEV_Connector::ACE_DEV_Connector (ACE_DEV_IO &new_io, + const ACE_DEV_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); + if (this->connect (new_io, remote_sap, timeout, local_sap, + reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE + && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("address %s, %p\n"), + remote_sap.get_path_name (), ACE_TEXT ("ACE_DEV_IO"))); +} + +ACE_INLINE bool +ACE_DEV_Connector::reset_new_handle (ACE_HANDLE) +{ + // Nothing to do here since the handle is not a socket + return false; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV_IO.cpp b/externals/ace/DEV_IO.cpp new file mode 100644 index 0000000..b9a8e1f --- /dev/null +++ b/externals/ace/DEV_IO.cpp @@ -0,0 +1,131 @@ +// $Id: DEV_IO.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/DEV_IO.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/DEV_IO.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, DEV_IO, "$Id: DEV_IO.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_DEV_IO) + +// Return the local endpoint address. + +int +ACE_DEV_IO::get_local_addr (ACE_DEV_Addr &addr) const +{ + ACE_TRACE ("ACE_DEV_IO::get_local_addr"); + + addr = this->addr_; + return 0; +} + +// Return the address of the remotely connected peer (if there is +// one). + +int +ACE_DEV_IO::get_remote_addr (ACE_DEV_Addr &addr) const +{ + ACE_TRACE ("ACE_DEV_IO::get_remote_addr"); + addr = this->addr_; + return 0; +} + +void +ACE_DEV_IO::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_DEV_IO::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->addr_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// Simple-minded do nothing constructor. + +ACE_DEV_IO::ACE_DEV_IO (void) +{ + ACE_TRACE ("ACE_DEV_IO::ACE_DEV_IO"); +} + +// Send N char *ptrs and int lengths. Note that the char *'s precede +// the ints (basically, an varargs version of writev). The count N is +// the *total* number of trailing arguments, *not* a couple of the +// number of tuple pairs! + +ssize_t +ACE_DEV_IO::send (size_t n, ...) const +{ + ACE_TRACE ("ACE_DEV_IO::send"); + va_list argp; + int total_tuples = static_cast (n / 2); + iovec *iovp; +#if defined (ACE_HAS_ALLOCA) + iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); +#else + ACE_NEW_RETURN (iovp, + iovec[total_tuples], + -1); +#endif /* !defined (ACE_HAS_ALLOCA) */ + + va_start (argp, n); + + for (int i = 0; i < total_tuples; i++) + { + iovp[i].iov_base = va_arg (argp, char *); + iovp[i].iov_len = va_arg (argp, int); + } + + ssize_t result = ACE_OS::writev (this->get_handle (), iovp, total_tuples); +#if !defined (ACE_HAS_ALLOCA) + delete [] iovp; +#endif /* !defined (ACE_HAS_ALLOCA) */ + va_end (argp); + return result; +} + +// This is basically an interface to ACE_OS::readv, that doesn't use the +// struct iovec explicitly. The ... can be passed as an arbitrary +// number of (char *ptr, int len) tuples. However, the count N is the +// *total* number of trailing arguments, *not* a couple of the number +// of tuple pairs! + +ssize_t +ACE_DEV_IO::recv (size_t n, ...) const +{ + ACE_TRACE ("ACE_DEV_IO::recv"); + va_list argp; + int total_tuples = static_cast (n / 2); + iovec *iovp; +#if defined (ACE_HAS_ALLOCA) + iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); +#else + ACE_NEW_RETURN (iovp, + iovec[total_tuples], + -1); +#endif /* !defined (ACE_HAS_ALLOCA) */ + + va_start (argp, n); + + for (int i = 0; i < total_tuples; i++) + { + iovp[i].iov_base = va_arg (argp, char *); + iovp[i].iov_len = va_arg (argp, int); + } + + ssize_t result = ACE_OS::readv (this->get_handle (), iovp, total_tuples); +#if !defined (ACE_HAS_ALLOCA) + delete [] iovp; +#endif /* !defined (ACE_HAS_ALLOCA) */ + va_end (argp); + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DEV_IO.h b/externals/ace/DEV_IO.h new file mode 100644 index 0000000..3b1c3de --- /dev/null +++ b/externals/ace/DEV_IO.h @@ -0,0 +1,185 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file DEV_IO.h + * + * $Id: DEV_IO.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Gerhard Lenzer + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_DEV_IO_H +#define ACE_DEV_IO_H +#include /**/ "ace/pre.h" + +#include "ace/DEV.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_STREAM_PIPES) +# include "ace/OS_NS_stropts.h" +#endif /* ACE_HAS_STREAM_PIPES */ + +#include "ace/os_include/os_stdio.h" +#include "ace/os_include/sys/os_uio.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +/** + * @class ACE_DEV_IO + * + * @brief Read/Write operations on Devices. + */ +class ACE_Export ACE_DEV_IO : public ACE_DEV +{ +public: + friend class ACE_DEV_Connector; + + /// Default constructor. + ACE_DEV_IO (void); + + // = Various send operations. + /// send upto @a n bytes in @a buf. + ssize_t send (const void *buf, size_t n) const; + + /// Recv upto @a n bytes in @a buf. + ssize_t recv (void *buf, size_t n) const; + + /// Send n bytes, keep trying until n are sent. + ssize_t send_n (const void *buf, + size_t n) const; + + /** + * @name I/O operations + * + * Notes on common parameters: + * + * @a buf is the buffer to write from or receive into. + * + * @a len is the number of bytes to transfer. + * + * The @a timeout parameter in the following methods indicates how + * long to blocking trying to transfer data. If @a timeout == 0, + * then the call behaves as a normal send/recv call, i.e., for + * blocking sockets, the call will block until action is possible; + * for non-blocking sockets, EWOULDBLOCK will be returned if no + * action is immediately possible. + * + * If @a timeout != 0, the call will wait until the relative time + * specified in *@a timeout elapses. + * + * The "_n()" I/O methods keep looping until all the data has been + * transferred. These methods also work for sockets in non-blocking + * mode i.e., they keep looping on EWOULDBLOCK. @a timeout is used + * to make sure we keep making progress, i.e., the same timeout + * value is used for every I/O operation in the loop and the timeout + * is not counted down. + * + * The return values for the "*_n()" methods match the return values + * from the non "_n()" methods and are specified as follows: + * + * - On complete transfer, the number of bytes transferred is returned. + * - On timeout, -1 is returned, errno == ETIME. + * - On error, -1 is returned, errno is set to appropriate error. + * - On EOF, 0 is returned, errno is irrelevant. + * + * On partial transfers, i.e., if any data is transferred before + * timeout/error/EOF, @a bytes_transferred will contain the number of + * bytes transferred. + */ + ssize_t recv_n (void *buf, + size_t n, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0) const; + +#if defined (ACE_HAS_STREAM_PIPES) + /// Recv bytes via STREAM pipes using "band" mode. + ssize_t recv (ACE_Str_Buf *cntl, + ACE_Str_Buf *data, + int *band, + int *flags) const; + + /// Send bytes via STREAM pipes using "band" mode. + ssize_t send (const ACE_Str_Buf *cntl, + const ACE_Str_Buf *data, + int band, + int flags) const; + + /// Recv @a cntl and @a data via STREAM pipes. + ssize_t recv (ACE_Str_Buf *cntl, + ACE_Str_Buf *data, + int *flags) const; + + /// Send @a cntl and @a data via STREAM pipes. + ssize_t send (const ACE_Str_Buf *cntl, + const ACE_Str_Buf *data, + int flags = 0) const; +#endif /* ACE_HAS_STREAM_PIPES */ + + /// Send iovecs via <::writev>. + ssize_t send (const iovec iov[], size_t n) const; + + /// Recv iovecs via <::readv>. + ssize_t recv (iovec iov[], size_t n) const; + + /** + * Send N char *ptrs and int lengths. Note that the char *'s + * precede the ints (basically, an varargs version of writev). The + * count N is the *total* number of trailing arguments, *not* a + * couple of the number of tuple pairs! + */ + ssize_t send (size_t n, ...) const; + + /** + * This is an interface to ::readv, that doesn't use the struct + * iovec explicitly. The ... can be passed as an arbitrary number + * of (char *ptr, int len) tuples. However, the count N is the + * *total* number of trailing arguments, *not* a couple of the + * number of tuple pairs! + */ + ssize_t recv (size_t n, ...) const; + + /// Send @a n bytes via Win32 WriteFile using overlapped I/O. + ssize_t send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; + + /// Recv @a n bytes via Win32 ReadFile using overlapped I/O. + ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; + + /// Dump the state of an object. + void dump (void) const; + + // = The following two methods are no-ops to keep the + // ACE_Connector happy. + /// Return the local endpoint address. + int get_local_addr (ACE_DEV_Addr &) const; + + /// Return the address of the remotely connected peer (if there is + /// one). + int get_remote_addr (ACE_DEV_Addr &) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + // = Meta-type info + typedef ACE_DEV_Addr PEER_ADDR; + +private: + /// Address of device we are connected to. + ACE_DEV_Addr addr_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/DEV_IO.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_DEV_IO_H */ diff --git a/externals/ace/DEV_IO.inl b/externals/ace/DEV_IO.inl new file mode 100644 index 0000000..796d24e --- /dev/null +++ b/externals/ace/DEV_IO.inl @@ -0,0 +1,126 @@ +// -*- C++ -*- +// +// $Id: DEV_IO.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_sys_uio.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_Memory.h" + +#include "ace/ACE.h" + +// Send exactly N bytes from BUF to this device. Keeping trying until +// this many bytes are sent. + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ssize_t +ACE_DEV_IO::send_n (const void *buf, size_t n) const +{ + ACE_TRACE ("ACE_DEV_IO::send_n"); + return ACE::write_n (this->get_handle (), buf, n); +} + +// Receive exactly N bytes from this file into BUF. Keep trying until +// this many bytes are received. + +ACE_INLINE ssize_t +ACE_DEV_IO::recv_n (void *buf, + size_t n, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) const +{ + ACE_TRACE ("ACE_DEV_IO::recv_n"); +#if defined (ACE_WIN32) + ACE_UNUSED_ARG (timeout); + + return ACE::read_n (this->get_handle (), + buf, + n, + bytes_transferred); +#else + return ACE::recv_n (this->get_handle (), + buf, + n, + timeout, + bytes_transferred); +#endif /*ACE_WIN32*/ +} + +ACE_INLINE ssize_t +ACE_DEV_IO::send (const void *buf, size_t n) const +{ + ACE_TRACE ("ACE_DEV_IO::send"); + return ACE_OS::write (this->get_handle (), (const char *) buf, n); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::recv (void *buf, size_t n) const +{ + ACE_TRACE ("ACE_DEV_IO::recv"); + return ACE_OS::read (this->get_handle (), (char *) buf, n); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::send (const iovec iov[], size_t n) const +{ + ACE_TRACE ("ACE_DEV_IO::send"); + return ACE_OS::writev (this->get_handle (), iov, static_cast (n)); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::recv (iovec iov[], size_t n) const +{ + ACE_TRACE ("ACE_DEV_IO::recv"); + return ACE_OS::readv (this->get_handle (), iov, static_cast (n)); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::send (const void *buf, size_t n, + ACE_OVERLAPPED *overlapped) const +{ + ACE_TRACE ("ACE_DEV_IO::send"); + return ACE_OS::write (this->get_handle (), + (const char *) buf, n, + overlapped); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::recv (void *buf, size_t n, + ACE_OVERLAPPED *overlapped) const +{ + ACE_TRACE ("ACE_DEV_IO::recv"); + return ACE_OS::read (this->get_handle (), (char *) buf, n, + overlapped); +} + +#if defined (ACE_HAS_STREAM_PIPES) +ACE_INLINE ssize_t +ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const +{ + ACE_TRACE ("ACE_DEV_IO::recv"); + return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const +{ + ACE_TRACE ("ACE_DEV_IO::send"); + return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const +{ + ACE_TRACE ("ACE_DEV_IO::recv"); + return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); +} + +ACE_INLINE ssize_t +ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const +{ + ACE_TRACE ("ACE_DEV_IO::send"); + return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); +} +#endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DLL.cpp b/externals/ace/DLL.cpp new file mode 100644 index 0000000..cad2511 --- /dev/null +++ b/externals/ace/DLL.cpp @@ -0,0 +1,267 @@ +// $Id: DLL.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/DLL.h" + +#include "ace/Log_Msg.h" +#include "ace/ACE.h" +#include "ace/DLL_Manager.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_dlfcn.h" +#include "ace/OS_NS_Thread.h" + +#include + +ACE_RCSID(ace, DLL, "$Id: DLL.cpp 80826 2008-03-04 14:51:23Z wotte $") + + ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Default constructor. Also, by default, the object will be closed +// before it is destroyed. + +ACE_DLL::ACE_DLL (bool close_handle_on_destruction) + : open_mode_ (0), + dll_name_ (0), + close_handle_on_destruction_ (close_handle_on_destruction), + dll_handle_ (0), + error_ (0) +{ + ACE_TRACE ("ACE_DLL::ACE_DLL (int)"); +} + +ACE_DLL::ACE_DLL (const ACE_DLL &rhs) + : open_mode_ (0), + dll_name_ (0), + close_handle_on_destruction_ (false), + dll_handle_ (0), + error_ (0) +{ + ACE_TRACE ("ACE_DLL::ACE_DLL (const ACE_DLL &)"); + + if (rhs.dll_name_ + // This will automatically up the refcount. + && this->open (rhs.dll_name_, + rhs.open_mode_, + rhs.close_handle_on_destruction_) != 0 + && ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL::copy_ctor: error: %s\n"), + this->error ())); +} + +// Assignment operator + +ACE_DLL & +ACE_DLL::operator= (const ACE_DLL &rhs) +{ + ACE_TRACE ("ACE_DLL::operator= (const ACE_DLL &)"); + + ACE_DLL tmp (rhs); + + std::swap (this->open_mode_, tmp.open_mode_); + std::swap (this->dll_name_, tmp.dll_name_); + std::swap (this->close_handle_on_destruction_, + tmp.close_handle_on_destruction_); + std::swap (this->dll_handle_, tmp.dll_handle_); + std::swap (this->error_, tmp.error_); + + return *this; +} + + +// If the library name and the opening mode are specified than on +// object creation the library is implicitly opened. + +ACE_DLL::ACE_DLL (const ACE_TCHAR *dll_name, + int open_mode, + bool close_handle_on_destruction) + : open_mode_ (open_mode), + dll_name_ (0), + close_handle_on_destruction_ (close_handle_on_destruction), + dll_handle_ (0), + error_ (0) +{ + ACE_TRACE ("ACE_DLL::ACE_DLL"); + + if (this->open (dll_name, this->open_mode_, close_handle_on_destruction) != 0 + && ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL::open: error calling open: %s\n"), + this->error ())); +} + +// The library is closed before the class gets destroyed depending on +// the close_handle_on_destruction value specified which is stored in +// close_handle_on_destruction_. + +ACE_DLL::~ACE_DLL (void) +{ + ACE_TRACE ("ACE_DLL::~ACE_DLL"); + + this->close (); + + // Normally delete()d in ACE_DLL::close(). However, that may not + // occur if full ACE_DLL initialization is interrupted due to errors + // (e.g. attempting to open a DSO/DLL that does not exist). Make + // sure this->dll_name_ is deallocated. + delete [] this->dll_name_; +} + +// This method opens the library based on the mode specified using the +// ACE_SHLIB_HANDLE which is obtained on making the ACE_OS::dlopen call. +// The default mode is: +// RTLD_LAZY Only references to data symbols are relocate when the +// object is first loaded. +// The other modes include: +// RTLD_NOW All necessary relocations are performed when the +// object is first loaded. +// RTLD_GLOBAL The object symbols are made available for the +// relocation processing of any other object. + +int +ACE_DLL::open (const ACE_TCHAR *dll_filename, + int open_mode, + bool close_handle_on_destruction) +{ + ACE_TRACE ("ACE_DLL::open"); + + return open_i (dll_filename, open_mode, close_handle_on_destruction); +} + +int +ACE_DLL::open_i (const ACE_TCHAR *dll_filename, + int open_mode, + bool close_handle_on_destruction, + ACE_SHLIB_HANDLE handle) +{ + ACE_TRACE ("ACE_DLL::open_i"); + + this->error_ = 0; + + if (!dll_filename) + { + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL::open_i: dll_name is %s\n"), + this->dll_name_ == 0 ? ACE_TEXT ("(null)") + : this->dll_name_)); + return -1; + } + + if (this->dll_handle_) + { + // If we have a good handle and its the same name, just return. + if (ACE_OS::strcmp (this->dll_name_, dll_filename) == 0) + return 0; + else + this->close (); + } + + if (!this->dll_name_) + this->dll_name_ = ACE::strnew (dll_filename); + + this->open_mode_ = open_mode; + this->close_handle_on_destruction_ = close_handle_on_destruction; + + this->dll_handle_ = ACE_DLL_Manager::instance()->open_dll (this->dll_name_, + this->open_mode_, + handle); + + if (!this->dll_handle_) + this->error_ = 1; + + return this->error_ ? -1 : 0; +} + +// The symbol refernce of the name specified is obtained. + +void * +ACE_DLL::symbol (const ACE_TCHAR *sym_name, int ignore_errors) +{ + ACE_TRACE ("ACE_DLL::symbol"); + + this->error_ = 0; + + void *sym = 0; + if (this->dll_handle_) + sym = this->dll_handle_->symbol (sym_name, ignore_errors); + + if (!sym) + this->error_ = 1; + + return sym; +} + +// The library is closed using the ACE_SHLIB_HANDLE object, i.e., the +// shared object is now disassociated form the current process. + +int +ACE_DLL::close (void) +{ + ACE_TRACE ("ACE_DLL::close"); + + int retval = 0; + + if (this->dll_handle_ + && this->close_handle_on_destruction_ + && this->dll_name_ + && (retval = ACE_DLL_Manager::instance ()->close_dll (this->dll_name_)) != 0) + this->error_ = 1; + + // Even if close_dll() failed, go ahead and cleanup. + this->dll_handle_ = 0; + delete [] this->dll_name_; + this->dll_name_ = 0; + this->close_handle_on_destruction_ = false; + + return retval; +} + +// This method is used return the last error of a library operation. + +ACE_TCHAR * +ACE_DLL::error (void) const +{ + ACE_TRACE ("ACE_DLL::error"); + if (this->error_) + { + return ACE_OS::dlerror (); + } + + return 0; +} + +// Return the handle to the user either temporarily or forever, thus +// orphaning it. If 0 means the user wants the handle forever and if 1 +// means the user temporarily wants to take the handle. + +ACE_SHLIB_HANDLE +ACE_DLL::get_handle (int become_owner) const +{ + ACE_TRACE ("ACE_DLL::get_handle"); + + ACE_SHLIB_HANDLE handle = ACE_SHLIB_INVALID_HANDLE; + + if (this->dll_handle_) + handle = this->dll_handle_->get_handle (become_owner); + + return handle; +} + +// Set the handle for the DLL. By default, the object will be closed +// before it is destroyed. + +int +ACE_DLL::set_handle (ACE_SHLIB_HANDLE handle, + bool close_handle_on_destruction) +{ + ACE_TRACE ("ACE_DLL::set_handle"); + + // Create a unique name. Note that this name is only quaranteed + // to be unique for the life of this object. + ACE_TCHAR temp[ACE_UNIQUE_NAME_LEN]; + ACE_OS::unique_name (this, temp, ACE_UNIQUE_NAME_LEN); + + return this->open_i (temp, 1, close_handle_on_destruction, handle); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DLL.h b/externals/ace/DLL.h new file mode 100644 index 0000000..fa748e8 --- /dev/null +++ b/externals/ace/DLL.h @@ -0,0 +1,196 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DLL.h + * + * $Id: DLL.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Kirthika Parameswaran + */ +//============================================================================= + +#ifndef ACE_DLL_H +#define ACE_DLL_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/os_include/os_dlfcn.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_DLL_Handle; + +/** + * @class ACE_DLL + * + * @brief Provides an abstract interface for handling various DLL + * operations. + * + * This class is a wrapper over the various methods for utilizing + * a dynamically linked library (DLL), which is called a shared + * library on some platforms. Operations @c open(), @c close(), and + * @c symbol() have been implemented to help opening/closing and + * extracting symbol information from a DLL, respectively. + */ +class ACE_Export ACE_DLL +{ +public: + // = Initialization and termination methods. + + /** + * Default constructor. By default, the close() operation on the + * object will be invoked before it is destroyed. + * @param close_handle_on_destruction Indicates whether or not the + * close() method will be called to close an open DLL when this + * object is destroyed. By default, close() will be called. + * Set this parameter to 0 for situations where the DLL's lifetime + * is controlled in a scope other than that of this ACE_DLL object. + * For example, termination by ACE_DLL_Manager via ACE::fini(). + */ + explicit ACE_DLL (bool close_handle_on_destruction = true); + + /// Allow assignment + ACE_DLL& operator= (const ACE_DLL &rhs); + + + /** + * This constructor performs the actions of open() during construction. + * @param dll_name The name or path of the DLL to load. + * @param open_mode Flags to alter the actions taken when loading the DLL. + * The possible values are: + * @li @c RTLD_LAZY (this the default): loads identifier symbols but + * not the symbols for functions, which are loaded dynamically + * on-demand. + * @li @c RTLD_NOW: performs all necessary relocations when + * @a dll_name is first loaded + * @li RTLD_GLOBAL: makes symbols available for relocation + * processing of any other DLLs. + * @param close_handle_on_destruction Indicates whether or not the + * close() method will be called to close an open DLL when this + * object is destroyed. By default, close() will be called. + * Set this parameter to 0 for situations where the DLL's lifetime + * is controlled in a scope other than that of this ACE_DLL object. + * For example, termination by ACE_DLL_Manager via ACE::fini(). + */ + explicit ACE_DLL (const ACE_TCHAR *dll_name, + int open_mode = ACE_DEFAULT_SHLIB_MODE, + bool close_handle_on_destruction = true); + + /// Copy constructor. + ACE_DLL (const ACE_DLL &); + + /** + * This method opens and dynamically links a specified DLL. + * @param dll_name The filename or path of the DLL to load. + * If a filename is given to @c open(), the @c ACE::ldfind() is used + * to locate DLLs via the following algorithms: (1) DLL filename + * expansion: @c ACE::ldfind() determines the name of the DLL by + * adding the appropriate prefix and suffix, e.g., it adds the @c lib + * prefix and @c .so suffix for Solaris and the @c .dll suffix for + * Windows and (2) DLL search path: @c ACE::ldfind() will also search + * for the designated DLL using the platform's DLL search path + * environment variable, e.g., it searches for DLLs using @c + * LD_LIBRARY_PATH on many UNIX systems and @c PATH on Windows. + * @param open_mode Flags to alter the actions taken when loading the DLL. + * The possible values are: + * @li @c RTLD_LAZY (this the default): loads identifier symbols but + * not the symbols for functions, which are loaded dynamically + * on-demand. + * @li @c RTLD_NOW: performs all necessary relocations when + * @a dll_name is first loaded + * @li RTLD_GLOBAL: makes symbols available for relocation + * processing of any other DLLs. + * @param close_handle_on_destruction Indicates whether or not the + * close() method will be called to close an open DLL when this + * object is destroyed. By default, close() will be called. + * Set this parameter to 0 for situations where the DLL's lifetime + * is controlled in a scope other than that of this ACE_DLL object. + * For example, termination by ACE_DLL_Manager via ACE::fini(). + * @retval -1 On failure + * @retval 0 On success. + */ + int open (const ACE_TCHAR *dll_name, + int open_mode = ACE_DEFAULT_SHLIB_MODE, + bool close_handle_on_destruction = true); + + /// Call to close the DLL object. + int close (void); + + /** + * Called when the DLL object is destroyed -- invokes close() if the + * @a close_handle_on_destruction flag was set to non-zero in the + * constructor or open() method. + */ + ~ACE_DLL (void); + + /** + * Look up a named symbol in the DLL. DLL must be successfully opened + * before calling symbol(). + * @param symbol_name The symbol name to look up. + * @param ignore_errors If set to 1, allows you to probe a dll without + * generating error messages in the log. Handy for determining + * the capabilities of a library. + * @return Returns the value of @a symbol_name if it is a valid symbol + * in the DLL. Otherwise, returns 0. + */ + void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); + + /// Returns a pointer to a string explaining that an error occured. You + /// will need to consult the error log for the actual error string + /// returned by the OS. + ACE_TCHAR *error (void) const; + + /** + * Return the handle to the caller. If @a become_owner is non-0 then + * caller assumes ownership of the handle and the ACE_DLL object + * won't call close() when it goes out of scope, even if + * is set. + */ + ACE_SHLIB_HANDLE get_handle (int become_owner = 0) const; + + /// Set the handle for the DLL object. By default, the close() + //operation on / the object will be invoked before it is destroyed. + int set_handle (ACE_SHLIB_HANDLE handle, + bool close_handle_on_destruction = true); + +private: + + int open_i (const ACE_TCHAR *dll_name, + int open_mode = ACE_DEFAULT_SHLIB_MODE, + bool close_handle_on_destruction = true, + ACE_SHLIB_HANDLE handle = 0); + + + //private: +public: + + /// Open mode. + int open_mode_; + + /// Keep track of the name of the loaded dll, so it can be used + /// to remove framework components, singletons that live in the dll, + /// prior to unloading the dll in the close() method. + ACE_TCHAR *dll_name_; + + /// This flag keeps track of whether we should close the handle + /// automatically when the object is destroyed. + bool close_handle_on_destruction_; + + ACE_DLL_Handle *dll_handle_; + + /// Flag to record if the last operation had an error. + bool error_; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_DLL_H */ diff --git a/externals/ace/DLL_Manager.cpp b/externals/ace/DLL_Manager.cpp new file mode 100644 index 0000000..9f2578e --- /dev/null +++ b/externals/ace/DLL_Manager.cpp @@ -0,0 +1,787 @@ +// $Id: DLL_Manager.cpp 86478 2009-08-13 07:15:05Z johnnyw $ + +#include "ace/DLL_Manager.h" + +#include "ace/Log_Msg.h" +#include "ace/ACE.h" +#include "ace/Framework_Component.h" + +#include "ace/Lib_Find.h" +#include "ace/Object_Manager.h" +#include "ace/SString.h" +#include "ace/Recursive_Thread_Mutex.h" +#include "ace/Guard_T.h" +#include "ace/OS_NS_dlfcn.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ace, + DLL_Manager, + "DLL_Manager.cpp,v 4.23 2003/11/05 23:30:46 shuston Exp") + +/******************************************************************/ + + ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +sig_atomic_t ACE_DLL_Handle::open_called_ = 0; + +ACE_DLL_Handle::ACE_DLL_Handle (void) + : refcount_ (0), + dll_name_ (0), + handle_ (ACE_SHLIB_INVALID_HANDLE) +{ + ACE_TRACE ("ACE_DLL_Handle::ACE_DLL_Handle"); +} + +ACE_DLL_Handle::~ACE_DLL_Handle (void) +{ + ACE_TRACE ("ACE_DLL_Handle::~ACE_DLL_Handle"); + this->close (1); + delete[] this->dll_name_; +} + +const ACE_TCHAR * +ACE_DLL_Handle::dll_name (void) const +{ + ACE_TRACE ("ACE_DLL_Handle::dll_name"); + return this->dll_name_; +} + +int +ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, + int open_mode, + ACE_SHLIB_HANDLE handle) +{ + ACE_TRACE ("ACE_DLL_Handle::open"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + + if (this->dll_name_) + { + // Once dll_name_ has been set, it can't be changed.. + if (ACE_OS::strcmp (this->dll_name_, dll_name) != 0) + { + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) DLL_Handle::open: error, ") + ACE_TEXT ("tried to reopen %s with name %s\n"), + this->dll_name_, + dll_name)); + + return -1; + } + } + else + this->dll_name_ = ACE::strnew (dll_name); + + if (!this->open_called_) + this->open_called_ = 1; + + // If it hasn't been loaded yet, go ahead and do that now. + if (this->handle_ == ACE_SHLIB_INVALID_HANDLE) + { + if (handle) + this->handle_ = handle; + else + { + /* + ** Get the set of names to try loading. We need to do this to + ** properly support the ability for a user to specify a simple, + ** unadorned name (for example, "ACE") that will work across + ** platforms. We apply platform specifics to get a name that will + ** work (e.g. libACE, ACEd.dll, ACE.dll, etc.) We rely on the + ** underlying dlopen() implementation to "Do The Right Thing" in + ** terms of using relative paths, LD_LIBRARY_PATH, system security + ** rules, etc. except when ACE_MUST_HELP_DLOPEN_SEARCH_PATH is set. + ** If it is set, then ACE::ldfind() scans the configured path + ** looking for a match on the name and prefix/suffix applications. + ** NOTE: having ACE scan for a file and then pass a fully-qualified + ** pathname to dlopen() is a potential security hole; therefore, + ** do not use ACE_MUST_HELP_DLOPEN_SEARCH_PATH unless necessary + ** and only after considering the risks. + */ + ACE_Array dll_names; + dll_names.max_size (10); // Decent guess to avoid realloc later + +#if defined (ACE_MUST_HELP_DLOPEN_SEARCH_PATH) + // Find out where the library is + ACE_TCHAR dll_pathname[MAXPATHLEN + 1]; + + // Transform the pathname into the appropriate dynamic link library + // by searching the ACE_LD_SEARCH_PATH. + ACE::ldfind (dll_name, + dll_pathname, + (sizeof dll_pathname / sizeof (ACE_TCHAR))); + ACE_TString dll_str (dll_pathname); + dll_names.size (1); + dll_names.set (dll_str, 0); +#else + this->get_dll_names (dll_name, dll_names); +#endif + + ACE_Array_Iterator name_iter (dll_names); + ACE_TString *name = 0; + while (name_iter.next (name)) + { + // The ACE_SHLIB_HANDLE object is obtained. + this->handle_ = ACE_OS::dlopen (name->c_str (), + open_mode); + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") + ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"), + name->c_str (), + open_mode, + ((this->handle_ != ACE_SHLIB_INVALID_HANDLE) + ? ACE_TEXT ("succeeded") + : ACE_TEXT ("failed")), + this->error()->c_str())); + } + + if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) // Good one? + break; + + // If errno is ENOENT we just skip over this one, + // anything else - like an undefined symbol, for + // instance must be flagged here or the next error will + // mask it. + // @TODO: If we've found our DLL _and_ it's + // broken, should we continue at all? + if ((errno != 0) && (errno != ENOENT) && ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") + ACE_TEXT ("(\'%s\') failed, errno=") + ACE_TEXT ("%d: <%s>\n"), + name->c_str (), + ACE_ERRNO_GET, + this->error ()->c_str ())); + +#if defined (AIX) + // AIX often puts the shared library file (most often named + // shr.o) inside an archive library. If this is an archive + // library name, then try appending [shr.o] and retry. + if (ACE_TString::npos != name->strstr (ACE_TEXT (".a"))) + { + ACE_TCHAR aix_pathname[MAXPATHLEN + 1]; + ACE_OS::strncpy (aix_pathname, + name->c_str (), + name->length ()); + aix_pathname[name->length ()] = '\0'; + ACE_OS::strcat (aix_pathname, ACE_TEXT ("(shr.o)")); + open_mode |= RTLD_MEMBER; + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") + ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"), + aix_pathname, + open_mode, + (this->handle_ != ACE_SHLIB_INVALID_HANDLE + ? ACE_TEXT ("succeeded") + : ACE_TEXT ("failed")), + this->error()->c_str())); + } + + this->handle_ = ACE_OS::dlopen (aix_pathname, open_mode); + if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) + break; + + // If errno is ENOENT we just skip over this one, anything + // else - like an undefined symbol, for instance + // must be flagged here or the next error will mask it. + // + // @TODO: If we've found our DLL _and_ it's broken, + // should we continue at all? + if (ACE::debug () && (errno != 0) && (errno != ENOENT)) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ") + ACE_TEXT ("(\'%s\') failed, errno=") + ACE_TEXT ("%d: %s\n"), + name->c_str (), + errno, + this->error ()->c_str ())); + + } +#endif /* AIX */ + + name_iter.advance (); + } + + if (this->handle_ == ACE_SHLIB_INVALID_HANDLE) + { + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::open (\"%s\"): ") + ACE_TEXT ("Invalid handle error: %s\n"), + this->dll_name_, + this->error ()->c_str ())); + + return -1; + } + } + } + + ++this->refcount_; + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::open - %s (%d), refcount=%d\n"), + this->dll_name_, + this->handle_, + this->refcount_)); + return 0; +} + + +int +ACE_DLL_Handle::close (int unload) +{ + ACE_TRACE ("ACE_DLL_Handle::close"); + + int retval = 0; + ACE_SHLIB_HANDLE h = ACE_SHLIB_INVALID_HANDLE; + + // Only hold the lock until it comes time to dlclose() the DLL. Closing + // the DLL can cause further shutdowns as DLLs and their dependents are + // unloaded. + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + + // Since we don't actually unload the dll as soon as the refcount + // reaches zero, we need to make sure we don't decrement it below + // zero. + if (this->refcount_ > 0) + --this->refcount_; + else + this->refcount_ = 0; + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::close - ") + ACE_TEXT ("%s (handle=%d, refcount=%d)\n"), + this->dll_name_, + this->handle_, + this->refcount_)); + + if (this->refcount_ == 0 && + this->handle_ != ACE_SHLIB_INVALID_HANDLE && + unload == 1) + { + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::close: ") + ACE_TEXT ("Unloading %s (handle=%d)\n"), + this->dll_name_, + this->handle_)); + + // First remove any associated Framework Components. + ACE_Framework_Repository *frPtr= ACE_Framework_Repository::instance (); + if (frPtr) + { + frPtr->remove_dll_components (this->dll_name_); + } + + h = this->handle_; + this->handle_ = ACE_SHLIB_INVALID_HANDLE; + } + } // Release lock_ here + + if (h != ACE_SHLIB_INVALID_HANDLE) + { + retval = ACE_OS::dlclose (h); + + if (retval != 0 && ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::close - ") + ACE_TEXT ("Failed with: \"%s\".\n"), + this->error ()->c_str ())); + } + + return retval; +} + +sig_atomic_t +ACE_DLL_Handle::refcount (void) const +{ + return this->refcount_; +} + +void * +ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors) +{ + ACE_TRACE ("ACE_DLL_Handle::symbol"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + + ACE_Auto_Array_Ptr auto_name (ACE::ldname (sym_name)); + // handle_ can be invalid especially when ACE_DLL_Handle resigned ownership + // BTW. Handle lifecycle management is a little crazy in ACE + if (this->handle_ != ACE_SHLIB_INVALID_HANDLE) + { +#if defined (ACE_OPENVMS) + void *sym = ACE::ldsymbol (this->handle_, auto_name.get ()); +#else + void *sym = ACE_OS::dlsym (this->handle_, auto_name.get ()); +#endif + + // Linux says that the symbol could be null and that it isn't an + // error. So you should check the error message also, but since + // null symbols won't do us much good anyway, let's still report + // an error. + if (!sym && ignore_errors != 1) + { + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::symbol (\"%s\") ") + ACE_TEXT (" failed with \"%s\".\n"), + auto_name.get (), + this->error ()->c_str ())); + + return 0; + } + return sym; + } + return 0; +} + +ACE_SHLIB_HANDLE +ACE_DLL_Handle::get_handle (int become_owner) +{ + ACE_TRACE ("ACE_DLL_Handle::get_handle"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + + if (this->refcount_ == 0 && become_owner != 0) + { + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) DLL_Handle::get_handle: ") + ACE_TEXT ("cannot become owner, refcount == 0.\n"))); + + return ACE_SHLIB_INVALID_HANDLE; + } + + ACE_SHLIB_HANDLE handle = this->handle_; + + if (become_owner != 0) + { + if (--this->refcount_ == 0) + this->handle_ = ACE_SHLIB_INVALID_HANDLE; + } + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) ACE_DLL_Handle::get_handle: ") + ACE_TEXT ("post call: handle %s, refcount %d\n"), + this->handle_ == ACE_SHLIB_INVALID_HANDLE ? + ACE_TEXT ("invalid") : ACE_TEXT ("valid"), + this->refcount_)); + + return handle; +} + +// This method is used return the last error of a library operation. + +auto_ptr +ACE_DLL_Handle::error (void) +{ + ACE_TRACE ("ACE_DLL_Handle::error"); + const ACE_TCHAR *error = ACE_OS::dlerror (); + auto_ptr str + (new ACE_TString (error ? error : ACE_TEXT ("no error"))); + return str; +} + +void +ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, + ACE_Array &try_names) +{ + // Build the array of DLL names to try on this platform by applying the + // proper prefixes and/or suffixes to the specified dll_name. + ACE_TString base (dll_name); + ACE_TString base_dir, base_file, base_suffix; + + // 1. Separate the dll_name into the dir part and the file part. We + // only decorate the file part to determine the names to try loading. + ACE_TString::size_type pos = base.rfind (ACE_DIRECTORY_SEPARATOR_CHAR); + if (pos != ACE_TString::npos) + { + base_dir = base.substr (0, pos + 1); + base_file = base.substr (pos + 1); + } + else + base_file = base; + + // 2. Locate the file suffix, if there is one. Move the '.' and the + // suffix to base_suffix. + if ((pos = base_file.rfind (ACE_TEXT ('.'))) != ACE_TString::npos) + { + base_suffix = base_file.substr (pos); + base_file = base_file.substr (0, pos); + } + + // 3. Build the combinations to try for this platform. + // Try these combinations: + // - name with decorator and platform's suffix appended (if not supplied) + // - name with platform's suffix appended (if not supplied) + // - name with platform's dll prefix (if it has one) and suffix + // - name with platform's dll prefix, decorator, and suffix. + // - name as originally given + // We first try to find the file using the decorator so that when a + // filename with and without decorator is used, we get the file with + // the same decorator as the ACE dll has and then as last resort + // the one without. For example with msvc, the debug build has a "d" + // decorator, but the release build has none and we really want to get + // the debug version of the library in a debug application instead + // of the release one. + // So we need room for 5 entries in try_names. + try_names.size (0); + if ((try_names.max_size () - try_names.size ()) < 5) + try_names.max_size (try_names.max_size () + 5); +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) + ACE_TString decorator (ACE_LD_DECORATOR_STR); +#endif + ACE_TString suffix (ACE_DLL_SUFFIX); + ACE_TString prefix (ACE_DLL_PREFIX); + + for (size_t i = 0; i < 5 && try_names.size () < try_names.max_size (); ++i) + { + ACE_TString try_this; + size_t const j = try_names.size (); + switch (i) + { + case 0: // Name + decorator + suffix + case 1: // Name + suffix + case 2: // Prefix + name + decorator + suffix + case 3: // Prefix + name + suffix + if ( + base_suffix.length () > 0 +#if !(defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)) + || (i == 1 || i == 3) // No decorator desired; skip +#endif + ) + break; + try_this = base_dir; + if (i > 1) + try_this += prefix; + try_this += base_file; + if (base_suffix.length () > 0) + try_this += base_suffix; + else + { +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) + try_this += decorator; +#endif + try_this += suffix; + } + break; + case 4: + try_this = dll_name; + break; + } + + if (try_this.length ()) + { + try_names.size (j + 1); + try_names.set (try_this, j); + } + } + return; +} + +/******************************************************************/ + +// Pointer to the Singleton instance. +ACE_DLL_Manager *ACE_DLL_Manager::instance_ = 0; + + +ACE_DLL_Manager * +ACE_DLL_Manager::instance (int size) +{ + ACE_TRACE ("ACE_DLL_Manager::instance"); + + if (ACE_DLL_Manager::instance_ == 0) + { + // Perform Double-Checked Locking Optimization. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + if (ACE_DLL_Manager::instance_ == 0) + { + ACE_NEW_RETURN (ACE_DLL_Manager::instance_, + ACE_DLL_Manager (size), + 0); + } + } + + return ACE_DLL_Manager::instance_; +} + +void +ACE_DLL_Manager::close_singleton (void) +{ + ACE_TRACE ("ACE_DLL_Manager::close_singleton"); + + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance ())); + + delete ACE_DLL_Manager::instance_; + ACE_DLL_Manager::instance_ = 0; +} + +ACE_DLL_Manager::ACE_DLL_Manager (int size) + : handle_vector_ (0), + current_size_ (0), + total_size_ (0), + unload_policy_ (ACE_DLL_UNLOAD_POLICY_PER_DLL) +{ + ACE_TRACE ("ACE_DLL_Manager::ACE_DLL_Manager"); + + if (this->open (size) != 0 && ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL_Manager ctor failed to allocate ") + ACE_TEXT ("handle_vector_.\n"))); +} + +ACE_DLL_Manager::~ACE_DLL_Manager (void) +{ + ACE_TRACE ("ACE_DLL_Manager::~ACE_DLL_Manager"); + + if (this->close () != 0 && ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL_Manager dtor failed to close ") + ACE_TEXT ("properly.\n"))); +} + +ACE_DLL_Handle * +ACE_DLL_Manager::open_dll (const ACE_TCHAR *dll_name, + int open_mode, + ACE_SHLIB_HANDLE handle) +{ + ACE_TRACE ("ACE_DLL_Manager::open_dll"); + + ACE_DLL_Handle *temp_handle = 0; + ACE_DLL_Handle *dll_handle = 0; + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + dll_handle = this->find_dll (dll_name); + if (!dll_handle) + { + if (this->current_size_ < this->total_size_) + { + ACE_NEW_RETURN (temp_handle, + ACE_DLL_Handle, + 0); + + dll_handle = temp_handle; + } + } + } + + if (dll_handle) + { + if (dll_handle->open (dll_name, open_mode, handle) != 0) + { + // Error while opening dll. Free temp handle + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL_Manager::open_dll: Could not ") + ACE_TEXT ("open dll %s.\n"), + dll_name)); + + delete temp_handle; + return 0; + } + + // Add the handle to the vector only if the dll is successfully + // opened. + if (temp_handle != 0) + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + this->handle_vector_[this->current_size_] = dll_handle; + ++this->current_size_; + } + } + + return dll_handle; +} + +int +ACE_DLL_Manager::close_dll (const ACE_TCHAR *dll_name) +{ + ACE_TRACE ("ACE_DLL_Manager::close_dll"); + ACE_DLL_Handle *handle = 0; + + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + handle = this->find_dll (dll_name); + } + + if (handle) + { + return this->unload_dll (handle, 0); + } + + return -1; +} + +u_long +ACE_DLL_Manager::unload_policy (void) const +{ + ACE_TRACE ("ACE_DLL_Manager::unload_policy"); + return this->unload_policy_; +} + +void +ACE_DLL_Manager::unload_policy (u_long unload_policy) +{ + ACE_TRACE ("ACE_DLL_Manager::unload_policy"); + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); + + u_long old_policy = this->unload_policy_; + this->unload_policy_ = unload_policy; + + // If going from LAZY to EAGER or from PER_DLL to PER_PROCESS|EAGER, + // call close(1) on all the ACE_DLL_Handle objects with refcount == 0 + // which will force those that are still loaded to be unloaded. + if (this->handle_vector_) + if (( ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_LAZY) && + ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) ) || + ( ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) && + ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_PER_DLL) && + ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_PER_DLL) )) + { + for (int i = this->current_size_ - 1; i >= 0; i--) + { + if (this->handle_vector_[i] && + this->handle_vector_[i]->refcount () == 0) + this->handle_vector_[i]->close (1); + } + } +} + +int +ACE_DLL_Manager::open (int size) +{ + ACE_TRACE ("ACE_DLL_Manager::open"); + + ACE_DLL_Handle **temp = 0; + + ACE_NEW_RETURN (temp, + ACE_DLL_Handle *[size], + -1); + + this->handle_vector_ = temp; + this->total_size_ = size; + return 0; +} + +int +ACE_DLL_Manager::close (void) +{ + ACE_TRACE ("ACE_DLL_Manager::close"); + + int force_close = 1; + + if (this->handle_vector_ != 0) + { + // Delete components in reverse order. + for (int i = this->current_size_ - 1; i >= 0; i--) + { + if (this->handle_vector_[i]) + { + ACE_DLL_Handle *s = + const_cast (this->handle_vector_[i]); + this->handle_vector_[i] = 0; + this->unload_dll (s, force_close); + delete s; + } + } + + delete [] this->handle_vector_; + this->handle_vector_ = 0; + this->current_size_ = 0; + } + return 0; +} + +ACE_DLL_Handle * +ACE_DLL_Manager::find_dll (const ACE_TCHAR *dll_name) const +{ + ACE_TRACE ("ACE_DLL_Manager::find_dll"); + + for (int i = 0; i < this->current_size_; i++) + if (this->handle_vector_[i] && + ACE_OS::strcmp (this->handle_vector_[i]->dll_name (), dll_name) == 0) + { + return this->handle_vector_[i]; + } + + return 0; +} + +int +ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload) +{ + ACE_TRACE ("ACE_DLL_Manager::unload_dll"); + + if (dll_handle) + { + int unload = force_unload; + if (unload == 0) + { + // apply strategy + if (ACE_BIT_DISABLED (this->unload_policy_, + ACE_DLL_UNLOAD_POLICY_PER_DLL)) + { + unload = ACE_BIT_DISABLED (this->unload_policy_, + ACE_DLL_UNLOAD_POLICY_LAZY); + } + else + { + // Declare the type of the symbol: + typedef int (*dll_unload_policy)(void); + + void * const unload_policy_ptr = + dll_handle->symbol (ACE_TEXT ("_get_dll_unload_policy"), 1); +#if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64)) + int const temp_p = + reinterpret_cast (unload_policy_ptr); +#else + intptr_t const temp_p = + reinterpret_cast (unload_policy_ptr); +#endif + + dll_unload_policy const the_policy = + reinterpret_cast (temp_p); + + if (the_policy != 0) + unload = ACE_BIT_DISABLED (the_policy (), + ACE_DLL_UNLOAD_POLICY_LAZY); + else + unload = ACE_BIT_DISABLED (this->unload_policy_, + ACE_DLL_UNLOAD_POLICY_LAZY); + } + } + + if (dll_handle->close (unload) != 0) + { + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL_Manager::unload error.\n"))); + + return -1; + } + } + else + { + if (ACE::debug ()) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_DLL_Manager::unload_dll called with ") + ACE_TEXT ("null pointer.\n"))); + + return -1; + } + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/DLL_Manager.h b/externals/ace/DLL_Manager.h new file mode 100644 index 0000000..63b9ee0 --- /dev/null +++ b/externals/ace/DLL_Manager.h @@ -0,0 +1,269 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DLL_Manager.h + * + * $Id: DLL_Manager.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + */ +//============================================================================= + +#ifndef ACE_DLL_MANAGER_H +#define ACE_DLL_MANAGER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Auto_Ptr.h" +#include "ace/Containers_T.h" +#include "ace/SStringfwd.h" +#include "ace/os_include/os_dlfcn.h" + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +# include "ace/Thread_Mutex.h" +#endif /* ACE_MT_SAFE */ + +#define ACE_DEFAULT_DLL_MANAGER_SIZE 1024 + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_DLL_Handle + * + * @brief Provides an abstract interface for handling various DLL + * operations. + * + * This class is an wrapper over the various methods for utilizing a + * dynamically linked library (DLL), which is called a shared library + * on some platforms. It is refcounted and managed by + * ACE_DLL_Manager, so there will only be a single instance of this + * class for each dll loaded, no matter how many instances of ACE_DLL + * an application has open. Operations , , and + * have been implemented to help opening/closing and extracting symbol + * information from a DLL, respectively. + * + * Most of this class came from the original ACE_DLL class. ACE_DLL + * is now just an interface that passed all it's calls either directly + * or via ACE_DLL_Manager to this class for execution. + * + */ +class ACE_Export ACE_DLL_Handle +{ +public: + + /// Default construtor. + ACE_DLL_Handle (void); + + /// Destructor. + ~ACE_DLL_Handle (void); + + /// Returns the name of the shared library (without prefixes or suffixes). + const ACE_TCHAR *dll_name () const; + + /** + * This method opens and dynamically links @a dll_name. The default + * mode is , which loads identifier symbols but not the + * symbols for functions, which are loaded dynamically on-demand. + * Other supported modes include: , which performs all + * necessary relocations when @a dll_name is first loaded and + * , which makes symbols available for relocation + * processing of any other DLLs. Returns -1 on failure and 0 on + * success. + */ + int open (const ACE_TCHAR *dll_name, + int open_mode, + ACE_SHLIB_HANDLE handle); + + /// Call to close the DLL object. If unload = 0, it only decrements + /// the refcount, but if unload = 1, then it will actually unload + /// the library when the refcount == 0; + int close (int unload = 0); + + /// Return the current refcount. + sig_atomic_t refcount (void) const; + + /// If @a symbol_name is in the symbol table of the DLL a pointer to + /// the @a symbol_name is returned. Otherwise, returns 0. Set the + /// ignore_errors flag to supress logging errors if symbol_name isn't + /// found. This is nice if you just want to probe a dll to see what's + /// available, since missing functions in that case aren't really errors. + void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); + + /** + * Return the handle to the caller. If @a become_owner is non-0 then + * caller assumes ownership of the handle so we decrement the retcount. + */ + ACE_SHLIB_HANDLE get_handle (int become_owner = 0); + +private: + + /// Returns a pointer to a string explaining why or + /// failed. This is used internal to print out the error to the log, + /// but since this object is shared, we can't store or return the error + /// to the caller. + auto_ptr error (void); + + // Builds array of DLL names to try to dlopen, based on platform + // and configured DLL prefixes/suffixes. + // Returns the array of names to try in try_names. + void get_dll_names (const ACE_TCHAR *dll_name, + ACE_Array &try_names); + + // Disallow copying and assignment since we don't handle them. + ACE_DLL_Handle (const ACE_DLL_Handle &); + void operator= (const ACE_DLL_Handle &); + +private: + + // Keep track of how many ACE_DLL objects have a reference to this + // dll. + sig_atomic_t refcount_; + + /// Name of the shared library. + ACE_TCHAR *dll_name_; + + /// Handle to the actual library loaded by the OS. + ACE_SHLIB_HANDLE handle_; + + /// Keeps track of whether or not open() has ever been called. This + /// helps get around problem on Linux, and perhaps other OS's, that + /// seg-fault if dlerror() is called before the ld library has been + /// initialized by a call to dlopen(). + static sig_atomic_t open_called_; + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// Synchronization variable for the MT_SAFE Repository + ACE_Thread_Mutex lock_; +#endif /* ACE_MT_SAFE */ +}; + +class ACE_Framework_Repository; + +/** + * @class ACE_DLL_Manager + * + * @brief This class is a singleton and serves as a factory and + * repository for instances of ACE_DLL_Handle. + * + * This class is a singleton whose lifetime is managed by the + * ACE_Framework_Repository. Although it is normally meant to be + * used directly only by ACE_DLL, applications can call the unload_policy() + * methods in order get/set the the dll unload policy. Unload policies include + * per_process/per-dll and eager/lazy. Dlls can export set their own policy + * by using the ACE_DLL_UNLOAD_POLICY macro found in config-all.h. If a dll + * choses to set an unload policy, it will be used when the per-dll policy + * (the default) is in effect. If the per-dll policy is in effect and a dll + * has not chosen to set a policy, the current per-process policy will be + * used. + * + * The following policy macros are provided in config-all.h: + * + * ACE_DLL_UNLOAD_POLICY_PER_PROCESS - Per-process policy that unloads dlls + * eagerly. + * + * ACE_DLL_UNLOAD_POLICY_PER_DLL - Apply policy on a per-dll basis. If the + * dll doesn't use one of the macros below, the current per-process policy + * will be used. + * + * ACE_DLL_UNLOAD_POLICY_LAZY - Don't unload dll when refcount reaches + * zero, i.e., wait for either an explicit unload request or program exit. + * + * ACE_DLL_UNLOAD_POLICY_DEFAULT - Default policy allows dlls to control + * their own destinies, but will unload those that don't make a choice eagerly. + * + */ +class ACE_Export ACE_DLL_Manager +{ +public: + friend class ACE_Framework_Repository; + friend class ACE_Object_Manager; + + enum + { + DEFAULT_SIZE = ACE_DEFAULT_DLL_MANAGER_SIZE + }; + + /// Return a unique instance + static ACE_DLL_Manager *instance (int size = ACE_DLL_Manager::DEFAULT_SIZE); + + /// Factory for ACE_DLL_Handle objects. If one already exits, + /// its refcount is incremented. + ACE_DLL_Handle *open_dll (const ACE_TCHAR *dll_name, + int openmode, + ACE_SHLIB_HANDLE handle); + + /// Close the underlying dll. Decrements the refcount. + int close_dll (const ACE_TCHAR *dll_name); + + /// Returns the current per-process UNLOAD_POLICY. + u_long unload_policy (void) const; + + /// Set the per-process UNLOAD_POLICY. If the policy is changed from + /// LAZY to EAGER, then it will also unload any dlls with zero + /// refcounts. + void unload_policy (u_long unload_policy); + +protected: + + /// Default constructor. + ACE_DLL_Manager (int size = ACE_DLL_Manager::DEFAULT_SIZE); + + /// Destructor. + ~ACE_DLL_Manager (void); + + // Allocate handle_vector_. + int open (int size); + + // Close all open dlls and deallocate memory. + int close (void); + + // Find dll in handle_vector_. + ACE_DLL_Handle *find_dll (const ACE_TCHAR *dll_name) const; + + // Applies strategy for unloading dll. + int unload_dll (ACE_DLL_Handle *dll_handle, int force_unload = 0); + +private: + + /// Close the singleton instance. + static void close_singleton (void); + + // Disallow copying and assignment since we don't handle these. + ACE_DLL_Manager (const ACE_DLL_Manager &); + void operator= (const ACE_DLL_Manager &); + +private: + + /// Vector containing all loaded handle objects. + ACE_DLL_Handle **handle_vector_; + + /// Current number of handles. + int current_size_; + + /// Maximum number of handles. + int total_size_; + + /// Unload strategy. + u_long unload_policy_; + + /// Pointer to a process-wide ACE_DLL_Manager. + static ACE_DLL_Manager *instance_; + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// Synchronization variable for the MT_SAFE Repository + ACE_Thread_Mutex lock_; +#endif /* ACE_MT_SAFE */ + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_DLL_MANAGER_H */ diff --git a/externals/ace/Date_Time.cpp b/externals/ace/Date_Time.cpp new file mode 100644 index 0000000..eff0f27 --- /dev/null +++ b/externals/ace/Date_Time.cpp @@ -0,0 +1,10 @@ +// Date_Time.cpp +// $Id: Date_Time.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Date_Time.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Date_Time.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Date_Time, "$Id: Date_Time.cpp 80826 2008-03-04 14:51:23Z wotte $") diff --git a/externals/ace/Date_Time.h b/externals/ace/Date_Time.h new file mode 100644 index 0000000..a15d435 --- /dev/null +++ b/externals/ace/Date_Time.h @@ -0,0 +1,125 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Date_Time.h + * + * $Id: Date_Time.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Tim Harrison (harrison@cs.wustl.edu) (and he's darn proud of this ;-)) + * + */ +//========================================================================== + +#ifndef ACE_DATE_TIME_H +#define ACE_DATE_TIME_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +/** + * @class ACE_Date_Time + * + * @brief System independent representation of date and time. + */ +class ACE_Export ACE_Date_Time +{ +public: + /// Constructor initializes current time/date info. + ACE_Date_Time (void); + + /// Constructor initializes with the given ACE_Time_Value + explicit ACE_Date_Time (const ACE_Time_Value& timevalue); + + /// Constructor with init values, no check for validy + /// Set/get portions of ACE_Date_Time, no check for validity. + ACE_Date_Time (long day, + long month = 0, + long year = 0, + long hour = 0, + long minute = 0, + long second = 0, + long microsec = 0, + long wday = 0); + + /// Update to the current time/date. + void update (void); + + /// Update to the given ACE_Time_Value + void update (const ACE_Time_Value& timevalue); + + /// Get day. + long day (void) const; + + /// Set day. + void day (long day); + + /// Get month. + long month (void) const; + + /// Set month. + void month (long month); + + /// Get year. + long year (void) const; + + /// Set year. + void year (long year); + + /// Get hour. + long hour (void) const; + + /// Set hour. + void hour (long hour); + + /// Get minute. + long minute (void) const; + + /// Set minute. + void minute (long minute); + + /// Get second. + long second (void) const; + + /// Set second. + void second (long second); + + /// Get microsec. + long microsec (void) const; + + /// Set microsec. + void microsec (long microsec); + + /// Get weekday. + long weekday (void) const; + + /// Set weekday. + void weekday (long wday); + +private: + long day_; + long month_; + long year_; + long hour_; + long minute_; + long second_; + long microsec_; + long wday_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Date_Time.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_DATE_TIME_H */ diff --git a/externals/ace/Date_Time.inl b/externals/ace/Date_Time.inl new file mode 100644 index 0000000..d34807d --- /dev/null +++ b/externals/ace/Date_Time.inl @@ -0,0 +1,219 @@ +// -*- C++ -*- +// +// $Id: Date_Time.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Global_Macros.h" +#include "ace/Time_Value.h" +#include "ace/OS_NS_sys_time.h" +#include "ace/OS_NS_time.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void +ACE_Date_Time::update (const ACE_Time_Value& timevalue) +{ +#if defined (ACE_HAS_WINCE) + // CE doesn't do localtime(). + FILETIME file_time = timevalue; + FILETIME local_file_time; + SYSTEMTIME sys_time; + ::FileTimeToLocalFileTime (&file_time, &local_file_time); + ::FileTimeToSystemTime (&local_file_time, &sys_time); + this->day_ = sys_time.wDay; + this->month_ = sys_time.wMonth; + this->year_ = sys_time.wYear; + this->hour_ = sys_time.wHour; + this->minute_ = sys_time.wMinute; + this->second_ = sys_time.wSecond; + this->microsec_ = sys_time.wMilliseconds * 1000; + this->wday_ = sys_time.wDayOfWeek; +#else + time_t time = timevalue.sec (); + struct tm tm_time; + ACE_OS::localtime_r (&time, &tm_time); + this->day_ = tm_time.tm_mday; + this->month_ = tm_time.tm_mon + 1; // localtime's months are 0-11 + this->year_ = tm_time.tm_year + 1900; // localtime reports years since 1900 + this->hour_ = tm_time.tm_hour; + this->minute_ = tm_time.tm_min; + this->second_ = tm_time.tm_sec; + this->microsec_ = timevalue.usec (); + this->wday_ = tm_time.tm_wday; +#endif /* ACE_HAS_WINCE */ +} + +ACE_INLINE void +ACE_Date_Time::update (void) +{ + ACE_TRACE ("ACE_Date_Time::update"); + + update(ACE_OS::gettimeofday ()); +} + +ACE_INLINE +ACE_Date_Time::ACE_Date_Time (void) +{ + ACE_TRACE ("ACE_Date_Time::ACE_Date_Time"); + this->update (); +} + +ACE_INLINE +ACE_Date_Time::ACE_Date_Time (const ACE_Time_Value& timevalue) +{ + ACE_TRACE ("ACE_Date_Time::ACE_Date_Time: timevalue"); + this->update (timevalue); +} + +// Constructor with init values, no check for validy +ACE_INLINE +ACE_Date_Time::ACE_Date_Time (long day, + long month, + long year, + long hour, + long minute, + long second, + long microsec, + long wday) + : day_ (day), + month_ (month), + year_ (year), + hour_ (hour), + minute_ (minute), + second_ (second), + microsec_ (microsec), + wday_ (wday) +{ + ACE_TRACE ("ACE_Date_Time::ACE_Date_Time"); +} + +// set/get portions of ACE_Date_Time, no check for validy + +// get day +ACE_INLINE long +ACE_Date_Time::day (void) const +{ + ACE_TRACE ("ACE_Date_Time::day"); + return day_; +} + +// set day +ACE_INLINE void +ACE_Date_Time::day (long day) +{ + ACE_TRACE ("ACE_Date_Time::day"); + day_ = day; +} + +// get month +ACE_INLINE long +ACE_Date_Time::month (void) const +{ + ACE_TRACE ("ACE_Date_Time::month"); + return month_; +} + +// set month +ACE_INLINE void +ACE_Date_Time::month (long month) +{ + ACE_TRACE ("ACE_Date_Time::month"); + month_ = month; +} + +// get year +ACE_INLINE long +ACE_Date_Time::year (void) const +{ + ACE_TRACE ("ACE_Date_Time::year"); + return year_; +} + +// set year +ACE_INLINE void +ACE_Date_Time::year (long year) +{ + ACE_TRACE ("ACE_Date_Time::year"); + year_ = year; +} + +// get hour +ACE_INLINE long +ACE_Date_Time::hour (void) const +{ + ACE_TRACE ("ACE_Date_Time::hour"); + return hour_; +} + +// set hour +ACE_INLINE void +ACE_Date_Time::hour (long hour) +{ + ACE_TRACE ("ACE_Date_Time::hour"); + hour_ = hour; +} + +// get minute +ACE_INLINE long +ACE_Date_Time::minute (void) const +{ + ACE_TRACE ("ACE_Date_Time::minute"); + return minute_; +} + +// set minute +ACE_INLINE void +ACE_Date_Time::minute (long minute) +{ + ACE_TRACE ("ACE_Date_Time::minute"); + minute_ = minute; +} + +// get second +ACE_INLINE long +ACE_Date_Time::second (void) const +{ + ACE_TRACE ("ACE_Date_Time::second"); + return second_; +} + +// set second +ACE_INLINE void +ACE_Date_Time::second (long second) +{ + ACE_TRACE ("ACE_Date_Time::second"); + second_ = second; +} + +// get microsec +ACE_INLINE long +ACE_Date_Time::microsec (void) const +{ + ACE_TRACE ("ACE_Date_Time::microsec"); + return microsec_; +} + +// set microsec +ACE_INLINE void +ACE_Date_Time::microsec (long microsec) +{ + ACE_TRACE ("ACE_Date_Time::microsec"); + microsec_ = microsec; +} + +// get wday +ACE_INLINE long +ACE_Date_Time::weekday (void) const +{ + ACE_TRACE ("ACE_Date_Time::weekday"); + return wday_; +} + +// set wday +ACE_INLINE void +ACE_Date_Time::weekday (long wday) +{ + ACE_TRACE ("ACE_Date_Time::weekday"); + wday_ = wday; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Default_Constants.h b/externals/ace/Default_Constants.h new file mode 100644 index 0000000..1c0743b --- /dev/null +++ b/externals/ace/Default_Constants.h @@ -0,0 +1,605 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Default_Constants.h + * + * $Id: Default_Constants.h 87487 2009-11-12 07:54:39Z johnnyw $ + * + * @author Douglas C. Schmidt + * @author Jesper S. M|ller + * @author and a cast of thousands... + * + * This one is split from the famous OS.h + */ +//============================================================================= + +#ifndef ACE_DEFAULT_CONSTANTS_H +#define ACE_DEFAULT_CONSTANTS_H +#include /**/ "ace/pre.h" + +// Included just keep compilers that see #pragma directive first +// happy. +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// For _POSIX_TIMER_MAX +#include "ace/os_include/os_limits.h" + +// Define the default constants for ACE. Many of these are used for +// the ACE tests and applications. You can change these values by +// defining the macros in your config.h file. +# if !defined (ACE_DEFAULT_CLOSE_ALL_HANDLES) +# define ACE_DEFAULT_CLOSE_ALL_HANDLES true +# endif /* ACE_DEFAULT_CLOSE_ALL_HANDLES */ + +// The maximum length for a fully qualified Internet name. +# if !defined(ACE_MAX_FULLY_QUALIFIED_NAME_LEN) +# define ACE_MAX_FULLY_QUALIFIED_NAME_LEN 256 +# endif /* ACE_MAX_FULLY_QUALIFIED_NAME_LEN */ + +#if !defined (ACE_DEFAULT_PAGEFILE_POOL_BASE) +#define ACE_DEFAULT_PAGEFILE_POOL_BASE (void *) 0 +#endif /* ACE_DEFAULT_PAGEFILE_POOL_BASE */ + +#if !defined (ACE_DEFAULT_PAGEFILE_POOL_SIZE) +#define ACE_DEFAULT_PAGEFILE_POOL_SIZE (size_t) 0x01000000 +#endif /* ACE_DEFAULT_PAGEFILE_POOL_SIZE */ + +#if !defined (ACE_DEFAULT_PAGEFILE_POOL_CHUNK) +#define ACE_DEFAULT_PAGEFILE_POOL_CHUNK (size_t) 0x00010000 +#endif /* ACE_DEFAULT_PAGEFILE_POOL_CHUNK */ + +#if !defined (ACE_DEFAULT_PAGEFILE_POOL_NAME) +#define ACE_DEFAULT_PAGEFILE_POOL_NAME ACE_TEXT ("Default_ACE_Pagefile_Memory_Pool") +#endif /* ACE_DEFAULT_PAGEFILE_POOL_NAME */ + +#if !defined (ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY) +#define ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY 0 +#endif /* ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY */ + +#if !defined (ACE_DEFAULT_SERVICE_REPOSITORY_SIZE) +#define ACE_DEFAULT_SERVICE_REPOSITORY_SIZE 1024 +#endif /* ACE_DEFAULT_SERVICE_REPOSITORY_SIZE */ + +#if !defined (ACE_DEFAULT_SERVICE_GESTALT_SIZE) +#define ACE_DEFAULT_SERVICE_GESTALT_SIZE 1024 +#endif /* ACE_DEFAULT_SERVICE_GESTALT_SIZE */ + +#if !defined (ACE_REACTOR_NOTIFICATION_ARRAY_SIZE) +#define ACE_REACTOR_NOTIFICATION_ARRAY_SIZE 1024 +#endif /* ACE_REACTOR_NOTIFICATION_ARRAY_SIZE */ + +# if !defined (ACE_DEFAULT_TIMEOUT) +# define ACE_DEFAULT_TIMEOUT 5 +# endif /* ACE_DEFAULT_TIMEOUT */ + +# if !defined (ACE_DEFAULT_BACKLOG) +# define ACE_DEFAULT_BACKLOG 5 +# endif /* ACE_DEFAULT_BACKLOG */ + +# if !defined (ACE_DEFAULT_ASYNCH_BACKLOG) +# define ACE_DEFAULT_ASYNCH_BACKLOG 5 +# endif /* ACE_DEFAULT_ASYNCH_BACKLOG */ + +# if !defined (ACE_DEFAULT_THREADS) +# define ACE_DEFAULT_THREADS 1 +# endif /* ACE_DEFAULT_THREADS */ + +// The following 3 defines are used in the IP multicast and broadcast tests. +# if !defined (ACE_DEFAULT_BROADCAST_PORT) +# define ACE_DEFAULT_BROADCAST_PORT 20000 +# endif /* ACE_DEFAULT_BROADCAST_PORT */ + +# if !defined (ACE_DEFAULT_MULTICAST_PORT) +# define ACE_DEFAULT_MULTICAST_PORT 20001 +# endif /* ACE_DEFAULT_MULTICAST_PORT */ + +# if !defined (ACE_DEFAULT_MULTICAST_ADDR) +// This address MUST be within the range for host group addresses: +// 224.0.0.0 to 239.255.255.255. +# define ACE_DEFAULT_MULTICAST_ADDR "224.9.9.2" +# endif /* ACE_DEFAULT_MULTICAST_ADDR */ + +# if defined (ACE_HAS_IPV6) +# if !defined (ACE_DEFAULT_MULTICASTV6_ADDR) +// This address should be within the range for site-local addresses: +// ff05::0/16 . +# define ACE_DEFAULT_MULTICASTV6_ADDR "ff05:0::ff01:1" +# endif /* ACE_DEFAULT_MULTICASTV6_ADDR */ +# endif + +// Default port number for HTTP. +# if !defined (ACE_DEFAULT_HTTP_SERVER_PORT) +# define ACE_DEFAULT_HTTP_SERVER_PORT 80 +# endif /* ACE_DEFAULT_HTTP_SERVER_PORT */ + +// Used in many IPC_SAP tests +# if !defined (ACE_DEFAULT_SERVER_PORT) +# define ACE_DEFAULT_SERVER_PORT 20002 +# endif /* ACE_DEFAULT_SERVER_PORT */ + +# if !defined (ACE_DEFAULT_HTTP_PORT) +# define ACE_DEFAULT_HTTP_PORT 80 +# endif /* ACE_DEFAULT_HTTP_PORT */ + +# if !defined (ACE_DEFAULT_MAX_SOCKET_BUFSIZ) +# define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65536 +# endif /* ACE_DEFAULT_MAX_SOCKET_BUFSIZ */ + +# if !defined (ACE_DEFAULT_SERVER_PORT_STR) +# define ACE_DEFAULT_SERVER_PORT_STR ACE_TEXT("20002") +# endif /* ACE_DEFAULT_SERVER_PORT_STR */ + +// Used for the Service_Directory test +# if !defined (ACE_DEFAULT_SERVICE_PORT) +# define ACE_DEFAULT_SERVICE_PORT 20003 +# endif /* ACE_DEFAULT_SERVICE_PORT */ + +// Used for the ACE_Thread_Spawn test +# if !defined (ACE_DEFAULT_THR_PORT ) +# define ACE_DEFAULT_THR_PORT 20004 +# endif /* ACE_DEFAULT_THR_PORT */ + +// Used for tests +# if !defined (ACE_DEFAULT_LOCAL_PORT) +# define ACE_DEFAULT_LOCAL_PORT 20005 +# endif /* ACE_DEFAULT_LOCAL_PORT */ + +// Used for Connector tests +# if !defined (ACE_DEFAULT_LOCAL_PORT_STR) +# define ACE_DEFAULT_LOCAL_PORT_STR "20005" +# endif /* ACE_DEFAULT_LOCAL_PORT_STR */ + +// Used for the name server. +# if !defined (ACE_DEFAULT_NAME_SERVER_PORT) +# define ACE_DEFAULT_NAME_SERVER_PORT 20006 +# endif /* ACE_DEFAULT_NAME_SERVER_PORT */ + +# if !defined (ACE_DEFAULT_NAME_SERVER_PORT_STR) +# define ACE_DEFAULT_NAME_SERVER_PORT_STR "20006" +# endif /* ACE_DEFAULT_NAME_SERVER_PORT_STR */ + +// Used for the token server. +# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT) +# define ACE_DEFAULT_TOKEN_SERVER_PORT 20007 +# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT */ + +# if !defined (ACE_DEFAULT_TOKEN_SERVER_PORT_STR) +# define ACE_DEFAULT_TOKEN_SERVER_PORT_STR "20007" +# endif /* ACE_DEFAULT_TOKEN_SERVER_PORT_STR */ + +// Used for the logging server. +# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT) +# define ACE_DEFAULT_LOGGING_SERVER_PORT 20008 +# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT */ + +# if !defined (ACE_DEFAULT_LOGGING_SERVER_PORT_STR) +# define ACE_DEFAULT_LOGGING_SERVER_PORT_STR "20008" +# endif /* ACE_DEFAULT_LOGGING_SERVER_PORT_STR */ + +// Used for the logging server. +# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT) +# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT 20008 +# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT */ + +# if !defined (ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR) +# define ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR "20008" +# endif /* ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR */ + +// Used for the time server. +# if !defined (ACE_DEFAULT_TIME_SERVER_PORT) +# define ACE_DEFAULT_TIME_SERVER_PORT 20009 +# endif /* ACE_DEFAULT_TIME_SERVER_PORT */ + +# if !defined (ACE_DEFAULT_TIME_SERVER_PORT_STR) +# define ACE_DEFAULT_TIME_SERVER_PORT_STR "20009" +# endif /* ACE_DEFAULT_TIME_SERVER_PORT_STR */ + +# if !defined (ACE_DEFAULT_TIME_SERVER_STR) +# define ACE_DEFAULT_TIME_SERVER_STR "ACE_TS_TIME" +# endif /* ACE_DEFAULT_TIME_SERVER_STR */ + +// Used by the FIFO tests +# if !defined (ACE_DEFAULT_RENDEZVOUS) +# if defined (ACE_HAS_STREAM_PIPES) +# define ACE_DEFAULT_RENDEZVOUS ACE_TEXT("/tmp/fifo.ace") +# else +# define ACE_DEFAULT_RENDEZVOUS ACE_TEXT("localhost:20010") +# endif /* ACE_HAS_STREAM_PIPES */ +# endif /* ACE_DEFAULT_RENDEZVOUS */ + +// Used for the UNIX syslog logging interface to ACE_Log_Msg. +# ifndef ACE_DEFAULT_SYSLOG_FACILITY +# define ACE_DEFAULT_SYSLOG_FACILITY LOG_USER +# endif /* ACE_DEFAULT_SYSLOG_FACILITY */ + +# if !defined (ACE_HAS_STREAM_LOG_MSG_IPC) +# if defined (ACE_HAS_STREAM_PIPES) +# define ACE_HAS_STREAM_LOG_MSG_IPC 1 +# else +# define ACE_HAS_STREAM_LOG_MSG_IPC 0 +# endif /* ACE_HAS_STREAM_PIPES */ +# endif /* !ACE_HAS_STREAM_LOG_MSG_IPC */ + +# if !defined (ACE_DEFAULT_LOGGER_KEY) +# if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) +# define ACE_DEFAULT_LOGGER_KEY ACE_TEXT ("/tmp/server_daemon") +# else +# define ACE_DEFAULT_LOGGER_KEY ACE_TEXT ("localhost:20012") +# endif /* ACE_HAS_STREAM_LOG_MSG_IPC==1 */ +# endif /* ACE_DEFAULT_LOGGER_KEY */ + +// The way to specify the local host for loopback IP. This is usually +// "localhost" but it may need changing on some platforms. +# if !defined (ACE_LOCALHOST) +# define ACE_LOCALHOST ACE_TEXT ("localhost") +# endif + +// This specification for an IPv6 localhost should work on all platforms +// supporting IPv6 +# if defined (ACE_HAS_IPV6) +# if !defined (ACE_IPV6_LOCALHOST) +# define ACE_IPV6_LOCALHOST ACE_TEXT ("::1") +# endif /* ACE_IPV6_LOCALHOST*/ +#endif /* ACE_HAS_IPV6 */ + +// This specification for an IPv6 ANY address should work on all platforms +// supporting IPv6 +# if defined (ACE_HAS_IPV6) +# if !defined (ACE_IPV6_ANY) +# define ACE_IPV6_ANY ACE_TEXT ("::") +# endif /* ACE_IPV6_ANY*/ +#endif /* ACE_HAS_IPV6 */ + +# if !defined (ACE_DEFAULT_SERVER_HOST) +# if defined (ACE_HAS_IPV6) +# define ACE_DEFAULT_SERVER_HOST ACE_IPV6_LOCALHOST +# else /*ACE_HAS_IPV6*/ +# define ACE_DEFAULT_SERVER_HOST ACE_LOCALHOST +# endif /*ACE_HAS_IPV6*/ +# endif /* ACE_DEFAULT_SERVER_HOST */ + +// Default shared memory key +# if !defined (ACE_DEFAULT_SHM_KEY) +# define ACE_DEFAULT_SHM_KEY 1234 +# endif /* ACE_DEFAULT_SHM_KEY */ + +// Default address for shared memory mapped files and SYSV shared memory +// (defaults to 64 M). +# if !defined (ACE_DEFAULT_BASE_ADDR) +# define ACE_DEFAULT_BASE_ADDR ((char *) (64 * 1024 * 1024)) +# endif /* ACE_DEFAULT_BASE_ADDR */ + +// Default segment size used by SYSV shared memory (128 K) +# if !defined (ACE_DEFAULT_SEGMENT_SIZE) +# define ACE_DEFAULT_SEGMENT_SIZE 1024 * 128 +# endif /* ACE_DEFAULT_SEGMENT_SIZE */ + +// Maximum number of SYSV shared memory segments +// (does anyone know how to figure out the right values?!) +# if !defined (ACE_DEFAULT_MAX_SEGMENTS) +# define ACE_DEFAULT_MAX_SEGMENTS 6 +# endif /* ACE_DEFAULT_MAX_SEGMENTS */ + +// Name of the map that's stored in shared memory. +# if !defined (ACE_NAME_SERVER_MAP) +# define ACE_NAME_SERVER_MAP "Name Server Map" +# endif /* ACE_NAME_SERVER_MAP */ + +// Default file permissions. +# if !defined (ACE_DEFAULT_FILE_PERMS) +# if defined (ACE_VXWORKS) +# define ACE_DEFAULT_FILE_PERMS (S_IRUSR | S_IWUSR| S_IRGRP| S_IROTH) +# else +# define ACE_DEFAULT_FILE_PERMS 0644 +# endif /* ACE_VXWORKS */ +# endif /* ACE_DEFAULT_FILE_PERMS */ + +// Default directory permissions. +# if !defined (ACE_DEFAULT_DIR_PERMS) +# define ACE_DEFAULT_DIR_PERMS 0755 +# endif /* ACE_DEFAULT_DIR_PERMS */ + +# if !defined (ACE_DEFAULT_TIMEPROBE_TABLE_SIZE) +# define ACE_DEFAULT_TIMEPROBE_TABLE_SIZE 8 * 1024 +# endif /* ACE_DEFAULT_TIMEPROBE_TABLE_SIZE */ + +// Default size of the ACE Map_Manager. +# if !defined (ACE_DEFAULT_MAP_SIZE) +# define ACE_DEFAULT_MAP_SIZE 1024 +# endif /* ACE_DEFAULT_MAP_SIZE */ + +# if defined (ACE_DEFAULT_MAP_SIZE) && (ACE_DEFAULT_MAP_SIZE == 0) +# error ACE_DEFAULT_MAP_SIZE should not be zero +# endif /* ACE_DEFAULT_MAP_SIZE */ + +// Defaults for ACE Timer Wheel +# if !defined (ACE_DEFAULT_TIMER_WHEEL_SIZE) +# define ACE_DEFAULT_TIMER_WHEEL_SIZE 1024 +# endif /* ACE_DEFAULT_TIMER_WHEEL_SIZE */ + +# if !defined (ACE_DEFAULT_TIMER_WHEEL_RESOLUTION) +# define ACE_DEFAULT_TIMER_WHEEL_RESOLUTION 100 +# endif /* ACE_DEFAULT_TIMER_WHEEL_RESOLUTION */ + +// Default size for ACE Timer Hash table +# if !defined (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE) +# define ACE_DEFAULT_TIMER_HASH_TABLE_SIZE 1024 +# endif /* ACE_DEFAULT_TIMER_HASH_TABLE_SIZE */ + +// Defaults for the ACE Free List +# if !defined (ACE_DEFAULT_FREE_LIST_PREALLOC) +# define ACE_DEFAULT_FREE_LIST_PREALLOC 0 +# endif /* ACE_DEFAULT_FREE_LIST_PREALLOC */ + +# if !defined (ACE_DEFAULT_FREE_LIST_LWM) +# define ACE_DEFAULT_FREE_LIST_LWM 0 +# endif /* ACE_DEFAULT_FREE_LIST_LWM */ + +# if !defined (ACE_DEFAULT_FREE_LIST_HWM) +# define ACE_DEFAULT_FREE_LIST_HWM 25000 +# endif /* ACE_DEFAULT_FREE_LIST_HWM */ + +# if !defined (ACE_DEFAULT_FREE_LIST_INC) +# define ACE_DEFAULT_FREE_LIST_INC 100 +# endif /* ACE_DEFAULT_FREE_LIST_INC */ + +# if !defined (ACE_UNIQUE_NAME_LEN) +# define ACE_UNIQUE_NAME_LEN 100 +# endif /* ACE_UNIQUE_NAME_LEN */ + +# if !defined (ACE_MAX_DGRAM_SIZE) + // This is just a guess. 8k is the normal limit on + // most machines because that's what NFS expects. +# define ACE_MAX_DGRAM_SIZE 8192 +# endif /* ACE_MAX_DGRAM_SIZE */ + +# if !defined (ACE_DEFAULT_ARGV_BUFSIZ) +# define ACE_DEFAULT_ARGV_BUFSIZ 1024 * 4 +# endif /* ACE_DEFAULT_ARGV_BUFSIZ */ + +// A free list which create more elements when there aren't enough +// elements. +# define ACE_FREE_LIST_WITH_POOL 1 + +// A simple free list which doen't allocate/deallocate elements. +# define ACE_PURE_FREE_LIST 2 + +# if defined (ACE_WIN32) + +// This is necessary to work around bugs with Win32 non-blocking +// connects... +# if !defined (ACE_NON_BLOCKING_BUG_DELAY) +# define ACE_NON_BLOCKING_BUG_DELAY 35000 +# endif /* ACE_NON_BLOCKING_BUG_DELAY */ +# endif /*ACE_WIN32*/ + +// Max size of an ACE Log Record data buffer. This can be reset in +// the config.h file if you'd like to increase or decrease the size. +# if !defined (ACE_MAXLOGMSGLEN) +# define ACE_MAXLOGMSGLEN 4 * 1024 +# endif /* ACE_MAXLOGMSGLEN */ + +// Max size of an ACE Token. +# define ACE_MAXTOKENNAMELEN 40 + +// Max size of an ACE Token client ID. +# define ACE_MAXCLIENTIDLEN MAXHOSTNAMELEN + 20 + +/// Max udp packet size +#if !defined (ACE_MAX_UDP_PACKET_SIZE) +#define ACE_MAX_UDP_PACKET_SIZE 65536 +#endif + +/** + * @name Default values to control CDR classes memory allocation strategies + */ +//@{ + +/// Control the initial size of all CDR buffers, application +/// developers may want to optimize this value to fit their request +/// size +#if !defined (ACE_DEFAULT_CDR_BUFSIZE) +# define ACE_DEFAULT_CDR_BUFSIZE 512 +#endif /* ACE_DEFAULT_CDR_BUFSIZE */ + +#if (ACE_DEFAULT_CDR_BUFSIZE == 0) +# error: ACE_DEFAULT_CDR_BUFSIZE should be bigger then 0 +#endif + +/// Stop exponential growth of CDR buffers to avoid overallocation +#if !defined (ACE_DEFAULT_CDR_EXP_GROWTH_MAX) +# define ACE_DEFAULT_CDR_EXP_GROWTH_MAX 65536 +#endif /* ACE_DEFAULT_CDR_EXP_GROWTH_MAX */ + +/// Control CDR buffer growth after maximum exponential growth is +/// reached +#if !defined (ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK) +# define ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK 65536 +#endif /* ACE_DEFAULT_CDR_LINEAR_GROWTH_CHUNK */ +//@} + +/// Control the zero-copy optimizations for octet sequences +/** + * Large octet sequences can be sent without any copies by chaining + * them in the list of message blocks that represent a single CDR + * stream. However, if the octet sequence is too small the zero copy + * optimizations actually hurt performance. Octet sequences smaller + * than this value will be copied. + */ +#if !defined (ACE_DEFAULT_CDR_MEMCPY_TRADEOFF) +#define ACE_DEFAULT_CDR_MEMCPY_TRADEOFF 256 +#endif /* ACE_DEFAULT_CDR_MEMCPY_TRADEOFF */ + +#if defined (ACE_WIN32) + // Define the pathname separator characters for Win32 (ugh). +# define ACE_DIRECTORY_SEPARATOR_STR_A "\\" +# define ACE_DIRECTORY_SEPARATOR_CHAR_A '\\' +#else + // Define the pathname separator characters for UNIX. +# define ACE_DIRECTORY_SEPARATOR_STR_A "/" +# define ACE_DIRECTORY_SEPARATOR_CHAR_A '/' +#endif /* ACE_WIN32 */ + +// Define the Wide character and normal versions of some of the string macros +#if defined (ACE_HAS_WCHAR) +# define ACE_DIRECTORY_SEPARATOR_STR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_STR_A) +# define ACE_DIRECTORY_SEPARATOR_CHAR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_CHAR_A) +#endif /* ACE_HAS_WCHAR */ + +#define ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT (ACE_DIRECTORY_SEPARATOR_STR_A) +#define ACE_DIRECTORY_SEPARATOR_CHAR ACE_TEXT (ACE_DIRECTORY_SEPARATOR_CHAR_A) + +#if !defined (ACE_DEFAULT_THREAD_PRIORITY) +# define ACE_DEFAULT_THREAD_PRIORITY (-0x7fffffffL - 1L) +#endif /* ACE_DEFAULT_THREAD_PRIORITY */ + +#if !defined (ACE_DEFAULT_THREAD_STACKSIZE) +# define ACE_DEFAULT_THREAD_STACKSIZE 0 +#endif /* ACE_DEFAULT_THREAD_STACKSIZE */ + +#if !defined (ACE_MAX_DEFAULT_PORT) +# define ACE_MAX_DEFAULT_PORT 65535 +#endif /* ACE_MAX_DEFAULT_PORT */ + +// Default number of ACE_Event_Handlers supported by +// ACE_Timer_Heap. +#if !defined (ACE_DEFAULT_TIMERS) && defined (_POSIX_TIMER_MAX) +# define ACE_DEFAULT_TIMERS _POSIX_TIMER_MAX +#endif /* ACE_DEFAULT_TIMERS */ + +#if !defined (ACE_DEFAULT_TIMERS) || (defined (ACE_DEFAULT_TIMERS) && (ACE_DEFAULT_TIMERS == 0)) +#error ACE_DEFAULT_TIMERS should be defined and not be zero +#endif /* ACE_DEFAULT_TIMERS */ + +#if defined (ACE_WIN32) +# define ACE_PLATFORM_A "Win32" +# define ACE_PLATFORM_EXE_SUFFIX_A ".exe" +#elif defined (ACE_VXWORKS) +# define ACE_PLATFORM_A "VxWorks" +# if defined (__RTP__) +# define ACE_PLATFORM_EXE_SUFFIX_A ".vxe" +# else +# define ACE_PLATFORM_EXE_SUFFIX_A ".out" +# endif +#else /* !ACE_WIN32 && !ACE_VXWORKS */ +# define ACE_PLATFORM_A "UNIX" +# define ACE_PLATFORM_EXE_SUFFIX_A "" +#endif /* ACE_WIN32 */ + +// Define the Wide character and normal versions of some of the string macros +#if defined (ACE_HAS_WCHAR) +# define ACE_PLATFORM_W ACE_TEXT_WIDE(ACE_PLATFORM_A) +# define ACE_PLATFORM_EXE_SUFFIX_W ACE_TEXT_WIDE(ACE_PLATFORM_EXE_SUFFIX_A) +#endif /* ACE_HAS_WCHAR */ + +#define ACE_PLATFORM ACE_TEXT (ACE_PLATFORM_A) +#define ACE_PLATFORM_EXE_SUFFIX ACE_TEXT (ACE_PLATFORM_EXE_SUFFIX_A) + +#if defined (ACE_WIN32) +# define ACE_LD_SEARCH_PATH ACE_TEXT ("PATH") +# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_TEXT (";") +# define ACE_DLL_SUFFIX ACE_TEXT (".dll") +# if !defined (ACE_DLL_PREFIX) +# define ACE_DLL_PREFIX ACE_TEXT ("") +# endif /* !ACE_DLL_PREFIX */ +#else /* !ACE_WIN32 */ +# if !defined (ACE_LD_SEARCH_PATH) +# define ACE_LD_SEARCH_PATH ACE_TEXT ("LD_LIBRARY_PATH") +# endif /* ACE_LD_SEARCH_PATH */ +# if !defined (ACE_LD_SEARCH_PATH_SEPARATOR_STR) +# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_TEXT (":") +# endif /* ACE_LD_SEARCH_PATH_SEPARATOR_STR */ +#endif /* ACE_WIN32 */ + +#if !defined (ACE_DLL_SUFFIX) +# define ACE_DLL_SUFFIX ACE_TEXT (".so") +#endif /* ACE_DLL_SUFFIX */ + +#if !defined (ACE_DLL_PREFIX) +# define ACE_DLL_PREFIX ACE_TEXT ("lib") +#endif /* ACE_DLL_PREFIX */ + +#if defined (ACE_WIN32) +// Used for dynamic linking +# if !defined (ACE_DEFAULT_SVC_CONF) +# if (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF ACE_TEXT (".\\svc.conf") +# else +# define ACE_DEFAULT_SVC_CONF ACE_TEXT (".\\svc.conf.xml") +# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ +# endif /* ACE_DEFAULT_SVC_CONF */ +#endif /* ACE_WIN32 */ + + // Used for dynamic linking. +#if !defined (ACE_DEFAULT_SVC_CONF) +# if (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF ACE_TEXT ("./svc.conf") +# else +# define ACE_DEFAULT_SVC_CONF ACE_TEXT ("./svc.conf.xml") +# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */ +#endif /* ACE_DEFAULT_SVC_CONF */ + +#if !defined (ACE_LOGGER_KEY) +# define ACE_LOGGER_KEY ACE_TEXT ("/tmp/server_daemon") +#endif /* ACE_LOGGER_KEY */ + +// Theses defines are used by the ACE Name Server. +#if !defined (ACE_DEFAULT_LOCALNAME_A) +# define ACE_DEFAULT_LOCALNAME_A "localnames" +#endif /* ACE_DEFAULT_LOCALNAME_A */ +#if !defined (ACE_DEFAULT_GLOBALNAME_A) +# define ACE_DEFAULT_GLOBALNAME_A "globalnames" +#endif /* ACE_DEFAULT_GLOBALNAME_A */ + +// ACE_DEFAULT_NAMESPACE_DIR is for legacy mode apps. A better +// way of doing this is something like ACE_Lib_Find::get_temp_dir, since +// this directory may not exist +#if defined (ACE_LEGACY_MODE) +# if defined (ACE_WIN32) +# define ACE_DEFAULT_NAMESPACE_DIR_A "C:\\temp" +# else /* ACE_WIN32 */ +# define ACE_DEFAULT_NAMESPACE_DIR_A "/tmp" +# endif /* ACE_WIN32 */ +# if defined (ACE_HAS_WCHAR) +# define ACE_DEFAULT_NAMESPACE_DIR_W ACE_TEXT_WIDE(ACE_DEFAULT_NAMESPACE_DIR_A) +# endif /* ACE_HAS_WCHAR */ +# define ACE_DEFAULT_NAMESPACE_DIR ACE_TEXT(ACE_DEFAULT_NAMESPACE_DIR_A) +#endif /* ACE_LEGACY_MODE */ + +#if defined (ACE_HAS_WCHAR) +# define ACE_DEFAULT_LOCALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_LOCALNAME_A) +# define ACE_DEFAULT_GLOBALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_GLOBALNAME_A) +#endif /* ACE_HAS_WCHAR */ + +#define ACE_DEFAULT_LOCALNAME ACE_TEXT (ACE_DEFAULT_LOCALNAME_A) +#define ACE_DEFAULT_GLOBALNAME ACE_TEXT (ACE_DEFAULT_GLOBALNAME_A) + +#if !defined (ACE_DEFAULT_OPEN_PERMS) +# define ACE_DEFAULT_OPEN_PERMS ACE_DEFAULT_FILE_PERMS +#endif /* ACE_DEFAULT_OPEN_PERMS */ + +#if !defined (ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS) +# if defined (ACE_WIN32) +# define ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS ACE_DEFAULT_OPEN_PERMS +# else +# define ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS (S_IRUSR | S_IWUSR) +# endif /* ACE_WIN32 */ +#endif /* ACE_DEFAULT_RW_PROCESS_MUTEX_PERMS */ + +# if defined (ACE_WIN32) + // The "null" device on Win32. +# define ACE_DEV_NULL "nul" +# define ACE_SYSCALL_FAILED 0xFFFFFFFF +# else /* !ACE_WIN32 */ + // The "null" device on UNIX. +# define ACE_DEV_NULL "/dev/null" +# define ACE_SYSCALL_FAILED -1 +# endif /* ACE_WIN32 */ + +#include /**/ "ace/post.h" +#endif /*ACE_DEFAULT_CONSTANTS_H*/ diff --git a/externals/ace/Dev_Poll_Reactor.cpp b/externals/ace/Dev_Poll_Reactor.cpp new file mode 100644 index 0000000..e0adc19 --- /dev/null +++ b/externals/ace/Dev_Poll_Reactor.cpp @@ -0,0 +1,2610 @@ +// $Id: Dev_Poll_Reactor.cpp 90177 2010-05-19 11:44:22Z vzykov $ + +#include "ace/OS_NS_errno.h" +#include "ace/Dev_Poll_Reactor.h" +#include "ace/Signal.h" +#include "ace/Sig_Handler.h" + +ACE_RCSID (ace, + Dev_Poll_Reactor, + "$Id: Dev_Poll_Reactor.cpp 90177 2010-05-19 11:44:22Z vzykov $") + +#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) + +# include "ace/OS_NS_unistd.h" +# include "ace/OS_NS_fcntl.h" +# include "ace/OS_NS_stropts.h" + +# if defined (ACE_HAS_DEV_POLL) +# if defined (linux) +# include /**/ +# elif defined (HPUX_VERS) && HPUX_VERS < 1123 +# include /**/ +# else +# include /**/ +# endif /* linux */ +# endif /* ACE_HAS_DEV_POLL */ + +#if !defined (__ACE_INLINE__) +# include "ace/Dev_Poll_Reactor.inl" +#endif /* __ACE_INLINE__ */ + + +#include "ace/Handle_Set.h" +#include "ace/Reactor.h" +#include "ace/Timer_Heap.h" +#include "ace/Timer_Queue.h" +#include "ace/ACE.h" +#include "ace/Reverse_Lock_T.h" +#include "ace/Recursive_Thread_Mutex.h" +#include "ace/Null_Mutex.h" +#include "ace/os_include/os_poll.h" +#include "ace/OS_NS_sys_mman.h" +#include "ace/Guard_T.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_sys_time.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Dev_Poll_Reactor_Notify::ACE_Dev_Poll_Reactor_Notify (void) + : dp_reactor_ (0) + , notification_pipe_ () + , max_notify_iterations_ (-1) +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + , notification_queue_ () +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ + , dispatching_ (false) +{ +} + +int +ACE_Dev_Poll_Reactor_Notify::open (ACE_Reactor_Impl *r, + ACE_Timer_Queue * /* timer_queue */, + int disable_notify_pipe) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::open"); + + if (disable_notify_pipe == 0) + { + this->dp_reactor_ = dynamic_cast (r); + + if (this->dp_reactor_ == 0) + { + errno = EINVAL; + return -1; + } + + if (this->notification_pipe_.open () == -1) + return -1; + +#if defined (F_SETFD) + // close-on-exec + ACE_OS::fcntl (this->notification_pipe_.read_handle (), F_SETFD, 1); + ACE_OS::fcntl (this->notification_pipe_.write_handle (), F_SETFD, 1); +#endif /* F_SETFD */ + +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + if (notification_queue_.open () == -1) + { + return -1; + } + + if (ACE::set_flags (this->notification_pipe_.write_handle (), + ACE_NONBLOCK) == -1) + return -1; +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ + + // Set the read handle into non-blocking mode since we need to + // perform a "speculative" read when determining if there are + // notifications to dispatch. + if (ACE::set_flags (this->notification_pipe_.read_handle (), + ACE_NONBLOCK) == -1) + return -1; + } + + return 0; +} + +int +ACE_Dev_Poll_Reactor_Notify::close (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::close"); + +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + notification_queue_.reset (); +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ + + return this->notification_pipe_.close (); +} + +int +ACE_Dev_Poll_Reactor_Notify::notify (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify"); + + // Just consider this method a "no-op" if there's no + // ACE_Dev_Poll_Reactor configured. + if (this->dp_reactor_ == 0) + return 0; + + ACE_Notification_Buffer buffer (eh, mask); + +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + ACE_UNUSED_ARG (timeout); + ACE_Dev_Poll_Handler_Guard eh_guard (eh); + + // When using the queue, the push call indicates whether or not a pipe + // write is needed. If it's not, don't waste pipe space. + int push_result = this->notification_queue_.push_new_notification (buffer); + if (-1 == push_result || 1 == push_result) + return -1 == push_result ? -1 : 0; // Also decrement eh's reference count + + // The notification has been queued, so it will be delivered at some + // point (and may have been already); release the refcnt guard. + eh_guard.release (); + + // Now pop the pipe to force the callback for dispatching when ready. If + // the send fails due to a full pipe, don't fail - assume the already-sent + // pipe bytes will cause the entire notification queue to be processed. + // Note that we don't need a timeout since the pipe is already in + // nonblocking mode and all we want is one attempt. + ssize_t n = ACE::send (this->notification_pipe_.write_handle (), + (char *) &buffer, + 1); // Only need one byte to pop the pipe + if (n == -1 && (errno != EAGAIN)) + return -1; + + return 0; +#else + + ACE_Dev_Poll_Handler_Guard eh_guard (eh); + + ssize_t n = ACE::send (this->notification_pipe_.write_handle (), + (char *) &buffer, + sizeof buffer, + timeout); + if (n == -1) + return -1; + + eh_guard.release (); + + return 0; +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ +} + +int +ACE_Dev_Poll_Reactor_Notify::dispatch_notifications ( + int & /* number_of_active_handles */, + ACE_Handle_Set & /* rd_mask */) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notifications"); + + // This method is unimplemented in the ACE_Dev_Poll_Reactor. + // Instead, the notification handler is invoked as part of the IO + // event set. Doing so alters the some documented semantics that + // state that the notifications are handled before IO events. + // Enforcing such semantics does not appear to be beneficial, and + // also serves to slow down event dispatching particularly with this + // ACE_Dev_Poll_Reactor. + + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_Dev_Poll_Reactor_Notify::read_notify_pipe (ACE_HANDLE handle, + ACE_Notification_Buffer &buffer) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::read_notify_pipe"); + + // This is a (non-blocking) "speculative" read, i.e., we attempt to + // read even if no event was polled on the read handle. A + // speculative read is necessary since notifications must be + // dispatched before IO events. We can avoid the speculative read + // by "walking" the array of pollfd structures returned from + // `/dev/poll' or `/dev/epoll' but that is potentially much more + // expensive than simply checking for an EWOULDBLOCK. + size_t to_read; + char *read_p; + +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + // The idea in the queued case is to be sure we never end up with a notify + // queued but no byte in the pipe. If that happens, the notify won't be + // dispatched. So always try to empty the pipe, read the queue, then put + // a byte in if needed. The notify() method is enqueueing then writing the + // pipe, so be sure to do it in the reverse order here to avoid a race + // between removing the last notification from the queue and the notify + // side writing its byte. + char b[1024]; + read_p = b; + to_read = sizeof(b); + (void)ACE::recv (handle, read_p, to_read); + + bool more_messages_queued = false; + ACE_Notification_Buffer next; + int result = notification_queue_.pop_next_notification (buffer, + more_messages_queued, + next); + + if (result <= 0) // Nothing dequeued or error + return result; + + // If there are more messages, ensure there's a byte in the pipe + // in case the notification limit stops dequeuing notifies before + // emptying the queue. + if (more_messages_queued) + (void) ACE::send (this->notification_pipe_.write_handle (), + (char *)&next, + 1); /* one byte is enough */ + return 1; +#else + to_read = sizeof buffer; + read_p = (char *)&buffer; + + ssize_t n = ACE::recv (handle, read_p, to_read); + + if (n > 0) + { + // Check to see if we've got a short read. + if (static_cast (n) != to_read) + { + size_t remainder = to_read - n; + + // If so, try to recover by reading the remainder. If this + // doesn't work we're in big trouble since the input stream + // won't be aligned correctly. I'm not sure quite what to + // do at this point. It's probably best just to return -1. + if (ACE::recv (handle, &read_p[n], remainder) <= 0) + return -1; + } + + return 1; + } + + // Return -1 if things have gone seriously wrong. + if (n <= 0 && (errno != EWOULDBLOCK && errno != EAGAIN)) + return -1; + + return 0; +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ +} + + +int +ACE_Dev_Poll_Reactor_Notify::handle_input (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::handle_input"); + + { + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->dispatching_lock_, -1)); + if (this->dispatching_) + return 0; + this->dispatching_ = true; + } + + int number_dispatched = 0; + int result = 0; + ACE_Notification_Buffer buffer; + + while ((result = this->read_notify_pipe (handle, buffer)) > 0) + { + // Dispatch the buffer + // NOTE: We count only if we made any dispatches ie. upcalls. + if (this->dispatch_notify (buffer) > 0) + ++number_dispatched; + + // Bail out if we've reached the . Note that + // by default is -1, so we'll loop until all + // the available notifications have been dispatched. + if (number_dispatched == this->max_notify_iterations_) + break; + } + + if (result == -1) + { + // Reassign number_dispatched to -1 if things have gone + // seriously wrong. + number_dispatched = -1; + } + + this->dispatching_ = false; + + return number_dispatched; +} + +ACE_HANDLE +ACE_Dev_Poll_Reactor_Notify::notify_handle (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::notify_handle"); + + return this->notification_pipe_.read_handle (); +} + +int +ACE_Dev_Poll_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer &) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::is_dispatchable"); + + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dispatch_notify"); + + // If eh == 0 then another thread is unblocking the + // ACE_Dev_Poll_Reactor to update the ACE_Dev_Poll_Reactor's + // internal structures. Otherwise, we need to dispatch the + // appropriate handle_* method on the ACE_Event_Handler + // pointer we've been passed. + if (buffer.eh_ != 0) + { + int result = 0; + + // Guard the handler's refcount. Recall that when the notify + // was queued, the refcount was incremented, so it need not be + // now. The guard insures that it is decremented properly. + ACE_Dev_Poll_Handler_Guard eh_guard (buffer.eh_, false); + + switch (buffer.mask_) + { + case ACE_Event_Handler::READ_MASK: + case ACE_Event_Handler::ACCEPT_MASK: + result = buffer.eh_->handle_input (ACE_INVALID_HANDLE); + break; + case ACE_Event_Handler::WRITE_MASK: + result = buffer.eh_->handle_output (ACE_INVALID_HANDLE); + break; + case ACE_Event_Handler::EXCEPT_MASK: + result = buffer.eh_->handle_exception (ACE_INVALID_HANDLE); + break; + default: + // Should we bail out if we get an invalid mask? + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("dispatch_notify invalid mask = %d\n"), + buffer.mask_)); + } + if (result == -1) + buffer.eh_->handle_close (ACE_INVALID_HANDLE, buffer.mask_); + } + + return 1; +} + +void +ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (int iterations) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations"); + + // Must always be > 0 or < 0 to optimize the loop exit condition. + if (iterations == 0) + iterations = 1; + + this->max_notify_iterations_ = iterations; +} + +int +ACE_Dev_Poll_Reactor_Notify::max_notify_iterations (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::max_notify_iterations"); + + return this->max_notify_iterations_; +} + +int +ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications ( + ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications"); + +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + + return notification_queue_.purge_pending_notifications (eh, mask); + +#else /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ + ACE_UNUSED_ARG (eh); + ACE_UNUSED_ARG (mask); + ACE_NOTSUP_RETURN (-1); +#endif /* defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) */ +} + +void +ACE_Dev_Poll_Reactor_Notify::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Dev_Poll_Reactor_Notify::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("dp_reactor_ = %@"), + this->dp_reactor_)); + this->notification_pipe_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// ----------------------------------------------------------------- + +ACE_Dev_Poll_Reactor::Handler_Repository::Handler_Repository (void) + : size_ (0), + max_size_ (0), + handlers_ (0) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::Handler_Repository"); +} + +bool +ACE_Dev_Poll_Reactor::Handler_Repository::invalid_handle ( + ACE_HANDLE handle) const +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::invalid_handle"); + + if (handle < 0 || handle >= this->max_size_) + { + errno = EINVAL; + return true; + } + else + return false; +} + +bool +ACE_Dev_Poll_Reactor::Handler_Repository::handle_in_range ( + ACE_HANDLE handle) const +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::handle_in_range"); + + if (handle >= 0 && handle < this->max_size_) + return true; + else + { + errno = EINVAL; + return false; + } +} + +int +ACE_Dev_Poll_Reactor::Handler_Repository::open (size_t size) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::open"); + + this->max_size_ = size; + + // Try to allocate the memory. + ACE_NEW_RETURN (this->handlers_, Event_Tuple[size], -1); + + // Try to increase the number of handles if is greater than + // the current limit. + return ACE::set_handle_limit (size); +} + +int +ACE_Dev_Poll_Reactor::Handler_Repository::unbind_all (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::unbind_all"); + + // Unbind all of the event handlers; similar to remove_handler() on all. + for (int handle = 0; + handle < this->max_size_; + ++handle) + { + Event_Tuple *entry = this->find (handle); + if (entry == 0) + continue; + + // Check for ref counting now - handle_close () may delete eh. + bool const requires_reference_counting = + entry->event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + (void) entry->event_handler->handle_close (handle, entry->mask); + this->unbind (handle, requires_reference_counting); + } + + return 0; +} + +int +ACE_Dev_Poll_Reactor::Handler_Repository::close (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::close"); + + if (this->handlers_ != 0) + { + this->unbind_all (); + + delete [] this->handlers_; + this->handlers_ = 0; + } + + return 0; +} + +ACE_Dev_Poll_Reactor::Event_Tuple * +ACE_Dev_Poll_Reactor::Handler_Repository::find (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::find"); + + Event_Tuple *tuple = 0; + + // Only bother to search for the if it's in range. + if (!this->handle_in_range (handle)) + { + errno = ERANGE; + return 0; + } + + tuple = &(this->handlers_[handle]); + if (tuple->event_handler == 0) + { + errno = ENOENT; + tuple = 0; + } + + return tuple; +} + +int +ACE_Dev_Poll_Reactor::Handler_Repository::bind ( + ACE_HANDLE handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::bind"); + + if (event_handler == 0) + return -1; + + if (handle == ACE_INVALID_HANDLE) + handle = event_handler->get_handle (); + + if (this->invalid_handle (handle)) + return -1; + + this->handlers_[handle].event_handler = event_handler; + this->handlers_[handle].mask = mask; + event_handler->add_reference (); + ++this->size_; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::Handler_Repository::unbind (ACE_HANDLE handle, + bool decr_refcnt) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::unbind"); + + Event_Tuple *entry = this->find (handle); + if (entry == 0) + return -1; + + if (decr_refcnt) + entry->event_handler->remove_reference (); + + entry->event_handler = 0; + entry->mask = ACE_Event_Handler::NULL_MASK; + entry->suspended = false; + entry->controlled = false; + --this->size_; + return 0; +} + +// ----------------------------------------------------------------- + +ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + int disable_notify_pipe, + ACE_Reactor_Notify *notify, + int mask_signals, + int s_queue) + : initialized_ (false) + , poll_fd_ (ACE_INVALID_HANDLE) + // , ready_set_ () +#if defined (ACE_HAS_EVENT_POLL) + , epoll_wait_in_progress_ (false) +#endif /* ACE_HAS_EVENT_POLL */ +#if defined (ACE_HAS_DEV_POLL) + , dp_fds_ (0) + , start_pfds_ (0) + , end_pfds_ (0) +#endif /* ACE_HAS_DEV_POLL */ + , deactivated_ (0) + , token_ (*this, s_queue) + , lock_adapter_ (token_) + , timer_queue_ (0) + , delete_timer_queue_ (false) + , signal_handler_ (0) + , delete_signal_handler_ (false) + , notify_handler_ (0) + , delete_notify_handler_ (false) + , mask_signals_ (mask_signals) + , restart_ (0) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor"); + + if (this->open (ACE::max_handles (), + 0, + sh, + tq, + disable_notify_pipe, + notify) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Dev_Poll_Reactor::open ") + ACE_TEXT ("failed inside ") + ACE_TEXT ("ACE_Dev_Poll_Reactor::CTOR"))); +} + +ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (size_t size, + bool rs, + ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + int disable_notify_pipe, + ACE_Reactor_Notify *notify, + int mask_signals, + int s_queue) + : initialized_ (false) + , poll_fd_ (ACE_INVALID_HANDLE) + // , ready_set_ () +#if defined (ACE_HAS_DEV_POLL) + , dp_fds_ (0) + , start_pfds_ (0) + , end_pfds_ (0) +#endif /* ACE_HAS_DEV_POLL */ + , deactivated_ (0) + , token_ (*this, s_queue) + , lock_adapter_ (token_) + , timer_queue_ (0) + , delete_timer_queue_ (false) + , signal_handler_ (0) + , delete_signal_handler_ (false) + , notify_handler_ (0) + , delete_notify_handler_ (false) + , mask_signals_ (mask_signals) + , restart_ (0) +{ + if (this->open (size, + rs, + sh, + tq, + disable_notify_pipe, + notify) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Dev_Poll_Reactor::open ") + ACE_TEXT ("failed inside ACE_Dev_Poll_Reactor::CTOR"))); +} + +ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor"); + + (void) this->close (); +} + +int +ACE_Dev_Poll_Reactor::open (size_t size, + bool restart, + ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + int disable_notify_pipe, + ACE_Reactor_Notify *notify) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::open"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + // Can't initialize ourselves more than once. + if (this->initialized_) + return -1; + +#ifdef ACE_HAS_EVENT_POLL + ACE_OS::memset (&this->event_, 0, sizeof (this->event_)); + this->event_.data.fd = ACE_INVALID_HANDLE; +#endif /* ACE_HAS_EVENT_POLL */ + + this->restart_ = restart; + this->signal_handler_ = sh; + this->timer_queue_ = tq; + this->notify_handler_ = notify; + + int result = 0; + + // Allows the signal handler to be overridden. + if (this->signal_handler_ == 0) + { + ACE_NEW_RETURN (this->signal_handler_, + ACE_Sig_Handler, + -1); + + if (this->signal_handler_ == 0) + result = -1; + else + this->delete_signal_handler_ = true; + } + + // Allows the timer queue to be overridden. + if (result != -1 && this->timer_queue_ == 0) + { + ACE_NEW_RETURN (this->timer_queue_, + ACE_Timer_Heap, + -1); + + if (this->timer_queue_ == 0) + result = -1; + else + this->delete_timer_queue_ = true; + } + + // Allows the Notify_Handler to be overridden. + if (result != -1 && this->notify_handler_ == 0) + { + ACE_NEW_RETURN (this->notify_handler_, + ACE_Dev_Poll_Reactor_Notify, + -1); + + if (this->notify_handler_ == 0) + result = -1; + else + this->delete_notify_handler_ = true; + } + +#if defined (ACE_HAS_EVENT_POLL) + + // Initialize epoll: + this->poll_fd_ = ::epoll_create (size); + if (this->poll_fd_ == -1) + result = -1; + +#else + + // Allocate the array before opening the device to avoid a potential + // resource leak if allocation fails. + ACE_NEW_RETURN (this->dp_fds_, + pollfd[size], + -1); + + // Open the `/dev/poll' character device. + this->poll_fd_ = ACE_OS::open ("/dev/poll", O_RDWR); + if (this->poll_fd_ == ACE_INVALID_HANDLE) + result = -1; + +#endif /* ACE_HAS_EVENT_POLL */ + + if (result != -1 && this->handler_rep_.open (size) == -1) + result = -1; + + // Registration of the notification handler must be done after the + // /dev/poll device has been fully initialized. + else if (this->notify_handler_->open (this, + 0, + disable_notify_pipe) == -1 + || (disable_notify_pipe == 0 + && this->register_handler_i ( + this->notify_handler_->notify_handle (), + this->notify_handler_, + ACE_Event_Handler::READ_MASK) == -1)) + result = -1; + + if (result != -1) + // We're all set to go. + this->initialized_ = true; + else + // This will close down all the allocated resources properly. + (void) this->close (); + + return result; +} + +int +ACE_Dev_Poll_Reactor::current_info (ACE_HANDLE, size_t & /* size */) +{ + ACE_NOTSUP_RETURN (-1); +} + + +int +ACE_Dev_Poll_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler) +{ + if (this->delete_signal_handler_) + delete this->signal_handler_; + + this->signal_handler_ = signal_handler; + this->delete_signal_handler_ = false; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::timer_queue (ACE_Timer_Queue *tq) +{ + if (this->delete_timer_queue_) + delete this->timer_queue_; + + this->timer_queue_ = tq; + this->delete_timer_queue_ = false; + + return 0; + +} + +ACE_Timer_Queue * +ACE_Dev_Poll_Reactor::timer_queue (void) const +{ + return this->timer_queue_; +} + +int +ACE_Dev_Poll_Reactor::close (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::close"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + int result = 0; + + if (this->poll_fd_ != ACE_INVALID_HANDLE) + { + result = ACE_OS::close (this->poll_fd_); + } + +#if defined (ACE_HAS_EVENT_POLL) + + ACE_OS::memset (&this->event_, 0, sizeof (this->event_)); + this->event_.data.fd = ACE_INVALID_HANDLE; + +#else + + delete [] this->dp_fds_; + this->dp_fds_ = 0; + this->start_pfds_ = 0; + this->end_pfds_ = 0; + +#endif /* ACE_HAS_EVENT_POLL */ + + if (this->delete_signal_handler_) + { + delete this->signal_handler_; + this->signal_handler_ = 0; + this->delete_signal_handler_ = false; + } + + (void) this->handler_rep_.close (); + + if (this->delete_timer_queue_) + { + delete this->timer_queue_; + this->timer_queue_ = 0; + this->delete_timer_queue_ = false; + } + + if (this->notify_handler_ != 0) + this->notify_handler_->close (); + + if (this->delete_notify_handler_) + { + delete this->notify_handler_; + this->notify_handler_ = 0; + this->delete_notify_handler_ = false; + } + + this->poll_fd_ = ACE_INVALID_HANDLE; + + this->initialized_ = false; + + return result; +} + +int +ACE_Dev_Poll_Reactor::work_pending (const ACE_Time_Value & max_wait_time) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending"); + + // Stash the current time + // + // The destructor of this object will automatically compute how much + // time elapsed since this method was called. + ACE_Time_Value mwt (max_wait_time); + ACE_MT (ACE_Countdown_Time countdown (&mwt)); + + Token_Guard guard (this->token_); + int const result = guard.acquire_quietly (&mwt); + + // If the guard is NOT the owner just return the retval + if (!guard.is_owner ()) + return result; + + // Update the countdown to reflect time waiting for the mutex. + ACE_MT (countdown.update ()); + + return this->work_pending_i (&mwt); +} + +int +ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::work_pending_i"); + + if (this->deactivated_) + return 0; + +#if defined (ACE_HAS_EVENT_POLL) + if (this->event_.data.fd != ACE_INVALID_HANDLE) +#else + if (this->start_pfds_ != this->end_pfds_) +#endif /* ACE_HAS_EVENT_POLL */ + return 1; // We still have work_pending (). Do not poll for + // additional events. + + ACE_Time_Value timer_buf (0); + ACE_Time_Value *this_timeout = + this->timer_queue_->calculate_timeout (max_wait_time, &timer_buf); + + // Check if we have timers to fire. + int const timers_pending = + ((this_timeout != 0 && max_wait_time == 0) + || (this_timeout != 0 && max_wait_time != 0 + && *this_timeout != *max_wait_time) ? 1 : 0); + + long const timeout = + (this_timeout == 0 + ? -1 /* Infinity */ + : static_cast (this_timeout->msec ())); + +#if defined (ACE_HAS_EVENT_POLL) + + // See if there are handlers that have to be resumed before waiting. + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->to_be_resumed_lock_, -1); + this->epoll_wait_in_progress_ = true; + for (Resume_Map::iterator i = this->to_be_resumed_.begin (); + i != this->to_be_resumed_.end (); + ++i) + { + // Make sure that 1) the handle is still registered, + // 2) the registered handler is the one we're waiting to resume. + Event_Tuple *info = this->handler_rep_.find (i->first); + if (info != 0 && info->event_handler == i->second) + { + this->resume_handler_i (i->first); + } + } + this->to_be_resumed_.clear (); + } + + // Wait for an event. + int const nfds = ::epoll_wait (this->poll_fd_, + &this->event_, + 1, + static_cast (timeout)); + // Count on this being an atomic update; at worst, we may get an + // extraneous notify() from dispatch_io_event. + this->epoll_wait_in_progress_ = false; + +#else + + struct dvpoll dvp; + + dvp.dp_fds = this->dp_fds_; + dvp.dp_nfds = this->handler_rep_.size (); + dvp.dp_timeout = timeout; // Milliseconds + + // Poll for events + int const nfds = ACE_OS::ioctl (this->poll_fd_, DP_POLL, &dvp); + + // Retrieve the results from the pollfd array. + this->start_pfds_ = dvp.dp_fds; + + // If nfds == 0 then end_pfds_ == start_pfds_ meaning that there is + // no work pending. If nfds > 0 then there is work pending. + // Otherwise an error occurred. + if (nfds > -1) + this->end_pfds_ = this->start_pfds_ + nfds; +#endif /* ACE_HAS_EVENT_POLL */ + + // If timers are pending, override any timeout from the poll. + return (nfds == 0 && timers_pending != 0 ? 1 : nfds); +} + + +int +ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value *max_wait_time) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events"); + + // Stash the current time + // + // The destructor of this object will automatically compute how much + // time elapsed since this method was called. + ACE_MT (ACE_Countdown_Time countdown (max_wait_time)); + + Token_Guard guard (this->token_); + int const result = guard.acquire_quietly (max_wait_time); + + // If the guard is NOT the owner just return the retval + if (!guard.is_owner ()) + return result; + + if (this->deactivated_) + return -1; + + // Update the countdown to reflect time waiting for the mutex. + ACE_MT (countdown.update ()); + + return this->handle_events_i (max_wait_time, guard); +} + +int +ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time, + Token_Guard &guard) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events_i"); + + int result = 0; + + // Poll for events + // + // If the underlying event wait call was interrupted via the interrupt + // signal (i.e. returned -1 with errno == EINTR) then the loop will + // be restarted if so desired. + do + { + result = this->work_pending_i (max_wait_time); + if (result == -1 && (this->restart_ == 0 || errno != EINTR)) + ACE_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("work_pending_i"))); + } + while (result == -1 && this->restart_ != 0 && errno == EINTR); + + if (result == 0 || (result == -1 && errno == ETIME)) + return 0; + else if (result == -1) + { + if (errno != EINTR) + return -1; + + // Bail out -- we got here since the poll was interrupted. + // If it was due to a signal registered through our ACE_Sig_Handler, + // then it was dispatched, so we count it in the number of events + // handled rather than cause an error return. + if (ACE_Sig_Handler::sig_pending () != 0) + { + ACE_Sig_Handler::sig_pending (0); + return 1; + } + return -1; + } + + // Dispatch an event. + return this->dispatch (guard); +} + +// Dispatch an event. On entry, the token is held by the caller. If an +// event is found to dispatch, the token is released before dispatching it. +int +ACE_Dev_Poll_Reactor::dispatch (Token_Guard &guard) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::dispatch"); + + // Perform the Template Method for dispatching the first located event. + // We dispatch only one to effectively dispatch events concurrently. + // As soon as an event is located, the token is released, allowing the + // next waiter to begin getting an event while we dispatch one here. + int result = 0; + + // Handle timers early since they may have higher latency + // constraints than I/O handlers. Ideally, the order of + // dispatching should be a strategy... + if ((result = this->dispatch_timer_handler (guard)) != 0) + return result; + + // If no timer dispatched, check for an I/O event. + result = this->dispatch_io_event (guard); + + return result; +} + +int +ACE_Dev_Poll_Reactor::dispatch_timer_handler (Token_Guard &guard) +{ + if (this->timer_queue_->is_empty ()) + return 0; // Empty timer queue so cannot have any expired timers. + + // Get the current time + ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () + + this->timer_queue_->timer_skew ()); + + // Look for a node in the timer queue whose timer <= the present + // time. + ACE_Timer_Node_Dispatch_Info info; + if (this->timer_queue_->dispatch_info (cur_time, info)) + { + const void *upcall_act = 0; + + // Preinvoke (handles refcount if needed, etc.) + this->timer_queue_->preinvoke (info, cur_time, upcall_act); + + // Release the token before expiration upcall. + guard.release_token (); + + // call the functor + this->timer_queue_->upcall (info, cur_time); + + // Postinvoke (undo refcount if needed, etc.) + this->timer_queue_->postinvoke (info, cur_time, upcall_act); + + // We have dispatched a timer + return 1; + } + + return 0; +} + +#if 0 +int +ACE_Dev_Poll_Reactor::dispatch_notification_handlers ( + ACE_Select_Reactor_Handle_Set &dispatch_set, + int &number_of_active_handles, + int &number_of_handlers_dispatched) +{ + // Check to see if the ACE_HANDLE associated with the + // Dev_Poll_Reactor's notify hook is enabled. If so, it means that + // one or more other threads are trying to update the + // ACE_Dev_Poll_Reactor's internal tables or the notify pipe is + // enabled. We'll handle all these threads and notifications, and + // then break out to continue the event loop. + + const int n = + this->notify_handler_->dispatch_notifications (number_of_active_handles, + dispatch_set.rd_mask_); + + if (n == -1) + return -1; + else + number_of_handlers_dispatched += n; + + return /* this->state_changed_ ? -1 : */ 0; +} +#endif /* 0 */ + +int +ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) +{ + + // Dispatch a ready event. + + // Define bits to check for while dispatching. +#if defined (ACE_HAS_EVENT_POLL) + const __uint32_t out_event = EPOLLOUT; + const __uint32_t exc_event = EPOLLPRI; + const __uint32_t in_event = EPOLLIN; + const __uint32_t err_event = EPOLLHUP | EPOLLERR; +#else + const short out_event = POLLOUT; + const short exc_event = POLLPRI; + const short in_event = POLLIN; + const short err_event = 0; // No known bits for this +#endif /* ACE_HAS_EVENT_POLL */ + +#if defined (ACE_HAS_EVENT_POLL) + // epoll_wait() pulls one event which is stored in event_. If the handle + // is invalid, there's no event there. Else process it. In any event, we + // have the event, so clear event_ for the next thread. + const ACE_HANDLE handle = this->event_.data.fd; + __uint32_t revents = this->event_.events; + this->event_.data.fd = ACE_INVALID_HANDLE; + this->event_.events = 0; + if (handle != ACE_INVALID_HANDLE) + +#else + // Since the underlying event demultiplexing mechansim (`/dev/poll' + // or '/dev/epoll') is stateful, and since only one result buffer is + // used, all pending events (i.e. those retrieved from a previous + // poll) must be dispatched before any additional event can be + // polled. As such, the Dev_Poll_Reactor keeps track of the + // progress of events that have been dispatched. + + // Select the first available handle with event (s) pending. Check for + // event type in defined order of dispatch: output, exception, input. + // When an event is located, clear its bit in the dispatch set. If there + // are no more events for the handle, also increment the pfds pointer + // to move to the next handle ready. + // + // Notice that pfds only contains file descriptors that have + // received events. + struct pollfd *& pfds = this->start_pfds_; + const ACE_HANDLE handle = pfds->fd; + short &revents = pfds->revents; + if (pfds < this->end_pfds_) +#endif /* ACE_HAS_EVENT_POLL */ + + { + /* When using sys_epoll, we can attach arbitrary user + data to the descriptor, so it can be delivered when + activity is detected. Perhaps we should store event + handler together with descriptor, instead of looking + it up in a repository ? Could it boost performance ? + */ + Event_Tuple *info = this->handler_rep_.find (handle); + if (info == 0) // No registered handler any longer + { +#ifdef ACE_HAS_EVENT_POLL + this->event_.data.fd = ACE_INVALID_HANDLE; // Dump the event +#endif /* ACE_HAS_EVENT_POLL */ + return 0; + } + + // Figure out what to do first in order to make it easier to manage + // the bit twiddling and possible pfds increment before releasing + // the token for dispatch. + // Note that if there's an error (such as the handle was closed + // without being removed from the event set) the EPOLLHUP and/or + // EPOLLERR bits will be set in revents. + ACE_Reactor_Mask disp_mask = 0; + ACE_Event_Handler *eh = info->event_handler; + int (ACE_Event_Handler::*callback)(ACE_HANDLE) = 0; + if (ACE_BIT_ENABLED (revents, out_event)) + { + disp_mask = ACE_Event_Handler::WRITE_MASK; + callback = &ACE_Event_Handler::handle_output; + ACE_CLR_BITS (revents, out_event); + } + else if (ACE_BIT_ENABLED (revents, exc_event)) + { + disp_mask = ACE_Event_Handler::EXCEPT_MASK; + callback = &ACE_Event_Handler::handle_exception; + ACE_CLR_BITS (revents, exc_event); + } + else if (ACE_BIT_ENABLED (revents, in_event)) + { + disp_mask = ACE_Event_Handler::READ_MASK; + callback = &ACE_Event_Handler::handle_input; + ACE_CLR_BITS (revents, in_event); + } + else if (ACE_BIT_ENABLED (revents, err_event)) + { + this->remove_handler_i (handle, + ACE_Event_Handler::ALL_EVENTS_MASK, + info->event_handler); +#ifdef ACE_HAS_DEV_POLL + ++pfds; +#endif /* ACE_HAS_DEV_POLL */ + return 1; + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%t) dispatch_io h %d unknown events 0x%x\n"), + handle, revents)); + } + +#ifdef ACE_HAS_DEV_POLL + // Increment the pointer to the next element before we + // release the token. Otherwise event handlers end up being + // dispatched multiple times for the same poll. + if (revents == 0) + ++pfds; +#else + // With epoll, events are registered with oneshot, so the handle is + // effectively suspended; future calls to epoll_wait() will select + // the next event, so they're not managed here. + // The hitch to this is that the notify handler is always registered + // WITHOUT oneshot and is never suspended/resumed. This avoids endless + // notify loops caused by the notify handler requiring a resumption + // which requires the token, which requires a notify, etc. described + // in Bugzilla 3714. So, never suspend the notify handler. + + bool reactor_resumes_eh = false; + if (eh != this->notify_handler_) + { + info->suspended = true; + + reactor_resumes_eh = + eh->resume_handler () == + ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER; + } +#endif /* ACE_HAS_DEV_POLL */ + + int status = 0; // gets callback status, below. + { + // Modify the reference count in an exception-safe way. + // Note that eh could be the notify handler. It's not strictly + // necessary to manage its refcount, but since we don't enable + // the counting policy, it won't do much. Management of the + // notified handlers themselves is done in the notify handler. + ACE_Dev_Poll_Handler_Guard eh_guard (eh); + + // Release the reactor token before upcall. + guard.release_token (); + + // Dispatch the detected event; will do the repeated upcalls + // if callback returns > 0, unless it's the notify handler (which + // returns the number of notfies dispatched, not an indication of + // re-callback requested). If anything other than the notify, come + // back with either 0 or < 0. + status = this->upcall (eh, callback, handle); + + if (eh == this->notify_handler_) + return status; + + // If the callback returned 0, epoll-based needs to resume the + // suspended handler but dev/poll doesn't. + // The epoll case is optimized to not acquire the token in order + // to resume the handler; the handler is added to a list of those + // that need to be resumed and is handled by the next leader + // that does an epoll_wait(). + // In both epoll and dev/poll cases, if the callback returns <0, + // the token needs to be acquired and the handler checked and + // removed if it hasn't already been. + if (status == 0) + { +#ifdef ACE_HAS_EVENT_POLL + // epoll-based effectively suspends handlers around the upcall. + // If the handler must be resumed, add it to the list. + if (reactor_resumes_eh) + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + grd, + this->to_be_resumed_lock_, + -1); + bool map_was_empty = this->to_be_resumed_.empty(); + this->to_be_resumed_.insert + (Resume_Map::value_type (handle, eh)); + if (this->epoll_wait_in_progress_ && map_was_empty) + this->notify(); + } +#endif /* ACE_HAS_EVENT_POLL */ + return 1; + } + + // All state in the handler repository may have changed during the + // upcall while other threads had the token. Thus, reacquire the + // token and evaluate what's needed. If the upcalled handler is still + // the handler of record for handle, continue with checking whether + // or not to remove or resume the handler. + guard.acquire (); + info = this->handler_rep_.find (handle); + if (info != 0 && info->event_handler == eh) + { + if (status < 0) + this->remove_handler_i (handle, disp_mask); + } + } + // Scope close handles eh ref count decrement, if needed. + + return 1; + } + + return 0; +} + +int +ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events"); + + return this->handle_events (max_wait_time); +} + +int +ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value &max_wait_time) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::handle_events"); + + return this->handle_events (&max_wait_time); +} + +int +ACE_Dev_Poll_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::alertable_handle_events"); + + return this->handle_events (max_wait_time); +} + +int +ACE_Dev_Poll_Reactor::deactivated (void) +{ + return this->deactivated_; +} + +void +ACE_Dev_Poll_Reactor::deactivate (int do_stop) +{ + this->deactivated_ = do_stop; + this->wakeup_all_threads (); +} + +int +ACE_Dev_Poll_Reactor::register_handler (ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->register_handler_i (handler->get_handle (), + handler, + mask); +} + +int +ACE_Dev_Poll_Reactor::register_handler (ACE_HANDLE handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->register_handler_i (handle, + event_handler, + mask); +} + +int +ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler_i"); + + if (handle == ACE_INVALID_HANDLE + || mask == ACE_Event_Handler::NULL_MASK) + { + errno = EINVAL; + return -1; + } + + if (this->handler_rep_.find (handle) == 0) + { + // Handler not present in the repository. Bind it. + if (this->handler_rep_.bind (handle, event_handler, mask) != 0) + return -1; + +#if defined (ACE_HAS_EVENT_POLL) + + Event_Tuple *info = this->handler_rep_.find (handle); + + struct epoll_event epev; + ACE_OS::memset (&epev, 0, sizeof (epev)); + static const int op = EPOLL_CTL_ADD; + + epev.data.fd = handle; + epev.events = this->reactor_mask_to_poll_event (mask); + // All but the notify handler get registered with oneshot to facilitate + // auto suspend before the upcall. See dispatch_io_event for more + // information. + if (event_handler != this->notify_handler_) + epev.events |= EPOLLONESHOT; + + if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("epoll_ctl"))); + (void) this->handler_rep_.unbind (handle); + return -1; + } + info->controlled = true; + +#endif /* ACE_HAS_EVENT_POLL */ + } + else + { + // Handler is already present in the repository, so register it + // again, possibly for different event. Add new mask to the + // current one. + if (this->mask_ops_i (handle, mask, ACE_Reactor::ADD_MASK) == -1) + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("mask_ops_i")), + -1); + } + +#ifdef ACE_HAS_DEV_POLL + + struct pollfd pfd; + + pfd.fd = handle; + pfd.events = this->reactor_mask_to_poll_event (mask); + pfd.revents = 0; + + // Add file descriptor to the "interest set." + if (ACE_OS::write (this->poll_fd_, &pfd, sizeof (pfd)) != sizeof (pfd)) + { + (void) this->handler_rep_.unbind (handle); + return -1; + } +#endif /*ACE_HAS_DEV_POLL*/ + + // Note the fact that we've changed the state of the wait_set_, + // which is used by the dispatching loop to determine whether it can + // keep going or if it needs to reconsult select (). + // this->state_changed_ = 1; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::register_handler ( + ACE_HANDLE /* event_handle */, + ACE_HANDLE /* io_handle */, + ACE_Event_Handler * /* event_handler */, + ACE_Reactor_Mask /* mask */) +{ + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_Dev_Poll_Reactor::register_handler (const ACE_Handle_Set &handle_set, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); + + ACE_Handle_Set_Iterator handle_iter (handle_set); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + // @@ It might be more efficient to construct a pollfd array and + // pass it to the write () call in register_handler_i () only once, + // instead of calling write () (a system call) once for each file + // descriptor. + + for (ACE_HANDLE h = handle_iter (); + h != ACE_INVALID_HANDLE; + h = handle_iter ()) + if (this->register_handler_i (h, event_handler, mask) == -1) + return -1; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, + ACE_Event_Handler **old_sh, + ACE_Sig_Action *old_disp) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); + + return this->signal_handler_->register_handler (signum, + new_sh, + new_disp, + old_sh, + old_disp); +} + +int +ACE_Dev_Poll_Reactor::register_handler (const ACE_Sig_Set &sigset, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::register_handler"); + + int result = 0; + +#if (ACE_NSIG > 0) + + for (int s = 1; s < ACE_NSIG; ++s) + if ((sigset.is_member (s) == 1) + && this->signal_handler_->register_handler (s, + new_sh, + new_disp) == -1) + result = -1; + +#else /* ACE_NSIG <= 0 */ + + ACE_UNUSED_ARG (sigset); + ACE_UNUSED_ARG (new_sh); + ACE_UNUSED_ARG (new_disp); + +#endif /* ACE_NSIG <= 0 */ + + return result; +} + +int +ACE_Dev_Poll_Reactor::remove_handler (ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->remove_handler_i (handler->get_handle (), mask); +} + +int +ACE_Dev_Poll_Reactor::remove_handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->remove_handler_i (handle, mask); +} + +int +ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler *eh) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler_i"); + + // If registered event handler not the same as eh, don't mess with + // the mask, but do the proper callback and refcount when needed. + bool handle_reg_changed = true; + Event_Tuple *info = this->handler_rep_.find (handle); + if (info == 0 && eh == 0) // Nothing to work with + return -1; + if (info != 0 && (eh == 0 || info->event_handler == eh)) + { + if (this->mask_ops_i (handle, mask, ACE_Reactor::CLR_MASK) == -1) + return -1; + handle_reg_changed = false; + eh = info->event_handler; + } + + // Check for ref counting now - handle_close () may delete eh. + bool const requires_reference_counting = + eh->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (ACE_BIT_DISABLED (mask, ACE_Event_Handler::DONT_CALL)) + (void) eh->handle_close (handle, mask); + + // If there are no longer any outstanding events on the given handle + // then remove it from the handler repository. + if (!handle_reg_changed && info->mask == ACE_Event_Handler::NULL_MASK) + this->handler_rep_.unbind (handle, requires_reference_counting); + + return 0; +} + +int +ACE_Dev_Poll_Reactor::remove_handler (const ACE_Handle_Set &handle_set, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); + + ACE_Handle_Set_Iterator handle_iter (handle_set); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + // @@ It might be more efficient to construct a pollfd array and + // pass it to the write () call in register_handler_i () only once, + // instead of calling write () (a system call) once for each file + // descriptor. + + for (ACE_HANDLE h = handle_iter (); + h != ACE_INVALID_HANDLE; + h = handle_iter ()) + if (this->remove_handler_i (h, mask) == -1) + return -1; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::remove_handler (int signum, + ACE_Sig_Action *new_disp, + ACE_Sig_Action *old_disp, + int sigkey) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); + + return this->signal_handler_->remove_handler (signum, + new_disp, + old_disp, + sigkey); +} + +int +ACE_Dev_Poll_Reactor::remove_handler (const ACE_Sig_Set &sigset) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::remove_handler"); + + int result = 0; + +#if (ACE_NSIG > 0) + + for (int s = 1; s < ACE_NSIG; ++s) + if ((sigset.is_member (s) == 1) + && this->signal_handler_->remove_handler (s) == -1) + result = -1; + +#else /* ACE_NSIG <= 0 */ + + ACE_UNUSED_ARG (sigset); + +#endif /* ACE_NSIG <= 0 */ + + return result; +} + +int +ACE_Dev_Poll_Reactor::suspend_handler (ACE_Event_Handler *event_handler) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); + + if (event_handler == 0) + { + errno = EINVAL; + return -1; + } + + ACE_HANDLE handle = event_handler->get_handle (); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->suspend_handler_i (handle); +} + +int +ACE_Dev_Poll_Reactor::suspend_handler (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->suspend_handler_i (handle); +} + +int +ACE_Dev_Poll_Reactor::suspend_handler (const ACE_Handle_Set &handles) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler"); + + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->suspend_handler_i (h) == -1) + return -1; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::suspend_handlers (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handlers"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + size_t const len = this->handler_rep_.max_size (); + + for (size_t i = 0; i < len; ++i) + { + Event_Tuple *info = this->handler_rep_.find (i); + if (info != 0 && !info->suspended && this->suspend_handler_i (i) != 0) + return -1; + } + return 0; +} + +int +ACE_Dev_Poll_Reactor::suspend_handler_i (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::suspend_handler_i"); + + Event_Tuple *info = this->handler_rep_.find (handle); + if (info == 0) + return -1; + + if (info->suspended) + return 0; // Already suspended. @@ Should this be an error? + + // Remove the handle from the "interest set." + // + // Note that the associated event handler is still in the handler + // repository, but no events will be polled on the given handle thus + // no event will be dispatched to the event handler. + +#if defined (ACE_HAS_EVENT_POLL) + + struct epoll_event epev; + ACE_OS::memset (&epev, 0, sizeof (epev)); + static const int op = EPOLL_CTL_DEL; + + epev.events = 0; + epev.data.fd = handle; + + if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) + return -1; + info->controlled = false; +#else + + struct pollfd pfd[1]; + + pfd[0].fd = handle; + pfd[0].events = POLLREMOVE; + pfd[0].revents = 0; + + if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd)) + return -1; + +#endif /* ACE_HAS_EVENT_POLL */ + + info->suspended = true; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::resume_handler (ACE_Event_Handler *event_handler) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); + + if (event_handler == 0) + { + errno = EINVAL; + return -1; + } + + ACE_HANDLE handle = event_handler->get_handle (); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->resume_handler_i (handle); +} + +int +ACE_Dev_Poll_Reactor::resume_handler (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->resume_handler_i (handle); +} + +int +ACE_Dev_Poll_Reactor::resume_handler (const ACE_Handle_Set &handles) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler"); + + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->resume_handler_i (h) == -1) + return -1; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::resume_handlers (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handlers"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + size_t const len = this->handler_rep_.max_size (); + + for (size_t i = 0; i < len; ++i) + { + Event_Tuple *info = this->handler_rep_.find (i); + if (info != 0 && info->suspended && this->resume_handler_i (i) != 0) + return -1; + } + + return 0; +} + +int +ACE_Dev_Poll_Reactor::resume_handler_i (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::resume_handler_i"); + + Event_Tuple *info = this->handler_rep_.find (handle); + if (info == 0) + return -1; + + if (!info->suspended) + return 0; + + ACE_Reactor_Mask mask = info->mask; + if (mask == ACE_Event_Handler::NULL_MASK) + { + info->suspended = false; + return 0; + } + + // Place the handle back in to the "interest set." + // + // Events for the given handle will once again be polled. + +#if defined (ACE_HAS_EVENT_POLL) + + struct epoll_event epev; + ACE_OS::memset (&epev, 0, sizeof (epev)); + int op = EPOLL_CTL_ADD; + if (info->controlled) + op = EPOLL_CTL_MOD; + epev.events = this->reactor_mask_to_poll_event (mask) | EPOLLONESHOT; + epev.data.fd = handle; + + if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) + return -1; + info->controlled = true; + +#else + + struct pollfd pfd[1]; + + pfd[0].fd = handle; + pfd[0].events = this->reactor_mask_to_poll_event (mask); + pfd[0].revents = 0; + + if (ACE_OS::write (this->poll_fd_, pfd, sizeof (pfd)) != sizeof (pfd)) + return -1; + +#endif /* ACE_HAS_EVENT_POLL */ + + info->suspended = false; + + return 0; +} + +int +ACE_Dev_Poll_Reactor::resumable_handler (void) +{ + // @@ Is this correct? + + return 0; +} + +bool +ACE_Dev_Poll_Reactor::uses_event_associations (void) +{ + // Since the Dev_Poll_Reactor does not do any event associations, + // this method always return false. + return false; +} + +long +ACE_Dev_Poll_Reactor::schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_timer"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + if (0 != this->timer_queue_) + return this->timer_queue_->schedule + (event_handler, + arg, + this->timer_queue_->gettimeofday () + delay, + interval); + + errno = ESHUTDOWN; + return -1; +} + +int +ACE_Dev_Poll_Reactor::reset_timer_interval (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::reset_timer_interval"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + if (0 != this->timer_queue_) + return this->timer_queue_->reset_interval (timer_id, interval); + + errno = ESHUTDOWN; + return -1; +} + +int +ACE_Dev_Poll_Reactor::cancel_timer (ACE_Event_Handler *event_handler, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return (this->timer_queue_ == 0 + ? 0 + : this->timer_queue_->cancel (event_handler, + dont_call_handle_close)); +} + +int +ACE_Dev_Poll_Reactor::cancel_timer (long timer_id, + const void **arg, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_timer"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return (this->timer_queue_ == 0 + ? 0 + : this->timer_queue_->cancel (timer_id, + arg, + dont_call_handle_close)); +} + +int +ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup"); + + return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK); +} + +int +ACE_Dev_Poll_Reactor::schedule_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::schedule_wakeup"); + + return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK); +} + +int +ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup"); + + return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK); +} + +int +ACE_Dev_Poll_Reactor::cancel_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::cancel_wakeup"); + + return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK); +} + +int +ACE_Dev_Poll_Reactor::notify (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::notify"); + + ssize_t n = 0; + + // Pass over both the Event_Handler *and* the mask to allow the + // caller to dictate which Event_Handler method the receiver + // invokes. Note that this call can timeout. + + n = this->notify_handler_->notify (eh, mask, timeout); + + return n == -1 ? -1 : 0; +} + +void +ACE_Dev_Poll_Reactor::max_notify_iterations (int iterations) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations"); + + ACE_MT (ACE_GUARD (ACE_Dev_Poll_Reactor_Token, mon, this->token_)); + + this->notify_handler_->max_notify_iterations (iterations); +} + +int +ACE_Dev_Poll_Reactor::max_notify_iterations (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::max_notify_iterations"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->notify_handler_->max_notify_iterations (); +} + +int +ACE_Dev_Poll_Reactor::purge_pending_notifications (ACE_Event_Handler * eh, + ACE_Reactor_Mask mask) +{ + if (this->notify_handler_ == 0) + return 0; + + return this->notify_handler_->purge_pending_notifications (eh, mask); +} + +ACE_Event_Handler * +ACE_Dev_Poll_Reactor::find_handler (ACE_HANDLE handle) +{ + ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, 0)); + + Event_Tuple *info = this->handler_rep_.find (handle); + if (info) + { + info->event_handler->add_reference (); + return info->event_handler; + } + else + { + return 0; + } +} + +int +ACE_Dev_Poll_Reactor::handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **event_handler) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::handler"); + + ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + Event_Tuple *info = this->handler_rep_.find (handle); + + if (info != 0 + && ACE_BIT_CMP_MASK (info->mask, + mask, // Compare all bits in the mask + mask)) + { + if (event_handler != 0) + *event_handler = info->event_handler; + + return 0; + } + + return -1; +} + +int +ACE_Dev_Poll_Reactor::handler (int signum, + ACE_Event_Handler **eh) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::handler"); + + ACE_Event_Handler *handler = this->signal_handler_->handler (signum); + + if (handler == 0) + return -1; + else if (eh != 0) + *eh = handler; + + return 0; +} + +bool +ACE_Dev_Poll_Reactor::initialized (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::initialized"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, false)); + + return this->initialized_; +} + +size_t +ACE_Dev_Poll_Reactor::size (void) const +{ + return this->handler_rep_.size (); +} + +ACE_Lock & +ACE_Dev_Poll_Reactor::lock (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::lock"); + + return this->lock_adapter_; +} + +void +ACE_Dev_Poll_Reactor::wakeup_all_threads (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::wakeup_all_threads"); + + // Send a notification, but don't block if there's no one to receive + // it. + this->notify (0, + ACE_Event_Handler::NULL_MASK, + (ACE_Time_Value *) &ACE_Time_Value::zero); +} + +int +ACE_Dev_Poll_Reactor::owner (ACE_thread_t /* new_owner */, + ACE_thread_t * /* old_owner */) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::owner"); + + // There is no need to set the owner of the event loop. Multiple + // threads may invoke the event loop simulataneously. + + return 0; +} + +int +ACE_Dev_Poll_Reactor::owner (ACE_thread_t * /* owner */) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::owner"); + + // There is no need to set the owner of the event loop. Multiple + // threads may invoke the event loop simulataneously. + + return 0; +} + +bool +ACE_Dev_Poll_Reactor::restart (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::restart"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, false)); + + return this->restart_; +} + +bool +ACE_Dev_Poll_Reactor::restart (bool r) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::restart"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, false)); + + bool current_value = this->restart_; + this->restart_ = r; + return current_value; +} + +void +ACE_Dev_Poll_Reactor::requeue_position (int) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position"); +} + +int +ACE_Dev_Poll_Reactor::requeue_position (void) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::requeue_position"); + + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_Dev_Poll_Reactor::mask_ops (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + int ops) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->mask_ops_i (event_handler->get_handle (), mask, ops); +} + +int +ACE_Dev_Poll_Reactor::mask_ops (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + int ops) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, -1)); + + return this->mask_ops_i (handle, mask, ops); +} + +int +ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + int ops) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::mask_ops_i"); + + Event_Tuple *info = this->handler_rep_.find (handle); + if (info == 0) + return -1; + + // Block out all signals until method returns. + ACE_Sig_Guard sb; + + ACE_Reactor_Mask const old_mask = info->mask; + ACE_Reactor_Mask new_mask = old_mask; + + // Perform GET, CLR, SET, and ADD operations on the interest/wait + // set and the suspend set (if necessary). + // + // GET = 1, Retrieve current value + // SET = 2, Set value of bits to new mask (changes the entire mask) + // ADD = 3, Bitwise "or" the value into the mask (only changes + // enabled bits) + // CLR = 4 Bitwise "and" the negation of the value out of the mask + // (only changes enabled bits) + // + // Returns the original mask. + + switch (ops) + { + case ACE_Reactor::GET_MASK: + // The work for this operation is done in all cases at the + // begining of the function. + return old_mask; + + case ACE_Reactor::CLR_MASK: + ACE_CLR_BITS (new_mask, mask); + break; + + case ACE_Reactor::SET_MASK: + new_mask = mask; + break; + + case ACE_Reactor::ADD_MASK: + ACE_SET_BITS (new_mask, mask); + break; + + default: + return -1; + } + + /// Reset the mask for the given handle. + info->mask = new_mask; + + // Only attempt to alter events for the handle from the + // "interest set" if it hasn't been suspended. If it has been + // suspended, the revised mask will take affect when the + // handle is resumed. The exception is if all the mask bits are + // cleared, we can un-control the fd now. + if (!info->suspended || (info->controlled && new_mask == 0)) + { + + short const events = this->reactor_mask_to_poll_event (new_mask); + +#if defined (sun) + // Apparently events cannot be updated on-the-fly on Solaris so + // remove the existing events, and then add the new ones. + struct pollfd pfd[2]; + + pfd[0].fd = handle; + pfd[0].events = POLLREMOVE; + pfd[0].revents = 0; + pfd[1].fd = (events == POLLREMOVE ? ACE_INVALID_HANDLE : handle); + pfd[1].events = events; + pfd[1].revents = 0; + + // Change the events associated with the given file descriptor. + if (ACE_OS::write (this->poll_fd_, + pfd, + sizeof (pfd)) != sizeof (pfd)) + return -1; +#elif defined (ACE_HAS_EVENT_POLL) + + struct epoll_event epev; + ACE_OS::memset (&epev, 0, sizeof (epev)); + int op; + + // ACE_Event_Handler::NULL_MASK ??? + if (new_mask == 0) + { + op = EPOLL_CTL_DEL; + epev.events = 0; + } + else + { + op = EPOLL_CTL_MOD; + epev.events = events | EPOLLONESHOT; + } + + epev.data.fd = handle; + + if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) + { + // If a handle is closed, epoll removes it from the poll set + // automatically - we may not know about it yet. If that's the + // case, a mod operation will fail with ENOENT. Retry it as + // an add. + if (op == EPOLL_CTL_MOD && errno == ENOENT && + ::epoll_ctl (this->poll_fd_, EPOLL_CTL_ADD, handle, &epev) == -1) + return -1; + } + info->controlled = (op != EPOLL_CTL_DEL); +#else + pollfd pfd[1]; + + pfd[0].fd = handle; + pfd[0].events = events; + pfd[0].revents = 0; + + // Change the events associated with the given file descriptor. + if (ACE_OS::write (this->poll_fd_, + pfd, + sizeof (pfd)) != sizeof (pfd)) + return -1; +#endif /*ACE_HAS_EVENT_POLL */ + } + + return old_mask; +} + +int +ACE_Dev_Poll_Reactor::ready_ops (ACE_Event_Handler * /* event_handler */, + ACE_Reactor_Mask /* mask */, + int /* ops */) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops"); + + // Since the Dev_Poll_Reactor uses the poll result buffer, the + // ready_set cannot be directly manipulated outside of the event + // loop. + ACE_NOTSUP_RETURN (-1); +} + +int +ACE_Dev_Poll_Reactor::ready_ops (ACE_HANDLE /* handle */, + ACE_Reactor_Mask /* mask */, + int /* ops */) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::ready_ops"); + + // Since the Dev_Poll_Reactor uses the poll result buffer, the + // ready_set cannot be directly manipulated outside of the event + // loop. + ACE_NOTSUP_RETURN (-1); +} + +void +ACE_Dev_Poll_Reactor::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Dev_Poll_Reactor::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("restart_ = %d\n"), this->restart_)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("initialized_ = %d"), + this->initialized_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("poll_fd_ = %d"), this->poll_fd_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("size_ = %u"), this->handler_rep_.size ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("deactivated_ = %d"), + this->deactivated_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +short +ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event (ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event"); + + if (mask == ACE_Event_Handler::NULL_MASK) + // No event. Remove from interest set. +#if defined (ACE_HAS_EVENT_POLL) + return EPOLL_CTL_DEL; +#else + return POLLREMOVE; +#endif /* ACE_HAS_EVENT_POLL */ + + short events = 0; + + // READ, ACCEPT, and CONNECT flag will place the handle in the + // read set. + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK) + || ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK) + || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) + { +#if defined (ACE_HAS_EVENT_POLL) + ACE_SET_BITS (events, EPOLLIN); +#else + ACE_SET_BITS (events, POLLIN); +#endif /*ACE_HAS_EVENT_POLL*/ + } + + // WRITE and CONNECT flag will place the handle in the write set. + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK) + || ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) + { +#if defined (ACE_HAS_EVENT_POLL) + ACE_SET_BITS (events, EPOLLOUT); +#else + ACE_SET_BITS (events, POLLOUT); +#endif /*ACE_HAS_EVENT_POLL*/ + } + + // EXCEPT flag will place the handle in the except set. + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + { +#if defined (ACE_HAS_EVENT_POLL) + ACE_SET_BITS (events, EPOLLPRI); +#else + ACE_SET_BITS (events, POLLPRI); +#endif /*ACE_HAS_EVENT_POLL*/ + } + + return events; +} + +namespace { + void polite_sleep_hook (void *) { } +} + +int +ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly"); + + // Acquire the token but don't ping any waiters; just queue up politely. + int result = 0; + if (max_wait) + { + ACE_Time_Value tv = ACE_OS::gettimeofday (); + tv += *max_wait; + + ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook, + 0, + &tv)); + } + else + { + ACE_MT (result = this->token_.acquire_read (&polite_sleep_hook)); + } + + // Check for timeouts and errors. + if (result == -1) + { + if (errno == ETIME) + return 0; + else + { + ACE_ERROR ((LM_ERROR, ACE_TEXT("%t: %p\n"), ACE_TEXT("token acquire_read"))); + return -1; + } + } + + // We got the token and so let us mark ourselves as owner + this->owner_ = 1; + + return result; +} + +int +ACE_Dev_Poll_Reactor::Token_Guard::acquire (ACE_Time_Value *max_wait) +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Token_Guard::acquire"); + + // Try to grab the token. If someone if already there, don't wake + // them up, just queue up in the thread pool. + int result = 0; + if (max_wait) + { + ACE_Time_Value tv = ACE_OS::gettimeofday (); + tv += *max_wait; + + ACE_MT (result = this->token_.acquire (0, 0, &tv)); + } + else + { + ACE_MT (result = this->token_.acquire ()); + } + + // Check for timeouts and errors. + if (result == -1) + { + if (errno == ETIME) + return 0; + else + return -1; + } + + // We got the token and so let us mark ourseleves as owner + this->owner_ = 1; + + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ diff --git a/externals/ace/Dev_Poll_Reactor.h b/externals/ace/Dev_Poll_Reactor.h new file mode 100644 index 0000000..030ad24 --- /dev/null +++ b/externals/ace/Dev_Poll_Reactor.h @@ -0,0 +1,1258 @@ +// -*- C++ -*- + +// ========================================================================= +/** + * @file Dev_Poll_Reactor.h + * + * $Id: Dev_Poll_Reactor.h 90177 2010-05-19 11:44:22Z vzykov $ + * + * @c /dev/poll (or Linux @c sys_epoll) based Reactor implementation. + * + * @author Ossama Othman + */ +// ========================================================================= + + +#ifndef ACE_DEV_POLL_REACTOR_H +#define ACE_DEV_POLL_REACTOR_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_EVENT_POLL) && defined (ACE_HAS_DEV_POLL) +# error ACE_HAS_EVENT_POLL and ACE_HAS_DEV_POLL are mutually exclusive. +#endif /* ACE_HAS_EVENT_POLL && defined ACE_HAS_DEV_POLL */ + +#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) + +#include "ace/Pipe.h" +#include "ace/Lock_Adapter_T.h" +#include "ace/Reactor_Impl.h" +#include "ace/Reactor_Token_T.h" +#include "ace/Token.h" + +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) +# include "ace/Notification_Queue.h" +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ + +#if defined (ACE_HAS_DEV_POLL) +struct pollfd; +#elif defined (ACE_HAS_EVENT_POLL) +# include "ace/Array_Map.h" +# include /**/ +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations +class ACE_Sig_Handler; +class ACE_Dev_Poll_Reactor; + + +// --------------------------------------------------------------------- + +#if 0 +/** + * @class ACE_Dev_Poll_Ready_Set + * + * @brief Class that contains the list of "ready" file descriptors. + * + * This class points to an array of pollfd structures corresponding to + * "ready" file descriptors, such as those corresponding to event + * handlers that request an additional callback after being initially + * dispatched (i.e. return a value greater than zero). + * @par + * The idea is to store the "ready" set in an existing area of memory + * that already contains pollfd instances. Doing so is safe since the + * "ready" set is dispatched before polling for additional events, + * thus avoiding being potentially overwritten during the event poll. + * @par + * When the "ready" set is dispatched, all that needs to be done is to + * iterate over the contents of the array. There is no need to "walk" + * the array in search of ready file descriptors since the array by + * design only contains ready file descriptors. As such, this + * implementation of a ready set is much more efficient in the + * presence of a large number of file descriptors in terms of both + * time and space than the one used in the Select_Reactor, for + * example. + */ +class ACE_Dev_Poll_Ready_Set +{ +public: + + /// Constructor. + ACE_Dev_Poll_Ready_Set (void); + +public: + + /// The array containing the pollfd structures corresponding to the + /// "ready" file descriptors. + struct pollfd *pfds; + + /// The number of "ready" file descriptors in the above array. + int nfds; + +}; +#endif /* 0 */ + +// --------------------------------------------------------------------- + +/** + * @class ACE_Dev_Poll_Reactor_Notify + * + * @brief Event handler used for unblocking the ACE_Dev_Poll_Reactor + * from its event loop. + * + * This event handler is used internally by the ACE_Dev_Poll_Reactor + * as a means to allow a thread other then the one running the event + * loop to unblock the event loop. + */ +class ACE_Dev_Poll_Reactor_Notify : public ACE_Reactor_Notify +{ +public: + + /// Constructor + ACE_Dev_Poll_Reactor_Notify (void); + + /** + * @name Initialization and Termination Methods + * + * Methods called when initializing and terminating this event + * handler. + */ + virtual int open (ACE_Reactor_Impl *, + ACE_Timer_Queue *timer_queue = 0, + int disable_notify = 0); + virtual int close (void); + + /** + * Called by a thread when it wants to unblock the Reactor_Impl. + * This wakes up the Reactor_Impl if currently blocked. Pass over + * both the Event_Handler and the mask to allow the caller to + * dictate which Event_Handler method the Reactor_Impl will + * invoke. The ACE_Time_Value indicates how long to block + * trying to notify the Reactor_Impl. If timeout == 0, the + * caller will block until action is possible, else will wait until + * the relative time specified in *timeout elapses). + */ + virtual int notify (ACE_Event_Handler *eh = 0, + ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value *timeout = 0); + + /// Unimplemented method required by pure virtual method in abstract + /// base class. + /** + * This method's interface is not very compatibile with this + * Reactor's design. It's not clear why this method is pure virtual + * either. + */ + virtual int dispatch_notifications (int &number_of_active_handles, + ACE_Handle_Set &rd_mask); + + /// Returns the ACE_HANDLE of the notify pipe on which the reactor + /// is listening for notifications so that other threads can unblock + /// the Reactor_Impl. + virtual ACE_HANDLE notify_handle (void); + + /// Verify whether the buffer has dispatchable info or not. + virtual int is_dispatchable (ACE_Notification_Buffer &buffer); + + /// Handle one notify call represented in @a buffer. This could be + /// because of a thread trying to unblock the Reactor_Impl. + virtual int dispatch_notify (ACE_Notification_Buffer &buffer); + + /// Read one notify call on the handle into @a buffer. + /// This could be because of a thread trying to unblock the Reactor_Impl. + virtual int read_notify_pipe (ACE_HANDLE handle, + ACE_Notification_Buffer &buffer); + + /// Called back by the ACE_Dev_Poll_Reactor when a thread wants to + /// unblock us. + virtual int handle_input (ACE_HANDLE handle); + + /** + * Set the maximum number of times that the handle_input method + * will iterate and dispatch the ACE_Event_Handlers that are + * passed in via the notify queue before breaking out of the event + * loop. By default, this is set to -1, which means "iterate until + * the queue is empty." Setting this to a value like "1 or 2" will + * increase "fairness" (and thus prevent starvation) at the expense + * of slightly higher dispatching overhead. + */ + virtual void max_notify_iterations (int); + + /** + * Get the maximum number of times that the handle_input method + * will iterate and dispatch the ACE_Event_Handlers that are + * passed in via the notify queue before breaking out of its event + * loop. + */ + virtual int max_notify_iterations (void); + + /** + * Purge any notifications pending in this reactor for the specified + * ACE_Event_Handler object. Returns the number of notifications + * purged. Returns -1 on error. + */ + virtual int purge_pending_notifications ( + ACE_Event_Handler * = 0, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + /// Dump the state of an object. + virtual void dump (void) const; + +protected: + + /** + * Keep a back pointer to the ACE_Dev_Poll_Reactor. If this value + * if NULL then the ACE_Dev_Poll_Reactor has been initialized with + * disable_notify_pipe. + */ + ACE_Dev_Poll_Reactor *dp_reactor_; + + /** + * Contains the ACE_HANDLE the ACE_Dev_Poll_Reactor is listening + * on, as well as the ACE_HANDLE that threads wanting the attention + * of the ACE_Dev_Poll_Reactor will write to. + */ + ACE_Pipe notification_pipe_; + + /** + * Keeps track of the maximum number of times that the + * ACE_Dev_Poll_Reactor_Notify::handle_input method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify pipe before breaking out of its recv loop. By default, + * this is set to -1, which means "iterate until the pipe is empty." + */ + int max_notify_iterations_; + +#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + /** + * @brief A user-space queue to store the notifications. + * + * The notification pipe has OS-specific size restrictions. That + * is, no more than a certain number of bytes may be stored in the + * pipe without blocking. This limit may be too small for certain + * applications. In this case, ACE can be configured to store all + * the events in user-space. The pipe is still needed to wake up + * the reactor thread, but only one event is sent through the pipe + * at a time. + */ + ACE_Notification_Queue notification_queue_; +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ + + /// Lock and flag to say whether we're already dispatching notifies. + /// Purpose is to only dispatch notifies from one thread at a time. + ACE_SYNCH_MUTEX dispatching_lock_; + volatile bool dispatching_; +}; + +// --------------------------------------------------------------------- + +/** + * @class ACE_Dev_Poll_Reactor + * + * @brief A `/dev/poll' or `/dev/epoll' based Reactor implemenatation. + * + * @attention The Linux epoll implementation works quite well and is + * fully supported; however, the /dev/poll implementation is @em experimental. + * + * The ACE_Dev_Poll_Reactor uses the `/dev/poll' or '/dev/epoll' + * character devices to demultiplex events on a given set of file + * descriptors. Unlike @c select(), `/dev/poll' and `/dev/epoll' have + * no hard-coded limit on the number of file descriptors that may be + * handled at any given time. As such, the ACE_Dev_Poll_Reactor can + * generally handle a much larger number of file descriptors than + * @c select() -based reactors. Furthermore, since `/dev/poll' and + * `/dev/epoll' both return a set of file descriptors that are active, + * there is no need to "walk" the set of file descriptors to determine + * which ones are active, such as what is done with the @c select() and + * @c poll() system calls. All returned file descriptors are active. + * This makes event dispatching very efficient. + * + * @note In general, this reactor may only be used to demultiplex + * events on sockets. Demultiplexing events on pipes, for + * example may not work. This is due to a limitation in the + * underlying `/dev/poll' device driver. + * + * @note It is only possible to achieve millisecond timeout + * resolutions with the @c ACE_Dev_Poll_Reactor. However, the + * timeout resolution for timers is independent of the reactors + * timeout resolution. As such, it may be possible to achieve + * sub-millisecond timeout resolutions for timers but that is + * entirely platform dependent. + */ + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +typedef ACE_Token ACE_DEV_POLL_TOKEN; +#else +typedef ACE_Noop_Token ACE_DEV_POLL_TOKEN; +#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ +typedef ACE_Reactor_Token_T ACE_Dev_Poll_Reactor_Token; + +class ACE_Export ACE_Dev_Poll_Reactor : public ACE_Reactor_Impl +{ + + /** + * @struct Event_Tuple + * + * @brief Struct that collects event registration information for a handle. + * + * @internal Internal use only + * + * This struct merely provides a means to associate an event mask + * with an event handler. Such an association is needed since it is + * not possible to retrieve the event mask from the "interest set" + * stored in the `/dev/poll' or `/dev/epoll' driver. Without this + * external association, it would not be possible keep track of the + * event mask for a given event handler when suspending it or resuming + * it. + * + * @note An ACE_Handle_Set is not used since the number of handles may + * exceed its capacity (ACE_DEFAULT_SELECT_REACTOR_SIZE). + */ + struct Event_Tuple + { + /// Constructor to set up defaults. + Event_Tuple (ACE_Event_Handler *eh = 0, + ACE_Reactor_Mask m = ACE_Event_Handler::NULL_MASK, + bool is_suspended = false, + bool is_controlled = false); + + /// The event handler. + ACE_Event_Handler *event_handler; + + /// The event mask for the above event handler. + ACE_Reactor_Mask mask; + + /// Flag that states whether or not the event handler is suspended. + bool suspended; + + /// Flag to say whether or not this handle is registered with epoll. + bool controlled; + }; + + + // --------------------------------------------------------------------- + + /** + * @class Handler_Repository + * + * @internal + * + * @brief Used to map ACE_HANDLEs onto the appropriate Event_Tuple. + * + * This class is simply a container that maps a handle to its + * corresponding event tuple. It is not meant for use outside of + * the Dev_Poll_Reactor. + * + * @note Calls to any method in this class, and any modification to a + * Event_Tuple returned from this class's methods, must be made + * while holding the reactor token. + */ + class Handler_Repository + { + public: + + /// Constructor. + Handler_Repository (void); + + /// Initialize a repository that can map handles up to the value @a size. + /// Since the event tuples are accessed directly using the handle as + /// an index, @a size sets the maximum handle value, minus 1. + int open (size_t size); + + /// Close down the repository. + int close (void); + + /** + * @name Repository Manipulation Operations + * + * Methods used to search and modify the handler repository. + */ + //@{ + + /// Return a pointer to the Event_Tuple associated with @a handle. + /// If there is none associated, returns 0 and sets errno. + Event_Tuple *find (ACE_HANDLE handle); + + + /// Bind the ACE_Event_Handler to the @c ACE_HANDLE with the + /// appropriate ACE_Reactor_Mask settings. + int bind (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Remove the binding for @a handle; optionally decrement the associated + /// handler's reference count. + int unbind (ACE_HANDLE handle, bool decr_refcnt = true); + + /// Remove all the registered tuples. + int unbind_all (void); + + //@} + + /** + * @name Sanity Checking + * + * Methods used to prevent "out-of-range" errors when indexing the + * underlying handler array. + */ + //@{ + + // Check the @a handle to make sure it's a valid @c ACE_HANDLE that + // within the range of legal handles (i.e., greater than or equal to + // zero and less than @c max_size_). + bool invalid_handle (ACE_HANDLE handle) const; + + // Check the handle to make sure it's a valid @c ACE_HANDLE that is + // within the range of currently registered handles (i.e., greater + // than or equal to zero and less than @c max_handlep1_). + bool handle_in_range (ACE_HANDLE handle) const; + + //@} + + /// Returns the current table size. + size_t size (void) const; + + /// Returns the current table size. + size_t max_size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + private: + + /// Current number of handles. + int size_; + + /// Maximum number of handles. + int max_size_; + + /// The underlying array of event handlers. + /** + * The array of event handlers is directly indexed directly using + * an @c ACE_HANDLE value. This is Unix-specific. + */ + Event_Tuple *handlers_; + + }; + +public: + + /// Initialize @c ACE_Dev_Poll_Reactor with the default size. + /** + * The default size for the @c ACE_Dev_Poll_Reactor is the maximum + * number of open file descriptors for the process. + */ + ACE_Dev_Poll_Reactor (ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + int disable_notify_pipe = 0, + ACE_Reactor_Notify *notify = 0, + int mask_signals = 1, + int s_queue = ACE_DEV_POLL_TOKEN::FIFO); + + /// Initialize ACE_Dev_Poll_Reactor with size @a size. + /** + * @note On Unix platforms, the @a size parameter should be as large + * as the maximum number of file descriptors allowed for a + * given process. This is necessary since a file descriptor + * is used to directly index the array of event handlers + * maintained by the Reactor's handler repository. Direct + * indexing is used for efficiency reasons. If the size + * parameter is less than the process maximum, the process + * maximum will be decreased in order to prevent potential + * access violations. + */ + ACE_Dev_Poll_Reactor (size_t size, + bool restart = false, + ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + int disable_notify_pipe = 0, + ACE_Reactor_Notify *notify = 0, + int mask_signals = 1, + int s_queue = ACE_DEV_POLL_TOKEN::FIFO); + + /// Close down and release all resources. + virtual ~ACE_Dev_Poll_Reactor (void); + + /// Initialization. + virtual int open (size_t size, + bool restart = false, + ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + int disable_notify_pipe = 0, + ACE_Reactor_Notify * = 0); + + /** + * @param handle allows the reactor to check if the caller is + * valid. + * + * @return 0 if the size of the current message has been put in + * size. -1 if not. + */ + virtual int current_info (ACE_HANDLE handle, size_t & /* size */); + + /// Use a user specified signal handler instead. + virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); + + /// Set a user-specified timer queue. + virtual int timer_queue (ACE_Timer_Queue *tq); + + /// Get the timer queue + /// @return The current @c ACE_Timer_Queue. + virtual ACE_Timer_Queue *timer_queue (void) const; + + /// Close down and release all resources. + virtual int close (void); + + // = Event loop drivers. + /** + * Returns non-zero if there are I/O events "ready" for dispatching, + * but does not actually dispatch the event handlers. By default, + * don't block while checking this, i.e., "poll". + * + * @note It is only possible to achieve millisecond timeout + * resolutions with the @c ACE_Dev_Poll_Reactor. + */ + virtual int work_pending ( + const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); + + /** + * This event loop driver blocks for up to @a max_wait_time before + * returning. It will return earlier if events occur. Note that + * @a max_wait_time can be 0, in which case this method blocks + * indefinitely until events occur. + * @par + * @a max_wait_time is decremented to reflect how much time this + * call took. For instance, if a time value of 3 seconds is passed + * to @c handle_events() and an event occurs after 2 seconds, + * @a max_wait_time will equal 1 second. This can be used if an + * application wishes to handle events for some fixed amount of + * time. + * @par + * The only difference between @c alertable_handle_events() and + * handle_events() is that in the alertable case, the event loop + * will return when the system queues an I/O completion routine or + * an Asynchronous Procedure Call. + * + * @return The total number of @c ACE_Event_Handlers that were + * dispatched, 0 if the @a max_wait_time elapsed without + * dispatching any handlers, or -1 if an error occurs. + + * @note It is only possible to achieve millisecond timeout + * resolutions with the @c ACE_Dev_Poll_Reactor. + */ + virtual int handle_events (ACE_Time_Value *max_wait_time = 0); + virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); + + /** + * This method is just like the one above, except the + * @a max_wait_time value is a reference and can therefore never be + * @c NULL. + * + * @note It is only possible to achieve millisecond timeout + * resolutions with the @c ACE_Dev_Poll_Reactor. + */ + virtual int handle_events (ACE_Time_Value &max_wait_time); + virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); + + // = Event handling control. + + /** + * @return The status of Reactor. If this function returns 0, the + * reactor is actively handling events. If it returns + * non-zero, @c handle_events() and + * @c handle_alertable_events() return -1 immediately. + */ + virtual int deactivated (void); + + /** + * Control whether the Reactor will handle any more incoming events + * or not. If @a do_stop == 1, the Reactor will be disabled. By + * default, a reactor is in active state and can be + * deactivated/reactived as desired. + */ + virtual void deactivate (int do_stop); + + // = Register and remove Handlers. + + /// Register @a event_handler with @a mask. The I/O handle will + /// always come from get_handle on the event_handler. + virtual int register_handler (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /// Register @a event_handler with @a mask. The I/O handle is + /// provided through the @a io_handle parameter. + virtual int register_handler (ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /** + * Register an @a event_handler that will be notified when + * @a event_handle is signaled. @a mask specifies the network + * events that the @a event_handler is interested in. + */ + virtual int register_handler (ACE_HANDLE event_handle, + ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /// Register @a event_handler> with all the @a handles> in the @c + /// Handle_Set. + virtual int register_handler (const ACE_Handle_Set &handles, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /** + * Register @a new_sh to handle the signal @a signum using the + * @a new_disp. Returns the @a old_sh that was previously + * registered (if any), along with the @a old_disp of the signal + * handler. + */ + virtual int register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp = 0, + ACE_Event_Handler **old_sh = 0, + ACE_Sig_Action *old_disp = 0); + + /// Registers @a new_sh to handle a set of signals @a sigset using the + /// @a new_disp. + virtual int register_handler (const ACE_Sig_Set &sigset, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp = 0); + + /// Removes @a event_handler. + /** + * @note The I/O handle will be obtained using @c get_handle() + * method of @a event_handler . If @a mask == + * @c ACE_Event_Handler::DONT_CALL then the @c handle_close() + * method of the @a event_handler is not invoked. + */ + virtual int remove_handler (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /** + * Removes @a handle. If @a mask == ACE_Event_Handler::DONT_CALL + * then the method of the associated + * is not invoked. + */ + virtual int remove_handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /** + * Removes all handles in @a handle_set. If @a mask == + * ACE_Event_Handler::DONT_CALL then the method of + * the associated s is not invoked. + */ + virtual int remove_handler (const ACE_Handle_Set &handle_set, + ACE_Reactor_Mask mask); + + /** + * Remove the ACE_Event_Handler currently associated with @a signum. + * Install the new disposition (if given) and return the previous + * disposition (if desired by the caller). Returns 0 on success and + * -1 if @a signum is invalid. + */ + virtual int remove_handler (int signum, + ACE_Sig_Action *new_disp, + ACE_Sig_Action *old_disp = 0, + int sigkey = -1); + + /// Calls for every signal in @a sigset. + virtual int remove_handler (const ACE_Sig_Set &sigset); + + // = Suspend and resume Handlers. + + /// Suspend event_handler temporarily. Use + /// ACE_Event_Handler::get_handle() to get the handle. + virtual int suspend_handler (ACE_Event_Handler *event_handler); + + /// Suspend handle temporarily. + virtual int suspend_handler (ACE_HANDLE handle); + + /// Suspend all handles in handle set temporarily. + virtual int suspend_handler (const ACE_Handle_Set &handles); + + /// Suspend all handles temporarily. + virtual int suspend_handlers (void); + + /// Resume event_handler. Use ACE_Event_Handler::get_handle() to + /// get the handle. + virtual int resume_handler (ACE_Event_Handler *event_handler); + + /// Resume handle. + virtual int resume_handler (ACE_HANDLE handle); + + /// Resume all handles in handle set. + virtual int resume_handler (const ACE_Handle_Set &handles); + + /// Resume all handles. + virtual int resume_handlers (void); + + /// Does the reactor allow the application to resume the handle on + /// its own, i.e., can it pass on the control of handle resumption to + /// the application. + virtual int resumable_handler (void); + + /// Return true if we any event associations were made by the reactor + /// for the handles that it waits on, false otherwise. + virtual bool uses_event_associations (void); + + // = Timer management. + + /** + * Schedule an ACE_Event_Handler that will expire after an amount + * of time. The return value of this method, a timer_id value, + * uniquely identifies the event_handler in the ACE_Reactor's + * internal list of timers. + * This timer_id value can be used to cancel the timer + * with the cancel_timer() call. + * + * @see cancel_timer() + * @see reset_timer_interval() + * + * @param event_handler event handler to schedule on reactor + * @param arg argument passed to the handle_timeout() method of + * event_handler. + * @param delay time interval after which the timer will expire. + * @param interval time interval for which the timer will be + * automatically rescheduled. + * @return -1 on failure, a timer_id value on success + */ + virtual long schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval = ACE_Time_Value::zero); + + /** + * Resets the interval of the timer represented by @a timer_id to + * @a interval, which is specified in relative time to the current + * . If @a interval is equal to + * ACE_Time_Value::zero, the timer will become a non-rescheduling + * timer. Returns 0 if successful, -1 if not. + */ + virtual int reset_timer_interval (long timer_id, + const ACE_Time_Value &interval); + + /// Cancel all Event_Handlers that match the address of + /// @a event_handler. Returns number of handlers cancelled. + virtual int cancel_timer (ACE_Event_Handler *event_handler, + int dont_call_handle_close = 1); + + /** + * Cancel the single event handler that matches the @a timer_id value + * (which was returned from the schedule method). If @a arg is + * non-NULL then it will be set to point to the ``magic cookie'' + * argument passed in when the event handler was registered. This + * makes it possible to free up the memory and avoid memory leaks. + * Returns 1 if cancellation succeeded and 0 if the @a timer_id + * wasn't found. + */ + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1); + + // = High-level event handler scheduling operations + + /// Add @a masks_to_be_added to the @a event_handler's entry. + /// @a event_handler must already have been registered. + virtual int schedule_wakeup (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks_to_be_added); + + /// Add @a masks_to_be_added to the @a handle's entry. + /// associated with @a handle must already have been registered. + virtual int schedule_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask masks_to_be_added); + + /// Clear @a masks_to_be_cleared from the @a event_handler's entry. + virtual int cancel_wakeup (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks_to_be_cleared); + + /// Clear @a masks_to_be_cleared from the @a handle's entry. + virtual int cancel_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask masks_to_be_cleared); + + // = Notification methods. + + /** + * Notify @a event_handler of @a mask event. The ACE_Time_Value + * indicates how long to blocking trying to notify. If @a timeout == + * 0, the caller will block until action is possible, else will wait + * until the relative time specified in @a timeout elapses). + */ + virtual int notify (ACE_Event_Handler *event_handler = 0, + ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0); + + /** + * Set the maximum number of times that ACE_Reactor_Impl will + * iterate and dispatch the ACE_Event_Handlers that are passed in + * via the notify queue before breaking out of its + * loop. By default, this is set to + * -1, which means "iterate until the queue is empty." Setting this + * to a value like "1 or 2" will increase "fairness" (and thus + * prevent starvation) at the expense of slightly higher dispatching + * overhead. + */ + virtual void max_notify_iterations (int); + + /** + * Get the maximum number of times that the ACE_Reactor_Impl will + * iterate and dispatch the ACE_Event_Handlers that are passed in + * via the notify queue before breaking out of its + * loop. + */ + virtual int max_notify_iterations (void); + + /** + * Purge any notifications pending in this reactor for the specified + * ACE_Event_Handler object. Returns the number of notifications + * purged. Returns -1 on error. + */ + virtual int purge_pending_notifications (ACE_Event_Handler * = 0, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + /** + * Return the Event_Handler associated with @a handle. Return 0 if + * @a handle is not registered. + */ + virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); + + /** + * Check to see if @a handle is associated with a valid Event_Handler + * bound to @a mask. Return the @a event_handler associated with this + * @c handler if @a event_handler != 0. + */ + virtual int handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **event_handler = 0); + + /** + * Check to see if @a signum is associated with a valid Event_Handler + * bound to a signal. Return the @a event_handler associated with + * this @c handler if @a event_handler != 0. + */ + virtual int handler (int signum, + ACE_Event_Handler ** = 0); + + /// Returns true if Reactor has been successfully initialized, else + /// false. + virtual bool initialized (void); + + /// Returns the current size of the Reactor's internal descriptor + /// table. + virtual size_t size (void) const; + + /// Returns a reference to the Reactor's internal lock. + virtual ACE_Lock &lock (void); + + /// Wake up all threads waiting in the event loop. + virtual void wakeup_all_threads (void); + + /// Transfers ownership of Reactor_Impl to the new_owner. + /** + * @note There is no need to set the owner of the event loop for the + * ACE_Dev_Poll_Reactor. Multiple threads may invoke the + * event loop simulataneously. As such, this method is a + * no-op. + */ + virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0); + + /// Return the ID of the "owner" thread. + /** + * @note There is no need to set the owner of the event loop for the + * ACE_Dev_Poll_Reactor. Multiple threads may invoke the + * event loop simulataneously. As such, this method is a + * no-op. + */ + virtual int owner (ACE_thread_t *owner); + + /// Get the existing restart value. + virtual bool restart (void); + + /// Set a new value for restart and return the original value. + /** + * @param r If zero, then the event loop will not be automatically + * restarted if the underlying poll is interrupted via the + * INTR (interrupt) signal. + * + * @return Returns the previous "restart" value. + */ + virtual bool restart (bool r); + + /// Set position of the owner thread. + /** + * @note This is currently a no-op. + */ + virtual void requeue_position (int); + + /// Get position of the owner thread. + /** + * @note This is currently a no-op. + */ + virtual int requeue_position (void); + + /** + * @name Low-level wait_set mask manipulation methods + * + * Low-level methods to manipulate the event/reactor mask associated + * with a handle and event handler when polling for events. + * @par + * The "interest set," i.e. the wait set, can be directly + * manipulated with these methods. + */ + //@{ + + /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the + /// event_handler and mask. + /** + * @return Old mask on success, -1 on error. + */ + virtual int mask_ops (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + int ops); + + /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle + /// and mask. + /** + * @return Old mask on success, -1 on error. + */ + virtual int mask_ops (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + int ops); + + //@} + + /** + * @name Low-level ready_set mask manipulation methods + * + * These methods are unimplemented. + */ + //@{ + + /// GET/SET/ADD/CLR the ready "bit" bound with the event_handler + /// and mask. + virtual int ready_ops (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + int ops); + + /// GET/SET/ADD/CLR the ready "bit" bound with the handle and mask. + virtual int ready_ops (ACE_HANDLE handle, + ACE_Reactor_Mask, + int ops); + + //@} + + /// Dump the state of an object. + virtual void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + + class Token_Guard; + + /// Non-locking version of wait_pending(). + /** + * Returns non-zero if there are I/O events "ready" for dispatching, + * but does not actually dispatch the event handlers. By default, + * don't block while checking this, i.e., "poll". + * + * @note It is only possible to achieve millisecond timeout + * resolutions with the ACE_Dev_Poll_Reactor. + */ + int work_pending_i (ACE_Time_Value *max_wait_time); + + /// Poll for events and return the number of event handlers that + /// were dispatched. + /** + * This is a helper method called by all handle_events() methods. + */ + int handle_events_i (ACE_Time_Value *max_wait_time, Token_Guard &guard); + + /// Perform the upcall with the given event handler method. + int upcall (ACE_Event_Handler *event_handler, + int (ACE_Event_Handler::*callback)(ACE_HANDLE), + ACE_HANDLE handle); + + /** + * Dispatch ACE_Event_Handlers for time events, I/O events, and + * signal events. Returns the total number of ACE_Event_Handlers + * that were dispatched or -1 if something goes wrong. + */ + int dispatch (Token_Guard &guard); + + /// Dispatch a single timer, if ready. + /// Returns: 0 if no timers ready (token still held), + /// 1 if a timer was expired (token released), + /// -1 on error (token still held). + int dispatch_timer_handler (Token_Guard &guard); + + /// Dispatch an IO event to the corresponding event handler. Returns + /// Returns: 0 if no events ready (token still held), + /// 1 if an event was expired (token released), + /// -1 on error (token still held). + int dispatch_io_event (Token_Guard &guard); + + /// Register the given event handler with the reactor. + int register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *eh, + ACE_Reactor_Mask mask); + + /// Remove the event handler associated with the given handle and + /// event mask from the "interest set." If @a eh is supplied, only + /// do the remove if @eh matches the event handler that's registered + /// for @a handle. + int remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler *eh = 0); + + /// Temporarily remove the given handle from the "interest set." + int suspend_handler_i (ACE_HANDLE handle); + + /// Place the given handle that was temporarily removed from the + /// "interest set," i.e that was suspended, back in to the interest + /// set. The given handle will once again be polled for events. + int resume_handler_i (ACE_HANDLE handle); + + /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the handle + /// and mask. This internal helper method acquires no lock. + /** + * @return Old mask on success, -1 on error. + */ + int mask_ops_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + int ops); + + /// Convert a reactor mask to its corresponding poll() event mask. + short reactor_mask_to_poll_event (ACE_Reactor_Mask mask); + +protected: + + /// Has the reactor been initialized. + bool initialized_; + + /// The file descriptor associated with the open `/dev/poll' or + /// `/dev/epoll' device. + /** + * All interactions with the `/dev/poll' or `/dev/epoll' device are + * done through this file descriptor. + */ + ACE_HANDLE poll_fd_; + + /// Track HANDLES we are interested in for various events that must + /// be dispatched *without* polling. + /// ACE_Dev_Poll_Ready_Set ready_set_; + +#if defined (ACE_HAS_EVENT_POLL) + /// Event structure to be filled by epoll_wait. epoll_wait() only gets + /// one event at a time and we rely on it's internals for fairness. + /// If this struct's fd is ACE_INVALID_HANDLE, the rest is indeterminate. + /// If the fd is good, the event is one that's been retrieved by + /// epoll_wait() but not yet processed. + struct epoll_event event_; + + /// Event handlers that are suspended/resumed around upcalls are not + /// immediately resumed; they're added to this list for resumption at + /// the next epoll_wait() call. This avoids always needing to acquire the + /// token just to resume a handler. Of course, if there are no other + /// handlers in the to-be-resumed list and an epoll_wait is already in + /// progress, the reactor needs to be notified to force another run around + /// the epoll_wait() call. + typedef ACE_Array_Map Resume_Map; + Resume_Map to_be_resumed_; + volatile bool epoll_wait_in_progress_; + ACE_SYNCH_MUTEX to_be_resumed_lock_; +#else + /// The pollfd array that `/dev/poll' will feed its results to. + struct pollfd *dp_fds_; + + + /// Pointer to the next pollfd array element that contains the next + /// event to be dispatched. + struct pollfd *start_pfds_; + + /// The last element in the pollfd array plus one. + /** + * The loop that dispatches IO events stops when this->start_pfds == + * this->end_pfds_. + */ + struct pollfd *end_pfds_; +#endif /* ACE_HAS_EVENT_POLL */ + + /// This flag is used to keep track of whether we are actively handling + /// events or not. + sig_atomic_t deactivated_; + + /// Lock used for synchronization of reactor state. + ACE_Dev_Poll_Reactor_Token token_; + + /// Adapter used to return internal lock to outside world. + ACE_Lock_Adapter lock_adapter_; + + /// The repository that contains all registered event handlers. + Handler_Repository handler_rep_; + + /// Defined as a pointer to allow overriding by derived classes... + ACE_Timer_Queue *timer_queue_; + + /// Keeps track of whether we should delete the timer queue (if we + /// didn't create it, then we don't delete it). + bool delete_timer_queue_; + + /// Handle signals without requiring global/static variables. + ACE_Sig_Handler *signal_handler_; + + /// Keeps track of whether we should delete the signal handler (if we + /// didn't create it, then we don't delete it). + bool delete_signal_handler_; + + /// Callback object that unblocks the if it's + /// sleeping. + ACE_Reactor_Notify *notify_handler_; + + /// Keeps track of whether we need to delete the notify handler (if + /// we didn't create it, then we don't delete it). + bool delete_notify_handler_; + + /// Flag that determines if signals are masked during event + /// dispatching. + /** + * If 0 then the Reactor will not mask the signals during the event + * dispatching. This is useful for applications that do not + * register any signal handlers and want to reduce the overhead + * introduce by the kernel level locks required to change the mask. + */ + int mask_signals_; + + /// Restart the handle_events event loop method automatically when + /// polling function in use (ioctl() in this case) is interrupted + /// via an EINTR signal. + bool restart_; + +protected: + + /** + * @class Token_Guard + * + * @brief A helper class that helps grabbing, releasing and waiting + * on tokens for a thread that needs access to the reactor's token. + */ + class ACE_Export Token_Guard + { + public: + + /// Constructor that will grab the token for us + Token_Guard (ACE_Dev_Poll_Reactor_Token &token); + + /// Destructor. This will release the token if it hasn't been + /// released till this point + ~Token_Guard (void); + + /// Release the token .. + void release_token (void); + + /// Returns whether the thread that created this object owns the + /// token or not. + int is_owner (void); + + /// A helper method that acquires the token 1) at a low priority, and + /// 2) wait quietly for the token, not waking another thread. This + /// is appropriate for cases where a thread wants to wait for and + /// dispatch an event, not causing an existing waiter to relinquish the + /// token, and also queueing up behind other threads waiting to modify + /// event records. + int acquire_quietly (ACE_Time_Value *max_wait = 0); + + /// A helper method that acquires the token at a high priority, and + /// does wake the current token holder. + int acquire (ACE_Time_Value *max_wait = 0); + + private: + + Token_Guard (void); + + private: + + /// The Reactor token. + ACE_Dev_Poll_Reactor_Token &token_; + + /// Flag that indicate whether the thread that created this object + /// owns the token or not. A value of 0 indicates that this class + /// hasn't got the token (and hence the thread) and a value of 1 + /// vice-versa. + int owner_; + + }; + +}; + + +/** + * @class ACE_Dev_Poll_Handler_Guard + * + * @brief Class used to make event handler reference count + * manipulation exception-safe. + * + * This class makes the reference count manipulation that occurs + * during an upcall exception-safe. Prior to dispatching the event + * handler, the reference count is increased. Once the upcall for the + * given event handler is complete, its reference count will be decreased. + */ +class ACE_Dev_Poll_Handler_Guard +{ +public: + + /// Constructor + /** + * The constructor checks to see if @a eh is a reference-counted handler and + * remember that for later. If @a eh is reference counted, its reference + * count is incremented unless @a do_incr is false. + * @a do_incr should be false if the reference count was incremented + * independently of this guard, for example, on a notify handler since + * the reference count is incremented when the notify is queued. + */ + ACE_Dev_Poll_Handler_Guard (ACE_Event_Handler *eh, bool do_incr = true); + + /// Destructor + /** + * The destructor decrements the reference count on the event + * handler corresponding to the given handle. + */ + ~ACE_Dev_Poll_Handler_Guard (void); + + /// Release the event handler from this guard; when the destructor is + /// called, the handler's reference count will not be decremented. + void release (void); + +private: + + /// The event handler being managed. + ACE_Event_Handler *eh_; + + /// true if eh_ is a reference-counted handler. + bool refcounted_; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +# include "ace/Dev_Poll_Reactor.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ + +#include /**/ "ace/post.h" + +#endif /* ACE_DEV_POLL_REACTOR_H */ diff --git a/externals/ace/Dev_Poll_Reactor.inl b/externals/ace/Dev_Poll_Reactor.inl new file mode 100644 index 0000000..2008107 --- /dev/null +++ b/externals/ace/Dev_Poll_Reactor.inl @@ -0,0 +1,146 @@ +// -*- C++ -*- +// +// $Id: Dev_Poll_Reactor.inl 90177 2010-05-19 11:44:22Z vzykov $ + +#include "ace/Log_Msg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Dev_Poll_Reactor::Event_Tuple::Event_Tuple (ACE_Event_Handler *eh, + ACE_Reactor_Mask m, + bool is_suspended, + bool is_controlled) + : event_handler (eh), + mask (m), + suspended (is_suspended), + controlled (is_controlled) +{ +} + +// --------------------------------------------------------------------- + +#if 0 +ACE_INLINE +ACE_Dev_Poll_Ready_Set::ACE_Dev_Poll_Ready_Set (void) + : pfds (0), + nfds (0) +{ +} +#endif /* 0 */ + +// --------------------------------------------------------------------- + +ACE_INLINE size_t +ACE_Dev_Poll_Reactor::Handler_Repository::size (void) const +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::size"); + + return this->size_; +} + +ACE_INLINE size_t +ACE_Dev_Poll_Reactor::Handler_Repository::max_size (void) const +{ + ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::max_size"); + + return this->max_size_; +} + +// ----------------------------------------------------------------- + +ACE_INLINE +ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard + (ACE_Event_Handler *eh, + bool do_incr) + : eh_ (eh), + refcounted_ (false) +{ + if (eh == 0) + return; + + this->refcounted_ = + eh->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (do_incr && this->refcounted_) + eh->add_reference (); +} + +ACE_INLINE +ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard (void) +{ + if (this->refcounted_ && this->eh_ != 0) + this->eh_->remove_reference (); +} + +ACE_INLINE void +ACE_Dev_Poll_Handler_Guard::release (void) +{ + this->eh_ = 0; +} + +// --------------------------------------------------------------------- + +ACE_INLINE int +ACE_Dev_Poll_Reactor::upcall (ACE_Event_Handler *event_handler, + int (ACE_Event_Handler::*callback)(ACE_HANDLE), + ACE_HANDLE handle) +{ + // If the handler returns positive value (requesting a reactor + // callback) just call back as many times as the handler requests + // it. The handler is suspended internally and other threads are off + // handling other things. + int status = 0; + + do + { + status = (event_handler->*callback) (handle); + } + while (status > 0 && event_handler != this->notify_handler_); + + return status; +} + + +/************************************************************************/ +// Methods for ACE_Dev_Poll_Reactor::Token_Guard +/************************************************************************/ + +ACE_INLINE +ACE_Dev_Poll_Reactor::Token_Guard::Token_Guard (ACE_Dev_Poll_Reactor_Token &token) + + : token_ (token), + owner_ (0) +{ +} + +ACE_INLINE +ACE_Dev_Poll_Reactor::Token_Guard::~Token_Guard (void) +{ + if (this->owner_ == 1) + { + ACE_MT (this->token_.release ()); + this->owner_ = 0; + } +} + +ACE_INLINE void +ACE_Dev_Poll_Reactor::Token_Guard::release_token (void) +{ + if (this->owner_) + { + ACE_MT (this->token_.release ()); + + // We are not the owner anymore.. + this->owner_ = 0; + } +} + +ACE_INLINE int +ACE_Dev_Poll_Reactor::Token_Guard::is_owner (void) +{ + return this->owner_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dirent.cpp b/externals/ace/Dirent.cpp new file mode 100644 index 0000000..df1290e --- /dev/null +++ b/externals/ace/Dirent.cpp @@ -0,0 +1,7 @@ +// $Id: Dirent.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Dirent.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Dirent.inl" +#endif /* __ACE_INLINE__ */ diff --git a/externals/ace/Dirent.h b/externals/ace/Dirent.h new file mode 100644 index 0000000..8d15e53 --- /dev/null +++ b/externals/ace/Dirent.h @@ -0,0 +1,122 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dirent.h + * + * $Id: Dirent.h 84316 2009-02-03 19:46:05Z johnnyw $ + * + * Define a portable C++ interface to ACE_OS_Dirent directory-entry + * manipulation. + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_DIRENT_H +#define ACE_DIRENT_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_dirent.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Dirent + * + * @brief Define a portable C++ directory-entry iterator based on the POSIX API. + */ +class ACE_Export ACE_Dirent +{ +public: + // = Initialization and termination methods. + /// Default constructor. + ACE_Dirent (void); + + /// Constructor calls @c opendir() + explicit ACE_Dirent (const ACE_TCHAR *dirname); + + /// Opens the directory named by filename and associates a directory + /// stream with it. + int open (const ACE_TCHAR *filename); + + /// Destructor calls @c closedir(). + ~ACE_Dirent (void); + + /// Closes the directory stream and frees the ACE_DIR structure. + void close (void); + + // = Iterator methods. + /** + * Returns a pointer to a structure representing the directory entry + * at the current position in the directory stream to which dirp + * refers, and positions the directory stream at the next entry, + * except on read-only filesystems. It returns a NULL pointer upon + * reaching the end of the directory stream, or upon detecting an + * invalid location in the directory. shall not return + * directory entries containing empty names. It is unspecified + * whether entries are returned for dot or dot-dot. The pointer + * returned by points to data that may be overwritten by + * another call to on the same directory stream. This + * data shall not be overwritten by another call to on a + * different directory stream. may buffer several + * directory entries per actual read operation; marks for + * update the st_atime field of the directory each time the + * directory is actually read. + */ + ACE_DIRENT *read (void); + + /** + * Has the equivalent functionality as except that an + * @a entry and @a result buffer must be supplied by the caller to + * store the result. + */ + int read (struct ACE_DIRENT *entry, + struct ACE_DIRENT **result); + + // = Manipulators. + /// Returns the current location associated with the directory + /// stream. + long tell (void); + + /** + * Sets the position of the next operation on the + * directory stream. The new position reverts to the position + * associated with the directory stream at the time the + * operation that provides loc was performed. Values returned by + * are good only for the lifetime of the pointer from + * which they are derived. If the directory is closed and then + * reopened, the value may be invalidated due to + * undetected directory compaction. It is safe to use a previous + * value immediately after a call to and before + * any calls to readdir. + */ + void seek (long loc); + + /** + * Resets the position of the directory stream to the beginning of + * the directory. It also causes the directory stream to refer to + * the current state of the corresponding directory, as a call to + * would. + */ + void rewind (void); + +private: + /// Pointer to the directory stream. + ACE_DIR *dirp_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Dirent.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_DIRENT_H */ diff --git a/externals/ace/Dirent.inl b/externals/ace/Dirent.inl new file mode 100644 index 0000000..01ce3a9 --- /dev/null +++ b/externals/ace/Dirent.inl @@ -0,0 +1,99 @@ +// -*- C++ -*- +// +// $Id: Dirent.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Log_Msg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_Dirent::open (const ACE_TCHAR *dirname) +{ + // If the directory stream is already open, close it to prevent + // possible resource leaks. + + if (this->dirp_ != 0) + { + ACE_OS::closedir (this->dirp_); + this->dirp_ = 0; + } + + this->dirp_ = ACE_OS::opendir (dirname); + + if (this->dirp_ == 0) + return -1; + else + return 0; +} + +ACE_INLINE +ACE_Dirent::ACE_Dirent (void) + : dirp_ (0) +{ +} + +ACE_INLINE +ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname) + : dirp_ (0) +{ + if (this->open (dirname) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Dirent::ACE_Dirent"))); +} + +ACE_INLINE +ACE_Dirent::~ACE_Dirent (void) +{ + if (this->dirp_ != 0) + ACE_OS::closedir (this->dirp_); +} + +ACE_INLINE ACE_DIRENT * +ACE_Dirent::read (void) +{ + return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0; +} + +ACE_INLINE int +ACE_Dirent::read (struct ACE_DIRENT *entry, + struct ACE_DIRENT **result) +{ + return this->dirp_ + ? ACE_OS::readdir_r (this->dirp_, entry, result) + : 0; +} + +ACE_INLINE void +ACE_Dirent::close (void) +{ + if (this->dirp_ != 0) + { + ACE_OS::closedir (this->dirp_); + + // Prevent double closure + this->dirp_ = 0; + } +} + +ACE_INLINE void +ACE_Dirent::rewind (void) +{ + if (this->dirp_) + ACE_OS::rewinddir (this->dirp_); +} + +ACE_INLINE void +ACE_Dirent::seek (long loc) +{ + if (this->dirp_) + ACE_OS::seekdir (this->dirp_, loc); +} + +ACE_INLINE long +ACE_Dirent::tell (void) +{ + return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dirent_Selector.cpp b/externals/ace/Dirent_Selector.cpp new file mode 100644 index 0000000..8fcb577 --- /dev/null +++ b/externals/ace/Dirent_Selector.cpp @@ -0,0 +1,59 @@ +// $Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Dirent_Selector.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Dirent_Selector.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/OS_NS_dirent.h" +#include "ace/OS_NS_stdlib.h" + +ACE_RCSID (ace, + Dirent_Selector, + "$Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Construction/Destruction + +ACE_Dirent_Selector::ACE_Dirent_Selector (void) + : namelist_ (0), + n_ (0) +{ +} + +ACE_Dirent_Selector::~ACE_Dirent_Selector (void) +{ + // Free up any allocated resources. + this->close(); +} + +int +ACE_Dirent_Selector::open (const ACE_TCHAR *dir, + ACE_SCANDIR_SELECTOR sel, + ACE_SCANDIR_COMPARATOR cmp) +{ + n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp); + return n_; +} + +int +ACE_Dirent_Selector::close (void) +{ + for (--n_; n_ >= 0; --n_) + { +#if defined (ACE_LACKS_STRUCT_DIR) + // Only the lacking-struct-dir emulation allocates this. Native + // scandir includes d_name in the dirent struct itself. + ACE_OS::free (this->namelist_[n_]->d_name); +#endif + ACE_OS::free (this->namelist_[n_]); + } + + ACE_OS::free (this->namelist_); + this->namelist_ = 0; + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dirent_Selector.h b/externals/ace/Dirent_Selector.h new file mode 100644 index 0000000..20673c4 --- /dev/null +++ b/externals/ace/Dirent_Selector.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dirent_Selector.h + * + * $Id: Dirent_Selector.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Define a portable C++ interface to the method. + * + * @author Rich Newman + */ +//============================================================================= + +#ifndef ACE_DIRENT_SELECTOR_H +#define ACE_DIRENT_SELECTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_dirent.h" /* Need ACE_SCANDIR_SELECTOR, COMPARATOR */ +#include "ace/os_include/os_dirent.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Dirent_Selector + * + * @brief Define a portable C++ directory-entry iterator based on the + * POSIX scandir API. + */ +class ACE_Export ACE_Dirent_Selector +{ +public: + /// Constructor + ACE_Dirent_Selector (void); + + /// Destructor. + virtual ~ACE_Dirent_Selector (void); + + /// Return the length of the list of matching directory entries. + int length (void) const; + + /// Return the entry at @a index. + ACE_DIRENT *operator[] (const int index) const; + + /// Free up resources. + int close (void); + + /// Open the directory @a dir and populate the current list of names with + /// directory entries that match the @a selector and @a comparator. + int open (const ACE_TCHAR *dir, + ACE_SCANDIR_SELECTOR selector = 0, + ACE_SCANDIR_COMPARATOR comparator = 0); + +protected: + /// Ptr to the namelist array. + ACE_DIRENT **namelist_; + + /// Number of entries in the array. + int n_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Dirent_Selector.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_DIRENT_SELECTOR_H */ diff --git a/externals/ace/Dirent_Selector.inl b/externals/ace/Dirent_Selector.inl new file mode 100644 index 0000000..15f8047 --- /dev/null +++ b/externals/ace/Dirent_Selector.inl @@ -0,0 +1,19 @@ +// -*- C++ -*- +// +// $Id: Dirent_Selector.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_Dirent_Selector::length (void) const +{ + return n_; +} + +ACE_INLINE ACE_DIRENT * +ACE_Dirent_Selector::operator[] (const int n) const +{ + return this->namelist_[n]; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dump.cpp b/externals/ace/Dump.cpp new file mode 100644 index 0000000..6e5c2d0 --- /dev/null +++ b/externals/ace/Dump.cpp @@ -0,0 +1,141 @@ +// $Id: Dump.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Dump.h" +#include "ace/Guard_T.h" +#include "ace/Thread_Mutex.h" +#include "ace/Object_Manager.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, Dump, "$Id: Dump.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Implementations (very simple for now...) + +ACE_Dumpable::~ACE_Dumpable (void) +{ + ACE_TRACE ("ACE_Dumpable::~ACE_Dumpable"); +} + +ACE_Dumpable::ACE_Dumpable (const void *this_ptr) + : this_ (this_ptr) +{ + ACE_TRACE ("ACE_Dumpable::ACE_Dumpable"); +} + +ACE_Dumpable_Ptr::ACE_Dumpable_Ptr (const ACE_Dumpable *dumper) + : dumper_ (dumper) +{ + ACE_TRACE ("ACE_Dumpable_Ptr::ACE_Dumpable_Ptr"); +} + +const ACE_Dumpable * +ACE_Dumpable_Ptr::operator->() const +{ + ACE_TRACE ("ACE_Dumpable_Ptr::operator->"); + return this->dumper_; +} + +void +ACE_Dumpable_Ptr::operator= (const ACE_Dumpable *dumper) const +{ + ACE_TRACE ("ACE_Dumpable_Ptr::operator="); + if (this->dumper_ != dumper) + { + delete const_cast (this->dumper_); + (const_cast (this))->dumper_ = dumper; + } +} + +ACE_ODB::ACE_ODB (void) + // Let the Tuple default constructor initialize object_table_ + : current_size_ (0) +{ + ACE_TRACE ("ACE_ODB::ACE_ODB"); +} + +ACE_ODB * +ACE_ODB::instance (void) +{ + ACE_TRACE ("ACE_ODB::instance"); + + if (ACE_ODB::instance_ == 0) + { + ACE_MT (ACE_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_DUMP_LOCK); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); + + if (ACE_ODB::instance_ == 0) + ACE_NEW_RETURN (ACE_ODB::instance_, + ACE_ODB, + 0); + } + + return ACE_ODB::instance_; +} + +void +ACE_ODB::dump_objects (void) +{ + ACE_TRACE ("ACE_ODB::dump_objects"); + for (int i = 0; i < this->current_size_; i++) + { + if (this->object_table_[i].this_ != 0) + // Dump the state of the object. + this->object_table_[i].dumper_->dump (); + } +} + +// This method registers a new . It detects +// duplicates and simply overwrites them. + +void +ACE_ODB::register_object (const ACE_Dumpable *dumper) +{ + ACE_TRACE ("ACE_ODB::register_object"); + int i; + int slot = 0; + + for (i = 0; i < this->current_size_; i++) + { + if (this->object_table_[i].this_ == 0) + slot = i; + else if (this->object_table_[i].this_ == dumper->this_) + { + slot = i; + break; + } + } + + if (i == this->current_size_) + { + slot = this->current_size_++; + ACE_ASSERT (this->current_size_ < ACE_ODB::MAX_TABLE_SIZE); + } + this->object_table_[slot].this_ = dumper->this_; + this->object_table_[slot].dumper_ = dumper; +} + +void +ACE_ODB::remove_object (const void *this_ptr) +{ + ACE_TRACE ("ACE_ODB::remove_object"); + int i; + + for (i = 0; i < this->current_size_; i++) + { + if (this->object_table_[i].this_ == this_ptr) + break; + } + + if (i < this->current_size_) + { + this->object_table_[i].this_ = 0; + this->object_table_[i].dumper_ = 0; + } +} + +ACE_ODB *ACE_ODB::instance_ = 0; + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dump.h b/externals/ace/Dump.h new file mode 100644 index 0000000..4ccd64a --- /dev/null +++ b/externals/ace/Dump.h @@ -0,0 +1,172 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Dump.h + * + * $Id: Dump.h 80826 2008-03-04 14:51:23Z wotte $ + * + * + * A prototype mechanism that allow all ACE objects to be registered + * with a central in-memory "database" that can dump the state of all + * live ACE objects (e.g., from within a debugger). + * + * The macros which allow easy registration and removal of objects to be + * dumped (ACE_REGISTER_OBJECT and ACE_REMOVE_OBJECT) are turned into + * no-ops by compiling with the ACE_NDEBUG macro defined. This allows + * usage to be removed in "release mode" builds without changing code. + * + * There are several interesting aspects to this design: + * + * 1. It uses the External Polymorphism pattern to avoid having to + * derive all ACE classes from a common base class that has virtual + * methods (this is crucial to avoid unnecessary overhead). In + * addition, there is no additional space added to ACE objects + * (this is crucial to maintain binary layout compatibility). + * + * 2. This mechanism can be conditionally compiled in order to + * completely disable this feature entirely. Moreover, by + * using macros there are relatively few changes to ACE code. + * + * 3. This mechanism copes with single-inheritance hierarchies of + * dumpable classes. In such cases we typically want only one + * dump, corresponding to the most derived instance. Thanks to + * Christian Millour (chris@etca.fr) for illustrating how to do + * this. Note, however, that this scheme doesn't generalize to + * work with multiple-inheritance or virtual base classes. + * + * Future work includes: + * + * 1. Using a dynamic object table rather than a static table + * + * 2. Adding support to allow particular classes of objects to + * be selectively dumped. + * + * + * @author Doug Schmidt + */ +//============================================================================= + + +#ifndef ACE_DUMP_H +#define ACE_DUMP_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Dumpable + * + * @brief Base class that defines a uniform interface for all object + * dumping. + */ +class ACE_Export ACE_Dumpable +{ +public: + friend class ACE_ODB; + friend class ACE_Dumpable_Ptr; + + /// Constructor. + ACE_Dumpable (const void *); + + /// This pure virtual method must be filled in by a subclass. + virtual void dump (void) const = 0; + +protected: + virtual ~ACE_Dumpable (void); + +private: + /// Pointer to the object that is being stored. + const void *this_; +}; + +/** + * @class ACE_Dumpable_Ptr + * + * @brief A smart pointer stored in the in-memory object database + * ACE_ODB. The pointee (if any) is deleted when reassigned. + */ +class ACE_Export ACE_Dumpable_Ptr +{ +public: + ACE_Dumpable_Ptr (const ACE_Dumpable *dumper = 0); + const ACE_Dumpable *operator->() const; + void operator= (const ACE_Dumpable *dumper) const; + +private: + /// "Real" pointer to the underlying abstract base class + /// pointer that does the real work. + const ACE_Dumpable *dumper_; +}; + +/** + * @class ACE_ODB + * + * @brief This is the object database (ODB) that keeps track of all + * live ACE objects. + */ +class ACE_Export ACE_ODB +{ +public: + /// @todo This is clearly inadequate and should be dynamic... + enum {MAX_TABLE_SIZE = 100000}; + + /// Iterates through the entire set of registered objects and + /// dumps their state. + void dump_objects (void); + + /// Add the tuple to the list of registered ACE objects. + void register_object (const ACE_Dumpable *dumper); + + /// Use to locate and remove the associated from the + /// list of registered ACE objects. + void remove_object (const void *this_); + + /// Interface to the Singleton instance of the object database. + static ACE_ODB *instance (void); + +private: + ACE_ODB (void); // Ensure we have a Singleton... + + struct Tuple + { + /// Pointer to the object that is registered. + const void *this_; + + /// Smart pointer to the ACE_Dumpable object associated with this_. + /// This uses an ACE_Dumpable_Ptr, instead of a bare pointer, to + /// cope with hierarchies of dumpable classes. In such cases we + /// typically want only one dump, corresponding to the most derived + /// instance. To achieve this, the handle registered for the + /// subobject corresponding to the base class is destroyed (hence + /// on destruction of the subobject its handle won't exist anymore + /// and we'll have to check for that). + const ACE_Dumpable_Ptr dumper_; + + Tuple (void) : dumper_(0) {} + }; + + /// Singleton instance of this class. + static ACE_ODB *instance_; + + /// The current implementation is very simple-minded and will be + /// changed to be dynamic. + Tuple object_table_[ACE_ODB::MAX_TABLE_SIZE]; + + /// Current size of . + int current_size_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +// Include the templates classes at this point. +#include "ace/Dump_T.h" + +#include /**/ "ace/post.h" +#endif /* ACE_DUMP_H */ diff --git a/externals/ace/Dump_T.cpp b/externals/ace/Dump_T.cpp new file mode 100644 index 0000000..da2b62a --- /dev/null +++ b/externals/ace/Dump_T.cpp @@ -0,0 +1,48 @@ +// Dump_T.cpp +// +// $Id: Dump_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_DUMP_T_CPP +#define ACE_DUMP_T_CPP + +#include "ace/Dump_T.h" +#include "ace/Global_Macros.h" +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Dumpable_Adapter::~ACE_Dumpable_Adapter (void) +{ + ACE_TRACE ("ACE_Dumpable_Adapter::~ACE_Dumpable_Adapter"); +} + +template +ACE_Dumpable_Adapter::ACE_Dumpable_Adapter (const Concrete *t) + : ACE_Dumpable ((const void *) t), this_ (t) +{ + ACE_TRACE ("ACE_Dumpable_Adapter::ACE_Dumpable_Adapter"); +} + +template Concrete * +ACE_Dumpable_Adapter::operator->() const +{ + return (Concrete *) this->this_; +} + +template void +ACE_Dumpable_Adapter::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Dumpable_Adapter::dump"); + this->this_->dump (); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_DUMP_T_CPP */ diff --git a/externals/ace/Dump_T.h b/externals/ace/Dump_T.h new file mode 100644 index 0000000..92b57ad --- /dev/null +++ b/externals/ace/Dump_T.h @@ -0,0 +1,82 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dump_T.h + * + * $Id: Dump_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//============================================================================= + + +#ifndef ACE_DUMP_T_H +#define ACE_DUMP_T_H +#include /**/ "ace/pre.h" + +#include "ace/Dump.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Dumpable_Adapter + * + * @brief This class inherits the interface of the abstract ACE_Dumpable + * class and is instantiated with the implementation of the + * concrete component class . + * + * This design is similar to the Adapter and Decorator patterns + * from the ``Gang of Four'' book. Note that + * need not inherit from a common class since ACE_Dumpable + * provides the uniform virtual interface! + */ +template +class ACE_Dumpable_Adapter : public ACE_Dumpable +{ +public: + // = Initialization and termination methods. + ACE_Dumpable_Adapter (const Concrete *t); + ~ACE_Dumpable_Adapter (void); + + /// Concrete dump method (simply delegates to the method of + /// ). + virtual void dump (void) const; + + /// Delegate to methods in the Concrete class. + Concrete *operator->() const; + +private: + /// Pointer to @c this of . + const Concrete *this_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +// Some useful macros for conditionally compiling this feature... +#if defined (ACE_NDEBUG) +#define ACE_REGISTER_OBJECT(CLASS) +#define ACE_REMOVE_OBJECT +#else +#define ACE_REGISTER_OBJECT(CLASS) \ + ACE_ODB::instance ()->register_object \ + (new ACE_Dumpable_Adapter (this)); +#define ACE_REMOVE_OBJECT \ + ACE_ODB::instance ()->remove_object \ + ((void *) this); +#endif /* ACE_NDEBUG */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Dump_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Dump_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_DUMP_T_H */ diff --git a/externals/ace/Dynamic.cpp b/externals/ace/Dynamic.cpp new file mode 100644 index 0000000..4eaedad --- /dev/null +++ b/externals/ace/Dynamic.cpp @@ -0,0 +1,34 @@ +// $Id: Dynamic.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Dynamic.h" +#include "ace/Singleton.h" +#include "ace/TSS_T.h" +#include "ace/Synch_Traits.h" +#include "ace/Null_Mutex.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Dynamic.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Dynamic, "$Id: Dynamic.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Dynamic::ACE_Dynamic (void) + : is_dynamic_ (false) +{ + ACE_TRACE ("ACE_Dynamic::ACE_Dynamic"); +} + +/* static */ ACE_Dynamic * +ACE_Dynamic::instance (void) +{ + return ACE_TSS_Singleton::instance (); +} + +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +template ACE_TSS_Singleton * + ACE_TSS_Singleton::singleton_; +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dynamic.h b/externals/ace/Dynamic.h new file mode 100644 index 0000000..70dfcd8 --- /dev/null +++ b/externals/ace/Dynamic.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Dynamic.h + * + * $Id: Dynamic.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + * @author Irfan Pyarali. + */ +//========================================================================== + +#ifndef ACE_DYNAMIC_H +#define ACE_DYNAMIC_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Dynamic + * + * @brief Checks to see if an object was dynamically allocated. + * + * This class holds the pointer in a thread-safe manner between + * the call to operator new and the call to the constructor. + */ +class ACE_Export ACE_Dynamic +{ +public: + // = Initialization and termination method. + /// Constructor. + ACE_Dynamic (void); + + /// Destructor. + ~ACE_Dynamic (void); + + /** + * Sets a flag that indicates that the object was dynamically + * created. This method is usually called in operator new and then + * checked and reset in the constructor. + */ + void set (void); + + /// @c true if we were allocated dynamically, else @c false. + bool is_dynamic (void); + + /// Resets state flag. + void reset (void); + + static ACE_Dynamic *instance (void); + +private: + /** + * Flag that indicates that the object was dynamically created. This + * method is usually called in operator new and then checked and + * reset in the constructor. + */ + bool is_dynamic_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Dynamic.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_DYNAMIC_H */ diff --git a/externals/ace/Dynamic.inl b/externals/ace/Dynamic.inl new file mode 100644 index 0000000..1e8e968 --- /dev/null +++ b/externals/ace/Dynamic.inl @@ -0,0 +1,34 @@ +// -*- C++ -*- +// +// $Id: Dynamic.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Dynamic::~ACE_Dynamic (void) +{ + // ACE_TRACE ("ACE_Dynamic::~ACE_Dynamic"); +} + +ACE_INLINE void +ACE_Dynamic::set (void) +{ + // ACE_TRACE ("ACE_Dynamic::set"); + this->is_dynamic_ = true; +} + +ACE_INLINE bool +ACE_Dynamic::is_dynamic (void) +{ + // ACE_TRACE ("ACE_Dynamic::is_dynamic"); + return this->is_dynamic_; +} + +ACE_INLINE void +ACE_Dynamic::reset (void) +{ + // ACE_TRACE ("ACE_Dynamic::reset"); + this->is_dynamic_ = false; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dynamic_Message_Strategy.cpp b/externals/ace/Dynamic_Message_Strategy.cpp new file mode 100644 index 0000000..bce5865 --- /dev/null +++ b/externals/ace/Dynamic_Message_Strategy.cpp @@ -0,0 +1,205 @@ +#include "ace/Dynamic_Message_Strategy.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Dynamic_Message_Strategy.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" +#include "ace/Malloc_Base.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ace, + Dynamic_Message_Strategy, + "$Id: Dynamic_Message_Strategy.cpp 84565 2009-02-23 08:20:39Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// ctor + +ACE_Dynamic_Message_Strategy::ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask, + unsigned long static_bit_field_shift, + unsigned long dynamic_priority_max, + unsigned long dynamic_priority_offset) + : static_bit_field_mask_ (static_bit_field_mask), + static_bit_field_shift_ (static_bit_field_shift), + dynamic_priority_max_ (dynamic_priority_max), + dynamic_priority_offset_ (dynamic_priority_offset), + max_late_ (0, dynamic_priority_offset - 1), + min_pending_ (0, dynamic_priority_offset), + pending_shift_ (0, dynamic_priority_max) +{ +} + +// dtor + +ACE_Dynamic_Message_Strategy::~ACE_Dynamic_Message_Strategy (void) +{ +} + +ACE_Dynamic_Message_Strategy::Priority_Status +ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb, + const ACE_Time_Value & tv) +{ + // default the message to have pending priority status + Priority_Status status = ACE_Dynamic_Message_Strategy::PENDING; + + // start with the passed absolute time as the message's priority, then + // call the polymorphic hook method to (at least partially) convert + // the absolute time and message attributes into the message's priority + ACE_Time_Value priority (tv); + convert_priority (priority, mb); + + // if the priority is negative, the message is pending + if (priority < ACE_Time_Value::zero) + { + // priority for pending messages must be shifted + // upward above the late priority range + priority += pending_shift_; + if (priority < min_pending_) + priority = min_pending_; + } + // otherwise, if the priority is greater than the maximum late + // priority value that can be represented, it is beyond late + else if (priority > max_late_) + { + // all messages that are beyond late are assigned lowest priority (zero) + mb.msg_priority (0); + return ACE_Dynamic_Message_Strategy::BEYOND_LATE; + } + // otherwise, the message is late, but its priority is correct + else + status = ACE_Dynamic_Message_Strategy::LATE; + + // use (fast) bitwise operators to isolate and replace + // the dynamic portion of the message's priority + mb.msg_priority((mb.msg_priority() & static_bit_field_mask_) | + ((priority.usec () + + ACE_ONE_SECOND_IN_USECS * (suseconds_t)(priority.sec())) << + static_bit_field_shift_)); + + // returns the priority status of the message + return status; +} + + +// Dump the state of the strategy. + +void +ACE_Dynamic_Message_Strategy::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Dynamic_Message_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("static_bit_field_mask_ = %u\n") + ACE_TEXT ("static_bit_field_shift_ = %u\n") + ACE_TEXT ("dynamic_priority_max_ = %u\n") + ACE_TEXT ("dynamic_priority_offset_ = %u\n") + ACE_TEXT ("max_late_ = [%d sec, %d usec]\n") + ACE_TEXT ("min_pending_ = [%d sec, %d usec]\n") + ACE_TEXT ("pending_shift_ = [%d sec, %d usec]\n"), + this->static_bit_field_mask_, + this->static_bit_field_shift_, + this->dynamic_priority_max_, + this->dynamic_priority_offset_, + this->max_late_.sec (), + this->max_late_.usec (), + this->min_pending_.sec (), + this->min_pending_.usec (), + this->pending_shift_.sec (), + this->pending_shift_.usec ())); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Deadline_Message_Strategy::ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask, + unsigned long static_bit_field_shift, + unsigned long dynamic_priority_max, + unsigned long dynamic_priority_offset) + : ACE_Dynamic_Message_Strategy (static_bit_field_mask, + static_bit_field_shift, + dynamic_priority_max, + dynamic_priority_offset) +{ +} + +ACE_Deadline_Message_Strategy::~ACE_Deadline_Message_Strategy (void) +{ +} + +void +ACE_Deadline_Message_Strategy::convert_priority (ACE_Time_Value & priority, + const ACE_Message_Block & mb) +{ + // Convert absolute time passed in tv to negative time + // to deadline of mb with respect to that absolute time. + priority -= mb.msg_deadline_time (); +} + // dynamic priority conversion function based on time to deadline + +void +ACE_Deadline_Message_Strategy::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Deadline_Message_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dynamic_Message_Strategy base class:\n"))); + this->ACE_Dynamic_Message_Strategy::dump (); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nderived class: ACE_Deadline_Message_Strategy\n"))); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Laxity_Message_Strategy::ACE_Laxity_Message_Strategy (unsigned long static_bit_field_mask, + unsigned long static_bit_field_shift, + unsigned long dynamic_priority_max, + unsigned long dynamic_priority_offset) + : ACE_Dynamic_Message_Strategy (static_bit_field_mask, + static_bit_field_shift, + dynamic_priority_max, + dynamic_priority_offset) +{ +} + +ACE_Laxity_Message_Strategy::~ACE_Laxity_Message_Strategy (void) +{ +} + +void +ACE_Laxity_Message_Strategy::convert_priority (ACE_Time_Value & priority, + const ACE_Message_Block & mb) +{ + // Convert absolute time passed in tv to negative + // laxity of mb with respect to that absolute time. + priority += mb.msg_execution_time (); + priority -= mb.msg_deadline_time (); +} + // dynamic priority conversion function based on laxity + +void +ACE_Laxity_Message_Strategy::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Laxity_Message_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dynamic_Message_Strategy base class:\n"))); + this->ACE_Dynamic_Message_Strategy::dump (); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nderived class: ACE_Laxity_Message_Strategy\n"))); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + // Dump the state of the strategy. + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dynamic_Message_Strategy.h b/externals/ace/Dynamic_Message_Strategy.h new file mode 100644 index 0000000..090ad3a --- /dev/null +++ b/externals/ace/Dynamic_Message_Strategy.h @@ -0,0 +1,217 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Dynamic_Message_Strategy.h + * + * $Id: Dynamic_Message_Strategy.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_DYNAMIC_MESSAGE_STRATEGY_H +#define ACE_DYNAMIC_MESSAGE_STRATEGY_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Message_Block.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Dynamic_Message_Strategy + * + * @brief An abstract base class which provides dynamic priority + * evaluation methods for use by the ACE_Dynamic_Message_Queue + * class or any other class which needs to manage the priorities + * of a collection of ACE_Message_Blocks dynamically. + * + * Methods for deadline and laxity based priority evaluation are + * provided. These methods assume a specific partitioning of + * the message priority number into a higher order dynamic bit + * field and a lower order static priority bit field. The + * default partitioning assumes an unsigned dynamic message + * priority field of 22 bits and an unsigned static message + * priority field of 10 bits. This corresponds to the initial + * values of the static class members. To provide a different + * partitioning, assign a different set of values to the static + * class memebers before using the static member functions. + */ +class ACE_Export ACE_Dynamic_Message_Strategy +{ +public: + + // = Message priority status + + // Values are defined as bit flags so that status combinations may + // be specified easily. + + enum Priority_Status + { + /// Message can still make its deadline + PENDING = 0x01, + /// Message cannot make its deadline + LATE = 0x02, + /// Message is so late its priority is undefined + BEYOND_LATE = 0x04, + /// Mask to match any priority status + ANY_STATUS = 0x07 + }; + + /// Constructor. + ACE_Dynamic_Message_Strategy (unsigned long static_bit_field_mask, + unsigned long static_bit_field_shift, + unsigned long dynamic_priority_max, + unsigned long dynamic_priority_offset); + + /// Virtual destructor. + virtual ~ACE_Dynamic_Message_Strategy (void); + + /// Updates the message's priority and returns its priority status. + Priority_Status priority_status (ACE_Message_Block &mb, + const ACE_Time_Value &tv); + + /// Get static bit field mask. + unsigned long static_bit_field_mask (void) const; + + /// Set static bit field mask. + void static_bit_field_mask (unsigned long); + + /// Get left shift value to make room for static bit field. + unsigned long static_bit_field_shift (void) const; + + /// Set left shift value to make room for static bit field. + void static_bit_field_shift (unsigned long); + + /// Get maximum supported priority value. + unsigned long dynamic_priority_max (void) const; + + /// Set maximum supported priority value. + void dynamic_priority_max (unsigned long); + + /// Get offset to boundary between signed range and unsigned range. + unsigned long dynamic_priority_offset (void) const; + + /// Set offset to boundary between signed range and unsigned range. + void dynamic_priority_offset (unsigned long); + + /// Dump the state of the strategy. + virtual void dump (void) const; + +protected: + /// Hook method for dynamic priority conversion. + virtual void convert_priority (ACE_Time_Value &priority, + const ACE_Message_Block &mb) = 0; + + /// This is a bit mask with all ones in the static bit field. + unsigned long static_bit_field_mask_; + + /** + * This is a left shift value to make room for static bit field: + * this value should be the logarithm base 2 of + * (static_bit_field_mask_ + 1). + */ + unsigned long static_bit_field_shift_; + + /// Maximum supported priority value. + unsigned long dynamic_priority_max_; + + /// Offset to boundary between signed range and unsigned range. + unsigned long dynamic_priority_offset_; + + /// Maximum late time value that can be represented. + ACE_Time_Value max_late_; + + /// Minimum pending time value that can be represented. + ACE_Time_Value min_pending_; + + /// Time value by which to shift pending priority. + ACE_Time_Value pending_shift_; +}; + +/** + * @class ACE_Deadline_Message_Strategy + * + * @brief Deadline based message priority strategy. + * + * Assigns dynamic message priority according to time to deadline. The + * message priority is divided into high and low order bit fields. The + * high order bit field is used for dynamic message priority, which is + * updated whenever the convert_priority() method is called. The + * low order bit field is used for static message priority and is left + * unchanged. The partitioning of the priority value into high and low + * order bit fields is done according to the arguments passed to the + * strategy object's constructor. + */ +class ACE_Export ACE_Deadline_Message_Strategy : public ACE_Dynamic_Message_Strategy +{ +public: + /// Ctor, with all arguments defaulted. + ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1 + unsigned long static_bit_field_shift = 10, // 10 low order bits + unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1 + unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1) + + /// Virtual dtor. + virtual ~ACE_Deadline_Message_Strategy (void); + + /// Dynamic priority conversion function based on time to deadline. + virtual void convert_priority (ACE_Time_Value &priority, + const ACE_Message_Block &mb); + + /// Dump the state of the strategy. + virtual void dump (void) const; +}; + +/** + * @class ACE_Laxity_Message_Strategy + * + * @brief Laxity based message priority strategy. + * + * Assigns dynamic message priority according to laxity (time to + * deadline minus worst case execution time). The message priority is + * divided into high and low order bit fields. The high order + * bit field is used for dynamic message priority, which is + * updated whenever the convert_priority() method is called. The + * low order bit field is used for static message priority and is left + * unchanged. The partitioning of the priority value into high and low + * order bit fields is done according to the arguments passed to the + * strategy object's constructor. + */ +class ACE_Export ACE_Laxity_Message_Strategy : public ACE_Dynamic_Message_Strategy +{ +public: + /// Ctor, with all arguments defaulted. + ACE_Laxity_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1 + unsigned long static_bit_field_shift = 10, // 10 low order bits + unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1 + unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1) + + /// virtual dtor. + virtual ~ACE_Laxity_Message_Strategy (void); + + /// Dynamic priority conversion function based on laxity. + virtual void convert_priority (ACE_Time_Value &priority, + const ACE_Message_Block &mb); + + /// Dump the state of the strategy. + virtual void dump (void) const; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Dynamic_Message_Strategy.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_DYNAMIC_MESSAGE_STRATEGY_H */ diff --git a/externals/ace/Dynamic_Message_Strategy.inl b/externals/ace/Dynamic_Message_Strategy.inl new file mode 100644 index 0000000..9742a07 --- /dev/null +++ b/externals/ace/Dynamic_Message_Strategy.inl @@ -0,0 +1,75 @@ +// -*- C++ -*- +// +// $Id: Dynamic_Message_Strategy.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE unsigned long +ACE_Dynamic_Message_Strategy::static_bit_field_mask (void) const +{ + return static_bit_field_mask_; +} + // get static bit field mask + +ACE_INLINE void +ACE_Dynamic_Message_Strategy::static_bit_field_mask (unsigned long ul) +{ + static_bit_field_mask_ = ul; +} + // set static bit field mask + +ACE_INLINE unsigned long +ACE_Dynamic_Message_Strategy::static_bit_field_shift (void) const +{ + return static_bit_field_shift_; +} + // get left shift value to make room for static bit field + +ACE_INLINE void +ACE_Dynamic_Message_Strategy::static_bit_field_shift (unsigned long ul) +{ + static_bit_field_shift_ = ul; +} + // set left shift value to make room for static bit field + +ACE_INLINE unsigned long +ACE_Dynamic_Message_Strategy::dynamic_priority_max (void) const +{ + return dynamic_priority_max_; +} + // get maximum supported priority value + +ACE_INLINE void +ACE_Dynamic_Message_Strategy::dynamic_priority_max (unsigned long ul) +{ + // pending_shift_ depends on dynamic_priority_max_: for performance + // reasons, the value in pending_shift_ is (re)calculated only when + // dynamic_priority_max_ is initialized or changes, and is stored + // as a class member rather than being a derived value. + dynamic_priority_max_ = ul; + pending_shift_ = ACE_Time_Value (0, ul); +} + // set maximum supported priority value + +ACE_INLINE unsigned long +ACE_Dynamic_Message_Strategy::dynamic_priority_offset (void) const +{ + return dynamic_priority_offset_; +} + // get offset for boundary between signed range and unsigned range + +ACE_INLINE void +ACE_Dynamic_Message_Strategy::dynamic_priority_offset (unsigned long ul) +{ + // max_late_ and min_pending_ depend on dynamic_priority_offset_: + // for performance reasons, the values in max_late_ and min_pending_ + // are (re)calculated only when dynamic_priority_offset_ is + // initialized or changes, and are stored as a class member rather + // than being derived each time one of their values is needed. + dynamic_priority_offset_ = ul; + max_late_ = ACE_Time_Value (0, ul - 1); + min_pending_ = ACE_Time_Value (0, ul); +} + // set offset for boundary between signed range and unsigned range + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dynamic_Service.cpp b/externals/ace/Dynamic_Service.cpp new file mode 100644 index 0000000..28d6e45 --- /dev/null +++ b/externals/ace/Dynamic_Service.cpp @@ -0,0 +1,63 @@ +// $Id: Dynamic_Service.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_DYNAMIC_SERVICE_CPP +#define ACE_DYNAMIC_SERVICE_CPP + +#include "ace/Dynamic_Service.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Object.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Dynamic_Service.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + +template TYPE * +ACE_Dynamic_Service::instance (const ACE_TCHAR *name) +{ + ACE_Service_Object * svc_obj = + static_cast + (ACE_Dynamic_Service_Base::instance (name,false)); + return dynamic_cast (svc_obj); +} + +template TYPE * +ACE_Dynamic_Service::instance (const ACE_TCHAR *name, + bool no_global) +{ + ACE_Service_Object * svc_obj = + static_cast + (ACE_Dynamic_Service_Base::instance (name, no_global)); + return dynamic_cast (svc_obj); +} + +template TYPE * +ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* conf, + const ACE_TCHAR *name) +{ + ACE_Service_Object * svc_obj = + static_cast + (ACE_Dynamic_Service_Base::instance (conf, name, false)); + return dynamic_cast (svc_obj); +} + +template TYPE * +ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* conf, + const ACE_TCHAR *name, + bool no_global) +{ + ACE_Service_Object * svc_obj = + static_cast + (ACE_Dynamic_Service_Base::instance (conf, name, no_global)); + return dynamic_cast (svc_obj); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_DYNAMIC_SERVICE_CPP */ diff --git a/externals/ace/Dynamic_Service.h b/externals/ace/Dynamic_Service.h new file mode 100644 index 0000000..b90095c --- /dev/null +++ b/externals/ace/Dynamic_Service.h @@ -0,0 +1,89 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dynamic_Service.h + * + * $Id: Dynamic_Service.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Prashant Jain + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_DYNAMIC_SERVICE_H +#define ACE_DYNAMIC_SERVICE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/Global_Macros.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Dynamic_Service_Base.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Service_Object; + +/** + * @class ACE_Dynamic_Service + * + * @brief Provides a general interface to retrieve arbitrary objects + * from the ACE service repository. + * + * Uses "name" for lookup in the ACE service repository. Obtains + * the object and returns it as the appropriate type. + */ +template +class ACE_Dynamic_Service : public ACE_Dynamic_Service_Base +{ +public: + /// Return instance using @a name to search the Service_Repository. + static TYPE* instance (const ACE_TCHAR *name); + static TYPE* instance (const ACE_TCHAR *name, bool no_global); + + static TYPE* instance (const ACE_Service_Gestalt* repo, + const ACE_TCHAR *name); + static TYPE* instance (const ACE_Service_Gestalt* repo, + const ACE_TCHAR *name, bool no_global); + +#if defined (ACE_USES_WCHAR) + + /// Return instance using @a name to search the Service_Repository. + static TYPE* instance (const ACE_ANTI_TCHAR *name); + + static TYPE* instance (const ACE_ANTI_TCHAR *name, bool no_global); + + static TYPE* instance (const ACE_Service_Gestalt* repo, + const ACE_ANTI_TCHAR *name); + static TYPE* instance (const ACE_Service_Gestalt* repo, + const ACE_ANTI_TCHAR *name, bool no_global); +#endif // ACE_USES_WCHAR + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service ()) + ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service (const ACE_Dynamic_Service&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Service& operator= (const ACE_Dynamic_Service&)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Dynamic_Service.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +# include "ace/Dynamic_Service.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +# pragma implementation ("Dynamic_Service.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_DYNAMIC_SERVICE_H */ diff --git a/externals/ace/Dynamic_Service.inl b/externals/ace/Dynamic_Service.inl new file mode 100644 index 0000000..31324bf --- /dev/null +++ b/externals/ace/Dynamic_Service.inl @@ -0,0 +1,39 @@ +// -*- C++ -*- +// +// $Id: Dynamic_Service.inl 81318 2008-04-10 10:12:05Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_USES_WCHAR) + +template ACE_INLINE TYPE * +ACE_Dynamic_Service::instance (const ACE_ANTI_TCHAR *name) +{ + return instance (ACE_TEXT_CHAR_TO_TCHAR (name),false); +} + +template ACE_INLINE TYPE * +ACE_Dynamic_Service::instance (const ACE_ANTI_TCHAR *name, + bool no_global) +{ + return instance (ACE_TEXT_CHAR_TO_TCHAR (name),no_global); +} + +template ACE_INLINE TYPE * +ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* repo, + const ACE_ANTI_TCHAR *name) +{ + return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),false); +} + +template ACE_INLINE TYPE * +ACE_Dynamic_Service::instance (const ACE_Service_Gestalt* repo, + const ACE_ANTI_TCHAR *name, + bool no_global) +{ + return instance (repo, ACE_TEXT_CHAR_TO_TCHAR (name),no_global); +} + +#endif // ACE_USES_WCHAR + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dynamic_Service_Base.cpp b/externals/ace/Dynamic_Service_Base.cpp new file mode 100644 index 0000000..ecefcf1 --- /dev/null +++ b/externals/ace/Dynamic_Service_Base.cpp @@ -0,0 +1,106 @@ +#include "ace/Dynamic_Service_Base.h" +#include "ace/ACE.h" +#include "ace/Service_Config.h" +#include "ace/Service_Repository.h" +#include "ace/Service_Types.h" +#include "ace/Log_Msg.h" + + +ACE_RCSID (ace, + Dynamic_Service_Base, + "$Id: Dynamic_Service_Base.cpp 84282 2009-01-30 15:04:29Z msmit $") + + ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + +void +ACE_Dynamic_Service_Base::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Dynamic_Service_Base::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// Get the instance using for the current global +// service configuration repository. + +void * +ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name, bool no_global) +{ + ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); + return instance (ACE_Service_Config::current (), name, no_global); +} + +// Find a service registration + +const ACE_Service_Type * +ACE_Dynamic_Service_Base::find_i (const ACE_Service_Gestalt* &repo, + const ACE_TCHAR *name, + bool no_global) +{ + ACE_TRACE ("ACE_Dynamic_Service_Base::find_i"); + const ACE_Service_Type *svc_rec = 0; + + ACE_Service_Gestalt* global = ACE_Service_Config::global (); + + for ( ; (repo->find (name, &svc_rec) == -1) && !no_global; repo = global) + { + // Check the static repo, too if different + if (repo == global) + break; + } + + return svc_rec; +} + + +// Get the instance using for specific configuration repository. +void * +ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo, + const ACE_TCHAR *name, + bool no_global) +{ + ACE_TRACE ("ACE_Dynamic_Service_Base::instance"); + + void *obj = 0; + const ACE_Service_Type_Impl *type = 0; + + const ACE_Service_Gestalt* repo_found = repo; + const ACE_Service_Type *svc_rec = find_i (repo_found, name, no_global); + if (svc_rec != 0) + { + type = svc_rec->type (); + if (type != 0) + obj = type->object (); + } + + if (ACE::debug ()) + { + ACE_Guard log_guard (*ACE_Log_Msg::instance ()); + + if (repo->repo_ != repo_found->repo_) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s") + ACE_TEXT (" type=%@ => %@") + ACE_TEXT (" [in repo=%@]\n"), + repo->repo_, name, type, obj, + repo_found->repo_)); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s") + ACE_TEXT (" type=%@ => %@\n"), + repo->repo_, name, type, obj)); + } + } + + return obj; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dynamic_Service_Base.h b/externals/ace/Dynamic_Service_Base.h new file mode 100644 index 0000000..31fdada --- /dev/null +++ b/externals/ace/Dynamic_Service_Base.h @@ -0,0 +1,73 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Dynamic_Service_Base.h + * + * $Id: Dynamic_Service_Base.h 89454 2010-03-11 09:35:25Z johnnyw $ + * + * @author Prashant Jain + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_DYNAMIC_SERVICE_BASE_H +#define ACE_DYNAMIC_SERVICE_BASE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Service_Gestalt; +class ACE_Service_Type; + +/** + * @class ACE_Dynamic_Service_Base + * + * @brief Base class for all ACE_Dynamic_Service instantiations. + * + * Factors out common code shared by all ACE_Dynamic_Service + * instantiations, this avoid code bloat. + */ +class ACE_Export ACE_Dynamic_Service_Base +{ +public: + /// Dump the current static of the object + void dump (void) const; + +protected: + /// Perform the default repo search, but optionally skip searching the global + /// repo. + static void* instance (const ACE_TCHAR *name, bool no_global = false); + + static void* instance (const ACE_Service_Gestalt* repo, + const ACE_TCHAR *name, + bool no_global = false); + + /// No need to create, or assign instances of this class + ACE_Dynamic_Service_Base (void); + ~ACE_Dynamic_Service_Base (void); + const ACE_Dynamic_Service_Base& operator= (const ACE_Dynamic_Service_Base&); + +private: + /// Implement the service search policy, i.e. "look for the service first + /// locally and then globally" + static const ACE_Service_Type *find_i (const ACE_Service_Gestalt* &repo, + const ACE_TCHAR *name, + bool no_global); + + /// The dependency declaration class needs access to the service search + /// policy, implemented by find_i() + friend class ACE_Dynamic_Service_Dependency; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_DYNAMIC_SERVICE_BASE_H */ diff --git a/externals/ace/Dynamic_Service_Dependency.cpp b/externals/ace/Dynamic_Service_Dependency.cpp new file mode 100644 index 0000000..df7cd0f --- /dev/null +++ b/externals/ace/Dynamic_Service_Dependency.cpp @@ -0,0 +1,51 @@ +#include "ace/ACE.h" +#include "ace/DLL_Manager.h" +#include "ace/Dynamic_Service_Dependency.h" +#include "ace/Service_Config.h" +#include "ace/Log_Msg.h" + +ACE_RCSID (ace, + Dynamic_Service_Dependency, + "$Id: Dynamic_Service_Dependency.cpp 80826 2008-03-04 14:51:23Z wotte $") + + + ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + +ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal) +{ + this->init (ACE_Service_Config::current (), principal); +} + +ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, + const ACE_TCHAR *principal) +{ + this->init (cfg, principal); +} + + +ACE_Dynamic_Service_Dependency::~ACE_Dynamic_Service_Dependency (void) +{ + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) DSD, this=%@ - destroying\n"), + this)); +} + +void +ACE_Dynamic_Service_Dependency::init (const ACE_Service_Gestalt *cfg, + const ACE_TCHAR *principal) +{ + const ACE_Service_Type* st = + ACE_Dynamic_Service_Base::find_i (cfg, principal,false); + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) DSD, this=%@ - creating dependency on "), this)); + st->dump (); + } + this->tracker_ = st->dll (); +} + + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Dynamic_Service_Dependency.h b/externals/ace/Dynamic_Service_Dependency.h new file mode 100644 index 0000000..0f187d0 --- /dev/null +++ b/externals/ace/Dynamic_Service_Dependency.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Dynamic_Service_Dependency.h + * + * $Id: Dynamic_Service_Dependency.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Iliyan Jeliazkov + */ +//============================================================================= + +#ifndef ACE_DYNAMIC_SERVICE_DEPENDENCY_H +#define ACE_DYNAMIC_SERVICE_DEPENDENCY_H + +#include /**/ "ace/pre.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Dynamic_Service_Base.h" +#include "ace/Service_Object.h" +#include "ace/DLL.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Dynamic_Service_Dependency + * + * @brief Provides a way to declare dependency on specific service, + * thus helping to avoid order of initialization issues with instances + * of an objects whose implementation code resides in dynamically loaded + * services. + * + * It is disastrous to have dynamically loadable services create and give away + * ownership of objects and then ending up being unloaded before all those + * instances have been deleted. Normally the code for such objects classes + * resides within the TEXT segment of the DLL, which implements the service. + * If a service gets removed, its DLL may be unmapped from memory and then + * any attempt to invoke a method on the said objects will cause SEGV. + * + * Such instances must contain a member of ACE_Dynamic_Service_Dependency + * initialized with the service they depend on. + * ACE_Dynamic_Service_Dependency's constructor and destructor are + * "magical" - they work by maintaining the underlying dynamic service's + * DLL reference count. + */ +class ACE_Export ACE_Dynamic_Service_Dependency +{ +public: + ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, + const ACE_TCHAR *principal); + ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal); + ~ACE_Dynamic_Service_Dependency (void); + +private: + void init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal); + +private: + ACE_DLL tracker_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + + +#include /**/ "ace/post.h" + +#endif /* ACE_DYNAMIC_SERVICE_DEPENDENCY_H */ diff --git a/externals/ace/Encoding_Converter.cpp b/externals/ace/Encoding_Converter.cpp new file mode 100644 index 0000000..b5fd2b3 --- /dev/null +++ b/externals/ace/Encoding_Converter.cpp @@ -0,0 +1,12 @@ +// $Id: Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $ +#include "ace/Encoding_Converter.h" + +#if defined (ACE_USES_WCHAR) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Encoding_Converter::~ACE_Encoding_Converter (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ diff --git a/externals/ace/Encoding_Converter.h b/externals/ace/Encoding_Converter.h new file mode 100644 index 0000000..34d22fa --- /dev/null +++ b/externals/ace/Encoding_Converter.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//========================================================================= +/** + * @file Encoding_Converter.h + * + * $Id: Encoding_Converter.h 80826 2008-03-04 14:51:23Z wotte $ + * + * This class is the base class for all encoding converters that convert + * to and from UTF-8. + * + * @author Chad Elliott + */ +//========================================================================= + +#ifndef ACE_ENCODING_CONVERTER_H +#define ACE_ENCODING_CONVERTER_H + +#include /**/ "ace/pre.h" + +#include "ace/Basic_Types.h" + +#if defined (ACE_USES_WCHAR) +#include /**/ "ace/ACE_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** The base class for all ACE UTF Encoding Converters. + * This class provides a generic interface that is used to implement + * various UTF encoding conversion classes. + */ +class ACE_Export ACE_Encoding_Converter +{ +public: + /// This enum describes the various states that can be returned + /// from the to_utf8() and from_utf8() methods which depends on + /// both the source buffer and the size of the target buffer. + enum Result {CONVERSION_OK, + SOURCE_EXHAUSTED, + TARGET_EXHAUSTED, + SOURCE_ILLEGAL + }; + + /// This destructor is here (and virtual) because we have virtual + /// functions. + virtual ~ACE_Encoding_Converter (void); + + /// Convert the source (which can be in any encoding) to UTF-8 and + /// store it in the provided target buffer. + virtual Result to_utf8 (const void* source, + size_t source_size, + ACE_Byte* target, + size_t target_size, + bool strict = true) = 0; + + /// Convert the UTF-8 source into an alternate encoding and store it + /// in the provided target buffer. + virtual Result from_utf8 (const ACE_Byte* source, + size_t source_size, + void* target, + size_t target_size, + bool strict = true) = 0; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ENCODING_CONVERTER_H */ diff --git a/externals/ace/Encoding_Converter_Factory.cpp b/externals/ace/Encoding_Converter_Factory.cpp new file mode 100644 index 0000000..f603ae3 --- /dev/null +++ b/externals/ace/Encoding_Converter_Factory.cpp @@ -0,0 +1,74 @@ +// $Id: Encoding_Converter_Factory.cpp 80826 2008-03-04 14:51:23Z wotte $ +#include "ace/Encoding_Converter_Factory.h" + +#if defined (ACE_USES_WCHAR) +#include "ace/UTF32_Encoding_Converter.h" +#include "ace/UTF16_Encoding_Converter.h" +#include "ace/UTF8_Encoding_Converter.h" +#include "ace/OS_Memory.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Encoding_Converter* +ACE_Encoding_Converter_Factory::create ( + const ACE_Byte* source, + size_t source_size, + ACE_Encoding_Converter_Factory::Encoding_Hint hint) +{ +#if defined (ACE_BIG_ENDIAN) + bool const convert_for_bigendian = true; +#else + bool const convert_for_bigendian = false; +#endif /* ACE_BIG_ENDIAN */ + ACE_Encoding_Converter* converter = 0; + + switch (hint) + { + case ACE_UTF_32BE: + ACE_NEW_RETURN (converter, + ACE_UTF32_Encoding_Converter (!convert_for_bigendian), + 0); + break; + case ACE_UTF_32LE: + ACE_NEW_RETURN (converter, + ACE_UTF32_Encoding_Converter (convert_for_bigendian), + 0); + break; + case ACE_UTF_16BE: + ACE_NEW_RETURN (converter, + ACE_UTF16_Encoding_Converter (!convert_for_bigendian), + 0); + break; + case ACE_UTF_16LE: + ACE_NEW_RETURN (converter, + ACE_UTF16_Encoding_Converter (convert_for_bigendian), + 0); + break; + case ACE_UTF_8: + ACE_NEW_RETURN (converter, + ACE_UTF8_Encoding_Converter, + 0); + break; + default: + // First check for ASCII since much of ASCII text will appear to + // convert from UTF-16 to UTF-8. + converter = ACE_UTF8_Encoding_Converter::encoded (source, source_size); + if (converter != 0) + return converter; + + // Check for UTF-32 + converter = ACE_UTF32_Encoding_Converter::encoded (source, source_size); + if (converter != 0) + return converter; + + // Check for UTF-16 + converter = ACE_UTF16_Encoding_Converter::encoded (source, source_size); + if (converter != 0) + return converter; + } + + return converter; +} + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ diff --git a/externals/ace/Encoding_Converter_Factory.h b/externals/ace/Encoding_Converter_Factory.h new file mode 100644 index 0000000..1441c69 --- /dev/null +++ b/externals/ace/Encoding_Converter_Factory.h @@ -0,0 +1,54 @@ +// -*- C++ -*- + +//========================================================================= +/** + * @file Encoding_Converter_Factory.h + * + * $Id: Encoding_Converter_Factory.h 80826 2008-03-04 14:51:23Z wotte $ + * + * This class can be used to create encoding converters of various types. + * + * @author Chad Elliott + */ +//========================================================================= + +#ifndef ACE_ENCODING_CONVERTER_FACTORY_H +#define ACE_ENCODING_CONVERTER_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "ace/Basic_Types.h" + +#if defined (ACE_USES_WCHAR) +#include /**/ "ace/ACE_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Encoding_Converter; + +/** Create an encoding converter based on the source or hint. + * This class allows users to avoid knowing any concrete converter types. + */ +class ACE_Export ACE_Encoding_Converter_Factory +{ +public: + /// This enum is used to tell what type of converter to create. + enum Encoding_Hint { ACE_UTF_32BE, ACE_UTF_32LE, + ACE_UTF_16BE, ACE_UTF_16LE, + ACE_UTF_8, ACE_NONE + }; + + /// Create an encoding converter based on the source. If a hint is + /// given, it just creates the specified type of converter without looking + /// at the source. + static ACE_Encoding_Converter* create (const ACE_Byte* source, + size_t source_size, + Encoding_Hint hint = ACE_NONE); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ + +#include /**/ "ace/post.h" + +#endif /* ACE_ENCODING_CONVERTER_FACTORY_H */ diff --git a/externals/ace/Env_Value_T.cpp b/externals/ace/Env_Value_T.cpp new file mode 100644 index 0000000..1997bbe --- /dev/null +++ b/externals/ace/Env_Value_T.cpp @@ -0,0 +1,12 @@ +// $Id: Env_Value_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_ENV_VALUE_T_CPP +#define ACE_ENV_VALUE_T_CPP + +#include "ace/Env_Value_T.h" + +#if ! defined (__ACE_INLINE__) +#include "ace/Env_Value_T.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_ENV_VALUE_T_CPP */ diff --git a/externals/ace/Env_Value_T.h b/externals/ace/Env_Value_T.h new file mode 100644 index 0000000..df2178a --- /dev/null +++ b/externals/ace/Env_Value_T.h @@ -0,0 +1,166 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Env_Value_T.h + * + * $Id: Env_Value_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Template to encapsulate getting a value from an environment variable + * and using a supplied default value if not in the environment. + * + * + * @author Chris Cleeland (derived from work by Carlos O'Ryan) + */ +//============================================================================= + +#ifndef ACE_ENV_VALUE_T_H +#define ACE_ENV_VALUE_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/Global_Macros.h" +#include "ace/OS_NS_stdlib.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Env_Value + * + * @brief Environment Variable Value + * + * Reads a variable from the user environment, providing a default + * value. + */ +template +class ACE_Env_Value +{ +public: + /** + * Default constructor which isn't bound to a specific environment + * variable name or a default value. Before being useful it must + * 'd. + */ + ACE_Env_Value (void); + + /// Constructor that calls . + ACE_Env_Value (const ACE_TCHAR *varname, + const T &vardefault); + + /// Destroy the value. + ~ACE_Env_Value (void); + + /// Returns the value as type T. + operator T (void); + + /// The constructor, read @a varname from the environment, using + /// @a defval as its value if it is not defined. + void open (const ACE_TCHAR *varname, const T &defval); + + /// Returns the name of the variable being tracked. + const ACE_TCHAR *varname (void) const; + +private: + /// Disallow copying and assignment. + ACE_UNIMPLEMENTED_FUNC (ACE_Env_Value(const ACE_Env_Value &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Env_Value operator=(const ACE_Env_Value &)) + + void fetch_value (void); + + const ACE_TCHAR *varname_; + T value_; +}; + +/// Function to convert a string @a s into type @c T. +template void ACE_Convert (const ACE_TCHAR *s, T &t); + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Env_Value_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Env_Value_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, ACE_TCHAR *&v) +{ + v = (ACE_TCHAR *) s; +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, const ACE_TCHAR *&v) +{ + v = (const ACE_TCHAR *) s; +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, short &si) +{ + si = static_cast (ACE_OS::strtol (s, 0, 10)); +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, u_short &us) +{ + us = static_cast (ACE_OS::strtol (s, 0, 10)); +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, u_int &i) +{ + i = static_cast (ACE_OS::strtol (s, 0, 10)); +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, long &l) +{ + l = ACE_OS::strtol (s, 0, 10); +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, int &i) +{ + i = static_cast (ACE_OS::strtol (s, 0, 10)); +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, u_long &ul) +{ + ul = ACE_OS::strtoul (s, 0, 10); +} + +template <> inline void +ACE_Convert (const ACE_TCHAR *s, double &d) +{ + d = ACE_OS::strtod (s, 0); +} + +// Default calls a CTOR on type T of the form 'T::T(const char*)', but +// users can feel free to create their own specialized conversion +// functions if necessary, as shown above. Note that for 'char*' the +// default is used because a simple cast will be performed and no +// conversion will be necessary. +template inline void +ACE_Convert (const ACE_TCHAR *s, T &t) +{ + t = T (s); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Env_Value_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_ENV_VALUE_T_H */ diff --git a/externals/ace/Env_Value_T.inl b/externals/ace/Env_Value_T.inl new file mode 100644 index 0000000..d9af1b0 --- /dev/null +++ b/externals/ace/Env_Value_T.inl @@ -0,0 +1,60 @@ +// $Id: Env_Value_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE +ACE_Env_Value::operator T (void) +{ + return value_; +} + +template ACE_INLINE +ACE_Env_Value::ACE_Env_Value (void) + : varname_ (0) +{ +} + +template ACE_INLINE +ACE_Env_Value::ACE_Env_Value (const ACE_TCHAR *varname, + const T &defval) + : varname_ (varname), + value_(defval) +{ + this->fetch_value (); +} + +template ACE_INLINE void +ACE_Env_Value::open (const ACE_TCHAR *varname, + const T &defval) +{ + this->varname_ = varname; + this->value_ = defval; + this->fetch_value (); +} + +template ACE_INLINE void +ACE_Env_Value::fetch_value (void) +{ +#if defined (ACE_WIN32) + const ACE_TCHAR *env = ACE_OS::getenv (this->varname_); + if (env != 0) + ACE_Convert (env, value_); +#else + char *nenv = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (this->varname_)); + if (nenv != 0) + ACE_Convert (ACE_TEXT_CHAR_TO_TCHAR (nenv), this->value_); +#endif +} + +template ACE_INLINE const ACE_TCHAR* +ACE_Env_Value::varname (void) const +{ + return this->varname_; +} + +template ACE_INLINE +ACE_Env_Value::~ACE_Env_Value (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Event.cpp b/externals/ace/Event.cpp new file mode 100644 index 0000000..ea5f86d --- /dev/null +++ b/externals/ace/Event.cpp @@ -0,0 +1,93 @@ +// $Id: Event.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Event.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Event.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, Event, "$Id: Event.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Event::ACE_Event (int manual_reset, + int initial_state, + int type, + const ACE_TCHAR *name, + void *arg, + LPSECURITY_ATTRIBUTES sa) + : removed_ (false) +{ + if (ACE_OS::event_init (&this->handle_, + manual_reset, + initial_state, + type, + name, + arg, + sa) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Event::ACE_Event"))); +} + +ACE_Event::~ACE_Event (void) +{ + this->remove (); +} + +int +ACE_Event::remove (void) +{ + int result = 0; + if (!this->removed_) + { + this->removed_ = true; + result = ACE_OS::event_destroy (&this->handle_); + } + return result; +} + +int +ACE_Event::wait (void) +{ + return ACE_OS::event_wait (&this->handle_); +} + +int +ACE_Event::wait (const ACE_Time_Value *abstime, int use_absolute_time) +{ + return ACE_OS::event_timedwait (&this->handle_, + const_cast (abstime), + use_absolute_time); +} + +int +ACE_Event::signal (void) +{ + return ACE_OS::event_signal (&this->handle_); +} + +int +ACE_Event::pulse (void) +{ + return ACE_OS::event_pulse (&this->handle_); +} + +int +ACE_Event::reset (void) +{ + return ACE_OS::event_reset (&this->handle_); +} + +void +ACE_Event::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Event.h b/externals/ace/Event.h new file mode 100644 index 0000000..887b504 --- /dev/null +++ b/externals/ace/Event.h @@ -0,0 +1,143 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Event.h + * + * $Id: Event.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_EVENT_H +#define ACE_EVENT_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_Thread.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Event + * + * @brief A wrapper around the Win32 event locking mechanism. + * + * Portable implementation of an Event mechanism, which is native to + * Win32, but must be emulated on UNIX. All platforms support + * process-scope locking support. However, only Win32 platforms + * support global naming and system-scope locking support. + */ +class ACE_Export ACE_Event +{ +public: + /// Constructor that creates event. + ACE_Event (int manual_reset = 0, + int initial_state = 0, + int type = USYNC_THREAD, + const ACE_TCHAR *name = 0, + void *arg = 0, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Implicitly destroy the event variable. + ~ACE_Event (void); + + /** + * Explicitly destroy the event variable. Note that only one thread + * should call this method since it doesn't protect against race + * conditions. + */ + int remove (void); + + /// Underlying handle to event. + ACE_event_t handle (void) const; + + /** + * Set the underlying handle to event. Note that this method assumes + * ownership of the and will close it down in . If + * you want the to stay open when is called make + * sure to call on the before closing it. You are + * responsible for the closing the existing before + * overwriting it. + */ + void handle (ACE_event_t new_handle); + + /** + * if MANUAL reset + * sleep till the event becomes signaled + * event remains signaled after wait() completes. + * else AUTO reset + * sleep till the event becomes signaled + * event resets wait() completes. + */ + int wait (void); + + /// Same as wait() above, but this one can be timed + /// @a abstime is absolute time-of-day if if @a use_absolute_time + /// is non-0, else it is relative time. + int wait (const ACE_Time_Value *abstime, + int use_absolute_time = 1); + + /** + * if MANUAL reset + * wake up all waiting threads + * set to signaled state + * else AUTO reset + * if no thread is waiting, set to signaled state + * if thread(s) are waiting, wake up one waiting thread and + * reset event + */ + int signal (void); + + /** + * if MANUAL reset + * wakeup all waiting threads and + * reset event + * else AUTO reset + * wakeup one waiting thread (if present) and + * reset event + */ + int pulse (void); + + /// Set to nonsignaled state. + int reset (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// The underlying handle. + ACE_event_t handle_; + + /// Keeps track of whether has been called yet to avoid + /// multiple calls, e.g., explicitly and implicitly in the + /// destructor. This flag isn't protected by a lock, so make sure + /// that you don't have multiple threads simultaneously calling + /// on the same object, which is a bad idea anyway... + bool removed_; + +private: + // = Prevent copying. + ACE_Event (const ACE_Event& event); + const ACE_Event &operator= (const ACE_Event &rhs); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Event.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_EVENT_H */ diff --git a/externals/ace/Event.inl b/externals/ace/Event.inl new file mode 100644 index 0000000..ae0805c --- /dev/null +++ b/externals/ace/Event.inl @@ -0,0 +1,18 @@ +// -*- C++ -*- +// $Id: Event.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_event_t +ACE_Event::handle (void) const +{ + return this->handle_; +} + +ACE_INLINE void +ACE_Event::handle (ACE_event_t new_handle) +{ + this->handle_ = new_handle; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Event_Handler.cpp b/externals/ace/Event_Handler.cpp new file mode 100644 index 0000000..e04e8cb --- /dev/null +++ b/externals/ace/Event_Handler.cpp @@ -0,0 +1,394 @@ +// Event_Handler.cpp +// $Id: Event_Handler.cpp 85236 2009-05-01 11:43:56Z johnnyw $ + +#include "ace/Event_Handler.h" +#include "ace/OS_Errno.h" +#include "ace/Reactor.h" +#include "ace/Thread_Manager.h" +/* Need to see if ACE_HAS_BUILTIN_ATOMIC_OP defined */ +#include "ace/Atomic_Op.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Event_Handler.inl" +#endif /* __ACE_INLINE__ */ + +#include + +ACE_RCSID(ace, Event_Handler, "$Id: Event_Handler.cpp 85236 2009-05-01 11:43:56Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Implement conceptually abstract virtual functions in the base class +// so derived classes don't have to implement unused ones. + +ACE_Event_Handler::ACE_Event_Handler (ACE_Reactor *r, + int p) + : reference_count_ (1), + priority_ (p), + reactor_ (r), + reference_counting_policy_ (Reference_Counting_Policy::DISABLED) +{ + // ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler"); +} + +ACE_Event_Handler::~ACE_Event_Handler (void) +{ + // ACE_TRACE ("ACE_Event_Handler::~ACE_Event_Handler"); +} + +// Gets the file descriptor associated with this I/O device. + +ACE_HANDLE +ACE_Event_Handler::get_handle (void) const +{ + ACE_TRACE ("ACE_Event_Handler::get_handle"); + return ACE_INVALID_HANDLE; +} + +// Sets the file descriptor associated with this I/O device. + +void +ACE_Event_Handler::set_handle (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Event_Handler::set_handle"); +} + +// Gets the priority of this handler. + +int +ACE_Event_Handler::priority (void) const +{ + ACE_TRACE ("ACE_Event_Handler::priority"); + return this->priority_; +} + +// Sets the priority + +void +ACE_Event_Handler::priority (int priority) +{ + ACE_TRACE ("ACE_Event_Handler::priority"); + this->priority_ = priority; +} + +// Called when the object is about to be removed from the Dispatcher +// tables. + +int +ACE_Event_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) +{ + ACE_TRACE ("ACE_Event_Handler::handle_close"); + return -1; +} + +// Called when input becomes available on fd. + +int +ACE_Event_Handler::handle_input (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Event_Handler::handle_input"); + return -1; +} + +// Called when output is possible on fd. + +int +ACE_Event_Handler::handle_output (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Event_Handler::handle_output"); + return -1; +} + +// Called when urgent data is available on fd. + +int +ACE_Event_Handler::handle_exception (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Event_Handler::handle_exception"); + return -1; +} + +// Called when timer expires, TV stores the current time. + +int +ACE_Event_Handler::handle_timeout (const ACE_Time_Value &, const void *) +{ + ACE_TRACE ("ACE_Event_Handler::handle_timeout"); + return -1; +} + +// Called when a monitored Process exits + +int +ACE_Event_Handler::handle_exit (ACE_Process *) +{ + ACE_TRACE ("ACE_Event_Handler::handle_exit"); + return -1; +} + +// Called when a registered signal occurs. + +int +ACE_Event_Handler::handle_signal (int, siginfo_t *, ucontext_t *) +{ + ACE_TRACE ("ACE_Event_Handler::handle_signal"); + return -1; +} + +int +ACE_Event_Handler::resume_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler::resume_handler"); + + // Return a default value and allow the reactor to take care of + // resuming the handler + return ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER; +} + + +int +ACE_Event_Handler::handle_qos (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Event_Handler::handle_qos"); + return -1; +} + +int +ACE_Event_Handler::handle_group_qos (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Event_Handler::handle_group_qos"); + return -1; +} + +void +ACE_Event_Handler::reactor (ACE_Reactor *reactor) +{ + ACE_TRACE ("ACE_Event_Handler::reactor"); + this->reactor_ = reactor; +} + +ACE_Reactor * +ACE_Event_Handler::reactor (void) const +{ + ACE_TRACE ("ACE_Event_Handler::reactor"); + return this->reactor_; +} + +ACE_Reactor_Timer_Interface * +ACE_Event_Handler::reactor_timer_interface (void) const +{ + ACE_TRACE ("ACE_Event_Handler::reactor_timer_interface"); + return this->reactor_; +} + +ACE_Event_Handler::Reference_Count +ACE_Event_Handler::add_reference (void) +{ + bool const reference_counting_required = + this->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (reference_counting_required) + return ++this->reference_count_; + else + return 1; +} + +ACE_Event_Handler::Reference_Count +ACE_Event_Handler::remove_reference (void) +{ + bool const reference_counting_required = + this->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (reference_counting_required) + { + Reference_Count result = + --this->reference_count_; + + if (result == 0) + delete this; + + return result; + } + else + { + return 1; + } +} + +ACE_Event_Handler::Policy::~Policy (void) +{ +} + +ACE_Event_Handler::Reference_Counting_Policy::Reference_Counting_Policy (Reference_Counting_Policy::Value value) + : value_ (value) +{ +} + +ACE_Event_Handler::Reference_Counting_Policy::Value +ACE_Event_Handler::Reference_Counting_Policy::value (void) const +{ + return this->value_; +} + +void +ACE_Event_Handler::Reference_Counting_Policy::value (ACE_Event_Handler::Reference_Counting_Policy::Value value) +{ + this->value_ = value; +} + +ACE_Event_Handler::Reference_Counting_Policy & +ACE_Event_Handler::reference_counting_policy (void) +{ + return this->reference_counting_policy_; +} + +ACE_THR_FUNC_RETURN +ACE_Event_Handler::read_adapter (void *args) +{ + ACE_Event_Handler *this_ptr = static_cast (args); + ACE_Reactor *r = this_ptr->reactor (); + + while (this_ptr->handle_input (ACE_STDIN) != -1) + continue; + + this_ptr->handle_close (ACE_STDIN, ACE_Event_Handler::READ_MASK); + // It's possible for handle_close() to "delete this" so we need to + // cache the reactor pointer and use it here. + r->notify (); + + return 0; +} + +int +ACE_Event_Handler::register_stdin_handler (ACE_Event_Handler *eh, + ACE_Reactor *reactor, + ACE_Thread_Manager *thr_mgr, + int flags) +{ +#if defined (ACE_WIN32) + ACE_UNUSED_ARG (reactor); + + eh->reactor (reactor); + return thr_mgr->spawn (&read_adapter, static_cast (eh), flags); +#else + // Keep compilers happy. + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (thr_mgr); + return reactor->register_handler (ACE_STDIN, + eh, + ACE_Event_Handler::READ_MASK); +#endif /* ACE_WIN32 */ +} + +int +ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor, + ACE_Thread_Manager * /* thr_mgr */) +{ +#if defined (ACE_WIN32) + ACE_UNUSED_ARG (reactor); + + // What should we do here? + ACE_NOTSUP_RETURN (-1); +#else + return reactor->remove_handler (ACE_STDIN, + ACE_Event_Handler::READ_MASK); +#endif /* ACE_WIN32 */ +} + +// --------------------------------------------------------------------- + +ACE_Event_Handler_var::ACE_Event_Handler_var (void) + : ptr_ (0) +{ +} + +ACE_Event_Handler_var::ACE_Event_Handler_var (ACE_Event_Handler *p) + : ptr_ (p) +{ +} + +ACE_Event_Handler_var::ACE_Event_Handler_var (const ACE_Event_Handler_var &b) + : ptr_ (b.ptr_) +{ + if (this->ptr_ != 0) + { + this->ptr_->add_reference (); + } +} + +ACE_Event_Handler_var::~ACE_Event_Handler_var (void) +{ + if (this->ptr_ != 0) + { + ACE_Errno_Guard eguard (errno); + this->ptr_->remove_reference (); + } +} + +ACE_Event_Handler_var & +ACE_Event_Handler_var::operator= (ACE_Event_Handler *p) +{ + if (this->ptr_ != p) + { + ACE_Event_Handler_var tmp (p); + std::swap (this->ptr_, tmp.ptr_); + } + + return *this; +} + +ACE_Event_Handler_var & +ACE_Event_Handler_var::operator= (const ACE_Event_Handler_var &b) +{ + ACE_Event_Handler_var tmp (b); + std::swap (this->ptr_, tmp.ptr_); + + return *this; +} + +ACE_Event_Handler * +ACE_Event_Handler_var::operator->() const +{ + return this->ptr_; +} + +ACE_Event_Handler * +ACE_Event_Handler_var::handler (void) const +{ + return this->ptr_; +} + +ACE_Event_Handler * +ACE_Event_Handler_var::release (void) +{ + ACE_Event_Handler * const old = this->ptr_; + this->ptr_ = 0; + return old; +} + +void +ACE_Event_Handler_var::reset (ACE_Event_Handler *p) +{ + *this = p; +} + +// --------------------------------------------------------------------- + +ACE_Notification_Buffer::ACE_Notification_Buffer (void) + : eh_ (0), + mask_ (ACE_Event_Handler::NULL_MASK) +{ + ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); +} + +ACE_Notification_Buffer::ACE_Notification_Buffer (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) + : eh_ (eh), + mask_ (mask) +{ + ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Event_Handler.h b/externals/ace/Event_Handler.h new file mode 100644 index 0000000..2e1414e --- /dev/null +++ b/externals/ace/Event_Handler.h @@ -0,0 +1,387 @@ +/* -*- C++ -*- */ + +//========================================================================== +/** + * @file Event_Handler.h + * + * $Id: Event_Handler.h 86576 2009-08-29 22:42:51Z shuston $ + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_EVENT_HANDLER_H +#define ACE_EVENT_HANDLER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_signal.h" +#include "ace/Atomic_Op.h" +#include "ace/Synch_Traits.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration. +class ACE_Message_Block; +class ACE_Reactor; +class ACE_Reactor_Timer_Interface; +class ACE_Thread_Manager; +class ACE_Process; + +typedef unsigned long ACE_Reactor_Mask; + +/** + * @class ACE_Event_Handler + * + * @brief Provides an abstract interface for handling various types of + * I/O, timer, and signal events. + * + * Subclasses read/write input/output on an I/O descriptor, + * handle an exception raised on an I/O descriptor, handle a + * timer's expiration, or handle a signal. + */ +class ACE_Export ACE_Event_Handler +{ +public: + enum + { + LO_PRIORITY = 0, + HI_PRIORITY = 10, + NULL_MASK = 0, +#if defined (ACE_USE_POLL) + READ_MASK = POLLIN, + WRITE_MASK = POLLOUT, + EXCEPT_MASK = POLLPRI, +#else /* USE SELECT */ + READ_MASK = (1 << 0), + WRITE_MASK = (1 << 1), + EXCEPT_MASK = (1 << 2), +#endif /* ACE_USE_POLL */ + ACCEPT_MASK = (1 << 3), + CONNECT_MASK = (1 << 4), + TIMER_MASK = (1 << 5), + QOS_MASK = (1 << 6), + GROUP_QOS_MASK = (1 << 7), + SIGNAL_MASK = (1 << 8), + ALL_EVENTS_MASK = READ_MASK | + WRITE_MASK | + EXCEPT_MASK | + ACCEPT_MASK | + CONNECT_MASK | + TIMER_MASK | + QOS_MASK | + GROUP_QOS_MASK | + SIGNAL_MASK, + RWE_MASK = READ_MASK | + WRITE_MASK | + EXCEPT_MASK, + DONT_CALL = (1 << 9) + }; + + /// Destructor is virtual to enable proper cleanup. + virtual ~ACE_Event_Handler (void); + + /// Get the I/O handle. + virtual ACE_HANDLE get_handle (void) const; + + /// Set the I/O handle. + virtual void set_handle (ACE_HANDLE); + + // = Get/set priority + + // Priorities run from MIN_PRIORITY (which is the "lowest priority") + // to MAX_PRIORITY (which is the "highest priority"). + /// Get the priority of the Event_Handler. + virtual int priority (void) const; + + /// Set the priority of the Event_Handler. + virtual void priority (int priority); + + /// Called when input events occur (e.g., connection or data). + virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); + + /// Called when output events are possible (e.g., when flow control + /// abates or non-blocking connection completes). + virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE); + + /// Called when an exceptional events occur (e.g., SIGURG). + virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE); + + /** + * Called when timer expires. @a current_time represents the current + * time that the Event_Handler was selected for timeout + * dispatching and @a act is the asynchronous completion token that + * was passed in when was invoked. + */ + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); + + /// Called when a process exits. + virtual int handle_exit (ACE_Process *); + + /// Called when a method returns -1 or when the + /// method is called on an ACE_Reactor. The + /// @a close_mask indicates which event has triggered the + /// method callback on a particular @a handle. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + /// Called when object is signaled by OS (either via UNIX signals or + /// when a Win32 object becomes signaled). + virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); + + enum + { + /// The handler is not resumed at all. Could lead to deadlock.. + ACE_EVENT_HANDLER_NOT_RESUMED = -1, + /// The reactor takes responsibility of resuming the handler and + /// is the default + ACE_REACTOR_RESUMES_HANDLER = 0, + /// The application takes responsibility of resuming the handler + ACE_APPLICATION_RESUMES_HANDLER + }; + /** + * Called to figure out whether the handler needs to resumed by the + * reactor or the application can take care of it. The default + * value of 0 would be returned which would allow the reactor to + * take care of resumption of the handler. The application can + * return a value more than zero and decide to resume the handler + * themseleves. + * + * @note This method has an affect only when used with the + * ACE_Dev_Poll_Reactor (and then, only on Linux) or the ACE_TP_Reactor. + */ + virtual int resume_handler (void); + + virtual int handle_qos (ACE_HANDLE = ACE_INVALID_HANDLE); + virtual int handle_group_qos (ACE_HANDLE = ACE_INVALID_HANDLE); + + // = Accessors to set/get the various event demultiplexors. + /// Set the event demultiplexors. + virtual void reactor (ACE_Reactor *reactor); + + /// Get the event demultiplexors. + virtual ACE_Reactor *reactor (void) const; + + /// Get only the reactor's timer related interface. + virtual ACE_Reactor_Timer_Interface *reactor_timer_interface (void) const; + + /** + * Used to read from non-socket ACE_HANDLEs in our own thread to + * work around Win32 limitations that don't allow us to 'able on + * Win32. + */ + static int register_stdin_handler (ACE_Event_Handler *eh, + ACE_Reactor *reactor, + ACE_Thread_Manager *thr_mgr, + int flags = THR_DETACHED); + + /// Performs the inverse of the method. + static int remove_stdin_handler (ACE_Reactor *reactor, + ACE_Thread_Manager *thr_mgr); + + /// Reference count type. + typedef long Reference_Count; + + /// Increment reference count on the handler. + /** + * This method is called when the handler is registered with the + * Reactor and when the Reactor makes an upcall on the handler. + * Reference count is 1 when the handler is created. + * + * @return Current reference count. + */ + virtual Reference_Count add_reference (void); + + /// Decrement reference count on the handler. + /** + * This method is called when the handler is removed from the + * Reactor and when an upcall made on the handler by the Reactor + * completes. Handler is deleted when the reference count reaches + * 0. + * + * @return Current reference count. + */ + virtual Reference_Count remove_reference (void); + + /** + * @class Policy + * + * @brief Base class for all handler policies. + */ + class ACE_Export Policy + { + + public: + + /// Virtual destructor. + virtual ~Policy (void); + }; + + /** + * @class Reference_Counting_Policy + * + * @brief This policy dictates the reference counting requirements + * for the handler. + * + * This policy allows applications to configure whether it wants the + * Reactor to call add_reference() and remove_reference() during + * registrations, removals, and upcalls. + * + * Default: DISABLED. + */ + class ACE_Export Reference_Counting_Policy : public Policy + { + /// This policy can only be created by the handler. + friend class ACE_Event_Handler; + + public: + + enum Value + { + /// Perform reference counting. + ENABLED, + /// Don't perform reference counting. + DISABLED + }; + + /// Current Reference_Counting_Policy. + Value value (void) const; + + /// Update Reference_Counting_Policy. + void value (Value value); + + private: + + /// Private constructor. + Reference_Counting_Policy (Value value); + + /// The value of the policy. + Value value_; + }; + + /// Current Reference_Counting_Policy. + Reference_Counting_Policy &reference_counting_policy (void); + +protected: + /// Force ACE_Event_Handler to be an abstract base class. + ACE_Event_Handler (ACE_Reactor * = 0, + int priority = ACE_Event_Handler::LO_PRIORITY); + + /// Typedef for implementation of reference counting. + typedef ACE_Atomic_Op Atomic_Reference_Count; + + /// Reference count. + Atomic_Reference_Count reference_count_; + +private: + + /// Priority of this Event_Handler. + int priority_; + + /// Pointer to the various event demultiplexors. + ACE_Reactor *reactor_; + + /// Reference counting requirements. + Reference_Counting_Policy reference_counting_policy_; +}; + +/** + * @class ACE_Event_Handler_var + * + * @brief Auto pointer like class for Event Handlers. + * + * Used to manage lifecycle of handlers. This class calls + * ACE_Event_Handler::remove_reference() in its destructor. + */ +class ACE_Export ACE_Event_Handler_var +{ + +public: + + /// Default constructor. + ACE_Event_Handler_var (void); + + /// Construct with a handler. + ACE_Event_Handler_var (ACE_Event_Handler *p); + + /// Copy constructor. + ACE_Event_Handler_var (const ACE_Event_Handler_var &b); + + /// Destructor. + ~ACE_Event_Handler_var (void); + + /// Assignment to a handler. + ACE_Event_Handler_var &operator= (ACE_Event_Handler *p); + + /// Assignment to a ACE_Event_Handler_var. + ACE_Event_Handler_var &operator= (const ACE_Event_Handler_var &b); + + /// Overloaded "->". + ACE_Event_Handler *operator-> () const; + + /// Access the handler. + ACE_Event_Handler *handler (void) const; + + /// Release the handler. + ACE_Event_Handler *release (void); + + /// Reset the handler. + void reset (ACE_Event_Handler *p = 0); + +private: + + /// Handler. + ACE_Event_Handler *ptr_; +}; + +/** + * @class ACE_Notification_Buffer + * + * @brief Simple wrapper for passing s and + * ACE_Reactor_Masks between threads. + */ +class ACE_Export ACE_Notification_Buffer +{ +public: + ACE_Notification_Buffer (void); + + ACE_Notification_Buffer (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask); + + /// Default dtor. + ~ACE_Notification_Buffer (void); + + /// Pointer to the Event_Handler that will be dispatched + /// by the main event loop. + ACE_Event_Handler *eh_; + + /// Mask that indicates which method to call. + ACE_Reactor_Mask mask_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Event_Handler.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_EVENT_HANDLER_H */ diff --git a/externals/ace/Event_Handler.inl b/externals/ace/Event_Handler.inl new file mode 100644 index 0000000..d97c454 --- /dev/null +++ b/externals/ace/Event_Handler.inl @@ -0,0 +1,12 @@ +// -*- C++ -*- +// +// $Id: Event_Handler.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Notification_Buffer::~ACE_Notification_Buffer (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Event_Handler_T.cpp b/externals/ace/Event_Handler_T.cpp new file mode 100644 index 0000000..45d9d4e --- /dev/null +++ b/externals/ace/Event_Handler_T.cpp @@ -0,0 +1,125 @@ +// Event_Handler_T.cpp +// +// $Id: Event_Handler_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_EVENT_HANDLER_T_CPP +#define ACE_EVENT_HANDLER_T_CPP + +#include "ace/Event_Handler_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) + +#if !defined (__ACE_INLINE__) +#include "ace/Event_Handler_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Event_Handler_T) + +template void +ACE_Event_Handler_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Event_Handler_T::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Event_Handler_T::~ACE_Event_Handler_T (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::~ACE_Event_Handler_T"); + if (this->delete_handler_) + delete this->op_handler_; +} + +template +ACE_Event_Handler_T::ACE_Event_Handler_T (T *op_handler, int delete_handler, + GET_HANDLE get_handle, + IO_HANDLER input_h, + CL_HANDLER close_h, + SIG_HANDLER sig_h, + TO_HANDLER timeout_h, + IO_HANDLER output_h, + SET_HANDLE set_handle, + IO_HANDLER except_h) + : op_handler_ (op_handler), + input_handler_ (input_h), + output_handler_ (output_h), + except_handler_ (except_h), + to_handler_ (timeout_h), + cl_handler_ (close_h), + sig_handler_ (sig_h), + delete_handler_ (delete_handler), + set_handle_ (set_handle), + get_handle_ (get_handle) +{ + ACE_TRACE ("ACE_Event_Handler_T::ACE_Event_Handler_T"); +} + +template ACE_HANDLE +ACE_Event_Handler_T::get_handle (void) const +{ + ACE_TRACE ("ACE_Event_Handler_T::get_handle"); + return this->get_handle_ == 0 ? ACE_INVALID_HANDLE : (this->op_handler_->*get_handle_) (); +} + +template void +ACE_Event_Handler_T::set_handle (ACE_HANDLE h) +{ + ACE_TRACE ("ACE_Event_Handler_T::set_handle"); + if (this->set_handle_ != 0) + (this->op_handler_->*set_handle_) (h); +} + +template int +ACE_Event_Handler_T::handle_input (ACE_HANDLE fd) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_input"); + return this->input_handler_ == 0 ? 0 : (this->op_handler_->*input_handler_) (fd); +} + +template int +ACE_Event_Handler_T::handle_output (ACE_HANDLE fd) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_output"); + return this->output_handler_ == 0 ? 0 : (this->op_handler_->*output_handler_) (fd); +} + +template int +ACE_Event_Handler_T::handle_exception (ACE_HANDLE fd) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_exception"); + return this->except_handler_ == 0 ? 0 : (this->op_handler_->*except_handler_) (fd); +} + +template int +ACE_Event_Handler_T::handle_timeout (const ACE_Time_Value &tv, const void *arg) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_timeout"); + return this->to_handler_ == 0 ? 0 : (this->op_handler_->*to_handler_) (tv, arg); +} + +template int +ACE_Event_Handler_T::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_close"); + return this->cl_handler_ == 0 ? 0 : (this->op_handler_->*cl_handler_) (fd, close_mask); +} + +template int +ACE_Event_Handler_T::handle_signal (int signum, siginfo_t *s, ucontext_t *u) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_signal"); + return this->sig_handler_ == 0 ? 0 : (this->op_handler_->*sig_handler_) (signum, s, u); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ + +#endif /* ACE_EVENT_HANDLER_T_CPP */ diff --git a/externals/ace/Event_Handler_T.h b/externals/ace/Event_Handler_T.h new file mode 100644 index 0000000..d86ac33 --- /dev/null +++ b/externals/ace/Event_Handler_T.h @@ -0,0 +1,191 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Event_Handler_T.h + * + * $Id: Event_Handler_T.h 83891 2008-11-28 11:01:50Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_EVENT_HANDLER_T_H +#define ACE_EVENT_HANDLER_T_H +#include /**/ "ace/pre.h" + +#include "ace/Event_Handler.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Event_Handler_T + * + * @brief Enable a class that doesn't inherit from the + * ACE_Event_Handler to be incorporated into the ACE_Reactor + * framework. Thanks to Greg Lavender (g.lavender@isode.com) + * for sharing this idea. + * + * It is sometimes the case that an application has a hierarchy + * of operation dispatcher classes that have their own + * inheritance hierarchy but also would like to integrate with + * the ACE_Reactor. Rather than adopt a "mixin" approach, it is + * often cleaner to define a template as a subclass of + * ACE_Event_Handler and parameterize it with an operation + * dispatcher type. + * When constructing an instantiation of the ACE_Event_Handler_T + * object, a set of pointers to member functions must be + * provided so that when one of the handle_* methods is called + * by the ACE_Reactor, the appropriate method is called on the + * underlying operations object. This is done since in some + * cases it is useful to map any event that happens to the same + * method on an object. + * The ACE_Event_Handler_T template is instantiated by an + * operations object and registered with the ACE_Reactor, and it + * then calls the appropriate op_handler. So, it's basically + * just another level of indirection in event dispatching. The + * coupling betweent the ultimate handler of the event and the + * ACE_Event_Handler class is relaxed a bit by have this + * intermediate object of type around. The + * client object can then dynamically change the bindings for + * the various handlers so that during the life of one of the + * operation objects, it can change how it wants events to be + * handled. It just instantiates a new instance of the template + * with different bindings and reregisters this new object with + * the ACE_Reactor. + */ +template +class ACE_Event_Handler_T : public ACE_Event_Handler +{ +public: + // = Typedefs to simplify pointer-to-member-function registration. + + // Get/set the underlying handle. + typedef ACE_HANDLE (T::*GET_HANDLE) (void) const; + typedef void (T::*SET_HANDLE) (ACE_HANDLE); + + /// Handle I/O events. + typedef int (T::*IO_HANDLER) (ACE_HANDLE); + + /// Handle timeout events. + typedef int (T::*TO_HANDLER) (const ACE_Time_Value &, const void *); + + /// Handle close events. + typedef int (T::*CL_HANDLER) (ACE_HANDLE, ACE_Reactor_Mask); + + /// = Initialization and termination methods. + typedef int (T::*SIG_HANDLER) (int, siginfo_t*, ucontext_t*); + + /// Initialize the op_handler. + ACE_Event_Handler_T (T *op_handler, + int delete_handler, + GET_HANDLE get_handle = 0, + IO_HANDLER input = 0, + CL_HANDLER close = 0, + SIG_HANDLER sig = 0, + TO_HANDLER timeout = 0, + IO_HANDLER output = 0, + SET_HANDLE set_handle = 0, + IO_HANDLER except = 0); + + /// Close down and delete the + ~ACE_Event_Handler_T (void); + + // = Override all the ACE_Event_Handler methods. + + // These methods all delegate down to the operations handler. + virtual ACE_HANDLE get_handle (void) const; + virtual void set_handle (ACE_HANDLE); + virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); + virtual int handle_output (ACE_HANDLE fd = ACE_INVALID_HANDLE); + virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE); + virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg = 0); + virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask); + virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); + + // = Get/set the operations handler. + T *op_handler (void); + void op_handler (T *); + + // = Get/set the target pointer-to-method used for dispatching. + + GET_HANDLE handle_get (void); + void handle_get (GET_HANDLE); + + SET_HANDLE handle_set (void); + void handle_set (SET_HANDLE); + + IO_HANDLER input_handler (void); + void input_handler (IO_HANDLER); + + IO_HANDLER output_handler (void); + void output_handler (IO_HANDLER); + + IO_HANDLER except_handler (void); + void except_handler (IO_HANDLER); + + TO_HANDLER to_handler (void); + void to_handler (TO_HANDLER); + + CL_HANDLER cl_handler (void); + void cl_handler (CL_HANDLER); + + SIG_HANDLER sig_handler (void); + void sig_handler (SIG_HANDLER); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Pointer to the object that handles all the delegated operations. + T *op_handler_; + + // = Handle input, output, and exception events. + IO_HANDLER input_handler_; + IO_HANDLER output_handler_; + IO_HANDLER except_handler_; + + /// Handle timeout events. + TO_HANDLER to_handler_; + + /// Handle close events. + CL_HANDLER cl_handler_; + + /// Handle signal events. + SIG_HANDLER sig_handler_; + + /// Keeps track of whether we need to delete the handler in the + /// destructor. + int delete_handler_; + + // = Get/set underlying handle. + SET_HANDLE set_handle_; + GET_HANDLE get_handle_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Event_Handler_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Event_Handler_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Event_Handler_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ +#include /**/ "ace/post.h" +#endif /* ACE_EVENT_HANDLER_H */ diff --git a/externals/ace/Event_Handler_T.inl b/externals/ace/Event_Handler_T.inl new file mode 100644 index 0000000..40db43e --- /dev/null +++ b/externals/ace/Event_Handler_T.inl @@ -0,0 +1,135 @@ +// -*- C++ -*- +// +// $Id: Event_Handler_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE void +ACE_Event_Handler_T::op_handler (T *op) +{ + ACE_TRACE ("ACE_Event_Handler_T::op_handler"); + this->op_handler_ = op; +} + +template ACE_INLINE T * +ACE_Event_Handler_T::op_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::op_handler"); + return this->op_handler_; +} + +template ACE_INLINE typename ACE_Event_Handler_T::GET_HANDLE +ACE_Event_Handler_T::handle_get (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_get"); + return this->get_handle_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::handle_get (typename ACE_Event_Handler_T::GET_HANDLE h) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_get"); + this->get_handle_ = h; +} + +template ACE_INLINE typename ACE_Event_Handler_T::SET_HANDLE +ACE_Event_Handler_T::handle_set (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_set"); + return this->set_handle_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::handle_set (typename ACE_Event_Handler_T::SET_HANDLE h) +{ + ACE_TRACE ("ACE_Event_Handler_T::handle_set"); + this->set_handle_ = h; +} + +template ACE_INLINE typename ACE_Event_Handler_T::IO_HANDLER +ACE_Event_Handler_T::input_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::input_handler"); + return this->input_handler_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::input_handler (typename ACE_Event_Handler_T::IO_HANDLER h) +{ + ACE_TRACE ("ACE_Event_Handler_T::input_handler"); + this->input_handler_ = h; +} + +template ACE_INLINE typename ACE_Event_Handler_T::IO_HANDLER +ACE_Event_Handler_T::output_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::output_handler"); + return this->output_handler_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::output_handler (typename ACE_Event_Handler_T::IO_HANDLER h) +{ + ACE_TRACE ("ACE_Event_Handler_T::output_handler"); + this->output_handler_ = h; +} + +template ACE_INLINE typename ACE_Event_Handler_T::IO_HANDLER +ACE_Event_Handler_T::except_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::except_handler"); + return this->except_handler_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::except_handler (typename ACE_Event_Handler_T::IO_HANDLER h) +{ + ACE_TRACE ("ACE_Event_Handler_T::except_handler"); + this->except_handler_ = h; +} + +template ACE_INLINE typename ACE_Event_Handler_T::TO_HANDLER +ACE_Event_Handler_T::to_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::to_handler"); + return this->to_handler_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::to_handler (typename ACE_Event_Handler_T::TO_HANDLER h) +{ + ACE_TRACE ("ACE_Event_Handler_T::to_handler"); + this->to_handler_ = h; +} + +template ACE_INLINE typename ACE_Event_Handler_T::CL_HANDLER +ACE_Event_Handler_T::cl_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::cl_handler"); + return this->cl_handler_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::cl_handler (typename ACE_Event_Handler_T::CL_HANDLER h) +{ + ACE_TRACE ("ACE_Event_Handler_T::cl_handler"); + this->cl_handler_ = h; +} + +template ACE_INLINE typename ACE_Event_Handler_T::SIG_HANDLER +ACE_Event_Handler_T::sig_handler (void) +{ + ACE_TRACE ("ACE_Event_Handler_T::sig_handler"); + return this->sig_handler_; +} + +template ACE_INLINE void +ACE_Event_Handler_T::sig_handler (typename ACE_Event_Handler_T::SIG_HANDLER h) +{ + ACE_TRACE ("ACE_Event_Handler_T::sig_handler"); + this->sig_handler_ = h; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Exception_Macros.h b/externals/ace/Exception_Macros.h new file mode 100644 index 0000000..bb74b1a --- /dev/null +++ b/externals/ace/Exception_Macros.h @@ -0,0 +1,55 @@ +// -*- C++ -*- + +// ============================================================================ +/** + * @file Exception_Macros.h + * + * $Id: Exception_Macros.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Writing code that is portable between platforms with or without + * native C++ exceptions is hard. The following macros offer some + * help on this task. + * + * @author Nanbor Wang + * @author Aniruddha Gokhale + * @author Carlos O'Ryan + * @author Krishnakumar B , et al. + */ +// ============================================================================ + +// Macros for handling exceptions. + +#ifndef ACE_EXCEPTION_MACROS_H +#define ACE_EXCEPTION_MACROS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +// By default, if the compiler supports native exception handling, assume +// CORBA also support native exception handling. But it can be disabled by +// defining ACE_CORBA_HAS_EXCEPTIONS=0. If the compiler does not support +// exceptions handling, make sure native exception handling is disabled. +#if defined (ACE_HAS_EXCEPTIONS) +# if defined (ACE_CORBA_HAS_EXCEPTIONS) +# if (ACE_CORBA_HAS_EXCEPTIONS == 0) +# undef ACE_USES_NATIVE_EXCEPTIONS +# else /* ACE_CORBA_HAS_EXCEPTIONS != 0 */ +# define ACE_USES_NATIVE_EXCEPTIONS +# endif /* ACE_CORBA_HAS_EXCEPTIONS == 0 */ +# else +# define ACE_USES_NATIVE_EXCEPTIONS +# define ACE_CORBA_HAS_EXCEPTIONS +# endif /* ACE_CORBA_HAS_EXCEPTIONS */ +#else /* ! ACE_HAS_EXCEPTIONS */ +# undef ACE_CORBA_HAS_EXCEPTIONS +# undef ACE_USES_NATIVE_EXCEPTIONS +#endif /* ACE_HAS_EXCEPTIONS */ + +#include /**/ "ace/post.h" + +#endif /* ACE_EXCEPTION_MACROS_H */ diff --git a/externals/ace/FIFO.cpp b/externals/ace/FIFO.cpp new file mode 100644 index 0000000..e397001 --- /dev/null +++ b/externals/ace/FIFO.cpp @@ -0,0 +1,78 @@ +// $Id: FIFO.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/FIFO.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FIFO.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_sys_stat.h" +#include "ace/OS_NS_fcntl.h" + +ACE_RCSID(ace, FIFO, "$Id: FIFO.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FIFO) + +void +ACE_FIFO::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FIFO::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("rendezvous_ = %s"), this->rendezvous_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_FIFO::open (const ACE_TCHAR *r, int flags, mode_t perms, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO::open"); + ACE_OS::strsncpy (this->rendezvous_, r, MAXPATHLEN); + + if ((flags & O_CREAT) != 0 + && ACE_OS::mkfifo (this->rendezvous_, perms) == -1 + && !(errno == EEXIST)) + return -1; + + this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa)); + return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; +} + +ACE_FIFO::ACE_FIFO (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO::ACE_FIFO"); + if (this->open (fifo_name, flags, perms, sa) == -1) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO"))); +} + +ACE_FIFO::ACE_FIFO (void) +{ +// ACE_TRACE ("ACE_FIFO::ACE_FIFO"); +} + +int +ACE_FIFO::close (void) +{ + ACE_TRACE ("ACE_FIFO::close"); + int result = 0; + + if (this->get_handle () != ACE_INVALID_HANDLE) + { + result = ACE_OS::close (this->get_handle ()); + this->set_handle (ACE_INVALID_HANDLE); + } + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO.h b/externals/ace/FIFO.h new file mode 100644 index 0000000..2d59056 --- /dev/null +++ b/externals/ace/FIFO.h @@ -0,0 +1,85 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file FIFO.h + * + * $Id: FIFO.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//========================================================================== + + +#ifndef ACE_FIFO_H +#define ACE_FIFO_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/IPC_SAP.h" +#include "ace/os_include/os_limits.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_FIFO + * + * @brief Abstract base class for UNIX FIFOs + * + * UNIX FIFOs are also known Named Pipes, which are totally + * unrelated to Win32 Named Pipes. If you want to use a local + * IPC mechanism that will be portable to both UNIX and Win32, + * take a look at the classes. + */ +class ACE_Export ACE_FIFO : public ACE_IPC_SAP +{ +public: + /// Open up the named pipe on the in accordance with the + /// flags. + int open (const ACE_TCHAR *rendezvous, int flags, mode_t perms, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Close down the ACE_FIFO without removing the rendezvous point. + int close (void); + + /// Close down the ACE_FIFO and remove the rendezvous point from the + /// file system. + int remove (void); + + /// Return the local address of this endpoint. + int get_local_addr (const ACE_TCHAR *&rendezvous) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = Make these protected to ensure that the class is "abstract." + /// Default constructor. + ACE_FIFO (void); + + /// Open up the named pipe on the in accordance with the + /// flags. + ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, mode_t perms, + LPSECURITY_ATTRIBUTES sa = 0); + +private: + /// Rendezvous point in the file system. + ACE_TCHAR rendezvous_[MAXPATHLEN + 1]; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FIFO.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FIFO_H */ diff --git a/externals/ace/FIFO.inl b/externals/ace/FIFO.inl new file mode 100644 index 0000000..05cc030 --- /dev/null +++ b/externals/ace/FIFO.inl @@ -0,0 +1,25 @@ +// -*- C++ -*- +// +// $Id: FIFO.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_unistd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_FIFO::get_local_addr (const ACE_TCHAR *&r) const +{ + ACE_TRACE ("ACE_FIFO::get_local_addr"); + r = this->rendezvous_; + return 0; +} + +ACE_INLINE int +ACE_FIFO::remove (void) +{ + ACE_TRACE ("ACE_FIFO::remove"); + int const result = this->close (); + return ACE_OS::unlink (this->rendezvous_) == -1 || result == -1 ? -1 : 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Recv.cpp b/externals/ace/FIFO_Recv.cpp new file mode 100644 index 0000000..254e30f --- /dev/null +++ b/externals/ace/FIFO_Recv.cpp @@ -0,0 +1,88 @@ +// $Id: FIFO_Recv.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/FIFO_Recv.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_fcntl.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FIFO_Recv.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FIFO_Recv, "$Id: FIFO_Recv.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv) + +void +ACE_FIFO_Recv::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FIFO_Recv::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_FIFO::dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("aux_handle_ = %d"), this->aux_handle_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_FIFO_Recv::close (void) +{ + ACE_TRACE ("ACE_FIFO_Recv::close"); + int result = ACE_FIFO::close (); + + if (this->aux_handle_ != ACE_INVALID_HANDLE) + return ACE_OS::close (this->aux_handle_); + else + return result; +} + +// Note that persistent means "open fifo for writing, as well as +// reading." This ensures that the fifo never gets EOF, even if there +// aren't any writers at the moment! + +int +ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + int persistent, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO_Recv::open"); + + if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1) + return -1; + else if (this->disable (ACE_NONBLOCK) == -1) + return -1; + else if (persistent + && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE) + return -1; + else + return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; +} + +ACE_FIFO_Recv::ACE_FIFO_Recv (void) + : aux_handle_ (ACE_INVALID_HANDLE) +{ + ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); +} + +ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + int persistent, + LPSECURITY_ATTRIBUTES sa) + : aux_handle_ (ACE_INVALID_HANDLE) +{ + ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); + + if (this->ACE_FIFO_Recv::open (fifo_name, + flags, + perms, + persistent, + sa) == -1) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv"))); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Recv.h b/externals/ace/FIFO_Recv.h new file mode 100644 index 0000000..c19d102 --- /dev/null +++ b/externals/ace/FIFO_Recv.h @@ -0,0 +1,85 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file FIFO_Recv.h + * + * $Id: FIFO_Recv.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//========================================================================== + + +#ifndef ACE_FIFO_RECV_H +#define ACE_FIFO_RECV_H + +#include /**/ "ace/pre.h" + +#include "ace/FIFO.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_fcntl.h" +#include "ace/Default_Constants.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_FIFO_Recv + * + * @brief Receiver side of the bytestream C++ wrapper for UNIX + * FIFOs. + */ +class ACE_Export ACE_FIFO_Recv : public ACE_FIFO +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_FIFO_Recv (void); + + /// Open up a bytestream named pipe for reading. + ACE_FIFO_Recv (const ACE_TCHAR *rendezvous, + int flags = O_CREAT | O_RDONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + int persistent = 1, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Open up a bytestream named pipe for reading. + int open (const ACE_TCHAR *rendezvous, + int flags = O_CREAT | O_RDONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + int persistent = 1, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Close down the named pipe. + int close (void); + + /// Recv @a buf of up to @a len bytes. + ssize_t recv (void *buf, size_t len); + + /// Recv @a buf of exactly @a len bytes (block until done). + ssize_t recv_n (void *buf, size_t len); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Auxiliary handle that is used to implement persistent FIFOs. + ACE_HANDLE aux_handle_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FIFO_Recv.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_FIFO_RECV_H */ diff --git a/externals/ace/FIFO_Recv.inl b/externals/ace/FIFO_Recv.inl new file mode 100644 index 0000000..d4c3fee --- /dev/null +++ b/externals/ace/FIFO_Recv.inl @@ -0,0 +1,24 @@ +// -*- C++ -*- +// +// $Id: FIFO_Recv.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ACE.h" +#include "ace/OS_NS_unistd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ssize_t +ACE_FIFO_Recv::recv (void *buf, size_t len) +{ + ACE_TRACE ("ACE_FIFO_Recv::recv"); + return ACE_OS::read (this->get_handle (), (char *) buf, len); +} + +ACE_INLINE ssize_t +ACE_FIFO_Recv::recv_n (void *buf, size_t n) +{ + ACE_TRACE ("ACE_FIFO_Recv::recv_n"); + return ACE::recv_n (this->get_handle (), buf, n); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Recv_Msg.cpp b/externals/ace/FIFO_Recv_Msg.cpp new file mode 100644 index 0000000..f389d03 --- /dev/null +++ b/externals/ace/FIFO_Recv_Msg.cpp @@ -0,0 +1,67 @@ +// $Id: FIFO_Recv_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/FIFO_Recv_Msg.h" + +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FIFO_Recv_Msg.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FIFO_Recv_Msg, "$Id: FIFO_Recv_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg) + +void +ACE_FIFO_Recv_Msg::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FIFO_Recv_Msg::dump"); + ACE_FIFO_Recv::dump (); +#endif /* ACE_HAS_DUMP */ +} + +// Note that persistent means "open FIFO for writing, as well as +// reading." This ensures that the FIFO never gets EOF, even if there +// aren't any writers at the moment! + +int +ACE_FIFO_Recv_Msg::open (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + int persistent, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::open"); + + return ACE_FIFO_Recv::open (fifo_name, + flags, + perms, + persistent, + sa); +} + +ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); +} + +ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + int persistent, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); + + if (this->ACE_FIFO_Recv_Msg::open (fifo_name, + flags, + perms, + persistent, + sa) == -1) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv_Msg"))); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Recv_Msg.h b/externals/ace/FIFO_Recv_Msg.h new file mode 100644 index 0000000..6b691e9 --- /dev/null +++ b/externals/ace/FIFO_Recv_Msg.h @@ -0,0 +1,138 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file FIFO_Recv_Msg.h + * + * $Id: FIFO_Recv_Msg.h 84480 2009-02-16 18:58:16Z johnnyw $ + * + * @author Doug Schmidt + */ +//============================================================================= + + +#ifndef ACE_FIFO_RECV_MSG_H +#define ACE_FIFO_RECV_MSG_H +#include /**/ "ace/pre.h" + +#include "ace/FIFO_Recv.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decls +class ACE_Str_Buf; + +/** + * @class ACE_FIFO_Recv_Msg + * + * @brief Receiver side for the record oriented C++ wrapper for UNIX FIFOs. + * + * This method works slightly differently on platforms with the + * @c ACE_HAS_STREAM_PIPES configuration setting than those without. + * With ACE_HAS_STREAM_PIPES, the @c getmsg() system function is used + * and it preserves message boundaries internally. Without + * @c ACE_HAS_STREAM_PIPES, the message boundaries are emulated by + * this class and ACE_FIFO_Send_Msg cooperating. The sending class + * first writes an integer number of bytes in the message, then the + * message. ACE_FIFO_Recv_Msg reads the count, then the data. + * The operational differences occur primarily when a message is larger + * than what a caller of this class requests. See recv() for details. + */ +class ACE_Export ACE_FIFO_Recv_Msg : public ACE_FIFO_Recv +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_FIFO_Recv_Msg (void); + + /// Open up a record-oriented named pipe for reading. + ACE_FIFO_Recv_Msg (const ACE_TCHAR *rendezvous, + int flags = O_CREAT | O_RDONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + int persistent = 1, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Open up a record-oriented named pipe for reading. + int open (const ACE_TCHAR *rendezvous, + int flags = O_CREAT | O_RDONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + int persistent = 1, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Receive a message based on attributes in an ACE_Str_Buf. + /** + * @param msg Reference to an ACE_Str_Buf whose @c buf member points + * to the memory to receive the data and @c maxlen member + * contains the maximum number of bytes to receive. + * On return after successfully reading data, the + * @c len member contains the number of bytes received and + * placed in the buffer pointed to by @c msg.buf. + * + * @retval -1 Error; consult @c errno for specific error number. + * @return If the @c ACE_HAS_STREAM_PIPES configuration setting is + * defined, the return value is the number of bytes received + * in the message and will be the same as @c buf.len. + * The return value from the @c getmsg() system function + * is discarded. + * If @c ACE_HAS_STREAM_PIPES is not defined, the number + * of bytes in the message read from the FIFO is returned. + * If the message is larger than the maximum length + * requested in @c msg.maxlen, the return value reflects + * the entire message length, and the @c msg.len member + * reflects how many bytes were actually placed in the + * caller's buffer. Any part of the message longer than + * @c msg.maxlen is discarded. + */ + ssize_t recv (ACE_Str_Buf &msg); + + /// Receive a message based on buffer pointer and maximum size. + /** + * @param buf Pointer to the memory to receive the data. + * @param len The maximum number of bytes to receive. + * + * @retval -1 Error; consult @c errno for specific error number. + * @return The number of bytes received in the message. For messages + * that are larger than the requested maximum size, the + * behavior is different depending on the @c ACE_HAS_STREAM_PIPES + * configuration setting. With @c ACE_HAS_STREAM_PIPES, + * the return value will be the same as @arg len (this is + * also possible if the message is exactly the same length + * as @arg len, and the two cases are indistinguishable). + * Without @c ACE_HAS_STREAM_PIPES, the return value is + * the total length of the message, including bytes in + * excess of @arg len. The excess bytes are discarded. + */ + ssize_t recv (void *buf, size_t len); + +#if defined (ACE_HAS_STREAM_PIPES) + /// Recv @a data and @a cntl message via Stream pipes. + ssize_t recv (ACE_Str_Buf *data, + ACE_Str_Buf *cntl, + int *flags); + + /// Recv @a data and @a cntl message via Stream pipes in "band" mode. + ssize_t recv (int *band, + ACE_Str_Buf *data, + ACE_Str_Buf *cntl, + int *flags); +#endif /* ACE_HAS_STREAM_PIPES */ + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FIFO_Recv_Msg.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FIFO_RECV_MSG_H */ diff --git a/externals/ace/FIFO_Recv_Msg.inl b/externals/ace/FIFO_Recv_Msg.inl new file mode 100644 index 0000000..0a0b067 --- /dev/null +++ b/externals/ace/FIFO_Recv_Msg.inl @@ -0,0 +1,137 @@ +// -*- C++ -*- +// +// $Id: FIFO_Recv_Msg.inl 82559 2008-08-07 20:23:07Z parsons $ + +#include "ace/Min_Max.h" +#include "ace/OS_NS_stropts.h" +#include "ace/Truncate.h" + +#if !defined (ACE_HAS_STREAM_PIPES) +#include "ace/OS_NS_unistd.h" +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ssize_t +ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); +#if defined (ACE_HAS_STREAM_PIPES) + int i = 0; + if (ACE_OS::getmsg (this->get_handle (), + (strbuf *) 0, + (strbuf *) &recv_msg, + &i) == -1) + { + return -1; + } + else + { + return recv_msg.len; + } +#else /* Do the ol' 2-read trick... */ + if (ACE_OS::read (this->get_handle (), + (char *) &recv_msg.len, + sizeof recv_msg.len) != sizeof recv_msg.len) + { + return -1; + } + else + { + size_t remaining = static_cast (recv_msg.len); + size_t requested = static_cast (recv_msg.maxlen); + ssize_t recv_len = ACE_OS::read (this->get_handle (), + (char *) recv_msg.buf, + ACE_MIN (remaining, requested)); + + if (recv_len == -1) + { + return -1; + } + + // Tell caller what's really in the buffer. + recv_msg.len = static_cast (recv_len); + + // If there are more bytes remaining in the message, read them and + // throw them away. Leaving them in the FIFO would make it difficult + // to find the start of the next message in the fifo. + // Since the ACE_HAS_STREAM_PIPES version of this method doesn't + // return getmsg()'s indication of "data remaining", don't worry about + // saving the indication here either to read the remainder later. + size_t total_msg_size = remaining; + remaining -= recv_len; + + while (remaining > 0) + { + const size_t throw_away = 1024; + char dev_null[throw_away]; + recv_len = ACE_OS::read (this->get_handle (), + dev_null, + ACE_MIN (remaining, throw_away)); + + if (recv_len == -1) + { + break; + } + + remaining -= recv_len; + } + + return ACE_Utils::truncate_cast (total_msg_size); + } +#endif /* ACE_HAS_STREAM_PIPES */ +} + +ACE_INLINE ssize_t +ACE_FIFO_Recv_Msg::recv (void *buf, size_t max_len) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); + ACE_Str_Buf recv_msg ((char *) buf, 0, static_cast (max_len)); + + return this->recv (recv_msg); +} + +#if defined (ACE_HAS_STREAM_PIPES) +ACE_INLINE ssize_t +ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, + ACE_Str_Buf *cntl, + int *flags) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); + if (ACE_OS::getmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + flags) == -1) + { + return -1; + } + else + { + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); + } +} + +ACE_INLINE ssize_t +ACE_FIFO_Recv_Msg::recv (int *band, + ACE_Str_Buf *data, + ACE_Str_Buf *cntl, + int *flags) +{ + ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); + + if (ACE_OS::getpmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + band, + flags) == -1) + { + return -1; + } + else + { + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); + } +} +#endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Send.cpp b/externals/ace/FIFO_Send.cpp new file mode 100644 index 0000000..720e63c --- /dev/null +++ b/externals/ace/FIFO_Send.cpp @@ -0,0 +1,58 @@ +// $Id: FIFO_Send.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/FIFO_Send.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FIFO_Send.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FIFO_Send, "$Id: FIFO_Send.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send) + +void +ACE_FIFO_Send::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FIFO_Send::dump"); + ACE_FIFO::dump (); +#endif /* ACE_HAS_DUMP */ +} + +ACE_FIFO_Send::ACE_FIFO_Send (void) +{ +// ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send"); +} + +int +ACE_FIFO_Send::open (const ACE_TCHAR *rendezvous_name, + int flags, + mode_t perms, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO_Send::open"); + return ACE_FIFO::open (rendezvous_name, + flags | O_WRONLY, + perms, + sa); +} + +ACE_FIFO_Send::ACE_FIFO_Send (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send"); + if (this->ACE_FIFO_Send::open (fifo_name, + flags, + perms, + sa) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_FIFO_Send::ACE_FIFO_Send"))); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Send.h b/externals/ace/FIFO_Send.h new file mode 100644 index 0000000..cc0fc28 --- /dev/null +++ b/externals/ace/FIFO_Send.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file FIFO_Send.h + * + * $Id: FIFO_Send.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//========================================================================== + + +#ifndef ACE_FIFO_SEND_H +#define ACE_FIFO_SEND_H + +#include /**/ "ace/pre.h" + +#include "ace/FIFO.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_fcntl.h" +#include "ace/Default_Constants.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_FIFO_Send + * + * @brief Sender side for the bytestream C++ wrapper for UNIX FIFOs + */ +class ACE_Export ACE_FIFO_Send : public ACE_FIFO +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_FIFO_Send (void); + + /// Open up a bytestream named pipe for writing. + ACE_FIFO_Send (const ACE_TCHAR *rendezvous, + int flags = O_WRONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Open up a bytestream named pipe for writing. + int open (const ACE_TCHAR *rendezvous, + int flags = O_WRONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Send @a buf of up to @a len bytes. + ssize_t send (const void *buf, size_t len); + + /// Send @a buf of exactly @a len bytes (block until done). + ssize_t send_n (const void *buf, size_t len); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FIFO_Send.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_FIFO_SEND_H */ diff --git a/externals/ace/FIFO_Send.inl b/externals/ace/FIFO_Send.inl new file mode 100644 index 0000000..a01facd --- /dev/null +++ b/externals/ace/FIFO_Send.inl @@ -0,0 +1,24 @@ +// -*- C++ -*- +// +// $Id: FIFO_Send.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ACE.h" +#include "ace/OS_NS_unistd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ssize_t +ACE_FIFO_Send::send (const void *buf, size_t len) +{ + ACE_TRACE ("ACE_FIFO_Send::send"); + return ACE_OS::write (this->get_handle (), (const char *) buf, len); +} + +ACE_INLINE ssize_t +ACE_FIFO_Send::send_n (const void *buf, size_t n) +{ + ACE_TRACE ("ACE_FIFO_Send::send_n"); + return ACE::send_n (this->get_handle (), buf, n); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Send_Msg.cpp b/externals/ace/FIFO_Send_Msg.cpp new file mode 100644 index 0000000..b3bbae0 --- /dev/null +++ b/externals/ace/FIFO_Send_Msg.cpp @@ -0,0 +1,80 @@ +// $Id: FIFO_Send_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/FIFO_Send_Msg.h" + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_sys_uio.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FIFO_Send_Msg.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FIFO_Send_Msg, "$Id: FIFO_Send_Msg.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg) + +void +ACE_FIFO_Send_Msg::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FIFO_Send_Msg::dump"); + ACE_FIFO_Send::dump (); +#endif /* ACE_HAS_DUMP */ +} + +ssize_t +ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg) +{ + // ACE_TRACE ("ACE_FIFO_Send_Msg::send"); +#if defined (ACE_HAS_STREAM_PIPES) + if (ACE_OS::putmsg (this->get_handle (), + (strbuf *) 0, + (strbuf *) &send_msg, + 0) == -1) + return -1; + else + return send_msg.len; +#else + iovec iov[2]; + + iov[0].iov_base = (char *) &send_msg.len; + iov[0].iov_len = sizeof send_msg.len; + + iov[1].iov_base = (char *) send_msg.buf; + iov[1].iov_len = static_cast (send_msg.len); + + ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2); + if (sent > 0) + sent -= iov[0].iov_len; // Don't count the length we added. + return sent; +#endif /* ACE_HAS_STREAM_PIPES */ +} + +ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void) +{ +// ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg"); +} + +int +ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO_Send_Msg::open"); + return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa); +} + +ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name, + int flags, + mode_t perms, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg"); + if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Send_Msg"))); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FIFO_Send_Msg.h b/externals/ace/FIFO_Send_Msg.h new file mode 100644 index 0000000..434ae10 --- /dev/null +++ b/externals/ace/FIFO_Send_Msg.h @@ -0,0 +1,91 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file FIFO_Send_Msg.h + * + * $Id: FIFO_Send_Msg.h 84480 2009-02-16 18:58:16Z johnnyw $ + * + * @author Doug Schmidt + */ +//============================================================================= + + +#ifndef ACE_FIFO_SEND_MSG_H +#define ACE_FIFO_SEND_MSG_H +#include /**/ "ace/pre.h" + +#include "ace/FIFO_Send.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_STREAM_PIPES) +# include "ace/OS_NS_stropts.h" +#endif /* ACE_HAS_STREAM_PIPES */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward Decls +class ACE_Str_Buf; + +/** + * @class ACE_FIFO_Send_Msg + * + * @brief Sender side for the Record oriented C++ wrapper for UNIX + * FIFOs. + */ +class ACE_Export ACE_FIFO_Send_Msg : public ACE_FIFO_Send +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_FIFO_Send_Msg (void); + + /// Open up a record-oriented named pipe for writing. + ACE_FIFO_Send_Msg (const ACE_TCHAR *rendezvous, + int flags = O_WRONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Open up a record-oriented named pipe for writing. + int open (const ACE_TCHAR *rendezvous, + int flags = O_WRONLY, + mode_t perms = ACE_DEFAULT_FILE_PERMS, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Send @a buf of up to @a len bytes. + ssize_t send (const ACE_Str_Buf &msg); + + /// Send @a buf of exactly @a len bytes (block until done). + ssize_t send (const void *buf, size_t len); + +#if defined (ACE_HAS_STREAM_PIPES) + /// Send @a data and @a cntl message via Stream pipes. + ssize_t send (const ACE_Str_Buf *data, + const ACE_Str_Buf *cntl = 0, + int flags = 0); + + /// Send @a data and @a cntl message via Stream pipes in "band" mode. + ssize_t send (int band, + const ACE_Str_Buf *data, + const ACE_Str_Buf *cntl = 0, + int flags = MSG_BAND); +#endif /* ACE_HAS_STREAM_PIPES */ + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FIFO_Send_Msg.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FIFO_SEND_MSG_H */ diff --git a/externals/ace/FIFO_Send_Msg.inl b/externals/ace/FIFO_Send_Msg.inl new file mode 100644 index 0000000..0a34e64 --- /dev/null +++ b/externals/ace/FIFO_Send_Msg.inl @@ -0,0 +1,53 @@ +// -*- C++ -*- +// +// $Id: FIFO_Send_Msg.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_stropts.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ssize_t +ACE_FIFO_Send_Msg::send (const void *buf, size_t len) +{ + ACE_TRACE ("ACE_FIFO_Send_Msg::send"); + ACE_Str_Buf send_msg ((char *) buf, static_cast (len)); + + return this->send (send_msg); +} + +#if defined (ACE_HAS_STREAM_PIPES) +ACE_INLINE ssize_t +ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data, + const ACE_Str_Buf *cntl, + int flags) +{ + ACE_TRACE ("ACE_FIFO_Send_Msg::send"); + if (ACE_OS::putmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + flags) == -1) + return-1; + else + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); +} + +ACE_INLINE ssize_t +ACE_FIFO_Send_Msg::send (int band, + const ACE_Str_Buf *data, + const ACE_Str_Buf *cntl, + int flags) +{ + ACE_TRACE ("ACE_FIFO_Send_Msg::send"); + + if (ACE_OS::putpmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + band, + flags) == -1) + return -1; + else + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); +} +#endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE.cpp b/externals/ace/FILE.cpp new file mode 100644 index 0000000..8fe88d1 --- /dev/null +++ b/externals/ace/FILE.cpp @@ -0,0 +1,147 @@ +// $Id: FILE.cpp 80826 2008-03-04 14:51:23Z wotte $ + +/* Defines the member functions for the base class of the ACE_IO_SAP + ACE_FILE abstraction. */ + +#include "ace/FILE.h" + +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_sys_stat.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FILE.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FILE, "$Id: FILE.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FILE) + +void +ACE_FILE::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FILE::dump"); + ACE_IO_SAP::dump (); +#endif /* ACE_HAS_DUMP */ +} + +// This is the do-nothing constructor. + +ACE_FILE::ACE_FILE (void) +{ + ACE_TRACE ("ACE_FILE::ACE_FILE"); +} + +// Close the file + +int +ACE_FILE::close (void) +{ + ACE_TRACE ("ACE_FILE::close"); + int result = 0; + + if (this->get_handle () != ACE_INVALID_HANDLE) + { + result = ACE_OS::close (this->get_handle ()); + this->set_handle (ACE_INVALID_HANDLE); + } + return result; +} + +int +ACE_FILE::get_info (ACE_FILE_Info *finfo) +{ + ACE_TRACE ("ACE_FILE::get_info"); + ACE_stat filestatus; + + int const result = ACE_OS::fstat (this->get_handle (), &filestatus); + + if (result == 0) + { + finfo->mode_ = filestatus.st_mode; + finfo->nlink_ = filestatus.st_nlink; + finfo->size_ = filestatus.st_size; + } + + return result; +} + +int +ACE_FILE::get_info (ACE_FILE_Info &finfo) +{ + ACE_TRACE ("ACE_FILE::get_info"); + + return this->get_info (&finfo); +} + +int +ACE_FILE::truncate (ACE_OFF_T length) +{ + ACE_TRACE ("ACE_FILE::truncate"); + return ACE_OS::ftruncate (this->get_handle (), length); +} + +ACE_OFF_T +ACE_FILE::seek (ACE_OFF_T offset, int startpos) +{ + return ACE_OS::lseek (this->get_handle (), offset, startpos); +} + +ACE_OFF_T +ACE_FILE::tell (void) +{ + ACE_TRACE ("ACE_FILE::tell"); + return ACE_OS::lseek (this->get_handle (), 0, SEEK_CUR); +} + +// Return the local endpoint address. + +int +ACE_FILE::get_local_addr (ACE_Addr &addr) const +{ + ACE_TRACE ("ACE_FILE::get_local_addr"); + + // Perform the downcast since had better be an + // . + ACE_FILE_Addr *file_addr = + dynamic_cast (&addr); + + if (file_addr == 0) + return -1; + else + { + *file_addr = this->addr_; + return 0; + } +} + +// Return the same result as . + +int +ACE_FILE::get_remote_addr (ACE_Addr &addr) const +{ + ACE_TRACE ("ACE_FILE::get_remote_addr"); + + return this->get_local_addr (addr); +} + +int +ACE_FILE::remove (void) +{ + ACE_TRACE ("ACE_FILE::remove"); + + this->close (); + return ACE_OS::unlink (this->addr_.get_path_name ()); +} + +int +ACE_FILE::unlink (void) +{ + ACE_TRACE ("ACE_FILE::unlink"); + + return ACE_OS::unlink (this->addr_.get_path_name ()); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE.h b/externals/ace/FILE.h new file mode 100644 index 0000000..407a033 --- /dev/null +++ b/externals/ace/FILE.h @@ -0,0 +1,139 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file FILE.h + * + * $Id: FILE.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Gerhard Lenzer + */ +//============================================================================= + +#ifndef ACE_FILE_H +#define ACE_FILE_H +#include /**/ "ace/pre.h" + +#include "ace/IO_SAP.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/FILE_Addr.h" + +// The following is necessary since many C++ compilers don't support +// typedef'd types inside of classes used as formal template +// arguments... ;-(. Luckily, using the C++ preprocessor I can hide +// most of this nastiness! + +#if defined (ACE_HAS_TEMPLATE_TYPEDEFS) +#define ACE_FILE_CONNECTOR ACE_FILE_Connector +#define ACE_FILE_STREAM ACE_FILE_IO +#else /* TEMPLATES are broken (must be a cfront-based compiler...) */ +#define ACE_FILE_CONNECTOR ACE_FILE_Connector, ACE_FILE_Addr +#define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr +#endif /* ACE_TEMPLATE_TYPEDEFS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_FILE_Info + * + * @brief Abstracts basic OS FILE information. + */ +class ACE_Export ACE_FILE_Info +{ +public: + /// Mode of file + mode_t mode_; + + /// No of links + nlink_t nlink_; + + /// Size of file + ACE_OFF_T size_; +}; + +/** + * @class ACE_FILE + * + * @brief Defines the core methods of the ACE_FILE abstraction. + */ +class ACE_Export ACE_FILE : public ACE_IO_SAP +{ +public: + /// Close the ACE_FILE handle without removing the ACE_FILE from + /// the file system. + int close (void); + + /// Close and remove the ACE_FILE from the file system. + int remove (void); + + /// Remove the ACE_FILE from the file system without closing the + /// ACE_FILE handle. + int unlink (void); + + /// Get information on this ACE_FILE. + int get_info (ACE_FILE_Info *finfo); + + /// Get information on this ACE_FILE. + int get_info (ACE_FILE_Info &finfo); + + /// Set filesize to length byte. + int truncate (ACE_OFF_T length); + + /** + * Sets the file pointer as follows: + * o If is , the pointer is set to @a offset + * bytes. + * + * o If is , the pointer is set to its + * current location plus @a offset. + * + * o If is , the pointer is set to the size + * of the file plus offset. + */ + ACE_OFF_T seek (ACE_OFF_T offset, + int whence = SEEK_CUR); + + /// Return an offset for the file handle. + ACE_OFF_T tell (void); + + /** + * Disable signal @a signum + * This is here to prevent Win32 from + * disabling SPIPE using socket calls + */ + int disable (int signum) const ; + + /// Return the local endpoint address in the referenced ACE_Addr. + /// Returns 0 if successful, else -1. + int get_local_addr (ACE_Addr &) const; + + /// Return the same thing as get_local_addr(). + int get_remote_addr (ACE_Addr &) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Ensure that this class is only created by the + /// ACE_FILE_Connector. + ACE_FILE (void); + + /// File we are "connected" with... + ACE_FILE_Addr addr_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FILE.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FILE_H */ diff --git a/externals/ace/FILE.inl b/externals/ace/FILE.inl new file mode 100644 index 0000000..288374a --- /dev/null +++ b/externals/ace/FILE.inl @@ -0,0 +1,18 @@ +// -*- C++ -*- +// +// $Id: FILE.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_FILE::disable (int signum) const +{ +#if defined (ACE_WIN32) + ACE_UNUSED_ARG (signum) ; + return 0 ; +#else /* ACE_WIN32 */ + return ACE_IO_SAP::disable (signum) ; +#endif /* ACE_WIN32 */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE_Addr.cpp b/externals/ace/FILE_Addr.cpp new file mode 100644 index 0000000..6d8fbeb --- /dev/null +++ b/externals/ace/FILE_Addr.cpp @@ -0,0 +1,124 @@ +// $Id: FILE_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/FILE_Addr.h" +#include "ace/Lib_Find.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdlib.h" +#include "ace/OS_NS_string.h" +#include "ace/os_include/sys/os_socket.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FILE_Addr.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FILE_Addr, "$Id: FILE_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Addr) + +ACE_FILE_Addr::ACE_FILE_Addr (void) + : ACE_Addr (AF_FILE, sizeof this->filename_ / sizeof (ACE_TCHAR)) +{ + this->filename_[0] = '\0'; +} + +int +ACE_FILE_Addr::set (const ACE_FILE_Addr &sa) +{ + if (sa.get_type () == AF_ANY) + { +#if defined (ACE_DEFAULT_TEMP_FILE) + // Create a temporary file. + ACE_OS::strcpy (this->filename_, + ACE_DEFAULT_TEMP_FILE); +#else /* ACE_DEFAULT_TEMP_FILE */ + if (ACE::get_temp_dir (this->filename_, MAXPATHLEN - 15) == -1) + // -15 for ace-file-XXXXXX + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Temporary path too long, ") + ACE_TEXT ("defaulting to current directory\n"))); + this->filename_[0] = 0; + } + + // Add the filename to the end + ACE_OS::strcat (this->filename_, ACE_TEXT ("ace-fileXXXXXX")); + +#endif /* ACE_DEFAULT_TEMP_FILE */ + + if (ACE_OS::mktemp (this->filename_) == 0) + return -1; + this->base_set (AF_FILE, + static_cast (ACE_OS::strlen (this->filename_) + 1)); + } + else + { + (void)ACE_OS::strsncpy (this->filename_, sa.filename_, sa.get_size ()); + + this->base_set (sa.get_type (), sa.get_size ()); + } + return 0; +} + +// Copy constructor. + +ACE_FILE_Addr::ACE_FILE_Addr (const ACE_FILE_Addr &sa) + : ACE_Addr (AF_FILE, sizeof this->filename_) +{ + this->set (sa); +} + +int +ACE_FILE_Addr::set (const ACE_TCHAR *filename) +{ + this->ACE_Addr::base_set (AF_FILE, + static_cast (ACE_OS::strlen (filename) + 1)); + (void) ACE_OS::strsncpy (this->filename_, + filename, + sizeof this->filename_ / sizeof (ACE_TCHAR)); + return 0; +} + +ACE_FILE_Addr & +ACE_FILE_Addr::operator= (const ACE_FILE_Addr &sa) +{ + if (this != &sa) + this->set (sa); + return *this; +} + +// Create a ACE_Addr from a ACE_FILE pathname. + +ACE_FILE_Addr::ACE_FILE_Addr (const ACE_TCHAR *filename) +{ + this->set (filename); +} + +int +ACE_FILE_Addr::addr_to_string (ACE_TCHAR *s, size_t len) const +{ + ACE_OS::strsncpy (s, this->filename_, len); + return 0; +} + +// Return the address. + +void * +ACE_FILE_Addr::get_addr (void) const +{ + return (void *)&this->filename_; +} + +void +ACE_FILE_Addr::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FILE_Addr::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("filename_ = %s"), this->filename_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE_Addr.h b/externals/ace/FILE_Addr.h new file mode 100644 index 0000000..432275b --- /dev/null +++ b/externals/ace/FILE_Addr.h @@ -0,0 +1,89 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file FILE_Addr.h + * + * $Id: FILE_Addr.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_FILE_ADDR_H +#define ACE_FILE_ADDR_H +#include /**/ "ace/pre.h" + +#include "ace/Addr.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Flag_Manip.h" +#include "ace/os_include/os_dirent.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_FILE_Addr + * + * @brief Defines the FILE address family address format. + */ +class ACE_Export ACE_FILE_Addr : public ACE_Addr +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_FILE_Addr (void); + + /// Copy constructor. + ACE_FILE_Addr (const ACE_FILE_Addr &sa); + + /// Acts like a copy constructor. If @a sa == ACE_Addr::sap_any then + /// create a temporary filename using ACE_OS::mktemp. + int set (const ACE_FILE_Addr &sa); + + /// Create a ACE_FILE_Addr from a pathname. + explicit ACE_FILE_Addr (const ACE_TCHAR *filename); + + /// Create a ACE_FILE_Addr from a pathname. + int set (const ACE_TCHAR *filename); + + /// Assignment operator. + ACE_FILE_Addr &operator= (const ACE_FILE_Addr &); + + /// Return a pointer to the address. + virtual void *get_addr (void) const; + + /// Transform the current address into string format. + virtual int addr_to_string (ACE_TCHAR *addr, size_t) const; + + /// Compare two addresses for equality. + bool operator == (const ACE_FILE_Addr &SAP) const; + + /// Compare two addresses for inequality. + bool operator != (const ACE_FILE_Addr &SAP) const; + + /// Return the path name used for the rendezvous point. + const ACE_TCHAR *get_path_name (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Name of the file. + ACE_TCHAR filename_[MAXPATHLEN + 1]; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FILE_Addr.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FILE_ADDR_H */ diff --git a/externals/ace/FILE_Addr.inl b/externals/ace/FILE_Addr.inl new file mode 100644 index 0000000..0ae7d31 --- /dev/null +++ b/externals/ace/FILE_Addr.inl @@ -0,0 +1,34 @@ +// -*- C++ -*- +// +// $Id: FILE_Addr.inl 80826 2008-03-04 14:51:23Z wotte $ + + +#include "ace/SString.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Compare two addresses for equality. + +ACE_INLINE bool +ACE_FILE_Addr::operator == (const ACE_FILE_Addr &sap) const +{ + return ACE_OS::strcmp (this->filename_, sap.filename_) == 0; +} + +// Compare two addresses for inequality. + +ACE_INLINE bool +ACE_FILE_Addr::operator != (const ACE_FILE_Addr &sap) const +{ + return !((*this) == sap); // This is lazy, of course... ;-) +} + +// Return the path name used for the rendezvous point. + +ACE_INLINE const ACE_TCHAR * +ACE_FILE_Addr::get_path_name (void) const +{ + return this->filename_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE_Connector.cpp b/externals/ace/FILE_Connector.cpp new file mode 100644 index 0000000..b59b1e8 --- /dev/null +++ b/externals/ace/FILE_Connector.cpp @@ -0,0 +1,84 @@ +// $Id: FILE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/FILE_Connector.h" +#include "ace/Handle_Ops.h" +#include "ace/OS_NS_stdlib.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FILE_Connector.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FILE_Connector, "$Id: FILE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Connector) + +void +ACE_FILE_Connector::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FILE_Connector::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_FILE_Connector::ACE_FILE_Connector (void) +{ + ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector"); +} + +int +ACE_FILE_Connector::connect (ACE_FILE_IO &new_io, + const ACE_FILE_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &, + int, + int flags, + int perms) +{ + ACE_TRACE ("ACE_FILE_Connector::connect"); + ACE_ASSERT (new_io.get_handle () == ACE_INVALID_HANDLE); + + ACE_HANDLE handle = ACE_INVALID_HANDLE; + + // Check to see if caller has requested that we create the filename. + if (reinterpret_cast ( + const_cast (remote_sap)) == ACE_Addr::sap_any) + { + // Create a new temporary file. + // Use ACE_OS::mkstemp() if it is available since it avoids a + // race condition, and subsequently a security hole due to that + // race condition (specifically, a denial-of-service attack). + // + // However, using mkstemp() prevents us from doing a timed open + // since it opens the file for us. Better to avoid the race + // condition. + char filename[] = "ace-file-XXXXXX"; + + handle = ACE_OS::mkstemp (filename); // mkstemp() replaces "XXXXXX" + + if (handle == ACE_INVALID_HANDLE + || new_io.addr_.set (ACE_TEXT_CHAR_TO_TCHAR (filename)) != 0) + return -1; + + new_io.set_handle (handle); + + return 0; + } + else + new_io.addr_ = remote_sap; // class copy. + + handle = ACE::handle_timed_open (timeout, + new_io.addr_.get_path_name (), + flags, + perms); + + new_io.set_handle (handle); + return handle == ACE_INVALID_HANDLE ? -1 : 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE_Connector.h b/externals/ace/FILE_Connector.h new file mode 100644 index 0000000..624ab3d --- /dev/null +++ b/externals/ace/FILE_Connector.h @@ -0,0 +1,113 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file FILE_Connector.h + * + * $Id: FILE_Connector.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Doug Schmidt + */ +//============================================================================= + +#ifndef ACE_FILE_CONNECTOR_H +#define ACE_FILE_CONNECTOR_H +#include /**/ "ace/pre.h" + +#include "ace/FILE_IO.h" +#include "ace/Log_Msg.h" +#include "ace/os_include/os_fcntl.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_FILE_Connector + * + * @brief Defines an active connection factory for the ACE_FILE wrappers. + * + * Note that the O_APPEND flag is only partly supported on Win32. If + * you specify O_APPEND, then the file pointer will be positioned at + * the end of the file initially during open, but it is not + * re-positioned at the end prior to each write, as specified by + * POSIX. This is generally good enough for typical situations, but + * it is ``not quite right'' in its semantics. + */ +class ACE_Export ACE_FILE_Connector +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_FILE_Connector (void); + + /** + * Actively ``connect'' and produce a @a new_io ACE_FILE_IO object + * if things go well. The @a remote_sap is the file that we are + * trying to create/open. If it's the default value of + * ACE_Addr::sap_any then the user is letting the OS create the + * filename (via ). The @a timeout is the amount of + * time to wait to create/open the file. If it's 0 then we block + * indefinitely. If *timeout == {0, 0} then the file is created + * using non-blocking mode. If *timeout > {0, 0} then this is the + * maximum amount of time to wait before timing out. The + * @a local_sap and @a reuse_addr parameters are ignored. The @a flags + * and @a perms arguments are passed down to the + * method. + */ + ACE_FILE_Connector (ACE_FILE_IO &new_io, + const ACE_FILE_Addr &remote_sap, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR | O_CREAT, + int perms = ACE_DEFAULT_FILE_PERMS); + + /** + * Actively ``connect'' and produce a @a new_io object + * if things go well. The @a remote_sap is the file that we are + * trying to create/open. If it's the default value of + * ACE_Addr::sap_any then the user is letting the OS create the + * filename (via ). The @a timeout is the amount of + * time to wait to create/open the file. If it's 0 then we block + * indefinitely. If *timeout == {0, 0} then the file is created + * using non-blocking mode. In this case, if the create/open can't + * be done immediately the value of -1 is returned with . If *timeout > {0, 0} then this is the maximum amount of + * time to wait before timing out. If the time expires before the + * connection is made @c errno == ETIME. The @a local_sap and + * @a reuse_addr parameters are ignored. The @a flags and @a perms + * arguments are passed down to the method. + */ + int connect (ACE_FILE_IO &new_io, + const ACE_FILE_Addr &remote_sap, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR | O_CREAT, + int perms = ACE_DEFAULT_FILE_PERMS); + + /// Resets any event associations on this handle + bool reset_new_handle (ACE_HANDLE handle); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + // = Meta-type "trait" information. + typedef ACE_FILE_Addr PEER_ADDR; + typedef ACE_FILE_IO PEER_STREAM; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FILE_Connector.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FILE_CONNECTOR_H */ diff --git a/externals/ace/FILE_Connector.inl b/externals/ace/FILE_Connector.inl new file mode 100644 index 0000000..953f661 --- /dev/null +++ b/externals/ace/FILE_Connector.inl @@ -0,0 +1,35 @@ +// -*- C++ -*- +// +// $Id: FILE_Connector.inl 82723 2008-09-16 09:35:44Z johnnyw $ + +// Creates a Local ACE_FILE. + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_FILE_Connector::ACE_FILE_Connector (ACE_FILE_IO &new_io, + const ACE_FILE_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector"); + if (this->connect (new_io, remote_sap, timeout, local_sap, + reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE + && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("address %s, %p\n"), + remote_sap.get_path_name (), + ACE_TEXT ("ACE_FILE_IO"))); +} + +ACE_INLINE bool +ACE_FILE_Connector::reset_new_handle (ACE_HANDLE) +{ + // Nothing to do here since the handle is not a socket + return false; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE_IO.cpp b/externals/ace/FILE_IO.cpp new file mode 100644 index 0000000..d6bf084 --- /dev/null +++ b/externals/ace/FILE_IO.cpp @@ -0,0 +1,145 @@ +// $Id: FILE_IO.cpp 82559 2008-08-07 20:23:07Z parsons $ + +#include "ace/FILE_IO.h" + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_sys_stat.h" +#include "ace/OS_Memory.h" +#include "ace/Truncate.h" + +#if !defined (__ACE_INLINE__) +#include "ace/FILE_IO.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, FILE_IO, "$Id: FILE_IO.cpp 82559 2008-08-07 20:23:07Z parsons $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_FILE_IO) + +void +ACE_FILE_IO::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_FILE_IO::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->addr_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// Simple-minded do nothing constructor. + +ACE_FILE_IO::ACE_FILE_IO (void) +{ + ACE_TRACE ("ACE_FILE_IO::ACE_FILE_IO"); +} + +// Send N char *ptrs and int lengths. Note that the char *'s precede +// the ints (basically, an varargs version of writev). The count N is +// the *total* number of trailing arguments, *not* a couple of the +// number of tuple pairs! + +ssize_t +ACE_FILE_IO::send (size_t n, ...) const +{ + ACE_TRACE ("ACE_FILE_IO::send"); + va_list argp; + int total_tuples = ACE_Utils::truncate_cast (n / 2); + iovec *iovp = 0; +#if defined (ACE_HAS_ALLOCA) + iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); +#else + ACE_NEW_RETURN (iovp, + iovec[total_tuples], + -1); +#endif /* !defined (ACE_HAS_ALLOCA) */ + + va_start (argp, n); + + for (int i = 0; i < total_tuples; i++) + { + iovp[i].iov_base = va_arg (argp, char *); + iovp[i].iov_len = va_arg (argp, int); + } + + ssize_t result = ACE_OS::writev (this->get_handle (), + iovp, + total_tuples); +#if !defined (ACE_HAS_ALLOCA) + delete [] iovp; +#endif /* !defined (ACE_HAS_ALLOCA) */ + va_end (argp); + return result; +} + +// This is basically an interface to ACE_OS::readv, that doesn't use +// the struct iovec explicitly. The ... can be passed as an arbitrary +// number of (char *ptr, int len) tuples. However, the count N is the +// *total* number of trailing arguments, *not* a couple of the number +// of tuple pairs! + +ssize_t +ACE_FILE_IO::recv (size_t n, ...) const +{ + ACE_TRACE ("ACE_FILE_IO::recv"); + va_list argp; + int total_tuples = ACE_Utils::truncate_cast (n / 2); + iovec *iovp = 0; +#if defined (ACE_HAS_ALLOCA) + iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); +#else + ACE_NEW_RETURN (iovp, + iovec[total_tuples], + -1); +#endif /* !defined (ACE_HAS_ALLOCA) */ + + va_start (argp, n); + + for (int i = 0; i < total_tuples; i++) + { + iovp[i].iov_base = va_arg (argp, char *); + iovp[i].iov_len = va_arg (argp, int); + } + + ssize_t const result = ACE_OS::readv (this->get_handle (), + iovp, + total_tuples); +#if !defined (ACE_HAS_ALLOCA) + delete [] iovp; +#endif /* !defined (ACE_HAS_ALLOCA) */ + va_end (argp); + return result; +} + +// Allows a client to read from a file without having to provide a +// buffer to read. This method determines how much data is in the +// file, allocates a buffer of this size, reads in the data, and +// returns the number of bytes read. + +ssize_t +ACE_FILE_IO::recvv (iovec *io_vec) +{ + ACE_TRACE ("ACE_FILE_IO::recvv"); + + io_vec->iov_base = 0; + size_t const length = + static_cast (ACE_OS::filesize (this->get_handle ())); + + if (length > 0) + { + ACE_NEW_RETURN (io_vec->iov_base, + char[length], + -1); + io_vec->iov_len = this->recv_n (io_vec->iov_base, + length); + return io_vec->iov_len; + } + else + { + return ACE_Utils::truncate_cast (length); + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/FILE_IO.h b/externals/ace/FILE_IO.h new file mode 100644 index 0000000..951069e --- /dev/null +++ b/externals/ace/FILE_IO.h @@ -0,0 +1,170 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file FILE_IO.h + * + * $Id: FILE_IO.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_FILE_IO_H +#define ACE_FILE_IO_H +#include /**/ "ace/pre.h" + +#include "ace/FILE.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/FILE_Addr.h" + +// Used in the FILE_IO.h file... +#include "ace/os_include/os_stdio.h" +#include "ace/os_include/sys/os_uio.h" + +#if defined (ACE_HAS_STREAM_PIPES) +# include "ace/OS_NS_stropts.h" +#endif /* ACE_HAS_STREAM_PIPES */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decl. +class ACE_Message_Block; +class ACE_Time_Value; + +/** + * @class ACE_FILE_IO + * + * @brief Read/Write operations on Files + */ +class ACE_Export ACE_FILE_IO : public ACE_FILE +{ +public: + friend class ACE_FILE_Connector; + + // = Initialization method. + /// Default constructor. + ACE_FILE_IO (void); + + /// send upto @a n bytes in @a buf. + ssize_t send (const void *buf, size_t n) const; + + /// Recv upto @a n bytes in @a buf. + ssize_t recv (void *buf, size_t n) const; + + /// Send n bytes, keep trying until n are sent. + ssize_t send_n (const void *buf, size_t n) const; + + /// Send all the @a message_blocks chained through their and + /// pointers. This call uses the underlying OS gather-write + /// operation to reduce the domain-crossing penalty. + ssize_t send_n (const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + /// Recv n bytes, keep trying until n are received. + ssize_t recv_n (void *buf, size_t n) const; + +#if defined (ACE_HAS_STREAM_PIPES) + /// Send bytes via STREAM pipes. + ssize_t send (const ACE_Str_Buf *cntl, + const ACE_Str_Buf *data, + int flags = 0) const; + + /// Recv bytes via STREAM pipes. + ssize_t recv (ACE_Str_Buf *cntl, + ACE_Str_Buf *data, + int *flags) const; + + /// Send bytes via STREAM pipes using "band" mode. + ssize_t send (const ACE_Str_Buf *cntl, + const ACE_Str_Buf *data, + int band, + int flags) const; + + /// Recv bytes via STREAM pipes using "band" mode. + ssize_t recv (ACE_Str_Buf *cntl, + ACE_Str_Buf *data, + int *band, + int *flags) const; + +#endif /* ACE_HAS_STREAM_PIPES */ + + /// Send iovecs via <::writev>. + ssize_t send (const iovec iov[], int n) const; + + /// Recv iovecs via <::readv>. + ssize_t recv (iovec iov[], int n) const; + + /** + * Send N char *ptrs and int lengths. Note that the char *'s + * precede the ints (basically, an varargs version of writev). The + * count N is the *total* number of trailing arguments, *not* a + * couple of the number of tuple pairs! + */ + ssize_t send (size_t n, ...) const; + + /** + * This is an interface to ::readv, that doesn't use the struct + * iovec explicitly. The ... can be passed as an arbitrary number + * of (char *ptr, int len) tuples. However, the count N is the + * *total* number of trailing arguments, *not* a couple of the + * number of tuple pairs! + */ + ssize_t recv (size_t n, ...) const; + + /// Send @a n bytes via Win32 WriteFile using overlapped I/O. + ssize_t send (const void *buf, + size_t n, + ACE_OVERLAPPED *overlapped) const; + + /// Recv @a n bytes via Win32 ReadFile using overlapped I/O. + ssize_t recv (void *buf, + size_t n, + ACE_OVERLAPPED *overlapped) const; + + /// Send an @c iovec of size @a n to the file. + ssize_t sendv (const iovec iov[], + int n) const; + + /** + * Allows a client to read from a file without having to provide a + * buffer to read. This method determines how much data is in the + * file, allocates a buffer of this size, reads in the data, and + * returns the number of bytes read. The caller is responsible for + * deleting the member in the field of using + * delete [] io_vec->iov_base. + */ + ssize_t recvv (iovec *io_vec); + + /// Send an of size @a n to the file. Will block until all + /// bytes are sent or an error occurs. + ssize_t sendv_n (const iovec iov[], + int n) const; + + /// Receive an of size @a n to the file. + ssize_t recvv_n (iovec iov[], + int n) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + // = Meta-type info + typedef ACE_FILE_Addr PEER_ADDR; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/FILE_IO.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FILE_IO_H */ diff --git a/externals/ace/FILE_IO.inl b/externals/ace/FILE_IO.inl new file mode 100644 index 0000000..d2e4f75 --- /dev/null +++ b/externals/ace/FILE_IO.inl @@ -0,0 +1,152 @@ +// -*- C++ -*- +// +// $Id: FILE_IO.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ACE.h" +#include "ace/OS_NS_sys_uio.h" +#include "ace/OS_NS_unistd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ssize_t +ACE_FILE_IO::sendv_n (const iovec iov[], int n) const +{ + ACE_TRACE ("ACE_FILE_IO::sendv_n"); + return ACE::writev_n (this->get_handle (), + iov, + n); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::send_n (const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + ACE_TRACE ("ACE_FILE_IO::send_n"); + ACE_UNUSED_ARG (timeout); + return ACE::write_n (this->get_handle (), + message_block, + bytes_transferred); +} + +// Recv an n byte message from the file. + +ACE_INLINE ssize_t +ACE_FILE_IO::recvv_n (iovec iov[], int n) const +{ + ACE_TRACE ("ACE_FILE_IO::recvv_n"); + // @@ Carlos, can you please update this to call the + // new ACE::recvv_n() method that you write? + return ACE_OS::readv (this->get_handle (), + iov, + n); +} + +// Send an of size to the file. + +ACE_INLINE ssize_t +ACE_FILE_IO::sendv (const iovec iov[], int n) const +{ + ACE_TRACE ("ACE_FILE_IO::sendv"); + return ACE_OS::writev (this->get_handle (), iov, n); +} + +// Send exactly N bytes from BUF to this file. Keeping trying until +// this many bytes are sent. + +ACE_INLINE ssize_t +ACE_FILE_IO::send_n (const void *buf, size_t n) const +{ + ACE_TRACE ("ACE_FILE_IO::send_n"); + return ACE::write_n (this->get_handle (), buf, n); +} + +// Receive exactly N bytes from this file into BUF. Keep trying until +// this many bytes are received. + +ACE_INLINE ssize_t +ACE_FILE_IO::recv_n (void *buf, size_t n) const +{ + ACE_TRACE ("ACE_FILE_IO::recv_n"); + return ACE::read_n (this->get_handle (), buf, n); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::send (const void *buf, size_t n) const +{ + ACE_TRACE ("ACE_FILE_IO::send"); + return ACE_OS::write (this->get_handle (), buf, n); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::recv (void *buf, size_t n) const +{ + ACE_TRACE ("ACE_FILE_IO::recv"); + return ACE_OS::read (this->get_handle (), buf, n); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::send (const iovec iov[], int n) const +{ + ACE_TRACE ("ACE_FILE_IO::send"); + return ACE_OS::writev (this->get_handle (), iov, n); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::recv (iovec iov[], int n) const +{ + ACE_TRACE ("ACE_FILE_IO::recv"); + return ACE_OS::readv (this->get_handle (), iov, n); +} + +#if defined (ACE_HAS_STREAM_PIPES) +ACE_INLINE ssize_t +ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const +{ + ACE_TRACE ("ACE_FILE_IO::recv"); + return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const +{ + ACE_TRACE ("ACE_FILE_IO::send"); + return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const +{ + ACE_TRACE ("ACE_FILE_IO::recv"); + return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const +{ + ACE_TRACE ("ACE_FILE_IO::send"); + return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::send (const void *buf, size_t n, + ACE_OVERLAPPED *overlapped) const +{ + ACE_TRACE ("ACE_FILE_IO::send"); + return ACE_OS::write (this->get_handle (), + buf, n, + overlapped); +} + +ACE_INLINE ssize_t +ACE_FILE_IO::recv (void *buf, size_t n, + ACE_OVERLAPPED *overlapped) const +{ + ACE_TRACE ("ACE_FILE_IO::recv"); + return ACE_OS::read (this->get_handle (), buf, n, + overlapped); +} + +#endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/File_Lock.cpp b/externals/ace/File_Lock.cpp new file mode 100644 index 0000000..9eac888 --- /dev/null +++ b/externals/ace/File_Lock.cpp @@ -0,0 +1,72 @@ +// $Id: File_Lock.cpp 87213 2009-10-23 13:11:34Z johnnyw $ + +#include "ace/File_Lock.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/File_Lock.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, File_Lock, "$Id: File_Lock.cpp 87213 2009-10-23 13:11:34Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock) + +void +ACE_File_Lock::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_File_Lock::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_File_Lock::ACE_File_Lock (ACE_HANDLE h, + bool unlink_in_destructor) + : removed_ (false), + unlink_in_destructor_ (unlink_in_destructor) +{ +// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); + if (ACE_OS::flock_init (&this->lock_) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"))); + this->set_handle (h); +} + +ACE_File_Lock::ACE_File_Lock (const ACE_TCHAR *name, + int flags, + mode_t perms, + bool unlink_in_destructor) + : unlink_in_destructor_ (unlink_in_destructor) +{ +// ACE_TRACE ("ACE_File_Lock::ACE_File_Lock"); + + if (this->open (name, flags, perms) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p %s\n"), + ACE_TEXT ("ACE_File_Lock::ACE_File_Lock"), + name)); +} + +int +ACE_File_Lock::open (const ACE_TCHAR *name, + int flags, + mode_t perms) +{ +// ACE_TRACE ("ACE_File_Lock::open"); + this->removed_ = false; + return ACE_OS::flock_init (&this->lock_, flags, name, perms); +} + +ACE_File_Lock::~ACE_File_Lock (void) +{ +// ACE_TRACE ("ACE_File_Lock::~ACE_File_Lock"); + this->remove (this->unlink_in_destructor_); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/File_Lock.h b/externals/ace/File_Lock.h new file mode 100644 index 0000000..2820f71 --- /dev/null +++ b/externals/ace/File_Lock.h @@ -0,0 +1,170 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file File_Lock.h + * + * $Id: File_Lock.h 87213 2009-10-23 13:11:34Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_FILE_LOCK_H +#define ACE_FILE_LOCK_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_stdio.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_File_Lock + * + * @brief A wrapper around the UNIX file locking mechanism. + * + * Allows us to "adapt" the UNIX file locking mechanisms to work + * with all of our Guard stuff... + */ +class ACE_Export ACE_File_Lock +{ +public: + /** + * Set the of the File_Lock to @a handle. Note that this + * constructor assumes ownership of the @a handle and will close it + * down in . If you want the @a handle to stay open when + * is called make sure to call on the @a handle. + * If you don't want the file unlinked in the destructor pass a + * zero value for . + */ + ACE_File_Lock (ACE_HANDLE handle = ACE_INVALID_HANDLE, + bool unlink_in_destructor = true); + + /// Open the @a filename with @a flags and @a mode and set the result + /// to . If you don't want the file unlinked in the + /// destructor pass a false value for @a unlink_in_destructor. + ACE_File_Lock (const ACE_TCHAR *filename, + int flags, + mode_t mode = 0, + bool unlink_in_destructor = true); + + /// Open the @a filename with @a flags and @a mode and set the result to + /// . + int open (const ACE_TCHAR *filename, + int flags, + mode_t mode = 0); + + /// Remove a File lock by releasing it and closing down the . + ~ACE_File_Lock (void); + + /// Remove a File lock by releasing it and closing down the + /// . If @a unlink_file is true then we unlink the file. + int remove (bool unlink_file = true); + + /** + * Note, for interface uniformity with other synchronization + * wrappers we include the method. This is implemented as + * a write-lock to be on the safe-side... + */ + int acquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); + + /** + * Note, for interface uniformity with other synchronization + * wrappers we include the method. This is implemented + * as a write-lock to be on the safe-side... Returns -1 on failure. + * If we "failed" because someone else already had the lock, @c errno + * is set to @c EBUSY. + */ + int tryacquire (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); + + /// Unlock a readers/writer lock. + int release (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); + + /// Acquire a write lock, but block if any readers or a + /// writer hold the lock. + int acquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); + + /** + * Conditionally acquire a write lock (i.e., won't block). Returns + * -1 on failure. If we "failed" because someone else already had + * the lock, @c errno is set to @c EBUSY. + */ + int tryacquire_write (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); + + /** + * Conditionally upgrade to a write lock (i.e., won't block). Returns + * -1 on failure. If we "failed" because someone else already had + * the lock, @c errno is set to @c EBUSY. + */ + int tryacquire_write_upgrade (short whence = 0, + ACE_OFF_T start = 0, + ACE_OFF_T len = 1); + + /** + * Acquire a read lock, but block if a writer hold the lock. + * Returns -1 on failure. If we "failed" because someone else + * already had the lock, @c errno is set to @c EBUSY. + */ + int acquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); + + /** + * Conditionally acquire a read lock (i.e., won't block). Returns + * -1 on failure. If we "failed" because someone else already had + * the lock, @c errno is set to @c EBUSY. + */ + int tryacquire_read (short whence = 0, ACE_OFF_T start = 0, ACE_OFF_T len = 1); + + /// Get underlying ACE_HANDLE for the file. + ACE_HANDLE get_handle (void) const; + + /** + * Set underlying ACE_HANDLE. Note that this method assumes + * ownership of the @a handle and will close it down in . If + * you want the @a handle to stay open when is called make + * sure to call on the @a handle before closing it. You are + * responsible for the closing the existing @a handle before + * overwriting it. + */ + void set_handle (ACE_HANDLE); + + /// Dump state of the object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Locking structure for OS record locks. + ACE_OS::ace_flock_t lock_; + + /// Keeps track of whether has been called yet to avoid + /// multiple calls, e.g., explicitly and implicitly in the + /// destructor. This flag isn't protected by a lock, so make sure + /// that you don't have multiple threads simultaneously calling + /// on the same object, which is a bad idea anyway... + bool removed_; + + /// Keeps track of whether to unlink the underlying file in the + /// destructor. + bool const unlink_in_destructor_; + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_File_Lock &); + ACE_File_Lock (const ACE_File_Lock &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/File_Lock.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FILE_LOCK_H */ diff --git a/externals/ace/File_Lock.inl b/externals/ace/File_Lock.inl new file mode 100644 index 0000000..cf0cefe --- /dev/null +++ b/externals/ace/File_Lock.inl @@ -0,0 +1,96 @@ +// -*- C++ -*- +// +// $Id: File_Lock.inl 87213 2009-10-23 13:11:34Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_File_Lock::acquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::acquire_read"); + return ACE_OS::flock_rdlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire_read (short whence, ACE_OFF_T start, ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire_read"); + return ACE_OS::flock_tryrdlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire_write"); + return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire_write_upgrade (short whence, + ACE_OFF_T start, + ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire_write_upgrade"); + return ACE_OS::flock_trywrlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::tryacquire (short whence, ACE_OFF_T start, ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::tryacquire"); + return this->tryacquire_write (whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::acquire_write (short whence, ACE_OFF_T start, ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::acquire_write"); + return ACE_OS::flock_wrlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::acquire (short whence, ACE_OFF_T start, ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::acquire"); + return this->acquire_write (whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::release (short whence, ACE_OFF_T start, ACE_OFF_T len) +{ +// ACE_TRACE ("ACE_File_Lock::release"); + return ACE_OS::flock_unlock (&this->lock_, whence, start, len); +} + +ACE_INLINE int +ACE_File_Lock::remove (bool unlink_file) +{ +// ACE_TRACE ("ACE_File_Lock::remove"); + + int result = 0; + + if (!this->removed_) + { + this->removed_ = true; + result = ACE_OS::flock_destroy (&this->lock_, + unlink_file); + } + return result; +} + +ACE_INLINE ACE_HANDLE +ACE_File_Lock::get_handle (void) const +{ +// ACE_TRACE ("ACE_File_Lock::get_handle"); + return this->lock_.handle_; +} + +ACE_INLINE void +ACE_File_Lock::set_handle (ACE_HANDLE h) +{ +// ACE_TRACE ("ACE_File_Lock::set_handle"); + this->lock_.handle_ = h; + this->removed_ = false; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Filecache.cpp b/externals/ace/Filecache.cpp new file mode 100644 index 0000000..494749c --- /dev/null +++ b/externals/ace/Filecache.cpp @@ -0,0 +1,746 @@ +// $Id: Filecache.cpp 83735 2008-11-14 09:41:52Z johnnyw $ + +#include "ace/Filecache.h" +#include "ace/Object_Manager.h" +#include "ace/Log_Msg.h" +#include "ace/ACE.h" +#include "ace/Guard_T.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_time.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_fcntl.h" +#include "ace/Truncate.h" + +ACE_RCSID (ace, + Filecache, + "$Id: Filecache.cpp 83735 2008-11-14 09:41:52Z johnnyw $") + +#if defined (ACE_WIN32) +// Specifies no sharing flags. +#define R_MASK ACE_DEFAULT_OPEN_PERMS +#define W_MASK 0 +#else +#define R_MASK S_IRUSR|S_IRGRP|S_IROTH +#define W_MASK S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR|S_IWGRP|S_IWOTH +#endif /* ACE_WIN32 */ + +#if defined (ACE_WIN32) +// See if you can get rid of some of these. +#define READ_FLAGS (FILE_FLAG_SEQUENTIAL_SCAN | \ + FILE_FLAG_OVERLAPPED | \ + O_RDONLY) +// static const int RCOPY_FLAGS = (FILE_FLAG_SEQUENTIAL_SCAN | +// O_RDONLY); +#define WRITE_FLAGS (FILE_FLAG_SEQUENTIAL_SCAN | \ + FILE_FLAG_OVERLAPPED | \ + O_RDWR | O_CREAT | O_TRUNC) +// static const int WCOPY_FLAGS = (FILE_FLAG_SEQUENTIAL_SCAN | +// O_RDWR | O_CREAT | O_TRUNC); +#else +#define READ_FLAGS O_RDONLY +// static const int RCOPY_FLAGS = O_RDONLY; +#define WRITE_FLAGS (O_RDWR | O_CREAT | O_TRUNC) +// static const int WCOPY_FLAGS = O_RDWR | O_CREAT | O_TRUNC; +#endif /* ACE_WIN32 */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// static data members +ACE_Filecache *ACE_Filecache::cvf_ = 0; + +void +ACE_Filecache_Handle::init (void) +{ + this->file_ = 0; + this->handle_ = ACE_INVALID_HANDLE; +} + +ACE_Filecache_Handle::ACE_Filecache_Handle (void) + : file_ (0), handle_ (0), mapit_ (0) +{ + this->init (); +} + +ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename, + ACE_Filecache_Flag mapit) + : file_ (0), handle_ (0), mapit_ (mapit) +{ + this->init (); + // Fetch the file from the Virtual_Filesystem let the + // Virtual_Filesystem do the work of cache coherency. + + // Filecache will also do the acquire, since it holds the lock at + // that time. + this->file_ = ACE_Filecache::instance ()->fetch (filename, mapit); +} + +ACE_Filecache_Handle::ACE_Filecache_Handle (const ACE_TCHAR *filename, + int size, + ACE_Filecache_Flag mapit) + : file_ (0), handle_ (0), mapit_ (mapit) +{ + this->init (); + + if (size == 0) + ACE_Filecache::instance ()->remove (filename); + else + { + // Since this is being opened for a write, simply create a new + // ACE_Filecache_Object now, and let the destructor add it into CVF + // later + + // Filecache will also do the acquire, since it holds the lock at + // that time. + this->file_ = ACE_Filecache::instance ()->create (filename, size); + } +} + +ACE_Filecache_Handle::~ACE_Filecache_Handle (void) +{ + if (this->handle_ != ACE_INVALID_HANDLE) + // this was dup ()'d + ACE_OS::close (this->handle_); + + ACE_Filecache::instance ()->finish (this->file_); +} + +void * +ACE_Filecache_Handle::address (void) const +{ + return this->file_ == 0 ? 0 : this->file_->address (); +} + +ACE_HANDLE +ACE_Filecache_Handle::handle (void) const +{ + if (this->handle_ == ACE_INVALID_HANDLE && this->file_ != 0) + { + ACE_Filecache_Handle *mutable_this = + const_cast (this); + mutable_this->handle_ = ACE_OS::dup (this->file_->handle ()); + } + return this->handle_; +} + +int +ACE_Filecache_Handle::error (void) const +{ + if (this->file_ == 0) + return -1; + else + return this->file_->error (); +} + +ACE_OFF_T +ACE_Filecache_Handle::size (void) const +{ + if (this->file_ == 0) + return -1; + else + return this->file_->size (); +} + +// ------------------ +// ACE_Filecache_Hash +// ------------------ + +#define ACE_Filecache_Hash \ + ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> +#define ACE_Filecache_Hash_Entry \ + ACE_Hash_Map_Entry + +template <> +ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry ( + const ACE_TCHAR *const &ext_id, + ACE_Filecache_Object *const &int_id, + ACE_Filecache_Hash_Entry *next, + ACE_Filecache_Hash_Entry *prev) + : ext_id_ (ext_id + ? ACE_OS::strdup (ext_id) + : ACE_OS::strdup (ACE_TEXT (""))), + int_id_ (int_id), + next_ (next), + prev_ (prev) +{ +} + +template <> +ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (ACE_Filecache_Hash_Entry *next, + ACE_Filecache_Hash_Entry *prev) + : ext_id_ (0), + next_ (next), + prev_ (prev) +{ +} + +template <> +ACE_Filecache_Hash_Entry::~ACE_Hash_Map_Entry (void) +{ + ACE_OS::free ((void *) ext_id_); +} + +// We need these template specializations since KEY is defined as a +// ACE_TCHAR*, which doesn't have a hash() or equal() method defined on it. + +template <> +unsigned long +ACE_Filecache_Hash::hash (const ACE_TCHAR *const &ext_id) +{ + return ACE::hash_pjw (ext_id); +} + +template <> +int +ACE_Filecache_Hash::equal (const ACE_TCHAR *const &id1, + const ACE_TCHAR *const &id2) +{ + return ACE_OS::strcmp (id1, id2) == 0; +} + +#undef ACE_Filecache_Hash +#undef ACE_Filecache_Hash_Entry + + +// ------------- +// ACE_Filecache +// ------------- + +ACE_Filecache * +ACE_Filecache::instance (void) +{ + // Double check locking pattern. + if (ACE_Filecache::cvf_ == 0) + { + ACE_SYNCH_RW_MUTEX &lock = + *ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_FILECACHE_LOCK); + ACE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, ace_mon, lock, 0); + + // @@ James, please check each of the ACE_NEW_RETURN calls to + // make sure that it is safe to return if allocation fails. + if (ACE_Filecache::cvf_ == 0) + ACE_NEW_RETURN (ACE_Filecache::cvf_, + ACE_Filecache, + 0); + } + + return ACE_Filecache::cvf_; +} + +ACE_Filecache::ACE_Filecache (void) + : size_ (ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE), + hash_ (size_) +{ +} + +ACE_Filecache::~ACE_Filecache (void) +{ +} + +ACE_Filecache_Object * +ACE_Filecache::insert_i (const ACE_TCHAR *filename, + ACE_SYNCH_RW_MUTEX &filelock, + int mapit) +{ + ACE_Filecache_Object *handle = 0; + + if (this->hash_.find (filename, handle) == -1) + { + ACE_NEW_RETURN (handle, + ACE_Filecache_Object (filename, filelock, 0, mapit), + 0); + + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) CVF: creating %s\n"), filename)); + + if (this->hash_.bind (filename, handle) == -1) + { + delete handle; + handle = 0; + } + } + else + handle = 0; + + return handle; +} + +ACE_Filecache_Object * +ACE_Filecache::remove_i (const ACE_TCHAR *filename) +{ + ACE_Filecache_Object *handle = 0; + + // Disassociate file from the cache. + if (this->hash_.unbind (filename, handle) == 0) + { + handle->stale_ = 1; + + // Try a lock. If it succeeds, we can delete it now. + // Otherwise, it will clean itself up later. + if (handle->lock_.tryacquire_write () == 0) + { + delete handle; + handle = 0; + } + } + else + handle = 0; + + return handle; +} + +ACE_Filecache_Object * +ACE_Filecache::update_i (const ACE_TCHAR *filename, + ACE_SYNCH_RW_MUTEX &filelock, + int mapit) +{ + ACE_Filecache_Object *handle = 0; + + handle = this->remove_i (filename); + handle = this->insert_i (filename, filelock, mapit); + + return handle; +} + +int +ACE_Filecache::find (const ACE_TCHAR *filename) +{ + return this->hash_.find (filename); +} + + +ACE_Filecache_Object * +ACE_Filecache::remove (const ACE_TCHAR *filename) +{ + ACE_Filecache_Object *handle = 0; + + ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_; + ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; + // ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; + + if (this->hash_.find (filename, handle) != -1) + { + ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, + ace_mon, + hashlock, + 0); + + return this->remove_i (filename); + } + + return 0; +} + + +ACE_Filecache_Object * +ACE_Filecache::fetch (const ACE_TCHAR *filename, int mapit) +{ + ACE_Filecache_Object *handle = 0; + + ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_; + ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; + ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; + + filelock.acquire_read (); + + if (this->hash_.find (filename, handle) == -1) + { + ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, + ace_mon, + hashlock, + 0); + + // Second check in the method call + handle = this->insert_i (filename, filelock, mapit); + + if (handle == 0) + filelock.release (); + } + else + { + if (handle->update ()) + { + { + // Double check locking pattern + ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, + ace_mon, + hashlock, + 0); + + // Second check in the method call + handle = this->update_i (filename, filelock, mapit); + + if (handle == 0) + filelock.release (); + } + } + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) CVF: found %s\n"), filename)); + } + + return handle; +} + +ACE_Filecache_Object * +ACE_Filecache::create (const ACE_TCHAR *filename, int size) +{ + ACE_Filecache_Object *handle = 0; + + ACE_OFF_T loc = ACE::hash_pjw (filename) % this->size_; + ACE_SYNCH_RW_MUTEX &filelock = this->file_lock_[loc]; + + ACE_NEW_RETURN (handle, + ACE_Filecache_Object (filename, size, filelock), + 0); + handle->acquire (); + + return handle; +} + +ACE_Filecache_Object * +ACE_Filecache::finish (ACE_Filecache_Object *&file) +{ + if (file == 0) + return file; + + ACE_OFF_T loc = ACE::hash_pjw (file->filename_) % this->size_; + ACE_SYNCH_RW_MUTEX &hashlock = this->hash_lock_[loc]; + + if (file != 0) + switch (file->action_) + { + case ACE_Filecache_Object::ACE_WRITING: + { + ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, + ace_mon, + hashlock, + 0); + + file->release (); + + this->remove_i (file->filename_); +#if 0 + int result = this->hash_.bind (file->filename (), file); + + if (result == 0) + file->acquire (); +#else + // Last one using a stale file is resposible for deleting it. + if (file->stale_) + { + // Try a lock. If it succeds, we can delete it now. + // Otherwise, it will clean itself up later. + if (file->lock_.tryacquire_write () == 0) + { + delete file; + file = 0; + } + } +#endif + } + + break; + default: + file->release (); + + // Last one using a stale file is resposible for deleting it. + if (file->stale_) + { + // Try a lock. If it succeds, we can delete it now. + // Otherwise, it will clean itself up later. + if (file->lock_.tryacquire_write () == 0) + { + delete file; + file = 0; + } + } + + break; + } + + return file; +} + +void +ACE_Filecache_Object::init (void) +{ + this->filename_[0] = '\0'; + this->handle_ = ACE_INVALID_HANDLE; + this->error_ = ACE_SUCCESS; + this->tempname_ = 0; + this->size_ = 0; + + ACE_OS::memset (&(this->stat_), 0, sizeof (this->stat_)); +} + +ACE_Filecache_Object::ACE_Filecache_Object (void) + : tempname_ (0), + mmap_ (), + handle_ (0), + // stat_ (), + size_ (0), + action_ (0), + error_ (0), + stale_ (0), + // sa_ (), + junklock_ (), + lock_ (junklock_) +{ + this->init (); +} + +ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename, + ACE_SYNCH_RW_MUTEX &lock, + LPSECURITY_ATTRIBUTES sa, + int mapit) + : tempname_ (0), + mmap_ (), + handle_ (0), + // stat_ (), + size_ (0), + action_ (0), + error_ (0), + stale_ (0), + sa_ (sa), + junklock_ (), + lock_ (lock) +{ + this->init (); + + // ASSERT strlen(filename) < sizeof (this->filename_) + ACE_OS::strcpy (this->filename_, filename); + this->action_ = ACE_Filecache_Object::ACE_READING; + // place ourselves into the READING state + + // Can we access the file? + if (ACE_OS::access (this->filename_, R_OK) == -1) + { + this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); + return; + } + + // Can we stat the file? + if (ACE_OS::stat (this->filename_, &this->stat_) == -1) + { + this->error_i (ACE_Filecache_Object::ACE_STAT_FAILED); + return; + } + + this->size_ = ACE_Utils::truncate_cast (this->stat_.st_size); + this->tempname_ = this->filename_; + + // Can we open the file? + this->handle_ = ACE_OS::open (this->tempname_, + READ_FLAGS, R_MASK, this->sa_); + if (this->handle_ == ACE_INVALID_HANDLE) + { + this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, + ACE_TEXT ("ACE_Filecache_Object::ctor: open")); + return; + } + + if (mapit) + { + // Can we map the file? + if (this->mmap_.map (this->handle_, static_cast (-1), + PROT_READ, ACE_MAP_PRIVATE, 0, 0, this->sa_) != 0) + { + this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, + ACE_TEXT ("ACE_Filecache_Object::ctor: map")); + ACE_OS::close (this->handle_); + this->handle_ = ACE_INVALID_HANDLE; + return; + } + } + + // Ok, finished! + this->action_ = ACE_Filecache_Object::ACE_READING; +} + +ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename, + ACE_OFF_T size, + ACE_SYNCH_RW_MUTEX &lock, + LPSECURITY_ATTRIBUTES sa) + : stale_ (0), + sa_ (sa), + lock_ (lock) +{ + this->init (); + + this->size_ = size; + ACE_OS::strcpy (this->filename_, filename); + this->action_ = ACE_Filecache_Object::ACE_WRITING; + + // Can we access the file? + if (ACE_OS::access (this->filename_, R_OK|W_OK) == -1 + // Does it exist? + && ACE_OS::access (this->filename_, F_OK) != -1) + { + // File exists, but we cannot access it. + this->error_i (ACE_Filecache_Object::ACE_ACCESS_FAILED); + return; + } + + this->tempname_ = this->filename_; + + // Can we open the file? + this->handle_ = ACE_OS::open (this->tempname_, WRITE_FLAGS, W_MASK, this->sa_); + if (this->handle_ == ACE_INVALID_HANDLE) + { + this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, + ACE_TEXT ("ACE_Filecache_Object::acquire: open")); + return; + } + + // Can we write? + if (ACE_OS::pwrite (this->handle_, "", 1, this->size_ - 1) != 1) + { + this->error_i (ACE_Filecache_Object::ACE_WRITE_FAILED, + ACE_TEXT ("ACE_Filecache_Object::acquire: write")); + ACE_OS::close (this->handle_); + return; + } + + // Can we map? + if (this->mmap_.map (this->handle_, this->size_, PROT_RDWR, MAP_SHARED, + 0, 0, this->sa_) != 0) + { + this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, + ACE_TEXT ("ACE_Filecache_Object::acquire: map")); + ACE_OS::close (this->handle_); + } + + // Ok, done! +} + +ACE_Filecache_Object::~ACE_Filecache_Object (void) +{ + if (this->error_ == ACE_SUCCESS) + { + this->mmap_.unmap (); + ACE_OS::close (this->handle_); + this->handle_ = ACE_INVALID_HANDLE; + } + + this->lock_.release (); +} + +int +ACE_Filecache_Object::acquire (void) +{ + return this->lock_.tryacquire_read (); +} + +int +ACE_Filecache_Object::release (void) +{ + if (this->action_ == ACE_WRITING) + { + // We are safe since only one thread has a writable Filecache_Object + +#if 0 + ACE_HANDLE original = ACE_OS::open (this->filename_, WRITE_FLAGS, W_MASK, + this->sa_); + if (original == ACE_INVALID_HANDLE) + this->error_ = ACE_Filecache_Object::ACE_OPEN_FAILED; + else if (ACE_OS::write (original, this->mmap_.addr (), + this->size_) == -1) + { + this->error_ = ACE_Filecache_Object::ACE_WRITE_FAILED; + ACE_OS::close (original); + ACE_OS::unlink (this->filename_); + } + else if (ACE_OS::stat (this->filename_, &this->stat_) == -1) + this->error_ = ACE_Filecache_Object::ACE_STAT_FAILED; +#endif + + this->mmap_.unmap (); + ACE_OS::close (this->handle_); + this->handle_ = ACE_INVALID_HANDLE; + +#if 0 + // Leave the file in an acquirable state. + this->handle_ = ACE_OS::open (this->tempname_, READ_FLAGS, R_MASK); + if (this->handle_ == ACE_INVALID_HANDLE) + { + this->error_i (ACE_Filecache_Object::ACE_OPEN_FAILED, + "ACE_Filecache_Object::acquire: open"); + } + else if (this->mmap_.map (this->handle_, -1, + PROT_READ, + ACE_MAP_PRIVATE, + 0, + 0, + this->sa_) != 0) + { + this->error_i (ACE_Filecache_Object::ACE_MEMMAP_FAILED, + "ACE_Filecache_Object::acquire: map"); + ACE_OS::close (this->handle_); + this->handle_ = ACE_INVALID_HANDLE; + } + + this->action_ = ACE_Filecache_Object::ACE_READING; +#endif + } + + return this->lock_.release (); +} + +int +ACE_Filecache_Object::error (void) const +{ + // The existence of the object means a read lock is being held. + return this->error_; +} + +int +ACE_Filecache_Object::error_i (int error_value, const ACE_TCHAR *s) +{ + s = s; + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p.\n"), s)); + this->error_ = error_value; + return error_value; +} + +const ACE_TCHAR * +ACE_Filecache_Object::filename (void) const +{ + // The existence of the object means a read lock is being held. + return this->filename_; +} + +ACE_OFF_T +ACE_Filecache_Object::size (void) const +{ + // The existence of the object means a read lock is being held. + return this->size_; +} + +ACE_HANDLE +ACE_Filecache_Object::handle (void) const +{ + // The existence of the object means a read lock is being held. + return this->handle_; +} + +void * +ACE_Filecache_Object::address (void) const +{ + // The existence of the object means a read lock is being held. + return this->mmap_.addr (); +} + +int +ACE_Filecache_Object::update (void) const +{ + // The existence of the object means a read lock is being held. + int result; + ACE_stat statbuf; + + if (ACE_OS::stat (this->filename_, &statbuf) == -1) + result = 1; + else + result = ACE_OS::difftime (this->stat_.st_mtime, statbuf.st_mtime) < 0; + + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Filecache.h b/externals/ace/Filecache.h new file mode 100644 index 0000000..60b8a90 --- /dev/null +++ b/externals/ace/Filecache.h @@ -0,0 +1,353 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Filecache.h + * + * $Id: Filecache.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author James Hu + */ +//============================================================================= + + +#ifndef ACE_FILECACHE_H +#define ACE_FILECACHE_H + +#include /**/ "ace/pre.h" + +#include "ace/Mem_Map.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Null_Mutex.h" +#include "ace/Synch_Traits.h" +#include "ace/RW_Thread_Mutex.h" +#include "ace/OS_NS_sys_stat.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +enum ACE_Filecache_Flag +{ + ACE_NOMAP = 0, + ACE_MAPIT = 1 +}; + +class ACE_Filecache_Object; + +/** + * @class ACE_Filecache_Handle + * + * @brief Abstraction over a real file. This is meant to be the entry + * point into the Cached Virtual Filesystem. + * + * This is a cached filesystem implementation based loosely on the + * implementation of JAWS_File. The interfaces will be nearly the + * same. The under-the-hood implementation should hopefully be a + * much faster thing. + * These will be given their own implementations later. For now, we + * borrow the implementation provided by JAWS. + * On creation, the cache is checked, and reference count is + * incremented. On destruction, reference count is decremented. If + * the reference count is 0, the file is removed from the cache. + * E.g. 1, + * { + * ACE_Filecache_Handle foo("foo.html"); + * this->peer ().send (foo.address (), foo.size ()); + * } + * E.g. 2, + * { + * ACE_Filecache_Handle foo("foo.html"); + * io->transmitfile (foo.handle (), this->peer ().handle ()); + * } + * E.g. 3, + * { + * ACE_Filecache_Handle foo("foo.html", content_length); + * this->peer ().recv (foo.address (), content_length); + * } + * TODO: + */ +class ACE_Export ACE_Filecache_Handle +{ + // (1) Get rid of the useless copying of files when reading. + // Although it does make sure the file you send isn't being changed, + // it doesn't make sure the file is in a sensible state before + // sending it. + // + // Alternative: if the file get's trashed while it is being shipped, + // let the client request the file again. The cache should have an + // updated copy by that point. + // + // (2) Use hashing for locating files. This means I need a hastable + // implementation with buckets. + // + // (3) Only lock when absolutely necessary. JAWS_Virtual_Filesystem was + // rather conservative, but for some reason it still ran into problems. + // Since this design should be simpler, problems should be easier to spot. + // +public: + + /// Query cache for file, and acquire it. Assumes the file is being + /// opened for reading. + ACE_Filecache_Handle (const ACE_TCHAR *filename, + ACE_Filecache_Flag mapit = ACE_MAPIT); + + /** + * Create new entry, and acquire it. Presence of SIZE assumes the + * file is being opened for writing. If SIZE is zero, assumes the + * file is to be removed from the cache. + */ + ACE_Filecache_Handle (const ACE_TCHAR *filename, + int size, + ACE_Filecache_Flag mapit = ACE_MAPIT); + + /// Closes any open handles, release acquired file. + ~ACE_Filecache_Handle (void); + + /// Base address of memory mapped file. + void *address (void) const; + + /// A handle (e.g., UNIX file descriptor, or NT file handle). + ACE_HANDLE handle (void) const; + + /// Any associated error in handle creation and acquisition. + int error (void) const; + + /// The size of the file. + ACE_OFF_T size (void) const; + +protected: + /// Default do nothing constructor. Prevent it from being called. + ACE_Filecache_Handle (void); + + /// Common initializations for constructors. + void init (void); + +public: + /// These come from ACE_Filecache_Object, which is an internal class. + enum + { + ACE_SUCCESS = 0, + ACE_ACCESS_FAILED, + ACE_OPEN_FAILED, + ACE_COPY_FAILED, + ACE_STAT_FAILED, + ACE_MEMMAP_FAILED, + ACE_WRITE_FAILED + }; + +private: + /// A reference to the low level instance. + ACE_Filecache_Object *file_; + + /// A 'd version of the one from . + ACE_HANDLE handle_; + + int mapit_; +}; + +typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> + ACE_Filecache_Hash; + +typedef ACE_Hash_Map_Entry ACE_Filecache_Hash_Entry; + +/** + * @class ACE_Filecache + * + * @brief A hash table holding the information about entry point into + * the Cached Virtual Filesystem. On insertion, the reference + * count is incremented. On destruction, reference count is + * decremented. + */ +class ACE_Export ACE_Filecache +{ +public: + /// Singleton pattern. + static ACE_Filecache *instance (void); + + ~ACE_Filecache (void); + + /// Returns 0 if the file associated with ``filename'' is in the cache, + /// or -1 if not. + int find (const ACE_TCHAR *filename); + + /// Return the file associated with ``filename'' if it is in the cache, + /// or create if not. + ACE_Filecache_Object *fetch (const ACE_TCHAR *filename, int mapit = 1); + + /// Remove the file associated with ``filename'' from the cache. + ACE_Filecache_Object *remove (const ACE_TCHAR *filename); + + /// Create a new Filecache_Object, returns it. + ACE_Filecache_Object *create (const ACE_TCHAR *filename, int size); + + /// Release an acquired Filecache_Object, returns it again or NULL if it + /// was deleted. + ACE_Filecache_Object *finish (ACE_Filecache_Object *&new_file); + +protected: + ACE_Filecache_Object *insert_i (const ACE_TCHAR *filename, + ACE_SYNCH_RW_MUTEX &filelock, + int mapit); + ACE_Filecache_Object *remove_i (const ACE_TCHAR *filename); + ACE_Filecache_Object *update_i (const ACE_TCHAR *filename, + ACE_SYNCH_RW_MUTEX &filelock, + int mapit); + +public: + + enum + { + /// For this stupid implementation, use an array. Someday, use a + /// balanced search tree, or real hash table. + ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE = 512, + + /// This determines the highwater mark in megabytes for the cache. + /// This will be ignored for now. + ACE_DEFAULT_VIRTUAL_FILESYSTEM_CACHE_SIZE = 20 + }; + +protected: + /// Prevent it from being called. + ACE_Filecache (void); + +private: + ACE_OFF_T size_; + + /// The hash table + ACE_Filecache_Hash hash_; + + /// The reference to the instance + static ACE_Filecache *cvf_; + + // = Synchronization variables. + ACE_SYNCH_RW_MUTEX hash_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; + ACE_SYNCH_RW_MUTEX file_lock_[ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE]; +}; + +/** + * @class ACE_Filecache_Object + * + * @brief Abstraction over a real file. This is what the Virtual + * Filesystem contains. This class is not intended for general + * consumption. Please consult a physician before attempting to + * use this class. + */ +class ACE_Export ACE_Filecache_Object +{ +public: + friend class ACE_Filecache; + + /// Creates a file for reading. + ACE_Filecache_Object (const ACE_TCHAR *filename, + ACE_SYNCH_RW_MUTEX &lock, + LPSECURITY_ATTRIBUTES sa = 0, + int mapit = 1); + + /// Creates a file for writing. + ACE_Filecache_Object (const ACE_TCHAR *filename, + ACE_OFF_T size, + ACE_SYNCH_RW_MUTEX &lock, + LPSECURITY_ATTRIBUTES sa = 0); + + /// Only if reference count is zero should this be called. + ~ACE_Filecache_Object (void); + + /// Increment the reference_count_. + int acquire (void); + + /// Decrement the reference_count_. + int release (void); + + // = error_ accessors + int error (void) const; + int error (int error_value, + const ACE_TCHAR *s = ACE_TEXT ("ACE_Filecache_Object")); + + /// filename_ accessor + const ACE_TCHAR *filename (void) const; + + /// handle_ accessor. + ACE_HANDLE handle (void) const; + + /// Base memory address for memory mapped file. + void *address (void) const; + + /// size_ accessor. + ACE_OFF_T size (void) const; + + /// True if file on disk is newer than cached file. + int update (void) const; + +protected: + /// Prevent from being called. + ACE_Filecache_Object (void); + + /// Common initialization code, + void init (void); + +private: + /// Internal error logging method, no locking. + int error_i (int error_value, + const ACE_TCHAR *s = ACE_TEXT ("ACE_Filecache_Object")); + +public: + + enum Creation_States + { + ACE_READING = 1, + ACE_WRITING = 2 + }; + + enum Error_Conditions + { + ACE_SUCCESS = 0, + ACE_ACCESS_FAILED, + ACE_OPEN_FAILED, + ACE_COPY_FAILED, + ACE_STAT_FAILED, + ACE_MEMMAP_FAILED, + ACE_WRITE_FAILED + }; + +private: + /// The temporary file name and the real file name. The real file is + /// copied into the temporary file for safety reasons. + ACE_TCHAR *tempname_; + ACE_TCHAR filename_[MAXPATHLEN + 1]; + + /// Holds the memory mapped version of the temporary file. + ACE_Mem_Map mmap_; + + /// The descriptor to the temporary file. + ACE_HANDLE handle_; + + /// Used to compare against the real file to test if an update is needed. + ACE_stat stat_; + ACE_OFF_T size_; + + /// Status indicators. + int action_; + int error_; + + /// If set to 1, means the object is flagged for removal. + int stale_; + + /// Security attribute object. + LPSECURITY_ATTRIBUTES sa_; + + /// The default initializer + ACE_SYNCH_RW_MUTEX junklock_; + + /// Provides a bookkeeping mechanism for users of this object. + ACE_SYNCH_RW_MUTEX &lock_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_FILECACHE_H */ diff --git a/externals/ace/Flag_Manip.cpp b/externals/ace/Flag_Manip.cpp new file mode 100644 index 0000000..f9ac408 --- /dev/null +++ b/externals/ace/Flag_Manip.cpp @@ -0,0 +1,95 @@ +// $Id: Flag_Manip.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Flag_Manip.h" + +#if defined (ACE_LACKS_FCNTL) +# include "ace/OS_NS_stropts.h" +# include "ace/OS_NS_errno.h" +#endif /* ACE_LACKS_FCNTL */ + +#if !defined (__ACE_INLINE__) +#include "ace/Flag_Manip.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (CYGWIN32) +# include "ace/os_include/os_termios.h" +#endif /* CYGWIN32 */ + +ACE_RCSID (ace, + Flag_Manip, + "$Id: Flag_Manip.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Flags are file status flags to turn on. + +int +ACE::set_flags (ACE_HANDLE handle, int flags) +{ + ACE_TRACE ("ACE::set_flags"); +#if defined (ACE_LACKS_FCNTL) + switch (flags) + { + case ACE_NONBLOCK: + // nonblocking argument (1) + // blocking: (0) + { + int nonblock = 1; + return ACE_OS::ioctl (handle, FIONBIO, &nonblock); + } + default: + ACE_NOTSUP_RETURN (-1); + } +#else + int val = ACE_OS::fcntl (handle, F_GETFL, 0); + + if (val == -1) + return -1; + + // Turn on flags. + ACE_SET_BITS (val, flags); + + if (ACE_OS::fcntl (handle, F_SETFL, val) == -1) + return -1; + else + return 0; +#endif /* ACE_LACKS_FCNTL */ +} + +// Flags are the file status flags to turn off. + +int +ACE::clr_flags (ACE_HANDLE handle, int flags) +{ + ACE_TRACE ("ACE::clr_flags"); + +#if defined (ACE_LACKS_FCNTL) + switch (flags) + { + case ACE_NONBLOCK: + // nonblocking argument (1) + // blocking: (0) + { + int nonblock = 0; + return ACE_OS::ioctl (handle, FIONBIO, &nonblock); + } + default: + ACE_NOTSUP_RETURN (-1); + } +#else + int val = ACE_OS::fcntl (handle, F_GETFL, 0); + + if (val == -1) + return -1; + + // Turn flags off. + ACE_CLR_BITS (val, flags); + + if (ACE_OS::fcntl (handle, F_SETFL, val) == -1) + return -1; + else + return 0; +#endif /* ACE_LACKS_FCNTL */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Flag_Manip.h b/externals/ace/Flag_Manip.h new file mode 100644 index 0000000..0457dcb --- /dev/null +++ b/externals/ace/Flag_Manip.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Flag_Manip.h + * + * $Id: Flag_Manip.h 80826 2008-03-04 14:51:23Z wotte $ + * + * This class includes the functions used for the Flag Manipulation. + * + * @author Priyanka Gontla + */ +//============================================================================= + +#ifndef ACE_FLAG_MANIP_H +#define ACE_FLAG_MANIP_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/os_include/os_fcntl.h" /* For values passed to these methods */ + +#if defined (ACE_EXPORT_MACRO) +# undef ACE_EXPORT_MACRO +#endif +#define ACE_EXPORT_MACRO ACE_Export + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + // = Set/get/clear various flags related to I/O HANDLE. + /// Set flags associated with @a handle. + extern ACE_Export int set_flags (ACE_HANDLE handle, + int flags); + + /// Clear flags associated with @a handle. + extern ACE_Export int clr_flags (ACE_HANDLE handle, + int flags); + + /// Return the current setting of flags associated with @a handle. + ACE_NAMESPACE_INLINE_FUNCTION int get_flags (ACE_HANDLE handle); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Flag_Manip.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FLAG_MANIP_H */ diff --git a/externals/ace/Flag_Manip.inl b/externals/ace/Flag_Manip.inl new file mode 100644 index 0000000..229a4ee --- /dev/null +++ b/externals/ace/Flag_Manip.inl @@ -0,0 +1,26 @@ +// -*- C++ -*- +// +// $Id: Flag_Manip.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_fcntl.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Return flags currently associated with handle. +ACE_INLINE int +ACE::get_flags (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE::get_flags"); + +#if defined (ACE_LACKS_FCNTL) + // ACE_OS::fcntl is not supported. It + // would be better to store ACE's notion of the flags + // associated with the handle, but this works for now. + ACE_UNUSED_ARG (handle); + return 0; +#else + return ACE_OS::fcntl (handle, F_GETFL, 0); +#endif /* ACE_LACKS_FCNTL */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Framework_Component.cpp b/externals/ace/Framework_Component.cpp new file mode 100644 index 0000000..7b63ad5 --- /dev/null +++ b/externals/ace/Framework_Component.cpp @@ -0,0 +1,279 @@ +// Framework_Component.cpp +// $Id: Framework_Component.cpp 84128 2009-01-09 15:07:40Z johnnyw $ + +#include "ace/Framework_Component.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Framework_Component.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Object_Manager.h" +#include "ace/Log_Msg.h" +#include "ace/DLL_Manager.h" +#include "ace/Recursive_Thread_Mutex.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID(ace, Framework_Component, "$Id: Framework_Component.cpp 84128 2009-01-09 15:07:40Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Framework_Component::~ACE_Framework_Component (void) +{ + ACE_TRACE ("ACE_Framework_Component::~ACE_Framework_Component"); + + ACE::strdelete (const_cast (this->dll_name_)); + ACE::strdelete (const_cast (this->name_)); +} + +/***************************************************************/ + +ACE_ALLOC_HOOK_DEFINE(ACE_Framework_Repository) + +sig_atomic_t ACE_Framework_Repository::shutting_down_ = 0; + +// Pointer to the Singleton instance. +ACE_Framework_Repository *ACE_Framework_Repository::repository_ = 0; + +ACE_Framework_Repository::~ACE_Framework_Repository (void) +{ + ACE_TRACE ("ACE_Framework_Repository::~ACE_Framework_Repository"); + this->close (); +} + +int +ACE_Framework_Repository::open (int size) +{ + ACE_TRACE ("ACE_Framework_Repository::open"); + + ACE_Framework_Component **temp = 0; + + ACE_NEW_RETURN (temp, + ACE_Framework_Component *[size], + -1); + + this->component_vector_ = temp; + this->total_size_ = size; + return 0; +} + +int +ACE_Framework_Repository::close (void) +{ + ACE_TRACE ("ACE_Framework_Repository::close"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + this->shutting_down_ = 1; + + if (this->component_vector_ != 0) + { + // Delete components in reverse order. + for (int i = this->current_size_ - 1; i >= 0; i--) + if (this->component_vector_[i]) + { + ACE_Framework_Component *s = + const_cast ( + this->component_vector_[i]); + + this->component_vector_[i] = 0; + delete s; + } + + delete [] this->component_vector_; + this->component_vector_ = 0; + this->current_size_ = 0; + } + + ACE_DLL_Manager::close_singleton (); + return 0; +} + +ACE_Framework_Repository * +ACE_Framework_Repository::instance (int size) +{ + ACE_TRACE ("ACE_Framework_Repository::instance"); + + if (ACE_Framework_Repository::repository_ == 0) + { + // Perform Double-Checked Locking Optimization. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + if (ACE_Framework_Repository::repository_ == 0) + { + if (ACE_Object_Manager::starting_up () || + !ACE_Object_Manager::shutting_down ()) + { + ACE_NEW_RETURN (ACE_Framework_Repository::repository_, + ACE_Framework_Repository (size), + 0); + } + } + } + + return ACE_Framework_Repository::repository_; +} + +void +ACE_Framework_Repository::close_singleton (void) +{ + ACE_TRACE ("ACE_Framework_Repository::close_singleton"); + + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance ())); + + delete ACE_Framework_Repository::repository_; + ACE_Framework_Repository::repository_ = 0; +} + +int +ACE_Framework_Repository::register_component (ACE_Framework_Component *fc) +{ + ACE_TRACE ("ACE_Framework_Repository::register_component"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + int i; + + // Check to see if it's already registered + for (i = 0; i < this->current_size_; i++) + if (this->component_vector_[i] && + fc->this_ == this->component_vector_[i]->this_) + { + ACE_ERROR_RETURN ((LM_ERROR, + "AFR::register_component: error, compenent already registered\n"), + -1); + } + + if (i < this->total_size_) + { + this->component_vector_[i] = fc; + ++this->current_size_; + return 0; + } + + return -1; +} + +int +ACE_Framework_Repository::remove_component (const ACE_TCHAR *name) +{ + ACE_TRACE ("ACE_Framework_Repository::remove_component"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + int i; + + for (i = 0; i < this->current_size_; i++) + if (this->component_vector_[i] && + ACE_OS::strcmp (this->component_vector_[i]->name_, name) == 0) + { + delete this->component_vector_[i]; + this->component_vector_[i] = 0; + this->compact (); + return 0; + } + + return -1; +} + +int +ACE_Framework_Repository::remove_dll_components (const ACE_TCHAR *dll_name) +{ + ACE_TRACE ("ACE_Framework_Repository::remove_dll_components"); + + if (this->shutting_down_) + return this->remove_dll_components_i (dll_name); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + return this->remove_dll_components_i (dll_name); +} + +int +ACE_Framework_Repository::remove_dll_components_i (const ACE_TCHAR *dll_name) +{ + ACE_TRACE ("ACE_Framework_Repository::remove_dll_components_i"); + + int i; + int retval = -1; + + for (i = 0; i < this->current_size_; i++) + if (this->component_vector_[i] && + ACE_OS::strcmp (this->component_vector_[i]->dll_name_, dll_name) == 0) + { + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("AFR::remove_dll_components_i (%s) ") + ACE_TEXT ("component \"%s\"\n"), + dll_name, this->component_vector_[i]->name_)); + delete this->component_vector_[i]; + this->component_vector_[i] = 0; + ++retval; + } + + this->compact (); + + return retval == -1 ? -1 : 0; +} + +void +ACE_Framework_Repository::compact (void) +{ + ACE_TRACE ("ACE_Framework_Repository::compact"); + + int i; + int start_hole; + int end_hole; + + do + { + start_hole = this->current_size_; + end_hole = this->current_size_; + + // Find hole + for (i = 0; i < this->current_size_; ++i) + { + if (this->component_vector_[i] == 0) + { + if (start_hole == this->current_size_) + { + start_hole = i; + end_hole = i; + } + else + end_hole = i; + } + else if (end_hole != this->current_size_) + break; + } + + if (start_hole != this->current_size_) + { + // move the contents and reset current_size_ + while (end_hole + 1 < this->current_size_) + { + this->component_vector_[start_hole++] = + this->component_vector_[++end_hole]; + } + // Since start_hole is now one past the last + // active slot. + this->current_size_ = start_hole; + } + + } while (start_hole != this->current_size_); +} + +void +ACE_Framework_Repository::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Framework_Repository::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Framework_Repository::ACE_Framework_Repository (int size) + : current_size_ (0) +{ + ACE_TRACE ("ACE_Framework_Repository::ACE_Framework_Repository"); + + if (this->open (size) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Framework_Repository"))); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Framework_Component.h b/externals/ace/Framework_Component.h new file mode 100644 index 0000000..941960b --- /dev/null +++ b/externals/ace/Framework_Component.h @@ -0,0 +1,210 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Framework_Component.h + * + * $Id: Framework_Component.h 80826 2008-03-04 14:51:23Z wotte $ + * + * A prototype mechanism that allows framework components, singletons + * such as ACE_Reactor, ACE_Proactor, etc, to be registered with a + * central repository managed by the ACE_Object_Manager or + * ACE_Service_Config that will handle destruction. + * + * This technique obviates changing ACE_Object_Manager and + * ACE_Service_Config everytime a new framework is added. Which also + * means that unused framework components don't need to linked into + * the final application which is important for applications with + * stringent footprint requirements. + * + * Framework components need only provide a static method, + * close_singleton() and add the ACE_REGISTER_FRAMEWORK_COMPONENT macro + * call to their instance() methods in order to participate. Components + * that don't have a close_singleton() method can also participate via + * template specialization of ACE_Framework_Component_T. + * + * This design uses the External Polymorphism pattern to avoid having + * to derive all framework components from a common base class that + * has virtual methods (this is crucial to avoid unnecessary overhead), + * and is based on the dump debugging implementation found in + * . + * + * @author Don Hinton . + */ +//============================================================================= + +#ifndef ACE_FRAMEWORK_COMPONENT_H +#define ACE_FRAMEWORK_COMPONENT_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_signal.h" +#include "ace/Thread_Mutex.h" + +#define ACE_DEFAULT_FRAMEWORK_REPOSITORY_SIZE 1024 + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Framework_Component + * + * @brief Base class that defines a uniform interface for all managed + * framework components. + */ +class ACE_Export ACE_Framework_Component +{ +public: + friend class ACE_Framework_Repository; + + /// Constructor. + ACE_Framework_Component (void *_this, + const ACE_TCHAR *dll_name = 0, + const ACE_TCHAR *name = 0); + + /// Close the contained singleton. + virtual void close_singleton (void) = 0; + +protected: + /// Destructor. + virtual ~ACE_Framework_Component (void); + +private: + // No copy possible + ACE_Framework_Component (const ACE_Framework_Component &); + void operator= (const ACE_Framework_Component &); + +private: + /// Pointer to the actual component. + const void *this_; + + /// Library associated with this component + const ACE_TCHAR *dll_name_; + + /// Component name + const ACE_TCHAR *name_; +}; + +/** + * @class ACE_Framework_Repository + * + * @brief Contains all framework components used by an application. + * + * This class contains a vector of ACE_Framework_Component *'s. On + * destruction, framework components are destroyed in the reverse order + * that they were added originally. + */ +class ACE_Export ACE_Framework_Repository +{ +public: + // This is just to silence a compiler warning about no public ctors + friend class ACE_Framework_Component; + + enum + { + DEFAULT_SIZE = ACE_DEFAULT_FRAMEWORK_REPOSITORY_SIZE + }; + + /// Close down the repository and free up dynamically allocated + /// resources. + ~ACE_Framework_Repository (void); + + /// Initialize the repository. + int open (int size = DEFAULT_SIZE); + + /// Close down the repository and free up dynamically allocated + /// resources, also called by dtor. + int close (void); + + /// Get pointer to a process-wide ACE_Framework_Repository. + static ACE_Framework_Repository *instance + (int size = ACE_Framework_Repository::DEFAULT_SIZE); + + /// Delete the dynamically allocated Singleton. + static void close_singleton (void); + + // = Search structure operations (all acquire locks as necessary). + + /// Insert a new component. Returns -1 when the repository is full + /// and 0 on success. + int register_component (ACE_Framework_Component *fc); + + /// Remove a component. Returns -1 on error or if component not found + /// and 0 on success. + int remove_component (const ACE_TCHAR *name); + + /// Remove all components associated with a particular dll. + int remove_dll_components (const ACE_TCHAR *dll_name); + + /// Return the current size of the repository. + int current_size (void) const; + + /// Return the total size of the repository. + int total_size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + + /// Initialize the repository. + ACE_Framework_Repository (int size = ACE_Framework_Repository::DEFAULT_SIZE); + +private: + + /// Actually removes the dll components, must be called with locks held. + int remove_dll_components_i (const ACE_TCHAR *dll_name); + + /// Compact component_vector_ after components have been removed__maintains + /// order. + void compact (void); + + /// Disallow copying and assignment. + ACE_Framework_Repository (const ACE_Framework_Repository &); + ACE_Framework_Repository &operator= (const ACE_Framework_Repository &); + +private: + + /// Contains all the framework components. + ACE_Framework_Component **component_vector_; + + /// Current number of components. + int current_size_; + + /// Maximum number of components. + int total_size_; + + /// Pointer to a process-wide ACE_Framework_Repository. + static ACE_Framework_Repository *repository_; + + /// Flag set when repository is the process of shutting down. This + /// is necessary to keep from self-deadlocking since some of + /// the components might make calls back to the repository to + /// unload their components, e.g., ACE_DLL_Manager. + static sig_atomic_t shutting_down_; + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// Synchronization variable for the MT_SAFE Repository + ACE_Thread_Mutex lock_; +#endif /* ACE_MT_SAFE */ + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Framework_Component.inl" +#endif /* __ACE_INLINE__ */ + +// Include the templates classes at this point. +#include "ace/Framework_Component_T.h" + +#include /**/ "ace/post.h" +#endif /* ACE_FRAMEWORK_COMPONENT_H */ diff --git a/externals/ace/Framework_Component.inl b/externals/ace/Framework_Component.inl new file mode 100644 index 0000000..1fb2de3 --- /dev/null +++ b/externals/ace/Framework_Component.inl @@ -0,0 +1,39 @@ +// -*- C++ -*- +// +// $Id: Framework_Component.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ACE.h" +#include "ace/Guard_T.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Framework_Component::ACE_Framework_Component (void *_this, + const ACE_TCHAR *dll_name, + const ACE_TCHAR *name) + : this_ (_this), + dll_name_ (ACE::strnew (dll_name ? dll_name : ACE_TEXT (""))), + name_ (ACE::strnew (name ? name : ACE_TEXT (""))) +{ + ACE_TRACE ("ACE_Framework_Component::ctor"); +} + +/***************************************************************/ + +ACE_INLINE int +ACE_Framework_Repository::current_size (void) const +{ + ACE_TRACE ("ACE_Framework_Repository::current_size"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1)); + return this->current_size_; +} + +ACE_INLINE int +ACE_Framework_Repository::total_size (void) const +{ + ACE_TRACE ("ACE_Framework_Repository::total_size"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1)); + return this->total_size_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Framework_Component_T.cpp b/externals/ace/Framework_Component_T.cpp new file mode 100644 index 0000000..6f0be7b --- /dev/null +++ b/externals/ace/Framework_Component_T.cpp @@ -0,0 +1,33 @@ +// $Id: Framework_Component_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_FRAMEWORK_COMPONENT_T_CPP +#define ACE_FRAMEWORK_COMPONENT_T_CPP + +#include "ace/Framework_Component_T.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Framework_Component_T::ACE_Framework_Component_T (Concrete *concrete) + : ACE_Framework_Component ((void *) concrete, concrete->dll_name (), concrete->name ()) +{ + ACE_TRACE ("ACE_Framework_Component_T::ctor"); +} + +template +ACE_Framework_Component_T::~ACE_Framework_Component_T (void) +{ + ACE_TRACE ("ACE_Framework_Component_T::~ACE_Framework_Component_T"); + Concrete::close_singleton (); +} + +template void +ACE_Framework_Component_T::close_singleton (void) +{ + ACE_TRACE ("ACE_Framework_Component_T::close_singleton"); + Concrete::close_singleton (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_FRAMEWORK_COMPONENT_T_CPP */ diff --git a/externals/ace/Framework_Component_T.h b/externals/ace/Framework_Component_T.h new file mode 100644 index 0000000..2dcef43 --- /dev/null +++ b/externals/ace/Framework_Component_T.h @@ -0,0 +1,71 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Framework_Component_T.h + * + * $Id: Framework_Component_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + */ +//============================================================================= + +#ifndef ACE_FRAMEWORK_COMPONENT_T_H +#define ACE_FRAMEWORK_COMPONENT_T_H +#include /**/ "ace/pre.h" +#include "ace/Framework_Component.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Framework_Component_T + * + * @brief This class inherits the interface of the abstract + * ACE_Framework_Component class and is instantiated with the + * implementation of the concrete component class @c class Concrete. + * + * This design is similar to the Adapter and Decorator patterns + * from the ``Gang of Four'' book. Note that @c class Concrete + * need not inherit from a common class since ACE_Framework_Component + * provides the uniform virtual interface! (implementation based on + * ACE_Dumpable_Adapter in . + */ +template +class ACE_Framework_Component_T : public ACE_Framework_Component +{ +public: + // = Initialization and termination methods. + + /// Constructor. + ACE_Framework_Component_T (Concrete *concrete); + + /// Destructor. + ~ACE_Framework_Component_T (void); + + /// Close the contained singleton. + void close_singleton (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +// This macro should be called in the instance() method +// of the Concrete class that will be managed. Along +// with the appropriate template instantiation. +#define ACE_REGISTER_FRAMEWORK_COMPONENT(CLASS, INSTANCE) \ + ACE_Framework_Repository::instance ()->register_component \ + (new ACE_Framework_Component_T (INSTANCE)); + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Framework_Component_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Framework_Component_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_FRAMEWORK_COMPONENT_T_H */ diff --git a/externals/ace/Free_List.cpp b/externals/ace/Free_List.cpp new file mode 100644 index 0000000..4da723f --- /dev/null +++ b/externals/ace/Free_List.cpp @@ -0,0 +1,163 @@ +// $Id: Free_List.cpp 81107 2008-03-27 11:12:42Z johnnyw $ + +#ifndef ACE_FREE_LIST_CPP +#define ACE_FREE_LIST_CPP + +#include "ace/Free_List.h" +#include "ace/Guard_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Free_List::~ACE_Free_List (void) +{ +} + +// Default constructor that takes in a preallocation number +// (), a low and high water mark ( and ) and an +// increment value () + +template +ACE_Locked_Free_List::ACE_Locked_Free_List (int mode, + size_t prealloc, + size_t lwm, + size_t hwm, + size_t inc) + : mode_ (mode), + free_list_ (0), + lwm_ (lwm), + hwm_ (hwm), + inc_ (inc), + size_ (0) +{ + this->alloc (prealloc); +} + +// Destructor - removes all the elements from the free_list + +template +ACE_Locked_Free_List::~ACE_Locked_Free_List (void) +{ + if (this->mode_ != ACE_PURE_FREE_LIST) + while (this->free_list_ != 0) + { + T *temp = this->free_list_; + this->free_list_ = this->free_list_->get_next (); + delete temp; + } +} + +// Inserts an element onto the free list (if we are allowed to manage +// elements withing and it pasts the high water mark, delete the +// element) + +template void +ACE_Locked_Free_List::add (T *element) +{ + ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); + + // Check to see that we not at the high water mark. + if (this->mode_ == ACE_PURE_FREE_LIST + || this->size_ < this->hwm_) + { + element->set_next (this->free_list_); + this->free_list_ = element; + this->size_++; + } + else + delete element; +} + +// Takes a element off the freelist and returns it. It creates +// new elements if we are allowed to do it and the size is at the low +// water mark. + +template T * +ACE_Locked_Free_List::remove (void) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, 0)); + + // If we are at the low water mark, add some nodes + if (this->mode_ != ACE_PURE_FREE_LIST && this->size_ <= this->lwm_) + this->alloc (this->inc_); + + // Remove a node + T *temp = this->free_list_; + + if (temp != 0) + { + this->free_list_ = this->free_list_->get_next (); + this->size_--; + } + + return temp; +} + + +// Returns the current size of the free list + +template size_t +ACE_Locked_Free_List::size (void) +{ + return this->size_; +} + +// Resizes the free list to + +template void +ACE_Locked_Free_List::resize (size_t newsize) +{ + ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); + + // Check if we are allowed to resize + if (this->mode_ != ACE_PURE_FREE_LIST) + { + // Check to see if we grow or shrink + if (newsize < this->size_) + { + this->dealloc (this->size_ - newsize); + } + else + { + this->alloc (newsize - this->size_); + } + } +} + +// Allocates extra nodes for the freelist + +template void +ACE_Locked_Free_List::alloc (size_t n) +{ + for (; n > 0; n--) + { + T *temp = 0; + ACE_NEW (temp, T); + temp->set_next (this->free_list_); + this->free_list_ = temp; + this->size_++; + } +} + +// Removes and frees nodes from the freelist. + +template void +ACE_Locked_Free_List::dealloc (size_t n) +{ + for (; this->free_list_ != 0 && n > 0; + n--) + { + T *temp = this->free_list_; + this->free_list_ = this->free_list_->get_next (); + delete temp; + this->size_--; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_FREE_LIST_CPP */ diff --git a/externals/ace/Free_List.h b/externals/ace/Free_List.h new file mode 100644 index 0000000..7f2ce59 --- /dev/null +++ b/externals/ace/Free_List.h @@ -0,0 +1,150 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Free_List.h + * + * $Id: Free_List.h 84619 2009-02-26 12:26:16Z johnnyw $ + * + * @author Darrell Brunsch (brunsch@cs.wustl.edu) + */ +//============================================================================= + +#ifndef ACE_FREE_LIST_H +#define ACE_FREE_LIST_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/Default_Constants.h" +#include "ace/os_include/os_stddef.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Free_List + * + * @brief Implements a free list. + * + * This class maintains a free list of nodes of type T. + */ +template +class ACE_Free_List +{ +public: + /// Destructor - removes all the elements from the free_list. + virtual ~ACE_Free_List (void); + + /// Inserts an element onto the free list (if it isn't past the high + /// water mark). + virtual void add (T *element) = 0; + + /// Takes a element off the freelist and returns it. It creates + /// new elements if the size is at or below the low water mark. + virtual T *remove (void) = 0; + + /// Returns the current size of the free list. + virtual size_t size (void) = 0; + + /// Resizes the free list to @a newsize. + virtual void resize (size_t newsize) = 0; +}; + +/** + * @class ACE_Locked_Free_List + * + * @brief Implements a free list. + * + * This class maintains a free list of nodes of type T. It + * depends on the type T having a and + * method. It maintains a mutex so the freelist can be used in + * a multithreaded program . + */ +template +class ACE_Locked_Free_List : public ACE_Free_List +{ +public: + // = Initialization and termination. + /** + * Constructor takes a @a mode (i.e., ACE_FREE_LIST_WITH_POOL or + * ACE_PURE_FREE_LIST), a count of the number of nodes to + * @a prealloc, a low and high water mark (@a lwm and @a hwm) that + * indicate when to allocate more nodes, an increment value (@a inc) + * that indicates how many nodes to allocate when the list must + * grow. + */ + ACE_Locked_Free_List (int mode = ACE_FREE_LIST_WITH_POOL, + size_t prealloc = ACE_DEFAULT_FREE_LIST_PREALLOC, + size_t lwm = ACE_DEFAULT_FREE_LIST_LWM, + size_t hwm = ACE_DEFAULT_FREE_LIST_HWM, + size_t inc = ACE_DEFAULT_FREE_LIST_INC); + + /// Destructor - removes all the elements from the free_list. + virtual ~ACE_Locked_Free_List (void); + + /// Inserts an element onto the free list (if it isn't past the high + /// water mark). + virtual void add (T *element); + + /// Takes a element off the freelist and returns it. It creates + /// new elements if the size is at or below the low water mark. + virtual T *remove (void); + + /// Returns the current size of the free list. + virtual size_t size (void); + + /// Resizes the free list to @a newsize. + virtual void resize (size_t newsize); + +protected: + /// Allocates @a n extra nodes for the freelist. + virtual void alloc (size_t n); + + /// Removes and frees @a n nodes from the freelist. + virtual void dealloc (size_t n); + + /// Free list operation mode, either ACE_FREE_LIST_WITH_POOL or + /// ACE_PURE_FREE_LIST. + int mode_; + + /// Pointer to the first node in the freelist. + T *free_list_; + + /// Low water mark. + size_t lwm_; + + /// High water mark. + size_t hwm_; + + /// Increment value. + size_t inc_; + + /// Keeps track of the size of the list. + size_t size_; + + /// Synchronization variable for ACE_Timer_Queue. + ACE_LOCK mutex_; + +private: + // = Don't allow these operations for now. + ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Free_List (const ACE_Locked_Free_List &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Locked_Free_List &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Free_List.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Free_List.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_FREE_LIST_H */ diff --git a/externals/ace/Functor.cpp b/externals/ace/Functor.cpp new file mode 100644 index 0000000..429aaac --- /dev/null +++ b/externals/ace/Functor.cpp @@ -0,0 +1,43 @@ + +//============================================================================= +/** + * @file Functor.cpp + * + * $Id: Functor.cpp 80826 2008-03-04 14:51:23Z wotte $ + * + * Non-inlinable method definitions for non-templatized classes + * and template specializations implementing the GOF Command Pattern, + * and STL-style functors. + * + * + * @author Chris Gill + * + * Based on Command Pattern implementations originally done by + * + * Carlos O'Ryan + * Douglas C. Schmidt + * Sergio Flores-Gaitan + * + * and on STL-style functor implementations originally done by + * + * Irfan Pyarali + */ +//============================================================================= + + +#include "ace/Functor_T.h" +#include "ace/Functor.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Functor.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Functor, "$Id: Functor.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Command_Base::~ACE_Command_Base (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Functor.h b/externals/ace/Functor.h new file mode 100644 index 0000000..ec1d285 --- /dev/null +++ b/externals/ace/Functor.h @@ -0,0 +1,523 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Functor.h + * + * $Id: Functor.h 86698 2009-09-13 15:58:17Z johnnyw $ + * + * Non-templatized classes and class template specializations for + * implementing function objects that are used in various places + * in ACE. There are currently two major categories of function + * objects in ACE: GoF Command Pattern objects, and STL-style + * functors for comparison of container elements. The command objects + * are invoked via an execute () method, while the STL-style functors are + * invoked via an operator() () method. + * Non-templatized classes for implementing the GoF Command Pattern, + * also known as functors or function objects. + * + * + * @author Chris Gill + * @author Based on Command Pattern implementations originally done by + * @author Carlos O'Ryan + * @author Douglas C. Schmidt + * @author Sergio Flores-Gaitan + * @author and on STL-style functor implementations originally done by + * @author Irfan Pyarali + */ +//========================================================================== + + +#ifndef ACE_FUNCTOR_H +#define ACE_FUNCTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/ACE_export.h" +#include "ace/Basic_Types.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +////////////////////////////////////////////////////////////// +// GOF Command Pattern Classes and Template Specializations // +////////////////////////////////////////////////////////////// + +/** + * @class ACE_Command_Base + * + * @brief Defines an abstract class that allows us to invoke commands + * without knowing anything about the implementation. + * + * This class declares an interface to execute a command + * independent of the effect of the command, or the objects used + * to implement it. + */ +class ACE_Export ACE_Command_Base +{ +public: + // = Initialization and termination methods. + /// Default constructor. + ACE_Command_Base (void); + + /// Virtual destructor. + virtual ~ACE_Command_Base (void); + + /** + * Invokes the method encapsulated by the command, passing along the + * passed argument (if any). Users of classes derived from this + * class must ensure that the resulting invocation can tolerate a + * null void pointer being passed, or otherwise ensure that this + * will never occur. + */ + virtual int execute (void *arg = 0) = 0; +}; + +//////////////////////////////////////////////////////////// +// STL-style Functor Classes and Template Specializations // +//////////////////////////////////////////////////////////// + +// Forward declaration since we are going to specialize that template +// here. The template itself requires this file so every user of the +// template should also see the specialization. +template class ACE_Hash; +template class ACE_Equal_To; +template class ACE_Less_Than; + +/** + * @brief Function object for hashing a char + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (char t) const; +}; + +/** + * @brief Function object for hashing a signed char + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (signed char t) const; +}; + +/** + * @brief Function object for hashing an unsigned char + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (unsigned char t) const; +}; + +#if 0 +// @@ ADD HASHES FOR ACE TYPES + +/** + * @brief Function object for hashing a 16-bit signed number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (ACE_INT16 t) const; +}; + +/** + * @brief Function object for hashing a 16-bit unsigned number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (ACE_UINT16 t) const; +}; + +/** + * @brief Function object for hashing a 32-bit signed number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (ACE_INT32 t) const; +}; + +/** + * @brief Function object for hashing a 32-bit unsigned number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (ACE_UINT32 t) const; +}; + +/** + * @brief Function object for hashing a 64-bit unsigned number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (ACE_UINT64 t) const; +}; + +// @@ DONE ADDING HASHES FOR ACE TYPES +#endif + +/** + * @brief Function object for hashing a short number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (short t) const; +}; + +/** + * @brief Function object for hashing an unsigned short number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (unsigned short t) const; +}; + +/** + * @brief Function object for hashing an int number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (int t) const; +}; + +/** + * @brief Function object for hashing an unsigned int number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (unsigned int t) const; +}; + +/** + * @brief Function object for hashing a long number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (long t) const; +}; + +/** + * @brief Function object for hashing an unsigned long number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (unsigned long t) const; +}; + +#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) +/** + * @brief Function object for hashing a signed 64-bit number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (ACE_INT64 t) const; +}; +#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ + +// We can do this even if ACE_LACKS_UNSIGNEDLONGLONG_T because there's an +// emulation for it in ACE_U_LongLong. +#if (ACE_SIZEOF_LONG < 8) +/** + * @brief Function object for hashing an unsigned 64-bit number + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (const ACE_UINT64 &t) const; +}; +#endif /* ACE_SIZEOF_LONG < 8 */ + +/** + * @brief Function object for hashing a const string + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Calls ACE::hash_pjw + unsigned long operator () (const char *t) const; +}; + +/** + * @brief Function object for hashing a string + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Calls ACE::hash_pjw + unsigned long operator () (const char *t) const; +}; + +/** + * @brief Function object for hashing a void * + */ +template<> +class ACE_Export ACE_Hash +{ +public: + unsigned long operator () (const void *) const; +}; + +/** + * @brief Function object for determining whether two const strings are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const char *lhs, + const char *rhs) const; +}; + +/** + * @brief Function object for determining whether two non-const + * strings are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const char *lhs, + const char *rhs) const; +}; + +/** + * @brief Function object for determining whether two unsigned + * 16 bit ints are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls built-in operators + int operator () (const ACE_UINT16 lhs, + const ACE_UINT16 rhs) const; +}; + +/** + * @brief Function object for determining whether two + * 16 bit ints are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls built-in operators + int operator () (const ACE_INT16 lhs, + const ACE_INT16 rhs) const; +}; + +/** + * @brief Function object for determining whether two unsigned + * 32 bit ints are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls built-in operators + int operator () (const ACE_UINT32 lhs, + const ACE_UINT32 rhs) const; +}; + +/** + * @brief Function object for determining whether two + * 32 bit ints are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls built-in operators + int operator () (const ACE_INT32 lhs, + const ACE_INT32 rhs) const; +}; + +/** + * @brief Function object for determining whether two unsigned + * 64 bit ints are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls built-in operators + int operator () (const ACE_UINT64 lhs, + const ACE_UINT64 rhs) const; +}; + +/** + * @brief Function object for determining whether the first const string + * is less than the second const string. + */ +template<> +class ACE_Export ACE_Less_Than +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const char *lhs, + const char *rhs) const; +}; + +/** + * @brief Function object for determining whether the first string + * is less than the second string. + */ +template<> +class ACE_Export ACE_Less_Than +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const char *lhs, + const char *rhs) const; +}; + +#if defined (ACE_HAS_WCHAR) + +# if ! defined (ACE_LACKS_NATIVE_WCHAR_T) +/** + * @brief Function object for hashing a wchar_t + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Simply returns t + unsigned long operator () (wchar_t t) const; +}; +# endif /* ACE_LACKS_NATIVE_WCHAR_T */ +/** + * @brief Function object for hashing a const string + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Calls ACE::hash_pjw + unsigned long operator () (const wchar_t *t) const; +}; + +/** + * @brief Function object for hashing a string + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Calls ACE::hash_pjw + unsigned long operator () (const wchar_t *t) const; +}; + +/** + * @brief Function object for determining whether two const strings are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const wchar_t *lhs, + const wchar_t *rhs) const; +}; + +/** + * @brief Function object for determining whether two non-const + * strings are equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const wchar_t *lhs, + const wchar_t *rhs) const; +}; + +/** + * @brief Function object for determining whether the first const string + * is less than the second const string. + */ +template<> +class ACE_Export ACE_Less_Than +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const wchar_t *lhs, + const wchar_t *rhs) const; +}; + +/** + * @brief Function object for determining whether the first string + * is less than the second string. + */ +template<> +class ACE_Export ACE_Less_Than +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const wchar_t *lhs, + const wchar_t *rhs) const; +}; + +#endif // ACE_HAS_WCHAR + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Functor.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_FUNCTOR_H */ diff --git a/externals/ace/Functor.inl b/externals/ace/Functor.inl new file mode 100644 index 0000000..30e5394 --- /dev/null +++ b/externals/ace/Functor.inl @@ -0,0 +1,284 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Functor.inl + * + * $Id: Functor.inl 80826 2008-03-04 14:51:23Z wotte $ + * + * Inlinable method definitions for non-templatized classes + * and template specializations implementing the GOF Command Pattern, + * and STL-style functors. + * + * + * @author Chris Gill + * + * Based on Command Pattern implementations originally done by + * + * Carlos O'Ryan + * Douglas C. Schmidt + * Sergio Flores-Gaitan + * + * and on STL-style functor implementations originally done by + * Irfan Pyarali + */ +//============================================================================= + + +#include "ace/ACE.h" +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +////////////////////////////////////////////////////////////// +// GOF Command Pattern Classes and Template Specializations // +////////////////////////////////////////////////////////////// + +// Default constructor. + +ACE_INLINE +ACE_Command_Base::ACE_Command_Base (void) +{ +} + +//////////////////////////////////////////////////////////// +// STL-style Functor Classes and Template Specializations // +//////////////////////////////////////////////////////////// + +ACE_INLINE unsigned long +ACE_Hash::operator () (char t) const +{ + return t; +} + +#if defined (ACE_HAS_WCHAR) && ! defined (ACE_LACKS_NATIVE_WCHAR_T) +ACE_INLINE unsigned long +ACE_Hash::operator () (wchar_t t) const +{ + return t; +} +#endif /* ACE_HAS_WCHAR && ! ACE_LACKS_NATIVE_WCHAR_T */ + +ACE_INLINE unsigned long +ACE_Hash::operator () (signed char t) const +{ + return t; +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (unsigned char t) const +{ + return t; +} + +#if 0 +ACE_INLINE unsigned long +ACE_Hash::operator () (ACE_INT16 t) const +{ + return t; +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (ACE_UINT16 t) const +{ + return t; +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (ACE_INT32 t) const +{ + return static_cast (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (ACE_UINT32 t) const +{ + return t; +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (ACE_UINT64 t) const +{ +#if (ACE_SIZEOF_LONG == 4) + return ACE_U64_TO_U32 (t); +#else + return static_cast (t); +#endif /* ACE_SIZEOF_LONG */ +} +#endif + +ACE_INLINE unsigned long +ACE_Hash::operator () (short t) const +{ + return static_cast (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (unsigned short t) const +{ + return static_cast (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (int t) const +{ + return static_cast (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (unsigned int t) const +{ + return static_cast (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (long t) const +{ + return static_cast (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (unsigned long t) const +{ + return t; +} + +// This #if needs to match the one in Functor.h +#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) +ACE_INLINE unsigned long +ACE_Hash::operator () (ACE_INT64 t) const +{ + return static_cast (t); +} +#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ + +#if (ACE_SIZEOF_LONG < 8) +ACE_INLINE unsigned long +ACE_Hash::operator () (const ACE_UINT64 &t) const +{ +#if (ACE_SIZEOF_LONG == 4) + return ACE_U64_TO_U32 (t); +#else + return static_cast (t); +#endif /* ACE_SIZEOF_LONG */ +} +#endif /* !ACE_LACKS_UNSIGNEDLONGLONG_T */ + +ACE_INLINE unsigned long +ACE_Hash::operator () (const char *t) const +{ + return ACE::hash_pjw (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (const char *t) const +{ + return ACE::hash_pjw (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (const void *t) const +{ + return static_cast (reinterpret_cast (t)); +} + +/***********************************************************************/ +ACE_INLINE int +ACE_Equal_To::operator () (const char *lhs, const char *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const char *lhs, const char *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const ACE_UINT16 lhs, const ACE_UINT16 rhs) const +{ + return (lhs == rhs); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const ACE_INT16 lhs, const ACE_INT16 rhs) const +{ + return (lhs == rhs); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const ACE_UINT32 lhs, const ACE_UINT32 rhs) const +{ + return (lhs == rhs); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const ACE_INT32 lhs, const ACE_INT32 rhs) const +{ + return (lhs == rhs); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const ACE_UINT64 lhs, const ACE_UINT64 rhs) const +{ + return (lhs == rhs); +} + +/****************************************************************************/ +ACE_INLINE int +ACE_Less_Than::operator () (const char *lhs, const char *rhs) const +{ + return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; +} + +ACE_INLINE int +ACE_Less_Than::operator () (const char *lhs, const char *rhs) const +{ + return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; +} + + +#if defined (ACE_HAS_WCHAR) + +ACE_INLINE unsigned long +ACE_Hash::operator () (const wchar_t *t) const +{ + return ACE::hash_pjw (t); +} + +ACE_INLINE unsigned long +ACE_Hash::operator () (const wchar_t *t) const +{ + return ACE::hash_pjw (t); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const wchar_t *lhs, + const wchar_t *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +ACE_INLINE int +ACE_Equal_To::operator () (const wchar_t *lhs, + const wchar_t *rhs) const +{ + return !ACE_OS::strcmp (lhs, rhs); +} + +ACE_INLINE int +ACE_Less_Than::operator () (const wchar_t *lhs, const wchar_t *rhs) const +{ + return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; +} + +ACE_INLINE int +ACE_Less_Than::operator () (const wchar_t *lhs, const wchar_t *rhs) const +{ + return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; +} + +#endif // ACE_HAS_WCHAR + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Functor_String.cpp b/externals/ace/Functor_String.cpp new file mode 100644 index 0000000..c113f5c --- /dev/null +++ b/externals/ace/Functor_String.cpp @@ -0,0 +1,7 @@ +#include "ace/Functor_String.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Functor_String.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Functor, "$Id: Functor_String.cpp 80826 2008-03-04 14:51:23Z wotte $") diff --git a/externals/ace/Functor_String.h b/externals/ace/Functor_String.h new file mode 100644 index 0000000..2adf561 --- /dev/null +++ b/externals/ace/Functor_String.h @@ -0,0 +1,129 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Functor_String.h + * + * $Id: Functor_String.h 86698 2009-09-13 15:58:17Z johnnyw $ + * + * Class template specializations for ACE_*String types implementing + * function objects that are used in various places in ATC. They + * could be placed in Functor.h. But we don't want to couple string + * types to the rest of ACE+TAO. Hence they are placed in a seperate + * file. + */ +//========================================================================== +#ifndef ACE_FUNCTOR_STRING_H +#define ACE_FUNCTOR_STRING_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/ACE_export.h" +#include "ace/SStringfwd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +//////////////////////////////////////////////////////////// +// STL-style Functor Classes and Template Specializations // +//////////////////////////////////////////////////////////// + +// Forward declaration since we are going to specialize that template +// here. The template itself requires this file so every user of the +// template should also see the specialization. +template class ACE_Hash; +template class ACE_Equal_To; +template class ACE_Less_Than; + +/** + * @brief Function object for determining whether two ACE_CStrings are + * equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + int operator () (const ACE_CString &lhs, + const ACE_CString &rhs) const; +}; + + +/** + * @brief Function object for hashing a ACE_CString + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Calls ACE::hash_pjw + unsigned long operator () (const ACE_CString &lhs) const; +}; + + +/** + * @brief Function object for determining whether the first const string + * is less than the second const string. + */ +template<> +class ACE_Export ACE_Less_Than +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const ACE_CString &lhs, + const ACE_CString &rhs) const; +}; + + +#if defined (ACE_USES_WCHAR) + +/** + * @brief Function object for determining whether two ACE_WStrings are + * equal. + */ +template<> +class ACE_Export ACE_Equal_To +{ +public: + int operator () (const ACE_WString &lhs, + const ACE_WString &rhs) const; +}; + + +/** + * @brief Function object for hashing a ACE_WString + */ +template<> +class ACE_Export ACE_Hash +{ +public: + /// Calls ACE::hash_pjw + unsigned long operator () (const ACE_WString &lhs) const; +}; + +/** + * @brief Function object for determining whether the first const wstring + * is less than the second const wstring. + */ +template<> +class ACE_Export ACE_Less_Than +{ +public: + /// Simply calls ACE_OS::strcmp + int operator () (const ACE_WString &lhs, + const ACE_WString &rhs) const; +}; + +#endif /*ACE_USES_WCHAR*/ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Functor_String.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /*ACE_FUNCTOR_STRING_H*/ diff --git a/externals/ace/Functor_String.inl b/externals/ace/Functor_String.inl new file mode 100644 index 0000000..bdac963 --- /dev/null +++ b/externals/ace/Functor_String.inl @@ -0,0 +1,56 @@ +// -*- C++ -*- +// +// $Id: Functor_String.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/ACE.h" +#include "ace/String_Base.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE unsigned long +ACE_Hash::operator () (const ACE_CString &t) const +{ + return t.hash (); +} + + +ACE_INLINE int +ACE_Equal_To::operator () (const ACE_CString &lhs, + const ACE_CString &rhs) const +{ + return lhs == rhs; +} + +ACE_INLINE int +ACE_Less_Than::operator () (const ACE_CString &lhs, + const ACE_CString &rhs) const +{ + return (lhs < rhs); +} + + +#if defined (ACE_USES_WCHAR) +ACE_INLINE unsigned long +ACE_Hash::operator () (const ACE_WString &t) const +{ + return t.hash (); +} + + +ACE_INLINE int +ACE_Equal_To::operator () (const ACE_WString &lhs, + const ACE_WString &rhs) const +{ + return lhs == rhs; +} + +ACE_INLINE int +ACE_Less_Than::operator () (const ACE_WString &lhs, + const ACE_WString &rhs) const +{ + return (lhs < rhs); +} + +#endif /*ACE_USES_WCHAR*/ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Functor_T.cpp b/externals/ace/Functor_T.cpp new file mode 100644 index 0000000..213b501 --- /dev/null +++ b/externals/ace/Functor_T.cpp @@ -0,0 +1,49 @@ +// $Id: Functor_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_FUNCTOR_T_CPP +#define ACE_FUNCTOR_T_CPP + +#include "ace/Functor_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Functor_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Command_Callback) + +/////////////////////////////////// +// GOF Command Pattern Templates // +/////////////////////////////////// + +// Constructor. + +template +ACE_Command_Callback::ACE_Command_Callback (RECEIVER &recvr, + ACTION action) + : receiver_ (recvr), + action_ (action) +{ +} + +template +ACE_Command_Callback::~ACE_Command_Callback (void) +{ +} + +// Invokes an operation. + +template int +ACE_Command_Callback::execute (void *arg) +{ + return (receiver_.*action_) (arg); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_FUNCTOR_T_CPP */ diff --git a/externals/ace/Functor_T.h b/externals/ace/Functor_T.h new file mode 100644 index 0000000..f055c3c --- /dev/null +++ b/externals/ace/Functor_T.h @@ -0,0 +1,158 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Functor_T.h + * + * $Id: Functor_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Templatized classes for implementing function objects that are + * used in various places in ACE. There are currently two major + * categories of function objects in ACE: GOF Command Pattern + * objects, and STL-style functors for comparison of container + * elements. The command objects are invoked via an + * method, while the STL-style functors are invoked via an + * method. + * + * + * @author Chris Gill + * @author Based on Command Pattern implementations originally done by + * @author Carlos O'Ryan + * @author Douglas C. Schmidt + * @author Sergio Flores-Gaitan + * @author and on STL-style functor implementations originally done by + * @author Irfan Pyarali + */ +//============================================================================= + + +#ifndef ACE_FUNCTOR_T_H +#define ACE_FUNCTOR_T_H +#include /**/ "ace/pre.h" + +#include "ace/Functor.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Functor_String.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/////////////////////////////////// +// GOF Command Pattern Templates // +/////////////////////////////////// + +/** + * @class ACE_Command_Callback + * + * @brief Defines a class template that allows us to invoke a GOF + * command style callback to an object without knowing anything + * about the object except its type. + * + * This class declares an interface to execute operations, + * binding a RECEIVER object with an ACTION. The RECEIVER knows + * how to implement the operation. A class can invoke operations + * without knowing anything about it, or how it was implemented. + */ +template +class ACE_Command_Callback : public ACE_Command_Base +{ +public: + /// Constructor: sets the of the Command to recvr, and the + /// of the Command to . + ACE_Command_Callback (RECEIVER &recvr, ACTION action); + + /// Virtual destructor. + virtual ~ACE_Command_Callback (void); + + /// Invokes the method from the object . + virtual int execute (void *arg = 0); + +private: + /// Object where the method resides. + RECEIVER &receiver_; + + /// Method that is going to be invoked. + ACTION action_; +}; + +///////////////////////////////// +// STL-style Functor Templates // +///////////////////////////////// + +/** + * @class ACE_Hash + * + * @brief Function object for hashing + */ +template +class ACE_Hash +{ +public: + /// Simply calls t.hash () + unsigned long operator () (const TYPE &t) const; +}; + +/** + * @class ACE_Pointer_Hash + * + * @brief Function object for hashing pointers + */ +template +class ACE_Pointer_Hash +{ +public: + /// Simply returns t. + unsigned long operator () (TYPE t) const; +}; + +/** + * @class ACE_Equal_To + * + * @brief Function object for comparing two objects of + * the given type for equality. + */ +template +class ACE_Equal_To +{ +public: + /// Simply calls operator== + bool operator () (const TYPE &lhs, + const TYPE &rhs) const; +}; + +/** + * @class ACE_Less_Than + * + * @brief Function object for determining whether the first object of + * the given type is less than the second object of the same + * type. + */ +template +class ACE_Less_Than +{ +public: + /// Simply calls operator< + bool operator () (const TYPE &lhs, + const TYPE &rhs) const; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Functor_T.inl" +#endif /* __ACE_INLINE__ */ + + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Functor_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Functor_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_FUNCTOR_T_H */ diff --git a/externals/ace/Functor_T.inl b/externals/ace/Functor_T.inl new file mode 100644 index 0000000..35cfed5 --- /dev/null +++ b/externals/ace/Functor_T.inl @@ -0,0 +1,42 @@ +// -*- C++ -*- +// +// $Id: Functor_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE unsigned long +ACE_Hash::operator () (const TYPE &t) const +{ + return t.hash (); +} + +template ACE_INLINE unsigned long +ACE_Pointer_Hash::operator () (TYPE t) const +{ +#if defined (ACE_WIN64) + // The cast below is legit... we only want a hash, and need not convert + // the hash back to a pointer. +# pragma warning(push) +# pragma warning(disable : 4311) /* Truncate pointer to unsigned long */ +#endif /* ACE_WIN64 */ + return reinterpret_cast (t); +#if defined (ACE_WIN64) +# pragma warning(pop) +#endif /* ACE_WIN64 */ +} + +template ACE_INLINE bool +ACE_Equal_To::operator () (const TYPE &lhs, + const TYPE &rhs) const +{ + return lhs == rhs; +} + +template ACE_INLINE bool +ACE_Less_Than::operator () (const TYPE &lhs, + const TYPE &rhs) const +{ + return lhs < rhs; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Future.cpp b/externals/ace/Future.cpp new file mode 100644 index 0000000..da40c46 --- /dev/null +++ b/externals/ace/Future.cpp @@ -0,0 +1,434 @@ + // $Id: Future.cpp 85358 2009-05-17 10:34:33Z johnnyw $ + +#ifndef ACE_FUTURE_CPP +#define ACE_FUTURE_CPP + +#include "ace/Future.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_RCSID (ace, Future, "$Id: Future.cpp 85358 2009-05-17 10:34:33Z johnnyw $") + +#if defined (ACE_HAS_THREADS) + +# include "ace/Guard_T.h" +# include "ace/Recursive_Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Future_Holder::ACE_Future_Holder (void) +{ +} + +template +ACE_Future_Holder::ACE_Future_Holder (const ACE_Future &item) + : item_ (item) +{ +} + +template +ACE_Future_Holder::~ACE_Future_Holder (void) +{ +} + +template +ACE_Future_Observer::ACE_Future_Observer (void) +{ +} + +template +ACE_Future_Observer::~ACE_Future_Observer (void) +{ +} + +// Dump the state of an object. + +template void +ACE_Future_Rep::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, + "ref_count_ = %d\n", + (int) this->ref_count_)); + ACE_DEBUG ((LM_INFO,"value_:\n")); + if (this->value_) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (NON-NULL)\n"))); + else + //FUZZ: disable check_for_NULL + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (NULL)\n"))); + //FUZZ: enable check_for_NULL + + ACE_DEBUG ((LM_INFO,"value_ready_:\n")); + this->value_ready_.dump (); + ACE_DEBUG ((LM_INFO,"value_ready_mutex_:\n")); + this->value_ready_mutex_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_Future_Rep * +ACE_Future_Rep::internal_create (void) +{ + ACE_Future_Rep *temp = 0; + ACE_NEW_RETURN (temp, + ACE_Future_Rep (), + 0); + return temp; +} + +template ACE_Future_Rep * +ACE_Future_Rep::create (void) +{ + // Yes set ref count to zero. + ACE_Future_Rep *temp = internal_create (); +#if defined (ACE_NEW_THROWS_EXCEPTIONS) + if (temp == 0) + ACE_throw_bad_alloc; +#else + ACE_ASSERT (temp != 0); +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + return temp; + } + + +template ACE_Future_Rep * +ACE_Future_Rep::attach (ACE_Future_Rep*& rep) +{ + ACE_ASSERT (rep != 0); + // Use value_ready_mutex_ for both condition and ref count management + ACE_MT (ACE_Guard r_mon (rep->value_ready_mutex_)); + ++rep->ref_count_; + return rep; +} + +template void +ACE_Future_Rep::detach (ACE_Future_Rep*& rep) +{ + ACE_ASSERT (rep != 0); + // Use value_ready_mutex_ for both condition and ref count management + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, r_mon, rep->value_ready_mutex_)); + + if (rep->ref_count_-- == 0) + { + ACE_MT (r_mon.release ()); + // We do not need the lock when deleting the representation. + // There should be no side effects from deleting rep and we don + // not want to release a deleted mutex. + delete rep; + } +} + +template void +ACE_Future_Rep::assign (ACE_Future_Rep*& rep, ACE_Future_Rep* new_rep) +{ + ACE_ASSERT (rep != 0); + ACE_ASSERT (new_rep != 0); + // Use value_ready_mutex_ for both condition and ref count management + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, r_mon, rep->value_ready_mutex_)); + + ACE_Future_Rep* old = rep; + rep = new_rep; + + // detached old last for exception safety + if (old->ref_count_-- == 0) + { + ACE_MT (r_mon.release ()); + // We do not need the lock when deleting the representation. + // There should be no side effects from deleting rep and we don + // not want to release a deleted mutex. + delete old; + } +} + +template +ACE_Future_Rep::ACE_Future_Rep (void) + : value_ (0), + ref_count_ (0), + value_ready_ (value_ready_mutex_) +{ +} + +template +ACE_Future_Rep::~ACE_Future_Rep (void) +{ + delete this->value_; +} + +template int +ACE_Future_Rep::ready (void) const +{ + return this->value_ != 0; +} + +template int +ACE_Future_Rep::set (const T &r, + ACE_Future &caller) +{ + // If the value is already produced, ignore it... + if (this->value_ == 0) + { + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, + this->value_ready_mutex_, + -1)); + // Otherwise, create a new result value. Note the use of the + // Double-checked locking pattern to avoid multiple allocations. + + if (this->value_ == 0) // Still no value, so proceed + { + ACE_NEW_RETURN (this->value_, + T (r), + -1); + + // Remove and notify all subscribed observers. + typename OBSERVER_COLLECTION::iterator iterator = + this->observer_collection_.begin (); + + typename OBSERVER_COLLECTION::iterator end = + this->observer_collection_.end (); + + while (iterator != end) + { + OBSERVER *observer = *iterator++; + observer->update (caller); + } + + // Signal all the waiting threads. + return this->value_ready_.broadcast (); + } + // Destructor releases the lock. + } + return 0; +} + +template int +ACE_Future_Rep::get (T &value, + ACE_Time_Value *tv) const +{ + // If the value is already produced, return it. + if (this->value_ == 0) + { + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + this->value_ready_mutex_, + -1)); + // If the value is not yet defined we must block until the + // producer writes to it. + + while (this->value_ == 0) + // Perform a timed wait. + if (this->value_ready_.wait (tv) == -1) + return -1; + + // Destructor releases the lock. + } + + value = *this->value_; + return 0; +} + +template int +ACE_Future_Rep::attach (ACE_Future_Observer *observer, + ACE_Future &caller) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->value_ready_mutex_, -1)); + + // Otherwise, create a new result value. Note the use of the + // Double-checked locking pattern to avoid corrupting the list. + + int result = 1; + + // If the value is already produced, then notify observer + if (this->value_ == 0) + result = this->observer_collection_.insert (observer); + else + observer->update (caller); + + return result; +} + +template int +ACE_Future_Rep::detach (ACE_Future_Observer *observer) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->value_ready_mutex_, -1)); + + // Remove all occurrences of the specified observer from this + // objects hash map. + return this->observer_collection_.remove (observer); +} + +template +ACE_Future_Rep::operator T () +{ + // If the value is already produced, return it. + if (this->value_ == 0) + { + // Constructor of ace_mon acquires the mutex. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->value_ready_mutex_, 0)); + + // If the value is not yet defined we must block until the + // producer writes to it. + + // Wait ``forever.'' + + while (this->value_ == 0) + if (this->value_ready_.wait () == -1) + // What to do in this case since we've got to indicate + // failure somehow? Exceptions would be nice, but they're + // not portable... + return 0; + + // Destructor releases the mutex + } + + return *this->value_; +} + +template +ACE_Future::ACE_Future (void) + : future_rep_ (FUTURE_REP::create ()) +{ +} + +template +ACE_Future::ACE_Future (const ACE_Future &r) + : future_rep_ (FUTURE_REP::attach (((ACE_Future &) r).future_rep_)) +{ +} + +template +ACE_Future::ACE_Future (const T &r) + : future_rep_ (FUTURE_REP::create ()) +{ + this->future_rep_->set (r, *this); +} + +template +ACE_Future::~ACE_Future (void) +{ + FUTURE_REP::detach (future_rep_); +} + +template bool +ACE_Future::operator== (const ACE_Future &r) const +{ + return r.future_rep_ == this->future_rep_; +} + +template bool +ACE_Future::operator!= (const ACE_Future &r) const +{ + return r.future_rep_ != this->future_rep_; +} + +template int +ACE_Future::cancel (const T &r) +{ + this->cancel (); + return this->future_rep_->set (r, *this); +} + +template int +ACE_Future::cancel (void) +{ + // If this ACE_Future is already attached to a ACE_Future_Rep, + // detach it (maybe delete the ACE_Future_Rep). + FUTURE_REP::assign (this->future_rep_, + FUTURE_REP::create ()); + return 0; +} + +template int +ACE_Future::set (const T &r) +{ + // Give the pointer to the result to the ACE_Future_Rep. + return this->future_rep_->set (r, *this); +} + +template int +ACE_Future::ready (void) const +{ + // We're ready if the ACE_Future_rep is ready... + return this->future_rep_->ready (); +} + +template int +ACE_Future::get (T &value, + ACE_Time_Value *tv) const +{ + // We return the ACE_Future_rep. + return this->future_rep_->get (value, tv); +} + +template int +ACE_Future::attach (ACE_Future_Observer *observer) +{ + return this->future_rep_->attach (observer, *this); +} + +template int +ACE_Future::detach (ACE_Future_Observer *observer) +{ + return this->future_rep_->detach (observer); +} + +template +ACE_Future::operator T () +{ + // note that this will fail (and COREDUMP!) + // if future_rep_ == 0 ! + // + // but... + // this is impossible unless somebody is so stupid to + // try something like this: + // + // Future futT; + // T t; + // t = futT; + + // perform type conversion on Future_Rep. + return *future_rep_; +} + +template void +ACE_Future::operator = (const ACE_Future &rhs) +{ + // assignment: + // + // bind to the same as . + + // This will work if &r == this, by first increasing the ref count + ACE_Future &r = (ACE_Future &) rhs; + FUTURE_REP::assign (this->future_rep_, + FUTURE_REP::attach (r.future_rep_)); +} + +template void +ACE_Future::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, + ACE_BEGIN_DUMP, this)); + + if (this->future_rep_) + this->future_rep_->dump (); + + ACE_DEBUG ((LM_DEBUG, + ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template ACE_Future_Rep * +ACE_Future::get_rep () +{ + return this->future_rep_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ + +#endif /* ACE_FUTURE_CPP */ diff --git a/externals/ace/Future.h b/externals/ace/Future.h new file mode 100644 index 0000000..e30159e --- /dev/null +++ b/externals/ace/Future.h @@ -0,0 +1,387 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Future.h + * + * $Id: Future.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Andres Kruse + * @author Douglas C. Schmidt + * @author Per Andersson and + * @author John Tucker + */ +//============================================================================= + +#ifndef ACE_FUTURE_H +#define ACE_FUTURE_H + +#include /**/ "ace/pre.h" + +#include "ace/Unbounded_Set.h" +#include "ace/Strategies_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +#include "ace/Recursive_Thread_Mutex.h" +#include "ace/Condition_Recursive_Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decl. +template class ACE_Future_Holder; +template class ACE_Future_Observer; +template class ACE_Future_Rep; +template class ACE_Future; + +/** + * @class ACE_Future_Holder + * + * @brief Implementation of object that holds an ACE_Future. + */ +template +class ACE_Future_Holder +{ +public: + ACE_Future_Holder (const ACE_Future &future); + ~ACE_Future_Holder (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + ACE_Future item_; + +protected: + ACE_Future_Holder (void); +}; + +/** + * @class ACE_Future_Observer + * + * @brief ACE_Future_Observer + * + * An ACE_Future_Observer object implements an object that is + * subscribed with an ACE_Future object so that it may be notified + * when the value of the ACE_Future object is written to by a writer + * thread. It uses the Observer pattern. + */ +template +class ACE_Future_Observer +{ +public: + /// Destructor + virtual ~ACE_Future_Observer (void); + + /// Called by the ACE_Future in which we are subscribed to when + /// its value is written to. + virtual void update (const ACE_Future &future) = 0; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +protected: + + /// Constructor + ACE_Future_Observer (void); +}; + +/** + * @class ACE_Future_Rep + * + * @internal + * + * @brief ACE_Future_Rep + * + * An ACE_Future_Rep object encapsules a pointer to an object + * of class T which is the result of an asynchronous method + * invocation. It is pointed to by ACE_Future object[s] and + * only accessible through them. + */ +template +class ACE_Future_Rep +{ +private: + friend class ACE_Future; + + /** + * Set the result value. The specified represents the + * future that invoked this method, which is used to notify + * the list of future observers. Returns 0 for success, -1 on error. + * This function only has an effect the first time it is called for + * the object. Subsequent calls return 0 (success) but have no effect. + */ + int set (const T &r, + ACE_Future &caller); + + /// Wait up to @a tv time to get the @a value. Note that @a tv must be + /// specified in absolute time rather than relative time. + int get (T &value, + ACE_Time_Value *tv) const; + + /** + * Attaches the specified observer to a subject (i.e., the ACE_Future_Rep). + * The update method of the specified subject will be invoked with a copy of + * the written-to ACE_Future as input when the result gets set. + * + * Returns 0 if the observer is successfully attached, 1 if the + * observer is already attached, and -1 if failures occur. + */ + int attach (ACE_Future_Observer *observer, + ACE_Future &caller); + + /** + * Detaches the specified observer from a subject (i.e., the ACE_Future_Rep). + * The update method of the specified subject will not be invoked when the + * ACE_Future_Reps result gets set. Returns 1 if the specified observer was + * actually attached to the subject prior to this call and 0 if was not. + * + * Returns 0 if the observer was successfully detached, and -1 if the + * observer was not attached in the first place. + */ + int detach (ACE_Future_Observer *observer); + + /** + * Type conversion. will block forever until the result is + * available. Note that this method is going away in a subsequent + * release since it doesn't distinguish between failure results and + * success results (exceptions should be used, but they aren't + * portable...). The method should be used instead since it + * separates the error value from the result, and also permits + * timeouts. + */ + operator T (); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + // = Encapsulate reference count and object lifetime of instances. + + // These methods must go after the others to work around a bug with + // Borland's C++ Builder... + + /// Allocate a new ACE_Future_Rep instance, returning NULL if it + /// cannot be created. + static ACE_Future_Rep *internal_create (void); + + /// Create a ACE_Future_Rep and initialize the reference count. + static ACE_Future_Rep *create (void); + + /** + * Increase the reference count and return argument. Uses the + * attribute "value_ready_mutex_" to synchronize reference count + * updating. + * + * Precondition (rep != 0). + */ + static ACE_Future_Rep *attach (ACE_Future_Rep *&rep); + + /** + * Decreases the reference count and deletes rep if there are no + * more references to rep. + * + * Precondition (rep != 0) + */ + static void detach (ACE_Future_Rep *&rep); + + /** + * Decreases the rep's reference count and deletes rep if there + * are no more references to rep. Then assigns new_rep to rep. + * + * Precondition (rep != 0 && new_rep != 0) + */ + static void assign (ACE_Future_Rep *&rep, ACE_Future_Rep *new_rep); + + /// Is result available? + int ready (void) const; + + /// Pointer to the result. + T *value_; + + /// Reference count. + int ref_count_; + + typedef ACE_Future_Observer OBSERVER; + + typedef ACE_Unbounded_Set OBSERVER_COLLECTION; + + /// Keep a list of ACE_Future_Observers unread by client's reader thread. + OBSERVER_COLLECTION observer_collection_; + + // = Condition variable and mutex that protect the . + mutable ACE_Recursive_Thread_Mutex value_ready_mutex_; + mutable ACE_Condition_Recursive_Thread_Mutex value_ready_; + +private: + + ACE_Future_Rep (void); + +protected: + + ~ACE_Future_Rep (void); + +}; + +/** + * @class ACE_Future + * + * @brief This class implements a ``single write, multiple read'' + * pattern that can be used to return results from asynchronous + * method invocations. + */ +template +class ACE_Future +{ +public: + // = Initialization and termination methods. + /// Constructor. + ACE_Future (void); + + /// Copy constructor binds @a this and @a r to the same + /// ACE_Future_Rep. An ACE_Future_Rep is created if necessary. + ACE_Future (const ACE_Future &r); + + /// Constructor that initialises an ACE_Future to point to the + /// result @a r immediately. + ACE_Future (const T &r); + + /// Destructor. + ~ACE_Future (void); + + /// Assignment operator that binds @a this and @a r to the same + /// ACE_Future_Rep. An ACE_Future_Rep is created if necessary. + void operator = (const ACE_Future &r); + + /// Cancel an ACE_Future and assign the value @a r. It is used if a + /// client does not want to wait for the value to be produced. + int cancel (const T &r); + + /** + * Cancel an ACE_Future. Put the future into its initial + * state. Returns 0 on succes and -1 on failure. It is now possible + * to reuse the ACE_Future. But remember, the ACE_Future + * is now bound to a new ACE_Future_Rep. + */ + int cancel (void); + + /** + * Equality operator that returns @c true if both ACE_Future objects + * point to the same ACE_Future_Rep object. + * + * @note It also returns @c true if both objects have just been + * instantiated and not used yet. + */ + bool operator == (const ACE_Future &r) const; + + /// Inequality operator, which is the opposite of equality. + bool operator != (const ACE_Future &r) const; + + /** + * Make the result available. Is used by the server thread to give + * the result to all waiting clients. Returns 0 for success, -1 on failure. + * This function only has an effect the first time it is called for + * the object (actually, the first time the underlying ACE_Future_Rep has a + * value assigned to it). Subsequent calls return 0 (success) but have no + * effect. + */ + int set (const T &r); + + /** + * Wait to get the object's value. + * + * @param value Receives the value of this ACE_Future when it is set. + * @param tv Pointer to an ACE_Time_Value containing the absolute + * time to wait until for the value to be set. If @a tv + * is 0, the call waits indefinitely for the value to be + * set, unless an error occurs. + * + * @retval 0 Success; @a value contains the value of the ACE_Future. + * @retval -1 Error; check ACE_OS::last_error() for an error code. + */ + int get (T &value, + ACE_Time_Value *tv = 0) const; + + /** + * @deprecated Note that this method is going away in a subsequent + * release since it doesn't distinguish between failure + * results and success results (exceptions should be + * used, but they aren't portable...). + * Type conversion, which obtains the result of the asynchronous + * method invocation. Will block forever. The get() method should be + * used instead since it separates the error value from the result, + * and also permits timeouts. + */ + operator T (); + + /// Check if the result is available. + int ready (void) const; + + /** + * Attaches the specified observer to a subject (this ACE_Future). + * The update method of the specified subject will be invoked with a copy of + * the associated ACE_Future as input when the result gets set. If the + * result is already set when this method gets invoked, then the update + * method of the specified subject will be invoked immediately. + * + * @param observer The observer to attach to the subject. + * + * @retval 0 Success. + * @retval 1 The observer was already attached. + * @retval -1 Error; check ACE_OS::last_error() for an error code. + */ + int attach (ACE_Future_Observer *observer); + + /** + * Detaches the specified observer from a subject (this ACE_Future). + * The update method of the specified subject will not be invoked when the + * ACE_Future_Rep result gets set. + * + * @param observer The observer to attach to the subject. + * + * @retval 0 The observer was successfully detached. + * @retval -1 Error, including the observer not attached prior + * to calling this method. + */ + int detach (ACE_Future_Observer *observer); + + /// Dump the state of an object. + void dump (void) const; + + /** + * Get the underlying ACE_Future_Rep pointer. Note that this method should + * rarely, if ever, be used and that modifying the underlying + * ACE_Future_Rep should be done with extreme caution. + */ + ACE_Future_Rep *get_rep (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + // the ACE_Future_Rep + /// Protect operations on the . + typedef ACE_Future_Rep FUTURE_REP; + FUTURE_REP *future_rep_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Future.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Future.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" + +#endif /* ACE_FUTURE_H */ diff --git a/externals/ace/Future_Set.cpp b/externals/ace/Future_Set.cpp new file mode 100644 index 0000000..a40b070 --- /dev/null +++ b/externals/ace/Future_Set.cpp @@ -0,0 +1,136 @@ +// $Id: Future_Set.cpp 88128 2009-12-14 02:17:22Z schmidt $ + +#ifndef ACE_FUTURE_SET_CPP +#define ACE_FUTURE_SET_CPP + +#include "ace/Future_Set.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Future_Set::ACE_Future_Set (ACE_Message_Queue *new_queue) + : delete_queue_ (false) +{ + if (new_queue) + this->future_notification_queue_ = new_queue; + else + { + ACE_NEW (this->future_notification_queue_, + ACE_Message_Queue); + this->delete_queue_ = true; + } +} + +template +ACE_Future_Set::~ACE_Future_Set (void) +{ + // Detach ourselves from all remaining futures, if any, in our map. + typename FUTURE_HASH_MAP::iterator iterator = + this->future_map_.begin (); + + typename FUTURE_HASH_MAP::iterator end = + this->future_map_.end (); + + for (; + iterator != end; + ++iterator) + { + FUTURE_HOLDER *future_holder = (*iterator).int_id_; + future_holder->item_.detach (this); + delete future_holder; + } + + if (this->delete_queue_) + delete this->future_notification_queue_; +} + +template int +ACE_Future_Set::is_empty () const +{ + return (((ACE_Future_Set*)this)->future_map_.current_size () == 0 ); +} + +template int +ACE_Future_Set::insert (ACE_Future &future) +{ + FUTURE_HOLDER *future_holder; + ACE_NEW_RETURN (future_holder, + FUTURE_HOLDER (future), + -1); + + FUTURE_REP *future_rep = future.get_rep (); + int result = this->future_map_.bind (future_rep, + future_holder); + + // If a new map entry was created, then attach to the future, + // otherwise we were already attached to the future or some error + // occurred so just delete the future holder. + if (result == 0) + // Attach ourself to the ACE_Futures list of observer + future.attach (this); + else + delete future_holder; + + return result; +} + +template void +ACE_Future_Set::update (const ACE_Future &future) +{ + ACE_Message_Block *mb; + FUTURE &local_future = const_cast &> (future); + + ACE_NEW (mb, + ACE_Message_Block ((char *) local_future.get_rep (), 0)); + + // Enqueue in priority order. + this->future_notification_queue_->enqueue (mb, 0); +} + +template int +ACE_Future_Set::next_readable (ACE_Future &future, + ACE_Time_Value *tv) +{ + if (this->is_empty ()) + return 0; + + ACE_Message_Block *mb = 0; + FUTURE_REP *future_rep = 0; + + // Wait for a "readable future" signal from the message queue. + if (this->future_notification_queue_->dequeue_head (mb, + tv) != -1) + { + // Extract future rep from the message block. + future_rep = reinterpret_cast (mb->base ()); + + // Delete the message block. + mb->release (); + } + else + return 0; + + // Remove the hash map entry with the specified future rep from our map. + FUTURE_HOLDER *future_holder; + if (this->future_map_.find (future_rep, + future_holder) != -1) + { + future = future_holder->item_; + this->future_map_.unbind (future_rep); + delete future_holder; + return 1; + } + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ +#endif /* ACE_FUTURE_SET_CPP */ diff --git a/externals/ace/Future_Set.h b/externals/ace/Future_Set.h new file mode 100644 index 0000000..3d07f4f --- /dev/null +++ b/externals/ace/Future_Set.h @@ -0,0 +1,146 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Future_Set.h + * + * $Id: Future_Set.h 88128 2009-12-14 02:17:22Z schmidt $ + * + * @author John Tucker + */ +//============================================================================= + +#ifndef ACE_FUTURE_SET_H +#define ACE_FUTURE_SET_H +#include /**/ "ace/pre.h" + +#include "ace/Thread.h" +#include "ace/Message_Queue.h" +#include "ace/Future.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Null_Mutex.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Future_Set + * + * @brief This class implements a mechanism that allows the values of + * a collection of ACE_Future objects to be accessed by reader threads + * as they become available. The caller(s) provide the ACE_Future_Set + * (i.e. the observer...) with the collection of ACE_Future objects + * (i.e. the subjects...) that are to be observed using the the + * ACE_Future_Set::insert() method. The caller(s) may then iterate + * over the collection in the order in which they become readable + * using the ACE_Future_Set::next_readable() method. + */ +template +class ACE_Future_Set : public ACE_Future_Observer +{ +public: + // = Initialization and termination methods. + + /// Constructor. + ACE_Future_Set (ACE_Message_Queue *future_notification_queue_ = 0); + + /// Destructor. + ~ACE_Future_Set (void); + + /** + * Return 1 if their are no ACE_Future objects left on its queue and + * 0 otherwise. + * + * When an ACE_Future_Set has no ACE_Future>subjects to observe it is + * empty. The ACE_Future_Set is in the empty state when either the caller(s) + * have retrieved every readable ACE_Future subject assigned the + * ACE_Future_Set via the ACE_Future_Set::next_readable() method, + * or when the ACE_Future_Set has not been assigned any subjects. + */ + int is_empty (void) const; + + /** + * Enqueus the given ACE_Future into this objects queue when it is + * readable. + * + * Returns 0 if the future is successfully inserted, 1 if the + * future is already inserted, and -1 if failures occur. + */ + int insert (ACE_Future &future); + + /** + * Wait up to @a tv time to get the @a value. Note that @a tv must be + * specified in absolute time rather than relative time.); get the + * next ACE_Future that is readable. If @a tv = 0, the will block + * forever. + * + * If a readable future becomes available, then the input + * ACE_Future object param will be assigned with it and 1 will + * be returned. If the ACE_Future_Set is empty (i.e. see definition + * of ACE_Future_Set::is_empty()), then 0 is returned. + * + * When a readable ACE_Future object is retrieved via the + * ACE_Future_Set::next_readable() method, the ACE_Future_Set will + * remove that ACE_Future object from its list of subjects. + */ + int next_readable (ACE_Future &result, + ACE_Time_Value *tv = 0); + + /// Called by the ACE_Future subject in which we are subscribed to + /// when its value is written to. + virtual void update (const ACE_Future &future); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Future_Set &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Future_Set (const ACE_Future_Set &)) + + typedef ACE_Future FUTURE; + + typedef ACE_Future_Rep FUTURE_REP; + + typedef ACE_Future_Holder FUTURE_HOLDER; + + typedef ACE_Pointer_Hash FUTURE_REP_HASH; + + typedef ACE_Equal_To FUTURE_REP_COMPARE; + + typedef ACE_Hash_Map_Manager_Ex FUTURE_HASH_MAP; + + /// Map of , subjects, which have not been written to by + /// client's writer thread. + FUTURE_HASH_MAP future_map_; + + /// Message queue for notifying the reader thread of which + /// have been written to by client's writer thread. + ACE_Message_Queue *future_notification_queue_; + + /// Keeps track of whether we need to delete the message queue. + bool delete_queue_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Future_Set.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Future_Set.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_HAS_THREADS */ +#include /**/ "ace/post.h" +#endif /* ACE_FUTURE_SET_H */ diff --git a/externals/ace/Get_Opt.cpp b/externals/ace/Get_Opt.cpp new file mode 100644 index 0000000..915ff8a --- /dev/null +++ b/externals/ace/Get_Opt.cpp @@ -0,0 +1,734 @@ +// $Id: Get_Opt.cpp 81840 2008-06-05 13:46:45Z sma $ + +#include "ace/Get_Opt.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Get_Opt.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/ACE.h" +#include "ace/Log_Msg.h" +#include "ace/SString.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_ctype.h" +#include "ace/OS_NS_stdlib.h" + +ACE_RCSID (ace, + Get_Opt, + "$Id: Get_Opt.cpp 81840 2008-06-05 13:46:45Z sma $") + +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University 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 OR 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. + */ + +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dieter Baron and Thomas Klausner. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR 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. + */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Get_Opt) + +#ifdef ACE_USES_WCHAR +void ACE_Get_Opt::ACE_Get_Opt_Init (const ACE_TCHAR *optstring) +#else +ACE_Get_Opt::ACE_Get_Opt (int argc, + ACE_TCHAR **argv, + const ACE_TCHAR *optstring, + int skip, + int report_errors, + int ordering, + int long_only) + : argc_ (argc), + argv_ (argv), + optind (skip), + opterr (report_errors), + optarg (0), + optstring_ (0), + long_only_ (long_only), + has_colon_ (0), + last_option_ (0), + nextchar_ (0), + optopt_ (0), + ordering_ (ordering), + nonopt_start_ (optind), + nonopt_end_ (optind), + long_option_ (0) +#endif +{ + ACE_TRACE ("ACE_Get_Opt::ACE_Get_Opt"); + + ACE_NEW (this->optstring_, ACE_TString (optstring)); + ACE_NEW (this->last_option_, ACE_TString (ACE_TEXT (""))); + + // First check to see if POSIXLY_CORRECT was set. + // Win32 is the only platform capable of wide-char env var. +#if defined (ACE_WIN32) + const ACE_TCHAR *env_check = ACE_TEXT ("POSIXLY_CORRECT"); +#else + const char *env_check = "POSIXLY_CORRECT"; +#endif + if (ACE_OS::getenv (env_check) != 0) + this->ordering_ = REQUIRE_ORDER; + + // Now, check to see if any or the following were passed at + // the begining of optstring: '+' same as POSIXLY_CORRECT; + // '-' turns off POSIXLY_CORRECT; or ':' which signifies we + // should return ':' if a parameter is missing for an option. + // We use a loop here, since a combination of "{+|-}:" in any + // order should be legal. + int done = 0; + int offset = 0; + while (!done) + { + switch (optstring[offset++]) + { + case '+': + this->ordering_ = REQUIRE_ORDER; + break; + case '-': + this->ordering_ = RETURN_IN_ORDER; + break; + case ':': + this->has_colon_ = 1; + break; + default: + // Quit as soon as we see something else... + done = 1; + break; + } + } +} + +ACE_Get_Opt::~ACE_Get_Opt (void) +{ + ACE_TRACE ("ACE_Get_Opt::~ACE_Get_Opt"); + + size_t i = 0; + size_t size = this->long_opts_.size (); + ACE_Get_Opt_Long_Option *option = 0; + for (i = 0; i < size; ++i) + { + int retval = this->long_opts_.get (option, i); + if (retval != 0) + { + // Should never happen. + retval = 0; + continue; + } + if (option) + { + delete option; + option = 0; + } + } + delete this->optstring_; + delete this->last_option_; +} + +int +ACE_Get_Opt::nextchar_i (void) +{ + ACE_TRACE ("ACE_Get_Opt::nextchar_i"); + + if (this->ordering_ == PERMUTE_ARGS) + if (this->permute () == EOF) + return EOF; + + // Update scanning pointer. + if (this->optind >= this->argc_) + { + // We're done... + this->nextchar_ = 0; + return EOF; + } + else if (*(this->nextchar_ = this->argv_[this->optind]) != '-' + || this->nextchar_[1] == '\0') + { + // We didn't get an option. + + if (this->ordering_ == REQUIRE_ORDER + || this->ordering_ == PERMUTE_ARGS) + // If we permuted or require the options to be in order, we're done. + return EOF; + + // It must be RETURN_IN_ORDER... + this->optarg = this->argv_[this->optind++]; + this->nextchar_ = 0; + return 1; + } + else if (this->nextchar_[1] != 0 + && *++this->nextchar_ == '-' + && this->nextchar_[1] == 0) + { + // Found "--" so we're done... + ++this->optind; + this->nextchar_ = 0; + return EOF; + } + + // If it's a long option, and we allow long options advance nextchar_. + if (*this->nextchar_ == '-' && this->long_opts_.size () != 0) + this->nextchar_++; + + return 0; +} + +int +ACE_Get_Opt::long_option_i (void) +{ + ACE_TRACE ("ACE_Get_Opt::long_option_i"); + + ACE_Get_Opt_Long_Option *p; + ACE_TCHAR *s = this->nextchar_; + int hits = 0; + int exact = 0; + ACE_Get_Opt_Long_Option *pfound = 0; + int indfound = 0; + + // Advance to the end of the long option name so we can use + // it to get the length for a string compare. + while (*s && *s != '=') + s++; + + size_t len = s - this->nextchar_; + // set last_option_ to nextchar_, up to the '='. + this->last_option (ACE_TString (this->nextchar_, len)); + + size_t size = this->long_opts_.size (); + u_int option_index = 0; + for (option_index = 0; option_index < size ; option_index++) + { + p = this->long_opts_[option_index]; + ACE_ASSERT (p); + + if (!ACE_OS::strncmp (p->name_, this->nextchar_, len)) + { + // Got at least a partial match. + pfound = p; + indfound = option_index; + hits += 1; + if (len == ACE_OS::strlen(p->name_)) + { + // And in fact, it's an exact match, so let's use it. + exact = 1; + break; + } + } + } + + if ((hits > 1) && !exact) + { + // Great, we found a match, but unfortunately we found more than + // one and it wasn't exact. + if (this->opterr) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%s: option `%s' is ambiguous\n"), + this->argv_[0], this->argv_[this->optind])); + this->nextchar_ = 0; + this->optind++; + return '?'; + } + + if (pfound != 0) + { + // Okay, we found a good one (either a single hit or an exact match). + option_index = indfound; + this->optind++; + if (*s) + { + // s must point to '=' which means there's an argument (well + // close enough). + if (pfound->has_arg_ != NO_ARG) + // Good, we want an argument and here it is. + this->optarg = ++s; + else + { + // Whoops, we've got what looks like an argument, but we + // don't want one. + if (this->opterr) + ACE_ERROR + ((LM_ERROR, + ACE_TEXT ("%s: long option `--%s' doesn't allow ") + ACE_TEXT ("an argument\n"), + this->argv_[0], pfound->name_)); + // The spec doesn't cover this, so we keep going and the program + // doesn't know we ignored an argument if opt_err is off!!! + } + } + else if (pfound->has_arg_ == ARG_REQUIRED) + { + // s didn't help us, but we need an argument. Note that + // optional arguments for long options must use the "=" syntax, + // so we won't get here in that case. + if (this->optind < this->argc_) + // We still have some elements left, so use the next one. + this->optarg = this->argv_[this->optind++]; + else + { + // All out of elements, so we have to punt... + if (this->opterr) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%s: long option '--%s' requires ") + ACE_TEXT ("an argument\n"), + this->argv_[0], pfound->name_)); + this->nextchar_ = 0; + this->optopt_ = pfound->val_; // Remember matching short equiv + return this->has_colon_ ? ':' : '?'; + } + } + this->nextchar_ = 0; + this->long_option_ = pfound; + // Since val_ has to be either a valid short option or 0, this works + // great. If the user really wants to know if a long option was passed. + this->optopt_ = pfound->val_; + return pfound->val_; + } + if (!this->long_only_ || this->argv_[this->optind][1] == '-' + || this->optstring_->find (*this->nextchar_) == ACE_TString::npos) + { + // Okay, we couldn't find a long option. If it isn't long_only (which + // means try the long first, and if not found try the short) or a long + // signature was passed, e.g. "--", or it's not a short (not sure when + // this could happen) it's an error. + if (this->opterr) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%s: illegal long option '--%s'\n"), + this->argv_[0], this->nextchar_)); + this->nextchar_ = 0; + this->optind++; + return '?'; + } + return this->short_option_i (); +} + +int +ACE_Get_Opt::short_option_i (void) +{ + ACE_TRACE ("ACE_Get_Opt::short_option_i"); + + /* Look at and handle the next option-character. */ + ACE_TCHAR opt = *this->nextchar_++; + // Set last_option_ to opt + this->last_option (opt); + + ACE_TCHAR *oli = 0; + oli = + const_cast (ACE_OS::strchr (this->optstring_->c_str (), opt)); + + /* Increment `optind' when we start to process its last character. */ + if (*this->nextchar_ == '\0') + ++this->optind; + + if (oli == 0 || opt == ':') + { + if (this->opterr) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%s: illegal short option -- %c\n"), + this->argv_[0], opt)); + return '?'; + } + if (opt == 'W' && oli[1] == ';') + { + if (this->nextchar_[0] == 0) + this->nextchar_ = this->argv_[this->optind]; + return long_option_i (); + } + this->optopt_ = oli[0]; // Remember the option that matched + if (oli[1] == ':') + { + if (oli[2] == ':') + { + // Takes an optional argument, and since short option args must + // must follow directly in the same argument, a NULL nextchar_ + // means we didn't get one. + if (*this->nextchar_ != '\0') + { + this->optarg = this->nextchar_; + this->optind++; + } + else + this->optarg = 0; + this->nextchar_ = 0; + } + else + { + // Takes a required argument. + if (*this->nextchar_ != '\0') + { + // Found argument in same argv-element. + this->optarg = this->nextchar_; + this->optind++; + } + else if (this->optind == this->argc_) + { + // Ran out of arguments before finding required argument. + if (this->opterr) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%s: short option requires ") + ACE_TEXT ("an argument -- %c\n"), + this->argv_[0], opt)); + opt = this->has_colon_ ? ':' : '?'; + } + else + // Use the next argv-element as the argument. + this->optarg = this->argv_[this->optind++]; + this->nextchar_ = 0; + } + } + return opt; +} + +int +ACE_Get_Opt::operator () (void) +{ + ACE_TRACE ("ACE_Get_Opt_Long::operator"); + + // First of all, make sure we reinitialize any pointers.. + this->optarg = 0; + this->long_option_ = 0; + + if (this->argv_ == 0) + { + // It can happen, e.g., on VxWorks. + this->optind = 0; + return -1; + } + + // We check this because we can string short options together if the + // preceding one doesn't take an argument. + if (this->nextchar_ == 0 || *this->nextchar_ == '\0') + { + int retval = this->nextchar_i (); + if (retval != 0) + return retval; + } + + if (((this->argv_[this->optind][0] == '-') + && (this->argv_[this->optind][1] == '-')) || this->long_only_) + return this->long_option_i (); + + return this->short_option_i (); +} + +int +ACE_Get_Opt::long_option (const ACE_TCHAR *name, + OPTION_ARG_MODE has_arg) +{ + ACE_TRACE ("ACE_Get_Opt::long_option (const ACE_TCHAR *name, OPTION_ARG_MODE has_arg)"); + return this->long_option (name, 0, has_arg); +} + +int +ACE_Get_Opt::long_option (const ACE_TCHAR *name, + int short_option, + OPTION_ARG_MODE has_arg) +{ + ACE_TRACE ("ACE_Get_Opt::long_option (const ACE_TCHAR *name, int short_option, OPTION_ARG_MODE has_arg)"); + + // We only allow valid alpha-numeric characters as short options. + // If short_options is not a valid alpha-numeric, we can still return it + // when the long option is found, but won't allow the caller to pass it on + // the command line (how could they?). The special case is 0, but since + // we always return it, we let the caller worry about that. + if (ACE_OS::ace_isalnum (short_option) != 0) + { + // If the short_option already exists, make sure it matches, otherwise + // add it. + ACE_TCHAR *s = 0; + if ((s = const_cast ( + ACE_OS::strchr (this->optstring_->c_str (), + short_option))) != 0) + { + // Short option exists, so verify the argument options + if (s[1] == ':') + { + if (s[2] == ':') + { + if (has_arg != ARG_OPTIONAL) + { + if (this->opterr) + ACE_ERROR + ((LM_ERROR, + ACE_TEXT ("Existing short option '%c' takes ") + ACE_TEXT ("optional argument; adding %s ") + ACE_TEXT ("requires ARG_OPTIONAL\n"), + short_option, name)); + return -1; + } + } + else + if (has_arg != ARG_REQUIRED) + { + if (this->opterr) + ACE_ERROR + ((LM_ERROR, + ACE_TEXT ("Existing short option '%c' requires ") + ACE_TEXT ("an argument; adding %s ") + ACE_TEXT ("requires ARG_REQUIRED\n"), + short_option, name)); + return -1; + } + } + else if (has_arg != NO_ARG) + { + if (this->opterr) + ACE_ERROR + ((LM_ERROR, + ACE_TEXT ("Existing short option '%c' does not ") + ACE_TEXT ("accept an argument; adding %s ") + ACE_TEXT ("requires NO_ARG\n"), + short_option, name)); + return -1; + } + } + else + { + // Didn't find short option, so add it... + *this->optstring_ += (ACE_TCHAR) short_option; + if (has_arg == ARG_REQUIRED) + *this->optstring_ += ACE_TEXT (":"); + else if (has_arg == ARG_OPTIONAL) + *this->optstring_ += ACE_TEXT ("::"); + } + } + + ACE_Get_Opt_Long_Option *option = + new ACE_Get_Opt_Long_Option (name, has_arg, short_option); + + if (!option) + return -1; + + // Add to array + size_t size = this->long_opts_.size (); + if (this->long_opts_.size (size + 1) != 0 + || this->long_opts_.set (option, size) != 0) + { + delete option; + ACE_ERROR_RETURN + ((LM_ERROR, ACE_TEXT ("Could not add long option to array.\n")), + -1); + } + return 0; +} + +const ACE_TCHAR* +ACE_Get_Opt::long_option (void) const +{ + ACE_TRACE ("ACE_Get_Opt::long_option (void)"); + if (this->long_option_) + return this->long_option_->name_; + return 0; +} + +const ACE_TCHAR* +ACE_Get_Opt::last_option (void) const +{ + return this->last_option_->c_str (); +} + +void +ACE_Get_Opt::last_option (const ACE_TString &last_option) +{ + *this->last_option_ = last_option; +} + +void +ACE_Get_Opt::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Get_Opt::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n") + ACE_TEXT ("opstring_ = %s\n") + ACE_TEXT ("long_only_ = %d\n") + ACE_TEXT ("has_colon_ = %d\n") + ACE_TEXT ("last_option_ = %s\n") + ACE_TEXT ("nextchar_ = %s\n") + ACE_TEXT ("optopt_ = %c\n") + ACE_TEXT ("ordering_ = %d\n"), + this->optstring_->c_str (), + this->long_only_, + this->has_colon_, + this->last_option_->c_str (), + this->nextchar_, + this->optopt_, + this->ordering_)); + + // now loop through the + size_t size = this->long_opts_.size (); + for (u_int i = 0; i < size ; ++i) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n") + ACE_TEXT ("long_option name_ = %s\n") + ACE_TEXT ("has_arg_ = %d\n") + ACE_TEXT ("val_ = %d\n"), + this->long_opts_[i]->name_, + this->long_opts_[i]->has_arg_, + this->long_opts_[i]->val_)); + } + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +void +ACE_Get_Opt::permute_args (void) +{ + ACE_TRACE ("ACE_Get_Opt::permute_args"); + + u_long cyclelen, i, j, ncycle, nnonopts, nopts; + u_long opt_end = this->optind; + int cstart, pos = 0; + ACE_TCHAR *swap = 0; + + nnonopts = this->nonopt_end_ - this->nonopt_start_; + nopts = opt_end - this->nonopt_end_; + ncycle = ACE::gcd (nnonopts, nopts); + cyclelen = (opt_end - this->nonopt_start_) / ncycle; + + this->optind = this->optind - nnonopts; + + for (i = 0; i < ncycle; i++) + { + cstart = this->nonopt_end_ + i; + pos = cstart; + for (j = 0; j < cyclelen; j++) + { + if (pos >= this->nonopt_end_) + pos -= nnonopts; + else + pos += nopts; + swap = this->argv_[pos]; + + ((ACE_TCHAR **)this->argv_)[pos] = argv_[cstart]; + + ((ACE_TCHAR **)this->argv_)[cstart] = swap; + } + } +} + +int +ACE_Get_Opt::permute (void) +{ + ACE_TRACE ("ACE_Get_Opt::permute"); + + if (this->nonopt_start_ != this->nonopt_end_ + && this->nonopt_start_ != this->optind) + this->permute_args (); + + this->nonopt_start_ = this->optind; + + // Skip over args untill we find the next option. + while (this->optind < this->argc_ + && (this->argv_[this->optind][0] != '-' + || this->argv_[this->optind][1] == '\0')) + this->optind++; + + // Got an option, so mark this as the end of the non options. + this->nonopt_end_ = this->optind; + + if (this->optind != this->argc_ + && ACE_OS::strcmp (this->argv_[this->optind], + ACE_TEXT ("--")) == 0) + { + // We found the marker for the end of the options. + ++this->optind; + + if (this->nonopt_start_ != this->nonopt_end_ + && this->nonopt_end_ != this->optind) + this->permute_args (); + } + + if (this->optind == this->argc_) + { + if (this->nonopt_start_ != this->nonopt_end_) + this->optind = this->nonopt_start_; + return EOF; + } + return 0; +} + +const ACE_TCHAR * +ACE_Get_Opt::optstring (void) const +{ + return this->optstring_->c_str (); +} + +ACE_Get_Opt::ACE_Get_Opt_Long_Option::ACE_Get_Opt_Long_Option ( + const ACE_TCHAR *name, + int has_arg, + int val) + : name_ (ACE::strnew (name)), + has_arg_ (has_arg), + val_ (val) +{} + +ACE_Get_Opt::ACE_Get_Opt_Long_Option::~ACE_Get_Opt_Long_Option (void) +{ + delete [] this->name_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Get_Opt.h b/externals/ace/Get_Opt.h new file mode 100644 index 0000000..1c30096 --- /dev/null +++ b/externals/ace/Get_Opt.h @@ -0,0 +1,494 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Get_Opt.h + * + * $Id: Get_Opt.h 86367 2009-08-05 09:41:11Z johnnyw $ + * + * @author Douglas C. Schmidt + * @author Don Hinton (added long option support) + */ +//========================================================================== + +#ifndef ACE_GET_OPT_H +#define ACE_GET_OPT_H +#include /**/ "ace/pre.h" + +#include "ace/SStringfwd.h" +#include "ace/Containers.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#undef optind +#undef optarg +#undef opterr + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/* + * These definitions are for backward compatibility with previous versions. + * of ACE_Get_Opt. + */ + +/** + * @class ACE_Get_Opt + * + * @brief Iterator for parsing command-line arguments. + * + * This is a C++ wrapper for getopt(3c) and getopt_long(3c). + */ + +class ACE_Export ACE_Get_Opt +{ +public: + /// Mutually exclusive ordering values. + enum + { + /** + * REQUIRE_ORDER means that processing stops and @c EOF is + * returned as soon as a non-option argument is found. @c opt_ind() + * will return the index of the next @a argv element so the program + * can continue processing the rest of the @a argv elements. + */ + REQUIRE_ORDER = 1, + + /** + * PERMUTE_ARGS means the @a argv elements are reordered dynamically + * (permuted) so that all options appear first. When the elements are + * permuted, the order of the options and the following arguments are + * maintained. When the last option has been processed, @c EOF is + * returned and @c opt_ind() returns the index into the next non-option + * element. + */ + PERMUTE_ARGS = 2, + + /** + * RETURN_IN_ORDER means each @a argv element is processed in the + * order is it seen. If the element is not recognized as an option, '1' + * is returned and @c opt_arg() refers to the @a argv element found. + */ + RETURN_IN_ORDER = 3 + }; + + /// Mutually exclusive option argument mode used by long options. + enum OPTION_ARG_MODE + { + /// Doesn't take an argument. + NO_ARG = 0, + + /// Requires an argument, same as passing ":" after a short option + /// character in @a optstring. + ARG_REQUIRED = 1, + + /// Argument is optional, same as passing "::" after a short + /// option character in @a optstring. + ARG_OPTIONAL = 2 + }; + + /** + * Constructor initializes the command line to be parsed. All information + * for parsing must be supplied to this constructor. + * + * @param argc The number of @a argv elements to parse. + * @param argv Command line tokens, such as would be passed + * to @c main(). + * @param optstring Nul-terminated string containing the legitimate + * short option characters. A single colon ":" + * following an option character means the option + * requires an argument. A double colon "::" following + * an option character means the argument is optional. + * The argument is taken from the rest of the current + * @a argv element, or from the following @a argv + * element (only valid for required arguments; + * optional arguments must always reside in the same + * @a argv element). The argument value, if any is + * returned by the @c opt_arg() method. + * @a optstring can be extended by adding long options + * with corresponding short options via the + * @c long_option() method. If the short option + * already appears in @a optstring, the argument + * characteristics must match, otherwise it is added. + * See @c long_option() for more information. + * If 'W', followed by a semi-colon ';' appears in + * @a optstring, then any time a 'W' appears on the + * command line, the following argument is treated as + * a long option. For example, if the command line + * contains "program -W foo", "foo" is treated as a + * long option, that is, as if "program --foo" had + * been passed. + * The following characters can appear in @a optstring + * before any option characters, with the described + * effect: + * - '+' changes the @a ordering to @a REQUIRE_ORDER. + * - '-' changes the @a ordering to @a RETURN_IN_ORDER. + * - ':' changes the return value from @c operator() + * and get_opt() from '?' to ':' when an option + * requires an argument but none is specified. + * + * @param skip_args Optional (default 1). The specified number of + * initial elements in @a argv are skipped before + * parsing begins. Thus, the default prevents + * @a argv[0] (usually the command name) from being + * parsed. @a argc includes all @a argv elements, + * including any skipped elements. + * @param report_errors Optional, if non-zero then parsing errors cause + * an error message to be displayed from the + * @c operator() method before it returns. The + * error message is suppressed if this argument is 0. + * This setting also controls whether or not an error + * message is displayed in @c long_option() encounters + * an error. + * @param ordering Optional (default is @c PERMUTE_ARGS); determines + * how the @a argv elements are processed. This argument + * is overridden by two factors: + * -# The @c POSIXLY_CORRECT environment variable. If + * this environment variable is set, the ordering + * is changed to @c REQUIRE_ORDER. + * -# Leading characters in @a optstring (see above). + * Any leading ordering characters override both + * the @a ordering argument and any effect of the + * @c POSIXLY_CORRECT environment variable. + * @param long_only Optional. If non-zero, then long options can be + * specified using a single '-' on the command line. + * If the token is not a long option, it is processed + * as usual, that is, as a short option or set of + * short options. + * + * Multiple short options can be combined as long as only the last + * one can takes an argument. For example, if @a optstring is defined as + * @c "abc:" or @c "abc::" then the command line @e "program -abcxxx" short + * options @e a, @e b, and @e c are found with @e "xxx" as the argument for + * @e c. + * However, if the command line is specified as @e "program -acb" only + * options @e a and @e c are found with @e "b" as the argument for @e c. + * Also, for options with optional arguments, that is, those followed by + * "::", the argument must be in the same @a argv element, so "program -abc + * xxx" will only find "xxx" as the argument for @e c if @a optstring is + * specified as @c "abc:" not @c "abc::". + */ +#ifndef ACE_USES_WCHAR + ACE_Get_Opt (int argc, + ACE_TCHAR **argv, + const ACE_TCHAR *optstring = ACE_TEXT (""), + int skip_args = 1, + int report_errors = 0, + int ordering = PERMUTE_ARGS, + int long_only = 0); + +#else +private: + void ACE_Get_Opt_Init (const ACE_TCHAR *optstring); +public: + ACE_Get_Opt (int argc, + ACE_TCHAR **argv, + const ACE_TCHAR *optstring = ACE_TEXT (""), + int skip_args = 1, + int report_errors = 0, + int ordering = PERMUTE_ARGS, + int long_only = 0); + ACE_Get_Opt (int argc, + ACE_TCHAR **argv, + const char *optstring, + int skip_args = 1, + int report_errors = 0, + int ordering = PERMUTE_ARGS, + int long_only = 0); +#endif + /// Default dtor. + ~ACE_Get_Opt (void); + + /** + * Scan elements of @a argv (whose length is @a argc) for short option + * characters given in @a optstring or long options (with no short + * option equivalents). + * + * If an element of @a argv starts with '-', and is not exactly "-" + * or "--", then it is a short option element. The characters of this + * element (aside from the initial '-') are option characters. If + * it starts with "--" followed by other characters it is treated as + * a long option. If @c operator() is called repeatedly, it returns + * each of the option characters from each of the option elements. + * + * @return The parsed option character. The following characters have + * special significance. + * @retval 0 A long option was found + * @retval '\?' Either an unknown option character was found, or the + * option is known but requires an argument, none was + * specified, and @a optstring did not contain a leading + * colon. + * @retval ':' A known option character was found but it requires an + * argument and none was supplied, and the first character + * of @a optstring was a colon. @c opt_opt() indicates + * which option was specified. + * @retval '1' @c RETURN_IN_ORDER was specified and a non-option argument + * was found. + * @retval EOF No more option characters were found. @c opt_ind() will + * return the index in @a argv of the first @a argv element + * that is not an option. If @c PERMUTE_ARGS was + * specified, the @a argv elements have been permuted so that + * those that are not options now come last. + * + * @note The standards are unclear with respect to the conditions under + * which '?' and ':' are returned, so we scan the initial characters of + * @a optstring up unto the first short option character for '+', '-', + * and ':' in order to determine ordering and missing argument behavior. + */ + int operator () (void); + + /** + * For communication from @c operator() to the caller. When + * @c operator() finds an option that takes an argument, the argument + * value is returned from this method, otherwise it returns 0. + */ + ACE_TCHAR *opt_arg (void) const; + + /** + * Returns the most recently matched option character. Especially + * useful when operator() returns ':' for an unspecified argument + * that's required, since this allows the caller to learn what option + * was specified without its required argument. + */ + int opt_opt (void); + + /** + * Index in @a argv of the next element to be scanned. This is used + * for communication to and from the caller and for communication + * between successive calls to @c operator(). On entry to + * @c operator(), zero means this is the first call; initialize. + * + * When @c operator() returns @c EOF, this is the index of the first of + * the non-option elements that the caller should itself scan. + * + * Otherwise, @c opt_ind() communicates from one call to the next how + * much of @a argv has been scanned so far. + */ + int &opt_ind (void); + + /// Adds a long option with no corresponding short option. + /** + * If the @a name option is seen, @c operator() returns 0. + * + * @param name The long option to add. + * @param has_arg Defines the argument requirements for + * the new option. + * + * @retval 0 Success + * @retval -1 The long option can not be added. + */ + int long_option (const ACE_TCHAR *name, + OPTION_ARG_MODE has_arg = NO_ARG); + + /// Adds a long option with a corresponding short option. + /** + * @param name The long option to add. + * @param short_option A character, the short option that corresponds + * to @a name. + * @param has_arg Defines the argument requirements for + * the new option. If the short option has already + * been supplied in the @a optstring, @a has_arg + * must match or an error is returned; otherwise, the + * new short option is added to the @a optstring. + * + * @retval 0 Success + * @retval -1 The long option can not be added. + */ + int long_option (const ACE_TCHAR *name, + int short_option, + OPTION_ARG_MODE has_arg = NO_ARG); + + /// Returns the name of the long option found on the last call to + /// @c operator() or 0 if none was found. + const ACE_TCHAR *long_option (void) const; + + /// The number of arguments in the internal @c argv_. + int argc (void) const; + + /// Accessor for the internal @c argv_ pointer. + ACE_TCHAR **argv (void) const; + + /// Accessor for the @c last_option that was processed. This allows + /// applications to know if the found option was a short or long + /// option, and is especially useful in cases where it was invalid + /// and the caller wants to print out the invalid value. + const ACE_TCHAR *last_option (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Return the @a optstring. This is handy to verify that calls to + /// long_option added short options as expected. + const ACE_TCHAR *optstring (void) const; + +public: + /* + * The following five data members should be private, but that + * would break backwards compatibility. However, we recommend not + * writing code that uses these fields directly. + */ + + /// Holds the @a argc count. + /** + * @deprecated This is public for backwards compatibility only. + * It will be made private in a release of ACE past 5.3. Do not + * write code that relies on this member being public; use the + * @c argc() accessor method instead. + */ + int argc_; + + /// Holds the @a argv pointer. + /** + * @deprecated This is public for backwards compatibility only. + * It will be made private in a release of ACE past 5.3. Do not + * write code that relies on this member being public; use the + * @c argv() accessor method instead. + */ + ACE_TCHAR **argv_; + + /// Index in @c argv_ of the next element to be scanned. + /** + * @deprecated This is public for backwards compatibility only. + * It will be made private in a release of ACE past 5.3. Do not + * write code that relies on this member being public; use the + * @c opt_ind() accessor method instead. + */ + int optind; + + /// Callers store zero here to inhibit the error message for + /// unrecognized options. + /** + * @deprecated This is public for backwards compatibility only. + * It will be made private in a release of ACE past 5.3. Do not + * write code that relies on this member being public; use the + * @a report_errors argument to this class's constructor instead. + */ + int opterr; + + /// Points to the option argument when one is found on last call to + /// @c operator(). + /** + * @deprecated This is public for backwards compatibility only. + * It will be made private in a release of ACE past 5.3. Do not + * write code that relies on this member being public; use the + * @c opt_arg() accessor method instead. + */ + ACE_TCHAR *optarg; + +private: + /** + * @class ACE_Get_Opt_Long_Option This class is for internal use + * in the ACE_Get_Opt class, and is inaccessible to users. + */ + class ACE_Get_Opt_Long_Option + { + public: + /// ctor + ACE_Get_Opt_Long_Option (const ACE_TCHAR *name, + int has_arg, + int val = 0); + + /// Dtor. + ~ACE_Get_Opt_Long_Option (void); + + bool operator < (const ACE_Get_Opt_Long_Option &rhs); + + /// Long option name. + const ACE_TCHAR *name_; + + /// Contains value for . + int has_arg_; + + /// Contains a valid short option character or zero if it doesn't + /// have a corresponding short option. It can also contain a + /// non-printable value that cannot be passed to but + /// will be returned by . This is handy for + /// simplifying long option handling, see tests/Get_Opt_Test.cpp + /// for an example of this technique. + int val_; + }; + + /// Updates nextchar_. + int nextchar_i (void); + + /// Handles long options. + int long_option_i (void); + + /// Handles short options. + int short_option_i (void); + + /// If permuting args, this functions manages the nonopt_start_ and + /// nonopt_end_ indexes and makes calls to permute to actually + /// reorder the -elements. + void permute_args (void); + + /// Handles reordering -elements. + int permute (void); + + /// Set last_option. + void last_option (const ACE_TString &s); + + // Disallow copying and assignment. + ACE_Get_Opt (const ACE_Get_Opt &); + ACE_Get_Opt &operator= (const ACE_Get_Opt &); + +private: + + /// Holds the option string. + ACE_TString *optstring_; + + /// Treat all options as long options. + int long_only_; + + /// Keeps track of whether or not a colon was passed in . + /// This is used to determine the return value when required + /// arguments are missing. + int has_colon_; + + /// This is the last option, short or long, that was processed. This + /// is handy to have in cases where the option passed was invalid. + ACE_TString *last_option_; + + /** + * The next char to be scanned in the option-element in which the + * last option character we returned was found. This allows us to + * pick up the scan where we left off * + * If this is zero, or a null string, it means resume the scan + * by advancing to the next -element. + */ + ACE_TCHAR *nextchar_; + + /// Most recently matched short option character. + int optopt_; + + /// Keeps track of ordering mode (default ). + int ordering_; + + /// Index of the first non-option -element found (only valid + /// when permuting). + int nonopt_start_; + + /// Index of the -element following the last non-option element + /// (only valid when permuting). + int nonopt_end_; + + /// Points to the long_option found on last call to . + ACE_Get_Opt_Long_Option *long_option_; + + /// Array of long options. + ACE_Array long_opts_; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Get_Opt.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_GET_OPT_H */ diff --git a/externals/ace/Get_Opt.inl b/externals/ace/Get_Opt.inl new file mode 100644 index 0000000..e307fb5 --- /dev/null +++ b/externals/ace/Get_Opt.inl @@ -0,0 +1,97 @@ +// -*- C++ -*- +// +// $Id: Get_Opt.inl 81840 2008-06-05 13:46:45Z sma $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE bool +ACE_Get_Opt::ACE_Get_Opt_Long_Option::operator < (const ACE_Get_Opt_Long_Option &rhs) +{ + return this->name_ < rhs.name_; +} + +ACE_INLINE int +ACE_Get_Opt::argc (void) const +{ + return this->argc_; +} + +ACE_INLINE ACE_TCHAR ** +ACE_Get_Opt::argv (void) const +{ + return this->argv_; +} + +ACE_INLINE ACE_TCHAR* +ACE_Get_Opt::opt_arg (void) const +{ + return this->optarg; +} + +ACE_INLINE int +ACE_Get_Opt::opt_opt (void) +{ + return this->optopt_; +} + +ACE_INLINE int & +ACE_Get_Opt::opt_ind (void) +{ + return this->optind; +} + +#ifdef ACE_USES_WCHAR +ACE_INLINE ACE_Get_Opt::ACE_Get_Opt (int argc, + ACE_TCHAR **argv, + const ACE_TCHAR *optstring, + int skip_args, + int report_errors, + int ordering, + int long_only) + : argc_ (argc), + argv_ (argv), + optind (skip_args), + opterr (report_errors), + optarg (0), + optstring_ (0), + long_only_ (long_only), + has_colon_ (0), + last_option_ (0), + nextchar_ (0), + optopt_ (0), + ordering_ (ordering), + nonopt_start_ (optind), + nonopt_end_ (optind), + long_option_ (0) +{ + ACE_Get_Opt_Init (optstring); +} + +ACE_INLINE ACE_Get_Opt::ACE_Get_Opt (int argc, + ACE_TCHAR **argv, + const char *optstring, + int skip_args, + int report_errors, + int ordering, + int long_only) + : argc_ (argc), + argv_ (argv), + optind (skip_args), + opterr (report_errors), + optarg (0), + optstring_ (), + long_only_ (long_only), + has_colon_ (0), + last_option_ (0), + nextchar_ (0), + optopt_ (0), + ordering_ (ordering), + nonopt_start_ (optind), + nonopt_end_ (optind), + long_option_ (0) +{ + ACE_Get_Opt_Init (ACE_TEXT_CHAR_TO_TCHAR (optstring)); +} +#endif + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Global_Macros.h b/externals/ace/Global_Macros.h new file mode 100644 index 0000000..d1bf642 --- /dev/null +++ b/externals/ace/Global_Macros.h @@ -0,0 +1,1121 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Global_Macros.h + * + * $Id: Global_Macros.h 82442 2008-07-28 13:11:29Z johnnyw $ + * + * @author Douglas C. Schmidt + * @author Jesper S. M|ller + * @author and a cast of thousands... + * + * This one is split from the famous OS.h + */ +//============================================================================= + +#ifndef ACE_GLOBAL_MACROS_H +#define ACE_GLOBAL_MACROS_H + +#include /**/ "ace/pre.h" + +// Included just keep compilers that see #pragma dierctive first +// happy. +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/config-lite.h" +#include "ace/Assert.h" // For ACE_ASSERT + +// Start Global Macros +# define ACE_BEGIN_DUMP ACE_TEXT ("\n====\n(%P|%t|%x)\n") +# define ACE_END_DUMP ACE_TEXT ("====\n") + +# if defined (ACE_NDEBUG) +# define ACE_DB(X) +# else +# define ACE_DB(X) X +# endif /* ACE_NDEBUG */ + +// ACE_NO_HEAP_CHECK macro can be used to suppress false report of +// memory leaks. It turns off the built-in heap checking until the +// block is left. The old state will then be restored Only used for +// Win32 (in the moment). +# if defined (ACE_WIN32) + +# if defined (_DEBUG) && !defined (ACE_HAS_WINCE) && !defined (__BORLANDC__) +# include /**/ + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Export ACE_No_Heap_Check +{ +public: + ACE_No_Heap_Check (void) + : old_state (_CrtSetDbgFlag (_CRTDBG_REPORT_FLAG)) + { _CrtSetDbgFlag (old_state & ~_CRTDBG_ALLOC_MEM_DF);} + ~ACE_No_Heap_Check (void) { _CrtSetDbgFlag (old_state);} +private: + int old_state; +}; + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +# define ACE_NO_HEAP_CHECK ACE_No_Heap_Check ____no_heap; +# else /* !_DEBUG */ +# define ACE_NO_HEAP_CHECK +# endif /* _DEBUG */ +# else /* !ACE_WIN32 */ +# define ACE_NO_HEAP_CHECK +# endif /* ACE_WIN32 */ + +// Turn a number into a string. +# define ACE_ITOA(X) #X + +// Create a string of a server address with a "host:port" format. +# define ACE_SERVER_ADDRESS(H,P) H ACE_TEXT(":") P + +// A couple useful inline functions for checking whether bits are +// enabled or disabled. + +// Efficiently returns the least power of two >= X... +# define ACE_POW(X) (((X) == 0)?1:(X-=1,X|=X>>1,X|=X>>2,X|=X>>4,X|=X>>8,X|=X>>16,(++X))) +# define ACE_EVEN(NUM) (((NUM) & 1) == 0) +# define ACE_ODD(NUM) (((NUM) & 1) == 1) +# define ACE_BIT_ENABLED(WORD, BIT) (((WORD) & (BIT)) != 0) +# define ACE_BIT_DISABLED(WORD, BIT) (((WORD) & (BIT)) == 0) +# define ACE_BIT_CMP_MASK(WORD, BIT, MASK) (((WORD) & (BIT)) == MASK) +# define ACE_SET_BITS(WORD, BITS) (WORD |= (BITS)) +# define ACE_CLR_BITS(WORD, BITS) (WORD &= ~(BITS)) + +# if !defined (ACE_ENDLESS_LOOP) +# define ACE_ENDLESS_LOOP +# endif /* ! ACE_ENDLESS_LOOP */ + +# if defined (ACE_NEEDS_FUNC_DEFINITIONS) + // It just evaporated ;-) Not pleasant. +# define ACE_UNIMPLEMENTED_FUNC(f) +# else +# define ACE_UNIMPLEMENTED_FUNC(f) f; +# endif /* ACE_NEEDS_FUNC_DEFINITIONS */ + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + // Easy way to designate that a class is used as a pseudo-namespace. + // Insures that g++ "friendship" anamolies are properly handled. + # define ACE_CLASS_IS_NAMESPACE(CLASSNAME) \ + private: \ + CLASSNAME (void); \ + CLASSNAME (const CLASSNAME&); \ + friend class ace_dewarn_gplusplus +#endif /* ACE_LACKS_DEPRECATED_MACROS */ + +// ---------------------------------------------------------------- + +//FUZZ: disable check_for_exception_sepc +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + #if defined (ACE_HAS_NO_THROW_SPEC) + # define ACE_THROW_SPEC(X) + #else + # if defined (ACE_HAS_EXCEPTIONS) + # if defined (ACE_WIN32) && defined (_MSC_VER) && \ + (_MSC_VER >= 1400) && (_MSC_VER <= 1500) + # define ACE_THROW_SPEC(X) throw(...) + # else + # define ACE_THROW_SPEC(X) throw X + # endif /* ACE_WIN32 && VC8 */ + # else /* ! ACE_HAS_EXCEPTIONS */ + # define ACE_THROW_SPEC(X) + # endif /* ! ACE_HAS_EXCEPTIONS */ + #endif /*ACE_HAS_NO_THROW_SPEC*/ +#endif /* ACE_LACKS_DEPRECATED_MACROS */ +//FUZZ: enable check_for_exception_sepc + +// ---------------------------------------------------------------- + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + /** + * This macro is deprecated + */ + #define ACE_NESTED_CLASS(TYPE, NAME) TYPE::NAME +#endif /* ACE_LACKS_DEPRECATED_MACROS */ + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + /** + * @name CORBA namespace macros. + * + * CORBA namespace macros. + * + * @deprecated These macros were formerly used by TAO but are now + * deprecated, and only remain to retain some backward + * compatibility. They will be removed in a future ACE + * release. + */ + //@{ + #define ACE_CORBA_1(NAME) CORBA::NAME + #define ACE_CORBA_2(TYPE, NAME) CORBA::TYPE::NAME + #define ACE_CORBA_3(TYPE, NAME) CORBA::TYPE::NAME + //@} +#endif /* ACE_LACKS_DEPRECATED_MACROS */ + +// ---------------------------------------------------------------- + +// Convenient macro for testing for deadlock, as well as for detecting +// when mutexes fail. +#define ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ACTION, REACTION) \ + ACE_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () != 0) { ACTION; } \ + else { REACTION; } +#define ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, REACTION) \ + ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ;, REACTION) +#define ACE_GUARD(MUTEX, OBJ, LOCK) \ + ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return) +#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN) \ + ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return RETURN) +# define ACE_WRITE_GUARD(MUTEX,OBJ,LOCK) \ + ACE_Write_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return; +# define ACE_WRITE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ + ACE_Write_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return RETURN; +# define ACE_READ_GUARD(MUTEX,OBJ,LOCK) \ + ACE_Read_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return; +# define ACE_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ + ACE_Read_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return RETURN; + +// ---------------------------------------------------------------- + +# define ACE_DES_NOFREE(POINTER,CLASS) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~CLASS (); \ + } \ + } \ + while (0) + +# define ACE_DES_ARRAY_NOFREE(POINTER,SIZE,CLASS) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + (&(POINTER)[i])->~CLASS (); \ + } \ + } \ + } \ + while (0) + +# define ACE_DES_FREE(POINTER,DEALLOCATOR,CLASS) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) + +# define ACE_DES_ARRAY_FREE(POINTER,SIZE,DEALLOCATOR,CLASS) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + (&(POINTER)[i])->~CLASS (); \ + } \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) + +# if defined (ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR) +# define ACE_DES_NOFREE_TEMPLATE(POINTER,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + } \ + } \ + while (0) +# define ACE_DES_ARRAY_NOFREE_TEMPLATE(POINTER,SIZE,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + (&(POINTER)[i])->~T_CLASS (); \ + } \ + } \ + } \ + while (0) + +#if defined (ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) +# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS T_PARAMETER (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#else +# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */ +# define ACE_DES_ARRAY_FREE_TEMPLATE(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + (&(POINTER)[i])->~T_CLASS (); \ + } \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#if defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) +# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#else +# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */ +#if defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) +# define ACE_DES_FREE_TEMPLATE3(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#else +# define ACE_DES_FREE_TEMPLATE3(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */ +#if defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) +# define ACE_DES_FREE_TEMPLATE4(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3, T_PARAM4) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#else +# define ACE_DES_FREE_TEMPLATE4(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3, T_PARAM4) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +#endif /* defined(ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS) */ +# define ACE_DES_ARRAY_FREE_TEMPLATE2(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + (&(POINTER)[i])->~T_CLASS (); \ + } \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +# else /* ! ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR */ +# define ACE_DES_NOFREE_TEMPLATE(POINTER,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + (POINTER)->T_CLASS T_PARAMETER::~T_CLASS (); \ + } \ + } \ + while (0) +# define ACE_DES_ARRAY_NOFREE_TEMPLATE(POINTER,SIZE,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + (POINTER)[i].T_CLASS T_PARAMETER::~T_CLASS (); \ + } \ + } \ + } \ + while (0) +# define ACE_DES_FREE_TEMPLATE(POINTER,DEALLOCATOR,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + POINTER->T_CLASS T_PARAMETER::~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +# define ACE_DES_ARRAY_FREE_TEMPLATE(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAMETER) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + POINTER[i].T_CLASS T_PARAMETER::~T_CLASS (); \ + } \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +# define ACE_DES_FREE_TEMPLATE2(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ + do { \ + if (POINTER) \ + { \ + POINTER->T_CLASS ::~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +# define ACE_DES_FREE_TEMPLATE3(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3) \ + do { \ + if (POINTER) \ + { \ + POINTER->T_CLASS ::~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +# define ACE_DES_FREE_TEMPLATE4(POINTER,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2,T_PARAM3,T_PARAM4) \ + do { \ + if (POINTER) \ + { \ + POINTER->T_CLASS ::~T_CLASS (); \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +# define ACE_DES_ARRAY_FREE_TEMPLATE2(POINTER,SIZE,DEALLOCATOR,T_CLASS,T_PARAM1,T_PARAM2) \ + do { \ + if (POINTER) \ + { \ + for (size_t i = 0; \ + i < SIZE; \ + ++i) \ + { \ + POINTER[i].T_CLASS ::~T_CLASS (); \ + } \ + DEALLOCATOR (POINTER); \ + } \ + } \ + while (0) +# endif /* defined ! ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR */ + + +/*******************************************************************/ + +/// Service Objects, i.e., objects dynamically loaded via the service +/// configurator, must provide a destructor function with the +/// following prototype to perform object cleanup. +typedef void (*ACE_Service_Object_Exterminator)(void *); + +/** @name Service Configurator macros + * + * The following macros are used to define helper objects used in + * ACE's Service Configurator framework, which is described in + * Chapter 5 of C++NPv2 . This + * framework implements the Component Configurator pattern, which is + * described in Chapter 2 of POSA2 . + * The intent of this pattern is to allow developers to dynamically + * load and configure services into a system. With a little help from + * this macros statically linked services can also be dynamically + * configured. + * + * More details about this component are available in the documentation + * of the ACE_Service_Configurator class and also + * ACE_Dynamic_Service. + * + * Notice that in all the macros the SERVICE_CLASS parameter must be + * the name of a class derived from ACE_Service_Object. + */ +//@{ +/// Declare a the data structure required to register a statically +/// linked service into the service configurator. +/** + * The macro should be used in the header file where the service is + * declared, its only argument is usually the name of the class that + * implements the service. + * + * @param SERVICE_CLASS The name of the class implementing the + * service. + */ +# define ACE_STATIC_SVC_DECLARE(SERVICE_CLASS) \ +extern ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS ; + +/// As ACE_STATIC_SVC_DECLARE, but using an export macro for NT +/// compilers. +/** + * NT compilers require the use of explicit directives to export and + * import symbols from a DLL. If you need to define a service in a + * dynamic library you should use this version instead. + * Normally ACE uses a macro to inject the correct export/import + * directives on NT. Naturally it also the macro expands to a blank + * on platforms that do not require such directives. + * The first argument (EXPORT_NAME) is the prefix for this export + * macro, the full name is formed by appending _Export. + * ACE provides tools to generate header files that define the macro + * correctly on all platforms, please see + * $ACE_ROOT/bin/generate_export_file.pl + * + * @param EXPORT_NAME The export macro name prefix. + * @param SERVICE_CLASS The name of the class implementing the service. + */ +#define ACE_STATIC_SVC_DECLARE_EXPORT(EXPORT_NAME,SERVICE_CLASS) \ +extern EXPORT_NAME##_Export ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS; + +/// Define the data structure used to register a statically linked +/// service into the Service Configurator. +/** + * The service configurator requires several arguments to build and + * control an statically linked service, including its name, the + * factory function used to construct the service, and some flags. + * All those parameters are configured in a single structure, an + * instance of this structure is statically initialized using the + * following macro. + * + * @param SERVICE_CLASS The name of the class that implements the + * service, must be derived (directly or indirectly) from + * ACE_Service_Object. + * @param NAME The name for this service, this name is used by the + * service configurator to match configuration options provided in + * the svc.conf file. + * @param TYPE The type of object. Objects can be streams or service + * objects. Please read the ACE_Service_Configurator and ASX + * documentation for more details. + * @param FN The name of the factory function, usually the + * ACE_SVC_NAME macro can be used to generate the name. The + * factory function is often defined using ACE_FACTORY_DECLARE and + * ACE_FACTORY_DEFINE. + * @param FLAGS Flags to control the ownership and lifecycle of the + * object. Please read the ACE_Service_Configurator documentation + * for more details. + * @param ACTIVE If not zero then a thread will be dedicate to the + * service. Please read the ACE_Service_Configurator documentation + * for more details. + */ +# define ACE_STATIC_SVC_DEFINE(SERVICE_CLASS, NAME, TYPE, FN, FLAGS, ACTIVE) \ +ACE_Static_Svc_Descriptor ace_svc_desc_##SERVICE_CLASS = { NAME, TYPE, FN, FLAGS, ACTIVE }; + +/// Automatically register a service with the service configurator +/** + * In some applications the services must be automatically registered + * with the service configurator, before main() starts. + * The ACE_STATIC_SVC_REQUIRE macro defines a class whose constructor + * register the service, it also defines a static instance of that + * class to ensure that the service is registered before main. + * + * On platforms that lack adequate support for static C++ objects the + * macro ACE_STATIC_SVC_REGISTER can be used to explicitly register + * the service. + * + * @todo One class per-Service_Object seems wasteful. It should be + * possible to define a single class and re-use it for all the + * service objects, just by passing the Service_Descriptor as an + * argument to the constructor. + */ +#if defined(ACE_LACKS_STATIC_CONSTRUCTORS) +# define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\ +class ACE_Static_Svc_##SERVICE_CLASS {\ +public:\ + ACE_Static_Svc_##SERVICE_CLASS() { \ + ACE_Service_Config::insert (\ + &ace_svc_desc_##SERVICE_CLASS); \ + } \ +}; +#define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS)\ +ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS + +#else /* !ACE_LACKS_STATIC_CONSTRUCTORS */ + +# define ACE_STATIC_SVC_REQUIRE(SERVICE_CLASS)\ +class ACE_Static_Svc_##SERVICE_CLASS {\ +public:\ + ACE_Static_Svc_##SERVICE_CLASS() { \ + ACE_Service_Config::insert (\ + &ace_svc_desc_##SERVICE_CLASS); \ + } \ +};\ +static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS; +#define ACE_STATIC_SVC_REGISTER(SERVICE_CLASS) do {} while (0) + +#endif /* !ACE_LACKS_STATIC_CONSTRUCTORS */ + +// Preprocessor symbols will not be expanded if they are +// concatenated. Force the preprocessor to expand them during the +// argument prescan by calling a macro that itself calls another that +// performs the actual concatenation. +#define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B +#define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B) + +#if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1 +// Preprocessor symbols will not be expanded if they are +// concatenated. Force the preprocessor to expand them during the +// argument prescan by calling a macro that itself calls another that +// performs the actual concatenation. +# define ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(PREFIX,VERSIONED_NAMESPACE,SERVICE_CLASS) PREFIX ## _ ## VERSIONED_NAMESPACE ## _ ## SERVICE_CLASS +#else +# define ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(PREFIX,VERSIONED_NAMESPACE,SERVICE_CLASS) PREFIX ## _ ## SERVICE_CLASS +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + +#define ACE_MAKE_SVC_CONFIG_FACTORY_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_make,VERSIONED_NAMESPACE,SERVICE_CLASS) +#define ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_gobble,VERSIONED_NAMESPACE,SERVICE_CLASS) + + +/// Declare the factory method used to create dynamically loadable +/// services. +/** + * Once the service implementation is dynamically loaded the Service + * Configurator uses a factory method to create the object. + * This macro declares such a factory function with the proper + * interface and export macros. + * Normally used in the header file that declares the service + * implementation. + * + * @param CLS must match the prefix of the export macro used for this + * service. + * @param SERVICE_CLASS must match the name of the class that + * implements the service. + * + */ +# define ACE_FACTORY_DECLARE(CLS,SERVICE_CLASS) \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * \ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *); + +/// Define the factory method (and destructor) for a dynamically +/// loadable service. +/** + * Use with arguments matching ACE_FACTORY_DECLARE. + * Normally used in the .cpp file that defines the service + * implementation. + * + * This macro defines both the factory method and the function used to + * cleanup the service object. + * + * If this macro is used to define a factory function that need not be + * exported (for example, in a static service situation), CLS can be + * specified as ACE_Local_Service. + */ +# define ACE_Local_Service_Export + +#if defined (ACE_OPENVMS) +# define ACE_PREPROC_STRINGIFY(A) #A +# define ACE_MAKE_SVC_REGISTRAR_ARG(A) ACE_PREPROC_STRINGIFY(A), (void*)&A +# define ACE_FACTORY_DEFINE(CLS,SERVICE_CLASS) \ +void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \ + static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \ + ACE_ASSERT (_p != 0); \ + delete _p; } \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \ +{ \ + ACE_TRACE (#SERVICE_CLASS); \ + if (gobbler != 0) \ + *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \ + return new SERVICE_CLASS; \ +} \ +ACE_Dynamic_Svc_Registrar ace_svc_reg_##SERVICE_CLASS \ + (ACE_MAKE_SVC_REGISTRAR_ARG(ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS))); +#else +# define ACE_FACTORY_DEFINE(CLS,SERVICE_CLASS) \ +void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \ + static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \ + ACE_ASSERT (_p != 0); \ + delete _p; } \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \ +{ \ + ACE_TRACE (#SERVICE_CLASS); \ + if (gobbler != 0) \ + *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \ + return new SERVICE_CLASS; \ +} +#endif + +/** + * For service classes scoped within namespaces, use this macro in + * place of ACE_FACTORY_DEFINE. The third argument in this case is + * the fully scoped name of the class as it is to be + * instantiated. For example, given: + * namespace ACE + * { + * namespace Foo + * { + * class Bar : public ACE_Service_Object + * {}; + * }; + * }; + * + * ACE_FACTORY_DECLARE(ACE,ACE_Foo_Bar) + * + * you would then use: + * + * ACE_FACTORY_NAMESPACE_DEFINE(ACE,ACE_Foo_Bar,ACE::Foo::Bar) + * + * Note that in this example, the ACE_FACTORY_DECLARE is done outside + * the namespace scope. Then, the SERVICE_CLASS name is the same as + * the fully scoped class name, but with '::' replaced with '_'. Doing + * this will ensure unique generated signatures for the various C + * style functions. + */ +#if defined (ACE_OPENVMS) +# define ACE_PREPROC_STRINGIFY(A) #A +# define ACE_MAKE_SVC_REGISTRAR_ARG(A) ACE_PREPROC_STRINGIFY(A), (void*)&A +# define ACE_FACTORY_NAMESPACE_DEFINE(CLS,SERVICE_CLASS,NAMESPACE_CLASS) \ +void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \ + static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \ + ACE_ASSERT (_p != 0); \ + delete _p; } \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \ +{ \ + ACE_TRACE (#SERVICE_CLASS); \ + if (gobbler != 0) \ + *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \ + return new NAMESPACE_CLASS; \ +} \ +ACE_Dynamic_Svc_Registrar ace_svc_reg_##SERVICE_CLASS \ + (ACE_MAKE_SVC_REGISTRAR_ARG(ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS))); +#else +# define ACE_FACTORY_NAMESPACE_DEFINE(CLS,SERVICE_CLASS,NAMESPACE_CLASS) \ +void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \ + static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \ + ACE_ASSERT (_p != 0); \ + delete _p; } \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \ +{ \ + ACE_TRACE (#SERVICE_CLASS); \ + if (gobbler != 0) \ + *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \ + return new NAMESPACE_CLASS; \ +} +#endif + +/// The canonical name for a service factory method +# define ACE_SVC_NAME(SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) + +/// The canonical way to invoke (i.e. construct) a service factory +/// method. +#define ACE_SVC_INVOKE(SERVICE_CLASS) ACE_SVC_NAME(SERVICE_CLASS) (0) + +//@} + +/** @name Helper macros for services defined in the netsvcs library. + * + * The ACE services defined in netsvcs use this helper macros for + * simplicity. + * + */ +//@{ +# define ACE_SVC_FACTORY_DECLARE(X) ACE_FACTORY_DECLARE (ACE_Svc, X) +# define ACE_SVC_FACTORY_DEFINE(X) ACE_FACTORY_DEFINE (ACE_Svc, X) +//@} + +#if defined (ACE_WIN32) +// These are used in SPIPE_Acceptor/Connector, but are ignored at runtime. +# if defined (ACE_HAS_WINCE) +# if !defined (PIPE_TYPE_MESSAGE) +# define PIPE_TYPE_MESSAGE 0 +# endif +# if !defined (PIPE_READMODE_MESSAGE) +# define PIPE_READMODE_MESSAGE 0 +# endif +# if !defined (PIPE_WAIT) +# define PIPE_WAIT 0 +# endif +# endif /* ACE_HAS_WINCE */ +#else /* !ACE_WIN32 */ +// Add some typedefs and macros to enhance Win32 conformance... +# if !defined (LPSECURITY_ATTRIBUTES) +# define LPSECURITY_ATTRIBUTES int +# endif /* !defined LPSECURITY_ATTRIBUTES */ +# if !defined (GENERIC_READ) +# define GENERIC_READ 0 +# endif /* !defined GENERIC_READ */ +# if !defined (FILE_SHARE_READ) +# define FILE_SHARE_READ 0 +# endif /* !defined FILE_SHARE_READ */ +# if !defined (OPEN_EXISTING) +# define OPEN_EXISTING 0 +# endif /* !defined OPEN_EXISTING */ +# if !defined (FILE_ATTRIBUTE_NORMAL) +# define FILE_ATTRIBUTE_NORMAL 0 +# endif /* !defined FILE_ATTRIBUTE_NORMAL */ +# if !defined (MAXIMUM_WAIT_OBJECTS) +# define MAXIMUM_WAIT_OBJECTS 0 +# endif /* !defined MAXIMUM_WAIT_OBJECTS */ +# if !defined (FILE_FLAG_OVERLAPPED) +# define FILE_FLAG_OVERLAPPED 0 +# endif /* !defined FILE_FLAG_OVERLAPPED */ +# if !defined (FILE_FLAG_SEQUENTIAL_SCAN) +# define FILE_FLAG_SEQUENTIAL_SCAN 0 +# endif /* FILE_FLAG_SEQUENTIAL_SCAN */ +# if !defined(FILE_FLAG_WRITE_THROUGH) +# define FILE_FLAG_WRITE_THROUGH 0 +# endif /* !defined FILE_FLAG_WRITE_THROUGH */ +# if !defined(PIPE_WAIT) +# define PIPE_WAIT 0 +# endif /* !defined PIPE_WAIT */ +# if !defined(PIPE_NOWAIT) +# define PIPE_NOWAIT 0 +# endif /* !defined PIPE_WAIT */ +# if !defined(PIPE_READMODE_BYTE) +# define PIPE_READMODE_BYTE 0 +# endif /* !defined PIPE_READMODE_BYTE */ +# if !defined(PIPE_READMODE_MESSAGE) +# define PIPE_READMODE_MESSAGE 0 +# endif /* !defined PIPE_READMODE_MESSAGE */ +# if !defined(PIPE_TYPE_BYTE) +# define PIPE_TYPE_BYTE 0 +# endif /* !defined PIPE_TYPE_BYTE */ +# if !defined(PIPE_TYPE_MESSAGE) +# define PIPE_TYPE_MESSAGE 0 +# endif /* !defined PIPE_TYPE_MESSAGE */ +#endif /* ACE_WIN32 */ + + +// Some useful abstrations for expressions involving +// ACE_Allocator.malloc (). The difference between ACE_NEW_MALLOC* +// with ACE_ALLOCATOR* is that they call constructors also. + +#include "ace/OS_Errno.h" /* Need errno and ENOMEM */ + +# define ACE_ALLOCATOR_RETURN(POINTER,ALLOCATOR,RET_VAL) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ + } while (0) +# define ACE_ALLOCATOR(POINTER,ALLOCATOR) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return; } \ + } while (0) +# define ACE_ALLOCATOR_NORETURN(POINTER,ALLOCATOR) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; } \ + } while (0) + +# define ACE_NEW_MALLOC_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,RET_VAL) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \ + else { (void) new (POINTER) CONSTRUCTOR; } \ + } while (0) +# define ACE_NEW_MALLOC(POINTER,ALLOCATOR,CONSTRUCTOR) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return;} \ + else { (void) new (POINTER) CONSTRUCTOR; } \ + } while (0) +# define ACE_NEW_MALLOC_NORETURN(POINTER,ALLOCATOR,CONSTRUCTOR) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM;} \ + else { (void) new (POINTER) CONSTRUCTOR; } \ + } while (0) + +/* ACE_Metrics */ +#if defined ACE_LACKS_ARRAY_PLACEMENT_NEW +# define ACE_NEW_MALLOC_ARRAY_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT,RET_VAL) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \ + else { for (u_int i = 0; i < COUNT; ++i) \ + {(void) new (POINTER) CONSTRUCTOR; ++POINTER;} \ + POINTER -= COUNT;} \ + } while (0) +# define ACE_NEW_MALLOC_ARRAY(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return;} \ + else { for (u_int i = 0; i < COUNT; ++i) \ + {(void) new (POINTER) CONSTRUCTOR; ++POINTER;} \ + POINTER -= COUNT;} \ + } while (0) +#else /* ! defined ACE_LACKS_ARRAY_PLACEMENT_NEW */ +# define ACE_NEW_MALLOC_ARRAY_RETURN(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT,RET_VAL) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return RET_VAL;} \ + else { (void) new (POINTER) CONSTRUCTOR [COUNT]; } \ + } while (0) +# define ACE_NEW_MALLOC_ARRAY(POINTER,ALLOCATOR,CONSTRUCTOR,COUNT) \ + do { POINTER = ALLOCATOR; \ + if (POINTER == 0) { errno = ENOMEM; return;} \ + else { (void) new (POINTER) CONSTRUCTOR [COUNT]; } \ + } while (0) +#endif /* defined ACE_LACKS_ARRAY_PLACEMENT_NEW */ + +// This is being placed here temporarily to help stablelize the builds, but will +// be moved out along with the above macros as part of the subsetting. dhinton +#if !defined (ACE_LACKS_NEW_H) +# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# include /**/ +# else +# include /**/ +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ +#endif /* ! ACE_LACKS_NEW_H */ + +# define ACE_NOOP(x) + +#if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) +# define ACE_SEH_TRY __try +# define ACE_SEH_EXCEPT(X) __except(X) +# define ACE_SEH_FINALLY __finally +#else /* !ACE_WIN32 */ +# define ACE_SEH_TRY if (1) +# define ACE_SEH_EXCEPT(X) while (0) +# define ACE_SEH_FINALLY if (1) +#endif /* ACE_WIN32 */ + +// These should probably be put into a seperate header. + +// The following is necessary since many C++ compilers don't support +// typedef'd types inside of classes used as formal template +// arguments... ;-(. Luckily, using the C++ preprocessor I can hide +// most of this nastiness! + +# if defined (ACE_HAS_TEMPLATE_TYPEDEFS) + +// Handle ACE_Message_Queue. +# define ACE_SYNCH_DECL class _ACE_SYNCH +# define ACE_SYNCH_USE _ACE_SYNCH +# define ACE_SYNCH_MUTEX_T typename _ACE_SYNCH::MUTEX +# define ACE_SYNCH_CONDITION_T typename _ACE_SYNCH::CONDITION +# define ACE_SYNCH_SEMAPHORE_T typename _ACE_SYNCH::SEMAPHORE + +// Handle ACE_Malloc* +# define ACE_MEM_POOL_1 class _ACE_MEM_POOL +# define ACE_MEM_POOL_2 _ACE_MEM_POOL +# define ACE_MEM_POOL _ACE_MEM_POOL +# define ACE_MEM_POOL_OPTIONS typename _ACE_MEM_POOL::OPTIONS + +// Handle ACE_Svc_Handler +# define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM +# define ACE_PEER_STREAM_2 _ACE_PEER_STREAM +# define ACE_PEER_STREAM _ACE_PEER_STREAM +# define ACE_PEER_STREAM_ADDR typename _ACE_PEER_STREAM::PEER_ADDR + +// Handle ACE_Acceptor +# define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR +# define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR +# define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR +# define ACE_PEER_ACCEPTOR_ADDR typename _ACE_PEER_ACCEPTOR::PEER_ADDR + +// Handle ACE_Connector +# define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR +# define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR +# define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR +# define ACE_PEER_CONNECTOR_ADDR typename ACE_PEER_CONNECTOR::PEER_ADDR +# define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_ADDR_TYPEDEF::sap_any + +// Handle ACE_SOCK_* +# define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor +# define ACE_SOCK_CONNECTOR ACE_SOCK_Connector +# define ACE_SOCK_STREAM ACE_SOCK_Stream +# define ACE_SOCK_DGRAM ACE_SOCK_Dgram +# define ACE_SOCK_DGRAM_BCAST ACE_SOCK_Dgram_Bcast +# define ACE_SOCK_DGRAM_MCAST ACE_SOCK_Dgram_Mcast + +// Handle ACE_SOCK_SEQPACK_* +# define ACE_SOCK_SEQPACK_ACCEPTOR ACE_SOCK_SEQPACK_Acceptor +# define ACE_SOCK_SEQPACK_CONNECTOR ACE_SOCK_SEQPACK_Connector +# define ACE_SOCK_SEQPACK_ASSOCIATION ACE_SOCK_SEQPACK_Association + +// Handle ACE_MEM_* +# define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor +# define ACE_MEM_CONNECTOR ACE_MEM_Connector +# define ACE_MEM_STREAM ACE_MEM_Stream + +// Handle ACE_LSOCK_* +# define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor +# define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector +# define ACE_LSOCK_STREAM ACE_LSOCK_Stream + +// Handle ACE_TLI_* +# define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor +# define ACE_TLI_CONNECTOR ACE_TLI_Connector +# define ACE_TLI_STREAM ACE_TLI_Stream + +// Handle ACE_SPIPE_* +# define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor +# define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector +# define ACE_SPIPE_STREAM ACE_SPIPE_Stream + +// Handle ACE_UPIPE_* +# define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor +# define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector +# define ACE_UPIPE_STREAM ACE_UPIPE_Stream + +// Handle ACE_FILE_* +# define ACE_FILE_CONNECTOR ACE_FILE_Connector +# define ACE_FILE_STREAM ACE_FILE_IO + +// Handle ACE_*_Memory_Pool. +# define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool +# define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool +# define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool +# define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool +# define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool +# define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool + +# else /* TEMPLATES are broken in some form or another (i.e., most C++ compilers) */ + +// Handle ACE_Message_Queue. +# if defined (ACE_HAS_OPTIMIZED_MESSAGE_QUEUE) +# define ACE_SYNCH_DECL class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T, class _ACE_SYNCH_SEMAPHORE_T +# define ACE_SYNCH_USE _ACE_SYNCH_MUTEX_T, _ACE_SYNCH_CONDITION_T, _ACE_SYNCH_SEMAPHORE_T +# else +# define ACE_SYNCH_DECL class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T +# define ACE_SYNCH_USE _ACE_SYNCH_MUTEX_T, _ACE_SYNCH_CONDITION_T +# endif /* ACE_HAS_OPTIMIZED_MESSAGE_QUEUE */ +# define ACE_SYNCH_MUTEX_T _ACE_SYNCH_MUTEX_T +# define ACE_SYNCH_CONDITION_T _ACE_SYNCH_CONDITION_T +# define ACE_SYNCH_SEMAPHORE_T _ACE_SYNCH_SEMAPHORE_T + +// Handle ACE_Malloc* +# define ACE_MEM_POOL_1 class _ACE_MEM_POOL, class _ACE_MEM_POOL_OPTIONS +# define ACE_MEM_POOL_2 _ACE_MEM_POOL, _ACE_MEM_POOL_OPTIONS +# define ACE_MEM_POOL _ACE_MEM_POOL +# define ACE_MEM_POOL_OPTIONS _ACE_MEM_POOL_OPTIONS + +// Handle ACE_Svc_Handler +# define ACE_PEER_STREAM_1 class _ACE_PEER_STREAM, class _ACE_PEER_ADDR +# define ACE_PEER_STREAM_2 _ACE_PEER_STREAM, _ACE_PEER_ADDR +# define ACE_PEER_STREAM _ACE_PEER_STREAM +# define ACE_PEER_STREAM_ADDR _ACE_PEER_ADDR + +// Handle ACE_Acceptor +# define ACE_PEER_ACCEPTOR_1 class _ACE_PEER_ACCEPTOR, class _ACE_PEER_ADDR +# define ACE_PEER_ACCEPTOR_2 _ACE_PEER_ACCEPTOR, _ACE_PEER_ADDR +# define ACE_PEER_ACCEPTOR _ACE_PEER_ACCEPTOR +# define ACE_PEER_ACCEPTOR_ADDR _ACE_PEER_ADDR + +// Handle ACE_Connector +# define ACE_PEER_CONNECTOR_1 class _ACE_PEER_CONNECTOR, class _ACE_PEER_ADDR +# define ACE_PEER_CONNECTOR_2 _ACE_PEER_CONNECTOR, _ACE_PEER_ADDR +# define ACE_PEER_CONNECTOR _ACE_PEER_CONNECTOR +# define ACE_PEER_CONNECTOR_ADDR _ACE_PEER_ADDR +# define ACE_PEER_CONNECTOR_ADDR_ANY ACE_PEER_CONNECTOR_ADDR::sap_any + +// Handle ACE_SOCK_* +# define ACE_SOCK_ACCEPTOR ACE_SOCK_Acceptor, ACE_INET_Addr +# define ACE_SOCK_CONNECTOR ACE_SOCK_Connector, ACE_INET_Addr +# define ACE_SOCK_STREAM ACE_SOCK_Stream, ACE_INET_Addr +# define ACE_SOCK_DGRAM ACE_SOCK_Dgram, ACE_INET_Addr +# define ACE_SOCK_DGRAM_BCAST ACE_SOCK_Dgram_Bcast, ACE_INET_Addr +# define ACE_SOCK_DGRAM_MCAST ACE_SOCK_Dgram_Mcast, ACE_INET_Addr + +// Handle ACE_SOCK_SEQPACK_* +# define ACE_SOCK_SEQPACK_ACCEPTOR ACE_SOCK_SEQPACK_Acceptor, ACE_Multihomed_INET_Addr +# define ACE_SOCK_SEQPACK_CONNECTOR ACE_SOCK_SEQPACK_Connector, ACE_Multihomed_INET_Addr +# define ACE_SOCK_SEQPACK_ASSOCIATION ACE_SOCK_SEQPACK_Association, ACE_Multihomed_INET_Addr + +// Handle ACE_MEM_* +# define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor, ACE_MEM_Addr +# define ACE_MEM_CONNECTOR ACE_MEM_Connector, ACE_INET_Addr +# define ACE_MEM_STREAM ACE_MEM_Stream, ACE_INET_Addr + +// Handle ACE_LSOCK_* +# define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor, ACE_UNIX_Addr +# define ACE_LSOCK_CONNECTOR ACE_LSOCK_Connector, ACE_UNIX_Addr +# define ACE_LSOCK_STREAM ACE_LSOCK_Stream, ACE_UNIX_Addr + +// Handle ACE_TLI_* +# define ACE_TLI_ACCEPTOR ACE_TLI_Acceptor, ACE_INET_Addr +# define ACE_TLI_CONNECTOR ACE_TLI_Connector, ACE_INET_Addr +# define ACE_TLI_STREAM ACE_TLI_Stream, ACE_INET_Addr + +// Handle ACE_SPIPE_* +# define ACE_SPIPE_ACCEPTOR ACE_SPIPE_Acceptor, ACE_SPIPE_Addr +# define ACE_SPIPE_CONNECTOR ACE_SPIPE_Connector, ACE_SPIPE_Addr +# define ACE_SPIPE_STREAM ACE_SPIPE_Stream, ACE_SPIPE_Addr + +// Handle ACE_UPIPE_* +# define ACE_UPIPE_ACCEPTOR ACE_UPIPE_Acceptor, ACE_SPIPE_Addr +# define ACE_UPIPE_CONNECTOR ACE_UPIPE_Connector, ACE_SPIPE_Addr +# define ACE_UPIPE_STREAM ACE_UPIPE_Stream, ACE_SPIPE_Addr + +// Handle ACE_FILE_* +# define ACE_FILE_CONNECTOR ACE_FILE_Connector, ACE_FILE_Addr +# define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr + +// Handle ACE_*_Memory_Pool. +# define ACE_MMAP_MEMORY_POOL ACE_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options +# define ACE_LITE_MMAP_MEMORY_POOL ACE_Lite_MMAP_Memory_Pool, ACE_MMAP_Memory_Pool_Options +# define ACE_SBRK_MEMORY_POOL ACE_Sbrk_Memory_Pool, ACE_Sbrk_Memory_Pool_Options +# define ACE_SHARED_MEMORY_POOL ACE_Shared_Memory_Pool, ACE_Shared_Memory_Pool_Options +# define ACE_LOCAL_MEMORY_POOL ACE_Local_Memory_Pool, ACE_Local_Memory_Pool_Options +# define ACE_PAGEFILE_MEMORY_POOL ACE_Pagefile_Memory_Pool, ACE_Pagefile_Memory_Pool_Options +# endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ + +// Work around compilers that don't like in-class static integral +// constants. Constants in this case are meant to be compile-time +// constants so that they may be used as template arguments, for +// example. BOOST provides a similar macro. +#ifndef ACE_LACKS_STATIC_IN_CLASS_CONSTANTS +# define ACE_STATIC_CONSTANT(TYPE, ASSIGNMENT) static TYPE const ASSIGNMENT +#else +# define ACE_STATIC_CONSTANT(TYPE, ASSIGNMENT) enum { ASSIGNMENT } +#endif /* !ACE_LACKS_STATIC_IN_CLASS_CONSTANTS */ + +#include /**/ "ace/post.h" + +#endif /*ACE_GLOBAL_MACROS_H*/ diff --git a/externals/ace/Guard_T.cpp b/externals/ace/Guard_T.cpp new file mode 100644 index 0000000..2090ddd --- /dev/null +++ b/externals/ace/Guard_T.cpp @@ -0,0 +1,61 @@ +// $Id: Guard_T.cpp 85141 2009-04-22 08:48:30Z johnnyw $ + +#ifndef ACE_GUARD_T_CPP +#define ACE_GUARD_T_CPP + +#include "ace/Guard_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Guard_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_HAS_DUMP) +# include "ace/Log_Msg.h" +#endif /* ACE_HAS_DUMP */ + +// **************************************************************** + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// ACE_ALLOC_HOOK_DEFINE(ACE_Guard) + +template void +ACE_Guard::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Guard::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("mutex_ = %x\n"), this->lock_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("owner_ = %d\n"), this->owner_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP, this)); +#endif /* ACE_HAS_DUMP */ +} + +// ACE_ALLOC_HOOK_DEFINE(ACE_Write_Guard) + +template void +ACE_Write_Guard::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Write_Guard::dump"); + ACE_Guard::dump (); +#endif /* ACE_HAS_DUMP */ +} + +// ACE_ALLOC_HOOK_DEFINE(ACE_Read_Guard) + +template void +ACE_Read_Guard::dump (void) const +{ +// ACE_TRACE ("ACE_Read_Guard::dump"); + ACE_Guard::dump (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_GUARD_T_CPP */ diff --git a/externals/ace/Guard_T.h b/externals/ace/Guard_T.h new file mode 100644 index 0000000..aee5c26 --- /dev/null +++ b/externals/ace/Guard_T.h @@ -0,0 +1,365 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Guard_T.h + * + * $Id: Guard_T.h 83306 2008-10-17 12:19:53Z johnnyw $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_GUARD_T_H +#define ACE_GUARD_T_H +#include /**/ "ace/pre.h" + +#include "ace/Lock.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/OS_NS_Thread.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Guard + * + * @brief This data structure is meant to be used within a method or + * function... It performs automatic aquisition and release of + * a parameterized synchronization object ACE_LOCK. + * + * The class given as an actual parameter must provide at + * the very least the , , , and + * methods. + */ +template +class ACE_Guard +{ +public: + + // = Initialization and termination methods. + ACE_Guard (ACE_LOCK &l); + + /// Implicitly and automatically acquire (or try to acquire) the + /// lock. If @a block is non-0 then the , else + /// it. + ACE_Guard (ACE_LOCK &l, bool block); + + /// Initialise the guard without implicitly acquiring the lock. The + /// @a become_owner parameter indicates whether the guard should release + /// the lock implicitly on destruction. The @a block parameter is + /// ignored and is used here to disambiguate with the preceding + /// constructor. + ACE_Guard (ACE_LOCK &l, bool block, int become_owner); + + /// Implicitly release the lock. + ~ACE_Guard (void); + + // = Lock accessors. + + /// Explicitly acquire the lock. + int acquire (void); + + /// Conditionally acquire the lock (i.e., won't block). + int tryacquire (void); + + /// Explicitly release the lock, but only if it is held! + int release (void); + + /// Relinquish ownership of the lock so that it is not released + /// implicitly in the destructor. + void disown (void); + + // = Utility methods. + /// true if locked, false if couldn't acquire the lock + /// (errno will contain the reason for this). + bool locked (void) const; + + /// Explicitly remove the lock. + int remove (void); + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + + /// Helper, meant for subclass only. + ACE_Guard (ACE_LOCK *lock): lock_ (lock), owner_ (0) {} + + /// Pointer to the ACE_LOCK we're guarding. + ACE_LOCK *lock_; + + /// Keeps track of whether we acquired the lock or failed. + int owner_; + +private: + // = Prevent assignment and initialization. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Guard &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Guard (const ACE_Guard &)) +}; + +/** + * @class ACE_Write_Guard + * + * @brief This class is similar to class ACE_Guard, though it + * acquires/releases a write lock automatically (naturally, the + * it is instantiated with must support the appropriate + * API). + */ +template +class ACE_Write_Guard : public ACE_Guard +{ +public: + // = Initialization method. + + /// Implicitly and automatically acquire a write lock. + ACE_Write_Guard (ACE_LOCK &m); + + /// Implicitly and automatically acquire (or try to acquire) a write + /// lock. + ACE_Write_Guard (ACE_LOCK &m, bool block); + + // = Lock accessors. + + /// Explicitly acquire the write lock. + int acquire_write (void); + + /// Explicitly acquire the write lock. + int acquire (void); + + /// Conditionally acquire the write lock (i.e., won't block). + int tryacquire_write (void); + + /// Conditionally acquire the write lock (i.e., won't block). + int tryacquire (void); + + // = Utility methods. + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; + +/** + * @class ACE_Read_Guard + * + * @brief This class is similar to class ACE_Guard, though it + * acquires/releases a read lock automatically (naturally, the + * it is instantiated with must support the appropriate + * API). + */ +template +class ACE_Read_Guard : public ACE_Guard +{ +public: + // = Initialization methods. + + /// Implicitly and automatically acquire a read lock. + ACE_Read_Guard (ACE_LOCK& m); + + /// Implicitly and automatically acquire (or try to acquire) a read + /// lock. + ACE_Read_Guard (ACE_LOCK &m, bool block); + + // = Lock accessors. + + /// Explicitly acquire the read lock. + int acquire_read (void); + + /// Explicitly acquire the read lock. + int acquire (void); + + /// Conditionally acquire the read lock (i.e., won't block). + int tryacquire_read (void); + + /// Conditionally acquire the read lock (i.e., won't block). + int tryacquire (void); + + // = Utility methods. + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; + +#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) + +#define ACE_TSS_Guard ACE_Guard +#define ACE_TSS_Write_GUARD ACE_Write_Guard +#define ACE_TSS_Read_GUARD ACE_Read_Guard + +#else + /* ACE platform supports some form of threading and + thread-specific storage. */ + +/** + * @class ACE_TSS_Guard + * + * @brief This data structure is meant to be used within a method or + * function... It performs automatic aquisition and release of + * a synchronization object. Moreover, it ensures that the lock + * is released even if a thread exits via ! + */ +template +class ACE_TSS_Guard +{ +public: + // = Initialization and termination methods. + + /// Implicitly and automatically acquire the thread-specific lock. + ACE_TSS_Guard (ACE_LOCK &lock, bool block = true); + + /// Implicitly release the thread-specific lock. + ~ACE_TSS_Guard (void); + + // = Lock accessors. + + /// Explicitly acquire the thread-specific lock. + int acquire (void); + + /// Conditionally acquire the thread-specific lock (i.e., won't + /// block). + int tryacquire (void); + + /// Explicitly release the thread-specific lock. + int release (void); + + // = Utility methods. + /// Explicitly release the thread-specific lock. + int remove (void); + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + /// Helper, meant for subclass only. + ACE_TSS_Guard (void); + + /// Initialize the key. + void init_key (void); + + /// Called when thread exits to clean up the lock. + static void cleanup (void *ptr); + + /// Thread-specific key... + ACE_thread_key_t key_; + +private: + // = Prevent assignment and initialization. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS_Guard &)) + ACE_UNIMPLEMENTED_FUNC (ACE_TSS_Guard (const ACE_TSS_Guard &)) +}; + +/** + * @class ACE_TSS_Write_Guard + * + * @brief This class is similar to class ACE_TSS_Guard, though it + * acquires/releases a write-lock automatically (naturally, the + * ACE_LOCK it is instantiated with must support the appropriate + * API). + */ +template +class ACE_TSS_Write_Guard : public ACE_TSS_Guard +{ +public: + // = Initialization method. + + /// Implicitly and automatically acquire the thread-specific write lock. + ACE_TSS_Write_Guard (ACE_LOCK &lock, bool block = true); + + // = Lock accessors. + + /// Explicitly acquire the thread-specific write lock. + int acquire_write (void); + + /// Explicitly acquire the thread-specific write lock. + int acquire (void); + + /// Conditionally acquire the thread-specific write lock (i.e., won't block). + int tryacquire_write (void); + + /// Conditionally acquire the thread-specific write lock (i.e., won't block). + int tryacquire (void); + + // = Utility methods. + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; + +/** + * @class ACE_TSS_Read_Guard + * + * @brief This class is similar to class , though it + * acquires/releases a read lock automatically (naturally, the + * it is instantiated with must support the + * appropriate API). + */ +template +class ACE_TSS_Read_Guard : public ACE_TSS_Guard +{ +public: + // = Initialization method. + /// Implicitly and automatically acquire the thread-specific read lock. + ACE_TSS_Read_Guard (ACE_LOCK &lock, bool block = true); + + // = Lock accessors. + /// Explicitly acquire the thread-specific read lock. + int acquire_read (void); + + /// Explicitly acquire the thread-specific read lock. + int acquire (void); + + /// Conditionally acquire the thread-specific read lock (i.e., won't + /// block). + int tryacquire_read (void); + + /// Conditionally acquire the thread-specific read lock (i.e., won't + /// block). + int tryacquire (void); + + // = Utility methods. + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. +}; + +#endif /* !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Guard_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Guard_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Guard_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_GUARD_T_H */ diff --git a/externals/ace/Guard_T.inl b/externals/ace/Guard_T.inl new file mode 100644 index 0000000..3e7d5b6 --- /dev/null +++ b/externals/ace/Guard_T.inl @@ -0,0 +1,170 @@ +// -*- C++ -*- +// +// $Id: Guard_T.inl 82723 2008-09-16 09:35:44Z johnnyw $ + +#include "ace/RW_Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE int +ACE_Guard::acquire (void) +{ + return this->owner_ = this->lock_->acquire (); +} + +template ACE_INLINE int +ACE_Guard::tryacquire (void) +{ + return this->owner_ = this->lock_->tryacquire (); +} + +template ACE_INLINE int +ACE_Guard::release (void) +{ + if (this->owner_ == -1) + return -1; + else + { + this->owner_ = -1; + return this->lock_->release (); + } +} + +template ACE_INLINE +ACE_Guard::ACE_Guard (ACE_LOCK &l) + : lock_ (&l), + owner_ (0) +{ + this->acquire (); +} + +template ACE_INLINE +ACE_Guard::ACE_Guard (ACE_LOCK &l, bool block) + : lock_ (&l), + owner_ (0) +{ + if (block) + this->acquire (); + else + this->tryacquire (); +} + +template ACE_INLINE +ACE_Guard::ACE_Guard (ACE_LOCK &l, bool /* block */, int become_owner) + : lock_ (&l), + owner_ (become_owner == 0 ? -1 : 0) +{ +} + +// Implicitly and automatically acquire (or try to acquire) the +// lock. + +template ACE_INLINE +ACE_Guard::~ACE_Guard (void) +{ + this->release (); +} + +template ACE_INLINE bool +ACE_Guard::locked (void) const +{ + return this->owner_ != -1; +} + +template ACE_INLINE int +ACE_Guard::remove (void) +{ + return this->lock_->remove (); +} + +template ACE_INLINE void +ACE_Guard::disown (void) +{ + this->owner_ = -1; +} + +template ACE_INLINE +ACE_Write_Guard::ACE_Write_Guard (ACE_LOCK &m) + : ACE_Guard (&m) +{ + this->acquire_write (); +} + +template ACE_INLINE int +ACE_Write_Guard::acquire_write (void) +{ + return this->owner_ = this->lock_->acquire_write (); +} + +template ACE_INLINE int +ACE_Write_Guard::acquire (void) +{ + return this->owner_ = this->lock_->acquire_write (); +} + +template ACE_INLINE int +ACE_Write_Guard::tryacquire_write (void) +{ + return this->owner_ = this->lock_->tryacquire_write (); +} + +template ACE_INLINE int +ACE_Write_Guard::tryacquire (void) +{ + return this->owner_ = this->lock_->tryacquire_write (); +} + +template ACE_INLINE +ACE_Write_Guard::ACE_Write_Guard (ACE_LOCK &m, + bool block) + : ACE_Guard (&m) +{ + if (block) + this->acquire_write (); + else + this->tryacquire_write (); +} + +template ACE_INLINE int +ACE_Read_Guard::acquire_read (void) +{ + return this->owner_ = this->lock_->acquire_read (); +} + +template ACE_INLINE int +ACE_Read_Guard::acquire (void) +{ + return this->owner_ = this->lock_->acquire_read (); +} + +template ACE_INLINE int +ACE_Read_Guard::tryacquire_read (void) +{ + return this->owner_ = this->lock_->tryacquire_read (); +} + +template ACE_INLINE int +ACE_Read_Guard::tryacquire (void) +{ + return this->owner_ = this->lock_->tryacquire_read (); +} + +template ACE_INLINE +ACE_Read_Guard::ACE_Read_Guard (ACE_LOCK &m) + : ACE_Guard (&m) +{ + this->acquire_read (); +} + +template ACE_INLINE +ACE_Read_Guard::ACE_Read_Guard (ACE_LOCK &m, + bool block) + : ACE_Guard (&m) +{ + if (block) + this->acquire_read (); + else + this->tryacquire_read (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Handle_Gobbler.h b/externals/ace/Handle_Gobbler.h new file mode 100644 index 0000000..9d6890a --- /dev/null +++ b/externals/ace/Handle_Gobbler.h @@ -0,0 +1,68 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Handle_Gobbler.h + * + * $Id: Handle_Gobbler.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Kirthika Parameswaran + * @author Irfan Pyarali + */ +//============================================================================= + + +#ifndef ACE_HANDLE_GOBBLER_H +#define ACE_HANDLE_GOBBLER_H +#include /**/ "ace/pre.h" + +#include "ace/Handle_Set.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Handle_Gobbler + * + * @brief This class gobbles up handles. + * + * This is useful when we need to control the number of handles + * available for a process. This class is mostly used for + * testing purposes. + */ +class ACE_Handle_Gobbler +{ +public: + + /// Destructor. Cleans up any remaining handles. + inline ~ACE_Handle_Gobbler (void); + + /** + * Handles are opened continously until the process runs out of + * them, and then handles are closed + * (freed) thereby making them usable in the future. + */ + inline int consume_handles (size_t n_handles_to_keep_available); + + /// Free up @a n_handles. + inline int free_handles (size_t n_handles); + + /// All remaining handles are closed. + inline void close_remaining_handles (void); + +private: + typedef ACE_Handle_Set HANDLE_SET; + + /// The container which holds the open descriptors. + HANDLE_SET handle_set_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include "ace/Handle_Gobbler.inl" + +#include /**/ "ace/post.h" +#endif /* ACE_HANDLE_GOBBLER_H */ diff --git a/externals/ace/Handle_Gobbler.inl b/externals/ace/Handle_Gobbler.inl new file mode 100644 index 0000000..cca9e4b --- /dev/null +++ b/externals/ace/Handle_Gobbler.inl @@ -0,0 +1,78 @@ +// -*- C++ -*- +// +// $Id: Handle_Gobbler.inl 85911 2009-07-07 05:45:14Z olli $ + +// Since this is only included in Handle_Gobbler.h, these should be +// inline, not ACE_INLINE. +// FUZZ: disable check_for_inline + +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_fcntl.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +inline void +ACE_Handle_Gobbler::close_remaining_handles (void) +{ + ACE_Handle_Set_Iterator iter (this->handle_set_); + for (ACE_HANDLE h = iter (); h != ACE_INVALID_HANDLE; h = iter ()) + ACE_OS::close (h); +} + +inline +ACE_Handle_Gobbler::~ACE_Handle_Gobbler (void) +{ + this->close_remaining_handles (); +} + +inline int +ACE_Handle_Gobbler::free_handles (size_t n_handles) +{ + ACE_Handle_Set_Iterator iter (this->handle_set_); + for (ACE_HANDLE h = iter (); + h != ACE_INVALID_HANDLE && n_handles > 0; + --n_handles, h = iter ()) + ACE_OS::close (h); + + return 0; +} + +inline int +ACE_Handle_Gobbler::consume_handles (size_t n_handles_to_keep_available) +{ + int result = 0; + +#if defined(ACE_WIN32) + // On Win32, this style of gobbling doesn't seem to work. + ACE_UNUSED_ARG(n_handles_to_keep_available); + +#else + + while (1) + { + ACE_HANDLE handle = ACE_OS::open (ACE_DEV_NULL, O_WRONLY); + + if (handle == ACE_INVALID_HANDLE) + { + if (ACE::out_of_handles (errno)) + { + result = this->free_handles (n_handles_to_keep_available); + break; + } + else + { + result = -1; + break; + } + } + if (handle >= static_cast(FD_SETSIZE)) + break; + this->handle_set_.set_bit (handle); + } + +#endif /* ACE_WIN32 */ + + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Handle_Ops.cpp b/externals/ace/Handle_Ops.cpp new file mode 100644 index 0000000..0ec856c --- /dev/null +++ b/externals/ace/Handle_Ops.cpp @@ -0,0 +1,48 @@ +// $Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Handle_Ops.h" + +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_fcntl.h" +#include "ace/Time_Value.h" + +ACE_RCSID (ace, + Handle_Ops, + "$Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_HANDLE +ACE::handle_timed_open (ACE_Time_Value *timeout, + const ACE_TCHAR *name, + int flags, + int perms, + LPSECURITY_ATTRIBUTES sa) +{ + ACE_TRACE ("ACE::handle_timed_open"); + + if (timeout != 0) + { +#if !defined (ACE_WIN32) + // On Win32, ACE_NONBLOCK gets recognized as O_WRONLY so we + // don't use it there + flags |= ACE_NONBLOCK; +#endif /* ACE_WIN32 */ + + // Open the named pipe or file using non-blocking mode... + ACE_HANDLE const handle = ACE_OS::open (name, flags, perms, sa); + + if (handle == ACE_INVALID_HANDLE + && (errno == EWOULDBLOCK + && (timeout->sec () > 0 || timeout->usec () > 0))) + // This expression checks if we were polling. + errno = ETIMEDOUT; + + return handle; + } + else + return ACE_OS::open (name, flags, perms, sa); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Handle_Ops.h b/externals/ace/Handle_Ops.h new file mode 100644 index 0000000..c615380 --- /dev/null +++ b/externals/ace/Handle_Ops.h @@ -0,0 +1,50 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Handle_Ops.h + * + * $Id: Handle_Ops.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Handle operations. + */ +//============================================================================= + +#ifndef ACE_HANDLE_OPS_H +#define ACE_HANDLE_OPS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +// = Operations on HANDLEs. +namespace ACE +{ + /** + * Wait up to @a timeout amount of time to actively open a device. + * This method doesn't perform the @c connect, it just does the + * timed wait. + */ + extern ACE_Export ACE_HANDLE handle_timed_open ( + ACE_Time_Value *timeout, + const ACE_TCHAR *name, + int flags, + int perms, + LPSECURITY_ATTRIBUTES sa = 0); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_HANDLE_OPS_H */ diff --git a/externals/ace/Handle_Set.cpp b/externals/ace/Handle_Set.cpp new file mode 100644 index 0000000..168acca --- /dev/null +++ b/externals/ace/Handle_Set.cpp @@ -0,0 +1,565 @@ +// Handle_Set.cpp +// $Id: Handle_Set.cpp 83306 2008-10-17 12:19:53Z johnnyw $ + +#include "ace/Handle_Set.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Handle_Set.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/OS_NS_string.h" + +ACE_RCSID(ace, Handle_Set, "$Id: Handle_Set.cpp 83306 2008-10-17 12:19:53Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set) + + // ACE_MSB_MASK is only used here. + // This needs to go here to avoid overflow problems on some compilers. +#if defined (ACE_WIN32) + // Does ACE_WIN32 have an fd_mask? +# define ACE_MSB_MASK (~(1 << (NFDBITS - 1))) +#else /* ! ACE_WIN32 */ +# define ACE_MSB_MASK (~((fd_mask) 1 << (NFDBITS - 1))) +#endif /* ! ACE_WIN32 */ + +#if defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !defined (_XOPEN_SOURCE) + // XPG4.2 requires the fds_bits member name, so it is not enabled by + // default on Linux/glibc-2.1.x systems. Instead use "__fds_bits." + // Ugly, but "what are you going to do?" 8-) +#define fds_bits __fds_bits +#endif /* linux && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !_XOPEN_SOURCE */ + +void +ACE_Handle_Set::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Handle_Set::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize_ = %d"), this->size_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmax_handle_ = %d"), this->max_handle_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n[ "))); + +#if defined (ACE_WIN32) + for (size_t i = 0; i < (size_t) this->mask_.fd_count + 1; i++) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" %x "), this->mask_.fd_array[i])); +#else /* !ACE_WIN32 */ + for (ACE_HANDLE i = 0; i < this->max_handle_ + 1; i++) + if (this->is_set (i)) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" %d "), i)); +#endif /* ACE_WIN32 */ + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" ]\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// Table that maps bytes to counts of the enabled bits in each value +// from 0 to 255, +// +// nbits_[0] == 0 +// +// because there are no bits enabled for the value 0. +// +// nbits_[5] == 2 +// +// because there are 2 bits enabled in the value 5, i.e., it's +// 101 in binary. + +const char ACE_Handle_Set::nbits_[256] = +{ + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8}; + +// Constructor, initializes the bitmask to all 0s. + +ACE_Handle_Set::ACE_Handle_Set (void) +{ + ACE_TRACE ("ACE_Handle_Set::ACE_Handle_Set"); + this->reset (); +} + +ACE_Handle_Set::ACE_Handle_Set (const fd_set &fd_mask) +{ + ACE_TRACE ("ACE_Handle_Set::ACE_Handle_Set"); + this->reset (); + ACE_OS::memcpy ((void *) &this->mask_, + (void *) &fd_mask, + sizeof this->mask_); +#if !defined (ACE_WIN32) + this->sync (ACE_Handle_Set::MAXSIZE); +#if defined (ACE_HAS_BIG_FD_SET) + this->min_handle_ = 0; +#endif /* ACE_HAS_BIG_FD_SET */ +#endif /* !ACE_WIN32 */ +} + +// Counts the number of bits enabled in N. Uses a table lookup to +// speed up the count. + +int +ACE_Handle_Set::count_bits (u_long n) +{ + + ACE_TRACE ("ACE_Handle_Set::count_bits"); +#if defined (ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT) + register int rval = 0; + + // Count the number of enabled bits in . This algorithm is very + // fast, i.e., O(enabled bits in n). + + for (register u_long m = n; + m != 0; + m &= m - 1) + rval++; + + return rval; +#else + return (ACE_Handle_Set::nbits_[n & 0xff] + + ACE_Handle_Set::nbits_[(n >> 8) & 0xff] + + ACE_Handle_Set::nbits_[(n >> 16) & 0xff] + + ACE_Handle_Set::nbits_[(n >> 24) & 0xff]); +#endif /* ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT */ +} + +#if defined (ACE_HAS_BIG_FD_SET) +// Find the bit position counting from right to left worst case +// (1<<31) is 8. + +int +ACE_Handle_Set::bitpos (u_long bit) +{ + register int l = 0; + register u_long n = bit - 1; + + // This is a fast count method when have the most significative bit. + + while (n >> 8) + { + n >>= 8; + l += 8; + } + + // Is greater than 15? + if (n & 16) + { + n >>= 4; + l += 4; + } + + // Count number remaining bits. + while (n != 0) + { + n &= n - 1; + l++; + } + return l; +} +#endif /* ACE_HAS_BIG_FD_SET */ + +// Synchronize the underlying FD_SET with the MAX_FD and the SIZE. + +#if defined (ACE_USE_SHIFT_FOR_EFFICIENCY) +// These don't work because shifting right 3 bits is not the same as +// dividing by 3, e.g., dividing by 8 requires shifting right 3 bits. +// In order to do the shift, we need to calculate the number of bits +// at some point. +#define ACE_DIV_BY_WORDSIZE(x) ((x) >> ((int) ACE_Handle_Set::WORDSIZE)) +#define ACE_MULT_BY_WORDSIZE(x) ((x) << ((int) ACE_Handle_Set::WORDSIZE)) +#else +#define ACE_DIV_BY_WORDSIZE(x) ((x) / ((int) ACE_Handle_Set::WORDSIZE)) +#define ACE_MULT_BY_WORDSIZE(x) ((x) * ((int) ACE_Handle_Set::WORDSIZE)) +#endif /* ACE_USE_SHIFT_FOR_EFFICIENCY */ + +void +ACE_Handle_Set::sync (ACE_HANDLE max) +{ + ACE_TRACE ("ACE_Handle_Set::sync"); +#if !defined (ACE_WIN32) + fd_mask *maskp = (fd_mask *)(this->mask_.fds_bits); + this->size_ = 0; + + for (int i = ACE_DIV_BY_WORDSIZE (max - 1); + i >= 0; + i--) + this->size_ += ACE_Handle_Set::count_bits (maskp[i]); + + this->set_max (max); +#else + ACE_UNUSED_ARG (max); +#endif /* !ACE_WIN32 */ +} + +// Resets the MAX_FD after a clear of the original MAX_FD. + +void +ACE_Handle_Set::set_max (ACE_HANDLE current_max) +{ + ACE_TRACE ("ACE_Handle_Set::set_max"); +#if !defined(ACE_WIN32) + fd_mask * maskp = (fd_mask *)(this->mask_.fds_bits); + + if (this->size_ == 0) + this->max_handle_ = ACE_INVALID_HANDLE; + else + { + int i; + + for (i = ACE_DIV_BY_WORDSIZE (current_max - 1); + maskp[i] == 0; + i--) + continue; +#if defined (ACE_TANDEM_NSK_BIT_ORDER) + // bits are in reverse order, MSB (sign bit) = bit 0. + this->max_handle_ = ACE_MULT_BY_WORDSIZE (i); + for (fd_mask val = maskp[i]; + (val & ACE_MSB_MASK) != 0; + val = (val << 1)) + ++this->max_handle_; +#elif 1 /* !defined(ACE_HAS_BIG_FD_SET) */ + this->max_handle_ = ACE_MULT_BY_WORDSIZE (i); + for (fd_mask val = maskp[i]; + (val & ~1) != 0; // This obscure code is needed since "bit 0" is in location 1... + val = (val >> 1) & ACE_MSB_MASK) + ++this->max_handle_; +#else + register u_long val = this->mask_.fds_bits[i]; + this->max_handle_ = ACE_MULT_BY_WORDSIZE (i) + + ACE_Handle_Set::bitpos(val & ~(val - 1)); +#endif /* 1 */ + } + + // Do some sanity checking... + if (this->max_handle_ >= ACE_Handle_Set::MAXSIZE) + this->max_handle_ = ACE_Handle_Set::MAXSIZE - 1; +#else + ACE_UNUSED_ARG (current_max); +#endif /* !ACE_WIN32 */ +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set_Iterator) + +void +ACE_Handle_Set_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Handle_Set_Iterator::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); +#if defined(ACE_WIN32) || !defined(ACE_HAS_BIG_FD_SET) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhandle_index_ = %d"), this->handle_index_)); +#elif defined(ACE_HAS_BIG_FD_SET) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nword_max_ = %d"), this->word_max_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nword_val_ = %d"), this->word_val_)); +#endif + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nword_num_ = %d"), this->word_num_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_HANDLE +ACE_Handle_Set_Iterator::operator () (void) +{ + ACE_TRACE ("ACE_Handle_Set_Iterator::operator"); +#if defined (ACE_WIN32) + if (this->handle_index_ < this->handles_.mask_.fd_count) + // Return the handle and advance the iterator. + return (ACE_HANDLE) this->handles_.mask_.fd_array[this->handle_index_++]; + else + return ACE_INVALID_HANDLE; + +#elif !defined (ACE_HAS_BIG_FD_SET) /* !ACE_WIN32 */ + // No sense searching further than the max_handle_ + 1; + ACE_HANDLE maxhandlep1 = this->handles_.max_handle_ + 1; + + // HP-UX 11 plays some games with the fd_mask type - fd_mask is + // defined as an int_32t, but the fds_bits is an array of longs. + // This makes plainly indexing through the array by hand tricky, + // since the FD_* macros treat the array as int32_t. So the bits + // are in the right place for int32_t, even though the array is + // long. This, they say, is to preserve the same in-memory layout + // for 32-bit and 64-bit processes. So, we play the same game as + // the FD_* macros to get the bits right. On all other systems, + // this amounts to practically a NOP, since this is what would have + // been done anyway, without all this type jazz. + fd_mask * maskp = (fd_mask *)(this->handles_.mask_.fds_bits); + + if (this->handle_index_ >= maxhandlep1) + // We've seen all the handles we're interested in seeing for this + // iterator. + return ACE_INVALID_HANDLE; + else + { + ACE_HANDLE result = this->handle_index_; + + // Increment the iterator and advance to the next bit in this + // word. + this->handle_index_++; +#if defined (ACE_TANDEM_NSK_BIT_ORDER) + // bits are in reverse order, MSB (sign bit) = bit 0. + this->word_val_ = (this->word_val_ << 1); +# else + this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; +# endif /* ACE_TANDEM_NSK_BIT_ORDER */ + + // If we've examined all the bits in this word, we'll go onto + // the next word. + + if (this->word_val_ == 0) + { + // Start the handle_index_ at the beginning of the next word + // and then loop until we've found the first non-zero bit or + // we run past the of the bitset. + + for (this->handle_index_ = ACE_MULT_BY_WORDSIZE(++this->word_num_); + this->handle_index_ < maxhandlep1 + && maskp[this->word_num_] == 0; + this->word_num_++) + this->handle_index_ += ACE_Handle_Set::WORDSIZE; + + // If the bit index becomes >= the maxhandlep1 that means + // there weren't any more bits set that we want to consider. + // Therefore, we'll just store the maxhandlep1, which will + // cause to return + // immediately next time it's called. + if (this->handle_index_ >= maxhandlep1) + { + this->handle_index_ = maxhandlep1; + return result; + } + else + // Load the bits of the next word. + this->word_val_ = maskp[this->word_num_]; + } + + // Loop until we get to have its least significant + // bit enabled, keeping track of which this + // represents (this information is used by subsequent calls to + // ). + +#if defined (ACE_TANDEM_NSK_BIT_ORDER) + // bits are in reverse order, MSB (sign bit) = bit 0. + for (; + this->word_val_ > 0; + this->word_val_ = (this->word_val_ << 1)) + this->handle_index_++; +# else + for (; + ACE_BIT_DISABLED (this->word_val_, 1); + this->handle_index_++) + this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; +# endif /* ACE_TANDEM_NSK_BIT_ORDER */ + + return result; + } +#else /* !ACE_HAS_BIG_FD_SET */ + // Find the first word in fds_bits with bit on + register u_long lsb = this->word_val_; + + if (lsb == 0) + { + do + { + // We have exceeded the word count in Handle_Set? + if (++this->word_num_ >= this->word_max_) + return ACE_INVALID_HANDLE; + + lsb = this->handles_.mask_.fds_bits[this->word_num_]; + } + while (lsb == 0); + + // Set index to word boundary. + this->handle_index_ = ACE_MULT_BY_WORDSIZE (this->word_num_); + + // Put new word_val. + this->word_val_ = lsb; + + // Find the least significative bit. + lsb &= ~(lsb - 1); + + // Remove least significative bit. + this->word_val_ ^= lsb; + + // Save to calculate bit distance. + this->oldlsb_ = lsb; + + // Move index to least significative bit. + while (lsb >>= 1) + this->handle_index_++; + } + else + { + // Find the least significative bit. + lsb &= ~(lsb - 1); + + // Remove least significative bit. + this->word_val_ ^= lsb; + + register u_long n = lsb - this->oldlsb_; + + // Move index to bit distance between new lsb and old lsb. + do + { + this->handle_index_++; + n &= n >> 1; + } + while (n != 0); + + this->oldlsb_ = lsb; + } + + return this->handle_index_; +#endif /* ACE_WIN32 */ +} + +ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs) + : handles_ (hs), +#if !defined (ACE_HAS_BIG_FD_SET) || defined (ACE_WIN32) + handle_index_ (0), + word_num_ (-1) +#elif defined (ACE_HAS_BIG_FD_SET) + oldlsb_ (0), + word_max_ (hs.max_handle_ == ACE_INVALID_HANDLE + ? 0 + : ((ACE_DIV_BY_WORDSIZE (hs.max_handle_)) + 1)) +#endif /* ACE_HAS_BIG_FD_SET */ +{ + ACE_TRACE ("ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator"); +#if !defined (ACE_WIN32) && !defined (ACE_HAS_BIG_FD_SET) + // No sense searching further than the max_handle_ + 1; + ACE_HANDLE maxhandlep1 = + this->handles_.max_handle_ + 1; + + fd_mask *maskp = + (fd_mask *)(this->handles_.mask_.fds_bits); + + // Loop until we've found the first non-zero bit or we run past the + // of the bitset. + while (this->handle_index_ < maxhandlep1 + && maskp[++this->word_num_] == 0) + this->handle_index_ += ACE_Handle_Set::WORDSIZE; + + // If the bit index becomes >= the maxhandlep1 that means there + // weren't any bits set. Therefore, we'll just store the + // maxhandlep1, which will cause to return + // immediately. + if (this->handle_index_ >= maxhandlep1) + this->handle_index_ = maxhandlep1; + else + // Loop until we get to have its least significant bit + // enabled, keeping track of which this represents + // (this information is used by ). +#if defined (ACE_TANDEM_NSK_BIT_ORDER) + // bits are in reverse order, MSB (sign bit) = bit 0. + for (this->word_val_ = maskp[this->word_num_]; + this->word_val_ > 0; + this->word_val_ = (this->word_val_ << 1)) + this->handle_index_++; +# else + for (this->word_val_ = maskp[this->word_num_]; + ACE_BIT_DISABLED (this->word_val_, 1) + && this->handle_index_ < maxhandlep1; + this->handle_index_++) + this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; +# endif /* ACE_TANDEM_NSK_BIT_ORDER */ +#elif !defined (ACE_WIN32) && defined (ACE_HAS_BIG_FD_SET) + if (this->word_max_==0) + { + this->word_num_ = -1; + this->word_val_ = 0; + } + else + { + this->word_num_ = + ACE_DIV_BY_WORDSIZE (this->handles_.min_handle_) - 1; + this->word_val_ = 0; + } +#endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */ +} + + +void +ACE_Handle_Set_Iterator::reset_state (void) +{ + ACE_TRACE ("ACE_Handle_Set_Iterator::reset_state"); + +#if !defined (ACE_HAS_BIG_FD_SET) || defined (ACE_WIN32) + this->handle_index_ = 0; + this->word_num_ = -1; +#elif defined (ACE_HAS_BIG_FD_SET) + this->oldlsb_ = 0; + this->word_max_ = + this->handles_.max_handle_ == ACE_INVALID_HANDLE ? 0 + : ((ACE_DIV_BY_WORDSIZE (this->handles_.max_handle_)) + 1); +#endif /* ACE_HAS_BIG_FD_SET */ + +#if !defined (ACE_WIN32) && !defined (ACE_HAS_BIG_FD_SET) + // No sense searching further than the max_handle_ + 1; + ACE_HANDLE maxhandlep1 = + this->handles_.max_handle_ + 1; + + fd_mask *maskp = + (fd_mask *)(this->handles_.mask_.fds_bits); + + // Loop until we've found the first non-zero bit or we run past the + // of the bitset. + while (this->handle_index_ < maxhandlep1 + && maskp[++this->word_num_] == 0) + this->handle_index_ += ACE_Handle_Set::WORDSIZE; + + // If the bit index becomes >= the maxhandlep1 that means there + // weren't any bits set. Therefore, we'll just store the + // maxhandlep1, which will cause to return + // immediately. + if (this->handle_index_ >= maxhandlep1) + this->handle_index_ = maxhandlep1; + else + // Loop until we get to have its least significant bit + // enabled, keeping track of which this represents + // (this information is used by ). +#if defined (ACE_TANDEM_NSK_BIT_ORDER) + // bits are in reverse order, MSB (sign bit) = bit 0. + for (this->word_val_ = maskp[this->word_num_]; + this->word_val_ > 0; + this->word_val_ = (this->word_val_ << 1)) + this->handle_index_++; +# else + for (this->word_val_ = maskp[this->word_num_]; + ACE_BIT_DISABLED (this->word_val_, 1) + && this->handle_index_ < maxhandlep1; + this->handle_index_++) + this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; +# endif /* ACE_TANDEM_NSK_BIT_ORDER */ +#elif !defined (ACE_WIN32) && defined (ACE_HAS_BIG_FD_SET) + if (this->word_max_==0) + { + this->word_num_ = -1; + this->word_val_ = 0; + } + else + { + this->word_num_ = + ACE_DIV_BY_WORDSIZE (this->handles_.min_handle_) - 1; + this->word_val_ = 0; + } +#endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Handle_Set.h b/externals/ace/Handle_Set.h new file mode 100644 index 0000000..11188f9 --- /dev/null +++ b/externals/ace/Handle_Set.h @@ -0,0 +1,236 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Handle_Set.h + * + * $Id: Handle_Set.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_HANDLE_SET_H +#define ACE_HANDLE_SET_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_select.h" +#include "ace/os_include/os_limits.h" + +// Default size of the ACE Reactor. +#if defined (FD_SETSIZE) + int const ACE_FD_SETSIZE = FD_SETSIZE; +#else /* !FD_SETSIZE */ +# define ACE_FD_SETSIZE FD_SETSIZE +#endif /* ACE_FD_SETSIZE */ + +#if !defined (ACE_DEFAULT_SELECT_REACTOR_SIZE) +# define ACE_DEFAULT_SELECT_REACTOR_SIZE ACE_FD_SETSIZE +#endif /* ACE_DEFAULT_SELECT_REACTOR_SIZE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Handle_Set + * + * @brief C++ wrapper facade for the socket @c fd_set abstraction. + * + * This abstraction is a very efficient wrapper facade over + * @c fd_set. In particular, no range checking is performed, so + * it's important not to set or clear bits that are outside the + * @c ACE_DEFAULT_SELECT_REACTOR_SIZE. + */ +class ACE_Export ACE_Handle_Set +{ +public: + friend class ACE_Handle_Set_Iterator; + + // = Initialization and termination. + + enum + { + MAXSIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE + }; + + // = Initialization methods. + /// Constructor, initializes the bitmask to all 0s. + ACE_Handle_Set (void); + + /** + * Constructor, initializes the handle set from a given mask. + */ + ACE_Handle_Set (const fd_set &mask); + + // = Methods for manipulating bitsets. + /// Initialize the bitmask to all 0s and reset the associated fields. + void reset (void); + + /** + * Checks whether @a handle is enabled. No range checking is + * performed so @a handle must be less than + * @c ACE_DEFAULT_SELECT_REACTOR_SIZE. + */ + int is_set (ACE_HANDLE handle) const; + + /// Enables the @a handle. No range checking is performed so @a handle + /// must be less than @c ACE_DEFAULT_SELECT_REACTOR_SIZE. + void set_bit (ACE_HANDLE handle); + + /// Disables the @a handle. No range checking is performed so + /// @a handle must be less than @c ACE_DEFAULT_SELECT_REACTOR_SIZE. + void clr_bit (ACE_HANDLE handle); + + /// Returns a count of the number of enabled bits. + int num_set (void) const; + + /// Returns the number of the large bit. + ACE_HANDLE max_set (void) const; + + /** + * Rescan the underlying @c fd_set up to handle @a max to find the new + * (highest bit set) and (how many bits set) values. + * This is useful for evaluating the changes after the handle set has + * been manipulated in some way other than member functions; for example, + * after + ACE_Select_Reactor_Handle_Set dispatch_set_; + + /// Tracks handles that are waited for by . + ACE_Select_Reactor_Handle_Set ready_set_; + + /// Defined as a pointer to allow overriding by derived classes... + ACE_Timer_Queue *timer_queue_; + + /// Handle signals without requiring global/static variables. + ACE_Sig_Handler *signal_handler_; + + /// Callback object that unblocks the ACE_Select_Reactor if it's + /// sleeping. + ACE_Reactor_Notify *notify_handler_; + + /// Keeps track of whether we should delete the timer queue (if we + /// didn't create it, then we don't delete it). + bool delete_timer_queue_; + + /// Keeps track of whether we should delete the signal handler (if we + /// didn't create it, then we don't delete it). + bool delete_signal_handler_; + + /// Keeps track of whether we need to delete the notify handler (if + /// we didn't create it, then we don't delete it). + bool delete_notify_handler_; + + /// True if we've been initialized yet... + bool initialized_; + + /// Restart the event-loop method automatically when + /// . + + if (number_of_active_handles == 0) + { + do + { + if (this->timer_queue_ == 0) + return 0; + + this_timeout = + this->timer_queue_->calculate_timeout (max_wait_time, + &timer_buf); +#ifdef ACE_WIN32 + // This arg is ignored on Windows and causes pointer + // truncation warnings on 64-bit compiles. + int const width = 0; +#else + int const width = this->handler_rep_.max_handlep1 (); +#endif /* ACE_WIN32 */ + + dispatch_set.rd_mask_ = this->wait_set_.rd_mask_; + dispatch_set.wr_mask_ = this->wait_set_.wr_mask_; + dispatch_set.ex_mask_ = this->wait_set_.ex_mask_; + number_of_active_handles = ACE_OS::select (width, + dispatch_set.rd_mask_, + dispatch_set.wr_mask_, + dispatch_set.ex_mask_, + this_timeout); + } + while (number_of_active_handles == -1 && this->handle_error () > 0); + + if (number_of_active_handles > 0) + { +#if !defined (ACE_WIN32) + // Resynchronize the fd_sets so their "max" is set properly. + dispatch_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); + dispatch_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); + dispatch_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); +#endif /* ACE_WIN32 */ + } + else if (number_of_active_handles == -1) + { + // Normally, select() will reset the bits in dispatch_set + // so that only those filed descriptors that are ready will + // have bits set. However, when an error occurs, the bit + // set remains as it was when the select call was first made. + // Thus, we now have a dispatch_set that has every file + // descriptor that was originally waited for, which is not + // correct. We must clear all the bit sets because we + // have no idea if any of the file descriptors is ready. + // + // NOTE: We dont have a test case to reproduce this + // problem. But pleae dont ignore this and remove it off. + dispatch_set.rd_mask_.reset (); + dispatch_set.wr_mask_.reset (); + dispatch_set.ex_mask_.reset (); + } + } + + // Return the number of events to dispatch. + return number_of_active_handles; +} + +template int +ACE_Select_Reactor_T::dispatch_timer_handlers + (int &number_of_handlers_dispatched) +{ + number_of_handlers_dispatched += this->timer_queue_->expire (); + + return 0; +} + +template int +ACE_Select_Reactor_T::dispatch_notification_handlers + (ACE_Select_Reactor_Handle_Set &dispatch_set, + int &number_of_active_handles, + int &number_of_handlers_dispatched) +{ + // Check to see if the ACE_HANDLE associated with the + // Select_Reactor's notify hook is enabled. If so, it means that + // one or more other threads are trying to update the + // ACE_Select_Reactor_T's internal tables or the notify pipe is + // enabled. We'll handle all these threads and notifications, and + // then break out to continue the event loop. + int const n = + this->notify_handler_->dispatch_notifications (number_of_active_handles, + dispatch_set.rd_mask_); + + if (n == -1) + return -1; + else + { + number_of_handlers_dispatched += n; + number_of_active_handles -= n; + } + + // Same as dispatch_timer_handlers + // No need to do anything with the state changed. That is because + // unbind already handles the case where someone unregister some + // kind of handle and unbind it. (::unbind calls the function + // state_changed () to reflect ant change with that) + // return this->state_changed_ ? -1 : 0; + return 0; +} + +template int +ACE_Select_Reactor_T::dispatch_io_set + (int number_of_active_handles, + int &number_of_handlers_dispatched, + int mask, + ACE_Handle_Set &dispatch_mask, + ACE_Handle_Set &ready_mask, + ACE_EH_PTMF callback) +{ + ACE_TRACE ("ACE_Select_Reactor_T::dispatch_io_set"); + ACE_HANDLE handle; + + ACE_Handle_Set_Iterator handle_iter (dispatch_mask); + + while ((handle = handle_iter ()) != ACE_INVALID_HANDLE && + number_of_handlers_dispatched < number_of_active_handles) + { + ++number_of_handlers_dispatched; + + this->notify_handle (handle, + mask, + ready_mask, + this->handler_rep_.find (handle), + callback); + + // clear the bit from that dispatch mask, + // so when we need to restart the iteration (rebuilding the iterator...) + // we will not dispatch the already dispatched handlers + this->clear_dispatch_mask (handle, mask); + + if (this->state_changed_) + { + + handle_iter.reset_state (); + this->state_changed_ = false; + } + } + + return 0; +} + +template int +ACE_Select_Reactor_T::dispatch_io_handlers + (ACE_Select_Reactor_Handle_Set &dispatch_set, + int &number_of_active_handles, + int &number_of_handlers_dispatched) +{ + ACE_TRACE ("ACE_Select_Reactor_T::dispatch_io_handlers"); + + // Handle output events (this code needs to come first to handle the + // obscure case of piggy-backed data coming along with the final + // handshake message of a nonblocking connection). + + if (this->dispatch_io_set (number_of_active_handles, + number_of_handlers_dispatched, + ACE_Event_Handler::WRITE_MASK, + dispatch_set.wr_mask_, + this->ready_set_.wr_mask_, + &ACE_Event_Handler::handle_output) == -1) + { + number_of_active_handles -= number_of_handlers_dispatched; + return -1; + } + + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Select_Reactor_T::dispatch - EXCEPT\n"))); + if (this->dispatch_io_set (number_of_active_handles, + number_of_handlers_dispatched, + ACE_Event_Handler::EXCEPT_MASK, + dispatch_set.ex_mask_, + this->ready_set_.ex_mask_, + &ACE_Event_Handler::handle_exception) == -1) + { + number_of_active_handles -= number_of_handlers_dispatched; + return -1; + } + + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Select_Reactor_T::dispatch - READ\n"))); + if (this->dispatch_io_set (number_of_active_handles, + number_of_handlers_dispatched, + ACE_Event_Handler::READ_MASK, + dispatch_set.rd_mask_, + this->ready_set_.rd_mask_, + &ACE_Event_Handler::handle_input) == -1) + { + number_of_active_handles -= number_of_handlers_dispatched; + return -1; + } + + number_of_active_handles -= number_of_handlers_dispatched; + return 0; +} + +template int +ACE_Select_Reactor_T::dispatch + (int active_handle_count, + ACE_Select_Reactor_Handle_Set &dispatch_set) +{ + ACE_TRACE ("ACE_Select_Reactor_T::dispatch"); + + int io_handlers_dispatched = 0; + int other_handlers_dispatched = 0; + int signal_occurred = 0; + // The following do/while loop keeps dispatching as long as there + // are still active handles. Note that the only way we should ever + // iterate more than once through this loop is if signals occur + // while we're dispatching other handlers. + + do + { + // We expect that the loop will decrease the number of active + // handles in each iteration. If it does not, then something is + // inconsistent in the state of the Reactor and we should avoid + // the loop. Please read the comments on bug 2540 for more + // details. + int initial_handle_count = active_handle_count; + + // Note that we keep track of changes to our state. If any of + // the dispatch_*() methods below return -1 it means that the + // state has changed as the result of an + // being dispatched. This means that we + // need to bail out and rerun the select() loop since our + // existing notion of handles in may no longer be + // correct. + // + // In the beginning, our state starts out unchanged. After + // every iteration (i.e., due to signals), our state starts out + // unchanged again. + + this->state_changed_ = false; + + // Perform the Template Method for dispatching all the handlers. + + // First check for interrupts. + if (active_handle_count == -1) + { + // Bail out -- we got here since /. Pass over both the Event_Handler *and* the + * @a mask to allow the caller to dictate which + * method the will invoke. The ACE_Time_Value + * indicates how long to blocking trying to notify the + * . If @a timeout == 0, the caller will block until + * action is possible, else will wait until the relative time + * specified in *@a timeout elapses). + */ + virtual int notify (ACE_Event_Handler * = 0, + ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0); + + /** + * Set the maximum number of times that the + * method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify pipe before breaking out of its loop. By default, + * this is set to -1, which means "iterate until the pipe is empty." + * Setting this to a value like "1 or 2" will increase "fairness" + * (and thus prevent starvation) at the expense of slightly higher + * dispatching overhead. + */ + virtual void max_notify_iterations (int); + + /** + * Get the maximum number of times that the + * method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify pipe before breaking out of its loop. + */ + virtual int max_notify_iterations (void); + + /// Get the existing restart value. + virtual bool restart (void); + + /// Set a new value for restart and return the original value. + virtual bool restart (bool r); + + /// Set position that the main ACE_Select_Reactor thread is requeued in the + /// list of waiters during a callback. + virtual void requeue_position (int); + + /// Get position that the main ACE_Select_Reactor thread is requeued in the + /// list of waiters during a callback. + virtual int requeue_position (void); + + // = Low-level wait_set mask manipulation methods. + /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the @a eh and + /// @a mask. + virtual int mask_ops (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask, + int ops); + + /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the @a handle + /// and @a mask. + virtual int mask_ops (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + int ops); + + // = Low-level ready_set mask manipulation methods. + /// GET/SET/ADD/CLR the ready "bit" bound with the @a eh and @a mask. + virtual int ready_ops (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask, + int ops); + + /// GET/SET/ADD/CLR the ready "bit" bound with the @a handle and @a mask. + virtual int ready_ops (ACE_HANDLE handle, + ACE_Reactor_Mask, + int ops); + + /// Wake up all threads in waiting in the event loop + virtual void wakeup_all_threads (void); + + // = Only the owner thread can perform a . + + /// Set the new owner of the thread and return the old owner. + virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0); + + /// Return the current owner of the thread. + virtual int owner (ACE_thread_t *); + + // = Miscellaneous Handler operations. + + /** + * Return the Event_Handler associated with @a handle. Return 0 if + * @a handle is not registered. + */ + virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); + + /** + * Check to see if @a handle is associated with a valid Event_Handler + * bound to @a mask. Return the @a eh associated with this @a handler + * if @a eh != 0. + */ + virtual int handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **eh = 0); + + /** + * Check to see if @a signum is associated with a valid Event_Handler + * bound to a signal. Return the @a eh associated with this + * handler if @a eh != 0. + */ + virtual int handler (int signum, + ACE_Event_Handler ** = 0); + + /// Returns true if we've been successfully initialized, else false. + virtual bool initialized (void); + + /// Returns the current size of the Reactor's internal descriptor + /// table. + virtual size_t size (void) const; + + /** + * Returns a reference to the ACE_Reactor_Token that is + * used to serialize the internal processing logic. + * This can be useful for situations where you need to avoid + * deadlock efficiently when ACE_Event_Handlers are used in + * multiple threads. + */ + virtual ACE_Lock &lock (void); + + /// Dump the state of an object. + virtual void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = Internal methods that do the actual work. + + // All of these methods assume that the token + // lock is held by the public methods that call down to them. + + /// Do the work of actually binding the @a handle and @a eh with the + /// @a mask. + virtual int register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *eh, + ACE_Reactor_Mask mask); + + /// Register a set of @a handles. + virtual int register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Do the work of actually unbinding the @a handle and @a eh with the + /// @a mask. + virtual int remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask); + + /// Remove a set of @a handles. + virtual int remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask); + + /// Suspend the associated with @a handle + virtual int suspend_i (ACE_HANDLE handle); + + /// Check to see if the associated with @a handle is + /// suspended. Returns 0 if not, 1 if so. + virtual int is_suspended_i (ACE_HANDLE handle); + + /// Resume the associated with @a handle + virtual int resume_i (ACE_HANDLE handle); + + /// Implement the public handler method. + virtual ACE_Event_Handler *find_handler_i (ACE_HANDLE handle); + + /// Implement the public handler method. + virtual int handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask, + ACE_Event_Handler ** = 0); + + /// Implement the public handler method. + virtual int handler_i (int signum, ACE_Event_Handler ** = 0); + + /** + * Check if there are any HANDLEs enabled in the , and + * if so, update the @a handle_set and return the number ready. If + * there aren't any HANDLEs enabled return 0. + */ + virtual int any_ready (ACE_Select_Reactor_Handle_Set &handle_set); + + /// Implement the method, assuming that the Sig_Guard is + /// beign held + virtual int any_ready_i (ACE_Select_Reactor_Handle_Set &handle_set); + + /// Take corrective action when errors occur. + virtual int handle_error (void); + + /// Make sure the handles are all valid. + virtual int check_handles (void); + + /// Wait for events to occur. + virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, + ACE_Time_Value *); + + // = Dispatching methods. + + /** + * Template Method that dispatches ACE_Event_Handlers for time + * events, I/O events, and signal events. Returns the total number + * of ACE_Event_Handlers that were dispatched or -1 if something + * goes wrong. + */ + virtual int dispatch (int nfound, + ACE_Select_Reactor_Handle_Set &); + + /** + * Dispatch all timer handlers that have expired. Returns -1 if the + * state of the has changed, else 0. + * is set to the number of timer handlers + * dispatched. + */ + virtual int dispatch_timer_handlers (int &number_dispatched); + + /** + * Dispatch any notification handlers. Returns -1 if the state of + * the has changed, else returns number of handlers + * notified. + */ + virtual int dispatch_notification_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set, + int &number_of_active_handles, + int &number_of_handlers_dispatched); + + /** + * Dispatch all the input/output/except handlers that are enabled in + * the @a dispatch_set. Updates @a number_of_active_handles and + * @a number_of_handlers_dispatched according to the behavior of the + * number Returns -1 if the state of the has changed, + * else 0. + */ + virtual int dispatch_io_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set, + int &number_of_active_handles, + int &number_of_handlers_dispatched); + + /** + * Factors the dispatching of an io handle set (each WRITE, EXCEPT + * or READ set of handles). It updates the + * @a number_of_handlers_dispatched and invokes this->notify_handle + * for all the handles in using the @a mask, + * and @a callback parameters. Must return -1 if + * this->state_changed otherwise it must return 0. + */ + virtual int dispatch_io_set (int number_of_active_handles, + int &number_of_handlers_dispatched, + int mask, + ACE_Handle_Set& dispatch_mask, + ACE_Handle_Set& ready_mask, + ACE_EH_PTMF callback); + + /// Notify the appropriate @a callback in the context of the @a eh + /// associated with @a handle that a particular event has occurred. + virtual void notify_handle (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Handle_Set &, + ACE_Event_Handler *eh, + ACE_EH_PTMF callback); + + /// Enqueue ourselves into the list of waiting threads at the + /// appropriate point specified by . + virtual void renew (void); + + /// Synchronization token for the MT_SAFE ACE_Select_Reactor. + ACE_SELECT_REACTOR_TOKEN token_; + + /// Adapter used to return internal lock to outside world. + ACE_Lock_Adapter lock_adapter_; + + /// Release the token lock when a Win32 structured exception occurs. + int release_token (void); + + /// Stops the VC++ compiler from bitching about exceptions and destructors + int handle_events_i (ACE_Time_Value *max_wait_time = 0); + + /// This flag is used to keep track of whether we are actively handling + /// events or not. + sig_atomic_t deactivated_; + +private: + /// Deny access since member-wise won't work... + ACE_UNIMPLEMENTED_FUNC (ACE_Select_Reactor_T (const ACE_Select_Reactor_T &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Select_Reactor_T &operator= (const ACE_Select_Reactor_T &) ) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Select_Reactor_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Select_Reactor_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Select_Reactor_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_SELECT_REACTOR_T_H */ diff --git a/externals/ace/Select_Reactor_T.inl b/externals/ace/Select_Reactor_T.inl new file mode 100644 index 0000000..30c8cbc --- /dev/null +++ b/externals/ace/Select_Reactor_T.inl @@ -0,0 +1,236 @@ +// -*- C++ -*- +// +// $Id: Select_Reactor_T.inl 82723 2008-09-16 09:35:44Z johnnyw $ + +#include "ace/Reactor.h" +#include "ace/Signal.h" +#include "ace/Sig_Handler.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_INLINE int +ACE_Select_Reactor_T::resume_handler (ACE_Event_Handler *h) +{ + ACE_TRACE ("ACE_Select_Reactor_T::resume_handler"); + return this->resume_handler (h->get_handle ()); +} + +template +ACE_INLINE int +ACE_Select_Reactor_T::resume_handler (const ACE_Handle_Set &handles) +{ + ACE_TRACE ("ACE_Select_Reactor_T::resume_handler"); + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + + ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->resume_i (h) == -1) + return -1; + + return 0; +} + +template +ACE_INLINE int +ACE_Select_Reactor_T::suspend_handler (ACE_Event_Handler *h) +{ + ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler"); + return this->suspend_handler (h->get_handle ()); +} + +template +ACE_INLINE int +ACE_Select_Reactor_T::suspend_handler (const ACE_Handle_Set &handles) +{ + ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler"); + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + + ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->suspend_i (h) == -1) + return -1; + + return 0; +} + +template +ACE_INLINE int +ACE_Select_Reactor_T::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, + ACE_Event_Handler **old_sh, + ACE_Sig_Action *old_disp) +{ + ACE_TRACE ("ACE_Select_Reactor_T::register_handler"); + return this->signal_handler_->register_handler (signum, + new_sh, new_disp, + old_sh, old_disp); +} + +#if defined (ACE_WIN32) + +template +ACE_INLINE int +ACE_Select_Reactor_T::register_handler (ACE_Event_Handler *, + ACE_HANDLE ) +{ + // Don't have an implementation for this yet... + ACE_NOTSUP_RETURN (-1); +} + +#endif /* ACE_WIN32 */ + +template +ACE_INLINE int +ACE_Select_Reactor_T::register_handler (ACE_HANDLE , + ACE_HANDLE , + ACE_Event_Handler *, + ACE_Reactor_Mask ) +{ + // Don't have an implementation for this yet... + ACE_NOTSUP_RETURN (-1); +} + +template +ACE_INLINE int +ACE_Select_Reactor_T::handler (int signum, ACE_Event_Handler **handler) +{ + ACE_TRACE ("ACE_Select_Reactor_T::handler"); + return this->handler_i (signum, handler); +} + +template +ACE_INLINE int +ACE_Select_Reactor_T::remove_handler (int signum, + ACE_Sig_Action *new_disp, + ACE_Sig_Action *old_disp, + int sigkey) +{ + ACE_TRACE ("ACE_Select_Reactor_T::remove_handler"); + return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey); +} + +template +ACE_INLINE bool +ACE_Select_Reactor_T::uses_event_associations (void) +{ + // Since the Select_Reactor does not do any event associations, this + // function always return false. + return false; +} + +// = The remaining methods in this file must be called with locks +// held. + +// Performs operations on the "ready" bits. + +template ACE_INLINE int +ACE_Select_Reactor_T::ready_ops (ACE_Event_Handler *handler, + ACE_Reactor_Mask mask, + int ops) +{ + ACE_TRACE ("ACE_Select_Reactor_T::ready_ops"); + return this->ready_ops (handler->get_handle (), mask, ops); +} + +// Performs operations on the "dispatch" masks. + +template ACE_INLINE int +ACE_Select_Reactor_T::mask_ops (ACE_Event_Handler *handler, + ACE_Reactor_Mask mask, + int ops) +{ + ACE_TRACE ("ACE_Select_Reactor_T::mask_ops"); + return this->mask_ops (handler->get_handle (), mask, ops); +} + +template ACE_INLINE int +ACE_Select_Reactor_T::schedule_wakeup (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup"); + return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK); +} + +template ACE_INLINE int +ACE_Select_Reactor_T::cancel_wakeup (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup"); + return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK); +} + +template ACE_INLINE int +ACE_Select_Reactor_T::schedule_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup"); + return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK); +} + +template ACE_INLINE int +ACE_Select_Reactor_T::cancel_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup"); + return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK); +} + +template ACE_INLINE ACE_Lock & +ACE_Select_Reactor_T::lock (void) +{ + ACE_TRACE ("ACE_Select_Reactor_T::lock"); + return this->lock_adapter_; +} + +template ACE_INLINE void +ACE_Select_Reactor_T::wakeup_all_threads (void) +{ + // Send a notification, but don't block if there's no one to receive + // it. + this->notify (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero); +} + +template ACE_INLINE int +ACE_Select_Reactor_T::alertable_handle_events (ACE_Time_Value *max_wait_time) +{ + return this->handle_events (max_wait_time); +} + +template ACE_INLINE int +ACE_Select_Reactor_T::alertable_handle_events (ACE_Time_Value &max_wait_time) +{ + return this->handle_events (max_wait_time); +} + +template ACE_INLINE int +ACE_Select_Reactor_T::deactivated (void) +{ + return this->deactivated_; +} + +template ACE_INLINE void +ACE_Select_Reactor_T::deactivate (int do_stop) +{ + { + ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, + ace_mon, + this->token_)); + this->deactivated_ = do_stop; + } + + this->wakeup_all_threads (); +} + +template ACE_INLINE size_t +ACE_Select_Reactor_T::size (void) const +{ + return this->handler_rep_.size (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Semaphore.cpp b/externals/ace/Semaphore.cpp new file mode 100644 index 0000000..2be156b --- /dev/null +++ b/externals/ace/Semaphore.cpp @@ -0,0 +1,64 @@ +// $Id: Semaphore.cpp 84282 2009-01-30 15:04:29Z msmit $ + +#include "ace/Semaphore.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Semaphore.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" +#include "ace/ACE.h" + +ACE_RCSID (ace, + Semaphore, + "$Id: Semaphore.cpp 84282 2009-01-30 15:04:29Z msmit $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Semaphore) + +void +ACE_Semaphore::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Semaphore::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Semaphore::ACE_Semaphore (unsigned int count, + int type, + const ACE_TCHAR *name, + void *arg, + int max) + : removed_ (false) +{ +// ACE_TRACE ("ACE_Semaphore::ACE_Semaphore"); +#if defined(ACE_LACKS_UNNAMED_SEMAPHORE) +// if the user does not provide a name, we generate a unique name here + ACE_TCHAR iname[ACE_UNIQUE_NAME_LEN]; + if (name == 0) + ACE::unique_name (this, iname, ACE_UNIQUE_NAME_LEN); + if (ACE_OS::sema_init (&this->semaphore_, count, type, + name ? name : iname, + arg, max) != 0) +#else + if (ACE_OS::sema_init (&this->semaphore_, count, type, + name, arg, max) != 0) +#endif + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Semaphore::ACE_Semaphore"))); +} + +ACE_Semaphore::~ACE_Semaphore (void) +{ +// ACE_TRACE ("ACE_Semaphore::~ACE_Semaphore"); + + this->remove (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Semaphore.h b/externals/ace/Semaphore.h new file mode 100644 index 0000000..7c4936a --- /dev/null +++ b/externals/ace/Semaphore.h @@ -0,0 +1,183 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Semaphore.h + * + * $Id: Semaphore.h 81014 2008-03-19 11:41:31Z johnnyw $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_SEMAPHORE_H +#define ACE_SEMAPHORE_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_Thread.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +/** + * @class ACE_Semaphore + * + * @brief Wrapper for Dijkstra style general semaphores. + */ +class ACE_Export ACE_Semaphore +{ +public: + // = Initialization and termination. + /// Initialize the semaphore, with initial value of "count". + ACE_Semaphore (unsigned int count = 1, // By default make this unlocked. + int type = USYNC_THREAD, + const ACE_TCHAR *name = 0, + void * = 0, + int max = 0x7fffffff); + + /// Implicitly destroy the semaphore. + ~ACE_Semaphore (void); + + /** + * Explicitly destroy the semaphore. Note that only one thread + * should call this method since it doesn't protect against race + * conditions. + */ + int remove (void); + + /// Block the thread until the semaphore count becomes + /// greater than 0, then decrement it. + int acquire (void); + + /** + * Block the thread until the semaphore count becomes greater than 0 + * (at which point it is decremented) or until @a tv times out (in + * which case -1 is returned and @c errno == @c ETIME). Note that @a tv + * is assumed to be in "absolute" rather than "relative" time. The + * value of @a tv is updated upon return to show the actual + * (absolute) acquisition time. + * + * @note Solaris threads do not support timed semaphores. + * Therefore, if you're running on Solaris you might want to + * consider using the ACE POSIX pthreads implementation instead, + * which can be enabled by compiling ACE with + * -DACE_HAS_PTHREADS, rather than -DACE_HAS_STHREADS or + * -DACE_HAS_POSIX_SEM. + */ + int acquire (ACE_Time_Value &tv); + + /** + * If @a tv == 0 then call directly. Otherwise, Block + * the thread until the semaphore count becomes greater than 0 + * (at which point it is decremented) or until @a tv times out (in + * which case -1 is returned and @c errno == @c ETIME). Note that + * <*tv> is assumed to be in "absolute" rather than "relative" time. + * The value of <*tv> is updated upon return to show the actual + * (absolute) acquisition time. + * + * @note Solaris threads do not support timed semaphores. + * Therefore, if you're running on Solaris you might want to + * consider using the ACE POSIX pthreads implementation instead, + * which can be enabled by compiling ACE with + * -DACE_HAS_PTHREADS, rather than -DACE_HAS_STHREADS or + * -DACE_HAS_POSIX_SEM. */ + int acquire (ACE_Time_Value *tv); + + /** + * Conditionally decrement the semaphore if count is greater than 0 + * (i.e., won't block). Returns -1 on failure. If we "failed" + * because someone else already had the lock, @c errno is set to + * @c EBUSY. + */ + int tryacquire (void); + + /// Increment the semaphore by 1, potentially unblocking a waiting + /// thread. + int release (void); + + /// Increment the semaphore by @a release_count, potentially + /// unblocking waiting threads. + int release (unsigned int release_count); + + /** + * Acquire semaphore ownership. This calls and is only + * here to make the ACE_Semaphore interface consistent with the + * other synchronization APIs. + */ + int acquire_read (void); + + /** + * Acquire semaphore ownership. This calls and is only + * here to make the ACE_Semaphore interface consistent with the + * other synchronization APIs. + */ + int acquire_write (void); + + /** + * Conditionally acquire semaphore (i.e., won't block). This calls + * and is only here to make the ACE_Semaphore + * interface consistent with the other synchronization APIs. + * Returns -1 on failure. If we "failed" because someone else + * already had the lock, @c errno is set to @c EBUSY. + */ + int tryacquire_read (void); + + /** + * Conditionally acquire semaphore (i.e., won't block). This calls + * and is only here to make the ACE_Semaphore + * interface consistent with the other synchronization APIs. + * Returns -1 on failure. If we "failed" because someone else + * already had the lock, @c errno is set to @c EBUSY. + */ + int tryacquire_write (void); + + /** + * This is only here to make the ACE_Semaphore + * interface consistent with the other synchronization APIs. + * Assumes the caller has already acquired the semaphore using one of + * the above calls, and returns 0 (success) always. + */ + int tryacquire_write_upgrade (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /// Return the underlying lock. + const ACE_sema_t &lock (void) const; + +protected: + ACE_sema_t semaphore_; + + /// Keeps track of whether remove() has been called yet to avoid + /// multiple remove() calls, e.g., explicitly and implicitly in the + /// destructor. This flag isn't protected by a lock, so make sure + /// that you don't have multiple threads simultaneously calling + /// remove () on the same object, which is a bad idea anyway... + bool removed_; + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Semaphore &); + ACE_Semaphore (const ACE_Semaphore &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Semaphore.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_SEMAPHORE_H */ diff --git a/externals/ace/Semaphore.inl b/externals/ace/Semaphore.inl new file mode 100644 index 0000000..e0162dc --- /dev/null +++ b/externals/ace/Semaphore.inl @@ -0,0 +1,119 @@ +// -*- C++ -*- +// +// $Id: Semaphore.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE const ACE_sema_t & +ACE_Semaphore::lock (void) const +{ +// ACE_TRACE ("ACE_Semaphore::lock"); + return this->semaphore_; +} + +ACE_INLINE int +ACE_Semaphore::remove (void) +{ +// ACE_TRACE ("ACE_Semaphore::remove"); + int result = 0; + if (!this->removed_) + { + this->removed_ = true; + result = ACE_OS::sema_destroy (&this->semaphore_); + } + return result; +} + +ACE_INLINE int +ACE_Semaphore::acquire (void) +{ +// ACE_TRACE ("ACE_Semaphore::acquire"); + return ACE_OS::sema_wait (&this->semaphore_); +} + +ACE_INLINE int +ACE_Semaphore::acquire (ACE_Time_Value &tv) +{ +// ACE_TRACE ("ACE_Semaphore::acquire"); + return ACE_OS::sema_wait (&this->semaphore_, tv); +} + +ACE_INLINE int +ACE_Semaphore::acquire (ACE_Time_Value *tv) +{ +// ACE_TRACE ("ACE_Semaphore::acquire"); + return ACE_OS::sema_wait (&this->semaphore_, tv); +} + +ACE_INLINE int +ACE_Semaphore::tryacquire (void) +{ +// ACE_TRACE ("ACE_Semaphore::tryacquire"); + return ACE_OS::sema_trywait (&this->semaphore_); +} + +ACE_INLINE int +ACE_Semaphore::release (void) +{ +// ACE_TRACE ("ACE_Semaphore::release"); + return ACE_OS::sema_post (&this->semaphore_); +} + +ACE_INLINE int +ACE_Semaphore::release (unsigned int release_count) +{ +// ACE_TRACE ("ACE_Semaphore::release"); + return ACE_OS::sema_post (&this->semaphore_, release_count); +} + +// Acquire semaphore ownership. This calls and is only +// here to make the interface consistent with the +// other synchronization APIs. + +ACE_INLINE int +ACE_Semaphore::acquire_read (void) +{ + return this->acquire (); +} + +// Acquire semaphore ownership. This calls and is only +// here to make the interface consistent with the +// other synchronization APIs. + +ACE_INLINE int +ACE_Semaphore::acquire_write (void) +{ + return this->acquire (); +} + +// Conditionally acquire semaphore (i.e., won't block). This calls +// and is only here to make the +// interface consistent with the other synchronization APIs. + +ACE_INLINE int +ACE_Semaphore::tryacquire_read (void) +{ + return this->tryacquire (); +} + +// Conditionally acquire semaphore (i.e., won't block). This calls +// and is only here to make the +// interface consistent with the other synchronization APIs. + +ACE_INLINE int +ACE_Semaphore::tryacquire_write (void) +{ + return this->tryacquire (); +} + +// This is only here to make the interface consistent +// with the other synchronization APIs. Assumes the caller has +// already acquired the semaphore using one of the above calls, and +// returns 0 (success) always. +ACE_INLINE int +ACE_Semaphore::tryacquire_write_upgrade (void) +{ + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Config.cpp b/externals/ace/Service_Config.cpp new file mode 100644 index 0000000..b1ec032 --- /dev/null +++ b/externals/ace/Service_Config.cpp @@ -0,0 +1,610 @@ +// $Id: Service_Config.cpp 84619 2009-02-26 12:26:16Z johnnyw $ + +#include "ace/Service_Config.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Service_Config.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Service_Types.h" +#include "ace/Reactor.h" +#include "ace/Singleton.h" +#include "ace/Service_Repository.h" + +#ifndef ACE_LACKS_UNIX_SIGNALS +# include "ace/Sig_Adapter.h" +#endif /* !ACE_LACKS_UNIX_SIGNALS */ + +#include "ace/OS_NS_time.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_unistd.h" +#include "ace/Thread.h" +#include "ace/Get_Opt.h" +#include "ace/ARGV.h" +#include "ace/Log_Msg.h" +#include "ace/ACE.h" + +ACE_RCSID (ace, + Service_Config, + "$Id: Service_Config.cpp 84619 2009-02-26 12:26:16Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Threading_Helper::~ACE_Threading_Helper () +{ + ACE_OS::thr_key_detach (this->key_, 0); + ACE_OS::thr_keyfree (this->key_); +} + +ACE_Threading_Helper::ACE_Threading_Helper () + : key_ (ACE_OS::NULL_key) +{ +# if defined (ACE_HAS_TSS_EMULATION) + ACE_Object_Manager::init_tss (); +# endif + + if (ACE_Thread::keycreate (&key_, 0, 0) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Failed to create thread key: %p\n"), + ACE_TEXT (""))); + } +} + +void +ACE_Threading_Helper::set (void* p) +{ + if (ACE_Thread::setspecific (key_, p) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Service Config failed to set thread key value: %p\n"), + ACE_TEXT(""))); +} + +void* +ACE_Threading_Helper::get (void) +{ + void* temp = 0; + if (ACE_Thread::getspecific (key_, &temp) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Service Config failed to get thread key value: %p\n"), + ACE_TEXT("")), + 0); + return temp; +} + +ACE_Threading_Helper::~ACE_Threading_Helper () +{ +} + +ACE_Threading_Helper::ACE_Threading_Helper () +{ +} + +void +ACE_Threading_Helper::set (void*) +{ +} + +void* +ACE_Threading_Helper::get (void) +{ + return ACE_Service_Config::singleton()->instance_.get (); +} + +/** + * @c ACE_Service_Config is supposed to be a Singleton. This is the + * only Configuration Gestalt available for access from static + * initializers at proces start-up time. Using Unmanaged Singleton + * is safer because (a) the Object Manager may not yet be fully initialized + * in the context of a static initializer that uses SC, and (b) because we + * know that upon process exit the SC will still be automaticaly and explicitly + * closed by @c ACE_Object_Manager::fini(). + */ +typedef ACE_Unmanaged_Singleton ACE_SERVICE_CONFIG_SINGLETON; + + +/// ctor +ACE_Service_Config_Guard::ACE_Service_Config_Guard (ACE_Service_Gestalt * psg) + : saved_ (ACE_Service_Config::current ()) +{ + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) - SCG:") + ACE_TEXT (" - config=%@ repo=%@ superceded by repo=%@\n"), + this, + this->saved_.get (), + this->saved_->repo_, + psg->repo_)); + + // Modify the TSS if the repo has changed + ACE_Service_Config::current (psg); +} + +ACE_Service_Config_Guard::~ACE_Service_Config_Guard (void) +{ + ACE_Service_Gestalt* s = this->saved_.get (); + ACE_ASSERT (s != 0); + + ACE_Service_Config::current (s); + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SCG:") + ACE_TEXT (" - new repo=%@\n"), + this, + this->saved_->repo_)); +} + + +ACE_ALLOC_HOOK_DEFINE (ACE_Service_Config) + +// Set the signal handler to point to the handle_signal() function. +ACE_Sig_Adapter *ACE_Service_Config::signal_handler_ = 0; + +// Trigger a reconfiguration. +sig_atomic_t ACE_Service_Config::reconfig_occurred_ = 0; + +// = Set by command-line options. + +/// Pathname of file to write process id. +ACE_TCHAR *ACE_Service_Config::pid_file_name_ = 0; + +/// Shall we become a daemon process? +bool ACE_Service_Config::be_a_daemon_ = false; + +/// Number of the signal used to trigger reconfiguration. +int ACE_Service_Config::signum_ = SIGHUP; + +void +ACE_Service_Config::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Config::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[]) +{ + ACE_TRACE ("ACE_Service_Config::parse_args_i"); + + // Using PERMUTE_ARGS (default) in order to have all + // unrecognized options and their value arguments moved + // to the end of the argument vector. We'll pick them up + // after processing our options and pass them on to the + // base class for further parsing. + //FUZZ: disable check_for_lack_ACE_OS + ACE_Get_Opt getopt (argc, + argv, + ACE_TEXT ("bs:p:"), + 1 , // Start at argv[1]. + 0, // Do not report errors + ACE_Get_Opt::RETURN_IN_ORDER); + //FUZZ: enable check_for_lack_ACE_OS + + //FUZZ: disable check_for_lack_ACE_OS + for (int c; (c = getopt ()) != -1; ) + //FUZZ: enable check_for_lack_ACE_OS + switch (c) + { + case 'p': + ACE_Service_Config::pid_file_name_ = getopt.opt_arg (); + break; + case 'b': + ACE_Service_Config::be_a_daemon_ = true; + break; + case 's': + { + // There's no point in dealing with this on NT since it + // doesn't really support signals very well... +#if !defined (ACE_LACKS_UNIX_SIGNALS) + ACE_Service_Config::signum_ = + ACE_OS::atoi (getopt.opt_arg ()); + + if (ACE_Reactor::instance ()->register_handler + (ACE_Service_Config::signum_, + ACE_Service_Config::signal_handler_) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("cannot obtain signal handler\n")), + -1); +#endif /* ACE_LACKS_UNIX_SIGNALS */ + break; + } + default:; // unknown arguments are benign + + } + + return 0; +} /* parse_args_i () */ + + +int +ACE_Service_Config::open_i (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key, + bool , + bool , + bool ) +{ + ACE_TRACE ("ACE_Service_Config::open_i"); + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); + + ACE_Log_Msg *log_msg = ACE_LOG_MSG; + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SC::open_i - this=%@, opened=%d\n"), + this, this->is_opened_)); + + // Guard against reentrant processing. + if (this->is_opened_) + return 0; + + this->is_opened_ = true; + + // Check for things we need to do on a per-process basis and which + // may not be safe, or wise to do an a per instance basis + + // Become a daemon before doing anything else. + if (ACE_Service_Config::be_a_daemon_) + ACE::daemonize (); + + // Write process id to file. + if (this->pid_file_name_ != 0) + { + FILE* pidf = ACE_OS::fopen (this->pid_file_name_, + ACE_TEXT("w")); + + if (pidf != 0) + { + ACE_OS::fprintf (pidf, + "%ld\n", + static_cast (ACE_OS::getpid())); + ACE_OS::fclose (pidf); + } + } + + u_long flags = log_msg->flags (); + + // Only use STDERR if the caller hasn't already set the flags. + if (flags == 0) + flags = (u_long) ACE_Log_Msg::STDERR; + + const ACE_TCHAR *key = logger_key; + + if (key == 0 || ACE_OS::strcmp (key, ACE_DEFAULT_LOGGER_KEY) == 0) + { + // Only use the static if the caller doesn't + // override it in the parameter list or if the key supplied is + // equal to the default static logger key. + key = ACE_Service_Config::current()->logger_key_; + } + else + { + ACE_SET_BITS (flags, ACE_Log_Msg::LOGGER); + } + + if (log_msg->open (program_name, + flags, + key) == -1) + return -1; + + if (ACE::debug ()) + ACE_DEBUG ((LM_STARTUP, + ACE_TEXT ("starting up daemon %n\n"))); + + // Initialize the Service Repository (this will still work if + // user forgets to define an object of type ACE_Service_Config). + ACE_Service_Repository::instance (ACE_Service_Gestalt::MAX_SERVICES); + + // Initialize the ACE_Reactor (the ACE_Reactor should be the + // same size as the ACE_Service_Repository). + ACE_Reactor::instance (); + + // There's no point in dealing with this on NT since it doesn't + // really support signals very well... +#if !defined (ACE_LACKS_UNIX_SIGNALS) + // Only attempt to register a signal handler for positive + // signal numbers. + if (ACE_Service_Config::signum_ > 0) + { + ACE_Sig_Set ss; + ss.sig_add (ACE_Service_Config::signum_); + if ((ACE_Reactor::instance () != 0) && + (ACE_Reactor::instance ()->register_handler + (ss, ACE_Service_Config::signal_handler_) == -1)) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("can't register signal handler\n"))); + } +#endif /* ACE_LACKS_UNIX_SIGNALS */ + + return 0; +} + +/// Return the global configuration instance. Always returns the same +/// instance +ACE_Service_Config * +ACE_Service_Config::singleton (void) +{ + return ACE_SERVICE_CONFIG_SINGLETON::instance (); +} + +int +ACE_Service_Config::insert (ACE_Static_Svc_Descriptor* stsd) +{ + return ACE_Service_Config::instance ()->insert (stsd); +} + + +// Totally remove from the daemon by removing it from the +// ACE_Reactor, and unlinking it if necessary. +int +ACE_Service_Config::remove (const ACE_TCHAR svc_name[]) +{ + ACE_TRACE ("ACE_Service_Config::remove"); + return ACE_Service_Repository::instance ()->remove (svc_name); +} + +// Suspend . Note that this will not unlink the service +// from the daemon if it was dynamically linked, it will mark it as +// being suspended in the Service Repository and call the +// member function on the appropriate . A service +// can be resumed later on by calling the method... + +int +ACE_Service_Config::suspend (const ACE_TCHAR svc_name[]) +{ + ACE_TRACE ("ACE_Service_Config::suspend"); + return ACE_Service_Repository::instance ()->suspend (svc_name); +} + +// Resume a SVC_NAME that was previously suspended or has not yet +// been resumed (e.g., a static service). + +int +ACE_Service_Config::resume (const ACE_TCHAR svc_name[]) +{ + ACE_TRACE ("ACE_Service_Config::resume"); + return ACE_Service_Repository::instance ()->resume (svc_name); +} + + +ACE_Service_Config::ACE_Service_Config (bool ignore_static_svcs, + size_t size, + int signum) +{ + ACE_TRACE ("ACE_Service_Config::ACE_Service_Config"); + + // TODO: Need to find a more customizable way of instantiating the + // gestalt but perhaps we should leave this out untill such + // customizations are identified. + ACE_Service_Gestalt* tmp = 0; + ACE_NEW_NORETURN (tmp, + ACE_Service_Gestalt (size, false, ignore_static_svcs)); + + this->is_opened_ = false; + this->instance_ = tmp; + this->threadkey_.set (tmp); + + ACE_Service_Config::signum_ = signum; +} + +ACE_Service_Config::ACE_Service_Config (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key) +{ + ACE_TRACE ("ACE_Service_Config::ACE_Service_Config"); + + // TODO: Need to find a more customizable way of instantiating the + // gestalt but perhaps we should leave this out untill such + // customizations are identified. + ACE_Service_Gestalt* tmp = 0; + ACE_NEW_NORETURN (tmp, + ACE_Service_Gestalt (ACE_Service_Repository::DEFAULT_SIZE, false)); + + this->is_opened_ = false; + this->instance_ = tmp; + this->threadkey_.set (tmp); + + if (this->open (program_name, + logger_key) == -1 && errno != ENOENT) + { + // Only print out an error if it wasn't the svc.conf file that was + // missing. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) SC failed to open: %p\n"), + program_name)); + } +} + +/// Return the "global" configuration instance, for the current +/// thread. This may be the same as instance(), but on some occasions, +/// it may be a different one. For example, ACE_Service_Config_Guard +/// provides a way of temporarily replacing the "current" +/// configuration instance in the context of a thread. +ACE_Service_Gestalt* +ACE_Service_Config::current (void) +{ + void* temp = ACE_Service_Config::singleton()->threadkey_.get (); + if (temp == 0) { + + // The most likely reason is that the current thread was spawned + // by some native primitive, like pthreads or Windows API - not + // from ACE. This is perfectly legal for callers who are not, or + // do not need to be ACE-aware. Such callers must have no + // expectation that the pluggable, multi-context configuration + // support will work - they would always get the global context, + // because at this point there is no information what the "parent" + // thread's configuration context was. + + temp = global(); + singleton()->threadkey_.set (temp); + } + + return static_cast (temp); +} + +/// A mutator to set the "current" (TSS) gestalt instance. +void +ACE_Service_Config::current (ACE_Service_Gestalt* newcurrent) +{ + ACE_Service_Config::singleton()->threadkey_.set (newcurrent); +} + + + +#if (ACE_USES_CLASSIC_SVC_CONF == 0) +ACE_Service_Type * +ACE_Service_Config::create_service_type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *o, + ACE_DLL &dll, + int active) +{ + ACE_Service_Type *sp = 0; + ACE_NEW_RETURN (sp, + ACE_Service_Type (n, o, dll, active), + 0); + return sp; +} +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ + +ACE_Service_Type_Impl * +ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name, + int type, + void *symbol, + u_int flags, + ACE_Service_Object_Exterminator gobbler) +{ + ACE_Service_Type_Impl *stp = 0; + + // Note, the only place we need to put a case statement. This is + // also the place where we'd put the RTTI tests, if the compiler + // actually supported them! + + switch (type) + { + case ACE_Service_Type::SERVICE_OBJECT: + ACE_NEW_RETURN (stp, + ACE_Service_Object_Type ((ACE_Service_Object *) symbol, + name, flags, + gobbler), + 0); + break; + case ACE_Service_Type::MODULE: + ACE_NEW_RETURN (stp, + ACE_Module_Type (symbol, name, flags), + 0); + break; + case ACE_Service_Type::STREAM: + ACE_NEW_RETURN (stp, + ACE_Stream_Type (symbol, name, flags), + 0); + break; + default: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("unknown case\n"))); + break; + } + return stp; + +} + + +// Signal handling API to trigger dynamic reconfiguration. +void +ACE_Service_Config::handle_signal (int sig, + siginfo_t *, + ucontext_t *) +{ +#if defined (ACE_NDEBUG) + ACE_UNUSED_ARG (sig); +#else /* ! ACE_NDEBUG */ + ACE_ASSERT (ACE_Service_Config::signum_ == sig); +#endif /* ! ACE_NDEBUG */ + + ACE_Service_Config::reconfig_occurred_ = 1; +} + +// Trigger reconfiguration to re-read configuration files. +void +ACE_Service_Config::reconfigure (void) +{ + ACE_TRACE ("ACE_Service_Config::reconfigure"); + + ACE_Service_Config::reconfig_occurred_ = 0; + + if (ACE::debug ()) + { +#if !defined (ACE_NLOGGING) + time_t t = ACE_OS::time (0); +#endif /* ! ACE_NLOGGING */ + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("beginning reconfiguration at %s"), + ACE_OS::ctime (&t))); + } + if (ACE_Service_Config::process_directives () == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("process_directives"))); +} + +// Tidy up and perform last rites on a terminating ACE_Service_Config. +int +ACE_Service_Config::close (void) +{ + ACE_Service_Config::singleton ()->instance_->close (); + + // Delete the service repository. All the objects inside the + // service repository should already have been finalized. + ACE_Service_Repository::close_singleton (); + + // Do away with the singleton ACE_Service_Config (calls dtor) + ACE_SERVICE_CONFIG_SINGLETON::close (); + + return 0; +} + + +int +ACE_Service_Config::fini_svcs (void) +{ + ACE_TRACE ("ACE_Service_Config::fini_svcs"); + + // Clear the LM_DEBUG bit from log messages if appropriate + if (ACE::debug ()) + ACE_Log_Msg::disable_debug_messages (); + + int result = 0; + if (ACE_Service_Repository::instance () != 0) + result = ACE_Service_Repository::instance ()->fini (); + + if (ACE::debug ()) + ACE_Log_Msg::enable_debug_messages (); + + return result; +} + +/// Perform user-specified close activities and remove dynamic memory. +ACE_Service_Config::~ACE_Service_Config (void) +{ + ACE_TRACE ("ACE_Service_Config::~ACE_Service_Config"); +} + +// ************************************************************ + +/* static */ +int +ACE_Service_Config::reconfig_occurred (void) +{ + ACE_TRACE ("ACE_Service_Config::reconfig_occurred"); + return ACE_Service_Config::reconfig_occurred_ != 0; +} + +void +ACE_Service_Config::reconfig_occurred (int config_occurred) +{ + ACE_TRACE ("ACE_Service_Config::reconfig_occurred"); + ACE_Service_Config::reconfig_occurred_ = config_occurred; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Config.h b/externals/ace/Service_Config.h new file mode 100644 index 0000000..5269d8f --- /dev/null +++ b/externals/ace/Service_Config.h @@ -0,0 +1,692 @@ +// -*- C++ -*- + +//==================================================================== +/** + * @file Service_Config.h + * + * $Id: Service_Config.h 89501 2010-03-17 08:59:56Z vzykov $ + * + * @author Douglas C. Schmidt + */ +//==================================================================== + +#ifndef ACE_SERVICE_CONFIG_H +#define ACE_SERVICE_CONFIG_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/Default_Constants.h" +#include "ace/Intrusive_Auto_Ptr.h" +#include "ace/Service_Gestalt.h" +#include "ace/Synch_Traits.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_signal.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decl. +class ACE_Service_Object; +class ACE_Service_Type; +class ACE_Service_Type_Impl; +class ACE_Service_Repository; +class ACE_Sig_Adapter; +class ACE_Allocator; +class ACE_Reactor; +class ACE_Thread_Manager; +class ACE_DLL; + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) +#define ACE_STATIC_SERVICE_DIRECTIVE(ident, parameters) \ + ACE_TEXT ("static ") \ + ACE_TEXT (ident) \ + ACE_TEXT (" \"") \ + ACE_TEXT (parameters) \ + ACE_TEXT ("\"") +#define ACE_DYNAMIC_SERVICE_DIRECTIVE(ident, libpathname, objectclass, parameters) \ + ACE_TEXT ("dynamic ") \ + ACE_TEXT (ident) \ + ACE_TEXT (" Service_Object * ") \ + ACE_TEXT (libpathname) \ + ACE_TEXT (":") \ + ACE_TEXT (objectclass) \ + ACE_TEXT ("() \"") \ + ACE_TEXT (parameters) \ + ACE_TEXT ("\"") +#define ACE_REMOVE_SERVICE_DIRECTIVE(ident) \ + ACE_TEXT ("remove ") \ + ACE_TEXT (ident) +class ACE_Svc_Conf_Param; +#else +#define ACE_STATIC_SERVICE_DIRECTIVE(ident, parameters) \ + ACE_TEXT ("") +#define ACE_DYNAMIC_SERVICE_DIRECTIVE(ident, libpathname, objectclass, parameters) \ + ACE_TEXT ("") \ + ACE_TEXT ("") +#define ACE_REMOVE_SERVICE_DIRECTIVE(ident) \ + ACE_TEXT ("") +class ACE_XML_Svc_Conf; +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +extern "C" +{ + typedef ACE_Service_Object *(*ACE_SERVICE_ALLOCATOR) (ACE_Service_Object_Exterminator *); +} + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Static_Svc_Descriptor + * + * @brief Holds the information necessary to describe a statically linked + * Svc. + */ +class ACE_Static_Svc_Descriptor +{ +public: + /// Name of the service. + const ACE_TCHAR *name_; + + /// Type of service. + int type_; + + /// Factory function that allocates the service. + ACE_SERVICE_ALLOCATOR alloc_; + + /// Bitmask flags indicating how the framework should delete memory. + u_int flags_; + + /// Flag indicating whether the service starts out active. + int active_; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +public: + /// Compare two service descriptors for equality. + bool operator== (ACE_Static_Svc_Descriptor &) const; + + /// Compare two service descriptors for inequality. + bool operator!= (ACE_Static_Svc_Descriptor &) const; +}; + + +/** + * @class ACE_Threading_Helper + * + * @brief Encapsulates responsibility for allocating, destroying and + * manipulating the value, associated with a thread-specific + * key. Relates to the ability of the created thread to inherit the + * parent thread's gestalt. Designed to be used as an instance member + * of @c ACE_Service_Config. + * + * Partial specialization over ACE_SYNCH_MUTEX is used to implement + * specific behavior in both multi- and single-threaded builds. + */ +template +class ACE_Threading_Helper +{ +}; + +/* + * Specialization for a multi threaded program + */ +template<> +class ACE_Export ACE_Threading_Helper +{ +public: + ACE_Threading_Helper (); + ~ACE_Threading_Helper (); + + void set (void*); + void* get (void); + +private: + /// Key for the thread-specific data, which is a simple pointer to + /// the thread's (currently-) global configuration context. + ACE_thread_key_t key_; +}; + +/* + * Specialization for a single threaded program + */ +template<> +class ACE_Export ACE_Threading_Helper +{ +public: + ACE_Threading_Helper (); + ~ACE_Threading_Helper (); + + void set (void*); + void* get (void); +}; + +#define ACE_Component_Config ACE_Service_Config + +/** + * @class ACE_Service_Config + * + * @brief Supplies common server operations for dynamic and static + * configuration of service. + * + * The ACE_Service_Config uses the Monostate pattern. Therefore, + * you can only have one of these instantiated per-process. It + * represents the process-wide collection of services, which is + * typicaly shared among all other configurable entities. The only + * ACE_Service_Config instance is registered with and owned by the + * ACE_Object_Manager. + * + * By contrast, the ACE_Service_Gestalt represents the collection + * of services, pertaining to a configurable entity. Typicaly, a + * "configurable entity" is an instance, which owns an instance of + * ACE_Service_Gestalt in order to ensure full controll over the + * services it needs. + * + * Another facet of ACE_Service_Config is that for a given thread, + * it provides access to its current, process-global + * ACE_Service_Gestalt instance through its curent() method. + * + * @note The signal_handler_ static member is allocated by the + * ACE_Object_Manager. The ACE_Service_Config constructor + * uses signal_handler_. Therefore, if the program has any + * static ACE_Service_Config objects, there might be + * initialization order problems. They can be minimized, but + * not eliminated, by _not_ #defining + * ACE_HAS_NONSTATIC_OBJECT_MANAGER. + */ +class ACE_Export ACE_Service_Config +{ + + /// The Instance, or the global (default) configuration context. + /// The monostate would forward the calls to that instance. The TSS + /// will point here + ACE_Intrusive_Auto_Ptr instance_; + + /// A helper instance to manage thread-specific key creation. + /// Dependent on the syncronization mutex ACE uses, the corresponding + /// partial template instantiation will perform the right services + /// that have to do with managing thread-specific storage. Note that, + /// for single-threaded builds they would do (next to) nothing. + ACE_Threading_Helper threadkey_; + +public: + + // = Initialization and termination methods. + + /** + * Initialize the Service Repository. Note that initialising @a + * signum to a negative number will prevent a signal handler being + * registered when the repository is opened. + */ + ACE_Service_Config (bool ignore_static_svcs = true, + size_t size = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE, + int signum = SIGHUP); + + /** + * Performs an open without parsing command-line arguments. The + * @a logger_key indicates where to write the logging output, which + * is typically either a STREAM pipe or a socket address. + */ + ACE_Service_Config (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key = ACE_DEFAULT_LOGGER_KEY); + + /// Perform user-specified close activities and remove dynamic + /// memory. + virtual ~ACE_Service_Config (void); + +private: + + /** + * Performs an open without parsing command-line arguments. + * Implements whats different in the opening sequence + * for this class, as opposed to the base class. + * + * The @a logger_key indicates where to write the logging output, which + * is typically either a STREAM pipe or a socket address. If + * @a ignore_default_svc_conf_file is non-0 then the "svc.conf" file + * will be ignored. If @a ignore_debug_flag is non-0 then the + * application is responsible for setting the + * @c ACE_Log_Msg::priority_mask() appropriately. Returns number of + * errors that occurred on failure and 0 otherwise. + */ + virtual int open_i (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf_file, + bool ignore_debug_flag); + + /** + * Implements whats different in the command line parameter processing + * for this class, as opposed to the base class. + */ + virtual int parse_args_i (int argc, ACE_TCHAR *argv[]); + + /// = Static interfaces + + public: + /** + * Returns the process-wide global singleton instance. It would + * have been created and will be managed by the Object Manager. + */ + static ACE_Service_Config* singleton (void); + + /** + * Mutator for the currently active configuration context instance + * (gestalt). Intended for use by helper classes like @see + * ACE_Service_Config_Guard. Stack-based instances can be used to + * temporarily change which gestalt is seen as global by static + * initializers (especially those in DLLs loaded at run-time). + */ + static void current (ACE_Service_Gestalt*); + + /** + * Accessor for the "current" service gestalt + */ + static ACE_Service_Gestalt* current (void); + + /** + * This is what the static service initializators are hard-wired to + * use, so in order to avoid interface changes this method merely + * forwards to @c ACE_Service_Config::current. This enables us to + * enforce which Service Gestalt is used for services registering + * through static initializers. Especially important for DLL-based + * dynamic services, which can contain their own static services and + * static initializers. + * + * @deprecated Use current() instead. + */ + static ACE_Service_Gestalt* instance (void); + + /** + * Returns a process-wide global singleton instance in contrast with + * current (), which may return a different instance at different + * times, dependent on the context. Modifying this method's return + * value is strongly discouraged as it will circumvent the mechanism + * for dynamically loading services. If you must, use with extreme + * caution! + */ + static ACE_Service_Gestalt* global (void); + + /** + * Performs an open without parsing command-line arguments. The + * @a logger_key indicates where to write the logging output, which + * is typically either a STREAM pipe or a socket address. If + * @a ignore_static_svcs is true then static services are not loaded, + * otherwise, they are loaded. If @a ignore_default_svc_conf_file is + * non-0 then the configuration file will be ignored. + * Returns zero upon success, -1 if the file is not found or cannot + * be opened (errno is set accordingly), otherwise returns the + * number of errors encountered loading the services in the + * specified svc.conf configuration file. If @a ignore_debug_flag is + * non-0 then the application is responsible for setting the + * @c ACE_Log_Msg::priority_mask appropriately. + */ + static int open (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key = ACE_DEFAULT_LOGGER_KEY, + bool ignore_static_svcs = true, + bool ignore_default_svc_conf_file = false, + bool ignore_debug_flag = false); + + /** + * This is the primary entry point into the ACE_Service_Config (the + * constructor just handles simple initializations). It parses + * arguments passed in from @a argc and @a argv parameters. The + * arguments that are valid in a call to this method include: + * + * - '-b' Option to indicate that we should be a daemon. Note that when + * this option is used, the process will be daemonized before the + * service configuration file(s) are read. During daemonization, + * (on POSIX systems) the current directory will be changed to "/" + * so the caller should either fully specify the file names, or + * execute a @c chroot() to the appropriate directory. + * @sa ACE::daemonize(). + * - '-d' Turn on debugging mode + * - '-f' Specifies a configuration file name other than the default + * svc.conf. Can be specified multiple times to use multiple files. + * If any configuration file is provided with this option then + * the default svc.conf will be ignored. + * - '-k' Specifies the rendezvous point to use for the ACE distributed + * logger. + * - '-y' Explicitly enables the use of static services. This flag + * overrides the @a ignore_static_svcs parameter value. + * - '-n' Explicitly disables the use of static services. This flag + * overrides the @a ignore_static_svcs parameter value. + * - '-p' Specifies a pathname which is used to store the process id. + * - '-s' Specifies a signal number other than SIGHUP to trigger reprocessing + * of the configuration file(s). Ignored for platforms that do not + * have POSIX signals, such as Windows. + * - '-S' Specifies a service directive string. Enclose the string in quotes + * and escape any embedded quotes with a backslash. This option + * specifies service directives without the need for a configuration + * file. Can be specified multiple times. + * + * Note: Options '-f' and '-S' complement each other. Directives from files + * and from '-S' option are processed together in the following order. First, + * all files are processed in the order they are specified in @a argv + * parameter. Second, all directive strings are executed in the order the + * directives appear in @a argv parameter. + * + * @param argc The number of commandline arguments. + * @param argv The array with commandline arguments + * @param logger_key Indicates where to write the logging output, + * which is typically either a STREAM pipe or a + * socket address. + * @param ignore_static_svcs If true then static services are not loaded, + * otherwise, they are loaded. + * @param ignore_default_svc_conf_file If non-0 then the @c svc.conf + * configuration file will be ignored. + * @param ignore_debug_flag If true then the application is responsible + * for setting the @c ACE_Log_Msg::priority_mask + * appropriately. + * + * @retval -1 The configuration file is not found or cannot + * be opened (errno is set accordingly). + * @retval 0 Success. + * @retval >0 The number of errors encountered while processing + * the service configuration file(s). + */ + static int open (int argc, + ACE_TCHAR *argv[], + const ACE_TCHAR *logger_key = ACE_DEFAULT_LOGGER_KEY, + bool ignore_static_svcs = true, + bool ignore_default_svc_conf_file = false, + bool ignore_debug_flag = false); + + /// Tidy up and perform last rites when ACE_Service_Config is shut + /// down. This method calls close_svcs(). Returns 0. + static int close (void); + + /// Perform user-specified close hooks and possibly delete all of the + /// configured services in the . + static int fini_svcs (void); + + /// True if reconfiguration occurred. + static int reconfig_occurred (void); + + /// Indicate that reconfiguration occurred. + static void reconfig_occurred (int); + + /// Perform the reconfiguration process. + static void reconfigure (void); + + // = The following methods are static in order to enforce Singleton + // semantics for the Reactor, Service_Repository, Thread_Manager, + // and Acceptor/Connector Strategy factory. Other portions of the + // system may need to access them at some point or another... + + // = This is not strictly needed, anymore since the service configurator + // has been refactored to allow multiple service configuration + // instances (called gestalts). The interfaces, however were retained in for + // the sake of maintaining source-code compatibility. + + + // = Accessors and mutators for process-wide Singletons. + + /// Returns a pointer to the list of statically linked services. + /// + /// @deprecated - Same as instance(), but still useful in legacy code, + /// (notably, one that can not be easily modified) which uses the following + /// idiom for registering static services: + /// + /// ACE_Service_Config::static_svcs ()->insert (...); + static ACE_Service_Gestalt* static_svcs (void); + + /// Insert a static service descriptor for processing on open_i(). The + /// corresponding ACE_STATIC_SVC_* macros were chaged to use this method + /// instead of obtaining a ptr to a container. See the note on static_svcs(). + /// Added to prevent exposing the internal storage representation of the + /// services repository and provide a better way of debugging service + /// loading and registration problems. + static int insert (ACE_Static_Svc_Descriptor *svc); + + // = Utility methods. + /// Dynamically link the shared object file and retrieve a pointer to + /// the designated shared object in this file. + static int initialize (const ACE_Service_Type *, + const ACE_TCHAR *parameters); + + /// Initialize and activate a statically @a svc_name service. + static int initialize (const ACE_TCHAR *svc_name, + const ACE_TCHAR *parameters); + + /// Resume a @a svc_name that was previously suspended or has not yet + /// been resumed (e.g., a static service). + static int resume (const ACE_TCHAR svc_name[]); + + /** + * Suspend @a svc_name. Note that this will not unlink the service + * from the daemon if it was dynamically linked, it will mark it as + * being suspended in the Service Repository and call the + * member function on the appropriate ACE_Service_Object. A + * service can be resumed later on by calling the member + * function... + */ + static int suspend (const ACE_TCHAR svc_name[]); + + /// Totally remove @a svc_name from the daemon by removing it + /// from the ACE_Reactor, and unlinking it if necessary. + static int remove (const ACE_TCHAR svc_name[]); + +#if defined (ACE_HAS_WINCE) && defined (ACE_USES_WCHAR) + // We must provide these function to bridge the Svc_Conf parser + // with ACE. + static int initialize (const ACE_Service_Type *, ACE_ANTI_TCHAR []); + static int initialize (const char svc_name[], ACE_ANTI_TCHAR parameters[]); + static int resume (const ACE_ANTI_TCHAR svc_name[]); + static int suspend (const ACE_ANTI_TCHAR svc_name[]); + static int remove (const ACE_ANTI_TCHAR svc_name[]); +#endif /* ACE_HAS_WINCE */ + + /// Dump the state of an object. + void dump (void) const; + + /// Set the signal_handler;for internal use by ACE_Object_Manager only. + static ACE_INLINE void signal_handler (ACE_Sig_Adapter *); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /// Process a file containing a list of service configuration + /// directives. + static int process_file (const ACE_TCHAR file[]); + + /// Process one service configuration @a directive, which is passed as + /// a string. Returns the number of errors that occurred. + static int process_directive (const ACE_TCHAR directive[]); + + /** + * Process one static service definition. Load a new static service + * into the ACE_Service_Repository. + * + * @param ssd Service descriptor, see the document of + * ACE_Static_Svc_Descriptor for more details. + * + * @param force_replace If set the new service descriptor replaces + * any previous instance in the ACE_Service_Repository. + * + * @return Returns -1 if the service cannot be 'loaded'. + */ + static int process_directive (const ACE_Static_Svc_Descriptor &ssd, + bool force_replace = false); + + /** + * Process (or re-process) service configuration requests that are + * provided in the svc.conf file(s). Returns the number of errors + * that occurred. + */ + static int process_directives (void); + + /// Handles signals to trigger reconfigurations. + static void handle_signal (int sig, siginfo_t *, ucontext_t *); + + /** + * Handle the command-line options intended for the + * ACE_Service_Config. Note that @c argv[0] is assumed to be the + * program name. + * The arguments that are valid in a call to this method are + * - '-b' Option to indicate that we should be a daemon + * - '-d' Turn on debugging mode + * - '-f' Option to read in the list of svc.conf file names + * - '-k' Option to read a wide string where in the logger output can + * be written + * - '-y' Turn on the flag for a repository of statically + * linked services + * - '-n' Need not have a repository of statically linked services + * - '-S' Option to read in the list of services on the command-line + * Please observe the difference between options '-f' that looks + * for a list of files and here a list of services. + */ + static int parse_args (int, ACE_TCHAR *argv[]); + +#if (ACE_USES_CLASSIC_SVC_CONF == 0) + static ACE_Service_Type *create_service_type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *o, + ACE_DLL &dll, + int active); +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ + + static ACE_Service_Type_Impl * + create_service_type_impl (const ACE_TCHAR *name, + int type, + void *symbol, + u_int flags, + ACE_Service_Object_Exterminator gobbler); + + /// @deprecated + /// Process service configuration requests that were provided on the + /// command-line. Returns the number of errors that occurred. + static int process_commandline_directives (void); + + /// Become a daemon. + static int start_daemon (void); + + // @deprecated + // Add the default statically-linked services to the + // ACE_Service_Repository. + static int load_static_svcs (void); + +protected: + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + /// @deprecated + /// This is the implementation function that process_directives() + /// and process_directive() both call. Returns the number of errors + /// that occurred. + static int process_directives_i (ACE_Svc_Conf_Param *param); +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ + + + // = Process-wide state. + +private: + + /// Have we called ACE_Service_Config::open() yet? + bool is_opened_; + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// Synchronization variable for open, etc. + mutable ACE_SYNCH_MUTEX lock_; +#endif /* ACE_MT_SAFE */ + + /// True if reconfiguration occurred. + static sig_atomic_t reconfig_occurred_; + + // = Set by command-line options. + /// Shall we become a daemon process? + static bool be_a_daemon_; + + /// Pathname of file to write process id. + static ACE_TCHAR *pid_file_name_; + + /// Number of the signal used to trigger reconfiguration. + static int signum_; + + /// Handles the reconfiguration signals. + static ACE_Sig_Adapter *signal_handler_; + + /// Pointer to the Singleton (ACE_Cleanup) Gestalt instance. + /// There is thread-specific global instance pointer, which is used to + /// temporarily change which Gestalt instance is used for static service + /// registrations. + /// + /// A specific use case is a thread, which loads a _dynamic_ service from + /// a DLL. If the said DLL also contains additional _static_ services, + /// those *must* be registered with the same configuration repository as + /// the dynamic service. Otherwise, the DLL's static services would be + /// registered with the global Gestalt and may outlive the DLL that + /// contains their code and perhaps the memory in which they are in. + /// This is a problem because if the DLL gets unloaded (as it will, if + /// it was loaded in an instance of Gestalt), the DLL's memory will be + /// deallocated, but the global service repository will still "think" + /// it must finalize the (DLL's) static services - with disastrous + /// consequences, occurring in the post-main code (at_exit()). + + /// This class needs the intimate access to be able to swap the + /// current TSS pointer for the global Gestalt. + friend class ACE_Service_Config_Guard; + + /// The helper needs intimate access (when building with no threads) + friend class ACE_Threading_Helper ; + friend class ACE_Threading_Helper ; +}; + +/** + * @class ACE_Service_Config_Guard + * + * @brief A guard class, designed to be instantiated on the stack. + * + * Instantiating it with a specific configuration ensures any references to + * ACE_Service_Config::instance(), even when occuring in static constructors, + * will allways access the designated configuration instance. + * This comes very handy when a dynamic service also registers any static + * services of its own and their static factories. + */ +class ACE_Export ACE_Service_Config_Guard +{ +public: + ACE_Service_Config_Guard (ACE_Service_Gestalt* psg); + ~ACE_Service_Config_Guard (void); + +private: + // Private AND not implemented to disable copying + ACE_Service_Config_Guard(const ACE_Service_Config_Guard&); + ACE_Service_Config_Guard& operator= (const ACE_Service_Config_Guard&); + +private: + ACE_Intrusive_Auto_Ptr saved_; +}; + + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Service_Config.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_SERVICE_CONFIG_H */ diff --git a/externals/ace/Service_Config.inl b/externals/ace/Service_Config.inl new file mode 100644 index 0000000..35be0e8 --- /dev/null +++ b/externals/ace/Service_Config.inl @@ -0,0 +1,208 @@ +// -*- C++ -*- +// +// $Id: Service_Config.inl 83302 2008-10-16 19:28:11Z mesnier_p $ + +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// This is the primary entry point into the ACE_Service_Config (the +// constructor just handles simple initializations). +ACE_INLINE int +ACE_Service_Config::open (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf, + bool ignore_debug_flag) +{ + ACE_TRACE ("ACE_Service_Config::open"); + if (singleton()->open_i (program_name, + logger_key, + ignore_static_svcs, + ignore_default_svc_conf, + ignore_debug_flag) == -1) + return -1; + + return current()->open (program_name, + logger_key, + ignore_static_svcs, + ignore_default_svc_conf, + ignore_debug_flag); +} + + +ACE_INLINE int +ACE_Service_Config::open (int argc, + ACE_TCHAR *argv[], + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf, + bool ignore_debug_flag) +{ + ACE_TRACE ("ACE_Service_Config::open"); + + if (singleton()->parse_args_i(argc, argv) == -1) + return -1; + + if (singleton()->open_i (argv[0], + logger_key, + ignore_static_svcs, + ignore_default_svc_conf, + ignore_debug_flag) == -1) + return -1; + + return current()->open (argc, + argv, + logger_key, + ignore_static_svcs, + ignore_default_svc_conf, + ignore_debug_flag); +} + +// Handle the command-line options intended for the +// ACE_Service_Config. +ACE_INLINE int +ACE_Service_Config::parse_args (int argc, ACE_TCHAR *argv[]) +{ + return ACE_Service_Config::current ()->parse_args (argc, argv); +} + +/// Return the global configuration instance. Allways returns the same +/// instance +ACE_INLINE ACE_Service_Gestalt * +ACE_Service_Config::global (void) +{ + return ACE_Service_Config::singleton()->instance_.get (); +} + +/// Return the configuration instance, considered "global" in the +/// current thread. This may be the same as instance(), but on some +/// occasions, it may be a different one. For example, +/// ACE_Service_Config_Guard provides a way of temporarily replacing +/// the "current" configuration instance in the context of a thread. +ACE_INLINE ACE_Service_Gestalt * +ACE_Service_Config::instance (void) +{ + return ACE_Service_Config::current (); +} + +// This method has changed to return the gestalt instead of the +// container, underlying the service repository and defined +// ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor*). This way +// the existing source code can keep using +// ACE_Service_Config::static_svcs(), however now it is not necessary +// to expose the repository storage *and* it is much easier to debug +// service registration problems. + +ACE_INLINE ACE_Service_Gestalt* +ACE_Service_Config::static_svcs (void) +{ + return ACE_Service_Config::current (); +} + +/// Compare two service descriptors for equality. +ACE_INLINE bool +ACE_Static_Svc_Descriptor::operator== (ACE_Static_Svc_Descriptor &d) const +{ + return ACE_OS::strcmp (name_, d.name_) == 0; +} + +/// Compare two service descriptors for inequality. +ACE_INLINE bool +ACE_Static_Svc_Descriptor::operator!= (ACE_Static_Svc_Descriptor &d) const +{ + return !(*this == d); +} + +ACE_INLINE void +ACE_Service_Config::signal_handler (ACE_Sig_Adapter *signal_handler) +{ + signal_handler_ = signal_handler; +} + +/// Initialize and activate a statically linked service. +ACE_INLINE int +ACE_Service_Config::initialize (const ACE_TCHAR *svc_name, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Config::initialize"); + return ACE_Service_Config::current ()->initialize (svc_name, + parameters); +} + +/// Dynamically link the shared object file and retrieve a pointer to +/// the designated shared object in this file. +ACE_INLINE int +ACE_Service_Config::initialize (const ACE_Service_Type *sr, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Config::initialize"); + return ACE_Service_Config::current ()->initialize (sr, parameters); +} + +/// Process a file containing a list of service configuration +/// directives. +ACE_INLINE int ACE_Service_Config::process_file (const ACE_TCHAR file[]) +{ + return ACE_Service_Config::current ()->process_file (file); +} + +/// +ACE_INLINE int +ACE_Service_Config::process_directive (const ACE_TCHAR directive[]) +{ + return ACE_Service_Config::current ()->process_directive (directive); +} + +/// Process service configuration requests as indicated in the queue of +/// svc.conf files. +ACE_INLINE int +ACE_Service_Config::process_directives (void) +{ + return ACE_Service_Config::current ()->process_directives (false); +} + +ACE_INLINE int +ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd, + bool force_replace) +{ + return ACE_Service_Config::current ()->process_directive (ssd, force_replace); +} + + +#if defined (ACE_HAS_WINCE) && defined (ACE_USES_WCHAR) +// We must provide these function to bridge Svc_Conf parser with ACE. + +ACE_INLINE int +ACE_Service_Config::initialize (const ACE_Service_Type *sp, ACE_ANTI_TCHAR parameters[]) +{ + return ACE_Service_Config::initialize (sp, ACE_TEXT_ANTI_TO_TCHAR (parameters)); +} + +ACE_INLINE int +ACE_Service_Config::initialize (const ACE_ANTI_TCHAR svc_name[], ACE_ANTI_TCHAR parameters[]) +{ + return ACE_Service_Config::initialize (ACE_TEXT_ANTI_TO_TCHAR (svc_name), + ACE_TEXT_ANTI_TO_TCHAR (parameters)); +} + +ACE_INLINE int +ACE_Service_Config::resume (const ACE_ANTI_TCHAR svc_name[]) +{ + return ACE_Service_Config::resume (ACE_TEXT_ANTI_TO_TCHAR (svc_name)); +} + +ACE_INLINE int +ACE_Service_Config::suspend (const ACE_ANTI_TCHAR svc_name[]) +{ + return ACE_Service_Config::suspend (ACE_TEXT_ANTI_TO_TCHAR (svc_name)); +} + +ACE_INLINE int +ACE_Service_Config::remove (const ACE_ANTI_TCHAR svc_name[]) +{ + return ACE_Service_Config::remove (ACE_TEXT_ANTI_TO_TCHAR (svc_name)); +} +#endif /* ACE_HAS_WINCE && !ACE_USES_WCHAR */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Gestalt.cpp b/externals/ace/Service_Gestalt.cpp new file mode 100644 index 0000000..8b3f8b8 --- /dev/null +++ b/externals/ace/Service_Gestalt.cpp @@ -0,0 +1,1314 @@ +// $Id: Service_Gestalt.cpp 89501 2010-03-17 08:59:56Z vzykov $ + +#include "ace/Svc_Conf.h" +#include "ace/Get_Opt.h" +#include "ace/ARGV.h" +#include "ace/Malloc.h" +#include "ace/Service_Manager.h" +#include "ace/Service_Types.h" +#include "ace/Containers.h" +#include "ace/Auto_Ptr.h" +#include "ace/Reactor.h" +#include "ace/Thread_Manager.h" +#include "ace/DLL.h" +#include "ace/XML_Svc_Conf.h" +#include "ace/SString.h" + +#ifndef ACE_LACKS_UNIX_SIGNALS +# include "ace/Signal.h" +#endif /* !ACE_LACKS_UNIX_SIGNALS */ + +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_time.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_sys_stat.h" + +#include "ace/TSS_T.h" +#include "ace/Service_Gestalt.h" + +#include "ace/Svc_Conf_Param.h" + +ACE_RCSID (ace, + Service_Gestalt, + "$Id: Service_Gestalt.cpp 89501 2010-03-17 08:59:56Z vzykov $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Service_Type_Dynamic_Guard::ACE_Service_Type_Dynamic_Guard + (ACE_Service_Repository &r, const ACE_TCHAR *name) + : repo_ (r) + // Relocation starts where the next service will be inserted (if any) + , repo_begin_ (r.current_size ()) + , name_ (name) +# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + // On this thread (for the duration of the initialize() method), + // we're about to do two things that require locking: (1) fiddle + // with the repository and (2) load a DLL and hence lock the + // DLL_Manager. + // + // Now if we don't lock the repo here, it is possible that two + // threads may deadlock on initialization because they can acquire + // locks (1) and (2) in different order, for instance: + // + // T1: loads a DLL (2) and registers a service (1); + // + // T2: may be relocating a service (1), which could lead to a + // (re)opening or uping the ref count on a DLL (2); + // + // To prevent this, we lock the repo here, using the repo_monitor_ + // member guard. + , repo_monitor_ (r.lock_) +#endif +{ + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) STDG::, repo=%@") + ACE_TEXT(", name=%s - begining at [%d]\n"), + &this->repo_, + this->name_, + this->repo_begin_)); + + ACE_ASSERT (this->name_ != 0); // No name? +} + + +/// Destructor +ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard (void) +{ + const ACE_Service_Type *tmp = 0; + + // Lookup without ignoring suspended services. Making sure + // not to ignore any inactive services, since those may be forward + // declarations + size_t slot = 0; + int const ret = this->repo_.find_i (this->name_, slot, &tmp, false); + + // We inserted it (as inactive), so we expect to find it, right? + if ((ret < 0 && ret != -2) || tmp == 0) + { + if (ACE::debug ()) + ACE_ERROR ((LM_WARNING, + ACE_TEXT ("ACE (%P|%t) STDG:: - Failed (%d) to find %s -> %@\n"), + ret, this->name_, tmp)); + return; + } + + if (tmp->type () != 0) + { + // Something has registered a proper (non-forward-decl) service with + // the same name as our dummy. + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) STDG::, repo=%@ [%d], ") + ACE_TEXT ("name=%s - updating dependents [%d - %d)\n"), + &this->repo_, + slot, + this->name_, + this->repo_begin_, + this->repo_.current_size ())); + + // Relocate any services inserted since we were created. + // Any (static, i.e. DLL = 0) services registered in + // the context of this guard aren't really static because + // their code belongs in the DLL's code segment + this->repo_.relocate_i (this->repo_begin_, this->repo_.current_size (), tmp->dll()); + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) STDG::, repo=%@ [%d], ") + ACE_TEXT ("name=%s - loaded (type=%@, impl=%@, object=%@, active=%d)\n"), + &this->repo_, + slot, + this->name_, + tmp, + tmp->type (), + tmp->type ()->object (), + tmp->active ())); + } +} + + + +// ---------------------------------------- + +ACE_Service_Gestalt::Processed_Static_Svc:: +Processed_Static_Svc (const ACE_Static_Svc_Descriptor *assd) + :name_(0), + assd_(assd) +{ + ACE_NEW_NORETURN (name_, ACE_TCHAR[ACE_OS::strlen(assd->name_)+1]); + ACE_OS::strcpy(name_,assd->name_); +} + +ACE_Service_Gestalt::Processed_Static_Svc::~Processed_Static_Svc (void) +{ + delete [] name_; +} + +void +ACE_Service_Gestalt::intrusive_add_ref (ACE_Service_Gestalt* g) +{ + if (g != 0) + { + ++g->refcnt_; + ACE_ASSERT (g->refcnt_ > 0); + } +} + +void +ACE_Service_Gestalt::intrusive_remove_ref (ACE_Service_Gestalt* g) +{ + if (g != 0) + { + long tmp = --g->refcnt_; + if (tmp <= 0) delete g; + ACE_ASSERT (tmp >= 0); + } +} + + +ACE_Service_Gestalt::~ACE_Service_Gestalt (void) +{ + + if (this->svc_repo_is_owned_) + delete this->repo_; + + this->repo_ =0; + + delete this->static_svcs_; + this->static_svcs_ = 0; + + // Delete the dynamically allocated static_svcs instance. +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::~SG - this=%@, pss = %@\n"), + this, this->processed_static_svcs_)); +#endif + + if (this->processed_static_svcs_ && + !this->processed_static_svcs_->is_empty()) + { + Processed_Static_Svc **pss = 0; + for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_); + iter.next (pss) != 0; + iter.advance ()) + { + delete *pss; + } + } + + delete this->processed_static_svcs_; + this->processed_static_svcs_ = 0; + + delete this->svc_conf_file_queue_; + this->svc_conf_file_queue_ = 0; +} + +ACE_Service_Gestalt::ACE_Service_Gestalt (size_t size, + bool svc_repo_is_owned, + bool no_static_svcs) + : svc_repo_is_owned_ (svc_repo_is_owned) + , svc_repo_size_ (size) + , is_opened_ (0) + , logger_key_ (ACE_DEFAULT_LOGGER_KEY) + , no_static_svcs_ (no_static_svcs) + , svc_queue_ (0) + , svc_conf_file_queue_ (0) + , repo_ (0) + , static_svcs_ (0) + , processed_static_svcs_ (0) + , refcnt_ (0) +{ + (void)this->init_i (); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::ctor - this = %@, pss = %@\n"), + this, this->processed_static_svcs_)); +#endif +} + +/// Performs the common initialization tasks for a new or previously +/// closed instance. Must not be virtual, as it is also called from +/// the constructor. +int +ACE_Service_Gestalt::init_i (void) +{ + // Only initialize the repo_ if (a) we are being constructed, or; + // (b) we're being open()-ed, perhaps after previously having been + // close()-ed. In both cases: repo_ == 0 and we need a repository. + if (this->repo_ == 0) + { + if (this->svc_repo_is_owned_) + { + ACE_NEW_RETURN (this->repo_, + ACE_Service_Repository (this->svc_repo_size_), + -1); + } + else + { + this->repo_ = + ACE_Service_Repository::instance (this->svc_repo_size_); + } + } + + if (init_svc_conf_file_queue () == -1) + return -1; + + if ( svc_conf_file_queue_->is_empty ()) + { + // Check if the default file exists before attempting to queue it + // for processing + FILE *fp = ACE_OS::fopen (ACE_DEFAULT_SVC_CONF, + ACE_TEXT ("r")); + bool skip_static_svcs = (fp == 0); + if (fp != 0) + ACE_OS::fclose (fp); + + if (!skip_static_svcs) { + // Load the default "svc.conf" entry here if there weren't + // overriding -f arguments in . + if (svc_conf_file_queue_->enqueue_tail + (ACE_TString (ACE_DEFAULT_SVC_CONF)) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("enqueuing ") + ACE_DEFAULT_SVC_CONF + ACE_TEXT(" file")), + -1); + } + } + } + + return 0; +} + + +/// Add the default statically-linked services to the Service +/// Repository. +int +ACE_Service_Gestalt::load_static_svcs (void) +{ + ACE_TRACE ("ACE_Service_Gestalt::load_static_svcs"); + + if (this->static_svcs_ == 0) + return 0; // Nothing to do + + ACE_Static_Svc_Descriptor **ssdp = 0; + for (ACE_STATIC_SVCS_ITERATOR iter (*this->static_svcs_); + iter.next (ssdp) != 0; + iter.advance ()) + { + ACE_Static_Svc_Descriptor *ssd = *ssdp; + + if (this->process_directive (*ssd, 1) == -1) + return -1; + } + return 0; + +} /* load_static_svcs () */ + + + +/// Find a static service descriptor by name +int +ACE_Service_Gestalt::find_static_svc_descriptor (const ACE_TCHAR* name, + ACE_Static_Svc_Descriptor **ssd) const +{ + ACE_TRACE ("ACE_Service_Gestalt::find_static_svc_descriptor"); + + if (this->static_svcs_ == 0) + return -1; + + ACE_Static_Svc_Descriptor **ssdp = 0; + for (ACE_STATIC_SVCS_ITERATOR iter ( *this->static_svcs_); + iter.next (ssdp) != 0; + iter.advance ()) + { + if (ACE_OS::strcmp ((*ssdp)->name_, name) == 0) + { + if (ssd != 0) + *ssd = *ssdp; + + return 0; + } + } + + return -1; +} + +/// @brief +const ACE_Static_Svc_Descriptor* +ACE_Service_Gestalt::find_processed_static_svc (const ACE_TCHAR* name) +{ + if (this->processed_static_svcs_ == 0 || name == 0) + return 0; + + Processed_Static_Svc **pss = 0; + for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_); + iter.next (pss) != 0; + iter.advance ()) + { + if (ACE_OS::strcmp ((*pss)->name_, name) == 0) + return (*pss)->assd_; + } + return 0; +} + + + +/// @brief Captures a list of the direcives processed (explicitely) for this +/// Gestalt so that services can be replicated in other repositories +/// upon their first initialization. +/// +/// This is part of the mechanism ensuring distinct local instances +/// for static service objects, loaded in another repository. +void +ACE_Service_Gestalt::add_processed_static_svc + (const ACE_Static_Svc_Descriptor *assd) +{ + + /// When process_directive(Static_Svc_Descriptor&) is called, it + /// associates a service object with the Gestalt and makes the + /// resource (a Service Object) local to the repository. This is but + /// the first step in using such SO. The next is the + /// "initialization" step. It is typicaly done through a "static" + /// service configuration directive. + /// + /// In contrast a "dynamic" directive, when processed through the + /// overloaded process_directives(string) both creates the SO + /// locally and initializes it, where the statics directive must + /// first locate the SO and then calls the init() method. This means + /// that durig the "static" initialization there's no specific + /// information about the hosting repository and the gestalt must + /// employ some lookup strategy to find it elsewhere. + + if (this->processed_static_svcs_ == 0) + ACE_NEW (this->processed_static_svcs_, + ACE_PROCESSED_STATIC_SVCS); + + Processed_Static_Svc **pss = 0; + for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_); + iter.next (pss) != 0; + iter.advance ()) + { + if (ACE_OS::strcmp ((*pss)->name_, assd->name_) == 0) + { + (*pss)->assd_ = assd; + return; + } + } + Processed_Static_Svc *tmp = 0; + ACE_NEW (tmp,Processed_Static_Svc(assd)); + this->processed_static_svcs_->insert(tmp); + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::add_processed_static_svc, ") + ACE_TEXT ("repo=%@ - %s\n"), + this->repo_, + assd->name_)); +} + + +/// Queues a static service object descriptor which, during open() +/// will be given to process_directive() to create the Service +/// Object. Normally, only called from static initializers, prior to +/// calling open() but loading a service from a DLL can cause it too. + +int +ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor *stsd) +{ + if (this->static_svcs_ == 0) + ACE_NEW_RETURN (this->static_svcs_, + ACE_STATIC_SVCS, + -1); + + return this->static_svcs_->insert (stsd); +} + + +ACE_ALLOC_HOOK_DEFINE (ACE_Service_Gestalt) + + +void +ACE_Service_Gestalt::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Gestalt::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_Service_Gestalt::initialize (const ACE_TCHAR *svc_name, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Gestalt_Base::initialize (repo)"); + ACE_ARGV args (parameters); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::initialize - () repo=%@, ") + ACE_TEXT ("looking up static ") + ACE_TEXT ("service \'%s\' to initialize\n"), + this->repo_, + svc_name)); + } +#endif + + const ACE_Service_Type *srp = 0; + for (int i = 0; this->find (svc_name, &srp) == -1 && i < 2; i++) + // if (this->repo_->find (svc_name, &srp) == -1) + { + const ACE_Static_Svc_Descriptor *assd = + ACE_Service_Config::global()->find_processed_static_svc(svc_name); + if (assd != 0) + { + this->process_directive_i(*assd, 0); + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) ERROR: SG::initialize - service \'%s\'") + ACE_TEXT (" was not located.\n"), + svc_name), + -1); + } + } + if (srp == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) ERROR: SG::initialize - service \'%s\'") + ACE_TEXT (" was not located.\n"), + svc_name), + -1); + + /// If initialization fails ... + if (srp->type ()->init (args.argc (), + args.argv ()) == -1) + { + // ... report and remove this entry. + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) ERROR: SG::initialize - static init of \'%s\'") + ACE_TEXT (" failed (%p)\n"), + svc_name, ACE_TEXT ("error"))); + this->repo_->remove (svc_name); + return -1; + } + + // If everything is ok, activate it + const_cast(srp)->active (1); + return 0; +} + + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) +int +ACE_Service_Gestalt::initialize (const ACE_Service_Type_Factory *stf, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Gestalt::initialize"); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@, name=%s") + ACE_TEXT (" - looking up in the repo\n"), + this->repo_, + stf->name ())); +#endif + + ACE_Service_Type *srp = 0; + int const retv = this->repo_->find (stf->name (), + (const ACE_Service_Type **) &srp); + + // If there is an active service already, remove it first + // before it can be re-installed. + if (retv >= 0) + { +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_WARNING, + ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@,") + ACE_TEXT (" name=%s - removing a pre-existing namesake.\n"), + this->repo_, + stf->name ())); +#endif + this->repo_->remove (stf->name ()); + } + + // If there is an inactive service by that name it may have been + // either inactivated, or just a forward declaration for a service, + // that is in the process of being initialized. If it is the latter, + // then we have detected an attempt to initialize the same dynamic + // service while still processing previous attempt. This can lock up + // the process, because the ACE_DLL_Manager::open () is not + // re-entrant - it uses a Singleton lock to serialize concurent + // invocations. This use case must be handled here, because if the + // DLL_Manager was re-entrant we would have entered an infinite + // recursion here. + if (retv == -2 && srp->type () == 0) + ACE_ERROR_RETURN ((LM_WARNING, + ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@,") + ACE_TEXT (" name=%s - forward-declared; ") + ACE_TEXT (" recursive initialization requests are") + ACE_TEXT (" ignored.\n"), + this->repo_, + stf->name ()), + -1); + + // Reserve a spot for the dynamic service by inserting an incomplete + // service declaration, i.e. one that can not produce a service + // object if asked (a forward declaration). This declaration + // ensures maintaining the proper partial ordering of the services + // with respect to their finalization. For example, dependent static + // services must be registered *after* the dynamic service that + // loads them, so that their finalization is complete *before* + // finalizing the dynamic service. + ACE_Service_Type_Dynamic_Guard dummy (*this->repo_, + stf->name ()); + + // make_service_type() is doing the dynamic loading and also runs + // any static initializers + ACE_Auto_Ptr tmp (stf->make_service_type (this)); + + if (tmp.get () != 0 && + this->initialize_i (tmp.get (), parameters) == 0) + { + // All good. Tthe ACE_Service_Type instance is now owned by the + // repository and we should make sure it is not destroyed upon + // exit from this method. + tmp.release (); + return 0; + } + + return -1; +} +#endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ + + +/// Dynamically link the shared object file and retrieve a pointer to +/// the designated shared object in this file. +/// @note This is obsolete (and error-prone) in the presense of dynamic +/// services with their own static services. This method will allow those +/// static services to register *before* the dynamic service that owns them. +/// Upon finalization of the static services the process may crash, because +/// the dynamic service's DLL may have been already released, together with +/// the memory in which the static services reside. +/// It may not crash, for instance, when the first static service to register +/// is the same as the dynamic service being loaded. You should be so lucky! .. +int +ACE_Service_Gestalt::initialize (const ACE_Service_Type *sr, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Gestalt::initialize"); + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@, name=%s") + ACE_TEXT (" - looking up in the repo\n"), + this->repo_, + sr->name ())); + + ACE_Service_Type *srp = 0; + if (this->repo_->find (sr->name (), + (const ACE_Service_Type **) &srp) >= 0) + { +#ifndef ACE_NLOGGING + ACE_DEBUG ((LM_WARNING, + ACE_TEXT ("ACE (%P|%t) SG::initialize - repo=%@, name=%s") + ACE_TEXT (" - removing a pre-existing namesake.\n"), + this->repo_, + sr->name ())); +#endif + this->repo_->remove (sr->name ()); + } + + return this->initialize_i (sr, parameters); + +} + +/// Dynamically link the shared object file and retrieve a pointer to +/// the designated shared object in this file. +int +ACE_Service_Gestalt::initialize_i (const ACE_Service_Type *sr, + const ACE_TCHAR *parameters) +{ + ACE_TRACE ("ACE_Service_Gestalt::initialize_i"); + ACE_ARGV args (parameters); + if (sr->type ()->init (args.argc (), + args.argv ()) == -1) + { + // We just get ps to avoid having remove() delete it. + ACE_Service_Type *ps = 0; + this->repo_->remove (sr->name (), &ps); + +#ifndef ACE_NLOGGING + // Not using LM_ERROR here to avoid confusing the test harness + if (ACE::debug ()) + ACE_ERROR_RETURN ((LM_WARNING, + ACE_TEXT ("ACE (%P|%t) SG::initialize_i -") + ACE_TEXT (" repo=%@, name=%s - remove failed: %m\n"), + this->repo_, + sr->name ()), + -1); +#endif + return -1; + } + + if (this->repo_->insert (sr) == -1) + { +#ifndef ACE_NLOGGING + // Not using LM_ERROR here to avoid confusing the test harness + if (ACE::debug ()) + ACE_ERROR_RETURN ((LM_WARNING, + ACE_TEXT ("ACE (%P|%t) SG::initialize_i -") + ACE_TEXT (" repo=%@, name=%s - insert failed: %m\n"), + this->repo_, + sr->name ()), + -1); +#endif + return -1; + } + + return 0; +} + +// Totally remove from the daemon by removing it from the +// ACE_Reactor, and unlinking it if necessary. + +int +ACE_Service_Gestalt::remove (const ACE_TCHAR svc_name[]) +{ + ACE_TRACE ("ACE_Service_Gestalt::remove"); + if (this->repo_ == 0) + return -1; + + return this->repo_->remove (svc_name); +} + +/// Suspend @a svc_name. Note that this will not unlink the service +/// from the daemon if it was dynamically linked, it will mark it as +/// being suspended in the Service Repository and call the +/// member function on the appropriate . A service +/// can be resumed later on by calling the method... +int +ACE_Service_Gestalt::suspend (const ACE_TCHAR svc_name[]) +{ + ACE_TRACE ("ACE_Service_Gestalt::suspend"); + if (this->repo_ == 0) + return -1; + + return this->repo_->suspend (svc_name); +} + +// Resume a SVC_NAME that was previously suspended or has not yet +// been resumed (e.g., a static service). + +int +ACE_Service_Gestalt::resume (const ACE_TCHAR svc_name[]) +{ + ACE_TRACE ("ACE_Service_Gestalt::resume"); + if (this->repo_ == 0) + return -1; + + return this->repo_->resume (svc_name); +} + + +int +ACE_Service_Gestalt::process_directive (const ACE_Static_Svc_Descriptor &ssd, + bool force_replace) +{ + int const result = process_directive_i (ssd, force_replace); + if (result == 0) + { + this->add_processed_static_svc(&ssd); + } + return result; +} + +int +ACE_Service_Gestalt::process_directive_i (const ACE_Static_Svc_Descriptor &ssd, + bool force_replace) +{ + if (this->repo_ == 0) + return -1; + + if (!force_replace) + { + if (this->repo_->find (ssd.name_, 0, 0) >= 0) + { + // The service is already there, just return + return 0; + } + } + + + ACE_Service_Object_Exterminator gobbler; + void *sym = (ssd.alloc_)(&gobbler); + + ACE_Service_Type_Impl *stp = + ACE_Service_Config::create_service_type_impl (ssd.name_, + ssd.type_, + sym, + ssd.flags_, + gobbler); + if (stp == 0) + return 0; + + ACE_Service_Type *service_type = 0; + + // This is just a temporary to force the compiler to use the right + // constructor in ACE_Service_Type. Note that, in cases where we are + // called from a static initializer which is part of a DLL, there is + // not enough information about the actuall DLL in this context. + ACE_DLL tmp_dll; + + ACE_NEW_RETURN (service_type, + ACE_Service_Type (ssd.name_, + stp, + tmp_dll, + ssd.active_), + -1); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::process_directive_i, ") + ACE_TEXT ("repo=%@ - %s, dll=%s, force=%d\n"), + this->repo_, + ssd.name_, + (tmp_dll.dll_name_ == 0) ? ACE_TEXT ("") : tmp_dll.dll_name_, + force_replace)); +#endif + + return this->repo_->insert (service_type); +} + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + +int +ACE_Service_Gestalt::process_directives_i (ACE_Svc_Conf_Param *param) +{ +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::process_directives_i, ") + ACE_TEXT ("repo=%@ - %s\n"), + this->repo_, + (param->type == ACE_Svc_Conf_Param::SVC_CONF_FILE) + ? ACE_TEXT ("") + : param->source.directive)); +#endif + + // AC 970827 Skip the heap check because yacc allocates a buffer + // here which will be reported as a memory leak for some reason. + ACE_NO_HEAP_CHECK + + // Were we called in the context of the current instance? + ACE_ASSERT (this == param->config); + + // Temporarily (for the duration of this call) make sure that *any* + // static service registrations will happen with this instance. Such + // registrations are possible as a side-effect of dynamically + // loading a DLL, which has other static services registered. Thus + // this instance will own both the DLL and those static services, + // which implies that their finalization will be performed in the + // correct order, i.e. prior to finalizing the DLL + ACE_Service_Config_Guard guard (this); + + ::ace_yyparse (param); + + // This is a hack, better errors should be provided... + if (param->yyerrno > 0) + { + // Always set the last error if ace_yyparse() fails. + // Other code may use errno to determine the type + // of problem that occurred from processing directives. + ACE_OS::last_error (EINVAL); + return param->yyerrno; + } + else + return 0; +} + +#else + +ACE_XML_Svc_Conf * +ACE_Service_Gestalt::get_xml_svc_conf (ACE_DLL &xmldll) +{ + if (xmldll.open (ACE_TEXT ("ACEXML_XML_Svc_Conf_Parser")) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) Failure to open ACEXML_XML_Svc_Conf_Parser: %p\n"), + ACE_TEXT("ACE_Service_Config::get_xml_svc_conf")), + 0); + + void * foo = + xmldll.symbol (ACE_TEXT ("_ACEXML_create_XML_Svc_Conf_Object")); + +#if defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64)) + int const temp_p = reinterpret_cast (foo); +#else + intptr_t const temp_p = reinterpret_cast (foo); +#endif + + ACE_XML_Svc_Conf::Factory factory = reinterpret_cast (temp_p); + + if (factory == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) Unable to resolve factory: %p\n"), + xmldll.error ()), + 0); + + return factory (); +} +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ + +int +ACE_Service_Gestalt::process_file (const ACE_TCHAR file[]) +{ + ACE_TRACE ("ACE_Service_Gestalt::process_file"); + + // To avoid recursive processing of the same file and the same repository + // we maintain an implicit stack of dummy "services" named after the file + // being processed. Anytime we have to open a new file, we then can check + // to see if it is not already being processed by searching for a dummy + // service with a matching name. + if (this->repo_->find (file, 0, 0) >=0) + { + ACE_DEBUG ((LM_WARNING, + ACE_TEXT ("ACE (%P|%t) Configuration file %s is currently") + ACE_TEXT (" being processed. Ignoring recursive process_file().\n"), + file)); + return 0; + } + + // Register a dummy service as a forward decl, using the file name as name. + // The entry will be automaticaly removed once the thread exits this block. + ACE_Service_Type_Dynamic_Guard recursion_guard (*this->repo_, + file); + + /* + * @TODO: Test with ACE_USES_CLASSIC_SVC_CONF turned off! + */ +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + int result = 0; + + FILE *fp = ACE_OS::fopen (file, + ACE_TEXT ("r")); + + if (fp == 0) + { + // Invalid svc.conf file. We'll report it here and break out of + // the method. + if (ACE::debug ()) + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t): %p\n"), + file)); + + // Use stat to find out if the file exists. I didn't use access() + // because stat is better supported on most non-unix platforms. + ACE_stat exists; + if (ACE_OS::stat (file, &exists) == 0) + // If it exists, but we couldn't open it for reading then we + // must not have permission to read it. + errno = EPERM; + else + errno = ENOENT; + result = -1; + } + else + { + ACE_Svc_Conf_Param f (this, fp); + + // Keep track of the number of errors. + result = this->process_directives_i (&f); + + (void) ACE_OS::fclose (fp); + } + return result; +#else + ACE_DLL dll; + + auto_ptr xml_svc_conf (this->get_xml_svc_conf (dll)); + + if (xml_svc_conf.get () == 0) + return -1; + + return xml_svc_conf->parse_file (file); +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ +} + +int +ACE_Service_Gestalt::process_directive (const ACE_TCHAR directive[]) +{ + ACE_TRACE ("ACE_Service_Gestalt::process_directive"); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::process_directive, repo=%@ - %s\n"), + this->repo_, + directive)); +#endif + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + ACE_UNUSED_ARG (directive); + + ACE_Svc_Conf_Param d (this, directive); + + return this->process_directives_i (&d); +#else + ACE_DLL dll; + + auto_ptr + xml_svc_conf (this->get_xml_svc_conf (dll)); + + if (xml_svc_conf.get () == 0) + return -1; + + // Temporarily (for the duration of this call) make sure that *any* static + // service registrations will happen with this instance. Such registrations + // are possible as a side-effect of dynamically loading a DLL, which has + // other static services registered. Thus this instance will own both the + // DLL and those static services, which implies that their finalization + // will be performed in the correct order, i.e. prior to finalizing the DLL + ACE_Service_Config_Guard guard (this); + + return xml_svc_conf->parse_string (directive); +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ + +} /* process_directive () */ + + +int +ACE_Service_Gestalt::init_svc_conf_file_queue (void) +{ + if (this->svc_conf_file_queue_ == 0) + { + ACE_SVC_QUEUE *tmp = 0; + ACE_NEW_RETURN (tmp, + ACE_SVC_QUEUE, + -1); + this->svc_conf_file_queue_ = tmp; + } + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::init_svc_conf_file_queue ") + ACE_TEXT ("- this=%@, repo=%@\n"), + this, this->repo_)); +#endif + + return 0; + +} /* init_svc_conf_file_queue () */ + + +int +ACE_Service_Gestalt::open_i (const ACE_TCHAR program_name[], + const ACE_TCHAR* logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf_file, + bool ignore_debug_flag) +{ + ACE_TRACE ("ACE_Service_Gestalt::open_i"); + int result = 0; + ACE_Log_Msg *log_msg = ACE_LOG_MSG; + + this->no_static_svcs_ = ignore_static_svcs; + + // Record the current log setting upon entering this thread. + u_long old_process_mask = log_msg->priority_mask + (ACE_Log_Msg::PROCESS); + + u_long old_thread_mask = log_msg->priority_mask + (ACE_Log_Msg::THREAD); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::open_i - this=%@, ") + ACE_TEXT ("opened=%d, loadstatics=%d\n"), + this, this->is_opened_, this->no_static_svcs_)); +#endif + + // Guard against reentrant processing. For example, + // if the singleton gestalt (ubergestalt) was already open, + // do not open it again... + if (this->is_opened_++ != 0) + return 0; + + if (this->init_i () != 0) + return -1; + + u_long flags = log_msg->flags (); + + // Only use STDERR if the caller hasn't already set the flags. + if (flags == 0) + flags = (u_long) ACE_Log_Msg::STDERR; + + const ACE_TCHAR *key = logger_key; + + if (key == 0 || ACE_OS::strcmp (key, ACE_DEFAULT_LOGGER_KEY) == 0) + { + // Only use the static if the caller doesn't + // override it in the parameter list or if the key supplied is + // equal to the default static logger key. + key = this->logger_key_; + } + else + { + ACE_SET_BITS (flags, ACE_Log_Msg::LOGGER); + } + + if (log_msg->open (program_name, + flags, + key) == -1) + return -1; + + if (!ignore_debug_flag) + { + // If -d was included as a startup parameter, the user wants debug + // information printed during service initialization. + if (ACE::debug ()) + ACE_Log_Msg::enable_debug_messages (); + else + // The user has requested no debugging info. + ACE_Log_Msg::disable_debug_messages (); + } + + // See if we need to load the static services. + if (this->no_static_svcs_ == 0 + && this->load_static_svcs () == -1) + result = -1; + else + { + if (this->process_directives (ignore_default_svc_conf_file) == -1) + result = -1; + else + result = this->process_commandline_directives (); + } + + + // Reset debugging back to the way it was when we came into + // into . + { + // Make sure to save/restore errno properly. + ACE_Errno_Guard error (errno); + + if (!ignore_debug_flag) + { + log_msg->priority_mask (old_process_mask, ACE_Log_Msg::PROCESS); + log_msg->priority_mask (old_thread_mask, ACE_Log_Msg::THREAD); + } + } + + return result; +} /* open_i () */ + + +int +ACE_Service_Gestalt::is_opened (void) +{ + return this->is_opened_; +} + +int +ACE_Service_Gestalt::process_commandline_directives (void) +{ + int result = 0; + if (this->svc_queue_ != 0) + { + ACE_TString *sptr = 0; + for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_queue_); + iter.next (sptr) != 0; + iter.advance ()) + { + // Process just a single directive. + if (this->process_directive ((sptr->fast_rep ())) != 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) %p\n"), + ACE_TEXT ("process_directive"))); + result = -1; + } + } + + delete this->svc_queue_; + this->svc_queue_ = 0; + } + + return result; + +} /* process_commandline_directives () */ + + +int +ACE_Service_Gestalt::parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_TRACE ("ACE_Service_Gestalt::parse_args"); + bool unused_ignore_default_svc_conf = true; + return parse_args_i (argc, argv, unused_ignore_default_svc_conf); +} + +int +ACE_Service_Gestalt::parse_args_i (int argc, + ACE_TCHAR *argv[], + bool &ignore_default_svc_conf_file) +{ + ACE_TRACE ("ACE_Service_Gestalt::parse_args_i"); + ACE_Get_Opt get_opt (argc, + argv, + ACE_TEXT ("df:k:nyS:"), + 1); // Start at argv[1]. + + if (this->init_svc_conf_file_queue () == -1) + return -1; + + for (int c; (argc != 0) && ((c = get_opt ()) != -1); ) + switch (c) + { + case 'd': + ACE::debug (1); + break; + case 'f': + if (this->svc_conf_file_queue_->enqueue_tail (ACE_TString (get_opt.opt_arg ())) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("enqueue_tail")), + -1); + ignore_default_svc_conf_file = true; + break; + case 'k': + /* + * @TODO: Is this always a static storage? Shouldn't we copy + * & gain ownership of the value? + */ + this->logger_key_ = get_opt.opt_arg (); + break; + case 'n': + this->no_static_svcs_ = 1; + break; + case 'y': + this->no_static_svcs_ = 0; + break; + case 'S': + if (this->svc_queue_ == 0) + { + ACE_NEW_RETURN (this->svc_queue_, + ACE_SVC_QUEUE, + -1); + } + + if (this->svc_queue_->enqueue_tail (ACE_TString (get_opt.opt_arg ())) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("enqueue_tail")), + -1); + break; + default: + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) %c is not a ACE_Service_Config option\n"), + c)); + } + + return 0; +} /* parse_args_i () */ + + + +// Process service configuration directives from the files queued for +// processing +int +ACE_Service_Gestalt::process_directives (bool ignore_default_svc_conf_file) +{ + ACE_TRACE ("ACE_Service_Gestalt::process_directives"); + + if (this->svc_conf_file_queue_ == 0 + || this->svc_conf_file_queue_->is_empty ()) + return 0; + + ACE_TString *sptr = 0; + ACE_TString default_svc_conf (ACE_DEFAULT_SVC_CONF); + + int failed = 0; + + // Iterate through all the svc.conf files. + for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_conf_file_queue_); + iter.next (sptr) != 0; + iter.advance ()) + { + if (*sptr == default_svc_conf && ignore_default_svc_conf_file) + continue; + + int result = this->process_file (sptr->fast_rep ()); + if (result < 0) + return result; + failed += result; + } + + return failed; + +} /* process_directives () */ + +// Tidy up and perform last rites on a terminating ACE_Service_Gestalt. +int +ACE_Service_Gestalt::close (void) +{ + ACE_TRACE ("ACE_Service_Gestalt::close"); + + if (!this->is_opened_ || --this->is_opened_ != 0) + return 0; + + // Delete the list fo svc.conf files + delete this->svc_conf_file_queue_; + this->svc_conf_file_queue_ = 0; + + if (this->processed_static_svcs_ && + !this->processed_static_svcs_->is_empty()) + { + Processed_Static_Svc **pss = 0; + for (ACE_PROCESSED_STATIC_SVCS_ITERATOR iter (*this->processed_static_svcs_); + iter.next (pss) != 0; + iter.advance ()) + { + delete *pss; + } + } + delete this->processed_static_svcs_; + this->processed_static_svcs_ = 0; + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SG::close - complete this=%@, repo=%@, owned=%d\n"), + this, this->repo_, this->svc_repo_is_owned_)); +#endif + + if (this->svc_repo_is_owned_) + delete this->repo_; + + this->repo_ = 0; + + return 0; +} /* close () */ + + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if !defined (__ACE_INLINE__) +#include "ace/Service_Gestalt.inl" +#endif /* __ACE_INLINE__ */ + +// Allocate a Service Manager. +ACE_FACTORY_DEFINE (ACE, ACE_Service_Manager) diff --git a/externals/ace/Service_Gestalt.h b/externals/ace/Service_Gestalt.h new file mode 100644 index 0000000..a4bbbcb --- /dev/null +++ b/externals/ace/Service_Gestalt.h @@ -0,0 +1,522 @@ +// -*- C++ -*- + +//==================================================================== +/** + * @file Service_Gestalt.h + * + * $Id: Service_Gestalt.h 89501 2010-03-17 08:59:56Z vzykov $ + * + * @author Iliyan Jeliazkov + */ +//==================================================================== + +#ifndef ACE_SERVICE_GESTALT_H +#define ACE_SERVICE_GESTALT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/Default_Constants.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Auto_Ptr.h" +#include "ace/SString.h" +#include "ace/Unbounded_Queue.h" +#include "ace/Unbounded_Set.h" +#include "ace/Service_Repository.h" +#include "ace/Singleton.h" +#include "ace/OS_NS_signal.h" +#include "ace/Synch_Traits.h" +#include "ace/Atomic_Op.h" +#include "ace/Guard_T.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) +class ACE_Service_Type_Factory; +class ACE_Location_Node; +#else +class ACE_XML_Svc_Conf; +class ACE_DLL; +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ + +class ACE_Static_Svc_Descriptor; +class ACE_Svc_Conf_Param; + +/** + * @class ACE_Service_Gestalt + * + * @brief Supplies common server operations for dynamic and static + * configuration of services. + * + * The Gestalt embodies the concept of configuration context. On one + * hand, it is a flat namespace, where names correspond to a Service + * Object instance. A Gestalt owns the Service Repository instance, + * which in turn owns the Service Object instances. + * + * Another aspect of a Gestalt is its responsibility for + * record-keeping and accounting for the meta-data, necessary for + * locating, removing or instantiating a service. + * + * A repository underlies an instance of a gestalt and its lifetime + * may or may not be bounded by the lifetime of the gestalt, that owns + * it. This feature is important for the derived classes and the + * Service Config in particular. + * + */ +class ACE_Export ACE_Service_Gestalt +{ +private: + /// + /// Not implemented to enforce no copying + // + ACE_UNIMPLEMENTED_FUNC (ACE_Service_Gestalt(const ACE_Service_Gestalt&)) + ACE_UNIMPLEMENTED_FUNC (ACE_Service_Gestalt& operator=(const ACE_Service_Gestalt&)) + +public: + enum + { + MAX_SERVICES = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE + }; + + enum + { + DEFAULT_SIZE = ACE_DEFAULT_SERVICE_GESTALT_SIZE + }; + + /// Constructor either associates the instance with the process-wide + /// singleton instance of ACE_Service_Repository, or creates and + /// manages its own instance of the specified size. + ACE_Service_Gestalt (size_t size = DEFAULT_SIZE, + bool svc_repo_is_owned = true, + bool no_static_svcs = true); + + /// Perform user-specified close activities and remove dynamic + /// memory. + ~ACE_Service_Gestalt (void); + + /// Dump the state of an object. + void dump (void) const; + + /** + * Performs an open without parsing command-line arguments. The + * @a logger_key indicates where to write the logging output, which + * is typically either a STREAM pipe or a socket address. If + * @a ignore_static_svcs is true then static services are not loaded, + * otherwise, they are loaded. If @a ignore_default_svc_conf_file is + * true then the @c svc.conf configuration file will be ignored. + * Returns zero upon success, -1 if the file is not found or cannot + * be opened (errno is set accordingly), otherwise returns the + * number of errors encountered loading the services in the + * specified svc.conf configuration file. If @a ignore_debug_flag is + * true then the application is responsible for setting the + * ACE_Log_Msg::priority_mask appropriately. + */ + int open (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key = 0, + bool ignore_static_svcs = true, + bool ignore_default_svc_conf_file = false, + bool ignore_debug_flag = false); + + /** + * This is the primary entry point into the ACE_Service_Config (the + * constructor just handles simple initializations). It parses + * arguments passed in from @a argc and @a argv parameters. The + * arguments that are valid in a call to this method include: + * + * - '-b' Option to indicate that we should be a daemon. Note that when + * this option is used, the process will be daemonized before the + * service configuration file(s) are read. During daemonization, + * (on POSIX systems) the current directory will be changed to "/" + * so the caller should either fully specify the file names, or + * execute a @c chroot() to the appropriate directory. + * @sa ACE::daemonize(). + * - '-d' Turn on debugging mode + * - '-f' Specifies a configuration file name other than the default + * svc.conf. Can be specified multiple times to use multiple files. + * If any configuration file is provided with this option then + * the default svc.conf will be ignored. + * - '-k' Specifies the rendezvous point to use for the ACE distributed + * logger. + * - '-y' Explicitly enables the use of static services. This flag + * overrides the @a ignore_static_svcs parameter value. + * - '-n' Explicitly disables the use of static services. This flag + * overrides the @a ignore_static_svcs parameter value. + * - '-p' Specifies a pathname which is used to store the process id. + * - '-s' Specifies a signal number other than SIGHUP to trigger reprocessing + * of the configuration file(s). Ignored for platforms that do not + * have POSIX signals, such as Windows. + * - '-S' Specifies a service directive string. Enclose the string in quotes + * and escape any embedded quotes with a backslash. This option + * specifies service directives without the need for a configuration + * file. Can be specified multiple times. + * + * Note: Options '-f' and '-S' complement each other. Directives from files + * and from '-S' option are processed together in the following order. First, + * all files are processed in the order they are specified in @a argv + * parameter. Second, all directive strings are executed in the order the + * directives appear in @a argv parameter. + * + * @param argc The number of commandline arguments. + * @param argv The array with commandline arguments + * @param logger_key Indicates where to write the logging output, + * which is typically either a STREAM pipe or a + * socket address. + * @param ignore_static_svcs If true then static services are not loaded, + * otherwise, they are loaded. + * @param ignore_default_svc_conf_file If false then the @c svc.conf + * configuration file will be ignored. + * @param ignore_debug_flag If false then the application is responsible + * for setting the @c ACE_Log_Msg::priority_mask + * appropriately. + * + * @retval -1 The configuration file is not found or cannot + * be opened (errno is set accordingly). + * @retval 0 Success. + * @retval >0 The number of errors encountered while processing + * the service configuration file(s). + */ + int open (int argc, + ACE_TCHAR *argv[], + const ACE_TCHAR *logger_key = 0, + bool ignore_static_svcs = true, + bool ignore_default_svc_conf_file = false, + bool ignore_debug_flag = false); + + /// Has it been opened? Returns the difference between the times + /// open and close have been called on this instance + int is_opened (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /// Process one service configuration @a directive, which is passed as + /// a string. Returns the number of errors that occurred. + int process_directive (const ACE_TCHAR directive[]); + + /// Process one static service definition. + /** + * Load a new static service. + * + * @param ssd Service descriptor, see the document of + * ACE_Static_Svc_Descriptor for more details. + * + * @param force_replace If set the new service descriptor replaces + * any previous instance in the repository. + * + * @return Returns -1 if the service cannot be 'loaded'. + */ + int process_directive (const ACE_Static_Svc_Descriptor &ssd, + bool force_replace = false); + + /// Process a file containing a list of service configuration + /// directives. + int process_file (const ACE_TCHAR file[]); + + /** + * Locate an entry with @a name in the table. If @a ignore_suspended + * is set then only consider services marked as resumed. If the + * caller wants the located entry, pass back a pointer to the + * located entry via @a srp. If @a name is not found, -1 is returned. + * If @a name is found, but it is suspended and the caller wants to + * ignore suspended services a -2 is returned. + */ + int find (const ACE_TCHAR name[], + const ACE_Service_Type **srp = 0, + bool ignore_suspended = true) const; + + /** + * Handle the command-line options intended for the + * ACE_Service_Gestalt. Note that @c argv[0] is assumed to be the + * program name. + * + * The arguments that are valid in a call to this method are + * - '-d' Turn on debugging mode + * - '-f' Option to read in the list of svc.conf file names + * - '-k' Option to read a wide string where in the logger output can + * be written + * - '-y' Turn on the flag for a repository of statically + * linked services + * - '-n' Need not have a repository of statically linked services + * - '-S' Option to read in the list of services on the command-line + * Please observe the difference between options '-f' that looks + * for a list of files and here a list of services. + */ + int parse_args (int argc, ACE_TCHAR *argv[]); + + /** + * Process (or re-process) service configuration requests that are + * provided in the svc.conf file(s). Returns the number of errors + * that occurred. + */ + int process_directives (bool ignore_default_svc_conf_file); + + /// Tidy up and perform last rites when ACE_Service_Config is shut + /// down. This method calls @c close_svcs. Returns 0. + int close (void); + + /// Registers a service descriptor for a static service object + int insert (ACE_Static_Svc_Descriptor *stsd); + + // = Utility methods. + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + /// Dynamically link the shared object file and retrieve a pointer to + /// the designated shared object in this file. Also account for the + /// possiblity to have static services registered when loading the DLL, by + /// ensuring that the dynamic sevice is registered before any of its + /// subordibnate static services. Thus avoiding any finalization order + /// problems. + int initialize (const ACE_Service_Type_Factory *, + const ACE_TCHAR *parameters); +#endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ + + /// Dynamically link the shared object file and retrieve a pointer to + /// the designated shared object in this file. + /// @deprecated + /// @note This is error-prone in the presense of dynamic services, + /// which in turn initialize their own static services. This method + /// will allow those static services to register *before* the dynamic + /// service that owns them. Upon finalization of the static services + /// the process will typically crash, because the dynamic service's + /// DLL may have been already released, together with the memory in + /// which the static services reside. It may not crash, for + /// instance, when the first static service to register is the same + /// as the dynamic service being loaded. You should be so lucky! + int initialize (const ACE_Service_Type *, + const ACE_TCHAR *parameters); + + /// Initialize and activate a statically @a svc_name service. + int initialize (const ACE_TCHAR *svc_name, + const ACE_TCHAR *parameters); + + /// Resume a @a svc_name that was previously suspended or has not yet + /// been resumed (e.g., a static service). + int resume (const ACE_TCHAR svc_name[]); + + /** + * Suspend @a svc_name. Note that this will not unlink the service + * from the daemon if it was dynamically linked, it will mark it as + * being suspended in the Service Repository and call the @c suspend() + * member function on the appropriate ACE_Service_Object. A + * service can be resumed later on by calling the @c resume() member + * function... + */ + int suspend (const ACE_TCHAR svc_name[]); + + /// Totally remove @a svc_name from the daemon by removing it + /// from the ACE_Reactor, and unlinking it if necessary. + int remove (const ACE_TCHAR svc_name[]); + + /** + * Using the supplied name, finds and (if needed) returns a pointer to a + * static service descriptor. Returns 0 for success and -1 for failure + */ + int find_static_svc_descriptor (const ACE_TCHAR* name, + ACE_Static_Svc_Descriptor **ssd = 0) const; + + struct Processed_Static_Svc + { + Processed_Static_Svc (const ACE_Static_Svc_Descriptor *); + ~Processed_Static_Svc (void); + ACE_TCHAR * name_; + const ACE_Static_Svc_Descriptor *assd_; + }; + + /// Get the current ACE_Service_Repository held by this object. + ACE_Service_Repository* current_service_repository (void); + +protected: + + int parse_args_i (int, ACE_TCHAR *argv[], + bool& ignore_default_svc_conf_file); + + /** + * Performs an open without parsing command-line arguments. The + * @a logger_key indicates where to write the logging output, which + * is typically either a STREAM pipe or a socket address. If + * @a ignore_default_svc_conf_file is non-0 then the "svc.conf" file + * will be ignored. If @a ignore_debug_flag is non-0 then the + * application is responsible for setting the + * @c ACE_Log_Msg::priority_mask() appropriately. Returns number of + * errors that occurred on failure and 0 otherwise. + */ + int open_i (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key = 0, + bool ignore_static_svcs = true, + bool ignore_default_svc_conf_file = false, + bool ignore_debug_flag = false); + + /// Initialize the @c svc_conf_file_queue_ if necessary. + int init_svc_conf_file_queue (void); + + /// Add the default statically-linked services to the + /// ACE_Service_Repository. + int load_static_svcs (void); + + /// Process service configuration requests that were provided on the + /// command-line. Returns the number of errors that occurred. + int process_commandline_directives (void); + + /// Process a static directive without also inserting its descriptor + /// the global table. This avoids multiple additions when processing + /// directives in non-global gestalts. + int process_directive_i (const ACE_Static_Svc_Descriptor &ssd, + bool force_replace = false); + +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + /// This is the implementation function that process_directives() + /// and process_directive() both call. Returns the number of errors + /// that occurred. + int process_directives_i (ACE_Svc_Conf_Param *param); +#else + /// Helper function to dynamically link in the XML Service Configurator + /// parser. + ACE_XML_Svc_Conf* get_xml_svc_conf (ACE_DLL &d); +#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ + + /// Dynamically link the shared object file and retrieve a pointer to + /// the designated shared object in this file. + int initialize_i (const ACE_Service_Type *sr, const ACE_TCHAR *parameters); + + const ACE_Static_Svc_Descriptor* find_processed_static_svc (const ACE_TCHAR*); + void add_processed_static_svc (const ACE_Static_Svc_Descriptor *); + + /// Performs the common initialization tasks for a new or previously + /// closed instance. Must not be virtual, as it is called from the + /// constructor. + int init_i (void); + +protected: + + /// Maintain a queue of services to be configured from the + /// command-line. + typedef ACE_Unbounded_Queue ACE_SVC_QUEUE; + typedef ACE_Unbounded_Queue_Iterator ACE_SVC_QUEUE_ITERATOR; + + /// Maintain a set of the statically linked service descriptors. + typedef ACE_Unbounded_Set + ACE_STATIC_SVCS; + + typedef ACE_Unbounded_Set_Iterator + ACE_STATIC_SVCS_ITERATOR; + + typedef ACE_Unbounded_Set + ACE_PROCESSED_STATIC_SVCS; + + typedef ACE_Unbounded_Set_Iterator + ACE_PROCESSED_STATIC_SVCS_ITERATOR; + + friend class ACE_Dynamic_Service_Base; + friend class ACE_Service_Object; + friend class ACE_Service_Config; + friend class ACE_Service_Config_Guard; + +protected: + + /// Do we own the service repository instance, or have only been + /// given a ptr to the singleton? + bool svc_repo_is_owned_; + + /// Repository size is necessary, so that we can close (which may + /// destroy the repository instance), and then re-open again. + size_t svc_repo_size_; + + /// Keep track of the number of times the instance has been + /// initialized (opened). "If so, we can't allow to be called since + /// it's not reentrant" is the original motivation, but that does not seem + /// to be the case anymore. This variable is incremented by the + /// method and decremented by the + /// method. + int is_opened_; + + /// Indicates where to write the logging output. This is typically + /// either a STREAM pipe or a socket + const ACE_TCHAR *logger_key_; + + /// Should we avoid loading the static services? + bool no_static_svcs_; + + /// Queue of services specified on the command-line. + ACE_SVC_QUEUE* svc_queue_; + + /** + * Queue of svc.conf files specified on the command-line. + * @@ This should probably be made to handle unicode filenames... + */ + ACE_SVC_QUEUE* svc_conf_file_queue_; + + /// The service repository to hold the services. + ACE_Service_Repository* repo_; + + /// Repository of statically linked services. + ACE_STATIC_SVCS* static_svcs_; + + /// Repository of statically linked services for which process + /// directive was called, but the service is not already a member of + /// the static_svcs_ list. + ACE_PROCESSED_STATIC_SVCS* processed_static_svcs_; + + /// Support for intrusive reference counting + ACE_Atomic_Op refcnt_; + + public: + static void intrusive_add_ref (ACE_Service_Gestalt*); + static void intrusive_remove_ref (ACE_Service_Gestalt*); + +}; /* class ACE_Service_Gestalt */ + + +/** + * @class ACE_Service_Type_Dynamic_Guard + * + * @brief A forward service declaration guard. + * + * Helps to resolve an issue with hybrid services, i.e. dynamic + * services, accompanied by static services in the same DLL. Only + * automatic instances of this class are supposed to exist. Those are + * created during (dynamic) service initialization and serve to: + * + * (a) Ensure the service we are loading is ordered last in the + * repository, following any other services it may cause to register, + * as part of its own registration. This is a common case when + * loading dynamic services from DLLs - there are often static + * initializers, which register static services. + * + * (b) The SDG instance destructor detects if the dynamic service + * initialized successfully and "fixes-up" all the newly registered + * static services to hold a reference to the DLL, from which they + * have originated. + */ +class ACE_Export ACE_Service_Type_Dynamic_Guard +{ +public: + ACE_Service_Type_Dynamic_Guard (ACE_Service_Repository &r, + ACE_TCHAR const *name); + + ~ACE_Service_Type_Dynamic_Guard (void); + +private: + ACE_Service_Repository & repo_; + size_t repo_begin_; + ACE_TCHAR const * const name_; + +# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + ACE_Guard< ACE_Recursive_Thread_Mutex > repo_monitor_; +#endif +}; + + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Service_Gestalt.inl" +#endif /* __ACE_INLINE__ */ + + +#include /**/ "ace/post.h" + +#endif /* ACE_SERVICE_GESTALT_H */ diff --git a/externals/ace/Service_Gestalt.inl b/externals/ace/Service_Gestalt.inl new file mode 100644 index 0000000..696dbf1 --- /dev/null +++ b/externals/ace/Service_Gestalt.inl @@ -0,0 +1,76 @@ +// -*- C++ -*- +// +// $Id: Service_Gestalt.inl 83780 2008-11-17 08:37:37Z johnnyw $ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + +// This is the primary entry point into the ACE_Service_Config (the +// constructor just handles simple initializations). + +ACE_INLINE int +ACE_Service_Gestalt::open (const ACE_TCHAR program_name[], + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf, + bool ignore_debug_flag) +{ + ACE_TRACE ("ACE_Service_Gestalt::open"); + this->no_static_svcs_ = ignore_static_svcs; + + return this->open_i (program_name, + logger_key, + ignore_static_svcs, + ignore_default_svc_conf, + ignore_debug_flag); +} + +ACE_INLINE int +ACE_Service_Gestalt::open (int argc, + ACE_TCHAR *argv[], + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf, + bool ignore_debug_flag) +{ + ACE_TRACE ("ACE_Service_Gestalt::open"); + + this->no_static_svcs_ = ignore_static_svcs; + + if (this->parse_args_i (argc, + argv, + ignore_default_svc_conf) == -1) + return -1; + + return this->open_i (argv == 0 ? 0 : argv[0], + logger_key, + ignore_static_svcs, + ignore_default_svc_conf, + ignore_debug_flag); +} + +/// Searches for a service object declaration in the local repo, only + +ACE_INLINE int +ACE_Service_Gestalt::find (const ACE_TCHAR name[], + const ACE_Service_Type **srp, + bool ignore_suspended) const +{ + // Closing the gestalt will have disassociated it from the + // repository. If the repository used to be owned by the gestalt, it + // will also have been destroyed - so just check for repo_ before + // doing anything with it. + if (this->repo_ != 0) + return this->repo_->find (name, srp, ignore_suspended); + + return 0; +} + +ACE_INLINE ACE_Service_Repository* +ACE_Service_Gestalt::current_service_repository (void) +{ + return this->repo_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Manager.cpp b/externals/ace/Service_Manager.cpp new file mode 100644 index 0000000..5a4dbcb --- /dev/null +++ b/externals/ace/Service_Manager.cpp @@ -0,0 +1,437 @@ +// $Id: Service_Manager.cpp 82723 2008-09-16 09:35:44Z johnnyw $ + +#include "ace/Service_Manager.h" + +#include "ace/Get_Opt.h" +#include "ace/Log_Msg.h" +#include "ace/Service_Repository.h" +#include "ace/Service_Config.h" +#include "ace/Service_Types.h" +#include "ace/Reactor.h" +#include "ace/WFMO_Reactor.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ace, + Service_Manager, + "$Id: Service_Manager.cpp 82723 2008-09-16 09:35:44Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE (ACE_Service_Manager) + +void +ACE_Service_Manager::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Manager::dump"); +#endif /* ACE_HAS_DUMP */ +} + +// Static variables. + +u_short ACE_Service_Manager::DEFAULT_PORT_ = 10000; + +ACE_Service_Manager::ACE_Service_Manager (void) + : debug_ (false), + signum_ (SIGHUP) +{ + ACE_TRACE ("ACE_Service_Manager::ACE_Service_Manager"); +} + +ACE_Service_Manager::~ACE_Service_Manager (void) +{ + ACE_TRACE ("ACE_Service_Manager::~ACE_Service_Manager"); +} + +int +ACE_Service_Manager::suspend (void) +{ + ACE_TRACE ("ACE_Service_Manager::suspend"); + return ACE_Reactor::instance ()->suspend_handler (this); +} + +int +ACE_Service_Manager::resume (void) +{ + ACE_TRACE ("ACE_Service_Manager::resume"); + return ACE_Reactor::instance ()->resume_handler (this); +} + +int +ACE_Service_Manager::open (const ACE_INET_Addr &sia) +{ + ACE_TRACE ("ACE_Service_Manager::open"); + + // Reuse the listening address, even if it's already in use! + if (this->acceptor_.open (sia, 1) == -1) + { + return -1; + } + + return 0; +} + +int +ACE_Service_Manager::info (ACE_TCHAR **strp, size_t length) const +{ + ACE_TRACE ("ACE_Service_Manager::info"); + ACE_INET_Addr sa; + ACE_TCHAR buf[BUFSIZ]; + + if (this->acceptor_.get_local_addr (sa) == -1) + { + return -1; + } + + ACE_OS::sprintf (buf, + ACE_TEXT ("%d/%s %s"), + sa.get_port_number (), + ACE_TEXT ("tcp"), + ACE_TEXT ("# lists all services in the daemon\n")); + + if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) + { + return -1; + } + else + { + ACE_OS::strsncpy (*strp, buf, length); + } + + return static_cast (ACE_OS::strlen (buf)); +} + +int +ACE_Service_Manager::init (int argc, ACE_TCHAR *argv[]) +{ + ACE_TRACE ("ACE_Service_Manager::init"); + ACE_INET_Addr local_addr (ACE_Service_Manager::DEFAULT_PORT_); + + //FUZZ: disable check_for_lack_ACE_OS + ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("dp:s:"), 0); // Start at argv[0] + + for (int c; (c = getopt ()) != -1; ) + //FUZZ: enable check_for_lack_ACE_OS + switch (c) + { + case 'd': + this->debug_ = true; + break; + case 'p': + local_addr.set ((u_short) ACE_OS::atoi (getopt.opt_arg ())); + break; + case 's': + this->signum_ = ACE_OS::atoi (getopt.opt_arg ()); + break; + default: + break; + } + + if (this->get_handle () == ACE_INVALID_HANDLE && + this->open (local_addr) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("open")), -1); + } + else if (ACE_Reactor::instance ()->register_handler + (this, + ACE_Event_Handler::ACCEPT_MASK) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("registering service with ACE_Reactor\n")), + -1); + } + + return 0; +} + +int +ACE_Service_Manager::handle_close (ACE_HANDLE, ACE_Reactor_Mask) +{ + ACE_TRACE ("ACE_Service_Manager::handle_close"); + return this->acceptor_.close (); +} + +int +ACE_Service_Manager::fini (void) +{ + ACE_TRACE ("ACE_Service_Manager::fini"); + + int retv = 0; + + if (this->get_handle () != ACE_INVALID_HANDLE) + { + retv = + ACE_Reactor::instance ()->remove_handler ( + this, + ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); + + this->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::NULL_MASK); + } + + return retv; +} + +ACE_HANDLE +ACE_Service_Manager::get_handle (void) const +{ + ACE_TRACE ("ACE_Service_Manager::get_handle"); + return this->acceptor_.get_handle (); +} + +int +ACE_Service_Manager::handle_signal (int, siginfo_t *, ucontext_t *) +{ + return 0; +} + +// Determine all the services offered by this daemon and return the +// information back to the client. + +int +ACE_Service_Manager::list_services (void) +{ + ACE_TRACE ("ACE_Service_Manager::list_services"); + ACE_Service_Repository_Iterator sri (*ACE_Service_Repository::instance (), 0); + + for (const ACE_Service_Type *sr; + sri.next (sr) != 0; + sri.advance ()) + { + ssize_t len = static_cast (ACE_OS::strlen (sr->name ())) + 11; + ACE_TCHAR buf[BUFSIZ]; + ACE_TCHAR *p = buf + len; + + ACE_OS::strcpy (buf, sr->name ()); + ACE_OS::strcat (buf, (sr->active ()) ? + ACE_TEXT (" (active) ") : + ACE_TEXT (" (paused) ")); + + p[-1] = ' '; + p[0] = '\0'; + + len += sr->type ()->info (&p, sizeof buf - len); + + if (this->debug_) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("len = %d, info = %s%s"), + len, + buf, + buf[len - 1] == '\n' ? ACE_TEXT ("") : ACE_TEXT ("\n"))); + } + + if (len > 0) + { + ssize_t n = this->client_stream_.send_n (buf, len); + + if (n <= 0 && errno != EPIPE) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("send_n"))); + } + } + } + + return 0; +} + +// Trigger a reconfiguration of the Service Configurator via its +// svc.conf file. + +int +ACE_Service_Manager::reconfigure_services (void) +{ + ACE_TRACE ("ACE_Service_Manager::reconfigure_services"); + +#if 0 +// Send ourselves a signal! ACE_OS::kill (ACE_OS::getpid (), +// this->signum_); +#endif /* 0 */ + + // Flag the main event loop that a reconfiguration should occur. + // The next trip through the should + // pick this up and cause a reconfiguration. Note that we can't + // trigger the reconfiguration automatically since that might "pull + // the rug" out from underneath the existing services in a + // problematic way. + ACE_Service_Config::reconfig_occurred ((sig_atomic_t) 1); + return static_cast (this->client_stream_.send_n ("done\n", + sizeof ("done\n"))); +} + +// isolate the request-processing code +void +ACE_Service_Manager::process_request (ACE_TCHAR *request) +{ + ACE_TRACE("ACE_Service_Manager::process_request"); + ACE_TCHAR *p; + + // Kill trailing newlines. + for (p = request; + (*p != '\0') && (*p != '\r') && (*p != '\n'); + p++) + { + continue; + } + + *p = '\0'; + + if (ACE_OS::strcmp (request, ACE_TEXT ("help")) == 0) + { + // Return a list of the configured services. + this->list_services (); + } + else if (ACE_OS::strcmp (request, ACE_TEXT ("reconfigure") )== 0) + { + // Trigger a reconfiguration by re-reading the local file. + this->reconfigure_services (); + } + else + { + // Just process a single request passed in via the socket + // remotely. + ACE_Service_Config_Guard guard (ACE_Service_Config::global ()); + ACE_Service_Config::process_directive (request); + } + + // Additional management services may be handled here... +} + +// Accept new connection from client and carry out the service they +// request. + +int +ACE_Service_Manager::handle_input (ACE_HANDLE) +{ + ACE_TRACE ("ACE_Service_Manager::handle_input"); + + // Try to find out if the implementation of the reactor that we are + // using requires us to reset the event association for the newly + // created handle. This is because the newly created handle will + // inherit the properties of the listen handle, including its event + // associations. + bool reset_new_handle = + ACE_Reactor::instance ()->uses_event_associations (); + + if (this->acceptor_.accept (this->client_stream_, // stream + 0, // remote address + 0, // timeout + 1, // restart + reset_new_handle // reset new handler + ) == -1) + { + return -1; + } + + if (this->debug_) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("client_stream fd = %d\n"), + this->client_stream_.get_handle ())); + ACE_INET_Addr sa; + + if (this->client_stream_.get_remote_addr (sa) == -1) + { + return -1; + } + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("accepted from host %C at port %d\n"), + sa.get_host_name (), + sa.get_port_number ())); + } + + ACE_TCHAR request[BUFSIZ]; + ACE_TCHAR* offset = request; + ssize_t remaining = sizeof (request); + + // Read service request from client. + + ssize_t result; + + // Keep looping until we actually get the request. Note that Win32 + // sets the socket into non-blocking mode, so we may need to loop if + // the system is heavily loaded. Read bytes into the buffer until a + // '\n' or '\r' is found in the buffer, otherwise the buffer + // contains an incomplete string. + + int error; + + do + { + result = client_stream_.recv (offset, remaining); + error = errno; + + if (result == 0 && error != EWOULDBLOCK) + { + remaining = 0; + } + + if (result >= 0) + { + if ((remaining -= result) <= 0) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("Request buffer overflow.\n"))); + result = 0; + break; + } + + offset += result; + *offset = 0; + + if (ACE_OS::strchr (request, '\r') != 0 + || ACE_OS::strchr (request, '\n') != 0) + { + remaining = 0; + } + } + } + while ((result == -1 && error == EWOULDBLOCK) || remaining > 0); + + switch (result) + { + case -1: + if (this->debug_) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("recv"))); + } + + break; + case 0: + return 0; + /* NOTREACHED */ + default: + { + ACE_Event_Handler *old_signal_handler = 0; + ACE_Reactor::instance ()->register_handler (SIGPIPE, + this, + 0, + &old_signal_handler); + + this->process_request (request); + + // Restore existing SIGPIPE handler + ACE_Reactor::instance ()->register_handler (SIGPIPE, + old_signal_handler); + } + } + + if (this->client_stream_.close () == -1 && this->debug_) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("close"))); + } + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Manager.h b/externals/ace/Service_Manager.h new file mode 100644 index 0000000..13ce604 --- /dev/null +++ b/externals/ace/Service_Manager.h @@ -0,0 +1,120 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Service_Manager.h + * + * $Id: Service_Manager.h 81388 2008-04-23 14:02:05Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_SERVICE_MANAGER_H +#define ACE_SERVICE_MANAGER_H +#include /**/ "ace/pre.h" + +#include "ace/SOCK_Stream.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SOCK_Acceptor.h" +#include "ace/INET_Addr.h" +#include "ace/Service_Object.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Service_Manager + * + * @brief Provide a standard ACE service for managing all the services + * configured in an ACE_Service_Repository. + * + * This implementation is simple and just handles each client + * request one at a time. There are currently 3 types of requests: + * - List services: If the string "help" is sent, return a list of all + * the services supported by the Service Configurator. + * - Reconfigure: If the string "reconfigure" is sent trigger a + * reconfiguration, which will re-read the local file. + * - Process directive: If neither "help" nor "reconfigure" is sent, + * simply treat the incoming string as a process directive and pass + * it along to . This allows + * remote configuration via command-line instructions like + * % echo suspend My_Remote_Service | telnet hostname 3911 + * + * Each request is associated with a new connection, which is closed + * when the request is processed. In addition, you must be using the + * singleton in order to trigger + * reconfigurations. + */ +class ACE_Export ACE_Service_Manager : public ACE_Service_Object +{ +public: + // = Initialization and termination hooks. + /// Constructor. + ACE_Service_Manager (void); + + /// Destructor. + virtual ~ACE_Service_Manager (void); + +protected: + // = Perform the various meta-services. + + /// Trigger a reconfiguration of the Service Configurator by + /// re-reading its local file. + virtual int reconfigure_services (void); + + /// Determine all the services offered by this daemon and return the + /// information back to the client. + virtual int list_services (void); + + // = Dynamic linking hooks. + virtual int init (int argc, ACE_TCHAR *argv[]); + virtual int info (ACE_TCHAR **info_string, size_t length) const; + virtual int fini (void); + + // = Scheduling hooks. + virtual int suspend (void); + virtual int resume (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + int open (const ACE_INET_Addr &sia); + + // = Demultiplexing hooks. + virtual ACE_HANDLE get_handle (void) const; + virtual int handle_input (ACE_HANDLE fd); + virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask); + virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); + + /// Handle one request. + virtual void process_request (ACE_TCHAR *request); + + /// Connection to the client (we only support one client connection + /// at a time). + ACE_SOCK_Stream client_stream_; + + /// Acceptor instance. + ACE_SOCK_Acceptor acceptor_; + + /// Keep track whether we debug or not. + bool debug_; + + /// The signal used to trigger reconfiguration. + int signum_; + + /// Default port for the Acceptor to listen on. + static u_short DEFAULT_PORT_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* _SERVICE_MANAGER_H */ diff --git a/externals/ace/Service_Object.cpp b/externals/ace/Service_Object.cpp new file mode 100644 index 0000000..0ac76be --- /dev/null +++ b/externals/ace/Service_Object.cpp @@ -0,0 +1,183 @@ +// $Id: Service_Object.cpp 90077 2010-05-05 16:19:16Z cbeaulac $ + +#include "ace/config-all.h" + +#include "ace/Service_Object.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Service_Object.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/OS_NS_stdio.h" +#include "ace/Service_Types.h" +#include "ace/DLL.h" +#include "ace/ACE.h" +#include "ace/Log_Msg.h" +#if defined (ACE_OPENVMS) +# include "ace/Lib_Find.h" +#endif + +ACE_RCSID (ace, + Service_Object, + "$Id: Service_Object.cpp 90077 2010-05-05 16:19:16Z cbeaulac $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Service_Object) +ACE_ALLOC_HOOK_DEFINE(ACE_Service_Type) + +void +ACE_Service_Type::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Type::dump"); +#endif /* ACE_HAS_DUMP */ + + + // Using printf, since the log facility may not have been + // initialized yet. Using a "//" prefix, in case the executable + // happens to be a code generator and the output gets embedded in + // the generated C++ code. + ACE_OS::fprintf(stderr, + "// [ST] dump, this=%p, name=%s, type=%p, so=%p, active=%d\n", + this, + this->name_, + this->type_, + (this->type_ != 0) ? this->type_->object () : 0, + this->active_); + +} + +ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *t, + const ACE_DLL &dll, + bool active) + : name_ (0), + type_ (t), + dll_ (dll), + active_ (active), + fini_already_called_ (false) +{ + ACE_TRACE ("ACE_Service_Type::ACE_Service_Type"); + this->name (n); +} + +ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *t, + ACE_SHLIB_HANDLE handle, + bool active) + : name_ (0), + type_ (t), + active_ (active), + fini_already_called_ (false) +{ + ACE_TRACE ("ACE_Service_Type::ACE_Service_Type"); + this->dll_.set_handle (handle); + this->name (n); +} + +ACE_Service_Type::~ACE_Service_Type (void) +{ + ACE_TRACE ("ACE_Service_Type::~ACE_Service_Type"); + this->fini (); + + delete [] const_cast (this->name_); +} + +int +ACE_Service_Type::fini (void) +{ + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) ST::fini - destroying name=%s, dll=%s\n"), + this->name_, + this->dll_.dll_name_)); + + if (this->fini_already_called_) + return 0; + + this->fini_already_called_ = true; + + if (this->type_ == 0) + { + // Returning 1 currently only makes sense for dummy instances, used + // to "reserve" a spot (kind of like forward-declarations) for a + // dynamic service. This is necessary to help enforce the correct + // finalization order, when such service also has any (dependent) + // static services + + return 1; // No implementation was found. + } + + int ret = this->type_->fini (); + + // Ensure type is 0 to prevent invalid access after call to fini. + this->type_ = 0; + + // Ensure that closing the DLL is done after type_->fini() as it may + // require access to the code for the service object destructor, + // which resides in the DLL + + return (ret | this->dll_.close ()); +} + +int +ACE_Service_Type::suspend (void) const +{ + ACE_TRACE ("ACE_Service_Type::suspend"); + (const_cast (this))->active_ = false; + return this->type_->suspend (); +} + +int +ACE_Service_Type::resume (void) const +{ + ACE_TRACE ("ACE_Service_Type::resume"); + (const_cast (this))->active_ = true; + return this->type_->resume (); +} + +ACE_Service_Object::ACE_Service_Object (ACE_Reactor *r) + : ACE_Event_Handler (r) +{ + ACE_TRACE ("ACE_Service_Object::ACE_Service_Object"); +} + +ACE_Service_Object::~ACE_Service_Object (void) +{ + ACE_TRACE ("ACE_Service_Object::~ACE_Service_Object"); +} + +int +ACE_Service_Object::suspend (void) +{ + ACE_TRACE ("ACE_Service_Object::suspend"); + return 0; +} + +int +ACE_Service_Object::resume (void) +{ + ACE_TRACE ("ACE_Service_Object::resume"); + return 0; +} + +void +ACE_Service_Type::name (const ACE_TCHAR *n) +{ + ACE_TRACE ("ACE_Service_Type::name"); + + delete [] const_cast (this->name_); + this->name_ = ACE::strnew (n); +} + +#if defined (ACE_OPENVMS) +ACE_Dynamic_Svc_Registrar::ACE_Dynamic_Svc_Registrar (const ACE_TCHAR* alloc_name, + void* svc_allocator) +{ + // register service allocator function by full name in ACE singleton registry + ACE::ldregister (alloc_name, svc_allocator); +} +#endif + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Object.h b/externals/ace/Service_Object.h new file mode 100644 index 0000000..2f24ccb --- /dev/null +++ b/externals/ace/Service_Object.h @@ -0,0 +1,206 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Service_Object.h + * + * $Id: Service_Object.h 84170 2009-01-15 13:31:50Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_SERVICE_OBJECT_H +#define ACE_SERVICE_OBJECT_H +#include /**/ "ace/pre.h" + +#include "ace/Shared_Object.h" +#include "ace/Svc_Conf_Tokens.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Event_Handler.h" +#include "ace/DLL.h" + +#include "ace/Service_Gestalt.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#define ACE_Component ACE_Service_Object + +/** + * @class ACE_Service_Object + * + * @brief Provide the abstract base class common to all service + * implementations. + * + * Classes that inherit from ACE_Service_Objects are capable + * of being registered with the ACE_Reactor (due to the + * ACE_Event_Handler, as well as being dynamically linked by + * the ACE_Service_Config (due to the ACE_Shared_Object). + */ +class ACE_Export ACE_Service_Object + : public ACE_Event_Handler, + public ACE_Shared_Object +{ +public: + // = Initialization and termination methods. + /// Constructor. + ACE_Service_Object (ACE_Reactor * = 0); + + /// Destructor. + virtual ~ACE_Service_Object (void); + + /// Temporarily disable a service without removing it completely. + virtual int suspend (void); + + /// Re-enable a previously suspended service. + virtual int resume (void); +}; + +// Forward decl. +class ACE_Service_Type_Impl; + +/** + * @class ACE_Service_Type + * + * @brief Keeps track of information related to the various + * ACE_Service_Type_Impl subclasses. + * + * This class acts as the interface of the "Bridge" pattern. + */ +class ACE_Export ACE_Service_Type +{ +public: + enum + { + /// Delete the payload object. + DELETE_OBJ = 1, + + /// Delete the enclosing object. + DELETE_THIS = 2 + }; + + enum + { + SERVICE_OBJECT = ACE_SVC_OBJ_T, + MODULE = ACE_MODULE_T, + STREAM = ACE_STREAM_T, + INVALID_TYPE = -1 + }; + + // = Initialization and termination methods. + ACE_Service_Type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *o, + const ACE_DLL &dll, + bool active); + ACE_Service_Type (const ACE_TCHAR *n, + ACE_Service_Type_Impl *o, + ACE_SHLIB_HANDLE handle, + bool active); + ~ACE_Service_Type (void); + + const ACE_TCHAR *name (void) const; + void name (const ACE_TCHAR *); + + const ACE_Service_Type_Impl *type (void) const; + void type (const ACE_Service_Type_Impl *, bool active = true); + + /// Is this just a stub for the real thing? + bool is_forward_declaration (void) const; + + int suspend (void) const; + int resume (void) const; + bool active (void) const; + void active (bool turnon); + + /// Calls @c fini on @c type_ + int fini (void); + + /// Check if the service has been fini'ed. + bool fini_called (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Get to the DLL's implentation + const ACE_DLL & dll (void) const; + + /// Sets the DLL + void dll (const ACE_DLL&); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Humanly readible name of svc. + const ACE_TCHAR *name_; + + /// Pointer to C++ object that implements the svc. + const ACE_Service_Type_Impl *type_; + + /// ACE_DLL representing the shared object file (non-zero if + /// dynamically linked). + mutable ACE_DLL dll_; + + /// true if svc is currently active, otherwise false. + bool active_; + + /// true if @c fini on @c type_ has already been called, otherwise false. + bool fini_already_called_; +}; + +/** + * @class ACE_Service_Object_Ptr + * + * @brief This is a smart pointer that holds onto the associated + * ACE_Service_Object * until the current scope is left, at + * which point the object's fini() hook is called and the + * service_object_ gets deleted. + * + * This class is similar to the Standard C++ Library class + * auto_ptr. It is used in conjunction with statically linked + * ACE_Service_Objects, as shown in the ./netsvcs/server/main.cpp example. + */ +class ACE_Export ACE_Service_Object_Ptr +{ +public: + // = Initialization and termination methods. + /// Acquire ownership of the @a so. + ACE_Service_Object_Ptr (ACE_Service_Object *so); + + /// Release the held ACE_Service_Object by calling its fini() hook. + ~ACE_Service_Object_Ptr (void); + + /// Smart pointer to access the underlying ACE_Service_Object. + ACE_Service_Object *operator-> (); + +private: + /// Holds the service object until we're done. + ACE_Service_Object *service_object_; +}; + +#if defined (ACE_OPENVMS) +/** + * @class ACE_Dynamic_Svc_Registrar + * + * @brief Used to register Service allocator function by its full name. + */ +class ACE_Dynamic_Svc_Registrar +{ +public: + ACE_Dynamic_Svc_Registrar (const ACE_TCHAR* alloc_name, + void* svc_allocator); +}; +#endif + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Service_Object.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_SERVICE_OBJECT_H */ diff --git a/externals/ace/Service_Object.inl b/externals/ace/Service_Object.inl new file mode 100644 index 0000000..6283f3e --- /dev/null +++ b/externals/ace/Service_Object.inl @@ -0,0 +1,79 @@ +// -*- C++ -*- +// $Id: Service_Object.inl 81388 2008-04-23 14:02:05Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_Service_Object_Ptr::ACE_Service_Object_Ptr (ACE_Service_Object *so) + : service_object_ (so) +{ +} + +ACE_INLINE ACE_Service_Object_Ptr::~ACE_Service_Object_Ptr (void) +{ + this->service_object_->fini (); + delete this->service_object_; +} + +ACE_INLINE ACE_Service_Object * +ACE_Service_Object_Ptr::operator-> () +{ + return this->service_object_; +} + +ACE_INLINE const ACE_TCHAR * +ACE_Service_Type::name (void) const +{ + ACE_TRACE ("ACE_Service_Type::name"); + return this->name_; +} + +ACE_INLINE const ACE_Service_Type_Impl * +ACE_Service_Type::type (void) const +{ + ACE_TRACE ("ACE_Service_Type::type"); + return this->type_; +} + +ACE_INLINE void +ACE_Service_Type::type (const ACE_Service_Type_Impl *o, bool enabled) +{ + ACE_TRACE ("ACE_Service_Type::type"); + this->type_ = o; + ((ACE_Service_Type *) this)->active_ = enabled; +} + +ACE_INLINE bool +ACE_Service_Type::active (void) const +{ + ACE_TRACE ("ACE_Service_Type::active"); + return this->active_; +} + +ACE_INLINE void +ACE_Service_Type::active (bool turnon) +{ + ACE_TRACE ("ACE_Service_Type::active"); + this->active_ = turnon; +} + +ACE_INLINE bool +ACE_Service_Type::fini_called (void) const +{ + ACE_TRACE ("ACE_Service_Type::fini_called"); + return this->fini_already_called_; +} + +ACE_INLINE const ACE_DLL & ACE_Service_Type::dll () const +{ + ACE_TRACE ("ACE_Service_Type::dll"); + return this->dll_; +} + +ACE_INLINE void ACE_Service_Type::dll (const ACE_DLL &adll) +{ + ACE_TRACE ("ACE_Service_Type::dll"); + this->dll_ = adll; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/externals/ace/Service_Repository.cpp b/externals/ace/Service_Repository.cpp new file mode 100644 index 0000000..1019514 --- /dev/null +++ b/externals/ace/Service_Repository.cpp @@ -0,0 +1,630 @@ +// $Id: Service_Repository.cpp 90337 2010-05-28 20:00:49Z cbeaulac $ + +#include "ace/Service_Repository.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Service_Repository.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Service_Types.h" +#include "ace/Object_Manager.h" +#include "ace/Log_Msg.h" +#include "ace/ACE.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID (ace, + Service_Repository, + "$Id: Service_Repository.cpp 90337 2010-05-28 20:00:49Z cbeaulac $") + + ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository) + +/// Process-wide Service Repository. +ACE_Service_Repository *ACE_Service_Repository::svc_rep_ = 0; + +/// Controls whether the Service_Repository is deleted when we shut +/// down (we can only delete it safely if we created it)! +bool ACE_Service_Repository::delete_svc_rep_ = false; + +void +ACE_Service_Repository::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Repository::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Service_Repository * +ACE_Service_Repository::instance (size_t size) +{ + ACE_TRACE ("ACE_Service_Repository::instance"); + + if (ACE_Service_Repository::svc_rep_ == 0) + { + // Perform Double-Checked Locking Optimization. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + if (ACE_Service_Repository::svc_rep_ == 0) + { + if (ACE_Object_Manager::starting_up () || + !ACE_Object_Manager::shutting_down ()) + { + ACE_NEW_RETURN (ACE_Service_Repository::svc_rep_, + ACE_Service_Repository (size), + 0); + ACE_Service_Repository::delete_svc_rep_ = true; + } + } + } + + return ACE_Service_Repository::svc_rep_; +} + +ACE_Service_Repository * +ACE_Service_Repository::instance (ACE_Service_Repository *s) +{ + ACE_TRACE ("ACE_Service_Repository::instance"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + + ACE_Service_Repository *t = ACE_Service_Repository::svc_rep_; + // We can't safely delete it since we don't know who created it! + ACE_Service_Repository::delete_svc_rep_ = false; + + ACE_Service_Repository::svc_rep_ = s; + return t; +} + +void +ACE_Service_Repository::close_singleton (void) +{ + ACE_TRACE ("ACE_Service_Repository::close_singleton"); + + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance ())); + + if (ACE_Service_Repository::delete_svc_rep_) + { + delete ACE_Service_Repository::svc_rep_; + ACE_Service_Repository::svc_rep_ = 0; + ACE_Service_Repository::delete_svc_rep_ = false; + } +} + +/// Initialize the Repository to a clean slate. +int +ACE_Service_Repository::open (size_t size) +{ + ACE_TRACE ("ACE_Service_Repository::open"); + + // Create a new array and swap it with the local array + array_type local_array (size); + this->service_array_.swap (local_array); + + return 0; +} + +ACE_Service_Repository::ACE_Service_Repository (size_t size) + : service_array_ (size) +{ + ACE_TRACE ("ACE_Service_Repository::ACE_Service_Repository"); +} + + +/// Finalize (call fini() and possibly delete) all the services. + +int +ACE_Service_Repository::fini (void) +{ + ACE_TRACE ("ACE_Service_Repository::fini"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + + int retval = 0; + // Do not be tempted to use the prefix decrement operator. Use + // postfix decrement operator since the index is unsigned and may + // wrap around the 0 + // + // debug output for empty service entries +#ifndef ACE_NLOGGING + if (ACE::debug ()) + { + for (size_t i = this->service_array_.size (); i-- != 0;) + { + ACE_Service_Type *s = + const_cast (this->service_array_[i]); + if (s == 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] -> 0\n"), + this, + i)); + } + } +#endif + // + // Remove all the Service_Object and Stream instances + // + for (size_t i = this->service_array_.size (); i-- != 0;) + { + // the services in reverse order. + ACE_Service_Type *s = + const_cast (this->service_array_[i]); + + if (s != 0 && + s->type () != 0 && + (s->type ()->service_type () != ACE_Service_Type::MODULE)) + { +#ifndef ACE_NLOGGING + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ") + ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"), + this, + i, + s->name (), + s->type (), + (s->type () != 0) ? s->type ()->object () : 0, + s->active ())); + } +#endif + + // Collect any errors. + retval += s->fini (); + } + } + // + // Remove all the Module instances + // + for (size_t i = this->service_array_.size (); i-- != 0;) + { + // the services in reverse order. + ACE_Service_Type *s = + const_cast (this->service_array_[i]); + + if (s != 0 && + s->type () != 0 && + (s->type ()->service_type () == ACE_Service_Type::MODULE)) + { +#ifndef ACE_NLOGGING + if (ACE::debug ()) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ") + ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"), + this, + i, + s->name (), + s->type (), + (s->type () != 0) ? s->type ()->object () : 0, + s->active ())); + } +#endif + // Collect any errors. + retval += s->fini (); + } + } + return (retval == 0) ? 0 : -1; +} + + +/// Close down all the services. +int +ACE_Service_Repository::close (void) +{ + ACE_TRACE ("ACE_Service_Repository::close"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + +#ifndef ACE_NLOGGING + if(ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@, size=%d\n"), + this, + this->service_array_.size())); +#endif + + // Do not use the prefix decrement operator since the index is + // unsigned and may wrap around the 0. + for (size_t i = this->service_array_.size(); i-- != 0; ) + { + // Delete services in reverse order. + ACE_Service_Type *s = + const_cast (this->service_array_[i]); + +#ifndef ACE_NLOGGING + if(ACE::debug ()) + { + if (s == 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@ [%d] -> 0\n"), + this, + i)); + else + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@ [%d], name=%s, object=%@\n"), + this, + i, + s->name (), + s)); + } +#endif + delete s; + } + + this->service_array_.clear (); + + return 0; +} + +ACE_Service_Repository::~ACE_Service_Repository (void) +{ + ACE_TRACE ("ACE_Service_Repository::~ACE_Service_Repository"); +#ifndef ACE_NLOGGING + if(ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, "ACE (%P|%t) SR::, this=%@\n", this)); +#endif + this->close (); +} + +/// Locate an entry with @a name in the table. If @a ignore_suspended is +/// set then only consider services marked as resumed. If the caller +/// wants the located entry, pass back a pointer to the located entry +/// via @a srp. If @a name is not found -1 is returned. If @a name is +/// found, but it is suspended and the caller wants to ignore suspended +/// services a -2 is returned. Must be called with locks held. +int +ACE_Service_Repository::find_i (const ACE_TCHAR name[], + size_t &slot, + const ACE_Service_Type **srp, + bool ignore_suspended) const +{ + ACE_TRACE ("ACE_Service_Repository::find_i"); + size_t i = 0; + array_type::const_iterator element = this->service_array_.end (); + + for (i = 0; i < this->service_array_.size(); i++) + { + array_type::const_iterator iter = this->service_array_.find (i); + if (iter != this->service_array_.end () + && (*iter).second != 0 // skip any empty slots + && ACE_OS::strcmp (name, (*iter).second->name ()) == 0) + { + element = iter; + break; + } + } + + if (element != this->service_array_.end ()) + { + slot = i; + if ((*element).second->fini_called ()) + { + if (srp != 0) + *srp = 0; + return -1; + } + + if (srp != 0) + *srp = (*element).second; + + if (ignore_suspended + && (*element).second->active () == 0) + return -2; + + return 0; + } + + return -1; +} + + +/// @brief Relocate (a static) service to another DLL. +/// +/// Works by having the service type keep a reference to a specific +/// DLL. No locking, caller makes sure calling it is safe. You can +/// forcefully relocate any DLLs in the given range, not only the +/// static ones - but that will cause Very Bad Things (tm) to happen. +int +ACE_Service_Repository::relocate_i (size_t begin, + size_t end, + const ACE_DLL& adll) +{ + ACE_SHLIB_HANDLE new_handle = adll.get_handle (0); + + for (size_t i = begin; i < end; i++) + { + ACE_Service_Type *type = + const_cast (this->service_array_[i]); + + ACE_SHLIB_HANDLE old_handle = (type == 0) ? ACE_SHLIB_INVALID_HANDLE + : type->dll ().get_handle (0); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + { + if (type == 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d]") + ACE_TEXT (": skipping empty slot\n"), + this, + i)); + else + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d]") + ACE_TEXT (": trying name=%s, handle: %d -> %d\n"), + this, + i, + type->name (), + old_handle, + new_handle)); + } +#endif + + if (type != 0 // skip any gaps + && old_handle == ACE_SHLIB_INVALID_HANDLE + && new_handle != old_handle) + { +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::relocate_i - repo=%@ [%d]") + ACE_TEXT (": relocating name=%s, handle: %d -> %d\n"), + this, + i, + type->name (), + old_handle, + new_handle)); +#endif + type->dll (adll); // ups the refcount on adll + } + } + + return 0; +} + +int +ACE_Service_Repository::find (const ACE_TCHAR name[], + const ACE_Service_Type **srp, + bool ignore_suspended) const +{ + ACE_TRACE ("ACE_Service_Repository::find"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + size_t ignore_location = 0; + return this->find_i (name, ignore_location, srp, ignore_suspended); +} + +/// Insert the ACE_Service_Type SR into the repository. Note that +/// services may be inserted either resumed or suspended. Using same +/// name as in an existing service causes the delete () to be called +/// for the old one, i.e. make sure @code sr is allocated on the heap! +int +ACE_Service_Repository::insert (const ACE_Service_Type *sr) +{ + ACE_TRACE ("ACE_Service_Repository::insert"); + + size_t i = 0; + int return_value = -1; + ACE_Service_Type const *s = 0; + + // Establish scope for locking while manipulating the service + // storage + { + // @TODO: Do we need a recursive mutex here? + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, + this->lock_, + -1)); + + return_value = find_i (sr->name (), i, &s, false); + + // Adding an entry. + if (s != 0) + { + this->service_array_[i] = sr; + } + else + { + // New services are always added where current_size_ points, + // because if any DLL relocation needs to happen, it will be + // performed on services with indexes between some old + // current_size_ and the new current_size_ value. See + // ACE_Service_Type_Dynamic_Guard ctor and dtor for details. + + if (i < this->service_array_.size ()) + i = this->service_array_.size (); + + this->service_array_[i] = sr; + return_value = 0; + } + } +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::insert - repo=%@ [%d],") + ACE_TEXT (" name=%s (%C) (type=%@, object=%@, active=%d)\n"), + this, + i, + sr->name(), + (return_value == 0 ? ((s==0) ? "new" : "replacing") : "failed"), + sr->type (), + (sr->type () != 0) ? sr->type ()->object () : 0, + sr->active ())); +#endif + + // If necessary, delete but outside the lock. (s may be 0, but + // that's okay, too) + delete s; + + if (return_value == -1) + ACE_OS::last_error (ENOSPC); + + return return_value; +} + +/// Resume a service that was previously suspended. +int +ACE_Service_Repository::resume (const ACE_TCHAR name[], + const ACE_Service_Type **srp) +{ + ACE_TRACE ("ACE_Service_Repository::resume"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + + size_t i = 0; + if (-1 == this->find_i (name, i, srp, 0)) + return -1; + + return this->service_array_[i]->resume (); +} + +/// Suspend a service so that it will not be considered active under +/// most circumstances by other portions of the ACE_Service_Repository. +int +ACE_Service_Repository::suspend (const ACE_TCHAR name[], + const ACE_Service_Type **srp) +{ + ACE_TRACE ("ACE_Service_Repository::suspend"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + size_t i = 0; + if (-1 == this->find_i (name, i, srp, 0)) + return -1; + + return this->service_array_[i]->suspend (); +} + +/** + * @brief Completely remove a @a name entry from the Repository and + * dynamically unlink it if it was originally dynamically linked. + */ +int +ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps) +{ + ACE_TRACE ("ACE_Service_Repository::remove"); + ACE_Service_Type *s = 0; + { + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); + + // Not found!? + if (this->remove_i (name, &s) == -1) + return -1; + } + + if (ps != 0) + *ps = s; + else + delete s; + return 0; +} + +/** + * @brief Completely remove a @a name entry from the Repository and + * dynamically unlink it if it was originally dynamically linked. + * + * Return a ptr to the entry in @code ps. There is no locking so make + * sure you hold the repo lock when calling. + * + * Since the order of services in the Respository matters, we can't + * simply overwrite the entry being deleted with the last and + * decrement the @c current_size by 1. A good example of why the order + * matters is a dynamic service, in whose DLL there is at least one + * static service. In order to prevent SEGV during finalization, those + * static services must be finalized _before_the dynamic service that + * owns them. Otherwice the TEXT segment, containing the code for the + * static service's desructor may be unloaded with the DLL. + * + * Neither can we "pack" the array because this may happen inside the + * scope of a Service_Dynamic_Guard, which caches an index where + * loading of a DLL started in order to relocate dependent services. + */ +int +ACE_Service_Repository::remove_i (const ACE_TCHAR name[], ACE_Service_Type **ps) +{ + size_t i = 0; + if (-1 == this->find_i (name, i, 0, false)) + return -1; // Not found + + // We may need the old ptr - to be delete outside the lock! + *ps = const_cast (this->service_array_[i]); + +#ifndef ACE_NLOGGING + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ACE (%P|%t) SR::remove_i - repo=%@ [%d],") + ACE_TEXT (" name=%s (removed) (type=%@, active=%d)\n"), + this, + i, + name, + *ps, + (*ps)->active ())); +#endif + + this->service_array_[i] = 0; // simply leave a gap + return 0; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository_Iterator) + +void +ACE_Service_Repository_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Repository_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +/// Initializes the iterator and skips over any suspended entries at +/// the beginning of the table, if necessary. Note, you must not +/// perform destructive operations on elements during this iteration... +ACE_Service_Repository_Iterator::ACE_Service_Repository_Iterator + (ACE_Service_Repository &sr, bool ignored_suspended) + : svc_rep_ (sr), + next_ (0), + ignore_suspended_ (ignored_suspended) +{ + while (!(done() || valid())) + this->next_++; +} + +/// Obtains a pointer to the next valid service in the table. If there +/// are no more entries, returns 0, else 1. +int +ACE_Service_Repository_Iterator::next (const ACE_Service_Type *&sr) +{ + ACE_TRACE ("ACE_Service_Repository_Iterator::next"); + + if (done ()) + return 0; + + sr = this->svc_rep_.service_array_[this->next_]; + return 1; +} + +/// Advance the iterator by the proper amount. If we are ignoring +/// suspended entries and the current entry is suspended, then we must +/// skip over this entry. Otherwise, we must advance the NEXT index to +/// reference the next valid service entry. +int +ACE_Service_Repository_Iterator::advance (void) +{ + ACE_TRACE ("ACE_Service_Repository_Iterator::advance"); + + if (done()) return 0; + + do this->next_++; while (!(done () || valid ())); + + return !done(); +} + +bool +ACE_Service_Repository_Iterator::valid (void) const +{ + ACE_TRACE ("ACE_Service_Repository_Iterator::valid"); + if (!this->ignore_suspended_) + return (this->svc_rep_.service_array_[this->next_] != 0); // skip over gaps + + return (this->svc_rep_.service_array_[this->next_] != 0 + && this->svc_rep_.service_array_[this->next_]->active ()); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Repository.h b/externals/ace/Service_Repository.h new file mode 100644 index 0000000..efd80bc --- /dev/null +++ b/externals/ace/Service_Repository.h @@ -0,0 +1,271 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Service_Repository.h + * + * $Id: Service_Repository.h 85007 2009-04-01 14:11:03Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_SERVICE_REPOSITORY_H +#define ACE_SERVICE_REPOSITORY_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Default_Constants.h" +#include "ace/Recursive_Thread_Mutex.h" +#include "ace/Array_Map.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Service_Type; +class ACE_DLL; + +#define ACE_Component_Repository ACE_Service_Repository +/** + * @class ACE_Service_Repository + * + * @brief Contains all the services offered by a Service + * Configurator-based application. + * + * This class contains a vector of ACE_Service_Types *'s and + * allows an administrative entity to centrally manage and + * control the behavior of application services. Note that if + * services are removed from the middle of the repository the + * order won't necessarily be maintained since the @a remove + * method performs compaction. However, the common case is not + * to remove services, so typically they are deleted in the + * reverse order that they were added originally. + */ +class ACE_Export ACE_Service_Repository +{ +public: + friend class ACE_Service_Repository_Iterator; + + enum + { + DEFAULT_SIZE = ACE_DEFAULT_SERVICE_REPOSITORY_SIZE + }; + + // = Initialization and termination methods. + /// Initialize the repository. + ACE_Service_Repository (size_t size = DEFAULT_SIZE); + + /// Initialize the repository. + int open (size_t size = DEFAULT_SIZE); + + /// Close down the repository and free up dynamically allocated + /// resources. + ~ACE_Service_Repository (void); + + /// Close down the repository and free up dynamically allocated + /// resources. + int close (void); + + /// Finalize all the services by calling fini() and deleting + /// dynamically allocated services. + int fini (void); + + /// Get pointer to a process-wide ACE_Service_Repository. + static ACE_Service_Repository * instance + (size_t size = ACE_Service_Repository::DEFAULT_SIZE); + + /// Set pointer to a process-wide ACE_Service_Repository and return + /// existing pointer. + static ACE_Service_Repository *instance (ACE_Service_Repository *); + + /// Delete the dynamically allocated Singleton. + static void close_singleton (void); + + // = Search structure operations (all acquire locks as necessary). + + /// Insert a new service record. Returns -1 when the service repository + /// is full and 0 on success. + int insert (const ACE_Service_Type *sr); + + /** + * Locate a named entry in the service table, optionally ignoring + * suspended entries. + * + * @param service_name The name of the service to search for. + * @param srp Optional; if not 0, it is a pointer to a location + * to receive the ACE_Service_Type pointer for the + * located service. Meaningless if this method + * returns -1. + * @param ignore_suspended If true, the search ignores suspended services. + * + * @retval 0 Named service was located. + * @retval -1 Named service was not found. + * @retval -2 Named service was found, but is suspended and + * @a ignore_suspended is true. + */ + int find (const ACE_TCHAR name[], + const ACE_Service_Type **srp = 0, + bool ignore_suspended = true) const; + + /// Remove an existing service record. If @a sr == 0, the service record + /// is deleted before control is returned to the caller. If @a sr != 0, + /// the service's record is removed from the repository, but not deleted; + /// *sr receives the service record pointer and the caller is responsible + /// for properly disposing of it. + int remove (const ACE_TCHAR name[], ACE_Service_Type **sr = 0); + + // = Liveness control + /// Resume a service record. + int resume (const ACE_TCHAR name[], const ACE_Service_Type **srp = 0); + + /// Suspend a service record. + int suspend (const ACE_TCHAR name[], const ACE_Service_Type **srp = 0); + + /// Return the current size of the repository. + size_t current_size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + + friend class ACE_Service_Type_Dynamic_Guard; + + /// Remove an existing service record. It requires @a sr != 0, which + /// receives the service record pointer and the caller is + /// responsible for properly disposing of it. + int remove_i (const ACE_TCHAR[], ACE_Service_Type **sr); + + /** + * Locate a named entry in the service table, optionally ignoring + * suspended entries. + * + * @param service_name The name of the service to search for. + * @param slot Receives the position index of the service if it + * is found. Contents are meaningless if this method + * returns -1. + * @param srp Optional; if not 0, it is a pointer to a location + * to receive the ACE_Service_Type pointer for the + * located service. Meaningless if this method + * returns -1. + * @param ignore_suspended If true, the search ignores suspended services. + * + * @retval 0 Named service was located; index in the table is set in + * @a slot. + * @retval -1 Named service was not found. + * @retval -2 Named service was found, but is suspended and + * @a ignore_suspended is true. + */ + int find_i (const ACE_TCHAR service_name[], + size_t &slot, + const ACE_Service_Type **srp = 0, + bool ignore_suspended = true) const; + + /// @brief Relocate (static) services to another DLL. + /// + /// If any have been registered in the context of a "forward + /// declaration" guard, those really aren't static services. Their + /// code is in the DLL's code segment, or in one of the dependent + /// DLLs. Therefore, such services need to be associated with the + /// proper DLL in order to prevent failures upon finalization. The + /// method locks the repo. + /// + /// Works by having the service type keep a reference to a specific + /// DLL. No locking, caller makes sure calling it is safe. You can + /// forcefully relocate any DLLs in the given range, not only the + /// static ones - but that will cause Very Bad Things (tm) to happen. + int relocate_i (size_t begin, + size_t end, + const ACE_DLL &adll); + + /// The typedef of the array used to store the services. + typedef ACE_Array_Map array_type; + + /// Contains all the configured services. + array_type service_array_; + + /// Pointer to a process-wide ACE_Service_Repository. + static ACE_Service_Repository *svc_rep_; + + /// Must delete the @c svc_rep_ if true. + static bool delete_svc_rep_; + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// Synchronization variable for the MT_SAFE Repository + mutable ACE_Recursive_Thread_Mutex lock_; +#endif /* ACE_MT_SAFE */ +}; + +/** + * @class ACE_Service_Repository_Iterator + * + * @brief Iterate through the ACE_Service_Repository. + * + * Make sure not to delete entries as the iteration is going on + * since this class is not designed as a robust iterator. + */ +class ACE_Export ACE_Service_Repository_Iterator +{ +public: + // = Initialization and termination methods. + /// Constructor initializes the iterator. + ACE_Service_Repository_Iterator (ACE_Service_Repository &sr, + bool ignored_suspended = true); + + /// Destructor. + ~ACE_Service_Repository_Iterator (void); + + +public: + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the repository. + /// Returns 0 when all items have been seen, else 1. + int next (const ACE_Service_Type *&next_item); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Move forward by one element in the repository. Returns 0 when all the + /// items in the set have been seen, else 1. + int advance (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + bool valid (void) const; + +private: + ACE_Service_Repository_Iterator (const ACE_Service_Repository_Iterator&); + + /// Reference to the Service Repository we are iterating over. + ACE_Service_Repository &svc_rep_; + + /// Next index location that we haven't yet seen. + size_t next_; + + /// Are we ignoring suspended services? + bool const ignore_suspended_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Service_Repository.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* _SERVICE_REPOSITORY_H */ diff --git a/externals/ace/Service_Repository.inl b/externals/ace/Service_Repository.inl new file mode 100644 index 0000000..1645f38 --- /dev/null +++ b/externals/ace/Service_Repository.inl @@ -0,0 +1,38 @@ +// -*- C++ -*- +// +// $Id: Service_Repository.inl 84170 2009-01-15 13:31:50Z johnnyw $ + +// Returns a count of the number of currently valid entries (counting +// both resumed and suspended entries). + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +#include "ace/Guard_T.h" +#include "ace/Thread_Mutex.h" +#endif /* ACE_MT_SAFE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE size_t +ACE_Service_Repository::current_size (void) const +{ + ACE_TRACE ("ACE_Service_Repository::current_size"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, + (ACE_Recursive_Thread_Mutex &) this->lock_, 0)); + return this->service_array_.size (); +} + +ACE_INLINE int +ACE_Service_Repository_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Service_Repository_Iterator::done"); + + return this->next_ >= this->svc_rep_.current_size (); +} + +ACE_INLINE +ACE_Service_Repository_Iterator::~ACE_Service_Repository_Iterator (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Templates.h b/externals/ace/Service_Templates.h new file mode 100644 index 0000000..d05d0d6 --- /dev/null +++ b/externals/ace/Service_Templates.h @@ -0,0 +1,29 @@ + +//============================================================================= +/** + * @file Service_Templates.h + * + * $Id: Service_Templates.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Priyanka Gontla + */ +//============================================================================= + + +#ifndef ACE_SERVICE_TEMPLATES_H +#define ACE_SERVICE_TEMPLATES_H +#include /**/ "ace/pre.h" + +#include "ace/Svc_Conf.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Auto_Ptr.h" +#include "ace/Thread_Manager.h" +#include "ace/Stream_Modules.h" +#include "ace/Stream.h" + +#include /**/ "ace/post.h" +#endif /* ACE_SERVICE_TEMPLATES_H */ diff --git a/externals/ace/Service_Types.cpp b/externals/ace/Service_Types.cpp new file mode 100644 index 0000000..3465d77 --- /dev/null +++ b/externals/ace/Service_Types.cpp @@ -0,0 +1,461 @@ +// $Id: Service_Types.cpp 90072 2010-05-04 21:34:39Z cbeaulac $ + +#include "ace/Service_Types.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Service_Types.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Stream_Modules.h" +#include "ace/Stream.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" + + +ACE_RCSID (ace, + Service_Types, + "$Id: Service_Types.cpp 90072 2010-05-04 21:34:39Z cbeaulac $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +typedef ACE_Stream MT_Stream; +typedef ACE_Module MT_Module; +typedef ACE_Task MT_Task; + +ACE_ALLOC_HOOK_DEFINE(ACE_Service_Type_Impl) + +void +ACE_Service_Type_Impl::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Service_Type_Impl::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Service_Type_Impl::ACE_Service_Type_Impl (void *so, + const ACE_TCHAR *s_name, + u_int f, + ACE_Service_Object_Exterminator gobbler, + int stype) + : name_ (0), + obj_ (so), + gobbler_ (gobbler), + flags_ (f), + service_type_ (stype) +{ + ACE_TRACE ("ACE_Service_Type_Impl::ACE_Service_Type_Impl"); + this->name (s_name); +} + +ACE_Service_Type_Impl::~ACE_Service_Type_Impl (void) +{ + ACE_TRACE ("ACE_Service_Type_Impl::~ACE_Service_Type_Impl"); + + // It's ok to call this, even though we may have already deleted it + // in the fini() method since it would then be NULL. + delete [] const_cast (this->name_); +} + +int +ACE_Service_Type_Impl::fini (void) const +{ + ACE_TRACE ("ACE_Service_Type_Impl::fini"); + + delete [] const_cast (this->name_); + (const_cast (this))->name_ = 0; + + if (ACE_BIT_ENABLED (this->flags_, + ACE_Service_Type::DELETE_OBJ)) + { + if (gobbler_ != 0) + gobbler_ (this->object ()); + else + // Cast to remove const-ness. + operator delete ((void *) this->object ()); + } + + if (ACE_BIT_ENABLED (this->flags_, + ACE_Service_Type::DELETE_THIS)) + delete const_cast (this); + + return 0; +} + +ACE_Service_Object_Type::ACE_Service_Object_Type (void *so, + const ACE_TCHAR *s_name, + u_int f, + ACE_Service_Object_Exterminator gobbler, + int stype) + : ACE_Service_Type_Impl (so, s_name, f, gobbler, stype) + , initialized_ (-1) +{ + ACE_TRACE ("ACE_Service_Object_Type::ACE_Service_Object_Type"); +} + +int +ACE_Service_Object_Type::init (int argc, ACE_TCHAR *argv[]) const +{ + ACE_TRACE ("ACE_Service_Object_Type::init"); + + void * const obj = this->object (); + + ACE_Service_Object * const so = + static_cast (obj); + + if (so == 0) + return -1; + + this->initialized_ = so->init (argc, argv); + + return this->initialized_; +} + +int +ACE_Service_Object_Type::fini (void) const +{ + ACE_TRACE ("ACE_Service_Object_Type::fini"); + + void * const obj = this->object (); + + ACE_Service_Object * const so = + static_cast (obj); + + // Call fini() if an only if, the object was successfuly + // initialized, i.e. init() returned 0. This is necessary to + // maintain the ctor/dtor-like semantics for init/fini. + if (so != 0 && this->initialized_ == 0) + so->fini (); + + return ACE_Service_Type_Impl::fini (); +} + +ACE_Service_Object_Type::~ACE_Service_Object_Type (void) +{ + ACE_TRACE ("ACE_Service_Object_Type::~ACE_Service_Object_Type"); +} + +int +ACE_Service_Object_Type::suspend (void) const +{ + ACE_TRACE ("ACE_Service_Object_Type::suspend"); + return static_cast (this->object ())->suspend (); +} + +int +ACE_Service_Object_Type::resume (void) const +{ + ACE_TRACE ("ACE_Service_Object_Type::resume"); + return static_cast (this->object ())->resume (); +} + +int +ACE_Service_Object_Type::info (ACE_TCHAR **str, size_t len) const +{ + ACE_TRACE ("ACE_Service_Object_Type::info"); + return static_cast (this->object ())->info (str, len); +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Module_Type) + +void +ACE_Module_Type::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Module_Type::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Module_Type::ACE_Module_Type (void *m, + const ACE_TCHAR *m_name, + u_int f, + int stype) + : ACE_Service_Type_Impl (m, m_name, f, 0, stype) +{ + ACE_TRACE ("ACE_Module_Type::ACE_Module_Type"); +} + +ACE_Module_Type::~ACE_Module_Type (void) +{ + ACE_TRACE ("ACE_Module_Type::~ACE_Module_Type"); +} + +int +ACE_Module_Type::init (int argc, ACE_TCHAR *argv[]) const +{ + ACE_TRACE ("ACE_Module_Type::init"); + void *obj = this->object (); + MT_Module *mod = (MT_Module *) obj; + // + // Change the Module's name to what's in the svc.conf file. + // We must do this so the names match up so everything shuts + // down properly during the call to ACE_Stream_Type::fini + // which calls MT_Stream::remove([name]) for all the modules. + // If the calls to remove fail, we end up with a double delete + // during shutdown. Bugzilla #3847 + // + mod->name (this->name_); + MT_Task *reader = mod->reader (); + MT_Task *writer = mod->writer (); + + if (reader->init (argc, argv) == -1 + || writer->init (argc, argv) == -1) + return -1; + else + return 0; +} + +int +ACE_Module_Type::suspend (void) const +{ + ACE_TRACE ("ACE_Module_Type::suspend"); + void *obj = this->object (); + MT_Module *mod = (MT_Module *) obj; + MT_Task *reader = mod->reader (); + MT_Task *writer = mod->writer (); + + if (reader->suspend () == -1 + || writer->suspend () == -1) + return -1; + else + return 0; +} + +int +ACE_Module_Type::resume (void) const +{ + ACE_TRACE ("ACE_Module_Type::resume"); + void *obj = this->object (); + MT_Module *mod = (MT_Module *) obj; + MT_Task *reader = mod->reader (); + MT_Task *writer = mod->writer (); + + if (reader->resume () == -1 + || writer->resume () == -1) + return -1; + else + return 0; +} + +// Note, these operations are somewhat too familiar with the +// implementation of ACE_Module and ACE_Module::close... + +int +ACE_Module_Type::fini (void) const +{ + ACE_TRACE ("ACE_Module_Type::fini"); + void *obj = this->object (); + MT_Module *mod = (MT_Module *) obj; + MT_Task *reader = mod->reader (); + MT_Task *writer = mod->writer (); + + if (reader != 0) + reader->fini (); + + if (writer != 0) + writer->fini (); + + // Close the module and delete the memory. + mod->close (MT_Module::M_DELETE); + return ACE_Service_Type_Impl::fini (); +} + +int +ACE_Module_Type::info (ACE_TCHAR **str, size_t len) const +{ + ACE_TRACE ("ACE_Module_Type::info"); + ACE_TCHAR buf[BUFSIZ]; + + ACE_OS::sprintf (buf, + ACE_TEXT ("%s\t %s"), + this->name (), + ACE_TEXT ("# ACE_Module\n")); + + if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0) + return -1; + else + ACE_OS::strsncpy (*str, buf, len); + return static_cast (ACE_OS::strlen (buf)); +} + +void +ACE_Module_Type::link (ACE_Module_Type *n) +{ + ACE_TRACE ("ACE_Module_Type::link"); + this->link_ = n; +} + +ACE_Module_Type * +ACE_Module_Type::link (void) const +{ + ACE_TRACE ("ACE_Module_Type::link"); + return this->link_; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Stream_Type) + +void +ACE_Stream_Type::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Stream_Type::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_Stream_Type::init (int, ACE_TCHAR *[]) const +{ + ACE_TRACE ("ACE_Stream_Type::init"); + return 0; +} + +int +ACE_Stream_Type::suspend (void) const +{ + ACE_TRACE ("ACE_Stream_Type::suspend"); + + for (ACE_Module_Type *m = this->head_; + m != 0; + m = m->link ()) + m->suspend (); + + return 0; +} + +int +ACE_Stream_Type::resume (void) const +{ + ACE_TRACE ("ACE_Stream_Type::resume"); + + for (ACE_Module_Type *m = this->head_; + m != 0; + m = m->link ()) + m->resume (); + + return 0; +} + +ACE_Stream_Type::ACE_Stream_Type (void *s, + const ACE_TCHAR *s_name, + u_int f, + int stype) + : ACE_Service_Type_Impl (s, s_name, f, 0, stype), + head_ (0) +{ + ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type"); +} + +ACE_Stream_Type::~ACE_Stream_Type (void) +{ + ACE_TRACE ("ACE_Stream_Type::~ACE_Stream_Type"); +} + +int +ACE_Stream_Type::info (ACE_TCHAR **str, size_t len) const +{ + ACE_TRACE ("ACE_Stream_Type::info"); + ACE_TCHAR buf[BUFSIZ]; + + ACE_OS::sprintf (buf, + ACE_TEXT ("%s\t %s"), + this->name (), + ACE_TEXT ("# STREAM\n")); + + if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0) + return -1; + else + ACE_OS::strsncpy (*str, buf, len); + return static_cast (ACE_OS::strlen (buf)); +} + +int +ACE_Stream_Type::fini (void) const +{ + ACE_TRACE ("ACE_Stream_Type::fini"); + void *obj = this->object (); + MT_Stream *str = (MT_Stream *) obj; + + for (ACE_Module_Type *m = this->head_; m != 0;) + { + ACE_Module_Type *t = m->link (); + + // Final arg is an indication to *not* delete the Module. + str->remove (m->name (), + MT_Module::M_DELETE_NONE); + m = t; + } + str->close (); + + return ACE_Service_Type_Impl::fini (); +} + +// Locate and remove from the ACE_Stream. + +int +ACE_Stream_Type::remove (ACE_Module_Type *mod) +{ + ACE_TRACE ("ACE_Stream_Type::remove"); + + ACE_Module_Type *prev = 0; + void *obj = this->object (); + MT_Stream *str = (MT_Stream *) obj; + int result = 0; + + for (ACE_Module_Type *m = this->head_; m != 0; ) + { + // We need to do this first so we don't bomb out if we delete m! + ACE_Module_Type *link = m->link (); + + if (m == mod) + { + if (prev == 0) + this->head_ = link; + else + prev->link (link); + + // Final arg is an indication to *not* delete the Module. + if (str->remove (m->name (), + MT_Module::M_DELETE_NONE) == -1) + result = -1; + + // Do not call m->fini (); as this will result in a double delete + // of the ACE_Module_type when ACE_Service_Repository::fini is called + } + else + prev = m; + + m = link; + } + + return result; +} + +int +ACE_Stream_Type::push (ACE_Module_Type *new_module) +{ + ACE_TRACE ("ACE_Stream_Type::push"); + void *obj = this->object (); + MT_Stream *str = (MT_Stream *) obj; + + new_module->link (this->head_); + this->head_ = new_module; + obj = new_module->object (); + return str->push ((MT_Module *) obj); +} + +ACE_Module_Type * +ACE_Stream_Type::find (const ACE_TCHAR *module_name) const +{ + ACE_TRACE ("ACE_Stream_Type::find"); + + for (ACE_Module_Type *m = this->head_; + m != 0; + m = m->link ()) + if (ACE_OS::strcmp (m->name (), module_name) == 0) + return m; + + return 0; +} + +// @@@ Eliminated ommented out explicit template instantiation code + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Service_Types.h b/externals/ace/Service_Types.h new file mode 100644 index 0000000..70a7ac4 --- /dev/null +++ b/externals/ace/Service_Types.h @@ -0,0 +1,221 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Service_Types.h + * + * $Id: Service_Types.h 89925 2010-04-19 12:49:11Z cbeaulac $ + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_SERVICE_TYPE_H +#define ACE_SERVICE_TYPE_H + +#include /**/ "ace/pre.h" + +#include "ace/Service_Object.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Service_Type_Impl + * + * @brief The abstract base class of the hierarchy that defines the + * contents of the ACE_Service_Repository. The subclasses of + * this class allow the configuration of ACE_Service_Objects, + * ACE_Modules, and ACE_Streams. + * + * This class provides the root of the implementation hierarchy + * of the "Bridge" pattern. It maintains a pointer to the + * appropriate type of service implementation, i.e., + * ACE_Service_Object, ACE_Module, or ACE_Stream. + */ +class ACE_Export ACE_Service_Type_Impl +{ +public: + // = Initialization and termination methods. + ACE_Service_Type_Impl (void *object, + const ACE_TCHAR *s_name, + u_int flags = 0, + ACE_Service_Object_Exterminator gobbler = 0, + int stype = ACE_Service_Type::INVALID_TYPE); + virtual ~ACE_Service_Type_Impl (void); + + // = Pure virtual interface (must be defined by the subclass). + virtual int suspend (void) const = 0; + virtual int resume (void) const = 0; + virtual int init (int argc, ACE_TCHAR *argv[]) const = 0; + virtual int fini (void) const; + virtual int info (ACE_TCHAR **str, size_t len) const = 0; + + /// The pointer to the service. + void *object (void) const; + + /// Get the name of the service. + const ACE_TCHAR *name (void) const; + + /// Set the name of the service. + void name (const ACE_TCHAR *); + + /// Dump the state of an object. + void dump (void) const; + + /// get the service_type of this service + int service_type (void) const; + + /// set the service_type of this service + void service_type (int stype); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Name of the service. + const ACE_TCHAR *name_; + + /// Pointer to object that implements the service. This actually + /// points to an ACE_Service_Object, ACE_Module, or ACE_Stream. + void *obj_; + + /// Destroy function to deallocate obj_. + ACE_Service_Object_Exterminator gobbler_; + + /// Flags that control serivce behavior (particularly deletion). + u_int flags_; + + /// type of this service + /// Used to properly manage the lifecycle of ACE_Modules and ACE_Streams + /// during shutdown + int service_type_; +}; + +/** + * @class ACE_Service_Object_Type + * + * @brief Define the methods for handling the configuration of + * ACE_Service_Objects. + */ +class ACE_Export ACE_Service_Object_Type : public ACE_Service_Type_Impl +{ +public: + // = Initialization method. + ACE_Service_Object_Type (void *so, + const ACE_TCHAR *name, + u_int flags = 0, + ACE_Service_Object_Exterminator gobbler = 0, + int stype = ACE_Service_Type::SERVICE_OBJECT); + + ~ACE_Service_Object_Type (void); + + // = Implement the hooks for . + virtual int suspend (void) const; + virtual int resume (void) const; + virtual int init (int argc, ACE_TCHAR *argv[]) const; + virtual int fini (void) const; + virtual int info (ACE_TCHAR **str, size_t len) const; + +private: + /// Holds the initialization status (result of object->init()) + mutable int initialized_; +}; + +/** + * @class ACE_Module_Type + * + * @brief Define the methods for handling the configuration of + * ACE_Modules. + */ +class ACE_Export ACE_Module_Type : public ACE_Service_Type_Impl +{ +public: + // = Initialization method. + ACE_Module_Type (void *m, // Really an ACE_Module *. + const ACE_TCHAR *identifier, + u_int flags = 0, + int stype = ACE_Service_Type::MODULE); + + ~ACE_Module_Type (void); + + // = Implement the hooks for . + virtual int suspend (void) const; + virtual int resume (void) const; + virtual int init (int argc, ACE_TCHAR *argv[]) const; + virtual int fini (void) const; + virtual int info (ACE_TCHAR **str, size_t len) const; + + /// Get the link pointer. + ACE_Module_Type *link (void) const; + + /// Set the link pointer. + void link (ACE_Module_Type *); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the next ACE_Module_Type in an ACE_Stream_Type. + ACE_Module_Type *link_; +}; + +/** + * @class ACE_Stream_Type + * + * @brief Define the methods for handling the configuration of + * ACE_Streams. + */ +class ACE_Export ACE_Stream_Type : public ACE_Service_Type_Impl +{ +public: + // = Initialization method. + ACE_Stream_Type (void *s, // Really an ACE_Stream *. + const ACE_TCHAR *identifier, + u_int flags = 0, + int stype = ACE_Service_Type::STREAM); + + ~ACE_Stream_Type (void); + + // = Implement the hooks for . + virtual int suspend (void) const; + virtual int resume (void) const; + virtual int init (int argc, ACE_TCHAR *argv[]) const; + virtual int fini (void) const; + virtual int info (ACE_TCHAR **str, size_t len) const; + + /// Add a new ACE_Module to the top of the ACE_Stream. + int push (ACE_Module_Type *new_module); + + /// Search for @a module and remove it from the ACE_Stream. + int remove (ACE_Module_Type *module); + + /// Locate the ACE_Module with @a mod_name. + ACE_Module_Type *find (const ACE_TCHAR *module_name) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the head of the ACE_Module list. + ACE_Module_Type *head_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Service_Types.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* _SERVICE_TYPE_H */ diff --git a/externals/ace/Service_Types.inl b/externals/ace/Service_Types.inl new file mode 100644 index 0000000..4586ac6 --- /dev/null +++ b/externals/ace/Service_Types.inl @@ -0,0 +1,43 @@ +// -*- C++ -*- +// +// $Id: Service_Types.inl 89925 2010-04-19 12:49:11Z cbeaulac $ + +#include "ace/ACE.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE void * +ACE_Service_Type_Impl::object (void) const +{ + ACE_TRACE ("ACE_Service_Type_Impl::object"); + return this->obj_; +} + +ACE_INLINE const ACE_TCHAR * +ACE_Service_Type_Impl::name (void) const +{ + ACE_TRACE ("ACE_Service_Type_Impl::name"); + return this->name_; +} + +ACE_INLINE void +ACE_Service_Type_Impl::name (const ACE_TCHAR *n) +{ + ACE_TRACE ("ACE_Service_Type_Impl::name"); + + ACE::strdelete (const_cast (this->name_)); + this->name_ = ACE::strnew (n); +} + +ACE_INLINE int +ACE_Service_Type_Impl::service_type (void) const +{ + return service_type_; +} + +ACE_INLINE void +ACE_Service_Type_Impl::service_type (int stype) +{ + service_type_ = stype; +} +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Shared_Memory.cpp b/externals/ace/Shared_Memory.cpp new file mode 100644 index 0000000..ccb1f26 --- /dev/null +++ b/externals/ace/Shared_Memory.cpp @@ -0,0 +1,13 @@ +// $Id: Shared_Memory.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Shared_Memory.h" + +ACE_RCSID(ace, Shared_Memory, "$Id: Shared_Memory.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Shared_Memory::~ACE_Shared_Memory (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Shared_Memory.h b/externals/ace/Shared_Memory.h new file mode 100644 index 0000000..6dbd17f --- /dev/null +++ b/externals/ace/Shared_Memory.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Shared_Memory.h + * + * $Id: Shared_Memory.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//========================================================================== + + +#ifndef ACE_SHARED_MEMORY_H +#define ACE_SHARED_MEMORY_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#include "ace/os_include/os_stddef.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Shared_Memory + * + * @brief This base class adapts both System V shared memory and "BSD" + * mmap to a common API. + * + * This is a very simple-minded wrapper, i.e., it really is only + * useful for allocating large contiguous chunks of shared + * memory. For a much more sophisticated version, please check + * out the class. + */ +class ACE_Export ACE_Shared_Memory +{ +public: + virtual ~ACE_Shared_Memory (void); + + // = Note that all the following methods are pure virtual. + virtual int close (void) = 0; + virtual int remove (void) = 0; + virtual void *malloc (size_t = 0) = 0; + virtual int free (void *p) = 0; + virtual size_t get_segment_size (void) const = 0; + virtual ACE_HANDLE get_id (void) const = 0; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_SHARED_MEMORY_H */ diff --git a/externals/ace/Shared_Memory_MM.cpp b/externals/ace/Shared_Memory_MM.cpp new file mode 100644 index 0000000..d6d1ed9 --- /dev/null +++ b/externals/ace/Shared_Memory_MM.cpp @@ -0,0 +1,111 @@ +// $Id: Shared_Memory_MM.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Shared_Memory_MM.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Shared_Memory_MM.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_RCSID (ace, + Shared_Memory_MM, + "$Id: Shared_Memory_MM.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_MM) + +void +ACE_Shared_Memory_MM::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Shared_Memory_MM::dump"); +#endif /* ACE_HAS_DUMP */ +} + +// Creates a shared memory segment of SIZE bytes. + +ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (ACE_HANDLE handle, + size_t length, + int prot, + int share, + char *addr, + ACE_OFF_T pos) + : shared_memory_ (handle, length, prot, share, addr, pos) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM"); +} + +ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (const ACE_TCHAR *file_name, + size_t len, + int flags, + int mode, + int prot, + int share, + char *addr, + ACE_OFF_T pos) + : shared_memory_ (file_name, len, flags, mode, + prot, share, addr, pos) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM"); +} + +// The "do-nothing" constructor. + +ACE_Shared_Memory_MM::ACE_Shared_Memory_MM (void) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::ACE_Shared_Memory_MM"); +} + +// The overall size of the segment. + +size_t +ACE_Shared_Memory_MM::get_segment_size (void) const +{ + ACE_TRACE ("ACE_Shared_Memory_MM::get_segment_size"); + // This cast is legit since the original length in open() is an int. + return this->shared_memory_.size (); +} + +// Unmaps the shared memory segment. + +int +ACE_Shared_Memory_MM::remove (void) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::remove"); + return shared_memory_.remove (); +} + +// Closes (unmaps) the shared memory segment. + +int +ACE_Shared_Memory_MM::close (void) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::close"); + return shared_memory_.unmap (); +} + +void * +ACE_Shared_Memory_MM::malloc (size_t) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::malloc"); + void *addr = 0; + + return this->shared_memory_ (addr) == -1 ? 0 : addr; +} + +ACE_HANDLE +ACE_Shared_Memory_MM::get_id (void) const +{ + ACE_TRACE ("ACE_Shared_Memory_MM::get_id"); + return this->shared_memory_.handle (); +} + +int +ACE_Shared_Memory_MM::free (void *p) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::free"); + return p != 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Shared_Memory_MM.h b/externals/ace/Shared_Memory_MM.h new file mode 100644 index 0000000..e02b212 --- /dev/null +++ b/externals/ace/Shared_Memory_MM.h @@ -0,0 +1,120 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Shared_Memory_MM.h + * + * $Id: Shared_Memory_MM.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + + +#ifndef ACE_SHARED_MALLOC_MM_H +#define ACE_SHARED_MALLOC_MM_H +#include /**/ "ace/pre.h" + +#include "ace/Shared_Memory.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Mem_Map.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Shared_Memory_MM + * + * @brief Shared memory wrapper based on MMAP. + * + * This class provides a very simple-minded shared memory manager. We + * strongly recommend that you do NOT use this class. Instead, please + * use @c ACE_Malloc, which has much more powerful capabilities. + */ +class ACE_Export ACE_Shared_Memory_MM : public ACE_Shared_Memory +{ +public: + // = Initialization and termination methods. + /// Default constructor. + ACE_Shared_Memory_MM (void); + + /// Constructor. + ACE_Shared_Memory_MM (ACE_HANDLE handle, + size_t length = static_cast (-1), + int prot = PROT_RDWR, + int share = ACE_MAP_PRIVATE, + char *addr = 0, + ACE_OFF_T pos = 0); + + /// Constructor. + ACE_Shared_Memory_MM (const ACE_TCHAR *file_name, + size_t length = static_cast (-1), + int flags = O_RDWR | O_CREAT, + int mode = ACE_DEFAULT_FILE_PERMS, + int prot = PROT_RDWR, + int share = ACE_MAP_SHARED, + char *addr = 0, ACE_OFF_T pos = 0); + + /// Open method. + int open (ACE_HANDLE handle, + size_t length = static_cast (-1), + int prot = PROT_RDWR, + int share = ACE_MAP_PRIVATE, + char *addr = 0, + ACE_OFF_T pos = 0); + + /// Open method. + int open (const ACE_TCHAR *file_name, + size_t length = static_cast (-1), + int flags = O_RDWR | O_CREAT, + int mode = ACE_DEFAULT_FILE_PERMS, + int prot = PROT_RDWR, + int share = ACE_MAP_SHARED, + char *addr = 0, + ACE_OFF_T pos = 0); + + /// Return the name of file that is mapped (if any). + const ACE_TCHAR *filename (void) const; + + /// Close down the shared memory segment. + virtual int close (void); + + /// Remove the shared memory segment and the underlying file. + virtual int remove (void); + + // = Allocation and deallocation methods. + /// Create a new chuck of memory containing @a size bytes. + virtual void *malloc (size_t size = 0); + + /// Free a chuck of memory allocated by + /// . + virtual int free (void *p); + + /// Return the size of the shared memory segment. + virtual size_t get_segment_size (void) const; + + /// Return the ID of the shared memory segment (i.e., an ACE_HANDLE). + virtual ACE_HANDLE get_id (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// This version is implemented with memory-mapped files. + ACE_Mem_Map shared_memory_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Shared_Memory_MM.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_SHARED_MALLOC_MM_H */ diff --git a/externals/ace/Shared_Memory_MM.inl b/externals/ace/Shared_Memory_MM.inl new file mode 100644 index 0000000..6e1f4b7 --- /dev/null +++ b/externals/ace/Shared_Memory_MM.inl @@ -0,0 +1,42 @@ +// -*- C++ -*- +// +// $Id: Shared_Memory_MM.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Return the name of file that is mapped (if any). + +ACE_INLINE const ACE_TCHAR * +ACE_Shared_Memory_MM::filename (void) const +{ + return this->shared_memory_.filename (); +} + +ACE_INLINE int +ACE_Shared_Memory_MM::open (ACE_HANDLE handle, + size_t length, + int prot, + int share, + char *addr, + ACE_OFF_T pos) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::open"); + return shared_memory_.map (handle, length, prot, share, addr, pos); +} + +ACE_INLINE int +ACE_Shared_Memory_MM::open (const ACE_TCHAR *file_name, + size_t len, + int flags, + int mode, + int prot, + int share, + char *addr, + ACE_OFF_T pos) +{ + ACE_TRACE ("ACE_Shared_Memory_MM::open"); + return shared_memory_.map (file_name, len, flags, mode, + prot, share, addr, pos); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Shared_Memory_Pool.cpp b/externals/ace/Shared_Memory_Pool.cpp new file mode 100644 index 0000000..0ef9392 --- /dev/null +++ b/externals/ace/Shared_Memory_Pool.cpp @@ -0,0 +1,461 @@ +// $Id: Shared_Memory_Pool.cpp 84455 2009-02-13 13:31:02Z johnnyw $ + +// Shared_Memory_Pool.cpp +#include "ace/Shared_Memory_Pool.h" +#include "ace/OS_NS_sys_shm.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, Shared_Memory_Pool, "$Id: Shared_Memory_Pool.cpp 84455 2009-02-13 13:31:02Z johnnyw $") + +#if !defined (ACE_LACKS_SYSV_SHMEM) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_Pool) + +ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options ( + const char *base_addr, + size_t max_segments, + size_t file_perms, + ACE_OFF_T minimum_bytes, + size_t segment_size) + : base_addr_ (base_addr), + max_segments_ (max_segments), + minimum_bytes_ (minimum_bytes), + file_perms_ (file_perms), + segment_size_ (segment_size) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options"); +} + +void +ACE_Shared_Memory_Pool::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Shared_Memory_Pool::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_Shared_Memory_Pool::in_use (ACE_OFF_T &offset, + size_t &counter) +{ + offset = 0; + SHM_TABLE *st = reinterpret_cast (this->base_addr_); + shmid_ds buf; + + for (counter = 0; + counter < this->max_segments_ && st[counter].used_ == 1; + counter++) + { + if (ACE_OS::shmctl (st[counter].shmid_, IPC_STAT, &buf) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("shmctl")), + -1); + offset += buf.shm_segsz; + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) segment size = %d, offset = %d\n"), buf.shm_segsz, offset)); + } + + return 0; +} + +int +ACE_Shared_Memory_Pool::find_seg (const void* const searchPtr, + ACE_OFF_T &offset, + size_t &counter) +{ + offset = 0; + SHM_TABLE *st = reinterpret_cast (this->base_addr_); + shmid_ds buf; + + for (counter = 0; + counter < this->max_segments_ + && st[counter].used_ == 1; + counter++) + { + if (ACE_OS::shmctl (st[counter].shmid_, IPC_STAT, &buf) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("shmctl")), + -1); + offset += buf.shm_segsz; + + // If segment 'counter' starts at a location greater than the + // place we are searching for. We then decrement the offset to + // the start of counter-1. (flabar@vais.net) + if (((ptrdiff_t) offset + (ptrdiff_t) (this->base_addr_)) > (ptrdiff_t) searchPtr) + { + --counter; + offset -= buf.shm_segsz; + return 0; + } + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) segment size = %d, offset = %d\n"), buf.shm_segsz, offset)); + } + + return 0; +} + +int +ACE_Shared_Memory_Pool::commit_backing_store_name (size_t rounded_bytes, + ACE_OFF_T &offset) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::commit_backing_store_name"); + + size_t counter; + SHM_TABLE *st = reinterpret_cast (this->base_addr_); + + if (this->in_use (offset, counter) == -1) + return -1; + + if (counter == this->max_segments_) + ACE_ERROR_RETURN ((LM_ERROR, + "exceeded max number of segments = %d, base = %u, offset = %u\n", + counter, + this->base_addr_, + offset), + -1); + else + { + int shmid = ACE_OS::shmget (st[counter].key_, + rounded_bytes, + this->file_perms_ | IPC_CREAT | IPC_EXCL); + if (shmid == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("shmget")), + -1); + st[counter].shmid_ = shmid; + st[counter].used_ = 1; + + void *address = (void *) (((char *) this->base_addr_) + offset); + void *shmem = ACE_OS::shmat (st[counter].shmid_, + (char *) address, + 0); + + if (shmem != address) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) %p, shmem = %u, address = %u\n"), + ACE_TEXT("shmat"), + shmem, + address), + -1); + } + return 0; +} + +// Handle SIGSEGV and SIGBUS signals to remap shared memory properly. + +int +ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::handle_signal"); + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("signal %S occurred\n"), signum)); + + // While FreeBSD 5.X has a siginfo_t struct with a si_addr field, + // it does not define SEGV_MAPERR. +#if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR) && \ + (defined (SEGV_MAPERR) || defined (SEGV_MEMERR)) + ACE_OFF_T offset; + // Make sure that the pointer causing the problem is within the + // range of the backing store. + + if (siginfo != 0) + { + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %u\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr)); + size_t counter; + if (this->in_use (offset, counter) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("in_use"))); +#if !defined(_UNICOS) + else if (!(siginfo->si_code == SEGV_MAPERR + && siginfo->si_addr < (((char *) this->base_addr_) + offset) + && siginfo->si_addr >= ((char *) this->base_addr_))) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) address %u out of range\n", + siginfo->si_addr), + -1); +#else /* ! _UNICOS */ + else if (!(siginfo->si_code == SEGV_MEMERR + && siginfo->si_addr < (((unsigned long) this->base_addr_) + offset) + && siginfo->si_addr >= ((unsigned long) this->base_addr_))) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) address %u out of range\n", + siginfo->si_addr), + -1); +#endif /* ! _UNICOS */ + } + + // The above if case will check to see that the address is in the + // proper range. Therefore there is a segment out there that the + // pointer wants to point into. Find the segment that someone else + // has used and attach to it (flabar@vais.net) + + size_t counter; // ret value to get shmid from the st table. + +#if !defined(_UNICOS) + if (this->find_seg (siginfo->si_addr, offset, counter) == -1) +#else /* ! _UNICOS */ + if (this->find_seg ((const void *)siginfo->si_addr, offset, counter) == -1) +#endif /* ! _UNICOS */ + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("in_use")), + -1); + + void *address = (void *) (((char *) this->base_addr_) + offset); + SHM_TABLE *st = reinterpret_cast (this->base_addr_); + + void *shmem = ACE_OS::shmat (st[counter].shmid_, (char *) address, 0); + + if (shmem != address) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) %p, shmem = %u, address = %u\n"), + ACE_TEXT("shmat"), + shmem, + address), + -1); + + // NOTE: this won't work if we dont have SIGINFO_T or SI_ADDR +#else + ACE_UNUSED_ARG (siginfo); +#endif /* ACE_HAS_SIGINFO_T && !defined (ACE_LACKS_SI_ADDR) */ + + return 0; +} + +ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool ( + const ACE_TCHAR *backing_store_name, + const OPTIONS *options) + : base_addr_ (0), + file_perms_ (ACE_DEFAULT_FILE_PERMS), + max_segments_ (ACE_DEFAULT_MAX_SEGMENTS), + minimum_bytes_ (0), + segment_size_ (ACE_DEFAULT_SEGMENT_SIZE) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool"); + + // Only change the defaults if != 0. + if (options) + { + this->base_addr_ = + reinterpret_cast (const_cast (options->base_addr_)); + this->max_segments_ = options->max_segments_; + this->file_perms_ = options->file_perms_; + this->minimum_bytes_ = options->minimum_bytes_; + this->segment_size_ = options->segment_size_; + } + + if (backing_store_name) + { + // Convert the string into a number that is used as the segment + // key. + + int segment_key; + int result = ::sscanf (ACE_TEXT_ALWAYS_CHAR (backing_store_name), + "%d", + &segment_key); + + if (result == 0 || result == EOF) + // The conversion to a number failed so hash with crc32 + // ACE::crc32 is also used in . + this->base_shm_key_ = + (key_t) ACE::crc32 (ACE_TEXT_ALWAYS_CHAR (backing_store_name)); + else + this->base_shm_key_ = segment_key; + + if (this->base_shm_key_ == IPC_PRIVATE) + // Make sure that the segment can be shared between unrelated + // processes. + this->base_shm_key_ = ACE_DEFAULT_SHM_KEY; + } + else + this->base_shm_key_ = ACE_DEFAULT_SHM_KEY; + + if (this->signal_handler_.register_handler (SIGSEGV, this) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Sig_Handler::register_handler"))); +} + +ACE_Shared_Memory_Pool::~ACE_Shared_Memory_Pool (void) +{ +} + +// Ask system for more shared memory. + +void * +ACE_Shared_Memory_Pool::acquire (size_t nbytes, + size_t &rounded_bytes) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::acquire"); + + rounded_bytes = this->round_up (nbytes); + + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquiring more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes)); + + ACE_OFF_T offset; + + if (this->commit_backing_store_name (rounded_bytes, offset) == -1) + return 0; + + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) acquired more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes)); + return ((char *) this->base_addr_) + offset; +} + +// Ask system for initial chunk of shared memory. + +void * +ACE_Shared_Memory_Pool::init_acquire (size_t nbytes, + size_t &rounded_bytes, + int &first_time) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::init_acquire"); + + ACE_OFF_T shm_table_offset = ACE::round_to_pagesize (sizeof (SHM_TABLE)); + rounded_bytes = this->round_up (nbytes > (size_t) this->minimum_bytes_ + ? nbytes + : (size_t) this->minimum_bytes_); + + // Acquire the semaphore to serialize initialization and prevent + // race conditions. + + int shmid = ACE_OS::shmget (this->base_shm_key_, + rounded_bytes + shm_table_offset, + this->file_perms_ | IPC_CREAT | IPC_EXCL); + if (shmid == -1) + { + if (errno != EEXIST) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("shmget")), + 0); + first_time = 0; + + shmid = ACE_OS::shmget (this->base_shm_key_, 0, 0); + + if (shmid == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) %p\n"), + ACE_TEXT ("shmget")), + 0); + + // This implementation doesn't care if we don't get the key we + // want... + this->base_addr_ = + ACE_OS::shmat (shmid, + reinterpret_cast (this->base_addr_), + 0); + if (this->base_addr_ == reinterpret_cast (-1)) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) %p, base_addr = %u\n"), + ACE_TEXT("shmat"), + this->base_addr_), + 0); + } + else + { + first_time = 1; + + // This implementation doesn't care if we don't get the key we + // want... + this->base_addr_ = + ACE_OS::shmat (shmid, + reinterpret_cast (this->base_addr_), + 0); + if (this->base_addr_ == reinterpret_cast (-1)) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT("(%P|%t) %p, base_addr = %u\n"), + ACE_TEXT("shmat"), + this->base_addr_), 0); + + SHM_TABLE *st = reinterpret_cast (this->base_addr_); + st[0].key_ = this->base_shm_key_; + st[0].shmid_ = shmid; + + st[0].used_ = 1; + + for (size_t counter = 1; // Skip over the first entry... + counter < this->max_segments_; + counter++) + { + st[counter].key_ = this->base_shm_key_ + counter; + st[counter].shmid_ = 0; + st[counter].used_ = 0; + } + } + + return (void *) (((char *) this->base_addr_) + shm_table_offset); +} + +// Instruct the memory pool to release all of its resources. + +int +ACE_Shared_Memory_Pool::release (int) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::release"); + + int result = 0; + SHM_TABLE *st = reinterpret_cast (this->base_addr_); + + for (size_t counter = 0; + counter < this->max_segments_ && st[counter].used_ == 1; + counter++) + if (ACE_OS::shmctl (st[counter].shmid_, IPC_RMID, 0) == -1) + result = -1; + + return result; +} + +int +ACE_Shared_Memory_Pool::sync (ssize_t, int) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::sync"); + return 0; +} + +int +ACE_Shared_Memory_Pool::sync (void *, size_t, int) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::sync"); + return 0; +} + +int +ACE_Shared_Memory_Pool::protect (ssize_t, int) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::protect"); + return 0; +} + +int +ACE_Shared_Memory_Pool::protect (void *, size_t, int) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::protect"); + return 0; +} + +void * +ACE_Shared_Memory_Pool::base_addr (void) const +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::base_addr"); + return this->base_addr_; +} + +// Implement the algorithm for rounding up the request to an +// appropriate chunksize. + +size_t +ACE_Shared_Memory_Pool::round_up (size_t nbytes) +{ + ACE_TRACE ("ACE_Shared_Memory_Pool::round_up"); + if (nbytes < this->segment_size_) + nbytes = this->segment_size_; + + return ACE::round_to_pagesize (nbytes); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* !ACE_LACKS_SYSV_SHMEM */ diff --git a/externals/ace/Shared_Memory_Pool.h b/externals/ace/Shared_Memory_Pool.h new file mode 100644 index 0000000..79cb970 --- /dev/null +++ b/externals/ace/Shared_Memory_Pool.h @@ -0,0 +1,210 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Shared_Memory_Pool.h + * + * $Id: Shared_Memory_Pool.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Dougls C. Schmidt + * @author Prashant Jain + */ +//============================================================================= + +#ifndef ACE_SHARED_MEMORY_POOL_H +#define ACE_SHARED_MEMORY_POOL_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_SYSV_SHMEM) + +#include "ace/ACE.h" +#include "ace/Event_Handler.h" +#include "ace/Sig_Handler.h" +#include "ace/os_include/sys/os_mman.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Shared_Memory_Pool_Options + * + * @brief Helper class for Shared Memory Pool constructor options. + * + * This should be a nested class, but that breaks too many + * compilers. + */ +class ACE_Export ACE_Shared_Memory_Pool_Options +{ +public: + /// Initialization method. + ACE_Shared_Memory_Pool_Options ( + const char *base_addr = ACE_DEFAULT_BASE_ADDR, + size_t max_segments = ACE_DEFAULT_MAX_SEGMENTS, + size_t file_perms = ACE_DEFAULT_FILE_PERMS, + ACE_OFF_T minimum_bytes = 0, + size_t segment_size = ACE_DEFAULT_SEGMENT_SIZE); + + /// Base address of the memory-mapped backing store. + const char *base_addr_; + + /// Number of shared memory segments to allocate. + size_t max_segments_; + + /// What the minimum bytes of the initial segment should be. + ACE_OFF_T minimum_bytes_; + + /// File permissions to use when creating/opening a segment. + size_t file_perms_; + + /// Shared memory segment size. + size_t segment_size_; +}; + +/** + * @class ACE_Shared_Memory_Pool + * + * @brief Make a memory pool that is based on System V shared memory + * (shmget(2) etc.). This implementation allows memory to be + * shared between processes. If your platform doesn't support + * System V shared memory (e.g., Win32 and many RTOS platforms + * do not) then you should use ACE_MMAP_Memory_Pool instead of this + * class. In fact, you should probably use ACE_MMAP_Memory_Pool on + * platforms that *do* support System V shared memory since it + * provides more powerful features, such as persistent backing store + * and greatly scalability. + */ +class ACE_Export ACE_Shared_Memory_Pool : public ACE_Event_Handler +{ +public: + typedef ACE_Shared_Memory_Pool_Options OPTIONS; + + /// Initialize the pool. + ACE_Shared_Memory_Pool (const ACE_TCHAR *backing_store_name = 0, + const OPTIONS *options = 0); + + virtual ~ACE_Shared_Memory_Pool (void); + + /// Ask system for initial chunk of local memory. + virtual void *init_acquire (size_t nbytes, + size_t &rounded_bytes, + int &first_time); + + /** + * Acquire at least @a nbytes from the memory pool. @a rounded_byes is + * the actual number of bytes allocated. Also acquires an internal + * semaphore that ensures proper serialization of Memory_Pool + * initialization across processes. + */ + virtual void *acquire (size_t nbytes, + size_t &rounded_bytes); + + /// Instruct the memory pool to release all of its resources. + virtual int release (int destroy = 1); + + /// Sync the memory region to the backing store starting at + /// @c this->base_addr_. + virtual int sync (ssize_t len = -1, int flags = MS_SYNC); + + /// Sync the memory region to the backing store starting at @a addr. + virtual int sync (void *addr, size_t len, int flags = MS_SYNC); + + /** + * Change the protection of the pages of the mapped region to @a prot + * starting at @c this->base_addr_ up to @a len bytes. If @a len == -1 + * then change protection of all pages in the mapped region. + */ + virtual int protect (ssize_t len = -1, int prot = PROT_RDWR); + + /// Change the protection of the pages of the mapped region to @a prot + /// starting at @a addr up to @a len bytes. + virtual int protect (void *addr, size_t len, int prot = PROT_RDWR); + + /// Return the base address of this memory pool, 0 if base_addr + /// never changes. + virtual void *base_addr (void) const; + + /// Dump the state of an object. + virtual void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Implement the algorithm for rounding up the request to an + /// appropriate chunksize. + virtual size_t round_up (size_t nbytes); + + /** + * Commits a new shared memory segment if necessary after an + * or a signal. @a offset is set to the new offset into + * the backing store. + */ + virtual int commit_backing_store_name (size_t rounded_bytes, + ACE_OFF_T &offset); + + /// Keeps track of all the segments being used. + struct SHM_TABLE + { + /// Shared memory segment key. + key_t key_; + + /// Shared memory segment internal id. + int shmid_; + + /// Is the segment currently used.; + int used_; + }; + + /** + * Base address of the shared memory segment. If this has the value + * of 0 then the OS is free to select any address, otherwise this + * value is what the OS must try to use to map the shared memory + * segment. + */ + void *base_addr_; + + /// File permissions to use when creating/opening a segment. + size_t file_perms_; + + /// Number of shared memory segments in the table. + size_t max_segments_; + + /// What the minimim bytes of the initial segment should be. + ACE_OFF_T minimum_bytes_; + + /// Shared memory segment size. + size_t segment_size_; + + /// Base shared memory key for the segment. + key_t base_shm_key_; + + /// Find the segment that contains the @a searchPtr + virtual int find_seg (const void *const searchPtr, + ACE_OFF_T &offset, + size_t &counter); + + /// Determine how much memory is currently in use. + virtual int in_use (ACE_OFF_T &offset, + size_t &counter); + + /// Handles SIGSEGV. + ACE_Sig_Handler signal_handler_; + + /// Handle SIGSEGV and SIGBUS signals to remap shared memory + /// properly. + virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* !ACE_LACKS_SYSV_SHMEM */ + +#include /**/ "ace/post.h" + +#endif /* ACE_SHARED_MEMORY_POOL_H */ diff --git a/externals/ace/Shared_Memory_SV.cpp b/externals/ace/Shared_Memory_SV.cpp new file mode 100644 index 0000000..fe26688 --- /dev/null +++ b/externals/ace/Shared_Memory_SV.cpp @@ -0,0 +1,88 @@ +// $Id: Shared_Memory_SV.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Shared_Memory_SV.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Shared_Memory_SV.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_RCSID (ace, + Shared_Memory_SV, + "$Id: Shared_Memory_SV.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_SV) + +void +ACE_Shared_Memory_SV::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Shared_Memory_SV::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Shared_Memory_SV::ACE_Shared_Memory_SV (key_t id, + size_t length, + int create, + int perms, + void *addr, + int flags) + : shared_memory_ (id, length, create, perms, addr, flags) +{ + ACE_TRACE ("ACE_Shared_Memory_SV::ACE_Shared_Memory_SV"); +} + +// The overall size of the segment. + +size_t +ACE_Shared_Memory_SV::get_segment_size (void) const +{ + ACE_TRACE ("ACE_Shared_Memory_SV::get_segment_size"); + // This cast is ok since the 'open' method for this class allows only + // an 'int' size. Therefore, this case should not lose information. + return this->shared_memory_.get_segment_size (); +} + +// Removes the shared memory segment. + +int +ACE_Shared_Memory_SV::remove (void) +{ + ACE_TRACE ("ACE_Shared_Memory_SV::remove"); + return shared_memory_.remove (); +} + +// Closes (detaches) the shared memory segment. + +int +ACE_Shared_Memory_SV::close (void) +{ + ACE_TRACE ("ACE_Shared_Memory_SV::close"); + return shared_memory_.detach (); +} + +void * +ACE_Shared_Memory_SV::malloc (size_t) +{ + ACE_TRACE ("ACE_Shared_Memory_SV::malloc"); + return this->shared_memory_.get_segment_ptr (); +} + +ACE_HANDLE +ACE_Shared_Memory_SV::get_id (void) const +{ + ACE_TRACE ("ACE_Shared_Memory_SV::get_id"); + return this->shared_memory_.get_id (); +} + +int +ACE_Shared_Memory_SV::free (void *p) +{ + ACE_TRACE ("ACE_Shared_Memory_SV::free"); + return p != 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Shared_Memory_SV.h b/externals/ace/Shared_Memory_SV.h new file mode 100644 index 0000000..7ae62a3 --- /dev/null +++ b/externals/ace/Shared_Memory_SV.h @@ -0,0 +1,101 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Shared_Memory_SV.h + * + * $Id: Shared_Memory_SV.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + + +#ifndef ACE_SHARED_MALLOC_SV_H +#define ACE_SHARED_MALLOC_SV_H +#include /**/ "ace/pre.h" + +#include "ace/Shared_Memory.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SV_Shared_Memory.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Shared_Memory_SV + * + * @brief Shared memory wrapper based on System V shared memory. + * + * This class provides a very simple-minded shared memory manager. We + * strongly recommend that you do NOT use this class. Instead, please + * use @c ACE_Malloc, which has much more powerful capabilities. + */ +class ACE_Export ACE_Shared_Memory_SV : public ACE_Shared_Memory +{ +public: + enum + { + ACE_CREATE = IPC_CREAT, + ACE_OPEN = 0 + }; + + // = Initialization and termination methods. + ACE_Shared_Memory_SV (void); + ACE_Shared_Memory_SV (key_t id, + size_t length, + int create = ACE_Shared_Memory_SV::ACE_OPEN, + int perms = ACE_DEFAULT_FILE_PERMS, + void *addr = 0, + int flags = 0); + + int open (key_t id, + size_t length, + int create = ACE_Shared_Memory_SV::ACE_OPEN, + int perms = ACE_DEFAULT_FILE_PERMS, + void *addr = 0, + int flags = 0); + + /// Close down the shared memory segment. + virtual int close (void); + + /// Remove the underlying shared memory segment. + virtual int remove (void); + + // = Allocation and deallocation methods. + /// Create a new chuck of memory containing @a size bytes. + virtual void *malloc (size_t = 0); + + /// Free a chuck of memory allocated by . + virtual int free (void *p); + + /// Return the size of the shared memory segment. + virtual size_t get_segment_size (void) const; + + /// Return the ID of the shared memory segment (i.e., a System V + /// shared memory internal id). + virtual ACE_HANDLE get_id (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// This version is implemented with System V shared memory + /// segments. + ACE_SV_Shared_Memory shared_memory_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Shared_Memory_SV.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_SHARED_MALLOC_SV_H */ diff --git a/externals/ace/Shared_Memory_SV.inl b/externals/ace/Shared_Memory_SV.inl new file mode 100644 index 0000000..1a58670 --- /dev/null +++ b/externals/ace/Shared_Memory_SV.inl @@ -0,0 +1,30 @@ +// -*- C++ -*- +// +// $Id: Shared_Memory_SV.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_Shared_Memory_SV::open (key_t id, + size_t length, + int create, + int perms, + void *addr, + int flags) +{ + ACE_TRACE ("ACE_Shared_Memory_SV::open"); + return shared_memory_.open_and_attach (id, length, create, + perms, addr, flags); +} + +// The "do-nothing" constructor. + +ACE_INLINE +ACE_Shared_Memory_SV::ACE_Shared_Memory_SV (void) +{ + ACE_TRACE ("ACE_Shared_Memory_SV::ACE_Shared_Memory_SV"); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Shared_Object.cpp b/externals/ace/Shared_Object.cpp new file mode 100644 index 0000000..76c27df --- /dev/null +++ b/externals/ace/Shared_Object.cpp @@ -0,0 +1,54 @@ +// $Id: Shared_Object.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Shared_Object.h" +#include "ace/Global_Macros.h" +#include "ace/config-all.h" + +/* Provide the abstract base class used to access dynamic linking + facilities */ + +#if !defined (__ACE_INLINE__) +#include "ace/Shared_Object.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (ace, + Shared_Object, + "$Id: Shared_Object.cpp 80826 2008-03-04 14:51:23Z wotte $") + + ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Initializes object when dynamic linking occurs. + +int +ACE_Shared_Object::init (int, ACE_TCHAR *[]) +{ + ACE_TRACE ("ACE_Shared_Object::init"); + return 0; +} + +// Terminates object when dynamic unlinking occurs. + +int +ACE_Shared_Object::fini (void) +{ + ACE_TRACE ("ACE_Shared_Object::fini"); + return 0; +} + +// Returns information on active object. + +int +ACE_Shared_Object::info (ACE_TCHAR **, size_t) const +{ + ACE_TRACE ("ACE_Shared_Object::info"); + return 0; +} + +// Need to give a default implementation. + +ACE_Shared_Object::~ACE_Shared_Object (void) +{ + ACE_TRACE ("ACE_Shared_Object::~ACE_Shared_Object"); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Shared_Object.h b/externals/ace/Shared_Object.h new file mode 100644 index 0000000..fedf051 --- /dev/null +++ b/externals/ace/Shared_Object.h @@ -0,0 +1,62 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Shared_Object.h + * + * $Id: Shared_Object.h 81348 2008-04-14 09:00:32Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_SHARED_OBJECT_H +#define ACE_SHARED_OBJECT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Shared_Object + * + * @brief Provide the abstract base class used to access dynamic + * linking facilities. + */ +class ACE_Export ACE_Shared_Object +{ +public: + /// Constructor + ACE_Shared_Object (void); + + /// Destructor + virtual ~ACE_Shared_Object (void); + + /// Initializes object when dynamic linking occurs. + virtual int init (int argc, ACE_TCHAR *argv[]); + + /// Terminates object when dynamic unlinking occurs. + virtual int fini (void); + + /// Returns information on a service object. + virtual int info (ACE_TCHAR **info_string, size_t length = 0) const; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Shared_Object.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_SHARED_OBJECT_H */ diff --git a/externals/ace/Shared_Object.inl b/externals/ace/Shared_Object.inl new file mode 100644 index 0000000..4f5f002 --- /dev/null +++ b/externals/ace/Shared_Object.inl @@ -0,0 +1,12 @@ +// -*- C++ -*- +// +// $Id: Shared_Object.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Shared_Object::ACE_Shared_Object (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Sig_Adapter.cpp b/externals/ace/Sig_Adapter.cpp new file mode 100644 index 0000000..d1af40f --- /dev/null +++ b/externals/ace/Sig_Adapter.cpp @@ -0,0 +1,80 @@ +// $Id: Sig_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Sig_Adapter.h" + +ACE_RCSID(ace, Sig_Adapter, "$Id: Sig_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Sig_Action &sa, int sigkey) + : sigkey_ (sigkey), + type_ (SIG_ACTION), + sa_ (sa) +{ + // ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter"); +} + +ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Event_Handler *eh, + int sigkey) + : sigkey_ (sigkey), + type_ (ACE_HANDLER), + eh_ (eh) +{ + // ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter"); +} + +ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Sig_Handler_Ex sig_func, + int sigkey) + : sigkey_ (sigkey), + type_ (C_FUNCTION), + sig_func_ (sig_func) +{ + // ACE_TRACE ("ACE_Sig_Adapter::ACE_Sig_Adapter"); +} + +ACE_Sig_Adapter::~ACE_Sig_Adapter () +{ +} + +int +ACE_Sig_Adapter::sigkey (void) +{ + ACE_TRACE ("ACE_Sig_Adapter::sigkey"); + return this->sigkey_; +} + +int +ACE_Sig_Adapter::handle_signal (int signum, + siginfo_t *siginfo, + ucontext_t *ucontext) +{ + ACE_TRACE ("ACE_Sig_Adapter::handle_signal"); + + switch (this->type_) + { + case SIG_ACTION: + { + // We have to dispatch a handler that was registered by a + // third-party library. + + ACE_Sig_Action old_disp; + + // Make sure this handler executes in the context it was + // expecting... + this->sa_.register_action (signum, &old_disp); + + ACE_Sig_Handler_Ex sig_func = ACE_Sig_Handler_Ex (this->sa_.handler ()); + + (*sig_func) (signum, siginfo, ucontext); + // Restore the original disposition. + old_disp.register_action (signum); + break; + } + case ACE_HANDLER: + this->eh_->handle_signal (signum, siginfo, ucontext); + break; + case C_FUNCTION: + (*this->sig_func_) (signum, siginfo, ucontext); + break; + } + return 0; +} diff --git a/externals/ace/Sig_Adapter.h b/externals/ace/Sig_Adapter.h new file mode 100644 index 0000000..cbd6b39 --- /dev/null +++ b/externals/ace/Sig_Adapter.h @@ -0,0 +1,81 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Sig_Adapter.h + * + * $Id: Sig_Adapter.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_SIG_ADAPTER_H +#define ACE_SIG_ADAPTER_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Event_Handler.h" +#include "ace/Signal.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Sig_Adapter + * + * @brief Provide an adapter that transforms various types of signal + * handlers into the scheme used by the ACE_Reactor. + */ +class ACE_Export ACE_Sig_Adapter : public ACE_Event_Handler +{ +public: + ACE_Sig_Adapter (ACE_Sig_Action &, int sigkey); + ACE_Sig_Adapter (ACE_Event_Handler *, int sigkey); + ACE_Sig_Adapter (ACE_Sig_Handler_Ex, int sigkey = 0); + ~ACE_Sig_Adapter (void); + + /// Returns this signal key that's used to remove this from the + /// ACE_Reactor's internal table. + int sigkey (void); + + /// Called by the to dispatch the signal handler. + virtual int handle_signal (int, siginfo_t *, ucontext_t *); + +private: + /// Key for this signal handler (used to remove it). + int sigkey_; + + /// Is this an external handler or an ACE handler? + enum + { + /// We're just wrapping an ACE_Event_Handler. + ACE_HANDLER, + /// An ACE_Sig_Action. + SIG_ACTION, + /// A normal C function. + C_FUNCTION + } type_; + + // = This should be a union, but C++ won't allow that because the + // has a constructor. + /// This is an external handler (ugh). + ACE_Sig_Action sa_; + + /// This is an ACE hander. + ACE_Event_Handler *eh_; + + /// This is a normal C function. + ACE_Sig_Handler_Ex sig_func_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_SIG_ADAPTER_H */ diff --git a/externals/ace/Sig_Handler.cpp b/externals/ace/Sig_Handler.cpp new file mode 100644 index 0000000..8691f81 --- /dev/null +++ b/externals/ace/Sig_Handler.cpp @@ -0,0 +1,616 @@ +// $Id: Sig_Handler.cpp 88360 2009-12-30 08:42:20Z olli $ + +#include "ace/Sig_Handler.h" +#include "ace/Sig_Adapter.h" +#include "ace/Signal.h" +#include "ace/Recursive_Thread_Mutex.h" +#include "ace/Managed_Object.h" +#include "ace/Containers.h" +#include "ace/Guard_T.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Sig_Handler.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Sig_Handler, "$Id: Sig_Handler.cpp 88360 2009-12-30 08:42:20Z olli $") + +#if defined (ACE_HAS_SIG_C_FUNC) + +extern "C" void +ace_sig_handler_dispatch (int signum, siginfo_t *info, ucontext_t *context) +{ + ACE_TRACE ("ace_sig_handler_dispatch"); + ACE_Sig_Handler::dispatch (signum, info, context); +} + +#define ace_signal_handler_dispatcher ACE_SignalHandler(ace_sig_handler_dispatch) + +extern "C" void +ace_sig_handlers_dispatch (int signum, siginfo_t *info, ucontext_t *context) +{ + ACE_TRACE ("ace_sig_handlers_dispatch"); + ACE_Sig_Handlers::dispatch (signum, info, context); +} + +#define ace_signal_handlers_dispatcher ACE_SignalHandler(ace_sig_handlers_dispatch) + +#else +#define ace_signal_handler_dispatcher ACE_SignalHandler(ACE_Sig_Handler::dispatch) + +#define ace_signal_handlers_dispatcher ACE_SignalHandler(ACE_Sig_Handlers::dispatch) +#endif /* ACE_HAS_SIG_C_FUNC */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Array of Event_Handlers that will handle the signals. +ACE_Event_Handler *ACE_Sig_Handler::signal_handlers_[ACE_NSIG]; + +// Remembers if a signal has occurred. +sig_atomic_t ACE_Sig_Handler::sig_pending_ = 0; + + +ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Handler) + +ACE_Sig_Handler::~ACE_Sig_Handler (void) +{ +} + +void +ACE_Sig_Handler::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Sig_Handler::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_Sig_Handler::sig_pending (void) +{ + ACE_TRACE ("ACE_Sig_Handler::sig_pending"); + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + return ACE_Sig_Handler::sig_pending_ != 0; +} + +void +ACE_Sig_Handler::sig_pending (int pending) +{ + ACE_TRACE ("ACE_Sig_Handler::sig_pending"); + + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + ACE_Sig_Handler::sig_pending_ = pending; +} + +ACE_Event_Handler * +ACE_Sig_Handler::handler (int signum) +{ + ACE_TRACE ("ACE_Sig_Handler::handler"); + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + + if (ACE_Sig_Handler::in_range (signum)) + return ACE_Sig_Handler::signal_handlers_[signum]; + else + return 0; +} + +ACE_Event_Handler * +ACE_Sig_Handler::handler_i (int signum, + ACE_Event_Handler *new_sh) +{ + ACE_TRACE ("ACE_Sig_Handler::handler_i"); + + if (ACE_Sig_Handler::in_range (signum)) + { + ACE_Event_Handler *sh = ACE_Sig_Handler::signal_handlers_[signum]; + + ACE_Sig_Handler::signal_handlers_[signum] = new_sh; + return sh; + } + else + return 0; +} + +ACE_Event_Handler * +ACE_Sig_Handler::handler (int signum, + ACE_Event_Handler *new_sh) +{ + ACE_TRACE ("ACE_Sig_Handler::handler"); + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + + return ACE_Sig_Handler::handler_i (signum, new_sh); +} + +// Register an ACE_Event_Handler along with the corresponding SIGNUM. +// This method does NOT acquire any locks, so it can be called from a +// signal handler. + +int +ACE_Sig_Handler::register_handler_i (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, + ACE_Event_Handler **old_sh, + ACE_Sig_Action *old_disp) +{ + ACE_TRACE ("ACE_Sig_Handler::register_handler_i"); + + if (ACE_Sig_Handler::in_range (signum)) + { + ACE_Sig_Action sa; // Define a "null" action. + ACE_Event_Handler *sh = ACE_Sig_Handler::handler_i (signum, new_sh); + + // Return a pointer to the old if the user + // asks for this. + if (old_sh != 0) + *old_sh = sh; + + // Make sure that points to a valid location if the + // user doesn't care... + if (new_disp == 0) + new_disp = &sa; + + new_disp->handler (ace_signal_handler_dispatcher); +#if !defined (ACE_HAS_LYNXOS4_SIGNALS) + new_disp->flags (new_disp->flags () | SA_SIGINFO); +#endif /* ACE_HAS_LYNXOS4_SIGNALS */ + return new_disp->register_action (signum, old_disp); + } + else + return -1; +} + +// Register an ACE_Event_Handler along with the corresponding SIGNUM. +// This method acquires a lock, so it can't be called from a signal +// handler, e.g., . + +int +ACE_Sig_Handler::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, + ACE_Event_Handler **old_sh, + ACE_Sig_Action *old_disp) +{ + ACE_TRACE ("ACE_Sig_Handler::register_handler"); + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + + return ACE_Sig_Handler::register_handler_i (signum, + new_sh, + new_disp, + old_sh, + old_disp); +} + +// Remove an ACE_Event_Handler. + +int +ACE_Sig_Handler::remove_handler (int signum, + ACE_Sig_Action *new_disp, + ACE_Sig_Action *old_disp, + int) +{ + ACE_TRACE ("ACE_Sig_Handler::remove_handler"); + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + + if (ACE_Sig_Handler::in_range (signum)) + { + ACE_Sig_Action sa (SIG_DFL, (sigset_t *) 0); // Define the default disposition. + + if (new_disp == 0) + new_disp = &sa; + + ACE_Sig_Handler::signal_handlers_[signum] = 0; + + // Register either the new disposition or restore the default. + return new_disp->register_action (signum, old_disp); + } + + return -1; +} + +// Master dispatcher function that gets called by a signal handler and +// dispatches one handler... + +void +ACE_Sig_Handler::dispatch (int signum, + siginfo_t *siginfo, + ucontext_t *ucontext) +{ + ACE_TRACE ("ACE_Sig_Handler::dispatch"); + + // Save/restore errno. + ACE_Errno_Guard error (errno); + + // We can't use the call here because that acquires + // the lock, which is non-portable... + ACE_Sig_Handler::sig_pending_ = 1; + + // Darn well better be in range since the OS dispatched this... + ACE_ASSERT (ACE_Sig_Handler::in_range (signum)); + + ACE_Event_Handler *eh = ACE_Sig_Handler::signal_handlers_[signum]; + + if (eh != 0) + { + if (eh->handle_signal (signum, siginfo, ucontext) == -1) + { + // Define the default disposition. + ACE_Sig_Action sa ((ACE_SignalHandler) SIG_DFL, (sigset_t *) 0); + + ACE_Sig_Handler::signal_handlers_[signum] = 0; + + // Remove the current disposition by registering the default + // disposition. + sa.register_action (signum); + + // Allow the event handler to close down if necessary. + eh->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::SIGNAL_MASK); + } +#if defined (ACE_WIN32) + else + // Win32 is weird in the sense that it resets the signal + // disposition to SIG_DFL after a signal handler is + // dispatched. Therefore, to workaround this "feature" we + // must re-register the with + // explicitly. + ACE_Sig_Handler::register_handler_i (signum, + eh); +#endif /* ACE_WIN32*/ + } +} + +// ---------------------------------------- +// The following classes are local to this file. + +// There are bugs with HP/UX's C++ compiler that prevents this stuff +// from compiling... +#define ACE_MAX_SIGNAL_HANDLERS ((size_t) 20) + +// Keeps track of the id that uniquely identifies each registered +// signal handler. This id can be used to cancel a timer via the +// method. +int ACE_Sig_Handlers::sigkey_ = 0; + +// If this is true then a 3rd party library has registered a +// handler... +bool ACE_Sig_Handlers::third_party_sig_handler_ = false; + +// Make life easier by defining typedefs... +typedef ACE_Fixed_Set ACE_SIG_HANDLERS_SET; +typedef ACE_Fixed_Set_Iterator ACE_SIG_HANDLERS_ITERATOR; + +class ACE_Sig_Handlers_Set +{ +public: + static ACE_SIG_HANDLERS_SET *instance (int signum); + +private: + static ACE_SIG_HANDLERS_SET *sig_handlers_[ACE_NSIG]; +}; + +/* static */ +ACE_SIG_HANDLERS_SET *ACE_Sig_Handlers_Set::sig_handlers_[ACE_NSIG]; + +/* static */ +ACE_SIG_HANDLERS_SET * +ACE_Sig_Handlers_Set::instance (int signum) +{ + if (signum <= 0 || signum >= ACE_NSIG) + return 0; // This will cause problems... + else if (ACE_Sig_Handlers_Set::sig_handlers_[signum] == 0) + ACE_NEW_RETURN (ACE_Sig_Handlers_Set::sig_handlers_[signum], + ACE_SIG_HANDLERS_SET, + 0); + return ACE_Sig_Handlers_Set::sig_handlers_[signum]; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Handlers) + +void +ACE_Sig_Handlers::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Sig_Handlers::dump"); +#endif /* ACE_HAS_DUMP */ +} + +// This is the method that does all the dirty work... The basic +// structure of this method was devised by Detlef Becker. + +int +ACE_Sig_Handlers::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, + ACE_Event_Handler **, + ACE_Sig_Action *old_disp) +{ + ACE_TRACE ("ACE_Sig_Handlers::register_handler"); + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + + if (ACE_Sig_Handler::in_range (signum)) + { + ACE_Sig_Adapter *ace_sig_adapter = 0; // Our signal handler. + ACE_Sig_Adapter *extern_sh = 0; // An external signal handler. + ACE_Sig_Action sa; + + // Get current signal disposition. + sa.retrieve_action (signum); + + // Check whether we are already in control of the signal + // handling disposition... + + if (!(sa.handler () == ace_signal_handlers_dispatcher + || sa.handler () == ACE_SignalHandler (SIG_IGN) + || sa.handler () == ACE_SignalHandler (SIG_DFL))) + { + // Drat, a 3rd party library has already installed a signal ;-( + + // Upto here we never disabled RESTART_MODE. Thus, + // RESTART_MODE can only be changed by 3rd party libraries. + + if (ACE_BIT_DISABLED (sa.flags (), SA_RESTART) + && ACE_Sig_Handlers::third_party_sig_handler_) + // Toggling is disallowed since we might break 3rd party + // code. + return -1; + + // Note that we've seen a 3rd party handler... + ACE_Sig_Handlers::third_party_sig_handler_ = true; + + // Create a new 3rd party disposition, remembering its + // preferred signal blocking etc...; + ACE_NEW_RETURN (extern_sh, + ACE_Sig_Adapter (sa, + ++ACE_Sig_Handlers::sigkey_), + -1); + // Add the external signal handler to the set of handlers + // for this signal. + if (ACE_Sig_Handlers_Set::instance (signum)->insert (extern_sh) == -1) + { + delete extern_sh; + return -1; + } + } + // Add our new handler at this point. + ACE_NEW_RETURN (ace_sig_adapter, + ACE_Sig_Adapter (new_sh, + ++ACE_Sig_Handlers::sigkey_), + -1); + // Add the ACE signal handler to the set of handlers for this + // signal (make sure it goes before the external one if there is + // one of these). + + int result = ACE_Sig_Handlers_Set::instance (signum)->insert (ace_sig_adapter); + + if (result == -1) + { + // We couldn't reinstall our handler, so let's pretend like + // none of this happened... + if (extern_sh) + { + ACE_Sig_Handlers_Set::instance (signum)->remove (extern_sh); + delete extern_sh; + } + delete ace_sig_adapter; + return -1; + } + // If ACE_Sig_Handlers::dispatch() was set we're done. + else if (sa.handler () == ace_signal_handlers_dispatcher) + return ace_sig_adapter->sigkey (); + + // Otherwise, we need to register our handler function so that + // all signals will be dispatched through ACE. + else + { + // Make sure that new_disp points to a valid location if the + // user doesn't care... + if (new_disp == 0) + new_disp = &sa; + + new_disp->handler (ace_signal_handlers_dispatcher); + + // Default is to restart signal handlers. + new_disp->flags (new_disp->flags () | SA_RESTART); +#if !defined (ACE_HAS_LYNXOS4_SIGNALS) + new_disp->flags (new_disp->flags () | SA_SIGINFO); +#endif /* ACE_HAS_LYNXOS4_SIGNALS */ + + // Finally install (possibly reinstall) the ACE signal + // handler disposition with the SA_RESTART mode enabled. + if (new_disp->register_action (signum, old_disp) == -1) + { + // Yikes, lots of roll back at this point... + ACE_Sig_Handlers_Set::instance (signum)->remove (ace_sig_adapter); + delete ace_sig_adapter; + + if (extern_sh) + { + ACE_Sig_Handlers_Set::instance (signum)->remove (extern_sh); + delete extern_sh; + } + return -1; + } + else // Return the signal key so that programs can cancel this + // handler if they want! + return ace_sig_adapter->sigkey (); + } + } + + return -1; +} + +// Remove the ACE_Event_Handler currently associated with . +// Install the new disposition (if given) and return the previous +// disposition (if desired by the caller). Returns 0 on success and +// -1 if is invalid. + +int +ACE_Sig_Handlers::remove_handler (int signum, + ACE_Sig_Action *new_disp, + ACE_Sig_Action *old_disp, + int sigkey) +{ + ACE_TRACE ("ACE_Sig_Handlers::remove_handler"); + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_Guard m (*lock)); + + if (ACE_Sig_Handler::in_range (signum)) + { + ACE_SIG_HANDLERS_SET *handler_set = + ACE_Sig_Handlers_Set::instance (signum); + + ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set); + + // Iterate through the set of handlers for this signal. + + for (ACE_Event_Handler **eh; + handler_iterator.next (eh) != 0; + ) + { + // Type-safe downcast would be nice here... + ACE_Sig_Adapter *sh = (ACE_Sig_Adapter *) *eh; + + // Remove the handler if (1) its key matches the key we've + // been told to remove or (2) if we've been told to remove + // *all* handlers (i.e., == -1). + + if (sh->sigkey () == sigkey || sigkey == -1) + { + handler_set->remove (*eh); + delete *eh; + } + } + + if (handler_set->size () == 0) + { + // If there are no more handlers left for a signal then + // register the new disposition or restore the default + // disposition. + + ACE_Sig_Action sa (SIG_DFL, (sigset_t *) 0); + + if (new_disp == 0) + new_disp = &sa; + + return new_disp->register_action (signum, old_disp); + } + return 0; + } + else + return -1; +} + +// Master dispatcher function that gets called by a signal handler and +// dispatches *all* the handlers... + +void +ACE_Sig_Handlers::dispatch (int signum, + siginfo_t *siginfo, + ucontext_t *ucontext) +{ + ACE_TRACE ("ACE_Sig_Handlers::dispatch"); + // The following is #ifdef'd out because it's entirely non-portable + // to acquire a mutex in a signal handler... +#if 0 + ACE_MT (ACE_Recursive_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_SIG_HANDLER_LOCK); + ACE_TSS_Guard m (*lock)); +#endif /* 0 */ + + // Save/restore errno. + ACE_Errno_Guard error (errno); + + ACE_Sig_Handler::sig_pending_ = 1; + + // Darn well better be in range since the OS dispatched this... + ACE_ASSERT (ACE_Sig_Handler::in_range (signum)); + + ACE_SIG_HANDLERS_SET *handler_set = + ACE_Sig_Handlers_Set::instance (signum); + + ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set); + + for (ACE_Event_Handler **eh = 0; + handler_iterator.next (eh) != 0; + ) + if ((*eh)->handle_signal (signum, siginfo, ucontext) == -1) + { + handler_set->remove (*eh); + delete *eh; + } +} + +// Return the first item in the list of handlers. Note that this will +// trivially provide the same behavior as the ACE_Sig_Handler +// version if there is only 1 handler registered! + +ACE_Event_Handler * +ACE_Sig_Handlers::handler (int signum) +{ + ACE_TRACE ("ACE_Sig_Handlers::handler"); + ACE_SIG_HANDLERS_SET *handler_set = + ACE_Sig_Handlers_Set::instance (signum); + ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set); + ACE_Event_Handler **eh = 0; + handler_iterator.next (eh); + return *eh; +} + +// The following is a strange bit of logic that tries to give the same +// semantics as what happens in ACE_Sig_Handler when we replace the +// current signal handler with a new one. Note that if there is only +// one signal handler the behavior will be identical. If there is +// more than one handler then things get weird... + +ACE_Event_Handler * +ACE_Sig_Handlers::handler (int signum, ACE_Event_Handler *new_sh) +{ + ACE_TRACE ("ACE_Sig_Handlers::handler"); + ACE_SIG_HANDLERS_SET *handler_set = + ACE_Sig_Handlers_Set::instance (signum); + ACE_SIG_HANDLERS_ITERATOR handler_iterator (*handler_set); + ACE_Event_Handler **eh = 0; + + // Find the first handler... + handler_iterator.next (eh); + + // ... then remove it from the set ... + handler_set->remove (*eh); + + // ... and then insert the new signal handler into the beginning of + // the set (note, this is a bit too tied up in the implementation of + // ACE_Unbounded_Set...). + ACE_Sig_Adapter *temp = 0; + + ACE_NEW_RETURN (temp, + ACE_Sig_Adapter (new_sh, + ++ACE_Sig_Handlers::sigkey_), + 0); + handler_set->insert (temp); + return *eh; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Sig_Handler.h b/externals/ace/Sig_Handler.h new file mode 100644 index 0000000..df1f0bf --- /dev/null +++ b/externals/ace/Sig_Handler.h @@ -0,0 +1,237 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Sig_Handler.h + * + * $Id: Sig_Handler.h 84727 2009-03-05 19:22:29Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_SIGNAL_HANDLER_H +#define ACE_SIGNAL_HANDLER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Event_Handler.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Sig_Action; + +/** + * @class ACE_Sig_Handler + * + * @brief This is the main dispatcher of signals for ACE. It improves + * the existing UNIX signal handling mechanism by allowing C++ + * objects to handle signals in a way that avoids the use of + * global/static variables and functions. + * + * Using this class a program can register an ACE_Event_Handler + * with the ACE_Sig_Handler in order to handle a designated + * @a signum. When a signal occurs that corresponds to this + * @a signum, the @c handle_signal method of the registered + * ACE_Event_Handler is invoked automatically. + */ +class ACE_Export ACE_Sig_Handler +{ +public: + /// Default constructor. + ACE_Sig_Handler (void); + + /// Destructor + virtual ~ACE_Sig_Handler (void); + + // = Registration and removal methods. + /** + * Add a new ACE_Event_Handler and a new sigaction associated with + * @a signum. Passes back the existing ACE_Event_Handler and its + * sigaction if pointers are non-zero. Returns -1 on failure and >= + * 0 on success. + */ + virtual int register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp = 0, + ACE_Event_Handler **old_sh = 0, + ACE_Sig_Action *old_disp = 0); + + /** + * Remove the ACE_Event_Handler currently associated with + * @a signum. @a sigkey is ignored in this implementation since there + * is only one instance of a signal handler. Install the new + * disposition (if given) and return the previous disposition (if + * desired by the caller). Returns 0 on success and -1 if @a signum + * is invalid. + */ + virtual int remove_handler (int signum, + ACE_Sig_Action *new_disp = 0, + ACE_Sig_Action *old_disp = 0, + int sigkey = -1); + + // Set/get signal status. + /// True if there is a pending signal. + static int sig_pending (void); + + /// Reset the value of so that no signal is pending. + static void sig_pending (int); + + // = Set/get the handler associated with a particular signal. + + /// Return the ACE_Sig_Handler associated with @a signum. + virtual ACE_Event_Handler *handler (int signum); + + /// Set a new ACE_Event_Handler that is associated with @a signum. + /// Return the existing handler. + virtual ACE_Event_Handler *handler (int signum, ACE_Event_Handler *); + + /** + * Callback routine registered with sigaction(2) that dispatches the + * method of the appropriate pre-registered + * ACE_Event_Handler. + */ + static void dispatch (int, siginfo_t *, + ucontext_t *); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = These methods and data members are shared by derived classes. + + /** + * Set a new ACE_Event_Handler that is associated with @a signum. + * Return the existing handler. Does not acquire any locks so that + * it can be called from a signal handler, such as . + */ + static ACE_Event_Handler *handler_i (int signum, + ACE_Event_Handler *); + + /** + * This implementation method is called by and + * @c dispatch. It doesn't do any locking so that it can be called + * within a signal handler, such as @c dispatch. It adds a new + * ACE_Event_Handler and a new sigaction associated with @a signum. + * Passes back the existing ACE_Event_Handler and its sigaction if + * pointers are non-zero. Returns -1 on failure and >= 0 on + * success. + */ + static int register_handler_i (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp = 0, + ACE_Event_Handler **old_sh = 0, + ACE_Sig_Action *old_disp = 0); + + /// Check whether the SIGNUM is within the legal range of signals. + static int in_range (int signum); + + /// Keeps track of whether a signal is pending. + static sig_atomic_t sig_pending_; + +private: + /// Array used to store one user-defined Event_Handler for every + /// signal. + static ACE_Event_Handler *signal_handlers_[ACE_NSIG]; +}; + +/** + * @class ACE_Sig_Handlers + * + * @brief This is an alternative signal handling dispatcher for ACE. It + * allows a list of signal handlers to be registered for each + * signal. It also makes SA_RESTART the default mode. + * + * Using this class a program can register one or more + * ACE_Event_Handler with the ACE_Sig_Handler in order to + * handle a designated @a signum. When a signal occurs that + * corresponds to this @a signum, the methods of + * all the registered ACE_Event_Handlers are invoked + * automatically. + */ +class ACE_Export ACE_Sig_Handlers : public ACE_Sig_Handler +{ +public: + // = Registration and removal methods. + /** + * Add a new ACE_Event_Handler and a new sigaction associated with + * @a signum. Passes back the existing ACE_Event_Handler and its + * sigaction if pointers are non-zero. Returns -1 on failure and + * a that is >= 0 on success. + */ + virtual int register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp = 0, + ACE_Event_Handler **old_sh = 0, + ACE_Sig_Action *old_disp = 0); + + /** + * Remove an ACE_Event_Handler currently associated with @a signum. + * We remove the handler if (1) its sigkey> matches the @a sigkey + * passed as a parameter or (2) if we've been told to remove all the + * handlers, i.e., @a sigkey == -1. If a new disposition is given it + * is installed and the previous disposition is returned (if desired + * by the caller). Returns 0 on success and -1 if @a signum is + * invalid. + */ + virtual int remove_handler (int signum, + ACE_Sig_Action *new_disp = 0, + ACE_Sig_Action *old_disp = 0, + int sigkey = -1); + + // = Set/get the handler associated with a particular signal. + + /// Return the head of the list of s associated with + /// SIGNUM. + virtual ACE_Event_Handler *handler (int signum); + + /** + * Set a new ACE_Event_Handler that is associated with SIGNUM at + * the head of the list of signals. Return the existing handler + * that was at the head. + */ + virtual ACE_Event_Handler *handler (int signum, + ACE_Event_Handler *); + + /** + * Callback routine registered with sigaction(2) that dispatches the + * method of all the pre-registered + * ACE_Event_Handlers for @a signum + */ + static void dispatch (int signum, siginfo_t *, ucontext_t *); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /** + * Keeps track of the id that uniquely identifies each registered + * signal handler. This id can be used to cancel a timer via the + * method. + */ + static int sigkey_; + + /// If this is true then a 3rd party library has registered a + /// handler... + static bool third_party_sig_handler_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Sig_Handler.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_SIG_HANDLER_H */ diff --git a/externals/ace/Sig_Handler.inl b/externals/ace/Sig_Handler.inl new file mode 100644 index 0000000..de02c09 --- /dev/null +++ b/externals/ace/Sig_Handler.inl @@ -0,0 +1,15 @@ +// -*- C++ -*- +// +// $Id: Sig_Handler.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_INLINE +ACE_Sig_Handler::ACE_Sig_Handler (void) +{ +} + +ACE_INLINE int +ACE_Sig_Handler::in_range (int signum) +{ + ACE_TRACE ("ACE_Sig_Handler::in_range"); + return signum > 0 && signum < ACE_NSIG; +} diff --git a/externals/ace/Signal.cpp b/externals/ace/Signal.cpp new file mode 100644 index 0000000..5f17455 --- /dev/null +++ b/externals/ace/Signal.cpp @@ -0,0 +1,221 @@ +// $Id: Signal.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Signal.h" +// #include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Signal.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Signal, "$Id: Signal.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Action) + +void +ACE_Sig_Action::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Sig_Action::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Set) + +ACE_Sig_Set::~ACE_Sig_Set (void) +{ + ACE_TRACE ("ACE_Sig_Set::~ACE_Sig_Set"); + ACE_OS::sigemptyset (&this->sigset_); +} + +ACE_Sig_Action::~ACE_Sig_Action (void) +{ + ACE_TRACE ("ACE_Sig_Action::~ACE_Sig_Action"); +} + +// Restore the signal mask. + +ACE_Sig_Guard::~ACE_Sig_Guard (void) +{ + //ACE_TRACE ("ACE_Sig_Guard::~ACE_Sig_Guard"); + if (!this->condition_) + return; + +#if !defined (ACE_LACKS_UNIX_SIGNALS) +#if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) + ACE_OS::sigprocmask (SIG_SETMASK, + (sigset_t *) this->omask_, + 0); +#else + ACE_OS::thr_sigsetmask (SIG_SETMASK, + (sigset_t *) this->omask_, + 0); +#endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ +#endif /* !ACE_LACKS_UNIX_SIGNALS */ +} + +void +ACE_Sig_Set::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Sig_Set::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Sig_Guard) + +void +ACE_Sig_Guard::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Sig_Guard::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Sig_Action::ACE_Sig_Action (void) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = 0; + + // Since Service_Config::signal_handler_ is static and has an + // ACE_Sig_Action instance, Win32 will get errno set unless this is + // commented out. +#if !defined (ACE_WIN32) + ACE_OS::sigemptyset (&this->sa_.sa_mask); +#endif /* ACE_WIN32 */ + this->sa_.sa_handler = 0; +} + +ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, + sigset_t *sig_mask, + int sig_flags) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = sig_flags; + + if (sig_mask == 0) + ACE_OS::sigemptyset (&this->sa_.sa_mask); + else + this->sa_.sa_mask = *sig_mask; // Structure assignment... + +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ +} + +ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, + const ACE_Sig_Set &sig_mask, + int sig_flags) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = sig_flags; + + // Structure assignment... + this->sa_.sa_mask = sig_mask.sigset (); + +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ +} + +ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, + int signum, + sigset_t *sig_mask, + int sig_flags) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = sig_flags; + + if (sig_mask == 0) + ACE_OS::sigemptyset (&this->sa_.sa_mask); + else + this->sa_.sa_mask = *sig_mask; // Structure assignment... + +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ + ACE_OS::sigaction (signum, &this->sa_, 0); +} + +ACE_Sig_Action::ACE_Sig_Action (ACE_SignalHandler sig_handler, + int signum, + const ACE_Sig_Set &sig_mask, + int sig_flags) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = sig_flags; + + // Structure assignment... + this->sa_.sa_mask = sig_mask.sigset (); + +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ + ACE_OS::sigaction (signum, &this->sa_, 0); +} + +ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals, + ACE_SignalHandler sig_handler, + const ACE_Sig_Set &sig_mask, + int sig_flags) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = sig_flags; + + // Structure assignment... + this->sa_.sa_mask = sig_mask.sigset (); + +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ + +#if (ACE_NSIG > 0) + for (int s = 1; s < ACE_NSIG; s++) + if ((signals.is_member (s)) == 1) + ACE_OS::sigaction (s, &this->sa_, 0); +#else /* ACE_NSIG <= 0 */ + ACE_UNUSED_ARG (signals); +#endif /* ACE_NSIG <= 0 */ +} + +ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Set &signals, + ACE_SignalHandler sig_handler, + sigset_t *sig_mask, + int sig_flags) +{ + // ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + this->sa_.sa_flags = sig_flags; + + if (sig_mask == 0) + ACE_OS::sigemptyset (&this->sa_.sa_mask); + else + this->sa_.sa_mask = *sig_mask; // Structure assignment... + +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ + +#if (ACE_NSIG > 0) + for (int s = 1; s < ACE_NSIG; s++) + if ((signals.is_member (s)) == 1) + ACE_OS::sigaction (s, &this->sa_, 0); +#else /* ACE_NSIG <= 0 */ + ACE_UNUSED_ARG (signals); +#endif /* ACE_NSIG <= 0 */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Signal.h b/externals/ace/Signal.h new file mode 100644 index 0000000..736d62e --- /dev/null +++ b/externals/ace/Signal.h @@ -0,0 +1,267 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Signal.h + * + * $Id: Signal.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_SIGNAL_H +#define ACE_SIGNAL_H +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if defined (ACE_DONT_INCLUDE_ACE_SIGNAL_H) +# error ace/Signal.h was #included instead of signal.h by ace/OS_NS_signal.h: fix!!!! +#endif /* ACE_DONT_INCLUDE_ACE_SIGNAL_H */ + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_signal.h" + +// Type of the extended signal handler. +typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext); + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Sig_Set + * + * @brief Provide a C++ wrapper for the C sigset_t interface. + * + * Handle signals via a more elegant C++ interface (e.g., + * doesn't require the use of global variables or global + * functions in an application). + */ +class ACE_Export ACE_Sig_Set +{ +public: + // = Initialization and termination methods. + /// Initialize with @a sigset. If @a sigset == 0 then fill + /// the set. + ACE_Sig_Set (sigset_t *sigset); + + /// Initialize with @a sigset. If @a sigset == 0 then fill + /// the set. + ACE_Sig_Set (ACE_Sig_Set *sigset); + + /// If @a fill == 0 then initialize the to be empty, else + /// full. + ACE_Sig_Set (int fill = 0); + + ~ACE_Sig_Set (void); + + /// Create a set that excludes all signals defined by the system. + int empty_set (void); + + /// Create a set that includes all signals defined by the system. + int fill_set (void); + + /// Adds the individual signal specified by @a signo to the set. + int sig_add (int signo); + + /// Deletes the individual signal specified by @a signo from the set. + int sig_del (int signo); + + /// Checks whether the signal specified by @a signo is in the set. + int is_member (int signo) const; + + /// Returns a pointer to the underlying @c sigset_t. + operator sigset_t *(); + + /// Returns a copy of the underlying @c sigset_t. + sigset_t sigset (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Set of signals. + sigset_t sigset_; +}; + +/** + * @class ACE_Sig_Action + * + * @brief C++ wrapper facade for the @c sigaction struct. + */ +class ACE_Export ACE_Sig_Action +{ +public: + // = Initialization methods. + /// Default constructor. Initializes everything to 0. + ACE_Sig_Action (void); + + /// Assigns the various fields of a @c sigaction struct but doesn't + /// register for signal handling via the @c sigaction function. + ACE_Sig_Action (ACE_SignalHandler handler, + sigset_t *sigmask = 0, + int flags = 0); + + /// Assigns the various fields of a @c sigaction struct but doesn't + /// register for signal handling via the @c sigaction function. + ACE_Sig_Action (ACE_SignalHandler handler, + const ACE_Sig_Set &sigmask, + int flags = 0); + + /** + * Assigns the various fields of a @c sigaction struct and registers + * the @a handler to process signal @a signum via the @c sigaction + * function. + */ + ACE_Sig_Action (ACE_SignalHandler handler, + int signum, + sigset_t *sigmask = 0, + int flags = 0); + + /** + * Assigns the various fields of a @c sigaction struct and registers + * the @a handler to process signal @a signum via the @c sigaction + * function. + */ + ACE_Sig_Action (ACE_SignalHandler handler, + int signum, + const ACE_Sig_Set &sigmask, + int flags = 0); + + + // @@ The next two methods have a parameter as "signalss". Please do + // not change the argument name as "signals". This causes the + // following problem as reported by + // . + + // In the file Signal.h two of the functions have and argument name + // of signals. signals is a Qt macro (to do with their meta object + // stuff. + // We could as well have it as "signal", but I am nost sure whether + // that would cause a problem with something else - Bala + + /** + * Assigns the various fields of a @c sigaction struct and registers + * the @a handler to process all @a signalss via the @c sigaction + * function. + */ + ACE_Sig_Action (const ACE_Sig_Set &signalss, + ACE_SignalHandler handler, + const ACE_Sig_Set &sigmask, + int flags = 0); + + /** + * Assigns the various fields of a @c sigaction struct and registers + * the @a handler to process all @a signalss via the @c sigaction + * function. + */ + ACE_Sig_Action (const ACE_Sig_Set &signalss, + ACE_SignalHandler handler, + sigset_t *sigmask = 0, + int flags = 0); + + /// Copy constructor. + ACE_Sig_Action (const ACE_Sig_Action &s); + + /// Default dtor. + ~ACE_Sig_Action (void); + + // = Signal action management. + /// Register @c this as the current disposition and store old + /// disposition into @a oaction if it is non-NULL. + int register_action (int signum, + ACE_Sig_Action *oaction = 0); + + /// Assign the value of @a oaction to @c this and make it become the + /// new signal disposition. + int restore_action (int signum, + ACE_Sig_Action &oaction); + + /// Retrieve the current disposition into @c this. + int retrieve_action (int signum); + + /// Set current signal action. + void set (struct sigaction *); + + /// Get current signal action. + struct sigaction *get (void); + operator struct sigaction *(); + + /// Set current signal flags. + void flags (int); + + /// Get current signal flags. + int flags (void); + + /// Set current signal mask. + void mask (sigset_t *); + void mask (ACE_Sig_Set &); + + /// Get current signal mask. + sigset_t *mask (void); + + /// Set current signal handler (pointer to function). + void handler (ACE_SignalHandler); + + /// Get current signal handler (pointer to function). + ACE_SignalHandler handler (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Controls signal behavior. + struct sigaction sa_; +}; + +/** + * @class ACE_Sig_Guard + * + * @brief Hold signals in MASK for duration of a C++ statement block. + * Note that a "0" for mask causes all signals to be held. + */ +class ACE_Export ACE_Sig_Guard +{ +public: + // = Initialization and termination methods. + /// This is kind of conditional Guard, needed when guard should be + /// activated only when a spcific condition met. When condition == + /// true (default), Guard is activated + ACE_Sig_Guard (ACE_Sig_Set *mask = 0, bool condition = true); + + /// Restore blocked signals. + ~ACE_Sig_Guard (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Original signal mask. + ACE_Sig_Set omask_; + + /// Guard Condition + bool condition_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Signal.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_SIGNAL_HANDLER_H */ diff --git a/externals/ace/Signal.inl b/externals/ace/Signal.inl new file mode 100644 index 0000000..858c33c --- /dev/null +++ b/externals/ace/Signal.inl @@ -0,0 +1,265 @@ +// -*- C++ -*- +// +// $Id: Signal.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_signal.h" +#include "ace/config-all.h" +#include "ace/Trace.h" +#include "ace/Object_Manager_Base.h" +#include "ace/OS_NS_Thread.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Sig_Set::ACE_Sig_Set (sigset_t *ss) + // : sigset_ () +{ + ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set"); + + if (ss == 0) + ACE_OS::sigfillset (&this->sigset_); + else + // Structure assignment. + this->sigset_ = *ss; +} + +ACE_INLINE +ACE_Sig_Set::ACE_Sig_Set (int fill) + // : sigset_ () +{ + ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set"); + + if (fill) + ACE_OS::sigfillset (&this->sigset_); + else + ACE_OS::sigemptyset (&this->sigset_); +} + +ACE_INLINE +ACE_Sig_Set::ACE_Sig_Set (ACE_Sig_Set *ss) + // : sigset_ () +{ + ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set"); + + if (ss == 0) + ACE_OS::sigfillset (&this->sigset_); + else + this->sigset_ = ss->sigset_; +} + +ACE_INLINE int +ACE_Sig_Set::empty_set (void) +{ + ACE_TRACE ("ACE_Sig_Set::empty_set"); + return ACE_OS::sigemptyset (&this->sigset_); +} + +ACE_INLINE int +ACE_Sig_Set::fill_set (void) +{ + ACE_TRACE ("ACE_Sig_Set::fill_set"); + return ACE_OS::sigfillset (&this->sigset_); +} + +ACE_INLINE int +ACE_Sig_Set::sig_add (int signo) +{ + ACE_TRACE ("ACE_Sig_Set::sig_add"); + return ACE_OS::sigaddset (&this->sigset_, signo); +} + +ACE_INLINE int +ACE_Sig_Set::sig_del (int signo) +{ + ACE_TRACE ("ACE_Sig_Set::sig_del"); + return ACE_OS::sigdelset (&this->sigset_, signo); +} + +ACE_INLINE int +ACE_Sig_Set::is_member (int signo) const +{ + ACE_TRACE ("ACE_Sig_Set::is_member"); + return ACE_OS::sigismember (const_cast (&this->sigset_), signo); +} + +ACE_INLINE +ACE_Sig_Set::operator sigset_t *(void) +{ + ACE_TRACE ("ACE_Sig_Set::operator sigset_t *"); + return &this->sigset_; +} + +ACE_INLINE sigset_t +ACE_Sig_Set::sigset (void) const +{ + ACE_TRACE ("ACE_Sig_Set::sigset"); + return this->sigset_; +} + +ACE_INLINE int +ACE_Sig_Action::flags (void) +{ + ACE_TRACE ("ACE_Sig_Action::flags"); + return this->sa_.sa_flags; +} + +ACE_INLINE void +ACE_Sig_Action::flags (int flags) +{ + ACE_TRACE ("ACE_Sig_Action::flags"); + this->sa_.sa_flags = flags; +} + +ACE_INLINE sigset_t * +ACE_Sig_Action::mask (void) +{ + ACE_TRACE ("ACE_Sig_Action::mask"); + return &this->sa_.sa_mask; +} + +ACE_INLINE void +ACE_Sig_Action::mask (sigset_t *ss) +{ + ACE_TRACE ("ACE_Sig_Action::mask"); + if (ss != 0) + this->sa_.sa_mask = *ss; // Structure assignment +} + +ACE_INLINE void +ACE_Sig_Action::mask (ACE_Sig_Set &ss) +{ + ACE_TRACE ("ACE_Sig_Action::mask"); + this->sa_.sa_mask = ss.sigset (); // Structure assignment +} + +ACE_INLINE ACE_SignalHandler +ACE_Sig_Action::handler (void) +{ + ACE_TRACE ("ACE_Sig_Action::handler"); + return ACE_SignalHandler (this->sa_.sa_handler); +} + +ACE_INLINE void +ACE_Sig_Action::handler (ACE_SignalHandler handler) +{ + ACE_TRACE ("ACE_Sig_Action::handler"); +#if !defined(ACE_HAS_TANDEM_SIGNALS) + this->sa_.sa_handler = ACE_SignalHandlerV (handler); +#else + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (handler); +#endif /* !ACE_HAS_TANDEM_SIGNALS */ +} + +#if 0 +ACE_INLINE ACE_SignalHandler +ACE_Sig_Action::sigaction (void) +{ + ACE_TRACE ("ACE_Sig_Action::sigaction"); + return ACE_SignalHandler (this->sa_.sa_sigaction); +} + +ACE_INLINE void +ACE_Sig_Action::sigaction (ACE_SignalHandler handler) +{ + ACE_TRACE ("ACE_Sig_Action::sigaction"); + this->sa_.sa_sigaction = (void (*)()) ACE_SignalHandlerV (handler); +} +#endif /* 0 */ + +ACE_INLINE void +ACE_Sig_Action::set (struct sigaction *sa) +{ + ACE_TRACE ("ACE_Sig_Action::set"); + this->sa_ = *sa; // Structure assignment. +} + +ACE_INLINE struct sigaction * +ACE_Sig_Action::get (void) +{ + ACE_TRACE ("ACE_Sig_Action::get"); + return &this->sa_; +} + +ACE_INLINE +ACE_Sig_Action::operator struct sigaction * () +{ + ACE_TRACE ("ACE_Sig_Action::operator struct sigaction *"); + return &this->sa_; +} + +ACE_INLINE +ACE_Sig_Action::ACE_Sig_Action (const ACE_Sig_Action &s) + // : sa_ () +{ + ACE_TRACE ("ACE_Sig_Action::ACE_Sig_Action"); + *this = s; // structure copy. +} + +ACE_INLINE int +ACE_Sig_Action::register_action (int signum, ACE_Sig_Action *oaction) +{ + ACE_TRACE ("ACE_Sig_Action::register_action"); + struct sigaction *sa = oaction == 0 ? 0 : oaction->get (); + + return ACE_OS::sigaction (signum, &this->sa_, sa); +} + +ACE_INLINE int +ACE_Sig_Action::retrieve_action (int signum) +{ + ACE_TRACE ("ACE_Sig_Action::retrieve_action"); + return ACE_OS::sigaction (signum, 0, &this->sa_); +} + +ACE_INLINE int +ACE_Sig_Action::restore_action (int signum, ACE_Sig_Action &oaction) +{ + ACE_TRACE ("ACE_Sig_Action::restore_action"); + this->sa_ = *oaction.get (); // Structure assignment + return ACE_OS::sigaction (signum, &this->sa_, 0); +} + +// Block out the signal MASK until the destructor is called. + +ACE_INLINE +ACE_Sig_Guard::ACE_Sig_Guard (ACE_Sig_Set *mask, + bool condition) + : omask_ () + , condition_ (condition) +{ + //ACE_TRACE ("ACE_Sig_Guard::ACE_Sig_Guard"); + if (!this->condition_) + return; + +#if defined (ACE_LACKS_UNIX_SIGNALS) + ACE_UNUSED_ARG (mask); +#else + // If MASK is 0 then block all signals! + if (mask == 0) + { +# if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) + ACE_OS::sigprocmask (SIG_BLOCK, + ACE_OS_Object_Manager::default_mask (), + (sigset_t *) this->omask_); +# else + ACE_OS::thr_sigsetmask (SIG_BLOCK, + ACE_OS_Object_Manager::default_mask (), + (sigset_t *) this->omask_); +# endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ + } + else +# if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) + ACE_OS::sigprocmask (SIG_BLOCK, + (sigset_t *) *mask, + (sigset_t *) + this->omask_); +# else + ACE_OS::thr_sigsetmask (SIG_BLOCK, + (sigset_t *) *mask, + (sigset_t *) + this->omask_); +# endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ +#endif /* ACE_LACKS_UNIX_SIGNALS */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Singleton.cpp b/externals/ace/Singleton.cpp new file mode 100644 index 0000000..25b7983 --- /dev/null +++ b/externals/ace/Singleton.cpp @@ -0,0 +1,548 @@ +// $Id: Singleton.cpp 84273 2009-01-30 12:55:25Z johnnyw $ + +#ifndef ACE_SINGLETON_CPP +#define ACE_SINGLETON_CPP + +#include "ace/Singleton.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Singleton.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Object_Manager.h" +#include "ace/Log_Msg.h" +#include "ace/Framework_Component.h" +#include "ace/Guard_T.h" +#include "ace/os_include/os_typeinfo.h" + +ACE_RCSID (ace, + Singleton, + "$Id: Singleton.cpp 84273 2009-01-30 12:55:25Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template void +ACE_Singleton::dump (void) +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Singleton::dump"); + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("instance_ = %x"), + ACE_Singleton::instance_i ())); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +#endif /* ACE_HAS_DUMP */ +} + +template ACE_Singleton *& +ACE_Singleton::instance_i (void) +{ +#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + // Pointer to the Singleton instance. This works around a bug with + // G++ and it's (mis-)handling of templates and statics... + static ACE_Singleton *singleton_ = 0; + + return singleton_; +#else + return ACE_Singleton::singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +} + +template TYPE * +ACE_Singleton::instance (void) +{ + ACE_TRACE ("ACE_Singleton::instance"); + + ACE_Singleton *&singleton = + ACE_Singleton::instance_i (); + + // Perform the Double-Check pattern... + if (singleton == 0) + { + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) + { + // The program is still starting up, and therefore assumed + // to be single threaded. There's no need to double-check. + // Or, the ACE_Object_Manager instance has been destroyed, + // so the preallocated lock is not available. Either way, + // don't register for destruction with the + // ACE_Object_Manager: we'll have to leak this instance. + + ACE_NEW_RETURN (singleton, (ACE_Singleton), 0); + } + else + { +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + // Obtain a lock from the ACE_Object_Manager. The pointer + // is static, so we only obtain one per ACE_Singleton + // instantiation. + static ACE_LOCK *lock = 0; + if (ACE_Object_Manager::get_singleton_lock (lock) != 0) + // Failed to acquire the lock! + return 0; + + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); + + if (singleton == 0) + { +#endif /* ACE_MT_SAFE */ + ACE_NEW_RETURN (singleton, (ACE_Singleton), 0); + + // Register for destruction with ACE_Object_Manager. + ACE_Object_Manager::at_exit (singleton, 0, typeid (TYPE).name ()); +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + } +#endif /* ACE_MT_SAFE */ + } + } + + return &singleton->instance_; +} + +template void +ACE_Singleton::cleanup (void *) +{ + ACE_Object_Manager::remove_at_exit (this); + delete this; + ACE_Singleton::instance_i () = 0; +} + +template void +ACE_Singleton::close (void) +{ + ACE_Singleton *&singleton = + ACE_Singleton::instance_i (); + + if (singleton) + { + singleton->cleanup (); + ACE_Singleton::instance_i () = 0; + } +} + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) +// Pointer to the Singleton instance. +template ACE_Singleton * +ACE_Singleton::singleton_ = 0; + +template ACE_Unmanaged_Singleton * +ACE_Unmanaged_Singleton::singleton_ = 0; +#endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */ + +template void +ACE_Unmanaged_Singleton::dump (void) +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Unmanaged_Singleton::dump"); + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("instance_ = %x"), + ACE_Unmanaged_Singleton::instance_i ())); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unmanaged_Singleton *& +ACE_Unmanaged_Singleton::instance_i (void) +{ +#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + // Pointer to the Singleton instance. This works around a bug with + // G++ and it's (mis-)handling of templates and statics... + static ACE_Unmanaged_Singleton *singleton_ = 0; + + return singleton_; +#else + return ACE_Unmanaged_Singleton::singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +} + +template TYPE * +ACE_Unmanaged_Singleton::instance (void) +{ + ACE_TRACE ("ACE_Unmanaged_Singleton::instance"); + + ACE_Unmanaged_Singleton *&singleton = + ACE_Unmanaged_Singleton::instance_i (); + + // Perform the Double-Check pattern... + if (singleton == 0) + { + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) + { + // The program is still starting up, and therefore assumed + // to be single threaded. There's no need to double-check. + // Or, the ACE_Object_Manager instance has been destroyed, + // so the preallocated lock is not available. Either way, + // don't register for destruction with the + // ACE_Object_Manager: we'll have to leak this instance. + + ACE_NEW_RETURN (singleton, (ACE_Unmanaged_Singleton), + 0); + } + else + { +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + // Obtain a lock from the ACE_Object_Manager. The pointer + // is static, so we only obtain one per + // ACE_Unmanaged_Singleton instantiation. + static ACE_LOCK *lock = 0; + if (ACE_Object_Manager::get_singleton_lock (lock) != 0) + // Failed to acquire the lock! + return 0; + + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); +#endif /* ACE_MT_SAFE */ + + if (singleton == 0) + ACE_NEW_RETURN (singleton, + (ACE_Unmanaged_Singleton), + 0); + } + } + + return &singleton->instance_; +} + +template void +ACE_Unmanaged_Singleton::close (void) +{ + ACE_Unmanaged_Singleton *&singleton = + ACE_Unmanaged_Singleton::instance_i (); + + if (singleton) + { + singleton->cleanup (); + ACE_Unmanaged_Singleton::instance_i () = 0; + } +} + +template void +ACE_TSS_Singleton::dump (void) +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_TSS_Singleton::dump"); + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("instance_ = %x"), + ACE_TSS_Singleton::instance_i ())); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +#endif /* ACE_HAS_DUMP */ +} + +template ACE_TSS_Singleton *& +ACE_TSS_Singleton::instance_i (void) +{ +#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + // Pointer to the Singleton instance. This works around a bug with + // G++ and it's (mis-)handling of templates and statics... + static ACE_TSS_Singleton *singleton_ = 0; + + return singleton_; +#else + return ACE_TSS_Singleton::singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +} + +template TYPE * +ACE_TSS_Singleton::instance (void) +{ + ACE_TRACE ("ACE_TSS_Singleton::instance"); + + ACE_TSS_Singleton *&singleton = + ACE_TSS_Singleton::instance_i (); + + // Perform the Double-Check pattern... + if (singleton == 0) + { + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) + { + // The program is still starting up, and therefore assumed + // to be single threaded. There's no need to double-check. + // Or, the ACE_Object_Manager instance has been destroyed, + // so the preallocated lock is not available. Either way, + // don't register for destruction with the + // ACE_Object_Manager: we'll have to leak this instance. + + ACE_NEW_RETURN (singleton, (ACE_TSS_Singleton), 0); + } + else + { +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + + // Obtain a lock from the ACE_Object_Manager. The pointer + // is static, so we only obtain one per ACE_Singleton instantiation. + static ACE_LOCK *lock = 0; + if (ACE_Object_Manager::get_singleton_lock (lock) != 0) + // Failed to acquire the lock! + return 0; + + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); + + if (singleton == 0) + { +#endif /* ACE_MT_SAFE */ + ACE_NEW_RETURN (singleton, (ACE_TSS_Singleton), + 0); + + // Register for destruction with ACE_Object_Manager. + ACE_Object_Manager::at_exit (singleton, 0, typeid (TYPE).name ()); +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + } +#endif /* ACE_MT_SAFE */ + } + } + + return ACE_TSS_GET (&singleton->instance_, TYPE); +} + +template void +ACE_TSS_Singleton::cleanup (void *) +{ + delete this; + ACE_TSS_Singleton::instance_i () = 0; +} + +template void +ACE_Unmanaged_TSS_Singleton::dump (void) +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Unmanaged_TSS_Singleton::dump"); + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("instance_ = %x"), + ACE_Unmanaged_TSS_Singleton::instance_i ())); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unmanaged_TSS_Singleton *& +ACE_Unmanaged_TSS_Singleton::instance_i (void) +{ +#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + // Pointer to the Singleton instance. This works around a bug with + // G++ and it's (mis-)handling of templates and statics... + static ACE_Unmanaged_TSS_Singleton *singleton_ = 0; + + return singleton_; +#else + return ACE_Unmanaged_TSS_Singleton::singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +} + +template TYPE * +ACE_Unmanaged_TSS_Singleton::instance (void) +{ + ACE_TRACE ("ACE_Unmanaged_TSS_Singleton::instance"); + + ACE_Unmanaged_TSS_Singleton *&singleton = + ACE_Unmanaged_TSS_Singleton::instance_i (); + + // Perform the Double-Check pattern... + if (singleton == 0) + { + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) + { + // The program is still starting up, and therefore assumed + // to be single threaded. There's no need to double-check. + // Or, the ACE_Object_Manager instance has been destroyed, + // so the preallocated lock is not available. Either way, + // don't register for destruction with the + // ACE_Object_Manager: we'll have to leak this instance. + + ACE_NEW_RETURN (singleton, + (ACE_Unmanaged_TSS_Singleton), + 0); + } + else + { +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + // Obtain a lock from the ACE_Object_Manager. The pointer + // is static, so we only obtain one per + // ACE_Unmanaged_Singleton instantiation. + static ACE_LOCK *lock = 0; + if (ACE_Object_Manager::get_singleton_lock (lock) != 0) + // Failed to acquire the lock! + return 0; + + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); +#endif /* ACE_MT_SAFE */ + + if (singleton == 0) + ACE_NEW_RETURN (singleton, + (ACE_Unmanaged_TSS_Singleton), + 0); + } + } + + return ACE_TSS_GET (&singleton->instance_, TYPE); +} + +template void +ACE_Unmanaged_TSS_Singleton::close (void) +{ + ACE_Unmanaged_TSS_Singleton *&singleton = + ACE_Unmanaged_TSS_Singleton::instance_i (); + + if (singleton) + singleton->cleanup (); +} + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) +// Pointer to the Singleton instance. +template ACE_TSS_Singleton * +ACE_TSS_Singleton::singleton_ = 0; + +template +ACE_Unmanaged_TSS_Singleton * +ACE_Unmanaged_TSS_Singleton::singleton_ = 0; +#endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */ + +/*************************************************************************/ + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) +// Pointer to the Singleton instance. +template ACE_DLL_Singleton_T * +ACE_DLL_Singleton_T::singleton_ = 0; +#endif /* !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) */ + +template void +ACE_DLL_Singleton_T::dump (void) +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_DLL_Singleton_T::dump"); + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("instance_ = %x"), + ACE_DLL_Singleton_T::instance_i ())); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_DLL_Singleton_T *& +ACE_DLL_Singleton_T::instance_i (void) +{ + ACE_TRACE ("ACE_DLL_Singleton_T::instance_i"); + +#if defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + // Pointer to the Singleton instance. This works around a bug with + // G++ and it's (mis-)handling of templates and statics... + static ACE_DLL_Singleton_T *singleton_ = 0; + + return singleton_; +#else + return ACE_DLL_Singleton_T::singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +} + +template TYPE * +ACE_DLL_Singleton_T::instance (void) +{ + ACE_TRACE ("ACE_DLL_Singleton_T::instance"); + + ACE_DLL_Singleton_T *&singleton = + ACE_DLL_Singleton_T::instance_i (); + + // Perform the Double-Check pattern... + if (singleton == 0) + { + if (ACE_Object_Manager::starting_up () || + ACE_Object_Manager::shutting_down ()) + { + // The program is still starting up, and therefore assumed + // to be single threaded. There's no need to double-check. + // Or, the ACE_Object_Manager instance has been destroyed, + // so the preallocated lock is not available. Either way, + // don't register for destruction with the + // ACE_Object_Manager: we'll have to leak this instance. + + ACE_NEW_RETURN (singleton, (ACE_DLL_Singleton_T), + 0); + } + else + { +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + // Obtain a lock from the ACE_Object_Manager. The pointer + // is static, so we only obtain one per + // ACE_Unmanaged_Singleton instantiation. + static ACE_LOCK *lock = 0; + if (ACE_Object_Manager::get_singleton_lock (lock) != 0) + // Failed to acquire the lock! + return 0; + + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *lock, 0); +#endif /* ACE_MT_SAFE */ + + if (singleton == 0) + ACE_NEW_RETURN (singleton, + (ACE_DLL_Singleton_T), + 0); + } + //ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_DLL_Singleton, singleton); + ACE_Framework_Repository::instance ()->register_component + (new ACE_Framework_Component_T > (singleton)); + } + + return &singleton->instance_; +} + +template void +ACE_DLL_Singleton_T::close (void) +{ + ACE_TRACE ("ACE_DLL_Singleton_T::close"); + + ACE_DLL_Singleton_T *&singleton = + ACE_DLL_Singleton_T::instance_i (); + + delete singleton; + singleton = 0; +} + +template void +ACE_DLL_Singleton_T::close_singleton (void) +{ + ACE_TRACE ("ACE_DLL_Singleton_T::close_singleton"); + ACE_DLL_Singleton_T::close (); +} + +template const ACE_TCHAR * +ACE_DLL_Singleton_T::dll_name (void) +{ + return this->instance ()->dll_name (); +} + +template const ACE_TCHAR * +ACE_DLL_Singleton_T::name (void) +{ + return this->instance ()->name (); +} + + +/**********************************************************************/ + +template const ACE_TCHAR* +ACE_DLL_Singleton_Adapter_T::dll_name (void) +{ + // @todo make this a constant somewhere (or it there already is one + // then use it. + return ACE_TEXT("ACE"); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_SINGLETON_CPP */ diff --git a/externals/ace/Singleton.h b/externals/ace/Singleton.h new file mode 100644 index 0000000..308ddc3 --- /dev/null +++ b/externals/ace/Singleton.h @@ -0,0 +1,330 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Singleton.h + * + * $Id: Singleton.h 84273 2009-01-30 12:55:25Z johnnyw $ + * + * @brief + * + * @author Tim Harrison + * @author Douglas C. Schmidt + * @author Chris Lahey + * @author Rich Christy + * @author David Levine + */ +//============================================================================= + +#ifndef ACE_SINGLETON_H +#define ACE_SINGLETON_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" +#include "ace/TSS_T.h" +#include "ace/Cleanup.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Singleton + * + * @brief A Singleton Adapter uses the Adapter pattern to turn ordinary + * classes into Singletons optimized with the Double-Checked + * Locking optimization pattern. + * + * This implementation is a slight variation on the GoF + * Singleton pattern. In particular, a single + * > instance is allocated here, + * not a instance. The reason for this is to allow + * registration with the ACE_Object_Manager, so that the + * Singleton can be cleaned up when the process exits. For this + * scheme to work, a (static) cleanup() function must be + * provided. ACE_Singleton provides one so that TYPE doesn't + * need to. + * If you want to make sure that only the singleton instance of + * is created, and that users cannot create their own + * instances of , do the following to class : + * (a) Make the constructor of private (or protected) + * (b) Make Singleton a friend of + * Here is an example: + * @verbatim + * class foo + * { + * friend class ACE_Singleton; + * private: + * foo () { cout << "foo constructed" << endl; } + * ~foo () { cout << "foo destroyed" << endl; } + * }; + * typedef ACE_Singleton FOO; + * @endverbatim + * + * @note The best types to use for ACE_LOCK are + * ACE_Recursive_Thread_Mutex and ACE_Null_Mutex. + * ACE_Recursive_Thread_Mutex should be used in multi-threaded + * programs in which it is possible for more than one thread to + * access the > instance. + * ACE_Null_Mutex can be used otherwise. The reason that these + * types of locks are best has to do with their allocation by + * the ACE_Object_Manager. Single ACE_Recursive_Thread_Mutex + * and ACE_Null_Mutex instances are used for all ACE_Singleton + * instantiations. However, other types of locks are allocated + * per ACE_Singleton instantiation. + */ +template +class ACE_Singleton : public ACE_Cleanup +{ +public: + /// Global access point to the Singleton. + static TYPE *instance (void); + + /// Cleanup method, used by @c ace_cleanup_destroyer to destroy the + /// ACE_Singleton. + virtual void cleanup (void *param = 0); + + /// Explicitly delete the Singleton instance. + static void close (void); + + /// Dump the state of the object. + static void dump (void); + +protected: + /// Default constructor. + ACE_Singleton (void); + + /// Contained instance. + TYPE instance_; + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + /// Pointer to the Singleton (ACE_Cleanup) instance. + static ACE_Singleton *singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ + + /// Get pointer to the Singleton instance. + static ACE_Singleton *&instance_i (void); +}; + +/** + * @class ACE_Unmanaged_Singleton + * + * @brief Same as ACE_Singleton, except does _not_ register with + * ACE_Object_Manager for destruction. + * + * This version of ACE_Singleton can be used if, for example, + * its DLL will be unloaded before the ACE_Object_Manager + * destroys the instance. Unlike with ACE_Singleton, the + * application is responsible for explicitly destroying the + * instance after it is no longer needed (if it wants to avoid + * memory leaks, at least). The close() static member function + * must be used to explicitly destroy the Singleton. + * Usage is the same as for ACE_Singleton, but note that if you + * you declare a friend, the friend class must still be an + * *ACE_Singleton*, not an ACE_Unmanaged_Singleton. + */ +template +class ACE_Unmanaged_Singleton : public ACE_Singleton +{ +public: + /// Global access point to the Singleton. + static TYPE *instance (void); + + /// Explicitly delete the Singleton instance. + static void close (void); + + /// Dump the state of the object. + static void dump (void); + +protected: + /// Default constructor. + ACE_Unmanaged_Singleton (void); + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + /// Pointer to the Singleton (ACE_Cleanup) instance. + static ACE_Unmanaged_Singleton *singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ + + /// Get pointer to the Singleton instance. + static ACE_Unmanaged_Singleton *&instance_i (void); +}; + +/** + * @class ACE_TSS_Singleton + * + * @brief This class uses the Adapter pattern to turn ordinary classes + * into Thread-specific Singletons optimized with the + * Double-Checked Locking optimization pattern. + * + * This implementation is another variation on the GoF Singleton + * pattern. In this case, a single > instance is allocated here, not a instance. + * Each call to the static method returns a Singleton + * whose pointer resides in thread-specific storage. As with + * ACE_Singleton, we use the ACE_Object_Manager so that the + * Singleton can be cleaned up when the process exits. For this + * scheme to work, a (static) cleanup() function must be + * provided. ACE_Singleton provides one so that TYPE doesn't + * need to. + */ +template +class ACE_TSS_Singleton : public ACE_Cleanup +{ +public: + /// Global access point to the singleton. + static TYPE *instance (void); + + /// Cleanup method, used by to destroy the + /// singleton. + virtual void cleanup (void *param = 0); + + /// Dump the state of the object. + static void dump (void); + +protected: + /// Default constructor. + ACE_TSS_Singleton (void); + + /// Contained instance. + ACE_TSS_TYPE (TYPE) instance_; + + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS_Singleton &)) + ACE_UNIMPLEMENTED_FUNC (ACE_TSS_Singleton (const ACE_TSS_Singleton &)) + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + /// Pointer to the Singleton (ACE_Cleanup) instance. + static ACE_TSS_Singleton *singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ + + /// Get pointer to the TSS Singleton instance. + static ACE_TSS_Singleton *&instance_i (void); +}; + +/** + * @class ACE_Unmanaged_TSS_Singleton + * + * @brief Same as ACE_TSS_Singleton, except does _not_ register with + * ACE_Object_Manager for destruction. + * + * This version of ACE_TSS_Singleton can be used if, for example, its DLL will + * be unloaded before the ACE_Object_Manager destroys the instance. Unlike with + * ACE_Singleton, the application is responsible for explicitly destroying the + * instance after it is no longer needed (if it wants to avoid memory leaks, + * at least). The close() static member function must be used to explicitly + * destroy the Singleton. + */ +template +class ACE_Unmanaged_TSS_Singleton : public ACE_TSS_Singleton +{ +public: + /// Global access point to the singleton. + static TYPE *instance (void); + + /// Explicitly delete the singleton instance. + static void close (void); + + /// Dump the state of the object. + static void dump (void); + +protected: + /// Default constructor. + ACE_Unmanaged_TSS_Singleton (void); + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + /// Pointer to the Singleton (ACE_Cleanup) instance. + static ACE_Unmanaged_TSS_Singleton *singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ + + /// Get pointer to the Singleton instance. + static ACE_Unmanaged_TSS_Singleton *&instance_i (void); +}; + +/** + * @class ACE_DLL_Singleton_T + * + * @brief Same as ACE_Singleton, except that it registers for + * destruction with the ACE_Framework_Repository instead of + * with the ACE_Object_Manager directly. + * + * This version of ACE_Singleton should be used for singletons + * that live in a dll loaded either directly by ACE_DLL or indirectly + * by the ACE Service Configuration framework. Whenever ACE_DLL is ready + * to actually unload the dll, ACE_DLL_Singleton based dlls associated + * with that dll will be destroyed first. In fact, any singleton can + * safely use ACE_DLL_Singleton, even those that don't live in dlls. In + * that case, the singleton will be destroyed at normal program shutdown. + * + * The only additional requirement is that the contained class + * export name() and dll_name() methods. See ACE_DLL_Singleton_Adapter_T + * below for a convenient example of how to satisfy this + * requirement for the dll_name(). + * + * Usage is the same as for ACE_Singleton, but note that if you + * you declare a friend, the friend class must still be an + * *ACE_Singleton*, not an ACE_Unmanaged_Singleton. + */ +template +class ACE_DLL_Singleton_T +{ +public: + //void cleanup (void *param = 0); + + /// Global access point to the Singleton. + static TYPE *instance (void); + + /// Explicitly delete the Singleton instance. + static void close (void); + + static void close_singleton (void); + + /// Dump the state of the object. + static void dump (void); + + const ACE_TCHAR *dll_name (void); + + const ACE_TCHAR *name (void); + +protected: + /// Default constructor. + ACE_DLL_Singleton_T (void); + + /// Destructor. + ~ACE_DLL_Singleton_T (void); + + /// Contained instance. + TYPE instance_; + +#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES) + /// Pointer to the Singleton instance. + static ACE_DLL_Singleton_T *singleton_; +#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ + + /// Get pointer to the singleton instance. + static ACE_DLL_Singleton_T *&instance_i (void); +}; + +template +class ACE_DLL_Singleton_Adapter_T : public TYPE +{ +public: + const ACE_TCHAR *dll_name (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Singleton.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Singleton.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Singleton.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_SINGLETON_H */ diff --git a/externals/ace/Singleton.inl b/externals/ace/Singleton.inl new file mode 100644 index 0000000..107a8b7 --- /dev/null +++ b/externals/ace/Singleton.inl @@ -0,0 +1,42 @@ +// -*- C++ -*- +// +// $Id: Singleton.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Default constructors. +// +// Note: don't explicitly initialize "instance_", because TYPE may not +// have a default constructor. Let the compiler figure it out . . . + +template ACE_INLINE +ACE_Singleton::ACE_Singleton (void) +{ +} + +template ACE_INLINE +ACE_Unmanaged_Singleton::ACE_Unmanaged_Singleton (void) +{ +} + +template ACE_INLINE +ACE_TSS_Singleton::ACE_TSS_Singleton (void) +{ +} + +template ACE_INLINE +ACE_Unmanaged_TSS_Singleton::ACE_Unmanaged_TSS_Singleton (void) +{ +} + +template ACE_INLINE +ACE_DLL_Singleton_T::ACE_DLL_Singleton_T (void) +{ +} + +template +ACE_DLL_Singleton_T::~ACE_DLL_Singleton_T (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Sock_Connect.cpp b/externals/ace/Sock_Connect.cpp new file mode 100644 index 0000000..217d83c --- /dev/null +++ b/externals/ace/Sock_Connect.cpp @@ -0,0 +1,1597 @@ +// $Id: Sock_Connect.cpp 87160 2009-10-19 14:01:10Z olli $ + +#include "ace/Sock_Connect.h" +#include "ace/INET_Addr.h" +#include "ace/Log_Msg.h" +#include "ace/Handle_Set.h" +#include "ace/Auto_Ptr.h" +#include "ace/SString.h" +#include "ace/OS_Memory.h" +#include "ace/OS_NS_stdio.h" +#include "ace/ACE.h" + +#if defined (sparc) +# include "ace/OS_NS_fcntl.h" +#endif // sparc + +#include "ace/OS_NS_stdlib.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_sys_socket.h" +#include "ace/OS_NS_netdb.h" +#include "ace/OS_NS_unistd.h" +#include "ace/os_include/net/os_if.h" + +#if defined (ACE_HAS_IPV6) +# include "ace/Guard_T.h" +# include "ace/Recursive_Thread_Mutex.h" +# if defined (_AIX) +# include /**/ +# endif /* _AIX */ +#endif /* ACE_HAS_IPV6 */ + +# if defined (ACE_HAS_GETIFADDRS) +# if defined (ACE_VXWORKS) +# include /**/ +# else +# include /**/ +# endif /*ACE_VXWORKS */ +# endif /* ACE_HAS_GETIFADDRS */ + +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) +#include /**/ +#include /**/ +#if defined (ACE_HAS_IPV6) +#include /**/ +extern "C" { + extern struct in_ifaddr* in_ifaddr; + extern LIST_HEAD(in_ifaddrhashhead, in_ifaddr) *in_ifaddrhashtbl; +} +#endif /* ACE_HAS_IPV6 */ +#include "ace/OS_NS_stdio.h" +#endif /* ACE_VXWORKS < 0x600 */ + +#if defined (ACE_VXWORKS) && ((ACE_VXWORKS >= 0x630) && (ACE_VXWORKS <= 0x670)) && defined (__RTP__) && defined (ACE_HAS_IPV6) +const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; +const struct in6_addr in6addr_nodelocal_allnodes = IN6ADDR_NODELOCAL_ALLNODES_INIT; +const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT; +const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; +#endif /* ACE_VXWORKS >= 0x630 && <= 0x670 && __RTP__ && ACE_HAS_IPV6 */ + +#if defined (ACE_HAS_WINCE) +#include /**/ +# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && (_WIN32_WCE < 0x600) && defined (ACE_HAS_IPV6) +// The following code is suggested by microsoft as a workaround to the fact +// that on Windows CE, these constants are exported as function addresses +// rather than simply values. +# include /**/ +const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; +const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; +# endif +#endif // ACE_HAS_WINCE + +#if defined (ACE_WIN32) && defined (ACE_HAS_PHARLAP) +# include "ace/OS_NS_stdio.h" +#endif + +#if defined (ACE_HAS_IPV6) + +// These defines support a generic usage based on +// the various SIGCF*IF ioctl implementations + +# if defined (SIOCGLIFCONF) +# define SIOCGIFCONF_CMD SIOCGLIFCONF +# if defined (__hpux) +# define IFREQ if_laddrreq +# define IFCONF if_laddrconf +# define IFC_REQ iflc_req +# define IFC_LEN iflc_len +# define IFC_BUF iflc_buf +# define IFR_ADDR iflr_addr +# define IFR_NAME iflr_name +# define IFR_FLAGS iflr_flags +# undef SETFAMILY +# define SA_FAMILY sa_family +# else +# define IFREQ lifreq +# define IFCONF lifconf +# define IFC_REQ lifc_req +# define IFC_LEN lifc_len +# define IFC_BUF lifc_buf +# define IFR_ADDR lifr_addr +# define IFR_NAME lifr_name +# define IFR_FLAGS lifr_flags +# define SETFAMILY +# define IFC_FAMILY lifc_family +# define IFC_FLAGS lifc_flags +# define SA_FAMILY ss_family +# endif +# else +# define SIOCGIFCONF_CMD SIOCGIFCONF +# define IFREQ ifreq +# define IFCONF ifconf +# define IFC_REQ ifc_req +# define IFC_LEN ifc_len +# define IFC_BUF ifc_buf +# define IFR_ADDR ifr_addr +# define IFR_NAME ifr_name +# define IFR_FLAGS ifr_flags +# undef SETFAMILY +# define SA_FAMILY sa_family +# endif /* SIOCGLIFCONF */ + +# if defined (ACE_HAS_THREADS) +# include "ace/Object_Manager.h" +# endif /* ACE_HAS_THREADS */ + +namespace +{ + // private: + // Used internally so not exported. + + // Does this box have ipv4 turned on? + int ace_ipv4_enabled = -1; + + // Does this box have ipv6 turned on? + int ace_ipv6_enabled = -1; + +} +#else /* ACE_HAS_IPV6 */ +# define SIOCGIFCONF_CMD SIOCGIFCONF +# define IFREQ ifreq +# define IFCONF ifconf +# define IFC_REQ ifc_req +# define IFC_LEN ifc_len +# define IFC_BUF ifc_buf +# define IFR_ADDR ifr_addr +# define IFR_NAME ifr_name +# define IFR_FLAGS ifr_flags +# undef SETFAMILY +# define SA_FAMILY sa_family +#endif /* ACE_HAS_IPV6 */ + +// This is a hack to work around a problem with Visual Age C++ 5 and 6 on AIX. +// Without this, the compiler auto-instantiates the ACE_Auto_Array_Ptr for +// ifreq (contained in this module) but only adds the #include for +// and not the one for which is also needed. Although we +// don't need the template defined here, it makes the compiler pull in +// and the build runs clean. +#if defined (AIX) && defined (__IBMCPP__) && (__IBMCPP__ >= 500) && (__IBMCPP__ < 700) +static ACE_Auto_Array_Ptr force_compiler_to_include_socket_h; +#endif /* AIX && __IBMCPP__ >= 500 */ + + +ACE_RCSID (ace, + Sock_Connect, + "$Id: Sock_Connect.cpp 87160 2009-10-19 14:01:10Z olli $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Bind socket to an unused port. + +int +ACE::bind_port (ACE_HANDLE handle, ACE_UINT32 ip_addr, int address_family) +{ + ACE_TRACE ("ACE::bind_port"); + + ACE_INET_Addr addr; + +#if defined (ACE_HAS_IPV6) + if (address_family != PF_INET6) + // What do we do if it is PF_"INET6? Since it's 4 bytes, it must be an + // IPV4 address. Is there a difference? Why is this test done? dhinton +#else /* ACE_HAS_IPV6 */ + ACE_UNUSED_ARG (address_family); +#endif /* !ACE_HAS_IPV6 */ + addr = ACE_INET_Addr ((u_short)0, ip_addr); +#if defined (ACE_HAS_IPV6) + else if (ip_addr != INADDR_ANY) + // address_family == PF_INET6 and a non default IP address means to bind + // to the IPv4-mapped IPv6 address + addr.set ((u_short)0, ip_addr, 1, 1); +#endif /* ACE_HAS_IPV6 */ + + // The OS kernel should select a free port for us. + return ACE_OS::bind (handle, + (sockaddr*)addr.get_addr(), + addr.get_size()); +} + +int +ACE::get_bcast_addr (ACE_UINT32 &bcast_addr, + const ACE_TCHAR *host_name, + ACE_UINT32 host_addr, + ACE_HANDLE handle) +{ + ACE_TRACE ("ACE::get_bcast_addr"); + +#if defined (ACE_LACKS_GET_BCAST_ADDR) + ACE_UNUSED_ARG (bcast_addr); + ACE_UNUSED_ARG (host_name); + ACE_UNUSED_ARG (host_addr); + ACE_UNUSED_ARG (handle); + ACE_NOTSUP_RETURN (-1); +#elif !defined(ACE_WIN32) && !defined(__INTERIX) + ACE_HANDLE s = handle; + + if (s == ACE_INVALID_HANDLE) + s = ACE_OS::socket (AF_INET, SOCK_STREAM, 0); + + if (s == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_OS::socket")), + -1); + + struct ifconf ifc; + char buf[BUFSIZ]; + + ifc.ifc_len = sizeof buf; + ifc.ifc_buf = buf; + + // Get interface structure and initialize the addresses using UNIX + // techniques + if (ACE_OS::ioctl (s, SIOCGIFCONF_CMD, (char *) &ifc) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_bcast_addr:") + ACE_TEXT ("ioctl (get interface configuration)")), + -1); + + struct ifreq *ifr = ifc.ifc_req; + + struct sockaddr_in ip_addr; + + // Get host ip address if necessary. + if (host_name) + { + hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name)); + + if (hp == 0) + return -1; + else +#if !defined(_UNICOS) + ACE_OS::memcpy ((char *) &ip_addr.sin_addr.s_addr, + (char *) hp->h_addr, + hp->h_length); +#else /* _UNICOS */ + { + ACE_UINT64 haddr; // a place to put the address + char * haddrp = (char *) &haddr; // convert to char pointer + ACE_OS::memcpy(haddrp,(char *) hp->h_addr,hp->h_length); + ip_addr.sin_addr.s_addr = haddr; + } +#endif /* ! _UNICOS */ + } + else + { + ACE_OS::memset ((void *) &ip_addr, 0, sizeof ip_addr); +#if !defined(_UNICOS) + ACE_OS::memcpy ((void *) &ip_addr.sin_addr, + (void*) &host_addr, + sizeof ip_addr.sin_addr); +#else /* _UNICOS */ + ip_addr.sin_addr.s_addr = host_addr; // just copy to the bitfield +#endif /* ! _UNICOS */ + } + +#if !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (__Lynx__) + for (int n = ifc.ifc_len / sizeof (struct ifreq) ; n > 0; + n--, ifr++) +#else + // see mk_broadcast@SOCK_Dgram_Bcast.cpp + for (int nbytes = ifc.ifc_len; nbytes >= (int) sizeof (struct ifreq) && + ((ifr->ifr_addr.sa_len > sizeof (struct sockaddr)) ? + (nbytes >= (int) sizeof (ifr->ifr_name) + ifr->ifr_addr.sa_len) : 1); + ((ifr->ifr_addr.sa_len > sizeof (struct sockaddr)) ? + (nbytes -= sizeof (ifr->ifr_name) + ifr->ifr_addr.sa_len, + ifr = (struct ifreq *) + ((caddr_t) &ifr->ifr_addr + ifr->ifr_addr.sa_len)) : + (nbytes -= sizeof (struct ifreq), ifr++))) +#endif /* !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (__Lynx__) */ + { + struct sockaddr_in if_addr; + + // Compare host ip address with interface ip address. + ACE_OS::memcpy (&if_addr, + &ifr->ifr_addr, + sizeof if_addr); + + if (ip_addr.sin_addr.s_addr != if_addr.sin_addr.s_addr) + continue; + + if (ifr->ifr_addr.sa_family != AF_INET) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_bcast_addr:") + ACE_TEXT ("Not AF_INET"))); + continue; + } + + struct ifreq flags = *ifr; + struct ifreq if_req = *ifr; + + if (ACE_OS::ioctl (s, SIOCGIFFLAGS, (char *) &flags) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_bcast_addr:") + ACE_TEXT (" ioctl (get interface flags)"))); + continue; + } + + if (ACE_BIT_DISABLED (flags.ifr_flags, IFF_UP)) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_bcast_addr:") + ACE_TEXT ("Network interface is not up"))); + continue; + } + + if (ACE_BIT_ENABLED (flags.ifr_flags, IFF_LOOPBACK)) + continue; + + if (ACE_BIT_ENABLED (flags.ifr_flags, IFF_BROADCAST)) + { + if (ACE_OS::ioctl (s, + SIOCGIFBRDADDR, + (char *) &if_req) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_bcast_addr:") + ACE_TEXT ("ioctl (get broadaddr)"))); + else + { + ACE_OS::memcpy (&ip_addr, + &if_req.ifr_broadaddr, + sizeof if_req.ifr_broadaddr); + + ACE_OS::memcpy ((void *) &host_addr, + (void *) &ip_addr.sin_addr, + sizeof host_addr); + + if (handle == ACE_INVALID_HANDLE) + ACE_OS::close (s); + + bcast_addr = host_addr; + return 0; + } + } + else + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_bcast_addr:") + ACE_TEXT ("Broadcast is not enable for this interface."))); + + if (handle == ACE_INVALID_HANDLE) + ACE_OS::close (s); + + bcast_addr = host_addr; + return 0; + } + + return 0; +#else + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (host_addr); + ACE_UNUSED_ARG (host_name); + bcast_addr = (ACE_UINT32 (INADDR_BROADCAST)); + return 0; +#endif /* !ACE_WIN32 && !__INTERIX */ +} + +int +ACE::get_fqdn (ACE_INET_Addr const & addr, + char hostname[], + size_t len) +{ + int h_error; // Not the same as errno! + hostent hentry; + ACE_HOSTENT_DATA buf; + + char * ip_addr = 0; + int ip_addr_size = 0; + if (addr.get_type () == AF_INET) + { + sockaddr_in * const sock_addr = + reinterpret_cast (addr.get_addr ()); + ip_addr_size = sizeof sock_addr->sin_addr; + ip_addr = (char*) &sock_addr->sin_addr; + } +#ifdef ACE_HAS_IPV6 + else + { + sockaddr_in6 * sock_addr = + reinterpret_cast (addr.get_addr ()); + + ip_addr_size = sizeof sock_addr->sin6_addr; + ip_addr = (char*) &sock_addr->sin6_addr; + } +#endif /* ACE_HAS_IPV6 */ + + // get the host entry for the address in question + hostent * const hp = ACE_OS::gethostbyaddr_r (ip_addr, + ip_addr_size, + addr.get_type (), + &hentry, + buf, + &h_error); + + // if it's not found in the host file or the DNS datase, there is nothing + // much we can do. embed the IP address + if (hp == 0 || hp->h_name == 0) + return -1; + + if (ACE::debug()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ") + ACE_TEXT ("canonical host name is %C\n"), + hp->h_name)); + + // check if the canonical name is the FQDN + if (!ACE_OS::strchr(hp->h_name, '.')) + { + // list of address + char** p; + // list of aliases + char** q; + + // for every address and for every alias within the address, check and + // see if we can locate a FQDN + for (p = hp->h_addr_list; *p != 0; ++p) + { + for (q = hp->h_aliases; *q != 0; ++q) + { + if (ACE_OS::strchr(*q, '.')) + { + // we got an FQDN from an alias. use this + if (ACE_OS::strlen (*q) >= len) + // the hostname is too huge to fit into a + // buffer of size MAXHOSTNAMELEN + // should we check other aliases as well + // before bailing out prematurely? + // for right now, let's do it. this (short name) + // is atleast better than embedding the IP + // address in the profile + continue; + + if (ACE::debug ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ") + ACE_TEXT ("found fqdn within alias as %C\n"), + *q)); + ACE_OS::strcpy (hostname, *q); + + return 0; + } + } + } + } + + // The canonical name may be an FQDN when we reach here. + // Alternatively, the canonical name (a non FQDN) may be the best + // we can do. + if (ACE_OS::strlen (hp->h_name) >= len) + { + // The hostname is too large to fit into a buffer of size + // MAXHOSTNAMELEN. + return -2; + } + else + { + ACE_OS::strcpy (hostname, hp->h_name); + } + + return 0; +} + +#if defined (ACE_WIN32) + +static int +get_ip_interfaces_win32 (size_t &count, + ACE_INET_Addr *&addrs) +{ +# if defined (ACE_HAS_WINCE) && defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) + // moved the ACE_HAS_WINCE impl ahaid of ACE_HAS_WINSOCK2 because + // WINCE in fact has winsock2, but doesn't properly support the + // WSAIoctl for obtaining IPv6 address info. + PIP_ADAPTER_ADDRESSES AdapterAddresses = 0; + ULONG OutBufferLength = 0; + ULONG RetVal = 0; + unsigned char *octet_buffer = 0; + + RetVal = + GetAdaptersAddresses(AF_UNSPEC, + 0, + 0, + AdapterAddresses, + &OutBufferLength); + + if (RetVal != ERROR_BUFFER_OVERFLOW) + { + return -1; + } + + ACE_NEW_RETURN (octet_buffer, unsigned char[OutBufferLength],-1); + AdapterAddresses = (IP_ADAPTER_ADDRESSES *)octet_buffer; + + RetVal = + GetAdaptersAddresses(AF_UNSPEC, + 0, + 0, + AdapterAddresses, + &OutBufferLength); + + if (RetVal != NO_ERROR) + { + delete [] octet_buffer; + return -1; + } + + // If successful, output some information from the data we received + PIP_ADAPTER_ADDRESSES AdapterList = AdapterAddresses; + while (AdapterList) + { + if (AdapterList->OperStatus == IfOperStatusUp) + { + if (AdapterList->IfIndex != 0) + ++count; + if (AdapterList->Ipv6IfIndex != 0) + ++count; + } + AdapterList = AdapterList->Next; + } + + AdapterList = AdapterAddresses; + + ACE_NEW_RETURN (addrs, ACE_INET_Addr[count],-1); + count = 0; + for (AdapterList = AdapterAddresses; + AdapterList != 0; + AdapterList = AdapterList->Next) + { + if (AdapterList->OperStatus != IfOperStatusUp) + continue; + + IP_ADAPTER_UNICAST_ADDRESS *uni = 0; + if (AdapterList->IfIndex != 0) + for (uni = AdapterList->FirstUnicastAddress; + uni != 0; + uni = uni->Next) + { + SOCKET_ADDRESS *sa_addr = &uni->Address; + if (sa_addr->lpSockaddr->sa_family == AF_INET) + { + sockaddr_in *sin = (sockaddr_in*)sa_addr->lpSockaddr; + addrs[count].set(sin,sa_addr->iSockaddrLength); + ++count; + break; + } + } + if (AdapterList->Ipv6IfIndex != 0) + { + for (uni = AdapterList->FirstUnicastAddress; + uni != 0; + uni = uni->Next) + { + SOCKET_ADDRESS *sa_addr = &uni->Address; + if (sa_addr->lpSockaddr->sa_family == AF_INET6) + { + sockaddr_in *sin = (sockaddr_in*)sa_addr->lpSockaddr; + addrs[count].set(sin,sa_addr->iSockaddrLength); + ++count; + break; + } + } + } + } + + delete [] octet_buffer; + return 0; + +# elif defined (ACE_HAS_PHARLAP) + // PharLap ETS has its own kernel routines to rummage through the device + // configs and extract the interface info, but only for Pharlap RT. +# if !defined (ACE_HAS_PHARLAP_RT) + ACE_NOTSUP_RETURN (-1); +# endif /* ACE_HAS_PHARLAP_RT */ + + // Locate all of the IP devices in the system, saving a DEVHANDLE + // for each. Then allocate the ACE_INET_Addrs needed and fetch all + // the IP addresses. To locate the devices, try the available + // device name roots and increment the device number until the + // kernel says there are no more of that type. + const size_t ACE_MAX_ETS_DEVICES = 64; // Arbitrary, but should be enough. + DEVHANDLE ip_dev[ACE_MAX_ETS_DEVICES]; + EK_TCPIPCFG *devp = 0; + size_t i, j; + ACE_TCHAR dev_name[16]; + + count = 0; + for (i = 0; count < ACE_MAX_ETS_DEVICES; i++, ++count) + { + // Ethernet. + ACE_OS::sprintf (dev_name, + "ether%d", + i); + ip_dev[count] = EtsTCPGetDeviceHandle (dev_name); + if (ip_dev[count] == 0) + break; + } + for (i = 0; count < ACE_MAX_ETS_DEVICES; i++, ++count) + { + // SLIP. + ACE_OS::sprintf (dev_name, + "sl%d", + i); + ip_dev[count] = EtsTCPGetDeviceHandle (dev_name); + if (ip_dev[count] == 0) + break; + } + for (i = 0; count < ACE_MAX_ETS_DEVICES; i++, ++count) + { + // PPP. + ACE_OS::sprintf (dev_name, + "ppp%d", + i); + ip_dev[count] = EtsTCPGetDeviceHandle (dev_name); + if (ip_dev[count] == 0) + break; + } + + if (count > 0) + ACE_NEW_RETURN (addrs, + ACE_INET_Addr[count], + -1); + else + addrs = 0; + + for (i = 0, j = 0; i < count; i++) + { + devp = EtsTCPGetDeviceCfg (ip_dev[i]); + if (devp != 0) + { + addrs[j].set (0, + devp->nwIPAddress, + 0); // Already in net order. + ++j; + } + // There's no call to close the DEVHANDLE. + } + + count = j; + if (count == 0 && addrs != 0) + { + delete [] addrs; + addrs = 0; + } + + return 0; + + +# else + // All non-CE, non-Pharlap Windows. Must support Winsock2. + + int i, n_interfaces, status; + + INTERFACE_INFO info[64]; + SOCKET sock; + + // Get an (overlapped) DGRAM socket to test with + sock = socket (AF_INET, SOCK_DGRAM, 0); + if (sock == INVALID_SOCKET) + return -1; + + DWORD bytes; + status = WSAIoctl(sock, + SIO_GET_INTERFACE_LIST, + 0, + 0, + info, + sizeof(info), + &bytes, + 0, + 0); + closesocket (sock); + if (status == SOCKET_ERROR) + return -1; + + n_interfaces = bytes / sizeof(INTERFACE_INFO); + + // SIO_GET_INTERFACE_LIST does not work for IPv6 + // Instead recent versions of Winsock2 add the new opcode + // SIO_ADDRESS_LIST_QUERY. + // If this is not available forget about IPv6 local interfaces:-/ + int n_v6_interfaces = 0; + +# if defined (ACE_HAS_IPV6) && defined (SIO_ADDRESS_LIST_QUERY) + + LPSOCKET_ADDRESS_LIST v6info; + char *buffer; + DWORD buflen = sizeof (SOCKET_ADDRESS_LIST) + (63 * sizeof (SOCKET_ADDRESS)); + ACE_NEW_RETURN (buffer, + char[buflen], + -1); + v6info = reinterpret_cast (buffer); + + // Get an (overlapped) DGRAM socket to test with. + // If it fails only return IPv4 interfaces. + sock = socket (AF_INET6, SOCK_DGRAM, IPPROTO_UDP); + if (sock != INVALID_SOCKET) + { + status = WSAIoctl(sock, + SIO_ADDRESS_LIST_QUERY, + 0, + 0, + v6info, + buflen, + &bytes, + 0, + 0); + closesocket (sock); + if (status != SOCKET_ERROR) + n_v6_interfaces = v6info->iAddressCount; + } +# endif /* ACE_HAS_IPV6 */ + + ACE_NEW_RETURN (addrs, + ACE_INET_Addr[n_interfaces + n_v6_interfaces], + -1); + + // Now go through the list and transfer the good ones to the list of + // because they're down or don't have an IP address. + for (count = 0, i = 0; i < n_interfaces; ++i) + { + LPINTERFACE_INFO lpii; + struct sockaddr_in *addrp = 0; + + lpii = &info[i]; + if (!(lpii->iiFlags & IFF_UP)) + continue; + + // We assume IPv4 addresses here + addrp = reinterpret_cast (&lpii->iiAddress.AddressIn); + if (addrp->sin_addr.s_addr == INADDR_ANY) + continue; + + // Set the address for the caller. + addrs[count].set(addrp, sizeof(sockaddr_in)); + ++count; + } + +# if defined (ACE_HAS_IPV6) && defined (SIO_ADDRESS_LIST_QUERY) + // Now go through the list and transfer the good ones to the list of + // because they're down or don't have an IP address. + for (i = 0; i < n_v6_interfaces; i++) + { + struct sockaddr_in6 *addr6p; + + if (v6info->Address[i].lpSockaddr->sa_family != AF_INET6) + continue; + + addr6p = reinterpret_cast (v6info->Address[i].lpSockaddr); + if (IN6_IS_ADDR_UNSPECIFIED(&addr6p->sin6_addr)) // IN6ADDR_ANY? + continue; + + // Set the address for the caller. + addrs[count].set(reinterpret_cast (addr6p), sizeof(sockaddr_in6)); + ++count; + } + + delete [] buffer; // Clean up +# endif /* ACE_HAS_IPV6 */ + + if (count == 0) + { + delete [] addrs; + addrs = 0; + } + + return 0; + +# endif /* ACE_HAS_WINCE */ +} +#elif defined (ACE_HAS_GETIFADDRS) +static int +get_ip_interfaces_getifaddrs (size_t &count, + ACE_INET_Addr *&addrs) +{ + // Take advantage of the BSD getifaddrs function that simplifies + // access to connected interfaces. + struct ifaddrs *ifap = 0; + struct ifaddrs *p_if = 0; + + if (::getifaddrs (&ifap) != 0) + return -1; + + // Count number of interfaces. + size_t num_ifs = 0; + for (p_if = ifap; p_if != 0; p_if = p_if->ifa_next) + ++num_ifs; + + // Now create and initialize output array. + ACE_NEW_RETURN (addrs, + ACE_INET_Addr[num_ifs], + -1); // caller must free + + // Pull the address out of each INET interface. Not every interface + // is for IP, so be careful to count properly. When setting the + // INET_Addr, note that the 3rd arg (0) says to leave the byte order + // (already in net byte order from the interface structure) as is. + count = 0; + + for (p_if = ifap; + p_if != 0; + p_if = p_if->ifa_next) + { + if (p_if->ifa_addr && + p_if->ifa_addr->sa_family == AF_INET) + { + struct sockaddr_in *addr = + reinterpret_cast (p_if->ifa_addr); + + // Sometimes the kernel returns 0.0.0.0 as the interface + // address, skip those... + if (addr->sin_addr.s_addr != INADDR_ANY) + { + addrs[count].set ((u_short) 0, + addr->sin_addr.s_addr, + 0); + ++count; + } + } +# if defined (ACE_HAS_IPV6) + else if (p_if->ifa_addr && + p_if->ifa_addr->sa_family == AF_INET6) + { + struct sockaddr_in6 *addr = + reinterpret_cast (p_if->ifa_addr); + + // Skip the ANY address + if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr)) + { + addrs[count].set(reinterpret_cast (addr), + sizeof(sockaddr_in6)); + ++count; + } + } +# endif /* ACE_HAS_IPV6 */ + } + + ::freeifaddrs (ifap); + + return 0; +} +#elif defined (__hpux) +static int +get_ip_interfaces_hpux (size_t &count, + ACE_INET_Addr *&addrs) +{ + size_t num_ifs = 0; + size_t num_ifs_found = 0; + + // Call specific routine as necessary. + ACE_HANDLE handle = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0); + ACE_HANDLE handle_ipv6 = ACE_INVALID_HANDLE; + + if (handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_ip_interfaces:open")), + -1); + + int result = 0; + int tmp_how_many = 0; + + result = ACE_OS::ioctl (handle, + SIOCGIFNUM, + (caddr_t) &tmp_how_many); + if (result != -1) + num_ifs = (size_t)tmp_how_many; + +# if defined (ACE_HAS_IPV6) + tmp_how_many = 0; + handle_ipv6 = ACE_OS::socket (PF_INET6, SOCK_DGRAM, 0); + result = ACE_OS::ioctl (handle_ipv6, + SIOCGLIFNUM, + (caddr_t) &tmp_how_many); + if (result != -1) + num_ifs += (size_t)tmp_how_many; +# endif + + if (num_ifs == 0) + { + ACE_OS::close (handle); + ACE_OS::close (handle_ipv6); + return -1; + } + + // ioctl likes to have an extra IFREQ structure to mark the end of + // what it returned, so increase the num_ifs by one. + ++num_ifs; + + //HPUX requires two passes, First for IPv4, then for IPv6 + + struct ifreq *ifs = 0; + ACE_NEW_RETURN (ifs, + struct ifreq[num_ifs], + -1); + ACE_OS::memset (ifs, 0, num_ifs * sizeof (struct ifreq)); + + ACE_Auto_Array_Ptr p_ifs (ifs); + + if (p_ifs.get() == 0) + { + ACE_OS::close (handle); + ACE_OS::close (handle_ipv6); + errno = ENOMEM; + return -1; + } + + struct ifconf ifcfg; + ACE_OS::memset (&ifcfg, 0, sizeof (struct ifconf)); + + ifcfg.ifc_req = p_ifs.get (); + ifcfg.ifc_len = num_ifs * sizeof (struct ifreq); + + if (ACE_OS::ioctl (handle, + SIOCGIFCONF, + (char *) &ifcfg) == -1) + { + ACE_OS::close (handle); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_ip_interfaces:") + ACE_TEXT ("ioctl - SIOCGIFCONF failed")), + -1); + } + + ACE_OS::close (handle); + + // Now create and initialize output array. + + ACE_NEW_RETURN (addrs, + ACE_INET_Addr[num_ifs], + -1); // caller must free + + struct ifreq *pcur = p_ifs.get (); + num_ifs_found = ifcfg.ifc_len / sizeof (struct ifreq); // get the number of returned ifs + + for (size_t i = 0; + i < num_ifs_found; + i++) + { + struct sockaddr_in *addr = + reinterpret_cast (&pcur->ifr_addr); + if (addr->sin_addr.s_addr != 0) + { + addrs[count].set ((u_short) 0, + addr->sin_addr.s_addr, + 0); + ++count; + } + ++pcur; + } + +# if defined (ACE_HAS_IPV6) + + if (handle_ipv6 != ACE_INVALID_HANDLE) + { + struct if_laddrreq *lifs = 0; + ACE_NEW_RETURN (lifs, + struct if_laddrreq[num_ifs], + -1); + ACE_OS::memset (lifs, 0, num_ifs * sizeof (struct if_laddrreq)); + + ACE_Auto_Array_Ptr p_lifs (lifs); + + if (p_lifs.get() == 0) + { + ACE_OS::close (handle); + ACE_OS::close (handle_ipv6); + errno = ENOMEM; + return -1; + } + + struct if_laddrconf lifcfg; + ACE_OS::memset (&lifcfg, 0, sizeof (struct if_laddrconf)); + + lifcfg.iflc_req = p_lifs.get (); + lifcfg.iflc_len = num_ifs * sizeof (struct if_laddrreq); + + if (ACE_OS::ioctl (handle_ipv6, + SIOCGLIFCONF, + (char *) &lifcfg) == -1) + { + ACE_OS::close (handle); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_ip_interfaces:") + ACE_TEXT ("ioctl - SIOCGLIFCONF failed")), + -1); + } + + ACE_OS::close (handle_ipv6); + + struct if_laddrreq *plcur = p_lifs.get (); + num_ifs_found = lifcfg.iflc_len / sizeof (struct if_laddrreq); + + for (size_t i = 0; + i < num_ifs_found; + i++) + { + struct sockaddr_in *addr = + reinterpret_cast (&plcur->iflr_addr); + if (!IN6_IS_ADDR_UNSPECIFIED(&reinterpret_cast(addr)->sin6_addr)) + { + addrs[count].set(addr, sizeof(struct sockaddr_in6)); + ++count; + } + ++plcur; + } + } +# endif /* ACE_HAS_IPV6 */ + return 0; +} +#elif defined (_AIX) +static int +get_ip_interfaces_aix (size_t &count, + ACE_INET_Addr *&addrs) +{ + ACE_HANDLE handle = ACE::get_handle(); + size_t num_ifs = 0; + struct ifconf ifc; + + if (handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_ip_interfaces_aix:")), + -1); + + if (ACE_OS::ioctl (handle, + SIOCGSIZIFCONF, + (caddr_t)&ifc.ifc_len) == -1) + { + ACE_OS::close (handle); + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("get ifconf size")), + -1); + } + + ACE_NEW_RETURN (ifc.ifc_buf,char [ifc.ifc_len], -1); + + ACE_Auto_Array_Ptr safe_buf (ifc.ifc_buf); + ACE_OS::memset (safe_buf.get(), 0, ifc.ifc_len); + + if (ACE_OS::ioctl(handle, SIOCGIFCONF, (caddr_t)&ifc) == -1) + { + ACE_OS::close (handle); + ACE_ERROR_RETURN((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("get ifconf")), + -1); + } + + ACE_OS::close (handle); + + char *buf_start = safe_buf.get(); + char *buf_end = buf_start + ifc.ifc_len; + + num_ifs = 0; + for (char *ptr = buf_start; ptr < buf_end; ) + { + struct ifreq *req = reinterpret_cast(ptr); + ptr += IFNAMSIZ; + ptr += req->ifr_addr.sa_len; + if (req->ifr_addr.sa_family == AF_INET +# if defined (ACE_HAS_IPV6) + || req->ifr_addr.sa_family == AF_INET6 +# endif + ) + ++num_ifs; + } + ACE_NEW_RETURN (addrs,ACE_INET_Addr[num_ifs], -1); + + for (char * ptr = buf_start; ptr < buf_end; ) + { + struct ifreq *req = reinterpret_cast(ptr); + // skip the interface name + ptr += IFNAMSIZ; + if (req->ifr_addr.sa_family == AF_INET +# if defined (ACE_HAS_IPV6) + || req->ifr_addr.sa_family == AF_INET6 +# endif + ) + { + sockaddr_in *addr = (sockaddr_in*)&req->ifr_addr; + addrs[count++].set(addr, addr->sin_len); + } + ptr += req->ifr_addr.sa_len; + } + + return 0; +} + +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) && !defined (ACE_HAS_VXWORKS551_MEDUSA) +int +get_ip_interfaces_vxworks_lt600 (size_t &count, + ACE_INET_Addr *&addrs) +{ + count = 0; + // Loop through each address structure + +# if defined (ACE_HAS_IPV6) && defined (TAILQ_ENTRY) +# define ia_next ia_link.tqe_next +# endif /* TAILQ_ENTRY */ + + for (struct in_ifaddr* ia = in_ifaddr; ia != 0; ia = ia->ia_next) + { + ++count; + } + + // Now create and initialize output array. + ACE_NEW_RETURN (addrs, + ACE_INET_Addr[count], + -1); // caller must free + count = 0; + for (struct in_ifaddr* ia = in_ifaddr; ia != 0; ia = ia->ia_next) + { + struct ifnet* ifp = ia->ia_ifa.ifa_ifp; + if (ifp != 0) + { + // Get the current interface name + char interface[64]; + ACE_OS::sprintf(interface, "%s%d", ifp->if_name, ifp->if_unit); + + // Get the address for the current interface + char address [INET_ADDR_LEN]; + STATUS status = ifAddrGet(interface, address); + + if (status == OK) + { + // Concatenate a ':' at the end. This is because in + // ACE_INET_Addr::string_to_addr, the ip_address is + // obtained using ':' as the delimiter. Since, using + // ifAddrGet(), we just get the IP address, I am adding + // a ":" to get with the general case. + ACE_OS::strcat (address, ":"); + addrs[count].set (address); + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE::get_ip_interface failed\n") + ACE_TEXT ("Couldnt get the IP Address\n")), + -1); + } + ++count; + } + } + return 0; +} +#endif // ACE_WIN32 || ACE_HAS_GETIFADDRS || __hpux || _AIX || ACE_VXWORKS < 0x600 + + +// return an array of all configured IP interfaces on this host, count +// rc = 0 on success (count == number of interfaces else -1 caller is +// responsible for calling delete [] on parray + +int +ACE::get_ip_interfaces (size_t &count, ACE_INET_Addr *&addrs) +{ + ACE_TRACE ("ACE::get_ip_interfaces"); + + count = 0; + addrs = 0; + +#if defined (ACE_WIN32) + return get_ip_interfaces_win32 (count, addrs); +#elif defined (ACE_HAS_GETIFADDRS) + return get_ip_interfaces_getifaddrs (count, addrs); +#elif defined (__hpux) + return get_ip_interfaces_hpux (count, addrs); +#elif defined (_AIX) + return get_ip_interfaces_aix (count, addrs); +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) && !defined (ACE_HAS_VXWORKS551_MEDUSA) + return get_ip_interfaces_vxworks_lt600 (count, addrs); +#elif (defined (__unix) || defined (__unix__) || defined (ACE_OPENVMS) || (defined (ACE_VXWORKS) && !defined (ACE_HAS_GETIFADDRS)) || defined (ACE_HAS_RTEMS)) && !defined (ACE_LACKS_NETWORKING) + // COMMON (SVR4 and BSD) UNIX CODE + + // Call specific routine as necessary. + ACE_HANDLE handle = ACE::get_handle(); + + if (handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_ip_interfaces:open")), + -1); + + size_t num_ifs = 0; + + if (ACE::count_interfaces (handle, num_ifs)) + { + ACE_OS::close (handle); + return -1; + } + + // ioctl likes to have an extra ifreq structure to mark the end of + // what it returned, so increase the num_ifs by one. + ++num_ifs; + + struct IFREQ *ifs = 0; + ACE_NEW_RETURN (ifs, + struct IFREQ[num_ifs], + -1); + ACE_OS::memset (ifs, 0, num_ifs * sizeof (struct IFREQ)); + + ACE_Auto_Array_Ptr p_ifs (ifs); + + if (p_ifs.get() == 0) + { + ACE_OS::close (handle); + errno = ENOMEM; + return -1; + } + + struct IFCONF ifcfg; + ACE_OS::memset (&ifcfg, 0, sizeof (struct IFCONF)); + +# ifdef SETFAMILY + ifcfg.IFC_FAMILY = AF_UNSPEC; // request all families be returned + ifcfg.IFC_FLAGS = 0; +# endif + + ifcfg.IFC_REQ = p_ifs.get (); + ifcfg.IFC_LEN = num_ifs * sizeof (struct IFREQ); + + if (ACE_OS::ioctl (handle, + SIOCGIFCONF_CMD, + (caddr_t) &ifcfg) == -1) + { + ACE_OS::close (handle); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::get_ip_interfaces:") + ACE_TEXT ("ioctl - SIOCGIFCONF failed")), + -1); + } + + ACE_OS::close (handle); + + // Now create and initialize output array. + + ACE_NEW_RETURN (addrs, + ACE_INET_Addr[num_ifs], + -1); // caller must free + + struct IFREQ *pcur = p_ifs.get (); + size_t num_ifs_found = ifcfg.IFC_LEN / sizeof (struct IFREQ); // get the number of returned ifs + + // Pull the address out of each INET interface. Not every interface + // is for IP, so be careful to count properly. When setting the + // INET_Addr, note that the 3rd arg (0) says to leave the byte order + // (already in net byte order from the interface structure) as is. + count = 0; + + for (size_t i = 0; + i < num_ifs_found; + i++) + { + if (pcur->IFR_ADDR.SA_FAMILY == AF_INET +# if defined (ACE_HAS_IPV6) + || pcur->IFR_ADDR.SA_FAMILY == AF_INET6 +# endif + ) + + { +# if !defined(_UNICOS) + struct sockaddr_in *addr = + reinterpret_cast (&pcur->IFR_ADDR); + + // Sometimes the kernel returns 0.0.0.0 as an IPv4 interface + // address; skip those... + if (addr->sin_addr.s_addr != 0 +# if defined (ACE_HAS_IPV6) + || (addr->sin_family == AF_INET6 && + !IN6_IS_ADDR_UNSPECIFIED(&reinterpret_cast(addr)->sin6_addr)) +# endif + ) + { + int addrlen = static_cast (sizeof (struct sockaddr_in)); +# if defined (ACE_HAS_IPV6) + if (addr->sin_family == AF_INET6) + addrlen = static_cast (sizeof (struct sockaddr_in6)); +# endif + addrs[count].set (addr, addrlen); + ++count; + } +# else /* ! _UNICOS */ + // need to explicitly copy on the Cray, since the bitfields kinda + // screw things up here + struct sockaddr_in inAddr; + + inAddr.sin_len = pcur->IFR_ADDR.sa_len; + inAddr.sin_family = pcur->IFR_ADDR.sa_family; + memcpy((void *)&(inAddr.sin_addr), + (const void *)&(pcur->IFR_ADDR.sa_data[8]), + sizeof(struct in_addr)); + + if (inAddr.sin_addr.s_addr != 0) + { + addrs[count].set(&inAddr, sizeof(struct sockaddr_in)); + ++count; + } +# endif /* ! _UNICOS */ + } + +#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__) + ++pcur; +#else + if (pcur->ifr_addr.sa_len <= sizeof (struct sockaddr)) + { + ++pcur; + } + else + { + pcur = (struct ifreq *) + (pcur->ifr_addr.sa_len + (caddr_t) &pcur->ifr_addr); + } +#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__) */ + } + +# if defined (ACE_HAS_IPV6) + // Retrieve IPv6 local interfaces by scanning /proc/net/if_inet6 if + // it exists. If we cannot open it then ignore possible IPv6 + // interfaces, we did our best;-) + FILE* fp = 0; + char addr_p[8][5]; + char s_ipaddr[64]; + int scopeid; + struct addrinfo hints, *res0; + int error; + + ACE_OS::memset (&hints, 0, sizeof (hints)); + hints.ai_flags = AI_NUMERICHOST; + hints.ai_family = AF_INET6; + + if ((fp = ACE_OS::fopen (ACE_TEXT ("/proc/net/if_inet6"), ACE_TEXT ("r"))) != 0) + { + while (fscanf (fp, + "%4s%4s%4s%4s%4s%4s%4s%4s %02x %*02x %*02x %*02x %*8s\n", + addr_p[0], addr_p[1], addr_p[2], addr_p[3], + addr_p[4], addr_p[5], addr_p[6], addr_p[7], &scopeid) != EOF) + { + // Format the address intoa proper IPv6 decimal address specification and + // resolve the resulting text using getaddrinfo(). + + const char* ip_fmt = "%s:%s:%s:%s:%s:%s:%s:%s%%%d"; + ACE_OS::sprintf (s_ipaddr, + ip_fmt, + addr_p[0], addr_p[1], addr_p[2], addr_p[3], + addr_p[4], addr_p[5], addr_p[6], addr_p[7], scopeid); + + error = getaddrinfo (s_ipaddr, 0, &hints, &res0); + if (error) + continue; + + if (res0->ai_family == AF_INET6 && + !IN6_IS_ADDR_UNSPECIFIED (&reinterpret_cast (res0->ai_addr)->sin6_addr)) + { + addrs[count].set(reinterpret_cast (res0->ai_addr), res0->ai_addrlen); + ++count; + } + freeaddrinfo (res0); + + } + ACE_OS::fclose (fp); + } +# endif /* ACE_HAS_IPV6 */ + + return 0; +#else + ACE_UNUSED_ARG (count); + ACE_UNUSED_ARG (addrs); + ACE_NOTSUP_RETURN (-1); // no implementation +#endif /* ACE_WIN32 */ +} + +// Helper routine for get_ip_interfaces, differs by UNIX platform so +// put into own subroutine. perform some ioctls to retrieve ifconf +// list of ifreq structs. + +int +ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many) +{ +#if defined (SIOCGIFNUM) +# if defined (SIOCGLIFNUM) && !defined (ACE_LACKS_STRUCT_LIFNUM) + int cmd = SIOCGLIFNUM; + struct lifnum if_num = {AF_UNSPEC,0,0}; +# else + int cmd = SIOCGIFNUM; + int if_num = 0; +# endif /* SIOCGLIFNUM */ + if (ACE_OS::ioctl (handle, cmd, (caddr_t)&if_num) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::count_interfaces:") + ACE_TEXT ("ioctl - SIOCGLIFNUM failed")), + -1); +# if defined (SIOCGLIFNUM) && !defined (ACE_LACKS_STRUCT_LIFNUM) + how_many = if_num.lifn_count; +# else + how_many = if_num; +# endif /* SIOCGLIFNUM */ +return 0; + +#elif (defined (__unix) || defined (__unix__) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS) || (defined (ACE_VXWORKS) && !defined (ACE_HAS_GETIFADDRS))) && !defined (ACE_LACKS_NETWORKING) + // Note: DEC CXX doesn't define "unix". BSD compatible OS: HP UX, + // AIX, SunOS 4.x perform some ioctls to retrieve ifconf list of + // ifreq structs no SIOCGIFNUM on SunOS 4.x, so use guess and scan + // algorithm + + // Probably hard to put this many ifs in a unix box.. + int const MAX_IF = 50; + + // HACK - set to an unreasonable number + int const num_ifs = MAX_IF; + + struct ifconf ifcfg; + size_t ifreq_size = num_ifs * sizeof (struct ifreq); + struct ifreq *p_ifs = (struct ifreq *) ACE_OS::malloc (ifreq_size); + + if (!p_ifs) + { + errno = ENOMEM; + return -1; + } + + ACE_OS::memset (p_ifs, 0, ifreq_size); + ACE_OS::memset (&ifcfg, 0, sizeof (struct ifconf)); + + ifcfg.ifc_req = p_ifs; + ifcfg.ifc_len = ifreq_size; + + if (ACE_OS::ioctl (handle, + SIOCGIFCONF_CMD, + (caddr_t) &ifcfg) == -1) + { + ACE_OS::free (ifcfg.ifc_req); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE::count_interfaces:") + ACE_TEXT ("ioctl - SIOCGIFCONF failed")), + -1); + } + + int if_count = 0; + int i = 0; + + // get if address out of ifreq buffers. ioctl puts a blank-named + // interface to mark the end of the returned interfaces. + for (i = 0; + i < num_ifs; + i++) + { + /* In OpenBSD, the length of the list is returned. */ + ifcfg.ifc_len -= sizeof (struct ifreq); + if (ifcfg.ifc_len < 0) + break; + + ++if_count; +#if !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__) + ++p_ifs; +#else + if (p_ifs->ifr_addr.sa_len <= sizeof (struct sockaddr)) + { + ++p_ifs; + } + else + { + p_ifs = (struct ifreq *) + (p_ifs->ifr_addr.sa_len + (caddr_t) &p_ifs->ifr_addr); + } +#endif /* !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) && !defined (ACE_HAS_RTEMS) && !defined (__Lynx__)*/ + } + + ACE_OS::free (ifcfg.ifc_req); + +# if defined (ACE_HAS_IPV6) + FILE* fp = 0; + + if ((fp = ACE_OS::fopen (ACE_TEXT ("/proc/net/if_inet6"), ACE_TEXT ("r"))) != 0) + { + // Scan the lines according to the expected format but don't really read any input + while (fscanf (fp, "%*32s %*02x %*02x %*02x %*02x %*8s\n") != EOF) + { + ++if_count; + } + ACE_OS::fclose (fp); + } +# endif /* ACE_HAS_IPV6 */ + + how_many = if_count; + return 0; +#else + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (how_many); + ACE_NOTSUP_RETURN (-1); // no implementation +#endif /* sparc && SIOCGIFNUM */ +} + +// Routine to return a handle from which ioctl() requests can be made. + +ACE_HANDLE +ACE::get_handle (void) +{ + // Solaris 2.x + ACE_HANDLE handle = ACE_INVALID_HANDLE; +#if defined (sparc) + handle = ACE_OS::open ("/dev/udp", O_RDONLY); +#elif defined (__unix) || defined (__unix__) || defined (_AIX) || defined (__hpux) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) || defined (ACE_OPENVMS) || defined (ACE_HAS_RTEMS) + // Note: DEC CXX doesn't define "unix" BSD compatible OS: HP UX, + // AIX, SunOS 4.x + + handle = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0); +#endif /* sparc */ + return handle; +} + + +#if defined (ACE_HAS_IPV6) +static int +ip_check (int &ipvn_enabled, int pf) +{ + // We only get to this point if ipvn_enabled was -1 in the caller. + // Perform Double-Checked Locking Optimization. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + + if (ipvn_enabled == -1) + { + // Determine if the kernel has IPv6 support by attempting to + // create a PF_INET socket and see if it fails. + ACE_HANDLE const s = ACE_OS::socket (pf, SOCK_DGRAM, 0); + if (s == ACE_INVALID_HANDLE) + { + ipvn_enabled = 0; + } + else + { + ipvn_enabled = 1; + ACE_OS::closesocket (s); + } + } + return ipvn_enabled; +} +#endif /* ACE_HAS_IPV6 */ + +bool +ACE::ipv4_enabled (void) +{ +#if defined (ACE_HAS_IPV6) + return static_cast (ace_ipv4_enabled == -1 ? + ::ip_check (ace_ipv4_enabled, PF_INET) : + ace_ipv4_enabled); +#else + // Assume it's always enabled since ACE requires some version of + // TCP/IP to exist. + return true; +#endif /* ACE_HAS_IPV6*/ +} + +int +ACE::ipv6_enabled (void) +{ +#if defined (ACE_HAS_IPV6) + return ace_ipv6_enabled == -1 ? + ::ip_check (ace_ipv6_enabled, PF_INET6) : + ace_ipv6_enabled; +#else /* ACE_HAS_IPV6 */ + return 0; +#endif /* !ACE_HAS_IPV6 */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Sock_Connect.h b/externals/ace/Sock_Connect.h new file mode 100644 index 0000000..d6a72c7 --- /dev/null +++ b/externals/ace/Sock_Connect.h @@ -0,0 +1,107 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Sock_Connect.h + * + * $Id: Sock_Connect.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Priyanka Gontla + * @author Based on code that existed formerly in ACE.h. + */ +//========================================================================== + +#ifndef ACE_SOCK_CONNECT_H +#define ACE_SOCK_CONNECT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Basic_Types.h" +#include "ace/os_include/netinet/os_in.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward Declarations +class ACE_INET_Addr; + +namespace ACE +{ + // = Socket connection establishment calls. + + /// Bind a new unused port to @a handle. + extern ACE_Export int bind_port (ACE_HANDLE handle, + ACE_UINT32 ip_addr = INADDR_ANY, + int address_family = AF_UNSPEC); + + /** + * Get our broadcast address based on our @a host_addr. If + * @a hostname is non-0 we'll use it to determine our IP address. If + * @a handle is not ACE_INVALID_HANDLE then we'll use this to + * determine our broadcast address, otherwise we'll have to create a + * socket internally (and free it). Returns -1 on failure and 0 on + * success. + */ + extern ACE_Export int get_bcast_addr ( + ACE_UINT32 &bcast_addr, + const ACE_TCHAR *hostname = 0, + ACE_UINT32 host_addr = 0, + ACE_HANDLE handle = ACE_INVALID_HANDLE); + + /// Get fully qualified host/domain name. + extern ACE_Export int get_fqdn (ACE_INET_Addr const & addr, + char hostname[], + size_t len); + + /** + * Return count and array of all configured IP interfaces on this + * host, rc = 0 on success (count == number of interfaces else -1). + * Caller is responsible for calling delete [] on @a addr_array. + */ + extern ACE_Export int get_ip_interfaces (size_t &count, + ACE_INET_Addr *&addr_array); + + /** + * Helper routine for get_ip_interfaces, differs by UNIX platform so + * put into own subroutine. perform some ioctls to retrieve ifconf + * list of ifreq structs. + */ + extern ACE_Export int count_interfaces (ACE_HANDLE handle, + size_t &how_many); + + /// Routine to return a handle from which @c ioctl requests can be + /// made. Caller must close the handle. + extern ACE_Export ACE_HANDLE get_handle (void); + + /// Returns @c true if IPv4 is enabled on the current host; @c false + /// if not. + /** + * This is an execution-time check. If ACE has not been compiled + * with @c ACE_HAS_IPV6, it always returns @c true. This function + * tries to create a @c PF_INET socket, returning @c true if it + * succeeds, and @c false if it fails. Caches the result so it only + gets checked once. + */ + extern ACE_Export bool ipv4_enabled (void); + + /** + * Returns 1 if IPv6 is enabled on the current host; 0 if not. + * This is an execution-time check. If ACE has not been compiled + * with ACE_HAS_IPV6, it always returns 0. If ACE_HAS_IPV6 is + * enabled, this function tries to create a PF_INET6 socket, + * returning 1 if it succeeds, and 0 if it fails. Caches the result + * so it only gets checked once. + */ + extern ACE_Export int ipv6_enabled (void); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_SOCK_CONNECT_H */ diff --git a/externals/ace/Stack_Trace.cpp b/externals/ace/Stack_Trace.cpp new file mode 100644 index 0000000..3beb1c5 --- /dev/null +++ b/externals/ace/Stack_Trace.cpp @@ -0,0 +1,723 @@ +//============================================================================= +/** + * @file Stack_Trace.cpp + * + * $Id: Stack_Trace.cpp 90041 2010-04-29 03:38:07Z cleeland $ + * + * @brief Encapsulate string representation of stack trace. + * + * Some platform-specific areas of this code have been adapted from + * examples found elsewhere. Specifically, + * - the GLIBC stack generation uses the documented "backtrace" API + * and is adapted from examples shown in relevant documentation + * and repeated elsewhere, e.g., + * http://www.linuxselfhelp.com/gnu/glibc/html_chapter/libc_33.html + * - the Solaris stack generation is adapted from a 1995 post on + * comp.unix.solaris by Bart Smaalders, + * http://groups.google.com/group/comp.unix.solaris/browse_thread/thread/8b9f3de8be288f1c/31550f93a48231d5?lnk=gst&q=how+to+get+stack+trace+on+solaris+group:comp.unix.solaris#31550f93a48231d5 + * - VxWorks kernel-mode stack tracing is adapted from a code example + * in the VxWorks FAQ at http://www.xs4all.nl/~borkhuis/vxworks/vxw_pt5.html + * although the undocumented functions it uses are also mentioned in + * various documents available on the WindRiver support website. + * + * If you add support for a new platform, please add a bullet to the + * above list with durable references to the origins of your code. + * + */ +//============================================================================= + +#include "ace/Stack_Trace.h" +#include "ace/Min_Max.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_stdio.h" + +ACE_RCSID (ace, Stack_Trace, "$Id: Stack_Trace.cpp 90041 2010-04-29 03:38:07Z cleeland $") + +/* + This is ugly, simply because it's very platform-specific. +*/ + +const char ACE_Stack_Trace::UNSUPPORTED[] = ""; +const char ACE_Stack_Trace::UNABLE_TO_GET_TRACE[] = ""; + +ACE_Stack_Trace::ACE_Stack_Trace (ssize_t starting_frame_offset, size_t num_frames) + : buflen_(0) +{ + // cannot initialize arrays, so we must assign. + this->buf_[0] = '\0'; + this->generate_trace (starting_frame_offset, num_frames); +} + +const char* +ACE_Stack_Trace::c_str () const +{ + return &this->buf_[0]; +} + +static inline size_t +determine_starting_frame (ssize_t initial_frame, ssize_t offset) +{ + return ACE_MAX( initial_frame + offset, static_cast(0)); +} + +#if (defined(__GLIBC__) || defined(ACE_HAS_EXECINFO_H)) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) +// This is the code for glibc +# include + +void +ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, size_t num_frames) +{ + const size_t MAX_FRAMES = 128; + const ssize_t INITIAL_FRAME = 3; + + void* stack[MAX_FRAMES]; + size_t stack_size = 0; + char** stack_syms; + + if (num_frames == 0) + num_frames = MAX_FRAMES; + + size_t starting_frame = + determine_starting_frame (INITIAL_FRAME, starting_frame_offset); + + stack_size = ::backtrace (&stack[0], sizeof(stack)/sizeof(stack[0])); + if (stack_size != 0) + { + stack_syms = ::backtrace_symbols (stack, stack_size); + + for (size_t i = starting_frame; + i < stack_size && num_frames > 0; + i++, num_frames--) + { + // this could be more efficient by remembering where we left off in buf_ + char *symp = &stack_syms[i][0]; + while (this->buflen_ < SYMBUFSIZ - 2 && *symp != '\0') + { + this->buf_[this->buflen_++] = *symp++; + } + this->buf_[this->buflen_++] = '\n'; // put a newline at the end + } + this->buf_[this->buflen_] = '\0'; // zero terminate the string + + ::free (stack_syms); + } + else + { + ACE_OS::strcpy (&this->buf_[0], UNABLE_TO_GET_TRACE); + } +} +#elif defined(VXWORKS) && !defined(__RTP__) +# include +# include // hopefully this is enough to get all the necessary #defines. + +struct ACE_Stack_Trace_stackstate +{ + ACE_Stack_Trace_stackstate (char* b, size_t& bl, size_t nf, size_t sf) + : buf(b), buflen(bl), num_frames(nf), starting_frame(sf) + { } + + char* buf; + size_t& buflen; + size_t num_frames; + size_t starting_frame; +}; + +//@TODO: Replace with a TSS-based pointer to avoid problems in multithreaded environs, +// or use a mutex to serialize access to this. +static ACE_Stack_Trace_stackstate* ACE_Stack_Trace_stateptr = 0; + +static void +ACE_Stack_Trace_Add_Frame_To_Buf (INSTR *caller, + unsigned int func, + unsigned int nargs, + unsigned int *args) +{ + if (ACE_Stack_Trace_stateptr == 0) + return; + + ACE_Stack_Trace_stackstate *stackstate = ACE_Stack_Trace_stateptr; + + // Decrement the num_frames and starting_frame elements, + // then see if we're ready to start or ready to finish. + --stackstate->num_frames; + --stackstate->starting_frame; + + if (stackstate->num_frames == 0 || stackstate->starting_frame > 0) + return; + + // These are references so that the structure gets updated + // in the code below. + char*& buf = stackstate->buf; + unsigned int& len = stackstate->buflen; + + // At some point try using symFindByValue() to lookup func (and caller?) + // to print out symbols rather than simply addresses. + + // VxWorks can pass -1 for "nargs" if there was an error + if (nargs == static_cast (-1)) nargs = 0; + + len += ACE_OS::sprintf (&buf[len], "%#10x: %#10x (", (int)caller, func); + for (unsigned int i = 0; i < nargs; ++i) + { + if (i != 0) + len += ACE_OS::sprintf (&buf[len], ", "); + len += ACE_OS::sprintf(&buf [len], "%#x", args [i]); + } + + len += ACE_OS::sprintf(&buf[len], ")\n"); +} + +void +ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, + size_t num_frames) +{ + const size_t MAX_FRAMES = 128; + const ssize_t INITIAL_FRAME = 3; + + if (num_frames == 0) + num_frames = MAX_FRAMES; + + size_t starting_frame = + determine_starting_frame (INITIAL_FRAME, starting_frame_offset); + + ACE_Stack_Trace_stackstate state (&this->buf_[0], this->buflen_, + num_frames, starting_frame); + + REG_SET regs; + + taskRegsGet ((int)taskIdSelf(), ®s); + // Maybe we should take a lock here to guard stateptr? + ACE_Stack_Trace_stateptr = &state; + trcStack (®s, (FUNCPTR)ACE_Stack_Trace_Add_Frame_To_Buf, taskIdSelf ()); +} + + +#elif defined(VXWORKS) && defined(__RTP__) +# include +# include +# include + +// See memEdrLib.c in VxWorks RTP sources for an example of stack tracing. + +static STATUS ace_vx_rtp_pc_validate (INSTR *pc, TRC_OS_CTX *pOsCtx) +{ + return ALIGNED (pc, sizeof (INSTR)) ? OK : ERROR; +} + +void +ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, + size_t num_frames) +{ + const size_t MAX_FRAMES = 128; + const ssize_t INITIAL_FRAME = 2; + + if (num_frames == 0) num_frames = MAX_FRAMES; + size_t starting_frame = + determine_starting_frame (INITIAL_FRAME, starting_frame_offset); + + jmp_buf regs; + setjmp (regs); + + TASK_DESC desc; + if (taskInfoGet (taskIdSelf (), &desc) == ERROR) return; + + TRC_OS_CTX osCtx; + osCtx.stackBase = desc.td_pStackBase; + osCtx.stackEnd = desc.td_pStackEnd; + osCtx.pcValidateRtn = reinterpret_cast (ace_vx_rtp_pc_validate); + + char *fp = _WRS_FRAMEP_FROM_JMP_BUF (regs); + INSTR *pc = _WRS_RET_PC_FROM_JMP_BUF (regs); + + for (size_t depth = 0; depth < num_frames + starting_frame; ++depth) + { + char *prevFp; + INSTR *prevPc; + INSTR *prevFn; + + if (trcLibFuncs.lvlInfoGet (fp, pc, &osCtx, &prevFp, &prevPc, &prevFn) + == ERROR) + { + ACE_OS::strcpy (this->buf_, UNABLE_TO_GET_TRACE); + return; + } + + if(prevPc == 0 || prevFp == 0) break; + + if (depth >= starting_frame) + { + //Hopefully a future version of VxWorks will have a system call + //for an RTP to query its own symbols, but this is not possible now. + //An enhancement request has been filed under WIND00123307. + const char *fnName = "(no symbols)"; + + static const int N_ARGS = 12; + int buf[N_ARGS]; + int *pArgs = 0; + int numArgs = + trcLibFuncs.lvlArgsGet (prevPc, prevFn, prevFp, + buf, N_ARGS, &pArgs); + + // VxWorks can return -1 for "numArgs" if there was an error + if (numArgs == -1) numArgs = 0; + + size_t len = ACE_OS::strlen (this->buf_); + size_t space = SYMBUFSIZ - len - 1; + char *cursor = this->buf_ + len; + size_t written = ACE_OS::snprintf (cursor, space, "%x %s", + prevFn, fnName); + cursor += written; + space -= written; + + if (space < 1) return; //no point in logging when we're out of buffer + for (int arg = 0; numArgs != -1 && pArgs && arg < numArgs; ++arg) + { + if (arg == 0) *cursor++ = '(', --space; + written = ACE_OS::snprintf (cursor, space, + (arg < numArgs - 1) ? "%x, " : "%x", + pArgs[arg]); + cursor += written; + space -= written; + if (space && arg == numArgs - 1) *cursor++ = ')', --space; + } + if (space) *cursor++ = '\n', --space; + *cursor++ = 0; //we saved space for the null terminator + } + + fp = prevFp; + pc = prevPc; + } +} + +#elif defined(sun) +/* + * walks up call stack, printing library:routine+offset for each routine + */ + +# include +# include +# include +# include +# include +# define ACE_STACK_TRACE_BIAS 0 + +# if defined(sparc) || defined(__sparc) +# define ACE_STACK_TRACE_FLUSHWIN() asm("ta 3"); +# define ACE_STACK_TRACE_FRAME_PTR_INDEX 1 +# define ACE_STACK_TRACE_SKIP_FRAMES 0 +# if defined(__sparcv9) +# undef ACE_STACK_TRACE_BIAS +# define ACE_STACK_TRACE_BIAS 2047 +# endif +# endif + +# if defined(i386) || defined(__i386) +# define ACE_STACK_TRACE_FLUSHWIN() +# define ACE_STACK_TRACE_FRAME_PTR_INDEX 3 +# define ACE_STACK_TRACE_SKIP_FRAMES 0 +# endif + +# if defined(__amd64) || defined(__x86_64) +# define ACE_STACK_TRACE_FLUSHWIN() +# define ACE_STACK_TRACE_FRAME_PTR_INDEX 5 +# define ACE_STACK_TRACE_SKIP_FRAMES 0 +# endif + +# if defined(ppc) || defined(__ppc) +# define ACE_STACK_TRACE_FLUSHWIN() +# define ACE_STACK_TRACE_FRAME_PTR_INDEX 0 +# define ACE_STACK_TRACE_SKIP_FRAMES 2 +# endif + +static frame* +cs_frame_adjust(frame* sp) +{ + unsigned char* sp_byte = (unsigned char*)sp; + sp_byte += ACE_STACK_TRACE_BIAS; + return (frame*) sp_byte; +} + +/* + this function walks up call stack, calling user-supplied + function once for each stack frame, passing the pc and the user-supplied + usrarg as the argument. + */ + +static int +cs_operate(int (*func)(void *, void *), void * usrarg, + size_t starting_frame, size_t num_frames_arg) +{ + ACE_STACK_TRACE_FLUSHWIN(); + + jmp_buf env; + setjmp(env); + frame* sp = cs_frame_adjust((frame*) env[ACE_STACK_TRACE_FRAME_PTR_INDEX]); + + // make a copy of num_frames_arg to eliminate the following warning on some + // solaris platforms: + // Stack_Trace.cpp:318: warning: argument `size_t num_frames' might be clobbered by `longjmp' or `vfork' + size_t num_frames = num_frames_arg; + + // I would like to use ACE_MAX below rather than ?:, but + // I get linker relocation errors such as the following when + // I use it: + // ld: fatal: relocation error: file: .shobj/Stack_Trace.o section: + // .rela.debug_line symbol: : relocation against a discarded symbol, + // symbol is part of discarded section: + // .text%const __type_0&ace_max(const __type_0&,const __type_0&) + // + const size_t starting_skip = starting_frame - 1; +#if ACE_STACK_TRACE_SKIP_FRAMES == 0 + size_t skip_frames = starting_skip; +#else + size_t skip_frames = + ACE_STACK_TRACE_SKIP_FRAMES > starting_skip ? + ACE_STACK_TRACE_SKIP_FRAMES : starting_skip; +#endif /* ACE_STACK_TRACE_SKIP_FRAMES == 0 */ + size_t i; + for (i = 0; i < skip_frames && sp; ++i) + { + sp = cs_frame_adjust((frame*) sp->fr_savfp); + } + + i = 0; + + while ( sp + && sp->fr_savpc + && ++i + && --num_frames + && (*func)((void*)sp->fr_savpc, usrarg)) + { + sp = cs_frame_adjust((frame*) sp->fr_savfp); + } + + return(i); +} + +static int +add_frame_to_buf (void* pc, void* usrarg) +{ + char* buf = (char*)usrarg; + Dl_info info; + const char* func = "??"; + const char* lib = "??"; + + if(dladdr(pc, & info) != 0) + { + lib = (const char *) info.dli_fname; + func = (const char *) info.dli_sname; + } + + (void) ACE_OS::snprintf(buf, + ACE_Stack_Trace::SYMBUFSIZ, + "%s%s:%s+0x%x\n", + buf, + lib, + func, + //@@ Should the arithmetic on the following + //line be done with two void* ptrs? The result + //would be ptrdiff_t, and what is the correct + //sprintf() conversion character for that? + (size_t)pc - (size_t)info.dli_saddr); + + return(1); +} + +void +ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, + size_t num_frames) +{ + const size_t MAX_FRAMES = 128; + const ssize_t INITIAL_FRAME = 3; + + if (num_frames == 0) + num_frames = MAX_FRAMES; + + size_t starting_frame = + determine_starting_frame (INITIAL_FRAME, starting_frame_offset); + + cs_operate (&add_frame_to_buf, &this->buf_[0], starting_frame, num_frames); +} + +#elif defined(ACE_WIN64) && (_WIN32_WINNT <= _WIN32_WINNT_WIN2K) +# if defined(_MSC_VER) +# define STRING2(X) #X +# define STRING(X) STRING2(X) +# pragma message (__FILE__ "(" STRING(__LINE__) ") : warning: stack traces"\ + " can't be generated on 64-bit Windows when _WIN32_WINNT is less than "\ + "0x501.") +# undef STRING +# undef STRING2 +# endif /*_MSC_VER*/ +void +ACE_Stack_Trace::generate_trace (ssize_t, size_t) +{ + ACE_OS::strcpy (&this->buf_[0], ""); +} + +#elif defined(ACE_WIN32) && !defined(ACE_HAS_WINCE) && !defined (__MINGW32__) \ + && !defined(__BORLANDC__) +# include +# include + +# define MAXTEXT 5000 +# define SYMSIZE 100 + +//@TODO: Test with WCHAR +//@TODO: Need a common CriticalSection since dbghelp is not thread-safe + +typedef struct _dbghelp_functions +{ + HMODULE hMod; //our handle to dbghelp.dll + + //these already have typedefs in DbgHelp.h + DWORD64 (WINAPI *SymGetModuleBase64) (HANDLE hProc, DWORD64 dwAddr); + PVOID (WINAPI *SymFunctionTableAccess64) (HANDLE hProc, DWORD64 AddrBase); + + typedef BOOL (WINAPI *SymFromAddr_t) + (HANDLE hProc, DWORD64 Addr, PDWORD64 Disp, PSYMBOL_INFO Symbol); + SymFromAddr_t SymFromAddr; + + typedef BOOL (WINAPI *SymGetLineFromAddr64_t) (HANDLE hProc, DWORD64 dwAddr, + PDWORD pdwDisplacement, + PIMAGEHLP_LINE64 Line); + SymGetLineFromAddr64_t SymGetLineFromAddr64; + + typedef DWORD (WINAPI *SymSetOptions_t) (DWORD SymOptions); + SymSetOptions_t SymSetOptions; + + typedef DWORD (WINAPI *SymGetOptions_t) (); + SymGetOptions_t SymGetOptions; + + typedef BOOL (WINAPI *SymInitialize_t) (HANDLE hProc, PCTSTR UserSearchPath, + BOOL invasive); + SymInitialize_t SymInitialize; + + typedef BOOL + (WINAPI *StackWalk64_t) (DWORD MachineType, HANDLE hPRoc, HANDLE hThr, + LPSTACKFRAME64 StackFrame, PVOID ContextRecord, + PREAD_PROCESS_MEMORY_ROUTINE64 RMRoutine, + PFUNCTION_TABLE_ACCESS_ROUTINE64 FTARoutine, + PGET_MODULE_BASE_ROUTINE64 GMBRoutine, + PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); + StackWalk64_t StackWalk64; + + typedef BOOL (WINAPI *SymCleanup_t) (HANDLE hProc); + SymCleanup_t SymCleanup; +} dbghelp_functions; + + +# pragma warning (push) +# pragma warning (disable:4706) +static bool load_dbghelp_library_if_needed (dbghelp_functions *pDbg) +{ + //@TODO: See codeproject's StackWalker.cpp for the list of locations to + //search so we get the "enhanced" dbghelp if the user has it but it is not + //first on the path. + if (!(pDbg->hMod = ACE_TEXT_LoadLibrary (ACE_TEXT ("Dbghelp")))) + return false; + + //@TODO: Cache this so we don't have to re-link every time. When to unload? + +# define LINK(TYPE, NAME) (pDbg->NAME = \ + (TYPE) GetProcAddress (pDbg->hMod, #NAME)) +# define LINK_T(NAME) LINK (dbghelp_functions::NAME##_t, NAME) + return LINK (PGET_MODULE_BASE_ROUTINE64, SymGetModuleBase64) + && LINK (PFUNCTION_TABLE_ACCESS_ROUTINE64, SymFunctionTableAccess64) + && LINK_T (SymFromAddr) && LINK_T (SymGetLineFromAddr64) + && LINK_T (SymSetOptions)&& LINK_T (SymGetOptions) + && LINK_T (SymInitialize) && LINK_T (StackWalk64) && LINK_T (SymCleanup); +# undef LINK +# undef LINK_T +} +# pragma warning (pop) + + +struct frame_state { + STACKFRAME64 sf; + PSYMBOL_INFO pSym; + dbghelp_functions *pDbg; +}; + +static int +add_frame_to_buf (struct frame_state const *fs, void *usrarg) +{ + if (fs == 0 || usrarg == 0) + return -1; + + char *buf = static_cast (usrarg); + + DWORD64 disp; + DWORD64 dwModBase = fs->pDbg->SymGetModuleBase64 (GetCurrentProcess (), + fs->sf.AddrPC.Offset); + if (fs->pDbg->SymFromAddr (GetCurrentProcess (), + fs->sf.AddrPC.Offset, &disp, fs->pSym)) + { + IMAGEHLP_LINE64 line = {sizeof (IMAGEHLP_LINE64)}; + DWORD lineDisp; + if (fs->pDbg->SymGetLineFromAddr64 (GetCurrentProcess (), + fs->sf.AddrPC.Offset, + &lineDisp, &line)) + { + (void) ACE_OS::snprintf (buf, ACE_Stack_Trace::SYMBUFSIZ, + "%s%s() %s: %d + 0x%x\n", + buf, fs->pSym->Name, line.FileName, + line.LineNumber, lineDisp); + } + else + { + (void) ACE_OS::snprintf (buf, ACE_Stack_Trace::SYMBUFSIZ, + "%s%s()+0x%x [0x%x]\n", + buf, fs->pSym->Name, disp, + fs->sf.AddrPC.Offset - dwModBase); + } + } + else + { + (void) ACE_OS::snprintf (buf, ACE_Stack_Trace::SYMBUFSIZ, + "%s[0x%x]\n", + buf, fs->sf.AddrPC.Offset - dwModBase); + } + return 0; +} + +static void emptyStack () { } + +#if defined (_MSC_VER) +# pragma warning(push) +// Suppress warning 4748 "/GS can not protect parameters and local +// variables from local buffer overrun because optimizations are +// disabled in function" +# pragma warning(disable: 4748) +#endif /* _MSC_VER */ + +static int +cs_operate(int (*func)(struct frame_state const *, void *), void *usrarg, + size_t starting_frame, size_t num_frames) +{ + dbghelp_functions dbg; + if (!load_dbghelp_library_if_needed (&dbg)) + { + ACE_OS::strcpy (static_cast (usrarg), + ""); + if (dbg.hMod) FreeLibrary (dbg.hMod); + return 1; + } + + frame_state fs; + ZeroMemory (&fs.sf, sizeof (fs.sf)); + fs.pDbg = &dbg; + emptyStack (); //Not sure what this should do, Chad? + + CONTEXT c; + ZeroMemory (&c, sizeof (CONTEXT)); + c.ContextFlags = CONTEXT_FULL; + +# if defined (_M_IX86) + DWORD machine = IMAGE_FILE_MACHINE_I386; + __asm { + call x + x: pop eax + mov c.Eip, eax + mov c.Ebp, ebp + mov c.Esp, esp + } + fs.sf.AddrPC.Offset = c.Eip; + fs.sf.AddrStack.Offset = c.Esp; + fs.sf.AddrFrame.Offset = c.Ebp; + fs.sf.AddrPC.Mode = AddrModeFlat; + fs.sf.AddrStack.Mode = AddrModeFlat; + fs.sf.AddrFrame.Mode = AddrModeFlat; +# elif defined (_M_X64) + DWORD machine = IMAGE_FILE_MACHINE_AMD64; + RtlCaptureContext (&c); + fs.sf.AddrPC.Offset = c.Rip; + fs.sf.AddrFrame.Offset = c.Rsp; //should be Rbp or Rdi instead? + fs.sf.AddrStack.Offset = c.Rsp; + fs.sf.AddrPC.Mode = AddrModeFlat; + fs.sf.AddrFrame.Mode = AddrModeFlat; + fs.sf.AddrStack.Mode = AddrModeFlat; +# elif defined (_M_IA64) + DWORD machine = IMAGE_FILE_MACHINE_IA64; + RtlCaptureContext (&c); + fs.sf.AddrPC.Offset = c.StIIP; + fs.sf.AddrFrame.Offset = c.RsBSP; + fs.sf.AddrBStore.Offset = c.RsBSP; + fs.sf.AddrStack.Offset = c.IntSp; + fs.sf.AddrPC.Mode = AddrModeFlat; + fs.sf.AddrFrame.Mode = AddrModeFlat; + fs.sf.AddrBStore.Mode = AddrModeFlat; + fs.sf.AddrStack.Mode = AddrModeFlat; +# endif + + fs.pSym = (PSYMBOL_INFO) GlobalAlloc (GMEM_FIXED, + sizeof (SYMBOL_INFO) + + sizeof (ACE_TCHAR) * (SYMSIZE - 1)); + fs.pSym->SizeOfStruct = sizeof (SYMBOL_INFO); + fs.pSym->MaxNameLen = SYMSIZE * sizeof (ACE_TCHAR); + dbg.SymSetOptions (SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES + | SYMOPT_FAIL_CRITICAL_ERRORS | dbg.SymGetOptions ()); + dbg.SymInitialize (GetCurrentProcess (), 0, true); + //What does the "true" parameter mean when tracing the current process? + + for (size_t current_frame = 0; current_frame < num_frames + starting_frame; + ++current_frame) + { + BOOL ok = dbg.StackWalk64 (machine, + GetCurrentProcess (), + GetCurrentThread (), + &fs.sf, &c, 0, + dbg.SymFunctionTableAccess64, + dbg.SymGetModuleBase64, 0); + if (!ok || fs.sf.AddrFrame.Offset == 0) + break; + + if (current_frame < starting_frame) + continue; + + func (&fs, usrarg); + } + + dbg.SymCleanup (GetCurrentProcess ()); + GlobalFree (fs.pSym); + FreeLibrary (dbg.hMod); + + return 0; +} + +#if defined (_MSC_VER) +// Restore the warning state to what it was before entry. +# pragma warning(pop) +#endif /* _MSC_VER */ + +void +ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, + size_t num_frames) +{ + const size_t MAX_FRAMES = 128; + const ssize_t INITIAL_FRAME = 3; + + if (num_frames == 0) + num_frames = MAX_FRAMES; + + size_t starting_frame = + determine_starting_frame (INITIAL_FRAME, starting_frame_offset); + + cs_operate (&add_frame_to_buf, &this->buf_[0], starting_frame, num_frames); +} + +#else // Unsupported platform +void +ACE_Stack_Trace::generate_trace (ssize_t, size_t) +{ +// Call determine_starting_frame() on HP aCC build to resolve declared +// method never referenced warning. +#if defined (__HP_aCC) + size_t starting_frame = determine_starting_frame (0, 0); +#endif + + ACE_OS::strcpy (&this->buf_[0], UNSUPPORTED); +} +#endif + diff --git a/externals/ace/Stack_Trace.h b/externals/ace/Stack_Trace.h new file mode 100644 index 0000000..56cf8a0 --- /dev/null +++ b/externals/ace/Stack_Trace.h @@ -0,0 +1,107 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Stack_Trace.h + * + * $Id: Stack_Trace.h 81926 2008-06-12 14:43:09Z mitza $ + * + * @author Chris Cleeland (cleeland.ociweb.com) + */ +//============================================================================= + +#ifndef ACE_STACK_TRACE_H +#define ACE_STACK_TRACE_H + +#include /**/ "ace/pre.h" + +#include "ace/ACE_export.h" +#include "ace/Basic_Types.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +# ifndef ACE_STACK_TRACE_SYMBUFSIZ +# define ACE_STACK_TRACE_SYMBUFSIZ 4096 +# endif + +/** + * @class ACE_Stack_Trace + * + * @brief Encapsulate a string representation of a stack trace on supported platforms. + * Stack traces for code built with optimize=1 (or "Release" configs on Visual + * Studio) may be misleading (missng frames) due to inlining performed by the + * compiler, which is indepenent of the inline=0 / inline=1 build option and + * the __ACE_INLINE__ / ACE_NO_INLINE macros. + * + * A new conversion character, the question mark, was added to ACE_Log_Msg for stack + * trace logging. The %? conversion character was added as a convenience so that users + * need not instantiate an ACE_Stack_Trace instance solely for the purpose of printing + * it in an ACE logging message. The following are functionally equivalent: + * + * \code + * ACE_DEBUG((LM_DEBUG, "%?")); + * + * ACE_Stack_Trace st; + * ACE_DEBUG ((LM_DEBUG, "%s", st.c_str() )); + * \endcode + * + * These usage examples were shown in $ACE_ROOT/tests/Stack_Trace_Test.cpp. + * + * @note The stack trace functionality was currently supported on platforms: + * - Any platform using glibc as its runtime library, or where ACE_HAS_EXECINFO_H is defined + * (this covers Linux and Mac) and gcc version >= 3.3. + * - VxWorks, both kernel and RTP + * - Solaris + * - Windows 32 and 64 bit (Visual C++, excluding WinCE/mobile) + * + * @note Since stack trace buffer size has limitation(@c ACE_STACK_TRACE_SYMBUFSIZ), you will not + * get a complete stack trace if @c ACE_STACK_TRACE_SYMBUFSIZ value is less than actual stack + * trace data length. To get a complete stack trace, you need set @c ACE_STACK_TRACE_SYMBUFSIZ + * with a larger value that is enough for the stack trace data in your @c config.h file + * and rebuild ACE. + * + * @note Using ACE logging mechanism (%?) to log the stack trace also has ACE_MAXLOGMSGLEN size limitation. + * To get a complete stack trace, you could use different output method. Following is an example. + * + * \code + * ACE_Stack_Trace st; + * ACE_OS::printf("at [%s]\n", st.c_str()); + * \endcode + */ +class ACE_Export ACE_Stack_Trace +{ +public: + /** + * @brief Grab a snapshot of the current stack trace and hold it for later use. + * + * @param starting_frame_offset offset into the array of frames to start printing; 0 is the + * platform-specific offset for the first frame, positive numbers give less frames, negative give + * more frames + * @param num_frames the number of stack frames to include (0 indicates platform-specific maximum) + * + */ + explicit ACE_Stack_Trace (ssize_t starting_frame_offset = 0, size_t num_frames = 0); + + /** + * @brief Return buffer as a C-style string. + * @return C-style string with string representation of stack trace. + * @note Lifecycle of string follows lifecycle of ACE_Stack_Trace instance. + */ + const char* c_str() const; + + static const size_t SYMBUFSIZ = ACE_STACK_TRACE_SYMBUFSIZ; + +private: + char buf_[SYMBUFSIZ]; + size_t buflen_; + + static const char UNSUPPORTED[]; + static const char UNABLE_TO_GET_TRACE[]; + + void generate_trace (ssize_t starting_frame_offset, size_t num_frames); +}; + +#include /**/ "ace/post.h" +#endif /* ACE_STACK_TRACE_H */ + diff --git a/externals/ace/Static_Object_Lock.h b/externals/ace/Static_Object_Lock.h new file mode 100644 index 0000000..ad78025 --- /dev/null +++ b/externals/ace/Static_Object_Lock.h @@ -0,0 +1,78 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Static_Object_Lock.h + * + * $Id: Static_Object_Lock.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author David L. Levine + * @author Matthias Kerkhoff + * @author Per Andersson + */ +//============================================================================= + +#ifndef ACE_STATIC_OBJECT_LOCK_H +#define ACE_STATIC_OBJECT_LOCK_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Recursive_Thread_Mutex; + +/** + * @class ACE_Static_Object_Lock + * + * @brief Provide an interface to access a global lock. + * + * This class is used to serialize the creation of static + * singleton objects. It really isn't needed any more, because + * anyone can access ACE_STATIC_OBJECT_LOCK directly. But, it + * is retained for backward compatibility. + */ +class ACE_Export ACE_Static_Object_Lock +{ +public: + /// Static lock access point. + static ACE_Recursive_Thread_Mutex *instance (void); + + /// For use only by ACE_Object_Manager to clean up lock if it + /// what dynamically allocated. + static void cleanup_lock (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ + +// hack to get around errors while compiling using split-cpp +#if defined (ACE_HAS_THREADS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_IS_SPLITTING) +typedef ACE_Cleanup_Adapter ACE_Static_Object_Lock_Type; + +# if defined (__GNUC__) +// With g++, suppress the warning that this is unused. +static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock __attribute__ ((unused)) = 0; +# else +static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock = 0; +# endif /* __GNUC__ */ + +# endif /* ACE_IS_SPLITTING */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_STATIC_OBJECT_LOCK_H */ diff --git a/externals/ace/Stats.cpp b/externals/ace/Stats.cpp new file mode 100644 index 0000000..840dc40 --- /dev/null +++ b/externals/ace/Stats.cpp @@ -0,0 +1,421 @@ +// $Id: Stats.cpp 83735 2008-11-14 09:41:52Z johnnyw $ + +#include "ace/Stats.h" + +#if !defined (__ACE_INLINE__) +# include "ace/Stats.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" + +ACE_RCSID(ace, Stats, "$Id: Stats.cpp 83735 2008-11-14 09:41:52Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_UINT32 +ACE_Stats_Value::fractional_field (void) const +{ + if (precision () == 0) + { + return 1; + } + else + { + ACE_UINT32 field = 10; + for (u_int i = 0; i < precision () - 1; ++i) + { + field *= 10; + } + + return field; + } +} + +int +ACE_Stats::sample (const ACE_INT32 value) +{ + if (samples_.enqueue_tail (value) == 0) + { + ++number_of_samples_; + if (number_of_samples_ == 0) + { + // That's a lot of samples :-) + overflow_ = EFAULT; + return -1; + } + + if (value < min_) + min_ = value; + + if (value > max_) + max_ = value; + + return 0; + } + else + { + // Probably failed due to running out of memory when trying to + // enqueue the new value. + overflow_ = errno; + return -1; + } +} + +void +ACE_Stats::mean (ACE_Stats_Value &m, + const ACE_UINT32 scale_factor) +{ + if (number_of_samples_ > 0) + { +#if defined ACE_LACKS_LONGLONG_T + // If ACE_LACKS_LONGLONG_T, then ACE_UINT64 is a user-defined class. + // To prevent having to construct a static of that class, declare it + // on the stack, and construct it, in each function that needs it. + const ACE_U_LongLong ACE_STATS_INTERNAL_OFFSET (0, 8); +#else /* ! ACE_LACKS_LONGLONG_T */ + const ACE_UINT64 ACE_STATS_INTERNAL_OFFSET = + ACE_UINT64_LITERAL (0x100000000); +#endif /* ! ACE_LACKS_LONGLONG_T */ + + ACE_UINT64 sum = ACE_STATS_INTERNAL_OFFSET; + ACE_Unbounded_Queue_Iterator i (samples_); + while (! i.done ()) + { + ACE_INT32 *sample; + if (i.next (sample)) + { + sum += *sample; + i.advance (); + } + } + + // sum_ was initialized with ACE_STATS_INTERNAL_OFFSET, so + // subtract that off here. + quotient (sum - ACE_STATS_INTERNAL_OFFSET, + number_of_samples_ * scale_factor, + m); + } + else + { + m.whole (0); + m.fractional (0); + } +} + +int +ACE_Stats::std_dev (ACE_Stats_Value &std_dev, + const ACE_UINT32 scale_factor) +{ + if (number_of_samples_ <= 1) + { + std_dev.whole (0); + std_dev.fractional (0); + } + else + { + const ACE_UINT32 field = std_dev.fractional_field (); + + // The sample standard deviation is: + // + // sqrt (sum (sample_i - mean)^2 / (number_of_samples_ - 1)) + + ACE_UINT64 mean_scaled; + // Calculate the mean, scaled, so that we don't lose its + // precision. + ACE_Stats_Value avg (std_dev.precision ()); + mean (avg, 1u); + avg.scaled_value (mean_scaled); + + // Calculate the summation term, of squared differences from the + // mean. + ACE_UINT64 sum_of_squares = 0; + ACE_Unbounded_Queue_Iterator i (samples_); + while (! i.done ()) + { + ACE_INT32 *sample; + if (i.next (sample)) + { + const ACE_UINT64 original_sum_of_squares = sum_of_squares; + + // Scale up by field width so that we don't lose the + // precision of the mean. Carefully . . . + const ACE_UINT64 product (*sample * field); + + ACE_UINT64 difference; + // NOTE: please do not reformat this code! It // + // works with the Diab compiler the way it is! // + if (product >= mean_scaled) // + { // + difference = product - mean_scaled; // + } // + else // + { // + difference = mean_scaled - product; // + } // + // NOTE: please do not reformat this code! It // + // works with the Diab compiler the way it is! // + + // Square using 64-bit arithmetic. + sum_of_squares += difference * ACE_U64_TO_U32 (difference); + i.advance (); + + if (sum_of_squares < original_sum_of_squares) + { + overflow_ = ENOSPC; + return -1; + } + } + } + + // Divide the summation by (number_of_samples_ - 1), to get the + // variance. In addition, scale the variance down to undo the + // mean scaling above. Otherwise, it can get too big. + ACE_Stats_Value variance (std_dev.precision ()); + quotient (sum_of_squares, + (number_of_samples_ - 1) * field * field, + variance); + + // Take the square root of the variance to get the standard + // deviation. First, scale up . . . + ACE_UINT64 scaled_variance; + variance.scaled_value (scaled_variance); + + // And scale up, once more, because we'll be taking the square + // root. + scaled_variance *= field; + ACE_Stats_Value unscaled_standard_deviation (std_dev.precision ()); + square_root (scaled_variance, + unscaled_standard_deviation); + + // Unscale. + quotient (unscaled_standard_deviation, + scale_factor * field, + std_dev); + } + + return 0; +} + + +void +ACE_Stats::reset (void) +{ + overflow_ = 0u; + number_of_samples_ = 0u; + min_ = 0x7FFFFFFF; + max_ = -0x8000 * 0x10000; + samples_.reset (); +} + +int +ACE_Stats::print_summary (const u_int precision, + const ACE_UINT32 scale_factor, + FILE *file) const +{ + ACE_TCHAR mean_string [128]; + ACE_TCHAR std_dev_string [128]; + ACE_TCHAR min_string [128]; + ACE_TCHAR max_string [128]; + int success = 0; + + for (int tmp_precision = precision; + ! overflow_ && ! success && tmp_precision >= 0; + --tmp_precision) + { + // Build a format string, in case the C library doesn't support %*u. + ACE_TCHAR format[32]; + if (tmp_precision == 0) + ACE_OS::sprintf (format, ACE_TEXT ("%%%d"), tmp_precision); + else + ACE_OS::sprintf (format, ACE_TEXT ("%%d.%%0%du"), tmp_precision); + + ACE_Stats_Value u (tmp_precision); + ((ACE_Stats *) this)->mean (u, scale_factor); + ACE_OS::sprintf (mean_string, format, u.whole (), u.fractional ()); + + ACE_Stats_Value sd (tmp_precision); + if (((ACE_Stats *) this)->std_dev (sd, scale_factor)) + { + success = 0; + continue; + } + else + { + success = 1; + } + ACE_OS::sprintf (std_dev_string, format, sd.whole (), sd.fractional ()); + + ACE_Stats_Value minimum (tmp_precision), maximum (tmp_precision); + if (min_ != 0) + { + const ACE_UINT64 m (min_); + quotient (m, scale_factor, minimum); + } + if (max_ != 0) + { + const ACE_UINT64 m (max_); + quotient (m, scale_factor, maximum); + } + ACE_OS::sprintf (min_string, format, + minimum.whole (), minimum.fractional ()); + ACE_OS::sprintf (max_string, format, + maximum.whole (), maximum.fractional ()); + } + + if (success == 1) + { + ACE_OS::fprintf (file, ACE_TEXT ("samples: %u (%s - %s); mean: ") + ACE_TEXT ("%s; std dev: %s\n"), + samples (), min_string, max_string, + mean_string, std_dev_string); + return 0; + } + else + { + ACE_OS::fprintf (file, + ACE_TEXT ("ACE_Stats::print_summary: OVERFLOW: %s\n"), + ACE_OS::strerror (overflow_)); + + return -1; + } +} + +void +ACE_Stats::quotient (const ACE_UINT64 dividend, + const ACE_UINT32 divisor, + ACE_Stats_Value "ient) +{ + // The whole part of the division comes from simple integer division. + quotient.whole (static_cast (divisor == 0 + ? 0 : dividend / divisor)); + + if (quotient.precision () > 0 || divisor == 0) + { + const ACE_UINT32 field = quotient.fractional_field (); + + // Fractional = (dividend % divisor) * 10^precision / divisor + + // It would be nice to add round-up term: + // Fractional = (dividend % divisor) * 10^precision / divisor + + // 10^precision/2 / 10^precision + // = ((dividend % divisor) * 10^precision + divisor) / + // divisor + quotient.fractional (static_cast ( + dividend % divisor * field / divisor)); + } + else + { + // No fractional portion is requested, so don't bother + // calculating it. + quotient.fractional (0); + } +} + +void +ACE_Stats::quotient (const ACE_Stats_Value ÷nd, + const ACE_UINT32 divisor, + ACE_Stats_Value "ient) +{ + // The whole part of the division comes from simple integer division. + quotient.whole (divisor == 0 ? 0 : dividend.whole () / divisor); + + if (quotient.precision () > 0 || divisor == 0) + { + const ACE_UINT32 field = quotient.fractional_field (); + + // Fractional = (dividend % divisor) * 10^precision / divisor. + quotient.fractional (dividend.whole () % divisor * field / divisor + + dividend.fractional () / divisor); + } + else + { + // No fractional portion is requested, so don't bother + // calculating it. + quotient.fractional (0); + } +} + +void +ACE_Stats::square_root (const ACE_UINT64 n, + ACE_Stats_Value &square_root) +{ + ACE_UINT32 floor = 0; + ACE_UINT32 ceiling = 0xFFFFFFFFu; + ACE_UINT32 mid = 0; + u_int i; + + // The maximum number of iterations is log_2 (2^64) == 64. + for (i = 0; i < 64; ++i) + { + mid = (ceiling - floor) / 2 + floor; + if (floor == mid) + // Can't divide the interval any further. + break; + else + { + // Multiply carefully to avoid overflow. + ACE_UINT64 mid_squared = mid; mid_squared *= mid; + if (mid_squared == n) + break; + else if (mid_squared < n) + floor = mid; + else + ceiling = mid; + } + } + + square_root.whole (mid); + ACE_UINT64 mid_squared = mid; mid_squared *= mid; + + if (square_root.precision () && mid_squared < n) + { + // (mid * 10^precision + fractional)^2 == + // n^2 * 10^(precision * 2) + + const ACE_UINT32 field = square_root.fractional_field (); + + floor = 0; + ceiling = field; + mid = 0; + + // Do the 64-bit arithmetic carefully to avoid overflow. + ACE_UINT64 target = n; + target *= field; + target *= field; + + ACE_UINT64 difference = 0; + + for (i = 0; i < square_root.precision (); ++i) + { + mid = (ceiling - floor) / 2 + floor; + + ACE_UINT64 current = square_root.whole () * field + mid; + current *= square_root.whole () * field + mid; + + if (floor == mid) + { + difference = target - current; + break; + } + else if (current <= target) + floor = mid; + else + ceiling = mid; + } + + // Check to see if the fractional part should be one greater. + ACE_UINT64 next = square_root.whole () * field + mid + 1; + next *= square_root.whole () * field + mid + 1; + + square_root.fractional (next - target < difference ? mid + 1 : mid); + } + else + { + // No fractional portion is requested, so don't bother + // calculating it. + square_root.fractional (0); + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Stats.h b/externals/ace/Stats.h new file mode 100644 index 0000000..2590ec9 --- /dev/null +++ b/externals/ace/Stats.h @@ -0,0 +1,222 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Stats.h + * + * $Id: Stats.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author David L. Levine + */ +//========================================================================== + + +#ifndef ACE_STATS_H +#define ACE_STATS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Unbounded_Queue.h" +#include "ace/Log_Msg.h" +#include "ace/Basic_Stats.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Stats_Value + * + * @brief Helper class for ACE_Stats. + * + * Container struct for 64-bit signed quantity and its + * precision. It would be nicer to use a fixed-point class, but + * this is sufficient. Users typically don't need to use this + * class directly; see ACE_Stats below. + */ +class ACE_Export ACE_Stats_Value +{ +public: + /** + * Constructor, which requires precision in terms of number of + * decimal digits. The more variation in the data, and the greater + * the data values, the smaller the precision must be to avoid + * overflow in the standard deviation calculation. 3 might be a + * good value, or maybe 4. 5 will probably be too large for + * non-trivial data sets. + */ + ACE_Stats_Value (const u_int precision); + + /// Accessor for precision. + u_int precision (void) const; + + /// Set the whole_ field. + void whole (const ACE_UINT32); + + /// Accessor for the whole_ field. + ACE_UINT32 whole (void) const; + + /// Set the fractional_ field. + void fractional (const ACE_UINT32); + + /// Accessor for the fractional_ field. + ACE_UINT32 fractional (void) const; + + /// Calculates the maximum value of the fractional portion, given its + /// precision. + ACE_UINT32 fractional_field (void) const; + + /** + * Access the value as an _unsigned_ 64 bit quantity. It scales the + * value up by {precision} decimal digits, so that no precision will + * be lost. It assumes that {whole_} is >= 0. + */ + void scaled_value (ACE_UINT64 &) const; + + /// Print to stdout. + void dump (void) const; + +private: + + ACE_Stats_Value (void) {} + +private: + /// The integer portion of the value. + ACE_UINT32 whole_; + + /// The fractional portion of the value. + ACE_UINT32 fractional_; + + /** + * The number of decimal digits of precision represented by + * {fractional_}. Not declared const, so the only way to change it + * is via the assignment operator. + */ + u_int precision_; + +}; + +/** + * @class ACE_Stats + * + * @brief Provides simple statistical analysis. + * + * Simple statistical analysis package. Prominent features are: + * -# It does not use any floating point arithmetic. + * -# It handles positive and/or negative sample values. The + * sample value type is ACE_INT32. + * -# It uses 64 bit unsigned, but not 64 bit signed, quantities + * internally. + * -# It checks for overflow of internal state. + * -# It has no static variables of other than built-in types. + * + * Example usage: + * + * @verbatim + * ACE_Stats stats; + * for (u_int i = 0; i < n; ++i) + * { + * const ACE_UINT32 sample = ...; + * stats.sample (sample); + * } + * stats.print_summary (3); + * @endverbatim + */ +class ACE_Export ACE_Stats +{ +public: + /// Default constructor. + ACE_Stats (void); + + /// Provide a new sample. Returns 0 on success, -1 if it fails due + /// to running out of memory, or to rolling over of the sample count. + int sample (const ACE_INT32 value); + + /// Access the number of samples provided so far. + ACE_UINT32 samples (void) const; + + /// Value of the minimum sample provided so far. + ACE_INT32 min_value (void) const; + + /// Value of the maximum sample provided so far. + ACE_INT32 max_value (void) const; + + /** + * Access the mean of all samples provided so far. The fractional + * part is to the specified number of digits. E.g., 3 fractional + * digits specifies that the fractional part is in thousandths. + */ + void mean (ACE_Stats_Value &mean, + const ACE_UINT32 scale_factor = 1); + + /// Access the standard deviation, whole and fractional parts. See + /// description of {mean} method for argument descriptions. + int std_dev (ACE_Stats_Value &std_dev, + const ACE_UINT32 scale_factor = 1); + + /** + * Print summary statistics. If scale_factor is not 1, then the + * results are divided by it, i.e., each of the samples is scaled + * down by it. If internal overflow is reached with the specified + * scale factor, it successively tries to reduce it. Returns -1 if + * there is overflow even with a 0 scale factor. + */ + int print_summary (const u_int precision, + const ACE_UINT32 scale_factor = 1, + FILE * = stdout) const; + + /// Initialize internal state. + void reset (void); + + /// Utility division function, for ACE_UINT64 dividend. + static void quotient (const ACE_UINT64 dividend, + const ACE_UINT32 divisor, + ACE_Stats_Value "ient); + + /// Utility division function, for ACE_Stats_Value dividend. + static void quotient (const ACE_Stats_Value ÷nd, + const ACE_UINT32 divisor, + ACE_Stats_Value "ient); + + /** + * Sqrt function, which uses an oversimplified version of Newton's + * method. It's not fast, but it doesn't require floating point + * support. + */ + static void square_root (const ACE_UINT64 n, + ACE_Stats_Value &square_root); + + /// Print summary statistics to stdout. + void dump (void) const; + +protected: + /// Internal indication of whether there has been overflow. Contains + /// the errno corresponding to the cause of overflow. + u_int overflow_; + + /// Number of samples. + ACE_UINT32 number_of_samples_; + + /// Minimum sample value. + ACE_INT32 min_; + + /// Maximum sample value. + ACE_INT32 max_; + + /// The samples. + ACE_Unbounded_Queue samples_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +# include "ace/Stats.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ! ACE_STATS_H */ diff --git a/externals/ace/Stats.inl b/externals/ace/Stats.inl new file mode 100644 index 0000000..4c76838 --- /dev/null +++ b/externals/ace/Stats.inl @@ -0,0 +1,104 @@ +// -*- C++ -*- +// +// $Id: Stats.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Stats_Value::ACE_Stats_Value (const u_int precision) + : whole_ (0), + fractional_ (0), + precision_ (precision) +{ +} + +ACE_INLINE +u_int +ACE_Stats_Value::precision (void) const +{ + return precision_; +} + +ACE_INLINE +void +ACE_Stats_Value::whole (const ACE_UINT32 value) +{ + whole_ = value; +} + +ACE_INLINE +ACE_UINT32 +ACE_Stats_Value::whole (void) const +{ + return whole_; +} + +ACE_INLINE +void +ACE_Stats_Value::fractional (const ACE_UINT32 value) +{ + fractional_ = value; +} + +ACE_INLINE +ACE_UINT32 +ACE_Stats_Value::fractional (void) const +{ + return fractional_; +} + +ACE_INLINE +void +ACE_Stats_Value::scaled_value (ACE_UINT64 &sv) const +{ + sv = whole () * fractional_field () + fractional (); +} + +ACE_INLINE +void +ACE_Stats_Value::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("precision: %u digits; whole: %u, fractional: %u\n"), + precision_, whole_, fractional_)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_INLINE +ACE_Stats::ACE_Stats (void) +{ + reset (); +} + +ACE_INLINE +ACE_UINT32 +ACE_Stats::samples (void) const +{ + return number_of_samples_; +} + +ACE_INLINE +ACE_INT32 +ACE_Stats::min_value (void) const +{ + return min_; +} + +ACE_INLINE +ACE_INT32 +ACE_Stats::max_value (void) const +{ + return max_; +} + +ACE_INLINE +void +ACE_Stats::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + print_summary (3u); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Strategies.h b/externals/ace/Strategies.h new file mode 100644 index 0000000..484ffa9 --- /dev/null +++ b/externals/ace/Strategies.h @@ -0,0 +1,33 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Strategies.h + * + * $Id: Strategies.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_STRATEGIES_H +#define ACE_STRATEGIES_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/// Place holder for backward compatibility.. +#include "ace/Connection_Recycling_Strategy.h" +#include "ace/Hashable.h" +#include "ace/Notification_Strategy.h" +#include "ace/Reactor_Notification_Strategy.h" +#include "ace/Recyclable.h" +#include "ace/Refcountable.h" + + +#include /**/ "ace/post.h" +#endif /*ACE_STRATEGIES_H*/ diff --git a/externals/ace/Strategies_T.cpp b/externals/ace/Strategies_T.cpp new file mode 100644 index 0000000..fbbc1a5 --- /dev/null +++ b/externals/ace/Strategies_T.cpp @@ -0,0 +1,1502 @@ +// $Id: Strategies_T.cpp 89510 2010-03-17 12:21:14Z vzykov $ + +#ifndef ACE_STRATEGIES_T_CPP +#define ACE_STRATEGIES_T_CPP + +#include "ace/Strategies_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Repository.h" +#include "ace/Service_Types.h" +#include "ace/Thread_Manager.h" +#include "ace/WFMO_Reactor.h" +#include "ace/ACE.h" +#include "ace/OS_NS_dlfcn.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_Errno.h" +#include "ace/Svc_Handler.h" +#if defined (ACE_OPENVMS) +# include "ace/Lib_Find.h" +#endif + +#if !defined (__ACE_INLINE__) +#include "ace/Strategies_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Recycling_Strategy::~ACE_Recycling_Strategy (void) +{ +} + +template int +ACE_Recycling_Strategy::assign_recycler (SVC_HANDLER *svc_handler, + ACE_Connection_Recycling_Strategy *recycler, + const void *recycling_act) +{ + svc_handler->recycler (recycler, recycling_act); + return 0; +} + +template int +ACE_Recycling_Strategy::prepare_for_recycling (SVC_HANDLER *svc_handler) +{ + return svc_handler->recycle (); +} + +template +ACE_Singleton_Strategy::~ACE_Singleton_Strategy (void) +{ + ACE_TRACE ("ACE_Singleton_Strategy::~ACE_Singleton_Strategy"); + if (this->delete_svc_handler_) + delete this->svc_handler_; +} + +// Create a Singleton SVC_HANDLER by always returning the same +// SVC_HANDLER. + +template int +ACE_Singleton_Strategy::make_svc_handler (SVC_HANDLER *&sh) +{ + ACE_TRACE ("ACE_Singleton_Strategy::make_svc_handler"); + sh = this->svc_handler_; + return 0; +} + +template int +ACE_Singleton_Strategy::open (SVC_HANDLER *sh, + ACE_Thread_Manager *) +{ + ACE_TRACE ("ACE_Singleton_Strategy::open"); + + if (this->delete_svc_handler_) + delete this->svc_handler_; + + // If is NULL then create a new . + if (sh == 0) + { + ACE_NEW_RETURN (this->svc_handler_, + SVC_HANDLER, + -1); + this->delete_svc_handler_ = true; + } + else + { + this->svc_handler_ = sh; + this->delete_svc_handler_ = false; + } + + return 0; +} + +template int +ACE_DLL_Strategy::open (const ACE_TCHAR dll_name[], + const ACE_TCHAR factory_function[], + const ACE_TCHAR svc_name[], + ACE_Service_Repository *svc_rep, + ACE_Thread_Manager *thr_mgr) +{ + ACE_TRACE ("ACE_DLL_Strategy::open"); + this->inherited::open (thr_mgr); + ACE_OS::strcpy (this->dll_name_, dll_name); + ACE_OS::strcpy (this->factory_function_, factory_function); + ACE_OS::strcpy (this->svc_name_, svc_name); + this->svc_rep_ = svc_rep; + return 0; +} + +// Create a SVC_HANDLER by dynamically linking it from a DLL. + +template int +ACE_DLL_Strategy::make_svc_handler (SVC_HANDLER *&sh) +{ + ACE_TRACE ("ACE_DLL_Strategy::make_svc_handler"); + + // Open the shared library. + ACE_SHLIB_HANDLE handle = ACE_OS::dlopen (this->dll_name_); + + // Extract the factory function. +#if defined (ACE_OPENVMS) + SVC_HANDLER *(*factory)(void) = + (SVC_HANDLER *(*)(void)) ACE::ldsymbol (handle, + this->factory_function_); +#else + SVC_HANDLER *(*factory)(void) = + (SVC_HANDLER *(*)(void)) ACE_OS::dlsym (handle, + this->factory_function_); +#endif + + // Call the factory function to obtain the new SVC_Handler (should + // use RTTI here when it becomes available...) + SVC_HANDLER *svc_handler = 0; + + ACE_ALLOCATOR_RETURN (svc_handler, (*factory)(), -1); + + if (svc_handler != 0) + { + // Create an ACE_Service_Type containing the SVC_Handler and + // insert into this->svc_rep_; + + ACE_Service_Type_Impl *stp = 0; + ACE_NEW_RETURN (stp, + ACE_Service_Object_Type (svc_handler, + this->svc_name_), + -1); + + ACE_Service_Type *srp = 0; + + ACE_NEW_RETURN (srp, + ACE_Service_Type (this->svc_name_, + stp, + handle, + 1), + -1); + if (srp == 0) + { + delete stp; + errno = ENOMEM; + return -1; + } + + if (this->svc_rep_->insert (srp) == -1) + return -1; + // @@ Somehow, we need to deal with this->thr_mgr_... + } + + sh = svc_handler; + return 0; +} + +// Default behavior is to activate the SVC_HANDLER by calling it's +// open() method, which allows the SVC_HANDLER to determine its own +// concurrency strategy. + +template int +ACE_Concurrency_Strategy::activate_svc_handler (SVC_HANDLER *svc_handler, + void *arg) +{ + ACE_TRACE ("ACE_Concurrency_Strategy::activate_svc_handler"); + + int result = 0; + + // See if we should enable non-blocking I/O on the 's + // peer. + if (ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK) != 0) + { + if (svc_handler->peer ().enable (ACE_NONBLOCK) == -1) + result = -1; + } + // Otherwise, make sure it's disabled by default. + else if (svc_handler->peer ().disable (ACE_NONBLOCK) == -1) + result = -1; + + if (result == 0 && svc_handler->open (arg) == -1) + result = -1; + + if (result == -1) + // The connection was already made; so this close is a "normal" close + // operation. + svc_handler->close (NORMAL_CLOSE_OPERATION); + + return result; +} + +template int +ACE_Reactive_Strategy::open (ACE_Reactor *reactor, + ACE_Reactor_Mask mask, + int flags) +{ + ACE_TRACE ("ACE_Reactive_Strategy::open"); + this->reactor_ = reactor; + this->mask_ = mask; + this->flags_ = flags; + + // Must have a + if (this->reactor_ == 0) + return -1; + else + return 0; +} + +template int +ACE_Reactive_Strategy::activate_svc_handler (SVC_HANDLER *svc_handler, + void *arg) +{ + ACE_TRACE ("ACE_Reactive_Strategy::activate_svc_handler"); + + int result = 0; + + if (this->reactor_ == 0) + result = -1; + + // Register with the Reactor with the appropriate . + else if (this->reactor_->register_handler (svc_handler, this->mask_) == -1) + result = -1; + + // If the implementation of the reactor uses event associations + else if (this->reactor_->uses_event_associations ()) + { + // If we don't have non-block on, it won't work with + // WFMO_Reactor + // This maybe too harsh + // if (!ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK)) + // goto failure; + if (svc_handler->open (arg) != -1) + return 0; + else + result = -1; + } + else + // Call up to our parent to do the SVC_HANDLER initialization. + return this->inherited::activate_svc_handler (svc_handler, arg); + + if (result == -1) + // The connection was already made; so this close is a "normal" close + // operation. + svc_handler->close (NORMAL_CLOSE_OPERATION); + + return result; +} + +template int +ACE_Thread_Strategy::open (ACE_Thread_Manager *thr_mgr, + long thr_flags, + int n_threads, + int flags) +{ + ACE_TRACE ("ACE_Thread_Strategy::open"); + this->thr_mgr_ = thr_mgr; + this->n_threads_ = n_threads; + this->thr_flags_ = thr_flags; + this->flags_ = flags; + + // Must have a thread manager! + if (this->thr_mgr_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("error: must have a non-NULL thread manager\n")), + -1); + else + return 0; +} + +template int +ACE_Thread_Strategy::activate_svc_handler (SVC_HANDLER *svc_handler, + void *arg) +{ + ACE_TRACE ("ACE_Thread_Strategy::activate_svc_handler"); + // Call up to our parent to do the SVC_HANDLER initialization. + if (this->inherited::activate_svc_handler (svc_handler, + arg) == -1) + return -1; + else + // Turn the into an active object (if it isn't + // already one as a result of the first activation...) + return svc_handler->activate (this->thr_flags_, + this->n_threads_); +} + +template int +ACE_Accept_Strategy::open + (const ACE_PEER_ACCEPTOR_ADDR &local_addr, bool reuse_addr) +{ + this->reuse_addr_ = reuse_addr; + this->peer_acceptor_addr_ = local_addr; + if (this->peer_acceptor_.open (local_addr, reuse_addr) == -1) + return -1; + + // Set the peer acceptor's handle into non-blocking mode. This is a + // safe-guard against the race condition that can otherwise occur + // between the time when was interrupted. + if (ACE_Sig_Handler::sig_pending () != 0) + { + ACE_Sig_Handler::sig_pending (0); + + // This piece of code comes from the old TP_Reactor. We did not + // handle signals at all then. If we happen to handle signals + // in the TP_Reactor, we should then start worryiung about this + // - Bala 21-Aug- 01 +if 0 + // Not sure if this should be done in the TP_Reactor + // case... leave it out for now. -Steve Huston 22-Aug-00 + + // If any HANDLES in the are activated as a + // result of signals they should be dispatched since + // they may be time critical... + active_handle_count = this->any_ready (dispatch_set); +else + // active_handle_count = 0; +endif + + // Record the fact that the Reactor has dispatched a + // handle_signal() method. We need this to return the + // appropriate count. + return 1; + } + + return -1; +} +#endif // #if 0 + + +int +ACE_TP_Reactor::handle_timer_events (int & /*event_count*/, + ACE_TP_Token_Guard &guard) +{ + if (this->timer_queue_ == 0 || this->timer_queue_->is_empty()) + { // Empty timer queue so cannot have any expired timers. + return 0; + } + + // Get the current time + ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () + + this->timer_queue_->timer_skew ()); + + // Look for a node in the timer queue whose timer <= the present + // time. + ACE_Timer_Node_Dispatch_Info info; + + if (this->timer_queue_->dispatch_info (cur_time, info)) + { + const void *upcall_act = 0; + + // Preinvoke. + this->timer_queue_->preinvoke (info, cur_time, upcall_act); + + // Release the token before dispatching notifies... + guard.release_token (); + + // call the functor + this->timer_queue_->upcall (info, cur_time); + + // Postinvoke + this->timer_queue_->postinvoke (info, cur_time, upcall_act); + + // We have dispatched a timer + return 1; + } + + return 0; +} + +int +ACE_TP_Reactor::handle_notify_events (int & /*event_count*/, + ACE_TP_Token_Guard &guard) +{ + // Get the handle on which notify calls could have occured + ACE_HANDLE notify_handle = this->get_notify_handle (); + + int result = 0; + + // The notify was not in the list returned by + // wait_for_multiple_events (). + if (notify_handle == ACE_INVALID_HANDLE) + return result; + + // Now just do a read on the pipe.. + ACE_Notification_Buffer buffer; + + // Clear the handle of the read_mask of our + this->ready_set_.rd_mask_.clr_bit (notify_handle); + + // Keep reading notifies till we empty it or till we have a + // dispatchable buffer + while (this->notify_handler_->read_notify_pipe (notify_handle, buffer) > 0) + { + // Just figure out whether we can read any buffer that has + // dispatchable info. If not we have just been unblocked by + // another thread trying to update the reactor. If we get any + // buffer that needs dispatching we will dispatch that after + // releasing the lock + if (this->notify_handler_->is_dispatchable (buffer) > 0) + { + // Release the token before dispatching notifies... + guard.release_token (); + + // Dispatch the upcall for the notify + this->notify_handler_->dispatch_notify (buffer); + + // We had a successful dispatch. + result = 1; + + // break out of the while loop + break; + } + } + + // If we did some work, then we just return 1 which will allow us + // to get out of here. If we return 0, then we will be asked to do + // some work ie. dispacth socket events + return result; +} + +int +ACE_TP_Reactor::handle_socket_events (int &event_count, + ACE_TP_Token_Guard &guard) +{ + + // We got the lock, lets handle some I/O events. + ACE_EH_Dispatch_Info dispatch_info; + + this->get_socket_event_info (dispatch_info); + + // If there is any event handler that is ready to be dispatched, the + // dispatch information is recorded in dispatch_info. + if (!dispatch_info.dispatch ()) + { + // Check for removed handlers. + if (dispatch_info.event_handler_ == 0) + { + this->handler_rep_.unbind(dispatch_info.handle_, + dispatch_info.mask_); + } + + + return 0; + } + + // Suspend the handler so that other threads don't start dispatching + // it, if we can't suspend then return directly + // + // NOTE: This check was performed in older versions of the + // TP_Reactor. Looks like it is a waste.. + if (dispatch_info.event_handler_ != this->notify_handler_) + if (this->suspend_i (dispatch_info.handle_) == -1) + return 0; + + // Call add_reference() if needed. + if (dispatch_info.reference_counting_required_) + dispatch_info.event_handler_->add_reference (); + + // Release the lock. Others threads can start waiting. + guard.release_token (); + + int result = 0; + + // If there was an event handler ready, dispatch it. + // Decrement the event left + --event_count; + + // Dispatched an event + if (this->dispatch_socket_event (dispatch_info) == 0) + ++result; + + return result; +} + +int +ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time) +{ + // If the reactor handler state has changed, clear any remembered + // ready bits and re-scan from the master wait_set. + if (this->state_changed_) + { + this->ready_set_.rd_mask_.reset (); + this->ready_set_.wr_mask_.reset (); + this->ready_set_.ex_mask_.reset (); + + this->state_changed_ = false; + } + else + { + // This is a hack... somewhere, under certain conditions (which + // I don't understand...) the mask will have all of its bits clear, + // yet have a size_ > 0. This is an attempt to remedy the affect, + // without knowing why it happens. + + this->ready_set_.rd_mask_.sync (this->ready_set_.rd_mask_.max_set ()); + this->ready_set_.wr_mask_.sync (this->ready_set_.wr_mask_.max_set ()); + this->ready_set_.ex_mask_.sync (this->ready_set_.ex_mask_.max_set ()); + } + + return this->wait_for_multiple_events (this->ready_set_, max_wait_time); +} + +int +ACE_TP_Reactor::get_socket_event_info (ACE_EH_Dispatch_Info &event) +{ + // Check for dispatch in write, except, read. Only catch one, but if + // one is caught, be sure to clear the handle from each mask in case + // there is more than one mask set for it. This would cause problems + // if the handler is suspended for dispatching, but its set bit in + // another part of ready_set_ kept it from being dispatched. + int found_io = 0; + ACE_HANDLE handle; + + // @@todo: We can do quite a bit of code reduction here. Let me get + // it to work before I do this. + { + ACE_Handle_Set_Iterator handle_iter (this->ready_set_.wr_mask_); + + while (!found_io && (handle = handle_iter ()) != ACE_INVALID_HANDLE) + { + if (this->is_suspended_i (handle)) + continue; + + // Remember this info + event.set (handle, + this->handler_rep_.find (handle), + ACE_Event_Handler::WRITE_MASK, + &ACE_Event_Handler::handle_output); + + this->clear_handle_read_set (handle); + found_io = 1; + } + } + + if (!found_io) + { + ACE_Handle_Set_Iterator handle_iter (this->ready_set_.ex_mask_); + + while (!found_io && (handle = handle_iter ()) != ACE_INVALID_HANDLE) + { + if (this->is_suspended_i (handle)) + continue; + + // Remember this info + event.set (handle, + this->handler_rep_.find (handle), + ACE_Event_Handler::EXCEPT_MASK, + &ACE_Event_Handler::handle_exception); + + this->clear_handle_read_set (handle); + + found_io = 1; + } + } + + if (!found_io) + { + ACE_Handle_Set_Iterator handle_iter (this->ready_set_.rd_mask_); + + while (!found_io && (handle = handle_iter ()) != ACE_INVALID_HANDLE) + { + if (this->is_suspended_i (handle)) + continue; + + // Remember this info + event.set (handle, + this->handler_rep_.find (handle), + ACE_Event_Handler::READ_MASK, + &ACE_Event_Handler::handle_input); + + this->clear_handle_read_set (handle); + found_io = 1; + } + } + + return found_io; +} + +// Dispatches a single event handler +int +ACE_TP_Reactor::dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info) +{ + ACE_TRACE ("ACE_TP_Reactor::dispatch_socket_event"); + + ACE_Event_Handler * const event_handler = dispatch_info.event_handler_; + ACE_EH_PTMF const callback = dispatch_info.callback_; + + // Check for removed handlers. + if (event_handler == 0) + return -1; + + // Upcall. If the handler returns positive value (requesting a + // reactor callback) don't set the ready-bit because it will be + // ignored if the reactor state has changed. Just call back + // as many times as the handler requests it. Other threads are off + // handling other things. + int status = 1; + while (status > 0) + status = (event_handler->*callback) (dispatch_info.handle_); + + // Post process socket event + return this->post_process_socket_event (dispatch_info, status); +} + +int +ACE_TP_Reactor::post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info, + int status) +{ + int result = 0; + + // First check if we really have to post process something, if not, then + // we don't acquire the token which saves us a lot of time. + if (status < 0 || + (dispatch_info.event_handler_ != this->notify_handler_ && + dispatch_info.resume_flag_ == + ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER)) + { + // Get the reactor token and with this token acquired remove first the + // handler and resume it at the same time. This must be atomic, see also + // bugzilla 2395. When this is not atomic it can be that we resume the + // handle after it is reused by the OS. + ACE_TP_Token_Guard guard (this->token_); + + result = guard.acquire_token (); + + // If the guard is NOT the owner just return the retval + if (!guard.is_owner ()) + return result; + + // A different event handler may have been registered during the + // upcall if the handle was closed and then reopened, for + // example. Make sure we're removing and/or resuming the event + // handler used during the upcall. + ACE_Event_Handler const * const eh = + this->handler_rep_.find (dispatch_info.handle_); + + // Only remove or resume the event handler used during the + // upcall. + if (eh == dispatch_info.event_handler_) + { + if (status < 0) + { + result = + this->remove_handler_i (dispatch_info.handle_, + dispatch_info.mask_); + } + + // Resume handler if required. + if (dispatch_info.event_handler_ != this->notify_handler_ && + dispatch_info.resume_flag_ == + ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER) + this->resume_i (dispatch_info.handle_); + } + } + + // Call remove_reference() if needed. + if (dispatch_info.reference_counting_required_) + dispatch_info.event_handler_->remove_reference (); + + return result; +} + +int +ACE_TP_Reactor::resumable_handler (void) +{ + return 1; +} + +int +ACE_TP_Reactor::handle_events (ACE_Time_Value &max_wait_time) +{ + return this->handle_events (&max_wait_time); +} + +void +ACE_TP_Reactor::notify_handle (ACE_HANDLE, + ACE_Reactor_Mask, + ACE_Handle_Set &, + ACE_Event_Handler *eh, + ACE_EH_PTMF) +{ + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_TP_Reactor::notify_handle: ") + ACE_TEXT ("Wrong version of notify_handle() got called\n"))); + + ACE_ASSERT (eh == 0); + ACE_UNUSED_ARG (eh); +} + +ACE_HANDLE +ACE_TP_Reactor::get_notify_handle (void) +{ + // Call the notify handler to get a handle on which we would have a + // notify waiting + ACE_HANDLE const read_handle = + this->notify_handler_->notify_handle (); + + // Check whether the rd_mask has been set on that handle. If so + // return the handle. + if (read_handle != ACE_INVALID_HANDLE && + this->ready_set_.rd_mask_.is_set (read_handle)) + { + return read_handle; + } + + // None found.. + return ACE_INVALID_HANDLE; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/TP_Reactor.h b/externals/ace/TP_Reactor.h new file mode 100644 index 0000000..33e00c2 --- /dev/null +++ b/externals/ace/TP_Reactor.h @@ -0,0 +1,320 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file TP_Reactor.h + * + * $Id: TP_Reactor.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * The ACE_TP_Reactor (aka, Thread Pool Reactor) uses the + * Leader/Followers pattern to demultiplex events among a pool of + * threads. When using a thread pool reactor, an application + * pre-spawns a fixed number of threads. When these threads + * invoke the ACE_TP_Reactor's handle_events() method, one thread + * will become the leader and wait for an event. The other + * follower threads will queue up waiting for their turn to become + * the leader. When an event occurs, the leader will pick a + * follower to become the leader and go on to handle the event. + * The consequence of using ACE_TP_Reactor is the amortization of + * the costs used to create threads. The context switching cost + * will also reduce. Moreover, the total resources used by + * threads are bounded because there are a fixed number of threads. + * + * @author Irfan Pyarali + * @author Nanbor Wang + */ +//============================================================================= + + +#ifndef ACE_TP_REACTOR_H +#define ACE_TP_REACTOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Select_Reactor.h" +#include "ace/Timer_Queue.h" /* Simple forward decl won't work... */ + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_EH_Dispatch_Info + * + * @brief This structure contains information of the activated event + * handler. + */ +class ACE_EH_Dispatch_Info +{ +public: + ACE_EH_Dispatch_Info (void); + + void set (ACE_HANDLE handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + ACE_EH_PTMF callback); + + bool dispatch (void) const; + + ACE_HANDLE handle_; + ACE_Event_Handler *event_handler_; + ACE_Reactor_Mask mask_; + ACE_EH_PTMF callback_; + int resume_flag_; + bool reference_counting_required_; + +private: + bool dispatch_; + + // Disallow copying and assignment. + ACE_EH_Dispatch_Info (const ACE_EH_Dispatch_Info &); + ACE_EH_Dispatch_Info &operator= (const ACE_EH_Dispatch_Info &); +}; + + +/** + * @class ACE_TP_Token_Guard + * + * @brief A helper class that helps grabbing, releasing and waiting + * on tokens for a thread that tries calling handle_events (). + * + * In short, this class will be owned by one thread by creating on the + * stack. This class gives the status of the ownership of the token + * and manages the ownership + */ + +class ACE_TP_Token_Guard +{ +public: + + /// Constructor that will grab the token for us + ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token); + + /// Destructor. This will release the token if it hasnt been + /// released till this point + ~ACE_TP_Token_Guard (void); + + /// Release the token .. + void release_token (void); + + /// Returns whether the thread that created this object ownes the + /// token or not. + bool is_owner (void); + + /// A helper method that grabs the token for us, after which the + /// thread that owns that can do some actual work. + int acquire_read_token (ACE_Time_Value *max_wait_time = 0); + + /** + * A helper method that grabs the token for us, after which the + * thread that owns that can do some actual work. This differs from + * acquire_read_token() as it uses acquire () to get the token instead of + * acquire_read () + */ + int acquire_token (ACE_Time_Value *max_wait_time = 0); + +private: + + // Disallow default construction. + ACE_TP_Token_Guard (void); + + // Disallow copying and assignment. + ACE_TP_Token_Guard (const ACE_TP_Token_Guard &); + ACE_TP_Token_Guard &operator= (const ACE_TP_Token_Guard &); + +private: + + /// The Select Reactor token. + ACE_Select_Reactor_Token &token_; + + /// Flag that indicate whether the thread that created this object + /// owns the token or not. A value of false indicates that this class + /// hasnt got the token (and hence the thread) and a value of true + /// vice-versa. + bool owner_; + +}; + +/** + * @class ACE_TP_Reactor + * + * @brief Specialization of ACE_Select_Reactor to support thread-pool + * based event dispatching. + * + * One of the shortcomings of the ACE_Select_Reactor is that it + * does not support a thread pool-based event dispatching model, + * similar to the one in ACE_WFMO_Reactor. In ACE_Select_Reactor, only + * thread can call handle_events() at any given time. ACE_TP_Reactor + * removes this short-coming. + * + * ACE_TP_Reactor is a specialization of ACE_Select_Reactor to support + * thread pool-based event dispatching. This reactor takes advantage + * of the fact that events reported by @c select() are persistent if not + * acted upon immediately. It works by remembering the event handler + * which was just activated, suspending it for further I/O activities, + * releasing the internal lock (so that another thread can start waiting + * in the event loop) and then dispatching the event's handler outside the + * scope of the reactor lock. After the event handler has been dispatched + * the event handler is resumed for further I/O activity. + * + * This reactor implementation is best suited for situations when the + * callbacks to event handlers can take arbitrarily long and/or a number + * of threads are available to run the event loop. Note that I/O-processing + * callback code in event handlers (e.g. handle_input()) does not have to + * be modified or made thread-safe for this reactor. This is because + * before an I/O event is dispatched to an event handler, the handler is + * suspended; it is resumed by the reactor after the upcall completes. + * Therefore, multiple I/O events will not be made to one event handler + * multiple threads simultaneously. This suspend/resume protection does not + * apply to either timers scheduled with the reactor or to notifications + * requested via the reactor. When using timers and/or notifications you + * must provide proper protection for your class in the context of multiple + * threads. + */ +class ACE_Export ACE_TP_Reactor : public ACE_Select_Reactor +{ +public: + + /// Initialize ACE_TP_Reactor with the default size. + ACE_TP_Reactor (ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + bool mask_signals = true, + int s_queue = ACE_Select_Reactor_Token::FIFO); + + /** + * Initialize the ACE_TP_Reactor to manage + * @a max_number_of_handles. If @a restart is non-0 then the + * ACE_Reactor's @c handle_events() method will be restarted + * automatically when @c EINTR occurs. If @a sh or + * @a tq are non-0 they are used as the signal handler and + * timer queue, respectively. + */ + ACE_TP_Reactor (size_t max_number_of_handles, + bool restart = false, + ACE_Sig_Handler *sh = 0, + ACE_Timer_Queue *tq = 0, + bool mask_signals = true, + int s_queue = ACE_Select_Reactor_Token::FIFO); + + /** + * This event loop driver that blocks for @a max_wait_time before + * returning. It will return earlier if timer events, I/O events, + * or signal events occur. Note that @a max_wait_time can be 0, in + * which case this method blocks indefinitely until events occur. + * + * @a max_wait_time is decremented to reflect how much time this call + * took. For instance, if a time value of 3 seconds is passed to + * handle_events and an event occurs after 2 seconds, + * @a max_wait_time will equal 1 second. This can be used if an + * application wishes to handle events for some fixed amount of + * time. + * + * @return The total number of events that were dispatched; 0 if the + * @a max_wait_time elapsed without dispatching any handlers, or -1 + * if an error occurs (check @c errno for more information). + */ + virtual int handle_events (ACE_Time_Value *max_wait_time = 0); + + virtual int handle_events (ACE_Time_Value &max_wait_time); + + /// Does the reactor allow the application to resume the handle on + /// its own ie. can it pass on the control of handle resumption to + /// the application. The TP reactor has can allow applications to + /// resume handles. So return a positive value. + virtual int resumable_handler (void); + + /// Called from handle events + static void no_op_sleep_hook (void *); + + /// The ACE_TP_Reactor implementation does not have a single owner thread. + /// Attempts to set the owner explicitly are ignored. The reported owner + /// thread is the current Leader in the pattern. + virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0); + + /// Return the thread ID of the current Leader. + virtual int owner (ACE_thread_t *t_id); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = Internal methods that do the actual work. + + /// Template method from the base class. + virtual void clear_dispatch_mask (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /// Dispatch just 1 signal, timer, notification handlers + int dispatch_i (ACE_Time_Value *max_wait_time, + ACE_TP_Token_Guard &guard); + + /// Get the event that needs dispatching. It could be either a + /// signal, timer, notification handlers or return possibly 1 I/O + /// handler for dispatching. In the most common use case, this would + /// return 1 I/O handler for dispatching + int get_event_for_dispatching (ACE_Time_Value *max_wait_time); + +#if 0 + // @Ciju + // signal handling isn't in a production state yet. + // Commenting it out for now. + + /// Method to handle signals + /// @note It is just busted at this point in time. + int handle_signals (int &event_count, + ACE_TP_Token_Guard &g); +#endif // #if 0 + + /// Handle timer events + int handle_timer_events (int &event_count, + ACE_TP_Token_Guard &g); + + /// Handle notify events + int handle_notify_events (int &event_count, + ACE_TP_Token_Guard &g); + + /// handle socket events + int handle_socket_events (int &event_count, + ACE_TP_Token_Guard &g); + + /// This method shouldn't get called. + virtual void notify_handle (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Handle_Set &, + ACE_Event_Handler *eh, + ACE_EH_PTMF callback); +private: + + /// Get the handle of the notify pipe from the ready set if there is + /// an event in the notify pipe. + ACE_HANDLE get_notify_handle (void); + + /// Get socket event dispatch information. + int get_socket_event_info (ACE_EH_Dispatch_Info &info); + + /// Notify the appropriate in the context of the + /// associated with that a particular event has occurred. + int dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info); + + /// Clear the @a handle from the read_set + void clear_handle_read_set (ACE_HANDLE handle); + + int post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,int status); + +private: + /// Deny access since member-wise won't work... + ACE_TP_Reactor (const ACE_TP_Reactor &); + ACE_TP_Reactor &operator = (const ACE_TP_Reactor &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/TP_Reactor.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_TP_REACTOR_H */ diff --git a/externals/ace/TP_Reactor.inl b/externals/ace/TP_Reactor.inl new file mode 100644 index 0000000..2b14a8c --- /dev/null +++ b/externals/ace/TP_Reactor.inl @@ -0,0 +1,119 @@ +// -*- C++ -*- +// +// $Id: TP_Reactor.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/************************************************************************/ +// Methods for ACE_EH_Dispatch_Info +/************************************************************************/ + +ACE_INLINE +ACE_EH_Dispatch_Info::ACE_EH_Dispatch_Info (void) : + handle_ (ACE_INVALID_HANDLE), + event_handler_ (0), + mask_ (ACE_Event_Handler::NULL_MASK), + callback_ (0), + resume_flag_ (ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER), + reference_counting_required_ (false), + dispatch_ (false) +{ +} + +ACE_INLINE void +ACE_EH_Dispatch_Info::set (ACE_HANDLE handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + ACE_EH_PTMF callback) +{ + this->dispatch_ = true; + + this->handle_ = handle; + this->event_handler_ = event_handler; + this->mask_ = mask; + this->callback_ = callback; + if (event_handler_) + { + this->resume_flag_ = event_handler->resume_handler (); + this->reference_counting_required_ = + (event_handler_->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + } + else + this->dispatch_ = false; +} + +ACE_INLINE bool +ACE_EH_Dispatch_Info::dispatch (void) const +{ + return this->dispatch_; +} + +/************************************************************************/ +// Methods for ACE_TP_Token_Guard +/************************************************************************/ + +ACE_INLINE +ACE_TP_Token_Guard::ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token) + + : token_ (token), + owner_ (false) +{ +} + +ACE_INLINE +ACE_TP_Token_Guard::~ACE_TP_Token_Guard (void) +{ + if (this->owner_) + { + ACE_MT (this->token_.release ()); + this->owner_ = false; + } +} + +ACE_INLINE void +ACE_TP_Token_Guard::release_token (void) +{ + if (this->owner_) + { + ACE_MT (this->token_.release ()); + + // We are not the owner anymore.. + this->owner_ = false; + } +} + +ACE_INLINE bool +ACE_TP_Token_Guard::is_owner (void) +{ + return this->owner_; +} + + +/************************************************************************/ +// Methods for ACE_TP_Reactor +/************************************************************************/ + +ACE_INLINE void +ACE_TP_Reactor::no_op_sleep_hook (void *) +{ +} + +ACE_INLINE void +ACE_TP_Reactor::clear_handle_read_set (ACE_HANDLE handle) +{ + this->ready_set_.wr_mask_.clr_bit (handle); + this->ready_set_.ex_mask_.clr_bit (handle); + this->ready_set_.rd_mask_.clr_bit (handle); +} + +ACE_INLINE void +ACE_TP_Reactor::clear_dispatch_mask (ACE_HANDLE , + ACE_Reactor_Mask ) +{ + this->ready_set_.rd_mask_.reset (); + this->ready_set_.wr_mask_.reset (); + this->ready_set_.ex_mask_.reset (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/TSS_Adapter.cpp b/externals/ace/TSS_Adapter.cpp new file mode 100644 index 0000000..da6218d --- /dev/null +++ b/externals/ace/TSS_Adapter.cpp @@ -0,0 +1,45 @@ +/** + * @file TSS_Adapter.cpp + * + * $Id: TSS_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $ + * + * Originally in Synch.cpp + * + * @author Douglas C. Schmidt + */ + +#include "ace/TSS_Adapter.h" + +ACE_RCSID(ace, TSS_Adapter, "$Id: TSS_Adapter.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_TSS_Adapter::ACE_TSS_Adapter (void *object, ACE_THR_DEST f) + : ts_obj_ (object), + func_ (f) +{ + // ACE_TRACE ("ACE_TSS_Adapter::ACE_TSS_Adapter"); +} + +void +ACE_TSS_Adapter::cleanup (void) +{ + // ACE_TRACE ("ACE_TSS_Adapter::cleanup"); + (*this->func_)(this->ts_obj_); // call cleanup routine for ts_obj_ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +extern "C" void +ACE_TSS_C_cleanup (void *object) +{ + // ACE_TRACE ("ACE_TSS_C_cleanup"); + if (object != 0) + { + ACE_TSS_Adapter * const tss_adapter = (ACE_TSS_Adapter *) object; + // Perform cleanup on the real TS object. + tss_adapter->cleanup (); + // Delete the adapter object. + delete tss_adapter; + } +} diff --git a/externals/ace/TSS_Adapter.h b/externals/ace/TSS_Adapter.h new file mode 100644 index 0000000..b8ff85e --- /dev/null +++ b/externals/ace/TSS_Adapter.h @@ -0,0 +1,61 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file TSS_Adapter.h + * + * $Id: TSS_Adapter.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Originally in Synch.h + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_TSS_ADAPTER_H +#define ACE_TSS_ADAPTER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_TSS_Adapter + * + * @brief This class encapsulates a TSS object and its associated + * C++ destructor function. It is used by the ACE_TSS... + * methods (in Synch_T.cpp) in order to allow an extern + * "C" cleanup routine to be used. Needed by the "frigging" + * MVS C++ compiler. + * + * Objects of this class are stored in thread specific + * storage. ts_obj_ points to the "real" object and + * func_ is a pointer to the C++ cleanup function for ts_obj_. + */ +class ACE_Export ACE_TSS_Adapter +{ +public: + /// Initialize the adapter. + ACE_TSS_Adapter (void *object, ACE_THR_DEST f); + + /// Perform the cleanup operation. + void cleanup (void); + +//private: + + /// The real TS object. + void * const ts_obj_; + + /// The real cleanup routine for ts_obj; + ACE_THR_DEST func_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_TSS_ADAPTER_H */ diff --git a/externals/ace/TSS_T.cpp b/externals/ace/TSS_T.cpp new file mode 100644 index 0000000..f539de4 --- /dev/null +++ b/externals/ace/TSS_T.cpp @@ -0,0 +1,723 @@ +// $Id: TSS_T.cpp 84282 2009-01-30 15:04:29Z msmit $ + +#ifndef ACE_TSS_T_CPP +#define ACE_TSS_T_CPP + +#include "ace/TSS_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/TSS_T.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Thread.h" +#include "ace/Log_Msg.h" +#include "ace/Guard_T.h" +#include "ace/OS_NS_stdio.h" + +#if defined (ACE_HAS_THR_C_DEST) +# include "ace/TSS_Adapter.h" +#endif /* ACE_HAS_THR_C_DEST */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_TSS) + +template +ACE_TSS::~ACE_TSS (void) +{ +#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) + if (this->once_) + { + ACE_OS::thr_key_detach (this->key_, this); + ACE_OS::thr_keyfree (this->key_); + } +#else // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) + // We own it, we need to delete it. + delete type_; +#endif // defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) +} + +template TYPE * +ACE_TSS::operator-> () const +{ + return this->ts_get (); +} + +template +ACE_TSS::operator TYPE *(void) const +{ + return this->ts_get (); +} + +template TYPE * +ACE_TSS::make_TSS_TYPE (void) const +{ + TYPE *temp = 0; + ACE_NEW_RETURN (temp, + TYPE, + 0); + return temp; +} + +template void +ACE_TSS::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_TSS::dump"); +#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->keylock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("key_ = %d\n"), this->key_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nonce_ = %d\n"), this->once_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ +#endif /* ACE_HAS_DUMP */ +} + +#if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) +#if defined (ACE_HAS_THR_C_DEST) +extern "C" void ACE_TSS_C_cleanup (void *); // defined in Synch.cpp +#endif /* ACE_HAS_THR_C_DEST */ + +template void +ACE_TSS::cleanup (void *ptr) +{ + // Cast this to the concrete TYPE * so the destructor gets called. + delete (TYPE *) ptr; +} + +template int +ACE_TSS::ts_init (void) +{ + // Ensure that we are serialized! + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->keylock_, 0); + + // Use the Double-Check pattern to make sure we only create the key + // once! + if (!this->once_) + { + if (ACE_Thread::keycreate (&this->key_, +#if defined (ACE_HAS_THR_C_DEST) + &ACE_TSS_C_cleanup, +#else + &ACE_TSS::cleanup, +#endif /* ACE_HAS_THR_C_DEST */ + (void *) this) != 0) + return -1; // Major problems, this should *never* happen! + else + { + // This *must* come last to avoid race conditions! + this->once_ = true; + return 0; + } + } + + return 0; +} + +template +ACE_TSS::ACE_TSS (TYPE *ts_obj) + : once_ (false), + key_ (ACE_OS::NULL_key) +{ + // If caller has passed us a non-NULL TYPE *, then we'll just use + // this to initialize the thread-specific value. Thus, subsequent + // calls to operator->() will return this value. This is useful + // since it enables us to assign objects to thread-specific data + // that have arbitrarily complex constructors! + + if (ts_obj != 0) + { + if (this->ts_init () == -1) + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + // What should we do if this call fails?! +#if defined (ACE_HAS_WINCE) + ::MessageBox (0, + ACE_TEXT ("ACE_Thread::keycreate() failed!"), + ACE_TEXT ("ACE_TSS::ACE_TSS"), + MB_OK); +#else + ACE_OS::fprintf (stderr, + "ACE_Thread::keycreate() failed!"); +#endif /* ACE_HAS_WINCE */ + return; + } + +#if defined (ACE_HAS_THR_C_DEST) + // Encapsulate a ts_obj and it's destructor in an + // ACE_TSS_Adapter. + ACE_TSS_Adapter *tss_adapter = 0; + ACE_NEW (tss_adapter, + ACE_TSS_Adapter ((void *) ts_obj, + ACE_TSS::cleanup)); + + // Put the adapter in thread specific storage + if (ACE_Thread::setspecific (this->key_, + (void *) tss_adapter) != 0) + { + delete tss_adapter; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Thread::setspecific() failed!"))); + } +#else + if (ACE_Thread::setspecific (this->key_, + (void *) ts_obj) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Thread::setspecific() failed!"))); +#endif /* ACE_HAS_THR_C_DEST */ + } +} + +template TYPE * +ACE_TSS::ts_get (void) const +{ + if (!this->once_) + { + // Create and initialize thread-specific ts_obj. + if (const_cast< ACE_TSS < TYPE > * >(this)->ts_init () == -1) + // Seriously wrong.. + return 0; + } + + TYPE *ts_obj = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + + // Get the adapter from thread-specific storage + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) + return 0; // This should not happen! + tss_adapter = static_cast (temp); + + // Check to see if this is the first time in for this thread. + if (tss_adapter == 0) +#else + // Get the ts_obj from thread-specific storage. Note that no locks + // are required here... + void *temp = ts_obj; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) + return 0; // This should not happen! + ts_obj = static_cast (temp); + + // Check to see if this is the first time in for this thread. + if (ts_obj == 0) +#endif /* ACE_HAS_THR_C_DEST */ + { + // Allocate memory off the heap and store it in a pointer in + // thread-specific storage (on the stack...). + + ts_obj = this->make_TSS_TYPE (); + + if (ts_obj == 0) + return 0; + +#if defined (ACE_HAS_THR_C_DEST) + // Encapsulate a ts_obj and it's destructor in an + // ACE_TSS_Adapter. + ACE_NEW_RETURN (tss_adapter, + ACE_TSS_Adapter (ts_obj, + ACE_TSS::cleanup), 0); + + // Put the adapter in thread specific storage + if (ACE_Thread::setspecific (this->key_, + (void *) tss_adapter) != 0) + { + delete tss_adapter; + delete ts_obj; + return 0; // Major problems, this should *never* happen! + } +#else + // Store the dynamically allocated pointer in thread-specific + // storage. + if (ACE_Thread::setspecific (this->key_, + (void *) ts_obj) != 0) + { + delete ts_obj; + return 0; // Major problems, this should *never* happen! + } +#endif /* ACE_HAS_THR_C_DEST */ + } + +#if defined (ACE_HAS_THR_C_DEST) + // Return the underlying ts object. + return static_cast (tss_adapter->ts_obj_); +#else + return ts_obj; +#endif /* ACE_HAS_THR_C_DEST */ +} + +// Get the thread-specific object for the key associated with this +// object. Returns 0 if the ts_obj has never been initialized, +// otherwise returns a pointer to the ts_obj. + +template TYPE * +ACE_TSS::ts_object (void) const +{ + if (!this->once_) // Return 0 if we've never been initialized. + return 0; + + TYPE *ts_obj = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + + // Get the tss adapter from thread-specific storage + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) + { + return 0; // This should not happen! + } + else + { + tss_adapter = static_cast (temp); + { + if (tss_adapter != 0) + // Extract the real TS object. + ts_obj = static_cast (tss_adapter->ts_obj_); + } + } +#else + void *temp = ts_obj; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) + return 0; // This should not happen! + ts_obj = static_cast (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return ts_obj; +} + +template TYPE * +ACE_TSS::ts_object (TYPE *new_ts_obj) +{ + // Note, we shouldn't hold the keylock at this point because + // does it for us and we'll end up with deadlock + // otherwise... + if (!this->once_) + { + // Create and initialize thread-specific ts_obj. + if (this->ts_init () == -1) + return 0; + } + + TYPE *ts_obj = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) + return 0; // This should not happen! + tss_adapter = static_cast (temp); + + if (tss_adapter != 0) + { + ts_obj = static_cast (tss_adapter->ts_obj_); + delete tss_adapter; // don't need this anymore + } + + ACE_NEW_RETURN (tss_adapter, + ACE_TSS_Adapter ((void *) new_ts_obj, + ACE_TSS::cleanup), + 0); + + if (ACE_Thread::setspecific (this->key_, + (void *) tss_adapter) == -1) + { + delete tss_adapter; + return ts_obj; // This should not happen! + } +#else + void *temp = ts_obj; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) + return 0; // This should not happen! + ts_obj = static_cast (temp); + if (ACE_Thread::setspecific (this->key_, (void *) new_ts_obj) == -1) + return ts_obj; // This should not happen! +#endif /* ACE_HAS_THR_C_DEST */ + + return ts_obj; +} + +ACE_ALLOC_HOOK_DEFINE(ACE_TSS_Guard) + +template void +ACE_TSS_Guard::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_TSS_Guard::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("key_ = %d\n"), this->key_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template void +ACE_TSS_Guard::init_key (void) +{ +// ACE_TRACE ("ACE_TSS_Guard::init_key"); + + this->key_ = ACE_OS::NULL_key; + ACE_Thread::keycreate (&this->key_, +#if defined (ACE_HAS_THR_C_DEST) + &ACE_TSS_C_cleanup, +#else + &ACE_TSS_Guard::cleanup, +#endif /* ACE_HAS_THR_C_DEST */ + (void *) this); +} + +template +ACE_TSS_Guard::ACE_TSS_Guard (void) +{ +// ACE_TRACE ("ACE_TSS_Guard::ACE_TSS_Guard"); + this->init_key (); +} + +template int +ACE_TSS_Guard::release (void) +{ +// ACE_TRACE ("ACE_TSS_Guard::release"); + + ACE_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->release (); +} + +template int +ACE_TSS_Guard::remove (void) +{ +// ACE_TRACE ("ACE_TSS_Guard::remove"); + + ACE_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->remove (); +} + +template +ACE_TSS_Guard::~ACE_TSS_Guard (void) +{ +// ACE_TRACE ("ACE_TSS_Guard::~ACE_TSS_Guard"); + + ACE_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + // Make sure that this pointer is NULL when we shut down... + ACE_Thread::setspecific (this->key_, 0); + ACE_Thread::keyfree (this->key_); + // Destructor releases lock. + delete guard; +} + +template void +ACE_TSS_Guard::cleanup (void *ptr) +{ +// ACE_TRACE ("ACE_TSS_Guard::cleanup"); + + // Destructor releases lock. + delete (ACE_Guard *) ptr; +} + +template +ACE_TSS_Guard::ACE_TSS_Guard (ACE_LOCK &lock, bool block) +{ +// ACE_TRACE ("ACE_TSS_Guard::ACE_TSS_Guard"); + + this->init_key (); + ACE_Guard *guard = 0; + ACE_NEW (guard, + ACE_Guard (lock, + block)); + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + ACE_NEW (tss_adapter, + ACE_TSS_Adapter ((void *) guard, + ACE_TSS_Guard::cleanup)); + ACE_Thread::setspecific (this->key_, + (void *) tss_adapter); +#else + ACE_Thread::setspecific (this->key_, + (void *) guard); +#endif /* ACE_HAS_THR_C_DEST */ +} + +template int +ACE_TSS_Guard::acquire (void) +{ +// ACE_TRACE ("ACE_TSS_Guard::acquire"); + + ACE_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->acquire (); +} + +template int +ACE_TSS_Guard::tryacquire (void) +{ +// ACE_TRACE ("ACE_TSS_Guard::tryacquire"); + + ACE_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->tryacquire (); +} + +template +ACE_TSS_Write_Guard::ACE_TSS_Write_Guard (ACE_LOCK &lock, + bool block) +{ +// ACE_TRACE ("ACE_TSS_Write_Guard::ACE_TSS_Write_Guard"); + + this->init_key (); + ACE_Guard *guard = 0; + ACE_NEW (guard, + ACE_Write_Guard (lock, + block)); + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + ACE_NEW (tss_adapter, + ACE_TSS_Adapter ((void *) guard, + ACE_TSS_Guard::cleanup)); + ACE_Thread::setspecific (this->key_, + (void *) tss_adapter); +#else + ACE_Thread::setspecific (this->key_, + (void *) guard); +#endif /* ACE_HAS_THR_C_DEST */ +} + +template int +ACE_TSS_Write_Guard::acquire (void) +{ +// ACE_TRACE ("ACE_TSS_Write_Guard::acquire"); + + ACE_Write_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->acquire_write (); +} + +template int +ACE_TSS_Write_Guard::tryacquire (void) +{ +// ACE_TRACE ("ACE_TSS_Write_Guard::tryacquire"); + + ACE_Write_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->tryacquire_write (); +} + +template int +ACE_TSS_Write_Guard::acquire_write (void) +{ +// ACE_TRACE ("ACE_TSS_Write_Guard::acquire_write"); + + return this->acquire (); +} + +template int +ACE_TSS_Write_Guard::tryacquire_write (void) +{ +// ACE_TRACE ("ACE_TSS_Write_Guard::tryacquire_write"); + + return this->tryacquire (); +} + +template void +ACE_TSS_Write_Guard::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_TSS_Write_Guard::dump"); + ACE_TSS_Guard::dump (); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_TSS_Read_Guard::ACE_TSS_Read_Guard (ACE_LOCK &lock, bool block) +{ +// ACE_TRACE ("ACE_TSS_Read_Guard::ACE_TSS_Read_Guard"); + + this->init_key (); + ACE_Guard *guard = 0; + ACE_NEW (guard, + ACE_Read_Guard (lock, + block)); +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter; + ACE_NEW (tss_adapter, + ACE_TSS_Adapter ((void *)guard, + ACE_TSS_Guard::cleanup)); + ACE_Thread::setspecific (this->key_, + (void *) tss_adapter); +#else + ACE_Thread::setspecific (this->key_, + (void *) guard); +#endif /* ACE_HAS_THR_C_DEST */ +} + +template int +ACE_TSS_Read_Guard::acquire (void) +{ +// ACE_TRACE ("ACE_TSS_Read_Guard::acquire"); + + ACE_Read_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->acquire_read (); +} + +template int +ACE_TSS_Read_Guard::tryacquire (void) +{ +// ACE_TRACE ("ACE_TSS_Read_Guard::tryacquire"); + + ACE_Read_Guard *guard = 0; + +#if defined (ACE_HAS_THR_C_DEST) + ACE_TSS_Adapter *tss_adapter = 0; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast (temp); + guard = static_cast *> (tss_adapter->ts_obj_); +#else + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast *> (temp); +#endif /* ACE_HAS_THR_C_DEST */ + + return guard->tryacquire_read (); +} + +template int +ACE_TSS_Read_Guard::acquire_read (void) +{ +// ACE_TRACE ("ACE_TSS_Read_Guard::acquire_read"); + + return this->acquire (); +} + +template int +ACE_TSS_Read_Guard::tryacquire_read (void) +{ +// ACE_TRACE ("ACE_TSS_Read_Guard::tryacquire_read"); + + return this->tryacquire (); +} + +template void +ACE_TSS_Read_Guard::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_TSS_Read_Guard::dump"); + ACE_TSS_Guard::dump (); +#endif /* ACE_HAS_DUMP */ +} + +#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TSS_T_CPP */ diff --git a/externals/ace/TSS_T.h b/externals/ace/TSS_T.h new file mode 100644 index 0000000..f9ffaa9 --- /dev/null +++ b/externals/ace/TSS_T.h @@ -0,0 +1,253 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file TSS_T.h + * + * $Id: TSS_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_TSS_T_H +#define ACE_TSS_T_H +#include /**/ "ace/pre.h" + +#include "ace/Lock.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// This should probably go somewhere else, but it's only used here and +// in Thread_Manager. +// Note there is no ACE_TSS_SET because one would typicaly do +// 'ACE_TSS_GET()->xyz_ = value', so the macro would have been too +// complicated. +# if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) +# define ACE_TSS_TYPE(T) ACE_TSS< T > +# define ACE_TSS_GET(I, T) ((I)->operator T * ()) +# else +# define ACE_TSS_TYPE(T) T +# define ACE_TSS_GET(I, T) (I) +# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ + +#include "ace/Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_TSS + * + * @brief Allows objects that are "physically" in thread specific + * storage (i.e., private to a thread) to be accessed as though + * they were "logically" global to a program. + * + * This class helps to maintain a separate copy of an object for each thread + * that needs access to it. All threads access a single instance of ACE_TSS + * to obtain a pointer to a thread-specific copy of a TYPE object. Using + * a pointer to TYPE in TSS instead of TYPE itself is useful because, + * in addition to avoiding copies on what may be a complex class, it allows + * assignment of objects to thread-specific data that have arbitrarily + * complex constructors. + * + * When the ACE_TSS object is destroyed, all threads's instances of the + * data are deleted. + * + * Modern compilers have no problem using a built-in type for @c TYPE. + * However, if you must use an older compiler that won't work with a built-in + * type, the ACE_TSS_Type_Adapter class template, below, can be used for + * adapting built-in types to work with ACE_TSS. + * + * @note Beware when creating static instances of this type + * (as with any other, btw). The unpredictable order of initialization + * across different platforms may cause a situation where one uses + * the instance before it is fully initialized. That's why typically + * instances of this type are dynamicaly allocated. On the stack it is + * typically allocated inside the ACE_Thread::svc() method which + * limits its lifetime appropriately. + * + */ +template +class ACE_TSS +{ +public: + /** + * Default constructor. Can also initialize this ACE_TSS instance, + * readying it for use by the calling thread as well as all other + * threads in the process. If the constructor does not initialize this + * object, the first access to it will perform the initialization, which + * could possibly (under odd error conditions) fail. + * + * @param ts_obj If non-zero, this object is initialized for use by + * all threads and @a ts_obj is used to set the + * thread-specific value for the calling thread. Other + * threads use the ts_object (TYPE *) method to set + * a specific value. + */ + ACE_TSS (TYPE *ts_obj = 0); + + /// Deregister this object from thread-specific storage administration. + /// Will cause all threads' copies of TYPE to be destroyed. + virtual ~ACE_TSS (void); + + /** + * Set the thread-specific object for the calling thread. + * If this object has not been initialized yet, this method performs the + * initialization. + * + * @param new_ts_obj The new value for the calling thread's copy of + * this object. + * + * @return The previous value of the calling thread's copy of this + * object; 0 if there was no previous value. This method also + * returns 0 on errors. To tell the difference between an error + * and a returned 0 pointer, it's recommended that one set errno + * to 0 prior to calling ts_object() and check for a new errno + * value if ts_object() returns 0. + */ + TYPE *ts_object (TYPE *new_ts_obj); + + /** @name Accessors + * + * All accessors return a pointer to the calling thread's copy of the + * TYPE data. The pointer may be 0 on error conditions or if the calling + * thread's copy of the data has not yet been set. See specific method + * descriptions for complete details. + */ + //@{ + /** + * Get the thread-specific object for this object. + * + * @return 0 if the object has never been initialized, otherwise returns + * the calling thread's copy of the data. The returned pointer + * may be 0 under odd error conditions; check errno for further + * information. + */ + TYPE *ts_object (void) const; + + /** + * Use a "smart pointer" to get the thread-specific data associated + * with this object. + * If this ACE_TSS object hasn't been initialized, this method + * will initialize it as a side-affect. If the calling thread has not + * set a value, a default-constructed instance of TYPE is allocated and it + * becomes the thread's instance. + * + * @return The calling thread's copy of the data. The returned pointer + * may be 0 under odd error conditions; check errno for further + * information. + */ + TYPE *operator-> () const; + + /** + * Obtain a pointer to the calling thread's TYPE object. + * If this ACE_TSS object hasn't been initialized, this method + * will initialize it as a side-affect. If the calling thread has not + * set a value, a default-constructed instance of TYPE is allocated and it + * becomes the thread's instance. + * + * @return The calling thread's copy of the data. The returned pointer + * may be 0 under odd error conditions; check errno for further + * information. + */ + operator TYPE *(void) const; + + //@} + + /// Hook for construction parameters. + virtual TYPE *make_TSS_TYPE (void) const; + + // = Utility methods. + + /// Dump the state of an object. + void dump (void) const; + + // ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +protected: + /// Actually implements the code that retrieves the object from + /// thread-specific storage. + TYPE *ts_get (void) const; + + /// Factors out common code for initializing TSS. This must NOT be + /// called with the lock held... + int ts_init (void); + +#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) + /// This implementation only works for non-threading systems... + TYPE *type_; +#else + /// Avoid race conditions during initialization. + ACE_Thread_Mutex keylock_; + + /// "First time in" flag. + volatile bool once_; + + /// Key for the thread-specific error data. + ACE_thread_key_t key_; + + /// "Destructor" that deletes internal TYPE * when thread exits. + static void cleanup (void *ptr); +#endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ + // = Disallow copying... + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_TSS &)) + ACE_UNIMPLEMENTED_FUNC (ACE_TSS (const ACE_TSS &)) +}; + +/** + * @class ACE_TSS_Type_Adapter + * + * @brief Adapter that allows built-in types to be used with ACE_TSS. + * + * Wraps a value of a built-in type, providing conversions to + * and from the type. Example use with ACE_TSS: + * ACE_TSS > i; + * *i = 37; + * ACE_OS::fprintf (stderr, "%d\n", *i); + * Unfortunately, though, some compilers have trouble with the + * implicit type conversions. This seems to work better: + * ACE_TSS > i; + * i->operator int & () = 37; + * ACE_OS::fprintf (stderr, "%d\n", i->operator int ()); + */ +template +class ACE_TSS_Type_Adapter +{ +public: + /// Constructor. Inlined here so that it should _always_ be inlined. + ACE_TSS_Type_Adapter (const TYPE value = 0): value_ (value) {} + + /// TYPE conversion. Inlined here so that it should _always_ be + /// inlined. + operator TYPE () const { return value_; }; + + /// TYPE & conversion. Inlined here so that it should _always_ be + /// inlined. + operator TYPE &() { return value_; }; + +private: + /// The wrapped value. + TYPE value_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/TSS_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/TSS_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("TSS_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TSS_T_H */ diff --git a/externals/ace/TSS_T.inl b/externals/ace/TSS_T.inl new file mode 100644 index 0000000..9959a2e --- /dev/null +++ b/externals/ace/TSS_T.inl @@ -0,0 +1,42 @@ +// -*- C++ -*- +// +// $Id: TSS_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +#if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE +ACE_TSS::ACE_TSS (TYPE *type) + : type_ (type) +{ +} + +template ACE_INLINE int +ACE_TSS::ts_init (void) +{ + return 0; +} + +template ACE_INLINE TYPE * +ACE_TSS::ts_object (void) const +{ + return this->type_; +} + +template ACE_INLINE TYPE * +ACE_TSS::ts_object (TYPE *type) +{ + this->type_ = type; + return this->type_; +} + +template ACE_INLINE TYPE * +ACE_TSS::ts_get (void) const +{ + return this->type_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ! (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */ diff --git a/externals/ace/TTY_IO.cpp b/externals/ace/TTY_IO.cpp new file mode 100644 index 0000000..6d5be6f --- /dev/null +++ b/externals/ace/TTY_IO.cpp @@ -0,0 +1,705 @@ +// $Id: TTY_IO.cpp 86739 2009-09-21 07:33:22Z olli $ + +#include "ace/TTY_IO.h" +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_strings.h" + +#if defined (ACE_HAS_TERMIOS) +# include "ace/os_include/os_termios.h" +#elif defined (ACE_HAS_TERMIO) +# include +#endif + +ACE_RCSID (ace, + TTY_IO, + "$Id: TTY_IO.cpp 86739 2009-09-21 07:33:22Z olli $") + +namespace +{ + const char ACE_TTY_IO_NONE[] = "none"; +#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) || defined (ACE_WIN32) + const char ACE_TTY_IO_ODD[] = "odd"; + const char ACE_TTY_IO_EVEN[] = "even"; +#endif +#if defined (ACE_WIN32) + const char ACE_TTY_IO_MARK[] = "mark"; + const char ACE_TTY_IO_SPACE[] = "space"; +#endif /* ACE_WIN32 */ +} + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_TTY_IO::Serial_Params::Serial_Params (void) +{ + baudrate = 9600; + xonlim = 0; + xofflim = 0; + readmincharacters = 0; + readtimeoutmsec = 10000; + paritymode = ACE_TTY_IO_NONE; + ctsenb = false; + rtsenb = 0; + xinenb = false; + xoutenb = false; + modem = false; + rcvenb = true; + dsrenb = false; + dtrdisable = false; + databits = 8; + stopbits = 1; +} + +// Interface for reading/writing serial device parameters + +int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const +{ +#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) + +#if defined (ACE_HAS_TERMIOS) + struct termios devpar; + speed_t newbaudrate = 0; + if (tcgetattr (get_handle () , &devpar) == -1) +#elif defined (TCGETS) + struct termios devpar; + unsigned int newbaudrate = 0; + if (this->ACE_IO_SAP::control (TCGETS, static_cast(&devpar)) == -1) +#elif defined (TCGETA) + struct termio devpar; + unsigned int newbaudrate = 0; + if (this->ACE_IO_SAP::control (TCGETA, static_cast(&devpar)) == -1) +#else + errno = ENOSYS; +#endif /* ACE_HAS_TERMIOS */ + return -1; + + switch (cmd) + { + case SETPARAMS: + switch (arg->baudrate) + { +#if defined (B0) + case 0: newbaudrate = B0; break; +#endif /* B0 */ +#if defined (B50) + case 50: newbaudrate = B50; break; +#endif /* B50 */ +#if defined (B75) + case 75: newbaudrate = B75; break; +#endif /* B75 */ +#if defined (B110) + case 110: newbaudrate = B110; break; +#endif /* B110 */ +#if defined (B134) + case 134: newbaudrate = B134; break; +#endif /* B134 */ +#if defined (B150) + case 150: newbaudrate = B150; break; +#endif /* B150 */ +#if defined (B200) + case 200: newbaudrate = B200; break; +#endif /* B200 */ +#if defined (B300) + case 300: newbaudrate = B300; break; +#endif /* B300 */ +#if defined (B600) + case 600: newbaudrate = B600; break; +#endif /* B600 */ +#if defined (B1200) + case 1200: newbaudrate = B1200; break; +#endif /* B1200 */ +#if defined (B1800) + case 1800: newbaudrate = B1800; break; +#endif /* B1800 */ +#if defined (B2400) + case 2400: newbaudrate = B2400; break; +#endif /* B2400 */ +#if defined (B4800) + case 4800: newbaudrate = B4800; break; +#endif /* B4800 */ +#if defined (B9600) + case 9600: newbaudrate = B9600; break; +#endif /* B9600 */ +#if defined (B19200) + case 19200: newbaudrate = B19200; break; +#endif /* B19200 */ +#if defined (B38400) + case 38400: newbaudrate = B38400; break; +#endif /* B38400 */ +#if defined (B56000) + case 56000: newbaudrate = B56000; break; +#endif /* B56000 */ +#if defined (B57600) + case 57600: newbaudrate = B57600; break; +#endif /* B57600 */ +#if defined (B76800) + case 76800: newbaudrate = B76800; break; +#endif /* B76800 */ +#if defined (B115200) + case 115200: newbaudrate = B115200; break; +#endif /* B115200 */ +#if defined (B128000) + case 128000: newbaudrate = B128000; break; +#endif /* B128000 */ +#if defined (B153600) + case 153600: newbaudrate = B153600; break; +#endif /* B153600 */ +#if defined (B230400) + case 230400: newbaudrate = B230400; break; +#endif /* B230400 */ +#if defined (B307200) + case 307200: newbaudrate = B307200; break; +#endif /* B307200 */ +#if defined (B256000) + case 256000: newbaudrate = B256000; break; +#endif /* B256000 */ +#if defined (B460800) + case 460800: newbaudrate = B460800; break; +#endif /* B460800 */ +#if defined (B500000) + case 500000: newbaudrate = B500000; break; +#endif /* B500000 */ +#if defined (B576000) + case 576000: newbaudrate = B576000; break; +#endif /* B576000 */ +#if defined (B921600) + case 921600: newbaudrate = B921600; break; +#endif /* B921600 */ +#if defined (B1000000) + case 1000000: newbaudrate = B1000000; break; +#endif /* B1000000 */ +#if defined (B1152000) + case 1152000: newbaudrate = B1152000; break; +#endif /* B1152000 */ +#if defined (B1500000) + case 1500000: newbaudrate = B1500000; break; +#endif /* B1500000 */ +#if defined (B2000000) + case 2000000: newbaudrate = B2000000; break; +#endif /* B2000000 */ +#if defined (B2500000) + case 2500000: newbaudrate = B2500000; break; +#endif /* B2500000 */ +#if defined (B3000000) + case 3000000: newbaudrate = B3000000; break; +#endif /* B3000000 */ +#if defined (B3500000) + case 3500000: newbaudrate = B3500000; break; +#endif /* B3500000 */ +#if defined (B4000000) + case 4000000: newbaudrate = B4000000; break; +#endif /* B4000000 */ + default: + return -1; + } + +#if defined (ACE_HAS_TERMIOS) + // Can you really have different input and output baud rates?! + if (cfsetospeed (&devpar, newbaudrate) == -1) + return -1; + if (cfsetispeed (&devpar, newbaudrate) == -1) + return -1; +#else + devpar.c_cflag &= ~CBAUD; +# if defined (CBAUDEX) + devpar.c_cflag &= ~CBAUDEX; +# endif /* CBAUDEX */ + devpar.c_cflag |= newbaudrate; +#endif /* ACE_HAS_TERMIOS */ + + devpar.c_cflag &= ~CSIZE; + switch (arg->databits) + { + case 5: + devpar.c_cflag |= CS5; + break; + case 6: + devpar.c_cflag |= CS6; + break; + case 7: + devpar.c_cflag |= CS7; + break; + case 8: + devpar.c_cflag |= CS8; + break; + default: + return -1; + } + + switch (arg->stopbits) + { + case 1: + devpar.c_cflag &= ~CSTOPB; + break; + case 2: + devpar.c_cflag |= CSTOPB; + break; + default: + return -1; + } + + if (arg->paritymode) + { + if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_ODD) == 0) + { + devpar.c_cflag |= PARENB; + devpar.c_cflag |= PARODD; + } + else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_EVEN) == 0) + { + devpar.c_cflag |= PARENB; + devpar.c_cflag &= ~PARODD; + } + else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_NONE) == 0) + devpar.c_cflag &= ~PARENB; + else + return -1; + } + else + { + devpar.c_cflag &= ~PARENB; + } + +#if defined (CNEW_RTSCTS) + if ((arg->ctsenb) || (arg->rtsenb)) // Enable RTS/CTS protocol + devpar.c_cflag |= CNEW_RTSCTS; + else + devpar.c_cflag &= ~CNEW_RTSCTS; +#elif defined (CRTSCTS) + if ((arg->ctsenb) || (arg->rtsenb)) // Enable RTS/CTS protocol + devpar.c_cflag |= CRTSCTS; + else + devpar.c_cflag &= ~CRTSCTS; +#endif /* NEW_RTSCTS || CRTSCTS */ + +#if defined (CREAD) + // Enable/disable receiver + if (arg->rcvenb) + devpar.c_cflag |= CREAD; + else + devpar.c_cflag &= ~CREAD; +#endif /* CREAD */ + +#if defined (HUPCL) + // Cause DTR to drop after port close. + devpar.c_cflag |= HUPCL; +#endif /* HUPCL */ + +#if defined (CLOCAL) + // If device is not a modem set to local device. + if (arg->modem) + devpar.c_cflag &= ~CLOCAL; + else + devpar.c_cflag |= CLOCAL; +#endif /* CLOCAL */ + + devpar.c_iflag = IGNPAR | INPCK; + if (arg->databits < 8) + devpar.c_iflag |= ISTRIP; + +#if defined (IGNBRK) + // If device is not a modem set to ignore break points + if(arg->modem) + devpar.c_iflag &= ~IGNBRK; + else + devpar.c_iflag |= IGNBRK; +#endif /* IGNBRK */ + +#if defined (IXOFF) + // Enable/disable software flow control on input + if (arg->xinenb) + devpar.c_iflag |= IXOFF; + else + devpar.c_iflag &= ~IXOFF; +#endif /* IXOFF */ + +#if defined (IXON) + // Enable/disable software flow control on output + if (arg->xoutenb) + devpar.c_iflag |= IXON; + else + devpar.c_iflag &= ~IXON; +#endif /* IXON */ + +#if defined (ICANON) + // Enable noncanonical input processing mode + devpar.c_lflag &= ~ICANON; +#endif /* ICANON */ + +#if defined (ECHO) + // Disable echoing of input characters + devpar.c_lflag &= ~ECHO; +#endif /* ECHO */ + +#if defined (ECHOE) + // Disable echoing erase chareacter as BS-SP-BS + devpar.c_lflag &= ~ECHOE; +#endif /* ECHOE */ + +#if defined (ISIG) + // Disable SIGINTR, SIGSUSP, SIGDSUSP and SIGQUIT signals + devpar.c_lflag &= ~ISIG; +#endif /* ISIG */ + +#if defined (OPOST) + // Disable post-processing of output data + devpar.c_oflag &= ~OPOST; +#endif /* OPOST */ + + if (arg->readtimeoutmsec < 0) + { + // Settings for infinite timeout. + devpar.c_cc[VTIME] = 0; + // In case of infinite timeout [VMIN] must be at least 1. + if (arg->readmincharacters > UCHAR_MAX) + devpar.c_cc[VMIN] = UCHAR_MAX; + else if (arg->readmincharacters < 1) + devpar.c_cc[VMIN] = 1; + else + devpar.c_cc[VMIN] = static_cast(arg->readmincharacters); + } + else + { + devpar.c_cc[VTIME] = static_cast(arg->readtimeoutmsec / 100); + + if (arg->readmincharacters > UCHAR_MAX) + devpar.c_cc[VMIN] = UCHAR_MAX; + else if (arg->readmincharacters < 1) + devpar.c_cc[VMIN] = 0; + else + devpar.c_cc[VMIN] = static_cast(arg->readmincharacters); + } + +#if defined (TIOCMGET) + int status; + this->ACE_IO_SAP::control (TIOCMGET, &status); + + if (arg->dtrdisable) + status &= ~TIOCM_DTR; + else + status |= TIOCM_DTR; + + this->ACE_IO_SAP::control (TIOCMSET, &status); +#endif /* definded (TIOCMGET) */ + +#if defined (ACE_HAS_TERMIOS) + return tcsetattr (get_handle (), TCSANOW, &devpar); +#elif defined (TCSETS) + return this->ACE_IO_SAP::control (TCSETS, static_cast(&devpar)); +#elif defined (TCSETA) + return this->ACE_IO_SAP::control (TCSETA, static_cast(&devpar)); +#else + errno = ENOSYS; + return -1; +#endif /* ACE_HAS_TERMIOS */ + + case GETPARAMS: + return -1; // Not yet implemented. + default: + return -1; // Wrong cmd. + } +#elif defined (ACE_WIN32) + DCB dcb; + dcb.DCBlength = sizeof dcb; + if (!::GetCommState (this->get_handle (), &dcb)) + { + ACE_OS::set_errno_to_last_error (); + return -1; + } + + COMMTIMEOUTS timeouts; + if (!::GetCommTimeouts (this->get_handle(), &timeouts)) + { + ACE_OS::set_errno_to_last_error (); + return -1; + } + + switch (cmd) + { + case SETPARAMS: + dcb.BaudRate = arg->baudrate; + + switch (arg->databits) + { + case 4: + case 5: + case 6: + case 7: + case 8: + dcb.ByteSize = arg->databits; + break; + default: + return -1; + } + + switch (arg->stopbits) + { + case 1: + dcb.StopBits = ONESTOPBIT; + break; + case 2: + dcb.StopBits = TWOSTOPBITS; + break; + default: + return -1; + } + + if (arg->paritymode) + { + dcb.fParity = TRUE; + if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_ODD) == 0) + dcb.Parity = ODDPARITY; + else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_EVEN) == 0) + dcb.Parity = EVENPARITY; + else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_NONE) == 0) + dcb.Parity = NOPARITY; + else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_MARK) == 0) + dcb.Parity = MARKPARITY; + else if (ACE_OS::strcasecmp (arg->paritymode, ACE_TTY_IO_SPACE) == 0) + dcb.Parity = SPACEPARITY; + else + return -1; + } + else + { + dcb.fParity = FALSE; + dcb.Parity = NOPARITY; + } + + // Enable/disable RTS protocol. + switch (arg->rtsenb) + { + case 1: + dcb.fRtsControl = RTS_CONTROL_ENABLE; + break; + case 2: + dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; + break; + case 3: + dcb.fRtsControl = RTS_CONTROL_TOGGLE; + break; + default: + dcb.fRtsControl = RTS_CONTROL_DISABLE; + } + + // Enable/disable CTS protocol. + if (arg->ctsenb) + dcb.fOutxCtsFlow = TRUE; + else + dcb.fOutxCtsFlow = FALSE; + + // Enable/disable DSR protocol. + if (arg->dsrenb) + dcb.fOutxDsrFlow = TRUE; + else + dcb.fOutxDsrFlow = FALSE; + + // Disable/enable DTR protocol + if (arg->dtrdisable) + dcb.fDtrControl = DTR_CONTROL_DISABLE; + else + dcb.fDtrControl = DTR_CONTROL_ENABLE; + + // Enable/disable software flow control on input + if (arg->xinenb) + dcb.fInX = TRUE; + else + dcb.fInX = FALSE; + + // Enable/disable software flow control on output + if (arg->xoutenb) + dcb.fOutX = TRUE; + else + dcb.fOutX = FALSE; + + // Always set limits unless set to negative to use default. + if (arg->xonlim >= 0) + dcb.XonLim = static_cast(arg->xonlim); + if (arg->xofflim >= 0) + dcb.XoffLim = static_cast(arg->xofflim); + + dcb.fAbortOnError = FALSE; + dcb.fErrorChar = FALSE; + dcb.fNull = FALSE; + dcb.fBinary = TRUE; + + if (!::SetCommState (this->get_handle (), &dcb)) + { + ACE_OS::set_errno_to_last_error (); + return -1; + } + + if (arg->readtimeoutmsec < 0) + { + // Settings for infinite timeout. + timeouts.ReadIntervalTimeout = 0; + timeouts.ReadTotalTimeoutMultiplier = 0; + timeouts.ReadTotalTimeoutConstant = 0; + } + else if (arg->readtimeoutmsec == 0) + { + // Return immediately if no data in the input buffer. + timeouts.ReadIntervalTimeout = MAXDWORD; + timeouts.ReadTotalTimeoutMultiplier = 0; + timeouts.ReadTotalTimeoutConstant = 0; + } + else + { + // Wait for specified timeout for char to arrive before returning. + timeouts.ReadIntervalTimeout = MAXDWORD; + timeouts.ReadTotalTimeoutMultiplier = MAXDWORD; + timeouts.ReadTotalTimeoutConstant = arg->readtimeoutmsec; + } + + if (!::SetCommTimeouts (this->get_handle (), &timeouts)) + { + ACE_OS::set_errno_to_last_error (); + return -1; + } + + return 0; + + case GETPARAMS: + arg->baudrate = dcb.BaudRate; + + switch (dcb.ByteSize) + { + case 4: + case 5: + case 6: + case 7: + case 8: + arg->databits = dcb.ByteSize; + break; + default: + return -1; + } + + switch (dcb.StopBits) + { + case ONESTOPBIT: + arg->stopbits = 1; + break; + case TWOSTOPBITS: + arg->stopbits = 2; + break; + default: + return -1; + } + + if (!dcb.fParity) + { + arg->paritymode = ACE_TTY_IO_NONE; + } + else + { + switch (dcb.Parity) + { + case ODDPARITY: + arg->paritymode = ACE_TTY_IO_ODD; + break; + case EVENPARITY: + arg->paritymode = ACE_TTY_IO_EVEN; + break; + case NOPARITY: + arg->paritymode = ACE_TTY_IO_NONE; + break; + case MARKPARITY: + arg->paritymode = ACE_TTY_IO_MARK; + break; + case SPACEPARITY: + arg->paritymode = ACE_TTY_IO_SPACE; + break; + default: + return -1; + } + } + + // Enable/disable RTS protocol. + switch (dcb.fRtsControl) + { + case RTS_CONTROL_ENABLE: + arg->rtsenb = 1; + break; + case RTS_CONTROL_HANDSHAKE: + arg->rtsenb = 2; + break; + case RTS_CONTROL_TOGGLE: + arg->rtsenb = 3; + break; + case RTS_CONTROL_DISABLE: + arg->rtsenb = 0; + break; + default: + return -1; + } + + // Enable/disable CTS protocol. + if (dcb.fOutxCtsFlow) + arg->ctsenb = true; + else + arg->ctsenb = false; + + // Enable/disable DSR protocol. + if (dcb.fOutxDsrFlow) + arg->dsrenb = true; + else + arg->dsrenb = false; + + // Disable/enable DTR protocol + // Attention: DTR_CONTROL_HANDSHAKE is not supported. + switch (dcb.fDtrControl) + { + case DTR_CONTROL_DISABLE: + arg->dtrdisable = true; + break; + case DTR_CONTROL_ENABLE: + arg->dtrdisable = false; + break; + default: + return -1; + } + + // Enable/disable software flow control on input + if (dcb.fInX) + arg->xinenb = true; + else + arg->xinenb = false; + + // Enable/disable software flow control on output + if (dcb.fOutX) + arg->xoutenb = true; + else + arg->xoutenb = false; + + arg->xonlim = static_cast(dcb.XonLim); + arg->xofflim = static_cast(dcb.XoffLim); + + if (timeouts.ReadIntervalTimeout == 0 && + timeouts.ReadTotalTimeoutMultiplier == 0 && + timeouts.ReadTotalTimeoutConstant == 0) + arg->readtimeoutmsec = -1; + else + arg->readtimeoutmsec = timeouts.ReadTotalTimeoutConstant; + + return 0; + + default: + return -1; // Wrong cmd. + + } // arg switch +#else + ACE_UNUSED_ARG (cmd); + ACE_UNUSED_ARG (arg); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_TERMIOS || ACE_HAS_TERMIO */ +} + +#if defined (ACE_NEEDS_DEV_IO_CONVERSION) +ACE_TTY_IO::operator ACE_DEV_IO &() +{ + return static_cast(*this); +} +#endif /* ACE_NEEDS_DEV_IO_CONVERSION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/TTY_IO.h b/externals/ace/TTY_IO.h new file mode 100644 index 0000000..1029966 --- /dev/null +++ b/externals/ace/TTY_IO.h @@ -0,0 +1,113 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file TTY_IO.h + * + * $Id: TTY_IO.h 82271 2008-07-09 09:23:03Z olli $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TTY_IO_H +#define ACE_TTY_IO_H + +#include "ace/DEV_IO.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_TTY_IO + * + * @brief Class definitions for platform specific TTY features. + * + * This class represents an example interface for a specific + * device (a serial line). It extends the capability of the + * underlying DEV_IO class by adding a control method that takes + * a special structure (Serial_Params) as argument to allow a + * comfortable user interface (away from that annoying termios + * structure, which is very specific to UNIX). + */ +class ACE_Export ACE_TTY_IO : public ACE_DEV_IO +{ +public: + enum Control_Mode + { + SETPARAMS, ///< Set control parameters. + GETPARAMS ///< Get control parameters. + }; + + struct ACE_Export Serial_Params + { + Serial_Params (void); + + /** Specifies the baudrate at which the communnication port operates. */ + int baudrate; + /** Specifies the minimum number of bytes in input buffer before XON char + is sent. Negative value indicates that default value should + be used (Win32). */ + int xonlim; + /** Specifies the maximum number of bytes in input buffer before XOFF char + is sent. Negative value indicates that default value should + be used (Win32). */ + int xofflim; + /** Specifies the minimum number of characters for non-canonical + read (POSIX). */ + unsigned int readmincharacters; + /** Specifies the time to wait before returning from read. Negative value + means infinite timeout. */ + int readtimeoutmsec; + /** Specifies the parity mode. POSIX supports "none", "even" and + "odd" parity. Additionally Win32 supports "mark" and "space" + parity modes. */ + const char *paritymode; + /** Enable & set CTS mode. Note that RTS & CTS are enabled/disabled + together on some systems (RTS/CTS is enabled if either + ctsenb or rtsenb is set). */ + bool ctsenb; + /** Enable & set RTS mode. Note that RTS & CTS are enabled/disabled + together on some systems (RTS/CTS is enabled if either + ctsenb or rtsenb is set). + - 0 = Disable RTS. + - 1 = Enable RTS. + - 2 = Enable RTS flow-control handshaking (Win32). + - 3 = Specifies that RTS line will be high if bytes are available + for transmission. After transmission RTS will be low (Win32). */ + unsigned char rtsenb; + /** Enable/disable software flow control on input. */ + bool xinenb; + /** Enable/disable software flow control on output. */ + bool xoutenb; + /** Specifies if device is a modem (POSIX). If not set modem status + lines are ignored. */ + bool modem; + /** Enable/disable receiver (POSIX). */ + bool rcvenb; + /** Controls whether DSR is disabled or enabled (Win32). */ + bool dsrenb; + /** Controls whether DTR is disabled or enabled. */ + bool dtrdisable; + /** Data bits. Valid values 5, 6, 7 and 8 data bits. + Additionally Win32 supports 4 data bits. */ + unsigned char databits; + /** Stop bits. Valid values are 1 and 2. */ + unsigned char stopbits; + }; + + /** Interface for reading/writing serial device parameters. */ + int control (Control_Mode cmd, Serial_Params *arg) const; + +#if defined (ACE_NEEDS_DEV_IO_CONVERSION) + /** This is necessary to pass ACE_TTY_IO as parameter to DEV_Connector. */ + operator ACE_DEV_IO &(); +#endif /* ACE_NEEDS_DEV_IO_CONVERSION */ +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TTY_IO_H */ diff --git a/externals/ace/Task.cpp b/externals/ace/Task.cpp new file mode 100644 index 0000000..b3d8aad --- /dev/null +++ b/externals/ace/Task.cpp @@ -0,0 +1,299 @@ +// $Id: Task.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Task.h" +#include "ace/Module.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Task.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_RCSID (ace, + Task, + "$Id: Task.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man) + : thr_count_ (0), + thr_mgr_ (thr_man), + flags_ (0), + grp_id_ (-1) +#if !(defined (ACE_MVS) || defined(__TANDEM)) + ,last_thread_id_ (0) +#endif /* !defined (ACE_MVS) */ +{ +#if (defined (ACE_MVS) || defined(__TANDEM)) + ACE_OS::memset( &this->last_thread_id_, '\0', sizeof( this->last_thread_id_ )); +#endif /* defined (ACE_MVS) */ +} + +ACE_Task_Base::~ACE_Task_Base (void) +{ +} + +// Default ACE_Task service routine + +int +ACE_Task_Base::svc (void) +{ + ACE_TRACE ("ACE_Task_Base::svc"); + return 0; +} + +// Default ACE_Task open routine + +int +ACE_Task_Base::open (void *) +{ + ACE_TRACE ("ACE_Task_Base::open"); + return 0; +} + +// Default ACE_Task close routine + +int +ACE_Task_Base::close (u_long) +{ + ACE_TRACE ("ACE_Task_Base::close"); + return 0; +} + +// Forward the call to close() so that existing applications don't +// break. + +int +ACE_Task_Base::module_closed (void) +{ + return this->close (1); +} + +// Default ACE_Task put routine. + +int +ACE_Task_Base::put (ACE_Message_Block *, ACE_Time_Value *) +{ + ACE_TRACE ("ACE_Task_Base::put"); + return 0; +} + +// Wait for all threads running in a task to exit. + +int +ACE_Task_Base::wait (void) +{ + ACE_TRACE ("ACE_Task_Base::wait"); + + // If we don't have a thread manager, we probably were never + // activated. + if (this->thr_mgr () != 0) + return this->thr_mgr ()->wait_task (this); + else + return 0; +} + +// Suspend a task. +int +ACE_Task_Base::suspend (void) +{ + ACE_TRACE ("ACE_Task_Base::suspend"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + if (this->thr_count_ > 0) + return this->thr_mgr_->suspend_task (this); + + return 0; +} + +// Resume a suspended task. +int +ACE_Task_Base::resume (void) +{ + ACE_TRACE ("ACE_Task_Base::resume"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + if (this->thr_count_ > 0) + return this->thr_mgr_->resume_task (this); + + return 0; +} + +int +ACE_Task_Base::activate (long flags, + int n_threads, + int force_active, + long priority, + int grp_id, + ACE_Task_Base *task, + ACE_hthread_t thread_handles[], + void *stack[], + size_t stack_size[], + ACE_thread_t thread_ids[], + const char* thr_name[]) +{ + ACE_TRACE ("ACE_Task_Base::activate"); + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + + // If the task passed in is zero, we will use + if (task == 0) + task = this; + + if (this->thr_count_ > 0 && force_active == 0) + return 1; // Already active. + else + { + if (this->thr_count_ > 0 && this->grp_id_ != -1) + // If we're joining an existing group of threads then make + // sure to use its group id. + grp_id = this->grp_id_; + this->thr_count_ += n_threads; + } + + // Use the ACE_Thread_Manager singleton if we're running as an + // active object and the caller didn't supply us with a + // Thread_Manager. + if (this->thr_mgr_ == 0) +# if defined (ACE_THREAD_MANAGER_LACKS_STATICS) + this->thr_mgr_ = ACE_THREAD_MANAGER_SINGLETON::instance (); +# else /* ! ACE_THREAD_MANAGER_LACKS_STATICS */ + this->thr_mgr_ = ACE_Thread_Manager::instance (); +# endif /* ACE_THREAD_MANAGER_LACKS_STATICS */ + + int grp_spawned = -1; + if (thread_ids == 0) + // Thread Ids were not specified + grp_spawned = + this->thr_mgr_->spawn_n (n_threads, + &ACE_Task_Base::svc_run, + (void *) this, + flags, + priority, + grp_id, + task, + thread_handles, + stack, + stack_size, + thr_name); + else + // thread names were specified + grp_spawned = + this->thr_mgr_->spawn_n (thread_ids, + n_threads, + &ACE_Task_Base::svc_run, + (void *) this, + flags, + priority, + grp_id, + stack, + stack_size, + thread_handles, + task, + thr_name); + if (grp_spawned == -1) + { + // If spawn_n fails, restore original thread count. + this->thr_count_ -= n_threads; + return -1; + } + + if (this->grp_id_ == -1) + this->grp_id_ = grp_spawned; + +#if defined (ACE_MVS) || defined(__TANDEM) + ACE_OS::memcpy( &this->last_thread_id_, '\0', sizeof(this->last_thread_id_)); +#else + this->last_thread_id_ = 0; // Reset to prevent inadvertant match on ID +#endif /* defined (ACE_MVS) */ + + return 0; + +#else + { + // Keep the compiler from complaining. + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (n_threads); + ACE_UNUSED_ARG (force_active); + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (grp_id); + ACE_UNUSED_ARG (task); + ACE_UNUSED_ARG (thread_handles); + ACE_UNUSED_ARG (stack); + ACE_UNUSED_ARG (stack_size); + ACE_UNUSED_ARG (thread_ids); + ACE_UNUSED_ARG (thr_name); + ACE_NOTSUP_RETURN (-1); + } +#endif /* ACE_MT_SAFE */ +} + +void +ACE_Task_Base::cleanup (void *object, void *) +{ + ACE_Task_Base *t = (ACE_Task_Base *) object; + + // The thread count must be decremented first in case the + // hook does something crazy like "delete this". + { + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, t->lock_)); + t->thr_count_--; + if (0 == t->thr_count_) + t->last_thread_id_ = ACE_Thread::self (); + } + + // @@ Is it possible to pass in the exit status somehow? + t->close (); + // t is undefined here. close() could have deleted it. +} + + +#if defined (ACE_HAS_SIG_C_FUNC) +extern "C" void +ACE_Task_Base_cleanup (void *object, void *) +{ + ACE_Task_Base::cleanup (object, 0); +} +#endif /* ACE_HAS_SIG_C_FUNC */ + +ACE_THR_FUNC_RETURN +ACE_Task_Base::svc_run (void *args) +{ + ACE_TRACE ("ACE_Task_Base::svc_run"); + + ACE_Task_Base *t = (ACE_Task_Base *) args; + + // Register ourself with our 's thread exit hook + // mechanism so that our close() hook will be sure to get invoked + // when this thread exits. + +#if defined ACE_HAS_SIG_C_FUNC + t->thr_mgr ()->at_exit (t, ACE_Task_Base_cleanup, 0); +#else + t->thr_mgr ()->at_exit (t, ACE_Task_Base::cleanup, 0); +#endif /* ACE_HAS_SIG_C_FUNC */ + + // Call the Task's svc() hook method. + int const svc_status = t->svc (); + ACE_THR_FUNC_RETURN status; +#if defined (ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN) + // Reinterpret case between integral types is not mentioned in the C++ spec + status = static_cast (svc_status); +#else + status = reinterpret_cast (svc_status); +#endif /* ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN */ + +// If we changed this zero change the other if in OS.cpp Thread_Adapter::invoke +#if 1 + // Call the close> hook. + ACE_Thread_Manager *thr_mgr_ptr = t->thr_mgr (); + + // This calls the Task->close () hook. + t->cleanup (t, 0); + + // This prevents a second invocation of the cleanup code + // (called later by . + thr_mgr_ptr->at_exit (t, 0, 0); +#endif + return status; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Task.h b/externals/ace/Task.h new file mode 100644 index 0000000..f2ac03c --- /dev/null +++ b/externals/ace/Task.h @@ -0,0 +1,307 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Task.h + * + * $Id: Task.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TASK_H +#define ACE_TASK_H +#include /**/ "ace/pre.h" + +#include "ace/Service_Object.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Thread_Manager.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Task_Flags + * + * @brief These flags are used within the ACE_Task. + * + * These flags should be hidden within ACE_Task. Unfortunately, the + * HP/UX C++ compiler can't grok this... Fortunately, there's no + * code defined here, so we don't have to worry about multiple + * definitions. + */ +namespace ACE_Task_Flags +{ + enum + { + /// Identifies a Task as being the "reader" in a Module. + ACE_READER = 01, + /// Just flush data messages in the queue. + ACE_FLUSHDATA = 02, + /// Flush all messages in the Queue. + ACE_FLUSHALL = 04, + /// Flush read queue + ACE_FLUSHR = 010, + /// Flush write queue + ACE_FLUSHW = 020, + /// Flush both queues + ACE_FLUSHRW = 030 + }; +} + +/** + * @class ACE_Task_Base + * + * @brief Direct base class for the ACE_Task template. + * + * This class factors out the non-template code in order to + * reduce template bloat, as well as to make it possible for the + * ACE_Thread_Manager to store ACE_Task_Base *'s + * polymorphically. + */ +class ACE_Export ACE_Task_Base : public ACE_Service_Object +{ +public: + // = Initialization and termination methods. + /// Constructor. + ACE_Task_Base (ACE_Thread_Manager * = 0); + + /// Destructor. + virtual ~ACE_Task_Base (void); + + // = Initialization and termination hooks. + + // These methods should be overridden by subclasses if you'd like to + // provide -specific initialization and termination behavior. + + /// Hook called to initialize a task and prepare it for execution. + /// @a args can be used to pass arbitrary information into . + virtual int open (void *args = 0); + + /** + * Hook called from ACE_Thread_Exit when during thread exit and from + * the default implementation of . In general, this + * method shouldn't be called directly by an application, + * particularly if the is running as an Active Object. + * Instead, a special message should be passed into the via + * the method defined below, and the method should + * interpret this as a flag to shut down the . + */ + virtual int close (u_long flags = 0); + + /** + * Hook called during . The default + * implementation calls forwards the call to close(1). Please + * notice the changed value of the default argument of . + * This allows tasks to differ between the call has been originated + * from or from . Be aware that + * close(0) will be also called when a thread associated with the + * ACE_Task instance exits. + */ + virtual int module_closed (void); + + // = Immediate and deferred processing methods, respectively. + + // These methods should be overridden by subclasses if you'd like to + // provide -specific message processing behavior. + + /// A hook method that can be used to pass a message to a + /// task, where it can be processed immediately or queued for subsequent + /// processing in the hook method. + virtual int put (ACE_Message_Block *, ACE_Time_Value * = 0); + + /// Run by a daemon thread to handle deferred processing. + virtual int svc (void); + + // = Active object activation method. + /** + * Turn the task into an active object, i.e., having @a n_threads of + * control, all running at the @a priority level (see below) with the + * same @a grp_id, all of which invoke . Returns -1 if + * failure occurs, returns 1 if Task is already an active object and + * @a force_active is false (i.e., do *not* create a new thread in + * this case), and returns 0 if Task was not already an active + * object and a thread is created successfully or thread is an + * active object and @a force_active is true. Note that if + * @a force_active is true and there are already threads spawned in + * this , the @a grp_id parameter is ignored and the @a grp_id + * of any newly activated thread(s) will inherit the existing + * @a grp_id of the existing thread(s) in the . + * + * The <{flags}> are a bitwise-OR of the following: + * = BEGIN + * THR_CANCEL_DISABLE, THR_CANCEL_ENABLE, THR_CANCEL_DEFERRED, + * THR_CANCEL_ASYNCHRONOUS, THR_BOUND, THR_NEW_LWP, THR_DETACHED, + * THR_SUSPENDED, THR_DAEMON, THR_JOINABLE, THR_SCHED_FIFO, + * THR_SCHED_RR, THR_SCHED_DEFAULT, THR_EXPLICIT_SCHED, + * THR_SCOPE_SYSTEM, THR_SCOPE_PROCESS + * = END + * If THR_SCHED_INHERIT is not desirable, applications should + * specifically pass in THR_EXPLICIT_SCHED. + * + * + * By default, or if <{priority}> is set to + * ACE_DEFAULT_THREAD_PRIORITY, an "appropriate" priority value for + * the given scheduling policy (specified in <{flags}>, e.g., + * ) is used. This value is calculated + * dynamically, and is the median value between the minimum and + * maximum priority values for the given policy. If an explicit + * value is given, it is used. Note that actual priority values are + * EXTREMEMLY implementation-dependent, and are probably best + * avoided. + * + * If @a thread_handles != 0 it is assumed to be an array of @a n + * thread_handles that will be assigned the values of the thread + * handles being spawned. Returns -1 on failure (@c errno will + * explain...), otherwise returns the group id of the threads. + * + * Assigning @a task allows you to associate the newly spawned + * threads with an instance of ACE_Task_Base. If @a task == 0, then + * the new threads are associated automatically with @c this + * ACE_Task_Base. Setting the @a task argument to value other than + * @c this makes the thread manipulating methods, such as wait(), + * suspend(), resume(), useless. Threads spawned with user + * specified @a task value must therefore be manipulated thru + * ACE_Thread_Manager directly. + * + * If @a stack != 0 it is assumed to be an array of @a n pointers to + * the base of the stacks to use for the threads being spawned. + * Likewise, if @a stack_size != 0 it is assumed to be an array of + * @a n values indicating how big each of the corresponding @a stacks + * are. + * + * + */ + virtual int activate (long flags = THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, + int n_threads = 1, + int force_active = 0, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + ACE_Task_Base *task = 0, + ACE_hthread_t thread_handles[] = 0, + void *stack[] = 0, + size_t stack_size[] = 0, + ACE_thread_t thread_ids[] = 0, + const char* thr_name[] = 0); + + /** + * Block until there are no more threads running in this task. + * This method will not wait for either detached or daemon threads; + * the threads must have been spawned with the @c THR_JOINABLE flag. + * Upon successful completion, the threads have been joined, so further + * attempts to join with any of the waited-for threads will fail. + * + * @retval 0 Success. + * @retval -1 Failure (consult errno for further information). + */ + virtual int wait (void); + + // = Suspend/resume a Task. + + // Note that these methods are not portable and should be avoided + // since they are inherently error-prone to use. They are only here + // for (the rare) applications that know how to use them correctly. + /// Suspend a task. + virtual int suspend (void); + /// Resume a suspended task. + virtual int resume (void); + + /// Get the current group id. + int grp_id (void) const; + + /// Set the current group id. + void grp_id (int); + + /// Get the thread manager associated with this Task. + ACE_Thread_Manager *thr_mgr (void) const; + + /// Set the thread manager associated with this Task. + void thr_mgr (ACE_Thread_Manager *); + + /// True if queue is a reader, else false. + int is_reader (void) const; + + /// True if queue is a writer, else false. + int is_writer (void) const; + + /** + * Returns the number of threads currently running within a task. + * If we're a passive object this value is 0, else it's greater than + * 0. + */ + size_t thr_count (void) const; + + /** + * Returns the thread ID of the thread whose exit caused this object's + * thread count to be decremented to 0. + * + * When a thread spawned in the context of this object (using activate()) + * returns from its svc() method ACE calls the close() hook. Before it does + * so, it decrements the number of active threads. If the number of threads + * is decremented to 0, the thread ID of the current thread is stored for + * access by this method. If the returned thread ID matches the calling + * thread's ID, the calling thread knows that there are no other threads + * still active in the ACE_Task. + * + * @retval ACE_thread_t of the last thread to close. 0 if the last thread + * is not yet known; for example, if no threads are active, or if + * multiple threads are active. + */ + ACE_thread_t last_thread (void) const; + + /// Routine that runs the service routine as a daemon thread. + static ACE_THR_FUNC_RETURN svc_run (void *); + + /// Cleanup hook that is called when a thread exits to gracefully + /// shutdown an ACE_Task. + static void cleanup (void *object, void *params); + +protected: + /** + * Count of the number of threads running within the task. If this + * value is greater than 0 then we're an active object and the value + * of is the number of active threads at this instant. + * If the value == 0, then we're a passive object. + */ + size_t thr_count_; + + /// Multi-threading manager. + ACE_Thread_Manager *thr_mgr_; + + /// ACE_Task flags. + u_long flags_; + + /// This maintains the group id of the Task. + int grp_id_; + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// Protect the state of a Task during concurrent operations, but + /// only if we're configured as MT safe... + ACE_Thread_Mutex lock_; +#endif /* ACE_MT_SAFE */ + + /// Holds the thread ID of the last thread to exit svc() in this object. + ACE_thread_t last_thread_id_; + +private: + + // = Disallow these operations. + ACE_Task_Base &operator= (const ACE_Task_Base &); + ACE_Task_Base (const ACE_Task_Base &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Task.inl" +#endif /* __ACE_INLINE__ */ + +// Include the ACE_Task templates classes at this point. +#include "ace/Task_T.h" + +#include /**/ "ace/post.h" +#endif /* ACE_TASK_H */ diff --git a/externals/ace/Task.inl b/externals/ace/Task.inl new file mode 100644 index 0000000..9f70371 --- /dev/null +++ b/externals/ace/Task.inl @@ -0,0 +1,77 @@ +// -*- C++ -*- +// +// $Id: Task.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Get the current group id. +ACE_INLINE int +ACE_Task_Base::grp_id (void) const +{ + ACE_TRACE ("ACE_Task_Base::grp_id"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, const_cast (this->lock_), -1)); + return this->grp_id_; +} + +// Set the current group id. + +ACE_INLINE void +ACE_Task_Base::grp_id (int identifier) +{ + ACE_TRACE ("ACE_Task_Base::grp_id"); + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); + + // Cache the group id in the task and then set it in the + // Thread_Manager, if there is one. + this->grp_id_ = identifier; + if (this->thr_mgr ()) + this->thr_mgr ()->set_grp (this, identifier); +} + +ACE_INLINE ACE_Thread_Manager * +ACE_Task_Base::thr_mgr (void) const +{ + ACE_TRACE ("ACE_Task_Base::thr_mgr"); + return this->thr_mgr_; +} + +ACE_INLINE void +ACE_Task_Base::thr_mgr (ACE_Thread_Manager *thr_mgr) +{ + ACE_TRACE ("ACE_Task_Base::thr_mgr"); + this->thr_mgr_ = thr_mgr; +} + +ACE_INLINE int +ACE_Task_Base::is_reader (void) const +{ + ACE_TRACE ("ACE_Task_Base::is_reader"); + return (ACE_BIT_ENABLED (this->flags_, ACE_Task_Flags::ACE_READER)); +} + +ACE_INLINE int +ACE_Task_Base::is_writer (void) const +{ + ACE_TRACE ("ACE_Task_Base::is_writer"); + return (ACE_BIT_DISABLED (this->flags_, ACE_Task_Flags::ACE_READER)); +} + +// Return the count of the current number of threads. +ACE_INLINE size_t +ACE_Task_Base::thr_count (void) const +{ + ACE_TRACE ("ACE_Task_Base::thr_count"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, const_cast (this->lock_), 0)); + + return this->thr_count_; +} + +// Return the thread ID of the last thread to exit svc(). +ACE_INLINE ACE_thread_t +ACE_Task_Base::last_thread (void) const +{ + ACE_TRACE ("ACE_Task_Base::last_thread"); + return this->last_thread_id_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Task_Ex_T.cpp b/externals/ace/Task_Ex_T.cpp new file mode 100644 index 0000000..de97e5b --- /dev/null +++ b/externals/ace/Task_Ex_T.cpp @@ -0,0 +1,114 @@ +// $Id: Task_Ex_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TASK_EX_T_CPP +#define ACE_TASK_EX_T_CPP + +#include "ace/Task_Ex_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Module.h" +#include "ace/Null_Condition.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Task_Ex_T.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template void +ACE_Task_Ex::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Task_Ex::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_)); + this->msg_queue_->dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags = %x"), this->flags_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmod_ = %x"), this->mod_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_count_ = %d"), this->thr_count_)); +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + this->lock_.dump (); +#endif /* ACE_MT_SAFE */ + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// If the user doesn't supply a ACE_Message_Queue_Ex pointer then we'll +// allocate one dynamically. Otherwise, we'll use the one they give. + +template +ACE_Task_Ex::ACE_Task_Ex (ACE_Thread_Manager *thr_man, + ACE_Message_Queue_Ex *mq) + : ACE_Task_Base (thr_man), + msg_queue_ (0), + delete_msg_queue_ (false), + mod_ (0), + next_ (0) +{ + ACE_TRACE ("ACE_Task_Ex::ACE_Task_Ex"); + + if (mq == 0) + { + ACE_NEW (mq, + (ACE_Message_Queue_Ex)); + this->delete_msg_queue_ = true; + } + + this->msg_queue_ = mq; +} + +template +ACE_Task_Ex::~ACE_Task_Ex (void) +{ + ACE_TRACE ("ACE_Task_Ex::~ACE_Task_Ex"); + if (this->delete_msg_queue_) + delete this->msg_queue_; + + // These assignments aren't strickly necessary but they help guard + // against odd race conditions... + this->delete_msg_queue_ = false; +} + +template ACE_Task * +ACE_Task_Ex::sibling (void) +{ + ACE_TRACE ("ACE_Task_Ex::sibling"); + /// @todo FIXME Need to impl ACE_Moudle to support ACE_Task as well. + /// Now always return 0 for sibling + return 0; +/* + if (this->mod_ == 0) + return 0; + else + return this->mod_->sibling (this); +*/ +} + +template const ACE_TCHAR * +ACE_Task_Ex::name (void) const +{ + ACE_TRACE ("ACE_Task_Ex::name"); + if (this->mod_ == 0) + return 0; + else + return this->mod_->name (); +} + +template ACE_Module * +ACE_Task_Ex::module (void) const +{ + ACE_TRACE ("ACE_Task_Ex::module"); + return this->mod_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TASK_EX_T_CPP */ diff --git a/externals/ace/Task_Ex_T.h b/externals/ace/Task_Ex_T.h new file mode 100644 index 0000000..00233d4 --- /dev/null +++ b/externals/ace/Task_Ex_T.h @@ -0,0 +1,205 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Task_Ex_T.h + * + * $Id: Task_Ex_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Kobi Cohen-Arazi + */ +//============================================================================= + +#ifndef ACE_TASK_EX_T_H +#define ACE_TASK_EX_T_H +#include /**/ "ace/pre.h" + +#include "ace/Service_Object.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Synch_Traits.h" +#include "ace/Task.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decls... +template class ACE_Module; + +/** + * @class ACE_Task_Ex + * + * @brief Primary interface for application message processing, as well + * as input and output message queueing. + * + * Unlike ACE_Task, these class doesn't have the ability to be a part of + * a Stream chain. I.e. You cannot (yet) chain modules based on ACE_Task_Ex. + * + * @todo: We can merge ACE_Task and ACE_Task_Ex to be one class. + * something like that: + * template + * class ACE_Task : public ACE_Task_Base + * { + * // use here the code from ACE_Task_Ex using ACE_Message_Queue_Ex + * }; + * + * Now specialized version of ACE_Task with ACE_Message_Block as its + * ACE_MESSAGE_TYPE... + * + * template + * class ACE_Task : public ACE_Task_Base + * { + * // put here the good old ACE_Task code + * }; + * + * When User (and legacy code) write ACE_Task, specialized ACE_Task + * code is in action. + */ +template +class ACE_Task_Ex : public ACE_Task_Base +{ +public: + friend class ACE_Module; + friend class ACE_Module_Type; + typedef ACE_Message_Queue_Ex MESSAGE_QUEUE_EX; + + // = Initialization/termination methods. + /** + * Initialize a Task, supplying a thread manager and a message + * queue. If the user doesn't supply a ACE_Message_Queue pointer + * then we'll allocate one dynamically. Otherwise, we'll use the + * one passed as a parameter. + */ + ACE_Task_Ex (ACE_Thread_Manager *thr_mgr = 0, + MESSAGE_QUEUE_EX *mq = 0); + + /// Destructor. + virtual ~ACE_Task_Ex (void); + + /// Gets the message queue associated with this task. + MESSAGE_QUEUE_EX *msg_queue (void); + + /// Sets the message queue associated with this task. + void msg_queue (MESSAGE_QUEUE_EX *); + +public: // Should be protected: + // = Message queue manipulation methods. + + // = Enqueue and dequeue methods. + + // For the following five method if @a timeout == 0, the caller will + // block until action is possible, else will wait until the + // <{absolute}> time specified in *@a timeout elapses). These calls + // will return, however, when queue is closed, deactivated, when a + // signal occurs, or if the time specified in timeout elapses, (in + // which case errno = EWOULDBLOCK). + + /// Insert message into the message queue. Note that @a timeout uses + /// <{absolute}> time rather than <{relative}> time. + int putq (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0); + + /** + * Extract the first message from the queue (blocking). Note that + * @a timeout uses <{absolute}> time rather than <{relative}> time. + * Returns number of items in queue if the call succeeds or -1 otherwise. + */ + int getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *timeout = 0); + + /// Return a message to the queue. Note that @a timeout uses + /// <{absolute}> time rather than <{relative}> time. + int ungetq (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0); + + /** + * Turn the message around and send it back down the Stream. Note + * that @a timeout uses <{absolute}> time rather than <{relative}> + * time. + */ + int reply (ACE_MESSAGE_TYPE *, ACE_Time_Value *timeout = 0); + + /** + * Transfer message to the adjacent ACE_Task_Ex in a ACE_Stream. Note + * that @a timeout uses <{absolute}> time rather than <{relative}> + * time. + */ + int put_next (ACE_MESSAGE_TYPE *msg, ACE_Time_Value *timeout = 0); + + /** + * Tests whether we can enqueue a message without blocking. + * @deprecated This method is deprecated and will go away in the future. + */ + int can_put (ACE_MESSAGE_TYPE *); + + // = ACE_Task utility routines to identify names et al. + /// Return the name of the enclosing Module if there's one associated + /// with the Task, else returns 0. + const ACE_TCHAR *name (void) const; + + // = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream). + /// Get next Task pointer. + ACE_Task *next (void); + + /// Set next Task pointer. + void next (ACE_Task *); + + /// Alwasy return 0. @todo FIXME + ACE_Task *sibling (void); + + /// Return the Task's Module if there is one, else returns 0. + ACE_Module *module (void) const; + + /** + * Flush the task's queue, i.e., free all of the enqueued + * message blocks and releases any threads blocked on the queue. + * Note that if this conflicts with the C++ iostream + * function, just rewrite the iostream function as ::. + */ + int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL); + + // = Special routines corresponding to certain message types. + + /// Manipulate watermarks. + void water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t); + + /// Queue of messages on the ACE_Task.. + MESSAGE_QUEUE_EX *msg_queue_; + + /// true if should delete Message_Queue, false otherwise. + bool delete_msg_queue_; + + /// Back-pointer to the enclosing module. + ACE_Module *mod_; + + /// Pointer to adjacent ACE_Task. + ACE_Task *next_; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task_Ex &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Task_Ex (const ACE_Task_Ex &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Task_Ex_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Task_Ex_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Task_Ex_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TASK_EX_H */ diff --git a/externals/ace/Task_Ex_T.inl b/externals/ace/Task_Ex_T.inl new file mode 100644 index 0000000..dd90bcd --- /dev/null +++ b/externals/ace/Task_Ex_T.inl @@ -0,0 +1,109 @@ +// -*- C++ -*- +// +// $Id: Task_Ex_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE void +ACE_Task_Ex::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, + size_t wm_size) +{ + ACE_TRACE ("ACE_Task_Ex::water_marks"); + if (cmd == ACE_IO_Cntl_Msg::SET_LWM) + this->msg_queue_->low_water_mark (wm_size); + else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */ + this->msg_queue_->high_water_mark (wm_size); +} + +template ACE_INLINE int +ACE_Task_Ex::getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task_Ex::getq"); + return this->msg_queue_->dequeue_head (mb, tv); +} + +template ACE_INLINE int +ACE_Task_Ex::can_put (ACE_MESSAGE_TYPE *) +{ + ACE_TRACE ("ACE_Task_Ex::can_put"); + ACE_NOTSUP_RETURN (-1); +} + +template ACE_INLINE int +ACE_Task_Ex::putq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task_Ex::putq"); + return this->msg_queue_->enqueue_tail (mb, tv); +} + +template ACE_INLINE int +ACE_Task_Ex::ungetq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task_Ex::ungetq"); + return this->msg_queue_->enqueue_head (mb, tv); +} + +template ACE_INLINE int +ACE_Task_Ex::flush (u_long flag) +{ + ACE_TRACE ("ACE_Task_Ex::flush"); + if (ACE_BIT_ENABLED (flag, ACE_Task_Flags::ACE_FLUSHALL)) + return this->msg_queue_ != 0 && this->msg_queue_->close (); + else + return -1; // Note, need to be more careful about what we free... +} + +template ACE_INLINE void +ACE_Task_Ex::msg_queue (ACE_Message_Queue_Ex *mq) +{ + ACE_TRACE ("ACE_Task_Ex::msg_queue"); + if (this->delete_msg_queue_) + { + delete this->msg_queue_; + this->delete_msg_queue_ = false; + } + this->msg_queue_ = mq; +} + +template ACE_Message_Queue_Ex * +ACE_Task_Ex::msg_queue (void) +{ + ACE_TRACE ("ACE_Task_Ex::msg_queue"); + return this->msg_queue_; +} + +template ACE_INLINE int +ACE_Task_Ex::reply (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task_Ex::reply"); + ACE_UNUSED_ARG (mb); + ACE_UNUSED_ARG (tv); + return -1 ; // this->sibling ()->put_next (mb, tv); +} + +template ACE_INLINE ACE_Task * +ACE_Task_Ex::next (void) +{ + ACE_TRACE ("ACE_Task_Ex::next"); + return this->next_; +} + +template ACE_INLINE void +ACE_Task_Ex::next (ACE_Task *q) +{ + ACE_TRACE ("ACE_Task_Ex::next"); + this->next_ = q; +} + +// Transfer msg to the next ACE_Task_Ex. + +template ACE_INLINE int +ACE_Task_Ex::put_next ( + ACE_MESSAGE_TYPE * /* msg */, + ACE_Time_Value * /* tv */) +{ + ACE_TRACE ("ACE_Task_Ex::put_next"); + return -1; // this->next_ == 0 ? -1 : this->next_->put (msg, tv); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Task_T.cpp b/externals/ace/Task_T.cpp new file mode 100644 index 0000000..08b36f8 --- /dev/null +++ b/externals/ace/Task_T.cpp @@ -0,0 +1,108 @@ +// $Id: Task_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TASK_T_CPP +#define ACE_TASK_T_CPP + +#include "ace/Task_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Module.h" +#include "ace/Null_Condition.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Task_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template void +ACE_Task::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Task::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_)); + this->msg_queue_->dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags = %x"), this->flags_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmod_ = %x"), this->mod_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_count_ = %d"), this->thr_count_)); +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + this->lock_.dump (); +#endif /* ACE_MT_SAFE */ + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// If the user doesn't supply a ACE_Message_Queue pointer then we'll +// allocate one dynamically. Otherwise, we'll use the one they give. + +template +ACE_Task::ACE_Task (ACE_Thread_Manager *thr_man, + ACE_Message_Queue *mq) + : ACE_Task_Base (thr_man), + msg_queue_ (0), + delete_msg_queue_ (false), + mod_ (0), + next_ (0) +{ + ACE_TRACE ("ACE_Task::ACE_Task"); + + if (mq == 0) + { + ACE_NEW (mq, + ACE_Message_Queue); + this->delete_msg_queue_ = true; + } + + this->msg_queue_ = mq; +} + +template +ACE_Task::~ACE_Task (void) +{ + ACE_TRACE ("ACE_Task::~ACE_Task"); + if (this->delete_msg_queue_) + delete this->msg_queue_; + + // These assignments aren't strickly necessary but they help guard + // against odd race conditions... + this->delete_msg_queue_ = false; +} + +template ACE_Task * +ACE_Task::sibling (void) +{ + ACE_TRACE ("ACE_Task::sibling"); + if (this->mod_ == 0) + return 0; + else + return this->mod_->sibling (this); +} + +template const ACE_TCHAR * +ACE_Task::name (void) const +{ + ACE_TRACE ("ACE_Task::name"); + if (this->mod_ == 0) + return 0; + else + return this->mod_->name (); +} + +template ACE_Module * +ACE_Task::module (void) const +{ + ACE_TRACE ("ACE_Task::module"); + return this->mod_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TASK_T_CPP */ diff --git a/externals/ace/Task_T.h b/externals/ace/Task_T.h new file mode 100644 index 0000000..b945bf3 --- /dev/null +++ b/externals/ace/Task_T.h @@ -0,0 +1,198 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Task_T.h + * + * $Id: Task_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TASK_T_H +#define ACE_TASK_T_H +#include /**/ "ace/pre.h" + +#include "ace/Message_Queue.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Synch_Traits.h" +#include "ace/Task.h" +#include "ace/IO_Cntl_Msg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decls... +template class ACE_Module; + +/** + * @class ACE_Task + * + * @brief Primary interface for application message processing, as well + * as input and output message queueing. + * + * This class serves as the basis for passive and active objects + * in ACE. + */ +template +class ACE_Task : public ACE_Task_Base +{ +public: + friend class ACE_Module; + friend class ACE_Module_Type; + + // = Initialization/termination methods. + /** + * Initialize a Task, supplying a thread manager and a message + * queue. If the user doesn't supply a ACE_Message_Queue pointer + * then we'll allocate one dynamically. Otherwise, we'll use the + * one passed as a parameter. + */ + ACE_Task (ACE_Thread_Manager *thr_mgr = 0, + ACE_Message_Queue *mq = 0); + + /// Destructor. + virtual ~ACE_Task (void); + + /// Gets the message queue associated with this task. + ACE_Message_Queue *msg_queue (void); + + /// Sets the message queue associated with this task. + void msg_queue (ACE_Message_Queue *); + +public: // Should be protected: + // = Message queue manipulation methods. + + // = Enqueue and dequeue methods. + + // For the following five method if @a timeout == 0, the caller will + // block until action is possible, else will wait until the + // <{absolute}> time specified in *@a timeout elapses). These calls + // will return, however, when queue is closed, deactivated, when a + // signal occurs, or if the time specified in timeout elapses, (in + // which case errno = EWOULDBLOCK). + + /// Insert message into the message queue. Note that @a timeout uses + /// <{absolute}> time rather than <{relative}> time. + int putq (ACE_Message_Block *, ACE_Time_Value *timeout = 0); + + /** + * Extract the first message from the queue (blocking). Note that + * @a timeout uses <{absolute}> time rather than <{relative}> time. + * Returns number of items in queue if the call succeeds or -1 otherwise. + */ + int getq (ACE_Message_Block *&mb, ACE_Time_Value *timeout = 0); + + /// Return a message to the queue. Note that @a timeout uses + /// <{absolute}> time rather than <{relative}> time. + int ungetq (ACE_Message_Block *, ACE_Time_Value *timeout = 0); + + /** + * Turn the message around, sending it in the opposite direction in + * the stream. To do this, the message is put onto the task next in + * the stream after this task's sibling. + * + * @param ACE_Message_Block Pointer to the block that is used in the reply. + * @param timeout The absolute time at which the put operation used to + * send the message block to the next module in the stream + * will time out. If 0, this call blocks until it can be + * completed. + */ + int reply (ACE_Message_Block *, ACE_Time_Value *timeout = 0); + + /** + * Transfer message to the adjacent ACE_Task in a ACE_Stream. Note + * that @a timeout uses <{absolute}> time rather than <{relative}> + * time. + */ + int put_next (ACE_Message_Block *msg, ACE_Time_Value *timeout = 0); + + /** + * Tests whether we can enqueue a message without blocking. + * + * @deprecated This method is deprecated and will go away in the future. + */ + int can_put (ACE_Message_Block *); + + // = ACE_Task utility routines to identify names et al. + /// Return the name of the enclosing Module if there's one associated + /// with the Task, else returns 0. + const ACE_TCHAR *name (void) const; + + // = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream). + /// Get next Task pointer. + ACE_Task *next (void); + + /// Set next Task pointer. + void next (ACE_Task *); + + /// Return the Task's sibling if there's one associated with the + /// Task's Module, else returns 0. + ACE_Task *sibling (void); + + /// Return the Task's Module if there is one, else returns 0. + ACE_Module *module (void) const; + + /** + * Flush the task's queue, i.e., free all of the enqueued + * message blocks and unblocks any threads waiting on the queue. + * Note that if this conflicts with the C++ iostream + * function, just rewrite the iostream function as ::. + */ + int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL); + + // = Special routines corresponding to certain message types. + + /// Manipulate watermarks. + void water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t); + + /// Queue of messages on the ACE_Task.. + ACE_Message_Queue *msg_queue_; + + /// true if should delete Message_Queue, false otherwise. + bool delete_msg_queue_; + + /// Back-pointer to the enclosing module. + ACE_Module *mod_; + + /// Pointer to adjacent ACE_Task. + ACE_Task *next_; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + // = Disallow these operations. + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Task (const ACE_Task &)) +}; + +#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT +template class ACE_Export ACE_Task; +template class ACE_Export ACE_Task; +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Task_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Task_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Task_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TASK_T_H */ diff --git a/externals/ace/Task_T.inl b/externals/ace/Task_T.inl new file mode 100644 index 0000000..a441ca9 --- /dev/null +++ b/externals/ace/Task_T.inl @@ -0,0 +1,105 @@ +// -*- C++ -*- +// +// $Id: Task_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE void +ACE_Task::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, + size_t wm_size) +{ + ACE_TRACE ("ACE_Task::water_marks"); + if (cmd == ACE_IO_Cntl_Msg::SET_LWM) + this->msg_queue_->low_water_mark (wm_size); + else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */ + this->msg_queue_->high_water_mark (wm_size); +} + +template ACE_INLINE int +ACE_Task::getq (ACE_Message_Block *&mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task::getq"); + return this->msg_queue_->dequeue_head (mb, tv); +} + +template ACE_INLINE int +ACE_Task::can_put (ACE_Message_Block *) +{ + ACE_TRACE ("ACE_Task::can_put"); + ACE_NOTSUP_RETURN (-1); +} + +template ACE_INLINE int +ACE_Task::putq (ACE_Message_Block *mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task::putq"); + return this->msg_queue_->enqueue_tail (mb, tv); +} + +template ACE_INLINE int +ACE_Task::ungetq (ACE_Message_Block *mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task::ungetq"); + return this->msg_queue_->enqueue_head (mb, tv); +} + +template ACE_INLINE int +ACE_Task::flush (u_long flag) +{ + ACE_TRACE ("ACE_Task::flush"); + if (ACE_BIT_ENABLED (flag, ACE_Task_Flags::ACE_FLUSHALL)) + return this->msg_queue_ != 0 && this->msg_queue_->close (); + else + return -1; // Note, need to be more careful about what we free... +} + +template ACE_INLINE void +ACE_Task::msg_queue (ACE_Message_Queue *mq) +{ + ACE_TRACE ("ACE_Task::msg_queue"); + if (this->delete_msg_queue_) + { + delete this->msg_queue_; + this->delete_msg_queue_ = false; + } + this->msg_queue_ = mq; +} + +template ACE_Message_Queue * +ACE_Task::msg_queue (void) +{ + ACE_TRACE ("ACE_Task::msg_queue"); + return this->msg_queue_; +} + +template ACE_INLINE int +ACE_Task::reply (ACE_Message_Block *mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task::reply"); + return this->sibling ()->put_next (mb, tv); +} + +template ACE_INLINE ACE_Task * +ACE_Task::next (void) +{ + ACE_TRACE ("ACE_Task::next"); + return this->next_; +} + +template ACE_INLINE void +ACE_Task::next (ACE_Task *q) +{ + ACE_TRACE ("ACE_Task::next"); + this->next_ = q; +} + +// Transfer msg to the next ACE_Task. + +template ACE_INLINE int +ACE_Task::put_next (ACE_Message_Block *msg, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task::put_next"); + return this->next_ == 0 ? -1 : this->next_->put (msg, tv); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Test_and_Set.cpp b/externals/ace/Test_and_Set.cpp new file mode 100644 index 0000000..15fbfe0 --- /dev/null +++ b/externals/ace/Test_and_Set.cpp @@ -0,0 +1,51 @@ +// $Id: Test_and_Set.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TEST_AND_SET_CPP +#define ACE_TEST_AND_SET_CPP + +#include "ace/Test_and_Set.h" +#include "ace/Guard_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Test_and_Set::ACE_Test_and_Set (TYPE initial_value) + : is_set_ (initial_value) +{ +} + +// Returns true if we are done, else false. +template TYPE +ACE_Test_and_Set::is_set (void) const +{ + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, this->is_set_); + return this->is_set_; +} + +// Sets the status. +template TYPE +ACE_Test_and_Set::set (TYPE status) +{ + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, this->is_set_); + TYPE o_status = this->is_set_; + this->is_set_ = status; + return o_status; +} + +template int +ACE_Test_and_Set::handle_signal (int, siginfo_t *, ucontext_t *) +{ + // By setting this to 1, we are "signaling" to anyone calling + // or or that the "test and set" object is in the + // "signaled" state, i.e., it's "available" to be set back to 0. + this->set (1); + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TEST_AND_SET_CPP */ diff --git a/externals/ace/Test_and_Set.h b/externals/ace/Test_and_Set.h new file mode 100644 index 0000000..062de0b --- /dev/null +++ b/externals/ace/Test_and_Set.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Test_and_Set.h + * + * $Id: Test_and_Set.h 80826 2008-03-04 14:51:23Z wotte $ + */ +//============================================================================= + + +#ifndef ACE_TEST_AND_SET_H +#define ACE_TEST_AND_SET_H + +#include /**/ "ace/pre.h" +#include "ace/Event_Handler.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Test_and_Set + * + * @brief Implements the classic ``test and set'' operation. + * + * + * This class keeps track of the status of , which can + * be set based on various events (such as receipt of a + * signal). This class is derived from ACE_Event_Handler so + * that it can be "signaled" by a Reactor when a signal occurs. + * We assume that is a data type that can be assigned the + * value 0 or 1. + */ +template +class ACE_Test_and_Set : public ACE_Event_Handler +{ +public: + ACE_Test_and_Set (TYPE initial_value = 0); + + /// Returns true if we are set, else false. + TYPE is_set (void) const; + + /// Sets the status, returning the original value of + /// . + TYPE set (TYPE); + + /// Called when object is signaled by OS (either via UNIX signals or + /// when a Win32 object becomes signaled). + virtual int handle_signal (int signum, + siginfo_t * = 0, + ucontext_t * = 0); + +private: + /// Keeps track of our state. + TYPE is_set_; + + /// Protect the state from race conditions. + ACE_LOCK lock_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Test_and_Set.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Test_and_Set.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TEST_AND_SET_H */ diff --git a/externals/ace/Thread.cpp b/externals/ace/Thread.cpp new file mode 100644 index 0000000..2fb009b --- /dev/null +++ b/externals/ace/Thread.cpp @@ -0,0 +1,101 @@ +// $Id: Thread.cpp 84163 2009-01-15 07:57:27Z johnnyw $ + +#include "ace/Thread.h" + +ACE_RCSID(ace, + Thread, + "$Id: Thread.cpp 84163 2009-01-15 07:57:27Z johnnyw $") + +#if !defined (__ACE_INLINE__) +#include "ace/Thread.inl" +#endif /* !defined (__ACE_INLINE__) */ + +#if defined (ACE_HAS_THREADS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +size_t +ACE_Thread::spawn_n (size_t n, + ACE_THR_FUNC func, + void *arg, + long flags, + long priority, + void *stack[], + size_t stack_size[], + ACE_Thread_Adapter *thread_adapter, + const char* thr_name[]) +{ + ACE_TRACE ("ACE_Thread::spawn_n"); + size_t i; + + for (i = 0; i < n; i++) + { + ACE_thread_t t_id; + // Bail out if error occurs. + if (ACE_OS::thr_create (func, + arg, + flags, + &t_id, + 0, + priority, + stack == 0 ? 0 : stack[i], + stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i], + thread_adapter, + thr_name == 0 ? 0 : &thr_name[i]) != 0) + break; + } + + return i; +} + +size_t +ACE_Thread::spawn_n (ACE_thread_t thread_ids[], + size_t n, + ACE_THR_FUNC func, + void *arg, + long flags, + long priority, + void *stack[], + size_t stack_size[], + ACE_hthread_t thread_handles[], + ACE_Thread_Adapter *thread_adapter, + const char* thr_name[]) +{ + ACE_TRACE ("ACE_Thread::spawn_n"); + size_t i = 0; + + for (i = 0; i < n; i++) + { + ACE_thread_t t_id; + ACE_hthread_t t_handle; + + int const result = + ACE_OS::thr_create (func, + arg, + flags, + &t_id, + &t_handle, + priority, + stack == 0 ? 0 : stack[i], + stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i], + thread_adapter, + thr_name == 0 ? 0 : &thr_name[i]); + + if (result == 0) + { + if (thread_ids != 0) + thread_ids[i] = t_id; + if (thread_handles != 0) + thread_handles[i] = t_handle; + } + else + // Bail out if error occurs. + break; + } + + return i; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/Thread.h b/externals/ace/Thread.h new file mode 100644 index 0000000..4d44858 --- /dev/null +++ b/externals/ace/Thread.h @@ -0,0 +1,282 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Thread.h + * + * $Id: Thread.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas Schmidt + */ +//========================================================================== + +#ifndef ACE_THREAD_H +#define ACE_THREAD_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_Thread.h" +#include "ace/Thread_Adapter.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +struct cancel_state +{ + /// e.g., PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE, + /// PTHREAD_CANCELED. + int cancelstate; + + /// e.g., PTHREAD_CANCEL_DEFERRED and PTHREAD_CANCEL_ASYNCHRONOUS. + int canceltype; +}; + +/** + * @class ACE_Thread + * + * @brief Provides a wrapper for threads. + * + * This class provides a common interface that is mapped onto + * POSIX Pthreads, Solaris threads, Win32 threads, VxWorks + * threads, or pSoS threads. Note, however, that it is + * generally a better idea to use the ACE_Thread_Manager + * programming API rather than the API since the + * thread manager is more powerful. + */ +class ACE_Export ACE_Thread +{ +public: + /** + * Creates a new thread having @a flags attributes and running @a func + * with (if is non-0 then @a func and + * are ignored and are obtained from ). + * and are set to the thread's ID and handle (?), + * respectively. The thread runs at @a priority priority (see + * below). + * + * The @a flags are a bitwise-OR of the following: + * = BEGIN + * THR_CANCEL_DISABLE, THR_CANCEL_ENABLE, THR_CANCEL_DEFERRED, + * THR_CANCEL_ASYNCHRONOUS, THR_BOUND, THR_NEW_LWP, THR_DETACHED, + * THR_SUSPENDED, THR_DAEMON, THR_JOINABLE, THR_SCHED_FIFO, + * THR_SCHED_RR, THR_SCHED_DEFAULT, THR_EXPLICIT_SCHED, + * THR_SCOPE_SYSTEM, THR_SCOPE_PROCESS + * = END + * + * By default, or if @a priority is set to + * ACE_DEFAULT_THREAD_PRIORITY, an "appropriate" priority value for + * the given scheduling policy (specified in , e.g., + * ) is used. This value is calculated + * dynamically, and is the median value between the minimum and + * maximum priority values for the given policy. If an explicit + * value is given, it is used. Note that actual priority values are + * EXTREMEMLY implementation-dependent, and are probably best + * avoided. + * + * Note that is always deleted when + * is called, so it must be allocated with global operator new. + */ + static int spawn (ACE_THR_FUNC func, + void *arg = 0, + long flags = THR_NEW_LWP | THR_JOINABLE, + ACE_thread_t *t_id = 0, + ACE_hthread_t *t_handle = 0, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + void *stack = 0, + size_t stack_size = ACE_DEFAULT_THREAD_STACKSIZE, + ACE_Thread_Adapter *thread_adapter = 0, + const char** thr_name = 0); + + /** + * Spawn N new threads, which execute @a func with argument @a arg (if + * @a thread_adapter is non-0 then @a func and @a args are ignored and + * are obtained from @a thread_adapter). If @a stack != 0 it is + * assumed to be an array of @a n pointers to the base of the stacks + * to use for the threads being spawned. Likewise, if @a stack_size + * != 0 it is assumed to be an array of @a n values indicating how + * big each of the corresponding @a stacks are. Returns the number + * of threads actually spawned (if this doesn't equal the number + * requested then something has gone wrong and @c errno will + * explain...). + * + * @see spawn() + */ + static size_t spawn_n (size_t n, + ACE_THR_FUNC func, + void *arg = 0, + long flags = THR_NEW_LWP | THR_JOINABLE, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + void *stack[] = 0, + size_t stack_size[] = 0, + ACE_Thread_Adapter *thread_adapter = 0, + const char* thr_name[] = 0); + + /** + * Spawn @a n new threads, which execute @a func with argument @a arg + * (if @a thread_adapter is non-0 then @a func and @a args are ignored + * and are obtained from @a thread_adapter). The thread_ids of + * successfully spawned threads will be placed into the + * buffer (which must be the same size as @a n). If @a stack != 0 it + * is assumed to be an array of @a n pointers to the base of the + * stacks to use for the threads being spawned. If @a stack_size != + * 0 it is assumed to be an array of @a n values indicating how big + * each of the corresponding @a stacks are. If @a thread_handles != 0 + * it is assumed to be an array of @a n thread_handles that will be + * assigned the values of the thread handles being spawned. Returns + * the number of threads actually spawned (if this doesn't equal the + * number requested then something has gone wrong and @c errno will + * explain...). + * + * @see spawn() + */ + static size_t spawn_n (ACE_thread_t thread_ids[], + size_t n, + ACE_THR_FUNC func, + void *arg, + long flags, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + void *stack[] = 0, + size_t stack_size[] = 0, + ACE_hthread_t thread_handles[] = 0, + ACE_Thread_Adapter *thread_adapter = 0, + const char* thr_name[] = 0); + + /** + * Wait for one or more threads to exit and reap their exit status. + * thr_join() returns successfully when the target thread terminates. + * + * @param thread_id is the ACE_thread_t ID of the thread to wait for. + * If @a thread_id is 0, join() waits for any + * undetached thread in the process to terminate + * on platforms that support this capability + * (for example, Solaris). + * @param departed points to a location that is set to the ID of the + * terminated thread if join() returns successfully. + * If @a departed is 0, it is ignored. + * @param status Points to the location that receives the joined + * thread's exit value. If @a status is 0, it is ignored. + * + * @retval 0 for success + * @retval -1 (with errno set) for failure. + */ + static int join (ACE_thread_t thread_id, + ACE_thread_t *departed, + ACE_THR_FUNC_RETURN *status); + + /// Wait for one thread to exit and reap its exit status. + static int join (ACE_hthread_t, + ACE_THR_FUNC_RETURN * = 0); + + /// Continue the execution of a previously suspended thread. + static int resume (ACE_hthread_t); + + /// Suspend the execution of a particular thread. + static int suspend (ACE_hthread_t); + + /// Get the priority of a particular thread. + static int getprio (ACE_hthread_t ht_id, int &priority); + + /// Get the priority and policy of a particular thread. + static int getprio (ACE_hthread_t ht_id, int &priority, int &policy); + + /// Set the priority of a particular thread. + static int setprio (ACE_hthread_t ht_id, int priority, int policy = -1); + + /// Send a signal to the thread. + static int kill (ACE_thread_t, int signum); + + /// Yield the thread to another. + static void yield (void); + + /** + * Return the unique kernel handle of the thread. Note that on + * Win32 this is actually a pseudohandle, which cannot be shared + * with other processes or waited on by threads. To locate the real + * handle, please use the ACE_Thread_Manager::thr_self() method. + */ + static void self (ACE_hthread_t &t_handle); + + /// Return the unique ID of the thread. + static ACE_thread_t self (void); + + /// Exit the current thread and return "status". + /// Should _not_ be called by main thread. + static void exit (ACE_THR_FUNC_RETURN status = 0); + + /// Get the LWP concurrency level of the process. + static int getconcurrency (void); + + /// Set the LWP concurrency level of the process. + static int setconcurrency (int new_level); + + /// Change and/or examine calling thread's signal mask. + static int sigsetmask (int how, + const sigset_t *sigset, + sigset_t *osigset = 0); + + /** + * Allocates a @a keyp that is used to identify data that is specific + * to each thread in the process. The key is global to all threads + * in the process. + */ + static int keycreate (ACE_thread_key_t *keyp, +#if defined (ACE_HAS_THR_C_DEST) + ACE_THR_C_DEST destructor, +#else + ACE_THR_DEST destructor, +#endif /* ACE_HAS_THR_C_DEST */ + void * = 0); + + /// Free up the key so that other threads can reuse it. + static int keyfree (ACE_thread_key_t key); + + /// Bind value to the thread-specific data key, @a key, for the calling + /// thread. + static int setspecific (ACE_thread_key_t key, + void *value); + + /// Stores the current value bound to @a key for the calling thread + /// into the location pointed to by @a valuep. + static int getspecific (ACE_thread_key_t key, + void **valuep); + + /// Disable thread cancellation. + static int disablecancel (struct cancel_state *old_state); + + /// Enable thread cancellation. + static int enablecancel (struct cancel_state *old_state, + int flag); + + /// Set the cancellation state. + static int setcancelstate (struct cancel_state &new_state, + struct cancel_state *old_state); + + /** + * Cancel a thread. + * @note This method is only portable on platforms, such as POSIX pthreads, + * that support thread cancellation. + */ + static int cancel (ACE_thread_t t_id); + + /// Test the cancel. + static void testcancel (void); + +private: + /// Ensure that we don't get instantiated. + ACE_Thread (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Thread.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_THREAD_H */ diff --git a/externals/ace/Thread.inl b/externals/ace/Thread.inl new file mode 100644 index 0000000..87e47e1 --- /dev/null +++ b/externals/ace/Thread.inl @@ -0,0 +1,286 @@ +// -*- C++ -*- +// +// $Id: Thread.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Allocates a that is used to identify data that is specific +// to each thread in the process. The key is global to all threads in +// the process. + +ACE_INLINE int +ACE_Thread::keycreate (ACE_thread_key_t *keyp, +#if defined (ACE_HAS_THR_C_DEST) + ACE_THR_C_DEST destructor, +#else + ACE_THR_DEST destructor, +#endif /* ACE_HAS_THR_C_DEST */ + void *inst) +{ + // ACE_TRACE ("ACE_Thread::keycreate"); + return ACE_OS::thr_keycreate (keyp, destructor, inst); +} + +// Free up the key so that other threads can reuse it. + +ACE_INLINE int +ACE_Thread::keyfree (ACE_thread_key_t key) +{ + ACE_TRACE ("ACE_Thread::keyfree"); + return ACE_OS::thr_keyfree (key); +} + +// Bind value to the thread-specific data key, , for the calling +// thread. + +ACE_INLINE int +ACE_Thread::setspecific (ACE_thread_key_t key, void *value) +{ + // ACE_TRACE ("ACE_Thread::setspecific"); + return ACE_OS::thr_setspecific (key, value); +} + +// Stores the current value bound to for the calling thread +// into the location pointed to by . + +ACE_INLINE int +ACE_Thread::getspecific (ACE_thread_key_t key, void **valuep) +{ + // ACE_TRACE ("ACE_Thread::getspecific"); + return ACE_OS::thr_getspecific (key, valuep); +} + +ACE_INLINE ACE_thread_t +ACE_Thread::self (void) +{ +// ACE_TRACE ("ACE_Thread::self"); + return ACE_OS::thr_self (); +} + +ACE_INLINE void +ACE_Thread::exit (ACE_THR_FUNC_RETURN status) +{ + ACE_TRACE ("ACE_Thread::exit"); + ACE_OS::thr_exit (status); +} + +ACE_INLINE void +ACE_Thread::yield (void) +{ + ACE_TRACE ("ACE_Thread::yield"); + ACE_OS::thr_yield (); +} + +ACE_INLINE int +ACE_Thread::spawn (ACE_THR_FUNC func, + void *arg, + long flags, + ACE_thread_t *t_id, + ACE_hthread_t *t_handle, + long priority, + void *thr_stack, + size_t thr_stack_size, + ACE_Thread_Adapter *thread_adapter, + const char** thr_name) +{ + ACE_TRACE ("ACE_Thread::spawn"); + + return ACE_OS::thr_create (func, + arg, + flags, + t_id, + t_handle, + priority, + thr_stack, + thr_stack_size, + thread_adapter, + thr_name); +} + +ACE_INLINE int +ACE_Thread::resume (ACE_hthread_t t_id) +{ + ACE_TRACE ("ACE_Thread::resume"); + return ACE_OS::thr_continue (t_id); +} + +ACE_INLINE int +ACE_Thread::suspend (ACE_hthread_t t_id) +{ + ACE_TRACE ("ACE_Thread::suspend"); + return ACE_OS::thr_suspend (t_id); +} + +ACE_INLINE int +ACE_Thread::kill (ACE_thread_t t_id, int signum) +{ + ACE_TRACE ("ACE_Thread::kill"); + return ACE_OS::thr_kill (t_id, signum); +} + +ACE_INLINE int +ACE_Thread::join (ACE_thread_t wait_for, + ACE_thread_t *departed, + ACE_THR_FUNC_RETURN *status) +{ + ACE_TRACE ("ACE_Thread::join"); + return ACE_OS::thr_join (wait_for, departed, status); +} + +ACE_INLINE int +ACE_Thread::join (ACE_hthread_t wait_for, + ACE_THR_FUNC_RETURN *status) +{ + ACE_TRACE ("ACE_Thread::join"); + return ACE_OS::thr_join (wait_for, status); +} + +ACE_INLINE int +ACE_Thread::getconcurrency (void) +{ + ACE_TRACE ("ACE_Thread::getconcurrency"); + return ACE_OS::thr_getconcurrency (); +} + +ACE_INLINE int +ACE_Thread::setconcurrency (int new_level) +{ + ACE_TRACE ("ACE_Thread::setconcurrency"); + return ACE_OS::thr_setconcurrency (new_level); +} + +ACE_INLINE int +ACE_Thread::sigsetmask (int how, + const sigset_t *sigset, + sigset_t *osigset) +{ + ACE_TRACE ("ACE_Thread::sigsetmask"); + return ACE_OS::thr_sigsetmask (how, sigset, osigset); +} + +ACE_INLINE int +ACE_Thread::disablecancel (struct cancel_state *old_state) +{ + ACE_TRACE ("ACE_Thread::disablecancel"); + int old_cstate = 0; + int result = ACE_OS::thr_setcancelstate (THR_CANCEL_DISABLE, + &old_cstate); + if (result == 0 && old_state != 0) + { + ACE_OS::memset (old_state, + 0, + sizeof (old_state)); + old_state->cancelstate = old_cstate; + } + + return result; +} + +ACE_INLINE int +ACE_Thread::enablecancel (struct cancel_state *old_state, + int flag) +{ + ACE_TRACE ("ACE_Thread::enablecancel"); + int old_cstate = 0; + int old_ctype = 0; + int result; + + result = ACE_OS::thr_setcancelstate (THR_CANCEL_ENABLE, + &old_cstate); + if (result != 0) + return result; + + result = ACE_OS::thr_setcanceltype (flag, + &old_ctype); + if (result != 0) + return result; + + if (old_state != 0) + { + old_state->cancelstate = old_cstate; + old_state->canceltype = old_ctype; + } + + return 0; +} + +ACE_INLINE int +ACE_Thread::setcancelstate (struct cancel_state &new_state, + struct cancel_state *old_state) +{ + ACE_TRACE ("ACE_Thread::setcancelstate"); + int old_cstate = 0; + int old_ctype = 0; + + if (new_state.cancelstate != 0 + && ACE_OS::thr_setcancelstate (new_state.cancelstate, + &old_cstate) != 0) + return -1; + + if (new_state.canceltype != 0 + && ACE_OS::thr_setcanceltype (new_state.canceltype, + &old_ctype) != 0) + { + int o_cstate; + + ACE_OS::thr_setcancelstate (old_cstate, + &o_cstate); + return -1; + } + + if (old_state != 0) + { + old_state->cancelstate = old_cstate; + old_state->canceltype = old_ctype; + } + + return 0; +} + +ACE_INLINE int +ACE_Thread::cancel (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread::cancel"); + + return ACE_OS::thr_cancel (t_id); +} + +ACE_INLINE void +ACE_Thread::testcancel (void) +{ + ACE_TRACE ("ACE_Thread::testcancel"); + + ACE_OS::thr_testcancel (); +} + +ACE_INLINE void +ACE_Thread::self (ACE_hthread_t &t_id) +{ +// ACE_TRACE ("ACE_Thread::self"); + ACE_OS::thr_self (t_id); +} + +ACE_INLINE int +ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority) +{ + ACE_TRACE ("ACE_Thread::getprio"); + return ACE_OS::thr_getprio (ht_id, priority); +} + +ACE_INLINE int +ACE_Thread::getprio (ACE_hthread_t ht_id, int &priority, int &policy) +{ + ACE_TRACE ("ACE_Thread::getprio"); + return ACE_OS::thr_getprio (ht_id, priority, policy); +} + +ACE_INLINE int +ACE_Thread::setprio (ACE_hthread_t ht_id, int priority, int policy) +{ + ACE_TRACE ("ACE_Thread::setprio"); + return ACE_OS::thr_setprio (ht_id, priority, policy); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Adapter.cpp b/externals/ace/Thread_Adapter.cpp new file mode 100644 index 0000000..9dbad05 --- /dev/null +++ b/externals/ace/Thread_Adapter.cpp @@ -0,0 +1,228 @@ +// $Id: Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $ + +#include "ace/Thread_Adapter.h" +#include "ace/Thread_Manager.h" +#include "ace/Thread_Exit.h" +#include "ace/Thread_Hook.h" +#include "ace/Object_Manager_Base.h" +#include "ace/Service_Config.h" + +ACE_RCSID (ace, + Thread_Adapter, + "$Id: Thread_Adapter.cpp 81239 2008-04-04 22:28:48Z iliyan $") + +#if !defined (ACE_HAS_INLINED_OSCALLS) +# include "ace/Thread_Adapter.inl" +#endif /* ACE_HAS_INLINED_OSCALLS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func, + void *arg, + ACE_THR_C_FUNC entry_point, + ACE_Thread_Manager *tm, + ACE_Thread_Descriptor *td +#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , ACE_SEH_EXCEPT_HANDLER selector, + ACE_SEH_EXCEPT_HANDLER handler +#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + ) + : ACE_Base_Thread_Adapter ( + user_func + , arg + , entry_point + , td +#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , selector + , handler +#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + ) + , thr_mgr_ (tm) +{ + ACE_OS_TRACE ("ACE_Thread_Adapter::ACE_Thread_Adapter"); +} + +ACE_Thread_Adapter::~ACE_Thread_Adapter (void) +{ +} + +ACE_THR_FUNC_RETURN +ACE_Thread_Adapter::invoke (void) +{ + // Inherit the logging features if the parent thread has an + // ACE_Log_Msg instance in thread-specific storage. + this->inherit_log_msg (); + + ACE_Service_Config::current (ACE_Service_Config::global()); + +#if !defined(ACE_USE_THREAD_MANAGER_ADAPTER) + // NOTE: this preprocessor directive should match the one in above + // ACE_Thread_Exit::instance (). With the Xavier Pthreads package, + // the exit_hook in TSS causes a seg fault. So, this works around + // that by creating exit_hook on the stack. +# if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION) + // Obtain our thread-specific exit hook and make sure that it knows + // how to clean us up! Note that we never use this pointer directly + // (it's stored in thread-specific storage), so it's ok to + // dereference it here and only store it as a reference. + + // Except if it is null, then the thr_mgr() method crashes. + // -jxh + + ACE_Thread_Exit *exit_hook_instance = ACE_Thread_Exit::instance (); + ACE_Thread_Exit_Maybe exit_hook_maybe (exit_hook_instance == 0); + ACE_Thread_Exit *exit_hook_ptr = exit_hook_instance + ? exit_hook_instance + : exit_hook_maybe.instance (); + ACE_Thread_Exit &exit_hook = *exit_hook_ptr; + + if (this->thr_mgr () != 0) + { + // Keep track of the that's associated with this + // . + exit_hook.thr_mgr (this->thr_mgr ()); + } +# else + // Without TSS, create an instance. When this + // function returns, its destructor will be called because the + // object goes out of scope. The drawback with this appraoch is + // that the destructor _won't_ get called if is called. + // So, threads shouldn't exit that way. Instead, they should return + // from . + ACE_Thread_Exit exit_hook; + exit_hook.thr_mgr (this->thr_mgr ()); +# endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ + +#endif /* ! ACE_USE_THREAD_MANAGER_ADAPTER */ + + return this->invoke_i (); +} + +ACE_THR_FUNC_RETURN +ACE_Thread_Adapter::invoke_i (void) +{ + // Extract the arguments. + ACE_THR_FUNC func = reinterpret_cast (this->user_func_); + void *arg = this->arg_; + +#if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) + ACE_OS_Thread_Descriptor *thr_desc = this->thr_desc_; +#endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ + + // Delete ourselves since we don't need anymore. Make sure + // not to access anywhere below this point. + delete this; + +#if defined (ACE_NEEDS_LWP_PRIO_SET) + // On SunOS, the LWP priority needs to be set in order to get + // preemption when running in the RT class. This is the ACE way to + // do that . . . + ACE_hthread_t thr_handle; + ACE_OS::thr_self (thr_handle); + int prio; + + // thr_getprio () on the current thread should never fail. + ACE_OS::thr_getprio (thr_handle, prio); + + // ACE_OS::thr_setprio () has the special logic to set the LWP priority, + // if running in the RT class. + ACE_OS::thr_setprio (prio); + +#endif /* ACE_NEEDS_LWP_PRIO_SET */ + + ACE_THR_FUNC_RETURN status = 0; + + ACE_SEH_TRY + { + ACE_SEH_TRY + { + ACE_Thread_Hook *hook = + ACE_OS_Object_Manager::thread_hook (); + + if (hook) + // Invoke the start hook to give the user a chance to + // perform some initialization processing before the + // is invoked. + status = hook->start (func, arg); + else + // Call thread entry point. + status = (*func) (arg); + } + +#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + ACE_SEH_EXCEPT (ACE_OS_Object_Manager::seh_except_selector ()( + (void *) GetExceptionInformation ())) + { + ACE_OS_Object_Manager::seh_except_handler ()(0); + } +#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + } + + ACE_SEH_FINALLY + { + // If we changed this to 1, change the respective if in + // Task::svc_run to 0. +#if 0 + // Call the close> hook. + if (func == reinterpret_cast ( + ACE_Task_Base::svc_run)) + { + ACE_Task_Base *task_ptr = (ACE_Task_Base *) arg; + ACE_Thread_Manager *thr_mgr_ptr = task_ptr->thr_mgr (); + + // This calls the Task->close () hook. + task_ptr->cleanup (task_ptr, 0); + + // This prevents a second invocation of the cleanup code + // (called later by . + thr_mgr_ptr->at_exit (task_ptr, 0, 0); + } +#endif /* 0 */ + +#if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) +# if defined (ACE_WIN32) && defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) + int using_afx = -1; + if (thr_desc) + using_afx = ACE_BIT_ENABLED (thr_desc->flags (), THR_USE_AFX); +# endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ + // Call TSS destructors. + ACE_OS::cleanup_tss (0 /* not main thread */); + +# if defined (ACE_WIN32) + // Exit the thread. Allow CWinThread-destructor to be invoked + // from AfxEndThread. _endthreadex will be called from + // AfxEndThread so don't exit the thread now if we are running + // an MFC thread. +# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) + if (using_afx != -1) + { + if (using_afx) + ::AfxEndThread ((DWORD) status); + else + ACE_ENDTHREADEX (status); + } + else + { + // Not spawned by ACE_Thread_Manager, use the old buggy + // version. You should seriously consider using + // ACE_Thread_Manager to spawn threads. The following code + // is know to cause some problem. + CWinThread *pThread = ::AfxGetThread (); + + if (!pThread || pThread->m_nThreadID != ACE_OS::thr_self ()) + ACE_ENDTHREADEX (status); + else + ::AfxEndThread ((DWORD)status); + } +# else + + ACE_ENDTHREADEX (status); +# endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/ +# endif /* ACE_WIN32 */ +#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ + } + + return status; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Adapter.h b/externals/ace/Thread_Adapter.h new file mode 100644 index 0000000..8f1f259 --- /dev/null +++ b/externals/ace/Thread_Adapter.h @@ -0,0 +1,100 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Thread_Adapter.h + * + * $Id: Thread_Adapter.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ +//============================================================================= + +#ifndef ACE_THREAD_ADAPTER_H +#define ACE_THREAD_ADAPTER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Base_Thread_Adapter.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decl. +class ACE_Thread_Manager; +class ACE_Thread_Descriptor; + +/** + * @class ACE_Thread_Adapter + * + * @brief Converts a C++ function into a function that + * can be called from a thread creation routine + * (e.g., pthread_create() or _beginthreadex()) that expects an + * extern "C" entry point. This class also makes it possible to + * transparently provide hooks to register a thread with an + * ACE_Thread_Manager. + * + * This class is used in ACE_OS::thr_create(). In general, the + * thread that creates an object of this class is different from + * the thread that calls @c invoke() on this object. Therefore, + * the @c invoke() method is responsible for deleting itself. + */ +class ACE_Export ACE_Thread_Adapter : public ACE_Base_Thread_Adapter +{ +public: + /// Constructor. + ACE_Thread_Adapter (ACE_THR_FUNC user_func, + void *arg, + ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, + ACE_Thread_Manager *thr_mgr = 0, + ACE_Thread_Descriptor *td = 0 +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , ACE_SEH_EXCEPT_HANDLER selector = 0, + ACE_SEH_EXCEPT_HANDLER handler = 0 +# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + ); + + /** + * Execute the with the . This function deletes + * @c this, thereby rendering the object useless after the call + * returns. + */ + virtual ACE_THR_FUNC_RETURN invoke (void); + + /// Accessor for the optional ACE_Thread_Manager. + ACE_Thread_Manager *thr_mgr (void); + +protected: + + /// Ensure that this object must be allocated on the heap. + ~ACE_Thread_Adapter (void); + +private: + + /// Called by invoke, mainly here to separate the SEH stuff because + /// SEH on Win32 doesn't compile with local vars with destructors. + virtual ACE_THR_FUNC_RETURN invoke_i (void); + +private: + + /// Optional thread manager. + ACE_Thread_Manager *thr_mgr_; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_HAS_INLINED_OSCALLS) +# if defined (ACE_INLINE) +# undef ACE_INLINE +# endif /* ACE_INLINE */ +# define ACE_INLINE inline +# include "ace/Thread_Adapter.inl" +# endif /* ACE_HAS_INLINED_OSCALLS */ + +#include /**/ "ace/post.h" +#endif /* ACE_THREAD_ADAPTER_H */ diff --git a/externals/ace/Thread_Adapter.inl b/externals/ace/Thread_Adapter.inl new file mode 100644 index 0000000..6def13b --- /dev/null +++ b/externals/ace/Thread_Adapter.inl @@ -0,0 +1,13 @@ +// -*- C++ -*- +// +// $Id: Thread_Adapter.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_Thread_Manager * +ACE_Thread_Adapter::thr_mgr (void) +{ + return this->thr_mgr_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Control.cpp b/externals/ace/Thread_Control.cpp new file mode 100644 index 0000000..51d0f4c --- /dev/null +++ b/externals/ace/Thread_Control.cpp @@ -0,0 +1,96 @@ +// $Id: Thread_Control.cpp 80826 2008-03-04 14:51:23Z wotte $ + +// +#include "ace/config-all.h" +#if defined (ACE_LEGACY_MODE) +// This silly include breaks a cycle when compiling in backwards +// compatibility mode +# include "ace/Thread_Exit.h" +#endif /* ACE_LEGACY_MODE */ +// + +#include "ace/Thread_Control.h" +#include "ace/Thread_Manager.h" + +ACE_RCSID(ace, Thread_Control, "$Id: Thread_Control.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if !defined (ACE_HAS_INLINED_OSCALLS) +# include "ace/Thread_Control.inl" +#endif /* ACE_HAS_INLINED_OSCALLS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +void +ACE_Thread_Control::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_OS_TRACE ("ACE_Thread_Control::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_Thread_Control::insert (ACE_Thread_Manager *tm, int insert) +{ + ACE_OS_TRACE ("ACE_Thread_Control::insert"); + + ACE_hthread_t t_id; + ACE_OS::thr_self (t_id); + this->tm_ = tm; + + if (insert) + return this->tm_->insert_thr (ACE_OS::thr_self (), t_id); + else + return 0; +} + +// Initialize the thread controller. + +ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t, + int insert) + : tm_ (t), + status_ (0) +{ + ACE_OS_TRACE ("ACE_Thread_Control::ACE_Thread_Control"); + + if (this->tm_ != 0 && insert) + { + ACE_hthread_t t_id; + ACE_OS::thr_self (t_id); + this->tm_->insert_thr (ACE_OS::thr_self (), t_id); + } +} + +// Automatically kill thread on exit. + +ACE_Thread_Control::~ACE_Thread_Control (void) +{ + ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control"); + +#if defined (ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS) || defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32) + this->exit (this->status_, 0); +#else + this->exit (this->status_, 1); +#endif /* ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS */ +} + +// Exit from thread (but clean up first). + +ACE_THR_FUNC_RETURN +ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status, int do_thr_exit) +{ + ACE_OS_TRACE ("ACE_Thread_Control::exit"); + + if (this->tm_ != 0) + return this->tm_->exit (exit_status, do_thr_exit); + else + { +#if !defined (ACE_HAS_TSS_EMULATION) + // With ACE_HAS_TSS_EMULATION, we let ACE_Thread_Adapter::invoke () + // exit the thread after cleaning up TSS. + ACE_OS::thr_exit (exit_status); +#endif /* ! ACE_HAS_TSS_EMULATION */ + return 0; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Control.h b/externals/ace/Thread_Control.h new file mode 100644 index 0000000..3eb5185 --- /dev/null +++ b/externals/ace/Thread_Control.h @@ -0,0 +1,102 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Thread_Control.h + * + * $Id: Thread_Control.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ +//============================================================================= + + +#ifndef ACE_THREAD_CONTROL_H +#define ACE_THREAD_CONTROL_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Thread_Manager; + +/** + * @class ACE_Thread_Control + * + * @brief Used to keep track of a thread's activities within its entry + * point function. + * + * A ACE_Thread_Manager uses this class to ensure that threads + * it spawns automatically register and unregister themselves + * with it. + * This class can be stored in thread-specific storage using the + * ACE_TSS wrapper. When a thread exits the + * function deletes this object, thereby + * ensuring that it gets removed from its associated + * ACE_Thread_Manager. + */ +class ACE_Export ACE_Thread_Control +{ +public: + /// Initialize the thread control object. If @a insert != 0, then + /// register the thread with the Thread_Manager. + ACE_Thread_Control (ACE_Thread_Manager *tm = 0, + int insert = 0); + + /// Remove the thread from its associated and exit + /// the thread if is enabled. + ~ACE_Thread_Control (void); + + /// Remove this thread from its associated ACE_Thread_Manager and exit + /// the thread if @a do_thr_exit is enabled. + ACE_THR_FUNC_RETURN exit (ACE_THR_FUNC_RETURN status, + int do_thr_exit); + + /// Store the and use it to register ourselves for + /// correct shutdown. + int insert (ACE_Thread_Manager *tm, int insert = 0); + + /// Returns the current . + ACE_Thread_Manager *thr_mgr (void); + + /// Atomically set a new and return the old + /// . + ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *); + + /// Set the exit status (and return existing status). + ACE_THR_FUNC_RETURN status (ACE_THR_FUNC_RETURN status); + + /// Get the current exit status. + ACE_THR_FUNC_RETURN status (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the thread manager for this block of code. + ACE_Thread_Manager *tm_; + + /// Keeps track of the exit status for the thread. + ACE_THR_FUNC_RETURN status_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_HAS_INLINED_OSCALLS) +# if defined (ACE_INLINE) +# undef ACE_INLINE +# endif /* ACE_INLINE */ +# define ACE_INLINE inline +# include "ace/Thread_Control.inl" +# endif /* ACE_HAS_INLINED_OSCALLS */ + +#include /**/ "ace/post.h" +#endif /* ACE_THREAD_CONTROL_H */ diff --git a/externals/ace/Thread_Control.inl b/externals/ace/Thread_Control.inl new file mode 100644 index 0000000..6ebd3ac --- /dev/null +++ b/externals/ace/Thread_Control.inl @@ -0,0 +1,46 @@ +// -*- C++ -*- +// +// $Id: Thread_Control.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Set the exit status. + +ACE_INLINE ACE_THR_FUNC_RETURN +ACE_Thread_Control::status (ACE_THR_FUNC_RETURN s) +{ + ACE_OS_TRACE ("ACE_Thread_Control::status"); + return this->status_ = s; +} + +// Get the exit status. + +ACE_INLINE ACE_THR_FUNC_RETURN +ACE_Thread_Control::status (void) +{ + ACE_OS_TRACE ("ACE_Thread_Control::status"); + return this->status_; +} + +// Returns the current . + +ACE_INLINE ACE_Thread_Manager * +ACE_Thread_Control::thr_mgr (void) +{ + ACE_OS_TRACE ("ACE_Thread_Control::thr_mgr"); + return this->tm_; +} + +// Atomically set a new and return the old +// . + +ACE_INLINE ACE_Thread_Manager * +ACE_Thread_Control::thr_mgr (ACE_Thread_Manager *tm) +{ + ACE_OS_TRACE ("ACE_Thread_Control::thr_mgr"); + ACE_Thread_Manager *o_tm = this->tm_; + this->tm_ = tm; + return o_tm; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Exit.cpp b/externals/ace/Thread_Exit.cpp new file mode 100644 index 0000000..cc6a862 --- /dev/null +++ b/externals/ace/Thread_Exit.cpp @@ -0,0 +1,123 @@ +// $Id: Thread_Exit.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Thread_Exit.h" +#include "ace/Managed_Object.h" +#include "ace/Thread_Manager.h" +#include "ace/Guard_T.h" + +ACE_RCSID(ace, Thread_Exit, "$Id: Thread_Exit.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +bool ACE_Thread_Exit::is_constructed_ = false; + +void +ACE_Thread_Exit::cleanup (void *instance) +{ + ACE_OS_TRACE ("ACE_Thread_Exit::cleanup"); + + delete (ACE_TSS_TYPE (ACE_Thread_Exit) *) instance; + + // Set the thr_exit_ static to null to keep things from crashing if + // ACE::fini() is enabled here. + ACE_Thread_Manager::thr_exit_ = 0; + + ACE_Thread_Exit::is_constructed_ = false; + // All TSS objects have been destroyed. Reset this flag so + // ACE_Thread_Exit singleton can be created again. +} + +// NOTE: this preprocessor directive should match the one in +// ACE_Task_Base::svc_run () below. This prevents the two statics +// from being defined. + +ACE_Thread_Exit * +ACE_Thread_Exit::instance (void) +{ +#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION) + ACE_OS_TRACE ("ACE_Thread_Exit::instance"); + + // Determines if we were dynamically allocated. + static ACE_TSS_TYPE (ACE_Thread_Exit) * volatile instance_; + + // Implement the Double Check pattern. + + if (!ACE_Thread_Exit::is_constructed_) + { + ACE_MT (ACE_Thread_Mutex *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_THREAD_EXIT_LOCK); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); + + if (!ACE_Thread_Exit::is_constructed_) + { + ACE_NEW_RETURN (instance_, + ACE_TSS_TYPE (ACE_Thread_Exit), + 0); + + ACE_Thread_Exit::is_constructed_ = true; + + ACE_Thread_Manager::set_thr_exit (instance_); + } + } + + return ACE_TSS_GET (instance_, ACE_Thread_Exit); +#else + return 0; +#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ +} + +// Grab hold of the Task * so that we can close() it in the +// destructor. + +ACE_Thread_Exit::ACE_Thread_Exit (void) +{ + ACE_OS_TRACE ("ACE_Thread_Exit::ACE_Thread_Exit"); +} + +// Set the this pointer... + +void +ACE_Thread_Exit::thr_mgr (ACE_Thread_Manager *tm) +{ + ACE_OS_TRACE ("ACE_Thread_Exit::thr_mgr"); + + if (tm != 0) + this->thread_control_.insert (tm, 0); +} + +// When this object is destroyed the Task is automatically closed +// down! + +ACE_Thread_Exit::~ACE_Thread_Exit (void) +{ + ACE_OS_TRACE ("ACE_Thread_Exit::~ACE_Thread_Exit"); +} + +ACE_Thread_Exit_Maybe::ACE_Thread_Exit_Maybe (int flag) + : instance_ (0) +{ + if (flag) + { + ACE_NEW (instance_, ACE_Thread_Exit); + } +} + +ACE_Thread_Exit_Maybe::~ACE_Thread_Exit_Maybe (void) +{ + delete this->instance_; +} + +ACE_Thread_Exit * +ACE_Thread_Exit_Maybe::operator -> (void) const +{ + return this->instance_; +} + +ACE_Thread_Exit * +ACE_Thread_Exit_Maybe::instance (void) const +{ + return this->instance_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Exit.h b/externals/ace/Thread_Exit.h new file mode 100644 index 0000000..5b614e2 --- /dev/null +++ b/externals/ace/Thread_Exit.h @@ -0,0 +1,111 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Thread_Exit.h + * + * $Id: Thread_Exit.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ +//============================================================================= + + +#ifndef ACE_THREAD_EXIT_H +#define ACE_THREAD_EXIT_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Thread_Control.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Thread_Exit + * + * @brief Keep exit information for a Thread in thread specific storage. + * so that the thread-specific exit hooks will get called no + * matter how the thread exits (e.g., via , C++ + * or Win32 exception, "falling off the end" of the thread entry + * point function, etc.). + * + * This clever little helper class is stored in thread-specific + * storage using the wrapper. When a thread exits the + * function deletes this object, thereby + * closing it down gracefully. + */ +class ACE_Export ACE_Thread_Exit +{ +public: + /// Capture the Thread that will be cleaned up automatically. + ACE_Thread_Exit (void); + + /// Set the ACE_Thread_Manager. + void thr_mgr (ACE_Thread_Manager *tm); + + /// Destructor calls the thread-specific exit hooks when a thread + /// exits. + ~ACE_Thread_Exit (void); + + /// Singleton access point. + static ACE_Thread_Exit *instance (void); + + /// Cleanup method, used by the ACE_Object_Manager to destroy the + /// singleton. + static void cleanup (void *instance); + +private: + /// Automatically add/remove the thread from the + /// ACE_Thread_Manager. + ACE_Thread_Control thread_control_; + + /** + * Used to detect whether we should create a new instance (or not) + * within the instance method -- we don't trust the instance_ ptr + * because the destructor may have run (if ACE::fini() was called). + * See bug #526. + * We don't follow the singleton pattern due to dependency issues. + */ + static bool is_constructed_; +}; + +/** + * @class ACE_Thread_Exit_Maybe + * + * @brief A version of ACE_Thread_Exit that is created dynamically + * under the hood if the flag is set to TRUE. + * + * Allows the appearance of a "smart pointer", but is not + * always created. + */ +class ACE_Export ACE_Thread_Exit_Maybe +{ +public: + /// Don't create an ACE_Thread_Exit instance by default. + ACE_Thread_Exit_Maybe (int flag = 0); + + /// Destroys the underlying ACE_Thread_Exit instance if it exists. + ~ACE_Thread_Exit_Maybe (void); + + /// Delegates to underlying instance. + ACE_Thread_Exit * operator -> (void) const; + + /// Returns the underlying instance. + ACE_Thread_Exit * instance (void) const; + +private: + + /// Holds the underlying instance. + ACE_Thread_Exit *instance_; + +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_THREAD_EXIT_H */ diff --git a/externals/ace/Thread_Hook.cpp b/externals/ace/Thread_Hook.cpp new file mode 100644 index 0000000..79d937f --- /dev/null +++ b/externals/ace/Thread_Hook.cpp @@ -0,0 +1,33 @@ +// $Id: Thread_Hook.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Thread_Hook.h" +#include "ace/Object_Manager_Base.h" + +ACE_RCSID(ace, Thread_Hook, "$Id: Thread_Hook.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Thread_Hook::~ACE_Thread_Hook () +{ +} + +ACE_THR_FUNC_RETURN +ACE_Thread_Hook::start (ACE_THR_FUNC func, + void *arg) +{ + return (func) (arg); +} + +ACE_Thread_Hook * +ACE_Thread_Hook::thread_hook (ACE_Thread_Hook *hook) +{ + return ACE_OS_Object_Manager::thread_hook (hook); +} + +ACE_Thread_Hook * +ACE_Thread_Hook::thread_hook (void) +{ + return ACE_OS_Object_Manager::thread_hook (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Hook.h b/externals/ace/Thread_Hook.h new file mode 100644 index 0000000..7bc3bcc --- /dev/null +++ b/externals/ace/Thread_Hook.h @@ -0,0 +1,65 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Thread_Hook.h + * + * $Id: Thread_Hook.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Carlos O'Ryan + */ +//============================================================================= + + +#ifndef ACE_THREAD_HOOK_H +#define ACE_THREAD_HOOK_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/ACE_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Thread_Hook + * + * @brief This class makes it possible to provide user-defined "start" + * hooks that are called before the thread entry point function + * is invoked. + */ +class ACE_Export ACE_Thread_Hook +{ + +public: + + /// Destructor. + virtual ~ACE_Thread_Hook (void); + + /** + * This method can be overridden in a subclass to customize this + * pre-function call "hook" invocation that can perform + * initialization processing before the thread entry point @a func + * method is called back. The @a func and @a arg passed into the + * start hook are the same as those passed by the application that + * spawned the thread. + */ + virtual ACE_THR_FUNC_RETURN start (ACE_THR_FUNC func, + void *arg); + + /// sets the system wide thread hook, returns the previous thread + /// hook or 0 if none is set. + static ACE_Thread_Hook *thread_hook (ACE_Thread_Hook *hook); + + /// Returns the current system thread hook. + static ACE_Thread_Hook *thread_hook (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_THREAD_HOOK_H */ diff --git a/externals/ace/Thread_Manager.cpp b/externals/ace/Thread_Manager.cpp new file mode 100644 index 0000000..4737dcb --- /dev/null +++ b/externals/ace/Thread_Manager.cpp @@ -0,0 +1,2223 @@ +// $Id: Thread_Manager.cpp 85341 2009-05-14 11:07:37Z johnnyw $ + +#include "ace/TSS_T.h" +#include "ace/Thread_Manager.h" +#include "ace/Dynamic.h" +#include "ace/Object_Manager.h" +#include "ace/Singleton.h" +#include "ace/Auto_Ptr.h" +#include "ace/Guard_T.h" +#include "ace/Time_Value.h" +#include "ace/OS_NS_sys_time.h" +#include "ace/Truncate.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Thread_Manager.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (ace, + Thread_Manager, + "$Id: Thread_Manager.cpp 85341 2009-05-14 11:07:37Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_At_Thread_Exit::~ACE_At_Thread_Exit (void) +{ + this->do_apply (); +} + +ACE_At_Thread_Exit_Func::~ACE_At_Thread_Exit_Func (void) +{ + this->do_apply (); +} + +void +ACE_At_Thread_Exit_Func::apply (void) +{ + this->func_ (this->object_, this->param_); +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Control) +ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Manager) + +#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) +// Process-wide Thread Manager. +ACE_Thread_Manager *ACE_Thread_Manager::thr_mgr_ = 0; + +// Controls whether the Thread_Manager is deleted when we shut down +// (we can only delete it safely if we created it!) +bool ACE_Thread_Manager::delete_thr_mgr_ = false; +#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ + +ACE_TSS_TYPE (ACE_Thread_Exit) *ACE_Thread_Manager::thr_exit_ = 0; + +int +ACE_Thread_Manager::set_thr_exit (ACE_TSS_TYPE (ACE_Thread_Exit) *ptr) +{ + if (ACE_Thread_Manager::thr_exit_ == 0) + ACE_Thread_Manager::thr_exit_ = ptr; + else + return -1; + return 0; +} + +void +ACE_Thread_Manager::dump (void) +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Thread_Manager::dump"); + // Cast away const-ness of this in order to use its non-const lock_. + ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, + ((ACE_Thread_Manager *) this)->lock_)); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncurrent_count_ = %d"), this->thr_list_.size ())); + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + iter.next ()->dump (); + } + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Thread_Descriptor::~ACE_Thread_Descriptor (void) +{ + delete this->sync_; +} + +void +ACE_Thread_Descriptor::at_pop (int apply) +{ + ACE_TRACE ("ACE_Thread_Descriptor::at_pop"); + // Get first at from at_exit_list + ACE_At_Thread_Exit* at = this->at_exit_list_; + // Remove at from at_exit list + this->at_exit_list_ = at->next_; + // Apply if required + if (apply) + { + at->apply (); + // Do the apply method + at->was_applied (true); + // Mark at has been applied to avoid double apply from + // at destructor + } + // If at is not owner delete at. + if (!at->is_owner ()) + delete at; +} + +void +ACE_Thread_Descriptor::at_push (ACE_At_Thread_Exit* cleanup, bool is_owner) +{ + ACE_TRACE ("ACE_Thread_Descriptor::at_push"); + cleanup->is_owner (is_owner); + cleanup->td_ = this; + cleanup->next_ = at_exit_list_; + at_exit_list_ = cleanup; +} + +int +ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit& cleanup) +{ + ACE_TRACE ("ACE_Thread_Descriptor::at_exit"); + at_push (&cleanup, 1); + return 0; +} + +int +ACE_Thread_Descriptor::at_exit (ACE_At_Thread_Exit* cleanup) +{ + ACE_TRACE ("ACE_Thread_Descriptor::at_exit"); + if (cleanup==0) + return -1; + else + { + this->at_push (cleanup); + return 0; + } +} + +void +ACE_Thread_Descriptor::do_at_exit () +{ + ACE_TRACE ("ACE_Thread_Descriptor::do_at_exit"); + while (at_exit_list_!=0) + this->at_pop (); +} + +void +ACE_Thread_Descriptor::terminate () +{ + ACE_TRACE ("ACE_Thread_Descriptor::terminate"); + + if (!terminated_) + { + ACE_Log_Msg* log_msg = this->log_msg_; + terminated_ = true; + // Run at_exit hooks + this->do_at_exit (); + // We must remove Thread_Descriptor from Thread_Manager list + if (this->tm_ != 0) + { + int close_handle = 0; + +#if !defined (ACE_HAS_VXTHREADS) + // Threads created with THR_DAEMON shouldn't exist here, but + // just to be safe, let's put it here. + + if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_JOINING)) + { + if (ACE_BIT_DISABLED (this->flags_, THR_DETACHED | THR_DAEMON) + || ACE_BIT_ENABLED (this->flags_, THR_JOINABLE)) + { + // Mark thread as terminated. + ACE_SET_BITS (this->thr_state_, ACE_Thread_Manager::ACE_THR_TERMINATED); + tm_->register_as_terminated (this); + // Must copy the information here because td will be + // "freed" below. + } +#if defined (ACE_WIN32) + else + { + close_handle = 1; + } +#endif /* ACE_WIN32 */ + } +#endif /* !ACE_HAS_VXTHREADS */ + + // Remove thread descriptor from the table. + if (this->tm_ != 0) + tm_->remove_thr (this, close_handle); + } + + // Check if we need delete ACE_Log_Msg instance + // If ACE_TSS_cleanup was not executed first log_msg == 0 + if (log_msg == 0) + { + // Only inform to ACE_TSS_cleanup that it must delete the log instance + // setting ACE_LOG_MSG thr_desc to 0. + ACE_LOG_MSG->thr_desc (0); + } + else + { + // Thread_Descriptor is the owner of the Log_Msg instance!! + // deleted. + this->log_msg_ = 0; + delete log_msg; + } + } +} + +int +ACE_Thread_Descriptor::at_exit (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param) +{ + ACE_TRACE ("ACE_Thread_Descriptor::at_exit"); + // To keep compatibility, when cleanup_hook is null really is a at_pop + // without apply. + if (cleanup_hook == 0) + { + if (this->at_exit_list_!= 0) + this->at_pop(0); + } + else + { + ACE_At_Thread_Exit* cleanup = 0; + ACE_NEW_RETURN (cleanup, + ACE_At_Thread_Exit_Func (object, + cleanup_hook, + param), + -1); + this->at_push (cleanup); + } + return 0; +} + +void +ACE_Thread_Descriptor::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Thread_Descriptor::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_id_ = %d"), this->thr_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_handle_ = %d"), this->thr_handle_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_state_ = %d"), this->thr_state_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags_ = %x\n"), this->flags_)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Thread_Descriptor::ACE_Thread_Descriptor (void) + : log_msg_ (0), + at_exit_list_ (0), + terminated_ (false) +{ + ACE_TRACE ("ACE_Thread_Descriptor::ACE_Thread_Descriptor"); + ACE_NEW (this->sync_, + ACE_DEFAULT_THREAD_MANAGER_LOCK); +} + +void +ACE_Thread_Descriptor::acquire_release (void) +{ + // Just try to acquire the lock then release it. +#if defined (ACE_THREAD_MANAGER_USES_SAFE_SPAWN) + if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)) +#endif /* ACE_THREAD_MANAGER_USES_SAFE_SPAWN */ + { + this->sync_->acquire (); + // Acquire the lock before removing from the thread table. If + // this thread is in the table already, it should simply acquire the + // lock easily. + + // Once we get the lock, we must have registered. + ACE_ASSERT (ACE_BIT_ENABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)); + + this->sync_->release (); + // Release the lock before putting it back to freelist. + } +} + +void +ACE_Thread_Descriptor::acquire (void) +{ + // Just try to acquire the lock then release it. +#if defined (ACE_THREAD_MANAGER_USES_SAFE_SPAWN) + if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)) +#endif /* ACE_THREAD_MANAGER_USES_SAFE_SPAWN */ + { + this->sync_->acquire (); + } +} + +void +ACE_Thread_Descriptor::release (void) +{ + // Just try to acquire the lock then release it. +#if defined (ACE_THREAD_MANAGER_USES_SAFE_SPAWN) + if (ACE_BIT_DISABLED (this->thr_state_, ACE_Thread_Manager::ACE_THR_SPAWNED)) +#endif /* ACE_THREAD_MANAGER_USES_SAFE_SPAWN */ + { + this->sync_->release (); + // Release the lock before putting it back to freelist. + } +} + +// The following macro simplifies subsequence code. +#define ACE_FIND(OP,INDEX) \ + ACE_Thread_Descriptor *INDEX = OP; \ + +ACE_Thread_Descriptor * +ACE_Thread_Manager::thread_descriptor (ACE_thread_t thr_id) +{ + ACE_TRACE ("ACE_Thread_Manager::thread_descriptor"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + + ACE_FIND (this->find_thread (thr_id), ptr); + return ptr; +} + +ACE_Thread_Descriptor * +ACE_Thread_Manager::hthread_descriptor (ACE_hthread_t thr_handle) +{ + ACE_TRACE ("ACE_Thread_Manager::hthread_descriptor"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + + ACE_FIND (this->find_hthread (thr_handle), ptr); + return ptr; +} + +// Return the thread descriptor (indexed by ACE_hthread_t). + +int +ACE_Thread_Manager::thr_self (ACE_hthread_t &self) +{ + ACE_TRACE ("ACE_Thread_Manager::thr_self"); + + ACE_Thread_Descriptor *desc = + this->thread_desc_self (); + + if (desc == 0) + return -1; + else + desc->self (self); + + return 0; +} + +// Initialize the synchronization variables. + +ACE_Thread_Manager::ACE_Thread_Manager (size_t prealloc, + size_t lwm, + size_t inc, + size_t hwm) + : grp_id_ (1), + automatic_wait_ (1) +#if defined (ACE_HAS_THREADS) + , zero_cond_ (lock_) +#endif /* ACE_HAS_THREADS */ + , thread_desc_freelist_ (ACE_FREE_LIST_WITH_POOL, + prealloc, lwm, hwm, inc) +{ + ACE_TRACE ("ACE_Thread_Manager::ACE_Thread_Manager"); +} + +#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) +ACE_Thread_Manager * +ACE_Thread_Manager::instance (void) +{ + ACE_TRACE ("ACE_Thread_Manager::instance"); + + if (ACE_Thread_Manager::thr_mgr_ == 0) + { + // Perform Double-Checked Locking Optimization. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + + if (ACE_Thread_Manager::thr_mgr_ == 0) + { + ACE_NEW_RETURN (ACE_Thread_Manager::thr_mgr_, + ACE_Thread_Manager, + 0); + ACE_Thread_Manager::delete_thr_mgr_ = true; + } + } + + return ACE_Thread_Manager::thr_mgr_; +} + +ACE_Thread_Manager * +ACE_Thread_Manager::instance (ACE_Thread_Manager *tm) +{ + ACE_TRACE ("ACE_Thread_Manager::instance"); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance (), 0)); + + ACE_Thread_Manager *t = ACE_Thread_Manager::thr_mgr_; + // We can't safely delete it since we don't know who created it! + ACE_Thread_Manager::delete_thr_mgr_ = false; + + ACE_Thread_Manager::thr_mgr_ = tm; + return t; +} + +void +ACE_Thread_Manager::close_singleton (void) +{ + ACE_TRACE ("ACE_Thread_Manager::close_singleton"); + + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, + *ACE_Static_Object_Lock::instance ())); + + if (ACE_Thread_Manager::delete_thr_mgr_) + { + // First, we clean up the thread descriptor list. + ACE_Thread_Manager::thr_mgr_->close (); + delete ACE_Thread_Manager::thr_mgr_; + ACE_Thread_Manager::thr_mgr_ = 0; + ACE_Thread_Manager::delete_thr_mgr_ = false; + } + + ACE_Thread_Exit::cleanup (ACE_Thread_Manager::thr_exit_); +} +#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ + +// Close up and release all resources. + +int +ACE_Thread_Manager::close () +{ + ACE_TRACE ("ACE_Thread_Manager::close"); + + // Clean up the thread descriptor list. + if (this->automatic_wait_) + this->wait (0, 1); + else + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + this->remove_thr_all (); + } + + return 0; +} + +ACE_Thread_Manager::~ACE_Thread_Manager (void) +{ + ACE_TRACE ("ACE_Thread_Manager::~ACE_Thread_Manager"); + this->close (); +} + + +// Run the entry point for thread spawned under the control of the +// . This must be an extern "C" to make certain +// compilers happy... +// +// The interaction with and +// works like this, with +// ACE_HAS_THREAD_SPECIFIC_STORAGE or ACE_HAS_TSS_EMULATION: +// +// o Every thread in the is run with +// . +// +// o retrieves the singleton +// instance from . +// The singleton gets created in thread-specific storage +// in the first call to that function. The key point is that the +// instance is in thread-specific storage. +// +// o A thread can exit by various means, such as , C++ +// or Win32 exception, "falling off the end" of the thread entry +// point function, etc. +// +// o If you follow this so far, now it gets really fun . . . +// When the thread-specific storage (for the thread that +// is being destroyed) is cleaned up, the OS threads package (or +// the ACE emulation of thread-specific storage) will destroy any +// objects that are in thread-specific storage. It has a list of +// them, and just walks down the list and destroys each one. +// +// o That's where the ACE_Thread_Exit destructor gets called. + +#if defined(ACE_USE_THREAD_MANAGER_ADAPTER) +extern "C" void * +ace_thread_manager_adapter (void *args) +{ +#if defined (ACE_HAS_TSS_EMULATION) + // As early as we can in the execution of the new thread, allocate + // its local TS storage. Allocate it on the stack, to save dynamic + // allocation/dealloction. + void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX]; + ACE_TSS_Emulation::tss_open (ts_storage); +#endif /* ACE_HAS_TSS_EMULATION */ + + ACE_Thread_Adapter *thread_args = reinterpret_cast (args); + + // NOTE: this preprocessor directive should match the one in above + // ACE_Thread_Exit::instance (). With the Xavier Pthreads package, + // the exit_hook in TSS causes a seg fault. So, this works around + // that by creating exit_hook on the stack. +#if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION) + // Obtain our thread-specific exit hook and make sure that it knows + // how to clean us up! Note that we never use this pointer directly + // (it's stored in thread-specific storage), so it's ok to + // dereference it here and only store it as a reference. + ACE_Thread_Exit &exit_hook = *ACE_Thread_Exit::instance (); +#else + // Without TSS, create an instance. When this + // function returns, its destructor will be called because the + // object goes out of scope. The drawback with this appraoch is + // that the destructor _won't_ get called if is called. + // So, threads shouldn't exit that way. Instead, they should return + // from . + ACE_Thread_Exit exit_hook; +#endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ + + // Keep track of the that's associated with this + // . + exit_hook.thr_mgr (thread_args->thr_mgr ()); + + // Invoke the user-supplied function with the args. + void *status = thread_args->invoke (); + + delete static_cast (thread_args); + return status; +} +#endif + +// Call the appropriate OS routine to spawn a thread. Should *not* be +// called with the lock_ held... + +int +ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, + void *args, + long flags, + ACE_thread_t *t_id, + ACE_hthread_t *t_handle, + long priority, + int grp_id, + void *stack, + size_t stack_size, + ACE_Task_Base *task, + const char** thr_name) +{ + // First, threads created by Thread Manager should not be daemon threads. + // Using assertion is probably a bit too strong. However, it helps + // finding this kind of error as early as possible. Perhaps we can replace + // assertion by returning error. + ACE_ASSERT (ACE_BIT_DISABLED (flags, THR_DAEMON)); + + // Create a new thread running . *Must* be called with the + // held... + // Get a "new" Thread Descriptor from the freelist. + auto_ptr new_thr_desc (this->thread_desc_freelist_.remove ()); + + // Reset thread descriptor status + new_thr_desc->reset (this); + + ACE_Thread_Adapter *thread_args = 0; +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + ACE_NEW_RETURN (thread_args, + ACE_Thread_Adapter (func, + args, + (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, + this, + new_thr_desc.get (), + ACE_OS_Object_Manager::seh_except_selector(), + ACE_OS_Object_Manager::seh_except_handler()), + -1); +# else + ACE_NEW_RETURN (thread_args, + ACE_Thread_Adapter (func, + args, + (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, + this, + new_thr_desc.get ()), + -1); +# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + auto_ptr auto_thread_args (static_cast (thread_args)); + + ACE_TRACE ("ACE_Thread_Manager::spawn_i"); + ACE_hthread_t thr_handle; + + ACE_thread_t thr_id; + if (t_id == 0) + t_id = &thr_id; + + // Acquire the lock to block the spawned thread from + // removing this Thread Descriptor before it gets put into our + // thread table. + new_thr_desc->sync_->acquire (); + + int const result = ACE_Thread::spawn (func, + args, + flags, + t_id, + &thr_handle, + priority, + stack, + stack_size, + thread_args, + thr_name); + + if (result != 0) + { + // _Don't_ clobber errno here! result is either 0 or -1, and + // ACE_OS::thr_create () already set errno! D. Levine 28 Mar 1997 + // errno = result; + ACE_Errno_Guard guard (errno); // Lock release may smash errno + new_thr_desc->sync_->release (); + return -1; + } + auto_thread_args.release (); + +#if defined (ACE_HAS_WTHREADS) + // Have to duplicate handle if client asks for it. + // @@ How are thread handles implemented on AIX? Do they + // also need to be duplicated? + if (t_handle != 0) +# if defined (ACE_LACKS_DUPLICATEHANDLE) + *t_handle = thr_handle; +# else /* ! ACE_LACKS_DUP */ + (void) ::DuplicateHandle (::GetCurrentProcess (), + thr_handle, + ::GetCurrentProcess (), + t_handle, + 0, + TRUE, + DUPLICATE_SAME_ACCESS); +# endif /* ! ACE_LACKS_DUP */ +#else /* ! ACE_HAS_WTHREADS */ + if (t_handle != 0) + *t_handle = thr_handle; +#endif /* ! ACE_HAS_WTHREADS */ + + // append_thr also put the into Thread_Manager's + // double-linked list. Only after this point, can we manipulate + // double-linked list from a spawned thread's context. + return this->append_thr (*t_id, + thr_handle, + ACE_THR_SPAWNED, + grp_id, + task, + flags, + new_thr_desc.release ()); +} + +int +ACE_Thread_Manager::spawn (ACE_THR_FUNC func, + void *args, + long flags, + ACE_thread_t *t_id, + ACE_hthread_t *t_handle, + long priority, + int grp_id, + void *stack, + size_t stack_size, + const char** thr_name) +{ + ACE_TRACE ("ACE_Thread_Manager::spawn"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + if (grp_id == -1) + grp_id = this->grp_id_++; // Increment the group id. + + if (priority != ACE_DEFAULT_THREAD_PRIORITY) + ACE_CLR_BITS (flags, THR_INHERIT_SCHED); + + if (this->spawn_i (func, + args, + flags, + t_id, + t_handle, + priority, + grp_id, + stack, + stack_size, + 0, + thr_name) == -1) + return -1; + + return grp_id; +} + +// Create N new threads running FUNC. + +int +ACE_Thread_Manager::spawn_n (size_t n, + ACE_THR_FUNC func, + void *args, + long flags, + long priority, + int grp_id, + ACE_Task_Base *task, + ACE_hthread_t thread_handles[], + void *stack[], + size_t stack_size[], + const char* thr_name[]) +{ + ACE_TRACE ("ACE_Thread_Manager::spawn_n"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + if (grp_id == -1) + grp_id = this->grp_id_++; // Increment the group id. + + for (size_t i = 0; i < n; i++) + { + // @@ What should happen if this fails?! e.g., should we try to + // cancel the other threads that we've already spawned or what? + if (this->spawn_i (func, + args, + flags, + 0, + thread_handles == 0 ? 0 : &thread_handles[i], + priority, + grp_id, + stack == 0 ? 0 : stack[i], + stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i], + task, + thr_name == 0 ? 0 : &thr_name [i]) == -1) + return -1; + } + + return grp_id; +} + +// Create N new threads running FUNC. + +int +ACE_Thread_Manager::spawn_n (ACE_thread_t thread_ids[], + size_t n, + ACE_THR_FUNC func, + void *args, + long flags, + long priority, + int grp_id, + void *stack[], + size_t stack_size[], + ACE_hthread_t thread_handles[], + ACE_Task_Base *task, + const char* thr_name[]) +{ + ACE_TRACE ("ACE_Thread_Manager::spawn_n"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + if (grp_id == -1) + grp_id = this->grp_id_++; // Increment the group id. + + for (size_t i = 0; i < n; i++) + { + // @@ What should happen if this fails?! e.g., should we try to + // cancel the other threads that we've already spawned or what? + if (this->spawn_i (func, + args, + flags, + thread_ids == 0 ? 0 : &thread_ids[i], + thread_handles == 0 ? 0 : &thread_handles[i], + priority, + grp_id, + stack == 0 ? 0 : stack[i], + stack_size == 0 ? ACE_DEFAULT_THREAD_STACKSIZE : stack_size[i], + task, + thr_name == 0 ? 0 : &thr_name [i]) == -1) + return -1; + } + + return grp_id; +} + +// Append a thread into the pool (does not check for duplicates). +// Must be called with locks held. + +int +ACE_Thread_Manager::append_thr (ACE_thread_t t_id, + ACE_hthread_t t_handle, + ACE_UINT32 thr_state, + int grp_id, + ACE_Task_Base *task, + long flags, + ACE_Thread_Descriptor *td) +{ + ACE_TRACE ("ACE_Thread_Manager::append_thr"); + ACE_Thread_Descriptor *thr_desc = 0; + + if (td == 0) + { + ACE_NEW_RETURN (thr_desc, + ACE_Thread_Descriptor, + -1); + thr_desc->tm_ = this; + // Setup the Thread_Manager. + } + else + thr_desc = td; + + thr_desc->thr_id_ = t_id; + thr_desc->thr_handle_ = t_handle; + thr_desc->grp_id_ = grp_id; + thr_desc->task_ = task; + thr_desc->flags_ = flags; + + this->thr_list_.insert_head (thr_desc); + ACE_SET_BITS (thr_desc->thr_state_, thr_state); + thr_desc->sync_->release (); + + return 0; +} + +// Return the thread descriptor (indexed by ACE_hthread_t). + +ACE_Thread_Descriptor * +ACE_Thread_Manager::find_hthread (ACE_hthread_t h_id) +{ + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (ACE_OS::thr_cmp (iter.next ()->thr_handle_, h_id)) + { + return iter.next (); + } + } + + return 0; +} + +// Locate the index in the table associated with . Must be +// called with the lock held. + +ACE_Thread_Descriptor * +ACE_Thread_Manager::find_thread (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread_Manager::find_thread"); + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (ACE_OS::thr_equal (iter.next ()->thr_id_, t_id)) + { + return iter.next (); + } + } + return 0; +} + +// Insert a thread into the pool (checks for duplicates and doesn't +// allow them to be inserted twice). + +int +ACE_Thread_Manager::insert_thr (ACE_thread_t t_id, + ACE_hthread_t t_handle, + int grp_id, + long flags) +{ + ACE_TRACE ("ACE_Thread_Manager::insert_thr"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + // Check for duplicates and bail out if we're already registered... + if (this->find_thread (t_id) != 0 ) + return -1; + + if (grp_id == -1) + grp_id = this->grp_id_++; + + if (this->append_thr (t_id, + t_handle, + ACE_THR_SPAWNED, + grp_id, + 0, + flags) == -1) + return -1; + + return grp_id; +} + +// Run the registered hooks when the thread exits. + +void +ACE_Thread_Manager::run_thread_exit_hooks (int i) +{ +#if 0 // currently unused! + ACE_TRACE ("ACE_Thread_Manager::run_thread_exit_hooks"); + + // @@ Currently, we have just one hook. This should clearly be + // generalized to support an arbitrary number of hooks. + + ACE_Thread_Descriptor *td = this->thread_desc_self (); + for (ACE_Cleanup_Info_Node *iter = td->cleanup_info_->pop_front (); + iter != 0; + iter = cleanup_info_->pop_front ()) + { + if (iter->cleanup_hook () != 0) + { + (*iter->cleanup_hook ()) (iter->object (), iter->param ()); + } + delete iter; + } + + ACE_UNUSED_ARG (i); +#else + ACE_UNUSED_ARG (i); +#endif /* 0 */ +} + +// Remove a thread from the pool. Must be called with locks held. + +void +ACE_Thread_Manager::remove_thr (ACE_Thread_Descriptor *td, + int close_handler) +{ + ACE_TRACE ("ACE_Thread_Manager::remove_thr"); + + td->tm_ = 0; + this->thr_list_.remove (td); + +#if defined (ACE_WIN32) + if (close_handler != 0) + ::CloseHandle (td->thr_handle_); +#else + ACE_UNUSED_ARG (close_handler); +#endif /* ACE_WIN32 */ + + this->thread_desc_freelist_.add (td); + +#if defined (ACE_HAS_THREADS) + // Tell all waiters when there are no more threads left in the pool. + if (this->thr_list_.size () == 0) + this->zero_cond_.broadcast (); +#endif /* ACE_HAS_THREADS */ +} + +// Repeatedly call remove_thr on all table entries until there +// is no thread left. Must be called with lock held. +void +ACE_Thread_Manager::remove_thr_all (void) +{ + ACE_Thread_Descriptor *td = 0; + + while ((td = this->thr_list_.delete_head ()) != 0) + { + this->remove_thr (td, 1); + } +} + +// ------------------------------------------------------------------ +// Factor out some common behavior to simplify the following methods. +#define ACE_THR_OP(OP,STATE) \ + int result = OP (td->thr_handle_); \ + if (result == -1) { \ + if (errno != ENOTSUP) \ + this->thr_to_be_removed_.enqueue_tail (td); \ + return -1; \ + } \ + else { \ + ACE_SET_BITS (td->thr_state_, STATE); \ + return 0; \ + } + +int +ACE_Thread_Manager::join_thr (ACE_Thread_Descriptor *td, int) +{ + ACE_TRACE ("ACE_Thread_Manager::join_thr"); + int const result = ACE_Thread::join (td->thr_handle_); + if (result != 0) + { + // Since the thread are being joined, we should + // let it remove itself from the list. + + // this->remove_thr (td); + errno = result; + return -1; + } + + return 0; +} + +int +ACE_Thread_Manager::suspend_thr (ACE_Thread_Descriptor *td, int) +{ + ACE_TRACE ("ACE_Thread_Manager::suspend_thr"); + + int const result = ACE_Thread::suspend (td->thr_handle_); + if (result == -1) { + if (errno != ENOTSUP) + this->thr_to_be_removed_.enqueue_tail (td); + return -1; + } + else { + ACE_SET_BITS (td->thr_state_, ACE_THR_SUSPENDED); + return 0; + } +} + +int +ACE_Thread_Manager::resume_thr (ACE_Thread_Descriptor *td, int) +{ + ACE_TRACE ("ACE_Thread_Manager::resume_thr"); + + int const result = ACE_Thread::resume (td->thr_handle_); + if (result == -1) { + if (errno != ENOTSUP) + this->thr_to_be_removed_.enqueue_tail (td); + return -1; + } + else { + ACE_CLR_BITS (td->thr_state_, ACE_THR_SUSPENDED); + return 0; + } +} + +int +ACE_Thread_Manager::cancel_thr (ACE_Thread_Descriptor *td, int async_cancel) +{ + ACE_TRACE ("ACE_Thread_Manager::cancel_thr"); + // Must set the state first and then try to cancel the thread. + ACE_SET_BITS (td->thr_state_, ACE_THR_CANCELLED); + + if (async_cancel != 0) + // Note that this call only does something relevant if the OS + // platform supports asynchronous thread cancellation. Otherwise, + // it's a no-op. + return ACE_Thread::cancel (td->thr_id_); + + return 0; +} + +int +ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum) +{ + ACE_TRACE ("ACE_Thread_Manager::kill_thr"); + + ACE_thread_t tid = td->thr_id_; + + int const result = ACE_Thread::kill (tid, signum); + + if (result != 0) + { + // Only remove a thread from us when there is a "real" error. + if (errno != ENOTSUP) + this->thr_to_be_removed_.enqueue_tail (td); + + return -1; + } + + return 0; +} + +// ------------------------------------------------------------------ +// Factor out some common behavior to simplify the following methods. +#define ACE_EXECUTE_OP(OP, ARG) \ + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); \ + ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); \ + ACE_FIND (this->find_thread (t_id), ptr); \ + if (ptr == 0) \ + { \ + errno = ENOENT; \ + return -1; \ + } \ + int const result = OP (ptr, ARG); \ + ACE_Errno_Guard error (errno); \ + while (! this->thr_to_be_removed_.is_empty ()) { \ + ACE_Thread_Descriptor * td = 0; \ + this->thr_to_be_removed_.dequeue_head (td); \ + this->remove_thr (td, 1); \ + } \ + return result + +// Suspend a single thread. + +int +ACE_Thread_Manager::suspend (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread_Manager::suspend"); + ACE_EXECUTE_OP (this->suspend_thr, 0); +} + +// Resume a single thread. + +int +ACE_Thread_Manager::resume (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread_Manager::resume"); + ACE_EXECUTE_OP (this->resume_thr, 0); +} + +// Cancel a single thread. + +int +ACE_Thread_Manager::cancel (ACE_thread_t t_id, int async_cancel) +{ + ACE_TRACE ("ACE_Thread_Manager::cancel"); + ACE_EXECUTE_OP (this->cancel_thr, async_cancel); +} + +// Send a signal to a single thread. + +int +ACE_Thread_Manager::kill (ACE_thread_t t_id, int signum) +{ + ACE_TRACE ("ACE_Thread_Manager::kill"); + ACE_EXECUTE_OP (this->kill_thr, signum); +} + +int +ACE_Thread_Manager::check_state (ACE_UINT32 state, + ACE_thread_t id, + int enable) +{ + ACE_TRACE ("ACE_Thread_Manager::check_state"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + ACE_UINT32 thr_state; + + int self_check = ACE_OS::thr_equal (id, ACE_OS::thr_self ()); + + // If we're checking the state of our thread, try to get the cached + // value out of TSS to avoid lookup. + if (self_check) + { + ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc (); + if (desc == 0) + return 0; // Always return false. + thr_state = desc->thr_state_; + } + else + { + // Not calling from self, have to look it up from the list. + ACE_FIND (this->find_thread (id), ptr); + if (ptr == 0) + return 0; + thr_state = ptr->thr_state_; + } + if (enable) + return ACE_BIT_ENABLED (thr_state, state); + + return ACE_BIT_DISABLED (thr_state, state); +} + +// Test if a single thread has terminated. + +int +ACE_Thread_Manager::testterminate (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread_Manager::testterminate"); + return this->check_state (ACE_THR_TERMINATED, t_id); +} + +// Test if a single thread is suspended. + +int +ACE_Thread_Manager::testsuspend (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread_Manager::testsuspend"); + return this->check_state (ACE_THR_SUSPENDED, t_id); +} + +// Test if a single thread is active (i.e., resumed). + +int +ACE_Thread_Manager::testresume (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread_Manager::testresume"); + return this->check_state (ACE_THR_SUSPENDED, t_id, 0); +} + +// Test if a single thread is cancelled. + +int +ACE_Thread_Manager::testcancel (ACE_thread_t t_id) +{ + ACE_TRACE ("ACE_Thread_Manager::testcancel"); + return this->check_state (ACE_THR_CANCELLED, t_id); +} + +// Thread information query functions. + +int +ACE_Thread_Manager::hthread_within (ACE_hthread_t handle) +{ + ACE_TRACE ("ACE_Thread_Manager::hthread_within"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1)); + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (ACE_OS::thr_cmp(iter.next ()->thr_handle_, handle)) + { + return 1; + } + } + + return 0; +} + +int +ACE_Thread_Manager::thread_within (ACE_thread_t tid) +{ + ACE_TRACE ("ACE_Thread_Manager::thread_within"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1)); + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (ACE_OS::thr_equal (iter.next ()->thr_id_, tid)) + { + return 1; + } + } + + return 0; +} + +// Get group ids for a particular thread id. + +int +ACE_Thread_Manager::get_grp (ACE_thread_t t_id, int &grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::get_grp"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + ACE_FIND (this->find_thread (t_id), ptr); + + if (ptr) + grp_id = ptr->grp_id_; + else + return -1; + return 0; +} + +// Set group ids for a particular thread id. + +int +ACE_Thread_Manager::set_grp (ACE_thread_t t_id, int grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::set_grp"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + ACE_FIND (this->find_thread (t_id), ptr); + if (ptr) + ptr->grp_id_ = grp_id; + else + return -1; + return 0; +} + +// Suspend a group of threads. + +int +ACE_Thread_Manager::apply_grp (int grp_id, + ACE_THR_MEMBER_FUNC func, + int arg) +{ + ACE_TRACE ("ACE_Thread_Manager::apply_grp"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1)); + ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); + + int result = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (iter.next ()->grp_id_ == grp_id) + { + if ((this->*func) (iter.next (), arg) == -1) + { + result = -1; + } + } + } + + // Must remove threads after we have traversed the thr_list_ to + // prevent clobber thr_list_'s integrity. + + if (! this->thr_to_be_removed_.is_empty ()) + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + + for (ACE_Thread_Descriptor *td; + this->thr_to_be_removed_.dequeue_head (td) != -1; + ) + this->remove_thr (td, 1); + } + + return result; +} + +int +ACE_Thread_Manager::suspend_grp (int grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::suspend_grp"); + return this->apply_grp (grp_id, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr)); +} + +// Resume a group of threads. + +int +ACE_Thread_Manager::resume_grp (int grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::resume_grp"); + return this->apply_grp (grp_id, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr)); +} + +// Kill a group of threads. + +int +ACE_Thread_Manager::kill_grp (int grp_id, int signum) +{ + ACE_TRACE ("ACE_Thread_Manager::kill_grp"); + return this->apply_grp (grp_id, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::kill_thr), signum); +} + +// Cancel a group of threads. + +int +ACE_Thread_Manager::cancel_grp (int grp_id, int async_cancel) +{ + ACE_TRACE ("ACE_Thread_Manager::cancel_grp"); + return this->apply_grp (grp_id, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr), + async_cancel); +} + +int +ACE_Thread_Manager::apply_all (ACE_THR_MEMBER_FUNC func, int arg) +{ + ACE_TRACE ("ACE_Thread_Manager::apply_all"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); + + int result = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if ((this->*func)(iter.next (), arg) == -1) + { + result = -1; + } + } + + // Must remove threads after we have traversed the thr_list_ to + // prevent clobber thr_list_'s integrity. + + if (! this->thr_to_be_removed_.is_empty ()) + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + + for (ACE_Thread_Descriptor *td; + this->thr_to_be_removed_.dequeue_head (td) != -1; + ) + this->remove_thr (td, 1); + } + + return result; +} + +// Resume all threads that are suspended. + +int +ACE_Thread_Manager::resume_all (void) +{ + ACE_TRACE ("ACE_Thread_Manager::resume_all"); + return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr)); +} + +int +ACE_Thread_Manager::suspend_all (void) +{ + ACE_TRACE ("ACE_Thread_Manager::suspend_all"); + return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr)); +} + +int +ACE_Thread_Manager::kill_all (int sig) +{ + ACE_TRACE ("ACE_Thread_Manager::kill_all"); + return this->apply_all (&ACE_Thread_Manager::kill_thr, sig); +} + +int +ACE_Thread_Manager::cancel_all (int async_cancel) +{ + ACE_TRACE ("ACE_Thread_Manager::cancel_all"); + return this->apply_all (ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr), + async_cancel); +} + +int +ACE_Thread_Manager::join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status) +{ + ACE_TRACE ("ACE_Thread_Manager::join"); + + bool found = false; + ACE_Thread_Descriptor_Base tdb; + + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + +#if !defined (ACE_HAS_VXTHREADS) + for (ACE_Double_Linked_List_Iterator biter (this->terminated_thr_list_); + !biter.done (); + biter.advance ()) + { + if (ACE_OS::thr_equal (biter.next ()->thr_id_, tid)) + { + ACE_Thread_Descriptor_Base *tdb = biter.advance_and_remove (false); + if (ACE_Thread::join (tdb->thr_handle_, status) == -1) + { + return -1; + } + delete tdb; + + // return immediately if we've found the thread we want to join. + return 0; + } + } +#endif /* !ACE_HAS_VXTHREADS */ + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + // If threads are created as THR_DETACHED or THR_DAEMON, we + // can't help much. + if (ACE_OS::thr_equal (iter.next ()->thr_id_,tid) && + (ACE_BIT_DISABLED (iter.next ()->flags_, THR_DETACHED | THR_DAEMON) + || ACE_BIT_ENABLED (iter.next ()->flags_, THR_JOINABLE))) + { + tdb = *iter.next (); + ACE_SET_BITS (iter.next ()->thr_state_, ACE_THR_JOINING); + found = 1; + break; + } + } + + if (!found) + return -1; + // Didn't find the thread we want or the thread is not joinable. + } + + if (ACE_Thread::join (tdb.thr_handle_, status) == -1) + return -1; + + return 0; +} + +// Wait for group of threads + +int +ACE_Thread_Manager::wait_grp (int grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::wait_grp"); + + int copy_count = 0; + ACE_Thread_Descriptor_Base *copy_table = 0; + + // We have to make sure that while we wait for these threads to + // exit, we do not have the lock. Therefore we make a copy of all + // interesting entries and let go of the lock. + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + +#if !defined (ACE_HAS_VXTHREADS) + ACE_NEW_RETURN (copy_table, + ACE_Thread_Descriptor_Base [this->thr_list_.size () + + this->terminated_thr_list_.size ()], + -1); +#else + ACE_NEW_RETURN (copy_table, + ACE_Thread_Descriptor_Base [this->thr_list_.size ()], + -1); +#endif /* !ACE_HAS_VXTHREADS */ + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + // If threads are created as THR_DETACHED or THR_DAEMON, we + // can't help much. + if (iter.next ()->grp_id_ == grp_id && + (ACE_BIT_DISABLED (iter.next ()->flags_, THR_DETACHED | THR_DAEMON) + || ACE_BIT_ENABLED (iter.next ()->flags_, THR_JOINABLE))) + { + ACE_SET_BITS (iter.next ()->thr_state_, ACE_THR_JOINING); + copy_table[copy_count++] = *iter.next (); + } + } + +#if !defined (ACE_HAS_VXTHREADS) + for (ACE_Double_Linked_List_Iterator biter (this->terminated_thr_list_); + !biter.done (); + biter.advance ()) + { + // If threads are created as THR_DETACHED or THR_DAEMON, we + // can't help much. + if (biter.next ()->grp_id_ == grp_id) + { + ACE_Thread_Descriptor_Base *tdb = biter.advance_and_remove (false); + copy_table[copy_count++] = *tdb; + delete tdb; + } + } +#endif /* !ACE_HAS_VXTHREADS */ + } + + // Now actually join() with all the threads in this group. + int result = 0; + + for (int i = 0; + i < copy_count && result != -1; + i++) + { + if (ACE_Thread::join (copy_table[i].thr_handle_) == -1) + result = -1; + } + + delete [] copy_table; + + return result; +} + +// Must be called when thread goes out of scope to clean up its table +// slot. + +ACE_THR_FUNC_RETURN +ACE_Thread_Manager::exit (ACE_THR_FUNC_RETURN status, bool do_thread_exit) +{ + ACE_TRACE ("ACE_Thread_Manager::exit"); +#if defined (ACE_WIN32) + // Remove detached thread handle. + + if (do_thread_exit) + { +#if 0 + // @@ This callback is now taken care of by TSS_Cleanup. Do we + // need it anymore? + + // On Win32, if we really wants to exit from a thread, we must + // first clean up the thread specific storage. By doing so, + // ACE_Thread_Manager::exit will be called again with + // do_thr_exit = 0 and cleaning up the ACE_Cleanup_Info (but not + // exiting the thread.) After the following call returns, we + // are safe to exit this thread. + delete ACE_Thread_Exit::instance (); +#endif /* 0 */ + ACE_Thread::exit (status); + } +#endif /* ACE_WIN32 */ + + // Just hold onto the guard while finding this thread's id and + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); + + // Find the thread id, but don't use the cache. It might have been + // deleted already. + ACE_thread_t const id = ACE_OS::thr_self (); + ACE_Thread_Descriptor* td = this->find_thread (id); + if (td != 0) + { + // @@ We call Thread_Descriptor terminate this realize the cleanup + // process itself. + td->terminate(); + } + } + + if (do_thread_exit) + { + ACE_Thread::exit (status); + // On reasonable systems should not return. + // However, due to horrible semantics with Win32 thread-specific + // storage this call can return (don't ask...). + } + + return 0; +} + +// Wait for all the threads to exit. + +int +ACE_Thread_Manager::wait (const ACE_Time_Value *timeout, + bool abandon_detached_threads, + bool use_absolute_time) +{ + ACE_TRACE ("ACE_Thread_Manager::wait"); + + ACE_Time_Value local_timeout; + // Check to see if we're using absolute time or not. + if (use_absolute_time == false && timeout != 0) + { + local_timeout = *timeout; + local_timeout += ACE_OS::gettimeofday (); + timeout = &local_timeout; + } + +#if !defined (ACE_HAS_VXTHREADS) + ACE_Double_Linked_List term_thr_list_copy; +#endif /* ACE_HAS_VXTHREADS */ + +#if defined (ACE_HAS_THREADS) + { + // Just hold onto the guard while waiting. + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + if (ACE_Object_Manager::shutting_down () != 1) + { + // Program is not shutting down. Perform a normal wait on threads. + if (abandon_detached_threads != 0) + { + ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); + for (ACE_Double_Linked_List_Iterator + iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (ACE_BIT_ENABLED (iter.next ()->flags_, + THR_DETACHED | THR_DAEMON) + && ACE_BIT_DISABLED (iter.next ()->flags_, THR_JOINABLE)) + { + this->thr_to_be_removed_.enqueue_tail (iter.next ()); + ACE_SET_BITS (iter.next ()->thr_state_, ACE_THR_JOINING); + } + } + + if (! this->thr_to_be_removed_.is_empty ()) + { + ACE_Thread_Descriptor *td = 0; + while (this->thr_to_be_removed_.dequeue_head (td) != -1) + this->remove_thr (td, 1); + } + } + + while (this->thr_list_.size () > 0) + if (this->zero_cond_.wait (timeout) == -1) + return -1; + } + else + // Program is shutting down, no chance to wait on threads. + // Therefore, we'll just remove threads from the list. + this->remove_thr_all (); + +#if !defined (ACE_HAS_VXTHREADS) + ACE_Thread_Descriptor_Base* item = 0; + while ((item = this->terminated_thr_list_.delete_head ()) != 0) + { + term_thr_list_copy.insert_tail (item); + } +#endif /* ACE_HAS_VXTHREADS */ + // Release the guard, giving other threads a chance to run. + } + +#if !defined (ACE_HAS_VXTHREADS) + // @@ VxWorks doesn't support thr_join (yet.) We are working + // on our implementation. Chorus'es thr_join seems broken. + ACE_Thread_Descriptor_Base *item = 0; + + while ((item = term_thr_list_copy.delete_head ()) != 0) + { + if (ACE_BIT_DISABLED (item->flags_, THR_DETACHED | THR_DAEMON) + || ACE_BIT_ENABLED (item->flags_, THR_JOINABLE)) + // Detached handles shouldn't reached here. + (void) ACE_Thread::join (item->thr_handle_); + + delete item; + } + +#endif /* !ACE_HAS_VXTHREADS */ +#else + ACE_UNUSED_ARG (timeout); + ACE_UNUSED_ARG (abandon_detached_threads); +#endif /* ACE_HAS_THREADS */ + + return 0; +} + +int +ACE_Thread_Manager::apply_task (ACE_Task_Base *task, + ACE_THR_MEMBER_FUNC func, + int arg) +{ + ACE_TRACE ("ACE_Thread_Manager::apply_task"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); + + int result = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + if (iter.next ()->task_ == task + && (this->*func) (iter.next (), arg) == -1) + result = -1; + + // Must remove threads after we have traversed the thr_list_ to + // prevent clobber thr_list_'s integrity. + + if (! this->thr_to_be_removed_.is_empty ()) + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + + for (ACE_Thread_Descriptor *td = 0; + this->thr_to_be_removed_.dequeue_head (td) != -1; + ) + this->remove_thr (td, 1); + } + + return result; +} + +// Wait for all threads to exit a task. + +int +ACE_Thread_Manager::wait_task (ACE_Task_Base *task) +{ + int copy_count = 0; + ACE_Thread_Descriptor_Base *copy_table = 0; + + // We have to make sure that while we wait for these threads to + // exit, we do not have the lock. Therefore we make a copy of all + // interesting entries and let go of the lock. + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + +#if !defined (ACE_HAS_VXTHREADS) + ACE_NEW_RETURN (copy_table, + ACE_Thread_Descriptor_Base [this->thr_list_.size () + + this->terminated_thr_list_.size ()], + -1); +#else + ACE_NEW_RETURN (copy_table, + ACE_Thread_Descriptor_Base [this->thr_list_.size ()], + -1); +#endif /* !ACE_HAS_VXTHREADS */ + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + // If threads are created as THR_DETACHED or THR_DAEMON, we + // can't wait on them here. + if (iter.next ()->task_ == task && + (ACE_BIT_DISABLED (iter.next ()->flags_, + THR_DETACHED | THR_DAEMON) + || ACE_BIT_ENABLED (iter.next ()->flags_, + THR_JOINABLE))) + { + ACE_SET_BITS (iter.next ()->thr_state_, + ACE_THR_JOINING); + copy_table[copy_count++] = *iter.next (); + } + } + +#if !defined (ACE_HAS_VXTHREADS) + for (ACE_Double_Linked_List_Iterator titer (this->terminated_thr_list_); + !titer.done (); + titer.advance ()) + { + // If threads are created as THR_DETACHED or THR_DAEMON, we can't help much here. + if (titer.next ()->task_ == task) + { + ACE_Thread_Descriptor_Base *tdb = titer.advance_and_remove (false); + copy_table[copy_count++] = *tdb; + delete tdb; + } + } +#endif /* !ACE_HAS_VXTHREADS */ + } + + // Now to do the actual work + int result = 0; + + for (int i = 0; + i < copy_count && result != -1; + i++) + { + if (ACE_Thread::join (copy_table[i].thr_handle_) == -1) + result = -1; + } + + delete [] copy_table; + + return result; +} + +// Suspend a task + +int +ACE_Thread_Manager::suspend_task (ACE_Task_Base *task) +{ + ACE_TRACE ("ACE_Thread_Manager::suspend_task"); + return this->apply_task (task, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::suspend_thr)); +} + +// Resume a task. +int +ACE_Thread_Manager::resume_task (ACE_Task_Base *task) +{ + ACE_TRACE ("ACE_Thread_Manager::resume_task"); + return this->apply_task (task, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::resume_thr)); +} + +// Kill a task. + +int +ACE_Thread_Manager::kill_task (ACE_Task_Base *task, int /* signum */) +{ + ACE_TRACE ("ACE_Thread_Manager::kill_task"); + return this->apply_task (task, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::kill_thr)); +} + +// Cancel a task. +int +ACE_Thread_Manager::cancel_task (ACE_Task_Base *task, + int async_cancel) +{ + ACE_TRACE ("ACE_Thread_Manager::cancel_task"); + return this->apply_task (task, + ACE_THR_MEMBER_FUNC (&ACE_Thread_Manager::cancel_thr), + async_cancel); +} + +// Locate the index in the table associated with from the +// beginning of the table up to an index. Must be called with the +// lock held. + +ACE_Thread_Descriptor * +ACE_Thread_Manager::find_task (ACE_Task_Base *task, size_t slot) +{ + ACE_TRACE ("ACE_Thread_Manager::find_task"); + + size_t i = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (i >= slot) + break; + + if (task == iter.next ()->task_) + return iter.next (); + + ++i; + } + + return 0; +} + +// Returns the number of ACE_Task in a group. + +int +ACE_Thread_Manager::num_tasks_in_group (int grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::num_tasks_in_group"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + int tasks_count = 0; + size_t i = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (iter.next ()->grp_id_ == grp_id + && this->find_task (iter.next ()->task_, i) == 0 + && iter.next ()->task_ != 0) + { + ++tasks_count; + } + + ++i; + } + return tasks_count; +} + +// Returns the number of threads in an ACE_Task. + +int +ACE_Thread_Manager::num_threads_in_task (ACE_Task_Base *task) +{ + ACE_TRACE ("ACE_Thread_Manager::num_threads_in_task"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + int threads_count = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (iter.next ()->task_ == task) + { + ++threads_count; + } + } + + return threads_count; +} + +// Returns in task_list a list of ACE_Tasks registered with ACE_Thread_Manager. + +ssize_t +ACE_Thread_Manager::task_all_list (ACE_Task_Base *task_list[], + size_t n) +{ + ACE_TRACE ("ACE_Thread_Manager::task_all_list"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + size_t task_list_count = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (task_list_count >= n) + { + break; + } + + ACE_Task_Base *task_p = iter.next ()->task_; + + if (0 != task_p) + { + // This thread has a task pointer; see if it's already in the + // list. Don't add duplicates. + size_t i = 0; + + for (; i < task_list_count; ++i) + { + if (task_list[i] == task_p) + { + break; + } + } + + if (i == task_list_count) // No match - add this one + { + task_list[task_list_count++] = task_p; + } + } + } + + return ACE_Utils::truncate_cast (task_list_count); +} + +// Returns in thread_list a list of all thread ids + +ssize_t +ACE_Thread_Manager::thread_all_list (ACE_thread_t thread_list[], + size_t n) +{ + ACE_TRACE ("ACE_Thread_Manager::thread_all_list"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + size_t thread_count = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (thread_count >= n) + { + break; + } + + thread_list[thread_count] = iter.next ()->thr_id_; + ++thread_count; + } + + return ACE_Utils::truncate_cast (thread_count); +} + + +int +ACE_Thread_Manager::thr_state (ACE_thread_t id, + ACE_UINT32& state) +{ + ACE_TRACE ("ACE_Thread_Manager::thr_state"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + int const self_check = ACE_OS::thr_equal (id, ACE_OS::thr_self ()); + + // If we're checking the state of our thread, try to get the cached + // value out of TSS to avoid lookup. + if (self_check) + { + ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc (); + + if (desc == 0) + { + return 0; // Always return false. + } + + state = desc->thr_state_; + } + else + { + // Not calling from self, have to look it up from the list. + ACE_FIND (this->find_thread (id), ptr); + + if (ptr == 0) + { + return 0; + } + + state = ptr->thr_state_; + } + + return 1; +} + +// Returns in task_list a list of ACE_Tasks in a group. + +ssize_t +ACE_Thread_Manager::task_list (int grp_id, + ACE_Task_Base *task_list[], + size_t n) +{ + ACE_TRACE ("ACE_Thread_Manager::task_list"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + ACE_Task_Base **task_list_iterator = task_list; + size_t task_list_count = 0; + size_t i = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (task_list_count >= n) + { + break; + } + + if (iter.next ()->grp_id_ == grp_id + && this->find_task (iter.next ()->task_, i) == 0) + { + task_list_iterator[task_list_count] = iter.next ()->task_; + ++task_list_count; + } + + ++i; + } + + return ACE_Utils::truncate_cast (task_list_count); +} + +// Returns in thread_list a list of thread ids in an ACE_Task. + +ssize_t +ACE_Thread_Manager::thread_list (ACE_Task_Base *task, + ACE_thread_t thread_list[], + size_t n) +{ + ACE_TRACE ("ACE_Thread_Manager::thread_list"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + size_t thread_count = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (thread_count >= n) + { + break; + } + + if (iter.next ()->task_ == task) + { + thread_list[thread_count] = iter.next ()->thr_id_; + ++thread_count; + } + } + + return ACE_Utils::truncate_cast (thread_count); +} + +// Returns in thread_list a list of thread handles in an ACE_Task. + +ssize_t +ACE_Thread_Manager::hthread_list (ACE_Task_Base *task, + ACE_hthread_t hthread_list[], + size_t n) +{ + ACE_TRACE ("ACE_Thread_Manager::hthread_list"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + size_t hthread_count = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (hthread_count >= n) + { + break; + } + + if (iter.next ()->task_ == task) + { + hthread_list[hthread_count] = iter.next ()->thr_handle_; + ++hthread_count; + } + } + + return ACE_Utils::truncate_cast (hthread_count); +} + +ssize_t +ACE_Thread_Manager::thread_grp_list (int grp_id, + ACE_thread_t thread_list[], + size_t n) +{ + ACE_TRACE ("ACE_Thread_Manager::thread_grp_list"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + size_t thread_count = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (thread_count >= n) + { + break; + } + + if (iter.next ()->grp_id_ == grp_id) + { + thread_list[thread_count] = iter.next ()->thr_id_; + thread_count++; + } + } + + return ACE_Utils::truncate_cast (thread_count); +} + +// Returns in thread_list a list of thread handles in an ACE_Task. + +ssize_t +ACE_Thread_Manager::hthread_grp_list (int grp_id, + ACE_hthread_t hthread_list[], + size_t n) +{ + ACE_TRACE ("ACE_Thread_Manager::hthread_grp_list"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + size_t hthread_count = 0; + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (hthread_count >= n) + { + break; + } + + if (iter.next ()->grp_id_ == grp_id) + { + hthread_list[hthread_count] = iter.next ()->thr_handle_; + hthread_count++; + } + } + + return ACE_Utils::truncate_cast (hthread_count); +} + +int +ACE_Thread_Manager::set_grp (ACE_Task_Base *task, int grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::set_grp"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + for (ACE_Double_Linked_List_Iterator iter (this->thr_list_); + !iter.done (); + iter.advance ()) + { + if (iter.next ()->task_ == task) + { + iter.next ()->grp_id_ = grp_id; + } + } + + return 0; +} + +int +ACE_Thread_Manager::get_grp (ACE_Task_Base *task, int &grp_id) +{ + ACE_TRACE ("ACE_Thread_Manager::get_grp"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + ACE_FIND (this->find_task (task), ptr); + grp_id = ptr->grp_id_; + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Manager.h b/externals/ace/Thread_Manager.h new file mode 100644 index 0000000..6502872 --- /dev/null +++ b/externals/ace/Thread_Manager.h @@ -0,0 +1,1267 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Thread_Manager.h + * + * $Id: Thread_Manager.h 83956 2008-12-03 07:57:38Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_THREAD_MANAGER_H +#define ACE_THREAD_MANAGER_H +#include /**/ "ace/pre.h" + +#include "ace/Thread.h" +#include "ace/Thread_Adapter.h" +#include "ace/Thread_Exit.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Condition_Thread_Mutex.h" +#include "ace/Unbounded_Queue.h" +#include "ace/Containers.h" +#include "ace/Free_List.h" +#include "ace/Singleton.h" +#include "ace/Log_Msg.h" +#include "ace/Synch_Traits.h" +#include "ace/Basic_Types.h" + +// The following macros control how a Thread Manager manages a pool of +// Thread_Descriptor. Currently, the default behavior is not to +// preallocate any thread descriptor and never (well, almost never) +// free up any thread descriptor until the Thread Manager gets +// destructed. Which means, once your system is stable, you rarely +// need to pay the price of memory allocation. On a deterministic +// system, which means, the number of threads spawned can be +// determined before hand, you can either redefine the memory pool +// size macros to suit your need or constructed the Thread_Manager +// accordingly. That way, you don't pay the price of memory +// allocation when the system is really doing its job. OTOH, on +// system with resources constraint, you may want to lower the size of +// ACE_DEFAULT_THREAD_MANAGER_HWM to avoid unused memory hanging +// around. + +#if !defined (ACE_DEFAULT_THREAD_MANAGER_PREALLOC) +# define ACE_DEFAULT_THREAD_MANAGER_PREALLOC 0 +#endif /* ACE_DEFAULT_THREAD_MANAGER_PREALLOC */ + +#if !defined (ACE_DEFAULT_THREAD_MANAGER_LWM) +# define ACE_DEFAULT_THREAD_MANAGER_LWM 1 +#endif /* ACE_DEFAULT_THREAD_MANAGER_LWM */ + +#if !defined (ACE_DEFAULT_THREAD_MANAGER_INC) +# define ACE_DEFAULT_THREAD_MANAGER_INC 1 +#endif /* ACE_DEFAULT_THREAD_MANAGER_INC */ + +#if !defined (ACE_DEFAULT_THREAD_MANAGER_HWM) +# define ACE_DEFAULT_THREAD_MANAGER_HWM ACE_DEFAULT_FREE_LIST_HWM +// this is a big number +#endif /* ACE_DEFAULT_THREAD_MANAGER_HWM */ + +// This is the synchronization mechanism used to prevent a thread +// descriptor gets removed from the Thread_Manager before it gets +// stash into it. If you want to disable this feature (and risk of +// corrupting the freelist,) you define the lock as ACE_Null_Mutex. +// Usually, if you can be sure that your threads will run for an +// extended period of time, you can safely disable the lock. + +#if !defined (ACE_DEFAULT_THREAD_MANAGER_LOCK) +# define ACE_DEFAULT_THREAD_MANAGER_LOCK ACE_SYNCH_MUTEX +#endif /* ACE_DEFAULT_THREAD_MANAGER_LOCK */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations. +class ACE_Task_Base; +class ACE_Thread_Manager; +class ACE_Thread_Descriptor; + +/** + * @class ACE_At_Thread_Exit + * + * @brief Contains a method to be applied when a thread is terminated. + */ +class ACE_Export ACE_At_Thread_Exit +{ + friend class ACE_Thread_Descriptor; + friend class ACE_Thread_Manager; +public: + /// Default constructor + ACE_At_Thread_Exit (void); + + /// The destructor + virtual ~ACE_At_Thread_Exit (void); + + /// At_Thread_Exit has the ownership? + bool is_owner (void) const; + + /// Set the ownership of the At_Thread_Exit. + bool is_owner (bool owner); + + /// This At_Thread_Exit was applied? + bool was_applied (void) const; + + /// Set applied state of At_Thread_Exit. + bool was_applied (bool applied); + +protected: + /// The next At_Thread_Exit hook in the list. + ACE_At_Thread_Exit *next_; + + /// Do the apply if necessary + void do_apply (void); + + /// The apply method. + virtual void apply (void) = 0; + + /// The Thread_Descriptor where this at is registered. + ACE_Thread_Descriptor* td_; + + /// The at was applied? + bool was_applied_; + + /// The at has the ownership of this? + bool is_owner_; +}; + +class ACE_Export ACE_At_Thread_Exit_Func : public ACE_At_Thread_Exit +{ +public: + /// Constructor + ACE_At_Thread_Exit_Func (void *object, + ACE_CLEANUP_FUNC func, + void *param = 0); + + virtual ~ACE_At_Thread_Exit_Func (void); + +protected: + /// The object to be cleanup + void *object_; + + /// The cleanup func + ACE_CLEANUP_FUNC func_; + + /// A param if required + void *param_; + + /// The apply method + void apply (void); +}; + +/** + * @class ACE_Thread_Descriptor_Base + * + * @brief Basic information for thread descriptors. These information + * gets extracted out because we need it after a thread is + * terminated. + * + * @internal + */ +class ACE_Export ACE_Thread_Descriptor_Base : public ACE_OS_Thread_Descriptor +{ + + friend class ACE_Thread_Manager; + friend class ACE_Double_Linked_List; + friend class ACE_Double_Linked_List_Iterator_Base; + friend class ACE_Double_Linked_List_Iterator; + friend class ACE_Double_Linked_List; + friend class ACE_Double_Linked_List_Iterator_Base; + friend class ACE_Double_Linked_List_Iterator; +public: + ACE_Thread_Descriptor_Base (void); + ~ACE_Thread_Descriptor_Base (void); + + // = We need the following operators to make Borland happy. + + /// Equality operator. + bool operator== (const ACE_Thread_Descriptor_Base &rhs) const; + + /// Inequality operator. + bool operator!= (const ACE_Thread_Descriptor_Base &rhs) const; + + /// Group ID. + int grp_id (void) const; + + /// Current state of the thread. + ACE_UINT32 state (void) const; + + /// Return the pointer to an ACE_Task_Base or NULL if there's no + /// ACE_Task_Base associated with this thread.; + ACE_Task_Base *task (void) const; + +protected: + /// Reset this base thread descriptor. + void reset (void); + + /// Unique thread ID. + ACE_thread_t thr_id_; + + /// Unique handle to thread (used by Win32 and AIX). + ACE_hthread_t thr_handle_; + + /// Group ID. + int grp_id_; + + /// Current state of the thread. + ACE_UINT32 thr_state_; + + /// Pointer to an ACE_Task_Base or NULL if there's no + /// ACE_Task_Base. + ACE_Task_Base *task_; + + /// We need these pointers to maintain the double-linked list in a + /// thread managers. + ACE_Thread_Descriptor_Base *next_; + ACE_Thread_Descriptor_Base *prev_; +}; + +/** + * @class ACE_Thread_Descriptor + * + * @brief Information for controlling threads that run under the control + * of the . + */ +class ACE_Export ACE_Thread_Descriptor : public ACE_Thread_Descriptor_Base +{ + friend class ACE_At_Thread_Exit; + friend class ACE_Thread_Manager; + friend class ACE_Double_Linked_List; + friend class ACE_Double_Linked_List_Iterator; +public: + // = Initialization method. + ACE_Thread_Descriptor (void); + + // = Accessor methods. + /// Unique thread id. + ACE_thread_t self (void) const; + + /// Unique handle to thread (used by Win32 and AIX). + void self (ACE_hthread_t &); + + /// Dump the state of an object. + void dump (void) const; + + /** + * This cleanup function must be called only for ACE_TSS_cleanup. + * The ACE_TSS_cleanup delegate Log_Msg instance destruction when + * Log_Msg cleanup is called before terminate. + */ + void log_msg_cleanup(ACE_Log_Msg* log_msg); + + /** + * Register an At_Thread_Exit hook and the ownership is acquire by + * Thread_Descriptor, this is the usual case when the AT is dynamically + * allocated. + */ + int at_exit (ACE_At_Thread_Exit* cleanup); + + /// Register an At_Thread_Exit hook and the ownership is retained for the + /// caller. Normally used when the at_exit hook is created in stack. + int at_exit (ACE_At_Thread_Exit& cleanup); + + /** + * Register an object (or array) for cleanup at thread termination. + * "cleanup_hook" points to a (global, or static member) function + * that is called for the object or array when it to be destroyed. + * It may perform any necessary cleanup specific for that object or + * its class. "param" is passed as the second parameter to the + * "cleanup_hook" function; the first parameter is the object (or + * array) to be destroyed. Returns 0 on success, non-zero on + * failure: -1 if virtual memory is exhausted or 1 if the object (or + * arrayt) had already been registered. + */ + int at_exit (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param); + + /// Do nothing destructor to keep some compilers happy + ~ACE_Thread_Descriptor (void); + + /** + * Do nothing but to acquire the thread descriptor's lock and + * release. This will first check if the thread is registered or + * not. If it is already registered, there's no need to reacquire + * the lock again. This is used mainly to get newly spawned thread + * in synch with thread manager and prevent it from accessing its + * thread descriptor before it gets fully built. This function is + * only called from ACE_Log_Msg::thr_desc. + */ + void acquire_release (void); + void acquire (void); + void release (void); + + /** + * Set/get the @c next_ pointer. These are required by the + * ACE_Free_List. + */ + void set_next (ACE_Thread_Descriptor *td); + ACE_Thread_Descriptor *get_next (void) const; + +private: + /// Reset this thread descriptor. + void reset (ACE_Thread_Manager *tm); + + /// Pop an At_Thread_Exit from at thread termination list, apply the at + /// if apply is true. + void at_pop (int apply = 1); + + /// Push an At_Thread_Exit to at thread termination list and set the + /// ownership of at. + void at_push (ACE_At_Thread_Exit* cleanup, + bool is_owner = false); + + /// Run the AT_Thread_Exit hooks. + void do_at_exit (void); + + /// Terminate realize the cleanup process to thread termination + void terminate (void); + + /// Thread_Descriptor is the ownership of ACE_Log_Msg if log_msg_!=0 + /// This can occur because ACE_TSS_cleanup was executed before terminate. + ACE_Log_Msg *log_msg_; + + /// The AT_Thread_Exit list + ACE_At_Thread_Exit *at_exit_list_; + +#if 0 +/// Currently not used + /** + * Stores the cleanup info for a thread. + * @note This should be generalized to be a stack of ACE_Cleanup_Info's. + */ + ACE_Cleanup_Info_Node_List cleanup_info_; +#endif + + /// Pointer to an ACE_Thread_Manager or NULL if there's no + /// ACE_Thread_Manager> + ACE_Thread_Manager* tm_; + + /// Registration lock to prevent premature removal of thread descriptor. + ACE_DEFAULT_THREAD_MANAGER_LOCK *sync_; + + /// Keep track of termination status. + bool terminated_; +}; + +// Forward declaration. +class ACE_Thread_Control; + +// This typedef should be (and used to be) inside the +// ACE_Thread_Manager declaration. But, it caused compilation +// problems on g++/VxWorks/i960 with -g. Note that +// ACE_Thread_Manager::THR_FUNC is only used internally in +// ACE_Thread_Manager, so it's not useful for anyone else. +// It also caused problems on IRIX5 with g++. +#if defined (__GNUG__) +typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int); +#endif /* __GNUG__ */ + +/** + * @class ACE_Thread_Manager + * + * @brief Manages a pool of threads. + * + * This class allows operations on groups of threads atomically. + * The default behavior of thread manager is to wait on + * all threads under it's management when it gets destructed. + * Therefore, remember to remove a thread from thread manager if + * you don't want it to wait for the thread. There are also + * functions to disable this default wait-on-exit behavior. + * However, if your program depends on turning this off to run + * correctly, you are probably doing something wrong. Rule of + * thumb, use ACE_Thread to manage your daemon threads. + * Notice that if there're threads which live beyond the scope of + * main(), you are sure to have resource leaks in your program. + * Remember to wait on threads before exiting your main program if that + * could happen in your programs. + */ +class ACE_Export ACE_Thread_Manager +{ +public: + friend class ACE_Thread_Control; + + // Allow ACE_THread_Exit to register the global TSS instance object. + friend class ACE_Thread_Exit; + friend class ACE_Thread_Descriptor; + +#if !defined (__GNUG__) + typedef int (ACE_Thread_Manager::*ACE_THR_MEMBER_FUNC)(ACE_Thread_Descriptor *, int); +#endif /* !__GNUG__ */ + + /// These are the various states a thread managed by the + /// ACE_Thread_Manager can be in. + enum + { + /// Uninitialized. + ACE_THR_IDLE = 0x00000000, + + /// Created but not yet running. + ACE_THR_SPAWNED = 0x00000001, + + /// Thread is active (naturally, we don't know if it's actually + /// *running* because we aren't the scheduler...). + ACE_THR_RUNNING = 0x00000002, + + /// Thread is suspended. + ACE_THR_SUSPENDED = 0x00000004, + + /// Thread has been cancelled (which is an indiction that it needs to + /// terminate...). + ACE_THR_CANCELLED = 0x00000008, + + /// Thread has shutdown, but the slot in the thread manager hasn't + /// been reclaimed yet. + ACE_THR_TERMINATED = 0x00000010, + + /// Join operation has been invoked on the thread by thread manager. + ACE_THR_JOINING = 0x10000000 + }; + + /** + * @brief Initialization and termination methods. + * + * Internally, ACE_Thread_Manager keeps a freelist for caching + * resources it uses to keep track of managed threads (not the + * threads themselves.) @a prealloc, @a lwm, @a inc, @hwm + * determine the initial size, the low water mark, increment step, + * and high water mark of the freelist. + * + * @sa ACE_Free_List + */ + ACE_Thread_Manager (size_t preaolloc = ACE_DEFAULT_THREAD_MANAGER_PREALLOC, + size_t lwm = ACE_DEFAULT_THREAD_MANAGER_LWM, + size_t inc = ACE_DEFAULT_THREAD_MANAGER_INC, + size_t hwm = ACE_DEFAULT_THREAD_MANAGER_HWM); + ~ACE_Thread_Manager (void); + +#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) + /// Get pointer to a process-wide ACE_Thread_Manager. + static ACE_Thread_Manager *instance (void); + + /// Set pointer to a process-wide ACE_Thread_Manager and return + /// existing pointer. + static ACE_Thread_Manager *instance (ACE_Thread_Manager *); + + /// Delete the dynamically allocated Singleton + static void close_singleton (void); +#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ + + /// No-op. Currently unused. + int open (size_t size = 0); + + /** + * Release all resources. + * By default, this method will wait until all threads exit. + * However, when called from close_singleton(), most global resources + * are destroyed and thus, close() does not try to wait; it simply cleans + * up internal thread records (the thread descriptor list). + */ + int close (void); + + /** + * Create a new thread, which executes @a func with argument @a arg. + * + * @param func The function that is called in the spawned thread. + * + * @param arg The value passed to each spawned thread's @a func. + * + * @param flags Flags to control attributes of the spawned threads. + * @sa ACE_OS::thr_create() for descriptions of the + * possible flags values and their interactions. + * + * @param t_id Pointer to a location to receive the spawned thread's + * ID. If 0, the ID is not returned. + * + * @param t_handle Pointer to a location to receive the spawned thread's + * thread handle. If 0, the handle is not returned. + * + * @param priority The priority at which the thread is spawned. + * + * @param grp_id The thread group that the spawned thread is + * added to. If -1 is specified, a new thread group is + * created for the spawned thread. + * + * @param stack Pointers to the base of a pre-allocated stack space + * for the thread's stack. If 0, the platform allocates + * stack space for the thread. If a stack is specified, + * it is recommended that @a stack_size also be supplied + * to specify the size of the stack. + * Not all platforms support pre-allocated stacks. If + * @a stack is specified for a platform which does not + * allow pre-allocated stack space this parameter is + * ignored. + * + * @param stack_size Indicate how large the thread's stack should be, in + * bytes. If a pre-allocated stack pointer is passed in + * @a stack, @a stack_size indicates the size of that + * stack area. If no pre-allocated stack is passed, + * the stack size specified is passed to the + * operating system to request that it allocate a stack + * of the specified size. + * + * @param thr_name Pointer to a name to assign to the spawned thread. + * This is only meaningful for platforms that have a + * capacity to name threads (e.g., VxWorks and some + * varieties of Pthreads). This argument is ignored if + * specified as 0 and on platforms that do not have the + * capability to name threads. + * + * @retval -1 on failure; @c errno contains an error value. + * @retval The group id of the spawned thread. + */ + int spawn (ACE_THR_FUNC func, + void *arg = 0, + long flags = THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, + ACE_thread_t *t_id = 0, + ACE_hthread_t *t_handle = 0, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + void *stack = 0, + size_t stack_size = ACE_DEFAULT_THREAD_STACKSIZE, + const char** thr_name = 0); + + /** + * Spawn a specified number of threads, all of which execute @a func + * with argument @a arg. + * + * @param n The number of threads to spawn. + * + * @param func The function that is called in the spawned thread. + * + * @param arg The value passed to each spawned thread's @a func. + * + * @param flags Flags to control attributes of the spawned threads. + * @sa ACE_OS::thr_create() for descriptions of the + * possible flags values and their interactions. + * + * @param priority The priority at which the threads are spawned. + * + * @param grp_id The thread group that the spawned threads are + * added to. If -1 is specified, a new thread group is + * created for the spawned threads. + * + * @param task The ACE_Task that the spawned threads are associated + * with. If 0, the threads are not associated with an + * ACE_Task. This argument is usually assigned by the + * ACE_Task_Base::activate() method to associate the + * spawned threads with the spawning ACE_Task object. + * + * @param thread_handles An array of @a n entries which will receive + * the thread handles of the spawned threads. + * + * @param stack An array of @a n pointers to pre-allocated stack space + * for each thread's stack. If specified as 0, the + * platform allocates stack space for each thread. If + * a stack is specified, it is recommended that a + * @a stack_size element also be supplied that specifies + * the size of the stack. + * Not all platforms support pre-allocated stacks. If + * @a stack is specified for a platform which does not + * allow pre-allocated stack space this parameter is + * ignored. + * + * @param stack_size An array of @a n values which indicate how large + * each thread's stack should be, in bytes. + * If pre-allocated stacks are passed in @a stacks, these + * sizes are for those stacks. If no pre-allocated stacks + * are passed, the stack sizes are specified to the + * operating system to request that it allocate stacks + * of the specified sizes. If an array entry is 0, the + * platform defaults are used for the corresponding thread. + * If a 0 array pointer is specified, platform defaults + * are used for all thread stack sizes. + * + * @param thr_name An array of names to assign to the spawned threads. + * This is only meaningful for platforms that have a + * capacity to name threads (e.g., VxWorks and some + * varieties of Pthreads). This argument is ignored if + * specified as 0 and on platforms that do not have the + * capability to name threads. + * + * ACE_Thread_Manager can manipulate threads in groups based on + * @a grp_id or @a task using functions such as kill_grp() or + * cancel_task(). + * + * @retval -1 on failure; @c errno contains an error value. + * @retval The group id of the threads. + */ + int spawn_n (size_t n, + ACE_THR_FUNC func, + void *arg = 0, + long flags = THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + ACE_Task_Base *task = 0, + ACE_hthread_t thread_handles[] = 0, + void *stack[] = 0, + size_t stack_size[] = 0, + const char* thr_name[] = 0); + + /** + * Spawn a specified number of threads, all of which execute @a func + * with argument @a arg. + * + * @param thread_ids An array to receive the thread IDs of successfully + * spawned buffer. If 0, the thread IDs are not returned. + * If specified, the array must be at least @a n entries. + * + * @param n The number of threads to spawn. + * + * @param func The function that is called in the spawned thread. + * + * @param arg The value passed to each spawned thread's @a func. + * + * @param flags Flags to control attributes of the spawned threads. + * @sa ACE_OS::thr_create() for descriptions of the + * possible flags values and their interactions. + * + * @param priority The priority at which the threads are spawned. + * + * @param grp_id The thread group that the spawned threads are + * added to. If -1 is specified, a new thread group is + * created for the spawned threads. + * + * @param stack An array of @a n pointers to pre-allocated stack space + * for each thread's stack. If specified as 0, the + * platform allocates stack space for each thread. If + * a stack is specified, it is recommended that a + * @a stack_size element also be supplied that specifies + * the size of the stack. + * Not all platforms support pre-allocated stacks. If + * @a stack is specified for a platform which does not + * allow pre-allocated stack space this parameter is + * ignored. + * + * @param stack_size An array of @a n values which indicate how large + * each thread's stack should be, in bytes. + * If pre-allocated stacks are passed in @a stacks, these + * sizes are for those stacks. If no pre-allocated stacks + * are passed, the stack sizes are specified to the + * operating system to request that it allocate stacks + * of the specified sizes. If an array entry is 0, the + * platform defaults are used for the corresponding thread. + * If a 0 array pointer is specified, platform defaults + * are used for all thread stack sizes. + * + * @param thread_handles An array of @a n entries which will receive + * the thread handles of the spawned threads. + * + * @param task The ACE_Task that the spawned threads are associated + * with. If 0, the threads are not associated with an + * ACE_Task. This argument is usually assigned by the + * ACE_Task_Base::activate() method to associate the + * spawned threads with the spawning ACE_Task object. + * + * @param thr_name An array of names to assign to the spawned threads. + * This is only meaningful for platforms that have a + * capacity to name threads (e.g., VxWorks and some + * varieties of Pthreads). This argument is ignored if + * specified as 0 and on platforms that do not have the + * capability to name threads. + * + * ACE_Thread_Manager can manipulate threads in groups based on + * @a grp_id or @a task using functions such as kill_grp() or + * cancel_task(). + * + * @retval -1 on failure; @c errno contains an error value. + * @retval The group id of the threads. + + */ + int spawn_n (ACE_thread_t thread_ids[], + size_t n, + ACE_THR_FUNC func, + void *arg, + long flags, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + void *stack[] = 0, + size_t stack_size[] = 0, + ACE_hthread_t thread_handles[] = 0, + ACE_Task_Base *task = 0, + const char* thr_name[] = 0); + + /** + * Called to clean up when a thread exits. + * + * @param do_thread_exit If non-0 then ACE_Thread::exit is called to + * exit the thread + * @param status If ACE_Thread_Exit is called, this is passed as + * the exit value of the thread. + * Should _not_ be called by main thread. + */ + ACE_THR_FUNC_RETURN exit (ACE_THR_FUNC_RETURN status = 0, + bool do_thread_exit = true); + + /** + * Block until there are no more threads running in this thread + * manager or @c timeout expires. + * + * @param timeout is treated as "absolute" time by default, but this + * can be changed to "relative" time by setting the @c + * use_absolute_time to false. + * @param abandon_detached_threads If true, @c wait() will first + * check thru its thread list for + * threads with THR_DETACHED or + * THR_DAEMON flags set and remove + * these threads. Notice that + * unlike other @c wait_*() methods, + * by default, @c wait() does wait on + * all thread spawned by this + * thread manager no matter the detached + * flags are set or not unless it is + * called with @c + * abandon_detached_threads flag set. + * @param use_absolute_time If true then treat @c timeout as + * absolute time, else relative time. + * @return 0 on success * and -1 on failure. + * + * @note If this function is called while the @c + * ACE_Object_Manager is shutting down (as a result of program + * rundown via @c ACE::fini()), it will not wait for any threads to + * complete. If you must wait for threads spawned by this thread + * manager to complete and you are in a ACE rundown situation (such + * as your object is being destroyed by the @c ACE_Object_Manager) + * you can use @c wait_grp() instead. + */ + int wait (const ACE_Time_Value *timeout = 0, + bool abandon_detached_threads = false, + bool use_absolute_time = true); + + /// Join a thread specified by @a tid. Do not wait on a detached thread. + int join (ACE_thread_t tid, ACE_THR_FUNC_RETURN *status = 0); + + /** + * Block until there are no more threads running in a group. + * Returns 0 on success and -1 on failure. Notice that wait_grp + * will not wait on detached threads. + */ + int wait_grp (int grp_id); + + /** + * Return the "real" handle to the calling thread, caching it if + * necessary in TSS to speed up subsequent lookups. This is + * necessary since on some platforms (e.g., Windows) we can't get this + * handle via direct method calls. Notice that you should *not* + * close the handle passed back from this method. It is used + * internally by Thread Manager. On the other hand, you *have to* + * use this internal thread handle when working on Thread_Manager. + * Return -1 if fail. + */ + int thr_self (ACE_hthread_t &); + + /** + * Return the unique ID of the calling thread. + * Same as calling ACE_Thread::self(). + */ + ACE_thread_t thr_self (void); + + /** + * Returns a pointer to the current ACE_Task_Base we're executing + * in if this thread is indeed running in an ACE_Task_Base, else + * return 0. + */ + ACE_Task_Base *task (void); + + /** + * @name Suspend and resume methods + * + * Suspend/resume is not supported on all platforms. For example, Pthreads + * does not support these functions. + */ + //@{ + + /// Suspend all threads + int suspend_all (void); + + /// Suspend a single thread. + int suspend (ACE_thread_t); + + /// Suspend a group of threads. + int suspend_grp (int grp_id); + + /** + * True if @a t_id is inactive (i.e., suspended), else false. Always + * return false if @a t_id is not managed by the Thread_Manager. + */ + int testsuspend (ACE_thread_t t_id); + + /// Resume all stopped threads + int resume_all (void); + + /// Resume a single thread. + int resume (ACE_thread_t); + + /// Resume a group of threads. + int resume_grp (int grp_id); + + /** + * True if @a t_id is active (i.e., resumed), else false. Always + * return false if @a t_id is not managed by the Thread_Manager. + */ + int testresume (ACE_thread_t t_id); + + //@} + + // = Send signals to one or more threads without blocking. + /** + * Send @a signum to all stopped threads. Not supported on platforms + * that do not have advanced signal support, such as Win32. + */ + int kill_all (int signum); + /** + * Send the @a signum to a single thread. Not supported on platforms + * that do not have advanced signal support, such as Win32. + */ + int kill (ACE_thread_t, int signum); + /** + * Send @a signum to a group of threads, not supported on platforms + * that do not have advanced signal support, such as Win32. + */ + int kill_grp (int grp_id, int signum); + + // = Cancel methods, which provides a cooperative thread-termination mechanism (will not block). + /** + * Cancel's all the threads. + */ + int cancel_all (int async_cancel = 0); + + /** + * Cancel a single thread. + */ + int cancel (ACE_thread_t, int async_cancel = 0); + + /** + * Cancel a group of threads. + */ + int cancel_grp (int grp_id, int async_cancel = 0); + + /** + * True if @a t_id is cancelled, else false. Always return false if + * @a t_id is not managed by the Thread_Manager. + */ + int testcancel (ACE_thread_t t_id); + + /** + * True if @a t_id has terminated (i.e., is no longer running), + * but the slot in the thread manager hasn't been reclaimed yet, + * else false. Always return false if @a t_id is not managed by the + * Thread_Manager. + */ + int testterminate (ACE_thread_t t_id); + + /// Set group ids for a particular thread id. + int set_grp (ACE_thread_t, + int grp_id); + + /// Get group ids for a particular thread id. + int get_grp (ACE_thread_t, + int &grp_id); + + /** + * @name Task-related operations + */ + //@{ + /** + * Block until there are no more threads running in a specified task. + * This method will not wait for either detached or daemon threads; + * the threads must have been spawned with the @c THR_JOINABLE flag. + * Upon successful completion, the threads have been joined, so further + * attempts to join with any of the waited-for threads will fail. + * + * @param task The ACE_Task_Base object whose threads are to waited for. + * + * @retval 0 Success. + * @retval -1 Failure (consult errno for further information). + */ + int wait_task (ACE_Task_Base *task); + + /** + * Suspend all threads in an ACE_Task. + */ + int suspend_task (ACE_Task_Base *task); + + /** + * Resume all threads in an ACE_Task. + */ + int resume_task (ACE_Task_Base *task); + + /** + * Send a signal @a signum to all threads in an ACE_Task. + */ + int kill_task (ACE_Task_Base *task, int signum); + + /** + * Cancel all threads in an ACE_Task. If is non-0, + * then asynchronously cancel these threads if the OS platform + * supports cancellation. Otherwise, perform a "cooperative" + * cancellation. + */ + int cancel_task (ACE_Task_Base *task, int async_cancel = 0); + + //@} + + // = Collect thread handles in the thread manager. Notice that + // the collected information is just a snapshot. + /// Check if the thread is managed by the thread manager. Return true if + /// the thread is found, false otherwise. + int hthread_within (ACE_hthread_t handle); + int thread_within (ACE_thread_t tid); + + /// Returns the number of ACE_Task_Base in a group. + int num_tasks_in_group (int grp_id); + + /// Returns the number of threads in an ACE_Task_Base. + int num_threads_in_task (ACE_Task_Base *task); + + /** + * Returns a list of ACE_Task_Base pointers corresponding to the tasks + * that have active threads in a specified thread group. + * + * @param grp_id The thread group ID to obtain task pointers for. + * + * @param task_list is a pointer to an array to receive the list of pointers. + * The caller is responsible for supplying an array with at + * least @arg n entries. + * + * @param n The maximum number of ACE_Task_Base pointers to write + * in @arg task_list. + * + * @retval If successful, the number of pointers returned, which will be + * no greater than @arg n. Returns -1 on error. + * + * @note This method has no way to indicate if there are more than + * @arg n ACE_Task_Base pointers available. Therefore, it may be + * wise to guess a larger value of @arg n than one thinks in cases + * where the exact number of tasks is not known. + * + * @sa num_tasks_in_group(), task_all_list() + */ + ssize_t task_list (int grp_id, + ACE_Task_Base *task_list[], + size_t n); + + /** + * Returns in @a thread_list a list of up to @a n thread ids in an + * ACE_Task_Base. The caller must allocate the memory for + * @a thread_list. In case of an error, -1 is returned. If no + * requested values are found, 0 is returned, otherwise correct + * number of retrieved values are returned. + */ + ssize_t thread_list (ACE_Task_Base *task, + ACE_thread_t thread_list[], + size_t n); + + /** + * Returns in @a hthread_list a list of up to @a n thread handles in + * an ACE_Task_Base. The caller must allocate memory for + * @a hthread_list. In case of an error, -1 is returned. If no + * requested values are found, 0 is returned, otherwise correct + * number of retrieved values are returned. + */ + ssize_t hthread_list (ACE_Task_Base *task, + ACE_hthread_t hthread_list[], + size_t n); + + /** + * Returns in @a thread_list a list of up to @a n thread ids in a + * group @a grp_id. The caller must allocate the memory for + * @a thread_list. In case of an error, -1 is returned. If no + * requested values are found, 0 is returned, otherwise correct + * number of retrieved values are returned. + */ + ssize_t thread_grp_list (int grp_id, + ACE_thread_t thread_list[], + size_t n); + + /** + * Returns in @a hthread_list a list of up to @a n thread handles in + * a group @a grp_id. The caller must allocate memory for + * @a hthread_list. + */ + ssize_t hthread_grp_list (int grp_id, + ACE_hthread_t hthread_list[], + size_t n); + + /** + * Returns a list of ACE_Task_Base pointers corresponding to the tasks + * that have active threads managed by this instance. + * + * @param task_list is a pointer to an array to receive the list of pointers. + * The caller is responsible for supplying an array with at + * least @arg n entries. + * + * @param n The maximum number of ACE_Task_Base pointers to write + * in @arg task_list. + * + * @retval If successful, the number of pointers returned, which will be + * no greater than @arg n. Returns -1 on error. + * + * @note This method has no way to indicate if there are more than + * @arg n ACE_Task_Base pointers available. Therefore, it may be + * wise to guess a larger value of @arg n than one thinks in cases + * where the exact number of tasks is not known. + * + * @sa count_threads() + */ + ssize_t task_all_list (ACE_Task_Base *task_list[], + size_t n); + + /** + * Returns in @a thread_list a list of up to @a n thread ids. The + * caller must allocate the memory for @a thread_list. In case of an + * error, -1 is returned. If no requested values are found, 0 is + * returned, otherwise correct number of retrieved values are + * returned. + */ + ssize_t thread_all_list (ACE_thread_t thread_list[], + size_t n); + + /// Set group ids for a particular task. + int set_grp (ACE_Task_Base *task, int grp_id); + + /// Get group ids for a particular task. + int get_grp (ACE_Task_Base *task, int &grp_id); + + /// Return a count of the current number of threads active in the + /// . + size_t count_threads (void) const; + + /// Get the state of the thread. Returns false if the thread is not + /// managed by this thread manager. + int thr_state (ACE_thread_t id, ACE_UINT32& state); + + /** + * Register an At_Thread_Exit hook and the ownership is acquire by + * Thread_Descriptor, this is the usual case when the AT is dynamically + * allocated. + */ + int at_exit (ACE_At_Thread_Exit* cleanup); + + /// Register an At_Thread_Exit hook and the ownership is retained for the + /// caller. Normally used when the at_exit hook is created in stack. + int at_exit (ACE_At_Thread_Exit& cleanup); + + /** + * + ***** + * @deprecated This function is deprecated. Please use the previous two + * at_exit method. Notice that you should avoid mixing this method + * with the previous two at_exit methods. + ***** + * + * Register an object (or array) for cleanup at + * thread termination. "cleanup_hook" points to a (global, or + * static member) function that is called for the object or array + * when it to be destroyed. It may perform any necessary cleanup + * specific for that object or its class. "param" is passed as the + * second parameter to the "cleanup_hook" function; the first + * parameter is the object (or array) to be destroyed. + * "cleanup_hook", for example, may delete the object (or array). + * If == 0, the will _NOT_ get cleanup at + * thread exit. You can use this to cancel the previously added + * at_exit. + */ + int at_exit (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param); + + /// Access function to determine whether the Thread_Manager will + /// wait for its thread to exit or not when being closing down. + void wait_on_exit (int dowait); + int wait_on_exit (void); + + /// Dump the state of an object. + void dump (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + // = Accessors for ACE_Thread_Descriptors. + /** + * Get a pointer to the calling thread's own thread_descriptor. + * This must be called from a spawn thread. This function will + * fetch the info from TSS. + */ + ACE_Thread_Descriptor *thread_desc_self (void); + + /// Return a pointer to the thread's Thread_Descriptor, + /// 0 if fail. + ACE_Thread_Descriptor *thread_descriptor (ACE_thread_t); + + /// Return a pointer to the thread's Thread_Descriptor, + /// 0 if fail. + ACE_Thread_Descriptor *hthread_descriptor (ACE_hthread_t); + + /// Create a new thread (must be called with locks held). + int spawn_i (ACE_THR_FUNC func, + void *arg, + long flags, + ACE_thread_t * = 0, + ACE_hthread_t *t_handle = 0, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + void *stack = 0, + size_t stack_size = 0, + ACE_Task_Base *task = 0, + const char** thr_name = 0); + + /// Run the registered hooks when the thread exits. + void run_thread_exit_hooks (int i); + + /// Locate the index of the table slot occupied by . Returns + /// -1 if is not in the table doesn't contain . + ACE_Thread_Descriptor *find_thread (ACE_thread_t t_id); + + /// Locate the index of the table slot occupied by . Returns + /// -1 if is not in the table doesn't contain . + ACE_Thread_Descriptor *find_hthread (ACE_hthread_t h_id); + + /** + * Locate the thread descriptor address of the list occupied by + * @a task. Returns 0 if @a task is not in the table doesn't contain + * @a task. + */ + ACE_Thread_Descriptor *find_task (ACE_Task_Base *task, + size_t slot = 0); + + /// Insert a thread in the table (checks for duplicates). + int insert_thr (ACE_thread_t t_id, + ACE_hthread_t, + int grp_id = -1, + long flags = 0); + + /// Append a thread in the table (adds at the end, growing the table + /// if necessary). + int append_thr (ACE_thread_t t_id, ACE_hthread_t, + ACE_UINT32, + int grp_id, + ACE_Task_Base *task = 0, + long flags = 0, + ACE_Thread_Descriptor *td = 0); + + /// Remove thread from the table. + void remove_thr (ACE_Thread_Descriptor *td, + int close_handler); + + /// Remove all threads from the table. + void remove_thr_all (void); + + // = The following four methods implement a simple scheme for + // operating on a collection of threads atomically. + + /** + * Efficiently check whether @a thread is in a particular @a state. + * This call updates the TSS cache if possible to speed up + * subsequent searches. + */ + int check_state (ACE_UINT32 state, + ACE_thread_t thread, + int enable = 1); + + /// Apply @a func to all members of the table that match the @a task + int apply_task (ACE_Task_Base *task, + ACE_THR_MEMBER_FUNC func, + int = 0); + + /// Apply @a func to all members of the table that match the @a grp_id. + int apply_grp (int grp_id, + ACE_THR_MEMBER_FUNC func, + int arg = 0); + + /// Apply @a func to all members of the table. + int apply_all (ACE_THR_MEMBER_FUNC, + int = 0); + + /// Join the thread described in @a td. + int join_thr (ACE_Thread_Descriptor *td, + int = 0); + + /// Resume the thread described in @a td. + int resume_thr (ACE_Thread_Descriptor *td, + int = 0); + + /// Suspend the thread described in @a td. + int suspend_thr (ACE_Thread_Descriptor *td, + int = 0); + + /// Send signal @a signum to the thread described in @a td. + int kill_thr (ACE_Thread_Descriptor *td, + int signum); + + /// Set the cancellation flag for the thread described in @a td. + int cancel_thr (ACE_Thread_Descriptor *td, + int async_cancel = 0); + + /// Register a thread as terminated and put it into the . + int register_as_terminated (ACE_Thread_Descriptor *td); + + /// Setting the static ACE_TSS_TYPE (ACE_Thread_Exit) *thr_exit_ pointer. + static int set_thr_exit (ACE_TSS_TYPE (ACE_Thread_Exit) *ptr); + + /** + * Keeping a list of thread descriptors within the thread manager. + * Double-linked list enables us to cache the entries in TSS + * and adding/removing thread descriptor entries without + * affecting other thread's descriptor entries. + */ + ACE_Double_Linked_List thr_list_; + +#if !defined (ACE_HAS_VXTHREADS) + /// Collect terminated but not yet joined thread entries. + ACE_Double_Linked_List terminated_thr_list_; +#endif /* !ACE_HAS_VXTHREADS */ + + /// Collect pointers to thread descriptors of threads to be removed later. + ACE_Unbounded_Queue thr_to_be_removed_; + + /// Keeps track of the next group id to assign. + int grp_id_; + + /// Set if we want the Thread_Manager to wait on all threads before + /// being closed, reset otherwise. + int automatic_wait_; + + // = ACE_Thread_Mutex and condition variable for synchronizing termination. +#if defined (ACE_HAS_THREADS) + /// Serialize access to the . + ACE_Thread_Mutex lock_; + + /// Keep track of when there are no more threads. + ACE_Condition_Thread_Mutex zero_cond_; +#endif /* ACE_HAS_THREADS */ + + ACE_Locked_Free_List thread_desc_freelist_; + +private: +#if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) + /// Pointer to a process-wide ACE_Thread_Manager. + static ACE_Thread_Manager *thr_mgr_; + + /// Must delete the thr_mgr_ if true. + static bool delete_thr_mgr_; + + /// Global ACE_TSS (ACE_Thread_Exit) object ptr. + static ACE_TSS_TYPE (ACE_Thread_Exit) *thr_exit_; +#endif /* ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ +}; + +#if defined (ACE_THREAD_MANAGER_LACKS_STATICS) +#define ACE_THREAD_MANAGER_SINGLETON_DEFINE \ + ACE_Singleton; +typedef ACE_Singleton ACE_THREAD_MANAGER_SINGLETON; +#endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Thread_Manager.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_THREAD_MANAGER_H */ diff --git a/externals/ace/Thread_Manager.inl b/externals/ace/Thread_Manager.inl new file mode 100644 index 0000000..4b9afe9 --- /dev/null +++ b/externals/ace/Thread_Manager.inl @@ -0,0 +1,305 @@ +// -*- C++ -*- +// +// $Id: Thread_Manager.inl 85341 2009-05-14 11:07:37Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_At_Thread_Exit::ACE_At_Thread_Exit (void) + : next_ (0), + td_ (0), + was_applied_ (false), + is_owner_ (true) +{ +} + +ACE_INLINE bool +ACE_At_Thread_Exit::was_applied() const +{ + return was_applied_; +} + +ACE_INLINE bool +ACE_At_Thread_Exit::was_applied (bool applied) +{ + was_applied_ = applied; + if (was_applied_) + td_ = 0; + return was_applied_; +} + +ACE_INLINE bool +ACE_At_Thread_Exit::is_owner() const +{ + return is_owner_; +} + +ACE_INLINE bool +ACE_At_Thread_Exit::is_owner (bool owner) +{ + is_owner_ = owner; + return is_owner_; +} + +ACE_INLINE void +ACE_At_Thread_Exit::do_apply (void) +{ + if (!this->was_applied_ && this->is_owner_) + td_->at_pop(); +} + +ACE_INLINE +ACE_At_Thread_Exit_Func::ACE_At_Thread_Exit_Func (void *object, + ACE_CLEANUP_FUNC func, + void *param) + : object_(object), + func_(func), + param_(param) +{ +} + +ACE_INLINE +ACE_Thread_Descriptor_Base::ACE_Thread_Descriptor_Base (void) + : ACE_OS_Thread_Descriptor (), + thr_id_ (ACE_OS::NULL_thread), + thr_handle_ (ACE_OS::NULL_hthread), + grp_id_ (0), + thr_state_ (ACE_Thread_Manager::ACE_THR_IDLE), + task_ (0), + next_ (0), + prev_ (0) +{ +} + +ACE_INLINE +ACE_Thread_Descriptor_Base::~ACE_Thread_Descriptor_Base (void) +{ +} + +ACE_INLINE bool +ACE_Thread_Descriptor_Base::operator== ( + const ACE_Thread_Descriptor_Base &rhs) const +{ + return + ACE_OS::thr_cmp (this->thr_handle_, rhs.thr_handle_) + && ACE_OS::thr_equal (this->thr_id_, rhs.thr_id_); +} + +ACE_INLINE bool +ACE_Thread_Descriptor_Base::operator!=(const ACE_Thread_Descriptor_Base &rhs) const +{ + return !(*this == rhs); +} + +ACE_INLINE ACE_Task_Base * +ACE_Thread_Descriptor_Base::task (void) const +{ + ACE_TRACE ("ACE_Thread_Descriptor_Base::task"); + return this->task_; +} + +// Group ID. + +ACE_INLINE int +ACE_Thread_Descriptor_Base::grp_id (void) const +{ + ACE_TRACE ("ACE_Thread_Descriptor_Base::grp_id"); + return grp_id_; +} + +// Current state of the thread. +ACE_INLINE ACE_UINT32 +ACE_Thread_Descriptor_Base::state (void) const +{ + ACE_TRACE ("ACE_Thread_Descriptor_Base::state"); + return thr_state_; +} + +// Reset this base descriptor. +ACE_INLINE void +ACE_Thread_Descriptor_Base::reset (void) +{ + ACE_TRACE ("ACE_Thread_Descriptor_Base::reset"); + this->thr_id_ = ACE_OS::NULL_thread; + this->thr_handle_ = ACE_OS::NULL_hthread; + this->grp_id_ = 0; + this->thr_state_ = ACE_Thread_Manager::ACE_THR_IDLE; + this->task_ = 0; + this->flags_ = 0; +} + +// Unique thread id. +ACE_INLINE ACE_thread_t +ACE_Thread_Descriptor::self (void) const +{ + ACE_TRACE ("ACE_Thread_Descriptor::self"); + return this->thr_id_; +} + +// Unique kernel-level thread handle. + +ACE_INLINE void +ACE_Thread_Descriptor::self (ACE_hthread_t &handle) +{ + ACE_TRACE ("ACE_Thread_Descriptor::self"); + handle = this->thr_handle_; +} + +ACE_INLINE void +ACE_Thread_Descriptor::log_msg_cleanup (ACE_Log_Msg* log_msg) + +{ + log_msg_ = log_msg; +} + +// Set the pointer +ACE_INLINE void +ACE_Thread_Descriptor::set_next (ACE_Thread_Descriptor *td) +{ + ACE_TRACE ("ACE_Thread_Descriptor::set_next"); + this->next_ = td; +} + +// Get the pointer +ACE_INLINE ACE_Thread_Descriptor * +ACE_Thread_Descriptor::get_next (void) const +{ + ACE_TRACE ("ACE_Thread_Descriptor::get_next"); + return static_cast (this->next_); +} + +// Reset this thread descriptor +ACE_INLINE void +ACE_Thread_Descriptor::reset (ACE_Thread_Manager *tm) +{ + ACE_TRACE ("ACE_Thread_Descriptor::reset"); + this->ACE_Thread_Descriptor_Base::reset (); + this->at_exit_list_ = 0; + // Start the at_exit hook list. + this->tm_ = tm; + // Setup the Thread_Manager. + this->log_msg_ = 0; + this->terminated_ = false; +} + +ACE_INLINE ACE_Thread_Descriptor * +ACE_Thread_Manager::thread_desc_self (void) +{ + // This method must be called with lock held. + + // Try to get it from cache. + ACE_Thread_Descriptor *desc = ACE_LOG_MSG->thr_desc (); + +#if 1 + // ACE_ASSERT (desc != 0); + // Thread descriptor should always get cached. +#else + if (desc == 0) + { + ACE_thread_t id = ACE_OS::thr_self (); + + desc = this->find_thread (id); + + // Thread descriptor adapter might not have been put into the + // list yet. + if (desc != 0) + // Update the TSS cache. + ACE_LOG_MSG->thr_desc (desc); + } +#endif + return desc; +} + +// Return the unique ID of the thread. + +ACE_INLINE ACE_thread_t +ACE_Thread_Manager::thr_self (void) +{ + ACE_TRACE ("ACE_Thread_Manager::thr_self"); + return ACE_Thread::self (); +} + +ACE_INLINE ACE_Task_Base * +ACE_Thread_Manager::task (void) +{ + ACE_TRACE ("ACE_Thread_Manager::task"); + + ACE_Thread_Descriptor *td = this->thread_desc_self () ; + + if (td == 0) + return 0; + else + return td->task (); +} + +ACE_INLINE int +ACE_Thread_Manager::open (size_t) +{ + // Currently no-op. + return 0; +} + +ACE_INLINE int +ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit* at) +{ + ACE_Thread_Descriptor *td = this->thread_desc_self (); + if (td == 0) + return -1; + else + return td->at_exit (at); +} + +ACE_INLINE int +ACE_Thread_Manager::at_exit (ACE_At_Thread_Exit& at) +{ + ACE_Thread_Descriptor *td = this->thread_desc_self (); + if (td == 0) + return -1; + else + return td->at_exit (at); +} + +ACE_INLINE int +ACE_Thread_Manager::at_exit (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param) +{ + ACE_Thread_Descriptor *td = this->thread_desc_self (); + if (td == 0) + return -1; + else + return td->at_exit (object, cleanup_hook, param); +} + +ACE_INLINE void +ACE_Thread_Manager::wait_on_exit (int do_wait) +{ + this->automatic_wait_ = do_wait; +} + +ACE_INLINE int +ACE_Thread_Manager::wait_on_exit (void) +{ + return this->automatic_wait_; +} + +ACE_INLINE int +ACE_Thread_Manager::register_as_terminated (ACE_Thread_Descriptor *td) +{ +#if defined (ACE_HAS_VXTHREADS) + ACE_UNUSED_ARG (td); +#else /* ! ACE_HAS_VXTHREADS */ + ACE_Thread_Descriptor_Base *tdb = 0; + ACE_NEW_RETURN (tdb, ACE_Thread_Descriptor_Base (*td), -1); + this->terminated_thr_list_.insert_tail (tdb); +#endif /* !ACE_HAS_VXTHREADS */ + return 0; +} + +ACE_INLINE size_t +ACE_Thread_Manager::count_threads (void) const +{ + return this->thr_list_.size (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Mutex.cpp b/externals/ace/Thread_Mutex.cpp new file mode 100644 index 0000000..4ebdc41 --- /dev/null +++ b/externals/ace/Thread_Mutex.cpp @@ -0,0 +1,62 @@ +/** + * @file Thread_Mutex.cpp + * + * $Id: Thread_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $ + * + * Originally in Synch.cpp + * + * @author Douglas C. Schmidt + */ + +#include "ace/Thread_Mutex.h" + +#if defined (ACE_HAS_THREADS) + +#if !defined (__ACE_INLINE__) +#include "ace/Thread_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" +#include "ace/Malloc_T.h" + +ACE_RCSID(ace, Thread_Mutex, "$Id: Thread_Mutex.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Mutex) + +void +ACE_Thread_Mutex::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Thread_Mutex::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Thread_Mutex::~ACE_Thread_Mutex (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::~ACE_Thread_Mutex"); + this->remove (); +} + +ACE_Thread_Mutex::ACE_Thread_Mutex (const ACE_TCHAR *name, ACE_mutexattr_t *arg) + : removed_ (false) +{ +// ACE_TRACE ("ACE_Thread_Mutex::ACE_Thread_Mutex"); + + if (ACE_OS::thread_mutex_init (&this->lock_, + 0, + name, + arg) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Thread_Mutex::ACE_Thread_Mutex"))); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/Thread_Mutex.h b/externals/ace/Thread_Mutex.h new file mode 100644 index 0000000..fd8f395 --- /dev/null +++ b/externals/ace/Thread_Mutex.h @@ -0,0 +1,176 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Thread_Mutex.h + * + * $Id: Thread_Mutex.h 89127 2010-02-22 19:58:18Z schmidt $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_THREAD_MUTEX_H +#define ACE_THREAD_MUTEX_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_HAS_THREADS) +# include "ace/Null_Mutex.h" +#else /* ACE_HAS_THREADS */ +// ACE platform supports some form of threading. + +#include /**/ "ace/ACE_export.h" +#include "ace/OS_NS_Thread.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Thread_Mutex + * + * @brief ACE_Thread_Mutex wrapper (only valid for threads in the same + * process). + * + * This implementation is optimized for locking threads that are + * in the same process. It maps to s on NT + * and with set to on UNIX. + * ACE_Thread_Mutex is recursive on some platforms (like + * Win32). However, on most platforms (like Solaris) it is not + * recursive. To be totally safe and portable, developers + * should use ACE_Recursive_Thread_Mutex when they need a + * recursive mutex. + */ +class ACE_Export ACE_Thread_Mutex +{ + friend class ACE_Condition_Thread_Mutex; +public: + /// Constructor. + ACE_Thread_Mutex (const ACE_TCHAR *name = 0, + ACE_mutexattr_t *attributes = 0); + + /// Implicitly destroy the mutex. + ~ACE_Thread_Mutex (void); + + /** + * Explicitly destroy the mutex. Note that only one thread should + * call this method since it doesn't protect against race + * conditions. + */ + int remove (void); + + /// Acquire lock ownership (wait on queue if necessary). + int acquire (void); + + /** + * Block the thread until we acquire the mutex or until @a tv times + * out, in which case -1 is returned with @c errno == @c ETIME. Note + * that @a tv is assumed to be in "absolute" rather than "relative" + * time. The value of @a tv is updated upon return to show the + * actual (absolute) acquisition time. + */ + int acquire (ACE_Time_Value &tv); + + /** + * If @a tv == 0 the call directly. Otherwise, Block the + * thread until we acquire the mutex or until @a tv times out, in + * which case -1 is returned with @c errno == @c ETIME. Note that + * @a tv is assumed to be in "absolute" rather than "relative" time. + * The value of @a tv is updated upon return to show the actual + * (absolute) acquisition time. + */ + int acquire (ACE_Time_Value *tv); + + /** + * Conditionally acquire lock (i.e., don't wait on queue). Returns + * -1 on failure. If we "failed" because someone else already had + * the lock, @c errno is set to @c EBUSY. + */ + int tryacquire (void); + + /// Release lock and unblock a thread at head of queue. + int release (void); + + /** + * Acquire mutex ownership. This calls acquire() and is only here + * to make the ACE_Thread_Mutex interface consistent with the + * other synchronization APIs. + */ + int acquire_read (void); + + /** + * Acquire mutex ownership. This calls acquire() and is only here + * to make the ACE_Thread_Mutex interface consistent with the + * other synchronization APIs. + */ + int acquire_write (void); + + /** + * Conditionally acquire mutex (i.e., won't block). This calls + * tryacquire() and is only here to make the ACE_Thread_Mutex + * interface consistent with the other synchronization APIs. + * Returns -1 on failure. If we "failed" because someone else + * already had the lock, @c errno is set to @c EBUSY. + */ + int tryacquire_read (void); + + /** + * Conditionally acquire mutex (i.e., won't block). This calls + * tryacquire() and is only here to make the ACE_Thread_Mutex + * interface consistent with the other synchronization APIs. + * Returns -1 on failure. If we "failed" because someone else + * already had the lock, @c errno is set to @c EBUSY. + */ + int tryacquire_write (void); + + /** + * This is only here to make the ACE_Thread_Mutex interface + * consistent with the other synchronization APIs. Assumes the + * caller has already acquired the mutex using one of the above + * calls, and returns 0 (success) always. + */ + int tryacquire_write_upgrade (void); + + /// Return the underlying mutex. + const ACE_thread_mutex_t &lock (void) const; + ACE_thread_mutex_t &lock (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Mutex type that supports single-process locking efficiently. + ACE_thread_mutex_t lock_; + + /// Keeps track of whether remove() has been called yet to avoid + /// multiple calls, e.g., explicitly and implicitly in the + /// destructor. This flag isn't protected by a lock, so make sure + /// that you don't have multiple threads simultaneously calling + /// on the same object, which is a bad idea anyway... + bool removed_; + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Thread_Mutex &); + ACE_Thread_Mutex (const ACE_Thread_Mutex &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Thread_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* !ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_THREAD_MUTEX_H */ diff --git a/externals/ace/Thread_Mutex.inl b/externals/ace/Thread_Mutex.inl new file mode 100644 index 0000000..d52fce9 --- /dev/null +++ b/externals/ace/Thread_Mutex.inl @@ -0,0 +1,104 @@ +// -*- C++ -*- +// +// $Id: Thread_Mutex.inl 89127 2010-02-22 19:58:18Z schmidt $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE const ACE_thread_mutex_t & +ACE_Thread_Mutex::lock (void) const +{ +// ACE_TRACE ("ACE_Thread_Mutex::lock"); + return this->lock_; +} + +ACE_INLINE ACE_thread_mutex_t & +ACE_Thread_Mutex::lock (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::lock"); + return this->lock_; +} + +ACE_INLINE int +ACE_Thread_Mutex::acquire_read (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::acquire_read"); + return ACE_OS::thread_mutex_lock (&this->lock_); +} + +ACE_INLINE int +ACE_Thread_Mutex::acquire_write (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::acquire_write"); + return ACE_OS::thread_mutex_lock (&this->lock_); +} + +ACE_INLINE int +ACE_Thread_Mutex::tryacquire_read (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_read"); + return ACE_OS::thread_mutex_trylock (&this->lock_); +} + +ACE_INLINE int +ACE_Thread_Mutex::tryacquire_write (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_write"); + return ACE_OS::thread_mutex_trylock (&this->lock_); +} + +ACE_INLINE int +ACE_Thread_Mutex::tryacquire_write_upgrade (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::tryacquire_write_upgrade"); + return 0; +} + +ACE_INLINE int +ACE_Thread_Mutex::acquire (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::acquire"); + return ACE_OS::thread_mutex_lock (&this->lock_); +} + +ACE_INLINE int +ACE_Thread_Mutex::acquire (ACE_Time_Value &tv) +{ + // ACE_TRACE ("ACE_Thread_Mutex::acquire"); + return ACE_OS::thread_mutex_lock (&this->lock_, tv); +} + +ACE_INLINE int +ACE_Thread_Mutex::acquire (ACE_Time_Value *tv) +{ + // ACE_TRACE ("ACE_Thread_Mutex::acquire"); + return ACE_OS::thread_mutex_lock (&this->lock_, tv); +} + +ACE_INLINE int +ACE_Thread_Mutex::tryacquire (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::tryacquire"); + return ACE_OS::thread_mutex_trylock (&this->lock_); +} + +ACE_INLINE int +ACE_Thread_Mutex::release (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::release"); + return ACE_OS::thread_mutex_unlock (&this->lock_); +} + +ACE_INLINE int +ACE_Thread_Mutex::remove (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::remove"); + int result = 0; + if (!this->removed_) + { + this->removed_ = true; + result = ACE_OS::thread_mutex_destroy (&this->lock_); + } + return result; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Thread_Semaphore.cpp b/externals/ace/Thread_Semaphore.cpp new file mode 100644 index 0000000..39b2893 --- /dev/null +++ b/externals/ace/Thread_Semaphore.cpp @@ -0,0 +1,62 @@ +/** + * @file Thread_Semaphore.cpp + * + * $Id: Thread_Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $ + * + * Originally in Synch.cpp + * + * @author Douglas C. Schmidt + */ + +#include "ace/Thread_Semaphore.h" + +#if defined (ACE_HAS_THREADS) + +#if !defined (__ACE_INLINE__) +#include "ace/Thread_Semaphore.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/ACE.h" + +ACE_RCSID(ace, Thread_Semaphore, "$Id: Thread_Semaphore.cpp 80826 2008-03-04 14:51:23Z wotte $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +void +ACE_Thread_Semaphore::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +// ACE_TRACE ("ACE_Thread_Semaphore::dump"); + + ACE_Semaphore::dump (); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Thread_Semaphore::ACE_Thread_Semaphore (unsigned int count, + const ACE_TCHAR *name, + void *arg, + int max) + : ACE_Semaphore (count, USYNC_THREAD, name, arg, max) +{ +// ACE_TRACE ("ACE_Thread_Semaphore::ACE_Thread_Semaphore"); +} + +/*****************************************************************************/ + +ACE_Thread_Semaphore * +ACE_Malloc_Lock_Adapter_T::operator () (const ACE_TCHAR *name) +{ + ACE_Thread_Semaphore *p = 0; + if (name == 0) + ACE_NEW_RETURN (p, ACE_Thread_Semaphore (1, name), 0); + else + ACE_NEW_RETURN (p, ACE_Thread_Semaphore (1, ACE::basename (name, + ACE_DIRECTORY_SEPARATOR_CHAR)), + 0); + return p; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/Thread_Semaphore.h b/externals/ace/Thread_Semaphore.h new file mode 100644 index 0000000..d7013d9 --- /dev/null +++ b/externals/ace/Thread_Semaphore.h @@ -0,0 +1,87 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Thread_Semaphore.h + * + * $Id: Thread_Semaphore.h 86731 2009-09-17 12:23:48Z johnnyw $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt + */ +//========================================================================== + +#ifndef ACE_THREAD_SEMAPHORE_H +#define ACE_THREAD_SEMAPHORE_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_HAS_THREADS) +# include "ace/Null_Semaphore.h" +#else /* ACE_HAS_THREADS */ +// ACE platform supports some form of threading. + +#include "ace/Semaphore.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Thread_Semaphore + * + * @brief Wrapper for Dijkstra style general semaphores that work + * only within one process. + */ +class ACE_Export ACE_Thread_Semaphore : public ACE_Semaphore +{ +public: + /// Initialize the semaphore, with an initial value of @a count, + /// maximum value of @a max, and unlocked by default. + ACE_Thread_Semaphore (unsigned int count = 1, // By default make this unlocked. + const ACE_TCHAR *name = 0, + void * = 0, + int max = 0x7FFFFFFF); + + /// Default dtor. + ~ACE_Thread_Semaphore (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +/*****************************************************************************/ + +template class ACE_Malloc_Lock_Adapter_T; + +/** + * @brief Template specialization of ACE_Malloc_Lock_Adapter_T for + * ACE_Thread_Semaphore. + * + * This is needed since the ctor for ACE_Thread_Semaphore doesn't match + * the standard form used by other lock strategy classes. + */ +template<> +class ACE_Export ACE_Malloc_Lock_Adapter_T +{ +public: + ACE_Thread_Semaphore * operator () (const ACE_TCHAR *name); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Thread_Semaphore.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* !ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_THREAD_SEMAPHORE_H */ diff --git a/externals/ace/Thread_Semaphore.inl b/externals/ace/Thread_Semaphore.inl new file mode 100644 index 0000000..b64ec3c --- /dev/null +++ b/externals/ace/Thread_Semaphore.inl @@ -0,0 +1,12 @@ +// -*- C++ -*- +// +// $Id: Thread_Semaphore.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Thread_Semaphore::~ACE_Thread_Semaphore (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Throughput_Stats.cpp b/externals/ace/Throughput_Stats.cpp new file mode 100644 index 0000000..6e66729 --- /dev/null +++ b/externals/ace/Throughput_Stats.cpp @@ -0,0 +1,202 @@ +// $Id: Throughput_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Throughput_Stats.h" + +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" +#include "ace/High_Res_Timer.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, Throughput_Stats, "$Id: Throughput_Stats.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Throughput_Stats::ACE_Throughput_Stats (void) + : ACE_Basic_Stats () + , throughput_last_ (0) +#if 0 + // @@TODO: This is what I really wanted to compute, but it just + // does not work. + , throughput_sum_x_ (0) + , throughput_sum_x2_ (0) + , throughput_sum_y_ (0) + , throughput_sum_y2_ (0) + , throughput_sum_xy_ (0) +#endif /* 0 */ +{ +} + +void +ACE_Throughput_Stats::sample (ACE_UINT64 throughput, + ACE_UINT64 latency) +{ + this->ACE_Basic_Stats::sample (latency); + + if (this->samples_count () == 1u) + { + + this->throughput_last_ = throughput; +#if 0 + // @@TODO: This is what I really wanted to compute, but it just + // does not work. + this->throughput_sum_y_ = this->samples_count_; + this->throughput_sum_y2_ = this->samples_count_ * this->samples_count_; + this->throughput_sum_x_ = throughput; + this->throughput_sum_x2_ = throughput * throughput; + this->throughput_sum_xy_ = throughput * this->samples_count_; + + ACE_OS::printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_); +#endif /* 0 */ + } + else + { + this->throughput_last_ = throughput; + +#if 0 + // @@TODO: This is what I really wanted to compute, but it just + // does not work. + this->throughput_sum_y_ += this->samples_count_; + this->throughput_sum_y2_ += this->samples_count_ * this->samples_count_; + this->throughput_sum_x_ += throughput; + this->throughput_sum_x2_ += throughput * throughput; + this->throughput_sum_xy_ += throughput * this->samples_count_; + + ACE_OS::printf ("%f %qu\n", throughput / 400000000.0, this->samples_count_); +#endif /* 0 */ + } +} + +void +ACE_Throughput_Stats::accumulate (const ACE_Throughput_Stats &rhs) +{ + if (rhs.samples_count () == 0u) + return; + + this->ACE_Basic_Stats::accumulate (rhs); + + if (this->samples_count () == 0u) + { + this->throughput_last_ = rhs.throughput_last_; +#if 0 + // @@TODO: This is what I really wanted to compute, but it just + // does not work. + this->throughput_sum_x_ = rhs.throughput_sum_x_; + this->throughput_sum_x2_ = rhs.throughput_sum_x2_; + this->throughput_sum_y_ = rhs.throughput_sum_y_; + this->throughput_sum_y2_ = rhs.throughput_sum_y2_; + this->throughput_sum_xy_ = rhs.throughput_sum_xy_; +#endif /* 0 */ + + return; + } + + + if (this->throughput_last_ < rhs.throughput_last_) + this->throughput_last_ = rhs.throughput_last_; + +#if 0 + // @@TODO: This is what I really wanted to compute, but it just + // does not work. + this->throughput_sum_x_ += rhs.throughput_sum_x_; + this->throughput_sum_x2_ += rhs.throughput_sum_x2_; + this->throughput_sum_y_ += rhs.throughput_sum_y_; + this->throughput_sum_y2_ += rhs.throughput_sum_y2_; + this->throughput_sum_xy_ += rhs.throughput_sum_xy_; +#endif /* 0 */ +} + +void +ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg, + ACE_UINT32 sf) +{ + if (this->samples_count () == 0u) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s : no data collected\n"), msg)); + return; + } + + this->ACE_Basic_Stats::dump_results (msg, sf); + + ACE_Throughput_Stats::dump_throughput (msg, sf, + this->throughput_last_, + this->samples_count ()); + +#if 0 + // @@TODO: This is what I really wanted to generate, but it just + // doesn't work. + double t_sum_x = + ACE_CU64_TO_CU32 (this->throughput_sum_x_);// / sf); + //t_sum_x /= 1000000.0; + double t_sum_y = + ACE_CU64_TO_CU32 (this->throughput_sum_y_); + double t_sum_x2 = + ACE_CU64_TO_CU32 (this->throughput_sum_x2_);// / (sf*sf)); + //t_sum_x2 /= 1000000.0; + //t_sum_x2 /= 1000000.0; + double t_sum_y2 = + ACE_CU64_TO_CU32 (this->throughput_sum_y2_); + double t_sum_xy = + ACE_CU64_TO_CU32 (this->throughput_sum_xy_);// / sf); + //t_sum_xy /= 1000000.0; + double t_avgx = t_sum_x / this->samples_count (); + double t_avgy = t_sum_y / this->samples_count (); + + double t_a = + (this->samples_count () * t_sum_xy - t_sum_x * t_sum_y) + / (this->samples_count () * t_sum_x2 - t_sum_x * t_sum_x); + double t_b = (t_avgy - t_a * t_avgx); + + t_a *= 1000000.0; + + double d_r = + (t_sum_xy - t_avgx * t_sum_y - t_avgy * t_sum_x + + this->samples_count () * t_avgx * t_avgy); + double n_r = + (t_sum_x2 + - this->samples_count () * t_avgx * t_avgx) + * (t_sum_y2 + - this->samples_count () * t_avgy * t_avgy); + double t_r = d_r * d_r / n_r; + + // ACE_DEBUG ((LM_DEBUG, + // "%s throughput: %.2f/%.2f/%.2f/%.6f/%.2f (avg/a/b/r/elapsed)\n", + // msg, t_avg, t_a, t_b, t_r, seconds)); + // ACE_DEBUG ((LM_DEBUG, + // "%s data: %.2f/%.2f/%.2f/%.6f/%.2f (x/x2/y/y2/xy)\n", + // msg, t_sum_x, t_sum_x2, t_sum_y, t_sum_y2, t_sum_xy)); +#endif +} + +void +ACE_Throughput_Stats::dump_throughput (const ACE_TCHAR *msg, + ACE_UINT32 sf, + ACE_UINT64 elapsed_time, + ACE_UINT32 samples_count) +{ +#ifndef ACE_NLOGGING + double seconds = +# if defined ACE_LACKS_LONGLONG_T + elapsed_time / sf; +#elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + static_cast (ACE_UINT64_DBLCAST_ADAPTER ( + ACE_U_LongLong(elapsed_time / sf))); +# else /* ! ACE_LACKS_LONGLONG_T */ + static_cast (ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / sf)); +# endif /* ! ACE_LACKS_LONGLONG_T */ + seconds /= ACE_HR_SCALE_CONVERSION; + + const double t_avg = samples_count / seconds; + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s throughput: %.2f (events/second)\n"), + msg, t_avg)); +#else + ACE_UNUSED_ARG (msg); + ACE_UNUSED_ARG (sf); + ACE_UNUSED_ARG (elapsed_time); + ACE_UNUSED_ARG (samples_count); +#endif /* ACE_NLOGGING */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Throughput_Stats.h b/externals/ace/Throughput_Stats.h new file mode 100644 index 0000000..c306c85 --- /dev/null +++ b/externals/ace/Throughput_Stats.h @@ -0,0 +1,86 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Throughput_Stats.h + * + * $Id: Throughput_Stats.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author David L. Levine + */ +//========================================================================== + + +#ifndef ACE_THROUGHPUT_STATS_H +#define ACE_THROUGHPUT_STATS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Basic_Stats.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/// A simple class to make throughput and latency analysis. +/** + * + * Keep the relevant information to perform throughput and latency + * analysis, including: + * -# Minimum, Average and Maximum latency + * -# Jitter for the latency + * -# Linear regression for throughput + * -# Accumulate results from several samples to obtain aggregated + * results, across several threads or experiments. + * + * @todo The idea behind this class was to use linear regression to + * determine if the throughput was linear or exhibited jitter. + * Unfortunately it never worked quite right, so only average + * throughput is computed. + */ +class ACE_Export ACE_Throughput_Stats : public ACE_Basic_Stats +{ +public: + /// Constructor + ACE_Throughput_Stats (void); + + /// Store one sample + void sample (ACE_UINT64 throughput, ACE_UINT64 latency); + + /// Update the values to reflect the stats in @a throughput + void accumulate (const ACE_Throughput_Stats &throughput); + + /// Print down the stats + void dump_results (const ACE_TCHAR* msg, ACE_UINT32 scale_factor); + + /// Dump the average throughput stats. + static void dump_throughput (const ACE_TCHAR *msg, + ACE_UINT32 scale_factor, + ACE_UINT64 elapsed_time, + ACE_UINT32 samples_count); +private: + /// The last throughput measurement. + ACE_UINT64 throughput_last_; + +#if 0 + /// These are the fields that we should keep to perform linear + /// regression + //@{ + ///@} + ACE_UINT64 throughput_sum_x_; + ACE_UINT64 throughput_sum_x2_; + ACE_UINT64 throughput_sum_y_; + ACE_UINT64 throughput_sum_y2_; + ACE_UINT64 throughput_sum_xy_; +#endif /* 0 */ +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ! ACE_THROUGHPUT_STATS_H */ diff --git a/externals/ace/Time_Value.cpp b/externals/ace/Time_Value.cpp new file mode 100644 index 0000000..af07c54 --- /dev/null +++ b/externals/ace/Time_Value.cpp @@ -0,0 +1,359 @@ +#include "ace/Time_Value.h" + +ACE_RCSID (ace, + Time_Value, + "$Id: Time_Value.cpp 89791 2010-04-07 14:36:21Z schmidt $") + +#if !defined (__ACE_INLINE__) +#include "ace/Time_Value.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Numeric_Limits.h" +#include "ace/If_Then_Else.h" +#include "ace/OS_NS_math.h" + +#ifdef ACE_HAS_CPP98_IOSTREAMS +#include +#include +#endif /* ACE_HAS_CPP98_IOSTREAMS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/// Static constant representing `zero-time'. +/// Note: this object requires static construction. +const ACE_Time_Value ACE_Time_Value::zero; + +/// Constant for maximum time representable. Note that this time +/// is not intended for use with select () or other calls that may +/// have *their own* implementation-specific maximum time representations. +/// Its primary use is in time computations such as those used by the +/// dynamic subpriority strategies in the ACE_Dynamic_Message_Queue class. +/// Note: this object requires static construction. +const ACE_Time_Value ACE_Time_Value::max_time ( + ACE_Numeric_Limits::max (), + ACE_ONE_SECOND_IN_USECS - 1); + +ACE_ALLOC_HOOK_DEFINE (ACE_Time_Value) + +/// Increment microseconds (the only reason this is here is to allow +/// the use of ACE_Atomic_Op with ACE_Time_Value). +ACE_Time_Value +ACE_Time_Value::operator ++ (int) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (int)"); + ACE_Time_Value tv (*this); + ++*this; + return tv; +} + +ACE_Time_Value & +ACE_Time_Value::operator ++ (void) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (void)"); + this->usec (this->usec () + 1); + this->normalize (); + return *this; +} + +/// Decrement microseconds (the only reason this is here is / to allow +/// the use of ACE_Atomic_Op with ACE_Time_Value). +ACE_Time_Value +ACE_Time_Value::operator -- (int) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator -- (int)"); + ACE_Time_Value tv (*this); + --*this; + return tv; +} + +ACE_Time_Value & +ACE_Time_Value::operator -- (void) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator -- (void)"); + this->usec (this->usec () - 1); + this->normalize (); + return *this; +} + +#if defined (ACE_WIN32) +/// Static constant to remove time skew between FILETIME and POSIX +/// time. POSIX and Win32 use different epochs (Jan. 1, 1970 v.s. +/// Jan. 1, 1601). The following constant defines the difference +/// in 100ns ticks. +/// +/// In the beginning (Jan. 1, 1601), there was no time and no computer. +/// And Bill said: "Let there be time," and there was time.... +# if defined (ACE_LACKS_LONGLONG_T) +const ACE_U_LongLong ACE_Time_Value::FILETIME_to_timval_skew = +ACE_U_LongLong (0xd53e8000, 0x19db1de); +# else +const DWORDLONG ACE_Time_Value::FILETIME_to_timval_skew = +ACE_INT64_LITERAL (0x19db1ded53e8000); +# endif + +/// Initializes the ACE_Time_Value object from a Win32 FILETIME +ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time) +{ + // // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (file_time); +} + +void ACE_Time_Value::set (const FILETIME &file_time) +{ + // Initializes the ACE_Time_Value object from a Win32 FILETIME +#if defined (ACE_LACKS_LONGLONG_T) + ACE_U_LongLong LL_100ns(file_time.dwLowDateTime, file_time.dwHighDateTime); + LL_100ns -= ACE_Time_Value::FILETIME_to_timval_skew; + // Convert 100ns units to seconds; + this->tv_.tv_sec = (long) (LL_100ns / ((double) (10000 * 1000))); + // Convert remainder to microseconds; + this->tv_.tv_usec = (suseconds_t)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); +#else + // Don't use a struct initializer, gcc don't like it. + ULARGE_INTEGER _100ns; + _100ns.LowPart = file_time.dwLowDateTime; + _100ns.HighPart = file_time.dwHighDateTime; + + _100ns.QuadPart -= ACE_Time_Value::FILETIME_to_timval_skew; + + // Convert 100ns units to seconds; + this->tv_.tv_sec = (long) (_100ns.QuadPart / (10000 * 1000)); + // Convert remainder to microseconds; + this->tv_.tv_usec = (suseconds_t) ((_100ns.QuadPart % (10000 * 1000)) / 10); +#endif // ACE_LACKS_LONGLONG_T + this->normalize (); +} + +/// Returns the value of the object as a Win32 FILETIME. +ACE_Time_Value::operator FILETIME () const +{ + FILETIME file_time; + // ACE_OS_TRACE ("ACE_Time_Value::operator FILETIME"); + +#if defined (ACE_LACKS_LONGLONG_T) + ACE_U_LongLong LL_sec(this->tv_.tv_sec); + ACE_U_LongLong LL_usec(this->tv_.tv_usec); + ACE_U_LongLong LL_100ns = LL_sec * (ACE_UINT32)(10000 * 1000) + + LL_usec * (ACE_UINT32)10 + + ACE_Time_Value::FILETIME_to_timval_skew; + file_time.dwLowDateTime = LL_100ns.lo(); + file_time.dwHighDateTime = LL_100ns.hi(); +#else + ULARGE_INTEGER _100ns; + _100ns.QuadPart = (((DWORDLONG) this->tv_.tv_sec * (10000 * 1000) + + this->tv_.tv_usec * 10) + + ACE_Time_Value::FILETIME_to_timval_skew); + + file_time.dwLowDateTime = _100ns.LowPart; + file_time.dwHighDateTime = _100ns.HighPart; +#endif //ACE_LACKS_LONGLONG_T + + return file_time; +} + +#endif /* ACE_WIN32 */ + +void +ACE_Time_Value::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_OS_TRACE ("ACE_Time_Value::dump"); +#if 0 + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntv_sec_ = %d"), this->tv_.tv_sec)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntv_usec_ = %d\n"), this->tv_.tv_usec)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* 0 */ +#endif /* ACE_HAS_DUMP */ +} + +void +ACE_Time_Value::normalize (bool saturate) +{ + // // ACE_OS_TRACE ("ACE_Time_Value::normalize"); + // From Hans Rohnert... + + if (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS) + { + /*! \todo This loop needs some optimization. + */ + if (!saturate) // keep the conditionnal expression outside the while loop to minimize performance cost + do + { + ++this->tv_.tv_sec; + this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; + } + while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); + else + do + if (this->tv_.tv_sec < ACE_Numeric_Limits::max()) + { + ++this->tv_.tv_sec; + this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; + } + else + this->tv_.tv_usec = ACE_ONE_SECOND_IN_USECS - 1; + while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); + } + else if (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS) + { + /*! \todo This loop needs some optimization. + */ + if (!saturate) + do + { + --this->tv_.tv_sec; + this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; + } + while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); + else + do + if (this->tv_.tv_sec > ACE_Numeric_Limits::min()) + { + --this->tv_.tv_sec; + this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; + } + else + this->tv_.tv_usec = -ACE_ONE_SECOND_IN_USECS + 1; + while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); + } + + if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0) + { + --this->tv_.tv_sec; + this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; + } + // tv_sec in qnxnto is unsigned +#if !defined ( __QNXNTO__) + else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) + { + ++this->tv_.tv_sec; + this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; + } +#endif /* __QNXNTO__ */ +} + + +ACE_Time_Value & +ACE_Time_Value::operator *= (double d) +{ + // To work around the lack of precision of a long double to contain + // a 64-bits time_t + 6 digits after the decimal point for the usec part, + // we perform the multiplication of the 2 timeval parts separately. + // + // This extra precision step is adding a cost when transfering the + // seconds resulting from the usec multiplication. This operation + // correspond to the normalization process performed in normalize() + // but we must absolutly do it here because the usec multiplication + // result value could exceed what can be stored in a suseconds_t + // type variable. + // + // Since this is a costly operation, we try to detect as soon as + // possible if we are having a saturation in order to abort the rest + // of the computation. + typedef ACE::If_Then_Else<(sizeof (double) > sizeof (time_t)), + double, + long double>::result_type float_type; + + float_type sec_total = static_cast (this->sec()); + sec_total *= d; + + // shall we saturate the result? + static const float_type max_int = + ACE_Numeric_Limits::max() + 0.999999; + static const float_type min_int = + ACE_Numeric_Limits::min() - 0.999999; + + if (sec_total > max_int) + { + this->set(ACE_Numeric_Limits::max(), ACE_ONE_SECOND_IN_USECS-1); + } + else if (sec_total < min_int) + { + this->set(ACE_Numeric_Limits::min(), -ACE_ONE_SECOND_IN_USECS+1); + } + else + { + time_t time_sec = static_cast (sec_total); + + float_type usec_total = this->usec(); + usec_total *= d; + + // adding usec resulting from tv_sec mult + usec_total += (sec_total-time_sec) * ACE_ONE_SECOND_IN_USECS; + + // extract seconds component of the usec mult + sec_total = usec_total / ACE_ONE_SECOND_IN_USECS; + // keep remaining usec + if (sec_total > 0) + { + usec_total = (sec_total - ACE_OS::floor(sec_total)); + } + else + { + usec_total = (sec_total - ACE_OS::ceil(sec_total)); + } + + sec_total -= usec_total; + usec_total *= ACE_ONE_SECOND_IN_USECS; + + // add the seconds component of the usec mult with the tv_sec mult prod. + sec_total += time_sec; + + // recheck for saturation + if (sec_total > max_int) + { + this->set (ACE_Numeric_Limits::max(), ACE_ONE_SECOND_IN_USECS - 1); + } + else if (sec_total < min_int) + { + this->set (ACE_Numeric_Limits::min(), -ACE_ONE_SECOND_IN_USECS + 1); + } + else + { + time_sec = static_cast (sec_total); + suseconds_t time_usec = static_cast (usec_total); + + // round up the result to save the last usec + if (time_usec > 0 && (usec_total - time_usec) >= 0.5) + { + ++time_usec; + } + else if (time_usec < 0 && (usec_total - time_usec) <= -0.5) + { + --time_usec; + } + + this->set (time_sec, time_usec); + } + } + return *this; +} + +#ifdef ACE_HAS_CPP98_IOSTREAMS +ostream &operator<<(ostream &o, const ACE_Time_Value &v) +{ + char oldFiller = o.fill (); + o.fill ('0'); + const timeval *tv = v; + if (tv->tv_sec) + { + o << tv->tv_sec; + if (tv->tv_usec) + o << '.' << std::setw (6) << ACE_STD_NAMESPACE::abs (tv->tv_usec); + } + else if (tv->tv_usec < 0) + o << "-0." << std::setw (6) << - tv->tv_usec; + else + { + o << '0'; + if (tv->tv_usec > 0) + o << '.'<< std::setw (6) << tv->tv_usec; + } + + o.fill (oldFiller); + return o; +} +#endif /* ACE_HAS_CPP98_IOSTREAMS */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Time_Value.h b/externals/ace/Time_Value.h new file mode 100644 index 0000000..384ff7d --- /dev/null +++ b/externals/ace/Time_Value.h @@ -0,0 +1,374 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Time_Value.h + * + * $Id: Time_Value.h 89121 2010-02-22 14:48:31Z schmidt $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TIME_VALUE_H +#define ACE_TIME_VALUE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +# include "ace/os_include/os_time.h" + +// Define some helpful constants. +// Not type-safe, and signed. For backward compatibility. +#define ACE_ONE_SECOND_IN_MSECS 1000L +suseconds_t const ACE_ONE_SECOND_IN_USECS = 1000000; +#define ACE_ONE_SECOND_IN_NSECS 1000000000L + +// needed for ACE_UINT64 +#include "ace/Basic_Types.h" + +// needed to determine if iostreams are present +#include "ace/iosfwd.h" + +// This forward declaration is needed by the set() and FILETIME() functions +#if defined (ACE_LACKS_LONGLONG_T) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Export ACE_U_LongLong; +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_LACKS_LONGLONG_T */ + +// ------------------------------------------------------------------- + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + +/** + * @class ACE_Time_Value + * + * @brief Operations on "timeval" structures, which express time in + * seconds (secs) and microseconds (usecs). + * + * This class centralizes all the time related processing in + * ACE. These time values are typically used in conjunction with OS + * mechanisms like or other calls that may have + * *their own* implementation-specific maximum time representations. + * Its primary use is in time computations such as those used by the + * dynamic subpriority strategies in the ACE_Dynamic_Message_Queue + * class. + */ + static const ACE_Time_Value max_time; + + // = Initialization methods. + + /// Default Constructor. + ACE_Time_Value (void); + + /// Constructor. + explicit ACE_Time_Value (time_t sec, suseconds_t usec = 0); + + // = Methods for converting to/from various time formats. + + /// Construct the ACE_Time_Value from a timeval. + explicit ACE_Time_Value (const struct timeval &t); + + /// Construct the ACE_Time_Value object from a timespec_t. + explicit ACE_Time_Value (const timespec_t &t); + +# if defined (ACE_WIN32) + /// Construct the ACE_Time_Value object from a Win32 FILETIME + explicit ACE_Time_Value (const FILETIME &ft); +# endif /* ACE_WIN32 */ + + /// Initializes the ACE_Time_Value from seconds and useconds. + void set (time_t sec, suseconds_t usec); + + /// Initializes the ACE_Time_Value from a double, which is assumed to be + /// in second format, with any remainder treated as microseconds. + void set (double d); + + /// Initializes the ACE_Time_Value from a timeval. + void set (const timeval &t); + + /// Initializes the ACE_Time_Value object from a timespec_t. + void set (const timespec_t &t); + +# if defined (ACE_WIN32) + /// Initializes the ACE_Time_Value object from a Win32 FILETIME. + void set (const FILETIME &ft); +# endif /* ACE_WIN32 */ + + /// Converts from ACE_Time_Value format into milliseconds format. + /** + * @return Sum of second field (in milliseconds) and microsecond field + * (in milliseconds). Note that this method can overflow if + * the second and microsecond field values are large, so use + * the msec (ACE_UINT64 &ms) method instead. + * + * @note The semantics of this method differs from the sec() and + * usec() methods. There is no analogous "millisecond" + * component in an ACE_Time_Value. + */ + unsigned long msec (void) const; + + /// Converts from ACE_Time_Value format into milliseconds format. + /** + * @return Sum of second field (in milliseconds) and microsecond field + * (in milliseconds) and return them via the @param ms parameter. + * + * @note The semantics of this method differs from the sec() and + * usec() methods. There is no analogous "millisecond" + * component in an ACE_Time_Value. + */ + void msec (ACE_UINT64 &ms) const; + + /// Converts from ACE_Time_Value format into milliseconds format. + /** + * @return Sum of second field (in milliseconds) and microsecond field + * (in milliseconds) and return them via the @param ms parameter. + * + * @note The semantics of this method differs from the sec() and + * usec() methods. There is no analogous "millisecond" + * component in an ACE_Time_Value. + */ + void msec (ACE_UINT64 &ms) /* const */; + + /// Converts from milli-seconds format into ACE_Time_Value format. + /** + * @note The semantics of this method differs from the sec() and + * usec() methods. There is no analogous "millisecond" + * component in an ACE_Time_Value. + */ + void msec (long); + + /// Converts from milli-seconds format into ACE_Time_Value format. + /** + * @note The semantics of this method differs from the sec() and + * usec() methods. There is no analogous "millisecond" + * component in an ACE_Time_Value. + */ + void msec (int); // converted to long then calls above. + + /// Returns the value of the object as a timespec_t. + operator timespec_t () const; + + /// Returns the value of the object as a timeval. + operator timeval () const; + + /// Returns a pointer to the object as a timeval. + operator const timeval *() const; + +# if defined (ACE_WIN32) + /// Returns the value of the object as a Win32 FILETIME. + operator FILETIME () const; +# endif /* ACE_WIN32 */ + + // = The following are accessor/mutator methods. + + /// Get seconds. + /** + * @return The second field/component of this ACE_Time_Value. + * + * @note The semantics of this method differs from the msec() + * method. + */ + time_t sec (void) const; + + /// Set seconds. + void sec (time_t sec); + + /// Get microseconds. + /** + * @return The microsecond field/component of this ACE_Time_Value. + * + * @note The semantics of this method differs from the msec() + * method. + */ + suseconds_t usec (void) const; + + /// Set microseconds. + void usec (suseconds_t usec); + + /** + * @return Sum of second field (in microseconds) and microsecond field + * and return them via the @param usec parameter. + */ + void to_usec (ACE_UINT64 &usec) const; + + // = The following arithmetic methods operate on ACE_Time_Value's. + + /// Add @a tv to this. + ACE_Time_Value &operator += (const ACE_Time_Value &tv); + + /// Add @a tv to this. + ACE_Time_Value &operator += (time_t tv); + + /// Assign @ tv to this + ACE_Time_Value &operator = (const ACE_Time_Value &tv); + + /// Assign @ tv to this + ACE_Time_Value &operator = (time_t tv); + + /// Subtract @a tv to this. + ACE_Time_Value &operator -= (const ACE_Time_Value &tv); + + /// Substract @a tv to this. + ACE_Time_Value &operator -= (time_t tv); + + /** + \brief Multiply the time value by the @a d factor. + \note The result of the operator is valid for results from range + < (ACE_INT32_MIN, -999999), (ACE_INT32_MAX, 999999) >. Result + outside this range are saturated to a limit. + */ + ACE_Time_Value &operator *= (double d); + + /// Increment microseconds as postfix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value operator++ (int); + + /// Increment microseconds as prefix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value &operator++ (void); + + /// Decrement microseconds as postfix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value operator-- (int); + + /// Decrement microseconds as prefix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value &operator-- (void); + + /// Adds two ACE_Time_Value objects together, returns the sum. + friend ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// Subtracts two ACE_Time_Value objects, returns the difference. + friend ACE_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if @a tv1 < @a tv2. + friend ACE_Export bool operator < (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if @a tv1 > @a tv2. + friend ACE_Export bool operator > (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if @a tv1 <= @a tv2. + friend ACE_Export bool operator <= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if @a tv1 >= @a tv2. + friend ACE_Export bool operator >= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if @a tv1 == @a tv2. + friend ACE_Export bool operator == (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if @a tv1 != @a tv2. + friend ACE_Export bool operator != (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + //@{ + /// Multiplies the time value by @a d + friend ACE_Export ACE_Time_Value operator * (double d, + const ACE_Time_Value &tv); + + friend ACE_Export ACE_Time_Value operator * (const ACE_Time_Value &tv, + double d); + //@} + + /// Dump is a no-op. + /** + * The dump() method is a no-op. It's here for backwards compatibility + * only, but does not dump anything. Invoking logging methods here + * violates layering restrictions in ACE because this class is part + * of the OS layer and @c ACE_Log_Msg is at a higher level. + */ + void dump (void) const; + +# if defined (ACE_WIN32) + /// Const time difference between FILETIME and POSIX time. +# if defined (ACE_LACKS_LONGLONG_T) + static const ACE_U_LongLong FILETIME_to_timval_skew; +# else + static const DWORDLONG FILETIME_to_timval_skew; +# endif // ACE_LACKS_LONGLONG_T +# endif /* ACE_WIN32 */ + +private: + /// Put the timevalue into a canonical form. + void normalize (bool saturate = false); + + /// Store the values as a timeval. +#if defined (ACE_HAS_TIME_T_LONG_MISMATCH) + // Windows' timeval is non-conformant, so swap in a struct that conforms + // to the proper data types to represent the entire time range that this + // class's API can accept. + // Also, since this class can supply a pointer to a timeval that things + // like select() expect, we need the OS-defined one as well. To make this + // available, use a real timeval called ext_tv_ and set it up when needed. + // Since this is most often for relative times that don't approach 32 bits + // in size, reducing a time_t to fit should be no problem. + struct { + time_t tv_sec; + suseconds_t tv_usec; + } tv_; + timeval ext_tv_; +#else + timeval tv_; +#endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ +}; + +#ifdef ACE_HAS_CPP98_IOSTREAMS +extern ACE_Export ostream &operator<<( ostream &o, const ACE_Time_Value &v ); +#endif + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Time_Value.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (__MINGW32__) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +// The MingW linker has problems with the exported statics +// zero and max_time with these two statics the linker will be able to +// resolve the static exported symbols. +static const ACE_Time_Value& __zero_time = ACE_Time_Value::zero; +static const ACE_Time_Value& __max_time = ACE_Time_Value::max_time; +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* __MINGW32__ */ + +#include /**/ "ace/post.h" + +#endif /* ACE_TIME_VALUE_H */ diff --git a/externals/ace/Time_Value.inl b/externals/ace/Time_Value.inl new file mode 100644 index 0000000..23d6f2d --- /dev/null +++ b/externals/ace/Time_Value.inl @@ -0,0 +1,399 @@ +// -*- C++ -*- +// +// $Id: Time_Value.inl 88502 2010-01-12 19:53:17Z olli $ + +#include "ace/Truncate.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/// Returns the value of the object as a timeval. +ACE_INLINE +ACE_Time_Value::operator timeval () const +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator timeval"); +#if defined (ACE_HAS_TIME_T_LONG_MISMATCH) + // Recall that on some Windows we substitute another type for timeval in tv_ + ACE_Time_Value *me = const_cast (this); + me->ext_tv_.tv_sec = ACE_Utils::truncate_cast (this->tv_.tv_sec); + me->ext_tv_.tv_usec = ACE_Utils::truncate_cast (this->tv_.tv_usec); + return this->ext_tv_; +#else + return this->tv_; +#endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ +} + +ACE_INLINE void +ACE_Time_Value::set (const timeval &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); + this->tv_.tv_sec = tv.tv_sec; + this->tv_.tv_usec = tv.tv_usec; + + this->normalize (); +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (const struct timeval &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (tv); +} + +ACE_INLINE +ACE_Time_Value::operator const timeval * () const +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *"); +#if defined (ACE_HAS_TIME_T_LONG_MISMATCH) + // Recall that on some Windows we substitute another type for timeval in tv_ + ACE_Time_Value *me = const_cast (this); + me->ext_tv_.tv_sec = ACE_Utils::truncate_cast (this->tv_.tv_sec); + me->ext_tv_.tv_usec = ACE_Utils::truncate_cast (this->tv_.tv_usec); + return (const timeval *) &this->ext_tv_; +#else + return (const timeval *) &this->tv_; +#endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ +} + +ACE_INLINE void +ACE_Time_Value::set (time_t sec, suseconds_t usec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); +# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) && defined (_MSC_VER) + // The WinCE 6.0 SDK ships with a timeval tv_sec member that uses long as type + // not time_t. This resolves in compilation warnings because time_t + // can be 64bit. Disable at this momemt the warning for just this method + // else we get a compile warnings each time this inline file is included + // this file. +# pragma warning (push) +# pragma warning (disable: 4244) +# endif + this->tv_.tv_sec = sec; +# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) && defined (_MSC_VER) +# pragma warning (pop) +# endif + this->tv_.tv_usec = usec; +#if __GNUC__ + if (__builtin_constant_p(sec) && + __builtin_constant_p(usec) && + (sec >= 0 && usec >= 0 && usec < ACE_ONE_SECOND_IN_USECS)) + return; +#endif + this->normalize (); +} + +ACE_INLINE void +ACE_Time_Value::set (double d) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); + long l = (long) d; + this->tv_.tv_sec = l; + this->tv_.tv_usec = (suseconds_t) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS + .5); + this->normalize (); +} + +/// Initializes a timespec_t. Note that this approach loses precision +/// since it converts the nano-seconds into micro-seconds. But then +/// again, do any real systems have nano-second timer precision?! +ACE_INLINE void +ACE_Time_Value::set (const timespec_t &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); + + this->set (tv.tv_sec, + tv.tv_nsec / 1000); // Convert nanoseconds into microseconds. +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (void) + // : tv_ () +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (0, 0); +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (time_t sec, suseconds_t usec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (sec, usec); +} + +/// Returns number of seconds. +ACE_INLINE time_t +ACE_Time_Value::sec (void) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::sec"); + return this->tv_.tv_sec; +} + +/// Sets the number of seconds. +ACE_INLINE void +ACE_Time_Value::sec (time_t sec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::sec"); + this->tv_.tv_sec = ACE_Utils::truncate_cast (sec); +} + +/// Converts from Time_Value format into milli-seconds format. +ACE_INLINE unsigned long +ACE_Time_Value::msec (void) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::msec"); + + // Note - we're truncating a value here, which can lose data. This is + // called out in the user documentation for this with a recommendation to + // use msec(ACE_UINT64&) instead, so just go ahead and truncate. + time_t secs = this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000; + return ACE_Utils::truncate_cast (secs); +} + +ACE_INLINE void +ACE_Time_Value::msec (ACE_UINT64 &ms) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::msec"); + ms = ACE_Utils::truncate_cast (this->tv_.tv_sec); + ms *= 1000; + ms += (this->tv_.tv_usec / 1000); +} + +ACE_INLINE void +ACE_Time_Value::msec (ACE_UINT64 &ms) /*const*/ +{ + // ACE_OS_TRACE ("ACE_Time_Value::msec"); + const ACE_Time_Value *tv = this; + tv->msec (ms); +} + +/// Converts from milli-seconds format into Time_Value format. +ACE_INLINE void +ACE_Time_Value::msec (long milliseconds) +{ + // ACE_OS_TRACE ("ACE_Time_Value::msec"); + // Convert millisecond units to seconds; + long secs = milliseconds / 1000; + this->tv_.tv_sec = secs; + // Convert remainder to microseconds; + this->tv_.tv_usec = (milliseconds - (secs * 1000)) * 1000; +} + +/// Converts from milli-seconds format into Time_Value format. +ACE_INLINE void +ACE_Time_Value::msec (int milliseconds) +{ + ACE_Time_Value::msec (static_cast (milliseconds)); +} + +/// Returns number of micro-seconds. +ACE_INLINE suseconds_t +ACE_Time_Value::usec (void) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::usec"); + return this->tv_.tv_usec; +} + +/// Sets the number of micro-seconds. +ACE_INLINE void +ACE_Time_Value::usec (suseconds_t usec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::usec"); + this->tv_.tv_usec = usec; +} + +ACE_INLINE void +ACE_Time_Value::to_usec (ACE_UINT64 & usec) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::to_usec"); + +#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + usec = ACE_U_LongLong (static_cast (this->tv_.tv_sec)); +#elif defined (ACE_LACKS_LONGLONG_T) + // No native 64-bit type, meaning time_t is most likely 32 bits. + usec = ACE_U_LongLong (this->tv_.tv_sec); +#else + usec = static_cast (this->tv_.tv_sec); +#endif /* ACE_LACKS_LONGLONG_T */ + usec *= 1000000; + usec += this->tv_.tv_usec; +} + +ACE_INLINE ACE_Time_Value +operator * (double d, const ACE_Time_Value &tv) +{ + return ACE_Time_Value (tv) *= d; +} + +ACE_INLINE ACE_Time_Value +operator * (const ACE_Time_Value &tv, double d) +{ + return ACE_Time_Value (tv) *= d; +} + +/// True if tv1 > tv2. +ACE_INLINE bool +operator > (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator >"); + if (tv1.sec () > tv2.sec ()) + return 1; + else if (tv1.sec () == tv2.sec () + && tv1.usec () > tv2.usec ()) + return 1; + else + return 0; +} + +/// True if tv1 >= tv2. +ACE_INLINE bool +operator >= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator >="); + if (tv1.sec () > tv2.sec ()) + return 1; + else if (tv1.sec () == tv2.sec () + && tv1.usec () >= tv2.usec ()) + return 1; + else + return 0; +} + +/// Returns the value of the object as a timespec_t. +ACE_INLINE +ACE_Time_Value::operator timespec_t () const +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator timespec_t"); + timespec_t tv; + tv.tv_sec = this->sec (); + // Convert microseconds into nanoseconds. + tv.tv_nsec = this->tv_.tv_usec * 1000; + return tv; +} + +/// Initializes the ACE_Time_Value object from a timespec_t. +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (const timespec_t &tv) + // : tv_ () +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (tv); +} + +/// True if tv1 < tv2. +ACE_INLINE bool +operator < (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator <"); + return tv2 > tv1; +} + +/// True if tv1 >= tv2. +ACE_INLINE bool +operator <= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator <="); + return tv2 >= tv1; +} + +/// True if tv1 == tv2. +ACE_INLINE bool +operator == (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator =="); + return tv1.sec () == tv2.sec () + && tv1.usec () == tv2.usec (); +} + +/// True if tv1 != tv2. +ACE_INLINE bool +operator != (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator !="); + return !(tv1 == tv2); +} + +/// Add TV to this. +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator+= (const ACE_Time_Value &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator+="); + this->sec (this->sec () + tv.sec ()); + this->usec (this->usec () + tv.usec ()); + this->normalize (); + return *this; +} + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator+= (time_t tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator+="); + this->sec (this->sec () + tv); + return *this; +} + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator= (const ACE_Time_Value &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator="); + this->sec (tv.sec ()); + this->usec (tv.usec ()); + return *this; +} + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator= (time_t tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator="); + this->sec (tv); + this->usec (0); + return *this; +} + +/// Subtract TV to this. +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator-= (const ACE_Time_Value &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator-="); + this->sec (this->sec () - tv.sec ()); + this->usec (this->usec () - tv.usec ()); + this->normalize (); + return *this; +} + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator-= (time_t tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator-="); + this->sec (this->sec () - tv); + return *this; +} + +/// Adds two ACE_Time_Value objects together, returns the sum. +ACE_INLINE ACE_Time_Value +operator + (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator +"); + ACE_Time_Value sum (tv1); + sum += tv2; + + return sum; +} + +/// Subtracts two ACE_Time_Value objects, returns the difference. +ACE_INLINE ACE_Time_Value +operator - (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator -"); + ACE_Time_Value delta (tv1); + delta -= tv2; + + return delta; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Timeprobe.cpp b/externals/ace/Timeprobe.cpp new file mode 100644 index 0000000..1fe8459 --- /dev/null +++ b/externals/ace/Timeprobe.cpp @@ -0,0 +1,15 @@ +// $Id: Timeprobe.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/config-all.h" + +ACE_RCSID(ace, Timeprobe, "$Id: Timeprobe.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if defined (ACE_COMPILE_TIMEPROBES) + +#include "ace/Timeprobe.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Timeprobe.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_COMPILE_TIMEPROBES */ diff --git a/externals/ace/Timeprobe.h b/externals/ace/Timeprobe.h new file mode 100644 index 0000000..ac2abe3 --- /dev/null +++ b/externals/ace/Timeprobe.h @@ -0,0 +1,201 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timeprobe.h + * + * $Id: Timeprobe.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Irfan Pyarali + * + * If users want to use time probes, the ACE_COMPILE_TIMEPROBES + * flag must be defined when compiling ACE. This can be achieved + * by doing one of the following: + * + * . Use make probe = 1, if you are using the make utility. + * + * . Define ACE_COMPILE_TIMEPROBES in config.h + * + * . Define ACE_COMPILE_TIMEPROBES in the VC project file. + * + * . Other regular methods will also work. + * + * It is not necessary to define ACE_COMPILE_TIMEPROBES when using + * time probes, you simply need ACE_ENABLE_TIMEPROBES. You can use + * the ACE_TIMEPROBE_* macros to program the time probes, and use + * the ACE_ENABLE_TIMEPROBE to enable the time probes. If you + * define ACE_ENABLE_TIMEPROBE in your code, but forget to compile + * ACE with ACE_COMPILE_TIMEPROBES, you will end up with linker + * errors. + * + * Remember that ACE_COMPILE_TIMEPROBES means that the ACE library + * will contain code for time probes. This is only useful when + * compiling ACE. ACE_ENABLE_TIMEPROBES means that the + * ACE_TIMEPROBE_* macros should spring to life. + */ +//============================================================================= + +#ifndef ACE_TIMEPROBE_H +#define ACE_TIMEPROBE_H +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" +#include /**/ "ace/ACE_export.h" +#include "ace/Malloc_Allocator.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/* Enable ACE Timeprobes */ +#if defined (ACE_ENABLE_TIMEPROBES) + #if !defined (ACE_COMPILE_TIMEPROBES) + #define ACE_COMPILE_TIMEPROBES + #endif /* ACE_COMPILE_TIMEPROBES */ +#endif /* ACE_ENABLE_TIMEPROBES */ + +#if defined (ACE_COMPILE_TIMEPROBES) + +#include "ace/OS_NS_time.h" +#include "ace/OS_NS_Thread.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Event_Descriptions + * + * @brief Event Descriptions. + */ +class ACE_Export ACE_Event_Descriptions +{ +public: + /// Event descriptions + const char **descriptions_; + + /// Minimum id of this description set + u_long minimum_id_; + + /// Comparison + bool operator== (const ACE_Event_Descriptions &rhs) const; +}; + +/** + * @class ACE_timeprobe_t + * + * @brief Time probe record. + */ +class ACE_Export ACE_timeprobe_t +{ +public: + /// Events are record as strings or numbers. + union event + { + u_long event_number_; + const char *event_description_; + }; + + /// Type of event. + enum event_type + { + NUMBER, + STRING + }; + + /// Event. + event event_; + + /// Type of event. + event_type event_type_; + + /// Timestamp. + ACE_hrtime_t time_; + + /// Id of thread posting the time probe. + ACE_thread_t thread_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Timeprobe.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Synch_Traits.h" +#include "ace/Null_Mutex.h" +#include "ace/Singleton.h" +#include "ace/Timeprobe_T.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// If ACE_MT_TIMEPROBES is defined, use a Thread_Mutex to lock the +// internal state of ACE_Timerprobe. This allows multiple threads to +// use the same ACE_Timerprobe. +# if defined (ACE_MT_TIMEPROBES) +typedef ACE_SYNCH_MUTEX ACE_TIMEPROBE_MUTEX; +# else /* ACE_MT_TIMEPROBES */ +typedef ACE_SYNCH_NULL_MUTEX ACE_TIMEPROBE_MUTEX; +# endif /* ACE_MT_TIMEPROBES */ + +typedef ACE_New_Allocator ACE_TIMEPROBE_ALLOCATOR; + +typedef ACE_Timeprobe_Ex + ACE_TIMEPROBE_WITH_LOCKING; + +// If ACE_TSS_TIMEPROBES is defined, store the ACE_Timeprobe singleton +// in thread specific storage. This allows multiple threads to use +// their own instance of ACE_Timerprobe, without interfering with each +// other. + +# if defined (ACE_TSS_TIMEPROBES) +# define ACE_TIMEPROBE_SINGLETON_TYPE ACE_TSS_Singleton +# define ACE_TIMEPROBE_SINGLETON_LOCK_TYPE ACE_SYNCH_NULL_MUTEX +# else /* ACE_TSS_TIMEPROBES */ +# define ACE_TIMEPROBE_SINGLETON_TYPE ACE_Singleton +# define ACE_TIMEPROBE_SINGLETON_LOCK_TYPE ACE_SYNCH_MUTEX +# endif /* ACE_TSS_TIMEPROBES */ + +ACE_SINGLETON_DECLARE (ACE_TIMEPROBE_SINGLETON_TYPE, \ + ACE_TIMEPROBE_WITH_LOCKING, \ + ACE_TIMEPROBE_SINGLETON_LOCK_TYPE) + +typedef ACE_TIMEPROBE_SINGLETON_TYPE + ACE_TIMEPROBE_SINGLETON; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_COMPILE_TIMEPROBES */ + +// If ACE_ENABLE_TIMEPROBES is defined, the macros below will +// work. Otherwise, they just vanish. Using this macro, you can +// control which files/libraries are probed. +#if defined (ACE_ENABLE_TIMEPROBES) && defined (ACE_COMPILE_TIMEPROBES) + +# define ACE_TIMEPROBE_RESET ACE_TIMEPROBE_SINGLETON::instance ()->reset () + +# define ACE_TIMEPROBE(id) ACE_TIMEPROBE_SINGLETON::instance ()->timeprobe (id) + +# define ACE_TIMEPROBE_PRINT ACE_TIMEPROBE_SINGLETON::instance ()->print_times () + +# define ACE_TIMEPROBE_PRINT_ABSOLUTE ACE_TIMEPROBE_SINGLETON::instance ()->print_absolute_times () + +# define ACE_TIMEPROBE_EVENT_DESCRIPTIONS(descriptions, minimum_id) \ +static int ace_timeprobe_##descriptions##_return = \ + ACE_TIMEPROBE_SINGLETON::instance ()->event_descriptions \ + (descriptions, minimum_id) + +# define ACE_FUNCTION_TIMEPROBE(X) \ + ACE_Function_Timeprobe function_timeprobe \ + (*ACE_TIMEPROBE_SINGLETON::instance (), X) + +#else /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */ + +# define ACE_TIMEPROBE_RESET +# define ACE_TIMEPROBE(id) +# define ACE_TIMEPROBE_PRINT +# define ACE_TIMEPROBE_PRINT_ABSOLUTE +# define ACE_TIMEPROBE_EVENT_DESCRIPTIONS(descriptions, minimum_id) +# define ACE_FUNCTION_TIMEPROBE(X) + +#endif /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */ +#include /**/ "ace/post.h" +#endif /* ACE_TIMEPROBE_H */ diff --git a/externals/ace/Timeprobe.inl b/externals/ace/Timeprobe.inl new file mode 100644 index 0000000..aa7a924 --- /dev/null +++ b/externals/ace/Timeprobe.inl @@ -0,0 +1,14 @@ +// -*- C++ -*- +// +// $Id: Timeprobe.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE bool +ACE_Event_Descriptions::operator== (const ACE_Event_Descriptions &rhs) const +{ + return this->minimum_id_ == rhs.minimum_id_ && + this->descriptions_ == rhs.descriptions_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Timeprobe_T.cpp b/externals/ace/Timeprobe_T.cpp new file mode 100644 index 0000000..d23b7b8 --- /dev/null +++ b/externals/ace/Timeprobe_T.cpp @@ -0,0 +1,427 @@ +// $Id: Timeprobe_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TIMEPROBE_T_CPP +#define ACE_TIMEPROBE_T_CPP + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_COMPILE_TIMEPROBES) + +#include "ace/Timeprobe.h" +#include "ace/High_Res_Timer.h" +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Timeprobe_Ex::ACE_Timeprobe_Ex (u_long size) + : timeprobes_ (0), + lock_ (), + max_size_ (size), + current_size_ (0), + report_buffer_full_ (0), + allocator_ (0) +{ + ACE_timeprobe_t *temp; + //FUZZ: disable check_for_lack_ACE_OS + ACE_NEW_MALLOC_ARRAY (temp, + (ACE_timeprobe_t *) this->allocator ()-> + malloc (this->max_size_*sizeof(ACE_timeprobe_t)), + ACE_timeprobe_t, + this->max_size_); + //FUZZ: enable check_for_lack_ACE_OS + this->timeprobes_ = temp; + +} + +template +ACE_Timeprobe_Ex:: +ACE_Timeprobe_Ex (ALLOCATOR *allocator, + u_long size) + : timeprobes_ (0), + lock_ (), + max_size_ (size), + current_size_ (0), + report_buffer_full_ (0), + allocator_ (allocator) +{ + ACE_timeprobe_t *temp = 0; + //FUZZ: disable check_for_lack_ACE_OS + ACE_NEW_MALLOC_ARRAY (temp, + (ACE_timeprobe_t *) this->allocator ()-> + malloc (this->max_size_*sizeof(ACE_timeprobe_t)), + ACE_timeprobe_t, + this->max_size_); + //FUZZ: enable check_for_lack_ACE_OS + this->timeprobes_ = temp; + +} + +template +ACE_Timeprobe_Ex::ACE_Timeprobe_Ex (const ACE_Timeprobe_Ex &) +{ + // + // Stupid MSVC is forcing me to define this; please don't use it. + // + + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_NOTSUP: %N, line %l\n"))); + errno = ENOTSUP; +} + +template +ACE_Timeprobe_Ex::~ACE_Timeprobe_Ex (void) +{ + ACE_DES_ARRAY_FREE ((ACE_timeprobe_t *) (this->timeprobes_), + this->max_size_, + this->allocator ()->free, + ACE_timeprobe_t); +} + +template void +ACE_Timeprobe_Ex::timeprobe (u_long event) +{ + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + this->timeprobes_[this->current_size_].event_.event_number_ = event; + this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::NUMBER; + this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime (); + this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self (); + + ++this->current_size_; + +#if !defined (ACE_TIMEPROBE_ASSERTS_FIXED_SIZE) + // wrap around to the beginning on overflow + if (this->current_size_ >= this->max_size_) + { + this->current_size_ = 0; + this->report_buffer_full_ = 1; + } +#endif /* ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */ + + ACE_ASSERT (this->current_size_ < this->max_size_); +} + +template void +ACE_Timeprobe_Ex::timeprobe (const char *event) +{ + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + this->timeprobes_[this->current_size_].event_.event_description_ = event; + this->timeprobes_[this->current_size_].event_type_ = ACE_timeprobe_t::STRING; + this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime (); + this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self (); + + ++this->current_size_; + +#if !defined (ACE_TIMEPROBE_ASSERTS_FIXED_SIZE) + // wrap around to the beginning on overflow + if (this->current_size_ >= this->max_size_) + { + this->current_size_ = 0; + this->report_buffer_full_ = 1; + } +#endif /* ACE_TIMEPROBE_ASSERTS_FIXED_SIZE */ + + ACE_ASSERT (this->current_size_ < this->max_size_); +} + +template void +ACE_Timeprobe_Ex::reset (void) +{ + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + this->current_size_ = 0; + this->report_buffer_full_ = 0; +} + +template void +ACE_Timeprobe_Ex::increase_size (u_long size) +{ + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + if (size > this->max_size_) + { + ACE_timeprobe_t *temp = 0; + //FUZZ: disable check_for_lack_ACE_OS + ACE_NEW_MALLOC_ARRAY (temp, + (ACE_timeprobe_t *) this->allocator ()-> + malloc (this->max_size_ + * sizeof (ACE_timeprobe_t)), + ACE_timeprobe_t, + size); + //FUZZ: enable check_for_lack_ACE_OS + + if (this->max_size_ > 0) + { + ACE_OS::memcpy (temp, + this->timeprobes_, + this->max_size_ * sizeof (ACE_timeprobe_t)); + + // Iterates over the array explicitly calling the destructor for + // each probe instance, then deallocates the memory + + ACE_DES_ARRAY_FREE ((ACE_timeprobe_t *)(this->timeprobes_), + this->max_size_, + this->allocator ()->free, + ACE_timeprobe_t); + } + this->timeprobes_ = temp; + this->max_size_ = size; + } +} + +template ACE_Unbounded_Set & +ACE_Timeprobe_Ex::event_descriptions (void) +{ + return this->event_descriptions_; +} + +template ACE_Unbounded_Set & +ACE_Timeprobe_Ex::sorted_event_descriptions (void) +{ + return this->sorted_event_descriptions_; +} + +template ACE_timeprobe_t * +ACE_Timeprobe_Ex::timeprobes (void) +{ + return this->timeprobes_; +} + +template ACE_LOCK & +ACE_Timeprobe_Ex::lock (void) +{ + return this->lock_; +} + +template u_long +ACE_Timeprobe_Ex::max_size (void) +{ + return this->max_size_; +} + +template u_long +ACE_Timeprobe_Ex::current_size (void) +{ + return this->current_size_; +} + +template int +ACE_Timeprobe_Ex::event_descriptions (const char **descriptions, + u_long minimum_id) +{ + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + ACE_Event_Descriptions events; + events.descriptions_ = descriptions; + events.minimum_id_ = minimum_id; + + this->event_descriptions_.insert (events); + + return 0; +} + +template void +ACE_Timeprobe_Ex::print_times (void) +{ + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + // Sort the event descriptions + this->sort_event_descriptions_i (); + + u_long size = this->report_buffer_full_ ? this->max_size_ + : this->current_size_; + + ACE_DEBUG ((LM_DEBUG, + "\nACE_Timeprobe_Ex; %u timestamps were recorded:\n", + size)); + + if (size == 0) + return; + + ACE_DEBUG ((LM_DEBUG, + "\n%-50.50s %8.8s %13.13s\n\n", + "Event", + "thread", + "usec")); + + double gsf = ACE_High_Res_Timer::global_scale_factor (); + u_long i, j; + + // First element + i = this->report_buffer_full_ ? this->current_size_ : 0; + + ACE_DEBUG ((LM_DEBUG, + "%-50.50s %8.8x %13.13s\n", + this->find_description_i (i), + this->timeprobes_[i].thread_, + "START")); + + if (size == 1) + return; + + bool has_timestamp_inversion = false; + + j = i; + i = (i + 1) % this->max_size_; + + do + { + // When reusing the same ACE_Timeprobe from multiple threads + // with Linux on Intel SMP, it sometimes happens that the + // recorded times go backward in time if they are recorded from + // different threads (see bugzilla #2342). To obtain the + // correct signed difference between consecutive recorded times, + // one has to cast the time difference to an intermediate signed + // integral type of the same size as ACE_hrtime_t. + + double time_difference = + (ACE_INT64) (this->timeprobes_[i].time_ - this->timeprobes_[j].time_); + + if (time_difference < 0) + has_timestamp_inversion = true; + + // Convert to microseconds. + time_difference /= gsf; + + ACE_DEBUG ((LM_DEBUG, + "%-50.50s %8.8x %14.3f\n", + this->find_description_i (i), + this->timeprobes_[i].thread_, + time_difference)); + + j = i; + i = (i + 1) % this->max_size_; + } + while (i != this->current_size_); + + static bool inversion_warning_printed = false; + if (!inversion_warning_printed && has_timestamp_inversion) + { + inversion_warning_printed = true; + ACE_DEBUG ((LM_DEBUG, + "\nWARNING: The timestamps recorded by gethrtime() on" + " this platform are\n" + "not monotonic across different threads.\n")); + } +} + +template void +ACE_Timeprobe_Ex::print_absolute_times (void) +{ + ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + // Sort the event descriptions + this->sort_event_descriptions_i (); + + u_long size = this->report_buffer_full_ ? this->max_size_ + : this->current_size_; + + ACE_DEBUG ((LM_DEBUG, + "\nACE_Timeprobe_Ex; %u timestamps were recorded:\n", + size)); + + if (size == 0) + return; + + ACE_DEBUG ((LM_DEBUG, + "\n%-50.50s %8.8s %13.13s\n\n", + "Event", + "thread", + "stamp")); + + u_long i = this->report_buffer_full_ ? this->current_size_ : 0; + + ACE_Time_Value tv; // to convert ACE_hrtime_t + do + { + ACE_High_Res_Timer::hrtime_to_tv (tv, this->timeprobes_ [i].time_); + + ACE_DEBUG ((LM_DEBUG, + "%-50.50s %8.8x %12.12u\n", + this->find_description_i (i), + this->timeprobes_ [i].thread_, + tv.sec () * 1000000 + + tv.usec ())); + + // Modulus increment: loops around at the end. + i = (i + 1) % this->max_size_; + } + while (i != this->current_size_); +} + +template const char * +ACE_Timeprobe_Ex::find_description_i (u_long i) +{ + if (this->timeprobes_[i].event_type_ == ACE_timeprobe_t::STRING) + return this->timeprobes_[i].event_.event_description_; + else + { + EVENT_DESCRIPTIONS::iterator iterator = this->sorted_event_descriptions_.begin (); + for (u_long j = 0; + j < this->sorted_event_descriptions_.size () - 1; + iterator++, j++) + { + EVENT_DESCRIPTIONS::iterator next_event_descriptions = iterator; + ++next_event_descriptions; + + if (this->timeprobes_[i].event_.event_number_ < (*next_event_descriptions).minimum_id_) + break; + } + return (*iterator).descriptions_[this->timeprobes_[i].event_.event_number_ - (*iterator).minimum_id_]; + } +} + +template void +ACE_Timeprobe_Ex::sort_event_descriptions_i (void) +{ + size_t total_elements = this->event_descriptions_.size (); + + for (size_t i = 0; + i < total_elements; + i++) + { + EVENT_DESCRIPTIONS::iterator iterator = this->event_descriptions_.begin (); + ACE_Event_Descriptions min_entry = *iterator; + + for (; + iterator != this->event_descriptions_.end (); + iterator++) + if ((*iterator).minimum_id_ < min_entry.minimum_id_) + min_entry = *iterator; + + this->sorted_event_descriptions_.insert (min_entry); + this->event_descriptions_.remove (min_entry); + } +} + +template ALLOCATOR * +ACE_Timeprobe_Ex::allocator (void) +{ + return allocator_ ? allocator_ : ACE_Singleton::instance (); +} + +template +ACE_Function_Timeprobe::ACE_Function_Timeprobe (Timeprobe &timeprobe, + u_long event) + : timeprobe_ (timeprobe), + event_ (event) +{ + this->timeprobe_.timeprobe (this->event_); +} + +template +ACE_Function_Timeprobe::~ACE_Function_Timeprobe (void) +{ + this->timeprobe_.timeprobe (this->event_ + 1); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_COMPILE_TIMEPROBES */ +#endif /* ACE_TIMEPROBE_T_CPP */ diff --git a/externals/ace/Timeprobe_T.h b/externals/ace/Timeprobe_T.h new file mode 100644 index 0000000..54e5ff4 --- /dev/null +++ b/externals/ace/Timeprobe_T.h @@ -0,0 +1,220 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timeprobe_T.h + * + * $Id: Timeprobe_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Irfan Pyarali + */ +//============================================================================= + + +#ifndef ACE_TIMEPROBE_T_H +#define ACE_TIMEPROBE_T_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_COMPILE_TIMEPROBES) + +#include "ace/Unbounded_Set.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Timeprobe_Ex + * + * @brief This class is used to instrument code. This is accomplished + * by inserting time probes at different location in the code. + * ACE_Timeprobe then measures the time difference between two + * time probes. + * + * This class provides a lightweight implementation for + * measuring the time required to execute code between two time + * probes. When a time probe executes, it records the time, the + * id of the calling thread, and an event description. The + * event description can either be an unsigned long or a string + * (char *). If string are used, care must be taken cause only + * pointer copies are done and the string data is *not* copied. + * The recorded time probes can then be printed by calling + * . If you have used unsigned longs as event + * descriptions in any of your time probes, you must have + * provided an event description table that maps the unsigned + * longs to readable strings. This map is a simple array of + * strings, and the event number is used as the index into the + * array when looking for the event description. If you have + * only used strings for the event description, this map is not + * necessary. + * Multiple maps can also be used to chunk up the time probes. + * Each one can be added by calling . + * Different tables are used internally by consulting the + * minimum_id for each table. It is up to the user to make sure + * that multiple tables do not share the same event id range. + */ +template +class ACE_Timeprobe_Ex +{ +public: + + /// Self + typedef ACE_Timeprobe_Ex + SELF; + + /** + * ACE_Timeprobe + */ + typedef ACE_Timeprobe_Ex ACE_Timeprobe; + + + /// We can hold multiple event description tables. + typedef ACE_Unbounded_Set + EVENT_DESCRIPTIONS; + + /// Create Timeprobes with @a size slots + ACE_Timeprobe_Ex (u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE); + + /// Create Timeprobes with @a size slots + ACE_Timeprobe_Ex (ALLOCATOR *allocator, + u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE); + /// Destructor. + ~ACE_Timeprobe_Ex (void); + + /// Record a time. @a event is used to describe this time probe. + void timeprobe (u_long event); + + /// Record a time. @a id is used to describe this time probe. + void timeprobe (const char *id); + + /// Record event descriptions. + int event_descriptions (const char **descriptions, + u_long minimum_id); + + /// Print the time probes. + void print_times (void); + + /// Print the time probes. + void print_absolute_times (void); + + /// Reset the slots. All old time probes will be lost. + void reset (void); + + void increase_size (u_long size); + + /// Not implemented (stupid MSVC won't let it be protected). + ACE_Timeprobe_Ex (const ACE_Timeprobe_Ex &); + + // = (Somewhat private) Accessors + + /// Event Descriptions + ACE_Unbounded_Set &event_descriptions (void); + + /// Sorted Event Descriptions. + ACE_Unbounded_Set &sorted_event_descriptions (void); + + /// Find description of event @a i + const char *find_description_i (u_long i); + + /// Sort event descriptions + void sort_event_descriptions_i (void); + + /// Time probe slots + ACE_timeprobe_t *timeprobes (void); + + /// Synchronization variable. + ACE_LOCK &lock (void); + + /// Max size of timestamp table + u_long max_size (void); + + /// Current size of timestamp table + u_long current_size (void); + +protected: + + /// Obtain an allocator pointer. If there is no allocator stored in + /// the instance, the singleton allocator in the current process is used. + ALLOCATOR * allocator (void); + + /// Event Descriptions + EVENT_DESCRIPTIONS event_descriptions_; + + /// Sorted Event Descriptions. + EVENT_DESCRIPTIONS sorted_event_descriptions_; + + /// Time probe slots + ACE_timeprobe_t *timeprobes_; + + /// Synchronization variable. + ACE_LOCK lock_; + + /// Max size of timestamp table + u_long max_size_; + + /// Current size of timestamp table + u_long current_size_; + + /// Flag indicating the report buffer has filled up, and is now + /// acting as a ring-buffer using modulus arithmetic: this saves the + /// max_size_ most recent time stamps and loses earlier ones until + /// drained. + u_short report_buffer_full_; + +private: + ALLOCATOR * allocator_; +}; + +// template +// class ACE_Timeprobe : public ACE_Timeprobe_Ex +// { +// public: +// // Initialize a ACE_Timeprobe with default size +// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance()); + +// /// Create Timeprobes with @a size slots +// ACE_Timeprobe (ACE_Allocator *allocator = ACE_Allocator::instance(), +// u_long size = ACE_DEFAULT_TIMEPROBE_TABLE_SIZE); +// }; + +/** + * @class ACE_Function_Timeprobe + * + * @brief Auto pointer like time probes. It will record on + * construction and on destruction. + */ +template +class ACE_Function_Timeprobe +{ +public: + /// Constructor. + ACE_Function_Timeprobe (Timeprobe &timeprobe, u_long event); + + /// Destructor. + ~ACE_Function_Timeprobe (void); + +protected: + /// Reference to timeprobe. + Timeprobe &timeprobe_; + + /// Event. + u_long event_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Timeprobe_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Timeprobe_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_COMPILE_TIMEPROBES */ +#include /**/ "ace/post.h" +#endif /* ACE_TIMEPROBE_T_H */ diff --git a/externals/ace/Timer_Hash.h b/externals/ace/Timer_Hash.h new file mode 100644 index 0000000..b381419 --- /dev/null +++ b/externals/ace/Timer_Hash.h @@ -0,0 +1,75 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Timer_Hash.h + * + * $Id: Timer_Hash.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Darrell Brunsch + */ +//============================================================================= + + +#ifndef ACE_TIMER_HASH_H +#define ACE_TIMER_HASH_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_Hash_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Timer_Heap_T.h" +#include "ace/Timer_List_T.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedef are here for ease of use + +typedef ACE_Timer_Hash_Upcall , + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Hash_Upcall; + +typedef ACE_Timer_List_T + ACE_Hash_Timer_List; + +typedef ACE_Timer_Heap_T + ACE_Hash_Timer_Heap; + + +typedef ACE_Timer_Hash_T, + ACE_SYNCH_RECURSIVE_MUTEX, + ACE_Hash_Timer_List> + + ACE_Timer_Hash; + +typedef ACE_Timer_Hash_Iterator_T, + ACE_SYNCH_RECURSIVE_MUTEX, + ACE_Hash_Timer_List> + ACE_Timer_Hash_Iterator; + +typedef ACE_Timer_Hash_T, + ACE_SYNCH_RECURSIVE_MUTEX, + ACE_Hash_Timer_Heap> + ACE_Timer_Hash_Heap; + +typedef ACE_Timer_Hash_Iterator_T, + ACE_SYNCH_RECURSIVE_MUTEX, + ACE_Hash_Timer_Heap> + ACE_Timer_Hash_Heap_Iterator; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_HASH_H */ diff --git a/externals/ace/Timer_Hash_T.cpp b/externals/ace/Timer_Hash_T.cpp new file mode 100644 index 0000000..d8153c1 --- /dev/null +++ b/externals/ace/Timer_Hash_T.cpp @@ -0,0 +1,870 @@ +// $Id: Timer_Hash_T.cpp 89254 2010-02-25 22:10:39Z cleeland $ + +#ifndef ACE_TIMER_HASH_T_CPP +#define ACE_TIMER_HASH_T_CPP + +#include "ace/Timer_Hash_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_sys_time.h" +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(ace, + Timer_Hash_T, + "$Id: Timer_Hash_T.cpp 89254 2010-02-25 22:10:39Z cleeland $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +class Hash_Token +{ +public: + // This constructor is required by ACE_Locked_Free_List::alloc. + Hash_Token (void) + {} + + Hash_Token *get_next (void) + { + return this->next_; + } + + void set_next (Hash_Token *next) + { + this->next_ = next; + } + + void set (const void *act, + size_t pos, + long orig_id, + const TYPE &type) + { + this->act_ = act; + this->pos_ = pos; + this->orig_id_ = orig_id; + this->type_ = type; + this->next_ = 0; + } + + const void *act_; + size_t pos_; + long orig_id_; + TYPE type_; + /// Pointer to next token. + Hash_Token *next_; +}; + +// Default constructor + +template +ACE_Timer_Hash_Upcall::ACE_Timer_Hash_Upcall (void) + : timer_hash_ (0) +{ + // Nothing +} + +// Constructor that specifies a Timer_Hash to call up to + +template +ACE_Timer_Hash_Upcall::ACE_Timer_Hash_Upcall ( + ACE_Timer_Queue_T *timer_hash) + : timer_hash_ (timer_hash) +{ + // Nothing +} + +template int +ACE_Timer_Hash_Upcall::registration ( + TIMER_QUEUE &, + ACE_Event_Handler *, + const void *) +{ + // Registration will be handled by the upcall functor of the timer + // hash. + return 0; +} + +template int +ACE_Timer_Hash_Upcall::preinvoke (TIMER_QUEUE &, + ACE_Event_Handler *, + const void *, + int, + const ACE_Time_Value &, + const void *&) +{ + // This method should never be invoked since we don't invoke + // expire() on the buckets. + ACE_ASSERT (0); + return 0; +} + +template int +ACE_Timer_Hash_Upcall::postinvoke ( + TIMER_QUEUE &, + ACE_Event_Handler *, + const void *, + int, + const ACE_Time_Value &, + const void *) +{ + // This method should never be invoked since we don't invoke + // expire() on the buckets. + ACE_ASSERT (0); + return 0; +} + +// Calls up to timer_hash's upcall functor +template int +ACE_Timer_Hash_Upcall::timeout ( + TIMER_QUEUE &, + ACE_Event_Handler *, + const void *, + int, + const ACE_Time_Value &) +{ + // This method should never be invoked since we don't invoke + // expire() on the buckets. + ACE_ASSERT (0); + return 0; +} + +template int +ACE_Timer_Hash_Upcall::cancel_type ( + TIMER_QUEUE &, + ACE_Event_Handler *, + int, + int &) +{ + // Cancellation will be handled by the upcall functor of the timer + // hash. + return 0; +} + +template int +ACE_Timer_Hash_Upcall::cancel_timer ( + TIMER_QUEUE &, + ACE_Event_Handler *, + int, + int) +{ + // Cancellation will be handled by the upcall functor of the timer + // hash. + return 0; +} + +template int +ACE_Timer_Hash_Upcall::deletion ( + TIMER_QUEUE &, + ACE_Event_Handler *event_handler, + const void *arg) +{ + // Call up to the upcall functor of the timer hash since the timer + // hash does not invoke deletion() on its upcall functor directly. + Hash_Token *h = + reinterpret_cast *> (const_cast (arg)); + + int result = + this->timer_hash_->upcall_functor (). + deletion (*this->timer_hash_, + event_handler, + h->act_); + + return result; +} + +template +ACE_Timer_Hash_Iterator_T::ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T &hash) + : timer_hash_ (hash) +{ + this->first (); + // Nothing +} + +// Positions the iterator at the first node in the timing hash table + +template void +ACE_Timer_Hash_Iterator_T::first (void) +{ + for (this->position_ = 0; + this->position_ < this->timer_hash_.table_size_; + ++this->position_) + { + // Check for an empty entry + if (!this->timer_hash_.table_[this->position_]->is_empty ()) + { + this->iter_ = &this->timer_hash_.table_[this->position_]->iter (); + this->iter_->first (); + return; + } + } + + // Didn't find any + this->iter_ = 0; +} + +// Positions the iterator at the next node in the bucket or goes to the next +// bucket + +template void +ACE_Timer_Hash_Iterator_T::next (void) +{ + if (this->isdone ()) + return; + + // If there is no more in the current bucket, go to the next + if (this->iter_->isdone ()) + { + for (++this->position_; + this->position_ < this->timer_hash_.table_size_; + ++this->position_) + { + // Check for an empty entry + if (!this->timer_hash_.table_[this->position_]->is_empty ()) + { + this->iter_ = &this->timer_hash_.table_[this->position_]->iter (); + this->iter_->first (); + return; + } + } + + // Didn't find any. + this->iter_ = 0; + } + else + this->iter_->next (); +} + +// Returns true when we are at the end (when bucket_item_ == 0) + +template bool +ACE_Timer_Hash_Iterator_T::isdone (void) const +{ + return this->iter_ == 0; +} + +// Returns the node at the current position in the sequence + +template +ACE_Timer_Node_T * +ACE_Timer_Hash_Iterator_T::item (void) +{ + if (this->isdone ()) + return 0; + + return this->iter_->item (); +} + +template +ACE_Timer_Queue_Iterator_T & +ACE_Timer_Hash_T::iter (void) +{ + this->iterator_->first (); + return *this->iterator_; +} + +// Create an empty queue. + +template +ACE_Timer_Hash_T::ACE_Timer_Hash_T ( + size_t table_size, + FUNCTOR *upcall_functor, + ACE_Free_List > *freelist) + : ACE_Timer_Queue_T (upcall_functor, freelist), + size_ (0), + table_size_ (table_size), + table_functor_ (this), + earliest_position_ (0) +#if defined (ACE_WIN64) + , pointer_base_ (0) +#endif /* ACE_WIN64 */ + , token_list_ () +{ + ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); + + ACE_NEW (table_, + BUCKET *[table_size]); + + this->gettimeofday (ACE_OS::gettimeofday); + + for (size_t i = 0; + i < table_size; + ++i) + { + ACE_NEW (this->table_[i], + BUCKET (&this->table_functor_, + this->free_list_)); + this->table_[i]->gettimeofday (ACE_OS::gettimeofday); + } + + ACE_NEW (iterator_, + HASH_ITERATOR (*this)); +} + + +template +ACE_Timer_Hash_T::ACE_Timer_Hash_T ( + FUNCTOR *upcall_functor, + ACE_Free_List > *freelist) + : ACE_Timer_Queue_T (upcall_functor, freelist), + size_ (0), + table_size_ (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE), + table_functor_ (this), + earliest_position_ (0) +#if defined (ACE_WIN64) + , pointer_base_ (0) +#endif /* ACE_WIN64 */ + , token_list_ () +{ + ACE_TRACE ("ACE_Timer_Hash_T::ACE_Timer_Hash_T"); + + ACE_NEW (table_, + BUCKET *[ACE_DEFAULT_TIMER_HASH_TABLE_SIZE]); + + + this->gettimeofday (ACE_OS::gettimeofday); + + for (size_t i = 0; + i < this->table_size_; + ++i) + { + ACE_NEW (this->table_[i], + BUCKET (&this->table_functor_, + this->free_list_)); + this->table_[i]->gettimeofday (ACE_OS::gettimeofday); + } + + ACE_NEW (iterator_, + HASH_ITERATOR (*this)); +} + +// Remove all remaining items in the Queue. + +template +ACE_Timer_Hash_T::~ACE_Timer_Hash_T (void) +{ + ACE_TRACE ("ACE_Timer_Hash_T::~ACE_Timer_Hash_T"); + ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); + + delete iterator_; + + for (size_t i = 0; + i < this->table_size_; + ++i) + delete this->table_[i]; + + delete [] this->table_; +} + +// Checks if queue is empty. + +template bool +ACE_Timer_Hash_T::is_empty (void) const +{ + ACE_TRACE ("ACE_Timer_Hash_T::is_empty"); + return this->table_[this->earliest_position_]->is_empty (); +} + +// Returns earliest time in a non-empty bucket + +template +const ACE_Time_Value & +ACE_Timer_Hash_T::earliest_time (void) const +{ + ACE_TRACE ("ACE_Timer_Hash_T::earliest_time"); + return this->table_[this->earliest_position_]->earliest_time (); +} + +template void +ACE_Timer_Hash_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Timer_Hash_T::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntable_size_ = %d"), this->table_size_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nearliest_position_ = %d"), this->earliest_position_)); + + for (size_t i = 0; i < this->table_size_; ++i) + if (!this->table_[i]->is_empty ()) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nBucket %d contains nodes"), i)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// Reschedule a periodic timer. This function must be called with the +// mutex lock held. + +template +void +ACE_Timer_Hash_T::reschedule ( + ACE_Timer_Node_T *expired) +{ + ACE_TRACE ("ACE_Timer_Hash_T::reschedule"); + + Hash_Token *h = + reinterpret_cast *> ( + const_cast (expired->get_act ())); + + // Don't use ACE_Utils::truncate_cast<> here. A straight + // static_cast<> will provide more unique results when the number + // of seconds is greater than std::numeric_limits::max(). + size_t const secs_hash_input = + static_cast (expired->get_timer_value ().sec ()); + h->pos_ = secs_hash_input % this->table_size_; + + h->orig_id_ = + this->table_[h->pos_]->schedule (expired->get_type (), + h, + expired->get_timer_value (), + expired->get_interval ()); + ACE_ASSERT (h->orig_id_ != -1); + +#if 0 + ACE_DEBUG ((LM_DEBUG, "Hash::reschedule() resets %d in slot %d where it's id is %d and token is %x\n", + expired->get_timer_value ().msec (), + h->pos_, + h->orig_id_, + h)); +#endif + + // Since schedule() above will allocate a new node + // then here schedule for deletion. Don't call + // this->free_node() because that will invalidate + // and that's what user have as timer_id. + ACE_Timer_Queue_T::free_node (expired); + + if (this->table_[this->earliest_position_]->is_empty () + || this->table_[h->pos_]->earliest_time () + < this->table_[this->earliest_position_]->earliest_time ()) + this->earliest_position_ = h->pos_; +} + +// Insert a new handler that expires at time future_time; if interval +// is > 0, the handler will be reinvoked periodically. + +template +long +ACE_Timer_Hash_T::schedule_i ( + const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_Timer_Hash_T::schedule_i"); + + // Don't use ACE_Utils::truncate_cast<> here. A straight + // static_cast<> will provide more unique results when the number + // of seconds is greater than std::numeric_limits::max(). + size_t const secs_hash_input = static_cast (future_time.sec ()); + size_t const position = secs_hash_input % this->table_size_; + + // Don't create Hash_Token directly. Instead we get one from Free_List + // and then set it properly. + Hash_Token *h = this->token_list_.remove (); + h->set (act, position, 0, type); + + h->orig_id_ = + this->table_[position]->schedule (type, + h, + future_time, + interval); + ACE_ASSERT (h->orig_id_ != -1); + +#if 0 + ACE_DEBUG ((LM_DEBUG, "Hash::schedule() placing %d in slot %d where it's id is %d and token is %x\n", + future_time.msec (), + position, + h->orig_id_, + h)); +#endif + + if (this->table_[this->earliest_position_]->is_empty () + || this->table_[position]->earliest_time () + < this->table_[this->earliest_position_]->earliest_time ()) + this->earliest_position_ = position; + + ++this->size_; + +#if defined (ACE_WIN64) + // This is a Win64 hack, necessary because of the original (bad) decision + // to use a pointer as the timer ID. This class doesn't follow the usual + // timer expiration rules (see comments in header file) and is probably + // not used much. The dynamic allocation of Hash_Tokens without + // recording them anywhere is a large problem for Win64 since the + // size of a pointer is 64 bits, but a long is 32. Since this class + // is not much used, I'm hacking this, at least for now. If it becomes + // an issue, I'll look at it again then. + intptr_t hi = reinterpret_cast (h); + if (this->pointer_base_ == 0) + this->pointer_base_ = hi & 0xffffffff00000000; + return static_cast (hi & 0xffffffff); +#else + return reinterpret_cast (h); +#endif +} + +// Locate and update the inteval on the timer_id + +template +int +ACE_Timer_Hash_T::reset_interval ( + long timer_id, + const ACE_Time_Value & interval) +{ + ACE_TRACE ("ACE_Timer_Hash_T::reset_interval"); + + // Make sure we are getting a valid , not an error + // returned by . + if (timer_id == -1) + return -1; + +#if defined (ACE_WIN64) + unsigned long const timer_offset = + static_cast (timer_id); + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + Hash_Token * const h = + reinterpret_cast *> (this->pointer_base_ + timer_offset); +#else + Hash_Token * const h = + reinterpret_cast *> (timer_id); + + // Grab the lock before accessing the table. We don't need to do so + // before this point since no members are accessed until now. + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); +#endif /* ACE_WIN64 */ + + return this->table_[h->pos_]->reset_interval (h->orig_id_, + interval); +} + +// Locate and remove the single with a value of +// @a timer_id from the correct table timer queue. + +template +int +ACE_Timer_Hash_T::cancel (long timer_id, + const void **act, + int dont_call) +{ + ACE_TRACE ("ACE_Timer_Hash_T::cancel"); + + // Make sure we are getting a valid , not an error + // returned by . + if (timer_id == -1) + return 0; + +#if defined (ACE_WIN64) + unsigned long const timer_offset = + static_cast (timer_id); + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + Hash_Token * const h = + reinterpret_cast *> (this->pointer_base_ + timer_offset); +#else + Hash_Token * const h = + reinterpret_cast *> (timer_id); + + // Grab the lock before accessing the table. We don't need to do so + // before this point since no members are accessed until now. + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); +#endif /* ACE_WIN64 */ + + int const result = this->table_[h->pos_]->cancel (h->orig_id_, + 0, + dont_call); + + if (result == 1) + { + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + h->type_, + dont_call, + cookie); + + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + h->type_, + dont_call, + cookie); + + if (h->pos_ == this->earliest_position_) + this->find_new_earliest (); + + if (act != 0) + *act = h->act_; + + // We could destruct Hash_Token explicitly but we better + // schedule it for destruction. In this case next + // token_list_.remove () will use it. + this->token_list_.add (h); + + --this->size_; + } + + return result; +} + +// Locate and remove all values of from the timer queue. + +template +int +ACE_Timer_Hash_T::cancel (const TYPE &type, + int dont_call) +{ + ACE_TRACE ("ACE_Timer_Hash_T::cancel"); + + size_t i; // loop variable. + + Hash_Token **timer_ids = 0; + size_t pos = 0; + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + ACE_NEW_RETURN (timer_ids, + Hash_Token *[this->size_], + -1); + + for (i = 0; + i < this->table_size_; + ++i) + { + ACE_Timer_Queue_Iterator_T, + ACE_Null_Mutex> &iter = + this->table_[i]->iter (); + + for (iter.first (); + !iter.isdone (); + iter.next ()) + if (iter.item ()->get_type () == type) + timer_ids[pos++] = + reinterpret_cast *> ( + const_cast (iter.item ()->get_act ())); + } + + if (pos > this->size_) + return -1; + + for (i = 0; i < pos; ++i) + { + int const result = + this->table_[timer_ids[i]->pos_]->cancel (timer_ids[i]->orig_id_, + 0, + dont_call); + ACE_ASSERT (result == 1); + ACE_UNUSED_ARG (result); + + // We could destruct Hash_Token explicitly but we better + // schedule it for destruction. + this->token_list_.add (timer_ids[i]); + + --this->size_; + } + + delete [] timer_ids; + + this->find_new_earliest (); + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + type, + dont_call, + cookie); + + for (i = 0; + i < pos; + ++i) + { + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + type, + dont_call, + cookie); + } + + return static_cast (pos); +} + +// Removes the earliest node and finds the new earliest position + +template ACE_Timer_Node_T * +ACE_Timer_Hash_T::remove_first (void) +{ + if (this->is_empty ()) + return 0; + + ACE_Timer_Node_T *temp = + this->table_[this->earliest_position_]->remove_first (); + + this->find_new_earliest (); + + --this->size_; + + return temp; +} + +// Finds a new earliest position + +template void +ACE_Timer_Hash_T::find_new_earliest (void) +{ + for (size_t i = 0; i < this->table_size_; ++i) + if (!this->table_[i]->is_empty ()) + if (this->table_[this->earliest_position_]->is_empty () + || this->earliest_time () == ACE_Time_Value::zero + || this->table_[i]->earliest_time () <= this->earliest_time ()) + this->earliest_position_ = i; +} + +// Returns the earliest node without removing it + +template ACE_Timer_Node_T * +ACE_Timer_Hash_T::get_first (void) +{ + ACE_TRACE ("ACE_Timer_Hash_T::get_first"); + + if (this->is_empty ()) + return 0; + + return this->table_[this->earliest_position_]->get_first (); +} + +template void +ACE_Timer_Hash_T::free_node (ACE_Timer_Node_T *node) +{ + ACE_Timer_Queue_T::free_node (node); + + Hash_Token *h = + reinterpret_cast *> (const_cast (node->get_act ())); + this->token_list_.add (h); +} + +template int +ACE_Timer_Hash_T::dispatch_info_i (const ACE_Time_Value &cur_time, + ACE_Timer_Node_Dispatch_Info_T &info) +{ + int const result = + ACE_Timer_Queue_T::dispatch_info_i (cur_time, + info); + + if (result == 1) + { + Hash_Token *h = + reinterpret_cast *> (const_cast (info.act_)); + + info.act_ = h->act_; + } + + return result; +} + +// Dummy version of expire to get rid of warnings in Sun CC 4.2 + +template int +ACE_Timer_Hash_T::expire () +{ + return ACE_Timer_Queue_T::expire(); +} + +// Specialized expire for Timer Hash + +template int +ACE_Timer_Hash_T::expire (const ACE_Time_Value &cur_time) +{ + ACE_TRACE ("ACE_Timer_Hash_T::expire"); + + int number_of_timers_expired = 0; + + ACE_Timer_Node_T *expired = 0; + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Go through the table and expire anything that can be expired + + for (size_t i = 0; + i < this->table_size_; + ++i) + { + while (!this->table_[i]->is_empty () + && this->table_[i]->earliest_time () <= cur_time) + { + expired = this->table_[i]->remove_first (); + const void *act = expired->get_act (); + bool reclaim = true; + + Hash_Token *h = + reinterpret_cast *> (const_cast (act)); + + ACE_ASSERT (h->pos_ == i); + +#if 0 + ACE_DEBUG ((LM_DEBUG, "Hash::expire() expiring %d in slot %d where it's id is %d and token is %x\n", + expired->get_timer_value ().msec (), + h->pos_, + h->orig_id_, + h)); +#endif + + // Check if this is an interval timer. + if (expired->get_interval () > ACE_Time_Value::zero) + { + // Make sure that we skip past values that have already + // "expired". + this->recompute_next_abs_interval_time (expired, cur_time); + + // Since this is an interval timer, we need to + // reschedule it. + this->reschedule (expired); + reclaim = false; + } + else + { + this->free_node (expired); + } + + ACE_Timer_Node_Dispatch_Info_T info; + + // Get the dispatch info + expired->get_dispatch_info (info); + + info.act_ = h->act_; + + const void *upcall_act = 0; + + this->preinvoke (info, cur_time, upcall_act); + + this->upcall (info, cur_time); + + this->postinvoke (info, cur_time, upcall_act); + + if (reclaim) + { + --this->size_; + } + + ++number_of_timers_expired; + } + } + + if (number_of_timers_expired > 0) + this->find_new_earliest (); + + return number_of_timers_expired; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_HASH_T_CPP */ diff --git a/externals/ace/Timer_Hash_T.h b/externals/ace/Timer_Hash_T.h new file mode 100644 index 0000000..b04e7cf --- /dev/null +++ b/externals/ace/Timer_Hash_T.h @@ -0,0 +1,342 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Timer_Hash_T.h + * + * $Id: Timer_Hash_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_TIMER_HASH_T_H +#define ACE_TIMER_HASH_T_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_Queue_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Free_List.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration. +template +class ACE_Timer_Hash_T; +template +class Hash_Token; + +/** + * @class ACE_Timer_Hash_Upcall + * + * @brief Functor for Timer_Hash + * + * This class calls up to the Timer Hash's functor from the + * timer queues in the hash table + */ +template +class ACE_Timer_Hash_Upcall +{ +public: + typedef ACE_Timer_Queue_T, + ACE_Null_Mutex> + TIMER_QUEUE; + + /// Default constructor (creates an invalid object, but needs to be here + /// so timer queues using this functor can be constructed) + ACE_Timer_Hash_Upcall (void); + + /// Constructor that specifies a Timer_Hash to call up to + ACE_Timer_Hash_Upcall (ACE_Timer_Queue_T *timer_hash); + + /// This method is called when a timer is registered. + int registration (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + + /// This method is called before the timer expires. + int preinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + + /// This method is called when the timer expires. + int timeout (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time); + + /// This method is called after the timer expires. + int postinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *upcall_act); + + /// This method is called when a handler is cancelled + int cancel_type (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int &requires_reference_counting); + + /// This method is called when a timer is cancelled + int cancel_timer (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int requires_reference_counting); + + /// This method is called when the timer queue is destroyed and + /// the timer is still contained in it + int deletion (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + +private: + /// Timer Queue to do the calling up to + ACE_Timer_Queue_T *timer_hash_; + + // = Don't allow these operations for now. + ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_Upcall (const ACE_Timer_Hash_Upcall &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_Upcall &)) +}; + +/** + * @class ACE_Timer_Hash_Iterator_T + * + * @brief Iterates over an ACE_Timer_Hash_T. + * + * This is a generic iterator that can be used to visit every + * node of a timer queue. Be aware that it doesn't transverse + * in the order of timeout values. + */ +template +class ACE_Timer_Hash_Iterator_T : public ACE_Timer_Queue_Iterator_T +{ +public: + /// Constructor. + ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T &); + + /// Positions the iterator at the earliest node in the Timer Queue + virtual void first (void); + + /// Positions the iterator at the next node in the Timer Queue + virtual void next (void); + + /// Returns true when there are no more nodes in the sequence + virtual bool isdone (void) const; + + /// Returns the node at the current position in the sequence + virtual ACE_Timer_Node_T *item (void); + +protected: + /// Pointer to the ACE_Timer_Hash that we are iterating over. + ACE_Timer_Hash_T &timer_hash_; + + /// Current position in 's table + size_t position_; + + /// Current iterator used on 's bucket + ACE_Timer_Queue_Iterator_T, ACE_Null_Mutex> *iter_; +}; + +/** + * @class ACE_Timer_Hash_T + * + * @brief Provides a hash table of BUCKETs as an implementation for + * a timer queue. + * + * This implementation uses a hash table of BUCKETs. The hash + * is based on the time_value of the event. Unlike other Timer + * Queues, ACE_Timer_Hash does not expire events in order. + */ +template +class ACE_Timer_Hash_T : public ACE_Timer_Queue_T +{ +public: + /// Type of iterator + typedef ACE_Timer_Hash_Iterator_T + HASH_ITERATOR; + + /// Iterator is a friend + friend class ACE_Timer_Hash_Iterator_T; + + /// Type inherited from + typedef ACE_Timer_Queue_T INHERITED; + + // = Initialization and termination methods. + /** + * Default constructor. @a table_size determines the size of the + * hash table. @a upcall_functor is the instance of the FUNCTOR + * to be used by the buckets. If @a upcall_functor is 0, a default + * FUNCTOR will be created. + */ + ACE_Timer_Hash_T (size_t table_size, + FUNCTOR *upcall_functor = 0, + ACE_Free_List > *freelist = 0); + + /** + * Default constructor. @a upcall_functor is the instance of the + * FUNCTOR to be used by the queue. If @a upcall_functor is 0, Timer + * Hash will create a default FUNCTOR. @a freelist the freelist of + * timer nodes. If 0, then a default freelist will be created. The default + * size will be ACE_DEFAULT_TIMERS and there will be no preallocation. + */ + ACE_Timer_Hash_T (FUNCTOR *upcall_functor = 0, ACE_Free_List > *freelist = 0); + + /// Destructor + virtual ~ACE_Timer_Hash_T (void); + + /// True if queue is empty, else false. + virtual bool is_empty (void) const; + + /// Returns the time of the earlier node in the . + /// Must be called on a non-empty queue. + virtual const ACE_Time_Value &earliest_time (void) const; + + /** + * Resets the interval of the timer represented by @a timer_id to + * @a interval, which is specified in relative time to the current + * . If @a interval is equal to + * ACE_Time_Value::zero, the timer will become a non-rescheduling + * timer. Returns 0 if successful, -1 if not. + */ + virtual int reset_interval (long timer_id, + const ACE_Time_Value &interval); + + /** + * Cancel all timer associated with @a type. If is 0 + * then the will be invoked. Returns number of timers + * cancelled. If any valid timer is not cancelled before destruction + * of this instance of ACE_Timer_Hash_T then user will get a memory + * leak. + */ + virtual int cancel (const TYPE &type, + int dont_call_handle_close = 1); + + /** + * Cancel the single timer that matches the @a timer_id value (which + * was returned from the method). If act is non-NULL + * then it will be set to point to the ``magic cookie'' argument + * passed in when the timer was registered. This makes it possible + * to free up the memory and avoid memory leaks. If is + * 0 then the will be invoked. Returns 1 if cancellation + * succeeded and 0 if the @a timer_id wasn't found. If any valid + * timer is not cancelled before destruction of this instance of + * ACE_Timer_Hash_T then user will get a memory leak. + */ + virtual int cancel (long timer_id, + const void **act = 0, + int dont_call_handle_close = 1); + + /** + * Run the for all timers whose values are <= + * . Also accounts for . Returns + * the number of timers canceled. + */ + virtual int expire (void); + + /** + * Run the for all timers whose values are <= @a current_time. + * This does not account for . Returns the number of + * timers canceled. + */ + virtual int expire (const ACE_Time_Value ¤t_time); + + /// Returns a pointer to this ACE_Timer_Queue's iterator. + virtual ACE_Timer_Queue_Iterator_T &iter (void); + + /// Removes the earliest node from the queue and returns it + virtual ACE_Timer_Node_T *remove_first (void); + + /// Dump the state of an object. + virtual void dump (void) const; + + /// Reads the earliest node from the queue and returns it. + virtual ACE_Timer_Node_T *get_first (void); + +protected: + /// Factory method that frees a previously allocated node. + virtual void free_node (ACE_Timer_Node_T *); + +private: + + /** + * Schedule @a type that will expire at @a future_time, + * which is specified in absolute time. If it expires then @a act is + * passed in as the value to the . If @a interval is != to + * ACE_Time_Value::zero then it is used to reschedule the @a type + * automatically, using relative time to the current . + * This method returns a that is a pointer to a token + * which stores information about the event. This can be + * used to cancel the timer before it expires. Returns -1 on + * failure. + */ + virtual long schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval); + + /// Non-locking version of dispatch_info () + virtual int dispatch_info_i (const ACE_Time_Value ¤t_time, + ACE_Timer_Node_Dispatch_Info_T &info); + + /// Reschedule an "interval" ACE_Timer_Node. + virtual void reschedule (ACE_Timer_Node_T *); + + /// Finds the earliest node + void find_new_earliest (void); + + /// Keeps track of the size of the queue + size_t size_; + + /// Table of BUCKETS + BUCKET **table_; + + /// Keeps track of the size of table_ + size_t table_size_; + + /// Functor used for the table's timer queues + ACE_Timer_Hash_Upcall table_functor_; + + /// Index to the position with the earliest entry + size_t earliest_position_; + + /// Iterator used to expire timers. + HASH_ITERATOR *iterator_; + +#if defined (ACE_WIN64) + // Part of a hack... see comments in schedule(). + // This is, essentially, the upper 32 bits of a 64-bit pointer on Win64. + ptrdiff_t pointer_base_; +#endif + + /// Hash_Token is usually allocated in schedule but its + /// deallocation is problematic and token_list_ helps with this. + ACE_Locked_Free_List, ACE_Null_Mutex> token_list_; + + // = Don't allow these operations for now. + ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_T (const ACE_Timer_Hash_T &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_T &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Timer_Hash_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Timer_Hash_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_HASH_T_H */ diff --git a/externals/ace/Timer_Heap.h b/externals/ace/Timer_Heap.h new file mode 100644 index 0000000..7dec5ec --- /dev/null +++ b/externals/ace/Timer_Heap.h @@ -0,0 +1,41 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Timer_Heap.h + * + * $Id: Timer_Heap.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TIMER_HEAP_H +#define ACE_TIMER_HEAP_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_Heap_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedefs are here for ease of use and backward +// compatibility. + +typedef ACE_Timer_Heap_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_Heap; + +typedef ACE_Timer_Heap_Iterator_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_Heap_Iterator; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_HEAP_H */ diff --git a/externals/ace/Timer_Heap_T.cpp b/externals/ace/Timer_Heap_T.cpp new file mode 100644 index 0000000..75ec9ef --- /dev/null +++ b/externals/ace/Timer_Heap_T.cpp @@ -0,0 +1,889 @@ +// $Id: Timer_Heap_T.cpp 84962 2009-03-24 15:16:25Z johnnyw $ + +#ifndef ACE_TIMER_HEAP_T_CPP +#define ACE_TIMER_HEAP_T_CPP + +#include "ace/Timer_Heap_T.h" +#include "ace/Log_Msg.h" +#include "ace/Guard_T.h" +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_string.h" +#include "ace/Numeric_Limits.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/* +** The ACE_Timer_Heap::max_size_ and array loops, checks, etc. are all size_t. +** The timer IDs are long, and since they are indices into the heap, we need +** to be sure that the timer heap size can fit in a long. Hence, when size +** is (re)set, limit it to the maximum long value. We use the C++ standard +** limits if available. +*/ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Define some simple inlined functions to clarify the code. +inline size_t +ACE_HEAP_PARENT (size_t X) +{ + return (X == 0 ? 0 : ((X - 1) / 2)); +} + +inline size_t +ACE_HEAP_LCHILD (size_t X) +{ + return X + X + 1; +} + +// Constructor that takes in an to iterate over. + +template +ACE_Timer_Heap_Iterator_T::ACE_Timer_Heap_Iterator_T ( + ACE_Timer_Heap_T &heap) + : timer_heap_ (heap) +{ + ACE_TRACE ("ACE_Timer_Heap_Iterator_T::ACE_Timer_Heap_Iterator"); + this->first (); +} + +template +ACE_Timer_Heap_Iterator_T::~ACE_Timer_Heap_Iterator_T (void) +{ +} + +// Positions the iterator at the first node in the heap array + +template +void +ACE_Timer_Heap_Iterator_T::first (void) +{ + this->position_ = 0; +} + +// Positions the iterator at the next node in the heap array + +template +void +ACE_Timer_Heap_Iterator_T::next (void) +{ + if (this->position_ != this->timer_heap_.cur_size_) + ++this->position_; +} + +// Returns true the is at the end of the heap array + +template bool +ACE_Timer_Heap_Iterator_T::isdone (void) const +{ + return this->position_ == this->timer_heap_.cur_size_; +} + +// Returns the node at the current position in the heap or 0 if at the end + +template ACE_Timer_Node_T * +ACE_Timer_Heap_Iterator_T::item (void) +{ + if (this->position_ != this->timer_heap_.cur_size_) + return this->timer_heap_.heap_[this->position_]; + return 0; +} + +// Constructor +// Note that timer_ids_curr_ and timer_ids_min_free_ both start at 0. +// Since timer IDs are assigned by first incrementing the timer_ids_curr_ +// value, the first ID assigned will be 1 (just as in the previous design). +// When it's time to wrap, the next ID given out will be 0. +template +ACE_Timer_Heap_T::ACE_Timer_Heap_T ( + size_t size, + bool preallocated, + FUNCTOR *upcall_functor, + ACE_Free_List > *freelist) + : ACE_Timer_Queue_T (upcall_functor, freelist), + max_size_ (size), + cur_size_ (0), + cur_limbo_ (0), + timer_ids_curr_ (0), + timer_ids_min_free_ (0), + preallocated_nodes_ (0), + preallocated_nodes_freelist_ (0) +{ + ACE_TRACE ("ACE_Timer_Heap_T::ACE_Timer_Heap_T"); + + // Possibly reduce size to fit in a long. + if (size > static_cast (ACE_Numeric_Limits::max ())) + { + size = static_cast (ACE_Numeric_Limits::max ()); + this->max_size_ = size; + } + + // Create the heap array. + ACE_NEW (this->heap_, + ACE_Timer_Node_T *[size]); + + // Create the parallel + ACE_NEW (this->timer_ids_, + ssize_t[size]); + + // Initialize the "freelist," which uses negative values to + // distinguish freelist elements from "pointers" into the + // array. + for (size_t i = 0; i < size; ++i) + this->timer_ids_[i] = -1; + + if (preallocated) + { + ACE_NEW (this->preallocated_nodes_, + ACE_Timer_Node_T[size]); + + // Add allocated array to set of such arrays for deletion on + // cleanup. + this->preallocated_node_set_.insert (this->preallocated_nodes_); + + // Form the freelist by linking the next_ pointers together. + for (size_t j = 1; j < size; ++j) + this->preallocated_nodes_[j - 1].set_next (&this->preallocated_nodes_[j]); + + // NULL-terminate the freelist. + this->preallocated_nodes_[size - 1].set_next (0); + + // Assign the freelist pointer to the front of the list. + this->preallocated_nodes_freelist_ = + &this->preallocated_nodes_[0]; + } + + ACE_NEW (iterator_, + HEAP_ITERATOR (*this)); +} + +// Note that timer_ids_curr_ and timer_ids_min_free_ both start at 0. +// Since timer IDs are assigned by first incrementing the timer_ids_curr_ +// value, the first ID assigned will be 1 (just as in the previous design). +// When it's time to wrap, the next ID given out will be 0. +template +ACE_Timer_Heap_T::ACE_Timer_Heap_T ( + FUNCTOR *upcall_functor, + ACE_Free_List > *freelist) + : ACE_Timer_Queue_T (upcall_functor, freelist), + max_size_ (ACE_DEFAULT_TIMERS), + cur_size_ (0), + cur_limbo_ (0), + timer_ids_curr_ (0), + timer_ids_min_free_ (0), + preallocated_nodes_ (0), + preallocated_nodes_freelist_ (0) +{ + ACE_TRACE ("ACE_Timer_Heap_T::ACE_Timer_Heap_T"); + + // Possibly reduce size to fit in a long. + if (this->max_size_ > static_cast (ACE_Numeric_Limits::max ())) + this->max_size_ = static_cast (ACE_Numeric_Limits::max ()); + + // Create the heap array. + ACE_NEW (this->heap_, + ACE_Timer_Node_T *[this->max_size_]); + + // Create the parallel array. + ACE_NEW (this->timer_ids_, + ssize_t[this->max_size_]); + + // Initialize the "freelist," which uses negative values to + // distinguish freelist elements from "pointers" into the + // array. + for (size_t i = 0; i < this->max_size_; ++i) + this->timer_ids_[i] = -1; + + ACE_NEW (iterator_, + HEAP_ITERATOR (*this)); +} + +template +ACE_Timer_Heap_T::~ACE_Timer_Heap_T (void) +{ + ACE_TRACE ("ACE_Timer_Heap_T::~ACE_Timer_Heap_T"); + + delete iterator_; + + size_t current_size = + this->cur_size_; + + // Clean up all the nodes still in the queue + for (size_t i = 0; i < current_size; ++i) + { + // Grab the event_handler and act, then delete the node before calling + // back to the handler. Prevents a handler from trying to cancel_timer() + // inside handle_close(), ripping the current timer node out from + // under us. + TYPE eh = this->heap_[i]->get_type (); + const void *act = this->heap_[i]->get_act (); + this->free_node (this->heap_[i]); + this->upcall_functor ().deletion (*this, eh, act); + } + + delete [] this->heap_; + delete [] this->timer_ids_; + + // clean up any preallocated timer nodes + if (preallocated_nodes_ != 0) + { + ACE_Unbounded_Set_Iterator *> + set_iterator (this->preallocated_node_set_); + + for (ACE_Timer_Node_T **entry = 0; + set_iterator.next (entry) !=0; + set_iterator.advance ()) + delete [] *entry; + } +} + +template +long +ACE_Timer_Heap_T::pop_freelist (void) +{ + ACE_TRACE ("ACE_Timer_Heap_T::pop_freelist"); + + // Scan for a free timer ID. Note that since this function is called + // _after_ the check for a full timer heap, we are guaranteed to find + // a free ID, even if we need to wrap around and start reusing freed IDs. + // On entry, the curr_ index is at the previous ID given out; start + // up where we left off last time. + // NOTE - a timer_ids_ slot with -2 is out of the heap, but not freed. + // It must be either freed (free_node) or rescheduled (reschedule). + ++this->timer_ids_curr_; + while (this->timer_ids_curr_ < this->max_size_ && + (this->timer_ids_[this->timer_ids_curr_] >= 0 || + this->timer_ids_[this->timer_ids_curr_] == -2 )) + ++this->timer_ids_curr_; + if (this->timer_ids_curr_ == this->max_size_) + { + ACE_ASSERT (this->timer_ids_min_free_ < this->max_size_); + this->timer_ids_curr_ = this->timer_ids_min_free_; + // We restarted the free search at min. Since min won't be + // free anymore, and curr_ will just keep marching up the list + // on each successive need for an ID, reset min_free_ to the + // size of the list until an ID is freed that curr_ has already + // gone past (see push_freelist). + this->timer_ids_min_free_ = this->max_size_; + } + + return static_cast (this->timer_ids_curr_); +} + +template +void +ACE_Timer_Heap_T::push_freelist (long old_id) +{ + ACE_TRACE ("ACE_Timer_Heap_T::push_freelist"); + + // Since this ID has already been checked by one of the public + // functions, it's safe to cast it here. + size_t oldid = static_cast (old_id); + + // The freelist values in the are negative, so set the + // freed entry back to 'free'. If this is the new lowest value free + // timer ID that curr_ won't see on it's normal march through the list, + // remember it. + ACE_ASSERT (this->timer_ids_[oldid] >= 0 || this->timer_ids_[oldid] == -2); + if (this->timer_ids_[oldid] == -2) + --this->cur_limbo_; + else + --this->cur_size_; + this->timer_ids_[oldid] = -1; + if (oldid < this->timer_ids_min_free_ && oldid <= this->timer_ids_curr_) + this->timer_ids_min_free_ = oldid; + return; +} + +template +long +ACE_Timer_Heap_T::timer_id (void) +{ + ACE_TRACE ("ACE_Timer_Heap_T::timer_id"); + + // Return the next item off the freelist and use it as the timer id. + return this->pop_freelist (); +} + +// Checks if queue is empty. + +template +bool +ACE_Timer_Heap_T::is_empty (void) const +{ + ACE_TRACE ("ACE_Timer_Heap_T::is_empty"); + return this->cur_size_ == 0; +} + +template +ACE_Timer_Queue_Iterator_T & +ACE_Timer_Heap_T::iter (void) +{ + this->iterator_->first (); + return *this->iterator_; +} + +// Returns earliest time in a non-empty queue. + +template const ACE_Time_Value & +ACE_Timer_Heap_T::earliest_time (void) const +{ + ACE_TRACE ("ACE_Timer_Heap_T::earliest_time"); + return this->heap_[0]->get_timer_value (); +} + +template +void +ACE_Timer_Heap_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Timer_Heap_T::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmax_size_ = %d"), this->max_size_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d"), this->cur_size_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_limbo_= %d"), this->cur_limbo_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nids_curr_ = %d"), + this->timer_ids_curr_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmin_free_ = %d"), + this->timer_ids_min_free_)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nheap_ =\n"))); + + for (size_t i = 0; i < this->cur_size_; ++i) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%d\n"), + i)); + this->heap_[i]->dump (); + } + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntimer_ids_ =\n"))); + + for (size_t j = 0; j < this->max_size_; ++j) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%d\t%d\n"), + j, + this->timer_ids_[j])); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template +void +ACE_Timer_Heap_T::copy ( + size_t slot, + ACE_Timer_Node_T *moved_node) +{ + // Insert into its new location in the heap. + this->heap_[slot] = moved_node; + + ACE_ASSERT (moved_node->get_timer_id () >= 0 + && moved_node->get_timer_id () < (int) this->max_size_); + + // Update the corresponding slot in the parallel array. + this->timer_ids_[moved_node->get_timer_id ()] = static_cast (slot); +} + +// Remove the slot'th timer node from the heap, but do not reclaim its +// timer ID or change the size of this timer heap object. The caller of +// this function must call either free_node (to reclaim the timer ID +// and the timer node memory, as well as decrement the size of the queue) +// or reschedule (to reinsert the node in the heap at a new time). +template +ACE_Timer_Node_T * +ACE_Timer_Heap_T::remove (size_t slot) +{ + ACE_Timer_Node_T *removed_node = + this->heap_[slot]; + + // NOTE - the cur_size_ is being decremented since the queue has one + // less active timer in it. However, this ACE_Timer_Node is not being + // freed, and there is still a place for it in timer_ids_ (the timer ID + // is not being relinquished). The node can still be rescheduled, or + // it can be freed via free_node. + --this->cur_size_; + + // Only try to reheapify if we're not deleting the last entry. + + if (slot < this->cur_size_) + { + ACE_Timer_Node_T *moved_node = + this->heap_[this->cur_size_]; + + // Move the end node to the location being removed and update + // the corresponding slot in the parallel array. + this->copy (slot, moved_node); + + // If the time_value_> is great than or equal its + // parent it needs be moved down the heap. + size_t parent = ACE_HEAP_PARENT (slot); + + if (moved_node->get_timer_value () + >= this->heap_[parent]->get_timer_value ()) + this->reheap_down (moved_node, + slot, + ACE_HEAP_LCHILD (slot)); + else + this->reheap_up (moved_node, + slot, + parent); + } + + this->timer_ids_[removed_node->get_timer_id ()] = -2; + ++this->cur_limbo_; + return removed_node; +} + +template void +ACE_Timer_Heap_T::reheap_down ( + ACE_Timer_Node_T *moved_node, + size_t slot, + size_t child) +{ + // Restore the heap property after a deletion. + + while (child < this->cur_size_) + { + // Choose the smaller of the two children. + if (child + 1 < this->cur_size_ + && this->heap_[child + 1]->get_timer_value () + < this->heap_[child]->get_timer_value ()) + child++; + + // Perform a if the child has a larger timeout value than + // the . + if (this->heap_[child]->get_timer_value () + < moved_node->get_timer_value ()) + { + this->copy (slot, + this->heap_[child]); + slot = child; + child = ACE_HEAP_LCHILD (child); + } + else + // We've found our location in the heap. + break; + } + + this->copy (slot, moved_node); +} + +template +void +ACE_Timer_Heap_T::reheap_up ( + ACE_Timer_Node_T *moved_node, + size_t slot, + size_t parent) +{ + // Restore the heap property after an insertion. + + while (slot > 0) + { + // If the parent node is greater than the we need + // to copy it down. + if (moved_node->get_timer_value () + < this->heap_[parent]->get_timer_value ()) + { + this->copy (slot, this->heap_[parent]); + slot = parent; + parent = ACE_HEAP_PARENT (slot); + } + else + break; + } + + // Insert the new node into its proper resting place in the heap and + // update the corresponding slot in the parallel array. + this->copy (slot, + moved_node); +} + +template +void +ACE_Timer_Heap_T::insert ( + ACE_Timer_Node_T *new_node) +{ + if (this->cur_size_ + this->cur_limbo_ + 2 >= this->max_size_) + this->grow_heap (); + + this->reheap_up (new_node, + this->cur_size_, + ACE_HEAP_PARENT (this->cur_size_)); + this->cur_size_++; +} + +template +void +ACE_Timer_Heap_T::grow_heap (void) +{ + // All the containers will double in size from max_size_. + size_t new_size = this->max_size_ * 2; + +#if 0 + // Yikes - there's no way to flag a failure of going out of range of + // a 'long' - this is a problem that should be addressed at some point. + if (new_size > ACE_Numeric_Limits::max ()) + new_size = ACE_Numeric_Limits::max (); + + if (new_size <= this->max_size_) // We are already at the limit + { + errno = ENOMEM; + return -1; + } +#endif /* 0 */ + + // First grow the heap itself. + + ACE_Timer_Node_T **new_heap = 0; + + ACE_NEW (new_heap, + ACE_Timer_Node_T *[new_size]); + + ACE_OS::memcpy (new_heap, + this->heap_, + this->max_size_ * sizeof *new_heap); + delete [] this->heap_; + this->heap_ = new_heap; + + // Grow the array of timer ids. + + ssize_t *new_timer_ids = 0; + + ACE_NEW (new_timer_ids, + ssize_t[new_size]); + + ACE_OS::memcpy (new_timer_ids, + this->timer_ids_, + this->max_size_ * sizeof (ssize_t)); + + delete [] timer_ids_; + this->timer_ids_ = new_timer_ids; + + // And add the new elements to the end of the "freelist". + for (size_t i = this->max_size_; i < new_size; ++i) + this->timer_ids_[i] = -(static_cast (i) + 1); + + // Grow the preallocation array (if using preallocation) + if (this->preallocated_nodes_ != 0) + { + // Create a new array with max_size elements to link in to + // existing list. + ACE_NEW (this->preallocated_nodes_, + ACE_Timer_Node_T[this->max_size_]); + + // Add it to the set for later deletion + this->preallocated_node_set_.insert (this->preallocated_nodes_); + + // Link new nodes together (as for original list). + for (size_t k = 1; k < this->max_size_; ++k) + this->preallocated_nodes_[k - 1].set_next (&this->preallocated_nodes_[k]); + + // NULL-terminate the new list. + this->preallocated_nodes_[this->max_size_ - 1].set_next (0); + + // Link new array to the end of the existling list. + if (this->preallocated_nodes_freelist_ == 0) + this->preallocated_nodes_freelist_ = + &preallocated_nodes_[0]; + else + { + ACE_Timer_Node_T *previous = + this->preallocated_nodes_freelist_; + + for (ACE_Timer_Node_T *current = this->preallocated_nodes_freelist_->get_next (); + current != 0; + current = current->get_next ()) + previous = current; + + previous->set_next (&this->preallocated_nodes_[0]); + } + } + + this->max_size_ = new_size; + // Force rescan of list from beginning for a free slot (I think...) + // This fixed Bugzilla #2447. + this->timer_ids_min_free_ = this->max_size_; +} + +// Reschedule a periodic timer. This function must be called with the +// mutex lock held. + +template +void +ACE_Timer_Heap_T::reschedule ( + ACE_Timer_Node_T *expired) +{ + ACE_TRACE ("ACE_Timer_Heap_T::reschedule"); + + // If we are rescheduling, then the most recent call was to + // remove_first (). That called remove () to remove the node from the + // heap, but did not free the timer ID. The ACE_Timer_Node still has + // its assigned ID - just needs to be inserted at the new proper + // place, and the heap restored properly. + if (this->timer_ids_[expired->get_timer_id ()] == -2) + --this->cur_limbo_; + this->insert (expired); +} + +template +ACE_Timer_Node_T * +ACE_Timer_Heap_T::alloc_node (void) +{ + ACE_Timer_Node_T *temp = 0; + + // Only allocate a node if we are *not* using the preallocated heap. + if (this->preallocated_nodes_ == 0) + ACE_NEW_RETURN (temp, + ACE_Timer_Node_T, + 0); + else + { + // check to see if the heap needs to grow + if (this->preallocated_nodes_freelist_ == 0) + this->grow_heap (); + + temp = this->preallocated_nodes_freelist_; + + // Remove the first element from the freelist. + this->preallocated_nodes_freelist_ = + this->preallocated_nodes_freelist_->get_next (); + } + return temp; +} + +template +void +ACE_Timer_Heap_T::free_node ( + ACE_Timer_Node_T *node) +{ + // Return this timer id to the freelist. + this->push_freelist (node->get_timer_id ()); + + // Only free up a node if we are *not* using the preallocated heap. + if (this->preallocated_nodes_ == 0) + delete node; + else + { + node->set_next (this->preallocated_nodes_freelist_); + this->preallocated_nodes_freelist_ = node; + } +} + +// Insert a new timer that expires at time future_time; if interval is +// > 0, the handler will be reinvoked periodically. + +template +long +ACE_Timer_Heap_T::schedule_i ( + const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_Timer_Heap_T::schedule_i"); + + if ((this->cur_size_ + this->cur_limbo_) < this->max_size_) + { + // Obtain the next unique sequence number. + long const timer_id = this->timer_id (); + + // Obtain the memory to the new node. + ACE_Timer_Node_T *temp = 0; + + ACE_ALLOCATOR_RETURN (temp, + this->alloc_node (), + -1); + temp->set (type, + act, + future_time, + interval, + 0, + timer_id); + + this->insert (temp); + return timer_id; + } + else + return -1; +} + +// Locate and remove the single timer with a value of @a timer_id from +// the timer queue. + +template +int +ACE_Timer_Heap_T::cancel (long timer_id, + const void **act, + int dont_call) +{ + ACE_TRACE ("ACE_Timer_Heap_T::cancel"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Locate the ACE_Timer_Node that corresponds to the timer_id. + + // Check to see if the timer_id is out of range + if (timer_id < 0 + || (size_t) timer_id > this->max_size_) + return 0; + + ssize_t timer_node_slot = this->timer_ids_[timer_id]; + + // Check to see if timer_id is still valid. + if (timer_node_slot < 0) + return 0; + + if (timer_id != this->heap_[timer_node_slot]->get_timer_id ()) + { + ACE_ASSERT (timer_id == this->heap_[timer_node_slot]->get_timer_id ()); + return 0; + } + else + { + ACE_Timer_Node_T *temp = + this->remove (timer_node_slot); + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + temp->get_type (), + dont_call, + cookie); + + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + temp->get_type (), + dont_call, + cookie); + + if (act != 0) + *act = temp->get_act (); + + this->free_node (temp); + return 1; + } +} + +// Locate and update the inteval on the timer_id + +template +int +ACE_Timer_Heap_T::reset_interval (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_Timer_Heap_T::reset_interval"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Locate the ACE_Timer_Node that corresponds to the timer_id. + + // Check to see if the timer_id is out of range + if (timer_id < 0 + || (size_t) timer_id > this->max_size_) + return -1; + + ssize_t timer_node_slot = this->timer_ids_[timer_id]; + + // Check to see if timer_id is still valid. + if (timer_node_slot < 0) + return -1; + + if (timer_id != this->heap_[timer_node_slot]->get_timer_id ()) + { + ACE_ASSERT (timer_id == this->heap_[timer_node_slot]->get_timer_id ()); + return -1; + } + else + { + // Reset the timer interval + this->heap_[timer_node_slot]->set_interval (interval); + return 0; + } +} + +// Locate and remove all values of @a type from the timer queue. + +template +int +ACE_Timer_Heap_T::cancel (const TYPE &type, + int dont_call) +{ + ACE_TRACE ("ACE_Timer_Heap_T::cancel"); + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + int number_of_cancellations = 0; + + // Try to locate the ACE_Timer_Node that matches the timer_id. + + for (size_t i = 0; i < this->cur_size_; ) + { + if (this->heap_[i]->get_type () == type) + { + ACE_Timer_Node_T *temp = this->remove (i); + + ++number_of_cancellations; + + this->free_node (temp); + + // We reset to zero so that we don't miss checking any nodes + // if a reheapify occurs when a node is removed. There + // may be a better fix than this, however. + i = 0; + } + else + ++i; + } + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + type, + dont_call, + cookie); + + for (int j = 0; + j < number_of_cancellations; + ++j) + { + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + type, + dont_call, + cookie); + } + + return number_of_cancellations; +} + +// Returns the earliest node or returns 0 if the heap is empty. + +template +ACE_Timer_Node_T * +ACE_Timer_Heap_T::remove_first (void) +{ + ACE_TRACE ("ACE_Timer_Heap_T::remove_first"); + + if (this->cur_size_ == 0) + return 0; + + return this->remove (0); +} + +template +ACE_Timer_Node_T * +ACE_Timer_Heap_T::get_first (void) +{ + ACE_TRACE ("ACE_Timer_Heap_T::get_first"); + + return this->cur_size_ == 0 ? 0 : this->heap_[0]; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_HEAP_T_CPP */ diff --git a/externals/ace/Timer_Heap_T.h b/externals/ace/Timer_Heap_T.h new file mode 100644 index 0000000..d6a6221 --- /dev/null +++ b/externals/ace/Timer_Heap_T.h @@ -0,0 +1,338 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_Heap_T.h + * + * $Id: Timer_Heap_T.h 84619 2009-02-26 12:26:16Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TIMER_HEAP_T_H +#define ACE_TIMER_HEAP_T_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_Queue_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Free_List.h" +#include "ace/Unbounded_Set.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration +template +class ACE_Timer_Heap_T; + +/** + * @class ACE_Timer_Heap_Iterator_T + * + * @brief Iterates over an ACE_Timer_Heap_T. + * + * This is a generic iterator that can be used to visit every + * node of a timer queue. Be aware that it doesn't transverse + * in the order of timeout values. + */ +template +class ACE_Timer_Heap_Iterator_T : public ACE_Timer_Queue_Iterator_T +{ +public: + /// Constructor. + ACE_Timer_Heap_Iterator_T (ACE_Timer_Heap_T &); + + /// Destructor. + ~ACE_Timer_Heap_Iterator_T (void); + + /// Positions the iterator at the earliest node in the Timer Queue + virtual void first (void); + + /// Positions the iterator at the next node in the Timer Queue + virtual void next (void); + + /// Returns true when there are no more nodes in the sequence + virtual bool isdone (void) const; + + /// Returns the node at the current position in the sequence + virtual ACE_Timer_Node_T *item (void); + +protected: + /// Pointer to the ACE_Timer_Heap that we are iterating over. + ACE_Timer_Heap_T &timer_heap_; + + /// Position in the array where the iterator is at + size_t position_; +}; + +/** + * @class ACE_Timer_Heap_T + * + * @brief Provides a very fast and predictable timer implementation. + * + * This implementation uses a heap-based callout queue of + * absolute times. Therefore, in the average and worst case, + * scheduling, canceling, and expiring timers is O(log N) (where + * N is the total number of timers). In addition, we can also + * preallocate as many @c ACE_Timer_Node objects as there are slots + * in the heap. This allows us to completely remove the need for + * dynamic memory allocation, which is important for real-time + * systems. + */ +template +class ACE_Timer_Heap_T : public ACE_Timer_Queue_T +{ +public: + typedef ACE_Timer_Heap_Iterator_T HEAP_ITERATOR; + friend class ACE_Timer_Heap_Iterator_T; + + typedef ACE_Timer_Queue_T INHERITED; + + // = Initialization and termination methods. + /** + * The Constructor creates a heap with specified number of elements. + * This can also take in a upcall functor and freelist (if 0, then + * defaults will be created). + * + * @param size The maximum number of timers that can be + * inserted into the new object. + * @param preallocated Default false, true then all the memory + * for the @c ACE_Timer_Node objects will be pre-allocated. This saves + * time and is more predictable (though it requires more space). + * Otherwise, timer nodes are allocated as needed. + * @param freelist is the freelist of timer nodes. + * @param upcall_functor If 0 Timer Heap will create a default FUNCTOR. + */ + ACE_Timer_Heap_T (size_t size, + bool preallocated = false, + FUNCTOR *upcall_functor = 0, + ACE_Free_List > *freelist = 0); + + /** + * Default constructor. @c upcall_functor is the instance of the + * FUNCTOR to be used by the queue. If @c upcall_functor is 0, Timer + * Heap will create a default FUNCTOR. @c freelist is the freelist of + * timer nodes. If 0, then a default freelist will be created. The default + * size will be ACE_DEFAULT_TIMERS and there will be no preallocation. + */ + ACE_Timer_Heap_T (FUNCTOR *upcall_functor = 0, + ACE_Free_List > *freelist = 0); + + /// Destructor. + virtual ~ACE_Timer_Heap_T (void); + + /// True if heap is empty, else false. + virtual bool is_empty (void) const; + + /// Returns the time of the earliest node in the Timer_Queue. + /// Must be called on a non-empty queue. + virtual const ACE_Time_Value &earliest_time (void) const; + + /** + * Resets the interval of the timer represented by @a timer_id to + * @a interval, which is specified in relative time to the current + * . If @a interval is equal to + * ACE_Time_Value::zero, the timer will become a non-rescheduling + * timer. Returns 0 if successful, -1 if not. + */ + virtual int reset_interval (long timer_id, + const ACE_Time_Value &interval); + + /** + * Cancel all timers associated with @a type. If @a dont_call_handle_close + * is 0 then the will be invoked. Returns number of timers + * cancelled. + */ + virtual int cancel (const TYPE &type, + int dont_call_handle_close = 1); + + /** + * Cancel the single timer that matches the @a timer_id value (which + * was returned from the method). If act is non-NULL + * then it will be set to point to the ``magic cookie'' argument + * passed in when the timer was registered. This makes it possible + * to free up the memory and avoid memory leaks. If @a dont_call_handle_close + * is 0 then the will be invoked. Returns 1 if cancellation + * succeeded and 0 if the @a timer_id wasn't found. + */ + virtual int cancel (long timer_id, + const void **act = 0, + int dont_call_handle_close = 1); + + /// Returns a pointer to this ACE_Timer_Queue's iterator. + virtual ACE_Timer_Queue_Iterator_T &iter (void); + + /** + * Removes the earliest node from the queue and returns it. Note that + * the timer is removed from the heap, but is not freed, and its ID + * is not reclaimed. The caller is responsible for calling either + * @c reschedule() or @c free_node() after this function returns. Thus, + * this function is for support of @c ACE_Timer_Queue::expire and + * should not be used unadvisedly in other conditions. + */ + ACE_Timer_Node_T *remove_first (void); + + /// Dump the state of an object. + virtual void dump (void) const; + + /// Reads the earliest node from the queue and returns it. + virtual ACE_Timer_Node_T *get_first (void); + +protected: + + /** + * Schedule a timer that may optionally auto-reset. + * Schedule @a type that will expire at @a future_time, + * which is specified in absolute time. If it expires then @a act is + * passed in as the value to the . If @a interval is != to + * ACE_Time_Value::zero then it is used to reschedule the @a type + * automatically, using relative time to the current . + * This method returns a that uniquely identifies the the + * @a type entry in an internal list. This can be used to + * cancel the timer before it expires. The cancellation ensures + * that are unique up to values of greater than 2 + * billion timers. As long as timers don't stay around longer than + * this there should be no problems with accidentally deleting the + * wrong timer. Returns -1 on failure (which is guaranteed never to + * be a valid ). + */ + virtual long schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval); + + /// Reschedule an "interval" ACE_Timer_Node. + virtual void reschedule (ACE_Timer_Node_T *); + + /// Factory method that allocates a new node (uses operator new if + /// we're *not* preallocating, otherwise uses an internal freelist). + virtual ACE_Timer_Node_T *alloc_node (void); + + /** + * Factory method that frees a previously allocated node (uses + * operator delete if we're *not* preallocating, otherwise uses an + * internal freelist). + */ + virtual void free_node (ACE_Timer_Node_T *); + +private: + /// Remove and return the @a sloth ACE_Timer_Node and restore the + /// heap property. + ACE_Timer_Node_T *remove (size_t slot); + + /// Insert @a new_node into the heap and restore the heap property. + void insert (ACE_Timer_Node_T *new_node); + + /** + * Doubles the size of the heap and the corresponding timer_ids array. + * If preallocation is used, will also double the size of the + * preallocated array of ACE_Timer_Nodes. + */ + void grow_heap (void); + + /// Restore the heap property, starting at @a slot. + void reheap_up (ACE_Timer_Node_T *new_node, + size_t slot, + size_t parent); + + /// Restore the heap property, starting at @a slot. + void reheap_down (ACE_Timer_Node_T *moved_node, + size_t slot, + size_t child); + + /// Copy @a moved_node into the @a slot slot of and move + /// @a slot into the corresponding slot in the array. + void copy (size_t slot, ACE_Timer_Node_T *moved_node); + + /** + * Returns a timer id that uniquely identifies this timer. This id + * can be used to cancel a timer via the method. The + * timer id returned from this method will never == -1 to avoid + * conflicts with other failure return values. + */ + long timer_id (void); + + /// Pops and returns a new timer id from the freelist. + long pop_freelist (void); + + /// Pushes @a old_id onto the freelist. + void push_freelist (long old_id); + + /// Maximum size of the heap. + size_t max_size_; + + /// Current size of the heap. + size_t cur_size_; + + /// Number of heap entries in transition (removed from the queue, but + /// not freed) and may be rescheduled or freed. + size_t cur_limbo_; + + /// Iterator used to expire timers. + HEAP_ITERATOR *iterator_; + + /** + * Current contents of the Heap, which is organized as a "heap" of + * ACE_Timer_Node *'s. In this context, a heap is a "partially + * ordered, almost complete" binary tree, which is stored in an + * array. + */ + ACE_Timer_Node_T **heap_; + + /** + * An array of "pointers" that allows each ACE_Timer_Node in the + * to be located in O(1) time. Basically, + * contains the slot in the array where an ACE_Timer_Node + * * with timer id \ resides. Thus, the timer id passed back from + * is really a slot into the array. The + * array serves two purposes: negative values are + * indications of free timer IDs, whereas positive values are + * "pointers" into the array for assigned timer IDs. + */ + ssize_t *timer_ids_; + + /// "Pointer" to the element in the array that was + /// last given out as a timer ID. + size_t timer_ids_curr_; + + /// Index representing the lowest timer ID that has been freed. When + /// the timer_ids_next_ value wraps around, it starts back at this + /// point. + size_t timer_ids_min_free_; + + /** + * If this is non-0, then we preallocate number of + * ACE_Timer_Node objects in order to reduce dynamic allocation + * costs. In auto-growing implementation, this points to the + * last array of nodes allocated. + */ + ACE_Timer_Node_T *preallocated_nodes_; + + /// This points to the head of the freelist, + /// which is organized as a stack. + ACE_Timer_Node_T *preallocated_nodes_freelist_; + + /// Set of pointers to the arrays of preallocated timer nodes. + /// Used to delete the allocated memory when required. + ACE_Unbounded_Set *> preallocated_node_set_; + + // = Don't allow these operations for now. + ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Heap_T (const ACE_Timer_Heap_T &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Heap_T &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Timer_Heap_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Timer_Heap_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_HEAP_T_H */ diff --git a/externals/ace/Timer_List.h b/externals/ace/Timer_List.h new file mode 100644 index 0000000..f2d9cc2 --- /dev/null +++ b/externals/ace/Timer_List.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_List.h + * + * $Id: Timer_List.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//============================================================================= + + +#ifndef ACE_TIMER_LIST_H +#define ACE_TIMER_LIST_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_List_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedefs are here for ease of use and backward +// compatibility. + +typedef ACE_Timer_List_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_List; + +typedef ACE_Timer_List_Iterator_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_List_Iterator; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_LIST_H */ diff --git a/externals/ace/Timer_List_T.cpp b/externals/ace/Timer_List_T.cpp new file mode 100644 index 0000000..c3b837b --- /dev/null +++ b/externals/ace/Timer_List_T.cpp @@ -0,0 +1,418 @@ +// $Id: Timer_List_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TIMER_LIST_T_C +#define ACE_TIMER_LIST_T_C + +#include "ace/Timer_List_T.h" +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_RCSID(ace, Timer_List_T, "$Id: Timer_List_T.cpp 80826 2008-03-04 14:51:23Z wotte $") + +// Default Constructor + +template +ACE_Timer_List_Iterator_T::ACE_Timer_List_Iterator_T (List& lst) + : list_ (lst) +{ + this->first(); +} + +template +ACE_Timer_List_Iterator_T::~ACE_Timer_List_Iterator_T (void) +{ +} + +// Positions the iterator at the node right after the dummy node + +template void +ACE_Timer_List_Iterator_T::first (void) +{ + this->current_node_ = this->list_.get_first(); +} + +// Positions the iterator at the next node in the Timer Queue + +template void +ACE_Timer_List_Iterator_T::next (void) +{ + // Make sure that if we are at the end, we don't wrap around + if (! this->isdone()) + this->current_node_ = this->current_node_->get_next (); + if (this->current_node_ == this->list_.head_) + this->current_node_ = 0; +} + +// Returns true when we are at + +template bool +ACE_Timer_List_Iterator_T::isdone (void) const +{ + return this->current_node_ == 0; +} + +// Returns the node at or 0 if we are at the end + +template ACE_Timer_Node_T * +ACE_Timer_List_Iterator_T::item (void) +{ + if (! this->isdone()) + return this->current_node_; + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// + +// Return our instance of the iterator + +template ACE_Timer_Queue_Iterator_T & +ACE_Timer_List_T::iter (void) +{ + this->iterator_->first (); + return *this->iterator_; +} + +// Create an empty list. + +template +ACE_Timer_List_T::ACE_Timer_List_T (FUNCTOR* uf, FreeList* fl) + : Base(uf, fl) + , head_ (new ACE_Timer_Node_T) + , id_counter_ (0) +{ + ACE_TRACE ("ACE_Timer_List_T::ACE_Timer_List_T"); + + this->head_->set_next (this->head_); + this->head_->set_prev (this->head_); + + ACE_NEW (iterator_, Iterator(*this)); +} + + +// Checks if list is empty. + +template bool +ACE_Timer_List_T::is_empty (void) const +{ + ACE_TRACE ("ACE_Timer_List_T::is_empty"); + return this->get_first_i() == 0; +} + + +// Returns earliest time in a non-empty list. + +template const ACE_Time_Value & +ACE_Timer_List_T::earliest_time (void) const +{ + ACE_TRACE ("ACE_Timer_List_T::earliest_time"); + ACE_Timer_Node_T* first = this->get_first_i(); + if (first != 0) + return first->get_timer_value (); + return ACE_Time_Value::zero; +} + + +// Remove all remaining items in the list. + +template +ACE_Timer_List_T::~ACE_Timer_List_T (void) +{ + ACE_TRACE ("ACE_Timer_List_T::~ACE_Timer_List_T"); + ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); + + delete iterator_; + + if (!this->is_empty()) + { + for (ACE_Timer_Node_T* n = this->get_first(); + n != this->head_; + ) + { + this->upcall_functor ().deletion (*this, + n->get_type(), + n->get_act()); + + ACE_Timer_Node_T *next = + n->get_next (); + + this->free_node (n); + + n = next; + } + } + + // delete the dummy node + delete this->head_; +} + +template void +ACE_Timer_List_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Timer_List_T::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + int count = 0; + + ACE_Timer_Node_T* n = this->get_first_i(); + if (n != 0) { + for (; n != this->head_; n = n->get_next()) { + ++count; + } + } + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize_ = %d"), count)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + + +// Reschedule a periodic timer. This function must be called with the +// lock held. + +template void +ACE_Timer_List_T::reschedule (ACE_Timer_Node_T* n) +{ + ACE_TRACE ("ACE_Timer_List_T::reschedule"); + this->schedule_i(n, n->get_timer_value()); +} + + +// Insert a new handler that expires at time future_time; if interval +// is > 0, the handler will be reinvoked periodically. + +template long +ACE_Timer_List_T::schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_Timer_List_T::schedule_i"); + + ACE_Timer_Node_T* n = this->alloc_node(); + + if (n != 0) + { + long id = this->id_counter_++; + + if (id != -1) { + n->set (type, act, future_time, interval, 0, 0, id); + this->schedule_i (n, future_time); + } + return id; + } + + // Failure return + errno = ENOMEM; + return -1; +} + +/// The shared scheduling functionality between schedule() and reschedule() +template void +ACE_Timer_List_T::schedule_i (ACE_Timer_Node_T* n, + const ACE_Time_Value& expire) +{ + if (this->is_empty()) { + n->set_prev(this->head_); + n->set_next(this->head_); + this->head_->set_prev(n); + this->head_->set_next(n); + return; + } + + // We always want to search backwards from the tail of the list, because + // this minimizes the search in the extreme case when lots of timers are + // scheduled for exactly the same time, and it also assumes that most of + // the timers will be scheduled later than existing timers. + ACE_Timer_Node_T* p = this->head_->get_prev(); + while (p != this->head_ && p->get_timer_value() > expire) + p = p->get_prev(); + + // insert after + n->set_prev(p); + n->set_next(p->get_next()); + p->get_next()->set_prev(n); + p->set_next(n); +} + +template +ACE_Timer_Node_T* +ACE_Timer_List_T::find_node (long timer_id) const +{ + ACE_Timer_Node_T* n = this->get_first_i(); + if (n == 0) + return 0; + + for (; n != this->head_; n = n->get_next()) { + if (n->get_timer_id() == timer_id) { + return n; + } + } + return 0; +} + +// Locate and update the inteval on the timer_id +template int +ACE_Timer_List_T::reset_interval (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_Timer_List_T::reset_interval"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + ACE_Timer_Node_T* n = this->find_node(timer_id); + if (n != 0) { + n->set_interval(interval); // The interval will take effect the next time this node is expired. + return 0; + } + return -1; +} + +// Locate and remove the single with a value of +// @a timer_id from the timer queue. +template int +ACE_Timer_List_T::cancel (long timer_id, + const void **act, + int skip_close) +{ + ACE_TRACE ("ACE_Timer_List_T::cancel"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + ACE_Timer_Node_T* n = this->find_node(timer_id); + if (n != 0) + { + if (act != 0) + *act = n->get_act (); + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + n->get_type (), + skip_close, + cookie); + + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + n->get_type (), + skip_close, + cookie); + + this->cancel_i (n); + + return 1; + } + + return 0; +} + +// Locate and remove all values of from the timer queue. +template int +ACE_Timer_List_T::cancel (const TYPE &type, int skip_close) +{ + ACE_TRACE ("ACE_Timer_List_T::cancel"); + + int num_canceled = 0; // Note : Technically this can overflow. + + int cookie = 0; + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + if (!this->is_empty ()) + { + for (ACE_Timer_Node_T* n = this->get_first(); + n != this->head_; + ) + { + if (n->get_type() == type) // Note: Typically Type is an ACE_Event_Handler* + { + ++num_canceled; + + ACE_Timer_Node_T* tmp = n; + n = n->get_next(); + + this->cancel_i (tmp); + } + else + { + n = n->get_next(); + } + } + } + + // Call the close hooks. + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + type, + skip_close, + cookie); + + for (int i = 0; + i < num_canceled; + ++i) + { + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + type, + skip_close, + cookie); + } + + return num_canceled; +} + +template void +ACE_Timer_List_T::unlink (ACE_Timer_Node_T* n) +{ + n->get_prev()->set_next(n->get_next()); + n->get_next()->set_prev(n->get_prev()); + n->set_prev(0); + n->set_next(0); +} + +/// Shared subset of the two cancel() methods. +template void +ACE_Timer_List_T::cancel_i (ACE_Timer_Node_T* n) +{ + this->unlink (n); + this->free_node (n); +} + +// Reads the first node on the list and returns it. +template ACE_Timer_Node_T * +ACE_Timer_List_T::get_first (void) +{ + ACE_TRACE ("ACE_Timer_List_T::get_first"); + return this->get_first_i(); +} + +template ACE_Timer_Node_T * +ACE_Timer_List_T::get_first_i (void) const +{ + ACE_TRACE ("ACE_Timer_List_T::get_first_i"); + ACE_Timer_Node_T* first = this->head_->get_next(); + if (first != this->head_) // Note : is_empty() uses get_first() + return first; + return 0; +} + + +// Removes the first node on the list and returns it. + +template ACE_Timer_Node_T * +ACE_Timer_List_T::remove_first (void) +{ + ACE_TRACE ("ACE_Timer_List_T::remove_first"); + ACE_Timer_Node_T* first = this->get_first(); + if (first != 0) { + this->unlink(first); + return first; + } + return 0; +} + +#endif /* ACE_TIMER_LIST_T_C */ diff --git a/externals/ace/Timer_List_T.h b/externals/ace/Timer_List_T.h new file mode 100644 index 0000000..cabd47a --- /dev/null +++ b/externals/ace/Timer_List_T.h @@ -0,0 +1,226 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Timer_List_T.h + * + * $Id: Timer_List_T.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TIMER_LIST_T_H +#define ACE_TIMER_LIST_T_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_Queue_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Forward declaration. +template +class ACE_Timer_List_T; + +/** + * @class ACE_Timer_List_Iterator_T + * + * @brief Iterates over an ACE_Timer_List. + * + * This is a generic iterator that can be used to visit every + * node of a timer queue. + */ +template +class ACE_Timer_List_Iterator_T +: public ACE_Timer_Queue_Iterator_T +{ +public: + typedef ACE_Timer_List_T List; + /// Constructor. + ACE_Timer_List_Iterator_T (List& lst); + + /// Destructor. + virtual ~ACE_Timer_List_Iterator_T (void); + + /// Positions the iterator at the earliest node in the Timer Queue + virtual void first (void); + + /// Positions the iterator at the next node in the Timer Queue + virtual void next (void); + + /// Returns true when there are no more nodes in the sequence + virtual bool isdone (void) const; + + /// Returns the node at the current position in the sequence + virtual ACE_Timer_Node_T *item (void); + +protected: + /// Pointer to the ACE_Timer_List that we are iterating over. + List& list_; + + /// Current position in the ACE_Timer_List + ACE_Timer_Node_T* current_node_; +}; + +/** + * @class ACE_Timer_List_T + * + * @brief Provides a simple implementation of timers. + * + * This implementation uses a linked list of absolute times. + * Therefore, in the average case, scheduling and canceling + * timers is O(N) (where N is the total number of timers) and + * expiring timers is O(K) (where K is the total number of timers + * that are < the current time of day). + * More clever implementations could use a delta-list, a heap, + * or timing wheels, etc. For instance, ACE_Timer_Heap + * is a subclass of ACE_Timer_List that implements a + * heap-based callout queue. For most applications, the + * ACE_Timer_Heap will perform substantially faster than the + * ACE_Timer_List. + */ +template +class ACE_Timer_List_T : public ACE_Timer_Queue_T +{ +public: + /// Type of iterator + typedef ACE_Timer_List_Iterator_T Iterator; + + /// Iterator is a friend + friend class ACE_Timer_List_Iterator_T; + + typedef ACE_Timer_Node_T Node; + /// Type inherited from + typedef ACE_Timer_Queue_T Base; + typedef ACE_Free_List FreeList; + + // = Initialization and termination methods. + /** + * Default constructor. @a upcall_functor is the instance of the + * FUNCTOR to be used by the list. If @a upcall_functor is 0, a + * default FUNCTOR will be created. @a freelist is the freelist of + * timer nodes. If 0, then a default freelist will be created. + */ + ACE_Timer_List_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0); + + /// Destructor + virtual ~ACE_Timer_List_T (void); + + /// True if queue is empty, else false. + virtual bool is_empty (void) const; + + /// Returns the time of the earlier node in the ACE_Timer_List. + /// Must be called on a non-empty queue. + virtual const ACE_Time_Value& earliest_time (void) const; + + /** + * Resets the interval of the timer represented by @a timer_id to + * @a interval, which is specified in relative time to the current + * . If @a interval is equal to + * ACE_Time_Value::zero, the timer will become a non-rescheduling + * timer. Returns 0 if successful, -1 if not. + */ + virtual int reset_interval (long timer_id, + const ACE_Time_Value& interval); + + /** + * Cancel all timers associated with @a type. If dont_call_handle_close is 0 + * then the @a functor will be invoked. Returns the number of timers + * cancelled. + */ + virtual int cancel (const TYPE& type, + int dont_call_handle_close = 1); + + /** + * Cancel the single timer that matches the @a timer_id value (which + * was returned from the method). If act is non-NULL + * then it will be set to point to the ``magic cookie'' argument + * passed in when the timer was registered. This makes it possible + * to free up the memory and avoid memory leaks. If is + * 0 then the will be invoked. Returns 1 if cancellation + * succeeded and 0 if the @a timer_id wasn't found. + */ + virtual int cancel (long timer_id, + const void** act = 0, + int dont_call_handle_close = 1); + + /// Returns a pointer to this ACE_Timer_Queue's iterator. + virtual ACE_Timer_Queue_Iterator_T& iter (void); + + /// Removes the earliest node from the queue and returns it + virtual ACE_Timer_Node_T* remove_first (void); + + /// Dump the state of an object. + virtual void dump (void) const; + + /// Reschedule an "interval" ACE_Timer_Node_T. This should be private + /// but for now it needs to be public for + virtual void reschedule (ACE_Timer_Node_T *); + + /// Reads the earliest node from the queue and returns it. + virtual ACE_Timer_Node_T* get_first (void); + +private: + + /** + * Schedule @a type that will expire at @a future_time, which is + * specified in absolute time. If it expires then @a act is passed + * in as the value to the . If @a interval is != to + * ACE_Time_Value::zero then it is used to reschedule the @a type + * automatically, using relative time to the current . + * This method returns a that uniquely identifies the the + * @a type entry in an internal list. This can be used to + * cancel the timer before it expires. The cancellation ensures + * that are unique up to values of greater than 2 + * billion timers. As long as timers don't stay around longer than + * this there should be no problems with accidentally deleting the + * wrong timer. Returns -1 on failure (which is guaranteed never to + * be a valid ). + */ + virtual long schedule_i (const TYPE& type, + const void* act, + const ACE_Time_Value& future_time, + const ACE_Time_Value& interval); + + void schedule_i(ACE_Timer_Node_T* n, const ACE_Time_Value& exp); + + ACE_Timer_Node_T* find_node(long timer_id) const; + + void cancel_i (ACE_Timer_Node_T* n); + + void unlink (ACE_Timer_Node_T* n); + + ACE_Timer_Node_T* get_first_i(void) const; + +private: + + /// Pointer to linked list of . + ACE_Timer_Node_T* head_; + + /// Iterator used to expire timers. + Iterator* iterator_; + + /** + * Keeps track of the timer id that uniquely identifies each timer. + * This id can be used to cancel a timer via the + * method. + */ + long id_counter_; + + // = Don't allow these operations for now. + ACE_UNIMPLEMENTED_FUNC (ACE_Timer_List_T (const ACE_Timer_List_T &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_List_T &)) +}; + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Timer_List_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Timer_List_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_LIST_T_H */ diff --git a/externals/ace/Timer_Queue.h b/externals/ace/Timer_Queue.h new file mode 100644 index 0000000..4644aa1 --- /dev/null +++ b/externals/ace/Timer_Queue.h @@ -0,0 +1,52 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_Queue.h + * + * $Id: Timer_Queue.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + * @author Irfan Pyarali + */ +//============================================================================= + +#ifndef ACE_TIMER_QUEUE_H +#define ACE_TIMER_QUEUE_H + +#include /**/ "ace/pre.h" + +#include "ace/Synch_Traits.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Timer_Queuefwd.h" +#include "ace/Timer_Queue_T.h" +#if defined (ACE_HAS_THREADS) +# include "ace/Recursive_Thread_Mutex.h" +#else +# include "ace/Null_Mutex.h" +#endif /* ACE_HAS_THREADS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedef are here for ease of use and backward +// compatibility. +typedef ACE_Timer_Node_Dispatch_Info_T + ACE_Timer_Node_Dispatch_Info; + +typedef ACE_Timer_Node_T + ACE_Timer_Node; + +typedef ACE_Timer_Queue_Iterator_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_Queue_Iterator; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_TIMER_QUEUE_H */ diff --git a/externals/ace/Timer_Queue_Adapters.cpp b/externals/ace/Timer_Queue_Adapters.cpp new file mode 100644 index 0000000..54e8f8a --- /dev/null +++ b/externals/ace/Timer_Queue_Adapters.cpp @@ -0,0 +1,361 @@ +// $Id: Timer_Queue_Adapters.cpp 89482 2010-03-15 07:58:50Z johnnyw $ + +#ifndef ACE_TIMER_QUEUE_ADAPTERS_CPP +#define ACE_TIMER_QUEUE_ADAPTERS_CPP + +#include "ace/Timer_Queue_Adapters.h" + +#if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) +#include "ace/Functor.h" +#endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +# if !defined (__ACE_INLINE__) +# include "ace/Timer_Queue_Adapters.inl" +# endif /* __ACE_INLINE__ */ + +#include "ace/Signal.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_sys_time.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template TQ & +ACE_Async_Timer_Queue_Adapter::timer_queue (void) +{ + return this->timer_queue_; +} + +template int +ACE_Async_Timer_Queue_Adapter::cancel (long timer_id, + const void **act) +{ + // Block designated signals. + ACE_Sig_Guard sg (&this->mask_); + ACE_UNUSED_ARG (sg); + + return this->timer_queue_.cancel (timer_id, act); +} + +template int +ACE_Async_Timer_Queue_Adapter::expire (void) +{ + // Block designated signals. + ACE_Sig_Guard sg (&this->mask_); + ACE_UNUSED_ARG (sg); + + return this->timer_queue_.expire (); +} + +template int +ACE_Async_Timer_Queue_Adapter::schedule_ualarm (void) +{ + ACE_Time_Value tv = this->timer_queue_.earliest_time () + - this->timer_queue_.gettimeofday (); + + // Beware of negative times and zero times (which cause problems for + // ). + if (tv < ACE_Time_Value::zero) + tv = ACE_Time_Value (0, 1); + + // @@ This code should be clever enough to avoid updating the + // if we haven't actually changed the earliest time. + // Schedule a new timer. + ACE_OS::ualarm (tv); + return 0; +} + +template long +ACE_Async_Timer_Queue_Adapter::schedule (TYPE eh, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) +{ + ACE_UNUSED_ARG (act); + ACE_UNUSED_ARG (interval); + + // Block designated signals. + ACE_Sig_Guard sg (&this->mask_); + ACE_UNUSED_ARG (sg); + + // @@ We still need to implement interval timers... + long tid = this->timer_queue_.schedule (eh, act, future_time); + + if (tid == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("schedule_timer")), + -1); + + if (this->schedule_ualarm () == -1) + return 0; + + return tid; +} + +template +ACE_Async_Timer_Queue_Adapter::ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask) + // If == 0, block *all* signals when the SIGARLM handler is + // running, else just block those in the mask. + : mask_ (mask) +{ + // The following code is necessary to selectively "block" certain + // signals when SIGALRM is running. Also, we always restart system + // calls that are interrupted by the signals. + + ACE_Sig_Action sa ((ACE_SignalHandler) 0, + this->mask_, + SA_RESTART); + + if (this->sig_handler_.register_handler (SIGALRM, this, &sa) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("register_handler"))); +} + +// This is the signal handler function for the asynchronous timer +// list. It gets invoked asynchronously when the SIGALRM signal +// occurs. + +template int +ACE_Async_Timer_Queue_Adapter::handle_signal (int signum, + siginfo_t *, + ucontext_t *) +{ + switch (signum) + { + case SIGALRM: + { + // Expire the pending timers. + + // @@ We need to figure out how to implement interval + // timers... + this->timer_queue_.expire (); + + // Only schedule a new timer if there is one in the list. + + // @@ This code should also become smarter to avoid + // unnecessary calls to ualarm(). + if (this->timer_queue_.is_empty () == 0) + return this->schedule_ualarm (); + else + return 0; + /* NOTREACHED */ + } + default: + ACE_ERROR_RETURN ((LM_ERROR, + "unexpected signal %S\n", + signum), + -1); + /* NOTREACHED */ + } +} + +template +ACE_Thread_Timer_Queue_Adapter::ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager *tm, + TQ* timer_queue) + : ACE_Task_Base (tm), + timer_queue_(timer_queue), + delete_timer_queue_(false), + condition_ (mutex_), + active_ (true), // Assume that we start in active mode. + thr_id_ (ACE_OS::NULL_thread) +{ + if (timer_queue_ == 0) + { + ACE_NEW (this->timer_queue_, + TQ); + this->delete_timer_queue_ = true; + } +} + +template +ACE_Thread_Timer_Queue_Adapter::~ACE_Thread_Timer_Queue_Adapter (void) +{ + if (this->delete_timer_queue_) + { + delete this->timer_queue_; + this->timer_queue_ = 0; + this->delete_timer_queue_ = false; + } +} + +template ACE_SYNCH_RECURSIVE_MUTEX & +ACE_Thread_Timer_Queue_Adapter::mutex (void) +{ + return this->mutex_; +} + +template long +ACE_Thread_Timer_Queue_Adapter::schedule + (TYPE handler, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) +{ + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_, -1); + + long result = this->timer_queue_->schedule (handler, act, future_time, interval); + this->condition_.signal (); + return result; +} + +template int +ACE_Thread_Timer_Queue_Adapter::cancel (long timer_id, + const void **act) +{ + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_, -1); + + int result = this->timer_queue_->cancel (timer_id, act); + condition_.signal (); + return result; +} + +template void +ACE_Thread_Timer_Queue_Adapter::deactivate (void) +{ + ACE_GUARD (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_); + + this->active_ = false; + this->condition_.signal (); +} + +template int +ACE_Thread_Timer_Queue_Adapter::svc (void) +{ + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mutex_, -1); + + this->thr_id_ = ACE_Thread::self (); + + // Thread cancellation point, if ACE supports it. + // + // Note: This call generates a warning under Solaris because the header + // file /usr/include/pthread.h redefines the routine argument. This + // is a bug in the Solaris header files and has nothing to do with + // ACE. +# if !defined (ACE_LACKS_PTHREAD_CANCEL) + ACE_PTHREAD_CLEANUP_PUSH (&this->condition_.mutex ().get_nesting_mutex ()); +# endif /* ACE_LACKS_PTHREAD_CANCEL */ + + while (this->active_) + { +# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) + // Temporarily suspend ownership of the timer queue mutex in + // order to dispatch deferred execution commands. These + // commands are to be treated as executing in a context + // "external" to the timer queue adapter, and thus must compete + // separately for this lock. + mutex_.release (); + this->dispatch_commands (); + + // Re-acquire ownership of the timer queue mutex in order to + // restore the "internal" timer queue adapter context + mutex_.acquire (); +# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ + + // If the queue is empty, sleep until there is a change on it. + if (this->timer_queue_->is_empty ()) + this->condition_.wait (); + else + { + // Compute the remaining time, being careful not to sleep + // for "negative" amounts of time. + ACE_Time_Value const tv_curr = this->timer_queue_->gettimeofday (); + ACE_Time_Value const tv_earl = this->timer_queue_->earliest_time (); + + if (tv_earl > tv_curr) + { + // The earliest time on the Timer_Queue is in future, so + // use ACE_OS::gettimeofday() to convert the tv to the + // absolute time. + ACE_Time_Value const tv = ACE_OS::gettimeofday () + (tv_earl - tv_curr); + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting until %u.%3.3u secs\n"), + // tv.sec(), tv.msec())); + this->condition_.wait (&tv); + } + } + + // Expire timers anyway, at worst this is a no-op. + this->timer_queue_->expire (); + } + + // Thread cancellation point, if ACE supports it. +# if !defined (ACE_LACKS_PTHREAD_CANCEL) + ACE_PTHREAD_CLEANUP_POP (0); +# endif /* ACE_LACKS_PTHREAD_CANCEL */ + + return 0; +} + +template int +ACE_Thread_Timer_Queue_Adapter::activate (long flags, + int , + int , + long priority, + int grp_id, + ACE_Task_Base *task, + ACE_hthread_t [], + void *stack[], + size_t stack_size[], + ACE_thread_t thread_ids[], + const char* thr_name[]) +{ + // Make sure to set this flag in case we were deactivated earlier. + this->active_ = true; + + // Make sure that we only allow a single thread to be spawned for + // our adapter. Otherwise, too many weird things can happen. + return ACE_Task_Base::activate (flags, 1, 0, priority, grp_id, task, 0, + stack, stack_size, thread_ids, thr_name); +} + +# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) + +// Enqueues a command object for execution just before waiting on the next +// timer event. This allows deferred execution of commands that cannot +// be performed in the timer event handler context, such as registering +// or cancelling timers on platforms where the timer queue mutex is not +// recursive. + +template int +ACE_Thread_Timer_Queue_Adapter::enqueue_command (ACE_Command_Base *cmd, + COMMAND_ENQUEUE_POSITION pos) +{ + // Serialize access to the command queue. + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->command_mutex_, -1); + + if (pos == ACE_Thread_Timer_Queue_Adapter::TAIL) + return command_queue_.enqueue_tail (cmd); + else + return command_queue_.enqueue_head (cmd); +} + +// Dispatches all command objects enqueued in the most recent event +// handler context. + +template int +ACE_Thread_Timer_Queue_Adapter::dispatch_commands (void) +{ + // Serialize access to the command queue. + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->command_mutex_, -1); + + // loop through the enqueued commands + ACE_Command_Base *cmd = 0; + while (command_queue_.dequeue_head (cmd) == 0) + if (cmd) + { + cmd->execute (); + delete cmd; + } + + return 0; +} + +# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_QUEUE_ADAPTERS_CPP */ diff --git a/externals/ace/Timer_Queue_Adapters.h b/externals/ace/Timer_Queue_Adapters.h new file mode 100644 index 0000000..d556171 --- /dev/null +++ b/externals/ace/Timer_Queue_Adapters.h @@ -0,0 +1,261 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_Queue_Adapters.h + * + * $Id: Timer_Queue_Adapters.h 89482 2010-03-15 07:58:50Z johnnyw $ + * + * @author Douglas C. Schmidt and + * Carlos O'Ryan + */ +//============================================================================= + +#ifndef ACE_TIMER_QUEUE_ADAPTERS_H +#define ACE_TIMER_QUEUE_ADAPTERS_H +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Signal.h" +#include "ace/Sig_Handler.h" +#include "ace/Condition_Recursive_Thread_Mutex.h" + +#if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) +# include "ace/Unbounded_Queue.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Command_Base; +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Sig_Set; + +/** + * @class ACE_Async_Timer_Queue_Adapter + * + * @brief Adapts an ACE timer queue to be driven asynchronously using signals. + * + * This implementation uses the ACE_OS::ualarm call, to generate + * the SIGARLM signal that is caught by this class. + * + * @note This adapter only works on platforms that support ualarm(). + * POSIX platforms generally do; Windows and some others do not. + * + * @todo This adapter does not automatically reschedule repeating timers. + */ +template +class ACE_Async_Timer_Queue_Adapter : public ACE_Event_Handler +{ +public: + typedef TQ TIMER_QUEUE; + + /// Constructor + /** + * Register the SIGALRM handler. If @a mask == 0 then block all + * signals when @c SIGALRM is run. Otherwise, just block the signals + * indicated in @a mask. + */ + ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask = 0); + + /// Schedule the timer according to the semantics of the + /// ACE_Timer_List. + /** + * This timer gets dispatched via a signal, rather than by a user + * calling expire(). Note that interval timers are not implemented + * yet. + */ + long schedule (TYPE type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval = ACE_Time_Value::zero); + + /// Cancel the @a timer_id and pass back the @a act if an address is + /// passed in. + int cancel (long timer_id, const void **act = 0); + + /// Dispatch all timers with expiry time at or before the current time. + /// Returns the number of timers expired. + int expire (void); + + /// Return a reference to the underlying timer queue. + TQ &timer_queue (void); + +private: + /// Perform the logic to compute the new ualarm(2) setting. + virtual int schedule_ualarm (void); + + /// Called back by @c SIGALRM handler. + virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); + + /// Handler for the @c SIGALRM signal, so that we can access our state + /// without requiring any global variables. + ACE_Sig_Handler sig_handler_; + + /// Implementation of the timer queue (e.g., ACE_Timer_List, + /// ACE_Timer_Heap, etc.). + TQ timer_queue_; + + /// Mask of signals to be blocked when we're servicing @c SIGALRM. + ACE_Sig_Set mask_; +}; + +/** + * @class ACE_Thread_Timer_Queue_Adapter + * + * @brief Adapts an ACE timer queue using a separate thread for dispatching. + * + * This implementation uses a separate thread to dispatch the timers. + * The base queue need not be thread safe; this class takes all the + * necessary locks. + * + * @note This is a case where template parameters will be useful, but + * (IMHO) the effort and portability problems discourage their + * use. + * + */ +template +class ACE_Thread_Timer_Queue_Adapter : public ACE_Task_Base +{ +public: + /// Trait for the underlying queue type. + typedef TQ TIMER_QUEUE; + +# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) + + /// Typedef for the position at which to enqueue a deferred + /// execution command. + enum COMMAND_ENQUEUE_POSITION {HEAD, TAIL}; + +# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ + + /// Creates the timer queue. Activation of the task is the user's + /// responsibility. Optionally a pointer to a timer queue can be passed, + /// when no pointer is passed, a TQ is dynamically created + ACE_Thread_Timer_Queue_Adapter (ACE_Thread_Manager * = ACE_Thread_Manager::instance (), + TQ* timer_queue = 0); + + /// Destructor. + virtual ~ACE_Thread_Timer_Queue_Adapter (void); + + /// Schedule the timer according to the semantics of the ; wakes + /// up the dispatching thread. + long schedule (TYPE handler, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval = ACE_Time_Value::zero); + + /// Cancel the @a timer_id and return the @a act parameter if an + /// address is passed in. Also wakes up the dispatching thread. + int cancel (long timer_id, const void **act = 0); + + /// Runs the dispatching thread. + virtual int svc (void); + + /// Inform the dispatching thread that it should terminate. + virtual void deactivate (void); + + /// Access the locking mechanism, useful for iteration. + ACE_SYNCH_RECURSIVE_MUTEX &mutex (void); + + /// Set a user-specified timer queue. + int timer_queue (TQ *tq); + + /// Return the current . + TQ *timer_queue (void) const; + + /// Return the thread id of our active object. + ACE_thread_t thr_id (void) const; + + /** + * We override the default activate() method so that we can ensure + * that only a single thread is ever spawned. Otherwise, too many + * weird things can happen... + */ + virtual int activate (long flags = THR_NEW_LWP | THR_JOINABLE, + int n_threads = 1, + int force_active = 0, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + ACE_Task_Base *task = 0, + ACE_hthread_t thread_handles[] = 0, + void *stack[] = 0, + size_t stack_size[] = 0, + ACE_thread_t thread_ids[] = 0, + const char* thr_name[] = 0); + +# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) + + /** + * Enqueues a command object for execution just before waiting on the next + * timer event. This allows deferred execution of commands that cannot + * be performed in the timer event handler context, such as registering + * or cancelling timers on platforms where the timer queue mutex is not + * recursive. + */ + int enqueue_command (ACE_Command_Base *command_, + COMMAND_ENQUEUE_POSITION pos = TAIL); + +# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ + +private: + +# if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) + /// Dispatches all command objects enqueued in the most + /// recent event handler context. + int dispatch_commands (void); + + /// Queue of commands for deferred execution. + ACE_Unbounded_Queue command_queue_; + + /// The mutual exclusion mechanism for the command queue. + ACE_SYNCH_MUTEX command_mutex_; +# endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ + + /// The underlying Timer_Queue. + TQ* timer_queue_; + + /// Keeps track of whether we should delete the timer queue (if we + /// didn't create it, then we don't delete it). + bool delete_timer_queue_; + + /// The mutual exclusion mechanism that is required to use the + /// . + ACE_SYNCH_RECURSIVE_MUTEX mutex_; + + /** + * The dispatching thread sleeps on this condition while waiting to + * dispatch the next timer; it is used to wake it up if there is a + * change on the timer queue. + */ + ACE_SYNCH_RECURSIVE_CONDITION condition_; + + /// When deactivate is called this variable turns to false and the + /// dispatching thread is signalled, to terminate its main loop. + bool active_; + + /// Thread id of our active object task. + ACE_thread_t thr_id_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +# include "ace/Timer_Queue_Adapters.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +# include "ace/Timer_Queue_Adapters.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +# pragma implementation ("Timer_Queue_Adapters.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_QUEUE_ADAPTERS_H */ diff --git a/externals/ace/Timer_Queue_Adapters.inl b/externals/ace/Timer_Queue_Adapters.inl new file mode 100644 index 0000000..d73ef02 --- /dev/null +++ b/externals/ace/Timer_Queue_Adapters.inl @@ -0,0 +1,29 @@ +// -*- C++ -*- +// +// $Id: Timer_Queue_Adapters.inl 89482 2010-03-15 07:58:50Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE TQ * +ACE_Thread_Timer_Queue_Adapter::timer_queue (void) const +{ + return this->timer_queue_; +} + +template ACE_INLINE int +ACE_Thread_Timer_Queue_Adapter::timer_queue (TQ *tq) +{ + if (this->delete_timer_queue_) + delete this->timer_queue_; + this->timer_queue_ = tq; + this->delete_timer_queue_ = false; + return 0; +} + +template ACE_INLINE ACE_thread_t +ACE_Thread_Timer_Queue_Adapter::thr_id (void) const +{ + return this->thr_id_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Timer_Queue_T.cpp b/externals/ace/Timer_Queue_T.cpp new file mode 100644 index 0000000..258e68e --- /dev/null +++ b/externals/ace/Timer_Queue_T.cpp @@ -0,0 +1,538 @@ +// $Id: Timer_Queue_T.cpp 89254 2010-02-25 22:10:39Z cleeland $ + +#ifndef ACE_TIMER_QUEUE_T_CPP +#define ACE_TIMER_QUEUE_T_CPP + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/* + * Hook to specialize to add includes + */ +//@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK + +#include "ace/Timer_Queue_T.h" +#include "ace/Guard_T.h" +#include "ace/Log_Msg.h" +#include "ace/Reactor_Timer_Interface.h" +#include "ace/Null_Mutex.h" +#include "ace/OS_NS_sys_time.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Timer_Queue_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// This fudge factor can be overriden for timers that need it, such as on +// Solaris, by defining the ACE_TIMER_SKEW symbol in the appropriate config +// header. +#if !defined (ACE_TIMER_SKEW) +# define ACE_TIMER_SKEW 0 +#endif /* ACE_TIMER_SKEW */ + +template void +ACE_Timer_Node_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Timer_Node_T::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nact_ = %x"), this->act_)); + this->timer_value_.dump (); + this->interval_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nprev_ = %x"), this->prev_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntimer_id_ = %d\n"), this->timer_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Timer_Node_T::ACE_Timer_Node_T (void) +{ + ACE_TRACE ("ACE_Timer_Node_T::ACE_Timer_Node_T"); +} + +template +ACE_Timer_Node_T::~ACE_Timer_Node_T (void) +{ + ACE_TRACE ("ACE_Timer_Node_T::~ACE_Timer_Node_T"); +} + +template +ACE_Timer_Queue_Iterator_T::ACE_Timer_Queue_Iterator_T (void) +{ +} + +template +ACE_Timer_Queue_Iterator_T::~ACE_Timer_Queue_Iterator_T (void) +{ +} + +template ACE_Time_Value * +ACE_Timer_Queue_T::calculate_timeout (ACE_Time_Value *max_wait_time) +{ + ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, max_wait_time)); + + if (this->is_empty ()) + // Nothing on the Timer_Queue, so use whatever the caller gave us. + return max_wait_time; + else + { + ACE_Time_Value const cur_time = this->gettimeofday (); + + if (this->earliest_time () > cur_time) + { + // The earliest item on the Timer_Queue is still in the + // future. Therefore, use the smaller of (1) caller's wait + // time or (2) the delta time between now and the earliest + // time on the Timer_Queue. + + this->timeout_ = this->earliest_time () - cur_time; + if (max_wait_time == 0 || *max_wait_time > timeout_) + return &this->timeout_; + else + return max_wait_time; + } + else + { + // The earliest item on the Timer_Queue is now in the past. + // Therefore, we've got to "poll" the Reactor, i.e., it must + // just check the descriptors and then dispatch timers, etc. + this->timeout_ = ACE_Time_Value::zero; + return &this->timeout_; + } + } +} + +template ACE_Time_Value * +ACE_Timer_Queue_T::calculate_timeout (ACE_Time_Value *max_wait_time, + ACE_Time_Value *the_timeout) +{ + ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); + + if (the_timeout == 0) + return 0; + + if (this->is_empty ()) + { + // Nothing on the Timer_Queue, so use whatever the caller gave us. + if (max_wait_time) + *the_timeout = *max_wait_time; + else + return 0; + } + else + { + ACE_Time_Value cur_time = this->gettimeofday (); + + if (this->earliest_time () > cur_time) + { + // The earliest item on the Timer_Queue is still in the + // future. Therefore, use the smaller of (1) caller's wait + // time or (2) the delta time between now and the earliest + // time on the Timer_Queue. + + *the_timeout = this->earliest_time () - cur_time; + if (!(max_wait_time == 0 || *max_wait_time > *the_timeout)) + *the_timeout = *max_wait_time; + } + else + { + // The earliest item on the Timer_Queue is now in the past. + // Therefore, we've got to "poll" the Reactor, i.e., it must + // just check the descriptors and then dispatch timers, etc. + *the_timeout = ACE_Time_Value::zero; + } + } + return the_timeout; +} + +template void +ACE_Timer_Queue_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Timer_Queue_T::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->timeout_.dump (); + this->timer_skew_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Timer_Queue_T::ACE_Timer_Queue_T (FUNCTOR *upcall_functor, + ACE_Free_List > *freelist) + : gettimeofday_ (ACE_OS::gettimeofday), + delete_upcall_functor_ (upcall_functor == 0), + delete_free_list_ (freelist == 0), + timer_skew_ (0, ACE_TIMER_SKEW) +{ + ACE_TRACE ("ACE_Timer_Queue_T::ACE_Timer_Queue_T"); + + if (!freelist) + ACE_NEW (free_list_, + (ACE_Locked_Free_List,ACE_Null_Mutex>)); + else + free_list_ = freelist; + + if (!upcall_functor) + ACE_NEW (upcall_functor_, + FUNCTOR); + else + upcall_functor_ = upcall_functor; +} + +template +ACE_Timer_Queue_T::~ACE_Timer_Queue_T (void) +{ + ACE_TRACE ("ACE_Timer_Queue_T::~ACE_Timer_Queue_T"); + + // Cleanup the functor and free_list on the way out + if (this->delete_upcall_functor_) + delete this->upcall_functor_; + + if (this->delete_free_list_) + delete this->free_list_; +} + +template ACE_Timer_Node_T * +ACE_Timer_Queue_T::alloc_node (void) +{ + return this->free_list_->remove (); +} + +template void +ACE_Timer_Queue_T::free_node (ACE_Timer_Node_T *node) +{ + this->free_list_->add (node); +} + +template ACE_LOCK & +ACE_Timer_Queue_T::mutex (void) +{ + return this->mutex_; +} + +template long +ACE_Timer_Queue_T::schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Schedule the timer. + long const result = + this->schedule_i (type, + act, + future_time, + interval); + + // Return on failure. + if (result == -1) + return result; + + // Inform upcall functor of successful registration. + this->upcall_functor ().registration (*this, + type, + act); + + // Return result; + return result; +} + +// Run the method for all Timers whose values are <= +// . +template int +ACE_Timer_Queue_T::expire (const ACE_Time_Value &cur_time) +{ + ACE_TRACE ("ACE_Timer_Queue_T::expire"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Keep looping while there are timers remaining and the earliest + // timer is <= the passed in to the method. + + if (this->is_empty ()) + return 0; + + int number_of_timers_expired = 0; + int result = 0; + + ACE_Timer_Node_Dispatch_Info_T info; + + while ((result = this->dispatch_info_i (cur_time, info)) != 0) + { + const void *upcall_act = 0; + + this->preinvoke (info, cur_time, upcall_act); + + this->upcall (info, cur_time); + + this->postinvoke (info, cur_time, upcall_act); + + ++number_of_timers_expired; + + } + + ACE_UNUSED_ARG (result); + return number_of_timers_expired; +} + +template void +ACE_Timer_Queue_T::recompute_next_abs_interval_time + (ACE_Timer_Node_T *expired, + const ACE_Time_Value &cur_time) +{ + if ( expired->get_timer_value () <= cur_time ) + { + /* + * Somehow the current time is past when this time was + * supposed to expire (e.g., timer took too long, + * somebody changed system time, etc.). There used to + * be a simple loop here that skipped ahead one timer + * interval at a time, but that was horribly inefficient + * (an O(n) algorithm) when the timer duration was small + * relative to the amount of time skipped. + * + * So, we replace the loop with a simple computation, + * which also happens to be O(1). All times get + * normalized in the computation to microseconds. + * + * For reference, the loop looked like this: + * + * do + * expired->set_timer_value (expired->get_timer_value () + + * expired->get_interval ()); + * while (expired->get_timer_value () <= cur_time); + * + */ + + // Compute the duration of the timer's interval + ACE_UINT64 interval_usec; + expired->get_interval ().to_usec (interval_usec); + + // Compute the span between the current time and when + // the timer would have expired in the past (and + // normalize to microseconds). + ACE_Time_Value old_diff = cur_time - expired->get_timer_value (); + ACE_UINT64 old_diff_usec; + old_diff.to_usec (old_diff_usec); + + // Compute the delta time in the future when the timer + // should fire as if it had advanced incrementally. The + // modulo arithmetic accomodates the likely case that + // the current time doesn't fall precisely on a timer + // firing interval. + ACE_UINT64 new_timer_usec = + interval_usec - (old_diff_usec % interval_usec); + + // Compute the absolute time in the future when this + // interval timer should expire. + ACE_Time_Value new_timer_value + (cur_time.sec () + + static_cast(new_timer_usec / ACE_ONE_SECOND_IN_USECS), + cur_time.usec () + + static_cast(new_timer_usec % ACE_ONE_SECOND_IN_USECS)); + + expired->set_timer_value (new_timer_value); + } +} + +template int +ACE_Timer_Queue_T::dispatch_info_i (const ACE_Time_Value &cur_time, + ACE_Timer_Node_Dispatch_Info_T &info) +{ + ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info_i"); + + if (this->is_empty ()) + return 0; + + ACE_Timer_Node_T *expired = 0; + + if (this->earliest_time () <= cur_time) + { + expired = this->remove_first (); + + // Get the dispatch info + expired->get_dispatch_info (info); + + // Check if this is an interval timer. + if (expired->get_interval () > ACE_Time_Value::zero) + { + // Make sure that we skip past values that have already + // "expired". + this->recompute_next_abs_interval_time (expired, cur_time); + + // Since this is an interval timer, we need to reschedule + // it. + this->reschedule (expired); + } + else + { + // Call the factory method to free up the node. + this->free_node (expired); + } + + return 1; + } + + return 0; +} + +template void +ACE_Timer_Queue_T::return_node (ACE_Timer_Node_T *node) +{ + ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); + this->free_node (node); +} + + +template +ACE_Event_Handler_Handle_Timeout_Upcall::ACE_Event_Handler_Handle_Timeout_Upcall (void) +{ +} + +template +ACE_Event_Handler_Handle_Timeout_Upcall::~ACE_Event_Handler_Handle_Timeout_Upcall (void) +{ +} + +template int +ACE_Event_Handler_Handle_Timeout_Upcall::registration (TIMER_QUEUE &, + ACE_Event_Handler *event_handler, + const void *) +{ + event_handler->add_reference (); + return 0; +} + +template int +ACE_Event_Handler_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE & /* timer_queue */, + ACE_Event_Handler *event_handler, + const void * /* timer_act */, + int /* recurring_timer */, + const ACE_Time_Value & /* cur_time */, + const void *&upcall_act) +{ + bool const requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + + upcall_act = &this->requires_reference_counting_; + } + + return 0; +} + +template int +ACE_Event_Handler_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE & /* timer_queue */, + ACE_Event_Handler *event_handler, + const void * /* timer_act */, + int /* recurring_timer */, + const ACE_Time_Value & /* cur_time */, + const void *upcall_act) +{ + if (upcall_act == &this->requires_reference_counting_) + { + event_handler->remove_reference (); + } + + return 0; +} + +template int +ACE_Event_Handler_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *event_handler, + const void *act, + int recurring_timer, + const ACE_Time_Value &cur_time) +{ + int requires_reference_counting = 0; + + if (!recurring_timer) + { + requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + } + + // Upcall to the s handle_timeout method. + if (event_handler->handle_timeout (cur_time, act) == -1) + { + if (event_handler->reactor_timer_interface ()) + event_handler->reactor_timer_interface ()->cancel_timer (event_handler, 0); + else + timer_queue.cancel (event_handler, 0); // 0 means "call handle_close()". + } + + if (!recurring_timer && + requires_reference_counting) + { + event_handler->remove_reference (); + } + + return 0; +} + +template int +ACE_Event_Handler_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &, + ACE_Event_Handler *event_handler, + int dont_call, + int &requires_reference_counting) +{ + requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + // Upcall to the s handle_close method + if (dont_call == 0) + event_handler->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::TIMER_MASK); + + return 0; +} + +template int +ACE_Event_Handler_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &, + ACE_Event_Handler *event_handler, + int, + int requires_reference_counting) +{ + if (requires_reference_counting) + event_handler->remove_reference (); + + return 0; +} + +template int +ACE_Event_Handler_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *event_handler, + const void *) +{ + int requires_reference_counting = 0; + + this->cancel_type (timer_queue, + event_handler, + 0, + requires_reference_counting); + + this->cancel_timer (timer_queue, + event_handler, + 0, + requires_reference_counting); + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_QUEUE_T_CPP */ diff --git a/externals/ace/Timer_Queue_T.h b/externals/ace/Timer_Queue_T.h new file mode 100644 index 0000000..5e316e1 --- /dev/null +++ b/externals/ace/Timer_Queue_T.h @@ -0,0 +1,566 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_Queue_T.h + * + * $Id: Timer_Queue_T.h 89254 2010-02-25 22:10:39Z cleeland $ + * + * @author Doug Schmidt + * @author Irfan Pyarali and + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_TIMER_QUEUE_T_H +#define ACE_TIMER_QUEUE_T_H +#include /**/ "ace/pre.h" + +#include "ace/Free_List.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Event_Handler.h" +#include "ace/Time_Value.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Timer_Node_Dispatch_Info_T + * + * @brief Maintains generated dispatch information for Timer nodes. + * + */ +template +class ACE_Timer_Node_Dispatch_Info_T +{ +public: + /// The type of object held in the queue + TYPE type_; + + /// Asynchronous completion token associated with the timer. + const void *act_; + + /// Flag to check if the timer is recurring. + int recurring_timer_; +}; + +/** + * @class ACE_Timer_Node_T + * + * @brief Maintains the state associated with a Timer entry. + */ +template +class ACE_Timer_Node_T +{ +public: + /// Default constructor + ACE_Timer_Node_T (void); + + /// Destructor + ~ACE_Timer_Node_T (void); + + /// Useful typedef .. + typedef ACE_Timer_Node_Dispatch_Info_T DISPATCH_INFO; + + /// Singly linked list + void set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T *n, + long timer_id); + + /// Doubly linked list version + void set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T *p, + ACE_Timer_Node_T *n, + long timer_id); + + // = Accessors + + /// Get the type. + TYPE &get_type (void); + + /// Set the type. + void set_type (TYPE &type); + + /// Get the asynchronous completion token. + const void *get_act (void); + + /// Set the asynchronous completion token. + void set_act (void *act); + + /// Get the timer value. + const ACE_Time_Value &get_timer_value (void) const; + + /// Set the timer value. + void set_timer_value (const ACE_Time_Value &timer_value); + + /// Get the timer interval. + const ACE_Time_Value &get_interval (void) const; + + /// Set the timer interval. + void set_interval (const ACE_Time_Value &interval); + + /// Get the previous pointer. + ACE_Timer_Node_T *get_prev (void); + + /// Set the previous pointer. + void set_prev (ACE_Timer_Node_T *prev); + + /// Get the next pointer. + ACE_Timer_Node_T *get_next (void); + + /// Set the next pointer. + void set_next (ACE_Timer_Node_T *next); + + /// Get the timer_id. + long get_timer_id (void) const; + + /// Set the timer_id. + void set_timer_id (long timer_id); + + /// Get the dispatch info. The dispatch information is got + /// through . This form helps us in preventing allocation and + /// deleting data along the criticl path. + /// @@TODO: We may want to have a copying version too, so that our + /// interface will be complete.. + void get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T &info); + + /// Dump the state of an TYPE. + void dump (void) const; + +private: + /// Type of object stored in the Queue + TYPE type_; + + /// Asynchronous completion token associated with the timer. + const void *act_; + + /// Time until the timer expires. + ACE_Time_Value timer_value_; + + /// If this is a periodic timer this holds the time until the next + /// timeout. + ACE_Time_Value interval_; + + /// Pointer to previous timer. + ACE_Timer_Node_T *prev_; + + /// Pointer to next timer. + ACE_Timer_Node_T *next_; + + /// Id of this timer (used to cancel timers before they expire). + long timer_id_; +}; + +/** + * @class ACE_Timer_Queue_Iterator_T + * + * @brief Generic interface for iterating over a subclass of + * ACE_Timer_Queue. + * + * This is a generic iterator that can be used to visit every + * node of a timer queue. Be aware that it isn't guaranteed + * that the transversal will be in order of timeout values. + */ +template +class ACE_Timer_Queue_Iterator_T +{ +public: + // = Initialization and termination methods. + /// Constructor. + ACE_Timer_Queue_Iterator_T (void); + + /// Destructor. + virtual ~ACE_Timer_Queue_Iterator_T (void); + + /// Positions the iterator at the earliest node in the Timer Queue + virtual void first (void) = 0; + + /// Positions the iterator at the next node in the Timer Queue + virtual void next (void) = 0; + + /// Returns true when there are no more nodes in the sequence + virtual bool isdone (void) const = 0; + + /// Returns the node at the current position in the sequence + virtual ACE_Timer_Node_T *item (void) = 0; +}; + +/** + * @class ACE_Timer_Queue_T + * + * @brief Provides an interface to timers. + * + * This is an abstract base class that provides hook for + * implementing specialized policies such as ACE_Timer_List + * and ACE_Timer_Heap. + */ +template +class ACE_Timer_Queue_T +{ +public: + /// Type of Iterator. + typedef ACE_Timer_Queue_Iterator_T ITERATOR; + + // = Initialization and termination methods. + /** + * Default constructor. @a upcall_functor is the instance of the + * FUNCTOR to be used by the queue. If @a upcall_functor is 0, Timer + * Queue will create a default FUNCTOR. @a freelist the freelist of + * timer nodes. If 0, then a default freelist will be created. + */ + ACE_Timer_Queue_T (FUNCTOR *upcall_functor = 0, + ACE_Free_List > *freelist = 0); + + /// Destructor - make virtual for proper destruction of inherited + /// classes. + virtual ~ACE_Timer_Queue_T (void); + + /// True if queue is empty, else false. + virtual bool is_empty (void) const = 0; + + /// Returns the time of the earlier node in the Timer_Queue. Must + /// be called on a non-empty queue. + virtual const ACE_Time_Value &earliest_time (void) const = 0; + + /** + * Schedule @a type that will expire at @a future_time, which is + * specified in absolute time. If it expires then @a act is passed + * in as the value to the . If @a interval is != to + * ACE_Time_Value::zero then it is used to reschedule the @a type + * automatically, using relative time to the current . + * This method returns a that uniquely identifies the the + * @a type entry in an internal list. This can be used to + * cancel the timer before it expires. The cancellation ensures + * that are unique up to values of greater than 2 + * billion timers. As long as timers don't stay around longer than + * this there should be no problems with accidentally deleting the + * wrong timer. Returns -1 on failure (which is guaranteed never to + * be a valid ). + */ + virtual long schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval = ACE_Time_Value::zero); + + /** + * Resets the interval of the timer represented by @a timer_id to + * @a interval, which is specified in relative time to the current + * . If @a interval is equal to + * ACE_Time_Value::zero, the timer will become a non-rescheduling + * timer. Returns 0 if successful, -1 if not. + */ + virtual int reset_interval (long timer_id, + const ACE_Time_Value &interval) = 0; + + /** + * Cancel all timer associated with @a type. If + * @a dont_call_handle_close is 0 then the will be invoked, + * which typically invokes the hook. Returns number + * of timers cancelled. + */ + virtual int cancel (const TYPE &type, + int dont_call_handle_close = 1) = 0; + + /** + * Cancel the single timer that matches the @a timer_id value (which + * was returned from the method). If act is non-NULL + * then it will be set to point to the ``magic cookie'' argument + * passed in when the timer was registered. This makes it possible + * to free up the memory and avoid memory leaks. If + * @a dont_call_handle_close is 0 then the will be invoked, + * which typically calls the hook. Returns 1 if + * cancellation succeeded and 0 if the @a timer_id wasn't found. + */ + virtual int cancel (long timer_id, + const void **act = 0, + int dont_call_handle_close = 1) = 0; + + /** + * Run the for all timers whose values are <= @a current_time. + * This does not account for . Returns the number of + * timers canceled. + */ + virtual int expire (const ACE_Time_Value ¤t_time); + + /** + * Get the dispatch information for a timer whose value is <= @a current_time. + * This does not account for . Returns 1 if + * there is a node whose value <= @a current_time else returns a 0. + * + */ + virtual int dispatch_info (const ACE_Time_Value ¤t_time, + ACE_Timer_Node_Dispatch_Info_T &info); + + /** + * Run the for all timers whose values are <= + * . Also accounts for . + * + * Depending on the resolution of the underlying OS the system calls + * like select()/poll() might return at time different than that is + * specified in the timeout. Suppose the OS guarantees a resolution of t ms. + * The timeline will look like + * + * A B + * | | + * V V + * |-------------|-------------|-------------|-------------| + * t t t t t + * + * + * If you specify a timeout value of A, then the timeout will not occur + * at A but at the next interval of the timer, which is later than + * that is expected. Similarly, if your timeout value is equal to B, + * then the timeout will occur at interval after B. Now depending upon the + * resolution of your timeouts and the accuracy of the timeouts + * needed for your application, you should set the value of + * . In the above case, if you want the timeout A to fire + * no later than A, then you should specify your to be + * A % t. + * + * The timeout value should be specified via the macro ACE_TIMER_SKEW + * in your config.h file. The default value is zero. + * + * Things get interesting if the t before the timeout value B is zero + * i.e your timeout is less than the interval. In that case, you are + * almost sure of not getting the desired timeout behaviour. Maybe you + * should look for a better OS :-) + * + * Returns the number of timers canceled. + */ + + /* virtual */ int expire (void); + + /** + * Returns the current time of day. This method allows different + * implementations of the timer queue to use special high resolution + * timers. + */ + /* virtual */ ACE_Time_Value gettimeofday (void); + + /// Allows applications to control how the timer queue gets the time + /// of day. + void gettimeofday (ACE_Time_Value (*gettimeofday)(void)); + + /// Determine the next event to timeout. Returns @a max if there are + /// no pending timers or if all pending timers are longer than max. + /// This method acquires a lock internally since it modifies internal state. + virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max); + + /** + * Determine the next event to timeout. Returns @a max if there are + * no pending timers or if all pending timers are longer than max. + * should be a pointer to storage for the timeout value, + * and this value is also returned. This method does not acquire a + * lock internally since it doesn't modify internal state. If you + * need to call this method when the queue is being modified + * concurrently, however, you should make sure to acquire the + * externally before making the call. + */ + virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max, + ACE_Time_Value *the_timeout); + + /// Set the timer skew for the Timer_Queue. + void timer_skew (const ACE_Time_Value &skew); + + /// Get the timer skew for the Timer_Queue. + const ACE_Time_Value &timer_skew (void) const; + + /// Synchronization variable used by the queue + ACE_LOCK &mutex (void); + + /// Accessor to the upcall functor + FUNCTOR &upcall_functor (void); + + /// Returns a pointer to this ACE_Timer_Queue's iterator. + virtual ITERATOR &iter (void) = 0; + + /// Removes the earliest node from the queue and returns it + virtual ACE_Timer_Node_T *remove_first (void) = 0; + + /// Dump the state of a object. + virtual void dump (void) const; + + /// Reads the earliest node from the queue and returns it. + virtual ACE_Timer_Node_T *get_first (void) = 0; + + /// Method used to return a timer node to the queue's ownership + /// after it is returned by a method like . + virtual void return_node (ACE_Timer_Node_T *); + + /// This method will call the preinvoke() on . + void preinvoke (ACE_Timer_Node_Dispatch_Info_T &info, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + + /// This method will call the timeout() on . + void upcall (ACE_Timer_Node_Dispatch_Info_T &info, + const ACE_Time_Value &cur_time); + + /// This method will call the postinvoke() on . + void postinvoke (ACE_Timer_Node_Dispatch_Info_T &info, + const ACE_Time_Value &cur_time, + const void *upcall_act); + +protected: + + /// Schedule a timer. + virtual long schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) = 0; + + /// Reschedule an "interval" ACE_Timer_Node. + virtual void reschedule (ACE_Timer_Node_T *) = 0; + + /// Factory method that allocates a new node. + virtual ACE_Timer_Node_T *alloc_node (void); + + /// Factory method that frees a previously allocated node. + virtual void free_node (ACE_Timer_Node_T *); + + /// Non-locking version of dispatch_info () + virtual int dispatch_info_i (const ACE_Time_Value ¤t_time, + ACE_Timer_Node_Dispatch_Info_T &info); + + /// Recompute when the next time is that this interval timer should fire. + void recompute_next_abs_interval_time (ACE_Timer_Node_T* expired, + const ACE_Time_Value &cur_time); + + /// Synchronization variable for ACE_Timer_Queue. + /// @note The right name would be lock_, but HP/C++ will choke on that! + ACE_LOCK mutex_; + + /// Class that implements a free list + ACE_Free_List > *free_list_; + + /// Pointer to function that returns the current time of day. + ACE_Time_Value (*gettimeofday_)(void); + + /// Upcall functor + FUNCTOR *upcall_functor_; + + /// To delete or not to delete is the question? + bool const delete_upcall_functor_; + + /// Flag to delete only if the class created the + bool const delete_free_list_; + +private: + + /// Returned by . + ACE_Time_Value timeout_; + + /// Adjusts for timer skew in various clocks. + ACE_Time_Value timer_skew_; + + // = Don't allow these operations for now. + ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Queue_T (const ACE_Timer_Queue_T &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Queue_T &)) +}; + +/** + * @class ACE_Event_Handler_Handle_Timeout_Upcall + * + * @brief Functor for Timer_Queues. + * + * This class implements the functor required by the Timer + * Queue to call on ACE_Event_Handlers. + */ +template +class ACE_Event_Handler_Handle_Timeout_Upcall +{ +public: + typedef ACE_Timer_Queue_T, + ACE_LOCK> + TIMER_QUEUE; + + // = Initialization and termination methods. + /// Constructor. + ACE_Event_Handler_Handle_Timeout_Upcall (void); + + /// Destructor. + ~ACE_Event_Handler_Handle_Timeout_Upcall (void); + + /// This method is called when a timer is registered. + int registration (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + + /// This method is called before the timer expires. + int preinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + + /// This method is called when the timer expires. + int timeout (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time); + + /// This method is called after the timer expires. + int postinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *upcall_act); + + /// This method is called when a handler is cancelled + int cancel_type (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int &requires_reference_counting); + + /// This method is called when a timer is cancelled + int cancel_timer (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int requires_reference_counting); + + /// This method is called when the timer queue is destroyed and + /// the timer is still contained in it + int deletion (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + +private: + + /// Flag indicating that reference counting is required for this + /// event handler upcall. + int requires_reference_counting_; + + // = Don't allow these operations for now. + ACE_UNIMPLEMENTED_FUNC (ACE_Event_Handler_Handle_Timeout_Upcall (const ACE_Event_Handler_Handle_Timeout_Upcall &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Event_Handler_Handle_Timeout_Upcall &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Timer_Queue_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Timer_Queue_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Timer_Queue_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_QUEUE_T_H */ diff --git a/externals/ace/Timer_Queue_T.inl b/externals/ace/Timer_Queue_T.inl new file mode 100644 index 0000000..7606a2e --- /dev/null +++ b/externals/ace/Timer_Queue_T.inl @@ -0,0 +1,222 @@ +// -*- C++ -*- +// +// $Id: Timer_Queue_T.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE void +ACE_Timer_Node_T::set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T *n, + long timer_id) +{ + this->type_ = type; + this->act_ = a; + this->timer_value_ = t; + this->interval_ = i; + this->next_ = n; + this->timer_id_ = timer_id; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T *p, + ACE_Timer_Node_T *n, + long timer_id) +{ + this->type_ = type; + this->act_ = a; + this->timer_value_ = t; + this->interval_ = i; + this->prev_ = p; + this->next_ = n; + this->timer_id_ = timer_id; +} + +template ACE_INLINE TYPE & +ACE_Timer_Node_T::get_type (void) +{ + return this->type_; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set_type (TYPE &type) +{ + this->type_ = type; +} + +template ACE_INLINE const void * +ACE_Timer_Node_T::get_act (void) +{ + return this->act_; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set_act (void *act) +{ + this->act_ = act; +} + +template ACE_INLINE const ACE_Time_Value & +ACE_Timer_Node_T::get_timer_value (void) const +{ + return this->timer_value_; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set_timer_value (const ACE_Time_Value &timer_value) +{ + this->timer_value_ = timer_value; +} + +template ACE_INLINE const ACE_Time_Value & +ACE_Timer_Node_T::get_interval (void) const +{ + return this->interval_; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set_interval (const ACE_Time_Value &interval) +{ + this->interval_ = interval; +} + +template ACE_INLINE ACE_Timer_Node_T * +ACE_Timer_Node_T::get_prev (void) +{ + return this->prev_; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set_prev (ACE_Timer_Node_T *prev) +{ + this->prev_ = prev; +} + +template ACE_INLINE ACE_Timer_Node_T * +ACE_Timer_Node_T::get_next (void) +{ + return this->next_; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set_next (ACE_Timer_Node_T *next) +{ + this->next_ = next; +} + +template ACE_INLINE long +ACE_Timer_Node_T::get_timer_id (void) const +{ + return this->timer_id_; +} + +template ACE_INLINE void +ACE_Timer_Node_T::set_timer_id (long timer_id) +{ + this->timer_id_ = timer_id; +} + +template ACE_INLINE void +ACE_Timer_Node_T::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T &info) +{ + // Yes, do a copy + info.type_ = this->type_; + info.act_ = this->act_; + info.recurring_timer_ = + this->interval_ > ACE_Time_Value::zero; +} + +template ACE_INLINE void +ACE_Timer_Queue_T::timer_skew (const ACE_Time_Value &skew) +{ + timer_skew_ = skew; +} + +template ACE_INLINE const ACE_Time_Value & +ACE_Timer_Queue_T::timer_skew (void) const +{ + return timer_skew_; +} + +template ACE_INLINE int +ACE_Timer_Queue_T::expire (void) +{ + if (!this->is_empty ()) + return this->expire (this->gettimeofday () + timer_skew_); + else + return 0; +} + +template int +ACE_Timer_Queue_T::dispatch_info (const ACE_Time_Value &cur_time, + ACE_Timer_Node_Dispatch_Info_T &info) +{ + ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, 0)); + + return this->dispatch_info_i (cur_time, info); +} + +template ACE_INLINE void +ACE_Timer_Queue_T::upcall (ACE_Timer_Node_Dispatch_Info_T &info, + const ACE_Time_Value &cur_time) +{ + this->upcall_functor ().timeout (*this, + info.type_, + info.act_, + info.recurring_timer_, + cur_time); +} + +template ACE_INLINE void +ACE_Timer_Queue_T::preinvoke (ACE_Timer_Node_Dispatch_Info_T &info, + const ACE_Time_Value &cur_time, + const void *&upcall_act) +{ + this->upcall_functor ().preinvoke (*this, + info.type_, + info.act_, + info.recurring_timer_, + cur_time, + upcall_act); +} + +template ACE_INLINE void +ACE_Timer_Queue_T::postinvoke (ACE_Timer_Node_Dispatch_Info_T &info, + const ACE_Time_Value &cur_time, + const void *upcall_act) +{ + this->upcall_functor ().postinvoke (*this, + info.type_, + info.act_, + info.recurring_timer_, + cur_time, + upcall_act); +} + +template ACE_INLINE ACE_Time_Value +ACE_Timer_Queue_T::gettimeofday (void) +{ + // Invoke gettimeofday via pointer to function. + return this->gettimeofday_ (); +} + +template ACE_INLINE void +ACE_Timer_Queue_T::gettimeofday (ACE_Time_Value (*gettimeofday)(void)) +{ + this->gettimeofday_ = gettimeofday; +} + +template ACE_INLINE FUNCTOR & +ACE_Timer_Queue_T::upcall_functor (void) +{ + return *this->upcall_functor_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Timer_Queuefwd.h b/externals/ace/Timer_Queuefwd.h new file mode 100644 index 0000000..662f29c --- /dev/null +++ b/externals/ace/Timer_Queuefwd.h @@ -0,0 +1,38 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_Queuefwd.h + * + * $Id: Timer_Queuefwd.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Forward declarations and typedefs of ACE_Timer_Queue class. + * + * @author Ossama Othman + */ +//============================================================================= + +#ifndef ACE_TIMER_QUEUE_FWD_H +#define ACE_TIMER_QUEUE_FWD_H + +#include /**/ "ace/pre.h" + +#include "ace/Synch_Traits.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template class ACE_Timer_Queue_T; +template class ACE_Event_Handler_Handle_Timeout_Upcall; + +class ACE_Event_Handler; + +typedef ACE_Timer_Queue_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_Queue; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_TIMER_QUEUE_FWD_H */ diff --git a/externals/ace/Timer_Wheel.h b/externals/ace/Timer_Wheel.h new file mode 100644 index 0000000..21ba877 --- /dev/null +++ b/externals/ace/Timer_Wheel.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_Wheel.h + * + * $Id: Timer_Wheel.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Darrell Brunsch (brunsch@cs.wustl.edu) + */ +//============================================================================= + + +#ifndef ACE_TIMER_WHEEL_H +#define ACE_TIMER_WHEEL_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_Wheel_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedefs are here for ease of use and backward +// compatibility. + +typedef ACE_Timer_Wheel_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_Wheel; + +typedef ACE_Timer_Wheel_Iterator_T, + ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Timer_Wheel_Iterator; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_WHEEL_H */ diff --git a/externals/ace/Timer_Wheel_T.cpp b/externals/ace/Timer_Wheel_T.cpp new file mode 100644 index 0000000..529cc45 --- /dev/null +++ b/externals/ace/Timer_Wheel_T.cpp @@ -0,0 +1,964 @@ +// $Id: Timer_Wheel_T.cpp 89254 2010-02-25 22:10:39Z cleeland $ + +#ifndef ACE_TIMER_WHEEL_T_CPP +#define ACE_TIMER_WHEEL_T_CPP + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_sys_time.h" +#include "ace/Guard_T.h" +#include "ace/Timer_Wheel_T.h" +#include "ace/Log_Msg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Design/implementation notes for ACE_Timer_Wheel_T. +// +// Each timer queue entry is represented by a ACE_Timer_Node. +// The timing wheel is divided into a number of "spokes"; there are +// spoke_count_ spokes in the wheel. Each timer is hashed into one of the +// spokes. Entries within each spoke are linked in a double-linked list +// in order of increasing expiration. The first ACE_Timer_Node in each +// spoke is a "dummy node" that marks the end of the list of ACE_Timer_Nodes +// in that spoke. +// +// The timer ID for a scheduled timer is formed by its spoke position in +// the wheel, and the number of timers that have been inserted in that spoke +// since the queue was initialized. N bits of the long timer_id are used +// to determine the spoke, and M bits are used as a counter. +// Each time a Node is inserted into a spoke, it's counter +// is incremented. The count is kept in the timer ID field +// of the dummy root Node. In the event of overflow of the counter, the spoke +// must be searched for each new id to make sure it's not already in use. To +// prevent having to do an exhaustive search each time, we keep extra data +// in the dummy root Node. +/** +* Default Constructor that sets defaults for spoke_count_ and resolution_ +* and doesn't do any preallocation. +* +* @param upcall_functor A pointer to a functor to use instead of the default +* @param freelist A pointer to a freelist to use instead of the default +*/ +template +ACE_Timer_Wheel_T::ACE_Timer_Wheel_T +(FUNCTOR* upcall_functor + , FreeList* freelist + ) +: Base (upcall_functor, freelist) +, spokes_(0) +, spoke_count_(0) // calculated in open_i +, spoke_bits_(0) +, res_bits_ (0) +, earliest_spoke_ (0) +, iterator_(0) +, timer_count_(0) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::ACE_Timer_Wheel_T"); + this->open_i (0, + ACE_DEFAULT_TIMER_WHEEL_SIZE, + ACE_DEFAULT_TIMER_WHEEL_RESOLUTION); +} + +/** +* Constructor that sets up the timing wheel and also may preallocate +* some nodes on the free list +* +* @param spoke_count The number of lists in the timer wheel +* @param resolution The time resolution in milliseconds used by the hashing function +* @param prealloc The number of entries to prealloc in the free_list +* @param upcall_functor A pointer to a functor to use instead of the default +* @param freelist A pointer to a freelist to use instead of the default +*/ +template +ACE_Timer_Wheel_T::ACE_Timer_Wheel_T + (u_int spoke_count, + u_int resolution, + size_t prealloc, + FUNCTOR* upcall_functor, + FreeList* freelist) +: Base (upcall_functor, freelist) +, spokes_ (0) +, spoke_count_ (0) // calculated in open_i +, spoke_bits_ (0) +, res_bits_ (0) +, earliest_spoke_ (0) +, iterator_ (0) +, timer_count_ (0) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::ACE_Timer_Wheel_T"); + this->open_i (prealloc, spoke_count, resolution); +} + +template int +ACE_Timer_Wheel_T::power2bits (int n, + int min_bits, + int max_bits) +{ + int max = (1 << max_bits) - 1; + if (n > max) + return max_bits; + + // count the bits in n. + int i = 0; + int tmp = n; + do + { + tmp >>= 1; + ++i; + } + while (tmp != 0); + + if (i <= min_bits) + return min_bits; + + // Which is nearest? + int a = (1 << i) - n; + int b = (1 << (i - 1)) - n; + if (b < 0) + b = -b; + if (b < a) + return i - 1; + return i; +} + +/** +* Initialize the queue. Uses the established members for all needed +* information. +*/ +template void +ACE_Timer_Wheel_T::open_i + (size_t prealloc, u_int spokes, u_int res) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::open_i"); + + this->gettimeofday (ACE_OS::gettimeofday); + + // Rather than waste bits in our timer id, we might as well round up + // the spoke count to the next power of two - 1 . (i.e 1,3,7,15,...127,etc.) + const int MIN_SPOKE_BITS = 3; // Allow between 8 and 4096 spokes + const int MAX_SPOKE_BITS = 12; + const int MAX_RES_BITS = 20; // 20 is plenty, even on 64 bit platforms. + + this->spoke_bits_ = power2bits (spokes, MIN_SPOKE_BITS, MAX_SPOKE_BITS); + this->res_bits_ = power2bits (res, 1, MAX_RES_BITS); + + this->spoke_count_ = 1 << this->spoke_bits_; + + this->free_list_->resize (prealloc + this->spoke_count_); + + this->wheel_time_.msec (1 << (this->res_bits_)); + + ACE_NEW (this->spokes_, ACE_Timer_Node_T* [this->spoke_count_]); + + // Create the root nodes. These will be treated specially + for (u_int i = 0; i < this->spoke_count_; ++i) + { + ACE_Timer_Node_T* root = this->alloc_node (); + root->set (0, 0, ACE_Time_Value::zero, ACE_Time_Value::zero, root, root, 0); + this->spokes_[i] = root; + } + + ACE_NEW (iterator_, Iterator (*this)); +} + +/// Destructor just cleans up its memory +template +ACE_Timer_Wheel_T::~ACE_Timer_Wheel_T (void) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::~ACE_Timer_Wheel_T"); + + delete iterator_; + + for (u_int i = 0; i < this->spoke_count_; ++i) + { + // Free all the nodes starting at the root + ACE_Timer_Node_T* root = this->spokes_[i]; + for (ACE_Timer_Node_T* n = root->get_next (); n != root;) + { + ACE_Timer_Node_T* next = n->get_next (); + this->upcall_functor ().deletion (*this, + n->get_type (), + n->get_act ()); + this->free_node (n); + n = next; + } + delete root; + } + delete[] this->spokes_; +} + +/// Searches for a node by timer_id within one spoke. +template +ACE_Timer_Node_T* +ACE_Timer_Wheel_T::find_spoke_node + (u_int spoke, long timer_id) const +{ + ACE_Timer_Node_T* root = this->spokes_[spoke]; + for (ACE_Timer_Node_T* n = root->get_next (); + n != root; + n = n->get_next ()) + { + if (n->get_timer_id () == timer_id) + return n; + } + return 0; +} + +/// Searches all spokes for a node matching the specified timer_id +/// Uses the spoke encoded in the timer_id as a starting place. +template +ACE_Timer_Node_T* +ACE_Timer_Wheel_T::find_node (long timer_id) const +{ + if (timer_id == -1) + return 0; + + // Search the spoke where timer_id was originally scheduled + u_int spoke_mask = this->spoke_count_ - 1; + u_int start = timer_id & spoke_mask; + ACE_Timer_Node_T* n = this->find_spoke_node (start, timer_id); + if (n != 0) + return n; + + //ACE_ERROR((LM_ERROR, "Node not found in original spoke.\n")); + + // Search the rest of the spokes + for (u_int i = 0; i < this->spoke_count_; ++i) + { + if (i != start) + { // already searched this one + n = this->find_spoke_node (i, timer_id); + if (n != 0) + return n; + } + } + + //ACE_ERROR((LM_ERROR, "Node not found.\n")); + return 0; +} + +/** +* Check to see if the wheel is empty +* +* @return True if empty +*/ +template bool +ACE_Timer_Wheel_T::is_empty (void) const +{ + ACE_TRACE ("ACE_Timer_Wheel_T::is_empty"); + return timer_count_ == 0; +} + + +/** +* @return First (earliest) node in the wheel_'s earliest_spoke_ list +*/ +template const ACE_Time_Value & +ACE_Timer_Wheel_T::earliest_time (void) const +{ + ACE_TRACE ("ACE_Timer_Wheel_T::earliest_time"); + ACE_Timer_Node_T* n = this->get_first_i (); + if (n != 0) + return n->get_timer_value (); + return ACE_Time_Value::zero; +} + +/// Uses a simple hash to find which spoke to use based on when the +/// timer is due to expire. Hopefully the 64bit int operations avoid +/// any overflow problems. +template u_int +ACE_Timer_Wheel_T::calculate_spoke + (const ACE_Time_Value& t) const +{ + return static_cast ((t.msec () >> this->res_bits_) & (this->spoke_count_ - 1)); +} + +/// Generates a unique timer_id for the given spoke. It should be pretty +/// fast until the point where the counter overflows. At that time you +/// have to do exhaustive searches within the spoke to ensure that a particular +/// timer id is not already in use. Some optimizations are in place so +/// that this hopefully doesn't have to happen often. +template long +ACE_Timer_Wheel_T::generate_timer_id (u_int spoke) +{ + + int cnt_bits = sizeof (long) * 8 - this->spoke_bits_; + long max_cnt = ((long)1 << cnt_bits) - 1; + if (spoke == this->spoke_count_) + --max_cnt; // Because -1 is used as a special invalid timer_id. + + ACE_Timer_Node_T* root = this->spokes_[spoke]; + + if (root == root->get_next ()) + root->set_act(0); + + // We use this field to keep track of the next counter value that + // may be in use. Of course it may have expired, so we just use + // this field so that we know when we don't have to check for duplicates +#if defined (ACE_WIN64) + // The cast below is legit... we know that long is shorter than a + // pointer, but are only using it as a 'long' storage area. +# pragma warning(push) +# pragma warning(disable : 4311) +#endif /* ACE_WIN64 */ + long next_cnt = reinterpret_cast (root->get_act ()); +#if defined (ACE_WIN64) +# pragma warning(pop) +#endif /* ACE_WIN64 */ + + // This field is used as a counter instead of a timer_id. + long cnt = root->get_timer_id (); + + if (cnt >= max_cnt && root == root->get_next ()) + { + // Special case when we overflow on an empty spoke. We can just + // wrap the count around without searching for duplicates. We only + // want to do this when the counter overflows, so that we return + // unique timer_id values as often as possible. + root->set_timer_id (1); + return spoke; + } + else if (cnt >= max_cnt) + { // overflow + cnt = 0; // try again starting at zero + } + else if (next_cnt == 0 || cnt < next_cnt) + { + root->set_timer_id (cnt + 1); + return (cnt << this->spoke_bits_) | spoke; + } + + //ACE_ERROR((LM_ERROR, "Timer id overflow. We have to search now.\n")); + + // We've run out of consecutive id numbers so now we have to search + // for a unique id. + // We'll try increasing numbers until we find one that is not in use, + // and we'll record the next highest number so that we can avoid this + // search as often as possible. + for (; cnt < max_cnt - 1; ++cnt) + { + long id = (cnt << this->spoke_bits_) | spoke; + ACE_Timer_Node_T* n = this->find_spoke_node (spoke, id); + if (n == 0) + { + root->set_timer_id (cnt + 1); + // Now we need to find the next highest cnt in use + next_cnt = 0; + for (; n != root; n = n->get_next ()) + { + long tmp = n->get_timer_id () >> this->spoke_bits_; + if (tmp > cnt && (tmp < next_cnt || next_cnt == 0)) + next_cnt = tmp; + } +#if defined (ACE_WIN64) + // The cast below is legit... we know we're storing a long in + // a pointer, but are only using it as a 'long' storage area. +# pragma warning(push) +# pragma warning(disable : 4312) +#endif /* ACE_WIN64 */ + root->set_act (reinterpret_cast (next_cnt)); +#if defined (ACE_WIN64) +# pragma warning(pop) +#endif /* ACE_WIN64 */ + return id; + } + } + + return -1; // We did our best, but the spoke is full. +} + +/** +* Creates a ACE_Timer_Node_T based on the input parameters. Then inserts +* the node into the wheel using reschedule (). Then returns a timer_id. +* +* @param type The data of the timer node +* @param act Asynchronous Completion Token (AKA magic cookie) +* @param future_time The time the timer is scheduled for (absolute time) +* @param interval If not ACE_Time_Value::zero, then this is a periodic +* timer and interval is the time period +* +* @return Unique identifier (can be used to cancel the timer). +* -1 on failure. +*/ +template long +ACE_Timer_Wheel_T::schedule_i (const TYPE& type, + const void* act, + const ACE_Time_Value& future_time, + const ACE_Time_Value& interval) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::schedule_i"); + + ACE_Timer_Node_T* n = this->alloc_node (); + + if (n != 0) + { + u_int spoke = calculate_spoke (future_time); + long id = generate_timer_id (spoke); + + //ACE_ERROR((LM_ERROR, "Scheduling %x spoke:%d id:%d\n", (long) n, spoke, id)); + + if (id != -1) + { + n->set (type, act, future_time, interval, 0, 0, id); + this->schedule_i (n, spoke, future_time); + } + return id; + } + + // Failure return + errno = ENOMEM; + return -1; +} + +/** +* Takes an ACE_Timer_Node and inserts it into the correct position in +* the correct list. Also makes sure to update the earliest time. +* +* @param n The timer node to reschedule +*/ +template void +ACE_Timer_Wheel_T::reschedule (ACE_Timer_Node_T* n) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::reschedule"); + const ACE_Time_Value& expire = n->get_timer_value (); + u_int spoke = calculate_spoke (expire); + this->schedule_i (n, spoke, expire); +} + +/// The shared scheduling functionality between schedule() and reschedule() +template void +ACE_Timer_Wheel_T::schedule_i + (ACE_Timer_Node_T* n, + u_int spoke, + const ACE_Time_Value& expire) +{ + // See if we need to update the earliest time + if (this->is_empty() || expire < this->earliest_time ()) + this->earliest_spoke_ = spoke; + + ACE_Timer_Node_T* root = this->spokes_[spoke]; + ACE_Timer_Node_T* last = root->get_prev (); + + ++timer_count_; + + // If the spoke is empty + if (last == root) { + n->set_prev (root); + n->set_next (root); + root->set_prev (n); + root->set_next (n); + return; + } + + // We always want to search backwards from the tail of the list, because + // this minimizes the search in the extreme case when lots of timers are + // scheduled for exactly the same time + ACE_Timer_Node_T* p = root->get_prev (); + while (p != root && p->get_timer_value () > expire) + p = p->get_prev (); + + // insert after + n->set_prev (p); + n->set_next (p->get_next ()); + p->get_next ()->set_prev (n); + p->set_next (n); +} + + +/** +* Find the timer node by using the id as a pointer. Then use set_interval() +* on the node to update the interval. +* +* @param timer_id The timer identifier +* @param interval The new interval +* +* @return 0 if successful, -1 if no. +*/ +template int +ACE_Timer_Wheel_T::reset_interval (long timer_id, + const ACE_Time_Value &interval + ) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::reset_interval"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + ACE_Timer_Node_T* n = this->find_node (timer_id); + if (n != 0) + { + // The interval will take effect the next time this node is expired. + n->set_interval (interval); + return 0; + } + return -1; +} + + +/** +* Goes through every list in the wheel and whenever we find one with the +* correct type value, we remove it and continue. At the end make sure +* we reset the earliest time value in case the earliest timers were +* removed. +* +* @param type The value to search for. +* @param skip_close If this non-zero, the cancellation method of the +* functor will not be called for each cancelled timer. +* +* @return Number of timers cancelled +*/ +template int +ACE_Timer_Wheel_T::cancel (const TYPE& type, int skip_close) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); + + int num_canceled = 0; // Note : Technically this can overflow. + int cookie = 0; + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + if (!this->is_empty ()) + { + ACE_Timer_Node_T* first = this->get_first (); + ACE_Time_Value last = first->get_timer_value (); + int recalc = 0; + + for (u_int i = 0; i < this->spoke_count_; ++i) + { + ACE_Timer_Node_T* root = this->spokes_[i]; + for (ACE_Timer_Node_T* n = root->get_next (); n != root; ) + { + if (n->get_type () == type) + { + ++num_canceled; + if (n == first) + recalc = 1; + + ACE_Timer_Node_T* tmp = n; + n = n->get_next (); + + this->cancel_i (tmp); + } + else + { + n = n->get_next (); + } + } + } + + if (recalc) + this->recalc_earliest (last); + } + + // Call the close hooks. + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + type, + skip_close, + cookie); + + for (int i = 0; + i < num_canceled; + ++i) + { + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + type, + skip_close, + cookie); + } + + return num_canceled; +} + + +/** +* Cancels the single timer that is specified by the timer_id. In this +* case the timer_id is actually a pointer to the node, so we cast it +* to the node. This can be dangerous if the timer_id is made up +* (or deleted twice) so we do a little sanity check. Finally we update +* the earliest time in case the earliest timer was removed. +* +* @param timer_id Timer Identifier +* @param act Asychronous Completion Token (AKA magic cookie): +* If this is non-zero, stores the magic cookie of +* the cancelled timer here. +* @param skip_close If this non-zero, the cancellation method of the +* functor will not be called. +* +* @return 1 for sucess and 0 if the timer_id wasn't found (or was +* found to be invalid) +*/ +template int +ACE_Timer_Wheel_T::cancel (long timer_id, + const void **act, + int skip_close) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + ACE_Timer_Node_T* n = this->find_node (timer_id); + if (n != 0) + { + ACE_Time_Value last = n->get_timer_value (); + + int recalc = (this->get_first_i () == n); + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per . + this->upcall_functor ().cancel_type (*this, + n->get_type (), + skip_close, + cookie); + + // cancel_timer() called once per . + this->upcall_functor ().cancel_timer (*this, + n->get_type (), + skip_close, + cookie); + if (act != 0) + *act = n->get_act (); + + this->cancel_i (n); + + if (recalc) + this->recalc_earliest (last); + + return 1; + } + return 0; +} + +/// Shared subset of the two cancel() methods. +template void +ACE_Timer_Wheel_T::cancel_i (ACE_Timer_Node_T* n) +{ + this->unlink (n); + this->free_node (n); +} + +/// There are a few places where we have to figure out which timer +/// will expire next. This method makes the assumption that spokes +/// are always sorted, and that timers are always in the correct spoke +/// determined from their expiration time. +/// The last time is always passed in, even though you can often calculate +/// it as get_first()->get_timer_value(). +template void +ACE_Timer_Wheel_T::recalc_earliest + (const ACE_Time_Value& last) +{ + // This is possible because we use a count for is_empty() + if (this->is_empty ()) + return; + + ACE_Time_Value et = ACE_Time_Value::zero; + u_int es = 0; + u_int spoke = this->earliest_spoke_; + + // We will have to go around the wheel at most one time. + for (u_int i = 0; i < this->spoke_count_; ++i) + { + ACE_Timer_Node_T* root = this->spokes_[spoke]; + ACE_Timer_Node_T* n = root->get_next (); + if (n != root) + { + ACE_Time_Value t = n->get_timer_value (); + if (t < last + this->wheel_time_) + { + this->earliest_spoke_ = spoke; + return; + } + else if (et == ACE_Time_Value::zero || t < et) + { + et = t; + es = spoke; + } + } + if (++spoke >= this->spoke_count_) + spoke = 0; + } + + this->earliest_spoke_ = es; + //ACE_ERROR((LM_ERROR, "We had to search the whole wheel.\n")); +} + +/** +* Dumps out the size of the wheel, the resolution, and the contents +* of the wheel. +*/ +template void +ACE_Timer_Wheel_T::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Timer_Wheel_T::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\nspoke_count_ = %d"), this->spoke_count_)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\nresolution_ = %d"), 1 << this->res_bits_)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\nwheel_ =\n"))); + + for (u_int i = 0; i < this->spoke_count_; ++i) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d\n"), i)); + ACE_Timer_Node_T* root = this->spokes_[i]; + for (ACE_Timer_Node_T* n = root->get_next (); + n != root; + n = n->get_next ()) + { + n->dump (); + } + } + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + + +/** +* Removes the earliest node and then find the new +* +* @return The earliest timer node. +*/ +template ACE_Timer_Node_T * +ACE_Timer_Wheel_T::remove_first (void) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::remove_first"); + return remove_first_expired (ACE_Time_Value::max_time); +} + +template void +ACE_Timer_Wheel_T::unlink (ACE_Timer_Node_T* n) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::unlink"); + --timer_count_; + n->get_prev ()->set_next (n->get_next ()); + n->get_next ()->set_prev (n->get_prev ()); + n->set_prev (0); + n->set_next (0); +} + +template ACE_Timer_Node_T * +ACE_Timer_Wheel_T::remove_first_expired (const ACE_Time_Value& now) +{ + ACE_Timer_Node_T* n = this->get_first (); + if (n != 0 && n->get_timer_value() <= now) + { + this->unlink (n); + this->recalc_earliest (n->get_timer_value ()); + return n; + } + return 0; +} + +/** +* Returns the earliest node without removing it +* +* @return The earliest timer node. +*/ +template +ACE_Timer_Node_T* +ACE_Timer_Wheel_T::get_first (void) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::get_first"); + return this->get_first_i (); +} + +template +ACE_Timer_Node_T* +ACE_Timer_Wheel_T::get_first_i (void) const +{ + ACE_Timer_Node_T* root = this->spokes_[this->earliest_spoke_]; + ACE_Timer_Node_T* first = root->get_next (); + if (first != root) + return first; + return 0; +} + + +/** +* @return The iterator +*/ +template +ACE_Timer_Queue_Iterator_T& +ACE_Timer_Wheel_T::iter (void) +{ + this->iterator_->first (); + return *this->iterator_; +} + +/** +* Dummy version of expire to get rid of warnings in Sun CC 4.2 +* Just call the expire of the base class. +*/ +template int +ACE_Timer_Wheel_T::expire () +{ + return ACE_Timer_Queue_T::expire (); +} + +/** +* This is a specialized version of expire that is more suited for the +* internal data representation. +* +* @param cur_time The time to expire timers up to. +* +* @return Number of timers expired +*/ +template int +ACE_Timer_Wheel_T::expire (const ACE_Time_Value& cur_time) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::expire"); + + int expcount = 0; + + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + ACE_Timer_Node_T* n = this->remove_first_expired (cur_time); + + while (n != 0) + { + ++expcount; + + //ACE_ERROR((LM_ERROR, "Expiring %x\n", (long) n)); + + ACE_Timer_Node_Dispatch_Info_T info; + + // Get the dispatch info + n->get_dispatch_info (info); + + if (n->get_interval () > ACE_Time_Value::zero) + { + // Make sure that we skip past values that have already + // "expired". + this->recompute_next_abs_interval_time (n, cur_time); + + this->reschedule (n); + } + else + { + this->free_node (n); + } + + const void *upcall_act = 0; + + this->preinvoke (info, cur_time, upcall_act); + + this->upcall (info, cur_time); + + this->postinvoke (info, cur_time, upcall_act); + + n = this->remove_first_expired (cur_time); + } + + return expcount; +} + +/////////////////////////////////////////////////////////////////////////// +// ACE_Timer_Wheel_Iterator_T + +/** +* Just initializes the iterator with a ACE_Timer_Wheel_T and then calls +* first() to initialize the rest of itself. +* +* @param wheel A reference for a timer queue to iterate over +*/ +template +ACE_Timer_Wheel_Iterator_T::ACE_Timer_Wheel_Iterator_T +(Wheel& wheel) +: timer_wheel_ (wheel) +{ + this->first(); +} + + +/** +* Destructor, at this level does nothing. +*/ +template +ACE_Timer_Wheel_Iterator_T::~ACE_Timer_Wheel_Iterator_T (void) +{ +} + + +/** +* Positions the iterator at the first position in the timing wheel +* that contains something. spoke_ will be set to the spoke position of +* this entry and current_node_ will point to the first entry in that spoke. +* +* If the wheel is empty, spoke_ will be equal timer_wheel_.spoke_count_ and +* current_node_ would be 0. +*/ +template void +ACE_Timer_Wheel_Iterator_T::first (void) +{ + this->goto_next(0); +} + + +/** +* Positions the iterator at the next node. +*/ +template void +ACE_Timer_Wheel_Iterator_T::next (void) +{ + if (this->isdone()) + return; + + ACE_Timer_Node_T* n = this->current_node_->get_next (); + ACE_Timer_Node_T* root = this->timer_wheel_.spokes_[this->spoke_]; + if (n == root) + this->goto_next (this->spoke_ + 1); + else + this->current_node_ = n; +} + +/// Helper class for common functionality of next() and first() +template void +ACE_Timer_Wheel_Iterator_T::goto_next (u_int start_spoke) +{ + // Find the first non-empty entry. + u_int sc = this->timer_wheel_.spoke_count_; + for (u_int i = start_spoke; i < sc; ++i) + { + ACE_Timer_Node_T* root = this->timer_wheel_.spokes_[i]; + ACE_Timer_Node_T* n = root->get_next (); + if (n != root) + { + this->spoke_ = i; + this->current_node_ = n; + return; + } + } + // empty + this->spoke_ = sc; + this->current_node_ = 0; +} + +/** +* @return True when we there aren't any more items (when current_node_ == 0) +*/ +template bool +ACE_Timer_Wheel_Iterator_T::isdone (void) const +{ + return this->current_node_ == 0; +} + +/** +* @return The node at the current spokeition in the sequence or 0 if the wheel +* is empty +*/ +template ACE_Timer_Node_T * +ACE_Timer_Wheel_Iterator_T::item (void) +{ + return this->current_node_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_WHEEL_T_CPP */ diff --git a/externals/ace/Timer_Wheel_T.h b/externals/ace/Timer_Wheel_T.h new file mode 100644 index 0000000..266099f --- /dev/null +++ b/externals/ace/Timer_Wheel_T.h @@ -0,0 +1,226 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Timer_Wheel_T.h + * + * $Id: Timer_Wheel_T.h 84619 2009-02-26 12:26:16Z johnnyw $ + * + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_TIMER_WHEEL_T_H +#define ACE_TIMER_WHEEL_T_H +#include /**/ "ace/pre.h" + +#include "ace/Timer_Queue_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration +template +class ACE_Timer_Wheel_T; + +/** + * @class ACE_Timer_Wheel_Iterator_T + * + * @brief Iterates over an ACE_Timer_Wheel. + * + * This is a generic iterator that can be used to visit every + * node of a timer queue. Be aware that it doesn't traverse + * in the order of timeout values. + */ +template +class ACE_Timer_Wheel_Iterator_T + : public ACE_Timer_Queue_Iterator_T +{ +public: + typedef ACE_Timer_Wheel_T Wheel; + typedef ACE_Timer_Node_T Node; + + /// Constructor + ACE_Timer_Wheel_Iterator_T (Wheel &); + + /// Destructor + ~ACE_Timer_Wheel_Iterator_T (void); + + /// Positions the iterator at the earliest node in the Timer Queue + virtual void first (void); + + /// Positions the iterator at the next node in the Timer Queue + virtual void next (void); + + /// Returns true when there are no more nodes in the sequence + virtual bool isdone (void) const; + + /// Returns the node at the current position in the sequence + virtual ACE_Timer_Node_T* item (void); + +protected: + /// Pointer to the ACE_Timer_List that we are iterating over. + Wheel& timer_wheel_; + + /// Current position in the timing wheel + u_int spoke_; + + /// Pointer to the position in the the th list + ACE_Timer_Node_T* current_node_; +private: + void goto_next(u_int start_spoke); +}; + +/** + * @class ACE_Timer_Wheel_T + * + * @brief Provides a Timing Wheel version of ACE_Timer_Queue. + * + * This implementation uses a hash table of ordered doubly- + * linked lists of absolute times. The enhancements over the + * @c ACE_Timer_List include adding a free list and the ability + * to preallocate nodes. Timer Wheel is based on the timing + * wheel implementation used in Adam M. Costello and + * George Varghese's paper "Redesigning the BSD Callout and + * Timer Facilities" + * (http://dworkin.wustl.edu/~varghese/PAPERS/newbsd.ps.Z) + */ +template +class ACE_Timer_Wheel_T : public ACE_Timer_Queue_T +{ +public: + /// Type of iterator + typedef ACE_Timer_Wheel_Iterator_T Iterator; + /// Iterator is a friend + friend class ACE_Timer_Wheel_Iterator_T; + typedef ACE_Timer_Node_T Node; + /// Type inherited from + typedef ACE_Timer_Queue_T Base; + typedef ACE_Free_List FreeList; + + /// Default constructor + ACE_Timer_Wheel_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0); + + /// Constructor with opportunities to set the wheelsize and resolution + ACE_Timer_Wheel_T (u_int spoke_count, + u_int resolution, + size_t prealloc = 0, + FUNCTOR* upcall_functor = 0, + FreeList* freelist = 0); + + /// Destructor + virtual ~ACE_Timer_Wheel_T (void); + + /// True if queue is empty, else false. + virtual bool is_empty (void) const; + + /// Returns the time of the earlier node in the ACE_Timer_Wheel. + /// Must be called on a non-empty queue. + virtual const ACE_Time_Value& earliest_time (void) const; + + /// Changes the interval of a timer (and can make it periodic or non + /// periodic by setting it to ACE_Time_Value::zero or not). + virtual int reset_interval (long timer_id, + const ACE_Time_Value& interval); + + /// Cancel all timer associated with @a type. If @a dont_call_handle_close is + /// 0 then the will be invoked. Returns number of timers + /// cancelled. + virtual int cancel (const TYPE& type, + int dont_call_handle_close = 1); + + // Cancel a timer, storing the magic cookie in act (if nonzero). + // Calls the functor if dont_call_handle_close is 0 and returns 1 + // on success + virtual int cancel (long timer_id, + const void** act = 0, + int dont_call_handle_close = 1); + + /// Run the for all timers whose values are <= + /// . Also accounts for . Returns + /// the number of timers canceled. + virtual int expire (void); + + // Run the for all timers whose values are <= @a current_time. + // This does not account for . Returns the number of + // timers canceled. + int expire (const ACE_Time_Value& current_time); + + /// Returns a pointer to this 's iterator. + virtual ACE_Timer_Queue_Iterator_T& iter (void); + + /// Removes the earliest node from the queue and returns it + virtual ACE_Timer_Node_T* remove_first (void); + + /// Dump the state of an object. + virtual void dump (void) const; + + /// Reads the earliest node from the queue and returns it. + virtual ACE_Timer_Node_T* get_first (void); + +protected: + + /// Schedules a timer. + virtual long schedule_i (const TYPE& type, + const void* act, + const ACE_Time_Value& future_time, + const ACE_Time_Value& interval); + +private: + // The following are documented in the .cpp file. + ACE_Timer_Node_T* get_first_i (void) const; + ACE_Timer_Node_T* remove_first_expired (const ACE_Time_Value& now); + void open_i (size_t prealloc, u_int spokes, u_int res); + virtual void reschedule (ACE_Timer_Node_T *); + ACE_Timer_Node_T* find_spoke_node(u_int spoke, long timer_id) const; + ACE_Timer_Node_T* find_node(long timer_id) const; + u_int calculate_spoke(const ACE_Time_Value& expire) const; + long generate_timer_id(u_int spoke); + void schedule_i (ACE_Timer_Node_T* n, u_int spoke, const ACE_Time_Value& expire); + void cancel_i (ACE_Timer_Node_T* n); + void unlink (ACE_Timer_Node_T* n); + void recalc_earliest(const ACE_Time_Value& last); + +private: + int power2bits (int n, int min_bits, int max_bits); + + /// Timing Wheel. + ACE_Timer_Node_T** spokes_; + /// Size of the timing wheel. + u_int spoke_count_; + /// Number of timer_id bits used for the spoke + int spoke_bits_; + /// Maximum number of timers per spoke + u_int max_per_spoke_; + /// Resolution (in microsoconds) of the timing wheel. + int res_bits_; + /// Index of the list with the earliest time + u_int earliest_spoke_; + /// Iterator used to expire timers. + Iterator* iterator_; + /// The total amount of time in one iteration of the wheel. (resolution * spoke_count) + ACE_Time_Value wheel_time_; + /// The total number of timers currently scheduled. + u_int timer_count_; + + // = Don't allow these operations for now, don't split into multiple lines + // breaks sun compilers + ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Wheel_T (const ACE_Timer_Wheel_T &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Wheel_T &)) +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Timer_Wheel_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Timer_Wheel_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_WHEEL_T_H */ diff --git a/externals/ace/Token.cpp b/externals/ace/Token.cpp new file mode 100644 index 0000000..9993261 --- /dev/null +++ b/externals/ace/Token.cpp @@ -0,0 +1,545 @@ +// $Id: Token.cpp 83735 2008-11-14 09:41:52Z johnnyw $ + +#include "ace/Token.h" + +#if !defined (__ACE_INLINE__) +# include "ace/Token.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Token, "$Id: Token.cpp 83735 2008-11-14 09:41:52Z johnnyw $") + +#if defined (ACE_HAS_THREADS) + +#include "ace/Thread.h" +#include "ace/Log_Msg.h" + +#if defined (ACE_TOKEN_DEBUGGING) +// FUZZ: disable check_for_streams_include +#include "ace/streams.h" +#endif /* ACE_TOKEN_DEBUGGING */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Token) + +void +ACE_Token::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Token::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthread = %d"), ACE_Thread::self ())); + // @@ Is there a portable way to do this? + // ACE_DEBUG ((LM_DEBUG, "\nowner_ = %d", (long) this->owner_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nowner_ addr = %x"), &this->owner_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nwaiters_ = %d"), this->waiters_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nin_use_ = %d"), this->in_use_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnesting level = %d"), this->nesting_level_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, + ACE_thread_t t_id) + : next_ (0), + thread_id_ (t_id), +#if defined (ACE_TOKEN_USES_SEMAPHORE) + cv_ (0), +#else + cv_ (m), +#endif /* ACE_TOKEN_USES_SEMAPHORE */ + runable_ (0) +{ +#if defined (ACE_TOKEN_USES_SEMAPHORE) + ACE_UNUSED_ARG (m); +#endif /* ACE_TOKEN_USES_SEMAPHORE */ + + ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry"); +} + +ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, + ACE_thread_t t_id, + ACE_Condition_Attributes &attributes) + : next_ (0), + thread_id_ (t_id), +#if defined (ACE_TOKEN_USES_SEMAPHORE) + cv_ (0), +#else + cv_ (m, attributes), +#endif /* ACE_TOKEN_USES_SEMAPHORE */ + runable_ (0) +{ +#if defined (ACE_TOKEN_USES_SEMAPHORE) + ACE_UNUSED_ARG (m); + ACE_UNUSED_ARG (attributes); +#endif /* ACE_TOKEN_USES_SEMAPHORE */ + + ACE_TRACE ("ACE_Token::ACE_Token_Queue_Entry::ACE_Token_Queue_Entry"); +} + +ACE_Token::ACE_Token_Queue::ACE_Token_Queue (void) + : head_ (0), + tail_ (0) +{ + ACE_TRACE ("ACE_Token::ACE_Token_Queue::ACE_Token_Queue"); +} + +// +// Remove an entry from the list. Must be called with locks held. +// +void +ACE_Token::ACE_Token_Queue::remove_entry (ACE_Token::ACE_Token_Queue_Entry *entry) +{ + ACE_TRACE ("ACE_Token::ACE_Token_Queue::remove_entry"); + ACE_Token_Queue_Entry *curr = 0; + ACE_Token_Queue_Entry *prev = 0; + + if (this->head_ == 0) + return; + + for (curr = this->head_; + curr != 0 && curr != entry; + curr = curr->next_) + prev = curr; + + if (curr == 0) + // Didn't find the entry... + return; + else if (prev == 0) + // Delete at the head. + this->head_ = this->head_->next_; + else + // Delete in the middle. + prev->next_ = curr->next_; + + // We need to update the tail of the list if we've deleted the last + // entry. + if (curr->next_ == 0) + this->tail_ = prev; +} + +// +// Add an entry into the list. Must be called with locks held. +// +void +ACE_Token::ACE_Token_Queue::insert_entry (ACE_Token::ACE_Token_Queue_Entry &entry, + int requeue_position) +{ + if (this->head_ == 0) + { + // No other threads - just add me + this->head_ = &entry; + this->tail_ = &entry; + } + else if (requeue_position == -1) + { + // Insert at the end of the queue. + this->tail_->next_ = &entry; + this->tail_ = &entry; + } + else if (requeue_position == 0) + { + // Insert at head of queue. + entry.next_ = this->head_; + this->head_ = &entry; + } + else + // Insert in the middle of the queue somewhere. + { + // Determine where our thread should go in the queue of waiters. + + ACE_Token::ACE_Token_Queue_Entry *insert_after = this->head_; + while (requeue_position-- && insert_after->next_ != 0) + insert_after = insert_after->next_; + + entry.next_ = insert_after->next_; + + if (entry.next_ == 0) + this->tail_ = &entry; + + insert_after->next_ = &entry; + } +} + +ACE_Token::ACE_Token (const ACE_TCHAR *name, void *any) + : lock_ (name, (ACE_mutexattr_t *) any), + owner_ (ACE_OS::NULL_thread), + in_use_ (0), + waiters_ (0), + nesting_level_ (0), + attributes_ (USYNC_THREAD), + queueing_strategy_ (FIFO) +{ +// ACE_TRACE ("ACE_Token::ACE_Token"); +} + +ACE_Token::~ACE_Token (void) +{ + ACE_TRACE ("ACE_Token::~ACE_Token"); +} + +int +ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), + void *arg, + ACE_Time_Value *timeout, + ACE_Token_Op_Type op_type) +{ + ACE_TRACE ("ACE_Token::shared_acquire"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + +#if defined (ACE_TOKEN_DEBUGGING) + this->dump (); +#endif /* ACE_TOKEN_DEBUGGING */ + + ACE_thread_t const thr_id = ACE_Thread::self (); + + // Nobody holds the token. + if (!this->in_use_) + { + // Its mine! + this->in_use_ = op_type; + this->owner_ = thr_id; + return 0; + } + + // + // Someone already holds the token. + // + + // Check if it is us. + if (ACE_OS::thr_equal (thr_id, this->owner_)) + { + ++this->nesting_level_; + return 0; + } + + // Do a quick check for "polling" behavior. + if (timeout != 0 && *timeout == ACE_Time_Value::zero) + { + errno = ETIME; + return -1; + } + + // + // We've got to sleep until we get the token. + // + + // Which queue we should end up in... + ACE_Token_Queue *queue = (op_type == ACE_Token::READ_TOKEN + ? &this->readers_ + : &this->writers_); + + // Allocate queue entry on stack. This works since we don't exit + // this method's activation record until we've got the token. + ACE_Token::ACE_Token_Queue_Entry my_entry (this->lock_, + thr_id, + this->attributes_); + queue->insert_entry (my_entry, this->queueing_strategy_); + ++this->waiters_; + + // Execute appropriate callback. (@@ should these + // methods return a success/failure status, and if so, what should + // we do with it?) + int ret = 0; + if (sleep_hook_func) + { + (*sleep_hook_func) (arg); + ++ret; + } + else + { + // Execute virtual method. + this->sleep_hook (); + ++ret; + } + + bool timed_out = false; + bool error = false; + + // Sleep until we've got the token (ignore signals). + do + { + int const result = my_entry.wait (timeout, this->lock_); + + if (result == -1) + { + // Note, this should obey whatever thread-specific interrupt + // policy is currently in place... + if (errno == EINTR) + continue; + +#if defined (ACE_TOKEN_DEBUGGING) + cerr << '(' << ACE_Thread::self () << ')' + << " acquire: " + << (errno == ETIME ? "timed out" : "error occurred") + << endl; +#endif /* ACE_TOKEN_DEBUGGING */ + + // We come here if a timeout occurs or some serious + // ACE_Condition object error. + if (errno == ETIME) + timed_out = true; + else + error = true; + + // Stop the loop. + break; + } + } + while (!ACE_OS::thr_equal (thr_id, this->owner_)); + + // Do this always and irrespective of the result of wait(). + --this->waiters_; + queue->remove_entry (&my_entry); + +#if defined (ACE_TOKEN_DEBUGGING) + ACE_DEBUG ((LM_DEBUG, "(%t) ACE_Token::shared_acquire (UNBLOCKED)\n")); +#endif /* ACE_TOKEN_DEBUGGING */ + + // If timeout occured + if (timed_out) + { + // This thread was still selected to own the token. + if (my_entry.runable_) + { + // Wakeup next waiter since this thread timed out. + this->wakeup_next_waiter (); + } + + // Return error. + return -1; + } + else if (error) + { + // Return error. + return -1; + } + + // If this is a normal wakeup, this thread should be runnable. + ACE_ASSERT (my_entry.runable_); + + return ret; +} + +// By default this is a no-op. + +/* virtual */ +void +ACE_Token::sleep_hook (void) +{ + ACE_TRACE ("ACE_Token::sleep_hook"); +} + +int +ACE_Token::acquire (ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_Token::acquire"); + return this->shared_acquire (0, 0, timeout, ACE_Token::WRITE_TOKEN); +} + +// Acquire the token, sleeping until it is obtained or until +// expires. + +int +ACE_Token::acquire (void (*sleep_hook_func)(void *), + void *arg, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_Token::acquire"); + return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::WRITE_TOKEN); +} + +// Try to renew the token. + +int +ACE_Token::renew (int requeue_position, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_Token::renew"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + +#if defined (ACE_TOKEN_DEBUGGING) + this->dump (); +#endif /* ACE_TOKEN_DEBUGGING */ + // ACE_ASSERT (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_)); + + // Check to see if there are any waiters worth giving up the lock + // for. + + // If no writers and either we are a writer or there are no readers. + if (this->writers_.head_ == 0 && + (this->in_use_ == ACE_Token::WRITE_TOKEN || + this->readers_.head_ == 0)) + // Immediate return. + return 0; + + // We've got to sleep until we get the token again. + + // Determine which queue should this thread go to. + ACE_Token::ACE_Token_Queue *this_threads_queue = + this->in_use_ == ACE_Token::READ_TOKEN ? + &this->readers_ : &this->writers_; + + ACE_Token::ACE_Token_Queue_Entry my_entry (this->lock_, + this->owner_); + + this_threads_queue->insert_entry (my_entry, + // if requeue_position == 0 then we want to go next, + // otherwise use the queueing strategy, which might also + // happen to be 0. + requeue_position == 0 ? 0 : this->queueing_strategy_); + ++this->waiters_; + + // Remember nesting level... + int const save_nesting_level_ = this->nesting_level_; + + // Reset state for new owner. + this->nesting_level_ = 0; + + // Wakeup waiter. + this->wakeup_next_waiter (); + + bool timed_out = false; + bool error = false; + + // Sleep until we've got the token (ignore signals). + do + { + int const result = my_entry.wait (timeout, this->lock_); + + if (result == -1) + { + // Note, this should obey whatever thread-specific interrupt + // policy is currently in place... + if (errno == EINTR) + continue; + +#if defined (ACE_TOKEN_DEBUGGING) + cerr << '(' << ACE_Thread::self () << ')' + << " renew: " + << (errno == ETIME ? "timed out" : "error occurred") + << endl; +#endif /* ACE_TOKEN_DEBUGGING */ + + // We come here if a timeout occurs or some serious + // ACE_Condition object error. + if (errno == ETIME) + timed_out = true; + else + error = true; + + // Stop the loop. + break; + } + } + while (!ACE_OS::thr_equal (my_entry.thread_id_, this->owner_)); + + // Do this always and irrespective of the result of wait(). + --this->waiters_; + this_threads_queue->remove_entry (&my_entry); + +#if defined (ACE_TOKEN_DEBUGGING) + ACE_DEBUG ((LM_DEBUG, "(%t) ACE_Token::renew (UNBLOCKED)\n")); +#endif /* ACE_TOKEN_DEBUGGING */ + + // If timeout occured + if (timed_out) + { + // This thread was still selected to own the token. + if (my_entry.runable_) + { + // Wakeup next waiter since this thread timed out. + this->wakeup_next_waiter (); + } + + // Return error. + return -1; + } + else if (error) + { + // Return error. + return -1; + } + + // If this is a normal wakeup, this thread should be runnable. + ACE_ASSERT (my_entry.runable_); + + // Reinstate nesting level. + this->nesting_level_ = save_nesting_level_; + + return 0; +} + +// Release the current holder of the token (which had +// better be the caller's thread!). + +int +ACE_Token::release (void) +{ + ACE_TRACE ("ACE_Token::release"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + +#if defined (ACE_TOKEN_DEBUGGING) + this->dump (); +#endif /* ACE_TOKEN_DEBUGGING */ + + // Nested release... + if (this->nesting_level_ > 0) + --this->nesting_level_; + else + { + // + // Regular release... + // + + // Wakeup waiter. + this->wakeup_next_waiter (); + } + + return 0; +} + +void +ACE_Token::wakeup_next_waiter (void) +{ + ACE_TRACE ("ACE_Token::wakeup_next_waiter"); + + // Reset state for new owner. + this->owner_ = ACE_OS::NULL_thread; + this->in_use_ = 0; + + // Any waiters... + if (this->writers_.head_ == 0 && + this->readers_.head_ == 0) + { + // No more waiters... + return; + } + + // Wakeup next waiter. + ACE_Token_Queue *queue = 0; + + // Writer threads get priority to run first. + if (this->writers_.head_ != 0) + { + this->in_use_ = ACE_Token::WRITE_TOKEN; + queue = &this->writers_; + } + else + { + this->in_use_ = ACE_Token::READ_TOKEN; + queue = &this->readers_; + } + + // Wake up waiter and make it runable. + queue->head_->runable_ = 1; + queue->head_->signal (); + + this->owner_ = queue->head_->thread_id_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/Token.h b/externals/ace/Token.h new file mode 100644 index 0000000..7857c44 --- /dev/null +++ b/externals/ace/Token.h @@ -0,0 +1,376 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Token.h + * + * $Id: Token.h 85367 2009-05-18 10:11:54Z johnnyw $ + * + * @author Original author + * @author Karl-Heinz Dorn (kdorn@erlh.siemens.de) + * @author Ported to ACE by + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + */ +//============================================================================= + +#ifndef ACE_TOKEN_H +#define ACE_TOKEN_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Null_Mutex.h" + +#if defined (ACE_HAS_THREADS) + +#include "ace/Thread_Mutex.h" + +#if (defined (ACE_WIN32) && !defined (ACE_USES_WINCE_SEMA_SIMULATION)) || defined (ACE_HAS_VXTHREADS) +// If platforms support semaphores with timed wait, then we use semaphores instead of c.v. +# define ACE_TOKEN_USES_SEMAPHORE +#endif /* ACE_WIN32 || ACE_HAS_VXTHREADS */ + +#if defined (ACE_TOKEN_USES_SEMAPHORE) +# include "ace/Semaphore.h" +#endif /* ACE_TOKEN_USES_SEMAPHORE */ + +#include "ace/Condition_Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +/** + * @class ACE_Token + * + * @brief Class that acquires, renews, and releases a synchronization + * token that is serviced in strict FIFO/LIFO ordering and that also + * supports (1) recursion and (2) readers/writer semantics. + * + * This class is a more general-purpose synchronization mechanism + * than many native OS mutexes. For example, it implements + * "recursive mutex" semantics, where a thread that owns the token + * can reacquire it without deadlocking. If the same thread calls + * multiple times, however, it must call an + * equal number of times before the token is actually released. + * Threads that are blocked awaiting the token are serviced in + * strict FIFO/LIFO order as other threads release the token (Solaris + * and Pthread mutexes don't strictly enforce an acquisition + * order). There are two lists within the class. Write + * acquires always have higher priority over read acquires. Which + * means, if you use both write/read operations, care must be + * taken to avoid starvation on the readers. Notice that the + * read/write acquire operations do not have the usual semantic of + * reader/writer locks. Only one reader can acquire the token at + * a time (which is different from the usual reader/writer locks + * where several readers can acquire a lock at the same time as + * long as there is no writer waiting for the lock). We choose + * the names to (1) borrow the semantic to give writers higher + * priority and (2) support a common interface for all locking + * classes in ACE. + */ +class ACE_Export ACE_Token +{ +public: + + /** + * Available queueing strategies. + */ + enum QUEUEING_STRATEGY + { + /// FIFO, First In, First Out. + FIFO = -1, + /// LIFO, Last In, First Out + LIFO = 0 + }; + + // = Initialization and termination. + + /// Constructor + ACE_Token (const ACE_TCHAR *name = 0, void * = 0); + + /// Destructor + virtual ~ACE_Token (void); + + // = Strategies + + /// Retrieve the current queueing strategy. + int queueing_strategy (void); + + /// Set the queueing strategy. + void queueing_strategy (int queueing_strategy); + + // = Synchronization operations. + + /** + * Acquire the token, sleeping until it is obtained or until the + * expiration of @a timeout, which is treated as "absolute" time. If + * some other thread currently holds the token then is + * called before our thread goes to sleep. This can be + * used by the requesting thread to unblock a token-holder that is + * sleeping, e.g., by means of writing to a pipe (the ACE + * ACE_Reactor uses this functionality). Return values: 0 if + * acquires without calling 1 if is + * called. 2 if the token is signaled. -1 if failure or timeout + * occurs (if timeout occurs errno == ETIME) If @a timeout == + * <&ACE_Time_Value::zero> then acquire has polling semantics (and + * does *not* call ). + */ + int acquire (void (*sleep_hook)(void *), + void *arg = 0, + ACE_Time_Value *timeout = 0); + + /** + * This behaves just like the previous method, except that + * it invokes the virtual function called that can be + * overridden by a subclass of ACE_Token. + */ + int acquire (ACE_Time_Value *timeout = 0); + + /** + * This should be overridden by a subclass to define the appropriate + * behavior before goes to sleep. By default, this is a + * no-op... + */ + virtual void sleep_hook (void); + + /** + * An optimized method that efficiently reacquires the token if no + * other threads are waiting. This is useful for situations where + * you don't want to degrade the quality of service if there are + * other threads waiting to get the token. If == + * -1 and there are other threads waiting to obtain the token we are + * queued according to the queueing strategy. If + * > -1 then it indicates how many entries to skip over before + * inserting our thread into the list of waiters (e.g., + * == 0 means "insert at front of the queue"). + * Renew has the rather odd semantics such that if there are other + * waiting threads it will give up the token even if the + * nesting_level_ > 1. I'm not sure if this is really the right + * thing to do (since it makes it possible for shared data to be + * changed unexpectedly) so use with caution... This method + * maintians the original token priority. As in , the + * @a timeout value is an absolute time. + */ + int renew (int requeue_position = 0, + ACE_Time_Value *timeout = 0); + + /// Become interface-compliant with other lock mechanisms (implements + /// a non-blocking ). + int tryacquire (void); + + /// Shuts down the ACE_Token instance. + int remove (void); + + /// Relinquish the token. If there are any waiters then the next one + /// in line gets it. + int release (void); + + /// Behaves like acquire() but at a lower priority. It should probably + /// be called acquire_yield() since the semantics aren't really + /// what's commonly expected for readers/writer locks. See the class + /// documentation above for more details. + int acquire_read (void); + + /// Behaves like acquire() but at a lower priority. It should probably + /// be called acquire_yield() since the semantics aren't really + /// what's commonly expected for readers/writer locks. See the class + /// documentation above for more details. + int acquire_read (void (*sleep_hook)(void *), + void *arg = 0, + ACE_Time_Value *timeout = 0); + + /// Calls acquire(). + int acquire_write (void); + + /// Calls acquire(). + int acquire_write (void (*sleep_hook)(void *), + void *arg = 0, + ACE_Time_Value *timeout = 0); + + /// Lower priority try_acquire(). + int tryacquire_read (void); + + /// Just calls . + int tryacquire_write (void); + + /// Assumes the caller has acquired the token and returns 0. + int tryacquire_write_upgrade (void); + + // = Accessor methods. + + /// Return the number of threads that are currently waiting to get + /// the token. + int waiters (void); + + /// Return the id of the current thread that owns the token. + ACE_thread_t current_owner (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /// The following structure implements a LIFO/FIFO queue of waiter threads + /// that are asleep waiting to obtain the token. + struct ACE_Token_Queue_Entry + { + /// Constructor + ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, + ACE_thread_t t_id); + + /// Constructor using a pre-allocated attributes + ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, + ACE_thread_t t_id, + ACE_Condition_Attributes &attributes); + + /// Entry blocks on the token. + int wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock); + + /// Notify (unblock) the entry. + int signal (void); + + /// Pointer to next waiter. + ACE_Token_Queue_Entry *next_; + + /// ACE_Thread id of this waiter. + ACE_thread_t thread_id_; + +#if defined (ACE_TOKEN_USES_SEMAPHORE) + /// ACE_Semaphore object used to wake up waiter when it can run again. + ACE_Semaphore cv_; +#else + /// ACE_Condition object used to wake up waiter when it can run again. + ACE_Condition_Thread_Mutex cv_; +#endif /* ACE_TOKEN_USES_SEMAPHORE */ + + /// Ok to run. + int runable_; + }; + +private: + enum ACE_Token_Op_Type + { + READ_TOKEN = 1, + WRITE_TOKEN + }; + + struct ACE_Token_Queue + { + /// Constructor + ACE_Token_Queue (void); + + /// Remove a waiter from the queue. + void remove_entry (ACE_Token_Queue_Entry *); + + /// Insert a waiter into the queue. + void insert_entry (ACE_Token_Queue_Entry &entry, + int requeue_position = -1); + + /// Head of the list of waiting threads. + ACE_Token_Queue_Entry *head_; + + /// Tail of the list of waiting threads. + ACE_Token_Queue_Entry *tail_; + }; + + /// Implements the and methods above. + int shared_acquire (void (*sleep_hook_func)(void *), + void *arg, + ACE_Time_Value *timeout, + ACE_Token_Op_Type op_type); + + /// Wake next in line for ownership. + void wakeup_next_waiter (void); + + /// A queue of writer threads. + ACE_Token_Queue writers_; + + /// A queue of reader threads. + ACE_Token_Queue readers_; + + /// ACE_Thread_Mutex used to lock internal data structures. + ACE_Thread_Mutex lock_; + + /// Current owner of the token. + ACE_thread_t owner_; + + /// Some thread (i.e., ) is using the token. We need this + /// extra variable to deal with POSIX pthreads madness... + int in_use_; + + /// Number of waiters. + int waiters_; + + /// Current nesting level. + int nesting_level_; + + /// The attributes for the condition variables, optimizes lock time. + ACE_Condition_Attributes attributes_; + + /// Queueing strategy, LIFO/FIFO. + int queueing_strategy_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#else + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Export ACE_Token +{ +public: + int queueing_strategy (void) { ACE_NOTSUP_RETURN (-1); } + void queueing_strategy (int /*queueing_strategy*/) { } + int acquire (ACE_Time_Value * = 0) { ACE_NOTSUP_RETURN (-1); } + int tryacquire (void) { ACE_NOTSUP_RETURN (-1); } + int remove (void) { ACE_NOTSUP_RETURN (-1); } + int release (void) { ACE_NOTSUP_RETURN (-1); } +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Export ACE_Noop_Token : public ACE_Null_Mutex +{ +public: + /// Queueing strategy + enum QUEUEING_STRATEGY + { + FIFO = -1, + LIFO = 0 + }; + + /// Get queueing strategy. + int queueing_strategy (void); + + /// Set queueing strategy. + void queueing_strategy (int queueing_strategy); + + int renew (int = 0, ACE_Time_Value * =0); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Token.inl" +#endif /* __ACE_INLINE__ */ + + +#include /**/ "ace/post.h" +#endif /* ACE_TOKEN_H */ diff --git a/externals/ace/Token.inl b/externals/ace/Token.inl new file mode 100644 index 0000000..f09a0e6 --- /dev/null +++ b/externals/ace/Token.inl @@ -0,0 +1,176 @@ +// -*- C++ -*- +// +// $Id: Token.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/config-macros.h" + +#if defined (ACE_HAS_THREADS) + +#include "ace/Guard_T.h" +#include "ace/Time_Value.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_Token::queueing_strategy (void) +{ + return this->queueing_strategy_; +} + +ACE_INLINE void +ACE_Token::queueing_strategy (int queueing_strategy) +{ + this->queueing_strategy_ = queueing_strategy == -1 ? -1 : 0; +} + +ACE_INLINE int +ACE_Token::remove (void) +{ + ACE_TRACE ("ACE_Token::remove"); + // Don't have an implementation for this yet... + ACE_NOTSUP_RETURN (-1); +} + +ACE_INLINE int +ACE_Token::tryacquire (void) +{ + ACE_TRACE ("ACE_Token::tryacquire"); + return this->shared_acquire + (0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::WRITE_TOKEN); +} + +ACE_INLINE int +ACE_Token::waiters (void) +{ + ACE_TRACE ("ACE_Token::waiters"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + + int const ret = this->waiters_; + return ret; +} + +ACE_INLINE ACE_thread_t +ACE_Token::current_owner (void) +{ + ACE_TRACE ("ACE_Token::current_owner"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, this->owner_); + + return this->owner_; +} + +ACE_INLINE int +ACE_Token::acquire_read (void) +{ + ACE_TRACE ("ACE_Token::acquire_read"); + return this->shared_acquire + (0, 0, 0, ACE_Token::READ_TOKEN); +} + +ACE_INLINE int +ACE_Token::acquire_write (void) +{ + ACE_TRACE ("ACE_Token::acquire_write"); + return this->shared_acquire + (0, 0, 0, ACE_Token::WRITE_TOKEN); +} + +ACE_INLINE int +ACE_Token::tryacquire_read (void) +{ + ACE_TRACE ("ACE_Token::tryacquire_read"); + return this->shared_acquire + (0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::READ_TOKEN); +} + +ACE_INLINE int +ACE_Token::acquire_read (void (*sleep_hook_func)(void *), + void *arg, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_Token::acquire_read"); + return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::READ_TOKEN); +} + +ACE_INLINE int +ACE_Token::tryacquire_write (void) +{ + ACE_TRACE ("ACE_Token::tryacquire_write"); + return this->shared_acquire + (0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::WRITE_TOKEN); +} + +ACE_INLINE int +ACE_Token::tryacquire_write_upgrade (void) +{ + ACE_TRACE ("ACE_Token::tryacquire_write_upgrade"); + return 0; +} + +ACE_INLINE int +ACE_Token::acquire_write (void (*sleep_hook_func)(void *), + void *arg, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_Token::acquire_write"); + return this->shared_acquire (sleep_hook_func, arg, timeout, ACE_Token::WRITE_TOKEN); +} + +ACE_INLINE int +ACE_Token::ACE_Token_Queue_Entry::wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock) +{ +#if defined (ACE_TOKEN_USES_SEMAPHORE) + lock.release (); + int const retv = (timeout == 0 ? + this->cv_.acquire () : + this->cv_.acquire (*timeout)); + lock.acquire (); + return retv; +#else + ACE_UNUSED_ARG (lock); + return this->cv_.wait (timeout); +#endif /* ACE_TOKEN_USES_SEMAPHORE */ +} + +ACE_INLINE int +ACE_Token::ACE_Token_Queue_Entry::signal (void) +{ + return +#if defined (ACE_TOKEN_USES_SEMAPHORE) + this->cv_.release (); +#else + this->cv_.signal (); +#endif /* ACE_TOKEN_USES_SEMAPHORE */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ + +/*****************************************************************************/ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_Noop_Token::queueing_strategy (void) +{ + return -1; +} + +ACE_INLINE void +ACE_Noop_Token::queueing_strategy (int /* queueing_strategy */) +{ +} + +ACE_INLINE int +ACE_Noop_Token::renew (int, ACE_Time_Value *) +{ + return 0; +} + +ACE_INLINE void +ACE_Noop_Token::dump (void) const +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/externals/ace/Token_Collection.cpp b/externals/ace/Token_Collection.cpp new file mode 100644 index 0000000..23a5813 --- /dev/null +++ b/externals/ace/Token_Collection.cpp @@ -0,0 +1,294 @@ +#include "ace/Token_Collection.h" + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#if !defined (__ACE_INLINE__) +#include "ace/Token_Collection.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_RCSID (ace, + Token_Collection, + "$Id: Token_Collection.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Token_Collection::ACE_Token_Collection (bool debug, + const ACE_TCHAR *name) +: debug_ (debug) +{ + ACE_TRACE ("ACE_Token_Collection::ACE_Token_Collection"); + + if (name == 0) + name = ACE_TEXT ("no name"); + + ACE_OS::strsncpy (this->name_, + const_cast (name), + ACE_MAXTOKENNAMELEN); +} + +int +ACE_Token_Collection::insert (ACE_Token_Proxy &new_token) +{ + ACE_TRACE ("ACE_Token_Collection::insert"); + + TOKEN_NAME name (new_token.name ()); + + // Check if the new_proxy is already in the list. + if (collection_.find (name) == 1) + // One already exists, so fail. + return -1; + + // Clone the new token. + ACE_Token_Proxy *temp = new_token.clone (); + + if (collection_.bind (name, temp) == -1) + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed\n")), -1); + return 0; +} + +int +ACE_Token_Collection::extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy) +{ + ACE_TRACE ("ACE_Token_Collection::extract"); + TOKEN_NAME name (token_name); + return collection_.unbind (token_name, proxy); +} + +ACE_Token_Proxy * +ACE_Token_Collection::is_member (const ACE_TCHAR *token_name) +{ + ACE_TRACE ("ACE_Token_Collection::is_member"); + TOKEN_NAME name (token_name); + ACE_Token_Proxy *temp; + // Get the token from the collection. + return collection_.find (name, temp) == -1 ? 0 : temp; +} + +int +ACE_Token_Collection::is_member (const ACE_Token_Proxy &token) +{ + ACE_TRACE ("ACE_Token_Collection::is_member"); + TOKEN_NAME token_name (token.name ()); + return collection_.find (token_name) == 0; +} + +int +ACE_Token_Collection::acquire (int notify, + void (*sleep_hook)(void *), + ACE_Synch_Options &options) +{ + ACE_TRACE ("ACE_Token_Collection::acquire"); + + COLLECTION::ITERATOR iterator (collection_); + + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + { + if (debug_) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("collection acquiring %s\n"), + temp->int_id_->name ())); + if (temp->int_id_->acquire (notify, + sleep_hook, + options) == -1) + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + this->release (); + ACE_RETURN (-1); + } + } + + return 0; +} + +int +ACE_Token_Collection::acquire (const ACE_TCHAR *token_name, + int notify, + void (*sleep_hook)(void *), + ACE_Synch_Options &options) +{ + ACE_TRACE ("ACE_Token_Collection::acquire"); + TOKEN_NAME name (token_name); + ACE_Token_Proxy *temp; + // Get the token from the collection. + int result = collection_.find (name, temp); + // did we find it? + if (result == -1) + return result; + // perform the operation + return temp->acquire (notify, sleep_hook, options); +} + + +int +ACE_Token_Collection::tryacquire (const ACE_TCHAR *token_name, + void (*sleep_hook)(void *)) +{ + ACE_TRACE ("ACE_Token_Collection::tryacquire"); + TOKEN_NAME name (token_name); + ACE_Token_Proxy *temp; + // Get the token from the collection. + int result = collection_.find (name, temp); + // did we find it? + if (result == -1) + return result; + + // perform the operation + return temp->tryacquire (sleep_hook); +} + +int +ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *)) +{ + ACE_TRACE ("ACE_Token_Collection::tryacquire"); + + COLLECTION::ITERATOR iterator (collection_); + + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + { + if (debug_) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("collection acquiring %s\n"), + temp->int_id_->name ())); + // We will fail if _any_ token is not free. + if (temp->int_id_->tryacquire (sleep_hook) == -1) + return -1; + } + + return 0; +} + +int +ACE_Token_Collection::renew (int requeue_position, + ACE_Synch_Options &options) +{ + ACE_TRACE ("ACE_Token_Collection::renew"); + + COLLECTION::ITERATOR iterator (collection_); + + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + { + if (debug_) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("collection renewing %s\n"), + temp->int_id_->name ())); + if (temp->int_id_->renew (requeue_position, options) == -1) + return -1; + } + + return 0; +} + +int +ACE_Token_Collection::renew (const ACE_TCHAR *token_name, + int requeue_position, + ACE_Synch_Options &options) +{ + ACE_TRACE ("ACE_Token_Collection::renew"); + TOKEN_NAME name (token_name); + ACE_Token_Proxy *temp; + + // Get the token from the collection. + int result = collection_.find (name, temp); + + // Did we find it? + if (result == -1) + ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%p %s\n"), + ACE_TEXT ("not in collection "), + token_name), -1); + // perform the operation + return temp->renew (requeue_position, options); +} + +int +ACE_Token_Collection::release (ACE_Synch_Options &) + +{ + ACE_TRACE ("ACE_Token_Collection::release"); + COLLECTION::ITERATOR iterator (collection_); + + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + { + if (debug_) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("collection releasing %s\n"), + temp->int_id_->name ())); + temp->int_id_->release (); + } + + return 0; +} + +int +ACE_Token_Collection::release (const ACE_TCHAR *token_name, + ACE_Synch_Options &options) +{ + ACE_TRACE ("ACE_Token_Collection::release"); + TOKEN_NAME name (token_name); + ACE_Token_Proxy *temp; + // get the token from the collection + int result = collection_.find (name, temp); + // did we find it? + if (result != 0) + return result; + // perform the operation + return temp->release (options); +} + +ACE_Token_Collection::~ACE_Token_Collection (void) +{ + ACE_TRACE ("ACE_Token_Collection::~ACE_Token_Collection"); + COLLECTION::ITERATOR iterator (collection_); + + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + { + delete temp->int_id_; + // The ext_id_'s delete themselves when the array of + // COLLECTION::ENTRYs goes away. + } +} + + +// This method doesn't mean anything for a collection. +ACE_Token_Proxy * +ACE_Token_Collection::clone (void) const +{ + ACE_TRACE ("ACE_Token_Collection::clone"); + return (ACE_Token_Proxy *) 0; +} + +// This method doesn't mean anything for a collection. +ACE_Tokens * +ACE_Token_Collection::create_token (const ACE_TCHAR *) +{ + ACE_TRACE ("ACE_Token_Collection::create_token"); + return (ACE_Tokens *) 0; +} + +void +ACE_Token_Collection::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Token_Collection::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Collection::dump:\n") + ACE_TEXT (" debug_ = %d\n"), debug_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("collection_\n"))); + collection_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("base:\n"))); + ACE_Token_Proxy::dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/externals/ace/Token_Collection.h b/externals/ace/Token_Collection.h new file mode 100644 index 0000000..16a9bb4 --- /dev/null +++ b/externals/ace/Token_Collection.h @@ -0,0 +1,243 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Token_Collection.h + * + * $Id: Token_Collection.h 80826 2008-03-04 14:51:23Z wotte $ + * + * The ACE_Token class offers methods for acquiring, renewing, + * and releasing a synchronization token on a per-token basis. The + * ACE_Token_Collection offers an interface for performing + * operations on groups of tokens as a whole, or on a single token + * within the collection. + * + * The atomic group operations are not yet implemented. + * + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author Tim Harrison (harrison@cs.wustl.edu) + */ +//============================================================================= + +#ifndef ACE_TOKEN_COLLECTION_H +#define ACE_TOKEN_COLLECTION_H +#include /**/ "ace/pre.h" + +#include "ace/Map_Manager.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#include "ace/Local_Tokens.h" +#include "ace/Null_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Token_Collection + * + * @brief Allows atomic token group operations AND + * provides a ACE_Token manager interface. + * + * There are two types of operations offered by + * ACE_Token_Collection. The first is atomic operations on + * collections of Token_Proxies. In this respect, the + * ACE_Token_Collection can be thought of as a single token + * consisting of multiple Token_Proxies. The second role of the + * ACE_Token_Collection is as a ACE_Token manager. + * ACE_Token_Collection allows individual operations on single + * members of a collection of Token_Proxies. This provides a + * single access point for operations on multiple tokens. + * + * @bug Although ACE_Token_Collection inherits from ACE_Token_Proxy, it + * can not be including in a collection. This is because + * returns zero for now. + * + */ +class ACE_Export ACE_Token_Collection : public ACE_Token_Proxy +{ +public: + /** + * @a debug print out verbose debugging messages. @a name will give a + * name to the collection. Collections don't really need names, but + * are sometimes useful for debugging. + */ + ACE_Token_Collection (bool debug = false, + const ACE_TCHAR *name = 0); + +// Collection Management operations + + /** + * Insert a Token into the collection. All ACE_Token type + * operations performed on the collection will also be performed on + * the new_proxy until it is removed. Note that no operations + * performed prior to the insertion will be performed. Returns: 0 + * on success, -1 on failure with @c errno == problem. If a token + * proxy already exists in the collection with the same name, the + * insertion will fail. Also, is copied. Note that during + * the copy, client_id's are *not* inherited. The client ID of the + * thread using the collection will be used. Client ID's can be + * changed explicity on each proxy using is_member. + */ + int insert (ACE_Token_Proxy &token); + + /** + * Removes the ACE_Token matching the given token_name from the + * collection. On success, extract returns 0. On failure + * (token_name was not in the collection,) extract returns -1. On + * success, the state of the token found is copied into proxy. + * The returned ACE_Token_Proxy* must be deleted by the user. + */ + int extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy); + + /// Returns the proxy if true. 0 otherwise. + ACE_Token_Proxy *is_member (const ACE_TCHAR *token_name); + + /** + * Is the specified token in the collection? + * 1, yes. + * 0, no. + */ + int is_member (const ACE_Token_Proxy &token); + +// = Collective operation semantics. + +// For acquire, renew, and release, there are two interfaces. Once +// interface allows an operation on a single token in the +// collection. The collective interfaces perform atomic operations +// on the entire collection. For instance, a collective acquire +// will perform an acquire for each and every token in the +// collection or the operation will fail. Currently, these +// operations are performed with no ordering heuristics. That is, +// the Collection steps through the tokens in the order they were +// inserted. For each one it performs the operation (acquire, +// renew, or release). + + /** + * Acquire "atomically" all resources in the collection. This is + * only successfull if all tokens in the collection could be + * acquired. options contains the blocking semantics, timeout + * value, etc. Returns: 0 on success, -1 on failure with @c errno == + * problem. If and error or deadlock occurs for one of the tokens, + * all the tokens will be released and the method will return -1. + * Note that returning on detection of deadlock prevents livelock + * between competing collections. If a collection returns after + * detecting deadlock, it is the application's responsibility to not + * to blindly loop on the collection::acquire operation. In other + * words, once the collection reports deadlock, it is out of our + * hands. + */ + virtual int acquire (int notify = 0, + void (*sleep_hook)(void *) = 0, + ACE_Synch_Options &options = + ACE_Synch_Options::defaults); + + /// Acquire the token corresponding to @a token_name. The other + /// parameters are passed to ::acquire. + virtual int acquire (const ACE_TCHAR *token_name, + int notify = 0, + void (*sleep_hook)(void *) = 0, + ACE_Synch_Options &options = + ACE_Synch_Options::defaults); + + /// Try to acquire all tokens in collection. + virtual int tryacquire (void (*sleep_hook)(void *) = 0); + + /// Try to acquire @a token_name. + virtual int tryacquire (const ACE_TCHAR *token_name, + void (*sleep_hook)(void *) = 0); + + /** + * Renews "atomically" all resources in the collection. This is + * only successfull if all tokens in the collection could be + * renewed. options contains the blocking semantics, timeout + * value, etc. Returns: 0 on success, -1 on failure with @c errno == + * problem. + */ + virtual int renew (int requeue_position = 0, + ACE_Synch_Options &options = + ACE_Synch_Options::defaults); + + + /// Renew the token corresponding to @a token_name. The other + /// parameters are passed to ::renew. + virtual int renew (const ACE_TCHAR *token_name, + int requeue_position = 0, + ACE_Synch_Options &options = + ACE_Synch_Options::defaults); + + /** + * Releases "atomically" all resources in the collection. This is + * only successfull if all tokens in the collection could be + * released. options contains the blocking semantics, timeout + * value, etc. Returns: 0 on success, -1 on failure with @c errno == + * problem. + */ + virtual int release (ACE_Synch_Options &options = + ACE_Synch_Options::defaults); + + + /// Release the token corresponding to . The other + /// parameters are passed to ::release. + virtual int release (const ACE_TCHAR *token_name, + ACE_Synch_Options &options = + ACE_Synch_Options::defaults); + + ~ACE_Token_Collection (void); + + /// Dump the state of the class. + void dump (void) const; + + /// Return the name of the collection. Not very functionally + /// important, but sometimes a useful debugging tool. + virtual const ACE_TCHAR *name (void) const; + +protected: + + typedef ACE_Token_Name TOKEN_NAME; + + /// COLLECTION maintains a mapping from token names to ACE_Tokens* + typedef ACE_Map_Manager + COLLECTION; + + /// Allows iterations through collection_ + /** + * @deprecated Deprecated typedef. Use COLLECTION::ITERATOR trait instead. + */ + typedef COLLECTION::ITERATOR COLLECTION_ITERATOR; + + /// Allows iterations through collection_ + /** + * @deprecated Deprecated typedef. Use COLLECTION::ENTRY trait instead. + */ + typedef COLLECTION::ENTRY COLLECTION_ENTRY; + + /// COLLECTION maintains a mapping from token names to ACE_Tokens*. + COLLECTION collection_; + + /// Whether to print out debug messages or not. + bool debug_; + + /// Name of the collection. + ACE_TCHAR name_[ACE_MAXTOKENNAMELEN]; + + // = I'm not sure what these mean, but they have to be defined since they're + // pure virtual in ACE_Token_Proxy. + virtual ACE_Token_Proxy *clone (void) const; + virtual ACE_Tokens *create_token (const ACE_TCHAR *name); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Token_Collection.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ + +#include /**/ "ace/post.h" +#endif /* ACE_TOKEN_COLLECTION_H */ diff --git a/externals/ace/Token_Collection.inl b/externals/ace/Token_Collection.inl new file mode 100644 index 0000000..73f1e95 --- /dev/null +++ b/externals/ace/Token_Collection.inl @@ -0,0 +1,17 @@ +// -*- C++ -*- +// +// $Id: Token_Collection.inl 80826 2008-03-04 14:51:23Z wotte $ + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE const ACE_TCHAR * +ACE_Token_Collection::name (void) const +{ + return name_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/externals/ace/Token_Invariants.cpp b/externals/ace/Token_Invariants.cpp new file mode 100644 index 0000000..52b1f85 --- /dev/null +++ b/externals/ace/Token_Invariants.cpp @@ -0,0 +1,356 @@ +#include "ace/Token_Invariants.h" + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#include "ace/Object_Manager.h" +#include "ace/os_include/os_typeinfo.h" + +ACE_RCSID (ace, + Token_Invariants, + "$Id: Token_Invariants.cpp 84179 2009-01-16 07:26:45Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Token_Invariant_Manager *ACE_Token_Invariant_Manager::instance_ = 0; + +ACE_Token_Invariant_Manager * +ACE_Token_Invariant_Manager::instance (void) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::instance"); + + // Perform the Double-Check pattern... + if (instance_ == 0) + { + ACE_MT (ACE_TOKEN_CONST::MUTEX *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_TOKEN_INVARIANTS_CREATION_LOCK); + ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, *lock, 0)); + + if (instance_ == 0) + { + ACE_NEW_RETURN (instance_, + ACE_Token_Invariant_Manager, + 0); + // Register for destruction with ACE_Object_Manager. + ACE_Object_Manager::at_exit (instance_, 0, typeid (instance_).name ()); + } + } + + return instance_; +} + +ACE_Token_Invariant_Manager::ACE_Token_Invariant_Manager (void) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::ACE_Token_Invariant_Manager"); +} + +int +ACE_Token_Invariant_Manager::mutex_acquired (const ACE_TCHAR *token_name) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::mutex_acquired"); + + ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); + + ACE_Mutex_Invariants *inv = 0; + if (this->get_mutex (token_name, inv) == -1) + return -1; + + return inv->acquired (); +} + +int +ACE_Token_Invariant_Manager::acquired (const ACE_Token_Proxy *proxy) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::acquired"); + + // Reach into the proxy to find the token type. + if (proxy->token_->type () == ACE_Tokens::MUTEX) + return this->mutex_acquired (proxy->name ()); + else // ACE_Tokens::RWLOCK. + { + if (proxy->type () == ACE_RW_Token::READER) + return this->reader_acquired (proxy->name ()); + else // ACE_RW_Token::WRITER. + return this->writer_acquired (proxy->name ()); + } +} + +void +ACE_Token_Invariant_Manager::releasing (const ACE_Token_Proxy *proxy) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::releasing"); + + // Reach into the proxy to find the token type. + if (proxy->token_->type () == ACE_Tokens::MUTEX) + this->mutex_releasing (proxy->name ()); + else // ACE_Tokens::RWLOCK. + this->rwlock_releasing (proxy->name ()); +} + +void +ACE_Token_Invariant_Manager::mutex_releasing (const ACE_TCHAR *token_name) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::mutex_releasing"); + ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); + + ACE_Mutex_Invariants *inv = 0; + if (this->get_mutex (token_name, inv) == 0) + inv->releasing (); +} + +int +ACE_Token_Invariant_Manager::reader_acquired (const ACE_TCHAR *token_name) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::reader_acquired"); + ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); + + ACE_RWLock_Invariants *inv = 0; + if (this->get_rwlock (token_name, inv) == -1) + return -1; + + return inv->reader_acquired (); +} + +int +ACE_Token_Invariant_Manager::writer_acquired (const ACE_TCHAR *token_name) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::writer_acquired"); + + ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_, -1); + + ACE_RWLock_Invariants *inv = 0; + if (this->get_rwlock (token_name, inv) == -1) + return -1; + + return inv->writer_acquired (); +} + +void +ACE_Token_Invariant_Manager::rwlock_releasing (const ACE_TCHAR *token_name) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::rwlock_releasing"); + + ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); + + ACE_RWLock_Invariants *inv = 0; + if (this->get_rwlock (token_name, inv) == 0) + inv->releasing (); +} + +void +ACE_Token_Invariant_Manager::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Token_Invariant_Manager::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("mutex_collection_:\n"))); + mutex_collection_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("rwlock_collection_:\n"))); + rwlock_collection_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + + +int +ACE_Token_Invariant_Manager::get_mutex (const ACE_TCHAR *token_name, + ACE_Mutex_Invariants *&inv) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::get_mutex"); + TOKEN_NAME name (token_name); + if (mutex_collection_.find (name, inv) == -1) + // We did not find one in the collection. + { + ACE_Mutex_Invariants *new_invariant; + + ACE_NEW_RETURN (new_invariant, + ACE_Mutex_Invariants, + -1); + if (mutex_collection_.bind (name, new_invariant) == -1) + { + delete new_invariant; + return -1; + } + + if (mutex_collection_.find (name, inv) == -1) + // We did not find one in the collection. + return -1; + } + + return 0; +} + +int +ACE_Token_Invariant_Manager::get_rwlock (const ACE_TCHAR *token_name, + ACE_RWLock_Invariants *&inv) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::get_rwlock"); + TOKEN_NAME name (token_name); + if (rwlock_collection_.find (name, inv) == -1) + // We did not find one in the collection. + { + ACE_RWLock_Invariants *new_invariant; + + ACE_NEW_RETURN (new_invariant, + ACE_RWLock_Invariants, + -1); + if (rwlock_collection_.bind (name, new_invariant) == -1) + return -1; + + if (rwlock_collection_.find (name, inv) == -1) + // We did not find one in the collection. + return -1; + } + + return 0; +} + + +ACE_Token_Invariant_Manager::~ACE_Token_Invariant_Manager (void) +{ + ACE_TRACE ("ACE_Token_Invariant_Manager::~ACE_Token_Invariant_Manager"); + + MUTEX_COLLECTION::ITERATOR iterator (mutex_collection_); + + for (MUTEX_COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + delete temp->int_id_; + + RWLOCK_COLLECTION::ITERATOR iterator2 (rwlock_collection_); + + for (RWLOCK_COLLECTION::ENTRY *temp2 = 0; + iterator2.next (temp2) != 0; + iterator2.advance ()) + delete temp2->int_id_; +} + +// ************************************************** +// ************************************************** +// ************************************************** + +ACE_Mutex_Invariants::ACE_Mutex_Invariants (void) +: owners_ (0) +{ +} + +int +ACE_Mutex_Invariants::acquired (void) +{ + if (++owners_ > 1) + { + owners_ = 42; + return 0; + } + else + return 1; +} + +void +ACE_Mutex_Invariants::releasing (void) +{ + if (owners_ == 1) + --owners_; +} + +ACE_Mutex_Invariants::ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs) +: owners_ (rhs.owners_) +{ +} + +void +ACE_Mutex_Invariants::operator= (const ACE_Mutex_Invariants &rhs) +{ + owners_ = rhs.owners_; +} + +void +ACE_Mutex_Invariants::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Mutex_Invariants::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("owners_ = %d\n"), owners_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// ************************************************** +// ************************************************** +// ************************************************** + +ACE_RWLock_Invariants::ACE_RWLock_Invariants (void) +: writers_ (0), + readers_ (0) +{ +} + +int +ACE_RWLock_Invariants::writer_acquired (void) +{ + if (readers_ > 0) + { + writers_ = readers_ = 42; + return 0; + } + else if (++writers_ > 1) + { + writers_ = readers_ = 42; + return 0; + } + else + return 1; +} + +int +ACE_RWLock_Invariants::reader_acquired (void) +{ + if (writers_ > 0) + { + writers_ = readers_ = 42; + return 0; + } + else + { + ++readers_; + return 1; + } +} + +void +ACE_RWLock_Invariants::releasing (void) +{ + if (writers_ == 1) + writers_ = 0; + else if (readers_ > 0) + --readers_; +} + +ACE_RWLock_Invariants::ACE_RWLock_Invariants (const ACE_RWLock_Invariants &rhs) +: writers_ (rhs.writers_), + readers_ (rhs.readers_) +{ +} + +void +ACE_RWLock_Invariants::operator= (const ACE_RWLock_Invariants &rhs) +{ + writers_ = rhs.writers_; + readers_ = rhs.readers_; +} + +void +ACE_RWLock_Invariants::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_RWLock_Invariants::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("writers_ = %d readers_ = %d\n"), + writers_, readers_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/externals/ace/Token_Invariants.h b/externals/ace/Token_Invariants.h new file mode 100644 index 0000000..5cec394 --- /dev/null +++ b/externals/ace/Token_Invariants.h @@ -0,0 +1,245 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Token_Invariants.h + * + * $Id: Token_Invariants.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Tim Harrison (harrison@cs.wustl.edu) + * + * Allows applications to test that invariants are always + * satisfied. Can test mutexes and readers/writer locks. Does + * not test recursive acquisition. + * + * + */ +//============================================================================= + +#ifndef ACE_TOKEN_INVARIANTS_H +#define ACE_TOKEN_INVARIANTS_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#include "ace/Map_Manager.h" +#include "ace/Local_Tokens.h" +#include "ace/Null_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Mutex_Invariants + * + * @brief Mutex Invariants + * = INVARIANTS + * 1. Only one owner at a time. + */ +class ACE_Export ACE_Mutex_Invariants +{ +public: + /// Default construction. + ACE_Mutex_Invariants (void); + + /// Returns 1 on success, 0 when an invariant has been violated and + /// -1 on error. + int acquired (void); + + /// Updates internal database. + void releasing (void); + + // = Map_Manager operations. + + /// Copy construction. + ACE_Mutex_Invariants (const ACE_Mutex_Invariants &rhs); + + /// Copy. + void operator= (const ACE_Mutex_Invariants &rhs); + + /// Dump the state of the class. + void dump (void) const; + +private: + /// Number of owners. This had better be 0 >= owners_ <= 1; + int owners_; +}; + +/** + * @class ACE_RWLock_Invariants + * + * @brief RWLock Invariants + * + * Preserve the following invariants: + * -# Only one writer at a time. + * -# If there is an owning writer, there are no owning readers. + */ +class ACE_Export ACE_RWLock_Invariants +{ +public: + /// Default construction. + ACE_RWLock_Invariants (void); + + /// Returns 1 on success, 0 when an invariant has been violated and + /// -1 on error. + int writer_acquired (void); + + /// Returns 1 on success, 0 when an invariant has been violated and + /// -1 on error. + int reader_acquired (void); + + /// Updates internal database. + void releasing (void); + + // = Map_Manager operations. + + /// Copy construction. + ACE_RWLock_Invariants (const ACE_RWLock_Invariants &rhs); + + /// Copy. + void operator= (const ACE_RWLock_Invariants &rhs); + + /// Dump the state of the class. + void dump (void) const; + +private: + /// Number of owning writers. + int writers_; + + /// Number of owning readers. + int readers_; +}; + +/** + * @class ACE_Token_Invariant_Manager + * + * @brief Token Invariants + * + * The Token Invariant Manager allows applications to test that + * invariants are always satisfied. Currently, Token_Invariants + * can test mutexes and readers/writer locks. Does not test + * recursive acquisition. + * Note that this class does not ever clean its database. Until + * destroyed, it's size will forever increase. + */ +class ACE_Export ACE_Token_Invariant_Manager : public ACE_Cleanup +{ +public: + + /// Singleton access point. + static ACE_Token_Invariant_Manager *instance (void); + + // = Polymorphic methods. Just pass in the proxy and the method + // figures out the type of the token. + + /// Returns 1 on success, 0 when an invariant has been violated and + /// -1 on error. + int acquired (const ACE_Token_Proxy *proxy); + + /// Updates internal database. + void releasing (const ACE_Token_Proxy *proxy); + + // = Explicit methods. These to not require actual proxies in order + // to test a scenario. + + /// Returns 1 on success, 0 when an invariant has been violated and + /// -1 on error. + int mutex_acquired (const ACE_TCHAR *token_name); + + /// Updates internal database. + void mutex_releasing (const ACE_TCHAR *token_name); + + /// Returns 1 on success, 0 when an invariant has been violated and + /// -1 on error. + int reader_acquired (const ACE_TCHAR *token_name); + + /// Returns 1 on success, 0 when an invariant has been violated and + /// -1 on error. + int writer_acquired (const ACE_TCHAR *token_name); + + /// Updates internal database. + void rwlock_releasing (const ACE_TCHAR *token_name); + + /// Dump the state of the class. + void dump (void) const; + + // = The following two method should be in the protected part of the + // class. Bugs with certain compilers preclude this. + /// Prevent non-singleton construction. + ACE_Token_Invariant_Manager (void); + + /// Destruction. + virtual ~ACE_Token_Invariant_Manager (void); + +protected: + /// Return or create. + int get_mutex (const ACE_TCHAR *token_name, + ACE_Mutex_Invariants *&inv); + + /// Return or create. + int get_rwlock (const ACE_TCHAR *token_name, + ACE_RWLock_Invariants *&inv); + + /// ACE_Mutex_Token used to lock internal data structures. + ACE_TOKEN_CONST::MUTEX lock_; + + /// This may be changed to a template type. + typedef ACE_Token_Name TOKEN_NAME; + + /// COLLECTION maintains a mapping from token names to mutexes. + typedef ACE_Map_Manager + MUTEX_COLLECTION; + + /// Allows iterations through collection. + /** + * @deprecated Deprecated typedef. Use MUTEX_COLLECTION::ITERATOR trait + * instead. + */ + typedef MUTEX_COLLECTION::ITERATOR MUTEX_COLLECTION_ITERATOR; + + /// Allows iterations through collection. + /** + * @deprecated Deprecated typedef. Use MUTEX_COLLECTION::ENTRY trait + * instead. + */ + typedef MUTEX_COLLECTION::ENTRY MUTEX_COLLECTION_ENTRY; + + /// MUTEX_COLLECTION maintains a mapping from token names to mutexes. + MUTEX_COLLECTION mutex_collection_; + + /// COLLECTION maintains a mapping from token names to mutexes. + typedef ACE_Map_Manager + RWLOCK_COLLECTION; + + /// Allows iterations through collection. + /** + * @deprecated Deprecated typedef. Use RWLOCK_COLLECTION::ITERATOR trait + * instead. + */ + typedef RWLOCK_COLLECTION::ITERATOR RWLOCK_COLLECTION_ITERATOR; + + /// Allows iterations through collection. + /** + * @deprecated Deprecated typedef. Use RWLOCK_COLLECTION::ENTRY trait + * instead. + */ + typedef RWLOCK_COLLECTION::ENTRY RWLOCK_COLLECTION_ENTRY; + + /// MUTEX_COLLECTION maintains a mapping from token names to mutexes. + RWLOCK_COLLECTION rwlock_collection_; + + /// Singleton pointer. + static ACE_Token_Invariant_Manager *instance_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ + +#include /**/ "ace/post.h" +#endif /* ACE_TOKEN_INVARIANTS_H */ diff --git a/externals/ace/Token_Manager.cpp b/externals/ace/Token_Manager.cpp new file mode 100644 index 0000000..1127622 --- /dev/null +++ b/externals/ace/Token_Manager.cpp @@ -0,0 +1,274 @@ +#include "ace/Token_Manager.h" + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#include "ace/Object_Manager.h" +#include "ace/os_include/os_typeinfo.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Token_Manager.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (ace, + Token_Manager, + "$Id: Token_Manager.cpp 84179 2009-01-16 07:26:45Z johnnyw $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// singleton token manager +ACE_Token_Manager *ACE_Token_Manager::token_manager_ = 0; + +ACE_Token_Manager::ACE_Token_Manager () +{ + ACE_TRACE ("ACE_Token_Manager::ACE_Token_Manager"); +} + +ACE_Token_Manager::~ACE_Token_Manager () +{ + ACE_TRACE ("ACE_Token_Manager::~ACE_Token_Manager"); + + COLLECTION::ITERATOR iterator (collection_); + + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + { + // @ should I be doing an unbind here? + delete temp->int_id_; + // The ext_id_'s delete themselves when the array of + // COLLECTION::ENTRYs goes away. + } +} + +ACE_Token_Manager * +ACE_Token_Manager::instance (void) +{ + ACE_TRACE ("ACE_Token_Manager::instance"); + + // This first check is to avoid acquiring the mutex in the common + // case. Double-Check pattern rules. + if (token_manager_ == 0) + { +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + ACE_TOKEN_CONST::MUTEX *lock = + ACE_Managed_Object::get_preallocated_object + (ACE_Object_Manager::ACE_TOKEN_MANAGER_CREATION_LOCK); + ACE_GUARD_RETURN (ACE_TOKEN_CONST::MUTEX, ace_mon, *lock, 0); +#endif /* ACE_MT_SAFE */ + + if (token_manager_ == 0) + { + ACE_NEW_RETURN (token_manager_, + ACE_Token_Manager, + 0); + // Register for destruction with ACE_Object_Manager. + ACE_Object_Manager::at_exit (token_manager_, 0, typeid (token_manager_).name ()); + } + } + + return token_manager_; +} + +void +ACE_Token_Manager::get_token (ACE_Token_Proxy *proxy, + const ACE_TCHAR *token_name) +{ + ACE_TRACE ("ACE_Token_Manager::get_token"); + // Hmm. I think this makes sense. We perform our own locking here + // (see safe_acquire.) We have to make sure that only one thread + // uses the collection at a time. + + ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); + + TOKEN_NAME name (token_name); + + if (collection_.find (name, proxy->token_) == -1) + // We did not find one in the collection. + { + // Make one. + proxy->token_ = proxy->create_token (token_name); + + // Put it in the collection. + if (collection_.bind (name, proxy->token_) == -1) + { + delete proxy->token_; + proxy->token_ = 0; + } + } + + if (proxy->token_ != 0) + proxy->token_->inc_reference (); + + // We may be returning proxy->token_ == 0 if new failed, caller must + // check. +} + +// 0. check_deadlock (TOKEN) +// 1. if TOKEN->visited (), return 0. +// 2. mark TOKEN visited. +// 3. get ALL_OWNERS +// 4. if CLIENT in ALL_OWNERS, return *DEADLOCK*. +// 5. for each OWNER in ALL_OWNERS, +// 6. if OWNER is not waiting for a NEW_TOKEN, continue. +// 7. else, if check_deadlock (NEW_TOKEN) == 1, return *DEADLOCK* +// 8. return 0. + +int +ACE_Token_Manager::check_deadlock (ACE_Token_Proxy *proxy) +{ + ACE_TRACE ("ACE_Token_Manager::check_deadlock"); + + // Start the recursive deadlock detection algorithm. + int result = this->check_deadlock (proxy->token_, proxy); + + // Whether or not we detect deadlock, we have to unmark all tokens + // for the next time. + COLLECTION::ITERATOR iterator (collection_); + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + temp->int_id_->visit (0); + + return result; +} + +int +ACE_Token_Manager::check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy) +{ + ACE_TRACE ("ACE_Token_Manager::check_deadlock"); + + if (token->visited ()) + return 0; + + token->visit (1); + + ACE_Tokens::OWNER_STACK owners; + + int is_owner = token->owners (owners, proxy->client_id ()); + + switch (is_owner) + { + case -1: + // Error. + return -1; + case 1: + // The caller is an owner, so we have a deadlock situation. + if (debug_) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Deadlock detected.\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s owns %s and is waiting for %s.\n"), + proxy->client_id (), + token->name (), + proxy->token_->name ())); + } + + return 1; + case 0: + default: + // Recurse on each owner. + while (!owners.is_empty ()) + { + ACE_TPQ_Entry *e; + owners.pop (e); + // If the owner is waiting on another token, recurse. + ACE_Tokens *twf = this->token_waiting_for (e->client_id ()); + if ((twf != 0) && + (this->check_deadlock (twf, proxy) == 1)) + { + if (debug_) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s owns %s and is waiting for %s.\n"), + e->client_id (), + token->name (), + twf->name ())); + } + return 1; + } + // else, check the next owner. + } + + // We've checked all the owners and found no deadlock. + return 0; + } +} + + +ACE_Tokens * +ACE_Token_Manager::token_waiting_for (const ACE_TCHAR *client_id) +{ + COLLECTION::ITERATOR iterator (collection_); + for (COLLECTION::ENTRY *temp = 0; + iterator.next (temp) != 0; + iterator.advance ()) + { + if (temp->int_id_->is_waiting_for (client_id)) + return temp->int_id_; + } + + // nothing was found, return NULL. + return 0; +} + +// Notify the token manager that a token is has been released. If +// as a result, there is no owner of the token, the token is +// deleted. +void +ACE_Token_Manager::release_token (ACE_Tokens *&token) +{ + ACE_TRACE ("ACE_Token_Manager::release_token"); + // again, let's perform our own locking here. + + ACE_GUARD (ACE_TOKEN_CONST::MUTEX, ace_mon, this->lock_); + + if (token->dec_reference () == 0) + { + // No one has the token, so we can delete it and remove it from + // our collection. First, let's get it from the collection. + TOKEN_NAME token_name (token->name ()); + + ACE_Tokens *temp; + + if (collection_.unbind (token_name, temp) == -1) + // we did not find one in the collection + { + errno = ENOENT; + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Token Manager could not release %s:%d\n"), + token->name (), token->type ())); + // @@ bad + } + else + // we found it + { + // sanity pointer comparison. The token referenced by the + // proxy better be the one we found in the list. + ACE_ASSERT (token == temp); + delete token; // or delete temp + // we set their token to zero. if the calling proxy is + // still going to be used, it had better check it's token + // value before calling a method on it! + token = 0; + } + } + // else + // someone is still interested in the token, so keep it around. +} + +void +ACE_Token_Manager::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Token_Manager::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Token_Manager::dump:\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("lock_\n"))); + lock_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("collection_\n"))); + collection_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/externals/ace/Token_Manager.h b/externals/ace/Token_Manager.h new file mode 100644 index 0000000..9882e28 --- /dev/null +++ b/externals/ace/Token_Manager.h @@ -0,0 +1,150 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Token_Manager.h + * + * $Id: Token_Manager.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Tim Harrison (harrison@cs.wustl.edu) + */ +//============================================================================= + +#ifndef ACE_TOKEN_MANAGER_H +#define ACE_TOKEN_MANAGER_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Local_Tokens.h" + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#include "ace/Null_Mutex.h" +#include "ace/Map_Manager.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Local_Mutex; +class ACE_Mutex_Token; + +/** + * @class ACE_Token_Manager + * + * @brief Manages all tokens in a process space. + * + * Factory: Proxies use the token manager to obtain token + * references. This allows multiple proxies to reference the same + * logical token. + * Deadlock detection: Tokens use the manager to check for + * deadlock situations during acquires. + */ +class ACE_Export ACE_Token_Manager : public ACE_Cleanup +{ + + // To add a new type of token (e.g. semaphore), do the following + // steps: 1. Create a new derivation of ACE_Token. This class + // defines the semantics of the new Token. 2. Create a + // derivation of ACE_Token_Manager. You will only need to + // redefine make_mutex. +public: + ACE_Token_Manager (void); + virtual ~ACE_Token_Manager (void); + + /// Get the pointer to token manager singleton. + static ACE_Token_Manager *instance (void); + + /// Set the pointer to token manager singleton. + void instance (ACE_Token_Manager *); + + /** + * The Token manager uses ACE_Token_Proxy::token_id_ to look for + * an existing token. If none is found, the Token Manager calls + * ACE_Token_Proxy::create_token to create a new one. When + * finished, sets ACE_Token_Proxy::token_. @a token_name uniquely + * id's the token name. + */ + void get_token (ACE_Token_Proxy *, const ACE_TCHAR *token_name); + + /** + * Check whether acquire will cause deadlock or not. + * returns 1 if the acquire will _not_ cause deadlock. + * returns 0 if the acquire _will_ cause deadlock. + * This method ignores recursive acquisition. That is, it will not + * report deadlock if the client holding the token requests the + * token again. Thus, it assumes recursive mutexes. + */ + int check_deadlock (ACE_Token_Proxy *proxy); + int check_deadlock (ACE_Tokens *token, ACE_Token_Proxy *proxy); + + /// Notify the token manager that a token has been released. If as a + /// result, there is no owner of the token, the token is deleted. + void release_token (ACE_Tokens *&token); + + /** + * This is to allow Tokens to perform atomic transactions. The + * typical usage is to acquire this mutex, check for a safe_acquire, + * perform some queueing (if need be) and then release the lock. + * This is necessary since safe_acquire is implemented in terms of + * the Token queues. + */ + ACE_TOKEN_CONST::MUTEX &mutex (void); + + /// Dump the state of the class. + void dump (void) const; + + /// Turn debug mode on/off. + void debug (bool d); + +private: + /// Whether to print debug messages or not. + bool debug_; + + /// pointer to singleton token manager. + static ACE_Token_Manager *token_manager_; + + /// Return the token that the given client_id is waiting for, if any + ACE_Tokens *token_waiting_for (const ACE_TCHAR *client_id); + + /// ACE_Mutex_Token used to lock internal data structures. + ACE_TOKEN_CONST::MUTEX lock_; + + /// This may be changed to a template type. + typedef ACE_Token_Name TOKEN_NAME; + + /// COLLECTION maintains a mapping from token names to ACE_Tokens* + typedef ACE_Map_Manager + COLLECTION; + + /// Allows iterations through collection_ + /** + * @deprecated Deprecated typedef. Use COLLECTION::ITERATOR trait + * instead. + */ + typedef COLLECTION::ITERATOR COLLECTION_ITERATOR; + + /// Allows iterations through collection_ + /** + * @deprecated Deprecated typedef. Use COLLECTION::ENTRY trait + * instead. + */ + typedef COLLECTION::ENTRY COLLECTION_ENTRY; + + /// COLLECTION maintains a mapping from token names to ACE_Tokens*. + COLLECTION collection_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Token_Manager.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ + +#include /**/ "ace/post.h" +#endif /* ACE_TOKEN_MANAGER_H */ diff --git a/externals/ace/Token_Manager.inl b/externals/ace/Token_Manager.inl new file mode 100644 index 0000000..a44778c --- /dev/null +++ b/externals/ace/Token_Manager.inl @@ -0,0 +1,25 @@ +// -*- C++ -*- +// +// $Id: Token_Manager.inl 80826 2008-03-04 14:51:23Z wotte $ + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_TOKEN_CONST::MUTEX & +ACE_Token_Manager::mutex (void) +{ + ACE_TRACE ("ACE_Token_Manager::mutex"); + return lock_; +} + +ACE_INLINE void +ACE_Token_Manager::debug (bool d) +{ + ACE_TRACE ("ACE_Token_Manager::debug"); + debug_ = d; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/externals/ace/Token_Request_Reply.cpp b/externals/ace/Token_Request_Reply.cpp new file mode 100644 index 0000000..598afe0 --- /dev/null +++ b/externals/ace/Token_Request_Reply.cpp @@ -0,0 +1,186 @@ +// $Id: Token_Request_Reply.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Token_Request_Reply.h" + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#if !defined (__ACE_INLINE__) +#include "ace/Token_Request_Reply.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Token_Request_Reply, "$Id: Token_Request_Reply.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Default "do nothing" constructor. + +ACE_Token_Request::ACE_Token_Request (void) + : token_name_ (0), + client_id_ (0) +{ +} + +// Create a ACE_Token_Request message. + +ACE_Token_Request::ACE_Token_Request (int token_type, + int proxy_type, + ACE_UINT32 operation_type, + const ACE_TCHAR token_name[], + const ACE_TCHAR client_id[], + const ACE_Synch_Options &options) +{ + this->token_type (token_type); + this->proxy_type (proxy_type); + this->operation_type (operation_type); + this->requeue_position (0); // to avoid Purify UMR + this->notify (0); // to avoid Purify UMR + transfer_.arg_ = 0; // to avoid Purify UMR + ACE_OS::memset (transfer_.data_, 0, sizeof transfer_.data_); // to avoid Purify UMR + this->token_name (token_name, client_id); + this->options (options); +} + +// Encode the transfer buffer into network byte order +// so that it can be sent to the server. + +int +ACE_Token_Request::encode (void *&buf) +{ + buf = (void *) &this->transfer_; + return this->length (); +} + +// Decode the transfer buffer into host byte byte order +// so that it can be used by the server. + +int +ACE_Token_Request::decode (void) +{ + this->token_name_ = this->transfer_.data_; + + options_.set (transfer_.use_timeout_ == 1 ? ACE_Synch_Options::USE_TIMEOUT : 0, + ACE_Time_Value (transfer_.sec_, transfer_.usec_), + (void *) transfer_.arg_); + + // Decode the variable-sized portion. + size_t token_len = ACE_OS::strlen (this->token_name_); + + // Check to make sure this->tokenName_ isn't too long! + if (token_len >= ACE_MAXTOKENNAMELEN) + { + errno = ENAMETOOLONG; + return -1; + } + else // Skip this->tokenName_ + '\0' + ':'. + this->client_id_ = + &this->token_name_[(token_len + 2) * sizeof (ACE_TCHAR)]; + + // Fixed size header + // token_name_ plus '\0' + // ':' + // client_id_ plus '\0' + size_t data_size = ACE_TOKEN_REQUEST_HEADER_SIZE + + ACE_OS::strlen (this->token_name_) + 1 + + ACE_OS::strlen (this->client_id_) + 1 + + 1; + + // Make sure the message was correctly received and framed. + return this->length () == data_size ? 0 : -1; +} + +// Print out the current values of the ACE_Token_Request. + +void +ACE_Token_Request::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("*******\nlength = %d\ntoken name = %s\nclient id = %s\n"), + this->length (), this->token_name (), this->client_id ())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("type = "))); + + if (this->token_type () == ACE_Tokens::MUTEX) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("MUTEX\n"))); + else // == ACE_Tokens::RWLOCK + { + if (this->proxy_type () == ACE_RW_Token::READER) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RLOCK\n"))); + else // == WRITER + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("WLOCK\n"))); + } + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("operation = "))); + switch (this->operation_type ()) + { + case ACE_Token_Request::ACQUIRE: + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACQUIRE\n"))); + break; + case ACE_Token_Request::RELEASE: + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RELEASE\n"))); + break; + case ACE_Token_Request::RENEW: + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RENEW\n"))); + break; + default: + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" = %d\n"), this->operation_type ())); + break; + } + + if (this->options ()[ACE_Synch_Options::USE_TIMEOUT] == 0) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("blocking forever\n"))); + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting for %d secs and %d usecs\n"), + this->options ().timeout ().sec (), this->options ().timeout ().usec ())); + } + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +// ************************************************************ +// ************************************************************ +// ************************************************************ + +// Create a ACE_Token_Reply message. + +ACE_Token_Reply::ACE_Token_Reply (void) // Type of reply. +{ + this->arg (0); + this->errnum (0); + this->length (sizeof (Transfer)); +} + +// Encode the transfer buffer into network byte order +// so that it can be sent to the client. + +int +ACE_Token_Reply::encode (void *&buf) +{ + buf = (void *) &this->transfer_; + return this->length (); +} + +// Decode the transfer buffer into host byte order +// so that it can be used by the client. + +int +ACE_Token_Reply::decode (void) +{ + return 0; +} + +// Print out current values of the ACE_Token_Reply object. + +void +ACE_Token_Reply::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("*******\nlength = %d\nerrnum = %d"), + this->length (), this->errnum ())); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("arg = %d"), this->arg ())); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/externals/ace/Token_Request_Reply.h b/externals/ace/Token_Request_Reply.h new file mode 100644 index 0000000..01a7cfd --- /dev/null +++ b/externals/ace/Token_Request_Reply.h @@ -0,0 +1,270 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Token_Request_Reply.h + * + * $Id: Token_Request_Reply.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Define the format used to exchange messages between the + * ACE_Token Server and its clients. + * + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author Tim Harrison (harrison@cs.wustl.edu) + */ +//============================================================================= + + +#ifndef ACE_TOKEN_REQUEST_REPLY_H +#define ACE_TOKEN_REQUEST_REPLY_H +#include /**/ "ace/pre.h" + +#include "ace/Local_Tokens.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/// Specifies the size of the fixed length portion of +/// the Transfer structure in ACE_Token_Request +#define ACE_TOKEN_REQUEST_HEADER_SIZE 40 + +/** + * @class ACE_Token_Request + * + * @brief Message format for delivering requests to the ACE_Token Server. + * + * This class is implemented to minimize data copying. + * In particular, all marshaling is done in situ... + */ +class ACE_Export ACE_Token_Request +{ +public: + /// Operation types. + enum OPERATION + { + /// Acquire the token. + ACQUIRE, + /// Release the token. + RELEASE, + /// Renew the token. + RENEW, + /// Remove the token. + REMOVE, + // Try to acquire the token. + TRY_ACQUIRE + }; + + /// Default constructor. + ACE_Token_Request (void); + + /** + * @param token_type MUTEX, RWLOCK + * @param proxy_type MUTEX, RLOCK, WLOCK (acquires mean different things) + * @param operation method + * @param token_name + * @param client_id + * @param options We check USE_TIMEOUT and use the arg. + */ + ACE_Token_Request (int token_type, + int proxy_type, + ACE_UINT32 operation, + const ACE_TCHAR token_name[], + const ACE_TCHAR client_id[], + const ACE_Synch_Options &options); + + /// Get the length of the encoded/decoded message. + ACE_UINT32 length (void) const; + + /// Set the length of the encoded/decoded message. + void length (ACE_UINT32); + + /// Get the type of proxy + int proxy_type (void) const; + + /// Set the type of proxy + void proxy_type (int proxy_type); + + /// Get the type of token + int token_type (void) const; + + /// Set the type of token + void token_type (int token_type); + + /// Get the type of the operation. + ACE_UINT32 operation_type (void) const; + + /// Set the type of the operation. + void operation_type (ACE_UINT32); + + /// Get the requeue position. These should be used when renew + /// is the operation type. + ACE_UINT32 requeue_position (void) const; + + /// Set the requeue position. These should be used when renew + /// is the operation type. + void requeue_position (ACE_UINT32); + + /// Get notify. These should be used when acquire is the operation type. + ACE_UINT32 notify (void) const; + + /// Set notify. These should be used when acquire is the operation type. + void notify (ACE_UINT32); + + /// Get the timeout. + ACE_Synch_Options &options (void) const; + + /// Set the timeout. + void options (const ACE_Synch_Options &options); + + // = Set/get the name of the token and the client id. The set + // method is combined to make it easier on us. We're copying the + // names as a contiguous buffer. + ACE_TCHAR *token_name (void) const; + ACE_TCHAR *client_id (void) const; + void token_name (const ACE_TCHAR *token_name, const ACE_TCHAR *client_id); + + /// Encode the message before transmission. + int encode (void *&); + + /// Decode message after reception. This must be called to set the + /// internal options. + int decode (void); + + /// Print out the values of the message for debugging purposes. + void dump (void) const; + +private: + // = The 5 fields in the struct are transmitted to the server. + // The remaining 2 fields are not tranferred -- they are used only on + // the server-side to simplify lookups. + + struct Transfer + { + /// Length of entire request. + ACE_UINT32 length_; + + /// Type of the request (i.e., MUTEX, RLOCK, WLOCK... + ACE_UINT32 token_type_; + + /// Type of the request (i.e., MUTEX, RLOCK, WLOCK... + ACE_UINT32 proxy_type_; + + /// Type of the request (i.e., , , , and ). + ACE_UINT32 operation_type_; + + /// this only makes sense when operation type is renew + ACE_UINT32 requeue_position_; + + /// this only makes sense when operation type is renew + ACE_UINT32 notify_; + + // = ACE_Synch_Options stuff + + /// Indicates if we should block forever. If 1, then + /// and indicates how long we should wait. If 0, + /// then we block forever. + ACE_UINT32 use_timeout_; + + /// Max seconds willing to wait for token if not blocking forever. + ACE_UINT32 sec_; + + /// Max micro seconds to wait for token if not blocking forever. + ACE_UINT32 usec_; + + /// value returned in ; + ACE_UINT32 arg_; + + /// The data portion contains the including a 0 terminator, + /// a ':', then the including a 0 terminator + ACE_TCHAR data_[ACE_MAXTOKENNAMELEN + ACE_MAXCLIENTIDLEN + 3]; + } transfer_; + + /// Pointer to the beginning of the token name in this->data_. + ACE_TCHAR *token_name_; + + /// Pointer to the beginning of the client id in this->data_; + ACE_TCHAR *client_id_; + + /// Holds arg, sec, usec, etc. + ACE_Synch_Options options_; +}; + +/** + * @class ACE_Token_Reply + * + * @brief Message format for delivering replies from the ACE_Token Server. + * + * This class is implemented to minimize data copying. + * In particular, all marshaling is done in situ... + */ +class ACE_Export ACE_Token_Reply +{ +public: + /// Default constructor. + ACE_Token_Reply (void); + + /// Get the length of the encoded/decoded message. + ACE_UINT32 length (void) const; + + /// Set the length of the encoded/decoded message. + void length (ACE_UINT32); + + /// Get the errno of a reply. + ACE_UINT32 errnum (void) const; + + /// Set the errno of a reply. + void errnum (ACE_UINT32); + + /// Get the arg of a reply. + ACE_UINT32 arg (void) const; + + /// Set the arg of a reply. + void arg (ACE_UINT32); + + /// Encode the message before transfer. + int encode (void *&); + + /// Decode a message after reception. + int decode (void); + + /// Print out the values of the message for debugging purposes. + void dump (void) const; + +private: + // = The 2 fields in the struct are transmitted to the server. + + struct Transfer + { + /// Length of entire reply. + ACE_UINT32 length_; + + /// Indicates why error occurred if type_> == . + /// Typical reasons include: + /// @c EWOULDBLOCK (if client requested a non-blocking check for the token). + /// @c ETIME (if the client timed out after waiting for the token). + /// (if the token lock was removed out from underneath a waiter). + /// (attempt to renew a token that isn't owned by the client). + ACE_UINT32 errno_; + + /// magic cookie + ACE_UINT32 arg_; + + } transfer_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Token_Request_Reply.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_TOKENS_LIBRARY */ + +#include /**/ "ace/post.h" +#endif /* ACE_TOKEN_REQUEST_REPLY_H */ diff --git a/externals/ace/Token_Request_Reply.inl b/externals/ace/Token_Request_Reply.inl new file mode 100644 index 0000000..4291bfa --- /dev/null +++ b/externals/ace/Token_Request_Reply.inl @@ -0,0 +1,205 @@ +// -*- C++ -*- +// +// $Id: Token_Request_Reply.inl 80826 2008-03-04 14:51:23Z wotte $ + +#if defined (ACE_HAS_TOKENS_LIBRARY) + +#include "ace/Truncate.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// = Set/get the length of the encoded/decoded message. + +ACE_INLINE ACE_UINT32 +ACE_Token_Request::length (void) const +{ + return ntohl (this->transfer_.length_); +} + +ACE_INLINE void +ACE_Token_Request::length (ACE_UINT32 l) +{ + this->transfer_.length_ = htonl (l); +} + +// = Set/get the type of the message. +ACE_INLINE int +ACE_Token_Request::token_type (void) const +{ + return (int) ntohl (this->transfer_.token_type_); +} + +ACE_INLINE void +ACE_Token_Request::token_type (int t) +{ + this->transfer_.token_type_ = htonl ((ACE_UINT32) t); +} + +// = Set/get the type of the message. +ACE_INLINE int +ACE_Token_Request::proxy_type (void) const +{ + return (int) ntohl (this->transfer_.proxy_type_); +} + +ACE_INLINE void +ACE_Token_Request::proxy_type (int t) +{ + this->transfer_.proxy_type_ = htonl ((ACE_UINT32) t); +} + +// = Set/get the type of the message. +ACE_INLINE ACE_UINT32 +ACE_Token_Request::operation_type (void) const +{ + return ntohl (this->transfer_.operation_type_); +} + +ACE_INLINE void +ACE_Token_Request::operation_type (ACE_UINT32 t) +{ + this->transfer_.operation_type_ = htonl (t); +} + +// = Set/get the requeue position +ACE_INLINE ACE_UINT32 +ACE_Token_Request::requeue_position (void) const +{ + return ntohl (this->transfer_.requeue_position_); +} + +ACE_INLINE void +ACE_Token_Request::requeue_position (ACE_UINT32 rq) +{ + this->transfer_.requeue_position_ = htonl (rq); +} + +// = Set/get the requeue position +ACE_INLINE ACE_UINT32 +ACE_Token_Request::notify (void) const +{ + return ntohl (this->transfer_.notify_); +} + +ACE_INLINE void +ACE_Token_Request::notify (ACE_UINT32 rq) +{ + this->transfer_.notify_ = htonl (rq); +} + +// = Set/get the blocking semantics. +ACE_INLINE ACE_Synch_Options & +ACE_Token_Request::options (void) const +{ + return (ACE_Synch_Options &) options_; +} + +ACE_INLINE void +ACE_Token_Request::options (const ACE_Synch_Options &opt) +{ + // fight the friggin const from hell + ACE_Synch_Options *options = (ACE_Synch_Options *) &opt; + + transfer_.use_timeout_ = options->operator[](ACE_Synch_Options::USE_TIMEOUT); + if (transfer_.use_timeout_ == 1) + { + transfer_.usec_ = options->timeout ().usec (); + if (options->timeout ().sec () > (time_t) ACE_UINT32_MAX) + transfer_.sec_ = ACE_UINT32_MAX; + else + transfer_.sec_ = static_cast (options->timeout ().sec ()); + } + else + { + transfer_.usec_ = 0; + transfer_.sec_ = 0; + } +} + +// = Set/get the name of the token. +ACE_INLINE ACE_TCHAR * +ACE_Token_Request::token_name (void) const +{ + return token_name_; +} + +ACE_INLINE void +ACE_Token_Request::token_name (const ACE_TCHAR *token_name, + const ACE_TCHAR *client_id) +{ + size_t token_name_length = ACE_OS::strlen (token_name) + 1; // Add 1 for '\0'. + size_t client_id_length = ACE_OS::strlen (client_id) + 1; // Add 1 for '\0'. + + // Set up pointers and copy token_name and client_id into request. + token_name_ = this->transfer_.data_; + client_id_ = &this->token_name_[token_name_length + 1]; // Add 1 for ':'; + client_id_[-1] = ACE_TEXT (':'); // Insert the ':' before this->clientId_. + + (void) ACE_OS::memcpy (this->token_name_, + token_name, + token_name_length * sizeof (ACE_TCHAR)); + (void) ACE_OS::memcpy (this->client_id_, + client_id, + client_id_length * sizeof (ACE_TCHAR)); + + // Fixed length header size + size_t len = ACE_TOKEN_REQUEST_HEADER_SIZE; + + // ... then add in the amount of the variable-sized portion. + len += token_name_length + client_id_length + 1; + this->length (ACE_Utils::truncate_cast (len)); +} + +// = Set/get the id of the client. +ACE_INLINE ACE_TCHAR * +ACE_Token_Request::client_id (void) const +{ + return this->client_id_; +} + +// ************************************************************ +// ************************************************************ +// ************************************************************ + +// = Set/get the length of the encoded/decoded message. +ACE_INLINE ACE_UINT32 +ACE_Token_Reply::length (void) const +{ + return ntohl (this->transfer_.length_); +} + +ACE_INLINE void +ACE_Token_Reply::length (ACE_UINT32 l) +{ + this->transfer_.length_ = htonl (l); +} + +// = Set/get the errno of a failed reply. +ACE_INLINE ACE_UINT32 +ACE_Token_Reply::errnum (void) const +{ + return ntohl (this->transfer_.errno_); +} + +ACE_INLINE void +ACE_Token_Reply::errnum (ACE_UINT32 e) +{ + this->transfer_.errno_ = htonl (e); +} + +// = Set/get the length of the encoded/decoded message. +ACE_INLINE ACE_UINT32 +ACE_Token_Reply::arg (void) const +{ + return ntohl (this->transfer_.arg_); +} + +ACE_INLINE void +ACE_Token_Reply::arg (ACE_UINT32 arg) +{ + this->transfer_.arg_ = htonl (arg); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/externals/ace/Tokenizer_T.cpp b/externals/ace/Tokenizer_T.cpp new file mode 100644 index 0000000..00aa2ab --- /dev/null +++ b/externals/ace/Tokenizer_T.cpp @@ -0,0 +1,242 @@ +// $Id: Tokenizer_T.cpp 88793 2010-02-01 17:50:34Z cleeland $ + +#ifndef ACE_TOKENIZER_T_CPP +#define ACE_TOKENIZER_T_CPP + +#include "ace/ACE.h" +#include "ace/Malloc_Base.h" +#include "ace/String_Base.h" +#include "ace/Auto_Ptr.h" +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template +ACE_Tokenizer_T::ACE_Tokenizer_T (ACE_CHAR_T *buffer) + : buffer_ (buffer), + index_ (0), + preserves_index_ (0), + delimiter_index_ (0) +{ +} + +template +int +ACE_Tokenizer_T::delimiter (ACE_CHAR_T d) +{ + if (delimiter_index_ == MAX_DELIMITERS) + return -1; + + delimiters_[delimiter_index_].delimiter_ = d; + delimiters_[delimiter_index_].replace_ = 0; + ++delimiter_index_; + return 0; +} + +template +int +ACE_Tokenizer_T::delimiter_replace (ACE_CHAR_T d, + ACE_CHAR_T replacement) +{ + // Make it possible to replace delimiters on-the-fly, e.g., parse + // string until certain token count and then copy rest of the + // original string. + for (int i = 0; i < delimiter_index_; i++) + if (delimiters_[i].delimiter_ == d) + { + delimiters_[i].replacement_ = replacement; + delimiters_[i].replace_ = 1; + return 0; + } + + if (delimiter_index_ >= MAX_DELIMITERS) + return -1; + + delimiters_[delimiter_index_].delimiter_ = d; + delimiters_[delimiter_index_].replacement_ = replacement; + delimiters_[delimiter_index_].replace_ = 1; + ++delimiter_index_; + return 0; +} + +template +int +ACE_Tokenizer_T::preserve_designators (ACE_CHAR_T start, + ACE_CHAR_T stop, + int strip) +{ + if (preserves_index_ == MAX_PRESERVES) + return -1; + + preserves_[preserves_index_].start_ = start; + preserves_[preserves_index_].stop_ = stop; + preserves_[preserves_index_].strip_ = strip; + ++preserves_index_; + return 0; +} + +template +int +ACE_Tokenizer_T::is_delimiter (ACE_CHAR_T d, + int &replace, + ACE_CHAR_T &r) +{ + replace = 0; + + for (int x = 0; x < delimiter_index_; x++) + if (delimiters_[x].delimiter_ == d) + { + if (delimiters_[x].replace_) + { + r = delimiters_[x].replacement_; + replace = 1; + } + return 1; + } + + return 0; +} + +template +int +ACE_Tokenizer_T::is_preserve_designator (ACE_CHAR_T start, + ACE_CHAR_T &stop, + int &strip) +{ + for (int x = 0; x < preserves_index_; x++) + if (preserves_[x].start_ == start) + { + stop = preserves_[x].stop_; + strip = preserves_[x].strip_; + return 1; + } + + return 0; +} + +template +ACE_CHAR_T * +ACE_Tokenizer_T::next (void) +{ + // Check if the previous pass was the last one in the buffer. + if (index_ == -1) + { + index_ = 0; + return 0; + } + + // Check if a buffer has been passed + if (!buffer_) + { + return 0; + } + + ACE_CHAR_T replacement = 0; + int replace; + ACE_CHAR_T *next_token = 0; + + // Skip all leading delimiters. + for (;;) + { + // Check for end of string. + if (buffer_[index_] == '\0') + { + // If we hit EOS at the start, return 0. + index_ = 0; + return 0; + } + + if (this->is_delimiter (buffer_[index_], + replace, + replacement)) + ++index_; + else + break; + } + + // When we reach this point, buffer_[index_] is a non-delimiter and + // not EOS - the start of our next_token. + next_token = buffer_ + index_; + + // A preserved region is it's own token. + ACE_CHAR_T stop; + int strip; + if (this->is_preserve_designator (buffer_[index_], + stop, + strip)) + { + while (++index_) + { + if (buffer_[index_] == '\0') + { + index_ = -1; + goto EXIT_LABEL; + } + + if (buffer_[index_] == stop) + break; + } + + if (strip) + { + // Skip start preserve designator. + next_token += 1; + // Zap the stop preserve designator. + buffer_[index_] = '\0'; + // Increment to the next token. + ++index_; + } + + goto EXIT_LABEL; + } + + // Step through finding the next delimiter or EOS. + for (;;) + { + // Advance pointer. + ++index_; + + // Check for delimiter. + if (this->is_delimiter (buffer_[index_], + replace, + replacement)) + { + // Replace the delimiter. + if (replace != 0) + buffer_[index_] = replacement; + + // Move the pointer up and return. + ++index_; + goto EXIT_LABEL; + } + + // A preserve designator is NESTED inside this token + // We can't strip such preserve designators, just skip + // over them so that delimiters nested within arn't seen. + if (this->is_preserve_designator (buffer_[index_], + stop, + strip)) + { + ++index_; // Skip starting preserve_designator + while (('\0' != buffer_[index_]) && (stop != buffer_[index_])) + ++index_; // Skip enclosed character + } + + // Check for end of string. + if (buffer_[index_] == '\0') + { + index_ = -1; + goto EXIT_LABEL; + } + } + +EXIT_LABEL: + return next_token; +} + +// ************************************************************* + + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TOKENIZER_T_CPP */ diff --git a/externals/ace/Tokenizer_T.h b/externals/ace/Tokenizer_T.h new file mode 100644 index 0000000..b13f5bb --- /dev/null +++ b/externals/ace/Tokenizer_T.h @@ -0,0 +1,241 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Tokenizer_T.h + * + * $Id: Tokenizer_T.h 88793 2010-02-01 17:50:34Z cleeland $ + * + * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) + * @author Nanbor Wang + */ +//============================================================================= + +#ifndef ACE_TOKENIZER_T_H +#define ACE_TOKENIZER_T_H + +#include /**/ "ace/pre.h" + +#include "ace/Global_Macros.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Tokenizer_T + * + * @brief Tokenizer + * + * Tokenizes a buffer. Allows application to set delimiters and + * preserve designators. Does not allow special characters, yet + * (e.g., printf ("\"like a quoted string\"")). + */ +template +class ACE_Tokenizer_T +{ +public: + /** + * \a buffer will be parsed. Notice that ACE_Tokenizer_T will modify + * \a buffer if you use delimiter_replace or + * preserve_designators to do character substitution. + * @note You should NOT pass a constant string or string literal + * to this constructor, since ACE_Tokenizer_T will try to modify + * the string. + * \sa preserve_designators + * \sa preserve_designators + */ + ACE_Tokenizer_T (ACE_CHAR_T *buffer); + + /** + * \a d is a delimiter. + * \return Returns 0 on success, -1 if there is no memory left. + * + * Example: + * \verbatim + char buf[30]; + ACE_OS::strcpy(buf, "William/Joseph/Hagins"); + + ACE_Tokenizer_T tok (buf); + tok.delimiter ('/'); + for (char *p = tok.next (); p; p = tok.next ()) + cout << p << endl; + \endverbatim + * + * This will print out: + * \verbatim + William/Joseph/Hagins + Joseph/Hagins + Hagins \endverbatim + */ + int delimiter (ACE_CHAR_T d); + + /** + * \a d is a delimiter and, when found, will be replaced by + * \a replacement. + * \return 0 on success, -1 if there is no memory left. + * + * Example: + * \verbatim + char buf[30]; + ACE_OS::strcpy(buf, "William/Joseph/Hagins"); + + ACE_Tokenizer tok (buf); + tok.delimiter_replace ('/', 0); + for (char *p = tok.next (); p; p = tok.next ()) + cout << p << endl; + \endverbatim + * + * This will print out: + * \verbatim + William + Joseph + Hagins \endverbatim + */ + int delimiter_replace (ACE_CHAR_T d, ACE_CHAR_T replacement); + + /** + * Extract string between a pair of designator characters. + * For instance, quotes, or '(' and ')'. + * \a start specifies the begin designator. + * \a stop specifies the end designator. + * \a strip If \a strip == 1, then the preserve + * designators will be stripped from the tokens returned by next. + * \return 0 on success, -1 if there is no memory left. + * + * Example with strip = 0: + * \verbatim + char buf[30]; + ACE_OS::strcpy(buf, "William(Joseph)Hagins"); + + ACE_Tokenizer tok (buf); + tok.preserve_designators ('(', ')', 0); + for (char *p = tok.next (); p; p = tok.next ()) + cout << p << endl; + \endverbatim + * + * This will print out: + * \verbatim + William(Joseph)Hagins + (Joseph)Hagins + )Hagins \endverbatim + * + * Example with strip = 1: + * \verbatim + char buf[30]; + ACE_OS::strcpy(buf, "William(Joseph)Hagins"); + + ACE_Tokenizer tok (buf); + tok.preserve_designators ('(', ')', 1); + for (char *p = tok.next (); p; p = tok.next ()) + cout << p << endl; + \endverbatim + * + * This will print out: + * \verbatim + William + Joseph + Hagins \endverbatim + */ + int preserve_designators (ACE_CHAR_T start, ACE_CHAR_T stop, int strip=1); + + /// Returns the next token. + ACE_CHAR_T *next (void); + + enum { + MAX_DELIMITERS=16, + MAX_PRESERVES=16 + }; + +protected: + /// Returns 1 if @a d is a delimiter, 0 otherwise. If @a d should be + /// replaced with @a r, @a replace is set to 1, otherwise 0. + int is_delimiter (ACE_CHAR_T d, int &replace, ACE_CHAR_T &r); + + /** + * If @a start is a start preserve designator, returns 1 and sets + * @a stop to the stop designator. Returns 0 if @a start is not a + * preserve designator. + */ + int is_preserve_designator (ACE_CHAR_T start, ACE_CHAR_T &stop, int &strip); + + ACE_CHAR_T *buffer_; + int index_; + + /** + * @class Preserve_Entry + * + * @brief Preserve Entry + * + * Defines a set of characters that designate an area that + * should not be parsed, but should be treated as a complete + * token. For instance, in: (this is a preserve region), start + * would be a left paren -(- and stop would be a right paren + * -)-. The strip determines whether the designators should be + * removed from the token. + */ + class Preserve_Entry + { + public: + /** + * E.g., "(". + * E.g., ")". + * Whether the designators should be removed from the token. + */ + ACE_CHAR_T start_; + ACE_CHAR_T stop_; + int strip_; + }; + + /// The application can specify MAX_PRESERVES preserve designators. + Preserve_Entry preserves_[MAX_PRESERVES]; + + /// Pointer to the next free spot in preserves_. + int preserves_index_; + + /** + * @class Delimiter_Entry + * + * @brief Delimiter Entry + * + * Describes a delimiter for the tokenizer. + */ + class Delimiter_Entry + { + public: + /** + * Most commonly a space ' '. + * What occurrences of delimiter_ should be replaced with. + * Whether replacement_ should be used. This should be replaced + * with a technique that sets replacement_ = delimiter by + * default. I'll do that next iteration. + */ + ACE_CHAR_T delimiter_; + ACE_CHAR_T replacement_; + int replace_; + }; + + /// The tokenizer allows MAX_DELIMITERS number of delimiters. + Delimiter_Entry delimiters_[MAX_DELIMITERS]; + + /// Pointer to the next free space in delimiters_. + int delimiter_index_; +}; + +typedef ACE_Tokenizer_T ACE_Tokenizer; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Tokenizer_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Tokenizer_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_TOKENIZER_T_H */ diff --git a/externals/ace/Trace.cpp b/externals/ace/Trace.cpp new file mode 100644 index 0000000..06269cc --- /dev/null +++ b/externals/ace/Trace.cpp @@ -0,0 +1,136 @@ +// $Id: Trace.cpp 87823 2009-11-30 12:38:34Z johnnyw $ + +#include "ace/Trace.h" + +ACE_RCSID (ace, + Trace, + "$Id: Trace.cpp 87823 2009-11-30 12:38:34Z johnnyw $") + +// Turn off tracing for the duration of this file. +#if defined (ACE_NTRACE) +#undef ACE_NTRACE +#endif /* ACE_NTRACE */ +#define ACE_NTRACE 1 + +#include "ace/Log_Msg.h" +#include "ace/Object_Manager_Base.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// = Static initialization. + +// Keeps track of how far to indent per trace call. +int ACE_Trace::nesting_indent_ = ACE_Trace::DEFAULT_INDENT; + +// Is tracing enabled? +bool ACE_Trace::enable_tracing_ = ACE_Trace::DEFAULT_TRACING; + +ACE_ALLOC_HOOK_DEFINE(ACE_Trace) + +void +ACE_Trace::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +#endif /* ACE_HAS_DUMP */ +} + +// Determine whether or not tracing is enabled + +bool +ACE_Trace::is_tracing (void) +{ + return ACE_Trace::enable_tracing_; +} + +// Enable the tracing facility. + +void +ACE_Trace::start_tracing (void) +{ + ACE_Trace::enable_tracing_ = true; +} + +// Disable the tracing facility. + +void +ACE_Trace::stop_tracing (void) +{ + ACE_Trace::enable_tracing_ = false; +} + +// Change the nesting indentation level. + +void +ACE_Trace::set_nesting_indent (int indent) +{ + ACE_Trace::nesting_indent_ = indent; +} + +// Get the nesting indentation level. + +int +ACE_Trace::get_nesting_indent (void) +{ + return ACE_Trace::nesting_indent_; +} + +// Perform the first part of the trace, which prints out the string N, +// the LINE, and the ACE_FILE as the function is entered. + +ACE_Trace::ACE_Trace (const ACE_TCHAR *n, + int line, + const ACE_TCHAR *file) +{ +#if defined (ACE_NLOGGING) + ACE_UNUSED_ARG (line); + ACE_UNUSED_ARG (file); +#endif /* ACE_NLOGGING */ + + this->name_ = n; + + // If ACE has not yet been initialized, don't try to trace... there's + // too much stuff not yet initialized. + if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ()) + { + ACE_Log_Msg *lm = ACE_LOG_MSG; + if (lm->tracing_enabled () + && lm->trace_active () == 0) + { + lm->trace_active (1); + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("%*s(%t) calling %s in file `%s' on line %d\n"), + ACE_Trace::nesting_indent_ * lm->inc (), + ACE_TEXT (""), + this->name_, + file, + line)); + lm->trace_active (0); + } + } +} + +// Perform the second part of the trace, which prints out the NAME as +// the function is exited. + +ACE_Trace::~ACE_Trace (void) +{ + // If ACE has not yet been initialized, don't try to trace... there's + // too much stuff not yet initialized. + if (ACE_Trace::enable_tracing_ && !ACE_OS_Object_Manager::starting_up ()) + { + ACE_Log_Msg *lm = ACE_LOG_MSG; + if (lm->tracing_enabled () + && lm->trace_active () == 0) + { + lm->trace_active (1); + ACE_DEBUG ((LM_TRACE, + ACE_TEXT ("%*s(%t) leaving %s\n"), + ACE_Trace::nesting_indent_ * lm->dec (), + ACE_TEXT (""), + this->name_)); + lm->trace_active (0); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Trace.h b/externals/ace/Trace.h new file mode 100644 index 0000000..3fbc9ce --- /dev/null +++ b/externals/ace/Trace.h @@ -0,0 +1,96 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Trace.h + * + * $Id: Trace.h 87823 2009-11-30 12:38:34Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TRACE_H +#define ACE_TRACE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Trace + * + * @brief A C++ trace facility that keeps track of which methods are + * entered and exited. + * + * This class uses C++ constructors and destructors to automate + * the ACE_Trace nesting. In addition, thread-specific storage + * is used to enable multiple threads to work correctly. + */ +class ACE_Export ACE_Trace +{ +public: + // = Initialization and termination methods. + + /// Perform the first part of the trace, which prints out the string + /// N, the LINE, and the ACE_FILE as the function is entered. + ACE_Trace (const ACE_TCHAR *n, + int line = 0, + const ACE_TCHAR *file = ACE_TEXT ("")); + + /// Perform the second part of the trace, which prints out the NAME + /// as the function is exited. + ~ACE_Trace (void); + + // = Control the tracing level. + /// Determine if tracing is enabled or not + static bool is_tracing(void); + + /// Enable the tracing facility. + static void start_tracing (void); + + /// Disable the tracing facility. + static void stop_tracing (void); + + /// Change the nesting indentation level. + static void set_nesting_indent (int indent); + + /// Get the nesting indentation level. + static int get_nesting_indent (void); + + /// Dump the state of an object. + void dump (void) const; + +private: + // Keeps track of how deeply the call stack is nested (this is + // maintained in thread-specific storage to ensure correctness in + // multiple threads of control. + + /// Name of the method we are in. + const ACE_TCHAR *name_; + + /// Keeps track of how far to indent per trace call. + static int nesting_indent_; + + /// Is tracing enabled? + static bool enable_tracing_; + + /// Default values. + enum + { + DEFAULT_INDENT = 3, + DEFAULT_TRACING = 1 + }; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_TRACE_H */ diff --git a/externals/ace/Truncate.h b/externals/ace/Truncate.h new file mode 100644 index 0000000..223513a --- /dev/null +++ b/externals/ace/Truncate.h @@ -0,0 +1,517 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Truncate.h + * + * $Id: Truncate.h 83306 2008-10-17 12:19:53Z johnnyw $ + * + * @author Steve Huston + * @author Ossama Othman + * @author Russell Mora + */ +//============================================================================= + +#ifndef ACE_TRUNCATE_H +#define ACE_TRUNCATE_H + +#include /**/ "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" +#include "ace/If_Then_Else.h" +#include "ace/Numeric_Limits.h" + +#if defined (ACE_LACKS_LONGLONG_T) +# include "ace/Basic_Types.h" +#endif /* ACE_LACKS_LONGLONG_T */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_Utils +{ + template struct Sign_Check; + + // Specialize the unsigned signed cases. + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; +#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T)) +# ifdef __GNUC__ + // Silence g++ "-pedantic" warnings regarding use of "long long" + // type. + __extension__ +# endif /* __GNUC__ */ + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; +#else + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; +#endif /* !ACE_LACKS_LONGLONG_T */ + + // Specialize the signed cases. + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; +#ifndef ACE_LACKS_LONGLONG_T +# ifdef __GNUC__ + // Silence g++ "-pedantic" warnings regarding use of "long long" + // type. + __extension__ +# endif /* __GNUC__ */ + template<> struct Sign_Check { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; +#endif /* !ACE_LACKS_LONGLONG_T */ + + // ----------------------------------------------------- + + /** + * @struct To_Unsigned + * + * @brief Retrieve unsigned counterpart to given type or value. + * + * Retrieve unsigned counterpart to given type or value. + */ + template struct To_Unsigned; + + template<> + struct To_Unsigned + { + typedef unsigned char unsigned_type; + + unsigned_type operator() (unsigned_type x) { return x; } + }; + + template<> + struct To_Unsigned + { + typedef unsigned short unsigned_type; + + unsigned_type operator() (unsigned_type x) { return x; } + }; + + template<> + struct To_Unsigned + { + typedef unsigned int unsigned_type; + + unsigned_type operator() (unsigned_type x) { return x; } + }; + + template<> + struct To_Unsigned + { + typedef unsigned long unsigned_type; + + unsigned_type operator() (unsigned_type x) { return x; } + }; + +#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T)) +# ifdef __GNUC__ + // Silence g++ "-pedantic" warnings regarding use of "long long" + // type. + __extension__ +# endif /* __GNUC__ */ + template<> + struct To_Unsigned + { + typedef unsigned long long unsigned_type; + + unsigned_type operator() (unsigned_type x) { return x; } + }; +#else + template<> + struct To_Unsigned + { + typedef ACE_U_LongLong unsigned_type; + + unsigned_type operator() (unsigned_type x) { return x; } + }; +#endif /* !ACE_LACKS_LONGLONG_T */ + + // ---------------- + + template<> + struct To_Unsigned + { + typedef signed char signed_type; + typedef unsigned char unsigned_type; + + unsigned_type operator() (signed_type x) + { + return static_cast (x); + } + }; + + template<> + struct To_Unsigned + { + typedef signed short signed_type; + typedef unsigned short unsigned_type; + + unsigned_type operator() (signed_type x) + { + return static_cast (x); + } + }; + + template<> + struct To_Unsigned + { + typedef signed int signed_type; + typedef unsigned int unsigned_type; + + unsigned_type operator() (signed_type x) + { + return static_cast (x); + } + }; + + template<> + struct To_Unsigned + { + typedef signed long signed_type; + typedef unsigned long unsigned_type; + + unsigned_type operator() (signed_type x) + { + return static_cast (x); + } + }; + +#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T)) +# ifdef __GNUC__ + // Silence g++ "-pedantic" warnings regarding use of "long long" + // type. + __extension__ +# endif /* __GNUC__ */ + template<> + struct To_Unsigned + { + typedef signed long long signed_type; + typedef unsigned long long unsigned_type; + + unsigned_type operator() (signed_type x) + { + return static_cast (x); + } + }; +#endif /* !ACE_LACKS_LONGLONG_T */ + + // ----------------------------------------------------- + + /** + * @struct Safe_Comparator + * + * @brief Conservative comparison of types that may not be safely + * promoted and/or converted to each other. + * + * The comparison operations provided by this structure perform + * negative value checking when necessary to prevent wrap-around + * when explicitly casting to an unsigned type. + * + * @internal This structure is not meant for general use. + */ + template struct Safe_Comparator; + + // LEFT: signed, RIGHT: unsigned + template + struct Safe_Comparator + { + static bool greater_than (LEFT lhs, RIGHT rhs) + { + // Prevent wrap-around when casting to unsigned. + if (lhs < 0) + return false; // since rhs is always positive + else + { + // Implicit promotion of unsigned LEFT and RIGHT types here. + return To_Unsigned() (lhs) > rhs; + } + } + }; + + // LEFT: unsigned, RIGHT: signed + template + struct Safe_Comparator + { + static bool greater_than (LEFT lhs, RIGHT rhs) + { + // Prevent wrap-around when casting to unsigned. + if (rhs < 0) + return true; // since lhs is always positive + else + { + // Implicit promotion of unsigned LEFT and RIGHT types here. + return lhs > To_Unsigned() (rhs); + } + } + }; + + // LEFT: unsigned, RIGHT: unsigned + template + struct Safe_Comparator + { + static bool greater_than (LEFT lhs, RIGHT rhs) + { + // Implicit promotion of unsigned LEFT and RIGHT types here. + return lhs > rhs; + } + }; + + // LEFT: signed, RIGHT: signed + template + struct Safe_Comparator + { + static bool greater_than (LEFT lhs, RIGHT rhs) + { + // Implicit promotion of signed LEFT and RIGHT types here. + return lhs > rhs; + } + }; + + // ----------------------------------------------------- + + /** + * @struct Fast_Comparator + * + * @brief Quick comparison of types that can be safely promoted + * and/or converted to each other. + * + * The comparison operations provided by this structure perform no + * negative value checking, meaning it is not applicable to all + * types. Check the value of the @c USABLE enumerator to determine + * if it applies to the types in question. + * + * @internal This structure is not meant for general use. + */ + template + struct Fast_Comparator + { + ACE_STATIC_CONSTANT ( + bool, + USE_LEFT = ((sizeof (LEFT) > sizeof (RIGHT) + && (Sign_Check::is_signed == 1 + || Sign_Check::is_signed == 0)) + + // The following is basically the case where LEFT + // and RIGHT are the same integral type. + || (sizeof (LEFT) == sizeof (RIGHT) + // Can't portably do + // Sign_Check::is_signed == + // Sign_Check::is_signed, + // i.e. comparison of anonymous enumerations, + // without triggering a compiler diagnostic + // so expand the comparison. + && ((Sign_Check::is_signed == 1 + && Sign_Check::is_signed == 1) + || (Sign_Check::is_signed == 0 + && Sign_Check::is_signed == 0))))); + + ACE_STATIC_CONSTANT ( + bool, + USE_RIGHT = (sizeof (RIGHT) > sizeof (LEFT) + && (Sign_Check::is_signed == 1 + || Sign_Check::is_signed == 0))); + + ACE_STATIC_CONSTANT (bool, USABLE = (USE_LEFT || USE_RIGHT)); + + typedef typename ACE::If_Then_Else< + USE_LEFT, + LEFT, + typename ACE::If_Then_Else< + USE_RIGHT, + RIGHT, + void>::result_type>::result_type promote_type; + + static bool greater_than (LEFT lhs, RIGHT rhs) + { + // The explicit cast is assumed to change the type of rhs without + // changing its value. + return + (static_cast (lhs) > static_cast (rhs)); + } + + }; + + // ----------------------------------------------------- + + /** + * @struct Comparator + * + * @brief Structure that provides optimal comparison operation for + * given types. + * + * The comparison operations provided by this structure are chosen + * at compile time based on the signs and sizes of types being + * compared. + * @par + * Comparisons of values with the same sign or those with types that + * can be promoted safely are done quickly, without any range + * checking. + * @par + * Comparisons of values of different types that cannot be safely + * promoted incur an additional check for a negative value to allow + * the compiler to perform the appropriate implicit unsigned type + * promotion. + * + * @note In general, the operations found in this structure should + * not be used to work around compiler diagnostics regarding + * comparison of signed and unsigned types. Verify that your + * types are correct before relying on those operations. + * + * @internal This structure is not meant for general use. + */ + template + struct Comparator + { + typedef typename ACE::If_Then_Else< + Fast_Comparator::USABLE, + Fast_Comparator, + Safe_Comparator::is_signed, + Sign_Check::is_signed> >::result_type comp_type; + }; + + // ----------------------------------------------------- + + /** + * @struct Truncator + * + * @brief Truncate value of type @c FROM to value of type @c TO. + * + * Truncate a value of type @c FROM to value of type @c TO, if the + * value is larger than the maximum of value of type @c TO. + */ + template + struct Truncator + { + ACE_STATIC_CONSTANT ( + bool, + // max FROM always greater than max TO + MAX_FROM_GT_MAX_TO = (sizeof(FROM) > sizeof (TO) + || (sizeof(FROM) == sizeof (TO) + && Sign_Check::is_signed == 0))); + + typedef typename ACE::If_Then_Else< + MAX_FROM_GT_MAX_TO, + FROM, + TO>::result_type comp_to_type; + + // Take advantage of knowledge that we're casting a positive value + // to a type large enough to hold it so that we can bypass + // negative value checks at compile-time. Otherwise fallback on + // the safer comparison. + typedef typename ACE::If_Then_Else< + MAX_FROM_GT_MAX_TO, + Fast_Comparator, + typename Comparator::comp_type>::result_type comparator; + + /// Truncate a value of type @c FROM to value of type @c TO, if + /// the value is larger than the maximum of value of type @c TO. + TO operator() (FROM val) + { + return + (comparator::greater_than (val, ACE_Numeric_Limits::max ()) + ? ACE_Numeric_Limits::max () + : static_cast (val)); + } + + }; + + // Partial specialization for the case where the types are the same. + // No truncation is necessary. + template + struct Truncator + { + T operator() (T val) + { + return val; + } + }; + + +#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + // Partial specialization for the case where we're casting from + // ACE_U_LongLong to a smaller integer. We assume that we're always + // truncating from ACE_U_LongLong to a smaller type. The partial + // specialization above handles the case where both the FROM and TO + // types are ACE_U_LongLong. + template + struct Truncator + { + TO operator() (ACE_U_LongLong const & val) + { + // If val less than or equal to ACE_Numeric_Limits::max(), + // val.lo() must be less than or equal to + // ACE_Numeric_Limits::max (), as well. + return + (val > ACE_Numeric_Limits::max () + ? ACE_Numeric_Limits::max () + : static_cast (val.lo ())); + } + }; +#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ + + // ----------------------------------------------------- + /** + * @struct Noop_Truncator + * + * @brief No-op truncation. + * + * This structure/functor performs no truncation since it assumes + * that @c sizeof(FROM) @c < @c sizeof(TO), meaning that + * @c numeric_limits::max() @c < @c numeric_limits::max(). + */ + template + struct Noop_Truncator + { + TO operator() (FROM val) + { + return static_cast (val); + } + }; + // ----------------------------------------------------- + + /** + * @class truncate_cast + * + * @brief Helper function to truncate an integral value to the + * maximum value of the given type. + * + * Very useful since ACE methods return @c int very often and + * the value's source is often a different-size integral + * type, such as @c size_t. This function hides the + * truncation logic and resolves compiler diagnostics. + * + * @internal Internal use only. + */ + template + inline TO truncate_cast (FROM val) + { + // If the size of FROM is less than the size of TO, "val" will + // never be greater than the maximum "TO" value, so there is no + // need to attempt to truncate. + typedef typename ACE::If_Then_Else< + (sizeof (FROM) < sizeof (TO)), + Noop_Truncator, + Truncator >::result_type truncator; + + return truncator() (val); + } + +} // namespace ACE_Utils + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_TRUNCATE_H*/ diff --git a/externals/ace/Typed_SV_Message.cpp b/externals/ace/Typed_SV_Message.cpp new file mode 100644 index 0000000..6be3d4c --- /dev/null +++ b/externals/ace/Typed_SV_Message.cpp @@ -0,0 +1,30 @@ +// $Id: Typed_SV_Message.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TYPED_SV_MESSAGE_CPP +#define ACE_TYPED_SV_MESSAGE_CPP + +#include "ace/Typed_SV_Message.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Typed_SV_Message.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Typed_SV_Message) + +template void +ACE_Typed_SV_Message::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Typed_SV_Message::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TYPED_SV_MESSAGE_CPP */ diff --git a/externals/ace/Typed_SV_Message.h b/externals/ace/Typed_SV_Message.h new file mode 100644 index 0000000..b43258e --- /dev/null +++ b/externals/ace/Typed_SV_Message.h @@ -0,0 +1,107 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Typed_SV_Message.h + * + * $Id: Typed_SV_Message.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//========================================================================== + + +#ifndef ACE_TYPED_SV_MESSAGE_H +#define ACE_TYPED_SV_MESSAGE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Typed_SV_Message + * + * @brief Defines the header file for the C++ wrapper for System V + * message queues. + */ +template +class ACE_Typed_SV_Message +{ +public: + // = Initialization and termination methods. + ACE_Typed_SV_Message (long type = 0, + int length = sizeof (T), + int max_size = sizeof (T)); + ACE_Typed_SV_Message (const T &data, + long type = 0, + int length = sizeof (T), + int max_size = sizeof (T)); + ~ACE_Typed_SV_Message (void); + + /// Get the type of the message. + long type (void) const; + + /// Set the type of the message. + void type (long type); + + /// Get the length of the message. + int length (void) const; + + /// Set the length of the message. + void length (int l); + + /// Get the maximum size of the message. + int max_size (void) const; + + /// Set the maximum size of the message. + void max_size (int m); + + /// Get a pointer to the data in the message. + T &data (void); + + /// Set a pointer to the data in the message. + void data (const T &data); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Type of message. + long type_; + + /// Length of this message. + int length_; + + /// Maximum length of any message. + int max_; + + /// Data stored in a message. + T data_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Typed_SV_Message.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Typed_SV_Message.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Typed_SV_Message.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_TYPED_SV_MESSAGE_H */ diff --git a/externals/ace/Typed_SV_Message.inl b/externals/ace/Typed_SV_Message.inl new file mode 100644 index 0000000..6d8ea70 --- /dev/null +++ b/externals/ace/Typed_SV_Message.inl @@ -0,0 +1,96 @@ +// -*- C++ -*- +// +// $Id: Typed_SV_Message.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/config-all.h" +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE +ACE_Typed_SV_Message::ACE_Typed_SV_Message (long t, + int l, + int m) + : type_ (t) +{ + ACE_TRACE ("ACE_Typed_SV_Message::ACE_Typed_SV_Message"); + this->length (l); + this->max_size (m); +} + +template ACE_INLINE +ACE_Typed_SV_Message::ACE_Typed_SV_Message (const T &d, + long t, + int l, + int m) + : type_ (t), + data_ (d) +{ + ACE_TRACE ("ACE_Typed_SV_Message::ACE_Typed_SV_Message"); + this->length (l); + this->max_size (m); +} + +template ACE_INLINE +ACE_Typed_SV_Message::~ACE_Typed_SV_Message (void) +{ + ACE_TRACE ("ACE_Typed_SV_Message::~ACE_Typed_SV_Message"); +} + +template ACE_INLINE long +ACE_Typed_SV_Message::type (void) const +{ + ACE_TRACE ("ACE_Typed_SV_Message::type"); + return this->type_; +} + +template ACE_INLINE void +ACE_Typed_SV_Message::type (long t) +{ + ACE_TRACE ("ACE_Typed_SV_Message::type"); + this->type_ = t; +} + +template ACE_INLINE int +ACE_Typed_SV_Message::length (void) const +{ + ACE_TRACE ("ACE_Typed_SV_Message::length"); + return this->length_; +} + +template ACE_INLINE void +ACE_Typed_SV_Message::length (int len) +{ + ACE_TRACE ("ACE_Typed_SV_Message::length"); + this->length_ = len + (sizeof *this - (sizeof this->type_ + sizeof this->data_)); +} + +template ACE_INLINE int +ACE_Typed_SV_Message::max_size (void) const +{ + ACE_TRACE ("ACE_Typed_SV_Message::max_size"); + return this->max_; +} + +template ACE_INLINE void +ACE_Typed_SV_Message::max_size (int m) +{ + ACE_TRACE ("ACE_Typed_SV_Message::max_size"); + this->max_ = m + (sizeof *this - (sizeof this->type_ + sizeof this->data_)); +} + +template T & +ACE_Typed_SV_Message::data (void) +{ + ACE_TRACE ("ACE_Typed_SV_Message::data"); + return this->data_; +} + +template void +ACE_Typed_SV_Message::data (const T &d) +{ + ACE_TRACE ("ACE_Typed_SV_Message::data"); + this->data_ = d; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Typed_SV_Message_Queue.cpp b/externals/ace/Typed_SV_Message_Queue.cpp new file mode 100644 index 0000000..0adb589 --- /dev/null +++ b/externals/ace/Typed_SV_Message_Queue.cpp @@ -0,0 +1,56 @@ +// $Id: Typed_SV_Message_Queue.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_TYPED_SV_MESSAGE_QUEUE_CPP +#define ACE_TYPED_SV_MESSAGE_QUEUE_CPP + +#include "ace/Typed_SV_Message.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Typed_SV_Message_Queue.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Typed_SV_Message_Queue.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Typed_SV_Message_Queue) + +template void +ACE_Typed_SV_Message_Queue::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Typed_SV_Message_Queue::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue (void) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue"); +} + +template +ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue (key_t external_id, + int create, + int perms) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue"); + if (this->open (external_id, create, perms) == -1) + ACE_ERROR ((LM_ERROR, + "ACE_Typed_SV_Message_Queue::ACE_Typed_SV_Message_Queue")); +} + +template +ACE_Typed_SV_Message_Queue::~ACE_Typed_SV_Message_Queue (void) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::~ACE_Typed_SV_Message_Queue"); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TYPED_SV_MESSAGE_QUEUE_CPP */ diff --git a/externals/ace/Typed_SV_Message_Queue.h b/externals/ace/Typed_SV_Message_Queue.h new file mode 100644 index 0000000..12c0e50 --- /dev/null +++ b/externals/ace/Typed_SV_Message_Queue.h @@ -0,0 +1,92 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Typed_SV_Message_Queue.h + * + * $Id: Typed_SV_Message_Queue.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_TYPED_MESSAGE_QUEUE_H +#define ACE_TYPED_MESSAGE_QUEUE_H +#include /**/ "ace/pre.h" + +#include "ace/SV_Message_Queue.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Typed_SV_Message.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Typed_SV_Message_Queue + * + * @brief Defines the header file for the C++ wrapper facade for typed message queues. + */ +template +class ACE_Typed_SV_Message_Queue +{ +public: + enum + { + ACE_CREATE = IPC_CREAT, + ACE_OPEN = 0, + ACE_NOWAIT = IPC_NOWAIT + }; + + // = Initialization and termination operations. + ACE_Typed_SV_Message_Queue (void); + ACE_Typed_SV_Message_Queue (key_t external_id, + int create = ACE_OPEN, + int perms = ACE_DEFAULT_FILE_PERMS); + int open (key_t external_id, + int create = ACE_OPEN, + int perms = ACE_DEFAULT_FILE_PERMS); + int close (void); + int remove (void); + ~ACE_Typed_SV_Message_Queue (void); + + /// Send method. + int send (const ACE_Typed_SV_Message &mb, int mflags = 0); + + /// Recv method. + int recv (ACE_Typed_SV_Message &mb, int mflags = 0); + + /// Return the id of the underlying ACE_SV_Message_Queue. + int get_id (void) const; + + /// Control the underlying message queue. + int control (int option, void *arg = 0); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + ACE_SV_Message_Queue message_queue_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Typed_SV_Message_Queue.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Typed_SV_Message_Queue.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Typed_SV_Message_Queue.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TYPED_MESSAGE_QUEUE_H */ diff --git a/externals/ace/Typed_SV_Message_Queue.inl b/externals/ace/Typed_SV_Message_Queue.inl new file mode 100644 index 0000000..9053993 --- /dev/null +++ b/externals/ace/Typed_SV_Message_Queue.inl @@ -0,0 +1,80 @@ +// -*- C++ -*- +// +// $Id: Typed_SV_Message_Queue.inl 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/SV_Message_Queue.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE int +ACE_Typed_SV_Message_Queue::open (key_t external_id, + int create, + int perms) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::open"); + return this->message_queue_.open (external_id, create, perms); +} + +// What does it mean to close a message queue?! + +template ACE_INLINE int +ACE_Typed_SV_Message_Queue::close (void) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::close"); + return 1; +} + +template ACE_INLINE int +ACE_Typed_SV_Message_Queue::recv (ACE_Typed_SV_Message &mb, + int mflags) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::recv"); + + int length = + this->message_queue_.recv (reinterpret_cast (mb), + mb.max_size (), + mb.type (), + mflags); + if (length != -1) + mb.length (length); + + return length; +} + +template ACE_INLINE int +ACE_Typed_SV_Message_Queue::send (const ACE_Typed_SV_Message &mb, + int mflags) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::send"); + return + this->message_queue_.send ( + reinterpret_cast ( + const_cast &> (mb)), + mb.length (), + mflags); +} + +template ACE_INLINE int +ACE_Typed_SV_Message_Queue::remove (void) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::remove"); + + return this->message_queue_.remove (); +} + +template ACE_INLINE int +ACE_Typed_SV_Message_Queue::control (int option, + void *arg) +{ + ACE_TRACE ("ACE_Typed_SV_Message_Queue::control"); + + return this->message_queue_.control (option, arg); +} + +template ACE_INLINE int +ACE_Typed_SV_Message_Queue::get_id (void) const +{ + return this->message_queue_.get_id (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/UNIX_Addr.cpp b/externals/ace/UNIX_Addr.cpp new file mode 100644 index 0000000..013af8a --- /dev/null +++ b/externals/ace/UNIX_Addr.cpp @@ -0,0 +1,151 @@ +// $Id: UNIX_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/UNIX_Addr.h" + +ACE_RCSID(ace, UNIX_Addr, "$Id: UNIX_Addr.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) + +#if !defined (__ACE_INLINE__) +#include "ace/UNIX_Addr.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_UNIX_Addr) + +// Set a pointer to the address. +void +ACE_UNIX_Addr::set_addr (void *addr, int len) +{ + ACE_TRACE ("ACE_UNIX_Addr::set_addr"); + + this->ACE_Addr::base_set (AF_UNIX, len); + ACE_OS::memcpy ((void *) &this->unix_addr_, + (void *) addr, + len); +} + +// Return a pointer to the underlying address. + +void * +ACE_UNIX_Addr::get_addr (void) const +{ + return (void *) &this->unix_addr_; +} + +// Transform the string into the current addressing format. + +int +ACE_UNIX_Addr::string_to_addr (const char addr[]) +{ + ACE_OS::strsncpy (this->unix_addr_.sun_path, addr, + sizeof this->unix_addr_.sun_path); + return 0; +} + +// Transform the current address into string format. + +int +ACE_UNIX_Addr::addr_to_string (ACE_TCHAR s[], size_t len) const +{ + ACE_OS::strsncpy (s, + ACE_TEXT_CHAR_TO_TCHAR (this->unix_addr_.sun_path), + len); + return 0; +} + +u_long +ACE_UNIX_Addr::hash (void) const +{ + return ACE::hash_pjw (this->unix_addr_.sun_path); +} + +void +ACE_UNIX_Addr::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +#endif /* ACE_HAS_DUMP */ +} + +// Do nothing constructor. + +ACE_UNIX_Addr::ACE_UNIX_Addr (void) + : ACE_Addr (AF_UNIX, sizeof this->unix_addr_) +{ + (void) ACE_OS::memset ((void *) &this->unix_addr_, + 0, + sizeof this->unix_addr_); + + this->unix_addr_.sun_family = AF_UNIX; +} + +int +ACE_UNIX_Addr::set (const ACE_UNIX_Addr &sa) +{ + if (sa.get_type () == AF_ANY) + (void) ACE_OS::memset ((void *) &this->unix_addr_, + 0, + sizeof this->unix_addr_); + else + ACE_OS::strcpy (this->unix_addr_.sun_path, + sa.unix_addr_.sun_path); + + this->unix_addr_.sun_family = AF_UNIX; + this->base_set (sa.get_type (), sa.get_size ()); + + return 0; +} + +// Copy constructor. + +ACE_UNIX_Addr::ACE_UNIX_Addr (const ACE_UNIX_Addr &sa) + : ACE_Addr (AF_UNIX, sa.get_size ()) +{ + this->set (sa); +} + +int +ACE_UNIX_Addr::set (const sockaddr_un *un, int len) +{ + (void) ACE_OS::memset ((void *) &this->unix_addr_, 0, + sizeof this->unix_addr_); + this->unix_addr_.sun_family = AF_UNIX; + ACE_OS::strcpy (this->unix_addr_.sun_path, un->sun_path); + this->base_set (AF_UNIX, len); + return 0; +} + +ACE_UNIX_Addr::ACE_UNIX_Addr (const sockaddr_un *un, int len) +{ + this->set (un, len); +} + +int +ACE_UNIX_Addr::set (const char rendezvous_point[]) +{ + (void) ACE_OS::memset ((void *) &this->unix_addr_, + 0, + sizeof this->unix_addr_); + this->unix_addr_.sun_family = AF_UNIX; + (void) ACE_OS::strsncpy (this->unix_addr_.sun_path, + rendezvous_point, + sizeof this->unix_addr_.sun_path); + + this->ACE_Addr::base_set (AF_UNIX, + sizeof this->unix_addr_ - + sizeof (this->unix_addr_.sun_path) + + ACE_OS::strlen (this->unix_addr_.sun_path)); + return 0; +} + +// Create a ACE_Addr from a UNIX pathname. + +ACE_UNIX_Addr::ACE_UNIX_Addr (const char rendezvous_point[]) +{ + this->set (rendezvous_point); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/externals/ace/UNIX_Addr.h b/externals/ace/UNIX_Addr.h new file mode 100644 index 0000000..887529f --- /dev/null +++ b/externals/ace/UNIX_Addr.h @@ -0,0 +1,117 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file UNIX_Addr.h + * + * $Id: UNIX_Addr.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//============================================================================= + + +#ifndef ACE_UNIX_ADDR_H +#define ACE_UNIX_ADDR_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) + +#include "ace/Addr.h" +#include "ace/Log_Msg.h" +#include "ace/ACE.h" +#include "ace/os_include/sys/os_un.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_UNIX_Addr + * + * @brief Defines the ``UNIX domain address family'' address format. + */ +class ACE_Export ACE_UNIX_Addr : public ACE_Addr +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_UNIX_Addr (void); + + /// Copy constructor. + ACE_UNIX_Addr (const ACE_UNIX_Addr &sa); + + /// Creates an ACE_UNIX_Addr from a string. + ACE_UNIX_Addr (const char rendezvous_point[]); + + /// Creates an ACE_INET_Addr from a sockaddr_un structure. + ACE_UNIX_Addr (const sockaddr_un *, int len); + + /// Creates an ACE_UNIX_Addr from another ACE_UNIX_Addr. + int set (const ACE_UNIX_Addr &sa); + + /// Creates an ACE_UNIX_Addr from a string. + int set (const char rendezvous_point[]); + + /// Creates an ACE_UNIX_Addr from a sockaddr_un structure. + int set (const sockaddr_un *, int len); + + /// Return a pointer to the underlying network address. + virtual void *get_addr (void) const; + + /// Set a pointer to the underlying network address. + virtual void set_addr (void *addr, int len); + + /// Transform the current address into string format. + virtual int addr_to_string (ACE_TCHAR addr[], size_t) const; + + /// Transform the string into the current addressing format. + virtual int string_to_addr (const char addr[]); + +#if defined (ACE_HAS_WCHAR) + /// Creates an ACE_UNIX_Addr from a string. + ACE_UNIX_Addr (const wchar_t rendezvous_point[]); + + /// Creates an ACE_UNIX_Addr from a string. + int set (const wchar_t rendezvous_point[]); +#endif /* ACE_HAS_WCHAR */ + + /// Compare two addresses for equality. + bool operator == (const ACE_UNIX_Addr &SAP) const; + + /// Compare two addresses for inequality. + bool operator != (const ACE_UNIX_Addr &SAP) const; + + /// Return the path name of the underlying rendezvous point. + const char *get_path_name (void) const; + + /// Computes and returns hash value. + virtual u_long hash (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Underlying socket address. + sockaddr_un unix_addr_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/UNIX_Addr.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ + +#include /**/ "ace/post.h" + +#endif /* ACE_UNIX_ADDR_H */ diff --git a/externals/ace/UNIX_Addr.inl b/externals/ace/UNIX_Addr.inl new file mode 100644 index 0000000..5e801b5 --- /dev/null +++ b/externals/ace/UNIX_Addr.inl @@ -0,0 +1,57 @@ +// -*- C++ -*- +// +// $Id: UNIX_Addr.inl 80826 2008-03-04 14:51:23Z wotte $ + + +#include "ace/OS_NS_string.h" + + +#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_HAS_WCHAR) +/// Creates an ACE_UNIX_Addr from a string. +ACE_INLINE +ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[]) +{ + this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ()); +} + +/// Creates an ACE_UNIX_Addr from a string. +ACE_INLINE int +ACE_UNIX_Addr::set (const wchar_t rendezvous_point[]) +{ + return this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ()); +} +#endif /* ACE_HAS_WCHAR */ + +// Compare two addresses for equality. + +ACE_INLINE bool +ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const +{ + return ACE_OS::strncmp (this->unix_addr_.sun_path, + sap.unix_addr_.sun_path, + sizeof this->unix_addr_.sun_path) == 0; +} + +// Compare two addresses for inequality. + +ACE_INLINE bool +ACE_UNIX_Addr::operator != (const ACE_UNIX_Addr &sap) const +{ + return !((*this) == sap); // This is lazy, of course... ;-) +} + +// Return the path name used for the rendezvous point. + +ACE_INLINE const char * +ACE_UNIX_Addr::get_path_name (void) const +{ + return this->unix_addr_.sun_path; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/externals/ace/UPIPE_Acceptor.cpp b/externals/ace/UPIPE_Acceptor.cpp new file mode 100644 index 0000000..c2c1015 --- /dev/null +++ b/externals/ace/UPIPE_Acceptor.cpp @@ -0,0 +1,129 @@ +// $Id: UPIPE_Acceptor.cpp 82723 2008-09-16 09:35:44Z johnnyw $ + +#include "ace/UPIPE_Acceptor.h" + +ACE_RCSID(ace, UPIPE_Acceptor, "$Id: UPIPE_Acceptor.cpp 82723 2008-09-16 09:35:44Z johnnyw $") + +#if defined (ACE_HAS_THREADS) + +#include "ace/OS_NS_unistd.h" + +#if !defined (__ACE_INLINE__) +#include "ace/UPIPE_Acceptor.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Acceptor) + +void +ACE_UPIPE_Acceptor::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_UPIPE_Acceptor::dump"); +#endif /* ACE_HAS_DUMP */ +} + +/* Do nothing routine for constructor. */ + +ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (void) + : mb_ (sizeof (ACE_UPIPE_Stream *)) +{ + ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor"); +} + +ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor (void) +{ + ACE_TRACE ("ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor"); +} + +// General purpose routine for performing server ACE_UPIPE. + +int +ACE_UPIPE_Acceptor::open (const ACE_UPIPE_Addr &local_addr, + int reuse_addr) +{ + ACE_TRACE ("ACE_UPIPE_Acceptor::open"); + return this->ACE_SPIPE_Acceptor::open (local_addr, reuse_addr); +} + +int +ACE_UPIPE_Acceptor::close (void) +{ + ACE_TRACE ("ACE_UPIPE_Acceptor::close"); + return this->ACE_SPIPE_Acceptor::close (); +} + +// General purpose routine for accepting new connections. + +ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_addr, + int reuse_addr) + : mb_ (sizeof (ACE_UPIPE_Stream *)) +{ + ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor"); + + if (this->open (local_addr, reuse_addr) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_UPIPE_Acceptor"))); +} + +int +ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream, + ACE_UPIPE_Addr *remote_addr, + ACE_Time_Value *timeout, + bool restart, + bool reset_new_handle) +{ + ACE_TRACE ("ACE_UPIPE_Acceptor::accept"); + ACE_UNUSED_ARG (reset_new_handle); + + ACE_SPIPE_Stream new_io; + + if (this->ACE_SPIPE_Acceptor::accept (new_io, remote_addr, + timeout, restart) == -1) + return -1; + else + { + ACE_UPIPE_Stream *remote_stream = 0; + + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1)); + + new_stream.set_handle (new_io.get_handle ()); + new_stream.reference_count_++; + + // Transfer address ownership. + new_io.get_local_addr (new_stream.local_addr_); + new_io.get_remote_addr (new_stream.remote_addr_); + + // Now that we got the handle, we'll read the address of the + // connector-side ACE_UPIPE_Stream out of the pipe and link that + // ACE_UPIPE_Stream to our ACE_UPIPE_Stream. + + if (ACE_OS::read (new_stream.get_handle (), + (char *) &remote_stream, + sizeof remote_stream) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_UPIPE_Acceptor: %p\n"), + ACE_TEXT ("read stream address failed"))); + else if (new_stream.stream_.link (remote_stream->stream_) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_UPIPE_Acceptor: %p\n"), + ACE_TEXT ("link streams failed"))); + // Send a message over the new streampipe to confirm acceptance. + else if (new_stream.send (&mb_, 0) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_UPIPE_Acceptor: %p\n"), + ACE_TEXT ("linked stream.put failed"))); + + // Close down the new_stream at this point in order to conserve + // handles. Note that we don't need the SPIPE connection + // anymore since we're now linked via the . + new_stream.ACE_SPIPE::close (); + return 0; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/UPIPE_Acceptor.h b/externals/ace/UPIPE_Acceptor.h new file mode 100644 index 0000000..e4925a0 --- /dev/null +++ b/externals/ace/UPIPE_Acceptor.h @@ -0,0 +1,99 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file UPIPE_Acceptor.h + * + * $Id: UPIPE_Acceptor.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Gerhard Lenzer + * @author Douglas C. Schmidt + */ +//============================================================================= + + +#ifndef ACE_UPIPE_ACCEPTOR_H +#define ACE_UPIPE_ACCEPTOR_H +#include /**/ "ace/pre.h" + +#include "ace/UPIPE_Stream.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +#include "ace/SPIPE_Acceptor.h" +#include "ace/Thread_Manager.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_UPIPE_Acceptor + * + * @brief Defines the format and interface for the listener side of the + * ACE_UPIPE_Stream. + */ +class ACE_Export ACE_UPIPE_Acceptor : public ACE_SPIPE_Acceptor +{ +public: + // = Initialization and termination. + /// Default constructor. + ACE_UPIPE_Acceptor (void); + + /// Initialize passive endpoint. + ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_sap, + int reuse_addr = 0); + + /// Initialize passive endpoint. + int open (const ACE_UPIPE_Addr &local_sap, + int reuse_addr = 0); + + /// Close down and release resources. + ~ACE_UPIPE_Acceptor (void); + + /// Close down and release resources. + int close (void); + + /// Close down and release resources and remove the underlying SPIPE + /// rendezvous point. + int remove (void); + + // = Passive connection acceptance method. + /** + * Accept a new data transfer connection. A @a timeout of 0 means + * block forever, a @a timeout of {0, 0} means poll. @a restart == 1 + * means "restart if interrupted." + */ + int accept (ACE_UPIPE_Stream &server_stream, + ACE_UPIPE_Addr *remote_addr = 0, + ACE_Time_Value *timeout = 0, + bool restart = true, + bool reset_new_handle = false); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Manage threads. + ACE_Thread_Manager tm; + + /// To confirm connection establishment. + ACE_Message_Block mb_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/UPIPE_Acceptor.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" + +#endif /* ACE_UPIPE_ACCEPTOR_H */ diff --git a/externals/ace/UPIPE_Acceptor.inl b/externals/ace/UPIPE_Acceptor.inl new file mode 100644 index 0000000..9432ad7 --- /dev/null +++ b/externals/ace/UPIPE_Acceptor.inl @@ -0,0 +1,14 @@ +// -*- C++ -*- +// +// $Id: UPIPE_Acceptor.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_UPIPE_Acceptor::remove (void) +{ + ACE_TRACE ("ACE_UPIPE_Acceptor::remove"); + return this->ACE_SPIPE_Acceptor::remove (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/UPIPE_Addr.h b/externals/ace/UPIPE_Addr.h new file mode 100644 index 0000000..aaf33b6 --- /dev/null +++ b/externals/ace/UPIPE_Addr.h @@ -0,0 +1,33 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file UPIPE_Addr.h + * + * $Id: UPIPE_Addr.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Doug Schmidt + */ +//============================================================================= + + +#ifndef ACE_UPIPE_ADDR_H +#define ACE_UPIPE_ADDR_H + +#include /**/ "ace/pre.h" + +#include "ace/SPIPE_Addr.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +typedef ACE_SPIPE_Addr ACE_UPIPE_Addr; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_UPIPE_ADDR_H */ diff --git a/externals/ace/UPIPE_Connector.cpp b/externals/ace/UPIPE_Connector.cpp new file mode 100644 index 0000000..9b9bfcd --- /dev/null +++ b/externals/ace/UPIPE_Connector.cpp @@ -0,0 +1,101 @@ +// $Id: UPIPE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/UPIPE_Connector.h" + +ACE_RCSID(ace, UPIPE_Connector, "$Id: UPIPE_Connector.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if defined (ACE_HAS_THREADS) + +#include "ace/Handle_Ops.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_stropts.h" + +#if !defined (__ACE_INLINE__) +#include "ace/UPIPE_Connector.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Connector) + +void +ACE_UPIPE_Connector::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_UPIPE_Connector::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_UPIPE_Connector::ACE_UPIPE_Connector (void) +{ + ACE_TRACE ("ACE_UPIPE_Connector::ACE_UPIPE_Connector"); +} + +int +ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream, + const ACE_UPIPE_Addr &addr, + ACE_Time_Value *timeout, + const ACE_Addr & /* local_sap */, + int /* reuse_addr */, + int flags, + int perms) +{ + ACE_TRACE ("ACE_UPIPE_Connector::connect"); + ACE_ASSERT (new_stream.get_handle () == ACE_INVALID_HANDLE); + + ACE_HANDLE handle = ACE::handle_timed_open (timeout, + addr.get_path_name (), + flags, perms); + + if (handle == ACE_INVALID_HANDLE) + return -1; +#if !defined (ACE_WIN32) + else if (ACE_OS::isastream (handle) != 1) + return -1; +#endif + else // We're connected! + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1)); + + ACE_UPIPE_Stream *ustream = &new_stream; + + new_stream.set_handle (handle); + new_stream.remote_addr_ = addr; // class copy. + new_stream.reference_count_++; + + // Now send the address of our ACE_UPIPE_Stream over this pipe + // to our corresponding ACE_UPIPE_Acceptor, so he may link the + // two streams. + ssize_t result = ACE_OS::write (handle, + (const char *) &ustream, + sizeof ustream); + if (result == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_UPIPE_Connector %p\n"), + ACE_TEXT ("write to pipe failed"))); + + // Wait for confirmation of stream linking. + ACE_Message_Block *mb_p = 0; + + // Our part is done, wait for server to confirm connection. + result = new_stream.recv (mb_p, 0); + + // Do *not* coalesce the following two checks for result == -1. + // They perform different checks and cannot be merged. + if (result == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_UPIPE_Connector %p\n"), + ACE_TEXT ("no confirmation from server"))); + else + // Close down the new_stream at this point in order to + // conserve handles. Note that we don't need the SPIPE + // connection anymore since we're linked via the Message_Queue + // now. + new_stream.ACE_SPIPE::close (); + return static_cast (result); + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/UPIPE_Connector.h b/externals/ace/UPIPE_Connector.h new file mode 100644 index 0000000..b2ad178 --- /dev/null +++ b/externals/ace/UPIPE_Connector.h @@ -0,0 +1,115 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file UPIPE_Connector.h + * + * $Id: UPIPE_Connector.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Gerhard Lenzer and Douglas C. Schmidt + */ +//============================================================================= + + +#ifndef ACE_UPIPE_CONNECTOR_H +#define ACE_UPIPE_CONNECTOR_H +#include /**/ "ace/pre.h" + +#include "ace/UPIPE_Stream.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_UPIPE_Connector + * + * @brief Defines an active connection factory for the + * ACE_UPIPE_STREAM wrappers. + */ +class ACE_Export ACE_UPIPE_Connector +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_UPIPE_Connector (void); + + /** + * Actively connect and produce a @a new_stream if things go well. + * The @a addr is the address that we are trying to connect + * with. The @a timeout is the amount of time to wait to connect. + * If it's 0 then we block indefinitely. If *timeout == {0, 0} then + * the connection is done using non-blocking mode. In this case, if + * the connection can't be made immediately the value of -1 is + * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then + * this is the maximum amount of time to wait before timing out. If the + * time expires before the connection is made @c errno == ETIME. The + * @a local_sap is the value of local address to bind to. If it's + * the default value of ACE_Addr::sap_any then the user is letting + * the OS do the binding. If @a reuse_addr == 1 then the + * @a local_addr is reused, even if it hasn't been cleanedup yet. + * The @a flags and @a perms arguments are passed down to the open() + * method. + */ + ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream, + const ACE_UPIPE_Addr &addr, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0); + + /** + * Actively connect and produce a @a new_stream if things go well. + * The @a addr is the address that we are trying to connect + * with. The @a timeout is the amount of time to wait to connect. + * If it's 0 then we block indefinitely. If *timeout == {0, 0} then + * the connection is done using non-blocking mode. In this case, if + * the connection can't be made immediately the value of -1 is + * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then + * this is the maximum amount of time to wait before timing out. If the + * time expires before the connection is made @c errno == ETIME. The + * @a local_sap is the value of local address to bind to. If it's + * the default value of ACE_Addr::sap_any then the user is letting + * the OS do the binding. If @a reuse_addr == 1 then the + * @a local_addr is reused, even if it hasn't been cleanedup yet. + * The @a flags and @a perms arguments are passed down to the open() + * method. + */ + int connect (ACE_UPIPE_Stream &new_stream, + const ACE_UPIPE_Addr &addr, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0); + + /// Resets any event associations on this handle + bool reset_new_handle (ACE_HANDLE handle); + + // = Meta-type info + typedef ACE_UPIPE_Addr PEER_ADDR; + typedef ACE_UPIPE_Stream PEER_STREAM; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/UPIPE_Connector.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" + +#endif /* ACE_UPIPE_CONNECTOR_H */ diff --git a/externals/ace/UPIPE_Connector.inl b/externals/ace/UPIPE_Connector.inl new file mode 100644 index 0000000..07b7502 --- /dev/null +++ b/externals/ace/UPIPE_Connector.inl @@ -0,0 +1,34 @@ +// -*- C++ -*- +// +// $Id: UPIPE_Connector.inl 82723 2008-09-16 09:35:44Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Creates a Local ACE_UPIPE. +ACE_INLINE +ACE_UPIPE_Connector::ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream, + const ACE_UPIPE_Addr &addr, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms) +{ + ACE_TRACE ("ACE_UPIPE_Connector::ACE_UPIPE_Connector"); + if (this->connect (new_stream, addr, timeout, local_sap, + reuse_addr, flags, perms) == -1 + && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("address %s, %p\n"), + addr.get_path_name (), + ACE_TEXT ("ACE_UPIPE_Connector"))); +} + +ACE_INLINE bool +ACE_UPIPE_Connector::reset_new_handle (ACE_HANDLE /* handle */) +{ + // Nothing to do here since the handle is not a socket + return false; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/UPIPE_Stream.cpp b/externals/ace/UPIPE_Stream.cpp new file mode 100644 index 0000000..d07722a --- /dev/null +++ b/externals/ace/UPIPE_Stream.cpp @@ -0,0 +1,234 @@ +// $Id: UPIPE_Stream.cpp 82559 2008-08-07 20:23:07Z parsons $ + +#include "ace/UPIPE_Stream.h" + +ACE_RCSID(ace, UPIPE_Stream, "$Id: UPIPE_Stream.cpp 82559 2008-08-07 20:23:07Z parsons $") + +#if defined (ACE_HAS_THREADS) + +#include "ace/OS_NS_string.h" + +#if !defined (__ACE_INLINE__) +#include "ace/UPIPE_Stream.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Stream) + +ACE_UPIPE_Stream::ACE_UPIPE_Stream (void) + : mb_last_ (0), + reference_count_ (0) +{ + ACE_TRACE ("ACE_UPIPE_Stream::ACE_UPIPE_STREAM"); +} + +ACE_UPIPE_Stream::~ACE_UPIPE_Stream (void) +{ + if (this->mb_last_ != 0) + { + this->mb_last_->release (); + this->mb_last_ = 0; + } +} + +int +ACE_UPIPE_Stream::control (int cmd, + void * val) const +{ + ACE_TRACE ("ACE_UPIPE_Stream::control"); + + return ((ACE_UPIPE_Stream *) this)->stream_.control + ((ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds) cmd, val); +} + +void +ACE_UPIPE_Stream::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_UPIPE_Stream::dump"); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_UPIPE_Stream::close (void) +{ + ACE_TRACE ("ACE_UPIPE_Stream::close"); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + + this->reference_count_--; + + if (this->reference_count_ == 0) + { + // Since the UPIPE should have been closed earlier we won't bother + // checking to see if closing it now fails. + + if (this->ACE_SPIPE::get_handle () != ACE_INVALID_HANDLE) + this->ACE_SPIPE::close (); + + // Close down the ACE_stream. + return this->stream_.close (); + } + return 0; +} + +int +ACE_UPIPE_Stream::get_remote_addr (ACE_UPIPE_Addr &remote_sap) const +{ + ACE_TRACE ("ACE_UPIPE_Stream::get_remote_addr"); + remote_sap = this->remote_addr_; + return 0; +} + +int +ACE_UPIPE_Stream::send (ACE_Message_Block *mb_p, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_UPIPE_Stream::send_msg"); + return this->stream_.put (mb_p, timeout) == -1 ? -1 : 0; +} + +int ACE_UPIPE_Stream::recv (ACE_Message_Block *& mb_p, + ACE_Time_Value *timeout) +{ + return this->stream_.get (mb_p, timeout) == -1 ? -1 : 0; +} + +// Send a buffer. + +ssize_t +ACE_UPIPE_Stream::send (const char *buffer, + size_t n, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_UPIPE_Stream::send"); + + ACE_Message_Block *mb_p; + ACE_NEW_RETURN (mb_p, + ACE_Message_Block (n), + -1); + mb_p->copy (buffer, n); + return + this->stream_.put (mb_p, timeout) == -1 + ? -1 + : static_cast (n); +} + +// Receive a buffer. + +ssize_t +ACE_UPIPE_Stream::recv (char *buffer, + size_t n, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_UPIPE_Stream::recv"); + // Index in buffer. + size_t bytes_read = 0; + + while (bytes_read < n) + if (this->mb_last_ != 0) + { + // We have remaining data in our last read Message_Buffer. + size_t this_len = this->mb_last_->length (); + if (this_len < n) + { + // The remaining data is not enough. + + ACE_OS::memcpy ((void *) &buffer[bytes_read], + this->mb_last_->rd_ptr (), + this_len); + bytes_read += this_len; + this->mb_last_ = this->mb_last_->release (); // mb_last_ now 0 + return static_cast (bytes_read); + } + else + { + // The remaining data is at least enough. If there's + // more, we'll get it the next time through. + ACE_OS::memcpy (&buffer[bytes_read], + this->mb_last_->rd_ptr (), + n); + bytes_read += n; + + // Advance rd_ptr. + this->mb_last_->rd_ptr (n); + + if (this->mb_last_->length () == 0) + // Now the Message_Buffer is empty. + this->mb_last_ = this->mb_last_->release (); + } + } + else + { + // We have to get a new Message_Buffer from our stream. + int result = this->stream_.get (this->mb_last_, timeout); + + if (result == -1) + { + if (errno == EWOULDBLOCK && bytes_read > 0) + // Return the number of bytes read before we timed out. + return static_cast (bytes_read); + else + return -1; + } + } + + return static_cast (bytes_read); +} + +ssize_t +ACE_UPIPE_Stream::send_n (const char *buf, + size_t n, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_UPIPE_Stream::send_n"); + + size_t bytes_written; + ssize_t len = 0; + + for (bytes_written = 0; bytes_written < n; bytes_written += len) + { + len = this->send (buf + bytes_written, + n - bytes_written, + timeout); + + if (len == -1) + { + return -1; + } + } + + return static_cast (bytes_written); +} + +ssize_t +ACE_UPIPE_Stream::recv_n (char *buf, + size_t n, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_UPIPE_Stream::recv_n"); + size_t bytes_read; + ssize_t len = 0; + + for (bytes_read = 0; bytes_read < n; bytes_read += len) + { + len = this->recv (buf + bytes_read, + n - bytes_read, + timeout); + + if (len == -1) + { + return -1; + } + else if (len == 0) + { + break; + } + } + + return static_cast< ssize_t> (bytes_read); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/externals/ace/UPIPE_Stream.h b/externals/ace/UPIPE_Stream.h new file mode 100644 index 0000000..b10aef1 --- /dev/null +++ b/externals/ace/UPIPE_Stream.h @@ -0,0 +1,140 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file UPIPE_Stream.h + * + * $Id: UPIPE_Stream.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Gerhard Lenzer + * @author Douglas C. Schmidt + */ +//============================================================================= + + +#ifndef ACE_UPIPE_STREAM_H +#define ACE_UPIPE_STREAM_H +#include /**/ "ace/pre.h" + +#include "ace/Stream.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_THREADS) + +#include "ace/SPIPE.h" +#include "ace/Message_Queue.h" +#include "ace/UPIPE_Addr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_UPIPE_Stream + * + * @brief Defines the method that transfer data on a UPIPE. + */ +class ACE_Export ACE_UPIPE_Stream : public ACE_SPIPE +{ +public: + friend class ACE_UPIPE_Acceptor; + friend class ACE_UPIPE_Connector; + + typedef ACE_Stream MT_Stream; + + // = Initialization and Termination. + + ACE_UPIPE_Stream (void); + + virtual ~ACE_UPIPE_Stream (void); + + /// Shut down the UPIPE and release resources. + int close (void); + + /// Return the underlying I/O handle. + ACE_HANDLE get_handle (void) const; + + // = Send/recv ACE Message_Blocks. + /// Send a message through the message queue. Returns -1 on error, + /// else 0. + int send (ACE_Message_Block *mb_p, + ACE_Time_Value *timeout = 0); + + /// Recv a message from the message queue. Returns -1 on error, else + /// 0. + int recv (ACE_Message_Block *&mb_p, + ACE_Time_Value *timeout = 0); + + // = Send/recv char buffers. + /// Send a buffer of @a n bytes through the message queue. Returns -1 + /// on error, else number of bytes sent. + ssize_t send (const char *buffer, + size_t n, + ACE_Time_Value *timeout = 0); + + /// Recv a buffer of upto @a n bytes from the message queue. Returns + /// -1 on error, else number of bytes read. + ssize_t recv (char *buffer, + size_t n, + ACE_Time_Value *timeout = 0); + + /// Send a buffer of exactly @a n bytes to the message queue. Returns + /// -1 on error, else number of bytes written (which should == n). + ssize_t send_n (const char *buffer, + size_t n, + ACE_Time_Value *timeout = 0); + + /// Recv a buffer of exactly @a n bytes from the message queue. + /// Returns -1 on error, else the number of bytes read. + ssize_t recv_n (char *buffer, + size_t n, + ACE_Time_Value *timeout = 0); + + /// Perform control operations on the UPIPE_Stream. + int control (int cmd, void *val) const; + + /// Return the remote address we are connected to. + int get_remote_addr (ACE_UPIPE_Addr &remote_sap) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + // = Meta-type info + typedef ACE_UPIPE_Addr PEER_ADDR; + +private: + /// To hold the last ACE_Message_Block read out of the stream. Thus + /// allowing subsequent reads from one ACE_Message_Block + ACE_Message_Block *mb_last_; + + /// Address of who we are connected to. + ACE_UPIPE_Addr remote_addr_; + + /// Stream component used by the @c UPIPE_Acceptor and + /// @c UPIPE_Connector to link together two UPIPE_Streams. + MT_Stream stream_; + + /// Keep track of whether the sender and receiver have both shutdown. + int reference_count_; + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + /// Ensure that we are thread-safe. + ACE_Thread_Mutex lock_; +#endif /* ACE_MT_SAFE */ +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/UPIPE_Stream.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" + +#endif /*ACE_UPIPE_STREAM_H */ diff --git a/externals/ace/UPIPE_Stream.inl b/externals/ace/UPIPE_Stream.inl new file mode 100644 index 0000000..7a0d73c --- /dev/null +++ b/externals/ace/UPIPE_Stream.inl @@ -0,0 +1,14 @@ +// -*- C++ -*- +// +// $Id: UPIPE_Stream.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_HANDLE +ACE_UPIPE_Stream::get_handle (void) const +{ + ACE_TRACE ("ACE_UPIPE_Stream::get_handle"); + return this->ACE_SPIPE::get_handle (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/UTF16_Encoding_Converter.cpp b/externals/ace/UTF16_Encoding_Converter.cpp new file mode 100644 index 0000000..da88373 --- /dev/null +++ b/externals/ace/UTF16_Encoding_Converter.cpp @@ -0,0 +1,364 @@ +// $Id: UTF16_Encoding_Converter.cpp 83735 2008-11-14 09:41:52Z johnnyw $ + +// ====================================================================== +// +// The actual conversion methods are covered by the copyright information +// below. It is not the actual code provided by Unicode, Inc. but is an +// ACE-ified and only slightly modified version. +// Chad Elliott 4/28/2005 +// +// Copyright 2001-2004 Unicode, Inc. +// +// Limitations on Rights to Redistribute This Code +// +// Unicode, Inc. hereby grants the right to freely use the information +// supplied in this file in the creation of products supporting the +// Unicode Standard, and to make copies of this file in any form +// for internal or external distribution as long as this notice +// remains attached. +// +// ====================================================================== + +#include "ace/UTF16_Encoding_Converter.h" + +#if defined (ACE_USES_WCHAR) +#include "ace/OS_NS_stdio.h" +#include "ace/OS_Memory.h" +#include "ace/Min_Max.h" + +#if !defined (__ACE_INLINE__) +#include "ace/UTF16_Encoding_Converter.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +static const ACE_UINT32 halfShift = 10; +static const ACE_UINT32 halfBase = 0x00010000; +static const ACE_UINT32 halfMask = 0x000003FF; + +static const ACE_UINT32 UNI_SUR_HIGH_START = 0x0000D800; +static const ACE_UINT32 UNI_SUR_HIGH_END = 0x0000DBFF; +static const ACE_UINT32 UNI_SUR_LOW_START = 0x0000DC00; +static const ACE_UINT32 UNI_SUR_LOW_END = 0x0000DFFF; +static const ACE_UINT32 UNI_REPLACEMENT_CHAR = 0x0000FFFD; +static const ACE_UINT32 UNI_MAX_BMP = 0x0000FFFF; +static const ACE_UINT32 UNI_MAX_UTF16 = 0x0010FFFF; + +// Once the bits are split out into bytes of UTF-8, this is a mask OR-ed +// into the first byte, depending on how many bytes follow. There are +// as many entries in this table as there are UTF-8 sequence types. +// (I.e., one byte sequence, two byte... etc.). Remember that sequencs +// for *legal* UTF-8 will be 4 or fewer bytes total. +static const ACE_Byte firstByteMark[7] = { 0x00, 0x00, 0xC0, + 0xE0, 0xF0, 0xF8, 0xFC }; + +// Index into the table below with the first byte of a UTF-8 sequence to +// get the number of trailing bytes that are supposed to follow it. +// Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is +// left as-is for anyone who may want to do such conversion, which was +// allowed in earlier algorithms. +static const ACE_Byte trailingBytesForUTF8[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 +}; + +// Magic values subtracted from a buffer value during UTF8 conversion. +// This table contains as many values as there might be trailing bytes +// in a UTF-8 sequence. +static const ACE_UINT32 offsetsFromUTF8[6] = { 0x00000000, 0x00003080, + 0x000E2080, 0x03C82080, + 0xFA082080, 0x82082080 }; + + +ACE_UTF16_Encoding_Converter::ACE_UTF16_Encoding_Converter (bool swap) + : swap_ (swap) +{ +} + +ACE_UTF16_Encoding_Converter::~ACE_UTF16_Encoding_Converter (void) +{ +} + +ACE_UTF16_Encoding_Converter::Result +ACE_UTF16_Encoding_Converter::to_utf8 (const void* source, + size_t source_size, + ACE_Byte* target, + size_t target_size, + bool strict) +{ + static const ACE_UINT32 byteMask = 0xBF; + static const ACE_UINT32 byteMark = 0x80; + Result result = CONVERSION_OK; + + ACE_Byte* targetEnd = target + target_size; + const ACE_UINT16* sourceStart = static_cast (source); + const ACE_UINT16* sourceEnd = sourceStart + + (source_size / sizeof (ACE_UINT16)); + + while (sourceStart < sourceEnd) + { + ACE_UINT16 nw = *sourceStart++; + ACE_UINT32 ch = (this->swap_ ? ACE_SWAP_WORD (nw) : nw); + + // If we have a surrogate pair, convert to ACE_UINT32 first. + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) + { + // If the 16 bits following the high surrogate are in the + // sourceStart buffer... + if (sourceStart < sourceEnd) + { + ACE_UINT32 ch2 = (this->swap_ ? ACE_SWAP_WORD (*sourceStart) : + *sourceStart); + // If it's a low surrogate, convert to ACE_UINT32. + if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) + { + ch = ((ch - UNI_SUR_HIGH_START) << halfShift) + + (ch2 - UNI_SUR_LOW_START) + halfBase; + ++sourceStart; + } + else if (strict) + { + // it's an unpaired high surrogate + result = SOURCE_ILLEGAL; + break; + } + } + else + { + // We don't have the 16 bits following the high surrogate. + result = SOURCE_EXHAUSTED; + break; + } + } + else if (strict) + { + // UTF-16 surrogate values are illegal in UTF-32 + if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) + { + result = SOURCE_ILLEGAL; + break; + } + } + + // Figure out how many bytes the result will require + unsigned short bytesToWrite = 0; + if (ch < 0x80) + bytesToWrite = 1; + else if (ch < 0x800) + bytesToWrite = 2; + else if (ch < 0x10000) + bytesToWrite = 3; + else if (ch < 0x110000) + bytesToWrite = 4; + else + { + bytesToWrite = 3; + ch = UNI_REPLACEMENT_CHAR; + } + + target += bytesToWrite; + if (target > targetEnd) + { + result = TARGET_EXHAUSTED; + break; + } + + // NOTE: Everything falls through for efficiency purposes. + switch (bytesToWrite) + { + case 4: + *--target = (ACE_Byte)((ch | byteMark) & byteMask); + ch >>= 6; + case 3: + *--target = (ACE_Byte)((ch | byteMark) & byteMask); + ch >>= 6; + case 2: + *--target = (ACE_Byte)((ch | byteMark) & byteMask); + ch >>= 6; + case 1: + *--target = (ACE_Byte)(ch | firstByteMark[bytesToWrite]); + } + target += bytesToWrite; + } + + return result; +} + +ACE_UTF16_Encoding_Converter::Result +ACE_UTF16_Encoding_Converter::from_utf8 (const ACE_Byte* source, + size_t source_size, + void* target, + size_t target_size, + bool strict) +{ + Result result = CONVERSION_OK; + const ACE_Byte* sourceEnd = source + source_size; + ACE_UINT16* targetStart = static_cast (target); + ACE_UINT16* targetEnd = targetStart + target_size; + + while (source < sourceEnd) + { + ACE_UINT32 ch = 0; + unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; + if (source + extraBytesToRead >= sourceEnd) + { + result = SOURCE_EXHAUSTED; + break; + } + + // Do this check whether lenient or strict + if (!this->is_legal_utf8 (source, extraBytesToRead + 1)) + { + result = SOURCE_ILLEGAL; + break; + } + + // The cases all fall through. See "Note A" below. + switch (extraBytesToRead) + { + case 5: // remember, illegal UTF-8 + ch += *source++; + ch <<= 6; + case 4: // remember, illegal UTF-8 + ch += *source++; + ch <<= 6; + case 3: + ch += *source++; + ch <<= 6; + case 2: + ch += *source++; + ch <<= 6; + case 1: + ch += *source++; + ch <<= 6; + case 0: + ch += *source++; + } + ch -= offsetsFromUTF8[extraBytesToRead]; + + if (targetStart >= targetEnd) + { + result = TARGET_EXHAUSTED; + break; + } + + if (ch <= UNI_MAX_BMP) // Target is a character <= 0xFFFF + { + // UTF-16 surrogate values are illegal in UTF-32 + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) + { + if (strict) + { + result = SOURCE_ILLEGAL; + break; + } + else + { + *targetStart++ = UNI_REPLACEMENT_CHAR; + } + } + else + { + *targetStart++ = (ACE_UINT16)ch; + } + } + else if (ch > UNI_MAX_UTF16) + { + if (strict) + { + result = SOURCE_ILLEGAL; + break; + } + else + { + *targetStart++ = UNI_REPLACEMENT_CHAR; + } + } + else + { + // targetStart is a character in range 0xFFFF - 0x10FFFF. + if (targetStart + 1 >= targetEnd) + { + result = TARGET_EXHAUSTED; + break; + } + ch -= halfBase; + *targetStart++ = (ACE_UINT16)((ch >> halfShift) + UNI_SUR_HIGH_START); + *targetStart++ = (ACE_UINT16)((ch & halfMask) + UNI_SUR_LOW_START); + } + } + + return result; +} + +ACE_UTF16_Encoding_Converter* +ACE_UTF16_Encoding_Converter::encoded (const ACE_Byte* source, + size_t source_size) +{ + static const size_t begin = 16; + static const size_t converted = begin * 4; + + ACE_Byte target[converted]; + ACE_UTF16_Encoding_Converter* converter = 0; + ACE_NEW_RETURN (converter, + ACE_UTF16_Encoding_Converter (false), + 0); + if (converter->to_utf8 (source, + ACE_MIN (begin, source_size), + target, + converted) == CONVERSION_OK) + { + return converter; + } + else + { + delete converter; + } + + return 0; +} + +ACE_UINT32 +ACE_UTF16_Encoding_Converter::get_UNI_SUR_HIGH_START (void) +{ + return UNI_SUR_HIGH_START; +} + +ACE_UINT32 +ACE_UTF16_Encoding_Converter::get_UNI_SUR_LOW_END (void) +{ + return UNI_SUR_LOW_END; +} + +ACE_UINT32 +ACE_UTF16_Encoding_Converter::get_UNI_REPLACEMENT_CHAR (void) +{ + return UNI_REPLACEMENT_CHAR; +} + +const ACE_Byte* +ACE_UTF16_Encoding_Converter::get_first_byte_mark (void) +{ + return firstByteMark; +} + +const ACE_Byte* +ACE_UTF16_Encoding_Converter::get_trailing_bytes_for_utf8 (void) +{ + return trailingBytesForUTF8; +} + +const ACE_UINT32* +ACE_UTF16_Encoding_Converter::get_offsets_from_utf8 (void) +{ + return offsetsFromUTF8; +} + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ diff --git a/externals/ace/UTF16_Encoding_Converter.h b/externals/ace/UTF16_Encoding_Converter.h new file mode 100644 index 0000000..9bdcb21 --- /dev/null +++ b/externals/ace/UTF16_Encoding_Converter.h @@ -0,0 +1,86 @@ +// -*- C++ -*- + +//========================================================================= +/** + * @file UTF16_Encoding_Converter.h + * + * $Id: UTF16_Encoding_Converter.h 80826 2008-03-04 14:51:23Z wotte $ + * + * This class contains declarations for methods that convert between + * UTF-16 (both BE and LE) and UTF-8 + * + * @author Chad Elliott + */ +//========================================================================= + +#ifndef ACE_UTF16_ENCODING_CONVERTER_H +#define ACE_UTF16_ENCODING_CONVERTER_H + +#include /**/ "ace/pre.h" + +#include "ace/Encoding_Converter.h" + +#if defined (ACE_USES_WCHAR) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** Convert from UTF-16 to UTF-8 and from UTF-8 to UTF-16. + * This class implements the ACE_Encoding_Converter interface. + */ +class ACE_UTF16_Encoding_Converter: public ACE_Encoding_Converter +{ +public: + /// The swap parameter determines whether we need to swap byte order on + /// the stream as each word is pulled off when converting to UTF-8. + ACE_UTF16_Encoding_Converter (bool swap = false); + + /// This is a do nothing destructor. + virtual ~ACE_UTF16_Encoding_Converter (void); + + /// Convert the source from UTF-16 to UTF-8 and store it in the + /// provided target buffer. + virtual Result to_utf8 (const void* source, + size_t source_size, + ACE_Byte* target, + size_t target_size, + bool strict = true); + + /// Convert the UTF-8 source into a UTF-16 encoding and store it + /// in the provided target buffer. + virtual Result from_utf8 (const ACE_Byte* source, + size_t source_size, + void* target, + size_t target_size, + bool strict = true); + + /// This factory helper method determines if the source stream is UTF-16 + /// encoded. If it is, allocate an ACE_UTF16_Encoding_Converter and + /// return it. The caller then owns the allocated object. + static ACE_UTF16_Encoding_Converter* encoded (const ACE_Byte* source, + size_t source_size); + +protected: + /// Determines if the source buffer is legal UTF-8 + bool is_legal_utf8 (const ACE_Byte* source, + size_t length) const; + + static ACE_UINT32 get_UNI_SUR_HIGH_START (void); + static ACE_UINT32 get_UNI_SUR_LOW_END (void); + static ACE_UINT32 get_UNI_REPLACEMENT_CHAR (void); + static const ACE_Byte* get_first_byte_mark (void); + static const ACE_Byte* get_trailing_bytes_for_utf8 (void); + static const ACE_UINT32* get_offsets_from_utf8 (void); + + bool swap_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/UTF16_Encoding_Converter.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_USES_WCHAR */ + +#include /**/ "ace/post.h" + +#endif /* ACE_UTF16_ENCODING_CONVERTER_H */ diff --git a/externals/ace/UTF16_Encoding_Converter.inl b/externals/ace/UTF16_Encoding_Converter.inl new file mode 100644 index 0000000..e529275 --- /dev/null +++ b/externals/ace/UTF16_Encoding_Converter.inl @@ -0,0 +1,76 @@ +/* -*- C++ -*- */ +// $Id: UTF16_Encoding_Converter.inl 80826 2008-03-04 14:51:23Z wotte $ + +// ====================================================================== +// +// The actual conversion methods are covered by the copyright information +// below. +// Chad Elliott 4/28/2005 +// +// Copyright 2001-2004 Unicode, Inc. +// +// Limitations on Rights to Redistribute This Code +// +// Unicode, Inc. hereby grants the right to freely use the information +// supplied in this file in the creation of products supporting the +// Unicode Standard, and to make copies of this file in any form +// for internal or external distribution as long as this notice +// remains attached. +// +// ====================================================================== + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE bool +ACE_UTF16_Encoding_Converter::is_legal_utf8 (const ACE_Byte* source, + size_t length) const +{ + ACE_Byte a; + const ACE_Byte* srcptr = source + length; + + switch (length) + { + default: + return false; + + // Everything else falls through when "true"... + case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; + case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; + case 2: if ((a = (*--srcptr)) > 0xBF) return false; + + switch (*source) + { + // no fall-through in this inner switch + case 0xE0: + if (a < 0xA0) + return false; + break; + case 0xED: + if (a > 0x9F) + return false; + break; + case 0xF0: + if (a < 0x90) + return false; + break; + case 0xF4: + if (a > 0x8F) + return false; + break; + default: + if (a < 0x80) + return false; + } + + case 1: + if (*source >= 0x80 && *source < 0xC2) + return false; + } + + if (*source > 0xF4) + return false; + + return true; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/UTF32_Encoding_Converter.cpp b/externals/ace/UTF32_Encoding_Converter.cpp new file mode 100644 index 0000000..459bf25 --- /dev/null +++ b/externals/ace/UTF32_Encoding_Converter.cpp @@ -0,0 +1,254 @@ +// $Id: UTF32_Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $ + +// ====================================================================== +// +// The actual conversion methods are covered by the copyright information +// below. It is not the actual code provided by Unicode, Inc. but is an +// ACE-ified and only slightly modified version. +// +// Chad Elliott 4/28/2005 +// +// Copyright 2001-2004 Unicode, Inc. +// +// Limitations on Rights to Redistribute This Code +// +// Unicode, Inc. hereby grants the right to freely use the information +// supplied in this file in the creation of products supporting the +// Unicode Standard, and to make copies of this file in any form +// for internal or external distribution as long as this notice +// remains attached. +// +// ====================================================================== + +#include "ace/UTF32_Encoding_Converter.h" + +#if defined (ACE_USES_WCHAR) +#include "ace/OS_NS_stdio.h" +#include "ace/OS_Memory.h" +#include "ace/Min_Max.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +static const ACE_UINT32 UNI_MAX_LEGAL_UTF32 = 0x0010FFFF; + +ACE_UTF32_Encoding_Converter::ACE_UTF32_Encoding_Converter (bool swap) + : ACE_UTF16_Encoding_Converter (swap) +{ +} + +ACE_UTF32_Encoding_Converter::~ACE_UTF32_Encoding_Converter (void) +{ +} + +ACE_UTF32_Encoding_Converter::Result +ACE_UTF32_Encoding_Converter::to_utf8 (const void* source, + size_t source_size, + ACE_Byte* target, + size_t target_size, + bool strict) +{ + static const ACE_UINT32 byteMask = 0xBF; + static const ACE_UINT32 byteMark = 0x80; + static const ACE_UINT32 UNI_SUR_HIGH_START = get_UNI_SUR_HIGH_START (); + static const ACE_UINT32 UNI_SUR_LOW_END = get_UNI_SUR_LOW_END (); + static const ACE_Byte* firstByteMark = get_first_byte_mark (); + + Result result = CONVERSION_OK; + ACE_Byte* targetEnd = target + target_size; + const ACE_UINT32* sourceStart = static_cast (source); + const ACE_UINT32* sourceEnd = sourceStart + (source_size / sizeof (ACE_UINT32)); + + while (sourceStart < sourceEnd) + { + ACE_UINT32 nw = *sourceStart++; + ACE_UINT32 ch = (this->swap_ ? ACE_SWAP_LONG (nw) : nw); + unsigned short bytesToWrite = 0; + + if (strict) + { + // UTF-16 surrogate values are illegal in UTF-32 + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) + { + result = SOURCE_ILLEGAL; + break; + } + } + + // Figure out how many bytes the result will require. Turn any + // illegally large ACE_UINT32 things (> Plane 17) into replacement + // chars. + if (ch < 0x80) + { + bytesToWrite = 1; + } + else if (ch < 0x800) + { + bytesToWrite = 2; + } + else if (ch < 0x10000) + { + bytesToWrite = 3; + } + else if (ch <= UNI_MAX_LEGAL_UTF32) + { + bytesToWrite = 4; + } + else + { + result = SOURCE_ILLEGAL; + break; + } + + target += bytesToWrite; + if (target > targetEnd) + { + result = TARGET_EXHAUSTED; + break; + } + + // NOTE: everything falls through. + switch (bytesToWrite) + { + case 4: + *--target = (ACE_Byte)((ch | byteMark) & byteMask); + ch >>= 6; + case 3: + *--target = (ACE_Byte)((ch | byteMark) & byteMask); + ch >>= 6; + case 2: + *--target = (ACE_Byte)((ch | byteMark) & byteMask); + ch >>= 6; + case 1: + *--target = (ACE_Byte) (ch | firstByteMark[bytesToWrite]); + } + target += bytesToWrite; + } + + return result; +} + +ACE_UTF32_Encoding_Converter::Result +ACE_UTF32_Encoding_Converter::from_utf8 (const ACE_Byte* source, + size_t source_size, + void* target, + size_t target_size, + bool strict) +{ + static const ACE_UINT32 UNI_SUR_HIGH_START = get_UNI_SUR_HIGH_START (); + static const ACE_UINT32 UNI_SUR_LOW_END = get_UNI_SUR_LOW_END (); + static const ACE_UINT32 UNI_REPLACEMENT_CHAR = get_UNI_REPLACEMENT_CHAR (); + static const ACE_Byte* trailingBytesForUTF8 = get_trailing_bytes_for_utf8 (); + static const ACE_UINT32* offsetsFromUTF8 = get_offsets_from_utf8 (); + + Result result = CONVERSION_OK; + const ACE_Byte* sourceEnd = source + source_size; + ACE_UINT32* targetStart = static_cast (target); + ACE_UINT32* targetEnd = targetStart + target_size; + + while (source < sourceEnd) + { + ACE_UINT32 ch = 0; + unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; + if (source + extraBytesToRead >= sourceEnd) + { + result = SOURCE_EXHAUSTED; + break; + } + + // Do this check whether lenient or strict + if (!this->is_legal_utf8 (source, extraBytesToRead + 1)) + { + result = SOURCE_ILLEGAL; + break; + } + + // The cases all fall through. See "Note A" below. + switch (extraBytesToRead) + { + case 5: + ch += *source++; + ch <<= 6; + case 4: + ch += *source++; + ch <<= 6; + case 3: + ch += *source++; + ch <<= 6; + case 2: + ch += *source++; + ch <<= 6; + case 1: + ch += *source++; + ch <<= 6; + case 0: + ch += *source++; + } + ch -= offsetsFromUTF8[extraBytesToRead]; + + if (targetStart >= targetEnd) + { + result = TARGET_EXHAUSTED; + break; + } + + if (ch <= UNI_MAX_LEGAL_UTF32) + { + // UTF-16 surrogate values are illegal in UTF-32, and anything + // over Plane 17 (> 0x10FFFF) is illegal. + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) + { + if (strict) + { + result = SOURCE_ILLEGAL; + break; + } + else + { + *targetStart++ = UNI_REPLACEMENT_CHAR; + } + } + else + { + *targetStart++ = ch; + } + } + else + { + result = SOURCE_ILLEGAL; + break; + } + } + + return result; +} + +ACE_UTF32_Encoding_Converter* +ACE_UTF32_Encoding_Converter::encoded (const ACE_Byte* source, + size_t source_size) +{ + static const size_t begin = 16; + static const size_t converted = begin * 4; + + ACE_Byte target[converted]; + ACE_UTF32_Encoding_Converter* converter = 0; + ACE_NEW_RETURN (converter, + ACE_UTF32_Encoding_Converter (false), + 0); + + if (converter->to_utf8 (source, + ACE_MIN (begin, source_size), + target, + converted) == CONVERSION_OK) + { + return converter; + } + else + { + delete converter; + } + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ diff --git a/externals/ace/UTF32_Encoding_Converter.h b/externals/ace/UTF32_Encoding_Converter.h new file mode 100644 index 0000000..214edee --- /dev/null +++ b/externals/ace/UTF32_Encoding_Converter.h @@ -0,0 +1,67 @@ +// -*- C++ -*- + +//========================================================================= +/** + * @file UTF32_Encoding_Converter.h + * + * $Id: UTF32_Encoding_Converter.h 80826 2008-03-04 14:51:23Z wotte $ + * + * This class contains declarations for methods that convert between + * UTF-32 (both BE and LE) and UTF-8 + * + * @author Chad Elliott + */ +//========================================================================= + +#ifndef ACE_UTF32_ENCODING_CONVERTER_H +#define ACE_UTF32_ENCODING_CONVERTER_H + +#include /**/ "ace/pre.h" + +#include "ace/UTF16_Encoding_Converter.h" + +#if defined (ACE_USES_WCHAR) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** Convert from UTF-32 to UTF-8 and from UTF-8 to UTF-32. + * This class implements the ACE_Encoding_Converter interface. + */ +class ACE_UTF32_Encoding_Converter: public ACE_UTF16_Encoding_Converter +{ +public: + /// This class has some similarities to the UTF16 converter, so + /// we just construct our base class and pass the swap parameter. + ACE_UTF32_Encoding_Converter (bool swap = false); + + /// This is a do nothing destructor. + virtual ~ACE_UTF32_Encoding_Converter (void); + + /// Convert the source from UTF-32 to UTF-8 and store it in the + /// provided target buffer. + virtual Result to_utf8 (const void* source, + size_t source_size, + ACE_Byte* target, + size_t target_size, + bool strict = true); + + /// Convert the UTF-8 source into a UTF-32 encoding and store it + /// in the provided target buffer. + virtual Result from_utf8 (const ACE_Byte* source, + size_t source_size, + void* target, + size_t target_size, + bool strict = true); + + /// This factory helper method determines if the source stream is UTF-32 + /// encoded. If it is, allocate an ACE_UTF32_Encoding_Converter and + /// return it. The caller then owns the allocated object. + static ACE_UTF32_Encoding_Converter* encoded (const ACE_Byte* source, + size_t source_size); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ + +#include /**/ "ace/post.h" + +#endif /* ACE_UTF32_ENCODING_CONVERTER_H */ diff --git a/externals/ace/UTF8_Encoding_Converter.cpp b/externals/ace/UTF8_Encoding_Converter.cpp new file mode 100644 index 0000000..cd6c409 --- /dev/null +++ b/externals/ace/UTF8_Encoding_Converter.cpp @@ -0,0 +1,92 @@ +// $Id: UTF8_Encoding_Converter.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/UTF8_Encoding_Converter.h" + +#if defined (ACE_USES_WCHAR) +#include "ace/UTF16_Encoding_Converter.h" +#include "ace/UTF32_Encoding_Converter.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_Memory.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_UTF8_Encoding_Converter::ACE_UTF8_Encoding_Converter (void) + : native_ (0) +{ + // Choose a converter for the ASCII or UTF-8 string to a wide character + // string which we will use in from_utf8. We have to make an + // assumption here about the encoding based on the size of ACE_TCHAR. + switch (sizeof (ACE_TCHAR)) + { + case 4: + ACE_NEW(this->native_, ACE_UTF32_Encoding_Converter); + break; + case 2: + ACE_NEW(this->native_, ACE_UTF16_Encoding_Converter); + break; + } +} + +ACE_UTF8_Encoding_Converter::~ACE_UTF8_Encoding_Converter (void) +{ + delete native_; +} + +ACE_UTF8_Encoding_Converter::Result +ACE_UTF8_Encoding_Converter::to_utf8 (const void* source, + size_t source_size, + ACE_Byte* target, + size_t target_size, + bool /*strict*/) +{ + if (target_size >= source_size) + { + ACE_OS::memcpy (target, source, source_size); + return CONVERSION_OK; + } + + return TARGET_EXHAUSTED; +} + +ACE_UTF8_Encoding_Converter::Result +ACE_UTF8_Encoding_Converter::from_utf8 (const ACE_Byte* source, + size_t source_size, + void* target, + size_t target_size, + bool strict) +{ + if (this->native_ != 0) + { + return this->native_->from_utf8(source, source_size, + target, target_size, strict); + } + + ACE_TCHAR* targetStart = static_cast (target); + ACE_OS::strncpy (targetStart, + ACE_TEXT_CHAR_TO_TCHAR ( + reinterpret_cast (source)), + source_size); + targetStart[source_size] = 0; + return CONVERSION_OK; +} + +ACE_UTF8_Encoding_Converter* +ACE_UTF8_Encoding_Converter::encoded (const ACE_Byte* source, + size_t source_size) +{ + for(size_t i = 0; i < source_size; i++) + { + if (source[i] < 0x01 || source[i] > 0x7f) + return 0; + } + + // All characters are "valid" ASCII + ACE_UTF8_Encoding_Converter* converter = 0; + ACE_NEW_RETURN (converter, + ACE_UTF8_Encoding_Converter, + 0); + return converter; +} + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ diff --git a/externals/ace/UTF8_Encoding_Converter.h b/externals/ace/UTF8_Encoding_Converter.h new file mode 100644 index 0000000..2cb6ed4 --- /dev/null +++ b/externals/ace/UTF8_Encoding_Converter.h @@ -0,0 +1,72 @@ +// -*- C++ -*- + +//========================================================================= +/** + * @file UTF8_Encoding_Converter.h + * + * $Id: UTF8_Encoding_Converter.h 80826 2008-03-04 14:51:23Z wotte $ + * + * This class contains declarations for methods that convert between + * UTF-8 and the native ACE_TCHAR representation. + * + * @author Chad Elliott + */ +//========================================================================= + +#ifndef ACE_UTF8_ENCODING_CONVERTER_H +#define ACE_UTF8_ENCODING_CONVERTER_H + +#include /**/ "ace/pre.h" + +#include "ace/Encoding_Converter.h" + +#if defined (ACE_USES_WCHAR) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** Convert from UTF-16 or UTF-32 to UTF-8. + * This class implements the ACE_Encoding_Converter interface. + */ +class ACE_UTF8_Encoding_Converter: public ACE_Encoding_Converter +{ +public: + /// Allocate the converter to be used by the from_utf8() method based + /// on the size of the native wide character. + ACE_UTF8_Encoding_Converter (void); + + /// De-allocate the native converter. + virtual ~ACE_UTF8_Encoding_Converter (void); + + /// Since the source *must be* UTF-8, there is no conversion required. + /// This method just copies the source to the target given that there + /// is enough space. + virtual Result to_utf8 (const void* source, + size_t source_size, + ACE_Byte* target, + size_t target_size, + bool strict = true); + + /// Utilize the native converter to convert the UTF-8 source into an + /// alternate encoding and store it in the provided target buffer. + virtual Result from_utf8 (const ACE_Byte* source, + size_t source_size, + void* target, + size_t target_size, + bool strict = true); + + + /// This factory helper method determines if the source stream is UTF-8 + /// encoded. If it is, allocate an ACE_UTF8_Encoding_Converter and + /// return it. The caller then owns the allocated object. + static ACE_UTF8_Encoding_Converter* encoded (const ACE_Byte* source, + size_t source_size); + +private: + ACE_Encoding_Converter* native_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL +#endif /* ACE_USES_WCHAR */ + +#include /**/ "ace/post.h" + +#endif /* ACE_UTF8_ENCODING_CONVERTER_H */ diff --git a/externals/ace/UUID.cpp b/externals/ace/UUID.cpp new file mode 100644 index 0000000..8004694 --- /dev/null +++ b/externals/ace/UUID.cpp @@ -0,0 +1,506 @@ +//$Id: UUID.cpp 88515 2010-01-13 08:47:38Z johnnyw $ + +#include "ace/UUID.h" +#include "ace/Guard_T.h" + +#if !defined (__ACE_INLINE__) +#include "ace/UUID.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_sys_time.h" +#include "ace/OS_NS_netdb.h" +#include "ace/OS_NS_unistd.h" +#include "ace/ACE.h" + +ACE_RCSID (ace, + UUID, + "$Id: UUID.cpp 88515 2010-01-13 08:47:38Z johnnyw $") + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_Utils +{ + // NIL version of the UUID + const UUID UUID::NIL_UUID; + + UUID::UUID (const ACE_CString& uuid_string) + { + this->init (); + this->from_string_i (uuid_string); + } + + const UUID & + UUID::operator = (const UUID & rhs) + { + if (this != &rhs) + { + // Reset the string version of the UUID a string version + // exist, and the UUID is not equal to the old UUID. + if (0 != this->as_string_.get ()) + { + if (0 == rhs.as_string_.get () || *this != rhs) + this->as_string_.reset (); + } + + // Copy the contents of the UUID. + ACE_OS::memcpy (&this->uuid_, &rhs.uuid_, BINARY_SIZE); + + /// @todo We should create an UUID_Ex class for UUIDs that + /// contain the thread id and process id. + this->thr_id_ = rhs.thr_id_; + this->pid_ = rhs.pid_; + } + + return *this; + } + + const ACE_CString * UUID::to_string (void) const + { + // Compute the string representation only once. + if (0 != this->as_string_.get ()) + return this->as_string_.get (); + + // Get a buffer exactly the correct size. Use the nil UUID as a + // gauge. Don't forget the trailing nul. + ACE_Auto_Array_Ptr auto_clean; + size_t UUID_STRING_LENGTH = 36 + thr_id_.length () + pid_.length (); + char *buf = 0; + + if (36 == UUID_STRING_LENGTH) + { + ACE_NEW_RETURN (buf, + char[UUID_STRING_LENGTH + 1], + 0); + + // Let the auto array pointer manage the buffer. + auto_clean.reset (buf); + + ACE_OS::sprintf (buf, + "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", + this->uuid_.time_low_, + this->uuid_.time_mid_, + this->uuid_.time_hi_and_version_, + this->uuid_.clock_seq_hi_and_reserved_, + this->uuid_.clock_seq_low_, + (this->uuid_.node_.node_ID ()) [0], + (this->uuid_.node_.node_ID ()) [1], + (this->uuid_.node_.node_ID ()) [2], + (this->uuid_.node_.node_ID ()) [3], + (this->uuid_.node_.node_ID ()) [4], + (this->uuid_.node_.node_ID ()) [5]); + } + else + { + UUID_STRING_LENGTH += 2; //for '-' + ACE_NEW_RETURN (buf, + char[UUID_STRING_LENGTH + 1], + 0); + + // Let the auto array pointer manage the buffer. + auto_clean.reset (buf); + + ACE_OS::sprintf (buf, + "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x-%s-%s", + this->uuid_.time_low_, + this->uuid_.time_mid_, + this->uuid_.time_hi_and_version_, + this->uuid_.clock_seq_hi_and_reserved_, + this->uuid_.clock_seq_low_, + (this->uuid_.node_.node_ID ()) [0], + (this->uuid_.node_.node_ID ()) [1], + (this->uuid_.node_.node_ID ()) [2], + (this->uuid_.node_.node_ID ()) [3], + (this->uuid_.node_.node_ID ()) [4], + (this->uuid_.node_.node_ID ()) [5], + thr_id_.c_str (), + pid_.c_str ()); + } + + // Save the string. + ACE_CString * as_string = 0; + + ACE_NEW_RETURN (as_string, + ACE_CString (buf, UUID_STRING_LENGTH), + 0); + + this->as_string_.reset (as_string); + return this->as_string_.get (); + } + + void + UUID::from_string_i (const ACE_CString& uuid_string) + { + if (uuid_string.length () < NIL_UUID.to_string ()->length ()) + { + ACE_ERROR ((LM_ERROR, + "%N ACE_UUID::from_string_i - " + "IllegalArgument (incorrect string length)\n")); + return; + } + + /// Special case for the nil UUID. + if (uuid_string == *NIL_UUID.to_string ()) + { + *this = NIL_UUID; + return; + } + + unsigned int time_low; + unsigned int time_mid; + unsigned int time_hi_and_version; + unsigned int clock_seq_hi_and_reserved; + unsigned int clock_seq_low; + unsigned int node [UUID_Node::NODE_ID_SIZE]; + char thr_pid_buf [BUFSIZ]; + + if (uuid_string.length () == NIL_UUID.to_string ()->length ()) + { + // This might seem quite strange this being in ACE, but it + // seems to be a bit difficult to write a facade for ::sscanf + // because some compilers dont support vsscanf, including + // MSVC. It appears that most platforms support sscanf though + // so we need to use it directly. + const int nScanned = +#if defined (ACE_HAS_TR24731_2005_CRT) + sscanf_s ( +#else + ::sscanf ( +#endif /* ACE_HAS_TR24731_2005_CRT */ + uuid_string.c_str (), + "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x", + &time_low, + &time_mid, + &time_hi_and_version, + &clock_seq_hi_and_reserved, + &clock_seq_low, + &node[0], + &node[1], + &node[2], + &node[3], + &node[4], + &node[5] + ); + + if (nScanned != 11) + { + ACE_DEBUG ((LM_DEBUG, + "UUID::from_string_i - " + "IllegalArgument (invalid string representation)\n")); + return; + } + } + else + { + const int nScanned = +#if defined (ACE_HAS_TR24731_2005_CRT) + sscanf_s (uuid_string.c_str (), + "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x-%s", + &time_low, + &time_mid, + &time_hi_and_version, + &clock_seq_hi_and_reserved, + &clock_seq_low, + &node[0], + &node[1], + &node[2], + &node[3], + &node[4], + &node[5], + thr_pid_buf, + BUFSIZ + ); +#else + ::sscanf (uuid_string.c_str (), + "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x-%s", + &time_low, + &time_mid, + &time_hi_and_version, + &clock_seq_hi_and_reserved, + &clock_seq_low, + &node[0], + &node[1], + &node[2], + &node[3], + &node[4], + &node[5], + thr_pid_buf + ); +#endif /* ACE_HAS_TR24731_2005_CRT */ + + if (nScanned != 12) + { + ACE_DEBUG ((LM_DEBUG, + "ACE_UUID::from_string_i - " + "IllegalArgument (invalid string representation)\n")); + return; + } + } + + this->uuid_.time_low_ = static_cast (time_low); + this->uuid_.time_mid_ = static_cast (time_mid); + this->uuid_.time_hi_and_version_ = static_cast (time_hi_and_version); + this->uuid_.clock_seq_hi_and_reserved_ = static_cast (clock_seq_hi_and_reserved); + this->uuid_.clock_seq_low_ = static_cast (clock_seq_low); + + for (size_t i = 0; i < UUID_Node::NODE_ID_SIZE; ++ i) + this->uuid_.node_.node_ID ()[i] = static_cast (node[i]); + + // Support varient 10- only + if ((this->uuid_.clock_seq_hi_and_reserved_ & 0xc0) != 0x80 && + (this->uuid_.clock_seq_hi_and_reserved_ & 0xc0) != 0xc0) + { + ACE_DEBUG ((LM_DEBUG, + "ACE_UUID::from_string_i - " + "IllegalArgument (unsupported variant)\n")); + return; + } + + /// Support versions 1, 3, and 4 only + ACE_UINT16 V1 = this->uuid_.time_hi_and_version_; + + if ((V1 & 0xF000) != 0x1000 && + (V1 & 0xF000) != 0x3000 && + (V1 & 0xF000) != 0x4000) + { + ACE_DEBUG ((LM_DEBUG, + "ACE_UUID::from_string_i - " + "IllegalArgument (unsupported version)\n")); + return; + } + + if ((this->uuid_.clock_seq_hi_and_reserved_ & 0xc0) == 0xc0) + { + if (uuid_string.length () == NIL_UUID.to_string ()->length ()) + { + ACE_DEBUG ((LM_DEBUG, + "ACE_UUID::from_string_i - " + "IllegalArgument (Missing Thread and Process Id)\n")); + return; + } + ACE_CString thr_pid_str (thr_pid_buf); + ssize_t pos = static_cast (thr_pid_str.find ('-')); + if (pos == -1) + ACE_DEBUG ((LM_DEBUG, + "ACE_UUID::from_string_i - " + "IllegalArgument (Thread and Process Id format incorrect)\n")); + + this->thr_id_ = thr_pid_str.substr (0, pos); + this->pid_ = thr_pid_str.substr (pos+1, thr_pid_str.length ()-pos-1); + } + } + + UUID_Generator::UUID_Generator (void) + : time_last_ (0), + destroy_lock_ (true), + is_init_ (false) + { + ACE_NEW (lock_, ACE_SYNCH_MUTEX); + this->init (); + } + + UUID_Generator::~UUID_Generator (void) + { + if (destroy_lock_) + delete lock_; + } + + void + UUID_Generator::init (void) + { + if (this->is_init_) + return; + + ACE_OS::macaddr_node_t macaddress; + int const result = ACE_OS::getmacaddress (&macaddress); + + UUID_Node::Node_ID node_id; + + if (-1 != result) + { + ACE_OS::memcpy (node_id, + macaddress.node, + UUID_Node::NODE_ID_SIZE); + } + else + { + node_id [0] = static_cast (ACE_OS::rand ()); + node_id [1] = static_cast (ACE_OS::rand ()); + node_id [2] = static_cast (ACE_OS::rand ()); + node_id [3] = static_cast (ACE_OS::rand ()); + node_id [4] = static_cast (ACE_OS::rand ()); + node_id [5] = static_cast (ACE_OS::rand ()); + } + + this->get_timestamp (time_last_); + + { + ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, *lock_); + uuid_state_.timestamp = time_last_; + + ACE_OS::memcpy (uuid_state_.node.node_ID (), + node_id, + UUID_Node::NODE_ID_SIZE); + } + + this->is_init_ = true; + } + + void + UUID_Generator:: + generate_UUID (UUID& uuid, ACE_UINT16 version, u_char variant) + { + UUID_Time timestamp; + ACE_UINT16 clock_sequence; + + this->get_timestamp_and_clocksequence (timestamp, + clock_sequence); + + // Construct a Version 1 UUID with the information in the arguements. + uuid.time_low (static_cast (timestamp & 0xFFFFFFFF)); + uuid.time_mid (static_cast ((timestamp >> 32) & 0xFFFF)); + + ACE_UINT16 tHAV = static_cast ((timestamp >> 48) & 0xFFFF); + tHAV |= (version << 12); + uuid.time_hi_and_version (tHAV); + + u_char cseqHAV; + uuid.clock_seq_low (static_cast (clock_sequence & 0xFF)); + cseqHAV = static_cast ((clock_sequence & 0x3f00) >> 8); + uuid_state_.timestamp = timestamp; + + cseqHAV |= variant; + uuid.clock_seq_hi_and_reserved (cseqHAV); + uuid.node (uuid_state_.node); + + if (variant == 0xc0) + { + ACE_Thread_ID thread_id; + char buf [BUFSIZ]; + thread_id.to_string (buf); + uuid.thr_id (buf); + + ACE_OS::sprintf (buf, + "%d", + static_cast (ACE_OS::getpid ())); + uuid.pid (buf); + } + } + + UUID* + UUID_Generator::generate_UUID (ACE_UINT16 version, u_char variant) + { + UUID* uuid = 0; + ACE_NEW_RETURN (uuid, + UUID, + 0); + + this->generate_UUID (*uuid, version, variant); + return uuid; + } + + /// Obtain a new timestamp. If UUID's are being generated too quickly + /// the clock sequence will be incremented + void + UUID_Generator::get_timestamp (UUID_Time& timestamp) + { + ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); + + this->get_systemtime (timestamp); + + // Account for the clock being set back. Increment the clock / + // sequence. + if (timestamp <= time_last_) + { + uuid_state_.clock_sequence = static_cast + ((uuid_state_.clock_sequence + 1) & ACE_UUID_CLOCK_SEQ_MASK); + } + // If the system time ticked since the last UUID was + // generated. Set / the clock sequence back. + else if (timestamp > time_last_) + { + uuid_state_.clock_sequence = 0; + } + + time_last_ = timestamp; + } + + void + UUID_Generator::get_timestamp_and_clocksequence (UUID_Time& timestamp, + ACE_UINT16& clock_sequence) + { + ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); + + this->get_systemtime (timestamp); + + // Account for the clock being set back. Increment the clock / + // sequence. + if (timestamp <= time_last_) + uuid_state_.clock_sequence = static_cast ((uuid_state_.clock_sequence + 1) & ACE_UUID_CLOCK_SEQ_MASK); + + // If the system time ticked since the last UUID was + // generated. Set / the clock sequence back. + else if (timestamp > time_last_) + uuid_state_.clock_sequence = 0; + + time_last_ = timestamp; + clock_sequence = uuid_state_.clock_sequence; + } + + /** + * ACE_Time_Value is in POSIX time, seconds since Jan 1, 1970. UUIDs use + * time in 100ns ticks since 15 October 1582. The difference is: + * 15 Oct 1582 - 1 Jan 1600: 17 days in Oct, 30 in Nov, 31 in Dec + + * 17 years and 4 leap days (1584, 88, 92 and 96) + * 1 Jan 1600 - 1 Jan 1900: 3 centuries + 73 leap days ( 25 in 17th cent. + * and 24 each in 18th and 19th centuries) + * 1 Jan 1900 - 1 Jan 1970: 70 years + 17 leap days. + * This adds up, in days: (17+30+31+365*17+4)+ (365*300+73)+ (365*70+17) or + * 122192928000000000U (0x1B21DD213814000) 100 ns ticks. + */ + void + UUID_Generator::get_systemtime (UUID_Time & timestamp) + { + const UUID_Time timeOffset = +#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) + ACE_U_LongLong (ACE_INT64_LITERAL (0x1B21DD213814000)); +#elif defined (ACE_LACKS_LONGLONG_T) + ACE_U_LongLong (0x13814000u, 0x1B21DD2u); +#else + ACE_UINT64_LITERAL (0x1B21DD213814000); +#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */ + + /// Get the time of day, convert to 100ns ticks then add the offset. + ACE_Time_Value now = ACE_OS::gettimeofday (); + ACE_UINT64 time; + now.to_usec (time); + time = time * 10; + timestamp = time + timeOffset; + } + + ACE_SYNCH_MUTEX* + UUID_Generator::lock (void) + { + return this->lock_; + } + + void + UUID_Generator::lock (ACE_SYNCH_MUTEX* lock, bool release_lock) + { + if (this->destroy_lock_) + delete this->lock_; + + this->lock_ = lock; + this->destroy_lock_ = release_lock; + } +} + +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) + template ACE_Singleton * + ACE_Singleton ::singleton_; +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/UUID.h b/externals/ace/UUID.h new file mode 100644 index 0000000..ae43c14 --- /dev/null +++ b/externals/ace/UUID.h @@ -0,0 +1,282 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file UUID.h + * + * $Id: UUID.h 88604 2010-01-18 18:01:19Z hillj $ + * + * @author Andrew T. Finnel + * @author Yamuna Krishnmaurthy + */ +//============================================================================= + +#ifndef ACE_UUID_H +#define ACE_UUID_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Auto_Ptr.h" +#include "ace/SString.h" +#include "ace/Singleton.h" +#include "ace/Synch_Traits.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_Utils +{ + /** + * @class UUID_Node + * + * @brief Holds the MAC-address of the UUID. + */ + class ACE_Export UUID_Node + { + public: + /// Size of the node in bytes. + enum {NODE_ID_SIZE = 6}; + + /// Type definition of the node. + typedef u_char Node_ID[NODE_ID_SIZE]; + + /// Get the node id + Node_ID & node_ID (void); + + /** + * @overload + */ + const Node_ID & node_ID (void) const; + + /// Test for equality. + bool operator == (const UUID_Node & right) const; + + /// Test for inequality. + bool operator != (const UUID_Node & right) const; + + private: + /// The value of the node id. + Node_ID node_ID_; + }; + + /** + * @class ACE_UUID + * + * ACE_UUID represents a Universally Unique IDentifier (UUID) as + * described in (the expired) INTERNET-DRAFT specification entitled + * UUIDs and GUIDs. All instances of UUID are of the time-based + * variety. That is, the version number part of the timeHiAndVersion + * field is 1. + * + * The default constructor creates a nil UUID. + * + * UUIDs have value semantics. In addition, they may be compared for + * ordering and equality. + * + * Additionally in this implementation provisions have been made to include + * process and thread ids to make the UUIDs more unique. The variant 0xc0 + * has been added to facilitate this. + */ + class ACE_Export UUID + { + public: + /// The size of a binary UUID. + enum { BINARY_SIZE = 16 }; + + /// Constructor + UUID (void); + + /// Constructs a UUID from a string representation. + UUID (const ACE_CString& uuidString); + + UUID (const UUID &right); + + // Destructor + ~UUID (void); + + ACE_UINT32 time_low (void) const; + void time_low (ACE_UINT32); + + ACE_UINT16 time_mid (void) const; + void time_mid (ACE_UINT16); + + ACE_UINT16 time_hi_and_version (void) const; + void time_hi_and_version (ACE_UINT16); + + u_char clock_seq_hi_and_reserved (void) const; + void clock_seq_hi_and_reserved (u_char); + + u_char clock_seq_low (void) const; + void clock_seq_low (u_char); + + UUID_Node & node (void); + const UUID_Node & node (void) const; + + void node (const UUID_Node & node); + + ACE_CString* thr_id (void); + void thr_id (char*); + + ACE_CString* pid (void); + void pid (char*); + + /// Returns a string representation of the UUID + const ACE_CString* to_string (void) const; + + /// Set the value using a string + void from_string (const ACE_CString& uuid_string); + + /// NIL UUID + static const UUID NIL_UUID; + + /// Equality Operations + bool operator == (const UUID &right) const; + bool operator != (const UUID &right) const; + + /// Compute a hash value for the UUID. + unsigned long hash (void) const; + + /// Assign an existing UUID to this UUID. + const UUID & operator = (const UUID & rhs); + + private: + /// Initialize the UUID + void init (void); + + /** + * Helper method to convert from a string UUID. + * + * @param[in] uuid_string String version of UUID. + */ + void from_string_i (const ACE_CString& uuid_string); + + /// Data Members for Class Attributes + struct data + { + /// Time low. + ACE_UINT32 time_low_; + + /// Time mid. + ACE_UINT16 time_mid_; + + /// Time high and version. + ACE_UINT16 time_hi_and_version_; + + /// Clock sequence high and reserved space. + u_char clock_seq_hi_and_reserved_; + + /// Clock sequence low. + u_char clock_seq_low_; + + /// MAC-address within the UUID. + UUID_Node node_; + } uuid_; + + ACE_CString thr_id_; + ACE_CString pid_; + + /// The string representation of the UUID. This is created and + /// updated only on demand. + mutable ACE_Auto_Ptr as_string_; + }; + + /** + * @class ACE_UUID_Generator + * + * Singleton class that generates UUIDs. + * + */ + class ACE_Export UUID_Generator + { + public: + + enum {ACE_UUID_CLOCK_SEQ_MASK = 0x3FFF}; + + /// Default constructor. + UUID_Generator(void); + + /// Destructor. + ~UUID_Generator(); + + /// Initialize the UUID generator + /// @deprecated This method may go away in some future release. + void init (void); + + /// Format timestamp, clockseq, and nodeID into an UUID of the + /// specified version and variant. For generating UUID's with + /// thread and process ids use variant=0xc0 + void generate_UUID (UUID&, ACE_UINT16 version=0x0001, u_char variant=0x80); + + /// Format timestamp, clockseq, and nodeID into a VI UUID. For + /// generating UUID's with thread and process ids use variant=0xc0 + UUID* generate_UUID (ACE_UINT16 version=0x0001, u_char variant=0x80); + + /// Type to represent UTC as a count of 100 nanosecond intervals + /// since 00:00:00.00, 15 October 1582. + typedef ACE_UINT64 UUID_Time; + + /// The locking strategy prevents multiple generators from accessing + /// the UUID_state at the same time. Get the locking strategy. + ACE_SYNCH_MUTEX* lock (void); + + /// Set a new locking strategy and return the old one. + void lock (ACE_SYNCH_MUTEX* lock, bool release_lock); + + private: + /// The system time when that last uuid was generated. + UUID_Time time_last_; + + /// Type to contain the UUID generator persistent state. This will + /// be kept in memory mapped shared memory + struct UUID_State + { + UUID_Time timestamp; + UUID_Node node; + ACE_UINT16 clock_sequence; + }; + + /// Obtain a UUID timestamp. Compensate for the fact that the time + /// obtained from getSystem time has a resolution less than 100ns. + void get_timestamp (UUID_Time& timestamp); + + /// Obtain a UUID timestamp and clock sequence. Compensate for the + /// fact that the time obtained from getSystem time has a + /// resolution less than 100ns. + void get_timestamp_and_clocksequence (UUID_Time& timestamp, + ACE_UINT16& clockSequence); + + /// Obtain the system time in UTC as a count of 100 nanosecond intervals + /// since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to + /// the Christian calendar). + void get_systemtime( UUID_Time& timeNow); + + /// The UUID generator persistent state. + UUID_State uuid_state_; + + ACE_SYNCH_MUTEX* lock_; + + bool destroy_lock_; + + /// Initalization state of the generator. + bool is_init_; + }; + + typedef ACE_Singleton + UUID_GENERATOR; +} + +ACE_SINGLETON_DECLARE (ACE_Singleton, ACE_Utils::UUID_Generator, ACE_SYNCH_MUTEX) + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/UUID.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif // ACE_UUID_H + diff --git a/externals/ace/UUID.inl b/externals/ace/UUID.inl new file mode 100644 index 0000000..568adfa --- /dev/null +++ b/externals/ace/UUID.inl @@ -0,0 +1,204 @@ +// -*- C++ -*- +// +//$Id: UUID.inl 85331 2009-05-14 00:04:12Z hillj $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_Utils +{ + ACE_INLINE + const UUID_Node::Node_ID & UUID_Node::node_ID (void) const + { + return this->node_ID_; + } + + ACE_INLINE + UUID_Node::Node_ID & UUID_Node::node_ID (void) + { + return this->node_ID_; + } + + ACE_INLINE + UUID::UUID (void) + { + this->init (); + } + + ACE_INLINE + UUID::UUID (const UUID &right) + : thr_id_ (right.thr_id_), + pid_ (right.pid_) + { + ACE_OS::memcpy (&this->uuid_, &right.uuid_, BINARY_SIZE); + } + + ACE_INLINE + UUID::~UUID (void) + { + + } + + ACE_INLINE void + UUID::init (void) + { + ACE_OS::memset (&this->uuid_, 0, BINARY_SIZE); + } + + ACE_INLINE unsigned long + UUID::hash (void) const + { + return ACE::hash_pjw (reinterpret_cast (&this->uuid_), + UUID::BINARY_SIZE); + } + + ACE_INLINE ACE_UINT32 + UUID::time_low (void) const + { + return this->uuid_.time_low_; + } + + ACE_INLINE void + UUID::time_low (ACE_UINT32 timelow) + { + this->uuid_.time_low_ = timelow; + } + + ACE_INLINE ACE_UINT16 + UUID::time_mid (void) const + { + return this->uuid_.time_mid_; + } + + ACE_INLINE void + UUID::time_mid (ACE_UINT16 time_mid) + { + this->uuid_.time_mid_ = time_mid; + } + + ACE_INLINE ACE_UINT16 + UUID::time_hi_and_version (void) const + { + return this->uuid_.time_hi_and_version_; + } + + ACE_INLINE void + UUID::time_hi_and_version (ACE_UINT16 time_hi_and_version) + { + this->uuid_.time_hi_and_version_ = time_hi_and_version; + } + + ACE_INLINE u_char + UUID::clock_seq_hi_and_reserved (void) const + { + return this->uuid_.clock_seq_hi_and_reserved_; + } + + ACE_INLINE void + UUID::clock_seq_hi_and_reserved (u_char clock_seq_hi_and_reserved) + { + this->uuid_.clock_seq_hi_and_reserved_ = clock_seq_hi_and_reserved; + } + + ACE_INLINE u_char + UUID::clock_seq_low (void) const + { + return this->uuid_.clock_seq_low_; + } + + ACE_INLINE void + UUID::clock_seq_low (u_char clock_seq_low) + { + this->uuid_.clock_seq_low_ = clock_seq_low; + } + + ACE_INLINE const UUID_Node & + UUID::node (void) const + { + return this->uuid_.node_; + } + + ACE_INLINE UUID_Node & + UUID::node (void) + { + return this->uuid_.node_; + } + + ACE_INLINE void + UUID::node (const UUID_Node & node) + { + ACE_OS::memcpy (&this->uuid_.node_, + node.node_ID (), + UUID_Node::NODE_ID_SIZE); + } + + ACE_INLINE ACE_CString* + UUID::thr_id (void) + { + return &this->thr_id_; + } + + ACE_INLINE void + UUID::thr_id (char* thr_id) + { + this->thr_id_ = thr_id; + } + + ACE_INLINE ACE_CString* + UUID::pid (void) + { + return &this->pid_; + } + + ACE_INLINE void + UUID::pid (char* pid) + { + this->pid_ = pid; + } + + ACE_INLINE void + UUID::from_string (const ACE_CString& uuidString) + { + this->from_string_i (uuidString); + } + + ACE_INLINE bool + UUID::operator == (const UUID &right) const + { + return 0 == ACE_OS::memcmp (&this->uuid_, &right.uuid_, BINARY_SIZE); + } + + ACE_INLINE bool + UUID::operator != (const UUID &right) const + { + return 0 != ACE_OS::memcmp (&this->uuid_, &right.uuid_, BINARY_SIZE); + } + + ACE_INLINE bool + UUID_Node::operator == (const UUID_Node& rt) const + { + for (size_t i = 0; i < NODE_ID_SIZE; ++i) + if (node_ID_ [i] != rt.node_ID_ [i]) + return false; + + return true; + } + + ACE_INLINE bool + UUID_Node::operator != (const UUID_Node& right) const + { + return !(*this == right); + } + +// ACE_INLINE bool +// UUID_node::operator < (const UUID_node& rt) const +// { +// UUID_node right = rt; +// for (size_t i = 0; i < NODE_ID_SIZE; ++i) +// if (nodeID_ [i] < right.nodeID ()[i]) +// return true; +// +// return false; +// } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Unbounded_Queue.cpp b/externals/ace/Unbounded_Queue.cpp new file mode 100644 index 0000000..2890650 --- /dev/null +++ b/externals/ace/Unbounded_Queue.cpp @@ -0,0 +1,433 @@ +// $Id: Unbounded_Queue.cpp 82723 2008-09-16 09:35:44Z johnnyw $ + +#ifndef ACE_UNBOUNDED_QUEUE_CPP +#define ACE_UNBOUNDED_QUEUE_CPP + +#include "ace/Unbounded_Queue.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Unbounded_Queue.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/Malloc_Base.h" +#include "ace/Log_Msg.h" +#include "ace/os_include/os_errno.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Queue) + +template +ACE_Unbounded_Queue::ACE_Unbounded_Queue (ACE_Allocator *alloc) + : head_ (0), + cur_size_ (0), + allocator_ (alloc) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::ACE_Unbounded_Queue (void)"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), + ACE_Node); + // Make the list circular by pointing it back to itself. + this->head_->next_ = this->head_; +} + +template +ACE_Unbounded_Queue::ACE_Unbounded_Queue (const ACE_Unbounded_Queue &us) + : head_ (0), + cur_size_ (0), + allocator_ (us.allocator_) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::ACE_Unbounded_Queue"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (ACE_Node *) this->allocator_->malloc (sizeof (ACE_Node)), + ACE_Node); + this->head_->next_ = this->head_; + this->copy_nodes (us); +} + +template void +ACE_Unbounded_Queue::operator= (const ACE_Unbounded_Queue &us) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::operator="); + + if (this != &us) + { + this->delete_nodes (); + this->copy_nodes (us); + } +} + +template ACE_Unbounded_Queue_Iterator +ACE_Unbounded_Queue::begin (void) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::begin"); + return ACE_Unbounded_Queue_Iterator (*this); +} + +template ACE_Unbounded_Queue_Iterator +ACE_Unbounded_Queue::end (void) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::end"); + return ACE_Unbounded_Queue_Iterator (*this, 1); +} + +template void +ACE_Unbounded_Queue::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Unbounded_Queue::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_ = %u"), this->head_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); + + T *item = 0; +#if !defined (ACE_NLOGGING) + size_t count = 1; +#endif /* ! ACE_NLOGGING */ + + for (ACE_Unbounded_Queue_Iterator iter (*(ACE_Unbounded_Queue *) this); + iter.next (item) != 0; + iter.advance ()) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("count = %d\n"), count++)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template void +ACE_Unbounded_Queue::copy_nodes (const ACE_Unbounded_Queue &us) +{ + for (ACE_Node *curr = us.head_->next_; + curr != us.head_; + curr = curr->next_) + if (this->enqueue_tail (curr->item_) == -1) + // @@ What's the right thing to do here? + this->delete_nodes (); +} + +template void +ACE_Unbounded_Queue::delete_nodes (void) +{ + for (ACE_Node *curr = this->head_->next_; + // Keep looking until we've hit the dummy node. + curr != this->head_; + ) + { + ACE_Node *temp = curr; + curr = curr->next_; + + ACE_DES_FREE_TEMPLATE (temp, + this->allocator_->free, + ACE_Node, + ); + --this->cur_size_; + // @@ Doesnt make sense to have this check since + // this will always be true. + // ACE_ASSERT (this->cur_size_ >= 0); + } + + // Reset the list to be a circular list with just a dummy node. + this->head_->next_ = this->head_; +} + +template +ACE_Unbounded_Queue::~ACE_Unbounded_Queue (void) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::~ACE_Unbounded_Queue (void)"); + + this->delete_nodes (); + ACE_DES_FREE_TEMPLATE (head_, + this->allocator_->free, + ACE_Node, + ); +} + +template int +ACE_Unbounded_Queue::enqueue_head (const T &new_item) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::enqueue_head"); + + ACE_Node *temp = 0; + + // Create a new node that points to the original head. + ACE_NEW_MALLOC_RETURN (temp, + static_cast *> (this->allocator_->malloc (sizeof (ACE_Node))), + ACE_Node (new_item, this->head_->next_), + -1); + // Link this pointer into the front of the list. Note that the + // "real" head of the queue is next_>, whereas is + // just a pointer to the dummy node. + this->head_->next_ = temp; + + ++this->cur_size_; + return 0; +} + +template int +ACE_Unbounded_Queue::enqueue_tail (const T &new_item) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::enqueue_tail"); + + // Insert into the old dummy node location. Note that this + // isn't actually the "head" item in the queue, it's a dummy node at + // the "tail" of the queue... + this->head_->item_ = new_item; + + ACE_Node *temp = 0; + + // Create a new dummy node. + ACE_NEW_MALLOC_RETURN (temp, + static_cast *> (this->allocator_->malloc (sizeof (ACE_Node))), + ACE_Node (this->head_->next_), + -1); + // Link this dummy pointer into the list. + this->head_->next_ = temp; + + // Point the head to the new dummy node. + this->head_ = temp; + + ++this->cur_size_; + return 0; +} + +template int +ACE_Unbounded_Queue::dequeue_head (T &item) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::dequeue_head"); + + // Check for empty queue. + if (this->is_empty ()) + return -1; + + ACE_Node *temp = this->head_->next_; + + item = temp->item_; + this->head_->next_ = temp->next_; + ACE_DES_FREE_TEMPLATE (temp, + this->allocator_->free, + ACE_Node, + ); + --this->cur_size_; + return 0; +} + +template void +ACE_Unbounded_Queue::reset (void) +{ + ACE_TRACE ("reset"); + + this->delete_nodes (); +} + +template int +ACE_Unbounded_Queue::get (T *&item, size_t slot) const +{ + // ACE_TRACE ("ACE_Unbounded_Queue::get"); + + ACE_Node *curr = this->head_->next_; + + size_t i; + + for (i = 0; i < this->cur_size_; i++) + { + if (i == slot) + break; + + curr = curr->next_; + } + + if (i < this->cur_size_) + { + item = &curr->item_; + return 0; + } + else + return -1; +} + +template int +ACE_Unbounded_Queue::set (const T &item, + size_t slot) +{ + // ACE_TRACE ("ACE_Unbounded_Queue::set"); + + ACE_Node *curr = this->head_->next_; + + size_t i; + + for (i = 0; + i < slot && i < this->cur_size_; + ++i) + curr = curr->next_; + + if (i < this->cur_size_) + { + // We're in range, so everything's cool. + curr->item_ = item; + return 0; + } + else + { + // We need to expand the list. + + // A common case will be increasing the set size by 1. + // Therefore, we'll optimize for this case. + if (i == slot) + { + // Try to expand the size of the set by 1. + if (this->enqueue_tail (item) == -1) + return -1; + else + return 0; + } + else + { + T const dummy = T (); + + // We need to expand the list by multiple (dummy) items. + for (; i < slot; ++i) + { + // This head points to the existing dummy node, which is + // about to be overwritten when we add the new dummy + // node. + curr = this->head_; + + // Try to expand the size of the set by 1, but don't + // store anything in the dummy node (yet). + if (this->enqueue_tail (dummy) == -1) + return -1; + } + + curr->item_ = item; + return 0; + } + } +} + +// **************************************************************** + +template void +ACE_Unbounded_Queue_Const_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unbounded_Queue_Const_Iterator::ACE_Unbounded_Queue_Const_Iterator (const ACE_Unbounded_Queue &q, int end) + : current_ (end == 0 ? q.head_->next_ : q.head_ ), + queue_ (q) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::ACE_Unbounded_Queue_Const_Iterator"); +} + +template int +ACE_Unbounded_Queue_Const_Iterator::advance (void) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::advance"); + this->current_ = this->current_->next_; + return this->current_ != this->queue_.head_; +} + +template int +ACE_Unbounded_Queue_Const_Iterator::first (void) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::first"); + this->current_ = this->queue_.head_->next_; + return this->current_ != this->queue_.head_; +} + +template int +ACE_Unbounded_Queue_Const_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::done"); + + return this->current_ == this->queue_.head_; +} + +template int +ACE_Unbounded_Queue_Const_Iterator::next (T *&item) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Const_Iterator::next"); + if (this->current_ == this->queue_.head_) + return 0; + else + { + item = &this->current_->item_; + return 1; + } +} + +// **************************************************************** + +template void +ACE_Unbounded_Queue_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unbounded_Queue_Iterator::ACE_Unbounded_Queue_Iterator (ACE_Unbounded_Queue &q, int end) + : current_ (end == 0 ? q.head_->next_ : q.head_ ), + queue_ (q) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::ACE_Unbounded_Queue_Iterator"); +} + +template int +ACE_Unbounded_Queue_Iterator::advance (void) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::advance"); + this->current_ = this->current_->next_; + return this->current_ != this->queue_.head_; +} + +template int +ACE_Unbounded_Queue_Iterator::first (void) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::first"); + this->current_ = this->queue_.head_->next_; + return this->current_ != this->queue_.head_; +} + +template int +ACE_Unbounded_Queue_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Unbounded_Queue_Iterator::done"); + + return this->current_ == this->queue_.head_; +} + +template int +ACE_Unbounded_Queue_Iterator::next (T *&item) +{ + // ACE_TRACE ("ACE_Unbounded_Queue_Iterator::next"); + if (this->current_ == this->queue_.head_) + return 0; + else + { + item = &this->current_->item_; + return 1; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_UNBOUNDED_QUEUE_CPP */ diff --git a/externals/ace/Unbounded_Queue.h b/externals/ace/Unbounded_Queue.h new file mode 100644 index 0000000..65be7aa --- /dev/null +++ b/externals/ace/Unbounded_Queue.h @@ -0,0 +1,297 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Unbounded_Queue.h + * + * $Id: Unbounded_Queue.h 84316 2009-02-03 19:46:05Z johnnyw $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_UNBOUNDED_QUEUE_H +#define ACE_UNBOUNDED_QUEUE_H +#include /**/ "ace/pre.h" + +#include "ace/Node.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stddef.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Allocator; + +template +class ACE_Unbounded_Queue; + +/** + * @class ACE_Unbounded_Queue_Iterator + * + * @brief Implement an iterator over an unbounded queue. + */ +template +class ACE_Unbounded_Queue_Iterator +{ +public: + // = Initialization method. + ACE_Unbounded_Queue_Iterator (ACE_Unbounded_Queue &q, int end = 0); + + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the queue. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the set. Returns 0 when all the + /// items in the queue have been seen, else 1. + int advance (void); + + /// Move to the first element in the queue. Returns 0 if the + /// queue is empty, else 1. + int first (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the current node in the iteration. + ACE_Node *current_; + + /// Pointer to the queue we're iterating over. + ACE_Unbounded_Queue &queue_; +}; + +/** + * @class ACE_Unbounded_Queue_Const_Iterator + * + * @brief Implement an iterator over an const unbounded queue. + */ +template +class ACE_Unbounded_Queue_Const_Iterator +{ +public: + // = Initialization method. + ACE_Unbounded_Queue_Const_Iterator (const ACE_Unbounded_Queue &q, int end = 0); + + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the queue. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the set. Returns 0 when all the + /// items in the queue have been seen, else 1. + int advance (void); + + /// Move to the first element in the queue. Returns 0 if the + /// queue is empty, else 1. + int first (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the current node in the iteration. + ACE_Node *current_; + + /// Pointer to the queue we're iterating over. + const ACE_Unbounded_Queue &queue_; +}; + +/** + * @class ACE_Unbounded_Queue + * + * @brief A Queue of "infinite" length. + * + * This implementation of an unbounded queue uses a circular + * linked list with a dummy node. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Circular linked list + * - Duplicates allowed? + * Yes + * - Random access allowed? + * No + * - Search speed + * N/A + * - Insert/replace speed + * N/A + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * Yes + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * + */ +template +class ACE_Unbounded_Queue +{ +public: + friend class ACE_Unbounded_Queue_Iterator; + friend class ACE_Unbounded_Queue_Const_Iterator; + + // Trait definition. + typedef ACE_Unbounded_Queue_Iterator ITERATOR; + typedef ACE_Unbounded_Queue_Const_Iterator CONST_ITERATOR; + + // = Initialization and termination methods. + /// Construction. Use user specified allocation strategy + /// if specified. + /** + * Initialize an empty queue using the strategy provided. + */ + ACE_Unbounded_Queue (ACE_Allocator *alloc = 0); + + /// Copy constructor. + /** + * Initialize the queue to be a copy of the provided queue. + */ + ACE_Unbounded_Queue (const ACE_Unbounded_Queue &); + + /// Assignment operator. + /** + * Perform a deep copy of rhs. + */ + void operator= (const ACE_Unbounded_Queue &); + + /// Destructor. + /** + * Clean up the memory for the queue. + */ + ~ACE_Unbounded_Queue (void); + + // = Check boundary conditions. + + /// Returns true if the container is empty, otherwise returns false. + /** + * Constant time check to see if the queue is empty. + */ + bool is_empty (void) const; + + /// Returns 0. + /** + * The queue cannot be full, so it always returns 0. + */ + bool is_full (void) const; + + // = Classic queue operations. + + /// Adds @a new_item to the tail of the queue. Returns 0 on success, + /// -1 on failure. + /** + * Insert an item at the end of the queue. + */ + int enqueue_tail (const T &new_item); + + /// Adds @a new_item to the head of the queue. Returns 0 on success, + /// -1 on failure. + /** + * Insert an item at the head of the queue. + */ + int enqueue_head (const T &new_item); + + /// Removes and returns the first @a item on the queue. Returns 0 on + /// success, -1 if the queue was empty. + /** + * Remove an item from the head of the queue. + */ + int dequeue_head (T &item); + + // = Additional utility methods. + + /// Reset the ACE_Unbounded_Queue to be empty and release all its + /// dynamically allocated resources. + /** + * Delete the queue nodes. + */ + void reset (void); + + /// Get the @a slot th element in the set. Returns -1 if the element + /// isn't in the range {0..#cur_size_ - 1}, else 0. + /** + * Find the item in the queue between 0 and the provided index of the + * queue. + */ + int get (T *&item, size_t slot = 0) const; + + /// Set the @a slot th element of the queue to @a item. + /** + * Set the @a slot th element in the set. Will pad out the set with + * empty nodes if @a slot is beyond the range {0..#cur_size_ - 1}. + * Returns -1 on failure, 0 if @a slot isn't initially in range, and + * 0 otherwise. + */ + int set (const T &item, size_t slot); + + /// The number of items in the queue. + /** + * Return the size of the queue. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + // = STL-styled unidirectional iterator factory. + ACE_Unbounded_Queue_Iterator begin (void); + ACE_Unbounded_Queue_Iterator end (void); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +protected: + /// Delete all the nodes in the queue. + void delete_nodes (void); + + /// Copy nodes into this queue. + void copy_nodes (const ACE_Unbounded_Queue &); + + /// Pointer to the dummy node in the circular linked Queue. + ACE_Node *head_; + + /// Current size of the queue. + size_t cur_size_; + + /// Allocation Strategy of the queue. + ACE_Allocator *allocator_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Unbounded_Queue.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Unbounded_Queue.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Unbounded_Queue.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_UNBOUNDED_QUEUE_H */ diff --git a/externals/ace/Unbounded_Queue.inl b/externals/ace/Unbounded_Queue.inl new file mode 100644 index 0000000..81e3ded --- /dev/null +++ b/externals/ace/Unbounded_Queue.inl @@ -0,0 +1,27 @@ +// -*- C++ -*- +// +// $Id: Unbounded_Queue.inl 84316 2009-02-03 19:46:05Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE size_t +ACE_Unbounded_Queue::size (void) const +{ + return this->cur_size_; +} + +template ACE_INLINE bool +ACE_Unbounded_Queue::is_empty (void) const +{ + // ACE_TRACE ("ACE_Unbounded_Queue::is_empty"); + return this->head_ == this->head_->next_; +} + +template ACE_INLINE bool +ACE_Unbounded_Queue::is_full (void) const +{ + // ACE_TRACE ("ACE_Unbounded_Queue::is_full"); + return false; // We should implement a "node of last resort for this..." +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Unbounded_Set.cpp b/externals/ace/Unbounded_Set.cpp new file mode 100644 index 0000000..c54e3fc --- /dev/null +++ b/externals/ace/Unbounded_Set.cpp @@ -0,0 +1,18 @@ +// $Id: Unbounded_Set.cpp 81624 2008-05-06 17:14:57Z wotte $ + +#ifndef ACE_UNBOUNDED_SET_CPP +#define ACE_UNBOUNDED_SET_CPP + +#include "ace/Unbounded_Set.h" +#include "ace/Malloc_Base.h" +#include "ace/Log_Msg.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Unbounded_Set.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_UNBOUNDED_SET_CPP */ diff --git a/externals/ace/Unbounded_Set.h b/externals/ace/Unbounded_Set.h new file mode 100644 index 0000000..a75eac1 --- /dev/null +++ b/externals/ace/Unbounded_Set.h @@ -0,0 +1,103 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Unbounded_Set.h + * + * $Id: Unbounded_Set.h 81642 2008-05-07 19:30:35Z shuston $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_UNBOUNDED_SET_H +#define ACE_UNBOUNDED_SET_H +#include /**/ "ace/pre.h" + +#include "ace/Unbounded_Set_Ex.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Allocator; + +/** + * @struct ACE_Unbounded_Set_Default_Comparator + * @brief Simple comparator that evaluates equality using == operator. + */ +template +struct ACE_Unbounded_Set_Default_Comparator +{ + bool operator() (const T&lhs, const T&rhs) const; +}; + +template +class ACE_Unbounded_Set; + +/** + * @class ACE_Unbounded_Set_Iterator + * @brief Compatibility wrapper for ACE_Unbounded_Set_Ex_Iterator. + */ +template +class ACE_Unbounded_Set_Iterator : public + ACE_Unbounded_Set_Ex_Iterator > +{ +public: + typedef ACE_Unbounded_Set_Ex_Iterator > base_type; + + // = Initialization method. + ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set &s, bool end = false); + + ACE_Unbounded_Set_Iterator (const base_type &s); +}; + +/** + * @class ACE_Unbounded_Set_Const_Iterator + * @brief Compatibility wrapper for ACE_Unbounded_Set_Ex_Const_Iterator. + */ +template +class ACE_Unbounded_Set_Const_Iterator : public + ACE_Unbounded_Set_Ex_Const_Iterator > +{ +public: + + typedef ACE_Unbounded_Set_Ex_Const_Iterator > base_type; + + // = Initialization method. + ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set &s, + bool end = false); + + ACE_Unbounded_Set_Const_Iterator (const base_type &s); +}; + +/** + * @class ACE_Unbounded_Set + * @brief Compatibility wrapper for ACE_Unbounded_Set_Ex. + */ +template +class ACE_Unbounded_Set : public + ACE_Unbounded_Set_Ex > +{ +public: + ACE_Unbounded_Set (ACE_Allocator *alloc = 0); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Unbounded_Set.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Unbounded_Set.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Unbounded_Set.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_UNBOUNDED_SET_H */ diff --git a/externals/ace/Unbounded_Set.inl b/externals/ace/Unbounded_Set.inl new file mode 100644 index 0000000..365b025 --- /dev/null +++ b/externals/ace/Unbounded_Set.inl @@ -0,0 +1,49 @@ +// -*- C++ -*- +// +// $Id: Unbounded_Set.inl 81642 2008-05-07 19:30:35Z shuston $ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE bool +ACE_Unbounded_Set_Default_Comparator::operator () (const T &lhs, const T &rhs) const +{ + return lhs == rhs; +} + +template +ACE_Unbounded_Set_Iterator::ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set &s, + bool end) + : base_type (s, end) +{ +} + +template +ACE_Unbounded_Set_Iterator::ACE_Unbounded_Set_Iterator (const base_type & s) + : base_type (s) +{ +} + +template +ACE_Unbounded_Set_Const_Iterator:: +ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set &s, + bool end) + : base_type (s, end) +{ +} + +template +ACE_Unbounded_Set_Const_Iterator::ACE_Unbounded_Set_Const_Iterator (const base_type & s) + : base_type (s) +{ +} + +template +ACE_Unbounded_Set::ACE_Unbounded_Set (ACE_Allocator *alloc) + : ACE_Unbounded_Set_Ex > (alloc) +{ +} + + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Unbounded_Set_Ex.cpp b/externals/ace/Unbounded_Set_Ex.cpp new file mode 100644 index 0000000..c5cd9e2 --- /dev/null +++ b/externals/ace/Unbounded_Set_Ex.cpp @@ -0,0 +1,499 @@ +// $Id: Unbounded_Set_Ex.cpp 81702 2008-05-15 10:18:07Z johnnyw $ + +#ifndef ACE_UNBOUNDED_SET_EX_CPP +#define ACE_UNBOUNDED_SET_EX_CPP + +#include "ace/Unbounded_Set.h" +#include "ace/Malloc_Base.h" +#include "ace/Log_Msg.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Unbounded_Set_Ex.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set_Ex) + +template size_t +ACE_Unbounded_Set_Ex::size (void) const +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::size"); + return this->cur_size_; +} + +template int +ACE_Unbounded_Set_Ex::insert_tail (const T &item) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::insert_tail"); + NODE *temp = 0; + + // Insert into the old dummy node location. + this->head_->item_ = item; + + // Create a new dummy node. + ACE_NEW_MALLOC_RETURN (temp, + static_cast (this->allocator_->malloc (sizeof (NODE))), + NODE (this->head_->next_), + -1); + // Link this pointer into the list. + this->head_->next_ = temp; + + // Point the head to the new dummy node. + this->head_ = temp; + + ++this->cur_size_; + return 0; +} + +template void +ACE_Unbounded_Set_Ex::reset (void) +{ + ACE_TRACE ("reset"); + + this->delete_nodes (); +} + +template void +ACE_Unbounded_Set_Ex::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Unbounded_Set_Ex::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_ = %u"), this->head_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhead_->next_ = %u"), this->head_->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncur_size_ = %d\n"), this->cur_size_)); + + T *item = 0; +#if !defined (ACE_NLOGGING) + size_t count = 1; +#endif /* ! ACE_NLOGGING */ + + const_iterator const the_end = this->end (); + for (const_iterator i (this->begin ()); + i != end; + ++i) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("count = %u\n"), count++)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template void +ACE_Unbounded_Set_Ex::copy_nodes (const ACE_Unbounded_Set_Ex &us) +{ + for (NODE *curr = us.head_->next_; + curr != us.head_; + curr = curr->next_) + this->insert_tail (curr->item_); +} + +template void +ACE_Unbounded_Set_Ex::delete_nodes (void) +{ + NODE *curr = this->head_->next_; + + // Keep looking until we've hit the dummy node. + + while (curr != this->head_) + { + NODE *temp = curr; + curr = curr->next_; + ACE_DES_FREE_TEMPLATE2 (temp, + this->allocator_->free, + ACE_Node, + T, C); + --this->cur_size_; + } + + // Reset the list to be a circular list with just a dummy node. + this->head_->next_ = this->head_; +} + +template +ACE_Unbounded_Set_Ex::~ACE_Unbounded_Set_Ex (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::~ACE_Unbounded_Set_Ex"); + + this->delete_nodes (); + + // Delete the dummy node. + ACE_DES_FREE_TEMPLATE2 (head_, + this->allocator_->free, + ACE_Node, + T, C); + this->head_ = 0; +} + +template +ACE_Unbounded_Set_Ex::ACE_Unbounded_Set_Ex (ACE_Allocator *alloc) + : head_ (0), + cur_size_ (0), + allocator_ (alloc) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::ACE_Unbounded_Set_Ex"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (NODE*) this->allocator_->malloc (sizeof (NODE)), + NODE); + // Make the list circular by pointing it back to itself. + this->head_->next_ = this->head_; +} + +template +ACE_Unbounded_Set_Ex::ACE_Unbounded_Set_Ex (const C &comp, + ACE_Allocator *alloc) + : head_ (0), + cur_size_ (0), + allocator_ (alloc), + comp_ (comp) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::ACE_Unbounded_Set_Ex"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (NODE*) this->allocator_->malloc (sizeof (NODE)), + NODE); + // Make the list circular by pointing it back to itself. + this->head_->next_ = this->head_; +} + +template +ACE_Unbounded_Set_Ex::ACE_Unbounded_Set_Ex (const ACE_Unbounded_Set_Ex &us) + : head_ (0), + cur_size_ (0), + allocator_ (us.allocator_), + comp_ (us.comp_) +{ + ACE_TRACE ("ACE_Unbounded_Set_Ex::ACE_Unbounded_Set_Ex"); + + if (this->allocator_ == 0) + this->allocator_ = ACE_Allocator::instance (); + + ACE_NEW_MALLOC (this->head_, + (NODE*) this->allocator_->malloc (sizeof (NODE)), + NODE); + this->head_->next_ = this->head_; + this->copy_nodes (us); +} + +template ACE_Unbounded_Set_Ex & +ACE_Unbounded_Set_Ex::operator= (const ACE_Unbounded_Set_Ex &us) +{ + ACE_TRACE ("ACE_Unbounded_Set_Ex::operator="); + + if (this != &us) + { + this->delete_nodes (); + this->copy_nodes (us); + } + + return *this; +} + +template int +ACE_Unbounded_Set_Ex::find (const T &item) const +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::find"); + const_iterator const the_end = this->end (); + for (const_iterator i = this->begin (); i != the_end; ++i) + if (this->comp_(*i, item)) + return 0; + + return -1; +} + +template int +ACE_Unbounded_Set_Ex::insert (const T &item) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::insert"); + if (this->find (item) == 0) + return 1; + else + return this->insert_tail (item); +} + +template int +ACE_Unbounded_Set_Ex::remove (const T &item) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::remove"); + + // Insert the item to be founded into the dummy node. + this->head_->item_ = item; + + NODE *curr = this->head_; + + while (!(this->comp_ (curr->next_->item_, item))) + curr = curr->next_; + + if (curr->next_ == this->head_) + return -1; // Item was not found. + else + { + NODE *temp = curr->next_; + // Skip over the node that we're deleting. + curr->next_ = temp->next_; + --this->cur_size_; + ACE_DES_FREE_TEMPLATE2 (temp, + this->allocator_->free, + ACE_Node, + T, C); + return 0; + } +} + +template typename ACE_Unbounded_Set_Ex::iterator +ACE_Unbounded_Set_Ex::begin (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::begin"); + return iterator (*this); +} + +template typename ACE_Unbounded_Set_Ex::iterator +ACE_Unbounded_Set_Ex::end (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::end"); + return iterator (*this, 1); +} + +template typename ACE_Unbounded_Set_Ex::const_iterator +ACE_Unbounded_Set_Ex::begin (void) const +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::begin"); + return const_iterator (*this); +} + +template typename ACE_Unbounded_Set_Ex::const_iterator +ACE_Unbounded_Set_Ex::end (void) const +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex::end"); + return const_iterator (*this, 1); +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set_Ex_Iterator) + +template void +ACE_Unbounded_Set_Ex_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unbounded_Set_Ex_Iterator::ACE_Unbounded_Set_Ex_Iterator ( + ACE_Unbounded_Set_Ex &s, + bool end) + : current_ (!end ? s.head_->next_ : s.head_ ), + set_ (&s) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::ACE_Unbounded_Set_Ex_Iterator"); +} + +template int +ACE_Unbounded_Set_Ex_Iterator::advance (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::advance"); + this->current_ = this->current_->next_; + return this->current_ != this->set_->head_; +} + +template int +ACE_Unbounded_Set_Ex_Iterator::first (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::first"); + this->current_ = this->set_->head_->next_; + return this->current_ != this->set_->head_; +} + +template int +ACE_Unbounded_Set_Ex_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::done"); + + return this->current_ == this->set_->head_; +} + +template int +ACE_Unbounded_Set_Ex_Iterator::next (T *&item) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::next"); + if (this->current_ == this->set_->head_) + return 0; + else + { + item = &this->current_->item_; + return 1; + } +} + +template ACE_Unbounded_Set_Ex_Iterator +ACE_Unbounded_Set_Ex_Iterator::operator++ (int) +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::operator++ (int)"); + ACE_Unbounded_Set_Ex_Iterator retv (*this); + + // postfix operator + + this->advance (); + return retv; +} + +template ACE_Unbounded_Set_Ex_Iterator& +ACE_Unbounded_Set_Ex_Iterator::operator++ (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::operator++ (void)"); + + // prefix operator + + this->advance (); + return *this; +} + +template T& +ACE_Unbounded_Set_Ex_Iterator::operator* (void) +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::operator*"); + T *retv = 0; + + int result = this->next (retv); + ACE_ASSERT (result != 0); + ACE_UNUSED_ARG (result); + + return *retv; +} + +template bool +ACE_Unbounded_Set_Ex_Iterator::operator== (const ACE_Unbounded_Set_Ex_Iterator &rhs) const +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::operator=="); + return (this->set_ == rhs.set_ && this->current_ == rhs.current_); +} + +template bool +ACE_Unbounded_Set_Ex_Iterator::operator!= (const ACE_Unbounded_Set_Ex_Iterator &rhs) const +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Iterator::operator!="); + return (this->set_ != rhs.set_ || this->current_ != rhs.current_); +} + +ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set_Ex_Const_Iterator) + +template void +ACE_Unbounded_Set_Ex_Const_Iterator::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::dump"); +#endif /* ACE_HAS_DUMP */ +} + +template +ACE_Unbounded_Set_Ex_Const_Iterator::ACE_Unbounded_Set_Ex_Const_Iterator ( + const ACE_Unbounded_Set_Ex &s, + bool end) + : current_ (!end ? s.head_->next_ : s.head_ ), + set_ (&s) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::ACE_Unbounded_Set_Ex_Const_Iterator"); +} + +template int +ACE_Unbounded_Set_Ex_Const_Iterator::advance (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::advance"); + this->current_ = this->current_->next_; + return this->current_ != this->set_->head_; +} + +template int +ACE_Unbounded_Set_Ex_Const_Iterator::first (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::first"); + this->current_ = this->set_->head_->next_; + return this->current_ != this->set_->head_; +} + +template int +ACE_Unbounded_Set_Ex_Const_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::done"); + + return this->current_ == this->set_->head_; +} + +template int +ACE_Unbounded_Set_Ex_Const_Iterator::next (T *&item) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::next"); + if (this->current_ == this->set_->head_) + return 0; + else + { + item = &this->current_->item_; + return 1; + } +} + +template ACE_Unbounded_Set_Ex_Const_Iterator +ACE_Unbounded_Set_Ex_Const_Iterator::operator++ (int) +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::operator++ (int)"); + ACE_Unbounded_Set_Ex_Const_Iterator retv (*this); + + // postfix operator + + this->advance (); + return retv; +} + +template ACE_Unbounded_Set_Ex_Const_Iterator& +ACE_Unbounded_Set_Ex_Const_Iterator::operator++ (void) +{ + // ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::operator++ (void)"); + + // prefix operator + + this->advance (); + return *this; +} + +template T& +ACE_Unbounded_Set_Ex_Const_Iterator::operator* (void) +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::operator*"); + T *retv = 0; + + int const result = this->next (retv); + ACE_ASSERT (result != 0); + ACE_UNUSED_ARG (result); + + return *retv; +} + +template bool +ACE_Unbounded_Set_Ex_Const_Iterator::operator== (const ACE_Unbounded_Set_Ex_Const_Iterator &rhs) const +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::operator=="); + return (this->set_ == rhs.set_ && this->current_ == rhs.current_); +} + +template bool +ACE_Unbounded_Set_Ex_Const_Iterator::operator!= (const ACE_Unbounded_Set_Ex_Const_Iterator &rhs) const +{ + //ACE_TRACE ("ACE_Unbounded_Set_Ex_Const_Iterator::operator!="); + return (this->set_ != rhs.set_ || this->current_ != rhs.current_); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_UNBOUNDED_SET_EX_CPP */ diff --git a/externals/ace/Unbounded_Set_Ex.h b/externals/ace/Unbounded_Set_Ex.h new file mode 100644 index 0000000..3d290a6 --- /dev/null +++ b/externals/ace/Unbounded_Set_Ex.h @@ -0,0 +1,376 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Unbounded_Set_Ex.h + * + * $Id: Unbounded_Set_Ex.h 88978 2010-02-13 16:03:31Z hillj $ + * + * @author Douglas C. Schmidt + */ +//============================================================================= + +#ifndef ACE_UNBOUNDED_SET_EX_H +#define ACE_UNBOUNDED_SET_EX_H +#include /**/ "ace/pre.h" + +#include "ace/Node.h" +#include "ace/os_include/os_stddef.h" +#include + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Allocator; + +template +class ACE_Unbounded_Set_Ex_Iterator; + +template +class ACE_Unbounded_Set_Ex_Const_Iterator; + +template +class ACE_Unbounded_Set_Ex; + +/** + * @class ACE_Unbounded_Set_Ex_Iterator + * + * @brief Implement an iterator over an unbounded set. + */ +template +class ACE_Unbounded_Set_Ex_Iterator +{ +public: + /// Type definition of the container type. + typedef ACE_Unbounded_Set_Ex container_type; + + // = std::iterator_traits typedefs/traits. + typedef std::forward_iterator_tag iterator_category; + typedef typename container_type::value_type value_type; + typedef typename container_type::reference reference; + typedef typename container_type::pointer pointer; + typedef typename container_type::difference_type difference_type; + + // = Initialization method. + ACE_Unbounded_Set_Ex_Iterator (ACE_Unbounded_Set_Ex &s, bool end = false); + + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the Set. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the set. Returns 0 when all the + /// items in the set have been seen, else 1. + int advance (void); + + /// Move to the first element in the set. Returns 0 if the + /// set is empty, else 1. + int first (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + // = STL styled iteration, compare, and reference functions. + + /// Postfix advance. + ACE_Unbounded_Set_Ex_Iterator operator++ (int); + + /// Prefix advance. + ACE_Unbounded_Set_Ex_Iterator& operator++ (void); + + /// Returns a reference to the internal element @c this is pointing to. + T& operator* (void); + + /// Check if two iterators point to the same position + bool operator== (const ACE_Unbounded_Set_Ex_Iterator &) const; + bool operator!= (const ACE_Unbounded_Set_Ex_Iterator &) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + /// Pointer to the current node in the iteration. + ACE_Node *current_; + + /// Pointer to the set we're iterating over. + ACE_Unbounded_Set_Ex *set_; +}; + +/** + * @class ACE_Unbounded_Set_Ex_Const_Iterator + * + * @brief Implement an const iterator over an unbounded set. + */ +template +class ACE_Unbounded_Set_Ex_Const_Iterator +{ +public: + typedef ACE_Unbounded_Set_Ex container_type; + + // = std::iterator_traits typedefs/traits. + typedef std::forward_iterator_tag iterator_category; + typedef typename container_type::const_value_type value_type; + typedef typename container_type::const_reference reference; + typedef typename container_type::const_pointer pointer; + typedef typename container_type::difference_type difference_type; + + // = Initialization method. + ACE_Unbounded_Set_Ex_Const_Iterator (const ACE_Unbounded_Set_Ex &s, + bool end = false); + + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the Set. + /// @return Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the set. Returns 0 when all the + /// items in the set have been seen, else 1. + int advance (void); + + /// Move to the first element in the set. Returns 0 if the + /// set is empty, else 1. + int first (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + // = STL styled iteration, compare, and reference functions. + + /// Postfix advance. + ACE_Unbounded_Set_Ex_Const_Iterator operator++ (int); + + /// Prefix advance. + ACE_Unbounded_Set_Ex_Const_Iterator& operator++ (void); + + /// Returns a reference to the internal element @c this is pointing to. + T& operator* (void); + + /// Check if two iterators point to the same position + bool operator== (const ACE_Unbounded_Set_Ex_Const_Iterator &) const; + bool operator!= (const ACE_Unbounded_Set_Ex_Const_Iterator &) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + + /// Pointer to the current node in the iteration. + ACE_Node *current_; + + /// Pointer to the set we're iterating over. + const ACE_Unbounded_Set_Ex *set_; +}; + +/** + * @class ACE_Unbounded_Set_Ex + * + * @brief Implement a simple unordered set of of unbounded size. + * + * This implementation of an unordered set uses a circular + * linked list with a dummy node. This implementation does not + * allow duplicates, but it maintains FIFO ordering of insertions. + * + * This implementation may also be parameterized with a comparator + * functor, which must implement bool operator () (const T&, const T&) const, + * returning true if the given items are equivalent. The default comparator + * is sufficient for objects reliably compared with operator==. + * + * Requirements and Performance Characteristics + * - Internal Structure + * Circular linked list + * - Duplicates allowed? + * No + * - Random access allowed? + * No + * - Search speed + * Linear + * - Insert/replace speed + * Linear + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * Yes + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + * -# operator== const + * + */ +template +class ACE_Unbounded_Set_Ex +{ +public: + friend class ACE_Unbounded_Set_Ex_Iterator; + friend class ACE_Unbounded_Set_Ex_Const_Iterator; + + // Trait definition. + typedef ACE_Unbounded_Set_Ex_Iterator ITERATOR; + typedef ACE_Unbounded_Set_Ex_Iterator iterator; + typedef ACE_Unbounded_Set_Ex_Const_Iterator CONST_ITERATOR; + typedef ACE_Unbounded_Set_Ex_Const_Iterator const_iterator; + typedef C COMP; + typedef ACE_Node NODE; + + // = STL typedefs/traits. + typedef T value_type; + typedef T const const_value_type; + typedef value_type & reference; + typedef const_value_type & const_reference; + typedef value_type * pointer; + typedef const_value_type * const_pointer; + typedef ptrdiff_t difference_type; + + // = Initialization and termination methods. + /// Constructor. Use user specified allocation strategy + /// if specified. + /** + * Initialize an empty set using the allocation strategy of the user if + * provided. + */ + ACE_Unbounded_Set_Ex (ACE_Allocator *alloc = 0); + + /** + * Initialize an empty set using the allocation strategy of the user if + * provided, and a given comparator functor. + */ + ACE_Unbounded_Set_Ex (const C &comparator, ACE_Allocator *alloc = 0); + + /// Copy constructor. + /** + * Initialize this set to be an exact copy of the set provided. + */ + ACE_Unbounded_Set_Ex (const ACE_Unbounded_Set_Ex &); + + /// Assignment operator. + /** + * Perform a deep copy of the rhs into the lhs. + */ + ACE_Unbounded_Set_Ex & operator= (const ACE_Unbounded_Set_Ex &); + + /// Destructor. + /** + * Destroy the nodes of the set. + */ + ~ACE_Unbounded_Set_Ex (void); + + // = Check boundary conditions. + + /// Returns @c true if the container is empty, otherwise returns @c false. + /** + * Constant time is_empty check. + */ + bool is_empty (void) const; + + /// Returns @c false. + /** + * Always returns @c false since the set can never fill up. + */ + bool is_full (void) const; + + // = Classic unordered set operations. + + /// Linear insertion of an item. + /** + * Insert @a new_item into the set (doesn't allow duplicates). + * Returns -1 if failures occur, 1 if item is already present, else + * 0. + */ + int insert (const T &new_item); + + /// Insert @a item at the tail of the set (doesn't check for + /// duplicates). + /** + * Constant time insert at the end of the set. + */ + int insert_tail (const T &item); + + /// Linear remove operation. + /** + * Remove first occurrence of @a item from the set. Returns 0 if + * it removes the item, -1 if it can't find the item, and -1 if a + * failure occurs. + */ + int remove (const T &item); + + /// Finds if @a item occurs in the set. Returns 0 if find succeeds, + /// else -1. + /** + * Performs a linear find operation. + */ + int find (const T &item) const; + + /// Size of the set. + /** + * Access the size of the set. + */ + size_t size (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Reset the ACE_Unbounded_Set_Ex to be empty. + /** + * Delete the nodes of the set. + */ + void reset (void); + + // = STL-styled unidirectional iterator factory. + iterator begin (void); + iterator end (void); + const_iterator begin (void) const; + const_iterator end (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Delete all the nodes in the Set. + void delete_nodes (void); + + /// Copy nodes into this set. + void copy_nodes (const ACE_Unbounded_Set_Ex &); + + /// Head of the linked list of Nodes. + NODE *head_; + + /// Current size of the set. + size_t cur_size_; + + /// Allocation strategy of the set. + ACE_Allocator *allocator_; + + /// Comparator to be used + COMP comp_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Unbounded_Set_Ex.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Unbounded_Set_Ex.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Unbounded_Set_Ex.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_UNBOUNDED_SET_H */ diff --git a/externals/ace/Unbounded_Set_Ex.inl b/externals/ace/Unbounded_Set_Ex.inl new file mode 100644 index 0000000..356a1f5 --- /dev/null +++ b/externals/ace/Unbounded_Set_Ex.inl @@ -0,0 +1,23 @@ +// -*- C++ -*- +// +// $Id: Unbounded_Set_Ex.inl 81624 2008-05-06 17:14:57Z wotte $ + +#include "ace/Global_Macros.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE bool +ACE_Unbounded_Set_Ex::is_empty (void) const +{ + ACE_TRACE ("ACE_Unbounded_Set_Ex::is_empty"); + return this->head_ == this->head_->next_; +} + +template ACE_INLINE bool +ACE_Unbounded_Set_Ex::is_full (void) const +{ + ACE_TRACE ("ACE_Unbounded_Set_Ex::is_full"); + return 0; // We should implement a "node of last resort for this..." +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/Value_Ptr.h b/externals/ace/Value_Ptr.h new file mode 100644 index 0000000..c9272a9 --- /dev/null +++ b/externals/ace/Value_Ptr.h @@ -0,0 +1,167 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Value_Ptr.h + * + * $Id: Value_Ptr.h 80826 2008-03-04 14:51:23Z wotte $ + * + * Value_Ptr implementation based on code in Herb Sutter's book "More + * Exceptional C++". + * + * @author Ossama Othman + */ +//========================================================================== + +#ifndef ACE_VALUE_PTR_H +#define ACE_VALUE_PTR_H + +#include "ace/config-lite.h" + +#include + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + /** + * @struct VP_traits + * + * @brief @c Value_Ptr traits template structure. + * + * The @c Value_Ptr template class delegates some operations to this + * template traits structure. + * + * Specialize this trait template if cloning through copy + * construction is not sufficient. For example, to avoid slicing + * when copying an object through a base class pointer, one can + * implement a virtual "clone" method that can be used to + * polymorphically invoke the appropriate cloning operation(s). + * That virtual method would then be invoked by the @c VP_traits\<\> + * specialization. + */ + template + struct VP_traits + { + /// Copy the given object. + static T * clone (T const * p) { return new T (*p); } + }; + + /** + * @class Value_Ptr + * + * @brief Smart pointer implementation designed for use as a class + * member. + * + * Using a @c std::auto_ptr\<\> as a class member is sometimes + * problematic since ownership of memory is transferred when copying + * such members. This @c Value_Ptr class is explicitly designed to + * avoid such problems by performing copies of the underlying object + * rather than transfer ownership. This, for example, allows it to + * be readily used as a member in classes placed inside STL + * containers. + * + * @see Item 31 in "More Exceptional C++" by Herb Sutter. + */ + template + class Value_Ptr + { + public: + + /// Constructor. + explicit Value_Ptr (T * p = 0) : p_ (p) { } + + /// Destructor. + ~Value_Ptr (void) { delete this->p_; } + + /// Deference operator. + T & operator* (void) const { return *this->p_; } + + /// Pointer operator. + T * operator-> (void) const { return this->p_; } + + /// Non-throwing swap operation used to make assignment strongly + /// exception-safe. + /** + * @note As implemented, the swap operation may not work correctly + * for @c auto_ptr\<\>s, but why would one use an @c + * auto_ptr\<\> as the template argument for this particular + * template class!? + */ + void swap (Value_Ptr & other) { std::swap (this->p_, other.p_); } + + /// Copy constructor. + Value_Ptr (Value_Ptr const & other) + : p_ (create_from (other.p_)) { } + + /// Assignment operator. + Value_Ptr & operator= (Value_Ptr const & other) + { + // Strongly exception-safe. + Value_Ptr temp (other); + this->swap (temp); + return *this; + } + +#ifndef ACE_LACKS_MEMBER_TEMPLATES + + // Compiler can't handle member templates so we lose converting + // copy operations. + + /// Converting copy constructor. + template + Value_Ptr (Value_Ptr const & other) + : p_ (create_from (other.p_)) { } + + /// Converting assignment operator. + template + Value_Ptr & operator= (Value_Ptr const & other) + { + // Strongly exception-safe. + Value_Ptr temp (other); + this->swap (temp); + return *this; + } + +#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ + + private: + +#ifndef ACE_LACKS_MEMBER_TEMPLATES + + /// Copying method invoked when copy constructing. + template + T * create_from (U const * p) const + { + return p ? VP_traits::clone (p) : 0; + } + +#else + + // Compiler can't handle member templates so we lose converting + // copy operations. + + /// Copying method invoked when copy constructing. + T * create_from (T const * p) const + { + return p ? VP_traits::clone (p) : 0; + } + +#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ + + private: + +#ifndef ACE_LACKS_MEMBER_TEMPLATES + template friend class Value_Ptr; +#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ + + /// Object owned by this @c Value_Ptr. + T * p_; + + }; + +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_VALUE_PTR_H */ diff --git a/externals/ace/Vector_T.cpp b/externals/ace/Vector_T.cpp new file mode 100644 index 0000000..006e6db --- /dev/null +++ b/externals/ace/Vector_T.cpp @@ -0,0 +1,154 @@ +// $Id: Vector_T.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#ifndef ACE_VECTOR_T_CPP +#define ACE_VECTOR_T_CPP + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Vector_T.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Vector_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Vector) + +template +void ACE_Vector::resize (const size_t new_size, + const T& t) +{ + ACE_Array::size (new_size); + if (new_size > length_) + for (size_t i = length_; i < new_size; ++i) + (*this)[i]=t; + + curr_max_size_ = this->max_size (); + length_ = new_size; +} + +template +void ACE_Vector::push_back (const T& elem) +{ + if (length_ == curr_max_size_) + { + ACE_Array::size (curr_max_size_ * 2); + curr_max_size_ = this->max_size (); + } + else + ACE_Array::size (length_ + 1); + + ++length_; + (*this)[length_-1] = elem; +} + +template +void ACE_Vector::dump (void) const +{ +#if defined (ACE_HAS_DUMP) +#if 0 + // Can't do this unless the vector is an object with a dump + // function. + for (size_t i = 0; i < this->size (); ++i) + (*this)[i].dump (); +#endif /* 0 */ +#endif /* ACE_HAS_DUMP */ +} + +// Compare this vector with for equality. +template bool +ACE_Vector::operator== (const ACE_Vector &s) const +{ + if (this == &s) + return true; + else if (this->size () != s.size ()) + return false; + + const size_t len = s.size (); + for (size_t slot = 0; slot < len; ++slot) + if ((*this)[slot] != s[slot]) + return false; + + return true; +} + +#if 0 +template +int compare(const ACE_Vector& v1, + const ACE_Vector& v2, + const size_t from_ndx, + const size_t to_ndx) +{ + size_t last1 = v1.size () - 1; + size_t last2 = v2.size () - 1; + if (last1 < from_ndx || last1 < to_ndx) + return false; + if (last2 < from_ndx || last2 < to_ndx) + return false; + if (last1 != last2) + return false; + + // cout<<"compare() <================="<"< +int partial_compare(const ACE_Vector& v1, + const ACE_Vector& v2, + const size_t from_ndx, + const size_t to_ndx) +{ + size_t last1 = v1.size () - 1; + size_t last2 = v2.size () - 1; + + if (last1 < from_ndx || last1 < to_ndx) + return false; + if (last2 < from_ndx || last2 < to_ndx) + return false; + + // cout<<"partial_compare() <================="<"< int +ACE_Vector_Iterator::next (T *&item) +{ + // ACE_TRACE ("ACE_Vector_Iterator::next"); + + if (this->done ()) + { + item = 0; + return 0; + } + else + { + item = &vector_[current_]; + return 1; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_VECTOR_T_CPP */ diff --git a/externals/ace/Vector_T.h b/externals/ace/Vector_T.h new file mode 100644 index 0000000..3d49f43 --- /dev/null +++ b/externals/ace/Vector_T.h @@ -0,0 +1,316 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Vector_T.h + * + * $Id: Vector_T.h 84477 2009-02-16 13:30:38Z johnnyw $ + * + * @author Craig L. Ching + * @author Gonzalo Diethelm + */ +//========================================================================== + +#ifndef ACE_VECTOR_T_H +#define ACE_VECTOR_T_H + +#include /**/ "ace/pre.h" + +#include "ace/Array.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/* + * Default size for an ACE_Vector. + */ +static const size_t ACE_VECTOR_DEFAULT_SIZE = 32; + +// Forward declaration. +template class ACE_Vector_Iterator; + +/** + * @class ACE_Vector + * + * @brief Defines an STL-like vector container. + * + * This is an STL-like template vector container, a wrapper around + * ACE_Array. It provides at least the basic std::vector look and + * feel: push_back(), clear(), resize(), capacity(). This template + * class uses the copy semantic paradigm, though it is okay to use + * reference counted smart pointers (see ACE_Ptr<T>) with this + * template class. + * + * Requirements and Performance Characteristics + * - Internal Structure + * ACE_Array + * - Duplicates allowed? + * Yes + * - Random access allowed? + * No + * - Search speed + * N/A + * - Insert/replace speed + * Linear + * - Iterator still valid after change to container? + * Yes + * - Frees memory for removed elements? + * No + * - Items inserted by + * Value + * - Requirements for contained type + * -# Default constructor + * -# Copy constructor + * -# operator= + */ +template +class ACE_Vector : public ACE_Array +{ +public: + /** + * A short name for iterator for ACE_Vector. + */ + typedef ACE_Vector_Iterator Iterator; + + + /** + * General constructor. + * + * @param init_size Initial size of the vector with the default + * value of DEFAULT_SIZE + * @param alloc Pointer to an ACE allocator. If it is NULL then the + * default ACE allocator is used + */ + ACE_Vector (const size_t init_size = DEFAULT_SIZE, + ACE_Allocator* alloc = 0); + + /** + * Destructor. + */ + ~ACE_Vector (); + + /** + * Returns the current vector capacity, that is, the currently + * allocated buffer size. + * + * @return Current buffer size of the vector + */ + size_t capacity (void) const; + + /** + * Returns the vector's dynamic size / actual current size of the + * vector. Do not confuse it with ACE_Array::size(), which returns + * the array's capacity. Unfortunately, ACE is not very consistent + * with the function names. + * + * @return Dynamic size / actual current size of the vector. + */ + size_t size (void) const; + + /** + * Clears out the vector. It does not reallocate the vector's + * buffer, it is just sets the vector's dynamic size to 0. + */ + void clear (void); + + /** + * Resizes the vector to the new capacity. If the vector's current + * capacity is smaller than the size to be specified, then the + * buffer gets reallocated. If the new capacity is less than the + * current capacity of the vector, the buffer size stays the same. + * + * @param new_size New capacity of the vector + * @param t A filler value (of the class T) for initializing the + * elements of the vector with. By default, if this + * parameter is not specified, the default value of the + * class T will be used (for more detail, see the + * initialization clause for this parameter). + */ + void resize (const size_t new_size, + const T& t); + + /** + * Appends a new element to the vector ("push back"). If the + * dynamic size of the vector is equal to the capacity of the vector + * (vector is at capacity), the vector automatically doubles its + * capacity. + * + * @param elem A reference to the new element to be appended. By + * default, this parameters gets initialized with the + * default value of the class T. + */ + void push_back (const T& elem); + + /** + * Deletes the last element from the vector ("pop back"). What this + * function really does is decrement the dynamic size of the + * vector. The vector's buffer does not get reallocated for + * performance. + */ + void pop_back (void); + + /** + * This function dumps the content of the vector. TO BE MOVED out + * of this class. It needs to be implemented as a global template + * function that accepts a const ACE_Vector<T>, in order to + * make instances of this class compile on Linux, AIX. G++ and xlC + * have template instantiation algoriths, which are different from + * the one in Visual C++. The algorithms try to instantiate ALL + * methods declared in the template class, regardless of whether the + * functions are used or not. That is, all of the classes, that are + * used as elements in ACE_Vector's, have to have the dump() methods + * defined in them (seems to be overkill). + * + * This function calls T::dump() for each element of the vector. + */ + void dump (void) const; + + // = Compare operators + + /// Equality comparison operator. + /** + * Compare this vector with @arg s for equality. Two vectors are equal + * if their sizes are equal and all the elements are equal. + */ + bool operator== (const ACE_Vector &s) const; + + /// Inequality comparison operator. + /** + * Compare this vector with @arg s for inequality such that @c *this != + * @arg s is always the complement of the boolean return value of + * @c *this == @arg s. + */ + bool operator!= (const ACE_Vector &s) const; + + void swap (ACE_Vector &rhs); + +protected: + + /** + * Dynamic size (length) of the vector. + */ + size_t length_; + + /** + * Current capacity (buffer size) of the vector. + */ + size_t curr_max_size_; + + friend class ACE_Vector_Iterator; +}; + +#if 0 +/* + * Not sure about including these functions, if for no other reason, + * because they polute the global namespace! + */ + +/** + * Compare two vectors in the range of [from_ndx..to_ndx]. This + * template function requires class T to have the bool operator!=() + * declared in the class. It is safe to define vectors of scalar data + * types, like int, double, etc., including class ACE_TString. + * + * @param v1 The first vector (out of the two) to be compared. + * @param v2 The Second vector (out of the two) to be compared. + * @param from_ndx Compare vector v1 and v2, starting with the + * "from_ndx" index . + * @param to_ndx Compare vector v1 and v2, from "from_ndx" to + * "to_ndx". + * @return Returns true if v1==v2 in the specified index range, + * returns false otherwise. Also, returns false in case if + * v1's size is not equal to v2's size. + */ +template +int compare (const ACE_Vector& v1, + const ACE_Vector& v2, + const size_t from_ndx, + const size_t to_ndx); + +/** + * Does a partial comparison of two vectors in the range of + * [from_ndx..to_ndx]. The only difference between this function and + * the template compare<T> function is that this function does + * not require v1 and v2 to be of equal size. + * + * @param v1 The first vector (out of the two) to be compared. + * @param v2 The Second vector (out of the two) to be compared. + * @param from_ndx Compare vector v1 and v2, starting with the + * "from_ndx" index . + * @param to_ndx Compare vector v1 and v2, from "from_ndx" to + * "to_ndx". + * @return Returns true if vector v1 and v2 are equal in the specified + * index range. + */ + +template +int partial_compare (const ACE_Vector& v1, + const ACE_Vector& v2, + const size_t from_ndx, + const size_t to_ndx); +#endif /* 0 */ +// **************************************************************** + +/** + * @class ACE_Vector_Iterator + * + * @brief Implement an iterator over an ACE_Vector. + * + * This iterator is safe in the face of vector element deletions. + * But it is NOT safe if the vector is resized via the assignment + * operator during iteration. That would be very odd, and dangerous. + */ +template +class ACE_Vector_Iterator +{ +public: + // = Initialization method. + ACE_Vector_Iterator (ACE_Vector &); + + // = Iteration methods. + + /// Pass back the @a next_item that hasn't been seen in the vector. + /// Returns 0 when all items have been seen, else 1. + int next (T *&next_item); + + /// Move forward by one element in the vector. Returns 0 when all the + /// items in the vector have been seen, else 1. + int advance (void); + + /// Returns 1 when all items have been seen, else 0. + int done (void) const; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + +private: + /// Pointer to the current item in the iteration. + size_t current_; + + /// Reference to the vector we're iterating over. + ACE_Vector &vector_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Vector_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Vector_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Vector_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" + +#endif /* ACE_VECTOR_T_H */ diff --git a/externals/ace/Vector_T.inl b/externals/ace/Vector_T.inl new file mode 100644 index 0000000..4b77310 --- /dev/null +++ b/externals/ace/Vector_T.inl @@ -0,0 +1,107 @@ +// -*- C++ -*- +// +// $Id: Vector_T.inl 81478 2008-04-28 13:22:26Z schmidt $ + +#include + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template ACE_INLINE +ACE_Vector::ACE_Vector (const size_t init_size, + ACE_Allocator* alloc) + : ACE_Array (init_size == 0 ? DEFAULT_SIZE : init_size, alloc), + length_ (0) +{ + this->curr_max_size_ = this->max_size (); +} + +template ACE_INLINE +ACE_Vector::~ACE_Vector () +{ +} + +template ACE_INLINE +size_t ACE_Vector::capacity (void) const +{ + return curr_max_size_; +} + +template ACE_INLINE +size_t ACE_Vector::size (void) const +{ + return length_; +} + +template ACE_INLINE +void ACE_Vector::clear (void) +{ + length_ = 0; +} + +template ACE_INLINE +void ACE_Vector::pop_back (void) +{ + if (length_ > 0) + { + --length_; + ACE_Array::size (length_); + } +} + +// Compare this vector with for inequality. + +template ACE_INLINE bool +ACE_Vector::operator!= (const ACE_Vector &s) const +{ + return !(*this == s); +} + +template ACE_INLINE void +ACE_Vector::swap (ACE_Vector &rhs) +{ + ACE_Array::swap (rhs); + std::swap (this->length_, rhs.length_); + std::swap (this->curr_max_size_, rhs.curr_max_size_); +} + +// **************************************************************** + +template ACE_INLINE void +ACE_Vector_Iterator::dump (void) const +{ + // ACE_TRACE ("ACE_Vector_Iterator::dump"); +} + +template ACE_INLINE +ACE_Vector_Iterator::ACE_Vector_Iterator (ACE_Vector &v) + : current_ (0), + vector_ (v) +{ + // ACE_TRACE ("ACE_Vector_Iterator::ACE_Vector_Iterator"); +} + +template ACE_INLINE int +ACE_Vector_Iterator::advance (void) +{ + // ACE_TRACE ("ACE_Vector_Iterator::advance"); + + if (this->current_ < vector_.size ()) + { + ++this->current_; + return 1; + } + else + // Already finished iterating. + return 0; +} + +template ACE_INLINE int +ACE_Vector_Iterator::done (void) const +{ + ACE_TRACE ("ACE_Vector_Iterator::done"); + + return this->current_ >= vector_.size (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/externals/ace/Version.h b/externals/ace/Version.h new file mode 100644 index 0000000..cf8dc89 --- /dev/null +++ b/externals/ace/Version.h @@ -0,0 +1,9 @@ + +// -*- C++ -*- +// $Id: Version.h 90351 2010-05-31 07:06:15Z johnnyw $ +// This is file was automatically generated by \$ACE_ROOT/bin/make_release. + +#define ACE_MAJOR_VERSION 5 +#define ACE_MINOR_VERSION 7 +#define ACE_BETA_VERSION 9 +#define ACE_VERSION "5.7.9" diff --git a/externals/ace/Versioned_Namespace.h b/externals/ace/Versioned_Namespace.h new file mode 100644 index 0000000..5422548 --- /dev/null +++ b/externals/ace/Versioned_Namespace.h @@ -0,0 +1,51 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Versioned_Namespace.h + * + * $Id$ + * + * Versioned namespace support. + * + * Useful for preventing conflicts when using a third party library. + * + * @author Ossama Othman + */ +//============================================================================= + +#ifndef ACE_VERSIONED_NAMESPACE_H +#define ACE_VERSIONED_NAMESPACE_H + +#ifndef ACE_CONFIG_MACROS_H +# error This header is only meant to be included by or after "ace/config-lite.h". +#endif /* !ACE_CONFIG_LITE_H */ + + +#if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1 + +# ifndef ACE_VERSIONED_NAMESPACE_NAME +//# include "ace/Version.h" + +// Preprocessor symbols will not be expanded if they are +// concatenated. Force the preprocessor to expand them during the +// argument prescan by calling a macro that itself calls another that +// performs the actual concatenation. +# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA) ACE_ ## MAJOR ## _ ## MINOR ## _ ## BETA +# define ACE_MAKE_VERSIONED_NAMESPACE_NAME(MAJOR,MINOR,BETA) ACE_MAKE_VERSIONED_NAMESPACE_NAME_IMPL(MAJOR,MINOR,BETA) +# define ACE_VERSIONED_NAMESPACE_NAME ACE_MAKE_VERSIONED_NAMESPACE_NAME(ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION) +# endif /* !ACE_VERSIONED_NAMESPACE_NAME */ + +# define ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_VERSIONED_NAMESPACE_NAME { +# define ACE_END_VERSIONED_NAMESPACE_DECL } \ + using namespace ACE_VERSIONED_NAMESPACE_NAME; + +#else + +# define ACE_VERSIONED_NAMESPACE_NAME +# define ACE_BEGIN_VERSIONED_NAMESPACE_DECL +# define ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_VERSIONED_NAMESPACE */ + +#endif /* !ACE_VERSIONED_NAMESPACE_H */ diff --git a/externals/ace/WFMO_Reactor.cpp b/externals/ace/WFMO_Reactor.cpp new file mode 100644 index 0000000..713b568 --- /dev/null +++ b/externals/ace/WFMO_Reactor.cpp @@ -0,0 +1,2748 @@ +// $Id: WFMO_Reactor.cpp 85125 2009-04-20 16:47:38Z johnnyw $ + +#include "ace/WFMO_Reactor.h" + +#if defined (ACE_WIN32) + +#include "ace/Handle_Set.h" +#include "ace/Timer_Heap.h" +#include "ace/Thread.h" +#include "ace/OS_NS_errno.h" +#include "ace/Null_Condition.h" + +#if !defined (__ACE_INLINE__) +#include "ace/WFMO_Reactor.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, WFMO_Reactor, "$Id: WFMO_Reactor.cpp 85125 2009-04-20 16:47:38Z johnnyw $") + +#include "ace/Auto_Ptr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_WFMO_Reactor_Handler_Repository::ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor) + : wfmo_reactor_ (wfmo_reactor) +{ +} + +int +ACE_WFMO_Reactor_Handler_Repository::open (size_t size) +{ + if (size > MAXIMUM_WAIT_OBJECTS) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%d exceeds MAXIMUM_WAIT_OBJECTS (%d)\n"), + size, + MAXIMUM_WAIT_OBJECTS), + -1); + + // Dynamic allocation + ACE_NEW_RETURN (this->current_handles_, + ACE_HANDLE[size], + -1); + ACE_NEW_RETURN (this->current_info_, + Current_Info[size], + -1); + ACE_NEW_RETURN (this->current_suspended_info_, + Suspended_Info[size], + -1); + ACE_NEW_RETURN (this->to_be_added_info_, + To_Be_Added_Info[size], + -1); + + // Initialization + this->max_size_ = size; + this->max_handlep1_ = 0; + this->suspended_handles_ = 0; + this->handles_to_be_added_ = 0; + this->handles_to_be_deleted_ = 0; + this->handles_to_be_suspended_ = 0; + this->handles_to_be_resumed_ = 0; + + for (size_t i = 0; i < size; ++i) + this->current_handles_[i] = ACE_INVALID_HANDLE; + + return 0; +} + +ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void) +{ + // Free up dynamically allocated space + delete [] this->current_handles_; + delete [] this->current_info_; + delete [] this->current_suspended_info_; + delete [] this->to_be_added_info_; +} + +ACE_Reactor_Mask +ACE_WFMO_Reactor_Handler_Repository::bit_ops (long &existing_masks, + ACE_Reactor_Mask change_masks, + int operation) +{ + // Find the old reactor masks. This automatically does the work of + // the GET_MASK operation. + + ACE_Reactor_Mask old_masks = ACE_Event_Handler::NULL_MASK; + + if (ACE_BIT_ENABLED (existing_masks, FD_READ) + || ACE_BIT_ENABLED (existing_masks, FD_CLOSE)) + ACE_SET_BITS (old_masks, ACE_Event_Handler::READ_MASK); + + if (ACE_BIT_ENABLED (existing_masks, FD_WRITE)) + ACE_SET_BITS (old_masks, ACE_Event_Handler::WRITE_MASK); + + if (ACE_BIT_ENABLED (existing_masks, FD_OOB)) + ACE_SET_BITS (old_masks, ACE_Event_Handler::EXCEPT_MASK); + + if (ACE_BIT_ENABLED (existing_masks, FD_ACCEPT)) + ACE_SET_BITS (old_masks, ACE_Event_Handler::ACCEPT_MASK); + + if (ACE_BIT_ENABLED (existing_masks, FD_CONNECT)) + ACE_SET_BITS (old_masks, ACE_Event_Handler::CONNECT_MASK); + + if (ACE_BIT_ENABLED (existing_masks, FD_QOS)) + ACE_SET_BITS (old_masks, ACE_Event_Handler::QOS_MASK); + + if (ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS)) + ACE_SET_BITS (old_masks, ACE_Event_Handler::GROUP_QOS_MASK); + + switch (operation) + { + case ACE_Reactor::CLR_MASK: + // For the CLR_MASK operation, clear only the specific masks. + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK)) + { + ACE_CLR_BITS (existing_masks, FD_READ); + ACE_CLR_BITS (existing_masks, FD_CLOSE); + } + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK)) + ACE_CLR_BITS (existing_masks, FD_WRITE); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK)) + ACE_CLR_BITS (existing_masks, FD_OOB); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK)) + ACE_CLR_BITS (existing_masks, FD_ACCEPT); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK)) + ACE_CLR_BITS (existing_masks, FD_CONNECT); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK)) + ACE_CLR_BITS (existing_masks, FD_QOS); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK)) + ACE_CLR_BITS (existing_masks, FD_GROUP_QOS); + + break; + + case ACE_Reactor::SET_MASK: + // If the operation is a set, first reset any existing masks + + existing_masks = 0; + /* FALLTHRU */ + + case ACE_Reactor::ADD_MASK: + // For the ADD_MASK and the SET_MASK operation, add only the + // specific masks. + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::READ_MASK)) + { + ACE_SET_BITS (existing_masks, FD_READ); + ACE_SET_BITS (existing_masks, FD_CLOSE); + } + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (existing_masks, FD_WRITE); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::EXCEPT_MASK)) + ACE_SET_BITS (existing_masks, FD_OOB); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::ACCEPT_MASK)) + ACE_SET_BITS (existing_masks, FD_ACCEPT); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::CONNECT_MASK)) + ACE_SET_BITS (existing_masks, FD_CONNECT); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::QOS_MASK)) + ACE_SET_BITS (existing_masks, FD_QOS); + + if (ACE_BIT_ENABLED (change_masks, ACE_Event_Handler::GROUP_QOS_MASK)) + ACE_SET_BITS (existing_masks, FD_GROUP_QOS); + + break; + + case ACE_Reactor::GET_MASK: + + // The work for this operation is done in all cases at the + // begining of the function. + + ACE_UNUSED_ARG (change_masks); + + break; + } + + return old_masks; +} + +int +ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + bool &changes_required) +{ + int error = 0; + + // Remember this value; only if it changes do we need to wakeup + // the other threads + size_t const original_handle_count = this->handles_to_be_deleted_; + size_t i; + + // Go through all the handles looking for . Even if we find + // it, we continue through the rest of the list since could + // appear multiple times. All handles are checked. + + // First check the current entries + for (i = 0; i < this->max_handlep1_ && error == 0; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->current_handles_[i] == handle + || this->current_info_[i].io_handle_ == handle) + && // Make sure that it is not already marked for deleted + !this->current_info_[i].delete_entry_) + { + if (this->remove_handler_i (i, mask) == -1) + error = 1; + } + + // Then check the suspended entries + for (i = 0; i < this->suspended_handles_ && error == 0; ++i) + // Since the handle can either be the event or the I/O handle, we + // have to check both + if ((this->current_suspended_info_[i].io_handle_ == handle + || this->current_suspended_info_[i].event_handle_ == handle) + && + // Make sure that it is not already marked for deleted + !this->current_suspended_info_[i].delete_entry_) + { + if (this->remove_suspended_handler_i (i, mask) == -1) + error = 1; + } + + // Then check the to_be_added entries + for (i = 0; i < this->handles_to_be_added_ && error == 0; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->to_be_added_info_[i].io_handle_ == handle + || this->to_be_added_info_[i].event_handle_ == handle) + && + // Make sure that it is not already marked for deleted + !this->to_be_added_info_[i].delete_entry_) + { + if (this->remove_to_be_added_handler_i (i, mask) == -1) + error = 1; + } + + // Only if the number of handlers to be deleted changes do we need + // to wakeup the other threads + if (original_handle_count < this->handles_to_be_deleted_) + changes_required = true; + + return error ? -1 : 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::remove_handler_i (size_t slot, + ACE_Reactor_Mask to_be_removed_masks) +{ + // I/O entries + if (this->current_info_[slot].io_entry_) + { + // See if there are other events that the is + // interested in + this->bit_ops (this->current_info_[slot].network_events_, + to_be_removed_masks, + ACE_Reactor::CLR_MASK); + + // Disassociate/Reassociate the event from/with the I/O handle. + // This will depend on the value of remaining set of network + // events that the is interested in. I don't + // think we can do anything about errors here, so I will not + // check this. + ::WSAEventSelect ((SOCKET) this->current_info_[slot].io_handle_, + this->current_handles_[slot], + this->current_info_[slot].network_events_); + } + // Normal event entries. + else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL)) + // Preserve DONT_CALL + to_be_removed_masks = ACE_Event_Handler::DONT_CALL; + else + // Make sure that the is the NULL_MASK + to_be_removed_masks = ACE_Event_Handler::NULL_MASK; + + // If this event was marked for suspension, undo the suspension flag + // and reduce the to be suspended count. + if (this->current_info_[slot].suspend_entry_) + { + // Undo suspension + this->current_info_[slot].suspend_entry_ = false; + // Decrement the handle count + --this->handles_to_be_suspended_; + } + + // If there are no more events that the is + // interested in, or this is a non-I/O entry, schedule the + // for removal + if (this->current_info_[slot].network_events_ == 0) + { + // Mark to be deleted + this->current_info_[slot].delete_entry_ = true; + // Remember the mask + this->current_info_[slot].close_masks_ = to_be_removed_masks; + // Increment the handle count + ++this->handles_to_be_deleted_; + } + + // Since it is not a complete removal, we'll call handle_close + // for all the masks that were removed. This does not change + // the internal state of the reactor. + // + // Note: this condition only applies to I/O entries + else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0) + { + ACE_HANDLE handle = this->current_info_[slot].io_handle_; + this->current_info_[slot].event_handler_->handle_close (handle, + to_be_removed_masks); + } + + return 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::remove_suspended_handler_i (size_t slot, + ACE_Reactor_Mask to_be_removed_masks) +{ + // I/O entries + if (this->current_suspended_info_[slot].io_entry_) + { + // See if there are other events that the is + // interested in + this->bit_ops (this->current_suspended_info_[slot].network_events_, + to_be_removed_masks, + ACE_Reactor::CLR_MASK); + + // Disassociate/Reassociate the event from/with the I/O handle. + // This will depend on the value of remaining set of network + // events that the is interested in. I don't + // think we can do anything about errors here, so I will not + // check this. + ::WSAEventSelect ((SOCKET) this->current_suspended_info_[slot].io_handle_, + this->current_suspended_info_[slot].event_handle_, + this->current_suspended_info_[slot].network_events_); + } + // Normal event entries. + else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL)) + // Preserve DONT_CALL + to_be_removed_masks = ACE_Event_Handler::DONT_CALL; + else + // Make sure that the is the NULL_MASK + to_be_removed_masks = ACE_Event_Handler::NULL_MASK; + + // If this event was marked for resumption, undo the resumption flag + // and reduce the to be resumed count. + if (this->current_suspended_info_[slot].resume_entry_) + { + // Undo resumption + this->current_suspended_info_[slot].resume_entry_ = false; + // Decrement the handle count + --this->handles_to_be_resumed_; + } + + // If there are no more events that the is + // interested in, or this is a non-I/O entry, schedule the + // for removal + if (this->current_suspended_info_[slot].network_events_ == 0) + { + // Mark to be deleted + this->current_suspended_info_[slot].delete_entry_ = true; + // Remember the mask + this->current_suspended_info_[slot].close_masks_ = to_be_removed_masks; + // Increment the handle count + ++this->handles_to_be_deleted_; + } + // Since it is not a complete removal, we'll call handle_close for + // all the masks that were removed. This does not change the + // internal state of the reactor. + // + // Note: this condition only applies to I/O entries + else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0) + { + ACE_HANDLE handle = this->current_suspended_info_[slot].io_handle_; + this->current_suspended_info_[slot].event_handler_->handle_close (handle, + to_be_removed_masks); + } + + return 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::remove_to_be_added_handler_i (size_t slot, + ACE_Reactor_Mask to_be_removed_masks) +{ + // I/O entries + if (this->to_be_added_info_[slot].io_entry_) + { + // See if there are other events that the is + // interested in + this->bit_ops (this->to_be_added_info_[slot].network_events_, + to_be_removed_masks, + ACE_Reactor::CLR_MASK); + + // Disassociate/Reassociate the event from/with the I/O handle. + // This will depend on the value of remaining set of network + // events that the is interested in. I don't + // think we can do anything about errors here, so I will not + // check this. + ::WSAEventSelect ((SOCKET) this->to_be_added_info_[slot].io_handle_, + this->to_be_added_info_[slot].event_handle_, + this->to_be_added_info_[slot].network_events_); + } + // Normal event entries. + else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL)) + // Preserve DONT_CALL + to_be_removed_masks = ACE_Event_Handler::DONT_CALL; + else + // Make sure that the is the NULL_MASK + to_be_removed_masks = ACE_Event_Handler::NULL_MASK; + + // If this event was marked for suspension, undo the suspension flag + // and reduce the to be suspended count. + if (this->to_be_added_info_[slot].suspend_entry_) + { + // Undo suspension + this->to_be_added_info_[slot].suspend_entry_ = false; + // Decrement the handle count + --this->handles_to_be_suspended_; + } + + // If there are no more events that the is + // interested in, or this is a non-I/O entry, schedule the + // for removal + if (this->to_be_added_info_[slot].network_events_ == 0) + { + // Mark to be deleted + this->to_be_added_info_[slot].delete_entry_ = true; + // Remember the mask + this->to_be_added_info_[slot].close_masks_ = to_be_removed_masks; + // Increment the handle count + ++this->handles_to_be_deleted_; + } + // Since it is not a complete removal, we'll call handle_close + // for all the masks that were removed. This does not change + // the internal state of the reactor. + // + // Note: this condition only applies to I/O entries + else if (ACE_BIT_ENABLED (to_be_removed_masks, ACE_Event_Handler::DONT_CALL) == 0) + { + ACE_HANDLE handle = this->to_be_added_info_[slot].io_handle_; + this->to_be_added_info_[slot].event_handler_->handle_close (handle, + to_be_removed_masks); + } + + return 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::suspend_handler_i (ACE_HANDLE handle, + bool &changes_required) +{ + size_t i = 0; + + // Go through all the handles looking for . Even if we find + // it, we continue through the rest of the list since could + // appear multiple times. All handles are checked. + + // Check the current entries first. + for (i = 0; i < this->max_handlep1_; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->current_handles_[i] == handle || + this->current_info_[i].io_handle_ == handle) && + // Make sure that it is not already marked for suspension + !this->current_info_[i].suspend_entry_) + { + // Mark to be suspended + this->current_info_[i].suspend_entry_ = true; + // Increment the handle count + ++this->handles_to_be_suspended_; + // Changes will be required + changes_required = true; + } + + // Then check the suspended entries. + for (i = 0; i < this->suspended_handles_; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->current_suspended_info_[i].event_handle_ == handle || + this->current_suspended_info_[i].io_handle_ == handle) && + // Make sure that the resumption is not already undone + this->current_suspended_info_[i].resume_entry_) + { + // Undo resumption + this->current_suspended_info_[i].resume_entry_ = false; + // Decrement the handle count + --this->handles_to_be_resumed_; + // Changes will be required + changes_required = true; + } + + // Then check the to_be_added entries. + for (i = 0; i < this->handles_to_be_added_; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->to_be_added_info_[i].io_handle_ == handle || + this->to_be_added_info_[i].event_handle_ == handle) && + // Make sure that it is not already marked for suspension + !this->to_be_added_info_[i].suspend_entry_) + { + // Mark to be suspended + this->to_be_added_info_[i].suspend_entry_ = true; + // Increment the handle count + ++this->handles_to_be_suspended_; + // Changes will be required + changes_required = true; + } + + return 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::resume_handler_i (ACE_HANDLE handle, + bool &changes_required) +{ + size_t i = 0; + + // Go through all the handles looking for . Even if we find + // it, we continue through the rest of the list since could + // appear multiple times. All handles are checked. + + // Check the current entries first. + for (i = 0; i < this->max_handlep1_; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->current_handles_[i] == handle || + this->current_info_[i].io_handle_ == handle) && + // Make sure that the suspension is not already undone + this->current_info_[i].suspend_entry_) + { + // Undo suspension + this->current_info_[i].suspend_entry_ = false; + // Decrement the handle count + --this->handles_to_be_suspended_; + // Changes will be required + changes_required = true; + } + + // Then check the suspended entries. + for (i = 0; i < this->suspended_handles_; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->current_suspended_info_[i].event_handle_ == handle || + this->current_suspended_info_[i].io_handle_ == handle) && + // Make sure that it is not already marked for resumption + !this->current_suspended_info_[i].resume_entry_) + { + // Mark to be resumed + this->current_suspended_info_[i].resume_entry_ = true; + // Increment the handle count + ++this->handles_to_be_resumed_; + // Changes will be required + changes_required = true; + } + + // Then check the to_be_added entries. + for (i = 0; i < this->handles_to_be_added_; ++i) + // Since the handle can either be the event or the I/O handle, + // we have to check both + if ((this->to_be_added_info_[i].io_handle_ == handle || + this->to_be_added_info_[i].event_handle_ == handle) && + // Make sure that the suspension is not already undone + this->to_be_added_info_[i].suspend_entry_) + { + // Undo suspension + this->to_be_added_info_[i].suspend_entry_ = false; + // Decrement the handle count + --this->handles_to_be_suspended_; + // Changes will be required + changes_required = true; + } + + return 0; +} + +void +ACE_WFMO_Reactor_Handler_Repository::unbind_all (void) +{ + { + ACE_GUARD (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_); + + bool dummy; + size_t i; + + // Remove all the current handlers + for (i = 0; i < this->max_handlep1_; ++i) + this->unbind_i (this->current_handles_[i], + ACE_Event_Handler::ALL_EVENTS_MASK, + dummy); + + // Remove all the suspended handlers + for (i = 0; i < this->suspended_handles_; ++i) + this->unbind_i (this->current_suspended_info_[i].event_handle_, + ACE_Event_Handler::ALL_EVENTS_MASK, + dummy); + + // Remove all the to_be_added handlers + for (i = 0; i < this->handles_to_be_added_; ++i) + this->unbind_i (this->to_be_added_info_[i].event_handle_, + ACE_Event_Handler::ALL_EVENTS_MASK, + dummy); + } + + // The guard is released here + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wfmo_reactor_.wakeup_all_threads (); +} + +int +ACE_WFMO_Reactor_Handler_Repository::bind_i (bool io_entry, + ACE_Event_Handler *event_handler, + long network_events, + ACE_HANDLE io_handle, + ACE_HANDLE event_handle, + bool delete_event) +{ + if (event_handler == 0) + return -1; + + // Make sure that the is valid + if (event_handle == ACE_INVALID_HANDLE) + event_handle = event_handler->get_handle (); + if (this->invalid_handle (event_handle)) + return -1; + + size_t current_size = this->max_handlep1_ + + this->handles_to_be_added_ - + this->handles_to_be_deleted_ + + this->suspended_handles_; + + // Make sure that there's room in the table and that total pending + // additions should not exceed what the array + // can hold. + if (current_size < this->max_size_ && + this->handles_to_be_added_ < this->max_size_) + { + // Cache this set into the , till we come + // around to actually adding this to the + this->to_be_added_info_[this->handles_to_be_added_].set (event_handle, + io_entry, + event_handler, + io_handle, + network_events, + delete_event); + + ++this->handles_to_be_added_; + + event_handler->add_reference (); + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wfmo_reactor_.wakeup_all_threads (); + } + else + { + errno = EMFILE; // File descriptor table is full (better than nothing) + return -1; + } + + return 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void) +{ + // Go through the entire valid array and check for all handles that + // have been schedule for deletion + if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_suspended_ > 0) + { + size_t i = 0; + while (i < this->max_handlep1_) + { + // This stuff is necessary here, since we should not make + // the upcall until all the internal data structures have + // been updated. This is to protect against upcalls that + // try to deregister again. + ACE_HANDLE handle = ACE_INVALID_HANDLE; + ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK; + ACE_Event_Handler *event_handler = 0; + + // See if this entry is scheduled for deletion + if (this->current_info_[i].delete_entry_) + { + // Calling the method here will ensure that we + // will only call it once per deregistering . + // This is essential in the case when the will + // do something like delete itself and we have multiple + // threads in WFMO_Reactor. + // + // Make sure that the DONT_CALL mask is not set + masks = this->current_info_[i].close_masks_; + if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0) + { + // Grab the correct handle depending on the type entry + if (this->current_info_[i].io_entry_) + handle = this->current_info_[i].io_handle_; + else + handle = this->current_handles_[i]; + + // Event handler + event_handler = this->current_info_[i].event_handler_; + } + + // If created the event, we need to clean it up + if (this->current_info_[i].delete_event_) + ACE_OS::event_destroy (&this->current_handles_[i]); + + // Reduce count by one + --this->handles_to_be_deleted_; + } + + // See if this entry is scheduled for suspension + else if (this->current_info_[i].suspend_entry_) + { + this->current_suspended_info_ [this->suspended_handles_].set (this->current_handles_[i], + this->current_info_[i]); + // Increase number of suspended handles + ++this->suspended_handles_; + + // Reduce count by one + --this->handles_to_be_suspended_; + } + + // See if this entry is scheduled for deletion or suspension + // If so we need to clean up + if (this->current_info_[i].delete_entry_ || + this->current_info_[i].suspend_entry_ ) + { + size_t last_valid_slot = this->max_handlep1_ - 1; + // If this is the last handle in the set, no need to swap + // places. Simply remove it. + if (i < last_valid_slot) + // Swap this handle with the last valid handle + { + // Struct copy + this->current_info_[i] = + this->current_info_[last_valid_slot]; + this->current_handles_[i] = + this->current_handles_[last_valid_slot]; + } + // Reset the info in this slot + this->current_info_[last_valid_slot].reset (); + this->current_handles_[last_valid_slot] = ACE_INVALID_HANDLE; + --this->max_handlep1_; + } + else + { + // This current entry is not up for deletion or + // suspension. Proceed to the next entry in the current + // handles. + ++i; + } + + // Now that all internal structures have been updated, make + // the upcall. + if (event_handler != 0) + { + bool const requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + event_handler->handle_close (handle, masks); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } + } + } + + return 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void) +{ + // Go through the array + if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_resumed_ > 0) + { + size_t i = 0; + while (i < this->suspended_handles_) + { + // This stuff is necessary here, since we should not make + // the upcall until all the internal data structures have + // been updated. This is to protect against upcalls that + // try to deregister again. + ACE_HANDLE handle = ACE_INVALID_HANDLE; + ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK; + ACE_Event_Handler *event_handler = 0; + + // See if this entry is scheduled for deletion + if (this->current_suspended_info_[i].delete_entry_) + { + // Calling the method here will ensure that we + // will only call it once per deregistering . + // This is essential in the case when the will + // do something like delete itself and we have multiple + // threads in WFMO_Reactor. + // + // Make sure that the DONT_CALL mask is not set + masks = this->current_suspended_info_[i].close_masks_; + if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0) + { + // Grab the correct handle depending on the type entry + if (this->current_suspended_info_[i].io_entry_) + handle = this->current_suspended_info_[i].io_handle_; + else + handle = this->current_suspended_info_[i].event_handle_; + + // Upcall + event_handler = this->current_suspended_info_[i].event_handler_; + } + + // If created the event, we need to clean it up + if (this->current_suspended_info_[i].delete_event_) + ACE_OS::event_destroy (&this->current_suspended_info_[i].event_handle_); + + // Reduce count by one + --this->handles_to_be_deleted_; + } + + else if (this->current_suspended_info_[i].resume_entry_) + { + // Add to the end of the current handles set + this->current_handles_[this->max_handlep1_] = this->current_suspended_info_[i].event_handle_; + // Struct copy + this->current_info_[this->max_handlep1_].set (this->current_suspended_info_[i]); + ++this->max_handlep1_; + + // Reduce count by one + --this->handles_to_be_resumed_; + } + + // If an entry needs to be removed, either because it + // was deleted or resumed, remove it now before doing + // the upcall. + if (this->current_suspended_info_[i].resume_entry_ || + this->current_suspended_info_[i].delete_entry_) + { + size_t last_valid_slot = this->suspended_handles_ - 1; + // Net effect is that we're removing an entry and + // compressing the list from the end. So, if removing + // an entry from the middle, copy the last valid one to the + // removed slot. Reset the end and decrement the number + // of suspended handles. + if (i < last_valid_slot) + // Struct copy + this->current_suspended_info_[i] = + this->current_suspended_info_[last_valid_slot]; + this->current_suspended_info_[last_valid_slot].reset (); + --this->suspended_handles_; + } + else + { + // This current entry is not up for deletion or + // resumption. Proceed to the next entry in the + // suspended handles. + ++i; + } + + // Now that all internal structures have been updated, make + // the upcall. + if (event_handler != 0) + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + event_handler->handle_close (handle, masks); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } + } + } + + return 0; +} + +int +ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void) +{ + // Go through the arrays + for (size_t i = 0; i < this->handles_to_be_added_; ++i) + { + // This stuff is necessary here, since we should not make + // the upcall until all the internal data structures have + // been updated. This is to protect against upcalls that + // try to deregister again. + ACE_HANDLE handle = ACE_INVALID_HANDLE; + ACE_Reactor_Mask masks = ACE_Event_Handler::NULL_MASK; + ACE_Event_Handler *event_handler = 0; + + // See if this entry is scheduled for deletion + if (this->to_be_added_info_[i].delete_entry_) + { + // Calling the method here will ensure that we + // will only call it once per deregistering . + // This is essential in the case when the will + // do something like delete itself and we have multiple + // threads in WFMO_Reactor. + // + // Make sure that the DONT_CALL mask is not set + masks = this->to_be_added_info_[i].close_masks_; + if (ACE_BIT_ENABLED (masks, ACE_Event_Handler::DONT_CALL) == 0) + { + // Grab the correct handle depending on the type entry + if (this->to_be_added_info_[i].io_entry_) + handle = this->to_be_added_info_[i].io_handle_; + else + handle = this->to_be_added_info_[i].event_handle_; + + // Upcall + event_handler = this->to_be_added_info_[i].event_handler_; + } + + // If created the event, we need to clean it up + if (this->to_be_added_info_[i].delete_event_) + ACE_OS::event_destroy (&this->to_be_added_info_[i].event_handle_); + + // Reduce count by one + --this->handles_to_be_deleted_; + } + + // See if this entry is scheduled for suspension + else if (this->to_be_added_info_[i].suspend_entry_) + { + this->current_suspended_info_ [this->suspended_handles_].set (this->to_be_added_info_[i].event_handle_, + this->to_be_added_info_[i]); + // Increase number of suspended handles + ++this->suspended_handles_; + + // Reduce count by one + --this->handles_to_be_suspended_; + } + + // If neither of the two flags are on, add to current + else + { + // Add to the end of the current handles set + this->current_handles_[this->max_handlep1_] = this->to_be_added_info_[i].event_handle_; + // Struct copy + this->current_info_[this->max_handlep1_].set (this->to_be_added_info_[i]); + ++this->max_handlep1_; + } + + // Reset the + this->to_be_added_info_[i].reset (); + + // Now that all internal structures have been updated, make the + // upcall. + if (event_handler != 0) + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + event_handler->handle_close (handle, masks); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } + } + + // Since all to be added handles have been taken care of, reset the + // counter + this->handles_to_be_added_ = 0; + + return 0; +} + +void +ACE_WFMO_Reactor_Handler_Repository::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + size_t i = 0; + + ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Max size = %d\n"), + this->max_size_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Current info table\n\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tSize = %d\n"), + this->max_handlep1_)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tHandles to be suspended = %d\n"), + this->handles_to_be_suspended_)); + + for (i = 0; i < this->max_handlep1_; ++i) + this->current_info_[i].dump (this->current_handles_[i]); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\n"))); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("To-be-added info table\n\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tSize = %d\n"), + this->handles_to_be_added_)); + + for (i = 0; i < this->handles_to_be_added_; ++i) + this->to_be_added_info_[i].dump (); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\n"))); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Suspended info table\n\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tSize = %d\n"), + this->suspended_handles_)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\tHandles to be resumed = %d\n"), + this->handles_to_be_resumed_)); + + for (i = 0; i < this->suspended_handles_; ++i) + this->current_suspended_info_[i].dump (); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\n"))); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Total handles to be deleted = %d\n"), + this->handles_to_be_deleted_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +/************************************************************/ + +int +ACE_WFMO_Reactor::work_pending (const ACE_Time_Value &) +{ + ACE_NOTSUP_RETURN (-1); +} + +#if defined (ACE_WIN32_VC8) +# pragma warning (push) +# pragma warning (disable:4355) /* Use of 'this' in initializer list */ +# endif +ACE_WFMO_Reactor::ACE_WFMO_Reactor (ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + ACE_Reactor_Notify *notify) + : signal_handler_ (0), + delete_signal_handler_ (false), + timer_queue_ (0), + delete_timer_queue_ (false), + delete_handler_rep_ (false), + notify_handler_ (0), + delete_notify_handler_ (false), + lock_adapter_ (lock_), + handler_rep_ (*this), + // this event is initially signaled + ok_to_wait_ (1), + // this event is initially unsignaled + wakeup_all_threads_ (0), + // this event is initially unsignaled + waiting_to_change_state_ (0), + active_threads_ (0), + owner_ (ACE_Thread::self ()), + new_owner_ (0), + change_state_thread_ (0), + open_for_business_ (false), + deactivated_ (0) +{ + if (this->open (ACE_WFMO_Reactor::DEFAULT_SIZE, 0, sh, tq, 0, notify) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("WFMO_Reactor"))); +} + +ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size, + int unused, + ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + ACE_Reactor_Notify *notify) + : signal_handler_ (0), + delete_signal_handler_ (false), + timer_queue_ (0), + delete_timer_queue_ (false), + delete_handler_rep_ (false), + notify_handler_ (0), + delete_notify_handler_ (false), + lock_adapter_ (lock_), + handler_rep_ (*this), + // this event is initially signaled + ok_to_wait_ (1), + // this event is initially unsignaled + wakeup_all_threads_ (0), + // this event is initially unsignaled + waiting_to_change_state_ (0), + active_threads_ (0), + owner_ (ACE_Thread::self ()), + new_owner_ (0), + change_state_thread_ (0), + open_for_business_ (false), + deactivated_ (0) +{ + ACE_UNUSED_ARG (unused); + + if (this->open (size, 0, sh, tq, 0, notify) == -1) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("WFMO_Reactor"))); +} +#if defined (ACE_WIN32_VC8) +# pragma warning (pop) +#endif + +int +ACE_WFMO_Reactor::current_info (ACE_HANDLE, size_t &) +{ + return -1; +} + +int +ACE_WFMO_Reactor::open (size_t size, + bool, + ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + int, + ACE_Reactor_Notify *notify) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + // If we are already open, return -1 + if (this->open_for_business_) + return -1; + + // Timer Queue + if (this->delete_timer_queue_) + delete this->timer_queue_; + + if (tq == 0) + { + ACE_NEW_RETURN (this->timer_queue_, + ACE_Timer_Heap, + -1); + this->delete_timer_queue_ = true; + } + else + { + this->timer_queue_ = tq; + this->delete_timer_queue_ = false; + } + + // Signal Handler + if (this->delete_signal_handler_) + delete this->signal_handler_; + + if (sh == 0) + { + ACE_NEW_RETURN (this->signal_handler_, + ACE_Sig_Handler, + -1); + this->delete_signal_handler_ = true; + } + else + { + this->signal_handler_ = sh; + this->delete_signal_handler_ = false; + } + + // Setup the atomic wait array (used later in ) + this->atomic_wait_array_[0] = this->lock_.lock ().proc_mutex_; + this->atomic_wait_array_[1] = this->ok_to_wait_.handle (); + + // Prevent memory leaks when the ACE_WFMO_Reactor is reopened. + if (this->delete_handler_rep_) + { + if (this->handler_rep_.changes_required ()) + { + // Make necessary changes to the handler repository + this->handler_rep_.make_changes (); + // Turn off since all necessary changes + // have completed + this->wakeup_all_threads_.reset (); + } + + this->handler_rep_.~ACE_WFMO_Reactor_Handler_Repository (); + } + + // Open the handle repository. Two additional handles for internal + // purposes + if (this->handler_rep_.open (size + 2) == -1) + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("opening handler repository")), + -1); + else + this->delete_handler_rep_ = true; + + if (this->notify_handler_ != 0 && this->delete_notify_handler_) + delete this->notify_handler_; + + this->notify_handler_ = notify; + + if (this->notify_handler_ == 0) + { + ACE_NEW_RETURN (this->notify_handler_, + ACE_WFMO_Reactor_Notify, + -1); + + if (this->notify_handler_ == 0) + return -1; + else + this->delete_notify_handler_ = true; + } + + /* NOTE */ + // The order of the following two registrations is very important + + // Open the notification handler + if (this->notify_handler_->open (this, this->timer_queue_) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("opening notify handler ")), + -1); + + // Register for event + if (this->register_handler (&this->wakeup_all_threads_handler_, + this->wakeup_all_threads_.handle ()) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("registering thread wakeup handler")), + -1); + + // Since we have added two handles into the handler repository, + // update the + if (this->handler_rep_.changes_required ()) + { + // Make necessary changes to the handler repository + this->handler_rep_.make_changes (); + // Turn off since all necessary changes + // have completed + this->wakeup_all_threads_.reset (); + } + + // We are open for business + this->open_for_business_ = true; + + return 0; +} + +int +ACE_WFMO_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler) +{ + if (this->signal_handler_ != 0 && this->delete_signal_handler_) + delete this->signal_handler_; + this->signal_handler_ = signal_handler; + this->delete_signal_handler_ = false; + return 0; +} + +ACE_Timer_Queue * +ACE_WFMO_Reactor::timer_queue (void) const +{ + return this->timer_queue_; +} + +int +ACE_WFMO_Reactor::timer_queue (ACE_Timer_Queue *tq) +{ + if (this->timer_queue_ != 0 && this->delete_timer_queue_) + delete this->timer_queue_; + this->timer_queue_ = tq; + this->delete_timer_queue_ = false; + return 0; +} + +int +ACE_WFMO_Reactor::close (void) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + // If we are already closed, return error + if (!this->open_for_business_) + return -1; + + // We are now closed + this->open_for_business_ = false; + // This will unregister all handles + this->handler_rep_.close (); + + return 0; +} + +ACE_WFMO_Reactor::~ACE_WFMO_Reactor (void) +{ + // Assumption: No threads are left in the Reactor when this method + // is called (i.e., active_threads_ == 0) + + // Close down + this->close (); + + // Make necessary changes to the handler repository that we caused + // by . + this->handler_rep_.make_changes (); + + if (this->delete_timer_queue_) + { + delete this->timer_queue_; + this->timer_queue_ = 0; + this->delete_timer_queue_ = false; + } + + if (this->delete_signal_handler_) + { + delete this->signal_handler_; + this->signal_handler_ = 0; + this->delete_signal_handler_ = false; + } + + if (this->delete_notify_handler_) + { + delete this->notify_handler_; + this->notify_handler_ = 0; + this->delete_notify_handler_ = false; + } +} + +int +ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle, + ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask new_masks) +{ + // If this is a Winsock 1 system, the underlying event assignment will + // not work, so don't try. Winsock 1 must use ACE_Select_Reactor for + // reacting to socket activity. + +#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) + + ACE_UNUSED_ARG (event_handle); + ACE_UNUSED_ARG (io_handle); + ACE_UNUSED_ARG (event_handler); + ACE_UNUSED_ARG (new_masks); + ACE_NOTSUP_RETURN (-1); + +#else + + // Make sure that the is valid + if (io_handle == ACE_INVALID_HANDLE) + io_handle = event_handler->get_handle (); + + if (this->handler_rep_.invalid_handle (io_handle)) + { + errno = ERROR_INVALID_HANDLE; + return -1; + } + + long new_network_events = 0; + bool delete_event = false; + auto_ptr event; + + // Look up the repository to see if the is already + // there. + ACE_Reactor_Mask old_masks; + int found = this->handler_rep_.modify_network_events_i (io_handle, + new_masks, + old_masks, + new_network_events, + event_handle, + delete_event, + ACE_Reactor::ADD_MASK); + + // Check to see if the user passed us a valid event; If not then we + // need to create one + if (event_handle == ACE_INVALID_HANDLE) + { + // Note: don't change this since some C++ compilers have + // s that don't work properly... + auto_ptr tmp (new ACE_Auto_Event); + event = tmp; + event_handle = event->handle (); + delete_event = true; + } + + int result = ::WSAEventSelect ((SOCKET) io_handle, + event_handle, + new_network_events); + // If we had found the there is nothing more to do + if (found) + return result; + else if (result != SOCKET_ERROR && + this->handler_rep_.bind_i (1, + event_handler, + new_network_events, + io_handle, + event_handle, + delete_event) != -1) + { + // The was not found in the repository, add to + // the repository. + if (delete_event) + { + // Clear out the handle in the ACE_Auto_Event so that when + // it is destroyed, the handle isn't closed out from under + // the reactor. After setting it, running down the event + // (via auto_ptr<> event, above) at function return will + // cause an error because it'll try to close an invalid handle. + // To avoid that smashing the errno value, save the errno + // here, explicitly remove the event so the dtor won't do it + // again, then restore errno. + ACE_Errno_Guard guard (errno); + event->handle (ACE_INVALID_HANDLE); + event->remove (); + } + return 0; + } + else + return -1; + +#endif /* ACE_HAS_WINSOCK2 || ACE_HAS_WINSOCK2 == 0 */ + +} + +int +ACE_WFMO_Reactor::mask_ops_i (ACE_HANDLE io_handle, + ACE_Reactor_Mask new_masks, + int operation) +{ + // Make sure that the is valid + if (this->handler_rep_.invalid_handle (io_handle)) + return -1; + + long new_network_events = 0; + bool delete_event = false; + ACE_HANDLE event_handle = ACE_INVALID_HANDLE; + + // Look up the repository to see if the is already + // there. + ACE_Reactor_Mask old_masks; + int found = this->handler_rep_.modify_network_events_i (io_handle, + new_masks, + old_masks, + new_network_events, + event_handle, + delete_event, + operation); + if (found) + { + int result = ::WSAEventSelect ((SOCKET) io_handle, + event_handle, + new_network_events); + if (result == 0) + return old_masks; + else + return result; + } + else + return -1; +} + + + +int +ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_handle, + ACE_Reactor_Mask new_masks, + ACE_Reactor_Mask &old_masks, + long &new_network_events, + ACE_HANDLE &event_handle, + bool &delete_event, + int operation) +{ + long *modified_network_events = &new_network_events; + int found = 0; + size_t i; + + // First go through the current entries + // + // Look for all entries in the current handles for matching handle + // (except those that have been scheduled for deletion) + for (i = 0; i < this->max_handlep1_ && !found; ++i) + if (io_handle == this->current_info_[i].io_handle_ && + !this->current_info_[i].delete_entry_) + { + found = 1; + modified_network_events = &this->current_info_[i].network_events_; + delete_event = this->current_info_[i].delete_event_; + event_handle = this->current_handles_[i]; + } + + // Then pass through the suspended handles + // + // Look for all entries in the suspended handles for matching handle + // (except those that have been scheduled for deletion) + for (i = 0; i < this->suspended_handles_ && !found; ++i) + if (io_handle == this->current_suspended_info_[i].io_handle_ && + !this->current_suspended_info_[i].delete_entry_) + { + found = 1; + modified_network_events = &this->current_suspended_info_[i].network_events_; + delete_event = this->current_suspended_info_[i].delete_event_; + event_handle = this->current_suspended_info_[i].event_handle_; + } + + // Then check the to_be_added handles + // + // Look for all entries in the to_be_added handles for matching + // handle (except those that have been scheduled for deletion) + for (i = 0; i < this->handles_to_be_added_ && !found; ++i) + if (io_handle == this->to_be_added_info_[i].io_handle_ && + !this->to_be_added_info_[i].delete_entry_) + { + found = 1; + modified_network_events = &this->to_be_added_info_[i].network_events_; + delete_event = this->to_be_added_info_[i].delete_event_; + event_handle = this->to_be_added_info_[i].event_handle_; + } + + old_masks = this->bit_ops (*modified_network_events, + new_masks, + operation); + + new_network_events = *modified_network_events; + + return found; +} + +ACE_Event_Handler * +ACE_WFMO_Reactor_Handler_Repository::find_handler (ACE_HANDLE handle) +{ + long existing_masks_ignored = 0; + return this->handler (handle, existing_masks_ignored); +} + +ACE_Event_Handler * +ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, + long &existing_masks) +{ + int found = 0; + size_t i = 0; + ACE_Event_Handler *event_handler = 0; + existing_masks = 0; + + // Look for the handle first + + // First go through the current entries + // + // Look for all entries in the current handles for matching handle + // (except those that have been scheduled for deletion) + for (i = 0; i < this->max_handlep1_ && !found; ++i) + if ((handle == this->current_info_[i].io_handle_ || + handle == this->current_handles_[i]) && + !this->current_info_[i].delete_entry_) + { + found = 1; + event_handler = this->current_info_[i].event_handler_; + existing_masks = this->current_info_[i].network_events_; + } + + // Then pass through the suspended handles + // + // Look for all entries in the suspended handles for matching handle + // (except those that have been scheduled for deletion) + for (i = 0; i < this->suspended_handles_ && !found; ++i) + if ((handle == this->current_suspended_info_[i].io_handle_ || + handle == this->current_suspended_info_[i].event_handle_) && + !this->current_suspended_info_[i].delete_entry_) + { + found = 1; + event_handler = this->current_suspended_info_[i].event_handler_; + existing_masks = this->current_suspended_info_[i].network_events_; + } + + // Then check the to_be_added handles + // + // Look for all entries in the to_be_added handles for matching + // handle (except those that have been scheduled for deletion) + for (i = 0; i < this->handles_to_be_added_ && !found; ++i) + if ((handle == this->to_be_added_info_[i].io_handle_ || + handle == this->to_be_added_info_[i].event_handle_) && + !this->to_be_added_info_[i].delete_entry_) + { + found = 1; + event_handler = this->to_be_added_info_[i].event_handler_; + existing_masks = this->to_be_added_info_[i].network_events_; + } + + if (event_handler) + event_handler->add_reference (); + + return event_handler; +} + +int +ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, + ACE_Reactor_Mask user_masks, + ACE_Event_Handler **user_event_handler) +{ + long existing_masks = 0; + int found = 0; + + ACE_Event_Handler_var safe_event_handler = + this->handler (handle, + existing_masks); + + if (safe_event_handler.handler ()) + found = 1; + + if (!found) + return -1; + + // Otherwise, make sure that the masks that the user is looking for + // are on. + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::READ_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_READ) && + !ACE_BIT_ENABLED (existing_masks, FD_CLOSE)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::WRITE_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_WRITE)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::EXCEPT_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_OOB)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::ACCEPT_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_ACCEPT)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::CONNECT_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_CONNECT)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::QOS_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_QOS)) + found = 0; + + if (found && + ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::GROUP_QOS_MASK)) + if (!ACE_BIT_ENABLED (existing_masks, FD_GROUP_QOS)) + found = 0; + + if (found && + user_event_handler) + *user_event_handler = safe_event_handler.release (); + + if (found) + return 0; + else + return -1; +} + +// Waits for and dispatches all events. Returns -1 on error, 0 if +// max_wait_time expired, or the number of events that were dispatched. +int +ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time, + int alertable) +{ + ACE_TRACE ("ACE_WFMO_Reactor::event_handling"); + + // Make sure we are not closed + if (!this->open_for_business_ || this->deactivated_) + return -1; + + // Stash the current time -- the destructor of this object will + // automatically compute how much time elapsed since this method was + // called. + ACE_Countdown_Time countdown (max_wait_time); + + int result; + do + { + // Check to see if it is ok to enter ::WaitForMultipleObjects + // This will acquire lock_> on success On failure, the + // lock will not be acquired + result = this->ok_to_wait (max_wait_time, alertable); + if (result != 1) + return result; + + // Increment the number of active threads + ++this->active_threads_; + + // Release the + this->lock_.release (); + + // Update the countdown to reflect time waiting to play with the + // mut and event. + countdown.update (); + + // Calculate timeout + int timeout = this->calculate_timeout (max_wait_time); + + // Wait for event to happen + DWORD wait_status = this->wait_for_multiple_events (timeout, + alertable); + + // Upcall + result = this->safe_dispatch (wait_status); + if (0 == result) + { + // wait_for_multiple_events timed out without dispatching + // anything. Because of rounding and conversion errors and + // such, it could be that the wait loop timed out, but + // the timer queue said it wasn't quite ready to expire a + // timer. In this case, max_wait_time won't have quite been + // reduced to 0, and we need to go around again. If max_wait_time + // is all the way to 0, just return, as the entire time the + // caller wanted to wait has been used up. + countdown.update (); // Reflect time waiting for events + if (0 == max_wait_time || max_wait_time->usec () == 0) + break; + } + } + while (result == 0); + + return result; +} + +int +ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time, + int alertable) +{ + // Calculate the max time we should spend here + // + // Note: There is really no need to involve the here + // because even if a timeout in the does expire we + // will not be able to dispatch it + + // We need to wait for both the and event. + // If not on WinCE, use WaitForMultipleObjects() to wait for both atomically. + // On WinCE, the waitAll arg to WFMO must be false, so wait for the + // ok_to_wait_ event first (since that's likely to take the longest) then + // grab the lock and recheck the ok_to_wait_ event. When we can get them + // both, or there's an error/timeout, return. +#if defined (ACE_HAS_WINCE) + ACE_UNUSED_ARG (alertable); + ACE_Time_Value timeout; + if (max_wait_time != 0) + { + timeout = ACE_OS::gettimeofday (); + timeout += *max_wait_time; + } + while (1) + { + int status; + if (max_wait_time == 0) + status = this->ok_to_wait_.wait (); + else + status = this->ok_to_wait_.wait (&timeout); + if (status == -1) + return -1; + // The event is signaled, so it's ok to wait; grab the lock and + // recheck the event. If something has changed, restart the wait. + if (max_wait_time == 0) + status = this->lock_.acquire (); + else + { + status = this->lock_.acquire (timeout); + } + if (status == -1) + return -1; + + // Have the lock_, now re-check the event. If it's not signaled, + // another thread changed something so go back and wait again. + if (this->ok_to_wait_.wait (&ACE_Time_Value::zero, 0) == 0) + break; + this->lock_.release (); + } + return 1; + +#else + int timeout = max_wait_time == 0 ? INFINITE : max_wait_time->msec (); + DWORD result = 0; + while (1) + { +# if defined (ACE_HAS_PHARLAP) + // PharLap doesn't implement WaitForMultipleObjectsEx, and doesn't + // do async I/O, so it's not needed in this case anyway. + result = ::WaitForMultipleObjects (sizeof this->atomic_wait_array_ / sizeof (ACE_HANDLE), + this->atomic_wait_array_, + TRUE, + timeout); + + if (result != WAIT_IO_COMPLETION) + break; + +# else + result = ::WaitForMultipleObjectsEx (sizeof this->atomic_wait_array_ / sizeof (ACE_HANDLE), + this->atomic_wait_array_, + TRUE, + timeout, + alertable); + + if (result != WAIT_IO_COMPLETION) + break; + +# endif /* ACE_HAS_PHARLAP */ + } + + switch (result) + { + case WAIT_TIMEOUT: + errno = ETIME; + return 0; + case WAIT_FAILED: + case WAIT_ABANDONED_0: + ACE_OS::set_errno_to_last_error (); + return -1; + default: + break; + } + + // It is ok to enter ::WaitForMultipleObjects + return 1; +#endif /* ACE_HAS_WINCE */ +} + +DWORD +ACE_WFMO_Reactor::wait_for_multiple_events (int timeout, + int alertable) +{ + // Wait for any of handles_ to be active, or until timeout expires. + // If is enabled allow asynchronous completion of + // ReadFile and WriteFile operations. + +#if defined (ACE_HAS_PHARLAP) || defined (ACE_HAS_WINCE) + // PharLap doesn't do async I/O and doesn't implement + // WaitForMultipleObjectsEx, so use WaitForMultipleObjects. + ACE_UNUSED_ARG (alertable); + return ::WaitForMultipleObjects (this->handler_rep_.max_handlep1 (), + this->handler_rep_.handles (), + FALSE, + timeout); +#else + return ::WaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (), + this->handler_rep_.handles (), + FALSE, + timeout, + alertable); +#endif /* ACE_HAS_PHARLAP */ +} + +DWORD +ACE_WFMO_Reactor::poll_remaining_handles (DWORD slot) +{ + return ::WaitForMultipleObjects (this->handler_rep_.max_handlep1 () - slot, + this->handler_rep_.handles () + slot, + FALSE, + 0); +} + +int +ACE_WFMO_Reactor::calculate_timeout (ACE_Time_Value *max_wait_time) +{ + ACE_Time_Value *time = 0; + if (this->owner_ == ACE_Thread::self ()) + time = this->timer_queue_->calculate_timeout (max_wait_time); + else + time = max_wait_time; + + if (time == 0) + return INFINITE; + else + return time->msec (); +} + + +int +ACE_WFMO_Reactor::expire_timers (void) +{ + // If "owner" thread + if (ACE_Thread::self () == this->owner_) + // expire all pending timers. + return this->timer_queue_->expire (); + + else + // Nothing to expire + return 0; +} + +int +ACE_WFMO_Reactor::dispatch (DWORD wait_status) +{ + // Expire timers + int handlers_dispatched = this->expire_timers (); + + switch (wait_status) + { + case WAIT_FAILED: // Failure. + ACE_OS::set_errno_to_last_error (); + return -1; + + case WAIT_TIMEOUT: // Timeout. + errno = ETIME; + return handlers_dispatched; + +#ifndef ACE_HAS_WINCE + case WAIT_IO_COMPLETION: // APC. + return handlers_dispatched; +#endif // ACE_HAS_WINCE + + default: // Dispatch. + // We'll let dispatch worry about abandoned mutes. + handlers_dispatched += this->dispatch_handles (wait_status); + return handlers_dispatched; + } +} + +// Dispatches any active handles from to +// , polling through our handle set looking +// for active handles. +int +ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status) +{ + // dispatch_slot is the absolute slot. Only += is used to + // increment it. + DWORD dispatch_slot = 0; + + // Cache this value, this is the absolute value. + DWORD const max_handlep1 = this->handler_rep_.max_handlep1 (); + + // nCount starts off at , this is a transient count of + // handles last waited on. + DWORD nCount = max_handlep1; + + for (int number_of_handlers_dispatched = 1; + ; + ++number_of_handlers_dispatched) + { + const bool ok = ( +#if ! defined(__BORLANDC__) \ + && !defined (ghs) \ + && !defined (__MINGW32__) \ + && !defined (_MSC_VER) + // wait_status is unsigned in Borland, Green Hills, + // mingw32 and MSVC++ + // This >= is always true, with a warning. + wait_status >= WAIT_OBJECT_0 && +#endif + wait_status <= (WAIT_OBJECT_0 + nCount)); + + if (ok) + dispatch_slot += wait_status - WAIT_OBJECT_0; + else + // Otherwise, a handle was abandoned. + dispatch_slot += wait_status - WAIT_ABANDONED_0; + + // Dispatch handler + if (this->dispatch_handler (dispatch_slot, max_handlep1) == -1) + return -1; + + // Increment slot + ++dispatch_slot; + + // We're done. + if (dispatch_slot >= max_handlep1) + return number_of_handlers_dispatched; + + // Readjust nCount + nCount = max_handlep1 - dispatch_slot; + + // Check the remaining handles + wait_status = this->poll_remaining_handles (dispatch_slot); + switch (wait_status) + { + case WAIT_FAILED: // Failure. + ACE_OS::set_errno_to_last_error (); + /* FALLTHRU */ + case WAIT_TIMEOUT: + // There are no more handles ready, we can return. + return number_of_handlers_dispatched; + } + } +} + +int +ACE_WFMO_Reactor::dispatch_handler (DWORD slot, + DWORD max_handlep1) +{ + // Check if there are window messages that need to be dispatched + if (slot == max_handlep1) + return this->dispatch_window_messages (); + + // Dispatch the handler if it has not been scheduled for deletion. + // Note that this is a very week test if there are multiple threads + // dispatching this slot as no locks are held here. Generally, you + // do not want to do something like deleting the this pointer in + // handle_close() if you have registered multiple times and there is + // more than one thread in WFMO_Reactor->handle_events(). + else if (!this->handler_rep_.scheduled_for_deletion (slot)) + { + ACE_HANDLE event_handle = *(this->handler_rep_.handles () + slot); + + if (this->handler_rep_.current_info ()[slot].io_entry_) + return this->complex_dispatch_handler (slot, + event_handle); + else + return this->simple_dispatch_handler (slot, + event_handle); + } + else + // The handle was scheduled for deletion, so we will skip it. + return 0; +} + +int +ACE_WFMO_Reactor::simple_dispatch_handler (DWORD slot, + ACE_HANDLE event_handle) +{ + // This dispatch is used for non-I/O entires + + // Assign the ``signaled'' HANDLE so that callers can get it. + // siginfo_t is an ACE - specific fabrication. Constructor exists. + siginfo_t sig (event_handle); + + ACE_Event_Handler *event_handler = + this->handler_rep_.current_info ()[slot].event_handler_; + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + + // Upcall + if (event_handler->handle_signal (0, &sig) == -1) + this->handler_rep_.unbind (event_handle, + ACE_Event_Handler::NULL_MASK); + + // Call remove_reference() if needed. + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + + return 0; +} + +int +ACE_WFMO_Reactor::complex_dispatch_handler (DWORD slot, + ACE_HANDLE event_handle) +{ + // This dispatch is used for I/O entires. + + ACE_WFMO_Reactor_Handler_Repository::Current_Info ¤t_info = + this->handler_rep_.current_info ()[slot]; + + WSANETWORKEVENTS events; + ACE_Reactor_Mask problems = ACE_Event_Handler::NULL_MASK; + if (::WSAEnumNetworkEvents ((SOCKET) current_info.io_handle_, + event_handle, + &events) == SOCKET_ERROR) + problems = ACE_Event_Handler::ALL_EVENTS_MASK; + else + { + // Prepare for upcalls. Clear the bits from representing + // events the handler is not interested in. If there are any left, + // do the upcall(s). upcall will replace events.lNetworkEvents + // with bits representing any functions that requested a repeat + // callback before checking handles again. In this case, continue + // to call back unless the handler is unregistered as a result of + // one of the upcalls. The way this is written, the upcalls will + // keep being done even if one or more upcalls reported problems. + // In practice this may turn out not so good, but let's see. If any + // problems, please notify Steve Huston + // before or after you change this code. + events.lNetworkEvents &= current_info.network_events_; + while (events.lNetworkEvents != 0) + { + ACE_Event_Handler *event_handler = + current_info.event_handler_; + + int reference_counting_required = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + // Call add_reference() if needed. + if (reference_counting_required) + { + event_handler->add_reference (); + } + + // Upcall + problems |= this->upcall (current_info.event_handler_, + current_info.io_handle_, + events); + + // Call remove_reference() if needed. + if (reference_counting_required) + { + event_handler->remove_reference (); + } + + if (this->handler_rep_.scheduled_for_deletion (slot)) + break; + } + } + + if (problems != ACE_Event_Handler::NULL_MASK + && !this->handler_rep_.scheduled_for_deletion (slot) ) + this->handler_rep_.unbind (event_handle, problems); + + return 0; +} + +ACE_Reactor_Mask +ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + WSANETWORKEVENTS &events) +{ + // This method figures out what exactly has happened to the socket + // and then calls appropriate methods. + ACE_Reactor_Mask problems = ACE_Event_Handler::NULL_MASK; + + // Go through the events and do the indicated upcalls. If the handler + // doesn't want to be called back, clear the bit for that event. + // At the end, set the bits back to to request a repeat call. + + long actual_events = events.lNetworkEvents; + int action; + + if (ACE_BIT_ENABLED (actual_events, FD_WRITE)) + { + action = event_handler->handle_output (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_WRITE); + if (action == -1) + ACE_SET_BITS (problems, ACE_Event_Handler::WRITE_MASK); + } + } + + if (ACE_BIT_ENABLED (actual_events, FD_CONNECT)) + { + if (events.iErrorCode[FD_CONNECT_BIT] == 0) + { + // Successful connect + action = event_handler->handle_output (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_CONNECT); + if (action == -1) + ACE_SET_BITS (problems, + ACE_Event_Handler::CONNECT_MASK); + } + } + // Unsuccessful connect + else + { + action = event_handler->handle_input (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_CONNECT); + if (action == -1) + ACE_SET_BITS (problems, + ACE_Event_Handler::CONNECT_MASK); + } + } + } + + if (ACE_BIT_ENABLED (actual_events, FD_OOB)) + { + action = event_handler->handle_exception (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_OOB); + if (action == -1) + ACE_SET_BITS (problems, ACE_Event_Handler::EXCEPT_MASK); + } + } + + if (ACE_BIT_ENABLED (actual_events, FD_READ)) + { + action = event_handler->handle_input (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_READ); + if (action == -1) + ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK); + } + } + + if (ACE_BIT_ENABLED (actual_events, FD_CLOSE) + && ACE_BIT_DISABLED (problems, ACE_Event_Handler::READ_MASK)) + { + action = event_handler->handle_input (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_CLOSE); + if (action == -1) + ACE_SET_BITS (problems, ACE_Event_Handler::READ_MASK); + } + } + + if (ACE_BIT_ENABLED (actual_events, FD_ACCEPT)) + { + action = event_handler->handle_input (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_ACCEPT); + if (action == -1) + ACE_SET_BITS (problems, ACE_Event_Handler::ACCEPT_MASK); + } + } + + if (ACE_BIT_ENABLED (actual_events, FD_QOS)) + { + action = event_handler->handle_qos (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_QOS); + if (action == -1) + ACE_SET_BITS (problems, ACE_Event_Handler::QOS_MASK); + } + } + + if (ACE_BIT_ENABLED (actual_events, FD_GROUP_QOS)) + { + action = event_handler->handle_group_qos (io_handle); + if (action <= 0) + { + ACE_CLR_BITS (actual_events, FD_GROUP_QOS); + if (action == -1) + ACE_SET_BITS (problems, ACE_Event_Handler::GROUP_QOS_MASK); + } + } + + events.lNetworkEvents = actual_events; + return problems; +} + + +int +ACE_WFMO_Reactor::update_state (void) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); + + // Decrement active threads + --this->active_threads_; + + // Check if the state of the handler repository has changed or new + // owner has to be set + if (this->handler_rep_.changes_required () || this->new_owner ()) + { + if (this->change_state_thread_ == 0) + // Try to become the thread which will be responsible for the + // changes + { + this->change_state_thread_ = ACE_Thread::self (); + // Make sure no new threads are allowed to enter + this->ok_to_wait_.reset (); + + if (this->active_threads_ > 0) + // Check for other active threads + { + // Wake up all other threads + this->wakeup_all_threads_.signal (); + // Release + monitor.release (); + // Go to sleep waiting for all other threads to get done + this->waiting_to_change_state_.wait (); + // Re-acquire again + monitor.acquire (); + } + + // Note that make_changes() calls into user code which can + // request other changes. So keep looping until all + // requested changes are completed. + while (this->handler_rep_.changes_required ()) + // Make necessary changes to the handler repository + this->handler_rep_.make_changes (); + if (this->new_owner ()) + // Update the owner + this->change_owner (); + // Turn off + this->wakeup_all_threads_.reset (); + // Let everyone know that it is ok to go ahead + this->ok_to_wait_.signal (); + // Reset this flag + this->change_state_thread_ = 0; + } + else if (this->active_threads_ == 0) + // This thread did not get a chance to become the change + // thread. If it is the last one out, it will wakeup the + // change thread + this->waiting_to_change_state_.signal (); + } + // This is if we were woken up explicitily by the user and there are + // no state changes required. + else if (this->active_threads_ == 0) + // Turn off + this->wakeup_all_threads_.reset (); + + return 0; +} + +void +ACE_WFMO_Reactor::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_WFMO_Reactor::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Count of currently active threads = %d\n"), + this->active_threads_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ID of owner thread = %d\n"), + this->owner_)); + + this->handler_rep_.dump (); + this->signal_handler_->dump (); + this->timer_queue_->dump (); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +int +ACE_WFMO_Reactor_Notify::dispatch_notifications (int & /*number_of_active_handles*/, + ACE_Handle_Set & /*rd_mask*/) +{ + return -1; +} + +int +ACE_WFMO_Reactor_Notify::is_dispatchable (ACE_Notification_Buffer & /*buffer*/) +{ + return 0; +} + +ACE_HANDLE +ACE_WFMO_Reactor_Notify::notify_handle (void) +{ + return ACE_INVALID_HANDLE; +} + +int +ACE_WFMO_Reactor_Notify::read_notify_pipe (ACE_HANDLE , + ACE_Notification_Buffer &) +{ + return 0; +} + +int +ACE_WFMO_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &) +{ + return 0; +} + +int +ACE_WFMO_Reactor_Notify::close (void) +{ + return -1; +} + +ACE_WFMO_Reactor_Notify::ACE_WFMO_Reactor_Notify (size_t max_notifies) + : timer_queue_ (0), + message_queue_ (max_notifies * sizeof (ACE_Notification_Buffer), + max_notifies * sizeof (ACE_Notification_Buffer)), + max_notify_iterations_ (-1) +{ +} + +int +ACE_WFMO_Reactor_Notify::open (ACE_Reactor_Impl *wfmo_reactor, + ACE_Timer_Queue *timer_queue, + int ignore_notify) +{ + ACE_UNUSED_ARG (ignore_notify); + timer_queue_ = timer_queue; + return wfmo_reactor->register_handler (this); +} + +ACE_HANDLE +ACE_WFMO_Reactor_Notify::get_handle (void) const +{ + return this->wakeup_one_thread_.handle (); +} + +// Handle all pending notifications. + +int +ACE_WFMO_Reactor_Notify::handle_signal (int signum, + siginfo_t *siginfo, + ucontext_t *) +{ + ACE_UNUSED_ARG (signum); + + // Just check for sanity... + if (siginfo->si_handle_ != this->wakeup_one_thread_.handle ()) + return -1; + + // This will get called when wakeup_one_thread_> event + // is signaled. + // ACE_DEBUG ((LM_DEBUG, + // ACE_TEXT ("(%t) waking up to handle internal notifications\n"))); + + for (int i = 1; ; ++i) + { + ACE_Message_Block *mb = 0; + // Copy ACE_Time_Value::zero since dequeue_head will modify it. + ACE_Time_Value zero_timeout (ACE_Time_Value::zero); + if (this->message_queue_.dequeue_head (mb, &zero_timeout) == -1) + { + if (errno == EWOULDBLOCK) + // We've reached the end of the processing, return + // normally. + return 0; + else + return -1; // Something weird happened... + } + else + { + ACE_Notification_Buffer *buffer = + reinterpret_cast (mb->base ()); + + // If eh == 0 then we've got major problems! Otherwise, we + // need to dispatch the appropriate handle_* method on the + // ACE_Event_Handler pointer we've been passed. + + if (buffer->eh_ != 0) + { + ACE_Event_Handler *event_handler = + buffer->eh_; + + bool const requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + int result = 0; + + switch (buffer->mask_) + { + case ACE_Event_Handler::READ_MASK: + case ACE_Event_Handler::ACCEPT_MASK: + result = event_handler->handle_input (ACE_INVALID_HANDLE); + break; + case ACE_Event_Handler::WRITE_MASK: + result = event_handler->handle_output (ACE_INVALID_HANDLE); + break; + case ACE_Event_Handler::EXCEPT_MASK: + result = event_handler->handle_exception (ACE_INVALID_HANDLE); + break; + case ACE_Event_Handler::QOS_MASK: + result = event_handler->handle_qos (ACE_INVALID_HANDLE); + break; + case ACE_Event_Handler::GROUP_QOS_MASK: + result = event_handler->handle_group_qos (ACE_INVALID_HANDLE); + break; + default: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("invalid mask = %d\n"), + buffer->mask_)); + break; + } + + if (result == -1) + event_handler->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::EXCEPT_MASK); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } + + // Make sure to delete the memory regardless of success or + // failure! + mb->release (); + + // Bail out if we've reached the . + // Note that by default is -1, so + // we'll loop until we're done. + if (i == this->max_notify_iterations_) + { + // If there are still notification in the queue, we need + // to wake up again + if (!this->message_queue_.is_empty ()) + this->wakeup_one_thread_.signal (); + + // Break the loop as we have reached max_notify_iterations_ + return 0; + } + } + } +} + +// Notify the WFMO_Reactor, potentially enqueueing the +// for subsequent processing in the WFMO_Reactor +// thread of control. + +int +ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + ACE_Time_Value *timeout) +{ + if (event_handler != 0) + { + ACE_Message_Block *mb = 0; + ACE_NEW_RETURN (mb, + ACE_Message_Block (sizeof (ACE_Notification_Buffer)), + -1); + + ACE_Notification_Buffer *buffer = + (ACE_Notification_Buffer *) mb->base (); + buffer->eh_ = event_handler; + buffer->mask_ = mask; + + // Convert from relative time to absolute time by adding the + // current time of day. This is what + // expects. + if (timeout != 0) + *timeout += timer_queue_->gettimeofday (); + + if (this->message_queue_.enqueue_tail + (mb, timeout) == -1) + { + mb->release (); + return -1; + } + + event_handler->add_reference (); + } + + return this->wakeup_one_thread_.signal (); +} + +void +ACE_WFMO_Reactor_Notify::max_notify_iterations (int iterations) +{ + ACE_TRACE ("ACE_WFMO_Reactor_Notify::max_notify_iterations"); + // Must always be > 0 or < 0 to optimize the loop exit condition. + if (iterations == 0) + iterations = 1; + + this->max_notify_iterations_ = iterations; +} + +int +ACE_WFMO_Reactor_Notify::max_notify_iterations (void) +{ + ACE_TRACE ("ACE_WFMO_Reactor_Notify::max_notify_iterations"); + return this->max_notify_iterations_; +} + +int +ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_WFMO_Reactor_Notify::purge_pending_notifications"); + + // Go over message queue and take out all the matching event + // handlers. If eh == 0, purge all. Note that reactor notifies (no + // handler specified) are never purged, as this may lose a needed + // notify the reactor queued for itself. + + if (this->message_queue_.is_empty ()) + return 0; + + // Guard against new and/or delivered notifications while purging. + // WARNING!!! The use of the notification queue's lock object for + // this guard makes use of the knowledge that on Win32, the mutex + // protecting the queue is really a CriticalSection, which is + // recursive. This is how we can get away with locking it down here + // and still calling member functions on the queue object. + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, monitor, this->message_queue_.lock(), -1); + + // first, copy all to our own local queue. Since we've locked everyone out + // of here, there's no need to use any synchronization on this queue. + ACE_Message_Queue local_queue; + + size_t queue_size = this->message_queue_.message_count (); + int number_purged = 0; + + size_t index; + + for (index = 0; index < queue_size; ++index) + { + ACE_Message_Block *mb = 0; + if (-1 == this->message_queue_.dequeue_head (mb)) + return -1; // This shouldn't happen... + + ACE_Notification_Buffer *buffer = + reinterpret_cast (mb->base ()); + + // If this is not a Reactor notify (it is for a particular handler), + // and it matches the specified handler (or purging all), + // and applying the mask would totally eliminate the notification, then + // release it and count the number purged. + if ((0 != buffer->eh_) && + (0 == eh || eh == buffer->eh_) && + ACE_BIT_DISABLED (buffer->mask_, ~mask)) // the existing notification mask + // is left with nothing when + // applying the mask + { + ACE_Event_Handler *event_handler = buffer->eh_; + + event_handler->remove_reference (); + + mb->release (); + ++number_purged; + } + else + { + // To preserve it, move it to the local_queue. But first, if + // this is not a Reactor notify (it is for a + // particularhandler), and it matches the specified handler + // (or purging all), then apply the mask + if ((0 != buffer->eh_) && + (0 == eh || eh == buffer->eh_)) + ACE_CLR_BITS(buffer->mask_, mask); + if (-1 == local_queue.enqueue_head (mb)) + return -1; + } + } + + if (this->message_queue_.message_count ()) + { // Should be empty! + ACE_ASSERT (0); + return -1; + } + + // Now copy back from the local queue to the class queue, taking + // care to preserve the original order... + queue_size = local_queue.message_count (); + for (index = 0; index < queue_size; ++index) + { + ACE_Message_Block *mb = 0; + if (-1 == local_queue.dequeue_head (mb)) + { + ACE_ASSERT (0); + return -1; + } + + if (-1 == this->message_queue_.enqueue_head (mb)) + { + ACE_ASSERT (0); + return -1; + } + } + + return number_purged; +} + +void +ACE_WFMO_Reactor_Notify::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_WFMO_Reactor_Notify::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + this->timer_queue_->dump (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Max. iteration: %d\n"), + this->max_notify_iterations_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +void +ACE_WFMO_Reactor::max_notify_iterations (int iterations) +{ + ACE_TRACE ("ACE_WFMO_Reactor::max_notify_iterations"); + ACE_GUARD (ACE_Process_Mutex, monitor, this->lock_); + + // Must always be > 0 or < 0 to optimize the loop exit condition. + this->notify_handler_->max_notify_iterations (iterations); +} + +int +ACE_WFMO_Reactor::max_notify_iterations (void) +{ + ACE_TRACE ("ACE_WFMO_Reactor::max_notify_iterations"); + ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); + + return this->notify_handler_->max_notify_iterations (); +} + +int +ACE_WFMO_Reactor::purge_pending_notifications (ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_WFMO_Reactor::purge_pending_notifications"); + if (this->notify_handler_ == 0) + return 0; + else + return this->notify_handler_->purge_pending_notifications (eh, mask); +} + +int +ACE_WFMO_Reactor::resumable_handler (void) +{ + ACE_TRACE ("ACE_WFMO_Reactor::resumable_handler"); + return 0; +} + + +// No-op WinSOCK2 methods to help WFMO_Reactor compile +#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) +int +WSAEventSelect (SOCKET /* s */, + WSAEVENT /* hEventObject */, + long /* lNetworkEvents */) +{ + return -1; +} + +int +WSAEnumNetworkEvents (SOCKET /* s */, + WSAEVENT /* hEventObject */, + LPWSANETWORKEVENTS /* lpNetworkEvents */) +{ + return -1; +} +#endif /* !defined ACE_HAS_WINSOCK2 */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_WIN32 */ diff --git a/externals/ace/WFMO_Reactor.h b/externals/ace/WFMO_Reactor.h new file mode 100644 index 0000000..fb3a14d --- /dev/null +++ b/externals/ace/WFMO_Reactor.h @@ -0,0 +1,1368 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file WFMO_Reactor.h + * + * $Id: WFMO_Reactor.h 84727 2009-03-05 19:22:29Z johnnyw $ + * + * @author Irfan Pyarali + * @author Tim Harrison + * @author Doug Schmidt + */ +//============================================================================= + +#ifndef ACE_WFMO_REACTOR_H +#define ACE_WFMO_REACTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_WIN32) + +#include "ace/Signal.h" +#include "ace/Timer_Queue.h" +#include "ace/Event_Handler.h" +#include "ace/Auto_Event.h" +#include "ace/Manual_Event.h" +#include "ace/Condition_Thread_Mutex.h" +#include "ace/Lock_Adapter_T.h" +#include "ace/Reactor_Impl.h" +#include "ace/Message_Queue.h" +#include "ace/Process_Mutex.h" + +// If we don't have WinSOCK2, we need these defined +#if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) +/* + * WinSock 2 extension -- bit values and indices for FD_XXX network events + */ +#define FD_READ_BIT 0 +#define FD_WRITE_BIT 1 +#define FD_OOB_BIT 2 +#define FD_ACCEPT_BIT 3 +#define FD_CONNECT_BIT 4 +#define FD_CLOSE_BIT 5 +#define FD_QOS_BIT 6 +#define FD_GROUP_QOS_BIT 7 + +#define FD_QOS (1 << FD_QOS_BIT) +#define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT) + +#define FD_MAX_EVENTS 8 +#define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1) + +#define WSAEVENT HANDLE + +typedef struct _WSANETWORKEVENTS +{ + long lNetworkEvents; + int iErrorCode[FD_MAX_EVENTS]; +} WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS; + +int WSAEventSelect (SOCKET s, + WSAEVENT hEventObject, + long lNetworkEvents); + +int WSAEnumNetworkEvents (SOCKET s, + WSAEVENT hEventObject, + LPWSANETWORKEVENTS lpNetworkEvents); + +#endif /* !defined ACE_HAS_WINSOCK2 */ + +class ACE_WFMO_Reactor_Test; // Must be out of versioned namespace. + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decl. +class ACE_WFMO_Reactor; +class ACE_Handle_Set; + +/** + * @class ACE_Wakeup_All_Threads_Handler + * + * @brief This is a helper class whose sole purpose is to handle events + * on wakeup_all_threads_> + */ +class ACE_Export ACE_Wakeup_All_Threads_Handler : public ACE_Event_Handler +{ +public: + /// Called when the wakeup_all_threads_> + virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); +}; + +/** + * @class ACE_WFMO_Reactor_Handler_Repository + * + * @internal This class is for internal ACE use only. + * + * @brief Used to map ACE_HANDLEs onto the appropriate + * ACE_Event_Handler * and other information. + */ +class ACE_Export ACE_WFMO_Reactor_Handler_Repository +{ +public: + friend class ACE_WFMO_Reactor; + friend class ACE_WFMO_Reactor_Test; + + /** + * @class Common_Info + * + * @brief This struct contains the necessary information for every + * entry. The reason the event is not in this + * structure is because we need to pass an event array into + * WaitForMultipleObjects and therefore keeping the events + * seperate makes sense. + */ + class Common_Info + { + public: + /// This indicates whether this entry is for I/O or for a regular + /// event + bool io_entry_; + + /// The assosiated + ACE_Event_Handler *event_handler_; + + /// The I/O handle related to the . This entry is + /// only valid if the flag is true. + ACE_HANDLE io_handle_; + + /** + * This is the set of events that the is + * interested in. This entry is only valid if the flag + * is true. + */ + long network_events_; + + /** + * This flag indicates that created the event on + * behalf of the user. Therefore we need to clean this up when the + * removes itself from . This entry + * is only valid if the flag is true. + */ + bool delete_event_; + + /// This is set when the entry needed to be deleted. + bool delete_entry_; + + /** + * These are the masks related to for the + * . This is only valid when is + * set. + */ + ACE_Reactor_Mask close_masks_; + + /// Constructor used for initializing the structure + Common_Info (void); + + /// Reset the state of the structure + void reset (void); + + /// Set the structure to these new values + void set (bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry, + ACE_Reactor_Mask close_masks); + + /// Set the structure to these new values + void set (Common_Info &common_info); + + /// Dump the state of an object. + void dump (void) const; + }; + + /** + * @class Current_Info + * + * @brief This structure inherits from the common structure to add + * information for current entries. + */ + class Current_Info : public Common_Info + { + public: + /// This is set when the entry needed to be suspended. + bool suspend_entry_; + + /// Default constructor + Current_Info (void); + + /// Reset the state of the structure + void reset (void); + + /// Set the structure to these new values + void set (bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry = false, + ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK, + bool suspend_entry = false); + + /// Set the structure to these new values + void set (Common_Info &common_info, + bool suspend_entry = false); + + /// Dump the state of an object. + void dump (ACE_HANDLE event_handle) const; + }; + + /** + * @class To_Be_Added_Info + * + * @brief This structure inherits from the common structure to add + * information for entries. + */ + class To_Be_Added_Info : public Common_Info + { + public: + /// Handle for the event + ACE_HANDLE event_handle_; + + /// This is set when the entry needed to be suspended. + bool suspend_entry_; + + /// Default constructor + To_Be_Added_Info (void); + + /// Reset the state of the structure + void reset (void); + + /// Set the structure to these new values + void set (ACE_HANDLE event_handle, + bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry = false, + ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK, + bool suspend_entry = false); + + /// Set the structure to these new values + void set (ACE_HANDLE event_handle, + Common_Info &common_info, + bool suspend_entry = false); + + /// Dump the state of an object. + void dump (void) const; + }; + + /** + * @class Suspended_Info + * + * @brief This structure inherits from the common structure to add + * information for suspended entries. + */ + class Suspended_Info : public Common_Info + { + public: + /// Handle for the event + ACE_HANDLE event_handle_; + + /// This is set when the entry needed to be resumed. + bool resume_entry_; + + /// Constructor used for initializing the structure + Suspended_Info (void); + + /// Reset the state of the structure + void reset (void); + + /// Set the structure to these new values + void set (ACE_HANDLE event_handle, + bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry = false, + ACE_Reactor_Mask close_masks = 0, + bool resume_entry = false); + + /// Set the structure to these new values + void set (ACE_HANDLE event_handle, + Common_Info &common_info, + bool resume_entry = false); + + /// Dump the state of an object. + void dump (void) const; + }; + + /// Constructor. + ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor); + + /// Destructor. + virtual ~ACE_WFMO_Reactor_Handler_Repository (void); + + /// Initialize the repository of the approriate @a size. + int open (size_t size); + + /// Close down the handler repository. + int close (void); + + // = Search structure operations. + + /// Bind the to the ACE_HANDLE. This is for + /// the simple event entry. + int bind (ACE_HANDLE, ACE_Event_Handler *); + + /// Insert I/O entry into the system. This method + /// assumes that the lock are head *before* this method is invoked. + int bind_i (bool io_entry, + ACE_Event_Handler *event_handler, + long network_events, + ACE_HANDLE io_handle, + ACE_HANDLE event_handle, + bool delete_event); + + /// Remove the binding of ACE_HANDLE in accordance with the @a mask. + int unbind (ACE_HANDLE, + ACE_Reactor_Mask mask); + + /// Non-lock-grabbing version of + int unbind_i (ACE_HANDLE, + ACE_Reactor_Mask mask, + bool &changes_required); + + /// Remove all bindings of tuples. + void unbind_all (void); + + // = Sanity checking. + + // Check the @a handle to make sure it's a valid ACE_HANDLE + int invalid_handle (ACE_HANDLE handle) const; + + // = Accessors. + /// Maximum ACE_HANDLE value, plus 1. + DWORD max_handlep1 (void) const; + + /// Pointer to the beginning of the current array of ACE_HANDLE + /// *'s. + ACE_HANDLE *handles (void) const; + + /// Pointer to the beginning of the current array of + /// ACE_Event_Handler *'s. + Current_Info *current_info (void) const; + + /// Check if changes to the handle set are required. + virtual bool changes_required (void); + + /// Make changes to the handle set + virtual int make_changes (void); + + /// Check to see if @a slot has been scheduled for deletion + int scheduled_for_deletion (size_t slot) const; + + /** + * This method is used to calculate the network mask after a mask_op + * request to . Note that because the + * may already be in the handler repository, we may have to find the + * old event and the old network events + */ + int modify_network_events_i (ACE_HANDLE io_handle, + ACE_Reactor_Mask new_masks, + ACE_Reactor_Mask &old_masks, + long &new_network_events, + ACE_HANDLE &event_handle, + bool &delete_event, + int operation); + + /// This method is used to change the network mask left (if any) + /// after a remove request to + ACE_Reactor_Mask bit_ops (long &existing_masks, + ACE_Reactor_Mask to_be_removed_masks, + int operation); + + /// Temporarily suspend entry + int suspend_handler_i (ACE_HANDLE handle, + bool &changes_required); + + /// Resume suspended entry + int resume_handler_i (ACE_HANDLE handle, + bool &changes_required); + + /// Deletions and suspensions in current_info_ + int make_changes_in_current_infos (void); + + /// Deletions and resumptions in current_suspended_info_ + int make_changes_in_suspension_infos (void); + + /// Deletions in to_be_added_info_, or transfers to current_info_ or + /// current_suspended_info_ from to_be_added_info_ + int make_changes_in_to_be_added_infos (void); + + /// Removes the ACE_Event_Handler at @a slot from the table. + int remove_handler_i (size_t slot, + ACE_Reactor_Mask mask); + + /// Removes the ACE_Event_Handler at @a slot from the table. + int remove_suspended_handler_i (size_t slot, + ACE_Reactor_Mask mask); + + /// Removes the ACE_Event_Handler at @a slot from the table. + int remove_to_be_added_handler_i (size_t slot, + ACE_Reactor_Mask to_be_removed_masks); + + /** + * Return the Event_Handler associated with @a handle. Return 0 if + * @a handle is not registered. + */ + ACE_Event_Handler *find_handler (ACE_HANDLE handle); + + /** + * Check to see if @a handle is associated with a valid Event_Handler + * bound to @a mask. Return the @a event_handler associated with this + * @a handler if @a event_handler != 0. + */ + int handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **event_handler = 0); + + /** + * Check to see if @a handle is associated with a valid + * Event_Handler. Return Event_Handler and associated masks. + */ + ACE_Event_Handler *handler (ACE_HANDLE handle, + long &existing_masks); + + /// Dump the state of an object. + void dump (void) const; + +protected: + /// Reference to our . + ACE_WFMO_Reactor &wfmo_reactor_; + + /// Maximum number of handles. + size_t max_size_; + + /** + * Array of passed to . This + * is not part of the structure as the handle array needs to be + * passed directly to . + */ + ACE_HANDLE *current_handles_; + + /// Array of current entries in the table + Current_Info *current_info_; + + /// A count of the number of active handles. + DWORD max_handlep1_; + + /// Information for entries to be added + To_Be_Added_Info *to_be_added_info_; + + /// Number of records to be added + size_t handles_to_be_added_; + + /// Currently suspended handles + Suspended_Info *current_suspended_info_; + + /// Number of currently suspended handles + size_t suspended_handles_; + + /// Number of records to be suspended + size_t handles_to_be_suspended_; + + /// Number of records to be resumed + size_t handles_to_be_resumed_; + + /// Number of records to be deleted + size_t handles_to_be_deleted_; + +}; + +/** + * @class ACE_WFMO_Reactor_Notify + * + * @brief Unblock the from its event loop, passing + * it an optional ACE_Event_Handler to dispatch. + * + * This implementation is necessary for cases where the + * is run in a multi-threaded program. In + * this case, we need to be able to unblock + * when updates occur other than in the + * main thread. To do this, we signal an + * auto-reset event the is listening on. If + * an ACE_Event_Handler and ACE_Reactor_Mask is passed to + * , the appropriate method is dispatched. + */ +class ACE_Export ACE_WFMO_Reactor_Notify : public ACE_Reactor_Notify +{ +public: + /// Constructor + ACE_WFMO_Reactor_Notify (size_t max_notifies = 1024); + + /// Initialization. is stored to call . + virtual int open (ACE_Reactor_Impl *wfmo_reactor, + ACE_Timer_Queue *timer_queue, + int disable_notify = 0); + + /// No-op. + virtual int close (void); + + /** + * Special trick to unblock when updates + * occur. All we do is enqueue @a event_handler and @a mask onto the + * ACE_Message_Queue and wakeup the by signaling + * its handle. The ACE_Time_Value indicates how long + * to blocking trying to notify the . If @a timeout == + * 0, the caller will block until action is possible, else will wait + * until the relative time specified in @a timeout elapses). + */ + virtual int notify (ACE_Event_Handler *event_handler = 0, + ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value *timeout = 0); + + /// No-op. + virtual int dispatch_notifications (int &number_of_active_handles, + ACE_Handle_Set &rd_mask); + + /// Returns a handle to the . + virtual ACE_HANDLE get_handle (void) const; + + /// Returns the ACE_HANDLE of the notify pipe on which the reactor + /// is listening for notifications so that other threads can unblock + /// the + virtual ACE_HANDLE notify_handle (void); + + /// Handle one of the notify call on the . This could be + /// because of a thread trying to unblock the + virtual int dispatch_notify (ACE_Notification_Buffer &buffer); + + /// Verify whether the buffer has dispatchable info or not. + virtual int is_dispatchable (ACE_Notification_Buffer &buffer); + + /// Read one of the notify call on the @a handle into the + /// . This could be because of a thread trying to unblock + /// the + virtual int read_notify_pipe (ACE_HANDLE handle, + ACE_Notification_Buffer &buffer); + + /** + * Set the maximum number of times that the + * method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify queue before breaking out of its + * loop. By default, this is set to + * -1, which means "iterate until the queue is empty." Setting this + * to a value like "1 or 2" will increase "fairness" (and thus + * prevent starvation) at the expense of slightly higher dispatching + * overhead. + */ + void max_notify_iterations (int); + + /** + * Get the maximum number of times that the + * method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify queue before breaking out of its + * loop. + */ + int max_notify_iterations (void); + + /** + * Purge any notifications pending in this reactor for the specified + * ACE_Event_Handler object. If @a eh == 0, all notifications for all + * handlers are removed (but not any notifications posted just to wake up + * the reactor itself). Returns the number of notifications purged. + * Returns -1 on error. + */ + virtual int purge_pending_notifications (ACE_Event_Handler *, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + /// Dump the state of an object. + virtual void dump (void) const; + +private: + /// Pointer to the wfmo_reactor's timer queue. + ACE_Timer_Queue *timer_queue_; + + /** + * Called when the notification event waited on by + * is signaled. This dequeues all pending + * ACE_Event_Handlers and dispatches them. + */ + virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); + + /// An auto event is used so that we can it to wakeup one + /// thread up (e.g., when the method is called). + ACE_Auto_Event wakeup_one_thread_; + + /// Message queue that keeps track of pending ACE_Event_Handlers. + /// This queue must be thread-safe because it can be called by + /// multiple threads of control. + ACE_Message_Queue message_queue_; + + /** + * Keeps track of the maximum number of times that the + * method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify queue before breaking out of its + * loop. By default, this is set to + * -1, which means "iterate until the queue is empty." + */ + int max_notify_iterations_; +}; + +/** + * @class ACE_WFMO_Reactor + * + * @brief An object oriented event demultiplexor and event handler. + * ACE_WFMO_Reactor is a Windows-only implementation of the ACE_Reactor + * interface that uses the WaitForMultipleObjects() event demultiplexer. + * + * Like the other ACE Reactors, ACE_WFMO_Reactor can schedule timers. + * It also reacts to signalable handles, such as events (see the documentation + * for WaitForMultipleObjects() for a complete list of signalable handle + * types). Therefore, I/O handles are not directly usable for registering + * for input, output, and exception notification. The exception to this + * is ACE_SOCK-based handles, which can be registered for input, output, and + * exception notification just as with other platforms. See Chapter 4 in + * C++NPv2 for complete details. + * + * Note that changes to the state of ACE_WFMO_Reactor are not + * instantaneous. Most changes (registration, removal, + * suspension, and resumption of handles, and changes in + * ownership) are made when the ACE_WFMO_Reactor reaches a stable + * state. Users should be careful, especially when removing + * handlers. This is because the ACE_WFMO_Reactor will call + * handle_close() on the handler when it is finally removed and + * not when remove_handler() is called. If the registered handler's pointer + * is not valid when ACE_WFMO_Reactor calls ACE_Event_Handler::handle_close(), + * use the DONT_CALL flag with remove_handler(). Preferably, use dynamically + * allocated event handlers and call "delete this" inside the handle_close() + * hook method. + * + * Note that although multiple threads can concurrently run the + * ACE_WFMO_Reactor event loop, the concept of the reactor "owner" is still + * important. Only the owner thread can expire timers and wait on the + * notifications handle. Thus, be careful to properly set the owner thread + * when spawning threads to run the event loop while you are using timers + * or notifications. + */ +class ACE_Export ACE_WFMO_Reactor : public ACE_Reactor_Impl +{ +public: + friend class ACE_WFMO_Reactor_Handler_Repository; + friend class ACE_WFMO_Reactor_Test; + + enum + { + /// Default size of the WFMO_Reactor's handle table. + /** + * Two slots will be added to the @a size parameter in the + * constructor and open methods which will store handles used for + * internal management purposes. + */ + DEFAULT_SIZE = MAXIMUM_WAIT_OBJECTS - 2 + }; + + // = Initialization and termination methods. + + /// Initialize ACE_WFMO_Reactor with the default size. + ACE_WFMO_Reactor (ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + ACE_Reactor_Notify * = 0); + + /** + * Initialize ACE_WFMO_Reactor with the specified size. + * + * @param size The maximum number of handles the reactor can + * register. The value should not exceed + * ACE_WFMO_Reactor::DEFAULT_SIZE. Two slots will be + * added to the @a size parameter which will store handles + * used for internal management purposes. + */ + ACE_WFMO_Reactor (size_t size, + int unused = 0, + ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + ACE_Reactor_Notify * = 0); + + /** + * Initialize ACE_WFMO_Reactor with the specified size. + * + * @param size The maximum number of handles the reactor can + * register. The value should not exceed + * ACE_WFMO_Reactor::DEFAULT_SIZE. Two slots will be + * added to the @a size parameter which will store handles + * used for internal management purposes. + */ + virtual int open (size_t size = ACE_WFMO_Reactor::DEFAULT_SIZE, + bool restart = false, + ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + int disable_notify_pipe = 0, + ACE_Reactor_Notify * = 0); + + /// Returns -1 (not used in this implementation); + virtual int current_info (ACE_HANDLE, size_t & /* size */); + + /// Use a user specified signal handler instead. + virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); + + /// Set a user-specified timer queue. + virtual int timer_queue (ACE_Timer_Queue *tq); + + /// Return the current ACE_Timer_Queue. + virtual ACE_Timer_Queue *timer_queue (void) const; + + /// Close down the ACE_WFMO_Reactor and release all of its resources. + virtual int close (void); + + /// Close down the ACE_WFMO_Reactor and release all of its resources. + virtual ~ACE_WFMO_Reactor (void); + + // = Event loop drivers. + + /** + * This method is not currently implemented. We recommend that you + * use handle_events (ACE_Time_Value::zero) to get basically the + * same effect, i.e., it won't block the caller if there are no events. + */ + virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); + + /** + * This event loop driver blocks for up to @a max_wait_time before + * returning. It will return earlier if timer events, I/O events, + * or signal events occur. Note that @a max_wait_time can be 0, in + * which case this method blocks indefinitely until events occur. + * + * @a max_wait_time is decremented to reflect how much time this call + * took. For instance, if a time value of 3 seconds is passed to + * handle_events and an event occurs after 2 seconds, + * @a max_wait_time will equal 1 second. This can be used if an + * application wishes to handle events for some fixed amount of + * time. + * + * is used as the demultiplexing call + * + * Returns the total number of I/O and timer ACE_Event_Handlers + * that were dispatched, 0 if the @a max_wait_time elapsed without + * dispatching any handlers, or -1 if an error occurs. + * + * The only difference between and + * is that in the alertable case, TRUE is passed to + * for the option. + */ + virtual int handle_events (ACE_Time_Value *max_wait_time = 0); + virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); + + /** + * This method is just like the one above, except the + * @a max_wait_time value is a reference and can therefore never be + * NULL. + * + * The only difference between and + * is that in the alertable case, TRUE is passed to + * for the option. + */ + virtual int handle_events (ACE_Time_Value &max_wait_time); + virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); + + + // = Event handling control. + + /** + * Return the status of Reactor. If this function returns 0, the reactor is + * actively handling events. If it returns non-zero, and + * return -1 immediately. + */ + virtual int deactivated (void); + + /** + * Control whether the Reactor will handle any more incoming events or not. + * If == 1, the Reactor will be disabled. By default, a reactor + * is in active state and can be deactivated/reactived as wish. + */ + virtual void deactivate (int do_stop); + + // = Register and remove Handlers. + + /** + * Register an ACE_Event_Handler @a event_handler. Since no Event + * Mask is passed through this interface, it is assumed that the + * @a handle being passed in is an event handle and when the event + * becomes signaled, will call handle_signal on + * @a event_handler. If @a handle == the + * will call the method of + * @a event_handler to extract the underlying event handle. + */ + virtual int register_handler (ACE_Event_Handler *event_handler, + ACE_HANDLE event_handle = ACE_INVALID_HANDLE); + + /** + * Register an ACE_Event_Handler . @a mask specifies + * the network events that the is interested in. If + * == the will + * call the method of to extract the + * underlying I/O handle. If the == + * , WFMO_Reactor will create an event for + * associating it with the I/O handle. When the is + * signalled, the appropriate callback will be invoked on + * the + */ + virtual int register_handler (ACE_HANDLE event_handle, + ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /** + * This is a simple version of the above method + * where the I/O handle is passed in and the event handle will + * always be created by + */ + virtual int register_handler (ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /** + * This is a simple version of the above method + * where the I/O handle will always come from on the + * and the event handle will always be created by + * + */ + virtual int register_handler (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /// Register @a event_handler with all the @a handles in the + /// . + virtual int register_handler (const ACE_Handle_Set &handles, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /** + * Register @a new_sh to handle the signal @a signum using the + * @a new_disp. Returns the @a old_sh that was previously registered + * (if any), along with the @a old_disp of the signal handler. + */ + virtual int register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp = 0, + ACE_Event_Handler **old_sh = 0, + ACE_Sig_Action *old_disp = 0); + + /// Registers @a new_sh to handle a set of signals @a sigset using the + /// @a new_disp. + virtual int register_handler (const ACE_Sig_Set &sigset, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp = 0); + + /** + * Removes @a event_handler from the . Note that + * the will call the method of + * @a event_handler to extract the underlying handle. If @a mask == + * ACE_Event_Handler::DONT_CALL then the method of + * the @a event_handler is not invoked. Note that the @a handle can + * either be the or the + */ + virtual int remove_handler (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /** + * Removes @a handle from the . If @a mask == + * ACE_Event_Handler::DONT_CALL then the method of + * the is not invoked. Note that the @a handle can + * either be the or the + * + * For the case of I/O entries, this removes the @a mask binding of + * whose handle is @a handle from . If + * there are no more bindings for this then it is + * removed from the WFMO_Reactor. For simple event entries, mask is + * mostly ignored and the is always removed from + * + */ + virtual int remove_handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /** + * Removes all the @a mask bindings for handles in the @a handle_set + * bind of . If there are no more bindings for any + * of these handles then they are removed from WFMO_Reactor. + */ + virtual int remove_handler (const ACE_Handle_Set &handle_set, + ACE_Reactor_Mask); + + /** + * Remove the ACE_Event_Handler currently associated with @a signum. + * @a sigkey is ignored in this implementation since there is only + * one instance of a signal handler. Install the new disposition + * (if given) and return the previous disposition (if desired by the + * caller). Returns 0 on success and -1 if @a signum is invalid. + */ + virtual int remove_handler (int signum, + ACE_Sig_Action *new_disp, + ACE_Sig_Action *old_disp = 0, + int sigkey = -1); + + /// Calls for every signal in @a sigset. + virtual int remove_handler (const ACE_Sig_Set &sigset); + + // = Suspend and resume Handlers. + + /// Suspend @a event_handler temporarily. Use + /// to get the handle. + virtual int suspend_handler (ACE_Event_Handler *event_handler); + + /// Suspend @a handle temporarily. + virtual int suspend_handler (ACE_HANDLE handle); + + /// Suspend all @a handles in handle set temporarily. + virtual int suspend_handler (const ACE_Handle_Set &handles); + + /// Suspend all temporarily. + virtual int suspend_handlers (void); + + /// Resume @a event_handler. Use to + /// get the handle. + virtual int resume_handler (ACE_Event_Handler *event_handler); + + /// Resume @a handle. + virtual int resume_handler (ACE_HANDLE handle); + + /// Resume all @a handles in handle set. + virtual int resume_handler (const ACE_Handle_Set &handles); + + /// Resume all . + virtual int resume_handlers (void); + + /// Does the reactor allow the application to resume the handle on + /// its own ie. can it pass on the control of handle resumption to + /// the application. A positive value indicates that the handlers + /// are application resumable. A value of 0 indicates otherwise. + virtual int resumable_handler (void); + + /** + * Return true if we any event associations were made by the reactor + * for the handles that it waits on, false otherwise. Since the + * WFMO_Reactor does use event associations, this function always + * return true. + */ + virtual bool uses_event_associations (void); + + // Timer management. + + /** + * Schedule an ACE_Event_Handler that will expire after an amount + * of time. The return value of this method, a timer_id value, + * uniquely identifies the event_handler in the ACE_Reactor's + * internal list of timers. + * This timer_id value can be used to cancel the timer + * with the cancel_timer() call. + * + * @see cancel_timer() + * @see reset_timer_interval() + * + * @param event_handler event handler to schedule on reactor + * @param arg argument passed to the handle_timeout() method of event_handler + * @param delay time interval after which the timer will expire + * @param interval time interval after which the timer will be automatically rescheduled + * @return -1 on failure, a timer_id value on success + */ + virtual long schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval = ACE_Time_Value::zero); + + /** + * Resets the interval of the timer represented by @a timer_id to + * @a interval, which is specified in relative time to the current + * . If @a interval is equal to + * ACE_Time_Value::zero, the timer will become a non-rescheduling + * timer. Returns 0 if successful, -1 if not. + */ + virtual int reset_timer_interval (long timer_id, + const ACE_Time_Value &interval); + + /// Cancel all Event_Handlers that match the address of + /// @a event_handler. Returns number of handler's cancelled. + virtual int cancel_timer (ACE_Event_Handler *event_handler, + int dont_call_handle_close = 1); + + /** + * Cancel the single Event_Handler that matches the @a timer_id value + * (which was returned from the schedule method). If arg is + * non-NULL then it will be set to point to the ``magic cookie'' + * argument passed in when the Event_Handler was registered. This + * makes it possible to free up the memory and avoid memory leaks. + * Returns 1 if cancellation succeeded and 0 if the @a timer_id + * wasn't found. + */ + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1); + + // = High-level Event_Handler scheduling operations + + /** + * Add @a masks_to_be_added to the @a event_handler's entry in + * WFMO_Reactor. @a event_handler must already have been registered + * with WFMO_Reactor. + */ + virtual int schedule_wakeup (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks_to_be_added); + + /** + * Add @a masks_to_be_added to the @a handle's entry in WFMO_Reactor. + * The Event_Handler associated with @a handle must already have been + * registered with WFMO_Reactor. + */ + virtual int schedule_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask masks_to_be_added); + + /** + * Remove to the 's entry in + * WFMO_Reactor. The Event_Handler associated with must + * already have been registered with WFMO_Reactor. + */ + virtual int cancel_wakeup (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks_to_be_deleted); + + /** + * Remove to the 's entry in + * WFMO_Reactor. The Event_Handler associated with must + * already have been registered with WFMO_Reactor. + */ + virtual int cancel_wakeup (ACE_HANDLE handle, + ACE_Reactor_Mask masks_to_be_deleted); + + // = Notification methods. + + /** + * Wakeup one thread if it is currently blocked + * in . The ACE_Time_Value indicates how + * long to blocking trying to notify the . If + * @a timeout == 0, the caller will block until action is possible, + * else will wait until the relative time specified in @a timeout + * elapses). + */ + virtual int notify (ACE_Event_Handler * = 0, + ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0); + + /** + * Set the maximum number of times that the + * method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify queue before breaking out of its + * loop. By default, this is set to + * -1, which means "iterate until the queue is empty." Setting this + * to a value like "1 or 2" will increase "fairness" (and thus + * prevent starvation) at the expense of slightly higher dispatching + * overhead. + */ + virtual void max_notify_iterations (int); + + /** + * Get the maximum number of times that the + * method will iterate and + * dispatch the ACE_Event_Handlers that are passed in via the + * notify queue before breaking out of its + * loop. + */ + virtual int max_notify_iterations (void); + + /** + * Purge any notifications pending in this reactor for the specified + * ACE_Event_Handler object. Returns the number of notifications + * purged. Returns -1 on error. + */ + virtual int purge_pending_notifications (ACE_Event_Handler * = 0, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + // = Assorted helper methods. + + /** + * Return the Event_Handler associated with . Return 0 if + * is not registered. + */ + ACE_Event_Handler *find_handler (ACE_HANDLE handle); + + /** + * Check to see if is associated with a valid Event_Handler + * bound to @a mask. Return the @a event_handler associated with this + * @a handler if @a event_handler != 0. + */ + virtual int handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **event_handler = 0); + + /** + * Check to see if @a signum is associated with a valid Event_Handler + * bound to a signal. Return the associated with + * this @a handler if != 0. + */ + virtual int handler (int signum, + ACE_Event_Handler ** = 0); + + /// Returns true if WFMO_Reactor has been successfully initialized, else + /// false. + virtual bool initialized (void); + + /// Returns the current size of the WFMO_Reactor's internal + /// descriptor table. + virtual size_t size (void) const; + + /// Returns a reference to the WFMO_Reactor's internal lock. + virtual ACE_Lock &lock (void); + + /// Wake up all threads in WaitForMultipleObjects so that they can + /// reconsult the handle set + virtual void wakeup_all_threads (void); + + /** + * Transfers ownership of the WFMO_Reactor to the @a new_owner. The + * transfer will not complete until all threads are ready (just like + * the handle set). + */ + virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0); + + /// Return the ID of the "owner" thread. + virtual int owner (ACE_thread_t *owner); + + /// Get the existing restart value. + virtual bool restart (void); + + /// Set a new value for restart and return the original value. + virtual bool restart (bool r); + + /// Not implemented + virtual void requeue_position (int); + + /// Not implemented + virtual int requeue_position (void); + + // = Low-level wait_set mask manipulation methods. + + /** + * Modify @a masks of the @a event_handler's entry in WFMO_Reactor + * depending upon . @a event_handler must already have + * been registered with WFMO_Reactor. + */ + virtual int mask_ops (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks, + int operation); + + /** + * Modify @a masks of the 's entry in WFMO_Reactor depending + * upon . must already have been registered + * with WFMO_Reactor. + */ + virtual int mask_ops (ACE_HANDLE handle, + ACE_Reactor_Mask masks, + int ops); + + // = Low-level ready_set mask manipulation methods. + + /// Not implemented + virtual int ready_ops (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + int ops); + + /// Not implemented + virtual int ready_ops (ACE_HANDLE handle, + ACE_Reactor_Mask, + int ops); + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; + + /// Dump the state of an object. + virtual void dump (void) const; + +protected: + /// Registration workhorse + virtual int register_handler_i (ACE_HANDLE event_handle, + ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask); + + /// Event handling workhorse + virtual int event_handling (ACE_Time_Value *max_wait_time = 0, + int alertable = 0); + + /// Bit masking workhorse + virtual int mask_ops_i (ACE_HANDLE io_handle, + ACE_Reactor_Mask masks, + int operation); + + /// Return the ID of the "owner" thread. Does not do any locking. + virtual ACE_thread_t owner_i (void); + + /// Wait up to @a max_wait_time until it's ok to enter + /// WaitForMultipleObjects. Returns 1 (and holding lock_) if ok to wait; + /// -1 (and not holding lock_) if not. + virtual int ok_to_wait (ACE_Time_Value *max_wait_time, + int alertable); + + /// Wait for timer and I/O events to occur. + virtual DWORD wait_for_multiple_events (int timeout, + int alertable); + + /// Check for activity on remaining handles. + virtual DWORD poll_remaining_handles (DWORD slot); + + /// Expire timers. Only the owner thread does useful stuff in this + /// function. + virtual int expire_timers (void); + + /// Dispatches the timers and I/O handlers. + virtual int dispatch (DWORD wait_status); + + /// Protect against structured exceptions caused by user code when + /// dispatching handles + virtual int safe_dispatch (DWORD wait_status); + + /** + * Dispatches any active handles from handles_[@a slot] to + * handles_[active_handles_] using to poll + * through our handle set looking for active handles. + */ + virtual int dispatch_handles (DWORD slot); + + /// Dispatches a single handler. Returns 0 on success, -1 if the + /// handler was removed. + virtual int dispatch_handler (DWORD slot, + DWORD max_handlep1); + + /// Dispatches a single handler. Returns 0 on success, -1 if the + /// handler was removed. + virtual int simple_dispatch_handler (DWORD slot, + ACE_HANDLE event_handle); + + /// Dispatches a single handler. Returns 0 on success, -1 if the + /// handler was removed. + virtual int complex_dispatch_handler (DWORD slot, + ACE_HANDLE event_handle); + + /// Dispatches window messages. Noop for WFMO_Reactor. + virtual int dispatch_window_messages (void); + + virtual ACE_Reactor_Mask upcall (ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + WSANETWORKEVENTS &events); + + /// Used to caluculate the next timeout + virtual int calculate_timeout (ACE_Time_Value *time); + + /// Update the state of the handler repository + virtual int update_state (void); + + /// Check to see if we have a new owner + virtual int new_owner (void); + + /// Set owner to new owner + virtual int change_owner (void); + + /// Handle signals without requiring global/static variables. + ACE_Sig_Handler *signal_handler_; + + /// Keeps track of whether we should delete the signal handler (if we + /// didn't create it, then we don't delete it). + bool delete_signal_handler_; + + /// Defined as a pointer to allow overriding by derived classes... + ACE_Timer_Queue *timer_queue_; + + /// Keeps track of whether we should delete the timer queue (if we + /// didn't create it, then we don't delete it). + bool delete_timer_queue_; + + /// Keeps track of whether we should delete the handler repository + bool delete_handler_rep_; + + /// Used when is called. + ACE_Reactor_Notify *notify_handler_; + + /// Keeps track of whether we should delete the notify handler. + bool delete_notify_handler_; + + /** + * Synchronization for the ACE_WFMO_Reactor. + * + * A Process Mutex is used here because of two reasons: + * (a) The implementation of ACE_Thread_Mutex uses CriticalSections + * CriticalSections are not waitable using ::WaitForMultipleObjects + * (b) This is really not a process mutex because it is not + * named. No other process can use this mutex. + */ + ACE_Process_Mutex lock_; + + /// Adapter used to return internal lock to outside world. + ACE_Lock_Adapter lock_adapter_; + + /// Table that maps to 's. + ACE_WFMO_Reactor_Handler_Repository handler_rep_; + + /// A manual event used to block threads from proceeding into + /// WaitForMultipleObjects + ACE_Manual_Event ok_to_wait_; + + /** + * A manual event is used so that we can wake everyone up (e.g., + * when ACE_Event_Handlers are bounded and unbound from the + * handler repository). + */ + ACE_Manual_Event wakeup_all_threads_; + + /// Used when is signaled + ACE_Wakeup_All_Threads_Handler wakeup_all_threads_handler_; + + /// The changing thread waits on this event, till all threads are not + /// active anymore + ACE_Auto_Event waiting_to_change_state_; + + /// Count of currently active threads + size_t active_threads_; + + /** + * The thread which is "owner" of the WFMO_Reactor. The owner + * concept is used because we don't want multiple threads to try to + * expire timers. Therefore the "owner" thread is the only one + * allowed to expire timers. Also, the owner thread is the only + * thread which waits on the notify handle. Note that the ownership + * can be transferred. + */ + ACE_thread_t owner_; + + /// The owner to be of the WFMO_Reactor + ACE_thread_t new_owner_; + + /// This is the thread which is responsible for the changing the + /// state of the handle set + ACE_thread_t change_state_thread_; + + /// This is an array of ACE_HANDLEs which keep track of the + /// and handles + ACE_HANDLE atomic_wait_array_ [2]; + + /// This flag is used to keep track of whether we are already closed. + bool open_for_business_; + + /// This flag is used to keep track of whether we are actively handling + /// events or not. + sig_atomic_t deactivated_; + +private: + /// Deny access since member-wise won't work... + ACE_WFMO_Reactor (const ACE_WFMO_Reactor &); + ACE_WFMO_Reactor &operator = (const ACE_WFMO_Reactor &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/WFMO_Reactor.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_WIN32 */ +#include /**/ "ace/post.h" +#endif /* ACE_WFMO_REACTOR_H */ diff --git a/externals/ace/WFMO_Reactor.inl b/externals/ace/WFMO_Reactor.inl new file mode 100644 index 0000000..6d3e43d --- /dev/null +++ b/externals/ace/WFMO_Reactor.inl @@ -0,0 +1,1202 @@ +// -*- C++ -*- +// +// $Id: WFMO_Reactor.inl 82949 2008-10-06 22:32:10Z shuston $ + +#include "ace/Handle_Set.h" +#include "ace/Reactor.h" +#include "ace/Thread.h" +#include "ace/Sig_Handler.h" +#include "ace/OS_NS_errno.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/************************************************************/ + +ACE_INLINE int +ACE_Wakeup_All_Threads_Handler::handle_signal (int /* signum */, + siginfo_t * /* siginfo */, + ucontext_t *) +{ + // This will get called when wakeup_all_threads_> event + // is signaled. There is nothing to be done here. + // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waking up to get updated handle set info\n"))); + return 0; +} + +#if defined (ACE_WIN32) + +/************************************************************/ + +ACE_INLINE +ACE_WFMO_Reactor_Handler_Repository::Common_Info::Common_Info (void) + : io_entry_ (false), + event_handler_ (0), + io_handle_ (ACE_INVALID_HANDLE), + network_events_ (0), + delete_event_ (false), + delete_entry_ (false), + close_masks_ (ACE_Event_Handler::NULL_MASK) +{ +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Common_Info::reset (void) +{ + this->event_handler_ = 0; + this->io_entry_ = false; + this->io_handle_ = ACE_INVALID_HANDLE; + this->network_events_ = 0; + this->delete_event_ = false; + this->delete_entry_ = false; + this->close_masks_ = ACE_Event_Handler::NULL_MASK; +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry, + ACE_Reactor_Mask close_masks) +{ + this->event_handler_ = event_handler; + this->io_entry_ = io_entry; + this->io_handle_ = io_handle; + this->network_events_ = network_events; + this->delete_event_ = delete_event; + this->delete_entry_ = delete_entry; + this->close_masks_ = close_masks; +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (Common_Info &common_info) +{ + *this = common_info; +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("I/O Entry = %d\n"), + this->io_entry_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Event Handler = %d\n"), + this->event_handler_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("I/O Handle = %d\n"), + this->io_handle_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Network Events = %d\n"), + this->network_events_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Delete Event = %d\n"), + this->delete_event_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Delete Entry = %d\n"), + this->delete_entry_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Close Masks = %d\n"), + this->close_masks_)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +/************************************************************/ + +ACE_INLINE +ACE_WFMO_Reactor_Handler_Repository::Current_Info::Current_Info (void) + : suspend_entry_ (false) +{ +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry, + ACE_Reactor_Mask close_masks, + bool suspend_entry) +{ + this->suspend_entry_ = suspend_entry; + Common_Info::set (io_entry, + event_handler, + io_handle, + network_events, + delete_event, + delete_entry, + close_masks); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (Common_Info &common_info, + bool suspend_entry) +{ + this->suspend_entry_ = suspend_entry; + Common_Info::set (common_info); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Current_Info::reset (void) +{ + this->suspend_entry_ = false; + Common_Info::reset (); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump (ACE_HANDLE event_handle) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + Common_Info::dump (); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Event Handle = %d\n"), + event_handle)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Suspend Entry = %d\n"), + this->suspend_entry_)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#else /* !ACE_HAS_DUMP */ + ACE_UNUSED_ARG (event_handle); +#endif /* ACE_HAS_DUMP */ +} + +/************************************************************/ + +ACE_INLINE +ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::To_Be_Added_Info (void) + : event_handle_ (ACE_INVALID_HANDLE), + suspend_entry_ (false) +{ +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle, + bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry, + ACE_Reactor_Mask close_masks, + bool suspend_entry) +{ + this->event_handle_ = event_handle; + this->suspend_entry_ = suspend_entry; + Common_Info::set (io_entry, + event_handler, + io_handle, + network_events, + delete_event, + delete_entry, + close_masks); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle, + Common_Info &common_info, + bool suspend_entry) +{ + this->event_handle_ = event_handle; + this->suspend_entry_ = suspend_entry; + Common_Info::set (common_info); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset (void) +{ + this->event_handle_ = ACE_INVALID_HANDLE; + this->suspend_entry_ = false; + Common_Info::reset (); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + Common_Info::dump (); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Event Handle = %d\n"), + this->event_handle_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Suspend Entry = %d\n"), + this->suspend_entry_)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +/************************************************************/ + +ACE_INLINE +ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::Suspended_Info (void) + : event_handle_ (ACE_INVALID_HANDLE), + resume_entry_ (false) +{ +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::reset (void) +{ + this->event_handle_ = ACE_INVALID_HANDLE; + this->resume_entry_ = false; + Common_Info::reset (); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle, + bool io_entry, + ACE_Event_Handler *event_handler, + ACE_HANDLE io_handle, + long network_events, + bool delete_event, + bool delete_entry, + ACE_Reactor_Mask close_masks, + bool resume_entry) +{ + this->event_handle_ = event_handle; + this->resume_entry_ = resume_entry; + Common_Info::set (io_entry, + event_handler, + io_handle, + network_events, + delete_event, + delete_entry, + close_masks); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle, + Common_Info &common_info, + bool resume_entry) +{ + this->event_handle_ = event_handle; + this->resume_entry_ = resume_entry; + Common_Info::set (common_info); +} + +ACE_INLINE void +ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + + Common_Info::dump (); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Event Handle = %d\n"), + this->event_handle_)); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Resume Entry = %d\n"), + this->resume_entry_)); + + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +/************************************************************/ + +ACE_INLINE int +ACE_WFMO_Reactor_Handler_Repository::close (void) +{ + // Let all the handlers know that the is closing down + this->unbind_all (); + + return 0; +} + +ACE_INLINE ACE_HANDLE * +ACE_WFMO_Reactor_Handler_Repository::handles (void) const +{ + // This code is probably too subtle to be useful in the long run... + // The basic idea is that all threads wait on all user handles plus + // the handle. The owner thread additional + // waits on the handle. This is to ensure that only the + // thread get to expire timers and handle event on the + // notify pipe. + if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) + return this->current_handles_; + else + return this->current_handles_ + 1; +} + +ACE_INLINE ACE_WFMO_Reactor_Handler_Repository::Current_Info * +ACE_WFMO_Reactor_Handler_Repository::current_info (void) const +{ + if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) + return this->current_info_; + else + return this->current_info_ + 1; +} + +ACE_INLINE DWORD +ACE_WFMO_Reactor_Handler_Repository::max_handlep1 (void) const +{ + if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) + return this->max_handlep1_; + else + return this->max_handlep1_ - 1; +} + +ACE_INLINE int +ACE_WFMO_Reactor_Handler_Repository::scheduled_for_deletion (size_t slot) const +{ + if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) + return this->current_info_[slot].delete_entry_ == true; + else + return this->current_info_[slot + 1].delete_entry_ == true; +} + +ACE_INLINE int +ACE_WFMO_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle) const +{ + ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::invalid_handle"); + // It's too expensive to perform more exhaustive validity checks on + // Win32 due to the way that they implement SOCKET HANDLEs. + if (handle == ACE_INVALID_HANDLE) + { + errno = EINVAL; + return 1; + } + else + return 0; +} + +ACE_INLINE bool +ACE_WFMO_Reactor_Handler_Repository::changes_required (void) +{ + // Check if handles have be scheduled for additions or removal + return this->handles_to_be_added_ > 0 + || this->handles_to_be_deleted_ > 0 + || this->handles_to_be_suspended_ > 0 + || this->handles_to_be_resumed_ > 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor_Handler_Repository::make_changes (void) +{ + // This method must ONLY be called by the + // change_state_thread_>. We therefore assume that + // there will be no contention for this method and hence no guards + // are neccessary. + + // Deletions and suspensions in current_info_ + this->make_changes_in_current_infos (); + + // Deletions and resumptions in current_suspended_info_ + this->make_changes_in_suspension_infos (); + + // Deletions in to_be_added_info_, or transfers to current_info_ or + // current_suspended_info_ from to_be_added_info_ + this->make_changes_in_to_be_added_infos (); + + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + if (this->invalid_handle (handle)) + return -1; + + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1); + + bool changes_required = false; + int const result = this->unbind_i (handle, + mask, + changes_required); + + if (changes_required) + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wfmo_reactor_.wakeup_all_threads (); + + return result; +} + +ACE_INLINE int +ACE_WFMO_Reactor::reset_timer_interval + (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_WFMO_Reactor::reset_timer_interval"); + + if (0 != this->timer_queue_) + { + long result = this->timer_queue_->reset_interval + (timer_id, + interval); + + // Wakeup the owner thread so that it gets the latest timer values + this->notify (); + + return result; + } + + errno = ESHUTDOWN; + return -1; +} + +ACE_INLINE long +ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler, + const void *arg, + const ACE_Time_Value &delay_time, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_WFMO_Reactor::schedule_timer"); + + if (0 != this->timer_queue_) + { + long result = this->timer_queue_->schedule + (handler, + arg, + timer_queue_->gettimeofday () + delay_time, + interval); + + // Wakeup the owner thread so that it gets the latest timer values + this->notify (); + + return result; + } + + errno = ESHUTDOWN; + return -1; +} + +ACE_INLINE int +ACE_WFMO_Reactor::cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer"); + if (0 != this->timer_queue_) + return this->timer_queue_->cancel (handler, dont_call_handle_close); + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::cancel_timer (long timer_id, + const void **arg, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer"); + if (0 != this->timer_queue_) + return this->timer_queue_->cancel (timer_id, arg, dont_call_handle_close); + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler, + ACE_HANDLE event_handle) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->handler_rep_.bind_i (0, + event_handler, + 0, + ACE_INVALID_HANDLE, + event_handle, + 0); +} + +ACE_INLINE int +ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->register_handler_i (ACE_INVALID_HANDLE, + ACE_INVALID_HANDLE, + event_handler, + mask); +} + +ACE_INLINE int +ACE_WFMO_Reactor::register_handler (ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->register_handler_i (ACE_INVALID_HANDLE, + io_handle, + event_handler, + mask); +} + +ACE_INLINE int +ACE_WFMO_Reactor::register_handler (ACE_HANDLE event_handle, + ACE_HANDLE io_handle, + ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->register_handler_i (event_handle, + io_handle, + event_handler, + mask); +} + +ACE_INLINE int +ACE_WFMO_Reactor::register_handler (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->register_handler_i (h, + ACE_INVALID_HANDLE, + handler, + mask) == -1) + return -1; + + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::schedule_wakeup (ACE_HANDLE io_handle, + ACE_Reactor_Mask masks_to_be_added) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->mask_ops_i (io_handle, + masks_to_be_added, + ACE_Reactor::ADD_MASK); +} + +ACE_INLINE int +ACE_WFMO_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks_to_be_added) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->mask_ops_i (event_handler->get_handle (), + masks_to_be_added, + ACE_Reactor::ADD_MASK); +} + +ACE_INLINE int +ACE_WFMO_Reactor::cancel_wakeup (ACE_HANDLE io_handle, + ACE_Reactor_Mask masks_to_be_removed) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->mask_ops_i (io_handle, + masks_to_be_removed, + ACE_Reactor::CLR_MASK); +} + +ACE_INLINE int +ACE_WFMO_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks_to_be_removed) +{ + // This GUARD is necessary since we are updating shared state. + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->mask_ops_i (event_handler->get_handle (), + masks_to_be_removed, + ACE_Reactor::CLR_MASK); +} + +ACE_INLINE int +ACE_WFMO_Reactor::remove_handler (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask) +{ + return this->handler_rep_.unbind (event_handler->get_handle (), + mask); +} + +ACE_INLINE int +ACE_WFMO_Reactor::remove_handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + return this->handler_rep_.unbind (handle, + mask); +} + +ACE_INLINE int +ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask) +{ + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + bool changes_required = false; + + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->handler_rep_.unbind_i (h, + mask, + changes_required) == -1) + return -1; + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wakeup_all_threads (); + + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + bool changes_required = false; + int const result = + this->handler_rep_.suspend_handler_i (handle, + changes_required); + + if (changes_required) + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wakeup_all_threads (); + + return result; +} + +ACE_INLINE int +ACE_WFMO_Reactor::suspend_handler (ACE_Event_Handler *event_handler) +{ + return this->suspend_handler (event_handler->get_handle ()); +} + +ACE_INLINE int +ACE_WFMO_Reactor::suspend_handler (const ACE_Handle_Set &handles) +{ + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + bool changes_required = false; + + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->handler_rep_.suspend_handler_i (h, + changes_required) == -1) + return -1; + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wakeup_all_threads (); + + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::suspend_handlers (void) +{ + bool error = false; + int result = 0; + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + // First suspend all current handles + bool changes_required = false; + + // Skip over the notify and wakeup_all_threads handles. These are registered + // by ACE_WFMO_Reactor::open(), not by users, and should not be suspended. + for (size_t i = 2; + i < this->handler_rep_.max_handlep1_ && !error; + i++) + { + result = + this->handler_rep_.suspend_handler_i (this->handler_rep_.current_handles_[i], + changes_required); + if (result == -1) + error = true; + } + + // Then suspend all to_be_added_handles + for (size_t i = 0; + i < this->handler_rep_.handles_to_be_added_ && !error; + i++) + { + if (this->handler_rep_.to_be_added_info_[i].io_entry_) + { + result = + this->handler_rep_.suspend_handler_i (this->handler_rep_.to_be_added_info_[i].io_handle_, + changes_required); + } + else + { + result = + this->handler_rep_.suspend_handler_i (this->handler_rep_.to_be_added_info_[i].event_handle_, + changes_required); + } + if (result == -1) + error = true; + } + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wakeup_all_threads (); + + return error ? -1 : 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::resume_handler (ACE_HANDLE handle) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + bool changes_required = false; + int result = + this->handler_rep_.resume_handler_i (handle, changes_required); + + if (changes_required) + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wakeup_all_threads (); + + return result; +} + +ACE_INLINE int +ACE_WFMO_Reactor::resume_handler (ACE_Event_Handler *event_handler) +{ + return this->resume_handler (event_handler->get_handle ()); +} + +ACE_INLINE int +ACE_WFMO_Reactor::resume_handler (const ACE_Handle_Set &handles) +{ + ACE_Handle_Set_Iterator handle_iter (handles); + ACE_HANDLE h; + bool changes_required = false; + + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + while ((h = handle_iter ()) != ACE_INVALID_HANDLE) + if (this->handler_rep_.resume_handler_i (h, + changes_required) == -1) + return -1; + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wakeup_all_threads (); + + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::resume_handlers (void) +{ + bool error = false; + int result = 0; + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + bool changes_required = false; + for (size_t i = 0; + i < this->handler_rep_.suspended_handles_ && !error; + i++) + { + result = + this->handler_rep_.resume_handler_i (this->handler_rep_.current_suspended_info_[i].event_handle_, + changes_required); + if (result == -1) + error = true; + } + + // Then resume all to_be_added_handles + for (size_t i = 0; + i < this->handler_rep_.handles_to_be_added_ && !error; + i++) + { + if (this->handler_rep_.to_be_added_info_[i].io_entry_) + { + result = + this->handler_rep_.resume_handler_i (this->handler_rep_.to_be_added_info_[i].io_handle_, + changes_required); + } + else + { + result = + this->handler_rep_.resume_handler_i (this->handler_rep_.to_be_added_info_[i].event_handle_, + changes_required); + } + if (result == -1) + error = true; + } + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the handle set + this->wakeup_all_threads (); + + return error ? -1 : 0; +} + +ACE_INLINE bool +ACE_WFMO_Reactor::uses_event_associations (void) +{ + // Since the WFMO_Reactor does use event associations, this function + // always return 1. + return true; +} + +ACE_INLINE int +ACE_WFMO_Reactor::handle_events (ACE_Time_Value &how_long) +{ + return this->event_handling (&how_long, FALSE); +} + +ACE_INLINE int +ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value &how_long) +{ + return this->event_handling (&how_long, TRUE); +} + +ACE_INLINE int +ACE_WFMO_Reactor::handle_events (ACE_Time_Value *how_long) +{ + return this->event_handling (how_long, FALSE); +} + +ACE_INLINE int +ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value *how_long) +{ + return this->event_handling (how_long, TRUE); +} + +ACE_INLINE int +ACE_WFMO_Reactor::deactivated (void) +{ + return this->deactivated_; +} + +ACE_INLINE void +ACE_WFMO_Reactor::deactivate (int do_stop) +{ + this->deactivated_ = do_stop; + this->wakeup_all_threads (); +} + +ACE_INLINE int +ACE_WFMO_Reactor::owner (ACE_thread_t *t) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + *t = this->owner_i (); + return 0; +} + +ACE_INLINE ACE_thread_t +ACE_WFMO_Reactor::owner_i (void) +{ + return this->owner_; +} + +ACE_INLINE int +ACE_WFMO_Reactor::owner (ACE_thread_t new_owner, ACE_thread_t *old_owner) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); + this->new_owner_ = new_owner; + + if (old_owner != 0) + *old_owner = this->owner_i (); + + // Wake up all threads in WaitForMultipleObjects so that they can + // reconsult the new owner responsibilities + this->wakeup_all_threads (); + + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::new_owner (void) +{ + return this->new_owner_ != ACE_thread_t (0); +} + +ACE_INLINE int +ACE_WFMO_Reactor::change_owner (void) +{ + this->owner_ = this->new_owner_; + this->new_owner_ = ACE_thread_t (0); + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::safe_dispatch (DWORD wait_status) +{ + int result = -1; + ACE_SEH_TRY + { + result = this->dispatch (wait_status); + } + ACE_SEH_FINALLY + { + this->update_state (); + } + + return result; +} + +ACE_INLINE int +ACE_WFMO_Reactor::dispatch_window_messages (void) +{ + return 0; +} + +ACE_INLINE void +ACE_WFMO_Reactor::wakeup_all_threads (void) +{ + this->wakeup_all_threads_.signal (); +} + +ACE_INLINE int +ACE_WFMO_Reactor::notify (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + ACE_Time_Value *timeout) +{ + return this->notify_handler_->notify (event_handler, mask, timeout); +} + +ACE_INLINE int +ACE_WFMO_Reactor::register_handler (int signum, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp, + ACE_Event_Handler **old_sh, + ACE_Sig_Action *old_disp) +{ + return this->signal_handler_->register_handler (signum, + new_sh, new_disp, + old_sh, old_disp); +} + +ACE_INLINE int +ACE_WFMO_Reactor::register_handler (const ACE_Sig_Set &sigset, + ACE_Event_Handler *new_sh, + ACE_Sig_Action *new_disp) +{ + int result = 0; + +#if (ACE_NSIG > 0) + for (int s = 1; s < ACE_NSIG; s++) + if (sigset.is_member (s) + && this->signal_handler_->register_handler (s, + new_sh, + new_disp) == -1) + result = -1; +#else + ACE_UNUSED_ARG (sigset); + ACE_UNUSED_ARG (new_sh); + ACE_UNUSED_ARG (new_disp); +#endif /* ACE_NSIG */ + + return result; +} + +ACE_INLINE int +ACE_WFMO_Reactor::remove_handler (int signum, + ACE_Sig_Action *new_disp, + ACE_Sig_Action *old_disp, + int sigkey) +{ + return this->signal_handler_->remove_handler (signum, + new_disp, + old_disp, + sigkey); +} + +ACE_INLINE int +ACE_WFMO_Reactor::remove_handler (const ACE_Sig_Set &sigset) +{ + int result = 0; + +#if (ACE_NSIG > 0) + for (int s = 1; s < ACE_NSIG; s++) + if (sigset.is_member (s) + && this->signal_handler_->remove_handler (s) == -1) + result = -1; +#else + ACE_UNUSED_ARG (sigset); +#endif /* ACE_NSIG */ + + return result; +} + +ACE_INLINE int +ACE_WFMO_Reactor::handler (int signum, ACE_Event_Handler **eh) +{ + ACE_Event_Handler *handler = + this->signal_handler_->handler (signum); + + if (handler == 0) + return -1; + else if (eh != 0) + *eh = handler; + return 0; +} + +ACE_INLINE int +ACE_WFMO_Reactor::mask_ops (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + int operation) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); + + return this->mask_ops_i (event_handler->get_handle (), + mask, + operation); +} + +ACE_INLINE int +ACE_WFMO_Reactor::mask_ops (ACE_HANDLE io_handle, + ACE_Reactor_Mask mask, + int operation) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); + + return this->mask_ops_i (io_handle, + mask, + operation); +} + +ACE_INLINE void +ACE_WFMO_Reactor::requeue_position (int) +{ + // Not implemented +} + +ACE_INLINE int +ACE_WFMO_Reactor::requeue_position (void) +{ + // Don't have an implementation for this yet... + ACE_NOTSUP_RETURN (-1); +} + +ACE_INLINE bool +ACE_WFMO_Reactor::restart (void) +{ + return false; +} + +ACE_INLINE bool +ACE_WFMO_Reactor::restart (bool) +{ + return false; +} + +ACE_INLINE int +ACE_WFMO_Reactor::ready_ops (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask mask, + int ops) +{ + // Don't have an implementation for this yet... + ACE_UNUSED_ARG (event_handler); + ACE_UNUSED_ARG (mask); + ACE_UNUSED_ARG (ops); + ACE_NOTSUP_RETURN (-1); +} + +ACE_INLINE int +ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle, + ACE_Reactor_Mask, + int ops) +{ + // Don't have an implementation for this yet... + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (ops); + ACE_NOTSUP_RETURN (-1); +} + +ACE_INLINE ACE_Event_Handler * +ACE_WFMO_Reactor::find_handler (ACE_HANDLE handle) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, 0); + + return this->handler_rep_.find_handler (handle); +} + +ACE_INLINE int +ACE_WFMO_Reactor::handler (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Event_Handler **event_handler) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + + return this->handler_rep_.handler (handle, + mask, + event_handler); +} + +ACE_INLINE bool +ACE_WFMO_Reactor::initialized (void) +{ + return this->open_for_business_; +} + +ACE_INLINE ACE_Lock & +ACE_WFMO_Reactor::lock (void) +{ + return this->lock_adapter_; +} + +ACE_INLINE size_t +ACE_WFMO_Reactor::size (void) const +{ + // Size of repository minus the 2 used for internal purposes + return this->handler_rep_.max_size_ - 2; +} +#else +ACE_INLINE bool +ACE_WFMO_Reactor_Handler_Repository::changes_required (void) +{ + return false; +} + +ACE_INLINE int +ACE_WFMO_Reactor_Handler_Repository::make_changes (void) +{ + return 0; +} + +ACE_INLINE +ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void) +{ +} + +#endif /* ACE_WIN32 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/WIN32_Asynch_IO.cpp b/externals/ace/WIN32_Asynch_IO.cpp new file mode 100644 index 0000000..3dd6efc --- /dev/null +++ b/externals/ace/WIN32_Asynch_IO.cpp @@ -0,0 +1,3782 @@ +// $Id: WIN32_Asynch_IO.cpp 89454 2010-03-11 09:35:25Z johnnyw $ + +#include "ace/WIN32_Asynch_IO.h" + +ACE_RCSID (ace, + Win32_Asynch_IO, + "$Id: WIN32_Asynch_IO.cpp 89454 2010-03-11 09:35:25Z johnnyw $") + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) && \ + (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 1)) + +#include "ace/WIN32_Proactor.h" +#include "ace/Proactor.h" +#include "ace/Message_Block.h" +#include "ace/Service_Config.h" +#include "ace/INET_Addr.h" +#include "ace/Task_T.h" +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_sys_socket.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +size_t +ACE_WIN32_Asynch_Result::bytes_transferred (void) const +{ + return this->bytes_transferred_; +} + +const void * +ACE_WIN32_Asynch_Result::act (void) const +{ + return this->act_; +} + +int +ACE_WIN32_Asynch_Result::success (void) const +{ + return this->success_; +} + +const void * +ACE_WIN32_Asynch_Result::completion_key (void) const +{ + return this->completion_key_; +} + +u_long +ACE_WIN32_Asynch_Result::error (void) const +{ + return this->error_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Result::event (void) const +{ + return this->hEvent; +} + +u_long +ACE_WIN32_Asynch_Result::offset (void) const +{ + return this->Offset; +} + +u_long +ACE_WIN32_Asynch_Result::offset_high (void) const +{ + return this->OffsetHigh; +} + +int +ACE_WIN32_Asynch_Result::priority (void) const +{ + ACE_NOTSUP_RETURN (0); +} + +int +ACE_WIN32_Asynch_Result::signal_number (void) const +{ + ACE_NOTSUP_RETURN (0); +} + +int +ACE_WIN32_Asynch_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + // Get to the platform specific implementation. + ACE_WIN32_Proactor *win32_proactor = dynamic_cast (proactor); + + if (win32_proactor == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Dynamic cast to WIN32 Proactor failed\n")), + -1); + + // Post myself. + return win32_proactor->post_completion (this); +} + +void +ACE_WIN32_Asynch_Result::set_bytes_transferred (size_t nbytes) +{ + this->bytes_transferred_ = nbytes; +} + +void +ACE_WIN32_Asynch_Result::set_error (u_long errcode) +{ + this->error_ = errcode; +} + +ACE_WIN32_Asynch_Result::~ACE_WIN32_Asynch_Result (void) +{ +} + +ACE_WIN32_Asynch_Result::ACE_WIN32_Asynch_Result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + const void* act, + ACE_HANDLE event, + u_long offset, + u_long offset_high, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + OVERLAPPED (), + handler_proxy_ (handler_proxy), + act_ (act), + bytes_transferred_ (0), + success_ (0), + completion_key_ (0), + error_ (0) +{ + // Set the ACE_OVERLAPPED structure + this->Internal = 0; + this->InternalHigh = 0; + this->Offset = offset; + this->OffsetHigh = offset_high; + this->hEvent = event; + + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (signal_number); +} + +int +ACE_WIN32_Asynch_Operation::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + this->proactor_ = proactor; + this->handler_proxy_ = handler_proxy; + this->handle_ = handle; + + // Grab the handle from the if is invalid + if (this->handle_ == ACE_INVALID_HANDLE) + { + ACE_Handler *handler = handler_proxy.get ()->handler (); + if (handler != 0) + this->handle_ = handler->handle (); + } + if (this->handle_ == ACE_INVALID_HANDLE) + return -1; + + if (this->proactor_!= 0) + // update implementation. + this->win32_proactor_ = + dynamic_cast (this->proactor_->implementation ()); + + // Register with the . + return this->win32_proactor_->register_handle (this->handle_, + completion_key); +} + +int +ACE_WIN32_Asynch_Operation::cancel (void) +{ +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) + // All I/O operations that are canceled will complete with the error + // ERROR_OPERATION_ABORTED. All completion notifications for the I/O + // operations will occur normally. + + // @@ This API returns 0 on failure. So, I am returning -1 in that + // case. Is that right? (Alex). + int const result = (int) ::CancelIo (this->handle_); + + if (result == 0) + // Couldn't cancel the operations. + return 2; + + // result is non-zero. All the operations are cancelled then. + return 0; + +#else /* !ACE_HAS_WIN32_OVERLAPPED_IO */ + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_AIO_CALLS */ +} + +ACE_Proactor * +ACE_WIN32_Asynch_Operation::proactor (void) const +{ + return this->proactor_; +} + +ACE_WIN32_Asynch_Operation::ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + win32_proactor_ (win32_proactor), + proactor_ (0), + handle_ (ACE_INVALID_HANDLE) +{ +} + +ACE_WIN32_Asynch_Operation::~ACE_WIN32_Asynch_Operation (void) +{ +} + +// ************************************************************ + +size_t +ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read (void) const +{ + return this->bytes_to_read_; +} + +ACE_Message_Block & +ACE_WIN32_Asynch_Read_Stream_Result::message_block (void) const +{ + return this->message_block_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Read_Stream_Result::handle (void) const +{ + return this->handle_; +} + +ACE_WIN32_Asynch_Read_Stream_Result::ACE_WIN32_Asynch_Read_Stream_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number, + int scatter_enabled) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Read_Stream_Result_Impl (), + ACE_WIN32_Asynch_Result (handler_proxy, + act, + event, + 0, + 0, + priority, + signal_number), + bytes_to_read_ (bytes_to_read), + message_block_ (message_block), + handle_ (handle), + scatter_enabled_ (scatter_enabled) +{ +} + +void +ACE_WIN32_Asynch_Read_Stream_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by GetQueuedCompletionStatus + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Appropriately move the pointers in the message block. + if (!this->scatter_enabled ()) + this->message_block_.wr_ptr (bytes_transferred); + else + { + for (ACE_Message_Block* mb = &this->message_block_; + (mb != 0) && (bytes_transferred > 0); + mb = mb->cont ()) + { + size_t len_part = mb->space (); + + if (len_part > bytes_transferred) + len_part = bytes_transferred; + + mb->wr_ptr (len_part); + + bytes_transferred -= len_part; + } + } + + // Create the interface result class. + ACE_Asynch_Read_Stream::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_stream (result); +} + +ACE_WIN32_Asynch_Read_Stream_Result::~ACE_WIN32_Asynch_Read_Stream_Result (void) +{ +} + +// Base class operations. These operations are here to kill dominance +// warnings. These methods call the base class methods. + +size_t +ACE_WIN32_Asynch_Read_Stream_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Read_Stream_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Read_Stream_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Read_Stream_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Read_Stream_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Read_Stream_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Read_Stream_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Read_Stream_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Read_Stream_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Read_Stream_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +int +ACE_WIN32_Asynch_Read_Stream_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +int +ACE_WIN32_Asynch_Read_Stream_Result::scatter_enabled (void) const +{ + return this->scatter_enabled_; +} + +ACE_WIN32_Asynch_Read_Stream::ACE_WIN32_Asynch_Read_Stream (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Read_Stream_Impl (), + ACE_WIN32_Asynch_Operation (win32_proactor) +{ +} + +int +ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) +{ + size_t space = message_block.space (); + if (bytes_to_read > space) + bytes_to_read = space; + + if (bytes_to_read == 0) + { + errno = ENOSPC; + return -1; + } + + // Create the Asynch_Result. + ACE_WIN32_Asynch_Read_Stream_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Read_Stream_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_read, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + // Shared read + int const return_val = this->shared_read (result); + + // Upon errors + if (return_val == -1) + delete result; + + return return_val; +} + +int +ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) +{ +#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) + iovec iov[ACE_IOV_MAX]; + int iovcnt = 0; + + // We should not read more than user requested, + // but it is allowed to read less + + for (const ACE_Message_Block* msg = &message_block; + msg != 0 && bytes_to_read > 0 && iovcnt < ACE_IOV_MAX; + msg = msg->cont () , ++iovcnt ) + { + size_t msg_space = msg->space (); + + // OS should correctly process zero length buffers + // if ( msg_space == 0 ) + // ACE_ERROR_RETURN ((LM_ERROR, + // ACE_TEXT ("ACE_WIN32_Asynch_Read_Stream::readv:") + // ACE_TEXT ("No space in the message block\n")), + // -1); + + if (msg_space > bytes_to_read) + msg_space = bytes_to_read; + bytes_to_read -= msg_space; + + // Make as many iovec as needed to fit all of msg_space. + size_t wr_ptr_offset = 0; + + while (msg_space > 0 && iovcnt < ACE_IOV_MAX) + { + u_long this_chunk_length; + if (msg_space > ULONG_MAX) + this_chunk_length = ULONG_MAX; + else + this_chunk_length = static_cast (msg_space); + // Collect the data in the iovec. + iov[iovcnt].iov_base = msg->wr_ptr () + wr_ptr_offset; + iov[iovcnt].iov_len = this_chunk_length; + msg_space -= this_chunk_length; + wr_ptr_offset += this_chunk_length; + + // Increment iovec counter if there's more to do. + if (msg_space > 0) + ++iovcnt; + } + if (msg_space > 0) // Ran out of iovecs before msg_space exhausted + { + errno = ERANGE; + return -1; + } + } + + // Re-calculate number bytes to read + bytes_to_read = 0; + + for (int i = 0; i < iovcnt ; ++i) + bytes_to_read += iov[i].iov_len; + + if (bytes_to_read == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Read_Stream::readv:") + ACE_TEXT ("Attempt to read 0 bytes\n")), + -1); + + // Create the Asynch_Result. + ACE_WIN32_Asynch_Read_Stream_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Read_Stream_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_read, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number, + 1), // scatter read enabled + -1); + + // do the scatter recv + + result->set_error (0); // Clear error before starting IO. + + DWORD bytes_recvd = 0; + u_long flags = 0; + + int initiate_result = ::WSARecv (reinterpret_cast (result->handle ()), + reinterpret_cast (iov), + iovcnt, + &bytes_recvd, + &flags, + result, + 0); + + if (0 == initiate_result) + // Immediate success: the OVERLAPPED will still get queued. + return 1; + + ACE_ASSERT (initiate_result == SOCKET_ERROR); + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + initiate_result = 0; + break; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("WSARecv"))); + } + + delete result; + initiate_result = -1; + break; + } + + return initiate_result; +#else + ACE_UNUSED_ARG (message_block); + ACE_UNUSED_ARG (bytes_to_read); + ACE_UNUSED_ARG (act); + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (signal_number); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */ +} + +ACE_WIN32_Asynch_Read_Stream::~ACE_WIN32_Asynch_Read_Stream (void) +{ +} + +int +ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result *result) +{ + // ReadFile API limits us to DWORD range. + if (result->bytes_to_read () > MAXDWORD) + { + errno = ERANGE; + return -1; + } + DWORD bytes_to_read = static_cast (result->bytes_to_read ()); + u_long bytes_read; + + result->set_error (0); // Clear error before starting IO. + + // Initiate the read + int initiate_result = ::ReadFile (result->handle (), + result->message_block ().wr_ptr (), + bytes_to_read, + &bytes_read, + result); + if (initiate_result == 1) + // Immediate success: the OVERLAPPED will still get queued. + return 0; + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + /* FALLTHRU */ + case ERROR_MORE_DATA: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + return 0; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ReadFile"))); + } + + return -1; + } +} + +// Methods belong to ACE_WIN32_Asynch_Operation base class. These +// methods are defined here to avoid VC++ warnings. They route the +// call to the ACE_WIN32_Asynch_Operation base class. + +int +ACE_WIN32_Asynch_Read_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Read_Stream::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Read_Stream::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +size_t +ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write (void) const +{ + return this->bytes_to_write_; +} + +ACE_Message_Block & +ACE_WIN32_Asynch_Write_Stream_Result::message_block (void) const +{ + return this->message_block_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Write_Stream_Result::handle (void) const +{ + return this->handle_; +} + +ACE_WIN32_Asynch_Write_Stream_Result::ACE_WIN32_Asynch_Write_Stream_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number, + int gather_enabled) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Write_Stream_Result_Impl (), + ACE_WIN32_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), + bytes_to_write_ (bytes_to_write), + message_block_ (message_block), + handle_ (handle), + gather_enabled_ (gather_enabled) +{ +} + +void +ACE_WIN32_Asynch_Write_Stream_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by . + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Appropriately move the pointers in the message block. + if (!this->gather_enabled ()) + this->message_block_.rd_ptr (bytes_transferred); + else + { + for (ACE_Message_Block* mb = &this->message_block_; + (mb != 0) && (bytes_transferred > 0); + mb = mb->cont ()) + { + size_t len_part = mb->length (); + + if ( len_part > bytes_transferred) + len_part = bytes_transferred; + + mb->rd_ptr (len_part); + + bytes_transferred -= len_part; + } + } + + // Create the interface result class. + ACE_Asynch_Write_Stream::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_stream (result); +} + +ACE_WIN32_Asynch_Write_Stream_Result::~ACE_WIN32_Asynch_Write_Stream_Result (void) +{ +} + +// Base class operations. These operations are here to kill dominance +// warnings. These methods call the base class methods. + +size_t +ACE_WIN32_Asynch_Write_Stream_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Write_Stream_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Write_Stream_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Write_Stream_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Write_Stream_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Write_Stream_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Write_Stream_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Write_Stream_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Write_Stream_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Write_Stream_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +int +ACE_WIN32_Asynch_Write_Stream_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +int +ACE_WIN32_Asynch_Write_Stream_Result::gather_enabled (void) const +{ + return this->gather_enabled_; +} + +ACE_WIN32_Asynch_Write_Stream::ACE_WIN32_Asynch_Write_Stream (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Write_Stream_Impl (), + ACE_WIN32_Asynch_Operation (win32_proactor) +{ +} + +int +ACE_WIN32_Asynch_Write_Stream::write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) +{ + size_t len = message_block.length(); + + if (bytes_to_write > len) + bytes_to_write = len ; + + if (bytes_to_write == 0) + ACE_ERROR_RETURN + ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Write_Stream::write:") + ACE_TEXT ("Attempt to write 0 bytes\n")), + -1); + + ACE_WIN32_Asynch_Write_Stream_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_write, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + // Shared write + int const return_val = this->shared_write (result); + + // Upon errors + if (return_val == -1) + { + delete result; + } + + return return_val; +} + +int +ACE_WIN32_Asynch_Write_Stream::writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) +{ +#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) + iovec iov[ACE_IOV_MAX]; + int iovcnt = 0; + + // We should not write more than user requested, + // but it is allowed to write less + + for (const ACE_Message_Block* msg = &message_block; + msg != 0 && bytes_to_write > 0 && iovcnt < ACE_IOV_MAX; + msg = msg->cont ()) + { + size_t msg_len = msg->length (); + + // Skip 0-length blocks. + if (msg_len == 0) + continue; + if (msg_len > bytes_to_write) + msg_len = bytes_to_write; + bytes_to_write -= msg_len; + + // Make as many iovec as needed to fit all of msg_len. + size_t rd_ptr_offset = 0; + + while (msg_len > 0 && iovcnt < ACE_IOV_MAX) + { + u_long this_chunk_length; + if (msg_len > ULONG_MAX) + this_chunk_length = ULONG_MAX; + else + this_chunk_length = static_cast (msg_len); + // Collect the data in the iovec. + iov[iovcnt].iov_base = msg->rd_ptr () + rd_ptr_offset; + iov[iovcnt].iov_len = this_chunk_length; + msg_len -= this_chunk_length; + rd_ptr_offset += this_chunk_length; + + // Increment iovec counter if there's more to do. + if (msg_len > 0) + iovcnt++; + } + if (msg_len > 0) // Ran out of iovecs before msg_space exhausted + { + errno = ERANGE; + return -1; + } + ++iovcnt; + } + + // Re-calculate number bytes to write + bytes_to_write = 0; + + for ( int i=0; i < iovcnt ; ++i ) + bytes_to_write += iov[i].iov_len; + + if ( bytes_to_write == 0 ) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Write_Stream::writev:") + ACE_TEXT ("Attempt to write 0 bytes\n")), + -1); + + + ACE_WIN32_Asynch_Write_Stream_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Write_Stream_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_write, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number, + 1), // gather write enabled + -1); + + // do the gather send + + u_long bytes_sent = 0; + + int initiate_result = ::WSASend (reinterpret_cast (result->handle ()), + reinterpret_cast (iov), + iovcnt, + &bytes_sent, + 0, // flags + result, + 0); + + if (0 == initiate_result) + // Immediate success: the OVERLAPPED will still get queued. + return 1; + + ACE_ASSERT (initiate_result == SOCKET_ERROR); + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + initiate_result = 0; + break; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("WSASend"))); + } + + delete result; + initiate_result = -1; + break; + } + + return initiate_result; +#else + ACE_UNUSED_ARG (message_block); + ACE_UNUSED_ARG (bytes_to_write); + ACE_UNUSED_ARG (act); + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (signal_number); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */ +} + +ACE_WIN32_Asynch_Write_Stream::~ACE_WIN32_Asynch_Write_Stream (void) +{ +} + +int +ACE_WIN32_Asynch_Write_Stream::shared_write (ACE_WIN32_Asynch_Write_Stream_Result *result) +{ + u_long bytes_written; + if (result->bytes_to_write () > MAXDWORD) + { + errno = ERANGE; + return -1; + } + DWORD bytes_to_write = static_cast (result->bytes_to_write ()); + + result->set_error (0); // Clear error before starting IO. + + // Initiate the write; Winsock 2 is required for the higher-performing + // WSASend() function. For Winsock 1, fall back to the slower WriteFile(). + int initiate_result = 0; +#if (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) + WSABUF iov; + iov.buf = result->message_block ().rd_ptr (); + iov.len = bytes_to_write; + initiate_result = ::WSASend (reinterpret_cast (result->handle ()), + &iov, + 1, + &bytes_written, + 0, // flags + result, + 0); + if (initiate_result == 0) + { + // Immediate success: the OVERLAPPED will still get queued. + return 0; + } +#else + initiate_result = ::WriteFile (result->handle (), + result->message_block ().rd_ptr (), + bytes_to_write, + &bytes_written, + result); + if (initiate_result == 1) + // Immediate success: the OVERLAPPED will still get queued. + return 0; +#endif /* ACE_HAS_WINSOCK2 */ + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + return 0; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("Initiating write"))); + return -1; + } +} + +// Methods belong to ACE_WIN32_Asynch_Operation base class. These +// methods are defined here to avoid VC++ warnings. They route the +// call to the ACE_WIN32_Asynch_Operation base class. + +int +ACE_WIN32_Asynch_Write_Stream::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Write_Stream::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Write_Stream::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +ACE_WIN32_Asynch_Read_File_Result::ACE_WIN32_Asynch_Read_File_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number, + int scatter_enabled) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Read_Stream_Result_Impl (), + ACE_Asynch_Read_File_Result_Impl (), + ACE_WIN32_Asynch_Read_Stream_Result (handler_proxy, + handle, + message_block, + bytes_to_read, + act, + event, + priority, + signal_number, + scatter_enabled) +{ + this->Offset = offset; + this->OffsetHigh = offset_high; +} + +void +ACE_WIN32_Asynch_Read_File_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by GetQueuedCompletionStatus. + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Appropriately move the pointers in the message block. + if (!this->scatter_enabled ()) + this->message_block_.wr_ptr (bytes_transferred); + else + { + static const size_t page_size = ACE_OS::getpagesize(); + + for (ACE_Message_Block* mb = &this->message_block_; + (mb != 0) && (bytes_transferred > 0); + mb = mb->cont ()) + { + // mb->space () is ought to be >= page_size. + // this is verified in the readv method + // ACE_ASSERT (mb->space () >= page_size); + + size_t len_part = page_size ; + + if ( len_part > bytes_transferred) + len_part = bytes_transferred; + + mb->wr_ptr (len_part); + + bytes_transferred -= len_part; + } + } + + // Create the interface result class. + ACE_Asynch_Read_File::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_file (result); +} + +ACE_WIN32_Asynch_Read_File_Result::~ACE_WIN32_Asynch_Read_File_Result (void) +{ +} + +// Base class operations. These operations are here to kill dominance +// warnings. These methods call the base class methods. + +size_t +ACE_WIN32_Asynch_Read_File_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Read_File_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Read_File_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Read_File_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Read_File_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Read_File_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Read_File_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Read_File_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Read_File_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Read_File_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +// The following methods belong to +// ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++ +// warnings. These methods route their call to the +// ACE_WIN32_Asynch_Read_Stream_Result base class. + +size_t +ACE_WIN32_Asynch_Read_File_Result::bytes_to_read (void) const +{ + return ACE_WIN32_Asynch_Read_Stream_Result::bytes_to_read (); +} + +ACE_Message_Block & +ACE_WIN32_Asynch_Read_File_Result::message_block (void) const +{ + return ACE_WIN32_Asynch_Read_Stream_Result::message_block (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Read_File_Result::handle (void) const +{ + return ACE_WIN32_Asynch_Read_Stream_Result::handle (); +} + +int +ACE_WIN32_Asynch_Read_File_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +// ************************************************************ + +ACE_WIN32_Asynch_Read_File::ACE_WIN32_Asynch_Read_File (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Read_Stream_Impl (), + ACE_Asynch_Read_File_Impl (), + ACE_WIN32_Asynch_Read_Stream (win32_proactor) +{ +} + +int +ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block, + size_t bytes_to_read, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) +{ + size_t space = message_block.space (); + if ( bytes_to_read > space ) + bytes_to_read = space; + + if ( bytes_to_read == 0 ) + ACE_ERROR_RETURN + ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Read_File::read:") + ACE_TEXT ("Attempt to read 0 bytes or no space in the message block\n")), + -1); + + + ACE_WIN32_Asynch_Read_File_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_read, + act, + offset, + offset_high, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + // Shared read + int return_val = this->shared_read (result); + + // Upon errors + if (return_val == -1) + delete result; + + return return_val; +} + +int +ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) +{ +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) + static const size_t page_size = ACE_OS::getpagesize(); + + FILE_SEGMENT_ELEMENT buffer_pointers[ACE_IOV_MAX + 1]; + int buffer_pointers_count = 0; + + // Each buffer must be at least the size of a system memory page + // and must be aligned on a system memory page size boundary + + // We should not read more than user requested, + // but it is allowed to read less + + size_t total_space = 0; + + for (const ACE_Message_Block* msg = &message_block; + msg != 0 && buffer_pointers_count < ACE_IOV_MAX && total_space < bytes_to_read; + msg = msg->cont(), ++buffer_pointers_count ) + { + size_t msg_space = msg->space (); + + if (msg_space < page_size) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Read_File::readv:") + ACE_TEXT ("Invalid message block size\n")), + -1); + + buffer_pointers[buffer_pointers_count].Buffer = msg->wr_ptr (); + total_space += page_size; + } + + // not read more than buffers space + if (bytes_to_read > total_space) + bytes_to_read = total_space; + + // ReadFileScatter API limits us to DWORD range. + if (bytes_to_read > MAXDWORD) + { + errno = ERANGE; + return -1; + } + DWORD dword_bytes_to_read = static_cast (bytes_to_read); + + // last one should be completely 0 + buffer_pointers[buffer_pointers_count].Buffer = 0; + + ACE_WIN32_Asynch_Read_File_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Read_File_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_read, + act, + offset, + offset_high, + this->win32_proactor_->get_handle (), + priority, + signal_number, + 1), // scatter read enabled + -1); + + // do the scatter read + result->set_error (0); // Clear error before starting IO. + + int initiate_result = ::ReadFileScatter (result->handle (), + buffer_pointers, + dword_bytes_to_read, + 0, // reserved, must be NULL + result); + + if (0 != initiate_result) + // Immediate success: the OVERLAPPED will still get queued. + return 1; + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + initiate_result = 0; + break; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ReadFileScatter"))); + } + + delete result; + initiate_result = -1; + break; + } + + return initiate_result; +#else + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_WIN32_OVERLAPPED_IO */ +} + + +ACE_WIN32_Asynch_Read_File::~ACE_WIN32_Asynch_Read_File (void) +{ +} + +int +ACE_WIN32_Asynch_Read_File::read (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) +{ + return ACE_WIN32_Asynch_Read_Stream::read (message_block, + bytes_to_read, + act, + priority, + signal_number); +} + +int +ACE_WIN32_Asynch_Read_File::readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number) +{ + return ACE_WIN32_Asynch_Read_Stream::readv (message_block, + bytes_to_read, + act, + priority, + signal_number); +} + +// Methods belong to ACE_WIN32_Asynch_Operation base class. These +// methods are defined here to avoid VC++ warnings. They route the +// call to the ACE_WIN32_Asynch_Operation base class. + +int +ACE_WIN32_Asynch_Read_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Read_File::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Read_File::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +ACE_WIN32_Asynch_Write_File_Result::ACE_WIN32_Asynch_Write_File_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number, + int gather_enabled) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Write_Stream_Result_Impl (), + ACE_Asynch_Write_File_Result_Impl (), + ACE_WIN32_Asynch_Write_Stream_Result (handler_proxy, + handle, + message_block, + bytes_to_write, + act, + event, + priority, + signal_number, + gather_enabled) +{ + this->Offset = offset; + this->OffsetHigh = offset_high; +} + +void +ACE_WIN32_Asynch_Write_File_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by GetQueuedCompletionStatus + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Appropriately move the pointers in the message block. + if (!this->gather_enabled ()) + this->message_block_.rd_ptr (bytes_transferred); + else + { + static const size_t page_size = ACE_OS::getpagesize(); + + for (ACE_Message_Block* mb = &this->message_block_; + (mb != 0) && (bytes_transferred > 0); + mb = mb->cont ()) + { + // mb->length () is ought to be >= page_size. + // this is verified in the writev method + // ACE_ASSERT (mb->length () >= page_size); + + size_t len_part = page_size; + + if ( len_part > bytes_transferred) + len_part = bytes_transferred; + + mb->rd_ptr (len_part); + + bytes_transferred -= len_part; + } + + } + + // Create the interface result class. + ACE_Asynch_Write_File::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_file (result); +} + +ACE_WIN32_Asynch_Write_File_Result::~ACE_WIN32_Asynch_Write_File_Result (void) +{ +} + +// Base class operations. These operations are here to kill dominance +// warnings. These methods call the base class methods. + +size_t +ACE_WIN32_Asynch_Write_File_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Write_File_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Write_File_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Write_File_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Write_File_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Write_File_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Write_File_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Write_File_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Write_File_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Write_File_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +// The following methods belong to +// ACE_WIN32_Asynch_Write_Stream_Result. They are here to avoid VC++ +// warnings. These methods route their call to the +// ACE_WIN32_Asynch_Write_Stream_Result base class. + +size_t +ACE_WIN32_Asynch_Write_File_Result::bytes_to_write (void) const +{ + return ACE_WIN32_Asynch_Write_Stream_Result::bytes_to_write (); +} + +ACE_Message_Block & +ACE_WIN32_Asynch_Write_File_Result::message_block (void) const +{ + return ACE_WIN32_Asynch_Write_Stream_Result::message_block (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Write_File_Result::handle (void) const +{ + return ACE_WIN32_Asynch_Write_Stream_Result::handle (); +} + +int +ACE_WIN32_Asynch_Write_File_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +ACE_WIN32_Asynch_Write_File::ACE_WIN32_Asynch_Write_File (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Write_Stream_Impl (), + ACE_Asynch_Write_File_Impl (), + ACE_WIN32_Asynch_Write_Stream (win32_proactor) +{ +} + +int +ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) +{ + size_t len = message_block.length (); + if ( bytes_to_write > len ) + bytes_to_write = len; + + if ( bytes_to_write == 0 ) + ACE_ERROR_RETURN + ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Write_File::write:") + ACE_TEXT ("Attempt to read 0 bytes\n")), + -1); + + ACE_WIN32_Asynch_Write_File_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_write, + act, + offset, + offset_high, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + // Shared write + int return_val = this->shared_write (result); + + // Upon errors + if (return_val == -1) + delete result; + + return return_val; +} + +int +ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number) +{ +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) + static const size_t page_size = ACE_OS::getpagesize(); + + FILE_SEGMENT_ELEMENT buffer_pointers[ACE_IOV_MAX + 1]; + int buffer_pointers_count = 0; + + // Each buffer must be at least the size of a system memory page + // and must be aligned on a system memory page size boundary + + // We should not read more than user requested, + // but it is allowed to read less + + size_t total_len = 0; + + for (const ACE_Message_Block* msg = &message_block; + msg != 0 && buffer_pointers_count < ACE_IOV_MAX && total_len < bytes_to_write; + msg = msg->cont (), ++buffer_pointers_count ) + { + size_t msg_len = msg->length (); + + // Don't allow writing less than page_size, unless + // the size of the message block is big enough (so we don't write from + // memory which does not belong to the message block), and the message + // block is the last in the chain. + if (msg_len < page_size && + (msg->size () - (msg->rd_ptr () - msg->base ()) < page_size || // message block too small + bytes_to_write - total_len > page_size ))// NOT last chunk + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Write_File::writev:") + ACE_TEXT ("Invalid message block length\n")), + -1); + + buffer_pointers[buffer_pointers_count].Buffer = msg->rd_ptr (); + total_len += page_size; + } + + // not write more than we have in buffers + if (bytes_to_write > total_len) + bytes_to_write = total_len; + // WriteFileGather API limits us to DWORD range. + if (bytes_to_write > MAXDWORD) + { + errno = ERANGE; + return -1; + } + DWORD dword_bytes_to_write = static_cast (bytes_to_write); + + // last one should be completely 0 + buffer_pointers[buffer_pointers_count].Buffer = 0; + + ACE_WIN32_Asynch_Write_File_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Write_File_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_write, + act, + offset, + offset_high, + this->win32_proactor_->get_handle (), + priority, + signal_number, + 1), // gather write enabled + -1); + + result->set_error(0); + + // do the gather write + int initiate_result = ::WriteFileGather (result->handle (), + buffer_pointers, + dword_bytes_to_write, + 0, // reserved, must be NULL + result); + + if (0 != initiate_result) + // Immediate success: the OVERLAPPED will still get queued. + return 1; + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + initiate_result = 0; + break; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("WriteFileGather"))); + } + + delete result; + initiate_result = -1; + break; + } + + return initiate_result; +#else + + ACE_NOTSUP_RETURN (-1); + +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ +} + + +ACE_WIN32_Asynch_Write_File::~ACE_WIN32_Asynch_Write_File (void) +{ +} + +int +ACE_WIN32_Asynch_Write_File::write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) +{ + return ACE_WIN32_Asynch_Write_Stream::write (message_block, + bytes_to_write, + act, + priority, + signal_number); +} + +int +ACE_WIN32_Asynch_Write_File::writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number) +{ + return ACE_WIN32_Asynch_Write_Stream::writev (message_block, + bytes_to_write, + act, + priority, + signal_number); +} + +// Methods belong to ACE_WIN32_Asynch_Operation base class. These +// methods are defined here to avoid VC++ warnings. They route the +// call to the ACE_WIN32_Asynch_Operation base class. + +int +ACE_WIN32_Asynch_Write_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Write_File::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Write_File::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +size_t +ACE_WIN32_Asynch_Accept_Result::bytes_to_read (void) const +{ + return this->bytes_to_read_; +} + +ACE_Message_Block & +ACE_WIN32_Asynch_Accept_Result::message_block (void) const +{ + return this->message_block_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Accept_Result::listen_handle (void) const +{ + return this->listen_handle_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Accept_Result::accept_handle (void) const +{ + return this->accept_handle_; +} + +ACE_WIN32_Asynch_Accept_Result::ACE_WIN32_Asynch_Accept_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Accept_Result_Impl (), + ACE_WIN32_Asynch_Result (handler_proxy, + act, + event, + 0, + 0, + priority, + signal_number), + bytes_to_read_ (bytes_to_read), + message_block_ (message_block), + listen_handle_ (listen_handle), + accept_handle_ (accept_handle) +{ +} + +void +ACE_WIN32_Asynch_Accept_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by GetQueuedCompletionStatus + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Appropriately move the pointers in the message block. + this->message_block_.wr_ptr (bytes_transferred); + + if (!success && this->accept_handle_ != ACE_INVALID_HANDLE) + { + ACE_OS::closesocket (this->accept_handle_); + this->accept_handle_ = ACE_INVALID_HANDLE; + } + + // Create the interface result class. + ACE_Asynch_Accept::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_accept (result); +} + +ACE_WIN32_Asynch_Accept_Result::~ACE_WIN32_Asynch_Accept_Result (void) +{ +} + +// Base class operations. These operations are here to kill dominance +// warnings. These methods call the base class methods. + +size_t +ACE_WIN32_Asynch_Accept_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Accept_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Accept_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Accept_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Accept_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Accept_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Accept_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Accept_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Accept_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Accept_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +int +ACE_WIN32_Asynch_Accept_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +ACE_WIN32_Asynch_Accept::ACE_WIN32_Asynch_Accept (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Accept_Impl (), + ACE_WIN32_Asynch_Operation (win32_proactor) +{ +} + +int +ACE_WIN32_Asynch_Accept::accept (ACE_Message_Block &message_block, + size_t bytes_to_read, + ACE_HANDLE accept_handle, + const void *act, + int priority, + int signal_number, + int addr_family) +{ +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) + // Sanity check: make sure that enough space has been allocated by + // the caller. + size_t address_size = +#if defined (ACE_HAS_IPV6) + addr_family == AF_INET ? sizeof (sockaddr_in) : sizeof (sockaddr_in6); +#else + sizeof (sockaddr_in); +#endif /* ACE_HAS_IPV6 */ + address_size += 16; // AcceptEx requires address size + 16 (minimum) + size_t available_space = message_block.space (); + size_t space_needed = bytes_to_read + 2 * address_size; + if (available_space < space_needed) + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Buffer too small\n")), -1); + + // WIN Specific. + + // AcceptEx API limits us to DWORD range. + if (bytes_to_read > MAXDWORD) + { + errno = ERANGE; + return -1; + } + DWORD dword_bytes_to_read = static_cast (bytes_to_read); + + int close_accept_handle = 0; + // If the is invalid, we will create a new socket. + if (accept_handle == ACE_INVALID_HANDLE) + { + accept_handle = ACE_OS::socket (addr_family, + SOCK_STREAM, + 0); + if (accept_handle == ACE_INVALID_HANDLE) + { + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_OS::socket"))); + } + return -1; + } + else + // Remember to close the socket down if failures occur. + close_accept_handle = 1; + } + + // Common code for both WIN and POSIX. + ACE_WIN32_Asynch_Accept_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Accept_Result (this->handler_proxy_, + this->handle_, + accept_handle, + message_block, + bytes_to_read, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + u_long bytes_read; + + // Initiate the accept. + int initiate_result = ::AcceptEx ((SOCKET) result->listen_handle (), + (SOCKET) result->accept_handle (), + result->message_block ().wr_ptr (), + dword_bytes_to_read, + static_cast (address_size), + static_cast (address_size), + &bytes_read, + result); + if (initiate_result == 1) + // Immediate success: the OVERLAPPED will still get queued. + return 1; + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + return 0; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (close_accept_handle == 1) + // Close the newly created socket + ACE_OS::closesocket (accept_handle); + + // Cleanup dynamically allocated Asynch_Result. + delete result; + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("AcceptEx"))); + } + return -1; + } +#else + ACE_UNUSED_ARG (message_block); + ACE_UNUSED_ARG (bytes_to_read); + ACE_UNUSED_ARG (accept_handle); + ACE_UNUSED_ARG (act); + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (signal_number); + ACE_UNUSED_ARG (addr_family); + ACE_NOTSUP_RETURN (-1); +#endif /* defined (ACE_HAS_WIN32_OVERLAPPED_IO) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) */ +} + +ACE_WIN32_Asynch_Accept::~ACE_WIN32_Asynch_Accept (void) +{ +} + +// Methods belong to ACE_WIN32_Asynch_Operation base class. These +// methods are defined here to avoid VC++ warnings. They route the +// call to the ACE_WIN32_Asynch_Operation base class. + +int +ACE_WIN32_Asynch_Accept::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Accept::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Accept::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +// ********************************************************************* + +ACE_HANDLE +ACE_WIN32_Asynch_Connect_Result::connect_handle (void) const +{ + return this->connect_handle_; +} + +void ACE_WIN32_Asynch_Connect_Result::connect_handle ( ACE_HANDLE handle ) +{ + this->connect_handle_ = handle; +} + + +ACE_WIN32_Asynch_Connect_Result::ACE_WIN32_Asynch_Connect_Result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Connect_Result_Impl (), + ACE_WIN32_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number), + connect_handle_ (connect_handle) +{ + ; +} + +void +ACE_WIN32_Asynch_Connect_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data. + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Create the interface result class. + ACE_Asynch_Connect::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_connect (result); +} + +ACE_WIN32_Asynch_Connect_Result::~ACE_WIN32_Asynch_Connect_Result (void) +{ +} + +// Base class operations. These operations are here to kill dominance +// warnings. These methods call the base class methods. + +size_t +ACE_WIN32_Asynch_Connect_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Connect_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Connect_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Connect_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Connect_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Connect_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Connect_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Connect_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Connect_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Connect_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +int +ACE_WIN32_Asynch_Connect_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +// ********************************************************************* + +ACE_WIN32_Asynch_Connect::ACE_WIN32_Asynch_Connect (ACE_WIN32_Proactor * win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Connect_Impl (), + ACE_WIN32_Asynch_Operation (win32_proactor), + flg_open_ (false) +{ +} + +ACE_WIN32_Asynch_Connect::~ACE_WIN32_Asynch_Connect (void) +{ + this->close (); + this->reactor (0); // to avoid purge_pending_notifications +} + +ACE_Proactor * +ACE_WIN32_Asynch_Connect::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Connect::get_handle (void) const +{ + + ACE_ASSERT (0); + return ACE_INVALID_HANDLE; +} + +void +ACE_WIN32_Asynch_Connect::set_handle (ACE_HANDLE) +{ + ACE_ASSERT (0) ; +} + +int +ACE_WIN32_Asynch_Connect::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE, + const void *completion_key, + ACE_Proactor *proactor) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::open"); + + // if we are already opened, + // we could not create a new handler without closing the previous + if (this->flg_open_) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%N:%l:ACE_WIN32_Asynch_Connect::open:") + ACE_TEXT ("connector already open\n")), + -1); + + //int result = + ACE_WIN32_Asynch_Operation::open (handler_proxy, + ACE_INVALID_HANDLE, + completion_key, + proactor); + + // Ignore result as we pass ACE_INVALID_HANDLE + //if (result == -1) + // return result; + + this->flg_open_ = true; + + return 0; +} + +int +ACE_WIN32_Asynch_Connect::connect (ACE_HANDLE connect_handle, + const ACE_Addr & remote_sap, + const ACE_Addr & local_sap, + int reuse_addr, + const void *act, + int priority, + int signal_number) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::connect"); + + if (!this->flg_open_) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%N:%l:ACE_WIN32_Asynch_Connect::connect") + ACE_TEXT ("connector was not opened before\n")), + -1); + + // Common code for both WIN and WIN32. + // Create future Asynch_Connect_Result + ACE_WIN32_Asynch_Connect_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Connect_Result (this->handler_proxy_, + connect_handle, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + int rc = connect_i (result, + remote_sap, + local_sap, + reuse_addr); + + // update handle + connect_handle = result->connect_handle (); + + if (rc != 0) + return post_result (result, true); + + // Enqueue result we will wait for completion + { + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); + + if (this->result_map_.bind (connect_handle, result) == -1) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Connect::connect: %p\n"), + ACE_TEXT ("bind"))); + result->set_error (EFAULT); + return post_result (result, true); + } + } + + ACE_Asynch_Pseudo_Task & task = + this->win32_proactor_->get_asynch_pseudo_task (); + + if (-1 == task.register_io_handler (connect_handle, + this, + ACE_Event_Handler::CONNECT_MASK, + 0)) // not to suspend after register + { + result = 0; + { + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); + this->result_map_.unbind (connect_handle, result); + } + if (result != 0) + { + result->set_error (EFAULT); + this->post_result (result, true); + } + } + + return 0; +} + +int ACE_WIN32_Asynch_Connect::post_result (ACE_WIN32_Asynch_Connect_Result * result, + bool post_enable) +{ + ACE_HANDLE handle = result->connect_handle (); + if (this->flg_open_ && post_enable) + { + // NOTE: result is invalid after post_completion(). It's either deleted + // or will be shortly via the proactor dispatch, regardless of success + // or fail of the call. + if (this->win32_proactor_ ->post_completion (result) == 0) + return 0; + + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Error:(%P | %t):%p\n"), + ACE_TEXT ("ACE_WIN32_Asynch_Connect::post_result: ") + ACE_TEXT (" failed"))); + } + else + { + // There was no call to post_completion() so manually delete result. + delete result; + } + + if (handle != ACE_INVALID_HANDLE) + ACE_OS::closesocket (handle); + + return -1; +} + +// connect_i +// return code : +// -1 errors before attempt to connect +// 0 connect started +// 1 connect finished ( may be unsuccessfully) + +int +ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result, + const ACE_Addr & remote_sap, + const ACE_Addr & local_sap, + int reuse_addr) +{ + result->set_bytes_transferred (0); + + ACE_HANDLE handle = result->connect_handle (); + if (handle == ACE_INVALID_HANDLE) + { + int protocol_family = remote_sap.get_type (); + handle = ACE_OS::socket (protocol_family, + SOCK_STREAM, + 0); + + // save it + result->connect_handle (handle); + if (handle == ACE_INVALID_HANDLE) + { + result->set_error (errno); + ACE_ERROR_RETURN + ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), + ACE_TEXT ("socket")), + -1); + } + + // Reuse the address + int one = 1; + if (protocol_family != PF_UNIX && + reuse_addr != 0 && + ACE_OS::setsockopt (handle, + SOL_SOCKET, + SO_REUSEADDR, + (const char*) &one, + sizeof one) == -1) + { + result->set_error (errno); + ACE_ERROR_RETURN + ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), + ACE_TEXT ("setsockopt")), + -1); + } + } + + if (local_sap != ACE_Addr::sap_any) + { + sockaddr * laddr = reinterpret_cast (local_sap.get_addr ()); + int size = local_sap.get_size (); + if (ACE_OS::bind (handle, laddr, size) == -1) + { + result->set_error (errno); + ACE_ERROR_RETURN + ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), + ACE_TEXT ("bind")), + -1); + } + } + + // set non blocking mode + if (ACE::set_flags (handle, ACE_NONBLOCK) != 0) + { + result->set_error (errno); + ACE_ERROR_RETURN + ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Connect::connect_i: %p\n"), + ACE_TEXT ("set_flags")), + -1); + } + + for (;;) + { + int rc = ACE_OS::connect + (handle, + reinterpret_cast (remote_sap.get_addr ()), + remote_sap.get_size ()); + + if (rc < 0) // failure + { + if (errno == EWOULDBLOCK || errno == EINPROGRESS) + return 0; // connect started + + if (errno == EINTR) + continue; + + result->set_error (errno); + } + return 1 ; // connect finished + } +} + + +// cancel_uncompleted +// It performs cancellation of all pending requests +// +// Parameter flg_notify can be +// 0 - don't send notifications about canceled accepts +// !0 - notify user about canceled accepts +// according WIN32 standards we should receive notifications +// on canceled AIO requests +// +// Return value : number of cancelled requests +// + +int +ACE_WIN32_Asynch_Connect::cancel_uncompleted (bool flg_notify, + ACE_Handle_Set &set) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::cancel_uncompleted"); + + int retval = 0; + + MAP_MANAGER::ITERATOR iter (result_map_); + MAP_MANAGER::ENTRY * me = 0; + + set.reset (); + + for (; iter.next (me) != 0; retval++, iter.advance ()) + { + ACE_HANDLE handle = me->ext_id_; + ACE_WIN32_Asynch_Connect_Result* result = me->int_id_ ; + + set.set_bit (handle); + + result->set_bytes_transferred (0); + result->set_error (ERROR_OPERATION_ABORTED); + this->post_result (result, flg_notify); + } + + result_map_.unbind_all (); + + return retval; +} + +int +ACE_WIN32_Asynch_Connect::cancel (void) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::cancel"); + + int rc = -1 ; // ERRORS + + ACE_Handle_Set set; + int num_cancelled = 0; + { + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); + + num_cancelled = cancel_uncompleted (flg_open_, set); + } + if (num_cancelled == 0) + rc = 1; // AIO_ALLDONE + else if (num_cancelled > 0) + rc = 0; // AIO_CANCELED + + if (!this->flg_open_) + return rc; + + ACE_Asynch_Pseudo_Task & task = + this->win32_proactor_->get_asynch_pseudo_task (); + + task.remove_io_handler (set); + return rc; +} + +int +ACE_WIN32_Asynch_Connect::close (void) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::close"); + + ACE_Handle_Set set; + int num_cancelled = 0; + { + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1)); + + num_cancelled = cancel_uncompleted (flg_open_, set); + } + if (num_cancelled == 0 || this->flg_open_ == 0) + { + this->flg_open_ = false; + return 0; + } + + ACE_Asynch_Pseudo_Task & task = + this->win32_proactor_->get_asynch_pseudo_task (); + + task.remove_io_handler (set); + return 0; +} + +int +ACE_WIN32_Asynch_Connect::handle_exception (ACE_HANDLE fd) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_exception"); + return handle_output (fd); +} + +int +ACE_WIN32_Asynch_Connect::handle_input (ACE_HANDLE fd) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_input"); + return handle_output (fd); +} + +int +ACE_WIN32_Asynch_Connect::handle_output (ACE_HANDLE fd) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_output"); + + ACE_WIN32_Asynch_Connect_Result* result = 0; + + { + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); + if (this->result_map_.unbind (fd, result) != 0) // not found + return -1; + } + + int sockerror = 0 ; + int lsockerror = sizeof sockerror; + + ACE_OS::getsockopt (fd, + SOL_SOCKET, + SO_ERROR, + (char*) & sockerror, + & lsockerror); + + // This previously just did a "return -1" and let handle_close() clean + // things up. However, this entire object may be gone as a result of + // the application's completion handler, so don't count on 'this' being + // legitimate on return from post_result(). + // remove_io_handler() contains flag DONT_CALL + this->win32_proactor_->get_asynch_pseudo_task().remove_io_handler (fd); + + result->set_bytes_transferred (0); + result->set_error (sockerror); + this->post_result (result, this->flg_open_); + return 0; +} + + +int +ACE_WIN32_Asynch_Connect::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask) +{ + ACE_TRACE ("ACE_WIN32_Asynch_Connect::handle_close"); + + ACE_Asynch_Pseudo_Task & task = + this->win32_proactor_->get_asynch_pseudo_task (); + task.remove_io_handler (fd); + + ACE_WIN32_Asynch_Connect_Result* result = 0; + + { + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0)); + if (this->result_map_.unbind (fd, result) != 0) // not found + return -1; + } + + result->set_bytes_transferred (0); + result->set_error (ERROR_OPERATION_ABORTED); + this->post_result (result, this->flg_open_); + + return 0; +} + +// ********************************************************************* + +ACE_HANDLE +ACE_WIN32_Asynch_Transmit_File_Result::socket (void) const +{ + return this->socket_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Transmit_File_Result::file (void) const +{ + return this->file_; +} + +ACE_Asynch_Transmit_File::Header_And_Trailer * +ACE_WIN32_Asynch_Transmit_File_Result::header_and_trailer (void) const +{ + return this->header_and_trailer_; +} + +size_t +ACE_WIN32_Asynch_Transmit_File_Result::bytes_to_write (void) const +{ + return this->bytes_to_write_; +} + +size_t +ACE_WIN32_Asynch_Transmit_File_Result::bytes_per_send (void) const +{ + return this->bytes_per_send_; +} + +u_long +ACE_WIN32_Asynch_Transmit_File_Result::flags (void) const +{ + return this->flags_; +} + +ACE_WIN32_Asynch_Transmit_File_Result::ACE_WIN32_Asynch_Transmit_File_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Transmit_File_Result_Impl (), + ACE_WIN32_Asynch_Result (handler_proxy, + act, + event, + offset, + offset_high, + priority, + signal_number), + socket_ (socket), + file_ (file), + header_and_trailer_ (header_and_trailer), + bytes_to_write_ (bytes_to_write), + bytes_per_send_ (bytes_per_send), + flags_ (flags) +{ +} + +void +ACE_WIN32_Asynch_Transmit_File_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by GetQueuedCompletionStatus + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // We will not do this because (a) the header and trailer blocks may + // be the same message_blocks and (b) in cases of failures we have + // no idea how much of what (header, data, trailer) was sent. + /* + if (this->success_ && this->header_and_trailer_ != 0) + { + ACE_Message_Block *header = this->header_and_trailer_->header (); + if (header != 0) + header->rd_ptr (this->header_and_trailer_->header_bytes ()); + + ACE_Message_Block *trailer = this->header_and_trailer_->trailer (); + if (trailer != 0) + trailer->rd_ptr (this->header_and_trailer_->trailer_bytes ()); + } + */ + + // Create the interface result class. + ACE_Asynch_Transmit_File::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_transmit_file (result); +} + +ACE_WIN32_Asynch_Transmit_File_Result::~ACE_WIN32_Asynch_Transmit_File_Result (void) +{ +} + +// Base class operations. These operations are here to kill dominance +// warnings. These methods call the base class methods. + +size_t +ACE_WIN32_Asynch_Transmit_File_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Transmit_File_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Transmit_File_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Transmit_File_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Transmit_File_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Transmit_File_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Transmit_File_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Transmit_File_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Transmit_File_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Transmit_File_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +int +ACE_WIN32_Asynch_Transmit_File_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +ACE_WIN32_Asynch_Transmit_File::ACE_WIN32_Asynch_Transmit_File (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Transmit_File_Impl (), + ACE_WIN32_Asynch_Operation (win32_proactor) +{ +} + +int +ACE_WIN32_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + int priority, + int signal_number) +{ +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) + + // TransmitFile API limits us to DWORD range. + if (bytes_to_write > MAXDWORD || bytes_per_send > MAXDWORD) + { + errno = ERANGE; + return -1; + } + DWORD dword_bytes_to_write = static_cast (bytes_to_write); + DWORD dword_bytes_per_send = static_cast (bytes_per_send); + + ACE_WIN32_Asynch_Transmit_File_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Transmit_File_Result (this->handler_proxy_, + this->handle_, + file, + header_and_trailer, + bytes_to_write, + offset, + offset_high, + bytes_per_send, + flags, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + ACE_LPTRANSMIT_FILE_BUFFERS transmit_buffers = 0; + if (result->header_and_trailer () != 0) + transmit_buffers = result->header_and_trailer ()->transmit_buffers (); + + // Initiate the transmit file + int initiate_result = ::TransmitFile ((SOCKET) result->socket (), + result->file (), + dword_bytes_to_write, + dword_bytes_per_send, + result, + transmit_buffers, + result->flags ()); + if (initiate_result == 1) + // Immediate success: the OVERLAPPED will still get queued. + return 1; + + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + return 0; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + // Cleanup dynamically allocated Asynch_Result + delete result; + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("TransmitFile"))); + } + return -1; + } +#else + ACE_UNUSED_ARG (file); + ACE_UNUSED_ARG (header_and_trailer); + ACE_UNUSED_ARG (bytes_to_write); + ACE_UNUSED_ARG (offset); + ACE_UNUSED_ARG (offset_high); + ACE_UNUSED_ARG (bytes_per_send); + ACE_UNUSED_ARG (flags); + ACE_UNUSED_ARG (act); + ACE_UNUSED_ARG (priority); + ACE_UNUSED_ARG (signal_number); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_WINSOCK2 */ +} + +ACE_WIN32_Asynch_Transmit_File::~ACE_WIN32_Asynch_Transmit_File (void) +{ +} + +// Methods belong to ACE_WIN32_Asynch_Operation base class. These +// methods are defined here to avoid VC++ warnings. They route the +// call to the ACE_WIN32_Asynch_Operation base class. + +int +ACE_WIN32_Asynch_Transmit_File::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Transmit_File::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Transmit_File::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +size_t +ACE_WIN32_Asynch_Read_Dgram_Result::bytes_to_read (void) const +{ + return this->bytes_to_read_; +} + +ACE_Message_Block* +ACE_WIN32_Asynch_Read_Dgram_Result::message_block (void) const +{ + return this->message_block_; +} + + +int +ACE_WIN32_Asynch_Read_Dgram_Result::remote_address (ACE_Addr& addr) const +{ + int retVal = -1; // failure + + // make sure the addresses are of the same type + if (addr.get_type () == this->remote_address_->get_type ()) + { // copy the remote_address_ into addr + addr.set_addr (this->remote_address_->get_addr (), + this->remote_address_->get_size ()); + retVal = 0; // success + } + + return retVal; +} + +sockaddr * +ACE_WIN32_Asynch_Read_Dgram_Result::saddr () const +{ + return (sockaddr *) this->remote_address_->get_addr (); +} + + +int +ACE_WIN32_Asynch_Read_Dgram_Result::flags (void) const +{ + return this->flags_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Read_Dgram_Result::handle (void) const +{ + return this->handle_; +} + +size_t +ACE_WIN32_Asynch_Read_Dgram_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Read_Dgram_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Read_Dgram_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Read_Dgram_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Read_Dgram_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Read_Dgram_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Read_Dgram_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Read_Dgram_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Read_Dgram_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Read_Dgram_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +int +ACE_WIN32_Asynch_Read_Dgram_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +ACE_WIN32_Asynch_Read_Dgram_Result::ACE_WIN32_Asynch_Read_Dgram_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Read_Dgram_Result_Impl(), + ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), + bytes_to_read_ (bytes_to_read), + message_block_ (message_block), + remote_address_ (0), + addr_len_ (0), + flags_ (flags), + handle_ (handle) +{ + ACE_ASSERT (protocol_family == PF_INET); // only supporting INET addresses + + ACE_NEW (remote_address_, ACE_INET_Addr); + addr_len_ = remote_address_->get_size (); + + ACE_UNUSED_ARG (protocol_family); +} + +void +ACE_WIN32_Asynch_Read_Dgram_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by GetQueuedCompletionStatus + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Appropriately move the pointers in the message block. + for (ACE_Message_Block* mb = this->message_block_; + (mb != 0) && (bytes_transferred > 0); + mb = mb->cont ()) + { + size_t len_part = mb->space (); + + if ( len_part > bytes_transferred) + len_part = bytes_transferred; + + mb->wr_ptr (len_part); + + bytes_transferred -= len_part; + } + + // Adjust the address length + this->remote_address_->set_size (this->addr_len_); + + // Create the interface result class. + ACE_Asynch_Read_Dgram::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_read_dgram (result); +} + +ACE_WIN32_Asynch_Read_Dgram_Result::~ACE_WIN32_Asynch_Read_Dgram_Result (void) +{ + delete this->remote_address_; +} + +//*************************************************************************** + +ACE_WIN32_Asynch_Read_Dgram::~ACE_WIN32_Asynch_Read_Dgram (void) +{ +} + +ssize_t +ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, + size_t & number_of_bytes_recvd, + int flags, + int protocol_family, + const void *act, + int priority, + int signal_number) +{ + number_of_bytes_recvd = 0; + + size_t bytes_to_read = 0; + + iovec iov[ACE_IOV_MAX]; + int iovcnt = 0; + + for (const ACE_Message_Block* msg = message_block; + msg != 0 && iovcnt < ACE_IOV_MAX; + msg = msg->cont () , ++iovcnt ) + { + size_t msg_space = msg->space (); + + // OS should correctly process zero length buffers + // if ( msg_space == 0 ) + // ACE_ERROR_RETURN ((LM_ERROR, + // ACE_TEXT ("ACE_WIN32_Asynch_Read_Dgram::recv:") + // ACE_TEXT ("No space in the message block\n")), + // -1); + + bytes_to_read += msg_space; + + // Make as many iovec as needed to fit all of msg_len. + size_t wr_ptr_offset = 0; + + while (msg_space > 0 && iovcnt < ACE_IOV_MAX) + { + u_long this_chunk_length; + if (msg_space > ULONG_MAX) + this_chunk_length = ULONG_MAX; + else + this_chunk_length = static_cast (msg_space); + // Collect the data in the iovec. + iov[iovcnt].iov_base = msg->wr_ptr () + wr_ptr_offset; + iov[iovcnt].iov_len = this_chunk_length; + msg_space -= this_chunk_length; + wr_ptr_offset += this_chunk_length; + + // Increment iovec counter if there's more to do. + if (msg_space > 0) + iovcnt++; + } + if (msg_space > 0) // Ran out of iovecs before msg_space exhausted + { + errno = ERANGE; + return -1; + } + } + + if (bytes_to_read == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACE_WIN32_Asynch_Read_Dgram::recv:") + ACE_TEXT ("Attempt to read 0 bytes\n")), + -1); + + // Create the Asynch_Result. + ACE_WIN32_Asynch_Read_Dgram_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Read_Dgram_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_read, + flags, + protocol_family, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + // do the scatter/gather recv + ssize_t initiate_result = ACE_OS::recvfrom (result->handle (), + iov, + iovcnt, + number_of_bytes_recvd, + result->flags_, + result->saddr (), + &(result->addr_len_), + result, + 0); + if (initiate_result == SOCKET_ERROR) + { + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + initiate_result = 0; + break; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("WSARecvFrom"))); + } + + delete result; + initiate_result = -1; + break; + } + + } + else + { + // Immediate success: the OVERLAPPED will still get queued. + // number_of_bytes_recvd contains the number of bytes recvd + // addr contains the peer address + // flags was updated + + // number_of_bytes_recvd = bytes_recvd; + initiate_result = 1; + } + + return initiate_result; +} + +int +ACE_WIN32_Asynch_Read_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Read_Dgram::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Read_Dgram::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +ACE_WIN32_Asynch_Read_Dgram::ACE_WIN32_Asynch_Read_Dgram (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Read_Dgram_Impl (), + ACE_WIN32_Asynch_Operation (win32_proactor) +{ +} + +//*********************************************** + +size_t +ACE_WIN32_Asynch_Write_Dgram_Result::bytes_to_write (void) const +{ + return this->bytes_to_write_; +} + +ACE_Message_Block* +ACE_WIN32_Asynch_Write_Dgram_Result::message_block () const +{ + return this->message_block_; +} + +int +ACE_WIN32_Asynch_Write_Dgram_Result::flags (void) const +{ + return this->flags_; +} + +ACE_HANDLE +ACE_WIN32_Asynch_Write_Dgram_Result::handle (void) const +{ + return this->handle_; +} + +size_t +ACE_WIN32_Asynch_Write_Dgram_Result::bytes_transferred (void) const +{ + return ACE_WIN32_Asynch_Result::bytes_transferred (); +} + +const void * +ACE_WIN32_Asynch_Write_Dgram_Result::act (void) const +{ + return ACE_WIN32_Asynch_Result::act (); +} + +int +ACE_WIN32_Asynch_Write_Dgram_Result::success (void) const +{ + return ACE_WIN32_Asynch_Result::success (); +} + +const void * +ACE_WIN32_Asynch_Write_Dgram_Result::completion_key (void) const +{ + return ACE_WIN32_Asynch_Result::completion_key (); +} + +u_long +ACE_WIN32_Asynch_Write_Dgram_Result::error (void) const +{ + return ACE_WIN32_Asynch_Result::error (); +} + +ACE_HANDLE +ACE_WIN32_Asynch_Write_Dgram_Result::event (void) const +{ + return ACE_WIN32_Asynch_Result::event (); +} + +u_long +ACE_WIN32_Asynch_Write_Dgram_Result::offset (void) const +{ + return ACE_WIN32_Asynch_Result::offset (); +} + +u_long +ACE_WIN32_Asynch_Write_Dgram_Result::offset_high (void) const +{ + return ACE_WIN32_Asynch_Result::offset_high (); +} + +int +ACE_WIN32_Asynch_Write_Dgram_Result::priority (void) const +{ + return ACE_WIN32_Asynch_Result::priority (); +} + +int +ACE_WIN32_Asynch_Write_Dgram_Result::signal_number (void) const +{ + return ACE_WIN32_Asynch_Result::signal_number (); +} + +int +ACE_WIN32_Asynch_Write_Dgram_Result::post_completion (ACE_Proactor_Impl *proactor) +{ + return ACE_WIN32_Asynch_Result::post_completion (proactor); +} + +ACE_WIN32_Asynch_Write_Dgram_Result::ACE_WIN32_Asynch_Write_Dgram_Result ( + const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_write, + int flags, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + ACE_Asynch_Write_Dgram_Result_Impl(), + ACE_WIN32_Asynch_Result (handler_proxy, + act, + event, + 0, + 0, + priority, + signal_number), + bytes_to_write_ (bytes_to_write), + message_block_ (message_block), + flags_ (flags), + handle_ (handle) +{ +} + +void +ACE_WIN32_Asynch_Write_Dgram_Result::complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error) +{ + // Copy the data which was returned by GetQueuedCompletionStatus + this->bytes_transferred_ = bytes_transferred; + this->success_ = success; + this->completion_key_ = completion_key; + this->error_ = error; + + // Appropriately move the pointers in the message block. + for (ACE_Message_Block* mb = this->message_block_; + (mb != 0) && (bytes_transferred > 0); + mb = mb->cont ()) + { + size_t len_part = mb->length (); + + if ( len_part > bytes_transferred) + len_part = bytes_transferred; + + mb->rd_ptr (len_part); + + bytes_transferred -= len_part; + } + + // Create the interface result class. + ACE_Asynch_Write_Dgram::Result result (this); + + // Call the application handler. + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_write_dgram (result); +} + +ACE_WIN32_Asynch_Write_Dgram_Result::~ACE_WIN32_Asynch_Write_Dgram_Result (void) +{ +} + + +//*********************************************** + +ACE_WIN32_Asynch_Write_Dgram::~ACE_WIN32_Asynch_Write_Dgram (void) +{ +} + +ssize_t +ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, + size_t &number_of_bytes_sent, + int flags, + const ACE_Addr &addr, + const void *act, + int priority, + int signal_number) +{ + number_of_bytes_sent = 0; + + size_t bytes_to_write = 0; + + iovec iov[ACE_IOV_MAX]; + int iovcnt = 0; + + for (const ACE_Message_Block* msg = message_block; + msg != 0 && iovcnt < ACE_IOV_MAX; + msg = msg->cont () , ++iovcnt ) + { + size_t msg_len = msg->length (); + + bytes_to_write += msg_len; + + // Make as many iovec as needed to fit all of msg_len. + size_t rd_ptr_offset = 0; + + do + { + if (msg_len >= 0 && iovcnt < ACE_IOV_MAX) + { + u_long this_chunk_length; + if (msg_len > ULONG_MAX) + this_chunk_length = ULONG_MAX; + else + this_chunk_length = static_cast (msg_len); + + // Collect the data in the iovec. + iov[iovcnt].iov_base = msg->rd_ptr () + rd_ptr_offset; + iov[iovcnt].iov_len = this_chunk_length; + msg_len -= this_chunk_length; + rd_ptr_offset += this_chunk_length; + + // Increment iovec counter if there's more to do. + if (msg_len > 0) + iovcnt++; + } + } + while (msg_len > 0 && iovcnt < ACE_IOV_MAX); + + if (msg_len > 0) // Ran out of iovecs before msg_space exhausted + { + errno = ERANGE; + return -1; + } + } + + // Create the Asynch_Result. + ACE_WIN32_Asynch_Write_Dgram_Result *result = 0; + ACE_NEW_RETURN (result, + ACE_WIN32_Asynch_Write_Dgram_Result (this->handler_proxy_, + this->handle_, + message_block, + bytes_to_write, + flags, + act, + this->win32_proactor_->get_handle (), + priority, + signal_number), + -1); + + // do the scatter/gather send + + ssize_t initiate_result = ACE_OS::sendto (result->handle (), + iov, + iovcnt, + number_of_bytes_sent, + result->flags_, + (sockaddr *) addr.get_addr (), + addr.get_size(), + result, + 0); + + + if (initiate_result == SOCKET_ERROR) + { + // If initiate failed, check for a bad error. + ACE_OS::set_errno_to_last_error (); + switch (errno) + { + case ERROR_IO_PENDING: + // The IO will complete proactively: the OVERLAPPED will still + // get queued. + initiate_result = 0; + break; + + default: + // Something else went wrong: the OVERLAPPED will not get + // queued. + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("WSASendTo"))); + } + + delete result; + initiate_result = -1; + break; + } + + } + else + { + // Immediate success: the OVERLAPPED will still get queued. + // number_of_bytes_recvd contains the number of bytes recvd + // addr contains the peer address + // flags was updated + + // number_of_bytes_sent = bytes_sent; + initiate_result = 1; + } + + return initiate_result; +} + +int +ACE_WIN32_Asynch_Write_Dgram::open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor) +{ + return ACE_WIN32_Asynch_Operation::open (handler_proxy, + handle, + completion_key, + proactor); +} + +int +ACE_WIN32_Asynch_Write_Dgram::cancel (void) +{ + return ACE_WIN32_Asynch_Operation::cancel (); +} + +ACE_Proactor * +ACE_WIN32_Asynch_Write_Dgram::proactor (void) const +{ + return ACE_WIN32_Asynch_Operation::proactor (); +} + +ACE_WIN32_Asynch_Write_Dgram::ACE_WIN32_Asynch_Write_Dgram (ACE_WIN32_Proactor *win32_proactor) + : ACE_Asynch_Operation_Impl (), + ACE_Asynch_Write_Dgram_Impl (), + ACE_WIN32_Asynch_Operation (win32_proactor) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO && ACE_HAS_WINSOCK2 */ diff --git a/externals/ace/WIN32_Asynch_IO.h b/externals/ace/WIN32_Asynch_IO.h new file mode 100644 index 0000000..34af77d --- /dev/null +++ b/externals/ace/WIN32_Asynch_IO.h @@ -0,0 +1,1937 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file WIN32_Asynch_IO.h + * + * $Id: WIN32_Asynch_IO.h 80826 2008-03-04 14:51:23Z wotte $ + * + * + * These classes only works on Win32 platforms. + * + * The implementation of ACE_Asynch_Transmit_File, + * ACE_Asynch_Accept, and ACE_Asynch_Connect are only supported if + * ACE_HAS_WINSOCK2 is defined or you are on WinNT 4.0 or higher. + * + * + * @author Irfan Pyarali + * @author Tim Harrison + * @author Alexander Babu Arulanthu + * @author Roger Tragin + * @author Alexander Libman + */ +//============================================================================= + +#ifndef ACE_WIN32_ASYNCH_IO_H +#define ACE_WIN32_ASYNCH_IO_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) && \ + (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 1)) + +#include "ace/Asynch_IO_Impl.h" +#include "ace/Addr.h" +#include "ace/Event_Handler.h" +#include "ace/Handle_Set.h" +#include "ace/Map_Manager.h" +#include "ace/Null_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declaration +class ACE_WIN32_Proactor; + +/** + * @class ACE_WIN32_Asynch_Result + * + * @brief An abstract class which adds information to the OVERLAPPED + * structure to make it more useful. + * + * An abstract base class from which you can obtain some basic + * information like the number of bytes transferred, the ACT + * associated with the asynchronous operation, indication of + * success or failure, etc. Subclasses may want to store more + * information that is particular to the asynchronous operation + * it represents. + */ +class ACE_Export ACE_WIN32_Asynch_Result : public virtual ACE_Asynch_Result_Impl, + public OVERLAPPED +{ + /// Factory class has special permissions. + friend class ACE_WIN32_Asynch_Accept; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// Returns 0. + int signal_number (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Result (void); + + /// Simulate error value to use in the post_completion () + void set_error (u_long errcode); + + /// Simulate value to use in the post_completion () + void set_bytes_transferred (size_t nbytes); + +protected: + /// Constructor. + ACE_WIN32_Asynch_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + const void* act, + ACE_HANDLE event, + u_long offset, + u_long offset_high, + int priority, + int signal_number = 0); + + /// Proxy for the ACE_Handler that will be called back. + ACE_Handler::Proxy_Ptr handler_proxy_; + + /// ACT for this operation. + const void *act_; + + /// Bytes transferred by this operation. + size_t bytes_transferred_; + + /// Success indicator. + int success_; + + /// ACT associated with handle. + const void *completion_key_; + + /// Error if operation failed. + u_long error_; +}; + +/** + * @class ACE_WIN32_Asynch_Operation + * + * @brief This class abstracts out the common things needed for + * implementing Asynch_Operation for WIN32 platform. + * + */ +class ACE_Export ACE_WIN32_Asynch_Operation : public virtual ACE_Asynch_Operation_Impl +{ +public: + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + // = Access methods. + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +protected: + /// Constructor. + ACE_WIN32_Asynch_Operation (ACE_WIN32_Proactor *win32_proactor); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Operation (void); + + /// Win32 Proactor. + ACE_WIN32_Proactor *win32_proactor_; + + /// Proactor that this asynch IO is registered with. + ACE_Proactor *proactor_; + + /// Handler that will receive the callback. + ACE_Handler::Proxy_Ptr handler_proxy_; + + /// I/O handle used for reading. + ACE_HANDLE handle_; +}; + +/** + * @class ACE_WIN32_Asynch_Read_Stream_Result + * + * @brief This class provides concrete implementation for + * ACE_Asynch_Read_Stream::Result class. + */ +class ACE_Export ACE_WIN32_Asynch_Read_Stream_Result : public virtual ACE_Asynch_Read_Stream_Result_Impl, + public ACE_WIN32_Asynch_Result +{ + /// Factory class will have special permissions. + friend class ACE_WIN32_Asynch_Read_Stream; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + /// The number of bytes which were requested at the start of the + /// asynchronous read. + size_t bytes_to_read (void) const; + + /// Message block which contains the read data. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for reading. + ACE_HANDLE handle (void) const; + + // Base class operations. These operations are here to kill + // dominance warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + + /// Accessor for the scatter read flag + int scatter_enabled (void) const; + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Read_Stream factory. + ACE_WIN32_Asynch_Read_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0, + int scatter_enabled = 0); + + /// Proactor will call this method when the read completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Read_Stream_Result (void); + + /// Bytes requested when the asynchronous read was initiated. + size_t bytes_to_read_; + + /// Message block for reading the data into. + ACE_Message_Block &message_block_; + + /// I/O handle used for reading. + ACE_HANDLE handle_; + + /// Flag for scatter read + int scatter_enabled_; +}; + +/** + * @class ACE_WIN32_Asynch_Read_Stream + * + * @brief This class is a factory for starting off asynchronous reads + * on a stream. + * + * Once is called, multiple asynchronous s can + * started using this class. An ACE_Asynch_Read_Stream::Result + * will be passed back to the @a handler when the asynchronous + * reads completes through the + * callback. + */ +class ACE_Export ACE_WIN32_Asynch_Read_Stream : public virtual ACE_Asynch_Read_Stream_Impl, + public ACE_WIN32_Asynch_Operation +{ + +public: + /// Constructor. + ACE_WIN32_Asynch_Read_Stream (ACE_WIN32_Proactor *win32_proactor); + + /// This starts off an asynchronous read. Upto @a bytes_to_read will + /// be read and stored in the @a message_block. + int read (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number = 0); + + /** + * Same as above but with scatter support, through chaining of composite + * message blocks using the continuation field. + */ + int readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number = 0); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Read_Stream (void); + + // Methods belong to ACE_WIN32_Asynch_Operation base class. These + // methods are defined here to avoid VC++ warnings. They route the + // call to the ACE_WIN32_Asynch_Operation base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +protected: + /// This is the method which does the real work and is there so that + /// the ACE_Asynch_Read_File class can use it too. + int shared_read (ACE_WIN32_Asynch_Read_Stream_Result *result); +}; + +/** + * @class ACE_WIN32_Asynch_Write_Stream_Result + * + * @brief This class provides concrete implementation for + * ACE_Asynch_Write_Stream::Result class. + */ +class ACE_Export ACE_WIN32_Asynch_Write_Stream_Result : public virtual ACE_Asynch_Write_Stream_Result_Impl, + public ACE_WIN32_Asynch_Result +{ + /// Factory class willl have special permissions. + friend class ACE_WIN32_Asynch_Write_Stream; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + /// The number of bytes which were requested at the start of the + /// asynchronous write. + size_t bytes_to_write (void) const; + + /// Message block that contains the data to be written. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for writing. + ACE_HANDLE handle (void) const; + + // = Base class operations. These operations are here to kill some + // warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + + /// Accessor for the gather write flag + int gather_enabled (void) const; + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Write_Stream factory. + ACE_WIN32_Asynch_Write_Stream_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0, + int gather_enabled = 0); + + /// ACE_Proactor will call this method when the write completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Write_Stream_Result (void); + + /// The number of bytes which were requested at the start of the + /// asynchronous write. + size_t bytes_to_write_; + + /// Message block that contains the data to be written. + ACE_Message_Block &message_block_; + + /// I/O handle used for writing. + ACE_HANDLE handle_; + + /// Flag for gather write + int gather_enabled_; +}; + +/** + * @class ACE_WIN32_Asynch_Write_Stream + * + * @brief This class is a factory for starting off asynchronous writes + * on a stream. + * + * + * Once is called, multiple asynchronous s can + * started using this class. A ACE_Asynch_Write_Stream::Result + * will be passed back to the @a handler when the asynchronous + * write completes through the + * callback. + */ +class ACE_Export ACE_WIN32_Asynch_Write_Stream : public virtual ACE_Asynch_Write_Stream_Impl, + public ACE_WIN32_Asynch_Operation +{ +public: + /// Constructor. + ACE_WIN32_Asynch_Write_Stream (ACE_WIN32_Proactor *win32_proactor); + + /// This starts off an asynchronous write. Upto @a bytes_to_write + /// will be written from the @a message_block. + int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number = 0); + + /** + * Same as above but with gather support, through chaining of composite + * message blocks using the continuation field. + */ + int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number = 0); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Write_Stream (void); + + // = Methods belonging to base class. + + // These methods are defined here to avoid VC++ warnings. They route + // the call to the base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +protected: + /// This is the method which does the real work and is there so that + /// the ACE_Asynch_Write_File class can use it too. + int shared_write (ACE_WIN32_Asynch_Write_Stream_Result *result); +}; + +/** + * @class ACE_WIN32_Asynch_Read_File_Result + * + * @brief This class provides concrete implementation for + * ACE_Asynch_Read_File::Result class. + */ +class ACE_Export ACE_WIN32_Asynch_Read_File_Result : public virtual ACE_Asynch_Read_File_Result_Impl, + public ACE_WIN32_Asynch_Read_Stream_Result +{ + /// Factory class will have special permissions. + friend class ACE_WIN32_Asynch_Read_File; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + // = These methods belong to ACE_WIN32_Asynch_Result class base + // class. These operations are here to kill some warnings. These + // methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + // The following methods belong to + // ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++ + // dominance warnings. These methods route their call to the + // ACE_WIN32_Asynch_Read_Stream_Result base class. + + /// The number of bytes which were requested at the start of the + /// asynchronous read. + size_t bytes_to_read (void) const; + + /// Message block which contains the read data. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for reading. + ACE_HANDLE handle (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Read_File factory. + ACE_WIN32_Asynch_Read_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number = 0, + int scatter_enabled = 0); + + /// ACE_Proactor will call this method when the read completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Read_File_Result (void); +}; + +/** + * @class ACE_WIN32_Asynch_Read_File + * + * @brief This class is a factory for starting off asynchronous reads + * on a file. + * + * Once is called, multiple asynchronous s can + * started using this class. A ACE_Asynch_Read_File::Result + * will be passed back to the @a handler when the asynchronous + * reads completes through the + * callback. + * + * This class differs slightly from ACE_Asynch_Read_Stream as it + * allows the user to specify an offset for the read. + */ +class ACE_Export ACE_WIN32_Asynch_Read_File : public virtual ACE_Asynch_Read_File_Impl, + public ACE_WIN32_Asynch_Read_Stream +{ + +public: + /// Constructor. + ACE_WIN32_Asynch_Read_File (ACE_WIN32_Proactor *win32_proactor); + + /** + * This starts off an asynchronous read. Upto @a bytes_to_read will + * be read and stored in the @a message_block. The read will start + * at @a offset from the beginning of the file. + */ + int read (ACE_Message_Block &message_block, + size_t bytes_to_read, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number = 0); + + /** + * Same as above but with scatter support, through chaining of + * composite message blocks using the continuation field. + * @note Each data block payload must be at least the size of a + * system memory page and must be aligned on a system memory page + * size boundary + */ + int readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number = 0); + + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Read_File (void); + + // = Methods belong to ACE_WIN32_Asynch_Operation base class. These + // methods are defined here to avoid VC++ warnings. They route the + // call to the ACE_WIN32_Asynch_Operation base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +private: + /** + * This method belongs to ACE_WIN32_Asynch_Read_Stream. It is here + * to avoid the compiler warnings. We forward this call to the + * ACE_WIN32_Asynch_Read_Stream class. + */ + int read (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number = 0); + + /** + * Same as above but with scatter support, through chaining of composite + * message blocks using the continuation field. + */ + int readv (ACE_Message_Block &message_block, + size_t bytes_to_read, + const void *act, + int priority, + int signal_number = 0); +}; + +/** + * @class ACE_WIN32_Asynch_Write_File_Result + * + * @brief This class provides implementation for + * ACE_Asynch_Write_File_Result for WIN32 platforms. + * + * This class has all the information necessary for the + * @a handler to uniquiely identify the completion of the + * asynchronous write. + * + * This class differs slightly from + * ACE_Asynch_Write_Stream::Result as it calls back + * on the @a handler instead + * of . No additional state + * is required by this class as ACE_Asynch_Result can store + * the @a offset. + */ +class ACE_Export ACE_WIN32_Asynch_Write_File_Result : public virtual ACE_Asynch_Write_File_Result_Impl, + public ACE_WIN32_Asynch_Write_Stream_Result +{ + /// Factory class will have special permission. + friend class ACE_WIN32_Asynch_Write_File; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + // = Base class operations. These operations are here to kill some + // warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + // The following methods belong to + // ACE_WIN32_Asynch_Read_Stream_Result. They are here to avoid VC++ + // warnings. These methods route their call to the + // ACE_WIN32_Asynch_Read_Stream_Result base class. + + /// The number of bytes which were requested at the start of the + /// asynchronous write. + size_t bytes_to_write (void) const; + + /// Message block that contains the data to be written. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for writing. + ACE_HANDLE handle (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Write_File factory. + ACE_WIN32_Asynch_Write_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number = 0, + int gather_enabled = 0); + + /// ACE_Proactor will call this method when the write completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Write_File_Result (void); +}; + +/** + * @class ACE_WIN32_Asynch_Write_File + * + * @brief This class is a factory for starting off asynchronous writes + * on a file. + * + * Once is called, multiple asynchronous s can be + * started using this class. A ACE_Asynch_Write_File::Result + * will be passed back to the @a handler when the asynchronous + * writes completes through the + * callback. + */ +class ACE_Export ACE_WIN32_Asynch_Write_File : public virtual ACE_Asynch_Write_File_Impl, + public ACE_WIN32_Asynch_Write_Stream +{ +public: + /// Constructor. + ACE_WIN32_Asynch_Write_File (ACE_WIN32_Proactor *win32_proactor); + + /** + * This starts off an asynchronous write. Upto @a bytes_to_write + * will be write and stored in the @a message_block. The write will + * start at @a offset from the beginning of the file. + */ + int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number = 0); + + /** + * Same as above but with gather support, through chaining of + * composite message blocks using the continuation field. + * @note Each data block payload must be at least the size of a + * system memory page and must be aligned on a system memory page + * size boundary + */ + int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + const void *act, + int priority, + int signal_number = 0); + + /// Destrcutor. + virtual ~ACE_WIN32_Asynch_Write_File (void); + + // = Methods belong to ACE_WIN32_Asynch_Operation base class. These + // methods are defined here to avoid VC++ warnings. They route the + // call to the ACE_WIN32_Asynch_Operation base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +private: + /** + * This method belongs to ACE_WIN32_Asynch_Write_Stream. It is here + * to avoid compiler warnings. This method is forwarded to the + * ACE_WIN32_Asynch_Write_Stream class. + */ + int write (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number = 0); + + /** + * Same as above but with gather support, through chaining of composite + * message blocks using the continuation field. + */ + int writev (ACE_Message_Block &message_block, + size_t bytes_to_write, + const void *act, + int priority, + int signal_number = 0); +}; + +/** + * @class ACE_WIN32_Asynch_Accept_Result + * + * @brief This class implements ACE_Asynch_Accept::Result for WIN32 + * platform. + * + * This class has all the information necessary for the + * @a handler to uniquiely identify the completion of the + * asynchronous accept. + */ +class ACE_Export ACE_WIN32_Asynch_Accept_Result : public virtual ACE_Asynch_Accept_Result_Impl, + public ACE_WIN32_Asynch_Result +{ + /// Factory will have special permission. + friend class ACE_WIN32_Asynch_Accept; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + /// The number of bytes which were requested at the start of the + /// asynchronous accept. + size_t bytes_to_read (void) const; + + /// Message block which contains the read data. + ACE_Message_Block &message_block (void) const; + + /// I/O handle used for accepting new connections. + ACE_HANDLE listen_handle (void) const; + + /// I/O handle for the new connection. + ACE_HANDLE accept_handle (void) const; + + // = Base class operations. These operations are here to kill some + // warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Accept factory. + ACE_WIN32_Asynch_Accept_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + /// ACE_Proactor will call this method when the accept completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Accept_Result (void); + + /// Bytes requested when the asynchronous read was initiated. + size_t bytes_to_read_; + + /// Message block for reading the data into. + ACE_Message_Block &message_block_; + + /// I/O handle used for accepting new connections. + ACE_HANDLE listen_handle_; + + /// I/O handle for the new connection. + ACE_HANDLE accept_handle_; +}; + +/** + * @class ACE_WIN32_Asynch_Accept + * + * @brief This class is a factory for starting off asynchronous accepts + * on a listen handle. + * + * Once is called, multiple asynchronous s can + * started using this class. A ACE_Asynch_Accept::Result will + * be passed back to the @a handler when the asynchronous accept + * completes through the + * callback. + */ +class ACE_Export ACE_WIN32_Asynch_Accept : public virtual ACE_Asynch_Accept_Impl, + public ACE_WIN32_Asynch_Operation +{ +public: + /// Constructor. + ACE_WIN32_Asynch_Accept (ACE_WIN32_Proactor *win32_proactor); + + /** + * This starts off an asynchronous accept. The asynchronous accept + * call also allows any initial data to be returned to the + * @a handler. Upto @a bytes_to_read will be read and stored in the + * @a message_block. The will be used for the + * call. If ( == INVALID_HANDLE), a new + * handle will be created. + * + * @a message_block must be specified. This is because the address of + * the new connection is placed at the end of this buffer. + */ + int accept (ACE_Message_Block &message_block, + size_t bytes_to_read, + ACE_HANDLE accept_handle, + const void *act, + int priority, + int signal_number = 0, + int addr_family = AF_INET); + + /// Destructor. + ~ACE_WIN32_Asynch_Accept (void); + + // Methods belong to ACE_WIN32_Asynch_Operation base class. These + // methods are defined here to avoid VC++ warnings. They route the + // call to the ACE_WIN32_Asynch_Operation base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; +}; + +/** + * @class ACE_WIN32_Asynch_Connect_Result + * + * @brief This is that class which will be passed back to the + * completion handler when the asynchronous connect completes. + * + * This class has all the information necessary for the + * completion handler to uniquiely identify the completion of the + * asynchronous connect. + */ +class ACE_Export ACE_WIN32_Asynch_Connect_Result : public virtual ACE_Asynch_Connect_Result_Impl, + public ACE_WIN32_Asynch_Result +{ + /// Factory classes will have special permissions. + friend class ACE_WIN32_Asynch_Connect; + + /// The Proactor constructs the Result class for faking results. + friend class ACE_WIN32_Proactor; + +public: + + /// I/O handle for the connection. + ACE_HANDLE connect_handle (void) const; + + // = Base class operations. These operations are here to kill some + // warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * Returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + /// Post this object to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Connect factory. + ACE_WIN32_Asynch_Connect_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number); + + /// ACE_Proactor will call this method when the accept completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Connect_Result (void); + + /// Set the I/O handle for the new connection. + void connect_handle (ACE_HANDLE handle); + + ACE_HANDLE connect_handle_; +}; + + +/** + * @class ACE_WIN32_Asynch_Connect + */ +class ACE_Export ACE_WIN32_Asynch_Connect : + public virtual ACE_Asynch_Connect_Impl, + public ACE_WIN32_Asynch_Operation, + public ACE_Event_Handler +{ +public: + + /// Constructor. + ACE_WIN32_Asynch_Connect (ACE_WIN32_Proactor * win32_proactor); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Connect (void); + + /** + * This open belongs to ACE_WIN32_Asynch_Operation. We forward + * this call to that method. We have put this here to avoid the + * compiler warnings. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor = 0); + + /** + * Start an asynchronous connect. + * + * @param connect_handle Handle to use for the connect. If the value + * ACE_INVALID_HANDLE, a new handle will be created. + * + * @retval 0 Success + * @retval -1 Error + */ + int connect (ACE_HANDLE connect_handle, + const ACE_Addr &remote_sap, + const ACE_Addr &local_sap, + int reuse_addr, + const void *act, + int priority, + int signal_number = 0); + + /** + * Cancel all pending pseudo-asynchronus requests + * Behavior as usual AIO request + */ + int cancel (void); + + /** + * Close performs cancellation of all pending requests + * and close the connect handle + */ + int close (void); + + /// Virtual from ACE_Event_Handler + ACE_HANDLE get_handle (void) const; + + /// Virtual from ACE_Event_Handler + void set_handle (ACE_HANDLE handle); + + /// Virtual from ACE_Event_Handler + int handle_input ( ACE_HANDLE handle); + int handle_output ( ACE_HANDLE handle); + int handle_exception ( ACE_HANDLE handle); + + /// Virtual from ACE_Event_Handler + int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) ; + + // = Methods belong to ACE_WIN32_Asynch_Operation base class. These + // methods are defined here to avoid dominace warnings. They route + // the call to the ACE_WIN32_Asynch_Operation base class. + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +private: + int connect_i (ACE_WIN32_Asynch_Connect_Result *result, + const ACE_Addr &remote_sap, + const ACE_Addr &local_sap, + int reuse_addr); + + int post_result (ACE_WIN32_Asynch_Connect_Result *result, bool flg_post); + + /// Cancel uncompleted connect operations. + /** + * @param flg_notify Indicates whether or not to send notification about + * canceled connect operations. If false, don't send + * notifications. If true, notify user about canceled + * connects. + * According WIN32 standards we should receive + * notifications on canceled AIO requests. + * + * @param set Receives the set of I/O handles on which asynchronous + * connect requests were canceled as a result of this + * method. The contents of @a set are completely + * replaced. + */ + int cancel_uncompleted (bool flg_notify, ACE_Handle_Set &set); + + /// true - Connect is registered in ACE_Asynch_Pseudo_Task + /// false - Accept is deregisted in ACE_Asynch_Pseudo_Task + bool flg_open_ ; + + typedef ACE_Map_Manager + MAP_MANAGER; + + /// Map of Result pointers that correspond to all the 's + /// pending. + MAP_MANAGER result_map_; + + /// The lock to protect the result map which is shared. The queue + /// is updated by main thread in the register function call and + /// through the auxillary thread in the asynch pseudo task. + ACE_SYNCH_MUTEX lock_; +}; + +/** + * @class ACE_WIN32_Asynch_Transmit_File_Result + * + * + * @brief This class implements ACE_Asynch_Transmit_File::Result for + * WIN32 platforms. + * + * This class has all the information necessary for the + * @a handler to uniquiely identify the completion of the + * asynchronous transmit file. + */ +class ACE_Export ACE_WIN32_Asynch_Transmit_File_Result : public virtual ACE_Asynch_Transmit_File_Result_Impl, + public ACE_WIN32_Asynch_Result +{ + /// Factory class will have special permission. + friend class ACE_WIN32_Asynch_Transmit_File; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + /// Socket used for transmitting the file. + ACE_HANDLE socket (void) const; + + /// File from which the data is read. + ACE_HANDLE file (void) const; + + /// Header and trailer data associated with this transmit file. + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer (void) const; + + /// The number of bytes which were requested at the start of the + /// asynchronous transmit file. + size_t bytes_to_write (void) const; + + /// Number of bytes per send requested at the start of the transmit + /// file. + size_t bytes_per_send (void) const; + + /// Flags which were passed into transmit file. + u_long flags (void) const; + + // Base class operations. These operations are here to kill some + // warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Transmit_File factory. + ACE_WIN32_Asynch_Transmit_File_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + /// Proactor will call this method when the write completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Transmit_File_Result (void); + + /// Network I/O handle. + ACE_HANDLE socket_; + + /// File I/O handle. + ACE_HANDLE file_; + + /// Header and trailer data associated with this transmit file. + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer_; + + /// The number of bytes which were requested at the start of the + /// asynchronous transmit file. + size_t bytes_to_write_; + + /// Number of bytes per send requested at the start of the transmit + /// file. + size_t bytes_per_send_; + + /// Flags which were passed into transmit file. + u_long flags_; +}; + +/** + * @class ACE_WIN32_Asynch_Transmit_File + * + * @brief This class is a factory for starting off asynchronous + * transmit files on a stream. + * + * Once is called, multiple asynchronous s + * can started using this class. A + * ACE_Asynch_Transmit_File::Result will be passed back to the + * @a handler when the asynchronous transmit file completes + * through the callback. + * + * The transmit_file function transmits file data over a + * connected network connection. The function uses the operating + * system's cache manager to retrieve the file data. This + * function provides high-performance file data transfer over + * network connections. This function would be of great use in + * a Web Server, Image Server, etc. + */ +class ACE_Export ACE_WIN32_Asynch_Transmit_File : public virtual ACE_Asynch_Transmit_File_Impl, + public ACE_WIN32_Asynch_Operation +{ +public: + /// Constructor. + ACE_WIN32_Asynch_Transmit_File (ACE_WIN32_Proactor *win32_proactor); + + /** + * This starts off an asynchronous transmit file. The is a + * handle to an open file. is a pointer to a + * data structure that contains pointers to data to send before and + * after the file data is sent. Set this parameter to 0 if you only + * want to transmit the file data. Upto @a bytes_to_write will be + * written to the . If you want to send the entire file, + * let @a bytes_to_write = 0. @a bytes_per_send is the size of each + * block of data sent per send operation. Please read the Win32 + * documentation on what the flags should be. + */ + int transmit_file (ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + int priority, + int signal_number = 0); + + /// Destructor. + ~ACE_WIN32_Asynch_Transmit_File (void); + + // Methods belong to ACE_WIN32_Asynch_Operation base class. These + // methods are defined here to avoid VC++ warnings. They route the + // call to the ACE_WIN32_Asynch_Operation base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; +}; + +/** + * @class ACE_WIN32_Asynch_Read_Dgram_Result + * + * @brief This class provides concrete implementation for + * ACE_Asynch_Read_Dgram::Result class. + */ +class ACE_Export ACE_WIN32_Asynch_Read_Dgram_Result : public virtual ACE_Asynch_Read_Dgram_Result_Impl, + public ACE_WIN32_Asynch_Result +{ + /// Factory class will have special permissions. + friend class ACE_WIN32_Asynch_Read_Dgram; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + /// The number of bytes which were requested at the start of the + /// asynchronous read. + size_t bytes_to_read (void) const; + + /// Message block which contains the read data + ACE_Message_Block *message_block (void) const; + + /// The address of where the packet came from + int remote_address (ACE_Addr& addr) const; + + sockaddr *saddr () const; + + /// The flags used in the read + int flags (void) const; + + /// I/O handle used for reading. + ACE_HANDLE handle (void) const; + + // Base class operations. These operations are here to kill + // dominance warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Read_Dgram factory. + ACE_WIN32_Asynch_Read_Dgram_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + /// Proactor will call this method when the read completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Read_Dgram_Result (void); + + /// Bytes requested when the asynchronous read was initiated. + size_t bytes_to_read_; + + /// Message block for reading the data into. + ACE_Message_Block *message_block_; + + /// The address of where the packet came from + ACE_Addr *remote_address_; + + int addr_len_; + + /// The flags used in the read + int flags_; + + /// I/O handle used for reading. + ACE_HANDLE handle_; +}; + +/** + * @class ACE_WIN32_Asynch_Read_Dgram + * + * @brief This class is a factory for starting off asynchronous reads + * on a UDP socket. + * + * Once is called, multiple asynchronous s can be + * started using this class. An ACE_Asynch_Read_Dgram::Result + * will be passed back to the @a handler when the asynchronous + * reads completes through the + * callback. + * + */ +class ACE_Export ACE_WIN32_Asynch_Read_Dgram : public virtual ACE_Asynch_Read_Dgram_Impl, + public ACE_WIN32_Asynch_Operation +{ +public: + /// Constructor. + ACE_WIN32_Asynch_Read_Dgram (ACE_WIN32_Proactor *win32_proactor); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Read_Dgram (void); + + /** This starts off an asynchronous read. Upto + * total_size()> will be read and stored in the + * @a message_block. @a message_block's will be updated to reflect + * the added bytes if the read operation is successfully completed. + * Return code of 1 means immediate success and + * will contain number of bytes read. The + * method will still be called. Return code of 0 means the IO will + * complete proactively. Return code of -1 means there was an error, use + * errno to get the error code. + * + * Scatter/gather is supported on WIN32 by using the cont()> + * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto + * size()> bytes will be read into each for + * a total of total_size()> bytes. All @a message_block's + * 's will be updated to reflect the added bytes for each + * @a message_block + */ + virtual ssize_t recv (ACE_Message_Block *message_block, + size_t &number_of_bytes_recvd, + int flags, + int protocol_family, + const void *act, + int priority, + int signal_number); + + // Methods belong to ACE_WIN32_Asynch_Operation base class. These + // methods are defined here to avoid VC++ warnings. They route the + // call to the ACE_WIN32_Asynch_Operation base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +protected: + /// Do-nothing constructor. + ACE_WIN32_Asynch_Read_Dgram (void); +}; + +/** + * @class ACE_WIN32_Asynch_Write_Dgram_Result + * + * @brief This class provides concrete implementation for + * ACE_Asynch_Write_Dgram::Result class. + */ +class ACE_Export ACE_WIN32_Asynch_Write_Dgram_Result : public virtual ACE_Asynch_Write_Dgram_Result_Impl, + public ACE_WIN32_Asynch_Result +{ + /// Factory class willl have special permissions. + friend class ACE_WIN32_Asynch_Write_Dgram; + + /// Proactor class has special permission. + friend class ACE_WIN32_Proactor; + +public: + /// The number of bytes which were requested at the start of the + /// asynchronous write. + size_t bytes_to_write (void) const; + + /// Message block which contains the sent data + ACE_Message_Block *message_block (void) const; + + /// The flags using in the write + int flags (void) const; + + /// I/O handle used for writing. + ACE_HANDLE handle (void) const; + + // = Base class operations. These operations are here to kill some + // warnings. These methods call the base class methods. + + /// Number of bytes transferred by the operation. + size_t bytes_transferred (void) const; + + /// ACT associated with the operation. + const void *act (void) const; + + /// Did the operation succeed? + int success (void) const; + + /** + * This returns the ACT associated with the handle when it was + * registered with the I/O completion port. This ACT is not the + * same as the ACT associated with the asynchronous operation. + */ + const void *completion_key (void) const; + + /// Error value if the operation fail. + u_long error (void) const; + + /// Event associated with the OVERLAPPED structure. + ACE_HANDLE event (void) const; + + /// This really make sense only when doing file I/O. + u_long offset (void) const; + + /// Offset_high associated with the OVERLAPPED structure. + u_long offset_high (void) const; + + /// The priority of the asynchronous operation. Currently, this is + /// not supported on Win32. + int priority (void) const; + + /// No-op. Returns 0. + int signal_number (void) const; + + /// Post @c this to the Proactor's completion port. + int post_completion (ACE_Proactor_Impl *proactor); + +protected: + /// Constructor is protected since creation is limited to + /// ACE_Asynch_Write_Stream factory. + ACE_WIN32_Asynch_Write_Dgram_Result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_write, + int flags, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + /// ACE_Proactor will call this method when the write completes. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Write_Dgram_Result (void); + + /// The number of bytes which were requested at the start of the + /// asynchronous write. + size_t bytes_to_write_; + + /// Message block used for the send. + ACE_Message_Block *message_block_; + + /// The flags using in the write + int flags_; + + /// I/O handle used for writing. + ACE_HANDLE handle_; +}; + +/** + * @class ACE_WIN32_Asynch_Write_Dgram + * + * @brief This class is a factory for starting off asynchronous writes + * on a UDP socket. + * + * + * Once is called, multiple asynchronous s can + * started using this class. A ACE_Asynch_Write_Stream::Result + * will be passed back to the @a handler when the asynchronous + * write completes through the + * callback. + */ +class ACE_Export ACE_WIN32_Asynch_Write_Dgram : public virtual ACE_Asynch_Write_Dgram_Impl, + public ACE_WIN32_Asynch_Operation +{ +public: + /// Constructor. + ACE_WIN32_Asynch_Write_Dgram (ACE_WIN32_Proactor *win32_proactor); + + /// Destructor. + virtual ~ACE_WIN32_Asynch_Write_Dgram (void); + + /** This starts off an asynchronous send. Upto + * total_length()> will be sent. @a message_block's + * will be updated to reflect the sent bytes if the send operation + * is successfully completed. + * Return code of 1 means immediate success and + * is updated to number of bytes sent. The + * method will still be called. Return code of 0 means the IO will + * complete proactively. Return code of -1 means there was an error, use + * errno to get the error code. + * + * Scatter/gather is supported on WIN32 by using the cont()> + * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto + * length()> bytes will be sent from each + * for a total of total_length()> bytes. All + * @a message_block's 's will be updated to reflect the bytes sent + * from each @a message_block. + */ + virtual ssize_t send (ACE_Message_Block *message_block, + size_t &number_of_bytes_sent, + int flags, + const ACE_Addr &addr, + const void *act, + int priority, + int signal_number); + + // = Methods belonging to base class. + + // These methods are defined here to avoid VC++ warnings. They route + // the call to the base class. + + /** + * Initializes the factory with information which will be used with + * each asynchronous call. If ( == ACE_INVALID_HANDLE), + * will be called on the @a handler to get the + * correct handle. + */ + int open (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + const void *completion_key, + ACE_Proactor *proactor); + + /** + * This cancels all pending accepts operations that were issued by + * the calling thread. The function does not cancel asynchronous + * operations issued by other threads. + */ + int cancel (void); + + /// Return the underlying proactor. + ACE_Proactor* proactor (void) const; + +protected: + /// Do-nothing constructor. + ACE_WIN32_Asynch_Write_Dgram (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO && ACE_HAS_WINSOCK2 */ +#include /**/ "ace/post.h" +#endif /* ACE_WIN32_ASYNCH_IO_H */ diff --git a/externals/ace/WIN32_Proactor.cpp b/externals/ace/WIN32_Proactor.cpp new file mode 100644 index 0000000..a559838 --- /dev/null +++ b/externals/ace/WIN32_Proactor.cpp @@ -0,0 +1,804 @@ +// $Id: WIN32_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $ + +// ACE_RCSID(ace, Proactor, "$Id: WIN32_Proactor.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#include "ace/WIN32_Proactor.h" + +#if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_OVERLAPPED_IO) +// WIN implemenatation of the Proactor. + +#include "ace/Log_Msg.h" +#include "ace/Object_Manager.h" +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_unistd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_WIN32_Wakeup_Completion + * + * This is result object is used by the of the + * ACE_Proactor interface to wake up all the threads blocking + * for completions. + */ +class ACE_WIN32_Wakeup_Completion : public ACE_WIN32_Asynch_Result +{ + +public: + /// Constructor. + ACE_WIN32_Wakeup_Completion (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act = 0, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Destructor. + virtual ~ACE_WIN32_Wakeup_Completion (void); + + /// This method calls the 's method. + virtual void complete (size_t bytes_transferred = 0, + int success = 1, + const void *completion_key = 0, + u_long error = 0); +}; + +ACE_WIN32_Proactor::ACE_WIN32_Proactor (size_t number_of_threads, + bool used_with_reactor_event_loop) + : completion_port_ (0), + // This *MUST* be 0, *NOT* ACE_INVALID_HANDLE !!! + number_of_threads_ (static_cast (number_of_threads)), + used_with_reactor_event_loop_ (used_with_reactor_event_loop) +{ + // Create the completion port. + this->completion_port_ = ::CreateIoCompletionPort (INVALID_HANDLE_VALUE, + 0, + 0, + this->number_of_threads_); + if (this->completion_port_ == 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("CreateIoCompletionPort"))); + + this->get_asynch_pseudo_task ().start (); +} + +ACE_WIN32_Proactor::~ACE_WIN32_Proactor (void) +{ + this->get_asynch_pseudo_task ().stop (); + + this->close (); +} + +ACE_Asynch_Pseudo_Task & +ACE_WIN32_Proactor::get_asynch_pseudo_task () +{ + return this->pseudo_task_; +} + +int +ACE_WIN32_Proactor::close (void) +{ + // Close the completion port + if (this->completion_port_ != 0) + { + // To avoid memory leaks we should delete all results from queue. + + for (;;) + { + ACE_OVERLAPPED *overlapped = 0; + u_long bytes_transferred = 0; + ULONG_PTR completion_key = 0; + + // Get the next asynchronous operation that completes + BOOL res = ::GetQueuedCompletionStatus + (this->completion_port_, + &bytes_transferred, + &completion_key, + &overlapped, + 0); // poll + + if (overlapped == 0 || res == FALSE) + break; + + ACE_WIN32_Asynch_Result *asynch_result = + (ACE_WIN32_Asynch_Result *) overlapped; + + delete asynch_result; + } + + int result = ACE_OS::close (this->completion_port_); + this->completion_port_ = 0; + return result; + } + + return 0; +} + +int +ACE_WIN32_Proactor::register_handle (ACE_HANDLE handle, + const void *completion_key) +{ + ULONG_PTR comp_key (reinterpret_cast (completion_key)); + + // No locking is needed here as no state changes. + ACE_HANDLE cp = ::CreateIoCompletionPort (handle, + this->completion_port_, + comp_key, + this->number_of_threads_); + if (cp == 0) + { + ACE_OS::set_errno_to_last_error (); + // If errno == ERROR_INVALID_PARAMETER, then this handle was + // already registered. + if (errno != ERROR_INVALID_PARAMETER) + { + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("CreateIoCompletionPort"))); + } + return -1; + } + } + return 0; +} + +ACE_Asynch_Read_Stream_Impl * +ACE_WIN32_Proactor::create_asynch_read_stream (void) +{ + ACE_Asynch_Read_Stream_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Read_Stream (this), + 0); + return implementation; +} + +ACE_Asynch_Write_Stream_Impl * +ACE_WIN32_Proactor::create_asynch_write_stream (void) +{ + ACE_Asynch_Write_Stream_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Write_Stream (this), + 0); + return implementation; +} + +ACE_Asynch_Read_Dgram_Impl * +ACE_WIN32_Proactor::create_asynch_read_dgram (void) +{ + ACE_Asynch_Read_Dgram_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Read_Dgram (this), + 0); + return implementation; +} + +ACE_Asynch_Write_Dgram_Impl * +ACE_WIN32_Proactor::create_asynch_write_dgram (void) +{ + ACE_Asynch_Write_Dgram_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Write_Dgram (this), + 0); + return implementation; +} + +ACE_Asynch_Read_File_Impl * +ACE_WIN32_Proactor::create_asynch_read_file (void) +{ + ACE_Asynch_Read_File_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Read_File (this), + 0); + return implementation; +} + +ACE_Asynch_Write_File_Impl * +ACE_WIN32_Proactor::create_asynch_write_file (void) +{ + ACE_Asynch_Write_File_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Write_File (this), + 0); + return implementation; +} + +ACE_Asynch_Accept_Impl * +ACE_WIN32_Proactor::create_asynch_accept (void) +{ + ACE_Asynch_Accept_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Accept (this), + 0); + return implementation; +} + +ACE_Asynch_Connect_Impl * +ACE_WIN32_Proactor::create_asynch_connect (void) +{ + ACE_Asynch_Connect_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Connect (this), + 0); + return implementation; +} + +ACE_Asynch_Transmit_File_Impl * +ACE_WIN32_Proactor::create_asynch_transmit_file (void) +{ + ACE_Asynch_Transmit_File_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Transmit_File (this), + 0); + return implementation; +} + +ACE_Asynch_Read_Stream_Result_Impl * +ACE_WIN32_Proactor::create_asynch_read_stream_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Read_Stream_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Read_Stream_Result (handler_proxy, + handle, + message_block, + bytes_to_read, + act, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Write_Stream_Result_Impl * +ACE_WIN32_Proactor::create_asynch_write_stream_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Write_Stream_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Write_Stream_Result (handler_proxy, + handle, + message_block, + bytes_to_write, + act, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Read_File_Result_Impl * +ACE_WIN32_Proactor::create_asynch_read_file_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Read_File_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Read_File_Result (handler_proxy, + handle, + message_block, + bytes_to_read, + act, + offset, + offset_high, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Write_File_Result_Impl * +ACE_WIN32_Proactor::create_asynch_write_file_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Write_File_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Write_File_Result (handler_proxy, + handle, + message_block, + bytes_to_write, + act, + offset, + offset_high, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Read_Dgram_Result_Impl * +ACE_WIN32_Proactor::create_asynch_read_dgram_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Read_Dgram_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Read_Dgram_Result (handler_proxy, + handle, + message_block, + bytes_to_read, + flags, + protocol_family, + act, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Write_Dgram_Result_Impl * +ACE_WIN32_Proactor::create_asynch_write_dgram_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Write_Dgram_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Write_Dgram_Result(handler_proxy, + handle, + message_block, + bytes_to_read, + flags, + act, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Accept_Result_Impl * +ACE_WIN32_Proactor::create_asynch_accept_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Accept_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Accept_Result (handler_proxy, + listen_handle, + accept_handle, + message_block, + bytes_to_read, + act, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Connect_Result_Impl * +ACE_WIN32_Proactor::create_asynch_connect_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Connect_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Connect_Result (handler_proxy, + connect_handle, + act, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Transmit_File_Result_Impl * +ACE_WIN32_Proactor::create_asynch_transmit_file_result + (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Transmit_File_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Transmit_File_Result (handler_proxy, + socket, + file, + header_and_trailer, + bytes_to_write, + offset, + offset_high, + bytes_per_send, + flags, + act, + event, + priority, + signal_number), + 0); + return implementation; +} + +ACE_Asynch_Result_Impl * +ACE_WIN32_Proactor::create_asynch_timer (const ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number) +{ + ACE_Asynch_Result_Impl *implementation = 0; + ACE_NEW_RETURN (implementation, + ACE_WIN32_Asynch_Timer (handler_proxy, + act, + tv, + event, + priority, + signal_number), + 0); + return implementation; +} + +int +ACE_WIN32_Proactor::handle_signal (int, siginfo_t *, ucontext_t *) +{ + // Perform a non-blocking "poll" for all the I/O events that have + // completed in the I/O completion queue. + + int result = 0; + + for (ACE_Time_Value timeout (0, 0); + ; + ) + { + result = this->handle_events (timeout); + + if (result != 1) + break; + } + + // If our handle_events failed, we'll report a failure to the + // Reactor. + return result == -1 ? -1 : 0; +} + +int +ACE_WIN32_Proactor::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask) +{ + ACE_UNUSED_ARG (close_mask); + ACE_UNUSED_ARG (handle); + + return this->close (); +} + +ACE_HANDLE +ACE_WIN32_Proactor::get_handle (void) const +{ + if (this->used_with_reactor_event_loop_) + return this->event_.handle (); + else + return 0; +} + +int +ACE_WIN32_Proactor::handle_events (ACE_Time_Value &wait_time) +{ + // Decrement with the amount of time spent in the method + ACE_Countdown_Time countdown (&wait_time); + return this->handle_events (wait_time.msec ()); +} + +int +ACE_WIN32_Proactor::handle_events (void) +{ + return this->handle_events (ACE_INFINITE); +} + +int +ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds) +{ + ACE_OVERLAPPED *overlapped = 0; + u_long bytes_transferred = 0; + ULONG_PTR completion_key = 0; + + // Get the next asynchronous operation that completes + BOOL result = ::GetQueuedCompletionStatus (this->completion_port_, + &bytes_transferred, + &completion_key, + &overlapped, + milli_seconds); + if (result == FALSE && overlapped == 0) + { + ACE_OS::set_errno_to_last_error (); + + switch (errno) + { + case WAIT_TIMEOUT: + errno = ETIME; + return 0; + + case ERROR_SUCCESS: + // Calling GetQueuedCompletionStatus with timeout value 0 + // returns FALSE with extended errno "ERROR_SUCCESS" errno = + // ETIME; ?? I don't know if this has to be done !! + return 0; + + default: + if (ACE::debug ()) + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("GetQueuedCompletionStatus"))); + return -1; + } + } + else if (overlapped != 0) + { + // Narrow the result. + ACE_WIN32_Asynch_Result *asynch_result = (ACE_WIN32_Asynch_Result *) overlapped; + + // If errors happen, grab the error. + if (result == FALSE) + ACE_OS::set_errno_to_last_error (); + else + errno = 0; + + u_long result_err = asynch_result->error (); + + // if "result_err" is 0 than + // It is normal OS/WIN32 AIO completion. + // We have cleared asynch_result->error_ + // during shared_read/shared_write. + // The real error code is already stored in "errno", + // so copy "errno" value to the "result_err" + // and pass this "result_err" code + // to the application_specific_code () + // else + // "result_err" non zero + // it means we have "post_completed" result + // so pass this "result_err" code + // to the application_specific_code () + + if (result_err == 0) + result_err = errno ; + + this->application_specific_code (asynch_result, + static_cast (bytes_transferred), + (void *) completion_key, + result_err); + } + return 1; +} + +void +ACE_WIN32_Proactor::application_specific_code (ACE_WIN32_Asynch_Result *asynch_result, + size_t bytes_transferred, + const void *completion_key, + u_long error) +{ + ACE_SEH_TRY + { + // Call completion hook + asynch_result->complete (bytes_transferred, + error ? 0 : 1, + (void *) completion_key, + error); + } + ACE_SEH_FINALLY + { + // This is crucial to prevent memory leaks + delete asynch_result; + } +} + +int +ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result) +{ + // Grab the event associated with the Proactor + HANDLE handle = this->get_handle (); + + // pass + // bytes_transferred + // completion_key + // to the ::PostQueuedCompletionStatus() + // error will be extracted later in handle_events() + + DWORD bytes_transferred = 0; + const void * completion_key = 0 ; + + if (result != 0) + { + // This cast is ok since the original API calls restricted the transfer + // counts to DWORD range. + bytes_transferred = static_cast (result->bytes_transferred ()); + completion_key = result->completion_key(); + } + + ULONG_PTR comp_key (reinterpret_cast (completion_key)); + + // Post a completion + if (::PostQueuedCompletionStatus (this->completion_port_, // completion port + bytes_transferred, // xfer count + comp_key, // completion key + result // overlapped + ) == FALSE) + { + delete result; + + if (ACE::debug ()) + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("PostQueuedCompletionStatus failed"))); + } + return -1; + } + + // If Proactor event is valid, signal it + if (handle != ACE_INVALID_HANDLE + && handle != 0) + ACE_OS::event_signal (&handle); + + return 0; +} + +int +ACE_WIN32_Proactor::post_wakeup_completions (int how_many) +{ + ACE_WIN32_Wakeup_Completion *wakeup_completion = 0; + + for (ssize_t ci = 0; ci < how_many; ci++) + { + ACE_NEW_RETURN + (wakeup_completion, + ACE_WIN32_Wakeup_Completion (this->wakeup_handler_.proxy ()), + -1); + + if (wakeup_completion->post_completion (this) == -1) + return -1; + } + + return 0; +} + +int +ACE_WIN32_Proactor::wake_up_dispatch_threads (void) +{ + return 0; +} + +int +ACE_WIN32_Proactor::close_dispatch_threads (int) +{ + return 0; +} + +size_t +ACE_WIN32_Proactor::number_of_threads (void) const +{ + return static_cast (this->number_of_threads_); +} + +void +ACE_WIN32_Proactor::number_of_threads (size_t threads) +{ + this->number_of_threads_ = static_cast (threads); +} + +ACE_WIN32_Asynch_Timer::ACE_WIN32_Asynch_Timer + (const ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + ACE_WIN32_Asynch_Result (handler_proxy, act, event, 0, 0, priority, + signal_number), + time_ (tv) +{ +} + +void +ACE_WIN32_Asynch_Timer::complete (size_t, + int, + const void *, + u_long) +{ + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_time_out (this->time_, this->act ()); +} + +ACE_WIN32_Wakeup_Completion::ACE_WIN32_Wakeup_Completion + (ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number) + : ACE_Asynch_Result_Impl (), + ACE_WIN32_Asynch_Result + (handler_proxy, act, event, 0, 0, priority, signal_number) +{ +} + +ACE_WIN32_Wakeup_Completion::~ACE_WIN32_Wakeup_Completion (void) +{ +} + +void +ACE_WIN32_Wakeup_Completion::complete (size_t /* bytes_transferred */, + int /* success */, + const void * /* completion_key */, + u_long /* error */) +{ + ACE_Handler *handler = this->handler_proxy_.get ()->handler (); + if (handler != 0) + handler->handle_wakeup (); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_WIN32 */ diff --git a/externals/ace/WIN32_Proactor.h b/externals/ace/WIN32_Proactor.h new file mode 100644 index 0000000..4fb686d --- /dev/null +++ b/externals/ace/WIN32_Proactor.h @@ -0,0 +1,325 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file WIN32_Proactor.h + * + * $Id: WIN32_Proactor.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Irfan Pyarali (irfan@cs.wustl.edu) + * @author Tim Harrison (harrison@cs.wustl.edu) + * @author Alexander Babu Arulanthu + * @author Roger Tragin + * @author Alexander Libman + */ +//============================================================================= + +#ifndef ACE_WIN32_PROACTOR_H +#define ACE_WIN32_PROACTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_WIN32) && defined (ACE_HAS_WIN32_OVERLAPPED_IO) +// WIN32 implementation of the Proactor. + +#include "ace/WIN32_Asynch_IO.h" +#include "ace/Event_Handler.h" + +#include "ace/Proactor_Impl.h" +#include "ace/Asynch_Pseudo_Task.h" +#include "ace/Auto_Event.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations. +class ACE_WIN32_Asynch_Result; +class ACE_WIN32_Proactor_Timer_Handler; + +/** + * @class ACE_WIN32_Proactor + * + * @brief A manager for asynchronous event demultiplexing on Win32. + * + * See the Proactor pattern description at + * http://www.cs.wustl.edu/~schmidt/PDF/proactor.pdf for more + * details. + */ +class ACE_Export ACE_WIN32_Proactor : public ACE_Proactor_Impl +{ + friend class ACE_WIN32_Asynch_Connect; + +public: + /// A do nothing constructor. + ACE_WIN32_Proactor (size_t number_of_threads = 0, + bool used_with_reactor_event_loop = false); + + /// Virtual destruction. + virtual ~ACE_WIN32_Proactor (void); + + /// Close the IO completion port. + virtual int close (void); + + /// This method adds the @a handle to the I/O completion port. This + /// function is a no-op function for Unix systems. + virtual int register_handle (ACE_HANDLE handle, + const void *completion_key); + + /** + * Dispatch a single set of events. If @a wait_time elapses before + * any events occur, return 0. Return 1 on success i.e., when a + * completion is dispatched, non-zero (-1) on errors and errno is + * set accordingly. + */ + virtual int handle_events (ACE_Time_Value &wait_time); + + /** + * Block indefinitely until at least one event is dispatched. + * Dispatch a single set of events. Return 1 on success i.e., when a + * completion is dispatched, non-zero (-1) on errors and errno is + * set accordingly. + */ + virtual int handle_events (void); + + /** + * Post a result to the completion port of the Proactor. If errors + * occur, the result will be deleted by this method. If successful, + * the result will be deleted by the Proactor when the result is + * removed from the completion port. Therefore, the result should + * have been dynamically allocated and should be orphaned by the + * user once this method is called. + */ + virtual int post_completion (ACE_WIN32_Asynch_Result *result); + + /// Add wakeup dispatch threads (reinit). + int wake_up_dispatch_threads (void); + + /// Close all dispatch threads. + int close_dispatch_threads (int wait); + + /// Get number of thread used as a parameter to @c CreateIoCompletionPort. + size_t number_of_threads (void) const; + + /// Set number of thread used as a parameter to @c CreateIoCompletionPort. + void number_of_threads (size_t threads); + + /// Get the event handle. + virtual ACE_HANDLE get_handle (void) const; + + virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void); + virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void); + virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void); + virtual ACE_Asynch_Write_File_Impl *create_asynch_write_file (void); + virtual ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void); + virtual ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void); + virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void); + virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void); + virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void); + + // Methods used to create Asynch_IO_Result objects. We create the right + // objects here in these methods. + + virtual ACE_Asynch_Read_Stream_Result_Impl *create_asynch_read_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + virtual ACE_Asynch_Write_Stream_Result_Impl *create_asynch_write_stream_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + virtual ACE_Asynch_Read_File_Result_Impl *create_asynch_read_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + virtual ACE_Asynch_Write_File_Result_Impl *create_asynch_write_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + size_t bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + /// Create the correct implementation class for ACE_Asynch_Read_Dgram::Result. + virtual ACE_Asynch_Read_Dgram_Result_Impl *create_asynch_read_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + /// Create the correct implementation class for ACE_Asynch_Write_Dgram::Result. + virtual ACE_Asynch_Write_Dgram_Result_Impl *create_asynch_write_dgram_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_write, + int flags, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + virtual ACE_Asynch_Accept_Result_Impl *create_asynch_accept_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + size_t bytes_to_read, + const void* act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + virtual ACE_Asynch_Connect_Result_Impl *create_asynch_connect_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE connect_handle, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + + virtual ACE_Asynch_Transmit_File_Result_Impl *create_asynch_transmit_file_result (const ACE_Handler::Proxy_Ptr &handler_proxy, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + size_t bytes_to_write, + u_long offset, + u_long offset_high, + size_t bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event, + int priority, + int signal_number = 0); + + /// Create a timer result object which can be used with the Timer + /// mechanism of the Proactor. + virtual ACE_Asynch_Result_Impl *create_asynch_timer (const ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event, + int priority, + int signal_number = 0); + +protected: + /// Task to process pseudo-asynchronous operations + ACE_Asynch_Pseudo_Task & get_asynch_pseudo_task (void); + + /// Called when object is signaled by OS (either via UNIX signals or + /// when a Win32 object becomes signaled). + virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); + + /// Called when object is removed from the ACE_Reactor. + virtual int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + /** + * Dispatch a single set of events. If @a milli_seconds elapses + * before any events occur, return 0. Return 1 if a completion is + * dispatched. Return -1 on errors. + */ + virtual int handle_events (unsigned long milli_seconds); + + /// Protect against structured exceptions caused by user code when + /// dispatching handles. + void application_specific_code (ACE_WIN32_Asynch_Result *asynch_result, + size_t bytes_transferred, + const void *completion_key, + u_long error); + + /** + * Post @a how_many completions to the completion port so that all + * threads can wake up. This is used in conjunction with the + * run_event_loop(). + */ + virtual int post_wakeup_completions (int how_many); + + /// Handle for the completion port. Unix doesnt have completion + /// ports. + ACE_HANDLE completion_port_; + + /// This number is passed to the @c CreateIOCompletionPort system + /// call. + DWORD number_of_threads_; + + /// This event is used in conjunction with Reactor when we try to + /// integrate the event loops of Reactor and the Proactor. + ACE_Auto_Event event_; + + /// Flag that indicates whether we are used in conjunction with + /// Reactor. + bool const used_with_reactor_event_loop_; + + /// Handler to handle the wakeups. This works in conjunction with the + /// ACE_Proactor::run_event_loop(). + ACE_Handler wakeup_handler_; + + /// Pseudo-task for asynch connect ( NT/2000) + /// In future should removed in XP with ConnectEx support + ACE_Asynch_Pseudo_Task pseudo_task_; +}; + +/** + * @class ACE_WIN32_Asynch_Timer + * + * @brief This class is posted to the completion port when a timer + * expires. When the complete method of this object is + * called, the @a handler's handle_timeout method will be + * called. + */ +class ACE_WIN32_Asynch_Timer : public ACE_WIN32_Asynch_Result +{ + /// The factory method for this class is with the POSIX_Proactor + /// class. + friend class ACE_WIN32_Proactor; + +protected: + /// Constructor. + ACE_WIN32_Asynch_Timer (const ACE_Handler::Proxy_Ptr &handler_proxy, + const void *act, + const ACE_Time_Value &tv, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = 0); + + /// This method calls the @a handler's handle_timeout method. + virtual void complete (size_t bytes_transferred, + int success, + const void *completion_key, + u_long error = 0); + + /// Time value requested by caller + ACE_Time_Value time_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_WIN32 */ +#include /**/ "ace/post.h" +#endif /* ACE_PROACTOR_H */ diff --git a/externals/ace/XML_Svc_Conf.cpp b/externals/ace/XML_Svc_Conf.cpp new file mode 100644 index 0000000..23dddad --- /dev/null +++ b/externals/ace/XML_Svc_Conf.cpp @@ -0,0 +1,15 @@ +// $Id: XML_Svc_Conf.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/XML_Svc_Conf.h" + +#if (ACE_USES_CLASSIC_SVC_CONF == 0) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_XML_Svc_Conf::~ACE_XML_Svc_Conf (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ diff --git a/externals/ace/XML_Svc_Conf.h b/externals/ace/XML_Svc_Conf.h new file mode 100644 index 0000000..883151e --- /dev/null +++ b/externals/ace/XML_Svc_Conf.h @@ -0,0 +1,65 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file XML_Svc_Conf.h + * + * $Id: XML_Svc_Conf.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Nanbor Wang + */ +//============================================================================= + + +#ifndef ACE_XML_SVC_CONF_H +#define ACE_XML_SVC_CONF_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if (ACE_USES_CLASSIC_SVC_CONF==0) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_XML_Svc_Conf + * + * @brief This abstract class defines the common operations + * ACE_Service_Config expects when using the XML Service Config Parser. + * + * When implementing a concret XML_Svc_Conf class, be sure to overload + * the new/delete function so the dynamically created concret XML_Svc_Conf + * instance can be deleted from the original heap in the DLL/SO. The + * concret XML_Svc_Conf implementation will be put into a DLL/SO that + * ACE applications can link to dynamically using the ACE_DLL class. + * This DLL should include an operation as follow: + * + * extern "C" ACE_XML_Svc_Conf_Parser * _ACEXML_create_XML_Svc_Conf_Object (void); + * + * + */ + +class ACE_Export ACE_XML_Svc_Conf +{ +public: + typedef ACE_XML_Svc_Conf *(*Factory)(void); + + virtual ~ACE_XML_Svc_Conf (void) = 0; + + virtual int parse_file (const ACE_TCHAR file[]) = 0; + + virtual int parse_string (const ACE_TCHAR str[]) = 0; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ + +#include /**/ "ace/post.h" + +#endif /* ACE_XML_SVC_CONF_H */ diff --git a/externals/ace/XTI_ATM_Mcast.cpp b/externals/ace/XTI_ATM_Mcast.cpp new file mode 100644 index 0000000..503e3fe --- /dev/null +++ b/externals/ace/XTI_ATM_Mcast.cpp @@ -0,0 +1,70 @@ +// $Id: XTI_ATM_Mcast.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/XTI_ATM_Mcast.h" + +ACE_RCSID(ace, XTI_ATM_Mcast, "$Id: XTI_ATM_Mcast.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if defined (ACE_HAS_XTI_ATM) + +#if !defined (__ACE_INLINE__) +#include "ace/XTI_ATM_Mcast.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_XTI_ATM_Mcast) + +void +ACE_XTI_ATM_Mcast::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_XTI_ATM_Mcast::dump"); +#endif /* ACE_HAS_DUMP */ +} + +ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (void) +{ + ACE_TRACE ("ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast"); +} + +// Add a leaf to the current connection (i.e., multicast). + +int +ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream ¤t_stream, + const ACE_Addr &remote_sap, + ACE_INT32 leaf_id, + ACE_Time_Value *timeout) +{ + ACE_TRACE ("ACE_XTI_ATM_Mcast::add_leaf"); + + struct netbuf call_req; + memset(&call_req, 0, sizeof(call_req)); + call_req.len = remote_sap.get_size (); + call_req.buf = (char *)remote_sap.get_addr (); + + if (::t_addleaf(current_stream.get_handle(), + leaf_id, + &call_req) < 0) + { + // Check for asynchronous event + if (t_errno == TLOOK) + { + int const event = ACE_OS::t_look(current_stream.get_handle()); + if (event != TNODATA && event != T_DATA) + return -1; + else + // If this doesn't work for asynchronous calls we need to call + // the XTI/ATM t_rcvleafchange() function to check for t_addleaf + // completion. + return complete (current_stream, 0, timeout); + } + else + return -1; + } + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_XTI_ATM */ diff --git a/externals/ace/XTI_ATM_Mcast.h b/externals/ace/XTI_ATM_Mcast.h new file mode 100644 index 0000000..bfdfa92 --- /dev/null +++ b/externals/ace/XTI_ATM_Mcast.h @@ -0,0 +1,137 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file XTI_ATM_Mcast.h + * + * $Id: XTI_ATM_Mcast.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Joe Hoffert + */ +//============================================================================= + + +#ifndef ACE_XTI_ATM_MCAST_H +#define ACE_XTI_ATM_MCAST_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_XTI_ATM) + +#include "ace/TLI_Connector.h" +#include "ace/ATM_Addr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_XTI_ATM_Mcast + * + * @brief Defines an active connection factory for the ACE_TLI C++ + * wrappers to support XTI/ATM multicast. + */ +class ACE_Export ACE_XTI_ATM_Mcast : public ACE_TLI_Connector +{ +public: + // = Initialization methods. + /// Default constructor. + ACE_XTI_ATM_Mcast (void); + + /** + * Actively connect and produce a @a new_stream if things go well. + * The @a remote_sap is the address that we are trying to connect + * with. The @a timeout is the amount of time to wait to connect. + * If it's 0 then we block indefinitely. If *timeout == {0, 0} then + * the connection is done using non-blocking mode. In this case, if + * the connection can't be made immediately the value of -1 is + * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then + * this is the amount of time to wait before timing out. If the + * time expires before the connection is made @c errno == ETIME. The + * @a local_sap is the value of local address to bind to. If it's + * the default value of ACE_Addr::sap_any then the user is letting + * the OS do the binding. If @a reuse_addr == 1 then the + * is reused, even if it hasn't been cleanedup yet. + */ + ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream, + const ACE_Addr &remote_sap, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0, + const char device[] = ACE_XTI_ATM_DEVICE, + struct t_info *info = 0, + int rw_flag = 1, + struct netbuf *udata = 0, + struct netbuf *opt = 0); + + /** + * Actively connect and produce a @a new_stream if things go well. + * The @a remote_sap is the address that we are trying to connect + * with. The @a timeout is the amount of time to wait to connect. + * If it's 0 then we block indefinitely. If *timeout == {0, 0} then + * the connection is done using non-blocking mode. In this case, if + * the connection can't be made immediately the value of -1 is + * returned with @c errno == EWOULDBLOCK. If *timeout > {0, 0} then + * this is the amount of time to wait before timing out. If the + * time expires before the connection is made @c errno == ETIME. The + * @a local_sap is the value of local address to bind to. If it's + * the default value of ACE_Addr::sap_any then the user is letting + * the OS do the binding. If @a reuse_addr == 1 then the + * is reused, even if it hasn't been cleanedup yet. + */ + int connect (ACE_TLI_Stream &new_stream, + const ACE_Addr &remote_sap, + ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, + int reuse_addr = 0, + int flags = O_RDWR, + int perms = 0, + const char device[] = ACE_XTI_ATM_DEVICE, + struct t_info *info = 0, + int rw_flag = 1, + struct netbuf *udata = 0, + struct netbuf *opt = 0); + + /** + * Actively add a leaf to the currently connected stream (i.e., + * multicast). The @a remote_sap is the address of the leaf that we + * are trying to add. The @a timeout is the amount of time to wait to + * connect. If it's 0 then we block indefinitely. If *timeout == + * {0, 0} then the connection is done using non-blocking mode. In + * this case, if the connection can't be made immediately the value + * of -1 is returned with @c errno == EWOULDBLOCK. If *timeout > + * {0, 0} then this is the amount of time to wait before timing out. + * If the time expires before the connection is made @c errno == ETIME. + */ + int add_leaf (ACE_TLI_Stream ¤t_stream, + const ACE_Addr &remote_sap, + ACE_INT32 leaf_id, + ACE_Time_Value *timeout = 0); + + // = Meta-type info + typedef ACE_ATM_Addr PEER_ADDR; + typedef ACE_TLI_Stream PEER_STREAM; + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/XTI_ATM_Mcast.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_XTI_ATM */ + +#include /**/ "ace/post.h" + +#endif /* ACE_XTI_ATM_MCAST_H */ diff --git a/externals/ace/XTI_ATM_Mcast.inl b/externals/ace/XTI_ATM_Mcast.inl new file mode 100644 index 0000000..b182bb4 --- /dev/null +++ b/externals/ace/XTI_ATM_Mcast.inl @@ -0,0 +1,65 @@ +// -*- C++ -*- +// +// $Id: XTI_ATM_Mcast.inl 80826 2008-03-04 14:51:23Z wotte $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream, + const ACE_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms, + const char device[], + struct t_info *info, + int rw_flag, + struct netbuf *udata, + struct netbuf *opt) +{ + ACE_TRACE ("ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast"); + if (this->connect (new_stream, remote_sap, timeout, local_sap, reuse_addr, + flags, perms, device, + info, rw_flag, + udata, opt) == ACE_INVALID_HANDLE + && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_TLI_Stream::ACE_TLI_Stream"))); +} + +// Connect the to the , waiting up to +// amount of time if necessary. This is simple a pass- +// through function to ACE_TLI_Connector::connect(). It is over- +// ridden to change the default device from TCP to XTI/ATM. + +ACE_INLINE +int +ACE_XTI_ATM_Mcast::connect (ACE_TLI_Stream &new_stream, + const ACE_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms, + const char device[], + struct t_info *info, + int rw_flag, + struct netbuf *udata, + struct netbuf *opt) +{ + ACE_TRACE ("ACE_XTI_ATM_Mcast::connect"); + return ACE_TLI_Connector::connect(new_stream, + remote_sap, + timeout, + local_sap, + reuse_addr, + flags, + perms, + device, + info, + rw_flag, + udata, + opt); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ace.rc b/externals/ace/ace.rc new file mode 100644 index 0000000..5479249 --- /dev/null +++ b/externals/ace/ace.rc @@ -0,0 +1,38 @@ +#include "Version.h" + +1 VERSIONINFO + FILEVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION,0 + PRODUCTVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_BETA_VERSION,0 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "FileDescription", "ACE\0" + VALUE "FileVersion", ACE_VERSION "\0" + VALUE "InternalName", "ACEDLL\0" + VALUE "LegalCopyright", "\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "ACE.DLL\0" + VALUE "ProductName", "ACE\0" + VALUE "ProductVersion", ACE_VERSION "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +/* + * The following resource is used by the ACE logger to write messages + * to the NT event log. If you are statically linking to the ACE + * library, and you wish to use the NT event log, you should copy this + * message table to your application's resource script. + */ +1 MESSAGETABLE ace_message_table.bin diff --git a/externals/ace/ace_message_table.bin b/externals/ace/ace_message_table.bin new file mode 100644 index 0000000..b46b32a Binary files /dev/null and b/externals/ace/ace_message_table.bin differ diff --git a/externals/ace/ace_wchar.cpp b/externals/ace/ace_wchar.cpp new file mode 100644 index 0000000..bec8255 --- /dev/null +++ b/externals/ace/ace_wchar.cpp @@ -0,0 +1,17 @@ +// -*- C++ -*- +// +// $Id: ace_wchar.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/config-macros.h" +#include "ace/ace_wchar.h" + +ACE_RCSID(ace, ace_wchar, "$Id: ace_wchar.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined(ACE_HAS_ICONV) +iconv_t ACE_Wide_To_Ascii::ACE_Wide_To_Ascii_iconv_env = 0; +iconv_t ACE_Ascii_To_Wide::ACE_Ascii_To_Wide_iconv_env = 0; +#endif + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/externals/ace/ace_wchar.h b/externals/ace/ace_wchar.h new file mode 100644 index 0000000..f556e0f --- /dev/null +++ b/externals/ace/ace_wchar.h @@ -0,0 +1,385 @@ +//* -*- C++ -*- */ + +//============================================================================= +/** + * @file ace_wchar.h + * + * $Id: ace_wchar.h 82441 2008-07-28 13:04:13Z johnnyw $ + * + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_WCHAR_H +#define ACE_WCHAR_H + +#include "ace/config-macros.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// These macros have been deprecated and should be replaced by their +// ACE_TEXT_* equivalents. These macros are just hacks and may not +// completely provide the old functionality. +#if defined (ACE_LEGACY_MODE) +// Convert the old unicode indicators +# if defined (ACE_HAS_MOSTLY_UNICODE_APIS) +# define ACE_USES_WCHAR +# endif /* ACE_HAS_MOSTLY_UNICODE_APIS */ +# if defined (ACE_HAS_UNICODE) +# define ACE_HAS_WCHAR +# endif /* ACE_HAS_UNICODE */ + +// These are defined to get older stuff to compile +// FUZZ: disable check_for_tchar +# define ASYS_TCHAR ACE_TCHAR +# define ASYS_TEXT ACE_TEXT +# define ASYS_ONLY_MULTIBYTE_STRING ACE_TEXT_ALWAYS_CHAR +# define ASYS_MULTIBYTE_STRING ACE_TEXT_CHAR_TO_TCHAR +# define ASYS_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR +# define ACE_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR + +# if defined (ACE_USES_WCHAR) +# define ASYS_ONLY_WIDE_STRING(STRING) STRING +# else /* ACE_USES_WCHAR */ +# define ASYS_ONLY_WIDE_STRING(STRING) \ + ACE_Ascii_To_Wide (STRING).wchar_rep () +# endif /* ACE_USES_WCHAR */ + +# define ACE_TEXT_STRING ACE_TString + +#endif /* ACE_LEGACY_MODE */ + +#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) +# if !defined (ACE_HAS_WCHAR) +# define ACE_HAS_WCHAR +# endif +# include /**/ +#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ + +#if defined (ACE_HAS_WCHAR) +# if defined (ACE_VXWORKS) +# include /**/ /* For wchar_t */ +# include /**/ /* For mbstowcs, etc. */ +# include /**/ /* For strlen */ +# if !defined (__RTP__) +# define wint_t unsigned int /* VxWorks has wchar_t but not wint_t */ +# else +# include /**/ +# include /**/ +# endif +# elif defined (ACE_OPENVMS) +# include /**/ +# include /**/ +# elif defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ + (ACE_HAS_STANDARD_CPP_LIBRARY != 0) +# include /**/ +# include /**/ +# elif defined (ACE_HAS_WINCE) +# include /**/ +# else +# include /**/ +# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ +#endif /* ACE_HAS_WCHAR */ + +#if defined (ACE_HAS_ICONV) +# include /**/ +# if !defined (ACE_MAX_ICONV_BUFFER) +# define ACE_MAX_ICONV_BUFFER 16*1024 +# endif +#endif /* ACE_HAS_ICONV */ + +#if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ + (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) +using std::size_t; +#endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ + +// This makes the somewhat dubious assumption that if a platform lacks +// a native wchar_t type, then it will typedef it as unsigned short. +#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_NATIVE_WCHAR_T) +# if !defined (ACE_WSTRING_HAS_USHORT_SUPPORT) +# define ACE_WSTRING_HAS_USHORT_SUPPORT +# endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */ +#endif /* ACE_HAS_WCHAR && !ACE_LACKS_NATIVE_WCHAR_T */ + +// Set the default behaviour for ACE_TEXT_WIDE to use the L-prefix +#if !defined (ACE_USES_L_PREFIX) +# define ACE_USES_L_PREFIX 1 +#endif /* ACE_USES_L_PREFIX */ + +// Define the unicode/wchar related macros correctly + +# if !defined (ACE_TEXT_WIDE) +# if (ACE_USES_L_PREFIX == 1) +# define ACE_TEXT_WIDE_I(STRING) L##STRING +# else /* ACE_USES_L_PREFIX */ +# define ACE_TEXT_WIDE_I(STRING) STRING +# endif /* ACE_USES_L_PREFIX */ +# define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING) +# endif /* ACE_TEXT_WIDE */ + +#if defined (ACE_USES_WCHAR) +typedef wchar_t ACE_TCHAR; +typedef char ACE_ANTI_TCHAR; +# define ACE_TEXT(STRING) ACE_TEXT_WIDE (STRING) +# if !defined (ACE_LACKS_DEPRECATED_MACROS) +# define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE (STRING) +# endif +# define ACE_TEXT_ALWAYS_CHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () +# define ACE_TEXT_ALWAYS_WCHAR(STRING) STRING +# define ACE_TEXT_CHAR_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () +# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) STRING +# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () +#else /* ACE_USES_WCHAR */ +typedef char ACE_TCHAR; +typedef wchar_t ACE_ANTI_TCHAR; +# define ACE_TEXT(STRING) STRING +# if !defined (ACE_LACKS_DEPRECATED_MACROS) +# define ACE_LIB_TEXT(STRING) STRING +# endif +# define ACE_TEXT_ALWAYS_CHAR(STRING) STRING +# define ACE_TEXT_ALWAYS_WCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep () +# define ACE_TEXT_CHAR_TO_TCHAR(STRING) STRING +# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () +# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep () +#endif /* ACE_USES_WCHAR */ + +// The OS_String module defines some wide-char functions that are not +// universally available. In particular, they're not part of the +// XPG4 Worldwide Portability Interface wide-character string handling +// functions. So, if ACE_HAS_XPG4_MULTIBYTE_CHAR is defined, note that +// these functions are missing. +#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR) + +# if !defined (ACE_LACKS_ITOW) +# define ACE_LACKS_ITOW +# endif + +# if !defined (ACE_LACKS_WCSICMP) +# define ACE_LACKS_WCSICMP +# endif + +# if !defined (ACE_LACKS_WCSNICMP) +# define ACE_LACKS_WCSNICMP +# endif + +# if !defined (ACE_LACKS_WCSDUP) +# define ACE_LACKS_WCSDUP +# endif + +#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ + +#if defined ACE_HAS_WCHAR + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Wide_To_Ascii + * + * @brief A lightweight wchar* to char* string conversion class. + * + * The purpose of this class is to perform conversion from + * wchar* to char* strings. It is not intended for general + * purpose use. + */ +class ACE_Wide_To_Ascii +{ +public: + /// Ctor must take a wchar string. + ACE_Wide_To_Ascii (const wchar_t *s); + + /// Dtor will free up the memory. + ~ACE_Wide_To_Ascii (void); + + /// Return the internal char* representation. + char *char_rep (void); + + /// Converts an wchar_t string to ascii and returns a new string. + static char *convert (const wchar_t *wstr); + +private: + /// Internal pointer to the converted string. + char *s_; + +#if defined (ACE_HAS_ICONV) + static iconv_t ACE_Wide_To_Ascii_iconv_env; +#endif /* ACE_HAS_ICONV */ + + /// Disallow these operation. + ACE_Wide_To_Ascii (void); + ACE_Wide_To_Ascii (ACE_Wide_To_Ascii &); + ACE_Wide_To_Ascii& operator= (ACE_Wide_To_Ascii &); +}; + +/** + * @class ACE_Ascii_To_Wide + * + * @brief A lightweight char* to wchar* string conversion class. + * + * The purpose of this class is to perform conversion from + * char* to wchar* strings. It is not intended for general + * purpose use. + */ +class ACE_Ascii_To_Wide +{ +public: + /// Ctor must take a wchar string. + ACE_Ascii_To_Wide (const char *s); + + /// Dtor will free up the memory. + ~ACE_Ascii_To_Wide (void); + + /// Return the internal wchar* representation. + wchar_t *wchar_rep (void); + + /// Converts an char string to unicode/wide and returns a new string. + static wchar_t *convert (const char *str); + +private: + /// Internal pointer to the converted string. + wchar_t *s_; + +#if defined (ACE_HAS_ICONV) + static iconv_t ACE_Ascii_To_Wide_iconv_env; +#endif /* ACE_HAS_ICONV */ + + /// Disallow these operation. + ACE_Ascii_To_Wide (void); + ACE_Ascii_To_Wide (ACE_Ascii_To_Wide &); + ACE_Ascii_To_Wide operator= (ACE_Ascii_To_Wide &); +}; + +#if defined (ACE_LEGACY_MODE) +typedef ACE_Ascii_To_Wide ACE_OS_CString; +typedef ACE_Wide_To_Ascii ACE_OS_WString; +#endif /* ACE_LEGACY_MODE */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_WCHAR */ + +#if defined (ACE_WIN32) +#if defined (ACE_USES_WCHAR) +#define ACE_LPSTR LPWSTR +#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYW +#define ACE_TEXT_STARTUPINFO STARTUPINFOW +#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAW +#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOW +#define ACE_TEXT_EXPLICIT_ACCESS EXPLICIT_ACCESS_W + +#define ACE_TEXT_CreateEvent ::CreateEventW +#define ACE_TEXT_CreateFile ::CreateFileW +#define ACE_TEXT_CreateFileMapping ::CreateFileMappingW +#define ACE_TEXT_CreateMutex ::CreateMutexW +#define ACE_TEXT_CreateProcess ::CreateProcessW +#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreW +#define ACE_TEXT_CreateService ::CreateServiceW +#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsW +#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationW +#define ACE_TEXT_FindFirstFile ::FindFirstFileW +#define ACE_TEXT_FindNextFile ::FindNextFileW +#define ACE_TEXT_FormatMessage ::FormatMessageW +#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsW +#define ACE_TEXT_GetComputerName ::GetComputerNameW +#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsW +#define ACE_TEXT_GetFileAttributes ::GetFileAttributesW +#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameW +#define ACE_TEXT_GetTempPath ::GetTempPathW +#define ACE_TEXT_GetUserName ::GetUserNameW +#define ACE_TEXT_GetUserNameEx ::GetUserNameExW +#define ACE_TEXT_GetVersionEx ::GetVersionExW +#define ACE_TEXT_LoadLibrary ::LoadLibraryW +#define ACE_TEXT_MoveFileEx ::MoveFileExW +#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeW +#define ACE_TEXT_OpenFileMapping ::OpenFileMappingW +#define ACE_TEXT_OpenSCManager ::OpenSCManagerW +#define ACE_TEXT_OpenService ::OpenServiceW +#define ACE_TEXT_OutputDebugString ::OutputDebugStringW +#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceW +#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerW +#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryW +#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExW +#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyW +#define ACE_TEXT_RegDeleteValue ::RegDeleteValueW +#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExW +#define ACE_TEXT_RegEnumValue ::RegEnumValueW +#define ACE_TEXT_RegCreateKey ::RegCreateKeyW +#define ACE_TEXT_RegOpenKey ::RegOpenKeyW +#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExW +#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExW +#define ACE_TEXT_RegSetValueEx ::RegSetValueExW +#define ACE_TEXT_ReportEvent ::ReportEventW +#define ACE_TEXT_SearchPath ::SearchPathW +#define ACE_TEXT_StartService ::StartServiceW +#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherW +#define ACE_TEXT_SetFileSecurity ::SetFileSecurityW +#define ACE_TEXT_SetEntriesInAcl ::SetEntriesInAclW +#define ACE_TEXT_PdhExpandCounterPath ::PdhExpandCounterPathW +#define ACE_TEXT_PdhOpenQuery ::PdhOpenQueryW +#define ACE_TEXT_PdhAddCounter ::PdhAddCounterW + +#else /* ACE_USES_WCHAR */ +#define ACE_LPSTR LPSTR +#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYA +#define ACE_TEXT_STARTUPINFO STARTUPINFOA +#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAA +#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOA +#define ACE_TEXT_EXPLICIT_ACCESS EXPLICIT_ACCESS_A + +#define ACE_TEXT_CreateEvent ::CreateEventA +#define ACE_TEXT_CreateFile ::CreateFileA +#define ACE_TEXT_CreateFileMapping ::CreateFileMappingA +#define ACE_TEXT_CreateMutex ::CreateMutexA +#define ACE_TEXT_CreateProcess ::CreateProcessA +#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreA +#define ACE_TEXT_CreateService ::CreateServiceA +#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsA +#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationA +#define ACE_TEXT_FindFirstFile ::FindFirstFileA +#define ACE_TEXT_FindNextFile ::FindNextFileA +#define ACE_TEXT_FormatMessage ::FormatMessageA +#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsA +#define ACE_TEXT_GetComputerName ::GetComputerNameA +#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsA +#define ACE_TEXT_GetFileAttributes ::GetFileAttributesA +#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameA +#define ACE_TEXT_GetTempPath ::GetTempPathA +#define ACE_TEXT_GetUserName ::GetUserNameA +#define ACE_TEXT_GetUserNameEx ::GetUserNameExA +#define ACE_TEXT_GetVersionEx ::GetVersionExA +#define ACE_TEXT_LoadLibrary ::LoadLibraryA +#define ACE_TEXT_MoveFileEx ::MoveFileExA +#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeA +#define ACE_TEXT_OpenFileMapping ::OpenFileMappingA +#define ACE_TEXT_OpenSCManager ::OpenSCManagerA +#define ACE_TEXT_OpenService ::OpenServiceA +#define ACE_TEXT_OutputDebugString ::OutputDebugStringA +#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceA +#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerA +#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryA +#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExA +#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyA +#define ACE_TEXT_RegDeleteValue ::RegDeleteValueA +#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExA +#define ACE_TEXT_RegEnumValue ::RegEnumValueA +#define ACE_TEXT_RegCreateKey ::RegCreateKeyA +#define ACE_TEXT_RegOpenKey ::RegOpenKeyA +#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExA +#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExA +#define ACE_TEXT_RegSetValueEx ::RegSetValueExA +#define ACE_TEXT_ReportEvent ::ReportEventA +#define ACE_TEXT_SearchPath ::SearchPathA +#define ACE_TEXT_StartService ::StartServiceA +#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherA +#define ACE_TEXT_SetFileSecurity ::SetFileSecurityA +#define ACE_TEXT_SetEntriesInAcl ::SetEntriesInAclA +#define ACE_TEXT_PdhExpandCounterPath ::PdhExpandCounterPathA +#define ACE_TEXT_PdhOpenQuery ::PdhOpenQueryA +#define ACE_TEXT_PdhAddCounter ::PdhAddCounterA +#endif /* ACE_USES_WCHAR */ +#endif /* ACE_WIN32 */ + +#include "ace/ace_wchar.inl" + +#endif /* ACE_WCHAR_H */ diff --git a/externals/ace/ace_wchar.inl b/externals/ace/ace_wchar.inl new file mode 100644 index 0000000..744b44f --- /dev/null +++ b/externals/ace/ace_wchar.inl @@ -0,0 +1,183 @@ +// -*- C++ -*- +// +// $Id: ace_wchar.inl 80826 2008-03-04 14:51:23Z wotte $ + +// These are always inlined +// FUZZ: disable check_for_inline + +#if defined (ACE_HAS_WCHAR) + +#if !defined (ACE_WIN32) +# include /**/ // Need to see strlen() +#endif /* ACE_WIN32 */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +inline +ACE_Wide_To_Ascii::~ACE_Wide_To_Ascii (void) +{ + delete [] this->s_; +} + +inline char * +ACE_Wide_To_Ascii::char_rep (void) +{ + return this->s_; +} + +inline char * +ACE_Wide_To_Ascii::convert (const wchar_t *wstr) +{ + // Short circuit null pointer case + if (wstr == 0) + return 0; + +# if defined (ACE_WIN32) + UINT const cp = GetACP (); // Codepage + int const len = ::WideCharToMultiByte (cp, + 0, + wstr, + -1, + 0, + 0, + 0, + 0); +# elif defined (ACE_LACKS_WCSLEN) + const wchar_t * wtemp = wstr; + while ((*wtemp) != 0) // Hopefully the string is null terminated! + ++wtemp; + + int const len = wtemp - wstr + 1; +# else /* ACE_WIN32 */ + size_t const len = ::wcslen (wstr) + 1; +# endif /* ACE_WIN32 */ + +#if !defined (ACE_HAS_ICONV) + char *str = new char[len]; +#endif + +# if defined (ACE_WIN32) + ::WideCharToMultiByte (cp, 0, wstr, -1, str, len, 0, 0); +# elif defined (ACE_VXWORKS) + ::wcstombs (str, wstr, len); +# elif defined (ACE_HAS_ICONV) + wchar_t * wstri = const_cast (wstr); + size_t lensi = ACE_MAX_ICONV_BUFFER; + size_t lenwi = len * sizeof(wchar_t); + char buf[ACE_MAX_ICONV_BUFFER]; + char *stri = buf; + + size_t hr = iconv (ACE_Wide_To_Ascii_iconv_env, (char**)&wstri, &lenwi, &stri, &lensi); + if ((hr==size_t(-1))||(lensi==ACE_MAX_ICONV_BUFFER)) + { + char *str=new char[len]; + for (size_t i = 0; i < len; i++) + { + wchar_t *t = const_cast (wstr); + str[i] = static_cast (*(t + i)); + } + + return str; + } + char *str = new char[ACE_MAX_ICONV_BUFFER-lensi]; + ::memcpy(str, buf, ACE_MAX_ICONV_BUFFER-lensi); +# else /* ACE_HAS_ICONV */ + for (size_t i = 0; i < len; ++i) + { + wchar_t *t = const_cast (wstr); + str[i] = static_cast (*(t + i)); + } +# endif /* ACE_WIN32 */ + return str; +} + +inline +ACE_Wide_To_Ascii::ACE_Wide_To_Ascii (const wchar_t *s) +{ +#if defined(ACE_HAS_ICONV) + if (ACE_Wide_To_Ascii_iconv_env == 0) + { + ACE_Wide_To_Ascii_iconv_env = iconv_open("", "WCHAR_T"); + } +#endif + s_ = ACE_Wide_To_Ascii::convert (s); +} + +inline +ACE_Ascii_To_Wide::~ACE_Ascii_To_Wide (void) +{ + delete [] this->s_; +} + +inline wchar_t * +ACE_Ascii_To_Wide::wchar_rep (void) +{ + return this->s_; +} + +inline wchar_t * +ACE_Ascii_To_Wide::convert (const char *str) +{ + // Short circuit null pointer case + if (str == 0) + return 0; + +# if defined (ACE_WIN32) + UINT const cp = GetACP (); // Codepage + int const len = ::MultiByteToWideChar (cp, 0, str, -1, 0, 0); +# else /* ACE_WIN32 */ + size_t const len = strlen (str) + 1; +# endif /* ACE_WIN32 */ + +#if !defined (ACE_HAS_ICONV) + wchar_t *wstr = new wchar_t[len]; +#endif + +# if defined (ACE_WIN32) + ::MultiByteToWideChar (cp, 0, str, -1, wstr, len); +# elif defined (ACE_VXWORKS) + ::mbstowcs (wstr, str, len); +# elif defined (ACE_HAS_ICONV) /* ACE_VXWORKS */ + char *stri = const_cast(str); + size_t lensi = len; + size_t lenwi = ACE_MAX_ICONV_BUFFER; + wchar_t buf[ACE_MAX_ICONV_BUFFER/sizeof(wchar_t)]; + wchar_t *wstri=buf; + + size_t hr=iconv(ACE_Ascii_To_Wide_iconv_env, &stri, &lensi, (char**)&wstri, &lenwi); + if((hr==size_t(-1))||(lenwi==ACE_MAX_ICONV_BUFFER)){ + wchar_t *wstr=new wchar_t[len*sizeof(wchar_t)]; + for (size_t i = 0; i < len; i++){ + char *t = const_cast (str); + wstr[i] = static_cast (*((unsigned char*)t + i)); + } + + return wstr; + } + wchar_t *wstr=new wchar_t[(ACE_MAX_ICONV_BUFFER-lenwi)/sizeof(wchar_t)]; + ::memcpy(wstr,buf,ACE_MAX_ICONV_BUFFER-lenwi); +# else /* ACE_HAS_ICONV */ + for (size_t i = 0; i < len; ++i) + { + char *t = const_cast (str); + wstr[i] = static_cast (*((unsigned char*)(t + i))); + } +# endif /* ACE_WIN32 */ + return wstr; +} + +inline +ACE_Ascii_To_Wide::ACE_Ascii_To_Wide (const char *s) +{ +#if defined(ACE_HAS_ICONV) + if (ACE_Ascii_To_Wide_iconv_env == 0) + { + ACE_Ascii_To_Wide_iconv_env = iconv_open("WCHAR_T", ""); + } +#endif + s_ = ACE_Ascii_To_Wide::convert (s); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_WCHAR */ diff --git a/externals/ace/checked_iterator.h b/externals/ace/checked_iterator.h new file mode 100644 index 0000000..08940e6 --- /dev/null +++ b/externals/ace/checked_iterator.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +#ifndef ACE_CHECKED_ITERATOR_H +#define ACE_CHECKED_ITERATOR_H + +/** + * @file checked_iterator.h + * + * @brief Checked iterator factory function. + * + * Some compilers (e.g. MSVC++ >= 8) issue security related + * diagnostics if algorithms such as std::copy() are used in an unsafe + * way. Normally this isn't an issue if STL container iterators are + * used in conjuction with the standard algorithms. However, in cases + * where application-specific iterators are use with standard + * algorithms that could potentially overrun a buffer, extra care must + * be taken to prevent such an overrun. If supported, checked + * iterators can be used to address the potential destination buffer + * overrun. + * + * This header provides function templates that generate the + * appropriate checked iterator. In cases where checked iterators are + * not supported, the pointer passed to the function is returned + * instead. + * + * $Id: checked_iterator.h 88263 2009-12-20 07:58:09Z johnnyw $ + * + * @internal The functions and types in this header are meant for + * internal use. They may change at any point between + * releases. + * + * @author Ossama Othman + */ + +# if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000) && (!defined (_STLPORT_VERSION)) +// Checked iterators are currently only supported in MSVC++ 8 or better. +# include +# endif /* _MSC_VER >= 1400 && !_STLPORT_VERSION */ + +# if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000) && (!defined (_STLPORT_VERSION)) +template +stdext::checked_array_iterator +ACE_make_checked_array_iterator (PTR buf, size_t len) +{ + return stdext::checked_array_iterator (buf, len); +} +# else +template +PTR +ACE_make_checked_array_iterator (PTR buf, size_t /* len */) +{ + // Checked iterators are unsupported. Just return the pointer to + // the buffer itself. + return buf; +} +# endif /* _MSC_VER >= 1400 && !_STLPORT_VERSION */ + +#endif /* ACE_CHECKED_ITERATOR_H */ diff --git a/externals/ace/config-WinCE.h b/externals/ace/config-WinCE.h new file mode 100644 index 0000000..9304058 --- /dev/null +++ b/externals/ace/config-WinCE.h @@ -0,0 +1,229 @@ +// $Id: config-WinCE.h 89494 2010-03-15 20:11:18Z olli $ + +// Note: For WinCE build, simply use: #include "ace/config-win32.h" +// It is same as config.h for Windows NT/2k so that you can +// share same files and directories for both WinCE and NT/2k +// builds, unless you add additional definition(s) for each +// specific build or change the output directory. + +#ifndef ACE_CONFIG_WINCE_H +#define ACE_CONFIG_WINCE_H + +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +# error Use config-win32.h in config.h instead of this header +#endif // ACE_CONFIG_WIN32_H + +#if !defined (_WIN32_WCE) +# error Define _WIN32_WCE to version (i.e. 500 = 5.0) +#endif // _WIN32_WCE + +#if (_WIN32_WCE < 500) +# error ACE requires Windows CE 5.0 and later. +#endif // _WIN32_WCE + +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_WINCE 1 +#endif + +#if defined (_MSC_VER) && (_MSC_VER < 1400) +// WinCE prior to Visual Studio 2005 integration doesn't have most of +// the standard C library time functions. It also doesn't define struct tm. +// SYSTEMTIME has pretty much the same info though, so we can map it when +// needed. Define struct tm here and use it when needed. This is taken +// from the standard C library. +# define ACE_LACKS_STRUCT_TM +#endif + +// We need these libraries to build: +#if defined (_MSC_VER) +# pragma comment(lib,"corelibc.lib") +# pragma comment(linker, "/nodefaultlib:oldnames.lib") +#endif + +// Only DLL version is supported on CE. +//#if defined (ACE_HAS_DLL) +//# undef ACE_HAS_DLL +//#endif // ACE_HAS_DLL +//#define ACE_HAS_DLL 1 + +// Need to define LD search path explicitly on CE because +// CE doesn't have environment variables and we can't get +// the information using getenv. +#define ACE_DEFAULT_LD_SEARCH_PATH ACE_TEXT (".\\;\\windows") + +#define ACE_LACKS_FCNTL_H +#define ACE_LACKS_SYS_TYPES_H +#define ACE_LACKS_GETCWD +#define ACE_LACKS_ASCTIME +#define ACE_LACKS_ASCTIME_R +#define ACE_LACKS_GMTIME +#define ACE_LACKS_GMTIME_R +#define ACE_LACKS_LOCALTIME +#define ACE_LACKS_PERROR +#define ACE_LACKS_STRFTIME +#define ACE_LACKS_WIN32_SETFILEPOINTEREX +#define ACE_LACKS_WIN32_SERVICES +#define ACE_LACKS_WIN32_SECURITY_DESCRIPTORS +#define ACE_LACKS_GETPROCESSTIMES +#define ACE_LACKS_PDH_H +#define ACE_LACKS_PDHMSG_H +#define ACE_LACKS_TIME +#define ACE_LACKS_TZSET +#define ACE_LACKS_RAISE +#define ACE_LACKS_BSEARCH + +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 + +#define ACE_LACKS_MSG_WFMO +#define ACE_LACKS_UMASK +#define ACE_HAS_TYPES_H +#define ACE_LACKS_DEV_T + +#define ACE_ISCTYPE_EQUIVALENT ::_isctype + +// WinCE only supports the UNICODE API +#if !defined (ACE_USES_WCHAR) +# define ACE_USES_WCHAR +#endif /* ACE_USES_WCHAR */ + +#if (_WIN32_WCE < 0x600) +# define ACE_USES_WINCE_SEMA_SIMULATION +# define ACE_LACKS_ERRNO_H +# define ACE_LACKS_DUP +# define ACE_LACKS_GETSYSTEMTIMEASFILETIME +#endif /* (_WIN32_WCE < 0x600) */ + +#define ACE_LACKS_REGNOTIFYCHANGEKEYVALUE + +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER 1 + +#if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS TLS_MINIMUM_AVAILABLE +#endif // ! defined(ACE_DEFAULT_THREAD_KEYS) + +// FILE stuff isn't always defined in CE +#if (_MSC_VER < 1400) && !defined (_FILE_DEFINED) + typedef void FILE; +# define _FILE_DEFINED +#endif /* _MSC_VER < 1400 && !_FILE_DEFINED */ + +// This was defined in previous versions of CE, but not 2.11 +#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION + +#define ACE_MAIN WINAPI WinMain + +// SH3 cross-compiler can't handle inline functions correctly +// (along with other bugs.) +#if defined (SH3) +# define ACE_LACKS_INLINE_FUNCTIONS +#endif // SH3 && _DEBUG + +#ifndef ACE_DEFAULT_SERVER_HOST +# define ACE_DEFAULT_SERVER_HOST ACE_TEXT("localhost") +#endif // ACE_DEFAULT_SERVER_HOST + +// @@ Need to remap every function that uses any of these flags to +// Win32 API. These are for ANSI styled function and are not +// available on WinCE. + +#define _O_RDONLY 0x0000 // open for reading only +#define _O_WRONLY 0x0001 // open for writing only +#define _O_RDWR 0x0002 // open for reading and writing +#define _O_APPEND 0x0008 // writes done at eof + +#define _O_CREAT 0x0100 // create and open file +#define _O_TRUNC 0x0200 // open and truncate +#define _O_EXCL 0x0400 // open only if file doesn't already exist + +// O_TEXT files have sequences translated to on read()'s, +// and sequences translated to on write()'s +#define _O_TEXT 0x4000 // file mode is text (translated) +#define _O_BINARY 0x8000 // file mode is binary (untranslated) + +// Temporary file bit - file is deleted when last handle is closed +#define _O_TEMPORARY 0x0040 // temporary file bit + +// Non-ANSI names +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_TEMPORARY _O_TEMPORARY + +// @@ NSIG value. This is definitely not correct. +#define NSIG 23 + +#if !defined (FILE_MAP_COPY) +#define FILE_MAP_COPY 0 +#endif + +#define ACE_HAS_INTERLOCKED_EXCHANGEADD +#define ACE_LACKS_ACCESS +#define ACE_LACKS__WACCESS +#define ACE_HAS_ACCESS_EMULATION +#define ACE_LACKS_EXEC +#define ACE_LACKS_MKTEMP +#define ACE_LACKS_ISATTY +#define ACE_LACKS_STRERROR +#define ACE_LACKS_SYSTEM +#define ACE_LACKS_PIPE + +#define ACE_LACKS_CHDIR +#define ACE_LACKS_GETENV +#define ACE_LACKS_SETENV +#define ACE_LACKS_UNSETENV +#define ACE_LACKS_PUTENV +#define ACE_LACKS_GETENVSTRINGS +#define ACE_LACKS_STRENVDUP +#define ACE_LACKS_REALPATH +#define ACE_LACKS_SWAB +#define ACE_LACKS_TEMPNAM + +#if defined (_WIN32_WCE_EMULATION) +// @@ For some reason, qsort isn't defined correctly (_stdcall vs _cdecl) +// under emulation. So for right now, exclude it. +# define ACE_LACKS_QSORT +#endif // _WIN32_WCE_EMULATION + +#if !defined (BUFSIZ) +# define BUFSIZ 1024 +#endif + +#define ACE_LACKS_MALLOC_H // We do have malloc.h, but don't use it. + +#define ACE_HAS_WINCE_BROKEN_ERRNO + +#define ACE_HAS_STRDUP_EMULATION + +#if !defined (MAXSYMLINKS) +# define MAXSYMLINKS 0 +#endif + +// WinCE can't do fixed addresses for memory-mapped files. +#if defined (ACE_DEFAULT_BASE_ADDR) +# undef ACE_DEFAULT_BASE_ADDR +#endif +#define ACE_DEFAULT_BASE_ADDR 0 + +#if (_WIN32_WCE < 0x600) +# define ACE_HAS_TSS_EMULATION +#endif // WinCE version < 6.0 + +// CE doesn't support FILE_SHARE_DELETE like regular windows +#if !defined (ACE_DEFAULT_FILE_PERMS) +# define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE) +#endif + +#define ACE_LACKS_SIGNAL_H +#define ACE_LACKS_SYS_STAT_H + +#include /**/ "ace/post.h" + +#endif // ACE_CONFIG_WINCE_H diff --git a/externals/ace/config-aix-5.x.h b/externals/ace/config-aix-5.x.h new file mode 100644 index 0000000..d524e95 --- /dev/null +++ b/externals/ace/config-aix-5.x.h @@ -0,0 +1,326 @@ +// $Id: config-aix-5.x.h 87268 2009-10-29 21:06:06Z olli $ +// +// Config file for AIX 5.1 and higher. + +#ifndef ACE_CONFIG_AIX_5_X_H +#define ACE_CONFIG_AIX_5_X_H + +// This define is needed for building with Visual Age C++ 5 in incremental +// mode. In the batch mode build, platform_aix_ibm.GNU sets it. The incremental +// mode compiler won't be supported after ACE 5.3, so this will also go away +// in that timeframe, so don't worry about future AIX versions. +#if !defined (ACE_AIX_VERS) +# define ACE_AIX_VERS 501 +#endif + +// AIX 5.1 has AIO, but it doesn't have the same API as other POSIX +// systems, and the semantics of operations are a bit different. Will take +// some real work to get this going. +// AIX 5.2, however, has the POSIX API implemented. However, the libc functions +// to implement it aren't exported by default. You need to use smit to enable +// them. So, leave AIO disabled unless the user explicitly enables it. +// config-aix-4.x.h will set ACE_HAS_AIO_CALLS if config-posix.h senses the +// feature-test macros, so set up _ACE_DISABLE_AIO_CALLS_ if the user didn't +// set it. Then check for it after including config-aix-4.x.h and remove +// ACE_HAS_AIO_CALLS if so. +#if !defined (ACE_HAS_AIO_CALLS) +# define _ACE_DISABLE_AIO_CALLS_ +#endif + +// Both IBM and g++ compilers set _THREAD_SAFE if compiler is asked to compile +// threaded code (xlC_r, as opposed to xlC; and g++ -pthread) +#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0) +# if defined (ACE_HAS_THREADS) +# undef ACE_HAS_THREADS +# endif +# if defined (_THREAD_SAFE) +# define ACE_HAS_THREADS 1 +// # else +// # define ACE_HAS_THREADS 0 +# endif /* _THREAD_SAFE */ +#endif /* !ACE_MT_SAFE || (ACE_MT_SAFE != 0) */ + +#if defined (__IBMCPP__) + // AIX xlC, IBM C/C++ compiler + //******************************************************************** + // + + // Compiler does this with a builtin - it's not in libc. + // Although ACE does have alloca() on this compiler/platform combination, + // it is disabled by default since it can be dangerous. Uncomment the + // following line if you ACE to use it. + //# define ACE_HAS_ALLOCA + + // Compiler supports the ssize_t typedef. +# define ACE_HAS_SSIZE_T + + // Keep an eye on this as the compiler and standards converge... +# define ACE_LACKS_LINEBUFFERED_STREAMBUF +# define ACE_LACKS_PRAGMA_ONCE + +# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS + // When using -qtempinc, we don't need to see template implementation + // source (though we do need a pragma to find the correct source file). + // However, without -qtempinc (either -qnotempinc or -qtemplateregistry) + // we do need to see the source. +# if defined (__TEMPINC__) +# if !defined ACE_TEMPLATES_REQUIRE_PRAGMA +# define ACE_TEMPLATES_REQUIRE_PRAGMA +# endif +# else +# if !defined (ACE_TEMPLATES_REQUIRE_SOURCE) +# define ACE_TEMPLATES_REQUIRE_SOURCE +# endif +# endif /* __TEMPINC__ */ + +# undef WIFEXITED +# undef WEXITSTATUS +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 + +# define ACE_HAS_TEMPLATE_TYPEDEFS +# define ACE_HAS_CUSTOM_EXPORT_MACROS +# define ACE_Proper_Export_Flag +# define ACE_Proper_Import_Flag + // There's no explicit import/export per-se, but to be sure that declared + // template code is exported, explicitly instantiate the class. +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class SINGLETON_TYPE < CLASS, LOCK >; +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE < CLASS, LOCK >; + +#elif defined (__GNUG__) + // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so + // this must appear before its #include. +# define ACE_HAS_STRING_CLASS + +# include "ace/config-g++-common.h" + +# define ACE_HAS_SSIZE_T + +# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0)) +// We have to explicitly instantiate static template members prior to g++ 4.1 +# define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION +#endif /* g++ prior to 4.1 */ + +# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0 + // ACE_MT_SAFE is #defined below, for all compilers. +# if !defined (_REENTRANT) +# define _REENTRANT +# endif /* _REENTRANT */ +# endif /* !ACE_MT_SAFE */ + +#else /* ! __IBMCPP__ && ! __GNUG__ */ +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-aix-5.x.h +# endif /* __cplusplus */ +#endif /* ! __xlC__ && ! __GNUG__ */ + +// Compiling for AIX. +#ifndef AIX +# define AIX +#endif /* AIX */ + +// Pick up all the detectable settings. +#include "ace/config-posix.h" + +// Regardless of what config-posix.h may indicate, AIX 5.3 is the first +// to support sem_timedwait(). Prior to that, use the emulation. +#if defined (ACE_HAS_POSIX_SEM_TIMEOUT) && \ + (defined (ACE_AIX_VERS) && (ACE_AIX_VERS < 503)) +# undef ACE_HAS_POSIX_SEM_TIMEOUT +#endif /* ACE_HAS_POSIX_SEM_TIMEOUT && ACE_AIX_VERS < 503 */ + +#if defined (ACE_DLL_SUFFIX) +# undef ACE_DLL_SUFFIX +#endif +#define ACE_DLL_SUFFIX ACE_TEXT (".so") + +#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + +#define ACE_HAS_SOCKLEN_T +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG + +// AIX has AIO, but the functions don't match those of other AIO-enabled +// platforms. If this is to work, it'll require some significant work, +// maybe moving the OS-abstraction stuff to an OS_AIO or some such thing. +//# define ACE_HAS_AIO_CALLS + +#define ACE_HAS_AIX_HI_RES_TIMER + +// Compiler/platform has correctly prototyped header files. +#define ACE_HAS_CPLUSPLUS_HEADERS + +// Prototypes for both signal() and struct sigaction are consistent. +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// OS has readdir and friends. +#define ACE_HAS_DIRENT + +// OS supports the getrusage() system call +#define ACE_HAS_GETRUSAGE + +#define ACE_HAS_GPERF + +#define ACE_HAS_H_ERRNO + +#define ACE_LACKS_STDINT_H +#define ACE_LACKS_SYS_SYSCTL_H + +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_ICMP_SUPPORT 1 +#define ACE_HAS_IP_MULTICAST + +// Lacks perfect filtering, must bind group address. +#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ + +#define ACE_HAS_MSG + +// Compiler/platform supports poll(). +#define ACE_HAS_POLL + +// Platform supports POSIX O_NONBLOCK semantics. +#define ACE_HAS_POSIX_NONBLOCK + +#define ACE_HAS_POSIX_TIME +// ... but needs to include another header for it on 4.2+ +# define ACE_HAS_BROKEN_POSIX_TIME +// ... and needs another typedef +#define ACE_LACKS_TIMESPEC_T +#define ACE_HAS_SELECT_H + +#define ACE_HAS_REENTRANT_FUNCTIONS + +// Compiler/platform defines the sig_atomic_t typedef +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_HAS_P_READ_WRITE + +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_STRBUF_T + +// Compiler supports stropts.h +#define ACE_HAS_STREAMS +// #define ACE_HAS_STREAM_PIPES + +// AIX bzero() +#define ACE_HAS_STRINGS + +#define ACE_HAS_STRUCT_NETDB_DATA + +// Dynamic linking is in good shape on newer OS/patch levels. If you have +// trouble with the dynamic linking parts of ACE, and can't patch your OS +// up to latest levels, comment this out. +#define ACE_HAS_SVR4_DYNAMIC_LINKING +// This is tightly related to dynamic linking... +#define ACE_HAS_AUTOMATIC_INIT_FINI + +#define ACE_HAS_SVR4_GETTIMEOFDAY + +#define ACE_HAS_SYSV_IPC +#define ACE_HAS_TIMOD_H +#define ACE_HAS_XTI +#define ACE_HAS_BROKEN_T_ERROR +#define ACE_TLI_TCP_DEVICE "/dev/xti/tcp" + +#define ACE_HAS_UALARM + +#define ACE_HAS_UCONTEXT_T + +#define ACE_HAS_UTIME + +#define ACE_HAS_CTYPE_T + +// Platform has XPG4 wide character type and functions. However, the size +// of wchar_t changes for 32- vs. 64-bit builds (unsigned short vs. unsigned +// int, respectively). +#define ACE_HAS_XPG4_MULTIBYTE_CHAR +#ifdef __64BIT__ +# define ACE_SIZEOF_WCHAR 4 +#else +# define ACE_SIZEOF_WCHAR 2 +#endif /* __64BIT__ */ + +#define ACE_LACKS_NETINET_TCP_H + +// AIX uses LIBPATH to search for libraries +#define ACE_LD_SEARCH_PATH ACE_TEXT ("LIBPATH") + +// Defines the page size of the system. +#define ACE_PAGE_SIZE 4096 + +//************************************************************** +// +// Threads related definitions. +// +// The threads on AIX are generally POSIX P1003.1c (ACE_HAS_PTHREADS). +// However, there is also a kernel thread ID (tid_t) that is used in +// ACE_Log_Msg (printing the thread ID). The tid_t is not the same as +// pthread_t, and can't derive one from the other - thread_self() gets +// the tid_t (kernel thread ID) if called from a thread. +// Thanks very much to Chris Lahey for straightening this out. + +#if defined (ACE_HAS_THREADS) +# if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +# endif + +# define ACE_HAS_PTHREADS +# define ACE_HAS_PTHREADS_UNIX98_EXT +# define ACE_HAS_PTHREAD_CONTINUE_NP +# define ACE_HAS_PTHREAD_SUSPEND_NP +# define ACE_HAS_RECURSIVE_MUTEXES +# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +# define ACE_HAS_SIGTHREADMASK +# define ACE_HAS_THREAD_SPECIFIC_STORAGE + +# define ACE_LACKS_THREAD_PROCESS_SCOPING +#else +# undef ACE_HAS_THREADS +#endif /* ACE_HAS_THREADS != 0 */ + +#define ACE_MALLOC_ALIGN 8 + +#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) && !defined(_UNIX95) +# define ACE_HAS_3_PARAM_WCSTOK +#endif /* (_XOPEN_SOURCE -0) >= 500 && !_UNIX95 */ + +#if defined (_ACE_DISABLE_AIO_CALLS_) +# if defined (ACE_HAS_AIO_CALLS) +# undef ACE_HAS_AIO_CALLS +# endif +# undef _ACE_DISABLE_AIO_CALLS_ +#endif + +// AIX's /usr/include/unistd.h sets _POSIX_SEMAPHORE to indicate the system +// supplies such a facility, but the headers don't enable it unless +// _XOPEN_SOURCE >= 500. So disable semaphores here if _XOPEN_SOURCE isn't +// up to snuff. +#if defined (ACE_HAS_POSIX_SEM) && \ + (!defined (_XOPEN_SOURCE) || (_XOPEN_SOURCE-0 < 500)) +# undef ACE_HAS_POSIX_SEM +#endif + +// I think this is correct, but needs to be verified... -Steve Huston +#define ACE_HAS_SIGTIMEDWAIT + +// AIX 5.1 has netinet/tcp.h +#undef ACE_LACKS_NETINET_TCP_H + +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_POSIX_GETPWNAM_R +#define ACE_HAS_SCANDIR +#define ACE_SCANDIR_CMP_USES_VOIDPTR +#define ACE_SCANDIR_SEL_LACKS_CONST +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_TIMEZONE /* Call tzset() to set timezone */ +#define ACE_LACKS_ISCTYPE +#define ACE_HAS_STRSIGNAL +#define ACE_NEEDS_STRSIGNAL_RANGE_CHECK + +#endif /* ACE_CONFIG_AIX_5_X_H */ diff --git a/externals/ace/config-all.h b/externals/ace/config-all.h new file mode 100644 index 0000000..e19caec --- /dev/null +++ b/externals/ace/config-all.h @@ -0,0 +1,93 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file config-all.h + * + * $Id: config-all.h 84216 2009-01-22 18:34:40Z johnnyw $ + * + * @author (Originally in OS.h)Doug Schmidt + * @author Jesper S. M|ller + * @author and a cast of thousands... + */ +//========================================================================== + +#ifndef ACE_CONFIG_ALL_H +#define ACE_CONFIG_ALL_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// This is used to indicate that a platform doesn't support a +// particular feature. +#if defined ACE_HAS_VERBOSE_NOTSUP + // Print a console message with the file and line number of the + // unsupported function. +# include "ace/OS_NS_stdio.h" +# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP; ACE_OS::fprintf (stderr, ACE_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return FAILVALUE; } while (0) +# define ACE_NOTSUP do { errno = ENOTSUP; ACE_OS::fprintf (stderr, ACE_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return; } while (0) +#else /* ! ACE_HAS_VERBOSE_NOTSUP */ +# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP ; return FAILVALUE; } while (0) +# define ACE_NOTSUP do { errno = ENOTSUP; return; } while (0) +#endif /* ! ACE_HAS_VERBOSE_NOTSUP */ + +// ---------------------------------------------------------------- + +# define ACE_TRACE_IMPL(X) ACE_Trace ____ (ACE_TEXT (X), __LINE__, ACE_TEXT (__FILE__)) + +// By default tracing is turned off. +#if !defined (ACE_NTRACE) +# define ACE_NTRACE 1 +#endif /* ACE_NTRACE */ + +#if (ACE_NTRACE == 1) +# define ACE_TRACE(X) +#else +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* ACE_NTRACE */ + +// By default we perform no tracing on the OS layer, otherwise the +// coupling between the OS layer and Log_Msg is too tight. But the +// application can override the default if they wish to. +#if !defined (ACE_OS_NTRACE) +# define ACE_OS_NTRACE 1 +#endif /* ACE_OS_NTRACE */ + +#if (ACE_OS_NTRACE == 1) +# define ACE_OS_TRACE(X) +#else +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_OS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* ACE_OS_NTRACE */ + +#if !defined (ACE_HAS_MONITOR_FRAMEWORK) +# define ACE_HAS_MONITOR_FRAMEWORK 1 +#endif + +#if !defined (ACE_HAS_SENDFILE) +# define ACE_HAS_SENDFILE 0 +#endif + +#if !defined (ACE_HAS_MONITOR_POINTS) +# define ACE_HAS_MONITOR_POINTS 0 +#endif + +// These includes are here to avoid circular dependencies. +// Keep this at the bottom of the file. It contains the main macros. +#include "ace/OS_main.h" + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_ALL_H */ diff --git a/externals/ace/config-cray.h b/externals/ace/config-cray.h new file mode 100644 index 0000000..1b94487 --- /dev/null +++ b/externals/ace/config-cray.h @@ -0,0 +1,205 @@ +/* -*- C++ -*- */ +// $Id: config-cray.h 87169 2009-10-19 20:26:55Z olli $ + +#ifndef ACE_CONFIG_CRAY_H +#define ACE_CONFIG_CRAY_H +#include /**/ "ace/pre.h" + +/* + The following predefined macros are used within ACE ifdefs. + These are defined when using the Cray compilers. _CRAYMPP + is defined, for example, if you are running on a Cray T3E + massively parallel machine. Moreover, in the case of the T3E, + _CRAYT3E will be defined. This is used to determine the + ACE_SIZEOF defines for primitive types. + + _UNICOS is defined as either the major version of UNICOS being run, + e.g. 9 or 10 on the vector machines (e.g. C90, T90, J90, YMP, ...) + or the major+minor+level UNICOS/mk version, e.g. 2.0.3 => 203, + being run on an MPP machine. + + Summary: + + _CRAYMPP (defined only if running on MPP machine, e.g. T3E, UNICOS/mk) + _CRAYT3E (defined specifically if compiling on a Cray T3E) + _UNICOS (defined if running UNICOS or UNICOS/mk) + + Tested on UNICOS 10.0.0.5, UNICOS/mk 2.0.4.57 + Compiles on UNICOS 9.0.2.8, but some tests deadlock + + Contributed by Doug Anderson +*/ + +#if defined (_UNICOS) && !defined (MAXPATHLEN) +#define MAXPATHLEN 1023 +#endif /* _UNICOS */ + +#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 + +// Defines the page size of the system. +#define ACE_PAGE_SIZE 4096 + +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_SSIZE_T + +#define ACE_HAS_SYSV_IPC + +#define ACE_MT_SAFE 1 + +#define ACE_HAS_THREADS + +#define ACE_HAS_PTHREADS + +#define ACE_HAS_THREAD_SPECIFIC_STORAGE + +#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + +#define ACE_HAS_POSIX_TIME + +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +#define ACE_HAS_POSIX_NONBLOCK + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +#define ACE_HAS_DIRENT + +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_IP_MULTICAST + +#define ACE_HAS_SOCKADDR_IN_SIN_LEN + +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_HAS_NONCONST_READLINK + +#define ACE_HAS_CHARPTR_SOCKOPT + +#define ACE_HAS_NONCONST_GETBY +#define ACE_HAS_NONCONST_INET_ADDR + +// has man pages, but links with missing symbols and I can't find lib yet +/* #define ACE_HAS_REGEX */ + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +#if _UNICOS > 9 +# define ACE_HAS_SIGWAIT +#endif + +#define ACE_HAS_SIG_ATOMIC_T + +#define ACE_HAS_SIGISMEMBER_BUG + +#define ACE_HAS_MSG + +#define ACE_HAS_GPERF + +// Special modifications that apply to UNICOS/mk +#if defined(_CRAYMPP) + +# define ACE_HAS_SIGINFO_T +# define ACE_HAS_UCONTEXT_T + +#endif + +// The Cray T90 supposedly supports SYSV SHMEM, but I was unable to get it +// working. Of course, all other Cray PVP and MPP systems do NOT support it, +// so it's probably good to just define like this for consistency +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_MMAP +#define ACE_LACKS_CONST_TIMESPEC_PTR +#define ACE_LACKS_SYSCALL +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_MADVISE +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_PTHREAD_CLEANUP +#define ACE_LACKS_CONDATTR_PSHARED +#define ACE_LACKS_THREAD_PROCESS_SCOPING + +#if !defined(_CRAYMPP) + +#define ACE_LACKS_PTHREAD_CANCEL +#define ACE_LACKS_PTHREAD_KILL + +#endif + +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_PRI_T +#define ACE_LACKS_GETPGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_MPROTECT +#define ACE_LACKS_MSYNC +#define ACE_LACKS_READV +#define ACE_LACKS_RLIMIT + +// we probably want to fake not having this, since Cray memory mgmt is different +#define ACE_LACKS_SBRK + +#define ACE_LACKS_SETSCHED + +#define ACE_LACKS_SIGINFO_H + +#define ACE_LACKS_TIMESPEC_T + +#define ACE_LACKS_WRITEV + +// Cray vector machines are "word" oriented, and modern ones are hard 64-bit. +// "char" is somewhat of a special case. Most problems arise when code thinks +// it can address 32-bit quantities and the like. MPP crays are typically +// byte oriented, e.g. T3E uses Alpha processors, so we don't need as much +// special treatment. + +#ifndef _CRAYMPP + +# define ACE_SIZEOF_CHAR 1 +# define ACE_SIZEOF_SHORT 8 +# define ACE_SIZEOF_INT 8 +# define ACE_SIZEOF_LONG 8 +# define ACE_SIZEOF_LONG_LONG 8 +# define ACE_SIZEOF_FLOAT 8 +# define ACE_SIZEOF_DOUBLE 8 +# define ACE_SIZEOF_LONG_DOUBLE 16 +# define ACE_SIZEOF_VOID_P 8 + +#elif defined(_CRAYT3E) + +# define ACE_SIZEOF_CHAR 1 +# define ACE_SIZEOF_SHORT 4 +# define ACE_SIZEOF_INT 8 +# define ACE_SIZEOF_LONG 8 +# define ACE_SIZEOF_LONG_LONG 8 +# define ACE_SIZEOF_FLOAT 4 +# define ACE_SIZEOF_DOUBLE 8 +# define ACE_SIZEOF_LONG_DOUBLE 8 +# define ACE_SIZEOF_VOID_P 8 + +#endif + +// Ones to check out at some point + +// C++ Compiler stuff to verify +/* #define ACE_NEW_THROWS_EXCEPTIONS */ +/* #define ACE_HAS_TEMPLATE_TYPEDEFS */ + +// thread issues to check out +/* #define ACE_LACKS_TIMEDWAIT_PROTOTYPES */ + +// Cray does seem to support it, in -lnsl and has tiuser.h header +/* #define ACE_HAS_TLI */ +/* #define ACE_HAS_TIUSER_H */ +/* #define ACE_HAS_TLI_PROTOTYPES */ + +/* #define ACE_LACKS_NAMED_POSIX_SEM */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_CRAY_H */ diff --git a/externals/ace/config-cxx-common.h b/externals/ace/config-cxx-common.h new file mode 100644 index 0000000..024c25f --- /dev/null +++ b/externals/ace/config-cxx-common.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +// +// $Id: config-cxx-common.h 81935 2008-06-12 22:01:53Z jtc $ + +#ifndef ACE_CXX_COMMON_H +#define ACE_CXX_COMMON_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_CONFIG_INCLUDE_CXX_COMMON) +# error ace/config-cxx-common.h: ACE configuration error! Do not #include this file directly! +#endif + +#if defined (__DECCXX) +# if !defined (linux) +# define ACE_HAS_STRING_CLASS +# if (__DECCXX_VER >= 60090010) +# define ACE_HAS_STDCPP_STL_INCLUDES +# endif /* __DECCXX_VER < 60090010 */ +# endif /* ! linux */ + +# define DEC_CXX +# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR +# define ACE_LACKS_LINEBUFFERED_STREAMBUF +# define ACE_LACKS_SIGNED_CHAR +# define ACE_HAS_CPLUSPLUS_HEADERS +# define ACE_TEMPLATES_REQUIRE_SOURCE +# if (__DECCXX_VER >= 60090010) + // DEC CXX 6.0 supports exceptions, etc., by default. Exceptions + // are enabled by platform_osf1_4.x.GNU/wrapper_macros.GNU. +# if defined (ACE_HAS_EXCEPTIONS) +# define ACE_NEW_THROWS_EXCEPTIONS +# endif /* ACE_HAS_EXCEPTIONS */ +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_HAS_TEMPLATE_TYPEDEFS + +# define ACE_ENDLESS_LOOP \ + unsigned int ace_endless_loop____ = 0; if (ace_endless_loop____) break; + +# if defined (__USE_STD_IOSTREAM) +# define ACE_LACKS_CHAR_RIGHT_SHIFTS +# define ACE_LACKS_IOSTREAM_FX +# define ACE_LACKS_UNBUFFERED_STREAMBUF +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# else /* ! __USE_STD_IOSTREAM */ +# define ACE_USES_OLD_IOSTREAMS +# endif /* ! __USE_STD_IOSTREAM */ + +// 9: nested comment not allowed. (/usr/include/pdsc.h!) (nestcomment) +// 177: variable was declared but never referenced (declbutnotref) +// 193: zero used for undefined preprocessing identifier (undpreid) +// 236: controlling expression is constant (boolexprconst) +// 401: base_class_with_nonvirtual_dtor (basclsnondto) +// 1016: expected type is incompatible with declared type of int (incint) +// 1136: conversion to smaller size integer could lose data (intconlosbit) + +# pragma message disable basclsnondto +# pragma message disable boolexprconst +# pragma message disable undpreid +# pragma message disable notusetmpfunprm +# pragma message disable bltinclnk + +# if (__DECCXX_VER >= 60190029) + // 6.1-029 and later support msg 1136. Disable it because it + // causes warnings from ACE and/or TAO. +# pragma message disable intconlosbit +# endif /* __DECCXX_VER >= 60190029 */ + +# if (__DECCXX_VER == 60190027) + // Seems that this version of cxx doesn't have reset +# define ACE_AUTO_PTR_LACKS_RESET +# endif /* __DECCXX_VER == 60190027 */ + +# if defined (DIGITAL_UNIX) && DIGITAL_UNIX >= 0x40D + // variable "PTHREAD_THIS_CATCH_NP" was declared but never referenced +# pragma message disable declbutnotref +# endif /* DIGITAL_UNIX >= 4.0f */ + +# else /* __DECCXX_VER < 60090010 */ +# define ACE_LACKS_PRAGMA_ONCE +# endif /* __DECCXX_VER < 60090010 */ +#else /* ! __DECCXX */ +# error ace/config-cxx-common.h can only be used with Compaq CXX! +#endif /* ! __DECCXX */ + +#include /**/ "ace/post.h" +#endif /* ACE_CXX_COMMON_H */ diff --git a/externals/ace/config-cygwin32.h b/externals/ace/config-cygwin32.h new file mode 100644 index 0000000..35c517c --- /dev/null +++ b/externals/ace/config-cygwin32.h @@ -0,0 +1,216 @@ +/* -*- C++ -*- */ +// $Id: config-cygwin32.h 87169 2009-10-19 20:26:55Z olli $ + +// The following configuration file is designed to work for CygWin +// platforms using GNU C++. + +#ifndef ACE_CONFIG_CYGWIN32_H +#define ACE_CONFIG_CYGWIN32_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_MT_SAFE) +#define ACE_MT_SAFE 1 +#endif + +#define CYGWIN32 + +// We trust this file will get included before +#if !defined(FD_SETSIZE) +# define FD_SETSIZE 1024 +#endif + +#if !defined (ACE_IOV_MAX) +# define ACE_IOV_MAX 64 +#endif /* ACE_IOV_MAX */ + +// Define custom export macros for export/import of symbols from/of dll's +#if !defined (ACE_HAS_CUSTOM_EXPORT_MACROS) +# define ACE_HAS_CUSTOM_EXPORT_MACROS 1 +# define ACE_Proper_Export_Flag __declspec (dllexport) +# define ACE_Proper_Import_Flag __declspec (dllimport) +# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; +# define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE ; +#endif + +#define ACE_HAS_SELECT_H + +#define ACE_LACKS_PRAGMA_ONCE + +#if ! defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#include /**/ + +// Needed to differentiate between libc 5 and libc 6 (aka glibc). +// It's there on all libc 5 systems I checked. +#include /**/ + +// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so +// this must appear before its #include. +#define ACE_HAS_STRING_CLASS + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#else +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-cygwin32.h +# endif /* __cplusplus */ +#endif /* __GNUG__ */ + +#define ACE_HAS_VOIDPTR_SOCKOPT 1 +#define ACE_HAS_UALARM 1 +#define ACE_HAS_STRNLEN 1 +#define ACE_HAS_POSIX_GETPWNAM_R 1 +#define ACE_HAS_POSIX_NONBLOCK 1 +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_CLOCK_GETTIME 1 +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_HAS_MSG +#define ACE_DEFAULT_BASE_ADDR ((char *) 0x8000000) +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_SVR4_DYNAMIC_LINKING +//#define ACE_HAS_SYSV_IPC +#define ACE_HAS_VOIDPTR_MMAP +#define ACE_HAS_CPLUSPLUS_HEADERS +#define ACE_HAS_POLL +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 +#define ACE_HAS_SOCKADDR_MSG_NAME 1 +#define ACE_LACKS_PRI_T 1 +#define ACE_HAS_3_PARAM_READDIR_R + +// Compiler/platform supports alloca(). +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you want ACE to use it. +//#define ACE_HAS_ALLOCA + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_IP_MULTICAST + +#define ACE_HAS_BIG_FD_SET + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 + +#define ACE_DEFAULT_SELECT_REACTOR_SIZE 256 + +#define ACE_HAS_GETPAGESIZE + +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY + +#define ACE_HAS_STRSIGNAL + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +#define ACE_HAS_SOCKLEN_T 1 + +#define ACE_HAS_GPERF + +#define ACE_HAS_DIRENT +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG + +#define ACE_LACKS_MKFIFO +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_FGETWC 1 +#define ACE_LACKS_NAMED_POSIX_SEM +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_MADVISE +#define ACE_LACKS_GETPGID_PROTOTYPE +#define ACE_LACKS_GETHOSTENT +#define ACE_LACKS_ITOW 1 +#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 +#define ACE_LACKS_RLIMIT +#define ACE_LACKS_RWLOCK_T 1 +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_SYS_SYSCTL_H + +#define ACE_LACKS_FGETWS 1 +#define ACE_LACKS_FPUTWS 1 + +#define ACE_LACKS_WCSTOULL 1 +#define ACE_LACKS_ISCTYPE + +#define ACE_HAS_AUTOMATIC_INIT_FINI + +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGACTION_CONSTP2 +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_SIG_C_FUNC 1 +#define ACE_HAS_SIG_ATOMIC_T + +#define ACE_HAS_POSIX_SEM + +#define ACE_HAS_P_READ_WRITE + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + +// Cygwin DLL suffix is .dll +#define ACE_DLL_SUFFIX ACE_TEXT (".dll") + +// Cygwin runs on Windows, so we have to get the environment variable PATH and +// not LD_LIBRARY_PATH which is the default in ACE +#define ACE_LD_SEARCH_PATH ACE_TEXT ("PATH") + +#if ACE_MT_SAFE +// Yes, we do have threads. +# define ACE_HAS_THREADS +// And they're even POSIX pthreads (LinuxThreads implementation) +# define ACE_HAS_PTHREADS + +# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS + +// Compiler/platform has thread-specific storage +# define ACE_HAS_THREAD_SPECIFIC_STORAGE + +# define ACE_HAS_PTHREADS_UNIX98_EXT +# define ACE_HAS_PTHREAD_CONTINUE 1 +# define ACE_HAS_PTHREAD_SUSPEND 1 + +# define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR +// Cygwin (see pthread.h): Not supported or implemented. +# define ACE_LACKS_SETSCHED +# define ACE_LACKS_SETDETACH +# define ACE_LACKS_PTHREAD_CANCEL +# define ACE_LACKS_THREAD_PROCESS_SCOPING +# define ACE_LACKS_MUTEXATTR_PSHARED +# define ACE_LACKS_RWLOCKATTR_PSHARED +# define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 +# define ACE_LACKS_PTHREAD_YIELD 1 +# define ACE_LACKS_PTHREAD_ATTR_SETSTACK + +#if CYGWIN_VERSION_API_MINOR < 207 +// In the 1.5.9 release of Cygwin the pthread_kill gives an access violation +// so for the time being we say Cygwin doesn't support pthread_kill. +# define ACE_LACKS_PTHREAD_KILL +#endif + +#endif /* ACE_MT_SAFE */ + +#if CYGWIN_VERSION_API_MINOR >= 207 +// > Cygwin 1.7 +#define ACE_HAS_VWPRINTF +#define ACE_HAS_VFWPRINTF +#define ACE_HAS_VSWPRINTF +#endif + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_CYGWIN32_H */ diff --git a/externals/ace/config-doxygen.h b/externals/ace/config-doxygen.h new file mode 100644 index 0000000..830e69a --- /dev/null +++ b/externals/ace/config-doxygen.h @@ -0,0 +1,126 @@ +// -*- C++ -*- + +/** + * This is a configuration file to define all the macros that Doxygen + * needs + * + * @file config-doxygen.h + * + * $Id: config-doxygen.h 84610 2009-02-26 10:26:09Z johnnyw $ + * + * @author Carlos O'Ryan + * @author Darrell Brunsch + * + */ +#ifndef ACE_CONFIG_DOXYGEN_H +#define ACE_CONFIG_DOXYGEN_H + +/// Make sure that we always turn inlining on. +#define __ACE_INLINE__ + +/// Make the wchar_t interfaces available. +#define ACE_HAS_WCHAR + +/// Make all the emulation versions of string operations visible +// #define ACE_LACKS_WCSTOK +#define ACE_LACKS_ITOW +#define ACE_LACKS_STRCASECMP +#define ACE_LACKS_STRRCHR +#define ACE_LACKS_WCSCAT +#define ACE_LACKS_WCSCHR +#define ACE_LACKS_WCSCMP +#define ACE_LACKS_WCSCPY +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSLEN +#define ACE_LACKS_WCSNCAT +#define ACE_LACKS_WCSNCMP +#define ACE_LACKS_WCSNCPY +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_WCSPBRK +#define ACE_LACKS_WCSRCHR +#define ACE_LACKS_WCSCSPN +#define ACE_LACKS_WCSSPN +#define ACE_LACKS_WCSSTR + +/// Support for threads enables several important classes +#define ACE_HAS_THREADS + +/// Support for Win32 enables the WFMO_Reactor and several Async I/O +/// classes +#define ACE_WIN32 + +/// Enable support for POSIX Asynchronous I/O calls +#define ACE_HAS_AIO_CALLS + +/// Enable support for TLI interfaces +#define ACE_HAS_TLI + +/// Enable support for the SSL wrappers +#define ACE_HAS_SSL 1 + +/// Enable exceptions +#define ACE_HAS_EXCEPTIONS + +/// Enable timeprobes +#define ACE_COMPILE_TIMEPROBES + +/// Enable unicode to generate ACE_Registry_Name_Space +#define UNICODE + +/// These defines make sure that Svc_Conf_y.cpp and Svc_Conf_l.cpp are correctly +/// parsed +#define __cplusplus +#define ACE_YY_USE_PROTOS + +/// TAO features that should be documented too +#define TAO_HAS_RT_CORBA 1 +#define TAO_HAS_MINIMUM_CORBA 0 +#define TAO_HAS_AMI 1 +#define TAO_HAS_INTERCEPTORS 1 +#define TAO_HAS_SCIOP 1 +#define TAO_HAS_COIOP 1 +#define TAO_HAS_TRANSPORT_CURRENT 1 + +/// Generate token library documentation +#define ACE_HAS_TOKENS_LIBRARY + +/// Generate ACE ATM classes documentation +#define ACE_HAS_ATM + +/// Generate ACE XTI ATM class documentation +#define ACE_HAS_XTI_ATM + +/// Generate ACE_Dev_Poll_Reactor documentation +#define ACE_HAS_DEV_POLL + +/// Generate ACE_Event_Handler_T documentation +#define ACE_HAS_TEMPLATE_TYPEDEFS + +/// Generate ACE_Log_Msg_NT_Event_Log documentation +#define ACE_HAS_LOG_MSG_NT_EVENT_LOG + +/// Generate icmp documentation +#define ACE_HAS_ICMP_SUPPORT 1 + +/// Don't expand ACE_RCSID macro +#define ACE_USE_RCSID 0 + +/// Parse some ACE_SSL classes that depend on recent versions of +/// OpenSSL. +#define OPENSSL_VERSION_NUMBER 0x00905820L + +/// Enable IPv6 +#define ACE_HAS_IPV6 + +/// Enable netlink socket support +#define ACE_HAS_NETLINK + +#define ACE_HAS_IP_MULTICAST + +#define ACE_INLINE +#define ACE_BEGIN_VERSIONED_NAMESPACE_DECL +#define ACE_END_VERSIONED_NAMESPACE_DECL +#define TAO_BEGIN_VERSIONED_NAMESPACE_DECL +#define TAO_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CONFIG_DOXYGEN_H */ diff --git a/externals/ace/config-freebsd.h b/externals/ace/config-freebsd.h new file mode 100644 index 0000000..b83394d --- /dev/null +++ b/externals/ace/config-freebsd.h @@ -0,0 +1,215 @@ +/* -*- C++ -*- */ +// $Id: config-freebsd.h 87483 2009-11-11 13:50:04Z olli $ + +// The following configuration file is designed to work for FreeBSD + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#if ACE_MT_SAFE + // Yes, we do have threads. +# define ACE_HAS_THREADS 1 +#else + // Set to 0 since that's what config-posix.h checks for. +# define ACE_HAS_THREADS 0 +#endif /* ACE_MT_SAFE */ + +#include "ace/config-posix.h" + +// Make sure we source in the OS version. +#include + +#if !defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#if (__FreeBSD_version < 220000) +# if defined (ACE_HAS_THREADS) +# error Threads are not supported. +# endif /* ACE_HAS_THREADS */ +#endif /* __FreeBSD_version < 220000 */ + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#if defined (ACE_HAS_PENTIUM) +# undef ACE_HAS_PENTIUM +#endif /* ACE_HAS_PENTIUM */ + +// Platform specific directives +// gcc defines __FreeBSD__ automatically for us. +#ifdef ACE_HAS_THREADS +# if !defined (_THREAD_SAFE) +# define _THREAD_SAFE +# endif /* _THREAD_SAFE */ +#endif + + +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_ALLOCA +#define ACE_HAS_ALT_CUSERID +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_CHARPTR_DL +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_DIRENT +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GPERF +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_MSG +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_RTLD_LAZY_V +#define ACE_HAS_SEMUN +#define ACE_HAS_SIGISMEMBER_BUG +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STRSIGNAL +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_SVR4_SIGNAL_T +#define ACE_HAS_SYSCTL +#define ACE_HAS_SYSV_IPC +#define ACE_HAS_SYS_FILIO_H +#define ACE_HAS_SYS_SOCKIO_H +#define ACE_HAS_SYS_SYSCALL_H +#define ACE_HAS_TERMIOS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_HAS_UALARM + +#define ACE_LACKS_CONDATTR_PSHARED +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_ITOW +#define ACE_LACKS_LOG2 +#define ACE_LACKS_MALLOC_H +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_SI_ADDR +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_THREAD_PROCESS_SCOPING +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_WCSDUP +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP + +#define ACE_NEEDS_SCHED_H + +// Defines the page size of the system. +#define ACE_PAGE_SIZE 4096 + +// Note, on FreeBSD 5, POSIX aio is now an optional kernel module which +// must be loaded. +// Read the aio(4) man page for what to do, otherwise any aio_* call +// will coredump. + +// By default use Proactor which does not use POSIX Real-time Signals. +#ifdef ACE_HAS_AIO_CALLS +# ifndef ACE_POSIX_AIOCB_PROACTOR +# define ACE_POSIX_AIOCB_PROACTOR +# endif /* ACE_POSIX_AIOCB_PROACTOR */ +#endif /* ACE_HAS_AIO_CALLS */ + +#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ + +// +// Version specific settings +// + +#if (__FreeBSD_version >= 220000) +# define ACE_HAS_VASPRINTF +#endif + +#if (__FreeBSD_version >= 300000) +# define ACE_HAS_SIGINFO_T +#endif /* __FreeBSD_version >= 300000 */ + +#if (__FreeBSD_version >= 320000) +# define ACE_HAS_REENTRANT_FUNCTIONS +# define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#endif /* __FreeBSD_version >= 320000 */ + +#if (__FreeBSD_version > 400000) +# define ACE_HAS_UCONTEXT_T +# define ACE_HAS_SOCKLEN_T +# define ACE_HAS_GETIFADDRS +# define ACE_HAS_PTHREADS_UNIX98_EXT +#endif + +#if (__FreeBSD_version < 400000) +# define ACE_LACKS_SIGSET +# define ACE_LACKS_RWLOCK_T +# define ACE_LACKS_READDIR_R +# define ACE_LACKS_SETSCHED +# define ACE_LACKS_PTHREAD_THR_SIGSETMASK +# define ACE_LACKS_UCONTEXT_H +# define ACE_LACKS_RAND_REENTRANT_FUNCTIONS + +enum schedparam_policy { + SCHED_RR, + SCHED_IO, + SCHED_FIFO, + SCHED_OTHER +}; +#endif + +#if (__FreeBSD_version < 420000) +# define ACE_LACKS_GETPGID +# define ACE_LACKS_SETPGID +# define ACE_LACKS_SETREGID +# define ACE_LACKS_SETREUID +# define ACE_LACKS_PTHREAD_CANCEL +#endif /* __FreeBSD_version < 420000 */ + +#if (__FreeBSD_version >= 440000) +# define ACE_HAS_GETPROGNAME +# define ACE_HAS_SETPROGNAME +#endif + +#if (__FreeBSD_version < 500100) +# define ACE_HAS_NONCONST_MSGSND +#endif + +#if (__FreeBSD_version < 501000) +# define ACE_LACKS_STDINT_H +# define ACE_LACKS_PWD_REENTRANT_FUNCTIONS +#endif + +#if (__FreeBSD_version >= 501000) +# define ACE_HAS_PTHREAD_SETSTACK +#endif + +#if (__FreeBSD_version < 700007) +# define ACE_HAS_SIGVAL_SIGVAL_INT +# define ACE_HAS_BROKEN_SIGEVENT_STRUCT +#endif + +#if (__FreeBSD_version >= 700028) +# define ACE_HAS_SCTP +# define ACE_HAS_LKSCTP +#endif + +#if (__FreeBSD_version < 700038) +# define ACE_HAS_VOID_UNSETENV +#endif + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-g++-common.h b/externals/ace/config-g++-common.h new file mode 100644 index 0000000..dc01018 --- /dev/null +++ b/externals/ace/config-g++-common.h @@ -0,0 +1,183 @@ +// -*- C++ -*- +// +// $Id: config-g++-common.h 89454 2010-03-11 09:35:25Z johnnyw $ + +// This configuration file is designed to be included by another, +// specific configuration file. It provides config information common +// to all g++ platforms, including egcs. + +#ifndef ACE_GNUG_COMMON_H +#define ACE_GNUG_COMMON_H +#include /**/ "ace/pre.h" + +#define ACE_HAS_CPLUSPLUS_HEADERS +#define ACE_HAS_STDCPP_STL_INCLUDES +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_TEMPLATES_REQUIRE_SOURCE + +#if ( __GNUC__ == 2 && __GNUC_MINOR__ < 97 ) + // gcc 2.97 and lower use old iostreams +# define ACE_USES_OLD_IOSTREAMS +#endif /* __GNUC__ >= 2.97 */ + +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS +#endif /* __GNUC__ >= 3.4 */ + +#if (__GNUC__ < 3) +# define ACE_LACKS_MEMBER_TEMPLATES +# define ACE_LACKS_NUMERIC_LIMITS +#endif /* __GNUC__ < 3 */ + +// __EXCEPTIONS is defined with -fexceptions, the egcs default. It +// is not defined with -fno-exceptions, the ACE default for g++. +// ACE_HAS_EXCEPTIONS is defined in +// include/makeinclude/wrapper_macros.GNU, so this really isn't +// necessary. Just in case . . . +#if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS) +# define ACE_HAS_EXCEPTIONS +#endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */ + +#if defined (ACE_HAS_EXCEPTIONS) +# define ACE_NEW_THROWS_EXCEPTIONS +# if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) +// Versions of g++ prior to 3.3 had a buggy operator // new(nothrow)[](). +# define ACE_HAS_NEW_NOTHROW +# endif /* __GNUC__ >= 3.3 */ +#endif /* ACE_HAS_EXCEPTIONS */ + +#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE) +# define ACE_SIZEOF_LONG_DOUBLE 12 +#endif /* i386 */ + +#if !defined (__MINGW32__) && (defined (i386) || defined (__i386__)) + // If running an Intel, assume that it's a Pentium so that + // ACE_OS::gethrtime () can use the RDTSC instruction. If running a + // 486 or lower, be sure to comment this out. (If not running an + // Intel CPU, this #define will not be seen because of the i386 + // protection, so it can be ignored.) +# define ACE_HAS_PENTIUM +#endif /* i386 */ + +#if (defined (ACE_HAS_PENTIUM) || defined (__amd64__) || defined (__x86_64__)) +# define ACE_HAS_INTEL_ASSEMBLY +#endif + +#if !defined (ACE_HAS_GCC_CONSTRUCTOR_ATTRIBUTE) +#define ACE_HAS_GCC_CONSTRUCTOR_ATTRIBUTE 1 +#endif + +#if !defined (ACE_HAS_GCC_DESTRUCTOR_ATTRIBUTE) +#define ACE_HAS_GCC_DESTRUCTOR_ATTRIBUTE 1 +#endif + +#if !defined (ACE_HAS_GCC_DEPRECATED_ATTRIBUTE) +#define ACE_HAS_GCC_DEPRECATED_ATTRIBUTE 1 +#endif + +#if (ACE_HAS_GCC_CONSTRUCTOR_ATTRIBUTE == 1) +# define ACE_GCC_CONSTRUCTOR_ATTRIBUTE __attribute__ ((constructor)) +#endif + +#if (ACE_HAS_GCC_DESTRUCTOR_ATTRIBUTE == 1) +# define ACE_GCC_DESTRUCTOR_ATTRIBUTE __attribute__ ((destructor)) +#endif + +#if (ACE_HAS_GCC_DEPRECATED_ATTRIBUTE == 1) +#define ACE_DEPRECATED __attribute__ ((deprecated)) +#endif + +// GNU g++ >= 4.x implements "#pragma once". +#if (__GNUC__ < 4) && !defined (ACE_LACKS_PRAGMA_ONCE) +// We define it with a -D with make depend. +# define ACE_LACKS_PRAGMA_ONCE +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +// Take advantage of G++ (>= 4.x) visibility attributes to generate +// improved shared library binaries. +#if (__GNUC__ >= 4) && !defined (__MINGW32__) && !defined (ACE_HAS_CEGCC) + +# if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 +# undef ACE_HAS_CUSTOM_EXPORT_MACROS +# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS) +# undef ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS +# endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ +# define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 0 +# else +# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS +# define ACE_HAS_CUSTOM_EXPORT_MACROS +# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ +# define ACE_Proper_Export_Flag __attribute__ ((visibility("default"))) +# define ACE_Proper_Import_Flag __attribute__ ((visibility("default"))) + +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) +// Sadly, G++ 4.x silently ignores visibility attributes on +// template instantiations, which breaks singletons. +// As a workaround, we use the GCC visibility pragmas. +// And to make them fit in a macro, we use C99's _Pragma() +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17470 +// This has been fixed in GCC 4.1.1 with FC6 but not with SuSE 10.2 +// that gets shipped with GCC 4.1.2 so we assume that with GCC 4.2 +// this will be fixed on the head. With FC6 just set this define yourself +# ifndef ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS +# define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1 +# endif +# endif + +# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS) && ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS == 1 +# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; +# else /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ +# define ACE_EXPORT_SINGLETON_DECLARATION(T) \ + _Pragma ("GCC visibility push(default)") \ + template class T \ + _Pragma ("GCC visibility pop") +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) \ + _Pragma ("GCC visibility push(default)") \ + template class SINGLETON_TYPE; \ + _Pragma ("GCC visibility pop") +# endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ + +// Note that the "__extension__" is needed to prevent g++ from issuing +// an error when using its "-pedantic" command line flag. +# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE; + +# endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ +#endif /* __GNU__ >= 4 */ + +// GCC >= 4.1 provides __sync_XXXX builtins for use in atomic operations +// although the builtins are provided globally they are not supported on all platforms +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) +# if defined (__powerpc__) +// The builtins seem to be provided for all powerpc platforms +# define ACE_HAS_GCC_ATOMIC_BUILTINS 1 +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 1) && (__GNUC_PATCHLEVEL__ == 1)) +// PPU GCC 4.1.1 doesn't have builtin atomic ops for size 1/2 +# define ACE_LACKS_GCC_ATOMIC_BUILTINS_2 +# define ACE_LACKS_GCC_ATOMIC_BUILTINS_1 +# endif +# endif +# if defined (__ia64) +// The builtins seem to be provided for the IA64 platforms +# define ACE_HAS_GCC_ATOMIC_BUILTINS 1 +# endif +# if defined (__amd64__) || defined (__x86_64__) +// The builtin's are provided also for 64bit linux +# define ACE_HAS_GCC_ATOMIC_BUILTINS 1 +# endif +#endif + +#if defined (ACE_HAS_GNU_REPO) + // -frepo causes unresolved symbols of basic_string left- and + // right-shift operators with ACE_HAS_STRING_CLASS. +# if defined (ACE_HAS_STRING_CLASS) +# undef ACE_HAS_STRING_CLASS +# endif /* ACE_HAS_STRING_CLASS */ +#endif /* ! ACE_HAS_GNU_REPO */ + +#include /**/ "ace/post.h" +#endif /* ACE_GNUG_COMMON_H */ diff --git a/externals/ace/config-ghs-common.h b/externals/ace/config-ghs-common.h new file mode 100644 index 0000000..ffa554c --- /dev/null +++ b/externals/ace/config-ghs-common.h @@ -0,0 +1,43 @@ +/* -*- C++ -*- */ +// $Id: config-ghs-common.h 80826 2008-03-04 14:51:23Z wotte $ + +// This configuration file is designed to be included by another, +// specific configuration file. It provides config information common +// to all Green Hills platforms. + +#ifndef ACE_GHS_COMMON_H +#define ACE_GHS_COMMON_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_CONFIG_INCLUDE_GHS_COMMON) +# error ace/config-ghs-common.h: ACE configuration error! Do not #include this file directly! +#endif + +#if defined (ghs) + +# if defined (sun) + // Need nonstatic Object_Manager on Solaris to prevent seg fault + // on startup. +# define ACE_HAS_NONSTATIC_OBJECT_MANAGER +# endif /* sun */ + +# if defined (__STANDARD_CXX) + // Green Hills 1.8.9, but not 1.8.8. +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_LACKS_AUTO_PTR +# define ACE_LACKS_CHAR_RIGHT_SHIFTS +# define ACE_LACKS_UNBUFFERED_STREAMBUF +# else +# define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA +# endif /* __STANDARD_CXX */ + +# define ACE_LACKS_LINEBUFFERED_STREAMBUF +# define ACE_LACKS_LONGLONG_T +# define ACE_LACKS_SIGNED_CHAR + +#else /* ! ghs */ +# error ace/config-ghs-common.h can only be used with Green Hills compilers! +#endif /* ! ghs */ + +#include /**/ "ace/post.h" +#endif /* ACE_GHS_COMMON_H */ diff --git a/externals/ace/config-hpux-11.00.h b/externals/ace/config-hpux-11.00.h new file mode 100644 index 0000000..82420f2 --- /dev/null +++ b/externals/ace/config-hpux-11.00.h @@ -0,0 +1,451 @@ +/* -*- C++ -*- */ +// $Id: config-hpux-11.00.h 89494 2010-03-15 20:11:18Z olli $ + +// The following configuration file is designed to work for HP +// platforms running HP-UX 11.00 using aC++ or gcc (2.95 and up). + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +#define ACE_LACKS_STDINT_H +#define ACE_LACKS_SYS_SELECT_H + +#if defined (__GNUG__) + +// config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so +// this must appear before its #include. +# define ACE_HAS_STRING_CLASS + +# include "ace/config-g++-common.h" + +#else + +// aC++... + +// Precompiler needs extra flags to ignore "invalid #pragma directive" +# ifndef ACE_USING_MCPP_PREPROCESSOR +# define ACE_CC_PREPROCESSOR_ARGS "-E +W 67" +# endif +// Compiler supports C++ exception handling. It's on by default. If the +// +noeh compiler option is used to disable exceptions, the compiler defines +// __HPACC_NOEH. +# if !defined (__HPACC_NOEH) +# define ACE_HAS_EXCEPTIONS 1 +# endif + +// If the -AA compile option is used, the compiler defines _HP_NAMESPACE_STD. +// The -AA option enables the 2.0 standard C++ library. If not used, then +// we have the old, 1.2.1 C++ library. +# if defined (_HP_NAMESPACE_STD) +# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) +# undef ACE_HAS_STANDARD_CPP_LIBRARY +# endif +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# undef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB +# endif +# if defined (RWSTD_NO_NAMESPACE) + namespace std {} using namespace std; +# else +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# endif /* RWSTD_NO_NAMESPACE */ +# else +# define ACE_USES_OLD_IOSTREAMS + // There's no support in ACE's use of numeric_limits for those that + // aren't in std:: +# define ACE_LACKS_NUMERIC_LIMITS +# endif /* _HP_NAMESPACE_STD */ + +// Compiler implements templates that support typedefs inside of classes +// used as formal arguments to a template class. +# define ACE_HAS_TEMPLATE_TYPEDEFS + +# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +// Platform lacks streambuf "linebuffered ()". +# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 + +// Lack of (and broken) support for placement operator delete is a known +// bug by HP, up until aC++ A.03.55.02. +# if (__HP_aCC < 35502) +# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE +# endif /* __HP_aCC < 35502 */ + +// Compiler's 'new' throws exceptions on failure, regardless of whether or +// not exception handling is enabled in the compiler options. Fortunately, +// new(nothrow_t) is offered. +# define ACE_NEW_THROWS_EXCEPTIONS +# define ACE_HAS_NEW_NOTHROW +# define ACE_HAS_NEW_NO_H 1 + +// Compiler's template mechanism must see source code (i.e., .C files). +# define ACE_TEMPLATES_REQUIRE_SOURCE + +// Compiler doesn't handle 'signed char' correctly (used in ace/IOStream.h) +# define ACE_LACKS_SIGNED_CHAR + +#endif /* __GNUG__, HP */ + +//********************************************************************* +// +// From here down is the compiler-INdependent OS settings. +// +//********************************************************************* + +// Compiling for HPUX. +#if !defined (HPUX) +#define HPUX +#endif /* HPUX */ +#define HPUX_11 + +#ifndef _HPUX_SOURCE +#define _HPUX_SOURCE +#endif + +#include /**/ + +// HP-UX is a POSIX-compliant system - see what's available. +#include "ace/config-posix.h" + +// config-posix.h sets up ACE_HAS_AIO_CALLS if the headers define the +// proper things. In HP-UX 11's case, the AIOCB Proactor works the best +// overall. If the user hasn't overridden it, select AIOCB. +#if defined (ACE_HAS_AIO_CALLS) +# if !defined (ACE_POSIX_AIOCB_PROACTOR) && !defined (ACE_POSIX_SIG_PROACTOR) +# define ACE_POSIX_AIOCB_PROACTOR +# endif /* !ACE_HAS_POSIX_AIOCB_PROACTOR && !ACE_POSIX_SIG_PROACTOR */ +#endif /* ACE_HAS_AIO_CALLS */ + +//////////////////////////////////////////////////////////////////////////// +// +// General OS information - see README for more details on what they mean +// +/////////////////////////////////////////////////////////////////////////// + +// HP/UX needs to have these addresses in a special range. +// If this is on a 64-bit model, the default is to use 64-bit addressing. +// It can also be set so that the mapped region is shareable with 32-bit +// programs. To enable the 32/64 sharing, comment out the first definition +// of ACE_DEFAULT_BASE_ADDR and uncomment the two lines after it. +#if defined (__LP64__) +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000001100000000) +//# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +//# define ACE_OS_EXTRA_MMAP_FLAGS MAP_ADDR32 + +# define ACE_DEFAULT_BASE_ADDRL (0x0000001100000000) +//# define ACE_DEFAULT_BASE_ADDRL (0x80000000) +#else +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +#endif /* __LP64__ */ + +// Preprocessor needs some help with data types +#if defined (__LP64__) +# define ACE_SIZEOF_LONG 8 +#else +# define ACE_SIZEOF_LONG 4 +#endif + +// Platform can do async I/O (aio_*) (set up in config-posix.h) +// ... but seems to require this in order to keep from hanging. Needs some +// investigation, maybe with HP. John Mulhern determined this value +// empirically. YMMV. If it does vary, set it up in your own config.h which +// then includes the ACE-supplied config. +#if !defined (ACE_INFINITE) +# define ACE_INFINITE 10000000 +#endif + +/* Compiler/platform correctly calls init()/fini() for shared libraries. */ +#define ACE_HAS_AUTOMATIC_INIT_FINI 1 + +// Manually tweak the malloc control block paddings to properly align +// things. +#define ACE_MALLOC_PADDING 16 +#define ACE_MALLOC_ALIGN 8 +#define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS 3 + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +#define ACE_HAS_SYS_PSTAT_H + +// But doesn't have a prototype for syscall() +#define ACE_LACKS_SYSCALL + +// Platform supports POSIX.1b clock_gettime () +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME + +// Prototypes for both signal() and struct sigaction are consistent. +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Compiler/platform has correctly prototyped header files. +#define ACE_HAS_CPLUSPLUS_HEADERS + +// Compiler/platform has Dirent iterator functions. +#define ACE_HAS_DIRENT + +#define ACE_HAS_VSWPRINTF + +// Platform supports getpagesize() call +#define ACE_HAS_GETPAGESIZE +// But we define this just to be safe +#define ACE_PAGE_SIZE 4096 + +// Can run gperf on this platform (needed for TAO) +# define ACE_HAS_GPERF + +// Optimize ACE_Handle_Set for select(). +# define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// Platform supports IP multicast +#define ACE_HAS_IP_MULTICAST +// At least for 11iv2, lacks perfect filtering. +#if (HPUX_VERS >= 1123) && !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif + +/* Platform defines MAP_FAILED as a long constant. */ +#define ACE_HAS_LONG_MAP_FAILED 1 + +// Platform supports recvmsg and sendmsg. +#define ACE_HAS_MSG + +// Platform's select() has non-const timeval argument +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +// Compiler/platform supports poll(). +#define ACE_HAS_POLL + +/* Platform supports "position-independent" features provided by + ACE_Based_Pointer<>. */ +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 + +/* Platform supports POSIX getpwnam_r() function */ +#define ACE_HAS_POSIX_GETPWNAM_R 1 + +// Platform supports POSIX O_NONBLOCK semantics. +#define ACE_HAS_POSIX_NONBLOCK + +// Platform supports the POSIX struct timespec type +#define ACE_HAS_POSIX_TIME + +/* Platform has pread() and pwrite() support. */ +#define ACE_HAS_P_READ_WRITE 1 + +/* Platform will recurse infinitely on thread exits from TSS cleanup routines + (e.g., AIX) */ +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 + +// Platform supports reentrant functions (all the POSIX *_r functions). +#define ACE_HAS_REENTRANT_FUNCTIONS +// ctime_r and asctime_r conform to POSIX.1c (2 param version) +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + +// Platform offers scandir(), and requires no adjustments for its API. +#define ACE_HAS_SCANDIR + +// HP-UX 11 has reentrant netdb functions. The catch is that the old +// functions (gethostbyname, etc.) are thread-safe and the _r versions are +// not used and will be removed at some point. So, define things so +// the _r versions are not used. This will slow things down a bit due to +// the extra mutex lock in the ACE_NETDBCALL_RETURN macro, and will be fixed +// in the future (problem ID P64). +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS + +/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ +#define ACE_LACKS_PRI_T 1 + +// Platform has shm_open +#define ACE_HAS_SHM_OPEN + +// Compiler/platform defines the sig_atomic_t typedef +#define ACE_HAS_SIG_ATOMIC_T + +/* Compiler requires extern "C" functions for signals. */ +#define ACE_HAS_SIG_C_FUNC 1 + +// Platform's sigaction() function takes const sigaction* as 2nd parameter. +#define ACE_HAS_SIGACTION_CONSTP2 + +#define ACE_HAS_SSIZE_T + +// Platform supports SVR4 extended signals +#define ACE_HAS_SIGINFO_T + +/* Define to 1 if platform has sigsuspend(). */ +#define ACE_HAS_SIGSUSPEND 1 + +// Platform doesn't detect a signal out of range unless it's way out of range. +#define ACE_HAS_SIGISMEMBER_BUG + +/* Platform provides socklen_t type, such as Linux with glibc2. */ +#define ACE_HAS_SOCKLEN_T 1 + +#define ACE_HAS_XPG4_MULTIBYTE_CHAR + +#define ACE_HAS_UALARM + +// Platform supports ucontext_t (which is used in the extended signal API). +#define ACE_HAS_UCONTEXT_T + +// Platform/compiler supports void * as second parameter to gettimeofday(). +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY + +/* Platform requires void * for mmap(). */ +#define ACE_HAS_VOIDPTR_MMAP 1 + +/* OS/compiler uses void * arg 4 setsockopt() rather than const char * */ +#define ACE_HAS_VOIDPTR_SOCKOPT 1 + +// Platform supports SVR4 dynamic linking semantics. +// When used, this requires -ldl on the ACE library link line. +#define ACE_HAS_SVR4_DYNAMIC_LINKING + +// Platform supports the getrusage() system call. +#define ACE_HAS_GETRUSAGE + +/* Define to 1 if platform has the declaration of getrusage(). */ +#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 + +// Platform has the sigwait function in a header file +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIGTIMEDWAIT + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +// accept() is thread-safe +#define ACE_HAS_THREAD_SAFE_ACCEPT + +// Platform lacks a typedef for timespec_t, but has struct timespec +#define ACE_LACKS_TIMESPEC_T + +// dlopen() takes a char* instead of const char* +#define ACE_HAS_CHARPTR_DL + +// lacks setegid and seteuid +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID + +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_SYS_SYSCTL_H + +// @@ TODO: It looks like HP-UX provides strtoll, strtoull, wcstoll and +// wcstoull but some more work is needed to plug them in correctly. +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_WCSTOLL +#define ACE_LACKS_STRTOULL +#define ACE_LACKS_WCSTOULL + +#define ACE_LACKS_ISWASCII + +#define ACE_LACKS_SETENV +#define ACE_LACKS_UNSETENV + +// Shared library name/path components +#if defined (__ia64) +# define ACE_DLL_SUFFIX ACE_TEXT (".so") +#else +# define ACE_DLL_SUFFIX ACE_TEXT (".sl") +#endif /* __ia64 */ +#if defined (__LP64__) +# define ACE_LD_SEARCH_PATH ACE_TEXT ("LD_LIBRARY_PATH") +#else +# define ACE_LD_SEARCH_PATH ACE_TEXT ("SHLIB_PATH") +#endif /* __LP64__ */ + +#if defined (_INCLUDE__STDC_A1_SOURCE) +# define ACE_HAS_3_PARAM_WCSTOK +#endif + +#define ACE_HAS_3_PARAM_READDIR_R + +#define ACE_LACKS_STRUCT_LIFNUM + +////////////////////////////////////////////////////////////////////////// +// +// STREAMS information +// +////////////////////////////////////////////////////////////////////////// + +// Platform supports STREAMS +#define ACE_HAS_STREAMS +// Compiler/platform supports struct strbuf. +#define ACE_HAS_STRBUF_T +// But the putmsg signature doesn't have it as const... +// Well, it really does, but it depends on preprocessor defines. +#define ACE_LACKS_CONST_STRBUF_PTR +/* Platform supports TLI timod STREAMS module */ +#define ACE_HAS_TIMOD_H 1 + +// Platform supports STREAM pipes +// This is possible, but not by default - need to rebuild the kernel to +// get them enabled - see pipe(2) and "STREAMS/UX for the HP 9000" +// #define ACE_HAS_STREAM_PIPES + +///////////////////////////////////////////////////////////////////////// +// +// TLI/XTI information +// +//////////////////////////////////////////////////////////////////////// + +// Platform supports XTI (includes TLI). +#define ACE_HAS_XTI +// HP-UX 11 conforms to the XPG4 spec, which ACE calls broken for the +// errmsg not being const... +#define ACE_HAS_BROKEN_T_ERROR +// The definitions of TCP_NODELAY and TCP_MAXSEG conflict between +// sys/xti.h and netinet/tcp.h. +#define ACE_HAS_CONFLICTING_XTI_MACROS +/* Platform provides header */ +#define ACE_HAS_SYS_XTI_H 1 + +///////////////////////////////////////////////////////////////////////// +// +// Threads information. +// +// Use of threads is controlled by the 'threads' argument to make. See +// include/makeinclude/platform_hpux_aCC.GNU for details. If it's not set, +// the default is to enable it, since kernel threads are always available +// on HP-UX 11, as opposed to 10.x where it was optional software. +// +//////////////////////////////////////////////////////////////////////// + +#if defined (ACE_HAS_THREADS) +# if (ACE_HAS_THREADS == 0) +# undef ACE_HAS_THREADS +# endif /* ACE_HAS_THREADS == 0 */ +#else +# define ACE_HAS_THREADS +#endif /* ACE_HAS_THREADS */ + +#if defined (ACE_HAS_THREADS) + +# if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +# endif + +// HP-UX doesn't define _POSIX_THREADS since it doesn't implement all +// features (lacks thread priority inheritance and protection), so +// config-posix.h doesn't get this one... +# define ACE_HAS_PTHREADS +# define ACE_HAS_PTHREADS_UNIX98_EXT +# define ACE_HAS_PTHREAD_CONTINUE +# define ACE_HAS_PTHREAD_RESUME_NP +# define ACE_HAS_PTHREAD_SUSPEND +# define ACE_HAS_RECURSIVE_MUTEXES +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +# define ACE_LACKS_PTHREAD_ATTR_SETSTACK +#endif /* ACE_HAS_THREADS */ + +#define ACE_HAS_POSIX_SEM + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses +#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-icc-common.h b/externals/ace/config-icc-common.h new file mode 100644 index 0000000..1ebd0c5 --- /dev/null +++ b/externals/ace/config-icc-common.h @@ -0,0 +1,113 @@ +// -*- C++ -*- +// +// $Id: config-icc-common.h 81935 2008-06-12 22:01:53Z jtc $ + +#ifndef ACE_LINUX_ICC_COMMON_H +#define ACE_LINUX_ICC_COMMON_H +#include /**/ "ace/pre.h" + +# define ACE_HAS_CPLUSPLUS_HEADERS +# define ACE_HAS_STDCPP_STL_INCLUDES +# define ACE_HAS_TEMPLATE_TYPEDEFS +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_HAS_STRING_CLASS + +#if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 +# undef ACE_HAS_CUSTOM_EXPORT_MACROS +# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS) +# undef ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS +# endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ +# define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 0 +#else +# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS +# define ACE_HAS_CUSTOM_EXPORT_MACROS +# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ +# define ACE_Proper_Export_Flag __attribute__ ((visibility("default"))) +# define ACE_Proper_Import_Flag __attribute__ ((visibility("default"))) + +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) +// Sadly, G++ 4.x silently ignores visibility attributes on +// template instantiations, which breaks singletons. +// As a workaround, we use the GCC visibility pragmas. +// And to make them fit in a macro, we use C99's _Pragma() +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17470 +// This has been fixed in GCC 4.1.1 with FC6 but not with SuSE 10.2 +// that gets shipped with GCC 4.1.2 so we assume that with GCC 4.2 +// this will be fixed on the head. With FC6 just set this define yourself +# ifndef ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS +# define ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1 +# endif +# endif + +# if defined (ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS) && ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS == 1 +# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; +# else /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ +# define ACE_EXPORT_SINGLETON_DECLARATION(T) \ + _Pragma ("GCC visibility push(default)") \ + template class T \ + _Pragma ("GCC visibility pop") +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) \ + _Pragma ("GCC visibility push(default)") \ + template class SINGLETON_TYPE; \ + _Pragma ("GCC visibility pop") +# endif /* ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS */ + +// Note that the "__extension__" is needed to prevent g++ from issuing +// an error when using its "-pedantic" command line flag. +# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE; +#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ + +// __EXCEPTIONS is defined with -fexceptions, the egcs default. It +// is not defined with -fno-exceptions, the ACE default for g++. +// ACE_HAS_EXCEPTIONS is defined in +// include/makeinclude/wrapper_macros.GNU, so this really isn't +// necessary. Just in case . . . +# if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS) +# define ACE_HAS_EXCEPTIONS +# endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */ + +# if defined (ACE_HAS_EXCEPTIONS) +# define ACE_NEW_THROWS_EXCEPTIONS +# endif /* ACE_HAS_EXCEPTIONS */ + +#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE) +# define ACE_SIZEOF_LONG_DOUBLE 12 +#endif /* i386 */ + +#if !defined (__MINGW32__) && (defined (i386) || defined (__i386__)) + // If running an Intel, assume that it's a Pentium so that + // ACE_OS::gethrtime () can use the RDTSC instruction. If running a + // 486 or lower, be sure to comment this out. (If not running an + // Intel CPU, this #define will not be seen because of the i386 + // protection, so it can be ignored.) +# define ACE_HAS_PENTIUM +#endif /* i386 */ + +#if (defined (ACE_HAS_PENTIUM) || defined (__amd64__) || defined (__x86_64__)) +# define ACE_HAS_INTEL_ASSEMBLY +#endif + +#if !defined (ACE_LACKS_PRAGMA_ONCE) + // We define it with a -D with make depend. +# define ACE_LACKS_PRAGMA_ONCE +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +#define ACE_TEMPLATES_REQUIRE_SOURCE + +#if (__INTEL_COMPILER >= 910) +# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS +#endif + +#if defined (__ia64) +# define ACE_HAS_IA64INTRIN_H +# define ACE_HAS_INTRINSIC_INTERLOCKED +#else +# define ACE_HAS_IA32INTRIN_H +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_LINUX_ICC_COMMON_H */ diff --git a/externals/ace/config-integritySCA.h b/externals/ace/config-integritySCA.h new file mode 100644 index 0000000..41afec5 --- /dev/null +++ b/externals/ace/config-integritySCA.h @@ -0,0 +1,229 @@ +// -*- C++ -*- + +#ifndef ACE_INT_CONFIG_H +#define ACE_INT_CONFIG_H + +/* + * This config.h file is for version 4.0.x of the + * Integrity RTOS with SCA from Green Hills Software + * http://www.ghs.com/products/rtos/integrity.html + * + * $Id: config-integritySCA.h 88501 2010-01-12 19:41:53Z olli $ + */ + +#define ghs +/* compilation defines */ +#define ACE_LACKS_GETPGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID + +#ifndef ACE_HAS_EXCEPTIONS + #define ACE_HAS_EXCEPTIONS +#endif +#define ACE_NEW_THROWS_EXCEPTIONS +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#define ACE_TEMPLATES_REQUIRE_SOURCE 1 +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define TAO_USE_SEQUENCE_TEMPLATES +#define ACE_NEEDS_FUNC_DEFINITIONS +#define _REENTRANT +#define ACE_MT_SAFE 1 + +// Compiler/platform has correctly prototyped header files. +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_SHM_OPEN + +/***** Operating System Defines *****/ + +/***** ANSI defines *****/ +#define ACE_LACKS_TEMPNAM /* believe it or not, this is ANSI C */ +#define ACE_LACKS_PUTENV_PROTOTYPE + +#define ACE_LACKS_SENDMSG + +/***** End Stack Defines *****/ + + +/* SCA STUFF */ +#if defined(INTEGRITY_VERSION) && (INTEGRITY_VERSION >= 40108) +#define ACE_HAS_SIG_ATOMIC_T +#endif /* INTEGRITY_VERSION */ +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIGACTION +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_UCONTEXT_H +#define ACE_HAS_SIG_C_FUNC +#define ACE_LACKS_SI_ADDR +#define ACE_HAS_AIO_CALLS + +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_DIRENT + +#define ACE_HAS_THREADS + +#define ACE_HAS_PTHREADS +/***** End Threading Defines *****/ + +/***** Hardware Defines *****/ +#define ACE_PAGE_SIZE 4096 +/***** End Hardware Defines *****/ + +/****** SYSV_IPC STUFF *****/ +#define ACE_LACKS_KEY_T + +/****** Posix Defines *****/ +#define ACE_LACKS_WAIT +#define ACE_LACKS_WAITPID +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_POSIX_SEM +#define ACE_HAS_STRDUP_EMULATION +#define ACE_HAS_MSG +#define ACE_LACKS_CONDATTR_PSHARED +#define ACE_LACKS_EXEC +#define ACE_LACKS_FORK +#define ACE_LACKS_MKFIFO +#define ACE_LACKS_MKTEMP +#define ACE_LACKS_MKSTEMP +#define ACE_LACKS_MPROTECT +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_PIPE +#define ACE_LACKS_RLIMIT +#define ACE_LACKS_RECVMSG +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SEMBUF_T +#define ACE_LACKS_UNIX_DOMAIN_SOCKETS +#define ACE_LACKS_FCNTL +#define ACE_LACKS_UMASK +#define ACE_LACKS_SEEK +#define ACE_LACKS_MSYNC +#define ACE_LACKS_PID_STUFF +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_IPC_H +#define ACE_LACKS_SETGID +#define ACE_LACKS_PIPE +#define ACE_LACKS_SYS_PARAM_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_UTSNAME_T +#define ACE_LACKS_UNAME +#define ACE_LACKS_UMASK +#define ACE_LACKS_ISATTY +#define ACE_LACKS_GETOPT +#define ACE_LACKS_STRCASECMP +#define ACE_LACKS_TRUNCATE +#define ACE_LACKS_PWD_FUNCTIONS +#define ACE_LACKS_UNIX_SIGNALS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_PUTENV +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_LACKS_THREAD_PROCESS_SCOPING +#define ACE_LACKS_SETSCHED +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_WRITEV +#define ACE_LACKS_READV +#define ACE_LACKS_SYSCONF +#define ACE_LACKS_GETOPT +/* below refers to fcntl style locking */ +#define ACE_LACKS_FILELOCKS + +#define ACE_LACKS_REALPATH +#define ACE_HAS_CONST_CHAR_SWAB +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +/***** Not tied to standards AFAIK ****/ +#define ACE_LACKS_MADVISE /* paging optimization not needed with INTEGRITY */ +#define ACE_LACKS_MALLOC_H /* netbsd's just includes stdlib.h */ +#define ACE_LACKS_MEMORY_H /* netbsd's just includes string.h */ +#define ACE_LACKS_INTTYPES_H +#define ACE_LACKS_SYS_RESOURCE_H +#define ACE_LACKS_SYS_WAIT_H +#define ACE_LACKS_SEARCH_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_PWD_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_DLFCN_H +#define ACE_LACKS_REGEX_H +#define ACE_LACKS_POLL_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_TERMIOS_H + +/***** STUFF INTEGRITY 4.0.8 APPEARS TO SUPPORT ****/ +/* note, possibly untested with ace */ + +/***** TAO STUFF ****/ +#define TAO_USE_DOTTED_DECIMAL_ADDRESSES 1 + +#include + +#include + +typedef void (*__sighandler_t)(int); + +extern "C" +{ + inline int isatty(int) { return 0; } +} + +#ifdef ppc +#define ACE_HAS_POWERPC_TIMER +#endif + +/* MIKEC Addtions */ +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#include // needed to define iovec +#define ACE_LACKS_READLINK +#define ACE_LACKS_GETPPID +#define NSIG (SIGRTMAX+1) +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_USE_RCSID 0 +#define ACE_LACKS_CUSERID +#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 0x5000 +#define fileno(file) ((file)->io_channel) //Hack to get Svc_Conf_l.cpp compiled +#define ACE_DEFAULT_THREAD_PRIORITY 127 +#define PRI_FIFO_MIN 1 +#define PRI_FIFO_MAX 127 +#define ACE_THR_PRI_FIFO_DEF 127 +#define PRI_RR_MIN 1 +#define PRI_RR_MAX 127 +#define ACE_THR_PRI_RR_DEF 127 +#define PRI_OTHER_MIN 1 +#define PRI_OTHER_MAX 127 +#define ACE_THR_PRI_OTHER_DEF 127 +#define ACE_PTHREAD_RETURN_ON_EXIT +#undef ACE_LACKS_UNLINK + +#define ACE_HAS_TIMED_MESSAGE_BLOCKS + +extern "C" { +int unlink(const char *); +} + +#define ACE_LACKS_SETSID +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY +#define ACE_LACKS_UNIX_SYSLOG +#define ACE_LACKS_TELLDIR +#define ACE_LACKS_SEEKDIR +#define ACE_LACKS_GETHOSTENT + + +/* end MIKEC Addtions */ + +// Hack to avoid ensure that things defined in ind_io.h +// have the right linkage +#include + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-linux-common.h b/externals/ace/config-linux-common.h new file mode 100644 index 0000000..b787a14 --- /dev/null +++ b/externals/ace/config-linux-common.h @@ -0,0 +1,464 @@ +/* -*- C++ -*- */ +// $Id: config-linux-common.h 88663 2010-01-22 10:49:22Z mcorino $ + +// Do not use this configuration file directly since it's designed to +// be included by another, specific configuration file, such as +// config-linux.h. It provides config information common to all Linux +// platforms. It automatically determines the CPU architecture, +// compiler (g++ or egcs), and libc (libc5 or glibc), and configures +// based on those. + +#ifndef ACE_LINUX_COMMON_H +#define ACE_LINUX_COMMON_H +#include /**/ "ace/pre.h" + +#define ACE_HAS_BYTESEX_H + +#if ! defined (__ACE_INLINE__) +#define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +// Needed to differentiate between libc 5 and libc 6 (aka glibc). +#include + +#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) +# define ACE_HAS_PTHREADS_UNIX98_EXT +#endif /* _XOPEN_SOURCE - 0 >= 500 */ + +#if !defined (ACE_LACKS_LINUX_NPTL) + +# include "ace/config-posix.h" + + // Temporary fix because NPTL kernels do have shm_open but there is a problem + // with shm_open/shm_unlink pairing in ACE which needs to be fixed when I have time. +# if defined (ACE_HAS_SHM_OPEN) +# undef ACE_HAS_SHM_OPEN +# endif /* ACE_HAS_SHM_OPEN */ + +# if defined (ACE_USES_FIFO_SEM) + // Don't use this for Linux NPTL since this has complete + // POSIX semaphores which are more efficient +# undef ACE_USES_FIFO_SEM +# endif /* ACE_USES_FIFO_SEM */ + +# if defined (ACE_HAS_POSIX_SEM) + // Linux NPTL may not define the right POSIX macro + // but they have the actual runtime support for this stuff +# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) +# define ACE_HAS_POSIX_SEM_TIMEOUT +# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) */ +# endif /* ACE_HAS_POSIX_SEM */ +#endif /* !ACE_LACKS_LINUX_NPTL */ + +// First the machine specific part + +#if defined (__powerpc__) || defined (__x86_64__) +# if !defined (ACE_DEFAULT_BASE_ADDR) +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x40000000) +# endif /* ! ACE_DEFAULT_BASE_ADDR */ +#elif defined (__ia64) +# if !defined (ACE_DEFAULT_BASE_ADDR) +// Zero base address should work fine for Linux of IA-64: it just lets +// the kernel to choose the right value. +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000000000000000) +# endif /* ! ACE_DEFAULT_BASE_ADDR */ +#endif /* ! __powerpc__ && ! __ia64 */ + +// Then glibc/libc5 specific parts + +#if defined(__GLIBC__) +# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) +# define ACE_HAS_NONCONST_SETRLIMIT +# endif +# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 3) +# define ACE_HAS_RUSAGE_WHO_ENUM enum __rusage_who +# define ACE_HAS_RLIMIT_RESOURCE_ENUM enum __rlimit_resource +# define ACE_LACKS_ISCTYPE +# endif +# define ACE_HAS_SOCKLEN_T +# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG + + // glibc defines both of these, used in OS_String. +# if defined (_GNU_SOURCE) +# define ACE_HAS_STRNLEN +# define ACE_HAS_WCSNLEN + + // This is probably not a 100%-sure-fire check... Red Hat Linux 9 + // and Enterprise Linux 3 and up have a new kernel that can send signals + // across threads. This was not possible prior because there was no real + // difference between a process and a thread. With this, the + // ACE_POSIX_SIG_Proactor is the only chance of getting asynch I/O working. + // There are restrictions, such as all socket operations being silently + // converted to synchronous by the kernel, that make aio a non-starter + // for most Linux platforms at this time. But we'll start to crawl... +# define ACE_POSIX_SIG_PROACTOR +# endif + + // To avoid the strangeness with Linux's ::select (), which modifies + // its timeout argument, use ::poll () instead. +# define ACE_HAS_POLL + +// Don't define _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED in ACE to make +// getpgid() prototype visible. ACE shouldn't depend on feature test +// macros to make prototypes visible. +# define ACE_LACKS_GETPGID_PROTOTYPE + +// @note the following defines are necessary with glibc 2.0 (0.961212-5) +// on Alpha. I assume that they're necessary on Intel as well, +// but that may depend on the version of glibc that is used. +//# define ACE_HAS_DLFCN_H_BROKEN_EXTERN_C +# define ACE_HAS_VOIDPTR_SOCKOPT + +// Don't define _POSIX_SOURCE in ACE to make strtok() prototype +// visible. ACE shouldn't depend on feature test macros to make +// prototypes visible. +# define ACE_LACKS_STRTOK_R_PROTOTYPE +// @note end of glibc 2.0 (0.961212-5)-specific configuration. + +# if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 + // These were suggested by Robert Hanzlik to get + // ACE to compile on Linux using glibc 2.1 and libg++/gcc 2.8. +# undef ACE_HAS_BYTESEX_H +# define ACE_HAS_SIGINFO_T +# define ACE_LACKS_SIGINFO_H +# define ACE_HAS_UCONTEXT_T + + // Pre-glibc (RedHat 5.2) doesn't have sigtimedwait. +# define ACE_HAS_SIGTIMEDWAIT +# endif /* __GLIBC__ 2.1+ */ +#else /* ! __GLIBC__ */ + // Fixes a problem with some non-glibc versions of Linux... +# define ACE_LACKS_MADVISE +# define ACE_LACKS_MSG_ACCRIGHTS +#endif /* ! __GLIBC__ */ + +// Don't define _LARGEFILE64_SOURCE in ACE to make llseek() or +// lseek64() prototype visible. ACE shouldn't depend on feature test +// macros to make prototypes visible. +#if __GLIBC__ > 1 +# if __GLIBC_MINOR__ == 0 +# define ACE_HAS_LLSEEK +# define ACE_LACKS_LLSEEK_PROTOTYPE +# else /* __GLIBC_MINOR__ > 0 */ +# define ACE_HAS_LSEEK64 +# define ACE_LACKS_LSEEK64_PROTOTYPE +# endif +#endif /* __GLIBC__ > 1 */ + +#if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 +# define ACE_HAS_P_READ_WRITE +# define ACE_LACKS_PREAD_PROTOTYPE +// Use ACE's alternate cuserid() implementation since the use of the +// system cuserid() is discouraged. +# define ACE_HAS_ALT_CUSERID +#endif /* __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 */ + +#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) +# define ACE_HAS_ISASTREAM_PROTOTYPE +# define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE +# define ACE_HAS_CPU_SET_T +#endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */ + +// Then the compiler specific parts + +#if defined (__INTEL_COMPILER) +# include "ace/config-icc-common.h" +#elif defined (__GNUG__) + // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so + // this must appear before its #include. +# define ACE_HAS_STRING_CLASS +# include "ace/config-g++-common.h" +#define ACE_CC_NAME ACE_TEXT ("g++") +#define ACE_CC_MAJOR_VERSION __GNUC__ +#define ACE_CC_MINOR_VERSION __GNUC_MINOR__ +//#define ACE_CC_BETA_VERSION 0 /* ??? */ +#elif defined (__DECCXX) +# define ACE_CONFIG_INCLUDE_CXX_COMMON +# include "ace/config-cxx-common.h" +#elif defined (__SUNCC_PRO) || defined (__SUNPRO_CC) +# include "ace/config-suncc-common.h" +#elif defined (__PGI) +// Portable group compiler +# define ACE_HAS_CPLUSPLUS_HEADERS +# define ACE_HAS_STDCPP_STL_INCLUDES +# define ACE_HAS_TEMPLATE_TYPEDEFS +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_LACKS_SWAB +#elif defined (__GNUC__) +/** + * GNU C compiler. + * + * We need to recognize the GNU C compiler since TAO has at least one + * C source header and file + * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly + * include this + */ +#else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && && !__PGI */ +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-linux-common.h +# endif /* __cplusplus */ +#endif /* ! __GNUG__*/ + +// Completely common part :-) + +// Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +#define ACE_HAS_SIGSUSPEND + +#define ACE_HAS_UALARM + +#define ACE_HAS_STRSIGNAL + +#if __GLIBC__ >= 2 +#ifndef ACE_HAS_POSIX_REALTIME_SIGNALS +#define ACE_HAS_POSIX_REALTIME_SIGNALS +#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ + +#ifndef ACE_HAS_AIO_CALLS +#define ACE_HAS_AIO_CALLS +#endif /* ACE_HAS_AIO_CALLS */ +#endif + +#if __GLIBC__ >= 2 +// glibc 2 and higher has wchar support +# define ACE_HAS_XPG4_MULTIBYTE_CHAR +# define ACE_HAS_VFWPRINTF +#endif + +#if __GLIBC__ < 2 +// These are present in glibc 2 and higher +# define ACE_LACKS_WCSTOK +# define ACE_LACKS_WCSDUP_PROTOTYPE +#endif /* __GLIBC__ < 2 */ + +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_ISWASCII + +#if __GLIBC__ >= 2 +# define ACE_HAS_3_PARAM_WCSTOK +#endif + +#define ACE_HAS_3_PARAM_READDIR_R + +#if !defined (ACE_DEFAULT_BASE_ADDR) +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +#endif /* ! ACE_DEFAULT_BASE_ADDR */ + +// Compiler/platform supports alloca(). +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA + +// Compiler/platform has +#define ACE_HAS_ALLOCA_H +#define ACE_HAS_SYS_SYSINFO_H +#define ACE_HAS_LINUX_SYSINFO + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GETRUSAGE_PROTOTYPE + +#define ACE_HAS_BYTESWAP_H +#define ACE_HAS_BSWAP_16 +#define ACE_HAS_BSWAP_32 + +#if defined __GNUC__ && __GNUC__ >= 2 +# define ACE_HAS_BSWAP_64 +#endif + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// ONLY define this if you have config'd multicast into a 2.0.34 or +// prior kernel. It is enabled by default in 2.0.35 kernels. +#if !defined (ACE_HAS_IP_MULTICAST) +# define ACE_HAS_IP_MULTICAST +#endif /* ! ACE_HAS_IP_MULTICAST */ + +// At least for IPv4, Linux lacks perfect filtering. +#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ + +#define ACE_HAS_BIG_FD_SET + +// Linux defines struct msghdr in /usr/include/socket.h +#define ACE_HAS_MSG + +// Linux "improved" the interface to select() so that it modifies +// the struct timeval to reflect the amount of time not slept +// (see NOTES in Linux's select(2) man page). +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 + +#define ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE 1 + +#define ACE_HAS_GETPAGESIZE 1 + +#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) +// glibc supports wchar, but lacks fgetwc and ungetwc +# define ACE_LACKS_FGETWC +# define ACE_HAS_NONCONST_MSGSND +# define ACE_LACKS_STRNLEN_PROTOTYPE +#endif + +// glibc requires _XOPEN_SOURCE_EXTENDED to make this prototype +// visible, so force ACE to declare one. Yuk! +#ifndef _XOPEN_SOURCE_EXTENDED +# define ACE_LACKS_MKSTEMP_PROTOTYPE +#endif /* !_XOPEN_SOURCE_EXTENDED */ + +// Platform defines struct timespec but not timespec_t +#define ACE_LACKS_TIMESPEC_T + +// Platform supplies scandir() +#define ACE_HAS_SCANDIR +#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) +// Although the scandir man page says otherwise, this setting is correct. +// The setting was fixed in 2.10, so do not use the hack after that. +#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR +#endif + +// A conflict appears when including both and +// with recent glibc headers. +//#define ACE_HAS_PROC_FS + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +// Platform/compiler supports global timezone variable. +#define ACE_HAS_TIMEZONE + +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +// Don't define _XOPEN_SOURCE in ACE to make strptime() prototype +// visible. ACE shouldn't depend on feature test macros to make +// prototypes visible. +#define ACE_LACKS_STRPTIME_PROTOTYPE + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler/platform defines a union semun for SysV shared memory. +#define ACE_HAS_SEMUN + +#define ACE_HAS_POSIX_TIME + +#define ACE_HAS_GPERF + +#define ACE_HAS_DIRENT + +// Starting with FC9 rawhide this file is not available anymore but +// this define is set +#if defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1 +# define ACE_LACKS_STROPTS_H +# define ACE_LACKS_STRRECVFD +#endif + +#if !defined (ACE_LACKS_STROPTS_H) +# define ACE_HAS_STRBUF_T +#endif + +#if defined (__ia64) || defined(__alpha) || defined (__x86_64__) +// On 64 bit platforms, the "long" type is 64-bits. Override the +// default 32-bit platform-specific format specifiers appropriately. +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" +#endif /* __ia64 */ + +#define ACE_SIZEOF_WCHAR 4 + +#if defined (__powerpc__) && !defined (ACE_SIZEOF_LONG_DOUBLE) +// 32bit PowerPC Linux uses 128bit long double +# define ACE_SIZEOF_LONG_DOUBLE 16 +#endif + +#define ACE_LACKS_GETIPNODEBYADDR +#define ACE_LACKS_GETIPNODEBYNAME + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +// Linux implements sendfile(). +#define ACE_HAS_SENDFILE 1 + +#define ACE_HAS_VOIDPTR_MMAP + +#define ACE_HAS_ICMP_SUPPORT 1 + +#define ACE_HAS_VASPRINTF + +// According to man pages Linux uses different (compared to UNIX systems) types +// for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP +// in setsockopt/getsockopt. +#define ACE_HAS_IP_MULTICAST_TTL_AS_INT 1 +#define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1 +#define ACE_HAS_IP_MULTICAST_LOOP_AS_INT 1 + +#if defined (ACE_LACKS_NETWORKING) +# include "ace/config-posix-nonetworking.h" +#else +# define ACE_HAS_NETLINK +# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) +# define ACE_HAS_GETIFADDRS +# endif +#endif + +#if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) +// Detect if getsockname() and getpeername() returns random values in +// the sockaddr_in::sin_zero field by evaluation of the kernel +// version. Since version 2.5.47 this problem is fixed. +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47)) +# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 0 +# else +# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 1 +# endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,47)) */ +#endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */ + +#if defined (ACE_HAS_EVENT_POLL) +// The sys_epoll interface was introduced in Linux kernel 2.5.45. +// Don't support backported versions since they appear to be buggy. +// The obsolete ioctl()-based interface is no longer supported. +#if 0 +// linux/version.h may not be accurate. It's not for Fedora Core 2... +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +# if (LINUX_VERSION_CODE < KERNEL_VERSION (2,5,45)) +# undef ACE_HAS_EVENT_POLL +# error Disabling Linux epoll support. Kernel used in C library is too old. +# error Linux kernel 2.5.45 or better is required. +# endif /* LINUX_VERSION_CODE < KERNEL_VERSION (2,5,45) */ +#endif /* ACE_HAS_EVENT_POLL */ +#endif + +#if !defined (ACE_HAS_EVENT_POLL) && !defined (ACE_HAS_DEV_POLL) +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +# if (LINUX_VERSION_CODE > KERNEL_VERSION (2,6,0)) +# define ACE_HAS_EVENT_POLL +# endif +#endif + +#include /**/ "ace/post.h" + +#endif /* ACE_LINUX_COMMON_H */ diff --git a/externals/ace/config-linux.h b/externals/ace/config-linux.h new file mode 100644 index 0000000..8b79c13 --- /dev/null +++ b/externals/ace/config-linux.h @@ -0,0 +1,75 @@ +// -*- C++ -*- +// +// $Id: config-linux.h 80826 2008-03-04 14:51:23Z wotte $ + +// The following configuration file is designed to work for Linux +// platforms using GNU C++. + +#ifndef ACE_CONFIG_LINUX_H +#define ACE_CONFIG_LINUX_H +#include /**/ "ace/pre.h" + +#define ACE_PLATFORM_CONFIG config-linux.h + +#include "ace/config-linux-common.h" + +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE + +#if !defined (ACE_MT_SAFE) +#define ACE_MT_SAFE 1 // JCEJ 12/22/96 #1 +#endif + +#if ACE_MT_SAFE +// Yes, we do have threads. +#define ACE_HAS_THREADS +// And they're even POSIX pthreads (LinuxThreads implementation) +#define ACE_HAS_PTHREADS + +// On linux this is part of pthreads +# if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L) +# if !defined (ACE_HAS_CLOCK_GETTIME) +# if !defined(__PGI) +# define ACE_HAS_CLOCK_GETTIME +# endif /* __PGI */ +# define ACE_HAS_CLOCK_SETTIME +# endif /* !ACE_HAS_CLOCK_GETTIME */ +# endif /* _POSIX_C_SOURCE >= 199309L */ + +#if !defined (ACE_HAS_PTHREADS_UNIX98_EXT) +# define ACE_LACKS_RWLOCK_T +#else +# define ACE_HAS_RECURSIVE_MUTEXES +#endif /* !ACE_HAS_PTHREADS_UNIX98_EXT */ + +#define ACE_HAS_THREAD_SPECIFIC_STORAGE // jcej 12/22/96 #2 + +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS // JCEJ 1/7-8/96 + +#if defined(__GLIBC__) +// Platform supports reentrant functions (i.e., all the POSIX *_r +// functions). +#define ACE_HAS_REENTRANT_FUNCTIONS + +#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) + // Older versions of glibc lacked reentrant netdb functions +# define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS + + // glibc < 2.1 lacks pthread_attr_setstacksize() +# define ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE +#endif /* (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) */ + +// uses ctime_r & asctime_r with only two parameters vs. three +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#endif + +#else +// AIO support pulls in the rt library, which pulls in the pthread +// library. Disable AIO in single-threaded builds. +# undef ACE_HAS_AIO_CALLS +#endif /* ACE_MT_SAFE */ + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_LINUX_H */ diff --git a/externals/ace/config-lite.h b/externals/ace/config-lite.h new file mode 100644 index 0000000..1a6937c --- /dev/null +++ b/externals/ace/config-lite.h @@ -0,0 +1,164 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file config-lite.h + * + * $Id: config-lite.h 85832 2009-06-28 16:14:59Z johnnyw $ + * + * @author (Originally in OS.h)Doug Schmidt + * @author Jesper S. M|ller + * @author and a cast of thousands... + * + * This file contains the contents of the old config-all.h in order to + * avoid a circular dependency problem caused by some of the new + * includes added to config-all.h, e.g., OS_main.h. + */ +//========================================================================== + +#ifndef ACE_CONFIG_LITE_H +#define ACE_CONFIG_LITE_H + +#include /**/ "ace/pre.h" + +#include "ace/config-macros.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Empty ACE_OS namespace to help identify compiler errors more +// easily. -- @@ Do we really need this? +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +namespace ACE_OS {} +ACE_END_VERSIONED_NAMESPACE_DECL + +// ============================================================================ +// UNICODE macros (to be added later) +// ============================================================================ + +// Get the unicode (i.e. ACE_TCHAR) defines +# include "ace/ace_wchar.h" + +// ============================================================================ +// at_exit declarations +// ============================================================================ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Marker for cleanup, used by ACE_Exit_Info. +extern int ace_exit_hook_marker; + +ACE_END_VERSIONED_NAMESPACE_DECL + +// For use by . +extern "C" +{ + typedef void (*ACE_EXIT_HOOK) (void); +} + +// Signature for registering a cleanup function that is used by the +// ACE_Object_Manager and the ACE_Thread_Manager. +# if defined (ACE_HAS_SIG_C_FUNC) +extern "C" { +# endif /* ACE_HAS_SIG_C_FUNC */ +typedef void (*ACE_CLEANUP_FUNC)(void *object, void *param) /* throw () */; +# if defined (ACE_HAS_SIG_C_FUNC) +} +# endif /* ACE_HAS_SIG_C_FUNC */ + +// ============================================================================ +// log_msg declarations +// ============================================================================ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) +typedef int (*ACE_SEH_EXCEPT_HANDLER)(void *); +// Prototype of win32 structured exception handler functions. +// They are used to get the exception handling expression or +// as exception handlers. +# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + +class ACE_OS_Thread_Descriptor; +class ACE_OS_Log_Msg_Attributes; +typedef void (*ACE_INIT_LOG_MSG_HOOK) (ACE_OS_Log_Msg_Attributes &attr +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , ACE_SEH_EXCEPT_HANDLER selector + , ACE_SEH_EXCEPT_HANDLER handler +# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + ); +typedef void (*ACE_INHERIT_LOG_MSG_HOOK) (ACE_OS_Thread_Descriptor*, + ACE_OS_Log_Msg_Attributes &); + +typedef void (*ACE_CLOSE_LOG_MSG_HOOK) (void); + +typedef void (*ACE_SYNC_LOG_MSG_HOOK) (const ACE_TCHAR *prog_name); + +typedef ACE_OS_Thread_Descriptor *(*ACE_THR_DESC_LOG_MSG_HOOK) (void); + +ACE_END_VERSIONED_NAMESPACE_DECL + +/** + * @deprecated ACE_DECLARE_STL_REVERSE_ITERATORS is a crutch to be + * used until all C++ compiler supported by ACE support + * the standard reverse_iterator adapters. + * @internal ACE_DECLARE_STL_REVERSE_ITERATORS is not meant for use + * outside of ACE. + */ +// STL reverse_iterator declaration generator +// Make sure you include in the file you're using this +// generator, and that the following traits are available: +// +// iterator +// const_iterator +// value_type +// reference +// pointer +// const_reference +// const_pointer +// difference_type +// +// Once all C++ compilers support the standard reverse_iterator +// adapters, we can drop this generator macro or at least drop the +// MSVC++ or Sun Studio preprocessor conditional blocks. +#if defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x5100 \ + && !defined (_STLPORT_VERSION) + // If we're not using the stlport4 C++ library (which has standard + // iterators), we need to ensure this is included in order to test + // the _RWSTD_NO_CLASS_PARTIAL_SPEC feature test macro below. +# include +#endif /* __SUNPRO_CC <= 0x5100 */ +#if (defined (_MSC_VER) && (_MSC_VER <= 1310) && defined (_WIN64)) \ + || defined (ACE_HAS_BROKEN_STD_REVERSE_ITERATOR) + // VC 7.1 and the latest 64-bit platform SDK still don't define a standard + // compliant reverse_iterator adapter. +# define ACE_DECLARE_STL_REVERSE_ITERATORS \ + typedef std::reverse_iterator reverse_iterator; \ + typedef std::reverse_iterator const_reverse_iterator; +#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x5100 \ + && defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) +# define ACE_DECLARE_STL_REVERSE_ITERATORS \ + typedef std::reverse_iterator reverse_iterator; \ + typedef std::reverse_iterator const_reverse_iterator; +#else +# define ACE_DECLARE_STL_REVERSE_ITERATORS \ + typedef std::reverse_iterator reverse_iterator; \ + typedef std::reverse_iterator const_reverse_iterator; +#endif /* _MSC_VER && _WIN64 */ + + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_LITE_H */ diff --git a/externals/ace/config-lynxos.h b/externals/ace/config-lynxos.h new file mode 100644 index 0000000..81176f6 --- /dev/null +++ b/externals/ace/config-lynxos.h @@ -0,0 +1,199 @@ +// $Id: config-lynxos.h 89494 2010-03-15 20:11:18Z olli $ + +// The following configuration file is designed to work for LynxOS, +// version 4.0.0 and later, using the GNU g++ compiler. + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +// System include files are not in sys/, this gets rid of warning. +#define __NO_INCLUDE_WARN__ + +#define __FREEBSDCODE__ +#include +#undef __FREEBSDCODE__ + +#if ! defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +// Compile using multi-thread libraries. +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#include "ace/config-posix.h" + +#if defined (__x86__) +# define ACE_HAS_PENTIUM +#elif defined (__powerpc__) + // It looks like the default stack size is 15000. + // ACE's Recursive_Mutex_Test needs more. +# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 + // This doesn't work on LynxOS 3.0.0, because it resets the TimeBaseRegister. + // # define ACE_HAS_POWERPC_TIMER +#endif /* __x86__ || __powerpc__ */ + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_ALLOCA +#define ACE_HAS_ALLOCA_H +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 +#define ACE_HAS_BROKEN_SIGEVENT_STRUCT +#define ACE_HAS_CHARPTR_SHMAT +#define ACE_HAS_CHARPTR_SHMDT +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_CPLUSPLUS_HEADERS +#define ACE_HAS_DIRENT +#define ACE_HAS_GETIFADDRS +#define ACE_HAS_GETPAGESIZE +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GETRUSAGE_PROTOTYPE +#define ACE_HAS_GPERF +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_ICMP_SUPPORT 1 +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_MEMCHR +#define ACE_HAS_MKDIR +#define ACE_HAS_MSG +#define ACE_HAS_NANOSLEEP +#define ACE_HAS_NEW_NOTHROW +#define ACE_HAS_NONCONST_CLOCK_SETTIME +#define ACE_HAS_NONCONST_MSGSND +#define ACE_HAS_NONCONST_READV +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONCONST_SETRLIMIT +#define ACE_HAS_NONCONST_WRITEV +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_SCANDIR +#define ACE_HAS_SIGACTION_CONSTP2 +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SIG_C_FUNC +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_MSG_NAME +#define ACE_HAS_SOCKLEN_T +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STREAMS +#define ACE_HAS_STRINGS +#define ACE_HAS_STRING_CLASS +#define ACE_HAS_SYSCTL +#define ACE_HAS_SYS_FILIO_H +#define ACE_HAS_SYS_SOCKIO_H +#define ACE_HAS_TERMIOS +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +#define ACE_LACKS_ALPHASORT_PROTOTYPE +#define ACE_LACKS_CONST_TIMESPEC_PTR +#define ACE_LACKS_GETPGID +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_MADVISE +#define ACE_LACKS_MKSTEMP_PROTOTYPE +#define ACE_LACKS_MKTEMP_PROTOTYPE +#define ACE_LACKS_PUTENV_PROTOTYPE +#define ACE_LACKS_REALPATH +#define ACE_LACKS_RLIMIT_NOFILE +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SCANDIR_PROTOTYPE +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_STRPTIME +#define ACE_LACKS_SWAB_PROTOTYPE +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_SUSECONDS_T + +#define ACE_DEFAULT_BASE_ADDR ((char *) 0) +#define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS +#define ACE_MALLOC_ALIGN 8 +#define ACE_PAGE_SIZE 4096 +#define ACE_POSIX_SIG_PROACTOR +#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR + +// LynxOS has poll.h but it is unusable since implementation is not provided +#define ACE_LACKS_POLL_H + +#if ACE_MT_SAFE == 1 + // Platform supports threads. +# define ACE_HAS_PTHREADS +# define ACE_HAS_PTHREADS_STD +# define ACE_HAS_PTHREADS_UNIX98_EXT +# define ACE_HAS_PTHREAD_GETCONCURRENCY +# define ACE_HAS_PTHREAD_SETCONCURRENCY +# define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +# define ACE_LACKS_PTHREAD_ATTR_SETSTACK +# define ACE_LACKS_THREAD_PROCESS_SCOPING +# if ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR == 0 +# define ACE_LACKS_SETDETACH +# define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR +# endif +#endif /* ACE_MT_SAFE */ + +// By default, don't include RCS Id strings in object code. +#if !defined (ACE_USE_RCSID) +# define ACE_USE_RCSID 0 +#endif /* ! ACE_USE_RCSID */ + +#if ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR == 0 +# define ACE_LACKS_GETOPT_PROTOTYPE +# define ACE_LACKS_INET_ATON_PROTOTYPE +# define ACE_LACKS_REGEX_H +# define ACE_LACKS_STRCASECMP_PROTOTYPE +# define ACE_LACKS_STRNCASECMP_PROTOTYPE +# define ACE_LACKS_SYS_SELECT_H +#endif + +#if (ACE_LYNXOS_MAJOR > 4) || (ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR >= 2) +// LynxOS 4.2 additons +# define ACE_HAS_POSIX_SEM_TIMEOUT +# define ACE_HAS_MUTEX_TIMEOUTS +#endif + +#if (ACE_LYNXOS_MAJOR >=5) +// LynxOS 5.0 Additons +# define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +# define ACE_HAS_NONCONST_INET_ADDR +# define ACE_LACKS_INET_ATON_PROTOTYPE +# define ACE_LACKS_SEMBUF_T +# define ACE_LACKS_STROPTS_H +# define ACE_LACKS_STRRECVFD +# define ACE_LACKS_SYS_SEM_H +# define ACE_SYS_SIGLIST __sys_siglist +#else +// LynxOS 5.0 Removals +# define ACE_HAS_LYNXOS4_SIGNALS +# define ACE_HAS_SEMUN +# define ACE_HAS_STRBUF_T +# define ACE_HAS_SYSV_IPC +# define ACE_LACKS_ISBLANK +# define ACE_LACKS_SETENV +# define ACE_LACKS_UNSETENV +# define ACE_LACKS_USECONDS_T +# define ACE_LACKS_VSNPRINTF +# define ACE_LACKS_WCHAR_H +# define ACE_SYS_SIGLIST sys_siglist +#endif + +#if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) +# define ACE_HAS_BROKEN_THREAD_KEYFREE +#endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-macosx-iphone-hardware.h b/externals/ace/config-macosx-iphone-hardware.h new file mode 100644 index 0000000..6201d8e --- /dev/null +++ b/externals/ace/config-macosx-iphone-hardware.h @@ -0,0 +1,15 @@ +// $Id: config-macosx-iphone-hardware.h 88739 2010-01-27 05:35:23Z sowayaa $ +#ifndef ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H +#define ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H + +#define ACE_HAS_IPHONE +#define ACE_SIZEOF_LONG_DOUBLE 8 + +#include "ace/config-macosx-snowleopard.h" + +#ifdef ACE_HAS_SYSV_IPC +#undef ACE_HAS_SYSV_IPC +#endif + +#endif ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H + diff --git a/externals/ace/config-macosx-iphone-simulator.h b/externals/ace/config-macosx-iphone-simulator.h new file mode 100644 index 0000000..024cf84 --- /dev/null +++ b/externals/ace/config-macosx-iphone-simulator.h @@ -0,0 +1,9 @@ +// $Id: config-macosx-iphone-simulator.h 88653 2010-01-21 23:19:50Z sowayaa $ +#ifndef ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H +#define ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H + +#define ACE_HAS_IPHONE +#include "ace/config-macosx-snowleopard.h" + +#endif ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H + diff --git a/externals/ace/config-macosx-leopard.h b/externals/ace/config-macosx-leopard.h new file mode 100644 index 0000000..dfaaf87 --- /dev/null +++ b/externals/ace/config-macosx-leopard.h @@ -0,0 +1,231 @@ +/* -*- C++ -*- */ +// $Id: config-macosx-leopard.h 90343 2010-05-29 02:18:47Z wotte $ + +// This configuration file is designed to work with the MacOS X operating system. + +#ifndef ACE_CONFIG_MACOSX_LEOPARD_H +#define ACE_CONFIG_MACOSX_LEOPARD_H + +#define ACE_HAS_MAC_OSX +#define ACE_HAS_NET_IF_DL_H + +#define ACE_HAS_VOID_UNSETENV + +#if ! defined (__ACE_INLINE__) +#define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#if !defined (ACE_SIZEOF_LONG_DOUBLE) +# if (__GNUC__ == 3 && __GNUC_MINOR__ == 3) + // Size of long double in GCC 3.3 is 8. +# define ACE_SIZEOF_LONG_DOUBLE 8 +# else // Else, the compiler is GCC4 + // For GCC4, the size is 16. +# define ACE_SIZEOF_LONG_DOUBLE 16 +# endif // GCC 3.3 +#endif // ACE_SIZEOF_LONG_DOUBLE + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#define ACE_ISCTYPE_EQUIVALENT __isctype + +#ifndef ACE_HAS_NONCONST_FD_ISSET +#define ACE_HAS_NONCONST_FD_ISSET +#endif + +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" + +#if !defined (__i386__) +# if defined (ACE_HAS_PENTIUM) +# undef ACE_HAS_PENTIUM +# endif /* ACE_HAS_PENTIUM */ +#else // __i386__ +# define ACE_HAS_PENTIUM +#endif //__i386__ + +#if !defined (_THREAD_SAFE) +#define _THREAD_SAFE +#endif /* _THREAD_SAFE */ + +#define ACE_HAS_GPERF +#define ACE_HAS_POSIX_SEM + +#define ACE_HAS_SUNOS4_GETTIMEOFDAY + +#define ACE_LACKS_STROPTS_H + +// Platform provides header. +#define ACE_HAS_EXECINFO_H + +// Wcharness.... +#define ACE_HAS_WCHAR +#define ACE_SIZEOF_WCHAR 4 + + +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_WCSDUP + +// Mac lacks the following pthread features +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_CONDATTR_PSHARED +// +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler/platform supports SVR4 signal typedef +#define ACE_HAS_SVR4_SIGNAL_T + +//Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +#define ACE_HAS_AIO_CALLS + +//Platform supports sigsuspend() +#define ACE_HAS_SIGSUSPEND + +#define ACE_LACKS_GETPGID +#define ACE_LACKS_RWLOCK_T + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_NEEDS_SCHED_H + +// Use of is deprecated. +#define ACE_LACKS_MALLOC_H + +#define ACE_HAS_ALT_CUSERID + +// Platform supports POSIX timers via struct timespec. +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_UALARM + +// Platform defines struct timespec but not timespec_t +#define ACE_LACKS_TIMESPEC_T + +#define ACE_LACKS_STRRECVFD + +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Compiler/platform supports alloca(). +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA + +// Compiler/platform correctly calls init()/fini() for shared libraries. +#define ACE_HAS_AUTOMATIC_INIT_FINI + +// platform supports POSIX O_NONBLOCK semantics +#define ACE_HAS_POSIX_NONBLOCK + +// platform supports IP multicast +#define ACE_HAS_IP_MULTICAST +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Compiler/platform provides the sockio.h file. +#define ACE_HAS_SYS_SOCKIO_H + +// Compiler/platform provides the socklen_t type. +#define ACE_HAS_SOCKLEN_T + +// Defines the page size of the system. +#define ACE_HAS_GETPAGESIZE + +// Platform provides header. +#define ACE_HAS_SYS_FILIO_H + +// Platform/compiler supports timezone * as second parameter to gettimeofday(). +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSV_MSQ_PROTOS +#define ACE_HAS_MSG +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_NONCONST_MSGSND + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#if ACE_MT_SAFE == 1 +// Yes, we do have threads. +# define ACE_HAS_THREADS +// And they're even POSIX pthreads +# define ACE_HAS_PTHREADS +# define ACE_HAS_PTHREADS_STD +# define ACE_HAS_PTHREAD_SCHEDPARAM +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +#endif /* ACE_MT_SAFE == 1 */ + +#define ACE_LACKS_THREAD_PROCESS_SCOPING + +#define ACE_HAS_DIRENT +#define ACE_LACKS_POLL_H +#define ACE_LACKS_SEARCH_H + +#define ACE_LACKS_SETSCHED +//#define ACE_HAS_RECURSIVE_MUTEXES + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +#define ACE_HAS_SEMUN +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_GETIFADDRS +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_UNNAMED_SEMAPHORE + +#if !defined (__DARWIN_UNIX03) +#define ACE_HAS_VOID_UNSETENV +#endif + + +// dlcompat package (not part of base Darwin) is needed for dlopen(). +// You may download directly from sourceforge and install or use fink +// Fink installer puts libraries in /sw/lib and headers in /sw/include +// In order to install dlcompat do the following: +// - download fink from http://fink.sf.net +// - type: +// fink install dlcompat +// as of Dec 2002, if you use fink you will need to uncomment the next line +// #define ACE_NEEDS_DL_UNDERSCORE +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH") +#define ACE_DLL_SUFFIX ACE_TEXT (".dylib") +//#define ACE_LACKS_DLCLOSE + +// gperf seems to need this +//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) +#error "Compiler must be upgraded, see http://developer.apple.com" +#endif /* __APPLE_CC__ */ + +#endif /* ACE_CONFIG_MACOSX_TIGER_H */ diff --git a/externals/ace/config-macosx-panther.h b/externals/ace/config-macosx-panther.h new file mode 100644 index 0000000..4b131f9 --- /dev/null +++ b/externals/ace/config-macosx-panther.h @@ -0,0 +1,182 @@ +/* -*- C++ -*- */ +// $Id: config-macosx-panther.h 87167 2009-10-19 19:33:53Z olli $ + +// This configuration file is designed to work with the MacOS X operating system. + +#ifndef ACE_CONFIG_MACOSX_H +#define ACE_CONFIG_MACOSX_H + +#if ! defined (__ACE_INLINE__) +#define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#define ACE_LACKS_SUSECONDS_T +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" + +#if defined (ACE_HAS_PENTIUM) +# undef ACE_HAS_PENTIUM +#endif /* ACE_HAS_PENTIUM */ + +#if !defined (_THREAD_SAFE) +#define _THREAD_SAFE +#endif /* _THREAD_SAFE */ + +#define ACE_HAS_GPERF +#define ACE_HAS_POSIX_SEM + +//#define ACE_HAS_SVR4_TLI + +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_WCHAR_H + +// +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler/platform supports SVR4 signal typedef +#define ACE_HAS_SVR4_SIGNAL_T + +//Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +//Platform supports sigsuspend() +#define ACE_HAS_SIGSUSPEND + +//#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_LACKS_GETPGID +#define ACE_LACKS_RWLOCK_T + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_NEEDS_SCHED_H + +// Use of is deprecated. +#define ACE_LACKS_MALLOC_H + +#define ACE_HAS_ALT_CUSERID + +// Platform supports POSIX timers via struct timespec. +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_UALARM + +// Platform defines struct timespec but not timespec_t +#define ACE_LACKS_TIMESPEC_T + +#define ACE_LACKS_STRRECVFD + +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Compiler/platform supports alloca(). +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA + +// Compiler/platform correctly calls init()/fini() for shared libraries. +#define ACE_HAS_AUTOMATIC_INIT_FINI + +// Explicit dynamic linking permits "lazy" symbol resolution +//#define ACE_HAS_RTLD_LAZY_V + +// platform supports POSIX O_NONBLOCK semantics +#define ACE_HAS_POSIX_NONBLOCK + +// platform supports IP multicast +#define ACE_HAS_IP_MULTICAST +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Compiler/platform provides the sockio.h file. +#define ACE_HAS_SYS_SOCKIO_H + +// Defines the page size of the system. +#define ACE_HAS_GETPAGESIZE + +// Platform provides header. +#define ACE_HAS_SYS_FILIO_H + +// Platform/compiler supports timezone * as second parameter to gettimeofday(). +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSV_MSQ_PROTOS +#define ACE_HAS_MSG +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_NONCONST_MSGSND + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#if ACE_MT_SAFE == 1 +// Yes, we do have threads. +# define ACE_HAS_THREADS +// And they're even POSIX pthreads +# define ACE_HAS_PTHREADS +# define ACE_HAS_PTHREAD_SCHEDPARAM +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +#endif /* ACE_MT_SAFE == 1 */ + +# define ACE_LACKS_THREAD_PROCESS_SCOPING + +#define ACE_HAS_DIRENT +#define ACE_LACKS_POLL_H +#define ACE_LACKS_SEARCH_H + +#define ACE_LACKS_SETSCHED +//#define ACE_HAS_RECURSIVE_MUTEXES + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +#define ACE_HAS_SEMUN +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_GETIFADDRS +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_UNNAMED_SEMAPHORE + +// dlcompat package (not part of base Darwin) is needed for dlopen(). +// You may download directly from sourceforge and install or use fink +// Fink installer puts libraries in /sw/lib and headers in /sw/include +// In order to install dlcompat do the following: +// - download fink from http://fink.sf.net +// - type: +// fink install dlcompat +// as of Dec 2002, if you use fink you will need to uncomment the next line +//#define ACE_NEEDS_DL_UNDERSCORE +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH") +#define ACE_DLL_SUFFIX ACE_TEXT (".dylib") +//#define ACE_LACKS_DLCLOSE + +// gperf seems to need this +//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) +#error "Compiler must be upgraded, see http://developer.apple.com" +#endif /* __APPLE_CC__ */ + +#endif /* ACE_CONFIG_MACOSX_H */ diff --git a/externals/ace/config-macosx-snowleopard.h b/externals/ace/config-macosx-snowleopard.h new file mode 100644 index 0000000..f9b3522 --- /dev/null +++ b/externals/ace/config-macosx-snowleopard.h @@ -0,0 +1,10 @@ +// $Id: config-macosx-snowleopard.h 87236 2009-10-27 08:21:42Z wotte $ +#ifndef ACE_CONFIG_MACOSX_SNOWLEOPARD_H +#define ACE_CONFIG_MACOSX_SNOWLEOPARD_H + +#include "ace/config-macosx-leopard.h" + +// This header has been deprecated in Snow Leopard. +#define ACE_LACKS_UCONTEXT_H + +#endif ACE_CONFIG_MACOSX_SNOWLEOPARD_H diff --git a/externals/ace/config-macosx-tiger.h b/externals/ace/config-macosx-tiger.h new file mode 100644 index 0000000..f3d1ddc --- /dev/null +++ b/externals/ace/config-macosx-tiger.h @@ -0,0 +1,213 @@ +/* -*- C++ -*- */ +// $Id: config-macosx-tiger.h 87167 2009-10-19 19:33:53Z olli $ + +// This configuration file is designed to work with the MacOS X operating system. + +#ifndef ACE_CONFIG_MACOSX_TIGER_H +#define ACE_CONFIG_MACOSX_TIGER_H + +#if ! defined (__ACE_INLINE__) +#define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#if !defined (ACE_SIZEOF_LONG_DOUBLE) +# if (__GNUC__ == 3 && __GNUC_MINOR__ == 3) + // Size of long double in GCC 3.3 is 8. +# define ACE_SIZEOF_LONG_DOUBLE 8 +# else // Else, the compiler is GCC4 + // For GCC4, the size is 16. +# define ACE_SIZEOF_LONG_DOUBLE 16 +# endif // GCC 3.3 +#endif // ACE_SIZEOF_LONG_DOUBLE + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" + +#if !defined (__i386__) +# if defined (ACE_HAS_PENTIUM) +# undef ACE_HAS_PENTIUM +# endif /* ACE_HAS_PENTIUM */ +#else // __i386__ +# define ACE_HAS_PENTIUM +#endif //__i386__ + +#if !defined (_THREAD_SAFE) +#define _THREAD_SAFE +#endif /* _THREAD_SAFE */ + +#define ACE_HAS_GPERF +#define ACE_HAS_POSIX_SEM + +#define ACE_HAS_SUNOS4_GETTIMEOFDAY + +#define ACE_LACKS_STROPTS_H + +// Wcharness.... +#define ACE_HAS_WCHAR +#define ACE_SIZEOF_WCHAR 4 + + +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_WCSDUP + +// Mac lacks the following pthread features +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_CONDATTR_PSHARED +// +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler/platform supports SVR4 signal typedef +#define ACE_HAS_SVR4_SIGNAL_T + +//Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +#define ACE_HAS_AIO_CALLS + +//Platform supports sigsuspend() +#define ACE_HAS_SIGSUSPEND + +#define ACE_LACKS_GETPGID +#define ACE_LACKS_RWLOCK_T + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_NEEDS_SCHED_H + +// Use of is deprecated. +#define ACE_LACKS_MALLOC_H + +#define ACE_HAS_ALT_CUSERID + +// Platform supports POSIX timers via struct timespec. +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_UALARM + +// Platform defines struct timespec but not timespec_t +#define ACE_LACKS_TIMESPEC_T + +#define ACE_LACKS_STRRECVFD + +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Compiler/platform supports alloca(). +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA + +// Compiler/platform correctly calls init()/fini() for shared libraries. +#define ACE_HAS_AUTOMATIC_INIT_FINI + +// platform supports POSIX O_NONBLOCK semantics +#define ACE_HAS_POSIX_NONBLOCK + +// platform supports IP multicast +#define ACE_HAS_IP_MULTICAST +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Compiler/platform provides the sockio.h file. +#define ACE_HAS_SYS_SOCKIO_H + +// Compiler/platform provides the socklen_t type. +#define ACE_HAS_SOCKLEN_T + +// Defines the page size of the system. +#define ACE_HAS_GETPAGESIZE + +// Platform provides header. +#define ACE_HAS_SYS_FILIO_H + +// Platform/compiler supports timezone * as second parameter to gettimeofday(). +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSV_MSQ_PROTOS +#define ACE_HAS_MSG +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_NONCONST_MSGSND + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#if ACE_MT_SAFE == 1 +// Yes, we do have threads. +# define ACE_HAS_THREADS +// And they're even POSIX pthreads +# define ACE_HAS_PTHREADS +# define ACE_HAS_PTHREAD_SCHEDPARAM +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +#endif /* ACE_MT_SAFE == 1 */ + +#define ACE_LACKS_THREAD_PROCESS_SCOPING + +#define ACE_HAS_DIRENT +#define ACE_LACKS_POLL_H +#define ACE_LACKS_SEARCH_H + +#define ACE_LACKS_SETSCHED +//#define ACE_HAS_RECURSIVE_MUTEXES + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +#define ACE_HAS_SEMUN +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_GETIFADDRS +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_UNNAMED_SEMAPHORE + +// dlcompat package (not part of base Darwin) is needed for dlopen(). +// You may download directly from sourceforge and install or use fink +// Fink installer puts libraries in /sw/lib and headers in /sw/include +// In order to install dlcompat do the following: +// - download fink from http://fink.sf.net +// - type: +// fink install dlcompat +// as of Dec 2002, if you use fink you will need to uncomment the next line +// #define ACE_NEEDS_DL_UNDERSCORE +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH") +#define ACE_DLL_SUFFIX ACE_TEXT (".dylib") +//#define ACE_LACKS_DLCLOSE + +// gperf seems to need this +//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#define ACE_LACKS_UNSETENV +#define ACE_LACKS_ISCTYPE + +#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) +#error "Compiler must be upgraded, see http://developer.apple.com" +#endif /* __APPLE_CC__ */ + +#endif /* ACE_CONFIG_MACOSX_TIGER_H */ diff --git a/externals/ace/config-macosx.h b/externals/ace/config-macosx.h new file mode 100644 index 0000000..ae2552f --- /dev/null +++ b/externals/ace/config-macosx.h @@ -0,0 +1,182 @@ +/* -*- C++ -*- */ +// $Id: config-macosx.h 87167 2009-10-19 19:33:53Z olli $ + +// This configuration file is designed to work with the MacOS X operating system, version 10.2 (Jaguar). + +#ifndef ACE_CONFIG_MACOSX_H +#define ACE_CONFIG_MACOSX_H + +#if ! defined (__ACE_INLINE__) +#define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" + +#if defined (ACE_HAS_PENTIUM) +# undef ACE_HAS_PENTIUM +#endif /* ACE_HAS_PENTIUM */ + +#if !defined (_THREAD_SAFE) +#define _THREAD_SAFE +#endif /* _THREAD_SAFE */ + +#define ACE_HAS_GPERF +#define ACE_HAS_POSIX_SEM + +//#define ACE_HAS_SVR4_TLI + +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_WCHAR_H + +#define ACE_SYS_SELECT_NEEDS_UNISTD_H + +// +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler/platform supports SVR4 signal typedef +#define ACE_HAS_SVR4_SIGNAL_T + +//Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +//Platform supports sigsuspend() +#define ACE_HAS_SIGSUSPEND + +//#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_LACKS_GETPGID +#define ACE_LACKS_RWLOCK_T + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_HAS_SYSCTL + +#define ACE_NEEDS_SCHED_H + +// Use of is deprecated. +#define ACE_LACKS_MALLOC_H + +#define ACE_HAS_ALT_CUSERID + +// Platform supports POSIX timers via struct timespec. +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_UALARM + +// Platform defines struct timespec but not timespec_t +#define ACE_LACKS_TIMESPEC_T + +#define ACE_LACKS_STRRECVFD + +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +//#define ACE_HAS_SYSV_IPC + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Compiler/platform supports alloca(). +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA + +// Compiler/platform correctly calls init()/fini() for shared libraries. +#define ACE_HAS_AUTOMATIC_INIT_FINI + +// Explicit dynamic linking permits "lazy" symbol resolution +//#define ACE_HAS_RTLD_LAZY_V + +// platform supports POSIX O_NONBLOCK semantics +#define ACE_HAS_POSIX_NONBLOCK + +// platform supports IP multicast +#define ACE_HAS_IP_MULTICAST +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Compiler/platform provides the sockio.h file. +#define ACE_HAS_SYS_SOCKIO_H + +// Defines the page size of the system. +#define ACE_HAS_GETPAGESIZE + +// Platform provides header. +#define ACE_HAS_SYS_FILIO_H + +// Platform/compiler supports timezone * as second parameter to gettimeofday(). +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSV_MSQ_PROTOS +#define ACE_HAS_MSG +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_NONCONST_MSGSND + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#if ACE_MT_SAFE == 1 +// Yes, we do have threads. +# define ACE_HAS_THREADS +// And they're even POSIX pthreads +# define ACE_HAS_PTHREADS +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +# define ACE_LACKS_THREAD_PROCESS_SCOPING +#endif /* ACE_MT_SAFE == 1 */ + +#define ACE_HAS_DIRENT +#define ACE_LACKS_POLL_H +#define ACE_LACKS_SEARCH_H + +#define ACE_LACKS_SETSCHED +//#define ACE_HAS_RECURSIVE_MUTEXES + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +#define ACE_HAS_SEMUN +#define ACE_HAS_SIGINFO_T +#define ACE_LACKS_SIGINFO_H +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_GETIFADDRS +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_UNNAMED_SEMAPHORE + +// dlcompat package (not part of base Darwin) is needed for dlopen(). +// You may download directly from sourceforge and install or use fink +// Fink installer puts libraries in /sw/lib and headers in /sw/include +// In order to install dlcompat do the following: +// - download fink from http://fink.sf.net +// - type: +// fink install dlcompat +// as of Dec 2002, if you use fink you will need to uncomment the next line +//#define ACE_NEEDS_DL_UNDERSCORE +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH") +#define ACE_DLL_SUFFIX ACE_TEXT (".dylib") +#define ACE_LACKS_DLCLOSE + +// gperf seems to need this +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) +#error "Compiler must be upgraded, see http://developer.apple.com" +#endif /* __APPLE_CC__ */ + +#endif /* ACE_CONFIG_MACOSX_H */ diff --git a/externals/ace/config-macros.h b/externals/ace/config-macros.h new file mode 100644 index 0000000..96a385e --- /dev/null +++ b/externals/ace/config-macros.h @@ -0,0 +1,651 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file config-macros.h + * + * $Id: config-macros.h 88485 2010-01-12 13:36:59Z schmidt $ + * + * @author (Originally in OS.h)Doug Schmidt + * @author Jesper S. M|ller + * @author and a cast of thousands... + * + * This file contains the contents of the old config-lite.h header + * without C++ code (except for C++ code in macros). Specifically, + * only macros or C language constructs are found in this header. + * Allows configuration values and macros to be used by some C + * language sources. + */ +//========================================================================== + +#ifndef ACE_CONFIG_MACROS_H +#define ACE_CONFIG_MACROS_H + +#include "ace/config.h" + +#include "ace/Version.h" +#include "ace/Versioned_Namespace.h" + +// ACE_HAS_TLI is used to decide whether to try any XTI/TLI functionality +// so if it isn't set, set it. Capabilities and differences between +// XTI and TLI favor XTI, but when deciding to do anything, as opposed to +// ACE_NOTSUP_RETURN for example, ACE_HAS_TLI is the deciding factor. +#if !defined (ACE_HAS_TLI) +# if defined (ACE_HAS_XTI) +# define ACE_HAS_TLI +# endif /* ACE_HAS_XTI */ +#endif /* ACE_HAS_TLI */ + +#define ACE_BITS_PER_ULONG (8 * sizeof (u_long)) + +#if !defined (ACE_OSTREAM_TYPE) +# if defined (ACE_LACKS_IOSTREAM_TOTALLY) +# define ACE_OSTREAM_TYPE FILE +# else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +# define ACE_OSTREAM_TYPE ostream +# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +#endif /* ! ACE_OSTREAM_TYPE */ + +#if !defined (ACE_DEFAULT_LOG_STREAM) +# if defined (ACE_LACKS_IOSTREAM_TOTALLY) +# define ACE_DEFAULT_LOG_STREAM 0 +# else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +# define ACE_DEFAULT_LOG_STREAM (&cerr) +# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +#endif /* ! ACE_DEFAULT_LOG_STREAM */ + +// These two are only for backward compatibility. You should avoid +// using them if not necessary. +#if !defined (ACE_LACKS_DEPRECATED_MACROS) +/** + * @deprecated The ACE_SYNCH_1 macro is deprecated + */ +# define ACE_SYNCH_1 ACE_SYNCH_DECL +/** + * @deprecated The ACE_SYNCH_2 macro is deprecated + */ +# define ACE_SYNCH_2 ACE_SYNCH_USE +#endif + +// For Win32 compatibility... +# if !defined (ACE_WSOCK_VERSION) +# define ACE_WSOCK_VERSION 0, 0 +# endif /* ACE_WSOCK_VERSION */ + +# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +# define ACE_MT(X) X +# if !defined (_REENTRANT) +# define _REENTRANT +# endif /* _REENTRANT */ +# else +# define ACE_MT(X) +# endif /* ACE_MT_SAFE */ + +# if defined (ACE_HAS_PURIFY) +# define ACE_INITIALIZE_MEMORY_BEFORE_USE +# endif /* ACE_HAS_PURIFY */ + +# if defined (ACE_HAS_VALGRIND) +# define ACE_INITIALIZE_MEMORY_BEFORE_USE +# endif /* ACE_HAS_VALGRIND */ + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) +/** + * @deprecated The @c ACE_HAS_USING macros are deprecated + */ +# define ACE_USING using +#endif /* !ACE_LACKS_DEPRECATED_MACROS */ + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) +/** + * @deprecated The @c ACE_TYPENAME macros is deprecated. Use standard + * C++ keyword typename instead. + */ +# define ACE_TYPENAME typename +#endif /* !ACE_LACKS_DEPRECATED_MACROS */ + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) +/** + * @deprecated The @c ACE_TEMPLATE_SPECIALIZATION and + * @c ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION macros are + * deprecated. Use standard C++ template specialization + * syntax instead. + */ +# define ACE_TEMPLATE_SPECIALIZATION template<> +# define ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION +#endif /* !ACE_LACKS_DEPRECATED_MACROS */ + +// ========================================================================= +// Perfect Multicast filting refers to RFC 3376, where a socket is only +// delivered dgrams for groups joined even if it didn't bind the group +// address. We turn this option off by default, although most OS's +// except for Windows and Solaris probably lack perfect filtering. +// ========================================================================= + +# if !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 0 +# endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ + +// ========================================================================= +// Enable/Disable Features By Default +// ========================================================================= + +# if !defined (ACE_HAS_POSITION_INDEPENDENT_POINTERS) +# define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 +# endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */ + +# if !defined (ACE_HAS_PROCESS_SPAWN) +# if !defined (ACE_LACKS_FORK) || \ + (defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)) || \ + defined (ACE_WINCE) || defined (ACE_OPENVMS) +# define ACE_HAS_PROCESS_SPAWN 1 +# endif +# endif /* ACE_HAS_PROCESS_SPAWN */ + +# if !defined (ACE_HAS_DYNAMIC_LINKING) +# if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) || defined (ACE_WIN32) || defined (ACE_VXWORKS) || defined (__hpux) +# define ACE_HAS_DYNAMIC_LINKING 1 +# endif +# endif /* ACE_HAS_DYNAMIC_LINKING */ + +# if defined (ACE_USES_FIFO_SEM) +# if defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_MKFIFO) || defined (ACE_LACKS_FCNTL) +# undef ACE_USES_FIFO_SEM +# endif +# endif /* ACE_USES_FIFO_SEM */ + +// ========================================================================= +// RCSID Macros +// ========================================================================= + +// By default, DO NOT include RCS Id strings in object code. +#if ! defined (ACE_USE_RCSID) +# define ACE_USE_RCSID 0 +#endif /* #if ! defined (ACE_USE_RCSID) */ + +#if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0)) +# if ! defined (ACE_RCSID) + + // This hack has the following purposes: + // 1. To define the RCS id string variable as a static char*, so + // that there won't be any duplicate extern symbols at link + // time. + // 2. To have a RCS id string variable with a unique name for each + // file. + // 3. To avoid warnings of the type "variable declared and never + // used". + +# define ACE_RCSID(path, file, id) \ + static inline const char* get_rcsid_ ## path ## _ ## file (const char*) \ + { \ + return id ; \ + } \ + static const char* rcsid_ ## path ## _ ## file = \ + get_rcsid_ ## path ## _ ## file ( rcsid_ ## path ## _ ## file ) ; + +# endif /* #if ! defined (ACE_RCSID) */ +#else + + // RCS id strings are not wanted. +# if defined (ACE_RCSID) +# undef ACE_RCSID +# endif /* #if defined (ACE_RCSID) */ +# define ACE_RCSID(path, file, id) /* noop */ +#endif /* #if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0)) */ + +// ========================================================================= +// INLINE macros +// +// These macros handle all the inlining of code via the .i or .inl files +// ========================================================================= + +#if defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) +# define ACE_NO_INLINE +#endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */ + +// ACE inlining has been explicitly disabled. Implement +// internally within ACE by undefining __ACE_INLINE__. +#if defined (ACE_NO_INLINE) +# undef __ACE_INLINE__ +#endif /* ! ACE_NO_INLINE */ + +#if defined (__ACE_INLINE__) +# define ACE_INLINE inline +# if !defined (ACE_HAS_INLINED_OSCALLS) +# define ACE_HAS_INLINED_OSCALLS +# endif /* !ACE_HAS_INLINED_OSCALLS */ +#else +# define ACE_INLINE +#endif /* __ACE_INLINE__ */ + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + // ========================================================================= + // EXPLICIT macro + // ========================================================================= + + /** + * @deprecated explicit is deprecated. ACE requires C++ + * "explicit" keyword support. + */ + # define ACE_EXPLICIT explicit +#endif /* ACE_LACKS_DEPRECATED_MACROS */ + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + // ========================================================================= + // MUTABLE macro + // ========================================================================= + + /** + * @deprecated ACE_MUTABLE is deprecated. ACE requires C++ "mutable" + * keyword support. + */ + # define ACE_MUTABLE mutable + # define ACE_CONST_WHEN_MUTABLE const +#endif /* ACE_LACKS_DEPRECATED_MACROS */ + +// ============================================================================ +// EXPORT macros +// +// Since Win32 DLL's do not export all symbols by default, they must be +// explicitly exported (which is done by *_Export macros). +// ============================================================================ + +// Win32 should have already defined the macros in config-win32-common.h +#if !defined (ACE_HAS_CUSTOM_EXPORT_MACROS) +# define ACE_Proper_Export_Flag +# define ACE_Proper_Import_Flag +# define ACE_EXPORT_SINGLETON_DECLARATION(T) +# define ACE_IMPORT_SINGLETON_DECLARATION(T) +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#else +// An export macro should at the very least have been defined. + +# ifndef ACE_Proper_Import_Flag +# define ACE_Proper_Import_Flag +# endif /* !ACE_Proper_Import_Flag */ + +# ifndef ACE_EXPORT_SINGLETON_DECLARATION +# define ACE_EXPORT_SINGLETON_DECLARATION(T) +# endif /* !ACE_EXPORT_SINGLETON_DECLARATION */ + +# ifndef ACE_IMPORT_SINGLETON_DECLARATION +# define ACE_IMPORT_SINGLETON_DECLARATION(T) +# endif /* !ACE_IMPORT_SINGLETON_DECLARATION */ + +# ifndef ACE_EXPORT_SINGLETON_DECLARE +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* !ACE_EXPORT_SINGLETON_DECLARE */ + +# ifndef ACE_IMPORT_SINGLETON_DECLARE +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* !ACE_IMPORT_SINGLETON_DECLARE */ + +#endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ + +// This is a whim of mine -- that instead of annotating a class with +// ACE_Export in its declaration, we make the declaration near the TOP +// of the file with ACE_DECLARE_EXPORT. +// TS = type specifier (e.g., class, struct, int, etc.) +// ID = identifier +// So, how do you use it? Most of the time, just use ... +// ACE_DECLARE_EXPORT(class, someobject); +// If there are global functions to be exported, then use ... +// ACE_DECLARE_EXPORT(void, globalfunction) (int, ...); +// Someday, when template libraries are supported, we made need ... +// ACE_DECLARE_EXPORT(template class, sometemplate) ; +# define ACE_DECLARE_EXPORT(TS,ID) TS ACE_Export ID + +// ============================================================================ +// Cast macros +// +// These macros are used to choose between the old cast style and the new +// *_cast<> operators +// ============================================================================ + +# define ACE_sap_any_cast(TYPE) reinterpret_cast (const_cast (ACE_Addr::sap_any)) + +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + /** + * @deprecated ACE_{static,reinterpret,dynamic,const}_cast@<@> is + * deprecated. Directly use standard C++ casts instead. + */ + # define ACE_static_cast(TYPE, EXPR) static_cast (EXPR) + # define ACE_static_cast_1_ptr(TYPE, T1, EXPR) static_cast *> (EXPR) + # define ACE_static_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast *> (EXPR) + # define ACE_static_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast *> (EXPR) + # define ACE_static_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast *> (EXPR) + # define ACE_static_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast *> (EXPR) + # define ACE_static_cast_1_ref(TYPE, T1, EXPR) static_cast &> (EXPR) + # define ACE_static_cast_2_ref(TYPE, T1, T2, EXPR) static_cast &> (EXPR) + # define ACE_static_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast &> (EXPR) + # define ACE_static_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast &> (EXPR) + # define ACE_static_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast &> (EXPR) + + # define ACE_const_cast(TYPE, EXPR) const_cast (EXPR) + # define ACE_const_cast_1_ptr(TYPE, T1, EXPR) const_cast *> (EXPR) + # define ACE_const_cast_2_ptr(TYPE, T1, T2, EXPR) const_cast *> (EXPR) + # define ACE_const_cast_3_ptr(TYPE, T1, T2, T3, EXPR) const_cast *> (EXPR) + # define ACE_const_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) const_cast *> (EXPR) + # define ACE_const_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast *> (EXPR) + # define ACE_const_cast_1_ref(TYPE, T1, EXPR) const_cast &> (EXPR) + # define ACE_const_cast_2_ref(TYPE, T1, T2, EXPR) const_cast &> (EXPR) + # define ACE_const_cast_3_ref(TYPE, T1, T2, T3, EXPR) const_cast &> (EXPR) + # define ACE_const_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) const_cast &> (EXPR) + # define ACE_const_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast &> (EXPR) + + # define ACE_reinterpret_cast(TYPE, EXPR) reinterpret_cast (EXPR) + # define ACE_reinterpret_cast_1_ptr(TYPE, T1, EXPR) reinterpret_cast *> (EXPR) + # define ACE_reinterpret_cast_2_ptr(TYPE, T1, T2, EXPR) reinterpret_cast *> (EXPR) + # define ACE_reinterpret_cast_3_ptr(TYPE, T1, T2, T3, EXPR) reinterpret_cast *> (EXPR) + # define ACE_reinterpret_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast *> (EXPR) + # define ACE_reinterpret_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast *> (EXPR) + # define ACE_reinterpret_cast_1_ref(TYPE, T1, EXPR) reinterpret_cast &> (EXPR) + # define ACE_reinterpret_cast_2_ref(TYPE, T1, T2, EXPR) reinterpret_cast &> (EXPR) + # define ACE_reinterpret_cast_3_ref(TYPE, T1, T2, T3, EXPR) reinterpret_cast &> (EXPR) + # define ACE_reinterpret_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast &> (EXPR) + # define ACE_reinterpret_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast &> (EXPR) + + # define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast (EXPR) + # define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) dynamic_cast *> (EXPR) + # define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) dynamic_cast *> (EXPR) + # define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) dynamic_cast *> (EXPR) + # define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast *> (EXPR) + # define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast *> (EXPR) + # define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) dynamic_cast &> (EXPR) + # define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) dynamic_cast &> (EXPR) + # define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) dynamic_cast &> (EXPR) + # define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast &> (EXPR) + # define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast &> (EXPR) +#endif /* ACE_LACKS_DEPRECATED_MACROS */ + +# if !defined (ACE_CAST_CONST) + // Sun CC 4.2, for example, requires const in reinterpret casts of + // data members in const member functions. But, other compilers + // complain about the useless const. This keeps everyone happy. +# if defined (__SUNPRO_CC) +# define ACE_CAST_CONST const +# else /* ! __SUNPRO_CC */ +# define ACE_CAST_CONST +# endif /* ! __SUNPRO_CC */ +# endif /* ! ACE_CAST_CONST */ + +// ============================================================================ +// Compiler Silencing macros +// +// Some compilers complain about parameters that are not used. This macro +// should keep them quiet. +// ============================================================================ + +#if !defined (ACE_UNUSED_ARG) +# if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) +# define ACE_UNUSED_ARG(a) (void) (a) +# elif defined (__GNUC__) || defined (ghs) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (ACE_RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) +// Some compilers complain about "statement with no effect" with (a). +// This eliminates the warnings, and no code is generated for the null +// conditional statement. @note that may only be true if -O is enabled, +// such as with GreenHills (ghs) 1.8.8. +# define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0) +# elif defined (__DMC__) + #define ACE_UNUSED_ID(identifier) + template + inline void ACE_UNUSED_ARG(const T& ACE_UNUSED_ID(t)) { } +# else /* ghs || __GNUC__ || ..... */ +# define ACE_UNUSED_ARG(a) (a) +# endif /* ghs || __GNUC__ || ..... */ +#endif /* !ACE_UNUSED_ARG */ + +#if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (ACE_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC < 40000 || __HP_aCC >= 60500)) +# define ACE_NOTREACHED(a) +#else /* __sgi || ghs || ..... */ +# define ACE_NOTREACHED(a) a +#endif /* __sgi || ghs || ..... */ + +// ============================================================================ +// ACE_ALLOC_HOOK* macros +// +// Macros to declare and define class-specific allocation operators. +// ============================================================================ + +# if defined (ACE_HAS_ALLOC_HOOKS) +# define ACE_ALLOC_HOOK_DECLARE \ + void *operator new (size_t bytes); \ + void operator delete (void *ptr); + + // Note that these are just place holders for now. Some day they + // may be be replaced by . +# define ACE_ALLOC_HOOK_DEFINE(CLASS) \ + void *CLASS::operator new (size_t bytes) { return ::new char[bytes]; } \ + void CLASS::operator delete (void *ptr) { delete [] ((char *) ptr); } +# else +# define ACE_ALLOC_HOOK_DECLARE struct __Ace {} /* Just need a dummy... */ +# define ACE_ALLOC_HOOK_DEFINE(CLASS) +# endif /* ACE_HAS_ALLOC_HOOKS */ + +// ============================================================================ +/** + * ACE_OSCALL* macros + * + * @deprecated ACE_OSCALL_RETURN and ACE_OSCALL should not be used. + * Please restart system calls in your application code. + * See the @c sigaction(2) man page for documentation + * regarding enabling restartable system calls across + * signals via the @c SA_RESTART flag. + * + * The following two macros used ensure that system calls are properly + * restarted (if necessary) when interrupts occur. However, that + * capability was never enabled by any of our supported platforms. + * In fact, some parts of ACE would not function properly when that + * ability was enabled. Furthermore, they assumed that ability to + * restart system calls was determined statically. That assumption + * does not hold for modern platforms, where that ability is + * determined dynamically at run-time. + */ +// ============================================================================ + +#define ACE_OSCALL_RETURN(X,TYPE,FAILVALUE) \ + do \ + return (TYPE) (X); \ + while (0) +#define ACE_OSCALL(X,TYPE,FAILVALUE,RESULT) \ + do \ + RESULT = (TYPE) (X); \ + while (0) + +#if defined (ACE_WIN32) +# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ + do { \ + TYPE ace_result_; \ + ace_result_ = (TYPE) X; \ + if (ace_result_ == FAILVALUE) \ + ACE_OS::set_errno_to_last_error (); \ + return ace_result_; \ + } while (0) +# define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \ + do { \ + RESULT = (TYPE) X; \ + if (RESULT == FAILVALUE) \ + ACE_OS::set_errno_to_last_error (); \ + } while (0) +#endif /* ACE_WIN32 */ + +// The C99 security-improved run-time returns an error value on failure; +// 0 on success. +#if defined (ACE_HAS_TR24731_2005_CRT) +# define ACE_SECURECRTCALL(X,TYPE,FAILVALUE,RESULT) \ + do { \ + errno_t ___ = X; \ + if (___ != 0) { errno = ___; RESULT = FAILVALUE; } \ + } while (0) +#endif /* ACE_HAS_TR24731_2005_CRT */ + +// ============================================================================ +// Fundamental types +// ============================================================================ + +#if defined (ACE_WIN32) + +typedef HANDLE ACE_HANDLE; +typedef SOCKET ACE_SOCKET; +# define ACE_INVALID_HANDLE INVALID_HANDLE_VALUE + +#else /* ! ACE_WIN32 */ + +typedef int ACE_HANDLE; +typedef ACE_HANDLE ACE_SOCKET; +# define ACE_INVALID_HANDLE -1 + +#endif /* ACE_WIN32 */ + +// Define the type that's returned from the platform's native thread +// functions. ACE_THR_FUNC_RETURN is the type defined as the thread +// function's return type, except when the thread function doesn't return +// anything (pSoS). The ACE_THR_FUNC_NO_RETURN_VAL macro is used to +// indicate that the actual thread function doesn't return anything. The +// rest of ACE uses a real type so there's no a ton of conditional code +// everywhere to deal with the possibility of no return type. +# if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) +# include /**/ +typedef int ACE_THR_FUNC_RETURN; +#define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN +# elif defined (ACE_WIN32) +typedef DWORD ACE_THR_FUNC_RETURN; +#define ACE_HAS_INTEGRAL_TYPE_THR_FUNC_RETURN +# else +typedef void* ACE_THR_FUNC_RETURN; +# endif /* ACE_VXWORKS */ +typedef ACE_THR_FUNC_RETURN (*ACE_THR_FUNC)(void *); + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +typedef void (*ACE_THR_C_DEST)(void *); +#ifdef __cplusplus +} +#endif /* __cplusplus */ +typedef void (*ACE_THR_DEST)(void *); + +// Now some platforms have special requirements... +# if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) +typedef FUNCPTR ACE_THR_FUNC_INTERNAL; // where typedef int (*FUNCPTR) (...) +# else +typedef ACE_THR_FUNC ACE_THR_FUNC_INTERNAL; +# endif /* ACE_VXWORKS */ + +# ifdef __cplusplus +extern "C" +{ +# endif /* __cplusplus */ +# if defined (ACE_VXWORKS) && !defined (ACE_HAS_PTHREADS) +typedef FUNCPTR ACE_THR_C_FUNC; // where typedef int (*FUNCPTR) (...) +# else +typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC)(void *); +# endif /* ACE_VXWORKS */ +# ifdef __cplusplus +} +# endif /* __cplusplus */ + +// ============================================================================ +// Macros for controlling the lifetimes of dlls loaded by ACE_DLL--including +// all dlls loaded via the ACE Service Config framework. +// +// Please don't change these values or add new ones wantonly, since we use +// the ACE_BIT_ENABLED, etc..., macros to test them. +// ============================================================================ + +// Per-process policy that unloads dlls eagerly. +#define ACE_DLL_UNLOAD_POLICY_PER_PROCESS 0 +// Apply policy on a per-dll basis. If the dll doesn't use one of the macros +// below, the current per-process policy will be used. +#define ACE_DLL_UNLOAD_POLICY_PER_DLL 1 +// Don't unload dll when refcount reaches zero, i.e., wait for either an +// explicit unload request or program exit. +#define ACE_DLL_UNLOAD_POLICY_LAZY 2 +// Default policy allows dlls to control their own destinies, but will +// unload those that don't make a choice eagerly. +#define ACE_DLL_UNLOAD_POLICY_DEFAULT ACE_DLL_UNLOAD_POLICY_PER_DLL + +// Add this macro you one of your cpp file in your dll. X should +// be either ACE_DLL_UNLOAD_POLICY_DEFAULT or ACE_DLL_UNLOAD_POLICY_LAZY. +#define ACE_DLL_UNLOAD_POLICY(CLS,X) \ +extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \ + { return X;} + +// ============================================================================ +// ACE_USES_CLASSIC_SVC_CONF macro +// ============================================================================ + +// For now, default is to use the classic svc.conf format. +#if !defined (ACE_USES_CLASSIC_SVC_CONF) +# if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF) +# error You can only use either CLASSIC or XML svc.conf, not both. +# endif +// Change the ACE_HAS_XML_SVC_CONF to ACE_HAS_CLASSIC_SVC_CONF when +// we switch ACE to use XML svc.conf as default format. +# if defined (ACE_HAS_XML_SVC_CONF) +# define ACE_USES_CLASSIC_SVC_CONF 0 +# else +# define ACE_USES_CLASSIC_SVC_CONF 1 +# endif /* ACE_HAS_XML_SVC_CONF */ +#endif /* ACE_USES_CLASSIC_SVC_CONF */ + +// ============================================================================ +// Default svc.conf file extension. +// ============================================================================ +#if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF_EXT ".conf" +#else +# define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml" +#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ + +// ============================================================================ +// Miscellaneous macros +// ============================================================================ + +#if defined (ACE_USES_EXPLICIT_STD_NAMESPACE) +# define ACE_STD_NAMESPACE std +#else +# define ACE_STD_NAMESPACE +#endif + +#if !defined (ACE_OS_String) +# define ACE_OS_String ACE_OS +#endif /* ACE_OS_String */ +#if !defined (ACE_OS_Memory) +# define ACE_OS_Memory ACE_OS +#endif /* ACE_OS_Memory */ +#if !defined (ACE_OS_Dirent) +# define ACE_OS_Dirent ACE_OS +#endif /* ACE_OS_Dirent */ +#if !defined (ACE_OS_TLI) +# define ACE_OS_TLI ACE_OS +#endif /* ACE_OS_TLI */ + +// ------------------------------------------------------------------- +// Preprocessor symbols will not be expanded if they are +// concatenated. Force the preprocessor to expand them during the +// argument prescan by calling a macro that itself calls another that +// performs the actual concatenation. +#define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B +#define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B) +// ------------------------------------------------------------------- + +/// If MPC is using a lib modifier this define will be set and this then +/// is used by the service configurator framework +#if defined MPC_LIB_MODIFIER && !defined (ACE_LD_DECORATOR_STR) +#define ACE_LD_DECORATOR_STR ACE_TEXT( MPC_LIB_MODIFIER ) +#endif /* MPC_LIB_MODIFIER */ + +#ifndef ACE_GCC_CONSTRUCTOR_ATTRIBUTE +# define ACE_GCC_CONSTRUCTOR_ATTRIBUTE +#endif + +#ifndef ACE_GCC_DESTRUCTOR_ATTRIBUTE +# define ACE_GCC_DESTRUCTOR_ATTRIBUTE +#endif + +#ifndef ACE_DEPRECATED +# define ACE_DEPRECATED +#endif + +#endif /* ACE_CONFIG_MACROS_H */ diff --git a/externals/ace/config-minimal.h b/externals/ace/config-minimal.h new file mode 100644 index 0000000..4cf2e8a --- /dev/null +++ b/externals/ace/config-minimal.h @@ -0,0 +1,39 @@ +/* -*- C++ -*- */ +// $Id: config-minimal.h 80826 2008-03-04 14:51:23Z wotte $ + +// This configuration file is designed to build only the minimal +// ACE_OS adaptation layer. + +#ifndef ACE_CONFIG_MINIMAL_H +#define ACE_CONFIG_MINIMAL_H +#include /**/ "ace/pre.h" + +#define ACE_HAS_MINIMAL_ACE_OS + +// Only instantiate the ACE_OS_Object_Manager. +#define ACE_MAIN_OBJECT_MANAGER \ + ACE_OS_Object_Manager ace_os_object_manager; + +#if !defined(ACE_USE_THREAD_MANAGER_ADAPTER) + // To prevent use of ACE_Thread_Exit functions in + // ACE_Thread_Adapter::invoke (). +# define ACE_USE_THREAD_MANAGER_ADAPTER +#endif /* ! ACE_USE_THREAD_MANAGER_ADAPTER */ + +#if defined (ACE_ASSERT) +# undef ACE_ASSERT +#endif /* ACE_ASSERT */ +#define ACE_ASSERT(x) + +#if defined (ACE_DEBUG) +# undef ACE_DEBUG +#endif /* ACE_DEBUG */ +#define ACE_DEBUG(x) + +#if defined (ACE_ERROR) +# undef ACE_ERROR +#endif /* ACE_ERROR */ +#define ACE_ERROR(x) + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_MINIMAL_H */ diff --git a/externals/ace/config-mvs.h b/externals/ace/config-mvs.h new file mode 100644 index 0000000..3f438a7 --- /dev/null +++ b/externals/ace/config-mvs.h @@ -0,0 +1,127 @@ +/* -*- C++ -*- */ +// $Id: config-mvs.h 88495 2010-01-12 19:23:11Z olli $ + +// Config file for MVS with OpenEdition + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +// The following #defines are hacks to get around things +// that seem to be missing or different in MVS land +#define MAXPATHLEN 1024 /* sys/param.h not on MVS */ +#define NSIG 44 /* missing from Signal.h */ +#define MAXHOSTNAMELEN 256 /* missing form netdb.h */ +#define howmany __howmany /* MVS uses different names than most others */ +#define MAXNAMLEN __DIR_NAME_MAX +#if defined (log) /* log is a macro in math.h */ +# undef log /* conflicts with log function in ACE */ +#endif /* log */ + +#define ACE_MVS + +// Preprocesor requires an extra argument +#ifndef ACE_USING_MCPP_PREPROCESSOR +# define ACE_CC_PREPROCESSOR_ARGS "-+ -E" +#endif + +// See the README file in this directory +// for a description of the following ACE_ macros + +#if __COMPILER_VER__ >= 0x21020000 /* OS/390 r2 or higher */ +# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +# define ACE_HAS_UCONTEXT_T +#else /* __COMPILER_VER__ < 0x21020000 */ +# define ACE_LACKS_UCONTEXT_H +#endif /* __COMPILER_VER__ < 0x21020000 */ + +#if __COMPILER_VER__ < 0x22060000 /* before OS/390 r2.6 */ +# define ACE_LACKS_LONGLONG_T +#endif /* __COMPILER_VER__ < 0x22060000 */ + +#define ERRMAX __sys_nerr + +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_CPLUSPLUS_HEADERS +#define ACE_HAS_DIRENT +#define ACE_HAS_GETPAGESIZE +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_LIMITED_RUSAGE_T +#define ACE_HAS_MSG +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONSCALAR_THREAD_KEY_T +#define ACE_HAS_POLL +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_PTHREADS +#define ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP +#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SIG_C_FUNC +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SIZET_SOCKET_LEN +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STRBUF_T +#define ACE_HAS_STRINGS +#define ACE_HAS_SYSV_IPC +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_HAS_THREADS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_THR_C_DEST +#define ACE_HAS_THR_C_FUNC +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_HAS_UALARM +#define ACE_HAS_UTIME +#define ACE_HAS_VOIDPTR_MMAP +#define ACE_HAS_VOIDPTR_SOCKOPT +#define ACE_HAS_XPG4_MULTIBYTE_CHAR + +#define ACE_LACKS_CONDATTR_PSHARED +#define ACE_LACKS_INET_ATON +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_IOSTREAM_FX +#define ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_MADVISE +#define ACE_LACKS_MALLOC_H +#define ACE_LACKS_PARAM_H +#define ACE_LACKS_SYS_PARAM_H +#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK +#define ACE_LACKS_READDIR_R +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SCHED_H +#define ACE_LACKS_SETSCHED +#define ACE_LACKS_SEMAPHORE_H +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_STDINT_H +#define ACE_LACKS_SYS_SELECT_H +#define ACE_LACKS_SYS_SYSCTL_H +#define ACE_LACKS_SYSTIME_H +#define ACE_LACKS_NETINET_TCP_H +#define ACE_LACKS_TCP_H +#define ACE_LACKS_THREAD_PROCESS_SCOPING +#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_FD_MASK + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#define ACE_NEEDS_DEV_IO_CONVERSION + +#define ACE_SIZEOF_FLOAT 4 +#define ACE_SIZEOF_DOUBLE 8 +#define ACE_SIZEOF_LONG_DOUBLE 16 +#define ACE_HAS_EBCDIC + +#define ACE_TEMPLATES_REQUIRE_SOURCE + +#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(a) IN_CLASSD(a) +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-netbsd.h b/externals/ace/config-netbsd.h new file mode 100644 index 0000000..07b26c9 --- /dev/null +++ b/externals/ace/config-netbsd.h @@ -0,0 +1,165 @@ +/* -*- C++ -*- */ +// $Id: config-netbsd.h 89494 2010-03-15 20:11:18Z olli $ + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H + +#ifndef ACE_MT_SAFE +#define ACE_MT_SAFE 1 +#endif + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + +#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +# define ACE_HAS_THREADS 1 +# define ACE_HAS_PTHREADS 1 +# define ACE_HAS_PTHREADS_UNIX98_EXT 1 +# define ACE_HAS_PTHREAD_RESUME_NP 1 +# define ACE_HAS_PTHREAD_SUSPEND_NP 1 +# define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 +# define ACE_LACKS_PTHREAD_YIELD 1 +#endif /* ACE_MT_SAFE */ + +#define ACE_HAS_CLOCK_SETTIME 1 +#define ACE_HAS_CLOCK_GETTIME 1 +#define ACE_HAS_SETTIMEOFDAY 1 +#define ACE_HAS_GETTIMEOFDAY 1 +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 +#define ACE_HAS_3_PARAM_WCSTOK 1 +#define ACE_HAS_3_PARAM_READDIR_R 1 +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG 1 +#define ACE_HAS_ALT_CUSERID 1 +#define ACE_HAS_AUTOMATIC_INIT_FINI 1 +#define ACE_HAS_CLOCK_GETTIME 1 +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 +#define ACE_HAS_DIRENT 1 +#define ACE_HAS_EXCEPTIONS 1 +#define ACE_HAS_GETIFADDRS 1 +#define ACE_HAS_GETPAGESIZE 1 +#define ACE_HAS_GETPROGNAME 1 +#define ACE_HAS_GETRUSAGE 1 +#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 +#define ACE_HAS_GPERF 1 +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 +#define ACE_HAS_IP_MULTICAST 1 +#define ACE_HAS_MSG 1 +#define ACE_HAS_NEW_NO_H 1 +#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 +#define ACE_HAS_ONLY_SCHED_OTHER 1 +#define ACE_HAS_POLL 1 +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 +#define ACE_HAS_POSIX_NONBLOCK 1 +#define ACE_HAS_POSIX_TIME 1 +#define ACE_HAS_P_READ_WRITE 1 +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 +#define ACE_HAS_REENTRANT_FUNCTIONS 1 +#define ACE_HAS_SCANDIR 1 +#define ACE_HAS_SETPROGNAME 1 +#define ACE_HAS_SIGACTION_CONSTP2 1 +#define ACE_HAS_SIGINFO_T 1 +#define ACE_HAS_SIGSUSPEND 1 +#define ACE_HAS_SIGTIMEDWAIT 1 +#define ACE_HAS_SIGWAIT 1 +#define ACE_HAS_SIG_ATOMIC_T 1 +#define ACE_HAS_SIG_C_FUNC 1 +#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN 1 +#define ACE_HAS_SOCKADDR_MSG_NAME 1 +#define ACE_HAS_SOCKLEN_T 1 +#define ACE_HAS_SSIZE_T 1 +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#define ACE_HAS_STDEXCEPT_NO_H 1 +#define ACE_HAS_STRINGS 1 +#define ACE_HAS_STRING_CLASS 1 +#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 +#define ACE_HAS_SYSV_IPC 1 +#define ACE_HAS_SYS_FILIO_H 1 +#define ACE_HAS_STRSIGNAL +#define ACE_HAS_SYS_SOCKIO_H 1 +#define ACE_HAS_SYS_SYSCALL_H 1 +#define ACE_HAS_SYSCTL +#define ACE_HAS_TERMIOS 1 +#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 +#define ACE_HAS_TIMEZONE 1 +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY 1 +#define ACE_HAS_UALARM 1 +#define ACE_HAS_UCONTEXT_T 1 +#define ACE_HAS_VOIDPTR_MMAP 1 +#define ACE_HAS_VOIDPTR_SOCKOPT 1 +#define ACE_HAS_WCHAR 1 +#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 +#define ACE_IOCTL_TYPE_ARG2 u_long +#define ACE_LACKS_CONDATTR_PSHARED 1 +#define ACE_LACKS_GETHOSTENT 1 +#define ACE_LACKS_GETIPNODEBYADDR 1 +#define ACE_LACKS_GETIPNODEBYNAME 1 +#define ACE_LACKS_IOSTREAM_FX 1 +#define ACE_LACKS_ITOW 1 +#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +#define ACE_LACKS_LOG2 1 +#define ACE_LACKS_MSG_ACCRIGHTS 1 +#define ACE_LACKS_MUTEXATTR_PSHARED 1 +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#define ACE_LACKS_PRI_T 1 +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 +#define ACE_LACKS_PTHREAD_YIELD 1 +#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1 +#define ACE_LACKS_RWLOCKATTR_PSHARED 1 +#define ACE_LACKS_RWLOCK_T 1 +#define ACE_LACKS_SETSCHED 1 +#define ACE_LACKS_SIGINFO_H 1 +#define ACE_LACKS_STROPTS_H 1 +#define ACE_LACKS_STRRECVFD 1 +#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 +#define ACE_LACKS_TIMESPEC_T 1 +#define ACE_LACKS_UNBUFFERED_STREAMBUF 1 +#define ACE_LACKS_WCSDUP 1 +#define ACE_LACKS_WCSICMP 1 +#define ACE_LACKS_WCSNICMP 1 +#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR 1 +#define ACE_LACKS_ISCTYPE + +#if defined(__x86_64__) +#define ACE_SIZEOF_DOUBLE 8 +#define ACE_SIZEOF_FLOAT 4 +#define ACE_SIZEOF_INT 4 +#define ACE_SIZEOF_LONG 8 +#define ACE_SIZEOF_LONG_DOUBLE 16 +#define ACE_SIZEOF_LONG_LONG 8 +#define ACE_SIZEOF_SHORT 2 +#define ACE_SIZEOF_VOID_P 8 +#define ACE_SIZEOF_WCHAR 4 + +typedef unsigned long ACE_UINT64; +typedef signed long ACE_INT64; + +#define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" + +#elif defined(__i386__) + +#define ACE_SIZEOF_DOUBLE 8 +#define ACE_SIZEOF_FLOAT 4 +#define ACE_SIZEOF_INT 4 +#define ACE_SIZEOF_LONG 4 +#define ACE_SIZEOF_LONG_DOUBLE 12 +#define ACE_SIZEOF_LONG_LONG 8 +#define ACE_SIZEOF_SHORT 2 +#define ACE_SIZEOF_VOID_P 4 +#define ACE_SIZEOF_WCHAR 4 + +typedef unsigned long long ACE_UINT64; +typedef signed long long ACE_INT64; + +#else +# error unknown CPU architecture +#endif + +#endif /* ACE_CONFIG_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/externals/ace/config-openbsd.h b/externals/ace/config-openbsd.h new file mode 100644 index 0000000..aab0310 --- /dev/null +++ b/externals/ace/config-openbsd.h @@ -0,0 +1,208 @@ +/* -*- C++ -*- */ +// $Id: config-openbsd.h 89494 2010-03-15 20:11:18Z olli $ + +// The following configuration file is designed to work for OpenBSD +// platforms using GNU g++. + +#ifndef ACE_CONFIG_H +# define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +// Platform specific directives +// gcc defines __OpenBSD__ automatically for us. +#include + +#if defined (ACE_HAS_THREADS) +# include /**/ +#endif /* ACE_HAS_THREADS */ + +#include "ace/config-posix.h" + +#if !defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* !__ACE_INLINE__ */ + +#if defined (__GNUG__) +# include "ace/config-g++-common.h" +#endif /* __GNUG__ */ + + +#if defined (ACE_HAS_THREADS) + +# if !defined (_THREAD_SAFE) +# define _THREAD_SAFE +# endif /* _THREAD_SAFE */ + +// And they're even POSIX pthreads +# if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +# endif /* ! ACE_MT_SAFE */ + + +// Check if pthreads and native exceptions are being used together. +// This causes SEGVs to tbe thrown somewhat randomly for some +// reason. According to newsgroup postings, it appears to be an +// OpenBSD or gcc bug. +# if defined (ACE_USES_NATIVE_EXCEPTIONS) +# error "OpenBSD pthreads and native exceptions currently do not work. See OpenBSD bug #1750" +# endif /* ACE_USES_NATIVE_EXCEPTIONS */ + +#else +// OpenBSD really has readdir_r () in single threaded mode, +// but the #ifdefs in OS.i select one with the wrong parameter +// sets if the ACE_HAS_POSIX_STD isn't defined (which is defined +// when ACE_HAS_THREADS is defined.) +# define ACE_LACKS_READDIR_R + +#endif /* ACE_HAS_THREADS */ + + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_ALLOCA +#define ACE_HAS_ALT_CUSERID +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_CHARPTR_DL +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_DIRENT +#define ACE_HAS_GETIFADDRS +#define ACE_HAS_GETPAGESIZE +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GPERF +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_ICMP_SUPPORT 1 +#define ACE_HAS_IPV6 +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_MEMCHR +#define ACE_HAS_MKDIR +#define ACE_HAS_MSG +#define ACE_HAS_NANOSLEEP +#define ACE_HAS_NEW_NO_H +#define ACE_HAS_NONCONST_MSGSND +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONCONST_SWAB +#define ACE_HAS_POLL +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 +#define ACE_HAS_POSIX_GETPWNAM_R +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_PTHREADS_STD +#define ACE_HAS_PTHREADS_UNIX98_EXT +#define ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP +#define ACE_HAS_PTHREAD_GETCONCURRENCY +#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP +#define ACE_HAS_PTHREAD_NP_H +#define ACE_HAS_PTHREAD_RESUME_NP +#define ACE_HAS_PTHREAD_SETCONCURRENCY +#define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE +#define ACE_HAS_PTHREAD_SUSPEND_NP +#define ACE_HAS_P_READ_WRITE +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_REENTRANT_FUNCTIONS +#define ACE_HAS_RTLD_LAZY_V +#define ACE_HAS_SCANDIR +#define ACE_HAS_SEMUN +#define ACE_HAS_SIGACTION_CONSTP2 +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SIG_C_FUNC +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_MSG_NAME +#define ACE_HAS_SOCKLEN_T +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STRINGS +#define ACE_HAS_STRING_CLASS +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_SVR4_SIGNAL_T +#define ACE_HAS_SYSCTL +#define ACE_HAS_SYSV_IPC +#define ACE_HAS_SYS_FILIO_H +#define ACE_HAS_STRSIGNAL +#define ACE_HAS_SYS_SOCKIO_H +#define ACE_HAS_SYS_SYSCALL_H +#define ACE_HAS_TERMIOS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_HAS_UALARM +#define ACE_HAS_VASPRINTF +#define ACE_HAS_VOIDPTR_MMAP +#define ACE_HAS_VOIDPTR_SOCKOPT +#define ACE_HAS_VOID_UNSETENV +#define ACE_HAS_WCHAR +#define ACE_HAS_XPG4_MULTIBYTE_CHAR + +#define ACE_LACKS_CONDATTR_PSHARED +#define ACE_LACKS_GETIPNODEBYADDR +#define ACE_LACKS_GETIPNODEBYNAME +#define ACE_LACKS_GETPGID +#define ACE_LACKS_IOSTREAM_FX +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_ITOW +#define ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_LOG2 +#define ACE_LACKS_MALLOC_H +#define ACE_LACKS_MSG_ACCRIGHTS +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING +#define ACE_LACKS_PRI_T +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK +#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS +#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS +#define ACE_LACKS_RLIMIT_PROTOTYPE +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSCHED +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_STDINT_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_TERMIO_H +#define ACE_LACKS_THREAD_PROCESS_SCOPING +#define ACE_LACKS_TIMEDWAIT_PROTOTYPES +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_UNBUFFERED_STREAMBUF +#define ACE_LACKS_U_LONGLONG_T +#define ACE_LACKS_WCHAR_H +#define ACE_LACKS_WCSCASECMP +#define ACE_LACKS_WCSDUP +#define ACE_LACKS_WCSNCASECMP +#define ACE_LACKS_WCSNICMP + +#define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS +#define ACE_PAGE_SIZE 4096 +#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR +#define ACE_SCANDIR_SEL_LACKS_CONST + +// OpenBSD 3.6 +#if (OpenBSD < 200411) +# define ACE_USES_ASM_SYMBOL_IN_DLSYM +#endif + +// ucontext_t is in OpenBSD 3.5 and later. +#if (OpenBSD >= 200405) +# define ACE_HAS_UCONTEXT_T +#endif /* OpenBSD >= 200405 */ + +// Lacks perfect filtering, must bind group address. +#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING +#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ + +// OpenBSD's dlsym call segfaults when passed an invalid handle. +// It seems as if most other OSs detect this and just report an error. +#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-openvms.h b/externals/ace/config-openvms.h new file mode 100644 index 0000000..ac57aad --- /dev/null +++ b/externals/ace/config-openvms.h @@ -0,0 +1,198 @@ +/* -*- C++ -*- */ +// $Id: config-openvms.h 87167 2009-10-19 19:33:53Z olli $ + +// The following configuration file is designed to work for OpenVMS 7.3-2 + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H + +#if !defined (ACE_USE_RCSID) +# define ACE_USE_RCSID 0 +#endif + +#ifdef __cplusplus +#pragma message disable CODCAUUNR +#pragma message disable CODEUNREACHABLE +//#pragma message disable DOLLARID +//#pragma message disable NOSIMPINT +//#pragma message disable NOSTDLONGLONG +#pragma message disable NARROWPTR +//#pragma message disable LONGEXTERN +#pragma message disable UNSCOMZER +#endif + +// Use a signed int to match POSIX +#define __SIGNED_INT_TIME_T + +#define ACE_OPENVMS __VMS_VER + +#define ACE_DLL_SUFFIX ACE_TEXT("") + +#define ACE_HAS_DUMP 1 + +// need this includes to ensure proper sequence of definitions so that +// f.i. HP C/C++ does not '#define ' memcpy, memmove etc. +#include +#include +#include +#undef memset +#undef memcpy +#undef memmove + +#if defined(__ia64__) + // on OpenVMS IA64 we need this get the singleton exported since we build + // ACE/TAO with the NOTEMPLATES export option which prohibits exporting + // of any template symbols unless explicitly exported + #define ACE_HAS_CUSTOM_EXPORT_MACROS + #define ACE_Proper_Export_Flag + #define ACE_Proper_Import_Flag + #define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T + #define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; +#else + #define ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION +#endif + +#define ACE_DEFAULT_BASE_ADDR ((char*)(0x30000000)) + +#define ACE_MAX_UDP_PACKET_SIZE 65535 + +#define ACE_HAS_STDCPP_STL_INCLUDES 1 + +/* missing system headers */ +#define ACE_LACKS_STDINT_H 1 +#define ACE_LACKS_SYS_IPC_H 1 +#define ACE_LACKS_SYS_SEM_H 1 +#define ACE_LACKS_SEMAPHORE_H 1 +#define ACE_LACKS_SYS_SELECT_H 1 +#define ACE_LACKS_TERMIOS_H 1 +#define ACE_LACKS_SYS_SHM_H 1 +#define ACE_LACKS_SYS_MSG_H 1 +#define ACE_LACKS_REGEX_H 1 +#define ACE_LACKS_SEARCH_H 1 +#define ACE_LACKS_SCHED_H 1 +#define ACE_LACKS_SYS_SYSCTL_H 1 +#define ACE_LACKS_MALLOC_H 1 +#define ACE_LACKS_SYS_PARAM_H 1 +#define ACE_LACKS_SIGINFO_H 1 +#define ACE_LACKS_UCONTEXT_H 1 + +/* missing rtl functions */ +#define ACE_LACKS_SETPGID 1 +#define ACE_LACKS_SETREUID 1 +#define ACE_LACKS_SETREGID 1 +#define ACE_LACKS_FORK 1 +#define ACE_LACKS_GETPGID 1 +#define ACE_LACKS_SETSID 1 +#define ACE_LACKS_FCNTL 1 +#define ACE_LACKS_SETEGID 1 +#define ACE_LACKS_SETEUID 1 + +#define ACE_LACKS_REALPATH 1 + +#define ACE_LACKS_SYMLINKS 1 + +#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1 +#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS 1 + +#define ACE_HAS_P_READ_WRITE +#define ACE_HAS_CHARPTR_DL 1 +#define ACE_HAS_CLOCK_GETTIME 1 +#define ACE_HAS_CLOCK_SETTIME 1 +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1 +#define ACE_HAS_DIRENT 1 +#define ACE_HAS_GETPAGESIZE 1 +#define ACE_HAS_MSG +#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 +#define ACE_HAS_3_PARAM_WCSTOK 1 +#define ACE_HAS_SIGSUSPEND 1 +#define ACE_HAS_SIGWAIT 1 +#define ACE_HAS_SIGTIMEDWAIT 1 + +#define ACE_HAS_SIG_C_FUNC 1 +#define ACE_HAS_SIGISMEMBER_BUG +#define ACE_HAS_STRNLEN 1 +#define ACE_HAS_STREAMS 1 +#define ACE_HAS_UALARM 1 +#define ACE_HAS_VOIDPTR_MMAP 1 +#define ACE_HAS_VOIDPTR_SOCKOPT 1 +#define ACE_LACKS_LSTAT 1 +#define ACE_LACKS_MADVISE 1 +#define ACE_LACKS_MKFIFO 1 +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 +#define ACE_LACKS_READLINK 1 +#define ACE_LACKS_RLIMIT 1 +#define ACE_LACKS_RLIMIT_PROTOTYPE 1 +#define ACE_LACKS_SETSCHED +#define ACE_LACKS_SYSCALL 1 +#define ACE_LACKS_WCSTOULL 1 +#define ACE_LACKS_WCSTOLL + +/* (missing) standard data types */ +#define ACE_LACKS_CONST_TIMESPEC_PTR 1 +#define ACE_LACKS_SUSECONDS_T 1 +#define ACE_HAS_IDTYPE_T 1 +#define ACE_HAS_SIGINFO_T 1 +#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 +#define ACE_HAS_SIZET_SOCKET_LEN 1 +#define ACE_HAS_SSIZE_T 1 +#define ACE_LACKS_PRI_T 1 +#define ACE_LACKS_SEMBUF_T 1 +#define ACE_LACKS_STRRECVFD 1 +#define ACE_LACKS_T_ERRNO 1 + +/* POSIX threads ompatibilities */ +#define ACE_LACKS_RWLOCK_T 1 +#define ACE_LACKS_PTHREAD_KILL 1 +#define ACE_LACKS_THREAD_PROCESS_SCOPING 1 + +#define ACE_HAS_PTHREADS 1 +#define ACE_HAS_PTHREAD_PROCESS_ENUM 1 +#define ACE_LACKS_UNNAMED_SEMAPHORE 1 +#define ACE_MT_SAFE 1 +#define ACE_HAS_THREADS 1 +#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 +#define ACE_HAS_THR_C_DEST 1 +#define ACE_HAS_THR_C_FUNC 1 +#define ACE_LACKS_PTHREAD_SIGMASK 1 +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 +#define ACE_NEEDS_HUGE_THREAD_STACKSIZE (64U*1024) +#define ACE_HAS_PTHREAD_SETCONCURRENCY 1 +#define ACE_HAS_PTHREAD_GETCONCURRENCY 1 +#define ACE_HAS_PTHREAD_SCHEDPARAM 1 + +/* language/platform conformance */ +#define ACE_NEW_THROWS_EXCEPTIONS 1 +#define ACE_TEMPLATES_REQUIRE_SOURCE 1 +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_HAS_AUTOMATIC_INIT_FINI 1 +#define ACE_LACKS_UNIX_SIGNALS 1 + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 +#define ACE_HAS_CPLUSPLUS_HEADERS 1 +#define ACE_HAS_EXCEPTIONS 1 +#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 + +#define ACE_HAS_GPERF 1 +#define ACE_HAS_IP_MULTICAST 1 +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#define ACE_HAS_POSIX_NONBLOCK 1 +#define ACE_HAS_POSIX_TIME 1 +#define ACE_HAS_BROKEN_POSIX_TIME 1 +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#define ACE_HAS_STRING_CLASS 1 +#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 + +#define ACE_HAS_TEMPLATE_TYPEDEFS 1 +#define ACE_LACKS_NAMED_POSIX_SEM 1 +#define ACE_LACKS_SYSV_SHMEM 1 +#define ACE_LACKS_UNIX_DOMAIN_SOCKETS 1 +#define ACE_LACKS_UNIX_SYSLOG 1 +#define ACE_LACKS_ALPHASORT 1 +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_ISBLANK + +#define ACE_LACKS_SETENV +#define ACE_LACKS_UNSETENV + +#endif diff --git a/externals/ace/config-pharlap.h b/externals/ace/config-pharlap.h new file mode 100644 index 0000000..dad0e91 --- /dev/null +++ b/externals/ace/config-pharlap.h @@ -0,0 +1,91 @@ +/* -*- C++ -*- */ +// $Id: config-pharlap.h 84373 2009-02-10 18:21:50Z johnnyw $ + +// This configuration file is for use with the PharLap Realtime ETS Kernel. +// It has been tested with PharLap TNT Embedded ToolSuite version 9.1. + +#ifndef ACE_CONFIG_PHARLAP_H +#define ACE_CONFIG_PHARLAP_H +#include /**/ "ace/pre.h" + +#define ACE_HAS_PHARLAP +// Some features are only available with the Realtime edition of ETS. +// Assume that if using ACE, the realtime version is also being used, but +// allow it to be turned off as well. +#ifndef ACE_HAS_PHARLAP_RT +# define ACE_HAS_PHARLAP_RT +#else +# if (ACE_HAS_PHARLAP_RT == 0) +# undef ACE_HAS_PHARLAP_RT +# endif +#endif + +// Fortunately, PharLap ETS offers much of the Win32 API. But it's still on +// Winsock 1.1 +#define ACE_HAS_WINSOCK2 0 +#define ACE_HAS_WINSOCK1 1 + +// The TSS implementation doesn't pass muster on the TSS_Test, but it works +// well with ACE's TSS emulation. +#define ACE_HAS_TSS_EMULATION + +#define ACE_LACKS_MMAP +#define ACE_LACKS_MPROTECT +#define ACE_LACKS_MSYNC +#define ACE_LACKS_TCP_NODELAY +#define ACE_LACKS_MSG_WFMO +#define ACE_LACKS_WIN32_MOVEFILEEX +#define ACE_LACKS_WIN32_REGISTRY +#define ACE_LACKS_WIN32_SECURITY_DESCRIPTORS +#define ACE_LACKS_WIN32_SERVICES +#define ACE_LACKS_WIN32_SETFILEPOINTEREX + +// There's no host table, by default. So using "localhost" won't work. +// If your system does have the ability to use "localhost" and you want to, +// define it before including this file. +#if !defined (ACE_LOCALHOST) +# define ACE_LOCALHOST "127.0.0.1" +#endif /* ACE_LOCALHOST */ + +// The normal Windows default stack size doesn't hold for ETS. Set what you +// want explicitly. +#if !defined (ACE_DEFAULT_THREAD_STACKSIZE) +# define ACE_DEFAULT_THREAD_STACKSIZE (1024*1024) +#endif /* ACE_DEFAULT_THREAD_STACKSIZE */ + +// Don't know how to get the page size at execution time. This is most likely +// the correct value. +#define ACE_PAGE_SIZE 4096 + +#if defined (ACE_HAS_PHARLAP_RT) +# define ACE_HAS_IP_MULTICAST + // ETS winsock doesn't define IP level socket options +//# define IP_TOS 8 +#endif /* ACE_HAS_PHARLAP_RT */ + +// Let the config-win32.h file do its thing +#undef ACE_CONFIG_H +#include "ace/config-win32.h" +// Now remove things that desktop/server Windows has but Pharlap ETS doesn't. +#undef ACE_HAS_INTERLOCKED_EXCHANGEADD +#undef ACE_HAS_WCHAR + +// PharLap's exports apparantly define LockFile, but it's documented as +// unsupported. LockFileEx is not present. +#define ACE_LACKS_FILELOCKS + +#include /**/ +#if defined (ACE_HAS_PHARLAP_RT) +# include /**/ +#define ACE_LACKS_IP_ADD_MEMBERSHIP +#endif /* ACE_HAS_PHARLAP_RT */ + +// Although IN_CLASSD is defined in both winsock.h and winsock2.h, it ends +// up undefined for Pharlap ETS builds. If this is the case, set things up +// so nothing looks like class D. +#if !defined (IN_CLASSD) +# define IN_CLASSD(i) (0) +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_PHARLAP_H */ diff --git a/externals/ace/config-posix-nonetworking.h b/externals/ace/config-posix-nonetworking.h new file mode 100644 index 0000000..7edc31d --- /dev/null +++ b/externals/ace/config-posix-nonetworking.h @@ -0,0 +1,86 @@ +/* -*- C -*- */ +// $Id: config-posix-nonetworking.h 80826 2008-03-04 14:51:23Z wotte $ + +/* The following configuration file is designed to work for RTEMS + platforms using GNU C. +*/ + +#ifndef ACE_CONFIG_POSIX_NONETWORKING_H +#define ACE_CONFIG_POSIX_NONETWORKING_H + +// Missing header files +# define ACE_LACKS_SYS_UIO_H +# define ACE_LACKS_SYS_SOCKET_H +# define ACE_LACKS_NETINET_IN_H +# define ACE_LACKS_NETDB_H +# define ACE_LACKS_ARPA_INET_H +# define ACE_LACKS_SYS_SELECT_H +# define ACE_LACKS_NET_IF_H +# define ACE_LACKS_SYSLOG_H +# define ACE_LACKS_SYS_UN_H +# define ACE_LACKS_MEMORY_H +# define ACE_LACKS_SYS_SYSCTL_H +# define ACE_LACKS_NETINET_TCP_H + +// Missing types +# define ACE_LACKS_IOVEC +# define ACE_LACKS_IN_ADDR +# define ACE_LACKS_SOCKADDR_IN +# define ACE_LACKS_SOCKADDR_UN +# define ACE_LACKS_HOSTENT +# define ACE_LACKS_SOCKADDR +# define ACE_LACKS_IP_MREQ +# define ACE_LACKS_PROTOENT +# define ACE_LACKS_SERVENT +# define ACE_LACKS_IFREQ +# define ACE_LACKS_IFCONF +# define ACE_LACKS_LINGER + +// Missing methods +# define ACE_LACKS_GETHOSTBYADDR +# define ACE_LACKS_GETHOSTBYNAME +# define ACE_LACKS_GETIPNODEBYADDR +# define ACE_LACKS_LISTEN +# define ACE_LACKS_BIND +# define ACE_LACKS_NTOHL +# define ACE_LACKS_HTONL +# define ACE_LACKS_HTONS +# define ACE_LACKS_NTOHS +# define ACE_LACKS_SELECT +# define ACE_LACKS_SOCKET +# define ACE_LACKS_SHUTDOWN +# define ACE_LACKS_SETSOCKOPT +# define ACE_LACKS_INET_ATON +# define ACE_LACKS_INET_ADDR +# define ACE_LACKS_INET_NTOA +# define ACE_LACKS_GET_BCAST_ADDR +# define ACE_LACKS_GETHOSTENT +# define ACE_LACKS_GETSERVBYNAME +# define ACE_LACKS_ACCEPT +# define ACE_LACKS_CONNECT +# define ACE_LACKS_GETPEERNAME +# define ACE_LACKS_GETSOCKNAME +# define ACE_LACKS_GETSOCKOPT +# define ACE_LACKS_RECV +# define ACE_LACKS_SEND +# define ACE_LACKS_SENDTO +# define ACE_LACKS_RECVFROM +# define ACE_LACKS_RECVMSG +# define ACE_LACKS_SENDMSG +# define ACE_LACKS_GETHOSTBYADDR_R +# define ACE_LACKS_GETPROTOBYNAME +# define ACE_LACKS_GETPROTOBYNUMBER +# define ACE_LACKS_GETSERVBYNAME +# define ACE_LACKS_READV +# define ACE_LACKS_WRITEV +# define ACE_LACKS_SOCKETPAIR +# undef ACE_HAS_MSG + +// Missing OS features +# define ACE_LACKS_UNIX_SYSLOG +# define ACE_LACKS_TCP_NODELAY + +// Missing ACE features +# define ACE_DISABLE_NOTIFY_PIPE_DEFAULT 1 + +#endif /* ACE_CONFIG_POSIX_NONETWORKING_H */ diff --git a/externals/ace/config-posix.h b/externals/ace/config-posix.h new file mode 100644 index 0000000..09b4e06 --- /dev/null +++ b/externals/ace/config-posix.h @@ -0,0 +1,73 @@ +/* -*- C++ -*- */ +// $Id: config-posix.h 82517 2008-08-05 19:36:26Z shuston $ + +#ifndef ACE_CONFIG_POSIX_H +#define ACE_CONFIG_POSIX_H + +#include + +/* The following POSIX constants are defined after is + * included. They are documented in: + * http://www.opengroup.org/onlinepubs/007904975/basedefs/unistd.h.html + */ +#if defined(_POSIX_REALTIME_SIGNALS) && (_POSIX_REALTIME_SIGNALS-0 != -1 ) +# if !defined(ACE_HAS_POSIX_REALTIME_SIGNALS) +# define ACE_HAS_POSIX_REALTIME_SIGNALS +# endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ +#endif /* _POSIX_REALTIME_SIGNALS */ + +#if defined(_POSIX_ASYNCHRONOUS_IO) && (_POSIX_ASYNCHRONOUS_IO-0 != -1 ) +# if !defined(ACE_HAS_AIO_CALLS) +# define ACE_HAS_AIO_CALLS +# endif /* ACE_HAS_AIO_CALLS */ +#endif /* _POSIX_ASYNCHRONOUS_IO */ + +#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0) +# if defined(_POSIX_SEMAPHORES) && (_POSIX_SEMAPHORES-0 != -1 ) +# if !defined(ACE_HAS_POSIX_SEM) +# define ACE_HAS_POSIX_SEM +# endif /* ACE_HAS_POSIX_SEM */ +# if defined(ACE_HAS_POSIX_SEM) +# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && \ + (defined (_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS-0 != -1)) +# define ACE_HAS_POSIX_SEM_TIMEOUT +# endif /* ACE_HAS_POSIX_SEM_TIMEOUT && _POSIX_TIMEOUTS */ +# endif /* ACE_HAS_POSIX_SEM */ +# endif /* ACE_HAS_POSIX_SEM */ +#endif /* !ACE_MT_SAFE */ + +#if defined(_POSIX_SHARED_MEMORY_OBJECTS) && (_POSIX_SHARED_MEMORY_OBJECTS-0 != -1 ) +# if !defined(ACE_HAS_SHM_OPEN) +# define ACE_HAS_SHM_OPEN +# endif /* ACE_HAS_SHM_OPEN */ +#endif /* _POSIX_SHARED_MEMORY_OBJECTS */ + +// Check if threading enabled/disable through platform_macros +#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0) +// Allow the user to disable use of threads by setting ACE_HAS_THREADS to 0 +// before including this file. The platform config (not macros) file can +// often detect that the compiler was invoked with or without threads support +// and set this accordingly. +# if defined (ACE_HAS_THREADS) && (ACE_HAS_THREADS == 0) +# undef ACE_HAS_THREADS +# else +# if defined(_POSIX_THREADS) && (_POSIX_THREADS-0 != -1 ) +# if !defined(ACE_HAS_THREADS) +# define ACE_HAS_THREADS +# endif /* ACE_HAS_THREADS */ + +# if !defined(ACE_HAS_PTHREADS) +# define ACE_HAS_PTHREADS +# endif /* ACE_HAS_PTHREADS */ + +# endif /* _POSIX_THREADS */ +# endif /* ACE_HAS_THREADS */ +#endif /* !ACE_MT_SAFE */ + +#if defined(_POSIX_MESSAGE_PASSING) && (_POSIX_MESSAGE_PASSING-0 != -1 ) +# if !defined(ACE_HAS_POSIX_MESSAGE_PASSING) +# define ACE_HAS_POSIX_MESSAGE_PASSING +# endif /* ACE_HAS_POSIX_MESSAGE_PASSING */ +#endif /* _POSIX_MESSAGE_PASSING */ + +#endif /* ACE_CONFIG_POSIX_H */ diff --git a/externals/ace/config-qnx-neutrino.h b/externals/ace/config-qnx-neutrino.h new file mode 100644 index 0000000..8652556 --- /dev/null +++ b/externals/ace/config-qnx-neutrino.h @@ -0,0 +1,136 @@ +// -*- C++ -*- +// $Id: config-qnx-neutrino.h 87167 2009-10-19 19:33:53Z olli $ +// The following configuration file is designed to work for Neutrino +// 2.0 (Beta) with GNU C++ and the POSIX (pthread) threads package. + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +#define _POSIX_C_SOURCE 199506 +#define _QNX_SOURCE + +// These constants are in i386-nto/include/limits.h, but egcs +// picks up its own limits.h instead: +#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */ +#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */ + +#if defined(__OPTIMIZE__) +# if defined(__X86__) + // string.h can't be used by ACE with __OPTIMIZE__. +# undef __OPTIMIZE__ +# include +# define __OPTIMIZE__ +# endif /* __X86__ */ +#endif /* __OPTIMIZE__ */ + +#include "ace/config-g++-common.h" + +// The following defines the Neutrino compiler. +// gcc should know to call g++ as necessary +#ifdef __GNUC__ +# define ACE_CC_NAME ACE_TEXT ("gcc") +#else +# define ACE_CC_NAME ACE_TEXT ("NTO compiler ??") +#endif + +// /usr/nto/include/float.h defines +// FLT_MAX_EXP 127 +// DBL_MAX_EXP 1023 +// ace expects 128 & 1024 respectively +// to set the following macros in ace/Basic_Types.h +// These macros are: +// #define ACE_SIZEOF_DOUBLE 8 +// #define ACE_SIZEOF_FLOAT 4 + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA +#define ACE_HAS_ALLOCA_H +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_DIRENT +#define ACE_HAS_GETPAGESIZE +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER +#define ACE_HAS_INLINED_OSCALLS +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_MSG +#define ACE_HAS_MT_SAFE_MKTIME +#define ACE_HAS_MUTEX_TIMEOUTS +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONCONST_SWAB +#define ACE_HAS_POSIX_SEM +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_PTHREADS +#define ACE_HAS_P_READ_WRITE +#define ACE_HAS_REENTRANT_FUNCTIONS +#define ACE_HAS_SELECT_H +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGISMEMBER_BUG +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STRINGS +#define ACE_HAS_SVR4_GETTIMEOFDAY +#define ACE_HAS_TERMIOS +#define ACE_HAS_THREADS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_THR_C_DEST +#define ACE_HAS_THR_C_FUNC +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_HAS_UALARM +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_VOIDPTR_MMAP +#define ACE_HAS_VOIDPTR_SOCKOPT +#define ACE_LACKS_CONDATTR_PSHARED +#define ACE_LACKS_CONST_TIMESPEC_PTR +#define ACE_LACKS_CUSERID +#define ACE_LACKS_FORK +#define ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_MADVISE +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_NAMED_POSIX_SEM +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_POLL_H +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SBRK +#define ACE_LACKS_SEEKDIR +#define ACE_LACKS_SO_SNDBUF +#define ACE_LACKS_SO_RCVBUF +#define ACE_LACKS_SOCKETPAIR +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_STREAM_MODULES +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SYSCALL +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_TCP_NODELAY +#define ACE_LACKS_TELLDIR +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_TRUNCATE +#define ACE_LACKS_T_ERRNO +#define ACE_LACKS_UALARM_PROTOTYPE +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_UNIX_DOMAIN_SOCKETS +#define ACE_LACKS_U_LONGLONG_T +#define ACE_MT_SAFE 1 +#define ACE_NEEDS_FUNC_DEFINITIONS +#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 +#define ACE_TEMPLATES_REQUIRE_SOURCE +#define ACE_THR_PRI_FIFO_DEF 10 +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-qnx-rtp-62x.h b/externals/ace/config-qnx-rtp-62x.h new file mode 100644 index 0000000..7fa7514 --- /dev/null +++ b/externals/ace/config-qnx-rtp-62x.h @@ -0,0 +1,131 @@ +// -*- C++ -*- +// $Id: config-qnx-rtp-62x.h 87167 2009-10-19 19:33:53Z olli $ +// The following configuration file is designed to work for QNX RTP 621 +// GNU C++ and the POSIX (pthread) threads package. You can get QNX +// RTP at http://get.qnx.com +#ifndef ACE_CONFIG_QNX_RTP_62x_H +#define ACE_CONFIG_QNX_RTP_62x_H +#include /**/ "ace/pre.h" +#include /**/ "ace/config-qnx-rtp-common.h" + +///////////////////////////////////////////////////////////////// +// Definition of the features that are available. +// +// ACE_HAS Section +///////////////////////////////////////////////////////////////// +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA +#define ACE_HAS_ALLOCA_H +#define ACE_HAS_ALT_CUSERID +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_DIRENT +#define ACE_HAS_GETPAGESIZE +#define ACE_HAS_GETIFADDRS +// Enable gperf, this is a hosted configuration. +#define ACE_HAS_GPERF +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_MSG +#define ACE_HAS_MT_SAFE_MKTIME +#define ACE_HAS_MUTEX_TIMEOUTS +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONCONST_SWAB +#define ACE_HAS_POSIX_SEM +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_PTHREADS +#define ACE_HAS_P_READ_WRITE +#define ACE_HAS_REENTRANT_FUNCTIONS +#define ACE_HAS_SELECT_H +#define ACE_HAS_SHM_OPEN +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGISMEMBER_BUG +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKLEN_T +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STRINGS +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_SVR4_GETTIMEOFDAY +#define ACE_HAS_TERMIOS +#define ACE_HAS_THREADS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_THR_C_DEST +#define ACE_HAS_THR_C_FUNC +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_HAS_UALARM +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_VOIDPTR_MMAP +#define ACE_HAS_VOIDPTR_SOCKOPT + +///////////////////////////////////////////////////////////////// +// Definition of the features that are not available. +// +// ACE_LACKS Section +///////////////////////////////////////////////////////////////// +#define ACE_LACKS_CONST_TIMESPEC_PTR +#define ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_MADVISE +// lacks mqueue mgr or speed-up named sem by shm emulation +#define ACE_LACKS_NAMED_POSIX_SEM +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +// Multicast_Tests reports for NTO 621 frames from unsubscribed groups +#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#define ACE_LACKS_POLL_H +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SO_SNDBUF +#define ACE_LACKS_SO_RCVBUF +#define ACE_LACKS_STREAM_MODULES +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_STRPTIME +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SYSCALL +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_T_ERRNO +#define ACE_LACKS_U_LONGLONG_T +#define ACE_LACKS_ALPHASORT +#define ACE_LACKS_FD_MASK +#define ACE_LACKS_NFDBITS +#define ACE_LACKS_ISCTYPE + +#define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE. + +#define ACE_MT_SAFE 1 +#define ACE_NEEDS_FUNC_DEFINITIONS +#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000 +#define ACE_THR_PRI_FIFO_DEF 10 +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND + +#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 + +#define ACE_SIZEOF_WCHAR 4 + +// No prototypes +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_WCSDUP +// The default value of FD_SETSIZE is 32, but actually x86 NTO +// supports by default at least 1000 descriptors in fd_set. +#if defined( FD_SETSIZE ) +#undef FD_SETSIZE +#endif +#define FD_SETSIZE 1000 +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_QNX_RTP_62x_H*/ diff --git a/externals/ace/config-qnx-rtp-common.h b/externals/ace/config-qnx-rtp-common.h new file mode 100644 index 0000000..79eb239 --- /dev/null +++ b/externals/ace/config-qnx-rtp-common.h @@ -0,0 +1,50 @@ +// -*- C++ -*- +// $Id: config-qnx-rtp-common.h 85074 2009-04-10 03:17:24Z mesnier_p $ +// several macros common to various qnx neutrino version. + +#ifndef ACE_CONFIG_QNX_RTP_COMMON_H +#define ACE_CONFIG_QNX_RTP_COMMON_H +#include /**/ "ace/pre.h" + +#define _POSIX_C_SOURCE 199506 +#define _QNX_SOURCE + +// These constants are in i386-nto/include/limits.h, but egcs +// picks up its own limits.h instead: +#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */ +#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */ + +#if defined(__OPTIMIZE__) +# if defined(__X86__) + // string.h can't be used by ACE with __OPTIMIZE__. +# undef __OPTIMIZE__ +# include +# define __OPTIMIZE__ +# endif /* __X86__ */ +#endif /* __OPTIMIZE__ */ + +#include "ace/config-g++-common.h" + +// The following defines the Neutrino compiler. +// gcc should know to call g++ as necessary +#ifdef __GNUC__ +# define ACE_CC_NAME ACE_TEXT ("gcc") +#else +# define ACE_CC_NAME ACE_TEXT ("QNX-RTP compiler ??") +#endif + +// /usr/nto/include/float.h defines +// FLT_MAX_EXP 127 +// DBL_MAX_EXP 1023 +// ace expects 128 & 1024 respectively +// to set the following macros in ace/Basic_Types.h +// These macros are: +#define ACE_SIZEOF_DOUBLE 8 +#define ACE_SIZEOF_FLOAT 4 + +// At least qnx 6.3.2 uses a void return for unsetenv +// This assumes that older versions do too. +#define ACE_HAS_VOID_UNSETENV + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_QNX_RTP_COMMON_H */ diff --git a/externals/ace/config-qnx-rtp-pre62x.h b/externals/ace/config-qnx-rtp-pre62x.h new file mode 100644 index 0000000..504d3a3 --- /dev/null +++ b/externals/ace/config-qnx-rtp-pre62x.h @@ -0,0 +1,152 @@ +// -*- C++ -*- +// $Id: config-qnx-rtp-pre62x.h 87167 2009-10-19 19:33:53Z olli $ +// The following configuration file is designed to work for QNX RTP +// GNU C++ and the POSIX (pthread) threads package. You can get QNX +// RTP at http://get.qnx.com + +#ifndef ACE_CONFIG_RTP_PRE62x_H +#define ACE_CONFIG_RTP_PRE62x_H +#include /**/ "ace/pre.h" +#include /**/ "ace/config-qnx-rtp-common.h" + +///////////////////////////////////////////////////////////////// +// Definition of the features that are available. +// +// ACE_HAS Section +///////////////////////////////////////////////////////////////// + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA +#define ACE_HAS_ALLOCA_H +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_DIRENT +#define ACE_HAS_GETPAGESIZE +// Enable gperf, this is a hosted configuration. +#define ACE_HAS_GPERF +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER +#define ACE_HAS_INLINED_OSCALLS +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_MSG +#define ACE_HAS_MT_SAFE_MKTIME +#define ACE_HAS_MUTEX_TIMEOUTS +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_POSIX_SEM +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_PTHREADS +#define ACE_HAS_P_READ_WRITE +#define ACE_HAS_REENTRANT_FUNCTIONS +#define ACE_HAS_SELECT_H +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGISMEMBER_BUG +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +// #define ACE_HAS_SIZET_SOCKET_LEN +#define ACE_HAS_SOCKLEN_T +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STRINGS +#define ACE_HAS_SVR4_GETTIMEOFDAY +#define ACE_HAS_TERMIOS +#define ACE_HAS_THREADS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_THR_C_DEST +#define ACE_HAS_THR_C_FUNC +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_HAS_UALARM +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_VOIDPTR_MMAP +#define ACE_HAS_VOIDPTR_SOCKOPT + +///////////////////////////////////////////////////////////////// +// Definition of the features that are not available. +// +// ACE_LACKS Section +///////////////////////////////////////////////////////////////// +#define ACE_LACKS_CONDATTR_PSHARED +#define ACE_LACKS_CONST_TIMESPEC_PTR +#define ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_MADVISE +#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_NAMED_POSIX_SEM +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SBRK +#define ACE_LACKS_SEEKDIR +#define ACE_LACKS_SO_SNDBUF +#define ACE_LACKS_SO_RCVBUF +#define ACE_LACKS_SOCKETPAIR +// Even if the QNX RTP docs says that socket pair are +// available, there is actually no implementation of +// soket-pairs. +#define ACE_LACKS_STREAM_MODULES +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SYSCALL +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_ALPHASORT +//#define ACE_LACKS_TCP_NODELAY // Based on the QNX RTP documentation, this option seems to + // to be supported. +#define ACE_LACKS_TELLDIR +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_TRUNCATE +#define ACE_LACKS_T_ERRNO +#define ACE_LACKS_UALARM_PROTOTYPE +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_UNIX_DOMAIN_SOCKETS +#define ACE_LACKS_U_LONGLONG_T +#define ACE_LACKS_FD_MASK +#define ACE_LACKS_NFDBITS + +#define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE. + +#define ACE_MT_SAFE 1 +#define ACE_NEEDS_FUNC_DEFINITIONS +#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000 +#define ACE_TEMPLATES_REQUIRE_SOURCE +#define ACE_THR_PRI_FIFO_DEF 10 +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND + +#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 + +#define ACE_SIZEOF_WCHAR 4 + +// Not really, but the prototype returns wchar_t instead of wchar_t * +#define ACE_LACKS_WCSSTR + +// No prototypes +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_WCSDUP + +// And these have prototypes but no implementation +#define ACE_LACKS_WCSLEN +#define ACE_LACKS_WCSNCMP +#define ACE_LACKS_WCSCPY +#define ACE_LACKS_WCSNCPY +#define ACE_LACKS_TOWLOWER +#define ACE_LACKS_TOWUPPER +#define ACE_LACKS_WCSCMP +#define ACE_LACKS_WCSCAT +#define ACE_LACKS_WCSNCAT +#define ACE_LACKS_WCSSPN +#define ACE_LACKS_WCSCHR +#define ACE_LACKS_WCSPBRK +#define ACE_LACKS_WCSRCHR + +#define ACE_LACKS_ACE_IOSTREAM + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_RTP_PRE62x_H */ diff --git a/externals/ace/config-qnx-rtp.h b/externals/ace/config-qnx-rtp.h new file mode 100644 index 0000000..c55a4ab --- /dev/null +++ b/externals/ace/config-qnx-rtp.h @@ -0,0 +1,25 @@ +// -*- C++ -*- +// $Id: config-qnx-rtp.h 80826 2008-03-04 14:51:23Z wotte $ +// The following configuration file is designed to work for QNX RTP +// GNU C++ and the POSIX (pthread) threads package. You can get QNX +// RTP at http://get.qnx.com. +// This header is intended to switch between configuration for +// various NTO versions. +#ifndef ACE_CONFIG_QNX_RTP_H +#define ACE_CONFIG_QNX_RTP_H +#include /**/ "ace/pre.h" + +#include +#if !defined(_NTO_VERSION) +# error "Could not detect QNX version from macro _NTO_VERSION" +#else +# define ACE_NTO_VERS _NTO_VERSION +# if ACE_NTO_VERS < 620 +# include /**/ "ace/config-qnx-rtp-pre62x.h" +# else +# include /**/ "ace/config-qnx-rtp-62x.h" +# endif +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_QNX_RTP_H */ diff --git a/externals/ace/config-rtems.h b/externals/ace/config-rtems.h new file mode 100644 index 0000000..d113a14 --- /dev/null +++ b/externals/ace/config-rtems.h @@ -0,0 +1,164 @@ +/* -*- C -*- */ +// $Id: config-rtems.h 87169 2009-10-19 20:26:55Z olli $ + +/* The following configuration file is designed to work for RTEMS + platforms using GNU C. +*/ + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H + +#if ! defined (__ACE_INLINE__) +#define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +// Needed to make some prototypes visible. +// #if ! defined (_GNU_SOURCE) +// #define _GNU_SOURCE +// #endif /* ! _GNU_SOURCE */ + +// First the machine specific part +// There are no known port specific issues with the RTEMS port of ACE. +// XXX Pentium and PowerPC have high res timer support in ACE. + +// Then the compiler specific parts +#if defined (__GNUG__) + // config-g-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so + // this must appear before its #include. +# define ACE_HAS_STRING_CLASS +# include "ace/config-g++-common.h" +#else /* ! __GNUG__ */ +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-rtems.h +# endif /* __cplusplus */ +#endif /* ! __GNUG__ */ + +#include "ace/config-posix.h" + +// Completely common part :-) + +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#define ACE_LACKS_ALPHASORT +#define ACE_LACKS_REGEX_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_DLFCN_H +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_STRINGS_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_POLL_H +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_LACKS_STRCASECMP +#define ACE_LACKS_MKSTEMP +#define ACE_LACKS_STRDUP +#define ACE_LACKS_STRTOK_R +#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS +#define ACE_LACKS_REALPATH +#define ACE_LACKS_TEMPNAM +#define ACE_LACKS_TZSET + +// Temporarily, enabling this results in compile errors with +// rtems 4.6.6. +#define ACE_LACKS_WCHAR_H + +#if !defined (ACE_MT_SAFE) +#define ACE_MT_SAFE 1 +#endif + +#if ACE_MT_SAFE +# define ACE_HAS_THREADS +# define ACE_HAS_PTHREADS +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +# define ACE_HAS_PTHREAD_SCHEDPARAM +# define ACE_LACKS_THREAD_PROCESS_SCOPING +#else +# define ACE_HAS_POSIX_GETPWNAM_R +# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#endif + +#define ACE_HAS_ALT_CUSERID +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_DIRENT +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_MSG +#define ACE_HAS_MT_SAFE_MKTIME +#define ACE_HAS_NONCONST_READV +#define ACE_HAS_GETPAGESIZE +#define ACE_HAS_POSIX_SEM +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_REENTRANT_FUNCTIONS +#define ACE_HAS_SIGACTION_CONSTP2 +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_SSIZE_T +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY +#define ACE_HAS_SYS_FILIO_H +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY +#define ACE_LACKS_EXEC +#define ACE_LACKS_FILELOCKS +#define ACE_LACKS_FORK +#define ACE_LACKS_GETPGID +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_MADVISE +#define ACE_LACKS_MMAP +#define ACE_LACKS_MPROTECT +#define ACE_LACKS_MSYNC +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK +#define ACE_LACKS_READDIR_R +#define ACE_LACKS_READLINK +#define ACE_LACKS_READV +#define ACE_LACKS_RLIMIT +#define ACE_LACKS_RLIMIT_PROTOTYPE +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SBRK +#define ACE_LACKS_SEMBUF_T +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETREUID_PROTOTYPE +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREGID_PROTOTYPE +#define ACE_LACKS_STRPTIME +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SI_ADDR +#define ACE_LACKS_SOCKETPAIR +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_SYSCALL +#define ACE_LACKS_UCONTEXT_H +#define ACE_HAS_NONCONST_WRITEV +#define ACE_LACKS_WRITEV +#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 +#define ACE_NEEDS_SCHED_H +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_TERMIOS + +// rtems 4.7 or higher +#if (__RTEMS_MAJOR__ > 4) || (__RTEMS_MAJOR__ == 4 && __RTEMS_MINOR__ > 6) +# define ACE_HAS_UALARM +#else +# define ACE_HAS_NOTSUP_SC_PAGESIZE +# define ACE_LACKS_SUSECONDS_T +# define ACE_LACKS_INTPTR_T +# undef ACE_HAS_SHM_OPEN +# undef ACE_HAS_AIO_CALLS +#endif + +// __RTEMS_REVISION__ could also be used but this is broken according +// to the rtems people + +#if !defined (_POSIX_REALTIME_SIGNALS) +# define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#endif + +#if defined (ACE_LACKS_NETWORKING) +# include "ace/config-posix-nonetworking.h" +#endif + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-sco-5.0.0.h b/externals/ace/config-sco-5.0.0.h new file mode 100644 index 0000000..61b6821 --- /dev/null +++ b/externals/ace/config-sco-5.0.0.h @@ -0,0 +1,90 @@ +/* -*- C++ -*- */ +// $Id: config-sco-5.0.0.h 87167 2009-10-19 19:33:53Z olli $ + +#ifndef ACE_CONFIG_SCO_5_0_0_H +#define ACE_CONFIG_SCO_5_0_0_H +#include /**/ "ace/pre.h" + +// Compiling for SCO. +#if !defined (SCO) +#define SCO +#endif /* SCO */ + +#if defined (SCO) && !defined (MAXPATHLEN) +#define MAXPATHLEN 1023 +#endif /* SCO */ + +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_LACKS_CONST_TIMESPEC_PTR +#define ACE_LACKS_SYSCALL +#define ACE_LACKS_STRRECVFD +#define ACE_NEEDS_FTRUNCATE +#define ACE_LACKS_MADVISE +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS + +#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC +#define ACE_HAS_NONCONST_MSGSND +#define ACE_HAS_BIG_FD_SET +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_AUTOMATIC_INIT_FINI + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +// Compiler/platform contains the file. +//#define ACE_HAS_SYS_SYSCALL_H + +// Fixes a problem with HP/UX not wrapping the mmap(2) header files +// with extern "C". +//#define ACE_HAS_BROKEN_MMAP_H + +// Prototypes for both signal() and struct sigaction are consistent. +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Compiler/platform has correctly prototyped header files. +#define ACE_HAS_CPLUSPLUS_HEADERS + +// Compiler/platform supports poll(). +// #define ACE_HAS_POLL + +// Platform supports POSIX O_NONBLOCK semantics. +#define ACE_HAS_POSIX_NONBLOCK + +// Compiler/platform defines the sig_atomic_t typedef +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler supports the ssize_t typedef. +//#define ACE_HAS_SSIZE_T + +// Defines the page size of the system. +#define ACE_PAGE_SIZE 4096 + +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +// Note, this only works if the flag is set above! +//#define ACE_HAS_GETRUSAGE + +// Platform uses int for select() rather than fd_set. +#define ACE_HAS_SELECT_H + +// Platform has prototypes for ACE_TLI. +#define ACE_HAS_TLI_PROTOTYPES +// Platform has the XLI version of ACE_TLI. +// #define ACE_HAS_XLI + +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_UCONTEXT_T + +#define ACE_LACKS_STRCASECMP + +// #define ACE_HAS_POSIX_TIME +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_DIRENT +#define ACE_LACKS_READDIR_R +#define ACE_HAS_GPERF + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_SCO_5_0_0_H */ diff --git a/externals/ace/config-suncc-common.h b/externals/ace/config-suncc-common.h new file mode 100644 index 0000000..3f0bae8 --- /dev/null +++ b/externals/ace/config-suncc-common.h @@ -0,0 +1,67 @@ +// -*- C++ -*- +// +// $Id: config-suncc-common.h 81935 2008-06-12 22:01:53Z jtc $ + +#ifndef ACE_SUNCC_COMMON_H +#define ACE_SUNCC_COMMON_H +#include /**/ "ace/pre.h" + +# define ACE_HAS_CPLUSPLUS_HEADERS +# define ACE_HAS_STDCPP_STL_INCLUDES +# define ACE_HAS_TEMPLATE_TYPEDEFS +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_HAS_STRING_CLASS +# define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS +# define ACE_HAS_THR_C_DEST 1 +# define ACE_LACKS_SWAB +#if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 +# undef ACE_HAS_CUSTOM_EXPORT_MACROS +#else +# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS +# define ACE_HAS_CUSTOM_EXPORT_MACROS +# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ +# define ACE_Proper_Export_Flag __attribute__ ((visibility("default"))) +# define ACE_Proper_Import_Flag +# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; +# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE; +#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ + +// __EXCEPTIONS is defined with -fexceptions, the egcs default. It +// is not defined with -fno-exceptions, the ACE default for g++. +// ACE_HAS_EXCEPTIONS is defined in +// include/makeinclude/wrapper_macros.GNU, so this really isn't +// necessary. Just in case . . . +# if defined (__EXCEPTIONS) && !defined (ACE_HAS_EXCEPTIONS) +# define ACE_HAS_EXCEPTIONS +# endif /* __EXCEPTIONS && ! ACE_HAS_EXCEPTIONS */ + +# if defined (ACE_HAS_EXCEPTIONS) +# define ACE_NEW_THROWS_EXCEPTIONS +# endif /* ACE_HAS_EXCEPTIONS */ + +#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE) +# define ACE_SIZEOF_LONG_DOUBLE 12 +#endif /* i386 */ + +#if defined (i386) || defined (__i386__) + // If running an Intel, assume that it's a Pentium so that + // ACE_OS::gethrtime () can use the RDTSC instruction. If running a + // 486 or lower, be sure to comment this out. (If not running an + // Intel CPU, this #define will not be seen because of the i386 + // protection, so it can be ignored.) +# define ACE_HAS_PENTIUM +#endif /* i386 */ + +#if !defined (ACE_LACKS_PRAGMA_ONCE) + // We define it with a -D with make depend. +# define ACE_LACKS_PRAGMA_ONCE +#endif /* ! ACE_LACKS_PRAGMA_ONCE */ + +#define ACE_TEMPLATES_REQUIRE_SOURCE + +#include /**/ "ace/post.h" +#endif /* ACE_SUNCC_COMMON_H */ diff --git a/externals/ace/config-sunos5.10.h b/externals/ace/config-sunos5.10.h new file mode 100644 index 0000000..df6f095 --- /dev/null +++ b/externals/ace/config-sunos5.10.h @@ -0,0 +1,66 @@ +/* -*- C++ -*- */ +// $Id: config-sunos5.10.h 89905 2010-04-16 13:04:47Z johnnyw $ + +// The following configuration file is designed to work for SunOS 5.10 +// (Solaris 10) platforms using the SunC++ 5.x (Sun Studio 8-10), or g++ +// compilers. + +#ifndef ACE_CONFIG_H + +// ACE_CONFIG_H is defined by one of the following #included headers. + +// #include the SunOS 5.9 config, then add any SunOS 5.10 updates below. +#include "ace/config-sunos5.9.h" + +// Solaris 10 can do sem_timedwait() (see ACE_OS::sema_wait). +#define ACE_HAS_POSIX_SEM_TIMEOUT + +#define ACE_HAS_SCANDIR + +// Solaris 10 offers a useable alphasort() unlike previous Solaris versions. +#if defined (ACE_LACKS_ALPHASORT) +# undef ACE_LACKS_ALPHASORT +#endif + +// Solaris 10 offers a useable log2() unlike previous Solaris versions. +#if defined (ACE_LACKS_LOG2) +# undef ACE_LACKS_LOG2 +#endif + +// Solaris 10 offers a useable isblank() unlike previous Solaris versions. +#if defined (ACE_LACKS_ISBLANK) +# undef ACE_LACKS_ISBLANK +#endif + +// Solaris 10 delivers pthread_attr_setstack +#if defined (ACE_LACKS_PTHREAD_ATTR_SETSTACK) +# undef ACE_LACKS_PTHREAD_ATTR_SETSTACK +#endif + +// Solaris 10 introduced printf() modifiers for [s]size_t types. +#if defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) +# undef ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%zd" +#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII */ + +#if defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) +# undef ACE_SIZE_T_FORMAT_SPECIFIER_ASCII +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%zu" +#endif /* ACE_SIZE_T_FORMAT_SPECIFIER_ASCII */ + +// Solaris 10 offers wcstoll() and wcstoull() +#if defined (ACE_LACKS_WCSTOLL) +# undef ACE_LACKS_WCSTOLL +#endif /* ACE_LACKS_WCSTOLL */ +#if defined (ACE_LACKS_WCSTOULL) +# undef ACE_LACKS_WCSTOULL +#endif /* ACE_LACKS_WCSTOULL */ + +#if defined (ACE_HAS_SCTP) && defined (ACE_HAS_LKSCTP) +# define ACE_HAS_VOID_PTR_SCTP_GETLADDRS +# define ACE_HAS_VOID_PTR_SCTP_GETPADDRS +#endif + +#define ACE_HAS_SOLARIS_ATOMIC_LIB + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-sunos5.11.h b/externals/ace/config-sunos5.11.h new file mode 100644 index 0000000..bbfd91c --- /dev/null +++ b/externals/ace/config-sunos5.11.h @@ -0,0 +1,15 @@ +/* -*- C++ -*- */ +// $Id: config-sunos5.11.h 80826 2008-03-04 14:51:23Z wotte $ + +// The following configuration file is designed to work for SunOS 5.11 +// (Solaris 11) platforms using the SunC++ 5.x (Sun Studio 10-12), or g++ +// compilers. + +#ifndef ACE_CONFIG_H + +// ACE_CONFIG_H is defined by one of the following #included headers. + +// #include the SunOS 5.10 config, then add any SunOS 5.11 updates below. +#include "ace/config-sunos5.10.h" + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-sunos5.5.h b/externals/ace/config-sunos5.5.h new file mode 100644 index 0000000..f16b503 --- /dev/null +++ b/externals/ace/config-sunos5.5.h @@ -0,0 +1,432 @@ +/* -*- C++ -*- */ +// $Id: config-sunos5.5.h 89494 2010-03-15 20:11:18Z olli $ + +// This configuration file is designed to work for SunOS 5.5 platforms +// using the following compilers: +// * Sun C++ 4.2 and later (including 5.x), patched as noted below +// * g++ 2.7.2 and later, including egcs +// * Green Hills 1.8.8 and later + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +#define ACE_LACKS_STDINT_H + +// alphasort() is present on earlier Solaris versions but is marked as not for +// use on non-BSD systems and not supported for use in applications that use +// system libraries or with multiple threads. So it's mostly useless. +#define ACE_LACKS_ALPHASORT + +// Solaris doesn't support log2() +#define ACE_LACKS_LOG2 + +// SunOS 5.5 does not provide getloadavg() +#define ACE_LACKS_GETLOADAVG + +// Some SunOS releases define _POSIX_PTHREAD_SEMANTICS automatically. +// We need to be check if the user has manually defined the macro before +// including . +#if defined (_POSIX_PTHREAD_SEMANTICS) +# define ACE_HAS_POSIX_PTHREAD_SEMANTICS +#endif /* _POSIX_PTHREAD_SEMANTICS */ + +// Before we do anything, we should include to +// ensure that things are set up properly. +#include + +// Some SunOS releases define _POSIX_PTHREAD_SEMANTICS automatically. +// We need to undef if the macro is set and not defined by the user. +#if defined (_POSIX_PTHREAD_SEMANTICS) && \ + !defined (ACE_HAS_POSIX_PTHREAD_SEMANTICS) +# undef _POSIX_PTHREAD_SEMANTICS +#endif /* _POSIX_PTHREAD_SEMANTICS && !ACE_HAS_POSIX_PTHREAD_SEMANTICS */ + +// Sun has the posix defines so let this file sort out what Sun delivers +#include "ace/config-posix.h" + +// Compiler version-specific settings: +#if defined (__SUNPRO_CC) +# if (__SUNPRO_CC < 0x410) + // The following might not be necessary, but I can't tell: my build + // with Sun C++ 4.0.1 never completes. +# define ACE_NEEDS_DEV_IO_CONVERSION +# elif (__SUNPRO_CC >= 0x420) +# if (__SUNPRO_CC >= 0x500) + // string.h and memory.h conflict for memchr definitions +# define ACE_LACKS_MEMORY_H + // If -compat=4 is turned on, the old 4.2 settings for iostreams are used, + // but the newer, explicit instantiation is used (above) +# if (__SUNPRO_CC_COMPAT >= 5) +# define ACE_HAS_TEMPLATE_TYPEDEFS +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_HAS_THR_C_DEST +# endif /* __SUNPRO_CC_COMPAT >= 5 */ +# if defined (ACE_HAS_EXCEPTIONS) +# define ACE_HAS_NEW_NOTHROW +# else + // See /opt/SUNWspro_5.0/SC5.0/include/CC/stdcomp.h: +# define _RWSTD_NO_EXCEPTIONS 1 +# endif /* ! ACE_HAS_EXCEPTIONS */ +# elif (__SUNPRO_CC == 0x420) || (__SUNPRO_CC == 0x410) +# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE +# endif /* __SUNPRO_CC >= 0x500 */ +# endif /* __SUNPRO_CC >= 0x420 */ + +# define ACE_CAST_CONST const +# define ACE_HAS_HI_RES_TIMER +# define ACE_HAS_SIG_C_FUNC /* Sun CC 5.0 needs this, 4.2 doesn't mind. */ +# define ACE_HAS_XPG4_MULTIBYTE_CHAR +# define ACE_LACKS_LINEBUFFERED_STREAMBUF +# define ACE_LACKS_SIGNED_CHAR + + // ACE_HAS_EXCEPTIONS precludes -noex in + // include/makeinclude/platform_macros.GNU. But beware, we have + // seen problems with exception handling on multiprocessor + // UltraSparcs: threaded executables core dump when threads exit. + // This problem does not seem to appear on single-processor UltraSparcs. + // And, it is solved with the application of patch + // 104631-02 "C++ 4.2: Jumbo Patch for C++ 4.2 on Solaris SPARC" + // to Sun C++ 4.2. + // To provide optimum performance, ACE_HAS_EXCEPTIONS is disabled by + // default. It can be enabled by adding "exceptions=1" to the "make" + // invocation. See include/makeinclude/platform_sunos5_sunc++.GNU + // for details. + +# if defined (ACE_HAS_EXCEPTIONS) + // If exceptions are enabled and we are using Sun/CC then + // throws an exception instead of returning 0. +# define ACE_NEW_THROWS_EXCEPTIONS +# endif /* ACE_HAS_EXCEPTIONS */ + + /* If you want to disable threading with Sun CC, remove -mt + from your CFLAGS, e.g., using make threads=0. */ + + +// Take advantage of Sun Studio 8 (Sun C++ 5.5) or better symbol +// visibility to generate improved shared library binaries. +# if (__SUNPRO_CC > 0x540) + +# if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 +# undef ACE_HAS_CUSTOM_EXPORT_MACROS +# else +# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS +# define ACE_HAS_CUSTOM_EXPORT_MACROS +# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ +# define ACE_Proper_Export_Flag __symbolic +# define ACE_Proper_Import_Flag __global + +# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE ; + +// # define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T +// # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE; + +# endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ +# endif /* __SUNPRO_CC > 0x540 (> Sun C++ 5.4) */ + +#elif defined (__GNUG__) + // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so + // this must appear before its #include. +# define ACE_HAS_STRING_CLASS + +# include "ace/config-g++-common.h" + +# define ACE_HAS_HI_RES_TIMER +# define ACE_HAS_XPG4_MULTIBYTE_CHAR + +# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0 + // ACE_MT_SAFE is #defined below, for all compilers. +# if !defined (_REENTRANT) + /* If you want to disable threading, comment out the following + line. Or, add -DACE_MT_SAFE=0 to your CFLAGS, e.g., using + make threads=0. */ +# define _REENTRANT +# endif /* _REENTRANT */ +# endif /* !ACE_MT_SAFE */ + +#elif defined (ghs) + +# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0 + // ACE_MT_SAFE is #defined below, for all compilers. +# if !defined (_REENTRANT) + /* If you want to disable threading, comment out the following + line. Or, add -DACE_MT_SAFE=0 to your CFLAGS, e.g., using + make threads=0. */ +# define _REENTRANT +# endif /* _REENTRANT */ +# endif /* !ACE_MT_SAFE */ + +# define ACE_CONFIG_INCLUDE_GHS_COMMON +# include "ace/config-ghs-common.h" + + // To avoid warning about inconsistent declaration between Sun's + // stdlib.h and Green Hills' ctype.h. +# include + + // IOStream_Test never halts with Green Hills 1.8.9. +# define ACE_LACKS_ACE_IOSTREAM + +#else /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-sunos5.5.h +# endif /* __cplusplus */ +#endif /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ + +#if !defined (__ACE_INLINE__) +// @note If you have link problems with undefined inline template +// functions with Sun C++, be sure that the #define of __ACE_INLINE__ +// below is not commented out. +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +// Platform supports the POSIX regular expression library. +// @note Please comment out the ACE_HAS_REGEX #define if you +// have link problems with g++ or egcs on SunOS 5.5. +#define ACE_HAS_REGEX + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// select()'s timeval arg is not declared as const and may be modified +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +// Platform supports pread() and pwrite() +#define ACE_HAS_P_READ_WRITE +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_UALARM +#define ACE_LACKS_UALARM_PROTOTYPE + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Platform supports system configuration information. +#define ACE_HAS_SYS_SYSTEMINFO_H +#define ACE_HAS_SYSV_SYSINFO + +// Platform supports recvmsg and sendmsg. +#define ACE_HAS_MSG + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +// Compiler/platform correctly calls init()/fini() for shared libraries. +#define ACE_HAS_AUTOMATIC_INIT_FINI + +// Platform supports POSIX O_NONBLOCK semantics. +#define ACE_HAS_POSIX_NONBLOCK + +// Compiler/platform has correctly prototyped header files. +#define ACE_HAS_CPLUSPLUS_HEADERS + +// Platform supports IP multicast +#define ACE_HAS_IP_MULTICAST + +// This setting was determined by running the autoconf tests. If it doesn't +// work uniformly, will need some tweaking, possibly based on other +// XPG feature-test macros. +#define ACE_HAS_CONST_CHAR_SWAB + +// Compiler/platform supports alloca() +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA + +// Compiler/platform has +#define ACE_HAS_ALLOCA_H + +// Platform contains . +#define ACE_HAS_POLL + +// Platform supports POSIX timers via timestruc_t. +#define ACE_HAS_POSIX_TIME + +// ACE_HAS_CLOCK_GETTIME requires linking with -lposix4. +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME + +// Platform supports the /proc file system. +#define ACE_HAS_PROC_FS + +// Platform supports the prusage_t struct. +#define ACE_HAS_PRUSAGE_T +#define ACE_HAS_GETRUSAGE + +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Platform supports SVR4 extended signals. +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_UCONTEXT_T + +// Compiler/platform provides the sockio.h file. +#define ACE_HAS_SYS_SOCKIO_H + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Platform supports STREAMS. +#define ACE_HAS_STREAMS + +// Platform supports STREAM pipes. +#define ACE_HAS_STREAM_PIPES + +// Compiler/platform supports struct strbuf. +#define ACE_HAS_STRBUF_T + +// Compiler/platform supports SVR4 dynamic linking semantics. +#define ACE_HAS_SVR4_DYNAMIC_LINKING + +// Compiler/platform supports SVR4 gettimeofday() prototype. +#define ACE_HAS_SVR4_GETTIMEOFDAY + +// Compiler/platform supports SVR4 ACE_TLI (in particular, T_GETNAME stuff)... +#define ACE_HAS_SVR4_TLI + +// Platform provides header. +#define ACE_HAS_SYS_FILIO_H + +#define ACE_HAS_STRSIGNAL + +// SunOS 5.5.x does not support mkstemp +#define ACE_LACKS_MKSTEMP +#define ACE_LACKS_SYS_SYSCTL_H + +#if !(defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)) +# define ACE_HAS_CHARPTR_SHMDT +#endif + +// Platform has posix getpwnam_r +#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE - 0 >= 199506L) || \ + defined(_POSIX_PTHREAD_SEMANTICS) +# define ACE_HAS_POSIX_GETPWNAM_R +#endif /* _POSIX_C_SOURCE || _POSIX_PTHREAD_SEMANTICS */ + +#if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE == 1) +#if defined (_REENTRANT) || \ + (defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) || \ + defined (_POSIX_PTHREAD_SEMANTICS) + // Compile using multi-thread libraries. +# define ACE_HAS_THREADS + +# if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +# endif /* ACE_MT_SAFE */ + + // Platform supports POSIX pthreads *and* Solaris threads, by + // default! If you only want to use POSIX pthreads, add + // -D_POSIX_PTHREAD_SEMANTICS to your CFLAGS. Or, #define it right + // here. See the Intro (3) man page for information on + // -D_POSIX_PTHREAD_SEMANTICS. +# if defined (_POSIX_PTHREAD_SEMANTICS) +# define ACE_LACKS_RWLOCK_T +# else +# define ACE_HAS_STHREADS +# endif /* ! _POSIX_PTHREAD_SEMANTICS */ + +# define ACE_HAS_PTHREADS + // . . . but only supports SCHED_OTHER scheduling policy +# define ACE_HAS_ONLY_SCHED_OTHER +# define ACE_HAS_SIGWAIT +# define ACE_HAS_SIGTIMEDWAIT +# define ACE_HAS_SIGSUSPEND +# define ACE_LACKS_PTHREAD_ATTR_SETSTACK + + // Compiler/platform has thread-specific storage +# define ACE_HAS_THREAD_SPECIFIC_STORAGE + + // Platform supports reentrant functions (i.e., all the POSIX *_r functions). +# define ACE_HAS_REENTRANT_FUNCTIONS + +# define ACE_NEEDS_LWP_PRIO_SET +# define ACE_HAS_THR_YIELD +# define ACE_LACKS_PTHREAD_YIELD +#endif /* _REENTRANT || _POSIX_C_SOURCE >= 199506L || \ + _POSIX_PTHREAD_SEMANTICS */ +#endif /* !ACE_MT_SAFE || ACE_MT_SAFE == 1 */ + +#define ACE_HAS_PRIOCNTL + +// Platform supports ACE_TLI timod STREAMS module. +#define ACE_HAS_TIMOD_H + +// Platform supports ACE_TLI tiuser header. +#define ACE_HAS_TIUSER_H + +// Platform provides ACE_TLI function prototypes. +#define ACE_HAS_TLI_PROTOTYPES + +// Platform has broken t_error() prototype. +#define ACE_HAS_BROKEN_T_ERROR + +// Platform supports ACE_TLI. +#define ACE_HAS_TLI + +#define ACE_HAS_GETPAGESIZE 1 + +#define ACE_HAS_IDTYPE_T + +#define ACE_HAS_GPERF +#define ACE_HAS_DIRENT + +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_ISBLANK + +#if defined (__SUNPRO_CC) +# define ACE_CC_NAME ACE_TEXT ("SunPro C++") +# define ACE_CC_MAJOR_VERSION (__SUNPRO_CC >> 8) +# define ACE_CC_MINOR_VERSION (__SUNPRO_CC & 0x00ff) +# define ACE_CC_BETA_VERSION (0) +#elif defined (__GNUG__) +# define ACE_CC_MAJOR_VERSION __GNUC__ +# define ACE_CC_MINOR_VERSION __GNUC_MINOR__ +# define ACE_CC_BETA_VERSION (0) +# if __GNUC_MINOR__ >= 90 +# define ACE_CC_NAME ACE_TEXT ("egcs") +# else +# define ACE_CC_NAME ACE_TEXT ("g++") +# endif /* __GNUC_MINOR__ */ +#endif /* __GNUG__ */ + +#if defined (i386) && (_FILE_OFFSET_BITS==32) +# define ACE_HAS_X86_STAT_MACROS +#endif /* i386 && _FILE_OFFSET_BITS==32 */ + +#define ACE_MALLOC_ALIGN ((size_t)8) +#define ACE_LACKS_SETREUID_PROTOTYPE +#define ACE_LACKS_SETREGID_PROTOTYPE + +// Solaris does indeed implement the inet_aton() function, but it is +// found in `libresolv.*'. It doesn't seem worth it to link another +// library just for that function. Just use the emulation in ACE that +// has been used for years. +#define ACE_LACKS_INET_ATON + +// Solaris doesn't have wcstoull +#define ACE_LACKS_WCSTOLL +#define ACE_LACKS_WCSTOULL + +#if defined (_LARGEFILE_SOURCE) || (_FILE_OFFSET_BITS==64) +#undef ACE_HAS_PROC_FS +#undef ACE_HAS_PRUSAGE_T +#endif /* (_LARGEFILE_SOURCE) || (_FILE_OFFSET_BITS==64) */ + +#if defined (_POSIX_PTHREAD_SEMANTICS) || (_FILE_OFFSET_BITS == 64) || (_POSIX_C_SOURCE - 0 >= 199506L) +# define ACE_HAS_3_PARAM_READDIR_R +#endif + +// Sum of the iov_len values can't be larger then SSIZE_MAX +#define ACE_HAS_SOCK_BUF_SIZE_MAX + +#define ACE_LACKS_SETENV +#define ACE_LACKS_UNSETENV + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-sunos5.6.h b/externals/ace/config-sunos5.6.h new file mode 100644 index 0000000..d100627 --- /dev/null +++ b/externals/ace/config-sunos5.6.h @@ -0,0 +1,126 @@ +/* -*- C++ -*- */ +// $Id: config-sunos5.6.h 81935 2008-06-12 22:01:53Z jtc $ + +// The following configuration file is designed to work for SunOS 5.6 +// platforms using the SunC++ 4.x or g++ compilers. + +#ifndef ACE_CONFIG_H + +// ACE_CONFIG_H is defined by one of the following #included headers. + +// #include the SunOS 5.5 config file, then add SunOS 5.6 updates below. + +#include "ace/config-sunos5.5.h" + +#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || \ + defined (__EXTENSIONS__) +// The asctime_r/ctime_r parameters change at POSIX.1c-1995 +# if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199506L) +# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +# endif /* POSIX_C_SOURCE >= 199506L */ +# define ACE_HAS_SIGWAIT +// Hack 'cuz _POSIX_C_SOURCE > 2 and -DEXTENSIONS hides this. +# define ACE_LACKS_MADVISE_PROTOTYPE +#endif /* _POSIX_C_SOURCE > 2 || __EXTENSIONS__ */ + +// Support for the SunC++ 5.2 compiler. +// Do not undefine for compat mode < 5 +#if defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510 +#if defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT >= 5) +#ifdef ACE_LACKS_ACE_IOSTREAM +#undef ACE_LACKS_ACE_IOSTREAM +#endif /* ACE_LACKS_ACE_IOSTREAM */ +#endif /* defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT >= 5) */ + +#ifndef ACE_LACKS_UNBUFFERED_STREAMBUF +#define ACE_LACKS_UNBUFFERED_STREAMBUF 1 +#endif /* ACE_LACKS_UNBUFFERED_STREAMBUF */ +#ifndef ACE_TEMPLATES_REQUIRE_SOURCE +#define ACE_TEMPLATES_REQUIRE_SOURCE 1 +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ +#ifndef ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_HAS_TEMPLATE_TYPEDEFS 1 +#endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ +// Forte 7 seems to botch this one... +#if __SUNPRO_CC == 0x540 +#undef ACE_HAS_TEMPLATE_TYPEDEFS +#endif +#ifndef ACE_HAS_THR_C_DEST +#define ACE_HAS_THR_C_DEST 1 +#endif /* ACE_HAS_THR_C_DEST */ +#ifndef ACE_HAS_THR_C_FUNC +#define ACE_HAS_THR_C_FUNC 1 +#endif /* ACE_HAS_THR_C_FUNC */ +#ifndef ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 +#endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */ +#ifndef ACE_HAS_SIG_C_FUNC +#define ACE_HAS_SIG_C_FUNC 1 +#endif /* ACE_HAS_SIG_C_FUNC */ +#ifndef ACE_HAS_STDCPP_STL_INCLUDES +#define ACE_HAS_STDCPP_STL_INCLUDES 1 +#endif /* ACE_HAS_STDCPP_STL_INCLUDES */ +#ifndef ACE_HAS_STRING_CLASS +#define ACE_HAS_STRING_CLASS 1 +#endif /* ACE_HAS_STRING_CLASS */ +#ifndef ACE_HAS_STANDARD_CPP_LIBRARY +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ +#ifndef ACE_HAS_STDCPP_STL_INCLUDES +#define ACE_HAS_STDCPP_STL_INCLUDES 1 +#endif /* ACE_HAS_STDCPP_STL_INCLUDES */ +#ifndef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ +#ifndef ACE_LACKS_IOSTREAM_FX +#define ACE_LACKS_IOSTREAM_FX 1 +#endif /* ACE_LACKS_IOSTREAM_FX */ +#ifndef ACE_LACKS_LINEBUFFERED_STREAMBUF +#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +#endif /* ACE_LACKS_LINEBUFFERED_STREAMBUF */ + +#endif /* defined (__SUNPRO_CC) && __SUNPRO_CC > 0x510 */ + +// SunOS 5.6 and above support mkstemp +#undef ACE_LACKS_MKSTEMP + + +// SunOS 5.6 has AIO calls. +#if !defined (ACE_HAS_AIO_CALLS) +#define ACE_HAS_AIO_CALLS +#endif /* ACE_HAS_AIO_CALLS */ + +#if !defined (ACE_HAS_POSIX_REALTIME_SIGNALS) +#define ACE_HAS_POSIX_REALTIME_SIGNALS +#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ + +#if !defined (ACE_HAS_POSIX_MESSAGE_PASSING) +#define ACE_HAS_POSIX_MESSAGE_PASSING +#endif /* ACE_HAS_POSIX_MESSAGE_PASSING */ + +#if !defined (ACE_HAS_POSIX_SEM) +#define ACE_HAS_POSIX_SEM +#endif /* ACE_HAS_POSIX_SEM */ + +// Sunos 5.6's aio_* with RT signals is broken. +#if !defined (ACE_POSIX_AIOCB_PROACTOR) +#define ACE_POSIX_AIOCB_PROACTOR +#endif /* ACE_POSIX_AIOCB_PROACTOR */ + +// SunOS 5.6 has a buggy select +#define ACE_HAS_LIMITED_SELECT + +// SunOS 5.6 introduced shm_open, but need to turn on POSIX.1b or higher +// to pick it up. +#if defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE > 2) +# define ACE_HAS_SHM_OPEN +#else +# undef ACE_HAS_SHM_OPEN +#endif /* _POSIX_C_SOURCE > 2 */ + +// The struct msghdr is conditional on SunOS 5.6 based on _XPG4_2 +#if defined(_XPG4_2) +# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#endif /* _XPG4_2 */ + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-sunos5.7.h b/externals/ace/config-sunos5.7.h new file mode 100644 index 0000000..60e1d99 --- /dev/null +++ b/externals/ace/config-sunos5.7.h @@ -0,0 +1,78 @@ +/* -*- C++ -*- */ +// $Id: config-sunos5.7.h 80826 2008-03-04 14:51:23Z wotte $ + +// The following configuration file is designed to work for SunOS 5.7 +// (Solaris 7) platforms using the SunC++ 4.x, 5.x, or g++ compilers. + +#ifndef ACE_CONFIG_H + +// ACE_CONFIG_H is defined by one of the following #included headers. + +// #include the SunOS 5.6 config file, then add SunOS 5.7 updates below. + +#include "ace/config-sunos5.6.h" + +// This may be true for earlier Solaris versions, but I can only verify +// it for Solaris 7 and later. +#define ACE_HAS_VFWPRINTF +#if defined (ACE_HAS_SHM_OPEN) +# define ACE_SHM_OPEN_REQUIRES_ONE_SLASH +#endif + +// Sun began distributing with SunOS 5.7 +#define ACE_HAS_SYS_LOADAVG_H + +// SunOS 5.7 has getloadavg() +#undef ACE_LACKS_GETLOADAVG + +#if defined (ghs) + // SunOS 5.7's /usr/include/sys/procfs_isa.h needs uint64_t, + // but /usr/include/sys/int_types.h doesn't #define it because + // _NO_LONGLONG is # +# undef ACE_HAS_PROC_FS +# undef ACE_HAS_PRUSAGE_T + +#elif defined (__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) + // Wide character methods are in std:: when using SunCC 5.3 +# define ACE_WCHAR_IN_STD_NAMESPACE +#endif /* __GNUG__ || ghs */ + +// SunOS 5.7 supports SCHED_FIFO and SCHED_RR, as well as SCHED_OTHER. +#undef ACE_HAS_ONLY_SCHED_OTHER + +// SunOS 5.7 gets this right . . . +#undef ACE_HAS_BROKEN_T_ERROR + +// And doesn't need to set LWP priorities, as shown by +// performance-tests/Misc/preempt. +#undef ACE_NEEDS_LWP_PRIO_SET + +// SunOS 5.7 can support Real-Time Signals and POSIX4 AIO operations +// are supported. + +#if !defined (ACE_HAS_AIO_CALLS) +#define ACE_HAS_AIO_CALLS +#endif /* !ACE_HAS_AIO_CALLS */ + +#ifdef ACE_HAS_LIMITED_SELECT +#undef ACE_HAS_LIMITED_SELECT +#endif /* ACE_HAS_LIMITED_SELECT */ + +// SunOS 5.7 has socklen_t +#define ACE_HAS_SOCKLEN_T + +#if defined (__sparcv9) +#define _LP64 +#define ACE_SIZEOF_LONG 8 /* Needed to circumvent compiler bug #4294969 */ +#endif /* __sparcv9 */ + +#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) /* XPG4 or XPG4v2 */ +// 2 parameter wcstok() +#else /* XPG4 or XPG4v2 */ +# define ACE_HAS_3_PARAM_WCSTOK +#endif + +// Solaris 7 started to support /dev/poll +#define ACE_HAS_DEV_POLL + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-sunos5.8.h b/externals/ace/config-sunos5.8.h new file mode 100644 index 0000000..eb83e91 --- /dev/null +++ b/externals/ace/config-sunos5.8.h @@ -0,0 +1,39 @@ +/* -*- C++ -*- */ +// $Id: config-sunos5.8.h 80826 2008-03-04 14:51:23Z wotte $ + +// The following configuration file is designed to work for SunOS 5.8 +// (Solaris 8) platforms using the SunC++ 4.x, 5.x, 6.x, or g++ compilers. + +#ifndef ACE_CONFIG_H + +// ACE_CONFIG_H is defined by one of the following #included headers. + +// #include the SunOS 5.7 config, then add any SunOS 5.8 updates below. +#include "ace/config-sunos5.7.h" + +#undef ACE_WCHAR_IN_STD_NAMESPACE + +// This may be true for versions prior to Solaris 8 as well, but I don't +// have any to try it on. +#if !defined (ACE_HAS_TIMEZONE) +# define ACE_HAS_TIMEZONE +#endif + +// The range of thread priorities for 5.8 differs from 5.7 in the +// minimum priority for the SCHED_OTHER policy (i.e., +// ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) -20 + +# if defined (_POSIX_PTHREAD_SEMANTICS) +# ifdef ACE_LACKS_RWLOCK_T +# undef ACE_LACKS_RWLOCK_T +# endif /* ACE_LACKS_RWLOCK_T */ +# endif /* _POSIX_PTHREAD_SEMANTICS */ + +// This is no longer the case for Sun 5.9 onwards +# undef ACE_HAS_X86_STAT_MACROS + +// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses +#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-sunos5.9.h b/externals/ace/config-sunos5.9.h new file mode 100644 index 0000000..b8d0944 --- /dev/null +++ b/externals/ace/config-sunos5.9.h @@ -0,0 +1,18 @@ +/* -*- C++ -*- */ +// $Id: config-sunos5.9.h 84213 2009-01-22 15:45:13Z johnnyw $ + +// The following configuration file is designed to work for SunOS 5.9 +// (Solaris 9) platforms using the SunC++ 5.x (Forte 6 and 7), or g++ +// compilers. + +#ifndef ACE_CONFIG_H + +// ACE_CONFIG_H is defined by one of the following #included headers. + +// #include the SunOS 5.8 config, then add any SunOS 5.9 updates below. +#include "ace/config-sunos5.8.h" + +#define ACE_HAS_SENDFILE 1 +#define ACE_LACKS_THR_CONCURRENCY_FUNCS + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-tandem-nsk-mips-v2.h b/externals/ace/config-tandem-nsk-mips-v2.h new file mode 100644 index 0000000..6174727 --- /dev/null +++ b/externals/ace/config-tandem-nsk-mips-v2.h @@ -0,0 +1,394 @@ +// -*- C++ -*- +// +// $Id: config-tandem-nsk-mips-v2.h 87167 2009-10-19 19:33:53Z olli $ + +#ifndef ACE_CONFIG_NSK_H +#define ACE_CONFIG_NSK_H + +#include /**/ "ace/pre.h" + +// The following configuration file contains defines for Tandem NSK +// platform, MIPS processor, version 2 C++ compiler. + + +//========================================================================= +// Tandem NSK specific parts +//========================================================================= + + +// Disable pthread renaming of symbols such as "open" and "close" +#define _CMA_NOWRAPPERS_ 1 + +// Get Handle_Set.cpp to generate correct bit operations for NSK platform +#define ACE_TANDEM_NSK_BIT_ORDER + +// Use facilities provided by T1248 version of pthreads. +// (If not defined, will use old version of pthreads.) +#define ACE_TANDEM_T1248_PTHREADS + +// Use all available T1248 thread aware wrapper functions for providing +// non-blocking I/O. +// [@note this causes a significant performance degradation] +//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS + + +// Need this include here because some symbols defined by pthreads +// (e.g. timespec_t) are needed before spthread.h is normally included +// by ACE +#ifdef ACE_TANDEM_T1248_PTHREADS +#include +#else +#include "pthread.h" +#include "dce/cma_dispatch_coop.h" +#endif + +// The following #defines are hacks to get around things +// that seem to be missing or different in Tandem land +#define NSIG 32 // missing from Signal.h + // note: on nsk TNS/R there is room in + // sigset_t for 128 signals but those + // above 31 are not valid. +#define MAXNAMLEN 248 // missing from dirent.h +#define ERRMAX 4218 // from errno.h + +// Following seems to be missing from G06.20 version of standard +// pthreads includes (it appeared in older version of standard pthreads) +// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test) +#ifdef ACE_TANDEM_T1248_PTHREADS +typedef enum CMA_T_SCHED_POLICY { + cma_c_sched_fifo = 0, + cma_c_sched_rr = 1, + cma_c_sched_throughput = 2, + cma_c_sched_background = 3, + cma_c_sched_ada_low = 4 + } cma_t_sched_policy; +#endif + +// T1248 doesn't define these constants. They're defined in spt/cma.h +// (formerly dce/cma.h), but this header is not included or provided +// by T1248 G07-AAL. +#define cma_c_prio_fifo_min 16 +#define cma_c_prio_fifo_mid 24 +#define cma_c_prio_fifo_max 31 +#define cma_c_prio_rr_min 16 +#define cma_c_prio_rr_mid 24 +#define cma_c_prio_rr_max 31 +#define cma_c_prio_through_min 8 +#define cma_c_prio_through_mid 12 +#define cma_c_prio_through_max 15 +#define cma_c_prio_back_min 1 +#define cma_c_prio_back_mid 4 +#define cma_c_prio_back_max 7 + +// Enable NSK Pluggable Protocols +#define TAO_HAS_NSKPW 1 +#define TAO_HAS_NSKFS 1 + +//========================================================================= +// Platform specific parts +//========================================================================= + +// Platform lacks getpwnam_r() methods (e.g., SGI 6.2). +#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS + +// Platform/compiler lacks {get,set}rlimit() function +#define ACE_LACKS_RLIMIT + +// The platform doesn't have mmap(2) +#define ACE_LACKS_MMAP + +// Platform lacks streambuf "linebuffered ()". [C++ iostream] +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +// Platform supports recvmsg and sendmsg +#define ACE_HAS_MSG + +// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}. +#define ACE_LACKS_MSG_ACCRIGHTS + +// Platform supports sigsuspend() +#define ACE_HAS_SIGSUSPEND + +// Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +// Compiler/platform defines the sig_atomic_t typedef +#define ACE_HAS_SIG_ATOMIC_T + +// OS/compiler uses size_t * rather than int * for socket lengths +#define ACE_HAS_SIZET_SOCKET_LEN + +// OS/compiler uses void * arg 4 setsockopt() rather than const char * +#define ACE_HAS_VOIDPTR_SOCKOPT + +// The platform doesn't have mprotect(2) +#define ACE_LACKS_MPROTECT + +// Platform lacks msync() +#define ACE_LACKS_MSYNC + +// Platform does not support reentrant netdb functions (getprotobyname_r, +// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support + +// Platform lacks madvise() +#define ACE_LACKS_MADVISE + +// Platform lacks pri_t +#define ACE_LACKS_PRI_T + +// Platform lacks a working sbrk() +#define ACE_LACKS_SBRK + +// Platform doesn't have syscall() prototype +#define ACE_LACKS_SYSCALL + +// Platform lacks the inet_aton() function. +#define ACE_LACKS_INET_ATON + +// Compiler/platform has Dirent iterator functions +#define ACE_HAS_DIRENT + +// Platform uses ACE_HAS_DIRENT but does not have readdir_r() +#define ACE_LACKS_READDIR_R + +// Platform supports getpagesize() call (otherwise, +// ACE_PAGE_SIZE must be defined) +#define ACE_HAS_GETPAGESIZE + +// Platform supports IP multicast +#define ACE_HAS_IP_MULTICAST + +// Platform's select() uses non-const timeval* +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +// Platform supports POSIX O_NONBLOCK semantics +#define ACE_HAS_POSIX_NONBLOCK + +// Platform lacks named POSIX semaphores +#define ACE_LACKS_NAMED_POSIX_SEM + +// Platform has support for multi-byte character support compliant +// with the XPG4 Worldwide Portability Interface wide-character +// classification. +#define ACE_HAS_XPG4_MULTIBYTE_CHAR + +// No wcsstr function available for this compiler +#define ACE_LACKS_WCSSTR + +// No wctype.h available for this compiler +#define ACE_LACKS_WCTYPE_H + +// Platform supports the POSIX regular expression library. +// [Note Tandem NSK platform does have regular expresson support but it +// does not follow the assumptions made by ACE. To use it would need +// to make some ACE modifications.] +//#define ACE_HAS_REGEX + +// Platform doesn't have truncate() +#define ACE_LACKS_TRUNCATE + +// Platform lacks readers/writer locks. +#define ACE_LACKS_RWLOCK_T + +// Compiler's 'new' throws exception on failure (ANSI C++ behavior). +#define ACE_NEW_THROWS_EXCEPTIONS + +// Optimize ACE_Handle_Set::count_bits for select() operations (common +// case) +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// Platform lacks setreuid() +#define ACE_LACKS_SETREUID + +// Platform lacks setregid() +#define ACE_LACKS_SETREGID + +// Compile using multi-thread libraries +#define ACE_MT_SAFE 1 + + + +// Platform supports System V IPC +#define ACE_HAS_SYSV_IPC + +#define ACE_LACKS_SO_SNDBUF +#define ACE_LACKS_SO_RCVBUF + +// Platform lacks the socketpair() call +#define ACE_LACKS_SOCKETPAIR + +// Platform limits the maximum socket message size. +#define ACE_HAS_SOCK_BUF_SIZE_MAX + +// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion +#define ACE_HRTIME_T_IS_BASIC_TYPE + +// printf format specifiers for 64 bit integers +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Ld" +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" + +//========================================================================= +// Threads specific parts +//========================================================================= + +// Platform supports threads +#define ACE_HAS_THREADS + +// Platform supports POSIX Pthreads, of one form or another. This +// macro says the platform has a pthreads variety - should also define +// one of the below to say which one. Also may need some +// ACE_HAS_... thing for extensions. +#define ACE_HAS_PTHREADS + +// Standard pthreads supports only SCHED_FIFO +#define ACE_HAS_ONLY_SCHED_FIFO + +// Compiler/platform has thread-specific storage +#define ACE_HAS_THREAD_SPECIFIC_STORAGE + +// Platform has no implementation of pthread_condattr_setpshared(), +// even though it supports pthreads! +#define ACE_LACKS_CONDATTR_PSHARED + +// pthread_cond_timedwait does *not* reset the time argument when the +// lock is acquired. +#define ACE_LACKS_COND_TIMEDWAIT_RESET + +// Platform lacks pthread_attr_setsched() +#define ACE_LACKS_SETSCHED + +// Platform has pthread_mutexattr_setkind_np(). +#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP + +// Platform lacks pthread_mutexattr_setpshared(). +#define ACE_LACKS_MUTEXATTR_PSHARED + +// Platform lacks pthread_attr_setscope() +#define ACE_LACKS_THREAD_PROCESS_SCOPING + +// Platform lacks pthread_attr_setstackaddr +#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR + +// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has +// a definition for it. +#ifdef ACE_TANDEM_T1248_PTHREADS +#define ACE_HAS_UCONTEXT_T +#endif + +#define ACE_LACKS_FD_MASK + +//========================================================================= +// Include file characteristics +//========================================================================= + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +// Platform lacks malloc.h +#define ACE_LACKS_MALLOC_H + +// Platform lacks the siginfo.h include file +#define ACE_LACKS_SIGINFO_H + +// Platform doesn't define struct strrecvfd. +#define ACE_LACKS_STRRECVFD + +// Platform lacks the ucontext.h file +#define ACE_LACKS_UCONTEXT_H + +// Prototypes for both signal() and struct sigaction are consistent. +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Platform supports the POSIX struct timespec type +#define ACE_HAS_POSIX_TIME + +// Platform/compiler supports timezone * as second parameter to gettimeofday() +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +// Platform has (which contains bzero() prototype) +#define ACE_HAS_STRINGS 1 + + +// OS/compiler omits the const from the iovec parameter in the +// writev() prototype. +#define ACE_HAS_NONCONST_WRITEV + +// Platform lacks +#define ACE_LACKS_STDINT_H + +// Platform lacks +#define ACE_LACKS_INTTYPES_H + +// Platform lacks +#define ACE_LACKS_SYS_SELECT_H + +// Platform lacks +#define ACE_LACKS_DLFCN_H + +// Platform lacks +#define ACE_LACKS_SEMAPHORE_H + +// Platform lacks +#define ACE_LACKS_POLL_H + +//========================================================================= +// Compiler specific parts +//========================================================================= + +// Compiler supports C++ exception handling +#define ACE_HAS_EXCEPTIONS + +// Compiler/platform has correctly prototyped header files +#define ACE_HAS_CPLUSPLUS_HEADERS + +// Compiler/platform does not support the unsigned long long datatype. +#define ACE_LACKS_LONGLONG_T + +// Compiler supports the ssize_t typedef +#define ACE_HAS_SSIZE_T + +// Platform/compiler supports Standard C++ Library +#define ACE_HAS_STANDARD_CPP_LIBRARY 0 + +// Compiler's template mechanism must see source code (i.e., +// .cpp files). +#define ACE_TEMPLATES_REQUIRE_SOURCE + +// Compiler implements templates that support typedefs inside +// of classes used as formal arguments to a template class. +#define ACE_HAS_TEMPLATE_TYPEDEFS + +// Platform has its standard c++ library in the namespace std. +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 + +// Compiler doesn't support static data member templates +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES + +// Platform lacks "signed char" type (broken!) +// Following will not be needed if use standard c library (G06.20 and later) +#define ACE_LACKS_SIGNED_CHAR + +//========================================================================= +// Build options +//========================================================================= + +// Disable the inclusion of RCS ids in the generated code. +#define ACE_USE_RCSID 0 + +// For debugging problems in os calls (but this doesn't work too well +// since output is not interleaved properly with output from ACE_TRACE +//# define ACE_OS_TRACE(X) ::printf(X) + +// Uncomment the following if timed message blocks are needed (e.g. +// for Dynamic_Priority_Test. Otherwise leave this disabled because +// enabling it adds overhead to message blocks and timed message blocks +// are "rarely used." +//#define ACE_HAS_TIMED_MESSAGE_BLOCKS + +// Uncomment the following if tokens library is needed. +//#define ACE_HAS_TOKENS_LIBRARY + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_NSK_H */ diff --git a/externals/ace/config-tandem-nsk-mips-v3.h b/externals/ace/config-tandem-nsk-mips-v3.h new file mode 100644 index 0000000..e6c05a8 --- /dev/null +++ b/externals/ace/config-tandem-nsk-mips-v3.h @@ -0,0 +1,464 @@ +// -*- C++ -*- +// +// $Id: config-tandem-nsk-mips-v3.h 87167 2009-10-19 19:33:53Z olli $ + + +#ifndef ACE_CONFIG_NSK_H +#define ACE_CONFIG_NSK_H + +#include /**/ "ace/pre.h" + +// The following configuration file contains defines for Tandem NSK +// platform, MIPS processor, version 3 C++ compiler. + + +//========================================================================= +// Tandem NSK specific parts +//========================================================================= + + +// Disable pthread renaming of symbols such as "open" and "close" +#define _CMA_NOWRAPPERS_ 1 + +// Get Handle_Set.cpp to generate correct bit operations for NSK platform +#define ACE_TANDEM_NSK_BIT_ORDER + +// Use facilities provided by T1248 version of pthreads. +// (If not defined, will use old version of pthreads.) +#define ACE_TANDEM_T1248_PTHREADS + +// Use all available T1248 thread aware wrapper functions for providing +// non-blocking I/O. +// [Note: this causes a significant performance degradation] +//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS + + +// Need this include here because some symbols defined by pthreads +// (e.g. timespec_t) are needed before spthread.h is normally included +// by ACE +#ifdef ACE_TANDEM_T1248_PTHREADS +#include +#else +#include "pthread.h" +#include "dce/cma_dispatch_coop.h" +#endif + +// The following #defines are hacks to get around things +// that seem to be missing or different in Tandem land +#define NSIG 32 // missing from Signal.h + // note: on nsk TNS/R there is room in + // sigset_t for 128 signals but those + // above 31 are not valid. +#define MAXNAMLEN 248 // missing from dirent.h +#define ERRMAX 4218 // from errno.h + +// Following seems to be missing from G06.20 version of standard +// pthreads includes (it appeared in older version of standard pthreads) +// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test) +#ifdef ACE_TANDEM_T1248_PTHREADS +typedef enum CMA_T_SCHED_POLICY { + cma_c_sched_fifo = 0, + cma_c_sched_rr = 1, + cma_c_sched_throughput = 2, + cma_c_sched_background = 3, + cma_c_sched_ada_low = 4 + } cma_t_sched_policy; +#endif + +// T1248 doesn't define these constants. They're defined in spt/cma.h +// (formerly dce/cma.h), but this header is not included or provided +// by T1248 G07-AAL. +#define cma_c_prio_fifo_min 16 +#define cma_c_prio_fifo_mid 24 +#define cma_c_prio_fifo_max 31 +#define cma_c_prio_rr_min 16 +#define cma_c_prio_rr_mid 24 +#define cma_c_prio_rr_max 31 +#define cma_c_prio_through_min 8 +#define cma_c_prio_through_mid 12 +#define cma_c_prio_through_max 15 +#define cma_c_prio_back_min 1 +#define cma_c_prio_back_mid 4 +#define cma_c_prio_back_max 7 + +// Enable NSK Pluggable Protocols +#define TAO_HAS_NSKPW 1 +#define TAO_HAS_NSKFS 1 + +//========================================================================= +// Platform specific parts +//========================================================================= + +// Platform lacks getpwnam_r() methods (e.g., SGI 6.2). +#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS + +// Platform/compiler lacks {get,set}rlimit() function +#define ACE_LACKS_RLIMIT + +// The platform doesn't have mmap(2) +#define ACE_LACKS_MMAP + +// Platform lacks streambuf "linebuffered ()". [C++ iostream] +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +// Platform supports recvmsg and sendmsg +#define ACE_HAS_MSG + +// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}. +#define ACE_LACKS_MSG_ACCRIGHTS + +// Platform supports sigsuspend() +#define ACE_HAS_SIGSUSPEND + +// Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +// Compiler/platform defines the sig_atomic_t typedef +#define ACE_HAS_SIG_ATOMIC_T + +// OS/compiler uses size_t * rather than int * for socket lengths +#define ACE_HAS_SIZET_SOCKET_LEN + +// OS/compiler uses void * arg 4 setsockopt() rather than const char * +#define ACE_HAS_VOIDPTR_SOCKOPT + +// The platform doesn't have mprotect(2) +#define ACE_LACKS_MPROTECT + +// Platform lacks msync() +#define ACE_LACKS_MSYNC + +// Platform does not support reentrant netdb functions (getprotobyname_r, +// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support + +// Platform lacks madvise() +#define ACE_LACKS_MADVISE + +// Platform lacks pri_t +#define ACE_LACKS_PRI_T + +// Platform lacks a working sbrk() +#define ACE_LACKS_SBRK + +// Platform doesn't have syscall() prototype +#define ACE_LACKS_SYSCALL + +// Platform lacks the inet_aton() function. +#define ACE_LACKS_INET_ATON + +// Compiler/platform has Dirent iterator functions +#define ACE_HAS_DIRENT + +// Platform uses ACE_HAS_DIRENT but does not have readdir_r() +#define ACE_LACKS_READDIR_R + +// Platform supports getpagesize() call (otherwise, +// ACE_PAGE_SIZE must be defined) +#define ACE_HAS_GETPAGESIZE + +// Platform supports IP multicast +#define ACE_HAS_IP_MULTICAST + +// Platform's select() uses non-const timeval* +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +// Platform supports POSIX O_NONBLOCK semantics +#define ACE_HAS_POSIX_NONBLOCK + +// Platform lacks named POSIX semaphores +#define ACE_LACKS_NAMED_POSIX_SEM + +// Platform has support for multi-byte character support compliant +// with the XPG4 Worldwide Portability Interface wide-character +// classification. +#define ACE_HAS_XPG4_MULTIBYTE_CHAR + +// No wcsstr function available for this compiler +#define ACE_LACKS_WCSSTR + +// No wctype.h available for this compiler +#define ACE_LACKS_WCTYPE_H + +// Platform supports the POSIX regular expression library. +// [Note Tandem NSK platform does have regular expresson support but it +// does not follow the assumptions made by ACE. To use it would need +// to make some ACE modifications.] +//#define ACE_HAS_REGEX + +// Platform doesn't have truncate() +#define ACE_LACKS_TRUNCATE + +// Platform lacks readers/writer locks. +#define ACE_LACKS_RWLOCK_T + +// Compiler's 'new' throws exception on failure (ANSI C++ behavior). +#define ACE_NEW_THROWS_EXCEPTIONS + +// Optimize ACE_Handle_Set::count_bits for select() operations (common +// case) +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// Platform lacks setreuid() +#define ACE_LACKS_SETREUID + +// Platform lacks setregid() +#define ACE_LACKS_SETREGID + +// Compile using multi-thread libraries +#define ACE_MT_SAFE 1 + + + +// Platform supports System V IPC +#define ACE_HAS_SYSV_IPC + +#define ACE_LACKS_SO_SNDBUF +#define ACE_LACKS_SO_RCVBUF + +// Platform lacks the socketpair() call +#define ACE_LACKS_SOCKETPAIR + +// Platform limits the maximum socket message size. +#define ACE_HAS_SOCK_BUF_SIZE_MAX + +// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion +#define ACE_HRTIME_T_IS_BASIC_TYPE + +// printf format specifiers for 64 bit integers +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Ld" +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" + +// Use larger default buffer size for ease of interoperability +#define ACE_DEFAULT_CDR_BUFSIZE 4096 + +// Size of a wchar +#define ACE_SIZEOF_WCHAR 2 + +// Platform lacks time typedefs +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_USECONDS_T + +// Platform lacks setegid() and seteuid() +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID + +// Platform lacks vsnprintf() +#define ACE_LACKS_VSNPRINTF + +// Platform lacks log2() +#define ACE_LACKS_LOG2 + +// Platform lacks alphasort() +#define ACE_LACKS_ALPHASORT + +#define ACE_LACKS_FD_MASK +#define ACE_LACKS_NFDBITS + +//========================================================================= +// Threads specific parts +//========================================================================= + +// Platform supports threads +#define ACE_HAS_THREADS + +// Platform supports POSIX Pthreads, of one form or another. This +// macro says the platform has a pthreads variety - should also define +// one of the below to say which one. Also may need some +// ACE_HAS_... thing for extensions. +#define ACE_HAS_PTHREADS + +// Standard pthreads supports only SCHED_FIFO +#define ACE_HAS_ONLY_SCHED_FIFO + +// Compiler/platform has thread-specific storage +#define ACE_HAS_THREAD_SPECIFIC_STORAGE + +// Platform has no implementation of pthread_condattr_setpshared(), +// even though it supports pthreads! +#define ACE_LACKS_CONDATTR_PSHARED + +// pthread_cond_timedwait does *not* reset the time argument when the +// lock is acquired. +#define ACE_LACKS_COND_TIMEDWAIT_RESET + +// Platform lacks pthread_attr_setsched() +#define ACE_LACKS_SETSCHED + +// Platform has pthread_getschedparam and pthread_setschedparam +// even when ACE_LACKS_SETSCHED is defined. +#define ACE_HAS_PTHREAD_SCHEDPARAM + +// Platform has pthread_mutexattr_setkind_np(). +#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP + +// Platform lacks pthread_mutexattr_setpshared(). +#define ACE_LACKS_MUTEXATTR_PSHARED + +// Platform lacks pthread_attr_setscope() +#define ACE_LACKS_THREAD_PROCESS_SCOPING + +// Platform lacks pthread_attr_setstackaddr +#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR + +// Platform lacks pthread_attr_setstack +#define ACE_LACKS_PTHREAD_ATTR_SETSTACK + +// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has +// a definition for it. +#ifdef ACE_TANDEM_T1248_PTHREADS +#define ACE_HAS_UCONTEXT_T +#endif + +//========================================================================= +// Include file characteristics +//========================================================================= + +// Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +// Platform lacks malloc.h +#define ACE_LACKS_MALLOC_H + +// Platform lacks the siginfo.h include file +#define ACE_LACKS_SIGINFO_H + +// Platform doesn't define struct strrecvfd. +#define ACE_LACKS_STRRECVFD + +// Platform lacks the ucontext.h file +#define ACE_LACKS_UCONTEXT_H + +// Prototypes for both signal() and struct sigaction are consistent. +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Platform supports the POSIX struct timespec type +#define ACE_HAS_POSIX_TIME + +// Platform/compiler supports timezone * as second parameter to gettimeofday() +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +// Platform has (which contains bzero() prototype) +#define ACE_HAS_STRINGS 1 + + +// OS/compiler omits the const from the iovec parameter in the +// writev() prototype. +#define ACE_HAS_NONCONST_WRITEV + +// Platform lacks +#define ACE_LACKS_STDINT_H + +// Platform lacks +#define ACE_LACKS_INTTYPES_H + +// Platform lacks +#define ACE_LACKS_SYS_SELECT_H + +// Platform lacks +#define ACE_LACKS_DLFCN_H + +// Platform lacks +#define ACE_LACKS_SEMAPHORE_H + +// Platform lacks +#define ACE_LACKS_POLL_H + +// Platform lacks +#define ACE_LACKS_SYS_SYSCTL_H + +//========================================================================= +// Compiler specific parts +//========================================================================= + +// Compiler supports C++ exception handling +#define ACE_HAS_EXCEPTIONS 1 + +// Compiler/platform has correctly prototyped header files +#define ACE_HAS_CPLUSPLUS_HEADERS + +// Compiler/platform does not support the unsigned long long datatype. +#define ACE_LACKS_UNSIGNEDLONGLONG_T + +// Compiler supports the ssize_t typedef +#define ACE_HAS_SSIZE_T + +// Platform/compiler supports Standard C++ Library +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 + +// Compiler's template mechanism must see source code (i.e., +// .cpp files). +#define ACE_TEMPLATES_REQUIRE_SOURCE + +// Compiler implements templates that support typedefs inside +// of classes used as formal arguments to a template class. +#define ACE_HAS_TEMPLATE_TYPEDEFS + +// Platform/Compiler supports a String class +#define ACE_HAS_STRING_CLASS +#define ACE_HAS_STDCPP_STL_INCLUDES + +// Platform has its standard c++ library in the namespace std. +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 + +// Compiler doesn't support static data member templates +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES + +// Platform lacks "signed char" type (broken!) +// Following will not be needed if use standard c library (G06.20 and later) +#define ACE_LACKS_SIGNED_CHAR + +// Compiler can handle any operators in namespace +#define ACE_ANY_OPS_USE_NAMESPACE + +// Platform lacks intptr_t typedef +#define ACE_LACKS_INTPTR_T + +//========================================================================= +// C++ version3 import/export macros +//========================================================================= + +// Define the export macros needed to export symbols outside a DLL +// The ACE_IMPORT_SINGLETON_DECLARE macro has been modified to not explicitly +// instantiate the class template. +#if defined(USE_EXPLICIT_EXPORT) +#define ACE_LACKS_INLINE_FUNCTIONS + +#define ACE_HAS_CUSTOM_EXPORT_MACROS +#define ACE_Proper_Export_Flag export$ +#define ACE_Proper_Import_Flag import$ +#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class export$ T +#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class export$ SINGLETON_TYPE; +#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class import$ T +#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class import$ SINGLETON_TYPE ; +#endif + + +//========================================================================= +// Build options +//========================================================================= + +// Disable the inclusion of RCS ids in the generated code. +#define ACE_USE_RCSID 0 + +// For debugging problems in os calls (but this doesn't work too well +// since output is not interleaved properly with output from ACE_TRACE +//# define ACE_OS_TRACE(X) ::printf(X) + +// Uncomment the following if timed message blocks are needed (e.g. +// for Dynamic_Priority_Test. Otherwise leave this disabled because +// enabling it adds overhead to message blocks and timed message blocks +// are "rarely used." +//#define ACE_HAS_TIMED_MESSAGE_BLOCKS + +// Uncomment the following if tokens library is needed. +//#define ACE_HAS_TOKENS_LIBRARY + +// NonStop CORBA uses the XML Service Configurator +#define ACE_HAS_XML_SVC_CONF + +#define ACE_LD_SEARCH_PATH "_RLD_LIB_PATH" + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_NSK_H */ diff --git a/externals/ace/config-tandem.h b/externals/ace/config-tandem.h new file mode 100644 index 0000000..145c20a --- /dev/null +++ b/externals/ace/config-tandem.h @@ -0,0 +1,191 @@ +/* -*- C++ -*- */ +// Testing TANDEM +// $Id: config-tandem.h 87167 2009-10-19 19:33:53Z olli $ + +// The following configuration file is designed to work for Tandems NonStop-UX +// 4.2MP platforms using the NCC 3.20 compiler. + +// Note this is a test version it might include several errors I +// have done a test and set/unset until I errors disappered. +// Some of the options that should be set aren't because of the simple fact +// that i haven't the time to check what is wrong. +// e.g. widecharacter are supported but a wcstok which only take 2 parameters +// are included by the compiler, to get the correct wcstok that takes 3 params +// we must set _XOPEN_SOURCE and we get ALOT of errors and warnings. +// So this config is done to get things to start to work it isn't finished. +// Janne (Jan.Perman@osd.Ericsson.se) + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H +#include /**/ "ace/pre.h" + +#if ! defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +#define ACE_HAS_IDTYPE_T +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// Tandem doesn't include this although they are defined +// in sys/time.h and sys/resource.h +#define ACE_LACKS_RLIMIT_PROTOTYPE // jjpp +// Tandem has a function to set t_errno (set_t_errno) +#define ACE_HAS_SET_T_ERRNO // jjpp + +//Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +// OS/compiler omits the const from the sendmsg() prototype. +#define ACE_HAS_NONCONST_SENDMSG + +//Platform supports system configuration information +#define ACE_HAS_SYS_SYSTEMINFO_H +#define ACE_HAS_SYSV_SYSINFO + +//Platform supports the POSIX regular expression library +#define ACE_HAS_REGEX + +// Platform supports recvmsg and sendmsg +#define ACE_HAS_MSG + +//Compiler/platform contains the file. +#define ACE_HAS_SYS_SYSCALL_H + +//Platform provides header +#define ACE_HAS_SYSENT_H + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +//Platform supports POSIX O_NONBLOCK semantics +#define ACE_HAS_POSIX_NONBLOCK + +// Compiler/platform has correctly prototyped header files +#define ACE_HAS_CPLUSPLUS_HEADERS + +//Compiler/platform supports alloca() +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA + +//Compiler/platform has +#define ACE_HAS_ALLOCA_H + +//Platform contains +#define ACE_HAS_POLL + +// Platform supports the POSIX struct timespec type +#define ACE_HAS_POSIX_TIME // As i understand it, but i'm in deep water +//Platform supports the SVR4 timestruc_t type + +// To get this to work a patch in sys/signal must be made +// typedef void SIG_FUNC_TYPE(int); +//#if defined (__cplusplus) +// void (*sa_handler)(int); +//#else +// ... +//#endif +//#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_TANDEM_SIGNALS +//Compiler/platform defines the sig_atomic_t typedef +#define ACE_HAS_SIG_ATOMIC_T +//Platform supports SVR4 extended signals +#define ACE_HAS_SIGINFO_T +//Platform supports ucontext_t (which is used in the extended signal API). +#define ACE_HAS_UCONTEXT_T + +// Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +//Compiler/platform provides the sockio.h file +#define ACE_HAS_SYS_SOCKIO_H + +// Compiler supports the ssize_t typedef +#define ACE_HAS_SSIZE_T // Limits.h must be included + +//Platform supports STREAMS +#define ACE_HAS_STREAMS + +#define ACE_HAS_STREAM_PIPES +//Platform supports STREAM pipes + +//Compiler/platform supports struct strbuf +#define ACE_HAS_STRBUF_T + +//Compiler/platform supports SVR4 dynamic linking semantics +#define ACE_HAS_SVR4_DYNAMIC_LINKING + +//Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... +#define ACE_HAS_SVR4_TLI + +//Platform provides header +#define ACE_HAS_SYS_FILIO_H + +//Platform supports TLI timod STREAMS module +#define ACE_HAS_TIMOD_H +//Platform supports TLI tiuser header +#define ACE_HAS_TIUSER_H + +//Platform supports TLI +#define ACE_HAS_TLI +//Platform provides TLI function prototypes +#define ACE_HAS_TLI_PROTOTYPES + +//Platform lacks streambuf "linebuffered ()". +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +// Platform lacks "signed char" type (broken!) +#define ACE_LACKS_SIGNED_CHAR + + +#define ACE_PAGE_SIZE 4096 +// Defines the page size of the system (not used on Win32 or +// with ACE_HAS_GETPAGESIZE). + +/****** THREAD SPECIFIC **********/ +/* If you want to remove threading then comment out the following four #defines .*/ +#if !defined (ACE_MT_SAFE) + #define ACE_MT_SAFE 1 //Compile using multi-thread libraries +#endif +#define ACE_HAS_THREADS //Platform supports threads +#define ACE_HAS_STHREADS //Platform supports Solaris threads + +// Compiler/platform has threadspecific storage +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +//Platform supports thr_keydelete (e.g,. UNIXWARE) + +#define ACE_HAS_THR_MINSTACK // Tandem uses thr_minstack instead of thr_min_stack +#define ACE_LACKS_PRI_T // Tandem lacks pri_t +#define ACE_HAS_THR_KEYDELETE + +//************************************* + +/*********************************/ + +/******* SIGNAL STUFF *******/ + +//Platform uses non-const char * in calls to gethostbyaddr, gethostbyname, +// getservbyname +#define ACE_HAS_NONCONST_GETBY +#define ACE_HAS_NONCONST_INET_ADDR +// Platform's select() uses non-const timeval* (only found on Linux right now) +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +// And on Tandem :-) +//Uses ctime_r & asctime_r with only two parameters vs. three. +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +//Platform has special header for select(). +#define ACE_HAS_SELECT_H +// Platform/compiler supports Standard C++ Library +#define ACE_HAS_STANDARD_CPP_LIBRARY +//Platform lacks madvise() (e.g., Linux) +#define ACE_LACKS_MADVISE +//Compiler/platform lacks strcasecmp() (e.g., DG/UX, UNIXWARE, VXWORKS) +#define ACE_LACKS_STRCASECMP + +// Defines the page size of the system. +#define ACE_PAGE_SIZE 4096 + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-tru64.h b/externals/ace/config-tru64.h new file mode 100644 index 0000000..45a7aa6 --- /dev/null +++ b/externals/ace/config-tru64.h @@ -0,0 +1,151 @@ +/* -*- C++ -*- */ +// $Id: config-tru64.h 87270 2009-10-29 21:47:47Z olli $ + +// The following configuration file is designed to work for the +// Digital UNIX V4.0a and later platforms. It relies on +// config-osf1-4.0.h, and adds deltas for newer platforms. + +#ifndef ACE_CONFIG_TRU64_H +#define ACE_CONFIG_TRU64_H +#include /**/ "ace/pre.h" + +#if !defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +// Compile using multi-thread libraries. +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif /* ! ACE_MT_SAFE */ + +/*clearerr is not defined when _REENTRANT is not defined*/ +#if ACE_MT_SAFE == 0 +#define ACE_LACKS_CLEARERR +#endif /* ACE_MT_SAFE == 0 */ + +#include "ace/config-posix.h" + +// Configuration-specific #defines: +// 1) g++ or cxx +// 2) pthreads or DCE threads +#if defined (__GNUG__) + // g++ with pthreads + + // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so + // this must appear before its #include. +# define ACE_HAS_STRING_CLASS + +# include "ace/config-g++-common.h" + +# define ACE_HAS_REENTRANT_FUNCTIONS +#elif defined (__DECCXX) + +# define ACE_CONFIG_INCLUDE_CXX_COMMON +# include "ace/config-cxx-common.h" + +#elif defined (__rational__) +# define ACE_HAS_REENTRANT_FUNCTIONS +# define ACE_HAS_STRING_CLASS +# define ACE_LACKS_LINEBUFFERED_STREAMBUF +# define ACE_LACKS_SIGNED_CHAR + + // Exceptions are enabled by platform_osf1_4.0_rcc.GNU. +# define ACE_HAS_STDCPP_STL_INCLUDES +#else +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler on Digital Unix +# endif /* __cplusplus */ +#endif /* ! __GNUG__ && ! __DECCXX && ! __rational__ */ + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_BROKEN_IF_HEADER +#if (ACE_MT_SAFE != 0) +# define ACE_HAS_PTHREADS +# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#endif /* ACE_MT_SAFE != 0 */ +#define ACE_LACKS_T_ERRNO +#if !defined (DIGITAL_UNIX) +# define DIGITAL_UNIX 0x400 +#endif /* ! DIGITAL_UNIX */ + +#define ACE_SIZEOF_LONG 8 + +#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_NONCONST_SETRLIMIT +#define ACE_HAS_BROKEN_T_ERROR +#define ACE_HAS_NONCONST_WRITEV +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_CPLUSPLUS_HEADERS +#define ACE_HAS_DIRENT +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GPERF +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_LLSEEK +#define ACE_HAS_LONG_MAP_FAILED +#define ACE_HAS_MSG +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONCONST_SENDMSG +#define ACE_HAS_OSF1_GETTIMEOFDAY +#define ACE_HAS_OSF_TIMOD_H +#define ACE_HAS_POLL +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_PRIOCNTL +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STRBUF_T +#define ACE_HAS_STREAMS +#define ACE_HAS_STRPTIME +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_SVR4_SIGNAL_T +#define ACE_HAS_SYS_SYSCALL_H +#define ACE_HAS_SYSV_IPC +#if (ACE_MT_SAFE == 0) +// clearerr is not defined when _REENTRANT is not defined +#define ACE_LACKS_CLEARERR +#else /* ACE_MT_SAFE != 0 */ +#define ACE_HAS_THREADS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR +#endif /* ACE_MT_SAFE != 0 */ +#define ACE_HAS_TIUSER_H +#define ACE_HAS_XTI +#define ACE_HAS_TLI_PROTOTYPES +#define ACE_HAS_UALARM +#define ACE_HAS_UCONTEXT_T +#define ACE_LACKS_PRI_T +#define ACE_LACKS_RWLOCK_T +#define ACE_PAGE_SIZE 8192 +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND + +// DJT 6/10/96 All these broken macro's can now be removed with the +// approporiate ordering of the include files. The Platinum release +// now temporarily supports both forms. Platform's implementation of +// sendmsg() has a non-const msgheader parameter. +#define ACE_HAS_NONCONST_SENDMSG +#define ACE_HAS_IDTYPE_T +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#if DIGITAL_UNIX >= 0x500 +# define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 +#endif /* DIGITAL_UNIX >= 0x500 */ + +#if DIGITAL_UNIX >= 0x40E +# define ACE_LACKS_STDINT_H +#endif /* DIGITAL_UNIX >= 0x40E */ + +#if (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) +#define ACE_LACKS_PREAD_PROTOTYPE +#endif /* (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) */ + +// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses +#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_TRU64_H */ diff --git a/externals/ace/config-unixware-7.1.0.h b/externals/ace/config-unixware-7.1.0.h new file mode 100644 index 0000000..820e7fb --- /dev/null +++ b/externals/ace/config-unixware-7.1.0.h @@ -0,0 +1,406 @@ +/* -*- C++ -*- */ +// $Id: config-unixware-7.1.0.h 87268 2009-10-29 21:06:06Z olli $ + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H + +/* ACE configuration header file */ + +/* Include the commong gnu config file */ +#include "config-g++-common.h" + +/* For unixware 7.1 && g++ 2.91.57, see if this fixes my problem */ +#ifndef UNIXWARE_7_1 +#define UNIXWARE_7_1 +#endif + +/* Define if you have alloca, as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define if you have the strftime function. */ +#define HAVE_STRFTIME 1 + +/* Define if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if lex declares yytext as a char * by default, not a char[]. */ +#define YYTEXT_POINTER 1 + +/* Define _REENTRANT if reentrant functions should be used. */ +#ifndef _REENTRANT +# define _REENTRANT 1 +#endif + +#define ACE_HAS_NEW_NO_H 1 +#define ACE_HAS_STDEXCEPT_NO_H 1 + +#define ACE_THREAD_MIN_PRIORITY 0 +#if defined (ACE_THREAD_MIN_PRIORITY) +# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY +#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */ + +#define ACE_THREAD_MAX_PRIORITY 99 +#if defined (ACE_THREAD_MAX_PRIORITY) +# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY +#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */ + +/* Specify sizes of given built-in types. If a size isn't defined here, + then ace/Basic_Types.h will attempt to deduce the size. */ +/* #undef ACE_SIZEOF_CHAR */ +#define ACE_SIZEOF_SHORT 2 +#define ACE_SIZEOF_INT 4 +#define ACE_SIZEOF_LONG 4 +#define ACE_SIZEOF_LONG_LONG 8 +#define ACE_SIZEOF_VOID_P 4 +#define ACE_SIZEOF_FLOAT 4 +#define ACE_SIZEOF_DOUBLE 8 +#define ACE_SIZEOF_LONG_DOUBLE 12 + +/* Enable ACE inlining */ +#define __ACE_INLINE__ 1 + +/* OS has priocntl (2) */ +#define ACE_HAS_PRIOCNTL 1 + +/* Platform has pread() and pwrite() support */ +#define ACE_HAS_P_READ_WRITE 1 + +/* Compiler/platform supports alloca() */ +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA 1 + +/* Compiler/platform correctly calls init()/fini() for shared libraries */ +#define ACE_HAS_AUTOMATIC_INIT_FINI 1 + +/* Platform doesn't cast MAP_FAILED to a (void *). */ +/* #undef ACE_HAS_BROKEN_MAP_FAILED */ +/* Staller: oh yes, let's do this! */ +#define ACE_HAS_BROKEN_MAP_FAILED + +/* Prototypes for both signal() and struct sigaction are consistent. */ +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 + +/* Platform supports operations on directories via struct dirent, + readdir_r, etc. */ +#define ACE_HAS_DIRENT 1 + +/* Compiler supports C++ exception handling */ +// MM-Graz if ! defined inserted, to prevent warnings, because it is already +// defined in config-g++common.h +# if !defined (ACE_HAS_EXCEPTIONS) +#define ACE_HAS_EXCEPTIONS 1 +# endif + +/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be + defined, except on Win32) */ +#define ACE_HAS_GETPAGESIZE 1 + +/* Platform supports the getrusage() system call. */ +#define ACE_HAS_GETRUSAGE 1 + +/* Platform has a getrusage () prototype in sys/resource.h that differs from + the one in ace/OS.i. */ +#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 + +/* The GPERF utility is compiled for this platform */ +#define ACE_HAS_GPERF 1 + +/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */ +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 + +/* Compiler/platform supports idtype_t. */ +#define ACE_HAS_IDTYPE_T 1 + +/* Platform supports IP multicast */ +#define ACE_HAS_IP_MULTICAST 1 + +/* Platform supports thr_keydelete (e.g,. UNIXWARE) */ +#define ACE_HAS_THR_KEYDELETE 1 + +/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */ +#define ACE_HAS_THR_MINSTACK 1 + +/* Platform supports recvmsg and sendmsg */ +#define ACE_HAS_MSG 1 + +/* Platform's select() uses non-const timeval* (only found on Linux right + now) */ +#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 + +/* Uses ctime_r & asctime_r with only two parameters vs. three. */ +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 + +/* Platform is an Intel Pentium microprocessor. */ +/* There is a problem with the gethrtime() because of (apparently) a problem + with the inline assembly instruction. Hopefully there is a way to resolve + that with an improvement to the assembler +*/ +#ifdef ACE_HAS_PENTIUM +#undef ACE_HAS_PENTIUM +#endif /* ACE_HAS_PENTIUM */ + + +/* Platform contains */ +#define ACE_HAS_POLL 1 + +/* Platform supports POSIX O_NONBLOCK semantics */ +#define ACE_HAS_POSIX_NONBLOCK 1 + +/* Platform supports the POSIX struct timespec type */ +#define ACE_HAS_POSIX_TIME 1 + +/* Platform supports the /proc file system and defines tid_t + in */ +#define ACE_HAS_PROC_FS 1 + +/* Platform supports POSIX Threads */ +#define ACE_HAS_PTHREADS 1 + +/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and + PTHREAD_PROCESS_SHARED values */ +#define ACE_HAS_PTHREAD_PROCESS_ENUM 1 + +/* Platform will recurse infinitely on thread exits from TSS cleanup routines + (e.g., AIX) */ +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 + +/* Platform supports reentrant functions (i.e., all the POSIX *_r + functions). */ +#define ACE_HAS_REENTRANT_FUNCTIONS 1 + +/* Platform has support for multi-byte character support compliant with the + XPG4 Worldwide Portability Interface wide-character classification. */ +#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 + +/* Platform does not support reentrant netdb functions (getprotobyname_r, + getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */ +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 + +/* Platform supports the POSIX regular expression library */ +#define ACE_HAS_REGEX 1 + +/* Platform has special header for select(). */ +#define ACE_HAS_SELECT_H 1 + +/* Platform has a function to set t_errno (e.g., Tandem). */ +#define ACE_HAS_SET_T_ERRNO 1 + +/* Platform supports SVR4 extended signals */ +#define ACE_HAS_SIGINFO_T 1 + +/* Platform/compiler has the sigwait(2) prototype */ +#define ACE_HAS_SIGWAIT 1 + +/* Compiler/platform defines the sig_atomic_t typedef */ +#define ACE_HAS_SIG_ATOMIC_T 1 + +/* Platform supports new BSD inet_addr len field. */ +#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 + +/* OS/compiler uses size_t * rather than int * for socket lengths */ +#define ACE_HAS_SIZET_SOCKET_LEN 1 + +/* Compiler/platform provides the sys/sockio.h file */ +#define ACE_HAS_SYS_SOCKIO_H 1 + +/* Compiler supports the ssize_t typedef */ +#define ACE_HAS_SSIZE_T 1 + +/* Platform supports UNIX International Threads */ +#define ACE_HAS_STHREADS 1 + +/* Platform has thr_yield() */ +#define ACE_HAS_THR_YIELD 1 + +/* Compiler/platform supports struct strbuf */ +#define ACE_HAS_STRBUF_T 1 + +/* Platform supports STREAMS */ +#define ACE_HAS_STREAMS 1 + +/* Platform supports STREAM pipes */ +#define ACE_HAS_STREAM_PIPES 1 + +/* Platform/Compiler supports a String class (e.g., GNU or Win32). */ +#define ACE_HAS_STRING_CLASS 1 + +/* Platform has (which contains bzero() prototype) */ +#define ACE_HAS_STRINGS 1 + +/* Platform/compiler supports void * as second parameter to gettimeofday(). */ +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1 + +/* Compiler/platform supports SVR4 dynamic linking semantics */ +#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 + +/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */ +#define ACE_HAS_SVR4_TLI 1 + +/* Compiler/platform contains the file. */ +#define ACE_HAS_SYS_SYSCALL_H 1 + +/* Platform supports system configuration information */ +#define ACE_HAS_SYS_SYSTEMINFO_H +#define ACE_HAS_SYSV_SYSINFO 1 + +/* Platform supports System V IPC (most versions of UNIX, but not Win32) */ +#define ACE_HAS_SYSV_IPC 1 + +/* Platform provides header */ +#define ACE_HAS_SYS_FILIO_H 1 + +/* Platform provides header */ +#define ACE_HAS_SYS_XTI_H 1 + +/* Platform has POSIX terminal interface. */ +#define ACE_HAS_TERMIOS 1 + +/* Platform supports threads */ +#define ACE_HAS_THREADS 1 + +/* Compiler/platform has thread-specific storage */ +#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 + +/* Platform supports TLI timod STREAMS module */ +#define ACE_HAS_TIMOD_H 1 + +/* Platform supports TLI tiuser header */ +#define ACE_HAS_TIUSER_H 1 + +/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */ +#define ACE_HAS_TLI 1 + +/* Platform provides TLI function prototypes */ +#define ACE_HAS_TLI_PROTOTYPES 1 + +/* Platform supports ualarm() */ +#define ACE_HAS_UALARM 1 + +/* Platform supports ucontext_t (which is used in the extended signal API). */ +#define ACE_HAS_UCONTEXT_T 1 + +/* Platform has header file */ +#define ACE_HAS_UTIME 1 + +/* Platform requires void * for mmap(). */ +#define ACE_HAS_VOIDPTR_MMAP 1 + +/* Platform has XTI (X/Open-standardized superset of TLI). Implies + ACE_HAS_TLI but uses a different header file. */ +#define ACE_HAS_XTI 1 + +/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily + mean that the platform does not support iostreams. */ +#define ACE_LACKS_ACE_IOSTREAM 1 + +/* Platform does not have u_longlong_t typedef */ +#define ACE_LACKS_U_LONGLONG_T 1 + +/* Platform lacks madvise() (e.g., Linux) */ +#define ACE_LACKS_MADVISE 1 + +/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ +#define ACE_LACKS_PRI_T 1 + +/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */ +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 + +/* Platfrom lack pthread_yield() support. */ +#define ACE_LACKS_PTHREAD_YIELD 1 + +/* Platform lacks readers/writer locks. */ +#define ACE_LACKS_RWLOCK_T 1 + +/* MIT pthreads platform lacks the timedwait prototypes */ +#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 + +/* Platform does not define timepec_t as a typedef for struct timespec. */ +#define ACE_LACKS_TIMESPEC_T 1 + +/* Compile using multi-thread libraries */ +#define ACE_MT_SAFE 1 + +/* Platform needs to #include to get thread scheduling defs. */ +#define ACE_NEEDS_SCHED_H 1 + +/*********************************************************************/ +/* Compiler's template mechanim must see source code (i.e., .cpp files). This + is used for GNU G++. */ +/* Staller -> make 0 */ +// #undef ACE_TEMPLATES_REQUIRE_SOURCE + +/*********************************************************************/ + +/* The OS/platform supports the poll() event demultiplexor */ +#define ACE_USE_POLL 1 + +/* Platform has its standard c++ library in the namespace std. */ +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 + +/* The number of bytes in a double. */ +#define SIZEOF_DOUBLE 8 + +/* The number of bytes in a float. */ +#define SIZEOF_FLOAT 4 + +/* The number of bytes in a int. */ +#define SIZEOF_INT 4 + +/* The number of bytes in a long. */ +#define SIZEOF_LONG 4 + +/* The number of bytes in a long double. */ +#define SIZEOF_LONG_DOUBLE 12 + +/* The number of bytes in a long long. */ +#define SIZEOF_LONG_LONG 8 + +/* The number of bytes in a short. */ +#define SIZEOF_SHORT 2 + +/* The number of bytes in a signed char. */ +#define SIZEOF_SIGNED_CHAR 1 + +/* The number of bytes in a void *. */ +#define SIZEOF_VOID_P 4 + +/* Define if you have the execv function. */ +#define HAVE_EXECV 1 + +/* Define if you have the execve function. */ +#define HAVE_EXECVE 1 + +/* Define if you have the execvp function. */ +#define HAVE_EXECVP 1 + +/* Define if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_IOMANIP 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Name of package */ +#define PACKAGE "ace" + +/* Added by Staller */ +#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h +#define howmany(x, y) (((x)+((y)-1))/(y)) +#define ACE_HAS_BROKEN_T_ERROR // make a nasty warning disappear in OS.i +#define __USLC__ 1 +#define __IOCTL_VERSIONED__ // By Carlo! + +#endif /* ACE_CONFIG_H */ diff --git a/externals/ace/config-unixware-7.1.0.udk.h b/externals/ace/config-unixware-7.1.0.udk.h new file mode 100644 index 0000000..ec668c1 --- /dev/null +++ b/externals/ace/config-unixware-7.1.0.udk.h @@ -0,0 +1,457 @@ +/* -*- C++ -*- */ +#ifndef ACE_CONFIG_UNIXWARE_UDK_H +#define ACE_CONFIG_UNIXWARE_UDK_H + +// $Id: config-unixware-7.1.0.udk.h 87167 2009-10-19 19:33:53Z olli $ + +// Configuration for the unixware UDK compiler. derived from the unixware/g++ config +// which was itself derived from an autoconfig run. + +/* ACE configuration header file */ + +#define ACE_TEMPLATES_REQUIRE_SOURCE + +#ifndef UNIXWARE_7_1 +#define UNIXWARE_7_1 +#endif + +#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE + +/* Define if you have the strftime function. */ +#define HAVE_STRFTIME 1 + +/* Define if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if lex declares yytext as a char * by default, not a char[]. */ +#define YYTEXT_POINTER 1 + +/* Define _REENTRANT if reentrant functions should be used. */ +#ifndef _REENTRANT +# define _REENTRANT 1 +#endif + +#define ACE_HAS_NEW_NO_H 1 +#define ACE_HAS_STDEXCEPT_NO_H 1 + +/* + * TODO: These two next #defines have an #undef before them, in + * case the variable being defined already had a value. + * The #undefs are being picked up by configure, and are commented out! + */ +#define ACE_THREAD_MIN_PRIORITY 0 +#if defined (ACE_THREAD_MIN_PRIORITY) +/* # undef PTHREAD_MIN_PRIORITY */ +# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY +#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */ + +#define ACE_THREAD_MAX_PRIORITY 99 +#if defined (ACE_THREAD_MAX_PRIORITY) +/* # undef PTHREAD_MAX_PRIORITY */ +# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY +#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */ + + + +/* UnixWare specific configuration parameters */ +/* #undef UNIXWARE */ +/* #undef UNIXWARE_2_0 */ +/* #undef UNIXWARE_2_1 */ + +/* Specify sizes of given built-in types. If a size isn't defined here, + then ace/Basic_Types.h will attempt to deduce the size. */ +/* #undef ACE_SIZEOF_CHAR */ +#define ACE_SIZEOF_SHORT 2 +#define ACE_SIZEOF_INT 4 +#define ACE_SIZEOF_LONG 4 +#define ACE_SIZEOF_LONG_LONG 8 +#define ACE_SIZEOF_VOID_P 4 +#define ACE_SIZEOF_FLOAT 4 +#define ACE_SIZEOF_DOUBLE 8 +#define ACE_SIZEOF_LONG_DOUBLE 12 + +/* Enable ACE inlining */ +#define __ACE_INLINE__ 1 + +/* Platform supports Asynchronous IO calls */ +/* #define ACE_HAS_AIO_CALLS */ + +/* Specify this if you don't want threads to inherit parent thread's + ACE_Log_Msg properties. */ +/* #undef ACE_THREADS_DONT_INHERIT_LOG_MSG */ + +/* OS has priocntl (2) */ +#define ACE_HAS_PRIOCNTL 1 + +/* Platform has pread() and pwrite() support */ +#define ACE_HAS_P_READ_WRITE 1 + +/* Compiler/platform correctly calls init()/fini() for shared libraries */ +#define ACE_HAS_AUTOMATIC_INIT_FINI 1 + +/* Compiler handles explicit calling of template destructor correctly. + See "ace/OS.h" for details. */ +/* Staller: already defined by config-g++-common.h +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1 +*/ + +/* Platform doesn't cast MAP_FAILED to a (void *). */ +/* #undef ACE_HAS_BROKEN_MAP_FAILED */ +/* Staller: oh yes, let's do this! */ +#define ACE_HAS_BROKEN_MAP_FAILED + + +/* Prototypes for both signal() and struct sigaction are consistent. */ +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 + +/* Compiler/platform has correctly prototyped header files */ +#define ACE_HAS_CPLUSPLUS_HEADERS + +/* Platform supports operations on directories via struct dirent, + readdir_r, etc. */ +#define ACE_HAS_DIRENT + +/* Compiler supports C++ exception handling */ +# if !defined (ACE_HAS_EXCEPTIONS) +#define ACE_HAS_EXCEPTIONS +# endif + +/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be + defined, except on Win32) */ +#define ACE_HAS_GETPAGESIZE + +/* Platform supports the getrusage() system call. */ +#define ACE_HAS_GETRUSAGE + +/* Platform has a getrusage () prototype in sys/resource.h that differs from + the one in ace/OS.i. */ +#define ACE_HAS_GETRUSAGE_PROTOTYPE + +/* The GPERF utility is compiled for this platform */ +#define ACE_HAS_GPERF + +/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */ +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 + +/* Compiler/platform supports SunOS high resolution timers */ +/* #undef ACE_HAS_HI_RES_TIMER */ + +/* Compiler/platform supports idtype_t. */ +#define ACE_HAS_IDTYPE_T + +/* Inline all the static class OS methods to remove call overhead */ +/* Note: This gets defined by OS.h if __ACE_INLINE__ is defined */ +/* #undef ACE_HAS_INLINED_OSCALLS */ + +/* Platform supports IP multicast */ +#define ACE_HAS_IP_MULTICAST + +/* Platform supports thr_keydelete (e.g,. UNIXWARE) */ +#define ACE_HAS_THR_KEYDELETE + +/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */ +#define ACE_HAS_THR_MINSTACK + +/* Some files, such as ace/streams.h, want to include new style C++ stream + headers. These headers are iomanip, ios, iostream, istream, ostream, + fstream and streambuf. If _all_ of these headers aren't available, then + assume that only iostream.h and fstream.h are available. */ +/* #define ACE_USES_OLD_IOSTREAMS */ + +/* Platform supports recvmsg and sendmsg */ +#define ACE_HAS_MSG + +/* Platform's select() uses non-const timeval* (only found on Linux right + now) */ +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +/* Uses ctime_r & asctime_r with only two parameters vs. three. */ +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + + +/* Platform is an Intel Pentium microprocessor. */ +/* There is a problem with the gethrtime() because of (apparently) a problem + with the inline assembly instruction. Hopefully there is a way to resolve + that with an improvement to the assembler +*/ +#ifdef ACE_HAS_PENTIUM +//#undef ACE_HAS_PENTIUM +#endif /* ACE_HAS_PENTIUM */ + + +/* Platform contains */ +#define ACE_HAS_POLL + +/* Platform supports POSIX O_NONBLOCK semantics */ +#define ACE_HAS_POSIX_NONBLOCK + +/* Platform supports the POSIX struct timespec type */ +#define ACE_HAS_POSIX_TIME + +/* Platform supports the /proc file system and defines tid_t + in */ +#define ACE_HAS_PROC_FS + +/* Platform supports POSIX Threads */ +#define ACE_HAS_PTHREADS + +/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and + PTHREAD_PROCESS_SHARED values */ +#define ACE_HAS_PTHREAD_PROCESS_ENUM + +/* Platform will recurse infinitely on thread exits from TSS cleanup routines + (e.g., AIX) */ +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS + +/* Platform supports reentrant functions (i.e., all the POSIX *_r + functions). */ +#define ACE_HAS_REENTRANT_FUNCTIONS + +/* Platform has support for multi-byte character support compliant with the + XPG4 Worldwide Portability Interface wide-character classification. */ +#define ACE_HAS_XPG4_MULTIBYTE_CHAR + +/* Platform does not support reentrant netdb functions (getprotobyname_r, + getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */ +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS + +/* Platform supports the POSIX regular expression library */ +#define ACE_HAS_REGEX + +/* Platform has special header for select(). */ +#define ACE_HAS_SELECT_H + +/* Platform has a function to set t_errno (e.g., Tandem). */ +#define ACE_HAS_SET_T_ERRNO + +/* Platform supports SVR4 extended signals */ +#define ACE_HAS_SIGINFO_T + +/* Platform/compiler has the sigwait(2) prototype */ +#define ACE_HAS_SIGWAIT + +/* Compiler/platform defines the sig_atomic_t typedef */ +#define ACE_HAS_SIG_ATOMIC_T + +/* Platform supports new BSD inet_addr len field. */ +#define ACE_HAS_SOCKADDR_IN_SIN_LEN + +/* OS/compiler uses size_t * rather than int * for socket lengths */ +#define ACE_HAS_SIZET_SOCKET_LEN + +/* Compiler/platform provides the sys/sockio.h file */ +#define ACE_HAS_SYS_SOCKIO_H + +/* Compiler supports the ssize_t typedef */ +#define ACE_HAS_SSIZE_T + +/* Platform supports UNIX International Threads */ +#define ACE_HAS_STHREADS + +/* Platform has thr_yield() */ +#define ACE_HAS_THR_YIELD + +/* Platform/compiler supports Standard C++ Library */ +/* It seems that UDK provides std-like declarations for only portions + such as +*/ +#define ACE_HAS_STANDARD_CPP_LIBRARY 0 + +/* Compiler/platform supports struct strbuf */ +#define ACE_HAS_STRBUF_T + +/* Platform supports STREAMS */ +#define ACE_HAS_STREAMS + +/* Platform supports STREAM pipes */ +#define ACE_HAS_STREAM_PIPES + +/* Platform/Compiler supports a String class (e.g., GNU or Win32). */ +#define ACE_HAS_STRING_CLASS + +/* Platform has (which contains bzero() prototype) */ +#define ACE_HAS_STRINGS + +/* Platform/compiler supports void * as second parameter to gettimeofday(). */ +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY + +/* Compiler/platform supports SVR4 dynamic linking semantics */ +#define ACE_HAS_SVR4_DYNAMIC_LINKING + +/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */ +#define ACE_HAS_SVR4_TLI + +/* Compiler/platform contains the file. */ +#define ACE_HAS_SYS_SYSCALL_H + +/* Platform supports system configuration information */ +#define ACE_HAS_SYS_SYSTEMINFO_H +#define ACE_HAS_SYSV_SYSINFO 1 + +/* Platform supports System V IPC (most versions of UNIX, but not Win32) */ +#define ACE_HAS_SYSV_IPC 1 + +/* Platform provides header */ +#define ACE_HAS_SYS_FILIO_H 1 + +/* Platform provides header */ +#define ACE_HAS_SYS_XTI_H 1 + +/* Compiler implements templates that support typedefs inside of classes used + as formal arguments to a template class. */ +#define ACE_HAS_TEMPLATE_TYPEDEFS 1 + +/* Platform has POSIX terminal interface. */ +#define ACE_HAS_TERMIOS 1 + +/* Platform supports threads */ +#define ACE_HAS_THREADS 1 + +/* Compiler/platform has thread-specific storage */ +#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 + +/* Platform supports TLI timod STREAMS module */ +#define ACE_HAS_TIMOD_H 1 + +/* Platform supports TLI tiuser header */ +#define ACE_HAS_TIUSER_H 1 + +/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */ +#define ACE_HAS_TLI 1 + +/* Platform provides TLI function prototypes */ +#define ACE_HAS_TLI_PROTOTYPES 1 + +/* Platform supports ualarm() */ +#define ACE_HAS_UALARM 1 + +/* Platform supports ucontext_t (which is used in the extended signal API). */ +#define ACE_HAS_UCONTEXT_T 1 + +/* Platform has header file */ +#define ACE_HAS_UTIME 1 + +/* Prints out console message in ACE_NOTSUP. Useful for tracking down origin + of ACE_NOTSUP. */ +/* #undef ACE_HAS_VERBOSE_NOTSUP */ + +/* Platform requires void * for mmap(). */ +#define ACE_HAS_VOIDPTR_MMAP 1 + +/* Platform has XTI (X/Open-standardized superset of TLI). Implies + ACE_HAS_TLI but uses a different header file. */ +#define ACE_HAS_XTI 1 + +/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily + mean that the platform does not support iostreams. */ +#define ACE_LACKS_ACE_IOSTREAM 1 + +/* Platform does not have u_longlong_t typedef */ +#define ACE_LACKS_U_LONGLONG_T 1 + +/* Platform lacks madvise() (e.g., Linux) */ +#define ACE_LACKS_MADVISE 1 + +/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ +#define ACE_LACKS_PRI_T 1 + +/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */ +#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 + +/* Platfrom lack pthread_yield() support. */ +#define ACE_LACKS_PTHREAD_YIELD 1 + +/* Platform lacks readers/writer locks. */ +#define ACE_LACKS_RWLOCK_T 1 + +/* MIT pthreads platform lacks the timedwait prototypes */ +#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 + +/* Platform does not define timepec_t as a typedef for struct timespec. */ +#define ACE_LACKS_TIMESPEC_T 1 + +/* Compile using multi-thread libraries */ +#define ACE_MT_SAFE 1 + +/* Platform needs to #include to get thread scheduling defs. */ +#define ACE_NEEDS_SCHED_H 1 + +/* The OS/platform supports the poll() event demultiplexor */ +#define ACE_USE_POLL 1 + +/* Platform has its standard c++ library in the namespace std. */ +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 + +/* The number of bytes in a double. */ +#define SIZEOF_DOUBLE 8 + +/* The number of bytes in a float. */ +#define SIZEOF_FLOAT 4 + +/* The number of bytes in a int. */ +#define SIZEOF_INT 4 + +/* The number of bytes in a long. */ +#define SIZEOF_LONG 4 + +/* The number of bytes in a long double. */ +#define SIZEOF_LONG_DOUBLE 12 + +/* The number of bytes in a long long. */ +#define SIZEOF_LONG_LONG 8 + +/* The number of bytes in a short. */ +#define SIZEOF_SHORT 2 + +/* The number of bytes in a signed char. */ +#define SIZEOF_SIGNED_CHAR 1 + +/* The number of bytes in a void *. */ +#define SIZEOF_VOID_P 4 + +/* Define if you have the execv function. */ +#define HAVE_EXECV 1 + +/* Define if you have the execve function. */ +#define HAVE_EXECVE 1 + +/* Define if you have the execvp function. */ +#define HAVE_EXECVP 1 + +/* Define if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define if you have the header file. */ +#define HAVE_FSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_IOMANIP 1 + +/* Define if you have the header file. */ +#define HAVE_IOSTREAM 1 + +/* Define if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Name of package */ +#define PACKAGE "ace" + +/* Version number of package */ +#define VERSION "4.6.37" + +/* Added by Staller */ +#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h +/* Hat nix gebracht +#define ACE_DEFAULT_SELECT_REACTOR_SIZE 256 // this is like in linux config fileto avoid another error +*/ +#define howmany(x, y) (((x)+((y)-1))/(y)) +#define ACE_HAS_BROKEN_T_ERROR // let disappear a nasty warning from OS.i +#if !defined (__USLC__) +# define __USLC__ 1 +#endif + +#define __IOCTL_VERSIONED__ // By Carlo! +#endif /* ACE_UNIXWARE_UDK_H */ diff --git a/externals/ace/config-visualage.h b/externals/ace/config-visualage.h new file mode 100644 index 0000000..4cef810 --- /dev/null +++ b/externals/ace/config-visualage.h @@ -0,0 +1,20 @@ +/* -*- C++ -*- */ +// $Id: config-visualage.h 80826 2008-03-04 14:51:23Z wotte $ + +// This configuration file automatically includes the proper +// configurations for IBM's VisualAge C++ compiler on Win32 and AIX. + +#ifndef CONFIG_VISUALAGE_H +#define CONFIG_VISUALAGE_H +#include /**/ "ace/pre.h" + +#ifdef __TOS_WIN__ + #include "ace/config-win32.h" +#elif __TOS_AIX__ + #include "ace/config-aix-4.x.h" +#else + #include "PLATFORM NOT SPECIFIED" +#endif /* __TOS_WIN__ */ + +#include /**/ "ace/post.h" +#endif //CONFIG_VISUALAGE_H diff --git a/externals/ace/config-vxworks.h b/externals/ace/config-vxworks.h new file mode 100644 index 0000000..fd4e041 --- /dev/null +++ b/externals/ace/config-vxworks.h @@ -0,0 +1,57 @@ +//* -*- C++ -*- */ +// $Id: config-vxworks.h 87036 2009-10-10 18:21:39Z johnnyw $ + +// The following configuration file is designed to work for VxWorks +// Based on ACE_VXWORKS it will select the correct config file + +#ifndef ACE_CONFIG_VXWORKS_H +#define ACE_CONFIG_VXWORKS_H +#include /**/ "ace/pre.h" + +// If ACE_VXWORKS is not defined try to figure out the VxWorks version +#if !defined (ACE_VXWORKS) +# include "vxWorks.h" +# if !defined (_WRS_VXWORKS_MAJOR) && !defined (_WRS_VXWORKS_MINOR) +# error You must define ACE_VXWORKS +# else +# if (_WRS_VXWORKS_MAJOR == 6) +# if (_WRS_VXWORKS_MINOR == 0) +# define ACE_VXWORKS 0x600 +# elif (_WRS_VXWORKS_MINOR == 1) +# define ACE_VXWORKS 0x610 +# elif (_WRS_VXWORKS_MINOR == 2) +# define ACE_VXWORKS 0x620 +# elif (_WRS_VXWORKS_MINOR == 3) +# define ACE_VXWORKS 0x630 +# elif (_WRS_VXWORKS_MINOR == 4) +# define ACE_VXWORKS 0x640 +# elif (_WRS_VXWORKS_MINOR == 5) +# define ACE_VXWORKS 0x650 +# elif (_WRS_VXWORKS_MINOR == 6) +# define ACE_VXWORKS 0x660 +# elif (_WRS_VXWORKS_MINOR == 7) +# define ACE_VXWORKS 0x670 +# elif (_WRS_VXWORKS_MINOR == 8) +# define ACE_VXWORKS 0x680 +# endif +# endif +# endif +#endif /* ! ACE_VXWORKS */ + +#if (ACE_VXWORKS == 0x640) +# include "ace/config-vxworks6.4.h" +#elif (ACE_VXWORKS == 0x650) +# include "ace/config-vxworks6.5.h" +#elif (ACE_VXWORKS == 0x660) +# include "ace/config-vxworks6.6.h" +#elif (ACE_VXWORKS == 0x670) +# include "ace/config-vxworks6.7.h" +#elif (ACE_VXWORKS == 0x680) +# include "ace/config-vxworks6.8.h" +#else +#error Unknown or unsupported VxWorks version +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_H */ + diff --git a/externals/ace/config-vxworks6.4.h b/externals/ace/config-vxworks6.4.h new file mode 100644 index 0000000..d1fad78 --- /dev/null +++ b/externals/ace/config-vxworks6.4.h @@ -0,0 +1,350 @@ +//* -*- C++ -*- */ +// $Id: config-vxworks6.4.h 89494 2010-03-15 20:11:18Z olli $ + +// The following configuration file is designed to work for VxWorks +// 6.4 platforms using one of these compilers: +// 1) The GNU g++ compiler that is shipped with VxWorks 6.4 +// 2) The Diab compiler that is shipped with VxWorks 6.4 + +#ifndef ACE_CONFIG_VXWORKS_6_4_H +#define ACE_CONFIG_VXWORKS_6_4_H +#include /**/ "ace/pre.h" + +#if ! defined (VXWORKS) +# define VXWORKS +#endif /* ! VXWORKS */ + +#if ! defined (ACE_VXWORKS) +# define ACE_VXWORKS 0x640 +#endif /* ! ACE_VXWORKS */ + +#if !defined (__RTP__) + // Fix for wrong typedef of time_t in kernel mode + #ifndef _TIME_T + #define _TIME_T + typedef long time_t; + #endif +#endif + +#if ! defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ + +// Compiler-specific configuration. +#if defined (__GNUG__) +# include "ace/config-g++-common.h" + +# define ACE_LACKS_IOSTREAM_FX +# define ACE_LACKS_LINEBUFFERED_STREAMBUF + +# if defined (__RTP__) && !defined (_HAS_C9X) +// Workaround for the fact that under RTP the log2 method can't be used +// without this define set, see TSR560446 +# if !defined (_C99) +# define _C99 +# endif +# endif + +#elif defined (__DCC__) +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_TEMPLATES_REQUIRE_SOURCE +#else /* ! __GNUG__ && ! ghs && !__DCC__ */ +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler on VxWorks +# endif /* __cplusplus */ +#endif /* ! __GNUG__ && ! ghs */ + +// Needed include to get all VxWorks CPU types +#include "types/vxCpu.h" +#if defined __RTP__ + #if defined (_VX_CPU) && (_VX_CPU == _VX_PENTIUM || _VX_CPU == _VX_PENTIUM2 || _VX_CPU == _VX_PENTIUM3 || _VX_CPU == _VX_PENTIUM4) + // If running an Intel Pentium the + // ACE_OS::gethrtime () can use the RDTSC instruction. + # define ACE_HAS_PENTIUM + #endif +#else + #if defined (CPU) && (CPU == PENTIUM || CPU == PENTIUM2 || CPU == PENTIUM3 || CPU == PENTIUM4) + // If running an Intel Pentium the + // ACE_OS::gethrtime () can use the RDTSC instruction. + # define ACE_HAS_PENTIUM + #endif +#endif + +#if !defined __RTP__ +# if defined (TOOL) && (TOOL == gnu) +# if defined (CPU) && (CPU == PPC85XX || CPU == PPC604 || CPU == PPC603 || CPU == PPC32) +// These PPC's do lack log2 in kernel mode +# define ACE_LACKS_LOG2 +# endif +# endif +#endif + +// OS-specific configuration +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_NONCONST_GETBY +#define ACE_HAS_NONCONST_INET_ADDR +#define ACE_HAS_NONCONST_SWAB +#define ACE_USES_INETLIB_H +#define ACE_USES_SELECTLIB_H +#define ACE_LACKS_UNIX_SYSLOG +#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 32768 +#define ACE_DEFAULT_THREAD_KEYS 16 +#define ACE_HAS_BROKEN_ACCEPT_ADDR +#define ACE_HAS_NONCONST_SENDMSG +#define ACE_HAS_NONCONST_WRITEV +#define ACE_HAS_CHARPTR_DL +#define ACE_HAS_CLOCK_GETTIME +#define ACE_HAS_CLOCK_SETTIME +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_CPLUSPLUS_HEADERS +#define ACE_HAS_DIRENT +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_MSG +#define ACE_HAS_NONCONST_READV +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_REENTRANT_FUNCTIONS +#define ACE_HAS_SIGACTION_CONSTP2 +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN +#define ACE_HAS_THREADS +#define ACE_HAS_SYSCTL +#define ACE_LACKS_ALPHASORT +#define ACE_LACKS_EXEC +#define ACE_LACKS_RLIMIT +#define ACE_LACKS_FILELOCKS +#define ACE_LACKS_FORK +#define ACE_LACKS_GETHOSTENT +#define ACE_LACKS_GETSERVBYNAME +#define ACE_LACKS_GETPROTOBYNAME +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETIPNODEBYADDR +#define ACE_LACKS_GETIPNODEBYNAME_IPV6 +#define ACE_LACKS_LSTAT +#define ACE_LACKS_MADVISE +#define ACE_LACKS_MALLOC_H +#define ACE_LACKS_MEMORY_H +#define ACE_LACKS_MKFIFO +#define ACE_LACKS_MKSTEMP +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_SYS_PARAM_H +#define ACE_LACKS_PWD_FUNCTIONS +#define ACE_LACKS_READLINK +#define ACE_LACKS_REALPATH +#define ACE_LACKS_PIPE +#define ACE_LACKS_RWLOCK_T +#define ACE_LACKS_SBRK +#define ACE_LACKS_SEEKDIR +#define ACE_LACKS_SEMBUF_T +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_SI_ADDR +#define ACE_LACKS_SOCKETPAIR +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_TELLDIR +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_TRUNCATE +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_USECONDS_T +#define ACE_LACKS_UMASK +#define ACE_LACKS_STRPTIME +#define ACE_LACKS_MKTEMP +#define ACE_LACKS_TEMPNAM +#define ACE_PAGE_SIZE 4096 +#define ACE_THR_PRI_FIFO_DEF 101 +#define ACE_THR_PRI_OTHER_DEF ACE_THR_PRI_FIFO_DEF +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_GETIFADDRS + +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETPGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID +#define ACE_LACKS_SETGID + +#define ACE_LACKS_SYS_UIO_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_PWD_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_TERMIOS_H +#define ACE_LACKS_POLL_H +#define ACE_LACKS_FCNTL + +// Some string things +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSDUP +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_WCSTOLL +#define ACE_LACKS_STRTOULL +#define ACE_LACKS_WCSTOULL + +#define ACE_HAS_CHARPTR_SOCKOPT +#define ACE_LACKS_SYMLINKS +#define ACE_LACKS_ISCTYPE + +#if defined __RTP__ + // We are building for RTP mode + #if !defined (ACE_AS_STATIC_LIBS) + # define ACE_HAS_SVR4_DYNAMIC_LINKING + #endif + #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + #define ACE_LACKS_REGEX_H + #if defined ACE_HAS_PENTIUM + // Bug to workaround VxWorks 6.4 x86 + # define ACE_LACKS_PUTENV + #endif + #define ACE_HAS_SETENV + #define ACE_LACKS_STRCASECMP + #define ACE_HAS_3_PARAM_WCSTOK + #define ACE_HAS_WCHAR + #define ACE_HAS_VFWPRINTF + #define ACE_SIZEOF_WCHAR 2 + #define ACE_HAS_SHM_OPEN + #if defined (ACE_AS_STATIC_LIBS) + # define ACE_HAS_AIO_CALLS + #endif + // VxWorks seems to either not define this or define as zero up till now + #if !defined (IOV_MAX) || (IOV_MAX == 0) + #define ACE_IOV_MAX 16 + #endif + #define ACE_LACKS_ISASCII +#else + // We are building for kernel mode + #define ACE_LACKS_SETENV + #define ACE_LACKS_UNSETENV + #define ACE_LACKS_SUSECONDS_T + #define ACE_LACKS_INTPTR_T + #define ACE_LACKS_INTTYPES_H + #define ACE_LACKS_STDINT_H + #define ACE_LACKS_UNAME + #define ACE_LACKS_UTSNAME_T + #define ACE_LACKS_RAND_REENTRANT_FUNCTIONS + #define ACE_LACKS_DLFCN_H + #define ACE_LACKS_WAIT + #define ACE_LACKS_WAITPID + #define ACE_LACKS_SYS_TIME_H + #define ACE_LACKS_SYS_SELECT_H + #define ACE_MKDIR_LACKS_MODE + #define ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R + #define ACE_LACKS_SEARCH_H + #define ACE_LACKS_SYSCONF + #define ACE_LACKS_GETPPID + #define ACE_LACKS_WCHAR_H + #define ACE_LACKS_WCTYPE_H + #define ACE_LACKS_WCSCAT + #define ACE_LACKS_WCSCHR + #define ACE_LACKS_WCSCMP + #define ACE_LACKS_WCSCPY + #define ACE_LACKS_WCSCSPN + #define ACE_LACKS_WCSLEN + #define ACE_LACKS_WCSNCAT + #define ACE_LACKS_WCSNCMP + #define ACE_LACKS_WCSNCPY + #define ACE_LACKS_WCSPBRK + #define ACE_LACKS_WCSRCHR + #define ACE_LACKS_WCSSPN + #define ACE_LACKS_WCSSTR + #define ACE_LACKS_WCSTOK + #define ACE_LACKS_TOWLOWER + #define ACE_LACKS_TOWUPPER + #define ACE_LACKS_WCSTOD + #define ACE_LACKS_WCSTOL + #define ACE_LACKS_WCSTOUL + #define ACE_LACKS_FGETWC + #define ACE_LACKS_FGETWS + #define ACE_LACKS_FPUTWS + #define ACE_HAS_IOCTL_INT_3_PARAM + #define ACE_LACKS_MMAP + #define ACE_LACKS_MSYNC + #define ACE_LACKS_MPROTECT + #if !defined (ACE_MAIN) + # define ACE_MAIN ace_main + #endif /* ! ACE_MAIN */ + #define ACE_LACKS_TZSET + #define ACE_LACKS_ISWCTYPE + #define ACE_LACKS_ISBLANK +#endif + +// It is possible to enable pthread support with VxWorks, when the user decides +// to use this, we need some more defines +#if defined ACE_HAS_PTHREADS +# define ACE_HAS_THREAD_SPECIFIC_STORAGE +# if !defined __RTP__ +# define ACE_LACKS_PTHREAD_ATTR_SETSTACK +# endif +# define ACE_HAS_PTHREAD_ATTR_SETNAME +# define ACE_HAS_POSIX_SEM +# define ACE_LACKS_MUTEXATTR_PSHARED +# define ACE_LACKS_CONDATTR_PSHARED +// Include this file, the sys/stat.h file shipped with VxWorks has old types +// and without this include we get a lot of compile errors. A TSR has been filed +// so that hopefully in the future we can zap this include +#include "types/vxTypesOld.h" +#else +# define ACE_LACKS_PTHREAD_H +# define ACE_HAS_VXTHREADS +# if !defined __RTP__ +// Only when building for kernel mode we can use TSS emulation, in rtp mode +// we can't use the WIND_TCB struct anymore +# define ACE_HAS_TSS_EMULATION +# if !defined (ACE_VXWORKS_SPARE) +# define ACE_VXWORKS_SPARE spare4 +# endif /* ! ACE_VXWORKS_SPARE */ +# endif +// VxWorks has no recursive mutexes. This was set in the past but it doesn't +// work with the pthread support, so only set it for the time being when pthread +// is disabled +# define ACE_HAS_RECURSIVE_MUTEXES +# define ACE_LACKS_COND_T +# define ACE_HAS_MUTEX_TIMEOUTS +#endif + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +// VxWorks defines the CPU define MAP, undef it to prevent problems with +// application code +#if defined (MAP) +#undef MAP +#endif /* MAP */ + +#if !defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE) +# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 +#endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */ + +#if !defined (ACE_NTRACE) +# define ACE_NTRACE 1 +#endif /* ACE_NTRACE */ + +// By default, don't include RCS Id strings in object code. +#if !defined (ACE_USE_RCSID) +#define ACE_USE_RCSID 0 +#endif /* !ACE_USE_RCSID */ + +#if defined (ACE_HAS_IP_MULTICAST) +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif /* ACE_HAS_IP_MULTICAST */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_6_4_H */ diff --git a/externals/ace/config-vxworks6.5.h b/externals/ace/config-vxworks6.5.h new file mode 100644 index 0000000..19273e6 --- /dev/null +++ b/externals/ace/config-vxworks6.5.h @@ -0,0 +1,25 @@ +//* -*- C++ -*- */ +// $Id: config-vxworks6.5.h 80826 2008-03-04 14:51:23Z wotte $ + +// The following configuration file is designed to work for VxWorks +// 6.5 platforms using one of these compilers: +// 1) The GNU g++ compiler that is shipped with VxWorks 6.5 +// 2) The Diab compiler that is shipped with VxWorks 6.5 + +#ifndef ACE_CONFIG_VXWORKS_6_5_H +#define ACE_CONFIG_VXWORKS_6_5_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_VXWORKS) +# define ACE_VXWORKS 0x650 +#endif /* ! ACE_VXWORKS */ + +#include "ace/config-vxworks6.4.h" + +#if defined (__RTP__) +# undef ACE_HAS_GETIFADDRS +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_6_5_H */ + diff --git a/externals/ace/config-vxworks6.6.h b/externals/ace/config-vxworks6.6.h new file mode 100644 index 0000000..eebce44 --- /dev/null +++ b/externals/ace/config-vxworks6.6.h @@ -0,0 +1,34 @@ +//* -*- C++ -*- */ +// $Id: config-vxworks6.6.h 85143 2009-04-22 09:15:08Z johnnyw $ + +// The following configuration file is designed to work for VxWorks +// 6.6 platforms using one of these compilers: +// 1) The GNU g++ compiler that is shipped with VxWorks 6.6 +// 2) The Diab compiler that is shipped with VxWorks 6.6 + +#ifndef ACE_CONFIG_VXWORKS_6_6_H +#define ACE_CONFIG_VXWORKS_6_6_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_VXWORKS) +# define ACE_VXWORKS 0x660 +#endif /* ! ACE_VXWORKS */ + +#include "ace/config-vxworks6.5.h" + +#if defined (ACE_HAS_PENTIUM) +# define ACE_LACKS_LOG2 +#endif + +#if !defined (__RTP__) +# undef ACE_HAS_IOCTL_INT_3_PARAM +# define ACE_HAS_TASKCPUAFFINITYSET +#endif + +#define ACE_HAS_VXATOMICLIB +#define ACE_HAS_CPUSET_T +#define ACE_HAS_VXCPULIB + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_6_6_H */ + diff --git a/externals/ace/config-vxworks6.7.h b/externals/ace/config-vxworks6.7.h new file mode 100644 index 0000000..eab429a --- /dev/null +++ b/externals/ace/config-vxworks6.7.h @@ -0,0 +1,23 @@ +//* -*- C++ -*- */ +// $Id: config-vxworks6.7.h 84971 2009-03-25 13:03:44Z johnnyw $ + +// The following configuration file is designed to work for VxWorks +// 6.7 platforms using one of these compilers: +// 1) The GNU g++ compiler that is shipped with VxWorks 6.7 +// 2) The Diab compiler that is shipped with VxWorks 6.7 + +#ifndef ACE_CONFIG_VXWORKS_6_7_H +#define ACE_CONFIG_VXWORKS_6_7_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_VXWORKS) +# define ACE_VXWORKS 0x670 +#endif /* ! ACE_VXWORKS */ + +#include "ace/config-vxworks6.6.h" + +#undef ACE_HAS_NONCONST_INET_ADDR + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_6_7_H */ + diff --git a/externals/ace/config-vxworks6.8.h b/externals/ace/config-vxworks6.8.h new file mode 100644 index 0000000..ecad475 --- /dev/null +++ b/externals/ace/config-vxworks6.8.h @@ -0,0 +1,21 @@ +//* -*- C++ -*- */ +// $Id: config-vxworks6.8.h 87036 2009-10-10 18:21:39Z johnnyw $ + +// The following configuration file is designed to work for VxWorks +// 6.8 platforms using one of these compilers: +// 1) The GNU g++ compiler that is shipped with VxWorks 6.8 +// 2) The Diab compiler that is shipped with VxWorks 6.8 + +#ifndef ACE_CONFIG_VXWORKS_6_8_H +#define ACE_CONFIG_VXWORKS_6_8_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_VXWORKS) +# define ACE_VXWORKS 0x680 +#endif /* ! ACE_VXWORKS */ + +#include "ace/config-vxworks6.7.h" + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_6_8_H */ + diff --git a/externals/ace/config-win32-borland.h b/externals/ace/config-win32-borland.h new file mode 100644 index 0000000..c3ae460 --- /dev/null +++ b/externals/ace/config-win32-borland.h @@ -0,0 +1,174 @@ +// -*- C++ -*- +//$Id: config-win32-borland.h 89292 2010-03-04 08:06:15Z johnnyw $ + +// The following configuration file contains defines for Borland compilers. + +#ifndef ACE_CONFIG_WIN32_BORLAND_H +#define ACE_CONFIG_WIN32_BORLAND_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#define ACE_HAS_CUSTOM_EXPORT_MACROS +#define ACE_Proper_Export_Flag __declspec (dllexport) +#define ACE_Proper_Import_Flag __declspec (dllimport) +#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T +#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; +#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class __declspec (dllimport) T +#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllimport) SINGLETON_TYPE ; + +// In later versions of C++Builder we will prefer inline functions by +// default. The debug configuration of ACE is built with functions +// out-of-line, so when linking your application against a debug ACE +// build, you can choose to use the out-of-line functions by adding +// ACE_NO_INLINE=1 to your project settings. +# if !defined (__ACE_INLINE__) +# define __ACE_INLINE__ 1 +# endif /* __ACE_INLINE__ */ + +# define ACE_CC_NAME ACE_TEXT ("Embarcadero C++ Builder") +# define ACE_CC_MAJOR_VERSION (__BORLANDC__ / 0x100) +# define ACE_CC_MINOR_VERSION (__BORLANDC__ % 0x100) +# define ACE_CC_BETA_VERSION (0) + +#ifndef ACE_USING_MCPP_PREPROCESSOR +# if (__BORLANDC__ >= 0x620) +# define ACE_CC_PREPROCESSOR_ARGS "-q -Sl -o%s" +# else +# define ACE_CC_PREPROCESSOR_ARGS "-q -P- -o%s" +# endif +#endif + +// Automatically define WIN32 macro if the compiler tells us it is our +// target platform. +# if defined (__WIN32__) && !defined (WIN32) +# define WIN32 1 +# endif + +// When building a VCL application, the main VCL header file should be +// included before anything else. You can define ACE_HAS_VCL=1 in your +// project settings to have this file included for you automatically. +# if defined (ACE_HAS_VCL) && (ACE_HAS_VCL != 0) +# include /**/ +# endif + +# define ACE_CC_PREPROCESSOR "CPP32.EXE" + +# include "ace/config-win32-common.h" + +# define ACE_WSTRING_HAS_USHORT_SUPPORT 1 +# define ACE_HAS_DIRENT + +#define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 1 + +#define ACE_NEEDS_DL_UNDERSCORE + +#define ACE_LACKS_TERMIOS_H +#define ACE_LACKS_NETINET_TCP_H +#define ACE_LACKS_REGEX_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_PWD_H +#define ACE_LACKS_POLL_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_STRINGS_H +#define ACE_LACKS_SEMAPHORE_H +#define ACE_LACKS_INTTYPES_H +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_SYS_SELECT_H +#define ACE_LACKS_SYS_TIME_H +#define ACE_LACKS_SYS_RESOURCE_H +#define ACE_LACKS_SYS_WAIT_H +#define ACE_LACKS_DLFCN_H +#define ACE_LACKS_SYS_MMAN_H +#define ACE_LACKS_SYS_UIO_H +#define ACE_LACKS_SYS_SOCKET_H +#define ACE_LACKS_NETINET_IN_H +#define ACE_LACKS_NETDB_H +#define ACE_LACKS_NET_IF_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_SYS_IOCTL_H +#define ACE_LACKS_STROPTS_H + +#undef ACE_LACKS_STRUCT_DIR +#undef ACE_LACKS_CLOSEDIR +#undef ACE_LACKS_OPENDIR +#undef ACE_LACKS_READDIR +#undef ACE_LACKS_REWINDDIR + +#define ACE_HAS_WOPENDIR +#define ACE_HAS_WCLOSEDIR +#define ACE_HAS_WREADDIR +#define ACE_HAS_WREWINDDIR + +#define ACE_LACKS_STRRECVFD +#define ACE_USES_EXPLICIT_STD_NAMESPACE + +#define ACE_HAS_TIME_T_LONG_MISMATCH + +#define ACE_EXPORT_NESTED_CLASSES 1 +#define ACE_HAS_CPLUSPLUS_HEADERS 1 +#define ACE_HAS_EXCEPTIONS +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#define ACE_HAS_STDCPP_STL_INCLUDES 1 +#define ACE_HAS_STRING_CLASS 1 +#define ACE_HAS_TEMPLATE_TYPEDEFS 1 +#define ACE_HAS_USER_MODE_MASKS 1 +#define ACE_LACKS_ACE_IOSTREAM 1 +#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +#define ACE_HAS_NEW_NOTHROW +#define ACE_TEMPLATES_REQUIRE_SOURCE 1 +#define ACE_SIZEOF_LONG_DOUBLE 10 +#define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Lu" +#define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_USES_STD_NAMESPACE_FOR_ABS 1 +#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) + +#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +// must have _MT defined to include multithreading +// features from win32 headers +# if !defined(__MT__) +// *** DO NOT *** defeat this error message by defining __MT__ yourself. +// You must link with the multi threaded libraries. Add -tWM to your +// compiler options +# error You must link against multi-threaded libraries when using ACE (check your project settings) +# endif /* !_MT && !ACE_HAS_WINCE */ +#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ + +#if (__BORLANDC__ < 0x620) +# define ACE_LACKS_ISBLANK +# define ACE_LACKS_ISWBLANK +# define ACE_LACKS_PRAGMA_ONCE 1 +#endif + +#define ACE_LACKS_ISWCTYPE +#define ACE_LACKS_ISCTYPE + +#if (__BORLANDC__ < 0x620) +// Older Borland compilers can't handle assembly in inline methods or +// templates (E2211). When we build for pentium optimized and we are inlining +// then we disable inline assembly +# if defined (ACE_HAS_PENTIUM) && defined(__ACE_INLINE__) +# define ACE_LACKS_INLINE_ASSEMBLY +# endif +#endif + +#if (__BORLANDC__ == 0x621) +// C++ Builder 2010 wcsncat seems broken +# define ACE_LACKS_WCSNCAT +#endif + +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup +#define ACE_STRCASECMP_EQUIVALENT ::stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::strnicmp +#define ACE_WTOF_EQUIVALENT ::_wtof +#define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X))) +#define ACE_HAS_ITOA 1 + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_BORLAND_H */ diff --git a/externals/ace/config-win32-cegcc.h b/externals/ace/config-win32-cegcc.h new file mode 100644 index 0000000..c29290d --- /dev/null +++ b/externals/ace/config-win32-cegcc.h @@ -0,0 +1,113 @@ +// -*- C++ -*- +// $Id: config-win32-cegcc.h 87167 2009-10-19 19:33:53Z olli $ + +// +// The following configuration file is designed to work for win32 +// platforms using gcc/g++ with mingw32 (http://www.mingw.org). +// + +#ifndef ACE_CONFIG_WIN32_CEGCC_H +#define ACE_CONFIG_WIN32_CEGCC_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +# error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#define ACE_CC_NAME ACE_TEXT ("g++") +#define ACE_CC_PREPROCESSOR "cpp" +#define ACE_CC_PREPROCESOR_ARGS "" + +// Why all this is not in config-g++-common.h? +#define ACE_CC_MAJOR_VERSION __GNUC__ +#define ACE_CC_MINOR_VERSION __GNUC_MINOR__ +#define ACE_CC_BETA_VERSION (0) + +#if !defined (ACE_HAS_CEGCC) +# error You do not seem to be using cegcc +#endif + +// We trust the user: He must have used -mpentiumpro or -mpentium +// if that is what he wants. +#if defined(pentiumpro) || defined(pentium) +# define ACE_HAS_PENTIUM +#endif + +#include "ace/config-g++-common.h" + +#include /**/ +#include /**/ +#include /**/ <_mingw.h> + +#if (__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 15)) +# undef ACE_LACKS_USECONDS_T +#endif + +#define ACE_HAS_USER_MODE_MASKS + +#define ACE_HAS_SSIZE_T +#undef ACE_LACKS_STRUCT_DIR +#undef ACE_LACKS_OPENDIR +#undef ACE_LACKS_CLOSEDIR +#undef ACE_LACKS_READDIR +#undef ACE_LACKS_TELLDIR +#undef ACE_LACKS_SEEKDIR +#undef ACE_LACKS_REWINDDIR + +#undef ACE_HAS_WTOF + +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_TERMIOS_H +#define ACE_LACKS_NETINET_TCP_H +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_STRPTIME +#define ACE_LACKS_POLL_H +#define ACE_LACKS_REGEX_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_PWD_H +#define ACE_LACKS_SEMAPHORE_H +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_SYS_SELECT_H +#define ACE_LACKS_SYS_RESOURCE_H +#define ACE_LACKS_SYS_WAIT_H +#define ACE_LACKS_DLFCN_H +#define ACE_LACKS_SYS_MMAN_H +#define ACE_LACKS_SYS_UIO_H +#define ACE_LACKS_SYS_SOCKET_H +#define ACE_LACKS_NETINET_IN_H +#define ACE_LACKS_NETDB_H +#define ACE_LACKS_NET_IF_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_SYS_IOCTL_H +#define ACE_LACKS_PDH_H +#define ACE_LACKS_PDHMSG_H +#define ACE_HAS_NONCONST_WCSDUP +#define ACE_HAS_WINSOCK2_GQOS +#define ACE_LACKS_CORRECT_ISWPRINT_TAB + +//Changes to compile on CE gcc. +#undef ACE_HAS_TYPES_H +#define ACE_LACKS_ERRNO_H +#undef ACE_LACKS_DEV_T +#define ACE_LACKS_ISCTYPE +#define ACE_HAS_NONCONST_WFDOPEN +#undef ACE_HAS_WTOI +#undef ACE_HAS_WTOL + +#define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" +#define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" +#define ACE_ENDTHREADEX(STATUS) ExitThread ((DWORD) STATUS) + +#define ACE_Proper_Export_Flag __declspec (dllexport) +#define ACE_Proper_Import_Flag __declspec (dllimport) +#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T +#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; +#define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T +#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE ; + +#define ACE_DLL_PREFIX ACE_TEXT ("lib") + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_CEGCC_H */ diff --git a/externals/ace/config-win32-common.h b/externals/ace/config-win32-common.h new file mode 100644 index 0000000..0160a37 --- /dev/null +++ b/externals/ace/config-win32-common.h @@ -0,0 +1,701 @@ +/* -*- C++ -*- */ +// $Id: config-win32-common.h 88567 2010-01-15 10:21:49Z olli $ + + +#ifndef ACE_CONFIG_WIN32_COMMON_H +#define ACE_CONFIG_WIN32_COMMON_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + + +// Windows Mobile (CE) stuff is primarily further restrictions to what's +// in the rest of this file. Also, it defined ACE_HAS_WINCE, which is used +// in this file. +#if defined (_WIN32_WCE) +# include "ace/config-WinCE.h" +#endif /* _WIN32_WCE */ + +// Complain if WIN32 is not already defined. +#if !defined (WIN32) && !defined (ACE_HAS_WINCE) +# error Please define WIN32 in your project settings. +#endif + +#define ACE_WIN32 +#if defined (_WIN64) || defined (WIN64) +# define ACE_WIN64 + +// Use 64-bit file offsets by default in the WIN64 case, similar to +// what 64-bit UNIX systems do. +// +// Note that _FILE_OFFSET_BITS is not recognized by Windows. It is, +// however, recognized by ACE. +# ifndef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 64 +# endif /* !_FILE_OFFSET_BITS */ +#endif /* _WIN64 || WIN64 */ + +#if !defined (_WIN32_WINNT) +# define _WIN32_WINNT 0x0501 // pretend it's at least Windows XP or Win2003 +#endif + +// If the invoking procedure turned off debugging by setting NDEBUG, then +// also set ACE_NDEBUG, unless the user has already set it. +#if defined (NDEBUG) +# if !defined (ACE_NDEBUG) +# define ACE_NDEBUG +# endif /* ACE_NDEBUG */ +#endif /* NDEBUG */ + +// Define ACE_HAS_MFC to 1, if you want ACE to use CWinThread. This should +// be defined, if your application uses MFC. +// Setting applies to : building ACE +// Runtime restrictions: MFC DLLs must be installed +// Additonal notes : If both ACE_HAS_MFC and ACE_MT_SAFE are +// defined, the MFC DLL (not the static lib) +// will be used from ACE. +#if !defined (ACE_HAS_MFC) +# define ACE_HAS_MFC 0 +#endif + +// ACE_USES_STATIC_MFC always implies ACE_HAS_MFC +#if defined (ACE_USES_STATIC_MFC) +# if defined (ACE_HAS_MFC) +# undef ACE_HAS_MFC +# endif +# define ACE_HAS_MFC 1 +#endif /* ACE_USES_STATIC_MFC */ + +// Define ACE_HAS_STRICT to 1 in your config.h file if you want to use +// STRICT type checking. It is disabled by default because it will +// break existing application code. However, if ACE_HAS_MFC is turned on, +// ACE_HAS_STRICT is required by MFC. +// Setting applies to : building ACE, linking with ACE +// Runtime restrictions: - +#if !defined (ACE_HAS_STRICT) +# define ACE_HAS_STRICT 0 +#endif + +// MFC itself defines STRICT. +#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) +# undef ACE_HAS_STRICT +# define ACE_HAS_STRICT 1 +#endif + +// Turn off the following define if you want to disable threading. +// Compile using multi-thread libraries. +// Setting applies to : building ACE, linking with ACE +// Runtime restrictions: multithreaded runtime DLL must be installed +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +// On winCE these classes do not exist. If they are +// introduced in the future, no changes need to be made +#if defined (ABOVE_NORMAL_PRIORITY_CLASS) && \ + defined (BELOW_NORMAL_PRIORITY_CLASS) && \ + defined (HIGH_PRIORITY_CLASS) && \ + defined (IDLE_PRIORITY_CLASS) && \ + defined (NORMAL_PRIORITY_CLASS) && \ + defined (REALTIME_PRIORITY_CLASS) +#define ACE_HAS_WIN32_PRIORITY_CLASS +#endif + +// Build ACE services as DLLs. If you write a library and want it to +// use ACE_Svc_Export, this will cause those macros to build dlls. If +// you want your ACE service to be a static library, comment out this +// line. As far as I know, the only reason to have a library be an +// ACE "service" is to leverage the ACE_Svc_Export macros. It's just +// as easy to define your own export macros. +// #if !defined (ACE_SVC_HAS_DLL) +// # define ACE_SVC_HAS_DLL 1 +// #endif + +// Define the special export macros needed to export symbols outside a dll +#if !defined(__BORLANDC__) && !defined (ACE_HAS_CUSTOM_EXPORT_MACROS) +#define ACE_HAS_CUSTOM_EXPORT_MACROS 1 +#define ACE_Proper_Export_Flag __declspec (dllexport) +#define ACE_Proper_Import_Flag __declspec (dllimport) +#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T +#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE; +#define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T +#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE ; +#endif /* !__BORLANDC__ */ + +// Define ACE_HAS_WINSOCK2 to 0 in your config.h file if you do *not* +// want to compile with WinSock 2.0. +// Setting applies to : building ACE +// Runtime restrictions: winsock2 must be installed. +// #define ACE_HAS_WINSOCK2 0 + +// By default, we use non-static object manager on Win32. That is, +// the object manager is allocated in main's stack memory. If this +// does not suit your need, i.e., if your programs depend on the use +// of static object manager, you neet to disable the behavior by adding +// +// #undef ACE_HAS_NONSTATIC_OBJECT_MANAGER +// +// in the config.h after including config-win32.h +// +// MFC users: the main function is defined within a MFC library and +// therefore, ACE won't be able to meddle with main function and +// instantiate the non-static object manager for you. To solve the +// problem, you'll need to instantiate the ACE_Object_Manager by +// either: +// +// 1. Using static object manager (as described above), however, using +// the non-static object manager is prefered, therefore, +// 2. Instantiate the non-static object manager yourself by either 1) +// call ACE::init () at the beginning and ACE::fini () at the end, +// _or_ 2) instantiate the ACE_Object_Manager in your CWinApp +// derived class. +// +// Optionally, you can #define +// ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER in your +// ace/config.h and always take care of the business by yourself. +// ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER has no effect when +// using static object managers. +#if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) +# define ACE_HAS_NONSTATIC_OBJECT_MANAGER +#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */ + +#define ACE_HAS_GPERF + +// By default, don't include RCS Id strings in object code. +#if !defined (ACE_USE_RCSID) +# define ACE_USE_RCSID 0 +#endif /* ! ACE_USE_RCSID */ + +// ---------------- platform features or lack of them ------------- + +// By default WIN32 has FD_SETSIZE of 64, which places the limit +// between 61 and 64 on the number of clients a server using the +// Select Reactor can support at the same time (i.e., 64 - standard in, +// out, error). Here we raise the limit to 1024. Adjust the definition +// below if you need to raise or lower it. + +#if !defined (FD_SETSIZE) +#define FD_SETSIZE 1024 +#endif /* FD_SETSIZE */ + + +// Windows doesn't like 65536 ;-) If 65536 is specified, it is +// silently ignored by the OS, i.e., setsockopt does not fail, and you +// get stuck with the default size of 8k. +#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 + +// It seems like Win32 does not have a limit on the number of buffers +// that can be transferred by the scatter/gather type of I/O +// functions, e.g., WSASend and WSARecv. We are setting this to be 64 +// for now. The typically use case is to create an I/O vector array +// of size ACE_IOV_MAX on the stack and then filled in. Note that we +// probably don't want too big a value for ACE_IOV_MAX since it may +// mostly go to waste or the size of the activation record may become +// excessively large. +#if !defined (ACE_IOV_MAX) +# define ACE_IOV_MAX 64 +#endif /* ACE_IOV_MAX */ + +#if !defined (ACE_HAS_WINCE) +// Platform supports pread() and pwrite() +# define ACE_HAS_WTOF +#endif /* ! ACE_HAS_WINCE */ + +#define ACE_HAS_P_READ_WRITE + +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_DIRECT_H +# define ACE_HAS_PROCESS_H +# define ACE_HAS_IO_H +#endif /* ! ACE_HAS_WINCE */ + +#if !defined (__MINGW32__) +# define ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS +#endif /* __MINGW32__ */ + +#define ACE_DEFAULT_THREAD_PRIORITY 0 + +#define ACE_HAS_DIRENT +#define ACE_HAS_MSG +#define ACE_HAS_RECURSIVE_MUTEXES +#define ACE_HAS_SOCKADDR_MSG_NAME +#define ACE_HAS_THREAD_SAFE_ACCEPT + +/* LACKS dir-related facilities */ +#define ACE_LACKS_READDIR_R +#define ACE_LACKS_REWINDDIR +#define ACE_LACKS_SEEKDIR +#define ACE_LACKS_TELLDIR + +/* LACKS gid/pid/sid/uid facilities */ +#define ACE_LACKS_GETPGID +#define ACE_LACKS_GETPPID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_GETGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_SETGID + +/* LACKS miscellaneous */ +#define ACE_LACKS_ALARM +#define ACE_LACKS_ARPA_INET_H +#define ACE_LACKS_DUP2 +#define ACE_LACKS_FORK +#define ACE_LACKS_GETHOSTENT +#define ACE_LACKS_GETOPT +#define ACE_LACKS_GETIPNODEBYNAME_IPV6 +#define ACE_LACKS_KILL +#define ACE_LACKS_INET_ATON +#define ACE_LACKS_MADVISE +#define ACE_LACKS_MKFIFO +#define ACE_LACKS_MODE_MASKS +#define ACE_LACKS_PTHREAD_H +#define ACE_LACKS_PWD_FUNCTIONS +#define ACE_LACKS_READLINK +#define ACE_LACKS_RLIMIT +#define ACE_LACKS_SBRK +#define ACE_LACKS_SCHED_H +#define ACE_LACKS_SEMBUF_T +#define ACE_LACKS_SIGACTION +#define ACE_LACKS_SIGSET +#define ACE_LACKS_SOCKETPAIR +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_USECONDS_T +#define ACE_LACKS_SYS_PARAM_H +#define ACE_LACKS_SYS_SYSCTL_H +#define ACE_LACKS_SYSCONF +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_UNISTD_H +#define ACE_LACKS_UNIX_SIGNALS +#define ACE_LACKS_UNIX_SYSLOG +#define ACE_LACKS_UTSNAME_T +#define ACE_LACKS_UNAME +#define ACE_LACKS_WAIT +#define ACE_LACKS_IOVEC +#define ACE_LACKS_LOG2 +#define ACE_LACKS_CADDR_T +#if !defined(__MINGW32__) && !defined (__BORLANDC__) +# define ACE_LACKS_MODE_T +#endif +#if !defined (__BORLANDC__) +# define ACE_LACKS_NLINK_T +# define ACE_LACKS_UID_T +# define ACE_LACKS_GID_T +#endif +#define ACE_LACKS_SETENV +#define ACE_LACKS_UNSETENV + +#define ACE_HAS_PDH_H +#define ACE_HAS_PDHMSG_H + +#define ACE_HAS_VFWPRINTF + +#define ACE_MKDIR_LACKS_MODE + +#define ACE_SIZEOF_LONG_LONG 8 +// Green Hills Native x86 does not support __int64 keyword +// Neither does mingw32. +#if !defined (ACE_LACKS_LONGLONG_T) && !defined (__MINGW32__) +#define ACE_INT64_TYPE signed __int64 +#define ACE_UINT64_TYPE unsigned __int64 +#endif /* (ghs) */ + +#if defined (__MINGW32__) +#define ACE_INT64_TYPE signed long long +#define ACE_UINT64_TYPE unsigned long long +#endif + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// Win32 has wide-char support. Use of the compiler-defined wchar_t type +// is controlled in compiler configs since it's a compiler switch. +#define ACE_HAS_WCHAR +#define ACE_HAS_WTOI +#define ACE_HAS_WTOL + +// Compiler/platform correctly calls init()/fini() for shared +// libraries. - applied for DLLs ? +//define ACE_HAS_AUTOMATIC_INIT_FINI + +// Platform supports POSIX O_NONBLOCK semantics. +//define ACE_HAS_POSIX_NONBLOCK + +// Platform contains . +//define ACE_HAS_POLL + +// Platform supports the /proc file system. +//define ACE_HAS_PROC_FS + +// Platform supports the rusage struct. +#define ACE_HAS_GETRUSAGE + +// Compiler/platform supports SVR4 signal typedef. +//define ACE_HAS_SVR4_SIGNAL_T + +// Platform provides header. +//define ACE_HAS_SYS_FILIO_H + +// Platform supports ACE_TLI timod STREAMS module. +//define ACE_HAS_TIMOD_H + +// Platform supports ACE_TLI tiuser header. +//define ACE_HAS_TIUSER_H + +// Platform provides ACE_TLI function prototypes. +// For Win32, this is not really true, but saves a lot of hassle! +#define ACE_HAS_TLI_PROTOTYPES + +// Platform supports ACE_TLI. +//define ACE_HAS_TLI + +// I'm pretty sure NT lacks these +#define ACE_LACKS_UNIX_DOMAIN_SOCKETS + +// Windows NT needs readv() and writev() +#define ACE_LACKS_WRITEV +#define ACE_LACKS_READV + +#if !defined (ACE_HAS_WTHREADS_CONDITION_VARIABLE) +# define ACE_LACKS_COND_T +#endif + +#define ACE_LACKS_RWLOCK_T + +#define ACE_LACKS_KEY_T + +// No system support for replacing any previous mappings. +#define ACE_LACKS_AUTO_MMAP_REPLACEMENT + +// ACE_HAS_PENTIUM is used to optimize some CDR operations; it's used for +// some other time-related things using g++, but not for VC. Current VC +// compilers set _M_IX86 > 400 by default so if you're not using a Pentium +// class CPU, set the project code generation options appropriately. +#if !defined(ACE_HAS_PENTIUM) && (_M_IX86 > 400) +# define ACE_HAS_PENTIUM +#endif + +#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +// Platform supports threads. +# define ACE_HAS_THREADS + +// Platform supports Windows32 threads. +# define ACE_HAS_WTHREADS + +// Compiler/platform has thread-specific storage +# define ACE_HAS_THREAD_SPECIFIC_STORAGE + +// Win32 doesn't have fcntl +#define ACE_LACKS_FCNTL + +#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ + +#if !defined(_DEBUG) +// If we are making a release, and the user has not specified +// inline directives, we will default to inline +# if ! defined (__ACE_INLINE__) +# define __ACE_INLINE__ 1 +# endif /* __ACE_INLINE__ */ +#endif + +// If __ACE_INLINE__ is defined to be 0, we will undefine it +#if defined (__ACE_INLINE__) && (__ACE_INLINE__ == 0) +# undef __ACE_INLINE__ +#endif /* __ACE_INLINE__ */ + +// We are build ACE and want to use MFC (multithreaded) +#if defined(ACE_HAS_MFC) && (ACE_HAS_MFC != 0) && defined (_MT) +# if (ACE_HAS_DLL != 0) && defined(ACE_BUILD_DLL) && !defined (_WINDLL) +// force multithreaded MFC DLL +# define _WINDLL +# endif /* _AFXDLL */ +# if !defined (_AFXDLL) && !defined (ACE_USES_STATIC_MFC) +# define _AFXDLL +# endif /* _AFXDLL */ +#endif + +// and MFC's are mutually +// incompatible. is brain-dead about MFC; it doesn't check +// to see whether MFC stuff is anticipated or already in progress +// before doing its thing. ACE needs (practically always) , +// and winsock in turn needs support either from windows.h or from +// afxwin.h. One or the other, not both. +// +// The MSVC++ V4.0 environment defines preprocessor macros that +// indicate the programmer has chosen something from the +// Build-->Settings-->General-->MFC combo-box. defines a +// macro itself to protect against double inclusion. We'll take +// advantage of all this to select the proper support for winsock. - +// trl 26-July-1996 + +// This is necessary since MFC users apparently can't #include +// directly. +#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) +# include /**/ /* He is doing MFC */ +// Windows.h will be included via afxwin.h->afx.h->afx_ver_.h->afxv_w32.h +// #define _INC_WINDOWS // Prevent winsock.h from including windows.h +#elif defined (ACE_HAS_WINCE) +# include /**/ +#endif + +#if !defined (_INC_WINDOWS) /* Already include windows.h ? */ +// Must define strict before including windows.h ! +# if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0) && !defined (STRICT) +# define STRICT 1 +# endif /* ACE_HAS_STRICT */ + +# if !defined (WIN32_LEAN_AND_MEAN) && !defined (ACE_NO_WIN32_LEAN_AND_MEAN) +# define WIN32_LEAN_AND_MEAN +# endif /* WIN32_LEAN_AND_MEAN */ + +#endif /* !defined (_INC_WINDOWS) */ + +// Always use WS2 when available +#if !defined(ACE_HAS_WINSOCK2) +# define ACE_HAS_WINSOCK2 1 +#endif /* !defined(ACE_HAS_WINSOCK2) */ +// Not use WS1 by default +#if !defined(ACE_HAS_WINSOCK1) +# define ACE_HAS_WINSOCK1 0 +#endif /* !defined(ACE_HAS_WINSOCK1) */ + + +#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) +# define ACE_HAS_ICMP_SUPPORT 1 +# if !defined (_WINSOCK2API_) +// will also include windows.h, if not present +# include /**/ +// WinCE 4 doesn't define the Exxx values without the WSA prefix, so do that +// here. This is all lifted from the #if 0'd out part of winsock2.h. +# if defined (_WIN32_WCE) && (_WIN32_WCE < 0x600) +# define EWOULDBLOCK WSAEWOULDBLOCK +# define EINPROGRESS WSAEINPROGRESS +# define EALREADY WSAEALREADY +# define ENOTSOCK WSAENOTSOCK +# define EDESTADDRREQ WSAEDESTADDRREQ +# define EMSGSIZE WSAEMSGSIZE +# define EPROTOTYPE WSAEPROTOTYPE +# define ENOPROTOOPT WSAENOPROTOOPT +# define EPROTONOSUPPORT WSAEPROTONOSUPPORT +# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +# define EOPNOTSUPP WSAEOPNOTSUPP +# define EPFNOSUPPORT WSAEPFNOSUPPORT +# define EAFNOSUPPORT WSAEAFNOSUPPORT +# define EADDRINUSE WSAEADDRINUSE +# define EADDRNOTAVAIL WSAEADDRNOTAVAIL +# define ENETDOWN WSAENETDOWN +# define ENETUNREACH WSAENETUNREACH +# define ENETRESET WSAENETRESET +# define ECONNABORTED WSAECONNABORTED +# define ECONNRESET WSAECONNRESET +# define ENOBUFS WSAENOBUFS +# define EISCONN WSAEISCONN +# define ENOTCONN WSAENOTCONN +# define ESHUTDOWN WSAESHUTDOWN +# define ETOOMANYREFS WSAETOOMANYREFS +# define ETIMEDOUT WSAETIMEDOUT +# define ECONNREFUSED WSAECONNREFUSED +# define ELOOP WSAELOOP +# define ENAMETOOLONG WSAENAMETOOLONG +# define EHOSTDOWN WSAEHOSTDOWN +# define EHOSTUNREACH WSAEHOSTUNREACH +# define ENOTEMPTY WSAENOTEMPTY +# define EPROCLIM WSAEPROCLIM +# define EUSERS WSAEUSERS +# define EDQUOT WSAEDQUOT +# define ESTALE WSAESTALE +# define EREMOTE WSAEREMOTE +# endif /* (_WIN32_WCE) && (_WIN32_WCE < 0x600) */ +# endif /* _WINSOCK2API */ + +# if defined (ACE_HAS_FORE_ATM_WS2) +# include /**/ +# endif /*ACE_HAS_FORE_ATM_WS2 */ + +// CE doesn't have Microsoft Winsock 2 extensions +# if !defined _MSWSOCK_ && !defined (ACE_HAS_WINCE) +# include /**/ +# endif /* _MSWSOCK_ */ + +# if defined (_MSC_VER) +# if defined (ACE_HAS_WINCE) +# pragma comment(lib, "ws2.lib") +# else +# pragma comment(lib, "ws2_32.lib") +# pragma comment(lib, "mswsock.lib") +# if defined (ACE_HAS_IPV6) +# pragma comment(lib, "iphlpapi.lib") +# endif +# endif /* ACE_HAS_WINCE */ +# endif /* _MSC_VER */ + +# define ACE_WSOCK_VERSION 2, 0 +#else +# if !defined (_WINSOCKAPI_) + // will also include windows.h, if not present +# include /**/ +# endif /* _WINSOCKAPI */ + +// PharLap ETS has its own winsock lib, so don't grab the one +// supplied with the OS. +# if defined (_MSC_VER) && !defined (_WIN32_WCE) && !defined (ACE_HAS_PHARLAP) +# pragma comment(lib, "wsock32.lib") +# endif /* _MSC_VER */ + +// We can't use recvmsg and sendmsg unless WinSock 2 is available +# define ACE_LACKS_RECVMSG +# define ACE_LACKS_SENDMSG + +// Version 1.1 of WinSock +# define ACE_WSOCK_VERSION 1, 1 +#endif /* ACE_HAS_WINSOCK2 */ + +// Platform supports IP multicast on Winsock 2 +#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) +# define ACE_HAS_IP_MULTICAST +#endif /* ACE_HAS_WINSOCK2 */ + +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_INTERLOCKED_EXCHANGEADD +#endif +#define ACE_HAS_WIN32_TRYLOCK + +#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP) +# define ACE_HAS_SIGNAL_OBJECT_AND_WAIT + +// If CancelIO is undefined get the updated sp2-sdk from MS +# define ACE_HAS_CANCEL_IO +# define ACE_HAS_WIN32_OVERLAPPED_IO +# define ACE_HAS_WIN32_NAMED_PIPES +#endif /* !defined (ACE_HAS_WINCE) && !ACE_HAS_PHARLAP */ + +#if !defined (ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION) +# define ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION EXCEPTION_CONTINUE_SEARCH +#endif /* ACE_SEH_DEFAULT_EXCEPTION_HANDLING_ACTION */ + +// ACE_HAS_QOS is defined in the qos.mpb base project. +// If qos=1 in default.features, then this macro will be defined. +#if defined (ACE_HAS_QOS) && !defined (ACE_HAS_WINSOCK2_GQOS) +# if defined (WINSOCK_VERSION) +# define ACE_HAS_WINSOCK2_GQOS 1 +# endif /* WINSOCK_VERSION */ +#endif /* ACE_HAS_WINSOCK2_GQOS */ + +// These are the defaults and can be overridden by a user's config.h +#if !defined (ACE_DEFAULT_FILE_PERMS) +# define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE | \ + FILE_SHARE_DELETE) +// This alternate used to be used for pre-NT4 systems; may still be needed +// by knock-offs such as CE and Pharlap. +//# define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE) +#endif /* !defined (ACE_DEFAULT_FILE_PERMS) */ + +#define ACE_SIZEOF_WCHAR 2 +#define ACE_HAS_MUTEX_TIMEOUTS +#define ACE_LACKS_STRUCT_DIR +#define ACE_LACKS_OPENDIR +#define ACE_LACKS_CLOSEDIR +#define ACE_LACKS_READDIR +#define ACE_LACKS_ALPHASORT +#define ACE_LACKS_MKSTEMP +#define ACE_LACKS_LSTAT +// Looks like Win32 has a non-const swab function +#define ACE_HAS_NONCONST_SWAB + +// If we are using winsock2 then the SO_REUSEADDR feature is broken +// SO_REUSEADDR=1 behaves like SO_REUSEPORT=1. (SO_REUSEPORT is an +// extension to sockets on some platforms) +// We define SO_REUSEPORT here so that ACE_OS::setsockopt() can still +// allow the user to specify that a socketaddr can *always* be reused. +#if defined (ACE_HAS_WINSOCK2) && ACE_HAS_WINSOCK2 != 0 && ! defined(SO_REUSEPORT) +#define SO_REUSEPORT 0x0400 // We just have to pick a value that won't conflict +#endif + +#if defined (ACE_WIN64) +// Data must be aligned on 8-byte boundaries, at a minimum. +# define ACE_MALLOC_ALIGN 8 +// Void pointers are 8 bytes +# define ACE_SIZEOF_VOID_P 8 +#endif /* ACE_WIN64 */ + +#if !defined (ACE_DISABLES_THREAD_LIBRARY_CALLS) +# define ACE_DISABLES_THREAD_LIBRARY_CALLS 0 +#endif /* ACE_DISABLES_THREAD_LIBRARY_CALLS */ + +#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP) +# define ACE_HAS_LOG_MSG_NT_EVENT_LOG +#endif /* !ACE_HAS_WINCE && !ACE_HAS_PHARLAP */ + +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_LLSEEK +#endif /* !ACE_HAS_WINCE */ + +// Needed for obtaining the MAC address +// I dont believe this will work under CE, notice the +// check for ACE_HAS_WINCE. +# if !defined (ACE_HAS_WINCE) +# include +# if defined (_MSC_VER) +# pragma comment(lib, "netapi32.lib") // needed for obtaing MACaddress +# endif +# endif /* !ACE_HAS_WINCE */ + +#if !defined (WINVER) +# define WINVER 0x0400 // pretend it's at least WinNT 4.0 +#endif + +/////////////////////////////////////// +// windows version-specific definitions +// see: http://msdn2.microsoft.com/en-us/library/aa383745.aspx +// +// For TSS information +// see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/thread_local_storage.asp + +#if (WINVER>=0x0600) +// Windows Server 2008 definitions go here +// Windows Vista defintions go here +# if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS 1088 +# endif // ! defined(ACE_DEFAULT_THREAD_KEYS) +#elif (WINVER>=0x0502) + // Windows Server 2003 SP1 definitions go here +# if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS 1088 +# endif // ! defined(ACE_DEFAULT_THREAD_KEYS) +#elif (WINVER>=0x0501) +// Windows XP definitions go here +# if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS 1088 +# endif // ! defined(ACE_DEFAULT_THREAD_KEYS) +#elif (WINVER>=0x0500) +// Windows 2000 definitions go here +# if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS 1088 +# endif // ! defined(ACE_DEFAULT_THREAD_KEYS) +#elif (WINVER>=0x0410) +// Windows 98 definitions go here +# if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS 80 +# endif // ! defined(ACE_DEFAULT_THREAD_KEYS) +#else +// antique windows +# if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS 64 +# endif // ! defined(ACE_DEFAULT_THREAD_KEYS) +#endif + +#if !defined (ACE_DEFAULT_BACKLOG) +# define ACE_DEFAULT_BACKLOG SOMAXCONN +#endif /* ACE_DEFAULT_BACKLOG */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_COMMON_H */ diff --git a/externals/ace/config-win32-dmc.h b/externals/ace/config-win32-dmc.h new file mode 100644 index 0000000..db6c7e9 --- /dev/null +++ b/externals/ace/config-win32-dmc.h @@ -0,0 +1,108 @@ +// -*- C++ -*- +// $Id: config-win32-dmc.h 87268 2009-10-29 21:06:06Z olli $ + +// The following configuration file contains defines for Digital Mars compilers. + +#ifndef ACE_CONFIG_WIN32_DMC_H +#define ACE_CONFIG_WIN32_DMC_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#ifndef WIN32 +# define WIN32 +#endif /* WIN32 */ + +#undef _M_IX86 +// This turns on ACE_HAS_PENTIUM +#define _M_IX86 500 + +#if defined ACE_LACKS_STRUCT_DIR +# undef ACE_LACKS_STRUCT_DIR +#endif + +// Changed ACE_TEXT to ACE_TEXT in the following line +# define ACE_CC_NAME ACE_TEXT ("Digital Mars") +# define ACE_CC_MAJOR_VERSION (1) +# define ACE_CC_MINOR_VERSION (8) +# define ACE_CC_BETA_VERSION (9) +# ifndef ACE_USING_MCPP_PREPROCESSOR +# define ACE_CC_PREPROCESSOR "DMC.EXE" +# define ACE_CC_PREPROCESSOR_ARGS "-E" +# endif + +// Microsoft's standard cpp library auto_ptr doesn't have reset (). +# define ACE_AUTO_PTR_LACKS_RESET + +#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) + +// This section below was extracted from config-win32-msvc +#define ACE_HAS_ITOA +#define ACE_ITOA_EQUIVALENT ::_itoa +#define ACE_STRCASECMP_EQUIVALENT ::_stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup +// This section above was extracted from config-win32-msvc + +# define ACE_EXPORT_NESTED_CLASSES 1 +# define ACE_HAS_CPLUSPLUS_HEADERS 1 +//# define ACE_HAS_EXCEPTIONS 1 +# define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 +# define ACE_HAS_SIG_ATOMIC_T 1 +# define ACE_HAS_STANDARD_CPP_LIBRARY 0 +# define ACE_HAS_STDCPP_STL_INCLUDES 1 +# define ACE_HAS_STRING_CLASS 1 +# define ACE_HAS_TEMPLATE_TYPEDEFS 1 +# define ACE_HAS_USER_MODE_MASKS 1 +//# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +# define ACE_LACKS_STRPTIME 1 +//# define ACE_LACKS_PRAGMA_ONCE 1 +//# define ACE_NEW_THROWS_EXCEPTIONS 1 +# define ACE_SIZEOF_LONG_DOUBLE 10 +# define ACE_TEMPLATES_REQUIRE_SOURCE 1 +// Changed ACE_TEXT to ACE_TEXT in the following two lines +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_HAS_STRBUF_T +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_USES_OLD_IOSTREAMS +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_SYS_RESOURCE_H +#define ACE_LACKS_SYS_WAIT_H +#define ACE_LACKS_STRINGS_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_SEMAPHORE_H +#define ACE_LACKS_SYS_MMAN_H +#define ACE_LACKS_SYS_UIO_H +#define ACE_LACKS_SYS_SOCKET_H +#define ACE_LACKS_NETINET_IN_H +#define ACE_LACKS_SYS_IOCTL_H +#define ACE_LACKS_SYS_SELECT_H +#define ACE_LACKS_NET_IF_H +#define ACE_LACKS_DLFCN_H +#define ACE_LACKS_NETDB_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_REGEX_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_NETINET_TCP_H +#define ACE_LACKS_UNISTD_H +#define ACE_LACKS_TERMIOS_H +#define ACE_LACKS_ACE_IOSTREAM +#define ACE_HAS_NONCONST_TEMPNAM + +// Typedefs which we expect DMC to do, but they don't do that +typedef long o_uid_t; +typedef long o_gid_t; + +#include "io.h" +#undef umask; +#undef tell; + +# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG) +# define ACE_LD_DECORATOR_STR ACE_TEXT ("d") +# endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_DMC_H */ diff --git a/externals/ace/config-win32-ghs.h b/externals/ace/config-win32-ghs.h new file mode 100644 index 0000000..0ac80bf --- /dev/null +++ b/externals/ace/config-win32-ghs.h @@ -0,0 +1,93 @@ +// -*- C++ -*- +// $Id: config-win32-ghs.h 87268 2009-10-29 21:06:06Z olli $ + +// The following configuration file contains defines for Green Hills compilers. + +#ifndef ACE_CONFIG_WIN32_GHS_H +#define ACE_CONFIG_WIN32_GHS_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#ifndef WIN32 +# define WIN32 +#endif /* WIN32 */ + +#undef _M_IX86 +// This turns on ACE_HAS_PENTIUM +#define _M_IX86 500 +// GHS does not provide DLL support +#define ACE_HAS_DLL 0 +#define TAO_HAS_DLL 0 +#undef _DLL + +//Green Hills Native x86 does not support structural exceptions +# undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS +# undef ACE_HAS_WCHAR +# define ACE_CONFIG_INCLUDE_GHS_COMMON +# include "ace/config-ghs-common.h" + +// Changed ACE_TEXT to ACE_TEXT in the following line +# define ACE_CC_NAME ACE_TEXT ("Green Hills C++") +# define ACE_CC_MAJOR_VERSION (1) +# define ACE_CC_MINOR_VERSION (8) +# define ACE_CC_BETA_VERSION (9) +# ifndef ACE_USING_MCPP_PREPROCESSOR +# define ACE_CC_PREPROCESSOR "GCX.EXE" +# define ACE_CC_PREPROCESSOR_ARGS "-E" +# endif + +// GHS uses Microsoft's standard cpp library, which has auto_ptr. +# undef ACE_LACKS_AUTO_PTR +// Microsoft's standard cpp library auto_ptr doesn't have reset (). +# define ACE_AUTO_PTR_LACKS_RESET + +#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) + +// This section below was extracted from config-win32-msvc +#define ACE_HAS_ITOA +#define ACE_ITOA_EQUIVALENT ::_itoa +#define ACE_STRCASECMP_EQUIVALENT ::_stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup +// This section above was extracted from config-win32-msvc + +# define ACE_EXPORT_NESTED_CLASSES 1 +# define ACE_HAS_CPLUSPLUS_HEADERS 1 +//# define ACE_HAS_EXCEPTIONS 1 +# define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 +# define ACE_HAS_SIG_ATOMIC_T 1 +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_HAS_STDCPP_STL_INCLUDES 1 +# define ACE_HAS_STRING_CLASS 1 +# define ACE_HAS_TEMPLATE_TYPEDEFS 1 +# define ACE_HAS_USER_MODE_MASKS 1 +# define ACE_LACKS_ACE_IOSTREAM 1 +//# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +# define ACE_LACKS_STRPTIME 1 +//# define ACE_LACKS_PRAGMA_ONCE 1 +# define ACE_LACKS_STRRECVFD 1 +//# define ACE_NEW_THROWS_EXCEPTIONS 1 +# define ACE_SIZEOF_LONG_DOUBLE 10 +# define ACE_TEMPLATES_REQUIRE_SOURCE 1 +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +// Set the following to zero to placate SString.h ACE_WString CTOR +# undef ACE_WSTRING_HAS_USHORT_SUPPORT + +// Green Hills Native x86 does not support __int64 keyword +# define ACE_LACKS_LONGLONG_T + +/* need to ensure these are included before */ +# include +# include + +# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG) +# define ACE_LD_DECORATOR_STR ACE_TEXT ("d") +# endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_GHS_H */ diff --git a/externals/ace/config-win32-interix.h b/externals/ace/config-win32-interix.h new file mode 100644 index 0000000..d0365ac --- /dev/null +++ b/externals/ace/config-win32-interix.h @@ -0,0 +1,127 @@ +// -*- C++ -*- +// $Id: config-win32-interix.h 87578 2009-11-16 14:41:47Z olli $ + +// The following configuration file is designed to work for Interix +// platforms using GNU g++ (Interix == Microsoft's Services for Unix) + +#ifndef ACE_CONFIG_WIN32_INTERIX_H +#define ACE_CONFIG_WIN32_INTERIX_H + +#include /**/ "ace/pre.h" + +#include "ace/config-g++-common.h" + +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_3_PARAM_READDIR_R +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_BROKEN_T_ERROR +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +#define ACE_HAS_DIRENT +#define ACE_HAS_EXCEPTIONS +#define ACE_HAS_GETPAGESIZE +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GETRUSAGE_PROTOTYPE +#define ACE_HAS_GPERF +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT +#define ACE_HAS_ICMP_SUPPORT 1 +#define ACE_HAS_IP_MULTICAST +#define ACE_HAS_MEMCHR +#define ACE_HAS_MKDIR +#define ACE_HAS_MSG +#define ACE_HAS_NEW_NOTHROW +#define ACE_HAS_NEW_NO_H +#define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_POLL +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 +#define ACE_HAS_POSIX_GETPWNAM_R +#define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_TIME +#define ACE_HAS_PTHREADS_STD +#define ACE_HAS_PTHREADS_UNIX98_EXT +#define ACE_HAS_PTHREAD_GETCONCURRENCY +#define ACE_HAS_PTHREAD_SETCONCURRENCY +#define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE +#define ACE_HAS_P_READ_WRITE +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_REENTRANT_FUNCTIONS +#define ACE_HAS_RTLD_LAZY_V +#define ACE_HAS_SEMUN +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SIGSUSPEND +#define ACE_HAS_SIGWAIT +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SIG_C_FUNC +#define ACE_HAS_SOCKADDR_MSG_NAME +#define ACE_HAS_SOCKLEN_T +#define ACE_HAS_SSIZE_T +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#define ACE_HAS_STDCPP_STL_INCLUDES +#define ACE_HAS_STREAMS +#define ACE_HAS_STRING_CLASS +#define ACE_HAS_STRSIGNAL +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_SVR4_GETTIMEOFDAY +#define ACE_HAS_SVR4_SIGNAL_T +#define ACE_HAS_SYSV_IPC +#define ACE_HAS_SYS_SYSCALL_H +#define ACE_HAS_TERMIOS +#define ACE_HAS_UALARM +#define ACE_HAS_UCONTEXT_T +#define ACE_HAS_VOIDPTR_GETTIMEOFDAY +#define ACE_HAS_NONSTATIC_OBJECT_MANAGER + +#define ACE_LACKS_GETPGID +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_LOG2 +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_NET_IF_H +#define ACE_LACKS_PRAGMA_ONCE +#define ACE_LACKS_SETSCHED +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SYS_SYSCTL_H +#define ACE_LACKS_TIMESPEC_T +#define ACE_LACKS_WCSTOK +#define ACE_LACKS_WCSTOLL +#define ACE_LACKS_WCSTOULL + +// These are probably not needed with gcc 4.x +#define ACE_LACKS_UNSETENV +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_STRTOULL +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID + + +#define ACE_PAGE_SIZE 4096 +#define ACE_SIZEOF_LONG_LONG 8 +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 + +#if defined (ACE_HAS_THREADS) +# define ACE_HAS_MUTEX_TIMEOUTS +# define ACE_HAS_PTHREADS +# define ACE_MT_SAFE 1 +#else +# error "You need to enable threads for this Interix port." +#endif /* ACE_HAS_THREADS */ + +// Turns off the tracing feature. +#if !defined (ACE_NTRACE) +#define ACE_NTRACE 1 +#endif /* ACE_NTRACE */ + +// NOTE: In debugging some of the test apps they would all memory fault in using +// ACE_Errno_Guard. Upon inspection of that code it uses TSS to save ERRNO in +// a TSS pointer. Access to that pointer caused the fault. The work around here +// is to tell ACE we have TSS and use emulation. More investigation is needed to +// determine whether Interix TSS is broken or the correct semantics for usage under +// Interix simply need to be ported. +// To get around the issue ACE_HAS_TSS_EMULATION is defined to use TSS emulation +// however while many test programs that use TSS pass the TSS_Test program fails. +#define ACE_HAS_THREAD_SPECIFIC_STORAGE // We need thread specific storage even though... +#define ACE_HAS_TSS_EMULATION // It would appear to be broken in Interix! + + +#include /**/ "ace/post.h" + +#endif /* ACE_CONFIG_WIN32_INTERIX_H */ diff --git a/externals/ace/config-win32-mingw.h b/externals/ace/config-win32-mingw.h new file mode 100644 index 0000000..0a0ff29 --- /dev/null +++ b/externals/ace/config-win32-mingw.h @@ -0,0 +1,105 @@ +// -*- C++ -*- +// $Id: config-win32-mingw.h 87167 2009-10-19 19:33:53Z olli $ + +// +// The following configuration file is designed to work for win32 +// platforms using gcc/g++ with mingw32 (http://www.mingw.org). +// + +#ifndef ACE_CONFIG_WIN32_MINGW_H +#define ACE_CONFIG_WIN32_MINGW_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +# error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#define ACE_CC_NAME ACE_TEXT ("g++") +#define ACE_CC_PREPROCESSOR "cpp" +#define ACE_CC_PREPROCESOR_ARGS "" + +// Why all this is not in config-g++-common.h? +#define ACE_CC_MAJOR_VERSION __GNUC__ +#define ACE_CC_MINOR_VERSION __GNUC_MINOR__ +#define ACE_CC_BETA_VERSION (0) + +#if !defined(__MINGW32__) +# error You do not seem to be using mingw32 +#endif + +#include "ace/config-g++-common.h" + +#include /**/ <_mingw.h> +#include /**/ + +#define ACE_HAS_USER_MODE_MASKS + +#if (__MINGW32_MAJOR_VERSION < 2) +# error You need a newer version (>= 2.0) of mingw32/w32api +#endif + +#if (__MINGW32_MAJOR_VERSION >= 3) +# define ACE_HAS_SSIZE_T +# undef ACE_LACKS_STRUCT_DIR +# undef ACE_LACKS_OPENDIR +# undef ACE_LACKS_CLOSEDIR +# undef ACE_LACKS_READDIR +# undef ACE_LACKS_TELLDIR +# undef ACE_LACKS_SEEKDIR +# undef ACE_LACKS_REWINDDIR +#else +# define ACE_LACKS_DIRENT_H +#endif + +#if (__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 15)) +# undef ACE_LACKS_USECONDS_T +#endif + +#undef ACE_HAS_WTOF + +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_TERMIOS_H +#define ACE_LACKS_NETINET_TCP_H +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_STRPTIME +#define ACE_LACKS_POLL_H +#define ACE_LACKS_REGEX_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_PWD_H +#define ACE_LACKS_SEMAPHORE_H +#define ACE_LACKS_UCONTEXT_H +#define ACE_LACKS_SYS_SELECT_H +#define ACE_LACKS_SYS_RESOURCE_H +#define ACE_LACKS_SYS_WAIT_H +#define ACE_LACKS_DLFCN_H +#define ACE_LACKS_SYS_MMAN_H +#define ACE_LACKS_SYS_UIO_H +#define ACE_LACKS_SYS_SOCKET_H +#define ACE_LACKS_NETINET_IN_H +#define ACE_LACKS_NETDB_H +#define ACE_LACKS_NET_IF_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_SYS_IOCTL_H +#define ACE_LACKS_PDH_H +#define ACE_LACKS_PDHMSG_H +#define ACE_HAS_NONCONST_WCSDUP +#define ACE_HAS_WINSOCK2_GQOS +#define ACE_ISCTYPE_EQUIVALENT ::_isctype + +// We trust the user: He must have used -mpentiumpro or -mpentium +// if that is what he wants. +#if defined(pentiumpro) || defined(pentium) +# define ACE_HAS_PENTIUM +#endif + +#define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" +#define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" + +#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) (STATUS)) + +#define ACE_DLL_PREFIX ACE_TEXT ("lib") + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MINGW_H */ diff --git a/externals/ace/config-win32-msvc-10.h b/externals/ace/config-win32-msvc-10.h new file mode 100644 index 0000000..1867aa0 --- /dev/null +++ b/externals/ace/config-win32-msvc-10.h @@ -0,0 +1,153 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file config-win32-msvc-10.h + * + * $Id: config-win32-msvc-10.h 87224 2009-10-26 07:49:31Z olli $ + * + * @brief Microsoft Visual C++ 10.0 configuration file. + * + * This file is the ACE configuration file for Microsoft Visual C++ version 10. + * + * @note Do not include this file directly, include config-win32.h instead. + */ +//============================================================================= + +#ifndef ACE_CONFIG_WIN32_MSVC_10_H +#define ACE_CONFIG_WIN32_MSVC_10_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#ifndef ACE_WIN32_VC10 +# define ACE_WIN32_VC10 +#endif + +// Visual C++ 9.0 (.NET) deprecated the old iostreams +#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#endif + +#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#endif + +// Windows' timeval is non-conformant (defined in terms of long instead of +// time_t) and VC9 (on desktop, not CE) changed time_t to a 64-bit value +// even when compiling a 32-bit application. Therefore, ace/Time_Value +// needs to rearrange a few things for this compiler. See Time_Value.h +// for complete details. +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_TIME_T_LONG_MISMATCH +#endif + +#define ACE_HAS_ITOA +#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +#define ACE_ITOA_EQUIVALENT ::_itoa +#define ACE_STRCASECMP_EQUIVALENT ::_stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup +#if defined (ACE_HAS_WINCE) +# define ACE_FILENO_EQUIVALENT ::_fileno +#else +# define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X))) +#endif + +#ifndef ACE_HAS_EXCEPTIONS +# define ACE_HAS_EXCEPTIONS +#endif + +// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will. +# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601) +# define ACE_HAS_SIG_ATOMIC_T +# endif /* !Win CE 6.0 or less */ + +#define ACE_LACKS_STRPTIME + +// Evaluate this with a WinCE build; maybe things have improved since VC8. +//#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_INTRIN_H +# define ACE_HAS_INTRINSIC_INTERLOCKED +//#endif + +#if !defined (_WIN32_WCE) || (_WIN32_WCE >= 0x501) +# define ACE_HAS_INTRINSIC_BYTESWAP +#endif + +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_STRRECVFD +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_TEMPLATES_REQUIRE_SOURCE + +// Platform provides ACE_TLI function prototypes. +// For Win32, this is not really true, but saves a lot of hassle! +#define ACE_HAS_TLI_PROTOTYPES + +// Platform support linebuffered streaming is broken +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) + +// Platform has its Standard C++ library in the namespace std +# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + +// ace/iostream.h does not work with the standard cpp library (yet). +# if !defined (ACE_USES_OLD_IOSTREAMS) +# define ACE_LACKS_ACE_IOSTREAM +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory. +#define ACE_NEW_THROWS_EXCEPTIONS +#define ACE_HAS_NEW_NOTHROW + +#else + +// iostream header lacks ipfx (), isfx (), etc., declarations +# define ACE_LACKS_IOSTREAM_FX + +#endif + +// There are too many instances of this warning to fix it right now. +// Maybe in the future. + +// Disable warning of using Microsoft Extension. +# pragma warning(disable:4231) + +// 'class1' : inherits 'class2::member' via dominance +#pragma warning(disable:4250) + +// CE (at least thru Windows Mobile 5) doesn't have the new, secure CRT. +#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_TR24731_2005_CRT) +# define ACE_HAS_TR24731_2005_CRT +#endif + +// On CE w/o MFC config-WinCE.h needs to declare a placement new. This +// triggers a warning that there's no placement delete, which can be ignored. +#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC) +# pragma warning(disable:4291) +#endif + +// A template can not be exported. Only an instantiation may be exported. +#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT + +// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to +// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. +# define ACE_NEEDS_FUNC_DEFINITIONS + +// Windows Vista and Windows Server 2008 and newer do have native condition +// variables +#if defined (WIN32_WINNT) && (WIN32_WINNT >= 0x0600) +# define ACE_HAS_WTHREADS_CONDITION_VARIABLE +# undef ACE_LACKS_COND_T +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MSVC_10_H */ diff --git a/externals/ace/config-win32-msvc-7.h b/externals/ace/config-win32-msvc-7.h new file mode 100644 index 0000000..30965d6 --- /dev/null +++ b/externals/ace/config-win32-msvc-7.h @@ -0,0 +1,124 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file config-win32-msvc-7.h + * + * $Id: config-win32-msvc-7.h 87251 2009-10-28 12:00:12Z olli $ + * + * @brief Microsoft Visual C++ 7.0 configuration file. + * + * This file is the ACE configuration file for Microsoft Visual C++ version 7. + * + * @note Do not include this file directly, include config-win32.h instead. + * + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_CONFIG_WIN32_MSVC_7_H +#define ACE_CONFIG_WIN32_MSVC_7_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +// Visual C++ 7.0 (.NET) deprecated the old iostreams +#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#endif + +#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#endif + +// Win64 SDK compiler claims std::auto_ptr<>::reset not available. +#if defined (_WIN64) || defined (WIN64) +#define ACE_AUTO_PTR_LACKS_RESET +#endif + +#define ACE_HAS_ITOA +#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +#define ACE_ITOA_EQUIVALENT ::_itoa +#define ACE_STRCASECMP_EQUIVALENT ::_stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup + +#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_EXCEPTIONS) +#define ACE_HAS_EXCEPTIONS +#endif /* ACE_HAS_WINCE */ + +#define ACE_LACKS_STRPTIME + +#define ACE_HAS_SIG_ATOMIC_T +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_STRRECVFD +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_TEMPLATES_REQUIRE_SOURCE + +// Platform provides ACE_TLI function prototypes. +// For Win32, this is not really true, but saves a lot of hassle! +#define ACE_HAS_TLI_PROTOTYPES + +// Platform support linebuffered streaming is broken +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +#if !defined (ACE_HAS_WINCE) && !(defined (__INTEL_COMPILER) && (__INTEL_COMPILER == 900)) +# define ACE_HAS_INTRINSIC_INTERLOCKED +# define ACE_HAS_INTRINSIC_BYTESWAP +#endif + +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) + +// Platform has its Standard C++ library in the namespace std +# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + +// ace/iostream.h does not work with the standard cpp library (yet). +# if !defined (ACE_USES_OLD_IOSTREAMS) +# define ACE_LACKS_ACE_IOSTREAM +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory. +// Since we don't support MSVC 7.0, don't test for it. +# define ACE_NEW_THROWS_EXCEPTIONS +# define ACE_HAS_NEW_NOTHROW + +#else + +// iostream header lacks ipfx (), isfx (), etc., declarations +# define ACE_LACKS_IOSTREAM_FX + +#endif + +// There are too many instances of this warning to fix it right now. +// Maybe in the future. +// 'this' : used in base member initializer list +#pragma warning(disable:4355) + +// 'class1' : inherits 'class2::member' via dominance +#pragma warning(disable:4250) + +// C++ Exception Specification ignored +#pragma warning(disable:4290) + +// Disable warning of using Microsoft Extension. +#pragma warning(disable:4231) + +// 'function' : unreferenced local function has been removed +#pragma warning(disable:4505) + +// A template can not be exported. Only an instantiation may be exported. +#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT + +// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to +// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. +# define ACE_NEEDS_FUNC_DEFINITIONS + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MSVC_7_H */ diff --git a/externals/ace/config-win32-msvc-8.h b/externals/ace/config-win32-msvc-8.h new file mode 100644 index 0000000..fafdd62 --- /dev/null +++ b/externals/ace/config-win32-msvc-8.h @@ -0,0 +1,163 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file config-win32-msvc-8.h + * + * $Id: config-win32-msvc-8.h 87224 2009-10-26 07:49:31Z olli $ + * + * @brief Microsoft Visual C++ 8.0 configuration file. + * + * This file is the ACE configuration file for Microsoft Visual C++ version 8. + * + * @note Do not include this file directly, include config-win32.h instead. + * + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_CONFIG_WIN32_MSVC_8_H +#define ACE_CONFIG_WIN32_MSVC_8_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#ifndef ACE_WIN32_VC8 +# define ACE_WIN32_VC8 +#endif + +// Visual C++ 8.0 (.NET) deprecated the old iostreams +#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#endif + +#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#endif + +// Windows' timeval is non-conformant (defined in terms of long instead of +// time_t) and VC8 (on desktop, not CE) changed time_t to a 64-bit value +// even when compiling a 32-bit application. Therefore, ace/Time_Value +// needs to rearrange a few things for this compiler. See Time_Value.h +// for complete details. +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_TIME_T_LONG_MISMATCH +#endif + +#define ACE_HAS_ITOA +#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +#define ACE_ITOA_EQUIVALENT ::_itoa +#define ACE_STRCASECMP_EQUIVALENT ::_stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup +#if defined (ACE_HAS_WINCE) +# define ACE_FILENO_EQUIVALENT ::_fileno +#else +# define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X))) +#endif + +#ifndef ACE_HAS_EXCEPTIONS +# define ACE_HAS_EXCEPTIONS +#endif + +// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will. +// This has been true up thrugh the versions. We don't have any indication +// that this might be supported in the future, but it is an easy enough fix +// to bump the wince revision number when a new version is released. +# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601) +# define ACE_HAS_SIG_ATOMIC_T +# endif /* !Win CE 6.0 or less */ + +#define ACE_LACKS_STRPTIME + +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_INTRIN_H +# define ACE_HAS_INTRINSIC_INTERLOCKED +#endif + +#if !defined (_WIN32_WCE) || (_WIN32_WCE >= 0x501) +# define ACE_HAS_INTRINSIC_BYTESWAP +#endif + +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_STRRECVFD +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_TEMPLATES_REQUIRE_SOURCE + +// Platform provides ACE_TLI function prototypes. +// For Win32, this is not really true, but saves a lot of hassle! +#define ACE_HAS_TLI_PROTOTYPES + +// Platform support linebuffered streaming is broken +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) + +// Platform has its Standard C++ library in the namespace std +# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + +// ace/iostream.h does not work with the standard cpp library (yet). +# if !defined (ACE_USES_OLD_IOSTREAMS) +# define ACE_LACKS_ACE_IOSTREAM +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory. +#define ACE_NEW_THROWS_EXCEPTIONS +#define ACE_HAS_NEW_NOTHROW + +#else + +// iostream header lacks ipfx (), isfx (), etc., declarations +# define ACE_LACKS_IOSTREAM_FX + +#endif + +// There are too many instances of this warning to fix it right now. +// Maybe in the future. + +// Disable warning of using Microsoft Extension. +#pragma warning(disable:4231) + +// 'class1' : inherits 'class2::member' via dominance +#pragma warning(disable:4250) + +// 'this' : used in base member initializer list +#pragma warning(disable:4355) + +// CE (at least thru Windows Mobile 5) doesn't have the new, secure CRT. +#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_TR24731_2005_CRT) +# define ACE_HAS_TR24731_2005_CRT +#endif + +//Detect Platform SDK 64-bit (AMD64) compiler using _MSC_FULL_VER +#if (defined (_WIN64) || defined (WIN64)) && _MSC_FULL_VER < 140050000 +# define ACE_AUTO_PTR_LACKS_RESET +# define ACE_MSVC_USES_DOUBLE_UNDERSCORE_STAT64 +# define ACE_HAS_BROKEN_STD_REVERSE_ITERATOR +# define ACE_LACKS_NUMERIC_LIMITS_64_BIT_TYPES +# undef ACE_HAS_TR24731_2005_CRT +# undef ACE_HAS_INTRIN_H +#endif + +// On CE w/o MFC config-WinCE.h needs to declare a placement new. This +// triggers a warning that there's no placement delete, which can be ignored. +#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC) +# pragma warning(disable:4291) +#endif + +// A template can not be exported. Only an instantiation may be exported. +#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT + +// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to +// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. +# define ACE_NEEDS_FUNC_DEFINITIONS + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MSVC_8_H */ diff --git a/externals/ace/config-win32-msvc-9.h b/externals/ace/config-win32-msvc-9.h new file mode 100644 index 0000000..bd6bcf6 --- /dev/null +++ b/externals/ace/config-win32-msvc-9.h @@ -0,0 +1,153 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file config-win32-msvc-9.h + * + * $Id: config-win32-msvc-9.h 87224 2009-10-26 07:49:31Z olli $ + * + * @brief Microsoft Visual C++ 9.0 configuration file. + * + * This file is the ACE configuration file for Microsoft Visual C++ version 9. + * + * @note Do not include this file directly, include config-win32.h instead. + */ +//============================================================================= + +#ifndef ACE_CONFIG_WIN32_MSVC_9_H +#define ACE_CONFIG_WIN32_MSVC_9_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#ifndef ACE_WIN32_VC9 +# define ACE_WIN32_VC9 +#endif + +// Visual C++ 9.0 (.NET) deprecated the old iostreams +#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#endif + +#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#endif + +// Windows' timeval is non-conformant (defined in terms of long instead of +// time_t) and VC9 (on desktop, not CE) changed time_t to a 64-bit value +// even when compiling a 32-bit application. Therefore, ace/Time_Value +// needs to rearrange a few things for this compiler. See Time_Value.h +// for complete details. +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_TIME_T_LONG_MISMATCH +#endif + +#define ACE_HAS_ITOA +#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +#define ACE_ITOA_EQUIVALENT ::_itoa +#define ACE_STRCASECMP_EQUIVALENT ::_stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup +#if defined (ACE_HAS_WINCE) +# define ACE_FILENO_EQUIVALENT ::_fileno +#else +# define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X))) +#endif + +#ifndef ACE_HAS_EXCEPTIONS +# define ACE_HAS_EXCEPTIONS +#endif + +// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will. +# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601) +# define ACE_HAS_SIG_ATOMIC_T +# endif /* !Win CE 6.0 or less */ + +#define ACE_LACKS_STRPTIME + +// Evaluate this with a WinCE build; maybe things have improved since VC8. +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_INTRIN_H +# define ACE_HAS_INTRINSIC_INTERLOCKED +#endif + +#if !defined (_WIN32_WCE) || (_WIN32_WCE >= 0x501) +# define ACE_HAS_INTRINSIC_BYTESWAP +#endif + +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_STRRECVFD +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_TEMPLATES_REQUIRE_SOURCE + +// Platform provides ACE_TLI function prototypes. +// For Win32, this is not really true, but saves a lot of hassle! +#define ACE_HAS_TLI_PROTOTYPES + +// Platform support linebuffered streaming is broken +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) + +// Platform has its Standard C++ library in the namespace std +# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + +// ace/iostream.h does not work with the standard cpp library (yet). +# if !defined (ACE_USES_OLD_IOSTREAMS) +# define ACE_LACKS_ACE_IOSTREAM +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory. +#define ACE_NEW_THROWS_EXCEPTIONS +#define ACE_HAS_NEW_NOTHROW + +#else + +// iostream header lacks ipfx (), isfx (), etc., declarations +# define ACE_LACKS_IOSTREAM_FX + +#endif + +// There are too many instances of this warning to fix it right now. +// Maybe in the future. + +// Disable warning of using Microsoft Extension. +# pragma warning(disable:4231) + +// 'class1' : inherits 'class2::member' via dominance +#pragma warning(disable:4250) + +// CE (at least thru Windows Mobile 5) doesn't have the new, secure CRT. +#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_TR24731_2005_CRT) +# define ACE_HAS_TR24731_2005_CRT +#endif + +// On CE w/o MFC config-WinCE.h needs to declare a placement new. This +// triggers a warning that there's no placement delete, which can be ignored. +#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC) +# pragma warning(disable:4291) +#endif + +// A template can not be exported. Only an instantiation may be exported. +#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT + +// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to +// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. +# define ACE_NEEDS_FUNC_DEFINITIONS + +// Windows Vista and Windows Server 2008 and newer do have native condition +// variables +#if defined (WIN32_WINNT) && (WIN32_WINNT >= 0x0600) +# define ACE_HAS_WTHREADS_CONDITION_VARIABLE +# undef ACE_LACKS_COND_T +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MSVC_9_H */ diff --git a/externals/ace/config-win32-msvc.h b/externals/ace/config-win32-msvc.h new file mode 100644 index 0000000..6f62477 --- /dev/null +++ b/externals/ace/config-win32-msvc.h @@ -0,0 +1,175 @@ +//============================================================================= +/** + * @file config-win32-msvc.h + * + * $Id: config-win32-msvc.h 85785 2009-06-24 18:20:42Z mitza $ + * + * @brief Microsoft Visual C++ configuration file. + * + * This file is the ACE configuration file for Microsoft Visual C++ versions + * 5.0, 6.0, and 7.0 (.NET) + * + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_CONFIG_WIN32_MSVC_H +#define ACE_CONFIG_WIN32_MSVC_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#define ACE_CC_NAME ACE_TEXT ("Visual C++") +#ifndef ACE_USING_MCPP_PREPROCESSOR +# define ACE_CC_PREPROCESSOR "CL.EXE" +# define ACE_CC_PREPROCESSOR_ARGS "-nologo -E" +#endif + +#define ACE_CC_MAJOR_VERSION (_MSC_VER / 100 - 6) +#define ACE_CC_MINOR_VERSION (_MSC_VER % 100) +#define ACE_CC_BETA_VERSION (0) + +#if !defined(_NATIVE_WCHAR_T_DEFINED) + #define ACE_LACKS_NATIVE_WCHAR_T +#endif + +// Win Mobile still does thread exits differently than PC Windows. +#if defined (_WIN32_WCE) +# define ACE_ENDTHREADEX(STATUS) ExitThread ((DWORD) STATUS) +#else +# define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) +#endif /* _WIN32_WCE */ + +//FUZZ: disable check_for_msc_ver +#if (_MSC_VER >= 1600) +# include "ace/config-win32-msvc-10.h" +#elif (_MSC_VER >= 1500) +# include "ace/config-win32-msvc-9.h" +#elif (_MSC_VER >= 1400) +# include "ace/config-win32-msvc-8.h" +#elif (_MSC_VER >= 1310) +# include "ace/config-win32-msvc-7.h" +#else +# error This version of Microsoft Visual C++ is not supported. +#endif +//FUZZ: enable check_for_msc_ver + +// MFC changes the behavior of operator new at all MSVC versions from 6 up +// by throwing a static CMemoryException* instead of std::bad_alloc +// (see ace/OS_Memory.h). This MFC exception object needs to be cleaned up +// by calling its Delete() method. +#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC == 1) +# if !defined (ACE_NEW_THROWS_EXCEPTIONS) +# define ACE_NEW_THROWS_EXCEPTIONS +# endif +# if defined (ACE_bad_alloc) +# undef ACE_bad_alloc +# endif +# define ACE_bad_alloc CMemoryException *e +# if defined (ACE_del_bad_alloc) +# undef ACE_del_bad_alloc +# endif +# define ACE_del_bad_alloc e->Delete(); +#endif /* ACE_HAS_MFC && ACE_HAS_MFC==1 */ + +#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +// must have _MT defined to include multithreading +// features from win32 headers +# if !defined(_MT) && !defined (ACE_HAS_WINCE) +// *** DO NOT *** defeat this error message by defining _MT yourself. +// On MSVC, this is changed by selecting the Multithreaded +// DLL or Debug Multithreaded DLL in the Project Settings +// under C++ Code Generation. +# error You must link against multi-threaded libraries when using ACE (check your project settings) +# endif /* !_MT && !ACE_HAS_WINCE */ +#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ + +#include +// Although ACE does have alloca() on this compiler/platform combination, it is +// disabled by default since it can be dangerous. Uncomment the following line +// if you ACE to use it. +//#define ACE_HAS_ALLOCA 1 + +#define ACE_LACKS_DIRENT_H +#define ACE_LACKS_DLFCN_H +#define ACE_LACKS_INTTYPES_H +#define ACE_LACKS_NETDB_H +#define ACE_LACKS_NET_IF_H +#define ACE_LACKS_NETINET_IN_H +#define ACE_LACKS_STDINT_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_SYS_IOCTL_H +#define ACE_LACKS_SYS_IPC_H +#define ACE_LACKS_SYS_MMAN_H +#define ACE_LACKS_SYS_RESOURCE_H +#define ACE_LACKS_SYS_SELECT_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_SYS_SOCKET_H +#define ACE_LACKS_SYS_TIME_H +#define ACE_LACKS_SYS_UIO_H +#define ACE_LACKS_SYS_WAIT_H +#define ACE_LACKS_UCONTEXT_H + +#define ACE_LACKS_SEMAPHORE_H +#define ACE_LACKS_STRINGS_H +#define ACE_LACKS_PWD_H +#define ACE_LACKS_POLL_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_NETINET_TCP_H +#define ACE_LACKS_TERMIOS_H +#define ACE_LACKS_REGEX_H + +#define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" +#define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" + +#define ACE_STRTOLL_EQUIVALENT ::_strtoi64 +#define ACE_WCSTOLL_EQUIVALENT ::_wcstoi64 +#define ACE_STRTOULL_EQUIVALENT ::_strtoui64 +#define ACE_WCSTOULL_EQUIVALENT ::_wcstoui64 +#define ACE_WTOF_EQUIVALENT ::_wtof + +#define ACE_LACKS_ISBLANK +#define ACE_LACKS_ISWBLANK +#define ACE_LACKS_CORRECT_ISWPRINT_TAB +#define ACE_ISCTYPE_EQUIVALENT ::_isctype + +// Turn off warnings for /W4 +// To resume any of these warning: #pragma warning(default: 4xxx) +// which should be placed after these defines + +#if !defined (ALL_WARNINGS) && defined(_MSC_VER) && !defined(ghs) && !defined(__MINGW32__) +# pragma warning(disable: 4127) /* constant expression for TRACE/ASSERT */ +# pragma warning(disable: 4134) /* message map member fxn casts */ +# pragma warning(disable: 4511) /* private copy constructors are good to have */ +# pragma warning(disable: 4512) /* private operator= are good to have */ +# pragma warning(disable: 4514) /* unreferenced inlines are common */ +# pragma warning(disable: 4710) /* private constructors are disallowed */ +# pragma warning(disable: 4705) /* statement has no effect in optimized code */ +# pragma warning(disable: 4791) /* loss of debugging info in retail version */ +# pragma warning(disable: 4275) /* deriving exported class from non-exported */ +# pragma warning(disable: 4251) /* using non-exported as public in exported */ +# pragma warning(disable: 4786) /* identifier was truncated to '255' characters in the browser information */ +# pragma warning(disable: 4097) /* typedef-name used as synonym for class-name */ +# pragma warning(disable: 4800) /* converting int to boolean */ +# if defined (__INTEL_COMPILER) +# pragma warning(disable: 1744) /* field of class type without a DLL interface used in a class with a DLL interface */ +# pragma warning(disable: 1738) +# endif +#endif /* !ALL_WARNINGS && _MSV_VER && !ghs && !__MINGW32__ */ + +// STRICT type checking in WINDOWS.H enhances type safety for Windows +// programs by using distinct types to represent all the different +// HANDLES in Windows. So for example, STRICT prevents you from +// mistakenly passing an HPEN to a routine expecting an HBITMAP. +// Note that we only use this if we +# if defined (ACE_HAS_STRICT) && (ACE_HAS_STRICT != 0) +# if !defined (STRICT) /* may already be defined */ +# define STRICT +# endif /* !STRICT */ +# endif /* ACE_HAS_STRICT */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MSVC_H */ diff --git a/externals/ace/config-win32.h b/externals/ace/config-win32.h new file mode 100644 index 0000000..af94651 --- /dev/null +++ b/externals/ace/config-win32.h @@ -0,0 +1,55 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file config-win32.h + * + * $Id: config-win32.h 85057 2009-04-08 10:59:58Z msmit $ + * + * @brief Microsoft Windows configuration file. + * + * This file is the ACE configuration file for all of Microsoft Windows + * platforms that ACE runs on. Based on preprocessor definitions, it + * includes other more specific configuration files. + * + * @author Darrell Brunsch + */ +//============================================================================= + +#ifndef ACE_CONFIG_WIN32_H +#define ACE_CONFIG_WIN32_H +#include /**/ "ace/pre.h" + +// NOTE: Please do not add anything besides #include's here. Put other stuff +// (definitions, etc.) in the included headers + +// We need to ensure that for Borland vcl.h can be included before +// windows.h. So we will not include config-win32-common.h from here, +// but instead let it be included at the appropriate place in +// config-win32-borland.h. +#if !defined (__BORLANDC__) +# include "ace/config-win32-common.h" +#endif /* !__BORLANDC__ */ + +// Include the config-win32-* file specific to the compiler +#if defined (__BORLANDC__) +# include "ace/config-win32-borland.h" +#elif defined (_MSC_VER) +# include "ace/config-win32-msvc.h" +#elif defined (ghs) +# include "ace/config-win32-ghs.h" +#elif defined (ACE_HAS_CEGCC) //need to be prior to MINGW32 +# include "ace/config-win32-cegcc.h" +#elif defined (__MINGW32__) +# include "ace/config-win32-mingw.h" +#elif defined (__DMC__) +# include "ace/config-win32-dmc.h" +#else +# error Compiler is not supported +#endif + +// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses +#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_H */ + diff --git a/externals/ace/config.h b/externals/ace/config.h new file mode 100644 index 0000000..d3408e6 --- /dev/null +++ b/externals/ace/config.h @@ -0,0 +1 @@ +#include "ace/config-win32.h" \ No newline at end of file diff --git a/externals/ace/config.h.in b/externals/ace/config.h.in new file mode 100644 index 0000000..aa09aa4 --- /dev/null +++ b/externals/ace/config.h.in @@ -0,0 +1,2204 @@ +/* ace/config.h.in. Generated from configure.ac by autoheader. */ + + +#ifndef ACE_CONFIG_H +#define ACE_CONFIG_H + +// ACE configuration header file + + + + +/* Compiler/platform standard C++ auto_ptr implementation lacks reset() method + */ +#undef ACE_AUTO_PTR_LACKS_RESET + +/* Enable ACE_Timeprobes */ +#undef ACE_COMPILE_TIMEPROBES + +/* */ +#undef ACE_DEFAULT_BASE_ADDR + +/* */ +#undef ACE_DEFAULT_BASE_ADDRL + +/* */ +#undef ACE_DEFAULT_CLOSE_ALL_HANDLES + +/* */ +#undef ACE_DEFAULT_MAX_SOCKET_BUFSIZ + +/* The default number of handles the select()-based reactor should handle */ +#undef ACE_DEFAULT_SELECT_REACTOR_SIZE + +/* Number of TSS keys, with ACE_HAS_TSS_EMULATION _only_. Defaults to 64. */ +#undef ACE_DEFAULT_THREAD_KEYS + +/* Define this if you don't want debug version ACE search for debug version + DLLs first before looking for the DLL names specified. */ +#undef ACE_DISABLE_DEBUG_DLL_CHECK + +/* Do not include emulation for timed semaphore acquisitions. */ +#undef ACE_DISABLE_POSIX_SEM_TIMEOUT_EMULATION + +/* Define to 1 to disable swapping swapping CDR on read */ +#undef ACE_DISABLE_SWAP_ON_READ + +/* Define to DLL file suffix */ +#undef ACE_DLL_SUFFIX + +/* Define to 1 to enable swapping swapping CDR on write */ +#undef ACE_ENABLE_SWAP_ON_WRITE + +/* Compiler requires template args when explicitly calling template + destructor. */ +#undef ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS + +/* Define to 1 if the getsockname() and getpeername() return random values in + the sockaddr_in.sin_zero field. */ +#undef ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO + +/* Uses ctime_r & asctime_r with only two parameters vs. three. */ +#undef ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + +/* Define to 1 if platform has 2 parameter sched_getaffinity() */ +#undef ACE_HAS_2_PARAM_SCHED_GETAFFINITY + +/* Define to 1 if platform has 2 parameter sched_setaffinity() */ +#undef ACE_HAS_2_PARAM_SCHED_SETAFFINITY + +/* Define to 1 if platform has 3 parameter readdir_r() */ +#undef ACE_HAS_3_PARAM_READDIR_R + +/* Define to 1 if platform has 3 parameter wcstok() */ +#undef ACE_HAS_3_PARAM_WCSTOK + +/* Platform has BSD 4.4 sendmsg()/recvmsg() APIs. */ +#undef ACE_HAS_4_4BSD_SENDMSG_RECVMSG + +/* Platform supports Asynchronous IO calls */ +#undef ACE_HAS_AIO_CALLS + +/* Platform has AIX4 ::read_real_time() */ +#undef ACE_HAS_AIX_HI_RES_TIMER + +/* Compiler/platform supports alloca(). */ +#undef ACE_HAS_ALLOCA + +/* Compiler/platform has */ +#undef ACE_HAS_ALLOCA_H + +/* Define to 1 if system should use Alpha's cycle counter */ +#undef ACE_HAS_ALPHA_TIMER + +/* Use ACE's alternate cuserid() implementation since a system cuserid() may + not exist, or it is not desirable to use it. The implementation requires + ACE_LACKS_PWD_FUNCTIONS to be undefined and that the geteuid() system call + exists. */ +#undef ACE_HAS_ALT_CUSERID + +/* Compiler/platform correctly calls init()/fini() for shared libraries. */ +#undef ACE_HAS_AUTOMATIC_INIT_FINI + +/* Compiler/platform has "big" fd_set, i.e. large number of bits set in fd_set + passed back from select(). */ +#undef ACE_HAS_BIG_FD_SET + +/* Platform sendv() does not work properly with datagrams, i.e. it fails when + the iovec size is IOV_MAX. */ +#undef ACE_HAS_BROKEN_DGRAM_SENDV + +/* Platform doesn't cast MAP_FAILED to a (void *). */ +#undef ACE_HAS_BROKEN_MAP_FAILED + +/* HP/UX does not wrap the mmap(2) header files with extern "C". */ +#undef ACE_HAS_BROKEN_MMAP_H + +/* Platform headers don't support prototypes */ +#undef ACE_HAS_BROKEN_MSG_H + +/* Platform defines struct timespec in */ +#undef ACE_HAS_BROKEN_POSIX_TIME + +/* OS/compiler's header files are inconsistent with libC definition of + rand_r(). */ +#undef ACE_HAS_BROKEN_RANDR + +/* Compiler/platform has the wrong prototype for t_error(), i.e., t_error(char + *) rather than t_error(const char *). */ +#undef ACE_HAS_BROKEN_T_ERROR + +/* Platform has (which contains bzero() prototype) */ +#undef ACE_HAS_BSTRING + +/* Define to 1 if platform has bswap16(). */ +#undef ACE_HAS_BSWAP16 + +/* Define to 1 if platform has bswap32(). */ +#undef ACE_HAS_BSWAP32 + +/* Define to 1 if platform has bswap64(). */ +#undef ACE_HAS_BSWAP64 + +/* Define to 1 if platform has bswap_16(). */ +#undef ACE_HAS_BSWAP_16 + +/* Define to 1 if platform has bswap_32(). */ +#undef ACE_HAS_BSWAP_32 + +/* Define to 1 if platform has bswap_64(). */ +#undef ACE_HAS_BSWAP_64 + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_BYTESEX_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_BYTESWAP_H + +/* Platform supports the Win32 CancelIO() function. (WinNT 4.0 and beyond) */ +#undef ACE_HAS_CANCEL_IO + +/* OS/platform uses char * for dlopen/dlsym args, rather than const char *. */ +#undef ACE_HAS_CHARPTR_DL + +/* Define to 1 if arg 2 of 'shmat' is char *' */ +#undef ACE_HAS_CHARPTR_SHMAT + +/* Define to 1 if arg 1 of 'shmdt' is char *' */ +#undef ACE_HAS_CHARPTR_SHMDT + +/* OS/platform uses char * for sockopt, rather than const char * */ +#undef ACE_HAS_CHARPTR_SOCKOPT + +/* Define to 1 if platform has clock_gettime(). */ +#undef ACE_HAS_CLOCK_GETTIME + +/* Define to 1 if platform has clock_settime(). */ +#undef ACE_HAS_CLOCK_SETTIME + +/* OS header files have some problems with XTI (HP/UX 11). */ +#undef ACE_HAS_CONFLICTING_XTI_MACROS + +/* Prototypes for both signal() and struct sigaction are consistent. */ +#undef ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +/* Platform has swab(const char*, char*, ssize_t) variant. */ +#undef ACE_HAS_CONST_CHAR_SWAB + +/* Compiler/platform has correctly prototyped header files. */ +#undef ACE_HAS_CPLUSPLUS_HEADERS + +/* Define to 1 if the system has the type `cpu_set_t'. */ +#undef ACE_HAS_CPU_SET_T + +/* Platform defines custom DSO/DLL symbol export macros. */ +#undef ACE_HAS_CUSTOM_EXPORT_MACROS + +/* Platform supports /dev/poll character device. */ +#undef ACE_HAS_DEV_POLL + +/* Platform supports operations on directories via struct dirent, readdir_r, + etc. */ +#undef ACE_HAS_DIRENT + +/* Build ACE using the frigging PC DLL nonsense... */ +#undef ACE_HAS_DLL + +/* Define to 1 if the dlsym() call segfaults when passed an invalid handle. */ +#undef ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE + +/* Platform (Linux) supports event poll interface. */ +#undef ACE_HAS_EVENT_POLL + +/* Compiler supports C++ exception handling. */ +#undef ACE_HAS_EXCEPTIONS + +/* Platform has Fast-Light (FL) toolkit installed. */ +#undef ACE_HAS_FL + +/* Define to 1 if compiler has builtin atomic support */ +#undef ACE_HAS_GCC_ATOMIC_BUILTINS + +/* Define to 1 if platform has getifaddrs(). */ +#undef ACE_HAS_GETIFADDRS + +/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be + defined, except on Win32). */ +#undef ACE_HAS_GETPAGESIZE + +/* Define to 1 if platform has getprogname(). */ +#undef ACE_HAS_GETPROGNAME + +/* Define to 1 if platform has getrusage(). */ +#undef ACE_HAS_GETRUSAGE + +/* Define to 1 if platform has the declaration of getrusage(). */ +#undef ACE_HAS_GETRUSAGE_PROTOTYPE + +/* Enable use of GNU template repositories. GNU C++ w/repo patch and EGCS only + */ +#undef ACE_HAS_GNU_REPO + +/* The GPERF utility is compiled for this platform */ +#undef ACE_HAS_GPERF + +/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) + */ +#undef ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +/* Define to 1 if system has SunOS high resolution timer. */ +#undef ACE_HAS_HI_RES_TIMER + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_IA32INTRIN_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_IA64INTRIN_H + +/* Defined to 1 if platform supports ICMP over raw sockets */ +#undef ACE_HAS_ICMP_SUPPORT + +/* Define to 1 if the system has the type `idtype_t'. */ +#undef ACE_HAS_IDTYPE_T + +/* Inline all the static class OS methods to remove call overhead Note: This + gets defined by OS.h if __ACE_INLINE__ is defined */ +#undef ACE_HAS_INLINED_OSCALLS + +/* Define to 1 if the system has the type `int16_t'. */ +#undef ACE_HAS_INT16_T + +/* Define to 1 if the system has the type `int32_t'. */ +#undef ACE_HAS_INT32_T + +/* Define to 1 if the system has the type `int64_t'. */ +#undef ACE_HAS_INT64_T + +/* Define to 1 if the system has the type `int8_t'. */ +#undef ACE_HAS_INT8_T + +/* Define to 1 if the system supports x86/x86_64 inline assembly */ +#undef ACE_HAS_INTEL_ASSEMBLY + +/* Platform supports the intrinsic interlocked optimizations. */ +#undef ACE_HAS_INTRINSIC_INTERLOCKED + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_INTRIN_H + +/* Platform supports IPv6 */ +#undef ACE_HAS_IPV6 + +/* Platform supports IP multicast */ +#undef ACE_HAS_IP_MULTICAST + +/* Platform supports the very odd IRIX 6.2 threads... */ +#undef ACE_HAS_IRIX62_THREADS + +/* Define to 1 if platform has the declaration of isastream(). */ +#undef ACE_HAS_ISASTREAM_PROTOTYPE + +/* Define to 1 if platform has itoa(). */ +#undef ACE_HAS_ITOA + +/* The rusage_t structure has only two fields. */ +#undef ACE_HAS_LIMITED_RUSAGE_T + +/* Define to 1 if system has Linux version of sysinfo(). */ +#undef ACE_HAS_LINUX_SYSINFO + +/* Platform supports llseek(). This should not be defined if ACE_HAS_LSEEK64 + is defined. */ +#undef ACE_HAS_LLSEEK + +/* Platform defines MAP_FAILED as a long constant. */ +#undef ACE_HAS_LONG_MAP_FAILED + +/* Platform supports lseek64(). This should not be defined if ACE_HAS_LLSEEK + is defined. */ +#undef ACE_HAS_LSEEK64 + +/* */ +#undef ACE_HAS_LYNXOS4_SIGNALS + +/* Enabled malloc statistics collection. */ +#undef ACE_HAS_MALLOC_STATS + +/* Define to 1 if platform has memchr(). */ +#undef ACE_HAS_MEMCHR + +/* Define to 1 if unrolled ACE_OS::fast_memcpy() is faster than system + memcpy() */ +#undef ACE_HAS_MEMCPY_LOOP_UNROLL + +/* Platform supports Microsoft Foundation Classes */ +#undef ACE_HAS_MFC + +/* Define to 1 if platform has mkdir(). */ +#undef ACE_HAS_MKDIR + +/* Platform supports recvmsg and sendmsg */ +#undef ACE_HAS_MSG + +/* Platform supports MT safe mktime() call (do any of them?) */ +#undef ACE_HAS_MT_SAFE_MKTIME + +/* Sockets may be called in multi-threaded programs */ +#undef ACE_HAS_MT_SAFE_SOCKETS + +/* Compiler supports timed mutex acquisitions (e.g. + pthread_mutex_timedlock()). */ +#undef ACE_HAS_MUTEX_TIMEOUTS + +/* Define to 1 if platform has nanosleep(). */ +#undef ACE_HAS_NANOSLEEP + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_NEW_H + +/* Compiler supports new (std::nothrow) */ +#undef ACE_HAS_NEW_NOTHROW + +/* Platform provides new style C++ header */ +#undef ACE_HAS_NEW_NO_H + +/* Define to 1 if system has nonconst FD_ISSET() macro. */ +#undef ACE_HAS_NONCONST_FD_ISSET + +/* Platform uses non-const char * in calls to gethostbyaddr, gethostbyname, + getservbyname */ +#undef ACE_HAS_NONCONST_GETBY + +/* Platform has a non-const parameter to msgsnd() (e.g., SCO). */ +#undef ACE_HAS_NONCONST_MSGSND + +/* Platform omits const qualifier from iovec parameter in readv() prototype. + */ +#undef ACE_HAS_NONCONST_READV + +/* Platform's select() uses non-const timeval* (only found on Linux right now) + */ +#undef ACE_HAS_NONCONST_SELECT_TIMEVAL + +/* Platform omits const qualifier from msghdr parameter in sendmsg() + prototype. */ +#undef ACE_HAS_NONCONST_SENDMSG + +/* Platform omits const qualifier from rlimit parameter in setrlimit() + prototype. */ +#undef ACE_HAS_NONCONST_SETRLIMIT + +/* Platform has swab(char*, char*, ssize_t) variant. */ +#undef ACE_HAS_NONCONST_SWAB + +/* Platform omits const qualifier from iovec parameter in writev() prototype. + */ +#undef ACE_HAS_NONCONST_WRITEV + +/* Causes the ACE_Object_Manager instance to be created in main (int, char + *[]), instead of as a static (global) instance. */ +#undef ACE_HAS_NONSTATIC_OBJECT_MANAGER + +/* Compiler/platform uses old malloc()/free() prototypes (ugh) */ +#undef ACE_HAS_OLD_MALLOC + +/* Platform, e.g., Solaris 2.5, only supports SCHED_OTHER POSIX scheduling + policy. */ +#undef ACE_HAS_ONLY_SCHED_OTHER + +/* Use the semaphore implementation of ACE_Message_Queue rather than the + emulated condition variable (NT and VxWorks). */ +#undef ACE_HAS_OPTIMIZED_MESSAGE_QUEUE + +/* timezone* 2nd parameter & no prototype */ +#undef ACE_HAS_OSF1_GETTIMEOFDAY + +/* Platform supports the OSF TLI timod STREAMS module */ +#undef ACE_HAS_OSF_TIMOD_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_PDH_H + +/* Define to 1 if system is using Intel Pentium(tm) processor */ +#undef ACE_HAS_PENTIUM + +/* Platform contains */ +#undef ACE_HAS_POLL + +/* Platform supports "position-independent" features provided by + ACE_Based_Pointer<>. */ +#undef ACE_HAS_POSITION_INDEPENDENT_POINTERS + +/* Platform supports POSIX getpwnam_r() function */ +#undef ACE_HAS_POSIX_GETPWNAM_R + +/* Platform supports POSIX O_NONBLOCK semantics */ +#undef ACE_HAS_POSIX_NONBLOCK + +/* Platform supports POSIX realtime signals */ +#undef ACE_HAS_POSIX_REALTIME_SIGNALS + +/* Platform supports POSIX real-time semaphores (e.g., VxWorks and Solaris) */ +#undef ACE_HAS_POSIX_SEM + +/* Platform supports timed POSIX semaphore acquisitions (sem_timedwait()). */ +#undef ACE_HAS_POSIX_SEM_TIMEOUT + +/* Platform supports the POSIX struct timespec type */ +#undef ACE_HAS_POSIX_TIME + +/* Define to 1 if system should use PowerPC's cycle counter */ +#undef ACE_HAS_POWERPC_TIMER + +/* OS has priocntl (2) */ +#undef ACE_HAS_PRIOCNTL + +/* Platform supports the /proc file system and defines tid_t in + */ +#undef ACE_HAS_PROC_FS + +/* Define to 1 if the system has the type `prusage_t'. */ +#undef ACE_HAS_PRUSAGE_T + +/* Define to 1 if platform has POSIX threads */ +#undef ACE_HAS_PTHREADS + +/* Platform supports POSIX Threads .4a Draft 4 */ +#undef ACE_HAS_PTHREADS_DRAFT4 + +/* Platform supports POSIX Threads .4a Draft 6 */ +#undef ACE_HAS_PTHREADS_DRAFT6 + +/* Platform supports POSIX Threads .1c Draft 7 */ +#undef ACE_HAS_PTHREADS_DRAFT7 + +/* Platform supports POSIX.1c-1995 threads */ +#undef ACE_HAS_PTHREADS_STD + +/* Platform has the UNIX98 extensions to Pthreads (rwlocks) */ +#undef ACE_HAS_PTHREADS_UNIX98_EXT + +/* Define to 1 if platform has pthread_attr_setcreatesuspend_np(). */ +#undef ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP + +/* Define to 1 if platform has pthread_condattr_setkind_np(). */ +#undef ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP + +/* Define to 1 if platform has pthread_continue(). */ +#undef ACE_HAS_PTHREAD_CONTINUE + +/* Define to 1 if platform has pthread_continue_np(). */ +#undef ACE_HAS_PTHREAD_CONTINUE_NP + +/* Define to 1 if platform has pthread_getaffinity_np(). */ +#undef ACE_HAS_PTHREAD_GETAFFINITY_NP + +/* Define to 1 if platform has pthread_getconcurrency(). */ +#undef ACE_HAS_PTHREAD_GETCONCURRENCY + +/* Define to 1 if platform has pthread_mutexattr_setkind_np(). */ +#undef ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_PTHREAD_NP_H + +/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and + PTHREAD_PROCESS_SHARED values */ +#undef ACE_HAS_PTHREAD_PROCESS_ENUM + +/* Define to 1 if platform has pthread_resume_np(). */ +#undef ACE_HAS_PTHREAD_RESUME_NP + +/* Define to 1 if platform has pthread_setaffinity_np(). */ +#undef ACE_HAS_PTHREAD_SETAFFINITY_NP + +/* Define to 1 if platform has pthread_setconcurrency(). */ +#undef ACE_HAS_PTHREAD_SETCONCURRENCY + +/* Define to 1 if platform has the declaration of pthread_sigmask(). */ +#undef ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE + +/* Define to 1 if platform has pthread_suspend(). */ +#undef ACE_HAS_PTHREAD_SUSPEND + +/* Define to 1 if platform has pthread_suspend_np(). */ +#undef ACE_HAS_PTHREAD_SUSPEND_NP + +/* Purify'ing. Defined on command line. */ +#undef ACE_HAS_PURIFY + +/* Platform has pread() and pwrite() support. */ +#undef ACE_HAS_P_READ_WRITE + +/* Quantify'ing. Defined on command line. */ +#undef ACE_HAS_QUANTIFY + +/* Define to 1 to configure Reactor to use a user-space queue for + notifications */ +#undef ACE_HAS_REACTOR_NOTIFICATION_QUEUE + +/* Mutexes are inherently recursive (e.g., Win32) */ +#undef ACE_HAS_RECURSIVE_MUTEXES + +/* Platform will recurse infinitely on thread exits from TSS cleanup routines + (e.g., AIX) */ +#undef ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS + +/* Platform supports reentrant functions (i.e., all the POSIX *_r functions). + */ +#undef ACE_HAS_REENTRANT_FUNCTIONS + +/* Platform supports the POSIX regular expression library */ +#undef ACE_HAS_REGEX + +/* Platform has enum instead of int for first argument to ::{get,set}rlimit + (). The value of this macro is the enum definition, e.g., enum + __rlimit_resource, for Linux glibc 2.0. */ +#undef ACE_HAS_RLIMIT_RESOURCE_ENUM + +/* Platform has enum instead of int for first argument to ::getrusage (). The + value of this macro is the enum definition, e.g., enum __rusage_who, for + Linux glibc 2.0. */ +#undef ACE_HAS_RUSAGE_WHO_ENUM + +/* Define to 1 if platform has sched_getaffinity(). */ +#undef ACE_HAS_SCHED_GETAFFINITY + +/* Define to 1 if platform has sched_setaffinity(). */ +#undef ACE_HAS_SCHED_SETAFFINITY + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SELECT_H + +/* Compiler/platform defines a union semun for SysV shared memory */ +#undef ACE_HAS_SEMUN + +/* Define to 1 if platform has setprogname(). */ +#undef ACE_HAS_SETPROGNAME + +/* Define to 1 if platform has set_t_errno(). */ +#undef ACE_HAS_SET_T_ERRNO + +/* Platform has shm_open() */ +#undef ACE_HAS_SHM_OPEN + +/* Platform's sigaction() function takes const sigaction* as 2nd parameter */ +#undef ACE_HAS_SIGACTION_CONSTP2 + +/* Define to 1 if the system has the type `siginfo_t'. */ +#undef ACE_HAS_SIGINFO_T + +/* Platform has bug with sigismember() (HP/UX 11). */ +#undef ACE_HAS_SIGISMEMBER_BUG + +/* Platform supports the Win32 SignalObjectAndWait() function (WinNT 4.0 and + beyond). */ +#undef ACE_HAS_SIGNAL_OBJECT_AND_WAIT + +/* Define to 1 if platform has sigsuspend(). */ +#undef ACE_HAS_SIGSUSPEND + +/* Define to 1 if platform has sigtimedwait(). */ +#undef ACE_HAS_SIGTIMEDWAIT + +/* Define to 1 if `sigval_int' is a member of `union sigval'. */ +#undef ACE_HAS_SIGVAL_SIGVAL_INT + +/* Define to 1 if `sigval_ptr' is a member of `union sigval'. */ +#undef ACE_HAS_SIGVAL_SIGVAL_PTR + +/* Define to 1 if platform has sigwait(). */ +#undef ACE_HAS_SIGWAIT + +/* Define to 1 if the system has the type 'sig_atomic_t'. */ +#undef ACE_HAS_SIG_ATOMIC_T + +/* Compiler requires extern "C" functions for signals. */ +#undef ACE_HAS_SIG_C_FUNC + +/* OS/compiler uses size_t * rather than int * for socket lengths */ +#undef ACE_HAS_SIZET_SOCKET_LEN + +/* Define to 1 if `sin6_len' is a member of `sockaddr_in6'. */ +#undef ACE_HAS_SOCKADDR_IN6_SIN6_LEN + +/* Define to 1 if `sin_len' is a member of `sockaddr_in'. */ +#undef ACE_HAS_SOCKADDR_IN_SIN_LEN + +/* Platform requires (struct sockaddr *) for msg_name field of struct msghdr. + */ +#undef ACE_HAS_SOCKADDR_MSG_NAME + +/* Define to 1 if the system has the type `socklen_t'. */ +#undef ACE_HAS_SOCKLEN_T + +/* Define to 1 if the system has the type `ssize_t'. */ +#undef ACE_HAS_SSIZE_T + +/* Platform/compiler supports Standard C++ Library */ +#undef ACE_HAS_STANDARD_CPP_LIBRARY + +/* Platform has void (*)(...) prototype for pthread_key_create() destructor + (e.g., LynxOS). */ +#undef ACE_HAS_STDARG_THR_DEST + +/* */ +#undef ACE_HAS_STDCPP_STL_INCLUDES + +/* Platform provides C++ header */ +#undef ACE_HAS_STDEXCEPT_NO_H + +/* Define to 1 if platform has UNIX International Threads */ +#undef ACE_HAS_STHREADS + +/* Define to 1 if the system has the type `struct strbuf'. */ +#undef ACE_HAS_STRBUF_T + +/* Define to 1 use ACE's strdup() emulation */ +#undef ACE_HAS_STRDUP_EMULATION + +/* Platform supports STREAMS */ +#undef ACE_HAS_STREAMS + +/* Platform supports STREAM pipes */ +#undef ACE_HAS_STREAM_PIPES + +/* Use the STRICT compilation mode on Win32. */ +#undef ACE_HAS_STRICT + +/* Platform has (which contains bzero() prototype) */ +#undef ACE_HAS_STRINGS + +/* Platform/Compiler supports a String class (e.g., GNU or Win32). */ +#undef ACE_HAS_STRING_CLASS + +/* Define to 1 if platform has strnlen(). */ +#undef ACE_HAS_STRNLEN + +/* Define to 1 if platform has strsignal(). */ +#undef ACE_HAS_STRSIGNAL + +/* Compiler/platform has strange hostent API for socket *_r() calls */ +#undef ACE_HAS_STRUCT_NETDB_DATA + +/* Compiler/platform supports SVR4 dynamic linking semantics */ +#undef ACE_HAS_SVR4_DYNAMIC_LINKING + +/* Compiler/platform supports SVR4 gettimeofday() prototype but doesn't have a + prototype */ +#undef ACE_HAS_SVR4_GETTIMEOFDAY + +/* Compiler/platform supports SVR4 signal typedef. */ +#undef ACE_HAS_SVR4_SIGNAL_T + +/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff). */ +#undef ACE_HAS_SVR4_TLI + +/* Define to 1 if platform has sysctl(). */ +#undef ACE_HAS_SYSCTL + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYSENT_H + +/* Platform supports System V IPC (most versions of UNIX, but not Win32) */ +#undef ACE_HAS_SYSV_IPC + +/* Define to 1 if system has SysV version of sysinfo(). */ +#undef ACE_HAS_SYSV_SYSINFO + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYS_FILIO_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYS_LOADAVG_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYS_PSTAT_H + +/* Compiler/platform supports _sys_siglist array */ +#undef ACE_HAS_SYS_SIGLIST + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYS_SOCKIO_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYS_SYSCALL_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYS_SYSINFO_H + +/* Define to 1 if platform has the header file. */ +#undef ACE_HAS_SYS_SYSTEMINFO_H + +/* Platform provides header */ +#undef ACE_HAS_SYS_XTI_H + +/* */ +#undef ACE_HAS_TANDEM_SIGNALS + +/* Compiler implements templates that support typedefs inside of classes used + as formal arguments to a template class. */ +#undef ACE_HAS_TEMPLATE_TYPEDEFS + +/* Define to 1 if system supports SysV tty API. */ +#undef ACE_HAS_TERMIO + +/* Define to 1 if system supports POSIX tty API. */ +#undef ACE_HAS_TERMIOS + +/* Platform supports threads. */ +#undef ACE_HAS_THREADS + +/* Platform allows multiple threads to call accept() on the same port (e.g., + WinNT). */ +#undef ACE_HAS_THREAD_SAFE_ACCEPT + +/* Platform has thread_self() rather than pthread_self() (e.g., DCETHREADS and + AIX) */ +#undef ACE_HAS_THREAD_SELF + +/* Compiler/platform has thread-specific storage */ +#undef ACE_HAS_THREAD_SPECIFIC_STORAGE + +/* The pthread_keycreate() routine *must* take extern C functions. */ +#undef ACE_HAS_THR_C_DEST + +/* The pthread_create() routine *must* take extern C functions. */ +#undef ACE_HAS_THR_C_FUNC + +/* Platform supports thr_keydelete (e.g,. UNIXWARE) */ +#undef ACE_HAS_THR_KEYDELETE + +/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). + */ +#undef ACE_HAS_THR_MINSTACK + +/* Platform has thr_yield() */ +#undef ACE_HAS_THR_YIELD + +/* Define to 1 if platform has global timezone variable */ +#undef ACE_HAS_TIMEZONE + +/* Platform/compiler supports timezone * as second parameter to gettimeofday() + and has a prototype. */ +#undef ACE_HAS_TIMEZONE_GETTIMEOFDAY + +/* Platform supports TLI timod STREAMS module */ +#undef ACE_HAS_TIMOD_H + +/* Platform supports TLI tiuser header */ +#undef ACE_HAS_TIUSER_H + +/* Platform does not protect with extern "C" */ +#undef ACE_HAS_TIUSER_H_BROKEN_EXTERN_C + +/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */ +#undef ACE_HAS_TLI + +/* Platform provides TLI function prototypes */ +#undef ACE_HAS_TLI_PROTOTYPES + +/* ACE provides TSS emulation. See also ACE_DEFAULT_THREAD_KEYS. */ +#undef ACE_HAS_TSS_EMULATION + +/* Define to 1 if platform has ualarm(). */ +#undef ACE_HAS_UALARM + +/* Define to 1 if the system has the type `ucontext_t'. */ +#undef ACE_HAS_UCONTEXT_T + +/* Define to 1 if the system has the type `uint16_t'. */ +#undef ACE_HAS_UINT16_T + +/* Define to 1 if the system has the type `uint32_t'. */ +#undef ACE_HAS_UINT32_T + +/* Define to 1 if the system has the type `uint64_t'. */ +#undef ACE_HAS_UINT64_T + +/* Define to 1 if the system has the type `uint8_t'. */ +#undef ACE_HAS_UINT8_T + +/* Has inconsistent SVR4 signal stuff, but not the same as the other platforms + */ +#undef ACE_HAS_UNIXWARE_SVR4_SIGNAL_T + +/* Define to 1 if platform has vasprintf(). */ +#undef ACE_HAS_VASPRINTF + +/* Define to 1 if platform has vaswprintf(). */ +#undef ACE_HAS_VASWPRINTF + +/* Prints out console message in ACE_NOTSUP. Useful for tracking down origin + of ACE_NOTSUP. */ +#undef ACE_HAS_VERBOSE_NOTSUP + +/* Define to 1 if platform has vfwprintf(). */ +#undef ACE_HAS_VFWPRINTF + +/* Platform/compiler supports void * as second parameter to gettimeofday() and + has a prototype. */ +#undef ACE_HAS_VOIDPTR_GETTIMEOFDAY + +/* Platform requires void * for mmap(). */ +#undef ACE_HAS_VOIDPTR_MMAP + +/* OS/compiler uses void * arg 4 setsockopt() rather than const char * */ +#undef ACE_HAS_VOIDPTR_SOCKOPT + +/* Define to 1 if platform has vswprintf(). */ +#undef ACE_HAS_VSWPRINTF + +/* Platform/compiler supports wchar_t */ +#undef ACE_HAS_WCHAR + +/* Define to 1 use ACE's wcsdup() emulation */ +#undef ACE_HAS_WCSDUP_EMULATION + +/* Define to 1 if platform has wcsnlen(). */ +#undef ACE_HAS_WCSNLEN + +/* Platform/compiler supports Win32 structural exceptions. */ +#undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS + +/* The Win32 platform support TryEnterCriticalSection(). (WinNT 4.0 and + beyond) */ +#undef ACE_HAS_WIN32_TRYLOCK + +/* The Win32 platform supports WinSock 2.0. */ +#undef ACE_HAS_WINSOCK2 + +/* Compiler handles explicit calling of template destructor correctly. */ +#undef ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +/* Solaris for intel uses macros for fstat() and stat(), these are wrappers + for _fxstat() and _xstat() uses of the macros. Causes compile and runtime + problems. */ +#undef ACE_HAS_X86_STAT_MACROS + +/* Platform has the XLI version of TLI */ +#undef ACE_HAS_XLI + +/* Platform has support for multi-byte character support compliant with the + XPG4 Worldwide Portability Interface wide-character classification. */ +#undef ACE_HAS_XPG4_MULTIBYTE_CHAR + +/* Platform has Xt Intrinsics Toolkit */ +#undef ACE_HAS_XT + +/* Platform has XTI (X/Open-standardized superset of TLI). Implies ACE_HAS_TLI + but uses a different header file. */ +#undef ACE_HAS_XTI + +/* Define to 1 if platform has _InterlockedDecrement(). */ +#undef ACE_HAS__INTERLOCKEDDECREMENT + +/* Define to 1 if platform has _InterlockedExchangeAdd(). */ +#undef ACE_HAS__INTERLOCKEDEXCHANGEADD + +/* Define to 1 if platform has _InterlockedIncrement(). */ +#undef ACE_HAS__INTERLOCKEDINCREMENT + +/* Define to the *printf format specifier (e.g. "%lld") for ACE_INT64 */ +#undef ACE_INT64_FORMAT_SPECIFIER + +/* Define to signed 64 bit integer type */ +#undef ACE_INT64_TYPE + +/* Define to the type of arg 2 for `ioctl'. */ +#undef ACE_IOCTL_TYPE_ARG2 + +/* Define to 1 if platform lacks access(). */ +#undef ACE_LACKS_ACCESS + +/* Do not compile support for the "Codecs" ACE features. */ +#undef ACE_LACKS_ACE_CODECS + +/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily + mean that the platform does not support iostreams. */ +#undef ACE_LACKS_ACE_IOSTREAM + +/* Do not compile support for the "other" ACE features, such as CORBA + handling, name services, and QoS. */ +#undef ACE_LACKS_ACE_OTHER + +/* Do not compile support for the ACE Service Configurator. */ +#undef ACE_LACKS_ACE_SVCCONF + +/* Do not compile support for the ACE Token feature. */ +#undef ACE_LACKS_ACE_TOKEN + +/* Do not compile support for the ACE UUID feature. */ +#undef ACE_LACKS_ACE_UUID + +/* Define to 1 if platform lacks alarm(). */ +#undef ACE_LACKS_ALARM + +/* Define to 1 if platform lacks alphasort(). */ +#undef ACE_LACKS_ALPHASORT + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_ARPA_INET_H + +/* Define to 1 if platform lacks asctime(). */ +#undef ACE_LACKS_ASCTIME + +/* Define to 1 if platform lacks asctime_r(). */ +#undef ACE_LACKS_ASCTIME_R + +/* No system support for replacing any previous mappings. */ +#undef ACE_LACKS_AUTO_MMAP_REPLACEMENT + +/* Platform lacks support for the standard C++ auto_ptr class */ +#undef ACE_LACKS_AUTO_PTR + +/* Define to 1 if platform lacks bsearch(). */ +#undef ACE_LACKS_BSEARCH + +/* Define to 1 to support unaligned CDR */ +#undef ACE_LACKS_CDR_ALIGNMENT + +/* Compiler does not have any istream operator>> for chars, u_chars, or signed + chars. */ +#undef ACE_LACKS_CHAR_RIGHT_SHIFTS + +/* Compiler does not have operator>> (istream &, u_char *) or operator>> + (istream &, signed char *) */ +#undef ACE_LACKS_CHAR_STAR_RIGHT_SHIFTS + +/* Define to 1 if platform lacks chdir(). */ +#undef ACE_LACKS_CHDIR + +/* Define to 1 if system lacks pthread_condattr_setpshared() */ +#undef ACE_LACKS_CONDATTR_PSHARED + +/* Platform lacks condition variables (e.g., Win32 and VxWorks) */ +#undef ACE_LACKS_COND_T + +/* pthread_cond_timedwait does *not* reset the time argument when the lock is + acquired. */ +#undef ACE_LACKS_COND_TIMEDWAIT_RESET + +/* Platform uses struct strbuf * rather than const struct strbuf * (e.g., + HP/UX 10.x) */ +#undef ACE_LACKS_CONST_STRBUF_PTR + +/* Platform forgot const in cond_timewait (e.g., HP/UX). */ +#undef ACE_LACKS_CONST_TIMESPEC_PTR + +/* Define to 1 if platform lacks difftime(). */ +#undef ACE_LACKS_DIFFTIME + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_DIRENT_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_DLFCN_H + +/* Define to 1 if platform lacks dup(). */ +#undef ACE_LACKS_DUP + +/* Define to 1 if platform lacks dup2(). */ +#undef ACE_LACKS_DUP2 + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_ERRNO_H + +/* Platform lacks the exec() family of system calls (e.g., Win32, VxWorks, + Chorus) */ +#undef ACE_LACKS_EXEC + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_EXECINFO_H + +/* Define to 1 if platform lacks fcntl(). */ +#undef ACE_LACKS_FCNTL + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_FCNTL_H + +/* Define to 1 if platform lacks fgetwc(). */ +#undef ACE_LACKS_FGETWC + +/* Define to 1 if platform lacks fgetws(). */ +#undef ACE_LACKS_FGETWS + +/* Define to 1 if the system lacks the type `struct flock'. */ +#undef ACE_LACKS_FILELOCKS + +/* Define to 1 if platform lacks fork(). */ +#undef ACE_LACKS_FORK + +/* Define to 1 if platform lacks fputws(). */ +#undef ACE_LACKS_FPUTWS + +/* Define to 1 if platform lacks fsync(). */ +#undef ACE_LACKS_FSYNC + +/* Define to 1 if platform lacks getcwd(). */ +#undef ACE_LACKS_GETCWD + +/* Define to 1 if platform lacks getegid(). */ +#undef ACE_LACKS_GETEGID + +/* Define to 1 if platform lacks geteuid(). */ +#undef ACE_LACKS_GETEUID + +/* Define to 1 if platform lacks getgid(). */ +#undef ACE_LACKS_GETGID + +/* Define to 1 if platform lacks gethostent(). */ +#undef ACE_LACKS_GETHOSTENT + +/* Define to 1 if platform lacks getipnodebyaddr(). */ +#undef ACE_LACKS_GETIPNODEBYADDR + +/* Define to 1 if platform lacks getipnodebyname(). */ +#undef ACE_LACKS_GETIPNODEBYNAME + +/* Define to 1 if platform lacks getopt(). */ +#undef ACE_LACKS_GETOPT + +/* Define to 1 if platform lacks the declaration of getopt(). */ +#undef ACE_LACKS_GETOPT_PROTOTYPE + +/* Define to 1 if platform lacks getpgid(). */ +#undef ACE_LACKS_GETPGID + +/* Define to 1 if platform lacks getpgid() declaration in . */ +#undef ACE_LACKS_GETPGID_PROTOTYPE + +/* Define to 1 if platform lacks getpid(). */ +#undef ACE_LACKS_GETPID + +/* Define to 1 if platform lacks getppid(). */ +#undef ACE_LACKS_GETPPID + +/* Platforms lacks getservbyname() (e.g., VxWorks and Chorus). */ +#undef ACE_LACKS_GETSERVBYNAME + +/* Define to 1 if platform lacks getuid(). */ +#undef ACE_LACKS_GETUID + +/* Define to 1 if platform lacks gmtime(). */ +#undef ACE_LACKS_GMTIME + +/* Define to 1 if platform lacks gmtime_r(). */ +#undef ACE_LACKS_GMTIME_R + +/* Define to 1 if platform lacks inet_aton(). */ +#undef ACE_LACKS_INET_ATON + +/* Platform can't handle "inline" keyword correctly. */ +#undef ACE_LACKS_INLINE_FUNCTIONS + +/* Define to 1 if the system lacks the type `intmax_t'. */ +#undef ACE_LACKS_INTMAX_T + +/* Define to 1 if the system lacks the type `intptr_t'. */ +#undef ACE_LACKS_INTPTR_T + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_INTTYPES_H + +/* iostream header does not declare ipfx (), opfx (), etc. */ +#undef ACE_LACKS_IOSTREAM_FX + +/* iostreams are not supported adequately on the given platform. */ +#undef ACE_LACKS_IOSTREAM_TOTALLY + +/* Define to 1 if platform lacks isatty(). */ +#undef ACE_LACKS_ISATTY + +/* Define to 1 if platform lacks isblank(). */ +#undef ACE_LACKS_ISBLANK + +/* Define to 1 if platform lacks isctype(). */ +#undef ACE_LACKS_ISCTYPE + +/* Define to 1 if platform lacks iswblank(). */ +#undef ACE_LACKS_ISWBLANK + +/* Define to 1 if platform lacks iswctype(). */ +#undef ACE_LACKS_ISWCTYPE + +/* Define to 1 if platform lacks itow(). */ +#undef ACE_LACKS_ITOW + +/* Define to 1 if the system lacks the type `key_t'. */ +#undef ACE_LACKS_KEY_T + +/* Define to 1 if platform lacks kill(). */ +#undef ACE_LACKS_KILL + +/* Platform lacks streambuf "linebuffered ()". */ +#undef ACE_LACKS_LINEBUFFERED_STREAMBUF + +/* Platform/compiler lacks the llseek() prototype. This should not be defined + if ACE_LACKS_LSEEK64_PROTOTYPE is defined. */ +#undef ACE_LACKS_LLSEEK_PROTOTYPE + +/* Define to 1 if platform lacks localtime(). */ +#undef ACE_LACKS_LOCALTIME + +/* Define to 1 if platform lacks log2(). */ +#undef ACE_LACKS_LOG2 + +/* Compiler/platform does not support the unsigned long long datatype. */ +#undef ACE_LACKS_LONGLONG_T + +/* Platform/compiler lacks the lseek64() prototype. This should not be defined + if ACE_LACKS_LLSEEK_PROTOTYPE is defined. */ +#undef ACE_LACKS_LSEEK64_PROTOTYPE + +/* Define to 1 if platform lacks lstat(). */ +#undef ACE_LACKS_LSTAT + +/* Define to 1 if platform lacks madvise(). */ +#undef ACE_LACKS_MADVISE + +/* Define to 1 if platform lacks the declaration of madvise(). */ +#undef ACE_LACKS_MADVISE_PROTOTYPE + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_MALLOC_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_MEMORY_H + +/* Define to 1 if platform lacks mkfifo(). */ +#undef ACE_LACKS_MKFIFO + +/* Define to 1 if platform lacks mkstemp(). */ +#undef ACE_LACKS_MKSTEMP + +/* Define to 1 if platform lacks the declaration of mkstemp(). */ +#undef ACE_LACKS_MKSTEMP_PROTOTYPE + +/* Define to 1 if platform lacks mktemp(). */ +#undef ACE_LACKS_MKTEMP + +/* Define to 1 if platform lacks the declaration of mktemp(). */ +#undef ACE_LACKS_MKTEMP_PROTOTYPE + +/* The platform doesn't have mmap(2) (e.g., SCO UNIX). */ +#undef ACE_LACKS_MMAP + +/* Platform/compiler doesn't have open() mode masks. */ +#undef ACE_LACKS_MODE_MASKS + +/* Platform does not have Motif X toolkit available */ +#undef ACE_LACKS_MOTIF + +/* Define to 1 if platform lacks mprotect(). */ +#undef ACE_LACKS_MPROTECT + +/* Platform defines ACE_HAS_MSG, but lacks msg_accrights{len}. */ +#undef ACE_LACKS_MSG_ACCRIGHTS + +/* Define to 1 if platform lacks msync(). */ +#undef ACE_LACKS_MSYNC + +/* Define to 1 if system lacks pthread_mutexattr_setpshared(). */ +#undef ACE_LACKS_MUTEXATTR_PSHARED + +/* Platform lacks named POSIX semaphores (e.g., Chorus) */ +#undef ACE_LACKS_NAMED_POSIX_SEM + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_NETDB_H + +/* Platform does not support reentrant netdb functions (getprotobyname_r, + getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */ +#undef ACE_LACKS_NETDB_REENTRANT_FUNCTIONS + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_NETINET_IN_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_NETINET_TCP_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_NET_IF_H + +/* OS requires non-null status pointer for pthread_join () */ +#undef ACE_LACKS_NULL_PTHREAD_STATUS + +/* Platform lacks std::numeric_limits<> */ +#undef ACE_LACKS_NUMERIC_LIMITS + +/* Define to 1 if platform lacks IGMPv3 "perfect" filtering of multicast + datagrams at the socket level. If defined, ACE_SOCK_Dgram_Mcast will bind + the first joined multicast group to the socket, and all future joins on + that socket will fail with an error. */ +#undef ACE_LACKS_PERFECT_MULTICAST_FILTERING + +/* Define to 1 if platform lacks pipe(). */ +#undef ACE_LACKS_PIPE + +/* Compiler doesn't support placement operator delete(void *, void *). */ +#undef ACE_LACKS_PLACEMENT_OPERATOR_DELETE + +/* Compiler complains about use of obsolete "pragma once" */ +#undef ACE_LACKS_PRAGMA_ONCE + +/* Platform/compiler lacks the pread() and pwrite() prototypes */ +#undef ACE_LACKS_PREAD_PROTOTYPE + +/* Define to 1 if the system lacks the type 'pri_t'. */ +#undef ACE_LACKS_PRI_T + +/* Define to 1 if platform lacks pthread_attr_setstack() */ +#undef ACE_LACKS_PTHREAD_ATTR_SETSTACK + +/* Define to 1 if platform lacks pthread_attr_setstackaddr(). */ +#undef ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR + +/* Define to 1 if platform lacks pthread_attr_setstacksize(). */ +#undef ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE + +/* Platform lacks pthread_cancel() */ +#undef ACE_LACKS_PTHREAD_CANCEL + +/* Define to 1 if platform lacks pthread_sigmask(). */ +#undef ACE_LACKS_PTHREAD_SIGMASK + +/* Define to 1 if platform lacks pthread_thr_sigsetmask(). */ +#undef ACE_LACKS_PTHREAD_THR_SIGSETMASK + +/* Define to 1 if platform lacks pthread_yield(). */ +#undef ACE_LACKS_PTHREAD_YIELD + +/* Platform lacks, getpwnam(), etc. */ +#undef ACE_LACKS_PWD_FUNCTIONS + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_PWD_H + +/* Platform lacks getpwnam_r() methods (e.g., SGI 6.2). */ +#undef ACE_LACKS_PWD_REENTRANT_FUNCTIONS + +/* Define to 1 if platform lacks qsort(). */ +#undef ACE_LACKS_QSORT + +/* Define to 1 if platform lacks readdir_r(). */ +#undef ACE_LACKS_READDIR_R + +/* Define to 1 if platform lacks readlink(). */ +#undef ACE_LACKS_READLINK + +/* Define to 1 if platform lacks readv(). */ +#undef ACE_LACKS_READV + +/* Define to 1 if platform lacks realpath(). */ +#undef ACE_LACKS_REALPATH + +/* Define to 1 if platform lacks recvmsg(). */ +#undef ACE_LACKS_RECVMSG + +/* Define to 1 if platform lacks rename(). */ +#undef ACE_LACKS_RENAME + +/* Platform/compiler lacks {get,set}rlimit() function (e.g., VxWorks, Chorus, + and SCO UNIX) */ +#undef ACE_LACKS_RLIMIT + +/* Define to 1 if platform lacks the declaration of {get,set}rlimit(). */ +#undef ACE_LACKS_RLIMIT_PROTOTYPE + +/* Define to 1 if system lacks pthread_rwlockattr_setpshared(). */ +#undef ACE_LACKS_RWLOCKATTR_PSHARED + +/* Define to 1 if the system lacks the type `rwlock_t'. */ +#undef ACE_LACKS_RWLOCK_T + +/* Define to 1 if platform lacks sbrk(). */ +#undef ACE_LACKS_SBRK + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SCHED_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SEARCH_H + +/* Define to 1 if platform lacks seekdir(). */ +#undef ACE_LACKS_SEEKDIR + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SEMAPHORE_H + +/* Define to 1 if the system lacks the type `struct sembuf'. */ +#undef ACE_LACKS_SEMBUF_T + +/* Define to 1 if platform lacks sendmsg(). */ +#undef ACE_LACKS_SENDMSG + +/* Platform lacks pthread_attr_setdetachstate() (e.g., HP/UX 10.x) */ +#undef ACE_LACKS_SETDETACH + +/* Define to 1 if platform lacks setegid(). */ +#undef ACE_LACKS_SETEGID + +/* Define to 1 if platform lacks setenv(). */ +#undef ACE_LACKS_SETENV + +/* Define to 1 if platform lacks seteuid(). */ +#undef ACE_LACKS_SETEUID + +/* Define to 1 if platform lacks setgid(). */ +#undef ACE_LACKS_SETGID + +/* Define to 1 if platform lacks setpgid(). */ +#undef ACE_LACKS_SETPGID + +/* Define to 1 if platform lacks setpgid() declaration in . */ +#undef ACE_LACKS_SETPGID_PROTOTYPE + +/* Define to 1 if platform lacks setregid(). */ +#undef ACE_LACKS_SETREGID + +/* Define to 1 if platform lacks setregid() declaration in . */ +#undef ACE_LACKS_SETREGID_PROTOTYPE + +/* Define to 1 if platform lacks setreuid(). */ +#undef ACE_LACKS_SETREUID + +/* Define to 1 if platform lacks setreuid() declaration in . */ +#undef ACE_LACKS_SETREUID_PROTOTYPE + +/* Platform lacks pthread_attr_setsched() (e.g. MVS) */ +#undef ACE_LACKS_SETSCHED + +/* Define to 1 if platform lacks setsid(). */ +#undef ACE_LACKS_SETSID + +/* Define to 1 if platform lacks setuid(). */ +#undef ACE_LACKS_SETUID + +/* Define to 1 if platform lacks sigaction(). */ +#undef ACE_LACKS_SIGACTION + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SIGINFO_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SIGNAL_H + +/* Platform lacks "signed char" type (broken!) */ +#undef ACE_LACKS_SIGNED_CHAR + +/* Define to 1 if the system lacks the type `sigset_t'. */ +#undef ACE_LACKS_SIGSET + +/* Define to 1 if `si_addr' is not a member of `siginfo_t'. */ +#undef ACE_LACKS_SI_ADDR + +/* Define to 1 if platform lacks socketpair(). */ +#undef ACE_LACKS_SOCKETPAIR + +/* Platform doesn't support SO_SNDBUF/SO_RCVBUF (used in TAO) */ +#undef ACE_LACKS_SOCKET_BUFSIZ + +/* Compiler doesn't support static data member templates */ +#undef ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_STDINT_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_STDLIB_H + +/* Define to 1 if platform lacks strcasecmp(). */ +#undef ACE_LACKS_STRCASECMP + +/* Define to 1 if platform lacks a declaration for strcasecmp() */ +#undef ACE_LACKS_STRCASECMP_PROTOTYPE + +/* Define to 1 if platform lacks strchr(). */ +#undef ACE_LACKS_STRCHR + +/* Define to 1 if platform lacks strdup(). */ +#undef ACE_LACKS_STRDUP + +/* Define to 1 if platform lacks strerror(). */ +#undef ACE_LACKS_STRERROR + +/* Define to 1 if platform lacks strftime(). */ +#undef ACE_LACKS_STRFTIME + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_STRINGS_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_STRING_H + +/* Define to 1 if platform lacks strncasecmp(). */ +#undef ACE_LACKS_STRNCASECMP + +/* Define to 1 if platform lacks a declaration for strncasecmp() */ +#undef ACE_LACKS_STRNCASECMP_PROTOTYPE + +/* Define to 1 if platform lacks the declaration of strnlen(). */ +#undef ACE_LACKS_STRNLEN_PROTOTYPE + +/* Platform lacks stropts.h */ +#undef ACE_LACKS_STROPTS_H + +/* Define to 1 if platform lacks strpbrk(). */ +#undef ACE_LACKS_STRPBRK + +/* Define to 1 if platform lacks strptime(). */ +#undef ACE_LACKS_STRPTIME + +/* Define to 1 if platform lacks the declaration of strptime(). */ +#undef ACE_LACKS_STRPTIME_PROTOTYPE + +/* Define to 1 if platform lacks strrchr(). */ +#undef ACE_LACKS_STRRCHR + +/* Define to 1 if the system lacks the type `struct strrecvfd'. */ +#undef ACE_LACKS_STRRECVFD + +/* Define to 1 if platform lacks strspn(). */ +#undef ACE_LACKS_STRSPN + +/* Define to 1 if platform lacks strtod(). */ +#undef ACE_LACKS_STRTOD + +/* Platform/compiler lacks the strtok_r() prototype */ +#undef ACE_LACKS_STRTOK_R_PROTOTYPE + +/* Define to 1 if platform lacks strtol(). */ +#undef ACE_LACKS_STRTOL + +/* Define to 1 if platform lacks strtoll(). */ +#undef ACE_LACKS_STRTOLL + +/* Define to 1 if platform lacks a declaration for strtoll() */ +#undef ACE_LACKS_STRTOLL_PROTOTYPE + +/* Define to 1 if platform lacks strtoul(). */ +#undef ACE_LACKS_STRTOUL + +/* Define to 1 if platform lacks strtoull(). */ +#undef ACE_LACKS_STRTOULL + +/* Define to 1 if platform lacks a declaration for strtoull() */ +#undef ACE_LACKS_STRTOULL_PROTOTYPE + +/* Define to 1 if the system lacks the type `struct dirent'. */ +#undef ACE_LACKS_STRUCT_DIR + +/* Define to 1 if the system lacks the type 'suseconds_t'. */ +#undef ACE_LACKS_SUSECONDS_T + +/* Define to 1 if platform lacks swab(). */ +#undef ACE_LACKS_SWAB + +/* Define to 1 if platform lacks syscall(). */ +#undef ACE_LACKS_SYSCALL + +/* Define to 1 if platform lacks sysconf(). */ +#undef ACE_LACKS_SYSCONF + +/* Define to 1 if platform lacks system(). */ +#undef ACE_LACKS_SYSTEM + +/* Platform lacks SYSV message queue prototypes */ +#undef ACE_LACKS_SYSV_MSQ_PROTOS + +/* Platform lacks System V shared memory (e.g., Win32 and VxWorks) */ +#undef ACE_LACKS_SYSV_SHMEM + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_IOCTL_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_IPC_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_MMAN_H + +/* Platform lacks sys/msg.h (e.g., Chorus and VxWorks) */ +#undef ACE_LACKS_SYS_MSG_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_PARAM_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_RESOURCE_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_SELECT_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_SEM_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_SHM_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_SOCKET_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_STAT_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_SYSCTL_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_TIME_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_TYPES_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_UIO_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_UN_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_SYS_WAIT_H + +/* OS does not support TCP_NODELAY */ +#undef ACE_LACKS_TCP_NODELAY + +/* Define to 1 if platform lacks telldir(). */ +#undef ACE_LACKS_TELLDIR + +/* Define to 1 if platform lacks tempnam(). */ +#undef ACE_LACKS_TEMPNAM + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_TERMIOS_H + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_TERMIO_H + +/* Platform lacks pthread_attr_setscope() */ +#undef ACE_LACKS_THREAD_PROCESS_SCOPING + +/* Define to 1 if platform lacks the declarations of recv_timedwait, + send_timedwait, etc. */ +#undef ACE_LACKS_TIMEDWAIT_PROTOTYPES + +/* Platform does not define timepec_t as a typedef for struct timespec. */ +#undef ACE_LACKS_TIMESPEC_T + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_TIME_H + +/* Define to 1 if platform lacks towlower(). */ +#undef ACE_LACKS_TOWLOWER + +/* Define to 1 if platform lacks towupper(). */ +#undef ACE_LACKS_TOWUPPER + +/* Define to 1 if platform lacks truncate(). */ +#undef ACE_LACKS_TRUNCATE + +/* Header files lack t_errno for TLI */ +#undef ACE_LACKS_T_ERRNO + +/* Define to 1 if platform lacks the declaration of ualarm(). */ +#undef ACE_LACKS_UALARM_PROTOTYPE + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_UCONTEXT_H + +/* Define to 1 if the system lacks the type `uintmax_t'. */ +#undef ACE_LACKS_UINTMAX_T + +/* Define to 1 if the system lacks the type `uintptr_t'. */ +#undef ACE_LACKS_UINTPTR_T + +/* Define to 1 if platform lacks umask(). */ +#undef ACE_LACKS_UMASK + +/* Define to 1 if platform lacks uname(). */ +#undef ACE_LACKS_UNAME + +/* */ +#undef ACE_LACKS_UNBUFFERED_STREAMBUF + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_UNISTD_H + +/* ACE platform has no UNIX domain sockets */ +#undef ACE_LACKS_UNIX_DOMAIN_SOCKETS + +/* Platform lacks full signal support (e.g., Win32 and Chorus). */ +#undef ACE_LACKS_UNIX_SIGNALS + +/* Define to 1 if platform lacks unlink(). */ +#undef ACE_LACKS_UNLINK + +/* Define to 1 if platform lacks unsetenv(). */ +#undef ACE_LACKS_UNSETENV + +/* Define to 1 if the system lacks the type 'useconds_t'. */ +#undef ACE_LACKS_USECONDS_T + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_UTIME_H + +/* Define to 1 if the system lacks the type `struct utsname'. */ +#undef ACE_LACKS_UTSNAME_T + +/* Define to 1 if the system lacks the type `u_long_long_t'. */ +#undef ACE_LACKS_U_LONGLONG_T + +/* Define to 1 if platform lacks vsnprintf(). */ +#undef ACE_LACKS_VSNPRINTF + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_WCHAR_H + +/* Define to 1 if the system lacks the type `wchar_t'. */ +#undef ACE_LACKS_WCHAR_T + +/* Define to 1 if platform lacks wcscasecmp(). */ +#undef ACE_LACKS_WCSCASECMP + +/* Define to 1 if platform lacks wcscat(). */ +#undef ACE_LACKS_WCSCAT + +/* Define to 1 if platform lacks wcschr(). */ +#undef ACE_LACKS_WCSCHR + +/* Define to 1 if platform lacks wcscmp(). */ +#undef ACE_LACKS_WCSCMP + +/* Define to 1 if platform lacks wcscpy(). */ +#undef ACE_LACKS_WCSCPY + +/* Define to 1 if platform lacks wcscspn(). */ +#undef ACE_LACKS_WCSCSPN + +/* Define to 1 if platform lacks wcsdup(). */ +#undef ACE_LACKS_WCSDUP + +/* Define to 1 if platform lacks wcslen(). */ +#undef ACE_LACKS_WCSLEN + +/* Define to 1 if platform lacks wcsncasecmp(). */ +#undef ACE_LACKS_WCSNCASECMP + +/* Define to 1 if platform lacks wcsncat(). */ +#undef ACE_LACKS_WCSNCAT + +/* Define to 1 if platform lacks wcsncmp(). */ +#undef ACE_LACKS_WCSNCMP + +/* Define to 1 if platform lacks wcsncpy(). */ +#undef ACE_LACKS_WCSNCPY + +/* Define to 1 if platform lacks wcsnicmp(). */ +#undef ACE_LACKS_WCSNICMP + +/* Define to 1 if platform lacks wcspbrk(). */ +#undef ACE_LACKS_WCSPBRK + +/* Define to 1 if platform lacks wcsrchr(). */ +#undef ACE_LACKS_WCSRCHR + +/* Define to 1 if platform lacks wcsspn(). */ +#undef ACE_LACKS_WCSSPN + +/* Define to 1 if platform lacks wcsstr(). */ +#undef ACE_LACKS_WCSSTR + +/* Define to 1 if platform lacks wcstod(). */ +#undef ACE_LACKS_WCSTOD + +/* Define to 1 if platform lacks wcstok(). */ +#undef ACE_LACKS_WCSTOK + +/* Define to 1 if platform lacks wcstol(). */ +#undef ACE_LACKS_WCSTOL + +/* Define to 1 if platform lacks wcstoll(). */ +#undef ACE_LACKS_WCSTOLL + +/* Define to 1 if platform lacks a declaration for wcstoll() */ +#undef ACE_LACKS_WCSTOLL_PROTOTYPE + +/* Define to 1 if platform lacks wcstoul(). */ +#undef ACE_LACKS_WCSTOUL + +/* Define to 1 if platform lacks wcstoull(). */ +#undef ACE_LACKS_WCSTOULL + +/* Define to 1 if platform lacks a declaration for wcstoull() */ +#undef ACE_LACKS_WCSTOULL_PROTOTYPE + +/* Define to 1 if platform lacks the header file. */ +#undef ACE_LACKS_WCTYPE_H + +/* Define to 1 if platform lacks writev(). */ +#undef ACE_LACKS_WRITEV + +/* Define to environment variable used for DLL search path */ +#undef ACE_LD_SEARCH_PATH + +/* typedef for ACE_LOFF_T */ +#undef ACE_LOFF_T_TYPEDEF + +/* Renames "main (int, char *[])", for platforms such as g++/VxWorks that + don't allow main. Requires the use of ACE_HAS_NONSTATIC_OBJECT_MANAGER. */ +#undef ACE_MAIN + +/* */ +#undef ACE_MALLOC_ALIGN + +/* */ +#undef ACE_MAP_PRIVATE + +/* Define to 1 if platform has 1 parameter mkdir() */ +#undef ACE_MKDIR_LACKS_MODE + +/* Compile using multi-thread libraries */ +#undef ACE_MT_SAFE + +/* Turns off debugging features */ +#undef ACE_NDEBUG + +/* Necessary with some compilers to pass ACE_TTY_IO as parameter to + DEV_Connector. */ +#undef ACE_NEEDS_DEV_IO_CONVERSION + +/* Compiler requires a definition for a "hidden" function, e.g., a private, + unimplemented copy constructor or assignment operator. The SGI C++ compiler + needs this, in template classes, with + ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA. */ +#undef ACE_NEEDS_FUNC_DEFINITIONS + +/* Required by platforms with small default stacks. */ +#undef ACE_NEEDS_HUGE_THREAD_STACKSIZE + +/* OS has LWPs, and when the priority of a bound thread is set, then the LWP + priority must be set also. */ +#undef ACE_NEEDS_LWP_PRIO_SET + +/* Platform needs to #include to get thread scheduling defs. */ +#undef ACE_NEEDS_SCHED_H + +/* Compiler's 'new' throws exception on failure (ANSI C++ behavior). */ +#undef ACE_NEW_THROWS_EXCEPTIONS + +/* Turns off the LM_DEBUG and LM_ERROR logging macros... */ +#undef ACE_NLOGGING + +/* Explicitly disable ACE inlining */ +#undef ACE_NO_INLINE + +/* Turns off the tracing feature. */ +#undef ACE_NTRACE + +/* Defines the page size of the system (not used on Win32 or with + ACE_HAS_GETPAGESIZE). */ +#undef ACE_PAGE_SIZE + +/* Flag that denotes the symbol should be exported from the DSO/DLL. */ +#undef ACE_Proper_Export_Flag + +/* Flag that denotes the symbol should be imported from the DSO/DLL. */ +#undef ACE_Proper_Import_Flag + +/* Platform redefines the t_... names (UnixWare) */ +#undef ACE_REDEFINES_XTI_FUNCTIONS + +/* shm_open() requires a leading slash in name */ +#undef ACE_SHM_OPEN_REQUIRES_ONE_SLASH + +/* Size of the native "double" type */ +#undef ACE_SIZEOF_DOUBLE + +/* Size of the native "float" type */ +#undef ACE_SIZEOF_FLOAT + +/* Size of the native "int" type */ +#undef ACE_SIZEOF_INT + +/* Size of the native "long" type */ +#undef ACE_SIZEOF_LONG + +/* Size of the native "long double" type */ +#undef ACE_SIZEOF_LONG_DOUBLE + +/* Size of the native "long long" type */ +#undef ACE_SIZEOF_LONG_LONG + +/* Size of the native "short" type */ +#undef ACE_SIZEOF_SHORT + +/* Size of the native "pointer to void" type */ +#undef ACE_SIZEOF_VOID_P + +/* Size of the native "wchar_t" type */ +#undef ACE_SIZEOF_WCHAR + +/* Define to the *printf format specifier (e.g. "%u") for size_t */ +#undef ACE_SIZE_T_FORMAT_SPECIFIER + +/* Define to the *printf format specifier (e.g. "%d") for ssize_t */ +#undef ACE_SSIZE_T_FORMAT_SPECIFIER + +/* Define to function that is equivalent to strcasecmp() */ +#undef ACE_STRCASECMP_EQUIVALENT + +/* Define to function that is equivalent to strdup() */ +#undef ACE_STRDUP_EQUIVALENT + +/* Define to function that is equivalent to strncasecmp() */ +#undef ACE_STRNCASECMP_EQUIVALENT + +/* Define to function that is equivalent to strtoll() */ +#undef ACE_STRTOLL_EQUIVALENT + +/* Define to function that is equivalent to strtoull() */ +#undef ACE_STRTOULL_EQUIVALENT + +/* Compiler's template mechanism must use a pragma. This is used for AIX's C++ + compiler. */ +#undef ACE_TEMPLATES_REQUIRE_PRAGMA + +/* Compiler's template mechanim must see source code (i.e., .cpp files). This + is used for GNU G++. */ +#undef ACE_TEMPLATES_REQUIRE_SOURCE + +/* Specify this if you don't want threads to inherit parent thread's + ACE_Log_Msg properties. */ +#undef ACE_THREADS_DONT_INHERIT_LOG_MSG + +/* */ +#undef ACE_THR_PRI_FIFO_DEF + +/* */ +#undef ACE_TIMER_SKEW + +/* Device the platform uses for TCP on TLI. Only needed if not /dev/tcp. */ +#undef ACE_TLI_TCP_DEVICE + +/* Define to the *printf format specifier (e.g. "%llu") for ACE_UINT64 */ +#undef ACE_UINT64_FORMAT_SPECIFIER + +/* Define to unsigned 64 bit integer type */ +#undef ACE_UINT64_TYPE + +/* Platform uses assembly symbols instead of C symbols in dlsym() */ +#undef ACE_USES_ASM_SYMBOL_IN_DLSYM + +/* Enable IPv6 support on platforms that don't have IPv6 turned on by default + */ +#undef ACE_USES_IPV4_IPV6_MIGRATION + +/* Some files, such as ace/streams.h, want to include new style C++ stream + headers. These headers are iomanip, ios, iostream, istream, ostream, + fstream and streambuf. If _all_ of these headers aren't available, then + assume that only iostream.h and fstream.h are available. */ +#undef ACE_USES_OLD_IOSTREAMS + +/* When linking MFC as a static library is desired */ +#undef ACE_USES_STATIC_MFC + +/* Platform has its standard C++ library in the namespace std. */ +#undef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB + +/* ACE is built to use wide characters internally */ +#undef ACE_USES_WCHAR + +/* The OS/platform supports the poll() event demultiplexor */ +#undef ACE_USE_POLL + +/* Define to 1 to embed RCS ID strings into compiled object files. */ +#undef ACE_USE_RCSID + +/* For Win32: Use Select_Reactor as default implementation of Reactor instead + of WFMO_Reactor. */ +#undef ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL + +/* Define to function that is equivalent to wcscasecmp() */ +#undef ACE_WCSCASECMP_EQUIVALENT + +/* Define to function that is equivalent to wcsdup() */ +#undef ACE_WCSDUP_EQUIVALENT + +/* Define to function that is equivalent to wcsncasecmp() */ +#undef ACE_WCSNCASECMP_EQUIVALENT + +/* Define to function that is equivalent to wcstoll() */ +#undef ACE_WCSTOLL_EQUIVALENT + +/* Define to function that is equivalent to wcstoull() */ +#undef ACE_WCSTOULL_EQUIVALENT + +/* Configure for use on Win32 */ +#undef ACE_WIN32 + +/* A parameter list indicating the version of WinSock (e.g., "1, 1" is version + 1.1). */ +#undef ACE_WSOCK_VERSION + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Configure for use on AIX */ +#undef AIX + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +#undef CLOSEDIR_VOID + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* GNU Win32 environement */ +#undef CYGWIN32 + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* */ +#undef DEC_CXX + +/* Configure for use on Digital Unix */ +#undef DIGITAL_UNIX + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FSTREAM + +/* Define to 1 if you have the header file. */ +#undef HAVE_FSTREAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IOMANIP + +/* Define to 1 if you have the header file. */ +#undef HAVE_IOS + +/* Define to 1 if you have the header file. */ +#undef HAVE_IOSTREAM + +/* Define to 1 if you have the header file. */ +#undef HAVE_IOSTREAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ISTREAM + +/* Define to 1 if you have the `dld' library (-ldld). */ +#undef HAVE_LIBDLD + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OSTREAM + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STREAMBUF + +/* Define to 1 if you have the `strftime' function. */ +#undef HAVE_STRFTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Configure for use on HP-UX */ +#undef HPUX + +/* Configure for use on HP-UX 10 */ +#undef HPUX_10 + +/* Configure for use on HP-UX 11 */ +#undef HPUX_11 + +/* */ +#undef IP_ADD_MEMBERSHIP + +/* */ +#undef IP_DROP_MEMBERSHIP + +/* Configure for use on Irix 5 */ +#undef IRIX5 + +/* Configure for use on Irix 6 */ +#undef IRIX6 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Maximum thread priority */ +#undef PTHREAD_MAX_PRIORITY + +/* Minimum thread priority */ +#undef PTHREAD_MIN_PRIORITY + +/* */ +#undef PTHREAD_STACK_MIN + +/* */ +#undef SCO + +/* The size of `double', as computed by sizeof. */ +#undef SIZEOF_DOUBLE + +/* The size of `float', as computed by sizeof. */ +#undef SIZEOF_FLOAT + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `signed char', as computed by sizeof. */ +#undef SIZEOF_SIGNED_CHAR + +/* The size of `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + +/* The size of `wchar_t', as computed by sizeof. */ +#undef SIZEOF_WCHAR_T + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Configure for use on UnixWare */ +#undef UNIXWARE + +/* */ +#undef UNIXWARE_2_0 + +/* */ +#undef UNIXWARE_2_1 + +/* */ +#undef UNIXWARE_7_1 + +/* Configure for use on VxWorks */ +#undef VXWORKS + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Enable ACE inlining */ +#undef __ACE_INLINE__ + +/* */ +#undef __IOCTL_VERSIONED__ + +/* */ +#undef __NO_INCLUDE_WARN__ + + + + +#endif /* ACE_CONFIG_H */ + + +// Local Variables: +// mode:C++ +// End: + + diff --git a/externals/ace/gethrtime.cpp b/externals/ace/gethrtime.cpp new file mode 100644 index 0000000..69de031 --- /dev/null +++ b/externals/ace/gethrtime.cpp @@ -0,0 +1,60 @@ +// $Id: gethrtime.cpp 80826 2008-03-04 14:51:23Z wotte $ +// +// Build this file with g++. It can be linked in to a ACE application +// that was compiled with GreenHills. It wouldn't be necessary if I +// knew a way to correctly move values from registers to a 64-bit +// variable in GHS asm code. That's easy with g++ asm. + +#include "ace/config-all.h" + +ACE_RCSID(ace, gethrtime, "$Id: gethrtime.cpp 80826 2008-03-04 14:51:23Z wotte $") + +#if defined (ghs) && (defined (i386) || defined(__i386__)) + +#include "ace/OS_NS_time.h" + +extern "C" +ACE_hrtime_t +ACE_GETHRTIME_NAME (void) +{ +#if defined (ACE_HAS_PENTIUM) + // ACE_TRACE ("ACE_GETHRTIME_NAME"); + +#if defined (ACE_LACKS_LONGLONG_T) + double now; +#else /* ! ACE_LACKS_LONGLONG_T */ + ACE_hrtime_t now; +#endif /* ! ACE_LACKS_LONGLONG_T */ + + // Read the high-res tick counter directly into memory variable + // "now". The A constraint signifies a 64-bit int. +#if defined (__GNUG__) + asm volatile ("rdtsc" : "=A" (now) : : "memory"); +// #elif defined (ghs) +// The following doesn't work. For now, this file must be compile with g++. +// asm ("rdtsc"); +// asm ("movl %edx,-16(%ebp)"); +// asm ("movl %eax,-12(%ebp)"); +#else +# error unsupported compiler +#endif + +#if defined (ACE_LACKS_LONGLONG_T) + // ACE_U_LongLong doesn't have the same layout as now, so construct + // it "properly". + ACE_UINT32 least, most; + ACE_OS::memcpy (&least, &now, sizeof (ACE_UINT32)); + ACE_OS::memcpy (&most, (unsigned char *) &now + sizeof (ACE_UINT32), + sizeof (ACE_UINT32)); + + const ACE_hrtime_t ret (least, most); + return ret; +#else /* ! ACE_LACKS_LONGLONG_T */ + return now; +#endif /* ! ACE_LACKS_LONGLONG_T */ + +#else /* ! ACE_HAS_PENTIUM */ +# error This file can _only_ be compiled with ACE_HAS_PENTIUM. +#endif /* ! ACE_HAS_PENTIUM */ +} +#endif /* ghs */ diff --git a/externals/ace/iosfwd.h b/externals/ace/iosfwd.h new file mode 100644 index 0000000..b9576eb --- /dev/null +++ b/externals/ace/iosfwd.h @@ -0,0 +1,100 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file iosfwd.h + * + * $Id: iosfwd.h 89098 2010-02-21 21:51:41Z schmidt $ + * + * @author Irfan Pyarali + * + * This file contains the portability ugliness for the Standard C++ + * Library. As implementations of the "standard" emerge, this file + * will need to be updated. + * + * This files deals with forward declaration for the stream + * classes. Remember that since the new Standard C++ Library code + * for streams uses templates, simple forward declaration will not + * work. + */ +//============================================================================= + + +#ifndef ACE_IOSFWD_H +#define ACE_IOSFWD_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) + +#if defined (__APPLE_CC__) +// Should this really be here? dhinton +// FUZZ: disable check_for_streams_include +# include "ace/streams.h" +#endif + +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ + (ACE_HAS_STANDARD_CPP_LIBRARY != 0) + +# if !defined (ACE_USES_OLD_IOSTREAMS) +# include /**/ +#define ACE_HAS_CPP98_IOSTREAMS 1 +# else + // @note If these forward declarations don't work (e.g. aren't + // portable), we may have to include "ace/streams.h" as a last + // resort. Doing so would defeat the purpose of this header, + // unfortunately. + class ios; + class streambuf; + class istream; + class ostream; + class iostream; + class filebuf; + class ifstream; + class ofstream; + class fstream; +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ + (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) + +# if !defined (ACE_USES_OLD_IOSTREAMS) + // Make these available in the global name space + using std::ios; + using std::streambuf; + using std::istream; + using std::ostream; + using std::iostream; + using std::filebuf; + using std::ifstream; + using std::ofstream; + using std::fstream; +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + +#else /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ + + class ios; + class streambuf; + class istream; + class ostream; + class iostream; + class filebuf; + class ifstream; + class ofstream; + class fstream; + +# endif /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ + +#include /**/ "ace/post.h" + +#endif /* ACE_LACKS_IOSTREAM_TOTALLY */ + +#endif /* ACE_IOSFWD_H */ diff --git a/externals/ace/os_include/arpa/os_inet.h b/externals/ace/os_include/arpa/os_inet.h new file mode 100644 index 0000000..b97f7c6 --- /dev/null +++ b/externals/ace/os_include/arpa/os_inet.h @@ -0,0 +1,74 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_inet.h + * + * definitions for internet operations + * + * $Id: os_inet.h 85015 2009-04-03 12:27:59Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_ARPA_OS_INET_H +#define ACE_OS_INCLUDE_ARPA_OS_INET_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/netinet/os_in.h" + +#if !defined (ACE_LACKS_ARPA_INET_H) + extern "C" { +# include /**/ + } +#endif /* !ACE_LACKS_ARPA_INET_H */ + +#if defined (ACE_USES_INETLIB_H) +# include /**/ +#endif /* ACE_USES_INETLIB_H */ + +/** + * In some environments it is useful to swap the bytes on write, for + * instance: a fast server can be feeding a lot of slow clients that + * happen to have the wrong byte order. + * Because this is a rarely used feature we disable it by default to + * minimize footprint. + * This macro enables the functionality, but we still need a way to + * activate it on a per-connection basis. + */ +// #define ACE_ENABLE_SWAP_ON_WRITE + +/** + * In some environements we never need to swap bytes when reading, for + * instance embebbed systems (such as avionics) or homogenous + * networks. + * Setting this macro disables the capabilities to demarshall streams + * in the wrong byte order. + */ +// #define ACE_DISABLE_SWAP_ON_READ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_INET_ATON_PROTOTYPE) + int inet_aton (const char *, struct in_addr *); +#endif /* ACE_LACKS_INET_ATON_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_ARPA_OS_INET_H */ diff --git a/externals/ace/os_include/net/os_if.h b/externals/ace/os_include/net/os_if.h new file mode 100644 index 0000000..3dcf591 --- /dev/null +++ b/externals/ace/os_include/net/os_if.h @@ -0,0 +1,112 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_if.h + * + * sockets local interfaces + * + * $Id: os_if.h 88719 2010-01-26 12:55:03Z sowayaa $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_NET_OS_IF_H +#define ACE_OS_INCLUDE_NET_OS_IF_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_NET_IF_H) +# include /**/ +# if defined (ACE_HAS_NET_IF_DL_H) +# include /**/ +# endif /* ACE_HAS_NET_IF_DL_H */ +# if defined (HPUX) && defined (IOR) + /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h + and we don't want that definition. See IOP_IORC.h. + Thanks to Torsten Kopper for this patch.*/ +# undef IOR +# endif /* HPUX && IOR */ +#endif /* !ACE_LACKS_NET_IF_H */ + +#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) +# include /**/ +#endif /* ACE_HAS_WINSOCK2 */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_HAS_BROKEN_IF_HEADER) + struct ifafilt; +#endif /* ACE_HAS_BROKEN_IF_HEADER */ + +#if defined (ACE_LACKS_IFREQ) +struct ifreq { +#define IFNAMSIZ 16 + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags; + int ifru_metric; + int ifru_mtu; + int ifru_phys; + int ifru_media; + caddr_t ifru_data; + int (*ifru_tap)(struct ifnet *, struct ether_header *, struct mbuf *); + } ifr_ifru; +#define ifr_addr ifr_ifru.ifru_addr /* address */ +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_flags ifr_ifru.ifru_flags /* flags */ +#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ +#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ +#define ifr_media ifr_ifru.ifru_media /* physical media */ +#define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_tap ifr_ifru.ifru_tap /* tap function */ +}; +#endif /* ACE_LACKS_IFREQ */ + +#if defined (ACE_LACKS_IFCONF) +struct ifconf { + int ifc_len; + union { + caddr_t ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ +#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ + }; +#endif /* ACE_LACKS_IFCONF */ + +#if !defined (IFF_UP) +# define IFF_UP 0x1 +#endif /* IFF_UP */ + +#if !defined (IFF_LOOPBACK) +# define IFF_LOOPBACK 0x8 +#endif /* IFF_LOOPBACK */ + +#if !defined (IFF_BROADCAST) +# define IFF_BROADCAST 0x2 +#endif /* IFF_BROADCAST */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_NET_OS_IF_H */ diff --git a/externals/ace/os_include/netinet/os_in.h b/externals/ace/os_include/netinet/os_in.h new file mode 100644 index 0000000..dff894a --- /dev/null +++ b/externals/ace/os_include/netinet/os_in.h @@ -0,0 +1,179 @@ + +// -*- C++ -*- + +//============================================================================= +/** + * @file os_in.h + * + * Internet address family + * + * $Id: os_in.h 85438 2009-05-26 06:56:46Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_NETINET_OS_IN_H +#define ACE_OS_INCLUDE_NETINET_OS_IN_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_inttypes.h" +#include "ace/os_include/sys/os_socket.h" + +#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) +# include /**/ +#endif /* ACE_HAS_WINSOCK2 */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if !defined (ACE_LACKS_NETINET_IN_H) +# include /**/ +#endif /* !ACE_LACKS_NETINET_IN_H */ + + +# if defined (ACE_HAS_PHARLAP_RT) +# define ACE_IPPROTO_TCP SOL_SOCKET +# else +# define ACE_IPPROTO_TCP IPPROTO_TCP +# endif /* ACE_HAS_PHARLAP_RT */ + +# if !defined (ACE_HAS_IP_MULTICAST) && defined (ACE_LACKS_IP_ADD_MEMBERSHIP) + // Even if ACE_HAS_IP_MULTICAST is not defined, if IP_ADD_MEMBERSHIP + // is defined, assume that the ip_mreq struct is also defined + // (presumably in netinet/in.h). + struct ip_mreq + { + /// IP multicast address of group + struct in_addr imr_multiaddr; + /// Local IP address of interface + struct in_addr imr_interface; + }; +# endif /* ! ACE_HAS_IP_MULTICAST && ACE_LACKS_IP_ADD_MEMBERSHIP */ + +# if defined (ACE_LACKS_IN_ADDR) + struct in_addr + { + u_long s_addr; + }; +# endif /* ACE_LACKS_IN_ADDR */ + +# if defined (ACE_LACKS_SOCKADDR_IN) + struct sockaddr_in + { + short sin_family; // e.g. AF_INET + unsigned short sin_port; // e.g. htons(3490) + struct in_addr sin_addr; // see struct in_addr, below + char sin_zero[8]; // zero this if you want to + }; +# endif /* ACE_LACKS_SOCKADDR_IN */ + +# if defined (ACE_LACKS_SOCKADDR_UN) + struct sockaddr_un { + u_char sun_len; /* sockaddr len including null */ + u_char sun_family; /* AF_UNIX */ + char sun_path[104]; /* path name (gag) */ + }; +#endif /* ACE_LACKS_SOCKADDR_UN */ + +# if defined (ACE_LACKS_IP_MREQ) + struct ip_mreq + { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ + }; +# endif /* ACE_LACKS_IP_MREQ */ + +#if !defined (IPPORT_RESERVED) +# define IPPORT_RESERVED 1024 +#endif /* !IPPORT_RESERVED */ + +#if !defined (IPPORT_USERRESERVED) +# define IPPORT_USERRESERVED 5000 +#endif /* !IPPORT_USERRESERVED */ + +// Define INET loopback address constant if it hasn't been defined +// Dotted Decimal 127.0.0.1 == Hexidecimal 0x7f000001 +#if !defined (INADDR_LOOPBACK) +# define INADDR_LOOPBACK ((ACE_UINT32) 0x7f000001) +#endif /* INADDR_LOOPBACK */ + +// The INADDR_NONE address is generally 255.255.255.255. +#if !defined (INADDR_NONE) +# define INADDR_NONE ((ACE_UINT32) 0xffffffff) +#endif /* INADDR_NONE */ + +// Define INET string length constants if they haven't been defined +// +// for IPv4 dotted-decimal +#if !defined (INET_ADDRSTRLEN) +# define INET_ADDRSTRLEN 16 +#endif /* INET_ADDRSTRLEN */ +// +// for IPv6 hex string +#if !defined (INET6_ADDRSTRLEN) +# define INET6_ADDRSTRLEN 46 +#endif /* INET6_ADDRSTRLEN */ + +# if !defined (IP_DROP_MEMBERSHIP) +# define IP_DROP_MEMBERSHIP 0 +# endif /* IP_DROP_MEMBERSHIP */ + +# if !defined (IP_ADD_MEMBERSHIP) +# define IP_ADD_MEMBERSHIP 0 +# define ACE_LACKS_IP_ADD_MEMBERSHIP +# endif /* IP_ADD_MEMBERSHIP */ + +# if !defined (IP_DEFAULT_MULTICAST_TTL) +# define IP_DEFAULT_MULTICAST_TTL 0 +# endif /* IP_DEFAULT_MULTICAST_TTL */ + +# if !defined (IP_DEFAULT_MULTICAST_LOOP) +# define IP_DEFAULT_MULTICAST_LOOP 0 +# endif /* IP_DEFAULT_MULTICAST_LOOP */ + +# if !defined (IP_MULTICAST_IF) +# define IP_MULTICAST_IF 0 +# endif /* IP_MULTICAST_IF */ + +# if !defined (IP_MULTICAST_TTL) +# define IP_MULTICAST_TTL 1 +# endif /* IP_MULTICAST_TTL */ + +# if !defined (IP_MULTICAST_LOOP) +# define IP_MULTICAST_LOOP 2 +# endif /* IP_MULTICAST_LOOP */ + +# if !defined (IP_MAX_MEMBERSHIPS) +# define IP_MAX_MEMBERSHIPS 0 +# endif /* IP_MAX_MEMBERSHIP */ + +# if !defined (IPPROTO_IP) +# define IPPROTO_IP 0 +# endif /* IPPROTO_IP */ + +# if !defined (IPPROTO_TCP) +# define IPPROTO_TCP 6 +# endif /* IPPROTO_TCP */ + +# if !defined (INADDR_ANY) +# define INADDR_ANY (u_long)0x00000000 +# endif /* INADDR_ANY */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_NETINET_OS_IN_H */ diff --git a/externals/ace/os_include/netinet/os_tcp.h b/externals/ace/os_include/netinet/os_tcp.h new file mode 100644 index 0000000..aca6590 --- /dev/null +++ b/externals/ace/os_include/netinet/os_tcp.h @@ -0,0 +1,46 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_tcp.h + * + * definitions for the Internet Transmission Control Protocol (TCP) + * + * $Id: os_tcp.h 88499 2010-01-12 19:34:34Z olli $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_NETINET_OS_TCP_H +#define ACE_OS_INCLUDE_NETINET_OS_TCP_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_NETINET_TCP_H) +# include /**/ +#endif /* !ACE_LACKS_NETINET_TCP_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +# if !defined (TCP_NODELAY) +# define TCP_NODELAY 0x01 +# endif /* TCP_NODELAY */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_NETINET_OS_TCP_H */ diff --git a/externals/ace/os_include/os_aio.h b/externals/ace/os_include/os_aio.h new file mode 100644 index 0000000..4ec9fe9 --- /dev/null +++ b/externals/ace/os_include/os_aio.h @@ -0,0 +1,47 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_aio.h + * + * asynchronous input and output (REALTIME) + * + * $Id: os_aio.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_AIO_H +#define ACE_OS_INCLUDE_OS_AIO_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Inclusion of the header may make visible symbols defined in +// the headers , , , and . + +#include "ace/os_include/os_signal.h" // for sigevent + +#if !defined (ACE_LACKS_AIO_H) +# include /**/ +#endif /* !ACE_LACKS_AIO_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_AIO_H */ diff --git a/externals/ace/os_include/os_assert.h b/externals/ace/os_include/os_assert.h new file mode 100644 index 0000000..fdca573 --- /dev/null +++ b/externals/ace/os_include/os_assert.h @@ -0,0 +1,46 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_assert.h + * + * verify program assertion + * + * $Id: os_assert.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_ASSERT_H +#define ACE_OS_INCLUDE_OS_ASSERT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_ASSERT_H) +# include /**/ +#endif /* !ACE_LACKS_ASSERT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_ASSERT_MACRO) +# define assert(expr) +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_ASSERT_H */ diff --git a/externals/ace/os_include/os_byteswap.h b/externals/ace/os_include/os_byteswap.h new file mode 100644 index 0000000..b55754e --- /dev/null +++ b/externals/ace/os_include/os_byteswap.h @@ -0,0 +1,41 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_byteswap.h + * + * Byteswap methods + * + * $Id: os_byteswap.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_BYTESWAP_H +#define ACE_OS_INCLUDE_OS_BYTESWAP_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_BYTESWAP_H) +# include /**/ +#endif /* !ACE_HAS_INTRIN_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_BYTESWAP_H */ diff --git a/externals/ace/os_include/os_complex.h b/externals/ace/os_include/os_complex.h new file mode 100644 index 0000000..5e6546f --- /dev/null +++ b/externals/ace/os_include/os_complex.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_complex.h + * + * complex arithmetic + * + * $Id: os_complex.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_COMPLEX_H +#define ACE_OS_INCLUDE_OS_COMPLEX_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_COMPLEX_H) +# include /**/ +#endif /* !ACE_LACKS_COMPLEX_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_COMPLEX_H */ diff --git a/externals/ace/os_include/os_cpio.h b/externals/ace/os_include/os_cpio.h new file mode 100644 index 0000000..2c06e8e --- /dev/null +++ b/externals/ace/os_include/os_cpio.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_cpio.h + * + * cpio archive values + * + * $Id: os_cpio.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_CPIO_H +#define ACE_OS_INCLUDE_OS_CPIO_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_CPIO_H) +# include /**/ +#endif /* !ACE_LACKS_CPIO_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_CPIO_H */ diff --git a/externals/ace/os_include/os_ctype.h b/externals/ace/os_include/os_ctype.h new file mode 100644 index 0000000..4b5b651 --- /dev/null +++ b/externals/ace/os_include/os_ctype.h @@ -0,0 +1,48 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_ctype.h + * + * character types + * + * $Id: os_ctype.h 83520 2008-11-03 08:54:08Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_CTYPE_H +#define ACE_OS_INCLUDE_OS_CTYPE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_CTYPE_H) +# include /**/ +#endif /* !ACE_LACKS_CTYPE_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +// @todo move the is* and is* emulation methods in ACE_OS here +// and let ACE_OS just call them. +#if !defined (ACE_HAS_CTYPE_T) +typedef int ctype_t; +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_CTYPE_H */ diff --git a/externals/ace/os_include/os_dirent.h b/externals/ace/os_include/os_dirent.h new file mode 100644 index 0000000..034bacd --- /dev/null +++ b/externals/ace/os_include/os_dirent.h @@ -0,0 +1,110 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_dirent.h + * + * format of directory entries + * + * $Id: os_dirent.h 82985 2008-10-08 18:15:30Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_DIRENT_H +#define ACE_OS_INCLUDE_OS_DIRENT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" +#include "ace/os_include/os_limits.h" + +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) +# include "ace/os_include/os_unistd.h" // VxWorks needs this to compile +#endif /* ACE_VXWORKS */ + +#if !defined (ACE_LACKS_DIRENT_H) +# include /**/ +#endif /* !ACE_LACKS_DIRENT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if !defined (MAXNAMLEN) +# define MAXNAMLEN NAME_MAX +#endif /* !MAXNAMLEN */ + +// At least compile on some of the platforms without info yet. +#if !defined (ACE_HAS_DIRENT) +typedef int ACE_DIR; +struct dirent { +}; +#endif /* ACE_HAS_DIRENT */ + +#if defined (ACE_LACKS_STRUCT_DIR) +struct dirent { + unsigned short d_ino; + unsigned short d_off; + unsigned short d_reclen; + // This must be a ACE_TCHAR * and not a one element + // ACE_TCHAR array. It causes problems on wide + // character builds with Visual C++ 6.0. + ACE_TCHAR *d_name; +}; + +#define ACE_DIRENT dirent +#define ACE_HAS_TCHAR_DIRENT + +struct ACE_DIR { + /// The name of the directory we are looking into + ACE_TCHAR *directory_name_; + + /// Remember the handle between calls. + HANDLE current_handle_; + + /// The struct for the results + ACE_DIRENT *dirent_; + + /// The struct for intermediate results. + ACE_TEXT_WIN32_FIND_DATA fdata_; + + /// A flag to remember if we started reading already. + int started_reading_; +}; +#elif defined (ACE_WIN32) && (__BORLANDC__) && defined (ACE_USES_WCHAR) +#define ACE_HAS_TCHAR_DIRENT +#define ACE_DIRENT wdirent +typedef wDIR ACE_DIR; +#else +#define ACE_DIRENT dirent +typedef DIR ACE_DIR; +#endif /* ACE_LACKS_STRUCT_DIR */ + +#if defined (ACE_LACKS_SCANDIR_PROTOTYPE) +int scandir (const char *, + struct dirent ***, + int (*) (const struct dirent *), + int (*) (const void *, const void *)); +#endif /* ACE_LACKS_SCANDIR_PROTOTYPE */ + +#if defined (ACE_LACKS_ALPHASORT_PROTOTYPE) +int alphasort (const void *, const void *); +#endif /* ACE_LACKS_ALPHASORT_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_DIRENT_H */ diff --git a/externals/ace/os_include/os_dlfcn.h b/externals/ace/os_include/os_dlfcn.h new file mode 100644 index 0000000..0f74437 --- /dev/null +++ b/externals/ace/os_include/os_dlfcn.h @@ -0,0 +1,101 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_dlfcn.h + * + * dynamic linking + * + * $Id: os_dlfcn.h 82273 2008-07-09 14:21:45Z jtc $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_DLFCN_H +#define ACE_OS_INCLUDE_OS_DLFCN_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_DLFCN_H) +# include /**/ +#endif /* !ACE_LACKS_DLFCN_H */ + +#if defined (__hpux) +# if defined(__GNUC__) || __cplusplus >= 199707L +# include /**/ +# else +# include /**/ +# endif /* (g++ || HP aC++) vs. HP C++ */ +#endif /* __hpux */ + +#if defined (ACE_VXWORKS) && !defined (__RTP__) +# include /**/ /* for module load */ +# include /**/ /* for module unload */ +# include /**/ /* for findSymbol */ +# include /**/ /* for global symbol table */ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (_M_UNIX) + int _dlclose (void *); + char *_dlerror (void); + void *_dlopen (const char *, int); + void * _dlsym (void *, const char *); +#endif /* _M_UNIX */ + +/* Set the proper handle type for dynamically-loaded libraries. */ +/* Also define a default 'mode' for loading a library - the names and values */ +/* differ between OSes, so if you write code that uses the mode, be careful */ +/* of the platform differences. */ +#if defined (ACE_WIN32) + // Dynamic loading-related types - used for dlopen and family. + typedef HINSTANCE ACE_SHLIB_HANDLE; +# define ACE_SHLIB_INVALID_HANDLE 0 +# define ACE_DEFAULT_SHLIB_MODE 0 +#elif defined (ACE_HAS_SVR4_DYNAMIC_LINKING) + typedef void *ACE_SHLIB_HANDLE; +# define ACE_SHLIB_INVALID_HANDLE 0 + // This is needed to for dynamic_cast to work properly on objects passed to + // libraries. +# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY | RTLD_GLOBAL +#elif defined (__hpux) + typedef shl_t ACE_SHLIB_HANDLE; +# define ACE_SHLIB_INVALID_HANDLE 0 +# define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED | DYNAMIC_PATH +#else /* !ACE_WIN32 && !ACE_HAS_SVR4_DYNAMIC_LINKING && !__hpux */ + typedef void *ACE_SHLIB_HANDLE; +# define ACE_SHLIB_INVALID_HANDLE 0 +# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY +#endif /* ACE_WIN32 */ + +#if !defined (RTLD_LAZY) +#define RTLD_LAZY 1 +#endif /* !RTLD_LAZY */ + +#if !defined (RTLD_NOW) +#define RTLD_NOW 2 +#endif /* !RTLD_NOW */ + +#if !defined (RTLD_GLOBAL) +#define RTLD_GLOBAL 3 +#endif /* !RTLD_GLOBAL */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_DLFCN_H */ diff --git a/externals/ace/os_include/os_errno.h b/externals/ace/os_include/os_errno.h new file mode 100644 index 0000000..53c9076 --- /dev/null +++ b/externals/ace/os_include/os_errno.h @@ -0,0 +1,343 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_errno.h + * + * system error numbers + * + * $Id: os_errno.h 85122 2009-04-20 16:34:19Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_ERRNO_H +#define ACE_OS_INCLUDE_OS_ERRNO_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_ERRNO_H) +# include /**/ +#endif /* !ACE_LACKS_ERRNO_H */ + +#if defined (ACE_VXWORKS) +// Needed for VxWorks to pickup errnoSet() +#include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_WIN32) + // error code mapping for windows + +# if !defined (ETIME) +# define ETIME ERROR_SEM_TIMEOUT +# endif /* !ETIME */ +# if !defined (EWOULDBLOCK) +# define EWOULDBLOCK WSAEWOULDBLOCK +# endif /* !EWOULDBLOCK */ +# if !defined (EINPROGRESS) +# define EINPROGRESS WSAEINPROGRESS +# endif /* !EINPROGRESS */ +# if !defined (EALREADY) +# define EALREADY WSAEALREADY +# endif /* !EALREADY */ +# if !defined (ENOTSOCK) +# define ENOTSOCK WSAENOTSOCK +# endif /* !ENOTSOCK */ +# if !defined (EDESTADDRREQ) +# define EDESTADDRREQ WSAEDESTADDRREQ +# endif /* !EDESTADDRREQ */ +# if !defined (EMSGSIZE) +# define EMSGSIZE WSAEMSGSIZE +# endif /* !EMSGSIZE */ +# if !defined (EPROTOTYPE) +# define EPROTOTYPE WSAEPROTOTYPE +# endif /* !EPROTOTYPE */ +# if !defined (ENOPROTOOPT) +# define ENOPROTOOPT WSAENOPROTOOPT +# endif /* !ENOPROTOOPT */ +# if !defined (EPROTONOSUPPORT) +# define EPROTONOSUPPORT WSAEPROTONOSUPPORT +# endif /* !EPROTONOSUPPORT */ +# if !defined (ESOCKTNOSUPPORT) +# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +# endif /* !ESOCKTNOSUPPORT */ +# if !defined (EOPNOTSUPP) +# define EOPNOTSUPP WSAEOPNOTSUPP +# endif /* !EOPNOTSUPP */ +# if !defined (EPFNOSUPPORT) +# define EPFNOSUPPORT WSAEPFNOSUPPORT +# endif /* !EPFNOSUPPORT */ +# if !defined (EAFNOSUPPORT) +# define EAFNOSUPPORT WSAEAFNOSUPPORT +# endif /* !EAFNOSUPPORT */ +# if !defined (EADDRINUSE) +# define EADDRINUSE WSAEADDRINUSE +# endif /* !EADDRINUSE */ +# if !defined (EADDRNOTAVAIL) +# define EADDRNOTAVAIL WSAEADDRNOTAVAIL +# endif /* !EADDRNOTAVAIL */ +# if !defined (ENETDOWN) +# define ENETDOWN WSAENETDOWN +# endif /* !ENETDOWN */ +# if !defined (ENETUNREACH) +# define ENETUNREACH WSAENETUNREACH +# endif /* !ENETUNREACH */ +# if !defined (ENETRESET) +# define ENETRESET WSAENETRESET +# endif /* !ENETRESET */ +# if !defined (ECONNABORTED) +# define ECONNABORTED WSAECONNABORTED +# endif /* !ECONNABORTED */ +# if !defined (ECONNRESET) +# define ECONNRESET WSAECONNRESET +# endif /* !ECONNRESET */ +# if !defined (ENOBUFS) +# define ENOBUFS WSAENOBUFS +# endif /* !ENOBUFS */ +# if !defined (EISCONN) +# define EISCONN WSAEISCONN +# endif /* !EISCONN */ +# if !defined (ENOTCONN) +# define ENOTCONN WSAENOTCONN +# endif /* !ENOTCONN */ +# if !defined (ESHUTDOWN) +# define ESHUTDOWN WSAESHUTDOWN +# endif /* !ESHUTDOWN */ +# if !defined (ETOOMANYREFS) +# define ETOOMANYREFS WSAETOOMANYREFS +# endif /* !ETOOMANYREFS */ +# if !defined (ETIMEDOUT) +# define ETIMEDOUT WSAETIMEDOUT +# endif /* !ETIMEDOUT */ +# if !defined (ECONNREFUSED) +# define ECONNREFUSED WSAECONNREFUSED +# endif /* !ECONNREFUSED */ +# if !defined (ELOOP) +# define ELOOP WSAELOOP +# endif /* !ELOOP */ +# if !defined (EHOSTDOWN) +# define EHOSTDOWN WSAEHOSTDOWN +# endif /* !EHOSTDOWN */ +# if !defined (EHOSTUNREACH) +# define EHOSTUNREACH WSAEHOSTUNREACH +# endif /* !EHOSTUNREACH */ +# if !defined (EPROCLIM) +# define EPROCLIM WSAEPROCLIM +# endif /* !EPROCLIM */ +# if !defined (EUSERS) +# define EUSERS WSAEUSERS +# endif /* !EUSERS */ +# if !defined (EDQUOT) +# define EDQUOT WSAEDQUOT +# endif /* !EDQUOT */ +# if !defined (ESTALE) +# define ESTALE WSAESTALE +# endif /* !ESTALE */ +# if !defined (EREMOTE) +# define EREMOTE WSAEREMOTE +# endif /* !EREMOTE */ + + // Grrr! ENAMETOOLONG and ENOTEMPTY are already defined by the horrible + // 'standard' library. + // #define ENAMETOOLONG WSAENAMETOOLONG +# if !defined (EADDRINUSE) +# define EADDRINUSE WSAEADDRINUSE +# endif /* EADDRINUSE*/ + + // CE needs this... +# if !defined (EPERM) +# define EPERM ERROR_ACCESS_DENIED +# endif +#endif /* ACE_WIN32 */ + +#if defined (ACE_HAS_H_ERRNO) +void herror (const char *str); +#endif /* ACE_HAS_H_ERRNO */ + +#if defined (ACE_LACKS_ERRNO_H) +# if !defined (EPERM) +# define EPERM 1 +# endif /* EPERM */ +# if !defined (ENOENT) +# define ENOENT 2 +# endif /* ENOENT */ +# if !defined (ESRCH) +# define ESRCH 3 +# endif /* ESRCH */ +# if !defined (EINTR) +# define EINTR 4 +# endif /* EINTR */ +# if !defined (EIO) +# define EIO 5 +# endif /* EIO */ +# if !defined (ENXIO) +# define ENXIO 6 +# endif /* ENXIO */ +# if !defined (E2BIG) +# define E2BIG 7 +# endif /* E2BIG */ +# if !defined (ENOEXEC) +# define ENOEXEC 8 +# endif /* ENOEXEC */ +# if !defined (EBADF) +# define EBADF 9 +# endif /* EBADF */ +# if !defined (ECHILD) +# define ECHILD 10 +# endif /* ECHILD */ +# if !defined (EAGAIN) +# define EAGAIN 11 +# endif /* EAGAIN */ +# if !defined (ENOMEM) +# define ENOMEM 12 +# endif /* ENOMEM */ +# if !defined (EACCES) +# define EACCES 13 +# endif /* EACCES */ +# if !defined (EFAULT) +# define EFAULT 14 +# endif /* EFAULT */ +# if !defined (EBUSY) +# define EBUSY 16 +# endif /* EBUSY */ +# if !defined (EEXIST) +# define EEXIST 17 +# endif /* EEXIST */ +# if !defined (EXDEV) +# define EXDEV 18 +# endif /* EXDEV */ +# if !defined (ENODEV) +# define ENODEV 19 +# endif /* ENODEV */ +# if !defined (ENOTDIR) +# define ENOTDIR 20 +# endif /* ENOTDIR */ +# if !defined (EISDIR) +# define EISDIR 21 +# endif /* EISDIR */ +# if !defined (EINVAL) +# define EINVAL 22 +# endif /* EINVAL */ +# if !defined (ENFILE) +# define ENFILE 23 +# endif /* ENFILE */ +# if !defined (EMFILE) +# define EMFILE 24 +# endif /* EMFILE */ +# if !defined (ENOTTY) +# define ENOTTY 25 +# endif /* ENOTTY */ +# if !defined (EFBIG) +# define EFBIG 27 +# endif /* EFBIG */ +# if !defined (ENOSPC) +# define ENOSPC 28 +# endif /* ENOSPC */ +# if !defined (ESPIPE) +# define ESPIPE 29 +# endif /* ESPIPE */ +# if !defined (EROFS) +# define EROFS 30 +# endif /* EROFS */ +# if !defined (EMLINK) +# define EMLINK 31 +# endif /* EMLINK */ +# if !defined (EPIPE) +# define EPIPE 32 +# endif /* EPIPE */ +# if !defined (EDOM) +# define EDOM 33 +# endif /* EDOM */ +# if !defined (ERANGE) +# define ERANGE 34 +# endif /* ERANGE */ +# if !defined (EDEADLK) +# define EDEADLK 36 +# endif /* EDEADLK */ +# if !defined (ENAMETOOLONG) +# define ENAMETOOLONG 38 +# endif /* ENAMETOOLONG */ +# if !defined (ENOLCK) +# define ENOLCK 39 +# endif /* ENOLCK */ +# if !defined (ENOSYS) +# define ENOSYS 40 +# endif /* ENOSYS */ +# if !defined (ENOTEMPTY) +# define ENOTEMPTY 41 +# endif /* ENOTEMPTY */ +#endif /* ACE_LACKS_ERRNO_H */ + +#if defined (ACE_LACKS_T_ERRNO) +extern int t_errno; +#endif /* ACE_LACKS_T_ERRNO */ + +#if !defined (ENOSYS) +# define ENOSYS EFAULT /* Operation not supported or unknown error. */ +#endif /* !ENOSYS */ + +#if !defined (ENOTSUP) +# define ENOTSUP ENOSYS /* Operation not supported. */ +#endif /* !ENOTSUP */ + +#if !defined (ESUCCESS) +# define ESUCCESS 0 +#endif /* !ESUCCESS */ + +#if !defined (EIDRM) +# define EIDRM 0 +#endif /* !EIDRM */ + +#if !defined (ENFILE) +# define ENFILE EMFILE /* No more socket descriptors are available. */ +#endif /* !ENFILE */ + +#if !defined (ECOMM) + // Not the same, but ECONNABORTED is provided on NT. +# define ECOMM ECONNABORTED +#endif /* ECOMM */ + +#if !defined (EDEADLK) +# define EDEADLK 1000 /* Some large number.... */ +#endif /* !EDEADLK */ + +#if !defined (ENXIO) /* Needed in SOCK_Dgram_Mcast */ +# define ENXIO 6 +#endif /* ENXIO */ + +#if !defined (ETIMEDOUT) && defined (ETIME) +# define ETIMEDOUT ETIME +#endif /* ETIMEDOUT */ + +#if !defined (ETIME) && defined (ETIMEDOUT) +# define ETIME ETIMEDOUT +#endif /* ETIMED */ + +#if !defined (EBUSY) +# define EBUSY ETIME +#endif /* EBUSY */ + +#if !defined (ECANCELED) +# define ECANCELED 125 +#endif /* ECANCELED */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_ERRNO_H */ diff --git a/externals/ace/os_include/os_fcntl.h b/externals/ace/os_include/os_fcntl.h new file mode 100644 index 0000000..048ff62 --- /dev/null +++ b/externals/ace/os_include/os_fcntl.h @@ -0,0 +1,106 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_fcntl.h + * + * file control options + * + * $Id: os_fcntl.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_FCNTL_H +#define ACE_OS_INCLUDE_OS_FCNTL_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_stat.h" +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_FCNTL_H) +# include /**/ +#endif /* !ACE_LACKS_FCNTL_H */ + +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) +// for creat(), open() +# include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (__BORLANDC__) +# define _O_CREAT O_CREAT +# define _O_EXCL O_EXCL +# define _O_TRUNC O_TRUNC + // 0x0800 is used for O_APPEND. 0x08 looks free. +# define _O_TEMPORARY 0x08 /* see fcntl.h */ +# define _O_RDWR O_RDWR +# define _O_WRONLY O_WRONLY +# define _O_RDONLY O_RDONLY +# define _O_APPEND O_APPEND +# define _O_BINARY O_BINARY +# define _O_TEXT O_TEXT +#endif /* __BORLANDC__ */ + +#if defined (__DMC__) +# define _O_TEMPORARY 0x08 /* see fcntl.h */ +#endif /* __DMC__ */ + +// defined Win32 specific macros for UNIX platforms +#if !defined (O_BINARY) +# define O_BINARY 0 +#endif /* O_BINARY */ +#if !defined (_O_BINARY) +# define _O_BINARY O_BINARY +#endif /* _O_BINARY */ +#if !defined (O_TEXT) +# define O_TEXT 0 +#endif /* O_TEXT */ +#if !defined (_O_TEXT) +# define _O_TEXT O_TEXT +#endif /* _O_TEXT */ +#if !defined (O_RAW) +# define O_RAW 0 +#endif /* O_RAW */ +#if !defined (_O_RAW) +# define _O_RAW O_RAW +#endif /* _O_RAW */ + +#if defined (ACE_WIN32) +# define O_NDELAY 1 +#endif /* ACE_WIN32 */ + +# if !defined (O_NONBLOCK) +# define O_NONBLOCK 1 +# endif /* O_NONBLOCK */ + +#if defined (ACE_HAS_POSIX_NONBLOCK) +# define ACE_NONBLOCK O_NONBLOCK +#else +# define ACE_NONBLOCK O_NDELAY +#endif /* ACE_HAS_POSIX_NONBLOCK */ + +# if !defined (F_GETFL) +# define F_GETFL 0 +# endif /* F_GETFL */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_FCNTL_H */ diff --git a/externals/ace/os_include/os_fenv.h b/externals/ace/os_include/os_fenv.h new file mode 100644 index 0000000..cbf5ab4 --- /dev/null +++ b/externals/ace/os_include/os_fenv.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_fenv.h + * + * floating-point environment + * + * $Id: os_fenv.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_FENV_H +#define ACE_OS_INCLUDE_OS_FENV_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_FENV_H) +# include /**/ +#endif /* !ACE_LACKS_FENV_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_FENV_H */ diff --git a/externals/ace/os_include/os_float.h b/externals/ace/os_include/os_float.h new file mode 100644 index 0000000..ac4b2f8 --- /dev/null +++ b/externals/ace/os_include/os_float.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_float.h + * + * floating types + * + * $Id: os_float.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_FLOAT_H +#define ACE_OS_INCLUDE_OS_FLOAT_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_FLOAT_H) +# include /**/ +#endif /* !ACE_LACKS_FLOAT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_FLOAT_H */ diff --git a/externals/ace/os_include/os_fmtmsg.h b/externals/ace/os_include/os_fmtmsg.h new file mode 100644 index 0000000..74251a9 --- /dev/null +++ b/externals/ace/os_include/os_fmtmsg.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_fmtmsg.h + * + * message display structures + * + * $Id: os_fmtmsg.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_FMTMSG_H +#define ACE_OS_INCLUDE_OS_FMTMSG_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_FMTMSG_H) +# include /**/ +#endif /* !ACE_LACKS_FMTMSG_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_FMTMSG_H */ diff --git a/externals/ace/os_include/os_fnmatch.h b/externals/ace/os_include/os_fnmatch.h new file mode 100644 index 0000000..36726e2 --- /dev/null +++ b/externals/ace/os_include/os_fnmatch.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_fnmatch.h + * + * filename-matching types + * + * $Id: os_fnmatch.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_FNMATCH_H +#define ACE_OS_INCLUDE_OS_FNMATCH_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_FNMATCH_H) +# include /**/ +#endif /* !ACE_LACKS_FNMATCH_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_FNMATCH_H */ diff --git a/externals/ace/os_include/os_ftw.h b/externals/ace/os_include/os_ftw.h new file mode 100644 index 0000000..225d325 --- /dev/null +++ b/externals/ace/os_include/os_ftw.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_ftw.h + * + * file tree traversal + * + * $Id: os_ftw.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_FTW_H +#define ACE_OS_INCLUDE_OS_FTW_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_stat.h" + +#if !defined (ACE_LACKS_FTW_H) +# include /**/ +#endif /* !ACE_LACKS_FTW_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_FTW_H */ diff --git a/externals/ace/os_include/os_glob.h b/externals/ace/os_include/os_glob.h new file mode 100644 index 0000000..0ced3a3 --- /dev/null +++ b/externals/ace/os_include/os_glob.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_glob.h + * + * pathname pattern-matching types + * + * $Id: os_glob.h 81692 2008-05-14 12:25:02Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_GLOB_H +#define ACE_OS_INCLUDE_OS_GLOB_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_GLOB_H) +# include /**/ +#endif /* !ACE_LACKS_GLOB_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_GLOB_H */ diff --git a/externals/ace/os_include/os_grp.h b/externals/ace/os_include/os_grp.h new file mode 100644 index 0000000..74bb6e6 --- /dev/null +++ b/externals/ace/os_include/os_grp.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_grp.h + * + * group structure + * + * $Id: os_grp.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_GRP_H +#define ACE_OS_INCLUDE_OS_GRP_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" // for gid_t + +#if !defined (ACE_LACKS_GRP_H) +# include /**/ +#endif /* !ACE_LACKS_GRP_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_GRP_H */ diff --git a/externals/ace/os_include/os_iconv.h b/externals/ace/os_include/os_iconv.h new file mode 100644 index 0000000..33b061c --- /dev/null +++ b/externals/ace/os_include/os_iconv.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_iconv.h + * + * codeset conversion facility + * + * $Id: os_iconv.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_ICONV_H +#define ACE_OS_INCLUDE_OS_ICONV_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_ICONV_H) +# include /**/ +#endif /* !ACE_LACKS_ICONV_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_ICONV_H */ diff --git a/externals/ace/os_include/os_intrin.h b/externals/ace/os_include/os_intrin.h new file mode 100644 index 0000000..37b6695 --- /dev/null +++ b/externals/ace/os_include/os_intrin.h @@ -0,0 +1,57 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_intrin.h + * + * Intrinsic methods + * + * $Id: os_intrin.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_INTRIN_H +#define ACE_OS_INCLUDE_OS_INTRIN_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_INTRIN_H) +# include /**/ +#endif /* !ACE_HAS_INTRIN_H */ + +#if defined (ACE_HAS_IA64INTRIN_H) +# include /**/ +#endif /* !ACE_HAS_IA64INTRIN_H */ + +#if defined (ACE_HAS_IA32INTRIN_H) +# include /**/ +#endif /* !ACE_HAS_IA32INTRIN_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (_MSC_VER) && (_MSC_VER < 1400) && !(defined (__INTEL_COMPILER) && (__INTEL_COMPILER == 900)) +// See http://msdn2.microsoft.com/en-us/library/f24ya7ct(VS.71).aspx +LONG __cdecl _InterlockedIncrement (LONG volatile *Addend); +LONG __cdecl _InterlockedDecrement (LONG volatile *Addend); +LONG __cdecl _InterlockedExchange (LONG volatile *Target, LONG Value); +LONG __cdecl _InterlockedExchangeAdd (LONG volatile *Addend, LONG Value); +#endif //_MSC_VER + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_INTRIN_H */ diff --git a/externals/ace/os_include/os_inttypes.h b/externals/ace/os_include/os_inttypes.h new file mode 100644 index 0000000..2f0c188 --- /dev/null +++ b/externals/ace/os_include/os_inttypes.h @@ -0,0 +1,46 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_inttypes.h + * + * fixed size integer types + * + * $Id: os_inttypes.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_INTTYPES_H +#define ACE_OS_INCLUDE_OS_INTTYPES_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stdint.h" + +#if !defined (ACE_LACKS_INTTYPES_H) +# include /**/ +#endif /* !ACE_LACKS_INTTYPES_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +// @todo if needbe, we can define the macros if they aren't available. + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_INTTYPES_H */ diff --git a/externals/ace/os_include/os_iso646.h b/externals/ace/os_include/os_iso646.h new file mode 100644 index 0000000..0c5ab2a --- /dev/null +++ b/externals/ace/os_include/os_iso646.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_iso646.h + * + * alternative spellings + * + * $Id: os_iso646.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_ISO646_H +#define ACE_OS_INCLUDE_OS_ISO646_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_ISO646_H) +# include /**/ +#endif /* !ACE_LACKS_ISO646_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_ISO646_H */ diff --git a/externals/ace/os_include/os_kstat.h b/externals/ace/os_include/os_kstat.h new file mode 100644 index 0000000..31836cd --- /dev/null +++ b/externals/ace/os_include/os_kstat.h @@ -0,0 +1,43 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_kstat.h + * + * $Id: os_kstat.h 81692 2008-05-14 12:25:02Z johnnyw $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_KSTAT_H +#define ACE_OS_INCLUDE_OS_KSTAT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_KSTAT) +# define ACE_HAS_KSTAT_H +#endif /* ACE_HAS_KSTAT */ + +#if defined (ACE_HAS_KSTAT_H) +# include +#endif /* ACE_HAS_KSTAT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_KSTAT_H */ diff --git a/externals/ace/os_include/os_langinfo.h b/externals/ace/os_include/os_langinfo.h new file mode 100644 index 0000000..bfcd67c --- /dev/null +++ b/externals/ace/os_include/os_langinfo.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_langinfo.h + * + * language information constants + * + * $Id: os_langinfo.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_LANGINFO_H +#define ACE_OS_INCLUDE_OS_LANGINFO_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_nl_types.h" + +#if !defined (ACE_LACKS_LANGINFO_H) +# include /**/ +#endif /* !ACE_LACKS_LANGINFO_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_LANGINFO_H */ diff --git a/externals/ace/os_include/os_libgen.h b/externals/ace/os_include/os_libgen.h new file mode 100644 index 0000000..ca24a4d --- /dev/null +++ b/externals/ace/os_include/os_libgen.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_libgen.h + * + * definitions for pattern matching functions + * + * $Id: os_libgen.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_LIBGEN_H +#define ACE_OS_INCLUDE_OS_LIBGEN_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_LIBGEN_H) +# include /**/ +#endif /* !ACE_LACKS_LIBGEN_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_LIBGEN_H */ diff --git a/externals/ace/os_include/os_limits.h b/externals/ace/os_include/os_limits.h new file mode 100644 index 0000000..a128efc --- /dev/null +++ b/externals/ace/os_include/os_limits.h @@ -0,0 +1,143 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_limits.h + * + * implementation-defined constants + * + * $Id: os_limits.h 84972 2009-03-25 19:09:06Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_LIMITS_H +#define ACE_OS_INCLUDE_OS_LIMITS_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_unistd.h" +#include "ace/os_include/os_stdio.h" // for FILENAME_MAX on Windows + +#if !defined (ACE_LACKS_LIMITS_H) +# include /**/ +#endif /* !ACE_LACKS_LIMITS_H */ + +#if !defined (ACE_LACKS_SYS_PARAM_H) +# include /**/ +#endif /* ACE_LACKS_SYS_PARAM_H */ + +// On VxWorks 5.5.1 _POSIX_TIMER_MAX is defined in time.h +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) +# include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if ! defined (howmany) +# define howmany(x, y) (((x)+((y)-1))/(y)) +#endif /* howmany */ + +#if !defined (NAME_MAX) +# if defined (MAXNAMLEN) +# define NAME_MAX MAXNAMLEN +# elif defined (MAXNAMELEN) +# define NAME_MAX MAXNAMELEN +# elif defined (FILENAME_MAX) +# define NAME_MAX FILENAME_MAX +# elif defined (_MAX_FNAME) +# define NAME_MAX _MAX_FNAME +# else /* _MAX_FNAME */ +# define NAME_MAX 256 +# endif /* MAXNAMLEN */ +#endif /* !NAME_MAX */ + +#if !defined (MAXNAMELEN) +# define MAXNAMELEN NAME_MAX +#endif /* MAXNAMELEN */ + +#if !defined (HOST_NAME_MAX) +# define HOST_NAME_MAX 256 +#endif /* !HOST_NAME_MAX */ + +// Note that we are using PATH_MAX instead of _POSIX_PATH_MAX, since +// _POSIX_PATH_MAX is the *minimun* maximum value for PATH_MAX and is +// defined by POSIX as 256. +#if !defined (PATH_MAX) +# if defined (_MAX_PATH) +# define PATH_MAX _MAX_PATH +# elif defined (MAX_PATH) +# define PATH_MAX MAX_PATH +# else /* !_MAX_PATH */ +# define PATH_MAX 1024 +# endif /* _MAX_PATH */ +#endif /* !PATH_MAX */ + +// Leaving this for backward compatibility, but PATH_MAX should always be +// used directly. +#if !defined (MAXPATHLEN) +# define MAXPATHLEN PATH_MAX +#endif /* !MAXPATHLEN */ + +// This is defined by XOPEN to be a minimum of 16. POSIX.1g +// also defines this value. platform-specific config.h can +// override this if need be. +#if !defined (IOV_MAX) +# define IOV_MAX 16 +#endif /* IOV_MAX */ + +#if !defined (ACE_IOV_MAX) +# define ACE_IOV_MAX IOV_MAX +#endif /* ACE_IOV_MAX */ + +#if defined (ACE_VXWORKS) && ((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x670)) && !defined (__RTP__) +# if defined (PIPE_BUF) && (PIPE_BUF == -1) +# undef PIPE_BUF +# endif +#endif /* ACE_VXWORKS */ + +#if !defined (PIPE_BUF) +# define PIPE_BUF 5120 +#endif /* PIPE_BUF */ + +#if defined (ACE_HAS_POSIX_REALTIME_SIGNALS) + // = Giving unique ACE scoped names for some important + // RTSignal-Related constants. Becuase sometimes, different + // platforms use different names for these constants. + + // Number of realtime signals provided in the system. + // _POSIX_RTSIG_MAX is the upper limit on the number of real time + // signals supported in a posix-4 compliant system. +# if defined (_POSIX_RTSIG_MAX) +# define ACE_RTSIG_MAX _POSIX_RTSIG_MAX +# else /* not _POSIX_RTSIG_MAX */ + // POSIX-4 compilant system has to provide atleast 8 RT signals. + // @@ Make sure the platform does *not* define this constant with + // some other name. If yes, use that instead of 8. +# define ACE_RTSIG_MAX 8 +# endif /* _POSIX_RTSIG_MAX */ +#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ + + // The maximum number of concurrent timers per process. +# if !defined (_POSIX_TIMER_MAX) +# define _POSIX_TIMER_MAX 44 +# endif /* _POSIX_TIMER_MAX */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_LIMITS_H */ diff --git a/externals/ace/os_include/os_local.h b/externals/ace/os_include/os_local.h new file mode 100644 index 0000000..b5752f9 --- /dev/null +++ b/externals/ace/os_include/os_local.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_local.h + * + * category macros + * + * $Id: os_local.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_LOCAL_H +#define ACE_OS_INCLUDE_OS_LOCAL_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stddef.h" + +#if !defined (ACE_LACKS_LOCAL_H) +# include /**/ +#endif /* !ACE_LACKS_LOCAL_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_LOCAL_H */ diff --git a/externals/ace/os_include/os_math.h b/externals/ace/os_include/os_math.h new file mode 100644 index 0000000..6fb53cb --- /dev/null +++ b/externals/ace/os_include/os_math.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_math.h + * + * mathematical declarations + * + * $Id: os_math.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_MATH_H +#define ACE_OS_INCLUDE_OS_MATH_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// FUZZ: disable check_for_math_include + +#if !defined (ACE_LACKS_MATH_H) +# include /**/ +#endif /* !ACE_LACKS_MATH_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_MATH_H */ diff --git a/externals/ace/os_include/os_monetary.h b/externals/ace/os_include/os_monetary.h new file mode 100644 index 0000000..6e95688 --- /dev/null +++ b/externals/ace/os_include/os_monetary.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_monetary.h + * + * monetary types + * + * $Id: os_monetary.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_MONETARY_H +#define ACE_OS_INCLUDE_OS_MONETARY_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_MONETARY_H) +# include /**/ +#endif /* !ACE_LACKS_MONETARY_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_MONETARY_H */ diff --git a/externals/ace/os_include/os_mqueue.h b/externals/ace/os_include/os_mqueue.h new file mode 100644 index 0000000..7b3cbb9 --- /dev/null +++ b/externals/ace/os_include/os_mqueue.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_mqueue.h + * + * message queues (REALTIME) + * + * $Id: os_mqueue.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_MQUEUE_H +#define ACE_OS_INCLUDE_OS_MQUEUE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_signal.h" + +#if !defined (ACE_LACKS_MQUEUE_H) +# include /**/ +#endif /* !ACE_LACKS_MQUEUE_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_MQUEUE_H */ diff --git a/externals/ace/os_include/os_ndbm.h b/externals/ace/os_include/os_ndbm.h new file mode 100644 index 0000000..042dceb --- /dev/null +++ b/externals/ace/os_include/os_ndbm.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_ndbm.h + * + * definitions for ndbm database operations + * + * $Id: os_ndbm.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_NDBM_H +#define ACE_OS_INCLUDE_OS_NDBM_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_NDBM_H) +# include /**/ +#endif /* !ACE_LACKS_NDBM_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_NDBM_H */ diff --git a/externals/ace/os_include/os_netdb.h b/externals/ace/os_include/os_netdb.h new file mode 100644 index 0000000..798bf9b --- /dev/null +++ b/externals/ace/os_include/os_netdb.h @@ -0,0 +1,100 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_netdb.h + * + * definitions for network database operations + * + * $Id: os_netdb.h 84660 2009-03-01 20:22:37Z olli $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_NETDB_H +#define ACE_OS_INCLUDE_OS_NETDB_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/netinet/os_in.h" +#include "ace/os_include/os_limits.h" + +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) +# include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if !defined (ACE_LACKS_NETDB_H) +# include /**/ +#endif /* !ACE_LACKS_NETDB_H */ + +#if defined (ACE_LACKS_HOSTENT) +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatibility */ +}; +#endif /* ACE_LACKS_HOSTENT */ + +#if defined (ACE_LACKS_PROTOENT) +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; +#endif /* ACE_LACKS_PROTOENT */ + +#if defined (ACE_LACKS_SERVENT) +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; +#endif /* ACE_LACKS_SERVENT */ + +#if defined (ACE_HAS_STRUCT_NETDB_DATA) + typedef char ACE_HOSTENT_DATA[sizeof(struct hostent_data)]; + typedef char ACE_SERVENT_DATA[sizeof(struct servent_data)]; + typedef char ACE_PROTOENT_DATA[sizeof(struct protoent_data)]; +#else +# if !defined ACE_HOSTENT_DATA_SIZE +# define ACE_HOSTENT_DATA_SIZE (4*1024) +# endif /*ACE_HOSTENT_DATA_SIZE */ +# if !defined ACE_SERVENT_DATA_SIZE +# define ACE_SERVENT_DATA_SIZE (4*1024) +# endif /*ACE_SERVENT_DATA_SIZE */ +# if !defined ACE_PROTOENT_DATA_SIZE +# define ACE_PROTOENT_DATA_SIZE (2*1024) +# endif /*ACE_PROTOENT_DATA_SIZE */ + typedef char ACE_HOSTENT_DATA[ACE_HOSTENT_DATA_SIZE]; + typedef char ACE_SERVENT_DATA[ACE_SERVENT_DATA_SIZE]; + typedef char ACE_PROTOENT_DATA[ACE_PROTOENT_DATA_SIZE]; +#endif /* ACE_HAS_STRUCT_NETDB_DATA */ + +# if !defined(MAXHOSTNAMELEN) +# define MAXHOSTNAMELEN HOST_NAME_MAX +# endif /* MAXHOSTNAMELEN */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_NETDB_H */ diff --git a/externals/ace/os_include/os_nl_types.h b/externals/ace/os_include/os_nl_types.h new file mode 100644 index 0000000..e043f6a --- /dev/null +++ b/externals/ace/os_include/os_nl_types.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_nl_types.h + * + * data types + * + * $Id: os_nl_types.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_NL_TYPES_H +#define ACE_OS_INCLUDE_OS_NL_TYPES_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_NL_TYPES_H) +# include /**/ +#endif /* !ACE_LACKS_nl_types_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_NL_TYPES_H */ diff --git a/externals/ace/os_include/os_pdh.h b/externals/ace/os_include/os_pdh.h new file mode 100644 index 0000000..5c60c60 --- /dev/null +++ b/externals/ace/os_include/os_pdh.h @@ -0,0 +1,45 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_pdh.h + * + * definitions for the windows pdh API + * + * $Id: os_pdh.h 81614 2008-05-05 14:04:25Z johnnyw $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_PDH_H +#define ACE_OS_INCLUDE_OS_PDH_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +# include /**/ +#endif /* ACE_HAS_PDH_H && !ACE_LACKS_PDH_H */ + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +# define ACE_HAS_WIN32_PDH +#endif + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_PDH_H */ diff --git a/externals/ace/os_include/os_pdhmsg.h b/externals/ace/os_include/os_pdhmsg.h new file mode 100644 index 0000000..2156236 --- /dev/null +++ b/externals/ace/os_include/os_pdhmsg.h @@ -0,0 +1,41 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_pdhmsg.h + * + * definitions for the windows pdh API + * + * $Id: os_pdhmsg.h 81693 2008-05-14 12:35:01Z johnnyw $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_PDHMSG_H +#define ACE_OS_INCLUDE_OS_PDHMSG_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_PDHMSG_H) && !defined (ACE_LACKS_PDHMSG_H) +# include /**/ +#endif /* ACE_HAS_PDH_H && !ACE_LACKS_PDH_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_PDHMSG_H */ diff --git a/externals/ace/os_include/os_poll.h b/externals/ace/os_include/os_poll.h new file mode 100644 index 0000000..646c1bb --- /dev/null +++ b/externals/ace/os_include/os_poll.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_poll.h + * + * definitions for the poll() function + * + * $Id: os_poll.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_POLL_H +#define ACE_OS_INCLUDE_OS_POLL_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_POLL_H) +# include /**/ +#endif /* !ACE_LACKS_POLL_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_POLL_H */ diff --git a/externals/ace/os_include/os_pthread.h b/externals/ace/os_include/os_pthread.h new file mode 100644 index 0000000..368f425 --- /dev/null +++ b/externals/ace/os_include/os_pthread.h @@ -0,0 +1,424 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_pthread.h + * + * threads + * + * $Id: os_pthread.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_PTHREAD_H +#define ACE_OS_INCLUDE_OS_PTHREAD_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_PRIOCNTL) + // Need to #include thread.h before #defining THR_BOUND, etc., + // when building without threads on SunOS 5.x. +# if defined (sun) +# include /**/ +# endif /* sun */ + + // Need to #include these before #defining USYNC_PROCESS on SunOS 5.x. +# include /**/ +# include /**/ +#endif /* ACE_HAS_PRIOCNTL */ + +#include "ace/os_include/sys/os_types.h" + +// This needs to go here *first* to avoid problems with AIX. +# if defined (ACE_HAS_PTHREADS) +# define ACE_DONT_INCLUDE_ACE_SIGNAL_H +# include "ace/os_include/os_signal.h" +# undef ACE_DONT_INCLUDE_ACE_SIGNAL_H +# if defined (DIGITAL_UNIX) +# define pthread_self __pthread_self +extern "C" pthread_t pthread_self (void); +# endif /* DIGITAL_UNIX */ +# endif /* ACE_HAS_PTHREADS */ + + +#if !defined (ACE_LACKS_PTHREAD_H) + extern "C" { +# if defined (ACE_TANDEM_T1248_PTHREADS) +# include /**/ +# else +# include /**/ +# endif + } +#endif /* !ACE_LACKS_PTHREAD_H */ + +#if defined (ACE_HAS_PTHREAD_NP_H) +// FreeBSD declares _np (non-portable) pthread extensions in +# include /**/ +#endif + +// @todo: need to reoganize to put includes at the top and the rest of the +// code at the bottom. Also, move the classes out of this file. +#if defined (ACE_HAS_PTHREADS) +# define ACE_SCHED_OTHER SCHED_OTHER +# define ACE_SCHED_FIFO SCHED_FIFO +# define ACE_SCHED_RR SCHED_RR + +// Definitions for THREAD- and PROCESS-LEVEL priorities...some +// implementations define these while others don't. In order to +// further complicate matters, we don't redefine the default (*_DEF) +// values if they've already been defined, which allows individual +// programs to have their own ACE-wide "default". + +// PROCESS-level values +# if (defined (_POSIX_PRIORITY_SCHEDULING) || defined (ACE_TANDEM_T1248_PTHREADS)) \ + && !defined(_UNICOS) && !defined(UNIXWARE_7_1) +# define ACE_PROC_PRI_FIFO_MIN (sched_get_priority_min(SCHED_FIFO)) +# define ACE_PROC_PRI_RR_MIN (sched_get_priority_min(SCHED_RR)) +# if defined (HPUX) + // HP-UX's other is the SCHED_HPUX class, which uses historical + // values that have reverse semantics from POSIX (low value is + // more important priority). To use these in pthreads calls, + // the values need to be converted. The other scheduling classes + // don't need this special treatment. +# define ACE_PROC_PRI_OTHER_MIN \ + (sched_get_priority_min(SCHED_OTHER)) +# else +# define ACE_PROC_PRI_OTHER_MIN (sched_get_priority_min(SCHED_OTHER)) +# endif /* HPUX */ +# else /* UNICOS is missing a sched_get_priority_min() implementation, + SCO too */ +# define ACE_PROC_PRI_FIFO_MIN 0 +# define ACE_PROC_PRI_RR_MIN 0 +# define ACE_PROC_PRI_OTHER_MIN 0 +# endif + +# if defined (_POSIX_PRIORITY_SCHEDULING) && !defined(UNIXWARE_7_1) +# define ACE_PROC_PRI_FIFO_MAX (sched_get_priority_max(SCHED_FIFO)) +# define ACE_PROC_PRI_RR_MAX (sched_get_priority_max(SCHED_RR)) +# if defined (HPUX) +# define ACE_PROC_PRI_OTHER_MAX \ + (sched_get_priority_max(SCHED_OTHER)) +# else +# define ACE_PROC_PRI_OTHER_MAX (sched_get_priority_max(SCHED_OTHER)) +# endif /* HPUX */ +# else /* SCO missing sched_get_priority_max() implementation */ +# define ACE_PROC_PRI_FIFO_MAX 59 +# define ACE_PROC_PRI_RR_MAX 59 +# define ACE_PROC_PRI_OTHER_MAX 59 +# endif + +# if !defined(ACE_PROC_PRI_FIFO_DEF) +# define ACE_PROC_PRI_FIFO_DEF (ACE_PROC_PRI_FIFO_MIN + (ACE_PROC_PRI_FIFO_MAX - ACE_PROC_PRI_FIFO_MIN)/2) +# endif +# if !defined(ACE_PROC_PRI_RR_DEF) +# define ACE_PROC_PRI_RR_DEF (ACE_PROC_PRI_RR_MIN + (ACE_PROC_PRI_RR_MAX - ACE_PROC_PRI_RR_MIN)/2) +# endif +# if !defined(ACE_PROC_PRI_OTHER_DEF) +# define ACE_PROC_PRI_OTHER_DEF (ACE_PROC_PRI_OTHER_MIN + (ACE_PROC_PRI_OTHER_MAX - ACE_PROC_PRI_OTHER_MIN)/2) +# endif + +// THREAD-level values +# if defined(PRI_FIFO_MIN) && defined(PRI_FIFO_MAX) && defined(PRI_RR_MIN) && defined(PRI_RR_MAX) && defined(PRI_OTHER_MIN) && defined(PRI_OTHER_MAX) +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) PRI_FIFO_MIN +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) PRI_FIFO_MAX +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) PRI_RR_MIN +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) PRI_RR_MAX +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) PRI_OTHER_MIN +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) PRI_OTHER_MAX +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# elif defined (AIX) + // AIX's priority range is 1 (low) to 127 (high). There aren't + // any preprocessor macros I can find. PRIORITY_MIN is for + // process priorities, as far as I can see, and does not apply + // to thread priority. The 1 to 127 range is from the + // pthread_attr_setschedparam man page (Steve Huston, 18-May-2001). +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) 1 +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) 127 +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) 1 +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) 127 +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) 1 +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) 127 +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# elif defined (sun) +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) 0 +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) 59 +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) 0 +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) 59 +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) 0 +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) 127 +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# else +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) ACE_PROC_PRI_FIFO_MIN +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) ACE_PROC_PRI_FIFO_MAX +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) ACE_PROC_PRI_RR_MIN +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) ACE_PROC_PRI_RR_MAX +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) ACE_PROC_PRI_OTHER_MIN +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) ACE_PROC_PRI_OTHER_MAX +# endif /* !ACE_THR_PRI_OTHER_MAX */ +# endif +# if !defined(ACE_THR_PRI_FIFO_DEF) +# define ACE_THR_PRI_FIFO_DEF ((ACE_THR_PRI_FIFO_MIN + ACE_THR_PRI_FIFO_MAX)/2) +# endif +# if !defined(ACE_THR_PRI_RR_DEF) +# define ACE_THR_PRI_RR_DEF ((ACE_THR_PRI_RR_MIN + ACE_THR_PRI_RR_MAX)/2) +# endif +# if !defined(ACE_THR_PRI_OTHER_DEF) +# define ACE_THR_PRI_OTHER_DEF ((ACE_THR_PRI_OTHER_MIN + ACE_THR_PRI_OTHER_MAX)/2) +# endif + // Typedefs to help compatibility with Windows NT and Pthreads. + typedef pthread_t ACE_hthread_t; + typedef pthread_t ACE_thread_t; + + // native TSS key type + typedef pthread_key_t ACE_OS_thread_key_t; + // TSS key type to be used by application +# if defined (ACE_HAS_TSS_EMULATION) + typedef u_int ACE_thread_key_t; +# else /* ! ACE_HAS_TSS_EMULATION */ + typedef ACE_OS_thread_key_t ACE_thread_key_t; +# endif /* ! ACE_HAS_TSS_EMULATION */ + +# if !defined (ACE_LACKS_COND_T) + typedef pthread_mutex_t ACE_mutex_t; + typedef pthread_cond_t ACE_cond_t; + typedef pthread_condattr_t ACE_condattr_t; + typedef pthread_mutexattr_t ACE_mutexattr_t; +# endif /* ! ACE_LACKS_COND_T */ + typedef pthread_mutex_t ACE_thread_mutex_t; + +# if !defined (PTHREAD_CANCEL_DISABLE) +# define PTHREAD_CANCEL_DISABLE 0 +# endif /* PTHREAD_CANCEL_DISABLE */ + +# if !defined (PTHREAD_CANCEL_ENABLE) +# define PTHREAD_CANCEL_ENABLE 0 +# endif /* PTHREAD_CANCEL_ENABLE */ + +# if !defined (PTHREAD_CANCEL_DEFERRED) +# define PTHREAD_CANCEL_DEFERRED 0 +# endif /* PTHREAD_CANCEL_DEFERRED */ + +# if !defined (PTHREAD_CANCEL_ASYNCHRONOUS) +# define PTHREAD_CANCEL_ASYNCHRONOUS 0 +# endif /* PTHREAD_CANCEL_ASYNCHRONOUS */ + +# define THR_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE +# define THR_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE +# define THR_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED +# define THR_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS + +# if !defined (PTHREAD_CREATE_JOINABLE) +# if defined (PTHREAD_CREATE_UNDETACHED) +# define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED +# else +# define PTHREAD_CREATE_JOINABLE 0 +# endif /* PTHREAD_CREATE_UNDETACHED */ +# endif /* PTHREAD_CREATE_JOINABLE */ + +# if !defined (PTHREAD_CREATE_DETACHED) +# define PTHREAD_CREATE_DETACHED 1 +# endif /* PTHREAD_CREATE_DETACHED */ + +# if !defined (PTHREAD_PROCESS_PRIVATE) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM) +# if defined (PTHREAD_MUTEXTYPE_FAST) +# define PTHREAD_PROCESS_PRIVATE PTHREAD_MUTEXTYPE_FAST +# else +# define PTHREAD_PROCESS_PRIVATE 0 +# endif /* PTHREAD_MUTEXTYPE_FAST */ +# endif /* PTHREAD_PROCESS_PRIVATE */ + +# if !defined (PTHREAD_PROCESS_SHARED) && !defined (ACE_HAS_PTHREAD_PROCESS_ENUM) +# if defined (PTHREAD_MUTEXTYPE_FAST) +# define PTHREAD_PROCESS_SHARED PTHREAD_MUTEXTYPE_FAST +# else +# define PTHREAD_PROCESS_SHARED 1 +# endif /* PTHREAD_MUTEXTYPE_FAST */ +# endif /* PTHREAD_PROCESS_SHARED */ + +# if !defined (ACE_HAS_STHREADS) +# if !defined (USYNC_THREAD) +# define USYNC_THREAD PTHREAD_PROCESS_PRIVATE +# endif /* ! USYNC_THREAD */ +# if !defined (USYNC_PROCESS) +# define USYNC_PROCESS PTHREAD_PROCESS_SHARED +# endif /* ! USYNC_PROCESS */ +# endif /* ACE_HAS_STHREADS */ + + /* MM-Graz: prevent warnings */ +# if !defined (UNIXWARE_7_1) +# undef THR_BOUND +# undef THR_NEW_LWP +# undef THR_DETACHED +# undef THR_SUSPENDED +# undef THR_DAEMON + +# define THR_BOUND 0x00000001 +# define THR_NEW_LWP 0x00000002 +# define THR_DETACHED 0x00000040 +# define THR_SUSPENDED 0x00000080 +# define THR_DAEMON 0x00000100 +# define THR_SCHED_FIFO 0x00020000 +# define THR_SCHED_RR 0x00040000 +# define THR_SCHED_DEFAULT 0x00080000 +# endif /* UNIXWARE_7_1 */ + +# define THR_JOINABLE 0x00010000 + +# if defined (ACE_HAS_IRIX62_THREADS) +# define THR_SCOPE_SYSTEM 0x00100000 +# else +# define THR_SCOPE_SYSTEM THR_BOUND +# endif /*ACE_HAS_IRIX62_THREADS*/ + +# define THR_SCOPE_PROCESS 0x00200000 +# define THR_INHERIT_SCHED 0x00400000 +# define THR_EXPLICIT_SCHED 0x00800000 +# define THR_SCHED_IO 0x01000000 + +# if !defined (ACE_HAS_STHREADS) +# if !defined (ACE_HAS_POSIX_SEM) && !defined (ACE_USES_FIFO_SEM) + +// This needs to be moved out of here. +#include /**/ "ace/ACE_export.h" +/** + * @class ACE_sema_t + * + * @brief This is used to implement semaphores for platforms that support + * POSIX pthreads, but do *not* support POSIX semaphores, i.e., + * it's a different type than the POSIX . + */ +class ACE_Export ACE_sema_t +{ +public: + /// Serialize access to internal state. + ACE_mutex_t lock_; + + /// Block until there are no waiters. + ACE_cond_t count_nonzero_; + + /// Count of the semaphore. + u_long count_; + + /// Number of threads that have called . + u_long waiters_; +}; +# endif /* !ACE_HAS_POSIX_SEM */ + +# if defined (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD) + // If we are on Solaris we can just reuse the existing + // implementations of these synchronization types. +# if !defined (ACE_LACKS_RWLOCK_T) && !defined (ACE_HAS_PTHREADS_UNIX98_EXT) +# include /**/ + typedef rwlock_t ACE_rwlock_t; +# endif /* !ACE_LACKS_RWLOCK_T */ +# include /**/ +# endif /* (ACE_LACKS_PTHREAD_YIELD) && defined (ACE_HAS_THR_YIELD) */ + +# else +# if !defined (ACE_HAS_POSIX_SEM) + typedef sema_t ACE_sema_t; +# endif /* !ACE_HAS_POSIX_SEM */ +# endif /* !ACE_HAS_STHREADS */ + +# if defined (ACE_HAS_PTHREADS_UNIX98_EXT) + typedef pthread_rwlock_t ACE_rwlock_t; +# endif /* ACE_HAS_PTHREADS_UNIX98_EXT */ + +# if defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) + + // glibc 2.2.x or better has pthread_mutex_timedlock() +# ifndef ACE_HAS_MUTEX_TIMEOUTS +# define ACE_HAS_MUTEX_TIMEOUTS +# endif /* ACE_HAS_MUTEX_TIMEOUTS */ + + // Use new pthread_attr_setstack if XPG6 support is enabled. +# if defined (_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) < 600 +# define ACE_LACKS_PTHREAD_ATTR_SETSTACK +# endif /* (_XOPEN_SOURCE - 0) < 600 */ + +# if !defined (_XOPEN_SOURCE) \ + || (defined (_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) < 600) + // pthread_mutex_timedlock() prototype is not visible if _XOPEN_SOURCE + // is not >= 600 (i.e. for XPG6). + extern "C" int pthread_mutex_timedlock (pthread_mutex_t *mutex, + const struct timespec * abstime); +# endif /* _XOPEN_SOURCE && _XOPEN_SOURCE < 600 */ + +# endif /* linux && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) */ + +#elif defined (ACE_HAS_STHREADS) +# if !defined (ACE_THR_PRI_FIFO_MIN) +# define ACE_THR_PRI_FIFO_MIN (long) 0 +# endif /* !ACE_THR_PRI_FIFO_MIN */ +# if !defined (ACE_THR_PRI_FIFO_MAX) +# define ACE_THR_PRI_FIFO_MAX (long) 59 +# endif /* !ACE_THR_PRI_FIFO_MAX */ +# if !defined (ACE_THR_PRI_RR_MIN) +# define ACE_THR_PRI_RR_MIN (long) 0 +# endif /* !ACE_THR_PRI_RR_MIN */ +# if !defined (ACE_THR_PRI_RR_MAX) +# define ACE_THR_PRI_RR_MAX (long) 59 +# endif /* !ACE_THR_PRI_RR_MAX */ +# if !defined (ACE_THR_PRI_OTHER_MIN) +# define ACE_THR_PRI_OTHER_MIN (long) 0 +# endif /* !ACE_THR_PRI_OTHER_MIN */ +# if !defined (ACE_THR_PRI_OTHER_MAX) +# define ACE_THR_PRI_OTHER_MAX (long) 127 +# endif /* !ACE_THR_PRI_OTHER_MAX */ +#endif /* ACE_HAS_PTHREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_PTHREAD_H */ diff --git a/externals/ace/os_include/os_pwd.h b/externals/ace/os_include/os_pwd.h new file mode 100644 index 0000000..b1bc94a --- /dev/null +++ b/externals/ace/os_include/os_pwd.h @@ -0,0 +1,58 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_pwd.h + * + * password structure + * + * $Id: os_pwd.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_PWD_H +#define ACE_OS_INCLUDE_OS_PWD_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_PWD_H) +# include /**/ +#endif /* !ACE_LACKS_PWD_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if !defined (ACE_WIN32) +// VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined +// in pwd.h, and that redefinition is used here +# if defined (_AIX) && defined (__IBMCPP__) && (__IBMCPP__ >= 400) + extern int _posix_getpwnam_r(const char *, struct passwd *, char *, + int, struct passwd **); +# endif /* AIX and VAC++ 4 */ +#endif /* !ACE_WIN32 */ + +#if defined (DIGITAL_UNIX) + extern int _Pgetpwnam_r (const char *, struct passwd *, + char *, size_t, struct passwd **); +#endif /* DIGITAL_UNIX */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_PWD_H */ diff --git a/externals/ace/os_include/os_regex.h b/externals/ace/os_include/os_regex.h new file mode 100644 index 0000000..1c856da --- /dev/null +++ b/externals/ace/os_include/os_regex.h @@ -0,0 +1,48 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_regex.h + * + * regular expression matching types + * + * $Id: os_regex.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_REGEX_H +#define ACE_OS_INCLUDE_OS_REGEX_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_REGEX_H) +# include /**/ +#endif /* !ACE_LACKS_REGEX_H */ + +#if defined (ACE_HAS_REGEX) +# include /**/ +#endif /* ACE_HAS_REGEX */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_REGEX_H */ diff --git a/externals/ace/os_include/os_sched.h b/externals/ace/os_include/os_sched.h new file mode 100644 index 0000000..f06541b --- /dev/null +++ b/externals/ace/os_include/os_sched.h @@ -0,0 +1,56 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_sched.h + * + * execution scheduling (REALTIME) + * + * $Id: os_sched.h 85102 2009-04-17 14:04:36Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_SCHED_H +#define ACE_OS_INCLUDE_OS_SCHED_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_time.h" + +#if !defined (ACE_LACKS_SCHED_H) +# include /**/ +#endif /* !ACE_LACKS_SCHED_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if !defined (__cpu_set_t_defined) || !defined (ACE_HAS_CPU_SET_T) +#if defined (ACE_HAS_CPUSET_T) + typedef cpuset_t cpu_set_t; +#else +# define ACE_CPU_SETSIZE 1024 + typedef struct + { + ACE_UINT32 bit_array_[ACE_CPU_SETSIZE / (8 * sizeof (ACE_UINT32))]; + } cpu_set_t; +#endif +#endif /* !ACE_HAS_CPU_SET_T || !__cpu_set_t_defined */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_SCHED_H */ diff --git a/externals/ace/os_include/os_search.h b/externals/ace/os_include/os_search.h new file mode 100644 index 0000000..605fd36 --- /dev/null +++ b/externals/ace/os_include/os_search.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_search.h + * + * search tables + * + * $Id: os_search.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_SEARCH_H +#define ACE_OS_INCLUDE_OS_SEARCH_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_SEARCH_H) +# include /**/ +#endif /* !ACE_LACKS_SEARCH_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_SEARCH_H */ diff --git a/externals/ace/os_include/os_semaphore.h b/externals/ace/os_include/os_semaphore.h new file mode 100644 index 0000000..7fad7da --- /dev/null +++ b/externals/ace/os_include/os_semaphore.h @@ -0,0 +1,77 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_semaphore.h + * + * semaphores (REALTIME) + * + * $Id: os_semaphore.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_SEMAPHORE_H +#define ACE_OS_INCLUDE_OS_SEMAPHORE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_time.h" + +#if !defined (ACE_LACKS_SEMAPHORE_H) +# include /**/ +#endif /* !ACE_LACKS_SEMAPHORE_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_HAS_POSIX_SEM) +# if !defined (SEM_FAILED) && !defined (ACE_LACKS_NAMED_POSIX_SEM) +# define SEM_FAILED ((sem_t *) -1) +# endif /* !SEM_FAILED */ + + typedef struct + { + /// Pointer to semaphore handle. This is allocated by ACE if we are + /// working with an unnamed POSIX semaphore or by the OS if we are + /// working with a named POSIX semaphore. + sem_t *sema_; + + /// Name of the semaphore (if this is non-NULL then this is a named + /// POSIX semaphore, else its an unnamed POSIX semaphore). + char *name_; + +# if defined (ACE_LACKS_NAMED_POSIX_SEM) + /// this->sema_ doesn't always get created dynamically if a platform + /// doesn't support named posix semaphores. We use this flag to + /// remember if we need to delete or not. + bool new_sema_; +# endif /* ACE_LACKS_NAMED_POSIX_SEM */ + +# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && !defined (ACE_DISABLE_POSIX_SEM_TIMEOUT_EMULATION) + /// Serialize access to internal state. + ACE_mutex_t lock_; + + /// Block until there are no waiters. + ACE_cond_t count_nonzero_; +# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && !ACE_DISABLE_POSIX_SEM_TIMEOUT_EMULATION */ + } ACE_sema_t; +#endif /* ACE_HAS_POSIX_SEM */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_SEMAPHORE_H */ diff --git a/externals/ace/os_include/os_setjmp.h b/externals/ace/os_include/os_setjmp.h new file mode 100644 index 0000000..2ab4a18 --- /dev/null +++ b/externals/ace/os_include/os_setjmp.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_setjmp.h + * + * stack environment declarations + * + * $Id: os_setjmp.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_SETJMP_H +#define ACE_OS_INCLUDE_OS_SETJMP_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_SETJMP_H) +# include /**/ +#endif /* !ACE_LACKS_SETJMP_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_SETJMP_H */ diff --git a/externals/ace/os_include/os_signal.h b/externals/ace/os_include/os_signal.h new file mode 100644 index 0000000..dbda2a6 --- /dev/null +++ b/externals/ace/os_include/os_signal.h @@ -0,0 +1,249 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_signal.h + * + * signals + * + * $Id: os_signal.h 87480 2009-11-11 11:38:15Z olli $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_SIGNAL_H +#define ACE_OS_INCLUDE_OS_SIGNAL_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_SIGNAL_H) + extern "C" { +# include /**/ + } +#endif /* !ACE_LACKS_SIGNAL_H */ + +// This must come after signal.h is #included. +#if defined (SCO) +# define SIGIO SIGPOLL +# include /**/ +#endif /* SCO */ + +#if defined (ACE_HAS_SIGINFO_T) +# if !defined (ACE_LACKS_SIGINFO_H) +# if defined (__QNX__) || defined (__OpenBSD__) || defined (__INTERIX) +# include /**/ +# else /* __QNX__ || __OpenBSD__ */ +# include /**/ +# endif /* __QNX__ || __OpenBSD__ */ +# endif /* ACE_LACKS_SIGINFO_H */ +#endif /* ACE_HAS_SIGINFO_T */ + +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) && !defined (__RTP__) +# include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_SIGSET) && !defined (__MINGW32__) + typedef u_int sigset_t; +#endif /* ACE_LACKS_SIGSET && !sigset_t */ + +#if !defined (ACE_HAS_SIG_ATOMIC_T) + typedef int sig_atomic_t; +#endif /* !ACE_HAS_SIG_ATOMIC_T */ + +# if !defined (SA_SIGINFO) +# define SA_SIGINFO 0 +# endif /* SA_SIGINFO */ + +# if !defined (SA_RESTART) +# define SA_RESTART 0 +# endif /* SA_RESTART */ + +#if !defined (SIGHUP) +# define SIGHUP 0 +#endif /* SIGHUP */ + +#if !defined (SIGINT) +# define SIGINT 0 +#endif /* SIGINT */ + +#if !defined (SIGSEGV) +# define SIGSEGV 0 +#endif /* SIGSEGV */ + +#if !defined (SIGIO) +# define SIGIO 0 +#endif /* SIGSEGV */ + +#if !defined (SIGUSR1) +# define SIGUSR1 0 +#endif /* SIGUSR1 */ + +#if !defined (SIGUSR2) +# define SIGUSR2 0 +#endif /* SIGUSR2 */ + +#if !defined (SIGCHLD) +# define SIGCHLD 0 +#endif /* SIGCHLD */ + +#if !defined (SIGCLD) +# define SIGCLD SIGCHLD +#endif /* SIGCLD */ + +#if !defined (SIGQUIT) +# define SIGQUIT 0 +#endif /* SIGQUIT */ + +#if !defined (SIGPIPE) +# define SIGPIPE 0 +#endif /* SIGPIPE */ + +#if !defined (SIGALRM) +# define SIGALRM 0 +#endif /* SIGALRM */ + +#if !defined (SIGABRT) +# define SIGABRT 0 +#endif /* SIGABRT */ + +#if !defined (SIGTERM) +# define SIGTERM 0 +#endif /* SIGTERM */ + +#if !defined (SIG_DFL) +# define SIG_DFL ((__sighandler_t) 0) +#endif /* SIG_DFL */ + +#if !defined (SIG_IGN) +# define SIG_IGN ((__sighandler_t) 1) /* ignore signal */ +#endif /* SIG_IGN */ + +#if !defined (SIG_ERR) +# define SIG_ERR ((__sighandler_t) -1) /* error return from signal */ +#endif /* SIG_ERR */ + +// These are used by the and +// methods. They must be unique and cannot +// conflict with the value of . We make the numbers +// negative here so they won't conflict with other values like SIGIO, +// etc. +# define ACE_SIGIO -1 +# define ACE_SIGURG -2 +# define ACE_CLOEXEC -3 + +#if defined (ACE_VXWORKS) +# define ACE_NSIG (_NSIGS + 1) +#elif defined (__Lynx__) || defined (ACE_HAS_RTEMS) +# define ACE_NSIG (NSIG + 1) +#else + // All other platforms set NSIG to one greater than the + // highest-numbered signal. +# define ACE_NSIG NSIG +#endif /* ACE_VXWORKS */ + +#if defined (ACE_HAS_WINCE) + typedef void (__cdecl * __sighandler_t)(int); +#endif + +#if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES) + // Prototypes for both signal() and struct sigaction are consistent.. + typedef void (*ACE_SignalHandler)(int); + typedef void (*ACE_SignalHandlerV)(int); +#elif defined (ACE_HAS_LYNXOS4_SIGNALS) || defined (ACE_HAS_TANDEM_SIGNALS) + typedef void (*ACE_SignalHandler)(...); + typedef void (*ACE_SignalHandlerV)(...); +#elif defined (ACE_HAS_SVR4_SIGNAL_T) + // SVR4 Signals are inconsistent (e.g., see struct sigaction).. + typedef void (*ACE_SignalHandler)(int); + typedef void (*ACE_SignalHandlerV)(void); +#elif defined (ACE_WIN32) + typedef void (__cdecl *ACE_SignalHandler)(int); + typedef void (__cdecl *ACE_SignalHandlerV)(int); +#elif defined (ACE_HAS_UNIXWARE_SVR4_SIGNAL_T) + typedef void (*ACE_SignalHandler)(int); + typedef void (*ACE_SignalHandlerV)(...); +#elif defined (INTEGRITY) + typedef void (*ACE_SignalHandler)(); + typedef void (*ACE_SignalHandlerV)(int); +#elif defined (ACE_HAS_RTEMS) + typedef void (*ACE_SignalHandler)(); + typedef void (*ACE_SignalHandlerV)(); +#else /* This is necessary for some older broken version of cfront */ +# if defined (SIG_PF) +# define ACE_SignalHandler SIG_PF +# else + typedef void (*ACE_SignalHandler)(int); +# endif /* SIG_PF */ + typedef void (*ACE_SignalHandlerV)(...); +#endif /* ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES */ + +#if defined (ACE_LACKS_SIGACTION) + struct sigaction + { + int sa_flags; + ACE_SignalHandlerV sa_handler; + sigset_t sa_mask; + }; +#endif /* ACE_LACKS_SIGACTION */ + +// Defining POSIX4 real-time signal range. +#if defined(ACE_HAS_POSIX_REALTIME_SIGNALS) +# define ACE_SIGRTMIN SIGRTMIN +# define ACE_SIGRTMAX SIGRTMAX +#else /* !ACE_HAS_POSIX_REALTIME_SIGNALS */ +# ifndef ACE_SIGRTMIN +# define ACE_SIGRTMIN 0 +# endif /* ACE_SIGRTMIN */ +# ifndef ACE_SIGRTMAX +# define ACE_SIGRTMAX 0 +# endif /* ACE_SIGRTMAX */ +#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ + +#if defined (DIGITAL_UNIX) + // sigwait is yet another macro on Digital UNIX 4.0, just causing + // trouble when introducing member functions with the same name. + // Thanks to Thilo Kielmann" for + // this fix. +# if defined (__DECCXX_VER) +# undef sigwait + // cxx on Digital Unix 4.0 needs this declaration. With it, + // <::_Psigwait> works with cxx -pthread. g++ does _not_ need + // it. + int _Psigwait __((const sigset_t *set, int *sig)); +# endif /* __DECCXX_VER */ +#elif !defined (ACE_HAS_SIGWAIT) +# if defined(ACE_HAS_RTEMS) + int sigwait (const sigset_t *set, int *sig); +# else + int sigwait (sigset_t *set); +# endif /* ACE_HAS_RTEMS */ +#endif /* ! DIGITAL_UNIX && ! ACE_HAS_SIGWAIT */ + +#if !defined (ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE) + int pthread_sigmask(int, const sigset_t *, sigset_t *); +#endif /*!ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include "ace/os_include/os_ucontext.h" + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_SIGNAL_H */ diff --git a/externals/ace/os_include/os_spawn.h b/externals/ace/os_include/os_spawn.h new file mode 100644 index 0000000..0f82564 --- /dev/null +++ b/externals/ace/os_include/os_spawn.h @@ -0,0 +1,46 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_spawn.h + * + * spawn (ADVANCED REALTIME) + * + * $Id: os_spawn.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_SPAWN_H +#define ACE_OS_INCLUDE_OS_SPAWN_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_signal.h" +#include "ace/os_include/sys/os_types.h" +#include "ace/os_include/os_sched.h" + +#if !defined (ACE_LACKS_SPAWN_H) +# include /**/ +#endif /* !ACE_LACKS_SPAWN_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_SPAWN_H */ diff --git a/externals/ace/os_include/os_stdarg.h b/externals/ace/os_include/os_stdarg.h new file mode 100644 index 0000000..0e9d234 --- /dev/null +++ b/externals/ace/os_include/os_stdarg.h @@ -0,0 +1,50 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stdarg.h + * + * handle variable argument list + * + * $Id: os_stdarg.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STDARG_H +#define ACE_OS_INCLUDE_OS_STDARG_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_STDARG_H) +# include /**/ +#endif /* !ACE_LACKS_STDARG_H */ + +#if !defined (va_copy) +#if defined (__va_copy) +#define va_copy(d, s) __va_copy((d),(s)) +#else +#define va_copy(d, s) memcpy((void *)&(d),(void *)&(s),sizeof(va_list)) +#endif +#endif + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STDARG_H */ diff --git a/externals/ace/os_include/os_stdbool.h b/externals/ace/os_include/os_stdbool.h new file mode 100644 index 0000000..ddb3f8e --- /dev/null +++ b/externals/ace/os_include/os_stdbool.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stdbool.h + * + * boolean type and values + * + * $Id: os_stdbool.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STDBOOL_H +#define ACE_OS_INCLUDE_OS_STDBOOL_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_STDBOOL_H) +# include /**/ +#endif /* !ACE_LACKS_STDBOOL_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STDBOOL_H */ diff --git a/externals/ace/os_include/os_stddef.h b/externals/ace/os_include/os_stddef.h new file mode 100644 index 0000000..55ec501 --- /dev/null +++ b/externals/ace/os_include/os_stddef.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stddef.h + * + * standard type definitions + * + * $Id: os_stddef.h 89759 2010-04-06 06:07:24Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +// From http://www.UNIX-systems.org/single_unix_specification/ + +#ifndef ACE_OS_INCLUDE_OS_STDDEF_H +#define ACE_OS_INCLUDE_OS_STDDEF_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_STDDEF_H) +# include /**/ +#endif /* !ACE_LACKS_STDDEF_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +// Signed integer type of the result of subtracting two pointers. +#if defined (ACE_LACKS_PTRDIFF_T) +# if !defined (ACE_PTRDIFF_T_TYPE) +# define ACE_PTRDIFF_T_TYPE unsigned long +# endif /* !ACE_PTRDIFF_T_TYPE */ + typedef ACE_PTRDIFF_T_TYPE ptrdiff_t; +#endif /* ACE_LACKS_PTRDIFF_T */ + +/* + Integer type whose range of values can represent distinct wide-character + codes for all members of the largest character set specified among the + locales supported by the compilation environment: the null character has + the code value 0 and each member of the portable character set has a code + value equal to its value when used as the lone character in an integer + character constant. +*/ +#if defined (ACE_LACKS_WCHAR_T) +# if !defined (ACE_WCHAR_T_TYPE) +# define ACE_WCHAR_T_TYPE long +# endif /* !ACE_WCHAR_T_TYPE */ + typedef ACE_WCHAR_T_TYPE wchar_t; +#endif /* ACE_LACKS_WCHAR_T */ + +// Unsigned integer type of the result of the sizeof operator. +#if defined (ACE_LACKS_SIZE_T) +# if !defined (ACE_SIZE_T_TYPE) +# define ACE_SIZE_T_TYPE unsigned int +# endif /* !ACE_SIZE_T_TYPE */ + typedef ACE_SIZE_T_TYPE size_t; +#endif /* ACE_LACKS_SIZE_T */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STDDEF_H */ diff --git a/externals/ace/os_include/os_stdint.h b/externals/ace/os_include/os_stdint.h new file mode 100644 index 0000000..ac6fec6 --- /dev/null +++ b/externals/ace/os_include/os_stdint.h @@ -0,0 +1,141 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stdint.h + * + * integer types + * + * $Id: os_stdint.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STDINT_H +#define ACE_OS_INCLUDE_OS_STDINT_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_STDINT_H) +# include /**/ +#endif /* !ACE_LACKS_STDINT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +// BSD style types +#if defined (ACE_LACKS_SYS_TYPES_H) \ + || (defined (__GLIBC__) && !defined (_BSD_SOURCE)) + typedef unsigned char u_char; + typedef unsigned short u_short; + typedef unsigned int u_int; + typedef unsigned long u_long; + + typedef unsigned char uchar_t; + typedef unsigned short ushort_t; + typedef unsigned int uint_t; + typedef unsigned long ulong_t; +#endif /* ACE_LACKS_SYS_TYPES_H */ + +/* Define required types if missing */ + +#if defined (ACE_LACKS_INT8_T) +# if !defined (ACE_INT8_T_TYPE) +# define ACE_INT8_T_TYPE char +# endif /* !ACE_INT8_T_TYPE */ + typedef ACE_INT8_T_TYPE int8_t; +#endif /* ACE_LACKS_INT8_T */ + +#if defined (ACE_LACKS_UINT8_T) +# if !defined (ACE_UINT8_T_TYPE) +# define ACE_UINT8_T_TYPE unsigned char +# endif /* !ACE_UINT8_T_TYPE */ + typedef ACE_UINT8_T_TYPE int8_t; +#endif /* ACE_LACKS_UINT8_T */ + +#if defined (ACE_LACKS_INT16_T) +# if !defined (ACE_INT16_T_TYPE) +# define ACE_INT16_T_TYPE short +# endif /* !ACE_INT16_T_TYPE */ + typedef ACE_INT16_T_TYPE int16_t; +#endif /* ACE_LACKS_INT16_T */ + +#if defined (ACE_LACKS_UINT16_T) +# if !defined (ACE_UINT16_T_TYPE) +# define ACE_UINT16_T_TYPE unsigned short +# endif /* !ACE_UINT16_T_TYPE */ + typedef ACE_UINT16_T_TYPE int16_t; +#endif /* ACE_LACKS_UINT16_T */ + +#if defined (ACE_LACKS_INT32_T) +# if !defined (ACE_INT32_T_TYPE) +# define ACE_INT32_T_TYPE long +# endif /* !ACE_INT32_T_TYPE */ + typedef ACE_INT32_T_TYPE int32_t; +#endif /* ACE_LACKS_INT32_T */ + +#if defined (ACE_LACKS_UINT32_T) +# if !defined (ACE_UINT32_T_TYPE) +# define ACE_UINT32_T_TYPE unsigned long +# endif /* !ACE_UINT32_T_TYPE */ + typedef ACE_UINT32_T_TYPE int32_t; +#endif /* ACE_LACKS_UIN32_T */ + +// @todo pull in ACE class here +// 64 bit will be a problem, but stub it out for now +/* +If an implementation provides integer types with width 64 that meet +these requirements, then the following types are required: int64_t uint64_t + +In particular, this will be the case if any of the following are true: + +The implementation supports the _POSIX_V6_ILP32_OFFBIG programming +environment and the application is being built in the +_POSIX_V6_ILP32_OFFBIG programming environment (see the Shell and +Utilities volume of IEEE Std 1003.1-2001, c99, Programming Environments). + +The implementation supports the _POSIX_V6_LP64_OFF64 programming +environment and the application is being built in the +_POSIX_V6_LP64_OFF64 programming environment. + +The implementation supports the _POSIX_V6_LPBIG_OFFBIG programming +environment and the application is being built in the +_POSIX_V6_LPBIG_OFFBIG programming environment. +*/ +#if defined (ACE_LACKS_INT64_T) +# if !defined (ACE_INT64_T_TYPE) +# define ACE_INT64_T_TYPE long +# endif /* !ACE_INT64_T_TYPE */ + typedef ACE_INT64_T_TYPE int64_t; +#endif /* ACE_LACKS_INT64_T */ + +#if defined (ACE_LACKS_UINT64_T) +# if !defined (ACE_UINT64_T_TYPE) +# define ACE_UINT64_T_TYPE unsigned long +# endif /* !ACE_UINT64_T_TYPE */ + typedef ACE_UINT64_T_TYPE int64_t; +#endif /* ACE_LACKS_UIN64_T */ + +// @todo move the ACE_INT## typedefs here so that ACE_INT64 will +// always be available. + + +// @todo perhaps add macros + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STDINT_H */ diff --git a/externals/ace/os_include/os_stdio.h b/externals/ace/os_include/os_stdio.h new file mode 100644 index 0000000..e9f4520 --- /dev/null +++ b/externals/ace/os_include/os_stdio.h @@ -0,0 +1,87 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stdio.h + * + * standard buffered input/output + * + * $Id: os_stdio.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STDIO_H +#define ACE_OS_INCLUDE_OS_STDIO_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// NOTE: stdarg.h must be #included before stdio.h on LynxOS. +#include "ace/os_include/os_stdarg.h" +#include "ace/os_include/os_stddef.h" + +#if !defined (ACE_LACKS_STDIO_H) +# include /**/ +#endif /* !ACE_LACKS_STDIO_H */ + +#if defined (ACE_VXWORKS) +// for remove(), rename() +# include /**/ +// for remCurIdGet() +# include /**/ +# if defined (__RTP__) && ((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x650)) +# define L_cuserid _PARM_L_cuserid +# endif +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +# if defined (INTEGRITY) +# define ACE_MAX_USERID 32 +# elif defined (ACE_WIN32) +# define ACE_MAX_USERID 32 +# else +# if defined (_POSIX_SOURCE) && defined (L_cuserid) +# define ACE_MAX_USERID L_cuserid +# else +# define ACE_MAX_USERID 9 +# endif +# endif /* INTEGRITY */ + +#if defined (BUFSIZ) +# define ACE_STREAMBUF_SIZE BUFSIZ +#else +# define ACE_STREAMBUF_SIZE 1024 +#endif /* BUFSIZ */ + +#if defined (ACE_WIN32) + typedef OVERLAPPED ACE_OVERLAPPED; +#else + struct ACE_OVERLAPPED + { + unsigned long Internal; + unsigned long InternalHigh; + unsigned long Offset; + unsigned long OffsetHigh; + ACE_HANDLE hEvent; + }; +#endif /* ACE_WIN32 */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STDIO_H */ diff --git a/externals/ace/os_include/os_stdlib.h b/externals/ace/os_include/os_stdlib.h new file mode 100644 index 0000000..6a675d5 --- /dev/null +++ b/externals/ace/os_include/os_stdlib.h @@ -0,0 +1,85 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stdlib.h + * + * standard library definitions + * + * $Id: os_stdlib.h 83948 2008-12-02 13:55:34Z jtc $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STDLIB_H +#define ACE_OS_INCLUDE_OS_STDLIB_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stddef.h" +#include "ace/os_include/sys/os_wait.h" + +#if defined (ACE_HAS_ALLOCA_H) +# include /**/ +#endif /* ACE_HAS_ALLOCA_H */ + +#if !defined (ACE_LACKS_STDLIB_H) +# include /**/ +#endif /* !ACE_LACKS_STDLIB_H */ + +#if defined (ACE_VXWORKS) && !defined (__RTP__) +# include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + typedef u_int ACE_RANDR_TYPE; +#if defined (ACE_HAS_BROKEN_RANDR) + // The SunOS 5.4.X version of rand_r is inconsistent with the header + // files... + int rand_r (ACE_RANDR_TYPE seed); +#else +#endif /* ACE_HAS_BROKEN_RANDR */ + +#if defined (DIGITAL_UNIX) + extern int _Prand_r (unsigned int *seedptr); +#endif /* DIGITAL_UNIX */ + +#if defined (ACE_LACKS_PUTENV_PROTOTYPE) + int putenv (char *); +#endif /* ACE_LACKS_PUTENV_PROTOTYPE */ + +#if defined (ACE_LACKS_MKTEMP_PROTOTYPE) + char *mktemp (char *); +#endif /* ACE_LACKS_MKTEMP_PROTOTYPE */ + +#if defined (ACE_LACKS_MKSTEMP_PROTOTYPE) + int mkstemp (char *); +#endif /* ACE_LACKS_MKSTEMP_PROTOTYPE */ + +#if defined (ACE_LACKS_STRTOLL_PROTOTYPE) + long long strtoll (const char *, char **, int); +#endif /* ACE_LACKS_STRTOLL_PROTOTYPE */ + +#if defined (ACE_LACKS_STRTOULL_PROTOTYPE) + unsigned long long strtoull (const char *, char **, int); +#endif /* ACE_LACKS_STRTOULL_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STDLIB_H */ diff --git a/externals/ace/os_include/os_string.h b/externals/ace/os_include/os_string.h new file mode 100644 index 0000000..0aa2f7d --- /dev/null +++ b/externals/ace/os_include/os_string.h @@ -0,0 +1,53 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_string.h + * + * string operations + * + * $Id: os_string.h 87216 2009-10-23 20:26:16Z olli $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STRING_H +#define ACE_OS_INCLUDE_OS_STRING_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stddef.h" + +#if !defined (ACE_LACKS_STRING_H) +# include /**/ +#endif /* !ACE_LACKS_STRING_H */ + + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_STRTOK_R_PROTOTYPE) && !defined (_POSIX_SOURCE) + char *strtok_r (char *s, const char *delim, char **save_ptr); +#endif /* ACE_LACKS_STRTOK_R_PROTOTYPE */ + +#if defined (ACE_LACKS_STRNLEN_PROTOTYPE) + size_t strnlen(const char *s, size_t maxlen); +#endif /* ACE_LACKS_STRNLEN_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STRING_H */ diff --git a/externals/ace/os_include/os_strings.h b/externals/ace/os_include/os_strings.h new file mode 100644 index 0000000..ba258b0 --- /dev/null +++ b/externals/ace/os_include/os_strings.h @@ -0,0 +1,52 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_strings.h + * + * string operations + * + * $Id: os_strings.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STRINGS_H +#define ACE_OS_INCLUDE_OS_STRINGS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stddef.h" + +#if !defined (ACE_LACKS_STRINGS_H) +# include /**/ +#endif /* !ACE_LACKS_STRINGS_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_STRCASECMP_PROTOTYPE) + int strcasecmp(const char *, const char *); +#endif /* ACE_LACKS_STRCASECMP_PROTOTYPE */ + +#if defined (ACE_LACKS_STRNCASECMP_PROTOTYPE) + int strncasecmp(const char *, const char *, size_t); +#endif /* ACE_LACKS_STRNCASECMP_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STRINGS_H */ diff --git a/externals/ace/os_include/os_stropts.h b/externals/ace/os_include/os_stropts.h new file mode 100644 index 0000000..e64717a --- /dev/null +++ b/externals/ace/os_include/os_stropts.h @@ -0,0 +1,114 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stropts.h + * + * STREAMS interface (STREAMS) + * + * $Id: os_stropts.h 84660 2009-03-01 20:22:37Z olli $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_STROPTS_H +#define ACE_OS_INCLUDE_OS_STROPTS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_unistd.h" + +#if defined (ACE_HAS_TIMOD_H) +# include /**/ +#elif defined (ACE_HAS_OSF_TIMOD_H) +# include /**/ +#endif /* ACE_HAS_TIMOD_H */ + +#if !defined (ACE_LACKS_SYS_IOCTL_H) +# include /**/ +#endif /* !ACE_LACKS_IOCTL_H */ + +#if defined (ACE_HAS_SYS_FILIO_H) +# include /**/ +#endif /* ACE_HAS_SYS_FILIO_H */ + +#if defined (ACE_HAS_SYS_SOCKIO_H) +# include /**/ +#endif /* ACE_HAS_SOCKIO_H */ + +// This is sorta counter intuitive, but this is how it was done in OS.h +// @todo: fix this... dhinton +#if defined (ACE_HAS_STREAMS) +# if defined (AIX) +# if !defined (_XOPEN_EXTENDED_SOURCE) +# define _XOPEN_EXTENDED_SOURCE +# endif /* !_XOPEN_EXTENDED_SOURCE */ +# endif /* AIX */ +#endif /* ACE_HAS_STREAMS */ + +#if !defined (ACE_LACKS_STROPTS_H) +# include /**/ +#endif /* !ACE_LACKS_STROPTS_H */ + +// This is sorta counter intuitive, but this is how it was done in OS.h +// @todo: fix this... dhinton +#if defined (ACE_HAS_STREAMS) +# if defined (AIX) +# undef _XOPEN_EXTENDED_SOURCE +# endif /* AIX */ +#endif /* ACE_HAS_STREAMS */ + +#if defined (ACE_VXWORKS) +// for ioctl() +# include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_STRRECVFD) + struct strrecvfd {}; +#endif /* ACE_LACKS_STRRECVFD */ + +# if !defined (SIOCGIFBRDADDR) +# define SIOCGIFBRDADDR 0 +# endif /* SIOCGIFBRDADDR */ + +# if !defined (SIOCGIFADDR) +# define SIOCGIFADDR 0 +# endif /* SIOCGIFADDR */ + +# if !defined (ACE_HAS_STRBUF_T) +struct strbuf +{ + /// No. of bytes in buffer. + int maxlen; + /// No. of bytes returned. + int len; + /// Pointer to data. + void *buf; +}; +# endif /* ACE_HAS_STRBUF_T */ + +// These prototypes are chronically lacking from many versions of UNIX. +#if !defined (ACE_WIN32) && !defined (ACE_HAS_ISASTREAM_PROTOTYPE) + int isastream (int); +#endif /* !ACE_WIN32 && ACE_HAS_ISASTREAM_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_STROPTS_H */ diff --git a/externals/ace/os_include/os_syslog.h b/externals/ace/os_include/os_syslog.h new file mode 100644 index 0000000..d448b74 --- /dev/null +++ b/externals/ace/os_include/os_syslog.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_syslog.h + * + * definitions for system error logging + * + * $Id: os_syslog.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_SYSLOG_H +#define ACE_OS_INCLUDE_OS_SYSLOG_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_SYSLOG_H) +# include /**/ +#endif /* !ACE_LACKS_SYSLOG_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_SYSLOG_H */ diff --git a/externals/ace/os_include/os_tar.h b/externals/ace/os_include/os_tar.h new file mode 100644 index 0000000..0079250 --- /dev/null +++ b/externals/ace/os_include/os_tar.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_tar.h + * + * extended tar definitions + * + * $Id: os_tar.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_TAR_H +#define ACE_OS_INCLUDE_OS_TAR_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_TAR_H) +# include /**/ +#endif /* !ACE_LACKS_TAR_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_TAR_H */ diff --git a/externals/ace/os_include/os_termios.h b/externals/ace/os_include/os_termios.h new file mode 100644 index 0000000..9dfd386 --- /dev/null +++ b/externals/ace/os_include/os_termios.h @@ -0,0 +1,46 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_termios.h + * + * define values for termios + * + * $Id: os_termios.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_TERMIOS_H +#define ACE_OS_INCLUDE_OS_TERMIOS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_TERMIOS_H) +# include /**/ +#endif /* !ACE_LACKS_TERMIOS_H */ + +#if defined (HPUX) +# include /**/ +#endif /* HPUX */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_TERMIOS_H */ diff --git a/externals/ace/os_include/os_tgmath.h b/externals/ace/os_include/os_tgmath.h new file mode 100644 index 0000000..6d9f2c2 --- /dev/null +++ b/externals/ace/os_include/os_tgmath.h @@ -0,0 +1,45 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_tgmath.h + * + * type-generic macros + * + * $Id: os_tgmath.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_TGMATH_H +#define ACE_OS_INCLUDE_OS_TGMATH_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_math.h" +#include "ace/os_include/os_complex.h" + +#if !defined (ACE_LACKS_TGMATH_H) +# include /**/ +#endif /* !ACE_LACKS_TGMATH_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_TGMATH_H */ diff --git a/externals/ace/os_include/os_time.h b/externals/ace/os_include/os_time.h new file mode 100644 index 0000000..e10a3b3 --- /dev/null +++ b/externals/ace/os_include/os_time.h @@ -0,0 +1,119 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_time.h + * + * time types + * + * $Id: os_time.h 87270 2009-10-29 21:47:47Z olli $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_TIME_H +#define ACE_OS_INCLUDE_OS_TIME_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// @todo should we include anything from signal.h? +#include "ace/os_include/sys/os_types.h" + +// To get the proper select() signature, this is required for HP-UX, and +// maybe other platforms that offer both int and fdset forms of select(). +// For HP-UX, sys/time.h must be included before time.h, or +// _XOPEN_SOURCE_EXTENDED must be defined. It's not nice to require +// the preprocessor macro, so we force our select() preference this way. +#if !defined (ACE_LACKS_SYS_TIME_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_TIME_H */ + +#if !defined (ACE_LACKS_TIME_H) +# include /**/ +#endif /* !ACE_LACKS_TIME_H */ + +# if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ + (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) +using std::tm; +# if !defined (ACE_HAS_DINKUM_STL) +# if defined (ACE_WIN32) +using std::_timezone; +# else +using std::timezone; +# endif +# endif +using std::difftime; +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ + +# if !defined (ACE_HAS_POSIX_TIME) +// Definition per POSIX. +typedef struct timespec +{ + /// Seconds + time_t tv_sec; + /// Nanoseconds + long tv_nsec; +} timespec_t; +# elif defined (ACE_HAS_BROKEN_POSIX_TIME) +# if defined (ACE_OPENVMS) +# include /**/ +# else +// OSF/1 defines struct timespec in - Tom Marrs +# include /**/ +# endif +# endif /* !ACE_HAS_POSIX_TIME */ + +# if defined(ACE_LACKS_TIMESPEC_T) +typedef struct timespec timespec_t; +# endif /* ACE_LACKS_TIMESPEC_T */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +// There are a lot of threads-related macro definitions in the config files. +// They came in at different times and from different places and platform +// requirements as threads evolved. They are probably not all needed - some +// overlap or are otherwise confused. This is an attempt to start +// straightening them out. +#if defined (ACE_HAS_PTHREADS) /* POSIX.1c threads (pthreads) */ + // ... and 2-parameter asctime_r and ctime_r +# if !defined (ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R) && \ + !defined (ACE_HAS_STHREADS) && !defined (ACE_VXWORKS) +# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +# endif +#endif /* ACE_HAS_PTHREADS */ + +#if defined (ACE_LACKS_STRPTIME_PROTOTYPE) && !defined (_XOPEN_SOURCE) + extern char *strptime (const char *s, const char *fmt, struct tm *tp); +#endif /* ACE_LACKS_STRPTIME_PROTOTYPE */ + +#if defined (ACE_LACKS_CONST_TIMESPEC_PTR) +typedef struct timespec * ACE_TIMESPEC_PTR; +#else +typedef const struct timespec * ACE_TIMESPEC_PTR; +#endif /* ACE_LACKS_CONST_TIMESPEC_PTR */ + +#if defined (DIGITAL_UNIX) + extern char *_Pctime_r (const time_t *, char *); + extern struct tm *_Plocaltime_r (const time_t *, struct tm *); + extern struct tm *_Pgmtime_r (const time_t *, struct tm *); + extern char *_Pasctime_r (const struct tm *, char *); +#endif /* DIGITAL_UNIX */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_TIME_H */ diff --git a/externals/ace/os_include/os_trace.h b/externals/ace/os_include/os_trace.h new file mode 100644 index 0000000..fd89d54 --- /dev/null +++ b/externals/ace/os_include/os_trace.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_trace.h + * + * tracing + * + * $Id: os_trace.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_TRACE_H +#define ACE_OS_INCLUDE_OS_TRACE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_TRACE_H) +# include /**/ +#endif /* !ACE_LACKS_TRACE_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_TRACE_H */ diff --git a/externals/ace/os_include/os_typeinfo.h b/externals/ace/os_include/os_typeinfo.h new file mode 100644 index 0000000..3ad1b16 --- /dev/null +++ b/externals/ace/os_include/os_typeinfo.h @@ -0,0 +1,39 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_typeinfo.h + * + * definitions for the typeinfo file + * + * $Id: os_typeinfo.h 84160 2009-01-14 14:13:58Z johnnyw $ + * + * @author Don Hinton Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_TYPEINFO_H +#define ACE_OS_INCLUDE_OS_TYPEINFO_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +# include /**/ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_TYPEINFO_H */ diff --git a/externals/ace/os_include/os_ucontext.h b/externals/ace/os_include/os_ucontext.h new file mode 100644 index 0000000..f62be80 --- /dev/null +++ b/externals/ace/os_include/os_ucontext.h @@ -0,0 +1,48 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_ucontext.h + * + * user context + * + * $Id: os_ucontext.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_UCONTEXT_H +#define ACE_OS_INCLUDE_OS_UCONTEXT_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_signal.h" + +#if !defined (ACE_LACKS_UCONTEXT_H) +# include /**/ +#endif /* !ACE_LACKS_ucontext_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +# if !defined (ACE_HAS_UCONTEXT_T) +typedef int ucontext_t; +# endif /* ACE_HAS_UCONTEXT_T */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_UCONTEXT_H */ diff --git a/externals/ace/os_include/os_ulimit.h b/externals/ace/os_include/os_ulimit.h new file mode 100644 index 0000000..8593c0d --- /dev/null +++ b/externals/ace/os_include/os_ulimit.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_ulimit.h + * + * ulimit commands + * + * $Id: os_ulimit.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_ULIMIT_H +#define ACE_OS_INCLUDE_OS_ULIMIT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_ULIMIT_H) +# include /**/ +#endif /* !ACE_LACKS_ULIMIT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_ULIMIT_H */ diff --git a/externals/ace/os_include/os_unistd.h b/externals/ace/os_include/os_unistd.h new file mode 100644 index 0000000..ee685d2 --- /dev/null +++ b/externals/ace/os_include/os_unistd.h @@ -0,0 +1,196 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_unistd.h + * + * standard symbolic constants and types + * + * $Id: os_unistd.h 87125 2009-10-15 17:34:25Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_UNISTD_H +#define ACE_OS_INCLUDE_OS_UNISTD_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" +#include "ace/os_include/os_inttypes.h" + +#if defined (ACE_HAS_PROCESS_H) +# include /**/ +#endif /* ACE_HAS_PROCESS_H */ + +#if defined (ACE_HAS_IO_H) +# include /**/ +#endif /* ACE_HAS_IO_H */ + +#if defined (ACE_HAS_SYS_SYSTEMINFO_H) +# include /**/ +#endif /* ACE_HAS_SYS_SYSTEMINFO_H */ + +#if !defined (ACE_LACKS_UNISTD_H) +# include /**/ +#endif /* !ACE_LACKS_UNISTD_H */ + +#if defined (ACE_VXWORKS) +# if !defined (__RTP__) + // for unlink(), close(), read(), write(), lseek(), chdir(), getcwd(), + // getwd(), and isatty() + # include /**/ +# endif +// for gethostname() +# include /**/ +#endif /* ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_WIN32) +// The following are #defines and #includes that are specific to +// WIN32. +# if defined (ACE_HAS_WINCE) +# define ACE_STDIN _fileno (stdin) +# define ACE_STDOUT _fileno (stdout) +# define ACE_STDERR _fileno (stderr) +# else +# define ACE_STDIN GetStdHandle (STD_INPUT_HANDLE) +# define ACE_STDOUT GetStdHandle (STD_OUTPUT_HANDLE) +# define ACE_STDERR GetStdHandle (STD_ERROR_HANDLE) +# endif // ACE_HAS_WINCE +// The following are #defines and #includes that are specific to UNIX. +#else /* !ACE_WIN32 */ +# if defined (STDIN_FILENO) +# define ACE_STDIN STDIN_FILENO +# else +# define ACE_STDIN 0 +# endif +# if defined (STDOUT_FILENO) +# define ACE_STDOUT STDOUT_FILENO +# else +# define ACE_STDOUT 1 +# endif +# if defined (STDERR_FILENO) +# define ACE_STDERR STDERR_FILENO +# else +# define ACE_STDERR 2 +# endif +#endif /* ACE_WIN32 */ + +#if (!defined (_BSD_SOURCE) && \ + !defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED)) \ + || (defined (_XOPEN_SOURCE) && defined (__GNUC__)) + +# if defined (ACE_LACKS_SETREUID_PROTOTYPE) + extern int setreuid (uid_t ruid, uid_t euid); +# endif /* ACE_LACKS_SETREUID_PROTOTYPE */ + +# if defined (ACE_LACKS_SETREGID_PROTOTYPE) + extern int setregid (gid_t rgid, gid_t egid); +# endif /* ACE_LACKS_SETREGID_PROTOTYPE */ +#endif /* !_BSD_SOURCE && !_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED + || _XOPEN_SOURCE && __GNUC__ */ + + // for use by access() +# if !defined (R_OK) +# define R_OK 04 /* Test for Read permission. */ +# endif /* R_OK */ + +# if !defined (W_OK) +# define W_OK 02 /* Test for Write permission. */ +# endif /* W_OK */ + +# if !defined (X_OK) +# if defined (ACE_WIN32) + /* Windows has no test for X_OK - use R_OK instead */ +# define X_OK R_OK /* Test for eXecute permission. */ +# else /* ACE_WIN32 */ +# define X_OK 01 /* Test for eXecute permission. */ +# endif /* ACE_WIN32 */ +# endif /* X_OK */ + +# if !defined (F_OK) +# define F_OK 0 /* Test for existence of File. */ +# endif /* F_OK */ + +#if defined (ACE_LACKS_UALARM_PROTOTYPE) + u_int ualarm (u_int usecs, u_int interval); +#endif /* ACE_LACKS_UALARM_PROTOTYPE */ + +#if defined (ACE_LACKS_PREAD_PROTOTYPE) && (_XOPEN_SOURCE - 0) < 500 + // _XOPEN_SOURCE == 500 Single Unix conformance + // It seems that _XOPEN_SOURCE == 500 means that the prototypes are + // already defined in the system headers. + ssize_t pread (int fd, + void *buf, + size_t nbytes, + ACE_OFF_T offset); + + ssize_t pwrite (int fd, + const void *buf, + size_t n, + ACE_OFF_T offset); +#endif /* ACE_LACKS_PREAD_PROTOTYPE && (_XOPEN_SOURCE - 0) < 500 */ + +#if defined (ACE_LACKS_GETPGID_PROTOTYPE) && \ + !defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED) + pid_t getpgid (pid_t pid); +#endif /* ACE_LACKS_GETPGID_PROTOTYPE && + !_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED */ + +#if !defined (_LARGEFILE64_SOURCE) +# if defined (ACE_LACKS_LSEEK64_PROTOTYPE) && \ + defined (ACE_LACKS_LLSEEK_PROTOTYPE) +# error Define either ACE_LACKS_LSEEK64_PROTOTYPE or ACE_LACKS_LLSEEK_PROTOTYPE, not both! +# elif defined (ACE_LACKS_LSEEK64_PROTOTYPE) + ACE_LOFF_T lseek64 (int fd, ACE_LOFF_T offset, int whence); +# elif defined (ACE_LACKS_LLSEEK_PROTOTYPE) + ACE_LOFF_T llseek (int fd, ACE_LOFF_T offset, int whence); +# endif +#endif /* _LARGEFILE64_SOURCE */ + +#if defined (__BORLANDC__) +# define _isatty isatty +#endif /* __BORLANDC__ */ + +# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES) + + ssize_t read_timedwait (ACE_HANDLE handle, + char *buf, + size_t n, + struct timespec *timeout); + + ssize_t write_timedwait (ACE_HANDLE handle, + const void *buf, + size_t n, + struct timespec *timeout); + +# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */ + +#if defined (ACE_LACKS_SWAB_PROTOTYPE) + void swab(const void *, void *, ssize_t); +#endif /* ACE_LACKS_SWAB_PROTOTYPE */ + +#if defined (ACE_LACKS_GETOPT_PROTOTYPE) + int getopt(int, char * const [], const char *); +#endif /* ACE_LACKS_GETOPT_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_UNISTD_H */ diff --git a/externals/ace/os_include/os_utime.h b/externals/ace/os_include/os_utime.h new file mode 100644 index 0000000..703da8b --- /dev/null +++ b/externals/ace/os_include/os_utime.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_utime.h + * + * access and modification times structure + * + * $Id: os_utime.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_UTIME_H +#define ACE_OS_INCLUDE_OS_UTIME_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_UTIME_H) +# include /**/ +#endif /* !ACE_LACKS_UTIME_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_UTIME_H */ diff --git a/externals/ace/os_include/os_utmpx.h b/externals/ace/os_include/os_utmpx.h new file mode 100644 index 0000000..74ef305 --- /dev/null +++ b/externals/ace/os_include/os_utmpx.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_utmpx.h + * + * user accounting database definitions + * + * $Id: os_utmpx.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_UTMPX_H +#define ACE_OS_INCLUDE_OS_UTMPX_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_time.h" + +#if !defined (ACE_LACKS_UTMPX_H) +# include /**/ +#endif /* !ACE_LACKS_UTMPX_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_UTMPX_H */ diff --git a/externals/ace/os_include/os_wchar.h b/externals/ace/os_include/os_wchar.h new file mode 100644 index 0000000..37eab2e --- /dev/null +++ b/externals/ace/os_include/os_wchar.h @@ -0,0 +1,57 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_wchar.h + * + * wide-character handling + * + * $Id: os_wchar.h 83948 2008-12-02 13:55:34Z jtc $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_WCHAR_H +#define ACE_OS_INCLUDE_OS_WCHAR_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// ctype.h, string.h, stdarg.h, stdio.h, stdlib.h, time.h +#include "ace/os_include/os_stdio.h" +#include "ace/os_include/os_stdlib.h" +#include "ace/os_include/os_time.h" +#include "ace/os_include/os_string.h" +#include "ace/os_include/os_ctype.h" + +#if !defined (ACE_LACKS_WCHAR_H) +# include /**/ +#endif /* !ACE_LACKS_WCHAR_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_WCSTOLL_PROTOTYPE) + long long wcstoll (const wchar_t *, wchar_t **, int); +#endif /* ACE_LACKS_WCSTOLL_PROTOTYPE */ + +#if defined (ACE_LACKS_WCSTOULL_PROTOTYPE) + unsigned long long wcstoull (const wchar_t *, wchar_t **, int); +#endif /* ACE_LACKS_WCSTOULL_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_WCHAR_H */ diff --git a/externals/ace/os_include/os_wctype.h b/externals/ace/os_include/os_wctype.h new file mode 100644 index 0000000..15aa295 --- /dev/null +++ b/externals/ace/os_include/os_wctype.h @@ -0,0 +1,45 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_wctype.h + * + * wide-character classification and mapping utilities + * + * $Id: os_wctype.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_WCTYPE_H +#define ACE_OS_INCLUDE_OS_WCTYPE_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// ctype.h, string.h, stdarg.h, stdio.h, stdlib.h, time.h +#include "ace/os_include/os_wchar.h" + +#if !defined (ACE_LACKS_WCTYPE_H) +# include /**/ +#endif /* !ACE_LACKS_WCTYPE_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_WCTYPE_H */ diff --git a/externals/ace/os_include/os_wordexp.h b/externals/ace/os_include/os_wordexp.h new file mode 100644 index 0000000..7696007 --- /dev/null +++ b/externals/ace/os_include/os_wordexp.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_wordexp.h + * + * word-expansion types + * + * $Id: os_wordexp.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_WORDEXP_H +#define ACE_OS_INCLUDE_OS_WORDEXP_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stddef.h" // size_t + +#if !defined (ACE_LACKS_WORDEXP_H) +# include /**/ +#endif /* !ACE_LACKS_WORDEXP_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_WORDEXP_H */ diff --git a/externals/ace/os_include/sys/os_ipc.h b/externals/ace/os_include/sys/os_ipc.h new file mode 100644 index 0000000..bea65e5 --- /dev/null +++ b/externals/ace/os_include/sys/os_ipc.h @@ -0,0 +1,74 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_ipc.h + * + * XSI interprocess communication access structure + * + * $Id: os_ipc.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_IPC_H +#define ACE_OS_INCLUDE_SYS_OS_IPC_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_SYS_IPC_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_IPC_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_WIN32) +# define ACE_INVALID_SEM_KEY 0 +#else /* !ACE_WIN32 */ +# define ACE_INVALID_SEM_KEY -1 +#endif /* ACE_WIN32 */ + +#if !defined (IPC_PRIVATE) +# define IPC_PRIVATE ACE_INVALID_SEM_KEY +#endif /* IPC_PRIVATE */ + +#if !defined (IPC_STAT) +# define IPC_STAT 0 +#endif /* IPC_STAT */ + +#if !defined (IPC_CREAT) +# define IPC_CREAT 0 +#endif /* IPC_CREAT */ + +#if !defined (IPC_NOWAIT) +# define IPC_NOWAIT 0 +#endif /* IPC_NOWAIT */ + +#if !defined (IPC_RMID) +# define IPC_RMID 0 +#endif /* IPC_RMID */ + +#if !defined (IPC_EXCL) +# define IPC_EXCL 0 +#endif /* IPC_EXCL */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_IPC_H */ diff --git a/externals/ace/os_include/sys/os_loadavg.h b/externals/ace/os_include/sys/os_loadavg.h new file mode 100644 index 0000000..6eeeb69 --- /dev/null +++ b/externals/ace/os_include/sys/os_loadavg.h @@ -0,0 +1,41 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_loadavg.h + * + * loadavg functions + * + * $Id: os_loadavg.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_LOADAVG_H +#define ACE_OS_INCLUDE_SYS_OS_LOADAVG_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_SYS_LOADAVG_H) +# include /**/ +#endif /* ACE_HAS_SYS_LOADAVG_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_LOADAVG_H */ diff --git a/externals/ace/os_include/sys/os_mman.h b/externals/ace/os_include/sys/os_mman.h new file mode 100644 index 0000000..b39fc48 --- /dev/null +++ b/externals/ace/os_include/sys/os_mman.h @@ -0,0 +1,122 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_mman.h + * + * memory management declarations + * + * $Id: os_mman.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_MMAN_H +#define ACE_OS_INCLUDE_SYS_OS_MMAN_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if defined (ACE_LACKS_MMAP) +# define ACE_LACKS_SYS_MMAN_H +#endif /* ACE_LACKS_MMAP */ + +#if !defined (ACE_LACKS_SYS_MMAN_H) + // Fixes a problem with HP/UX. +# if defined (ACE_HAS_BROKEN_MMAP_H) + extern "C" { +# endif /* ACE_HAS_BROKEN_MMAP_H */ +# include /**/ +# if defined (ACE_HAS_BROKEN_MMAP_H) + } +# endif /* ACE_HAS_BROKEN_MMAP_H */ +#endif /* ACE_LACKS_SYS_MMAN_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_SYS_MMAN_H) && !defined (ACE_WIN32) +# define PROT_READ 0 +# define PROT_WRITE 0 +# define PROT_EXEC 0 +# define PROT_NONE 0 +# define PROT_RDWR 0 +# define MAP_PRIVATE 0 +# define MAP_SHARED 0 +# define MAP_FIXED 0 +#elif defined (ACE_WIN32) + // These two may be used for internal flags soon: +# define MAP_PRIVATE 1 +# define MAP_SHARED 2 +# define MAP_FIXED 4 + // MMAP flags +# define PROT_READ PAGE_READONLY +# define PROT_WRITE PAGE_READWRITE +# define PROT_RDWR PAGE_READWRITE +/* If we can find suitable use for these flags, here they are: +PAGE_WRITECOPY +PAGE_EXECUTE +PAGE_EXECUTE_READ +PAGE_EXECUTE_READWRITE +PAGE_EXECUTE_WRITECOPY +PAGE_GUARD +PAGE_NOACCESS +PAGE_NOCACHE */ +#endif /* !ACE_LACKS_SYS_MMAN_H && !ACE_WIN32*/ + +# if !defined (ACE_MAP_PRIVATE) +# define ACE_MAP_PRIVATE MAP_PRIVATE +# endif /* ! ACE_MAP_PRIVATE */ + +# if !defined (ACE_MAP_SHARED) +# define ACE_MAP_SHARED MAP_SHARED +# endif /* ! ACE_MAP_SHARED */ + +# if !defined (ACE_MAP_FIXED) +# define ACE_MAP_FIXED MAP_FIXED +# endif /* ! ACE_MAP_FIXED */ + +# if !defined (MAP_FAILED) || defined (ACE_HAS_BROKEN_MAP_FAILED) +# undef MAP_FAILED +# define MAP_FAILED ((void *) -1) +# elif defined (ACE_HAS_LONG_MAP_FAILED) +# undef MAP_FAILED +# define MAP_FAILED ((void *) -1L) +# endif /* !MAP_FAILED || ACE_HAS_BROKEN_MAP_FAILED */ + +#if !defined (PROT_RDWR) +# define PROT_RDWR (PROT_READ|PROT_WRITE) +#endif /* PROT_RDWR */ + +# if defined (ACE_WIN32) + // Needed to map calls to NT transparently. +# define MS_ASYNC 0 +# define MS_INVALIDATE 0 +# endif /* ACE_WIN32 */ + +# if !defined (MS_SYNC) +# define MS_SYNC 0x0 +# endif /* !MS_SYNC */ + +#if !defined (ACE_LACKS_MADVISE) && defined (ACE_LACKS_MADVISE_PROTOTYPE) + extern "C" int madvise(caddr_t, size_t, int); +#endif /* !ACE_LACKS_MADVISE && ACE_LACKS_MADVISE_PROTOTYPE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_MMAN_H */ diff --git a/externals/ace/os_include/sys/os_msg.h b/externals/ace/os_include/sys/os_msg.h new file mode 100644 index 0000000..fa7edad --- /dev/null +++ b/externals/ace/os_include/sys/os_msg.h @@ -0,0 +1,55 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_msg.h + * + * XSI message queue structures + * + * $Id: os_msg.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_MSG_H +#define ACE_OS_INCLUDE_SYS_OS_MSG_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_ipc.h" + +#if !defined (ACE_LACKS_SYS_MSG_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_MSG_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + // Declare opaque type. Needed for ACE_OS wrappers on systems + // without SysV IPC. + struct msqid_ds; + +#if defined (ACE_LACKS_SYSV_MSQ_PROTOS) + int msgget (key_t, int); + int msgrcv (int, void *, size_t, long, int); + int msgsnd (int, const void *, size_t, int); + int msgctl (int, int, struct msqid_ds *); +#endif /* ACE_LACKS_SYSV_MSQ_PROTOS */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_MSG_H */ diff --git a/externals/ace/os_include/sys/os_pstat.h b/externals/ace/os_include/sys/os_pstat.h new file mode 100644 index 0000000..dcb3467 --- /dev/null +++ b/externals/ace/os_include/sys/os_pstat.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_pstat.h + * + * pstat functions + * + * $Id: os_pstat.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_PSTAT_H +#define ACE_OS_INCLUDE_SYS_OS_PSTAT_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_SYS_PSTAT_H) +# include /**/ +# include /**/ +#endif /* ACE_HAS_SYS_PSTAT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_PSTAT_H */ diff --git a/externals/ace/os_include/sys/os_resource.h b/externals/ace/os_include/sys/os_resource.h new file mode 100644 index 0000000..23486b6 --- /dev/null +++ b/externals/ace/os_include/sys/os_resource.h @@ -0,0 +1,104 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_resource.h + * + * definitions for XSI resource operations + * + * $Id: os_resource.h 81697 2008-05-14 18:33:11Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_RESOURCE_H +#define ACE_OS_INCLUDE_SYS_OS_RESOURCE_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_time.h" +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_SYS_RESOURCE_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_RESOURCE_H */ + +#if defined (ACE_HAS_SYS_SYSTEMINFO_H) +# include /**/ +#endif /* ACE_HAS_SYS_SYSTEMINFO_H */ + +#if defined (ACE_HAS_SYS_SYSCALL_H) +# include /**/ +#endif /* ACE_HAS_SYS_SYSCALL_H */ + +// prusage_t is defined in +#if defined (ACE_HAS_PROC_FS) +# include /**/ +#endif /* ACE_HAS_PROC_FS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +// There must be a better way to do this... +#if !defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT_NOFILE) +# if defined (linux) || defined (AIX) || defined (SCO) +# if defined (RLIMIT_OFILE) +# define RLIMIT_NOFILE RLIMIT_OFILE +# else +# define RLIMIT_NOFILE 200 +# endif /* RLIMIT_OFILE */ +# endif /* defined (linux) || defined (AIX) || defined (SCO) */ +#endif /* RLIMIT_NOFILE */ + +#if defined (ACE_WIN32) +# define RUSAGE_SELF 1 + /// Fake the UNIX rusage structure. Perhaps we can add more to this + /// later on? + struct rusage + { + FILETIME ru_utime; + FILETIME ru_stime; + }; +#endif /* ACE_WIN32 */ + +#if defined (ACE_LACKS_RLIMIT_PROTOTYPE) + int getrlimit (int resource, struct rlimit *rlp); + int setrlimit (int resource, const struct rlimit *rlp); +#endif /* ACE_LACKS_RLIMIT_PROTOTYPE */ + +#if defined (ACE_HAS_PRUSAGE_T) + typedef prusage_t ACE_Rusage; +#elif defined (ACE_HAS_GETRUSAGE) + typedef rusage ACE_Rusage; +#else + typedef int ACE_Rusage; +#endif /* ACE_HAS_PRUSAGE_T */ + +#if !defined (ACE_WIN32) +// These prototypes are chronically lacking from many versions of UNIX. +# if !defined (ACE_HAS_GETRUSAGE_PROTOTYPE) + int getrusage (int who, struct rusage *rusage); +# endif /* ! ACE_HAS_GETRUSAGE_PROTOTYPE */ + +# if defined (ACE_LACKS_SYSCALL) + int syscall (int, ACE_HANDLE, struct rusage *); +# endif /* ACE_LACKS_SYSCALL */ +#endif /* !ACE_WIN32 */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_RESOURCE_H */ diff --git a/externals/ace/os_include/sys/os_select.h b/externals/ace/os_include/sys/os_select.h new file mode 100644 index 0000000..59473af --- /dev/null +++ b/externals/ace/os_include/sys/os_select.h @@ -0,0 +1,61 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_select.h + * + * select types + * + * $Id: os_select.h 85015 2009-04-03 12:27:59Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_SELECT_H +#define ACE_OS_INCLUDE_SYS_OS_SELECT_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_time.h" +#include "ace/os_include/os_signal.h" +#include "ace/os_include/os_unistd.h" + +#if !defined (ACE_LACKS_SYS_SELECT_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_SELECT_H */ + +#if defined (ACE_USES_SELECTLIB_H) && defined (ACE_LACKS_SYS_SELECT_H) +# include /**/ +#endif /* ACE_USES_SELECTLIB_H && ACE_LACKS_SYS_SELECT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_FD_MASK) + typedef long fd_mask; +#endif /* __QNX__ */ + +#if defined (ACE_WIN32) + // This will help until we figure out everything: +# define NFDBITS 32 /* only used in unused functions... */ +#elif defined (ACE_LACKS_NFDBITS) +# define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ +#endif /* ACE_WIN32 */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_SELECT_H */ diff --git a/externals/ace/os_include/sys/os_sem.h b/externals/ace/os_include/sys/os_sem.h new file mode 100644 index 0000000..926092b --- /dev/null +++ b/externals/ace/os_include/sys/os_sem.h @@ -0,0 +1,90 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_sem.h + * + * XSI semaphore facility + * + * $Id: os_sem.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_SEM_H +#define ACE_OS_INCLUDE_SYS_OS_SEM_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_ipc.h" + +#if !defined (ACE_LACKS_SYS_SEM_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_SEM_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +# if !defined (GETVAL) +# define GETVAL 0 +# endif /* GETVAL */ + +# if !defined (SETVAL) +# define SETVAL 0 +# endif /* SETVAL */ + +# if !defined (GETALL) +# define GETALL 0 +# endif /* GETALL */ + +# if !defined (SETALL) +# define SETALL 0 +# endif /* SETALL */ + +# if !defined (SEM_UNDO) +# define SEM_UNDO 0 +# endif /* SEM_UNDO */ + +#if defined (ACE_LACKS_SEMBUF_T) + struct sembuf + { + /// semaphore # + unsigned short sem_num; + + /// semaphore operation + short sem_op; + + /// operation flags + short sem_flg; + }; +#endif /* ACE_LACKS_SEMBUF_T */ + +#if !defined (ACE_HAS_SEMUN) || (defined (__GLIBC__) && defined (_SEM_SEMUN_UNDEFINED)) + union semun + { + /// value for SETVAL + int val; + /// buffer for IPC_STAT & IPC_SET + struct semid_ds *buf; + /// array for GETALL & SETALL + u_short *array; + }; +#endif /* !ACE_HAS_SEMUN || (defined (__GLIBC__) && defined (_SEM_SEMUN_UNDEFINED)) */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_SEM_H */ diff --git a/externals/ace/os_include/sys/os_shm.h b/externals/ace/os_include/sys/os_shm.h new file mode 100644 index 0000000..79d502f --- /dev/null +++ b/externals/ace/os_include/sys/os_shm.h @@ -0,0 +1,48 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_shm.h + * + * XSI shared memory facility + * + * $Id: os_shm.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_SHM_H +#define ACE_OS_INCLUDE_SYS_OS_SHM_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_ipc.h" + +#if !defined (ACE_LACKS_SYS_SHM_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_SHM_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + // Declare opaque type. Needed for ACE_OS wrappers on systems + // without SysV IPC. + struct shmid_ds; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_SHM_H */ diff --git a/externals/ace/os_include/sys/os_socket.h b/externals/ace/os_include/sys/os_socket.h new file mode 100644 index 0000000..6760417 --- /dev/null +++ b/externals/ace/os_include/sys/os_socket.h @@ -0,0 +1,307 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_socket.h + * + * main sockets header + * + * $Id: os_socket.h 85015 2009-04-03 12:27:59Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_SOCKET_H +#define ACE_OS_INCLUDE_SYS_OS_SOCKET_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_uio.h" + +#if !defined (ACE_LACKS_SYS_SOCKET_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_SOCKET_H */ + +#if defined (ACE_USES_SOCKLIB_H) +# include /**/ +#endif /* ACE_USES_SOCKLIB_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if !defined (ACE_HAS_MSG) && !defined (SCO) + struct msghdr {}; +#endif /* ACE_HAS_MSG */ + +#if defined (ACE_HAS_MSG) && defined (ACE_LACKS_MSG_ACCRIGHTS) +# if !defined (msg_accrights) +# undef msg_control +# define msg_accrights msg_control +# endif /* ! msg_accrights */ + +# if !defined (msg_accrightslen) +# undef msg_controllen +# define msg_accrightslen msg_controllen +# endif /* ! msg_accrightslen */ +#endif /* ACE_HAS_MSG && ACE_LACKS_MSG_ACCRIGHTS */ + +# if defined (ACE_LACKS_SOCKADDR) + struct sockaddr { + u_char sa_len; /* total length */ + u_char sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ + }; +# endif /* ACE_LACKS_SOCKADDR */ + +# if defined (ACE_LACKS_LINGER) + struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ + }; +# endif /* ACE_LACKS_LINGER */ + +#if defined (ACE_WIN32) + struct msghdr + { + /// Optional address + sockaddr * msg_name; + + /// Size of address + int msg_namelen; + + /// Scatter/gather array + iovec *msg_iov; + + /// # elements in msg_iov + int msg_iovlen; + + /// Access rights sent/received + caddr_t msg_accrights; + + int msg_accrightslen; + }; +#endif /* ACE_WIN32 */ + +#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) + // Control message size to pass a file descriptor. +# define ACE_BSD_CONTROL_MSG_LEN sizeof (struct cmsghdr) + sizeof (ACE_HANDLE) +#endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ + +// Increase the range of "address families". Please note that this +// must appear _after_ the include of sys/socket.h, for the AF_FILE +// definition on Linux/glibc2. +#if !defined (AF_ANY) +# define AF_ANY (-1) +#endif /* AF_ANY */ + +#if !defined (AF_UNSPEC) +# define AF_UNSPEC 0 +#endif /* AF_UNSPEC */ + +#if !defined (AF_LOCAL) +# define AF_LOCAL 1 +#endif /* AF_LOCAL */ + +#if !defined (AF_UNIX) +# define AF_UNIX AF_LOCAL +#endif /* AF_UNIX */ + +#if !defined (AF_INET) +# define AF_INET 2 +#endif /* AF_INET */ + +#if !defined (PF_INET) +# define PF_INET AF_INET +#endif /* PF_INET */ + +#if !defined (PF_LOCAL) +# define PF_LOCAL AF_LOCAL +#endif /* PF_LOCAL */ + +#if !defined (PF_UNIX) +# define PF_UNIX PF_LOCAL +#endif /* PF_UNIX */ + +#if !defined (AF_MAX) +# define AF_MAX 29 +#endif /* AF_MAX */ + +#if !defined (PF_UNSPEC) +# define PF_UNSPEC 0 +#endif /* PF_UNSPEC */ + +#define AF_SPIPE (AF_MAX + 1) +#if !defined (AF_FILE) +# define AF_FILE (AF_MAX + 2) +#endif /* ! AF_FILE */ +#define AF_DEV (AF_MAX + 3) +#define AF_UPIPE (AF_SPIPE) + +#if !defined (MSG_OOB) +# define MSG_OOB 0x1 +#endif /* MSG_OOB */ + +#if !defined (MSG_PEEK) +# define MSG_PEEK 0x2 +#endif /* MSG_PEEK */ + +#if !defined (SOCK_STREAM) +# define SOCK_STREAM 1 +#endif /* SOCK_STREAM */ + +#if !defined (SOCK_DGRAM) +# define SOCK_DGRAM 2 +#endif /* SOCK_DGRAM */ + +#if !defined (SOCK_SEQPACKET) +# define SOCK_SEQPACKET 5 +#endif /* SOCK_SEQPACKET */ + +#if !defined (SOL_SOCKET) +# define SOL_SOCKET 0xffff +#endif /* SOL_SOCKET */ + +#if !defined (SO_REUSEADDR) +# define SO_REUSEADDR 0x0004 +#endif /* SO_REUSEADDR */ + +#if !defined (SO_LINGER) +# define SO_LINGER 0x0080 +#endif /* SO_LINGER */ + +#if !defined (SO_SNDBUF) +# define SO_SNDBUF 0x1001 +#endif /* SO_SNDBUF */ + +#if !defined (SO_RCVBUF) +# define SO_RCVBUF 0x1002 +#endif /* SO_RCVBUF */ + +#if !defined (SO_BROADCAST) +# define SO_BROADCAST 0x0020 +#endif /* SO_BROADCAST */ + +#if !defined (SO_ERROR) +# define SO_ERROR 0x1007 +#endif /* SO_ERROR */ + +#if !defined (SCM_RIGHTS) +# define SCM_RIGHTS 0x01 +#endif /* SCM_RIGHTS */ + +#if defined (ACE_HAS_IPV6) +# if defined (ACE_USES_IPV4_IPV6_MIGRATION) +# define ACE_ADDRESS_FAMILY_INET AF_UNSPEC +# define ACE_PROTOCOL_FAMILY_INET PF_UNSPEC +# else +# define ACE_ADDRESS_FAMILY_INET AF_INET6 +# define ACE_PROTOCOL_FAMILY_INET PF_INET6 +# endif /* ACE_USES_IPV4_IPV6_MIGRATION */ +#else /* !ACE_HAS_IPV6 */ +# define ACE_ADDRESS_FAMILY_INET AF_INET +# define ACE_PROTOCOL_FAMILY_INET PF_INET +#endif /* ACE_HAS_IPV6 */ + +#if !defined (ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE) +#define ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE SSIZE_MAX +#endif /* ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE */ + +#if defined (ACE_HAS_SOCKLEN_T) +# if defined (__hpux) + /* + ** HP-UX supplies the socklen_t type unless some feature set less than + ** _XOPEN_SOURCE_EXTENDED is specifically requested. However, it only + ** actually uses the socklen_t type in supplied socket functions if + ** _XOPEN_SOURCE_EXTENDED is specifically requested. So, for example, + ** the compile options ACE usually uses (includes -mt) cause _HPUX_SOURCE + ** to be set, which sets _INCLUDE_XOPEN_SOURCE_EXTENDED (causing socklen_t + ** to be defined) but _not_ _XOPEN_SOURCE_EXTENDED (causing socket functions + ** to use int, not socklen_t). React to this situation here... + */ +# if defined (_XOPEN_SOURCE_EXTENDED) +typedef socklen_t ACE_SOCKET_LEN; +# else +typedef int ACE_SOCKET_LEN; +# endif /* _XOPEN_SOURCE_EXTENDED */ +# else +typedef socklen_t ACE_SOCKET_LEN; +# endif /* __hpux */ +#elif defined (ACE_HAS_SIZET_SOCKET_LEN) +typedef size_t ACE_SOCKET_LEN; +#else +typedef int ACE_SOCKET_LEN; +#endif /* ACE_HAS_SIZET_SOCKET_LEN */ + +#if defined (ACE_HAS_NETLINK) +# include /**/ +# include /**/ +# define ACE_PROTOCOL_FAMILY_NETLINK AF_NETLINK +#endif + +#if defined (ACE_HAS_LKSCTP) +extern "C" +{ +#include /**/ +#include /**/ +} +#endif /* ACE_HAS_LKSCTP */ + +# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES) + + ssize_t recv_timedwait (ACE_HANDLE handle, + char *buf, + int len, + int flags, + struct timespec *timeout); + + ssize_t recvmsg_timedwait (ACE_HANDLE handle, + struct msghdr *msg, + int flags, + struct timespec *timeout); + + ssize_t recvfrom_timedwait (ACE_HANDLE handle, + char *buf, + int len, + int flags, + struct sockaddr *addr, + int *addrlen, + struct timespec *timeout); + + ssize_t send_timedwait (ACE_HANDLE handle, + const char *buf, + int len, + int flags, + struct timespec *timeout); + + ssize_t sendmsg_timedwait (ACE_HANDLE handle, + const struct msghdr *msg, + int flags, + struct timespec *timeout); + + ssize_t sendto_timedwait (ACE_HANDLE handle, + const char *buf, + int len, + int flags, + const struct sockaddr *addr, + int addrlen, + struct timespec *timeout); + +# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_SOCKET_H */ diff --git a/externals/ace/os_include/sys/os_stat.h b/externals/ace/os_include/sys/os_stat.h new file mode 100644 index 0000000..19b1265 --- /dev/null +++ b/externals/ace/os_include/sys/os_stat.h @@ -0,0 +1,157 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_stat.h + * + * data returned by the stat() function + * + * $Id: os_stat.h 85057 2009-04-08 10:59:58Z msmit $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_STAT_H +#define ACE_OS_INCLUDE_SYS_OS_STAT_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if defined (ACE_HAS_DIRECT_H) +# include /**/ +#endif /* ACE_HAS_DIRECT_H */ + +#if !defined (ACE_LACKS_SYS_STAT_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_STAT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_MODE_MASKS) +// MODE MASKS + +// the following macros are for POSIX conformance. + +# if !defined (ACE_HAS_USER_MODE_MASKS) +# if !defined (S_IRWXU) +# define S_IRWXU 00700 /* read, write, execute: owner. */ +# endif /* !S_IRWXU */ +# if !defined (S_IRUSR) +# define S_IRUSR 00400 /* read permission: owner. */ +# endif /* !S_IRUSR */ +# if !defined (S_IWUSR) +# define S_IWUSR 00200 /* write permission: owner. */ +# endif /* !S_IWUSR */ +# if !defined (S_IXUSR) +# define S_IXUSR 00100 /* execute permission: owner. */ +# endif /* !S_IXUSR */ +# endif /* ACE_HAS_USER_MODE_MASKS */ + +# if !defined (S_IRWXG) +# define S_IRWXG 00070 +# endif /* S_IRWXG */ +# if !defined (S_IRGRP) +# define S_IRGRP 00040 +# endif /* S_IRGRP */ +# if !defined (S_IWGRP) +# define S_IWGRP 00020 +# endif /* S_IWGRP */ +# if !defined (S_IXGRP) +# define S_IXGRP 00010 +# endif /* S_IXGRP */ +# if !defined (S_IRWXO) +# define S_IRWXO 00007 +# endif /* S_IRWXO */ +# if !defined (S_IROTH) +# define S_IROTH 00004 +# endif /* S_IROTH */ +# if !defined (S_IWOTH) +# define S_IWOTH 00002 +# endif /* S_IWOTH */ +# if !defined (S_IXOTH) +# define S_IXOTH 00001 +# endif /* S_IXOTH */ + +// WinCE's S_IFLNK is defined with the other bits, below. +#if !defined (S_IFLNK) && !defined (ACE_HAS_WINCE) +#define S_IFLNK 0200000 +#endif /* S_IFLNK && !ACE_HAS_WINCE */ + +#endif /* ACE_LACKS_MODE_MASKS */ + +// Some systems (VxWorks) don't define S_ISLNK +#if !defined (S_ISLNK) +# if defined (S_IFLNK) +# define S_ISLNK(mode) (((mode)&S_IFLNK) == S_IFLNK) +# else +# define S_ISLNK(mode) 0 +# endif /* S_IFLNK */ +#endif /* S_ISLNK */ + +#if defined (ACE_HAS_WINCE) + +// Translate the WinCE bits into names expected by our callers. +// The dwFileAttributes parameter doesn't have protection info, so +// S_IFMT is the whole thing. Since there are no symbolic links, S_IFLNK is 0. +# define S_IFMT 0xFFFF +# define S_IFDIR FILE_ATTRIBUTE_DIRECTORY +# define S_IFREG FILE_ATTRIBUTE_NORMAL +# define S_IFLNK 0 + +# if !defined (__MINGW32__) + // Since CE does not have _stat by default as NT/2000 does, the 'stat' + // struct defined here will be used. Also note that CE file system + // struct is only for the CE 3.0 or later. + // Refer to the WCHAR.H from Visual C++ and WIBASE.H from eVC 3.0. + struct stat + { + /// always 0 on Windows platforms + dev_t st_dev; + + /// always 0 on Windows platforms + dev_t st_rdev; + + /// file attribute + mode_t st_mode; + + /// number of hard links + nlink_t st_nlink; + + /// time of last access + time_t st_atime; + + /// time of last data modification + time_t st_mtime; + + /// time of creation + time_t st_ctime; + + /// file size, in bytes + ACE_OFF_T st_size; + + // Following members do not have direct conversion in Window platforms. + //u_long st_blksize; // optimal blocksize for I/O + //u_long st_flags; // user defined flags for file + }; + #endif +#endif /* ACE_HAS_WINCE */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_STAT_H */ diff --git a/externals/ace/os_include/sys/os_statvfs.h b/externals/ace/os_include/sys/os_statvfs.h new file mode 100644 index 0000000..7988c4f --- /dev/null +++ b/externals/ace/os_include/sys/os_statvfs.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_statvfs.h + * + * VFS File System information structure + * + * $Id: os_statvfs.h 81692 2008-05-14 12:25:02Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_STATVFS_H +#define ACE_OS_INCLUDE_SYS_OS_STATVFS_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_SYS_STATVFS_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_STATVFS_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_STATVFS_H */ diff --git a/externals/ace/os_include/sys/os_sysctl.h b/externals/ace/os_include/sys/os_sysctl.h new file mode 100644 index 0000000..ee51cd7 --- /dev/null +++ b/externals/ace/os_include/sys/os_sysctl.h @@ -0,0 +1,41 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_sysctl.h + * + * declarations for sysctl + * + * $Id: os_sysctl.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_SYSCTL_H +#define ACE_OS_INCLUDE_SYS_OS_SYSCTL_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_SYS_SYSCTL_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_SYSCTL_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_SYSCTL_H */ diff --git a/externals/ace/os_include/sys/os_sysinfo.h b/externals/ace/os_include/sys/os_sysinfo.h new file mode 100644 index 0000000..7aca1f4 --- /dev/null +++ b/externals/ace/os_include/sys/os_sysinfo.h @@ -0,0 +1,39 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_sysinfo.h + * + * $Id: os_sysinfo.h 81692 2008-05-14 12:25:02Z johnnyw $ + * + * @author Johnny Willemsen + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_SYSINFO_H +#define ACE_OS_INCLUDE_SYS_OS_SYSINFO_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_SYS_SYSINFO_H) +# include /**/ +#endif /* ACE_HAS_SYS_SYSINFO_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_SYSINFO_H */ diff --git a/externals/ace/os_include/sys/os_time.h b/externals/ace/os_include/sys/os_time.h new file mode 100644 index 0000000..937ceeb --- /dev/null +++ b/externals/ace/os_include/sys/os_time.h @@ -0,0 +1,56 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_time.h + * + * time types + * + * $Id: os_time.h 85365 2009-05-18 08:27:42Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_TIME_H +#define ACE_OS_INCLUDE_SYS_OS_TIME_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_SYS_TIME_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_TIME_H */ + +#if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) +# include /**/ // VxWorks 6.2 defined timeval in time.h +#endif + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_HAS_SVR4_GETTIMEOFDAY) + int gettimeofday (struct timeval *tp, void * = 0); +#elif defined (ACE_HAS_OSF1_GETTIMEOFDAY) + int gettimeofday (struct timeval *tp, struct timezone * = 0); +#elif defined (ACE_HAS_VOIDPTR_GETTIMEOFDAY) +# define ACE_HAS_SVR4_GETTIMEOFDAY +#endif /* ACE_HAS_SVR4_GETTIMEOFDAY */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_TIME_H */ diff --git a/externals/ace/os_include/sys/os_timeb.h b/externals/ace/os_include/sys/os_timeb.h new file mode 100644 index 0000000..cf10566 --- /dev/null +++ b/externals/ace/os_include/sys/os_timeb.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_timeb.h + * + * additional definitions for date and time + * + * $Id: os_timeb.h 83306 2008-10-17 12:19:53Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_TIMEB_H +#define ACE_OS_INCLUDE_SYS_OS_TIMEB_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_SYS_TIMEB_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_TIMEB_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_TIMEB_H */ diff --git a/externals/ace/os_include/sys/os_times.h b/externals/ace/os_include/sys/os_times.h new file mode 100644 index 0000000..617b416 --- /dev/null +++ b/externals/ace/os_include/sys/os_times.h @@ -0,0 +1,44 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_times.h + * + * file access and modification times structure + * + * $Id: os_times.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_TIMES_H +#define ACE_OS_INCLUDE_SYS_OS_TIMES_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" + +#if !defined (ACE_LACKS_SYS_TIMES_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_TIMES_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_TIMES_H */ diff --git a/externals/ace/os_include/sys/os_types.h b/externals/ace/os_include/sys/os_types.h new file mode 100644 index 0000000..9638265 --- /dev/null +++ b/externals/ace/os_include/sys/os_types.h @@ -0,0 +1,157 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_types.h + * + * data types + * + * $Id: os_types.h 88515 2010-01-13 08:47:38Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_TYPES_H +#define ACE_OS_INCLUDE_SYS_OS_TYPES_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_stddef.h" + +#if !defined (ACE_LACKS_SYS_TYPES_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_TYPES_H */ + +#if defined (ACE_HAS_TYPES_H) +# include /**/ +#endif /* ACE_HAS_TYPES_H */ + +# if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ + (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) +using std::time_t; +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +typedef double ACE_timer_t; + +// todo: don't forget to clean this up! ;-) +#if !defined (ACE_HAS_CLOCK_GETTIME) && !(defined (_CLOCKID_T_) || defined (_CLOCKID_T)) + typedef int clockid_t; +# if !defined (CLOCK_REALTIME) +# define CLOCK_REALTIME 0 +# endif /* CLOCK_REALTIME */ +#endif /* ! ACE_HAS_CLOCK_GETTIME && ! _CLOCKID_T_ */ + +#if defined (ACE_LACKS_DEV_T) + typedef unsigned int dev_t; +#endif /* ACE_LACKS_DEV_T */ + +#if defined (ACE_HAS_WINCE) + typedef long off_t; +#endif + +#if defined(ACE_WIN32) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS==64) + typedef __int64 ACE_OFF_T; +#else + typedef off_t ACE_OFF_T; +#endif + +#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8 + typedef off_t ACE_LOFF_T; +#elif defined (ACE_HAS_RTEMS) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || defined(ACE_MVS) || defined(__INTERIX) || \ + (defined (ACE_OPENVMS) && defined (_LARGEFILE)) + typedef off_t ACE_LOFF_T; +#elif defined (__sgi) || defined (AIX) || defined (HPUX) || defined (__QNX__) + typedef off64_t ACE_LOFF_T; +#elif defined (__sun) + typedef offset_t ACE_LOFF_T; +#elif defined (WIN32) + typedef __int64 ACE_LOFF_T; +#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x680)) || \ + defined (ACE_LYNXOS_MAJOR) || \ + (defined (ACE_OPENVMS) && !defined (_LARGEFILE)) || \ + defined (__TANDEM) + typedef long long ACE_LOFF_T; +#else + typedef loff_t ACE_LOFF_T; +#endif + +#if defined (ACE_LACKS_UID_T) +typedef long uid_t; +#endif /* ACE_LACKS_UID_T */ + +#if defined (ACE_LACKS_GID_T) +typedef long gid_t; +#endif /* ACE_LACKS_GID_T */ + +#if defined (ACE_LACKS_CADDR_T) +typedef char *caddr_t; +#endif /* ACE_LACKS_CADDR_T */ + +#if defined (ACE_LACKS_MODE_T) +typedef u_short mode_t; +#endif /* ACE_LACKS_MODE_T */ + +#if defined (ACE_LACKS_NLINK_T) +typedef DWORD nlink_t; +#endif /* ACE_LACKS_NLINK_T */ + +#if defined (ACE_LACKS_KEY_T) +# if defined (ACE_WIN32) + // Win32 doesn't use numeric values to name its semaphores, it uses + // strings! + typedef char *key_t; +# else + typedef int key_t; +# endif /* ACE_WIN32 */ +#endif /* ACE_LACKS_KEY_T */ + +#if !defined (ACE_HAS_SSIZE_T) +# if defined (ACE_WIN64) + typedef SSIZE_T ssize_t; +# else + typedef int ssize_t; +# endif /* ACE_WIN64 */ +#endif /* ACE_HAS_SSIZE_T */ + +#if defined (ACE_WIN32) + typedef DWORD ACE_exitcode; +#else + typedef int ACE_exitcode; +#endif /* ACE_WIN32 */ + +#if defined (ACE_LACKS_SUSECONDS_T) + typedef long suseconds_t; +#endif + +#if defined (ACE_LACKS_USECONDS_T) + typedef unsigned long useconds_t; +#endif + +#if defined (ACE_WIN32) && !defined(__MINGW32__) + typedef int pid_t; +#endif /* ACE_WIN32 */ + +# if !defined (ACE_INVALID_PID) +# define ACE_INVALID_PID ((pid_t) -1) +# endif /* ACE_INVALID_PID */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_TYPES_H */ diff --git a/externals/ace/os_include/sys/os_uio.h b/externals/ace/os_include/sys/os_uio.h new file mode 100644 index 0000000..7baaec5 --- /dev/null +++ b/externals/ace/os_include/sys/os_uio.h @@ -0,0 +1,77 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_uio.h + * + * definitions for vector I/O operations + * + * $Id: os_uio.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_UIO_H +#define ACE_OS_INCLUDE_SYS_OS_UIO_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_types.h" +#include "ace/os_include/os_limits.h" + +#if !defined (ACE_LACKS_SYS_UIO_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_UIO_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_IOVEC) + /// The ordering of the fields in this struct is important. It has to + /// match those in WSABUF. + struct iovec + { + /// byte count to read/write + u_long iov_len; + /// data to be read/written + char *iov_base; + + // WSABUF is a Winsock2-only type. +# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) + operator WSABUF &(void) { return *((WSABUF *) this); } +# endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */ + }; +#endif /* ACE_LACKS_IOVEC */ + + +# if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES) + + ssize_t readv_timedwait (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + struct timespec* timeout); + + ssize_t writev_timedwait (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + struct timespec *timeout); + +# endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_UIO_H */ diff --git a/externals/ace/os_include/sys/os_un.h b/externals/ace/os_include/sys/os_un.h new file mode 100644 index 0000000..04a4da0 --- /dev/null +++ b/externals/ace/os_include/sys/os_un.h @@ -0,0 +1,52 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_un.h + * + * definitions for UNIX domain sockets + * + * $Id: os_un.h 85015 2009-04-03 12:27:59Z johnnyw $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_UN_H +#define ACE_OS_INCLUDE_SYS_OS_UN_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/sys/os_socket.h" + +#if !defined (ACE_LACKS_SYS_UN_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_UN_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#if defined (ACE_LACKS_SOCKADDR_UN) +struct sockaddr_un { + short sun_family; // AF_UNIX. + char sun_path[108]; // path name. +}; +#endif /* ACE_LACKS_SOCKADDR_UN */ + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_UN_H */ diff --git a/externals/ace/os_include/sys/os_utsname.h b/externals/ace/os_include/sys/os_utsname.h new file mode 100644 index 0000000..d78d1e3 --- /dev/null +++ b/externals/ace/os_include/sys/os_utsname.h @@ -0,0 +1,42 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_utsname.h + * + * system name structure + * + * $Id: os_utsname.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_UTSNAME_H +#define ACE_OS_INCLUDE_SYS_OS_UTSNAME_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_LACKS_SYS_UTSNAME_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_UTSNAME_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_UTSNAME_H */ diff --git a/externals/ace/os_include/sys/os_wait.h b/externals/ace/os_include/sys/os_wait.h new file mode 100644 index 0000000..b7a219a --- /dev/null +++ b/externals/ace/os_include/sys/os_wait.h @@ -0,0 +1,97 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_wait.h + * + * declarations for waiting + * + * $Id: os_wait.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Don Hinton + * @author This code was originally in various places including ace/OS.h. + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_SYS_OS_WAIT_H +#define ACE_OS_INCLUDE_SYS_OS_WAIT_H + +#include /**/ "ace/pre.h" + +#include "ace/config-lite.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_signal.h" +#include "ace/os_include/sys/os_resource.h" + +#if !defined (ACE_LACKS_SYS_WAIT_H) +# include /**/ +#endif /* !ACE_LACKS_SYS_WAIT_H */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + // Wrapping around wait status macros for platforms that + // lack them. + +# if !defined (WCOREDUMP) +# define WCOREDUMP(stat) 0 +# endif /* WCOREDUMP */ + +# if !defined (WNOHANG) +# define WNOHANG 0100 +# endif /* !WNOHANG */ + + // If the value of WIFEXITED(stat) is non-zero, this macro evaluates + // to the exit code that the child process exit(3C), or the value + // that the child process returned from main. Peaceful exit code is + // 0. +# if !defined (WEXITSTATUS) +# define WEXITSTATUS(stat) stat +# endif /* WEXITSTATUS */ + +# if !defined (WIFCONTINUED) +# define WIFCONTINUED(stat) 0 +# endif /* WIFCONTINUED */ + + // Evaluates to a non-zero value if status was returned for a child + // process that terminated normally. 0 means status wasn't + // returned. +# if !defined (WIFEXITED) +# define WIFEXITED(stat) 1 +# endif /* WIFEXITED */ + + // Evaluates to a non-zero value if status was returned for a child + // process that terminated due to the receipt of a signal. 0 means + // status wasnt returned. +# if !defined (WIFSIGNALED) +# define WIFSIGNALED(stat) 0 +# endif /* WIFSIGNALED */ + +# if !defined (WIFSTOPPED) +# define WIFSTOPPED(stat) 0 +# endif /* WIFSTOPPED */ + +# if !defined (WSTOPSIG) +# define WSTOPSIG(stat) 0 +# endif /* WSTOPSIG */ + + // If the value of WIFSIGNALED(stat) is non-zero, this macro + // evaluates to the number of the signal that caused the + // termination of the child process. +# if !defined (WTERMSIG) +# define WTERMSIG(stat) 0 +# endif /* WTERMSIG */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_SYS_OS_WAIT_H */ diff --git a/externals/ace/post.h b/externals/ace/post.h new file mode 100644 index 0000000..c393dfe --- /dev/null +++ b/externals/ace/post.h @@ -0,0 +1,22 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file post.h + * + * $Id: post.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Christopher Kohlhoff + * + * This file restores the original alignment rules. + */ +//============================================================================= + +// No header guard +#if defined (_MSC_VER) +# pragma pack (pop) +#elif defined (__BORLANDC__) +# pragma option pop +# pragma nopushoptwarn +# pragma nopackwarning +#endif diff --git a/externals/ace/pre.h b/externals/ace/pre.h new file mode 100644 index 0000000..7cc32d8 --- /dev/null +++ b/externals/ace/pre.h @@ -0,0 +1,24 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file pre.h + * + * $Id: pre.h 80826 2008-03-04 14:51:23Z wotte $ + * + * @author Christopher Kohlhoff + * + * This file saves the original alignment rules and changes the alignment + * boundary to ACE's default. + */ +//============================================================================= + +// No header guard +#if defined (_MSC_VER) +# pragma warning (disable:4103) +# pragma pack (push, 8) +#elif defined (__BORLANDC__) +# pragma option push -a8 -b -Ve- -Vx- -w-rvl -w-rch -w-ccc -w-obs -w-aus -w-pia -w-inl -w-sig +# pragma nopushoptwarn +# pragma nopackwarning +#endif diff --git a/externals/ace/streams.h b/externals/ace/streams.h new file mode 100644 index 0000000..396a67c --- /dev/null +++ b/externals/ace/streams.h @@ -0,0 +1,138 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file streams.h + * + * $Id: streams.h 82445 2008-07-28 13:40:01Z johnnyw $ + * + * @author Irfan Pyarali + * + * This file contains the portability ugliness for the Standard C++ + * Library. As implementations of the "standard" emerge, this file + * will need to be updated. + * + * This files deals with the streams includes. + * + * + */ +//============================================================================= + + +#ifndef ACE_STREAMS_H +#define ACE_STREAMS_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Do this so the #pragma warning in the MSVC headers do not +// affect our #pragma warning settings +#if defined (_MSC_VER) +#pragma warning(push) +#endif /* _MSC_VER*/ + + +#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) + +# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ + (ACE_HAS_STANDARD_CPP_LIBRARY != 0) + +# if defined (_MSC_VER) +# pragma warning(disable: 4018 4114 4146 4245) +# pragma warning(disable: 4663 4664 4665 4511 4512) +# endif /* _MSC_VER */ + +# if defined (ACE_USES_OLD_IOSTREAMS) +# include /**/ +# include /**/ + // This has been commented as it is not needed and causes problems with Qt. + // (brunsch) But has been uncommented since it should be included. Qt + // probably should have some sort of macro that will prevent including this + // when it is used. +# include /**/ +# else +# include /**/ +# include /**/ +# include /**/ +# include /**/ +# include /**/ +# include /**/ +# include /**/ +# endif /* ACE_USES_OLD_IOSTREAMS */ + +# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \ + (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0) + +# if !defined (ACE_USES_OLD_IOSTREAMS) + // Make these available in the global name space + using std::ios; + using std::ios_base; + using std::streambuf; + using std::istream; + using std::ostream; + using std::iostream; + using std::filebuf; + using std::ifstream; + using std::ofstream; + using std::fstream; + + using std::cin; + using std::cout; + using std::cerr; + using std::clog; + + using std::endl; + using std::ends; + using std::flush; + + using std::ws; + + using std::resetiosflags; + using std::setfill; + using std::setiosflags; + using std::setprecision; + using std::setw; + + using std::dec; + using std::hex; + using std::oct; +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + +# if defined (_MSC_VER) +# pragma warning(4: 4018 4114 4146 4245) +# pragma warning(4: 4663 4664 4665 4512 4511) +# endif /* _MSC_VER */ + +# else /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ + +# include /**/ +# include /**/ +# include /**/ + +# if defined (ACE_WIN32) && !defined(__MINGW32__) +# if defined(_MSC_VER) // VSB +# include /**/ +# include /**/ +# include /**/ +# include /**/ +# endif /* _MSC_VER */ +# endif /* ACE_WIN32 && !__MINGW32__ */ + +# endif /* ! ACE_HAS_STANDARD_CPP_LIBRARY */ + +#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ + +// Do this so the #pragma warning in the MSVC headers do not +// affect our #pragma warning settings +#if defined (_MSC_VER) +#pragma warning(pop) +#endif /* _MSC_VER */ + +#include /**/ "ace/post.h" +#endif /* ACE_STREAMS_H */ diff --git a/externals/ace/svc_export.h b/externals/ace/svc_export.h new file mode 100644 index 0000000..18cf3a2 --- /dev/null +++ b/externals/ace/svc_export.h @@ -0,0 +1,44 @@ +// -*- C++ -*- +// $Id: svc_export.h 84495 2009-02-17 17:44:31Z johnnyw $ +// Definition for Win32 Export directives. + +// This file was generated by generate_export_file.pl +// but needed to be altered to support ACE_BUILD_SVC_DLL +// instead of ACE_SVC_BUILD_DLL which was already being +// used. + +// ------------------------------ +#if !defined (ACE_SVC_EXPORT_H) +#define ACE_SVC_EXPORT_H + +#include /**/ "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_SVC_HAS_DLL) +# define ACE_SVC_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_SVC_HAS_DLL */ + +#if !defined (ACE_SVC_HAS_DLL) +#define ACE_SVC_HAS_DLL 1 +#endif /* ! ACE_SVC_HAS_DLL */ + +#if defined (ACE_SVC_HAS_DLL) +# if (ACE_SVC_HAS_DLL == 1) +# if defined (ACE_BUILD_SVC_DLL) || defined (ACE_SVC_BUILD_DLL) +# define ACE_Svc_Export ACE_Proper_Export_Flag +# define ACE_SVC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# else +# define ACE_Svc_Export ACE_Proper_Import_Flag +# define ACE_SVC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# endif /* ACE_BUILD_SVC_DLL */ +# else +# define ACE_Svc_Export +# define ACE_SVC_SINGLETON_DECLARATION(T) +# endif /* ! ACE_SVC_HAS_DLL == 1 */ +#else +# define ACE_Svc_Export +# define ACE_SVC_SINGLETON_DECLARATION(T) +#endif /* ACE_SVC_HAS_DLL */ + +#endif /* ACE_SVC_EXPORT_H */ + +// End of auto generated file. diff --git a/externals/ace/win/VC90/ace.vcproj b/externals/ace/win/VC90/ace.vcproj new file mode 100644 index 0000000..39b0872 --- /dev/null +++ b/externals/ace/win/VC90/ace.vcproj @@ -0,0 +1,5308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/externals/ace/win/ace.sln b/externals/ace/win/ace.sln new file mode 100644 index 0000000..6b09a5f --- /dev/null +++ b/externals/ace/win/ace.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACE_Wrappers", "VC90\ace.vcproj", "{BD537C9A-FECA-1BAD-6757-8A6348EA12C8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|Win32.ActiveCfg = Debug|Win32 + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|Win32.Build.0 = Debug|Win32 + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|x64.ActiveCfg = Debug|x64 + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Debug|x64.Build.0 = Debug|x64 + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Release|Win32.ActiveCfg = Release|Win32 + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Release|Win32.Build.0 = Release|Win32 + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Release|x64.ActiveCfg = Release|x64 + {BD537C9A-FECA-1BAD-6757-8A6348EA12C8}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/bzip2/CMakeLists.txt b/externals/bzip2/CMakeLists.txt new file mode 100644 index 0000000..3de5475 --- /dev/null +++ b/externals/bzip2/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +file(GLOB sources *.c) + +set(bzip2_STAT_SRCS + ${sources} +) + +include_directories( + ${CMAKE_SOURCE_DIR}/externals/zlib + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_library(bzip2 STATIC ${bzip2_STAT_SRCS}) diff --git a/externals/bzip2/blocksort.c b/externals/bzip2/blocksort.c new file mode 100644 index 0000000..bd2dec1 --- /dev/null +++ b/externals/bzip2/blocksort.c @@ -0,0 +1,1094 @@ + +/*-------------------------------------------------------------*/ +/*--- Block sorting machinery ---*/ +/*--- blocksort.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + +/*---------------------------------------------*/ +/*--- Fallback O(N log(N)^2) sorting ---*/ +/*--- algorithm, for repetitive blocks ---*/ +/*---------------------------------------------*/ + +/*---------------------------------------------*/ +static +__inline__ +void fallbackSimpleSort ( UInt32* fmap, + UInt32* eclass, + Int32 lo, + Int32 hi ) +{ + Int32 i, j, tmp; + UInt32 ec_tmp; + + if (lo == hi) return; + + if (hi - lo > 3) { + for ( i = hi-4; i >= lo; i-- ) { + tmp = fmap[i]; + ec_tmp = eclass[tmp]; + for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 ) + fmap[j-4] = fmap[j]; + fmap[j-4] = tmp; + } + } + + for ( i = hi-1; i >= lo; i-- ) { + tmp = fmap[i]; + ec_tmp = eclass[tmp]; + for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ ) + fmap[j-1] = fmap[j]; + fmap[j-1] = tmp; + } +} + + +/*---------------------------------------------*/ +#define fswap(zz1, zz2) \ + { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } + +#define fvswap(zzp1, zzp2, zzn) \ +{ \ + Int32 yyp1 = (zzp1); \ + Int32 yyp2 = (zzp2); \ + Int32 yyn = (zzn); \ + while (yyn > 0) { \ + fswap(fmap[yyp1], fmap[yyp2]); \ + yyp1++; yyp2++; yyn--; \ + } \ +} + + +#define fmin(a,b) ((a) < (b)) ? (a) : (b) + +#define fpush(lz,hz) { stackLo[sp] = lz; \ + stackHi[sp] = hz; \ + sp++; } + +#define fpop(lz,hz) { sp--; \ + lz = stackLo[sp]; \ + hz = stackHi[sp]; } + +#define FALLBACK_QSORT_SMALL_THRESH 10 +#define FALLBACK_QSORT_STACK_SIZE 100 + + +static +void fallbackQSort3 ( UInt32* fmap, + UInt32* eclass, + Int32 loSt, + Int32 hiSt ) +{ + Int32 unLo, unHi, ltLo, gtHi, n, m; + Int32 sp, lo, hi; + UInt32 med, r, r3; + Int32 stackLo[FALLBACK_QSORT_STACK_SIZE]; + Int32 stackHi[FALLBACK_QSORT_STACK_SIZE]; + + r = 0; + + sp = 0; + fpush ( loSt, hiSt ); + + while (sp > 0) { + + AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 ); + + fpop ( lo, hi ); + if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { + fallbackSimpleSort ( fmap, eclass, lo, hi ); + continue; + } + + /* Random partitioning. Median of 3 sometimes fails to + avoid bad cases. Median of 9 seems to help but + looks rather expensive. This too seems to work but + is cheaper. Guidance for the magic constants + 7621 and 32768 is taken from Sedgewick's algorithms + book, chapter 35. + */ + r = ((r * 7621) + 1) % 32768; + r3 = r % 3; + if (r3 == 0) med = eclass[fmap[lo]]; else + if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else + med = eclass[fmap[hi]]; + + unLo = ltLo = lo; + unHi = gtHi = hi; + + while (1) { + while (1) { + if (unLo > unHi) break; + n = (Int32)eclass[fmap[unLo]] - (Int32)med; + if (n == 0) { + fswap(fmap[unLo], fmap[ltLo]); + ltLo++; unLo++; + continue; + }; + if (n > 0) break; + unLo++; + } + while (1) { + if (unLo > unHi) break; + n = (Int32)eclass[fmap[unHi]] - (Int32)med; + if (n == 0) { + fswap(fmap[unHi], fmap[gtHi]); + gtHi--; unHi--; + continue; + }; + if (n < 0) break; + unHi--; + } + if (unLo > unHi) break; + fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--; + } + + AssertD ( unHi == unLo-1, "fallbackQSort3(2)" ); + + if (gtHi < ltLo) continue; + + n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n); + m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m); + + n = lo + unLo - ltLo - 1; + m = hi - (gtHi - unHi) + 1; + + if (n - lo > hi - m) { + fpush ( lo, n ); + fpush ( m, hi ); + } else { + fpush ( m, hi ); + fpush ( lo, n ); + } + } +} + +#undef fmin +#undef fpush +#undef fpop +#undef fswap +#undef fvswap +#undef FALLBACK_QSORT_SMALL_THRESH +#undef FALLBACK_QSORT_STACK_SIZE + + +/*---------------------------------------------*/ +/* Pre: + nblock > 0 + eclass exists for [0 .. nblock-1] + ((UChar*)eclass) [0 .. nblock-1] holds block + ptr exists for [0 .. nblock-1] + + Post: + ((UChar*)eclass) [0 .. nblock-1] holds block + All other areas of eclass destroyed + fmap [0 .. nblock-1] holds sorted order + bhtab [ 0 .. 2+(nblock/32) ] destroyed +*/ + +#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) +#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) +#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) +#define WORD_BH(zz) bhtab[(zz) >> 5] +#define UNALIGNED_BH(zz) ((zz) & 0x01f) + +static +void fallbackSort ( UInt32* fmap, + UInt32* eclass, + UInt32* bhtab, + Int32 nblock, + Int32 verb ) +{ + Int32 ftab[257]; + Int32 ftabCopy[256]; + Int32 H, i, j, k, l, r, cc, cc1; + Int32 nNotDone; + Int32 nBhtab; + UChar* eclass8 = (UChar*)eclass; + + /*-- + Initial 1-char radix sort to generate + initial fmap and initial BH bits. + --*/ + if (verb >= 4) + VPrintf0 ( " bucket sorting ...\n" ); + for (i = 0; i < 257; i++) ftab[i] = 0; + for (i = 0; i < nblock; i++) ftab[eclass8[i]]++; + for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i]; + for (i = 1; i < 257; i++) ftab[i] += ftab[i-1]; + + for (i = 0; i < nblock; i++) { + j = eclass8[i]; + k = ftab[j] - 1; + ftab[j] = k; + fmap[k] = i; + } + + nBhtab = 2 + (nblock / 32); + for (i = 0; i < nBhtab; i++) bhtab[i] = 0; + for (i = 0; i < 256; i++) SET_BH(ftab[i]); + + /*-- + Inductively refine the buckets. Kind-of an + "exponential radix sort" (!), inspired by the + Manber-Myers suffix array construction algorithm. + --*/ + + /*-- set sentinel bits for block-end detection --*/ + for (i = 0; i < 32; i++) { + SET_BH(nblock + 2*i); + CLEAR_BH(nblock + 2*i + 1); + } + + /*-- the log(N) loop --*/ + H = 1; + while (1) { + + if (verb >= 4) + VPrintf1 ( " depth %6d has ", H ); + + j = 0; + for (i = 0; i < nblock; i++) { + if (ISSET_BH(i)) j = i; + k = fmap[i] - H; if (k < 0) k += nblock; + eclass[k] = j; + } + + nNotDone = 0; + r = -1; + while (1) { + + /*-- find the next non-singleton bucket --*/ + k = r + 1; + while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; + if (ISSET_BH(k)) { + while (WORD_BH(k) == 0xffffffff) k += 32; + while (ISSET_BH(k)) k++; + } + l = k - 1; + if (l >= nblock) break; + while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++; + if (!ISSET_BH(k)) { + while (WORD_BH(k) == 0x00000000) k += 32; + while (!ISSET_BH(k)) k++; + } + r = k - 1; + if (r >= nblock) break; + + /*-- now [l, r] bracket current bucket --*/ + if (r > l) { + nNotDone += (r - l + 1); + fallbackQSort3 ( fmap, eclass, l, r ); + + /*-- scan bucket and generate header bits-- */ + cc = -1; + for (i = l; i <= r; i++) { + cc1 = eclass[fmap[i]]; + if (cc != cc1) { SET_BH(i); cc = cc1; }; + } + } + } + + if (verb >= 4) + VPrintf1 ( "%6d unresolved strings\n", nNotDone ); + + H *= 2; + if (H > nblock || nNotDone == 0) break; + } + + /*-- + Reconstruct the original block in + eclass8 [0 .. nblock-1], since the + previous phase destroyed it. + --*/ + if (verb >= 4) + VPrintf0 ( " reconstructing block ...\n" ); + j = 0; + for (i = 0; i < nblock; i++) { + while (ftabCopy[j] == 0) j++; + ftabCopy[j]--; + eclass8[fmap[i]] = (UChar)j; + } + AssertH ( j < 256, 1005 ); +} + +#undef SET_BH +#undef CLEAR_BH +#undef ISSET_BH +#undef WORD_BH +#undef UNALIGNED_BH + + +/*---------------------------------------------*/ +/*--- The main, O(N^2 log(N)) sorting ---*/ +/*--- algorithm. Faster for "normal" ---*/ +/*--- non-repetitive blocks. ---*/ +/*---------------------------------------------*/ + +/*---------------------------------------------*/ +static +__inline__ +Bool mainGtU ( UInt32 i1, + UInt32 i2, + UChar* block, + UInt16* quadrant, + UInt32 nblock, + Int32* budget ) +{ + Int32 k; + UChar c1, c2; + UInt16 s1, s2; + + AssertD ( i1 != i2, "mainGtU" ); + /* 1 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 2 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 3 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 4 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 5 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 6 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 7 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 8 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 9 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 10 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 11 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + /* 12 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + i1++; i2++; + + k = nblock + 8; + + do { + /* 1 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 2 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 3 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 4 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 5 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 6 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 7 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + /* 8 */ + c1 = block[i1]; c2 = block[i2]; + if (c1 != c2) return (c1 > c2); + s1 = quadrant[i1]; s2 = quadrant[i2]; + if (s1 != s2) return (s1 > s2); + i1++; i2++; + + if (i1 >= nblock) i1 -= nblock; + if (i2 >= nblock) i2 -= nblock; + + k -= 8; + (*budget)--; + } + while (k >= 0); + + return False; +} + + +/*---------------------------------------------*/ +/*-- + Knuth's increments seem to work better + than Incerpi-Sedgewick here. Possibly + because the number of elems to sort is + usually small, typically <= 20. +--*/ +static +Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, + 9841, 29524, 88573, 265720, + 797161, 2391484 }; + +static +void mainSimpleSort ( UInt32* ptr, + UChar* block, + UInt16* quadrant, + Int32 nblock, + Int32 lo, + Int32 hi, + Int32 d, + Int32* budget ) +{ + Int32 i, j, h, bigN, hp; + UInt32 v; + + bigN = hi - lo + 1; + if (bigN < 2) return; + + hp = 0; + while (incs[hp] < bigN) hp++; + hp--; + + for (; hp >= 0; hp--) { + h = incs[hp]; + + i = lo + h; + while (True) { + + /*-- copy 1 --*/ + if (i > hi) break; + v = ptr[i]; + j = i; + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget + ) ) { + ptr[j] = ptr[j-h]; + j = j - h; + if (j <= (lo + h - 1)) break; + } + ptr[j] = v; + i++; + + /*-- copy 2 --*/ + if (i > hi) break; + v = ptr[i]; + j = i; + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget + ) ) { + ptr[j] = ptr[j-h]; + j = j - h; + if (j <= (lo + h - 1)) break; + } + ptr[j] = v; + i++; + + /*-- copy 3 --*/ + if (i > hi) break; + v = ptr[i]; + j = i; + while ( mainGtU ( + ptr[j-h]+d, v+d, block, quadrant, nblock, budget + ) ) { + ptr[j] = ptr[j-h]; + j = j - h; + if (j <= (lo + h - 1)) break; + } + ptr[j] = v; + i++; + + if (*budget < 0) return; + } + } +} + + +/*---------------------------------------------*/ +/*-- + The following is an implementation of + an elegant 3-way quicksort for strings, + described in a paper "Fast Algorithms for + Sorting and Searching Strings", by Robert + Sedgewick and Jon L. Bentley. +--*/ + +#define mswap(zz1, zz2) \ + { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } + +#define mvswap(zzp1, zzp2, zzn) \ +{ \ + Int32 yyp1 = (zzp1); \ + Int32 yyp2 = (zzp2); \ + Int32 yyn = (zzn); \ + while (yyn > 0) { \ + mswap(ptr[yyp1], ptr[yyp2]); \ + yyp1++; yyp2++; yyn--; \ + } \ +} + +static +__inline__ +UChar mmed3 ( UChar a, UChar b, UChar c ) +{ + UChar t; + if (a > b) { t = a; a = b; b = t; }; + if (b > c) { + b = c; + if (a > b) b = a; + } + return b; +} + +#define mmin(a,b) ((a) < (b)) ? (a) : (b) + +#define mpush(lz,hz,dz) { stackLo[sp] = lz; \ + stackHi[sp] = hz; \ + stackD [sp] = dz; \ + sp++; } + +#define mpop(lz,hz,dz) { sp--; \ + lz = stackLo[sp]; \ + hz = stackHi[sp]; \ + dz = stackD [sp]; } + + +#define mnextsize(az) (nextHi[az]-nextLo[az]) + +#define mnextswap(az,bz) \ + { Int32 tz; \ + tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \ + tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \ + tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; } + + +#define MAIN_QSORT_SMALL_THRESH 20 +#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT) +#define MAIN_QSORT_STACK_SIZE 100 + +static +void mainQSort3 ( UInt32* ptr, + UChar* block, + UInt16* quadrant, + Int32 nblock, + Int32 loSt, + Int32 hiSt, + Int32 dSt, + Int32* budget ) +{ + Int32 unLo, unHi, ltLo, gtHi, n, m, med; + Int32 sp, lo, hi, d; + + Int32 stackLo[MAIN_QSORT_STACK_SIZE]; + Int32 stackHi[MAIN_QSORT_STACK_SIZE]; + Int32 stackD [MAIN_QSORT_STACK_SIZE]; + + Int32 nextLo[3]; + Int32 nextHi[3]; + Int32 nextD [3]; + + sp = 0; + mpush ( loSt, hiSt, dSt ); + + while (sp > 0) { + + AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 ); + + mpop ( lo, hi, d ); + if (hi - lo < MAIN_QSORT_SMALL_THRESH || + d > MAIN_QSORT_DEPTH_THRESH) { + mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); + if (*budget < 0) return; + continue; + } + + med = (Int32) + mmed3 ( block[ptr[ lo ]+d], + block[ptr[ hi ]+d], + block[ptr[ (lo+hi)>>1 ]+d] ); + + unLo = ltLo = lo; + unHi = gtHi = hi; + + while (True) { + while (True) { + if (unLo > unHi) break; + n = ((Int32)block[ptr[unLo]+d]) - med; + if (n == 0) { + mswap(ptr[unLo], ptr[ltLo]); + ltLo++; unLo++; continue; + }; + if (n > 0) break; + unLo++; + } + while (True) { + if (unLo > unHi) break; + n = ((Int32)block[ptr[unHi]+d]) - med; + if (n == 0) { + mswap(ptr[unHi], ptr[gtHi]); + gtHi--; unHi--; continue; + }; + if (n < 0) break; + unHi--; + } + if (unLo > unHi) break; + mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--; + } + + AssertD ( unHi == unLo-1, "mainQSort3(2)" ); + + if (gtHi < ltLo) { + mpush(lo, hi, d+1 ); + continue; + } + + n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n); + m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m); + + n = lo + unLo - ltLo - 1; + m = hi - (gtHi - unHi) + 1; + + nextLo[0] = lo; nextHi[0] = n; nextD[0] = d; + nextLo[1] = m; nextHi[1] = hi; nextD[1] = d; + nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1; + + if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); + if (mnextsize(1) < mnextsize(2)) mnextswap(1,2); + if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); + + AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" ); + AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" ); + + mpush (nextLo[0], nextHi[0], nextD[0]); + mpush (nextLo[1], nextHi[1], nextD[1]); + mpush (nextLo[2], nextHi[2], nextD[2]); + } +} + +#undef mswap +#undef mvswap +#undef mpush +#undef mpop +#undef mmin +#undef mnextsize +#undef mnextswap +#undef MAIN_QSORT_SMALL_THRESH +#undef MAIN_QSORT_DEPTH_THRESH +#undef MAIN_QSORT_STACK_SIZE + + +/*---------------------------------------------*/ +/* Pre: + nblock > N_OVERSHOOT + block32 exists for [0 .. nblock-1 +N_OVERSHOOT] + ((UChar*)block32) [0 .. nblock-1] holds block + ptr exists for [0 .. nblock-1] + + Post: + ((UChar*)block32) [0 .. nblock-1] holds block + All other areas of block32 destroyed + ftab [0 .. 65536 ] destroyed + ptr [0 .. nblock-1] holds sorted order + if (*budget < 0), sorting was abandoned +*/ + +#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8]) +#define SETMASK (1 << 21) +#define CLEARMASK (~(SETMASK)) + +static +void mainSort ( UInt32* ptr, + UChar* block, + UInt16* quadrant, + UInt32* ftab, + Int32 nblock, + Int32 verb, + Int32* budget ) +{ + Int32 i, j, k, ss, sb; + Int32 runningOrder[256]; + Bool bigDone[256]; + Int32 copyStart[256]; + Int32 copyEnd [256]; + UChar c1; + Int32 numQSorted; + UInt16 s; + if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" ); + + /*-- set up the 2-byte frequency table --*/ + for (i = 65536; i >= 0; i--) ftab[i] = 0; + + j = block[0] << 8; + i = nblock-1; + for (; i >= 3; i -= 4) { + quadrant[i] = 0; + j = (j >> 8) | ( ((UInt16)block[i]) << 8); + ftab[j]++; + quadrant[i-1] = 0; + j = (j >> 8) | ( ((UInt16)block[i-1]) << 8); + ftab[j]++; + quadrant[i-2] = 0; + j = (j >> 8) | ( ((UInt16)block[i-2]) << 8); + ftab[j]++; + quadrant[i-3] = 0; + j = (j >> 8) | ( ((UInt16)block[i-3]) << 8); + ftab[j]++; + } + for (; i >= 0; i--) { + quadrant[i] = 0; + j = (j >> 8) | ( ((UInt16)block[i]) << 8); + ftab[j]++; + } + + /*-- (emphasises close relationship of block & quadrant) --*/ + for (i = 0; i < BZ_N_OVERSHOOT; i++) { + block [nblock+i] = block[i]; + quadrant[nblock+i] = 0; + } + + if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); + + /*-- Complete the initial radix sort --*/ + for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1]; + + s = block[0] << 8; + i = nblock-1; + for (; i >= 3; i -= 4) { + s = (s >> 8) | (block[i] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i; + s = (s >> 8) | (block[i-1] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i-1; + s = (s >> 8) | (block[i-2] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i-2; + s = (s >> 8) | (block[i-3] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i-3; + } + for (; i >= 0; i--) { + s = (s >> 8) | (block[i] << 8); + j = ftab[s] -1; + ftab[s] = j; + ptr[j] = i; + } + + /*-- + Now ftab contains the first loc of every small bucket. + Calculate the running order, from smallest to largest + big bucket. + --*/ + for (i = 0; i <= 255; i++) { + bigDone [i] = False; + runningOrder[i] = i; + } + + { + Int32 vv; + Int32 h = 1; + do h = 3 * h + 1; while (h <= 256); + do { + h = h / 3; + for (i = h; i <= 255; i++) { + vv = runningOrder[i]; + j = i; + while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) { + runningOrder[j] = runningOrder[j-h]; + j = j - h; + if (j <= (h - 1)) goto zero; + } + zero: + runningOrder[j] = vv; + } + } while (h != 1); + } + + /*-- + The main sorting loop. + --*/ + + numQSorted = 0; + + for (i = 0; i <= 255; i++) { + + /*-- + Process big buckets, starting with the least full. + Basically this is a 3-step process in which we call + mainQSort3 to sort the small buckets [ss, j], but + also make a big effort to avoid the calls if we can. + --*/ + ss = runningOrder[i]; + + /*-- + Step 1: + Complete the big bucket [ss] by quicksorting + any unsorted small buckets [ss, j], for j != ss. + Hopefully previous pointer-scanning phases have already + completed many of the small buckets [ss, j], so + we don't have to sort them at all. + --*/ + for (j = 0; j <= 255; j++) { + if (j != ss) { + sb = (ss << 8) + j; + if ( ! (ftab[sb] & SETMASK) ) { + Int32 lo = ftab[sb] & CLEARMASK; + Int32 hi = (ftab[sb+1] & CLEARMASK) - 1; + if (hi > lo) { + if (verb >= 4) + VPrintf4 ( " qsort [0x%x, 0x%x] " + "done %d this %d\n", + ss, j, numQSorted, hi - lo + 1 ); + mainQSort3 ( + ptr, block, quadrant, nblock, + lo, hi, BZ_N_RADIX, budget + ); + numQSorted += (hi - lo + 1); + if (*budget < 0) return; + } + } + ftab[sb] |= SETMASK; + } + } + + AssertH ( !bigDone[ss], 1006 ); + + /*-- + Step 2: + Now scan this big bucket [ss] so as to synthesise the + sorted order for small buckets [t, ss] for all t, + including, magically, the bucket [ss,ss] too. + This will avoid doing Real Work in subsequent Step 1's. + --*/ + { + for (j = 0; j <= 255; j++) { + copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK; + copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1; + } + for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) { + k = ptr[j]-1; if (k < 0) k += nblock; + c1 = block[k]; + if (!bigDone[c1]) + ptr[ copyStart[c1]++ ] = k; + } + for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { + k = ptr[j]-1; if (k < 0) k += nblock; + c1 = block[k]; + if (!bigDone[c1]) + ptr[ copyEnd[c1]-- ] = k; + } + } + + AssertH ( (copyStart[ss]-1 == copyEnd[ss]) + || + /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1. + Necessity for this case is demonstrated by compressing + a sequence of approximately 48.5 million of character + 251; 1.0.0/1.0.1 will then die here. */ + (copyStart[ss] == 0 && copyEnd[ss] == nblock-1), + 1007 ) + + for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK; + + /*-- + Step 3: + The [ss] big bucket is now done. Record this fact, + and update the quadrant descriptors. Remember to + update quadrants in the overshoot area too, if + necessary. The "if (i < 255)" test merely skips + this updating for the last bucket processed, since + updating for the last bucket is pointless. + + The quadrant array provides a way to incrementally + cache sort orderings, as they appear, so as to + make subsequent comparisons in fullGtU() complete + faster. For repetitive blocks this makes a big + difference (but not big enough to be able to avoid + the fallback sorting mechanism, exponential radix sort). + + The precise meaning is: at all times: + + for 0 <= i < nblock and 0 <= j <= nblock + + if block[i] != block[j], + + then the relative values of quadrant[i] and + quadrant[j] are meaningless. + + else { + if quadrant[i] < quadrant[j] + then the string starting at i lexicographically + precedes the string starting at j + + else if quadrant[i] > quadrant[j] + then the string starting at j lexicographically + precedes the string starting at i + + else + the relative ordering of the strings starting + at i and j has not yet been determined. + } + --*/ + bigDone[ss] = True; + + if (i < 255) { + Int32 bbStart = ftab[ss << 8] & CLEARMASK; + Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart; + Int32 shifts = 0; + + while ((bbSize >> shifts) > 65534) shifts++; + + for (j = bbSize-1; j >= 0; j--) { + Int32 a2update = ptr[bbStart + j]; + UInt16 qVal = (UInt16)(j >> shifts); + quadrant[a2update] = qVal; + if (a2update < BZ_N_OVERSHOOT) + quadrant[a2update + nblock] = qVal; + } + AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 ); + } + + } + + if (verb >= 4) + VPrintf3 ( " %d pointers, %d sorted, %d scanned\n", + nblock, numQSorted, nblock - numQSorted ); +} + +#undef BIGFREQ +#undef SETMASK +#undef CLEARMASK + + +/*---------------------------------------------*/ +/* Pre: + nblock > 0 + arr2 exists for [0 .. nblock-1 +N_OVERSHOOT] + ((UChar*)arr2) [0 .. nblock-1] holds block + arr1 exists for [0 .. nblock-1] + + Post: + ((UChar*)arr2) [0 .. nblock-1] holds block + All other areas of block destroyed + ftab [ 0 .. 65536 ] destroyed + arr1 [0 .. nblock-1] holds sorted order +*/ +void BZ2_blockSort ( EState* s ) +{ + UInt32* ptr = s->ptr; + UChar* block = s->block; + UInt32* ftab = s->ftab; + Int32 nblock = s->nblock; + Int32 verb = s->verbosity; + Int32 wfact = s->workFactor; + UInt16* quadrant; + Int32 budget; + Int32 budgetInit; + Int32 i; + + if (nblock < 10000) { + fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); + } else { + /* Calculate the location for quadrant, remembering to get + the alignment right. Assumes that &(block[0]) is at least + 2-byte aligned -- this should be ok since block is really + the first section of arr2. + */ + i = nblock+BZ_N_OVERSHOOT; + if (i & 1) i++; + quadrant = (UInt16*)(&(block[i])); + + /* (wfact-1) / 3 puts the default-factor-30 + transition point at very roughly the same place as + with v0.1 and v0.9.0. + Not that it particularly matters any more, since the + resulting compressed stream is now the same regardless + of whether or not we use the main sort or fallback sort. + */ + if (wfact < 1 ) wfact = 1; + if (wfact > 100) wfact = 100; + budgetInit = nblock * ((wfact-1) / 3); + budget = budgetInit; + + mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); + if (verb >= 3) + VPrintf3 ( " %d work, %d block, ratio %5.2f\n", + budgetInit - budget, + nblock, + (float)(budgetInit - budget) / + (float)(nblock==0 ? 1 : nblock) ); + if (budget < 0) { + if (verb >= 2) + VPrintf0 ( " too repetitive; using fallback" + " sorting algorithm\n" ); + fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); + } + } + + s->origPtr = -1; + for (i = 0; i < s->nblock; i++) + if (ptr[i] == 0) + { s->origPtr = i; break; }; + + AssertH( s->origPtr != -1, 1003 ); +} + + +/*-------------------------------------------------------------*/ +/*--- end blocksort.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/bzlib.c b/externals/bzip2/bzlib.c new file mode 100644 index 0000000..ef86c91 --- /dev/null +++ b/externals/bzip2/bzlib.c @@ -0,0 +1,1572 @@ + +/*-------------------------------------------------------------*/ +/*--- Library top-level functions. ---*/ +/*--- bzlib.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + +/* CHANGES + 0.9.0 -- original version. + 0.9.0a/b -- no changes in this file. + 0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress(). + fixed bzWrite/bzRead to ignore zero-length requests. + fixed bzread to correctly handle read requests after EOF. + wrong parameter order in call to bzDecompressInit in + bzBuffToBuffDecompress. Fixed. +*/ + +#include "bzlib_private.h" + + +/*---------------------------------------------------*/ +/*--- Compression stuff ---*/ +/*---------------------------------------------------*/ + + +/*---------------------------------------------------*/ +#ifndef BZ_NO_STDIO +void BZ2_bz__AssertH__fail ( int errcode ) +{ + fprintf(stderr, + "\n\nbzip2/libbzip2: internal error number %d.\n" + "This is a bug in bzip2/libbzip2, %s.\n" + "Please report it to me at: jseward@bzip.org. If this happened\n" + "when you were using some program which uses libbzip2 as a\n" + "component, you should also report this bug to the author(s)\n" + "of that program. Please make an effort to report this bug;\n" + "timely and accurate bug reports eventually lead to higher\n" + "quality software. Thanks. Julian Seward, 10 December 2007.\n\n", + errcode, + BZ2_bzlibVersion() + ); + + if (errcode == 1007) { + fprintf(stderr, + "\n*** A special note about internal error number 1007 ***\n" + "\n" + "Experience suggests that a common cause of i.e. 1007\n" + "is unreliable memory or other hardware. The 1007 assertion\n" + "just happens to cross-check the results of huge numbers of\n" + "memory reads/writes, and so acts (unintendedly) as a stress\n" + "test of your memory system.\n" + "\n" + "I suggest the following: try compressing the file again,\n" + "possibly monitoring progress in detail with the -vv flag.\n" + "\n" + "* If the error cannot be reproduced, and/or happens at different\n" + " points in compression, you may have a flaky memory system.\n" + " Try a memory-test program. I have used Memtest86\n" + " (www.memtest86.com). At the time of writing it is free (GPLd).\n" + " Memtest86 tests memory much more thorougly than your BIOSs\n" + " power-on test, and may find failures that the BIOS doesn't.\n" + "\n" + "* If the error can be repeatably reproduced, this is a bug in\n" + " bzip2, and I would very much like to hear about it. Please\n" + " let me know, and, ideally, save a copy of the file causing the\n" + " problem -- without which I will be unable to investigate it.\n" + "\n" + ); + } + + exit(3); +} +#endif + + +/*---------------------------------------------------*/ +static +int bz_config_ok ( void ) +{ + if (sizeof(int) != 4) return 0; + if (sizeof(short) != 2) return 0; + if (sizeof(char) != 1) return 0; + return 1; +} + + +/*---------------------------------------------------*/ +static +void* default_bzalloc ( void* opaque, Int32 items, Int32 size ) +{ + void* v = malloc ( items * size ); + return v; +} + +static +void default_bzfree ( void* opaque, void* addr ) +{ + if (addr != NULL) free ( addr ); +} + + +/*---------------------------------------------------*/ +static +void prepare_new_block ( EState* s ) +{ + Int32 i; + s->nblock = 0; + s->numZ = 0; + s->state_out_pos = 0; + BZ_INITIALISE_CRC ( s->blockCRC ); + for (i = 0; i < 256; i++) s->inUse[i] = False; + s->blockNo++; +} + + +/*---------------------------------------------------*/ +static +void init_RL ( EState* s ) +{ + s->state_in_ch = 256; + s->state_in_len = 0; +} + + +static +Bool isempty_RL ( EState* s ) +{ + if (s->state_in_ch < 256 && s->state_in_len > 0) + return False; else + return True; +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzCompressInit) + ( bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor ) +{ + Int32 n; + EState* s; + + if (!bz_config_ok()) return BZ_CONFIG_ERROR; + + if (strm == NULL || + blockSize100k < 1 || blockSize100k > 9 || + workFactor < 0 || workFactor > 250) + return BZ_PARAM_ERROR; + + if (workFactor == 0) workFactor = 30; + if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; + if (strm->bzfree == NULL) strm->bzfree = default_bzfree; + + s = BZALLOC( sizeof(EState) ); + if (s == NULL) return BZ_MEM_ERROR; + s->strm = strm; + + s->arr1 = NULL; + s->arr2 = NULL; + s->ftab = NULL; + + n = 100000 * blockSize100k; + s->arr1 = BZALLOC( n * sizeof(UInt32) ); + s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) ); + s->ftab = BZALLOC( 65537 * sizeof(UInt32) ); + + if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) { + if (s->arr1 != NULL) BZFREE(s->arr1); + if (s->arr2 != NULL) BZFREE(s->arr2); + if (s->ftab != NULL) BZFREE(s->ftab); + if (s != NULL) BZFREE(s); + return BZ_MEM_ERROR; + } + + s->blockNo = 0; + s->state = BZ_S_INPUT; + s->mode = BZ_M_RUNNING; + s->combinedCRC = 0; + s->blockSize100k = blockSize100k; + s->nblockMAX = 100000 * blockSize100k - 19; + s->verbosity = verbosity; + s->workFactor = workFactor; + + s->block = (UChar*)s->arr2; + s->mtfv = (UInt16*)s->arr1; + s->zbits = NULL; + s->ptr = (UInt32*)s->arr1; + + strm->state = s; + strm->total_in_lo32 = 0; + strm->total_in_hi32 = 0; + strm->total_out_lo32 = 0; + strm->total_out_hi32 = 0; + init_RL ( s ); + prepare_new_block ( s ); + return BZ_OK; +} + + +/*---------------------------------------------------*/ +static +void add_pair_to_block ( EState* s ) +{ + Int32 i; + UChar ch = (UChar)(s->state_in_ch); + for (i = 0; i < s->state_in_len; i++) { + BZ_UPDATE_CRC( s->blockCRC, ch ); + } + s->inUse[s->state_in_ch] = True; + switch (s->state_in_len) { + case 1: + s->block[s->nblock] = (UChar)ch; s->nblock++; + break; + case 2: + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + break; + case 3: + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + break; + default: + s->inUse[s->state_in_len-4] = True; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = (UChar)ch; s->nblock++; + s->block[s->nblock] = ((UChar)(s->state_in_len-4)); + s->nblock++; + break; + } +} + + +/*---------------------------------------------------*/ +static +void flush_RL ( EState* s ) +{ + if (s->state_in_ch < 256) add_pair_to_block ( s ); + init_RL ( s ); +} + + +/*---------------------------------------------------*/ +#define ADD_CHAR_TO_BLOCK(zs,zchh0) \ +{ \ + UInt32 zchh = (UInt32)(zchh0); \ + /*-- fast track the common case --*/ \ + if (zchh != zs->state_in_ch && \ + zs->state_in_len == 1) { \ + UChar ch = (UChar)(zs->state_in_ch); \ + BZ_UPDATE_CRC( zs->blockCRC, ch ); \ + zs->inUse[zs->state_in_ch] = True; \ + zs->block[zs->nblock] = (UChar)ch; \ + zs->nblock++; \ + zs->state_in_ch = zchh; \ + } \ + else \ + /*-- general, uncommon cases --*/ \ + if (zchh != zs->state_in_ch || \ + zs->state_in_len == 255) { \ + if (zs->state_in_ch < 256) \ + add_pair_to_block ( zs ); \ + zs->state_in_ch = zchh; \ + zs->state_in_len = 1; \ + } else { \ + zs->state_in_len++; \ + } \ +} + + +/*---------------------------------------------------*/ +static +Bool copy_input_until_stop ( EState* s ) +{ + Bool progress_in = False; + + if (s->mode == BZ_M_RUNNING) { + + /*-- fast track the common case --*/ + while (True) { + /*-- block full? --*/ + if (s->nblock >= s->nblockMAX) break; + /*-- no input? --*/ + if (s->strm->avail_in == 0) break; + progress_in = True; + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + s->strm->next_in++; + s->strm->avail_in--; + s->strm->total_in_lo32++; + if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; + } + + } else { + + /*-- general, uncommon case --*/ + while (True) { + /*-- block full? --*/ + if (s->nblock >= s->nblockMAX) break; + /*-- no input? --*/ + if (s->strm->avail_in == 0) break; + /*-- flush/finish end? --*/ + if (s->avail_in_expect == 0) break; + progress_in = True; + ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); + s->strm->next_in++; + s->strm->avail_in--; + s->strm->total_in_lo32++; + if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; + s->avail_in_expect--; + } + } + return progress_in; +} + + +/*---------------------------------------------------*/ +static +Bool copy_output_until_stop ( EState* s ) +{ + Bool progress_out = False; + + while (True) { + + /*-- no output space? --*/ + if (s->strm->avail_out == 0) break; + + /*-- block done? --*/ + if (s->state_out_pos >= s->numZ) break; + + progress_out = True; + *(s->strm->next_out) = s->zbits[s->state_out_pos]; + s->state_out_pos++; + s->strm->avail_out--; + s->strm->next_out++; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + return progress_out; +} + + +/*---------------------------------------------------*/ +static +Bool handle_compress ( bz_stream* strm ) +{ + Bool progress_in = False; + Bool progress_out = False; + EState* s = strm->state; + + while (True) { + + if (s->state == BZ_S_OUTPUT) { + progress_out |= copy_output_until_stop ( s ); + if (s->state_out_pos < s->numZ) break; + if (s->mode == BZ_M_FINISHING && + s->avail_in_expect == 0 && + isempty_RL(s)) break; + prepare_new_block ( s ); + s->state = BZ_S_INPUT; + if (s->mode == BZ_M_FLUSHING && + s->avail_in_expect == 0 && + isempty_RL(s)) break; + } + + if (s->state == BZ_S_INPUT) { + progress_in |= copy_input_until_stop ( s ); + if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) { + flush_RL ( s ); + BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) ); + s->state = BZ_S_OUTPUT; + } + else + if (s->nblock >= s->nblockMAX) { + BZ2_compressBlock ( s, False ); + s->state = BZ_S_OUTPUT; + } + else + if (s->strm->avail_in == 0) { + break; + } + } + + } + + return progress_in || progress_out; +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) +{ + Bool progress; + EState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + preswitch: + switch (s->mode) { + + case BZ_M_IDLE: + return BZ_SEQUENCE_ERROR; + + case BZ_M_RUNNING: + if (action == BZ_RUN) { + progress = handle_compress ( strm ); + return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; + } + else + if (action == BZ_FLUSH) { + s->avail_in_expect = strm->avail_in; + s->mode = BZ_M_FLUSHING; + goto preswitch; + } + else + if (action == BZ_FINISH) { + s->avail_in_expect = strm->avail_in; + s->mode = BZ_M_FINISHING; + goto preswitch; + } + else + return BZ_PARAM_ERROR; + + case BZ_M_FLUSHING: + if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; + if (s->avail_in_expect != s->strm->avail_in) + return BZ_SEQUENCE_ERROR; + progress = handle_compress ( strm ); + if (s->avail_in_expect > 0 || !isempty_RL(s) || + s->state_out_pos < s->numZ) return BZ_FLUSH_OK; + s->mode = BZ_M_RUNNING; + return BZ_RUN_OK; + + case BZ_M_FINISHING: + if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; + if (s->avail_in_expect != s->strm->avail_in) + return BZ_SEQUENCE_ERROR; + progress = handle_compress ( strm ); + if (!progress) return BZ_SEQUENCE_ERROR; + if (s->avail_in_expect > 0 || !isempty_RL(s) || + s->state_out_pos < s->numZ) return BZ_FINISH_OK; + s->mode = BZ_M_IDLE; + return BZ_STREAM_END; + } + return BZ_OK; /*--not reached--*/ +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) +{ + EState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + if (s->arr1 != NULL) BZFREE(s->arr1); + if (s->arr2 != NULL) BZFREE(s->arr2); + if (s->ftab != NULL) BZFREE(s->ftab); + BZFREE(strm->state); + + strm->state = NULL; + + return BZ_OK; +} + + +/*---------------------------------------------------*/ +/*--- Decompression stuff ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzDecompressInit) + ( bz_stream* strm, + int verbosity, + int small ) +{ + DState* s; + + if (!bz_config_ok()) return BZ_CONFIG_ERROR; + + if (strm == NULL) return BZ_PARAM_ERROR; + if (small != 0 && small != 1) return BZ_PARAM_ERROR; + if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; + + if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; + if (strm->bzfree == NULL) strm->bzfree = default_bzfree; + + s = BZALLOC( sizeof(DState) ); + if (s == NULL) return BZ_MEM_ERROR; + s->strm = strm; + strm->state = s; + s->state = BZ_X_MAGIC_1; + s->bsLive = 0; + s->bsBuff = 0; + s->calculatedCombinedCRC = 0; + strm->total_in_lo32 = 0; + strm->total_in_hi32 = 0; + strm->total_out_lo32 = 0; + strm->total_out_hi32 = 0; + s->smallDecompress = (Bool)small; + s->ll4 = NULL; + s->ll16 = NULL; + s->tt = NULL; + s->currBlockNo = 0; + s->verbosity = verbosity; + + return BZ_OK; +} + + +/*---------------------------------------------------*/ +/* Return True iff data corruption is discovered. + Returns False if there is no problem. +*/ +static +Bool unRLE_obuf_to_output_FAST ( DState* s ) +{ + UChar k1; + + if (s->blockRandomised) { + + while (True) { + /* try to finish existing run */ + while (True) { + if (s->strm->avail_out == 0) return False; + if (s->state_out_len == 0) break; + *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; + BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); + s->state_out_len--; + s->strm->next_out++; + s->strm->avail_out--; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + /* can a new run be started? */ + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; + + s->state_out_len = 1; + s->state_out_ch = s->k0; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 2; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 3; + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + s->state_out_len = ((Int32)k1) + 4; + BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; + s->k0 ^= BZ_RAND_MASK; s->nblock_used++; + } + + } else { + + /* restore */ + UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC; + UChar c_state_out_ch = s->state_out_ch; + Int32 c_state_out_len = s->state_out_len; + Int32 c_nblock_used = s->nblock_used; + Int32 c_k0 = s->k0; + UInt32* c_tt = s->tt; + UInt32 c_tPos = s->tPos; + char* cs_next_out = s->strm->next_out; + unsigned int cs_avail_out = s->strm->avail_out; + Int32 ro_blockSize100k = s->blockSize100k; + /* end restore */ + + UInt32 avail_out_INIT = cs_avail_out; + Int32 s_save_nblockPP = s->save_nblock+1; + unsigned int total_out_lo32_old; + + while (True) { + + /* try to finish existing run */ + if (c_state_out_len > 0) { + while (True) { + if (cs_avail_out == 0) goto return_notr; + if (c_state_out_len == 1) break; + *( (UChar*)(cs_next_out) ) = c_state_out_ch; + BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); + c_state_out_len--; + cs_next_out++; + cs_avail_out--; + } + s_state_out_len_eq_one: + { + if (cs_avail_out == 0) { + c_state_out_len = 1; goto return_notr; + }; + *( (UChar*)(cs_next_out) ) = c_state_out_ch; + BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); + cs_next_out++; + cs_avail_out--; + } + } + /* Only caused by corrupt data stream? */ + if (c_nblock_used > s_save_nblockPP) + return True; + + /* can a new run be started? */ + if (c_nblock_used == s_save_nblockPP) { + c_state_out_len = 0; goto return_notr; + }; + c_state_out_ch = c_k0; + BZ_GET_FAST_C(k1); c_nblock_used++; + if (k1 != c_k0) { + c_k0 = k1; goto s_state_out_len_eq_one; + }; + if (c_nblock_used == s_save_nblockPP) + goto s_state_out_len_eq_one; + + c_state_out_len = 2; + BZ_GET_FAST_C(k1); c_nblock_used++; + if (c_nblock_used == s_save_nblockPP) continue; + if (k1 != c_k0) { c_k0 = k1; continue; }; + + c_state_out_len = 3; + BZ_GET_FAST_C(k1); c_nblock_used++; + if (c_nblock_used == s_save_nblockPP) continue; + if (k1 != c_k0) { c_k0 = k1; continue; }; + + BZ_GET_FAST_C(k1); c_nblock_used++; + c_state_out_len = ((Int32)k1) + 4; + BZ_GET_FAST_C(c_k0); c_nblock_used++; + } + + return_notr: + total_out_lo32_old = s->strm->total_out_lo32; + s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out); + if (s->strm->total_out_lo32 < total_out_lo32_old) + s->strm->total_out_hi32++; + + /* save */ + s->calculatedBlockCRC = c_calculatedBlockCRC; + s->state_out_ch = c_state_out_ch; + s->state_out_len = c_state_out_len; + s->nblock_used = c_nblock_used; + s->k0 = c_k0; + s->tt = c_tt; + s->tPos = c_tPos; + s->strm->next_out = cs_next_out; + s->strm->avail_out = cs_avail_out; + /* end save */ + } + return False; +} + + + +/*---------------------------------------------------*/ +__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab ) +{ + Int32 nb, na, mid; + nb = 0; + na = 256; + do { + mid = (nb + na) >> 1; + if (indx >= cftab[mid]) nb = mid; else na = mid; + } + while (na - nb != 1); + return nb; +} + + +/*---------------------------------------------------*/ +/* Return True iff data corruption is discovered. + Returns False if there is no problem. +*/ +static +Bool unRLE_obuf_to_output_SMALL ( DState* s ) +{ + UChar k1; + + if (s->blockRandomised) { + + while (True) { + /* try to finish existing run */ + while (True) { + if (s->strm->avail_out == 0) return False; + if (s->state_out_len == 0) break; + *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; + BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); + s->state_out_len--; + s->strm->next_out++; + s->strm->avail_out--; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + /* can a new run be started? */ + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; + + s->state_out_len = 1; + s->state_out_ch = s->k0; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 2; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 3; + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; + k1 ^= BZ_RAND_MASK; s->nblock_used++; + s->state_out_len = ((Int32)k1) + 4; + BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; + s->k0 ^= BZ_RAND_MASK; s->nblock_used++; + } + + } else { + + while (True) { + /* try to finish existing run */ + while (True) { + if (s->strm->avail_out == 0) return False; + if (s->state_out_len == 0) break; + *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; + BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); + s->state_out_len--; + s->strm->next_out++; + s->strm->avail_out--; + s->strm->total_out_lo32++; + if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; + } + + /* can a new run be started? */ + if (s->nblock_used == s->save_nblock+1) return False; + + /* Only caused by corrupt data stream? */ + if (s->nblock_used > s->save_nblock+1) + return True; + + s->state_out_len = 1; + s->state_out_ch = s->k0; + BZ_GET_SMALL(k1); s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 2; + BZ_GET_SMALL(k1); s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + s->state_out_len = 3; + BZ_GET_SMALL(k1); s->nblock_used++; + if (s->nblock_used == s->save_nblock+1) continue; + if (k1 != s->k0) { s->k0 = k1; continue; }; + + BZ_GET_SMALL(k1); s->nblock_used++; + s->state_out_len = ((Int32)k1) + 4; + BZ_GET_SMALL(s->k0); s->nblock_used++; + } + + } +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) +{ + Bool corrupt; + DState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + while (True) { + if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; + if (s->state == BZ_X_OUTPUT) { + if (s->smallDecompress) + corrupt = unRLE_obuf_to_output_SMALL ( s ); else + corrupt = unRLE_obuf_to_output_FAST ( s ); + if (corrupt) return BZ_DATA_ERROR; + if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { + BZ_FINALISE_CRC ( s->calculatedBlockCRC ); + if (s->verbosity >= 3) + VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, + s->calculatedBlockCRC ); + if (s->verbosity >= 2) VPrintf0 ( "]" ); + if (s->calculatedBlockCRC != s->storedBlockCRC) + return BZ_DATA_ERROR; + s->calculatedCombinedCRC + = (s->calculatedCombinedCRC << 1) | + (s->calculatedCombinedCRC >> 31); + s->calculatedCombinedCRC ^= s->calculatedBlockCRC; + s->state = BZ_X_BLKHDR_1; + } else { + return BZ_OK; + } + } + if (s->state >= BZ_X_MAGIC_1) { + Int32 r = BZ2_decompress ( s ); + if (r == BZ_STREAM_END) { + if (s->verbosity >= 3) + VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", + s->storedCombinedCRC, s->calculatedCombinedCRC ); + if (s->calculatedCombinedCRC != s->storedCombinedCRC) + return BZ_DATA_ERROR; + return r; + } + if (s->state != BZ_X_OUTPUT) return r; + } + } + + AssertH ( 0, 6001 ); + + return 0; /*NOTREACHED*/ +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) +{ + DState* s; + if (strm == NULL) return BZ_PARAM_ERROR; + s = strm->state; + if (s == NULL) return BZ_PARAM_ERROR; + if (s->strm != strm) return BZ_PARAM_ERROR; + + if (s->tt != NULL) BZFREE(s->tt); + if (s->ll16 != NULL) BZFREE(s->ll16); + if (s->ll4 != NULL) BZFREE(s->ll4); + + BZFREE(strm->state); + strm->state = NULL; + + return BZ_OK; +} + + +#ifndef BZ_NO_STDIO +/*---------------------------------------------------*/ +/*--- File I/O stuff ---*/ +/*---------------------------------------------------*/ + +#define BZ_SETERR(eee) \ +{ \ + if (bzerror != NULL) *bzerror = eee; \ + if (bzf != NULL) bzf->lastErr = eee; \ +} + +typedef + struct { + FILE* handle; + Char buf[BZ_MAX_UNUSED]; + Int32 bufN; + Bool writing; + bz_stream strm; + Int32 lastErr; + Bool initialisedOk; + } + bzFile; + + +/*---------------------------------------------*/ +static Bool myfeof ( FILE* f ) +{ + Int32 c = fgetc ( f ); + if (c == EOF) return True; + ungetc ( c, f ); + return False; +} + + +/*---------------------------------------------------*/ +BZFILE* BZ_API(BZ2_bzWriteOpen) + ( int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor ) +{ + Int32 ret; + bzFile* bzf = NULL; + + BZ_SETERR(BZ_OK); + + if (f == NULL || + (blockSize100k < 1 || blockSize100k > 9) || + (workFactor < 0 || workFactor > 250) || + (verbosity < 0 || verbosity > 4)) + { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; + + if (ferror(f)) + { BZ_SETERR(BZ_IO_ERROR); return NULL; }; + + bzf = malloc ( sizeof(bzFile) ); + if (bzf == NULL) + { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; + + BZ_SETERR(BZ_OK); + bzf->initialisedOk = False; + bzf->bufN = 0; + bzf->handle = f; + bzf->writing = True; + bzf->strm.bzalloc = NULL; + bzf->strm.bzfree = NULL; + bzf->strm.opaque = NULL; + + if (workFactor == 0) workFactor = 30; + ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, + verbosity, workFactor ); + if (ret != BZ_OK) + { BZ_SETERR(ret); free(bzf); return NULL; }; + + bzf->strm.avail_in = 0; + bzf->initialisedOk = True; + return bzf; +} + + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzWrite) + ( int* bzerror, + BZFILE* b, + void* buf, + int len ) +{ + Int32 n, n2, ret; + bzFile* bzf = (bzFile*)b; + + BZ_SETERR(BZ_OK); + if (bzf == NULL || buf == NULL || len < 0) + { BZ_SETERR(BZ_PARAM_ERROR); return; }; + if (!(bzf->writing)) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + + if (len == 0) + { BZ_SETERR(BZ_OK); return; }; + + bzf->strm.avail_in = len; + bzf->strm.next_in = buf; + + while (True) { + bzf->strm.avail_out = BZ_MAX_UNUSED; + bzf->strm.next_out = bzf->buf; + ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN ); + if (ret != BZ_RUN_OK) + { BZ_SETERR(ret); return; }; + + if (bzf->strm.avail_out < BZ_MAX_UNUSED) { + n = BZ_MAX_UNUSED - bzf->strm.avail_out; + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n, bzf->handle ); + if (n != n2 || ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + } + + if (bzf->strm.avail_in == 0) + { BZ_SETERR(BZ_OK); return; }; + } +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzWriteClose) + ( int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out ) +{ + BZ2_bzWriteClose64 ( bzerror, b, abandon, + nbytes_in, NULL, nbytes_out, NULL ); +} + + +void BZ_API(BZ2_bzWriteClose64) + ( int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 ) +{ + Int32 n, n2, ret; + bzFile* bzf = (bzFile*)b; + + if (bzf == NULL) + { BZ_SETERR(BZ_OK); return; }; + if (!(bzf->writing)) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + + if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0; + if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0; + if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0; + if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0; + + if ((!abandon) && bzf->lastErr == BZ_OK) { + while (True) { + bzf->strm.avail_out = BZ_MAX_UNUSED; + bzf->strm.next_out = bzf->buf; + ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH ); + if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END) + { BZ_SETERR(ret); return; }; + + if (bzf->strm.avail_out < BZ_MAX_UNUSED) { + n = BZ_MAX_UNUSED - bzf->strm.avail_out; + n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), + n, bzf->handle ); + if (n != n2 || ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + } + + if (ret == BZ_STREAM_END) break; + } + } + + if ( !abandon && !ferror ( bzf->handle ) ) { + fflush ( bzf->handle ); + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return; }; + } + + if (nbytes_in_lo32 != NULL) + *nbytes_in_lo32 = bzf->strm.total_in_lo32; + if (nbytes_in_hi32 != NULL) + *nbytes_in_hi32 = bzf->strm.total_in_hi32; + if (nbytes_out_lo32 != NULL) + *nbytes_out_lo32 = bzf->strm.total_out_lo32; + if (nbytes_out_hi32 != NULL) + *nbytes_out_hi32 = bzf->strm.total_out_hi32; + + BZ_SETERR(BZ_OK); + BZ2_bzCompressEnd ( &(bzf->strm) ); + free ( bzf ); +} + + +/*---------------------------------------------------*/ +BZFILE* BZ_API(BZ2_bzReadOpen) + ( int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused ) +{ + bzFile* bzf = NULL; + int ret; + + BZ_SETERR(BZ_OK); + + if (f == NULL || + (small != 0 && small != 1) || + (verbosity < 0 || verbosity > 4) || + (unused == NULL && nUnused != 0) || + (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED))) + { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; + + if (ferror(f)) + { BZ_SETERR(BZ_IO_ERROR); return NULL; }; + + bzf = malloc ( sizeof(bzFile) ); + if (bzf == NULL) + { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; + + BZ_SETERR(BZ_OK); + + bzf->initialisedOk = False; + bzf->handle = f; + bzf->bufN = 0; + bzf->writing = False; + bzf->strm.bzalloc = NULL; + bzf->strm.bzfree = NULL; + bzf->strm.opaque = NULL; + + while (nUnused > 0) { + bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; + unused = ((void*)( 1 + ((UChar*)(unused)) )); + nUnused--; + } + + ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small ); + if (ret != BZ_OK) + { BZ_SETERR(ret); free(bzf); return NULL; }; + + bzf->strm.avail_in = bzf->bufN; + bzf->strm.next_in = bzf->buf; + + bzf->initialisedOk = True; + return bzf; +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) +{ + bzFile* bzf = (bzFile*)b; + + BZ_SETERR(BZ_OK); + if (bzf == NULL) + { BZ_SETERR(BZ_OK); return; }; + + if (bzf->writing) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + + if (bzf->initialisedOk) + (void)BZ2_bzDecompressEnd ( &(bzf->strm) ); + free ( bzf ); +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzRead) + ( int* bzerror, + BZFILE* b, + void* buf, + int len ) +{ + Int32 n, ret; + bzFile* bzf = (bzFile*)b; + + BZ_SETERR(BZ_OK); + + if (bzf == NULL || buf == NULL || len < 0) + { BZ_SETERR(BZ_PARAM_ERROR); return 0; }; + + if (bzf->writing) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; }; + + if (len == 0) + { BZ_SETERR(BZ_OK); return 0; }; + + bzf->strm.avail_out = len; + bzf->strm.next_out = buf; + + while (True) { + + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return 0; }; + + if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { + n = fread ( bzf->buf, sizeof(UChar), + BZ_MAX_UNUSED, bzf->handle ); + if (ferror(bzf->handle)) + { BZ_SETERR(BZ_IO_ERROR); return 0; }; + bzf->bufN = n; + bzf->strm.avail_in = bzf->bufN; + bzf->strm.next_in = bzf->buf; + } + + ret = BZ2_bzDecompress ( &(bzf->strm) ); + + if (ret != BZ_OK && ret != BZ_STREAM_END) + { BZ_SETERR(ret); return 0; }; + + if (ret == BZ_OK && myfeof(bzf->handle) && + bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) + { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; + + if (ret == BZ_STREAM_END) + { BZ_SETERR(BZ_STREAM_END); + return len - bzf->strm.avail_out; }; + if (bzf->strm.avail_out == 0) + { BZ_SETERR(BZ_OK); return len; }; + + } + + return 0; /*not reached*/ +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzReadGetUnused) + ( int* bzerror, + BZFILE* b, + void** unused, + int* nUnused ) +{ + bzFile* bzf = (bzFile*)b; + if (bzf == NULL) + { BZ_SETERR(BZ_PARAM_ERROR); return; }; + if (bzf->lastErr != BZ_STREAM_END) + { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; + if (unused == NULL || nUnused == NULL) + { BZ_SETERR(BZ_PARAM_ERROR); return; }; + + BZ_SETERR(BZ_OK); + *nUnused = bzf->strm.avail_in; + *unused = bzf->strm.next_in; +} +#endif + + +/*---------------------------------------------------*/ +/*--- Misc convenience stuff ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzBuffToBuffCompress) + ( char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor ) +{ + bz_stream strm; + int ret; + + if (dest == NULL || destLen == NULL || + source == NULL || + blockSize100k < 1 || blockSize100k > 9 || + verbosity < 0 || verbosity > 4 || + workFactor < 0 || workFactor > 250) + return BZ_PARAM_ERROR; + + if (workFactor == 0) workFactor = 30; + strm.bzalloc = NULL; + strm.bzfree = NULL; + strm.opaque = NULL; + ret = BZ2_bzCompressInit ( &strm, blockSize100k, + verbosity, workFactor ); + if (ret != BZ_OK) return ret; + + strm.next_in = source; + strm.next_out = dest; + strm.avail_in = sourceLen; + strm.avail_out = *destLen; + + ret = BZ2_bzCompress ( &strm, BZ_FINISH ); + if (ret == BZ_FINISH_OK) goto output_overflow; + if (ret != BZ_STREAM_END) goto errhandler; + + /* normal termination */ + *destLen -= strm.avail_out; + BZ2_bzCompressEnd ( &strm ); + return BZ_OK; + + output_overflow: + BZ2_bzCompressEnd ( &strm ); + return BZ_OUTBUFF_FULL; + + errhandler: + BZ2_bzCompressEnd ( &strm ); + return ret; +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzBuffToBuffDecompress) + ( char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity ) +{ + bz_stream strm; + int ret; + + if (dest == NULL || destLen == NULL || + source == NULL || + (small != 0 && small != 1) || + verbosity < 0 || verbosity > 4) + return BZ_PARAM_ERROR; + + strm.bzalloc = NULL; + strm.bzfree = NULL; + strm.opaque = NULL; + ret = BZ2_bzDecompressInit ( &strm, verbosity, small ); + if (ret != BZ_OK) return ret; + + strm.next_in = source; + strm.next_out = dest; + strm.avail_in = sourceLen; + strm.avail_out = *destLen; + + ret = BZ2_bzDecompress ( &strm ); + if (ret == BZ_OK) goto output_overflow_or_eof; + if (ret != BZ_STREAM_END) goto errhandler; + + /* normal termination */ + *destLen -= strm.avail_out; + BZ2_bzDecompressEnd ( &strm ); + return BZ_OK; + + output_overflow_or_eof: + if (strm.avail_out > 0) { + BZ2_bzDecompressEnd ( &strm ); + return BZ_UNEXPECTED_EOF; + } else { + BZ2_bzDecompressEnd ( &strm ); + return BZ_OUTBUFF_FULL; + }; + + errhandler: + BZ2_bzDecompressEnd ( &strm ); + return ret; +} + + +/*---------------------------------------------------*/ +/*-- + Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +/*-- + return version like "0.9.5d, 4-Sept-1999". +--*/ +const char * BZ_API(BZ2_bzlibVersion)(void) +{ + return BZ_VERSION; +} + + +#ifndef BZ_NO_STDIO +/*---------------------------------------------------*/ + +#if defined(_WIN32) || defined(OS2) || defined(MSDOS) +# include +# include +# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) +#else +# define SET_BINARY_MODE(file) +#endif +static +BZFILE * bzopen_or_bzdopen + ( const char *path, /* no use when bzdopen */ + int fd, /* no use when bzdopen */ + const char *mode, + int open_mode) /* bzopen: 0, bzdopen:1 */ +{ + int bzerr; + char unused[BZ_MAX_UNUSED]; + int blockSize100k = 9; + int writing = 0; + char mode2[10] = ""; + FILE *fp = NULL; + BZFILE *bzfp = NULL; + int verbosity = 0; + int workFactor = 30; + int smallMode = 0; + int nUnused = 0; + + if (mode == NULL) return NULL; + while (*mode) { + switch (*mode) { + case 'r': + writing = 0; break; + case 'w': + writing = 1; break; + case 's': + smallMode = 1; break; + default: + if (isdigit((int)(*mode))) { + blockSize100k = *mode-BZ_HDR_0; + } + } + mode++; + } + strcat(mode2, writing ? "w" : "r" ); + strcat(mode2,"b"); /* binary mode */ + + if (open_mode==0) { + if (path==NULL || strcmp(path,"")==0) { + fp = (writing ? stdout : stdin); + SET_BINARY_MODE(fp); + } else { + fp = fopen(path,mode2); + } + } else { +#ifdef BZ_STRICT_ANSI + fp = NULL; +#else + fp = fdopen(fd,mode2); +#endif + } + if (fp == NULL) return NULL; + + if (writing) { + /* Guard against total chaos and anarchy -- JRS */ + if (blockSize100k < 1) blockSize100k = 1; + if (blockSize100k > 9) blockSize100k = 9; + bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, + verbosity,workFactor); + } else { + bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode, + unused,nUnused); + } + if (bzfp == NULL) { + if (fp != stdin && fp != stdout) fclose(fp); + return NULL; + } + return bzfp; +} + + +/*---------------------------------------------------*/ +/*-- + open file for read or write. + ex) bzopen("file","w9") + case path="" or NULL => use stdin or stdout. +--*/ +BZFILE * BZ_API(BZ2_bzopen) + ( const char *path, + const char *mode ) +{ + return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0); +} + + +/*---------------------------------------------------*/ +BZFILE * BZ_API(BZ2_bzdopen) + ( int fd, + const char *mode ) +{ + return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1); +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len ) +{ + int bzerr, nread; + if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0; + nread = BZ2_bzRead(&bzerr,b,buf,len); + if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) { + return nread; + } else { + return -1; + } +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len ) +{ + int bzerr; + + BZ2_bzWrite(&bzerr,b,buf,len); + if(bzerr == BZ_OK){ + return len; + }else{ + return -1; + } +} + + +/*---------------------------------------------------*/ +int BZ_API(BZ2_bzflush) (BZFILE *b) +{ + /* do nothing now... */ + return 0; +} + + +/*---------------------------------------------------*/ +void BZ_API(BZ2_bzclose) (BZFILE* b) +{ + int bzerr; + FILE *fp; + + if (b==NULL) {return;} + fp = ((bzFile *)b)->handle; + if(((bzFile*)b)->writing){ + BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); + if(bzerr != BZ_OK){ + BZ2_bzWriteClose(NULL,b,1,NULL,NULL); + } + }else{ + BZ2_bzReadClose(&bzerr,b); + } + if(fp!=stdin && fp!=stdout){ + fclose(fp); + } +} + + +/*---------------------------------------------------*/ +/*-- + return last error code +--*/ +static const char *bzerrorstrings[] = { + "OK" + ,"SEQUENCE_ERROR" + ,"PARAM_ERROR" + ,"MEM_ERROR" + ,"DATA_ERROR" + ,"DATA_ERROR_MAGIC" + ,"IO_ERROR" + ,"UNEXPECTED_EOF" + ,"OUTBUFF_FULL" + ,"CONFIG_ERROR" + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ +}; + + +const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum) +{ + int err = ((bzFile *)b)->lastErr; + + if(err>0) err = 0; + *errnum = err; + return bzerrorstrings[err*-1]; +} +#endif + + +/*-------------------------------------------------------------*/ +/*--- end bzlib.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/bzlib.h b/externals/bzip2/bzlib.h new file mode 100644 index 0000000..c5b75d6 --- /dev/null +++ b/externals/bzip2/bzlib.h @@ -0,0 +1,282 @@ + +/*-------------------------------------------------------------*/ +/*--- Public header file for the library. ---*/ +/*--- bzlib.h ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#ifndef _BZLIB_H +#define _BZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BZ_RUN 0 +#define BZ_FLUSH 1 +#define BZ_FINISH 2 + +#define BZ_OK 0 +#define BZ_RUN_OK 1 +#define BZ_FLUSH_OK 2 +#define BZ_FINISH_OK 3 +#define BZ_STREAM_END 4 +#define BZ_SEQUENCE_ERROR (-1) +#define BZ_PARAM_ERROR (-2) +#define BZ_MEM_ERROR (-3) +#define BZ_DATA_ERROR (-4) +#define BZ_DATA_ERROR_MAGIC (-5) +#define BZ_IO_ERROR (-6) +#define BZ_UNEXPECTED_EOF (-7) +#define BZ_OUTBUFF_FULL (-8) +#define BZ_CONFIG_ERROR (-9) + +typedef + struct { + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *,int,int); + void (*bzfree)(void *,void *); + void *opaque; + } + bz_stream; + + +#ifndef BZ_IMPORT +#define BZ_EXPORT +#endif + +#ifndef BZ_NO_STDIO +/* Need a definitition for FILE */ +#include +#endif + +#ifdef _WIN32 +# include +# ifdef small + /* windows.h define small to char */ +# undef small +# endif +# ifdef BZ_EXPORT +# define BZ_API(func) WINAPI func +# define BZ_EXTERN extern +# else + /* import windows dll dynamically */ +# define BZ_API(func) (WINAPI * func) +# define BZ_EXTERN +# endif +#else +# define BZ_API(func) func +# define BZ_EXTERN extern +#endif + + +/*-- Core (low-level) library functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, + int small + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm + ); + + + +/*-- High(er) level library functions --*/ + +#ifndef BZ_NO_STDIO +#define BZ_MAX_UNUSED 5000 + +typedef void BZFILE; + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused + ); + +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 + ); +#endif + + +/*-- Utility functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity + ); + + +/*-- + Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ + +BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( + void + ); + +#ifndef BZ_NO_STDIO +BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( + const char *path, + const char *mode + ); + +BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( + int fd, + const char *mode + ); + +BZ_EXTERN int BZ_API(BZ2_bzread) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzwrite) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzflush) ( + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzclose) ( + BZFILE* b + ); + +BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( + BZFILE *b, + int *errnum + ); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/*-------------------------------------------------------------*/ +/*--- end bzlib.h ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/bzlib_private.h b/externals/bzip2/bzlib_private.h new file mode 100644 index 0000000..2342787 --- /dev/null +++ b/externals/bzip2/bzlib_private.h @@ -0,0 +1,509 @@ + +/*-------------------------------------------------------------*/ +/*--- Private header file for the library. ---*/ +/*--- bzlib_private.h ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#ifndef _BZLIB_PRIVATE_H +#define _BZLIB_PRIVATE_H + +#include + +#ifndef BZ_NO_STDIO +#include +#include +#include +#endif + +#include "bzlib.h" + + + +/*-- General stuff. --*/ + +#define BZ_VERSION "1.0.5, 10-Dec-2007" + +typedef char Char; +typedef unsigned char Bool; +typedef unsigned char UChar; +typedef int Int32; +typedef unsigned int UInt32; +typedef short Int16; +typedef unsigned short UInt16; + +#define True ((Bool)1) +#define False ((Bool)0) + +#ifndef __GNUC__ +#define __inline__ /* */ +#endif + +#ifndef BZ_NO_STDIO + +extern void BZ2_bz__AssertH__fail ( int errcode ); +#define AssertH(cond,errcode) \ + { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } + +#if BZ_DEBUG +#define AssertD(cond,msg) \ + { if (!(cond)) { \ + fprintf ( stderr, \ + "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\ + exit(1); \ + }} +#else +#define AssertD(cond,msg) /* */ +#endif + +#define VPrintf0(zf) \ + fprintf(stderr,zf) +#define VPrintf1(zf,za1) \ + fprintf(stderr,zf,za1) +#define VPrintf2(zf,za1,za2) \ + fprintf(stderr,zf,za1,za2) +#define VPrintf3(zf,za1,za2,za3) \ + fprintf(stderr,zf,za1,za2,za3) +#define VPrintf4(zf,za1,za2,za3,za4) \ + fprintf(stderr,zf,za1,za2,za3,za4) +#define VPrintf5(zf,za1,za2,za3,za4,za5) \ + fprintf(stderr,zf,za1,za2,za3,za4,za5) + +#else + +extern void bz_internal_error ( int errcode ); +#define AssertH(cond,errcode) \ + { if (!(cond)) bz_internal_error ( errcode ); } +#define AssertD(cond,msg) do { } while (0) +#define VPrintf0(zf) do { } while (0) +#define VPrintf1(zf,za1) do { } while (0) +#define VPrintf2(zf,za1,za2) do { } while (0) +#define VPrintf3(zf,za1,za2,za3) do { } while (0) +#define VPrintf4(zf,za1,za2,za3,za4) do { } while (0) +#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0) + +#endif + + +#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1) +#define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp)) + + +/*-- Header bytes. --*/ + +#define BZ_HDR_B 0x42 /* 'B' */ +#define BZ_HDR_Z 0x5a /* 'Z' */ +#define BZ_HDR_h 0x68 /* 'h' */ +#define BZ_HDR_0 0x30 /* '0' */ + +/*-- Constants for the back end. --*/ + +#define BZ_MAX_ALPHA_SIZE 258 +#define BZ_MAX_CODE_LEN 23 + +#define BZ_RUNA 0 +#define BZ_RUNB 1 + +#define BZ_N_GROUPS 6 +#define BZ_G_SIZE 50 +#define BZ_N_ITERS 4 + +#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE)) + + + +/*-- Stuff for randomising repetitive blocks. --*/ + +extern Int32 BZ2_rNums[512]; + +#define BZ_RAND_DECLS \ + Int32 rNToGo; \ + Int32 rTPos \ + +#define BZ_RAND_INIT_MASK \ + s->rNToGo = 0; \ + s->rTPos = 0 \ + +#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0) + +#define BZ_RAND_UPD_MASK \ + if (s->rNToGo == 0) { \ + s->rNToGo = BZ2_rNums[s->rTPos]; \ + s->rTPos++; \ + if (s->rTPos == 512) s->rTPos = 0; \ + } \ + s->rNToGo--; + + + +/*-- Stuff for doing CRCs. --*/ + +extern UInt32 BZ2_crc32Table[256]; + +#define BZ_INITIALISE_CRC(crcVar) \ +{ \ + crcVar = 0xffffffffL; \ +} + +#define BZ_FINALISE_CRC(crcVar) \ +{ \ + crcVar = ~(crcVar); \ +} + +#define BZ_UPDATE_CRC(crcVar,cha) \ +{ \ + crcVar = (crcVar << 8) ^ \ + BZ2_crc32Table[(crcVar >> 24) ^ \ + ((UChar)cha)]; \ +} + + + +/*-- States and modes for compression. --*/ + +#define BZ_M_IDLE 1 +#define BZ_M_RUNNING 2 +#define BZ_M_FLUSHING 3 +#define BZ_M_FINISHING 4 + +#define BZ_S_OUTPUT 1 +#define BZ_S_INPUT 2 + +#define BZ_N_RADIX 2 +#define BZ_N_QSORT 12 +#define BZ_N_SHELL 18 +#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2) + + + + +/*-- Structure holding all the compression-side stuff. --*/ + +typedef + struct { + /* pointer back to the struct bz_stream */ + bz_stream* strm; + + /* mode this stream is in, and whether inputting */ + /* or outputting data */ + Int32 mode; + Int32 state; + + /* remembers avail_in when flush/finish requested */ + UInt32 avail_in_expect; + + /* for doing the block sorting */ + UInt32* arr1; + UInt32* arr2; + UInt32* ftab; + Int32 origPtr; + + /* aliases for arr1 and arr2 */ + UInt32* ptr; + UChar* block; + UInt16* mtfv; + UChar* zbits; + + /* for deciding when to use the fallback sorting algorithm */ + Int32 workFactor; + + /* run-length-encoding of the input */ + UInt32 state_in_ch; + Int32 state_in_len; + BZ_RAND_DECLS; + + /* input and output limits and current posns */ + Int32 nblock; + Int32 nblockMAX; + Int32 numZ; + Int32 state_out_pos; + + /* map of bytes used in block */ + Int32 nInUse; + Bool inUse[256]; + UChar unseqToSeq[256]; + + /* the buffer for bit stream creation */ + UInt32 bsBuff; + Int32 bsLive; + + /* block and combined CRCs */ + UInt32 blockCRC; + UInt32 combinedCRC; + + /* misc administratium */ + Int32 verbosity; + Int32 blockNo; + Int32 blockSize100k; + + /* stuff for coding the MTF values */ + Int32 nMTF; + Int32 mtfFreq [BZ_MAX_ALPHA_SIZE]; + UChar selector [BZ_MAX_SELECTORS]; + UChar selectorMtf[BZ_MAX_SELECTORS]; + + UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + /* second dimension: only 3 needed; 4 makes index calculations faster */ + UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4]; + + } + EState; + + + +/*-- externs for compression. --*/ + +extern void +BZ2_blockSort ( EState* ); + +extern void +BZ2_compressBlock ( EState*, Bool ); + +extern void +BZ2_bsInitWrite ( EState* ); + +extern void +BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); + +extern void +BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); + + + +/*-- states for decompression. --*/ + +#define BZ_X_IDLE 1 +#define BZ_X_OUTPUT 2 + +#define BZ_X_MAGIC_1 10 +#define BZ_X_MAGIC_2 11 +#define BZ_X_MAGIC_3 12 +#define BZ_X_MAGIC_4 13 +#define BZ_X_BLKHDR_1 14 +#define BZ_X_BLKHDR_2 15 +#define BZ_X_BLKHDR_3 16 +#define BZ_X_BLKHDR_4 17 +#define BZ_X_BLKHDR_5 18 +#define BZ_X_BLKHDR_6 19 +#define BZ_X_BCRC_1 20 +#define BZ_X_BCRC_2 21 +#define BZ_X_BCRC_3 22 +#define BZ_X_BCRC_4 23 +#define BZ_X_RANDBIT 24 +#define BZ_X_ORIGPTR_1 25 +#define BZ_X_ORIGPTR_2 26 +#define BZ_X_ORIGPTR_3 27 +#define BZ_X_MAPPING_1 28 +#define BZ_X_MAPPING_2 29 +#define BZ_X_SELECTOR_1 30 +#define BZ_X_SELECTOR_2 31 +#define BZ_X_SELECTOR_3 32 +#define BZ_X_CODING_1 33 +#define BZ_X_CODING_2 34 +#define BZ_X_CODING_3 35 +#define BZ_X_MTF_1 36 +#define BZ_X_MTF_2 37 +#define BZ_X_MTF_3 38 +#define BZ_X_MTF_4 39 +#define BZ_X_MTF_5 40 +#define BZ_X_MTF_6 41 +#define BZ_X_ENDHDR_2 42 +#define BZ_X_ENDHDR_3 43 +#define BZ_X_ENDHDR_4 44 +#define BZ_X_ENDHDR_5 45 +#define BZ_X_ENDHDR_6 46 +#define BZ_X_CCRC_1 47 +#define BZ_X_CCRC_2 48 +#define BZ_X_CCRC_3 49 +#define BZ_X_CCRC_4 50 + + + +/*-- Constants for the fast MTF decoder. --*/ + +#define MTFA_SIZE 4096 +#define MTFL_SIZE 16 + + + +/*-- Structure holding all the decompression-side stuff. --*/ + +typedef + struct { + /* pointer back to the struct bz_stream */ + bz_stream* strm; + + /* state indicator for this stream */ + Int32 state; + + /* for doing the final run-length decoding */ + UChar state_out_ch; + Int32 state_out_len; + Bool blockRandomised; + BZ_RAND_DECLS; + + /* the buffer for bit stream reading */ + UInt32 bsBuff; + Int32 bsLive; + + /* misc administratium */ + Int32 blockSize100k; + Bool smallDecompress; + Int32 currBlockNo; + Int32 verbosity; + + /* for undoing the Burrows-Wheeler transform */ + Int32 origPtr; + UInt32 tPos; + Int32 k0; + Int32 unzftab[256]; + Int32 nblock_used; + Int32 cftab[257]; + Int32 cftabCopy[257]; + + /* for undoing the Burrows-Wheeler transform (FAST) */ + UInt32 *tt; + + /* for undoing the Burrows-Wheeler transform (SMALL) */ + UInt16 *ll16; + UChar *ll4; + + /* stored and calculated CRCs */ + UInt32 storedBlockCRC; + UInt32 storedCombinedCRC; + UInt32 calculatedBlockCRC; + UInt32 calculatedCombinedCRC; + + /* map of bytes used in block */ + Int32 nInUse; + Bool inUse[256]; + Bool inUse16[16]; + UChar seqToUnseq[256]; + + /* for decoding the MTF values */ + UChar mtfa [MTFA_SIZE]; + Int32 mtfbase[256 / MTFL_SIZE]; + UChar selector [BZ_MAX_SELECTORS]; + UChar selectorMtf[BZ_MAX_SELECTORS]; + UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + + Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 minLens[BZ_N_GROUPS]; + + /* save area for scalars in the main decompress code */ + Int32 save_i; + Int32 save_j; + Int32 save_t; + Int32 save_alphaSize; + Int32 save_nGroups; + Int32 save_nSelectors; + Int32 save_EOB; + Int32 save_groupNo; + Int32 save_groupPos; + Int32 save_nextSym; + Int32 save_nblockMAX; + Int32 save_nblock; + Int32 save_es; + Int32 save_N; + Int32 save_curr; + Int32 save_zt; + Int32 save_zn; + Int32 save_zvec; + Int32 save_zj; + Int32 save_gSel; + Int32 save_gMinlen; + Int32* save_gLimit; + Int32* save_gBase; + Int32* save_gPerm; + + } + DState; + + + +/*-- Macros for decompression. --*/ + +#define BZ_GET_FAST(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ + s->tPos = s->tt[s->tPos]; \ + cccc = (UChar)(s->tPos & 0xff); \ + s->tPos >>= 8; + +#define BZ_GET_FAST_C(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \ + c_tPos = c_tt[c_tPos]; \ + cccc = (UChar)(c_tPos & 0xff); \ + c_tPos >>= 8; + +#define SET_LL4(i,n) \ + { if (((i) & 0x1) == 0) \ + s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \ + s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \ + } + +#define GET_LL4(i) \ + ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF) + +#define SET_LL(i,n) \ + { s->ll16[i] = (UInt16)(n & 0x0000ffff); \ + SET_LL4(i, n >> 16); \ + } + +#define GET_LL(i) \ + (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) + +#define BZ_GET_SMALL(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ + cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ + s->tPos = GET_LL(s->tPos); + + +/*-- externs for decompression. --*/ + +extern Int32 +BZ2_indexIntoF ( Int32, Int32* ); + +extern Int32 +BZ2_decompress ( DState* ); + +extern void +BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, + Int32, Int32, Int32 ); + + +#endif + + +/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ + +#ifdef BZ_NO_STDIO +#ifndef NULL +#define NULL 0 +#endif +#endif + + +/*-------------------------------------------------------------*/ +/*--- end bzlib_private.h ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/compress.c b/externals/bzip2/compress.c new file mode 100644 index 0000000..8c80a07 --- /dev/null +++ b/externals/bzip2/compress.c @@ -0,0 +1,672 @@ + +/*-------------------------------------------------------------*/ +/*--- Compression machinery (not incl block sorting) ---*/ +/*--- compress.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +/* CHANGES + 0.9.0 -- original version. + 0.9.0a/b -- no changes in this file. + 0.9.0c -- changed setting of nGroups in sendMTFValues() + so as to do a bit better on small files +*/ + +#include "bzlib_private.h" + + +/*---------------------------------------------------*/ +/*--- Bit stream I/O ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +void BZ2_bsInitWrite ( EState* s ) +{ + s->bsLive = 0; + s->bsBuff = 0; +} + + +/*---------------------------------------------------*/ +static +void bsFinishWrite ( EState* s ) +{ + while (s->bsLive > 0) { + s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24); + s->numZ++; + s->bsBuff <<= 8; + s->bsLive -= 8; + } +} + + +/*---------------------------------------------------*/ +#define bsNEEDW(nz) \ +{ \ + while (s->bsLive >= 8) { \ + s->zbits[s->numZ] \ + = (UChar)(s->bsBuff >> 24); \ + s->numZ++; \ + s->bsBuff <<= 8; \ + s->bsLive -= 8; \ + } \ +} + + +/*---------------------------------------------------*/ +static +__inline__ +void bsW ( EState* s, Int32 n, UInt32 v ) +{ + bsNEEDW ( n ); + s->bsBuff |= (v << (32 - s->bsLive - n)); + s->bsLive += n; +} + + +/*---------------------------------------------------*/ +static +void bsPutUInt32 ( EState* s, UInt32 u ) +{ + bsW ( s, 8, (u >> 24) & 0xffL ); + bsW ( s, 8, (u >> 16) & 0xffL ); + bsW ( s, 8, (u >> 8) & 0xffL ); + bsW ( s, 8, u & 0xffL ); +} + + +/*---------------------------------------------------*/ +static +void bsPutUChar ( EState* s, UChar c ) +{ + bsW( s, 8, (UInt32)c ); +} + + +/*---------------------------------------------------*/ +/*--- The back end proper ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------------*/ +static +void makeMaps_e ( EState* s ) +{ + Int32 i; + s->nInUse = 0; + for (i = 0; i < 256; i++) + if (s->inUse[i]) { + s->unseqToSeq[i] = s->nInUse; + s->nInUse++; + } +} + + +/*---------------------------------------------------*/ +static +void generateMTFValues ( EState* s ) +{ + UChar yy[256]; + Int32 i, j; + Int32 zPend; + Int32 wr; + Int32 EOB; + + /* + After sorting (eg, here), + s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, + and + ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] + holds the original block data. + + The first thing to do is generate the MTF values, + and put them in + ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ]. + Because there are strictly fewer or equal MTF values + than block values, ptr values in this area are overwritten + with MTF values only when they are no longer needed. + + The final compressed bitstream is generated into the + area starting at + (UChar*) (&((UChar*)s->arr2)[s->nblock]) + + These storage aliases are set up in bzCompressInit(), + except for the last one, which is arranged in + compressBlock(). + */ + UInt32* ptr = s->ptr; + UChar* block = s->block; + UInt16* mtfv = s->mtfv; + + makeMaps_e ( s ); + EOB = s->nInUse+1; + + for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0; + + wr = 0; + zPend = 0; + for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i; + + for (i = 0; i < s->nblock; i++) { + UChar ll_i; + AssertD ( wr <= i, "generateMTFValues(1)" ); + j = ptr[i]-1; if (j < 0) j += s->nblock; + ll_i = s->unseqToSeq[block[j]]; + AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); + + if (yy[0] == ll_i) { + zPend++; + } else { + + if (zPend > 0) { + zPend--; + while (True) { + if (zPend & 1) { + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; + } else { + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; + } + if (zPend < 2) break; + zPend = (zPend - 2) / 2; + }; + zPend = 0; + } + { + register UChar rtmp; + register UChar* ryy_j; + register UChar rll_i; + rtmp = yy[1]; + yy[1] = yy[0]; + ryy_j = &(yy[1]); + rll_i = ll_i; + while ( rll_i != rtmp ) { + register UChar rtmp2; + ryy_j++; + rtmp2 = rtmp; + rtmp = *ryy_j; + *ryy_j = rtmp2; + }; + yy[0] = rtmp; + j = ryy_j - &(yy[0]); + mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++; + } + + } + } + + if (zPend > 0) { + zPend--; + while (True) { + if (zPend & 1) { + mtfv[wr] = BZ_RUNB; wr++; + s->mtfFreq[BZ_RUNB]++; + } else { + mtfv[wr] = BZ_RUNA; wr++; + s->mtfFreq[BZ_RUNA]++; + } + if (zPend < 2) break; + zPend = (zPend - 2) / 2; + }; + zPend = 0; + } + + mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++; + + s->nMTF = wr; +} + + +/*---------------------------------------------------*/ +#define BZ_LESSER_ICOST 0 +#define BZ_GREATER_ICOST 15 + +static +void sendMTFValues ( EState* s ) +{ + Int32 v, t, i, j, gs, ge, totc, bt, bc, iter; + Int32 nSelectors, alphaSize, minLen, maxLen, selCtr; + Int32 nGroups, nBytes; + + /*-- + UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + is a global since the decoder also needs it. + + Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + are also globals only used in this proc. + Made global to keep stack frame size small. + --*/ + + + UInt16 cost[BZ_N_GROUPS]; + Int32 fave[BZ_N_GROUPS]; + + UInt16* mtfv = s->mtfv; + + if (s->verbosity >= 3) + VPrintf3( " %d in block, %d after MTF & 1-2 coding, " + "%d+2 syms in use\n", + s->nblock, s->nMTF, s->nInUse ); + + alphaSize = s->nInUse+2; + for (t = 0; t < BZ_N_GROUPS; t++) + for (v = 0; v < alphaSize; v++) + s->len[t][v] = BZ_GREATER_ICOST; + + /*--- Decide how many coding tables to use ---*/ + AssertH ( s->nMTF > 0, 3001 ); + if (s->nMTF < 200) nGroups = 2; else + if (s->nMTF < 600) nGroups = 3; else + if (s->nMTF < 1200) nGroups = 4; else + if (s->nMTF < 2400) nGroups = 5; else + nGroups = 6; + + /*--- Generate an initial set of coding tables ---*/ + { + Int32 nPart, remF, tFreq, aFreq; + + nPart = nGroups; + remF = s->nMTF; + gs = 0; + while (nPart > 0) { + tFreq = remF / nPart; + ge = gs-1; + aFreq = 0; + while (aFreq < tFreq && ge < alphaSize-1) { + ge++; + aFreq += s->mtfFreq[ge]; + } + + if (ge > gs + && nPart != nGroups && nPart != 1 + && ((nGroups-nPart) % 2 == 1)) { + aFreq -= s->mtfFreq[ge]; + ge--; + } + + if (s->verbosity >= 3) + VPrintf5( " initial group %d, [%d .. %d], " + "has %d syms (%4.1f%%)\n", + nPart, gs, ge, aFreq, + (100.0 * (float)aFreq) / (float)(s->nMTF) ); + + for (v = 0; v < alphaSize; v++) + if (v >= gs && v <= ge) + s->len[nPart-1][v] = BZ_LESSER_ICOST; else + s->len[nPart-1][v] = BZ_GREATER_ICOST; + + nPart--; + gs = ge+1; + remF -= aFreq; + } + } + + /*--- + Iterate up to BZ_N_ITERS times to improve the tables. + ---*/ + for (iter = 0; iter < BZ_N_ITERS; iter++) { + + for (t = 0; t < nGroups; t++) fave[t] = 0; + + for (t = 0; t < nGroups; t++) + for (v = 0; v < alphaSize; v++) + s->rfreq[t][v] = 0; + + /*--- + Set up an auxiliary length table which is used to fast-track + the common case (nGroups == 6). + ---*/ + if (nGroups == 6) { + for (v = 0; v < alphaSize; v++) { + s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; + s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; + s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; + } + } + + nSelectors = 0; + totc = 0; + gs = 0; + while (True) { + + /*--- Set group start & end marks. --*/ + if (gs >= s->nMTF) break; + ge = gs + BZ_G_SIZE - 1; + if (ge >= s->nMTF) ge = s->nMTF-1; + + /*-- + Calculate the cost of this group as coded + by each of the coding tables. + --*/ + for (t = 0; t < nGroups; t++) cost[t] = 0; + + if (nGroups == 6 && 50 == ge-gs+1) { + /*--- fast track the common case ---*/ + register UInt32 cost01, cost23, cost45; + register UInt16 icv; + cost01 = cost23 = cost45 = 0; + +# define BZ_ITER(nn) \ + icv = mtfv[gs+(nn)]; \ + cost01 += s->len_pack[icv][0]; \ + cost23 += s->len_pack[icv][1]; \ + cost45 += s->len_pack[icv][2]; \ + + BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4); + BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9); + BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14); + BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19); + BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24); + BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29); + BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34); + BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39); + BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44); + BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49); + +# undef BZ_ITER + + cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; + cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; + cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; + + } else { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) { + UInt16 icv = mtfv[i]; + for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; + } + } + + /*-- + Find the coding table which is best for this group, + and record its identity in the selector table. + --*/ + bc = 999999999; bt = -1; + for (t = 0; t < nGroups; t++) + if (cost[t] < bc) { bc = cost[t]; bt = t; }; + totc += bc; + fave[bt]++; + s->selector[nSelectors] = bt; + nSelectors++; + + /*-- + Increment the symbol frequencies for the selected table. + --*/ + if (nGroups == 6 && 50 == ge-gs+1) { + /*--- fast track the common case ---*/ + +# define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++ + + BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4); + BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9); + BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14); + BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19); + BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24); + BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29); + BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34); + BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39); + BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44); + BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49); + +# undef BZ_ITUR + + } else { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) + s->rfreq[bt][ mtfv[i] ]++; + } + + gs = ge+1; + } + if (s->verbosity >= 3) { + VPrintf2 ( " pass %d: size is %d, grp uses are ", + iter+1, totc/8 ); + for (t = 0; t < nGroups; t++) + VPrintf1 ( "%d ", fave[t] ); + VPrintf0 ( "\n" ); + } + + /*-- + Recompute the tables based on the accumulated frequencies. + --*/ + /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See + comment in huffman.c for details. */ + for (t = 0; t < nGroups; t++) + BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), + alphaSize, 17 /*20*/ ); + } + + + AssertH( nGroups < 8, 3002 ); + AssertH( nSelectors < 32768 && + nSelectors <= (2 + (900000 / BZ_G_SIZE)), + 3003 ); + + + /*--- Compute MTF values for the selectors. ---*/ + { + UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp; + for (i = 0; i < nGroups; i++) pos[i] = i; + for (i = 0; i < nSelectors; i++) { + ll_i = s->selector[i]; + j = 0; + tmp = pos[j]; + while ( ll_i != tmp ) { + j++; + tmp2 = tmp; + tmp = pos[j]; + pos[j] = tmp2; + }; + pos[0] = tmp; + s->selectorMtf[i] = j; + } + }; + + /*--- Assign actual codes for the tables. --*/ + for (t = 0; t < nGroups; t++) { + minLen = 32; + maxLen = 0; + for (i = 0; i < alphaSize; i++) { + if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; + if (s->len[t][i] < minLen) minLen = s->len[t][i]; + } + AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); + AssertH ( !(minLen < 1), 3005 ); + BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), + minLen, maxLen, alphaSize ); + } + + /*--- Transmit the mapping table. ---*/ + { + Bool inUse16[16]; + for (i = 0; i < 16; i++) { + inUse16[i] = False; + for (j = 0; j < 16; j++) + if (s->inUse[i * 16 + j]) inUse16[i] = True; + } + + nBytes = s->numZ; + for (i = 0; i < 16; i++) + if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); + + for (i = 0; i < 16; i++) + if (inUse16[i]) + for (j = 0; j < 16; j++) { + if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); + } + + if (s->verbosity >= 3) + VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); + } + + /*--- Now the selectors. ---*/ + nBytes = s->numZ; + bsW ( s, 3, nGroups ); + bsW ( s, 15, nSelectors ); + for (i = 0; i < nSelectors; i++) { + for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); + bsW(s,1,0); + } + if (s->verbosity >= 3) + VPrintf1( "selectors %d, ", s->numZ-nBytes ); + + /*--- Now the coding tables. ---*/ + nBytes = s->numZ; + + for (t = 0; t < nGroups; t++) { + Int32 curr = s->len[t][0]; + bsW ( s, 5, curr ); + for (i = 0; i < alphaSize; i++) { + while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ }; + while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ }; + bsW ( s, 1, 0 ); + } + } + + if (s->verbosity >= 3) + VPrintf1 ( "code lengths %d, ", s->numZ-nBytes ); + + /*--- And finally, the block data proper ---*/ + nBytes = s->numZ; + selCtr = 0; + gs = 0; + while (True) { + if (gs >= s->nMTF) break; + ge = gs + BZ_G_SIZE - 1; + if (ge >= s->nMTF) ge = s->nMTF-1; + AssertH ( s->selector[selCtr] < nGroups, 3006 ); + + if (nGroups == 6 && 50 == ge-gs+1) { + /*--- fast track the common case ---*/ + UInt16 mtfv_i; + UChar* s_len_sel_selCtr + = &(s->len[s->selector[selCtr]][0]); + Int32* s_code_sel_selCtr + = &(s->code[s->selector[selCtr]][0]); + +# define BZ_ITAH(nn) \ + mtfv_i = mtfv[gs+(nn)]; \ + bsW ( s, \ + s_len_sel_selCtr[mtfv_i], \ + s_code_sel_selCtr[mtfv_i] ) + + BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4); + BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9); + BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14); + BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19); + BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24); + BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29); + BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34); + BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39); + BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44); + BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49); + +# undef BZ_ITAH + + } else { + /*--- slow version which correctly handles all situations ---*/ + for (i = gs; i <= ge; i++) { + bsW ( s, + s->len [s->selector[selCtr]] [mtfv[i]], + s->code [s->selector[selCtr]] [mtfv[i]] ); + } + } + + + gs = ge+1; + selCtr++; + } + AssertH( selCtr == nSelectors, 3007 ); + + if (s->verbosity >= 3) + VPrintf1( "codes %d\n", s->numZ-nBytes ); +} + + +/*---------------------------------------------------*/ +void BZ2_compressBlock ( EState* s, Bool is_last_block ) +{ + if (s->nblock > 0) { + + BZ_FINALISE_CRC ( s->blockCRC ); + s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31); + s->combinedCRC ^= s->blockCRC; + if (s->blockNo > 1) s->numZ = 0; + + if (s->verbosity >= 2) + VPrintf4( " block %d: crc = 0x%08x, " + "combined CRC = 0x%08x, size = %d\n", + s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); + + BZ2_blockSort ( s ); + } + + s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]); + + /*-- If this is the first block, create the stream header. --*/ + if (s->blockNo == 1) { + BZ2_bsInitWrite ( s ); + bsPutUChar ( s, BZ_HDR_B ); + bsPutUChar ( s, BZ_HDR_Z ); + bsPutUChar ( s, BZ_HDR_h ); + bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) ); + } + + if (s->nblock > 0) { + + bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 ); + bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 ); + bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 ); + + /*-- Now the block's CRC, so it is in a known place. --*/ + bsPutUInt32 ( s, s->blockCRC ); + + /*-- + Now a single bit indicating (non-)randomisation. + As of version 0.9.5, we use a better sorting algorithm + which makes randomisation unnecessary. So always set + the randomised bit to 'no'. Of course, the decoder + still needs to be able to handle randomised blocks + so as to maintain backwards compatibility with + older versions of bzip2. + --*/ + bsW(s,1,0); + + bsW ( s, 24, s->origPtr ); + generateMTFValues ( s ); + sendMTFValues ( s ); + } + + + /*-- If this is the last block, add the stream trailer. --*/ + if (is_last_block) { + + bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 ); + bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 ); + bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); + bsPutUInt32 ( s, s->combinedCRC ); + if (s->verbosity >= 2) + VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC ); + bsFinishWrite ( s ); + } +} + + +/*-------------------------------------------------------------*/ +/*--- end compress.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/crctable.c b/externals/bzip2/crctable.c new file mode 100644 index 0000000..215687b --- /dev/null +++ b/externals/bzip2/crctable.c @@ -0,0 +1,104 @@ + +/*-------------------------------------------------------------*/ +/*--- Table for doing CRCs ---*/ +/*--- crctable.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + +/*-- + I think this is an implementation of the AUTODIN-II, + Ethernet & FDDI 32-bit CRC standard. Vaguely derived + from code by Rob Warnock, in Section 51 of the + comp.compression FAQ. +--*/ + +UInt32 BZ2_crc32Table[256] = { + + /*-- Ugly, innit? --*/ + + 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L, + 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L, + 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L, + 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL, + 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L, + 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L, + 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L, + 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL, + 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L, + 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L, + 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L, + 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL, + 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L, + 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L, + 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L, + 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL, + 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL, + 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L, + 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L, + 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL, + 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL, + 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L, + 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L, + 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL, + 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL, + 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L, + 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L, + 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL, + 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL, + 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L, + 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L, + 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL, + 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L, + 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL, + 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL, + 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L, + 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L, + 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL, + 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL, + 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L, + 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L, + 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL, + 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL, + 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L, + 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L, + 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL, + 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL, + 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L, + 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L, + 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL, + 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L, + 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L, + 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L, + 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL, + 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L, + 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L, + 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L, + 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL, + 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L, + 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L, + 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L, + 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL, + 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L, + 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L +}; + + +/*-------------------------------------------------------------*/ +/*--- end crctable.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/decompress.c b/externals/bzip2/decompress.c new file mode 100644 index 0000000..bba5e0f --- /dev/null +++ b/externals/bzip2/decompress.c @@ -0,0 +1,626 @@ + +/*-------------------------------------------------------------*/ +/*--- Decompression machinery ---*/ +/*--- decompress.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + + +/*---------------------------------------------------*/ +static +void makeMaps_d ( DState* s ) +{ + Int32 i; + s->nInUse = 0; + for (i = 0; i < 256; i++) + if (s->inUse[i]) { + s->seqToUnseq[s->nInUse] = i; + s->nInUse++; + } +} + + +/*---------------------------------------------------*/ +#define RETURN(rrr) \ + { retVal = rrr; goto save_state_and_return; }; + +#define GET_BITS(lll,vvv,nnn) \ + case lll: s->state = lll; \ + while (True) { \ + if (s->bsLive >= nnn) { \ + UInt32 v; \ + v = (s->bsBuff >> \ + (s->bsLive-nnn)) & ((1 << nnn)-1); \ + s->bsLive -= nnn; \ + vvv = v; \ + break; \ + } \ + if (s->strm->avail_in == 0) RETURN(BZ_OK); \ + s->bsBuff \ + = (s->bsBuff << 8) | \ + ((UInt32) \ + (*((UChar*)(s->strm->next_in)))); \ + s->bsLive += 8; \ + s->strm->next_in++; \ + s->strm->avail_in--; \ + s->strm->total_in_lo32++; \ + if (s->strm->total_in_lo32 == 0) \ + s->strm->total_in_hi32++; \ + } + +#define GET_UCHAR(lll,uuu) \ + GET_BITS(lll,uuu,8) + +#define GET_BIT(lll,uuu) \ + GET_BITS(lll,uuu,1) + +/*---------------------------------------------------*/ +#define GET_MTF_VAL(label1,label2,lval) \ +{ \ + if (groupPos == 0) { \ + groupNo++; \ + if (groupNo >= nSelectors) \ + RETURN(BZ_DATA_ERROR); \ + groupPos = BZ_G_SIZE; \ + gSel = s->selector[groupNo]; \ + gMinlen = s->minLens[gSel]; \ + gLimit = &(s->limit[gSel][0]); \ + gPerm = &(s->perm[gSel][0]); \ + gBase = &(s->base[gSel][0]); \ + } \ + groupPos--; \ + zn = gMinlen; \ + GET_BITS(label1, zvec, zn); \ + while (1) { \ + if (zn > 20 /* the longest code */) \ + RETURN(BZ_DATA_ERROR); \ + if (zvec <= gLimit[zn]) break; \ + zn++; \ + GET_BIT(label2, zj); \ + zvec = (zvec << 1) | zj; \ + }; \ + if (zvec - gBase[zn] < 0 \ + || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \ + RETURN(BZ_DATA_ERROR); \ + lval = gPerm[zvec - gBase[zn]]; \ +} + + +/*---------------------------------------------------*/ +Int32 BZ2_decompress ( DState* s ) +{ + UChar uc; + Int32 retVal; + Int32 minLen, maxLen; + bz_stream* strm = s->strm; + + /* stuff that needs to be saved/restored */ + Int32 i; + Int32 j; + Int32 t; + Int32 alphaSize; + Int32 nGroups; + Int32 nSelectors; + Int32 EOB; + Int32 groupNo; + Int32 groupPos; + Int32 nextSym; + Int32 nblockMAX; + Int32 nblock; + Int32 es; + Int32 N; + Int32 curr; + Int32 zt; + Int32 zn; + Int32 zvec; + Int32 zj; + Int32 gSel; + Int32 gMinlen; + Int32* gLimit; + Int32* gBase; + Int32* gPerm; + + if (s->state == BZ_X_MAGIC_1) { + /*initialise the save area*/ + s->save_i = 0; + s->save_j = 0; + s->save_t = 0; + s->save_alphaSize = 0; + s->save_nGroups = 0; + s->save_nSelectors = 0; + s->save_EOB = 0; + s->save_groupNo = 0; + s->save_groupPos = 0; + s->save_nextSym = 0; + s->save_nblockMAX = 0; + s->save_nblock = 0; + s->save_es = 0; + s->save_N = 0; + s->save_curr = 0; + s->save_zt = 0; + s->save_zn = 0; + s->save_zvec = 0; + s->save_zj = 0; + s->save_gSel = 0; + s->save_gMinlen = 0; + s->save_gLimit = NULL; + s->save_gBase = NULL; + s->save_gPerm = NULL; + } + + /*restore from the save area*/ + i = s->save_i; + j = s->save_j; + t = s->save_t; + alphaSize = s->save_alphaSize; + nGroups = s->save_nGroups; + nSelectors = s->save_nSelectors; + EOB = s->save_EOB; + groupNo = s->save_groupNo; + groupPos = s->save_groupPos; + nextSym = s->save_nextSym; + nblockMAX = s->save_nblockMAX; + nblock = s->save_nblock; + es = s->save_es; + N = s->save_N; + curr = s->save_curr; + zt = s->save_zt; + zn = s->save_zn; + zvec = s->save_zvec; + zj = s->save_zj; + gSel = s->save_gSel; + gMinlen = s->save_gMinlen; + gLimit = s->save_gLimit; + gBase = s->save_gBase; + gPerm = s->save_gPerm; + + retVal = BZ_OK; + + switch (s->state) { + + GET_UCHAR(BZ_X_MAGIC_1, uc); + if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC); + + GET_UCHAR(BZ_X_MAGIC_2, uc); + if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC); + + GET_UCHAR(BZ_X_MAGIC_3, uc) + if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); + + GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) + if (s->blockSize100k < (BZ_HDR_0 + 1) || + s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); + s->blockSize100k -= BZ_HDR_0; + + if (s->smallDecompress) { + s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); + s->ll4 = BZALLOC( + ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) + ); + if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); + } else { + s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) ); + if (s->tt == NULL) RETURN(BZ_MEM_ERROR); + } + + GET_UCHAR(BZ_X_BLKHDR_1, uc); + + if (uc == 0x17) goto endhdr_2; + if (uc != 0x31) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_2, uc); + if (uc != 0x41) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_3, uc); + if (uc != 0x59) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_4, uc); + if (uc != 0x26) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_5, uc); + if (uc != 0x53) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_BLKHDR_6, uc); + if (uc != 0x59) RETURN(BZ_DATA_ERROR); + + s->currBlockNo++; + if (s->verbosity >= 2) + VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); + + s->storedBlockCRC = 0; + GET_UCHAR(BZ_X_BCRC_1, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_BCRC_2, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_BCRC_3, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_BCRC_4, uc); + s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); + + GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); + + s->origPtr = 0; + GET_UCHAR(BZ_X_ORIGPTR_1, uc); + s->origPtr = (s->origPtr << 8) | ((Int32)uc); + GET_UCHAR(BZ_X_ORIGPTR_2, uc); + s->origPtr = (s->origPtr << 8) | ((Int32)uc); + GET_UCHAR(BZ_X_ORIGPTR_3, uc); + s->origPtr = (s->origPtr << 8) | ((Int32)uc); + + if (s->origPtr < 0) + RETURN(BZ_DATA_ERROR); + if (s->origPtr > 10 + 100000*s->blockSize100k) + RETURN(BZ_DATA_ERROR); + + /*--- Receive the mapping table ---*/ + for (i = 0; i < 16; i++) { + GET_BIT(BZ_X_MAPPING_1, uc); + if (uc == 1) + s->inUse16[i] = True; else + s->inUse16[i] = False; + } + + for (i = 0; i < 256; i++) s->inUse[i] = False; + + for (i = 0; i < 16; i++) + if (s->inUse16[i]) + for (j = 0; j < 16; j++) { + GET_BIT(BZ_X_MAPPING_2, uc); + if (uc == 1) s->inUse[i * 16 + j] = True; + } + makeMaps_d ( s ); + if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); + alphaSize = s->nInUse+2; + + /*--- Now the selectors ---*/ + GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); + if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); + GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); + if (nSelectors < 1) RETURN(BZ_DATA_ERROR); + for (i = 0; i < nSelectors; i++) { + j = 0; + while (True) { + GET_BIT(BZ_X_SELECTOR_3, uc); + if (uc == 0) break; + j++; + if (j >= nGroups) RETURN(BZ_DATA_ERROR); + } + s->selectorMtf[i] = j; + } + + /*--- Undo the MTF values for the selectors. ---*/ + { + UChar pos[BZ_N_GROUPS], tmp, v; + for (v = 0; v < nGroups; v++) pos[v] = v; + + for (i = 0; i < nSelectors; i++) { + v = s->selectorMtf[i]; + tmp = pos[v]; + while (v > 0) { pos[v] = pos[v-1]; v--; } + pos[0] = tmp; + s->selector[i] = tmp; + } + } + + /*--- Now the coding tables ---*/ + for (t = 0; t < nGroups; t++) { + GET_BITS(BZ_X_CODING_1, curr, 5); + for (i = 0; i < alphaSize; i++) { + while (True) { + if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); + GET_BIT(BZ_X_CODING_2, uc); + if (uc == 0) break; + GET_BIT(BZ_X_CODING_3, uc); + if (uc == 0) curr++; else curr--; + } + s->len[t][i] = curr; + } + } + + /*--- Create the Huffman decoding tables ---*/ + for (t = 0; t < nGroups; t++) { + minLen = 32; + maxLen = 0; + for (i = 0; i < alphaSize; i++) { + if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; + if (s->len[t][i] < minLen) minLen = s->len[t][i]; + } + BZ2_hbCreateDecodeTables ( + &(s->limit[t][0]), + &(s->base[t][0]), + &(s->perm[t][0]), + &(s->len[t][0]), + minLen, maxLen, alphaSize + ); + s->minLens[t] = minLen; + } + + /*--- Now the MTF values ---*/ + + EOB = s->nInUse+1; + nblockMAX = 100000 * s->blockSize100k; + groupNo = -1; + groupPos = 0; + + for (i = 0; i <= 255; i++) s->unzftab[i] = 0; + + /*-- MTF init --*/ + { + Int32 ii, jj, kk; + kk = MTFA_SIZE-1; + for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { + for (jj = MTFL_SIZE-1; jj >= 0; jj--) { + s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj); + kk--; + } + s->mtfbase[ii] = kk + 1; + } + } + /*-- end MTF init --*/ + + nblock = 0; + GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); + + while (True) { + + if (nextSym == EOB) break; + + if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { + + es = -1; + N = 1; + do { + if (nextSym == BZ_RUNA) es = es + (0+1) * N; else + if (nextSym == BZ_RUNB) es = es + (1+1) * N; + N = N * 2; + GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); + } + while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); + + es++; + uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ]; + s->unzftab[uc] += es; + + if (s->smallDecompress) + while (es > 0) { + if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); + s->ll16[nblock] = (UInt16)uc; + nblock++; + es--; + } + else + while (es > 0) { + if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); + s->tt[nblock] = (UInt32)uc; + nblock++; + es--; + }; + + continue; + + } else { + + if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); + + /*-- uc = MTF ( nextSym-1 ) --*/ + { + Int32 ii, jj, kk, pp, lno, off; + UInt32 nn; + nn = (UInt32)(nextSym - 1); + + if (nn < MTFL_SIZE) { + /* avoid general-case expense */ + pp = s->mtfbase[0]; + uc = s->mtfa[pp+nn]; + while (nn > 3) { + Int32 z = pp+nn; + s->mtfa[(z) ] = s->mtfa[(z)-1]; + s->mtfa[(z)-1] = s->mtfa[(z)-2]; + s->mtfa[(z)-2] = s->mtfa[(z)-3]; + s->mtfa[(z)-3] = s->mtfa[(z)-4]; + nn -= 4; + } + while (nn > 0) { + s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; + }; + s->mtfa[pp] = uc; + } else { + /* general case */ + lno = nn / MTFL_SIZE; + off = nn % MTFL_SIZE; + pp = s->mtfbase[lno] + off; + uc = s->mtfa[pp]; + while (pp > s->mtfbase[lno]) { + s->mtfa[pp] = s->mtfa[pp-1]; pp--; + }; + s->mtfbase[lno]++; + while (lno > 0) { + s->mtfbase[lno]--; + s->mtfa[s->mtfbase[lno]] + = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; + lno--; + } + s->mtfbase[0]--; + s->mtfa[s->mtfbase[0]] = uc; + if (s->mtfbase[0] == 0) { + kk = MTFA_SIZE-1; + for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { + for (jj = MTFL_SIZE-1; jj >= 0; jj--) { + s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; + kk--; + } + s->mtfbase[ii] = kk + 1; + } + } + } + } + /*-- end uc = MTF ( nextSym-1 ) --*/ + + s->unzftab[s->seqToUnseq[uc]]++; + if (s->smallDecompress) + s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else + s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]); + nblock++; + + GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); + continue; + } + } + + /* Now we know what nblock is, we can do a better sanity + check on s->origPtr. + */ + if (s->origPtr < 0 || s->origPtr >= nblock) + RETURN(BZ_DATA_ERROR); + + /*-- Set up cftab to facilitate generation of T^(-1) --*/ + s->cftab[0] = 0; + for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; + for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; + for (i = 0; i <= 256; i++) { + if (s->cftab[i] < 0 || s->cftab[i] > nblock) { + /* s->cftab[i] can legitimately be == nblock */ + RETURN(BZ_DATA_ERROR); + } + } + + s->state_out_len = 0; + s->state_out_ch = 0; + BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); + s->state = BZ_X_OUTPUT; + if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); + + if (s->smallDecompress) { + + /*-- Make a copy of cftab, used in generation of T --*/ + for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; + + /*-- compute the T vector --*/ + for (i = 0; i < nblock; i++) { + uc = (UChar)(s->ll16[i]); + SET_LL(i, s->cftabCopy[uc]); + s->cftabCopy[uc]++; + } + + /*-- Compute T^(-1) by pointer reversal on T --*/ + i = s->origPtr; + j = GET_LL(i); + do { + Int32 tmp = GET_LL(j); + SET_LL(j, i); + i = j; + j = tmp; + } + while (i != s->origPtr); + + s->tPos = s->origPtr; + s->nblock_used = 0; + if (s->blockRandomised) { + BZ_RAND_INIT_MASK; + BZ_GET_SMALL(s->k0); s->nblock_used++; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + } else { + BZ_GET_SMALL(s->k0); s->nblock_used++; + } + + } else { + + /*-- compute the T^(-1) vector --*/ + for (i = 0; i < nblock; i++) { + uc = (UChar)(s->tt[i] & 0xff); + s->tt[s->cftab[uc]] |= (i << 8); + s->cftab[uc]++; + } + + s->tPos = s->tt[s->origPtr] >> 8; + s->nblock_used = 0; + if (s->blockRandomised) { + BZ_RAND_INIT_MASK; + BZ_GET_FAST(s->k0); s->nblock_used++; + BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; + } else { + BZ_GET_FAST(s->k0); s->nblock_used++; + } + + } + + RETURN(BZ_OK); + + + + endhdr_2: + + GET_UCHAR(BZ_X_ENDHDR_2, uc); + if (uc != 0x72) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_3, uc); + if (uc != 0x45) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_4, uc); + if (uc != 0x38) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_5, uc); + if (uc != 0x50) RETURN(BZ_DATA_ERROR); + GET_UCHAR(BZ_X_ENDHDR_6, uc); + if (uc != 0x90) RETURN(BZ_DATA_ERROR); + + s->storedCombinedCRC = 0; + GET_UCHAR(BZ_X_CCRC_1, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_CCRC_2, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_CCRC_3, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + GET_UCHAR(BZ_X_CCRC_4, uc); + s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); + + s->state = BZ_X_IDLE; + RETURN(BZ_STREAM_END); + + default: AssertH ( False, 4001 ); + } + + AssertH ( False, 4002 ); + + save_state_and_return: + + s->save_i = i; + s->save_j = j; + s->save_t = t; + s->save_alphaSize = alphaSize; + s->save_nGroups = nGroups; + s->save_nSelectors = nSelectors; + s->save_EOB = EOB; + s->save_groupNo = groupNo; + s->save_groupPos = groupPos; + s->save_nextSym = nextSym; + s->save_nblockMAX = nblockMAX; + s->save_nblock = nblock; + s->save_es = es; + s->save_N = N; + s->save_curr = curr; + s->save_zt = zt; + s->save_zn = zn; + s->save_zvec = zvec; + s->save_zj = zj; + s->save_gSel = gSel; + s->save_gMinlen = gMinlen; + s->save_gLimit = gLimit; + s->save_gBase = gBase; + s->save_gPerm = gPerm; + + return retVal; +} + + +/*-------------------------------------------------------------*/ +/*--- end decompress.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/huffman.c b/externals/bzip2/huffman.c new file mode 100644 index 0000000..87e79e3 --- /dev/null +++ b/externals/bzip2/huffman.c @@ -0,0 +1,205 @@ + +/*-------------------------------------------------------------*/ +/*--- Huffman coding low-level stuff ---*/ +/*--- huffman.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + +/*---------------------------------------------------*/ +#define WEIGHTOF(zz0) ((zz0) & 0xffffff00) +#define DEPTHOF(zz1) ((zz1) & 0x000000ff) +#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3)) + +#define ADDWEIGHTS(zw1,zw2) \ + (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \ + (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2))) + +#define UPHEAP(z) \ +{ \ + Int32 zz, tmp; \ + zz = z; tmp = heap[zz]; \ + while (weight[tmp] < weight[heap[zz >> 1]]) { \ + heap[zz] = heap[zz >> 1]; \ + zz >>= 1; \ + } \ + heap[zz] = tmp; \ +} + +#define DOWNHEAP(z) \ +{ \ + Int32 zz, yy, tmp; \ + zz = z; tmp = heap[zz]; \ + while (True) { \ + yy = zz << 1; \ + if (yy > nHeap) break; \ + if (yy < nHeap && \ + weight[heap[yy+1]] < weight[heap[yy]]) \ + yy++; \ + if (weight[tmp] < weight[heap[yy]]) break; \ + heap[zz] = heap[yy]; \ + zz = yy; \ + } \ + heap[zz] = tmp; \ +} + + +/*---------------------------------------------------*/ +void BZ2_hbMakeCodeLengths ( UChar *len, + Int32 *freq, + Int32 alphaSize, + Int32 maxLen ) +{ + /*-- + Nodes and heap entries run from 1. Entry 0 + for both the heap and nodes is a sentinel. + --*/ + Int32 nNodes, nHeap, n1, n2, i, j, k; + Bool tooLong; + + Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; + Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; + Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; + + for (i = 0; i < alphaSize; i++) + weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; + + while (True) { + + nNodes = alphaSize; + nHeap = 0; + + heap[0] = 0; + weight[0] = 0; + parent[0] = -2; + + for (i = 1; i <= alphaSize; i++) { + parent[i] = -1; + nHeap++; + heap[nHeap] = i; + UPHEAP(nHeap); + } + + AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); + + while (nHeap > 1) { + n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); + n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); + nNodes++; + parent[n1] = parent[n2] = nNodes; + weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]); + parent[nNodes] = -1; + nHeap++; + heap[nHeap] = nNodes; + UPHEAP(nHeap); + } + + AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 ); + + tooLong = False; + for (i = 1; i <= alphaSize; i++) { + j = 0; + k = i; + while (parent[k] >= 0) { k = parent[k]; j++; } + len[i-1] = j; + if (j > maxLen) tooLong = True; + } + + if (! tooLong) break; + + /* 17 Oct 04: keep-going condition for the following loop used + to be 'i < alphaSize', which missed the last element, + theoretically leading to the possibility of the compressor + looping. However, this count-scaling step is only needed if + one of the generated Huffman code words is longer than + maxLen, which up to and including version 1.0.2 was 20 bits, + which is extremely unlikely. In version 1.0.3 maxLen was + changed to 17 bits, which has minimal effect on compression + ratio, but does mean this scaling step is used from time to + time, enough to verify that it works. + + This means that bzip2-1.0.3 and later will only produce + Huffman codes with a maximum length of 17 bits. However, in + order to preserve backwards compatibility with bitstreams + produced by versions pre-1.0.3, the decompressor must still + handle lengths of up to 20. */ + + for (i = 1; i <= alphaSize; i++) { + j = weight[i] >> 8; + j = 1 + (j / 2); + weight[i] = j << 8; + } + } +} + + +/*---------------------------------------------------*/ +void BZ2_hbAssignCodes ( Int32 *code, + UChar *length, + Int32 minLen, + Int32 maxLen, + Int32 alphaSize ) +{ + Int32 n, vec, i; + + vec = 0; + for (n = minLen; n <= maxLen; n++) { + for (i = 0; i < alphaSize; i++) + if (length[i] == n) { code[i] = vec; vec++; }; + vec <<= 1; + } +} + + +/*---------------------------------------------------*/ +void BZ2_hbCreateDecodeTables ( Int32 *limit, + Int32 *base, + Int32 *perm, + UChar *length, + Int32 minLen, + Int32 maxLen, + Int32 alphaSize ) +{ + Int32 pp, i, j, vec; + + pp = 0; + for (i = minLen; i <= maxLen; i++) + for (j = 0; j < alphaSize; j++) + if (length[j] == i) { perm[pp] = j; pp++; }; + + for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0; + for (i = 0; i < alphaSize; i++) base[length[i]+1]++; + + for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1]; + + for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0; + vec = 0; + + for (i = minLen; i <= maxLen; i++) { + vec += (base[i+1] - base[i]); + limit[i] = vec-1; + vec <<= 1; + } + for (i = minLen + 1; i <= maxLen; i++) + base[i] = ((limit[i-1] + 1) << 1) - base[i]; +} + + +/*-------------------------------------------------------------*/ +/*--- end huffman.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/randtable.c b/externals/bzip2/randtable.c new file mode 100644 index 0000000..068b763 --- /dev/null +++ b/externals/bzip2/randtable.c @@ -0,0 +1,84 @@ + +/*-------------------------------------------------------------*/ +/*--- Table for randomising repetitive blocks ---*/ +/*--- randtable.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + + +/*---------------------------------------------*/ +Int32 BZ2_rNums[512] = { + 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, + 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, + 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, + 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, + 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, + 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, + 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, + 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, + 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, + 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, + 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, + 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, + 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, + 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, + 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, + 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, + 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, + 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, + 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, + 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, + 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, + 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, + 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, + 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, + 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, + 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, + 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, + 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, + 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, + 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, + 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, + 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, + 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, + 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, + 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, + 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, + 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, + 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, + 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, + 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, + 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, + 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, + 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, + 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, + 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, + 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, + 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, + 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, + 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, + 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, + 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, + 936, 638 +}; + + +/*-------------------------------------------------------------*/ +/*--- end randtable.c ---*/ +/*-------------------------------------------------------------*/ diff --git a/externals/bzip2/win/VC90/bzip2.vcproj b/externals/bzip2/win/VC90/bzip2.vcproj new file mode 100644 index 0000000..98b3a33 --- /dev/null +++ b/externals/bzip2/win/VC90/bzip2.vcproj @@ -0,0 +1,333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/externals/bzip2/win/bzip2.sln b/externals/bzip2/win/bzip2.sln new file mode 100644 index 0000000..1a637e4 --- /dev/null +++ b/externals/bzip2/win/bzip2.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "VC90\bzip2.vcproj", "{CE773400-763E-4B71-B5E2-C9B60A752EB1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Debug|Win32.ActiveCfg = Debug|Win32 + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Debug|Win32.Build.0 = Debug|Win32 + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Debug|x64.ActiveCfg = Debug|x64 + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Debug|x64.Build.0 = Debug|x64 + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Release|Win32.ActiveCfg = Release|Win32 + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Release|Win32.Build.0 = Release|Win32 + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Release|x64.ActiveCfg = Release|x64 + {CE773400-763E-4B71-B5E2-C9B60A752EB1}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/g3dlite/AABox.cpp b/externals/g3dlite/AABox.cpp new file mode 100644 index 0000000..035497a --- /dev/null +++ b/externals/g3dlite/AABox.cpp @@ -0,0 +1,366 @@ +/** + @file AABox.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2004-01-10 + @edited 2006-01-11 +*/ + +#include "G3D/platform.h" +#include "G3D/AABox.h" +#include "G3D/Box.h" +#include "G3D/Plane.h" +#include "G3D/Sphere.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" + + +namespace G3D { + +const AABox& AABox::maxFinite() { + static const AABox b = AABox(Vector3::minFinite(), + Vector3::maxFinite()); + return b; +} + + +const AABox& AABox::large() { + static const AABox b = AABox(Vector3::minFinite() * 0.5f, + Vector3::maxFinite() * 0.5f); + return b; +} + + +const AABox& AABox::inf() { + static const AABox b = AABox(-Vector3::inf(), Vector3::inf()); + return b; +} + + +const AABox& AABox::zero() { + static const AABox b = AABox(Vector3::zero(), Vector3::zero()); + return b; +} + + +void AABox::serialize(class BinaryOutput& b) const { + b.writeVector3(lo); + b.writeVector3(hi); +} + + +void AABox::deserialize(class BinaryInput& b) { + lo = b.readVector3(); + hi = b.readVector3(); +} + + +void AABox::split(const Vector3::Axis& axis, float location, AABox& low, AABox& high) const { + // Low, medium, and high along the chosen axis + float L = G3D::min(location, lo[axis]); + float M = G3D::min(G3D::max(location, lo[axis]), hi[axis]); + float H = G3D::max(location, hi[axis]); + + // Copy over this box. + high = low = *this; + + // Now move the split points along the special axis + low.lo[axis] = L; + low.hi[axis] = M; + high.lo[axis] = M; + high.hi[axis] = H; +} + + +Vector3 AABox::randomSurfacePoint() const { + Vector3 extent = hi - lo; + float aXY = extent.x * extent.y; + float aYZ = extent.y * extent.z; + float aZX = extent.z * extent.x; + + float r = (float)uniformRandom(0.0f, aXY + aYZ + aZX); + + // Choose evenly between positive and negative face planes + float d = ((float)uniformRandom(0, 1) < 0.5f) ? 0.0f : 1.0f; + + // The probability of choosing a given face is proportional to + // its area. + if (r < aXY) { + return + lo + + Vector3( + (float)uniformRandom(0.0f, extent.x), + (float)uniformRandom(0.0f, extent.y), + d * extent.z); + } else if (r < aYZ) { + return + lo + + Vector3( + d * extent.x, + (float)uniformRandom(0, extent.y), + (float)uniformRandom(0, extent.z)); + } else { + return + lo + + Vector3( + (float)uniformRandom(0, extent.x), + d * extent.y, + (float)uniformRandom(0, extent.z)); + } +} + + +Vector3 AABox::randomInteriorPoint() const { + return Vector3( + (float)uniformRandom(lo.x, hi.x), + (float)uniformRandom(lo.y, hi.y), + (float)uniformRandom(lo.z, hi.z)); +} + + +bool AABox::intersects(const AABox& other) const { + // Must be overlap along all three axes. + // Try to find a separating axis. + + for (int a = 0; a < 3; ++a) { + + // |--------| + // |------| + + if ((lo[a] > other.hi[a]) || + (hi[a] < other.lo[a])) { + return false; + } + } + + return true; +} + +int AABox::dummy = 0; + +bool AABox::culledBy( + const Array& plane, + int& cullingPlane, + const uint32 _inMask, + uint32& childMask) const { + + uint32 inMask = _inMask; + assert(plane.size() < 31); + + childMask = 0; + + const bool finite = + (abs(lo.x) < G3D::finf()) && + (abs(hi.x) < G3D::finf()) && + (abs(lo.y) < G3D::finf()) && + (abs(hi.y) < G3D::finf()) && + (abs(lo.z) < G3D::finf()) && + (abs(hi.z) < G3D::finf()); + + // See if there is one plane for which all of the + // vertices are in the negative half space. + for (int p = 0; p < plane.size(); ++p) { + + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + Vector3 corner; + + int numContained = 0; + int v = 0; + + // We can early-out only if we have found one point on each + // side of the plane (i.e. if we are straddling). That + // occurs when (numContained < v) && (numContained > 0) + for (v = 0; (v < 8) && ((numContained == v) || (numContained == 0)); ++v) { + // Unrolling these 3 if's into a switch decreases performance + // by about 2x + corner.x = (v & 1) ? hi.x : lo.x; + corner.y = (v & 2) ? hi.y : lo.y; + corner.z = (v & 4) ? hi.z : lo.z; + + if (finite) { // this branch is highly predictable + if (plane[p].halfSpaceContainsFinite(corner)) { + ++numContained; + } + } else { + if (plane[p].halfSpaceContains(corner)) { + ++numContained; + } + } + } + + if (numContained == 0) { + // Plane p culled the box + cullingPlane = p; + + // The caller should not recurse into the children, + // since the parent is culled. If they do recurse, + // make them only test against this one plane, which + // will immediately cull the volume. + childMask = 1 << p; + return true; + + } else if (numContained < v) { + // The bounding volume straddled the plane; we have + // to keep testing against this plane + childMask |= (1 << p); + } + } + + // Move on to the next bit. + inMask = inMask >> 1; + } + + // None of the planes could cull this box + cullingPlane = -1; + return false; +} + + +bool AABox::culledBy( + const Array& plane, + int& cullingPlane, + const uint32 _inMask) const { + + uint32 inMask = _inMask; + assert(plane.size() < 31); + + const bool finite = + (abs(lo.x) < G3D::finf()) && + (abs(hi.x) < G3D::finf()) && + (abs(lo.y) < G3D::finf()) && + (abs(hi.y) < G3D::finf()) && + (abs(lo.z) < G3D::finf()) && + (abs(hi.z) < G3D::finf()); + + // See if there is one plane for which all of the + // vertices are in the negative half space. + for (int p = 0; p < plane.size(); ++p) { + + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + bool culled = true; + Vector3 corner; + + int v; + + // Assume this plane culls all points. See if there is a point + // not culled by the plane... early out when at least one point + // is in the positive half space. + for (v = 0; (v < 8) && culled; ++v) { + + // Unrolling these 3 if's into a switch decreases performance + // by about 2x + corner.x = (v & 1) ? hi.x : lo.x; + corner.y = (v & 2) ? hi.y : lo.y; + corner.z = (v & 4) ? hi.z : lo.z; + + if (finite) { // this branch is highly predictable + culled = ! plane[p].halfSpaceContainsFinite(corner); + } else { + culled = ! plane[p].halfSpaceContains(corner); + } + } + + if (culled) { + // Plane p culled the box + cullingPlane = p; + + return true; + } + } + + // Move on to the next bit. + inMask = inMask >> 1; + } + + // None of the planes could cull this box + cullingPlane = -1; + return false; +} + + +bool AABox::intersects(const class Sphere& sphere) const { + double d = 0; + + //find the square of the distance + //from the sphere to the box + for (int i = 0; i < 3; ++i) { + if (sphere.center[i] < lo[i]) { + d += square(sphere.center[i] - lo[i]); + } else if (sphere.center[i] > hi[i]) { + d += square(sphere.center[i] - hi[i]); + } + } + + return d <= square(sphere.radius); +} + +Vector3 AABox::corner(int index) const { + + // default constructor inits all components to 0 + Vector3 v; + + switch (index) + { + case 0: + v.x = lo.x; + v.y = lo.y; + v.z = hi.z; + break; + + case 1: + v.x = hi.x; + v.y = lo.y; + v.z = hi.z; + break; + + case 2: + v.x = hi.x; + v.y = hi.y; + v.z = hi.z; + break; + + case 3: + v.x = lo.x; + v.y = hi.y; + v.z = hi.z; + break; + + case 4: + v.x = lo.x; + v.y = lo.y; + v.z = lo.z; + break; + + case 5: + v.x = hi.x; + v.y = lo.y; + v.z = lo.z; + break; + + case 6: + v.x = hi.x; + v.y = hi.y; + v.z = lo.z; + break; + + case 7: + v.x = lo.x; + v.y = hi.y; + v.z = lo.z; + break; + + default: + debugAssertM(false, "Invalid corner index"); + break; + } + + return v; +} + + +} diff --git a/externals/g3dlite/Any.cpp b/externals/g3dlite/Any.cpp new file mode 100644 index 0000000..de4d32e --- /dev/null +++ b/externals/g3dlite/Any.cpp @@ -0,0 +1,1237 @@ +/** + @file Any.cpp + + @author Morgan McGuire + @author Shawn Yarbrough + + @created 2006-06-11 + @edited 2009-11-15 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#include "G3D/Any.h" +#include "G3D/TextOutput.h" +#include "G3D/TextInput.h" +#include "G3D/stringutils.h" +#include +#include + +namespace G3D { + +void Any::beforeRead() const { + if (isPlaceholder()) { + // Tried to read from a placeholder--throw an exception as if + // the original operator[] had failed. + KeyNotFound e; + alwaysAssertM(m_data, "Corrupt placeholder"); + + e.filename = m_data->source.filename; + e.line = m_data->source.line; + e.character = m_data->source.character; + e.key = m_placeholderName; + e.message = + "This exception may have been thrown later than " + "the actual operator[] invocation."; + + throw e; + } +} + + +Any::Data* Any::Data::create(const Data* d) { + Data* p = create(d->type); + + p->comment = d->comment; + p->name = d->name; + + switch (d->type) { + case NONE: + case BOOLEAN: + case NUMBER: + // No clone needed + break; + + case STRING: + *(p->value.s) = *(d->value.s); + break; + + case ARRAY: + *(p->value.a) = *(d->value.a); + break; + + case TABLE: + *(p->value.t) = *(d->value.t); + // Note that placeholders may be copied; that is ok--they are still + // just placeholders. + break; + } + + return p; +} + + +Any::Data* Any::Data::create(Any::Type t) { + size_t s = sizeof(Data); + + switch (t) { + case NONE: + case BOOLEAN: + case NUMBER: + // No extra space needed + break; + + case STRING: + s += sizeof(std::string); + break; + + case ARRAY: + s += sizeof(AnyArray); + break; + + case TABLE: + s += sizeof(AnyTable); + break; + } + + // Allocate the data object + Data* p = new (MemoryManager::create()->alloc(s)) Data(t); + + // Create the (empyt) value object at the end of the Data object + switch (t) { + case NONE: + case BOOLEAN: + case NUMBER: + // No value + break; + + case STRING: + p->value.s = new (p + 1) std::string(); + break; + + case ARRAY: + p->value.a = new (p + 1) AnyArray(); + break; + + case TABLE: + p->value.t = new (p + 1) AnyTable(); + break; + } + + return p; +} + + +void Any::Data::destroy(Data* d) { + if (d != NULL) { + d->~Data(); + MemoryManager::create()->free(d); + } +} + + +Any::Data::~Data() { + debugAssertM(referenceCount.value() <= 0, "Deleted while still referenced."); + + // Destruct but do not deallocate children + switch (type) { + case STRING: + debugAssert(value.s != NULL); + value.s->~basic_string(); + break; + + case ARRAY: + debugAssert(value.a != NULL); + value.a->~Array(); + break; + + case TABLE: + debugAssert(value.t != NULL); + value.t->~Table(); + break; + + default: + // All other types should have a NULL value pointer (i.e., they were used just for name and comment fields) + debugAssertM(value.s == NULL, "Corrupt Any::Data::Value"); + } + + value.s = NULL; +} + + +////////////////////////////////////////////////////////////// + +bool Any::containsKey(const std::string& x) const { + beforeRead(); + verifyType(TABLE); + + Any* a = m_data->value.t->getPointer(x); + + // Don't return true for placeholder objects + return (a != NULL) && (! a->isPlaceholder()); +} + + +void Any::dropReference() { + if (m_data && m_data->referenceCount.decrement() <= 0) { + // This was the last reference to the shared data + Data::destroy(m_data); + } + m_data = NULL; +} + + +void Any::ensureMutable() { + if (m_data && (m_data->referenceCount.value() >= 1)) { + // Copy the data. We must do this before dropping the reference + // to avoid a race condition + Data* d = Data::create(m_data); + dropReference(); + m_data = d; + } +} + + +Any::Any() : m_type(NONE), m_data(NULL) { +} + + +Any::Any(TextInput& t) : m_type(NONE), m_data(NULL) { + deserialize(t); +} + + +Any::Any(const Any& x) : m_type(NONE), m_data(NULL) { + x.beforeRead(); + *this = x; +} + + +Any::Any(double x) : m_type(NUMBER), m_simpleValue(x), m_data(NULL) { +} + + +#ifdef G3D_32BIT +Any::Any(int64 x) : m_type(NUMBER), m_simpleValue((double)x), m_data(NULL) { +} +#endif // G3D_32BIT + + +Any::Any(long x) : m_type(NUMBER), m_simpleValue((double)x), m_data(NULL) { +} + + +Any::Any(int x) : m_type(NUMBER), m_simpleValue((double)x), m_data(NULL) { +} + + +Any::Any(short x) : m_type(NUMBER), m_simpleValue((double)x), m_data(NULL) { +} + + +Any::Any(bool x) : m_type(BOOLEAN), m_simpleValue(x), m_data(NULL) { +} + + +Any::Any(const std::string& s) : m_type(STRING), m_data(Data::create(STRING)) { + *(m_data->value.s) = s; +} + + +Any::Any(const char* s) : m_type(STRING), m_data(NULL) { + if (s == NULL) { + m_type = NONE; + } else { + ensureData(); + *(m_data->value.s) = s; + } +} + + +Any::Any(Type t, const std::string& name) : m_type(t), m_data(NULL) { + alwaysAssertM(t == ARRAY || t == TABLE, "Can only create ARRAY or TABLE from Type enum."); + + ensureData(); + if (name != "") { + m_data->name = name; + } +} + + +Any::~Any() { + dropReference(); +} + + +void Any::beforeWrite() { + if (isPlaceholder()) { + // This is no longer a placeholder + m_placeholderName = ""; + } +} + +Any& Any::operator=(const Any& x) { + x.beforeRead(); + + if (this == &x) { + return *this; + } + + beforeWrite(); + + dropReference(); + + m_type = x.m_type; + m_simpleValue = x.m_simpleValue; + + if (x.m_data != NULL) { + x.m_data->referenceCount.increment(); + m_data = x.m_data; + } + + return *this; +} + + +Any& Any::operator=(double x) { + *this = Any(x); + return *this; +} + + +Any& Any::operator=(int x) { + return (*this = Any(x)); +} + + +Any& Any::operator=(bool x) { + *this = Any(x); + return *this; +} + + +Any& Any::operator=(const std::string& x) { + *this = Any(x); + return *this; +} + + +Any& Any::operator=(const char* x) { + *this = Any(x); + return *this; +} + + +Any& Any::operator=(Type t) { + switch (t) { + case NONE: + *this = Any(); + break; + + case TABLE: + case ARRAY: + *this = Any(t); + break; + + default: + alwaysAssertM(false, "Can only assign NONE, TABLE, or ARRAY Type enum."); + } + + return *this; +} + + +Any::Type Any::type() const { + beforeRead(); + return m_type; +} + + +const std::string& Any::comment() const { + beforeRead(); + + static const std::string blank; + if (m_data != NULL) { + return m_data->comment; + } else { + return blank; + } +} + + +void Any::setComment(const std::string& c) { + beforeRead(); + ensureData(); + m_data->comment = c; +} + + +bool Any::isNone() const { + beforeRead(); + return (m_type == NONE); +} + + +double Any::number() const { + beforeRead(); + verifyType(NUMBER); + return m_simpleValue.n; +} + + +const std::string& Any::string() const { + beforeRead(); + verifyType(STRING); + return *(m_data->value.s); +} + + +bool Any::boolean() const { + beforeRead(); + verifyType(BOOLEAN); + return m_simpleValue.b; +} + + +const std::string& Any::name() const { + beforeRead(); + static const std::string blank; + if (m_data != NULL) { + return m_data->name; + } else { + return blank; + } +} + + +void Any::setName(const std::string& n) { + beforeRead(); + ensureData(); + m_data->name = n; +} + + +int Any::size() const { + beforeRead(); + verifyType(ARRAY, TABLE); + switch (m_type) { + case TABLE: + return m_data->value.t->size(); + + case ARRAY: + return m_data->value.a->size(); + + default:; + return 0; + } // switch (m_type) +} + + +int Any::length() const { + beforeRead(); + return size(); +} + + +void Any::resize(int n) { + beforeRead(); + alwaysAssertM(n >= 0, "Cannot resize less than 0."); + verifyType(ARRAY); + m_data->value.a->resize(n); +} + + +void Any::clear() { + beforeRead(); + verifyType(ARRAY, TABLE); + switch (m_type) { + case ARRAY: + m_data->value.a->clear(); + break; + + case TABLE: + m_data->value.t->clear(); + break; + + default:; + } +} + + +const Any& Any::operator[](int i) const { + beforeRead(); + verifyType(ARRAY); + debugAssert(m_data != NULL); + Array& array = *(m_data->value.a); + return array[i]; +} + + +Any& Any::next() { + beforeRead(); + verifyType(ARRAY); + int n = size(); + resize(n + 1); + return (*this)[n]; +} + + +Any& Any::operator[](int i) { + beforeRead(); + verifyType(ARRAY); + debugAssert(m_data != NULL); + Array& array = *(m_data->value.a); + return array[i]; +} + + +const Array& Any::array() const { + beforeRead(); + verifyType(ARRAY); + debugAssert(m_data != NULL); + return *(m_data->value.a); +} + + +void Any::append(const Any& x0) { + beforeRead(); + verifyType(ARRAY); + debugAssert(m_data != NULL); + m_data->value.a->append(x0); +} + + +void Any::append(const Any& x0, const Any& x1) { + beforeRead(); + append(x0); + append(x1); +} + + +void Any::append(const Any& x0, const Any& x1, const Any& x2) { + beforeRead(); + append(x0); + append(x1); + append(x2); +} + + +void Any::append(const Any& x0, const Any& x1, const Any& x2, const Any& x3) { + beforeRead(); + append(x0); + append(x1); + append(x2); + append(x3); +} + + +const Table& Any::table() const { + beforeRead(); + verifyType(TABLE); + debugAssert(m_data != NULL); + return *(m_data->value.t); +} + + +const Any& Any::operator[](const std::string& x) const { + beforeRead(); + verifyType(TABLE); + debugAssert(m_data != NULL); + const Table& table = *(m_data->value.t); + Any* value = table.getPointer(x); + if (value == NULL) { + KeyNotFound e; + if (m_data) { + e.filename = m_data->source.filename; + e.line = m_data->source.line; + e.character = m_data->source.character; + } + e.key = x; + throw e; + } + return *value; +} + + +Any& Any::operator[](const std::string& key) { + beforeRead(); + verifyType(TABLE); + + bool created = false; + Any& value = m_data->value.t->getCreate(key, created); + + if (created) { + // The entry was created by this method; do not allow it to be + // read before it is written. + value.m_placeholderName = key; + + // Write source data for the value + value.ensureData(); + value.m_data->source = source(); + } + + return value; +} + + +void Any::set(const std::string& k, const Any& v) { + beforeRead(); + v.beforeRead(); + verifyType(TABLE); + debugAssert(m_data != NULL); + Table& table = *(m_data->value.t); + table.set(k, v); +} + + +const Any& Any::get(const std::string& x, const Any& defaultVal) const { + beforeRead(); + defaultVal.beforeRead(); + try { + return operator[](x); + } catch(KeyNotFound) { + return defaultVal; + } +} + + +bool Any::operator==(const Any& x) const { + beforeRead(); + x.beforeRead(); + if (m_type != x.m_type) { + return false; + } + + switch (m_type) { + case NONE: + return true; + + case BOOLEAN: + return (m_simpleValue.b == x.m_simpleValue.b); + + case NUMBER: + return (m_simpleValue.n == x.m_simpleValue.n); + + case STRING: + debugAssert(m_data != NULL); + return (*(m_data->value.s) == *(x.m_data->value.s)); + + case TABLE: { + if (size() != x.size()) { + return false; + } + debugAssert(m_data != NULL); + if (m_data->name != x.m_data->name) { + return false; + } + Table& cmptable = *( m_data->value.t); + Table& xcmptable = *(x.m_data->value.t); + for (Table::Iterator it1 = cmptable.begin(), it2 = xcmptable.begin(); + it1 != cmptable.end() && it2 != xcmptable.end(); + ++it1, ++it2) { + if (*it1 != *it2) { + return false; + } + } + return true; + } + + case ARRAY: { + if (size() != x.size()) { + return false; + } + debugAssert(m_data != NULL); + if (m_data->name != x.m_data->name) { + return false; + } + + Array& cmparray = *( m_data->value.a); + Array& xcmparray = *(x.m_data->value.a); + + for (int ii = 0; ii < size(); ++ii) { + if (cmparray[ii] != xcmparray[ii]) { + return false; + } + } + return true; + } + + default: + alwaysAssertM(false, "Unknown type."); + return false; + } // switch (m_type) + +} + + +bool Any::operator!=(const Any& x) const { + beforeRead(); + x.beforeRead(); + return !operator==(x); +} + + +static void getDeserializeSettings(TextInput::Settings& settings) { + settings.cppBlockComments = true; + settings.cppLineComments = true; + settings.otherLineComments = true; + settings.otherCommentCharacter = '#'; + settings.generateCommentTokens = true; + settings.singleQuotedStrings = false; + settings.msvcSpecials = false; + settings.caseSensitive = false; +} + + +std::string Any::unparse() const { + beforeRead(); + TextOutput::Settings settings; + TextOutput to(settings); + serialize(to); + return to.commitString(); +} + + +void Any::parse(const std::string& src) { + beforeRead(); + TextInput::Settings settings; + getDeserializeSettings(settings); + + TextInput ti(TextInput::FROM_STRING, src, settings); + deserialize(ti); +} + + +void Any::load(const std::string& filename) { + beforeRead(); + TextInput::Settings settings; + getDeserializeSettings(settings); + + TextInput ti(filename, settings); + deserialize(ti); +} + + +void Any::save(const std::string& filename) const { + beforeRead(); + TextOutput::Settings settings; + settings.wordWrap = TextOutput::Settings::WRAP_NONE; + + TextOutput to(filename,settings); + serialize(to); + to.commit(); +} + + +static bool needsQuotes(const std::string& s) { + if (! isLetter(s[0]) && (s[0] != '_')) { + return true; + } + + for (int i = 0; i < (int)s.length(); ++i) { + char c = s[i]; + + // peek character + char p = (i == (int)s.length() - 1) ? '_' : s[i + 1]; + + // Identify separators + if ((c == '-' && p == '>') || + (c == ':' && p == ':')) { + // Skip over this symbol + ++i; + continue; + } + + if (! isDigit(c) && ! isLetter(c) & (c != '.')) { + // This is an illegal character for an identifier, so we need quotes + return true; + } + } + + return false; +} + + +// TODO: if the output will fit on one line, compress tables and arrays into a single line +void Any::serialize(TextOutput& to) const { + beforeRead(); + if (m_data && ! m_data->comment.empty()) { + to.printf("\n/* %s */\n", m_data->comment.c_str()); + } + + switch (m_type) { + case NONE: + to.writeSymbol("NONE"); + break; + + case BOOLEAN: + to.writeBoolean(m_simpleValue.b); + break; + + case NUMBER: + to.writeNumber(m_simpleValue.n); + break; + + case STRING: + debugAssert(m_data != NULL); + to.writeString(*(m_data->value.s)); + break; + + case TABLE: { + debugAssert(m_data != NULL); + if (! m_data->name.empty()) { + if (needsQuotes(m_data->name)) { + to.writeString(m_data->name); + } else { + to.writeSymbol(m_data->name); + } + } + to.writeSymbol("{"); + to.writeNewline(); + to.pushIndent(); + AnyTable& table = *(m_data->value.t); + Array keys; + table.getKeys(keys); + keys.sort(); + + for (int i = 0; i < keys.size(); ++i) { + + to.writeSymbol(keys[i]); + to.writeSymbol("="); + table[keys[i]].serialize(to); + + if (i < keys.size() - 1) { + to.writeSymbol(","); + } + to.writeNewline(); + + // Skip a line between table entries + to.writeNewline(); + } + + to.popIndent(); + to.writeSymbol("}"); + break; + } + + case ARRAY: { + debugAssert(m_data != NULL); + if (! m_data->name.empty()) { + // For arrays, leave no trailing space between the name and the paren + to.writeSymbol(format("%s(", m_data->name.c_str())); + } else { + to.writeSymbol("("); + } + to.writeNewline(); + to.pushIndent(); + Array& array = *(m_data->value.a); + for (int ii = 0; ii < size(); ++ii) { + array[ii].serialize(to); + if (ii < size() - 1) { + to.writeSymbol(","); + to.writeNewline(); + } + + // Put the close paren on an array right behind the last element + } + to.popIndent(); + to.writeSymbol(")"); + break; + } + } +} + + +void Any::deserializeComment(TextInput& ti, Token& token, std::string& comment) { + // Parse comments + while (token.type() == Token::COMMENT) { + comment += trimWhitespace(token.string()) + "\n"; + + // Allow comments to contain newlines. + do { + token = ti.read(); + comment += "\n"; + } while (token.type() == Token::NEWLINE); + } + + comment = trimWhitespace(comment); +} + +/** True if \a c is an open paren of some form */ +static bool isOpen(const char c) { + return c == '(' || c == '[' || c == '{'; +} + + +/** True if \a c is an open paren of some form */ +static bool isClose(const char c) { + return c == ')' || c == ']' || c == '}'; +} + + +/** True if \a s is a C++ name operator */ +static bool isNameOperator(const std::string& s) { + return s == "." || s == "::" || s == "->"; +} + + +void Any::deserializeName(TextInput& ti, Token& token, std::string& name) { + debugAssert(token.type() == Token::SYMBOL); + std::string s = token.string(); + while (! isOpen(s[0])) { + name += s; + + // Skip newlines and comments + token = ti.readSignificant(); + + if (token.type() != Token::SYMBOL) { + throw ParseError(ti.filename(), token.line(), token.character(), + "Expected symbol while parsing Any"); + } + s = token.string(); + } +} + + +void Any::deserialize(TextInput& ti) { + beforeRead(); + Token token = ti.read(); + deserialize(ti, token); + // Restore the last token + ti.push(token); +} + + +void Any::deserialize(TextInput& ti, Token& token) { + // Deallocate old data + dropReference(); + m_type = NONE; + m_simpleValue.b = false; + + // Skip leading newlines + while (token.type() == Token::NEWLINE) { + token = ti.read(); + } + + std::string comment; + if (token.type() == Token::COMMENT) { + deserializeComment(ti, token, comment); + } + + if (token.type() == Token::END) { + // There should never be a comment without an Any following it; even + // if the file ends with some commented out stuff, + // that should not happen after a comma, so we'd never read that + // far in a proper file. + throw ParseError(ti.filename(), token.line(), token.character(), + "File ended without a properly formed Any"); + } + + switch (token.type()) { + case Token::STRING: + m_type = STRING; + ensureData(); + *(m_data->value.s) = token.string(); + m_data->source.set(ti, token); + break; + + case Token::NUMBER: + m_type = NUMBER; + m_simpleValue.n = token.number(); + ensureData(); + m_data->source.set(ti, token); + break; + + case Token::BOOLEAN: + m_type = BOOLEAN; + m_simpleValue.b = token.boolean(); + ensureData(); + m_data->source.set(ti, token); + break; + + case Token::SYMBOL: + // Named Array, Named Table, Array, Table, or NONE + if (toUpper(token.string()) == "NONE") { + // Nothing left to do; we initialized to NONE originally + ensureData(); + m_data->source.set(ti, token); + } else { + // Array or Table + + // Parse the name + + // s must have at least one element or this would not have + // been parsed as a symbol + std::string name; + deserializeName(ti, token, name); + if (token.type() != Token::SYMBOL) { + throw ParseError(ti.filename(), token.line(), token.character(), + "Malformed Any TABLE or ARRAY; must start with [, (, or {"); + } + + if (isOpen(token.string()[0])) { + // Array or table + deserializeBody(ti, token); + } else { + throw ParseError(ti.filename(), token.line(), token.character(), + "Malformed Any TABLE or ARRAY; must start with [, (, or {"); + } + + if (! name.empty()) { + ensureData(); + m_data->name = name; + } + } // if NONE + break; + + default: + throw ParseError(ti.filename(), token.line(), token.character(), + "Unexpected token"); + + } // switch + + if (! comment.empty()) { + ensureData(); + m_data->comment = comment; + } + + if (m_type != ARRAY && m_type != TABLE) { + // Array and table already consumed their last token + token = ti.read(); + } +} + + +void Any::ensureData() { + if (m_data == NULL) { + m_data = Data::create(m_type); + } +} + + +static bool isSeparator(char c) { + return c == ',' || c == ';'; +} + + +void Any::readUntilCommaOrClose(TextInput& ti, Token& token) { + while (! ((token.type() == Token::SYMBOL) && + (isClose(token.string()[0])) || + isSeparator(token.string()[0]))) { + switch (token.type()) { + case Token::NEWLINE: + case Token::COMMENT: + // Consume + token = ti.read(); + break; + + default: + throw ParseError(ti.filename(), token.line(), token.character(), + "Expected a comma or close paren"); + } + } +} + + +void Any::deserializeBody(TextInput& ti, Token& token) { + char closeSymbol = '}'; + m_type = TABLE; + + const char c = token.string()[0]; + + if (c != '{') { + m_type = ARRAY; + // Chose the appropriate close symbol + closeSymbol = (c == '(') ? ')' : ']'; + } + + // Allocate the underlying data structure + ensureData(); + m_data->source.set(ti, token); + + // Consume the open token + token = ti.read(); + + while (! ((token.type() == Token::SYMBOL) && (token.string()[0] == closeSymbol))) { + + // Read any leading comment. This must be done here (and not in the recursive deserialize + // call) in case the body contains only a comment. + std::string comment; + deserializeComment(ti, token, comment); + + if ((token.type() == Token::SYMBOL) && (token.string()[0] == closeSymbol)) { + // We're done; this catches the case where the array is empty + break; + } + + // Pointer the value being read + Any a = NULL; + std::string key; + + if (m_type == TABLE) { + // Read the key + if (token.type() != Token::SYMBOL && token.type() != Token::STRING) { + throw ParseError(ti.filename(), token.line(), token.character(), "Expected a name"); + } + + key = token.string(); + // Consume everything up to the = sign + token = ti.readSignificant(); + + if ((token.type() != Token::SYMBOL) || (token.string() != "=")) { + throw ParseError(ti.filename(), token.line(), token.character(), "Expected ="); + } else { + // Consume (don't consume comments--we want the value pointed to by a to get those). + token = ti.read(); + } + } + a.deserialize(ti, token); + + if (! comment.empty()) { + // Prepend the comment we read earlier + a.ensureData(); + a.m_data->comment = trimWhitespace(comment + "\n" + a.m_data->comment); + } + + if (m_type == TABLE) { + set(key, a); + } else { + append(a); + } + + // Read until the comma or close paren, discarding trailing comments and newlines + readUntilCommaOrClose(ti, token); + + // Consume the comma + if (isSeparator(token.string()[0])) { + token = ti.read(); + } + } + + // Consume the close paren (to match other deserialize methods) + token = ti.read(); +} + + +Any::operator int() const { + beforeRead(); + return iRound(number()); +} + + +Any::operator float() const { + beforeRead(); + return float(number()); +} + + +Any::operator double() const { + beforeRead(); + return number(); +} + + +Any::operator bool() const { + beforeRead(); + return boolean(); +} + + +Any::operator std::string() const { + beforeRead(); + return string(); +} + + +const Any::Source& Any::source() const { + static Source s; + if (m_data) { + return m_data->source; + } else { + return s; + } +} + + +void Any::verify(bool value, const std::string& message) const { + beforeRead(); + if (! value) { + ParseError p; + if (m_data) { + p.filename = m_data->source.filename; + p.line = m_data->source.line; + p.character = m_data->source.character; + } + + if (name().empty()) { + p.message = "Parse error"; + } else { + p.message = "Parse error while reading the contents of " + name(); + } + + if (! message.empty()) { + p.message = p.message + ": " + message; + } + + throw p; + } +} + + +void Any::verifyName(const std::string& n) const { + beforeRead(); + verify(beginsWith(toUpper(name()), toUpper(n)), "Name must begin with " + n); +} + + +void Any::verifyType(Type t) const { + beforeRead(); + if (type() != t) { + verify(false, "Must have type " + toString(t)); + } +} + + +void Any::verifyType(Type t0, Type t1) const { + beforeRead(); + if (type() != t0 && type() != t1) { + verify(false, "Must have type " + toString(t0) + " or " + toString(t1)); + } +} + + +void Any::verifySize(int low, int high) const { + beforeRead(); + verifyType(ARRAY, TABLE); + if (size() < low || size() > high) { + verify(false, format("Size must be between %d and %d", low, high)); + } +} + + +void Any::verifySize(int s) const { + beforeRead(); + verifyType(ARRAY, TABLE); + if (size() != s) { + verify(false, format("Size must be %d", s)); + } +} + + +std::string Any::toString(Type t) { + switch(t) { + case NONE: return "NONE"; + case BOOLEAN: return "BOOLEAN"; + case NUMBER: return "NUMBER"; + case STRING: return "STRING"; + case ARRAY: return "ARRAY"; + case TABLE: return "TABLE"; + default: + alwaysAssertM(false, "Illegal Any::Type"); + return ""; + } +} + +} // namespace G3D + diff --git a/externals/g3dlite/BinaryFormat.cpp b/externals/g3dlite/BinaryFormat.cpp new file mode 100644 index 0000000..d399137 --- /dev/null +++ b/externals/g3dlite/BinaryFormat.cpp @@ -0,0 +1,81 @@ +/** + @file BinaryFormat.cpp + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2005-06-10 + @edited 2005-06-10 + */ + +#include "G3D/BinaryFormat.h" + +namespace G3D { + +int32 byteSize(BinaryFormat f) { + switch (f) { + case BOOL8_BINFMT: + case UINT8_BINFMT: + case INT8_BINFMT: + return 1; + + case UINT16_BINFMT: + case INT16_BINFMT: + return 2; + + case FLOAT16_BINFMT: + return 2; + + case UINT32_BINFMT: + case INT32_BINFMT: + case FLOAT32_BINFMT: + return 4; + + case FLOAT64_BINFMT: + case UINT64_BINFMT: + case INT64_BINFMT: + return 8; + + case INT128_BINFMT: + case UINT128_BINFMT: + return 16; + + case VECTOR2_BINFMT: + return 2 * 4; + + case VECTOR2INT16_BINFMT: + return 2 * 2; + + case VECTOR3_BINFMT: + return 3 * 4; + + case VECTOR3INT16_BINFMT: + return 3 * 2; + + case VECTOR4_BINFMT: + return 4 * 4; + + case VECTOR4INT16_BINFMT: + return 4 * 4; + + case COLOR3_BINFMT: + return 3 * 4; + + case COLOR3UINT8_BINFMT: + return 3 * 1; + + case COLOR3INT16_BINFMT: + return 3 * 2; + + case COLOR4_BINFMT: + return 4 * 4; + + case COLOR4UINT8_BINFMT: + return 4 * 1; + + case COLOR4INT16_BINFMT: + return 4 * 2; + + default: + return -1; + } +} +} diff --git a/externals/g3dlite/BinaryInput.cpp b/externals/g3dlite/BinaryInput.cpp new file mode 100644 index 0000000..65a9976 --- /dev/null +++ b/externals/g3dlite/BinaryInput.cpp @@ -0,0 +1,568 @@ +/** + @file BinaryInput.cpp + + @author Morgan McGuire, graphics3d.com + Copyright 2001-2007, Morgan McGuire. All rights reserved. + + @created 2001-08-09 + @edited 2005-02-24 + + +
+    {    
+    BinaryOutput b("c:/tmp/test.b", BinaryOutput::LITTLE_ENDIAN);
+
+    float f = 3.1415926;
+    int i = 1027221;
+    std::string s = "Hello World!";
+
+    b.writeFloat32(f);
+    b.writeInt32(i);
+    b.writeString(s);
+    b.commit();
+    
+
+    BinaryInput in("c:/tmp/test.b", BinaryInput::LITTLE_ENDIAN);
+
+    debugAssert(f == in.readFloat32());
+    int ii = in.readInt32();
+    debugAssert(i == ii);
+    debugAssert(s == in.readString());
+    }
+  
+ */ + +#include "G3D/platform.h" +#include "G3D/BinaryInput.h" +#include "G3D/Array.h" +#include "G3D/fileutils.h" +#include "G3D/Log.h" +#include + +#include + +namespace G3D { + +void BinaryInput::readBool8(std::vector& out, int64 n) { + out.resize((int)n); + // std::vector optimizes bool in a way that prevents fast reading + for (int64 i = 0; i < n ; ++i) { + out[i] = readBool8(); + } +} + + +void BinaryInput::readBool8(Array& out, int64 n) { + out.resize(n); + readBool8(out.begin(), n); +} + + +#define IMPLEMENT_READER(ucase, lcase)\ +void BinaryInput::read##ucase(std::vector& out, int64 n) {\ + out.resize(n);\ + read##ucase(&out[0], n);\ +}\ +\ +\ +void BinaryInput::read##ucase(Array& out, int64 n) {\ + out.resize(n);\ + read##ucase(out.begin(), n);\ +} + + +IMPLEMENT_READER(UInt8, uint8) +IMPLEMENT_READER(Int8, int8) +IMPLEMENT_READER(UInt16, uint16) +IMPLEMENT_READER(Int16, int16) +IMPLEMENT_READER(UInt32, uint32) +IMPLEMENT_READER(Int32, int32) +IMPLEMENT_READER(UInt64, uint64) +IMPLEMENT_READER(Int64, int64) +IMPLEMENT_READER(Float32, float32) +IMPLEMENT_READER(Float64, float64) + +#undef IMPLEMENT_READER + +// Data structures that are one byte per element can be +// directly copied, regardles of endian-ness. +#define IMPLEMENT_READER(ucase, lcase)\ +void BinaryInput::read##ucase(lcase* out, int64 n) {\ + if (sizeof(lcase) == 1) {\ + readBytes(out, n);\ + } else {\ + for (int64 i = 0; i < n ; ++i) {\ + out[i] = read##ucase();\ + }\ + }\ +} + +IMPLEMENT_READER(Bool8, bool) +IMPLEMENT_READER(UInt8, uint8) +IMPLEMENT_READER(Int8, int8) + +#undef IMPLEMENT_READER + + +#define IMPLEMENT_READER(ucase, lcase)\ +void BinaryInput::read##ucase(lcase* out, int64 n) {\ + if (m_swapBytes) {\ + for (int64 i = 0; i < n; ++i) {\ + out[i] = read##ucase();\ + }\ + } else {\ + readBytes(out, sizeof(lcase) * n);\ + }\ +} + + +IMPLEMENT_READER(UInt16, uint16) +IMPLEMENT_READER(Int16, int16) +IMPLEMENT_READER(UInt32, uint32) +IMPLEMENT_READER(Int32, int32) +IMPLEMENT_READER(UInt64, uint64) +IMPLEMENT_READER(Int64, int64) +IMPLEMENT_READER(Float32, float32) +IMPLEMENT_READER(Float64, float64) + +#undef IMPLEMENT_READER + +void BinaryInput::loadIntoMemory(int64 startPosition, int64 minLength) { + // Load the next section of the file + debugAssertM(m_filename != "", "Read past end of file."); + + int64 absPos = m_alreadyRead + m_pos; + + if (m_bufferLength < minLength) { + // The current buffer isn't big enough to hold the chunk we want to read. + // This happens if there was little memory available during the initial constructor + // read but more memory has since been freed. + m_bufferLength = minLength; + debugAssert(m_freeBuffer); + m_buffer = (uint8*)System::realloc(m_buffer, m_bufferLength); + if (m_buffer == NULL) { + throw "Tried to read a larger memory chunk than could fit in memory. (2)"; + } + } + + m_alreadyRead = startPosition; + +# ifdef G3D_WIN32 + FILE* file = fopen(m_filename.c_str(), "rb"); + debugAssert(file); + int ret = fseek(file, (off_t)m_alreadyRead, SEEK_SET); + debugAssert(ret == 0); + size_t toRead = (size_t)G3D::min(m_bufferLength, m_length - m_alreadyRead); + ret = fread(m_buffer, 1, toRead, file); + debugAssert(ret == toRead); + fclose(file); + file = NULL; + +# else + FILE* file = fopen(m_filename.c_str(), "rb"); + debugAssert(file); + int ret = fseeko(file, (off_t)m_alreadyRead, SEEK_SET); + debugAssert(ret == 0); + size_t toRead = (size_t)G3D::min(m_bufferLength, m_length - m_alreadyRead); + ret = fread(m_buffer, 1, toRead, file); + debugAssert((size_t)ret == (size_t)toRead); + fclose(file); + file = NULL; +# endif + + m_pos = absPos - m_alreadyRead; + debugAssert(m_pos >= 0); +} + + + +const bool BinaryInput::NO_COPY = false; + +static bool needSwapBytes(G3DEndian fileEndian) { + return (fileEndian != System::machineEndian()); +} + + +/** Helper used by the constructors for decompression */ +static uint32 readUInt32(const uint8* data, bool swapBytes) { + if (swapBytes) { + uint8 out[4]; + out[0] = data[3]; + out[1] = data[2]; + out[2] = data[1]; + out[3] = data[0]; + return *((uint32*)out); + } else { + return *((uint32*)data); + } +} + + +void BinaryInput::setEndian(G3DEndian e) { + m_fileEndian = e; + m_swapBytes = needSwapBytes(m_fileEndian); +} + + +BinaryInput::BinaryInput( + const uint8* data, + int64 dataLen, + G3DEndian dataEndian, + bool compressed, + bool copyMemory) : + m_filename(""), + m_bitPos(0), + m_bitString(0), + m_beginEndBits(0), + m_alreadyRead(0), + m_bufferLength(0), + m_pos(0) { + + m_freeBuffer = copyMemory || compressed; + + setEndian(dataEndian); + + if (compressed) { + // Read the decompressed size from the first 4 bytes + m_length = G3D::readUInt32(data, m_swapBytes); + + debugAssert(m_freeBuffer); + m_buffer = (uint8*)System::alignedMalloc(m_length, 16); + + unsigned long L = m_length; + // Decompress with zlib + int64 result = uncompress(m_buffer, (unsigned long*)&L, data + 4, dataLen - 4); + m_length = L; + m_bufferLength = L; + debugAssert(result == Z_OK); (void)result; + + } else { + m_length = dataLen; + m_bufferLength = m_length; + if (! copyMemory) { + debugAssert(!m_freeBuffer); + m_buffer = const_cast(data); + } else { + debugAssert(m_freeBuffer); + m_buffer = (uint8*)System::alignedMalloc(m_length, 16); + System::memcpy(m_buffer, data, dataLen); + } + } +} + + +BinaryInput::BinaryInput( + const std::string& filename, + G3DEndian fileEndian, + bool compressed) : + m_filename(filename), + m_bitPos(0), + m_bitString(0), + m_beginEndBits(0), + m_alreadyRead(0), + m_length(0), + m_bufferLength(0), + m_buffer(NULL), + m_pos(0), + m_freeBuffer(true) { + + setEndian(fileEndian); + + // Update global file tracker + _internal::currentFilesUsed.insert(m_filename); + + + if (! fileExists(m_filename, false)) { + std::string zipfile; + std::string internalfile; + if (zipfileExists(m_filename, zipfile, internalfile)) { + // Load from zipfile + void* v; + size_t s; + zipRead(filename, v, s); + m_buffer = reinterpret_cast(v); + m_bufferLength = m_length = s; + if (compressed) { + decompress(); + } + m_freeBuffer = true; + } else { + Log::common()->printf("Warning: File not found: %s\n", m_filename.c_str()); + } + return; + } + + // Figure out how big the file is and verify that it exists. + m_length = fileLength(m_filename); + + // Read the file into memory + FILE* file = fopen(m_filename.c_str(), "rb"); + + if (! file || (m_length == -1)) { + throw format("File not found: \"%s\"", m_filename.c_str()); + return; + } + + if (! compressed && (m_length > INITIAL_BUFFER_LENGTH)) { + // Read only a subset of the file so we don't consume + // all available memory. + m_bufferLength = INITIAL_BUFFER_LENGTH; + } else { + // Either the length is fine or the file is compressed + // and requires us to read the whole thing for zlib. + m_bufferLength = m_length; + } + + debugAssert(m_freeBuffer); + m_buffer = (uint8*)System::alignedMalloc(m_bufferLength, 16); + if (m_buffer == NULL) { + if (compressed) { + throw "Not enough memory to load compressed file. (1)"; + } + + // Try to allocate a small array; not much memory is available. + // Give up if we can't allocate even 1k. + while ((m_buffer == NULL) && (m_bufferLength > 1024)) { + m_bufferLength /= 2; + m_buffer = (uint8*)System::alignedMalloc(m_bufferLength, 16); + } + } + debugAssert(m_buffer); + + fread(m_buffer, m_bufferLength, sizeof(int8), file); + fclose(file); + file = NULL; + + if (compressed) { + if (m_bufferLength != m_length) { + throw "Not enough memory to load compressed file. (2)"; + } + + decompress(); + } +} + +void BinaryInput::decompress() { + // Decompress + // Use the existing buffer as the source, allocate + // a new buffer to use as the destination. + + int64 tempLength = m_length; + m_length = G3D::readUInt32(m_buffer, m_swapBytes); + + // The file couldn't have better than 500:1 compression + alwaysAssertM(m_length < m_bufferLength * 500, "Compressed file header is corrupted"); + + uint8* tempBuffer = m_buffer; + m_buffer = (uint8*)System::alignedMalloc(m_length, 16); + + debugAssert(m_buffer); + debugAssert(isValidHeapPointer(tempBuffer)); + debugAssert(isValidHeapPointer(m_buffer)); + + unsigned long L = m_length; + int64 result = uncompress(m_buffer, &L, tempBuffer + 4, tempLength - 4); + m_length = L; + m_bufferLength = m_length; + + debugAssertM(result == Z_OK, "BinaryInput/zlib detected corruption in " + m_filename); + (void)result; + + System::alignedFree(tempBuffer); +} + + +void BinaryInput::readBytes(void* bytes, int64 n) { + prepareToRead(n); + debugAssert(isValidPointer(bytes)); + + memcpy(bytes, m_buffer + m_pos, n); + m_pos += n; +} + + +BinaryInput::~BinaryInput() { + + if (m_freeBuffer) { + System::alignedFree(m_buffer); + } + m_buffer = NULL; +} + + +uint64 BinaryInput::readUInt64() { + prepareToRead(8); + uint8 out[8]; + + if (m_swapBytes) { + out[0] = m_buffer[m_pos + 7]; + out[1] = m_buffer[m_pos + 6]; + out[2] = m_buffer[m_pos + 5]; + out[3] = m_buffer[m_pos + 4]; + out[4] = m_buffer[m_pos + 3]; + out[5] = m_buffer[m_pos + 2]; + out[6] = m_buffer[m_pos + 1]; + out[7] = m_buffer[m_pos + 0]; + } else { + *(uint64*)out = *(uint64*)(m_buffer + m_pos); + } + + m_pos += 8; + return *(uint64*)out; +} + + +std::string BinaryInput::readString(int64 n) { + prepareToRead(n); + debugAssertM((m_pos + n) <= m_length, "Read past end of file"); + + char *s = (char*)System::alignedMalloc(n + 1, 16); + assert(s != NULL); + + memcpy(s, m_buffer + m_pos, n); + // There may not be a null, so make sure + // we add one. + s[n] = '\0'; + + std::string out = s; + System::alignedFree(s); + s = NULL; + + m_pos += n; + + return out; + +} + + +std::string BinaryInput::readString() { + int64 n = 0; + + if ((m_pos + m_alreadyRead + n) < (m_length - 1)) { + prepareToRead(1); + } + + if ( ((m_pos + m_alreadyRead + n) < (m_length - 1)) && + (m_buffer[m_pos + n] != '\0')) { + + ++n; + while ( ((m_pos + m_alreadyRead + n) < (m_length - 1)) && + (m_buffer[m_pos + n] != '\0')) { + + prepareToRead(1); + ++n; + } + } + + // Consume NULL + ++n; + + return readString(n); +} + + +std::string BinaryInput::readStringEven() { + std::string x = readString(); + if (hasMore() && (G3D::isOdd(x.length() + 1))) { + skip(1); + } + return x; +} + + +std::string BinaryInput::readString32() { + int len = readUInt32(); + return readString(len); +} + + +Vector4 BinaryInput::readVector4() { + float x = readFloat32(); + float y = readFloat32(); + float z = readFloat32(); + float w = readFloat32(); + return Vector4(x, y, z, w); +} + + +Vector3 BinaryInput::readVector3() { + float x = readFloat32(); + float y = readFloat32(); + float z = readFloat32(); + return Vector3(x, y, z); +} + + +Vector2 BinaryInput::readVector2() { + float x = readFloat32(); + float y = readFloat32(); + return Vector2(x, y); +} + + +Color4 BinaryInput::readColor4() { + float r = readFloat32(); + float g = readFloat32(); + float b = readFloat32(); + float a = readFloat32(); + return Color4(r, g, b, a); +} + + +Color3 BinaryInput::readColor3() { + float r = readFloat32(); + float g = readFloat32(); + float b = readFloat32(); + return Color3(r, g, b); +} + + +void BinaryInput::beginBits() { + debugAssert(m_beginEndBits == 0); + m_beginEndBits = 1; + m_bitPos = 0; + + debugAssertM(hasMore(), "Can't call beginBits when at the end of a file"); + m_bitString = readUInt8(); +} + + +uint32 BinaryInput::readBits(int numBits) { + debugAssert(m_beginEndBits == 1); + + uint32 out = 0; + + const int total = numBits; + while (numBits > 0) { + if (m_bitPos > 7) { + // Consume a new byte for reading. We do this at the beginning + // of the loop so that we don't try to read past the end of the file. + m_bitPos = 0; + m_bitString = readUInt8(); + } + + // Slide the lowest bit of the bitString into + // the correct position. + out |= (m_bitString & 1) << (total - numBits); + + // Shift over to the next bit + m_bitString = m_bitString >> 1; + ++m_bitPos; + --numBits; + } + + return out; +} + + +void BinaryInput::endBits() { + debugAssert(m_beginEndBits == 1); + if (m_bitPos == 0) { + // Put back the last byte we read + --m_pos; + } + m_beginEndBits = 0; + m_bitPos = 0; +} + +} diff --git a/externals/g3dlite/BinaryOutput.cpp b/externals/g3dlite/BinaryOutput.cpp new file mode 100644 index 0000000..2de46c6 --- /dev/null +++ b/externals/g3dlite/BinaryOutput.cpp @@ -0,0 +1,522 @@ +/** + @file BinaryOutput.cpp + + @author Morgan McGuire, graphics3d.com + Copyright 2002-2007, Morgan McGuire, All rights reserved. + + @created 2002-02-20 + @edited 2008-01-07 + */ + +#include "G3D/platform.h" +#include "G3D/BinaryOutput.h" +#include "G3D/fileutils.h" +#include "G3D/stringutils.h" +#include "G3D/Array.h" +#include + +#include + +// Largest memory buffer that the system will use for writing to +// disk. After this (or if the system runs out of memory) +// chunks of the file will be dumped to disk. +// +// Currently 400 MB +#define MAX_BINARYOUTPUT_BUFFER_SIZE 400000000 + +namespace G3D { + +void BinaryOutput::writeBool8(const std::vector& out, int n) { + for (int i = 0; i < n; ++i) { + writeBool8(out[i]); + } +} + + +void BinaryOutput::writeBool8(const Array& out, int n) { + writeBool8(out.getCArray(), n); +} + +#define IMPLEMENT_WRITER(ucase, lcase)\ +void BinaryOutput::write##ucase(const std::vector& out, int n) {\ + write##ucase(&out[0], n);\ +}\ +\ +\ +void BinaryOutput::write##ucase(const Array& out, int n) {\ + write##ucase(out.getCArray(), n);\ +} + + +IMPLEMENT_WRITER(UInt8, uint8) +IMPLEMENT_WRITER(Int8, int8) +IMPLEMENT_WRITER(UInt16, uint16) +IMPLEMENT_WRITER(Int16, int16) +IMPLEMENT_WRITER(UInt32, uint32) +IMPLEMENT_WRITER(Int32, int32) +IMPLEMENT_WRITER(UInt64, uint64) +IMPLEMENT_WRITER(Int64, int64) +IMPLEMENT_WRITER(Float32, float32) +IMPLEMENT_WRITER(Float64, float64) + +#undef IMPLEMENT_WRITER + +// Data structures that are one byte per element can be +// directly copied, regardles of endian-ness. +#define IMPLEMENT_WRITER(ucase, lcase)\ +void BinaryOutput::write##ucase(const lcase* out, int n) {\ + if (sizeof(lcase) == 1) {\ + writeBytes((void*)out, n);\ + } else {\ + for (int i = 0; i < n ; ++i) {\ + write##ucase(out[i]);\ + }\ + }\ +} + +IMPLEMENT_WRITER(Bool8, bool) +IMPLEMENT_WRITER(UInt8, uint8) +IMPLEMENT_WRITER(Int8, int8) + +#undef IMPLEMENT_WRITER + + +#define IMPLEMENT_WRITER(ucase, lcase)\ +void BinaryOutput::write##ucase(const lcase* out, int n) {\ + if (m_swapBytes) {\ + for (int i = 0; i < n; ++i) {\ + write##ucase(out[i]);\ + }\ + } else {\ + writeBytes((const void*)out, sizeof(lcase) * n);\ + }\ +} + + +IMPLEMENT_WRITER(UInt16, uint16) +IMPLEMENT_WRITER(Int16, int16) +IMPLEMENT_WRITER(UInt32, uint32) +IMPLEMENT_WRITER(Int32, int32) +IMPLEMENT_WRITER(UInt64, uint64) +IMPLEMENT_WRITER(Int64, int64) +IMPLEMENT_WRITER(Float32, float32) +IMPLEMENT_WRITER(Float64, float64) + +#undef IMPLEMENT_WRITER + + +void BinaryOutput::reallocBuffer(size_t bytes, size_t oldBufferLen) { + //debugPrintf("reallocBuffer(%d, %d)\n", bytes, oldBufferLen); + + size_t newBufferLen = (int)(m_bufferLen * 1.5) + 100; + uint8* newBuffer = NULL; + + if ((m_filename == "") || (newBufferLen < MAX_BINARYOUTPUT_BUFFER_SIZE)) { + // We're either writing to memory (in which case we *have* to try and allocate) + // or we've been asked to allocate a reasonable size buffer. + + //debugPrintf(" realloc(%d)\n", newBufferLen); + newBuffer = (uint8*)System::realloc(m_buffer, newBufferLen); + if (newBuffer != NULL) { + m_maxBufferLen = newBufferLen; + } + } + + if ((newBuffer == NULL) && (bytes > 0)) { + // Realloc failed; we're probably out of memory. Back out + // the entire call and try to dump some data to disk. + m_bufferLen = oldBufferLen; + reserveBytesWhenOutOfMemory(bytes); + } else { + m_buffer = newBuffer; + debugAssert(isValidHeapPointer(m_buffer)); + } +} + + +void BinaryOutput::reserveBytesWhenOutOfMemory(size_t bytes) { + if (m_filename == "") { + throw "Out of memory while writing to memory in BinaryOutput (no RAM left)."; + } else if ((int)bytes > (int)m_maxBufferLen) { + throw "Out of memory while writing to disk in BinaryOutput (could not create a large enough buffer)."; + } else { + + // Dump the contents to disk. In order to enable seeking backwards, + // we keep the last 10 MB in memory. + int writeBytes = m_bufferLen - 10 * 1024 * 1024; + + if (writeBytes < m_bufferLen / 3) { + // We're going to write less than 1/3 of the file; + // give up and just write the whole thing. + writeBytes = m_bufferLen; + } + debugAssert(writeBytes > 0); + + //debugPrintf("Writing %d bytes to disk\n", writeBytes); + + const char* mode = (m_alreadyWritten > 0) ? "ab" : "wb"; + FILE* file = fopen(m_filename.c_str(), mode); + debugAssert(file); + + size_t count = fwrite(m_buffer, 1, writeBytes, file); + debugAssert((int)count == writeBytes); (void)count; + + fclose(file); + file = NULL; + + // Record that we saved this data. + m_alreadyWritten += writeBytes; + m_bufferLen -= writeBytes; + m_pos -= writeBytes; + + debugAssert(m_bufferLen < m_maxBufferLen); + debugAssert(m_bufferLen >= 0); + debugAssert(m_pos >= 0); + debugAssert(m_pos <= m_bufferLen); + + // Shift the unwritten data back appropriately in the buffer. + debugAssert(isValidHeapPointer(m_buffer)); + System::memcpy(m_buffer, m_buffer + writeBytes, m_bufferLen); + debugAssert(isValidHeapPointer(m_buffer)); + + // *now* we allocate bytes (there should presumably be enough + // space in the buffer; if not, we'll come back through this + // code and dump the last 10MB to disk as well. Note that the + // bytes > maxBufferLen case above would already have triggered + // if this call couldn't succeed. + reserveBytes(bytes); + } +} + + +BinaryOutput::BinaryOutput() { + m_alreadyWritten = 0; + m_swapBytes = false; + m_pos = 0; + m_filename = ""; + m_buffer = NULL; + m_bufferLen = 0; + m_maxBufferLen = 0; + m_beginEndBits = 0; + m_bitString = 0; + m_bitPos = 0; + m_ok = true; + m_committed = false; +} + + +BinaryOutput::BinaryOutput( + const std::string& filename, + G3DEndian fileEndian) { + + m_pos = 0; + m_alreadyWritten = 0; + setEndian(fileEndian); + m_filename = filename; + m_buffer = NULL; + m_bufferLen = 0; + m_maxBufferLen = 0; + m_beginEndBits = 0; + m_bitString = 0; + m_bitPos = 0; + m_committed = false; + + m_ok = true; + /** Verify ability to write to disk */ + commit(false); + m_committed = false; +} + + +void BinaryOutput::reset() { + debugAssert(m_beginEndBits == 0); + alwaysAssertM(m_filename == "", + "Can only reset a BinaryOutput that writes to memory."); + + // Do not reallocate, just clear the size of the buffer. + m_pos = 0; + m_alreadyWritten = 0; + m_bufferLen = 0; + m_beginEndBits = 0; + m_bitString = 0; + m_bitPos = 0; + m_committed = false; +} + + +BinaryOutput::~BinaryOutput() { + debugAssert((m_buffer == NULL) || isValidHeapPointer(m_buffer)); + System::free(m_buffer); + m_buffer = NULL; + m_bufferLen = 0; + m_maxBufferLen = 0; +} + + +void BinaryOutput::setEndian(G3DEndian fileEndian) { + m_fileEndian = fileEndian; + m_swapBytes = (fileEndian != System::machineEndian()); +} + + +bool BinaryOutput::ok() const { + return m_ok; +} + + +void BinaryOutput::compress() { + if (m_alreadyWritten > 0) { + throw "Cannot compress huge files (part of this file has already been written to disk)."; + } + + // Old buffer size + int L = m_bufferLen; + uint8* convert = (uint8*)&L; + + // Zlib requires the output buffer to be this big + unsigned long newSize = iCeil(m_bufferLen * 1.01) + 12; + uint8* temp = (uint8*)System::malloc(newSize); + int result = compress2(temp, &newSize, m_buffer, m_bufferLen, 9); + + debugAssert(result == Z_OK); (void)result; + + // Write the header + if (m_swapBytes) { + m_buffer[0] = convert[3]; + m_buffer[1] = convert[2]; + m_buffer[2] = convert[1]; + m_buffer[3] = convert[0]; + } else { + m_buffer[0] = convert[0]; + m_buffer[1] = convert[1]; + m_buffer[2] = convert[2]; + m_buffer[3] = convert[3]; + } + + // Write the data + if ((int64)newSize + 4 > (int64)m_maxBufferLen) { + m_maxBufferLen = newSize + 4; + m_buffer = (uint8*)System::realloc(m_buffer, m_maxBufferLen); + } + m_bufferLen = newSize + 4; + System::memcpy(m_buffer + 4, temp, newSize); + m_pos = m_bufferLen; + + System::free(temp); +} + + +void BinaryOutput::commit(bool flush) { + debugAssertM(! m_committed, "Cannot commit twice"); + m_committed = true; + debugAssertM(m_beginEndBits == 0, "Missing endBits before commit"); + + // Make sure the directory exists. + std::string root, base, ext, path; + Array pathArray; + parseFilename(m_filename, root, pathArray, base, ext); + + path = root + stringJoin(pathArray, '/'); + if (! fileExists(path, false)) { + createDirectory(path); + } + + const char* mode = (m_alreadyWritten > 0) ? "ab" : "wb"; + + FILE* file = fopen(m_filename.c_str(), mode); + + m_ok = (file != NULL) && m_ok; + + if (m_ok) { + debugAssertM(file, std::string("Could not open '") + m_filename + "'"); + + if (m_buffer != NULL) { + m_alreadyWritten += m_bufferLen; + + int success = fwrite(m_buffer, m_bufferLen, 1, file); + (void)success; + debugAssertM(success == 1, std::string("Could not write to '") + m_filename + "'"); + } + if (flush) { + fflush(file); + } + fclose(file); + file = NULL; + } +} + + +void BinaryOutput::commit( + uint8* out) { + debugAssertM(! m_committed, "Cannot commit twice"); + m_committed = true; + + System::memcpy(out, m_buffer, m_bufferLen); +} + + +void BinaryOutput::writeUInt16(uint16 u) { + reserveBytes(2); + + uint8* convert = (uint8*)&u; + + if (m_swapBytes) { + m_buffer[m_pos] = convert[1]; + m_buffer[m_pos + 1] = convert[0]; + } else { + *(uint16*)(m_buffer + m_pos) = u; + } + + m_pos += 2; +} + + +void BinaryOutput::writeUInt32(uint32 u) { + reserveBytes(4); + + uint8* convert = (uint8*)&u; + + debugAssert(m_beginEndBits == 0); + + if (m_swapBytes) { + m_buffer[m_pos] = convert[3]; + m_buffer[m_pos + 1] = convert[2]; + m_buffer[m_pos + 2] = convert[1]; + m_buffer[m_pos + 3] = convert[0]; + } else { + *(uint32*)(m_buffer + m_pos) = u; + } + + m_pos += 4; +} + + +void BinaryOutput::writeUInt64(uint64 u) { + reserveBytes(8); + + uint8* convert = (uint8*)&u; + + if (m_swapBytes) { + m_buffer[m_pos] = convert[7]; + m_buffer[m_pos + 1] = convert[6]; + m_buffer[m_pos + 2] = convert[5]; + m_buffer[m_pos + 3] = convert[4]; + m_buffer[m_pos + 4] = convert[3]; + m_buffer[m_pos + 5] = convert[2]; + m_buffer[m_pos + 6] = convert[1]; + m_buffer[m_pos + 7] = convert[0]; + } else { + *(uint64*)(m_buffer + m_pos) = u; + } + + m_pos += 8; +} + + +void BinaryOutput::writeString(const char* s) { + // +1 is because strlen doesn't count the null + int len = strlen(s) + 1; + + debugAssert(m_beginEndBits == 0); + reserveBytes(len); + System::memcpy(m_buffer + m_pos, s, len); + m_pos += len; +} + + +void BinaryOutput::writeStringEven(const char* s) { + // +1 is because strlen doesn't count the null + int len = strlen(s) + 1; + + reserveBytes(len); + System::memcpy(m_buffer + m_pos, s, len); + m_pos += len; + + // Pad with another NULL + if ((len % 2) == 1) { + writeUInt8(0); + } +} + + +void BinaryOutput::writeString32(const char* s) { + writeUInt32(strlen(s) + 1); + writeString(s); +} + + +void BinaryOutput::writeVector4(const Vector4& v) { + writeFloat32(v.x); + writeFloat32(v.y); + writeFloat32(v.z); + writeFloat32(v.w); +} + + +void BinaryOutput::writeVector3(const Vector3& v) { + writeFloat32(v.x); + writeFloat32(v.y); + writeFloat32(v.z); +} + + +void BinaryOutput::writeVector2(const Vector2& v) { + writeFloat32(v.x); + writeFloat32(v.y); +} + + +void BinaryOutput::writeColor4(const Color4& v) { + writeFloat32(v.r); + writeFloat32(v.g); + writeFloat32(v.b); + writeFloat32(v.a); +} + + +void BinaryOutput::writeColor3(const Color3& v) { + writeFloat32(v.r); + writeFloat32(v.g); + writeFloat32(v.b); +} + + +void BinaryOutput::beginBits() { + debugAssertM(m_beginEndBits == 0, "Already in beginBits...endBits"); + m_bitString = 0x00; + m_bitPos = 0; + m_beginEndBits = 1; +} + + +void BinaryOutput::writeBits(uint32 value, int numBits) { + + while (numBits > 0) { + // Extract the current bit of value and + // insert it into the current byte + m_bitString |= (value & 1) << m_bitPos; + ++m_bitPos; + value = value >> 1; + --numBits; + + if (m_bitPos > 7) { + // We've reached the end of this byte + writeUInt8(m_bitString); + m_bitString = 0x00; + m_bitPos = 0; + } + } +} + + +void BinaryOutput::endBits() { + debugAssertM(m_beginEndBits == 1, "Not in beginBits...endBits"); + if (m_bitPos > 0) { + writeUInt8(m_bitString); + } + m_bitString = 0; + m_bitPos = 0; + m_beginEndBits = 0; +} + +} diff --git a/externals/g3dlite/Box.cpp b/externals/g3dlite/Box.cpp new file mode 100644 index 0000000..f7c112a --- /dev/null +++ b/externals/g3dlite/Box.cpp @@ -0,0 +1,393 @@ +/** + @file Box.cpp + Box class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2006-02-05 +*/ + +#include "G3D/Box.h" +#include "G3D/debug.h" +#include "G3D/Plane.h" +#include "G3D/AABox.h" +#include "G3D/CoordinateFrame.h" + +namespace G3D { + +/** + Sets a field on four vertices. Used by the constructor. + */ +#define setMany(i0, i1, i2, i3, field, extreme) \ + _corner[i0].field = _corner[i1].field = \ + _corner[i2].field = _corner[i3].field = \ + (extreme).field + +Box::Box() { +} + + +Box::Box(const AABox& b) { + init(b.low(), b.high()); +} + +Box::Box(class BinaryInput& b) { + deserialize(b); +} + + +void Box::serialize(class BinaryOutput& b) const { + int i; + for (i = 0; i < 8; ++i) { + _corner[i].serialize(b); + } + + // Other state can be reconstructed +} + + +void Box::deserialize(class BinaryInput& b) { + int i; + + _center = Vector3::zero(); + for (i = 0; i < 8; ++i) { + _corner[i].deserialize(b); + _center += _corner[i]; + } + + _center = _center / 8; + + // Reconstruct other state from the corners + _axis[0] = _corner[5] - _corner[4]; + _axis[1] = _corner[7] - _corner[4]; + _axis[2] = _corner[0] - _corner[4]; + + for (i = 0; i < 3; ++i) { + _extent[i] = _axis[i].magnitude(); + _axis[i] /= _extent[i]; + } + + _volume = _extent.x * _extent.y * _extent.z; + + _area = 2 * + (_extent.x * _extent.y + + _extent.y * _extent.z + + _extent.z * _extent.x); +} + + +Box::Box( + const Vector3& min, + const Vector3& max) { + + init(min.min(max), min.max(max)); + +} + +void Box::init( + const Vector3& min, + const Vector3& max) { + + debugAssert( + (min.x <= max.x) && + (min.y <= max.y) && + (min.z <= max.z)); + + setMany(0, 1, 2, 3, z, max); + setMany(4, 5, 6, 7, z, min); + + setMany(1, 2, 5, 6, x, max); + setMany(0, 3, 4, 7, x, min); + + setMany(3, 2, 6, 7, y, max); + setMany(0, 1, 5, 4, y, min); + + _extent = max - min; + + _axis[0] = Vector3::unitX(); + _axis[1] = Vector3::unitY(); + _axis[2] = Vector3::unitZ(); + + if (_extent.isFinite()) { + _volume = _extent.x * _extent.y * _extent.z; + } else { + _volume = G3D::finf(); + } + + debugAssert(! isNaN(_extent.x)); + + _area = 2 * + (_extent.x * _extent.y + + _extent.y * _extent.z + + _extent.z * _extent.x); + + _center = (max + min) * 0.5f; + + // If the extent is infinite along an axis, make the center zero to avoid NaNs + for (int i = 0; i < 3; ++i) { + if (! G3D::isFinite(_extent[i])) { + _center[i] = 0.0f; + } + } +} + + +float Box::volume() const { + return _volume; +} + + +float Box::area() const { + return _area; +} + + +void Box::getLocalFrame(CoordinateFrame& frame) const { + + frame.rotation = Matrix3( + _axis[0][0], _axis[1][0], _axis[2][0], + _axis[0][1], _axis[1][1], _axis[2][1], + _axis[0][2], _axis[1][2], _axis[2][2]); + + frame.translation = _center; +} + + +CoordinateFrame Box::localFrame() const { + CoordinateFrame out; + getLocalFrame(out); + return out; +} + + +void Box::getFaceCorners(int f, Vector3& v0, Vector3& v1, Vector3& v2, Vector3& v3) const { + switch (f) { + case 0: + v0 = _corner[0]; v1 = _corner[1]; v2 = _corner[2]; v3 = _corner[3]; + break; + + case 1: + v0 = _corner[1]; v1 = _corner[5]; v2 = _corner[6]; v3 = _corner[2]; + break; + + case 2: + v0 = _corner[7]; v1 = _corner[6]; v2 = _corner[5]; v3 = _corner[4]; + break; + + case 3: + v0 = _corner[2]; v1 = _corner[6]; v2 = _corner[7]; v3 = _corner[3]; + break; + + case 4: + v0 = _corner[3]; v1 = _corner[7]; v2 = _corner[4]; v3 = _corner[0]; + break; + + case 5: + v0 = _corner[1]; v1 = _corner[0]; v2 = _corner[4]; v3 = _corner[5]; + break; + + default: + debugAssert((f >= 0) && (f < 6)); + } +} + + + +int Box::dummy = 0; + +bool Box::culledBy( + const Array& plane, + int& cullingPlane, + const uint32 _inMask, + uint32& childMask) const { + + uint32 inMask = _inMask; + assert(plane.size() < 31); + + childMask = 0; + + // See if there is one plane for which all of the + // vertices are in the negative half space. + for (int p = 0; p < plane.size(); ++p) { + + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + Vector3 corner; + + int numContained = 0; + int v = 0; + + // We can early-out only if we have found one point on each + // side of the plane (i.e. if we are straddling). That + // occurs when (numContained < v) && (numContained > 0) + for (v = 0; (v < 8) && ((numContained == v) || (numContained == 0)); ++v) { + if (plane[p].halfSpaceContains(_corner[v])) { + ++numContained; + } + } + + if (numContained == 0) { + // Plane p culled the box + cullingPlane = p; + + // The caller should not recurse into the children, + // since the parent is culled. If they do recurse, + // make them only test against this one plane, which + // will immediately cull the volume. + childMask = 1 << p; + return true; + + } else if (numContained < v) { + // The bounding volume straddled the plane; we have + // to keep testing against this plane + childMask |= (1 << p); + } + } + + // Move on to the next bit. + inMask = inMask >> 1; + } + + // None of the planes could cull this box + cullingPlane = -1; + return false; +} + + +bool Box::culledBy( + const Array& plane, + int& cullingPlane, + const uint32 _inMask) const { + + uint32 inMask = _inMask; + assert(plane.size() < 31); + + // See if there is one plane for which all of the + // vertices are in the negative half space. + for (int p = 0; p < plane.size(); ++p) { + + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + bool culled = true; + + int v; + + // Assume this plane culls all points. See if there is a point + // not culled by the plane... early out when at least one point + // is in the positive half space. + for (v = 0; (v < 8) && culled; ++v) { + culled = ! plane[p].halfSpaceContains(corner(v)); + } + + if (culled) { + // Plane p culled the box + cullingPlane = p; + + return true; + } + } + + // Move on to the next bit. + inMask = inMask >> 1; + } + + // None of the planes could cull this box + cullingPlane = -1; + return false; +} + + +bool Box::contains( + const Vector3& point) const { + + // Form axes from three edges, transform the point into that + // space, and perform 3 interval tests + + Vector3 u = _corner[4] - _corner[0]; + Vector3 v = _corner[3] - _corner[0]; + Vector3 w = _corner[1] - _corner[0]; + + Matrix3 M = Matrix3(u.x, v.x, w.x, + u.y, v.y, w.y, + u.z, v.z, w.z); + + // M^-1 * (point - _corner[0]) = point in unit cube's object space + // compute the inverse of M + Vector3 osPoint = M.inverse() * (point - _corner[0]); + + return + (osPoint.x >= 0) && + (osPoint.y >= 0) && + (osPoint.z >= 0) && + (osPoint.x <= 1) && + (osPoint.y <= 1) && + (osPoint.z <= 1); +} + +#undef setMany + + +void Box::getRandomSurfacePoint(Vector3& P, Vector3& N) const { + float aXY = _extent.x * _extent.y; + float aYZ = _extent.y * _extent.z; + float aZX = _extent.z * _extent.x; + + float r = (float)uniformRandom(0, aXY + aYZ + aZX); + + // Choose evenly between positive and negative face planes + float d = (uniformRandom(0, 1) < 0.5f) ? -1.0f : 1.0f; + + // The probability of choosing a given face is proportional to + // its area. + if (r < aXY) { + P = _axis[0] * (float)uniformRandom(-0.5, 0.5) * _extent.x + + _axis[1] * (float)uniformRandom(-0.5, 0.5) * _extent.y + + _center + _axis[2] * d * _extent.z * 0.5f; + N = _axis[2] * d; + } else if (r < aYZ) { + P = _axis[1] * (float)uniformRandom(-0.5, 0.5) * _extent.y + + _axis[2] * (float)uniformRandom(-0.5, 0.5) * _extent.z + + _center + _axis[0] * d * _extent.x * 0.5f; + N = _axis[0] * d; + } else { + P = _axis[2] * (float)uniformRandom(-0.5, 0.5) * _extent.z + + _axis[0] *(float) uniformRandom(-0.5, 0.5) * _extent.x + + _center + _axis[1] * d * _extent.y * 0.5f; + N = _axis[1] * d; + } +} + + +Vector3 Box::randomInteriorPoint() const { + Vector3 sum = _center; + + for (int a = 0; a < 3; ++a) { + sum += _axis[a] * (float)uniformRandom(-0.5, 0.5) * _extent[a]; + } + + return sum; +} + +Box Box::inf() { + return Box(-Vector3::inf(), Vector3::inf()); +} + +void Box::getBounds(class AABox& aabb) const { + + Vector3 lo = _corner[0]; + Vector3 hi = lo; + + for (int v = 1; v < 8; ++v) { + const Vector3& C = _corner[v]; + lo = lo.min(C); + hi = hi.max(C); + } + + aabb = AABox(lo, hi); +} + + +} // namespace diff --git a/externals/g3dlite/CMakeLists.txt b/externals/g3dlite/CMakeLists.txt new file mode 100644 index 0000000..da5c89e --- /dev/null +++ b/externals/g3dlite/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +file(GLOB sources *.cpp) + +set(g3dlib_STAT_SRCS + ${sources} +) +if(WIN32) + include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/externals/zlib + ) +else() + include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ) +endif() + +add_library(g3dlib STATIC ${g3dlib_STAT_SRCS}) + +if(WIN32) + target_link_libraries(g3dlib + zlib + ) +else() + target_link_libraries(g3dlib + ${ZLIB_LIBRARIES} + ) +endif() diff --git a/externals/g3dlite/Capsule.cpp b/externals/g3dlite/Capsule.cpp new file mode 100644 index 0000000..2ad3891 --- /dev/null +++ b/externals/g3dlite/Capsule.cpp @@ -0,0 +1,179 @@ +/** + @file Capsule.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-02-07 + @edited 2005-08-18 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#include "G3D/Capsule.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/LineSegment.h" +#include "G3D/Sphere.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/Line.h" +#include "G3D/AABox.h" + +namespace G3D { + +Capsule::Capsule(class BinaryInput& b) { + deserialize(b); +} + + +Capsule::Capsule() { +} + + +Capsule::Capsule(const Vector3& _p1, const Vector3& _p2, float _r) + : p1(_p1), p2(_p2), _radius(_r) { +} + + +void Capsule::serialize(class BinaryOutput& b) const { + p1.serialize(b); + p2.serialize(b); + b.writeFloat64(_radius); +} + + +void Capsule::deserialize(class BinaryInput& b) { + p1.deserialize(b); + p2.deserialize(b); + _radius = b.readFloat64(); +} + + +Line Capsule::axis() const { + return Line::fromTwoPoints(p1, p2); +} + + +float Capsule::volume() const { + return + // Sphere volume + pow(_radius, 3) * pi() * 4 / 3 + + + // Cylinder volume + pow(_radius, 2) * (p1 - p2).magnitude(); +} + + +float Capsule::area() const { + + return + // Sphere area + pow(_radius, 2) * 4 * pi() + + + // Cylinder area + twoPi() * _radius * (p1 - p2).magnitude(); +} + + +void Capsule::getBounds(AABox& out) const { + Vector3 min = p1.min(p2) - (Vector3(1, 1, 1) * _radius); + Vector3 max = p1.max(p2) + (Vector3(1, 1, 1) * _radius); + + out = AABox(min, max); +} + + +bool Capsule::contains(const Vector3& p) const { + return LineSegment::fromTwoPoints(p1, p2).distanceSquared(p) <= square(radius()); +} + + +void Capsule::getRandomSurfacePoint(Vector3& p, Vector3& N) const { + float h = height(); + float r = radius(); + + // Create a random point on a standard capsule and then rotate to the global frame. + + // Relative areas + float capRelArea = sqrt(r) / 2.0f; + float sideRelArea = r * h; + + float r1 = uniformRandom(0, capRelArea * 2 + sideRelArea); + + if (r1 < capRelArea * 2) { + + // Select a point uniformly at random on a sphere + N = Sphere(Vector3::zero(), 1).randomSurfacePoint(); + p = N * r; + p.y += sign(p.y) * h / 2.0f; + } else { + // Side + float a = uniformRandom(0, (float)twoPi()); + N.x = cos(a); + N.y = 0; + N.z = sin(a); + p.x = N.x * r; + p.z = N.y * r; + p.y = uniformRandom(-h / 2.0f, h / 2.0f); + } + + // Transform to world space + CoordinateFrame cframe; + getReferenceFrame(cframe); + + p = cframe.pointToWorldSpace(p); + N = cframe.normalToWorldSpace(N); +} + + +void Capsule::getReferenceFrame(CoordinateFrame& cframe) const { + cframe.translation = center(); + + Vector3 Y = (p1 - p2).direction(); + Vector3 X = (abs(Y.dot(Vector3::unitX())) > 0.9) ? Vector3::unitY() : Vector3::unitX(); + Vector3 Z = X.cross(Y).direction(); + X = Y.cross(Z); + cframe.rotation.setColumn(0, X); + cframe.rotation.setColumn(1, Y); + cframe.rotation.setColumn(2, Z); +} + + +Vector3 Capsule::randomInteriorPoint() const { + float h = height(); + float r = radius(); + + // Create a random point in a standard capsule and then rotate to the global frame. + + Vector3 p; + + float hemiVolume = pi() * (r*r*r) * 4 / 6.0; + float cylVolume = pi() * square(r) * h; + + float r1 = uniformRandom(0, 2.0 * hemiVolume + cylVolume); + + if (r1 < 2.0 * hemiVolume) { + + p = Sphere(Vector3::zero(), r).randomInteriorPoint(); + + p.y += sign(p.y) * h / 2.0f; + + } else { + + // Select a point uniformly at random on a disk + float a = uniformRandom(0, (float)twoPi()); + float r2 = sqrt(uniformRandom(0, 1)) * r; + + p = Vector3(cos(a) * r2, + uniformRandom(-h / 2.0f, h / 2.0f), + sin(a) * r2); + } + + // Transform to world space + CoordinateFrame cframe; + getReferenceFrame(cframe); + + return cframe.pointToWorldSpace(p); +} + +} // namespace diff --git a/externals/g3dlite/CollisionDetection.cpp b/externals/g3dlite/CollisionDetection.cpp new file mode 100644 index 0000000..77eef0a --- /dev/null +++ b/externals/g3dlite/CollisionDetection.cpp @@ -0,0 +1,2455 @@ +/** + @file CollisionDetection.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @cite Bounce direction based on Paul Nettle's ftp://ftp.3dmaileffects.com/pub/FluidStudios/CollisionDetection/Fluid_Studios_Generic_Collision_Detection_for_Games_Using_Ellipsoids.pdf and comments by Max McGuire. Ray-sphere code by Eric Haines. + + @created 2001-11-24 + @edited 2008-12-29 + */ + +#include "G3D/CoordinateFrame.h" +#include "G3D/platform.h" +#include "G3D/CollisionDetection.h" +#include "G3D/debugAssert.h" +#include "G3D/vectorMath.h" +#include "G3D/Capsule.h" +#include "G3D/Plane.h" +#include "G3D/Line.h" +#include "G3D/LineSegment.h" +#include "G3D/Sphere.h" +#include "G3D/Box.h" +#include "G3D/Triangle.h" +#include "G3D/Vector3.h" +#include "G3D/AABox.h" + +#ifdef _MSC_VER +// Turn on fast floating-point optimizations +#pragma float_control( push ) +#pragma fp_contract( on ) +#pragma fenv_access( off ) +#pragma float_control( except, off ) +#pragma float_control( precise, off ) +#endif + + +namespace G3D { + +bool CollisionDetection::ignoreBool; +Vector3 CollisionDetection::ignore; +Array CollisionDetection::ignoreArray; + + + +Vector3 CollisionDetection::separatingAxisForSolidBoxSolidBox( + const int separatingAxisIndex, + const Box & box1, + const Box & box2) { + debugAssert(separatingAxisIndex >= 0); + debugAssert(separatingAxisIndex < 15); + Vector3 axis; + if (separatingAxisIndex < 3) { + axis = box1.axis(separatingAxisIndex); + } else if (separatingAxisIndex < 6) { + axis = box2.axis(separatingAxisIndex - 3); + } else { + int box1Index = (separatingAxisIndex - 6) / 3; + int box2Index = (separatingAxisIndex - 6) % 3; + axis = cross(box1.axis(box1Index), box2.axis(box2Index)); + } + return axis; +} + +#ifdef _MSC_VER +# pragma warning (push) +# pragma warning (disable : 4244) +#endif + +float CollisionDetection::projectedDistanceForSolidBoxSolidBox( + const int separatingAxisIndex, + const Vector3 & a, + const Vector3 & b, + const Vector3 & D, + const double* c, + const double* ca, + const double* ad, + const double* bd) +{ + (void)D; + + float R0 = 0.0f; + float R1 = 0.0f; + float R = 0.0f; + switch (separatingAxisIndex) { + case 0: + // A0 + R0 = a[0]; + R1 = b[0] * ca[0] + b[1] * ca[1] + b[2] * ca[2]; + R = fabs(ad[0]); + break; + case 1: + // A1 + R0 = a[1]; + R1 = b[0] * ca[3] + b[1] * ca[4] + b[2] * ca[5]; + R = fabs(ad[1]); + break; + case 2: + // A2 + R0 = a[2]; + R1 = b[0] * ca[6] + b[1] * ca[7] + b[2] * ca[8]; + R = fabs(ad[2]); + break; + case 3: + // B0 + R0 = a[0] * ca[0] + a[1] * ca[3] + a[2] * ca[6]; + R1 = b[0]; + R = fabs(bd[0]); + break; + case 4: + // B1 + R0 = a[0] * ca[1] + a[1] * ca[4] + a[2] * ca[7]; + R1 = b[1]; + R = fabs(bd[1]); + break; + case 5: + // B2 + R0 = a[0] * ca[2] + a[1] * ca[5] + a[2] * ca[8]; + R1 = b[2]; + R = fabs(bd[2]); + break; + case 6: + // A0 x B0 + R0 = a[1] * ca[6] + a[2] * ca[3]; + R1 = b[1] * ca[2] + b[2] * ca[1]; + R = fabs(c[3] * ad[2] - c[6] * ad[1]); + break; + case 7: + // A0 x B1 + R0 = a[1] * ca[7] + a[2] * ca[4]; + R1 = b[0] * ca[2] + b[2] * ca[0]; + R = fabs(c[4] * ad[2] - c[7] * ad[1]); + break; + case 8: + // A0 x B2 + R0 = a[1] * ca[8] + a[2] * ca[5]; + R1 = b[0] * ca[1] + b[1] * ca[0]; + R = fabs(c[5] * ad[2] - c[8] * ad[1]); + break; + case 9: + // A1 x B0 + R0 = a[0] * ca[6] + a[2] * ca[0]; + R1 = b[1] * ca[5] + b[2] * ca[4]; + R = fabs(c[6] * ad[0] - c[0] * ad[2]); + break; + case 10: + // A1 x B1 + R0 = a[0] * ca[7] + a[2] * ca[1]; + R1 = b[0] * ca[5] + b[2] * ca[3]; + R = fabs(c[7] * ad[0] - c[1] * ad[2]); + break; + case 11: + // A1 x B2 + R0 = a[0] * ca[8] + a[2] * ca[2]; + R1 = b[0] * ca[4] + b[1] * ca[3]; + R = fabs(c[8] * ad[0] - c[2] * ad[2]); + break; + case 12: + // A2 x B0 + R0 = a[0] * ca[3] + a[1] * ca[0]; + R1 = b[1] * ca[8] + b[2] * ca[7]; + R = fabs(c[0] * ad[1] - c[3] * ad[0]); + break; + case 13: + // A2 x B1 + R0 = a[0] * ca[4] + a[1] * ca[1]; + R1 = b[0] * ca[8] + b[2] * ca[6]; + R = fabs(c[1] * ad[1] - c[4] * ad[0]); + break; + case 14: + // A2 x B2 + R0 = a[0] * ca[5] + a[1] * ca[2]; + R1 = b[0] * ca[7] + b[1] * ca[6]; + R = fabs(c[2] * ad[1] - c[5] * ad[0]); + break; + default: + debugAssertM(false, "fell through switch statement"); + } + + return (R - (R0 + R1)); +} + + +bool CollisionDetection::parallelAxisForSolidBoxSolidBox( + const double* ca, + const double epsilon, + int & axis1, + int & axis2) { + const double parallelDot = 1.0 - epsilon; + for (int i = 0; i < 9; i++) { + if (ca[i] >= parallelDot) { + axis1 = i / 3; + axis2 = i % 3; + return true; + } + } + return false; +} + + + + +void CollisionDetection::fillSolidBoxSolidBoxInfo( + const Box & box1, + const Box & box2, + Vector3 & a, + Vector3 & b, + Vector3 & D, + double* c, + double* ca, + double* ad, + double* bd) { + // length between center and each side of box1 and box2 + a = box1.extent() * 0.5; + b = box2.extent() * 0.5; + + // difference between centers of box1 and box2 + D = box2.center() - box1.center(); + + // store the value of all possible dot products between the + // axes of box1 and box2, c_{row, col} in the Eberly paper + // corresponds to c[row * 3 + col] for this 9 element array. + // + // c[] holds signed values, ca[] hold absolute values + for (int i = 0; i < 9; i++) { + c[i] = dot(box1.axis(i / 3), box2.axis(i % 3)); + ca[i] = fabs(c[i]); + } + + // store all possible dot products between the axes of box1 and D, + // as well as the axes of box2 and D + for (int i = 0; i < 3; i++) { + ad[i] = dot(box1.axis(i), D); + bd[i] = dot(box2.axis(i), D); + } +} + + + +bool CollisionDetection::conservativeBoxBoxTest( + const Vector3 & a, const Vector3 & b, const Vector3 & D) { + // do a quick bounding sphere test because it is relatively + // cheap, (three dot products, two sqrts, and a few others) + double boxRadius1 = a.magnitude(); + double boxRadius2 = b.magnitude(); + return (D.squaredMagnitude() < square(boxRadius1 + boxRadius2)); +} + + + + +bool CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox( + const Box& box1, + const Box& box2, + const int lastSeparatingAxis) { + // for explanations of the variable please refer to the + // paper and fillSolidBoxSolidBoxInfo() + Vector3 a; + Vector3 b; + Vector3 D; + double c[9]; + double ca[9]; + double ad[3]; + double bd[3]; + + fillSolidBoxSolidBoxInfo(box1, box2, a, b, D, c, ca, ad, bd); + + int dummy1, dummy2; + bool parallelAxes = parallelAxisForSolidBoxSolidBox(ca, 0.00001, + dummy1, dummy2); + + // check the separating axis from the last time step + if (lastSeparatingAxis != -1 && + (lastSeparatingAxis < 6 || !parallelAxes)) { + double projectedDistance = projectedDistanceForSolidBoxSolidBox( + lastSeparatingAxis, a, b, D, c, ca, ad, bd); + + // the separating axis from the last time step is still + // valid, the boxes do not intersect + if (projectedDistance > 0.0) { + return false; + } + } + + // test if the boxes can be separated by a plane normal to + // any of the three axes of box1, any of the three axes of box2, + // or any of the 9 possible cross products of axes from box1 + // and box2 + for (int i = 0; i < 15; i++) { + // do not need to check edge-edge cases if any two of + // the axes are parallel + if (parallelAxes && i == 6) { + return true; + } + + double projectedDistance = + projectedDistanceForSolidBoxSolidBox(i, a, b, D, c, ca, ad, bd); + + // found a separating axis, the boxes do not intersect + if (projectedDistance > 0.0) { + return false; + } + } + + return true; +} + + + +void CollisionDetection::closestPointsBetweenLineAndLine( + const Line & line1, + const Line & line2, + Vector3 & closest1, + Vector3 & closest2) { + // TODO make accessors for Line that don't make a copy of data + Vector3 P0 = line1.point(); + Vector3 u = line1.direction(); + Vector3 Q0 = line2.point(); + Vector3 v = line2.direction(); + Vector3 w0 = P0 - Q0; + + // a = 1.0, c = 1.0 + double b = dot(u, v); + double d = dot(u, w0); + double e = dot(v, w0); + double D = 1.0 - b * b; + double sc, tc; + + static const double epsilon = 0.00001; + + if (D < epsilon) { + // lines are parallel, choose P0 as one point, find the point + // on line2 that is closest to P0 + sc = 0.0; + tc = (b > 1.0) ? (d / b) : (e / 1.0); + } else { + // lines are not parallel + sc = (b * e - 1.0 * d) / D; + tc = (1.0 * e - b * d) / D; + } + + closest1 = P0 + (sc * u); + closest2 = Q0 + (tc * v); +} + + + +float CollisionDetection::penetrationDepthForFixedBoxFixedBox( + const Box& box1, + const Box& box2, + Array& contactPoints, + Array& contactNormals, + const int lastSeparatingAxis) { + + contactPoints.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + contactNormals.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + + Vector3 a; + Vector3 b; + Vector3 D; + double c[9]; + double ca[9]; + double ad[3]; + double bd[3]; + + debugAssert(lastSeparatingAxis >= -1); + debugAssert(lastSeparatingAxis < 15); + + fillSolidBoxSolidBoxInfo(box1, box2, a, b, D, c, ca, ad, bd); + + int axis1, axis2; + bool parallelAxes = parallelAxisForSolidBoxSolidBox(ca, 0.00001, + axis1, axis2); + + + // check the separating axis from the last time step + if (lastSeparatingAxis != -1 && + (lastSeparatingAxis < 6 || !parallelAxes)) { + float projectedDistance = projectedDistanceForSolidBoxSolidBox( + lastSeparatingAxis, a, b, D, c, ca, ad, bd); + + // the separating axis from the last time step is still + // valid, the boxes do not intersect + if (projectedDistance > 0.0) { + return -projectedDistance; + } + } + + // test if the boxes can be separated by a plane normal to + // any of the three axes of box1, any of the three axes of box2, + // (test 9 possible cross products later) + float penetration = -finf(); + int penetrationAxisIndex = -1; + + for (int i = 0; i < 6; i++) { + float projectedDistance = + projectedDistanceForSolidBoxSolidBox(i, a, b, D, c, ca, ad, bd); + + // found a separating axis, the boxes do not intersect + if (projectedDistance > 0.0) { + return -projectedDistance; + } + + // keep track of the axis that is least violated + if (projectedDistance > penetration) { + penetration = projectedDistance; + penetrationAxisIndex = i; + } + } + + + // for each edge-edge case we have to adjust the magnitude of + // penetration since we did not include the dot(L, L) denominator + // that can be smaller than 1.0 for the edge-edge cases. + if (!parallelAxes) { + double edgeDistances[9]; + + // run through edge-edge cases to see if we can find a separating axis + for (int i = 6; i < 15; i++) { + float projectedDistance = + projectedDistanceForSolidBoxSolidBox(i, a, b, D, c, ca, ad, bd); + + // found a separating axis, the boxes do not intersect, + // correct magnitude and return projected distance + if (projectedDistance > 0.0) { + Vector3 L = separatingAxisForSolidBoxSolidBox(i, box1, box2); + projectedDistance /= dot(L, L); + return -projectedDistance; + } + + edgeDistances[i - 6] = projectedDistance; + } + + // no separating axis found, the boxes do intersect, + // correct the magnitudes of the projectedDistance values + for (int i = 6; i < 15; i++) { + // find the negative penetration value with the smallest magnitude, + // the adjustment done for the edge-edge cases only increases + // magnitude by dividing by a number smaller than 1 and greater than 0 + float projectedDistance = (float)edgeDistances[i - 6]; + if (projectedDistance > penetration) { + Vector3 L = separatingAxisForSolidBoxSolidBox(i, box1, box2); + projectedDistance /= dot(L, L); + if (projectedDistance > penetration) { + penetration = projectedDistance; + penetrationAxisIndex = i; + } + } + } + } + + // get final separating axis vector + Vector3 L = separatingAxisForSolidBoxSolidBox(penetrationAxisIndex, + box1, box2); + + // set L to be the normal that faces away from box1 + if (dot(L, D) < 0) { + L = -L; + } + + Vector3 contactPoint; + + if (penetrationAxisIndex < 6) { + // vertex to face collision, find deepest colliding vertex + const Box* vertexBox; + const Box* faceBox; + Vector3 faceNormal = L; + + // L will be the outward facing normal for the faceBox + if (penetrationAxisIndex < 3) { + faceBox = & box1; + vertexBox = & box2; + if (dot(L, D) < 0) { + faceNormal = -L; + } + } else { + faceBox = & box2; + vertexBox = & box1; + if (dot(L, D) > 0) { + faceNormal = -L; + } + } + + // find the vertex that is farthest away in the direction + // face normal direction + int deepestPointIndex = 0; + float deepestPointDot = dot(faceNormal, vertexBox->corner(0)); + for (int i = 1; i < 8; i++) { + float dotProduct = dot(faceNormal, vertexBox->corner(i)); + if (dotProduct < deepestPointDot) { + deepestPointDot = dotProduct; + deepestPointIndex = i; + } + } + + // return the point half way between the deepest point and the + // contacting face + contactPoint = vertexBox->corner(deepestPointIndex) + + (-penetration * 0.5 * faceNormal); + } else { + // edge-edge case, find the two ege lines + int edge1 = (penetrationAxisIndex - 6) / 3; + int edge2 = (penetrationAxisIndex - 6) % 3; + Vector3 linePoint1 = box1.center(); + Vector3 linePoint2 = box2.center(); + Vector3 lineDir1; + Vector3 lineDir2; + + // find edge line by finding the edge axis, and the + // other two axes that are closest to the other box + for (int i = 0; i < 3; i++ ) { + if (i == edge1) { + lineDir1 = box1.axis(i); + } else { + Vector3 axis = box1.axis(i); + if (dot(axis, L) < 0) { + axis = -axis; + } + linePoint1 += axis * a[i]; + } + + if (i == edge2) { + lineDir2 = box2.axis(i); + } else { + Vector3 axis = box2.axis(i); + if (dot(axis, L) > 0) { + axis = -axis; + } + linePoint2 += axis * b[i]; + } + } + + // make lines from the two closest edges, and find + // the points that on each line that are closest to the other + Line line1 = Line::fromPointAndDirection(linePoint1, lineDir1); + Line line2 = Line::fromPointAndDirection(linePoint2, lineDir2); + Vector3 closest1; + Vector3 closest2; + + closestPointsBetweenLineAndLine(line1, line2, closest1, closest2); + + // take the average of the two closest edge points for the final + // contact point + contactPoint = (closest1 + closest2) * 0.5; + } + + contactPoints.push(contactPoint); + contactNormals.push(L); + + return -penetration; + +} + + + + +float CollisionDetection::penetrationDepthForFixedSphereFixedBox( + const Sphere& sphere, + const Box& box, + Array& contactPoints, + Array& contactNormals) { + + contactPoints.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + contactNormals.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + + // In its local coordinate frame, the box measures + // 2 * halfExtent[a] along dimesion a. + Vector3 halfExtent(box.extent(0), box.extent(1), box.extent(2)); + halfExtent *= 0.5f; + + CoordinateFrame boxFrame; + box.getLocalFrame(boxFrame); + + // Transform the sphere to the box's coordinate frame. + Vector3 center = boxFrame.pointToObjectSpace(sphere.center); + + // Find the square of the distance from the sphere to the box + + + // Distance along each axis from the closest side of the box + // to the sphere center. Negative values are *inside* the box. + Vector3 distOutsideBox; + + // Divide space up into the 27 regions corresponding + // to {+|-|0}X, {+|-|0}Y, {+|-|0}Z and classify the + // sphere center into one of them. + Vector3 centerRegion; + + // In the edge collision case, the edge is between vertices + // (constant + variable) and (constant - variable). + Vector3 constant, variable; + + int numNonZero = 0; + + // Iterate over axes + for (int a = 0; a < 3; ++a) { + // For each (box side), see which direction the sphere + // is outside the box (positive or negative). Add the + // square of that distance to the total distance from + // the box. + + float distanceFromLow = -halfExtent[a] - center[a]; + float distanceFromHigh = center[a] - halfExtent[a]; + + if (fabsf(distanceFromLow) < fabsf(distanceFromHigh)) { + distOutsideBox[a] = distanceFromLow; + } else { + distOutsideBox[a] = distanceFromHigh; + } + + if (distanceFromLow < 0.0) { + if (distanceFromHigh < 0.0) { + // Inside the box + centerRegion[a] = 0.0; + variable[a] = 1.0; + } else { + // Off the high side + centerRegion[a] = 1.0; + constant[a] = halfExtent[a]; + ++numNonZero; + } + } else if (distanceFromHigh < 0.0) { + // Off the low side + centerRegion[a] = -1.0; + constant[a] = -halfExtent[a]; + ++numNonZero; + } else { + debugAssertM(false, + "distanceFromLow and distanceFromHigh cannot both be positive"); + } + } + + // Squared distance between the outside of the box and the + // sphere center. + float d2 = Vector3::zero().max(distOutsideBox).squaredMagnitude(); + + if (d2 > square(sphere.radius)) { + // There is no penetration because the distance is greater + // than the radius of the sphere. This is the common case + // and we quickly exit. + return -1; + } + + // We know there is some penetration but need to classify it. + // + // Examine the region that contains the center of the sphere. If + // there is exactly one non-zero axis, the collision is with a + // plane. If there are exactly two non-zero axes, the collision + // is with an edge. If all three axes are non-zero, the collision is + // with a vertex. If there are no non-zero axes, the center is inside + // the box. + + double depth = -1; + switch (numNonZero) { + case 3: // Vertex collision + // The collision point is the vertex at constant, the normal + // is the vector from there to the sphere center. + contactNormals.append(boxFrame.normalToWorldSpace(constant - center)); + contactPoints.append(boxFrame.pointToWorldSpace(constant)); + depth = sphere.radius - sqrt(d2); + break; + + case 2: // Edge collision + { + // TODO: unwrapping the edge constructor and closest point + // code will probably make it faster. + + // Determine the edge + Line line = Line::fromPointAndDirection(constant, variable); + + // Penetration depth: + depth = sphere.radius - sqrt(d2); + + // The contact point is the closes point to the sphere on the line + Vector3 X = line.closestPoint(center); + contactNormals.append(boxFrame.normalToWorldSpace(X - center).direction()); + contactPoints.append(boxFrame.pointToWorldSpace(X)); + } + break; + + case 1: // Plane collision + { + // The plane normal is the centerRegion vector, + // so the sphere normal is the negative. Take + // it to world space from box-space. + + // Center region doesn't need to be normalized because + // it is known to contain only one non-zero value + // and that value is +/- 1. + Vector3 N = boxFrame.normalToWorldSpace(-centerRegion); + contactNormals.append(N); + + // Penetration depth: + depth = sphere.radius - sqrtf(d2); + + // Compute the contact point from the penetration depth + contactPoints.append(sphere.center + N * (sphere.radius - depth)); + } + break; + + case 0: // Volume collision + + // The sphere center is inside the box. This is an easy case + // to handle. Note that all axes of distOutsideBox must + // be negative. + + // Arbitratily choose the sphere center as a contact point + contactPoints.append(sphere.center); + + // Find the least-negative penetration axis. + // + // We could have computed this during the loop over the axes, + // but since volume collisions are rare (they only occur with + // large time steps), this case will seldom be executed and + // should not be optimized at the expense of the others. + if (distOutsideBox.x > distOutsideBox.y) { + if (distOutsideBox.x > distOutsideBox.z) { + // Smallest penetration on x-axis + // Chose normal based on which side we're closest to. + // Keep in mind that this is a normal to the sphere, + // so it is the inverse of the box normal. + if (center.x > 0) { + contactNormals.append(boxFrame.normalToWorldSpace(-Vector3::unitX())); + } else { + contactNormals.append(boxFrame.normalToWorldSpace(Vector3::unitX())); + } + depth = -distOutsideBox.x; + } else { + // Smallest penetration on z-axis + goto ZAXIS; + } + } else if (distOutsideBox.y > distOutsideBox.z) { + // Smallest penetration on y-axis + // Chose normal based on which side we're closest to. + // Keep in mind that this is a normal to the sphere, + // so it is the inverse of the box normal. + if (center.y > 0) { + contactNormals.append(boxFrame.normalToWorldSpace(-Vector3::unitY())); + } else { + contactNormals.append(boxFrame.normalToWorldSpace(Vector3::unitY())); + } + depth = -distOutsideBox.y; + } else { + // Smallest on z-axis +ZAXIS: + // Chose normal based on which side we're closest to. + // Keep in mind that this is a normal to the sphere, + // so it is the inverse of the box normal. + if (center.z > 0) { + contactNormals.append(boxFrame.normalToWorldSpace(-Vector3::unitZ())); + } else { + contactNormals.append(boxFrame.normalToWorldSpace(Vector3::unitZ())); + } + depth = -distOutsideBox.z; + } + break; + + default: + debugAssertM(false, "Fell through switch"); + break; + } + + return depth; +} + + +float CollisionDetection::penetrationDepthForFixedSphereFixedSphere( + const Sphere& sphereA, + const Sphere& sphereB, + Array& contactPoints, + Array& contactNormals) { + + Vector3 axis = sphereB.center - sphereA.center; + double radius = sphereA.radius + sphereB.radius; + double mag = axis.magnitude(); + axis /= mag; + double depth = -(mag - radius); + + contactPoints.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + contactNormals.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + + if (depth >= 0) { + contactPoints.append(sphereA.center + axis * (sphereA.radius - depth / 2)); + contactNormals.append(axis); + } + + return depth; +} + + +float CollisionDetection::penetrationDepthForFixedSphereFixedPlane( + const Sphere& sphereA, + const Plane& planeB, + Array& contactPoints, + Array& contactNormals) { + + Vector3 N; + double d; + + planeB.getEquation(N, d); + + double depth = -(sphereA.center.dot(N) + d - sphereA.radius); + + contactPoints.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + contactNormals.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + + if (depth >= 0) { + contactPoints.append(N * (depth - sphereA.radius) + sphereA.center); + contactNormals.append(N); + } + + return depth; +} + + +float CollisionDetection::penetrationDepthForFixedBoxFixedPlane( + const Box& box, + const Plane& plane, + Array& contactPoints, + Array& contactNormals) { + + Vector3 N; + double d; + + plane.getEquation(N, d); + + contactPoints.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + contactNormals.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + + float lowest = finf(); + for (int i = 0; i < 8; ++i) { + const Vector3 vertex = box.corner(i); + + float x = vertex.dot(N) + (float)d; + + if (x <= 0) { + // All vertices below the plane should be contact points. + contactPoints.append(vertex); + contactNormals.append(-N); + } + + lowest = min(lowest, x); + } + + // Depth should be a positive number + return -lowest; +} + + +float CollisionDetection::collisionTimeForMovingPointFixedPlane( + const Vector3& point, + const Vector3& velocity, + const Plane& plane, + Vector3& location, + Vector3& outNormal) { + + // Solve for the time at which normal.dot(point + velocity) + d == 0. + double d; + Vector3 normal; + plane.getEquation(normal, d); + + float vdotN = velocity.dot(normal); + float pdotN = point.dot(normal); + + if (fuzzyEq(pdotN + d, 0)) { + // The point is *in* the plane. + location = point; + outNormal = normal; + return 0; + } + + if (vdotN >= 0) { + // no collision will occur + location = Vector3::inf(); + return finf(); + } + + float t = -(pdotN + d) / vdotN; + if (t < 0) { + location = Vector3::inf(); + return finf(); + } else { + location = point + velocity * t; + outNormal = normal; + return t; + } +} + +bool __fastcall CollisionDetection::rayAABox( + const Ray& ray, + const Vector3& invDir, + const AABox& box, + const Vector3& boxCenter, + float boundingRadiusSquared, + Vector3& location, + bool& inside) { + + debugAssertM(fabs(ray.direction().squaredLength() - 1.0f) < 0.01f, format("Length = %f", ray.direction().length())); + { + // Pre-emptive partial bounding sphere test + const Vector3 L(boxCenter - ray.origin()); + float d = L.dot(ray.direction()); + + float L2 = L.dot(L); + float D2 = square(d); + float M2 = L2 - D2; + + if (((d < 0) && (L2 > boundingRadiusSquared)) || (M2 > boundingRadiusSquared)) { + inside = false; + return false; + } + // Passing here does not mean that the ray hits the bounding sphere; + // we would still have to perform more expensive tests to determine + // that. + } + + inside = true; + const Vector3& MinB = box.low(); + const Vector3& MaxB = box.high(); + Vector3 MaxT(-1.0f, -1.0f, -1.0f); + + // Find candidate planes. + for (int i = 0; i < 3; ++i) { + if (ray.origin()[i] < MinB[i]) { + location[i] = MinB[i]; + inside = false; + + // Calculate T distances to candidate planes + if (ray.direction()[i] != 0) { + MaxT[i] = (MinB[i] - ray.origin()[i]) * invDir[i]; + } + } else if (ray.origin()[i] > MaxB[i]) { + location[i] = MaxB[i]; + inside = false; + + // Calculate T distances to candidate planes + if (ray.direction()[i] != 0) { + MaxT[i] = (MaxB[i] - ray.origin()[i]) * invDir[i]; + } + } + } + + if (inside) { + // Ray origin inside bounding box + location = ray.origin(); + return true; + } + + // Get largest of the maxT's for final choice of intersection + int WhichPlane = 0; + if (MaxT[1] > MaxT[WhichPlane]) { + WhichPlane = 1; + } + + if (MaxT[2] > MaxT[WhichPlane]) { + WhichPlane = 2; + } + + // Check final candidate actually inside box + if (MaxT[WhichPlane] < 0.0f) { + // Miss the box + return false; + } + + for (int i = 0; i < 3; ++i) { + if (i != WhichPlane) { + location[i] = ray.origin()[i] + MaxT[WhichPlane] * ray.direction()[i]; + if ((location[i] < MinB[i]) || + (location[i] > MaxB[i])) { + // On this plane we're outside the box extents, so + // we miss the box + return false; + } + } + } + + return true; +} + +float CollisionDetection::collisionTimeForMovingPointFixedSphere( + const Vector3& point, + const Vector3& velocity, + const Sphere& sphere, + Vector3& location, + Vector3& outNormal, + bool solid) { + + if (solid && sphere.contains(point)) { + location = point; + outNormal = (point - sphere.center).direction(); + return 0.0f; + } + + float speed = velocity.magnitude(); + const Vector3& direction = velocity / speed; + + // length of the axis between the start and the sphere + const Vector3& L = sphere.center - point; + float d = L.dot(direction); + + float L2 = L.dot(L); + float R2 = square(sphere.radius); + float D2 = square(d); + + if ((d < 0.0f) && (L2 > R2)) { + location = Vector3::inf(); + return finf(); + } + + const float M2 = L2 - D2; + + if (M2 > R2) { + location = Vector3::inf(); + return finf(); + } + + float q = sqrt(R2 - M2); + float time; + + if (L2 > R2) { + time = d - q; + } else { + time = d + q; + } + + time /= speed; + + location = point + velocity * time; + outNormal = (location - sphere.center).direction(); + + return time; +} + + +float CollisionDetection::collisionTimeForMovingSphereFixedSphere( + const Sphere& movingSphere, + const Vector3& velocity, + const Sphere& fixedSphere, + Vector3& location, + Vector3& outNormal) { + + const Vector3& sep = (fixedSphere.center - movingSphere.center); + float sepLen = sep.squaredLength(); + if (sepLen < square(movingSphere.radius + fixedSphere.radius)) { + // Interpenetrating + outNormal = sep.directionOrZero(); + location = fixedSphere.center - outNormal * fixedSphere.radius; + return 0; + } + + float time = collisionTimeForMovingPointFixedSphere + (movingSphere.center, velocity, + Sphere(fixedSphere.center, fixedSphere.radius + movingSphere.radius), + location, outNormal); + + if (time < finf()) { + // Location is now the center of the moving sphere at the collision time. + // Adjust for the size of the moving sphere. Two spheres always collide + // along a line between their centers. + location += (location - fixedSphere.center) * movingSphere.radius / fixedSphere.radius; + } + + return time; +} + + +/* +float CollisionDetection::collisionTimeForMovingPointFixedTriangle( + const Vector3& point, + const Vector3& velocity, + const Triangle& triangle, + Vector3& outLocation, + Vector3& outNormal) { + + double time = collisionTimeForMovingPointFixedPlane(point, velocity, triangle.plane(), outLocation, outNormal); + + if (time == finf()) { + // No collision with the plane of the triangle. + return finf(); + } + + if (isPointInsideTriangle(triangle.vertex(0), triangle.vertex(1), triangle.vertex(2), triangle.normal(), outLocation, triangle.primaryAxis())) { + // Collision occured inside the triangle + return time; + } else { + // Missed the triangle + outLocation = Vector3::inf(); + return finf(); + } +}*/ + +/* +float CollisionDetection::collisionTimeForMovingPointFixedTriangle( + const Vector3& orig, + const Vector3& dir, + const Vector3& vert0, + const Vector3& vert1, + const Vector3& vert2) { + + // Barycenteric coords + double u, v; + #define EPSILON 0.000001 + #define CROSS(dest,v1,v2) \ + dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \ + dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \ + dest[2]=v1[0]*v2[1]-v1[1]*v2[0]; + + #define DOT(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2]) + + #define SUB(dest,v1,v2) \ + dest[0]=v1[0]-v2[0]; \ + dest[1]=v1[1]-v2[1]; \ + dest[2]=v1[2]-v2[2]; + + double edge1[3], edge2[3], tvec[3], pvec[3], qvec[3]; + + // find vectors for two edges sharing vert0 + SUB(edge1, vert1, vert0); + SUB(edge2, vert2, vert0); + + // begin calculating determinant - also used to calculate U parameter + CROSS(pvec, dir, edge2); + + // if determinant is near zero, ray lies in plane of triangle + const double det = DOT(edge1, pvec); + + if (det < EPSILON) { + return finf(); + } + + // calculate distance from vert0 to ray origin + SUB(tvec, orig, vert0); + + // calculate U parameter and test bounds + u = DOT(tvec, pvec); + if ((u < 0.0) || (u > det)) { + // Hit the plane outside the triangle + return finf(); + } + + // prepare to test V parameter + CROSS(qvec, tvec, edge1); + + // calculate V parameter and test bounds + v = DOT(dir, qvec); + if ((v < 0.0) || (u + v > det)) { + // Hit the plane outside the triangle + return finf(); + } + + // calculate t, scale parameters, ray intersects triangle + // If we want u,v, we can compute this + // double t = DOT(edge2, qvec); + //const double inv_det = 1.0 / det; + //t *= inv_det; + //u *= inv_det; + //v *= inv_det; + // return t; + + // Case where we don't need correct (u, v): + + const double t = DOT(edge2, qvec); + + if (t >= 0) { + // Note that det must be positive + return t / det; + } else { + // We had to travel backwards in time to intersect + return finf(); + } + + #undef EPSILON + #undef CROSS + #undef DOT + #undef SUB +} +*/ + +float CollisionDetection::collisionTimeForMovingPointFixedBox( + const Vector3& point, + const Vector3& velocity, + const Box& box, + Vector3& location, + Vector3& outNormal) { + + double bestTime; + + Vector3 normal; + Vector3 v[4]; + + // Prime the loop + int f = 0; + box.getFaceCorners(f, v[0], v[1], v[2], v[3]); + bestTime = collisionTimeForMovingPointFixedRectangle(point, velocity, v[0], v[1], v[2], v[3], location, normal); + outNormal = normal; + + // Check other faces + for (f = 1; f < 6; ++f) { + Vector3 pos; + box.getFaceCorners(f, v[0], v[1], v[2], v[3]); + float time = collisionTimeForMovingPointFixedRectangle(point, velocity, v[0], v[1], v[2], v[3], pos, normal); + if (time < bestTime) { + bestTime = time; + outNormal = normal; + location = pos; + } + } + + return bestTime; +} + + +float CollisionDetection::collisionTimeForMovingPointFixedAABox( + const Vector3& origin, + const Vector3& dir, + const AABox& box, + Vector3& location, + bool& Inside, + Vector3& normal) { + + if (collisionLocationForMovingPointFixedAABox(origin, dir, box, location, Inside, normal)) { + return (location - origin).magnitude(); + } else { + return (float)finf(); + } +} + + +bool CollisionDetection::collisionLocationForMovingPointFixedAABox( + const Vector3& origin, + const Vector3& dir, + const AABox& box, + Vector3& location, + bool& Inside, + Vector3& normal) { + + // Integer representation of a floating-point value. + #define IR(x) ((uint32&)x) + + Inside = true; + const Vector3& MinB = box.low(); + const Vector3& MaxB = box.high(); + Vector3 MaxT(-1.0f, -1.0f, -1.0f); + + // Find candidate planes. + for (int i = 0; i < 3; ++i) { + if (origin[i] < MinB[i]) { + location[i] = MinB[i]; + Inside = false; + + // Calculate T distances to candidate planes + if (IR(dir[i])) { + MaxT[i] = (MinB[i] - origin[i]) / dir[i]; + } + } else if (origin[i] > MaxB[i]) { + location[i] = MaxB[i]; + Inside = false; + + // Calculate T distances to candidate planes + if (IR(dir[i])) { + MaxT[i] = (MaxB[i] - origin[i]) / dir[i]; + } + } + } + + if (Inside) { + // Ray origin inside bounding box + location = origin; + return false; + } + + // Get largest of the maxT's for final choice of intersection + int WhichPlane = 0; + if (MaxT[1] > MaxT[WhichPlane]) { + WhichPlane = 1; + } + + if (MaxT[2] > MaxT[WhichPlane]) { + WhichPlane = 2; + } + + // Check final candidate actually inside box + if (IR(MaxT[WhichPlane]) & 0x80000000) { + // Miss the box + return false; + } + + for (int i = 0; i < 3; ++i) { + if (i != WhichPlane) { + location[i] = origin[i] + MaxT[WhichPlane] * dir[i]; + if ((location[i] < MinB[i]) || + (location[i] > MaxB[i])) { + // On this plane we're outside the box extents, so + // we miss the box + return false; + } + } + } + + // Choose the normal to be the plane normal facing into the ray + normal = Vector3::zero(); + normal[WhichPlane] = (dir[WhichPlane] > 0) ? -1.0 : 1.0; + + return true; + + #undef IR +} + + + +float CollisionDetection::collisionTimeForMovingPointFixedRectangle( + const Vector3& point, + const Vector3& velocity, + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + Vector3& location, + Vector3& outNormal) { + + Plane plane = Plane(v0, v1, v2); + + float time = collisionTimeForMovingPointFixedPlane(point, velocity, plane, location, outNormal); + + if (time == finf()) { + // No collision is ever going to happen + return time; + } + + if (isPointInsideRectangle(v0, v1, v2, v3, plane.normal(), location)) { + // The intersection point is inside the rectangle; that is the location where + // the point hits the rectangle. + return time; + } else { + return finf(); + } +} + +/** Used by findRayCapsuleIntersection. + @cite From magic software http://www.magic-software.com/Source/Intersection3D/MgcIntr3DLinCap.cpp */ +static int findRayCapsuleIntersectionAux( + const Vector3& rkOrigin, + const Vector3& rkDirection, + const Capsule& rkCapsule, + double afT[2]) { + + Vector3 capsuleDirection = rkCapsule.point(1) - rkCapsule.point(0); + + // set up quadratic Q(t) = a*t^2 + 2*b*t + c + Vector3 kU, kV, kW = capsuleDirection; + float fWLength = kW.unitize(); + Vector3::generateOrthonormalBasis(kU, kV, kW); + Vector3 kD(kU.dot(rkDirection), kV.dot(rkDirection), kW.dot(rkDirection)); + float fDLength = kD.unitize(); + + float fEpsilon = 1e-6f; + + float fInvDLength = 1.0f/fDLength; + Vector3 kDiff = rkOrigin - rkCapsule.point(0); + Vector3 kP(kU.dot(kDiff),kV.dot(kDiff),kW.dot(kDiff)); + float fRadiusSqr = square(rkCapsule.radius()); + + float fInv, fA, fB, fC, fDiscr, fRoot, fT, fTmp; + + // Is the velocity parallel to the capsule direction? (or zero) + if ((abs(kD.z) >= 1.0f - fEpsilon) || (fDLength < fEpsilon)) { + + float fAxisDir = rkDirection.dot(capsuleDirection); + + fDiscr = fRadiusSqr - kP.x*kP.x - kP.y*kP.y; + if ((fAxisDir < 0) && (fDiscr >= 0.0f)) { + // Velocity anti-parallel to the capsule direction + fRoot = sqrt(fDiscr); + afT[0] = (kP.z + fRoot)*fInvDLength; + afT[1] = -(fWLength - kP.z + fRoot)*fInvDLength; + return 2; + } else if ((fAxisDir > 0) && (fDiscr >= 0.0f)) { + // Velocity parallel to the capsule direction + fRoot = sqrt(fDiscr); + afT[0] = -(kP.z + fRoot)*fInvDLength; + afT[1] = (fWLength - kP.z + fRoot)*fInvDLength; + return 2; + } else { + // sphere heading wrong direction, or no velocity at all + return 0; + } + } + + // test intersection with infinite cylinder + fA = kD.x*kD.x + kD.y*kD.y; + fB = kP.x*kD.x + kP.y*kD.y; + fC = kP.x*kP.x + kP.y*kP.y - fRadiusSqr; + fDiscr = fB*fB - fA*fC; + if (fDiscr < 0.0f) { + // line does not intersect infinite cylinder + return 0; + } + + int iQuantity = 0; + + if (fDiscr > 0.0f) { + // line intersects infinite cylinder in two places + fRoot = sqrt(fDiscr); + fInv = 1.0f/fA; + fT = (-fB - fRoot)*fInv; + fTmp = kP.z + fT*kD.z; + if ((0.0f <= fTmp) && (fTmp <= fWLength)) { + afT[iQuantity] = fT * fInvDLength; + iQuantity++; + } + + fT = (-fB + fRoot)*fInv; + fTmp = kP.z + fT*kD.z; + + if ((0.0f <= fTmp) && (fTmp <= fWLength)) { + afT[iQuantity++] = fT*fInvDLength; + } + + if (iQuantity == 2) { + // line intersects capsule wall in two places + return 2; + } + } else { + // line is tangent to infinite cylinder + fT = -fB/fA; + fTmp = kP.z + fT*kD.z; + if ((0.0f <= fTmp) && (fTmp <= fWLength)) { + afT[0] = fT*fInvDLength; + return 1; + } + } + + // test intersection with bottom hemisphere + // fA = 1 + fB += kP.z*kD.z; + fC += kP.z*kP.z; + fDiscr = fB*fB - fC; + if (fDiscr > 0.0f) { + fRoot = sqrt(fDiscr); + fT = -fB - fRoot; + fTmp = kP.z + fT*kD.z; + if (fTmp <= 0.0f) { + afT[iQuantity++] = fT*fInvDLength; + if (iQuantity == 2) { + return 2; + } + } + + fT = -fB + fRoot; + fTmp = kP.z + fT*kD.z; + if (fTmp <= 0.0f) { + afT[iQuantity++] = fT*fInvDLength; + if (iQuantity == 2) { + return 2; + } + } + } else if (fDiscr == 0.0f) { + fT = -fB; + fTmp = kP.z + fT*kD.z; + if (fTmp <= 0.0f) { + afT[iQuantity++] = fT*fInvDLength; + if (iQuantity == 2) { + return 2; + } + } + } + + // test intersection with top hemisphere + // fA = 1 + fB -= kD.z*fWLength; + fC += fWLength*(fWLength - 2.0f*kP.z); + + fDiscr = fB*fB - fC; + if (fDiscr > 0.0f) { + fRoot = sqrt(fDiscr); + fT = -fB - fRoot; + fTmp = kP.z + fT*kD.z; + if (fTmp >= fWLength) { + afT[iQuantity++] = fT*fInvDLength; + if (iQuantity == 2) { + return 2; + } + } + + fT = -fB + fRoot; + fTmp = kP.z + fT*kD.z; + if (fTmp >= fWLength) { + afT[iQuantity++] = fT*fInvDLength; + if (iQuantity == 2) { + return 2; + } + } + } else if (fDiscr == 0.0f) { + fT = -fB; + fTmp = kP.z + fT*kD.z; + if (fTmp >= fWLength) { + afT[iQuantity++] = fT*fInvDLength; + if (iQuantity == 2) { + return 2; + } + } + } + + return iQuantity; +} + + +/** Used by collisionTimeForMovingPointFixedCapsule. + @cite From magic software http://www.magic-software.com/Source/Intersection3D/MgcIntr3DLinCap.cpp + + @param rkRay The ray + @param rkCapsule The capsule + @param riQuantity The number of intersections found + @param akPoint The intersections found + @return True if there is at least one intersection + */ +static bool findRayCapsuleIntersection( + const Ray& rkRay, + const Capsule& rkCapsule, + int& riQuantity, + Vector3 akPoint[2]) { + + double afT[2]; + riQuantity = findRayCapsuleIntersectionAux(rkRay.origin(), rkRay.direction(), rkCapsule, afT); + + // Only return intersections that occur in the future + int iClipQuantity = 0; + int i; + for (i = 0; i < riQuantity; ++i) { + if (afT[i] >= 0.0f) { + akPoint[iClipQuantity] = rkRay.origin() + afT[i] * rkRay.direction(); + ++iClipQuantity; + } + } + + riQuantity = iClipQuantity; + return (riQuantity > 0); +} + +float CollisionDetection::collisionTimeForMovingPointFixedCapsule( + const Vector3& _point, + const Vector3& velocity, + const Capsule& capsule, + Vector3& location, + Vector3& outNormal) { + + float timeScale = velocity.magnitude(); + + if (timeScale == 0.0f) { + timeScale = 1; + } + + Vector3 direction = velocity / timeScale; + int numIntersections; + Vector3 intersection[2]; + findRayCapsuleIntersection(Ray::fromOriginAndDirection(_point, direction), capsule, numIntersections, intersection); + + if (numIntersections == 2) { + // A collision can only occur if there are two intersections. If there is one + // intersection, that one is exiting the capsule. + + // Find the entering intersection (the first one that occurs). + float d0 = (intersection[0] - _point).squaredMagnitude(); + float d1 = (intersection[1] - _point).squaredMagnitude(); + + // Compute the surface normal (if we aren't ignoring the result) + if (&outNormal != &ignore) { + Vector3 p2 = LineSegment::fromTwoPoints(capsule.point(0), capsule.point(1)).closestPoint(_point); + outNormal = (_point - p2).direction(); + } + + if (d0 > d1) { + location = intersection[1]; + return sqrt(d1) / timeScale; + } else { + location = intersection[0]; + return sqrt(d0) / timeScale; + } + } else { + // No entering intersection discovered; return no intersection. + location = Vector3::inf(); + return finf(); + } +} + + +float CollisionDetection::collisionTimeForMovingSphereFixedPlane( + const Sphere& sphere, + const Vector3& velocity, + const Plane& plane, + Vector3& location, + Vector3& outNormal) { + + if (sphere.radius == 0) { + // Optimization for zero radius sphere + return collisionTimeForMovingPointFixedPlane(sphere.center, velocity, plane, location, outNormal); + } + + // The collision point on the sphere will be the point at + // center - (radius * normal). Collisions only occur when + // the sphere is travelling into the plane. + + double d; + plane.getEquation(outNormal, d); + + double vdotN = velocity.dot(outNormal); + + if (fuzzyGt(vdotN, 0)) { + // No collision when the sphere is moving towards a backface. + location = Vector3::inf(); + return (float)finf(); + } + + float cdotN = sphere.center.dot(outNormal); + + // Distance from the center to the plane + float distance = cdotN + (float)d; + + // Where is the collision on the sphere? + Vector3 point = sphere.center - (sphere.radius * outNormal); + + if (fuzzyLe(G3D::abs(distance), sphere.radius)) { + // Already interpenetrating + location = sphere.center - distance * outNormal; + return 0; + } else { + return collisionTimeForMovingPointFixedPlane(point, velocity, plane, location, outNormal); + } + +} + + +float CollisionDetection::collisionTimeForMovingSphereFixedTriangle( + const class Sphere& sphere, + const Vector3& velocity, + const Triangle& triangle, + Vector3& outLocation, + float b[3]) { + + Vector3 dummy; + float time = collisionTimeForMovingSphereFixedPlane(sphere, velocity, triangle.plane(), + outLocation, dummy); + + if (time == finf()) { + // No collision is ever going to happen + return time; + } + + // We will hit the plane of the triangle at *time*. See if + // the intersection point actually is within the triangle. + + if (isPointInsideTriangle(triangle.vertex(0), triangle.vertex(1), triangle.vertex(2), triangle.normal(), + outLocation, b, triangle.primaryAxis())) { + + // The intersection point is inside the triangle; that is the location where + // the sphere hits the triangle. + +# ifdef G3D_DEBUG + { + // Internal consistency checks + debugAssertM(b[0] >= 0.0 && b[0] <= 1.0f, "Intersection is outside triangle."); + debugAssertM(b[1] >= 0.0 && b[1] <= 1.0f, "Intersection is outside triangle."); + debugAssertM(b[2] >= 0.0 && b[2] <= 1.0f, "Intersection is outside triangle."); + Vector3 blend = + b[0] * triangle.vertex(0) + + b[1] * triangle.vertex(1) + + b[2] * triangle.vertex(2); + debugAssertM(blend.fuzzyEq(outLocation), "Barycentric coords don't match intersection."); + // Call again so that we can debug the problem + // isPointInsideTriangle(triangle.vertex(0), triangle.vertex(1), triangle.vertex(2), triangle.normal(), + // outLocation, b, triangle.primaryAxis()); + } +# endif + + return time; + } + + // The collision (if it exists) is with a point on the triangle perimeter. + // Switch over to moving the triangle towards a fixed sphere and see at what time + // they will hit. + + // Closest point on the triangle to the sphere intersection with the plane. + int edgeIndex; + const Vector3& point = closestPointOnTrianglePerimeter(triangle._vertex, triangle.edgeDirection, + triangle.edgeMagnitude, outLocation, edgeIndex); + + float t = 0; + if (! sphere.contains(point)) { + // The point is outside the sphere--see when it will hit + t = collisionTimeForMovingPointFixedSphere(point, -velocity, sphere, dummy, dummy); + } + + if (t < finf()) { + outLocation = point; + // Compute Barycentric coords + + // Index of the next vertex + static const int next[] = {1, 2, 0}; + + // Project along the edge in question. + // Avoid sqrt by taking advantage of the existing edgeDirection unit vector. + b[next[edgeIndex]] = (outLocation - triangle._vertex[edgeIndex]).dot + (triangle.edgeDirection[edgeIndex]) / triangle.edgeMagnitude[edgeIndex]; + + b[edgeIndex] = 1.0f - b[next[edgeIndex]]; + + b[next[next[edgeIndex]]] = 0.0f; + +# ifdef G3D_DEBUG + { + // Internal consistency checks + for (int i = 0; i < 3; ++i) { + debugAssertM(fuzzyGe(b[i], 0.0f) && fuzzyLe(b[i], 1.0f), "Intersection is outside triangle."); + } + Vector3 blend = + b[0] * triangle.vertex(0) + + b[1] * triangle.vertex(1) + + b[2] * triangle.vertex(2); + debugAssertM(blend.fuzzyEq(outLocation), + format("Barycentric coords don't match intersection. %s != %s", + blend.toString().c_str(), + outLocation.toString().c_str())); + + // Call again so that we can debug the problem + collisionTimeForMovingPointFixedSphere(point, -velocity, sphere, dummy, dummy); + } +# endif + + // Due to tiny roundoffs, these values might be slightly out of bounds. + // Ensure that they are legal. Note that the above debugging code + // verifies that we are not clamping truly illegal values. + for (int i = 0; i < 3; ++i) { + b[i] = clamp(b[i], 0.0f, 1.0f); + } + } + + // The collision occured at the point, if it occured. The normal + // was the plane normal, computed above. + + return t; +} + + +float CollisionDetection::collisionTimeForMovingSphereFixedRectangle( + const Sphere& sphere, + const Vector3& velocity, + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + Vector3& location, + Vector3& outNormal) { + + Plane plane(v0, v1, v2); + + float time = collisionTimeForMovingSphereFixedPlane(sphere, velocity, plane, location, outNormal); + + if (time == finf()) { + // No collision is ever going to happen + return time; + } + + if (isPointInsideRectangle(v0, v1, v2, v3, plane.normal(), location)) { + // The intersection point is inside the rectangle; that is the location where + // the sphere hits the rectangle. + return time; + } + + // Switch over to moving the rectangle towards a fixed sphere and see at what time + // they will hit. + + Vector3 point = closestPointToRectanglePerimeter(v0, v1, v2, v3, sphere.center); + + Vector3 dummy; + double t = collisionTimeForMovingPointFixedSphere(point, -velocity, sphere, location, dummy); + + // Normal is the plane normal, location is the original location of the point. + location = point; + + return t; +} + + +float CollisionDetection::collisionTimeForMovingSphereFixedBox( + const Sphere& sphere, + const Vector3& velocity, + const Box& box, + Vector3& location, + Vector3& outNormal) { + + if (fixedSolidSphereIntersectsFixedSolidBox(sphere, box)) { + // TODO: Compute more useful location and normal? + location = sphere.center; + outNormal = Vector3::zero(); + return 0; + } + + float bestTime; + + Vector3 v[4]; + int f = 0; + box.getFaceCorners(f, v[0], v[1], v[2], v[3]); + bestTime = collisionTimeForMovingSphereFixedRectangle(sphere, velocity, v[0], v[1], v[2], v[3], location, outNormal); + + for (f = 1; f < 6; ++f) { + Vector3 pos, normal; + box.getFaceCorners(f, v[0], v[1], v[2], v[3]); + float time = collisionTimeForMovingSphereFixedRectangle(sphere, velocity, v[0], v[1], v[2], v[3], pos, normal); + if (time < bestTime) { + bestTime = time; + location = pos; + outNormal = normal; + } + } + + return bestTime; +} + + +float CollisionDetection::collisionTimeForMovingSphereFixedCapsule( + const Sphere& sphere, + const Vector3& velocity, + const Capsule& capsule, + Vector3& location, + Vector3& outNormal) { + + (void)outNormal; + + Capsule _capsule(capsule.point(0), capsule.point(1), capsule.radius() + sphere.radius); + + Vector3 normal; + double time = collisionTimeForMovingPointFixedCapsule(sphere.center, velocity, _capsule, location, normal); + + if (time < finf()) { + // Location is now the position of the center of the sphere at the time of collision. + // We have to adjust the collision location for the size of the sphere. + location -= sphere.radius * normal; + } + + return time; +} + + +Vector3 CollisionDetection::bounceDirection( + const Sphere& sphere, + const Vector3& velocity, + const float collisionTime, + const Vector3& collisionLocation, + const Vector3& collisionNormal) { + + // Location when the collision occurs + Vector3 sphereLocation = sphere.center + velocity * collisionTime; + + Vector3 normal = (sphereLocation - collisionLocation); + if (fuzzyEq(normal.squaredMagnitude(), 0)) { + normal = collisionNormal; + } else { + normal.unitize(); + } + + Vector3 direction = velocity.direction(); + + // Reflect direction about the normal + return direction - 2.0 * normal * normal.dot(direction); +} + + +Vector3 CollisionDetection::slideDirection( + const Sphere& sphere, + const Vector3& velocity, + const float collisionTime, + const Vector3& collisionLocation) { + + Vector3 sphereLocation = sphere.center + velocity * collisionTime; + Vector3 normal = (sphereLocation - collisionLocation).direction(); + Vector3 direction = velocity.direction(); + + // subtract off the part in the direction away from the normal. + return direction - normal * normal.dot(direction); +} + + +Vector3 CollisionDetection::closestPointOnLineSegment( + const Vector3& v0, + const Vector3& v1, + const Vector3& point) { + + const Vector3& edge = (v1 - v0); + float edgeLength = edge.magnitude(); + + if (edgeLength == 0) { + // The line segment is a point + return v0; + } + + return closestPointOnLineSegment(v0, v1, edge / edgeLength, edgeLength, point); +} + + +Vector3 CollisionDetection::closestPointOnLineSegment( + const Vector3& v0, + const Vector3& v1, + const Vector3& edgeDirection, + const float edgeLength, + const Vector3& point) { + + debugAssert((v1 - v0).direction().fuzzyEq(edgeDirection)); + debugAssert(fuzzyEq((v1 - v0).magnitude(), edgeLength)); + + // Vector towards the point + const Vector3& c = point - v0; + + // Projected onto the edge itself + float t = edgeDirection.dot(c); + + if (t <= 0) { + // Before the start + return v0; + } else if (t >= edgeLength) { + // After the end + return v1; + } else { + // At distance t along the edge + return v0 + edgeDirection * t; + } +} + + +Vector3 CollisionDetection::closestPointOnTrianglePerimeter( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& point) { + + Vector3 v[3] = {v0, v1, v2}; + Vector3 edgeDirection[3] = {(v1 - v0), (v2 - v1), (v0 - v2)}; + float edgeLength[3]; + + for (int i = 0; i < 3; ++i) { + edgeLength[i] = edgeDirection[i].magnitude(); + edgeDirection[i] /= edgeLength[i]; + } + + int edgeIndex; + return closestPointOnTrianglePerimeter(v, edgeDirection, edgeLength, point, edgeIndex); +} + + +Vector3 CollisionDetection::closestPointOnTrianglePerimeter( + const Vector3 v[3], + const Vector3 edgeDirection[3], + const float edgeLength[3], + const Vector3& point, + int& edgeIndex) { + + // Closest point on segment from v[i] to v[i + 1] + Vector3 r[3]; + + // Distance squared from r[i] to point + float d[3]; + + // Index of the next point + static const int next[] = {1, 2, 0}; + + for (int i = 0; i < 3; ++i) { + r[i] = closestPointOnLineSegment(v[i], v[next[i]], edgeDirection[i], edgeLength[i], point); + d[i] = (r[i] - point).squaredMagnitude(); + } + + if (d[0] < d[1]) { + if (d[0] < d[2]) { + // Between v0 and v1 + edgeIndex = 0; + } else { + // Between v2 and v0 + edgeIndex = 2; + } + } else { + if (d[1] < d[2]) { + // Between v1 and v2 + edgeIndex = 1; + } else { + // Between v2 and v0 + edgeIndex = 2; + } + } + +# ifdef G3D_DEBUG + { + Vector3 diff = r[edgeIndex] - v[edgeIndex]; + debugAssertM(fuzzyEq(diff.direction().dot(edgeDirection[edgeIndex]), 1.0f) || + diff.fuzzyEq(Vector3::zero()), "Point not on correct triangle edge"); + float frac = diff.dot(edgeDirection[edgeIndex])/edgeLength[edgeIndex]; + debugAssertM(frac >= -0.000001, "Point off low side of edge."); + debugAssertM(frac <= 1.000001, "Point off high side of edge."); + } +# endif + + return r[edgeIndex]; +} + + +bool CollisionDetection::isPointInsideTriangle( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& normal, + const Vector3& point, + float b[3], + Vector3::Axis primaryAxis) { + + if (primaryAxis == Vector3::DETECT_AXIS) { + primaryAxis = normal.primaryAxis(); + } + + // Check that the point is within the triangle using a Barycentric + // coordinate test on a two dimensional plane. + int i, j; + + switch (primaryAxis) { + case Vector3::X_AXIS: + i = Vector3::Y_AXIS; + j = Vector3::Z_AXIS; + break; + + case Vector3::Y_AXIS: + i = Vector3::Z_AXIS; + j = Vector3::X_AXIS; + break; + + case Vector3::Z_AXIS: + i = Vector3::X_AXIS; + j = Vector3::Y_AXIS; + break; + + default: + // This case is here to supress a warning on Linux + i = j = 0; + debugAssertM(false, "Should not get here."); + break; + } + + // See if all barycentric coordinates are non-negative + + // 2D area via cross product +# define AREA2(d, e, f) (((e)[i] - (d)[i]) * ((f)[j] - (d)[j]) - ((f)[i] - (d)[i]) * ((e)[j] - (d)[j])) + + // Area of the polygon + float area = AREA2(v0, v1, v2); + if (area == 0) { + // This triangle has zero area, so the point must not + // be in it unless the triangle point is the test point. + return (v0 == point); + } + + debugAssert(area != 0); + + float invArea = 1.0f / area; + + // (avoid normalization until absolutely necessary) + b[0] = AREA2(point, v1, v2) * invArea; + + if ((b[0] < 0.0f) || (b[0] > 1.0f)) { + return false; + } + + b[1] = AREA2(v0, point, v2) * invArea; + if ((b[1] < 0.0f) || (b[1] > 1.0f)) { + return false; + } + + b[2] = 1.0f - b[0] - b[1]; + +# undef AREA2 + + return (b[2] >= 0.0f) && (b[2] <= 1.0f); +} + + +bool CollisionDetection::isPointInsideRectangle( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + const Vector3& normal, + const Vector3& point) { + + return isPointInsideTriangle(v0, v1, v2, normal, point) || + isPointInsideTriangle(v2, v3, v0, normal, point); +} + + +Vector3 CollisionDetection::closestPointToRectanglePerimeter( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + const Vector3& point) { + + Vector3 r0 = closestPointOnLineSegment(v0, v1, point); + Vector3 r1 = closestPointOnLineSegment(v1, v2, point); + Vector3 r2 = closestPointOnLineSegment(v2, v3, point); + Vector3 r3 = closestPointOnLineSegment(v3, v0, point); + + double d0 = (r0 - point).squaredMagnitude(); + double d1 = (r1 - point).squaredMagnitude(); + double d2 = (r2 - point).squaredMagnitude(); + double d3 = (r3 - point).squaredMagnitude(); + + if (d0 < d1) { + if (d0 < d2) { + if (d0 < d3) { + return r0; + } else { + return r3; + } + } else { + if (d2 < d3) { + return r2; + } else { + return r3; + } + } + } else { + if (d1 < d2) { + if (d1 < d3) { + return r1; + } else { + return r3; + } + } else { + if (d2 < d3) { + return r2; + } else { + return r3; + } + } + } +} + + +Vector3 CollisionDetection::closestPointToRectangle( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + const Vector3& point) { + + Plane plane(v0, v1, v2); + + // Project the point into the plane + double a, b, c, d; + plane.getEquation(a, b, c, d); + + double distance = a*point.x + b*point.y + c*point.z + d; + Vector3 planePoint = point - distance * plane.normal(); + + if (isPointInsideRectangle(v0, v1, v2, v3, plane.normal(), planePoint)) { + return planePoint; + } else { + return closestPointToRectanglePerimeter(v0, v1, v2, v3, planePoint); + } +} + + +bool CollisionDetection::fixedSolidSphereIntersectsFixedSolidSphere( + const Sphere& sphere1, + const Sphere& sphere2) { + + return (sphere1.center - sphere2.center).squaredMagnitude() < square(sphere1.radius + sphere2.radius); +} + + +bool CollisionDetection::fixedSolidSphereIntersectsFixedSolidBox( + const Sphere& sphere, + const Box& box) { + + // If the center of the sphere is within the box, the whole + // sphere is within the box. + if (box.contains(sphere.center)) { + return true; + } + + float r2 = square(sphere.radius); + + // Find the closest point on the surface of the box to the sphere. If + // this point is within the sphere's radius, they intersect. + int f; + for (f = 0; f < 6; ++f) { + Vector3 v0, v1, v2, v3; + box.getFaceCorners(f, v0, v1, v2, v3); + if ((closestPointToRectangle(v0, v1, v2, v3, sphere.center) - sphere.center).squaredMagnitude() <= r2) { + return true; + } + } + + return false; +} + + +bool CollisionDetection::movingSpherePassesThroughFixedBox( + const Sphere& sphere, + const Vector3& velocity, + const Box& box, + double timeLimit) { + + // If they intersect originally, they definitely pass through each other. + if (fixedSolidSphereIntersectsFixedSolidBox(sphere, box)) { + return true; + } + + // See if the sphere hits the box during the time period. + Vector3 dummy1, dummy2; + + return (collisionTimeForMovingSphereFixedBox(sphere, velocity, box, dummy1, dummy2) < timeLimit); +} + + +bool CollisionDetection::movingSpherePassesThroughFixedSphere( + const Sphere& sphere, + const Vector3& velocity, + const Sphere& fixedSphere, + double timeLimit) { + + if (fixedSolidSphereIntersectsFixedSolidSphere(sphere, fixedSphere)) { + return true; + } + + // Extend the fixed sphere by the radius of the moving sphere + Sphere bigFixed(fixedSphere.center, fixedSphere.radius + sphere.radius); + Vector3 dummy1, dummy2; + + // If the sphere collides with the other sphere during the time limit, it passes through + return (collisionTimeForMovingPointFixedSphere(sphere.center, velocity, bigFixed, dummy1, dummy2) < timeLimit); +} + + + +bool CollisionDetection::fixedSolidSphereIntersectsFixedTriangle( + const Sphere& sphere, + const Triangle& triangle) { + + // How far is the sphere from the plane of the triangle + const Plane& plane = triangle.plane(); + + // Does the closest point to the sphere center lie within the triangle? + Vector3 v = plane.closestPoint(sphere.center); + + // Is the closest point to the plane within the sphere? + if ((v - sphere.center).squaredLength() <= square(sphere.radius)) { + // Is it also within the triangle? + float b[3]; + if (isPointInsideTriangle(triangle.vertex(0), triangle.vertex(1), triangle.vertex(2), triangle.normal(), + v, b, triangle.primaryAxis())){ + // The closest point is inside the triangle + return true; + } + } + + // ignored + int edgeIndex; + + v = closestPointOnTrianglePerimeter(triangle._vertex, triangle.edgeDirection, triangle.edgeMagnitude, sphere.center, edgeIndex); + + // Is the closest point within the sphere? + return ((v - sphere.center).squaredLength() <= square(sphere.radius)); +} + + +//////////////////////////////////////////////////////////////////////////////// +// AABB-triangle overlap test code based on Tomas Akenine-Möller's +// http://www.cs.lth.se/home/Tomas_Akenine_Moller/code/tribox3.txt +// Ported 2008-12-28 + +#define X 0 +#define Y 1 +#define Z 2 + +#define FINDMINMAX(x0, x1, x2, min, max) \ + min = max = x0; \ + if(x1max) max=x1;\ + if(x2max) max=x2; + +static bool planeBoxOverlap(const Vector3& normal, const Vector3& vert, const Vector3& maxbox) { + Vector3 vmin, vmax; + float v; + + // for each axis + for(int a = 0; a < 3; ++a) { + v = vert[a]; + + if (normal[a] > 0.0f) { + vmin[a] = -maxbox[a] - v; + vmax[a] = maxbox[a] - v; + } else { + vmin[a] = maxbox[a] - v; + vmax[a] = -maxbox[a] - v; + } + } + + if (normal.dot(vmin) > 0.0f) { + return false; + } else if (normal.dot(vmax) >= 0.0f) { + return true; + } else { + return false; + } +} + +/*======================== X-tests ========================*/ + +#define AXISTEST_X01(a, b, fa, fb) \ + p0 = a*v0[Y] - b*v0[Z]; \ + p2 = a*v2[Y] - b*v2[Z]; \ + if(p0rad || max<-rad) return false; + + +#define AXISTEST_X2(a, b, fa, fb) \ + p0 = a*v0[Y] - b*v0[Z]; \ + p1 = a*v1[Y] - b*v1[Z]; \ + if(p0rad || max<-rad) return false; + +/*======================== Y-tests ========================*/ + +#define AXISTEST_Y02(a, b, fa, fb) \ + p0 = -a*v0[X] + b*v0[Z]; \ + p2 = -a*v2[X] + b*v2[Z]; \ + if(p0rad || max<-rad) return false; + +#define AXISTEST_Y1(a, b, fa, fb) \ + p0 = -a*v0[X] + b*v0[Z]; \ + p1 = -a*v1[X] + b*v1[Z]; \ + if(p0rad || max<-rad) return false; + +/*======================== Z-tests ========================*/ + +#define AXISTEST_Z12(a, b, fa, fb) \ + p1 = a*v1[X] - b*v1[Y]; \ + p2 = a*v2[X] - b*v2[Y]; \ + if(p2rad || max<-rad) return false; + +#define AXISTEST_Z0(a, b, fa, fb) \ + p0 = a*v0[X] - b*v0[Y]; \ + p1 = a*v1[X] - b*v1[Y]; \ + if(p0rad || max<-rad) return false; + +bool CollisionDetection::fixedSolidBoxIntersectsFixedTriangle( + const AABox& box, const Triangle& tri) { + + // use separating axis theorem to test overlap between triangle and box + // need to test for overlap in these directions: + // 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle + // we do not even need to test these) + // 2) normal of the triangle + // 3) crossproduct(edge from tri, {x,y,z}-direction) + // this gives 3x3=9 more tests + + // This is the fastest branch (on Sun). + // Move the triangle to the object space of the box + // Triangle vertices in box object space + + const Vector3& boxcenter = box.center(); + const Vector3& boxhalfsize = box.extent() * 0.5f; + + const Vector3& v0 = tri.vertex(0) - boxcenter; + const Vector3& v1 = tri.vertex(1) - boxcenter; + const Vector3& v2 = tri.vertex(2) - boxcenter; + + // Compute triangle edges in object space + const Vector3& e0 = v1 - v0; + const Vector3& e1 = v2 - v1; + const Vector3& e2 = v0 - v2; + + // Bullet 3: + // test the 9 tests first (this was faster) + float min,max,p0,p1,p2,rad; + Vector3 fe; + + fe = abs(e0); + AXISTEST_X01(e0[Z], e0[Y], fe[Z], fe[Y]); + AXISTEST_Y02(e0[Z], e0[X], fe[Z], fe[X]); + AXISTEST_Z12(e0[Y], e0[X], fe[Y], fe[X]); + + fe = abs(e1); + AXISTEST_X01(e1[Z], e1[Y], fe[Z], fe[Y]); + AXISTEST_Y02(e1[Z], e1[X], fe[Z], fe[X]); + AXISTEST_Z0 (e1[Y], e1[X], fe[Y], fe[X]); + + fe = abs(e2); + AXISTEST_X2 (e2[Z], e2[Y], fe[Z], fe[Y]); + AXISTEST_Y1 (e2[Z], e2[X], fe[Z], fe[X]); + AXISTEST_Z12(e2[Y], e2[X], fe[Y], fe[X]); + + // Bullet 1: + // first test overlap in the {x,y,z}-directions + // find min, max of the triangle each direction, and test for overlap in + // that direction -- this is equivalent to testing a minimal AABB around + // the triangle against the AABB + + // test in X-direction + FINDMINMAX(v0[X],v1[X],v2[X],min,max); + if (min > boxhalfsize[X] || max < -boxhalfsize[X]) { + return false; + } + + // test in Y-direction + FINDMINMAX(v0[Y],v1[Y],v2[Y],min,max); + if (min > boxhalfsize[Y] || max < -boxhalfsize[Y]) { + return false; + } + + // test in Z-direction + FINDMINMAX(v0[Z],v1[Z],v2[Z],min,max); + if (min > boxhalfsize[Z] || max < -boxhalfsize[Z]) { + return false; + } + + // Bullet 2: + // test if the box intersects the plane of the triangle + // compute plane equation of triangle: normal*x+d=0 + + if (! planeBoxOverlap(tri.normal(), v0, boxhalfsize)) { + return false; + } + + // box and triangle overlap + return true; +} +#undef X +#undef Y +#undef Z + +//////////////////////////////////////////////////////////////////////////////// + + +} // namespace + +#ifdef _MSC_VER +// Turn off fast floating-point optimizations +#pragma float_control( pop ) +#pragma warning (pop) +#endif diff --git a/externals/g3dlite/CoordinateFrame.cpp b/externals/g3dlite/CoordinateFrame.cpp new file mode 100644 index 0000000..9b639b6 --- /dev/null +++ b/externals/g3dlite/CoordinateFrame.cpp @@ -0,0 +1,436 @@ +/** + @file CoordinateFrame.cpp + + Coordinate frame class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2009-11-13 + + Copyright 2000-2010, Morgan McGuire. + All rights reserved. +*/ + +#include "G3D/platform.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/Quat.h" +#include "G3D/Matrix4.h" +#include "G3D/Box.h" +#include "G3D/AABox.h" +#include "G3D/Sphere.h" +#include "G3D/Triangle.h" +#include "G3D/Ray.h" +#include "G3D/Capsule.h" +#include "G3D/Cylinder.h" +#include "G3D/UprightFrame.h" +#include "G3D/Any.h" +#include "G3D/stringutils.h" + +namespace G3D { + +CoordinateFrame::CoordinateFrame(const Any& any) { + any.verifyName("CFrame"); + if (toUpper(any.name()) == "CFRAME") { + any.verifyType(Any::TABLE, Any::ARRAY); + if (any.type() == Any::TABLE) { + rotation = any["rotation"]; + translation = any["translation"]; + } else { + any.verifySize(2); + rotation = any[0]; + translation = any[1]; + } + } else { + any.verifyName("CFrame::fromXYZYPRDegrees"); + any.verifyType(Any::ARRAY); + any.verifySize(3, 6); + + int s = any.size(); + + *this = fromXYZYPRDegrees(any[0], any[1], any[2], + (s > 3) ? any[3].number() : 0.0f, + (s > 4) ? any[4].number() : 0.0f, + (s > 5) ? any[5].number() : 0.0f); + } +} + + +CoordinateFrame::operator Any() const { + float x, y, z, yaw, pitch, roll; + getXYZYPRDegrees(x, y, z, yaw, pitch, roll); + Any a(Any::ARRAY, "CFrame::fromXYZYPRDegrees"); + a.append(x, y, z, yaw); + if ( ! G3D::fuzzyEq(yaw, 0.0f) || ! G3D::fuzzyEq(pitch, 0.0f) || ! G3D::fuzzyEq(roll, 0.0f)) { + a.append(yaw); + if (! G3D::fuzzyEq(pitch, 0.0f) || ! G3D::fuzzyEq(roll, 0.0f)) { + a.append(pitch); + if (! G3D::fuzzyEq(roll, 0.0f)) { + a.append(roll); + } + } + } + return a; +} + + +CoordinateFrame::CoordinateFrame(const class UprightFrame& f) { + *this = f.toCoordinateFrame(); +} + + +CoordinateFrame::CoordinateFrame() : + rotation(Matrix3::identity()), translation(Vector3::zero()) { +} + +CoordinateFrame CoordinateFrame::fromXYZYPRRadians(float x, float y, float z, float yaw, + float pitch, float roll) { + Matrix3 rotation = Matrix3::fromAxisAngle(Vector3::unitY(), yaw); + + rotation = Matrix3::fromAxisAngle(rotation.column(0), pitch) * rotation; + rotation = Matrix3::fromAxisAngle(rotation.column(2), roll) * rotation; + + const Vector3 translation(x, y, z); + + return CoordinateFrame(rotation, translation); +} + + +void CoordinateFrame::getXYZYPRRadians(float& x, float& y, float& z, + float& yaw, float& pitch, float& roll) const { + x = translation.x; + y = translation.y; + z = translation.z; + + const Vector3& look = lookVector(); + + if (abs(look.y) > 0.99f) { + // Looking nearly straight up or down + + yaw = G3D::pi() + atan2(look.x, look.z); + pitch = asin(look.y); + roll = 0.0f; + + } else { + + // Yaw cannot be affected by others, so pull it first + yaw = G3D::pi() + atan2(look.x, look.z); + + // Pitch is the elevation of the yaw vector + pitch = asin(look.y); + + Vector3 actualRight = rightVector(); + Vector3 expectedRight = look.cross(Vector3::unitY()); + + roll = 0;//acos(actualRight.dot(expectedRight)); TODO + } +} + + +void CoordinateFrame::getXYZYPRDegrees(float& x, float& y, float& z, + float& yaw, float& pitch, float& roll) const { + getXYZYPRRadians(x, y, z, yaw, pitch, roll); + yaw = toDegrees(yaw); + pitch = toDegrees(pitch); + roll = toDegrees(roll); +} + + +CoordinateFrame CoordinateFrame::fromXYZYPRDegrees(float x, float y, float z, + float yaw, float pitch, float roll) { + return fromXYZYPRRadians(x, y, z, toRadians(yaw), toRadians(pitch), toRadians(roll)); +} + + +Ray CoordinateFrame::lookRay() const { + return Ray::fromOriginAndDirection(translation, lookVector()); +} + + +bool CoordinateFrame::fuzzyEq(const CoordinateFrame& other) const { + + for (int c = 0; c < 3; ++c) { + for (int r = 0; r < 3; ++r) { + if (! G3D::fuzzyEq(other.rotation[r][c], rotation[r][c])) { + return false; + } + } + if (! G3D::fuzzyEq(translation[c], other.translation[c])) { + return false; + } + } + + return true; +} + + +bool CoordinateFrame::fuzzyIsIdentity() const { + const Matrix3& I = Matrix3::identity(); + + for (int c = 0; c < 3; ++c) { + for (int r = 0; r < 3; ++r) { + if (fuzzyNe(I[r][c], rotation[r][c])) { + return false; + } + } + if (fuzzyNe(translation[c], 0)) { + return false; + } + } + + return true; +} + + +bool CoordinateFrame::isIdentity() const { + return + (translation == Vector3::zero()) && + (rotation == Matrix3::identity()); +} + + +Matrix4 CoordinateFrame::toMatrix4() const { + return Matrix4(*this); +} + + +std::string CoordinateFrame::toXML() const { + return G3D::format( + "\n %lf,%lf,%lf,%lf,\n %lf,%lf,%lf,%lf,\n %lf,%lf,%lf,%lf,\n %lf,%lf,%lf,%lf\n\n", + rotation[0][0], rotation[0][1], rotation[0][2], translation.x, + rotation[1][0], rotation[1][1], rotation[1][2], translation.y, + rotation[2][0], rotation[2][1], rotation[2][2], translation.z, + 0.0, 0.0, 0.0, 1.0); +} + + +Plane CoordinateFrame::toObjectSpace(const Plane& p) const { + Vector3 N, P; + double d; + p.getEquation(N, d); + P = N * (float)d; + P = pointToObjectSpace(P); + N = normalToObjectSpace(N); + return Plane(N, P); +} + + +Plane CoordinateFrame::toWorldSpace(const Plane& p) const { + Vector3 N, P; + double d; + p.getEquation(N, d); + P = N * (float)d; + P = pointToWorldSpace(P); + N = normalToWorldSpace(N); + return Plane(N, P); +} + + +Triangle CoordinateFrame::toObjectSpace(const Triangle& t) const { + return Triangle(pointToObjectSpace(t.vertex(0)), + pointToObjectSpace(t.vertex(1)), + pointToObjectSpace(t.vertex(2))); +} + + +Triangle CoordinateFrame::toWorldSpace(const Triangle& t) const { + return Triangle(pointToWorldSpace(t.vertex(0)), + pointToWorldSpace(t.vertex(1)), + pointToWorldSpace(t.vertex(2))); +} + + +Cylinder CoordinateFrame::toWorldSpace(const Cylinder& c) const { + return Cylinder( + pointToWorldSpace(c.point(0)), + pointToWorldSpace(c.point(1)), + c.radius()); +} + + +Capsule CoordinateFrame::toWorldSpace(const Capsule& c) const { + return Capsule( + pointToWorldSpace(c.point(0)), + pointToWorldSpace(c.point(1)), + c.radius()); +} + + +Box CoordinateFrame::toWorldSpace(const AABox& b) const { + Box b2(b); + return toWorldSpace(b2); +} + + +Box CoordinateFrame::toWorldSpace(const Box& b) const { + Box out(b); + + for (int i = 0; i < 8; ++i) { + out._corner[i] = pointToWorldSpace(b._corner[i]); + debugAssert(! isNaN(out._corner[i].x)); + } + + for (int i = 0; i < 3; ++i) { + out._axis[i] = vectorToWorldSpace(b._axis[i]); + } + + out._center = pointToWorldSpace(b._center); + + return out; +} + + +Box CoordinateFrame::toObjectSpace(const Box &b) const { + return inverse().toWorldSpace(b); +} + + +Box CoordinateFrame::toObjectSpace(const AABox& b) const { + return toObjectSpace(Box(b)); +} + + +CoordinateFrame::CoordinateFrame(class BinaryInput& b) : rotation(Matrix3::zero()) { + deserialize(b); +} + + +void CoordinateFrame::deserialize(class BinaryInput& b) { + rotation.deserialize(b); + translation.deserialize(b); +} + + +void CoordinateFrame::serialize(class BinaryOutput& b) const { + rotation.serialize(b); + translation.serialize(b); +} + + +Sphere CoordinateFrame::toWorldSpace(const Sphere &b) const { + return Sphere(pointToWorldSpace(b.center), b.radius); +} + + +Sphere CoordinateFrame::toObjectSpace(const Sphere &b) const { + return Sphere(pointToObjectSpace(b.center), b.radius); +} + + +Ray CoordinateFrame::toWorldSpace(const Ray& r) const { + return Ray::fromOriginAndDirection(pointToWorldSpace(r.origin()), vectorToWorldSpace(r.direction())); +} + + +Ray CoordinateFrame::toObjectSpace(const Ray& r) const { + return Ray::fromOriginAndDirection(pointToObjectSpace(r.origin()), vectorToObjectSpace(r.direction())); +} + + +void CoordinateFrame::lookAt(const Vector3 &target) { + lookAt(target, Vector3::unitY()); +} + + +void CoordinateFrame::lookAt( + const Vector3& target, + Vector3 up) { + + up = up.direction(); + + Vector3 look = (target - translation).direction(); + if (fabs(look.dot(up)) > .99f) { + up = Vector3::unitX(); + if (fabs(look.dot(up)) > .99f) { + up = Vector3::unitY(); + } + } + + up -= look * look.dot(up); + up.unitize(); + + Vector3 z = -look; + Vector3 x = -z.cross(up); + x.unitize(); + + Vector3 y = z.cross(x); + + rotation.setColumn(0, x); + rotation.setColumn(1, y); + rotation.setColumn(2, z); +} + + +CoordinateFrame CoordinateFrame::lerp( + const CoordinateFrame& other, + float alpha) const { + + if (alpha == 1.0f) { + return other; + } else if (alpha == 0.0f) { + return *this; + } else { + Quat q1 = Quat(this->rotation); + Quat q2 = Quat(other.rotation); + + return CoordinateFrame( + q1.slerp(q2, alpha).toRotationMatrix(), + this->translation * (1 - alpha) + other.translation * alpha); + } +} + + +void CoordinateFrame::pointToWorldSpace(const Array& v, Array& vout) const { + vout.resize(v.size()); + + for (int i = v.size() - 1; i >= 0; --i) { + vout[i] = pointToWorldSpace(v[i]); + } +} + + +void CoordinateFrame::normalToWorldSpace(const Array& v, Array& vout) const { + vout.resize(v.size()); + + for (int i = v.size() - 1; i >= 0; --i) { + vout[i] = normalToWorldSpace(v[i]); + } +} + + +void CoordinateFrame::vectorToWorldSpace(const Array& v, Array& vout) const { + vout.resize(v.size()); + + for (int i = v.size() - 1; i >= 0; --i) { + vout[i] = vectorToWorldSpace(v[i]); + } +} + + +void CoordinateFrame::pointToObjectSpace(const Array& v, Array& vout) const { + vout.resize(v.size()); + + for (int i = v.size() - 1; i >= 0; --i) { + vout[i] = pointToObjectSpace(v[i]); + } +} + + +void CoordinateFrame::normalToObjectSpace(const Array& v, Array& vout) const { + vout.resize(v.size()); + + for (int i = v.size() - 1; i >= 0; --i) { + vout[i] = normalToObjectSpace(v[i]); + } +} + + +void CoordinateFrame::vectorToObjectSpace(const Array& v, Array& vout) const { + vout.resize(v.size()); + + for (int i = v.size() - 1; i >= 0; --i) { + vout[i] = vectorToObjectSpace(v[i]); + } +} + +} // namespace diff --git a/externals/g3dlite/Crypto.cpp b/externals/g3dlite/Crypto.cpp new file mode 100644 index 0000000..c69b233 --- /dev/null +++ b/externals/g3dlite/Crypto.cpp @@ -0,0 +1,70 @@ +/** + @file Crypto.cpp + + @author Morgan McGuire, http://graphics.cs.williams.edu + + + @created 2006-03-28 + @edited 2006-04-06 + */ + +#include "G3D/platform.h" +#include "G3D/Crypto.h" +#include "G3D/g3dmath.h" +#include + +namespace G3D { + + +int Crypto::smallPrime(int n) { + debugAssert(n < numSmallPrimes() && n >= 0); + + // From: + // http://primes.utm.edu/lists/small/1000.txt + + static const int table[] = { + 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, + 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, + 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, + 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, + 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, + 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, + 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, + 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, + 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, + 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, + 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, + 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, + 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, + 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, + 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, + 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, + 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, + 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, + 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, + 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, + 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, + 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, + 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, + 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, + 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, + 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, + 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, + 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, + 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, + 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, + 1993, 1997, 1999}; + + return table[n]; +} + + +int Crypto::numSmallPrimes() { + return 303; +} + +uint32 Crypto::crc32(const void* byte, size_t numBytes) { + return ::crc32(::crc32(0, Z_NULL, 0), static_cast(byte), numBytes); +} + +} // G3D diff --git a/externals/g3dlite/Cylinder.cpp b/externals/g3dlite/Cylinder.cpp new file mode 100644 index 0000000..7a7b9f9 --- /dev/null +++ b/externals/g3dlite/Cylinder.cpp @@ -0,0 +1,176 @@ +/** + @file Cylinder.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-02-07 + @edited 2006-02-18 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#include "G3D/platform.h" +#include "G3D/Cylinder.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/LineSegment.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/Line.h" +#include "G3D/AABox.h" + +namespace G3D { + +Cylinder::Cylinder(class BinaryInput& b) { + deserialize(b); +} + + +Cylinder::Cylinder() { +} + + +Cylinder::Cylinder(const Vector3& _p1, const Vector3& _p2, float _r) + : p1(_p1), p2(_p2), mRadius(_r) { +} + + +void Cylinder::serialize(class BinaryOutput& b) const { + p1.serialize(b); + p2.serialize(b); + b.writeFloat64(mRadius); +} + + +void Cylinder::deserialize(class BinaryInput& b) { + p1.deserialize(b); + p2.deserialize(b); + mRadius = b.readFloat64(); +} + + +Line Cylinder::axis() const { + return Line::fromTwoPoints(p1, p2); +} + + + +float Cylinder::radius() const { + return mRadius; +} + + +float Cylinder::volume() const { + return + (float)pi() * square(mRadius) * (p1 - p2).magnitude(); +} + + +float Cylinder::area() const { + return + // Sides + (twoPi() * mRadius) * height() + + + // Caps + twoPi() * square(mRadius); +} + +void Cylinder::getBounds(AABox& out) const { + Vector3 min = p1.min(p2) - (Vector3(1, 1, 1) * mRadius); + Vector3 max = p1.max(p2) + (Vector3(1, 1, 1) * mRadius); + out = AABox(min, max); +} + +bool Cylinder::contains(const Vector3& p) const { + return LineSegment::fromTwoPoints(p1, p2).distanceSquared(p) <= square(mRadius); +} + + +void Cylinder::getReferenceFrame(CoordinateFrame& cframe) const { + cframe.translation = center(); + + Vector3 Y = (p1 - p2).direction(); + Vector3 X = (abs(Y.dot(Vector3::unitX())) > 0.9) ? Vector3::unitY() : Vector3::unitX(); + Vector3 Z = X.cross(Y).direction(); + X = Y.cross(Z); + cframe.rotation.setColumn(0, X); + cframe.rotation.setColumn(1, Y); + cframe.rotation.setColumn(2, Z); +} + + +void Cylinder::getRandomSurfacePoint(Vector3& p, Vector3& N) const { + float h = height(); + float r = radius(); + + // Create a random point on a standard cylinder and then rotate to the global frame. + + // Relative areas (factor of 2PI already taken out) + float capRelArea = square(r) / 2.0f; + float sideRelArea = r * h; + + float r1 = uniformRandom(0, capRelArea * 2 + sideRelArea); + + if (r1 < capRelArea * 2) { + + // Select a point uniformly at random on a disk + // @cite http://mathworld.wolfram.com/DiskPointPicking.html + float a = uniformRandom(0, (float)twoPi()); + float r2 = sqrt(uniformRandom(0, 1)) * r; + p.x = cos(a) * r2; + p.z = sin(a) * r2; + + N.x = 0; + N.z = 0; + if (r1 < capRelArea) { + // Top + p.y = h / 2.0f; + N.y = 1; + } else { + // Bottom + p.y = -h / 2.0f; + N.y = -1; + } + } else { + // Side + float a = uniformRandom(0, (float)twoPi()); + N.x = cos(a); + N.y = 0; + N.z = sin(a); + p.x = N.x * r; + p.z = N.y * r; + p.y = uniformRandom(-h / 2.0f, h / 2.0f); + } + + // Transform to world space + CoordinateFrame cframe; + getReferenceFrame(cframe); + + p = cframe.pointToWorldSpace(p); + N = cframe.normalToWorldSpace(N); +} + + +Vector3 Cylinder::randomInteriorPoint() const { + float h = height(); + float r = radius(); + + // Create a random point in a standard cylinder and then rotate to the global frame. + + // Select a point uniformly at random on a disk + // @cite http://mathworld.wolfram.com/DiskPointPicking.html + float a = uniformRandom(0, (float)twoPi()); + float r2 = sqrt(uniformRandom(0, 1)) * r; + + Vector3 p( cos(a) * r2, + uniformRandom(-h / 2.0f, h / 2.0f), + sin(a) * r2); + + // Transform to world space + CoordinateFrame cframe; + getReferenceFrame(cframe); + + return cframe.pointToWorldSpace(p); +} + +} // namespace diff --git a/externals/g3dlite/G3D/AABox.h b/externals/g3dlite/G3D/AABox.h new file mode 100644 index 0000000..2e8da1f --- /dev/null +++ b/externals/g3dlite/G3D/AABox.h @@ -0,0 +1,272 @@ +/** + @file AABox.h + + Axis-aligned box class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2004-01-10 + @edited 2009-02-10 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_AABOX_H +#define G3D_AABOX_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/debug.h" +#include "G3D/Array.h" +#include "G3D/Plane.h" + +namespace G3D { + +/** + An axis-aligned box. + */ +class AABox { +private: + friend class Intersect; + + /** Optional argument placeholder */ + static int dummy; + + Vector3 lo; + Vector3 hi; + +public: + + /** Does not initialize the fields */ + inline AABox() {} + + /** + Constructs a zero-area AABox at v. + */ + inline explicit AABox(const Vector3& v) { + lo = hi = v; + } + + /** Assumes that low is less than or equal to high along each dimension. + To have this automatically enforced, use + AABox(low.min(high), low.max(high)); + */ + inline AABox(const Vector3& low, const Vector3& high) { + set(low, high); + } + + /** Assumes that low is less than or equal to high along each dimension. + */ + inline void set(const Vector3& low, const Vector3& high) { + debugAssert( + (low.x <= high.x) && + (low.y <= high.y) && + (low.z <= high.z)); + lo = low; + hi = high; + } + + /** + Grows to include the bounds of a + */ + inline void merge(const AABox& a) { + lo = lo.min(a.lo); + hi = hi.max(a.hi); + } + + inline void merge(const Vector3& a) { + lo = lo.min(a); + hi = hi.max(a); + } + + void serialize(class BinaryOutput& b) const; + + void deserialize(class BinaryInput& b); + + inline bool isFinite() const { + return lo.isFinite() && hi.isFinite(); + } + + inline const Vector3& low() const { + return lo; + } + + inline const Vector3& high() const { + return hi; + } + + /** + The largest possible finite box. + */ + static const AABox& maxFinite(); + + /** A large finite box. This is smaller than FLT_MAX + because it leaves room to add boxes together. */ + static const AABox& large(); + + static const AABox& inf(); + + static const AABox& zero(); + + /** + Returns the centroid of the box. + */ + inline Vector3 center() const { + return (lo + hi) * 0.5; + } + + Vector3 corner(int index) const; + + /** + Distance from corner(0) to the next corner along axis a. + */ + inline float extent(int a) const { + debugAssert(a < 3); + return hi[a] - lo[a]; + } + + + inline Vector3 extent() const { + return hi - lo; + } + + + /** + Splits the box into two AABoxes along the specified axis. low contains + the part that was closer to negative infinity along axis, high contains + the other part. Either may have zero volume. + */ + void split(const Vector3::Axis& axis, float location, AABox& low, AABox& high) const; + + /** + Conservative culling test for up to 32 planes. + Returns true if there exists a plane[p] for + which the entire object is in the negative half space + (opposite the plane normal). + + testMask and childMask + are used for optimizing bounding volume hierarchies. + The version of this method that produces childMask + is slower than the version without; it should only + be used for parent nodes. + + @param cullingPlaneIndex The index of the first plane for which + the entire object is in the negative half-space. The function + exits early when one plane is found. -1 when the function + returns false (i.e. when no plane culls the whole object). + + @param testMask If bit p is 0, the + bounding volume automatically passes the culling test for + plane[p] (i.e. it is known that the volume + is entirely within the positive half space). The function + must return false if testMask is 0 and test all planes + when testMask is -1 (0xFFFFFFFF). + + @param childMask Test mask for the children of this volume. + + */ + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex, + const uint32 testMask, + uint32& childMask) const; + + /** + Conservative culling test that does not produce a mask for children. + */ + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex = dummy, + const uint32 testMask = 0xFFFFFFFF) const; + + /** less than or equal to containment */ + inline bool contains(const AABox& other) const { + return + (other.hi.x <= hi.x) && + (other.hi.y <= hi.y) && + (other.hi.z <= hi.z) && + (other.lo.x >= lo.x) && + (other.lo.y >= lo.y) && + (other.lo.z >= lo.z); + } + + inline bool contains( + const Vector3& point) const { + return + (point.x >= lo.x) && + (point.y >= lo.y) && + (point.z >= lo.z) && + (point.x <= hi.x) && + (point.y <= hi.y) && + (point.z <= hi.z); + } + + inline float area() const { + Vector3 diag = hi - lo; + return 2.0f * (diag.x * diag.y + diag.y * diag.z + diag.x * diag.z); + } + + inline float volume() const { + Vector3 diag = hi - lo; + return diag.x * diag.y * diag.z; + } + + Vector3 randomInteriorPoint() const; + + Vector3 randomSurfacePoint() const; + + /** Returns true if there is any overlap */ + bool intersects(const AABox& other) const; + + /** Returns true if there is any overlap. + @cite Jim Arvo's algorithm from Graphics Gems II*/ + bool intersects(const class Sphere& other) const; + + /** Return the intersection of the two boxes */ + AABox intersect(const AABox& other) const { + Vector3 H = hi.min(other.hi); + Vector3 L = lo.max(other.lo).min(H); + return AABox(L, H); + } + + inline size_t hashCode() const { + return lo.hashCode() + hi.hashCode(); + } + + inline bool operator==(const AABox& b) const { + return (lo == b.lo) && (hi == b.hi); + } + + inline bool operator!=(const AABox& b) const { + return !((lo == b.lo) && (hi == b.hi)); + } + + inline AABox operator+(const Vector3& v) const { + AABox out; + out.lo = lo + v; + out.hi = hi + v; + return out; + } + + inline AABox operator-(const Vector3& v) const { + AABox out; + out.lo = lo - v; + out.hi = hi - v; + return out; + } + + void getBounds(AABox& out) const { + out = *this; + } +}; + +} + +template <> struct HashTrait { + static size_t hashCode(const G3D::AABox& key) { return key.hashCode(); } +}; + + + +#endif diff --git a/externals/g3dlite/G3D/Any.h b/externals/g3dlite/G3D/Any.h new file mode 100644 index 0000000..4970120 --- /dev/null +++ b/externals/g3dlite/G3D/Any.h @@ -0,0 +1,570 @@ +/** + @file Any.h + + @author Morgan McGuire, Shawn Yarbrough, and Corey Taylor + @maintainer Morgan McGuire + + @created 2006-06-11 + @edited 2009-12-16 + + Copyright 2000-2010, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Any_h +#define G3D_Any_h + +#include "G3D/platform.h" +#include "G3D/Table.h" +#include "G3D/Array.h" +#include "G3D/AtomicInt32.h" +#include + +// needed for Token +#include "G3D/TextInput.h" + +#ifdef verify +#undef verify +#endif + +namespace G3D { + +class TextOutput; + +/** +\brief Easy loading and saving of human-readable configuration files. + +Encodes typed, structured data and can serialize it to a human +readable format that is very similar to the Python language's data +syntax. Well-suited for quickly creating human-readable file formats, +especially since deserialization and serialization preserve comments and +an Any can tell you what file and line it came from. + +The class is designed so that copying Anys generally is fast, even if +it is a large array or table. This is because data is shared between +copies until it is mutated, at which point an actual copy occurs. + +\section Example +Sample File: +
+{
+   shape = "round",
+
+   # in meters
+   radius = 3.7,
+
+   position = Vector3(1.0, -1.0, 0.0),
+   texture = { format = "RGB8", size = (320, 200)}
+}
+
+ +Sample code using: +
+Any x;
+x.load("ball.txt");
+if (x["shape"].string() == "round") {
+    x["density"] = 3;
+}
+x.save("ball.txt");
+
+ +The custom serialization format was chosen to be terse, easy for +humans to read, and easy for machines to parse. It was specifically +chosen over formats like XML, YAML, JSON, S-expressions, and Protocol +Buffers, although there is no reason you could not write readers and +writers for G3D::Any that support those. + +G3D::Any assumes that structures do not contain cycles; it is an +error to create a structure like: + +
+Any x(Any::ARRAY);
+x.array().append(x);    // don't do this!
+
+ +although no exception will be thrown at runtime during that append. + + +\section Parsing + +The primary use of Any is to create your own text file formats. +The Vector3 constructor is a good example of how to use the Any::verify +methods to provide good error checking while parsing such formats: + +
+Vector3::Vector3(const Any& any) {
+    any.verifyName("Vector3");
+    any.verifyType(Any::TABLE, Any::ARRAY);
+    any.verifySize(3);
+
+    if (any.type() == Any::ARRAY) {
+        x = any[0];
+        y = any[1];
+        z = any[2];
+    } else {
+        // Table
+        x = any["x"];
+        y = any["y"];
+        z = any["z"];
+    }
+}
+
+ +\section BNF +Serialized format BNF: + +
+identifier  ::= (letter | "_") (letter | digit | "_")*
+identifier-op ::= "::" | "->" | "."
+
+identifier-exp ::= [identifier-op] identifier (identifier-op identifier)*
+
+comment     ::= "#"  "\n"
+separator   ::= "," | ";"
+
+number      ::= 
+string      ::= 
+boolean     ::= "True" | "False"
+none        ::= "None"
+array       ::= "(" [value ("," value)*] ")"
+pair        ::= (identifier | string) "=" value
+table       ::= "{" [pair (separator pair)*] "}"
+named-array ::= identifier-exp tuple
+named-table ::= identifier-exp dict
+
+value       ::= [comment] (none | number | boolean | string | array | table | named-array | named-table)
+
+ +Except for single-line comments, whitespace is not significant. +All parsing is case-insensitive. + +The deserializer allows the substitution of [] for () when writing +tuples and ";" for ",". + +The serializer indents four spaces for each level of nesting. +Tables are written with the keys in alphabetic order. +*/ +class Any { +public: + + enum Type {NONE, BOOLEAN, NUMBER, STRING, ARRAY, TABLE}; + + static std::string toString(Type t); + + /** Where an Any came from in a file. Useful for throwing parsing errors */ + class Source { + public: + std::string filename; + int line; + int character; + + Source() : line(0), character(0) {} + + void set(const TextInput& ti, const Token& t) { + filename = ti.filename(); + line = t.line(); + character = t.character(); + } + }; + + typedef Array AnyArray; + typedef Table AnyTable; + +private: + + /** Called from deserialize() */ + static void deserializeComment(TextInput& ti, Token& token, std::string& comment); + + /** NONE, BOOLEAN, and NUMBER are stored directly in the Any */ + union SimpleValue { + bool b; + double n; + + inline SimpleValue() : n(0.0) {} + inline SimpleValue(bool x) : b(x) {} + inline SimpleValue(double x) : n(x) {} + }; + + class Data { + public: + /** ARRAY, TABLE, or STRING value only. NULL otherwise. */ + union Value { + std::string* s; + Array* a; + AnyTable* t; + inline Value() : s(NULL) {} + }; + + // Needed so that the destructor knows what is in Value + // and can call its destructor. + Type type; + + /** Always points to memory that is allocated with the Data, so + the destructor does not delete this. */ + Value value; + + std::string comment; + + std::string name; + + /** For STRING, ARRAY and TABLE types, m_value is shared between + multiple instances. Mutation is allowed only if the reference + count is exactly 1, otherwise the mutating instance must copy + the value. This is not used for other types. + */ + AtomicInt32 referenceCount; + + Source source; + + private: + + /** Called by create() */ + inline Data(Type t) : type(t), referenceCount(1) {} + + /** Called by destroy */ + ~Data(); + + public: + + /** Clones the argument */ + static Data* create(const Data* d); + static Data* create(Type t); + + /** Free d, invoking its destructor and freeing the memory for + the value. */ + static void destroy(Data* d); + + }; + + /** If not empty, this Any was created from operator[] on a table + and perhaps was not intended to exist. The name is needed to + format the error message if it is read from before it is + written to. + + The source of a placeholder object is that of the parent + object until it is written. + */ + std::string m_placeholderName; + + Type m_type; + SimpleValue m_simpleValue; + mutable Data* m_data; + + /** Called before every read operation to ensure that this object + is not a placeholder. */ + void beforeRead() const; + + /** Called before every write operation to wipe the placeholder + status. */ + void beforeWrite(); + + /** Decrements the reference count (if there is one). If the + reference count is zero after decrement, calls delete on @a m_data + and sets it to NULL. + */ + void dropReference(); + + /** Allocate the Data object if it does not exist */ + void ensureData(); + + /** If m_data is not NULL, ensure that it has a unique reference + and contains a valid m_data. This has a race condition if two + threads are both trying to modify the same Any + simultaneously.*/ + void ensureMutable(); + + /** Read an unnamed a TABLE or ARRAY. Token should be the open + paren token; it is the next token after the close on + return. Called from deserialize().*/ + void deserializeBody(TextInput& ti, Token& token); + + void deserialize(TextInput& ti, Token& token); + + /** Read the name of a named Array or Table. */ + static void deserializeName(TextInput& ti, Token& token, std::string& name); + + /** Read until a comma is consumed or a close paren is hit, and + return that token. Considers the passed in token to be the first + value read. */ + static void readUntilCommaOrClose(TextInput& ti, Token& token); + + /** Construct an Any that is a proxy for a table fetch from \a data. + This proxy can be copied exactly once on return from operator[].*/ + Any(const std::string& key, Data* data); + + inline bool isPlaceholder() const { + return ! m_placeholderName.empty(); + } + +public: + + /** Base class for all Any exceptions.*/ + class Exception { + public: + virtual ~Exception() {} + }; + + /** Thrown by operator[] when a key is not present in a const table. */ + class KeyNotFound : public ParseError { + public: + std::string key; + }; + + /** Thrown by operator[] when an array index is not present. */ + class IndexOutOfBounds : public Exception { + public: + int index; + int size; + inline IndexOutOfBounds() : index(0), size(0) {} + inline IndexOutOfBounds(int i, int s) : index(i), size(s) {} + }; + + /** NONE constructor */ + Any(); + + /** Deserialize */ + explicit Any(TextInput& t); + + Any(const Any& x); + + /** NUMBER constructor */ + Any(double x); + +#ifdef G3D_32BIT + /** NUMBER constructor */ + Any(int64 x); +#endif // G3D_32BIT + +#if 0 + /** NUMBER constructor */ + Any(int32 x); +#endif // 0 + + /** NUMBER constructor */ + Any(long x); + + /** NUMBER constructor */ + Any(int x); + + /** NUMBER constructor */ + Any(short x); + + /** BOOLEAN constructor */ + Any(bool x); + + /** STRING constructor */ + Any(const std::string& x); + + /** STRING constructor */ + Any(const char* x); + + /** \a t must be ARRAY or TABLE */ + Any(Type t, const std::string& name = ""); + + ~Any(); + + /** Removes the comment and name */ + Any& operator=(const Any& x); + + /** Removes the comment and name */ + Any& operator=(double x); + + /** Removes the comment and name */ + Any& operator=(int x); + + /** Removes the comment and name */ + Any& operator=(bool x); + + /** Removes the comment and name */ + Any& operator=(const std::string& x); + + /** Removes the comment and name */ + Any& operator=(const char* x); + + /** \a t must be ARRAY, TABLE, or NONE. Removes the comment and name */ + Any& operator=(Type t); + + Type type() const; + + /** Same as deserialize or load, but operates on a string instead + of a stream or file. + + \sa deserialize, load + */ + void parse(const std::string& src); + + std::string unparse() const; + + /** Comments appear before values when they are in serialized form.*/ + const std::string& comment() const; + void setComment(const std::string& c); + + /** True if this is the NONE value */ + bool isNone() const; + + /** Throws a ParseError exception if this is not a number */ + double number() const; + const std::string& string() const; + bool boolean() const; + + /** If this is named ARRAY or TABLE, returns the name. */ + const std::string& name() const; + + /** \brief Set the name used when serializing an ARRAY or TABLE. + + Only legal for ARRAY or TABLE. The \a name must begin with a letter + and contain only letters, numbers, underscores and scope operators. + +
+        a2z
+        hello
+        Foo::bar
+        color.red
+        this->that
+        __x
+        
+ + + The scope operators "::", "->", and + ".", may have spaces around them. The name may not + contain parentheses. + */ + void setName(const std::string& name); + + /** Number of elements if this is an ARRAY or TABLE */ + int size() const; + int length() const; + + /** For an array, returns the ith element */ + const Any& operator[](int i) const; + Any& operator[](int i); + + /** Directly exposes the underlying data structure for an ARRAY. */ + const Array& array() const; + void append(const Any& v0); + void append(const Any& v0, const Any& v1); + void append(const Any& v0, const Any& v1, const Any& v2); + void append(const Any& v0, const Any& v1, const Any& v2, const Any& v3); + + /** Directly exposes the underlying data structure for table.*/ + const Table& table() const; + + /** For a table, returns the element for \a key. Throws KeyNotFound + exception if the element does not exist. + */ + const Any& operator[](const std::string& key) const; + + // Needed to prevent the operator[](int) overload from catching + // string literals + inline const Any& operator[](const char* key) const { + return operator[](std::string(key)); + } + + /** + Fetch an element from a table. This can be used as: + +
+        a["key"] = value;  (create the key if it did not exist)
+        
+ + or + +
+        value = a["key"];  (throw an error if the key did not exist)
+        
+ + Note: + In order to cause elements to be correctly created in the + first case while still providing "key not found" errors in the + second case, the Any returned is a special object that delays + the actual fetch until the following assignment or method + call. This means that in the event of an error, the exception + may be thrown from a line other than the actual fetch. Use + the Any::get() or the const Any::operator[]() methods to avoid + this behavior and ensure error-checking at fetch time. + */ + Any& operator[](const std::string& key); + + /** \copydoc Any::operator[](const std::string&) */ + inline Any& operator[](const char* key) { + return operator[](std::string(key)); + } + + /** For a table, returns the element for key \a x and \a + defaultVal if it does not exist. */ + const Any& get(const std::string& key, const Any& defaultVal) const; + + /** Returns true if this key is in the TABLE. Illegal to call on an object that is not a TABLE. */ + bool containsKey(const std::string& key) const; + + /** For a table, assigns the element for key k. */ + void set(const std::string& key, const Any& val); + + /** for an ARRAY, resizes and returns the last element */ + Any& next(); + + + /** True if the Anys are exactly equal, ignoring comments. Applies deeply on arrays and tables. */ + bool operator==(const Any& x) const; + bool operator!=(const Any& x) const; + + operator int() const; + operator float() const; + operator double() const; + operator bool() const; + operator std::string() const; + + /** Resize to \a n elements, where new elements are NIL + It is an error to call this method if this is not an Any::ARRAY */ + void resize(int n); + + /** + Clears all entries. + This must be a TABLE or ARRAY */ + void clear(); + + /** Parse from a file. + \sa deserialize, parse */ + void load(const std::string& filename); + + /** Uses the serialize method. */ + void save(const std::string& filename) const; + + void serialize(TextOutput& to) const; + /** Parse from a stream. + \sa load, parse */ + void deserialize(TextInput& ti); + + const Source& source() const; + + /** Throws a ParseError if \a value is false. Useful for quickly + creating parse rules in classes that deserialize from Any. + */ + void verify(bool value, const std::string& message = "") const; + + /** Verifies that the name begins with identifier \a n. It may contain + identifier operators after this */ + void verifyName(const std::string& n) const; + + /** Verifies that the type is \a t. */ + void verifyType(Type t) const; + + /** Throws an exception if the type is not \a t0 or \a t1. */ + void verifyType(Type t0, Type t1) const; + + /** Verifies that the size is between \a low and \a high, inclusive */ + void verifySize(int low, int high) const; + + /** Verifies that the size is exactly \a s */ + void verifySize(int s) const; + +private: + + void deserializeTable(TextInput& ti); + void deserializeArray(TextInput& ti,const std::string& term); + +}; // class Any + +} // namespace G3D + +#endif diff --git a/externals/g3dlite/G3D/AnyVal.h b/externals/g3dlite/G3D/AnyVal.h new file mode 100644 index 0000000..8c1bc72 --- /dev/null +++ b/externals/g3dlite/G3D/AnyVal.h @@ -0,0 +1,512 @@ +/** + @file AnyVal.h + @author Morgan McGuire + @created 2006-06-11 + @edited 2008-07-14 + */ + +#ifndef G3D_ANYVAL_H +#define G3D_ANYVAL_H + +#include "G3D/platform.h" +#include +#include "G3D/Array.h" +#include "G3D/TextInput.h" + +namespace G3D { +// Forward declarations for G3D types +class Vector2; +class Vector3; +class Vector4; +class Color1; +class Color3; +class Color4; +class Quat; +class Matrix2; +class Matrix3; +class Matrix4; +class CoordinateFrame; +class TextInput; +class TextOutput; +class BinaryInput; +class BinaryOutput; +class Rect2D; +class AABox; + +/** + \deprecated + Use the G3D::Any class instead. This is only provided for + backwards compatibility to G3D 7.xx. + + A generic value, useful for defining property trees that can + be loaded from and saved to disk. The values are intentionally + restricted to a small set. + + When written to files, the syntax is as follows. Note that you can + nest arrays and tables in order to create full tree (i.e., XML-like) + structures as configuration files: + + + + + + + + + + + + + + + + + + + + + + + +
NULLNil
doubleThe number in printf double format
booltrue or false
std::stringThe string in double-quotes (")
Rect2DR(x0,y0,x1,y1)
Color1C1(value)
Color3C3(r,g,b)
Color4C4(r,g,b,a)
Vector2V2(x,y)
Vector3V3(x,y,z)
Vector4V4(x,y,z,w)
QuatV(x,y,z,w)
AABoxAAB(low Vector3, high Vector3)
Matrix2M2(r0c0, r0c1, +
   
r1c0, r1c1)
Matrix3M3(r0c0, r0c1, r0c2, +
   
r1c0, r1c1, r1c2, +
   
r2c0, r2c1, r2c2)
Matrix4M4(r0c0, r0c1, r0c2, r0c3, +
   
r1c0, r1c1, r1c2, r1c3, +
   
r2c0, r2c1, r2c2, r2c3, +
   
r3c0, r3c1, r3c2, r3c3)
CoordinateFrameCF(r0c0, r0c1, r0c2, r0c3, +
   
r1c0, r1c1, r1c2, r1c3, +
   
r2c0, r2c1, r2c2, r2c3)
CoordinateFrameCF(V3(x, y, z), yaw deg, pitch deg, optional roll deg)
Array[element0, element1, ... , elementn-1]
Table{symbol0 = value0 +
 symbol1 = value1 +
 ... +
 symboln-1 = valuen-1}
+ + See also boost::any for a more general purpose but slightly harder to use + "any" for C++. + + The semantics of operator[] and the get() methods are slightly different; + operator[] acts more like a scripting language that automatically extends + arrays and tables instead of generating errors. get() has more strict semantics, + like a C++ class. + + AnyVal uses copy-on-mutate, so that AnyVal a = b semantically copies b (like int a = b would), although in practice + it delays the copy until one is mutated so that it is still fast to "copy" large arrays and tables. + + Reading example: +
+    AnyVal property = AnyVal::fromFile("c:/tmp/test.txt"));
+
+    Vector3 vel = property["angular velocity"]
+
+    Using defaults to handle errors:
+       If there was no "enabled" value, this will return the default instead of failing
+    bool enabled = property["enabled"].boolean(true);
+
+ 
+ + Writing to a file: +
+    AnyVal dict(AnyVal::TABLE);
+
+    dict["enabled"] = AnyVal(true);
+    dict["weight"] = 100;
+    dict["angular velocity"] = Vector3(1, -3, 4.5);
+
+    TextOutput t("c:/tmp/test.txt");
+    dict.serialize(t);
+    t.commit();
+  
+ + Example of a data file: +
+   {
+      heights = [1, 17, 32]
+      model = 
+        {
+           color = C3(1, 1, 1)
+           filename = "foo.md2"
+        }
+      position = V3(23, 14, 0)
+      name = "Elmer"
+   }
+  
+ +

+ What's the difference from boost::any? +
I think that AnyVal will be easier for novice C++ users. It addresses the problem that + even though G3D::TextInput makes reading configuration files extremely simple, many people + still don't use it. So AnyVal makes it ridiculously simple to read and write a tree of G3D + types to a file. + + AnyVal: +

+{
+AnyVal tree(TextInput("config.txt"));
+
+bool enabled = tree.get("enabled", false);
+Vector3 direction = tree.get("direction", Vector3::zero());
+...
+}
+
+ +boost: +
+{
+bool enabled = false;
+Vector3 direction;
+Table tree;
+
+ ...write lots of file parsing code...
+
+   if (tree.containsKey("enabled")) {
+      const boost::any& val = tree["enabled"];
+      try {
+        enabled = any_cast(val);
+      } catch(const boost::bad_any_cast &) {
+      }
+    }
+
+   if (tree.containsKey("direction")) {
+      const boost::any& val = tree["direction"];
+      try {
+        direction = any_cast(val);
+      } catch(const boost::bad_any_cast &) {
+      }
+    }
+   ...
+}
+
+ +\deprecated + */ +class AnyVal { +public: + + /** Array and table values are all Any.*/ + enum Type { + NIL, + NUMBER, + BOOLEAN, + STRING, + VECTOR2, + VECTOR3, + VECTOR4, + MATRIX2, + MATRIX3, + MATRIX4, + QUAT, + COORDINATEFRAME, + COORDINATEFRAME2D, + CFRAME = COORDINATEFRAME, + CFRAME2D = COORDINATEFRAME2D, + COLOR1, + COLOR3, + COLOR4, + RECT2D, + AABOX2D = RECT2D, + AABOX, + ARRAY, + TABLE}; + + /** Base class for all AnyVal exceptions.*/ + class Exception { + public: + virtual ~Exception() {} + }; + + /** Thrown when an inappropriate operation is performed (e.g., operator[] on a number) */ + class WrongType : public Exception { + public: + Type expected; + Type actual; + WrongType() : expected(NIL), actual(NIL) {} + WrongType(Type e, Type a) : expected(e), actual(a) {} + }; + + /** Thrown by operator[] when a key is not present. */ + class KeyNotFound : public Exception { + public: + std::string key; + KeyNotFound() {} + KeyNotFound(const std::string& k) : key(k) {} + }; + + class IndexOutOfBounds : public Exception { + public: + int index; + int size; + IndexOutOfBounds() : index(0), size(0) {} + IndexOutOfBounds(int i, int s) : index(i), size(s) {} + }; + + /** Thrown when deserialize() when the input is incorrectly formatted. */ + class CorruptText : public Exception { + public: + std::string message; + + /** Token where the problem occurred.*/ + G3D::Token token; + + CorruptText() {} + CorruptText(const std::string& s, const G3D::Token& t) : message(s), token(t) {} + }; + +private: + + Type m_type; + void* m_value; + + /** For table and array types, *m_value is shared between multiple + instances. Mutation is allowed only if the reference count is + exactly 1, otherwise the mutating instance must copy the + value. This is not used for other types. + */ + int* m_referenceCount; + + /** Decrements the reference count (if there is one). If the + reference count is zero or does not exist. Calls delete on @a + m_value and sets it to NULL. + */ + void deleteValue(); + + /** Returns a copy of the value. */ + void* copyValue() const; + + /** Assumes isSharedType. Ensures that this has a unique reference */ + void makeMutable(); + + /** True if this is a shared value between multiple instances. */ + inline bool isShared() const { + return m_referenceCount && (*m_referenceCount > 1); + } + + /** True when m_value is a double pointer */ + inline bool isSharedType() const { + return (m_type == TABLE) || (m_type == ARRAY); + } + +public: + + AnyVal(); + + /** Deserialize */ + explicit AnyVal(G3D::TextInput& t); + + static AnyVal fromFile(const std::string& filename); + + void load(const std::string& filename); + + void save(const std::string& filename) const; + + ///** Deserialize */ + //explicit AnyVal(G3D::BinaryInput& t); + + /** Construct a number */ + AnyVal(double); + AnyVal(int); + + // Explicit to avoid ambiguity with the 'double' constructor + // when an integer type is constructed + AnyVal(bool); + AnyVal(const G3D::Vector2&); + AnyVal(const G3D::Vector3&); + AnyVal(const G3D::Vector4&); + + AnyVal(const G3D::Color1&); + AnyVal(const G3D::Color3&); + AnyVal(const G3D::Color4&); + + AnyVal(const std::string&); + AnyVal(const char*); + + AnyVal(const G3D::Quat&); + + AnyVal(const G3D::Rect2D&); + AnyVal(const G3D::AABox&); + + AnyVal(const G3D::CoordinateFrame&); + AnyVal(const G3D::Matrix2&); + AnyVal(const G3D::Matrix3&); + AnyVal(const G3D::Matrix4&); + + AnyVal(const AnyVal&); + + AnyVal(Type arrayOrTable); + + AnyVal& operator=(const AnyVal&); + + /** Frees the underlying storage */ + ~AnyVal(); + + Type type() const; + + bool isNil() const { + return type() == NIL; + } + + void serialize(G3D::TextOutput& t) const; + //void serialize(G3D::BinaryOutput& t) const; + void deserialize(G3D::TextInput& t); + //void deserialize(G3D::BinaryInput& t); + + /** Array dereference. If the index is out of bounds, IndexOutOfBounds is thrown */ + const AnyVal& operator[](int) const; + + /** Extend this array by one element. */ + void append(const AnyVal&); + + /** If the index is out of bounds, the array is resized. If the index is negative, + IndexOutOfBounds is thrown.*/ + AnyVal& operator[](int); + + /** If @a i is out of bounds or this is not an ARRAY, defaultVal is returned.*/ + const AnyVal& get(int i, const AnyVal& defaultVal) const; + + /** If out of bounds, IndexOutOfBounds is thrown. */ + const AnyVal& get(int i) const; + + /** Returns defaultVal if this is not a TABLE or the key is not found. */ + const AnyVal& get(const std::string& key, const AnyVal& defaultVal) const; + + /** Throws KeyNotFound exception if the key is not present.*/ + const AnyVal& get(const std::string& key) const; + + /** Table reference */ + const AnyVal& operator[](const std::string&) const; + + /** Table reference. If the element does not exist, it is created. */ + AnyVal& operator[](const std::string&); + + /** Table reference */ + const AnyVal& operator[](const char*) const; + + /** Table reference. If the element does not exist, it is created. */ + AnyVal& operator[](const char*); + + /** If this value is not a number throws a WrongType exception. */ + double number() const; + + /** If this value is not a number, returns defaultVal. */ + double number(double defaultVal) const; + + operator double () const { + return number(); + } + + operator float () const { + return (float)number(); + } + + bool boolean() const; + bool boolean(bool b) const; + + operator bool() const { + return boolean(); + } + + const std::string& string() const; + const std::string& string(const std::string& defaultVal) const; + + operator const std::string& () const { + return string(); + } + + const G3D::Rect2D& rect2D() const; + const G3D::Rect2D& rect2D(const G3D::Rect2D& defaultVal) const; + + operator const Rect2D& () const { + return rect2D(); + } + + const G3D::AABox& aabox() const; + const G3D::AABox& aabox(const G3D::AABox& defaultVal) const; + + operator const AABox& () const { + return aabox(); + } + + const G3D::Vector2& vector2() const; + const G3D::Vector2& vector2(const G3D::Vector2& defaultVal) const; + + operator const Vector2& () const { + return vector2(); + } + + const G3D::Vector3& vector3() const; + const G3D::Vector3& vector3(const G3D::Vector3& defaultVal) const; + + operator const Vector3& () { + return vector3(); + } + + const G3D::Vector4& vector4() const; + const G3D::Vector4& vector4(const G3D::Vector4& defaultVal) const; + + operator const Vector4& () const { + return vector4(); + } + + const G3D::Color1& color1() const; + const G3D::Color1& color1(const G3D::Color1& defaultVal) const; + + const G3D::Color3& color3() const; + const G3D::Color3& color3(const G3D::Color3& defaultVal) const; + + operator const Color3& () const { + return color3(); + } + + const G3D::Color4& color4() const; + const G3D::Color4& color4(const G3D::Color4& defaultVal) const; + + operator const Color4& () const { + return color4(); + } + + const G3D::CoordinateFrame& coordinateFrame() const; + const G3D::CoordinateFrame& coordinateFrame(const G3D::CoordinateFrame& defaultVal) const; + + operator const CoordinateFrame& () const { + return coordinateFrame(); + } + + const G3D::Matrix2& matrix2() const; + const G3D::Matrix2& matrix2(const G3D::Matrix2& defaultVal) const; + + operator const Matrix2& () const { + return matrix2(); + } + + const G3D::Matrix3& matrix3() const; + const G3D::Matrix3& matrix3(const G3D::Matrix3& defaultVal) const; + + operator const Matrix3& () const { + return matrix3(); + } + + const G3D::Matrix4& matrix4() const; + const G3D::Matrix4& matrix4(const G3D::Matrix4& defaultVal) const; + + operator const Matrix4& () const { + return matrix4(); + } + + const G3D::Quat& quat() const; + const G3D::Quat& quat(const G3D::Quat& defaultVal) const; + + operator const Quat& () const { + return quat(); + } + + std::string toString() const; + + /** Number of elements for an array or table.*/ + int size() const; + + /** For a table, returns the keys. */ + void getKeys(G3D::Array&) const; +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/AreaMemoryManager.h b/externals/g3dlite/G3D/AreaMemoryManager.h new file mode 100644 index 0000000..d8d8f71 --- /dev/null +++ b/externals/g3dlite/G3D/AreaMemoryManager.h @@ -0,0 +1,93 @@ +/** + @file AreaMemoryManager.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2009-01-20 + @edited 2009-05-29 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + + +#ifndef G3D_AreaMemoryManager_h +#define G3D_AreaMemoryManager_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Array.h" +#include "G3D/MemoryManager.h" + +namespace G3D { + +/** + \brief Allocates memory in large blocks and then frees it as an area. + + Useful for ensuring cache coherence and for reducing the time cost of + multiple allocations and deallocations. + + Not threadsafe + */ +class AreaMemoryManager : public MemoryManager { +private: + + class Buffer { + private: + uint8* m_first; + size_t m_size; + size_t m_used; + + public: + + Buffer(size_t size); + + ~Buffer(); + + /** Returns NULL if out of space */ + void* alloc(size_t s); + }; + + size_t m_sizeHint; + + /** The underlying array is stored in regular MemoryManager heap memory */ + Array m_bufferArray; + + AreaMemoryManager(size_t sizeHint); + +public: + + typedef ReferenceCountedPointer Ref; + + /** + \param sizeHint Total amount of memory expected to be allocated. + The allocator will allocate memory from the system in increments + of this size. + */ + static AreaMemoryManager::Ref create(size_t sizeHint = 10 * 1024 * 1024); + + /** Invokes deallocateAll. */ + ~AreaMemoryManager(); + + size_t bytesAllocated() const; + + /** Allocates memory out of the buffer pool. + @param s must be no larger than sizeHint */ + virtual void* alloc(size_t s); + + /** Ignored. */ + virtual void free(void* x); + + virtual bool isThreadsafe() const; + + /** Deletes all previously allocated memory. Because delete is not + invoked on objects in this memory, it is not safe to simply + free memory containing C++ objects that expect their destructors + to be called. */ + void deallocateAll(); +}; + +typedef AreaMemoryManager CoherentAllocator; +} + +#endif diff --git a/externals/g3dlite/G3D/Array.h b/externals/g3dlite/G3D/Array.h new file mode 100644 index 0000000..cc9e1d9 --- /dev/null +++ b/externals/g3dlite/G3D/Array.h @@ -0,0 +1,1274 @@ +/** + @file Array.h + + @maintainer Morgan McGuire, graphics3d.com + @cite Portions written by Aaron Orenstein, a@orenstein.name + + @created 2001-03-11 + @edited 2009-05-29 + + Copyright 2000-2009, Morgan McGuire, http://graphics.cs.williams.edu + All rights reserved. + */ + +#ifndef G3D_Array_h +#define G3D_Array_h + +#include "G3D/platform.h" +#include "G3D/debug.h" +#include "G3D/System.h" +#include "G3D/MemoryManager.h" +#ifdef G3D_DEBUG +// For formatting error messages +# include "G3D/format.h" +#endif +#include +#include + +#ifdef _MSC_VER +# include + +# pragma warning (push) + // debug information too long +# pragma warning( disable : 4312) +# pragma warning( disable : 4786) +#endif + + +namespace G3D { + +/** + Constant for passing to Array::resize + */ +const bool DONT_SHRINK_UNDERLYING_ARRAY = false; + +/** Constant for Array::sort */ +const int SORT_INCREASING = 1; +/** Constant for Array::sort */ +const int SORT_DECREASING = -1; + +/** + \brief Dynamic 1D array tuned for performance. + + Objects must have a default constructor (constructor that + takes no arguments) in order to be used with this template. + You will get the error "no appropriate default constructor found" + if they do not. + + Do not use with objects that overload placement operator new, + since the speed of Array is partly due to pooled allocation. + + Array is highly optimized compared to std::vector. + Array operations are less expensive than on std::vector and for large + amounts of data, Array consumes only 1.5x the total size of the + data, while std::vector consumes 2.0x. The default + array takes up zero heap space. The first resize (or append) + operation grows it to a reasonable internal size so it is efficient + to append to small arrays. + + Then Array needs to copy + data internally on a resize operation it correctly invokes copy + constructors of the elements (the MSVC6 implementation of + std::vector uses realloc, which can create memory leaks for classes + containing references and pointers). Array provides a guaranteed + safe way to access the underlying data as a flat C array -- + Array::getCArray. Although (T*)std::vector::begin() can be used for + this purpose, it is not guaranteed to succeed on all platforms. + + To serialize an array, see G3D::serialize. + + The template parameter MIN_ELEMENTS indicates the smallest number of + elements that will be allocated. The default of 10 is designed to avoid + the overhead of repeatedly allocating the array as it grows from 1, to 2, and so on. + If you are creating a lot of small Arrays, however, you may want to set this smaller + to reduce the memory cost. Once the array has been allocated, it will never + deallocate the underlying array unless MIN_ELEMENTS is set to 0, MIN_BYTES is 0, and the array + is empty. + + Do not subclass an Array. + + \sa G3D::SmallArray + */ +template +class Array { +private: + /** 0...num-1 are initialized elements, num...numAllocated-1 are not */ + T* data; + + int num; + int numAllocated; + + MemoryManager::Ref m_memoryManager; + + /** \param n Number of elements + */ + void init(int n, const MemoryManager::Ref& m) { + m_memoryManager = m; + debugAssert(n >= 0); + this->num = 0; + this->numAllocated = 0; + data = NULL; + if (n > 0) { + resize(n); + } else { + data = NULL; + } + } + + void _copy(const Array &other) { + init(other.num, MemoryManager::create()); + for (int i = 0; i < num; i++) { + data[i] = other.data[i]; + } + } + + /** + Returns true iff address points to an element of this array. + Used by append. + */ + inline bool inArray(const T* address) { + return (address >= data) && (address < data + num); + } + + + /** Only compiled if you use the sort procedure. */ + static bool __cdecl compareGT(const T& a, const T& b) { + return a > b; + } + + + /** + Allocates a new array of size numAllocated (not a parameter to the method) + and then copies at most oldNum elements from the old array to it. Destructors are + called for oldNum elements of the old array. + */ + void realloc(int oldNum) { + T* oldData = data; + + // The allocation is separate from the constructor invocation because we don't want + // to pay for the cost of constructors until the newly allocated + // elements are actually revealed to the application. They + // will be constructed in the resize() method. + + data = (T*)m_memoryManager->alloc(sizeof(T) * numAllocated); + alwaysAssertM(data, "Memory manager returned NULL: out of memory?"); + + // Call the copy constructors + {const int N = G3D::min(oldNum, numAllocated); + const T* end = data + N; + T* oldPtr = oldData; + for (T* ptr = data; ptr < end; ++ptr, ++oldPtr) { + + // Use placement new to invoke the constructor at the location + // that we determined. Use the copy constructor to make the assignment. + const T* constructed = new (ptr) T(*oldPtr); + + (void)constructed; + debugAssertM(constructed == ptr, + "new returned a different address than the one provided by Array."); + }} + + // Call destructors on the old array (if there is no destructor, this will compile away) + {const T* end = oldData + oldNum; + for (T* ptr = oldData; ptr < end; ++ptr) { + ptr->~T(); + }} + + m_memoryManager->free(oldData); + } + +public: + + /** + G3D C++ STL style iterator variable. Call begin() to get + the first iterator, pre-increment (++i) the iterator to get to + the next value. Use dereference (*i) to access the element. + */ + typedef T* Iterator; + /** G3D C++ STL style const iterator in same style as Iterator. */ + typedef const T* ConstIterator; + + /** stl porting compatibility helper */ + typedef Iterator iterator; + /** stl porting compatibility helper */ + typedef ConstIterator const_iterator; + /** stl porting compatibility helper */ + typedef T value_type; + /** stl porting compatibility helper */ + typedef int size_type; + /** stl porting compatibility helper */ + typedef int difference_type; + + /** + C++ STL style iterator method. Returns the first iterator element. + Do not change the size of the array while iterating. + */ + Iterator begin() { + return data; + } + + ConstIterator begin() const { + return data; + } + /** + C++ STL style iterator method. Returns one after the last iterator + element. + */ + ConstIterator end() const { + return data + num; + } + + Iterator end() { + return data + num; + } + + /** + The array returned is only valid until the next append() or resize call, or + the Array is deallocated. + */ + T* getCArray() { + return data; + } + + /** + The array returned is only valid until the next append() or resize call, or + the Array is deallocated. + */ + const T* getCArray() const { + return data; + } + + /** Creates a zero length array (no heap allocation occurs until resize). */ + Array() : num(0) { + init(0, MemoryManager::create()); + debugAssert(num >= 0); + } + + + /** Creates an array containing v0. */ + Array(const T& v0) { + init(1, MemoryManager::create()); + (*this)[0] = v0; + } + + /** Creates an array containing v0 and v1. */ + Array(const T& v0, const T& v1) { + init(2, MemoryManager::create()); + (*this)[0] = v0; + (*this)[1] = v1; + } + + /** Creates an array containing v0...v2. */ + Array(const T& v0, const T& v1, const T& v2) { + init(3, MemoryManager::create()); + (*this)[0] = v0; + (*this)[1] = v1; + (*this)[2] = v2; + } + + /** Creates an array containing v0...v3. */ + Array(const T& v0, const T& v1, const T& v2, const T& v3) { + init(4, MemoryManager::create()); + (*this)[0] = v0; + (*this)[1] = v1; + (*this)[2] = v2; + (*this)[3] = v3; + } + + /** Creates an array containing v0...v4. */ + Array(const T& v0, const T& v1, const T& v2, const T& v3, const T& v4) { + init(5, MemoryManager::create()); + (*this)[0] = v0; + (*this)[1] = v1; + (*this)[2] = v2; + (*this)[3] = v3; + (*this)[4] = v4; + } + + + /** + Copy constructor + */ + Array(const Array& other) : num(0) { + _copy(other); + debugAssert(num >= 0); + } + + /** + Destructor does not delete() the objects if T is a pointer type + (e.g. T = int*) instead, it deletes the pointers themselves and + leaves the objects. Call deleteAll if you want to dealocate + the objects referenced. Do not call deleteAll if T is not a pointer + type (e.g. do call Array::deleteAll, do not call Array::deleteAll). + */ + ~Array() { + // Invoke the destructors on the elements + for (int i = 0; i < num; i++) { + (data + i)->~T(); + } + + m_memoryManager->free(data); + // Set to 0 in case this Array is global and gets referenced during app exit + data = NULL; + num = 0; + numAllocated = 0; + } + + /** + Removes all elements. Use resize(0, false) or fastClear if you want to + remove all elements without deallocating the underlying array + so that future append() calls will be faster. + */ + void clear(bool shrink = true) { + resize(0, shrink); + } + + void clearAndSetMemoryManager(const MemoryManager::Ref& m) { + clear(); + debugAssert(data == NULL); + m_memoryManager = m; + } + + /** resize(0, false) + @deprecated*/ + void fastClear() { + clear(false); + } + + /** + Assignment operator. + */ + Array& operator=(const Array& other) { + debugAssert(num >= 0); + resize(other.num); for (int i = 0; i < num; ++i) { + data[i] = other[i]; + } + debugAssert(num >= 0); + return *this; + } + + Array& operator=(const std::vector& other) { + resize((int)other.size()); + for (int i = 0; i < num; ++i) { + data[i] = other[i]; + } + return *this; + } + + inline MemoryManager::Ref memoryManager() const { + return m_memoryManager; + } + + /** + Number of elements in the array. + */ + inline int size() const { + return num; + } + + /** + Number of elements in the array. (Same as size; this is just + here for convenience). + */ + inline int length() const { + return size(); + } + + /** + Swaps element index with the last element in the array then + shrinks the array by one. + */ + void fastRemove(int index, bool shrinkIfNecessary = false) { + debugAssert(index >= 0); + debugAssert(index < num); + data[index] = data[num - 1]; + resize(size() - 1, shrinkIfNecessary); + } + + + /** + Inserts at the specified index and shifts all other elements up by one. + */ + void insert(int n, const T& value) { + // Add space for the extra element + resize(num + 1, false); + + for (int i = num - 1; i > n; --i) { + data[i] = data[i - 1]; + } + data[n] = value; + } + + /** @param shrinkIfNecessary if false, memory will never be + reallocated when the array shrinks. This makes resizing much + faster but can waste memory. + */ + void resize(int n, bool shrinkIfNecessary = true) { + debugAssert(n >= 0); + if (num == n) { + return; + } + + int oldNum = num; + num = n; + + // Call the destructors on newly hidden elements if there are any + for (int i = num; i < oldNum; ++i) { + (data + i)->~T(); + } + + // Once allocated, always maintain MIN_ELEMENTS elements or 32 bytes, whichever is higher. + const int minSize = std::max(MIN_ELEMENTS, (int)(MIN_BYTES / sizeof(T))); + + if ((MIN_ELEMENTS == 0) && (MIN_BYTES == 0) && (n == 0) && shrinkIfNecessary) { + // Deallocate the array completely + numAllocated = 0; + m_memoryManager->free(data); + data = NULL; + return; + } + + if (num > numAllocated) { + // Grow the underlying array + + if (numAllocated == 0) { + // First allocation; grow to exactly the size requested to avoid wasting space. + numAllocated = n; + debugAssert(oldNum == 0); + realloc(oldNum); + } else { + + if (num < minSize) { + // Grow to at least the minimum size + numAllocated = minSize; + + } else { + + // Increase the underlying size of the array. Grow aggressively + // up to 64k, less aggressively up to 400k, and then grow relatively + // slowly (1.5x per resize) to avoid excessive space consumption. + // + // These numbers are tweaked according to performance tests. + + float growFactor = 3.0; + + int oldSizeBytes = numAllocated * sizeof(T); + if (oldSizeBytes > 400000) { + // Avoid bloat + growFactor = 1.5; + } else if (oldSizeBytes > 64000) { + // This is what std:: uses at all times + growFactor = 2.0; + } + + numAllocated = (num - numAllocated) + (int)(numAllocated * growFactor); + + if (numAllocated < minSize) { + numAllocated = minSize; + } + } + + realloc(oldNum); + } + + } else if ((num <= numAllocated / 3) && shrinkIfNecessary && (num > minSize)) { + // Shrink the underlying array + + // Only copy over old elements that still remain after resizing + // (destructors were called for others if we're shrinking) + realloc(iMin(num, oldNum)); + + } + + // Call the constructors on newly revealed elements. + // Do not use parens because we don't want the intializer + // invoked for POD types. + for (int i = oldNum; i < num; ++i) { + new (data + i) T; + } + } + + /** + Add an element to the end of the array. Will not shrink the underlying array + under any circumstances. It is safe to append an element that is already + in the array. + */ + inline void append(const T& value) { + + if (num < numAllocated) { + // This is a simple situation; just stick it in the next free slot using + // the copy constructor. + new (data + num) T(value); + ++num; + } else if (inArray(&value)) { + // The value was in the original array; resizing + // is dangerous because it may move the value + // we have a reference to. + T tmp = value; + append(tmp); + } else { + // Here we run the empty initializer where we don't have to, but + // this simplifies the computation. + resize(num + 1, DONT_SHRINK_UNDERLYING_ARRAY); + data[num - 1] = value; + } + } + + + inline void append(const T& v1, const T& v2) { + if (inArray(&v1) || inArray(&v2)) { + // Copy into temporaries so that the references won't break when + // the array resizes. + T t1 = v1; + T t2 = v2; + append(t1, t2); + } else if (num + 1 < numAllocated) { + // This is a simple situation; just stick it in the next free slot using + // the copy constructor. + new (data + num) T(v1); + new (data + num + 1) T(v2); + num += 2; + } else { + // Resize the array. Note that neither value is already in the array. + resize(num + 2, DONT_SHRINK_UNDERLYING_ARRAY); + data[num - 2] = v1; + data[num - 1] = v2; + } + } + + + inline void append(const T& v1, const T& v2, const T& v3) { + if (inArray(&v1) || inArray(&v2) || inArray(&v3)) { + T t1 = v1; + T t2 = v2; + T t3 = v3; + append(t1, t2, t3); + } else if (num + 2 < numAllocated) { + // This is a simple situation; just stick it in the next free slot using + // the copy constructor. + new (data + num) T(v1); + new (data + num + 1) T(v2); + new (data + num + 2) T(v3); + num += 3; + } else { + resize(num + 3, DONT_SHRINK_UNDERLYING_ARRAY); + data[num - 3] = v1; + data[num - 2] = v2; + data[num - 1] = v3; + } + } + + + inline void append(const T& v1, const T& v2, const T& v3, const T& v4) { + if (inArray(&v1) || inArray(&v2) || inArray(&v3) || inArray(&v4)) { + T t1 = v1; + T t2 = v2; + T t3 = v3; + T t4 = v4; + append(t1, t2, t3, t4); + } else if (num + 3 < numAllocated) { + // This is a simple situation; just stick it in the next free slot using + // the copy constructor. + new (data + num) T(v1); + new (data + num + 1) T(v2); + new (data + num + 2) T(v3); + new (data + num + 3) T(v4); + num += 4; + } else { + resize(num + 4, DONT_SHRINK_UNDERLYING_ARRAY); + data[num - 4] = v1; + data[num - 3] = v2; + data[num - 2] = v3; + data[num - 1] = v4; + } + } + + /** + Returns true if the given element is in the array. + */ + bool contains(const T& e) const { + for (int i = 0; i < size(); ++i) { + if ((*this)[i] == e) { + return true; + } + } + + return false; + } + + /** + Append the elements of array. Cannot be called with this array + as an argument. + */ + void append(const Array& array) { + debugAssert(this != &array); + int oldNum = num; + int arrayLength = array.length(); + + resize(num + arrayLength, false); + + for (int i = 0; i < arrayLength; i++) { + data[oldNum + i] = array.data[i]; + } + } + + /** + Pushes a new element onto the end and returns its address. + This is the same as A.resize(A.size() + 1, false); A.last() + */ + inline T& next() { + resize(num + 1, false); + return last(); + } + + /** + Pushes an element onto the end (appends) + */ + inline void push(const T& value) { + append(value); + } + + inline void push(const Array& array) { + append(array); + } + + /** Alias to provide std::vector compatibility */ + inline void push_back(const T& v) { + push(v); + } + + /** "The member function removes the last element of the controlled sequence, which must be non-empty." + For compatibility with std::vector. */ + inline void pop_back() { + pop(); + } + + /** + "The member function returns the storage currently allocated to hold the controlled + sequence, a value at least as large as size()" + For compatibility with std::vector. + */ + int capacity() const { + return numAllocated; + } + + /** + "The member function returns a reference to the first element of the controlled sequence, + which must be non-empty." + For compatibility with std::vector. + */ + T& front() { + return (*this)[0]; + } + + /** + "The member function returns a reference to the first element of the controlled sequence, + which must be non-empty." + For compatibility with std::vector. + */ + const T& front() const { + return (*this)[0]; + } + + /** + "The member function returns a reference to the last element of the controlled sequence, + which must be non-empty." + For compatibility with std::vector. + */ + T& back() { + return (*this)[size()-1]; + } + + /** + "The member function returns a reference to the last element of the controlled sequence, + which must be non-empty." + For compatibility with std::vector. + */ + const T& back() const { + return (*this)[size()-1]; + } + + /** + Removes the last element and returns it. By default, shrinks the underlying array. + */ + inline T pop(bool shrinkUnderlyingArrayIfNecessary = true) { + debugAssert(num > 0); + T temp = data[num - 1]; + resize(num - 1, shrinkUnderlyingArrayIfNecessary); + return temp; + } + + /** Pops the last element and discards it without returning anything. Faster than pop. + By default, does not shrink the underlying array.*/ + inline void popDiscard(bool shrinkUnderlyingArrayIfNecessary = false) { + debugAssert(num > 0); + resize(num - 1, shrinkUnderlyingArrayIfNecessary); + } + + + /** + "The member function swaps the controlled sequences between *this and str." + Note that this is slower than the optimal std implementation. + + For compatibility with std::vector. + */ + void swap(Array& str) { + Array temp = str; + str = *this; + *this = temp; + } + + + /** + Performs bounds checks in debug mode + */ + inline T& operator[](int n) { + debugAssertM((n >= 0) && (n < num), format("Array index out of bounds. n = %d, size() = %d", n, num)); + debugAssert(data!=NULL); + return data[n]; + } + + inline T& operator[](unsigned int n) { + debugAssertM(n < (unsigned int)num, format("Array index out of bounds. n = %d, size() = %d", n, num)); + return data[n]; + } + + /** + Performs bounds checks in debug mode + */ + inline const T& operator[](int n) const { + debugAssert((n >= 0) && (n < num)); + debugAssert(data!=NULL); + return data[n]; + } + + inline const T& operator[](unsigned int n) const { + debugAssert((n < (unsigned int)num)); + debugAssert(data!=NULL); + return data[n]; + } + + inline T& randomElement() { + debugAssert(num > 0); + debugAssert(data!=NULL); + return data[iRandom(0, num - 1)]; + } + + inline const T& randomElement() const { + debugAssert(num > 0); + debugAssert(data!=NULL); + return data[iRandom(0, num - 1)]; + } + + /** + Returns the last element, performing a check in + debug mode that there is at least one element. + */ + inline const T& last() const { + debugAssert(num > 0); + debugAssert(data!=NULL); + return data[num - 1]; + } + + /** Returns element lastIndex() */ + inline T& last() { + debugAssert(num > 0); + debugAssert(data!=NULL); + return data[num - 1]; + } + + /** Returns size() - 1 */ + inline int lastIndex() const { + debugAssertM(num > 0, "Array is empty"); + return num - 1; + } + + inline int firstIndex() const { + debugAssertM(num > 0, "Array is empty"); + return 0; + } + + /** Returns element firstIndex(), performing a check in debug mode to ensure that there is at least one */ + inline T& first() { + debugAssertM(num > 0, "Array is empty"); + return data[0]; + } + + inline const T& first() const { + debugAssertM(num > 0, "Array is empty"); + return data[0]; + } + + /** Returns iFloor(size() / 2), throws an assertion in debug mode if the array is empty */ + inline int middleIndex() const { + debugAssertM(num > 0, "Array is empty"); + return num >> 1; + } + + /** Returns element middleIndex() */ + inline const T& middle() const { + debugAssertM(num > 0, "Array is empty"); + return data[num >> 1]; + } + + /** Returns element middleIndex() */ + inline T& middle() { + debugAssertM(num > 0, "Array is empty"); + return data[num >> 1]; + } + + /** + Calls delete on all objects[0...size-1] + and sets the size to zero. + */ + void deleteAll() { + for (int i = 0; i < num; i++) { + delete data[i]; + } + resize(0); + } + + /** + Returns the index of (the first occurance of) an index or -1 if + not found. Searches from the right. + */ + int rfindIndex(const T& value) const { + for (int i = num -1 ; i >= 0; --i) { + if (data[i] == value) { + return i; + } + } + return -1; + } + + /** + Returns the index of (the first occurance of) an index or -1 if + not found. + */ + int findIndex(const T& value) const { + for (int i = 0; i < num; ++i) { + if (data[i] == value) { + return i; + } + } + return -1; + } + + /** + Finds an element and returns the iterator to it. If the element + isn't found then returns end(). + */ + Iterator find(const T& value) { + for (int i = 0; i < num; ++i) { + if (data[i] == value) { + return data + i; + } + } + return end(); + } + + ConstIterator find(const T& value) const { + for (int i = 0; i < num; ++i) { + if (data[i] == value) { + return data + i; + } + } + return end(); + } + + /** + Removes count elements from the array + referenced either by index or Iterator. + */ + void remove(Iterator element, int count = 1) { + debugAssert((element >= begin()) && (element < end())); + debugAssert((count > 0) && (element + count) <= end()); + Iterator last = end() - count; + + while(element < last) { + element[0] = element[count]; + ++element; + } + + resize(num - count); + } + + void remove(int index, int count = 1) { + debugAssert((index >= 0) && (index < num)); + debugAssert((count > 0) && (index + count <= num)); + + remove(begin() + index, count); + } + + /** + Reverse the elements of the array in place. + */ + void reverse() { + T temp; + + int n2 = num / 2; + for (int i = 0; i < n2; ++i) { + temp = data[num - 1 - i]; + data[num - 1 - i] = data[i]; + data[i] = temp; + } + } + + /** + Sort using a specific less-than function, e.g.: + +
+    bool __cdecl myLT(const MyClass& elem1, const MyClass& elem2) {
+        return elem1.x < elem2.x;
+    }
+    
+ + Note that for pointer arrays, the const must come + after the class name, e.g., Array uses: + +
+    bool __cdecl myLT(MyClass*const& elem1, MyClass*const& elem2) {
+        return elem1->x < elem2->x;
+    }
+    
+ + or a functor, e.g., +
+bool
+less_than_functor::operator()( const double& lhs, const double& rhs ) const
+{
+return( lhs < rhs? true : false );
+}
+
+ */ + // void sort(bool (__cdecl *lessThan)(const T& elem1, const T& elem2)) { + // std::sort(data, data + num, lessThan); + //} + template + void sort(const LessThan& lessThan) { + // Using std::sort, which according to http://www.open-std.org/JTC1/SC22/WG21/docs/D_4.cpp + // was 2x faster than qsort for arrays around size 2000 on intel core2 with gcc + std::sort(data, data + num, lessThan); + } + + /** + Sorts the array in increasing order using the > or < operator. To + invoke this method on Array, T must override those operator. + You can overide these operators as follows: + + bool T::operator>(const T& other) const { + return ...; + } + bool T::operator<(const T& other) const { + return ...; + } + + */ + void sort(int direction = SORT_INCREASING) { + if (direction == SORT_INCREASING) { + std::sort(data, data + num); + } else { + std::sort(data, data + num, compareGT); + } + } + + /** + Sorts elements beginIndex through and including endIndex. + */ + void sortSubArray(int beginIndex, int endIndex, int direction = SORT_INCREASING) { + if (direction == SORT_INCREASING) { + std::sort(data + beginIndex, data + endIndex + 1); + } else { + std::sort(data + beginIndex, data + endIndex + 1, compareGT); + } + } + + void sortSubArray(int beginIndex, int endIndex, bool (__cdecl *lessThan)(const T& elem1, const T& elem2)) { + std::sort(data + beginIndex, data + endIndex + 1, lessThan); + } + + /** + The StrictWeakOrdering can be either a class that overloads the function call operator() or + a function pointer of the form bool (__cdecl *lessThan)(const T& elem1, const T& elem2) + */ + template + void sortSubArray(int beginIndex, int endIndex, StrictWeakOrdering& lessThan) { + std::sort(data + beginIndex, data + endIndex + 1, lessThan); + } + + /** Uses < and == to evaluate operator(); this is the default comparator for Array::partition. */ + class DefaultComparator { + public: + inline int operator()(const T& A, const T& B) const { + if (A < B) { + return 1; + } else if (A == B) { + return 0; + } else { + return -1; + } + } + }; + + /** The output arrays are resized with fastClear() so that if they are already of the same size + as this array no memory is allocated during partitioning. + + @param comparator A function, or class instance with an overloaded operator() that compares + two elements of type T and returns 0 if they are equal, -1 if the second is smaller, + and 1 if the first is smaller (i.e., following the conventions of std::string::compare). For example: + +
+        int compare(int A, int B) {
+            if (A < B) {
+                return 1;
+            } else if (A == B) {
+                return 0;
+            } else {
+                return -1;
+            }
+        }
+        
+ */ + template + void partition( + const T& partitionElement, + Array& ltArray, + Array& eqArray, + Array& gtArray, + const Comparator& comparator) const { + + // Make sure all arrays are independent + debugAssert(<Array != this); + debugAssert(&eqArray != this); + debugAssert(>Array != this); + debugAssert(<Array != &eqArray); + debugAssert(<Array != >Array); + debugAssert(&eqArray != >Array); + + // Clear the arrays + ltArray.fastClear(); + eqArray.fastClear(); + gtArray.fastClear(); + + // Form a table of buckets for lt, eq, and gt + Array* bucket[3] = {<Array, &eqArray, >Array}; + + for (int i = 0; i < num; ++i) { + int c = comparator(partitionElement, data[i]); + debugAssertM(c >= -1 && c <= 1, "Comparator returned an illegal value."); + + // Insert into the correct bucket, 0, 1, or 2 + bucket[c + 1]->append(data[i]); + } + } + + /** + Uses < and == on elements to perform a partition. See partition(). + */ + void partition( + const T& partitionElement, + Array& ltArray, + Array& eqArray, + Array& gtArray) const { + + partition(partitionElement, ltArray, eqArray, gtArray, typename Array::DefaultComparator()); + } + + /** + Paritions the array into those below the median, those above the median, and those elements + equal to the median in expected O(n) time using quickselect. If the array has an even + number of different elements, the median for partition purposes is the largest value + less than the median. + + @param tempArray used for working scratch space + @param comparator see parition() for a discussion.*/ + template + void medianPartition( + Array& ltMedian, + Array& eqMedian, + Array& gtMedian, + Array& tempArray, + const Comparator& comparator) const { + + ltMedian.fastClear(); + eqMedian.fastClear(); + gtMedian.fastClear(); + + // Handle trivial cases first + switch (size()) { + case 0: + // Array is empty; no parition is possible + return; + + case 1: + // One element + eqMedian.append(first()); + return; + + case 2: + { + // Two element array; median is the smaller + int c = comparator(first(), last()); + + switch (c) { + case -1: + // first was bigger + eqMedian.append(last()); + gtMedian.append(first()); + break; + + case 0: + // Both equal to the median + eqMedian.append(first(), last()); + break; + + case 1: + // Last was bigger + eqMedian.append(first()); + gtMedian.append(last()); + break; + } + } + return; + } + + // All other cases use a recursive randomized median + + // Number of values less than all in the current arrays + int ltBoost = 0; + + // Number of values greater than all in the current arrays + int gtBoost = 0; + + // For even length arrays, force the gt array to be one larger than the + // lt array: + // [1 2 3] size = 3, choose half = (s + 1) /2 + // + int lowerHalfSize, upperHalfSize; + if (isEven(size())) { + lowerHalfSize = size() / 2; + upperHalfSize = lowerHalfSize + 1; + } else { + lowerHalfSize = upperHalfSize = (size() + 1) / 2; + } + const T* xPtr = NULL; + + // Maintain pointers to the arrays; we'll switch these around during sorting + // to avoid copies. + const Array* source = this; + Array* lt = <Median; + Array* eq = &eqMedian; + Array* gt = >Median; + Array* extra = &tempArray; + + while (true) { + // Choose a random element -- choose the middle element; this is theoretically + // suboptimal, but for loosly sorted array is actually the best strategy + + xPtr = &(source->middle()); + if (source->size() == 1) { + // Done; there's only one element left + break; + } + const T& x = *xPtr; + + // Note: partition (fast) clears the arrays for us + source->partition(x, *lt, *eq, *gt, comparator); + + int L = lt->size() + ltBoost + eq->size(); + int U = gt->size() + gtBoost + eq->size(); + if ((L >= lowerHalfSize) && + (U >= upperHalfSize)) { + + // x must be the partition median + break; + + } else if (L < lowerHalfSize) { + + // x must be smaller than the median. Recurse into the 'gt' array. + ltBoost += lt->size() + eq->size(); + + // The new gt array will be the old source array, unless + // that was the this pointer (i.e., unless we are on the + // first iteration) + Array* newGt = (source == this) ? extra : const_cast*>(source); + + // Now set up the gt array as the new source + source = gt; + gt = newGt; + + } else { + + // x must be bigger than the median. Recurse into the 'lt' array. + gtBoost += gt->size() + eq->size(); + + // The new lt array will be the old source array, unless + // that was the this pointer (i.e., unless we are on the + // first iteration) + Array* newLt = (source == this) ? extra : const_cast*>(source); + + // Now set up the lt array as the new source + source = lt; + lt = newLt; + } + } + + // Now that we know the median, make a copy of it (since we're about to destroy the array that it + // points into). + T median = *xPtr; + xPtr = NULL; + + // Partition the original array (note that this fast clears for us) + partition(median, ltMedian, eqMedian, gtMedian, comparator); + } + + /** + Computes a median partition using the default comparator and a dynamically allocated temporary + working array. If the median is not in the array, it is chosen to be the largest value smaller + than the true median. + */ + void medianPartition( + Array& ltMedian, + Array& eqMedian, + Array& gtMedian) const { + + Array temp; + medianPartition(ltMedian, eqMedian, gtMedian, temp, DefaultComparator()); + } + + + /** Redistributes the elements so that the new order is statistically independent + of the original order. O(n) time.*/ + void randomize() { + T temp; + + for (int i = size() - 1; i >= 0; --i) { + int x = iRandom(0, i); + + temp = data[i]; + data[i] = data[x]; + data[x] = temp; + } + } + + +}; + + +/** Array::contains for C-arrays */ +template bool contains(const T* array, int len, const T& e) { + for (int i = len - 1; i >= 0; --i) { + if (array[i] == e) { + return true; + } + } + return false; +} + +} // namespace + +#ifdef _MSC_VER +# pragma warning (pop) +#endif + +#endif diff --git a/externals/g3dlite/G3D/AtomicInt32.h b/externals/g3dlite/G3D/AtomicInt32.h new file mode 100644 index 0000000..2d63f99 --- /dev/null +++ b/externals/g3dlite/G3D/AtomicInt32.h @@ -0,0 +1,164 @@ +/** + @file AtomicInt32.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2005-09-01 + @edited 2006-06-21 + */ +#ifndef G3D_ATOMICINT32_H +#define G3D_ATOMICINT32_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" + +#if defined(G3D_OSX) +# include +#endif + +namespace G3D { + +/** + An integer that may safely be used on different threads without + external locking. + + On Win32, Linux, FreeBSD, and Mac OS X this is implemented without locks. + + BETA API This is unsupported and may change + */ +class AtomicInt32 { +private: +# if defined(G3D_WIN32) + volatile long m_value; +# elif defined(G3D_OSX) + int32_t m_value; +# else + volatile int32 m_value; +# endif + + +public: + + /** Initial value is undefined. */ + AtomicInt32() {} + + /** Atomic set */ + explicit AtomicInt32(const int32 x) { + m_value = x; + } + + /** Atomic set */ + AtomicInt32(const AtomicInt32& x) { + m_value = x.m_value; + } + + /** Atomic set */ + const AtomicInt32& operator=(const int32 x) { + m_value = x; + return *this; + } + + /** Atomic set */ + void operator=(const AtomicInt32& x) { + m_value = x.m_value; + } + + /** Returns the current value */ + int32 value() const { + return m_value; + } + + /** Returns the old value, before the add. */ + int32 add(const int32 x) { +# if defined(G3D_WIN32) + + return InterlockedExchangeAdd(&m_value, x); + +# elif defined(G3D_LINUX) || defined(G3D_FREEBSD) + + int32 old; + asm volatile ("lock; xaddl %0,%1" + : "=r"(old), "=m"(m_value) /* outputs */ + : "0"(x), "m"(m_value) /* inputs */ + : "memory", "cc"); + return old; + +# elif defined(G3D_OSX) + + int32 old = m_value; + OSAtomicAdd32(x, &m_value); + return old; + +# endif + } + + /** Returns old value. */ + int32 sub(const int32 x) { + return add(-x); + } + + void increment() { +# if defined(G3D_WIN32) + // Note: returns the newly incremented value + InterlockedIncrement(&m_value); +# elif defined(G3D_LINUX) || defined(G3D_FREEBSD) + add(1); +# elif defined(G3D_OSX) + // Note: returns the newly incremented value + OSAtomicIncrement32(&m_value); +# endif + } + + /** Returns zero if the result is zero after decrement, non-zero otherwise.*/ + int32 decrement() { +# if defined(G3D_WIN32) + // Note: returns the newly decremented value + return InterlockedDecrement(&m_value); +# elif defined(G3D_LINUX) || defined(G3D_FREEBSD) + unsigned char nz; + + asm volatile ("lock; decl %1;\n\t" + "setnz %%al" + : "=a" (nz) + : "m" (m_value) + : "memory", "cc"); + return nz; +# elif defined(G3D_OSX) + // Note: returns the newly decremented value + return OSAtomicDecrement32(&m_value); +# endif + } + + + /** Atomic test-and-set: if *this == comperand then *this := exchange else do nothing. + In both cases, returns the old value of *this. + + Performs an atomic comparison of this with the Comperand value. + If this is equal to the Comperand value, the Exchange value is stored in this. + Otherwise, no operation is performed. + + Under VC6 the sign bit may be lost. + */ + int32 compareAndSet(const int32 comperand, const int32 exchange) { +# if defined(G3D_WIN32) + return InterlockedCompareExchange(&m_value, exchange, comperand); +# elif defined(G3D_LINUX) || defined(G3D_FREEBSD) || defined(G3D_OSX) + // Based on Apache Portable Runtime + // http://koders.com/c/fid3B6631EE94542CDBAA03E822CA780CBA1B024822.aspx + int32 ret; + asm volatile ("lock; cmpxchgl %1, %2" + : "=a" (ret) + : "r" (exchange), "m" (m_value), "0"(comperand) + : "memory", "cc"); + return ret; + + // Note that OSAtomicCompareAndSwap32 does not return a useful value for us + // so it can't satisfy the cmpxchgl contract. +# endif + } + +}; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/BinaryFormat.h b/externals/g3dlite/G3D/BinaryFormat.h new file mode 100644 index 0000000..f6719a1 --- /dev/null +++ b/externals/g3dlite/G3D/BinaryFormat.h @@ -0,0 +1,140 @@ +/** + @file BinaryFormat.h + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @author 2005-06-03 + @edited 2005-06-03 + + Copyright 2000-2005, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_BINARYFORMAT_H +#define G3D_BINARYFORMAT_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" + +namespace G3D { + +class Vector2; +class Vector2int16; +class Vector3; +class Vector3int16; +class Vector4; +class Vector4int16; +class Color3; +class Color3uint8; +class Color4; +class Color4uint8; + +/** + Some values like float16 and int128 have no current CPU data structure that implements them but are useful + for file formats and for GPUs. + + CHUNK_BINFMT data follows the protocol. + */ +// Must be packed int 16 bits for the chunk reader +// We can't name these just "INT8" etc. because some libraries #define names like that +enum BinaryFormat { + FIRST_BINFMT = 1000, + + BOOL8_BINFMT, + UINT8_BINFMT, INT8_BINFMT, UINT16_BINFMT, INT16_BINFMT, UINT32_BINFMT, INT32_BINFMT, UINT64_BINFMT, INT64_BINFMT, UINT128_BINFMT, INT128_BINFMT, + FLOAT16_BINFMT, FLOAT32_BINFMT, FLOAT64_BINFMT, + VECTOR2_BINFMT, VECTOR2INT16_BINFMT, + VECTOR3_BINFMT, VECTOR3INT16_BINFMT, + VECTOR4_BINFMT, VECTOR4INT16_BINFMT, + COLOR3_BINFMT, COLOR3UINT8_BINFMT, COLOR3INT16_BINFMT, + COLOR4_BINFMT, COLOR4UINT8_BINFMT, COLOR4INT16_BINFMT, + STRING_BINFMT, STRINGEVEN_BINFMT, STRING8_BINFMT, STRING16_BINFMT, STRING32_BINFMT, + + CHUNK_BINFMT, + + CUSTOM_BINFMT, + + LAST_BINFMT +}; + +} + +/** A macro that maps G3D types to format constants. + (e.g. binaryFormatOf(Vector3) == VECTOR3_BINFMT). +*/ +// This implementation is designed to meet the following constraints: +// 1. Work around the many MSVC++ partial template bugs +// 2. Work for primitive types (e.g. int) +#define binaryFormatOf(T) (G3D::_internal::_BinaryFormat::x()) + +namespace G3D { +namespace _internal { + + +template class _BinaryFormat { +public: + static BinaryFormat x() { + return CUSTOM_BINFMT; + } +}; +}} + + +/** + Macro to declare the underlying format (as will be returned by glFormatOf) + of a type. For example, + +
+    DECLARE_BINARYFORMATOF(Vector4, VECTOR4_BINFMT)
+  
+ + Use this so you can make vertex arrays of your own classes and not just + the standard ones. + */ +#define DECLARE_BINARYFORMATOF(CType, EnumType) \ +namespace G3D { \ + namespace _internal { \ + template<> class _BinaryFormat { \ + public: \ + static BinaryFormat x() { \ + return EnumType; \ + } \ + }; \ + } \ +} + +DECLARE_BINARYFORMATOF( bool, BOOL8_BINFMT ) + +DECLARE_BINARYFORMATOF( uint8, UINT8_BINFMT ) +DECLARE_BINARYFORMATOF( int8, INT8_BINFMT ) +DECLARE_BINARYFORMATOF( uint16, UINT16_BINFMT ) +DECLARE_BINARYFORMATOF( int16, INT16_BINFMT ) +DECLARE_BINARYFORMATOF( uint32, UINT32_BINFMT ) +DECLARE_BINARYFORMATOF( int32, INT32_BINFMT ) +DECLARE_BINARYFORMATOF( uint64, UINT64_BINFMT ) +DECLARE_BINARYFORMATOF( int64, INT64_BINFMT ) + +DECLARE_BINARYFORMATOF( float32, FLOAT32_BINFMT ) +DECLARE_BINARYFORMATOF( float64, FLOAT64_BINFMT ) + +DECLARE_BINARYFORMATOF( Vector2, VECTOR2_BINFMT ) +DECLARE_BINARYFORMATOF( Vector2int16, VECTOR2INT16_BINFMT ) +DECLARE_BINARYFORMATOF( Vector3, VECTOR3_BINFMT ) +DECLARE_BINARYFORMATOF( Vector3int16, VECTOR3INT16_BINFMT ) +DECLARE_BINARYFORMATOF( Vector4, VECTOR4_BINFMT ) +DECLARE_BINARYFORMATOF( Vector4int16, VECTOR4INT16_BINFMT ) + +DECLARE_BINARYFORMATOF( Color3, COLOR3_BINFMT ) +DECLARE_BINARYFORMATOF( Color3uint8, COLOR3UINT8_BINFMT ) +DECLARE_BINARYFORMATOF( Color4, COLOR4_BINFMT ) +DECLARE_BINARYFORMATOF( Color4uint8, COLOR4UINT8_BINFMT ) + +namespace G3D { + +/** Returns -1 if the format is custom, otherwise the byte size + of a single element in this format.*/ +int32 byteSize(BinaryFormat f); + + +} //G3D + +#endif diff --git a/externals/g3dlite/G3D/BinaryInput.h b/externals/g3dlite/G3D/BinaryInput.h new file mode 100644 index 0000000..1dac93e --- /dev/null +++ b/externals/g3dlite/G3D/BinaryInput.h @@ -0,0 +1,441 @@ +/** + @file BinaryInput.h + + @maintainer Morgan McGuire, graphics3d.com + + @created 2001-08-09 + @edited 2006-07-19 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_BinaryInput_h +#define G3D_BinaryInput_h + +#ifdef _MSC_VER +// Disable conditional expression is constant, which occurs incorrectly on inlined functions +# pragma warning(push) +# pragma warning( disable : 4127 ) +#endif + +#include +#include +#include +#include +#include +#include +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Color4.h" +#include "G3D/Color3.h" +#include "G3D/Vector4.h" +#include "G3D/Vector3.h" +#include "G3D/Vector2.h" +#include "G3D/g3dmath.h" +#include "G3D/debug.h" +#include "G3D/System.h" + + +namespace G3D { + +#if defined(G3D_WIN32) || defined(G3D_LINUX) + // Allow writing of integers to non-word aligned locations. + // This is legal on x86, but not on other platforms. + #define G3D_ALLOW_UNALIGNED_WRITES +#endif + +/** + Sequential or random access byte-order independent binary file access. + Files compressed with zlib and beginning with an unsigned 32-bit int + size are transparently decompressed when the compressed = true flag is + specified to the constructor. + + For every readX method there are also versions that operate on a whole + Array, std::vector, or C-array. e.g. readFloat32(Array& array, n) + These methods resize the array or std::vector to the appropriate size + before reading. For a C-array, they require the pointer to reference + a memory block at least large enough to hold n elements. + + Most classes define serialize/deserialize methods that use BinaryInput, + BinaryOutput, TextInput, and TextOutput. There are text serializer + functions for primitive types (e.g. int, std::string, float, double) but not + binary serializers-- you must call the BinaryInput::readInt32 or + other appropriate function. This is because it would be very hard to + debug the error sequence: serialize(1.0, bo); ... float f; deserialize(f, bi); + in which a double is serialized and then deserialized as a float. + */ +class BinaryInput { +private: + + // The initial buffer will be no larger than this, but + // may grow if a large memory read occurs. 50 MB + enum {INITIAL_BUFFER_LENGTH = 50000000}; + + /** + is the file big or little endian + */ + G3DEndian m_fileEndian; + std::string m_filename; + + bool m_swapBytes; + + /** Next position to read from in bitString during readBits. */ + int m_bitPos; + + /** Bits currently being read by readBits. + Contains at most 8 (low) bits. Note that + beginBits/readBits actually consumes one extra byte, which + will be restored by writeBits.*/ + uint32 m_bitString; + + /** 1 when between beginBits and endBits, 0 otherwise. */ + int m_beginEndBits; + + /** When operating on huge files, we cannot load the whole file into memory. + This is the file position to which buffer[0] corresponds. + */ + int64 m_alreadyRead; + + /** + Length of the entire file, in bytes. + For the length of the buffer, see bufferLength + */ + int64 m_length; + + /** Length of the array referenced by buffer. May go past the end of the file!*/ + int64 m_bufferLength; + uint8* m_buffer; + + /** + Next byte in file, relative to buffer. + */ + int64 m_pos; + + /** + When true, the buffer is freed in the destructor. + */ + bool m_freeBuffer; + + /** Ensures that we are able to read at least minLength from startPosition (relative + to start of file). */ + void loadIntoMemory(int64 startPosition, int64 minLength = 0); + + /** Verifies that at least this number of bytes can be read.*/ + inline void prepareToRead(int64 nbytes) { + debugAssertM(m_length > 0, m_filename + " not found or corrupt."); + debugAssertM(m_pos + nbytes + m_alreadyRead <= m_length, "Read past end of file."); + + if (m_pos + nbytes > m_bufferLength) { + loadIntoMemory(m_pos + m_alreadyRead, nbytes); + } + } + + // Not implemented on purpose, don't use + BinaryInput(const BinaryInput&); + BinaryInput& operator=(const BinaryInput&); + bool operator==(const BinaryInput&); + + /** Buffer is compressed; replace it with a decompressed version */ + void decompress(); +public: + + /** false, constant to use with the copyMemory option */ + static const bool NO_COPY; + + /** + If the file cannot be opened, a zero length buffer is presented. + Automatically opens files that are inside zipfiles. + + @param compressed Set to true if and only if the file was + compressed using BinaryOutput's zlib compression. This has + nothing to do with whether the input is in a zipfile. + */ + BinaryInput( + const std::string& filename, + G3DEndian fileEndian, + bool compressed = false); + + /** + Creates input stream from an in memory source. + Unless you specify copyMemory = false, the data is copied + from the pointer, so you may deallocate it as soon as the + object is constructed. It is an error to specify copyMemory = false + and compressed = true. + + To decompress part of a file, you can follow the following paradigm: + +
+        BinaryInput master(...);
+
+        // read from master to point where compressed data exists.
+
+        BinaryInput subset(master.getCArray() + master.getPosition(), 
+                           master.length() - master.getPosition(),
+                           master.endian(), true, true);
+
+        // Now read from subset (it is ok for master to go out of scope)
+     
+ */ + BinaryInput( + const uint8* data, + int64 dataLen, + G3DEndian dataEndian, + bool compressed = false, + bool copyMemory = true); + + virtual ~BinaryInput(); + + /** Change the endian-ness of the file. This only changes the + interpretation of the file for future read calls; the + underlying data is unmodified.*/ + void setEndian(G3DEndian endian); + + G3DEndian endian() const { + return m_fileEndian; + } + + std::string getFilename() const { + return m_filename; + } + + /** + Returns a pointer to the internal memory buffer. + May throw an exception for huge files. + */ + const uint8* getCArray() const { + if (m_alreadyRead > 0) { + throw "Cannot getCArray for a huge file"; + } + return m_buffer; + } + + /** + Performs bounds checks in debug mode. [] are relative to + the start of the file, not the current position. + Seeks to the new position before reading (and leaves + that as the current position) + */ + inline uint8 operator[](int64 n) { + setPosition(n); + return readUInt8(); + } + + /** + Returns the length of the file in bytes. + */ + inline int64 getLength() const { + return m_length; + } + + inline int64 size() const { + return getLength(); + } + + /** + Returns the current byte position in the file, + where 0 is the beginning and getLength() - 1 is the end. + */ + inline int64 getPosition() const { + return m_pos + m_alreadyRead; + } + + /** + Sets the position. Cannot set past length. + May throw a char* when seeking backwards more than 10 MB on a huge file. + */ + inline void setPosition(int64 p) { + debugAssertM(p <= m_length, "Read past end of file"); + m_pos = p - m_alreadyRead; + if ((m_pos < 0) || (m_pos > m_bufferLength)) { + loadIntoMemory(m_pos + m_alreadyRead); + } + } + + /** + Goes back to the beginning of the file. + */ + inline void reset() { + setPosition(0); + } + + inline int8 readInt8() { + prepareToRead(1); + return m_buffer[m_pos++]; + } + + inline bool readBool8() { + return (readInt8() != 0); + } + + inline uint8 readUInt8() { + prepareToRead(1); + return ((uint8*)m_buffer)[m_pos++]; + } + + uint16 inline readUInt16() { + prepareToRead(2); + + m_pos += 2; + if (m_swapBytes) { + uint8 out[2]; + out[0] = m_buffer[m_pos - 1]; + out[1] = m_buffer[m_pos - 2]; + return *(uint16*)out; + } else { + #ifdef G3D_ALLOW_UNALIGNED_WRITES + return *(uint16*)(&m_buffer[m_pos - 2]); + #else + uint8 out[2]; + out[0] = m_buffer[m_pos - 2]; + out[1] = m_buffer[m_pos - 1]; + return *(uint16*)out; + #endif + } + + } + + inline int16 readInt16() { + uint16 a = readUInt16(); + return *(int16*)&a; + } + + inline uint32 readUInt32() { + prepareToRead(4); + + m_pos += 4; + if (m_swapBytes) { + uint8 out[4]; + out[0] = m_buffer[m_pos - 1]; + out[1] = m_buffer[m_pos - 2]; + out[2] = m_buffer[m_pos - 3]; + out[3] = m_buffer[m_pos - 4]; + return *(uint32*)out; + } else { + #ifdef G3D_ALLOW_UNALIGNED_WRITES + return *(uint32*)(&m_buffer[m_pos - 4]); + #else + uint8 out[4]; + out[0] = m_buffer[m_pos - 4]; + out[1] = m_buffer[m_pos - 3]; + out[2] = m_buffer[m_pos - 2]; + out[3] = m_buffer[m_pos - 1]; + return *(uint32*)out; + #endif + } + } + + + inline int32 readInt32() { + uint32 a = readUInt32(); + return *(int32*)&a; + } + + uint64 readUInt64(); + + inline int64 readInt64() { + uint64 a = readUInt64(); + return *(int64*)&a; + } + + inline float32 readFloat32() { + union { + uint32 a; + float32 b; + }; + a = readUInt32(); + return b; + } + + inline float64 readFloat64() { + union { + uint64 a; + float64 b; + }; + a = readUInt64(); + return b; + } + + void readBytes(void* bytes, int64 n); + + /** + Reads an n character string. The string is not + required to end in NULL in the file but will + always be a proper std::string when returned. + */ + std::string readString(int64 n); + + /** + Reads until NULL or the end of the file is encountered. + */ + std::string readString(); + + /** + Reads until NULL or the end of the file is encountered. + If the string has odd length (including NULL), reads + another byte. + */ + std::string readStringEven(); + + + std::string readString32(); + + Vector4 readVector4(); + Vector3 readVector3(); + Vector2 readVector2(); + + Color4 readColor4(); + Color3 readColor3(); + + /** + Skips ahead n bytes. + */ + inline void skip(int64 n) { + setPosition(m_pos + m_alreadyRead + n); + } + + /** + Returns true if the position is not at the end of the file + */ + inline bool hasMore() const { + return m_pos + m_alreadyRead < m_length; + } + + /** Prepares for bit reading via readBits. Only readBits can be + called between beginBits and endBits without corrupting the + data stream. */ + void beginBits(); + + /** Can only be called between beginBits and endBits */ + uint32 readBits(int numBits); + + /** Ends bit-reading. */ + void endBits(); + +# define DECLARE_READER(ucase, lcase)\ + void read##ucase(lcase* out, int64 n);\ + void read##ucase(std::vector& out, int64 n);\ + void read##ucase(Array& out, int64 n); + + DECLARE_READER(Bool8, bool) + DECLARE_READER(UInt8, uint8) + DECLARE_READER(Int8, int8) + DECLARE_READER(UInt16, uint16) + DECLARE_READER(Int16, int16) + DECLARE_READER(UInt32, uint32) + DECLARE_READER(Int32, int32) + DECLARE_READER(UInt64, uint64) + DECLARE_READER(Int64, int64) + DECLARE_READER(Float32, float32) + DECLARE_READER(Float64, float64) +# undef DECLARE_READER +}; + + +} + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +#endif diff --git a/externals/g3dlite/G3D/BinaryOutput.h b/externals/g3dlite/G3D/BinaryOutput.h new file mode 100644 index 0000000..d81ec56 --- /dev/null +++ b/externals/g3dlite/G3D/BinaryOutput.h @@ -0,0 +1,421 @@ +/** + @file BinaryOutput.h + + @maintainer Morgan McGuire, graphics3d.com + + @created 2001-08-09 + @edited 2008-01-24 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_BINARYOUTPUT_H +#define G3D_BINARYOUTPUT_H + +#include "G3D/platform.h" +#include +#include +#include +#include +#include +#include "G3D/Color4.h" +#include "G3D/Color3.h" +#include "G3D/Vector4.h" +#include "G3D/Vector3.h" +#include "G3D/Vector2.h" +#include "G3D/g3dmath.h" +#include "G3D/debug.h" +#include "G3D/BinaryInput.h" +#include "G3D/System.h" + +#ifdef _MSC_VER +# pragma warning (push) +// Conditional is constant (wrong in inline) +# pragma warning (disable : 4127) +#endif +namespace G3D { + +/** + Sequential or random access byte-order independent binary file access. + + The compress() call can be used to compress with zlib. + + Any method call can trigger an out of memory error (thrown as char*) + when writing to "" instead of a file. + + Compressed writing and seeking backwards is not supported for huge files + (i.e., BinaryOutput may have to dump the contents to disk if they + exceed available RAM). + */ +class BinaryOutput { +private: + std::string m_filename; + + bool m_committed; + + /** 0 outside of beginBits...endBits, 1 inside */ + int m_beginEndBits; + + /** The current string of bits being built up by beginBits...endBits. + This string is treated semantically, as if the lowest bit was + on the left and the highest was on the right.*/ + int8 m_bitString; + + /** Position (from the lowest bit) currently used in bitString.*/ + int m_bitPos; + + // True if the file endianess does not match the machine endian + bool m_swapBytes; + + G3DEndian m_fileEndian; + + uint8* m_buffer; + + /** Size of the elements used */ + int m_bufferLen; + + /** Underlying size of memory allocaded */ + int m_maxBufferLen; + + /** Next byte in file */ + int m_pos; + + /** is this initialized? */ + bool m_init; + + /** Number of bytes already written to the file.*/ + size_t m_alreadyWritten; + + bool m_ok; + + void reserveBytesWhenOutOfMemory(size_t bytes); + + void reallocBuffer(size_t bytes, size_t oldBufferLen); + + /** + Make sure at least bytes can be written, resizing if + necessary. + */ + inline void reserveBytes(int bytes) { + debugAssert(bytes > 0); + size_t oldBufferLen = (size_t)m_bufferLen; + + m_bufferLen = iMax(m_bufferLen, (m_pos + bytes)); + if (m_bufferLen > m_maxBufferLen) { + reallocBuffer(bytes, oldBufferLen); + } + } + + // Not implemented on purpose, don't use + BinaryOutput(const BinaryOutput&); + BinaryOutput& operator=(const BinaryOutput&); + bool operator==(const BinaryOutput&); + +public: + + /** + You must call setEndian() if you use this (memory) constructor. + */ + BinaryOutput(); + + /** + Doesn't actually open the file; commit() does that. + Use "" as the filename if you're going to commit + to memory. + */ + BinaryOutput( + const std::string& filename, + G3DEndian fileEndian); + + ~BinaryOutput(); + + /** Compresses the data in the buffer in place, + preceeding it with a little-endian uint32 indicating + the uncompressed size. + + Call immediately before commit(). + + Cannot be used for huge files (ones where the data + was already written to disk)-- will throw char*. + */ + void compress(); + + /** True if no errors have been encountered.*/ + bool ok() const; + + /** + Returns a pointer to the internal memory buffer. + */ + inline const uint8* getCArray() const { + return m_buffer; + } + + void setEndian(G3DEndian fileEndian); + + G3DEndian endian() const { + return m_fileEndian; + } + + std::string getFilename() const { + return m_filename; + } + + /** + Write the bytes to disk. It is ok to call this + multiple times; it will just overwrite the previous file. + + Parent directories are created as needed if they do + not exist. + + Not called from the destructor; you must call + it yourself. + + @param flush If true (default) the file is ready for reading when the method returns, otherwise + the method returns immediately and writes the file in the background. + */ + void commit(bool flush = true); + + /** + Write the bytes to memory (which must be of + at least size() bytes). + */ + void commit(uint8*); + + /** + A memory BinaryOutput may be reset so that it can be written to again + without allocating new memory. The underlying array will not be deallocated, + but the reset structure will act like a newly intialized one. + */ + void reset(); + + + inline int length() const { + return (int)m_bufferLen + (int)m_alreadyWritten; + } + + inline int size() const { + return length(); + } + + /** + Sets the length of the file to n, padding + with 0's past the current end. Does not + change the position of the next byte to be + written unless n < size(). + + Throws char* when resetting a huge file to be shorter + than its current length. + */ + inline void setLength(int n) { + n = n - (int)m_alreadyWritten; + + if (n < 0) { + throw "Cannot resize huge files to be shorter."; + } + + if (n < m_bufferLen) { + m_pos = n; + } + if (n > m_bufferLen) { + reserveBytes(n - m_bufferLen); + } + } + + /** + Returns the current byte position in the file, + where 0 is the beginning and getLength() - 1 is the end. + */ + inline int64 position() const { + return (int64)m_pos + (int64)m_alreadyWritten; + } + + + /** + Sets the position. Can set past length, in which case + the file is padded with zeros up to one byte before the + next to be written. + + May throw a char* exception when seeking backwards on a huge file. + */ + inline void setPosition(int64 p) { + p = p - (int64)m_alreadyWritten; + + if (p > m_bufferLen) { + setLength((int)(p + (int64)m_alreadyWritten)); + } + + if (p < 0) { + throw "Cannot seek more than 10 MB backwards on huge files."; + } + + m_pos = (int)p; + } + + + void writeBytes( + const void* b, + int count) { + + reserveBytes(count); + debugAssert(m_pos >= 0); + debugAssert(m_bufferLen >= count); + System::memcpy(m_buffer + m_pos, b, count); + m_pos += count; + } + + /** + Writes a signed 8-bit integer to the current position. + */ + inline void writeInt8(int8 i) { + reserveBytes(1); + m_buffer[m_pos] = *(uint8*)&i; + m_pos++; + } + + inline void writeBool8(bool b) { + writeInt8(b ? 1 : 0); + } + + inline void writeUInt8(uint8 i) { + reserveBytes(1); + m_buffer[m_pos] = i; + m_pos++; + } + + void writeUInt16(uint16 u); + + inline void writeInt16(int16 i) { + writeUInt16(*(uint16*)&i); + } + + void writeUInt32(uint32 u); + + inline void writeInt32(int32 i) { + debugAssert(m_beginEndBits == 0); + writeUInt32(*(uint32*)&i); + } + + void writeUInt64(uint64 u); + + inline void writeInt64(int64 i) { + writeUInt64(*(uint64*)&i); + } + + inline void writeFloat32(float32 f) { + debugAssert(m_beginEndBits == 0); + union { + float32 a; + uint32 b; + }; + a = f; + writeUInt32(b); + } + + inline void writeFloat64(float64 f) { + union { + float64 a; + uint64 b; + }; + a = f; + writeUInt64(b); + } + + /** + Write a string with NULL termination. + */ + inline void writeString(const std::string& s) { + writeString(s.c_str()); + } + + void writeString(const char* s); + + /** + Write a string, ensuring that the total length + including NULL is even. + */ + void writeStringEven(const std::string& s) { + writeStringEven(s.c_str()); + } + + void writeStringEven(const char* s); + + + void writeString32(const char* s); + + /** + Write a string with a 32-bit length field in front + of it. + */ + void writeString32(const std::string& s) { + writeString32(s.c_str()); + } + + void writeVector4(const Vector4& v); + + void writeVector3(const Vector3& v); + + void writeVector2(const Vector2& v); + + void writeColor4(const Color4& v); + + void writeColor3(const Color3& v); + + /** + Skips ahead n bytes. + */ + inline void skip(int n) { + if (m_pos + n > m_bufferLen) { + setLength((int)m_pos + (int)m_alreadyWritten + n); + } + m_pos += n; + } + + /** Call before a series of BinaryOutput::writeBits calls. Only writeBits + can be called between beginBits and endBits without corrupting the stream.*/ + void beginBits(); + + /** Write numBits from bitString to the output stream. Bits are numbered from + low to high. + + Can only be + called between beginBits and endBits. Bits written are semantically + little-endian, regardless of the actual endian-ness of the system. That is, + writeBits(0xABCD, 16) writes 0xCD to the first byte and + 0xAB to the second byte. However, if used with BinaryInput::readBits, the ordering + is transparent to the caller. + */ + void writeBits(uint32 bitString, int numBits); + + /** Call after a series of BinaryOutput::writeBits calls. This will + finish out with zeros the last byte into which bits were written.*/ + void endBits(); + + +# define DECLARE_WRITER(ucase, lcase)\ + void write##ucase(const lcase* out, int n);\ + void write##ucase(const std::vector& out, int n);\ + void write##ucase(const Array& out, int n); + + DECLARE_WRITER(Bool8, bool) + DECLARE_WRITER(UInt8, uint8) + DECLARE_WRITER(Int8, int8) + DECLARE_WRITER(UInt16, uint16) + DECLARE_WRITER(Int16, int16) + DECLARE_WRITER(UInt32, uint32) + DECLARE_WRITER(Int32, int32) + DECLARE_WRITER(UInt64, uint64) + DECLARE_WRITER(Int64, int64) + DECLARE_WRITER(Float32, float32) + DECLARE_WRITER(Float64, float64) +# undef DECLARE_WRITER + +}; + +} + +#ifdef _MSC_VER +# pragma warning (pop) +#endif + +#endif diff --git a/externals/g3dlite/G3D/BoundsTrait.h b/externals/g3dlite/G3D/BoundsTrait.h new file mode 100644 index 0000000..15e1418 --- /dev/null +++ b/externals/g3dlite/G3D/BoundsTrait.h @@ -0,0 +1,20 @@ +/** + @file BoundsTrait.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2008-10-01 + @edited 2008-10-01 + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_BOUNDSTRAIT_H +#define G3D_BOUNDSTRAIT_H + +#include "G3D/platform.h" + +template +struct BoundsTrait{}; + +#endif + diff --git a/externals/g3dlite/G3D/Box.h b/externals/g3dlite/G3D/Box.h new file mode 100644 index 0000000..82af912 --- /dev/null +++ b/externals/g3dlite/G3D/Box.h @@ -0,0 +1,195 @@ +/** + @file Box.h + + Box class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com + @created 2001-06-02 + @edited 2007-06-05 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_BOX_H +#define G3D_BOX_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Array.h" +#include "G3D/Plane.h" + +namespace G3D { + +class CoordinateFrame; + +/** + An arbitrary 3D box, useful as a bounding box. + + + To construct a box from a coordinate frame, center and extent, use the idiom: + + Box box = cframe.toObjectSpace(Box(center - extent/2, center + extent/2)); + */ +class Box { +private: + + static int32 dummy; + + friend class CoordinateFrame; + + /** +
+       3    2       7    6
+    
+       0    1       4    5
+
+       front    back (seen through front)
+      
+ */ + Vector3 _corner[8]; + + /** + Unit axes. + */ + Vector3 _axis[3]; + + Vector3 _center; + + /** + Extent along each axis. + */ + Vector3 _extent; + + float _area; + float _volume; + + void init( + const Vector3& min, + const Vector3& max); + +public: + + /** + Does not initialize the fields. + */ + Box(); + + /** + Constructs a box from two opposite corners. + */ + Box( + const Vector3& min, + const Vector3& max); + + static Box inf(); + + Box(class BinaryInput& b); + + Box(const class AABox& b); + + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + /** + Returns the object to world transformation for + this box. localFrame().worldToObject(...) takes + objects into the space where the box axes are + (1,0,0), (0,1,0), (0,0,1). Note that there + is no scaling in this transformation. + */ + CoordinateFrame localFrame() const; + + void getLocalFrame(CoordinateFrame& frame) const; + + /** + Returns the centroid of the box. + */ + inline Vector3 center() const { + return _center; + } + + + inline Vector3 corner(int i) const { + debugAssert(i < 8); + return _corner[i]; + } + + /** + Unit length. + */ + inline Vector3 axis(int a) const { + debugAssert(a < 3); + return _axis[a]; + } + + /** + Distance from corner(0) to the next corner + along the box's local axis a. + */ + inline float extent(int a) const { + debugAssert(a < 3); + return (float)_extent[a]; + } + + inline Vector3 extent() const { + return _extent; + } + + /** + Returns the four corners of a face (0 <= f < 6). + The corners are returned to form a counter clockwise quad facing outwards. + */ + void getFaceCorners( + int f, + Vector3& v0, + Vector3& v1, + Vector3& v2, + Vector3& v3) const; + + + /** + See AABox::culledBy + */ + bool culledBy + ( + const Array& plane, + int32& cullingPlaneIndex, + const uint32 testMask, + uint32& childMask) const; + + /** + Conservative culling test that does not produce a mask for children. + */ + bool culledBy + ( + const Array& plane, + int32& cullingPlaneIndex = dummy, + const uint32 testMask = -1) const; + + bool contains( + const Vector3& point) const; + + float area() const; + + float volume() const; + + void getRandomSurfacePoint(Vector3& P, Vector3& N = Vector3::ignore()) const; + + /** + Uniformly distributed on the interior (includes surface) + */ + Vector3 randomInteriorPoint() const; + + void getBounds(class AABox&) const; + + bool isFinite() const { + return G3D::isFinite(_volume); + } +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Box2D.h b/externals/g3dlite/G3D/Box2D.h new file mode 100644 index 0000000..80accad --- /dev/null +++ b/externals/g3dlite/G3D/Box2D.h @@ -0,0 +1,121 @@ +/** + @file Box2D.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2008-12-27 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Box2D_h +#define G3D_Box2D_h + +#include "G3D/platform.h" +#include "G3D/Vector2.h" + +namespace G3D { + +class CoordinateFrame; +typedef class CoordinateFrame CFrame; +class Rect2D; +typedef class Rect2D AABox2D; + +/** + 2D oriented box + @cite http://www.flipcode.com/archives/2D_OBB_Intersection.shtml + */ +class Box2D { +private: + /** Corners of the box, where 0 is the lower left. */ + Vector2 m_corner[4]; + + /** Two edges of the box extended away from corner[0], with length + = 1 / extentSquared */ + Vector2 m_axisin[2]; + + /** Two edges of the box extended away from corner[0], with unit length */ + Vector2 m_axis[2]; + + /** Centroid of the box */ + Vector2 m_center; + + /** origin[a] = m_corner[0].dot(m_axisin[a]); */ + float origin[2]; + + /** Surface area */ + float m_area; + + Vector2 m_extent; + + /** Returns true if other overlaps one dimension of this. */ + bool overlaps1Way(const Box2D& other) const; + + + /** Updates the axes after the m_corners move. Assumes the + m_corners actually form a rectangle. */ + void computeAxes(); + +public: + + /** + @param center World-space center + @param w Width along object-space x-axis + @param h Height along object-space y-axis + @param angle Counter-clockwise angle from object-space x-axis in radians + */ + Box2D(const Vector2& center = Vector2(0, 0), float w = 0, float h = 0, float angle = 0); + + Box2D(const AABox2D& b); + + Box2D(const Vector2& min, const Vector2& max); + + /** Transform @a b by @a frame, discarding the Z components, and + compute the new box.*/ + Box2D(const CFrame& frame, Box2D& b); + + inline bool contains(const Vector2& v) const { + // Take to object space: + const Vector2& p = v - m_center; + float x = p.dot(m_axisin[0]); + float y = p.dot(m_axisin[1]); + + // Must be within extent/2 on both axes in object space + return (abs(x) <= 0.5f) && (abs(y) <= 0.5f); + } + + /** @brief Distance from corner(0) to the next corner along the box's local axis a. */ + inline const Vector2& extent() const { + return m_extent; + } + + /** @brief Unit length vector along axis @a a */ + inline const Vector2& axis(int a) const { + debugAssert(a == 0 || a == 1); + return m_axis[a]; + } + + /** @brief Surface area */ + inline float area() const { + return m_area; + } + + inline const Vector2& corner(int i) const { + debugAssert(i >=0 && i <= 3); + return m_corner[i]; + } + + inline const Vector2& center() const { + return m_center; + } + + /** Returns true if the intersection of the boxes is non-empty. */ + inline bool overlaps(const Box2D& other) const { + return overlaps1Way(other) && other.overlaps1Way(*this); + } +}; + +} // G3D +#endif diff --git a/externals/g3dlite/G3D/BumpMapPreprocess.h b/externals/g3dlite/G3D/BumpMapPreprocess.h new file mode 100644 index 0000000..955f99e --- /dev/null +++ b/externals/g3dlite/G3D/BumpMapPreprocess.h @@ -0,0 +1,61 @@ +/** + \file BumpMapPreprocess.h + + \maintainer Morgan McGuire, http://graphics.cs.williams.edu + + \created 2010-01-28 + \edited 2010-01-28 + + Copyright 2000-2010, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_BumpMapPreprocess_h +#define G3D_BumpMapPreprocess_h + +#include "G3D/platform.h" + +namespace G3D { +class Any; + +/** +Not in the BumpMap class to avoid a circular dependency between Texture and BumpMap. +G3D::GImage::computeNormalMap(). +*/ +class BumpMapPreprocess { +public: + + /** If true, the elevations are box filtered after computing normals + and before uploading, which produces better results for parallax offset mapping + Defaults to false. */ + bool lowPassFilter; + + /** Height of the maximum ("white") value, in pixels, for the purpose of computing normals. + A value of 255 means that a 255 x 255 bump image with a full black-to-white gradient + will produce a 45-degree ramp (this also results in "cubic" voxels). + A negative value means to set zExtentPixels to -zExtentPixels * max(width, height). + The default is -0.02. + */ + float zExtentPixels; + + /** After computing normals, scale the height by |N.z|, a trick that reduces texture swim in steep areas for parallax offset + mapping. Defaults to false.*/ + bool scaleZByNz; + + BumpMapPreprocess() : lowPassFilter(false), zExtentPixels(-0.02f), scaleZByNz(false) {} + + BumpMapPreprocess(const Any& any); + + operator Any() const; + + bool operator==(const BumpMapPreprocess& other) const { + return + (lowPassFilter == other.lowPassFilter) && + (zExtentPixels == other.zExtentPixels) && + (scaleZByNz == other.scaleZByNz); + } +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Capsule.h b/externals/g3dlite/G3D/Capsule.h new file mode 100644 index 0000000..baeea3a --- /dev/null +++ b/externals/g3dlite/G3D/Capsule.h @@ -0,0 +1,90 @@ +/** + @file Capsule.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-02-07 + @edited 2005-08-20 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_CAPSULE_H +#define G3D_CAPSULE_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Vector3.h" + +namespace G3D { + +class Line; +class AABox; +/** + A shape formed by extruding a sphere along a line segment. + */ +class Capsule { +private: + Vector3 p1; + Vector3 p2; + + float _radius; +public: + + + /** Uninitialized */ + Capsule(); + Capsule(class BinaryInput& b); + Capsule(const Vector3& _p1, const Vector3& _p2, float _r); + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + /** The line down the center of the capsule */ + Line axis() const; + + inline float radius() const { + return _radius; + } + + /** Argument may be 0 or 1 */ + inline Vector3 point(int i) const { + debugAssert(i == 0 || i == 1); + return (i == 0) ? p1 : p2; + } + + /** Distance between the sphere centers. The total extent of the cylinder is + 2r + h. */ + inline float height() const { + return (p1 - p2).magnitude(); + } + + inline Vector3 center() const { + return (p1 + p2) / 2.0; + } + + /** Get a reference frame in which the center of mass is the origin and Y is the axis of the capsule.*/ + void getReferenceFrame(class CoordinateFrame& cframe) const; + + /** + Returns true if the point is inside the capsule or on its surface. + */ + bool contains(const Vector3& p) const; + + float volume() const; + + float area() const; + + /** Get axis aligned bounding box */ + void getBounds(AABox& out) const; + + /** Random world space point with outward facing normal. */ + void getRandomSurfacePoint(Vector3& P, Vector3& N) const; + + /** Point selected uniformly at random over the volume. */ + Vector3 randomInteriorPoint() const; +}; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/CollisionDetection.h b/externals/g3dlite/G3D/CollisionDetection.h new file mode 100644 index 0000000..c8fcf55 --- /dev/null +++ b/externals/g3dlite/G3D/CollisionDetection.h @@ -0,0 +1,1205 @@ +/** + @file CollisionDetection.h + + + Moving collision detection for simple primitives. + + @author Morgan McGuire, http://graphics.cs.williams.edu + @cite Spherical collision based on Paul Nettle's + ftp://ftp.3dmaileffects.com/pub/FluidStudios/CollisionDetection/Fluid_Studios_Generic_Collision_Detection_for_Games_Using_Ellipsoids.pdf + and comments by Max McGuire. Ray-sphere intersection by Eric Haines. + Box-Box intersection written by Kevin Egan. + Thanks to Max McGuire of Iron Lore for various bug fixes. + Box-Triangle by Tomas Akenine-Moller + + @created 2001-11-19 + @edited 2008-12-19 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_COLLISIONDETECTION_H +#define G3D_COLLISIONDETECTION_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Plane.h" +#include "G3D/Box.h" +#include "G3D/Triangle.h" +#include "G3D/Array.h" +#include "G3D/Ray.h" +#include "G3D/Line.h" + +namespace G3D { + + +/** + Collision detection primitives and tools for building + higher order collision detection schemes. + + These routines provide moving and static collision detection. + Moving collision detection allows the calculation of collisions that + occur during a period of time -- as opposed to the intersection of + two static bodies. + + Moving collision detection routines detect collisions between + only static primitives and moving spheres or points. Since the + reference frame can be user defined, these functions can be used to + detect the collision between two moving bodies by subtracting + the velocity vector of one object from the velocity vector of the + sphere or point the detection is to occur with. This unified + velocity vector will act as if both objects are moving simultaneously. + + Collisions are detected for single-sided objects only. That is, + no collision is detected when leaving a primitive or passing + through a plane or triangle opposite the normal... except for the + point-sphere calculation or when otherwise noted. + + For a sphere, the collision location returned is the point in world + space where the surface of the sphere and the fixed object meet. + It is not the position of the center of the sphere at + the time of the collision. + + The collision normal returned is the surface normal to the fixed + object at the collision location. + +

+ Static Collision Detection: (Neither object is moving) + + + + + + + + + + + + + + +
Vector3LineSegmentRay *LinePlaneTriangleSphereCylinderCapsuleAABoxBox
Vector3\link Vector3::operator== V3::==\endlink \link Vector3::fuzzyEq V3::fuzzy \endlink \link G3D::distance distance \endlink
LineSegment\link LineSegment::closestPoint LS::closestPoint\endlink \link LineSegment::distance LS::distance\endlink \link CollisionDetection::closestPointOnLineSegment CD\endlink
Ray *Ray::closestPoint Ray::distance
LineLine::closestPoint Line::distance\link CollisionDetection::closestPointsBetweenLineAndLine CD\endlink
Plane
Triangle
SphereSphere::contains\link CollisionDetection::collisionTimeForMovingPointFixedSphere CD \endlink, \link Ray::intersectionTime R::time\endlink
CylinderCylinder::contains
CapsuleCapsule::contains
AABoxAABox::contains\link CollisionDetection::fixedSolidBoxIntersectsFixedTriangle CD\endlink
BoxBox::contains(treat as Ray)\link CollisionDetection::collisionTimeForMovingPointFixedBox CD\endlink(treat as Ray)\link CollisionDetection::penetrationDepthForFixedBoxFixedPlane CD \endlink\link CollisionDetection::penetrationDepthForFixedBoxFixedPlane CD\endlink\link CollisionDetection::penetrationDepthForFixedSphereFixedBox CD\endlinkNone (use OPCODE)\link CollisionDetection::movingSpherePassesThroughFixedBox CD \endlink\link CollisionDetection::penetrationDepthForFixedBoxFixedBox CD\endlink\link CollisionDetection::penetrationDepthForFixedBoxFixedBox CD\endlink
+ +

+ Moving Collision Detection: + + * Note: Moving collision detection against certain primitives is equivalent to static collision + detection against a bigger primitive. Ray, Line Segment == ``moving Point''; Capsule ==``moving Sphere''; Plane == ``moving Line'' + + @deprecated Routines moving to the G3D::Intersect class in G3D 8.0 + */ +class CollisionDetection { +private: + + /** + Default parameter if value passed to a function as reference is + not to be calculated. Must be explicitly supported by function. + */ + static Vector3 ignore; + + /** + Default parameter if value passed to a function as reference is + not to be calculated. Must be explicitly supported by function. + */ + static bool ignoreBool; + + /** + Default parameter if value passed to a function as reference is + not to be calculated. Must be explicitly supported by function. + */ + static Array ignoreArray; + + + // Static class! + CollisionDetection() {} + virtual ~CollisionDetection() {} + +public: + + /** + Converts an index [0, 15] to the corresponding separating axis. + Does not return normalized vector in the edge-edge case + (indices 6 through 15). + + @param separatingAxisIndex Separating axis. + @param box1 Box 1. + @param box2 Box 2. + + @return Axis that separates the two boxes. + */ + static Vector3 separatingAxisForSolidBoxSolidBox( + const int separatingAxisIndex, + const Box & box1, + const Box & box2); + + /** + Tests whether two boxes have axes that are parallel to + each other. If they are, axis1 and axis2 are set to be + the parallel axes for both box1 and box2 respectively. + + @param ca Dot products of each of the boxes axes + @param epsilon Fudge factor (small unit by which the dot + products may vary and still be considered + zero). + @param axis1 Parallel Axis 1. [Post Condition] + @param axis2 Parallel Axis 2. [Post Condition] + + @return true - If boxes have a parallel axis + @return false - otherwise. + */ + static bool parallelAxisForSolidBoxSolidBox( + const double* ca, + const double epsilon, + int & axis1, + int & axis2); + + /** + Calculates the projected distance between the two boxes along + the specified separating axis, negative distances correspond + to an overlap along that separating axis. The distance is not + divided by denominator dot(L, L), see + penetrationDepthForFixedSphereFixedBox() for more details + + @param separatingAxisIndex + @param a Box 1's bounding sphere vector + @param b Box 2's bounding sphere vector + @param D Vector between Box 1 and Box 2's center points + @param c Pointer to array of dot products of the axes of Box 1 + and Box 2. + @param ca Pointer to array of unsigned dot products of the axes + of Box 1 and Box 2. + @param ad Pointer to array of dot products of Box 1 axes and D. + @param bd Pointer to array of dot products of Box 2 axes and D. + + @return Projected distance between the two boxes along the + specified separating axis. + */ + static float projectedDistanceForSolidBoxSolidBox( + const int separatingAxisIndex, + const Vector3 & a, + const Vector3 & b, + const Vector3 & D, + const double* c, + const double* ca, + const double* ad, + const double* bd); + + + /** + Creates a set of standard information about two boxes in order to + solve for their collision. This information includes a vector to + the radius of the bounding sphere for each box, the vector between + each boxes' center and a series of dot products between differing + important vectors. These dot products include those between the axes + of both boxes (signed and unsigned values), and the dot products + between all the axes of box1 and the boxes' center vector and box2 + and the boxes' center vector. + + @pre The following space requirements must be met: + - c[] 9 elements + - ca[] 9 elements + - ad[] 3 elements + - bd[] 3 elements + + @cite dobted from David Eberly's papers, variables used in this function + correspond to variables used in pages 6 and 7 in the pdf + http://www.magic-software.com/Intersection.html + http://www.magic-software.com/Documentation/DynamicCollisionDetection.pdf + + @note Links are out-dated. (Kept to preserve origin and authorship) + + @param box1 Box 1 + @param box2 Box 2 + @param a Box 1's bounding sphere vector + @param b Box 2's bounding sphere vector + @param D Vector between Box 1 and Box 2's center points + @param c Pointer to array of dot products of the axes of Box 1 + and Box 2. + @param ca Pointer to array of unsigned dot products of the axes + of Box 1 and Box 2. + @param ad Pointer to array of dot products of Box 1 axes and D. + @param bd Pointer to array of dot products of Box 2 axes and D. + */ + static void fillSolidBoxSolidBoxInfo( + const Box & box1, + const Box & box2, + Vector3 & a, + Vector3 & b, + Vector3 & D, + double* c, + double* ca, + double* ad, + double* bd); + + /** + Performs a simple bounding sphere check between two boxes to determine + whether these boxes could possibly intersect. This is a very + cheap operation (three dot products, two sqrts and a few others). If + it returns true, an intersection is possible, but not necessarily + guaranteed. + + @param a Vector from box A's center to an outer vertex + @param b Vector from box B's center to an outer vertex + @param D Distance between the centers of the two boxes + + @return true - if possible intersection + @return false - otherwise (This does not guarantee an intersection) + */ + static bool conservativeBoxBoxTest( + const Vector3 & a, + const Vector3 & b, + const Vector3 & D); + + /** + Determines whether two fixed solid boxes intersect. + + @note To speed up collision detection, the lastSeparatingAxis from + the previous time step can be passed in and that plane can be + checked first. If the separating axis was not saved, or if the + two boxes intersected then lastSeparatingAxis should equal -1. + + @cite Adobted from David Eberly's papers, variables used in this function + correspond to variables used in pages 6 and 7 in the pdf + http://www.magic-software.com/Intersection.html + http://www.magic-software.com/Documentation/DynamicCollisionDetection.pdf + + @param box1 Box 1. + @param box2 Box 2. + @param lastSeparatingAxis Last separating axis. + (optimization - see note) + + @return true - Intersection. + @return false - otherwise. + */ + static bool fixedSolidBoxIntersectsFixedSolidBox( + const Box& box1, + const Box& box2, + const int lastSeparatingAxis = -1); + + /** + Calculates the closest points on two lines with each other. If the + lines are parallel then using the starting point, else calculate the + closest point on each line to the other. + + @note This is very similiar to calculating the intersection of two lines. + Logically then, the two points calculated would be identical if calculated + with inifinite precision, but with the finite precision of floating point + calculations, these values could (will) differ as the line slope approaches + zero or inifinity. + + @cite variables and algorithm based on derivation at the following website: + http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm + + @param line1 Line 1. + @param line2 Line 2. + @param closest1 Closest point on line 1. + @param closest2 Closest point on line 2. + */ + static void closestPointsBetweenLineAndLine( + const Line & line1, + const Line & line2, + Vector3 & closest1, + Vector3 & closest2); + + /** + Calculates the depth of penetration between two fixed boxes. + Contact normal faces away from box1 and into box2. If there is + contact, only one contact point is returned. The minimally + violated separating plane is computed + - if the separating axis corresponds to a face + the contact point is half way between the deepest vertex + and the face + - if the separating axis corresponds to two edges + the contact point is the midpoint of the smallest line + segment between the two edge lines + + @note This is very similiar to calculating the intersection of two lines. + Logically then, the two points calculated would be identical if calculated + with inifinite precision, but with the finite precision of floating point + calculations, these values could (will) differ as the line slope approaches + zero or inifinity. + + @cite adobted from David Eberly's papers, variables used in this function + correspond to variables used in pages 6 and 7 in the pdf + http://www.magic-software.com/Intersection.html + http://www.magic-software.com/Documentation/DynamicCollisionDetection.pdf + + @param box1 Box 1 + @param box2 Box 2 + @param contactPoints Contact point between boxes. [Post Condition] + @param contactNormals Surface normal at contact point. [Post Condition] + @param lastSeparatingAxis Last separating axis. (Used for optimization) + + @return Depth of penetration between the two boxes. If there is no + intersection between the boxes, then a negative value is returned. + */ + static float penetrationDepthForFixedBoxFixedBox( + const Box& box1, + const Box& box2, + Array& contactPoints, + Array& contactNormals, + const int lastSeparatingAxis = -1); + + /** + Calculates the depth of penetration between two fixed spheres as well + as the deepest point of Sphere A that penetrates Sphere B. The normal + returned points away from the object A, although it may + represent a perpendicular to either the faces of object B or object A + depending on their relative orientations. + + @param sphereA Fixed Sphere A. + @param sphereB Fixed Sphere B. + @param contactPoints Sphere A's deepest point that penetrates Sphere B. + [Post Condition] + @param contactNormals Normal at penetration point. [Post Condition] + + @return Depth of penetration. If there is no intersection between the + objects then the depth will be a negative value. + */ + static float penetrationDepthForFixedSphereFixedSphere( + const class Sphere& sphereA, + const Sphere& sphereB, + Array& contactPoints, + Array& contactNormals = ignoreArray); + + /** + Calculates the depth of penetration between a fixed sphere and a fixed + box as well as the deepest point of the sphere that penetrates the box + and the normal at that intersection. + + @note There are three possible intersections between a sphere and box. + - Sphere completely contained in the box + - Sphere intersects one edge + - Sphere intersects one vertex + + The contact point and contact normal vary for each of these situations. + - Sphere contained in Box: + - Normal is based on side of least penetration (as is the depth calculation). + - Point is based on center of sphere + - Sphere intersects one edge + - Normal is based on vector from the box center to the point of depth. + - Point is closest point to the sphere on the line + - Sphere intersects one vertex + - Normal is based on vector from the box center to the vertex of penetration. + - Point is vertex of penetration. + + @cite Adapted from Jim Arvo's method in Graphics Gems + See also http://www.win.tue.nl/~gino/solid/gdc2001depth.pdf + + @param sphere Fixed Sphere. + @param box Fixed Box. + @param contactPoints Sphere point that penetrates the box. [Post Condition] + @param contactNormals Normal at the penetration point. [Post Condition] + + @return Depth of penetration. If there is no intersection between the + objects then the depth will be a negative value. + */ + static float penetrationDepthForFixedSphereFixedBox( + const Sphere& sphere, + const Box& box, + Array& contactPoints, + Array& contactNormals = ignoreArray); + + /** + Calculates the depth of penetration between a Fixed Sphere and a Fixed + Plane as well as the deepest point of the sphere that penetrates the plane + and the plane normal at that intersection. + + @param sphereA Fixed Sphere. + @param planeB Fixed Plane. + @param contactPoints Sphere point that penetrates the plane. + [Post Condition] + @param contactNormals Normal at penetration point. [Post Condition] + + @return Depth of penetration. If there is no intersection between the + objects then the depth will be a negative value. + */ + static float penetrationDepthForFixedSphereFixedPlane( + const Sphere& sphereA, + const class Plane& planeB, + Array& contactPoints, + Array& contactNormals = ignoreArray); + + /** + Calculates the depth of penetration between a fixed box and a fixed + plane as well as the vertexes of the box that penetrate the plane + and the plane normals at those intersections. + + @param box Fixed Box. + @param plane Fixed Plane. + @param contactPoints Box points that penetrate the plane. + [Post Condition] + @param contactNormals Normals at penetration points [Post Condition] + + @return Depth of penetration. If there is no intersection between the + objects then the depth will be a negative value. + */ + static float penetrationDepthForFixedBoxFixedPlane( + const Box& box, + const Plane& plane, + Array& contactPoints, + Array& contactNormals = ignoreArray); + + /** + Calculates time between the intersection of a moving point and a fixed + plane. + + @note This is only a one sided collision test. The side defined by + the plane's surface normal is the only one tested. For a two sided + collision, call the function once for each side's surface normal. + + @param point Moving point. + @param velocity Point's velocity. + @param plane Fixed plane. + @param location Location of collision. [Post Condition] + (Infinite vector on no collision) + @param outNormal Plane's surface normal. [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingPointFixedPlane( + const Vector3& point, + const Vector3& velocity, + const class Plane& plane, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving point and a fixed + triangle. + + @note This is only a one sided collision test. The side defined by + the triangle's surface normal is the only one tested. For a two sided + collision, call the function once for each side's surface normal. + + @param orig Moving point. + @param dir Point's velocity. + @param v0 Triangle vertex 1. + @param v1 Triangle vertex 2. + @param v2 Triangle vertex 3 + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + inline static float collisionTimeForMovingPointFixedTriangle( + const Vector3& orig, + const Vector3& dir, + const Vector3& v0, + const Vector3& v1, + const Vector3& v2) { + return Ray::fromOriginAndDirection(orig, dir).intersectionTime(v0, v1, v2); + } + + /** + Calculates time between the intersection of a moving point and a fixed + triangle. + + @note This is only a one sided collision test. The side defined by + the triangle's surface normal is the only one tested. For a two sided + collision, call the function once for each side's surface normal. + + @param orig Moving point. + @param dir Point's velocity. + @param v0 Triangle vertex 1. + @param v1 Triangle vertex 2. + @param v2 Triangle vertex 3 + @param location Location of collision. [Post Condition] + (Infinite vector on no collision) + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + inline static float collisionTimeForMovingPointFixedTriangle( + const Vector3& orig, + const Vector3& dir, + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + Vector3& location) { + float t = collisionTimeForMovingPointFixedTriangle(orig, dir, v0, v1, v2); + if (t < finf()) { + location = orig + dir * t; + } + return t; + } + + /** + Calculates time between the intersection of a moving point and a fixed + triangle. + + @note This is only a one sided collision test. The side defined by + the triangle's surface normal is the only one tested. For a two sided + collision, call the function once for each side's surface normal. + + @param orig Moving point. + @param dir Point's velocity. + @param tri Fixed triangle. + @param location Location of collision. [Post Condition] + (Infinite vector on no collision) + @param normal Triangle's surface normal. [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + inline static float collisionTimeForMovingPointFixedTriangle( + const Vector3& orig, + const Vector3& dir, + const Triangle& tri, + Vector3& location = ignore, + Vector3& normal = ignore) { + + float t = collisionTimeForMovingPointFixedTriangle( + orig, dir, tri.vertex(0), tri.vertex(1), tri.vertex(2)); + + if ((t < finf()) && (&location != &ignore)) { + location = orig + dir * t; + normal = tri.normal(); + } + return t; + } + + /** + Calculates time between the intersection of a moving point and a fixed + triangle. + + @note This is only a one sided collision test. The side defined by + the triangle's surface normal is the only one tested. For a two sided + collision, call the function once for each side's surface normal. + + @param orig Moving point. + @param dir Point's velocity. + @param v0 Triangle vertex 1. + @param v1 Triangle vertex 2. + @param v2 Triangle vertex 3 + @param location Location of collision. [Post Condition] + (Infinite vector on no collision) + @param normal Triangle's surface normal. [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + inline static float collisionTimeForMovingPointFixedTriangle( + const Vector3& orig, + const Vector3& dir, + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + Vector3& location, + Vector3& normal) { + float t = collisionTimeForMovingPointFixedTriangle(orig, dir, v0, v1, v2); + if (t < finf()) { + location = orig + dir * t; + normal = (v1 - v0).cross(v2 - v0).direction(); + } + return t; + } + + /** + If the ray origin is inside the box, returns inf() but inside + is set to true. + Beta API + + @cite Andrew Woo, from "Graphics Gems", Academic Press, 1990 + @cite Optimized code by Pierre Terdiman, 2000 (~20-30% faster on Celeron 500) + @cite Epsilon value added by Klaus Hartmann + @cite http://www.codercorner.com/RayAABB.cpp + */ + static float collisionTimeForMovingPointFixedAABox( + const Vector3& point, + const Vector3& velocity, + const class AABox& box, + Vector3& outLocation, + bool& inside = ignoreBool, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving point and a fixed + Axis-Aligned Box (AABox). + + @note Avoids the sqrt from collisionTimeForMovingPointFixedAABox. + + @param point Moving point. + @param velocity Sphere's velocity. + @param box Fixed AAbox. + @param location Location of collision. [Post Condition] + @param Inside Does the ray originate inside the box? [Post Condition] + @param normal Box's surface normal to collision [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static bool collisionLocationForMovingPointFixedAABox( + const Vector3& point, + const Vector3& velocity, + const class AABox& box, + Vector3& outLocation, + bool& inside = ignoreBool, + Vector3& normal = ignore); + + + /** + @brief Calculates intersection of a ray and a static + Axis-Aligned Box (AABox). + + @note Avoids the sqrt from collisionTimeForMovingPointFixedAABox; + early-out branches and operations optimized for Intel Core2 architecture. + + @param invDir 1/dir + @param location Location of collision. [Post Condition] + @param inside Does the ray originate inside the box? [Post Condition] + + @return True if the ray hits the box + */ + static bool __fastcall rayAABox( + const Ray& ray, + const Vector3& invDir, + const AABox& box, + const Vector3& boxCenter, + float boundingRadiusSquared, + Vector3& location, + bool& inside); + + /** + Calculates time between the intersection of a moving point and a fixed + sphere. + + @note When ray is starts inside the rectangle, the exiting intersection + is detected. + + @param point Moving point. + @param velocity Point's velocity. + @param sphere Fixed Sphere. + @param outLocation Location of collision. [Post Condition] + @param outNormal Sphere's surface normal to collision [Post Condition] + \param solid If true, rays inside the sphere immediately intersect (good for collision detection). If false, they hit the opposite side of the sphere (good for ray tracing). + + @return Time until collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingPointFixedSphere( + const Vector3& point, + const Vector3& velocity, + const class Sphere& sphere, + Vector3& outLocation, + Vector3& outNormal = ignore, + bool solid = false); + + /** + Calculates time between the intersection of a moving point and a fixed + box. + + @note If the point is already inside the box, no collision: inf is returned. + + @param point Moving point. + @param velocity Sphere's velocity. + @param box Fixed box. + @param location Position of collision. [Post Condition] + @param outNormal Box's surface normal to collision [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingPointFixedBox( + const Vector3& point, + const Vector3& velocity, + const class Box& box, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving point and a fixed + rectangle defined by the points v0, v1, v2, & v3. + + @note This is only a one sided collision test. The side defined by + the rectangle's surface normal is the only one tested. For a two sided + collision, call the function once for each side's surface normal. + + @param point Moving point. + @param velocity Sphere's velocity. + @param v0 Rectangle vertex 1. + @param v1 Rectangle vertex 2. + @param v2 Rectangle vertex 3 + @param v3 Rectangle vertex 4. + @param location Location of collision [Post Condition] + @param outNormal Rectangle's surface normal. [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingPointFixedRectangle( + const Vector3& point, + const Vector3& velocity, + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving point and a fixed + capsule. + + @param point Moving point. + @param velocity Point's velocity. + @param capsule Fixed capsule. + @param outLocation Location of collision. [Post Condition] + @param outNormal Capsule's surface normal to collision [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingPointFixedCapsule( + const Vector3& point, + const Vector3& velocity, + const class Capsule& capsule, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving sphere and a fixed + triangle. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param plane Fixed Plane. + @param outLocation Location of collision -- not center position of sphere + at the collision time. [Post Condition] + @param outNormal Box's surface normal to collision [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingSphereFixedPlane( + const class Sphere& sphere, + const Vector3& velocity, + const class Plane& plane, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving sphere and a fixed + triangle. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param triangle Fixed Triangle. (collisions can happen on the back side of the triangle) + @param outLocation Location of collision, if collision occurs -- not center position of sphere + at the collision time. If there is interpenetration at the start, this point may be inside + the sphere. + @param b Barycentric coordinates. These are not valid unless collision occurs. + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingSphereFixedTriangle( + const class Sphere& sphere, + const Vector3& velocity, + const Triangle& triangle, + Vector3& outLocation, + float b[3] = (float*)&ignore); + + /** + Calculates time between the intersection of a moving sphere and a fixed + rectangle defined by the points v0, v1, v2, & v3. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param v0 Rectangle vertex 1. + @param v1 Rectangle vertex 2. + @param v2 Rectangle vertex 3 + @param v3 Rectangle vertex 4. + @param outLocation Location of collision -- not center position of sphere + at the collision time. [Post Condition] + @param outNormal Box's surface normal to collision [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingSphereFixedRectangle( + const class Sphere& sphere, + const Vector3& velocity, + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving sphere and a fixed + box. + + @note This function will not detect an intersection between a moving object + that is already interpenetrating the fixed object. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param box Fixed box. + @param location Location of collision -- not center position of sphere + at the collision time. [Post Condition] + @param outNormal Box's surface normal to collision [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingSphereFixedBox( + const class Sphere& sphere, + const Vector3& velocity, + const class Box& box, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** Calculates time between the intersection of a moving sphere + and a fixed sphere. + + If they are already interpenetrating, returns 0 and @a + location is the closest point on the surface of the fixed sphere + to the center of the moving sphere. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param fixedSphere Fixed Sphere. + @param outLocation Location of collision -- not center position of sphere + at the collision time. [Post Condition] + @param outNormal Moving sphere's surface normal to collision [Post Condition] + + @return Time until collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingSphereFixedSphere( + const Sphere& sphere, + const Vector3& velocity, + const Sphere& fixedSphere, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Calculates time between the intersection of a moving sphere and a fixed + capsule. + + @note This won't detect a collision if the sphere is already + interpenetrating the capsule. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param capsule Fixed capsule. + @param location Location of collision -- not center position of sphere + at the collision time. [Post Condition] + @param outNormal Capsule's surface normal to the collision [Post Condition] + + @return Time til collision. If there is no collision then the return + value will be inf(). + */ + static float collisionTimeForMovingSphereFixedCapsule( + const class Sphere& sphere, + const Vector3& velocity, + const class Capsule& capsule, + Vector3& outLocation, + Vector3& outNormal = ignore); + + /** + Finds the direction of bounce that a sphere would have when it + intersects an object with the given time of collision, the + collision location and the collision normal. + + @note This function works like a pong style ball bounce. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param collisionTime Time of collision. + @param collisionLocation Collision location. + @param collisionNormal Surface collision normal. + + @return Direction of bounce. + */ + static Vector3 bounceDirection( + const class Sphere& sphere, + const Vector3& velocity, + const float collisionTime, + const Vector3& collisionLocation, + const Vector3& collisionNormal); + + /** + Finds the direction of slide given a moving sphere, its velocity, the + time of collision and the collision location. This function works as + if the sphere intersects the surface and continues to hug it. + + @note The result will work well for calculating the movement of a player + who collides with an object and continues moving along the object instead + of just bouncing off it. + + @param sphere Moving sphere. + @param velocity Sphere's velocity. + @param collisionTime Time of collision + @param collisionLocation Collision location. + + @return Direction of slide. + */ + static Vector3 slideDirection( + const class Sphere& sphere, + const Vector3& velocity, + const float collisionTime, + const Vector3& collisionLocation); + + /** + Finds the closest point on a line segment to a given point. + + @param v0 line vertex 1. + @param v1 line vertex 2. + @param point External point. + + @return Closests point to point on the line segment. + */ + static Vector3 closestPointOnLineSegment( + const Vector3& v0, + const Vector3& v1, + const Vector3& point); + + /** + Finds the closest point on a line segment to a given point. + + @note This is an optimization to closestPointOnLineSegment. Edge length + and direction can be used in this function if already pre-calculated. This + prevents doing the same work twice. + + @param v0 line vertex 0. + @param v1 line vertex 1. + @param edgeDirection The direction of the segment (unit length). + @param edgeLength The length of the segment. + @param point External point. + + @return Closests point to point on the line segment. + */ + static Vector3 closestPointOnLineSegment( + const Vector3& v0, + const Vector3& v1, + const Vector3& edgeDirection, + float edgeLength, + const Vector3& point); + + /** + Finds the closest point on the perimeter of the triangle to an external point; + given a triangle defined by three points v0, v1, & v2, and the external point. + + @param v0 Triangle vertex 0. + @param v1 Triangle vertex 1. + @param v2 Triangle vertex 2. + @param point External point. + + @return Closests point to point on the perimeter of the + triangle. + */ + static Vector3 closestPointOnTrianglePerimeter( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& point); + + /** + Finds the closest point on the perimeter of the triangle to an external point; + given a triangle defined by the array of points v, its edge directions and + their lengths, as well as the external point. + + @note This is an optimization to closestPointToTrianglePerimeter. Edge length + and direction can be used in this function if already pre-calculated. This + prevents doing the same work twice. + + @param v Triangle vertices. + @param point External point. + @param edgeIndex The point lies on the edge between v[edgeIndex] and v[(edgeIndex + 1) % 3] + + @return Closest point to point on the perimeter of the + triangle. + */ + static Vector3 closestPointOnTrianglePerimeter( + const Vector3 v[3], + const Vector3 edgeDirection[3], + const float edgeLength[3], + const Vector3& point, + int& edgeIndex); + + /** + Tests whether a point is contained within the triangle defined by + v0, v1, and v2 and its plane's normal. + + @param v0 Triangle vertex 0. + @param v1 Triangle vertex 1. + @param v2 Triangle vertex 2. + @param normal Normal to triangle's plane. + @param point The point in question. + @param primaryAxis Primary axis of triangle. This will be detected + if not given. This parameter is provided as an optimization. + @param b Barycentric coordinates; b[i] is the weight on v[i] + + @return true - if point is inside the triangle. + @return false - otherwise + */ + static bool isPointInsideTriangle( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& normal, + const Vector3& point, + float b[3], + Vector3::Axis primaryAxis = Vector3::DETECT_AXIS); + + inline static bool isPointInsideTriangle( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& normal, + const Vector3& point, + Vector3::Axis primaryAxis = Vector3::DETECT_AXIS) { + + float b[3]; + return isPointInsideTriangle(v0, v1, v2, normal, point, b, primaryAxis); + } + + /** + Tests for the intersection of a moving sphere and a fixed box in a + given time limit. + + @note Returns true if any part of the sphere is inside the box + during the time period (inf means "ever"). Useful for + performing bounding-box collision detection. + + @param sphere Moving sphere. + @param velocity Velocity of moving sphere. + @param box Fixed box. + @param timeLimit Time limit for intersection test. + + @return true - if the two objects will touch. + @return false - if there is no intersection. + */ + static bool movingSpherePassesThroughFixedBox( + const Sphere& sphere, + const Vector3& velocity, + const Box& box, + double timeLimit = inf()); + + /** + Tests for the intersection of a moving sphere and a fixed sphere in a + given time limit. + + @note This function will not detect an intersection between a moving object + that is already interpenetrating the fixed object. + + @param sphere Moving sphere. + @param velocity Velocity of moving sphere. + @param fixedSphere Fixed sphere. + @param timeLimit Time limit for intersection test. + + @return true - if the two spheres will touch. + @return false - if there is no intersection. + */ + static bool movingSpherePassesThroughFixedSphere( + const Sphere& sphere, + const Vector3& velocity, + const Sphere& fixedSphere, + double timeLimit = inf()); + + /** + Tests for the intersection of two fixed spheres. + + @param sphere1 Fixed sphere 1. + @param sphere2 Fixed sphere 2. + + @return true - if the two spheres touch. + @return false - if there is no intersection. + */ + static bool fixedSolidSphereIntersectsFixedSolidSphere( + const Sphere& sphere1, + const Sphere& sphere2); + + /** + Tests for the intersection of a fixed sphere and a fixed box. + + @param sphere Fixed sphere. + @param box Fixed box. + + @return true - if the two objects touch. + @return false - if there is no intersection. + */ + static bool fixedSolidSphereIntersectsFixedSolidBox( + const Sphere& sphere, + const Box& box); + + static bool fixedSolidSphereIntersectsFixedTriangle( + const Sphere& sphere, + const Triangle& triangle); + + static bool fixedSolidBoxIntersectsFixedTriangle( + const AABox& box, + const Triangle& triangle); + + /** + Tests whether a point is inside a rectangle defined by the vertexes + v0, v1, v2, & v3, and the rectangle's plane normal. + + @param v0 Rectangle vertex 1. + @param v1 Rectangle vertex 2. + @param v2 Rectangle vertex 3. + @param v3 Rectangle vertex 4. + @param normal Normal to rectangle's plane. + @param point The point in question. + + @return true - if point is inside the rectangle. + @return false - otherwise + */ + static bool isPointInsideRectangle( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + const Vector3& normal, + const Vector3& point); + + /** + Finds the closest point on the perimeter of the rectangle to an + external point; given a rectangle defined by four points v0, v1, + v2, & v3, and the external point. + + @param v0 Rectangle vertex 1. + @param v1 Rectangle vertex 2. + @param v2 Rectangle vertex 3. + @param v3 Rectangle vertex 4. + @param point External point. + + @return Closests point to point on the perimeter of the + rectangle. + */ + static Vector3 closestPointToRectanglePerimeter( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + const Vector3& point); + + /** + Finds the closest point in the rectangle to an external point; Given + a rectangle defined by four points v0, v1, v2, & v3, and the external + point. + + @param v0 Rectangle vertex 1. + @param v1 Rectangle vertex 2. + @param v2 Rectangle vertex 3 + @param v3 Rectangle vertex 4. + @param point External point. + + @return Closet point in the rectangle to the external point. + */ + static Vector3 closestPointToRectangle( + const Vector3& v0, + const Vector3& v1, + const Vector3& v2, + const Vector3& v3, + const Vector3& point); +}; + +} // namespace + +#endif // G3D_COLLISIONDETECTION_H diff --git a/externals/g3dlite/G3D/Color1.h b/externals/g3dlite/G3D/Color1.h new file mode 100644 index 0000000..0f68c84 --- /dev/null +++ b/externals/g3dlite/G3D/Color1.h @@ -0,0 +1,144 @@ +/** + @file Color1.h + + Monochrome Color class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2007-01-31 + @edited 2009-03-20 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_COLOR1_H +#define G3D_COLOR1_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/HashTrait.h" +#include + +namespace G3D { + +/** + Monochrome color. This is just a float, but it has nice semantics + because a scaling by 255 automatically occurs when switching between + fixed point (Color1uint8) and floating point (Color1) formats. + */ +class Color1 { +private: + // Hidden operators + bool operator<(const Color1&) const; + bool operator>(const Color1&) const; + bool operator<=(const Color1&) const; + bool operator>=(const Color1&) const; + +public: + float value; + + /** + Initializes to 0 + */ + inline Color1() : value(0) {} + + Color1(class BinaryInput& bi); + + inline explicit Color1(float v) : value(v) { + } + + inline bool isZero() const { + return value == 0.0f; + } + + inline bool isOne() const { + return value == 1.0f; + } + + static const Color1& one(); + + static const Color1& zero(); + + /** Returns the value three times */ + class Color3 rgb() const; + + Color1 (const class Color1uint8& other); + + void serialize(class BinaryOutput& bo) const; + void deserialize(class BinaryInput& bi); + + Color1 operator+ (const Color1& other) const { + return Color1(value + other.value); + } + + Color1 operator+ (const float other) const { + return Color1(value + other); + } + + Color1& operator+= (const Color1 other) { + value += other.value; + return *this; + } + + Color1& operator-= (const Color1 other) { + value -= other.value; + return *this; + } + + Color1 operator- (const Color1& other) const { + return Color1(value - other.value); + } + + Color1 operator- (const float other) const { + return Color1(value - other); + } + + Color1 operator- () const { + return Color1(-value); + } + + Color1 operator* (const Color1& other) const { + return Color1(value * other.value); + } + + Color1 operator* (const float other) const { + return Color1(value * other); + } + + Color1 operator/ (const Color1& other) const { + return Color1(value / other.value); + } + + Color1 operator/ (const float other) const { + return Color1(value / other); + } + + inline Color1 max(const Color1& other) const { + return Color1(G3D::max(value, other.value)); + } + + inline Color1 min(const Color1& other) const { + return Color1(G3D::min(value, other.value)); + } + + inline Color1 lerp(const Color1& other, float a) const { + return Color1(value + (other.value - value) * a); + + } + + inline size_t hashCode() const { + return (size_t)(value * 0xFFFFFF); + } +}; + +} + +template <> +struct HashTrait { + static size_t hashCode(const G3D::Color1& key) { + return key.hashCode(); + } +}; + + +#endif diff --git a/externals/g3dlite/G3D/Color1uint8.h b/externals/g3dlite/G3D/Color1uint8.h new file mode 100644 index 0000000..092099d --- /dev/null +++ b/externals/g3dlite/G3D/Color1uint8.h @@ -0,0 +1,91 @@ +/** + @file Color1uint8.h + + @maintainer Morgan McGuire, graphics3d.com + + @created 2007-01-30 + @edited 2007-01-30 + + Copyright 2000-2007, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_COLOR1UINT8_H +#define G3D_COLOR1UINT8_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" + +namespace G3D { + +/** + Represents a Color1 as a packed integer. Convenient + for creating unsigned int vertex arrays. + + WARNING: Integer color formats are different than + integer vertex formats. The color channels are automatically + scaled by 255 (because OpenGL automatically scales integer + colors back by this factor). So Color3(1,1,1) == Color3uint8(255,255,255) + but Vector3(1,1,1) == Vector3int16(1,1,1). + + Note: + Conversion of a float32 to uint8 is accomplished by min(iFloor(f * 256)) and + back to float32 by u / 255.0f. This gives equal size intervals. +Consider a number line from 0 to 1 and a corresponding one from 0 to 255. If we use iRound(x * 255), then the mapping for three critical intervals are: + +

+let s = 0.5/255
+  float             int       size
+[0, s)           -> 0          s
+[s, s * 3)       -> 1         2*s
+(1 - s, 1]       -> 255        s
+
+ +If we use max(floor(x * 256), 255), then we get: + +
+let s = 1/256
+  float             int           size
+[0, s)           -> 0               s
+[s, 2 * s)       -> 1               s
+(1 - s, 1]       -> 255             s
+
+and the intervals are all the same size, thus giving equal precision to all values. + */ +G3D_BEGIN_PACKED_CLASS(1) +class Color1uint8 { +private: + // Hidden operators + bool operator<(const Color1uint8&) const; + bool operator>(const Color1uint8&) const; + bool operator<=(const Color1uint8&) const; + bool operator>=(const Color1uint8&) const; + +public: + + uint8 value; + + Color1uint8() : value(0) {} + + explicit Color1uint8(const uint8 _v) : value(_v) {} + + Color1uint8(const class Color1& c); + + Color1uint8(class BinaryInput& bi); + + void serialize(class BinaryOutput& bo) const; + + void deserialize(class BinaryInput& bi); + + inline bool operator==(const Color1uint8& other) const { + return value == other.value; + } + + inline bool operator!=(const Color1uint8& other) const { + return value != other.value; + } + +} +G3D_END_PACKED_CLASS(1) +} +#endif diff --git a/externals/g3dlite/G3D/Color3.h b/externals/g3dlite/G3D/Color3.h new file mode 100644 index 0000000..bffe434 --- /dev/null +++ b/externals/g3dlite/G3D/Color3.h @@ -0,0 +1,432 @@ +/** + @file Color3.h + + Color class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @cite Portions based on Dave Eberly's Magic Software Library + at http://www.magic-software.com + + @created 2001-06-02 + @edited 2009-04-28 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Color3_h +#define G3D_Color3_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/HashTrait.h" +#include "G3D/Color1.h" +#include + +namespace G3D { +class Any; + +/** + Do not subclass-- this implementation makes assumptions about the + memory layout. + */ +class Color3 { +private: + // Hidden operators + bool operator<(const Color3&) const; + bool operator>(const Color3&) const; + bool operator<=(const Color3&) const; + bool operator>=(const Color3&) const; + +public: + /** + Does not initialize fields. + */ + Color3(); + + /** \param any Must be in one of the following forms: + - Color3(#, #, #) + - Color3::fromARGB(#) + - Color3{r = #, g = #, b = #) + - Color3::one() + - Color3::zero() + */ + Color3(const Any& any); + + /** Converts the Color3 to an Any. */ + operator Any() const; + + explicit Color3(class BinaryInput& bi); + + Color3(float r, float g, float b); + Color3(float v) : r(v), g(v), b(v) {} + + explicit Color3(const class Vector3& v); + + explicit Color3(const float value[3]); + + /** Returns this color */ + const Color3& rgb() const { + return *this; + } + + /** + Initialize from another color. + */ + Color3 (const Color3& other); + + Color3 (const class Color3uint8& other); + + inline bool isZero() const { + return (r == 0.0f) && (g == 0.0f) && (b == 0.0f); + } + + inline bool isOne() const { + return (r == 1.0f) && (g == 1.0f) && (b == 1.0f); + } + + bool isFinite() const; + + /** + Initialize from an HTML-style color (e.g. 0xFF0000 == RED) + */ + static Color3 fromARGB(uint32); + + /** Returns one of the color wheel colors (e.g. RED, GREEN, CYAN). + Does not include white, black, or gray. */ + static const Color3& wheelRandom(); + + /** Generate colors according to the ANSI color set, mod 16. + \sa pastelMap */ + static Color3 ansiMap(uint32 i); + + /** + Generate colors using a hash such that adjacent values + are unlikely to have similar colors. + + Useful for rendering with + stable but arbitrary colors, e.g., when debugging a mesh + algorithm. + + \sa ansiMap + */ + static Color3 pastelMap(uint32 i); + + /** + * Channel value. + */ + float r, g, b; + + void serialize(class BinaryOutput& bo) const; + void deserialize(class BinaryInput& bi); + + // access vector V as V[0] = V.r, V[1] = V.g, V[2] = V.b + // + // WARNING. These member functions rely on + // (1) Color3 not having virtual functions + // (2) the data packed in a 3*sizeof(float) memory block + const float& operator[] (int i) const; + float& operator[] (int i); + + // assignment and comparison + Color3& operator= (const Color3& rkVector); + bool operator== (const Color3& rkVector) const; + bool operator!= (const Color3& rkVector) const; + size_t hashCode() const; + + // arithmetic operations + Color3 operator+ (const Color3& rkVector) const; + Color3 operator- (const Color3& rkVector) const; + inline Color3 operator* (float s) const { + return Color3(r * s, g * s, b * s); + } + Color3 operator* (const Color3& rkVector) const; + inline Color3 operator/ (float fScalar) const { + return (*this) * (1.0f / fScalar); + } + Color3 operator- () const; + + // arithmetic updates + Color3& operator+= (const Color3& rkVector); + Color3& operator-= (const Color3& rkVector); + Color3& operator*= (const Color3& rkVector); + Color3& operator*= (float fScalar); + Color3& operator/= (float fScalar); + + bool fuzzyEq(const Color3& other) const; + bool fuzzyNe(const Color3& other) const; + + // vector operations + float length () const; + Color3 direction() const; + float squaredLength () const; + float dot (const Color3& rkVector) const; + float unitize (float fTolerance = 1e-06); + Color3 cross (const Color3& rkVector) const; + Color3 unitCross (const Color3& rkVector) const; + + inline Color3 pow(const Color3& other) const { + return Color3(::pow(r, other.r), ::pow(g, other.g), ::pow(b, other.b)); + } + + inline Color3 pow(float other) const { + return Color3(::pow(r, other), ::pow(g, other), ::pow(b, other)); + } + + inline Color3 max(const Color3& other) const { + return Color3(G3D::max(r, other.r), G3D::max(g, other.g), G3D::max(b, other.b)); + } + + inline Color3 min(const Color3& other) const { + return Color3(G3D::min(r, other.r), G3D::min(g, other.g), G3D::min(b, other.b)); + } + + /** Smallest element */ + inline float min() const { + return G3D::min(G3D::min(r, g), b); + } + + /** Largest element */ + inline float max() const { + return G3D::max(G3D::max(r, g), b); + } + + inline Color3 lerp(const Color3& other, float a) const { + return (*this) + (other - *this) * a; + + } + + inline float sum() const { + return r + g + b; + } + + inline float average() const { + return sum() / 3.0f; + } + + + /** + * Converts from HSV to RGB , note: toHSV(fromHSV(_hsv)) may not be _hsv, if it is at a grey point or black point. + * The components of _hsv should lie in the unit interval. + * @cite Alvy Ray Smith SIGGRAPH 1978 "Color Gamut Transform Pairs" + **/ + static Color3 fromHSV(const Vector3& _hsv); + static Vector3 toHSV(const Color3& _rgb); + + /** Duplicates the matlab jet colormap maps [0,1] --> (r,g,b) where blue is close to 0 and red is close to 1. */ + static Color3 jetColorMap(const float& val); + + /** Returns colors with maximum saturation and value @param hue [0, 1]*/ + static Color3 rainbowColorMap(float hue); + + std::string toString() const; + + /** Random unit vector */ + static Color3 random(); + + // Special values. + // Intentionally not inlined: see Matrix3::identity() for details. + static const Color3& red(); + static const Color3& green(); + static const Color3& blue(); + static const Color3& purple(); + static const Color3& cyan(); + static const Color3& yellow(); + static const Color3& brown(); + static const Color3& orange(); + static const Color3& black(); + static const Color3& gray(); + static const Color3& white(); + + static const Color3& zero(); + static const Color3& one(); + + inline Color3 bgr() const { + return Color3(b, g, r); + } +}; + +inline G3D::Color3 operator* (float s, const G3D::Color3& c) { + return c * s; +} + +inline G3D::Color3 operator* (G3D::Color1& s, const G3D::Color3& c) { + return c * s.value; +} + +inline G3D::Color3 operator* (const G3D::Color3& c, G3D::Color1& s) { + return c * s.value; +} + + +//---------------------------------------------------------------------------- +inline Color3::Color3 () { +} + +//---------------------------------------------------------------------------- + +inline Color3::Color3(float fX, float fY, float fZ) { + r = fX; + g = fY; + b = fZ; +} + +//---------------------------------------------------------------------------- +inline Color3::Color3(const float afCoordinate[3]) { + r = afCoordinate[0]; + g = afCoordinate[1]; + b = afCoordinate[2]; +} + +//---------------------------------------------------------------------------- +inline Color3::Color3 (const Color3& rkVector) { + r = rkVector.r; + g = rkVector.g; + b = rkVector.b; +} + +//---------------------------------------------------------------------------- +inline float& Color3::operator[] (int i) { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- + +inline const float& Color3::operator[] (int i) const { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- + +inline bool Color3::fuzzyEq(const Color3& other) const { + return G3D::fuzzyEq((*this - other).squaredLength(), 0); +} + +//---------------------------------------------------------------------------- + +inline bool Color3::fuzzyNe(const Color3& other) const { + return G3D::fuzzyNe((*this - other).squaredLength(), 0); +} + + +//---------------------------------------------------------------------------- +inline Color3& Color3::operator= (const Color3& rkVector) { + r = rkVector.r; + g = rkVector.g; + b = rkVector.b; + return *this; +} + +//---------------------------------------------------------------------------- +inline bool Color3::operator== (const Color3& rkVector) const { + return ( r == rkVector.r && g == rkVector.g && b == rkVector.b ); +} + +//---------------------------------------------------------------------------- +inline bool Color3::operator!= (const Color3& rkVector) const { + return ( r != rkVector.r || g != rkVector.g || b != rkVector.b ); +} + +//---------------------------------------------------------------------------- +inline Color3 Color3::operator+ (const Color3& rkVector) const { + return Color3(r + rkVector.r, g + rkVector.g, b + rkVector.b); +} + +//---------------------------------------------------------------------------- +inline Color3 Color3::operator- (const Color3& rkVector) const { + return Color3(r -rkVector.r, g - rkVector.g, b - rkVector.b); +} + +//---------------------------------------------------------------------------- +inline Color3 Color3::operator* (const Color3& rkVector) const { + return Color3(r * rkVector.r, g * rkVector.g, b * rkVector.b); +} + +//---------------------------------------------------------------------------- +inline Color3 Color3::operator- () const { + return Color3( -r, -g, -b); +} + +//---------------------------------------------------------------------------- +inline Color3& Color3::operator+= (const Color3& rkVector) { + r += rkVector.r; + g += rkVector.g; + b += rkVector.b; + return *this; +} + +//---------------------------------------------------------------------------- +inline Color3& Color3::operator-= (const Color3& rkVector) { + r -= rkVector.r; + g -= rkVector.g; + b -= rkVector.b; + return *this; +} + +//---------------------------------------------------------------------------- +inline Color3& Color3::operator*= (float fScalar) { + r *= fScalar; + g *= fScalar; + b *= fScalar; + return *this; +} + +//---------------------------------------------------------------------------- +inline Color3& Color3::operator*= (const Color3& rkVector) { + r *= rkVector.r; + g *= rkVector.g; + b *= rkVector.b; + return *this; +} +//---------------------------------------------------------------------------- +inline float Color3::squaredLength () const { + return r*r + g*g + b*b; +} + +//---------------------------------------------------------------------------- +inline float Color3::length () const { + return sqrtf(r*r + g*g + b*b); +} + +//---------------------------------------------------------------------------- +inline Color3 Color3::direction () const { + float lenSquared = r * r + g * g + b * b; + + if (lenSquared != 1.0f) { + return *this / sqrtf(lenSquared); + } else { + return *this; + } +} + +//---------------------------------------------------------------------------- +inline float Color3::dot (const Color3& rkVector) const { + return r*rkVector.r + g*rkVector.g + b*rkVector.b; +} + +//---------------------------------------------------------------------------- +inline Color3 Color3::cross (const Color3& rkVector) const { + return Color3(g*rkVector.b - b*rkVector.g, b*rkVector.r - r*rkVector.b, + r*rkVector.g - g*rkVector.r); +} + +//---------------------------------------------------------------------------- +inline Color3 Color3::unitCross (const Color3& rkVector) const { + Color3 kCross(g*rkVector.b - b*rkVector.g, b*rkVector.r - r*rkVector.b, + r*rkVector.g - g*rkVector.r); + kCross.unitize(); + return kCross; +} + + +} // namespace + + +template <> struct HashTrait { + static size_t hashCode(const G3D::Color3& key) { + return key.hashCode(); + } +}; + + +#endif diff --git a/externals/g3dlite/G3D/Color3uint8.h b/externals/g3dlite/G3D/Color3uint8.h new file mode 100644 index 0000000..bd4b00d --- /dev/null +++ b/externals/g3dlite/G3D/Color3uint8.h @@ -0,0 +1,110 @@ +/** + @file Color3uint8.h + + @maintainer Morgan McGuire, graphics3d.com + + @created 2003-04-07 + @edited 2006-06-24 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_COLOR3UINT8_H +#define G3D_COLOR3UINT8_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" + +namespace G3D { + +/** + Represents a Color3 as a packed integer. Convenient + for creating unsigned int vertex arrays. Used by + G3D::GImage as the underlying format. + + WARNING: Integer color formats are different than + integer vertex formats. The color channels are automatically + scaled by 255 (because OpenGL automatically scales integer + colors back by this factor). So Color3(1,1,1) == Color3uint8(255,255,255) + but Vector3(1,1,1) == Vector3int16(1,1,1). + */ + +G3D_BEGIN_PACKED_CLASS(1) + +class Color3uint8 { +private: + // Hidden operators + bool operator<(const Color3uint8&) const; + bool operator>(const Color3uint8&) const; + bool operator<=(const Color3uint8&) const; + bool operator>=(const Color3uint8&) const; + +public: + uint8 r; + uint8 g; + uint8 b; + + Color3uint8() : r(0), g(0), b(0) {} + + Color3uint8(const uint8 _r, const uint8 _g, const uint8 _b) : r(_r), g(_g), b(_b) {} + + Color3uint8(const class Color3& c); + + Color3uint8(class BinaryInput& bi); + + inline static Color3uint8 fromARGB(uint32 i) { + Color3uint8 c; + c.r = (i >> 16) & 0xFF; + c.g = (i >> 8) & 0xFF; + c.b = i & 0xFF; + return c; + } + + inline Color3uint8 bgr() const { + return Color3uint8(b, g, r); + } + + /** + Returns the color packed into a uint32 + (the upper byte is 0xFF) + */ + inline uint32 asUInt32() const { + return (0xFF << 24) + ((uint32)r << 16) + ((uint32)g << 8) + b; + } + + void serialize(class BinaryOutput& bo) const; + + void deserialize(class BinaryInput& bi); + + // access vector V as V[0] = V.r, V[1] = V.g, V[2] = V.b + // + // WARNING. These member functions rely on + // (1) Color3 not having virtual functions + // (2) the data packed in a 3*sizeof(uint8) memory block + uint8& operator[] (int i) const { + debugAssert((unsigned int)i < 3); + return ((uint8*)this)[i]; + } + + operator uint8* () { + return (G3D::uint8*)this; + } + + operator const uint8* () const { + return (uint8*)this; + } + + bool operator==(const Color3uint8& other) const { + return (other.r == r) && (other.g == g) && (other.b == b); + } + + bool operator!=(const Color3uint8& other) const { + return (other.r != r) && (other.g != g) && (other.b != b); + } +} +G3D_END_PACKED_CLASS(1) + +} // namespace G3D + +#endif diff --git a/externals/g3dlite/G3D/Color4.h b/externals/g3dlite/G3D/Color4.h new file mode 100644 index 0000000..d8858ab --- /dev/null +++ b/externals/g3dlite/G3D/Color4.h @@ -0,0 +1,338 @@ +/** + @file Color4.h + + Color class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @cite Portions based on Dave Eberly's Magic Software Library + at http://www.magic-software.com + + @created 2002-06-25 + @edited 2009-11-15 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Color4_h +#define G3D_Color4_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Color3.h" +#include + +namespace G3D { + +class Any; + +/** + Do not subclass-- this implementation makes assumptions about the + memory layout. + */ +class Color4 { +private: + // Hidden operators + bool operator<(const Color4&) const; + bool operator>(const Color4&) const; + bool operator<=(const Color4&) const; + bool operator>=(const Color4&) const; + +public: + + /** \param any Must be in one of the following forms: + - Color4(#, #, #, #) + - Color4::fromARGB(#) + - Color4{r = #, g = #, b = #, a = #) + */ + Color4(const Any& any); + + /** Converts the Color4 to an Any. */ + operator Any() const; + + /** + * Does not initialize fields. + */ + Color4 (); + + Color4(const Color3& c3, float a = 1.0); + + Color4(const class Color4uint8& c); + + Color4(class BinaryInput& bi); + + Color4(const class Vector4& v); + + Color4(float r, float g, float b, float a = 1.0); + + static const Color4& one(); + + Color4(float value[4]); + + /** + * Initialize from another color. + */ + Color4(const Color4& other); + + + inline bool isZero() const { + return (r == 0.0f) && (g == 0.0f) && (b == 0.0f) && (a == 0.0f); + } + + inline bool isOne() const { + return (r == 1.0f) && (g == 1.0f) && (b == 1.0f) && (a == 1.0f); + } + + void serialize(class BinaryOutput& bo) const; + void deserialize(class BinaryInput& bi); + + /** + Initialize from an HTML-style color (e.g. 0xFFFF0000 == RED) + */ + static Color4 fromARGB(uint32); + + /** + * Channel values. + */ + float r, g, b, a; + + inline Color3 rgb() const { + return Color3(r, g, b); + } + + // access vector V as V[0] = V.r, V[1] = V.g, V[2] = V.b, v[3] = V.a + // + // WARNING. These member functions rely on + // (1) Color4 not having virtual functions + // (2) the data packed in a 3*sizeof(float) memory block + float& operator[] (int i) const; + + // assignment and comparison + Color4& operator= (const Color4& rkVector); + bool operator== (const Color4& rkVector) const; + bool operator!= (const Color4& rkVector) const; + size_t hashCode() const; + + // arithmetic operations + Color4 operator+ (const Color4& rkVector) const; + Color4 operator- (const Color4& rkVector) const; + Color4 operator* (float fScalar) const; + inline Color4 operator* (const Color4& k) const { + return Color4(r*k.r, g*k.g, b*k.b, a * k.a); + } + Color4 operator/ (float fScalar) const; + Color4 operator- () const; + friend Color4 operator* (double fScalar, const Color4& rkVector); + + // arithmetic updates + Color4& operator+= (const Color4& rkVector); + Color4& operator-= (const Color4& rkVector); + Color4& operator*= (float fScalar); + Color4& operator/= (float fScalar); + + bool fuzzyEq(const Color4& other) const; + bool fuzzyNe(const Color4& other) const; + + std::string toString() const; + + inline Color4 max(const Color4& other) const { + return Color4(G3D::max(r, other.r), G3D::max(g, other.g), G3D::max(b, other.b), G3D::max(a, other.a)); + } + + inline Color4 min(const Color4& other) const { + return Color4(G3D::min(r, other.r), G3D::min(g, other.g), G3D::min(b, other.b), G3D::min(a, other.a)); + } + + /** r + g + b + a */ + inline float sum() const { + return r + g + b + a; + } + + inline Color4 lerp(const Color4& other, float a) const { + return (*this) + (other - *this) * a; + + } + + // Special values. + // Intentionally not inlined: see Matrix3::identity() for details. + static const Color4& zero(); + static const Color4& clear(); + + static const Color4& inf(); + static const Color4& nan(); + + inline bool isFinite() const { + return G3D::isFinite(r) && G3D::isFinite(g) && G3D::isFinite(b) && G3D::isFinite(a); + } + + inline Color3 bgr() const { + return Color3(b, g, r); + } +}; + +/** + Extends the c3 with alpha = 1.0 + */ +Color4 operator*(const Color3& c3, const Color4& c4); + + +inline Color4 operator*(const Color3& c3, const Color4& c4) { + return Color4(c3.r * c4.r, c3.g * c4.g, c3.b * c4.b, c4.a); +} + +//---------------------------------------------------------------------------- + +inline Color4::Color4 () { + // For efficiency in construction of large arrays of vectors, the + // default constructor does not initialize the vector. +} + +//---------------------------------------------------------------------------- + +inline Color4::Color4(const Color3& c3, float a) { + r = c3.r; + g = c3.g; + b = c3.b; + this->a = a; +} + +//---------------------------------------------------------------------------- + +inline Color4::Color4( + float r, + float g, + float b, + float a) : + r(r), g(g), b(b), a(a) { +} + +//---------------------------------------------------------------------------- +inline Color4::Color4 (float afCoordinate[4]) { + r = afCoordinate[0]; + g = afCoordinate[1]; + b = afCoordinate[2]; + a = afCoordinate[3]; +} + +//---------------------------------------------------------------------------- + +inline Color4::Color4( + const Color4& other) { + + r = other.r; + g = other.g; + b = other.b; + a = other.a; +} + +//---------------------------------------------------------------------------- + +inline float& Color4::operator[] (int i) const { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- + +inline bool Color4::fuzzyEq(const Color4& other) const { + Color4 dif = (*this - other); + return G3D::fuzzyEq(dif.r * dif.r + dif.g * dif.g + dif.b * dif.b + dif.a * dif.a, 0); +} + +//---------------------------------------------------------------------------- + +inline bool Color4::fuzzyNe(const Color4& other) const { + Color4 dif = (*this - other); + return G3D::fuzzyNe(dif.r * dif.r + dif.g * dif.g + dif.b * dif.b + dif.a * dif.a, 0); +} + + +//---------------------------------------------------------------------------- +inline Color4& Color4::operator= (const Color4& other) { + r = other.r; + g = other.g; + b = other.b; + a = other.a; + return *this; +} + +//---------------------------------------------------------------------------- + +inline bool Color4::operator== (const Color4& other) const { + return ( r == other.r && g == other.g && b == other.b && a == other.a); +} + +//---------------------------------------------------------------------------- + +inline bool Color4::operator!= (const Color4& other) const { + return ( r != other.r || g != other.g || b != other.b || a != other.a); +} + +//---------------------------------------------------------------------------- +inline Color4 Color4::operator+ (const Color4& other) const { + return Color4(r + other.r, g + other.g, b + other.b, a + other.a); +} + +//---------------------------------------------------------------------------- +inline Color4 Color4::operator- (const Color4& other) const { + return Color4(r - other.r, g - other.g, b - other.b, a - other.a); +} + +//---------------------------------------------------------------------------- + +inline Color4 Color4::operator* (float fScalar) const { + return Color4(fScalar * r, fScalar * g, fScalar * b, fScalar * a); +} + +//---------------------------------------------------------------------------- + +inline Color4 Color4::operator- () const { + return Color4(-r, -g, -b, -a); +} + +//---------------------------------------------------------------------------- + +inline Color4 operator* (float fScalar, const Color4& other) { + return Color4(fScalar * other.r, fScalar * other.g, + fScalar * other.b, fScalar * other.a); +} + +//---------------------------------------------------------------------------- + +inline Color4& Color4::operator+= (const Color4& other) { + r += other.r; + g += other.g; + b += other.b; + a += other.a; + return *this; +} + +//---------------------------------------------------------------------------- + +inline Color4& Color4::operator-= (const Color4& other) { + r -= other.r; + g -= other.g; + b -= other.b; + a -= other.a; + return *this; +} + +//---------------------------------------------------------------------------- + +inline Color4& Color4::operator*= (float fScalar) { + r *= fScalar; + g *= fScalar; + b *= fScalar; + a *= fScalar; + return *this; +} + +} // namespace + +template <> +struct HashTrait { + static size_t hashCode(const G3D::Color4& key) { + return key.hashCode(); + } +}; + +#endif diff --git a/externals/g3dlite/G3D/Color4uint8.h b/externals/g3dlite/G3D/Color4uint8.h new file mode 100644 index 0000000..ab8c072 --- /dev/null +++ b/externals/g3dlite/G3D/Color4uint8.h @@ -0,0 +1,115 @@ +/** + @file Color4uint8.h + + @maintainer Morgan McGuire, graphics3d.com + + @created 2003-04-07 + @edited 2006-03-24 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef COLOR4UINT8_H +#define COLOR4UINT8_H + +#include "G3D/g3dmath.h" +#include "G3D/platform.h" +#include "G3D/Color3uint8.h" + +namespace G3D { + +/** + Represents a Color4 as a packed integer. Convenient + for creating unsigned int vertex arrays. Used by + G3D::GImage as the underlying format. + + WARNING: Integer color formats are different than + integer vertex formats. The color channels are automatically + scaled by 255 (because OpenGL automatically scales integer + colors back by this factor). So Color4(1,1,1) == Color4uint8(255,255,255) + but Vector3(1,1,1) == Vector3int16(1,1,1). + + */ +G3D_BEGIN_PACKED_CLASS(1) +class Color4uint8 { +private: + // Hidden operators + bool operator<(const Color4uint8&) const; + bool operator>(const Color4uint8&) const; + bool operator<=(const Color4uint8&) const; + bool operator>=(const Color4uint8&) const; + +public: + uint8 r; + uint8 g; + uint8 b; + uint8 a; + + Color4uint8() : r(0), g(0), b(0), a(0) {} + + Color4uint8(const class Color4& c); + + Color4uint8(const uint8 _r, const uint8 _g, const uint8 _b, const uint8 _a) : r(_r), g(_g), b(_b), a(_a) {} + + Color4uint8(const Color3uint8& c, const uint8 _a) : r(c.r), g(c.g), b(c.b), a(_a) {} + + Color4uint8(class BinaryInput& bi); + + inline static Color4uint8 fromARGB(uint32 i) { + Color4uint8 c; + c.a = (i >> 24) & 0xFF; + c.r = (i >> 16) & 0xFF; + c.g = (i >> 8) & 0xFF; + c.b = i & 0xFF; + return c; + } + + inline uint32 asUInt32() const { + return ((uint32)a << 24) + ((uint32)r << 16) + ((uint32)g << 8) + b; + } + + // access vector V as V[0] = V.r, V[1] = V.g, V[2] = V.b + // + // WARNING. These member functions rely on + // (1) Color4uint8 not having virtual functions + // (2) the data packed in a 3*sizeof(uint8) memory block + uint8& operator[] (int i) const { + return ((uint8*)this)[i]; + } + + operator uint8* () { + return (uint8*)this; + } + + operator const uint8* () const { + return (uint8*)this; + } + + + inline Color3uint8 bgr() const { + return Color3uint8(b, g, r); + } + + void serialize(class BinaryOutput& bo) const; + + void deserialize(class BinaryInput& bi); + + inline Color3uint8 rgb() const { + return Color3uint8(r, g, b); + } + + bool operator==(const Color4uint8& other) const { + return *reinterpret_cast(this) == *reinterpret_cast(&other); + } + + bool operator!=(const Color4uint8& other) const { + return *reinterpret_cast(this) != *reinterpret_cast(&other); + } + +} +G3D_END_PACKED_CLASS(1) + +} // namespace G3D + +#endif diff --git a/externals/g3dlite/G3D/Cone.h b/externals/g3dlite/G3D/Cone.h new file mode 100644 index 0000000..d801a9b --- /dev/null +++ b/externals/g3dlite/G3D/Cone.h @@ -0,0 +1,68 @@ +/** + @file Cone.h + + Cone class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com + + @created 2001-06-02 + @edited 2006-02-23 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_CONE_H +#define G3D_CONE_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Vector3.h" + +namespace G3D { + +/** + An infinite cone. + */ +class Cone { + +private: + Vector3 tip; + Vector3 direction; + + /** Angle from the center line to the edge. */ + float angle; + +public: + + /** + @param angle Angle from the center line to the edge, in radians + */ + Cone(const Vector3& tip, const Vector3& direction, float angle); + + /** + Forms the smallest cone that contains the box. Undefined if + the tip is inside or on the box. + */ + Cone(const Vector3& tip, const class Box& box); + + virtual ~Cone() {} + + /** + Returns true if the cone touches, intersects, or contains b. + + If c.intersects(s) and c.intersects(Sphere(s.center, s.radius * 2) + then the sphere s is entirely within cone c. + */ + bool intersects(const class Sphere& s) const; + + /** + True if v is a point inside the cone. + */ + bool contains(const class Vector3& v) const; +}; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/ConvexPolyhedron.h b/externals/g3dlite/G3D/ConvexPolyhedron.h new file mode 100644 index 0000000..a6fdd62 --- /dev/null +++ b/externals/g3dlite/G3D/ConvexPolyhedron.h @@ -0,0 +1,180 @@ +/** + @file ConvexPolyhedron.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-11-11 + @edited 2006-04-10 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_CONVEXPOLYHEDRON_H +#define G3D_CONVEXPOLYHEDRON_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Vector2.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/Plane.h" +#include "G3D/Line.h" +#include "G3D/Array.h" + +namespace G3D { + +class DirectedEdge { +public: + Vector3 start; + Vector3 stop; +}; + +class ConvexPolygon { +private: + + friend class ConvexPolyhedron; + + Array _vertex; + +public: + + ConvexPolygon() {} + ConvexPolygon(const Vector3& v0, const Vector3& v1, const Vector3& v2); + ConvexPolygon(const Array& __vertex); + virtual ~ConvexPolygon() {} + + /** + Counter clockwise winding order. + */ + inline const Vector3& vertex(int i) const { + return _vertex[i]; + } + + inline void setVertex(int i, const Vector3& v) { + _vertex[i] = v; + } + + /** + Zero vertices indicates an empty polygon (zero area). + */ + inline int numVertices() const { + return _vertex.size(); + } + + inline void setNumVertices(int n) { + _vertex.resize(n); + } + + /** + O(n) in the number of edges + */ + bool isEmpty() const; + + /** + Cuts the polygon at the plane. If the polygon is entirely above or below + the plane, one of the returned polygons will be empty. + + @param above The part of the polygon above (on the side the + normal points to or in the plane) the plane + @param below The part of the polygon below the plane. + @param newEdge If a new edge was introduced, this is that edge (on the above portion; the below portion is the opposite winding. + */ + void cut(const Plane& plane, ConvexPolygon &above, ConvexPolygon &below, DirectedEdge& newEdge); + void cut(const Plane& plane, ConvexPolygon &above, ConvexPolygon &below); + + /** + When a cut plane grazes a vertex in the polygon, two near-identical vertices may be created. + The closeness of these two points can cause a number of problems, such as ConvexPolygon::normal() + returning an infinite vector. It should be noted, however, that not all applications are + sensitive to near-identical vertices. + + removeDuplicateVertices() detects and eliminates redundant vertices. + */ + void removeDuplicateVertices(); + + /** + O(n) in the number of edges + */ + float getArea() const; + + inline Vector3 normal() const { + debugAssert(_vertex.length() >= 3); + return (_vertex[1] - _vertex[0]).cross(_vertex[2] - _vertex[0]).direction(); + } + + /** + Returns the same polygon with inverse winding. + */ + ConvexPolygon inverse() const; +}; + + + +class ConvexPolyhedron { +public: + /** + Zero faces indicates an empty polyhedron + */ + Array face; + + ConvexPolyhedron() {} + ConvexPolyhedron(const Array& _face); + + /** + O(n) in the number of edges + */ + bool isEmpty() const; + + /** + O(n) in the number of edges + */ + float getVolume() const; + + /** + Cuts the polyhedron at the plane. If the polyhedron is entirely above or below + the plane, one of the returned polyhedra will be empty. + + @param above The part of the polyhedron above (on the side the + normal points to or in the plane) the plane + @param below The part of the polyhedron below the plane. + */ + void cut(const Plane& plane, ConvexPolyhedron &above, ConvexPolyhedron &below); +}; + +/** + + */ +class ConvexPolygon2D { +private: + + Array m_vertex; + +public: + + ConvexPolygon2D() {} + + /** + Points are counter-clockwise in a Y = down, X = right coordinate + system. + + @param reverse If true, the points are reversed (i.e. winding direction is changed) + before the polygon is created. + */ + ConvexPolygon2D(const Array& pts, bool reverse = false); + + inline int numVertices() const { + return m_vertex.size(); + } + + inline const Vector2& vertex(int index) const { + debugAssert((index >= 0) && (index <= m_vertex.size())); + return m_vertex[index]; + } + + /** @param reverseWinding If true, the winding direction of the polygon is reversed for this test.*/ + bool contains(const Vector2& p, bool reverseWinding = false) const; +}; + + +} // namespace +#endif diff --git a/externals/g3dlite/G3D/CoordinateFrame.h b/externals/g3dlite/G3D/CoordinateFrame.h new file mode 100644 index 0000000..7ed4d0a --- /dev/null +++ b/externals/g3dlite/G3D/CoordinateFrame.h @@ -0,0 +1,331 @@ +/** + @file CoordinateFrame.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-03-04 + @edited 2009-04-29 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. +*/ + +#ifndef G3D_CFrame_h +#define G3D_CFrame_h + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/Matrix3.h" +#include "G3D/Array.h" +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +// Turn off "conditional expression is constant" warning; MSVC generates this +// for debug assertions in inlined methods. +# pragma warning (disable : 4127) +#endif + + +namespace G3D { +class Any; + +/** + A rigid body RT (rotation-translation) transformation. + +CoordinateFrame abstracts a 4x4 matrix that maps object space to world space: + + v_world = C * v_object + +CoordinateFrame::rotation is the upper 3x3 submatrix, CoordinateFrame::translation +is the right 3x1 column. The 4th row is always [0 0 0 1], so it isn't stored. +So you don't have to remember which way the multiplication and transformation work, +it provides explicit toWorldSpace and toObjectSpace methods. Also, points, vectors +(directions), and surface normals transform differently, so they have separate methods. + +Some helper functions transform whole primitives like boxes in and out of object space. + +Convert to Matrix4 using CoordinateFrame::toMatrix4. You can construct a CoordinateFrame +from a Matrix4 using Matrix4::approxCoordinateFrame, however, because a Matrix4 is more +general than a CoordinateFrame, some information may be lost. + +@sa G3D::UprightFrame, G3D::PhysicsFrame, G3D::Matrix4, G3D::Quat +*/ +class CoordinateFrame { +public: + + /** Takes object space points to world space. */ + Matrix3 rotation; + + /** Takes object space points to world space. */ + Vector3 translation; + + /** \param any Must be in one of the following forms: + - CFrame((matrix3 expr), (vector3 expr)) + - CFrame::fromXYZYPRDegrees(#, #, #, #, #, #) + - CFrame { rotation = (matrix3 expr), translation = (vector3 expr) } + */ + CoordinateFrame(const Any& any); + + /** Converts the CFrame to an Any. */ + operator Any() const; + + inline bool operator==(const CoordinateFrame& other) const { + return (translation == other.translation) && (rotation == other.rotation); + } + + inline bool operator!=(const CoordinateFrame& other) const { + return !(*this == other); + } + + bool fuzzyEq(const CoordinateFrame& other) const; + + bool fuzzyIsIdentity() const; + + bool isIdentity() const; + + /** + Initializes to the identity coordinate frame. + */ + CoordinateFrame(); + + CoordinateFrame(const Vector3& _translation) : + rotation(Matrix3::identity()), translation(_translation) { + } + + CoordinateFrame(const Matrix3 &rotation, const Vector3 &translation) : + rotation(rotation), translation(translation) { + } + + CoordinateFrame(const Matrix3 &rotation) : + rotation(rotation), translation(Vector3::zero()) { + } + + CoordinateFrame(const class UprightFrame& f); + + static CoordinateFrame fromXYZYPRRadians(float x, float y, float z, float yaw = 0.0f, float pitch = 0.0f, float roll = 0.0f); + + /** Construct a coordinate frame from translation = (x,y,z) and + rotations (in that order) about Y, object space X, object space + Z. Note that because object-space axes are used, these are not + equivalent to Euler angles; they are known as Tait-Bryan + rotations and are more convenient for intuitive positioning.*/ + static CoordinateFrame fromXYZYPRDegrees(float x, float y, float z, float yaw = 0.0f, float pitch = 0.0f, float roll = 0.0f); + + CoordinateFrame(class BinaryInput& b); + + void deserialize(class BinaryInput& b); + + void serialize(class BinaryOutput& b) const; + + CoordinateFrame(const CoordinateFrame &other) : + rotation(other.rotation), translation(other.translation) {} + + /** + Computes the inverse of this coordinate frame. + */ + inline CoordinateFrame inverse() const { + CoordinateFrame out; + out.rotation = rotation.transpose(); + out.translation = -out.rotation * translation; + return out; + } + + inline ~CoordinateFrame() {} + + /** See also Matrix4::approxCoordinateFrame */ + class Matrix4 toMatrix4() const; + + void getXYZYPRRadians(float& x, float& y, float& z, float& yaw, float& pitch, float& roll) const; + void getXYZYPRDegrees(float& x, float& y, float& z, float& yaw, float& pitch, float& roll) const; + + + /** + Produces an XML serialization of this coordinate frame. + @deprecated + */ + std::string toXML() const; + + /** + Returns the heading of the lookVector as an angle in radians relative to + the world -z axis. That is, a counter-clockwise heading where north (-z) + is 0 and west (-x) is PI/2. + + Note that the heading ignores the Y axis, so an inverted + object has an inverted heading. + */ + inline float getHeading() const { + Vector3 look = rotation.column(2); + float angle = -(float) atan2(-look.x, look.z); + return angle; + } + + /** + Takes the coordinate frame into object space. + this->inverse() * c + */ + inline CoordinateFrame toObjectSpace(const CoordinateFrame& c) const { + return this->inverse() * c; + } + + inline Vector4 toObjectSpace(const Vector4& v) const { + return this->inverse().toWorldSpace(v); + } + + inline Vector4 toWorldSpace(const Vector4& v) const { + return Vector4(rotation * Vector3(v.x, v.y, v.z) + translation * v.w, v.w); + } + + /** + Transforms the point into world space. + */ + inline Vector3 pointToWorldSpace(const Vector3& v) const { + return Vector3( + rotation[0][0] * v[0] + rotation[0][1] * v[1] + rotation[0][2] * v[2] + translation[0], + rotation[1][0] * v[0] + rotation[1][1] * v[1] + rotation[1][2] * v[2] + translation[1], + rotation[2][0] * v[0] + rotation[2][1] * v[1] + rotation[2][2] * v[2] + translation[2]); + } + + /** + Transforms the point into object space. Assumes that the rotation matrix is orthonormal. + */ + inline Vector3 pointToObjectSpace(const Vector3& v) const { + float p[3]; + p[0] = v[0] - translation[0]; + p[1] = v[1] - translation[1]; + p[2] = v[2] - translation[2]; + debugAssert(G3D::fuzzyEq(rotation.determinant(), 1.0f)); + return Vector3( + rotation[0][0] * p[0] + rotation[1][0] * p[1] + rotation[2][0] * p[2], + rotation[0][1] * p[0] + rotation[1][1] * p[1] + rotation[2][1] * p[2], + rotation[0][2] * p[0] + rotation[1][2] * p[1] + rotation[2][2] * p[2]); + } + + /** + Transforms the vector into world space (no translation). + */ + inline Vector3 vectorToWorldSpace(const Vector3& v) const { + return rotation * v; + } + + inline Vector3 normalToWorldSpace(const Vector3& v) const { + return rotation * v; + } + + class Ray toObjectSpace(const Ray& r) const; + + Ray toWorldSpace(const Ray& r) const; + + /** + Transforms the vector into object space (no translation). + */ + inline Vector3 vectorToObjectSpace(const Vector3 &v) const { + // Multiply on the left (same as rotation.transpose() * v) + return v * rotation; + } + + inline Vector3 normalToObjectSpace(const Vector3 &v) const { + // Multiply on the left (same as rotation.transpose() * v) + return v * rotation; + } + + void pointToWorldSpace(const Array& v, Array& vout) const; + + void normalToWorldSpace(const Array& v, Array& vout) const; + + void vectorToWorldSpace(const Array& v, Array& vout) const; + + void pointToObjectSpace(const Array& v, Array& vout) const; + + void normalToObjectSpace(const Array& v, Array& vout) const; + + void vectorToObjectSpace(const Array& v, Array& vout) const; + + class Box toWorldSpace(const class AABox& b) const; + + class Box toWorldSpace(const class Box& b) const; + + class Cylinder toWorldSpace(const class Cylinder& b) const; + + class Capsule toWorldSpace(const class Capsule& b) const; + + class Plane toWorldSpace(const class Plane& p) const; + + class Sphere toWorldSpace(const class Sphere& b) const; + + class Triangle toWorldSpace(const class Triangle& t) const; + + class Box toObjectSpace(const AABox& b) const; + + class Box toObjectSpace(const Box& b) const; + + class Plane toObjectSpace(const Plane& p) const; + + class Sphere toObjectSpace(const Sphere& b) const; + + Triangle toObjectSpace(const Triangle& t) const; + + /** Compose: create the transformation that is other followed by this.*/ + CoordinateFrame operator*(const CoordinateFrame &other) const { + return CoordinateFrame(rotation * other.rotation, + pointToWorldSpace(other.translation)); + } + + CoordinateFrame operator+(const Vector3& v) const { + return CoordinateFrame(rotation, translation + v); + } + + CoordinateFrame operator-(const Vector3& v) const { + return CoordinateFrame(rotation, translation - v); + } + + void lookAt(const Vector3& target); + + void lookAt( + const Vector3& target, + Vector3 up); + + /** The direction this camera is looking (its negative z axis)*/ + inline Vector3 lookVector() const { + return -rotation.column(2); + } + + /** Returns the ray starting at the camera origin travelling in direction CoordinateFrame::lookVector. */ + class Ray lookRay() const; + + /** Up direction for this camera (its y axis). */ + inline Vector3 upVector() const { + return rotation.column(1); + } + + inline Vector3 rightVector() const { + return rotation.column(0); + } + + /** + If a viewer looks along the look vector, this is the viewer's "left". + Useful for strafing motions and building alternative coordinate frames. + */ + inline Vector3 leftVector() const { + return -rotation.column(0); + } + + /** + Linearly interpolates between two coordinate frames, using + Quat::slerp for the rotations. + */ + CoordinateFrame lerp( + const CoordinateFrame& other, + float alpha) const; + +}; + +typedef CoordinateFrame CFrame; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/Crypto.h b/externals/g3dlite/G3D/Crypto.h new file mode 100644 index 0000000..56c816a --- /dev/null +++ b/externals/g3dlite/G3D/Crypto.h @@ -0,0 +1,96 @@ +/** + @file Crypto.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + + @created 2006-03-29 + @edited 2006-04-06 + */ + +#ifndef G3D_CRYPTO_H +#define G3D_CRYPTO_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include + +namespace G3D { + +/** See G3D::Crypto::md5 */ +class MD5Hash { +private: + + uint8 value[16]; + +public: + + MD5Hash() { + for (int i = 0; i < 16; ++i) { + value[i] = 0; + } + } + + explicit MD5Hash(class BinaryInput& b); + + uint8& operator[](int i) { + return value[i]; + } + + const uint8& operator[](int i) const { + return value[i]; + } + + bool operator==(const MD5Hash& other) const { + bool match = true; + for (int i = 0; i < 16; ++i) { + match = match && (other.value[i] == value[i]); + } + return match; + } + + inline bool operator!=(const MD5Hash& other) const { + return !(*this == other); + } + + void deserialize(class BinaryInput& b); + + void serialize(class BinaryOutput& b) const; +}; + + +/** Cryptography and hashing helper functions */ +class Crypto { +public: + + /** + Computes the CRC32 value of a byte array. CRC32 is designed to be a hash + function that produces different values for similar strings. + + This implementation is compatible with PKZIP and GZIP. + + Based on http://www.gamedev.net/reference/programming/features/crc32/ + */ + static uint32 crc32(const void* bytes, size_t numBytes); + + /** + Computes the MD5 hash (message digest) of a byte stream, as defined by + http://www.ietf.org/rfc/rfc1321.txt. + + @cite Based on implementation by L. Peter Deutsch, ghost@aladdin.com + */ + MD5Hash md5(const void* bytes, size_t numBytes); + + /** + Returns the nth prime less than 2000 in constant time. The first prime has index + 0 and is the number 2. + */ + static int smallPrime(int n); + + /** Returns 1 + the largest value that can be passed to smallPrime. */ + static int numSmallPrimes(); +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Cylinder.h b/externals/g3dlite/G3D/Cylinder.h new file mode 100644 index 0000000..85eba77 --- /dev/null +++ b/externals/g3dlite/G3D/Cylinder.h @@ -0,0 +1,92 @@ +/** + @file Cylinder.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-02-07 + @edited 2005-09-26 + + Copyright 2000-2005, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Cylinder_H +#define G3D_Cylinder_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Vector3.h" + +namespace G3D { + +class Line; +class AABox; +/** + Right cylinder + */ +class Cylinder { +private: + Vector3 p1; + Vector3 p2; + + float mRadius; + +public: + + /** Uninitialized */ + Cylinder(); + Cylinder(class BinaryInput& b); + Cylinder(const Vector3& _p1, const Vector3& _p2, float _r); + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + /** The line down the center of the Cylinder */ + Line axis() const; + + /** + A reference frame in which the center of mass is at the origin and + the Y-axis is the cylinder's axis. If the cylinder is transformed, this reference frame + may freely rotate around its axis.*/ + void getReferenceFrame(class CoordinateFrame& cframe) const; + + /** Returns point 0 or 1 */ + inline const Vector3& point(int i) const { + debugAssert(i >= 0 && i <= 1); + return (i == 0) ? p1 : p2; + } + + /** + Returns true if the point is inside the Cylinder or on its surface. + */ + bool contains(const Vector3& p) const; + + float area() const; + + float volume() const; + + float radius() const; + + /** Center of mass */ + inline Vector3 center() const { + return (p1 + p2) / 2.0f; + } + + inline float height() const { + return (p1 - p2).magnitude(); + } + + /** + Get close axis aligned bounding box. + With vertical world orientation, the top and bottom might not be very tight. */ + void getBounds(AABox& out) const; + + /** Random world space point with outward facing normal. */ + void getRandomSurfacePoint(Vector3& P, Vector3& N) const; + + /** Point selected uniformly at random over the volume. */ + Vector3 randomInteriorPoint() const; +}; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/EqualsTrait.h b/externals/g3dlite/G3D/EqualsTrait.h new file mode 100644 index 0000000..349cb50 --- /dev/null +++ b/externals/g3dlite/G3D/EqualsTrait.h @@ -0,0 +1,26 @@ +/** + @file EqualsTrait.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2008-10-01 + @edited 2008-10-01 + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_EQUALSTRAIT_H +#define G3D_EQUALSTRAIT_H + +#include "G3D/platform.h" + +/** Default implementation of EqualsTrait. + @see G3D::Table for specialization requirements. +*/ +template struct EqualsTrait { + static bool equals(const Key& a, const Key& b) { + return a == b; + } +}; + +#endif + diff --git a/externals/g3dlite/G3D/G3D.h b/externals/g3dlite/G3D/G3D.h new file mode 100644 index 0000000..5b56b9c --- /dev/null +++ b/externals/g3dlite/G3D/G3D.h @@ -0,0 +1,162 @@ +/** + @file G3D.h + + This header includes all of the G3D libraries in + appropriate namespaces. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-08-25 + @edited 2010-01-30 + + Copyright 2000-2010, Morgan McGuire. + All rights reserved. +*/ + +#ifndef G3D_G3D_h +#define G3D_G3D_h + +#define NOMINMAX 1 +#ifdef min + #undef min +#endif +#ifdef max + #undef max +#endif + +#include "G3D/platform.h" +#include "G3D/units.h" +#include "G3D/ParseError.h" +#include "G3D/Random.h" +#include "G3D/Array.h" +#include "G3D/SmallArray.h" +#include "G3D/Queue.h" +#include "G3D/Crypto.h" +#include "G3D/format.h" +#include "G3D/Vector2.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/Color1.h" +#include "G3D/Color3.h" +#include "G3D/Color4.h" +#include "G3D/Matrix2.h" +#include "G3D/Matrix3.h" +#include "G3D/Matrix4.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/PhysicsFrame.h" +#include "G3D/Plane.h" +#include "G3D/Line.h" +#include "G3D/Ray.h" +#include "G3D/Sphere.h" +#include "G3D/Box.h" +#include "G3D/Box2D.h" +#include "G3D/AABox.h" +#include "G3D/WrapMode.h" +#include "G3D/Cone.h" +#include "G3D/Quat.h" +#include "G3D/stringutils.h" +#include "G3D/prompt.h" +#include "G3D/Table.h" +#include "G3D/Set.h" +#include "G3D/GUniqueID.h" +#include "G3D/BinaryFormat.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/debug.h" +#include "G3D/g3dfnmatch.h" +#include "G3D/G3DGameUnits.h" +#include "G3D/g3dmath.h" +#include "G3D/uint128.h" +#include "G3D/fileutils.h" +#include "G3D/ReferenceCount.h" +#include "G3D/Welder.h" +#include "G3D/GMutex.h" +#include "G3D/PrecomputedRandom.h" +#include "G3D/MemoryManager.h" +#include "G3D/AreaMemoryManager.h" +#include "G3D/BumpMapPreprocess.h" + +template struct HashTrait< G3D::ReferenceCountedPointer > { + static size_t hashCode(G3D::ReferenceCountedPointer key) { return reinterpret_cast( key.pointer() ); } +}; + +#include "G3D/GImage.h" +#include "G3D/CollisionDetection.h" +#include "G3D/Intersect.h" +#include "G3D/Log.h" +#include "G3D/serialize.h" +#include "G3D/TextInput.h" +#include "G3D/NetAddress.h" +#include "G3D/NetworkDevice.h" +#include "G3D/System.h" +#include "G3D/splinefunc.h" +#include "G3D/Spline.h" +#include "G3D/UprightFrame.h" +#include "G3D/LineSegment.h" +#include "G3D/Capsule.h" +#include "G3D/Cylinder.h" +#include "G3D/Triangle.h" +#include "G3D/Color3uint8.h" +#include "G3D/Color4uint8.h" +#include "G3D/Vector2int16.h" +#include "G3D/Vector3int16.h" +#include "G3D/Vector3int32.h" +#include "G3D/Vector4int8.h" +#include "G3D/ConvexPolyhedron.h" +#include "G3D/MeshAlg.h" +#include "G3D/vectorMath.h" +#include "G3D/Rect2D.h" +#include "G3D/GCamera.h" +#include "G3D/GLight.h" +#include "G3D/KDTree.h" +#include "G3D/PointKDTree.h" +#include "G3D/TextOutput.h" +#include "G3D/MeshBuilder.h" +#include "G3D/Stopwatch.h" +#include "G3D/AtomicInt32.h" +#include "G3D/GThread.h" +#include "G3D/ThreadSet.h" +#include "G3D/RegistryUtil.h" +#include "G3D/Any.h" +#include "G3D/PointHashGrid.h" +#include "G3D/Map2D.h" +#include "G3D/Image1.h" +#include "G3D/Image1uint8.h" +#include "G3D/Image3.h" +#include "G3D/Image3uint8.h" +#include "G3D/Image4.h" +#include "G3D/Image4uint8.h" +#include "G3D/filter.h" +#include "G3D/WeakCache.h" +#include "G3D/Pointer.h" +#include "G3D/Matrix.h" +#include "G3D/ImageFormat.h" + +#ifdef _MSC_VER +# pragma comment(lib, "zlib") +# pragma comment(lib, "ws2_32") +# pragma comment(lib, "winmm") +# pragma comment(lib, "imagehlp") +# pragma comment(lib, "gdi32") +# pragma comment(lib, "user32") +# pragma comment(lib, "kernel32") +# pragma comment(lib, "version") +# pragma comment(lib, "advapi32") +# pragma comment(lib, "png") +# pragma comment(lib, "jpeg") +# pragma comment(lib, "zip") +# ifdef _DEBUG + // Don't link against G3D when building G3D itself. +# ifndef G3D_BUILDING_LIBRARY_DLL +# pragma comment(lib, "G3Dd.lib") +# endif +# else + // Don't link against G3D when building G3D itself. +# ifndef G3D_BUILDING_LIBRARY_DLL +# pragma comment(lib, "G3D.lib") +# endif +# endif +#endif + +#endif + diff --git a/externals/g3dlite/G3D/G3DAll.h b/externals/g3dlite/G3D/G3DAll.h new file mode 100644 index 0000000..1176fe7 --- /dev/null +++ b/externals/g3dlite/G3D/G3DAll.h @@ -0,0 +1,26 @@ +/** + @file G3DAll.h + + Includes all G3D and GLG3D files and uses the G3D namespace. + + This requires OpenGL and SDL headers. If you don't want all of this, + \#include separately. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-01-01 + @edited 2006-08-13 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_G3DALL_H +#define G3D_G3DALL_H + +#include "G3D/G3D.h" +#include "GLG3D/GLG3D.h" + +using namespace G3D; + +#endif diff --git a/externals/g3dlite/G3D/G3DGameUnits.h b/externals/g3dlite/G3D/G3DGameUnits.h new file mode 100644 index 0000000..e2bc2c8 --- /dev/null +++ b/externals/g3dlite/G3D/G3DGameUnits.h @@ -0,0 +1,42 @@ +/** + @file G3DGameUnits.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2002-10-05 + @edited 2006-11-10 + */ + +#ifndef G3D_GAMEUNITS_H +#define G3D_GAMEUNITS_H + +#include "G3D/platform.h" + +namespace G3D { +/** + Time, in seconds. + */ +typedef double GameTime; +typedef double SimTime; + +/** + Actual wall clock time in seconds. + */ +typedef double RealTime; + +enum AMPM {AM, PM}; + +/** \deprecated */ +enum {SECOND=1, MINUTE=60, HOUR = 60*60, DAY=24*60*60, SUNRISE=24*60*60/4, SUNSET=24*60*60*3/4, MIDNIGHT=0, METER=1, KILOMETER=1000}; + +/** + Converts a 12 hour clock time into the number of seconds since + midnight. Note that 12:00 PM is noon and 12:00 AM is midnight. + + Example: toSeconds(10, 00, AM) + */ +SimTime toSeconds(int hour, int minute, double seconds, AMPM ap); +SimTime toSeconds(int hour, int minute, AMPM ap); + +} + +#endif diff --git a/externals/g3dlite/G3D/GCamera.h b/externals/g3dlite/G3D/GCamera.h new file mode 100644 index 0000000..018fbc8 --- /dev/null +++ b/externals/g3dlite/G3D/GCamera.h @@ -0,0 +1,337 @@ +/** + @file GCamera.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2005-07-20 + @edited 2009-04-20 +*/ + +#ifndef G3D_GCamera_H +#define G3D_GCamera_H + +#include "G3D/platform.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/Vector3.h" +#include "G3D/Plane.h" +#include "G3D/debugAssert.h" + +namespace G3D { + +class Matrix4; +class Rect2D; +class Any; + +/** + Abstraction of a pinhole camera. + + The area a camera sees is called a frustum. It is bounded by the + near plane, the far plane, and the sides of the view frame projected + into the scene. It has the shape of a pyramid with the top cut off. + + Cameras can project points from 3D to 2D. The "unit" projection + matches OpenGL. It maps the entire view frustum to a cube of unit + radius (i.e., edges of length 2) centered at the origin. The + non-unit projection then maps that cube to the specified pixel + viewport in X and Y and the range [0, 1] in Z. The projection is + reversable as long as the projected Z value is known. + + All viewport arguments are the pixel bounds of the viewport-- e.g., + RenderDevice::viewport(). + */ +class GCamera { + +public: + /** + Stores the direction of the field of view + */ + enum FOVDirection {HORIZONTAL, VERTICAL}; + +private: + + /** Full field of view (in radians) */ + float m_fieldOfView; + + /** Clipping plane, *not* imaging plane. Negative numbers. */ + float m_nearPlaneZ; + + /** Negative */ + float m_farPlaneZ; + + /** Stores the camera's location and orientation */ + CoordinateFrame m_cframe; + + /** Horizontal or Vertical */ + FOVDirection m_direction; + +public: + + /** Must be of the format produced by the Any cast, e.g., + +
+        GCamera {
+            coordinateFrame = CFrame::fromXYZYPRDegrees(-13.3f, 8.0f, -1.9f, 246.6f, -3),
+            nearPlaneZ = -0.5,
+            farPlaneZ = -50,
+            fovDirection = "HORIZONTAL",
+            fovAngleDegrees = 90
+        }
+ + Missing fields are filled from the default GCamera constructor. + */ + GCamera(const Any& any); + + operator Any() const; + + class Frustum { + public: + class Face { + public: + /** Counter clockwise indices into vertexPos */ + int vertexIndex[4]; + + /** The plane containing the face. */ + Plane plane; + }; + + /** The vertices, in homogeneous space. If w == 0, + a vertex is at infinity. */ + Array vertexPos; + + /** The faces in the frustum. When the + far plane is at infinity, there are 5 faces, + otherwise there are 6. The faces are in the order + N,R,L,B,T,[F]. + */ + Array faceArray; + }; + + GCamera(); + + GCamera(const Matrix4& proj, const CFrame& frame); + + virtual ~GCamera(); + + /** Returns the current coordinate frame */ + const CoordinateFrame& coordinateFrame() const { + return m_cframe; + } + + /** Sets c to the camera's coordinate frame */ + void getCoordinateFrame(CoordinateFrame& c) const; + + /** Sets a new coordinate frame for the camera */ + void setCoordinateFrame(const CoordinateFrame& c); + + /** Sets \a P equal to the camera's projection matrix. This is the + matrix that maps points to the homogeneous clip cube that + varies from -1 to 1 on all axes. The projection matrix does + not include the camera transform. + + This is the matrix that a RenderDevice (or OpenGL) uses as the projection matrix. + @sa RenderDevice::setProjectionAndCameraMatrix, RenderDevice::setProjectionMatrix, Matrix4::perspectiveProjection + */ + void getProjectUnitMatrix(const Rect2D& viewport, Matrix4& P) const; + + /** Sets \a P equal to the matrix that transforms points to pixel + coordinates on the given viewport. A point correspoinding to + the top-left corner of the viewport in camera space will + transform to viewport.x0y0() and the bottom-right to viewport.x1y1(). */ + void getProjectPixelMatrix(const Rect2D& viewport, Matrix4& P) const; + + /** Converts projected points from OpenGL standards + (-1, 1) to normal 3D coordinate standards (0, 1) + + \deprecated + */ // TODO: Remove + Vector3 convertFromUnitToNormal(const Vector3& in, const Rect2D& viewport) const; + + /** + Sets the field of view, in radians. The + initial angle is toRadians(55). Must specify + the direction of the angle. + + This is the full angle, i.e., from the left side of the + viewport to the right side. + */ + void setFieldOfView(float angle, FOVDirection direction); + + /** Returns the current full field of view angle (from the left side of the + viewport to the right side) and direction */ + inline void getFieldOfView(float& angle, FOVDirection& direction) const { + angle = m_fieldOfView; + direction = m_direction; + } + + /** + Projects a world space point onto a width x height screen. The + returned coordinate uses pixmap addressing: x = right and y = + down. The resulting z value is 0 at the near plane, 1 at the far plane, + and is a linear compression of unit cube projection. + + If the point is behind the camera, Vector3::inf() is returned. + */ + Vector3 project(const G3D::Vector3& point, + const class Rect2D& viewport) const; + + /** + Projects a world space point onto a unit cube. The resulting + x,y,z values range between -1 and 1, where z is -1 + at the near plane and 1 at the far plane and varies hyperbolically in between. + + If the point is behind the camera, Vector3::inf() is returned. + */ + Vector3 projectUnit(const G3D::Vector3& point, + const class Rect2D& viewport) const; + + /** + Gives the world-space coordinates of screen space point v, where + v.x is in pixels from the left, v.y is in pixels from + the top, and v.z is on the range 0 (near plane) to 1 (far plane). + */ + Vector3 unproject(const Vector3& v, const Rect2D& viewport) const; + + /** + Gives the world-space coordinates of unit cube point v, where + v varies from -1 to 1 on all axes. The unproject first + transforms the point into a pixel location for the viewport, then calls unproject + */ + Vector3 unprojectUnit(const Vector3& v, const Rect2D& viewport) const; + + /** + Returns the pixel area covered by a shape of the given + world space area at the given z value (z must be negative). + */ + float worldToScreenSpaceArea(float area, float z, const class Rect2D& viewport) const; + + /** + Returns the world space 3D viewport corners. These + are at the near clipping plane. The corners are constructed + from the nearPlaneZ, viewportWidth, and viewportHeight. + "left" and "right" are from the GCamera's perspective. + */ + void getNearViewportCorners(const class Rect2D& viewport, + Vector3& outUR, Vector3& outUL, + Vector3& outLL, Vector3& outLR) const; + + /** + Returns the world space 3D viewport corners. These + are at the Far clipping plane. The corners are constructed + from the nearPlaneZ, farPlaneZ, viewportWidth, and viewportHeight. + "left" and "right" are from the GCamera's perspective. + */ + void getFarViewportCorners(const class Rect2D& viewport, + Vector3& outUR, Vector3& outUL, + Vector3& outLL, Vector3& outLR) const; + + /** + Returns the image plane depth, assumes imagePlane + is the same as the near clipping plane. + returns a positive number. + */ + float imagePlaneDepth() const; + + /** + Returns the world space ray passing through the center of pixel + (x, y) on the image plane. The pixel x and y axes are opposite + the 3D object space axes: (0,0) is the upper left corner of the screen. + They are in viewport coordinates, not screen coordinates. + + The ray origin is at the origin. To start it at the image plane, + move it forward by imagePlaneDepth/ray.direction.z + + Integer (x, y) values correspond to + the upper left corners of pixels. If you want to cast rays + through pixel centers, add 0.5 to x and y. + */ + Ray worldRay( + float x, + float y, + const class Rect2D& viewport) const; + + /** + Returns a negative z-value. + */ + inline float nearPlaneZ() const { + return m_nearPlaneZ; + } + + /** + Returns a negative z-value. + */ + inline float farPlaneZ() const { + return m_farPlaneZ; + } + + /** + Sets a new value for the far clipping plane + Expects a negative value + */ + inline void setFarPlaneZ(float z) { + debugAssert(z < 0); + m_farPlaneZ = z; + } + + /** + Sets a new value for the near clipping plane + Expects a negative value + */ + inline void setNearPlaneZ(float z) { + debugAssert(z < 0); + m_nearPlaneZ = z; + } + + /** + Returns the camera space width of the viewport at the near plane. + */ + float viewportWidth(const class Rect2D& viewport) const; + + /** + Returns the camera space height of the viewport at the near plane. + */ + float viewportHeight(const class Rect2D& viewport) const; + + void setPosition(const Vector3& t); + + /** Rotate the camera in place to look at the target. Does not + persistently look at that location when the camera moves; + i.e., if you move the camera and still want it to look at the + old target, you must call lookAt again after moving the + camera.)*/ + void lookAt(const Vector3& position, const Vector3& up = Vector3::unitY()); + + /** + Returns the clipping planes of the frustum, in world space. + The planes have normals facing into the view frustum. + + The plane order is guaranteed to be: + Near, Right, Left, Top, Bottom, [Far] + + If the far plane is at infinity, the resulting array will have + 5 planes, otherwise there will be 6. + + The viewport is used only to determine the aspect ratio of the screen; the + absolute dimensions and xy values don't matter. + */ + void getClipPlanes + ( + const Rect2D& viewport, + Array& outClip) const; + + /** + Returns the world space view frustum, which is a truncated pyramid describing + the volume of space seen by this camera. + */ + void frustum(const Rect2D& viewport, GCamera::Frustum& f) const; + + GCamera::Frustum frustum(const Rect2D& viewport) const; + + /** Read and Write camera parameters */ + void serialize(class BinaryOutput& bo) const; + void deserialize(class BinaryInput& bi); + +}; + +} // namespace G3D + +#endif diff --git a/externals/g3dlite/G3D/GImage.h b/externals/g3dlite/G3D/GImage.h new file mode 100644 index 0000000..8ae1113 --- /dev/null +++ b/externals/g3dlite/G3D/GImage.h @@ -0,0 +1,607 @@ +/** + \file GImage.h + + See G3D::GImage for details. + + @cite JPEG compress/decompressor is the IJG library, used in accordance with their license. + @cite JPG code by John Chisholm, using the IJG Library + @cite TGA code by Morgan McGuire + @cite BMP code by John Chisholm, based on code by Edward "CGameProgrammer" Resnick mailto:cgp@gdnmail.net at ftp://ftp.flipcode.com/cotd/LoadPicture.txt + @cite PCX format described in the ZSOFT PCX manual http://www.nist.fss.ru/hr/doc/spec/pcx.htm#2 + @cite PNG compress/decompressor is the libpng library, used in accordance with their license. + @cite PPM code by Morgan McGuire based on http://netpbm.sourceforge.net/doc/ppm.html + + \maintainer Morgan McGuire, http://graphics.cs.williams.edu + + \created 2002-05-27 + \edited 2010-01-04 + + Copyright 2000-2010, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_GImage_h +#define G3D_GImage_h + +#include "G3D/platform.h" +#include +#include "G3D/Array.h" +#include "G3D/g3dmath.h" +#include "G3D/stringutils.h" +#include "G3D/Color1uint8.h" +#include "G3D/Color3uint8.h" +#include "G3D/Color4uint8.h" +#include "G3D/MemoryManager.h" +#include "G3D/BumpMapPreprocess.h" + +namespace G3D { +class BinaryInput; +class BinaryOutput; + + +/** + Interface to image compression & file formats. + + Supported formats (decode and encode): Color JPEG, PNG, + (Uncompressed)TGA 24, (Uncompressed)TGA 32, BMP 1, BMP 4, BMP 8, BMP + 24, PPM (P6), and PPM ASCII (P1, P2, P3), which includes PPM, PGM, + and PBM. 8-bit paletted PCX, 24-bit PCX, and ICO are supported for + decoding only. + + Sample usage: + + \verbatim + // Loading from disk: + G3D::GImage im1("test.jpg"); + + // Loading from memory: + G3D::GImage im2(data, length); + + // im.pixel is a pointer to RGB color data. If you want + // an alpha channel, call RGBtoRGBA or RGBtoARGB for + // conversion. + + // Saving to memory: + G3D::GImage im3(width, height); + // (Set the pixels of im3...) + uint8* data2; + int len2; + im3.encode(G3D::GImage::JPEG, data2, len2); + + // Saving to disk + im3.save("out.jpg"); + \endverbatim + + The free Image Magick Magick Wand API + (http://www.imagemagick.org/www/api/magick_wand.html) provides a more powerful + API for image manipulation and wider set of image load/save formats. It is + recommended over GImage (we don't include it directly in G3D because their license + is more restrictive than the BSD one). + + */ +class GImage { +private: + + /** Used exclusively for allocating m_byte; this may be an + implementation that allocates directly on a GPU.*/ + MemoryManager::Ref m_memMan; + uint8* m_byte; + + int m_channels; + int m_width; + int m_height; + +public: + + class Error { + public: + Error( + const std::string& reason, + const std::string& filename = "") : + reason(reason), filename(filename) {} + + std::string reason; + std::string filename; + }; + + /** PGM, PPM, and PBM all come in two versions and are classified as PPM_* files */ + enum Format {JPEG, BMP, TGA, PCX, ICO, PNG, + PPM_BINARY, PGM_BINARY = PPM_BINARY, + PPM_ASCII, PGM_ASCII = PPM_ASCII, + AUTODETECT, UNKNOWN}; + + + /** + The number of channels; either 3 (RGB) or 4 (RGBA) + */ + inline int channels() const { + return m_channels; + } + + inline int width() const { + return m_width; + } + + inline int height() const { + return m_height; + } + + inline const uint8* byte() const { + return m_byte; + } + + /** Returns a pointer to the underlying data, which is stored + in row-major order without row padding. + e.g., uint8* ptr = image.rawData(); + */ + template + inline const Type* rawData() const { + return (Type*)m_byte; + } + + /** \copybrief GImage::rawData() const */ + template + inline Type* rawData() { + return (Type*)m_byte; + } + + inline const Color1uint8* pixel1() const { + debugAssertM(m_channels == 1, format("Tried to call GImage::pixel1 on an image with %d channels", m_channels)); + return (Color1uint8*)m_byte; + } + + inline Color1uint8* pixel1() { + debugAssertM(m_channels == 1, format("Tried to call GImage::pixel1 on an image with %d channels", m_channels)); + return (Color1uint8*)m_byte; + } + + /** Returns a pointer to the upper left pixel + as Color4uint8. + */ + inline const Color4uint8* pixel4() const { + debugAssertM(m_channels == 4, format("Tried to call GImage::pixel4 on an image with %d channels", m_channels)); + return (Color4uint8*)m_byte; + } + + inline Color4uint8* pixel4() { + debugAssert(m_channels == 4); + return (Color4uint8*)m_byte; + } + + /** Returns a pointer to the upper left pixel + as Color3uint8. + */ + inline const Color3uint8* pixel3() const { + debugAssertM(m_channels == 3, format("Tried to call GImage::pixel3 on an image with %d channels", m_channels)); + return (Color3uint8*)m_byte; + } + + inline Color3uint8* pixel3() { + debugAssert(m_channels == 3); + return (Color3uint8*)m_byte; + } + + /** Returns the pixel at (x, y), where (0,0) is the upper left. */ + inline const Color1uint8& pixel1(int x, int y) const { + debugAssert(x >= 0 && x < m_width); + debugAssert(y >= 0 && y < m_height); + return pixel1()[x + y * m_width]; + } + + /** Returns the pixel at (x, y), where (0,0) is the upper left. */ + inline Color1uint8& pixel1(int x, int y) { + debugAssert(x >= 0 && x < m_width); + debugAssert(y >= 0 && y < m_height); + return pixel1()[x + y * m_width]; + } + + /** Returns the pixel at (x, y), where (0,0) is the upper left. */ + inline const Color3uint8& pixel3(int x, int y) const { + debugAssert(x >= 0 && x < m_width); + debugAssert(y >= 0 && y < m_height); + return pixel3()[x + y * m_width]; + } + + inline Color3uint8& pixel3(int x, int y) { + debugAssert(x >= 0 && x < m_width); + debugAssert(y >= 0 && y < m_height); + return pixel3()[x + y * m_width]; + } + + /** Returns the pixel at (x, y), where (0,0) is the upper left. */ + inline const Color4uint8& pixel4(int x, int y) const { + debugAssert(x >= 0 && x < m_width); + debugAssert(y >= 0 && y < m_height); + return pixel4()[x + y * m_width]; + } + + inline Color4uint8& pixel4(int x, int y) { + debugAssert(x >= 0 && x < m_width); + debugAssert(y >= 0 && y < m_height); + return pixel4()[x + y * m_width]; + } + + inline uint8* byte() { + return m_byte; + } + +private: + + void encodeBMP( + BinaryOutput& out) const; + + /** + The TGA file will be either 24- or 32-bit depending + on the number of channels. + */ + void encodeTGA( + BinaryOutput& out) const; + + /** + Converts this image into a JPEG + */ + void encodeJPEG( + BinaryOutput& out) const; + + /** + Converts this image into a JPEG + */ + void encodePNG( + BinaryOutput& out) const; + + void encodePPM( + BinaryOutput& out) const; + + void encodePPMASCII( + BinaryOutput& out) const; + + void decodeTGA( + BinaryInput& input); + + void decodeBMP( + BinaryInput& input); + + void decodeJPEG( + BinaryInput& input); + + void decodePCX( + BinaryInput& input); + + void decodeICO( + BinaryInput& input); + + void decodePNG( + BinaryInput& input); + + void decodePPM( + BinaryInput& input); + + void decodePPMASCII( + BinaryInput& input); + + /** + Given [maybe] a filename, memory buffer, and [maybe] a format, + returns the most likely format of this file. + */ + static Format resolveFormat( + const std::string& filename, + const uint8* data, + int dataLen, + Format maybeFormat); + + void _copy( + const GImage& other); + +public: + + /** Predicts the image file format of \a filename */ + static Format resolveFormat(const std::string& filename); + + void flipHorizontal(); + void flipVertical(); + void rotate90CW(int numTimes = 1); + + /** + Create an empty image of the given size. + \sa load() + */ + GImage( + int width = 0, + int height = 0, + int channels = 3, + const MemoryManager::Ref& m = MemoryManager::create()); + + /** + Load an encoded image from disk and decode it. + Throws GImage::Error if something goes wrong. + */ + GImage( + const std::string& filename, + Format format = AUTODETECT, + const MemoryManager::Ref& m = MemoryManager::create()); + + /** + Decodes an image stored in a buffer. + */ + GImage( + const unsigned char*data, + int length, + Format format = AUTODETECT, + const MemoryManager::Ref& m = MemoryManager::create()); + + GImage( + const GImage& other, + const MemoryManager::Ref& m = MemoryManager::create()); + + GImage& operator=(const GImage& other); + + /** + Returns a new GImage that has 4 channels. RGB is + taken from this GImage and the alpha from the red + channel of the supplied image. The new GImage is passed + as a reference parameter for speed. + */ + void insertRedAsAlpha(const GImage& alpha, GImage& output) const; + + /** + Returns a new GImage with 3 channels, removing + the alpha channel if there is one. The new GImage + is passed as a reference parameter for speed. + */ + void stripAlpha(GImage& output) const; + + /** + Loads an image from disk (clearing the old one first), + using the existing memory manager. + */ + void load( + const std::string& filename, + Format format = AUTODETECT); + + /** + Frees memory and resets to a 0x0 image. + */ + void clear(); + + /** + Deallocates the pixels. + */ + virtual ~GImage(); + + /** + Resizes the internal buffer to (\a width x \a height) with the + number of \a channels specified. + + \param zero If true, all data is set to 0 (black). + */ + void resize(int width, int height, int channels, bool zero = true); + + /** + Copies src sub-image data into dest at a certain offset. + The dest variable must already contain an image that is large + enough to contain the src sub-image at the specified offset. + Returns true on success and false if the src sub-image cannot + completely fit within dest at the specified offset. Both + src and dest must have the same number of channels. + */ + static bool pasteSubImage( + GImage& dest, + const GImage& src, + int destX, + int destY, + int srcX, + int srcY, + int srcWidth, + int srcHeight); + + /** + creates dest from src sub-image data. + Returns true on success and false if the src sub-image + is not within src. + */ + static bool copySubImage(GImage & dest, const GImage & src, + int srcX, int srcY, int srcWidth, int srcHeight); + + void convertToRGBA(); + + void convertToRGB(); + + /** Averages color channels if they exist */ + void convertToL8(); + + /** + Returns true if format is supported. Format + should be an extension string (e.g. "BMP"). + */ + static bool supportedFormat( + const std::string& format); + + /** + Converts a string to an enum, returns UNKNOWN if not recognized. + */ + static Format stringToFormat( + const std::string& format); + + /** + Encode and save to disk. + */ + void save( + const std::string& filename, + Format format = AUTODETECT) const; + + /** + The caller must delete the returned buffer. + TODO: provide a memory manager + */ + void encode( + Format format, + uint8*& outData, + int& outLength) const; + + /** + Does not commit the BinaryOutput when done. + */ + void encode( + Format format, + BinaryOutput& out) const; + + /** + Decodes the buffer into this image. + @param format Must be the correct format. + */ + void decode( + BinaryInput& input, + Format format); + + /** Returns the size of this object in bytes */ + int sizeInMemory() const; + + /** Ok for in == out */ + static void R8G8B8_to_Y8U8V8(int width, int height, const uint8* in, uint8* out); + + /** Ok for in == out */ + static void Y8U8V8_to_R8G8B8(int width, int height, const uint8* in, uint8* out); + + /** + @param in RGB buffer of numPixels * 3 bytes + @param out Buffer of numPixels * 4 bytes + @param numPixels Number of RGB pixels to convert + */ + static void RGBtoRGBA( + const uint8* in, + uint8* out, + int numPixels); + + static void RGBtoARGB( + const uint8* in, + uint8* out, + int numPixels); + + static void LtoRGB + (const uint8* in, + uint8* out, + int numPixels); + + static void LtoRGBA + (const uint8* in, + uint8* out, + int numPixels); + + /** Safe for in == out */ + static void RGBtoBGR( + const uint8* in, + uint8* out, + int numPixels); + + /** + Win32 32-bit HDC format. + */ + static void RGBtoBGRA( + const uint8* in, + uint8* out, + int numPixels); + + static void RGBAtoRGB( + const uint8* in, + uint8* out, + int numPixels); + /** + Uses the red channel of the second image as an alpha channel. + */ + static void RGBxRGBtoRGBA( + const uint8* colorRGB, + const uint8* alphaRGB, + uint8* out, + int numPixels); + + /** + Flips the image along the vertical axis. + Safe for in == out. + */ + static void flipRGBVertical( + const uint8* in, + uint8* out, + int width, + int height); + + static void flipRGBAVertical( + const uint8* in, + uint8* out, + int width, + int height); + + /** + Given a tangent space bump map, computes a new image where the + RGB channels are a tangent space normal map and the alpha channel + is the original bump map. Assumes the input image is tileable. + + In the resulting image, x = red = tangent, y = green = binormal, and z = blue = normal. + + Particularly useful as part of the idiom: +
+ 	    GImage normal;
+	    computeNormalMap(GImage(filename), normal);
+	    return Texture::fromGImage(filename, normal);
+    
+ + */ + static void computeNormalMap( + const class GImage& bump, + class GImage& normal, + const BumpMapPreprocess& preprocess = BumpMapPreprocess()); + + static void computeNormalMap + (int width, + int height, + int channels, + const uint8* src, + GImage& normal, + const BumpMapPreprocess& preprocess = BumpMapPreprocess()); + + /** + Bayer demosaicing using the filter proposed in + + HIGH-QUALITY LINEAR INTERPOLATION FOR DEMOSAICING OF BAYER-PATTERNED COLOR IMAGES + Henrique S. Malvar, Li-wei He, and Ross Cutler + + The filter wraps at the image boundaries. + + Assumes in != out. + */ + static void BAYER_G8B8_R8G8_to_R8G8B8_MHC(int w, int h, const uint8* in, uint8* _out); + static void BAYER_G8R8_B8G8_to_R8G8B8_MHC(int w, int h, const uint8* in, uint8* _out); + static void BAYER_R8G8_G8B8_to_R8G8B8_MHC(int w, int h, const uint8* in, uint8* _out); + static void BAYER_B8G8_G8R8_to_R8G8B8_MHC(int w, int h, const uint8* in, uint8* _out); + + /** Fast conversion; the output has 1/2 the size of the input in each direction. Assumes in != out. + See G3D::BAYER_G8B8_R8G8_to_R8G8B8_MHC for a much better result. */ + static void BAYER_G8B8_R8G8_to_Quarter_R8G8B8 + (int inWidth, + int inHeight, + const uint8* in, + uint8* out); + + /** Attempt to undo fast conversion of G3D::BAYER_G8B8_R8G8_to_Quarter_R8G8B8; + the green channel will lose data. Assumes in != out + The input should have size 3 * inWidth * inHeight. The output should have size + 2 * inWidth * 2 * inHeight. + */ + static void Quarter_R8G8B8_to_BAYER_G8B8_R8G8 + (int inWidth, + int inHeight, + const uint8* in, + uint8* out); + + /** Overwrites every pixel with one of the two colors in a checkerboard pattern. + The fields used from the two colors depend on the current number of channels in @a im. + */ + static void makeCheckerboard + (GImage& im, + int checkerSize = 1, + const Color4uint8& color1 = Color4uint8(255,255,255,255), + const Color4uint8& color2 = Color4uint8(0,0,0,255)); +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/GLight.h b/externals/g3dlite/G3D/GLight.h new file mode 100644 index 0000000..3a95f1a --- /dev/null +++ b/externals/g3dlite/G3D/GLight.h @@ -0,0 +1,106 @@ +/** + @file GLight.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-11-12 + @edited 2009-11-08 +*/ + +#ifndef G3D_GLight_h +#define G3D_GLight_h + +#include "G3D/platform.h" +#include "G3D/Vector4.h" +#include "G3D/Vector3.h" +#include "G3D/Color4.h" + +namespace G3D { +class Any; + +/** + A light representation that closely follows the OpenGL light format. + */ +class GLight { +public: + /** World space position (for a directional light, w = 0 */ + Vector4 position; + + /** For a spot or directional light, this is the "right vector" that will be used when constructing + a reference frame(). */ + Vector3 rightDirection; + + /** Direction in which the light faces, if a spot light. This is the "look vector" of the light source. */ + Vector3 spotDirection; + + /** In degrees. 180 = no cutoff (point/dir). Values less than 90 = spot light */ + float spotCutoff; + + /** If true, G3D::SuperShader will render a cone of light large + enough to encompass the entire square that bounds the cutoff + angle. This produces a square prism instead of a cone of light + when used with a G3D::ShadowMap. for an unshadowed light this + has no effect.*/ + bool spotSquare; + + /** Constant, linear, quadratic */ + float attenuation[3]; + + /** May be outside the range [0, 1] */ + Color3 color; + + /** If false, this light is ignored */ + bool enabled; + + /** If false, this light does not create specular highlights + (useful when using negative lights). */ + bool specular; + + /** If false, this light does not create diffuse illumination + (useful when rendering a specular-only pass). */ + bool diffuse; + + GLight(); + + /** Accepted forms: + - GLight::directional( vector3, color3, [bool, [bool]]) + - GLight::spot(vector3, vector3, #, color3, [#, [#, [#, [#, [bool, [bool]]]]) + - GLight::point(vector3, color3, [#, [#, [#, [#, [bool, [bool]]]]) + - GLight { [all fields] } + */ + GLight(const Any& any); + + /** Converts the Color3 to an Any. */ + operator Any() const; + + /** @param toLight will be normalized */ + static GLight directional(const Vector3& toLight, const Color3& color, bool specular = true, bool diffuse = true); + + static GLight point(const Vector3& pos, const Color3& color, float constAtt = 1, float linAtt = 0, float quadAtt = 0.5f, bool specular = true, bool diffuse = true); + + /** @param pointDirection Will be normalized. Points in the + direction that light propagates. + + @param cutOffAngleDegrees Must be on the range [0, 90]. This + is the angle from the point direction to the edge of the light + cone. I.e., a value of 45 produces a light with a 90-degree + cone of view. + */ + static GLight spot(const Vector3& pos, const Vector3& pointDirection, float cutOffAngleDegrees, + const Color3& color, float constAtt = 1, float linAtt = 0, float quadAtt = 0, + bool specular = true, bool diffuse = true); + + /** Returns the sphere within which this light has some noticable effect. May be infinite. + @param cutoff The value at which the light intensity is considered negligible. */ + class Sphere effectSphere(float cutoff = 30.0f / 255) const; + + /** Computes a reference frame (e.g., for use with G3D::ShadowMap */ + class CoordinateFrame frame() const; + + bool operator==(const GLight& other) const; + bool operator!=(const GLight& other) const; +}; + +} // namespace +#endif + diff --git a/externals/g3dlite/G3D/GMutex.h b/externals/g3dlite/G3D/GMutex.h new file mode 100644 index 0000000..3469b81 --- /dev/null +++ b/externals/g3dlite/G3D/GMutex.h @@ -0,0 +1,123 @@ +/** + @file GMutex.h + + @created 2005-09-22 + @edited 2009-03-25 + */ + +#ifndef G3D_GMutex_h +#define G3D_GMutex_h + +#include "G3D/platform.h" +#include "G3D/AtomicInt32.h" +#include "G3D/debugAssert.h" +#include + +#ifndef G3D_WIN32 +# include +# include +#endif + + +namespace G3D { + +/** + \brief A mutual exclusion lock that busy-waits when locking. + + On a machine with one (significant) thread per processor core, + a spinlock may be substantially faster than a mutex. + + \sa G3D::GThread, G3D::GMutex, G3D::AtomicInt32 + */ +class Spinlock { +private: + + AtomicInt32 x; + +public: + + inline Spinlock() : x(0) {} + + /** Busy waits until the lock is unlocked, then locks it + exclusively. Returns true if the lock succeeded on the first + try (indicating no contention). */ + inline bool lock() { + bool first = true; + while (x.compareAndSet(0, 1) == 1) { + first = false; +# ifdef G3D_WIN32 + Sleep(0); +# else + usleep(0); +# endif + } + return first; + } + + inline void unlock() { + x.compareAndSet(1, 0); + } + +}; + +/** + \brief Mutual exclusion lock used for synchronization. + + @sa G3D::GThread, G3D::AtomicInt32, G3D::Spinlock +*/ +class GMutex { +private: +# ifdef G3D_WIN32 + CRITICAL_SECTION m_handle; +# else + pthread_mutex_t m_handle; + pthread_mutexattr_t m_attr; +# endif + + // Not implemented on purpose, don't use + GMutex(const GMutex &mlock); + GMutex &operator=(const GMutex &); + bool operator==(const GMutex&); + +public: + GMutex(); + ~GMutex(); + + /** Locks the mutex or blocks until available. */ + void lock(); + + /** Locks the mutex if it not already locked. + Returns true if lock successful, false otherwise. */ + bool tryLock(); + + /** Unlocks the mutex. */ + void unlock(); +}; + + +/** + Automatically locks while in scope. +*/ +class GMutexLock { +private: + GMutex* m; + + // Not implemented on purpose, don't use + GMutexLock(const GMutexLock &mlock); + GMutexLock &operator=(const GMutexLock &); + bool operator==(const GMutexLock&); + +public: + GMutexLock(GMutex* mutex) { + m = mutex; + m->lock(); + } + + ~GMutexLock() { + m->unlock(); + } +}; + +} // G3D + +#endif diff --git a/externals/g3dlite/G3D/GThread.h b/externals/g3dlite/G3D/GThread.h new file mode 100644 index 0000000..58437ef --- /dev/null +++ b/externals/g3dlite/G3D/GThread.h @@ -0,0 +1,121 @@ +/** + @file GThread.h + + @created 2005-09-22 + @edited 2007-01-31 + + */ + +#ifndef G3D_GTHREAD_H +#define G3D_GTHREAD_H + +#include "G3D/platform.h" +#include "G3D/ReferenceCount.h" +#include + +#ifndef G3D_WIN32 +# include +# include +#endif + + +namespace G3D { + +typedef ReferenceCountedPointer GThreadRef; + +/** + Platform independent thread implementation. You can either subclass and + override GThread::threadMain or call the create method with a method. + + Beware of reference counting and threads. If circular references exist between + GThread subclasses then neither class will ever be deallocated. Also, + dropping all pointers (and causing deallocation) of a GThread does NOT + stop the underlying process. + + @sa G3D::GMutex, G3D::Spinlock, G3D::AtomicInt32 +*/ +class GThread : public ReferenceCountedObject { +private: + // "Status" is a reserved work on FreeBSD + enum GStatus {STATUS_CREATED, STATUS_STARTED, STATUS_RUNNING, STATUS_COMPLETED}; + + // Not implemented on purpose, don't use + GThread(const GThread &); + GThread& operator=(const GThread&); + bool operator==(const GThread&); + +#ifdef G3D_WIN32 + static DWORD WINAPI internalThreadProc(LPVOID param); +#else + static void* internalThreadProc(void* param); +#endif //G3D_WIN32 + + volatile GStatus m_status; + + // Thread handle to hold HANDLE and pthread_t +#ifdef G3D_WIN32 + HANDLE m_handle; + HANDLE m_event; +#else + pthread_t m_handle; +#endif //G3D_WIN32 + + std::string m_name; + +protected: + + /** Overriden by the thread implementor */ + virtual void threadMain() = 0; + +public: + typedef ReferenceCountedPointer Ref; + enum SpawnBehavior {USE_NEW_THREAD, USE_CURRENT_THREAD}; + + GThread(const std::string& name); + + virtual ~GThread(); + + /** Constructs a basic GThread without requiring a subclass. + + @param proc The global or static function for the threadMain() */ + static GThreadRef create(const std::string& name, void (*proc)(void*), void* param = NULL); + + /** Starts the thread and executes threadMain(). Returns false if + the thread failed to start (either because it was already started + or because the OS refused). + + @param behavior If USE_CURRENT_THREAD, rather than spawning a new thread, this routine + runs threadMain on the current thread. + */ + bool start(SpawnBehavior behavior = USE_NEW_THREAD); + + /** Terminates the thread without notifying or + waiting for a cancelation point. */ + void terminate(); + + /** + Returns true if threadMain is currently executing. This will + only be set when the thread is actually running and might not + be set when start() returns. */ + bool running() const; + + /** True after start() has been called, even through the thread + may have already completed(), or be currently running().*/ + bool started() const; + + /** Returns true if the thread has exited. */ + bool completed() const; + + /** Waits for the thread to finish executing. */ + void waitForCompletion(); + + /** Returns thread name */ + inline const std::string& name() { + return m_name; + } +}; + + +} // namespace G3D + +#endif //G3D_GTHREAD_H diff --git a/externals/g3dlite/G3D/GUniqueID.h b/externals/g3dlite/G3D/GUniqueID.h new file mode 100644 index 0000000..c8b775c --- /dev/null +++ b/externals/g3dlite/G3D/GUniqueID.h @@ -0,0 +1,69 @@ +/** + @file GUniqueID.h + @author Morgan McGuire, http://graphics.cs.williams.edu + */ +#ifndef G3D_GUNIQUEID_H +#define G3D_GUNIQUEID_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Table.h" + +namespace G3D { + +/** Globally unique identifiers. The probability of two different + programs generating the same value from UniqueID::create is + vanishingly small. + + UniqueIDs optionally contain a 10-bit application specific tag + that distinguishes their type. +*/ +class GUniqueID { +private: + + uint64 id; + +public: + + GUniqueID() : id(0) {} + + bool uninitialized() const { + return id == 0; + } + + uint16 tag() const { + return id >> 54; + } + + operator uint64() const { + return id; + } + + bool operator==(const GUniqueID& other) const { + return id == other.id; + } + + bool operator!=(const GUniqueID& other) const { + return id != other.id; + } + + void serialize(class BinaryOutput& b) const; + + void deserialize(class BinaryInput& b); + + void serialize(class TextOutput& t) const; + + void deserialize(class TextInput& t); + + /** Create a new ID */ + static GUniqueID create(uint16 tag = 0); +}; + +} // G3D + +/** For Table and Set */ +template<> struct HashTrait { + static size_t hashCode(G3D::GUniqueID id) { return (size_t)(G3D::uint64)id; } +}; + +#endif diff --git a/externals/g3dlite/G3D/HashTrait.h b/externals/g3dlite/G3D/HashTrait.h new file mode 100644 index 0000000..ca35da4 --- /dev/null +++ b/externals/g3dlite/G3D/HashTrait.h @@ -0,0 +1,92 @@ +/** + @file HashTrait.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2008-10-01 + @edited 2009-11-01 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_HashTrait_h +#define G3D_HashTrait_h + +#include "G3D/platform.h" +#include "G3D/Crypto.h" +#include "G3D/g3dmath.h" +#include "G3D/uint128.h" + +/** Must be specialized for custom types. + @see G3D::Table for specialization requirements. +*/ +template struct HashTrait{}; + +template struct HashTrait { + static size_t hashCode(const void* k) { return reinterpret_cast(k); } +}; + +#if 0 +template <> struct HashTrait { + static size_t hashCode(int k) { return static_cast(k); } +}; +#endif + +template <> struct HashTrait { + static size_t hashCode(G3D::int16 k) { return static_cast(k); } +}; + +template <> struct HashTrait { + static size_t hashCode(G3D::uint16 k) { return static_cast(k); } +}; + +//template <> struct HashTrait { +// static size_t hashCode(int k) { return static_cast(k); } +//}; + +template <> struct HashTrait { + static size_t hashCode(G3D::int32 k) { return static_cast(k); } +}; + +template <> struct HashTrait { + static size_t hashCode(G3D::uint32 k) { return static_cast(k); } +}; + +#if 0 +template <> struct HashTrait { + static size_t hashCode(G3D::uint32 k) { return static_cast(k); } +}; +#endif + +template <> struct HashTrait { + static size_t hashCode(G3D::int64 k) { return static_cast(k); } +}; + +template <> struct HashTrait { + static size_t hashCode(G3D::uint64 k) { return static_cast(k); } +}; + +template <> struct HashTrait { + static size_t hashCode(const std::string& k) { return static_cast(G3D::Crypto::crc32(k.c_str(), k.size())); } +}; + +template <> struct HashTrait { + // Use the FNV-1 hash (http://isthe.com/chongo/tech/comp/fnv/#FNV-1). + static size_t hashCode(G3D::uint128 key) { + static const G3D::uint128 FNV_PRIME_128(1 << 24, 0x159); + static const G3D::uint128 FNV_OFFSET_128(0xCF470AAC6CB293D2ULL, 0xF52F88BF32307F8FULL); + + G3D::uint128 hash = FNV_OFFSET_128; + G3D::uint128 mask(0, 0xFF); + for (int i = 0; i < 16; ++i) { + hash *= FNV_PRIME_128; + hash ^= (mask & key); + key >>= 8; + } + + G3D::uint64 foldedHash = hash.hi ^ hash.lo; + return static_cast((foldedHash >> 32) ^ (foldedHash & 0xFFFFFFFF)); + } +}; + +#endif diff --git a/externals/g3dlite/G3D/Image1.h b/externals/g3dlite/G3D/Image1.h new file mode 100644 index 0000000..711e83f --- /dev/null +++ b/externals/g3dlite/G3D/Image1.h @@ -0,0 +1,81 @@ +/** + @file Image1.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-01-31 + @edited 2007-01-31 +*/ + + +#ifndef G3D_IMAGE1_H +#define G3D_IMAGE1_H + +#include "G3D/platform.h" +#include "G3D/Map2D.h" +#include "G3D/Color1.h" +#include "G3D/GImage.h" + +namespace G3D { + +typedef ReferenceCountedPointer Image1Ref; + +/** + Luminance image with 32-bit floating point storage. + + See also G3D::Image1uint8, G3D::GImage. + */ +class Image1 : public Map2D { +public: + + typedef Image1 Type; + typedef ReferenceCountedPointer Ref; + typedef Color1 Storage; + typedef Color1 Compute; + +protected: + + Image1(int w, int h, WrapMode wrap); + + void copyGImage(const class GImage& im); + void copyArray(const Color1* src, int w, int h); + void copyArray(const Color3* src, int w, int h); + void copyArray(const Color4* src, int w, int h); + void copyArray(const Color1uint8* src, int w, int h); + void copyArray(const Color3uint8* src, int w, int h); + void copyArray(const Color4uint8* src, int w, int h); + +public: + + const class ImageFormat* format() const; + + /** Creates an all-zero width x height image. */ + static Ref createEmpty(int width, int height, WrapMode wrap = WrapMode::ERROR); + + /** Creates a 0 x 0 image. */ + static Ref createEmpty(WrapMode wrap = WrapMode::ERROR); + + static Ref fromFile(const std::string& filename, WrapMode wrap = WrapMode::ERROR, GImage::Format fmt = GImage::AUTODETECT); + + static Ref fromArray(const class Color1uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color1* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + + static Ref fromImage1uint8(const ReferenceCountedPointer& im); + + static Ref fromGImage(const class GImage& im, WrapMode wrap = WrapMode::ERROR); + + /** Loads from any of the file formats supported by G3D::GImage. If there is an alpha channel on the input, + it is stripped. */ + void load(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Saves in any of the formats supported by G3D::GImage. */ + void save(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); +}; + +} // G3D + +#endif diff --git a/externals/g3dlite/G3D/Image1uint8.h b/externals/g3dlite/G3D/Image1uint8.h new file mode 100644 index 0000000..f32e022 --- /dev/null +++ b/externals/g3dlite/G3D/Image1uint8.h @@ -0,0 +1,80 @@ +/** + @file Image1uint8.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-01-31 + @edited 2007-01-31 +*/ + +#ifndef G3D_IMAGE1UINT8_H +#define G3D_IMAGE1UINT8_H + +#include "G3D/platform.h" +#include "G3D/Map2D.h" +#include "G3D/Color1uint8.h" +#include "G3D/Color1.h" +#include "G3D/GImage.h" + +namespace G3D { + +typedef ReferenceCountedPointer Image1uint8Ref; + +/** + Compact storage for luminance 8-bit images. + + See also G3D::Image3, G3D::GImage + */ +class Image1uint8 : public Map2D { +public: + + typedef Image1uint8 Type; + typedef Image1uint8Ref Ref; + +protected: + + Image1uint8(int w, int h, WrapMode wrap); + + void copyGImage(const class GImage& im); + void copyArray(const Color1* src, int w, int h); + void copyArray(const Color3* src, int w, int h); + void copyArray(const Color4* src, int w, int h); + void copyArray(const Color1uint8* src, int w, int h); + void copyArray(const Color3uint8* src, int w, int h); + void copyArray(const Color4uint8* src, int w, int h); + +public: + + const class ImageFormat* format() const; + + /** Creates an all-zero width x height image. */ + static Ref createEmpty(int width, int height, WrapMode wrap = WrapMode::ERROR); + + /** Creates a 0 x 0 image. */ + static Ref createEmpty(WrapMode wrap = WrapMode::ERROR); + + static Ref fromFile(const std::string& filename, WrapMode wrap = WrapMode::ERROR, GImage::Format fmt = GImage::AUTODETECT); + + static Ref fromGImage(const class GImage& im, WrapMode wrap = WrapMode::ERROR); + + static Ref fromArray(const class Color1uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color1* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + + static Ref fromImage1(const ReferenceCountedPointer& im); + static Ref fromImage3uint8(const ReferenceCountedPointer& im); + + /** Loads from any of the file formats supported by G3D::GImage. If there is an alpha channel on the input, + it is stripped. */ + void load(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Saves in any of the formats supported by G3D::GImage. */ + void save(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); +}; + +} // G3D + +#endif diff --git a/externals/g3dlite/G3D/Image3.h b/externals/g3dlite/G3D/Image3.h new file mode 100644 index 0000000..13cb8fa --- /dev/null +++ b/externals/g3dlite/G3D/Image3.h @@ -0,0 +1,81 @@ +/** + @file Image3.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-01-31 + @edited 2007-01-31 +*/ + + +#ifndef G3D_IMAGE3_H +#define G3D_IMAGE3_H + +#include "G3D/platform.h" +#include "G3D/Map2D.h" +#include "G3D/Color3.h" +#include "G3D/GImage.h" + +namespace G3D { + +typedef ReferenceCountedPointer Image3Ref; + +/** + RGB image with 32-bit floating point storage for each channel. + + See also G3D::Image3uint8, G3D::GImage. + */ +class Image3 : public Map2D { +public: + + typedef Image3 Type; + typedef ReferenceCountedPointer Ref; + typedef Color3 Storage; + typedef Color3 Compute; + +protected: + + Image3(int w, int h, WrapMode wrap); + + void copyGImage(const class GImage& im); + void copyArray(const Color1* src, int w, int h); + void copyArray(const Color3* src, int w, int h); + void copyArray(const Color4* src, int w, int h); + void copyArray(const Color1uint8* src, int w, int h); + void copyArray(const Color3uint8* src, int w, int h); + void copyArray(const Color4uint8* src, int w, int h); + +public: + + const class ImageFormat* format() const; + + /** Creates an all-zero width x height image. */ + static Ref createEmpty(int width, int height, WrapMode wrap = WrapMode::ERROR); + + /** Creates a 0 x 0 image. */ + static Ref createEmpty(WrapMode wrap = WrapMode::ERROR); + + static Ref fromFile(const std::string& filename, WrapMode wrap = WrapMode::ERROR, GImage::Format fmt = GImage::AUTODETECT); + + static Ref fromArray(const class Color1uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color1* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + + static Ref fromImage3uint8(const ReferenceCountedPointer& im); + + static Ref fromGImage(const class GImage& im, WrapMode wrap = WrapMode::ERROR); + + /** Loads from any of the file formats supported by G3D::GImage. If there is an alpha channel on the input, + it is stripped. */ + void load(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Saves in any of the formats supported by G3D::GImage. */ + void save(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); +}; + +} // G3D + +#endif diff --git a/externals/g3dlite/G3D/Image3uint8.h b/externals/g3dlite/G3D/Image3uint8.h new file mode 100644 index 0000000..d4fdbc1 --- /dev/null +++ b/externals/g3dlite/G3D/Image3uint8.h @@ -0,0 +1,85 @@ +/** + @file Image3uint8.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-01-31 + @edited 2007-01-31 +*/ + +#ifndef G3D_IMAGE3UINT8_H +#define G3D_IMAGE3UINT8_H + +#include "G3D/platform.h" +#include "G3D/Map2D.h" +#include "G3D/Color3uint8.h" +#include "G3D/Color3.h" +#include "G3D/GImage.h" + +namespace G3D { + +typedef ReferenceCountedPointer Image3uint8Ref; + +/** + Compact storage for RGB 8-bit per channel images. + + See also G3D::Image3, G3D::GImage + */ +class Image3uint8 : public Map2D { +public: + + typedef Image3uint8 Type; + typedef Image3uint8Ref Ref; + +protected: + + Image3uint8(int w, int h, WrapMode wrap); + + void copyGImage(const class GImage& im); + void copyArray(const Color1* src, int w, int h); + void copyArray(const Color3* src, int w, int h); + void copyArray(const Color4* src, int w, int h); + void copyArray(const Color1uint8* src, int w, int h); + void copyArray(const Color3uint8* src, int w, int h); + void copyArray(const Color4uint8* src, int w, int h); + +public: + + const class ImageFormat* format() const; + + /** Creates an all-zero width x height image. */ + static Ref createEmpty(int width, int height, WrapMode wrap = WrapMode::ERROR); + + + /** Creates a 0 x 0 image. */ + static Ref createEmpty(WrapMode wrap = WrapMode::ERROR); + + + static Ref fromFile(const std::string& filename, WrapMode wrap = WrapMode::ERROR, GImage::Format fmt = GImage::AUTODETECT); + + static Ref fromGImage(const class GImage& im, WrapMode wrap = WrapMode::ERROR); + + static Ref fromArray(const class Color1uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color1* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + + static Ref fromImage3(const ReferenceCountedPointer& im); + static Ref fromImage1uint8(const ReferenceCountedPointer& im); + + /** Loads from any of the file formats supported by G3D::GImage. If there is an alpha channel on the input, + it is stripped. */ + void load(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Saves in any of the formats supported by G3D::GImage. */ + void save(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Extracts color channel 0 <= c <= 2 and returns it as a new monochrome image. */ + ReferenceCountedPointer getChannel(int c) const; +}; + +} // G3D + +#endif diff --git a/externals/g3dlite/G3D/Image4.h b/externals/g3dlite/G3D/Image4.h new file mode 100644 index 0000000..21d7f1e --- /dev/null +++ b/externals/g3dlite/G3D/Image4.h @@ -0,0 +1,86 @@ +/** + @file Image4.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-01-31 + @edited 2007-01-31 +*/ + + +#ifndef G3D_IMAGE4_H +#define G3D_IMAGE4_H + +#include "G3D/platform.h" +#include "G3D/Map2D.h" +#include "G3D/Color4.h" +#include "G3D/GImage.h" + +namespace G3D { + +typedef ReferenceCountedPointer Image4Ref; + +/** + RGBA image with 32-bit floating point storage for each channel. + + Whenever a method needs to convert from RGB to RGBA, A=1 is assumed. + + Bilinear interpolation on Image4 is about 8x faster than on + Image4uint8 due to the large cost of converting int->float on modern + machines. + + @sa G3D::Image4uint8, G3D::GImage. + */ +class Image4 : public Map2D { +public: + + typedef Image4 Type; + typedef ReferenceCountedPointer Ref; + typedef Color4 Storage; + typedef Color4 Compute; + +protected: + + Image4(int w, int h, WrapMode wrap); + + void copyGImage(const class GImage& im); + void copyArray(const Color1* src, int w, int h); + void copyArray(const Color3* src, int w, int h); + void copyArray(const Color4* src, int w, int h); + void copyArray(const Color1uint8* src, int w, int h); + void copyArray(const Color3uint8* src, int w, int h); + void copyArray(const Color4uint8* src, int w, int h); + +public: + + const class ImageFormat* format() const; + + /** Creates an all-zero width x height image. */ + static Ref createEmpty(int width, int height, WrapMode wrap = WrapMode::ERROR); + + /** Creates a 0 x 0 image. */ + static Ref createEmpty(WrapMode wrap = WrapMode::ERROR); + + static Ref fromFile(const std::string& filename, WrapMode wrap = WrapMode::ERROR, GImage::Format fmt = GImage::AUTODETECT); + + static Ref fromArray(const class Color1uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color1* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + + static Ref fromImage4uint8(const ReferenceCountedPointer& im); + + static Ref fromGImage(const class GImage& im, WrapMode wrap = WrapMode::ERROR); + + /** Loads from any of the file formats supported by G3D::GImage. */ + void load(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Saves in any of the formats supported by G3D::GImage. */ + void save(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); +}; + +} // G3D + +#endif diff --git a/externals/g3dlite/G3D/Image4uint8.h b/externals/g3dlite/G3D/Image4uint8.h new file mode 100644 index 0000000..46df6b4 --- /dev/null +++ b/externals/g3dlite/G3D/Image4uint8.h @@ -0,0 +1,85 @@ +/** + @file Image4uint8.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-01-31 + @edited 2007-01-31 +*/ + +#ifndef G3D_IMAGE4UINT8_H +#define G3D_IMAGE4UINT8_H + +#include "G3D/platform.h" +#include "G3D/Map2D.h" +#include "G3D/Color4uint8.h" +#include "G3D/Color4.h" +#include "G3D/GImage.h" +#include "G3D/Image1uint8.h" + +namespace G3D { + +typedef ReferenceCountedPointer Image4uint8Ref; + +/** + Compact storage for RGBA 8-bit per channel images. + + See also G3D::Image4, G3D::GImage + */ +class Image4uint8 : public Map2D { +public: + + typedef Image4uint8 Type; + typedef Image4uint8Ref Ref; + +protected: + + Image4uint8(int w, int h, WrapMode wrap); + + void copyGImage(const class GImage& im); + void copyArray(const Color1* src, int w, int h); + void copyArray(const Color3* src, int w, int h); + void copyArray(const Color4* src, int w, int h); + void copyArray(const Color1uint8* src, int w, int h); + void copyArray(const Color3uint8* src, int w, int h); + void copyArray(const Color4uint8* src, int w, int h); + +public: + + const class ImageFormat* format() const; + + /** Creates an all-zero width x height image. */ + static Ref createEmpty(int width, int height, WrapMode wrap = WrapMode::ERROR); + + + /** Creates a 0 x 0 image. */ + static Ref createEmpty(WrapMode wrap = WrapMode::ERROR); + + + static Ref fromFile(const std::string& filename, WrapMode wrap = WrapMode::ERROR, GImage::Format fmt = GImage::AUTODETECT); + + static Ref fromGImage(const class GImage& im, WrapMode wrap = WrapMode::ERROR); + + static Ref fromArray(const class Color1uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4uint8* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color1* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color3* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + static Ref fromArray(const class Color4* ptr, int width, int height, WrapMode wrap = WrapMode::ERROR); + + static Ref fromImage4(const ReferenceCountedPointer& im); + + /** Loads from any of the file formats supported by G3D::GImage. If there is an alpha channel on the input, + it is stripped. */ + void load(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Saves in any of the formats supported by G3D::GImage. */ + void save(const std::string& filename, GImage::Format fmt = GImage::AUTODETECT); + + /** Extracts color channel 0 <= c <= 3 and returns it as a new monochrome image. */ + ReferenceCountedPointer getChannel(int c) const; +}; + +} // G3D + +#endif diff --git a/externals/g3dlite/G3D/ImageFormat.h b/externals/g3dlite/G3D/ImageFormat.h new file mode 100644 index 0000000..7f09832 --- /dev/null +++ b/externals/g3dlite/G3D/ImageFormat.h @@ -0,0 +1,419 @@ +/** + @file ImageFormat.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-05-23 + @edited 2010-01-01 +*/ + +#ifndef GLG3D_ImageFormat_H +#define GLG3D_ImageFormat_H + +#include "G3D/platform.h" +#include "G3D/Table.h" +#include "G3D/enumclass.h" + +namespace G3D { + +/** Information about common image formats. + Don't construct these; use the methods provided. + + For most formats, the number indicates the number of bits per channel and a suffix of "F" indicates + floating point. This does not hold for the YUV and DXT formats.*/ +class ImageFormat { +public: + + // Must update ImageFormat::name() when this enum changes. + enum Code { + CODE_NONE = -1, + CODE_L8, + CODE_L16, + CODE_L16F, + CODE_L32F, + + CODE_A8, + CODE_A16, + CODE_A16F, + CODE_A32F, + + CODE_LA4, + CODE_LA8, + CODE_LA16, + CODE_LA16F, + CODE_LA32F, + + CODE_RGB5, + CODE_RGB5A1, + CODE_RGB8, + CODE_RGB10, + CODE_RGB10A2, + CODE_RGB16, + CODE_RGB16F, + CODE_RGB32F, + CODE_R11G11B10F, + CODE_RGB9E5F, + + CODE_RGB8I, + CODE_RGB8UI, + + CODE_ARGB8, + CODE_BGR8, + + CODE_RG8, + CODE_RG8I, + CODE_RG8UI, + + CODE_RGBA8, + CODE_RGBA16, + CODE_RGBA16F, + CODE_RGBA32F, + + CODE_RGBA32UI, + + CODE_BAYER_RGGB8, + CODE_BAYER_GRBG8, + CODE_BAYER_GBRG8, + CODE_BAYER_BGGR8, + CODE_BAYER_RGGB32F, + CODE_BAYER_GRBG32F, + CODE_BAYER_GBRG32F, + CODE_BAYER_BGGR32F, + + CODE_HSV8, + CODE_HSV32F, + + CODE_YUV420_PLANAR, + CODE_YUV422, + CODE_YUV444, + + CODE_RGB_DXT1, + CODE_RGBA_DXT1, + CODE_RGBA_DXT3, + CODE_RGBA_DXT5, + + CODE_SRGB8, + CODE_SRGBA8, + + CODE_SL8, + CODE_SLA8, + + CODE_SRGB_DXT1, + CODE_SRGBA_DXT1, + CODE_SRGBA_DXT3, + CODE_SRGBA_DXT5, + + CODE_DEPTH16, + CODE_DEPTH24, + CODE_DEPTH32, + CODE_DEPTH32F, + + CODE_STENCIL1, + CODE_STENCIL4, + CODE_STENCIL8, + CODE_STENCIL16, + + CODE_DEPTH24_STENCIL8, + + CODE_NUM + }; + + enum ColorSpace { + COLOR_SPACE_NONE, + COLOR_SPACE_RGB, + COLOR_SPACE_HSV, + COLOR_SPACE_YUV, + COLOR_SPACE_SRGB + }; + + enum BayerPattern { + BAYER_PATTERN_NONE, + BAYER_PATTERN_RGGB, + BAYER_PATTERN_GRBG, + BAYER_PATTERN_GBRG, + BAYER_PATTERN_BGGR + }; + + /** Number of channels (1 for a depth texture). */ + int numComponents; + bool compressed; + + /** Useful for serializing. */ + Code code; + + ColorSpace colorSpace; + + /** If this is a Bayer format, what is the pattern. */ + BayerPattern bayerPattern; + + /** The OpenGL format equivalent to this one, e.g, GL_RGB8 Zero if there is no equivalent. This is actually a GLenum */ + int openGLFormat; + + /** The OpenGL base format equivalent to this one (e.g., GL_RGB, GL_ALPHA). Zero if there is no equivalent. */ + int openGLBaseFormat; + + int luminanceBits; + + /** Number of bits per pixel storage for alpha values; Zero for compressed textures and non-RGB. */ + int alphaBits; + + /** Number of bits per pixel storage for red values; Zero for compressed textures and non-RGB. */ + int redBits; + + /** Number of bits per pixel storage for green values; Zero for compressed textures and non-RGB. */ + int greenBits; + + /** Number of bits per pixel storage for blue values; Zero for compressed textures and non-RGB. */ + int blueBits; + + /** Number of bits per pixel */ + int stencilBits; + + /** Number of depth bits (for depth textures; e.g. shadow maps) */ + int depthBits; + + /** Amount of CPU memory per pixel when packed into an array, discounting any end-of-row padding. */ + int cpuBitsPerPixel; + + /** Amount of CPU memory per pixel when packed into an array, discounting any end-of-row padding. + @deprecated Use cpuBitsPerPixel*/ + int packedBitsPerTexel; + + /** + Amount of GPU memory per pixel on most graphics cards, for formats supported by OpenGL. This is + only an estimate--the actual amount of memory may be different on your actual card. + + This may be greater than the sum of the per-channel bits + because graphics cards need to pad to the nearest 1, 2, or + 4 bytes. + */ + int openGLBitsPerPixel; + + /** @deprecated Use openGLBitsPerPixel */ + int hardwareBitsPerTexel; + + /** The OpenGL bytes (type) format of the data buffer used with this texture format, e.g., GL_UNSIGNED_BYTE */ + int openGLDataFormat; + + /** True if there is no alpha channel for this texture. */ + bool opaque; + + /** True if the bit depths specified are for float formats. */ + bool floatingPoint; + + /** Human readable name of this format.*/ + const std::string& name() const; + + /** Takes the same values that name() returns */ + static const ImageFormat* fromString(const std::string& s); + +private: + + ImageFormat + (int numComponents, + bool compressed, + int glFormat, + int glBaseFormat, + int luminanceBits, + int alphaBits, + int redBits, + int greenBits, + int blueBits, + int depthBits, + int stencilBits, + int hardwareBitsPerTexel, + int packedBitsPerTexel, + int glDataFormat, + bool opaque, + bool floatingPoint, + Code code, + ColorSpace colorSpace, + BayerPattern bayerPattern = BAYER_PATTERN_NONE); + +public: + + static const ImageFormat* L8(); + + static const ImageFormat* L16(); + + static const ImageFormat* L16F(); + + static const ImageFormat* L32F(); + + static const ImageFormat* A8(); + + static const ImageFormat* A16(); + + static const ImageFormat* A16F(); + + static const ImageFormat* A32F(); + + static const ImageFormat* LA4(); + + static const ImageFormat* LA8(); + + static const ImageFormat* LA16(); + + static const ImageFormat* LA16F(); + + static const ImageFormat* LA32F(); + + static const ImageFormat* BGR8(); + + static const ImageFormat* RG8(); + static const ImageFormat* RG8I(); + static const ImageFormat* RG8UI(); + + static const ImageFormat* RGB5(); + + static const ImageFormat* RGB5A1(); + + static const ImageFormat* RGB8(); + + static const ImageFormat* RGB10(); + + static const ImageFormat* RGB10A2(); + + static const ImageFormat* RGB16(); + + static const ImageFormat* RGB16F(); + + static const ImageFormat* RGB32F(); + + static const ImageFormat* RGBA8(); + + static const ImageFormat* RGBA16(); + + static const ImageFormat* RGBA16F(); + + static const ImageFormat* RGBA32F(); + + static const ImageFormat* RGBA32UI(); + + static const ImageFormat* R11G11B10F(); + + static const ImageFormat* RGB9E5F(); + + static const ImageFormat* RGB8I(); + + static const ImageFormat* RGB8UI(); + + static const ImageFormat* RGB_DXT1(); + + static const ImageFormat* RGBA_DXT1(); + + static const ImageFormat* RGBA_DXT3(); + + static const ImageFormat* RGBA_DXT5(); + + static const ImageFormat* SRGB8(); + + static const ImageFormat* SRGBA8(); + + static const ImageFormat* SL8(); + + static const ImageFormat* SLA8(); + + static const ImageFormat* SRGB_DXT1(); + + static const ImageFormat* SRGBA_DXT1(); + + static const ImageFormat* SRGBA_DXT3(); + + static const ImageFormat* SRGBA_DXT5(); + + static const ImageFormat* DEPTH16(); + + static const ImageFormat* DEPTH24(); + + static const ImageFormat* DEPTH32(); + + static const ImageFormat* DEPTH32F(); + + static const ImageFormat* STENCIL1(); + + static const ImageFormat* STENCIL4(); + + static const ImageFormat* STENCIL8(); + + static const ImageFormat* STENCIL16(); + + static const ImageFormat* DEPTH24_STENCIL8(); + + static const ImageFormat* YUV420_PLANAR(); + + static const ImageFormat* YUV422(); + + static const ImageFormat* YUV444(); + + /** + NULL pointer; indicates that the G3D::Texture class should choose + either RGBA8 or RGB8 depending on the presence of an alpha channel + in the input. + */ + static const ImageFormat* AUTO() { return NULL; } + + /** Returns DEPTH16, DEPTH24, or DEPTH32 according to the bits + specified. You can use "glGetInteger(GL_DEPTH_BITS)" to match + the screen's format.*/ + static const ImageFormat* depth(int depthBits = 24); + + /** Returns STENCIL1, STENCIL4, STENCIL8 or STENCIL16 according to the bits + specified. You can use "glGetInteger(GL_STENCIL_BITS)" to match + the screen's format.*/ + static const ImageFormat* stencil(int bits = 8); + + /** Returns the matching ImageFormat* identified by the Code. May return NULL + if this format's code is reserved but not yet implemented by G3D. */ + static const ImageFormat* fromCode(ImageFormat::Code code); + + + + /** For use with ImageFormat::convert. */ + class BayerAlgorithm { + public: + enum Value { + NEAREST, + BILINEAR, + MHC, + HIGH_QUALITY = MHC + }; + private: + + Value value; + + public: + + G3D_DECLARE_ENUM_CLASS_METHODS(BayerAlgorithm); + }; + + /** Converts between arbitrary formats on the CPU. Not all format conversions are supported or directly supported. + Formats without direct conversions will attempt to convert through RGBA first. + + A conversion routine might only support source or destination padding or y inversion or none. + If support is needed and not available in any of the direct conversion routines, then no conversion is done. + + YUV422 expects data in YUY2 format (Y, U, Y2, v). Most YUV formats require width and heights that are multiples of 2. + + Returns true if a conversion was available, false if none occurred. + */ + static bool convert(const Array& srcBytes, int srcWidth, int srcHeight, const ImageFormat* srcFormat, int srcRowPadBits, + const Array& dstBytes, const ImageFormat* dstFormat, int dstRowPadBits, + bool invertY = false, BayerAlgorithm bayerAlg = BayerAlgorithm::HIGH_QUALITY); + + /* Checks if a conversion between two formats is available. */ + static bool conversionAvailable(const ImageFormat* srcFormat, int srcRowPadBits, const ImageFormat* dstFormat, int dstRowPadBits, bool invertY = false); +}; + +typedef ImageFormat TextureFormat; + +} + +template <> +struct HashTrait { + static size_t hashCode(const G3D::ImageFormat* key) { return reinterpret_cast(key); } +}; + + + +#endif diff --git a/externals/g3dlite/G3D/Intersect.h b/externals/g3dlite/G3D/Intersect.h new file mode 100644 index 0000000..4a3c8fb --- /dev/null +++ b/externals/g3dlite/G3D/Intersect.h @@ -0,0 +1,55 @@ +/** + @file Intersect.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2009-06-29 + @edited 2009-06-29 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + + From the G3D Innovation Engine + http://g3d.sf.net + */ +#ifndef G3D_Intersect +#define G3D_Intersect + +#include "G3D/platform.h" +#include "G3D/Ray.h" +#include "G3D/AABox.h" + +namespace G3D { + +/** + @beta + */ +class Intersect { +public: + + /** \brief Returns true if the intersection of the ray and the solid box is non-empty. + + \cite "Fast Ray / Axis-Aligned Bounding Box Overlap Tests using Ray Slopes" + by Martin Eisemann, Thorsten Grosch, Stefan Müller and Marcus Magnor + Computer Graphics Lab, TU Braunschweig, Germany and + University of Koblenz-Landau, Germany + */ + static bool __fastcall rayAABox(const Ray& ray, const AABox& box); + + /** \brief Returns true if the intersection of the ray and the solid box is non-empty. + + \param time If there is an intersection, set to the time to that intersection. If the ray origin is inside the box, + this is a negative value indicating the distance backwards from the ray origin to the first intersection. + \a time is not set if there is no intersection. + + \cite Slope-Mul method from "Fast Ray / Axis-Aligned Bounding Box Overlap Tests using Ray Slopes" + by Martin Eisemann, Thorsten Grosch, Stefan Müller and Marcus Magnor + Computer Graphics Lab, TU Braunschweig, Germany and + University of Koblenz-Landau, Germany + */ + static bool __fastcall rayAABox(const Ray& ray, const AABox& box, float& time); +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/KDTree.h b/externals/g3dlite/G3D/KDTree.h new file mode 100644 index 0000000..4785ef2 --- /dev/null +++ b/externals/g3dlite/G3D/KDTree.h @@ -0,0 +1,1667 @@ +/** + @file KDTree.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2004-01-11 + @edited 2009-12-28 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_KDTREE_H +#define G3D_KDTREE_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Table.h" +#include "G3D/Vector2.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/AABox.h" +#include "G3D/Sphere.h" +#include "G3D/Box.h" +#include "G3D/Triangle.h" +#include "G3D/Ray.h" +#include "G3D/GCamera.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/CollisionDetection.h" +#include "G3D/GCamera.h" +#include "G3D/BoundsTrait.h" +#include + +// If defined, in debug mode the tree is checked for consistency +// as a way of detecting corruption due to implementation bugs +// #define VERIFY_TREE + +template<> struct BoundsTrait { + static void getBounds(const G3D::Vector2& v, G3D::AABox& out) { out = G3D::AABox(G3D::Vector3(v, 0)); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Vector3& v, G3D::AABox& out) { out = G3D::AABox(v); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Vector4& v, G3D::AABox& out) { out = G3D::AABox(v.xyz()); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::AABox& v, G3D::AABox& out) { out = v; } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Sphere& s, G3D::AABox& out) { s.getBounds(out); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Box& b, G3D::AABox& out) { b.getBounds(out); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Vector2*& v, G3D::AABox& out) { out = G3D::AABox(G3D::Vector3(*v, 0)); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Vector3*& v, G3D::AABox& out) { out = G3D::AABox(*v); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Vector4*& v, G3D::AABox& out) { out = G3D::AABox(v->xyz()); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::AABox*& v, G3D::AABox& out) { out = *v; } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Sphere*& s, G3D::AABox& out) { s->getBounds(out); } +}; + +template<> struct BoundsTrait { + static void getBounds(const G3D::Box*& b, G3D::AABox& out) { b->getBounds(out); } +}; + + +template<> struct BoundsTrait { + static void getBounds(const G3D::Triangle*& t, G3D::AABox& out) { t->getBounds(out); } +}; + +namespace G3D { + namespace _internal { + + /** + Wraps a pointer value so that it can be treated as the instance itself; + convenient for inserting pointers into a Table but using the + object equality instead of pointer equality. + */ + template + class Indirector { + public: + Type* handle; + + inline Indirector(Type* h) : handle(h) {} + + inline Indirector() : handle(NULL) {} + + /** Returns true iff the values referenced by the handles are equivalent. */ + inline bool operator==(const Indirector& m) const { + return *handle == *(m.handle); + } + + inline bool operator==(const Type& m) const { + return *handle == m; + } + + inline size_t hashCode() const { + return handle->hashCode(); + } + }; + } // namespace internal +} // namespace G3D + +template struct HashTrait > { + static size_t hashCode(const G3D::_internal::Indirector& key) { return key.hashCode(); } +}; + +namespace G3D { + +/** + A set that supports spatial queries using a KD tree (axis-aligned + BSP tree) for speed. + + KDTree allows you to quickly find objects in 3D that lie within + a box or along a ray. For large sets of objects it is much faster + than testing each object for a collision. + + KDTree is as powerful as but more general than a Quad Tree, Oct + Tree, or regular KD tree that cycles through axes, but less general than an unconstrained BSP tree + (which is much slower to create). + + Internally, objects + are arranged into a tree according to their + axis-aligned bounds. This increases the cost of insertion to + O(log n) but allows fast overlap queries. + + Template Parameters +
The template parameter T must be one for which + the following functions are all overloaded: + +
+  T::T(); // public constructor of no arguments
+  template <> struct HashTrait { static size_t hashCode(int key); };
+  template<> struct BoundsTrait { static void getBounds(const T& obj, G3D::AABox& out); };
+ 
+ + G3D provides these for common classes like G3D::Vector3 and G3D::Sphere. + If you use a custom class, or a pointer to a custom class, you will need + to define those functions. + + Moving %Set Members +
It is important that objects do not move without updating the + KDTree. If the axis-aligned bounds of an object are about + to change, KDTree::remove it before they change and + KDTree::insert it again afterward. For objects + where the hashCode and == operator are invariant with respect + to the 3D position, + you can use the KDTree::update method as a shortcut to + insert/remove an object in one step after it has moved. + + + Note: Do not mutate any value once it has been inserted into KDTree. Values + are copied interally. All KDTree iterators convert to pointers to constant + values to reinforce this. + + If you want to mutate the objects you intend to store in a KDTree + simply insert pointers to your objects instead of the objects + themselves, and ensure that the above operations are defined. (And + actually, because values are copied, if your values are large you may + want to insert pointers anyway, to save space and make the balance + operation faster.) + + Dimensions + Although designed as a 3D-data structure, you can use the KDTree + for data distributed along 2 or 1 axes by simply returning bounds + that are always zero along one or more dimensions. + +*/ +template< class T, + class BoundsFunc = BoundsTrait, + class HashFunc = HashTrait, + class EqualsFunc = EqualsTrait > +class KDTree { +protected: +#define TreeType KDTree + + /** Wrapper for a value that includes a cache of its bounds. + Except for the test value used in a set-query operation, there + is only ever one instance of the handle associated with any + value and the memberTable and Nodes maintain pointers to that + heap-allocated value. + */ + class Handle { + public: + /** The bounds of each object are constrained to AABox::large */ + AABox bounds; + + /** Center of bounds. We cache this value to avoid recomputing it + during the median sort, and because MSVC 6 std::sort goes into + an infinite loop if we compute the midpoint on the fly (possibly + a floating point roundoff issue, where B& point, + int beginIndex, + int endIndex) { + + Vector3 lo = Vector3::inf(); + Vector3 hi = -lo; + + debugAssertM(beginIndex <= endIndex, "No points"); + for (int p = beginIndex; p <= endIndex; ++p) { + // This code is written with the vector min and max expanded + // because otherwise it compiles incorrectly with -O3 on + // gcc 3.4 + + const Vector3& pLo = point[p]->bounds.low(); + const Vector3& pHi = point[p]->bounds.high(); + for (int a = 0; a < 3; ++a) { + lo[a] = G3D::min(lo[a], pLo[a]); + hi[a] = G3D::max(hi[a], pHi[a]); + } + } + + return AABox(lo, hi); + } + + /** Compares centers */ + class CenterComparator { + public: + Vector3::Axis sortAxis; + + CenterComparator(Vector3::Axis a) : sortAxis(a) {} + + inline int operator()(Handle* A, const Handle* B) const { + float a = A->center[sortAxis]; + float b = B->center[sortAxis]; + + if (a < b) { + return 1; + } else if (a > b) { + return -1; + } else { + return 0; + } + } + }; + + + /** Compares bounds for strict >, <, or overlap*/ + class BoundsComparator { + public: + Vector3::Axis sortAxis; + + BoundsComparator(Vector3::Axis a) : sortAxis(a) {} + + inline int operator()(Handle* A, const Handle* B) const { + const AABox& a = A->bounds; + const AABox& b = B->bounds; + + if (a.high()[sortAxis] < b.low()[sortAxis]) { + return 1; + } else if (a.low()[sortAxis] > b.high()[sortAxis]) { + return -1; + } else { + return 0; + } + } + }; + + + /** Compares bounds to the sort location */ + class Comparator { + public: + Vector3::Axis sortAxis; + float sortLocation; + + Comparator(Vector3::Axis a, float l) : sortAxis(a), sortLocation(l) {} + + inline int operator()(Handle* ignore, const Handle* handle) const { + (void)ignore; + const AABox& box = handle->bounds; + debugAssert(ignore == NULL); + + if (box.high()[sortAxis] < sortLocation) { + // Box is strictly below the sort location + return -1; + } else if (box.low()[sortAxis] > sortLocation) { + // Box is strictly above the sort location + return 1; + } else { + // Box overlaps the sort location + return 0; + } + } + }; + + // Using System::malloc with this class provided no speed improvement. + class Node { + public: + + /** Spatial bounds on all values at this node and its children, based purely on + the parent's splitting planes. May be infinite. */ + AABox splitBounds; + + Vector3::Axis splitAxis; + + /** Location along the specified axis */ + float splitLocation; + + /** child[0] contains all values strictly + smaller than splitLocation along splitAxis. + + child[1] contains all values strictly + larger. + + Both may be NULL if there are not enough + values to bother recursing. + */ + Node* child[2]; + + /** Array of values at this node (i.e., values + straddling the split plane + all values if + this is a leaf node). + + This is an array of pointers because that minimizes + data movement during tree building, which accounts + for about 15% of the time cost of tree building. + */ + Array valueArray; + + /** For each object in the value array, a copy of its bounds. + Packing these into an array at the node level + instead putting them in the valueArray improves + cache coherence, which is about a 3x performance + increase when performing intersection computations. + */ + Array boundsArray; + + /** Creates node with NULL children */ + Node() { + splitAxis = Vector3::X_AXIS; + splitLocation = 0; + splitBounds = AABox(-Vector3::inf(), Vector3::inf()); + for (int i = 0; i < 2; ++i) { + child[i] = NULL; + } + } + + /** + Doesn't clone children. + */ + Node(const Node& other) : valueArray(other.valueArray), boundsArray(other.boundsArray) { + splitAxis = other.splitAxis; + splitLocation = other.splitLocation; + splitBounds = other.splitBounds; + for (int i = 0; i < 2; ++i) { + child[i] = NULL; + } + } + + /** Copies the specified subarray of pt into point, NULLs the children. + Assumes a second pass will set splitBounds. */ + Node(const Array& pt) : valueArray(pt) { + splitAxis = Vector3::X_AXIS; + splitLocation = 0; + for (int i = 0; i < 2; ++i) { + child[i] = NULL; + } + + boundsArray.resize(valueArray.size()); + for (int i = 0; i < valueArray.size(); ++i) { + boundsArray[i] = valueArray[i]->bounds; + } + } + + /** Deletes the children (but not the values) */ + ~Node() { + for (int i = 0; i < 2; ++i) { + delete child[i]; + } + } + + /** Returns true if this node is a leaf (no children) */ + inline bool isLeaf() const { + return (child[0] == NULL) && (child[1] == NULL); + } + + + /** + Recursively appends all handles and children's handles + to the array. + */ + void getHandles(Array& handleArray) const { + handleArray.append(valueArray); + for (int i = 0; i < 2; ++i) { + if (child[i] != NULL) { + child[i]->getHandles(handleArray); + } + } + } + + void verifyNode(const Vector3& lo, const Vector3& hi) { + // debugPrintf("Verifying: split %d @ %f [%f, %f, %f], [%f, %f, %f]\n", + // splitAxis, splitLocation, lo.x, lo.y, lo.z, hi.x, hi.y, hi.z); + + debugAssertM(lo == splitBounds.low(), + format("lo = %s, splitBounds.lo = %s", + lo.toString().c_str(), splitBounds.low().toString().c_str())); + debugAssert(hi == splitBounds.high()); + + for (int i = 0; i < valueArray.length(); ++i) { + const AABox& b = valueArray[i]->bounds; + debugAssert(b == boundsArray[i]); + + for(int axis = 0; axis < 3; ++axis) { + debugAssert(b.low()[axis] <= b.high()[axis]); + debugAssert(b.low()[axis] >= lo[axis]); + debugAssert(b.high()[axis] <= hi[axis]); + } + } + + if (child[0] || child[1]) { + debugAssert(lo[splitAxis] < splitLocation); + debugAssert(hi[splitAxis] > splitLocation); + } + + Vector3 newLo = lo; + newLo[splitAxis] = splitLocation; + Vector3 newHi = hi; + newHi[splitAxis] = splitLocation; + + if (child[0] != NULL) { + child[0]->verifyNode(lo, newHi); + } + + if (child[1] != NULL) { + child[1]->verifyNode(newLo, hi); + } + } + + + /** + Stores the locations of the splitting planes (the structure but not the content) + so that the tree can be quickly rebuilt from a previous configuration without + calling balance. + */ + static void serializeStructure(const Node* n, BinaryOutput& bo) { + if (n == NULL) { + bo.writeUInt8(0); + } else { + bo.writeUInt8(1); + n->splitBounds.serialize(bo); + serialize(n->splitAxis, bo); + bo.writeFloat32(n->splitLocation); + for (int c = 0; c < 2; ++c) { + serializeStructure(n->child[c], bo); + } + } + } + + /** Clears the member table */ + static Node* deserializeStructure(BinaryInput& bi) { + if (bi.readUInt8() == 0) { + return NULL; + } else { + Node* n = new Node(); + n->splitBounds.deserialize(bi); + deserialize(n->splitAxis, bi); + n->splitLocation = bi.readFloat32(); + for (int c = 0; c < 2; ++c) { + n->child[c] = deserializeStructure(bi); + } + return n; + } + } + + /** Returns the deepest node that completely contains bounds. */ + Node* findDeepestContainingNode(const AABox& bounds) { + + // See which side of the splitting plane the bounds are on + if (bounds.high()[splitAxis] < splitLocation) { + // Bounds are on the low side. Recurse into the child + // if it exists. + if (child[0] != NULL) { + return child[0]->findDeepestContainingNode(bounds); + } + } else if (bounds.low()[splitAxis] > splitLocation) { + // Bounds are on the high side, recurse into the child + // if it exists. + if (child[1] != NULL) { + return child[1]->findDeepestContainingNode(bounds); + } + } + + // There was no containing child, so this node is the + // deepest containing node. + return this; + } + + + /** Appends all members that intersect the box. + If useSphere is true, members that pass the box test + face a second test against the sphere. */ + void getIntersectingMembers( + const AABox& box, + const Sphere& sphere, + Array& members, + bool useSphere) const { + + // Test all values at this node + for (int v = 0; v < boundsArray.size(); ++v) { + const AABox& bounds = boundsArray[v]; + if (bounds.intersects(box) && + (! useSphere || bounds.intersects(sphere))) { + members.append(& (valueArray[v]->value)); + } + } + + // If the left child overlaps the box, recurse into it + if ((child[0] != NULL) && (box.low()[splitAxis] < splitLocation)) { + child[0]->getIntersectingMembers(box, sphere, members, useSphere); + } + + // If the right child overlaps the box, recurse into it + if ((child[1] != NULL) && (box.high()[splitAxis] > splitLocation)) { + child[1]->getIntersectingMembers(box, sphere, members, useSphere); + } + } + + /** + Recurse through the tree, assigning splitBounds fields. + */ + void assignSplitBounds(const AABox& myBounds) { + splitBounds = myBounds; + + AABox childBounds[2]; + myBounds.split(splitAxis, splitLocation, childBounds[0], childBounds[1]); + +# if defined(G3D_DEBUG) && defined(VERIFY_TREE) + // Verify the split + for (int v = 0; v < boundsArray.size(); ++v) { + const AABox& bounds = boundsArray[v]; + debugAssert(myBounds.contains(bounds)); + } +# endif + + for (int c = 0; c < 2; ++c) { + if (child[c]) { + child[c]->assignSplitBounds(childBounds[c]); + } + } + } + + /** Returns true if the ray intersects this node */ + bool intersects(const Ray& ray, float distance) const { + // See if the ray will ever hit this node or its children + Vector3 location; + bool alreadyInsideBounds = false; + bool rayWillHitBounds = + CollisionDetection::collisionLocationForMovingPointFixedAABox( + ray.origin(), ray.direction(), splitBounds, location, alreadyInsideBounds); + + bool canHitThisNode = (alreadyInsideBounds || + (rayWillHitBounds && ((location - ray.origin()).squaredLength() < square(distance)))); + + return canHitThisNode; + } + + template + void intersectRay( + const Ray& ray, + RayCallback& intersectCallback, + float& distance, + bool intersectCallbackIsFast) const { + + if (! intersects(ray, distance)) { + // The ray doesn't hit this node, so it can't hit the children of the node. + return; + } + + // Test for intersection against every object at this node. + for (int v = 0; v < valueArray.size(); ++v) { + bool canHitThisObject = true; + + if (! intersectCallbackIsFast) { + // See if + Vector3 location; + const AABox& bounds = boundsArray[v]; + bool alreadyInsideBounds = false; + bool rayWillHitBounds = + CollisionDetection::collisionLocationForMovingPointFixedAABox( + ray.origin(), ray.direction(), bounds, location, alreadyInsideBounds); + + canHitThisObject = (alreadyInsideBounds || + (rayWillHitBounds && ((location - ray.origin()).squaredLength() < square(distance)))); + } + + if (canHitThisObject) { + // It is possible that this ray hits this object. Look for the intersection using the + // callback. + const T& value = valueArray[v]->value; + intersectCallback(ray, value, distance); + } + } + + // There are three cases to consider next: + // + // 1. the ray can start on one side of the splitting plane and never enter the other, + // 2. the ray can start on one side and enter the other, and + // 3. the ray can travel exactly down the splitting plane + + enum {NONE = -1}; + int firstChild = NONE; + int secondChild = NONE; + + if (ray.origin()[splitAxis] < splitLocation) { + + // The ray starts on the small side + firstChild = 0; + + if (ray.direction()[splitAxis] > 0) { + // The ray will eventually reach the other side + secondChild = 1; + } + + } else if (ray.origin()[splitAxis] > splitLocation) { + + // The ray starts on the large side + firstChild = 1; + + if (ray.direction()[splitAxis] < 0) { + secondChild = 0; + } + } else { + // The ray starts on the splitting plane + if (ray.direction()[splitAxis] < 0) { + // ...and goes to the small side + firstChild = 0; + } else if (ray.direction()[splitAxis] > 0) { + // ...and goes to the large side + firstChild = 1; + } + } + + // Test on the side closer to the ray origin. + if ((firstChild != NONE) && child[firstChild]) { + child[firstChild]->intersectRay(ray, intersectCallback, distance, intersectCallbackIsFast); + } + + if (ray.direction()[splitAxis] != 0) { + // See if there was an intersection before hitting the splitting plane. + // If so, there is no need to look on the far side and recursion terminates. + float distanceToSplittingPlane = (splitLocation - ray.origin()[splitAxis]) / ray.direction()[splitAxis]; + if (distanceToSplittingPlane > distance) { + // We aren't going to hit anything else before hitting the splitting plane, + // so don't bother looking on the far side of the splitting plane at the other + // child. + return; + } + } + + // Test on the side farther from the ray origin. + if ((secondChild != NONE) && child[secondChild]) { + child[secondChild]->intersectRay(ray, intersectCallback, distance, intersectCallbackIsFast); + } + + } + }; + + + /** + Recursively subdivides the subarray. + + Clears the source array as soon as it is no longer needed. + + Call assignSplitBounds() on the root node after making a tree. + */ + Node* makeNode( + Array& source, + int valuesPerNode, + int numMeanSplits, + Array& temp) { + + Node* node = NULL; + + if (source.size() <= valuesPerNode) { + // Make a new leaf node + node = new Node(source); + + // Set the pointers in the memberTable + for (int i = 0; i < source.size(); ++i) { + memberTable.set(Member(source[i]), node); + } + source.clear(); + + } else { + // Make a new internal node + node = new Node(); + + const AABox& bounds = computeBounds(source, 0, source.size() - 1); + const Vector3& extent = bounds.high() - bounds.low(); + + Vector3::Axis splitAxis = extent.primaryAxis(); + + float splitLocation; + + // Arrays for holding the children + Array lt, gt; + + if (numMeanSplits <= 0) { + + source.medianPartition(lt, node->valueArray, gt, temp, CenterComparator(splitAxis)); + + // Choose the split location to be the center of whatever fell in the center + splitLocation = node->valueArray[0]->center[splitAxis]; + + // Some of the elements in the lt or gt array might really overlap the split location. + // Move them as needed. + for (int i = 0; i < lt.size(); ++i) { + const AABox& bounds = lt[i]->bounds; + if ((bounds.low()[splitAxis] <= splitLocation) && (bounds.high()[splitAxis] >= splitLocation)) { + node->valueArray.append(lt[i]); + // Remove this element and process the new one that + // is swapped in in its place. + lt.fastRemove(i); --i; + } + } + + for (int i = 0; i < gt.size(); ++i) { + const AABox& bounds = gt[i]->bounds; + if ((bounds.low()[splitAxis] <= splitLocation) && (bounds.high()[splitAxis] >= splitLocation)) { + node->valueArray.append(gt[i]); + // Remove this element and process the new one that + // is swapped in in its place. + gt.fastRemove(i); --i; + } + } + + if ((node->valueArray.size() > (source.size() / 2)) && + (source.size() > 6)) { + // This was a bad partition; we ended up putting the splitting plane right in the middle of most of the + // objects. We could try to split on a different axis, or use a different partition (e.g., the extents mean, + // or geometric mean). This implementation falls back on the extents mean, since that case is already handled + // below. + numMeanSplits = 1; + } + } + + // Note: numMeanSplits may have been increased by the code in the previous case above in order to + // force a re-partition. + + if (numMeanSplits > 0) { + // Split along the mean + splitLocation = + bounds.high()[splitAxis] * 0.5f + + bounds.low()[splitAxis] * 0.5f; + + debugAssertM(isFinite(splitLocation), + "Internal error: split location must be finite."); + + source.partition(NULL, lt, node->valueArray, gt, Comparator(splitAxis, splitLocation)); + + // The Comparator ensures that elements are strictly on the correct side of the split + } + + +# if defined(G3D_DEBUG) && defined(VERIFY_TREE) + debugAssert(lt.size() + node->valueArray.size() + gt.size() == source.size()); + // Verify that all objects ended up on the correct side of the split. + // (i.e., make sure that the Array partition was correct) + for (int i = 0; i < lt.size(); ++i) { + const AABox& bounds = lt[i]->bounds; + debugAssert(bounds.high()[splitAxis] < splitLocation); + } + + for (int i = 0; i < gt.size(); ++i) { + const AABox& bounds = gt[i]->bounds; + debugAssert(bounds.low()[splitAxis] > splitLocation); + } + + for (int i = 0; i < node->valueArray.size(); ++i) { + const AABox& bounds = node->valueArray[i]->bounds; + debugAssert(bounds.high()[splitAxis] >= splitLocation); + debugAssert(bounds.low()[splitAxis] <= splitLocation); + } +# endif + + // The source array is no longer needed + source.clear(); + + node->splitAxis = splitAxis; + node->splitLocation = splitLocation; + + // Update the bounds array and member table + node->boundsArray.resize(node->valueArray.size()); + for (int i = 0; i < node->valueArray.size(); ++i) { + Handle* v = node->valueArray[i]; + node->boundsArray[i] = v->bounds; + memberTable.set(Member(v), node); + } + + if (lt.size() > 0) { + node->child[0] = makeNode(lt, valuesPerNode, numMeanSplits - 1, temp); + } + + if (gt.size() > 0) { + node->child[1] = makeNode(gt, valuesPerNode, numMeanSplits - 1, temp); + } + + } + + return node; + } + + /** + Recursively clone the passed in node tree, setting + pointers for members in the memberTable as appropriate. + called by the assignment operator. + */ + Node* cloneTree(Node* src) { + Node* dst = new Node(*src); + + // Make back pointers + for (int i = 0; i < dst->valueArray.size(); ++i) { + memberTable.set(Member(dst->valueArray[i]), dst); + } + + // Clone children + for (int i = 0; i < 2; ++i) { + if (src->child[i] != NULL) { + dst->child[i] = cloneTree(src->child[i]); + } + } + + return dst; + } + + /** + Wrapper for a Handle; used to create a memberTable that acts like Table but + stores only Handle* internally to avoid memory copies. + */ + typedef _internal::Indirector Member; + + typedef Table MemberTable; + + /** Maps members to the node containing them */ + MemberTable memberTable; + + Node* root; + +public: + + /** To construct a balanced tree, insert the elements and then call + KDTree::balance(). */ + KDTree() : root(NULL) {} + + + KDTree(const KDTree& src) : root(NULL) { + *this = src; + } + + + KDTree& operator=(const KDTree& src) { + delete root; + // Clone tree takes care of filling out the memberTable. + root = cloneTree(src.root); + return *this; + } + + + ~KDTree() { + clear(); + } + + /** + Throws out all elements of the set. + */ + void clear() { + typedef typename Table<_internal::Indirector, Node*>::Iterator It; + + // Delete all handles stored in the member table + It cur = memberTable.begin(); + It end = memberTable.end(); + while (cur != end) { + delete cur->key.handle; + cur->key.handle = NULL; + ++cur; + } + memberTable.clear(); + + // Delete the tree structure itself + delete root; + root = NULL; + } + + int size() const { + return memberTable.size(); + } + + /** + Inserts an object into the set if it is not + already present. O(log n) time. Does not + cause the tree to be balanced. + */ + void insert(const T& value) { + if (contains(value)) { + // Already in the set + return; + } + + Handle* h = new Handle(value); + + if (root == NULL) { + // This is the first node; create a root node + root = new Node(); + } + + Node* node = root->findDeepestContainingNode(h->bounds); + + // Insert into the node + node->valueArray.append(h); + node->boundsArray.append(h->bounds); + + // Insert into the node table + Member m(h); + memberTable.set(m, node); + } + + /** Inserts each elements in the array in turn. If the tree + begins empty (no structure and no elements), this is faster + than inserting each element in turn. You still need to balance + the tree at the end.*/ + void insert(const Array& valueArray) { + if (root == NULL) { + // Optimized case for an empty tree; don't bother + // searching or reallocating the root node's valueArray + // as we incrementally insert. + root = new Node(); + root->valueArray.resize(valueArray.size()); + root->boundsArray.resize(root->valueArray.size()); + for (int i = 0; i < valueArray.size(); ++i) { + // Insert in opposite order so that we have the exact same + // data structure as if we inserted each (i.e., order is reversed + // from array). + Handle* h = new Handle(valueArray[i]); + int j = valueArray.size() - i - 1; + root->valueArray[j] = h; + root->boundsArray[j] = h->bounds; + memberTable.set(Member(h), root); + } + + } else { + // Insert at appropriate tree depth. + for (int i = 0; i < valueArray.size(); ++i) { + insert(valueArray[i]); + } + } + } + + + /** + Returns true if this object is in the set, otherwise + returns false. O(1) time. + */ + bool contains(const T& value) { + // Temporarily create a handle and member + Handle h(value); + return memberTable.containsKey(Member(&h)); + } + + + /** + Removes an object from the set in O(1) time. + It is an error to remove members that are not already + present. May unbalance the tree. + + Removing an element never causes a node (split plane) to be removed... + nodes are only changed when the tree is rebalanced. This behavior + is desirable because it allows the split planes to be serialized, + and then deserialized into an empty tree which can be repopulated. + */ + void remove(const T& value) { + debugAssertM(contains(value), + "Tried to remove an element from a " + "KDTree that was not present"); + + // Get the list of elements at the node + Handle h(value); + Member m(&h); + + Array& list = memberTable[m]->valueArray; + + Handle* ptr = NULL; + + // Find the element and remove it + for (int i = list.length() - 1; i >= 0; --i) { + if (list[i]->value == value) { + // This was the element. Grab the pointer so that + // we can delete it below + ptr = list[i]; + + // Remove the handle from the node + list.fastRemove(i); + + // Remove the corresponding bounds + memberTable[m]->boundsArray.fastRemove(i); + break; + } + } + + // Remove the member + memberTable.remove(m); + + // Delete the handle data structure + delete ptr; + ptr = NULL; + } + + + /** + If the element is in the set, it is removed. + The element is then inserted. + + This is useful when the == and hashCode methods + on T are independent of the bounds. In + that case, you may call update(v) to insert an + element for the first time and call update(v) + again every time it moves to keep the tree + up to date. + */ + void update(const T& value) { + if (contains(value)) { + remove(value); + } + insert(value); + } + + + /** + Rebalances the tree (slow). Call when objects + have moved substantially from their original positions + (which unbalances the tree and causes the spatial + queries to be slow). + + @param valuesPerNode Maximum number of elements to put at + a node. + + @param numMeanSplits numMeanSplits = 0 gives a + fully axis aligned BSP-tree, where the balance operation attempts to balance + the tree so that every splitting plane has an equal number of left + and right children (i.e. it is a median split along that axis). + This tends to maximize average performance. + + You can override this behavior by + setting a number of mean (average) splits. numMeanSplits = MAX_INT + creates a full oct-tree, which tends to optimize peak performance at the expense of + average performance. It tends to have better clustering behavior when + members are not uniformly distributed. + */ + void balance(int valuesPerNode = 5, int numMeanSplits = 3) { + if (root == NULL) { + // Tree is empty + return; + } + + // Get all handles and delete the old tree structure + Node* oldRoot = root; + for (int c = 0; c < 2; ++c) { + if (root->child[c] != NULL) { + root->child[c]->getHandles(root->valueArray); + + // Delete the child; this will delete all structure below it + delete root->child[c]; + root->child[c] = NULL; + } + } + + Array temp; + // Make a new root. Work with a copy of the value array because + // makeNode clears the source array as it progresses + Array copy(oldRoot->valueArray); + root = makeNode(copy, valuesPerNode, numMeanSplits, temp); + + // Throw away the old root node + delete oldRoot; + oldRoot = NULL; + + // Walk the tree, assigning splitBounds. We start with unbounded + // space. This will override the current member table. + const AABox& LARGE = AABox::large(); + root->assignSplitBounds(LARGE); + +# ifdef _DEBUG + { + // Ensure that the balanced tree is still correct + root->verifyNode(LARGE.low(), LARGE.high()); + } +# endif + } + + + /** Clear, set the contents to the values in the array, and then balance */ + void setContents(const Array& array, int valuesPerNode = 5, int numMeanSplits = 3) { + clear(); + insert(array); + balance(valuesPerNode, numMeanSplits); + } + + +protected: + + /** + @param parentMask The mask that this node returned from culledBy. + */ + static void getIntersectingMembers( + const Array& plane, + Array& members, + Node* node, + uint32 parentMask) { + + int dummy; + + if (parentMask == 0) { + // None of these planes can cull anything + for (int v = node->valueArray.size() - 1; v >= 0; --v) { + members.append(& (node->valueArray[v]->value)); + } + + // Iterate through child nodes + for (int c = 0; c < 2; ++c) { + if (node->child[c]) { + getIntersectingMembers(plane, members, node->child[c], 0); + } + } + } else { + + // Test values at this node against remaining planes + for (int v = node->boundsArray.size() - 1; v >= 0; --v) { + if (! node->boundsArray[v].culledBy(plane, dummy, parentMask)) { + members.append(&(node->valueArray[v]->value)); + } + } + + uint32 childMask = 0xFFFFFF; + + // Iterate through child nodes + for (int c = 0; c < 2; ++c) { + if (node->child[c] && + ! node->child[c]->splitBounds.culledBy(plane, dummy, parentMask, childMask)) { + // This node was not culled + getIntersectingMembers(plane, members, node->child[c], childMask); + } + } + } + } + +public: + + /** + Returns all members inside the set of planes. + @param members The results are appended to this array. + */ + void getIntersectingMembers(const Array& plane, Array& members) const { + if (root == NULL) { + return; + } + + getIntersectingMembers(plane, members, root, 0xFFFFFF); + } + + void getIntersectingMembers(const Array& plane, Array& members) const { + Array temp; + getIntersectingMembers(plane, temp, root, 0xFFFFFF); + for (int i = 0; i < temp.size(); ++i) { + members.append(*temp[i]); + } + } + + /** + Typically used to find all visible + objects inside the view frustum (see also GCamera::getClipPlanes)... i.e. all objects + not culled by frustum. + + Example: +
+        Array  visible;
+        tree.getIntersectingMembers(camera.frustum(), visible);
+        // ... Draw all objects in the visible array.
+      
+ @param members The results are appended to this array. + */ + void getIntersectingMembers(const GCamera::Frustum& frustum, Array& members) const { + Array plane; + + for (int i = 0; i < frustum.faceArray.size(); ++i) { + plane.append(frustum.faceArray[i].plane); + } + + getIntersectingMembers(plane, members); + } + + void getIntersectingMembers(const GCamera::Frustum& frustum, Array& members) const { + Array temp; + getIntersectingMembers(frustum, temp); + for (int i = 0; i < temp.size(); ++i) { + members.append(*temp[i]); + } + } + + /** + C++ STL style iterator variable. See beginBoxIntersection(). + The iterator overloads the -> (dereference) operator, so this + acts like a pointer to the current member. + */ + // This iterator turns Node::getIntersectingMembers into a + // coroutine. It first translates that method from recursive to + // stack based, then captures the system state (analogous to a Scheme + // continuation) after each element is appended to the member array, + // and allowing the computation to be restarted. + class BoxIntersectionIterator { + private: + friend class TreeType; + + /** True if this is the "end" iterator instance */ + bool isEnd; + + /** The box that we're testing against. */ + AABox box; + + /** Node that we're currently looking at. Undefined if isEnd + is true. */ + Node* node; + + /** Nodes waiting to be processed */ + // We could use backpointers within the tree and careful + // state management to avoid ever storing the stack-- but + // it is much easier this way and only inefficient if the + // caller uses post increment (which they shouldn't!). + Array stack; + + /** The next index of current->valueArray to return. + Undefined when isEnd is true.*/ + int nextValueArrayIndex; + + BoxIntersectionIterator() : isEnd(true) {} + + BoxIntersectionIterator(const AABox& b, const Node* root) : + isEnd(root == NULL), box(b), + node(const_cast(root)), nextValueArrayIndex(-1) { + + // We intentionally start at the "-1" index of the current + // node so we can use the preincrement operator to move + // ourselves to element 0 instead of repeating all of the + // code from the preincrement method. Note that this might + // cause us to become the "end" instance. + ++(*this); + } + + public: + + inline bool operator!=(const BoxIntersectionIterator& other) const { + return ! (*this == other); + } + + bool operator==(const BoxIntersectionIterator& other) const { + if (isEnd) { + return other.isEnd; + } else if (other.isEnd) { + return false; + } else { + // Two non-end iterators; see if they match. This is kind of + // silly; users shouldn't call == on iterators in general unless + // one of them is the end iterator. + if ((box != other.box) || (node != other.node) || + (nextValueArrayIndex != other.nextValueArrayIndex) || + (stack.length() != other.stack.length())) { + return false; + } + + // See if the stacks are the same + for (int i = 0; i < stack.length(); ++i) { + if (stack[i] != other.stack[i]) { + return false; + } + } + + // We failed to find a difference; they must be the same + return true; + } + } + + /** + Pre increment. + */ + BoxIntersectionIterator& operator++() { + ++nextValueArrayIndex; + + bool foundIntersection = false; + while (! isEnd && ! foundIntersection) { + + // Search for the next node if we've exhausted this one + while ((! isEnd) && (nextValueArrayIndex >= node->valueArray.length())) { + // If we entered this loop, then the iterator has exhausted the elements at + // node (possibly because it just switched to a child node with no members). + // This loop continues until it finds a node with members or reaches + // the end of the whole intersection search. + + // If the right child overlaps the box, push it onto the stack for + // processing. + if ((node->child[1] != NULL) && + (box.high()[node->splitAxis] > node->splitLocation)) { + stack.push(node->child[1]); + } + + // If the left child overlaps the box, push it onto the stack for + // processing. + if ((node->child[0] != NULL) && + (box.low()[node->splitAxis] < node->splitLocation)) { + stack.push(node->child[0]); + } + + if (stack.length() > 0) { + // Go on to the next node (which may be either one of the ones we + // just pushed, or one from farther back the tree). + node = stack.pop(); + nextValueArrayIndex = 0; + } else { + // That was the last node; we're done iterating + isEnd = true; + } + } + + // Search for the next intersection at this node until we run out of children + while (! isEnd && ! foundIntersection && (nextValueArrayIndex < node->valueArray.length())) { + if (box.intersects(node->boundsArray[nextValueArrayIndex])) { + foundIntersection = true; + } else { + ++nextValueArrayIndex; + // If we exhaust this node, we'll loop around the master loop + // to find a new node. + } + } + } + + return *this; + } + + private: + /** + Post increment (much slower than preincrement!). + Intentionally overloaded to preclude accidentally slow code. + */ + BoxIntersectionIterator operator++(int); + /*{ + BoxIntersectionIterator old = *this; + ++this; + return old; + }*/ + + public: + + /** Overloaded dereference operator so the iterator can masquerade as a pointer + to a member */ + const T& operator*() const { + alwaysAssertM(! isEnd, "Can't dereference the end element of an iterator"); + return node->valueArray[nextValueArrayIndex]->value; + } + + /** Overloaded dereference operator so the iterator can masquerade as a pointer + to a member */ + T const * operator->() const { + alwaysAssertM(! isEnd, "Can't dereference the end element of an iterator"); + return &(stack.last()->valueArray[nextValueArrayIndex]->value); + } + + /** Overloaded cast operator so the iterator can masquerade as a pointer + to a member */ + operator T*() const { + alwaysAssertM(! isEnd, "Can't dereference the end element of an iterator"); + return &(stack.last()->valueArray[nextValueArrayIndex]->value); + } + }; + + + /** + Iterates through the members that intersect the box + */ + BoxIntersectionIterator beginBoxIntersection(const AABox& box) const { + return BoxIntersectionIterator(box, root); + } + + BoxIntersectionIterator endBoxIntersection() const { + // The "end" iterator instance + return BoxIntersectionIterator(); + } + + /** + Appends all members whose bounds intersect the box. + See also KDTree::beginBoxIntersection. + */ + void getIntersectingMembers(const AABox& box, Array& members) const { + if (root == NULL) { + return; + } + root->getIntersectingMembers(box, Sphere(Vector3::zero(), 0), members, false); + } + + void getIntersectingMembers(const AABox& box, Array& members) const { + Array temp; + getIntersectingMembers(box, temp); + for (int i = 0; i < temp.size(); ++i) { + members.append(*temp[i]); + } + } + + + /** + Invoke a callback for every member along a ray until the closest intersection is found. + + @param callback either a function or an instance of a class with an overloaded operator() of the form: + + void callback(const Ray& ray, const T& object, float& distance). If the ray hits the object + before travelling distance distance, updates distance with the new distance to + the intersection, otherwise leaves it unmodified. A common example is: + +
+     class Entity {
+     public:
+
+                void intersect(const Ray& ray, float& maxDist, Vector3& outLocation, Vector3& outNormal) {
+                    float d = maxDist;
+
+                    // ... search for intersection distance d
+
+                    if ((d > 0) && (d < maxDist)) {
+                        // Intersection occured
+                        maxDist = d;
+                        outLocation = ...;
+                        outNormal = ...;
+                    }
+                }
+            };
+
+            // Finds the surface normal and location of the first intersection with the scene
+            class Intersection {
+            public:
+                Entity*     closestEntity;
+                Vector3     hitLocation;
+                Vector3     hitNormal;
+
+                void operator()(const Ray& ray, const Entity* entity, float& distance) {
+                    entity->intersect(ray, distance, hitLocation, hitNormal);
+                }
+            };
+
+            KDTree scene;
+
+            Intersection intersection;
+            float distance = finf();
+            scene.intersectRay(camera.worldRay(x, y), intersection, distance);
+          
+ + + @param distance When the method is invoked, this is the maximum + distance that the tree should search for an intersection. On + return, this is set to the distance to the first intersection + encountered. + + @param intersectCallbackIsFast If false, each object's bounds are + tested before the intersectCallback is invoked. If the + intersect callback runs at the same speed or faster than + AABox-ray intersection, set this to true. + */ + template + void intersectRay( + const Ray& ray, + RayCallback& intersectCallback, + float& distance, + bool intersectCallbackIsFast = false) const { + + root->intersectRay(ray, intersectCallback, distance, intersectCallbackIsFast); + } + + + /** + @brief Finds all members whose bounding boxes intersect the sphere. The actual + elements may not intersect the sphere. + + @param members The results are appended to this array. + */ + void getIntersectingMembers(const Sphere& sphere, Array& members) const { + if (root == NULL) { + return; + } + + AABox box; + sphere.getBounds(box); + root->getIntersectingMembers(box, sphere, members, true); + } + + void getIntersectingMembers(const Sphere& sphere, Array& members) const { + Array temp; + getIntersectingMembers(sphere, temp); + for (int i = 0; i < temp.size(); ++i) { + members.append(*temp[i]); + } + } + + /** + Stores the locations of the splitting planes (the structure but not the content) + so that the tree can be quickly rebuilt from a previous configuration without + calling balance. + */ + void serializeStructure(BinaryOutput& bo) const { + Node::serializeStructure(root, bo); + } + + /** Clears the member table */ + void deserializeStructure(BinaryInput& bi) { + clear(); + root = Node::deserializeStructure(bi); + } + + /** + Returns an array of all members of the set. See also KDTree::begin. + */ + void getMembers(Array& members) const { + Array temp; + memberTable.getKeys(temp); + for (int i = 0; i < temp.size(); ++i) { + members.append(*(temp.handle)); + } + } + + + /** If a value that is EqualsFunc to @a value is present, returns a pointer to the + version stored in the data structure, otherwise returns NULL. + */ + const T* getPointer(const T& value) const { + // Temporarily create a handle and member + Handle h(value); + const Member* member = memberTable.getKeyPointer(Member(&h)); + if (member == NULL) { + // Not found + return NULL; + } else { + return &(member->handle->value); + } + } + + + /** + C++ STL style iterator variable. See begin(). + Overloads the -> (dereference) operator, so this acts like a pointer + to the current member. + */ + class Iterator { + private: + friend class TreeType; + + // Note: this is a Table iterator, we are currently defining + // Set iterator + typename Table::Iterator it; + + Iterator(const typename Table::Iterator& it) : it(it) {} + + public: + + inline bool operator!=(const Iterator& other) const { + return !(*this == other); + } + + bool operator==(const Iterator& other) const { + return it == other.it; + } + + /** + Pre increment. + */ + Iterator& operator++() { + ++it; + return *this; + } + + private: + /** + Post increment (slower than preincrement). Intentionally unimplemented to prevent slow code. + */ + Iterator operator++(int);/* { + Iterator old = *this; + ++(*this); + return old; + }*/ + public: + + const T& operator*() const { + return it->key.handle->value; + } + + T* operator->() const { + return &(it->key.handle->value); + } + + operator T*() const { + return &(it->key.handle->value); + } + }; + + + /** + C++ STL style iterator method. Returns the first member. + Use preincrement (++entry) to get to the next element (iteration + order is arbitrary). + Do not modify the set while iterating. + */ + Iterator begin() const { + return Iterator(memberTable.begin()); + } + + + /** + C++ STL style iterator method. Returns one after the last iterator + element. + */ + Iterator end() const { + return Iterator(memberTable.end()); + } +#undef TreeType +}; + + +} + +#endif diff --git a/externals/g3dlite/G3D/Line.h b/externals/g3dlite/G3D/Line.h new file mode 100644 index 0000000..3579a6b --- /dev/null +++ b/externals/g3dlite/G3D/Line.h @@ -0,0 +1,105 @@ +/** + @file Line.h + + Line class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2006-02-28 + */ + +#ifndef G3D_LINE_H +#define G3D_LINE_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" + +namespace G3D { + +class Plane; + +/** + An infinite 3D line. + */ +class Line { +protected: + + Vector3 _point; + Vector3 _direction; + + Line(const Vector3& point, const Vector3& direction) { + _point = point; + _direction = direction.direction(); + } + +public: + + /** Undefined (provided for creating Array only) */ + inline Line() {} + + Line(class BinaryInput& b); + + void serialize(class BinaryOutput& b) const; + + void deserialize(class BinaryInput& b); + + virtual ~Line() {} + + /** + Constructs a line from two (not equal) points. + */ + static Line fromTwoPoints(const Vector3 &point1, const Vector3 &point2) { + return Line(point1, point2 - point1); + } + + /** + Creates a line from a point and a (nonzero) direction. + */ + static Line fromPointAndDirection(const Vector3& point, const Vector3& direction) { + return Line(point, direction); + } + + /** + Returns the closest point on the line to point. + */ + Vector3 closestPoint(const Vector3& pt) const; + + /** + Returns the distance between point and the line + */ + double distance(const Vector3& point) const { + return (closestPoint(point) - point).magnitude(); + } + + /** Returns a point on the line */ + Vector3 point() const; + + /** Returns the direction (or negative direction) of the line */ + Vector3 direction() const; + + /** + Returns the point where the line and plane intersect. If there + is no intersection, returns a point at infinity. + */ + Vector3 intersection(const Plane &plane) const; + + + /** Finds the closest point to the two lines. + + @param minDist Returns the minimum distance between the lines. + + @cite http://objectmix.com/graphics/133793-coordinates-closest-points-pair-skew-lines.html + */ + Vector3 closestPoint(const Line& B, float& minDist) const; + + inline Vector3 closestPoint(const Line& B) const { + float m; + return closestPoint(B, m); + } +}; + +};// namespace + + +#endif diff --git a/externals/g3dlite/G3D/LineSegment.h b/externals/g3dlite/G3D/LineSegment.h new file mode 100644 index 0000000..70210ec --- /dev/null +++ b/externals/g3dlite/G3D/LineSegment.h @@ -0,0 +1,115 @@ +/** + @file LineSegment.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-02-08 + @edited 2008-02-02 + */ + +#ifndef G3D_LINESEGMENT_H +#define G3D_LINESEGMENT_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" + +namespace G3D { + +/** + An finite segment of an infinite 3D line. + */ +class LineSegment { +protected: + + Vector3 _point; + + /** Not normalized */ + Vector3 direction; + + LineSegment(const Vector3& __point, const Vector3& _direction) : _point(__point), direction(_direction) { + } + +public: + + inline LineSegment() : _point(Vector3::zero()), direction(Vector3::zero()) {} + + LineSegment(class BinaryInput& b); + + void serialize(class BinaryOutput& b) const; + + void deserialize(class BinaryInput& b); + + virtual ~LineSegment() {} + + /** + * Constructs a line from two (not equal) points. + */ + static LineSegment fromTwoPoints(const Vector3 &point1, const Vector3 &point2) { + return LineSegment(point1, point2 - point1); + } + + /** Call with 0 or 1 */ + Vector3 point(int i) const; + + inline float length() const { + return direction.magnitude(); + } + + /** + * Returns the closest point on the line segment to point. + */ + Vector3 closestPoint(const Vector3 &point) const; + + /** + Returns the distance between point and the line + */ + double distance(const Vector3& p) const { + return (closestPoint(p) - p).magnitude(); + } + + double distanceSquared(const Vector3& p) const { + return (closestPoint(p) - p).squaredMagnitude(); + } + + /** Returns true if some part of this segment is inside the sphere */ + bool intersectsSolidSphere(const class Sphere& s) const; + + Vector3 randomPoint() const; + +}; + + +class LineSegment2D { +private: + + Vector2 m_origin; + + /** Not normalized */ + Vector2 m_direction; + + /** Length of m_direction */ + float m_length; + +public: + + LineSegment2D() {} + + static LineSegment2D fromTwoPoints(const Vector2& p0, const Vector2& p1); + + /** Returns the intersection of these segements (including + testing endpoints), or Vector2::inf() if they do not intersect. */ + Vector2 intersection(const LineSegment2D& other) const; + + Vector2 point(int i) const; + + Vector2 closestPoint(const Vector2& Q) const; + + float distance(const Vector2& p) const; + + float length() const; +}; + +} // namespace + + +#endif diff --git a/externals/g3dlite/G3D/Log.h b/externals/g3dlite/G3D/Log.h new file mode 100644 index 0000000..d252d0c --- /dev/null +++ b/externals/g3dlite/G3D/Log.h @@ -0,0 +1,109 @@ +/** + @file Log.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @cite Backtrace by Aaron Orenstein + @created 2001-08-04 + @edited 2005-11-04 + */ + +#ifndef G3D_LOG_H +#define G3D_LOG_H + +#include +#include +#include "G3D/platform.h" + +#ifndef G3D_WIN32 + #include +#endif + +namespace G3D { + +/** Prints to the common system log, log.txt, which is usually + in the working directory of the program. If your disk is + not writable or is slow, it will attempt to write to "c:/tmp/log.txt" or + "c:/temp/log.txt" on Windows systems instead. + + Unlike printf or debugPrintf, + this function guarantees that all output is committed before it returns. + This is very useful for debugging a crash, which might hide the last few + buffered print statements otherwise. + + Many G3D routines write useful warnings and debugging information to the + system log, which makes it a good first place to go when tracking down + a problem. + */ +void logPrintf(const char* fmt, ...); + +/** Does not flush the buffer; follow up with a logPrintf to force the flush. */ +void logLazyPrintf(const char* fmt, ...); + +/** + System log for debugging purposes. The first log opened + is the "common log" and can be accessed with the static + method common(). If you access common() and a common log + does not yet exist, one is created for you. + */ +class Log { +private: + + /** + Log messages go here. + */ + FILE* logFile; + + std::string filename; + + static Log* commonLog; + + int stripFromStackBottom; + +public: + + /** + @param stripFromStackBottom Number of call stacks to strip from the + bottom of the stack when printing a trace. Useful for hiding + routines like "main" and "WinMain". If the specified file cannot + be opened for some reason, tries to open "c:/tmp/log.txt" or + "c:/temp/log.txt" instead. + */ + Log(const std::string& filename = "log.txt", + int stripFromStackBottom = 0); + + virtual ~Log(); + + /** + Returns the handle to the file log. + */ + FILE* getFile() const; + + /** + Marks the beginning of a logfile section. + */ + void section(const std::string& s); + + /** + Given arguments like printf, writes characters to the debug text overlay. + */ + // We want G3D_CHECK_PRINTF_ARGS here, but that conflicts with the + // overload. + void __cdecl printf(const char* fmt, ...) G3D_CHECK_PRINTF_METHOD_ARGS; + + void __cdecl vprintf(const char*, va_list argPtr) G3D_CHECK_VPRINTF_METHOD_ARGS; + /** Does not flush */ + void __cdecl lazyvprintf(const char*, va_list argPtr) G3D_CHECK_VPRINTF_METHOD_ARGS; + + static Log* common(); + + static std::string getCommonLogFilename(); + + void print(const std::string& s); + + + void println(const std::string& s); +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Map2D.h b/externals/g3dlite/G3D/Map2D.h new file mode 100644 index 0000000..9af9f72 --- /dev/null +++ b/externals/g3dlite/G3D/Map2D.h @@ -0,0 +1,667 @@ +/** + @file Map2D.h + + More flexible support than provided by G3D::GImage. + + @maintainer Morgan McGuire, morgan@cs.brown.edu + @created 2004-10-10 + @edited 2009-03-24 + */ +#ifndef G3D_Map2D_h +#define G3D_Map2D_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Array.h" +#include "G3D/vectorMath.h" +#include "G3D/Vector2int16.h" +#include "G3D/ReferenceCount.h" +#include "G3D/AtomicInt32.h" +#include "G3D/GThread.h" +#include "G3D/Rect2D.h" +#include "G3D/WrapMode.h" + +#include + +namespace G3D { +namespace _internal { + +/** The default compute type for a type is the type itself. */ +template class _GetComputeType { +public: + typedef Storage Type; +}; + +} // _internal +} // G3D + +// This weird syntax is needed to support VC6, which doesn't +// properly implement template overloading. +#define DECLARE_COMPUTE_TYPE(StorageType, ComputeType) \ +namespace G3D { \ + namespace _internal { \ + template<> class _GetComputeType < StorageType > { \ + public: \ + typedef ComputeType Type; \ + }; \ + } \ +} + +DECLARE_COMPUTE_TYPE( float32, float64) +DECLARE_COMPUTE_TYPE( float64, float64) + +DECLARE_COMPUTE_TYPE( int8, float32) +DECLARE_COMPUTE_TYPE( int16, float32) +DECLARE_COMPUTE_TYPE( int32, float64) +DECLARE_COMPUTE_TYPE( int64, float64) + +DECLARE_COMPUTE_TYPE( uint8, float32) +DECLARE_COMPUTE_TYPE( uint16, float32) +DECLARE_COMPUTE_TYPE( uint32, float64) +DECLARE_COMPUTE_TYPE( uint64, float64) + +DECLARE_COMPUTE_TYPE( Vector2, Vector2) +DECLARE_COMPUTE_TYPE( Vector2int16, Vector2) + +DECLARE_COMPUTE_TYPE( Vector3, Vector3) +DECLARE_COMPUTE_TYPE( Vector3int16, Vector3) + +DECLARE_COMPUTE_TYPE( Vector4, Vector4) + +DECLARE_COMPUTE_TYPE( Color3, Color3) +DECLARE_COMPUTE_TYPE( Color3uint8, Color3) + +DECLARE_COMPUTE_TYPE( Color4, Color4) +DECLARE_COMPUTE_TYPE( Color4uint8, Color4) +#undef DECLARE_COMPUTE_TYPE + +namespace G3D { + +/** + Map of values across a discrete 2D plane. Can be thought of as a generic class for 2D images, + allowing flexibility as to pixel format and convenient methods. + In fact, the "pixels" can be any values + on a grid that can be sensibly interpolated--RGB colors, scalars, 4D vectors, and so on. + + Other "image" classes in G3D: + + G3D::GImage - Supports file formats, fast, Color3uint8 and Color4uint8 formats. No interpolation. + + G3D::Texture::Ref - Represents image on the graphics card (not directly readable on the CPU). Supports 2D, 3D, and a variety of interpolation methods, loads file formats. + + G3D::Image3 - A subclass of Map2D that supports image loading and saving and conversion to Texture. + + G3D::Image4 - A subclass of Map2D that supports image loading and saving and conversion to Texture. + + G3D::Image3uint8 - A subclass of Map2D that supports image loading and saving and conversion to Texture. + + G3D::Image4uint8 - A subclass of Map2D that supports image loading and saving and conversion to Texture. + + There are two type parameters-- the first (@ Storage) is the type + used to store the "pixel" values efficiently and + the second (@a Compute) is + the type operated on by computation. The Compute::Compute(Storage&) constructor + is used to convert between storage and computation types. + @a Storage is often an integer version of @a Compute, for example + Map2D. By default, the computation type is: + +
+     Storage       Computation
+
+     uint8          float32
+     uint16         float32
+     uint32         float64
+     uint64         float64
+
+     int8           float32
+     int16          float32
+     int32          float64
+     int64          float64
+
+     float32        float64
+     float64        float64
+
+     Vector2        Vector2
+     Vector2int16   Vector2
+
+     Vector3        Vector3
+     Vector3int16   Vector3
+
+     Vector4        Vector4
+
+     Color3         Color3
+     Color3uint8    Color3
+
+     Color4         Color4
+     Color4uint8    Color4
+    
+ Any other storage type defaults to itself as the computation type. + + The computation type can be any that + supports lerp, +, -, *, /, and an empty constructor. + + Assign value: + + im->set(x, y, 7); or + im->get(x, y) = 7; + + Read value: + + int c = im(x, y); + + Can also sample with nearest neighbor, bilinear, and bicubic + interpolation. + + Sampling follows OpenGL conventions, where + pixel values represent grid points and (0.5, 0.5) is half-way + between two vertical and two horizontal grid points. + To draw an image of dimensions w x h with nearest neighbor + sampling, render pixels from [0, 0] to [w - 1, h - 1]. + + Under the WrapMode::CLAMP wrap mode, the value of bilinear interpolation + becomes constant outside [1, w - 2] horizontally. Nearest neighbor + interpolation is constant outside [0, w - 1] and bicubic outside + [3, w - 4]. The class does not offer quadratic interpolation because + the interpolation filter could not center over a pixel. + + @author Morgan McGuire, http://graphics.cs.williams.edu + */ +template< typename Storage, +typename Compute = typename G3D::_internal::_GetComputeType::Type> +class Map2D : public ReferenceCountedObject { + +// +// It doesn't make sense to automatically convert from Compute back to Storage +// because the rounding rule (and scaling) is application dependent. +// Thus the interpolation methods all return type Compute. +// + +public: + + typedef Storage StorageType; + typedef Compute ComputeType; + typedef Map2D Type; + typedef ReferenceCountedPointer Ref; + +protected: + + Storage ZERO; + + /** Width, in pixels. */ + uint32 w; + + /** Height, in pixels. */ + uint32 h; + + WrapMode _wrapMode; + + /** 0 if no mutating method has been invoked + since the last call to setChanged(); */ + AtomicInt32 m_changed; + + Array data; + + /** Handles the exceptional cases from get */ + const Storage& slowGet(int x, int y, WrapMode wrap) { + switch (wrap) { + case WrapMode::CLAMP: + return fastGet(iClamp(x, 0, w - 1), iClamp(y, 0, h - 1)); + + case WrapMode::TILE: + return fastGet(iWrap(x, w), iWrap(y, h)); + + case WrapMode::ZERO: + return ZERO; + + case WrapMode::ERROR: + alwaysAssertM(((uint32)x < w) && ((uint32)y < h), + format("Index out of bounds: (%d, %d), w = %d, h = %d", + x, y, w, h)); + + // intentionally fall through + case WrapMode::IGNORE: + // intentionally fall through + default: + { + static Storage temp; + return temp; + } + } + } + +public: + + /** Unsafe access to the underlying data structure with no wrapping support; requires that (x, y) is in bounds. */ + inline const Storage& fastGet(int x, int y) const { + debugAssert(((uint32)x < w) && ((uint32)y < h)); + return data[x + y * w]; + } + + /** Unsafe access to the underlying data structure with no wrapping support; requires that (x, y) is in bounds. */ + inline void fastSet(int x, int y, const Storage& v) { + debugAssert(((uint32)x < w) && ((uint32)y < h)); + data[x + y * w] = v; + } + +protected: + + /** Given four control points and a value on the range [0, 1) + evaluates the Catmull-rom spline between the times of the + middle two control points */ + Compute bicubic(const Compute* ctrl, double s) const { + + // f = B * S * ctrl' + + // B matrix: Catmull-Rom spline basis + static const double B[4][4] = { + { 0.0, -0.5, 1.0, -0.5}, + { 1.0, 0.0, -2.5, 1.5}, + { 0.0, 0.5, 2.0, -1.5}, + { 0.0, 0.0, -0.5, 0.5}}; + + // S: Powers of the fraction + double S[4]; + double s2 = s * s; + S[0] = 1.0; + S[1] = s; + S[2] = s2; + S[3] = s2 * s; + + Compute sum(ZERO); + + for (int c = 0; c < 4; ++c) { + double coeff = 0.0; + for (int power = 0; power < 4; ++power) { + coeff += B[c][power] * S[power]; + } + sum += ctrl[c] * coeff; + } + + return sum; + } + + + Map2D(int w, int h, WrapMode wrap) : w(0), h(0), _wrapMode(wrap), m_changed(1) { + ZERO = Storage(Compute(Storage()) * 0); + resize(w, h); + } + +public: + + /** + Although Map2D is not threadsafe (except for the setChanged() method), + you can use this mutex to create your own threadsafe access to a Map2D. + Not used by the default implementation. + */ + GMutex mutex; + + static Ref create(int w = 0, int h = 0, WrapMode wrap = WrapMode::ERROR) { + return new Map2D(w, h, wrap); + } + + /** Resizes without clearing, leaving garbage. + */ + void resize(uint32 newW, uint32 newH) { + if ((newW != w) || (newH != h)) { + w = newW; + h = newH; + data.resize(w * h); + setChanged(true); + } + } + + /** + Returns true if this map has been written to since the last call to setChanged(false). + This is useful if you are caching a texture map other value that must be recomputed + whenever this changes. + */ + bool changed() { + return m_changed.value() != 0; + } + + /** Set/unset the changed flag. */ + void setChanged(bool c) { + m_changed = c ? 1 : 0; + } + + /** Returns a pointer to the underlying row-major data. There is no padding at the end of the row. + Be careful--this will be reallocated during a resize. You should call setChanged(true) if you mutate the array.*/ + Storage* getCArray() { + return data.getCArray(); + } + + + const Storage* getCArray() const { + return data.getCArray(); + } + + + /** Row-major array. You should call setChanged(true) if you mutate the array. */ + Array& getArray() { + return data; + } + + + const Array& getArray() const { + return data; + } + + /** is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode */ + inline bool inBounds(int x, int y) const { + return (((uint32)x < w) && ((uint32)y < h)); + } + + /** is (x, y) strictly within the image bounds, or will it trigger some kind of wrap mode */ + inline bool inBounds(const Vector2int16& v) const { + return inBounds(v.x, v.y); + } + + /** Get the value at (x, y). + + Note that the type of image->get(x, y) is + the storage type, not the computation + type. If the constructor promoting Storage to Compute rescales values + (as, for example Color3(Color3uint8&) does), this will not match the value + returned by Map2D::nearest. + */ + inline const Storage& get(int x, int y, WrapMode wrap) const { + if (((uint32)x < w) && ((uint32)y < h)) { + return data[x + y * w]; + } else { + // Remove the const to allow a slowGet on this object + // (we're returning a const reference so this is ok) + return const_cast(this)->slowGet(x, y, wrap); + } +# ifndef G3D_WIN32 + // gcc gives a useless warning that the above code might reach the end of the function; + // we use this line to supress the warning. + return ZERO; +# endif + } + + inline const Storage& get(int x, int y) const { + return get(x, y, _wrapMode); + } + + inline const Storage& get(const Vector2int16& p) const { + return get(p.x, p.y, _wrapMode); + } + + inline const Storage& get(const Vector2int16& p, WrapMode wrap) const { + return get(p.x, p.y, wrap); + } + + inline Storage& get(int x, int y, WrapMode wrap) { + return const_cast(const_cast(this)->get(x, y, wrap)); +# ifndef G3D_WIN32 + // gcc gives a useless warning that the above code might reach the end of the function; + // we use this line to supress the warning. + return ZERO; +# endif + } + + inline Storage& get(int x, int y) { + return const_cast(const_cast(this)->get(x, y)); +# ifndef G3D_WIN32 + // gcc gives a useless warning that the above code might reach the end of the function; + // we use this line to supress the warning. + return ZERO; +# endif + } + + inline Storage& get(const Vector2int16& p) { + return get(p.x, p.y); + } + + /** Sets the changed flag to true */ + inline void set(const Vector2int16& p, const Storage& v) { + set(p.x, p.y, v); + } + + /** Sets the changed flag to true */ + void set(int x, int y, const Storage& v, WrapMode wrap) { + setChanged(true); + if (((uint32)x < w) && ((uint32)y < h)) { + // In bounds, wrapping isn't an issue. + data[x + y * w] = v; + } else { + const_cast(slowGet(x, y, wrap)) = v; + } + } + + void set(int x, int y, const Storage& v) { + set(x, y, v, _wrapMode); + } + + + void setAll(const Storage& v) { + for(int i = 0; i < data.size(); ++i) { + data[i] = v; + } + setChanged(true); + } + + /** flips if @a flip is true*/ + void maybeFlipVertical(bool flip) { + if (flip) { + flipVertical(); + } + } + + virtual void flipVertical() { + int halfHeight = h/2; + Storage* d = data.getCArray(); + for (int y = 0; y < halfHeight; ++y) { + int o1 = y * w; + int o2 = (h - y - 1) * w; + for (int x = 0; x < (int)w; ++x) { + int i1 = o1 + x; + int i2 = o2 + x; + Storage temp = d[i1]; + d[i1] = d[i2]; + d[i2] = temp; + } + } + setChanged(true); + } + + virtual void flipHorizontal() { + int halfWidth = w / 2; + Storage* d = data.getCArray(); + for (int x = 0; x < halfWidth; ++x) { + for (int y = 0; y < (int)h; ++y) { + int i1 = y * w + x; + int i2 = y * w + (w - x - 1); + Storage temp = d[i1]; + d[i1] = d[i2]; + d[i2] = temp; + } + } + setChanged(true); + } + + /** + Crops this map so that it only contains pixels between (x, y) and (x + w - 1, y + h - 1) inclusive. + */ + virtual void crop(int newX, int newY, int newW, int newH) { + alwaysAssertM(newX + newW <= (int)w, "Cannot grow when cropping"); + alwaysAssertM(newY + newH <= (int)h, "Cannot grow when cropping"); + alwaysAssertM(newX >= 0 && newY >= 0, "Origin out of bounds."); + + // Always safe to copy towards the upper left, provided + // that we're iterating towards the lower right. This lets us avoid + // reallocating the underlying array. + for (int y = 0; y < newH; ++y) { + for (int x = 0; x < newW; ++x) { + data[x + y * newW] = data[(x + newX) + (y + newY) * w]; + } + } + + resize(newW, newH); + } + + /** iRounds to the nearest x0 and y0. */ + virtual void crop(const Rect2D& rect) { + crop(iRound(rect.x0()), iRound(rect.y0()), iRound(rect.x1()) - iRound(rect.x0()), iRound(rect.y1()) - iRound(rect.y0())); + } + + /** Returns the nearest neighbor. Pixel values are considered + to be at the upper left corner, so image->nearest(x, y) == image(x, y) + */ + inline Compute nearest(float x, float y, WrapMode wrap) const { + int ix = iRound(x); + int iy = iRound(y); + return Compute(get(ix, iy, wrap)); + } + + inline Compute nearest(float x, float y) const { + return nearest(x, y, _wrapMode); + } + + inline Compute nearest(const Vector2& p) const { + return nearest(p.x, p.y); + } + + /** Returns the average value of all elements of the map */ + Compute average() const { + if ((w == 0) || (h == 0)) { + return ZERO; + } + + // To avoid overflows, compute the average of row averages + + Compute rowSum = ZERO; + for (unsigned int y = 0; y < h; ++y) { + Compute sum = ZERO; + int offset = y * w; + for (unsigned int x = 0; x < w; ++x) { + sum += Compute(data[offset + x]); + } + rowSum += sum * (1.0f / w); + } + + return rowSum * (1.0f / h); + } + + /** + Needs to access elements from (floor(x), floor(y)) + to (floor(x) + 1, floor(y) + 1) and will use + the wrap mode appropriately (possibly generating + out of bounds errors). + + Guaranteed to match nearest(x, y) at integers. */ + Compute bilinear(float x, float y, WrapMode wrap) const { + const int i = iFloor(x); + const int j = iFloor(y); + + const float fX = x - i; + const float fY = y - j; + + // Horizontal interpolation, first row + const Compute& t0 = get(i, j, wrap); + const Compute& t1 = get(i + 1, j, wrap); + + // Horizontal interpolation, second row + const Compute& t2 = get(i, j + 1, wrap); + const Compute& t3 = get(i + 1, j + 1, wrap); + + const Compute& A = lerp(t0, t1, fX); + const Compute& B = lerp(t2, t3, fX); + + // Vertical interpolation + return lerp(A, B, fY); + } + + Compute bilinear(float x, float y) const { + return bilinear(x, y, _wrapMode); + } + + inline Compute bilinear(const Vector2& p) const { + return bilinear(p.x, p.y, _wrapMode); + } + + inline Compute bilinear(const Vector2& p, WrapMode wrap) const { + return bilinear(p.x, p.y, wrap); + } + + /** + Uses Catmull-Rom splines to interpolate between grid + values. Guaranteed to match nearest(x, y) at integers. + */ + Compute bicubic(float x, float y, WrapMode wrap) const { + int i = iFloor(x); + int j = iFloor(y); + float fX = x - i; + float fY = y - j; + + Compute vsample[4]; + for (int v = 0; v < 4; ++v) { + + // Horizontal interpolation + Compute hsample[4]; + for (int u = 0; u < 4; ++u) { + hsample[u] = Compute(get(i + u - 1, j + v - 1, wrap)); + } + + vsample[v] = bicubic(hsample, fX); + } + + // Vertical interpolation + return bicubic(vsample, fY); + } + + Compute bicubic(float x, float y) const { + return bicubic(x, y, _wrapMode); + } + + inline Compute bicubic(const Vector2& p, WrapMode wrap) const { + return bicubic(p.x, p.y, wrap); + } + + inline Compute bicubic(const Vector2& p) const { + return bicubic(p.x, p.y, _wrapMode); + } + + /** Pixel width */ + inline int32 width() const { + return (int32)w; + } + + + /** Pixel height */ + inline int32 height() const { + return (int32)h; + } + + + /** Dimensions in pixels */ + Vector2int16 size() const { + return Vector2int16(w, h); + } + + /** Rectangle from (0, 0) to (w, h) */ + Rect2D rect2DBounds() const { + return Rect2D::xywh(0, 0, w, h); + } + + /** Number of bytes occupied by the image data and this structure */ + size_t sizeInMemory() const { + return data.size() * sizeof(Storage) + sizeof(*this); + } + + + WrapMode wrapMode() const { + return _wrapMode; + } + + + void setWrapMode(WrapMode m) { + _wrapMode = m; + } +}; + + + +} + +#endif // G3D_IMAGE_H diff --git a/externals/g3dlite/G3D/Matrix.h b/externals/g3dlite/G3D/Matrix.h new file mode 100644 index 0000000..3c5394d --- /dev/null +++ b/externals/g3dlite/G3D/Matrix.h @@ -0,0 +1,634 @@ +/** + @file Matrix.h + @author Morgan McGuire, http://graphics.cs.williams.edu + + @created 2005-10-23 + @edited 2007-07-18 + */ + +#ifndef G3D_MATRIX_H +#define G3D_MATRIX_H + +#include "G3D/g3dmath.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/Matrix3.h" +#include "G3D/Matrix4.h" +#include "G3D/ReferenceCount.h" + +namespace G3D { + +/** + N x M matrix. + + The actual data is tracked internally by a reference counted pointer; + it is efficient to pass and assign Matrix objects because no data is actually copied. + This avoids the headache of pointers and allows natural math notation: + +
+    Matrix A, B, C;
+    // ...
+
+    C = A * f(B);
+    C = C.inverse();
+
+    A = Matrix::identity(4);
+    C = A;
+    C.set(0, 0, 2.0); // Triggers a copy of the data so that A remains unchanged.
+
+    // etc.
+
+  
+ + The Matrix::debugNumCopyOps and Matrix::debugNumAllocOps counters + increment every time an operation forces the copy and allocation of matrices. You + can use these to detect slow operations when efficiency is a major concern. + + Some methods accept an output argument instead of returning a value. For example, + A = B.transpose() can also be invoked as B.transpose(A). + The latter may be more efficient, since Matrix may be able to re-use the storage of + A (if it has approximatly the right size and isn't currently shared with another matrix). + + @sa G3D::Matrix3, G3D::Matrix4, G3D::Vector2, G3D::Vector3, G3D::Vector4, G3D::CoordinateFrame + + @beta + */ +class Matrix { +public: + /** + Internal precision. Currently float, but this may become a templated class in the future + to allow operations like Matrix and Matrix. + + Not necessarily a plain-old-data type (e.g., could ComplexFloat), but must be something + with no constructor, that can be safely memcpyd, and that has a bit pattern of all zeros + when zero.*/ + typedef float T; + + /** Incremented every time the elements of a matrix are copied. Useful for profiling your + own code that uses Matrix to determine when it is slow due to copying.*/ + static int debugNumCopyOps; + + /** Incremented every time a new matrix object is allocated. Useful for profiling your + own code that uses Matrix to determine when it is slow due to allocation.*/ + static int debugNumAllocOps; + +private: +public: + + /** Used internally by Matrix. + + Does not throw exceptions-- assumes the caller has taken care of + argument checking. */ + class Impl : public ReferenceCountedObject { + public: + + static void* operator new(size_t size) { + return System::malloc(size); + } + + static void operator delete(void* p) { + System::free(p); + } + + ~Impl(); + + private: + friend class Matrix; + + /** elt[r][c] = the element. Pointers into data.*/ + T** elt; + + /** Row major data for the entire matrix. */ + T* data; + + /** The number of rows */ + int R; + + /** The number of columns */ + int C; + + int dataSize; + + /** If R*C is much larger or smaller than the current, deletes all previous data + and resets to random data. Otherwise re-uses existing memory and just resets + R, C, and the row pointers. */ + void setSize(int newRows, int newCols); + + inline Impl() : elt(NULL), data(NULL), R(0), C(0), dataSize(0) {} + + Impl(const Matrix3& M); + + Impl(const Matrix4& M); + + inline Impl(int r, int c) : elt(NULL), data(NULL), R(0), C(0), dataSize(0) { + setSize(r, c); + } + + Impl& operator=(const Impl& m); + + inline Impl(const Impl& B) : elt(NULL), data(NULL), R(0), C(0), dataSize(0) { + // Use the assignment operator + *this = B; + } + + void setZero(); + + inline void set(int r, int c, T v) { + debugAssert(r < R); + debugAssert(c < C); + elt[r][c] = v; + } + + inline const T& get(int r, int c) const { + debugAssert(r < R); + debugAssert(c < C); + return elt[r][c]; + } + + /** Multiplies this by B and puts the result in out. */ + void mul(const Impl& B, Impl& out) const; + + /** Ok if out == this or out == B */ + void add(const Impl& B, Impl& out) const; + + /** Ok if out == this or out == B */ + void add(T B, Impl& out) const; + + /** Ok if out == this or out == B */ + void sub(const Impl& B, Impl& out) const; + + /** Ok if out == this or out == B */ + void sub(T B, Impl& out) const; + + /** B - this */ + void lsub(T B, Impl& out) const; + + /** Ok if out == this or out == B */ + void arrayMul(const Impl& B, Impl& out) const; + + /** Ok if out == this or out == B */ + void mul(T B, Impl& out) const; + + /** Ok if out == this or out == B */ + void arrayDiv(const Impl& B, Impl& out) const; + + /** Ok if out == this or out == B */ + void div(T B, Impl& out) const; + + void negate(Impl& out) const; + + /** Slow way of computing an inverse; for reference */ + void inverseViaAdjoint(Impl& out) const; + + /** Use Gaussian elimination with pivots to solve for the inverse destructively in place. */ + void inverseInPlaceGaussJordan(); + + void adjoint(Impl& out) const; + + /** Matrix of all cofactors */ + void cofactor(Impl& out) const; + + /** + Cofactor [r][c] is defined as C[r][c] = -1 ^(r+c) * det(A[r][c]), + where A[r][c] is the (R-1)x(C-1) matrix formed by removing row r and + column c from the original matrix. + */ + T cofactor(int r, int c) const; + + /** Ok if out == this or out == B */ + void transpose(Impl& out) const; + + T determinant() const; + + /** Determinant computed without the given row and column */ + T determinant(int r, int c) const; + + void arrayLog(Impl& out) const; + + void arrayExp(Impl& out) const; + + void arraySqrt(Impl& out) const; + + void arrayCos(Impl& out) const; + + void arraySin(Impl& out) const; + + void swapRows(int r0, int r1); + + void swapAndNegateCols(int c0, int c1); + + void mulRow(int r, const T& v); + + void abs(Impl& out) const; + + /** Makes a (R-1)x(C-1) copy of this matrix */ + void withoutRowAndCol(int excludeRow, int excludeCol, Impl& out) const; + + bool anyNonZero() const; + + bool allNonZero() const; + + void setRow(int r, const T* vals); + + void setCol(int c, const T* vals); + }; +private: + + typedef ReferenceCountedPointer ImplRef; + + ImplRef impl; + + inline Matrix(ImplRef i) : impl(i) {} + inline Matrix(Impl* i) : impl(ImplRef(i)) {} + + /** Used by SVD */ + class SortRank { + public: + T value; + int col; + + inline bool operator>(const SortRank& x) const { + return x.value > value; + } + + inline bool operator<(const SortRank& x) const { + return x.value < value; + } + + inline bool operator>=(const SortRank& x) const { + return x.value >= value; + } + + inline bool operator<=(const SortRank& x) const { + return x.value <= value; + } + + inline bool operator==(const SortRank& x) const { + return x.value == value; + } + + inline bool operator!=(const SortRank& x) const { + return x.value != value; + } + }; + + Matrix vectorPseudoInverse() const; + Matrix partitionPseudoInverse() const; + Matrix colPartPseudoInverse() const; + Matrix rowPartPseudoInverse() const; + + Matrix col2PseudoInverse(const Matrix& B) const; + Matrix col3PseudoInverse(const Matrix& B) const; + Matrix col4PseudoInverse(const Matrix& B) const; + Matrix row2PseudoInverse(const Matrix& B) const; + Matrix row3PseudoInverse(const Matrix& B) const; + Matrix row4PseudoInverse(const Matrix& B) const; + +public: + + Matrix() : impl(new Impl(0, 0)) {} + + Matrix(const Matrix3& M) : impl(new Impl(M)) {} + + Matrix(const Matrix4& M) : impl(new Impl(M)) {} + + template + static Matrix fromDiagonal(const Array& d) { + Matrix D = zero(d.length(), d.length()); + for (int i = 0; i < d.length(); ++i) { + D.set(i, i, d[i]); + } + return D; + } + + static Matrix fromDiagonal(const Matrix& d); + + /** Returns a new matrix that is all zero. */ + Matrix(int R, int C) : impl(new Impl(R, C)) { + impl->setZero(); + } + + /** Returns a new matrix that is all zero. */ + static Matrix zero(int R, int C); + + /** Returns a new matrix that is all one. */ + static Matrix one(int R, int C); + + /** Returns a new identity matrix */ + static Matrix identity(int N); + + /** Uniformly distributed values between zero and one. */ + static Matrix random(int R, int C); + + /** The number of rows */ + inline int rows() const { + return impl->R; + } + + /** Number of columns */ + inline int cols() const { + return impl->C; + } + + /** Generally more efficient than A * B */ + Matrix& operator*=(const T& B); + + /** Generally more efficient than A / B */ + Matrix& operator/=(const T& B); + + /** Generally more efficient than A + B */ + Matrix& operator+=(const T& B); + + /** Generally more efficient than A - B */ + Matrix& operator-=(const T& B); + + /** No performance advantage over A * B because + matrix multiplication requires intermediate + storage. */ + Matrix& operator*=(const Matrix& B); + + /** Generally more efficient than A + B */ + Matrix& operator+=(const Matrix& B); + + /** Generally more efficient than A - B */ + Matrix& operator-=(const Matrix& B); + + /** Returns a new matrix that is a subset of this one, + from r1:r2 to c1:c2, inclusive.*/ + Matrix subMatrix(int r1, int r2, int c1, int c2) const; + + /** Matrix multiplication. To perform element-by-element multiplication, + see arrayMul. */ + inline Matrix operator*(const Matrix& B) const { + Matrix C(impl->R, B.impl->C); + impl->mul(*B.impl, *C.impl); + return C; + } + + /** See also A *= B, which is more efficient in many cases */ + inline Matrix operator*(const T& B) const { + Matrix C(impl->R, impl->C); + impl->mul(B, *C.impl); + return C; + } + + /** See also A += B, which is more efficient in many cases */ + inline Matrix operator+(const Matrix& B) const { + Matrix C(impl->R, impl->C); + impl->add(*B.impl, *C.impl); + return C; + } + + /** See also A -= B, which is more efficient in many cases */ + inline Matrix operator-(const Matrix& B) const { + Matrix C(impl->R, impl->C); + impl->sub(*B.impl, *C.impl); + return C; + } + + /** See also A += B, which is more efficient in many cases */ + inline Matrix operator+(const T& v) const { + Matrix C(impl->R, impl->C); + impl->add(v, *C.impl); + return C; + } + + /** See also A -= B, which is more efficient in many cases */ + inline Matrix operator-(const T& v) const { + Matrix C(impl->R, impl->C); + impl->sub(v, *C.impl); + return C; + } + + + Matrix operator>(const T& scalar) const; + + Matrix operator<(const T& scalar) const; + + Matrix operator>=(const T& scalar) const; + + Matrix operator<=(const T& scalar) const; + + Matrix operator==(const T& scalar) const; + + Matrix operator!=(const T& scalar) const; + + /** scalar B - this */ + inline Matrix lsub(const T& B) const { + Matrix C(impl->R, impl->C); + impl->lsub(B, *C.impl); + return C; + } + + inline Matrix arrayMul(const Matrix& B) const { + Matrix C(impl->R, impl->C); + impl->arrayMul(*B.impl, *C.impl); + return C; + } + + Matrix3 toMatrix3() const; + + Matrix4 toMatrix4() const; + + Vector2 toVector2() const; + + Vector3 toVector3() const; + + Vector4 toVector4() const; + + /** Mutates this */ + void arrayMulInPlace(const Matrix& B); + + /** Mutates this */ + void arrayDivInPlace(const Matrix& B); + + // Declares an array unary method and its explicit-argument counterpart +# define DECLARE_METHODS_1(method)\ + inline Matrix method() const {\ + Matrix C(impl->R, impl->C);\ + impl->method(*C.impl);\ + return C;\ + }\ + void method(Matrix& out) const; + + + DECLARE_METHODS_1(abs) + DECLARE_METHODS_1(arrayLog) + DECLARE_METHODS_1(arrayExp) + DECLARE_METHODS_1(arraySqrt) + DECLARE_METHODS_1(arrayCos) + DECLARE_METHODS_1(arraySin) + DECLARE_METHODS_1(negate) + +# undef DECLARE_METHODS_1 + + inline Matrix operator-() const { + return negate(); + } + + /** + A-1 computed using the Gauss-Jordan algorithm, + for square matrices. + Run time is O(R3), where R is the + number of rows. + */ + inline Matrix inverse() const { + Impl* A = new Impl(*impl); + A->inverseInPlaceGaussJordan(); + return Matrix(A); + } + + inline T determinant() const { + return impl->determinant(); + } + + /** + AT + */ + inline Matrix transpose() const { + Impl* A = new Impl(cols(), rows()); + impl->transpose(*A); + return Matrix(A); + } + + /** Transpose in place; more efficient than transpose */ + void transpose(Matrix& out) const; + + inline Matrix adjoint() const { + Impl* A = new Impl(cols(), rows()); + impl->adjoint(*A); + return Matrix(A); + } + + /** + (ATA)-1AT) computed + using SVD. + + @param tolerance Use -1 for automatic tolerance. + */ + Matrix pseudoInverse(float tolerance = -1) const; + + /** Called from pseudoInverse when the matrix has size > 4 along some dimension.*/ + Matrix svdPseudoInverse(float tolerance = -1) const; + + /** + (ATA)-1AT) computed + using Gauss-Jordan elimination. + */ + inline Matrix gaussJordanPseudoInverse() const { + Matrix trans = transpose(); + return (trans * (*this)).inverse() * trans; + } + + /** Singular value decomposition. Factors into three matrices + such that @a this = @a U * fromDiagonal(@a d) * @a V.transpose(). + + The matrix must have at least as many rows as columns. + + Run time is O(C2*R). + + @param sort If true (default), the singular values + are arranged so that D is sorted from largest to smallest. + */ + void svd(Matrix& U, Array& d, Matrix& V, bool sort = true) const; + + void set(int r, int c, T v); + + void setCol(int c, const Matrix& vec); + + void setRow(int r, const Matrix& vec); + + Matrix col(int c) const; + + Matrix row(int r) const; + + T get(int r, int c) const; + + Vector2int16 size() const { + return Vector2int16(rows(), cols()); + } + + int numElements() const { + return rows() * cols(); + } + + void swapRows(int r0, int r1); + + /** Swaps columns c0 and c1 and negates both */ + void swapAndNegateCols(int c0, int c1); + + void mulRow(int r, const T& v); + + /** Returns true if any element is non-zero */ + bool anyNonZero() const; + + /** Returns true if all elements are non-zero */ + bool allNonZero() const; + + inline bool allZero() const { + return !anyNonZero(); + } + + inline bool anyZero() const { + return !allNonZero(); + } + + /** Serializes in Matlab source format */ + void serialize(TextOutput& t) const; + + std::string toString(const std::string& name) const; + + std::string toString() const { + static const std::string name = ""; + return toString(name); + } + + /** 2-norm squared: sum(squares). (i.e., dot product with itself) */ + double normSquared() const; + + /** 2-norm (sqrt(sum(squares)) */ + double norm() const; + + /** + Low-level SVD functionality. Useful for applications that do not want + to construct a Matrix but need to perform the SVD operation. + + this = U * D * V' + + Assumes that rows >= cols + + @return NULL on success, a string describing the error on failure. + @param U rows x cols matrix to be decomposed, gets overwritten with U, a rows x cols matrix with orthogonal columns. + @param D vector of singular values of a (diagonal of the D matrix). Length cols. + @param V returns the right orthonormal transformation matrix, size cols x cols + + @cite Based on Dianne Cook's implementation, which is adapted from + svdecomp.c in XLISP-STAT 2.1, which is code from Numerical Recipes + adapted by Luke Tierney and David Betz. The Numerical Recipes code + is adapted from Forsythe et al, who based their code on Golub and + Reinsch's original implementation. + */ + static const char* svdCore(float** U, int rows, int cols, float* D, float** V); + +}; + +} + +inline G3D::Matrix operator-(const G3D::Matrix::T& v, const G3D::Matrix& M) { + return M.lsub(v); +} + +inline G3D::Matrix operator*(const G3D::Matrix::T& v, const G3D::Matrix& M) { + return M * v; +} + +inline G3D::Matrix operator+(const G3D::Matrix::T& v, const G3D::Matrix& M) { + return M + v; +} + +inline G3D::Matrix abs(const G3D::Matrix& M) { + return M.abs(); +} + +#endif + diff --git a/externals/g3dlite/G3D/Matrix2.h b/externals/g3dlite/G3D/Matrix2.h new file mode 100644 index 0000000..eaf4aef --- /dev/null +++ b/externals/g3dlite/G3D/Matrix2.h @@ -0,0 +1,69 @@ +#ifndef G3D_MATRIX2_H +#define G3D_MATRIX2_H + +#include "G3D/platform.h" +#include "G3D/Vector2.h" + +namespace G3D { + +/** @beta */ +class Matrix2 { +private: + + float data[2][2]; + +public: + + inline Matrix2() { + data[0][0] = 1.0f; data[0][1] = 0.0f; + data[1][0] = 0.0f; data[1][1] = 1.0f; + } + + inline Matrix2(float v00, float v01, float v10, float v11) { + data[0][0] = v00; data[0][1] = v01; + data[1][0] = v10; data[1][1] = v11; + } + + inline Vector2 operator*(const Vector2& v) const { + return Vector2(data[0][0] * v[0] + data[0][1] * v[1], + data[1][0] * v[0] + data[1][1] * v[1]); + } + + inline Matrix2 inverse() const { + return Matrix2(data[0][0], data[1][0], + data[0][1], data[1][1]) * (1.0f / determinant()); + } + + inline Matrix2 transpose() const { + return Matrix2(data[0][0], data[1][0], + data[0][1], data[1][1]); + } + + inline float determinant() const { + return data[0][0] * data[1][1] - data[0][1] * data[1][0]; + } + + inline Matrix2 operator*(float f) const { + return Matrix2(data[0][0] * f, data[0][1] * f, + data[1][0] * f, data[1][1] * f); + } + + inline Matrix2 operator/(float f) const { + return Matrix2(data[0][0] / f, data[0][1] / f, + data[1][0] / f, data[1][1] / f); + } + + inline float* operator[](int i) { + debugAssert(i >= 0 && i <= 2); + return data[i]; + } + + inline const float* operator[](int i) const { + debugAssert(i >= 0 && i <= 1); + return data[i]; + } +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Matrix3.h b/externals/g3dlite/G3D/Matrix3.h new file mode 100644 index 0000000..06ec7e6 --- /dev/null +++ b/externals/g3dlite/G3D/Matrix3.h @@ -0,0 +1,366 @@ +/** + @file Matrix3.h + + 3x3 matrix class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @cite Portions based on Dave Eberly's Magic Software Library at
http://www.magic-software.com + + @created 2001-06-02 + @edited 2006-04-05 + */ + +#ifndef G3D_Matrix3_h +#define G3D_Matrix3_h + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/debugAssert.h" + +#include + +namespace G3D { + +#ifdef _MSC_VER +// Turn off "conditional expression is constant" warning; MSVC generates this +// for debug assertions in inlined methods. +# pragma warning (disable : 4127) +#endif + +class Any; + +/** + 3x3 matrix. Do not subclass. + */ +class Matrix3 { +private: + + float elt[3][3]; + + // Hidden operators + bool operator<(const Matrix3&) const; + bool operator>(const Matrix3&) const; + bool operator<=(const Matrix3&) const; + bool operator>=(const Matrix3&) const; + +public: + + Matrix3(const Any& any); + + operator Any() const; + + /** Initial values are undefined for performance. See also + Matrix3::zero(), Matrix3::identity(), Matrix3::fromAxisAngle, etc.*/ + inline Matrix3() {} + + Matrix3 (class BinaryInput& b); + Matrix3 (const float aafEntry[3][3]); + Matrix3 (const Matrix3& rkMatrix); + Matrix3 (float fEntry00, float fEntry01, float fEntry02, + float fEntry10, float fEntry11, float fEntry12, + float fEntry20, float fEntry21, float fEntry22); + + bool fuzzyEq(const Matrix3& b) const; + + /** Constructs a matrix from a quaternion. + @cite Graphics Gems II, p. 351--354 + @cite Implementation from Watt and Watt, pg 362*/ + Matrix3(const class Quat& q); + + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + /** Returns true if column(0).cross(column(1)).dot(column(2)) > 0. */ + bool isRightHanded() const; + + /** + Sets all elements. + */ + void set(float fEntry00, float fEntry01, float fEntry02, + float fEntry10, float fEntry11, float fEntry12, + float fEntry20, float fEntry21, float fEntry22); + + /** + * member access, allows use of construct mat[r][c] + */ + inline float* operator[] (int iRow) { + debugAssert(iRow >= 0); + debugAssert(iRow < 3); + return (float*)&elt[iRow][0]; + } + + inline const float* operator[] (int iRow) const { + debugAssert(iRow >= 0); + debugAssert(iRow < 3); + return (const float*)&elt[iRow][0]; + } + + inline operator float* () { + return (float*)&elt[0][0]; + } + + inline operator const float* () const{ + return (const float*)&elt[0][0]; + } + + Vector3 column(int c) const; + const Vector3& row(int r) const; + + void setColumn(int iCol, const Vector3 &vector); + void setRow(int iRow, const Vector3 &vector); + + // assignment and comparison + inline Matrix3& operator= (const Matrix3& rkMatrix) { + memcpy(elt, rkMatrix.elt, 9 * sizeof(float)); + return *this; + } + + bool operator== (const Matrix3& rkMatrix) const; + bool operator!= (const Matrix3& rkMatrix) const; + + // arithmetic operations + Matrix3 operator+ (const Matrix3& rkMatrix) const; + Matrix3 operator- (const Matrix3& rkMatrix) const; + /** Matrix-matrix multiply */ + Matrix3 operator* (const Matrix3& rkMatrix) const; + Matrix3 operator- () const; + + Matrix3& operator+= (const Matrix3& rkMatrix); + Matrix3& operator-= (const Matrix3& rkMatrix); + Matrix3& operator*= (const Matrix3& rkMatrix); + + /** + * matrix * vector [3x3 * 3x1 = 3x1] + */ + inline Vector3 operator* (const Vector3& v) const { + Vector3 kProd; + + for (int r = 0; r < 3; ++r) { + kProd[r] = + elt[r][0] * v[0] + + elt[r][1] * v[1] + + elt[r][2] * v[2]; + } + + return kProd; + } + + + /** + * vector * matrix [1x3 * 3x3 = 1x3] + */ + friend Vector3 operator* (const Vector3& rkVector, + const Matrix3& rkMatrix); + + /** + * matrix * scalar + */ + Matrix3 operator* (float fScalar) const; + + /** scalar * matrix */ + friend Matrix3 operator* (double fScalar, const Matrix3& rkMatrix); + friend Matrix3 operator* (float fScalar, const Matrix3& rkMatrix); + friend Matrix3 operator* (int fScalar, const Matrix3& rkMatrix); + + Matrix3& operator*= (float k); + Matrix3& operator/= (float k); + + +private: + /** Multiplication where out != A and out != B */ + static void _mul(const Matrix3& A, const Matrix3& B, Matrix3& out); +public: + + /** Optimized implementation of out = A * B. It is safe (but slow) to call + with A, B, and out possibly pointer equal to one another.*/ + // This is a static method so that it is not ambiguous whether "this" + // is an input or output argument. + inline static void mul(const Matrix3& A, const Matrix3& B, Matrix3& out) { + if ((&out == &A) || (&out == &B)) { + // We need a temporary anyway, so revert to the stack method. + out = A * B; + } else { + // Optimized in-place multiplication. + _mul(A, B, out); + } + } + +private: + static void _transpose(const Matrix3& A, Matrix3& out); +public: + + /** Optimized implementation of out = A.transpose(). It is safe (but slow) to call + with A and out possibly pointer equal to one another. + + Note that A.transpose() * v can be computed + more efficiently as v * A. + */ + inline static void transpose(const Matrix3& A, Matrix3& out) { + if (&A == &out) { + out = A.transpose(); + } else { + _transpose(A, out); + } + } + + /** Returns true if the rows and column L2 norms are 1.0 and the rows are orthogonal. */ + bool isOrthonormal() const; + + Matrix3 transpose () const; + bool inverse (Matrix3& rkInverse, float fTolerance = 1e-06) const; + Matrix3 inverse (float fTolerance = 1e-06) const; + float determinant () const; + + /** singular value decomposition */ + void singularValueDecomposition (Matrix3& rkL, Vector3& rkS, + Matrix3& rkR) const; + /** singular value decomposition */ + void singularValueComposition (const Matrix3& rkL, + const Vector3& rkS, const Matrix3& rkR); + + /** Gram-Schmidt orthonormalization (applied to columns of rotation matrix) */ + void orthonormalize(); + + /** orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12) */ + void qDUDecomposition (Matrix3& rkQ, Vector3& rkD, + Vector3& rkU) const; + + /** + Polar decomposition of a matrix. Based on pseudocode from Nicholas J + Higham, "Computing the Polar Decomposition -- with Applications Siam + Journal of Science and Statistical Computing, Vol 7, No. 4, October + 1986. + + Decomposes A into R*S, where R is orthogonal and S is symmetric. + + Ken Shoemake's "Matrix animation and polar decomposition" + in Proceedings of the conference on Graphics interface '92 + seems to be better known in the world of graphics, but Higham's version + uses a scaling constant that can lead to faster convergence than + Shoemake's when the initial matrix is far from orthogonal. + */ + void polarDecomposition(Matrix3 &R, Matrix3 &S) const; + + /** + * Matrix norms. + */ + float spectralNorm () const; + + float squaredFrobeniusNorm() const; + + float frobeniusNorm() const; + + float l1Norm() const; + + float lInfNorm() const; + + float diffOneNorm(const Matrix3 &y) const; + + /** matrix must be orthonormal */ + void toAxisAngle(Vector3& rkAxis, float& rfRadians) const; + + static Matrix3 fromDiagonal(const Vector3& d) { + return Matrix3(d.x, 0, 0, + 0, d.y, 0, + 0, 0, d.z); + } + + static Matrix3 fromAxisAngle(const Vector3& rkAxis, float fRadians); + + /** + * The matrix must be orthonormal. The decomposition is yaw*pitch*roll + * where yaw is rotation about the Up vector, pitch is rotation about the + * right axis, and roll is rotation about the Direction axis. + */ + bool toEulerAnglesXYZ (float& rfYAngle, float& rfPAngle, + float& rfRAngle) const; + bool toEulerAnglesXZY (float& rfYAngle, float& rfPAngle, + float& rfRAngle) const; + bool toEulerAnglesYXZ (float& rfYAngle, float& rfPAngle, + float& rfRAngle) const; + bool toEulerAnglesYZX (float& rfYAngle, float& rfPAngle, + float& rfRAngle) const; + bool toEulerAnglesZXY (float& rfYAngle, float& rfPAngle, + float& rfRAngle) const; + bool toEulerAnglesZYX (float& rfYAngle, float& rfPAngle, + float& rfRAngle) const; + static Matrix3 fromEulerAnglesXYZ (float fYAngle, float fPAngle, float fRAngle); + static Matrix3 fromEulerAnglesXZY (float fYAngle, float fPAngle, float fRAngle); + static Matrix3 fromEulerAnglesYXZ (float fYAngle, float fPAngle, float fRAngle); + static Matrix3 fromEulerAnglesYZX (float fYAngle, float fPAngle, float fRAngle); + static Matrix3 fromEulerAnglesZXY (float fYAngle, float fPAngle, float fRAngle); + static Matrix3 fromEulerAnglesZYX (float fYAngle, float fPAngle, float fRAngle); + + /** eigensolver, matrix must be symmetric */ + void eigenSolveSymmetric (float afEigenvalue[3], + Vector3 akEigenvector[3]) const; + + static void tensorProduct (const Vector3& rkU, const Vector3& rkV, + Matrix3& rkProduct); + std::string toString() const; + + static const float EPSILON; + + // Special values. + // The unguaranteed order of initialization of static variables across + // translation units can be a source of annoying bugs, so now the static + // special values (like Vector3::ZERO, Color3::WHITE, ...) are wrapped + // inside static functions that return references to them. + // These functions are intentionally not inlined, because: + // "You might be tempted to write [...] them as inline functions + // inside their respective header files, but this is something you + // must definitely not do. An inline function can be duplicated + // in every file in which it appears śóő˝ and this duplication + // includes the static object definition. Because inline functions + // automatically default to internal linkage, this would result in + // having multiple static objects across the various translation + // units, which would certainly cause problems. So you must + // ensure that there is only one definition of each wrapping + // function, and this means not making the wrapping functions inline", + // according to Chapter 10 of "Thinking in C++, 2nd ed. Volume 1" by Bruce Eckel, + // http://www.mindview.net/ + static const Matrix3& zero(); + static const Matrix3& identity(); + +protected: + + // support for eigensolver + void tridiagonal (float afDiag[3], float afSubDiag[3]); + bool qLAlgorithm (float afDiag[3], float afSubDiag[3]); + + // support for singular value decomposition + static const float ms_fSvdEpsilon; + static const int ms_iSvdMaxIterations; + static void bidiagonalize (Matrix3& kA, Matrix3& kL, + Matrix3& kR); + static void golubKahanStep (Matrix3& kA, Matrix3& kL, + Matrix3& kR); + + // support for spectral norm + static float maxCubicRoot (float afCoeff[3]); + +}; + + +//---------------------------------------------------------------------------- +/** v * M == M.transpose() * v */ +inline Vector3 operator* (const Vector3& rkPoint, const Matrix3& rkMatrix) { + Vector3 kProd; + + for (int r = 0; r < 3; ++r) { + kProd[r] = + rkPoint[0] * rkMatrix.elt[0][r] + + rkPoint[1] * rkMatrix.elt[1][r] + + rkPoint[2] * rkMatrix.elt[2][r]; + } + + return kProd; +} + + +} // namespace + +#endif + diff --git a/externals/g3dlite/G3D/Matrix4.h b/externals/g3dlite/G3D/Matrix4.h new file mode 100644 index 0000000..9ce87d8 --- /dev/null +++ b/externals/g3dlite/G3D/Matrix4.h @@ -0,0 +1,249 @@ +/** + @file Matrix4.h + + 4x4 matrix class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-10-02 + @edited 2009-10-20 + */ + +#ifndef G3D_Matrix4_h +#define G3D_Matrix4_h + +#ifdef _MSC_VER +// Disable conditional expression is constant, which occurs incorrectly on inlined functions +# pragma warning (push) +# pragma warning( disable : 4127 ) +#endif + +#include "G3D/platform.h" +#include "G3D/debugAssert.h" +#include "G3D/Matrix3.h" +#include "G3D/Vector3.h" + +namespace G3D { + +class Any; + +/** + A 4x4 matrix. + + See also G3D::CoordinateFrame, G3D::Matrix3, G3D::Quat + */ +class Matrix4 { +private: + + float elt[4][4]; + + /** + Computes the determinant of the 3x3 matrix that lacks excludeRow + and excludeCol. + */ + float subDeterminant(int excludeRow, int excludeCol) const; + + // Hidden operators + bool operator<(const Matrix4&) const; + bool operator>(const Matrix4&) const; + bool operator<=(const Matrix4&) const; + bool operator>=(const Matrix4&) const; + +public: + /** Must be of the form: Matrix4(#, #, # .... #)*/ + Matrix4(const Any& any); + + operator Any() const; + + Matrix4( + float r1c1, float r1c2, float r1c3, float r1c4, + float r2c1, float r2c2, float r2c3, float r2c4, + float r3c1, float r3c2, float r3c3, float r3c4, + float r4c1, float r4c2, float r4c3, float r4c4); + + /** + init should be row major. + */ + Matrix4(const float* init); + + /** + a is the upper left 3x3 submatrix and b is the upper right 3x1 submatrix. The last row of the created matrix is (0,0,0,1). + */ + Matrix4(const class Matrix3& upper3x3, const class Vector3& lastCol = Vector3::zero()); + + Matrix4(const class CoordinateFrame& c); + + Matrix4(const double* init); + + Matrix4(); + + /** Produces an RT transformation that nearly matches this Matrix4. + Because a Matrix4 may not be precisely a rotation and translation, + this may introduce error. */ + class CoordinateFrame approxCoordinateFrame() const; + + // Special values. + // Intentionally not inlined: see Matrix3::identity() for details. + static const Matrix4& identity(); + static const Matrix4& zero(); + + /** If this is a perspective projection matrix created by + Matrix4::perspectiveProjection, extract its parameters. */ + void getPerspectiveProjectionParameters + (float& left, + float& right, + float& bottom, + float& top, + float& nearval, + float& farval, + float updirection = -1.0f) const; + + inline float* operator[](int r) { + debugAssert(r >= 0); + debugAssert(r < 4); + return (float*)&elt[r]; + } + + inline const float* operator[](int r) const { + debugAssert(r >= 0); + debugAssert(r < 4); + return (const float*)&elt[r]; + } + + inline operator float* () { + return (float*)&elt[0][0]; + } + + inline operator const float* () const { + return (const float*)&elt[0][0]; + } + + Matrix4 operator*(const Matrix4& other) const; + + class Matrix3 upper3x3() const; + + /** Homogeneous multiplication. Let k = M * [v w]^T. result = k.xyz() / k.w */ + class Vector3 homoMul(const class Vector3& v, float w) const; + + /** + Constructs an orthogonal projection matrix from the given parameters. + Near and far are the NEGATIVE of the near and far plane Z values + (to follow OpenGL conventions). + + \param upDirection Use -1.0 for 2D Y increasing downwards (the G3D 8.x default convention), + 1.0 for 2D Y increasing upwards (the G3D 7.x default and OpenGL convention) + */ + static Matrix4 orthogonalProjection( + float left, + float right, + float bottom, + float top, + float nearval, + float farval, + float upDirection = -1.0f); + + + /** \param upDirection Use -1.0 for 2D Y increasing downwards (the G3D 8.x default convention), + 1.0 for 2D Y increasing upwards (the G3D 7.x default and OpenGL convention) + */ + static Matrix4 orthogonalProjection( + const class Rect2D& rect, + float nearval, + float farval, + float upDirection = -1.0f); + + /** \param upDirection Use -1.0 for 2D Y increasing downwards (the G3D 8.x default convention), + 1.0 for 2D Y increasing upwards (the G3D 7.x default and OpenGL convention) + */ + static Matrix4 perspectiveProjection( + float left, + float right, + float bottom, + float top, + float nearval, + float farval, + float upDirection = -1.0f); + + void setRow(int r, const class Vector4& v); + void setColumn(int c, const Vector4& v); + + const Vector4& row(int r) const; + Vector4 column(int c) const; + + Matrix4 operator*(const float s) const; + Vector4 operator*(const Vector4& vector) const; + + Matrix4 transpose() const; + + bool operator!=(const Matrix4& other) const; + bool operator==(const Matrix4& other) const; + + float determinant() const; + Matrix4 inverse() const; + + /** + Transpose of the cofactor matrix (used in computing the inverse). + Note: This is in fact only one type of adjoint. More generally, + an adjoint of a matrix is any mapping of a matrix which possesses + certain properties. This returns the so-called adjugate + or classical adjoint. + */ + Matrix4 adjoint() const; + Matrix4 cofactor() const; + + /** Serializes row-major */ + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + std::string toString() const; + + /** 3D scale matrix */ + inline static Matrix4 scale(const Vector3& v) { + return Matrix4(v.x, 0, 0, 0, + 0, v.y, 0, 0, + 0, 0, v.z, 0, + 0, 0, 0, 1); + } + + /** 3D scale matrix */ + inline static Matrix4 scale(float x, float y, float z) { + return scale(Vector3(x, y, z)); + } + + /** 3D scale matrix */ + inline static Matrix4 scale(float s) { + return scale(s,s,s); + } + + /** 3D translation matrix */ + inline static Matrix4 translation(const Vector3& v) { + return Matrix4(Matrix3::identity(), v); + } + + inline static Matrix4 translation(float x, float y, float z) { + return Matrix4(Matrix3::identity(), Vector3(x, y, z)); + } + + /** Create a rotation matrix that rotates \a deg degrees around the Y axis */ + inline static Matrix4 yawDegrees(float deg) { + return Matrix4(Matrix3::fromAxisAngle(Vector3::unitY(), toRadians(deg))); + } + + inline static Matrix4 pitchDegrees(float deg) { + return Matrix4(Matrix3::fromAxisAngle(Vector3::unitX(), toRadians(deg))); + } + + inline static Matrix4 rollDegrees(float deg) { + return Matrix4(Matrix3::fromAxisAngle(Vector3::unitZ(), toRadians(deg))); + } +}; + + + +} // namespace + +#ifdef _MSC_VER +# pragma warning (pop) +#endif + +#endif diff --git a/externals/g3dlite/G3D/MemoryManager.h b/externals/g3dlite/G3D/MemoryManager.h new file mode 100644 index 0000000..15bf6d8 --- /dev/null +++ b/externals/g3dlite/G3D/MemoryManager.h @@ -0,0 +1,93 @@ +/** + @file MemoryManager.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2009-04-20 + @edited 2009-04-20 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ +#ifndef G3D_MemoryManager_h +#define G3D_MemoryManager_h + +#include "G3D/platform.h" +#include "G3D/ReferenceCount.h" + +namespace G3D { + +/** + Abstraction of memory management. + Default implementation uses G3D::System::malloc and is threadsafe. + + \sa CRTMemoryManager, AlignedMemoryManager, AreaMemoryManager */ +class MemoryManager : public ReferenceCountedObject { +protected: + + MemoryManager(); + +public: + + typedef ReferenceCountedPointer Ref; + + /** Return a pointer to \a s bytes of memory that are unused by + the rest of the program. The contents of the memory are + undefined */ + virtual void* alloc(size_t s); + + /** Invoke to declare that this memory will no longer be used by + the program. The memory manager is not required to actually + reuse or release this memory. */ + virtual void free(void* ptr); + + /** Returns true if this memory manager is threadsafe (i.e., alloc + and free can be called asychronously) */ + virtual bool isThreadsafe() const; + + /** Return the instance. There's only one instance of the default + MemoryManager; it is cached after the first creation. */ + static MemoryManager::Ref create(); +}; + +/** + Allocates memory on 16-byte boundaries. + \sa MemoryManager, CRTMemoryManager, AreaMemoryManager */ +class AlignedMemoryManager : public MemoryManager { +protected: + + AlignedMemoryManager(); + +public: + + typedef ReferenceCountedPointer Ref; + + + virtual void* alloc(size_t s); + + virtual void free(void* ptr); + + virtual bool isThreadsafe() const; + + static AlignedMemoryManager::Ref create(); +}; + + +/** MemoryManager implemented using the C runtime. */ +class CRTMemoryManager : public MemoryManager { +protected: + CRTMemoryManager(); + +public: + typedef ReferenceCountedPointer Ref; + virtual void* alloc(size_t s); + virtual void free(void* ptr); + virtual bool isThreadsafe() const; + + /** There's only one instance of this memory manager; it is + cached after the first creation. */ + static CRTMemoryManager::Ref create(); +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/MeshAlg.h b/externals/g3dlite/G3D/MeshAlg.h new file mode 100644 index 0000000..1decea1 --- /dev/null +++ b/externals/g3dlite/G3D/MeshAlg.h @@ -0,0 +1,683 @@ +/** + @file MeshAlg.h + + Indexed Mesh algorithms. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-09-14 + @edited 2010-01-18 +*/ + +#ifndef G3D_MeshAlg_h +#define G3D_MeshAlg_h + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Vector3.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/SmallArray.h" +#include "G3D/constants.h" +#include "G3D/Image1.h" + +#ifdef G3D_WIN32 +// Turn off "conditional expression is constant" warning; MSVC generates this +// for debug assertions in inlined methods. +#pragma warning (disable : 4127) +#endif + +namespace G3D { + +/** + Indexed mesh algorithms. You have to build your own mesh class. +

+ No mesh class is provided with G3D because there isn't an "ideal" + mesh format-- one application needs keyframed animation, another + skeletal animation, a third texture coordinates, a fourth + cannot precompute information, etc. Instead of compromising, this + class implements the hard parts of mesh computation and you can write + your own ideal mesh class on top of it. + + \sa G3D::ArticulatedModel, G3D::IFSModel + */ +class MeshAlg { +public: + + /** \deprecated */ + typedef PrimitiveType Primitive; + + /** Adjacency information for a vertex. + Does not contain the vertex position or normal, + which are stored in the MeshAlg::Geometry object. + Vertexs must be stored in an array + parallel to (indexed in the same way as) + MeshAlg::Geometry::vertexArray. + */ + class Vertex { + public: + Vertex() {} + + /** + Array of edges adjacent to this vertex. + Let e = edgeIndex[i]. + edge[(e >= 0) ? e : ~e].vertexIndex[0] == this + vertex index. + + Edges may be listed multiple times if they are + degenerate. + */ + SmallArray edgeIndex; + + /** + Returns true if e or ~e is in the edgeIndex list. + */ + inline bool inEdge(int e) const { + return edgeIndex.contains(~e) || edgeIndex.contains(e); + } + + /** + Array of faces containing this vertex. Faces + may be listed multiple times if they are degenerate. + */ + SmallArray faceIndex; + + inline bool inFace(int f) const { + debugAssert(f >= 0); + return faceIndex.contains(f); + } + }; + + + /** + Oriented, indexed triangle. + */ + class Face { + public: + Face(); + + /** + Used by Edge::faceIndex to indicate a missing face. + This is a large negative value. + */ + static const int NONE; + + + /** + Vertices in the face in counter-clockwise order. + Degenerate faces may include the same vertex multiple times. + */ + int vertexIndex[3]; + + inline bool containsVertex(int v) const { + return contains(vertexIndex, 3, v); + } + + /** + Edge indices in counter-clockwise order. Edges are + undirected, so it is important to know which way + each edge is pointing in a face. This is encoded + using negative indices. + + If edgeIndex[i] >= 0 then this face + contains the directed edge + between vertex indices + edgeArray[face.edgeIndex[i]].vertexIndex[0] + and + edgeArray[face.edgeIndex[i]].vertexIndex[1]. + + If edgeIndex[i] < 0 then + ~edgeIndex[i] (i.e. the two's + complement of) is used and this face contains the directed + edge between vertex indices + edgeArray[~face.edgeIndex[i]].vertexIndex[0] + and + edgeArray[~face.edgeIndex[i]].vertexIndex[1]. + + Degenerate faces may include the same edge multiple times. + */ + // Temporarily takes on the value Face::NONE during adjacency + // computation to indicate an edge that has not yet been assigned. + int edgeIndex[3]; + + inline bool containsEdge(int e) const { + if (e < 0) { + e = ~e; + } + return contains(edgeIndex, 3, e) || contains(edgeIndex, 3, ~e); + } + + /** Contains the forward edge e if e >= 0 and the backward edge + ~e otherwise. */ + inline bool containsDirectedEdge(int e) const { + return contains(edgeIndex, 3, e); + } + }; + + + /** Oriented, indexed edge */ + class Edge { + public: + Edge(); + + /** Degenerate edges may include the same vertex times. */ + int vertexIndex[2]; + + inline bool containsVertex(int v) const { + return contains(vertexIndex, 2, v); + } + + /** + The edge is directed forward in face 0 + backward in face 1. Face index of MeshAlg::Face::NONE + indicates a boundary (a.k.a. crack, broken) edge. + */ + int faceIndex[2]; + + /** Returns true if f is contained in the faceIndex array in either slot. + To see if it is forward in that face, just check edge.faceIndex[0] == f.*/ + inline bool inFace(int f) const { + return contains(faceIndex, 2, f); + } + + /** + Returns true if either faceIndex is NONE. + */ + inline bool boundary() const { + return (faceIndex[0] == Face::NONE) || + (faceIndex[1] == Face::NONE); + } + + /** + Returns the reversed edge. + */ + inline Edge reverse() const { + Edge e; + e.vertexIndex[0] = vertexIndex[1]; + e.vertexIndex[1] = vertexIndex[0]; + e.faceIndex[0] = faceIndex[1]; + e.faceIndex[1] = faceIndex[0]; + return e; + } + }; + + + /** + Convenient for passing around the per-vertex data that changes under + animation. The faces and edges are needed to interpret + these values. + */ + class Geometry { + public: + /** Vertex positions */ + Array vertexArray; + + /** Vertex normals */ + Array normalArray; + + /** + Assignment is optimized using SSE. + */ + Geometry& operator=(const Geometry& src); + + void clear() { + vertexArray.clear(); + normalArray.clear(); + } + }; + + /** + Given a set of vertices and a set of indices for traversing them + to create triangles, computes other mesh properties. + + Colocated vertices are treated as separate. To have + colocated vertices collapsed (necessary for many algorithms, + like shadowing), weld the mesh before computing adjacency. + + Recent change: In version 6.00, colocated vertices were automatically + welded by this routine and degenerate faces and edges were removed. That + is no longer the case. + + Where two faces meet, there are two opposite directed edges. These + are collapsed into a single bidirectional edge in the edgeArray. + If four faces meet exactly at the same edge, that edge will appear + twice in the array, and so on. If an edge is a boundary of the mesh + (i.e. if the edge has only one adjacent face) it will appear in the + array with one face index set to MeshAlg::Face::NONE. + + @param vertexGeometry %Vertex positions to use when deciding colocation. + @param indexArray Order to traverse vertices to make triangles + @param faceArray Output + @param edgeArray Output. Sorted so that boundary edges are at the end of the array. + @param vertexArray Output + */ + static void computeAdjacency( + const Array& vertexGeometry, + const Array& indexArray, + Array& faceArray, + Array& edgeArray, + Array& vertexArray); + + /** + @deprecated Use the other version of computeAdjacency, which takes Array. + @param facesAdjacentToVertex Output adjacentFaceArray[v] is an array of + indices for faces touching vertex index v + */ + static void computeAdjacency( + const Array& vertexArray, + const Array& indexArray, + Array& faceArray, + Array& edgeArray, + Array< Array >& facesAdjacentToVertex); + + /** + Computes some basic mesh statistics including: min, max mean and median, + edge lengths; and min, mean, median, and max face area. + + @param vertexArray %Vertex positions to use when deciding colocation. + @param indexArray Order to traverse vertices to make triangles + @param minEdgeLength Minimum edge length + @param meanEdgeLength Mean edge length + @param medianEdgeLength Median edge length + @param maxEdgeLength Max edge length + @param minFaceArea Minimum face area + @param meanFaceArea Mean face area + @param medianFaceArea Median face area + @param maxFaceArea Max face area + */ + static void computeAreaStatistics( + const Array& vertexArray, + const Array& indexArray, + double& minEdgeLength, + double& meanEdgeLength, + double& medianEdgeLength, + double& maxEdgeLength, + double& minFaceArea, + double& meanFaceArea, + double& medianFaceArea, + double& maxFaceArea); + +private: + + /** Helper for weldAdjacency */ + static void weldBoundaryEdges( + Array& faceArray, + Array& edgeArray, + Array& vertexArray); + +public: + + /** + Computes tangent and binormal vectors, + which provide a (mostly) consistent + parameterization over the surface for + effects like bump mapping. In the resulting coordinate frame, + T = x (varies with texture s coordinate), B = y (varies with negative texture t coordinate), + and N = z for a right-handed coordinate frame. If a billboard is vertical on the screen + in view of the camera, the tangent space matches the camera's coordinate frame. + + The vertex, texCoord, tangent, and binormal + arrays are parallel arrays. + + The resulting tangent and binormal might not be exactly + perpendicular to each other. They are guaranteed to + be perpendicular to the normal. + + @cite Max McGuire + */ + static void computeTangentSpaceBasis( + const Array& vertexArray, + const Array& texCoordArray, + const Array& vertexNormalArray, + const Array& faceArray, + Array& tangent, + Array& binormal); + + /** @deprecated */ + static void computeNormals( + const Array& vertexArray, + const Array& faceArray, + const Array< Array >& adjacentFaceArray, + Array& vertexNormalArray, + Array& faceNormalArray); + + /** + Vertex normals are weighted by the area of adjacent faces. + Nelson Max showed this is superior to uniform weighting for + general meshes in jgt. + + @param vertexNormalArray Output. Unit length + @param faceNormalArray Output. Degenerate faces produce zero magnitude normals. Unit length + @see weld + */ + static void computeNormals( + const Array& vertexGeometry, + const Array& faceArray, + const Array& vertexArray, + Array& vertexNormalArray, + Array& faceNormalArray); + + /** Computes unit length normals in place using the other computeNormals methods. + If you already have a face array use another method; it will be faster. + @see weld*/ + static void computeNormals( + Geometry& geometry, + const Array& indexArray); + + /** + Computes face normals only. Significantly faster (especially if + normalize is false) than computeNormals. + @see weld + */ + static void computeFaceNormals( + const Array& vertexArray, + const Array& faceArray, + Array& faceNormals, + bool normalize = true); + + /** + Classifies each face as a backface or a front face relative + to the observer point P (which is at infinity when P.w = 0). + A face with normal exactly perpendicular to the observer vector + may be classified as either a front or a back face arbitrarily. + */ + static void identifyBackfaces( + const Array& vertexArray, + const Array& faceArray, + const Vector4& P, + Array& backface); + + /** A faster version of identifyBackfaces for the case where + face normals have already been computed */ + static void identifyBackfaces( + const Array& vertexArray, + const Array& faceArray, + const Vector4& P, + Array& backface, + const Array& faceNormals); + + /** + Welds nearby and colocated elements of the oldVertexArray together so that + newVertexArray contains no vertices within radius of one another. + Every vertex in newVertexPositions also appears in oldVertexPositions. + This is useful for downsampling meshes and welding cracks created by artist errors + or numerical imprecision. + + The two integer arrays map indices back and forth between the arrays according to: +

+     oldVertexArray[toOld[ni]] == newVertexArray[ni]
+     oldVertexArray[oi] == newVertexArray[toNew[ni]]
+     
+ + Note that newVertexPositions is never longer than oldVertexPositions + and is shorter when vertices are welded. + + Welding with a large radius will effectively compute a lower level of detail for + the mesh. + + The welding method runs in roughly linear time in the length of oldVertexArray-- + a uniform spatial grid is used to achieve nearly constant time vertex collapses + for uniformly distributed vertices. + + It is sometimes desirable to keep the original vertex ordering but + identify the unique vertices. The following code computes + array canonical s.t. canonical[v] = first occurance of + a vertex near oldVertexPositions[v] in oldVertexPositions. + +
+        Array canonical(oldVertexPositions.size()), toNew, toOld;
+        computeWeld(oldVertexPositions, Array(), toNew, toOld, radius);
+        for (int v = 0; v < canonical.size(); ++v) {
+            canonical[v] = toOld[toNew[v]];
+        }
+     
+ + See also G3D::MeshAlg::weldAdjacency. + + @cite The method is that described as the 'Grouper' in Baum, Mann, Smith, and Winget, + Making Radiosity Usable: Automatic Preprocessing and Meshing Techniques for + the Generation of Accurate Radiosity Solutions, Computer Graphics vol 25, no 4, July 1991. + + @deprecated Use weld. + */ + static void computeWeld( + const Array& oldVertexPositions, + Array& newVertexPositions, + Array& toNew, + Array& toOld, + double radius = fuzzyEpsilon); + + /** + Modifies the face, edge, and vertex arrays in place so that + colocated (within radius) vertices are treated as identical. + Note that the vertexArray and corresponding geometry will + contain elements that are no longer used. In the vertexArray, + these elements are initialized to MeshAlg::Vertex() but not + removed (because removal would change the indexing). + + This is a good preprocessing step for algorithms that are only + concerned with the shape of a mesh (e.g. cartoon rendering, fur, shadows) + and not the indexing of the vertices. + + Use this method when you have already computed adjacency information + and want to collapse colocated vertices within that data without + disturbing the actual mesh vertices or indexing scheme. + + If you have not computed adjacency already, use MeshAlg::computeWeld + instead and compute adjacency information after welding. + + @deprecated Use weld. + + @param faceArray Mutated in place. Size is maintained (degenerate + faces are not removed). + @param edgeArray Mutated in place. May shrink if boundary edges + are welded together. + @param vertexArray Mutated in place. Size is maintained (duplicate + vertices contain no adjacency info). + */ + static void weldAdjacency( + const Array& originalGeometry, + Array& faceArray, + Array& edgeArray, + Array& vertexArray, + double radius = fuzzyEpsilon); + + + /** + Counts the number of edges (in an edge array returned from + MeshAlg::computeAdjacency) that have only one adjacent face. + */ + static int countBoundaryEdges(const Array& edgeArray); + + + /** + Generates an array of integers from start to start + n - 1 that have run numbers + in series then omit the next skip before the next run. Useful for turning + a triangle list into an indexed face set. + + Example: +
+       createIndexArray(10, x);
+       // x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 
+
+       createIndexArray(5, x, 2);
+       // x = [2, 3, 4, 5, 6, 7] 
+
+       createIndexArray(6, x, 0, 2, 1);
+       // x = [0, 1, 3, 4, 6, 7]
+     
+ */ + static void createIndexArray( + int n, + Array& array, + int start = 0, + int run = 1, + int skip = 0); + + /** + Computes a conservative, near-optimal axis aligned bounding box and sphere. + + @cite The bounding sphere uses the method from J. Ritter. An effcient bounding sphere. In Andrew S. Glassner, editor, Graphics Gems. Academic Press, Boston, MA, 1990. + + */ + static void computeBounds(const Array& vertex, class AABox& box, class Sphere& sphere); + + /** Computes bounds for a subset of the vertices. It is ok if vertices appear more than once in the index array. */ + static void computeBounds(const Array& vertex, const Array& index, class AABox& box, class Sphere& sphere); + + /** + In debug mode, asserts that the adjacency references between the + face, edge, and vertex array are consistent. + */ + static void debugCheckConsistency( + const Array& faceArray, + const Array& edgeArray, + const Array& vertexArray); + + /** + Generates a unit square in the X-Z plane composed of a grid of wCells x hCells + squares and then transforms it by xform. + + @param vertex Output vertices + @param texCoord Output texture coordinates + @param index Output triangle list indices + @param textureScale Lower-right texture coordinate + @param spaceCentered If true, the coordinates generated are centered at the origin before the transformation. + @param twoSided If true, matching top and bottom planes are generated. + \param elevation If non-NULL, values from this image are used as elevations. Apply an \a xform to adjust the scale + */ + static void generateGrid( + Array& vertex, + Array& texCoord, + Array& index, + int wCells = 10, + int hCells = 10, + const Vector2& textureScale = Vector2(1,1), + bool spaceCentered = true, + bool twoSided = true, + const CoordinateFrame& xform = CoordinateFrame(), + const Image1::Ref& elevation = NULL); + + /** Converts quadlist (QUADS), + triangle fan (TRIANGLE_FAN), + tristrip(TRIANGLE_STRIP), and quadstrip (QUAD_STRIP) indices into + triangle list (TRIANGLES) indices and appends them to outIndices. */ + template + static void toIndexedTriList( + const Array& inIndices, + MeshAlg::Primitive inType, + Array& outIndices) { + + debugAssert( + inType == PrimitiveType::TRIANGLE_STRIP || + inType == PrimitiveType::TRIANGLE_FAN || + inType == PrimitiveType::QUADS || + inType == PrimitiveType::QUAD_STRIP); + + const int inSize = inIndices.size(); + + switch(inType) { + case PrimitiveType::TRIANGLE_FAN: + { + debugAssert(inSize >= 3); + + int N = outIndices.size(); + outIndices.resize(N + (inSize - 2) * 3); + + for (IndexType i = 1, outIndex = N; i <= (inSize - 2); ++i, outIndex += 3) { + outIndices[outIndex] = inIndices[0]; + outIndices[outIndex + 1] = inIndices[i]; + outIndices[outIndex + 2] = inIndices[i + 1]; + } + + break; + } + + case PrimitiveType::TRIANGLE_STRIP: + { + debugAssert(inSize >= 3); + + int N = outIndices.size(); + outIndices.resize(N + (inSize - 2) * 3); + + bool atEven = false; + for (IndexType i = 0, outIndex = N; i <= (inSize - 2); ++i, outIndex += 3) { + if (atEven) { + outIndices[outIndex] = inIndices[i + 1]; + outIndices[outIndex + 1] = inIndices[i]; + outIndices[outIndex + 2] = inIndices[i + 2]; + atEven = false; + } else { + outIndices[outIndex] = inIndices[i]; + outIndices[outIndex + 1] = inIndices[i + 1]; + outIndices[outIndex + 2] = inIndices[i + 2]; + atEven = true; + } + } + + break; + } + + case PrimitiveType::QUADS: + { + debugAssert(inIndices.size() >= 4); + + int N = outIndices.size(); + outIndices.resize(N + (inSize / 4) * 3); + + for (IndexType i = 0, outIndex = N; i <= (inSize - 4); i += 4, outIndex += 6) { + outIndices[outIndex] = inIndices[i]; + outIndices[outIndex + 1] = inIndices[i + 1]; + outIndices[outIndex + 2] = inIndices[i + 3]; + outIndices[outIndex + 3] = inIndices[i + 1]; + outIndices[outIndex + 4] = inIndices[i + 2]; + outIndices[outIndex + 5] = inIndices[i + 3]; + } + + break; + } + + case PrimitiveType::QUAD_STRIP: + { + debugAssert(inIndices.size() >= 4); + + int N = outIndices.size(); + outIndices.resize(N + (inSize - 2) * 3); + + for (IndexType i = 0, outIndex = N; i <= (inSize - 2); i += 2, outIndex += 6) { + outIndices[outIndex] = inIndices[i]; + outIndices[outIndex + 1] = inIndices[i + 1]; + outIndices[outIndex + 2] = inIndices[i + 2]; + outIndices[outIndex + 3] = inIndices[i + 2]; + outIndices[outIndex + 4] = inIndices[i + 1]; + outIndices[outIndex + 5] = inIndices[i + 3]; + } + break; + } + default: + alwaysAssertM(false, "Illegal argument"); + } + } + +protected: + + /** + Helper for computeAdjacency. If a directed edge with index e already + exists from i0 to i1 then e is returned. If a directed edge with index e + already exists from i1 to i0, ~e is returned (the complement) and + edgeArray[e] is set to f. Otherwise, a new edge is created from i0 to i1 + with first face index f and its index is returned. + + @param vertexArray Vertex positions to use when deciding colocation. + + @param area Area of face f. When multiple edges of the same direction + are found between the same vertices (usually because of degenerate edges) + the face with larger area is kept in the edge table. + */ + static int findEdgeIndex( + const Array& vertexArray, + Array& geometricEdgeArray, + int i0, int i1, int f, double area); +}; +} +#endif + diff --git a/externals/g3dlite/G3D/MeshBuilder.h b/externals/g3dlite/G3D/MeshBuilder.h new file mode 100644 index 0000000..9920d59 --- /dev/null +++ b/externals/g3dlite/G3D/MeshBuilder.h @@ -0,0 +1,82 @@ +/** + @file MeshBuilder.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-02-27 + @edited 2004-10-04 + */ +#ifndef G3D_MESHBUILDER_H +#define G3D_MESHBUILDER_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Vector3.h" +#include "G3D/Triangle.h" + +namespace G3D { + +/** + Allows creation of optimized watertight meshes from unoptimized polygon soups. + See also G3D::MeshAlg for algorithms that operate on the output. + */ +class MeshBuilder { +public: + + /** + Set setWeldRadius to AUTO_WELD to weld vertices closer than 1/2 + the smallest edge length in a model. + */ + enum {AUTO_WELD = -100}; + +private: + /** Indices of vertices in or near a grid cell. */ + typedef Array List; + + std::string name; + + /** + All of the triangles, as a long triangle list. + */ + Array triList; + + void centerTriList(); + void computeBounds(Vector3& min, Vector3& max); + + bool _twoSided; + + /** Collapse radius */ + double close; + +public: + + inline MeshBuilder(bool twoSided = false) : _twoSided(twoSided), close(AUTO_WELD) {} + + /** Writes the model to the arrays, which can then be used with + G3D::IFSModel::save and G3D::MeshAlg */ + void commit(std::string& name, Array& indexArray, Array& vertexArray); + + /** + Adds a new triangle to the model. (Counter clockwise) + */ + void addTriangle(const Vector3& a, const Vector3& b, const Vector3& c); + + /** + Adds two new triangles to the model. (Counter clockwise) + */ + void addQuad(const Vector3& a, const Vector3& b, const Vector3& c, const Vector3& d); + + void addTriangle(const Triangle& t); + + void setName(const std::string& n); + + /** Vertices within this distance are considered identical. + Use AUTO_WELD (the default) to have the distance be a function of the model size.*/ + void setWeldRadius(double r) { + close = r; + } +}; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/NetAddress.h b/externals/g3dlite/G3D/NetAddress.h new file mode 100644 index 0000000..8ed20a0 --- /dev/null +++ b/externals/g3dlite/G3D/NetAddress.h @@ -0,0 +1,132 @@ +#ifndef G3D_NETADDRESS_H +#define G3D_NETADDRESS_H + +#include "G3D/platform.h" +#include "G3D/Table.h" + +/** These control the version of Winsock used by G3D. + Version 2.0 is standard for G3D 6.09 and later. + Version 1.1 is standard for G3D 6.08 and earlier. + */ +#define G3D_WINSOCK_MAJOR_VERSION 2 +#define G3D_WINSOCK_MINOR_VERSION 0 + +#ifdef G3D_WIN32 +# if (G3D_WINSOCK_MAJOR_VERSION == 2) +# include +# elif (G3D_WINSOCK_MAJOR_VERSION == 1) +# include +# endif +#else +# include +# include +# include +# ifndef SOCKADDR_IN +# define SOCKADDR_IN struct sockaddr_in +# endif +# ifndef SOCKET +# define SOCKET int +# endif +#endif + +#include "G3D/g3dmath.h" + +namespace G3D { + +class NetAddress { +private: + friend class NetworkDevice; + friend class LightweightConduit; + friend class ReliableConduit; + + /** Host byte order */ + void init(uint32 host, uint16 port); + void init(const std::string& hostname, uint16 port); + NetAddress(const SOCKADDR_IN& a); + NetAddress(const struct in_addr& addr, uint16 port = 0); + + SOCKADDR_IN addr; + +public: + /** + In host byte order + */ + NetAddress(uint32 host, uint16 port = 0); + + /** + @param port Specified in host byte order (i.e., don't worry about endian issues) + */ + NetAddress(const std::string& hostname, uint16 port); + + /** + @param hostnameAndPort in the form "hostname:port" or "ip:port" + */ + NetAddress(const std::string& hostnameAndPort); + + /** + @deprecated Use G3D::NetworkDevice::broadcastAddressArray() + + @brief Creates a UDP broadcast address for use with a + G3D::LightweightConduit. + + UDP broadcast allows one machine to send a packet to all machines + on the same local network. The IP portion of the address is + 0xFFFFFFFF, which indicates "broadcast" to the underlying socket + API. This feature is not available with the connection-based TCP + protocol abstracted by G3D::ReliableConduit; use multisend + instead. + */ + static NetAddress broadcastAddress(uint16 port); + + NetAddress(); + + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + /** @brief Returns true if this is not an illegal address. */ + bool ok() const; + + /** @brief Returns a value in host format (i.e., don't worry about + endian issues) */ + inline uint32 ip() const { + return ntohl(addr.sin_addr.s_addr); + //return ntohl(addr.sin_addr.S_un.S_addr); + } + + inline uint16 port() const { + return ntohs(addr.sin_port); + } + + std::string ipString() const; + std::string toString() const; + +}; + +std::ostream& operator<<(std::ostream& os, const NetAddress&); + +} // namespace G3D + +template <> struct HashTrait { + static size_t hashCode(const G3D::NetAddress& key) { + return static_cast(key.ip() + (static_cast(key.port()) << 16)); + } +}; + +namespace G3D { + +/** + Two addresses may point to the same computer but be != because + they have different IP's. + */ +inline bool operator==(const NetAddress& a, const NetAddress& b) { + return (a.ip() == b.ip()) && (a.port() == b.port()); +} + + +inline bool operator!=(const NetAddress& a, const NetAddress& b) { + return !(a == b); +} + +} // namespace G3D + +#endif diff --git a/externals/g3dlite/G3D/NetworkDevice.h b/externals/g3dlite/G3D/NetworkDevice.h new file mode 100644 index 0000000..ea3290c --- /dev/null +++ b/externals/g3dlite/G3D/NetworkDevice.h @@ -0,0 +1,738 @@ +/** + @file NetworkDevice.h + + These classes abstract networking from the socket level to a + serialized messaging style that is more appropriate for games. The + performance has been tuned for sending many small messages. The + message protocol contains a header that prevents them from being used + with raw UDP/TCP (e.g. connecting to an HTTP server). + + LightweightConduit and ReliableConduits have different interfaces + because they have different semantics. You would never want to + interchange them without rewriting the surrounding code. + + NetworkDevice creates conduits because they need access to a global + log pointer and because I don't want non-reference counted conduits + being created. + + Be careful with threads and reference counting. The reference + counters are not threadsafe, and are also not updated correctly if a + thread is explicitly killed. Since the conduits will be passed by + const XConduitRef& most of the time this doesn't appear as a major + problem. With non-blocking conduits, you should need few threads + anyway. + + LightweightConduits preceed each message with a 4-byte host order + unsigned integer that is the message type. This does not appear in + the message serialization/deserialization. + + ReliableConduits preceed each message with two 4-byte host order + unsigned integers. The first is the message type and the second + indicates the length of the rest of the data. The size does not + include the size of the header itself. The minimum message is 9 + bytes:a 4-byte type, a 4-byte header equal to "1", and one byte of data. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2002-11-22 + @edited 2006-11-25 + */ + +#ifndef G3D_NETWORKDEVICE_H +#define G3D_NETWORKDEVICE_H + +#include "G3D/platform.h" +#include "G3D/NetAddress.h" + +#include +#include +#include "G3D/g3dmath.h" + +#include "G3D/ReferenceCount.h" +#include "G3D/Array.h" +#include "G3D/BinaryOutput.h" + +namespace G3D { + +class TextOutput; + +class Conduit : public ReferenceCountedObject { +protected: + friend class NetworkDevice; + friend class NetListener; + + uint64 mSent; + uint64 mReceived; + uint64 bSent; + uint64 bReceived; + + SOCKET sock; + + /** + Used for serialization. One per socket + to make this threadsafe. + */ + BinaryOutput binaryOutput; + + Conduit(); + +public: + + virtual ~Conduit(); + uint64 bytesSent() const; + uint64 messagesSent() const; + uint64 bytesReceived() const; + uint64 messagesReceived() const; + + /** + If true, receive will return true. + */ + virtual bool messageWaiting(); + + /** + Returns the type of the waiting message (i.e. the type supplied + with send). The return value is zero when there is no message + waiting. + + One way to use this is to have a Table mapping message types to + pre-allocated subclasses so receiving looks like: + +
+         // My base class for messages.
+         class Message {
+             virtual void serialize(BinaryOutput&) const;
+             virtual void deserialize(BinaryInput&);
+             virtual void process() = 0;
+         };
+
+         Message* m = table[conduit->waitingMessageType()];
+         conduit->receive(m);
+         m->process();
+     
+ + Another is to simply switch on the message type: + +
+         switch (conduit->waitingMessageType()) {
+         case 0:
+            // No message
+            break;
+
+         case ENTITY_SPAWN_MSG:
+            {
+               EntitySpawnMsg m;
+               condiut->receive(m);
+               spawnEntity(m.id, m.position, m.modelID);
+            }
+            break;
+            ...
+         }
+      
+ */ + virtual uint32 waitingMessageType() = 0; + + /** Returns true if the connection is ok. */ + bool ok() const; +}; + +typedef ReferenceCountedPointer ReliableConduitRef; + +#ifdef __GNUC__ +// Workaround for a known bug in gcc 4.x where htonl produces +// a spurrious warning. +// http://gcc.gnu.org/ml/gcc-bugs/2005-10/msg03270.html +uint32 gcchtonl(uint32); +#endif + +// Messaging and stream APIs must be supported on a single class because +// sometimes an application will switch modes on a single socket. For +// example, when transferring 3D level geometry during handshaking with +// a game server. +/** + A conduit that guarantees messages will arrive, intact and in order. + Create on the client using NetworkDevice::createReliableConduit and + on the server using NetListener::waitForConnection. Set the reference + counted pointer to NULL to disconnect. + + To construct a ReliableConduit: +
    +
  1. Create a G3D::NetworkDevice (if you are using G3D::GApp, it creates + one for you) on the client and on the server. +
  2. On the server, create a G3D::NetListener using + G3D::NetworkDevice::createListener +
  3. On the server, invoke G3D::NetListener::waitForConnection. +
  4. On the client, call G3D::NetworkDevice::createReliableConduit. + You will need the server's G3D::NetAddress. Consider using + G3D::Discovery::Client to find it via broadcasting. +
+ + */ +class ReliableConduit : public Conduit { +private: + friend class NetworkDevice; + friend class NetListener; + + enum State {RECEIVING, HOLDING, NO_MESSAGE} state; + + NetAddress addr; + + /** + Type of the incoming message. + */ + uint32 messageType; + + /** + Total size of the incoming message (read from the header). + */ + uint32 messageSize; + + /** Shared buffer for receiving messages. */ + void* receiveBuffer; + + /** Total size of the receiveBuffer. */ + size_t receiveBufferTotalSize; + + /** Size occupied by the current message... so far. This will be + equal to messageSize when the whole message has arrived. + */ + size_t receiveBufferUsedSize; + + ReliableConduit(const NetAddress& addr); + + ReliableConduit(const SOCKET& sock, + const NetAddress& addr); + + template static void serializeMessage + (uint32 t, const T& m, BinaryOutput& b) { + + b.writeUInt32(t); + + // Reserve space for the 4 byte size header + b.writeUInt32(0); + + size_t L = b.length(); + m.serialize(b); + if ((size_t)b.length() == L) { + // No data was created by serialization. + // We need to send at least one byte because receive assumes that + // a zero length message is an error. + b.writeUInt8(0xFF); + } + + uint32 len = b.size() - 8; + + // We send the length first to tell recv how much data to read. + // Here we abuse BinaryOutput a bit and write directly into + // its buffer, violating the abstraction. + // Note that we write to the second set of 4 bytes, which is + // the size field. + uint32* lenPtr = ((uint32*)b.getCArray()) + 1; + #if defined(__GNUC__) + *lenPtr = gcchtonl(len); + #else + *lenPtr = htonl(len); + #endif + } + + + void sendBuffer(const BinaryOutput& b); + + /** Accumulates whatever part of the message (not the header) is + still waiting on the socket into the receiveBuffer during + state = RECEIVING mode. Closes the socket if anything goes + wrong. When receiveBufferUsedSize == messageSize, the entire + message has arrived. */ + void receiveIntoBuffer(); + + /** Receives the messageType and messageSize from the socket. */ + void receiveHeader(); + +public: + + /** + Client invokes this to connect to a server. The call blocks until the + conduit is opened. The conduit will not be ok() if it fails. + */ + static ReliableConduitRef create(const NetAddress& address); + + /** Closes the socket. */ + ~ReliableConduit(); + + + // The message is actually copied from the socket to an internal buffer during + // this call. Receive only deserializes. + virtual bool messageWaiting(); + + /** + Serializes the message and schedules it to be sent as soon as possible, + and then returns immediately. The message can be any class with + a serialize and deserialize method. On the receiving side, + use G3D::ReliableConduit::waitingMessageType() to detect the incoming + message and then invoke G3D::ReliableConduit::receive(msg) where msg + is of the same class as the message that was sent. + + The actual data sent across the network is preceeded by the + message type and the size of the serialized message as a 32-bit + integer. The size is sent because TCP is a stream protocol and + doesn't have a concept of discrete messages. + */ + template inline void send(uint32 type, const T& message) { + binaryOutput.reset(); + serializeMessage(type, message, binaryOutput); + sendBuffer(binaryOutput); + } + + /** Sends an empty message with the given type. Useful for sending + commands that have no parameters. */ + void send(uint32 type); + + /** Send the same message to a number of conduits. Useful for sending + data from a server to many clients (only serializes once). */ + template + inline static void multisend( + const Array& array, + uint32 type, + const T& m) { + + if (array.size() > 0) { + array[0]->binaryOutput.reset(); + serializeMessage(type, m, array[0]->binaryOutput); + + for (int i = 0; i < array.size(); ++i) { + array[i]->sendBuffer(array[0]->binaryOutput); + } + } + } + + virtual uint32 waitingMessageType(); + + /** + If a message is waiting, deserializes the waiting message into + message and returns true, otherwise returns false. You can + determine the type of the message (and therefore, the class + of message) using G3D::ReliableConduit::waitingMessageType(). + */ + template inline bool receive(T& message) { + if (! messageWaiting()) { + return false; + } + + debugAssert(state == HOLDING); + // Deserialize + BinaryInput b((uint8*)receiveBuffer, receiveBufferUsedSize, G3D_LITTLE_ENDIAN, BinaryInput::NO_COPY); + message.deserialize(b); + + // Don't let anyone read this message again. We leave the buffer + // allocated for the next caller, however. + receiveBufferUsedSize = 0; + state = NO_MESSAGE; + messageType = 0; + messageSize = 0; + + // Potentially read the next message. + messageWaiting(); + + return true; + } + + /** Removes the current message from the queue. */ + inline void receive() { + if (! messageWaiting()) { + return; + } + receiveBufferUsedSize = 0; + state = NO_MESSAGE; + messageType = 0; + messageSize = 0; + + // Potentially read the next message. + messageWaiting(); + } + + NetAddress address() const; +}; + + +typedef ReferenceCountedPointer LightweightConduitRef; + +/** + Provides fast but unreliable transfer of messages. On a LAN, + LightweightConduit will probably never drop messages but you + might get your messages out of order. On an internet + connection it might drop messages altogether. Messages are never + corrupted, however. LightweightConduit requires a little less setup + and overhead than ReliableConduit. ReliableConduit guarantees + message delivery and order but requires a persistent connection. + + To set up a LightweightConduit (assuming you have already made + subclasses of G3D::NetMessage based on your application's + pcommunication protocol): + +[Server Side] +
    +
  1. Call LightweightConduit::create(port, true, false), +where port is the port on which you will receive messages. + +
  2. Poll LightweightConduit::messageWaiting from your main loop. When +it is true (or, equivalently, when LightweightConduit::waitingMessageType +is non-zero) there is an incoming message. + +
  3. To read the incoming message, call LightweightConduit::receive with +the appropriate class type, which mist have a deserialize method. +LightweightConduit::waitingMessageType tells you what class is +needed (you make up your own message constants for your program; numbers +under 1000 are reserved for G3D's internal use). + +
  4. When done, simply set the G3D::LightweightConduitRef to NULL or let +it go out of scope and the conduit cleans itself up automatically. +
+ +[Client Side] +
    +
  1. Call G3D::LightweightConduit::create(). If you will +broadcast to all servers on a LAN, set the third optional argument to +true (the default is false for no broadcast). You can also set up the +receive port as if it was a server to send and receive from a single +LightweightConduit. + +
  2. To send, call G3D::LightweightConduit::send with the target address +and a pointer to an instance of the message you want to send. + +
  3. When done, simply set the G3D::LightweightConduitRef to NULL or let +it go out of scope and the conduit cleans itself up automatically. + +
+ */ +class LightweightConduit : public Conduit { +private: + friend class NetworkDevice; + + /** + True when waitingForMessageType has read the message + from the network into messageType/messageStream. + */ + bool alreadyReadMessage; + + /** + Origin of the received message. + */ + NetAddress messageSender; + + /** + The type of the last message received. + */ + uint32 messageType; + + /** + The message received (the type has already been read off). + */ + Array messageBuffer; + + LightweightConduit(uint16 receivePort, bool enableReceive, bool enableBroadcast); + + void sendBuffer(const NetAddress& a, BinaryOutput& b); + + /** Maximum transmission unit (packet size in bytes) for this socket. + May vary between sockets. */ + int MTU; + + + template + void serializeMessage( + uint32 type, + const T& m, + BinaryOutput& b) const { + + debugAssert(type != 0); + b.writeUInt32(type); + m.serialize(b); + b.writeUInt32(1); + + debugAssertM(b.size() < MTU, + format("This LightweightConduit is limited to messages of " + "%d bytes (Ethernet hardware limit; this is the " + "'UDP MTU')", maxMessageSize())); + + if (b.size() >= MTU) { + throw LightweightConduit::PacketSizeException( + format("This LightweightConduit is limited to messages of " + "%d bytes (Ethernet hardware limit; this is the " + "'UDP MTU')", maxMessageSize()), + b.size() - 4, // Don't count the type header + maxMessageSize()); + } + } + +public: + + static LightweightConduitRef create(uint16 receivePort, bool enableReceive, bool enableBroadcast); + + class PacketSizeException { + public: + std::string message; + int serializedPacketSize; + int maxMessageSize; + + inline PacketSizeException(const std::string& m, int s, int b) : + message(m), + serializedPacketSize(s), + maxMessageSize(b) {} + }; + + /** Closes the socket. */ + ~LightweightConduit(); + + /** The maximum length of a message that can be sent + (G3D places a small header at the front of each UDP packet; + this is already taken into account by the value returned). + */ + inline int maxMessageSize() const { + return MTU - 4; + } + + + template inline void send(const NetAddress& a, uint32 type, const T& msg) { + binaryOutput.reset(); + serializeMessage(type, msg, binaryOutput); + sendBuffer(a, binaryOutput); + } + + /** Send the same message to multiple addresses (only serializes once). + Useful when server needs to send to a known list of addresses + (unlike direct UDP broadcast to all addresses on the subnet) */ + template inline void send(const Array& a, uint32 type, const T& m) { + binaryOutput.reset(); + serializeMessage(type, m, binaryOutput); + + for (int i = 0; i < a.size(); ++i) { + sendBuffer(a[i], binaryOutput); + } + } + + bool receive(NetAddress& sender); + + template inline bool receive(NetAddress& sender, T& message) { + bool r = receive(sender); + if (r) { + BinaryInput b((messageBuffer.getCArray() + 4), + messageBuffer.size() - 4, + G3D_LITTLE_ENDIAN, BinaryInput::NO_COPY); + message.deserialize(b); + } + + return r; + } + + inline bool receive() { + static NetAddress ignore; + return receive(ignore); + } + + virtual uint32 waitingMessageType(); + + + virtual bool messageWaiting(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +typedef ReferenceCountedPointer NetListenerRef; + +/** + Runs on the server listening for clients trying to make reliable connections. + */ +class NetListener : public ReferenceCountedObject { +private: + + friend class NetworkDevice; + + SOCKET sock; + + /** Port is in host byte order. */ + NetListener(uint16 port); + +public: + + static NetListenerRef create(const uint16 port); + + ~NetListener(); + + /** Block until a connection is received. Returns NULL if + something went wrong. */ + ReliableConduitRef waitForConnection(); + + /** True if a client is waiting (i.e. waitForConnection will + return immediately). */ + bool clientWaiting() const; + + bool ok() const; +}; + + +/////////////////////////////////////////////////////////////////////////////// + +/** + @brief Abstraction of network (socket) functionality. + + An abstraction over sockets that provides a message-based network + infrastructure optimized for sending many small (~500 bytes) messages. + All functions always return immediately. + + Create only one NetworkDevice per process (a WinSock restriction). + + NetworkDevice is technically not thread safe. However, as long as + you use different conduits on different threads (or lock conduits + before sending), you will encounter no problems sharing the single + NetworkDevice across multiple threads. That is, do not invoke the same + Conduit's send or receive method on two threads at once. + + This assumes that the underlying WinSock/BSD sockets implementation + is thread safe. That is not guaranteed, but in practice seems + to always be true (see + http://tangentsoft.net/wskfaq/intermediate.html#threadsafety) + +
+ + IP networks use "network byte order" (big-endian) for + communicating integers. "Host byte order" is the endian-ness of + the local machine (typically little-endian; see + System::endian). The C functions htonl() and ntohl() convert 32-bit + values between these formats. G3D only ever exposes host byte order, + so programmers rarely need to be aware of the distinction. + + */ +class NetworkDevice { +public: + + /** @brief Description of an ethernet or wireless ethernet adapter.*/ + class EthernetAdapter { + public: + /** Reverse-DNS of the ip address.*/ + std::string hostname; + + /** Name of the adapter */ + std::string name; + + /** IP address in host byte order.*/ + uint32 ip; + + /** Subnet mask in host byte order.*/ + uint32 subnet; + + /** UDP broadcast address in host byte order.*/ + uint32 broadcast; + + /** MAC (hardware) address, if known */ + uint8 mac[6]; + + EthernetAdapter(); + + /** Produces a text description of this adapter */ + void describe(TextOutput& t) const; + }; + +private: + + friend class Conduit; + friend class LightweightConduit; + friend class ReliableConduit; + friend class NetListener; + + bool initialized; + + Array m_adapterArray; + + /** Broadcast addresses available on this machine, + extracted from m_adapterArray.*/ + Array m_broadcastAddresses; + + /** Utility method. */ + void closesocket(SOCKET& sock) const; + + /** Utility method. Returns true on success.*/ + bool bind(SOCKET sock, const NetAddress& addr) const; + + /** The global instance */ + static NetworkDevice* s_instance; + + NetworkDevice(); + + bool init(); + + void _cleanup(); + + /** Called from init to update m_adapterArray and + m_broadcastAddresses. */ + void addAdapter(const EthernetAdapter& a); + +public: + + /** Prints an IP address to a string. + @param ip In host byte order.*/ + static std::string formatIP(uint32 ip); + + /** Prints a MAC address to a string. */ + static std::string formatMAC(const uint8 mac[6]); + + ~NetworkDevice(); + + /** Returns the available ethernet adapters for the current + machine that are online. Does not include the loopback adapter + for localhost.*/ + inline const Array& adapterArray() const { + return m_adapterArray; + } + + /** Returns the (unique) IP addresses for UDP broadcasting + extracted from adapterArray(). All are in host byte order. */ + inline const Array& broadcastAddressArray() const { + return m_broadcastAddresses; + } + + /** + Returns NULL if there was a problem initializing the network. + */ + static NetworkDevice* instance(); + + /** + Shuts down the network device (destroying the global instance). + */ + static void cleanup(); + + /** + Prints a human-readable description of this machine + to the text output stream. + */ + void describeSystem( + TextOutput& t); + + void describeSystem( + std::string& s); + + /** Returns the name (or one of the names) of this computer */ + std::string localHostName() const; + + /** There is often more than one address for the local host. This + returns all of them. + @deprecated Use adapterArray() + */ + void localHostAddresses(Array& array) const; +}; + + +#ifdef __GNUC__ +inline uint32 gcchtonl(uint32 x) { + // This pragma fools gcc into surpressing all error messages, + // including the bogus one that it creates for htonl +# pragma GCC system_header + return htonl(x); +} +#endif + +} // G3D namespace + +#ifndef _WIN32 +#undef SOCKADDR_IN +#undef SOCKET +#endif + +#endif diff --git a/externals/g3dlite/G3D/ParseError.h b/externals/g3dlite/G3D/ParseError.h new file mode 100644 index 0000000..f02948e --- /dev/null +++ b/externals/g3dlite/G3D/ParseError.h @@ -0,0 +1,59 @@ +/** + @file ParseError.h + + @maintainer Morgan McGuire + + @created 2009-11-15 + @edited 2009-11-15 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ +#ifndef G3D_ParseError_h +#define G3D_ParseError_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include + +namespace G3D { + +/** Thrown by TextInput, Any, and other parsers on unexpected input. */ +class ParseError { +public: + enum {UNKNOWN = -1}; + + /** Empty means unknown */ + std::string filename; + + /** For a binary file, the location of the parse error. -1 if unknown.*/ + int64 byte; + + /** For a text file, the line number is the line number of start of token which caused the exception. 1 is + the first line of the file. -1 means unknown. Note that you can use + TextInput::Settings::startingLineNumberOffset to shift the effective line + number that is reported by that class. + */ + int line; + + /** Character number (in the line) of the start of the token which caused the + exception. 1 is the character in the line. May be -1 if unknown. + */ + int character; + + std::string message; + + ParseError() : byte(UNKNOWN), line(UNKNOWN), character(UNKNOWN) {} + + virtual ~ParseError() {} + + ParseError(const std::string& f, int l, int c, const std::string& m) : + filename (f), byte(UNKNOWN), line(l), character(c), message(m) {} + + ParseError(const std::string& f, int64 b, const std::string& m) : + filename (f), byte(b), line(UNKNOWN), character(UNKNOWN), message(m) {} +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/PhysicsFrame.h b/externals/g3dlite/G3D/PhysicsFrame.h new file mode 100644 index 0000000..a5a9305 --- /dev/null +++ b/externals/g3dlite/G3D/PhysicsFrame.h @@ -0,0 +1,74 @@ +/** + @file PhysicsFrame.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-07-08 + @edited 2006-01-10 +*/ + +#ifndef G3D_PHYSICSFRAME_H +#define G3D_PHYSICSFRAME_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Matrix3.h" +#include "G3D/Quat.h" +#include "G3D/CoordinateFrame.h" +#include +#include + + +namespace G3D { + +/** + An RT transformation using a quaternion; suitable for + physics integration. + + This interface is in "Beta" and will change in the next release. + */ +class PhysicsFrame { +public: + + Quat rotation; + + /** + Takes object space points to world space. + */ + Vector3 translation; + + /** + Initializes to the identity frame. + */ + PhysicsFrame(); + + /** + Purely translational force + */ + PhysicsFrame(const Vector3& translation) : translation(translation) {} + + PhysicsFrame(const CoordinateFrame& coordinateFrame); + + /** Compose: create the transformation that is other followed by this.*/ + PhysicsFrame operator*(const PhysicsFrame& other) const; + + virtual ~PhysicsFrame() {} + + CoordinateFrame toCoordinateFrame() const; + + /** + Linear interpolation (spherical linear for the rotations). + */ + PhysicsFrame lerp( + const PhysicsFrame& other, + float alpha) const; + + void deserialize(class BinaryInput& b); + + void serialize(class BinaryOutput& b) const; + +}; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/Plane.h b/externals/g3dlite/G3D/Plane.h new file mode 100644 index 0000000..360bcd2 --- /dev/null +++ b/externals/g3dlite/G3D/Plane.h @@ -0,0 +1,161 @@ +/** + @file Plane.h + + Plane class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2004-07-18 +*/ + +#ifndef G3D_PLANE_H +#define G3D_PLANE_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/debugAssert.h" + +namespace G3D { + +/** + An infinite 2D plane in 3D space. + */ +class Plane { +private: + + /** normal.Dot(x,y,z) = distance */ + Vector3 _normal; + float _distance; + + /** + Assumes the normal has unit length. + */ + Plane(const Vector3& n, float d) : _normal(n), _distance(d) { + } + +public: + + Plane() : _normal(Vector3::unitY()), _distance(0) { + } + + /** + Constructs a plane from three points. + */ + Plane( + const Vector3& point0, + const Vector3& point1, + const Vector3& point2); + + /** + Constructs a plane from three points, where at most two are + at infinity (w = 0, not xyz = inf). + */ + Plane( + Vector4 point0, + Vector4 point1, + Vector4 point2); + + /** + The normal will be unitized. + */ + Plane( + const Vector3& __normal, + const Vector3& point); + + static Plane fromEquation(float a, float b, float c, float d); + + Plane(class BinaryInput& b); + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + virtual ~Plane() {} + + /** + Returns true if point is on the side the normal points to or + is in the plane. + */ + inline bool halfSpaceContains(Vector3 point) const { + // Clamp to a finite range for testing + point = point.clamp(Vector3::minFinite(), Vector3::maxFinite()); + + // We can get away with putting values *at* the limits of the float32 range into + // a dot product, since the dot product is carried out on float64. + return _normal.dot(point) >= _distance; + } + + /** + Returns true if point is on the side the normal points to or + is in the plane. + */ + inline bool halfSpaceContains(const Vector4& point) const { + if (point.w == 0) { + return _normal.dot(point.xyz()) > 0; + } else { + return halfSpaceContains(point.xyz() / point.w); + } + } + + /** + Returns true if point is on the side the normal points to or + is in the plane. Only call on finite points. Faster than halfSpaceContains. + */ + inline bool halfSpaceContainsFinite(const Vector3& point) const { + debugAssert(point.isFinite()); + return _normal.dot(point) >= _distance; + } + + /** + Returns true if the point is nearly in the plane. + */ + inline bool fuzzyContains(const Vector3 &point) const { + return fuzzyEq(point.dot(_normal), _distance); + } + + inline const Vector3& normal() const { + return _normal; + } + + /** + Returns distance from point to plane. Distance is negative if point is behind (not in plane in direction opposite normal) the plane. + */ + inline float distance(const Vector3& x) const { + return (_normal.dot(x) - _distance); + } + + inline Vector3 closestPoint(const Vector3& x) const { + return x + (_normal * (-distance(x))); + } + + /** Returns normal * distance from origin */ + Vector3 center() const { + return _normal * _distance; + } + + /** + Inverts the facing direction of the plane so the new normal + is the inverse of the old normal. + */ + void flip(); + + /** + Returns the equation in the form: + + normal.Dot(Vector3(x, y, z)) + d = 0 + */ + void getEquation(Vector3 &normal, double& d) const; + void getEquation(Vector3 &normal, float& d) const; + + /** + ax + by + cz + d = 0 + */ + void getEquation(double& a, double& b, double& c, double& d) const; + void getEquation(float& a, float& b, float& c, float& d) const; + + std::string toString() const; +}; + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/PointHashGrid.h b/externals/g3dlite/G3D/PointHashGrid.h new file mode 100644 index 0000000..0db9e67 --- /dev/null +++ b/externals/g3dlite/G3D/PointHashGrid.h @@ -0,0 +1,917 @@ +/** + @file PointHashGrid.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2008-07-01 + @edited 2009-05-28 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. +*/ +#ifndef G3D_PointHashGrid_h +#define G3D_PointHashGrid_h + +#include "G3D/platform.h" +#include "G3D/EqualsTrait.h" +#include "G3D/HashTrait.h" +#include "G3D/Vector3.h" +#include "G3D/Vector3int32.h" +#include "G3D/Array.h" +#include "G3D/Table.h" +#include "G3D/AABox.h" +#include "G3D/Sphere.h" +#include "G3D/SmallArray.h" + +namespace G3D { + +/** + Storage of data in a sparse 3D grid of point-based data. The + space cost for n elements is O(n). For data with + approximately uniform density (with respect to the radius hint), + the time cost of searching for neighbors is O(1). + + Value must be supported by a G3D::PositionTrait, + G3D::EqualsTrait, and G3D::HashFunc. overrides are provided for + common G3D classes like G3D::Vector3. +*/ +template, + class EqualsFunc = EqualsTrait, + class HashFunc = HashTrait > +class PointHashGrid { +private: + +#define ThisType PointHashGrid + + /** A value annotated with precomputed position and hash code.*/ + class Entry { + public: + Vector3 position; + Value value; + }; + + /** One cell of the grid. */ + typedef Array Cell; + typedef Table CellTable; + + /** The cube of +/-1 along each dimension. Initialized by initOffsetArray.*/ + Vector3int32 m_offsetArray[3*3*3]; + + /** Incremented every time the data structure is mutated. + Used by the iterators to determine if the data structure + has changed since iteration began. */ + int m_epoch; + + /** Extent of a cell along one dimension. */ + float m_cellWidth; + + /** 1.0 / cell width */ + float m_invCellWidth; + + /** Conservative bounds; the actual data may be smaller. */ + AABox m_bounds; + + /** Number of elements. */ + int m_size; + + /** Non-empty cells indexed by grid position. Actual 3D position is + position * m_cellWidth*/ + CellTable m_data; + + MemoryManager::Ref m_memoryManager; + + /** Intentionally unimplemented: prevent copy construction. */ + PointHashGrid(const ThisType&); + + + /** Intentionally unimplemented: prevent assignment. */ + PointHashGrid& operator=(const ThisType&); + + + /** Locate the cell and index within that cell containing v. Called by + remove() and contains(). */ + bool find(const Value& v, + Vector3int32& foundCellCoord, + Cell*& foundCell, + int& index) { + + Vector3 pos; + PosFunc::getPosition(v, pos); + + Vector3int32 cellCoord; + getCellCoord(pos, cellCoord); + for (int i = 0; i < 27; ++i) { + Vector3int32 c = cellCoord + m_offsetArray[i]; + Cell* cell = m_data.getPointer(c); + if (cell != NULL) { + // The cell exists + for (int j = 0; j < cell->size(); ++j) { + if (EqualsFunc::equals((*cell)[j].value, v)) { + foundCell = cell; + index = j; + foundCellCoord = c; + return true; + } + } + } + } + + // Not found + return false; + } + + /** Given a real-space position, returns the cell coord + containing it.*/ + inline void getCellCoord(const Vector3& pos, Vector3int32& cellCoord) const { + for (int a = 0; a < 3; ++a) { + cellCoord[a] = iFloor(pos[a] * m_invCellWidth); + } + } + + /** Initializes m_offsetArray. */ + void initOffsetArray() { + int i = 0; + Vector3int32 d; + for (d.x = -1; d.x <= +1; ++d.x) { + for (d.y = -1; d.y <= +1; ++d.y) { + for (d.z = -1; d.z <= +1; ++d.z) { + m_offsetArray[i] = d; + ++i; + } + } + } + + // Put (0, 0, 0) first, so that contains() is most likely to find + // the value quickly. + i = (1 * 3 + 1) * 3 + 1; + debugAssert(m_offsetArray[i] == Vector3int32(0,0,0)); + Vector3int32 temp = m_offsetArray[0]; + m_offsetArray[0] = m_offsetArray[i]; + m_offsetArray[i] = temp; + } + +public: + + /** + @param radiusHint the radius that will typically be used with + beginSphereIntersection and beginBoxIntersection. If two Values are equal, + their positions must be within this radius as well. + */ + PointHashGrid(float radiusHint, const MemoryManager::Ref& m = MemoryManager::create()) : m_size(0), m_memoryManager(m) { + initOffsetArray(); + m_data.clearAndSetMemoryManager(m_memoryManager); + + debugAssertM(radiusHint > 0, "Cell radius must be positive"); + m_cellWidth = radiusHint; + m_invCellWidth = 1.0f / m_cellWidth; + } + + /** + If radiusHint is negative, it is automatically chosen to put + about 5 values in each grid cell (which means about 27 * 5 + values for each beginIntersection call). + */ + PointHashGrid(const Array& init, float radiusHint = -1.0f, const MemoryManager::Ref& m = MemoryManager::create()) : m_size(0), m_memoryManager(m) { + initOffsetArray(); + m_data.clearAndSetMemoryManager(m_memoryManager); + + Vector3 lo(Vector3::inf()); + Vector3 hi(-lo); + + // Compute bounds + Array entry(init.size()); + for (int i = 0; i < entry.size(); ++i) { + const Value& value = init[i]; + Vector3 pos = m_posFunc(value); + + entry[i].value = value; + entry[i].hashCode = m_hashFunc(value); + entry[i].position = pos; + + lo = lo.min(pos); + hi = hi.max(pos); + } + + m_bounds = AABox(lo, hi); + + if (radiusHint <= 0) { + // Compute a good cell width based on the bounds. + // + // N numPerCell + // ----- = --------- + // volume r^3 + + float numPerCell = 5; + radiusHint = + (float)pow(numPerCell * m_bounds.volume() / init.size(), 1.0 / 3.0); + + if (radiusHint == 0) { + // Volume must have been zero because all points were colocated. + radiusHint = 0.1f; + } + } + + insert(init); + } + + /** Returns the number of elements. */ + inline int size() const { + return m_size; + } + + /** Returns a conservative bounding box around the contents. This is + conservative because it is not updated when elements are removed. */ + const AABox& conservativeBoxBounds() const { + return m_bounds; + } + + /** Insert @a v at position @a p given by getPosition(v, p). + Multiple elements that are equal may be inserted; all copies will be + in the data structure. */ + void insert(const Value& v) { + Vector3 pos; + PosFunc::getPosition(v, pos); + Vector3int32 cellCoord; + getCellCoord(pos, cellCoord); + + // See if the cell already exists + Cell& cell = m_data.getCreate(cellCoord); + + if (cell.size() == 0) { + // Use the same memory manager as for the whole class + cell.clearAndSetMemoryManager(m_memoryManager); + } + + Entry& entry = cell.next(); + entry.value = v; + entry.position = pos; + + // Update the bounds + if (size() == 0) { + m_bounds = AABox(pos); + } else { + m_bounds.merge(pos); + } + + ++m_size; + ++m_epoch; + } + + + /** Inserts all elements of the array. */ + void insert(const Array& v) { + for (int i = 0; i < v.size(); ++i) { + insert(v[i]); + } + } + + + /** If there are multiple copies of an element, you must + delete them multiple times. + + @param shrinkIfNecessary If true, deallocate underlying data + structures as they are emptied. False increases performace at + the cost of memory overhead for dynamic structures. + + @return true if the element was found. + */ + bool remove(const Value& v, bool shrinkIfNecessary = true) { + Cell* cell = NULL; + int index = 0; + Vector3int32 cellCoord; + + if (find(v, cellCoord, cell, index)) { + cell->fastRemove(index, shrinkIfNecessary); + --m_size; + ++m_epoch; + + if ((cell->size() == 0) && shrinkIfNecessary) { + // Remove the cell itself + + // Drop our pointer, which is about to dangle + cell = NULL; + bool success = m_data.remove(cellCoord); + debugAssertM(success, "Data structure corrupt: " + "tried to remove a cell that doesn't exist."); + } + + return true; + + } else { + return false; + } + } + + /** Removes all elements of @v. */ + void remove(const Array& v, bool shrink = true) { + for (int i = 0; i < v.size(); ++i) { + remove(v[i], shrink); + } + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + class Iterator { + private: + friend class ThisType; + + bool m_isEnd; + + const ThisType* m_grid; + + typename CellTable::Iterator m_tableIterator; + + /** Index within m_tableIterator->value of the current value. */ + int m_arrayIndex; + + const int m_epoch; + + /** End iterator. Note that the m_tableIterator is initialized to the end iterator + of a temporary value! This is ok because we'll never look at the value of the + m_tableIterator, since we're initializing the "end" Iterator.*/ + Iterator() : m_isEnd(true), m_grid(NULL), m_tableIterator(CellTable().end()), + m_arrayIndex(0), m_epoch(0) {} + + Iterator(const ThisType* grid) : + m_isEnd(false), + m_grid(grid), + m_tableIterator( grid->m_data.begin() ), + m_arrayIndex(0), + m_epoch(grid->m_epoch) { } + + private: + + const Value& value() const { + debugAssert(! m_isEnd); + debugAssertM(m_tableIterator->value.size() > m_arrayIndex, + "No more elements"); + return m_tableIterator->value[m_arrayIndex].value; + } + + public: + + inline bool operator!=(const Iterator& other) const { + if (other.m_isEnd && m_isEnd) { + return false; + } else { + return (m_isEnd != other.m_isEnd) || + (m_tableIterator != other.m_tableIterator) || + (m_arrayIndex != other.m_arrayIndex); + } + } + + bool operator==(const Iterator& other) const { + return !(*this != other); + } + + /** Preincrement */ + Iterator& operator++() { + debugAssert(! m_isEnd); + debugAssertM(m_epoch == m_grid->m_epoch, + "It is illegal to mutate the HashGrid " + "while iterating through it."); + + ++m_arrayIndex; + + if (m_arrayIndex >= m_tableIterator->value.size()) { + // Move on to the next cell + ++m_tableIterator; + m_arrayIndex = 0; + + // Check to see if we're at the end + m_isEnd = (m_tableIterator == m_grid->m_data.end()); + } + + return *this; + } + + /** Post increment (slower) */ + Iterator operator++(int) { + debugAssert(! m_isEnd); + Iterator old = *this; + ++(*this); + return old; + } + + const Value& operator*() const { return value(); } + const Value* operator->() const { return &value(); } + operator Value*() const { return &value(); } + }; // Iterator + + + /** Iterate through all members. It is an error to mutate the HashGrid + while iterating through it. Each member can be accessed by "dereferencing" + the iterator: + +
+        for (Grid::Iterator i = grid.begin(); i != grid.end(), ++i) {
+        const Value& = *i;
+        ...
+        }
+        
+ */ + Iterator begin() const { + return Iterator(this); + } + + const Iterator& end() const { + static const Iterator it; + return it; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + // Forward declaration required by older gcc versions for friend declaration in BoxIterator + class SphereIterator; + class BoxIterator { + private: + friend class ThisType; + friend class SphereIterator; + + bool m_isEnd; + + const ThisType* m_grid; + + /** Lower bound on the boxes covered, inclusive. */ + Vector3int32 m_lo; + + /** Upper bound on the boxes covered, inclusive.*/ + Vector3int32 m_hi; + + /** If true, test values against m_box before returning them.*/ + bool m_exact; + + /** The underlying box in 3D space */ + AABox m_box; + + /** The iterator winds through the 3D grid between m_lo and (m_lo + m_extent) in + Z,Y,X-major order. This is the index keeping track of how + far it has come */ + Vector3int32 m_current; + + /** The current cell. */ + Cell* m_cell; + + /** Index within m_cell of the current value */ + int m_arrayIndex; + + const int m_epoch; + + + /** Called from advance() */ + void advanceCell() { + do { + ++m_current.x; + if (m_current.x > m_hi.x) { + m_current.x = m_lo.x; + ++m_current.y; + if (m_current.y > m_hi.y) { + m_current.y = m_lo.y; + ++m_current.z; + if (m_current.z > m_hi.z) { + m_isEnd = true; + return; + } + } + } + + // Pick up the new cell + m_cell = m_grid->m_data.getPointer(m_current); + // Keep advancing if the cell does not exist + } while ((m_cell == NULL) || (m_cell->size() == 0)); + } + + /** Advance to the next value */ + void advance() { + debugAssert(! m_isEnd); + + do { + ++m_arrayIndex; + bool inConstructor = (m_cell == NULL); + if (inConstructor || m_arrayIndex >= m_cell->size()) { + advanceCell(); + m_arrayIndex = 0; + + if (m_isEnd) { + // Ran out of values + return; + } + debugAssert(m_cell != NULL); + } + + // Advance until we have a value that can be returned, either + // because we don't care about exactness or because it is + // guaranteed to be within the box. + } while (m_exact && ! m_box.contains(position())); + } + + + /** End iterator */ + BoxIterator() : m_isEnd(true), m_grid(NULL), m_exact(true), m_current(0,0,0), m_cell(NULL), m_arrayIndex(0), m_epoch(0) {} + + /** Begin iterator */ + BoxIterator(const ThisType* grid, bool exact, const AABox& box) : + m_isEnd(false), + m_grid(grid), + m_exact(exact), + m_box(box), + m_current(-1, 0 ,0), + m_cell(NULL), + m_arrayIndex(0), + m_epoch(grid->m_epoch) { + + m_grid->getCellCoord(box.low(), m_lo); + m_grid->getCellCoord(box.high(), m_hi); + + // Get to the first value + m_current = m_lo; + // Back up one so that advancing takes us to the first + --m_current.x; + advance(); + } + + const Value& value() const { + debugAssert(! m_isEnd); + return (*m_cell)[m_arrayIndex].value; + } + + /** Used by SphereIterator::advance() */ + const Vector3& position() const { + debugAssert(! m_isEnd); + return (*m_cell)[m_arrayIndex].position; + } + + // Intentionally unimplemented + BoxIterator& operator=(const BoxIterator&); + + public: + + inline bool operator!=(const BoxIterator& other) const { + if (other.m_isEnd && m_isEnd) { + return false; + } else { + return (m_isEnd != other.m_isEnd) || + (m_cell != other.m_cell) || + (m_arrayIndex != other.m_arrayIndex); + } + } + + bool operator==(const BoxIterator& other) const { + return !(*this != other); + } + + /** Preincrement */ + BoxIterator& operator++() { + debugAssert(! m_isEnd); + debugAssertM(m_epoch == m_grid->m_epoch, + "It is illegal to mutate the HashGrid " + "while iterating through it."); + + advance(); + + return *this; + } + + /** Post increment (slower) */ + BoxIterator operator++(int) { + Iterator old = *this; + ++(*this); + return old; + } + + const Value& operator*() const { return value(); } + const Value* operator->() const { return &value(); } + operator Value*() const { return &value(); } + + bool hasMore() const { + return ! m_isEnd; + } + }; // BoxIterator + + /** + Finds all values whose positions are within @a box. It is an error to + mutate the PointHashGrid while iterating through it. + + @param exact If false, the iterator will execute more quickly but will likely return some + values that lie outside the box. Set exact = false if you are going to test the + results against the yourself box anyway. + */ + BoxIterator beginBoxIntersection(const AABox& box, bool exact = true) const { + return BoxIterator(this, exact, box); + } + + const BoxIterator& endBoxIntersection() const { + static const BoxIterator it; + return it; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + class SphereIterator { + private: + + friend class ThisType; + + bool m_isEnd; + Sphere m_sphere; + BoxIterator m_boxIterator; + + SphereIterator() : m_isEnd(true) {} + + void advance() { + if (! m_boxIterator.hasMore()) { + m_isEnd = true; + return; + } + + while (! m_sphere.contains(m_boxIterator.position())) { + ++m_boxIterator; + + if (! m_boxIterator.hasMore()) { + m_isEnd = true; + return; + } + } + } + + static AABox getBoundingBox(const Sphere& s) { + AABox box; + s.getBounds(box); + return box; + } + + SphereIterator(const ThisType* grid, const Sphere& sphere) : + m_isEnd(false), + m_sphere(sphere), + m_boxIterator(grid, false, getBoundingBox(sphere)) { + + // Find the first element that is actually in the sphere, + // not just the box. + advance(); + } + + const Value& value() const { + return *m_boxIterator; + } + + // TODO: if the sphere is very big compared to radius, check each + // cell's box to see if the cell itself is actually inside the sphere + // before iterating through it, since there may be many boxes outside the sphere. + + // Intentionally unimplemented + SphereIterator& operator=(const SphereIterator&); + public: + + inline bool operator!=(const SphereIterator& other) const { + if (other.m_isEnd && m_isEnd) { + return false; + } else { + return + (m_isEnd != other.m_isEnd) || + (m_sphere != other.m_sphere) || + (m_boxIterator != other.m_boxIterator); + } + } + + bool operator==(const SphereIterator& other) const { + return !(*this != other); + } + + + + /** Preincrement */ + SphereIterator& operator++() { + debugAssert(! m_isEnd); + + ++m_boxIterator; + advance(); + + return *this; + } + + /** Post increment (slower) */ + SphereIterator operator++(int) { + Iterator old = *this; + ++(*this); + return old; + } + + const Value& operator*() const { return value(); } + const Value* operator->() const { return &value(); } + operator Value*() const { return &value(); } + + bool hasMore() const { + return ! m_isEnd; + } + }; // SphereIterator + + /** + Finds all values whose positions are within @a sphere. It is an error + to mutate the HashGrid while iterating through it. + */ + SphereIterator beginSphereIntersection(const Sphere& sphere) const { + return SphereIterator(this, sphere); + } + + const SphereIterator& endSphereIntersection() const { + static const SphereIterator it; + return it; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + /** + Dereference to access the bounds() and size() [element count] of the underlying + cell objet. + + Example: +
+       for(PointHashGrid::CellIterator iter = grid.beginCells(); iter != grid.endCells(); ++iter) {	
+       entriesFound += iter->size();
+       }
+       
+ */ + class CellIterator { + private: + friend class ThisType; + + bool m_isEnd; + const ThisType* m_grid; + typename CellTable::Iterator m_tableIterator; + const int m_epoch; + + + Cell& cell() { + return m_tableIterator->value; + } + + public: + + class CellObject { + friend class CellIterator; + private: + const CellIterator* m_parent; + + CellObject() : m_parent(NULL) {} + + public: + + /** Returns the bounds on this cell */ + AABox bounds() const { + const Vector3int32& k = m_parent->m_tableIterator->key; + return AABox(Vector3(k) * m_parent->m_cellWidth, + Vector3(k + Vector3int32(1, 1, 1)) * m_parent->m_cellWidth); + } + + /** Number of elements inside this cell */ + int size() const { + debugAssert(! m_parent->m_isEnd); + return m_parent->m_tableIterator->value.size(); + } + }; + + private: + /** Used to make the indirection work.*/ + CellObject m_indirection; + + /** End iterator. Note that the m_tableIterator is initialized to the end iterator + of a temporary value! This is ok because we'll never look at the value of the + m_tableIterator, since we're initializing the "end" Iterator.*/ + CellIterator() : + m_isEnd(true), + m_grid(NULL), + m_tableIterator( CellTable().end() ), + m_epoch(0) {} + + CellIterator(const ThisType* grid) : + m_isEnd(false), + m_grid(grid), + m_tableIterator( grid->m_data.begin()), + m_epoch(grid->m_epoch) { + m_indirection.m_parent = this; + m_isEnd = ! m_tableIterator.hasMore(); + } + + // Intentionally unimplemented + CellIterator& operator=(const CellIterator&); + + public: + + const CellObject& operator*() const { return m_indirection; } + const CellObject* operator->() const { return &m_indirection; } + operator CellObject*() const { return &m_indirection; } + + inline bool operator!=(const CellIterator& other) const { + // != is called more often than == during iteration + return !( + (m_isEnd && other.m_isEnd) || + ((m_isEnd == other.m_isEnd) && + (m_tableIterator != other.m_tableIterator))); + } + + bool operator==(const CellIterator& other) const { + return !(*this != other); + } + + /** Preincrement */ + CellIterator& operator++() { + debugAssertM(m_epoch == m_grid->m_epoch, + "It is illegal to mutate the HashGrid while " + "iterating through it."); + ++m_tableIterator; + m_isEnd = ! m_tableIterator.hasMore(); + return *this; + } + + /** Post increment (slower) */ + CellIterator operator++(int) { + Iterator old = *this; + ++(*this); + return old; + } + + bool hasMore() const { + return ! m_isEnd; + } + }; // CellIterator + + /** Iterates through the non-empty cells. This is intended primarily for + debugging and visualizing the data structure.*/ + CellIterator beginCells() const { + return CellIterator(this); + } + + const CellIterator& endCells() const { + static const CellIterator it; + return it; + } + + /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// + + /** Returns true if there is a value that is exactly equal to @a v. This will + check all neighboring cells to avoid roundoff error at cell boundaries. + */ + bool contains(const Value& v) const { + Cell* cell = NULL; + int index = 0; + Vector3int32 cellCoord; + return const_cast(this)->find(v, cellCoord, cell, index); + } + + /** Calls delete on all of the values, which are assumed to be pointers. + This is a helper to avoid requiring you to iterate through the data + structure, removing and deleting each one. Clears the PointHashGrid at the + end. + + Using objects (instead of pointers) or reference counted pointers is + recommended over using pointers and this deleteAll method.*/ + void deleteAll() { + for (Iterator it = begin(); it.hasMore(); ++it) { + delete *it; + } + clear(); + } + + void clearAndSetMemoryManager(const MemoryManager::Ref& m) { + ++m_epoch; + m_size = 0; + m_bounds = AABox(); + + m_data.clearAndSetMemoryManager(m); + m_memoryManager = m; + } + + /** Removes all data. + @param shrink If true, underlying structures are deallocated as + they are freed.*/ + void clear(bool shrink = true) { + m_size = 0; + m_bounds = AABox(); + if (! shrink) { + // Remove all data + for (CellIterator it = beginCells(); it.hasMore(); ++it) { + it.cell().clear(true); + } + } else { + m_data.clear(); + } + ++m_epoch; + } + + int debugGetDeepestBucketSize() const { + return m_data.debugGetDeepestBucketSize(); + } + + float debugGetAverageBucketSize() const { + return m_data.debugGetAverageBucketSize(); + } +#undef ThisType +}; + +} // G3D +#endif diff --git a/externals/g3dlite/G3D/PointKDTree.h b/externals/g3dlite/G3D/PointKDTree.h new file mode 100644 index 0000000..151cbd5 --- /dev/null +++ b/externals/g3dlite/G3D/PointKDTree.h @@ -0,0 +1,1185 @@ +/** + @file PointKDTree.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2004-01-11 + @edited 2008-11-02 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + + */ + +#ifndef X_PointKDTree_H +#define X_PointKDTree_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Table.h" +#include "G3D/Vector2.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/AABox.h" +#include "G3D/Sphere.h" +#include "G3D/Box.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/CollisionDetection.h" +#include "G3D/GCamera.h" +#include "G3D/PositionTrait.h" +#include + +namespace G3D { + +/** + A set data structure that supports spatial queries using an axis-aligned + BSP tree for speed. + + PointKDTree allows you to quickly find points in 3D that lie within + a box or sphere. For large sets of objects it is much faster + than testing each object for a collision. See also G3D::KDTree; this class + is optimized for point sets, e.g.,for use in photon mapping and mesh processing. + + Template Parameters + +
+ +
The template parameter T must be one for which + the following functions are overloaded: + +
+      T::T(); (public constructor of no arguments)
+
+       template<> struct PositionTrait {
+         static void getPosition(const T& v, G3D::Vector3& p);};
+
+       template <> struct HashTrait {
+         static size_t hashCode(const T& key);};
+
+       template<> struct EqualsTrait {
+           static bool equals(const T& a, const T& b); };
+    
+ +

+ + G3D provides these for the Vector2, Vector3, and Vector4 classes. + If you use a custom class, or a pointer to a custom class, you will need + to define those functions. + + Moving %Set Members +

It is important that objects do not move without updating the + PointKDTree. If the position of an object is about + to change, PointKDTree::remove it before they change and + PointKDTree::insert it again afterward. For objects + where the hashCode and == operator are invariant with respect + to the 3D position, + you can use the PointKDTree::update method as a shortcut to + insert/remove an object in one step after it has moved. + + + Note: Do not mutate any value once it has been inserted into PointKDTree. Values + are copied interally. All PointKDTree iterators convert to pointers to constant + values to reinforce this. + + If you want to mutate the objects you intend to store in a PointKDTree + simply insert pointers to your objects instead of the objects + themselves, and ensure that the above operations are defined. (And + actually, because values are copied, if your values are large you may + want to insert pointers anyway, to save space and make the balance + operation faster.) + + Dimensions + Although designed as a 3D-data structure, you can use the PointKDTree + for data distributed along 2 or 1 axes by simply returning bounds + that are always zero along one or more dimensions. + +*/ +template, + class HashFunc = HashTrait, + class EqualsFunc = EqualsTrait > +class PointKDTree { +protected: +#define TreeType PointKDTree + + // Unlike the KDTree, the PointKDTree assumes that T elements are + // small and keeps the handle and cached position together instead of + // placing them in separate bounds arrays. Also note that a copy of T + // is kept in the member table and that there is no indirection. + class Handle { + private: + Vector3 m_position; + + public: + T value; + + inline Handle() {} + inline Handle(const T& v) : value(v) { + PositionFunc::getPosition(v, m_position); + } + + /** Used by makeNode to create fake handles for partitioning. */ + void setPosition(const Vector3& v) { + m_position = v; + } + + inline const Vector3& position() const { + return m_position; + } + }; + + /** Returns the bounds of the sub array. Used by makeNode. */ + static AABox computeBounds( + const Array& point) { + + if (point.size() == 0) { + return AABox(Vector3::inf(), Vector3::inf()); + } + + AABox bounds(point[0].position()); + + for (int p = 0; p < point.size(); ++p) { + bounds.merge(point[p].position()); + } + + return bounds; + } + + class Node { + public: + + /** Spatial bounds on all values at this node and its children, based purely on + the parent's splitting planes. May be infinite */ + AABox splitBounds; + + Vector3::Axis splitAxis; + + /** Location along the specified axis */ + float splitLocation; + + /** child[0] contains all values strictly + smaller than splitLocation along splitAxis. + + child[1] contains all values strictly + larger. + + Both may be NULL if there are not enough + values to bother recursing. + */ + Node* child[2]; + + /** Values if this is a leaf node). */ + Array valueArray; + + /** Creates node with NULL children */ + Node() { + splitAxis = Vector3::X_AXIS; + splitLocation = 0; + splitBounds = AABox(-Vector3::inf(), Vector3::inf()); + for (int i = 0; i < 2; ++i) { + child[i] = NULL; + } + } + + /** + Doesn't clone children. + */ + Node(const Node& other) : valueArray(other.valueArray) { + splitAxis = other.splitAxis; + splitLocation = other.splitLocation; + splitBounds = other.splitBounds; + for (int i = 0; i < 2; ++i) { + child[i] = NULL; + } + } + + /** Copies the specified subarray of pt into point, NULLs the children. + Assumes a second pass will set splitBounds. */ + Node(const Array& pt) { + splitAxis = Vector3::X_AXIS; + splitLocation = 0; + for (int i = 0; i < 2; ++i) { + child[i] = NULL; + } + valueArray = pt; + } + + + /** Deletes the children (but not the values) */ + ~Node() { + for (int i = 0; i < 2; ++i) { + delete child[i]; + } + } + + + /** Returns true if this node is a leaf (no children) */ + inline bool isLeaf() const { + return (child[0] == NULL) && (child[1] == NULL); + } + + + /** + Recursively appends all handles and children's handles + to the array. + */ + void getHandles(Array& handleArray) const { + handleArray.append(valueArray); + for (int i = 0; i < 2; ++i) { + if (child[i] != NULL) { + child[i]->getHandles(handleArray); + } + } + } + + + void verifyNode(const Vector3& lo, const Vector3& hi) { + // debugPrintf("Verifying: split %d @ %f [%f, %f, %f], [%f, %f, %f]\n", + // splitAxis, splitLocation, lo.x, lo.y, lo.z, hi.x, hi.y, hi.z); + + debugAssert(lo == splitBounds.low()); + debugAssert(hi == splitBounds.high()); + + for (int i = 0; i < valueArray.length(); ++i) { + const Vector3& b = valueArray[i].position(); + debugAssert(splitBounds.contains(b)); + } + + if (child[0] || child[1]) { + debugAssert(lo[splitAxis] < splitLocation); + debugAssert(hi[splitAxis] > splitLocation); + } + + Vector3 newLo = lo; + newLo[splitAxis] = splitLocation; + Vector3 newHi = hi; + newHi[splitAxis] = splitLocation; + + if (child[0] != NULL) { + child[0]->verifyNode(lo, newHi); + } + + if (child[1] != NULL) { + child[1]->verifyNode(newLo, hi); + } + } + + + /** + Stores the locations of the splitting planes (the structure but not the content) + so that the tree can be quickly rebuilt from a previous configuration without + calling balance. + */ + static void serializeStructure(const Node* n, BinaryOutput& bo) { + if (n == NULL) { + bo.writeUInt8(0); + } else { + bo.writeUInt8(1); + n->splitBounds.serialize(bo); + serialize(n->splitAxis, bo); + bo.writeFloat32(n->splitLocation); + for (int c = 0; c < 2; ++c) { + serializeStructure(n->child[c], bo); + } + } + } + + /** Clears the member table */ + static Node* deserializeStructure(BinaryInput& bi) { + if (bi.readUInt8() == 0) { + return NULL; + } else { + Node* n = new Node(); + n->splitBounds.deserialize(bi); + deserialize(n->splitAxis, bi); + n->splitLocation = bi.readFloat32(); + for (int c = 0; c < 2; ++c) { + n->child[c] = deserializeStructure(bi); + } + } + } + + /** Returns the deepest node that completely contains bounds. */ + Node* findDeepestContainingNode(const Vector3& point) { + + // See which side of the splitting plane the bounds are on + if (point[splitAxis] < splitLocation) { + // Point is on the low side. Recurse into the child + // if it exists. + if (child[0] != NULL) { + return child[0]->findDeepestContainingNode(point); + } + } else if (point[splitAxis] > splitLocation) { + // Point is on the high side, recurse into the child + // if it exists. + if (child[1] != NULL) { + return child[1]->findDeepestContainingNode(point); + } + } + + // There was no containing child, so this node is the + // deepest containing node. + return this; + } + + /** Appends all members that intersect the box. + If useSphere is true, members are tested against the sphere instead. */ + void getIntersectingMembers( + const AABox& sphereBounds, + const Sphere& sphere, + Array& members) const { + + // Test all values at this node. Extract the + // underlying C array for speed + const int N = valueArray.size(); + const Handle* handleArray = valueArray.getCArray(); + + const float r2 = square(sphere.radius); + + // Copy the sphere center so that it is on the stack near the radius + const Vector3 center = sphere.center; + for (int v = 0; v < N; ++v) { + if ((center - handleArray[v].position()).squaredLength() <= r2) { + members.append(handleArray[v].value); + } + } + + // If the left child overlaps the box, recurse into it + if (child[0] && (sphereBounds.low()[splitAxis] < splitLocation)) { + child[0]->getIntersectingMembers(sphereBounds, sphere, members); + } + + // If the right child overlaps the box, recurse into it + if (child[1] && (sphereBounds.high()[splitAxis] > splitLocation)) { + child[1]->getIntersectingMembers(sphereBounds, sphere, members); + } + } + + /** Appends all members that intersect the box. + If useSphere is true, members are tested against the sphere instead. + + Implemented using both box and sphere tests to simplify the implementation + of a future beginSphereInteresection iterator using the same underlying + BoxIterator class. + */ + void getIntersectingMembers( + const AABox& box, + const Sphere& sphere, + Array& members, + bool useSphere) const { + + // Test all values at this node + for (int v = 0; v < valueArray.size(); ++v) { + if ((useSphere && sphere.contains(valueArray[v].position())) || + (! useSphere && box.contains(valueArray[v].position()))) { + members.append(valueArray[v].value); + } + } + + // If the left child overlaps the box, recurse into it + if ((child[0] != NULL) && (box.low()[splitAxis] < splitLocation)) { + child[0]->getIntersectingMembers(box, sphere, members, useSphere); + } + + // If the right child overlaps the box, recurse into it + if ((child[1] != NULL) && (box.high()[splitAxis] > splitLocation)) { + child[1]->getIntersectingMembers(box, sphere, members, useSphere); + } + } + + /** + Recurse through the tree, assigning splitBounds fields. + */ + void assignSplitBounds(const AABox& myBounds) { + splitBounds = myBounds; + +# ifdef G3D_DEBUG + if (child[0] || child[1]) { + debugAssert(splitBounds.high()[splitAxis] > splitLocation); + debugAssert(splitBounds.low()[splitAxis] < splitLocation); + } +# endif + + AABox childBounds[2]; + myBounds.split(splitAxis, splitLocation, childBounds[0], childBounds[1]); + + for (int c = 0; c < 2; ++c) { + if (child[c]) { + child[c]->assignSplitBounds(childBounds[c]); + } + } + } + }; + + class AxisComparator { + private: + Vector3::Axis sortAxis; + + public: + + AxisComparator(Vector3::Axis s) : sortAxis(s) {} + + inline int operator()(const Handle& A, const Handle& B) const { + if (A.position()[sortAxis] > B.position()[sortAxis]) { + return -1; + } else if (A.position()[sortAxis] < B.position()[sortAxis]) { + return 1; + } else { + return 0; + } + } + }; + + /** + Recursively subdivides the subarray. + + The source array will be cleared after it is used + + Call assignSplitBounds() on the root node after making a tree. + */ + Node* makeNode( + Array& source, + Array& temp, + int valuesPerNode, + int numMeanSplits) { + + Node* node = NULL; + + if (source.size() <= valuesPerNode) { + // Make a new leaf node + node = new Node(source); + + // Set the pointers in the memberTable + for (int i = 0; i < source.size(); ++i) { + memberTable.set(source[i].value, node); + } + + } else { + // Make a new internal node + node = new Node(); + + const AABox bounds = computeBounds(source); + const Vector3 extent = bounds.high() - bounds.low(); + + Vector3::Axis splitAxis = extent.primaryAxis(); + + float splitLocation; + + Array lt, gt; + + if (numMeanSplits <= 0) { + source.medianPartition(lt, node->valueArray, gt, temp, AxisComparator(splitAxis)); + splitLocation = node->valueArray[0].position()[splitAxis]; + + if ((node->valueArray.size() > source.size() / 2) && + (source.size() > 10)) { + // Our median split put an awful lot of points on the splitting plane. Try a mean + // split instead + numMeanSplits = 1; + } + } + + if (numMeanSplits > 0) { + // Compute the mean along the axis + + splitLocation = (bounds.high()[splitAxis] + + bounds.low()[splitAxis]) / 2.0; + + Handle splitHandle; + Vector3 v; + v[splitAxis] = splitLocation; + splitHandle.setPosition(v); + + source.partition(splitHandle, lt, node->valueArray, gt, AxisComparator(splitAxis)); + } + +# if defined(G3D_DEBUG) && defined(VERIFY_TREE) + for (int i = 0; i < lt.size(); ++i) { + const Vector3& v = lt[i].position(); + debugAssert(v[splitAxis] < splitLocation); + } + for (int i = 0; i < gt.size(); ++i) { + debugAssert(gt[i].position()[splitAxis] > splitLocation); + } + for (int i = 0; i < node->valueArray.size(); ++i) { + debugAssert(node->valueArray[i].position()[splitAxis] == splitLocation); + } +# endif + + node->splitAxis = splitAxis; + node->splitLocation = splitLocation; + + // Throw away the source array to save memory + source.fastClear(); + + if (lt.size() > 0) { + node->child[0] = makeNode(lt, temp, valuesPerNode, numMeanSplits - 1); + } + + if (gt.size() > 0) { + node->child[1] = makeNode(gt, temp, valuesPerNode, numMeanSplits - 1); + } + + // Add the values stored at this interior node to the member table + for(int i = 0; i < node->valueArray.size(); ++i) { + memberTable.set(node->valueArray[i].value, node); + } + + } + + return node; + } + + /** + Recursively clone the passed in node tree, setting + pointers for members in the memberTable as appropriate. + called by the assignment operator. + */ + Node* cloneTree(Node* src) { + Node* dst = new Node(*src); + + // Make back pointers + for (int i = 0; i < dst->valueArray.size(); ++i) { + memberTable.set(dst->valueArray[i].value, dst); + } + + // Clone children + for (int i = 0; i < 2; ++i) { + if (src->child[i] != NULL) { + dst->child[i] = cloneTree(src->child[i]); + } + } + + return dst; + } + + /** Maps members to the node containing them */ + typedef Table MemberTable; + MemberTable memberTable; + + Node* root; + +public: + + /** To construct a balanced tree, insert the elements and then call + PointKDTree::balance(). */ + PointKDTree() : root(NULL) {} + + + PointKDTree(const PointKDTree& src) : root(NULL) { + *this = src; + } + + + PointKDTree& operator=(const PointKDTree& src) { + delete root; + // Clone tree takes care of filling out the memberTable. + root = cloneTree(src.root); + return *this; + } + + + ~PointKDTree() { + clear(); + } + + /** + Throws out all elements of the set and erases the structure of the tree. + */ + void clear() { + memberTable.clear(); + delete root; + root = NULL; + } + + /** Removes all elements of the set while maintaining the structure of the tree */ + void clearData() { + memberTable.clear(); + Array stack; + stack.push(root); + while (stack.size() > 0) { + Node* node = stack.pop(); + node->valueArray.fastClear(); + + for (int i = 0; i < 2; ++i) { + if (node->child[i] != NULL) { + stack.push(node->child[i]); + } + } + } + } + + + int size() const { + return memberTable.size(); + } + + /** + Inserts an object into the set if it is not + already present. O(log n) time. Does not + cause the tree to be balanced. + */ + void insert(const T& value) { + if (contains(value)) { + // Already in the set + return; + } + + Handle h(value); + + if (root == NULL) { + // This is the first node; create a root node + root = new Node(); + } + + Node* node = root->findDeepestContainingNode(h.position()); + + // Insert into the node + node->valueArray.append(h); + + // Insert into the node table + memberTable.set(value, node); + } + + /** Inserts each elements in the array in turn. If the tree + begins empty (no structure and no elements), this is faster + than inserting each element in turn. You still need to balance + the tree at the end.*/ + void insert(const Array& valueArray) { + // Pre-size the member table to avoid multiple allocations + memberTable.setSizeHint(valueArray.size() + size()); + + if (root == NULL) { + // Optimized case for an empty tree; don't bother + // searching or reallocating the root node's valueArray + // as we incrementally insert. + root = new Node(); + root->valueArray.resize(valueArray.size()); + for (int i = 0; i < valueArray.size(); ++i) { + // Insert in opposite order so that we have the exact same + // data structure as if we inserted each (i.e., order is reversed + // from array). + root->valueArray[valueArray.size() - i - 1] = Handle(valueArray[i]); + memberTable.set(valueArray[i], root); + } + } else { + // Insert at appropriate tree depth. + for (int i = 0; i < valueArray.size(); ++i) { + insert(valueArray[i]); + } + } + } + + + /** + Returns true if this object is in the set, otherwise + returns false. O(1) time. + */ + bool contains(const T& value) { + return memberTable.containsKey(value); + } + + + /** + Removes an object from the set in O(1) time. + It is an error to remove members that are not already + present. May unbalance the tree. + + Removing an element never causes a node (split plane) to be removed... + nodes are only changed when the tree is rebalanced. This behavior + is desirable because it allows the split planes to be serialized, + and then deserialized into an empty tree which can be repopulated. + */ + void remove(const T& value) { + debugAssertM(contains(value), + "Tried to remove an element from a " + "PointKDTree that was not present"); + + Array& list = memberTable[value]->valueArray; + + // Find the element and remove it + for (int i = list.length() - 1; i >= 0; --i) { + if (list[i].value == value) { + list.fastRemove(i); + break; + } + } + memberTable.remove(value); + } + + + /** + If the element is in the set, it is removed. + The element is then inserted. + + This is useful when the == and hashCode methods + on T are independent of the bounds. In + that case, you may call update(v) to insert an + element for the first time and call update(v) + again every time it moves to keep the tree + up to date. + */ + void update(const T& value) { + if (contains(value)) { + remove(value); + } + insert(value); + } + + + /** + Rebalances the tree (slow). Call when objects + have moved substantially from their original positions + (which unbalances the tree and causes the spatial + queries to be slow). + + @param valuesPerNode Maximum number of elements to put at + a node. + + @param numMeanSplits numMeanSplits = 0 gives a + fully axis aligned BSP-tree, where the balance operation attempts to balance + the tree so that every splitting plane has an equal number of left + and right children (i.e. it is a median split along that axis). + This tends to maximize average performance; all querries will return in the same amount of time. + + You can override this behavior by + setting a number of mean (average) splits. numMeanSplits = MAX_INT + creates a full oct-tree, which tends to optimize peak performance (some areas of the scene will terminate after few recursive splits) at the expense of + peak performance. + */ + void balance(int valuesPerNode = 40, int numMeanSplits = 3) { + if (root == NULL) { + // Tree is empty + return; + } + + Array handleArray; + root->getHandles(handleArray); + + // Delete the old tree + clear(); + + Array temp; + root = makeNode(handleArray, temp, valuesPerNode, numMeanSplits); + temp.fastClear(); + + // Walk the tree, assigning splitBounds. We start with unbounded + // space. + root->assignSplitBounds(AABox::maxFinite()); + +# ifdef _DEBUG + root->verifyNode(Vector3::minFinite(), Vector3::maxFinite()); +# endif + } + +private: + + /** + Returns the elements + + @param parentMask The mask that this node returned from culledBy. + */ + static void getIntersectingMembers( + const Array& plane, + Array& members, + Node* node, + uint32 parentMask) { + + int dummy; + + if (parentMask == 0) { + // None of these planes can cull anything + for (int v = node->valueArray.size() - 1; v >= 0; --v) { + members.append(node->valueArray[v].value); + } + + // Iterate through child nodes + for (int c = 0; c < 2; ++c) { + if (node->child[c]) { + getIntersectingMembers(plane, members, node->child[c], 0); + } + } + } else { + + if (node->valueArray.size() > 0) { + // This is a leaf; check the points + debugAssertM(node->child[0] == NULL, "Malformed Point tree"); + debugAssertM(node->child[1] == NULL, "Malformed Point tree"); + + // Test values at this node against remaining planes + for (int p = 0; p < plane.size(); ++p) { + if ((parentMask >> p) & 1 != 0) { + // Test against this plane + const Plane& curPlane = plane[p]; + for (int v = node->valueArray.size() - 1; v >= 0; --v) { + if (curPlane.halfSpaceContains(node->valueArray[v].position())) { + members.append(node->valueArray[v].value); + } + } + } + } + } else { + + uint32 childMask = 0xFFFFFF; + + // Iterate through child nodes + for (int c = 0; c < 2; ++c) { + if (node->child[c] && + ! node->child[c]->splitBounds.culledBy(plane, dummy, parentMask, childMask)) { + // This node was not culled + getIntersectingMembers(plane, members, node->child[c], childMask); + } + } + } + } + } + +public: + + /** + Returns all members inside the set of planes. + @param members The results are appended to this array. + */ + void getIntersectingMembers(const Array& plane, Array& members) const { + if (root == NULL) { + return; + } + + getIntersectingMembers(plane, members, root, 0xFFFFFF); + } + + /** + Typically used to find all visible + objects inside the view frustum (see also GCamera::getClipPlanes)... i.e. all objects + not culled by frustum. + + Example: +
+        Array  visible;
+        tree.getIntersectingMembers(camera.frustum(), visible);
+        // ... Draw all objects in the visible array.
+      
+ @param members The results are appended to this array. + */ + void getIntersectingMembers(const GCamera::Frustum& frustum, Array& members) const { + Array plane; + + for (int i = 0; i < frustum.faceArray.size(); ++i) { + plane.append(frustum.faceArray[i].plane); + } + + getIntersectingMembers(plane, members); + } + + /** + C++ STL style iterator variable. See beginBoxIntersection(). + The iterator overloads the -> (dereference) operator, so this + acts like a pointer to the current member. + */ + // This iterator turns Node::getIntersectingMembers into a + // coroutine. It first translates that method from recursive to + // stack based, then captures the system state (analogous to a Scheme + // continuation) after each element is appended to the member array, + // and allowing the computation to be restarted. + class BoxIntersectionIterator { + private: + friend class TreeType; + + /** True if this is the "end" iterator instance */ + bool isEnd; + + /** The box that we're testing against. */ + AABox box; + + /** Node that we're currently looking at. Undefined if isEnd + is true. */ + Node* node; + + /** Nodes waiting to be processed */ + // We could use backpointers within the tree and careful + // state management to avoid ever storing the stack-- but + // it is much easier this way and only inefficient if the + // caller uses post increment (which they shouldn't!). + Array stack; + + /** The next index of current->valueArray to return. + Undefined when isEnd is true.*/ + int nextValueArrayIndex; + + BoxIntersectionIterator() : isEnd(true) {} + + BoxIntersectionIterator(const AABox& b, const Node* root) : + isEnd(root == NULL), box(b), + node(const_cast(root)), nextValueArrayIndex(-1) { + + // We intentionally start at the "-1" index of the current + // node so we can use the preincrement operator to move + // ourselves to element 0 instead of repeating all of the + // code from the preincrement method. Note that this might + // cause us to become the "end" instance. + ++(*this); + } + + public: + + inline bool operator!=(const BoxIntersectionIterator& other) const { + return ! (*this == other); + } + + bool operator==(const BoxIntersectionIterator& other) const { + if (isEnd) { + return other.isEnd; + } else if (other.isEnd) { + return false; + } else { + // Two non-end iterators; see if they match. This is kind of + // silly; users shouldn't call == on iterators in general unless + // one of them is the end iterator. + if ((box != other.box) || (node != other.node) || + (nextValueArrayIndex != other.nextValueArrayIndex) || + (stack.length() != other.stack.length())) { + return false; + } + + // See if the stacks are the same + for (int i = 0; i < stack.length(); ++i) { + if (stack[i] != other.stack[i]) { + return false; + } + } + + // We failed to find a difference; they must be the same + return true; + } + } + + /** + Pre increment. + */ + BoxIntersectionIterator& operator++() { + ++nextValueArrayIndex; + + bool foundIntersection = false; + while (! isEnd && ! foundIntersection) { + + // Search for the next node if we've exhausted this one + while ((! isEnd) && (nextValueArrayIndex >= node->valueArray.length())) { + // If we entered this loop, then the iterator has exhausted the elements at + // node (possibly because it just switched to a child node with no members). + // This loop continues until it finds a node with members or reaches + // the end of the whole intersection search. + + // If the right child overlaps the box, push it onto the stack for + // processing. + if ((node->child[1] != NULL) && + (box.high()[node->splitAxis] > node->splitLocation)) { + stack.push(node->child[1]); + } + + // If the left child overlaps the box, push it onto the stack for + // processing. + if ((node->child[0] != NULL) && + (box.low()[node->splitAxis] < node->splitLocation)) { + stack.push(node->child[0]); + } + + if (stack.length() > 0) { + // Go on to the next node (which may be either one of the ones we + // just pushed, or one from farther back the tree). + node = stack.pop(); + nextValueArrayIndex = 0; + } else { + // That was the last node; we're done iterating + isEnd = true; + } + } + + // Search for the next intersection at this node until we run out of children + while (! isEnd && ! foundIntersection && (nextValueArrayIndex < node->valueArray.length())) { + if (box.intersects(node->valueArray[nextValueArrayIndex].bounds)) { + foundIntersection = true; + } else { + ++nextValueArrayIndex; + // If we exhaust this node, we'll loop around the master loop + // to find a new node. + } + } + } + + return *this; + } + + /** + Post increment (much slower than preincrement!). + */ + BoxIntersectionIterator operator++(int) { + BoxIntersectionIterator old = *this; + ++this; + return old; + } + + /** Overloaded dereference operator so the iterator can masquerade as a pointer + to a member */ + const T& operator*() const { + alwaysAssertM(! isEnd, "Can't dereference the end element of an iterator"); + return node->valueArray[nextValueArrayIndex].value; + } + + /** Overloaded dereference operator so the iterator can masquerade as a pointer + to a member */ + T const * operator->() const { + alwaysAssertM(! isEnd, "Can't dereference the end element of an iterator"); + return &(stack.last()->valueArray[nextValueArrayIndex].value); + } + + /** Overloaded cast operator so the iterator can masquerade as a pointer + to a member */ + operator T*() const { + alwaysAssertM(! isEnd, "Can't dereference the end element of an iterator"); + return &(stack.last()->valueArray[nextValueArrayIndex].value); + } + }; + + + /** + Iterates through the members that intersect the box + */ + BoxIntersectionIterator beginBoxIntersection(const AABox& box) const { + return BoxIntersectionIterator(box, root); + } + + BoxIntersectionIterator endBoxIntersection() const { + // The "end" iterator instance + return BoxIntersectionIterator(); + } + + /** + Appends all members whose bounds intersect the box. + See also PointKDTree::beginBoxIntersection. + */ + void getIntersectingMembers(const AABox& box, Array& members) const { + if (root == NULL) { + return; + } + root->getIntersectingMembers(box, Sphere(Vector3::zero(), 0), members, false); + } + + + /** + @param members The results are appended to this array. + */ + void getIntersectingMembers(const Sphere& sphere, Array& members) const { + if (root == NULL) { + return; + } + + AABox box; + sphere.getBounds(box); + root->getIntersectingMembers(box, sphere, members); + + } + + + /** + Stores the locations of the splitting planes (the structure but not the content) + so that the tree can be quickly rebuilt from a previous configuration without + calling balance. + */ + void serializeStructure(BinaryOutput& bo) const { + Node::serializeStructure(root, bo); + } + + /** Clears the member table */ + void deserializeStructure(BinaryInput& bi) { + clear(); + root = Node::deserializeStructure(bi); + } + + /** + Returns an array of all members of the set. See also PointKDTree::begin. + */ + void getMembers(Array& members) const { + memberTable.getKeys(members); + } + + + /** + C++ STL style iterator variable. See begin(). + Overloads the -> (dereference) operator, so this acts like a pointer + to the current member. + */ + class Iterator { + private: + friend class TreeType; + + // Note: this is a Table iterator, we are currently defining + // Set iterator + typename MemberTable::Iterator it; + + Iterator(const typename MemberTable::Iterator& it) : it(it) {} + + public: + inline bool operator!=(const Iterator& other) const { + return !(*this == other); + } + + bool operator==(const Iterator& other) const { + return it == other.it; + } + + /** + Pre increment. + */ + Iterator& operator++() { + ++it; + return *this; + } + + /** + Post increment (slower than preincrement). + */ + Iterator operator++(int) { + Iterator old = *this; + ++(*this); + return old; + } + + const T& operator*() const { + return it->key; + } + + T* operator->() const { + return &(it->key); + } + + operator T*() const { + return &(it->key); + } + }; + + + /** + C++ STL style iterator method. Returns the first member. + Use preincrement (++entry) to get to the next element (iteration + order is arbitrary). + Do not modify the set while iterating. + */ + Iterator begin() const { + return Iterator(memberTable.begin()); + } + + + /** + C++ STL style iterator method. Returns one after the last iterator + element. + */ + Iterator end() const { + return Iterator(memberTable.end()); + } +#undef TreeType +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Pointer.h b/externals/g3dlite/G3D/Pointer.h new file mode 100644 index 0000000..6e35062 --- /dev/null +++ b/externals/g3dlite/G3D/Pointer.h @@ -0,0 +1,292 @@ +/** + @file Pointer.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-05-16 + @edited 2009-03-26 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ +#ifndef G3D_Pointer_h +#define G3D_Pointer_h + +#include "G3D/debugAssert.h" +#include "G3D/ReferenceCount.h" + +namespace G3D { + +/** + Acts like a pointer to a value of type ValueType (i.e., + ValueType*), but can operate through accessor methods as well as on + a value in memory. This is useful for implementing scripting + languages and other applications that need to connect existing APIs + by reference. + + Because the accessors require values to be passed by value (instead of by reference) + this is primarily useful for objects whose memory size is small. + +
+   class Foo {
+   public:
+      void setEnabled(bool b);
+      bool getEnabled() const;
+   };
+
+   Foo  f;
+   bool b;
+   
+   Pointer p1(&b);
+   Pointer p2(&f, &Foo::getEnabled, &Foo::setEnabled);
+
+   *p1 = true;
+   *p2 = false;
+   *p2 = *p1; \/\/ Value assignment
+   p2 = p1; \/\/ Pointer aliasing
+
+   \/\/ Or, equivalently:
+   p1.setValue(true);
+   p2.setValue(false);
+
+   p2.setValue(p1.getValue());
+   p2 = p1;
+   
+ + Note: Because of the way that dereference is implemented, you cannot pass *p through a function + that takes varargs (...), e.g., printf("%d", *p) will produce a compile-time error. Instead use + printf("%d",(bool)*p) or printf("%d", p.getValue()). + + */ +template +class Pointer { +private: + + class Interface { + public: + virtual ~Interface() {}; + virtual void set(ValueType b) = 0; + virtual ValueType get() const = 0; + virtual Interface* clone() const = 0; + virtual bool isNull() const = 0; + }; + + class Memory : public Interface { + private: + + ValueType* value; + + public: + + Memory(ValueType* value) : value(value) { + //debugAssert(value != NULL); + } + + virtual void set(ValueType v) { + *value = v; + } + + virtual ValueType get() const { + return *value; + } + + virtual Interface* clone() const { + return new Memory(value); + } + + virtual bool isNull() const { + return value == NULL; + } + }; + + template + class Accessor : public Interface { + private: + + T* object; + GetMethod getMethod; + SetMethod setMethod; + + public: + + Accessor(T* object, + GetMethod getMethod, + SetMethod setMethod) : object(object), getMethod(getMethod), setMethod(setMethod) { + debugAssert(object != NULL); + } + + virtual void set(ValueType v) { + (object->*setMethod)(v); + } + + virtual ValueType get() const { + return (object->*getMethod)(); + } + + virtual Interface* clone() const { + return new Accessor(object, getMethod, setMethod); + } + + virtual bool isNull() const { + return object == NULL; + } + }; + + + template + class RefAccessor : public Interface { + private: + + ReferenceCountedPointer object; + GetMethod getMethod; + SetMethod setMethod; + + public: + + RefAccessor( + const ReferenceCountedPointer& object, + GetMethod getMethod, + SetMethod setMethod) : object(object), getMethod(getMethod), setMethod(setMethod) { + + debugAssert(object != NULL); + } + + virtual void set(ValueType v) { + (object.pointer()->*setMethod)(v); + } + + virtual ValueType get() const { + return (object.pointer()->*getMethod)(); + } + + virtual Interface* clone() const { + return new RefAccessor(object, getMethod, setMethod); + } + + virtual bool isNull() const { + return object.isNull(); + } + }; + + + Interface* m_interface; + +public: + + Pointer() : m_interface(NULL) {}; + + /** Allows implicit cast from real pointer */ + Pointer(ValueType* v) : m_interface(new Memory(v)) {} + + inline bool isNull() const { + return (m_interface == NULL) || m_interface->isNull(); + } + + // Assignment + inline Pointer& operator=(const Pointer& r) { + delete m_interface; + if (r.m_interface != NULL) { + m_interface = r.m_interface->clone(); + } else { + m_interface = NULL; + } + return this[0]; + } + + Pointer(const Pointer& p) : m_interface(NULL) { + this[0] = p; + } + + template + Pointer(const ReferenceCountedPointer& object, + ValueType (Class::*getMethod)() const, + void (Class::*setMethod)(ValueType)) : + m_interface(new RefAccessor(object, getMethod, setMethod)) {} + + template + Pointer(const ReferenceCountedPointer& object, + const ValueType& (Class::*getMethod)() const, + void (Class::*setMethod)(ValueType)) : + m_interface(new RefAccessor(object, getMethod, setMethod)) {} + + template + Pointer(const ReferenceCountedPointer& object, + ValueType (Class::*getMethod)() const, + void (Class::*setMethod)(const ValueType&)) : + m_interface(new RefAccessor(object, getMethod, setMethod)) {} + + template + Pointer(const ReferenceCountedPointer& object, + const ValueType& (Class::*getMethod)() const, + void (Class::*setMethod)(const ValueType&)) : + m_interface(new RefAccessor(object, getMethod, setMethod)) {} + + template + Pointer(Class* object, + const ValueType& (Class::*getMethod)() const, + void (Class::*setMethod)(const ValueType&)) : + m_interface(new Accessor(object, getMethod, setMethod)) {} + + template + Pointer(Class* object, + ValueType (Class::*getMethod)() const, + void (Class::*setMethod)(const ValueType&)) : + m_interface(new Accessor(object, getMethod, setMethod)) {} + + template + Pointer(Class* object, + const ValueType& (Class::*getMethod)() const, + void (Class::*setMethod)(ValueType)) : + m_interface(new Accessor(object, getMethod, setMethod)) {} + + template + Pointer(Class* object, + ValueType (Class::*getMethod)() const, + void (Class::*setMethod)(ValueType)) : + m_interface(new Accessor(object, getMethod, setMethod)) {} + + ~Pointer() { + delete m_interface; + } + + inline const ValueType getValue() const { + debugAssert(m_interface != NULL); + return m_interface->get(); + } + + inline void setValue(const ValueType& v) { + debugAssert(m_interface != NULL); + m_interface->set(v); + } + + class IndirectValue { + private: + + friend class Pointer; + Pointer* pointer; + IndirectValue(Pointer* p) : pointer(p) {} + + public: + + void operator=(const ValueType& v) { + pointer->setValue(v); + } + + operator ValueType() const { + return pointer->getValue(); + } + + }; + + inline IndirectValue operator*() { + return IndirectValue(this); + } + + inline const ValueType operator*() const { + return getValue(); + } +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/PositionTrait.h b/externals/g3dlite/G3D/PositionTrait.h new file mode 100644 index 0000000..67a4f64 --- /dev/null +++ b/externals/g3dlite/G3D/PositionTrait.h @@ -0,0 +1,7 @@ +#ifndef G3D_POSITIONTRAIT_H +#define G3D_POSITIONTRAIT_H + +template +struct PositionTrait{}; + +#endif diff --git a/externals/g3dlite/G3D/PrecomputedRandom.h b/externals/g3dlite/G3D/PrecomputedRandom.h new file mode 100644 index 0000000..411d128 --- /dev/null +++ b/externals/g3dlite/G3D/PrecomputedRandom.h @@ -0,0 +1,110 @@ +/** + @file PrecomputedRandom.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2009-03-31 + @edited 2009-03-31 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ +#ifndef G3D_PrecomputedRandom_h +#define G3D_PrecomputedRandom_h + +#include "G3D/platform.h" +#include "G3D/Random.h" + +namespace G3D { + +/** Fast random numbers using a precomputed data table. + + e.g., generates cosHemi about 13x faster than Random. + This is useful for quickly generating seeded random + numbers for reproducibility. G3D::Random takes a long + time to seed; this is instantaneous (providing the + precomputed data is already available.) + + Not threadsafe.*/ +class PrecomputedRandom : public Random { +public: + /** Put the cosHemi and the uniform together so that when + alternating between them we stay in cache. This is also packed + into a good size for SIMD and GPU operations.*/ + class HemiUniformData { + public: + float cosHemiX; + float cosHemiY; + float cosHemiZ; + float uniform; + }; + + class SphereBitsData { + public: + float sphereX; + float sphereY; + float sphereZ; + uint32 bits; + }; + +protected: + + /** Array of 2^n elements. */ + const HemiUniformData* m_hemiUniform; + const SphereBitsData* m_sphereBits; + + /** 2^n - 1; the AND mask for computing a fast modulo */ + int m_modMask; + + int m_index; + + /** If true, free m_hemiUniform and m_sphereBits in destructor */ + bool m_freeData; + +public: + + /* + \param dataSize Must be a power of 2 + \param data Will NOT be deleted by the destructor. + */ + PrecomputedRandom(const HemiUniformData* data1, const SphereBitsData* data2, int dataSize, uint32 seed = 0xF018A4D2); + + /** + \param dataSize Number of random numbers that can be requested before periodicity. Must be a power of 2. + */ + PrecomputedRandom(int dataSize, uint32 seed = 0xF018A4D2); + + ~PrecomputedRandom(); + + /** Each bit is random. Subclasses can choose to override just + this method and the other methods will all work automatically. */ + virtual uint32 bits(); + + // integer is inherited + + /** Uniform random float on the range [min, max] */ + virtual float uniform(float low, float high); + + /** Uniform random float on the range [0, 1] */ + virtual float uniform(); + + // gaussian is inherited + + /** Returns 3D unit vectors distributed according to + a cosine distribution about the z axis. */ + virtual void cosHemi(float& x, float& y, float& z); + + /** Returns 3D unit vectors distributed according to a cosine + power distribution (\f$ \mbox{cos}^k \theta \f$) about + the z-axis. */ + virtual void cosPowHemi(const float k, float& x, float& y, float& z); + + // hemi is inherited + + /** Returns 3D unit vectors uniformly distributed on the sphere */ + virtual void sphere(float& x, float& y, float& z); +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Quat.h b/externals/g3dlite/G3D/Quat.h new file mode 100644 index 0000000..9ef3d57 --- /dev/null +++ b/externals/g3dlite/G3D/Quat.h @@ -0,0 +1,725 @@ +/** + @file Quat.h + + Quaternion + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-01-23 + @edited 2009-05-10 + */ + +#ifndef G3D_Quat_h +#define G3D_Quat_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Vector3.h" +#include "G3D/Matrix3.h" +#include + +namespace G3D { + +/** + Unit quaternions are used in computer graphics to represent + rotation about an axis. Any 3x3 rotation matrix can + be stored as a quaternion. + + A quaternion represents the sum of a real scalar and + an imaginary vector: ix + jy + kz + w. A unit quaternion + representing a rotation by A about axis v has the form + [sin(A/2)*v, cos(A/2)]. For a unit quaternion, q.conj() == q.inverse() + is a rotation by -A about v. -q is the same rotation as q + (negate both the axis and angle). + + A non-unit quaterion q represents the same rotation as + q.unitize() (Dam98 pg 28). + + Although quaternion-vector operations (eg. Quat + Vector3) are + well defined, they are not supported by this class because + they typically are bugs when they appear in code. + + Do not subclass. + + BETA API -- subject to change + @cite Erik B. Dam, Martin Koch, Martin Lillholm, Quaternions, Interpolation and Animation. Technical Report DIKU-TR-98/5, Department of Computer Science, University of Copenhagen, Denmark. 1998. + */ +class Quat { +private: + // Hidden operators + bool operator<(const Quat&) const; + bool operator>(const Quat&) const; + bool operator<=(const Quat&) const; + bool operator>=(const Quat&) const; + +public: + + /** + q = [sin(angle / 2) * axis, cos(angle / 2)] + + In Watt & Watt's notation, s = w, v = (x, y, z) + In the Real-Time Rendering notation, u = (x, y, z), w = w + */ + float x, y, z, w; + + /** + Initializes to a zero degree rotation. + */ + inline Quat() : x(0), y(0), z(0), w(1) {} + + Quat( + const Matrix3& rot); + + inline Quat(float _x, float _y, float _z, float _w) : + x(_x), y(_y), z(_z), w(_w) {} + + /** Defaults to a pure vector quaternion */ + inline Quat(const Vector3& v, float _w = 0) : x(v.x), y(v.y), z(v.z), w(_w) { + } + + /** + The real part of the quaternion. + */ + inline const float& real() const { + return w; + } + + inline float& real() { + return w; + } + + /** Note: two quats can represent the Quat::sameRotation and not be equal. */ + bool fuzzyEq(const Quat& q) { + return G3D::fuzzyEq(x, q.x) && G3D::fuzzyEq(y, q.y) && G3D::fuzzyEq(z, q.z) && G3D::fuzzyEq(w, q.w); + } + + /** True if these quaternions represent the same rotation (note that every rotation is + represented by two values; q and -q). + */ + bool sameRotation(const Quat& q) { + return fuzzyEq(q) || fuzzyEq(-q); + } + + inline Quat operator-() const { + return Quat(-x, -y, -z, -w); + } + + /** + Returns the imaginary part (x, y, z) + */ + inline const Vector3& imag() const { + return *(reinterpret_cast(this)); + } + + inline Vector3& imag() { + return *(reinterpret_cast(this)); + } + + /** q = [sin(angle/2)*axis, cos(angle/2)] */ + static Quat fromAxisAngleRotation( + const Vector3& axis, + float angle); + + /** Returns the axis and angle of rotation represented + by this quaternion (i.e. q = [sin(angle/2)*axis, cos(angle/2)]) */ + void toAxisAngleRotation( + Vector3& axis, + double& angle) const; + + void toAxisAngleRotation( + Vector3& axis, + float& angle) const { + double d; + toAxisAngleRotation(axis, d); + angle = (float)d; + } + + Matrix3 toRotationMatrix() const; + + void toRotationMatrix( + Matrix3& rot) const; + + /** + Spherical linear interpolation: linear interpolation along the + shortest (3D) great-circle route between two quaternions. + + Note: Correct rotations are expected between 0 and PI in the right order. + + @cite Based on Game Physics -- David Eberly pg 538-540 + @param threshold Critical angle between between rotations at which + the algorithm switches to normalized lerp, which is more + numerically stable in those situations. 0.0 will always slerp. + */ + Quat slerp( + const Quat& other, + float alpha, + float threshold = 0.05f) const; + + /** Normalized linear interpolation of quaternion components. */ + Quat nlerp(const Quat& other, float alpha) const; + + /** + Negates the imaginary part. + */ + inline Quat conj() const { + return Quat(-x, -y, -z, w); + } + + inline float sum() const { + return x + y + z + w; + } + + inline float average() const { + return sum() / 4.0f; + } + + inline Quat operator*(float s) const { + return Quat(x * s, y * s, z * s, w * s); + } + + inline Quat& operator*=(float s) { + x *= s; + y *= s; + z *= s; + w *= s; + return *this; + } + + /** @cite Based on Watt & Watt, page 360 */ + friend Quat operator* (float s, const Quat& q); + + inline Quat operator/(float s) const { + return Quat(x / s, y / s, z / s, w / s); + } + + inline float dot(const Quat& other) const { + return (x * other.x) + (y * other.y) + (z * other.z) + (w * other.w); + } + + /** Note that q-1 = q.conj() for a unit quaternion. + @cite Dam99 page 13 */ + inline Quat inverse() const { + return conj() / dot(*this); + } + + Quat operator-(const Quat& other) const; + + Quat operator+(const Quat& other) const; + + /** + Quaternion multiplication (composition of rotations). + Note that this does not commute. + */ + Quat operator*(const Quat& other) const; + + /* (*this) * other.inverse() */ + Quat operator/(const Quat& other) const { + return (*this) * other.inverse(); + } + + + /** Is the magnitude nearly 1.0? */ + inline bool isUnit(float tolerance = 1e-5) const { + return abs(dot(*this) - 1.0f) < tolerance; + } + + + inline float magnitude() const { + return sqrtf(dot(*this)); + } + + inline Quat log() const { + if ((x == 0) && (y == 0) && (z == 0)) { + if (w > 0) { + return Quat(0, 0, 0, ::logf(w)); + } else if (w < 0) { + // Log of a negative number. Multivalued, any number of the form + // (PI * v, ln(-q.w)) + return Quat((float)pi(), 0, 0, ::logf(-w)); + } else { + // log of zero! + return Quat((float)nan(), (float)nan(), (float)nan(), (float)nan()); + } + } else { + // Partly imaginary. + float imagLen = sqrtf(x * x + y * y + z * z); + float len = sqrtf(imagLen * imagLen + w * w); + float theta = atan2f(imagLen, (float)w); + float t = theta / imagLen; + return Quat(t * x, t * y, t * z, ::logf(len)); + } + } + /** log q = [Av, 0] where q = [sin(A) * v, cos(A)]. + Only for unit quaternions + debugAssertM(isUnit(), "Log only defined for unit quaternions"); + // Solve for A in q = [sin(A)*v, cos(A)] + Vector3 u(x, y, z); + double len = u.magnitude(); + + if (len == 0.0) { + return + } + double A = atan2((double)w, len); + Vector3 v = u / len; + + return Quat(v * A, 0); + } + */ + + /** exp q = [sin(A) * v, cos(A)] where q = [Av, 0]. + Only defined for pure-vector quaternions */ + inline Quat exp() const { + debugAssertM(w == 0, "exp only defined for vector quaternions"); + Vector3 u(x, y, z); + float A = u.magnitude(); + Vector3 v = u / A; + return Quat(sinf(A) * v, cosf(A)); + } + + + /** + Raise this quaternion to a power. For a rotation, this is + the effect of rotating x times as much as the original + quaterion. + + Note that q.pow(a).pow(b) == q.pow(a + b) + @cite Dam98 pg 21 + */ + inline Quat pow(float x) const { + return (log() * x).exp(); + } + + inline void unitize() { + float mag2 = dot(*this); + if (! G3D::fuzzyEq(mag2, 1.0f)) { + *this *= rsq(mag2); + } + } + + /** + Returns a unit quaterion obtained by dividing through by + the magnitude. + */ + inline Quat toUnit() const { + Quat x = *this; + x.unitize(); + return x; + } + + /** + The linear algebra 2-norm, sqrt(q dot q). This matches + the value used in Dam's 1998 tech report but differs from the + n(q) value used in Eberly's 1999 paper, which is the square of the + norm. + */ + inline float norm() const { + return magnitude(); + } + + // access quaternion as q[0] = q.x, q[1] = q.y, q[2] = q.z, q[3] = q.w + // + // WARNING. These member functions rely on + // (1) Quat not having virtual functions + // (2) the data packed in a 4*sizeof(float) memory block + const float& operator[] (int i) const; + float& operator[] (int i); + + /** Generate uniform random unit quaternion (i.e. random "direction") + @cite From "Uniform Random Rotations", Ken Shoemake, Graphics Gems III. + */ + static Quat unitRandom(); + + void deserialize(class BinaryInput& b); + void serialize(class BinaryOutput& b) const; + + // 2-char swizzles + + Vector2 xx() const; + Vector2 yx() const; + Vector2 zx() const; + Vector2 wx() const; + Vector2 xy() const; + Vector2 yy() const; + Vector2 zy() const; + Vector2 wy() const; + Vector2 xz() const; + Vector2 yz() const; + Vector2 zz() const; + Vector2 wz() const; + Vector2 xw() const; + Vector2 yw() const; + Vector2 zw() const; + Vector2 ww() const; + + // 3-char swizzles + + Vector3 xxx() const; + Vector3 yxx() const; + Vector3 zxx() const; + Vector3 wxx() const; + Vector3 xyx() const; + Vector3 yyx() const; + Vector3 zyx() const; + Vector3 wyx() const; + Vector3 xzx() const; + Vector3 yzx() const; + Vector3 zzx() const; + Vector3 wzx() const; + Vector3 xwx() const; + Vector3 ywx() const; + Vector3 zwx() const; + Vector3 wwx() const; + Vector3 xxy() const; + Vector3 yxy() const; + Vector3 zxy() const; + Vector3 wxy() const; + Vector3 xyy() const; + Vector3 yyy() const; + Vector3 zyy() const; + Vector3 wyy() const; + Vector3 xzy() const; + Vector3 yzy() const; + Vector3 zzy() const; + Vector3 wzy() const; + Vector3 xwy() const; + Vector3 ywy() const; + Vector3 zwy() const; + Vector3 wwy() const; + Vector3 xxz() const; + Vector3 yxz() const; + Vector3 zxz() const; + Vector3 wxz() const; + Vector3 xyz() const; + Vector3 yyz() const; + Vector3 zyz() const; + Vector3 wyz() const; + Vector3 xzz() const; + Vector3 yzz() const; + Vector3 zzz() const; + Vector3 wzz() const; + Vector3 xwz() const; + Vector3 ywz() const; + Vector3 zwz() const; + Vector3 wwz() const; + Vector3 xxw() const; + Vector3 yxw() const; + Vector3 zxw() const; + Vector3 wxw() const; + Vector3 xyw() const; + Vector3 yyw() const; + Vector3 zyw() const; + Vector3 wyw() const; + Vector3 xzw() const; + Vector3 yzw() const; + Vector3 zzw() const; + Vector3 wzw() const; + Vector3 xww() const; + Vector3 yww() const; + Vector3 zww() const; + Vector3 www() const; + + // 4-char swizzles + + Vector4 xxxx() const; + Vector4 yxxx() const; + Vector4 zxxx() const; + Vector4 wxxx() const; + Vector4 xyxx() const; + Vector4 yyxx() const; + Vector4 zyxx() const; + Vector4 wyxx() const; + Vector4 xzxx() const; + Vector4 yzxx() const; + Vector4 zzxx() const; + Vector4 wzxx() const; + Vector4 xwxx() const; + Vector4 ywxx() const; + Vector4 zwxx() const; + Vector4 wwxx() const; + Vector4 xxyx() const; + Vector4 yxyx() const; + Vector4 zxyx() const; + Vector4 wxyx() const; + Vector4 xyyx() const; + Vector4 yyyx() const; + Vector4 zyyx() const; + Vector4 wyyx() const; + Vector4 xzyx() const; + Vector4 yzyx() const; + Vector4 zzyx() const; + Vector4 wzyx() const; + Vector4 xwyx() const; + Vector4 ywyx() const; + Vector4 zwyx() const; + Vector4 wwyx() const; + Vector4 xxzx() const; + Vector4 yxzx() const; + Vector4 zxzx() const; + Vector4 wxzx() const; + Vector4 xyzx() const; + Vector4 yyzx() const; + Vector4 zyzx() const; + Vector4 wyzx() const; + Vector4 xzzx() const; + Vector4 yzzx() const; + Vector4 zzzx() const; + Vector4 wzzx() const; + Vector4 xwzx() const; + Vector4 ywzx() const; + Vector4 zwzx() const; + Vector4 wwzx() const; + Vector4 xxwx() const; + Vector4 yxwx() const; + Vector4 zxwx() const; + Vector4 wxwx() const; + Vector4 xywx() const; + Vector4 yywx() const; + Vector4 zywx() const; + Vector4 wywx() const; + Vector4 xzwx() const; + Vector4 yzwx() const; + Vector4 zzwx() const; + Vector4 wzwx() const; + Vector4 xwwx() const; + Vector4 ywwx() const; + Vector4 zwwx() const; + Vector4 wwwx() const; + Vector4 xxxy() const; + Vector4 yxxy() const; + Vector4 zxxy() const; + Vector4 wxxy() const; + Vector4 xyxy() const; + Vector4 yyxy() const; + Vector4 zyxy() const; + Vector4 wyxy() const; + Vector4 xzxy() const; + Vector4 yzxy() const; + Vector4 zzxy() const; + Vector4 wzxy() const; + Vector4 xwxy() const; + Vector4 ywxy() const; + Vector4 zwxy() const; + Vector4 wwxy() const; + Vector4 xxyy() const; + Vector4 yxyy() const; + Vector4 zxyy() const; + Vector4 wxyy() const; + Vector4 xyyy() const; + Vector4 yyyy() const; + Vector4 zyyy() const; + Vector4 wyyy() const; + Vector4 xzyy() const; + Vector4 yzyy() const; + Vector4 zzyy() const; + Vector4 wzyy() const; + Vector4 xwyy() const; + Vector4 ywyy() const; + Vector4 zwyy() const; + Vector4 wwyy() const; + Vector4 xxzy() const; + Vector4 yxzy() const; + Vector4 zxzy() const; + Vector4 wxzy() const; + Vector4 xyzy() const; + Vector4 yyzy() const; + Vector4 zyzy() const; + Vector4 wyzy() const; + Vector4 xzzy() const; + Vector4 yzzy() const; + Vector4 zzzy() const; + Vector4 wzzy() const; + Vector4 xwzy() const; + Vector4 ywzy() const; + Vector4 zwzy() const; + Vector4 wwzy() const; + Vector4 xxwy() const; + Vector4 yxwy() const; + Vector4 zxwy() const; + Vector4 wxwy() const; + Vector4 xywy() const; + Vector4 yywy() const; + Vector4 zywy() const; + Vector4 wywy() const; + Vector4 xzwy() const; + Vector4 yzwy() const; + Vector4 zzwy() const; + Vector4 wzwy() const; + Vector4 xwwy() const; + Vector4 ywwy() const; + Vector4 zwwy() const; + Vector4 wwwy() const; + Vector4 xxxz() const; + Vector4 yxxz() const; + Vector4 zxxz() const; + Vector4 wxxz() const; + Vector4 xyxz() const; + Vector4 yyxz() const; + Vector4 zyxz() const; + Vector4 wyxz() const; + Vector4 xzxz() const; + Vector4 yzxz() const; + Vector4 zzxz() const; + Vector4 wzxz() const; + Vector4 xwxz() const; + Vector4 ywxz() const; + Vector4 zwxz() const; + Vector4 wwxz() const; + Vector4 xxyz() const; + Vector4 yxyz() const; + Vector4 zxyz() const; + Vector4 wxyz() const; + Vector4 xyyz() const; + Vector4 yyyz() const; + Vector4 zyyz() const; + Vector4 wyyz() const; + Vector4 xzyz() const; + Vector4 yzyz() const; + Vector4 zzyz() const; + Vector4 wzyz() const; + Vector4 xwyz() const; + Vector4 ywyz() const; + Vector4 zwyz() const; + Vector4 wwyz() const; + Vector4 xxzz() const; + Vector4 yxzz() const; + Vector4 zxzz() const; + Vector4 wxzz() const; + Vector4 xyzz() const; + Vector4 yyzz() const; + Vector4 zyzz() const; + Vector4 wyzz() const; + Vector4 xzzz() const; + Vector4 yzzz() const; + Vector4 zzzz() const; + Vector4 wzzz() const; + Vector4 xwzz() const; + Vector4 ywzz() const; + Vector4 zwzz() const; + Vector4 wwzz() const; + Vector4 xxwz() const; + Vector4 yxwz() const; + Vector4 zxwz() const; + Vector4 wxwz() const; + Vector4 xywz() const; + Vector4 yywz() const; + Vector4 zywz() const; + Vector4 wywz() const; + Vector4 xzwz() const; + Vector4 yzwz() const; + Vector4 zzwz() const; + Vector4 wzwz() const; + Vector4 xwwz() const; + Vector4 ywwz() const; + Vector4 zwwz() const; + Vector4 wwwz() const; + Vector4 xxxw() const; + Vector4 yxxw() const; + Vector4 zxxw() const; + Vector4 wxxw() const; + Vector4 xyxw() const; + Vector4 yyxw() const; + Vector4 zyxw() const; + Vector4 wyxw() const; + Vector4 xzxw() const; + Vector4 yzxw() const; + Vector4 zzxw() const; + Vector4 wzxw() const; + Vector4 xwxw() const; + Vector4 ywxw() const; + Vector4 zwxw() const; + Vector4 wwxw() const; + Vector4 xxyw() const; + Vector4 yxyw() const; + Vector4 zxyw() const; + Vector4 wxyw() const; + Vector4 xyyw() const; + Vector4 yyyw() const; + Vector4 zyyw() const; + Vector4 wyyw() const; + Vector4 xzyw() const; + Vector4 yzyw() const; + Vector4 zzyw() const; + Vector4 wzyw() const; + Vector4 xwyw() const; + Vector4 ywyw() const; + Vector4 zwyw() const; + Vector4 wwyw() const; + Vector4 xxzw() const; + Vector4 yxzw() const; + Vector4 zxzw() const; + Vector4 wxzw() const; + Vector4 xyzw() const; + Vector4 yyzw() const; + Vector4 zyzw() const; + Vector4 wyzw() const; + Vector4 xzzw() const; + Vector4 yzzw() const; + Vector4 zzzw() const; + Vector4 wzzw() const; + Vector4 xwzw() const; + Vector4 ywzw() const; + Vector4 zwzw() const; + Vector4 wwzw() const; + Vector4 xxww() const; + Vector4 yxww() const; + Vector4 zxww() const; + Vector4 wxww() const; + Vector4 xyww() const; + Vector4 yyww() const; + Vector4 zyww() const; + Vector4 wyww() const; + Vector4 xzww() const; + Vector4 yzww() const; + Vector4 zzww() const; + Vector4 wzww() const; + Vector4 xwww() const; + Vector4 ywww() const; + Vector4 zwww() const; + Vector4 wwww() const; +}; + +inline Quat exp(const Quat& q) { + return q.exp(); +} + +inline Quat log(const Quat& q) { + return q.log(); +} + +inline G3D::Quat operator*(double s, const G3D::Quat& q) { + return q * (float)s; +} + +inline G3D::Quat operator*(float s, const G3D::Quat& q) { + return q * s; +} + +inline float& Quat::operator[] (int i) { + debugAssert(i >= 0); + debugAssert(i < 4); + return ((float*)this)[i]; +} + +inline const float& Quat::operator[] (int i) const { + debugAssert(i >= 0); + debugAssert(i < 4); + return ((float*)this)[i]; +} + +inline Quat Quat::operator-(const Quat& other) const { + return Quat(x - other.x, y - other.y, z - other.z, w - other.w); +} + +inline Quat Quat::operator+(const Quat& other) const { + return Quat(x + other.x, y + other.y, z + other.z, w + other.w); +} + +} // Namespace G3D + +// Outside the namespace to avoid overloading confusion for C++ +inline G3D::Quat pow(const G3D::Quat& q, double x) { + return q.pow((float)x); +} + + +#endif diff --git a/externals/g3dlite/G3D/Quat.inl b/externals/g3dlite/G3D/Quat.inl new file mode 100644 index 0000000..9e4c861 --- /dev/null +++ b/externals/g3dlite/G3D/Quat.inl @@ -0,0 +1,36 @@ +/** + Quat.inl + + @cite Quaternion implementation based on Watt & Watt page 363. + Thanks to Max McGuire for slerp optimizations. + + @maintainer Morgan McGuire, matrix@graphics3d.com + + @created 2002-01-23 + @edited 2004-03-04 + */ + +namespace G3D { + +inline float& Quat::operator[] (int i) { + debugAssert(i >= 0); + debugAssert(i < 4); + return ((float*)this)[i]; +} + +inline const float& Quat::operator[] (int i) const { + debugAssert(i >= 0); + debugAssert(i < 4); + return ((float*)this)[i]; +} + +inline Quat Quat::operator-(const Quat& other) const { + return Quat(x - other.x, y - other.y, z - other.z, w - other.w); +} + +inline Quat Quat::operator+(const Quat& other) const { + return Quat(x + other.x, y + other.y, z + other.z, w + other.w); +} + +} + diff --git a/externals/g3dlite/G3D/Queue.h b/externals/g3dlite/G3D/Queue.h new file mode 100644 index 0000000..3657326 --- /dev/null +++ b/externals/g3dlite/G3D/Queue.h @@ -0,0 +1,364 @@ +/** + @file Queue.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-07-09 + @edited 2008-12-20 + */ + +#ifndef G3D_QUEUE_H +#define G3D_QUEUE_H + +#include "G3D/platform.h" +#include "G3D/System.h" +#include "G3D/debug.h" + +namespace G3D { + +/** + Locate the indices of the break between of the two + sections of the circular queue. These are used to + construct two for loops that iterate over the whole + sequence without using the modulo operator. + + [0 ... secondEnd) [head .... firstEnd) + */ +#define FIND_ENDS \ + int firstEnd = head + num;\ + int secondEnd = 0;\ + if (firstEnd > numAllocated) {\ + secondEnd = firstEnd - numAllocated;\ + firstEnd = numAllocated;\ + } + + +/** + Dynamic queue that uses a circular buffer for performance. + + Faster than std::deque for objects with constructors. + */ +template +class Queue { +private: + // + // |<---- num ---->| + // [ | | | | | | | | | | | | | ] + // ^ + // | + // head + // + // + + /** + Only num elements are initialized. + */ + T* data; + + /** + Index of the next element to be dequeue-d in data. + */ + int head; + + /** + Number of elements (including head) that are visible and initialized. + */ + int num; + + /** + Size of data array in elements. + */ + int numAllocated; + + /** If a clear was needed, assumes it already occured */ + void _copy(const Queue& other) { + debugAssert(data == NULL); + data = (T*)System::malloc(sizeof(T) * other.numAllocated); + debugAssert(data); + head = other.head; + num = other.num; + numAllocated = other.numAllocated; + + FIND_ENDS; + + for (int i = head; i < firstEnd; ++i) { + new (data + i)T(other.data[i]); + } + + for (int i = 0; i < secondEnd; ++i) { + new (data + i)T(other.data[i]); + } + } + + + /** + Computes a data array index from a queue position. The queue position + may be negative. + */ + inline int index(int i) const { + return (head + i + numAllocated) % numAllocated; + } + + /** + Allocates newSize elements and repacks the array. + */ + void repackAndRealloc(int newSize) { + // TODO: shrink queue + T* old = data; + data = (T*)System::malloc(newSize * sizeof(T)); + debugAssert(data != NULL); + + FIND_ENDS; + + int j = 0; + for (int i = head; i < firstEnd; ++i, ++j) { + new (data + j)T(old[i]); + (old + i)->~T(); + } + + for (int i = 0; i < secondEnd; ++i, ++j) { + new (data + j)T(old[i]); + (old + i)->~T(); + } + + head = 0; + System::free(old); + numAllocated = newSize; + } + + /** + Ensure that there is at least one element between + the tail and head, wrapping around in the circular + buffer. + */ + inline void reserveSpace() { + if (num == numAllocated) { + repackAndRealloc(numAllocated * 3 + 20); + } + } + +public: + + Queue() : + data(NULL), + head(0), + num(0), + numAllocated(0) { + } + + + /** + Copy constructor + */ + Queue(const Queue& other) : data(NULL) { + _copy(other); + } + + + /** + Destructor does not delete() the objects if T is a pointer type + (e.g. T = int*) instead, it deletes the pointers themselves and + leaves the objects. Call deleteAll if you want to dealocate + the objects referenced. + */ + virtual ~Queue() { + clear(); + } + + /** + Insert a new element into the front of the queue + (a traditional queue only uses pushBack). + */ + inline void pushFront(const T& e) { + reserveSpace(); + + // Get the index of head-1 + int i = index(-1); + + // Call the constructor on the newly exposed element. + new (data + i)T(e); + + // Reassign the head to point to this index + head = i; + ++num; + } + + /** + Insert a new element at the end of the queue. + */ + inline void pushBack(const T& e) { + reserveSpace(); + + // Get the index of 1+tail + int i = index(num); + + // Initialize that element + new (data + i)T(e); + ++num; + } + + /** + pushBack + */ + inline void enqueue(const T& e) { + pushBack(e); + } + + + /** + Remove the last element from the queue. The queue will never + shrink in size. (A typical queue only uses popFront). + */ + inline T popBack() { + int tail = index(num - 1); + T result(data[tail]); + + // Call the destructor + (data + tail)->~T(); + --num; + + return result; + } + + /** + Remove the next element from the head of the queue. The queue will never + shrink in size. */ + inline T popFront() { + T result(data[head]); + // Call the destructor + (data + head)->~T(); + head = (head + 1) % numAllocated; + --num; + return result; + } + + + /** + popFront + */ + inline T dequeue() { + return popFront(); + } + + /** + Removes all elements (invoking their destructors). + + @param freeStorage If false, the underlying array is not deallocated + (allowing fast push in the future), however, the size of the Queue + is reported as zero. + + */ + void clear(bool freeStorage = true) { + + FIND_ENDS; + + // Invoke the destructors on the elements + int i; + for (i = head; i < firstEnd; ++i) { + (data + i)->~T(); + } + + for (i = 0; i < secondEnd; ++i) { + (data + i)->~T(); + } + + num = 0; + head = 0; + if (freeStorage) { + numAllocated = 0; + System::free(data); + data = NULL; + } + } + + /** Clear without freeing the underlying array. */ + void fastClear() { + clear(false); + } + + /** + Assignment operator. + */ + Queue& operator=(const Queue& other) { + clear(); + _copy(other); + return *this; + } + + /** + Number of elements in the queue. + */ + inline int size() const { + return num; + } + + /** + Number of elements in the queue. + */ + inline int length() const { + return size(); + } + + /** + Performs bounds checks in debug mode + */ + inline T& operator[](int n) { + debugAssert((n >= 0) && (n < num)); + return data[index(n)]; + } + + /** + Performs bounds checks in debug mode + */ + inline const T& operator[](int n) const { + debugAssert((n >= 0) && (n < num)); + return data[index(n)]; + } + + + /** Returns the back element */ + inline const T& last() const { + return (*this)[size() - 1]; + } + + inline T& last() { + return (*this)[size() - 1]; + } + + /** + Returns true if the given element is in the queue. + */ + bool contains(const T& e) const { + for (int i = 0; i < size(); ++i) { + if ((*this)[i] == e) { + return true; + } + } + + return false; + } + + /** + Calls delete on all objects[0...size-1] + and sets the queue size to zero. + */ + void deleteAll() { + FIND_ENDS; + + int i; + for (i = 0; i < secondEnd; ++i) { + delete data[i]; + } + + for (i = head; i < firstEnd; ++i) { + delete data[i]; + } + clear(); + } +}; + +#undef FIND_ENDS + +}; // namespace + +#endif diff --git a/externals/g3dlite/G3D/Random.h b/externals/g3dlite/G3D/Random.h new file mode 100644 index 0000000..54491d0 --- /dev/null +++ b/externals/g3dlite/G3D/Random.h @@ -0,0 +1,139 @@ +/** + @file Random.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2009-01-02 + @edited 2009-03-20 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ +#ifndef G3D_Random_h +#define G3D_Random_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/GMutex.h" + +namespace G3D { + +/** Random number generator. + + Threadsafe. + + Useful for generating consistent random numbers across platforms + and when multiple threads are involved. + + Uses the Fast Mersenne Twister (FMT-19937) algorithm. + + On average, uniform() runs about 2x-3x faster than rand(). + + @cite http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html + + On OS X, Random is about 10x faster than drand48() (which is + threadsafe) and 4x faster than rand() (which is not threadsafe). + */ +class Random { +protected: + + /** Constants (important for the algorithm; do not modify) */ + enum { + N = 624, + M = 397, + R = 31, + U = 11, + S = 7, + T = 15, + L = 18, + A = 0x9908B0DF, + B = 0x9D2C5680, + C = 0xEFC60000}; + + /** + Prevents multiple overlapping calls to generate(). + */ + Spinlock lock; + + /** State vector (these are the next N values that will be returned) */ + uint32* state; + + /** Index into state */ + int index; + + bool m_threadsafe; + + /** Generate the next N ints, and store them for readback later. + Called from bits() */ + virtual void generate(); + + /** For subclasses. The void* parameter is just to distinguish this from the + public constructor.*/ + Random(void*); + +public: + + /** \param threadsafe Set to false if you know that this random + will only be used on a single thread. This eliminates the + lock and improves performance on some platforms. + */ + Random(uint32 seed = 0xF018A4D2, bool threadsafe = true); + + virtual ~Random(); + + /** Each bit is random. Subclasses can choose to override just + this method and the other methods will all work automatically. */ + virtual uint32 bits(); + + /** Uniform random integer on the range [min, max] */ + virtual int integer(int min, int max); + + /** Uniform random float on the range [min, max] */ + virtual inline float uniform(float low, float high) { + // We could compute the ratio in double precision here for + // about 1.5x slower performance and slightly better + // precision. + return low + (high - low) * ((float)bits() / (float)0xFFFFFFFFUL); + } + + /** Uniform random float on the range [0, 1] */ + virtual inline float uniform() { + // We could compute the ratio in double precision here for + // about 1.5x slower performance and slightly better + // precision. + const float norm = 1.0f / (float)0xFFFFFFFFUL; + return (float)bits() * norm; + } + + /** Normally distributed reals. */ + virtual float gaussian(float mean, float stdev); + + /** Returns 3D unit vectors distributed according to + a cosine distribution about the z-axis. */ + virtual void cosHemi(float& x, float& y, float& z); + + /** Returns 3D unit vectors distributed according to a cosine + power distribution (\f$ \cos^k \theta \f$) about + the z-axis. */ + virtual void cosPowHemi(const float k, float& x, float& y, float& z); + + /** Returns 3D unit vectors uniformly distributed on the + hemisphere about the z-axis. */ + virtual void hemi(float& x, float& y, float& z); + + /** Returns 3D unit vectors uniformly distributed on the sphere */ + virtual void sphere(float& x, float& y, float& z); + + /** + A shared instance for when the performance and features but not + consistency of the class are desired. It is slightly (10%) + faster to use a distinct instance than to use the common one. + + Threadsafe. + */ + static Random& common(); +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Ray.h b/externals/g3dlite/G3D/Ray.h new file mode 100644 index 0000000..80df582 --- /dev/null +++ b/externals/g3dlite/G3D/Ray.h @@ -0,0 +1,371 @@ +/** + @file Ray.h + + Ray class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-07-12 + @edited 2009-06-29 + */ + +#ifndef G3D_Ray_h +#define G3D_Ray_h + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Triangle.h" + +namespace G3D { + +/** + A 3D Ray. + */ +class Ray { +private: + friend class Intersect; + + Vector3 m_origin; + + /** Unit length */ + Vector3 m_direction; + + /** 1.0 / direction */ + Vector3 m_invDirection; + + + // The following are for the "ray slope" optimization from + // "Fast Ray / Axis-Aligned Bounding Box Overlap Tests using Ray Slopes" + // by Martin Eisemann, Thorsten Grosch, Stefan Müller and Marcus Magnor + // Computer Graphics Lab, TU Braunschweig, Germany and + // University of Koblenz-Landau, Germany*/ + enum Classification {MMM, MMP, MPM, MPP, PMM, PMP, PPM, PPP, POO, MOO, OPO, OMO, OOP, OOM, OMM, OMP, OPM, OPP, MOM, MOP, POM, POP, MMO, MPO, PMO, PPO}; Classification classification; + // ray slope + float ibyj, jbyi, kbyj, jbyk, ibyk, kbyi; + // Precomputed components + float c_xy, c_xz, c_yx, c_yz, c_zx, c_zy; + +public: + + void set(const Vector3& origin, const Vector3& direction); + + inline const Vector3& origin() const { + return m_origin; + } + + /** Unit direction vector. */ + inline const Vector3& direction() const { + return m_direction; + } + + /** Component-wise inverse of direction vector. May have inf() components */ + inline const Vector3& invDirection() const { + return m_invDirection; + } + + inline Ray() { + set(Vector3::zero(), Vector3::unitX()); + } + + inline Ray(const Vector3& origin, const Vector3& direction) { + set(origin, direction); + } + + Ray(class BinaryInput& b); + + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + /** + Creates a Ray from a origin and a (nonzero) unit direction. + */ + static Ray fromOriginAndDirection(const Vector3& point, const Vector3& direction) { + return Ray(point, direction); + } + + /** Advances the origin along the direction by @a distance */ + inline Ray bump(float distance) const { + return Ray(m_origin + m_direction * distance, m_direction); + } + + /** Advances the origin along the @a bumpDirection by @a distance and returns the new ray*/ + inline Ray bump(float distance, const Vector3& bumpDirection) const { + return Ray(m_origin + bumpDirection * distance, m_direction); + } + + /** + Returns the closest point on the Ray to point. + */ + Vector3 closestPoint(const Vector3& point) const { + float t = m_direction.dot(point - m_origin); + if (t < 0) { + return m_origin; + } else { + return m_origin + m_direction * t; + } + } + + /** + Returns the closest distance between point and the Ray + */ + float distance(const Vector3& point) const { + return (closestPoint(point) - point).magnitude(); + } + + /** + Returns the point where the Ray and plane intersect. If there + is no intersection, returns a point at infinity. + + Planes are considered one-sided, so the ray will not intersect + a plane where the normal faces in the traveling direction. + */ + Vector3 intersection(const class Plane& plane) const; + + /** + Returns the distance until intersection with the sphere or the (solid) ball bounded by the sphere. + Will be 0 if inside the sphere, inf if there is no intersection. + + The ray direction is not normalized. If the ray direction + has unit length, the distance from the origin to intersection + is equal to the time. If the direction does not have unit length, + the distance = time * direction.length(). + + See also the G3D::CollisionDetection "movingPoint" methods, + which give more information about the intersection. + + \param solid If true, rays inside the sphere immediately intersect (good for collision detection). If false, they hit the opposite side of the sphere (good for ray tracing). + */ + float intersectionTime(const class Sphere& sphere, bool solid = false) const; + + float intersectionTime(const class Plane& plane) const; + + float intersectionTime(const class Box& box) const; + + float intersectionTime(const class AABox& box) const; + + /** + The three extra arguments are the weights of vertices 0, 1, and 2 + at the intersection point; they are useful for texture mapping + and interpolated normals. + */ + float intersectionTime( + const Vector3& v0, const Vector3& v1, const Vector3& v2, + const Vector3& edge01, const Vector3& edge02, + double& w0, double& w1, double& w2) const; + + /** + Ray-triangle intersection for a 1-sided triangle. Fastest version. + @cite http://www.acm.org/jgt/papers/MollerTrumbore97/ + http://www.graphics.cornell.edu/pubs/1997/MT97.html + */ + inline float intersectionTime( + const Vector3& vert0, + const Vector3& vert1, + const Vector3& vert2, + const Vector3& edge01, + const Vector3& edge02) const; + + + inline float intersectionTime( + const Vector3& vert0, + const Vector3& vert1, + const Vector3& vert2) const { + + return intersectionTime(vert0, vert1, vert2, vert1 - vert0, vert2 - vert0); + } + + + inline float intersectionTime( + const Vector3& vert0, + const Vector3& vert1, + const Vector3& vert2, + double& w0, + double& w1, + double& w2) const { + + return intersectionTime(vert0, vert1, vert2, vert1 - vert0, vert2 - vert0, w0, w1, w2); + } + + /* One-sided triangle + */ + inline float intersectionTime(const Triangle& triangle) const { + return intersectionTime( + triangle.vertex(0), triangle.vertex(1), triangle.vertex(2), + triangle.edge01(), triangle.edge02()); + } + + inline float intersectionTime( + const Triangle& triangle, + double& w0, + double& w1, + double& w2) const { + return intersectionTime(triangle.vertex(0), triangle.vertex(1), triangle.vertex(2), + triangle.edge01(), triangle.edge02(), w0, w1, w2); + } + + /** Refracts about the normal + using G3D::Vector3::refractionDirection + and bumps the ray slightly from the newOrigin. */ + Ray refract( + const Vector3& newOrigin, + const Vector3& normal, + float iInside, + float iOutside) const; + + /** Reflects about the normal + using G3D::Vector3::reflectionDirection + and bumps the ray slightly from + the newOrigin. */ + Ray reflect( + const Vector3& newOrigin, + const Vector3& normal) const; +}; + + +#define EPSILON 0.000001 +#define CROSS(dest,v1,v2) \ + dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \ + dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \ + dest[2]=v1[0]*v2[1]-v1[1]*v2[0]; + +#define DOT(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2]) + +#define SUB(dest,v1,v2) \ + dest[0]=v1[0]-v2[0]; \ + dest[1]=v1[1]-v2[1]; \ + dest[2]=v1[2]-v2[2]; + +inline float Ray::intersectionTime( + const Vector3& vert0, + const Vector3& vert1, + const Vector3& vert2, + const Vector3& edge1, + const Vector3& edge2) const { + + (void)vert1; + (void)vert2; + + // Barycenteric coords + float u, v; + + float tvec[3], pvec[3], qvec[3]; + + // begin calculating determinant - also used to calculate U parameter + CROSS(pvec, m_direction, edge2); + + // if determinant is near zero, ray lies in plane of triangle + const float det = DOT(edge1, pvec); + + if (det < EPSILON) { + return finf(); + } + + // calculate distance from vert0 to ray origin + SUB(tvec, m_origin, vert0); + + // calculate U parameter and test bounds + u = DOT(tvec, pvec); + if ((u < 0.0f) || (u > det)) { + // Hit the plane outside the triangle + return finf(); + } + + // prepare to test V parameter + CROSS(qvec, tvec, edge1); + + // calculate V parameter and test bounds + v = DOT(m_direction, qvec); + if ((v < 0.0f) || (u + v > det)) { + // Hit the plane outside the triangle + return finf(); + } + + + // Case where we don't need correct (u, v): + const float t = DOT(edge2, qvec); + + if (t >= 0.0f) { + // Note that det must be positive + return t / det; + } else { + // We had to travel backwards in time to intersect + return finf(); + } +} + + +inline float Ray::intersectionTime( + const Vector3& vert0, + const Vector3& vert1, + const Vector3& vert2, + const Vector3& edge1, + const Vector3& edge2, + double& w0, + double& w1, + double& w2) const { + + (void)vert1; + (void)vert2; + + // Barycenteric coords + float u, v; + + float tvec[3], pvec[3], qvec[3]; + + // begin calculating determinant - also used to calculate U parameter + CROSS(pvec, m_direction, edge2); + + // if determinant is near zero, ray lies in plane of triangle + const float det = DOT(edge1, pvec); + + if (det < EPSILON) { + return finf(); + } + + // calculate distance from vert0 to ray origin + SUB(tvec, m_origin, vert0); + + // calculate U parameter and test bounds + u = DOT(tvec, pvec); + if ((u < 0.0f) || (u > det)) { + // Hit the plane outside the triangle + return finf(); + } + + // prepare to test V parameter + CROSS(qvec, tvec, edge1); + + // calculate V parameter and test bounds + v = DOT(m_direction, qvec); + if ((v < 0.0f) || (u + v > det)) { + // Hit the plane outside the triangle + return finf(); + } + + float t = DOT(edge2, qvec); + + if (t >= 0) { + const float inv_det = 1.0f / det; + t *= inv_det; + u *= inv_det; + v *= inv_det; + + w0 = (1.0f - u - v); + w1 = u; + w2 = v; + + return t; + } else { + // We had to travel backwards in time to intersect + return finf(); + } +} + +#undef EPSILON +#undef CROSS +#undef DOT +#undef SUB + +}// namespace + +#endif diff --git a/externals/g3dlite/G3D/Rect2D.h b/externals/g3dlite/G3D/Rect2D.h new file mode 100644 index 0000000..2fb58c5 --- /dev/null +++ b/externals/g3dlite/G3D/Rect2D.h @@ -0,0 +1,417 @@ +/** + @file Rect2D.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-11-13 + @created 2009-11-16 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Rect2D_h +#define G3D_Rect2D_h + +// Linux defines this as a macro +#ifdef border +#undef border +#endif + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Vector2.h" + +#ifdef _MSC_VER +// Turn off "conditional expression is constant" warning; MSVC generates this +// for debug assertions in inlined methods. +# pragma warning (disable : 4127) +#endif + + +namespace G3D { + +class Any; + +/** + If you are using this class for pixel rectangles, keep in mind that the last + pixel you can draw to is at x0() + width() - 1. + */ +class Rect2D { +private: + Vector2 min, max; + + /** + Returns true if the whole polygon is clipped. + @param p Value of the point + @param axis Index [0 or 1] of the axis to clip along? + @param clipGreater Are we clipping greater than or less than the line? + @param inPoly Polygon being clipped + @param outPoly The clipped polygon + */ + template + static bool clipSide2D( + const float p, bool clipGreater, int axis, + const Array& inPoly, Array& outPoly) { + + outPoly.clear(); + int i0 = -1; + + Vector2 pt1; + bool c1 = true; + + float negate = clipGreater ? -1 : 1; + + // Find a point that is not clipped + for (i0 = 0; (i0 < inPoly.length()) && c1; ++i0) { + pt1 = inPoly[i0]; + c1 = (negate * pt1[axis]) < (negate * p); + } + + // We incremented i0 one time to many + --i0; + + if (c1) { + // We could not find an unclipped point + return true; + } + + outPoly.append(pt1); + + // for each point in inPoly, + // if the point is outside the side and the previous one was also outside, continue + // if the point is outside the side and the previous one was inside, cut the line + // if the point is inside the side and the previous one was also inside, append the points + // if the point is inside the side and the previous one was outside, cut the line + for (int i = 1; i <= inPoly.length(); ++i) { + T pt2 = inPoly[(i + i0) % inPoly.length()]; + bool c2 = (negate * pt2[axis]) < (negate * p); + + if (c1 ^ c2) { + + if (!c1 && c2 && (i > 1)) { + // Unclipped to clipped trasition and not the first iteration + outPoly.append(pt1); + } + + // only one point is clipped, find where the line crosses the clipping plane + + + float alpha; + if (pt2[axis] == pt1[axis]) { + alpha = 0; + } else { + alpha = (p - pt1[axis]) / (pt2[axis] - pt1[axis]); + } + outPoly.append(pt1.lerp(pt2, alpha)); + } else if (! (c1 || c2) && (i != 1)) { + // neither point is clipped (don't do this the first time + // because we appended the first pt before the loop) + outPoly.append(pt1); + } + + pt1 = pt2; + c1 = c2; + } + + return false; + } + +public: + + /** \param any Must either Rect2D::xywh(#, #, #, #) or Rect2D::xyxy(#, #, #, #)*/ + Rect2D(const Any& any); + + /** Converts the Rect2D to an Any. */ + operator Any() const; + + Rect2D() : min(0, 0), max(0, 0) {} + + /** Creates a rectangle at 0,0 with the given width and height*/ + Rect2D(const Vector2& wh) : min(0, 0), max(wh.x, wh.y) {} + + /** Computes a rectangle that contains both @a a and @a b. + Note that even if @a or @b has zero area, its origin will be included.*/ + Rect2D(const Rect2D& a, const Rect2D& b) { + min = a.min.min(b.min); + max = a.max.max(b.max); + } + + /** @brief Uniformly random point on the interior */ + Vector2 randomPoint() const { + return Vector2(uniformRandom(0, max.x - min.x) + min.x, + uniformRandom(0, max.y - min.y) + min.y); + } + + float width() const { + return max.x - min.x; + } + + float height() const { + return max.y - min.y; + } + + float x0() const { + return min.x; + } + + float x1() const { + return max.x; + } + + float y0() const { + return min.y; + } + + float y1() const { + return max.y; + } + + /** Min, min corner */ + Vector2 x0y0() const { + return min; + } + + Vector2 x1y0() const { + return Vector2(max.x, min.y); + } + + Vector2 x0y1() const { + return Vector2(min.x, max.y); + } + + /** Max,max corner */ + Vector2 x1y1() const { + return max; + } + + /** Width and height */ + Vector2 wh() const { + return max - min; + } + + Vector2 center() const { + return (max + min) * 0.5; + } + + float area() const { + return width() * height(); + } + + bool isFinite() const { + return (min.isFinite() && max.isFinite()); + } + + Rect2D lerp(const Rect2D& other, float alpha) const { + Rect2D out; + + out.min = min.lerp(other.min, alpha); + out.max = max.lerp(other.max, alpha); + + return out; + } + + static Rect2D xyxy(float x0, float y0, float x1, float y1) { + Rect2D r; + + r.min.x = G3D::min(x0, x1); + r.min.y = G3D::min(y0, y1); + r.max.x = G3D::max(x0, x1); + r.max.y = G3D::max(y0, y1); + + return r; + } + + static Rect2D xyxy(const Vector2& v0, const Vector2& v1) { + Rect2D r; + + r.min = v0.min(v1); + r.max = v0.max(v1); + + return r; + } + + static Rect2D xywh(float x, float y, float w, float h) { + return xyxy(x, y, x + w, y + h); + } + + static Rect2D xywh(const Vector2& v, const Vector2& w) { + return xyxy(v.x, v.y, v.x + w.x, v.y + w.y); + } + + /** Constructs a Rect2D with infinite boundaries. + Use isFinite() to test either min or max. + */ + static Rect2D inf() { + return xyxy(Vector2::inf(), Vector2::inf()); + } + + bool contains(const Vector2& v) const { + return (v.x >= min.x) && (v.y >= min.y) && (v.x <= max.x) && (v.y <= max.y); + } + + bool contains(const Rect2D& r) const { + return (min.x <= r.min.x) && (min.y <= r.min.y) && + (max.x >= r.max.x) && (max.y >= r.max.y); + } + + /** True if there is non-zero area to the intersection between @a this and @a r. + Note that two rectangles that are adjacent do not intersect because there is + zero area to the overlap, even though one of them "contains" the corners of the other.*/ + bool intersects(const Rect2D& r) const { + return (min.x < r.max.x) && (min.y < r.max.y) && + (max.x > r.min.x) && (max.y > r.min.y); + } + + /** Like intersection, but counts the adjacent case as touching. */ + bool intersectsOrTouches(const Rect2D& r) const { + return (min.x <= r.max.x) && (min.y <= r.max.y) && + (max.x >= r.min.x) && (max.y >= r.min.y); + } + + Rect2D operator*(float s) const { + return xyxy(min.x * s, min.y * s, max.x * s, max.y * s); + } + + Rect2D operator/(float s) const { + return xyxy(min / s, max / s); + } + + Rect2D operator/(const Vector2& s) const { + return xyxy(min / s, max / s); + } + + Rect2D operator+(const Vector2& v) const { + return xyxy(min + v, max + v); + } + + Rect2D operator-(const Vector2& v) const { + return xyxy(min - v, max - v); + } + + bool operator==(const Rect2D& other) const { + return (min == other.min) && (max == other.max); + } + + bool operator!=(const Rect2D& other) const { + return (min != other.min) || (max != other.max); + } + + /** Returns the corners in the order: (min,min), (max,min), (max,max), (min,max). */ + Vector2 corner(int i) const { + debugAssert(i >= 0 && i < 4); + switch (i & 3) { + case 0: + return Vector2(min.x, min.y); + case 1: + return Vector2(max.x, min.y); + case 2: + return Vector2(max.x, max.y); + case 3: + return Vector2(min.x, max.y); + default: + // Should never get here + return Vector2(0, 0); + } + } + + + /** @deprecated + @sa expand() */ + Rect2D border(float delta) const { + return Rect2D::xywh(x0() + delta, + y0() + delta, + width() - 2.0f * delta, + height() - 2.0f * delta); + } + + /** Returns a new Rect2D that is bigger/smaller by the specified amount + (negative is shrink.) */ + Rect2D expand(float delta) const { + float newX = x0() - delta; + float newY = y0() - delta; + float newW = width() + 2.0f * delta; + float newH = height() + 2.0f * delta; + + if (newW < 0.0f) { + newX = (x0() + width()) / 2.0f; + newW = 0.0f; + } + + if (newH < 0.0f) { + newY = (y0() + height()) / 2.0f; + newH = 0.0f; + } + return Rect2D::xywh(newX, newY, newW, newH); + } + + /** + Clips so that the rightmost point of the outPoly is at rect.x1 (e.g. a 800x600 window produces + rightmost point 799, not 800). The results are suitable for pixel rendering if iRounded. + Templated so that it will work for Vector2,3,4 (the z and w components are interpolated linearly). + The template parameter must define T.lerp and contain x and y components. + + If the entire polygon is clipped by a single side, the result will be empty. + The result might also have zero area but not be empty. + */ + template + void clip(const Array& inPoly, Array& outPoly) const { + + const bool greaterThan = true; + const bool lessThan = false; + const int X = 0; + const int Y = 1; + + Array temp; + + bool entirelyClipped = + clipSide2D(x0(), lessThan, X, inPoly, temp) || + clipSide2D(x1(), greaterThan, X, temp, outPoly) || + clipSide2D(y0(), lessThan, Y, outPoly, temp) || + clipSide2D(y1(), greaterThan, Y, temp, outPoly); + + if (entirelyClipped) { + outPoly.clear(); + } + } + + + /** Returns the largest, centered Rect2D that can fit inside this + while maintaining the aspect ratio of x:y. Convenient for + displaying images in odd-shaped windows. + */ + Rect2D largestCenteredSubRect(float ww, float hh) const { + float textureAspect = hh / ww; + float viewAspect = height() / width(); + + if (viewAspect > textureAspect) { + // The view is too tall + float h = width() * textureAspect; + float y = (height() - h) / 2; + return Rect2D::xywh(0, y, width(), h) + corner(0); + } else { + // The view is too wide + float w = height() / textureAspect; + float x = (width() - w) / 2; + return Rect2D::xywh(x, 0, w, height()) + corner(0); + } + } + + /** + Returns the overlap region between the two rectangles. This may have zero area + if they do not intersect. See the two-Rect2D constructor for a way to compute + a union-like rectangle. + */ + Rect2D intersect(const Rect2D& other) const { + if (intersects(other)) { + return Rect2D::xyxy(min.max(other.min), max.min(other.max)); + }else{ + return Rect2D::xywh(0, 0, 0, 0); + } + } +}; + +typedef Rect2D AABox2D; +} + +#endif diff --git a/externals/g3dlite/G3D/ReferenceCount.h b/externals/g3dlite/G3D/ReferenceCount.h new file mode 100644 index 0000000..84591c6 --- /dev/null +++ b/externals/g3dlite/G3D/ReferenceCount.h @@ -0,0 +1,570 @@ +/** + @file ReferenceCount.h + + Reference Counting Garbage Collector for C++ + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine. + @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm + + @created 2001-10-23 + @edited 2009-04-25 +*/ +#ifndef G3D_ReferenceCount_h +#define G3D_ReferenceCount_h + +#include "G3D/platform.h" +#include "G3D/debug.h" +#include "G3D/AtomicInt32.h" + +namespace G3D { + +#ifdef _MSC_VER +// Turn off "conditional expression is constant" warning; MSVC generates this +// for debug assertions in inlined methods. +# pragma warning (disable : 4127) +#endif + +/** Base class for WeakReferenceCountedPointer */ +class _WeakPtr { +public: + inline virtual ~_WeakPtr() {} + +protected: + friend class ReferenceCountedObject; + + /** Called by ReferenceCountedObject to tell a weak pointer that its underlying object was collected. */ + virtual void objectCollected() = 0; +}; + +/** Used internally by ReferenceCountedObject */ +class _WeakPtrLinkedList { +public: + _WeakPtr* weakPtr; + _WeakPtrLinkedList* next; + + inline _WeakPtrLinkedList() : weakPtr(NULL), next(NULL) {} + + /** Inserts this node into the head of the list that previously had n as its head. */ + inline _WeakPtrLinkedList(_WeakPtr* p, _WeakPtrLinkedList* n) : weakPtr(p), next(n) {} +}; + +/** + Objects that are reference counted inherit from this. Subclasses + must have a public destructor (the default destructor is fine) + and publicly inherit ReferenceCountedObject. + + Multiple inheritance from a reference counted object is dangerous-- use + at your own risk. + + ReferenceCountedPointer and ReferenceCountedObject are threadsafe. + You can create and drop references on multiple threads without + violating integrity. WeakReferenceCountedPointer is not + threadsafe. Introducing a weak pointer destroys all thread safety, + even for strong pointers to the same object (this is inherent in the + design of the class; we cannot fix it without slowing down the + performance of reference counted objects.) + + Usage Example + +
+
+class Foo : public G3D::ReferenceCountedObject {
+public:
+    int x;
+};
+
+class Bar : public Foo {};
+
+typedef G3D::ReferenceCountedPointer FooRef;
+typedef G3D::WeakReferenceCountedPointer WeakFooRef;
+typedef G3D::ReferenceCountedPointer BarRef;
+
+
+int main(int argc, char *argv[]) {
+
+    WeakFooRef x;
+
+    {
+        FooRef a = new Foo();
+
+        // Reference count == 1
+
+        x = a;
+        // Weak references do not increase count
+
+        {
+            FooRef b = a;
+            // Reference count == 2
+        }
+
+        // Reference count == 1
+    }
+    // No more strong references; object automatically deleted.
+    // x is set to NULL automatically.
+
+    // Example of using dynamic cast on reference counted objects
+    BarRef b = new Bar();
+
+    // No cast needed to go down the heirarchy.
+    FooRef f = b;
+
+    // We can't cast the reference object because it is a class.
+    // Instead we must extract the pointer and cast that:
+    b = dynamic_cast(&*f);
+
+    return 0;
+}
+
+ */ +class ReferenceCountedObject { +public: + + /** + The long name is to keep this from accidentally conflicting with + a subclass's variable name. Do not use or explicitly manipulate + this value--its type may change in the future and is not part + of the supported API. + */ + AtomicInt32 ReferenceCountedObject_refCount; + + /** + Linked list of all weak pointers that reference this (some may be + on the stack!). Do not use or explicitly manipulate this value. + */ + _WeakPtrLinkedList* ReferenceCountedObject_weakPointer; + +protected: + + ReferenceCountedObject(); + +public: + + /** Automatically called immediately before the object is deleted. + This is not called from the destructor because it needs to be invoked + before the subclass destructor. + */ + void ReferenceCountedObject_zeroWeakPointers(); + + virtual ~ReferenceCountedObject(); + + + /** + Note: copies will initially start out with 0 + references and 0 weak references like any other object. + */ + ReferenceCountedObject(const ReferenceCountedObject& notUsed); + + ReferenceCountedObject& operator=(const ReferenceCountedObject& other); +}; + + + +/** + Use ReferenceCountedPointer in place of T* in your program. + T must subclass ReferenceCountedObject. +@deprecated To be replaced by boost::shared_ptr in 7.0 + */ +template +class ReferenceCountedPointer { +private: + + T* m_pointer; + +public: + typedef T element_type; + + inline T* pointer() const { + return m_pointer; + } + +private: + + /** Nulls out the pointer and drops a reference. If the reference + count hits zero. */ + void zeroPointer() { + if (m_pointer != NULL) { + + ReferenceCountedObject* pointer = ((ReferenceCountedObject*)m_pointer); + debugAssert(G3D::isValidHeapPointer(m_pointer)); + debugAssertM(pointer->ReferenceCountedObject_refCount.value() > 0, + "Dangling reference detected."); + + // Only delete if this instance caused the count to hit + // exactly zero. If there is a race condition, the value + // may be zero after decrement returns, but only one of + // the instances will get a zero return value. + if (pointer->ReferenceCountedObject_refCount.decrement() == 0) { + // We held the last reference, so delete the object. + // This test is threadsafe because there is no way for + // the reference count to increase after the last + // reference was dropped (assuming the application does + // not voilate the class abstraction). + //debugPrintf(" delete 0x%x\n", m_pointer); + + // We must zero the weak pointers *before* deletion in case there + // are cycles of weak references. + // Note that since there are no strong references at this point, + // it is perfectly fair to zero the weak pointers anyway. + pointer->ReferenceCountedObject_zeroWeakPointers(); + delete pointer; + } + + m_pointer = NULL; + } + } + + /** Non-atomic (except for the referencec increment). Can only be + called in contexts like the copy constructor or initial + constructor where it is known that the reference count will + not hit zero on some other thread. */ + void setPointer(T* x) { + if (x != m_pointer) { + zeroPointer(); + + if (x != NULL) { + debugAssert(G3D::isValidHeapPointer(x)); + + m_pointer = x; + + // Note that the ref count can be zero if this is the + // first pointer to it + ReferenceCountedObject* pointer = (ReferenceCountedObject*)m_pointer; + debugAssertM(pointer->ReferenceCountedObject_refCount.value() >= 0, + "Negative reference count detected."); + pointer->ReferenceCountedObject_refCount.increment(); + } + } + } + +public: + + inline ReferenceCountedPointer() : m_pointer(NULL) {} + + /** + Allow silent cast to the base class. + +
+        SubRef  s = new Sub();
+        BaseRef b = s;
+      
+ + i.e., compile-time subtyping rule + RCP<T> <: RCP<S> if T <: S + */ + template + inline ReferenceCountedPointer(const ReferenceCountedPointer& p) : + m_pointer(NULL) { + setPointer(p.pointer()); + } + +# if (! defined(MSC_VER) || (MSC_VER >= 1300)) + /** + Explicit cast to a subclass. Acts like dynamic cast; the result will be NULL if + the cast cannot succeed. Not supported on VC6. +
+        SubRef  s = new Sub();
+        BaseRef b = s;
+        s = b.downcast();   // Note that the template argument is the object type, not the pointer type.
+      
+ */ + template + ReferenceCountedPointer downcast() { + return ReferenceCountedPointer(dynamic_cast(m_pointer)); + } + + template + const ReferenceCountedPointer downcast() const { + return ReferenceCountedPointer(dynamic_cast(m_pointer)); + } +# endif + + // We need an explicit version of the copy constructor as well or + // the default copy constructor will be used. + inline ReferenceCountedPointer(const ReferenceCountedPointer& p) : m_pointer(NULL) { + setPointer(p.m_pointer); + } + + /** Allows construction from a raw pointer. That object will thereafter be + reference counted -- do not call delete on it. + + Use of const allows downcast on const references */ + inline ReferenceCountedPointer(const T* p) : m_pointer(NULL) { + // only const constructor is defined to remove ambiguity using NULL + setPointer(const_cast(p)); + } + + + inline ~ReferenceCountedPointer() { + zeroPointer(); + } + + inline size_t hashCode() const { + return reinterpret_cast(m_pointer);; + } + + inline const ReferenceCountedPointer& operator=(const ReferenceCountedPointer& p) { + setPointer(p.m_pointer); + return *this; + } + + inline ReferenceCountedPointer& operator=(T* p) { + setPointer(p); + return *this; + } + + inline bool operator==(const ReferenceCountedPointer& y) const { + return (m_pointer == y.m_pointer); + } + + inline bool operator!=(const ReferenceCountedPointer& y) const { + return (m_pointer != y.m_pointer); + } + + bool operator < (const ReferenceCountedPointer& y) const { + return (m_pointer < y.m_pointer); + } + + bool operator > (const ReferenceCountedPointer& y) const { + return (m_pointer > y.m_pointer); + } + + bool operator <= (const ReferenceCountedPointer& y) const { + return (m_pointer <= y.m_pointer); + } + + bool operator >= (const ReferenceCountedPointer& y) const { + return (m_pointer >= y.m_pointer); + } + + inline T& operator*() const { + debugAssertM(m_pointer != NULL, "Dereferenced a NULL ReferenceCountedPointer"); + return (*m_pointer); + } + + inline T* operator->() const { + debugAssertM(m_pointer != NULL, "Dereferenced a NULL ReferenceCountedPointer"); + return m_pointer; + } + + inline bool isNull() const { + return (m_pointer == NULL); + } + + inline bool notNull() const { + return (m_pointer != NULL); + } + + // TODO: distinguish between last strong and last any pointer + /** + Returns true if this is the last reference to an object. + Useful for flushing memoization caches-- a cache that holds the last + reference is unnecessarily keeping an object alive. + + Not threadsafe. + + @deprecated Use WeakReferenceCountedPointer for caches + */ + inline int isLastReference() const { + return (m_pointer->ReferenceCountedObject_refCount.value() == 1); + } +}; + + +/** + A weak pointer allows the object it references to be garbage collected. + Weak pointers are commonly used in caches, where it is important to hold + a pointer to an object without keeping that object alive solely for the + cache's benefit (i.e., the object can be collected as soon as all + pointers to it outside the cache are gone). They are also convenient + for adding back-pointers in tree and list structures. + + Weak pointers may become NULL at any point (when their target is collected). + Therefore the only way to reference the target is to convert to a strong + pointer and then check that it is not NULL. + +@deprecated To be replaced by boost::weak_ptr in 7.0 + */ +template +class WeakReferenceCountedPointer : public _WeakPtr { +private: + + /** NULL if the object has been collected. */ + T* pointer; + +public: + /** + Creates a strong pointer, which prevents the object from being + garbage collected. The strong pointer may be NULL, which means + that the underlying. + */ + // There is intentionally no way to check if the + // WeakReferenceCountedPointer has a null reference without + // creating a strong pointer since there is no safe way to use + // that information-- the pointer could be collected by a + // subsequent statement. + ReferenceCountedPointer createStrongPtr() const { + // TODO: What if the object's destructor is called while we + // are in this method? + return ReferenceCountedPointer(pointer); + } + +private: + + /** Thread issues: safe because this is only called when another + object is guaranteed to keep p alive for the duration of this + call. */ + void setPointer(T* p) { + // TODO: must prevent the object from being collected while in + // this method + + zeroPointer(); + pointer = p; + + if (pointer != NULL) { + // TODO: threadsafe: must update the list atomically + + // Add myself to the head of my target's list of weak pointers + _WeakPtrLinkedList* head = + new _WeakPtrLinkedList + (this, + pointer->ReferenceCountedObject_weakPointer); + + pointer->ReferenceCountedObject_weakPointer = head; + } else { + + } + } + + + /** + Removes this from its target's list of weak pointers. Called + when the weak pointer goes out of scope. + + Thread issues: depends on the thread safety of createStrongPtr. + */ + void zeroPointer() { + // Grab a strong reference to prevent the object from being collected while we + // are traversing its list. + ReferenceCountedPointer strong = createStrongPtr(); + + // If the following test fails then the object was collected before we + // reached it. + if (strong.notNull()) { + debugAssertM(((ReferenceCountedObject*)pointer)->ReferenceCountedObject_weakPointer != NULL, + "Weak pointer exists without a backpointer from the object."); + + // Remove myself from my target's list of weak pointers + _WeakPtrLinkedList** node = &((ReferenceCountedObject*)pointer)->ReferenceCountedObject_weakPointer; + while ((*node)->weakPtr != this) { + node = &((*node)->next); + debugAssertM(*node != NULL, + "Weak pointer exists without a backpointer from the object (2)."); + } + + // Node must now point at the node for me. Remove node and + // close the linked list behind it. + _WeakPtrLinkedList* temp = *node; + *node = temp->next; + + // Now delete the node corresponding to me + delete temp; + } + + pointer = NULL; + } + +public: + + WeakReferenceCountedPointer() : pointer(0) {} + + /** + Allow compile time subtyping rule + RCP<T> <: RCP<S> if T <: S + */ + template + inline WeakReferenceCountedPointer(const WeakReferenceCountedPointer& p) : pointer(0) { + // Threadsafe: the object cannot be collected while the other pointer exists. + setPointer(p.pointer); + } + + template + inline WeakReferenceCountedPointer(const ReferenceCountedPointer& p) : pointer(0) { + // Threadsafe: the object cannot be collected while the other + // pointer exists. + setPointer(p.pointer()); + } + + // Gets called a *lot* when weak pointers are on the stack + WeakReferenceCountedPointer( + const WeakReferenceCountedPointer& weakPtr) : pointer(0) { + setPointer(weakPtr.pointer); + } + + WeakReferenceCountedPointer( + const ReferenceCountedPointer& strongPtr) : pointer(0) { + setPointer(strongPtr.pointer()); + } + + ~WeakReferenceCountedPointer() { + zeroPointer(); + } + + WeakReferenceCountedPointer& operator=(const WeakReferenceCountedPointer& other) { + // Threadsafe: the object cannot be collected while the other pointer exists. + + // I now point at other's target + setPointer(other.pointer); + + return *this; + } + + WeakReferenceCountedPointer& operator=(const ReferenceCountedPointer& other) { + + // Threadsafe: the object cannot be collected while the other pointer exists. + + // I now point at other's target + setPointer(other.pointer()); + + return *this; + } + + bool operator==(const WeakReferenceCountedPointer& other) const { + return pointer == other.pointer; + } + + bool operator!=(const WeakReferenceCountedPointer& other) const { + return pointer != other.pointer; + } + + bool operator < (const WeakReferenceCountedPointer& y) const { + return (pointer < y.pointer); + } + + bool operator > (const WeakReferenceCountedPointer& y) const { + return (pointer > y.pointer); + } + + bool operator <= (const WeakReferenceCountedPointer& y) const { + return (pointer <= y.pointer); + } + + bool operator >= (const ReferenceCountedPointer& y) const { + return (pointer >= y.pointer); + } + +protected: + + /** Invoked by the destructor on ReferenceCountedPointer. */ + void objectCollected() { + debugAssertM(pointer != NULL, + "Removed a weak pointer twice."); + pointer = NULL; + } + +}; + +} // namespace + +#endif + diff --git a/externals/g3dlite/G3D/RegistryUtil.h b/externals/g3dlite/G3D/RegistryUtil.h new file mode 100644 index 0000000..4b47be5 --- /dev/null +++ b/externals/g3dlite/G3D/RegistryUtil.h @@ -0,0 +1,97 @@ +/** + @file RegistryUtil.h + + @created 2006-04-06 + @edited 2006-04-06 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. +*/ + +#ifndef G3D_REGISTRYUTIL_H +#define G3D_REGISTRYUTIL_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" + +// This file is only used on Windows +#ifdef G3D_WIN32 + +#include + +namespace G3D { + +/** + Provides generalized Windows registry querying. + + All key names are one string in the format: + "[base key]\[sub-keys]" + + A value must now be provided for every query. + An empty value string will use the (Default) value. + + [base key] can be any of the following: + HKEY_CLASSES_ROOT + HKEY_CURRENT_CONFIG + HKEY_CURRENT_USER + HKEY_LOCAL_MACHINE + HKEY_PERFORMANCE_DATA + HKEY_PERFORMANCE_NLSTEXT + HKEY_PERFORMANCE_TEXT + HKEY_USERS + + valueExists() should be used to validate a key+value before reading or writing + to ensure that a debug assert or false return is for a different error during + reads and writes. + + All read and write calls will assert when a key will not open for reasons other + that it does not exist. All read and write calls will assert when the value cannot + be read or written for any reason. +*/ +class RegistryUtil { + +public: + /** returns true if the key exists and the current user has permission to read */ + static bool keyExists(const std::string& key); + + /** returns true if the key exists and the current user has permission to read */ + static bool valueExists(const std::string& key, const std::string& value); + + /** returns false if the key could not be read for any reason. */ + static bool readInt32(const std::string& key, const std::string& value, int32& data); + + /** + Reads an arbitrary amount of data from a binary registry key. + returns false if the key could not be read for any reason. + + @beta + @param data pointer to the output buffer of sufficient size. Pass NULL as data in order to have available data size returned in dataSize. + @param dataSize size of the output buffer. When NULL is passed for data, contains the size of available data on successful return. + */ + static bool readBytes(const std::string& key, const std::string& value, uint8* data, uint32& dataSize); + + /** returns false if the key could not be read for any reason. */ + static bool readString(const std::string& key, const std::string& value, std::string& data); + + /** returns false if the key could not be written for any reason. */ + static bool writeInt32(const std::string& key, const std::string& value, int32 data); + + /** + Writes an arbitrary amount of data to a binary registry key. + returns false if the key could not be written for any reason. + + @param data pointer to the input buffer + @param dataSize size of the input buffer that should be written + */ + static bool writeBytes(const std::string& key, const std::string& value, const uint8* data, uint32 dataSize); + + /** returns false if the key could not be written for any reason. */ + static bool writeString(const std::string& key, const std::string& value, const std::string& data); + +}; + +} // namespace G3D + +#endif // G3D_WIN32 + +#endif // G3D_REGISTRYTUIL_H diff --git a/externals/g3dlite/G3D/Set.h b/externals/g3dlite/G3D/Set.h new file mode 100644 index 0000000..9a8e1b6 --- /dev/null +++ b/externals/g3dlite/G3D/Set.h @@ -0,0 +1,186 @@ +/** + @file Set.h + + Hash set + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-12-09 + @edited 2009-06-10 + */ + +#ifndef G3D_Set_h +#define G3D_Set_h + +#include "G3D/platform.h" +#include "G3D/Table.h" +#include "G3D/MemoryManager.h" +#include +#include + +namespace G3D { + +/** + An unordered data structure that has at most one of each element. + Provides O(1) time insert, remove, and member test (contains). + + Set uses G3D::Table internally, which means that the template type T + must define a hashCode and operator== function. See G3D::Table for + a discussion of these functions. + */ +// There is not copy constructor or assignment operator defined because +// the default ones are correct for Set. +template, class EqualsFunc = EqualsTrait > +class Set { + + /** + If an object is a member, it is contained in + this table. + */ + Table memberTable; + +public: + + void clearAndSetMemoryManager(const MemoryManager::Ref& m) { + memberTable.clearAndSetMemoryManager(m); + } + + virtual ~Set() {} + + int size() const { + return (int)memberTable.size(); + } + + bool contains(const T& member) const { + return memberTable.containsKey(member); + } + + /** + Inserts into the table if not already present. + */ + void insert(const T& member) { + memberTable.set(member, true); + } + + /** + Returns true if the element was present and removed. Returns false + if the element was not present. + */ + bool remove(const T& member) { + return memberTable.remove(member); + } + + /** If @a member is present, sets @a removed to the element + being removed and returns true. Otherwise returns false + and does not write to @a removed. This is useful when building + efficient hashed data structures that wrap Set. + */ + bool getRemove(const T& member, T& removed) { + bool ignore; + return memberTable.getRemove(member, removed, ignore); + } + + /** If a value that is EqualsFunc to @a member is present, returns a pointer to the + version stored in the data structure, otherwise returns NULL. + */ + const T* getPointer(const T& member) const { + return memberTable.getKeyPointer(member); + } + + Array getMembers() const { + return memberTable.getKeys(); + } + + void getMembers(Array& keyArray) const { + memberTable.getKeys(keyArray); + } + + void clear() { + memberTable.clear(); + } + + void deleteAll() { + getMembers().deleteAll(); + clear(); + } + + /** + C++ STL style iterator variable. See begin(). + */ + class Iterator { + private: + friend class Set; + + // Note: this is a Table iterator, we are currently defining + // Set iterator + typename Table::Iterator it; + + Iterator(const typename Table::Iterator& it) : it(it) {} + + public: + inline bool operator!=(const Iterator& other) const { + return !(*this == other); + } + + bool hasMore() const { + return it.hasMore(); + } + + bool operator==(const Iterator& other) const { + return it == other.it; + } + + /** + Pre increment. + */ + Iterator& operator++() { + ++it; + return *this; + } + + /** + Post increment (slower than preincrement). + */ + Iterator operator++(int) { + Iterator old = *this; + ++(*this); + return old; + } + + const T& operator*() const { + return it->key; + } + + T* operator->() const { + return &(it->key); + } + + operator T*() const { + return &(it->key); + } + }; + + + /** + C++ STL style iterator method. Returns the first member. + Use preincrement (++entry) to get to the next element. + Do not modify the set while iterating. + */ + Iterator begin() const { + return Iterator(memberTable.begin()); + } + + + /** + C++ STL style iterator method. Returns one after the last iterator + element. + */ + const Iterator end() const { + return Iterator(memberTable.end()); + } +}; + +} + +#endif + diff --git a/externals/g3dlite/G3D/SmallArray.h b/externals/g3dlite/G3D/SmallArray.h new file mode 100644 index 0000000..41f9959 --- /dev/null +++ b/externals/g3dlite/G3D/SmallArray.h @@ -0,0 +1,155 @@ +/** + @file SmallArray.h + + @created 2009-04-26 + @edited 2009-04-26 + + Copyright 2000-2009, Morgan McGuire, http://graphics.cs.williams.edu + All rights reserved. + */ +#ifndef G3D_SmallArray_h +#define G3D_SmallArray_h + +#include "G3D/platform.h" +#include "G3D/Array.h" + +namespace G3D { + +/** Embeds \a N elements to reduce allocation time and increase + memory coherence when working with arrays of arrays. + Offers a limited subset of the functionality of G3D::Array.*/ +template +class SmallArray { +private: + int m_size; + + /** First N elements */ + T m_embedded[N]; + + /** Remaining elements */ + Array m_rest; + +public: + + SmallArray() : m_size(0) {} + + inline int size() const { + return m_size; + } + + void resize(int n, bool shrinkIfNecessary = true) { + m_rest.resize(std::max(0, n - N), shrinkIfNecessary); + m_size = n; + } + + void clear(bool shrinkIfNecessary = true) { + resize(0, shrinkIfNecessary); + } + + inline T& operator[](int i) { + debugAssert(i < m_size && i >= 0); + if (i < N) { + return m_embedded[i]; + } else { + return m_rest[i - N]; + } + } + + inline const T& operator[](int i) const { + debugAssert(i < m_size && i >= 0); + if (i < N) { + return m_embedded[i]; + } else { + return m_rest[i - N]; + } + } + + inline void push(const T& v) { + ++m_size; + if (m_size <= N) { + m_embedded[m_size - 1] = v; + } else { + m_rest.append(v); + } + } + + inline void append(const T& v) { + push(v); + } + + void fastRemove(int i) { + debugAssert(i < m_size && i >= 0); + if (i < N) { + if (m_size <= N) { + // Exclusively embedded + m_embedded[i] = m_embedded[m_size - 1]; + } else { + // Move one down from the rest array + m_embedded[i] = m_rest.pop(); + } + } else { + // Removing from the rest array + m_rest.fastRemove(i - N); + } + --m_size; + } + + T pop() { + debugAssert(m_size > 0); + if (m_size <= N) { + // Popping from embedded, don't need a temporary + --m_size; + return m_embedded[m_size]; + } else { + // Popping from rest + --m_size; + return m_rest.pop(); + } + } + + inline void popDiscard() { + debugAssert(m_size > 0); + if (m_size > N) { + m_rest.popDiscard(); + } + --m_size; + } + + inline T& next() { + ++m_size; + if (m_size <= N) { + return m_embedded[m_size - 1]; + } else { + return m_rest.next(); + } + } + + bool contains(const T& value) const { + for (int i = std::min(m_size, N) - 1; i >= 0; --i) { + if (m_embedded[i] == value) { + return true; + } + } + return m_rest.contains(value); + } + + template + SmallArray& operator=(const Array& src) { + resize(src.size()); + for (int i = 0; i < src.size(); ++i) { + (*this)[i] = src[i]; + } + return *this; + } + + inline const T& last() const { + return (*this)[size() - 1]; + } + + inline T& last() { + return (*this)[size() - 1]; + } +}; + +} +#endif diff --git a/externals/g3dlite/G3D/Sphere.h b/externals/g3dlite/G3D/Sphere.h new file mode 100644 index 0000000..595b61c --- /dev/null +++ b/externals/g3dlite/G3D/Sphere.h @@ -0,0 +1,148 @@ +/** + @file Sphere.h + + Sphere class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2008-10-07 + */ + +#ifndef G3D_SPHERE_H +#define G3D_SPHERE_H + +#include "G3D/platform.h" +#include "G3D/Vector3.h" +#include "G3D/Array.h" +#include "G3D/Sphere.h" + +namespace G3D { + +/** + Sphere. + */ +class Sphere { +private: + + static int32 dummy; + +public: + Vector3 center; + float radius; + + Sphere() { + center = Vector3::zero(); + radius = 0; + } + + Sphere(class BinaryInput& b); + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + Sphere( + const Vector3& center, + float radius) { + + this->center = center; + this->radius = radius; + } + + virtual ~Sphere() {} + + bool operator==(const Sphere& other) const { + return (center == other.center) && (radius == other.radius); + } + + bool operator!=(const Sphere& other) const { + return !((center == other.center) && (radius == other.radius)); + } + + /** + Returns true if point is less than or equal to radius away from + the center. + */ + bool contains(const Vector3& point) const; + + bool contains(const Sphere& other) const; + + /** + @deprecated Use culledBy(Array&) + */ + bool culledBy( + const class Plane* plane, + int numPlanes, + int32& cullingPlaneIndex, + const uint32 testMask, + uint32& childMask) const; + + /** + @deprecated Use culledBy(Array&) + */ + bool culledBy( + const class Plane* plane, + int numPlanes, + int32& cullingPlaneIndex = dummy, + const uint32 testMask = 0xFFFFFFFF) const; + + /** + See AABox::culledBy + */ + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex, + const uint32 testMask, + uint32& childMask) const; + + /** + Conservative culling test that does not produce a mask for children. + */ + bool culledBy( + const Array& plane, + int32& cullingPlaneIndex = dummy, + const uint32 testMask = 0xFFFFFFFF) const; + + virtual std::string toString() const; + + float volume() const; + + float area() const; + + /** + Uniformly distributed on the surface. + */ + Vector3 randomSurfacePoint() const; + + /** + Uniformly distributed on the interior (includes surface) + */ + Vector3 randomInteriorPoint() const; + + void getBounds(class AABox& out) const; + + bool intersects(const Sphere& other) const; + + /** Translates the sphere */ + Sphere operator+(const Vector3& v) const { + return Sphere(center + v, radius); + } + + /** Translates the sphere */ + Sphere operator-(const Vector3& v) const { + return Sphere(center - v, radius); + } + + /** Sets this to the smallest sphere that encapsulates both */ + void merge(const Sphere& s); +}; + +} + +template <> struct HashTrait { + static size_t hashCode(const G3D::Sphere& key) { + return static_cast(key.center.hashCode() + (key.radius * 13)); + } +}; + + +#endif diff --git a/externals/g3dlite/G3D/Spline.h b/externals/g3dlite/G3D/Spline.h new file mode 100644 index 0000000..fdd29e6 --- /dev/null +++ b/externals/g3dlite/G3D/Spline.h @@ -0,0 +1,367 @@ +/** + @file Spline.h + + @author Morgan McGuire, http://graphics.cs.williams.edu + */ + +#ifndef G3D_SPLINE_H +#define G3D_SPLINE_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/g3dmath.h" +#include "G3D/Matrix4.h" +#include "G3D/Vector4.h" + +namespace G3D { + +/** Common implementation code for all G3D::Spline template parameters */ +class SplineBase { +public: + + /** Times at which control points occur. Must have the same + number of elements as Spline::control. */ + Array time; + + /** If cyclic, then the control points will be assumed to wrap around. + If not cyclic, then the tangents at the ends of the spline + point to the final control points.*/ + bool cyclic; + + /** For a cyclic spline, this is the time elapsed between the last + control point and the first. If less than or equal to zero this is + assumed to be: + + (time[0] - time[1] + . + time[time.size() - 1] - time[time.size() - 2]) / 2. + */ + float finalInterval; + + SplineBase() : cyclic(true), finalInterval(-1) {} + + virtual ~SplineBase() {} + + /** See specification for Spline::finalInterval; this handles the + non-positive case. Returns 0 if not cyclic. */ + float getFinalInterval() const; + + /** Returns the amount of time covered by this spline in one + period. For a cyclic spline, this contains the final + interval.*/ + float duration() const; + + /** Computes the derivative spline basis from the control point version. */ + static Matrix4 computeBasis(); + +protected: + + /** Assumes that t0 <= s < tn. called by computeIndex. */ + void computeIndexInBounds(float s, int& i, float& u) const; + +public: + + /** + Given a time @a s, finds @a i and 0 <= @a u < 1 such that + @a s = time[@a i] * @a u + time[@a i + 1] * (1 - @a u). Note that + @a i may be outside the bounds of the time and control arrays; + use getControl to handle wraparound and extrapolation issues. + + This function takes expected O(1) time for control points with + uniform time sampled control points or for uniformly + distributed random time samples, but may take O( log time.size() ) time + in the worst case. + + Called from evaluate(). + */ + void computeIndex(float s, int& i, float& u) const; +}; + + +/** + Smooth parameteric curve implemented using a piecewise 3rd-order + Catmull-Rom spline curve. The spline is considered infinite and may + either continue linearly from the specified control points or cycle + through them. Control points are spaced uniformly in time at unit + intervals by default, but irregular spacing may be explicitly + specified. + + The dimension of the spline can be set by varying the Control + template parameter. For a 1D function, use Spline. For a + curve in the plane, Spline. Note that any template + parameter that supports operator+(Control) and operator*(float) can + be used; you can make splines out of G3D::Vector4, G3D::Matrix3, or + your own classes. + + To provide shortest-path interpolation, subclass G3D::Spline and + override ensureShortestPath(). To provide normalization of + interpolated points (e.g., projecting Quats onto the unit + hypersphere) override correct(). + + See Real Time Rendering, 2nd edition, ch 12 for a general discussion + of splines and their properties. + + @sa G3D::UprightSpline, G3D::QuatSpline + */ +template +class Spline : public SplineBase { +protected: + /** The additive identity control point. */ + Control zero; + +public: + + /** Control points. Must have the same number of elements as + Spline::time.*/ + Array control; + + Spline() { + static Control x; + // Hide the fact from C++ that we are using an + // uninitialized variable here by pointer arithmetic. + // This is ok because any type that is a legal control + // point also supports multiplication by float. + zero = *(&x) * 0.0f; + } + + /** Appends a control point at a specific time that must be + greater than that of the previous point. */ + void append(float t, const Control& c) { + debugAssertM((time.size() == 0) || (t > time.last()), + "Control points must have monotonically increasing times."); + time.append(t); + control.append(c); + debugAssert(control.size() == time.size()); + } + + + /** Appends control point spaced in time based on the previous + control point, or spaced at unit intervals if this is the + first control point. */ + void append(const Control& c) { + switch (time.size()) { + case 0: + append(0, c); + break; + + case 1: + if (time[0] == 0) { + append(1, c); + } else { + append(time[0], c); + } + break; + + default: + append(2 * time[time.size() - 1] - time[time.size() - 2], c); + } + debugAssert(control.size() == time.size()); + } + + /** Erases all control points and times, but retains the state of + cyclic and finalInterval. + */ + void clear() { + control.clear(); + time.clear(); + } + + + /** Number of control points */ + int size() const { + debugAssert(time.size() == control.size()); + return control.size(); + } + + + /** Returns the requested control point and time sample based on + array index. If the array index is out of bounds, wraps (for + a cyclic spline) or linearly extrapolates (for a non-cyclic + spline), assuming time intervals follow the first or last + sample recorded. + + Calls correct() on the control point if it was extrapolated. + + Returns 0 if there are no control points. + + @sa Spline::control and Spline::time for the underlying + control point array; Spline::computeIndex to find the index + given a time. + */ + void getControl(int i, float& t, Control& c) const { + int N = control.size(); + if (N == 0) { + c = zero; + t = 0; + } else if (cyclic) { + c = control[iWrap(i, N)]; + + if (i < 0) { + // Wrapped around bottom + + // Number of times we wrapped around the cyclic array + int wraps = (N + 1 - i) / N; + int j = (i + wraps * N) % N; + t = time[j] - wraps * duration(); + + } else if (i < N) { + + t = time[i]; + + } else { + // Wrapped around top + + // Number of times we wrapped around the cyclic array + int wraps = i / N; + int j = i % N; + t = time[j] + wraps * duration(); + } + + } else if (i < 0) { + // Are there enough points to extrapolate? + if (N >= 2) { + // Step away from control point 0 + float dt = time[1] - time[0]; + + // Extrapolate (note; i is negative) + c = control[1] * float(i) + control[0] * float(1 - i); + correct(c); + t = dt * i + time[0]; + + } else { + // Just clamp + c = control[0]; + + // Only 1 time; assume 1s intervals + t = time[0] + i; + } + + } else if (i >= N) { + if (N >= 2) { + float dt = time[N - 1] - time[N - 2]; + + // Extrapolate + c = control[N - 1] * float(i - N + 2) + control[N - 2] * -float(i - N + 1); + correct(c); + t = time[N - 1] + dt * (i - N + 1); + + } else { + // Return the last, clamping + c = control.last(); + // Only 1 time; assume 1s intervals + t = time[0] + i; + } + } else { + // In bounds + c = control[i]; + t = time[i]; + } + } + +protected: + + /** Returns a series of N control points and times, fixing + boundary issues. The indices may be assumed to be treated + cyclically. */ + void getControls(int i, float* T, Control* A, int N) const { + for (int j = 0; j < N; ++j) { + getControl(i + j, T[j], A[j]); + } + ensureShortestPath(A, N); + } + + /** + Mutates the array of N control points. It is useful to override this + method by one that wraps the values if they are angles or quaternions + for which "shortest path" interpolation is significant. + */ + virtual void ensureShortestPath(Control* A, int N) const { (void)A; (void) N;} + + /** Normalize or otherwise adjust this interpolated Control. */ + virtual void correct(Control& A) const { (void)A; } + +public: + + + /** + Return the position at time s. The spline is defined outside + of the time samples by extrapolation or cycling. + */ + Control evaluate(float s) const { + debugAssertM(control.size() == time.size(), "Corrupt spline: wrong number of control points."); + + /* + @cite http://www.gamedev.net/reference/articles/article1497.asp + Derivation of basis matrix follows. + + Given control points with positions p[i] at times t[i], 0 <= i <= 3, find the position + at time t[1] <= s <= t[2]. + + Let u = s - t[0] + Let U = [u^0 u^1 u^2 u^3] = [1 u u^2 u^3] + Let dt0 = t[0] - t[-1] + Let dt1 = t[1] - t[0] + Let dt2 = t[2] - t[1] + */ + + // Index of the first control point (i.e., the u = 0 point) + int i = 0; + // Fractional part of the time + float u = 0; + + computeIndex(s, i, u); + + Control p[4]; + float t[4]; + getControls(i - 1, t, p, 4); + float dt0 = t[1] - t[0]; + float dt1 = t[2] - t[1]; + float dt2 = t[3] - t[2]; + + static const Matrix4 basis = computeBasis(); + + // Powers of u + Vector4 uvec((float)(u*u*u), (float)(u*u), (float)u, 1.0f); + + // Compute the weights on each of the control points. + const Vector4& weights = uvec * basis; + + // Compute the weighted sum of the neighboring control points. + Control sum; + + const Control& p0 = p[0]; + const Control& p1 = p[1]; + const Control& p2 = p[2]; + const Control& p3 = p[3]; + + const Control& dp0 = p1 + (p0*-1.0f); + const Control& dp1 = p2 + (p1*-1.0f); + const Control& dp2 = p3 + (p2*-1.0f); + + // The factor of 1/2 from averaging two time intervals is + // already factored into the basis + + // tan1 = (dp0 / dt0 + dp1 / dt1) * ((dt0 + dt1) * 0.5); + // The last term normalizes for unequal time intervals + float x = (dt0 + dt1) * 0.5f; + float n0 = x / dt0; + float n1 = x / dt1; + float n2 = x / dt2; + const Control& dp1n1 = dp1 * n1; + const Control& tan1 = dp0 * n0 + dp1n1; + const Control& tan2 = dp1n1 + dp2 * n2; + + sum = + tan1 * weights[0]+ + p1 * weights[1] + + p2 * weights[2] + + tan2 * weights[3]; + + + correct(sum); + return sum; + } +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Stopwatch.h b/externals/g3dlite/G3D/Stopwatch.h new file mode 100644 index 0000000..3f2aa9c --- /dev/null +++ b/externals/g3dlite/G3D/Stopwatch.h @@ -0,0 +1,144 @@ +/** + @file Stopwatch.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2005-10-05 + @edited 2009-05-10 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Stopwatch_h +#define G3D_Stopwatch_h + +#include "G3D/platform.h" +#include "G3D/Queue.h" +#include "G3D/G3DGameUnits.h" +#include "G3D/g3dmath.h" + +namespace G3D { + +/** + \brief Accurately measure durations and framerates. + + Example 1: For profiling code in the context of a rendering loop: +
+      sw.tick();
+      ...timed code...
+      sw.tock();
+
+      screenPrintf("%f\n", sw.smoothFPS());
+    
+ + + Example 2: For profiling pieces of a sequence: +
+    Stopwatch sw;
+    slowOperation();
+    sw.after("slowOperation");
+    kdTree.balance();
+    sw.after("Balance tree");
+   
+ */ +class Stopwatch { +private: + + std::string myName; + double startTime; + std::string prevMark; + double prevTime; + + /** True between tick and tock */ + bool inBetween; + + /** The initial cycle count. */ + uint64 cycleStart; + + /** The time at which tick was called. */ + RealTime timeStart; + + /** The time at which the previous tock was called, -1 if never. */ + RealTime lastTockTime; + + RealTime lastDuration; + int64 lastCycleCount; + + /** Frames per second. */ + double m_fps; + + /** Weighted fps */ + double emwaFPS; + double m_smoothFPS; + + /** Weighted duration */ + RealTime emwaDuration; + + /** The overhead for calling into the class. */ + int64 cycleOverhead; + + /** Called from the constructor. */ + void computeOverhead(); + +public: + + Stopwatch(const std::string& name = "Stopwatch"); + + /** Returns the number of times that tick was called per wall-clock second; + e.g. frames-per-second. */ + double FPS() const { + return m_fps; + } + + /** Amount of time between the most recent tick and tock calls. 0 if tick has + never been called. */ + RealTime elapsedTime() const { + return lastDuration; + } + + /** Time-smoothed value that is stable to the nearest 1%. + This is useful if you are displaying elapsed time in real-time + and want a stable number.*/ + RealTime smoothElapsedTime() const { + return emwaDuration; + } + + /** Time-smoothed value of fps that is stable to the nearest integer for fps > 10 and + to the first decimal place for fps <= 10. + This is useful if you + are displaying the frame rate in real-time and want a stable (readable) number.*/ + double smoothFPS() const { + return m_smoothFPS; + } + + /** The elapsed cycle time between tick and tock. An attempt is made to factor out all + tick/tock overhead, so that back-to-back calls should return zero. + Unreliable on non-x86 platforms.*/ + uint64 elapsedCycles() const { + return lastCycleCount; + } + + /** Call at the beginning of the period that you want timed. */ + void tick(); + + /** Call at the end of the period that you want timed. */ + void tock(); + + + /** Reset the start time used by after() and the emwa value.*/ + void reset(); + + /** Call after an operation has completed, with the name of the operation, to + print a debug message listing the time since the previous after() call. */ + void after(const std::string& s = ""); + +}; + +/** Because it is hard to remember the proper capitalization. */ +typedef Stopwatch StopWatch; + +} + +#endif + diff --git a/externals/g3dlite/G3D/System.h b/externals/g3dlite/G3D/System.h new file mode 100644 index 0000000..56ef9c8 --- /dev/null +++ b/externals/g3dlite/G3D/System.h @@ -0,0 +1,507 @@ +/** + @file System.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @cite Rob Wyatt http://www.gamasutra.com/features/wyatts_world/19990709/processor_detection_01.htm + @cite Benjamin Jurke http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-ProcessorDetectionClass&forum=cotd&id=-1 + @cite Michael Herf http://www.stereopsis.com/memcpy.html + + @created 2003-01-25 + @edited 2008-10-14 + */ + +#ifndef G3D_System_h +#define G3D_System_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/G3DGameUnits.h" +#include "G3D/BinaryFormat.h" +#include + +#ifdef G3D_OSX +# include +#endif + +namespace G3D { + +/** + Routine used by the demos to find the data. Searches in + ../data, ../../data, etc. up to 5 levels back. Checks + common locations like \verbatim c:\libraries\g3d-\data \endverbatim + and some hard-coded paths on the Brown University file + system. + + @deprecated + */ +std::string demoFindData(bool errorIfNotFound = true); + +/** G3D, SDL, and IJG libraries require license documentation + to be distributed with your program. This generates the + string that must appear in your documentation. + Your program can be commercial, closed-source under + any license you want. + @deprecated Use System::license +*/ +std::string license(); + +/** +@brief The order in which the bytes of an integer are stored on a +machine. + +Intel/AMD chips tend to be G3D_LITTLE_ENDIAN, Mac PPC's and Suns are +G3D_BIG_ENDIAN. However, this is primarily used to specify the byte +order of file formats, which are fixed. +*/ +enum G3DEndian { + G3D_BIG_ENDIAN, + G3D_LITTLE_ENDIAN +}; + +/** + @brief OS and processor abstraction. + + The first time any method is called the processor will be analyzed. + Future calls are then fast. + + Timing function overview: + System::getCycleCount + - actual cycle count + + System::getTick + - High-resolution time in seconds since program started + + System::getLocalTime + - High-resolution time in seconds since Jan 1, 1970 + (because it is stored in a double, this may be less + accurate than getTick) + */ +class System { +public: + /** + @param size Size of memory that the system was trying to allocate + + @param recoverable If true, the system will attempt to allocate again + if the callback returns true. If false, malloc is going to return + NULL and this invocation is just to notify the application. + + @return Return true to force malloc to attempt allocation again if the + error was recoverable. + */ + typedef bool (*OutOfMemoryCallback)(size_t size, bool recoverable); + +private: + + bool m_initialized; + int m_cpuSpeed; + bool m_hasCPUID; + bool m_hasRDTSC; + bool m_hasMMX; + bool m_hasSSE; + bool m_hasSSE2; + bool m_hasSSE3; + bool m_has3DNOW; + bool m_has3DNOW2; + bool m_hasAMDMMX; + std::string m_cpuVendor; + int m_numCores; + + /** this holds the data directory set by the application (currently + GApp) for use by findDataFile */ + std::string m_appDataDir; + + G3DEndian m_machineEndian; + std::string m_cpuArch; + std::string m_operatingSystem; + +# ifdef G3D_WIN32 + /** Used by getTick() for timing */ + LARGE_INTEGER m_start; + LARGE_INTEGER m_counterFrequency; +#else + struct timeval m_start; +#endif + + std::string m_version; + OutOfMemoryCallback m_outOfMemoryCallback; + +#ifdef G3D_OSX + /** In Cycles/Second */ + SInt32 m_OSXCPUSpeed; + double m_secondsPerNS; +#endif + + /** The Real-World time of System::getTick() time 0. Set by initTime */ + RealTime m_realWorldGetTickTime0; + + uint32 m_highestCPUIDFunction; + + /** @brief Used for the singleton instance only. */ + System(); + + /** @brief The singleton instance. + + Used instead of a global variable to ensure that the order of + intialization is correct, which is critical because other + globals may allocate memory using System::malloc. + */ + static System& instance(); + + enum CPUIDFunction { + CPUID_VENDOR_ID = 0x00000000, + CPUID_PROCESSOR_FEATURES = 0x00000001, + CPUID_NUM_CORES = 0x00000004, + CPUID_GET_HIGHEST_FUNCTION = 0x80000000, + CPUID_EXTENDED_FEATURES = 0x80000001}; + + /** Helper macro to call cpuid functions and return all values + + See http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/ + or http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf + + for description of the arguments. + */ + static void cpuid(CPUIDFunction func, uint32& areg, uint32& breg, uint32& creg, uint32& dreg); + + void init(); + + /** Called from init() */ + void getStandardProcessorExtensions(); + + /** Called from init() */ + void initTime(); + +public: + + /** Returns the speed of processor 0 in MHz. + Always returns 0 on linux.*/ + inline static int cpuSpeedMHz() { + return instance().m_cpuSpeed; + } + + /** Returns the number of logical processor cores (i.e., the + number of execution units for threads) */ + inline static int numCores() { + return instance().m_numCores; + } + + inline static bool hasCPUID() { + return instance().m_hasCPUID; + } + + inline static bool hasRDTSC() { + return instance().m_hasRDTSC; + } + + inline static bool hasSSE() { + return instance().m_hasSSE; + } + + inline static bool hasSSE2() { + return instance().m_hasSSE2; + } + + inline static bool hasSSE3() { + return instance().m_hasSSE3; + } + + inline static bool hasMMX() { + return instance().m_hasMMX; + } + + inline static bool has3DNow() { + return instance().m_has3DNOW; + } + + inline static const std::string& cpuVendor() { + return instance().m_cpuVendor; + } + + /** + Returns the endianness of this machine. + */ + inline static G3DEndian machineEndian() { + return instance().m_machineEndian; + } + + /** e.g., "Windows", "GNU/Linux" */ + inline static const std::string& operatingSystem() { + return instance().m_operatingSystem; + } + + /** e.g., 80686 */ + inline static const std::string& cpuArchitecture() { + return instance().m_cpuArch; + } + + /** + Returns the current date as a string in the form YYYY-MM-DD + */ + static std::string currentDateString(); + + /** + Guarantees that the start of the array is aligned to the + specified number of bytes. + */ + static void* alignedMalloc(size_t bytes, size_t alignment); + + /** + Uses pooled storage to optimize small allocations (1 byte to 5 + kilobytes). Can be 10x to 100x faster than calling ::malloc or + new. + + The result must be freed with free. + + Threadsafe on Win32. + + @sa calloc realloc OutOfMemoryCallback free + */ + static void* malloc(size_t bytes); + + static void* calloc(size_t n, size_t x); + + /** + Version of realloc that works with System::malloc. + */ + static void* realloc(void* block, size_t bytes); + + /** Returns a string describing how well System::malloc is using + its internal pooled storage. "heap" memory was slow to + allocate; the other data sizes are comparatively fast.*/ + static std::string mallocPerformance(); + static void resetMallocPerformanceCounters(); + + /** + Returns a string describing the current usage of the buffer pools used for + optimizing System::malloc. + */ + static std::string mallocStatus(); + + /** + Free data allocated with System::malloc. + + Threadsafe on Win32. + */ + static void free(void* p); + + /** + Frees memory allocated with alignedMalloc. + */ + static void alignedFree(void* ptr); + + /** An implementation of memcpy that may be up to 2x as fast as the C library + one on some processors. Guaranteed to have the same behavior as memcpy + in all cases. */ + static void memcpy(void* dst, const void* src, size_t numBytes); + + /** An implementation of memset that may be up to 2x as fast as the C library + one on some processors. Guaranteed to have the same behavior as memset + in all cases. */ + static void memset(void* dst, uint8 value, size_t numBytes); + + /** + Returns the fully qualified filename for the currently running executable. + + This is more reliable than arg[0], which may be intentionally set + to an incorrect value by a calling program, relative to a now + non-current directory, or obfuscated by sym-links. + + @cite Linux version written by Nicolai Haehnle , http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-getexename&forum=cotd&id=-1 + */ + static std::string currentProgramFilename(); + + /** Name of this program. Note that you can mutate this string to + set your app name explicitly.*/ + static std::string& appName(); + + /** G3D Version string */ + inline static const std::string& version() { + return instance().m_version; + } + + /** + @brief The optimization status of the G3D library (not the program compiled against it) + + Either "Debug" or "Release", depending on whether _DEBUG was + defined at compile-time for the library. + */ + static const std::string& build(); + + /** + Causes the current thread to yield for the specified duration + and consume almost no CPU. + The sleep will be extremely precise; it uses System::time() + to calibrate the exact yeild time. + */ + static void sleep(RealTime t); + + /** + Clears the console. + Console programs only. + */ + static void consoleClearScreen(); + + /** + Returns true if a key is waiting. + Console programs only. + */ + static bool consoleKeyPressed(); + + /** + Blocks until a key is read (use consoleKeyPressed to determine if + a key is waiting to be read) then returns the character code for + that key. + */ + static int consoleReadKey(); + + /** + The actual time (measured in seconds since + Jan 1 1970 midnight). + + Adjusted for local timezone and daylight savings + time. This is as accurate and fast as getCycleCount(). + */ + static RealTime time(); + + /** + To count the number of cycles a given operation takes: + +
+     unsigned long count;
+     System::beginCycleCount(count);
+     ...
+     System::endCycleCount(count);
+     // count now contains the cycle count for the intervening operation.
+     
+ */ + /* static void beginCycleCount(uint64& cycleCount); + static void endCycleCount(uint64& cycleCount); + + static uint64 getCycleCount(); */ + + inline static void setOutOfMemoryCallback(OutOfMemoryCallback c) { + instance().m_outOfMemoryCallback = c; + } + + /** + When System::malloc fails to allocate memory because the system is + out of memory, it invokes this handler (if it is not NULL). + The argument to the callback is the amount of memory that malloc + was trying to allocate when it ran out. If the callback returns + true, System::malloc will attempt to allocate the memory again. + If the callback returns false, then System::malloc will return NULL. + + You can use outOfMemoryCallback to free data structures or to + register the failure. + */ + inline static OutOfMemoryCallback outOfMemoryCallback() { + return instance().m_outOfMemoryCallback; + } + + /** Set an environment variable for the current process */ + static void setEnv(const std::string& name, const std::string& value); + + /** Get an environment variable for the current process. Returns NULL if the variable doesn't exist. */ + static const char* getEnv(const std::string& name); + + /** + Prints a human-readable description of this machine + to the text output stream. Either argument may be NULL. + */ + static void describeSystem( + class TextOutput& t); + + static void describeSystem( + std::string& s); + + /** On Win32, returns the clipboard text contents. Does nothing on other + platforms (yet) */ + static std::string getClipboardText(); + + /** Copies the text to the clipboard on Win32. */ + static void setClipboardText(const std::string& s); + + /** + Tries to locate the resource by looking in related directories. + If found, returns the full path to the resource, otherwise + returns the empty string. + */ + static std::string findDataFile(const std::string& full, bool errorIfNotFound = true); + + /** + Sets the path that the application is using as its data directory. + Used by findDataDir as an initial search location. GApp sets this + upon constrution. + */ + static void setAppDataDir(const std::string& path); + +}; + +/* don't need that for MaNGOS, not portable to Win64... +#ifdef _MSC_VER + inline uint64 System::getCycleCount() { + uint32 timehi, timelo; + + // Use the assembly instruction rdtsc, which gets the current + // cycle count (since the process started) and puts it in edx:eax. + __asm + { + rdtsc; + mov timehi, edx; + mov timelo, eax; + } + + return ((uint64)timehi << 32) + (uint64)timelo; + } + +#elif defined(G3D_LINUX) + + inline uint64 System::getCycleCount() { + uint32 timehi, timelo; + + __asm__ __volatile__ ( + "rdtsc " + : "=a" (timelo), + "=d" (timehi) + : ); + + return ((uint64)timehi << 32) + (uint64)timelo; + } + +#elif defined(G3D_OSX) + + inline uint64 System::getCycleCount() { + //Note: To put off extra processing until the end, this does not + //return the actual clock cycle count. It is a bus cycle count. + //When endCycleCount() is called, it converts the two into a difference + //of clock cycles + + return (uint64) UnsignedWideToUInt64(UpTime()); + //return (uint64) mach_absolute_time(); + } + +#endif + +inline void System::beginCycleCount(uint64& cycleCount) { + cycleCount = getCycleCount(); +} + + +inline void System::endCycleCount(uint64& cycleCount) { +#ifndef G3D_OSX + cycleCount = getCycleCount() - cycleCount; +#else + AbsoluteTime end = UpTime(); + Nanoseconds diffNS = + AbsoluteDeltaToNanoseconds(end, UInt64ToUnsignedWide(cycleCount)); + cycleCount = + (uint64) ((double) (instance().m_OSXCPUSpeed) * + (double) UnsignedWideToUInt64(diffNS) * instance().m_secondsPerNS); +#endif +} + */ + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/Table.h b/externals/g3dlite/G3D/Table.h new file mode 100644 index 0000000..287efa9 --- /dev/null +++ b/externals/g3dlite/G3D/Table.h @@ -0,0 +1,924 @@ +/** + @file Table.h + + Templated hash table class. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2001-04-22 + @edited 2010-01-28 + Copyright 2000-2010, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Table_h +#define G3D_Table_h + +#include +#include + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/debug.h" +#include "G3D/System.h" +#include "G3D/g3dmath.h" +#include "G3D/EqualsTrait.h" +#include "G3D/HashTrait.h" +#include "G3D/MemoryManager.h" + +#ifdef _MSC_VER +# pragma warning (push) + // Debug name too long warning +# pragma warning (disable : 4786) +#endif + +namespace G3D { + +/** + An unordered data structure mapping keys to values. + + There are two ways of definining custom hash functions (G3D provides built-in ones for most classes): + +
+ class Foo {
+ public:
+     std::string     name;
+     int             index;
+     static size_t hashCode(const Foo& key) {
+          return HashTrait::hashCode(key.name) + key.index;
+     }
+  };
+
+  template<> struct HashTrait {
+       static size_t hashCode(const Foo& key) { return HashTrait::hashCode(key.name) + key.index; }
+  }; 
+
+
+  // Use Foo::hashCode
+  Table fooTable1;
+
+  // Use HashTrait
+  Table      fooTable2;
+  
+ + + Key must be a pointer, an int, a std::string or provide overloads for: + +
+    template<> struct HashTrait {
+        static size_t hashCode(const Key& key) { return reinterpret_cast( ... ); }
+    }; 
+  
+ + and one of + +
+    template<> struct EqualsTrait{
+         static bool equals(const Key& a, const Key& b) { return ... ; }
+    };
+
+
+    bool operator==(const Key&, const Key&);
+  
+ + G3D pre-defines HashTrait specializations for common types (like int and std::string). + If you use a Table with a different type you must write those functions yourself. For example, + an enum would use: + +
+    template<> struct HashTrait {
+        static size_t equals(const MyEnum& key) const { return reinterpret_cast( key ); }
+    };
+  
+ + And rely on the default enum operator==. + + + Periodically check that debugGetLoad() is low (> 0.1). When it gets near + 1.0 your hash function is badly designed and maps too many inputs to + the same output. + */ +template, class EqualsFunc = EqualsTrait > +class Table { +public: + + /** + The pairs returned by iterator. + */ + class Entry { + public: + Key key; + Value value; + Entry() {} + Entry(const Key& k) : key(k) {} + Entry(const Key& k, const Value& v) : key(k), value(v) {} + bool operator==(const Entry &peer) const { return (key == peer.key && value == peer.value); } + bool operator!=(const Entry &peer) const { return !operator==(peer); } + }; + +private: + + typedef Table ThisType; + + /** + Linked list nodes used internally by HashTable. + */ + class Node { + public: + Entry entry; + size_t hashCode; + Node* next; + + private: + + // Private to require use of the allocator + Node(const Key& k, const Value& v, size_t h, Node* n) + : entry(k, v), hashCode(h), next(n) { + } + + Node(const Key& k, size_t h, Node* n) + : entry(k), hashCode(h), next(n) { + } + + public: + + static Node* create(const Key& k, const Value& v, size_t h, Node* n, MemoryManager::Ref& mm) { + Node* node = (Node*)mm->alloc(sizeof(Node)); + return new (node) Node(k, v, h, n); + } + + static Node* create(const Key& k, size_t hashCode, Node* n, MemoryManager::Ref& mm) { + Node* node = (Node*)mm->alloc(sizeof(Node)); + return new (node) Node(k, hashCode, n); + } + + static void destroy(Node* n, MemoryManager::Ref& mm) { + n->~Node(); + mm->free(n); + } + + /** + Clones a whole chain; + */ + Node* clone(MemoryManager::Ref& mm) { + return create(this->entry.key, this->entry.value, hashCode, (next == NULL) ? NULL : next->clone(mm), mm); + } + }; + + void checkIntegrity() const { +# ifdef G3D_DEBUG + debugAssert(m_bucket == NULL || isValidHeapPointer(m_bucket)); + for (size_t b = 0; b < m_numBuckets; ++b) { + Node* node = m_bucket[b]; + debugAssert(node == NULL || isValidHeapPointer(node)); + while (node != NULL) { + debugAssert(node == NULL || isValidHeapPointer(node)); + node = node->next; + } + } +# endif + } + + /** Number of elements in the table.*/ + size_t m_size; + + /** + Array of Node*. + + We don't use Array because Table is lower-level than Array. + Some elements may be NULL. + */ + Node** m_bucket; + + /** + Length of the m_bucket array. + */ + size_t m_numBuckets; + + MemoryManager::Ref m_memoryManager; + + void* alloc(size_t s) const { + return m_memoryManager->alloc(s); + } + + void free(void* p) const { + return m_memoryManager->free(p); + } + + /** + Re-hashes for a larger m_bucket size. + */ + void resize(size_t newSize) { + + // Hang onto the old m_bucket array + Node** oldBucket = m_bucket; + + // Allocate a new m_bucket array with the new size + m_bucket = (Node**)alloc(sizeof(Node*) * newSize); + // Set all pointers to NULL + System::memset(m_bucket, 0, newSize * sizeof(Node*)); + debugAssertM(m_bucket != NULL, "MemoryManager::alloc returned NULL. Out of memory."); + // Move each node to its new hash location + for (size_t b = 0; b < m_numBuckets; ++b) { + Node* node = oldBucket[b]; + + // There is a linked list of nodes at this m_bucket + while (node != NULL) { + // Hang onto the old next pointer + Node* nextNode = node->next; + + // Insert at the head of the list for m_bucket[i] + size_t i = node->hashCode % newSize; + node->next = m_bucket[i]; + m_bucket[i] = node; + + // Move on to the next node + node = nextNode; + } + + // Drop the old pointer for cleanliness when debugging + oldBucket[b] = NULL; + } + + // Delete the old storage + free(oldBucket); + this->m_numBuckets = newSize; + + checkIntegrity(); + } + + + void copyFrom(const ThisType& h) { + if (&h == this) { + return; + } + + debugAssert(m_bucket == NULL); + m_size = h.m_size; + m_numBuckets = h.m_numBuckets; + m_bucket = (Node**)alloc(sizeof(Node*) * m_numBuckets); + // No need to NULL elements since we're about to overwrite them + + for (size_t b = 0; b < m_numBuckets; ++b) { + if (h.m_bucket[b] != NULL) { + m_bucket[b] = h.m_bucket[b]->clone(m_memoryManager); + } else { + m_bucket[b] = NULL; + } + } + + checkIntegrity(); + } + + /** + Frees the heap structures for the nodes. + */ + void freeMemory() { + checkIntegrity(); + + for (size_t b = 0; b < m_numBuckets; b++) { + Node* node = m_bucket[b]; + while (node != NULL) { + Node* next = node->next; + Node::destroy(node, m_memoryManager); + node = next; + } + m_bucket[b] = NULL; + } + free(m_bucket); + m_bucket = NULL; + m_numBuckets = 0; + m_size = 0; + } + +public: + + /** + Creates an empty hash table using the default MemoryManager. + */ + Table() : m_bucket(NULL) { + m_memoryManager = MemoryManager::create(); + m_numBuckets = 0; + m_size = 0; + m_bucket = NULL; + checkIntegrity(); + } + + /** Changes the internal memory manager to m */ + void clearAndSetMemoryManager(const MemoryManager::Ref& m) { + clear(); + debugAssert(m_bucket == NULL); + m_memoryManager = m; + } + + /** + Recommends that the table resize to anticipate at least this number of elements. + */ + void setSizeHint(size_t n) { + size_t s = n * 3; + if (s > m_numBuckets) { + resize(s); + } + } + + /** + Destroys all of the memory allocated by the table, but does not + call delete on keys or values if they are pointers. If you want to + deallocate things that the table points at, use getKeys() and Array::deleteAll() + to delete them. + */ + virtual ~Table() { + freeMemory(); + } + + /** Uses the default memory manager */ + Table(const ThisType& h) { + m_memoryManager = MemoryManager::create(); + m_numBuckets = 0; + m_size = 0; + m_bucket = NULL; + this->copyFrom(h); + checkIntegrity(); + } + + + Table& operator=(const ThisType& h) { + // No need to copy if the argument is this + if (this != &h) { + // Free the existing nodes + freeMemory(); + this->copyFrom(h); + checkIntegrity(); + } + return *this; + } + + /** + Returns the length of the deepest m_bucket. + */ + size_t debugGetDeepestBucketSize() const { + size_t deepest = 0; + + for (size_t b = 0; b < m_numBuckets; b++) { + size_t count = 0; + Node* node = m_bucket[b]; + while (node != NULL) { + node = node->next; + ++count; + } + + if (count > deepest) { + deepest = count; + } + } + + return deepest; + } + + /** + Returns the average size of non-empty buckets. + */ + float debugGetAverageBucketSize() const { + size_t num = 0; + size_t count = 0; + + for (size_t b = 0; b < m_numBuckets; b++) { + Node* node = m_bucket[b]; + if (node != NULL) { + ++num; + while (node != NULL) { + node = node->next; + ++count; + } + } + } + + return (float)((double)count / num); + } + + /** + A small load (close to zero) means the hash table is acting very + efficiently most of the time. A large load (close to 1) means + the hash table is acting poorly-- all operations will be very slow. + A large load will result from a bad hash function that maps too + many keys to the same code. + */ + double debugGetLoad() const { + return debugGetDeepestBucketSize() / (double)size(); + } + + /** + Returns the number of buckets. + */ + size_t debugGetNumBuckets() const { + return m_numBuckets; + } + + /** + C++ STL style iterator variable. See begin(). + */ + class Iterator { + private: + friend class Table; + + /** + Bucket index. + */ + size_t index; + + /** + Linked list node. + */ + Node* node; + ThisType* table; + size_t m_numBuckets; + Node** m_bucket; + bool isDone; + + /** + Creates the end iterator. + */ + Iterator(const ThisType* table) : table(const_cast(table)) { + isDone = true; + } + + Iterator(const ThisType* table, size_t m_numBuckets, Node** m_bucket) : + table(const_cast(table)), + m_numBuckets(m_numBuckets), + m_bucket(m_bucket) { + + if (m_numBuckets == 0) { + // Empty table + isDone = true; + return; + } + + index = 0; + node = m_bucket[index]; + isDone = false; + findNext(); + } + + /** + Finds the next element, setting isDone if one can't be found. + Looks at the current element first. + */ + void findNext() { + while (node == NULL) { + index++; + if (index >= m_numBuckets) { + isDone = true; + break; + } else { + node = m_bucket[index]; + } + } + } + + public: + inline bool operator!=(const Iterator& other) const { + return !(*this == other); + } + + bool operator==(const Iterator& other) const { + if (other.isDone || isDone) { + // Common case; check against isDone. + return (isDone == other.isDone) && (other.table == table); + } else { + return + (table == other.table) && + (node == other.node) && + (index == other.index); + } + } + + /** + Pre increment. + */ + Iterator& operator++() { + node = node->next; + findNext(); + return *this; + } + + /** + Post increment (slower than preincrement). + */ + Iterator operator++(int) { + Iterator old = *this; + ++(*this); + return old; + } + + const Entry& operator*() const { + return node->entry; + } + + Entry* operator->() const { + return &(node->entry); + } + + operator Entry*() const { + return &(node->entry); + } + + bool hasMore() const { + return ! isDone; + } + }; + + + /** + C++ STL style iterator method. Returns the first Entry, which + contains a key and value. Use preincrement (++entry) to get to + the next element. Do not modify the table while iterating. + */ + Iterator begin() const { + return Iterator(this, m_numBuckets, m_bucket); + } + + /** + C++ STL style iterator method. Returns one after the last iterator + element. + */ + const Iterator end() const { + return Iterator(this); + } + + /** + Removes all elements + */ + void clear() { + freeMemory(); + m_numBuckets = 0; + m_size = 0; + m_bucket = NULL; + } + + + /** + Returns the number of keys. + */ + size_t size() const { + return m_size; + } + + + /** + If you insert a pointer into the key or value of a table, you are + responsible for deallocating the object eventually. Inserting + key into a table is O(1), but may cause a potentially slow rehashing. + */ + void set(const Key& key, const Value& value) { + getCreateEntry(key).value = value; + } + +private: + + /** Helper for remove() and getRemove() */ + bool remove(const Key& key, Key& removedKey, Value& removedValue, bool updateRemoved) { + if (m_numBuckets == 0) { + return false; + } + size_t code = HashFunc::hashCode(key); + size_t b = code % m_numBuckets; + + // Go to the m_bucket + Node* n = m_bucket[b]; + + if (n == NULL) { + return false; + } + + Node* previous = NULL; + + // Try to find the node + do { + if ((code == n->hashCode) && EqualsFunc::equals(n->entry.key, key)) { + // This is the node; remove it + + // Replace the previous's next pointer + if (previous == NULL) { + m_bucket[b] = n->next; + } else { + previous->next = n->next; + } + + if (updateRemoved) { + removedKey = n->entry.key; + removedValue = n->entry.value; + } + // Delete the node + Node::destroy(n, m_memoryManager); + --m_size; + return true; + } + + previous = n; + n = n->next; + } while (n != NULL); + + return false; + //alwaysAssertM(false, "Tried to remove a key that was not in the table."); + } + +public: + + /** If @a member is present, sets @a removed to the element + being removed and returns true. Otherwise returns false + and does not write to @a removed. */ + bool getRemove(const Key& key, Key& removedKey, Value& removedValue) { + return remove(key, removedKey, removedValue, true); + } + + /** + Removes an element from the table if it is present. + @return true if the element was found and removed, otherwise false + */ + bool remove(const Key& key) { + Key x; + Value v; + return remove(key, x, v, false); + } + +private: + + Entry* getEntryPointer(const Key& key) const { + if (m_numBuckets == 0) { + return NULL; + } + + size_t code = HashFunc::hashCode(key); + size_t b = code % m_numBuckets; + + Node* node = m_bucket[b]; + + while (node != NULL) { + if ((node->hashCode == code) && EqualsFunc::equals(node->entry.key, key)) { + return &(node->entry); + } + node = node->next; + } + + return NULL; + } + +public: + + /** If a value that is EqualsFunc to @a member is present, returns a pointer to the + version stored in the data structure, otherwise returns NULL. + */ + const Key* getKeyPointer(const Key& key) const { + const Entry* e = getEntryPointer(key); + if (e == NULL) { + return NULL; + } else { + return &(e->key); + } + } + + /** + Returns the value associated with key. + @deprecated Use get(key, val) or getPointer(key) + */ + Value& get(const Key& key) const { + Entry* e = getEntryPointer(key); + debugAssertM(e != NULL, "Key not found"); + return e->value; + } + + + /** Returns a pointer to the element if it exists, or NULL if it does not. + Note that if your value type is a pointer, the return value is + a pointer to a pointer. Do not remove the element while holding this + pointer. + + It is easy to accidentally mis-use this method. Consider making + a Table and using get(key, val) instead, which makes you manage + the memory for the values yourself and is less likely to result in + pointer errors. + */ + Value* getPointer(const Key& key) const { + if (m_numBuckets == 0) { + return NULL; + } + + size_t code = HashFunc::hashCode(key); + size_t b = code % m_numBuckets; + + Node* node = m_bucket[b]; + + while (node != NULL) { + if ((node->hashCode == code) && EqualsFunc::equals(node->entry.key, key)) { + // found key + return &(node->entry.value); + } + node = node->next; + } + + // Failed to find key + return NULL; + } + + /** + If the key is present in the table, val is set to the associated value and returns true. + If the key is not present, returns false. + */ + bool get(const Key& key, Value& val) const { + Value* v = getPointer(key); + if (v != NULL) { + val = *v; + return true; + } else { + return false; + } + } + + + + /** Called by getCreate() and set() + + \param created Set to true if the entry was created by this method. + */ + Entry& getCreateEntry(const Key& key, bool& created) { + created = false; + + if (m_numBuckets == 0) { + resize(10); + } + + size_t code = HashFunc::hashCode(key); + size_t b = code % m_numBuckets; + + // Go to the m_bucket + Node* n = m_bucket[b]; + + // No m_bucket, so this must be the first + if (n == NULL) { + m_bucket[b] = Node::create(key, code, NULL, m_memoryManager); + ++m_size; + created = true; + return m_bucket[b]->entry; + } + + size_t bucketLength = 1; + + // Sometimes a bad hash code will cause all elements + // to collide. Detect this case and don't rehash when + // it occurs; nothing good will come from the rehashing. + bool allSameCode = true; + + // Try to find the node + do { + allSameCode = allSameCode && (code == n->hashCode); + + if ((code == n->hashCode) && EqualsFunc::equals(n->entry.key, key)) { + // This is the a pre-existing node + return n->entry; + } + + n = n->next; + ++bucketLength; + } while (n != NULL); + + const size_t maxBucketLength = 3; + // (Don't bother changing the size of the table if all entries + // have the same hashcode--they'll still collide) + if ((bucketLength > maxBucketLength) && + ! allSameCode && + (m_numBuckets < m_size * 15)) { + + // This m_bucket was really large; rehash if all elements + // don't have the same hashcode the number of buckets is + // reasonable. + + // Back off the scale factor as the number of buckets gets + // large + float f = 3.0f; + if (m_numBuckets > 1000000) { + f = 1.5f; + } else if (m_numBuckets > 100000) { + f = 2.0f; + } + int newSize = iMax((int)(m_numBuckets * f) + 1, (int)(m_size * f)); + resize(newSize); + } + + // Not found; insert at the head. + b = code % m_numBuckets; + m_bucket[b] = Node::create(key, code, m_bucket[b], m_memoryManager); + ++m_size; + created = true; + return m_bucket[b]->entry; + } + + Entry& getCreateEntry(const Key& key) { + bool ignore; + return getCreateEntry(key, ignore); + } + + + /** Returns the current value that key maps to, creating it if necessary.*/ + Value& getCreate(const Key& key) { + return getCreateEntry(key).value; + } + + /** \param created True if the element was created. */ + Value& getCreate(const Key& key, bool& created) { + return getCreateEntry(key, created).value; + } + + + /** + Returns true if key is in the table. + */ + bool containsKey(const Key& key) const { + if (m_numBuckets == 0) { + return false; + } + + size_t code = HashFunc::hashCode(key); + size_t b = code % m_numBuckets; + + Node* node = m_bucket[b]; + + while (node != NULL) { + if ((node->hashCode == code) && EqualsFunc::equals(node->entry.key, key)) { + return true; + } + node = node->next; + } while (node != NULL); + + return false; + } + + + /** + Short syntax for get. + */ + inline Value& operator[](const Key &key) const { + return get(key); + } + + /** + Returns an array of all of the keys in the table. + You can iterate over the keys to get the values. + @deprecated + */ + Array getKeys() const { + Array keyArray; + getKeys(keyArray); + return keyArray; + } + + void getKeys(Array& keyArray) const { + keyArray.resize(0, DONT_SHRINK_UNDERLYING_ARRAY); + for (size_t i = 0; i < m_numBuckets; i++) { + Node* node = m_bucket[i]; + while (node != NULL) { + keyArray.append(node->entry.key); + node = node->next; + } + } + } + + /** + Calls delete on all of the keys and then clears the table. + */ + void deleteKeys() { + for (size_t i = 0; i < m_numBuckets; i++) { + Node* node = m_bucket[i]; + while (node != NULL) { + delete node->entry.key; + node = node->next; + } + } + clear(); + } + + /** + Calls delete on all of the values. This is unsafe-- + do not call unless you know that each value appears + at most once. + + Does not clear the table, so you are left with a table + of NULL pointers. + */ + void deleteValues() { + for (size_t i = 0; i < m_numBuckets; ++i) { + Node* node = m_bucket[i]; + while (node != NULL) { + delete node->entry.value; + node->entry.value = NULL; + node = node->next; + } + } + } +}; + +} // namespace + +#ifdef _MSC_VER +# pragma warning (pop) +#endif + +#endif diff --git a/externals/g3dlite/G3D/TextInput.h b/externals/g3dlite/G3D/TextInput.h new file mode 100644 index 0000000..33eb8c4 --- /dev/null +++ b/externals/g3dlite/G3D/TextInput.h @@ -0,0 +1,801 @@ +/** + @file TextInput.h + + Simple text lexer/tokenizer. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @cite Based on a lexer written by Aaron Orenstein. + + @created 2002-11-27 + @edited 2009-11-24 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_TextInput_h +#define G3D_TextInput_h + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Set.h" +#include "G3D/ParseError.h" +#include +#include +#include +#include + +namespace G3D { + +/** + For use with TextInput. + */ +class Token { +public: + + /** + More detailed type information than Type. + */ + enum ExtendedType { + DOUBLE_QUOTED_TYPE, + SINGLE_QUOTED_TYPE, + SYMBOL_TYPE, + FLOATING_POINT_TYPE, + INTEGER_TYPE, + BOOLEAN_TYPE, + LINE_COMMENT_TYPE, + BLOCK_COMMENT_TYPE, + NEWLINE_TYPE, + END_TYPE + }; + + /** + Strings are enclosed in quotes, symbols are not. + */ + enum Type { + STRING = DOUBLE_QUOTED_TYPE, + SYMBOL = SYMBOL_TYPE, + NUMBER = FLOATING_POINT_TYPE, + BOOLEAN = BOOLEAN_TYPE, + COMMENT = LINE_COMMENT_TYPE, + NEWLINE = NEWLINE_TYPE, + END = END_TYPE + }; + +private: + + friend class TextInput; + + /** + Holds the actual value, which might be any type. If a number, it will be + parsed at runtime. + */ + std::string _string; + + bool _bool; + int _line; + int _character; + Type _type; + ExtendedType _extendedType; + +public: + + Token() : + _string(""), + _bool(false), + _line(0), + _character(0), + _type(END), + _extendedType(END_TYPE) {} + + Token(Type t, ExtendedType e, const std::string& s, int L, int c) + : _string(s), _bool(false), _line(L), _character(c), _type(t), _extendedType(e) {} + + Token(Type t, ExtendedType e, const std::string& s, bool b, int L, int c) + : _string(s), _bool(b), _line(L), _character(c), _type(t), _extendedType(e) {} + + Type type() const { + return _type; + } + + ExtendedType extendedType() const { + return _extendedType; + } + + /** + The value of a single or double quote string (not including the quotes), + the name of a symbol, or the exact textual representation of a number as + parsed from the input. + */ + const std::string& string() const { + return _string; + } + + bool boolean() const { + return _bool; + } + + /** + Starting line of the input from which this token was parsed. Starts + at 1. + */ + int line() const { + return _line; + } + + /** + Starting character position in the input line from which this token was + parsed. Starts at 1. + */ + int character() const { + return _character; + } + + /** Return the numeric value for a number type, or zero if this is + not a number type. + */ + double number() const; +}; + + +/** + A simple style tokenizer for reading text files. TextInput handles a + superset of C++,Java, Matlab, and Bash code text including single + line comments, block comments, quoted strings with escape sequences, + and operators. TextInput recognizes several categories of tokens, + which are separated by white space, quotation marks, or the end of a + recognized operator: + +
    +
  • Token::SINGLE_QUOTED_TYPE string of characters surrounded by single quotes, e.g., 'x', '\\0', 'foo'. +
  • Token::DOUBLE_QUOTED_TYPE string of characters surrounded by double quotes, e.g., "x", "abc\txyz", "b o b". +
  • Token::SYMBOL_TYPE legal C++ operators, keywords, and identifiers. e.g., >=, Foo, _X, class, { +
  • Token::INTEGER_TYPE numbers without decimal places or exponential notation. e.g., 10, 0x17F, 32, 0, -155 +
  • Token::FLOATING_POINT_TYPE numbers with decimal places or exponential notation. e.g., 1e3, -1.2, .4, 0.5 +
  • Token::BOOLEAN_TYPE special symbols like "true" and "false"; the exact details can be configured in TextInput::Settings +
  • Token::LINE_COMMENT_TYPE (disabled by default); generated for line comments as specified by TextInput::Settings +
  • Token::BLOCK_COMMENT_TYPE (disabled by default); generated for c-style block comments as specified by TextInput::Settings +
  • Token::NEWLINE_TYPE (disabled by default); generated for any of "\\r", "\\n" or "\\r\\n" +
+ +

The special ".." and "..." tokens are always recognized in + addition to normal C++ operators. Additional tokens can be made + available by changing the Settings. + + Negative numbers are handled specially because of the ambiguity between unary minus and negative numbers-- + see the note on TextInput::read. + + TextInput does not have helper functions for types with non-obvious + formatting, or helpers that would be redundant. Use the serialize + methods instead for parsing specific types like int, Vector3, and + Color3. + + Inside quoted strings escape sequences are converted. Thus the + string token for ["a\\nb"] is 'a', followed by a newline, followed by + 'b'. Outside of quoted strings, escape sequences are not converted, + so the token sequence for [a\\nb] is symbol 'a', symbol '\\', symbol + 'nb' (this matches what a C++ parser would do). The exception is + that a specified TextInput::Settings::otherCommentCharacter preceeded + by a backslash is assumed to be an escaped comment character and is + returned as a symbol token instead of being parsed as a comment + (this is what a LaTex or VRML parser would do). + + Examples + +

+  TextInput ti(TextInput::FROM_STRING, "name = \"Max\", height = 6");
+
+  Token t;
+
+  t = ti.read(); 
+  debugAssert(t.type == Token::SYMBOL);
+  debugAssert(t.sval == "name");
+
+  ti.read();
+  debugAssert(t.type == Token::SYMBOL);
+  debugAssert(t.sval == "=");
+
+  std::string name = ti.read().sval;
+  ti.read();
+  
+ +
+  TextInput ti(TextInput::FROM_STRING, "name = \"Max\", height = 6");
+  ti.readSymbols("name", "=");
+  std::string name = ti.readString();
+  ti.readSymbols(",", "height", "=");
+  double height = ti. readNumber();
+  
+ + Assumes that the file is not modified once opened. + */ +class TextInput { +public: + + /** Tokenizer configuration options. */ + class Settings { + public: + /** If true, C-style slash-star marks a multi-line comment. + + See generateCommentTokens for rules on how this is applied. + + Default is true. + */ + bool cppBlockComments; + + /** If true, // begins a single line comment. + + See generateCommentTokens for rules on how this is applied. + + Default is true. + */ + bool cppLineComments; + + /** If true, otherCommentCharacter and otherCommentCharacter2 + are used to begin single line comments in the same way + cppLineComments is. + + See generateCommentTokens for rules on how this is applied. + + Default is true. + */ + bool otherLineComments; + + /** If true, \\r, \\n, \\t, \\0, \\\\ and other escape sequences inside + strings are converted to the equivalent C++ escaped character. + If false, backslashes are treated literally. It is convenient to + set to false if reading Windows paths, for example, like + c:\\foo\\bar. + + Default is true. + */ + bool escapeSequencesInStrings; + + /** If not '\\0', specifies a character that begins single line + comments ('#' and '%' are popular choices). This is independent + of the cppLineComments flag. If the character appears in text with + a backslash in front of it, it is considered escaped and is not + treated as a comment character. + + Default is '\\0'. + */ + char otherCommentCharacter; + + /** Another (optional) 1-comment character. Useful for files that + support multiple comment syntaxes. Default is '\\0'. + */ + char otherCommentCharacter2; + + /** If true, comments enabled by cppBlockComments, cppLineComments + and otherLineComments will generate their respective tokens. + If false, the same settings will enable parsing and ignoring + comments + + Default is false. + */ + bool generateCommentTokens; + + /** If true, newlines will generate tokens. + If false, newlines will be discarded as whitespace when parsed + outside of other tokens. + + Default is false. + */ + bool generateNewlineTokens; + + /** If true, "-1" parses as the number -1 instead of the + symbol "-" followed by the number 1. Default is true.*/ + bool signedNumbers; + + /** If true, strings can be marked with single quotes (e.g., + 'aaa'). If false, the quote character is parsed as a + symbol. Default is true. Backquote (`) is always parsed + as a symbol. */ + bool singleQuotedStrings; + + /** The character to use as a single quote. Defaults to "'" (backquote), + occasionally useful to set to "`" (forward quote) or to "," (comma) for + reading CSV files. */ + char singleQuoteCharacter; + + /** If set to a non-empty string, that string will be used in + place of the real file name (or in place of a pseudonym + constructed from the buffer if given FROM_STRING) in + tokens and exceptions. + + Default is empty. + */ + std::string sourceFileName; + + + /** Added to the line number reported by peekLineNumber and in + exceptions. Useful for concatenating files that are + parsed separately. Default is zero. */ + int startingLineNumberOffset; + + /** + Parse -1.#IND00 as the floating point number returned by + nan(), -1.#INF00 as -inf(), and 1.#INF00 as inf(). Note + that the C99 standard specifies that a variety of formats + like "NaN" and "nan" are to be used; these are easier to + parse yourself and not currently supported by readNumber. + + An alternative to specifying msvcSpecials is to read numbers as: +
+            Token x = t.read();
+            Token y = t.peek();
+            if ((x.string() == "-1.") && 
+                (y.string() == "#INF00") && 
+                (y.character() == x.character() + 3) &&
+                (y.line() == x.line()) {
+                t.read();
+                return nan();
+            }
+            // ... similar cases for inf
+          
+ + If the single-comment character was #, the floating point + special format overrides the comment and will be parsed + instead. + + If signedNumbers is false msvcSpecials will not be parsed. + + Default is true. */ + bool msvcSpecials; + + /** + Parse the following set of useful proof symbols: + + => + ::> + <:: + :> + <: + |- + ::= + := + <- + + Default is false. + */ + bool proofSymbols; + + /** + When parsing booleans and msvcSpecials, is case significant? + Default is {true} + */ + bool caseSensitive; + + /** All symbols that will become the 'true' boolean token. See also caseSensitive. + Clear this value to disable parsing of true booleans. + + Default is {true}. + */ + Set trueSymbols; + + /** See trueSymbols. Default is {false}*/ + Set falseSymbols; + + Settings(); + }; + +private: + + std::deque stack; + + /** + Characters to be tokenized. + */ + Array buffer; + + /** + Offset of current character (the next character to consumed) in + input buffer. + */ + int currentCharOffset; + + /** + Line number of next character to be consumed from the input buffer. (1 + indicates first line of input.) + + Note that this is the line number of the @e next character to be + consumed from the input, not the line number of the @e last character + consumed! + */ + int lineNumber; + + /** + Character number (within the line) of the next character to be consumed + from the input buffer. (1 indicates first character of the line). + + Note that this is the character number of the @e next character to be + consumed from the input, not the character number of the @e last + character consumed! + */ + int charNumber; + + /** Configuration options. This includes the file name that will be + reported in tokens and exceptions. */ + Settings options; + + void init(); + + /** + Consumes the next character from the input buffer, and returns that + character. Updates lineNumber and charNumber to reflect the location of + the next character in the input buffer. + + Note: you shouldn't be using the return value of this function in most + cases. In general, you should peekInputChar() to get the next + character, determine what to do with it, then consume it with this + function (or with eatAndPeekInputChar()). Given that usage, in most + instances you already know what this function would return! + */ + int eatInputChar(); + + /** + Returns the next character from the input buffer, without consuming any + characters. Can also be used to look deeper into the input buffer. + Does not modify lineNumber or charNumber. + + @param distance Index of the character in the input buffer to peek at, + relative to the next character. Default is 0, for the next character in + the input buffer. + */ + int peekInputChar(int distance = 0); + + /** + Helper function to consume the next character in the input buffer and + peek at the one following (without consuming it). + */ + inline int eatAndPeekInputChar() { + eatInputChar(); + return peekInputChar(0); + } + + /** + Read the next token, returning an END token if no more input is + available. + */ + Token nextToken(); + + /** + Helper for nextToken. Appends characters to t._string until the end + delimiter is reached. + + When called, the next character in the input buffer should be first the + first character after the opening delimiter character. + */ + void parseQuotedString(unsigned char delimiter, Token& t); + +public: + + class TokenException : public ParseError { + public: + /** Name of file being parsed when exception occurred. + \deprecated Use filename + */ + std::string sourceFile; + + virtual ~TokenException() {} + + protected: + + TokenException( + const std::string& src, + int ln, + int ch); + + }; + + /** While parsing a number of the form 1.\#IN?00, ? was + not 'D' or 'F'. */ + class BadMSVCSpecial : public TokenException { + public: + + BadMSVCSpecial( + const std::string& src, + int ln, + int ch); + }; + + /** Thrown by the read methods. */ + class WrongTokenType : public TokenException { + public: + Token::Type expected; + Token::Type actual; + + WrongTokenType( + const std::string& src, + int ln, + int ch, + Token::Type e, + Token::Type a); + }; + + class WrongSymbol : public TokenException { + public: + std::string expected; + std::string actual; + + WrongSymbol( + const std::string& src, + int ln, + int ch, + const std::string& e, + const std::string& a); + }; + + + /** String read from input did not match expected string. */ + class WrongString : public TokenException { + public: + std::string expected; + std::string actual; + + WrongString( + const std::string& src, + int ln, + int ch, + const std::string& e, + const std::string& a); + }; + + TextInput(const std::string& filename, const Settings& settings = Settings()); + + enum FS {FROM_STRING}; + /** Creates input directly from a string. The first argument must be + TextInput::FROM_STRING. + */ + TextInput(FS fs, const std::string& str, const Settings& settings = Settings()); + + /** Returns true while there are tokens remaining. */ + bool hasMore(); + + /** Read the next token (which will be the END token if ! hasMore()). + + Signed numbers can be handled in one of two modes. If the option + TextInput::Settings::signedNumbers is true, + A '+' or '-' immediately before a number is prepended onto that number and + if there is intervening whitespace, it is read as a separate symbol. + + If TextInput::Settings::signedNumbers is false, + read() does not distinguish between a plus or minus symbol next + to a number and a positive/negative number itself. For example, "x - 1" and "x -1" + will be parsed the same way by read(). + + In both cases, readNumber() will contract a leading "-" or "+" onto + a number. + */ + Token read(); + + /** Calls read() until the result is not a newline or comment */ + Token readSignificant(); + + /** Read one token (or possibly two) as a number or throws + WrongTokenType, and returns the number. + + If the first token in the input is a number, it is returned directly. + + If TextInput::Settings::signedNumbers is false and the input stream + contains a '+' or '-' symbol token immediately followed by a number + token, both tokens will be consumed and a single token will be + returned by this method. + + WrongTokenType will be thrown if one of the input conditions + described above is not satisfied. When an exception is thrown, no + tokens are consumed. + */ + double readNumber(); + + bool readBoolean(); + + /** Reads a string token or throws WrongTokenType, and returns the token. + + Use this method (rather than readString) if you want the token's + location as well as its value. + + WrongTokenType will be thrown if the next token in the input stream + is not a string. When an exception is thrown, no tokens are + consumed. + */ + Token readStringToken(); + + /** Like readStringToken, but returns the token's string. + + Use this method (rather than readStringToken) if you want the token's + value but don't really care about its location in the input. Use of + readStringToken is encouraged for better error reporting. + */ + std::string readString(); + + /** Reads a specific string token or throws either WrongTokenType or + WrongString. If the next token in the input is a string matching @p + s, it will be consumed. + + Use this method if you want to match a specific string from the + input. In that case, typically error reporting related to the token + is only going to occur because of a mismatch, so no location + information is needed by the caller. + + WrongTokenType will be thrown if the next token in the input stream + is not a string. WrongString will be thrown if the next token in the + input stream is a string but does not match the @p s parameter. When + an exception is thrown, no tokens are consumed. + */ + void readString(const std::string& s); + + /** Reads a comment token or throws WrongTokenType, and returns the token. + + Use this method (rather than readComment) if you want the token's + location as well as its value. + + WrongTokenType will be thrown if the next token in the input stream + is not a comment. When an exception is thrown, no tokens are + consumed. + */ + Token readCommentToken(); + + /** Like readCommentToken, but returns the token's string. + + Use this method (rather than readCommentToken) if you want the token's + value but don't really care about its location in the input. Use of + readCommentToken is encouraged for better error reporting. + */ + std::string readComment(); + + /** Reads a specific comment token or throws either WrongTokenType or + WrongString. If the next token in the input is a comment matching @p + s, it will be consumed. + + Use this method if you want to match a specific comment from the + input. In that case, typically error reporting related to the token + is only going to occur because of a mismatch, so no location + information is needed by the caller. + + WrongTokenType will be thrown if the next token in the input stream + is not a comment. WrongString will be thrown if the next token in the + input stream is a comment but does not match the @p s parameter. When + an exception is thrown, no tokens are consumed. + */ + void readComment(const std::string& s); + + /** Reads a newline token or throws WrongTokenType, and returns the token. + + Use this method (rather than readNewline) if you want the token's + location as well as its value. + + WrongTokenType will be thrown if the next token in the input stream + is not a newline. When an exception is thrown, no tokens are + consumed. + */ + Token readNewlineToken(); + + /** Like readNewlineToken, but returns the token's string. + + Use this method (rather than readNewlineToken) if you want the token's + value but don't really care about its location in the input. Use of + readNewlineToken is encouraged for better error reporting. + */ + std::string readNewline(); + + /** Reads a specific newline token or throws either WrongTokenType or + WrongString. If the next token in the input is a newline matching @p + s, it will be consumed. + + Use this method if you want to match a specific newline from the + input. In that case, typically error reporting related to the token + is only going to occur because of a mismatch, so no location + information is needed by the caller. + + WrongTokenType will be thrown if the next token in the input stream + is not a newline. WrongString will be thrown if the next token in the + input stream is a newlin but does not match the @p s parameter. When + an exception is thrown, no tokens are consumed. + */ + void readNewline(const std::string& s); + + /** Reads a symbol token or throws WrongTokenType, and returns the token. + + Use this method (rather than readSymbol) if you want the token's + location as well as its value. + + WrongTokenType will be thrown if the next token in the input stream + is not a symbol. When an exception is thrown, no tokens are + consumed. + */ + Token readSymbolToken(); + + /** Like readSymbolToken, but returns the token's string. + + Use this method (rather than readSymbolToken) if you want the token's + value but don't really care about its location in the input. Use of + readSymbolToken is encouraged for better error reporting. + */ + std::string readSymbol(); + + /** Reads a specific symbol token or throws either WrongTokenType or + WrongSymbol. If the next token in the input is a symbol matching @p + symbol, it will be consumed. + + Use this method if you want to match a specific symbol from the + input. In that case, typically error reporting related to the token + is only going to occur because of a mismatch, so no location + information is needed by the caller. + + WrongTokenType will be thrown if the next token in the input stream + is not a symbol. WrongSymbol will be thrown if the next token in the + input stream is a symbol but does not match the @p symbol parameter. + When an exception is thrown, no tokens are consumed. + */ + void readSymbol(const std::string& symbol); + + + /** Read a series of two specific symbols. See readSymbol. */ + inline void readSymbols(const std::string& s1, const std::string& s2) { + readSymbol(s1); + readSymbol(s2); + } + + /** Read a series of three specific symbols. See readSymbol. */ + inline void readSymbols( + const std::string& s1, + const std::string& s2, + const std::string& s3) { + readSymbol(s1); + readSymbol(s2); + readSymbol(s3); + } + + /** Read a series of four specific symbols. See readSymbol. */ + inline void readSymbols( + const std::string& s1, + const std::string& s2, + const std::string& s3, + const std::string& s4) { + readSymbol(s1); + readSymbol(s2); + readSymbol(s3); + readSymbol(s4); + } + + /** Return a copy of the next token in the input stream, but don't remove + it from the input stream. + */ + Token peek(); + + /** Returns the line number for the @e next token. See also peek. */ + int peekLineNumber(); + + /** Returns the character number (relative to the line) for the @e next + token in the input stream. See also peek. + */ + int peekCharacterNumber(); + + /** Take a previously read token and push it back at the front of the + input stream. + + Can be used in the case where more than one token of read-ahead is + needed (i.e., when peek doesn't suffice). + */ + void push(const Token& t); + + /** Returns the filename from which this input is drawn, or the first few + characters of the string if created from a string. + If settings::filename is non-empty that will replace the + true filename.*/ + const std::string& filename() const; +}; + +void deserialize(bool& b, TextInput& ti); +void deserialize(int& b, TextInput& ti); +void deserialize(uint8& b, TextInput& ti); +void deserialize(double& b, TextInput& ti); +void deserialize(float& b, TextInput& ti); +void deserialize(std::string& b, TextInput& ti); + +} // namespace + +#endif + diff --git a/externals/g3dlite/G3D/TextOutput.h b/externals/g3dlite/G3D/TextOutput.h new file mode 100644 index 0000000..4c22b7d --- /dev/null +++ b/externals/g3dlite/G3D/TextOutput.h @@ -0,0 +1,249 @@ +/** + @file TextOutput.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2004-06-21 + @edited 2006-10-24 + + Copyright 2000-2007, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_TEXTOUTPUT_H +#define G3D_TEXTOUTPUT_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include + +namespace G3D { + +/** + Convenient formatting of ASCII text written to a file. +

+ + The core writeString, writeNumber, and writeSymbol methods map to TextInput's + methods. Number and Symbol each print an additional space that is used to + separate adjacent tokens. + + TextOutput::printf allows arbitrary text to be conveniently dumped + en-masse. Use [de]serialize(bool, TextOutput) and other overloads to read/write + primitive types in a standardized manner and + +

+ When a word-wrap line break occurs, all whitespace between words is replaced + with a single newline (the newline may be two characters-- see + G3D::TextOutput::Options::NewlineStyle). Word wrapping occurs against + the number of columns specified by Options::numColumns, minus the current + indent level. + + Indenting adds the specified number of spaces immediately after a newline. + If a newline was followed by spaces in the original string, these are added + to the indent spaces. Indenting will indent blank lines and will leave + indents after the last newline of a file (if the indent level is non-zero at the end). + +

Serialization/Marshalling +

Text serialization is accomplished using TextOutput by defining the pair of + methods: + +
+  void serialize(TextOutput& to) const;
+  void deserialize(TextInput& ti);
+  
+ + See also G3D::TextInput. + +

+ BETA API +

This API is subject to change in future versions. + */ +class TextOutput { +public: + + class Settings { + public: + /** + WRAP_NONE Word wrapping is disabled + WRAP_WITHOUT_BREAKING Word-wrap, but don't break continuous lines that + are longer than numColumns (default) + WRAP_ALWAYS Wrap even if it means breaking a continuous line or + a quoted string. + + Word wrapping is only allowed at whitespaces ('\\n', '\\r', '\\t', ' '); it + will not occur after commas, punctuation, minus signs, or any other characters + */ + enum WordWrapMode {WRAP_NONE, WRAP_WITHOUT_BREAKING, WRAP_ALWAYS}; + + /** Defaults to WRAP_WITHOUT_BREAKING */ + WordWrapMode wordWrap; + + /** Is word-wrapping allowed to insert newlines inside double quotes? + Default: false */ + bool allowWordWrapInsideDoubleQuotes; + + /** Number of columns for word wrapping. Default: 8 */ + int numColumns; + + /** Number of spaces in each indent. Default: 4 */ + int spacesPerIndent; + + /** Style of newline used by word wrapping and by (optional) conversion. + default: Windows: NEWLINE_WINDOWS, Linux, OS X: NEWLINE_UNIX. + */ + enum NewlineStyle {NEWLINE_WINDOWS, NEWLINE_UNIX}; + + NewlineStyle newlineStyle; + + /** If true, all newlines are converted to NewlineStyle regardless of + how they start out. Default: true. */ + bool convertNewlines; + + /** Used by writeBoolean */ + std::string trueSymbol; + + /** Used by writeBoolean */ + std::string falseSymbol; + + Settings() : + wordWrap(WRAP_WITHOUT_BREAKING), + allowWordWrapInsideDoubleQuotes(false), + numColumns(80), + spacesPerIndent(4), + convertNewlines(true), + trueSymbol("true"), + falseSymbol("false") { + #ifdef G3D_WIN32 + newlineStyle = NEWLINE_WINDOWS; + #else + newlineStyle = NEWLINE_UNIX; + #endif + } + }; + +private: + + /** Used by indentAndAppend to tell when we are writing the + first character of a new line. + + So that push/popIndent work correctly, we cannot indent + immediately after writing a newline. Instead we must + indent on writing the first character after that + newline. + */ + bool startingNewLine; + + /** Number of characters at the end of the buffer since the last newline */ + int currentColumn; + + /** True if we have seen an open " and no close ".*/ + bool inDQuote; + + /** Empty if there is none */ + std::string filename; + + Array data; + + Settings option; + + /** Number of indents to prepend before each line. Always set using setIndentLevel.*/ + int indentLevel; + + void setIndentLevel(int i); + + /** Actual number of spaces to indent. */ + int indentSpaces; + + /** the newline character(s) */ + std::string newline; + + void setOptions(const Settings& _opt); + + /** Converts to the desired newlines. Called from vprintf */ + void convertNewlines(const std::string& in, std::string& out); + + /** Called from vprintf */ + void wordWrapIndentAppend(const std::string& str); + + /** Appends the character to data, indenting whenever a newline is encountered. + Called from wordWrapIndentAppend */ + void indentAppend(char c); + +public: + + explicit TextOutput(const std::string& filename, const Settings& options = Settings()); + + /** Constructs a text output that can later be commited to a string instead of a file.*/ + explicit TextOutput(const Settings& options = Settings()); + + /** Commit to the filename specified on the constructor. + Not called from the destructor; you must call + it yourself. + @param flush If true (default) the file is ready for reading when the method returns, otherwise + the method returns immediately and writes the file in the background.*/ + void commit(bool flush = true); + + /** Commits to this string */ + void commitString(std::string& string); + + /** Increase indent level by 1 */ + void pushIndent(); + + void popIndent(); + + /** Produces a new string that contains the output */ + std::string commitString(); + + /** Writes a quoted string. Special characters in the string (e.g., \\, \\t, \\n) are escaped so that + TextInput will produce the identical string on reading.*/ + void writeString(const std::string& string); + + void writeBoolean(bool b); + + void writeNumber(double n); + + void writeNumber(int n); + + void writeNewline(); + void writeNewlines(int numLines); + + /** The symbol is written without quotes. Symbols are required to begin with a + letter or underscore and contain only letters, underscores, and numbers + or be a C++ symbol (e.g. "{", "(", "++", etc.) + so that they may be properly parsed by TextInput::readSymbol. Symbols are + printed with a trailing space.*/ + void writeSymbol(const std::string& string); + + /** Convenient idiom for writing multiple symbols in a row, e.g. + writeSymbols("name", "="); The empty symbols are not written. + */ + void writeSymbols( + const std::string& a, + const std::string& b = "", + const std::string& c = "", + const std::string& d = "", + const std::string& e = "", + const std::string& f = ""); + + /** Normal printf conventions. Note that the output will be reformatted + for word-wrapping and newlines */ + void __cdecl printf(const char* fmt, ...) + G3D_CHECK_PRINTF_METHOD_ARGS; + + // Can't pass by reference because that confuses va_start + void __cdecl printf(const std::string fmt, ...); + void __cdecl vprintf(const char* fmt, va_list argPtr) + G3D_CHECK_VPRINTF_METHOD_ARGS; +}; + +// Primitive serializers +void serialize(const bool& b, TextOutput& to); +void serialize(const int& b, TextOutput& to); +void serialize(const uint8& b, TextOutput& to); +void serialize(const double& b, TextOutput& to); +void serialize(const float& b, TextOutput& to); +void serialize(const std::string& b, TextOutput& to); +void serialize(const char* b, TextOutput& to); + +} + +#endif diff --git a/externals/g3dlite/G3D/ThreadSet.h b/externals/g3dlite/G3D/ThreadSet.h new file mode 100644 index 0000000..121f141 --- /dev/null +++ b/externals/g3dlite/G3D/ThreadSet.h @@ -0,0 +1,87 @@ +#ifndef G3D_THREADSET_H +#define G3D_THREADSET_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/ReferenceCount.h" +#include "G3D/GThread.h" +#include "G3D/GMutex.h" + +namespace G3D { + +/** Manages a set of threads. All methods are threadsafe except for + the iterator begin/end. + + @beta*/ +class ThreadSet : public ReferenceCountedObject { +public: + /** Intended to allow future use with a template parameter.*/ + typedef GThread Thread; + + typedef ReferenceCountedPointer ThreadRef; + typedef ReferenceCountedPointer Ref; + typedef Array::Iterator Iterator; + typedef Array::ConstIterator ConstIterator; + +private: + + /** Protects m_thread */ + GMutex m_lock; + + /** Threads in the set */ + Array m_thread; + +public: + + /** Total number of threads (some of which may be completed). */ + int size() const; + + /** Number of threads that have been started */ + int numStarted() const; + + /** Start all threads that are not currently started. + + @param lastThreadBehavior If USE_CURRENT_THREAD, takes the last unstarted thread and executes it manually on + the current thread. This helps to take full advantage of the machine when + running a large number of jobs and avoids the overhead of a thread start for single-thread groups. + Note that this forces start() to block until + that thread is complete. + */ + void start(GThread::SpawnBehavior lastThreadBehavior = GThread::USE_NEW_THREAD) const; + + /** Terminate all threads that are currently started */ + void terminate() const; + + /** Waits until all started threads have completed. */ + void waitForCompletion() const; + + /** Remove all (not stopping them) */ + void clear(); + + /** Removes completed threads and returns the new size.*/ + int removeCompleted(); + + /** Inserts a new thread, if it is not already present, and + returns the new number of threads.*/ + int insert(const ThreadRef& t); + + /** Removes a thread. Returns true if the thread was present and + removed. */ + bool remove(const ThreadRef& t); + + bool contains(const ThreadRef& t) const; + + /** It is an error to mutate the ThreadSet while iterating through it. */ + Iterator begin(); + + Iterator end(); + + ConstIterator begin() const; + + ConstIterator end() const; +}; + + +} // namespace G3D + +#endif diff --git a/externals/g3dlite/G3D/Triangle.h b/externals/g3dlite/G3D/Triangle.h new file mode 100644 index 0000000..590dbaa --- /dev/null +++ b/externals/g3dlite/G3D/Triangle.h @@ -0,0 +1,160 @@ +/** + @file Triangle.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-04-05 + @edited 2008-10-06 + + @cite Random point method by Greg Turk, Generating random points in triangles. In A. S. Glassner, ed., Graphics Gems, pp. 24-28. Academic Press, 1990 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_TRIANGLE_H +#define G3D_TRIANGLE_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Vector3.h" +#include "G3D/Plane.h" +#include "G3D/BoundsTrait.h" +#include "G3D/debugAssert.h" +#include + +namespace G3D { + +/** + A generic triangle representation. This should not be used + as the underlying triangle for creating models; it is intended + for providing fast property queries but requires a lot of + storage and is mostly immutable. + */ +class Triangle { +private: + friend class CollisionDetection; + friend class Ray; + + Vector3 _vertex[3]; + + /** edgeDirection[i] is the normalized vector v[i+1] - v[i] */ + Vector3 edgeDirection[3]; + float edgeMagnitude[3]; + Plane _plane; + Vector3::Axis _primaryAxis; + + /** vertex[1] - vertex[0] */ + Vector3 _edge01; + + /** vertex[2] - vertex[0] */ + Vector3 _edge02; + + float _area; + + void init(const Vector3& v0, const Vector3& v1, const Vector3& v2); + +public: + + Triangle(class BinaryInput& b); + void serialize(class BinaryOutput& b); + void deserialize(class BinaryInput& b); + + Triangle(); + + Triangle(const Vector3& v0, const Vector3& v1, const Vector3& v2); + + ~Triangle(); + + /** 0, 1, or 2 */ + inline const Vector3& vertex(int n) const { + debugAssert((n >= 0) && (n < 3)); + return _vertex[n]; + } + + /** vertex[1] - vertex[0] */ + inline const Vector3& edge01() const { + return _edge01; + } + + /** vertex[2] - vertex[0] */ + inline const Vector3& edge02() const { + return _edge02; + } + + float area() const; + + Vector3::Axis primaryAxis() const { + return _primaryAxis; + } + + const Vector3& normal() const; + + /** Barycenter */ + Vector3 center() const; + + const Plane& plane() const; + + /** Returns a random point in the triangle. */ + Vector3 randomPoint() const; + + inline void getRandomSurfacePoint + (Vector3& P, + Vector3& N = Vector3::ignore()) const { + P = randomPoint(); + N = normal(); + } + + /** + For two triangles to be equal they must have + the same vertices in the same order. + That is, vertex[0] == vertex[0], etc. + */ + inline bool operator==(const Triangle& other) const { + for (int i = 0; i < 3; ++i) { + if (_vertex[i] != other._vertex[i]) { + return false; + } + } + + return true; + } + + inline size_t hashCode() const { + return + _vertex[0].hashCode() + + (_vertex[1].hashCode() >> 2) + + (_vertex[2].hashCode() >> 3); + } + + void getBounds(class AABox&) const; + + /** + @brief Intersect the ray at distance less than @a distance. + + @param distance Set to the maximum distance (can be G3D::inf()) + to search for an intersection. On return, this is the smaller + of the distance to the intersection, if one exists, and the original + value. + + @param baryCoord If a triangle is hit before @a distance, a + the barycentric coordinates of the hit location on the triangle. + Otherwise, unmodified. + + @return True if there was an intersection before the original distance. + */ + bool intersect(const class Ray& ray, float& distance, float baryCoord[3]) const; +}; + +} // namespace G3D + +template <> struct HashTrait { + static size_t hashCode(const G3D::Triangle& key) { return key.hashCode(); } +}; + + +template<> struct BoundsTrait { + static void getBounds(const G3D::Triangle& t, G3D::AABox& out) { t.getBounds(out); } +}; + +#endif diff --git a/externals/g3dlite/G3D/UprightFrame.h b/externals/g3dlite/G3D/UprightFrame.h new file mode 100644 index 0000000..ad5157c --- /dev/null +++ b/externals/g3dlite/G3D/UprightFrame.h @@ -0,0 +1,83 @@ +/** + @file UprightFrame.h + + @author Morgan McGuire, http://graphics.cs.williams.edu + */ + +#ifndef G3D_UPRIGHTFRAME_H +#define G3D_UPRIGHTFRAME_H + +#include "G3D/platform.h" +#include "G3D/Spline.h" +#include "G3D/Vector3.h" +#include "G3D/CoordinateFrame.h" + +namespace G3D { + +/** + Coordinate frame expressed in Euler angles. + Unlike a G3D::Quat, UprightFrame always keeps the reference frame from rolling about its own z axis. + Particularly useful for cameras. + + @sa G3D::CoordinateFrame, G3D::Matrix4, G3D::PhysicsFrame, G3D::UprightSpline, G3D::UprightSplineManipulator + */ +class UprightFrame { +public: + + Vector3 translation; + + /** -pi/2 < pitch < pi/2 in radians about the X-axis */ + float pitch; + + /** In radians about the Y-axis */ + float yaw; + + inline UprightFrame(const Vector3& t = Vector3::zero(), float p = 0, float y = 0) + : translation(t), pitch(p), yaw(y) {} + + UprightFrame(const CoordinateFrame& cframe); + + CoordinateFrame toCoordinateFrame() const; + + /** Supports implicit cast to CoordinateFrame */ + inline operator CoordinateFrame() const { + return toCoordinateFrame(); + } + + /** Required for use with spline */ + UprightFrame operator+(const UprightFrame& other) const; + + /** Required for use with spline */ + UprightFrame operator*(const float k) const; + + /** + Unwraps the yaw values in the elements of the array such that + they still represent the same angles but strictly increase/decrease + without wrapping about zero. For use with Spline + */ + static void unwrapYaw(UprightFrame* a, int N); + + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); +}; + +/** Shortest-path linear velocity spline for camera positions. Always keeps the camera from rolling. +@sa G3D::UprightSplineManipulator, G3D::UprightFrame +*/ +class UprightSpline : public Spline { +protected: + + virtual void ensureShortestPath(UprightFrame* A, int N) const { + UprightFrame::unwrapYaw(A, N); + } + +public: + + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/Vector2.h b/externals/g3dlite/G3D/Vector2.h new file mode 100644 index 0000000..dba7353 --- /dev/null +++ b/externals/g3dlite/G3D/Vector2.h @@ -0,0 +1,454 @@ +/** + @file Vector2.h + + 2D vector class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2008-11-30 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. +*/ + +#ifndef G3D_VECTOR2_H +#define G3D_VECTOR2_H + +#include + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Table.h" +#include "G3D/HashTrait.h" +#include "G3D/Vector2int16.h" +#include "G3D/Random.h" + +namespace G3D { + +class Vector2; +class Vector3; +class Vector4; +class Any; + +/** + Do not subclass-- this implementation makes assumptions about the + memory layout. + */ +class Vector2 { +private: + // Hidden operators + bool operator<(const Vector2&) const; + bool operator>(const Vector2&) const; + bool operator<=(const Vector2&) const; + bool operator>=(const Vector2&) const; + +public: + float x; + float y; + + /** \param any Must either Vector2(#, #) or Vector2 {x = #, y = #}*/ + Vector2(const Any& any); + + /** Converts the Vector2 to an Any. */ + operator Any() const; + + /** Creates the zero vector */ + Vector2(); + Vector2(class TextInput& t); + Vector2(class BinaryInput& b); + Vector2(float x, float y); + Vector2(float coordinate[2]); + Vector2(double coordinate[2]); + Vector2(const Vector2& other); + Vector2(const Vector2int16& other); + + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + void serialize(class TextOutput& t) const; + void deserialize(class TextInput& t); + + float& operator[](int i); + const float& operator[](int i) const; + + // assignment and comparison + Vector2& operator=(const Vector2& other); + bool operator==(const Vector2& other) const; + bool operator!=(const Vector2& other) const; + size_t hashCode() const; + bool fuzzyEq(const Vector2& other) const; + bool fuzzyNe(const Vector2& other) const; + + /** Returns true if this vector has finite length */ + bool isFinite() const; + + /** Returns true if this vector has length == 0 */ + bool isZero() const; + + /** Returns true if this vector has length == 1 */ + bool isUnit() const; + + // arithmetic operations + Vector2 operator+(const Vector2& v) const; + Vector2 operator-(const Vector2& v) const; + Vector2 operator*(float s) const; + + /** Array (pointwise) multiplication */ + Vector2 operator*(const Vector2& v) const; + + /** Array division */ + Vector2 operator/(const Vector2& v) const; + Vector2 operator/(float s) const; + + /** Unary minus */ + Vector2 operator-() const; + + /** x + y */ + inline float sum() const { + return x + y; + } + + /** + Linear interpolation + */ + inline Vector2 lerp(const Vector2& v, float alpha) const { + return (*this) + (v - *this) * alpha; + } + + inline Vector2 clamp(const Vector2& low, const Vector2& high) const { + return Vector2( + G3D::clamp(x, low.x, high.x), + G3D::clamp(y, low.y, high.y)); + } + + inline Vector2 clamp(float low, float high) const { + return Vector2( + (float)G3D::clamp(x, low, high), + (float)G3D::clamp(y, low, high)); + } + + // arithmetic updates + Vector2& operator+=(const Vector2&); + Vector2& operator-=(const Vector2&); + Vector2& operator*=(float); + Vector2& operator/=(float); + Vector2& operator*=(const Vector2&); + Vector2& operator/=(const Vector2&); + + // vector operations + + /** */ + float length() const; + + /** Returns a unit-length vector */ + Vector2 direction() const; + + /** + Potentially less accurate but faster than direction(). + Only works if System::hasSSE is true. + */ + Vector2 fastDirection() const { + return direction(); + } + + float squaredLength() const; + float dot(const Vector2& s) const; + + /** + Make this vector have unit length and return the old length. + If the vector length was less than tolerance, do not normalize. + */ + float unitize(float fTolerance = 1e-06); + + Vector2 min(const Vector2& v) const; + Vector2 max(const Vector2& v) const; + + /** Uniformly distributed random vector on the unit sphere */ + static Vector2 random(Random& r = Random::common()); + + // Special values. + // Intentionally not inlined: see Matrix3::identity() for details. + static const Vector2& zero(); + static const Vector2& one(); + static const Vector2& unitX(); + static const Vector2& unitY(); + static const Vector2& inf(); + static const Vector2& nan(); + /** smallest (most negative) representable vector */ + static const Vector2& minFinite(); + /** Largest representable vector */ + static const Vector2& maxFinite(); + + std::string toString() const; + + // 2-char swizzles + + Vector2 xx() const; + Vector2 yx() const; + Vector2 xy() const; + Vector2 yy() const; + + // 3-char swizzles + + Vector3 xxx() const; + Vector3 yxx() const; + Vector3 xyx() const; + Vector3 yyx() const; + Vector3 xxy() const; + Vector3 yxy() const; + Vector3 xyy() const; + Vector3 yyy() const; + + // 4-char swizzles + + Vector4 xxxx() const; + Vector4 yxxx() const; + Vector4 xyxx() const; + Vector4 yyxx() const; + Vector4 xxyx() const; + Vector4 yxyx() const; + Vector4 xyyx() const; + Vector4 yyyx() const; + Vector4 xxxy() const; + Vector4 yxxy() const; + Vector4 xyxy() const; + Vector4 yyxy() const; + Vector4 xxyy() const; + Vector4 yxyy() const; + Vector4 xyyy() const; + Vector4 yyyy() const; + +}; + +inline Vector2 operator*(double s, const Vector2& v) { + return v * (float)s; +} + +inline Vector2 operator*(float s, const Vector2& v) { + return v * s; +} + +inline Vector2 operator*(int s, const Vector2& v) { + return v * (float)s; +} + + +inline Vector2::Vector2 () : x(0.0f), y(0.0f) { +} + + +inline Vector2::Vector2(float _x, float _y) : x(_x), y(_y) { +} + + +inline Vector2::Vector2 (float afCoordinate[2]) { + x = afCoordinate[0]; + y = afCoordinate[1]; +} + + + +inline Vector2::Vector2 (double afCoordinate[2]) { + x = (float)afCoordinate[0]; + y = (float)afCoordinate[1]; +} + + +inline Vector2::Vector2 (const Vector2& rkVector) { + x = rkVector.x; + y = rkVector.y; +} + + +inline Vector2::Vector2 (const Vector2int16& v) : x(v.x), y(v.y) { +} + + +inline float& Vector2::operator[] (int i) { + return ((float*)this)[i]; +} + + +inline const float& Vector2::operator[] (int i) const { + return ((float*)this)[i]; +} + + +inline Vector2& Vector2::operator= (const Vector2& rkVector) { + x = rkVector.x; + y = rkVector.y; + return *this; +} + + +inline bool Vector2::operator== (const Vector2& rkVector) const { + return ( x == rkVector.x && y == rkVector.y); +} + + +inline bool Vector2::operator!= (const Vector2& rkVector) const { + return ( x != rkVector.x || y != rkVector.y); +} + + +inline Vector2 Vector2::operator+ (const Vector2& rkVector) const { + return Vector2(x + rkVector.x, y + rkVector.y); +} + + +inline Vector2 Vector2::operator- (const Vector2& rkVector) const { + return Vector2(x - rkVector.x, y - rkVector.y); +} + + +inline Vector2 Vector2::operator* (float fScalar) const { + return Vector2(fScalar*x, fScalar*y); +} + + + +inline Vector2 Vector2::operator- () const { + return Vector2( -x, -y); +} + + + +inline Vector2& Vector2::operator+= (const Vector2& rkVector) { + x += rkVector.x; + y += rkVector.y; + return *this; +} + + + +inline Vector2& Vector2::operator-= (const Vector2& rkVector) { + x -= rkVector.x; + y -= rkVector.y; + return *this; +} + + + +inline Vector2& Vector2::operator*= (float fScalar) { + x *= fScalar; + y *= fScalar; + return *this; +} + + + + +inline Vector2& Vector2::operator*= (const Vector2& rkVector) { + x *= rkVector.x; + y *= rkVector.y; + return *this; +} + + + +inline Vector2& Vector2::operator/= (const Vector2& rkVector) { + x /= rkVector.x; + y /= rkVector.y; + return *this; +} + + +inline Vector2 Vector2::operator* (const Vector2& rkVector) const { + return Vector2(x * rkVector.x, y * rkVector.y); +} + + + +inline Vector2 Vector2::operator/ (const Vector2& rkVector) const { + return Vector2(x / rkVector.x, y / rkVector.y); +} + + +inline float Vector2::squaredLength () const { + return x*x + y*y; +} + + +inline float Vector2::length () const { + return sqrtf(x*x + y*y); +} + + +inline Vector2 Vector2::direction () const { + float lenSquared = x * x + y * y; + + if (lenSquared != 1.0f) { + return *this / sqrtf(lenSquared); + } else { + return *this; + } +} + + + +inline float Vector2::dot (const Vector2& rkVector) const { + return x*rkVector.x + y*rkVector.y; +} + + + +inline Vector2 Vector2::min(const Vector2 &v) const { + return Vector2(G3D::min(v.x, x), G3D::min(v.y, y)); +} + + + +inline Vector2 Vector2::max(const Vector2 &v) const { + return Vector2(G3D::max(v.x, x), G3D::max(v.y, y)); +} + + + +inline bool Vector2::fuzzyEq(const Vector2& other) const { + return G3D::fuzzyEq((*this - other).squaredLength(), 0); +} + + + +inline bool Vector2::fuzzyNe(const Vector2& other) const { + return G3D::fuzzyNe((*this - other).squaredLength(), 0); +} + + + +inline bool Vector2::isFinite() const { + return G3D::isFinite(x) && G3D::isFinite(y); +} + + + +inline bool Vector2::isZero() const { + return (x == 0.0f) && (y == 0.0f); +} + + + +inline bool Vector2::isUnit() const { + return squaredLength() == 1.0f; +} + +} // namespace G3D + +template <> +struct HashTrait { + static size_t hashCode(const G3D::Vector2& key) { + return key.hashCode(); + } +}; + + +// Intentionally outside namespace to avoid operator overloading confusion +inline G3D::Vector2 operator*(double s, const G3D::Vector2& v) { + return v * (float)s; +} +inline G3D::Vector2 operator*(int s, const G3D::Vector2& v) { + return v * (float)s; +} + +#endif diff --git a/externals/g3dlite/G3D/Vector2.inl b/externals/g3dlite/G3D/Vector2.inl new file mode 100644 index 0000000..4f7c55a --- /dev/null +++ b/externals/g3dlite/G3D/Vector2.inl @@ -0,0 +1,18 @@ +/** + @file Vector2.inl + + @maintainer Morgan McGuire, matrix@graphics3d.com + @cite Portions by Laura Wollstadt, graphics3d.com + + @cite Portions based on Dave Eberly'x Magic Software Library + at http://www.magic-software.com + + @created 2001-06-02 + @edited 2006-01-14 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +} + diff --git a/externals/g3dlite/G3D/Vector2int16.h b/externals/g3dlite/G3D/Vector2int16.h new file mode 100644 index 0000000..ba72266 --- /dev/null +++ b/externals/g3dlite/G3D/Vector2int16.h @@ -0,0 +1,127 @@ +/** + @file Vector2int16.h + + @maintainer Morgan McGuire, matrix@brown.edu + + @created 2003-08-09 + @edited 2004-01-03 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef VECTOR2INT16_H +#define VECTOR2INT16_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/HashTrait.h" + +namespace G3D { + +/** + \class Vector2int16 + A Vector2 that packs its fields into uint16s. + */ +G3D_BEGIN_PACKED_CLASS(2) +class Vector2int16 { +private: + // Hidden operators + bool operator<(const Vector2int16&) const; + bool operator>(const Vector2int16&) const; + bool operator<=(const Vector2int16&) const; + bool operator>=(const Vector2int16&) const; + +public: + G3D::int16 x; + G3D::int16 y; + + Vector2int16() : x(0), y(0) {} + Vector2int16(G3D::int16 _x, G3D::int16 _y) : x(_x), y(_y){} + Vector2int16(const class Vector2& v); + Vector2int16(class BinaryInput& bi); + + inline G3D::int16& operator[] (int i) { + debugAssert(((unsigned int)i) <= 1); + return ((G3D::int16*)this)[i]; + } + + inline const G3D::int16& operator[] (int i) const { + debugAssert(((unsigned int)i) <= 1); + return ((G3D::int16*)this)[i]; + } + + inline Vector2int16 operator+(const Vector2int16& other) const { + return Vector2int16(x + other.x, y + other.y); + } + + inline Vector2int16 operator-(const Vector2int16& other) const { + return Vector2int16(x - other.x, y - other.y); + } + + inline Vector2int16 operator*(const Vector2int16& other) const { + return Vector2int16(x * other.x, y * other.y); + } + + inline Vector2int16 operator*(const int s) const { + return Vector2int16(x * s, y * s); + } + + inline Vector2int16& operator+=(const Vector2int16& other) { + x += other.x; + y += other.y; + return *this; + } + + /** Shifts both x and y */ + inline Vector2int16 operator>>(const int s) const { + return Vector2int16(x >> s, y >> s); + } + + /** Shifts both x and y */ + inline Vector2int16 operator<<(const int s) const { + return Vector2int16(x << s, y << s); + } + + inline Vector2int16& operator-=(const Vector2int16& other) { + x -= other.x; + y -= other.y; + return *this; + } + + inline Vector2int16& operator*=(const Vector2int16& other) { + x *= other.x; + y *= other.y; + return *this; + } + + Vector2int16 clamp(const Vector2int16& lo, const Vector2int16& hi); + + inline bool operator== (const Vector2int16& rkVector) const { + return ((int32*)this)[0] == ((int32*)&rkVector)[0]; + } + + inline bool operator!= (const Vector2int16& rkVector) const { + return ((int32*)this)[0] != ((int32*)&rkVector)[0]; + } + + Vector2int16 max(const Vector2int16& v) const { + return Vector2int16(iMax(x, v.x), iMax(y, v.y)); + } + + Vector2int16 min(const Vector2int16& v) const { + return Vector2int16(iMin(x, v.x), iMin(y, v.y)); + } + + void serialize(class BinaryOutput& bo) const; + void deserialize(class BinaryInput& bi); +} +G3D_END_PACKED_CLASS(2) + +} + +template<> struct HashTrait { + static size_t hashCode(const G3D::Vector2int16& key) { return static_cast(key.x + ((int)key.y << 16)); } +}; + +#endif diff --git a/externals/g3dlite/G3D/Vector3.h b/externals/g3dlite/G3D/Vector3.h new file mode 100644 index 0000000..4825efb --- /dev/null +++ b/externals/g3dlite/G3D/Vector3.h @@ -0,0 +1,798 @@ +/** + @file Vector3.h + + 3D vector class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-06-02 + @edited 2009-11-01 + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Vector3_h +#define G3D_Vector3_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Random.h" +#include "G3D/Vector2.h" +#include "G3D/Table.h" +#include "G3D/HashTrait.h" +#include "G3D/PositionTrait.h" +#include "G3D/Vector2.h" +#include +#include + +namespace G3D { + +class Vector2; +class Vector4; +class Vector4int8; +class Vector3int32; +class Any; + +/** + Swizzles + Vector classes have swizzle operators, e.g. v.xy(), that + allow selection of arbitrary sub-fields. These cannot be used as write + masks. Examples + +
+Vector3 v(1, 2, 3);
+Vector3 j;
+Vector2 b;
+
+b = v.xz();
+j = b.xx();
+
+ + + Warning + + Do not subclass-- this implementation makes assumptions about the + memory layout. + */ +class Vector3 { +public: + + // coordinates + float x, y, z; + +private: + + // Hidden operators + bool operator<(const Vector3&) const; + bool operator>(const Vector3&) const; + bool operator<=(const Vector3&) const; + bool operator>=(const Vector3&) const; + +public: + /** Initializes to zero */ + Vector3(); + + /** \param any Must either Vector3(#, #, #) or Vector3 {x = #, y = #, z = #}*/ + Vector3(const Any& any); + + /** Converts the Vector3 to an Any. */ + operator Any() const; + + /** Divides by 127 */ + Vector3(const Vector4int8&); + Vector3(const class Vector3int32& v); + explicit Vector3(class BinaryInput& b); + Vector3(float _x, float _y, float _z); + explicit Vector3(const class Vector2& v, float _z); + explicit Vector3(float coordinate[3]); + explicit Vector3(double coordinate[3]); + Vector3(const class Vector3int16& v); + explicit Vector3(class TextInput& t); + explicit Vector3(const class Color3& c); + + /** Format is three float32's */ + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + /** Format is "(%f, %f, %f)" */ + void serialize(class TextOutput& t) const; + void deserialize(class TextInput& t); + + // access vector V as V[0] = V.x, V[1] = V.y, V[2] = V.z + // + // WARNING. These member functions rely on + // (1) Vector3 not having virtual functions + // (2) the data packed in a 3*sizeof(float) memory block + const float& __fastcall operator[] (int i) const; + float& operator[] (int i); + + enum Axis {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, DETECT_AXIS=-1}; + + /** + Returns the largest dimension. Particularly convenient for determining + which plane to project a triangle onto for point-in-polygon tests. + */ + Axis primaryAxis() const; + + // assignment and comparison + Vector3& __fastcall operator= (const Vector3& rkVector); + bool operator== (const Vector3& rkVector) const; + bool operator!= (const Vector3& rkVector) const; + size_t hashCode() const; + bool fuzzyEq(const Vector3& other) const; + bool fuzzyNe(const Vector3& other) const; + + /** Returns true if this vector has finite length. */ + bool isFinite() const; + + /** Returns true if this vector has length ~= 0 */ + bool isZero() const; + + /** Returns true if this vector has length ~= 1 */ + bool isUnit() const; + + // arithmetic operations + Vector3 __fastcall operator+ (const Vector3& v) const; + Vector3 __fastcall operator- (const Vector3& v) const; + Vector3 __fastcall operator* (float s) const; + inline Vector3 __fastcall operator/ (float s) const { + return *this * (1.0f / s); + } + Vector3 __fastcall operator* (const Vector3& v) const; + Vector3 __fastcall operator/ (const Vector3& v) const; + Vector3 __fastcall operator- () const; + + // arithmetic updates + Vector3& __fastcall operator+= (const Vector3& v); + Vector3& __fastcall operator-= (const Vector3& v); + Vector3& __fastcall operator*= (float s); + inline Vector3& __fastcall operator/= (float s) { + return (*this *= (1.0f / s)); + } + Vector3& __fastcall operator*= (const Vector3& v); + Vector3& __fastcall operator/= (const Vector3& v); + + /** Same as magnitude */ + float length() const; + + float magnitude() const; + + /** + The result is a nan vector if the length is almost zero. + */ + Vector3 direction() const; + + /** + Potentially less accurate but faster than direction(). + Only works if System::hasSSE is true. + */ + Vector3 fastDirection() const; + + /** + Reflect this vector about the (not necessarily unit) normal. + Assumes that both the before and after vectors point away from + the base of the normal. + + Note that if used for a collision or ray reflection you + must negate the resulting vector to get a direction pointing + away from the collision. + +
+       V'    N      V
+                 
+         r   ^   -,
+          \  |  /
+            \|/
+     
+ + See also Vector3::reflectionDirection + */ + Vector3 reflectAbout(const Vector3& normal) const; + + /** + See also G3D::Ray::reflect. + The length is 1. +
+       V'    N       V
+                 
+         r   ^    /
+          \  |  /
+            \|'-
+     
+ */ + Vector3 reflectionDirection(const Vector3& normal) const; + + + /** + Returns Vector3::zero() if the length is nearly zero, otherwise + returns a unit vector. + */ + inline Vector3 directionOrZero() const { + float mag = magnitude(); + if (G3D::fuzzyEq(mag, 0.0f)) { + return Vector3::zero(); + } else if (G3D::fuzzyEq(mag, 1.0f)) { + return *this; + } else { + return *this * (1.0f / mag); + } + } + + /** + Returns the direction of a refracted ray, + where iExit is the index of refraction for the + previous material and iEnter is the index of refraction + for the new material. Like Vector3::reflectionDirection, + the result has length 1 and is + pointed away from the intersection. + + Returns Vector3::zero() in the case of total internal refraction. + + @param iOutside The index of refraction (eta) outside + (on the positive normal side) of the surface. + + @param iInside The index of refraction (eta) inside + (on the negative normal side) of the surface. + + See also G3D::Ray::refract. +
+              N      V
+                  
+              ^    /
+              |  /
+              |'-
+          __--
+     V'<--
+     
+ */ + Vector3 refractionDirection( + const Vector3& normal, + float iInside, + float iOutside) const; + + /** Synonym for direction */ + inline Vector3 unit() const { + return direction(); + } + + /** Returns a normalized vector. May be computed with lower + precision than unit */ + inline Vector3 fastUnit() const { + return fastDirection(); + } + + /** Same as squaredMagnitude */ + float squaredLength() const; + + float squaredMagnitude () const; + + float __fastcall dot(const Vector3& rkVector) const; + + float unitize(float tolerance = 1e-06); + + /** Cross product. Note that two cross products in a row + can be computed more cheaply: v1 x (v2 x v3) = (v1 dot v3) v2 - (v1 dot v2) v3. + */ + Vector3 __fastcall cross(const Vector3& rkVector) const; + Vector3 unitCross(const Vector3& rkVector) const; + + /** + Returns a matrix such that v.cross() * w = v.cross(w). +
+     [ 0  -v.z  v.y ]
+     [ v.z  0  -v.x ]
+     [ -v.y v.x  0  ]
+     
+ */ + class Matrix3 cross() const; + + Vector3 __fastcall min(const Vector3 &v) const; + Vector3 __fastcall max(const Vector3 &v) const; + + /** Smallest element */ + inline float min() const { + return G3D::min(G3D::min(x, y), z); + } + + /** Largest element */ + inline float max() const { + return G3D::max(G3D::max(x, y), z); + } + + std::string toString() const; + + inline Vector3 clamp(const Vector3& low, const Vector3& high) const { + return Vector3( + G3D::clamp(x, low.x, high.x), + G3D::clamp(y, low.y, high.y), + G3D::clamp(z, low.z, high.z)); + } + + inline Vector3 clamp(float low, float high) const { + return Vector3( + G3D::clamp(x, low, high), + G3D::clamp(y, low, high), + G3D::clamp(z, low, high)); + } + + /** + Linear interpolation + */ + inline Vector3 lerp(const Vector3& v, float alpha) const { + return (*this) + (v - *this) * alpha; + } + + /** Gram-Schmidt orthonormalization. */ + static void orthonormalize (Vector3 akVector[3]); + + /** \brief Random unit vector, uniformly distributed on the sphere. + + Distribution rendered by G3D::DirectionHistogram: + \image html vector3-random.png + */ + static Vector3 random(Random& r = Random::common()); + + /** \brief Random unit vector, distributed according to \f$\max(\cos \theta,0)\f$. + + That is, so that the probability of \f$\vec{V}\f$ is proportional + to \f$\max(\vec{v} \cdot \vec{n}, 0)\f$. Useful in photon mapping for + Lambertian scattering. + + Distribution rendered by G3D::DirectionHistogram: + \image html vector3-coshemirandom.png + + \param n Unit vector at the center of the distribution. + + @cite Henrik Wann Jensen, Realistic Image Synthesis using Photon Mapping eqn 2.24 + */ + static Vector3 cosHemiRandom(const Vector3& n, Random& r = Random::common()); + + /** \brief Random unit vector, distributed according to \f$\max(\cos^k \theta,0)\f$. + + That is, so that the probability of \f$\vec{V}\f$ is + proportional to \f$\max((\vec{v} \cdot \vec{n})^k, 0)\f$. + Useful in photon mapping for glossy scattering. + + Distribution rendered by G3D::DirectionHistogram: + \image html vector3-cospowhemirandom.png + + \param n Unit vector at the center of the distribution. + + @cite Ashikhmin and Shirley, An anisotropic Phong BRDF model, Journal of Graphics Tools, 2002 + */ + static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = Random::common()); + + /** + \brief Random vector distributed over the hemisphere about normal. + + Distribution rendered by G3D::DirectionHistogram: + \image html vector3-hemirandom.png + */ + static Vector3 hemiRandom(const Vector3& normal, Random& r = Random::common()); + + /** Input W must be initialize to a nonzero vector, output is {U,V,W} + an orthonormal basis. A hint is provided about whether or not W + is already unit length. + @deprecated Use getTangents + */ + static void generateOrthonormalBasis (Vector3& rkU, Vector3& rkV, + Vector3& rkW, bool bUnitLengthW = true); + + inline float sum() const { + return x + y + z; + } + + inline float average() const { + return sum() / 3.0f; + } + + // Special values. + static const Vector3& zero(); + static const Vector3& one(); + static const Vector3& unitX(); + static const Vector3& unitY(); + static const Vector3& unitZ(); + static const Vector3& inf(); + static const Vector3& nan(); + + /** Smallest (most negative) representable vector */ + static const Vector3& minFinite(); + + /** Largest representable vector */ + static const Vector3& maxFinite(); + + + /** Creates two orthonormal tangent vectors X and Y such that + if Z = this, X x Y = Z.*/ + inline void getTangents(Vector3& X, Vector3& Y) const { + debugAssertM(G3D::fuzzyEq(length(), 1.0f), + "makeAxes requires Z to have unit length"); + + // Choose another vector not perpendicular + X = (abs(x) < 0.9f) ? Vector3::unitX() : Vector3::unitY(); + + // Remove the part that is parallel to Z + X -= *this * this->dot(X); + X /= X.length(); + + Y = this->cross(X); + } + + + // 2-char swizzles + + Vector2 xx() const; + Vector2 yx() const; + Vector2 zx() const; + Vector2 xy() const; + Vector2 yy() const; + Vector2 zy() const; + Vector2 xz() const; + Vector2 yz() const; + Vector2 zz() const; + + // 3-char swizzles + + Vector3 xxx() const; + Vector3 yxx() const; + Vector3 zxx() const; + Vector3 xyx() const; + Vector3 yyx() const; + Vector3 zyx() const; + Vector3 xzx() const; + Vector3 yzx() const; + Vector3 zzx() const; + Vector3 xxy() const; + Vector3 yxy() const; + Vector3 zxy() const; + Vector3 xyy() const; + Vector3 yyy() const; + Vector3 zyy() const; + Vector3 xzy() const; + Vector3 yzy() const; + Vector3 zzy() const; + Vector3 xxz() const; + Vector3 yxz() const; + Vector3 zxz() const; + Vector3 xyz() const; + Vector3 yyz() const; + Vector3 zyz() const; + Vector3 xzz() const; + Vector3 yzz() const; + Vector3 zzz() const; + + // 4-char swizzles + + Vector4 xxxx() const; + Vector4 yxxx() const; + Vector4 zxxx() const; + Vector4 xyxx() const; + Vector4 yyxx() const; + Vector4 zyxx() const; + Vector4 xzxx() const; + Vector4 yzxx() const; + Vector4 zzxx() const; + Vector4 xxyx() const; + Vector4 yxyx() const; + Vector4 zxyx() const; + Vector4 xyyx() const; + Vector4 yyyx() const; + Vector4 zyyx() const; + Vector4 xzyx() const; + Vector4 yzyx() const; + Vector4 zzyx() const; + Vector4 xxzx() const; + Vector4 yxzx() const; + Vector4 zxzx() const; + Vector4 xyzx() const; + Vector4 yyzx() const; + Vector4 zyzx() const; + Vector4 xzzx() const; + Vector4 yzzx() const; + Vector4 zzzx() const; + Vector4 xxxy() const; + Vector4 yxxy() const; + Vector4 zxxy() const; + Vector4 xyxy() const; + Vector4 yyxy() const; + Vector4 zyxy() const; + Vector4 xzxy() const; + Vector4 yzxy() const; + Vector4 zzxy() const; + Vector4 xxyy() const; + Vector4 yxyy() const; + Vector4 zxyy() const; + Vector4 xyyy() const; + Vector4 yyyy() const; + Vector4 zyyy() const; + Vector4 xzyy() const; + Vector4 yzyy() const; + Vector4 zzyy() const; + Vector4 xxzy() const; + Vector4 yxzy() const; + Vector4 zxzy() const; + Vector4 xyzy() const; + Vector4 yyzy() const; + Vector4 zyzy() const; + Vector4 xzzy() const; + Vector4 yzzy() const; + Vector4 zzzy() const; + Vector4 xxxz() const; + Vector4 yxxz() const; + Vector4 zxxz() const; + Vector4 xyxz() const; + Vector4 yyxz() const; + Vector4 zyxz() const; + Vector4 xzxz() const; + Vector4 yzxz() const; + Vector4 zzxz() const; + Vector4 xxyz() const; + Vector4 yxyz() const; + Vector4 zxyz() const; + Vector4 xyyz() const; + Vector4 yyyz() const; + Vector4 zyyz() const; + Vector4 xzyz() const; + Vector4 yzyz() const; + Vector4 zzyz() const; + Vector4 xxzz() const; + Vector4 yxzz() const; + Vector4 zxzz() const; + Vector4 xyzz() const; + Vector4 yyzz() const; + Vector4 zyzz() const; + Vector4 xzzz() const; + Vector4 yzzz() const; + Vector4 zzzz() const; + + /** Can be passed to ignore a vector3 parameter */ + static Vector3& ignore(); +}; + +inline G3D::Vector3 operator*(float s, const G3D::Vector3& v) { + return v * s; +} + +inline G3D::Vector3 operator*(double s, const G3D::Vector3& v) { + return v * (float)s; +} + +inline G3D::Vector3 operator*(int s, const G3D::Vector3& v) { + return v * (float)s; +} + +std::ostream& operator<<(std::ostream& os, const Vector3&); + + +void serialize(const Vector3::Axis& a, class BinaryOutput& bo); +void deserialize(Vector3::Axis& a, class BinaryInput& bo); + + +//---------------------------------------------------------------------------- +inline Vector3::Vector3() : x(0.0f), y(0.0f), z(0.0f) { +} + +//---------------------------------------------------------------------------- + +inline Vector3::Vector3 (float fX, float fY, float fZ) : x(fX), y(fY), z(fZ) { +} + +//---------------------------------------------------------------------------- +inline Vector3::Vector3 (float V[3]) : x(V[0]), y(V[1]), z(V[2]){ +} + +//---------------------------------------------------------------------------- +inline Vector3::Vector3 (double V[3]) : x((float)V[0]), y((float)V[1]), z((float)V[2]){ +} + +//---------------------------------------------------------------------------- +inline const float& Vector3::operator[] (int i) const { + return ((float*)this)[i]; +} + +inline float& Vector3::operator[] (int i) { + return ((float*)this)[i]; +} + + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator= (const Vector3& rkVector) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::fuzzyEq(const Vector3& other) const { + return G3D::fuzzyEq((*this - other).squaredMagnitude(), 0); +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::fuzzyNe(const Vector3& other) const { + return G3D::fuzzyNe((*this - other).squaredMagnitude(), 0); +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::isFinite() const { + return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z); +} + +//---------------------------------------------------------------------------- +inline bool Vector3::operator== (const Vector3& rkVector) const { + return ( x == rkVector.x && y == rkVector.y && z == rkVector.z ); +} + +//---------------------------------------------------------------------------- +inline bool Vector3::operator!= (const Vector3& rkVector) const { + return ( x != rkVector.x || y != rkVector.y || z != rkVector.z ); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator+ (const Vector3& rkVector) const { + return Vector3(x + rkVector.x, y + rkVector.y, z + rkVector.z); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator- (const Vector3& rkVector) const { + return Vector3(x - rkVector.x, y - rkVector.y, z - rkVector.z); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator* (const Vector3& rkVector) const { + return Vector3(x * rkVector.x, y * rkVector.y, z * rkVector.z); +} + +inline Vector3 Vector3::operator*(float f) const { + return Vector3(x * f, y * f, z * f); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator/ (const Vector3& rkVector) const { + return Vector3(x / rkVector.x, y / rkVector.y, z / rkVector.z); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator- () const { + return Vector3(-x, -y, -z); +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator+= (const Vector3& rkVector) { + x += rkVector.x; + y += rkVector.y; + z += rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator-= (const Vector3& rkVector) { + x -= rkVector.x; + y -= rkVector.y; + z -= rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator*= (float fScalar) { + x *= fScalar; + y *= fScalar; + z *= fScalar; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator*= (const Vector3& rkVector) { + x *= rkVector.x; + y *= rkVector.y; + z *= rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator/= (const Vector3& rkVector) { + x /= rkVector.x; + y /= rkVector.y; + z /= rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline float Vector3::squaredMagnitude () const { + return x*x + y*y + z*z; +} + +//---------------------------------------------------------------------------- +inline float Vector3::squaredLength () const { + return squaredMagnitude(); +} + +//---------------------------------------------------------------------------- +inline float Vector3::magnitude() const { + return ::sqrtf(x*x + y*y + z*z); +} + +//---------------------------------------------------------------------------- +inline float Vector3::length() const { + return magnitude(); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::direction () const { + const float lenSquared = squaredMagnitude(); + const float invSqrt = 1.0f / sqrtf(lenSquared); + return Vector3(x * invSqrt, y * invSqrt, z * invSqrt); +} + +//---------------------------------------------------------------------------- + +inline Vector3 Vector3::fastDirection () const { + float lenSquared = x * x + y * y + z * z; + float invSqrt = rsq(lenSquared); + return Vector3(x * invSqrt, y * invSqrt, z * invSqrt); +} + +//---------------------------------------------------------------------------- +inline float Vector3::dot (const Vector3& rkVector) const { + return x*rkVector.x + y*rkVector.y + z*rkVector.z; +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::cross (const Vector3& rkVector) const { + return Vector3(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z, + x*rkVector.y - y*rkVector.x); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::unitCross (const Vector3& rkVector) const { + Vector3 kCross(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z, + x*rkVector.y - y*rkVector.x); + kCross.unitize(); + return kCross; +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::min(const Vector3 &v) const { + return Vector3(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z)); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::max(const Vector3 &v) const { + return Vector3(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z)); +} + +//---------------------------------------------------------------------------- +inline bool Vector3::isZero() const { + return G3D::fuzzyEq(squaredMagnitude(), 0.0f); +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::isUnit() const { + return G3D::fuzzyEq(squaredMagnitude(), 1.0f); +} + +} // namespace G3D + + +template <> +struct HashTrait { + static size_t hashCode(const G3D::Vector3& key) { + return key.hashCode(); + } +}; + + +template<> struct PositionTrait { + static void getPosition(const G3D::Vector2& v, G3D::Vector3& p) { p = G3D::Vector3(v, 0); } +}; + +template<> struct PositionTrait { + static void getPosition(const G3D::Vector3& v, G3D::Vector3& p) { p = v; } +}; + + +#endif diff --git a/externals/g3dlite/G3D/Vector3.inl b/externals/g3dlite/G3D/Vector3.inl new file mode 100644 index 0000000..9211c2a --- /dev/null +++ b/externals/g3dlite/G3D/Vector3.inl @@ -0,0 +1,249 @@ +/** + @file Vector3.inl + + @maintainer Morgan McGuire, matrix@graphics3d.com + + @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com + + @created 2001-06-02 + @edited 2004-05-21 + Copyright 2000-2004, Morgan McGuire. + All rights reserved. + */ + +//---------------------------------------------------------------------------- +#ifdef SSE + // If you receive an error on this line, it is because you do not have the file + // xmmintrin.h needed for MMX & SSE extensions. Download and install + // + // http://download.microsoft.com/download/vstudio60ent/SP5/Wideband-Full/WIN98Me/EN-US/vs6sp5.exe + // and + // http://download.microsoft.com/download/vb60ent/Update/6/W9X2KXP/EN-US/vcpp5.exe + // + // to get this file. +# include +#endif + +inline unsigned int hashCode(const G3D::Vector3& v) { + return v.hashCode(); +} + +namespace G3D { + +//---------------------------------------------------------------------------- +inline Vector3::Vector3() : x(0.0f), y(0.0f), z(0.0f) { +} + +//---------------------------------------------------------------------------- + +inline Vector3::Vector3 (float fX, float fY, float fZ) : x(fX), y(fY), z(fZ) { +} + +//---------------------------------------------------------------------------- +inline Vector3::Vector3 (float V[3]) : x(V[0]), y(V[1]), z(V[2]){ +} +//---------------------------------------------------------------------------- +inline Vector3::Vector3 (double V[3]) : x((float)V[0]), y((float)V[1]), z((float)V[2]){ +} + +//---------------------------------------------------------------------------- +inline Vector3::Vector3 (const Vector3& V) : x(V.x), y(V.y), z(V.z) { +} + +//---------------------------------------------------------------------------- + +//inline Vector3::Vector3 (const __m128& m) { + // Cast from SSE packed floats +// *this = *(Vector3*)&m; +//} + +//---------------------------------------------------------------------------- +inline const float& Vector3::operator[] (int i) const { + return ((float*)this)[i]; +} + +inline float& Vector3::operator[] (int i) { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator= (const Vector3& rkVector) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::fuzzyEq(const Vector3& other) const { + return G3D::fuzzyEq((*this - other).squaredMagnitude(), 0); +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::fuzzyNe(const Vector3& other) const { + return G3D::fuzzyNe((*this - other).squaredMagnitude(), 0); +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::isFinite() const { + return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z); +} + +//---------------------------------------------------------------------------- +inline bool Vector3::operator== (const Vector3& rkVector) const { + return ( x == rkVector.x && y == rkVector.y && z == rkVector.z ); +} + +//---------------------------------------------------------------------------- +inline bool Vector3::operator!= (const Vector3& rkVector) const { + return ( x != rkVector.x || y != rkVector.y || z != rkVector.z ); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator+ (const Vector3& rkVector) const { + return Vector3(x + rkVector.x, y + rkVector.y, z + rkVector.z); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator- (const Vector3& rkVector) const { + return Vector3(x - rkVector.x, y - rkVector.y, z - rkVector.z); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator* (const Vector3& rkVector) const { + return Vector3(x * rkVector.x, y * rkVector.y, z * rkVector.z); +} + +inline Vector3 Vector3::operator*(float f) const { + return Vector3(x * f, y * f, z * f); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator/ (const Vector3& rkVector) const { + return Vector3(x / rkVector.x, y / rkVector.y, z / rkVector.z); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::operator- () const { + return Vector3(-x, -y, -z); +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator+= (const Vector3& rkVector) { + x += rkVector.x; + y += rkVector.y; + z += rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator-= (const Vector3& rkVector) { + x -= rkVector.x; + y -= rkVector.y; + z -= rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator*= (float fScalar) { + x *= fScalar; + y *= fScalar; + z *= fScalar; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator*= (const Vector3& rkVector) { + x *= rkVector.x; + y *= rkVector.y; + z *= rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector3& Vector3::operator/= (const Vector3& rkVector) { + x /= rkVector.x; + y /= rkVector.y; + z /= rkVector.z; + return *this; +} + +//---------------------------------------------------------------------------- +inline float Vector3::squaredMagnitude () const { + return x*x + y*y + z*z; +} + +//---------------------------------------------------------------------------- +inline float Vector3::squaredLength () const { + return squaredMagnitude(); +} + +//---------------------------------------------------------------------------- +inline float Vector3::magnitude() const { + return sqrtf(x*x + y*y + z*z); +} + +//---------------------------------------------------------------------------- +inline float Vector3::length() const { + return magnitude(); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::direction () const { + float lenSquared = squaredMagnitude(); + float invSqrt = 1.0f / sqrtf(lenSquared); + return Vector3(x * invSqrt, y * invSqrt, z * invSqrt); +} + +//---------------------------------------------------------------------------- + +inline Vector3 Vector3::fastDirection () const { + float lenSquared = x * x + y * y + z * z; + float invSqrt = rsq(lenSquared); + return Vector3(x * invSqrt, y * invSqrt, z * invSqrt); +} + +//---------------------------------------------------------------------------- +inline float Vector3::dot (const Vector3& rkVector) const { + return x*rkVector.x + y*rkVector.y + z*rkVector.z; +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::cross (const Vector3& rkVector) const { + return Vector3(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z, + x*rkVector.y - y*rkVector.x); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::unitCross (const Vector3& rkVector) const { + Vector3 kCross(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z, + x*rkVector.y - y*rkVector.x); + kCross.unitize(); + return kCross; +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::min(const Vector3 &v) const { + return Vector3(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z)); +} + +//---------------------------------------------------------------------------- +inline Vector3 Vector3::max(const Vector3 &v) const { + return Vector3(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z)); +} + +//---------------------------------------------------------------------------- +inline bool Vector3::isZero() const { + return G3D::fuzzyEq(squaredMagnitude(), 0.0f); +} + +//---------------------------------------------------------------------------- + +inline bool Vector3::isUnit() const { + return G3D::fuzzyEq(squaredMagnitude(), 1.0f); +} + +} // namespace diff --git a/externals/g3dlite/G3D/Vector3int16.h b/externals/g3dlite/G3D/Vector3int16.h new file mode 100644 index 0000000..3197ea4 --- /dev/null +++ b/externals/g3dlite/G3D/Vector3int16.h @@ -0,0 +1,127 @@ +/** + @file Vector3int16.h + + @maintainer Morgan McGuire, matrix@brown.edu + + @created 2003-04-07 + @edited 2003-06-24 + Copyright 2000-2004, Morgan McGuire. + All rights reserved. + */ + +#ifndef VECTOR3INT16_H +#define VECTOR3INT16_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/HashTrait.h" + +#ifdef _MSC_VER +// Turn off "conditional expression is constant" warning; MSVC generates this +// for debug assertions in inlined methods. +#pragma warning (disable : 4127) +#endif + + +namespace G3D { + +/** + \class Vector3int16 + A Vector3 that packs its fields into uint16s. + */ +G3D_BEGIN_PACKED_CLASS(2) +class Vector3int16 { +private: + // Hidden operators + bool operator<(const Vector3int16&) const; + bool operator>(const Vector3int16&) const; + bool operator<=(const Vector3int16&) const; + bool operator>=(const Vector3int16&) const; + +public: + G3D::int16 x; + G3D::int16 y; + G3D::int16 z; + + Vector3int16() : x(0), y(0), z(0) {} + Vector3int16(G3D::int16 _x, G3D::int16 _y, G3D::int16 _z) : x(_x), y(_y), z(_z) {} + Vector3int16(const class Vector3& v); + Vector3int16(class BinaryInput& bi); + + void serialize(class BinaryOutput& bo) const; + void deserialize(class BinaryInput& bi); + + inline G3D::int16& operator[] (int i) { + debugAssert(i <= 2); + return ((G3D::int16*)this)[i]; + } + + inline const G3D::int16& operator[] (int i) const { + debugAssert(i <= 2); + return ((G3D::int16*)this)[i]; + } + + inline Vector3int16 operator+(const Vector3int16& other) const { + return Vector3int16(x + other.x, y + other.y, z + other.z); + } + + inline Vector3int16 operator-(const Vector3int16& other) const { + return Vector3int16(x - other.x, y - other.y, z - other.z); + } + + inline Vector3int16 operator*(const Vector3int16& other) const { + return Vector3int16(x * other.x, y * other.y, z * other.z); + } + + inline Vector3int16 operator*(const int s) const { + return Vector3int16(int16(x * s), int16(y * s), int16(z * s)); + } + + inline Vector3int16& operator+=(const Vector3int16& other) { + x += other.x; + y += other.y; + z += other.y; + return *this; + } + + inline Vector3int16& operator-=(const Vector3int16& other) { + x -= other.x; + y -= other.y; + z -= other.z; + return *this; + } + + inline Vector3int16& operator*=(const Vector3int16& other) { + x *= other.x; + y *= other.y; + z *= other.z; + return *this; + } + + inline bool operator== (const Vector3int16& rkVector) const { + return ( x == rkVector.x && y == rkVector.y && z == rkVector.z ); + } + + inline bool operator!= (const Vector3int16& rkVector) const { + return ( x != rkVector.x || y != rkVector.y || z != rkVector.z ); + } + + Vector3int16 max(const Vector3int16& v) const { + return Vector3int16(std::max(x, v.x), std::max(y, v.y), std::max(z, v.z)); + } + + Vector3int16 min(const Vector3int16& v) const { + return Vector3int16(std::min(x, v.x), std::min(y, v.y), std::min(z, v.z)); + } + + std::string toString() const; +} +G3D_END_PACKED_CLASS(2) + +} + +template <> struct HashTrait { + static size_t hashCode(const G3D::Vector3int16& key) { return static_cast(key.x + ((int)key.y << 5) + ((int)key.z << 10)); } +}; + +#endif diff --git a/externals/g3dlite/G3D/Vector3int32.h b/externals/g3dlite/G3D/Vector3int32.h new file mode 100644 index 0000000..2f256ea --- /dev/null +++ b/externals/g3dlite/G3D/Vector3int32.h @@ -0,0 +1,128 @@ +/** + @file Vector3int32.h + + @maintainer Morgan McGuire, matrix@brown.edu + + @created 2008-07-01 + @edited 2008-07-01 + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef VECTOR3INT32_H +#define VECTOR3INT32_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/HashTrait.h" + +namespace G3D { + +/** + \ Vector3int32 + A Vector3 that packs its fields into uint32s. + */ +G3D_BEGIN_PACKED_CLASS(4) +class Vector3int32 { +private: + // Hidden operators + bool operator<(const Vector3int32&) const; + bool operator>(const Vector3int32&) const; + bool operator<=(const Vector3int32&) const; + bool operator>=(const Vector3int32&) const; + +public: + G3D::int32 x; + G3D::int32 y; + G3D::int32 z; + + Vector3int32() : x(0), y(0), z(0) {} + Vector3int32(int _x, int _y, int _z) : x(_x), y(_y), z(_z) {} + Vector3int32(const class Vector3int16& v); + Vector3int32(const class Vector3& v); + Vector3int32(class BinaryInput& bi); + + void serialize(class BinaryOutput& bo) const; + void deserialize(class BinaryInput& bi); + + inline G3D::int32& operator[] (int i) { + debugAssert(i <= 2); + return ((G3D::int32*)this)[i]; + } + + inline const G3D::int32& operator[] (int i) const { + debugAssert(i <= 2); + return ((G3D::int32*)this)[i]; + } + + inline Vector3int32 operator+(const Vector3int32& other) const { + return Vector3int32(x + other.x, y + other.y, z + other.z); + } + + inline Vector3int32 operator-(const Vector3int32& other) const { + return Vector3int32(x - other.x, y - other.y, z - other.z); + } + + inline Vector3int32 operator*(const Vector3int32& other) const { + return Vector3int32(x * other.x, y * other.y, z * other.z); + } + + inline Vector3int32 operator*(const int s) const { + return Vector3int32(x * s, y * s, z * s); + } + + inline Vector3int32& operator+=(const Vector3int32& other) { + x += other.x; + y += other.y; + z += other.y; + return *this; + } + + inline Vector3int32& operator-=(const Vector3int32& other) { + x -= other.x; + y -= other.y; + z -= other.z; + return *this; + } + + inline Vector3int32& operator*=(const Vector3int32& other) { + x *= other.x; + y *= other.y; + z *= other.z; + return *this; + } + + inline bool operator== (const Vector3int32& rkVector) const { + return ( x == rkVector.x && y == rkVector.y && z == rkVector.z ); + } + + inline bool operator!= (const Vector3int32& rkVector) const { + return ( x != rkVector.x || y != rkVector.y || z != rkVector.z ); + } + + Vector3int32 max(const Vector3int32& v) const { + return Vector3int32(iMax(x, v.x), iMax(y, v.y), iMax(z, v.z)); + } + + Vector3int32 min(const Vector3int32& v) const { + return Vector3int32(iMin(x, v.x), iMin(y, v.y), iMin(z, v.z)); + } + + std::string toString() const; +} +G3D_END_PACKED_CLASS(4) + +} + +template <> struct HashTrait { + static size_t hashCode(const G3D::Vector3int32& key) { + // Mask for the top bit of a uint32 + const G3D::uint32 top = (1UL << 31); + // Mask for the bottom 10 bits of a uint32 + const G3D::uint32 bot = 0x000003FF; + return static_cast(((key.x & top) | ((key.y & top) >> 1) | ((key.z & top) >> 2)) | + (((key.x & bot) << 19) ^ ((key.y & bot) << 10) ^ (key.z & bot))); + } +}; + +#endif diff --git a/externals/g3dlite/G3D/Vector4.h b/externals/g3dlite/G3D/Vector4.h new file mode 100644 index 0000000..5e51145 --- /dev/null +++ b/externals/g3dlite/G3D/Vector4.h @@ -0,0 +1,716 @@ +/** + @file Vector4.h + + Homogeneous vector class. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-07-09 + @edited 2008-11-01 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_Vector4_h +#define G3D_Vector4_h + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Vector3.h" +#include "G3D/Vector2.h" +#include "G3D/Table.h" +#include "G3D/HashTrait.h" +#include "G3D/PositionTrait.h" +#include + +namespace G3D { + +class Vector2; +class Vector3; +class Vector4; +class Vector4int8; +class Any; + +/** + Do not subclass-- this implementation makes assumptions about the + memory layout. + */ +class Vector4 { +private: + // Hidden operators + bool operator<(const Vector4&) const; + bool operator>(const Vector4&) const; + bool operator<=(const Vector4&) const; + bool operator>=(const Vector4&) const; + +public: + + /** \param any Must either Vector4(#, #, #, #) or Vector3 {x = #, y = #, z = #, w =#}*/ + Vector4(const Any& any); + + /** Converts the Vector4 to an Any. */ + operator Any() const; + + // construction + Vector4(); + Vector4(float fX, float fY, float fZ, float fW); + Vector4(float afCoordinate[4]); + Vector4(const Vector4& rkVector); + Vector4(const class Color4& c); + Vector4(const Vector3& rkVector, float fW); + Vector4(const Vector2& v1, const Vector2& v2); + Vector4(const Vector2& v1, float fz, float fw); + + /** Divides by 127 when converting */ + Vector4(const Vector4int8&); + + Vector4(class BinaryInput& b); + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + // coordinates + float x, y, z, w; + + // access vector V as V[0] = V.x, V[1] = V.y, V[2] = V.z, etc. + // + // WARNING. These member functions rely on + // (1) Vector4 not having virtual functions + // (2) the data packed in a 4*sizeof(float) memory block + float& operator[] (int i); + const float& operator[] (int i) const; + + // assignment and comparison + Vector4& operator= (const Vector4& rkVector); + bool operator== (const Vector4& rkVector) const; + bool operator!= (const Vector4& rkVector) const; + + static const Vector4& zero(); + + inline void set(float _x, float _y, float _z, float _w) { + x = _x; + y = _y; + z = _z; + w = _w; + } + + inline void set(const Vector3& v, float _w) { + x = v.x; + y = v.y; + z = v.z; + w = _w; + } + + inline void set(const Vector2& v, float _z, float _w) { + x = v.x; + y = v.y; + z = _z; + w = _w; + } + + size_t hashCode() const; + bool fuzzyEq(const Vector4& other) const; + bool fuzzyNe(const Vector4& other) const; + + static const Vector4& inf(); + static const Vector4& nan(); + + /** sqrt(this->dot(*this)) */ + float length() const; + float squaredLength() const; + + inline float sum() const { + return x + y + z + w; + } + + /** Returns true if this vector has finite length */ + bool isFinite() const; + + /** Returns true if this vector has length == 0 */ + bool isZero() const; + + /** Returns true if this vector has length == 1 */ + bool isUnit() const; + + // arithmetic operations + Vector4 operator+ (const Vector4& rkVector) const; + Vector4 operator- (const Vector4& rkVector) const; + + inline Vector4 operator*(const Vector4& rkVector) const { + return Vector4(x * rkVector.x, y * rkVector.y, z * rkVector.z, w * rkVector.w); + } + + inline Vector4 operator/(const Vector4& rkVector) const { + return Vector4(x / rkVector.x, y / rkVector.y, z / rkVector.z, w / rkVector.w); + } + + Vector4 operator*(const class Matrix4& M) const; + + Vector4 operator* (float fScalar) const; + Vector4 operator/ (float fScalar) const; + Vector4 operator- () const; + friend Vector4 operator* (float, const Vector4& rkVector); + + // arithmetic updates + Vector4& operator+= (const Vector4& rkVector); + Vector4& operator-= (const Vector4& rkVector); + Vector4& operator*= (float fScalar); + Vector4& operator/= (float fScalar); + + inline Vector4 clamp(const Vector4& low, const Vector4& high) const { + return Vector4( + G3D::clamp(x, low.x, high.x), + G3D::clamp(y, low.y, high.y), + G3D::clamp(z, low.z, high.z), + G3D::clamp(w, low.w, high.w)); + } + + inline Vector4 clamp(float low, float high) const { + return Vector4( + G3D::clamp(x, low, high), + G3D::clamp(y, low, high), + G3D::clamp(z, low, high), + G3D::clamp(w, low, high)); + } + + float dot (const Vector4& rkVector) const; + + Vector4 min(const Vector4& v) const; + Vector4 max(const Vector4& v) const; + + std::string toString() const; + + /** + Linear interpolation + */ + Vector4 lerp(const Vector4& v, float alpha) const; + + // 2-char swizzles + + Vector2 xx() const; + Vector2 yx() const; + Vector2 zx() const; + Vector2 wx() const; + Vector2 xy() const; + Vector2 yy() const; + Vector2 zy() const; + Vector2 wy() const; + Vector2 xz() const; + Vector2 yz() const; + Vector2 zz() const; + Vector2 wz() const; + Vector2 xw() const; + Vector2 yw() const; + Vector2 zw() const; + Vector2 ww() const; + + // 3-char swizzles + + Vector3 xxx() const; + Vector3 yxx() const; + Vector3 zxx() const; + Vector3 wxx() const; + Vector3 xyx() const; + Vector3 yyx() const; + Vector3 zyx() const; + Vector3 wyx() const; + Vector3 xzx() const; + Vector3 yzx() const; + Vector3 zzx() const; + Vector3 wzx() const; + Vector3 xwx() const; + Vector3 ywx() const; + Vector3 zwx() const; + Vector3 wwx() const; + Vector3 xxy() const; + Vector3 yxy() const; + Vector3 zxy() const; + Vector3 wxy() const; + Vector3 xyy() const; + Vector3 yyy() const; + Vector3 zyy() const; + Vector3 wyy() const; + Vector3 xzy() const; + Vector3 yzy() const; + Vector3 zzy() const; + Vector3 wzy() const; + Vector3 xwy() const; + Vector3 ywy() const; + Vector3 zwy() const; + Vector3 wwy() const; + Vector3 xxz() const; + Vector3 yxz() const; + Vector3 zxz() const; + Vector3 wxz() const; + Vector3 xyz() const; + Vector3 yyz() const; + Vector3 zyz() const; + Vector3 wyz() const; + Vector3 xzz() const; + Vector3 yzz() const; + Vector3 zzz() const; + Vector3 wzz() const; + Vector3 xwz() const; + Vector3 ywz() const; + Vector3 zwz() const; + Vector3 wwz() const; + Vector3 xxw() const; + Vector3 yxw() const; + Vector3 zxw() const; + Vector3 wxw() const; + Vector3 xyw() const; + Vector3 yyw() const; + Vector3 zyw() const; + Vector3 wyw() const; + Vector3 xzw() const; + Vector3 yzw() const; + Vector3 zzw() const; + Vector3 wzw() const; + Vector3 xww() const; + Vector3 yww() const; + Vector3 zww() const; + Vector3 www() const; + + // 4-char swizzles + + Vector4 xxxx() const; + Vector4 yxxx() const; + Vector4 zxxx() const; + Vector4 wxxx() const; + Vector4 xyxx() const; + Vector4 yyxx() const; + Vector4 zyxx() const; + Vector4 wyxx() const; + Vector4 xzxx() const; + Vector4 yzxx() const; + Vector4 zzxx() const; + Vector4 wzxx() const; + Vector4 xwxx() const; + Vector4 ywxx() const; + Vector4 zwxx() const; + Vector4 wwxx() const; + Vector4 xxyx() const; + Vector4 yxyx() const; + Vector4 zxyx() const; + Vector4 wxyx() const; + Vector4 xyyx() const; + Vector4 yyyx() const; + Vector4 zyyx() const; + Vector4 wyyx() const; + Vector4 xzyx() const; + Vector4 yzyx() const; + Vector4 zzyx() const; + Vector4 wzyx() const; + Vector4 xwyx() const; + Vector4 ywyx() const; + Vector4 zwyx() const; + Vector4 wwyx() const; + Vector4 xxzx() const; + Vector4 yxzx() const; + Vector4 zxzx() const; + Vector4 wxzx() const; + Vector4 xyzx() const; + Vector4 yyzx() const; + Vector4 zyzx() const; + Vector4 wyzx() const; + Vector4 xzzx() const; + Vector4 yzzx() const; + Vector4 zzzx() const; + Vector4 wzzx() const; + Vector4 xwzx() const; + Vector4 ywzx() const; + Vector4 zwzx() const; + Vector4 wwzx() const; + Vector4 xxwx() const; + Vector4 yxwx() const; + Vector4 zxwx() const; + Vector4 wxwx() const; + Vector4 xywx() const; + Vector4 yywx() const; + Vector4 zywx() const; + Vector4 wywx() const; + Vector4 xzwx() const; + Vector4 yzwx() const; + Vector4 zzwx() const; + Vector4 wzwx() const; + Vector4 xwwx() const; + Vector4 ywwx() const; + Vector4 zwwx() const; + Vector4 wwwx() const; + Vector4 xxxy() const; + Vector4 yxxy() const; + Vector4 zxxy() const; + Vector4 wxxy() const; + Vector4 xyxy() const; + Vector4 yyxy() const; + Vector4 zyxy() const; + Vector4 wyxy() const; + Vector4 xzxy() const; + Vector4 yzxy() const; + Vector4 zzxy() const; + Vector4 wzxy() const; + Vector4 xwxy() const; + Vector4 ywxy() const; + Vector4 zwxy() const; + Vector4 wwxy() const; + Vector4 xxyy() const; + Vector4 yxyy() const; + Vector4 zxyy() const; + Vector4 wxyy() const; + Vector4 xyyy() const; + Vector4 yyyy() const; + Vector4 zyyy() const; + Vector4 wyyy() const; + Vector4 xzyy() const; + Vector4 yzyy() const; + Vector4 zzyy() const; + Vector4 wzyy() const; + Vector4 xwyy() const; + Vector4 ywyy() const; + Vector4 zwyy() const; + Vector4 wwyy() const; + Vector4 xxzy() const; + Vector4 yxzy() const; + Vector4 zxzy() const; + Vector4 wxzy() const; + Vector4 xyzy() const; + Vector4 yyzy() const; + Vector4 zyzy() const; + Vector4 wyzy() const; + Vector4 xzzy() const; + Vector4 yzzy() const; + Vector4 zzzy() const; + Vector4 wzzy() const; + Vector4 xwzy() const; + Vector4 ywzy() const; + Vector4 zwzy() const; + Vector4 wwzy() const; + Vector4 xxwy() const; + Vector4 yxwy() const; + Vector4 zxwy() const; + Vector4 wxwy() const; + Vector4 xywy() const; + Vector4 yywy() const; + Vector4 zywy() const; + Vector4 wywy() const; + Vector4 xzwy() const; + Vector4 yzwy() const; + Vector4 zzwy() const; + Vector4 wzwy() const; + Vector4 xwwy() const; + Vector4 ywwy() const; + Vector4 zwwy() const; + Vector4 wwwy() const; + Vector4 xxxz() const; + Vector4 yxxz() const; + Vector4 zxxz() const; + Vector4 wxxz() const; + Vector4 xyxz() const; + Vector4 yyxz() const; + Vector4 zyxz() const; + Vector4 wyxz() const; + Vector4 xzxz() const; + Vector4 yzxz() const; + Vector4 zzxz() const; + Vector4 wzxz() const; + Vector4 xwxz() const; + Vector4 ywxz() const; + Vector4 zwxz() const; + Vector4 wwxz() const; + Vector4 xxyz() const; + Vector4 yxyz() const; + Vector4 zxyz() const; + Vector4 wxyz() const; + Vector4 xyyz() const; + Vector4 yyyz() const; + Vector4 zyyz() const; + Vector4 wyyz() const; + Vector4 xzyz() const; + Vector4 yzyz() const; + Vector4 zzyz() const; + Vector4 wzyz() const; + Vector4 xwyz() const; + Vector4 ywyz() const; + Vector4 zwyz() const; + Vector4 wwyz() const; + Vector4 xxzz() const; + Vector4 yxzz() const; + Vector4 zxzz() const; + Vector4 wxzz() const; + Vector4 xyzz() const; + Vector4 yyzz() const; + Vector4 zyzz() const; + Vector4 wyzz() const; + Vector4 xzzz() const; + Vector4 yzzz() const; + Vector4 zzzz() const; + Vector4 wzzz() const; + Vector4 xwzz() const; + Vector4 ywzz() const; + Vector4 zwzz() const; + Vector4 wwzz() const; + Vector4 xxwz() const; + Vector4 yxwz() const; + Vector4 zxwz() const; + Vector4 wxwz() const; + Vector4 xywz() const; + Vector4 yywz() const; + Vector4 zywz() const; + Vector4 wywz() const; + Vector4 xzwz() const; + Vector4 yzwz() const; + Vector4 zzwz() const; + Vector4 wzwz() const; + Vector4 xwwz() const; + Vector4 ywwz() const; + Vector4 zwwz() const; + Vector4 wwwz() const; + Vector4 xxxw() const; + Vector4 yxxw() const; + Vector4 zxxw() const; + Vector4 wxxw() const; + Vector4 xyxw() const; + Vector4 yyxw() const; + Vector4 zyxw() const; + Vector4 wyxw() const; + Vector4 xzxw() const; + Vector4 yzxw() const; + Vector4 zzxw() const; + Vector4 wzxw() const; + Vector4 xwxw() const; + Vector4 ywxw() const; + Vector4 zwxw() const; + Vector4 wwxw() const; + Vector4 xxyw() const; + Vector4 yxyw() const; + Vector4 zxyw() const; + Vector4 wxyw() const; + Vector4 xyyw() const; + Vector4 yyyw() const; + Vector4 zyyw() const; + Vector4 wyyw() const; + Vector4 xzyw() const; + Vector4 yzyw() const; + Vector4 zzyw() const; + Vector4 wzyw() const; + Vector4 xwyw() const; + Vector4 ywyw() const; + Vector4 zwyw() const; + Vector4 wwyw() const; + Vector4 xxzw() const; + Vector4 yxzw() const; + Vector4 zxzw() const; + Vector4 wxzw() const; + Vector4 xyzw() const; + Vector4 yyzw() const; + Vector4 zyzw() const; + Vector4 wyzw() const; + Vector4 xzzw() const; + Vector4 yzzw() const; + Vector4 zzzw() const; + Vector4 wzzw() const; + Vector4 xwzw() const; + Vector4 ywzw() const; + Vector4 zwzw() const; + Vector4 wwzw() const; + Vector4 xxww() const; + Vector4 yxww() const; + Vector4 zxww() const; + Vector4 wxww() const; + Vector4 xyww() const; + Vector4 yyww() const; + Vector4 zyww() const; + Vector4 wyww() const; + Vector4 xzww() const; + Vector4 yzww() const; + Vector4 zzww() const; + Vector4 wzww() const; + Vector4 xwww() const; + Vector4 ywww() const; + Vector4 zwww() const; + Vector4 wwww() const; + +}; + + +//---------------------------------------------------------------------------- +inline Vector4::Vector4() { + x = y = z = w = 0; +} + +//---------------------------------------------------------------------------- + +inline Vector4::Vector4 (float fX, float fY, float fZ, float fW) { + x = fX; + y = fY; + z = fZ; + w = fW; +} + +//---------------------------------------------------------------------------- +inline Vector4::Vector4 (float afCoordinate[4]) { + x = afCoordinate[0]; + y = afCoordinate[1]; + z = afCoordinate[2]; + w = afCoordinate[3]; +} + +//---------------------------------------------------------------------------- +inline Vector4::Vector4(const Vector4& rkVector) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + w = rkVector.w; +} +//---------------------------------------------------------------------------- +inline Vector4::Vector4(const Vector3& rkVector, float fW) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + w = fW; +} + +//---------------------------------------------------------------------------- +inline float& Vector4::operator[] (int i) { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- +inline const float& Vector4::operator[] (int i) const { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator= (const Vector4& rkVector) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + w = rkVector.w; + return *this; +} + +//---------------------------------------------------------------------------- +inline bool Vector4::operator== (const Vector4& rkVector) const { + return ( (x == rkVector.x) && (y == rkVector.y) && (z == rkVector.z) && (w == rkVector.w)); +} + +//---------------------------------------------------------------------------- +inline bool Vector4::operator!= (const Vector4& rkVector) const { + return ( x != rkVector.x || y != rkVector.y || z != rkVector.z || w != rkVector.w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator+ (const Vector4& rkVector) const { + return Vector4(x + rkVector.x, y + rkVector.y, z + rkVector.z, w + rkVector.w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator- (const Vector4& rkVector) const { + return Vector4(x - rkVector.x, y - rkVector.y, z - rkVector.z, w - rkVector.w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator* (float fScalar) const { + return Vector4(fScalar*x, fScalar*y, fScalar*z, fScalar*w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator- () const { + return Vector4( -x, -y, -z, -w); +} + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator+= (const Vector4& rkVector) { + x += rkVector.x; + y += rkVector.y; + z += rkVector.z; + w += rkVector.w; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator-= (const Vector4& rkVector) { + x -= rkVector.x; + y -= rkVector.y; + z -= rkVector.z; + w -= rkVector.w; + return *this; +} + +//---------------------------------------------------------------------------- + +inline Vector4 Vector4::lerp(const Vector4& v, float alpha) const { + return (*this) + (v - *this) * alpha; +} + + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator*= (float fScalar) { + x *= fScalar; + y *= fScalar; + z *= fScalar; + w *= fScalar; + return *this; +} + + +//---------------------------------------------------------------------------- +inline float Vector4::dot(const Vector4& rkVector) const { + return x*rkVector.x + y*rkVector.y + z*rkVector.z + w*rkVector.w; +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::min(const Vector4 &v) const { + return Vector4(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z), G3D::min(v.w, w)); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::max(const Vector4 &v) const { + return Vector4(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z), G3D::max(v.w, w)); +} + +//---------------------------------------------------------------------------- +inline bool Vector4::isZero() const { + return (x == 0.0f) && (y == 0.0f) && (z == 0.0f) && (w == 0.0f); +} + +//---------------------------------------------------------------------------- + +inline bool Vector4::isFinite() const { + return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z) && G3D::isFinite(w); +} + +//---------------------------------------------------------------------------- + +inline bool Vector4::isUnit() const { + return squaredLength() == 1.0; +} + +//---------------------------------------------------------------------------- + +inline float Vector4::length() const { + return sqrtf(squaredLength()); +} + +//---------------------------------------------------------------------------- + +inline float Vector4::squaredLength() const { + return x * x + y * y + z * z + w * w; +} + +} + +template <> struct HashTrait { + static size_t hashCode(const G3D::Vector4& key) { return key.hashCode(); } +}; + + +template<> struct PositionTrait { + static void getPosition(const G3D::Vector4& v, G3D::Vector3& p) { p = v.xyz(); } +}; + +inline G3D::Vector4 operator* (float s, const G3D::Vector4& v) { + return v * s; +} + +#endif diff --git a/externals/g3dlite/G3D/Vector4.inl b/externals/g3dlite/G3D/Vector4.inl new file mode 100644 index 0000000..576cca8 --- /dev/null +++ b/externals/g3dlite/G3D/Vector4.inl @@ -0,0 +1,191 @@ +/** + @file Vector4.inl + + @maintainer Morgan McGuire, matrix@graphics3d.com + + @created 2002-07-09 + @edited 2003-02-10 + */ + +//---------------------------------------------------------------------------- + +inline unsigned int hashCode(const G3D::Vector4& v) { + return v.hashCode(); +} + +namespace G3D { + +//---------------------------------------------------------------------------- +inline Vector4::Vector4() { + x = y = z = w = 0; +} + +//---------------------------------------------------------------------------- + +inline Vector4::Vector4 (float fX, float fY, float fZ, float fW) { + x = fX; + y = fY; + z = fZ; + w = fW; +} + +//---------------------------------------------------------------------------- +inline Vector4::Vector4 (float afCoordinate[4]) { + x = afCoordinate[0]; + y = afCoordinate[1]; + z = afCoordinate[2]; + w = afCoordinate[3]; +} + +//---------------------------------------------------------------------------- +inline Vector4::Vector4(const Vector4& rkVector) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + w = rkVector.w; +} +//---------------------------------------------------------------------------- +inline Vector4::Vector4(const Vector3& rkVector, float fW) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + w = fW; +} + +//---------------------------------------------------------------------------- +inline float& Vector4::operator[] (int i) { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- +inline const float& Vector4::operator[] (int i) const { + return ((float*)this)[i]; +} + +//---------------------------------------------------------------------------- +inline Vector4::operator float* () { + return (float*)this; +} + +inline Vector4::operator const float* () const { + return (float*)this; +} + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator= (const Vector4& rkVector) { + x = rkVector.x; + y = rkVector.y; + z = rkVector.z; + w = rkVector.w; + return *this; +} + +//---------------------------------------------------------------------------- +inline bool Vector4::operator== (const Vector4& rkVector) const { + return ( (x == rkVector.x) && (y == rkVector.y) && (z == rkVector.z) && (w == rkVector.w)); +} + +//---------------------------------------------------------------------------- +inline bool Vector4::operator!= (const Vector4& rkVector) const { + return ( x != rkVector.x || y != rkVector.y || z != rkVector.z || w != rkVector.w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator+ (const Vector4& rkVector) const { + return Vector4(x + rkVector.x, y + rkVector.y, z + rkVector.z, w + rkVector.w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator- (const Vector4& rkVector) const { + return Vector4(x - rkVector.x, y - rkVector.y, z - rkVector.z, w - rkVector.w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator* (float fScalar) const { + return Vector4(fScalar*x, fScalar*y, fScalar*z, fScalar*w); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::operator- () const { + return Vector4( -x, -y, -z, -w); +} + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator+= (const Vector4& rkVector) { + x += rkVector.x; + y += rkVector.y; + z += rkVector.z; + w += rkVector.w; + return *this; +} + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator-= (const Vector4& rkVector) { + x -= rkVector.x; + y -= rkVector.y; + z -= rkVector.z; + w -= rkVector.w; + return *this; +} + +//---------------------------------------------------------------------------- + +inline Vector4 Vector4::lerp(const Vector4& v, float alpha) const { + return (*this) + (v - *this) * alpha; +} + +//---------------------------------------------------------------------------- +inline Vector4& Vector4::operator*= (float fScalar) { + x *= fScalar; + y *= fScalar; + z *= fScalar; + w *= fScalar; + return *this; +} + +//---------------------------------------------------------------------------- +inline float Vector4::dot(const Vector4& rkVector) const { + return x*rkVector.x + y*rkVector.y + z*rkVector.z + w*rkVector.w; +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::min(const Vector4 &v) const { + return Vector4(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z), G3D::min(v.w, w)); +} + +//---------------------------------------------------------------------------- +inline Vector4 Vector4::max(const Vector4 &v) const { + return Vector4(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z), G3D::max(v.w, w)); +} + +//---------------------------------------------------------------------------- +inline bool Vector4::isZero() const { + return (x == 0.0f) && (y == 0.0f) && (z == 0.0f) && (w == 0.0f); +} + +//---------------------------------------------------------------------------- + +inline bool Vector4::isFinite() const { + return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z) && G3D::isFinite(w); +} + +//---------------------------------------------------------------------------- + +inline bool Vector4::isUnit() const { + return squaredLength() == 1.0; +} + +//---------------------------------------------------------------------------- + +inline float Vector4::length() const { + return sqrtf(squaredLength()); +} + +//---------------------------------------------------------------------------- + +inline float Vector4::squaredLength() const { + return x * x + y * y + z * z + w * w; +} + +} + diff --git a/externals/g3dlite/G3D/Vector4int8.h b/externals/g3dlite/G3D/Vector4int8.h new file mode 100644 index 0000000..544b693 --- /dev/null +++ b/externals/g3dlite/G3D/Vector4int8.h @@ -0,0 +1,113 @@ +/** + @file Vector4int8.h + + Homogeneous vector class. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-02-09 + @edited 2007-02-09 + + Copyright 2000-2007, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_VECTOR4INT8_H +#define G3D_VECTOR4INT8_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" + +namespace G3D { + +class Vector3; +class Vector4; + +/** + Homogeneous vector stored efficiently in four signed int8s. + + */ +class Vector4int8 { +private: + // Hidden operators + bool operator<(const Vector4int8&) const; + bool operator>(const Vector4int8&) const; + bool operator<=(const Vector4int8&) const; + bool operator>=(const Vector4int8&) const; + + + /** For fast operations, treat this packed data structure as + an int32 */ + inline uint32& asInt32() { + return *reinterpret_cast(this); + } + + inline const uint32& asInt32() const { + return *reinterpret_cast(this); + } + +public: + // construction + inline Vector4int8() : x(0), y(0), z(0), w(0) {} + + /** Multiplies the source by 127 and clamps to (-128, 127) when converting */ + Vector4int8(const Vector4& source); + + /** Multiplies the source by 127 and clamps to (-128, 127) when converting */ + Vector4int8(const Vector3& source, int8 w); + + inline Vector4int8(int8 x, int8 y, int8 z, int8 w) : x(x), y(y), z(z), w(w) {} + + Vector4int8(class BinaryInput& b); + void serialize(class BinaryOutput& b) const; + void deserialize(class BinaryInput& b); + + // coordinates + int8 x, y, z, w; + + inline operator int8* () { + return reinterpret_cast(this); + } + + inline operator const int8* () const { + return reinterpret_cast(this); + } + + // access vector V as V[0] = V.x, V[1] = V.y, V[2] = V.z, etc. + // + // WARNING. These member functions rely on + // (1) Vector4int8 not having virtual functions + // (2) the data packed in a 4*sizeof(int8) memory block + inline int8& operator[] (int i) { + debugAssert(i >= 0 && i <= 4); + return ((int8*)this)[i]; + } + + const int8& operator[] (int i) const { + debugAssert(i >= 0 && i <= 4); + return ((const int8*)this)[i]; + } + + // assignment and comparison + Vector4int8& operator= (const Vector4int8& other) { + asInt32() = other.asInt32(); + return *this; + } + + inline bool operator== (const Vector4int8& other) const { + return asInt32() == other.asInt32(); + } + + inline bool operator!= (const Vector4int8& other) const { + return ! (*this == other); + } + + inline unsigned int hashCode() const { + return asInt32(); + } +}; + +} // namespace G3D + + +#endif diff --git a/externals/g3dlite/G3D/WeakCache.h b/externals/g3dlite/G3D/WeakCache.h new file mode 100644 index 0000000..f9fdc4b --- /dev/null +++ b/externals/g3dlite/G3D/WeakCache.h @@ -0,0 +1,122 @@ +/** + @file WeakCache.h + + @maintainer Morgan McGuire, graphics3d.com + + @created 2007-05-16 + @edited 2007-05-16 + + Copyright 2000-2007, Morgan McGuire. + All rights reserved. + */ +#ifndef G3D_WEAKCACHE_H +#define G3D_WEAKCACHE_H + +#include "G3D/ReferenceCount.h" +#include "G3D/Table.h" + +namespace G3D { + +/** + A cache that does not prevent its members from being garbage collected. + Useful to avoid loading or computing an expression twice. Useful + for memoization and dynamic programming. + + Maintains a table of weak pointers. Weak pointers do not prevent + an object from being garbage collected. If the object is garbage + collected, the cache removes its reference. + + There are no "contains" or "iterate" methods because elements can be + flushed from the cache at any time if they are garbage collected. + + Example: +
+      WeakCache textureCache;
+
+      TextureRef loadTexture(std::string s) {
+          TextureRef t = textureCache[s];
+
+          if (t.isNull()) {
+              t = Texture::fromFile(s);
+              textureCache.set(s, t);
+          }
+
+          return t;
+      }
+      
+      
+    
+ */ +template +class WeakCache { + typedef WeakReferenceCountedPointer ValueWeakRef; + +private: + + Table table; + +public: + /** + Returns NULL if the object is not in the cache + */ + ValueRef operator[](const Key& k) { + if (table.containsKey(k)) { + ValueWeakRef w = table[k]; + ValueRef s = w.createStrongPtr(); + if (s.isNull()) { + // This object has been collected; clean out its key + table.remove(k); + } + return s; + } else { + return NULL; + } + } + + void set(const Key& k, ValueRef v) { + table.set(k, v); + } + + /** Removes k from the cache or does nothing if it is not currently in the cache.*/ + void remove(const Key& k) { + if (table.containsKey(k)) { + table.remove(k); + } + } +}; + +#if 0 // To turn off all WeakCaching +template +class WeakCache { +private: + + Table table; + +public: + /** + Returns NULL if the object is not in the cache + */ + ValueRef operator[](const Key& k) { + if (table.containsKey(k)) { + return table[k]; + } else { + return NULL; + } + } + + void set(const Key& k, ValueRef v) { + table.set(k, v); + } + + /** Removes k from the cache or does nothing if it is not currently in the cache.*/ + void remove(const Key& k) { + if (table.containsKey(k)) { + table.remove(k); + } + } +}; +#endif + +} +#endif + diff --git a/externals/g3dlite/G3D/Welder.h b/externals/g3dlite/G3D/Welder.h new file mode 100644 index 0000000..2c2554d --- /dev/null +++ b/externals/g3dlite/G3D/Welder.h @@ -0,0 +1,82 @@ +#ifndef G3D_Welder_h +#define G3D_Welder_h + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/Vector3.h" +#include "G3D/Vector2.h" + +namespace G3D { + +class Any; + +class Welder { +private: + + Welder() {} + +public: + + class Settings { + public: + /** Surfaces with normals that are within this angle of each + other are considered to be curved. Default value is toRadians(70.0f).*/ + float normalSmoothingAngle; + float vertexWeldRadius; + float textureWeldRadius; + float normalWeldRadius; + + inline Settings(float normalSmoothAngle = toRadians(70.0f)) : + normalSmoothingAngle(normalSmoothAngle), + vertexWeldRadius(0.0001f), + textureWeldRadius(0.0001f), + normalWeldRadius(0.01f) {} + + + Settings(const Any& any); + operator Any() const; + }; + +/** + Mutates geometry, texCoord, and indexArray so that the output has collocated vertices collapsed (welded). + + @param vertices Input and output + @param textureCoords Input and output + @param normals Output only + @param indices Input and output. This is an array of trilist indices. + @param oldToNewIndex Output argument + @param normalSmoothingAngle Varies from 0 (flat shading) to toRadians(180) for extremely smooth shading. Default is toRadians(70) + */ + static void weld( + Array& vertices, + Array& textureCoords, + Array& normals, + Array*>& indices, + const Settings& settings); + + /** + Mutates geometry, texCoord, and indexArray so that the output has collocated vertices collapsed (welded). + + @param vertices Input and output + @param textureCoords Input and output + @param normals Output only + @param indices Input and output. This is an array of trilist indices. + @param oldToNewIndex Output argument + @param normalSmoothingAngle Varies from 0 (flat shading) to toRadians(180) for extremely smooth shading. Default is toRadians(70) + */ + inline static void weld( + Array& vertices, + Array& textureCoords, + Array& normals, + Array& indices, + const Settings& settings) { + + Array*> meta; + meta.append(&indices); + weld(vertices, textureCoords, normals, meta, settings); + } +}; + +} + +#endif diff --git a/externals/g3dlite/G3D/WrapMode.h b/externals/g3dlite/G3D/WrapMode.h new file mode 100644 index 0000000..8ef38a7 --- /dev/null +++ b/externals/g3dlite/G3D/WrapMode.h @@ -0,0 +1,93 @@ +/** + @file WrapMode.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-04-17 + @edited 2007-04-17 + + Copyright 2000-2010, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_WrapMode_h +#define G3D_WrapMode_h + +#include "G3D/platform.h" +#include "G3D/enumclass.h" + +#ifdef IGNORE +# undef IGNORE +#endif +#ifdef ZERO +# undef ZERO +#endif +#ifdef ERROR +# undef ERROR +#endif + +namespace G3D { + +/** + Describes the behavior of G3D::Texture, G3D::Map2D, G3D::Image3, + etc. when accessing an out-of-bounds pixel. Not all classes support + all modes. + + Refer to these as scoped enums, e.g., WrapMode m = WrapMode::CLAMP;. + + WrapMode::IGNORE silently discards attempts to write to out + of bounds locations and returns an undefined value for reading + from out of bounds locations. + + WrapMode::ERROR generates an error when the + pixel indices are out of bounds + + WrapMode::CLAMP makes out of bounds pixels equal to the last in-range pixel along that dimension. + + WrapMode::TILE computes out of bounds pixels modulo the dimension + + WrapMode::ZERO treats out of bounds values as the zero value, which varies in definition + according to the class used. For example, with a G3D::Texture, ZERO = Color4(0,0,0,0). + + Uses the "Intelligent Enum" design pattern + http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4001/ + */ +class WrapMode { +public: + /** Don't use this enum; use WrapMode instances instead. */ + enum Value { + CLAMP, + TILE, + ZERO, + IGNORE, + ERROR + }; + +private: + + Value value; + +public: + + G3D_DECLARE_ENUM_CLASS_METHODS(WrapMode); + + inline const char* toString() const { + static const char* s[] = {"CLAMP", "TILE", "ZERO", "IGNORE", "ERROR"}; + return s[value]; + } + + inline explicit WrapMode(const std::string& x) : value(ERROR) { + static const char* s[] = {"CLAMP", "TILE", "ZERO", "IGNORE", "ERROR"}; + for (int i = 0; i < 5; ++i) { + if (x == s[i]) { + value = (Value)i; + } + } + } +}; + +} // namespace G3D + +G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::WrapMode); + +#endif diff --git a/externals/g3dlite/G3D/constants.h b/externals/g3dlite/G3D/constants.h new file mode 100644 index 0000000..dd5cb36 --- /dev/null +++ b/externals/g3dlite/G3D/constants.h @@ -0,0 +1,129 @@ +/** + @file G3D/constants.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2009-05-20 + @edited 2009-05-20 +*/ +#ifndef G3D_constants_h +#define G3D_constants_h + +#include "G3D/platform.h" +#include "G3D/enumclass.h" + +namespace G3D { + +/** These are defined to have the same value as the equivalent OpenGL + constant. */ +class PrimitiveType { +public: + enum Value { + POINTS = 0x0000, + LINES = 0x0001, + LINE_STRIP = 0x0003, + TRIANGLES = 0x0004, + TRIANGLE_STRIP = 0x0005, + TRIANGLE_FAN = 0x0006, + QUADS = 0x0007, + QUAD_STRIP = 0x0008 + }; + +private: + + Value value; + +public: + + G3D_DECLARE_ENUM_CLASS_METHODS(PrimitiveType); +}; + + +/** Values for SuperSurface::GPUGeom::refractionHint. */ +class RefractionQuality { +public: + enum Value { + /** No refraction; a translucent object will appear as if it had the same index of refraction + as the surrounding medium and objects will be undistorted in the background. */ + NONE = 0, + + /** Use a static environment map (cube or paraboloid) for computing transmissivity.*/ + STATIC_ENV = 25, + + /** Use a dynamically rendered 2D environment map; distort the background. This looks good for many scenes + but avoids the cost of rendering a cube map for DYNAMIC_ENV. */ + DYNAMIC_FLAT = 50, + + /** Use a dynamically rendered 2D environment map that is re-captured per transparent object. This works well + for transparent objects that are separated by a significant camera space z distance but overlap in screen space.*/ + DYNAMIC_FLAT_MULTILAYER = 55, + + /** Render a dynamic environment map */ + DYNAMIC_ENV = 75, + + /** Use the best method available, ideally true ray tracing. */ + BEST = 100 + }; + +private: + + /** Used for to/from string conversion. Last is the emtpy string as a sentinel */ + static const std::string str[7]; + static const Value enm[6]; + Value value; + +public: + G3D_DECLARE_ENUM_CLASS_METHODS(RefractionQuality); + + RefractionQuality(const class Any&); + RefractionQuality& operator=(const Any&); + operator Any() const; + const std::string& toString() const; +}; + + +/** Values for SuperSurface::GPUGeom::mirrorHint. */ +class MirrorQuality { +public: + + enum Value { + /** Reflections are black */ + NONE = 0, + + /** Use a static environment map. This is what most games use */ + STATIC_ENV = 25, + + /** Planar reflection, typically for water or glass windows. This assumes that the mirror is flat; + it is distinct from RefractionQuality::DYNAMIC_FLAT, which assumes the background is flat.*/ + DYNAMIC_PLANAR = 50, + + /** Render a dynamic environment map. */ + DYNAMIC_ENV = 75, + + /** Use the best method available, ideally true ray tracing. */ + BEST = 100 + }; + +private: + + /** Used for to/from string conversion. Last is the emtpy string as a sentinel */ + static const std::string str[6]; + static const Value enm[5]; + + Value value; + +public: + G3D_DECLARE_ENUM_CLASS_METHODS(MirrorQuality); + MirrorQuality(const class Any&); + MirrorQuality& operator=(const Any&); + operator Any() const; + const std::string& toString() const; +}; + +} // namespace G3D + +G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::PrimitiveType) +G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::RefractionQuality) +G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::MirrorQuality) + +#endif + diff --git a/externals/g3dlite/G3D/debug.h b/externals/g3dlite/G3D/debug.h new file mode 100644 index 0000000..a7697fe --- /dev/null +++ b/externals/g3dlite/G3D/debug.h @@ -0,0 +1,66 @@ +/** + @file debug.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-08-26 + @edited 2006-02-16 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. +*/ + +#ifndef G3D_DEBUG_H +#define G3D_DEBUG_H + +#include "G3D/platform.h" +#ifdef _MSC_VER + #include +#endif + +#include "G3D/debugPrintf.h" +#include "G3D/debugAssert.h" + +namespace G3D { + +#ifdef _MSC_VER + // Turn off 64-bit warnings +# pragma warning(push) +# pragma warning( disable : 4312) +# pragma warning( disable : 4267) +# pragma warning( disable : 4311) +#endif + + +/** + Useful for debugging purposes. + */ +inline bool isValidHeapPointer(const void* x) { + #ifdef _MSC_VER + return + (x != (void*)0xcccccccc) && (x != (void*)0xdeadbeef) && (x != (void*)0xfeeefeee); + #else + return x != NULL; + #endif +} + +/** + Returns true if the pointer is likely to be + a valid pointer (instead of an arbitrary number). + Useful for debugging purposes. + */ +inline bool isValidPointer(const void* x) { + #ifdef _MSC_VER + return x != ((void*)0xcccccccc) && (x != (void*)0xdeadbeef) && (x != (void*)0xfeeefeee); + #else + return x != NULL; + #endif +} + +#ifdef _MSC_VER +# pragma warning(pop) +#endif + +} + +#endif diff --git a/externals/g3dlite/G3D/debugAssert.h b/externals/g3dlite/G3D/debugAssert.h new file mode 100644 index 0000000..432e97e --- /dev/null +++ b/externals/g3dlite/G3D/debugAssert.h @@ -0,0 +1,233 @@ +/** + @file debugAssert.h + + debugAssert(expression); + debugAssertM(expression, message); + + @cite + John Robbins, Microsoft Systems Journal Bugslayer Column, Feb 1999. + + http://msdn.microsoft.com/library/periodic/period99/feb99_BUGSLAYE_BUGSLAYE.htm + + @cite + Douglas Cox, An assert() Replacement, Code of The Day, flipcode, Sept 19, 2000 + + http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-AssertReplace&forum=cotd&id=-1 + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-08-26 + @edited 2006-01-12 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_DEBUGASSERT_H +#define G3D_DEBUGASSERT_H + +#include +#include "G3D/platform.h" + +#include + +#ifdef _MSC_VER +// conditional expression is constant +# pragma warning (disable : 4127) +#endif + +#ifdef G3D_LINUX + // Needed so we can define a global display + // pointer for debugAssert. +#if SOMEONE_MADE_THIS_USEFUL + #include + #include + #include +#endif +#endif + + +/** + @def debugBreak() + + Break at the current location (i.e. don't push a procedure stack frame + before breaking). + */ + +/** + @def debugAssert(exp) + Breaks if the expression is false. If G3D_DEBUG_NOGUI is defined, prompts at + the console, otherwise pops up a dialog. The user may then break (debug), + ignore, or halt the program. + + The assertion is also posted to the clipboard under Win32. + */ + +/** + @def debugAssertM(exp, msg) + Breaks if the expression is false and displays a message. If G3D_DEBUG_NOGUI + is defined, prompts at the console, otherwise pops up a dialog. The user may + then break (debug), ignore, or halt the program. + + The assertion is also posted to the clipboard under Win32. + */ + +/** + @def alwaysAssertM(exp, msg) + Same as debugAssertM except that it asserts in release builds as well. + */ + +namespace G3D { +typedef bool (*AssertionHook)( + const char* _expression, + const std::string& message, + const char* filename, + int lineNumber, + bool useGuiPrompt); + +/** + Allows customization of the global function invoked when a debugAssert fails. + The initial value is G3D::_internal::_handleDebugAssert_. G3D will invoke + rawBreak if the hook returns true. If NULL, assertions are not handled. +*/ +void setAssertionHook(AssertionHook hook); + +AssertionHook assertionHook(); + +/** + Called by alwaysAssertM in case of failure in release mode. If returns + true then the program exits with -1 (you can replace this with your own + version that throws an exception or has other failure modes). + */ +void setFailureHook(AssertionHook hook); +AssertionHook failureHook(); + +namespace _internal { + extern AssertionHook _debugHook; + extern AssertionHook _failureHook; +} // internal +} // G3D + +/** + @def __debugPromptShowDialog__ + @internal + */ + +#ifdef G3D_DEBUG + +# if defined(_MSC_VER) +# define rawBreak() ::DebugBreak(); +# elif defined(__i386__) + // gcc on intel +# define rawBreak() __asm__ __volatile__ ( "int $3" ); +# else + // some other gcc +# define rawBreak() ::abort() +# endif + + +# define debugBreak() G3D::_internal::_releaseInputGrab_(); rawBreak(); G3D::_internal::_restoreInputGrab_(); +# define debugAssert(exp) debugAssertM(exp, "Debug assertion failure") + + #ifdef G3D_DEBUG_NOGUI + #define __debugPromptShowDialog__ false + #else + #define __debugPromptShowDialog__ true + #endif + + #define debugAssertM(exp, message) do { \ + if (!(exp)) { \ + G3D::_internal::_releaseInputGrab_(); \ + if ((G3D::_internal::_debugHook != NULL) && \ + G3D::_internal::_debugHook((const char*)(#exp), message, __FILE__, __LINE__, __debugPromptShowDialog__)) { \ + rawBreak(); \ + } \ + G3D::_internal::_restoreInputGrab_(); \ + } \ + } while (0) + + #define alwaysAssertM debugAssertM + +#else // Release + #ifdef G3D_DEBUG_NOGUI + #define __debugPromptShowDialog__ false + #else + #define __debugPromptShowDialog__ true + #endif + + // In the release build, just define away assertions. + #define rawBreak() do {} while (0) + #define debugAssert(exp) do {} while (0) + #define debugAssertM(exp, message) do {} while (0) + #define debugBreak() do {} while (0) + + // But keep the 'always' assertions + #define alwaysAssertM(exp, message) { \ + if (!(exp)) { \ + G3D::_internal::_releaseInputGrab_(); \ + if ((G3D::_internal::_failureHook != NULL) && \ + G3D::_internal::_failureHook(#exp, message, __FILE__, __LINE__, __debugPromptShowDialog__)) { \ + ::exit(-1); \ + } \ + G3D::_internal::_restoreInputGrab_(); \ + } \ + } + +#endif // if debug + + + +namespace G3D { namespace _internal { + +#ifdef G3D_LINUX +#if SOMEONE_MADE_THIS_USEFUL + /** + A pointer to the X11 display. Initially NULL. If set to a + non-null value (e.g. by SDLWindow), debugAssert attempts to use + this display to release the mouse/input grab when an assertion + fails. + */ + extern Display* x11Display; + + /** + A pointer to the X11 window. Initially NULL. If set to a + non-null value (e.g. by SDLWindow), debugAssert attempts to use + this window to release the mouse/input grab when an assertion + fails. + */ + extern Window x11Window; +#endif +#endif + +/** + Pops up an assertion dialog or prints an assertion + + ignoreAlways - return result of pressing the ignore button. + useGuiPrompt - if true, shows a dialog + */ +bool _handleDebugAssert_( + const char* expression, + const std::string& message, + const char* filename, + int lineNumber, + bool useGuiPrompt); + +bool _handleErrorCheck_( + const char* expression, + const std::string& message, + const char* filename, + int lineNumber, + bool useGuiPrompt); + +/** Attempts to give the user back their mouse and keyboard if they + were locked to the current window. + @internal*/ +void _releaseInputGrab_(); + +/** Attempts to restore the state before _releaseInputGrab_. + @internal*/ +void _restoreInputGrab_(); + +}; }; // namespace + +#endif diff --git a/externals/g3dlite/G3D/debugPrintf.h b/externals/g3dlite/G3D/debugPrintf.h new file mode 100644 index 0000000..b42151c --- /dev/null +++ b/externals/g3dlite/G3D/debugPrintf.h @@ -0,0 +1,62 @@ +/** + @file debugPrintf.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-08-26 + @edited 2007-07-20 + + Copyright 2000-2007, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_DEBUGPRINTF_H +#define G3D_DEBUGPRINTF_H + +#include "G3D/platform.h" +#include +#include +#include "G3D/format.h" +#include + +namespace G3D { + +typedef void (*ConsolePrintHook)(const std::string&); + +namespace _internal { + extern ConsolePrintHook _consolePrintHook; +} + +/** Called by consolePrintf after the log and terminal have been written to. + Used by GConsole to intercept printing routines.*/ +void setConsolePrintHook(ConsolePrintHook h); + +ConsolePrintHook consolePrintHook(); + +/** + Sends output to the log and to the last GConsole instantiated. + + Guarantees that the output has been flushed by the time the routine + returns. + @sa G3D::logPrintf, G3D::screenPrintf + @return The string that was printed + */ +std::string __cdecl consolePrintf(const char* fmt ...) G3D_CHECK_PRINTF_ARGS; +std::string consolePrint(const std::string&); + +/** + Under visual studio, appears in the VS debug pane. + On unix-based operating systems the output is sent to stderr. + + Also sends output to the console (G3D::consolePrintf) if there is a consolePrintHook, + and log (G3D::logPrintf), and flushes before returning. + + @return The string that was printed +*/ +std::string __cdecl debugPrintf(const char* fmt ...) G3D_CHECK_PRINTF_ARGS; +std::string debugPrint(const std::string&); + +} // namespace G3D + +#endif + diff --git a/externals/g3dlite/G3D/enumclass.h b/externals/g3dlite/G3D/enumclass.h new file mode 100644 index 0000000..c7dfe45 --- /dev/null +++ b/externals/g3dlite/G3D/enumclass.h @@ -0,0 +1,147 @@ +/** + @file G3D/enumclass.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2007-01-27 + @edited 2007-07-20 +*/ +#ifndef G3D_enumclass_h +#define G3D_enumclass_h + +#include "G3D/HashTrait.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" + +/** +\def G3D_DECLARE_ENUM_CLASS_METHODS + + \brief Creates a series of methods that turn a class into a scoped enumeration. + + Uses the "Intelligent Enum" design pattern + http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4001/ + + Enum classes are initialized to their zero value by default. + + See GLG3D/GKey.h for an example. + \sa G3D_DECLARE_ENUM_CLASS_HASHCODE + */ +#define G3D_DECLARE_ENUM_CLASS_METHODS(Classname)\ + inline Classname(char v) : value((Value)v) {}\ +\ + inline Classname() : value((Value)0) {}\ +\ + inline Classname(const Value v) : value(v) {}\ +\ + explicit inline Classname(int v) : value((Value)v) {}\ +\ + /** Support cast back to the Value type, which is needed to allow implicit assignment inside unions. */\ + /*inline operator Value() const { + return value; + }*/\ +\ + inline operator int() const {\ + return (int)value;\ + }\ +\ + inline bool operator== (const Classname other) const {\ + return value == other.value;\ + }\ +\ + inline bool operator== (const Classname::Value other) const {\ + return value == other;\ + }\ +\ + inline bool operator!= (const Classname other) const {\ + return value != other.value;\ + }\ +\ + inline bool operator!= (const Classname::Value other) const {\ + return value != other;\ + }\ +\ + inline bool operator< (const Classname other) const {\ + return value < other.value;\ + }\ +\ + inline bool operator> (const Classname other) const {\ + return value > other.value;\ + }\ +\ + inline bool operator>= (const Classname other) const {\ + return value >= other.value;\ + }\ +\ + inline bool operator<= (const Classname other) const {\ + return value <= other.value;\ + }\ +\ + inline bool operator< (const Value other) const {\ + return value < other;\ + }\ +\ + inline bool operator> (const Value other) const {\ + return value > other;\ + }\ +\ + inline bool operator<= (const Value other) const {\ + return value <= other;\ + }\ +\ + inline bool operator>= (const Value other) const {\ + return value >= other;\ + }\ +\ + inline Classname& operator-- () {\ + value = (Value)((int)value - 1);\ + return *this;\ + }\ +\ + inline Classname& operator++ () {\ + value = (Value)((int)value + 1);\ + return *this;\ + }\ +\ + inline Classname& operator+= (const int x) {\ + value = (Value)((int)value + x);\ + return *this;\ + }\ +\ + inline Classname& operator-= (const int x) {\ + value = (Value)((int)value - x);\ + return *this;\ + }\ +\ + inline Classname operator+ (const int x) const {\ + return Classname((int)value + x);\ + }\ +\ + inline Classname operator- (const int x) const {\ + return Classname((int)value - x);\ + }\ +\ + inline unsigned int hashCode() const {\ + return (unsigned int)value;\ + }\ +\ + inline void serialize(BinaryOutput& b) const {\ + b.writeInt32(value);\ + }\ +\ + inline void deserialize(BinaryInput& b) {\ + value = (Value)b.readInt32();\ + } + +/** \def G3D_DECLARE_ENUM_CLASS_HASHCODE +*/ +#define G3D_DECLARE_ENUM_CLASS_HASHCODE(Classname)\ +template <> struct HashTrait \ +{ \ + static size_t hashCode(Classname::Value key) { return static_cast(key); } \ +}; \ + \ +template <> struct HashTrait \ +{ \ + static size_t hashCode(Classname key) { return static_cast(key.hashCode()); } \ +}; + +#endif diff --git a/externals/g3dlite/G3D/fileutils.h b/externals/g3dlite/G3D/fileutils.h new file mode 100644 index 0000000..9e49777 --- /dev/null +++ b/externals/g3dlite/G3D/fileutils.h @@ -0,0 +1,254 @@ +/** + @file fileutils.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @author 2002-06-06 + @edited 2010-02-06 + + Copyright 2000-2010, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_fileUtils_h +#define G3D_fileUtils_h + +#include "G3D/platform.h" +#include +#include +#include "G3D/Array.h" +#include "G3D/Set.h" +#include "G3D/g3dmath.h" + +#ifdef G3D_WIN32 +// For chdir, mkdir, etc. +# include +#endif + +namespace G3D { + + namespace _internal { + extern Set currentFilesUsed; + } + +/** Returns all the files used by G3D and GLG3D during the current execution. */ +Array filesUsed(); + +std::string readWholeFile( + const std::string& filename); + + +/** Reads from a zip file and decompresses the desired contents + into memory. Does not support recursive zip calls (i.e. a .zip + stored within another .zip) + + @param file the path, of the format C:\\...\\something.zip\\...\\desiredfile.ext + @param data a pointer to the memory where the file will be stored + @param length the size of the file decompressed to memory */ +void zipRead(const std::string& file, + void*& data, + size_t& length); + + +/** Closes the contents of a zip file that had been decompressed to + memory. Must be called in tandem with zipRead() to avoid memory + leaks. + + @param data the pointer to the decompressed file in memory */ +void zipClose(void* data); + + +/** + @param flush If true (default), the file is ready for reading as soon + as the function returns. If false, the function returns immediately and + writes the file in the background. + */ +void writeWholeFile( + const std::string& filename, + const std::string& str, + bool flush = true); + +/** + Creates the directory (which may optionally end in a /) + and any parents needed to reach it. + */ +void createDirectory( + const std::string& dir); + +/** + Fully qualifies a filename. The filename may contain wildcards, + in which case the wildcards will be preserved in the returned value. + */ +std::string resolveFilename(const std::string& filename); + +/** + Appends all files matching filespec to the files array. The names + will not contain paths unless includePath == true. These may be + relative to the current directory unless the filespec is fully qualified + (can be done with resolveFilename). + Wildcards can only appear to the right of the last slash in filespec. + Works with .zip files used as paths, if filespec is passed in the form + C:\\...\\something.zip\\* Does not work recursively with zipfiles (a + .zip within a .zip will not work) + */ +void getFiles( + const std::string& filespec, + Array& files, + bool includePath = false); + +/** + Appends all directories matching filespec to the files array. The names + will not contain paths unless includePath == true. These may be + relative to the current directory unless the filespec is fully qualified + (can be done with resolveFilename). + Does not append special directories "." or "..". + Works with .zip files used as paths, if filespec is passed in the form + C:\\...\\something.zip\\* Does not work recursively with zipfiles (a + .zip within a .zip will not work) + */ +void getDirs( + const std::string& filespec, + Array& files, + bool includePath = false); + + +/** Returns true if the specified path exists and is a directory */ +bool isDirectory(const std::string& filespec); + + +/** Returns true if the specified filename exists and is a zipfile */ +bool isZipfile(const std::string& filename); + + +/** Returns the length of the file. If + filename specifies a path that contains a zipfile, but the + contents within are specified correctly, returns the + uncompressed size of the requested file. Returns -1 if + the file does not exist. + + @param filename the path to test, may contain .zip +*/ +int64 fileLength(const std::string& filename); + +/** + Copies the file + */ +void copyFile( + const std::string& source, + const std::string& dest); + +/** Returns a temporary file that is open for read/write access. This + tries harder than the ANSI tmpfile, so it may succeed when that fails. */ +FILE* createTempFile(); + +/** + Returns true if the given file (or directory) exists. + + \param filename the path to test. must not end in a trailing slash. + \param lookInZipfiles if the path does not exist, calls zipfileExists() + \param trustCache If true and \a lookInZipfiles is true, cache directory and zipfile contents + so that subsequent calls to the same directory are fast. + + \sa G3D::clearFileSystemCache, G3D::zipfileExists + */ +bool fileExists +(const std::string& filename, + bool lookInZipfiles = true, + bool trustCache = true); + + +/** Clears the cache used by fileExists */ +void clearFileSystemCache(); + +/** + Returns true if the given file (or directory) exists + within a zipfile. Called if fileExists initially + returns false and the lookInZipfiles flag has been set. + Must not end in a trailing slash. Does not work for recursive + zipfiles (.zips within another .zip) + + @param filename the path to test + @param outZipfile the path to the .zip file + @param outInternalFile the path (within the .zip) where the desired file is located, if valid + + */ +bool zipfileExists +(const std::string& filename, + std::string& outZipfile, + std::string& outInternalFile); + +bool zipfileExists(const std::string& filename); + +/** + Parses a filename into four useful pieces. + + Examples: + + c:\\a\\b\\d.e + root = "c:\\" + path = "a" "b" + base = "d" + ext = "e" + + /a/b/d.e + root = "/" + path = "a" "b" + base = "d" + ext = "e" + + /a/b + root = "/" + path = "a" + base = "b" + ext = "e" + + */ +void parseFilename( + const std::string& filename, + std::string& drive, + Array& path, + std::string& base, + std::string& ext); + + +/** + Returns the part of the filename that includes the base and ext from + parseFilename (i.e. everything to the right of the path). + */ +std::string filenameBaseExt(const std::string& filename); + +/** + Returns the extension on a filename. + */ +std::string filenameExt(const std::string& filename); + + +/** Returns the portion of a filename to the left of the last period + and to the right of the last slash or colon. + */ +std::string filenameBase(const std::string& filename); + +/** Creates a unique filename base in the current directory using the + specified prefix and suffix.*/ +std::string generateFilenameBase(const std::string& prefix = "", const std::string& suffix = ""); + +/** + Returns the drive (if Win32) and path from a filename, including + a slash if there was one. + filenamePath(f) + filenameBaseExt(f) == f + */ +std::string filenamePath(const std::string& filename); + +/** Returns true if '*' or '?' appears in the string */ +bool filenameContainsWildcards(const std::string& filename); + +/** Returns true if dst does not exist or src is newer than dst. Works on both files and directories. */ +bool fileIsNewer(const std::string& src, const std::string& dst); + +/** Appends file onto dirname, ensuring a / if needed. */ +std::string pathConcat(const std::string& dirname, const std::string& file); + +} // namespace + +#endif + diff --git a/externals/g3dlite/G3D/filter.h b/externals/g3dlite/G3D/filter.h new file mode 100644 index 0000000..609477b --- /dev/null +++ b/externals/g3dlite/G3D/filter.h @@ -0,0 +1,29 @@ +/** + @file G3D/filter.h + + @author Morgan McGuire, http://graphics.cs.williams.edu + @created 2007-03-01 + @edited 2007-03-01 + + Copyright 2000-2007, Morgan McGuire. + All rights reserved. + */ +#ifndef G3D_FILTER_H +#define G3D_FILTER_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include "G3D/g3dmath.h" + +namespace G3D { +/** + Generates a set of 1D gaussian filter coefficients of size N. The coefficients + are centered on element (N-1)/2 and have standard deviation given by std. The coefficients + are normalized such that the sum across coeff is 1.0. + + Matches the results returned by Matlab fspecial('gaussian', [1, N], std) + */ +void gaussian1D(Array& coeff, int N = 5, float std = 0.5f); +} + +#endif diff --git a/externals/g3dlite/G3D/format.h b/externals/g3dlite/G3D/format.h new file mode 100644 index 0000000..3c7f067 --- /dev/null +++ b/externals/g3dlite/G3D/format.h @@ -0,0 +1,44 @@ +/** + @file format.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @author 2000-09-09 + @edited 2005-11-03 + + Copyright 2000-2005, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_FORMAT_H +#define G3D_FORMAT_H + +#include "G3D/platform.h" +#include +#include +#include + +namespace G3D { + +/** + Produces a string from arguments of the style of printf. This avoids + problems with buffer overflows when using sprintf and makes it easy + to use the result functionally. This function is fast when the resulting + string is under 160 characters (not including terminator) and slower + when the string is longer. + */ +std::string __cdecl format( + const char* fmt + ...) G3D_CHECK_PRINTF_ARGS; + +/** + Like format, but can be called with the argument list from a ... function. + */ +std::string vformat( + const char* fmt, + va_list argPtr) G3D_CHECK_VPRINTF_ARGS; + + +} // namespace + +#endif diff --git a/externals/g3dlite/G3D/g3dfnmatch.h b/externals/g3dlite/G3D/g3dfnmatch.h new file mode 100644 index 0000000..464b392 --- /dev/null +++ b/externals/g3dlite/G3D/g3dfnmatch.h @@ -0,0 +1,83 @@ +/*- + * Copyright (c) 1992, 1993 + *The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + *This product includes software developed by the University of + *California, Berkeley and its contributors. + * 4. Neither the name of the University 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 OR 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. + * + *@(#)fnmatch.h8.1 (Berkeley) 6/2/93 + * + * From FreeBSD fnmatch.h 1.7 + * $Id: g3dfnmatch.h,v 1.1 2010/02/06 06:51:28 morgan3d Exp $ + */ +#ifndef G3D_g3dfnmatch_h +#define G3D_g3dfnmatch_h + +#include "G3D/platform.h" + +namespace G3D { + +#if defined(G3D_WIN32) + +# if ! defined(FNM_NOMATCH) +# define FNM_NOMATCH 1 /* Match failed. */ +# define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ +# define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ +# define FNM_PERIOD 0x04 /* Period must be matched by period. */ +# define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ +# define FNM_CASEFOLD 0x10 /* Case insensitive search. */ +# define FNM_PREFIX_DIRS 0x20 /* Directory prefixes of pattern match too. */ +# endif + +#else + + // On non-windows systems, include fnmatch directly +# include +#endif + + +/** + Function fnmatch() as specified in POSIX 1003.2-1992, section B.6. + Compares a filename or pathname to a pattern. + +The fnmatch() function checks whether the string argument matches the pattern argument, which is a shell wildcard pattern. +The flags argument modifies the behaviour; it is the bitwise OR of zero or more of the following flags: + +- FNM_NOESCAPE If this flag is set, treat backslash as an ordinary character, instead of an escape character. +- FNM_PATHNAME If this flag is set, match a slash in string only with a slash in pattern and not by an asterisk (*) or a question mark (?) metacharacter, nor by a bracket expression ([]) containing a slash. +- FNM_PERIOD If this flag is set, a leading period in string has to be matched exactly by a period in pattern. A period is considered to be leading if it is the first character in string, or if both FNM_PATHNAME is set and the period immediately follows a slash. +- FNM_FILE_NAME This is a GNU synonym for FNM_PATHNAME. +- FNM_LEADING_DIR If this flag (a GNU extension) is set, the pattern is considered to be matched if it matches an initial segment of string which is followed by a slash. This flag is mainly for the internal use of glibc and is only implemented in certain cases. +- FNM_CASEFOLD If this flag (a GNU extension) is set, the pattern is matched case-insensitively. + +\return Zero if \a string matches \a pattern, FNM_NOMATCH if there is no match or another non-zero value if there is an error + + */ +int g3dfnmatch(const char *pattern, const char *string, int flags); +} +#endif diff --git a/externals/g3dlite/G3D/g3dmath.h b/externals/g3dlite/G3D/g3dmath.h new file mode 100644 index 0000000..d16214e --- /dev/null +++ b/externals/g3dlite/G3D/g3dmath.h @@ -0,0 +1,845 @@ +/** + @file g3dmath.h + + Math util class. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @cite highestBit by Jukka Liimatta + + @created 2001-06-02 + @edited 2009-04-07 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_g3dmath_h +#define G3D_g3dmath_h + +#ifdef _MSC_VER +// Disable conditional expression is constant, which occurs incorrectly on inlined functions +# pragma warning (push) +# pragma warning (disable : 4127) +// disable: "C++ exception handler used" +# pragma warning (disable : 4530) +#endif + +#include "G3D/platform.h" +#include +#include +#include +#include + +#ifdef _MSC_VER + // Visual Studio is missing inttypes.h +# ifndef PRId64 +# define PRId64 "I64d" +# endif +#else +#include +#endif + +/*These defines enable functionality introduced with the 1999 ISO C +**standard. They must be defined before the inclusion of math.h to +**engage them. If optimisation is enabled, these functions will be +**inlined. With optimisation switched off, you have to link in the +**maths library using -lm. +*/ + +#define _ISOC9X_SOURCE1 +#define _ISOC99_SOURCE1 +#define __USE_ISOC9X1 +#define __USE_ISOC991 + +#include + +#include "G3D/debug.h" + +#undef min +#undef max + +namespace G3D { + +#ifdef _MSC_VER +inline double __fastcall drand48() { + return ::rand() / double(RAND_MAX); +} + +#if !defined(_WIN64) + +/** + Win32 implementation of the C99 fast rounding routines. + + @cite routines are + Copyright (C) 2001 Erik de Castro Lopo + + Permission to use, copy, modify, distribute, and sell this file for any + purpose is hereby granted without fee, provided that the above copyright + and this permission notice appear in all copies. No representations are + made about the suitability of this software for any purpose. It is + provided "as is" without express or implied warranty. +*/ + +__inline long int lrint (double flt) { + int intgr; + + _asm { + fld flt + fistp intgr + }; + + return intgr; +} + +__inline long int lrintf(float flt) { + int intgr; + + _asm { + fld flt + fistp intgr + }; + + return intgr; +} + +#else + + __inline long int lrint (double flt) { + return (long int)floor(flt+0.5f); + } + + __inline long int lrintf(float flt) { + return (long int)floorf(flt+0.5f); + } + +#endif + +#endif + + +#define fuzzyEpsilon (0.00001f) +/** + This value should not be tested against directly, instead + G3D::isNan() and G3D::isFinite() will return reliable results. */ +double inf(); + +/** This value should not be tested against directly, instead + G3D::isNan() and G3D::isFinite() will return reliable results. */ +double nan(); + +float finf(); + +float fnan(); + +inline double pi() { + return 3.1415926535898; +} + +inline double halfPi() { + return 1.57079633; +} + +inline double twoPi() { + return 6.28318531; +} + +typedef signed char int8; +typedef unsigned char uint8; +typedef short int16; +typedef unsigned short uint16; +typedef int int32; +typedef unsigned int uint32; + +#ifdef _MSC_EXTENSIONS + typedef __int64 int64; + typedef unsigned __int64 uint64; +#elif ! defined(_MSC_VER) + typedef int64_t int64; + typedef uint64_t uint64; +#else + typedef long long int64; + typedef unsigned long long uint64; +#endif + +typedef float float32; +typedef double float64; + +int iAbs(int iValue); +int iCeil(double fValue); + +/** + Clamps the value to the range [low, hi] (inclusive) + */ +int iClamp(int val, int low, int hi); +int16 iClamp(int16 val, int16 low, int16 hi); +double clamp(double val, double low, double hi); +float clamp(float val, float low, float hi); + +/** + Returns a + (b - a) * f; + */ +inline double lerp(double a, double b, double f) { + return a + (b - a) * f; +} + +inline float lerp(float a, float b, float f) { + return a + (b - a) * f; +} + +/** + Wraps the value to the range [0, hi) (exclusive + on the high end). This is like the clock arithmetic + produced by % (modulo) except the result is guaranteed + to be positive. + */ +int iWrap(int val, int hi); + +int iFloor(double fValue); + +int iSign(int iValue); +int iSign(double fValue); + +inline int iSign(float f) { + return iSign((double)f); +} + + +/** + Fast round to integer using the lrint routine. + Typically 6x faster than casting to integer. + */ +inline int iRound(double fValue) { + return lrint(fValue); +} + +/** + Fast round to integer using the lrint routine. + Typically 6x faster than casting to integer. + */ +inline int iRound(float f) { + return lrintf(f); +} + +/** + Returns a random number uniformly at random between low and hi + (inclusive). + @deprecated Use Random::integer + */ +int iRandom(int low, int hi); + +double abs (double fValue); +double aCos (double fValue); +double aSin (double fValue); +double aTan (double fValue); +double aTan2 (double fY, double fX); +double sign (double fValue); +double square (double fValue); + +/** + Returns true if the argument is a finite real number. + */ +bool isFinite(double x); + +/** + Returns true if the argument is NaN (not a number). + You can't use x == nan to test this because all + comparisons against nan return false. + */ +bool isNaN(double x); +bool isNaN(float x); +inline bool isNaN(int x) { + (void)x; + return false; +} + +/** + Computes x % 3. + */ +int iMod3(int x); + +/** + Uniform random number between low and hi, inclusive. [low, hi] + @deprecated + @sa Random::uniform + */ +float uniformRandom(float low = 0.0f, float hi = 1.0f); + +/** + Normally distributed random number. + + @deprecated + @sa Random::gaussian + */ +float gaussRandom(float mean = 0.0f, float stdev = 1.0f); + + +/** Returns x5 */ +template +inline T pow5(T x) { + const T y = x * x; + return y * y * x; +} + + +template +inline T min(const T& x, const T& y) { + return std::min(x, y); +} + +template +inline T min(const T& x, const T& y, const T& z) { + return std::min(std::min(x, y), z); +} + +template +inline T min(const T& x, const T& y, const T& z, const T& w) { + return std::min(std::min(x, y), std::min(z, w)); +} + +template +inline T max(const T& x, const T& y) { + return std::max(x, y); +} + +template +inline T max(const T& x, const T& y, const T& z) { + return std::max(std::max(x, y), z); +} + +template +inline T max(const T& x, const T& y, const T& z, const T& w) { + return std::max(std::max(x, y), std::max(z, w)); +} + +int iMin(int x, int y); +int iMax(int x, int y); + +double square(double x); +double sumSquares(double x, double y); +double sumSquares(double x, double y, double z); +double distance(double x, double y); +double distance(double x, double y, double z); + +/** + Returnes the 0-based index of the highest 1 bit from + the left. -1 means the number was 0. + + @cite Based on code by jukka@liimatta.org + */ +int highestBit(uint32 x); + +/** + Note that fuzzyEq(a, b) && fuzzyEq(b, c) does not imply + fuzzyEq(a, c), although that will be the case on some + occasions. + */ +bool fuzzyEq(double a, double b); + +/** True if a is definitely not equal to b. + Guaranteed false if a == b. + Possibly false when a != b.*/ +bool fuzzyNe(double a, double b); + +/** Is a strictly greater than b? (Guaranteed false if a <= b). + (Possibly false if a > b) */ +bool fuzzyGt(double a, double b); + +/** Is a near or greater than b? */ +bool fuzzyGe(double a, double b); + +/** Is a strictly less than b? (Guaranteed false if a >= b)*/ +bool fuzzyLt(double a, double b); + +/** Is a near or less than b? */ +bool fuzzyLe(double a, double b); + +/** + Computes 1 / sqrt(x). + */ +inline float rsq(float x) { + return 1.0f / sqrtf(x); +} + +/** + Return the next power of 2 higher than the input + If the input is already a power of 2, the output will be the same + as the input. + */ +int ceilPow2(unsigned int in); + +/** Returns 2^x */ +inline int pow2(unsigned int x) { + return 1 << x; +} + +inline double log2(double x) { + return ::log(x) * 1.442695; +} + +inline float log2(float x) { + return ::logf(x) * 1.442695f; +} + +inline double log2(int x) { + return log2((double)x); +} + + +/** + * True if num is a power of two. + */ +bool isPow2(int num); + +bool isOdd(int num); +bool isEven(int num); + +double toRadians(double deg); +double toDegrees(double rad); + +/** + Returns true if x is not exactly equal to 0.0f. + */ +inline bool any(float x) { + return x != 0; +} + +/** + Returns true if x is not exactly equal to 0.0f. + */ +inline bool all(float x) { + return x != 0; +} + +/** + v / v (for DirectX/Cg support) + */ +inline float normalize(float v) { + return v / v; +} + +/** + a * b (for DirectX/Cg support) + */ +inline float dot(float a, float b) { + return a * b; +} + + +/** + a * b (for DirectX/Cg support) + */ +inline float mul(float a, float b) { + return a * b; +} + +/** + 2^x + */ +inline double exp2(double x) { + return pow(2.0, x); +} + +inline float exp2(float x) { + return powf(2.0f, x); +} + +/** @deprecated Use rsq */ +inline double rsqrt(double x) { + return 1.0 / sqrt(x); +} + +/** @deprecated Use rsq */ +inline float rsqrt(float x) { + // TODO: default this to using the SSE2 instruction + return 1.0 / sqrtf(x); +} + +/** + sin(x)/x + */ +inline double sinc(double x) { + double r = sin(x) / x; + + if (isNaN(r)) { + return 1.0; + } else { + return r; + } +} + +/** + Computes a floating point modulo; the result is t wrapped to the range [lo, hi). + */ +inline float wrap(float t, float lo, float hi) { + if ((t >= lo) && (t < hi)) { + return t; + } + + debugAssert(hi > lo); + + float interval = hi - lo; + + return t - interval * iFloor((t - lo) / interval); +} + + +inline double wrap(double t, double lo, double hi) { + if ((t >= lo) && (t < hi)) { + return t; + } + + debugAssert(hi > lo); + + double interval = hi - lo; + + return t - interval * iFloor((t - lo) / interval); +} + +inline double wrap(double t, double hi) { + return wrap(t, 0.0, hi); +} + + +inline bool isFinite(double x) { + return ! isNaN(x) && (x < G3D::inf()) && (x > -G3D::inf()); +} + +inline bool isFinite(float x) { + return ! isNaN(x) && (x < G3D::finf()) && (x > -G3D::finf()); +} + +//---------------------------------------------------------------------------- +inline int iAbs (int iValue) { + return ( iValue >= 0 ? iValue : -iValue ); +} + +//---------------------------------------------------------------------------- +inline int iCeil (double fValue) { + return int(::ceil(fValue)); +} + +//---------------------------------------------------------------------------- + +inline int iClamp(int val, int low, int hi) { + debugAssert(low <= hi); + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } +} + +//---------------------------------------------------------------------------- + +inline int16 iClamp(int16 val, int16 low, int16 hi) { + debugAssert(low <= hi); + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } +} + +//---------------------------------------------------------------------------- + +inline double clamp(double val, double low, double hi) { + debugAssert(low <= hi); + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } +} + +inline float clamp(float val, float low, float hi) { + debugAssert(low <= hi); + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } +} +//---------------------------------------------------------------------------- + +inline int iWrap(int val, int hi) { + if (val < 0) { + return ((val % hi) + hi) % hi; + } else { + return val % hi; + } +} + +//---------------------------------------------------------------------------- +inline int iFloor (double fValue) { + return int(::floor(fValue)); +} + +//---------------------------------------------------------------------------- +inline int iSign (int iValue) { + return ( iValue > 0 ? + 1 : ( iValue < 0 ? -1 : 0 ) ); +} + +inline int iSign (double fValue) { + return ( fValue > 0.0 ? + 1 : ( fValue < 0.0 ? -1 : 0 ) ); +} + +//---------------------------------------------------------------------------- +inline double abs (double fValue) { + return double(::fabs(fValue)); +} + +//---------------------------------------------------------------------------- +inline double aCos (double fValue) { + if ( -1.0 < fValue ) { + if ( fValue < 1.0 ) + return double(::acos(fValue)); + else + return 0.0; + } else { + return pi(); + } +} + +//---------------------------------------------------------------------------- +inline double aSin (double fValue) { + if ( -1.0 < fValue ) { + if ( fValue < 1.0 ) { + return double(::asin(fValue)); + } else { + return -halfPi(); + } + } else { + return halfPi(); + } +} + +//---------------------------------------------------------------------------- +inline double aTan (double fValue) { + return double(::atan(fValue)); +} + +//---------------------------------------------------------------------------- +inline double aTan2 (double fY, double fX) { + return double(::atan2(fY, fX)); +} + +//---------------------------------------------------------------------------- +inline double sign (double fValue) { + if (fValue > 0.0) { + return 1.0; + } + + if (fValue < 0.0) { + return -1.0; + } + + return 0.0; +} + +inline float sign (float fValue) { + if (fValue > 0.0f) { + return 1.0f; + } + + if (fValue < 0.0f) { + return -1.0f; + } + + return 0.0f; +} + + +inline float uniformRandom(float low, float hi) { + return (hi - low) * float(::rand()) / float(RAND_MAX) + low; +} + +inline double square(double x) { + return x * x; +} + +inline float square(float x) { + return x * x; +} + +inline int square(int x) { + return x * x; +} + +//---------------------------------------------------------------------------- +inline double sumSquares(double x, double y) { + return x*x + y*y; +} + +//---------------------------------------------------------------------------- +inline float sumSquares(float x, float y) { + return x*x + y*y; +} + +//---------------------------------------------------------------------------- +inline double sumSquares(double x, double y, double z) { + return x*x + y*y + z*z; +} + +//---------------------------------------------------------------------------- +inline float sumSquares(float x, float y, float z) { + return x*x + y*y + z*z; +} + +//---------------------------------------------------------------------------- +inline double distance(double x, double y) { + return sqrt(sumSquares(x, y)); +} + +//---------------------------------------------------------------------------- +inline float distance(float x, float y) { + return sqrt(sumSquares(x, y)); +} + +//---------------------------------------------------------------------------- +inline double distance(double x, double y, double z) { + return sqrt(sumSquares(x, y, z)); +} + +//---------------------------------------------------------------------------- +inline float distance(float x, float y, float z) { + return sqrt(sumSquares(x, y, z)); +} + +//---------------------------------------------------------------------------- + +/** @deprecated use G3D::min */ +inline int iMin(int x, int y) { + return (x >= y) ? y : x; +} + +//---------------------------------------------------------------------------- +/** @deprecated use G3D::min */ +inline int iMax(int x, int y) { + return (x >= y) ? x : y; +} + +//---------------------------------------------------------------------------- +inline int ceilPow2(unsigned int in) { + in -= 1; + + in |= in >> 16; + in |= in >> 8; + in |= in >> 4; + in |= in >> 2; + in |= in >> 1; + + return in + 1; +} + +inline bool isPow2(int num) { + return ((num & -num) == num); +} + +inline bool isOdd(int num) { + return (num & 1) == 1; +} + +inline bool isEven(int num) { + return (num & 1) == 0; +} + +inline double toRadians(double deg) { + return deg * pi() / 180.0; +} + +inline double toDegrees(double rad) { + return rad * 180.0 / pi(); +} + +inline float toRadians(float deg) { + return deg * (float)pi() / 180.0f; +} + +inline float toDegrees(float rad) { + return rad * 180.0f / (float)pi(); +} + +inline float toRadians(int deg) { + return deg * (float)pi() / 180.0f; +} + +inline float toDegrees(int rad) { + return rad * 180.0f / (float)pi(); +} +/** + Computes an appropriate epsilon for comparing a and b. + */ +inline double eps(double a, double b) { + // For a and b to be nearly equal, they must have nearly + // the same magnitude. This means that we can ignore b + // since it either has the same magnitude or the comparison + // will fail anyway. + (void)b; + const double aa = abs(a) + 1.0; + if (aa == inf()) { + return fuzzyEpsilon; + } else { + return fuzzyEpsilon * aa; + } +} + +inline bool fuzzyEq(double a, double b) { + return (a == b) || (abs(a - b) <= eps(a, b)); +} + +inline bool fuzzyNe(double a, double b) { + return ! fuzzyEq(a, b); +} + +inline bool fuzzyGt(double a, double b) { + return a > b + eps(a, b); +} + +inline bool fuzzyGe(double a, double b) { + return a > b - eps(a, b); +} + +inline bool fuzzyLt(double a, double b) { + return a < b - eps(a, b); +} + +inline bool fuzzyLe(double a, double b) { + return a < b + eps(a, b); +} + +inline int iMod3(int x) { + return x % 3; +} + +/** + Given a 32-bit integer, returns the integer with the bytes in the opposite order. + */ +inline uint32 flipEndian32(const uint32 x) { + return (x << 24) | ((x & 0xFF00) << 8) | + ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24); +} + +/** + Given a 16-bit integer, returns the integer with the bytes in the opposite order. + */ +inline uint16 flipEndian16(const uint16 x) { + return (x << 8) | ((x & 0xFF00) >> 8); +} + + +} // namespace + +#ifdef _MSC_VER +# pragma warning (pop) +#endif + +#endif + diff --git a/externals/g3dlite/G3D/g3dmath.inl b/externals/g3dlite/G3D/g3dmath.inl new file mode 100644 index 0000000..9bf661a --- /dev/null +++ b/externals/g3dlite/G3D/g3dmath.inl @@ -0,0 +1,288 @@ +/** + @file g3dmath.inl + + @maintainer Morgan McGuire, matrix@graphics3d.com + + @created 2001-06-02 + @edited 2006-01-14 + */ + +#include + +#ifdef _MSC_VER +// Disable conditional expression is constant, which occurs incorrectly on inlined functions +# pragma warning (push) +# pragma warning( disable : 4127 ) +#endif + +namespace G3D { + +inline bool isNaN(double x) { + bool b1 = (x < 0.0); + bool b2 = (x >= 0.0); + bool b3 = !(b1 || b2); + return b3; +} + +inline bool isFinite(double x) { + return ! isNaN(x) && (x < G3D::inf()) && (x > -G3D::inf()); +} + +//---------------------------------------------------------------------------- +inline int iAbs (int iValue) { + return ( iValue >= 0 ? iValue : -iValue ); +} + +//---------------------------------------------------------------------------- +inline int iCeil (double fValue) { + return int(::ceil(fValue)); +} + +//---------------------------------------------------------------------------- + +inline int iClamp(int val, int low, int hi) { + debugAssert(low <= hi); + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } +} + +//---------------------------------------------------------------------------- + +inline double clamp(double val, double low, double hi) { + debugAssert(low <= hi); + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } +} + +inline float clamp(float val, float low, float hi) { + debugAssert(low <= hi); + if (val <= low) { + return low; + } else if (val >= hi) { + return hi; + } else { + return val; + } +} +//---------------------------------------------------------------------------- + +inline int iWrap(int val, int hi) { + if (val < 0) { + return ((val % hi) + hi) % hi; + } else { + return val % hi; + } +} + +//---------------------------------------------------------------------------- +inline int iFloor (double fValue) { + return int(::floor(fValue)); +} + +//---------------------------------------------------------------------------- +inline int iSign (int iValue) { + return ( iValue > 0 ? + 1 : ( iValue < 0 ? -1 : 0 ) ); +} + +inline int iSign (double fValue) { + return ( fValue > 0.0 ? + 1 : ( fValue < 0.0 ? -1 : 0 ) ); +} + +//---------------------------------------------------------------------------- +inline double abs (double fValue) { + return double(::fabs(fValue)); +} + +//---------------------------------------------------------------------------- +inline double aCos (double fValue) { + if ( -1.0 < fValue ) { + if ( fValue < 1.0 ) + return double(::acos(fValue)); + else + return 0.0; + } else { + return G3D_PI; + } +} + +//---------------------------------------------------------------------------- +inline double aSin (double fValue) { + if ( -1.0 < fValue ) { + if ( fValue < 1.0 ) { + return double(::asin(fValue)); + } else { + return -G3D_HALF_PI; + } + } else { + return G3D_HALF_PI; + } +} + +//---------------------------------------------------------------------------- +inline double aTan (double fValue) { + return double(::atan(fValue)); +} + +//---------------------------------------------------------------------------- +inline double aTan2 (double fY, double fX) { + return double(::atan2(fY, fX)); +} + +//---------------------------------------------------------------------------- +inline double sign (double fValue) { + if (fValue > 0.0) { + return 1.0; + } + + if (fValue < 0.0) { + return -1.0; + } + + return 0.0; +} + +inline double G3D_DEPRECATED unitRandom () { + return double(::rand()) / double(RAND_MAX); +} + +inline float uniformRandom(float low, float hi) { + return (hi - low) * float(::rand()) / float(RAND_MAX) + low; +} + +//---------------------------------------------------------------------------- +inline double G3D_DEPRECATED symmetricRandom () { + return 2.0 * double(::rand()) / double(RAND_MAX) - 1.0; +} + +//---------------------------------------------------------------------------- +inline double square(double x) { + return x * x; +} + +//---------------------------------------------------------------------------- +inline double sumSquares(double x, double y) { + return x*x + y*y; +} + +//---------------------------------------------------------------------------- +inline double sumSquares(double x, double y, double z) { + return x*x + y*y + z*z; +} + +//---------------------------------------------------------------------------- +inline double distance(double x, double y) { + return sqrt(sumSquares(x, y)); +} + +//---------------------------------------------------------------------------- +inline double distance(double x, double y, double z) { + return sqrt(sumSquares(x, y, z)); +} + +//---------------------------------------------------------------------------- + +/** @deprecated use G3D::min */ +inline int iMin(int x, int y) { + return (x >= y) ? y : x; +} + +//---------------------------------------------------------------------------- +/** @deprecated use G3D::min */ +inline int iMax(int x, int y) { + return (x >= y) ? x : y; +} + +//---------------------------------------------------------------------------- +inline int ceilPow2(unsigned int in) { + in -= 1; + + in |= in >> 16; + in |= in >> 8; + in |= in >> 4; + in |= in >> 2; + in |= in >> 1; + + return in + 1; +} + +inline bool isPow2(int num) { + return ((num & -num) == num); +} + +inline bool isOdd(int num) { + return (num & 1) == 1; +} + +inline bool isEven(int num) { + return (num & 1) == 0; +} + +inline double toRadians(double deg) { + return deg * G3D_PI / 180.0; +} + +inline double toDegrees(double rad) { + return rad * 180.0 / G3D_PI; +} + +/** + Computes an appropriate epsilon for comparing a and b. + */ +inline double eps(double a, double b) { + // For a and b to be nearly equal, they must have nearly + // the same magnitude. This means that we can ignore b + // since it either has the same magnitude or the comparison + // will fail anyway. + (void)b; + const double aa = abs(a) + 1; + if (aa == inf()) { + return fuzzyEpsilon; + } else { + return fuzzyEpsilon * aa; + } +} + +inline bool fuzzyEq(double a, double b) { + return (a == b) || (abs(a - b) <= eps(a, b)); +} + +inline bool fuzzyNe(double a, double b) { + return ! fuzzyEq(a, b); +} + +inline bool fuzzyGt(double a, double b) { + return a > b + eps(a, b); +} + +inline bool fuzzyGe(double a, double b) { + return a > b - eps(a, b); +} + +inline bool fuzzyLt(double a, double b) { + return a < b - eps(a, b); +} + +inline bool fuzzyLe(double a, double b) { + return a < b + eps(a, b); +} + +inline int iMod3(int x) { + return x % 3; +} + +} // namespace G3D + +#ifdef _MSC_VER +// Disable conditional expression is constant, which occurs incorrectly on inlined functions +# pragma warning (pop) +#endif diff --git a/externals/g3dlite/G3D/platform.h b/externals/g3dlite/G3D/platform.h new file mode 100644 index 0000000..11ba012 --- /dev/null +++ b/externals/g3dlite/G3D/platform.h @@ -0,0 +1,331 @@ +/** + @file platform.h + + \#defines for platform specific issues. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-06-09 + @edited 2010-01-11 + */ + +#ifndef G3D_platform_h +#define G3D_platform_h + +/** + The version number of G3D in the form: MmmBB -> + version M.mm [beta BB] + */ +#define G3D_VER 80004 + +// fatal error for unsupported architectures +#if defined(__powerpc__) +# error PowerPC is not supported by G3D! +#endif + +#if defined(G3D_RELEASEDEBUG) +# define G3D_DEBUGRELEASE +#endif + +#if defined(G3D_DEBUGRELEASE) && defined(_DEBUG) +# undef _DEBUG +#endif + +/** @def G3D_DEBUG() + Defined if G3D is built in debug mode. */ +#if !defined(G3D_DEBUG) && (defined(_DEBUG) || defined(G3D_DEBUGRELEASE)) +# define G3D_DEBUG +#endif + +#ifndef _MSC_VER +/// Fast call is a register-based optimized calling convention supported only by Visual C++ +#define __fastcall + +#endif + +#ifdef _MSC_VER + #define G3D_WIN32 +#elif defined(__FreeBSD__) || defined(__OpenBSD__) + #define G3D_FREEBSD + #define G3D_LINUX +#elif defined(__linux__) + #define G3D_LINUX +#elif defined(__APPLE__) + #define G3D_OSX + + // Prevent OS X fp.h header from being included; it defines + // pi as a constant, which creates a conflict with G3D +#define __FP__ +#else + #error Unknown platform +#endif + +// Detect 64-bit under various compilers +#if (defined(_M_X64) || defined(_WIN64) || defined(__LP64__) || defined(_LP64)) +# define G3D_64BIT + #if defined(WIN32) + #include + #endif +#else +# define G3D_32BIT +#endif + +// Strongly encourage inlining on gcc +#ifdef __GNUC__ +#define inline __inline__ +#endif + + +// Verify that the supported compilers are being used and that this is a known +// processor. + +#ifdef G3D_LINUX +# ifndef __GNUC__ +# error G3D only supports the gcc compiler on Linux. +# endif +#endif + +#ifdef G3D_OSX +# ifndef __GNUC__ +# error G3D only supports the gcc compiler on OS X. +# endif + +# if defined(__i386__) +# define G3D_OSX_INTEL +# elif defined(__PPC__) +# define G3D_OSX_PPC +# else +# define G3D_OSX_UNKNOWN +# endif + +#endif + + +#ifdef _MSC_VER +// Microsoft Visual C++ 8.0 ("Express") = 1400 +// Microsoft Visual C++ 7.1 ("2003") _MSC_VER = 1310 +// Microsoft Visual C++ 7.0 ("2002") _MSC_VER = 1300 +// Microsoft Visual C++ 6.0 _MSC_VER = 1200 +// Microsoft Visual C++ 5.0 _MSC_VER = 1100 + +// Turn off warnings about deprecated C routines +# pragma warning (disable : 4996) + +// Turn off "conditional expression is constant" warning; MSVC generates this +// for debug assertions in inlined methods. +# pragma warning (disable : 4127) + +/** @def G3D_DEPRECATED() + Creates deprecated warning. */ +# define G3D_DEPRECATED __declspec(deprecated) + +// Prevent Winsock conflicts by hiding the winsock API +# ifndef _WINSOCKAPI_ +# define _G3D_INTERNAL_HIDE_WINSOCK_ +# define _WINSOCKAPI_ +# endif + +// Disable 'name too long for browse information' warning +# pragma warning (disable : 4786) +// TODO: remove +# pragma warning (disable : 4244) + +# define restrict + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_PRINTF_ARGS + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_VPRINTF_ARGS + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_PRINTF_METHOD_ARGS + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_VPRINTF_METHOD_ARGS + + // On MSVC, we need to link against the multithreaded DLL version of + // the C++ runtime because that is what SDL and ZLIB are compiled + // against. This is not the default for MSVC, so we set the following + // defines to force correct linking. + // + // For documentation on compiler options, see: + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_.2f.md.2c_2f.ml.2c_2f.mt.2c_2f.ld.asp + // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_Compiler_Reference.asp + // + + // DLL runtime + #ifndef _DLL + #define _DLL + #endif + + // Multithreaded runtime + #ifndef _MT + #define _MT 1 + #endif + + // Ensure that we aren't forced into the static lib + #ifdef _STATIC_CPPLIB + #undef _STATIC_CPPLIB + #endif + + #ifdef _DEBUG + #pragma comment (linker, "/NODEFAULTLIB:LIBCMTD.LIB") + #pragma comment (linker, "/NODEFAULTLIB:LIBCPMTD.LIB") + #pragma comment (linker, "/NODEFAULTLIB:LIBCPD.LIB") + #pragma comment (linker, "/DEFAULTLIB:MSVCPRTD.LIB") + #pragma comment(linker, "/NODEFAULTLIB:LIBCD.LIB") + #pragma comment(linker, "/DEFAULTLIB:MSVCRTD.LIB") + #else + #pragma comment(linker, "/NODEFAULTLIB:LIBC.LIB") + #pragma comment(linker, "/DEFAULTLIB:MSVCRT.LIB") + #pragma comment (linker, "/NODEFAULTLIB:LIBCMT.LIB") + #pragma comment (linker, "/NODEFAULTLIB:LIBCPMT.LIB") + #pragma comment(linker, "/NODEFAULTLIB:LIBCP.LIB") + #pragma comment (linker, "/DEFAULTLIB:MSVCPRT.LIB") + #endif + + // Now set up external linking + +# ifdef _DEBUG + // zlib was linked against the release MSVCRT; force + // the debug version. +# pragma comment(linker, "/NODEFAULTLIB:MSVCRT.LIB") +# endif + + +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif + + +# define NOMINMAX 1 +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# include +# undef WIN32_LEAN_AND_MEAN +# undef NOMINMAX + +# ifdef _G3D_INTERNAL_HIDE_WINSOCK_ +# undef _G3D_INTERNAL_HIDE_WINSOCK_ +# undef _WINSOCKAPI_ +# endif + + +/** @def G3D_START_AT_MAIN() + Defines necessary wrapper around WinMain on Windows to allow transfer of execution to main(). */ +# define G3D_START_AT_MAIN()\ +int WINAPI G3D_WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw);\ +int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) {\ + return G3D_WinMain(hInst, hPrev, szCmdLine, sw);\ +} + +#else + +/** @def G3D_START_AT_MAIN() + Defines necessary wrapper around WinMain on Windows to allow transfer of execution to main(). */ +# define G3D_START_AT_MAIN() + +#endif // win32 + +#ifdef __GNUC__ + +# include + +# if __STDC_VERSION__ < 199901 +# define restrict __restrict__ +# endif + +/** @def G3D_DEPRECATED() + Creates deprecated warning. */ +# define G3D_DEPRECATED __attribute__((__deprecated__)) + +// setup function calling conventions +# if defined(__i386__) && ! defined(__x86_64__) + +# ifndef __cdecl +# define __cdecl __attribute__((cdecl)) +# endif + +# ifndef __stdcall +# define __stdcall __attribute__((stdcall)) +# endif + +# elif defined(__x86_64__) + +# ifndef __cdecl +# define __cdecl +# endif + +# ifndef __stdcall +# define __stdcall +# endif +# endif // calling conventions + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_PRINTF_METHOD_ARGS __attribute__((__format__(__printf__, 2, 3))) + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_VPRINTF_METHOD_ARGS __attribute__((__format__(__printf__, 2, 0))) + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_PRINTF_ARGS __attribute__((__format__(__printf__, 1, 2))) + +/** @def G3D_CHECK_PRINTF_METHOD_ARGS() + Enables printf parameter validation on gcc. */ +# define G3D_CHECK_VPRINTF_ARGS __attribute__((__format__(__printf__, 1, 0))) +#endif + + +/** + @def STR(expression) + + Creates a string from the expression. Frequently used with G3D::Shader + to express shading programs inline. + + STR(this becomes a string)\verbatim
\endverbatim evaluates the same as \verbatim\endverbatim"this becomes a string"
+ */
+#define STR(x) #x
+
+/** @def PRAGMA(expression)
+    \#pragma may not appear inside a macro, so this uses the pragma operator
+    to create an equivalent statement.*/
+#ifdef _MSC_VER
+// Microsoft's version http://msdn.microsoft.com/en-us/library/d9x1s805.aspx
+#    define PRAGMA(x) __pragma(x)
+#else
+// C99 standard http://www.delorie.com/gnu/docs/gcc/cpp_45.html
+#    define PRAGMA(x) _Pragma(#x)
+#endif
+
+/** @def G3D_BEGIN_PACKED_CLASS(byteAlign)
+    Switch to tight alignment
+    See G3D::Color3uint8 for an example.*/
+#ifdef _MSC_VER
+#    define G3D_BEGIN_PACKED_CLASS(byteAlign)  PRAGMA( pack(push, byteAlign) )
+#else
+#    define G3D_BEGIN_PACKED_CLASS(byteAlign)
+#endif
+
+/** @def G3D_END_PACKED_CLASS(byteAlign)
+    End switch to tight alignment
+    See G3D::Color3uint8 for an example.*/
+#ifdef _MSC_VER
+#    define G3D_END_PACKED_CLASS(byteAlign)  ; PRAGMA( pack(pop) )
+#elif defined(__GNUC__)
+#    define G3D_END_PACKED_CLASS(byteAlign)  __attribute((aligned(byteAlign))) ;
+#else
+#    define G3D_END_PACKED_CLASS(byteAlign)  ;
+#endif
+
+
+// Header guard
+#endif
diff --git a/externals/g3dlite/G3D/prompt.h b/externals/g3dlite/G3D/prompt.h
new file mode 100644
index 0000000..c6df628
--- /dev/null
+++ b/externals/g3dlite/G3D/prompt.h
@@ -0,0 +1,67 @@
+/** 
+ @file prompt.h
+ 
+ @maintainer Morgan McGuire, http://graphics.cs.williams.edu
+ @cite   Windows GUI code by Max McGuire
+
+ @created 2001-08-26
+ @edited  2006-08-13
+ */
+
+#ifndef G3D_PROMPT_H
+#define G3D_PROMPT_H
+
+#include "platform.h"
+#include 
+
+namespace G3D {
+
+/**
+  Prints a prompt to stdout and waits for user input.  The return value is
+  the number of the user's choice (the first is 0, if there are no
+  choices, returns 0). 
+ 
+  @param useGui Under Win32, use a GUI, not stdout prompt.
+  @param windowTitle The title for the prompt window
+  @param promptx The text string to prompt the user with
+  @param choice  An array of strings that are the choices the user may make
+  @param numChoices The length of choice.
+
+  @cite Windows dialog interface by Max McGuire, mmcguire@ironlore.com
+  @cite Font setting code by Kurt Miller, kurt@flipcode.com
+ */
+int prompt(
+    const char*     windowTitle,
+    const char*     promptx,
+    const char**    choice,
+    int             numChoices,
+    bool            useGui);
+
+/**
+  Prints a prompt and waits for user input.  The return value is
+  the number of the user's choice (the first is 0, if there are no
+  choices, returns 0).
+  

Uses GUI under Win32, stdout prompt otherwise. + */ +inline int prompt( + const char* windowTitle, + const char* promptx, + const char** choice, + int numChoices) { + + return prompt(windowTitle, promptx, choice, numChoices, true); +} + + +/** + Displays a GUI prompt with "Ok" as the only choice. + */ +void msgBox( + const std::string& message, + const std::string& title = "Message"); + + +}; // namespace + +#endif + diff --git a/externals/g3dlite/G3D/serialize.h b/externals/g3dlite/G3D/serialize.h new file mode 100644 index 0000000..2382c0e --- /dev/null +++ b/externals/g3dlite/G3D/serialize.h @@ -0,0 +1,30 @@ +#ifndef G3D_SERIALIZE_H +#define G3D_SERIALIZE_H + +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/Array.h" + +namespace G3D { + + +template +void serialize(const Array& array, BinaryOutput& b) { + b.writeInt32(array.size()); + for (int i = 0; i < array.size(); ++i) { + serialize(array[i], b); + } +} + +template +void deserialize(Array& array, BinaryInput& b) { + int N = b.readInt32(); + array.resize(N); + for (int i = 0; i < array.size(); ++i) { + deserialize(array[i], b); + } +} + +} + +#endif diff --git a/externals/g3dlite/G3D/splinefunc.h b/externals/g3dlite/G3D/splinefunc.h new file mode 100644 index 0000000..3f3a018 --- /dev/null +++ b/externals/g3dlite/G3D/splinefunc.h @@ -0,0 +1,118 @@ +/** + @file spline.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2004-07-25 + @edited 2007-05-05 + */ + +#ifndef G3D_SPLINEFUNC_H +#define G3D_SPLINEFUNC_H + +#include "G3D/platform.h" +#include "G3D/debug.h" +#include "G3D/Array.h" +#include "G3D/g3dmath.h" + +namespace G3D { + +/** + Interpolates a property according to a piecewise linear spline. This provides + C0 continuity but the derivatives are not smooth. +

+ Example: + + const double times[] = {MIDNIGHT, SUNRISE - HOUR, SUNRISE, SUNRISE + sunRiseAndSetTime / 4, SUNRISE + sunRiseAndSetTime, SUNSET - sunRiseAndSetTime, SUNSET - sunRiseAndSetTime / 2, SUNSET, SUNSET + HOUR/2, DAY}; + const Color3 color[] = {Color3(0, .0, .1), Color3(0, .0, .1), Color3::black(), Color3::black(), Color3::white() * .25, Color3::white() * .25, Color3(.5, .2, .2), Color3(.05, .05, .1), Color3(0, .0, .1), Color3(0, .0, .1)}; + ambient = linearSpline(time, times, color, 10); + + + See also G3D::Spline + + @param x The spline is a function of x; this is the sample to choose. + @param controlX controlX[i], controlY[i] is a control points. It is assumed + that controlX are strictly increasing. XType must support + the "<" operator and a subtraction operator that returns + a number. + @param controlY YType must support multiplication and addition. + @param numControl The number of control points. + */ +template +YType linearSpline(double x, const XType* controlX, const YType* controlY, int numControl) { + debugAssert(numControl >= 1); + + // Off the beginning + if ((numControl == 1) || (x < controlX[0])) { + return controlY[0]; + } + + for (int i = 1; i < numControl; ++i) { + if (x < controlX[i]) { + const double alpha = (double)(controlX[i] - x) / (controlX[i] - controlX[i - 1]); + return controlY[i] * (1 - alpha) + controlY[i - 1] * alpha; + } + } + + // Off the end + return controlY[numControl - 1]; +} + + + /** See also G3D::Spline*/ +template YType cyclicCatmullRomSpline( + double t, + const YType* controlY, + int numPoints) { + + debugAssert(numPoints >= 3); + + t = wrap(t, numPoints); + + // Find the indices of adjacent control points + int i = iFloor(t); + + // Compute the distance from the control point + t = t - i; + + // Shift back one point for correct indexing + i += numPoints - 1; + + // Pick up four control points + const YType& P0 = controlY[(i + 0) % numPoints]; + const YType& P1 = controlY[(i + 1) % numPoints]; + const YType& P2 = controlY[(i + 2) % numPoints]; + const YType& P3 = controlY[(i + 3) % numPoints]; + + return 0.5 * ((2 * P1) + + (-P0 + P2) * t + + (2*P0 - 5*P1 + 4*P2 - P3) * t*t + + (-P0 + 3*P1- 3*P2 + P3) * t*t*t); +} + +/** + A cubic spline with regularly spaced + control points. The spline interpolates + the control points. The spline + will wrap from the last point back to the first. + + The t parameter is on the range [0, controlY.size()], + where integers correspond to control points exactly. + + See also G3D::Spline + + @cite http://www.mvps.org/directx/articles/catmull/ +*/ +template YType cyclicCatmullRomSpline( + double t, + const Array& controlY) { + + int numPoints = controlY.size(); + return cyclicCatmullRomSpline(t, controlY.getCArray(), numPoints); +} + +} + +#endif + + diff --git a/externals/g3dlite/G3D/stringutils.h b/externals/g3dlite/G3D/stringutils.h new file mode 100644 index 0000000..e15a757 --- /dev/null +++ b/externals/g3dlite/G3D/stringutils.h @@ -0,0 +1,140 @@ +/** + @file stringutils.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @author 2000-09-09 + @edited 2008-08-05 + */ + +#ifndef G3D_STRINGUTILS_H +#define G3D_STRINGUTILS_H + +#include "G3D/platform.h" +#include "G3D/Array.h" +#include + +namespace G3D { + +extern const char* NEWLINE; + +/** Separates a comma-separated line, properly escaping commas within + double quotes (") and super quotes ("""). This matches Microsoft Excel's + CSV output. + + \param stripQuotes If true, strips leading and trailing " and """ + + \sa G3D::stringSplit, G3D::TextInput, G3D::readWholeFile +*/ +void parseCommaSeparated(const std::string s, Array& array, bool stripQuotes = true); + +/** + Returns true if the test string begins with the pattern string. + */ +bool beginsWith( + const std::string& test, + const std::string& pattern); + +/** + Returns true if the test string ends with the pattern string. + */ +bool endsWith( + const std::string& test, + const std::string& pattern); + +/** + Produces a new string that is the input string + wrapped at a certain number of columns (where + the line is broken at the latest space before the + column limit.) Platform specific NEWLINEs + are inserted to wrap. + */ +std::string wordWrap( + const std::string& input, + int numCols); + +/** + A comparison function for passing to Array::sort. + */ +int stringCompare( + const std::string& s1, + const std::string& s2); + +int stringPtrCompare( + const std::string* s1, + const std::string* s2); + +/** + Returns a new string that is an uppercase version of x. + */ +std::string toUpper( + const std::string& x); + +std::string toLower( + const std::string& x); + +/** + Splits x at each occurance of splitChar. + */ +G3D::Array stringSplit( + const std::string& x, + char splitChar); + +/** + joinChar is not inserted at the beginning or end, just in between + elements. + */ +std::string stringJoin( + const G3D::Array& a, + char joinChar); + +std::string stringJoin( + const G3D::Array& a, + const std::string& joinStr); + +/** + Strips whitespace from both ends of the string. + */ +std::string trimWhitespace( + const std::string& s); + +/** These standard C functions are renamed for clarity/naming + conventions and to return bool, not int. + */ +inline bool isWhiteSpace(const unsigned char c) { + return isspace(c) != 0; +} + +/** These standard C functions are renamed for clarity/naming + conventions and to return bool, not int. + */ +inline bool isNewline(const unsigned char c) { + return (c == '\n') || (c == '\r'); +} + +/** These standard C functions are renamed for clarity/naming + conventions and to return bool, not int. + */ +inline bool isDigit(const unsigned char c) { + return isdigit(c) != 0; +} + +/** These standard C functions are renamed for clarity/naming + conventions and to return bool, not int. + */ +inline bool isLetter(const unsigned char c) { + return isalpha(c) != 0; +} + +inline bool isSlash(const unsigned char c) { + return (c == '\\') || (c == '/'); +} + +inline bool isQuote(const unsigned char c) { + return (c == '\'') || (c == '\"'); +} + +}; // namespace + +#endif + diff --git a/externals/g3dlite/G3D/uint128.h b/externals/g3dlite/G3D/uint128.h new file mode 100644 index 0000000..da1af3e --- /dev/null +++ b/externals/g3dlite/G3D/uint128.h @@ -0,0 +1,51 @@ +/** + @file uint128.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @author Kyle Whitson + + @created 2008-07-17 + @edited 2008-07-17 + */ + +#ifndef G3D_UINT128_H +#define G3D_UINT128_H + +#include "G3D/g3dmath.h" + +namespace G3D { + +/** Limited functionality 128-bit unsigned integer. This is primarily to support FNV hashing and other + cryptography applications. See the GMP library for high-precision C++ math support. */ +class uint128 { +public: + + G3D::uint64 hi; + G3D::uint64 lo; + + uint128(const uint64& lo); + + uint128(const uint64& hi, const uint64& lo); + + uint128& operator+=(const uint128& x); + + uint128& operator*=(const uint128& x); + + uint128& operator^=(const uint128& x); + + uint128& operator&=(const uint128& x); + + uint128& operator|=(const uint128& x); + + bool operator==(const uint128& x); + + uint128& operator>>=(const int x); + + uint128& operator<<=(const int x); + + uint128 operator&(const uint128& x); + +}; +} + +#endif diff --git a/externals/g3dlite/G3D/units.h b/externals/g3dlite/G3D/units.h new file mode 100644 index 0000000..2e30304 --- /dev/null +++ b/externals/g3dlite/G3D/units.h @@ -0,0 +1,126 @@ +/** + @file units.h + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2009-08-21 + @edited 2009-08-21 + */ +#ifndef G3D_units_h +#define G3D_units_h + +#include "G3D/platform.h" + +namespace G3D { +/** Use using namespace G3D::units; to include all units + into your program. The units system is specifically designed not to + be general but to support commonly used units efficiently and + clearly. See http://en.wikipedia.org/wiki/SI_prefix for interesting facts + about SI/metric units and full definitions.*/ +namespace units { + +/** 1e-9 m */ +inline float nanometers() { + return 1e-9f; +} + +/** 1e-6 m */ +inline float micrometers() { + return 1e-6f; +} + +/** 0.001 m */ +inline float millimeters() { + return 0.001f; +} + +/** 0.01 m */ +inline float centimeters() { + return 0.01f; +} + +/** SI base unit of distance measure. */ +inline float meters() { + return 1.0f; +} + +/** 1000 m */ +inline float kilometers() { + return 100.0f; +} + +/** 0.0254 m */ +inline float inches() { + return 0.0254f; +} + +/** 0.3048 m */ +inline float feet() { + return 0.3048f; +} + +/** 0.9144 m */ +inline float yards() { + return 0.9144f; +} + +/** 1609.344 m */ +inline float miles() { + return 1609.344f; +} + +///////////////////////////////////////////////////////////// + +/** SI base unit of angular measure. */ +inline float radians() { + return 1.0f; +} + +/** pi/180 */ +inline float degrees() { + return 0.0174532925f; +} + +////////////////////////////////////////////////////////////// + +/** 1e-9 s */ +inline float nanoseconds() { + return 1e-9f; +} + +/** 1e-3 s */ +inline float milliseconds() { + return 1e-3f; +} + +/** Base unit of time */ +inline float seconds() { + return 1.0; +} + +/** 60 s */ +inline float minutes() { + return 60.0f; +} + +/** 3600 s */ +inline float hours() { + return 3600.0f; +} + +/** 86400 s */ +inline float days() { + return 86400.0f; +} + +/** 31556926 s */ +inline float years() { + return 31556926.0f; +} + +/////////////////////////////////////////// + +} +} + +#endif diff --git a/externals/g3dlite/G3D/vectorMath.h b/externals/g3dlite/G3D/vectorMath.h new file mode 100644 index 0000000..ac6d2b3 --- /dev/null +++ b/externals/g3dlite/G3D/vectorMath.h @@ -0,0 +1,235 @@ +/** + @file vectorMath.h + + Function aliases for popular vector methods. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created: 2001-06-02 + @edited: 2004-02-02 + Copyright 2000-2004, Morgan McGuire. + All rights reserved. + */ + +#ifndef G3D_VECTORMATH_H +#define G3D_VECTORMATH_H + +#include "G3D/platform.h" +#include "G3D/g3dmath.h" +#include "G3D/Vector2.h" +#include "G3D/Vector3.h" +#include "G3D/Vector4.h" +#include "G3D/Matrix3.h" +#include "G3D/Matrix4.h" +#include "G3D/Color1.h" +#include "G3D/Color3.h" +#include "G3D/Color4.h" + + +namespace G3D { + + +inline Matrix4 mul(const Matrix4& a, const Matrix4& b) { + return a * b; +} + +inline Vector4 mul(const Matrix4& m, const Vector4& v) { + return m * v; +} + +inline Vector3 mul(const Matrix3& m, const Vector3& v) { + return m * v; +} + +inline Matrix3 mul(const Matrix3& a, const Matrix3& b) { + return a * b; +} + +inline float dot(const Vector2& a, const Vector2& b) { + return a.dot(b); +} + +inline float dot(const Vector3& a, const Vector3& b) { + return a.dot(b); +} + +inline float dot(const Vector4& a, const Vector4& b) { + return a.dot(b); +} + +inline Vector2 normalize(const Vector2& v) { + return v / v.length(); +} + +inline Vector3 normalize(const Vector3& v) { + return v / v.magnitude(); +} + +inline Vector4 normalize(const Vector4& v) { + return v / v.length(); +} + +inline Vector2 abs(const Vector2& v) { + return Vector2(::fabsf(v.x), ::fabsf(v.y)); +} + +inline Vector3 abs(const Vector3& v) { + return Vector3(::fabsf(v.x), ::fabsf(v.y), ::fabsf(v.z)); +} + +inline Vector4 abs(const Vector4& v) { + return Vector4(::fabsf(v.x), ::fabsf(v.y), ::fabsf(v.z), ::fabsf(v.w)); +} + +inline bool all(const Vector2& v) { + return (v.x != 0) && (v.y != 0); +} + +inline bool all(const Vector3& v) { + return (v.x != 0) && (v.y != 0) && (v.z != 0); +} + +inline bool all(const Vector4& v) { + return (v.x != 0) && (v.y != 0) && (v.z != 0) && (v.w != 0); +} + +inline bool any(const Vector2& v) { + return (v.x != 0) || (v.y != 0); +} + +inline bool any(const Vector3& v) { + return (v.x != 0) || (v.y != 0) || (v.z != 0); +} + +inline bool any(const Vector4& v) { + return (v.x != 0) || (v.y != 0) || (v.z != 0) || (v.w != 0); +} + +inline Vector2 clamp(const Vector2& v, const Vector2& a, const Vector2& b) { + return v.clamp(a, b); +} + +inline Vector3 clamp(const Vector3& v, const Vector3& a, const Vector3& b) { + return v.clamp(a, b); +} + +inline Vector4 clamp(const Vector4& v, const Vector4& a, const Vector4& b) { + return v.clamp(a, b); +} + +inline Vector2 lerp(const Vector2& v1, const Vector2& v2, float f) { + return v1.lerp(v2, f); +} + +inline Vector3 lerp(const Vector3& v1, const Vector3& v2, float f) { + return v1.lerp(v2, f); +} + +inline Vector4 lerp(const Vector4& v1, const Vector4& v2, float f) { + return v1.lerp(v2, f); +} + +inline Color1 lerp(const Color1& v1, const Color1& v2, float f) { + return v1.lerp(v2, f); +} + +inline Color3 lerp(const Color3& v1, const Color3& v2, float f) { + return v1.lerp(v2, f); +} + +inline Color4 lerp(const Color4& v1, const Color4& v2, float f) { + return v1.lerp(v2, f); +} + +inline Vector3 cross(const Vector3& v1, const Vector3& v2) { + return v1.cross(v2); +} + +inline double determinant(const Matrix3& m) { + return m.determinant(); +} + +inline double determinant(const Matrix4& m) { + return m.determinant(); +} + +inline Vector2 min(const Vector2& v1, const Vector2& v2) { + return v1.min(v2); +} + +inline Vector3 min(const Vector3& v1, const Vector3& v2) { + return v1.min(v2); +} + +inline Vector4 min(const Vector4& v1, const Vector4& v2) { + return v1.min(v2); +} + +inline Color3 min(const Color3& v1, const Color3& v2) { + return v1.min(v2); +} + +inline Color4 min(const Color4& v1, const Color4& v2) { + return v1.min(v2); +} + +inline Vector2 max(const Vector2& v1, const Vector2& v2) { + return v1.max(v2); +} + +inline Vector3 max(const Vector3& v1, const Vector3& v2) { + return v1.max(v2); +} + +inline Vector4 max(const Vector4& v1, const Vector4& v2) { + return v1.max(v2); +} + +inline Color3 max(const Color3& v1, const Color3& v2) { + return v1.max(v2); +} + +inline Color4 max(const Color4& v1, const Color4& v2) { + return v1.max(v2); +} + +inline Vector2 sign(const Vector2& v) { + return Vector2((float)sign(v.x), (float)sign(v.y)); +} + +inline Vector3 sign(const Vector3& v) { + return Vector3((float)sign(v.x), (float)sign(v.y), (float)sign(v.z)); +} + +inline Vector4 sign(const Vector4& v) { + return Vector4((float)sign(v.x), (float)sign(v.y), (float)sign(v.z), (float)sign(v.w)); +} + +inline float length(float v) { + return ::fabsf(v); +} + +inline float length(const Vector2& v) { + return v.length(); +} + +inline float length(const Vector3& v) { + return v.magnitude(); +} + +inline float length(const Vector4& v) { + return v.length(); +} + +/** + Computes the log of each component. Useful for + inverting the monitor gamma function or simulating + perceptual response. + */ +inline Color3 log(const Color3& c) { + return Color3(::logf(c.r), ::logf(c.g), ::logf(c.b)); +} + +} + +#endif diff --git a/externals/g3dlite/Line.cpp b/externals/g3dlite/Line.cpp new file mode 100644 index 0000000..195ae71 --- /dev/null +++ b/externals/g3dlite/Line.cpp @@ -0,0 +1,89 @@ +/** + @file Line.cpp + + Line class + + @maintainer Morgan McGuire, graphics3d.com + + @created 2001-06-02 + @edited 2006-01-28 + */ + +#include "G3D/Line.h" +#include "G3D/Plane.h" + +namespace G3D { + +Vector3 Line::intersection(const Plane& plane) const { + float d; + Vector3 normal = plane.normal(); + plane.getEquation(normal, d); + float rate = _direction.dot(normal); + + if (rate == 0) { + + return Vector3::inf(); + + } else { + float t = -(d + _point.dot(normal)) / rate; + + return _point + _direction * t; + } +} + + +Line::Line(class BinaryInput& b) { + deserialize(b); +} + + +void Line::serialize(class BinaryOutput& b) const { + _point.serialize(b); + _direction.serialize(b); +} + + +void Line::deserialize(class BinaryInput& b) { + _point.deserialize(b); + _direction.deserialize(b); +} + + +Vector3 Line::closestPoint(const Vector3& pt) const { + float t = _direction.dot(pt - _point); + return _point + _direction * t; +} + + +Vector3 Line::point() const { + return _point; +} + + +Vector3 Line::direction() const { + return _direction; +} + + +Vector3 Line::closestPoint(const Line& B, float& minDist) const { + const Vector3& P1 = _point; + const Vector3& U1 = _direction; + + Vector3 P2 = B.point(); + Vector3 U2 = B.direction(); + + const Vector3& P21 = P2 - P1; + const Vector3& M = U2.cross(U1); + float m2 = M.length(); + + Vector3 R = P21.cross(M) / m2; + + float t1 = R.dot(U2); + + minDist = abs(P21.dot(M)) / sqrt(m2); + + return P1 + t1 * U1; +} + +} + diff --git a/externals/g3dlite/LineSegment.cpp b/externals/g3dlite/LineSegment.cpp new file mode 100644 index 0000000..754600a --- /dev/null +++ b/externals/g3dlite/LineSegment.cpp @@ -0,0 +1,236 @@ +/** + @file LineSegment.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-02-08 + @edited 2008-02-02 + */ + +#include "G3D/platform.h" +#include "G3D/LineSegment.h" +#include "G3D/Sphere.h" +#include "G3D/debug.h" + +namespace G3D { + + +Vector3 LineSegment::closestPoint(const Vector3& p) const { + + // The vector from the end of the capsule to the point in question. + Vector3 v(p - _point); + + // Projection of v onto the line segment scaled by + // the length of direction. + float t = direction.dot(v); + + // Avoid some square roots. Derivation: + // t/direction.length() <= direction.length() + // t <= direction.squaredLength() + + if ((t >= 0) && (t <= direction.squaredMagnitude())) { + + // The point falls within the segment. Normalize direction, + // divide t by the length of direction. + return _point + direction * t / direction.squaredMagnitude(); + + } else { + + // The point does not fall within the segment; see which end is closer. + + // Distance from 0, squared + float d0Squared = v.squaredMagnitude(); + + // Distance from 1, squared + float d1Squared = (v - direction).squaredMagnitude(); + + if (d0Squared < d1Squared) { + + // Point 0 is closer + return _point; + + } else { + + // Point 1 is closer + return _point + direction; + + } + } + +} + +Vector3 LineSegment::point(int i) const { + switch (i) { + case 0: + return _point; + + case 1: + return _point + direction; + + default: + debugAssertM(i == 0 || i == 1, "Argument to point must be 0 or 1"); + return _point; + } +} + + +bool LineSegment::intersectsSolidSphere(const class Sphere& s) const { + return distanceSquared(s.center) <= square(s.radius); +} + + +LineSegment::LineSegment(class BinaryInput& b) { + deserialize(b); +} + + +void LineSegment::serialize(class BinaryOutput& b) const { + _point.serialize(b); + direction.serialize(b); +} + + +void LineSegment::deserialize(class BinaryInput& b) { + _point.deserialize(b); + direction.deserialize(b); +} + + +Vector3 LineSegment::randomPoint() const { + return _point + uniformRandom(0, 1) * direction; +} + + +///////////////////////////////////////////////////////////////////////////////////// + +LineSegment2D LineSegment2D::fromTwoPoints(const Vector2& p0, const Vector2& p1) { + LineSegment2D s; + s.m_origin = p0; + s.m_direction = p1 - p0; + s.m_length = s.m_direction.length(); + return s; +} + + +Vector2 LineSegment2D::point(int i) const { + debugAssert(i == 0 || i == 1); + if (i == 0) { + return m_origin; + } else { + return m_direction + m_origin; + } +} + + +Vector2 LineSegment2D::closestPoint(const Vector2& Q) const { + // Two constants that appear in the result + const Vector2 k1(m_origin - Q); + const Vector2& k2 = m_direction; + + if (fuzzyEq(m_length, 0)) { + // This line segment has no length + return m_origin; + } + + // Time [0, 1] at which we hit the closest point travelling from p0 to p1. + // Derivation can be obtained by minimizing the expression + // ||P0 + (P1 - P0)t - Q||. + const float t = -k1.dot(k2) / (m_length * m_length); + + if (t < 0) { + // Clipped to low end point + return m_origin; + } else if (t > 1) { + // Clipped to high end point + return m_origin + m_direction; + } else { + // Subsitute into the line equation to find + // the point on the segment. + return m_origin + k2 * t; + } +} + + +float LineSegment2D::distance(const Vector2& p) const { + Vector2 closest = closestPoint(p); + return (closest - p).length(); +} + + +float LineSegment2D::length() const { + return m_length; +} + + +Vector2 LineSegment2D::intersection(const LineSegment2D& other) const { + + if ((m_origin == other.m_origin) || + (m_origin == other.m_origin + other.m_direction)) { + return m_origin; + } + + if (m_origin + m_direction == other.m_origin) { + return other.m_origin; + } + + // Note: Now that we've checked the endpoints, all other parallel lines can now be assumed + // to not intersect (within numerical precision) + + Vector2 dir1 = m_direction; + Vector2 dir2 = other.m_direction; + Vector2 origin1 = m_origin; + Vector2 origin2 = other.m_origin; + + if (dir1.x == 0) { + // Avoid an upcoming divide by zero + dir1 = dir1.yx(); + dir2 = dir2.yx(); + origin1 = origin1.yx(); + origin2 = origin2.yx(); + } + + // t1 = ((other.m_origin.x - m_origin.x) + other.m_direction.x * t2) / m_direction.x + // + // ((other.m_origin.x - m_origin.x) + other.m_direction.x * t2) * m_direction.y / m_direction.x = + // (other.m_origin.y - m_origin.y) + other.m_direction.y * t2 + // + // m = m_direction.y / m_direction.x + // d = other.m_origin - m_origin + // + // (d.x + other.m_direction.x * t2) * m = d.y + other.m_direction.y * t2 + // + // d.x * m + other.m_direction.x * m * t2 = d.y + other.m_direction.y * t2 + // + // d.x * m - d.y = (other.m_direction.y - other.m_direction.x * m) * t2 + // + // (d.x * m - d.y) / (other.m_direction.y - other.m_direction.x * m) = t2 + // + + Vector2 d = origin2 - origin1; + float m = dir1.y / dir1.x; + + float t2 = (d.x * m - d.y) / (dir2.y - dir2.x * m); + if (! isFinite(t2)) { + // Parallel lines: no intersection + return Vector2::inf(); + } + + if ((t2 < 0.0f) || (t2 > 1.0f)) { + // Intersection occurs past the end of the line segments + return Vector2::inf(); + } + + float t1 = (d.x + dir2.x * t2) / dir1.x; + if ((t1 < 0.0f) || (t1 > 1.0f)) { + // Intersection occurs past the end of the line segments + return Vector2::inf(); + } + + // Return the intersection point (computed from non-transposed + // variables even if we flipped above) + return m_origin + m_direction * t1; + +} + +} + diff --git a/externals/g3dlite/Log.cpp b/externals/g3dlite/Log.cpp new file mode 100644 index 0000000..07614fc --- /dev/null +++ b/externals/g3dlite/Log.cpp @@ -0,0 +1,146 @@ +/** + @file Log.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2001-08-04 + @edited 2009-01-15 + */ + +#include "G3D/platform.h" +#include "G3D/Log.h" +#include "G3D/format.h" +#include "G3D/Array.h" +#include "G3D/fileutils.h" +#include + +#ifdef G3D_WIN32 + #include +#else + #include +#endif + +namespace G3D { + +void logPrintf(const char* fmt, ...) { + va_list arg_list; + va_start(arg_list, fmt); + Log::common()->vprintf(fmt, arg_list); + va_end(arg_list); +} + + +void logLazyPrintf(const char* fmt, ...) { + va_list arg_list; + va_start(arg_list, fmt); + Log::common()->lazyvprintf(fmt, arg_list); + va_end(arg_list); +} + +Log* Log::commonLog = NULL; + +Log::Log(const std::string& filename, int stripFromStackBottom) : + stripFromStackBottom(stripFromStackBottom) { + + this->filename = filename; + + logFile = fopen(filename.c_str(), "w"); + + if (logFile == NULL) { + std::string drive, base, ext; + Array path; + parseFilename(filename, drive, path, base, ext); + std::string logName = base + ((ext != "") ? ("." + ext) : ""); + + // Write time is greater than 1ms. This may be a network drive.... try another file. + #ifdef G3D_WIN32 + logName = std::string(std::getenv("TEMP")) + logName; + #else + logName = std::string("/tmp/") + logName; + #endif + + logFile = fopen(logName.c_str(), "w"); + } + + // Use a large buffer (although we flush in logPrintf) + setvbuf(logFile, NULL, _IOFBF, 2048); + + fprintf(logFile, "Application Log\n"); + time_t t; + time(&t); + fprintf(logFile, "Start: %s\n", ctime(&t)); + fflush(logFile); + + if (commonLog == NULL) { + commonLog = this; + } +} + + +Log::~Log() { + section("Shutdown"); + println("Closing log file"); + + // Make sure we don't leave a dangling pointer + if (Log::commonLog == this) { + Log::commonLog = NULL; + } + + fclose(logFile); +} + + +FILE* Log::getFile() const { + return logFile; +} + + +Log* Log::common() { + if (commonLog == NULL) { + commonLog = new Log(); + } + return commonLog; +} + + +std::string Log::getCommonLogFilename() { + return common()->filename; +} + + +void Log::section(const std::string& s) { + fprintf(logFile, "_____________________________________________________\n"); + fprintf(logFile, "\n ### %s ###\n\n", s.c_str()); +} + + +void __cdecl Log::printf(const char* fmt, ...) { + va_list arg_list; + va_start(arg_list, fmt); + print(vformat(fmt, arg_list)); + va_end(arg_list); +} + + +void __cdecl Log::vprintf(const char* fmt, va_list argPtr) { + vfprintf(logFile, fmt, argPtr); + fflush(logFile); +} + + +void __cdecl Log::lazyvprintf(const char* fmt, va_list argPtr) { + vfprintf(logFile, fmt, argPtr); +} + + +void Log::print(const std::string& s) { + fprintf(logFile, "%s", s.c_str()); + fflush(logFile); +} + + +void Log::println(const std::string& s) { + fprintf(logFile, "%s\n", s.c_str()); + fflush(logFile); +} + +} diff --git a/externals/g3dlite/Matrix3.cpp b/externals/g3dlite/Matrix3.cpp new file mode 100644 index 0000000..b32d938 --- /dev/null +++ b/externals/g3dlite/Matrix3.cpp @@ -0,0 +1,1927 @@ +/** + @file Matrix3.cpp + + 3x3 matrix class + + @author Morgan McGuire, graphics3d.com + + @created 2001-06-02 + @edited 2009-11-15 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. +*/ + +#include "G3D/platform.h" +#include +#include +#include "G3D/Matrix3.h" +#include "G3D/g3dmath.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/Quat.h" +#include "G3D/Any.h" + +namespace G3D { + +const float Matrix3::EPSILON = 1e-06f; + +Matrix3::Matrix3(const Any& any) { + any.verifyName("Matrix3"); + any.verifyType(Any::ARRAY); + any.verifySize(9); + + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 3; ++c) { + elt[r][c] = any[r * 3 + c]; + } + } +} + + +Matrix3::operator Any() const { + Any any(Any::ARRAY, "Matrix3"); + any.resize(9); + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 3; ++c) { + any[r * 3 + c] = elt[r][c]; + } + } + + return any; +} + +const Matrix3& Matrix3::zero() { + static Matrix3 m(0, 0, 0, 0, 0, 0, 0, 0, 0); + return m; +} + +const Matrix3& Matrix3::identity() { + static Matrix3 m(1, 0, 0, 0, 1, 0, 0, 0, 1); + return m; +} + + +const float Matrix3::ms_fSvdEpsilon = 1e-04f; +const int Matrix3::ms_iSvdMaxIterations = 32; + +Matrix3::Matrix3(BinaryInput& b) { + deserialize(b); +} + +bool Matrix3::fuzzyEq(const Matrix3& b) const { + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 3; ++c) { + if (! G3D::fuzzyEq(elt[r][c], b[r][c])) { + return false; + } + } + } + return true; +} + + +bool Matrix3::isRightHanded() const{ + + const Vector3& X = column(0); + const Vector3& Y = column(1); + const Vector3& Z = column(2); + + const Vector3& W = X.cross(Y); + + return W.dot(Z) > 0.0f; +} + + +bool Matrix3::isOrthonormal() const { + const Vector3& X = column(0); + const Vector3& Y = column(1); + const Vector3& Z = column(2); + + return + (G3D::fuzzyEq(X.dot(Y), 0.0f) && + G3D::fuzzyEq(Y.dot(Z), 0.0f) && + G3D::fuzzyEq(X.dot(Z), 0.0f) && + G3D::fuzzyEq(X.squaredMagnitude(), 1.0f) && + G3D::fuzzyEq(Y.squaredMagnitude(), 1.0f) && + G3D::fuzzyEq(Z.squaredMagnitude(), 1.0f)); +} + +//---------------------------------------------------------------------------- +Matrix3::Matrix3(const Quat& _q) { + // Implementation from Watt and Watt, pg 362 + // See also http://www.flipcode.com/documents/matrfaq.html#Q54 + Quat q = _q; + q.unitize(); + float xx = 2.0f * q.x * q.x; + float xy = 2.0f * q.x * q.y; + float xz = 2.0f * q.x * q.z; + float xw = 2.0f * q.x * q.w; + + float yy = 2.0f * q.y * q.y; + float yz = 2.0f * q.y * q.z; + float yw = 2.0f * q.y * q.w; + + float zz = 2.0f * q.z * q.z; + float zw = 2.0f * q.z * q.w; + + set(1.0f - yy - zz, xy - zw, xz + yw, + xy + zw, 1.0f - xx - zz, yz - xw, + xz - yw, yz + xw, 1.0f - xx - yy); +} + +//---------------------------------------------------------------------------- + +Matrix3::Matrix3 (const float aafEntry[3][3]) { + memcpy(elt, aafEntry, 9*sizeof(float)); +} + +//---------------------------------------------------------------------------- +Matrix3::Matrix3 (const Matrix3& rkMatrix) { + memcpy(elt, rkMatrix.elt, 9*sizeof(float)); +} + +//---------------------------------------------------------------------------- +Matrix3::Matrix3( + float fEntry00, float fEntry01, float fEntry02, + float fEntry10, float fEntry11, float fEntry12, + float fEntry20, float fEntry21, float fEntry22) { + set(fEntry00, fEntry01, fEntry02, + fEntry10, fEntry11, fEntry12, + fEntry20, fEntry21, fEntry22); +} + +void Matrix3::set( + float fEntry00, float fEntry01, float fEntry02, + float fEntry10, float fEntry11, float fEntry12, + float fEntry20, float fEntry21, float fEntry22) { + + elt[0][0] = fEntry00; + elt[0][1] = fEntry01; + elt[0][2] = fEntry02; + elt[1][0] = fEntry10; + elt[1][1] = fEntry11; + elt[1][2] = fEntry12; + elt[2][0] = fEntry20; + elt[2][1] = fEntry21; + elt[2][2] = fEntry22; +} + + +void Matrix3::deserialize(BinaryInput& b) { + int r,c; + for (c = 0; c < 3; ++c) { + for (r = 0; r < 3; ++r) { + elt[r][c] = b.readFloat32(); + } + } +} + + +void Matrix3::serialize(BinaryOutput& b) const { + int r,c; + for (c = 0; c < 3; ++c) { + for (r = 0; r < 3; ++r) { + b.writeFloat32(elt[r][c]); + } + } +} + + +//---------------------------------------------------------------------------- +Vector3 Matrix3::column (int iCol) const { + assert((0 <= iCol) && (iCol < 3)); + return Vector3(elt[0][iCol], elt[1][iCol], + elt[2][iCol]); +} + + +const Vector3& Matrix3::row (int iRow) const { + assert((0 <= iRow) && (iRow < 3)); + return *reinterpret_cast(elt[iRow]); +} + + +void Matrix3::setColumn(int iCol, const Vector3 &vector) { + debugAssert((iCol >= 0) && (iCol < 3)); + elt[0][iCol] = vector.x; + elt[1][iCol] = vector.y; + elt[2][iCol] = vector.z; +} + + +void Matrix3::setRow(int iRow, const Vector3 &vector) { + debugAssert((iRow >= 0) && (iRow < 3)); + elt[iRow][0] = vector.x; + elt[iRow][1] = vector.y; + elt[iRow][2] = vector.z; +} + + +//---------------------------------------------------------------------------- +bool Matrix3::operator== (const Matrix3& rkMatrix) const { + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + if ( elt[iRow][iCol] != rkMatrix.elt[iRow][iCol] ) + return false; + } + } + + return true; +} + +//---------------------------------------------------------------------------- +bool Matrix3::operator!= (const Matrix3& rkMatrix) const { + return !operator==(rkMatrix); +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::operator+ (const Matrix3& rkMatrix) const { + Matrix3 kSum; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + kSum.elt[iRow][iCol] = elt[iRow][iCol] + + rkMatrix.elt[iRow][iCol]; + } + } + + return kSum; +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::operator- (const Matrix3& rkMatrix) const { + Matrix3 kDiff; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + kDiff.elt[iRow][iCol] = elt[iRow][iCol] - + rkMatrix.elt[iRow][iCol]; + } + } + + return kDiff; +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::operator* (const Matrix3& rkMatrix) const { + Matrix3 kProd; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + kProd.elt[iRow][iCol] = + elt[iRow][0] * rkMatrix.elt[0][iCol] + + elt[iRow][1] * rkMatrix.elt[1][iCol] + + elt[iRow][2] * rkMatrix.elt[2][iCol]; + } + } + + return kProd; +} + +Matrix3& Matrix3::operator+= (const Matrix3& rkMatrix) { + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + elt[iRow][iCol] = elt[iRow][iCol] + rkMatrix.elt[iRow][iCol]; + } + } + + return *this; +} + +Matrix3& Matrix3::operator-= (const Matrix3& rkMatrix) { + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + elt[iRow][iCol] = elt[iRow][iCol] - rkMatrix.elt[iRow][iCol]; + } + } + + return *this; +} + +Matrix3& Matrix3::operator*= (const Matrix3& rkMatrix) { + Matrix3 mulMat; + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + mulMat.elt[iRow][iCol] = + elt[iRow][0] * rkMatrix.elt[0][iCol] + + elt[iRow][1] * rkMatrix.elt[1][iCol] + + elt[iRow][2] * rkMatrix.elt[2][iCol]; + } + } + + *this = mulMat; + return *this; +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::operator- () const { + Matrix3 kNeg; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + kNeg[iRow][iCol] = -elt[iRow][iCol]; + } + } + + return kNeg; +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::operator* (float fScalar) const { + Matrix3 kProd; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + kProd[iRow][iCol] = fScalar * elt[iRow][iCol]; + } + } + + return kProd; +} + +Matrix3& Matrix3::operator/= (float fScalar) { + return *this *= (1.0f / fScalar); +} + +Matrix3& Matrix3::operator*= (float fScalar) { + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + elt[iRow][iCol] *= fScalar; + } + } + + return *this; +} + +//---------------------------------------------------------------------------- +Matrix3 operator* (double fScalar, const Matrix3& rkMatrix) { + Matrix3 kProd; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + kProd[iRow][iCol] = fScalar * rkMatrix.elt[iRow][iCol]; + } + } + + return kProd; +} + +Matrix3 operator* (float fScalar, const Matrix3& rkMatrix) { + return (double)fScalar * rkMatrix; +} + + +Matrix3 operator* (int fScalar, const Matrix3& rkMatrix) { + return (double)fScalar * rkMatrix; +} +//---------------------------------------------------------------------------- +Matrix3 Matrix3::transpose () const { + Matrix3 kTranspose; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + kTranspose[iRow][iCol] = elt[iCol][iRow]; + } + } + + return kTranspose; +} + +//---------------------------------------------------------------------------- +bool Matrix3::inverse (Matrix3& rkInverse, float fTolerance) const { + // Invert a 3x3 using cofactors. This is about 8 times faster than + // the Numerical Recipes code which uses Gaussian elimination. + + rkInverse[0][0] = elt[1][1] * elt[2][2] - + elt[1][2] * elt[2][1]; + rkInverse[0][1] = elt[0][2] * elt[2][1] - + elt[0][1] * elt[2][2]; + rkInverse[0][2] = elt[0][1] * elt[1][2] - + elt[0][2] * elt[1][1]; + rkInverse[1][0] = elt[1][2] * elt[2][0] - + elt[1][0] * elt[2][2]; + rkInverse[1][1] = elt[0][0] * elt[2][2] - + elt[0][2] * elt[2][0]; + rkInverse[1][2] = elt[0][2] * elt[1][0] - + elt[0][0] * elt[1][2]; + rkInverse[2][0] = elt[1][0] * elt[2][1] - + elt[1][1] * elt[2][0]; + rkInverse[2][1] = elt[0][1] * elt[2][0] - + elt[0][0] * elt[2][1]; + rkInverse[2][2] = elt[0][0] * elt[1][1] - + elt[0][1] * elt[1][0]; + + float fDet = + elt[0][0] * rkInverse[0][0] + + elt[0][1] * rkInverse[1][0] + + elt[0][2] * rkInverse[2][0]; + + if ( G3D::abs(fDet) <= fTolerance ) + return false; + + float fInvDet = 1.0 / fDet; + + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) + rkInverse[iRow][iCol] *= fInvDet; + } + + return true; +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::inverse (float fTolerance) const { + Matrix3 kInverse = Matrix3::zero(); + inverse(kInverse, fTolerance); + return kInverse; +} + +//---------------------------------------------------------------------------- +float Matrix3::determinant () const { + float fCofactor00 = elt[1][1] * elt[2][2] - + elt[1][2] * elt[2][1]; + float fCofactor10 = elt[1][2] * elt[2][0] - + elt[1][0] * elt[2][2]; + float fCofactor20 = elt[1][0] * elt[2][1] - + elt[1][1] * elt[2][0]; + + float fDet = + elt[0][0] * fCofactor00 + + elt[0][1] * fCofactor10 + + elt[0][2] * fCofactor20; + + return fDet; +} + +//---------------------------------------------------------------------------- +void Matrix3::bidiagonalize (Matrix3& kA, Matrix3& kL, + Matrix3& kR) { + float afV[3], afW[3]; + float fLength, fSign, fT1, fInvT1, fT2; + bool bIdentity; + + // map first column to (*,0,0) + fLength = sqrt(kA[0][0] * kA[0][0] + kA[1][0] * kA[1][0] + + kA[2][0] * kA[2][0]); + + if ( fLength > 0.0 ) { + fSign = (kA[0][0] > 0.0 ? 1.0 : -1.0); + fT1 = kA[0][0] + fSign * fLength; + fInvT1 = 1.0 / fT1; + afV[1] = kA[1][0] * fInvT1; + afV[2] = kA[2][0] * fInvT1; + + fT2 = -2.0 / (1.0 + afV[1] * afV[1] + afV[2] * afV[2]); + afW[0] = fT2 * (kA[0][0] + kA[1][0] * afV[1] + kA[2][0] * afV[2]); + afW[1] = fT2 * (kA[0][1] + kA[1][1] * afV[1] + kA[2][1] * afV[2]); + afW[2] = fT2 * (kA[0][2] + kA[1][2] * afV[1] + kA[2][2] * afV[2]); + kA[0][0] += afW[0]; + kA[0][1] += afW[1]; + kA[0][2] += afW[2]; + kA[1][1] += afV[1] * afW[1]; + kA[1][2] += afV[1] * afW[2]; + kA[2][1] += afV[2] * afW[1]; + kA[2][2] += afV[2] * afW[2]; + + kL[0][0] = 1.0 + fT2; + kL[0][1] = kL[1][0] = fT2 * afV[1]; + kL[0][2] = kL[2][0] = fT2 * afV[2]; + kL[1][1] = 1.0 + fT2 * afV[1] * afV[1]; + kL[1][2] = kL[2][1] = fT2 * afV[1] * afV[2]; + kL[2][2] = 1.0 + fT2 * afV[2] * afV[2]; + bIdentity = false; + } else { + kL = Matrix3::identity(); + bIdentity = true; + } + + // map first row to (*,*,0) + fLength = sqrt(kA[0][1] * kA[0][1] + kA[0][2] * kA[0][2]); + + if ( fLength > 0.0 ) { + fSign = (kA[0][1] > 0.0 ? 1.0 : -1.0); + fT1 = kA[0][1] + fSign * fLength; + afV[2] = kA[0][2] / fT1; + + fT2 = -2.0 / (1.0 + afV[2] * afV[2]); + afW[0] = fT2 * (kA[0][1] + kA[0][2] * afV[2]); + afW[1] = fT2 * (kA[1][1] + kA[1][2] * afV[2]); + afW[2] = fT2 * (kA[2][1] + kA[2][2] * afV[2]); + kA[0][1] += afW[0]; + kA[1][1] += afW[1]; + kA[1][2] += afW[1] * afV[2]; + kA[2][1] += afW[2]; + kA[2][2] += afW[2] * afV[2]; + + kR[0][0] = 1.0; + kR[0][1] = kR[1][0] = 0.0; + kR[0][2] = kR[2][0] = 0.0; + kR[1][1] = 1.0 + fT2; + kR[1][2] = kR[2][1] = fT2 * afV[2]; + kR[2][2] = 1.0 + fT2 * afV[2] * afV[2]; + } else { + kR = Matrix3::identity(); + } + + // map second column to (*,*,0) + fLength = sqrt(kA[1][1] * kA[1][1] + kA[2][1] * kA[2][1]); + + if ( fLength > 0.0 ) { + fSign = (kA[1][1] > 0.0 ? 1.0 : -1.0); + fT1 = kA[1][1] + fSign * fLength; + afV[2] = kA[2][1] / fT1; + + fT2 = -2.0 / (1.0 + afV[2] * afV[2]); + afW[1] = fT2 * (kA[1][1] + kA[2][1] * afV[2]); + afW[2] = fT2 * (kA[1][2] + kA[2][2] * afV[2]); + kA[1][1] += afW[1]; + kA[1][2] += afW[2]; + kA[2][2] += afV[2] * afW[2]; + + float fA = 1.0 + fT2; + float fB = fT2 * afV[2]; + float fC = 1.0 + fB * afV[2]; + + if ( bIdentity ) { + kL[0][0] = 1.0; + kL[0][1] = kL[1][0] = 0.0; + kL[0][2] = kL[2][0] = 0.0; + kL[1][1] = fA; + kL[1][2] = kL[2][1] = fB; + kL[2][2] = fC; + } else { + for (int iRow = 0; iRow < 3; iRow++) { + float fTmp0 = kL[iRow][1]; + float fTmp1 = kL[iRow][2]; + kL[iRow][1] = fA * fTmp0 + fB * fTmp1; + kL[iRow][2] = fB * fTmp0 + fC * fTmp1; + } + } + } +} + +//---------------------------------------------------------------------------- +void Matrix3::golubKahanStep (Matrix3& kA, Matrix3& kL, + Matrix3& kR) { + float fT11 = kA[0][1] * kA[0][1] + kA[1][1] * kA[1][1]; + float fT22 = kA[1][2] * kA[1][2] + kA[2][2] * kA[2][2]; + float fT12 = kA[1][1] * kA[1][2]; + float fTrace = fT11 + fT22; + float fDiff = fT11 - fT22; + float fDiscr = sqrt(fDiff * fDiff + 4.0 * fT12 * fT12); + float fRoot1 = 0.5 * (fTrace + fDiscr); + float fRoot2 = 0.5 * (fTrace - fDiscr); + + // adjust right + float fY = kA[0][0] - (G3D::abs(fRoot1 - fT22) <= + G3D::abs(fRoot2 - fT22) ? fRoot1 : fRoot2); + float fZ = kA[0][1]; + float fInvLength = 1.0 / sqrt(fY * fY + fZ * fZ); + float fSin = fZ * fInvLength; + float fCos = -fY * fInvLength; + + float fTmp0 = kA[0][0]; + float fTmp1 = kA[0][1]; + kA[0][0] = fCos * fTmp0 - fSin * fTmp1; + kA[0][1] = fSin * fTmp0 + fCos * fTmp1; + kA[1][0] = -fSin * kA[1][1]; + kA[1][1] *= fCos; + + int iRow; + + for (iRow = 0; iRow < 3; iRow++) { + fTmp0 = kR[0][iRow]; + fTmp1 = kR[1][iRow]; + kR[0][iRow] = fCos * fTmp0 - fSin * fTmp1; + kR[1][iRow] = fSin * fTmp0 + fCos * fTmp1; + } + + // adjust left + fY = kA[0][0]; + + fZ = kA[1][0]; + + fInvLength = 1.0 / sqrt(fY * fY + fZ * fZ); + + fSin = fZ * fInvLength; + + fCos = -fY * fInvLength; + + kA[0][0] = fCos * kA[0][0] - fSin * kA[1][0]; + + fTmp0 = kA[0][1]; + + fTmp1 = kA[1][1]; + + kA[0][1] = fCos * fTmp0 - fSin * fTmp1; + + kA[1][1] = fSin * fTmp0 + fCos * fTmp1; + + kA[0][2] = -fSin * kA[1][2]; + + kA[1][2] *= fCos; + + int iCol; + + for (iCol = 0; iCol < 3; iCol++) { + fTmp0 = kL[iCol][0]; + fTmp1 = kL[iCol][1]; + kL[iCol][0] = fCos * fTmp0 - fSin * fTmp1; + kL[iCol][1] = fSin * fTmp0 + fCos * fTmp1; + } + + // adjust right + fY = kA[0][1]; + + fZ = kA[0][2]; + + fInvLength = 1.0 / sqrt(fY * fY + fZ * fZ); + + fSin = fZ * fInvLength; + + fCos = -fY * fInvLength; + + kA[0][1] = fCos * kA[0][1] - fSin * kA[0][2]; + + fTmp0 = kA[1][1]; + + fTmp1 = kA[1][2]; + + kA[1][1] = fCos * fTmp0 - fSin * fTmp1; + + kA[1][2] = fSin * fTmp0 + fCos * fTmp1; + + kA[2][1] = -fSin * kA[2][2]; + + kA[2][2] *= fCos; + + for (iRow = 0; iRow < 3; iRow++) { + fTmp0 = kR[1][iRow]; + fTmp1 = kR[2][iRow]; + kR[1][iRow] = fCos * fTmp0 - fSin * fTmp1; + kR[2][iRow] = fSin * fTmp0 + fCos * fTmp1; + } + + // adjust left + fY = kA[1][1]; + + fZ = kA[2][1]; + + fInvLength = 1.0 / sqrt(fY * fY + fZ * fZ); + + fSin = fZ * fInvLength; + + fCos = -fY * fInvLength; + + kA[1][1] = fCos * kA[1][1] - fSin * kA[2][1]; + + fTmp0 = kA[1][2]; + + fTmp1 = kA[2][2]; + + kA[1][2] = fCos * fTmp0 - fSin * fTmp1; + + kA[2][2] = fSin * fTmp0 + fCos * fTmp1; + + for (iCol = 0; iCol < 3; iCol++) { + fTmp0 = kL[iCol][1]; + fTmp1 = kL[iCol][2]; + kL[iCol][1] = fCos * fTmp0 - fSin * fTmp1; + kL[iCol][2] = fSin * fTmp0 + fCos * fTmp1; + } +} + +//---------------------------------------------------------------------------- +void Matrix3::singularValueDecomposition (Matrix3& kL, Vector3& kS, + Matrix3& kR) const { + int iRow, iCol; + + Matrix3 kA = *this; + bidiagonalize(kA, kL, kR); + + for (int i = 0; i < ms_iSvdMaxIterations; i++) { + float fTmp, fTmp0, fTmp1; + float fSin0, fCos0, fTan0; + float fSin1, fCos1, fTan1; + + bool bTest1 = (G3D::abs(kA[0][1]) <= + ms_fSvdEpsilon * (G3D::abs(kA[0][0]) + G3D::abs(kA[1][1]))); + bool bTest2 = (G3D::abs(kA[1][2]) <= + ms_fSvdEpsilon * (G3D::abs(kA[1][1]) + G3D::abs(kA[2][2]))); + + if ( bTest1 ) { + if ( bTest2 ) { + kS[0] = kA[0][0]; + kS[1] = kA[1][1]; + kS[2] = kA[2][2]; + break; + } else { + // 2x2 closed form factorization + fTmp = (kA[1][1] * kA[1][1] - kA[2][2] * kA[2][2] + + kA[1][2] * kA[1][2]) / (kA[1][2] * kA[2][2]); + fTan0 = 0.5 * (fTmp + sqrt(fTmp * fTmp + 4.0)); + fCos0 = 1.0 / sqrt(1.0 + fTan0 * fTan0); + fSin0 = fTan0 * fCos0; + + for (iCol = 0; iCol < 3; iCol++) { + fTmp0 = kL[iCol][1]; + fTmp1 = kL[iCol][2]; + kL[iCol][1] = fCos0 * fTmp0 - fSin0 * fTmp1; + kL[iCol][2] = fSin0 * fTmp0 + fCos0 * fTmp1; + } + + fTan1 = (kA[1][2] - kA[2][2] * fTan0) / kA[1][1]; + fCos1 = 1.0 / sqrt(1.0 + fTan1 * fTan1); + fSin1 = -fTan1 * fCos1; + + for (iRow = 0; iRow < 3; iRow++) { + fTmp0 = kR[1][iRow]; + fTmp1 = kR[2][iRow]; + kR[1][iRow] = fCos1 * fTmp0 - fSin1 * fTmp1; + kR[2][iRow] = fSin1 * fTmp0 + fCos1 * fTmp1; + } + + kS[0] = kA[0][0]; + kS[1] = fCos0 * fCos1 * kA[1][1] - + fSin1 * (fCos0 * kA[1][2] - fSin0 * kA[2][2]); + kS[2] = fSin0 * fSin1 * kA[1][1] + + fCos1 * (fSin0 * kA[1][2] + fCos0 * kA[2][2]); + break; + } + } else { + if ( bTest2 ) { + // 2x2 closed form factorization + fTmp = (kA[0][0] * kA[0][0] + kA[1][1] * kA[1][1] - + kA[0][1] * kA[0][1]) / (kA[0][1] * kA[1][1]); + fTan0 = 0.5 * ( -fTmp + sqrt(fTmp * fTmp + 4.0)); + fCos0 = 1.0 / sqrt(1.0 + fTan0 * fTan0); + fSin0 = fTan0 * fCos0; + + for (iCol = 0; iCol < 3; iCol++) { + fTmp0 = kL[iCol][0]; + fTmp1 = kL[iCol][1]; + kL[iCol][0] = fCos0 * fTmp0 - fSin0 * fTmp1; + kL[iCol][1] = fSin0 * fTmp0 + fCos0 * fTmp1; + } + + fTan1 = (kA[0][1] - kA[1][1] * fTan0) / kA[0][0]; + fCos1 = 1.0 / sqrt(1.0 + fTan1 * fTan1); + fSin1 = -fTan1 * fCos1; + + for (iRow = 0; iRow < 3; iRow++) { + fTmp0 = kR[0][iRow]; + fTmp1 = kR[1][iRow]; + kR[0][iRow] = fCos1 * fTmp0 - fSin1 * fTmp1; + kR[1][iRow] = fSin1 * fTmp0 + fCos1 * fTmp1; + } + + kS[0] = fCos0 * fCos1 * kA[0][0] - + fSin1 * (fCos0 * kA[0][1] - fSin0 * kA[1][1]); + kS[1] = fSin0 * fSin1 * kA[0][0] + + fCos1 * (fSin0 * kA[0][1] + fCos0 * kA[1][1]); + kS[2] = kA[2][2]; + break; + } else { + golubKahanStep(kA, kL, kR); + } + } + } + + // positize diagonal + for (iRow = 0; iRow < 3; iRow++) { + if ( kS[iRow] < 0.0 ) { + kS[iRow] = -kS[iRow]; + + for (iCol = 0; iCol < 3; iCol++) + kR[iRow][iCol] = -kR[iRow][iCol]; + } + } +} + +//---------------------------------------------------------------------------- +void Matrix3::singularValueComposition (const Matrix3& kL, + const Vector3& kS, const Matrix3& kR) { + int iRow, iCol; + Matrix3 kTmp; + + // product S*R + for (iRow = 0; iRow < 3; iRow++) { + for (iCol = 0; iCol < 3; iCol++) + kTmp[iRow][iCol] = kS[iRow] * kR[iRow][iCol]; + } + + // product L*S*R + for (iRow = 0; iRow < 3; iRow++) { + for (iCol = 0; iCol < 3; iCol++) { + elt[iRow][iCol] = 0.0; + + for (int iMid = 0; iMid < 3; iMid++) + elt[iRow][iCol] += kL[iRow][iMid] * kTmp[iMid][iCol]; + } + } +} + +//---------------------------------------------------------------------------- +void Matrix3::orthonormalize () { + // Algorithm uses Gram-Schmidt orthogonalization. If 'this' matrix is + // M = [m0|m1|m2], then orthonormal output matrix is Q = [q0|q1|q2], + // + // q0 = m0/|m0| + // q1 = (m1-(q0*m1)q0)/|m1-(q0*m1)q0| + // q2 = (m2-(q0*m2)q0-(q1*m2)q1)/|m2-(q0*m2)q0-(q1*m2)q1| + // + // where |V| indicates length of vector V and A*B indicates dot + // product of vectors A and B. + + // compute q0 + float fInvLength = 1.0 / sqrt(elt[0][0] * elt[0][0] + + elt[1][0] * elt[1][0] + + elt[2][0] * elt[2][0]); + + elt[0][0] *= fInvLength; + elt[1][0] *= fInvLength; + elt[2][0] *= fInvLength; + + // compute q1 + float fDot0 = + elt[0][0] * elt[0][1] + + elt[1][0] * elt[1][1] + + elt[2][0] * elt[2][1]; + + elt[0][1] -= fDot0 * elt[0][0]; + elt[1][1] -= fDot0 * elt[1][0]; + elt[2][1] -= fDot0 * elt[2][0]; + + fInvLength = 1.0 / sqrt(elt[0][1] * elt[0][1] + + elt[1][1] * elt[1][1] + + elt[2][1] * elt[2][1]); + + elt[0][1] *= fInvLength; + elt[1][1] *= fInvLength; + elt[2][1] *= fInvLength; + + // compute q2 + float fDot1 = + elt[0][1] * elt[0][2] + + elt[1][1] * elt[1][2] + + elt[2][1] * elt[2][2]; + + fDot0 = + elt[0][0] * elt[0][2] + + elt[1][0] * elt[1][2] + + elt[2][0] * elt[2][2]; + + elt[0][2] -= fDot0 * elt[0][0] + fDot1 * elt[0][1]; + elt[1][2] -= fDot0 * elt[1][0] + fDot1 * elt[1][1]; + elt[2][2] -= fDot0 * elt[2][0] + fDot1 * elt[2][1]; + + fInvLength = 1.0 / sqrt(elt[0][2] * elt[0][2] + + elt[1][2] * elt[1][2] + + elt[2][2] * elt[2][2]); + + elt[0][2] *= fInvLength; + elt[1][2] *= fInvLength; + elt[2][2] *= fInvLength; +} + +//---------------------------------------------------------------------------- +void Matrix3::qDUDecomposition (Matrix3& kQ, + Vector3& kD, Vector3& kU) const { + // Factor M = QR = QDU where Q is orthogonal, D is diagonal, + // and U is upper triangular with ones on its diagonal. Algorithm uses + // Gram-Schmidt orthogonalization (the QR algorithm). + // + // If M = [ m0 | m1 | m2 ] and Q = [ q0 | q1 | q2 ], then + // + // q0 = m0/|m0| + // q1 = (m1-(q0*m1)q0)/|m1-(q0*m1)q0| + // q2 = (m2-(q0*m2)q0-(q1*m2)q1)/|m2-(q0*m2)q0-(q1*m2)q1| + // + // where |V| indicates length of vector V and A*B indicates dot + // product of vectors A and B. The matrix R has entries + // + // r00 = q0*m0 r01 = q0*m1 r02 = q0*m2 + // r10 = 0 r11 = q1*m1 r12 = q1*m2 + // r20 = 0 r21 = 0 r22 = q2*m2 + // + // so D = diag(r00,r11,r22) and U has entries u01 = r01/r00, + // u02 = r02/r00, and u12 = r12/r11. + + // Q = rotation + // D = scaling + // U = shear + + // D stores the three diagonal entries r00, r11, r22 + // U stores the entries U[0] = u01, U[1] = u02, U[2] = u12 + + // build orthogonal matrix Q + float fInvLength = 1.0 / sqrt(elt[0][0] * elt[0][0] + + elt[1][0] * elt[1][0] + + elt[2][0] * elt[2][0]); + kQ[0][0] = elt[0][0] * fInvLength; + kQ[1][0] = elt[1][0] * fInvLength; + kQ[2][0] = elt[2][0] * fInvLength; + + float fDot = kQ[0][0] * elt[0][1] + kQ[1][0] * elt[1][1] + + kQ[2][0] * elt[2][1]; + kQ[0][1] = elt[0][1] - fDot * kQ[0][0]; + kQ[1][1] = elt[1][1] - fDot * kQ[1][0]; + kQ[2][1] = elt[2][1] - fDot * kQ[2][0]; + fInvLength = 1.0 / sqrt(kQ[0][1] * kQ[0][1] + kQ[1][1] * kQ[1][1] + + kQ[2][1] * kQ[2][1]); + kQ[0][1] *= fInvLength; + kQ[1][1] *= fInvLength; + kQ[2][1] *= fInvLength; + + fDot = kQ[0][0] * elt[0][2] + kQ[1][0] * elt[1][2] + + kQ[2][0] * elt[2][2]; + kQ[0][2] = elt[0][2] - fDot * kQ[0][0]; + kQ[1][2] = elt[1][2] - fDot * kQ[1][0]; + kQ[2][2] = elt[2][2] - fDot * kQ[2][0]; + fDot = kQ[0][1] * elt[0][2] + kQ[1][1] * elt[1][2] + + kQ[2][1] * elt[2][2]; + kQ[0][2] -= fDot * kQ[0][1]; + kQ[1][2] -= fDot * kQ[1][1]; + kQ[2][2] -= fDot * kQ[2][1]; + fInvLength = 1.0 / sqrt(kQ[0][2] * kQ[0][2] + kQ[1][2] * kQ[1][2] + + kQ[2][2] * kQ[2][2]); + kQ[0][2] *= fInvLength; + kQ[1][2] *= fInvLength; + kQ[2][2] *= fInvLength; + + // guarantee that orthogonal matrix has determinant 1 (no reflections) + float fDet = kQ[0][0] * kQ[1][1] * kQ[2][2] + kQ[0][1] * kQ[1][2] * kQ[2][0] + + kQ[0][2] * kQ[1][0] * kQ[2][1] - kQ[0][2] * kQ[1][1] * kQ[2][0] - + kQ[0][1] * kQ[1][0] * kQ[2][2] - kQ[0][0] * kQ[1][2] * kQ[2][1]; + + if ( fDet < 0.0 ) { + for (int iRow = 0; iRow < 3; iRow++) + for (int iCol = 0; iCol < 3; iCol++) + kQ[iRow][iCol] = -kQ[iRow][iCol]; + } + + // build "right" matrix R + Matrix3 kR; + + kR[0][0] = kQ[0][0] * elt[0][0] + kQ[1][0] * elt[1][0] + + kQ[2][0] * elt[2][0]; + + kR[0][1] = kQ[0][0] * elt[0][1] + kQ[1][0] * elt[1][1] + + kQ[2][0] * elt[2][1]; + + kR[1][1] = kQ[0][1] * elt[0][1] + kQ[1][1] * elt[1][1] + + kQ[2][1] * elt[2][1]; + + kR[0][2] = kQ[0][0] * elt[0][2] + kQ[1][0] * elt[1][2] + + kQ[2][0] * elt[2][2]; + + kR[1][2] = kQ[0][1] * elt[0][2] + kQ[1][1] * elt[1][2] + + kQ[2][1] * elt[2][2]; + + kR[2][2] = kQ[0][2] * elt[0][2] + kQ[1][2] * elt[1][2] + + kQ[2][2] * elt[2][2]; + + // the scaling component + kD[0] = kR[0][0]; + + kD[1] = kR[1][1]; + + kD[2] = kR[2][2]; + + // the shear component + float fInvD0 = 1.0 / kD[0]; + + kU[0] = kR[0][1] * fInvD0; + + kU[1] = kR[0][2] * fInvD0; + + kU[2] = kR[1][2] / kD[1]; +} + +//---------------------------------------------------------------------------- +void Matrix3::polarDecomposition(Matrix3 &R, Matrix3 &S) const{ + /* + Polar decomposition of a matrix. Based on pseudocode from + Nicholas J Higham, "Computing the Polar Decomposition -- with + Applications Siam Journal of Science and Statistical Computing, Vol 7, No. 4, + October 1986. + + Decomposes A into R*S, where R is orthogonal and S is symmetric. + + Ken Shoemake's "Matrix animation and polar decomposition" + in Proceedings of the conference on Graphics interface '92 + seems to be better known in the world of graphics, but Higham's version + uses a scaling constant that can lead to faster convergence than + Shoemake's when the initial matrix is far from orthogonal. + */ + + Matrix3 X = *this; + Matrix3 tmp = X.inverse(); + Matrix3 Xit = tmp.transpose(); + int iter = 0; + + const int MAX_ITERS = 100; + + const double eps = 50 * std::numeric_limits::epsilon(); + const float BigEps = 50 * eps; + + /* Higham suggests using OneNorm(Xit-X) < eps * OneNorm(X) + * as the convergence criterion, but OneNorm(X) should quickly + * settle down to something between 1 and 1.7, so just comparing + * with eps seems sufficient. + *--------------------------------------------------------------- */ + + double resid = X.diffOneNorm(Xit); + while (resid > eps && iter < MAX_ITERS) { + + tmp = X.inverse(); + Xit = tmp.transpose(); + + if (resid < BigEps) { + // close enough use simple iteration + X += Xit; + X *= 0.5f; + } + else { + // not close to convergence, compute acceleration factor + float gamma = sqrt( sqrt( + (Xit.l1Norm()* Xit.lInfNorm())/(X.l1Norm()*X.lInfNorm()) ) ); + + X *= 0.5f * gamma; + tmp = Xit; + tmp *= 0.5f / gamma; + X += tmp; + } + + resid = X.diffOneNorm(Xit); + iter++; + } + + R = X; + tmp = R.transpose(); + + S = tmp * (*this); + + // S := (S + S^t)/2 one more time to make sure it is symmetric + tmp = S.transpose(); + + S += tmp; + S *= 0.5f; + +#ifdef G3D_DEBUG + // Check iter limit + assert(iter < MAX_ITERS); + + // Check A = R*S + tmp = R*S; + resid = tmp.diffOneNorm(*this); + assert(resid < eps); + + // Check R is orthogonal + tmp = R*R.transpose(); + resid = tmp.diffOneNorm(Matrix3::identity()); + assert(resid < eps); + + // Check that S is symmetric + tmp = S.transpose(); + resid = tmp.diffOneNorm(S); + assert(resid < eps); +#endif +} + +//---------------------------------------------------------------------------- +float Matrix3::maxCubicRoot (float afCoeff[3]) { + // Spectral norm is for A^T*A, so characteristic polynomial + // P(x) = c[0]+c[1]*x+c[2]*x^2+x^3 has three positive float roots. + // This yields the assertions c[0] < 0 and c[2]*c[2] >= 3*c[1]. + + // quick out for uniform scale (triple root) + const float fOneThird = 1.0f / 3.0f; + const float fEpsilon = 1e-06f; + float fDiscr = afCoeff[2] * afCoeff[2] - 3.0f * afCoeff[1]; + + if ( fDiscr <= fEpsilon ) + return -fOneThird*afCoeff[2]; + + // Compute an upper bound on roots of P(x). This assumes that A^T*A + // has been scaled by its largest entry. + float fX = 1.0f; + + float fPoly = afCoeff[0] + fX * (afCoeff[1] + fX * (afCoeff[2] + fX)); + + if ( fPoly < 0.0f ) { + // uses a matrix norm to find an upper bound on maximum root + fX = G3D::abs(afCoeff[0]); + float fTmp = 1.0 + G3D::abs(afCoeff[1]); + + if ( fTmp > fX ) + fX = fTmp; + + fTmp = 1.0 + G3D::abs(afCoeff[2]); + + if ( fTmp > fX ) + fX = fTmp; + } + + // Newton's method to find root + float fTwoC2 = 2.0f * afCoeff[2]; + + for (int i = 0; i < 16; i++) { + fPoly = afCoeff[0] + fX * (afCoeff[1] + fX * (afCoeff[2] + fX)); + + if ( G3D::abs(fPoly) <= fEpsilon ) + return fX; + + float fDeriv = afCoeff[1] + fX * (fTwoC2 + 3.0f * fX); + + fX -= fPoly / fDeriv; + } + + return fX; +} + +//---------------------------------------------------------------------------- +float Matrix3::spectralNorm () const { + Matrix3 kP; + int iRow, iCol; + float fPmax = 0.0; + + for (iRow = 0; iRow < 3; iRow++) { + for (iCol = 0; iCol < 3; iCol++) { + kP[iRow][iCol] = 0.0; + + for (int iMid = 0; iMid < 3; iMid++) { + kP[iRow][iCol] += + elt[iMid][iRow] * elt[iMid][iCol]; + } + + if ( kP[iRow][iCol] > fPmax ) + fPmax = kP[iRow][iCol]; + } + } + + float fInvPmax = 1.0 / fPmax; + + for (iRow = 0; iRow < 3; iRow++) { + for (iCol = 0; iCol < 3; iCol++) + kP[iRow][iCol] *= fInvPmax; + } + + float afCoeff[3]; + afCoeff[0] = -(kP[0][0] * (kP[1][1] * kP[2][2] - kP[1][2] * kP[2][1]) + + kP[0][1] * (kP[2][0] * kP[1][2] - kP[1][0] * kP[2][2]) + + kP[0][2] * (kP[1][0] * kP[2][1] - kP[2][0] * kP[1][1])); + afCoeff[1] = kP[0][0] * kP[1][1] - kP[0][1] * kP[1][0] + + kP[0][0] * kP[2][2] - kP[0][2] * kP[2][0] + + kP[1][1] * kP[2][2] - kP[1][2] * kP[2][1]; + afCoeff[2] = -(kP[0][0] + kP[1][1] + kP[2][2]); + + float fRoot = maxCubicRoot(afCoeff); + float fNorm = sqrt(fPmax * fRoot); + return fNorm; +} + +//---------------------------------------------------------------------------- +float Matrix3::squaredFrobeniusNorm() const { + float norm2 = 0; + const float* e = &elt[0][0]; + + for (int i = 0; i < 9; ++i){ + norm2 += (*e) * (*e); + } + + return norm2; +} + +//---------------------------------------------------------------------------- +float Matrix3::frobeniusNorm() const { + return sqrtf(squaredFrobeniusNorm()); +} + +//---------------------------------------------------------------------------- +float Matrix3::l1Norm() const { + // The one norm of a matrix is the max column sum in absolute value. + float oneNorm = 0; + for (int c = 0; c < 3; ++c) { + + float f = fabs(elt[0][c])+ fabs(elt[1][c]) + fabs(elt[2][c]); + + if (f > oneNorm) { + oneNorm = f; + } + } + return oneNorm; +} + +//---------------------------------------------------------------------------- +float Matrix3::lInfNorm() const { + // The infinity norm of a matrix is the max row sum in absolute value. + float infNorm = 0; + + for (int r = 0; r < 3; ++r) { + + float f = fabs(elt[r][0]) + fabs(elt[r][1])+ fabs(elt[r][2]); + + if (f > infNorm) { + infNorm = f; + } + } + return infNorm; +} + +//---------------------------------------------------------------------------- +float Matrix3::diffOneNorm(const Matrix3 &y) const{ + float oneNorm = 0; + + for (int c = 0; c < 3; ++c){ + + float f = fabs(elt[0][c] - y[0][c]) + fabs(elt[1][c] - y[1][c]) + + fabs(elt[2][c] - y[2][c]); + + if (f > oneNorm) { + oneNorm = f; + } + } + return oneNorm; +} + +//---------------------------------------------------------------------------- +void Matrix3::toAxisAngle (Vector3& rkAxis, float& rfRadians) const { + // + // Let (x,y,z) be the unit-length axis and let A be an angle of rotation. + // The rotation matrix is R = I + sin(A)*P + (1-cos(A))*P^2 (Rodrigues' formula) where + // I is the identity and + // + // +- -+ + // P = | 0 -z +y | + // | +z 0 -x | + // | -y +x 0 | + // +- -+ + // + // If A > 0, R represents a counterclockwise rotation about the axis in + // the sense of looking from the tip of the axis vector towards the + // origin. Some algebra will show that + // + // cos(A) = (trace(R)-1)/2 and R - R^t = 2*sin(A)*P + // + // In the event that A = pi, R-R^t = 0 which prevents us from extracting + // the axis through P. Instead note that R = I+2*P^2 when A = pi, so + // P^2 = (R-I)/2. The diagonal entries of P^2 are x^2-1, y^2-1, and + // z^2-1. We can solve these for axis (x,y,z). Because the angle is pi, + // it does not matter which sign you choose on the square roots. + + float fTrace = elt[0][0] + elt[1][1] + elt[2][2]; + float fCos = 0.5f * (fTrace - 1.0f); + rfRadians = G3D::aCos(fCos); // in [0,PI] + + if ( rfRadians > 0.0 ) { + if ( rfRadians < pi() ) { + rkAxis.x = elt[2][1] - elt[1][2]; + rkAxis.y = elt[0][2] - elt[2][0]; + rkAxis.z = elt[1][0] - elt[0][1]; + rkAxis.unitize(); + } else { + // angle is PI + float fHalfInverse; + + if ( elt[0][0] >= elt[1][1] ) { + // r00 >= r11 + if ( elt[0][0] >= elt[2][2] ) { + // r00 is maximum diagonal term + rkAxis.x = 0.5 * sqrt(elt[0][0] - + elt[1][1] - elt[2][2] + 1.0); + fHalfInverse = 0.5 / rkAxis.x; + rkAxis.y = fHalfInverse * elt[0][1]; + rkAxis.z = fHalfInverse * elt[0][2]; + } else { + // r22 is maximum diagonal term + rkAxis.z = 0.5 * sqrt(elt[2][2] - + elt[0][0] - elt[1][1] + 1.0); + fHalfInverse = 0.5 / rkAxis.z; + rkAxis.x = fHalfInverse * elt[0][2]; + rkAxis.y = fHalfInverse * elt[1][2]; + } + } else { + // r11 > r00 + if ( elt[1][1] >= elt[2][2] ) { + // r11 is maximum diagonal term + rkAxis.y = 0.5 * sqrt(elt[1][1] - + elt[0][0] - elt[2][2] + 1.0); + fHalfInverse = 0.5 / rkAxis.y; + rkAxis.x = fHalfInverse * elt[0][1]; + rkAxis.z = fHalfInverse * elt[1][2]; + } else { + // r22 is maximum diagonal term + rkAxis.z = 0.5 * sqrt(elt[2][2] - + elt[0][0] - elt[1][1] + 1.0); + fHalfInverse = 0.5 / rkAxis.z; + rkAxis.x = fHalfInverse * elt[0][2]; + rkAxis.y = fHalfInverse * elt[1][2]; + } + } + } + } else { + // The angle is 0 and the matrix is the identity. Any axis will + // work, so just use the x-axis. + rkAxis.x = 1.0; + rkAxis.y = 0.0; + rkAxis.z = 0.0; + } +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::fromAxisAngle (const Vector3& _axis, float fRadians) { + Vector3 axis = _axis.direction(); + + Matrix3 m; + float fCos = cos(fRadians); + float fSin = sin(fRadians); + float fOneMinusCos = 1.0 - fCos; + float fX2 = square(axis.x); + float fY2 = square(axis.y); + float fZ2 = square(axis.z); + float fXYM = axis.x * axis.y * fOneMinusCos; + float fXZM = axis.x * axis.z * fOneMinusCos; + float fYZM = axis.y * axis.z * fOneMinusCos; + float fXSin = axis.x * fSin; + float fYSin = axis.y * fSin; + float fZSin = axis.z * fSin; + + m.elt[0][0] = fX2 * fOneMinusCos + fCos; + m.elt[0][1] = fXYM - fZSin; + m.elt[0][2] = fXZM + fYSin; + + m.elt[1][0] = fXYM + fZSin; + m.elt[1][1] = fY2 * fOneMinusCos + fCos; + m.elt[1][2] = fYZM - fXSin; + + m.elt[2][0] = fXZM - fYSin; + m.elt[2][1] = fYZM + fXSin; + m.elt[2][2] = fZ2 * fOneMinusCos + fCos; + + return m; +} + +//---------------------------------------------------------------------------- +bool Matrix3::toEulerAnglesXYZ (float& rfXAngle, float& rfYAngle, + float& rfZAngle) const { + // rot = cy*cz -cy*sz sy + // cz*sx*sy+cx*sz cx*cz-sx*sy*sz -cy*sx + // -cx*cz*sy+sx*sz cz*sx+cx*sy*sz cx*cy + + if ( elt[0][2] < 1.0f ) { + if ( elt[0][2] > -1.0f ) { + rfXAngle = G3D::aTan2( -elt[1][2], elt[2][2]); + rfYAngle = (float) G3D::aSin(elt[0][2]); + rfZAngle = G3D::aTan2( -elt[0][1], elt[0][0]); + return true; + } else { + // WARNING. Not unique. XA - ZA = -atan2(r10,r11) + rfXAngle = -G3D::aTan2(elt[1][0], elt[1][1]); + rfYAngle = -(float)halfPi(); + rfZAngle = 0.0f; + return false; + } + } else { + // WARNING. Not unique. XAngle + ZAngle = atan2(r10,r11) + rfXAngle = G3D::aTan2(elt[1][0], elt[1][1]); + rfYAngle = (float)halfPi(); + rfZAngle = 0.0f; + return false; + } +} + +//---------------------------------------------------------------------------- +bool Matrix3::toEulerAnglesXZY (float& rfXAngle, float& rfZAngle, + float& rfYAngle) const { + // rot = cy*cz -sz cz*sy + // sx*sy+cx*cy*sz cx*cz -cy*sx+cx*sy*sz + // -cx*sy+cy*sx*sz cz*sx cx*cy+sx*sy*sz + + if ( elt[0][1] < 1.0f ) { + if ( elt[0][1] > -1.0f ) { + rfXAngle = G3D::aTan2(elt[2][1], elt[1][1]); + rfZAngle = (float) asin( -elt[0][1]); + rfYAngle = G3D::aTan2(elt[0][2], elt[0][0]); + return true; + } else { + // WARNING. Not unique. XA - YA = atan2(r20,r22) + rfXAngle = G3D::aTan2(elt[2][0], elt[2][2]); + rfZAngle = (float)halfPi(); + rfYAngle = 0.0; + return false; + } + } else { + // WARNING. Not unique. XA + YA = atan2(-r20,r22) + rfXAngle = G3D::aTan2( -elt[2][0], elt[2][2]); + rfZAngle = -(float)halfPi(); + rfYAngle = 0.0f; + return false; + } +} + +//---------------------------------------------------------------------------- +bool Matrix3::toEulerAnglesYXZ (float& rfYAngle, float& rfXAngle, + float& rfZAngle) const { + // rot = cy*cz+sx*sy*sz cz*sx*sy-cy*sz cx*sy + // cx*sz cx*cz -sx + // -cz*sy+cy*sx*sz cy*cz*sx+sy*sz cx*cy + + if ( elt[1][2] < 1.0 ) { + if ( elt[1][2] > -1.0 ) { + rfYAngle = G3D::aTan2(elt[0][2], elt[2][2]); + rfXAngle = (float) asin( -elt[1][2]); + rfZAngle = G3D::aTan2(elt[1][0], elt[1][1]); + return true; + } else { + // WARNING. Not unique. YA - ZA = atan2(r01,r00) + rfYAngle = G3D::aTan2(elt[0][1], elt[0][0]); + rfXAngle = (float)halfPi(); + rfZAngle = 0.0; + return false; + } + } else { + // WARNING. Not unique. YA + ZA = atan2(-r01,r00) + rfYAngle = G3D::aTan2( -elt[0][1], elt[0][0]); + rfXAngle = -(float)halfPi(); + rfZAngle = 0.0f; + return false; + } +} + +//---------------------------------------------------------------------------- +bool Matrix3::toEulerAnglesYZX (float& rfYAngle, float& rfZAngle, + float& rfXAngle) const { + // rot = cy*cz sx*sy-cx*cy*sz cx*sy+cy*sx*sz + // sz cx*cz -cz*sx + // -cz*sy cy*sx+cx*sy*sz cx*cy-sx*sy*sz + + if ( elt[1][0] < 1.0 ) { + if ( elt[1][0] > -1.0 ) { + rfYAngle = G3D::aTan2( -elt[2][0], elt[0][0]); + rfZAngle = (float) asin(elt[1][0]); + rfXAngle = G3D::aTan2( -elt[1][2], elt[1][1]); + return true; + } else { + // WARNING. Not unique. YA - XA = -atan2(r21,r22); + rfYAngle = -G3D::aTan2(elt[2][1], elt[2][2]); + rfZAngle = -(float)halfPi(); + rfXAngle = 0.0; + return false; + } + } else { + // WARNING. Not unique. YA + XA = atan2(r21,r22) + rfYAngle = G3D::aTan2(elt[2][1], elt[2][2]); + rfZAngle = (float)halfPi(); + rfXAngle = 0.0f; + return false; + } +} + +//---------------------------------------------------------------------------- +bool Matrix3::toEulerAnglesZXY (float& rfZAngle, float& rfXAngle, + float& rfYAngle) const { + // rot = cy*cz-sx*sy*sz -cx*sz cz*sy+cy*sx*sz + // cz*sx*sy+cy*sz cx*cz -cy*cz*sx+sy*sz + // -cx*sy sx cx*cy + + if ( elt[2][1] < 1.0 ) { + if ( elt[2][1] > -1.0 ) { + rfZAngle = G3D::aTan2( -elt[0][1], elt[1][1]); + rfXAngle = (float) asin(elt[2][1]); + rfYAngle = G3D::aTan2( -elt[2][0], elt[2][2]); + return true; + } else { + // WARNING. Not unique. ZA - YA = -atan(r02,r00) + rfZAngle = -G3D::aTan2(elt[0][2], elt[0][0]); + rfXAngle = -(float)halfPi(); + rfYAngle = 0.0f; + return false; + } + } else { + // WARNING. Not unique. ZA + YA = atan2(r02,r00) + rfZAngle = G3D::aTan2(elt[0][2], elt[0][0]); + rfXAngle = (float)halfPi(); + rfYAngle = 0.0f; + return false; + } +} + +//---------------------------------------------------------------------------- +bool Matrix3::toEulerAnglesZYX (float& rfZAngle, float& rfYAngle, + float& rfXAngle) const { + // rot = cy*cz cz*sx*sy-cx*sz cx*cz*sy+sx*sz + // cy*sz cx*cz+sx*sy*sz -cz*sx+cx*sy*sz + // -sy cy*sx cx*cy + + if ( elt[2][0] < 1.0 ) { + if ( elt[2][0] > -1.0 ) { + rfZAngle = atan2f(elt[1][0], elt[0][0]); + rfYAngle = asinf(-(double)elt[2][1]); + rfXAngle = atan2f(elt[2][1], elt[2][2]); + return true; + } else { + // WARNING. Not unique. ZA - XA = -atan2(r01,r02) + rfZAngle = -G3D::aTan2(elt[0][1], elt[0][2]); + rfYAngle = (float)halfPi(); + rfXAngle = 0.0f; + return false; + } + } else { + // WARNING. Not unique. ZA + XA = atan2(-r01,-r02) + rfZAngle = G3D::aTan2( -elt[0][1], -elt[0][2]); + rfYAngle = -(float)halfPi(); + rfXAngle = 0.0f; + return false; + } +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::fromEulerAnglesXYZ (float fYAngle, float fPAngle, + float fRAngle) { + float fCos, fSin; + + fCos = cosf(fYAngle); + fSin = sinf(fYAngle); + Matrix3 kXMat(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0, fSin, fCos); + + fCos = cosf(fPAngle); + fSin = sinf(fPAngle); + Matrix3 kYMat(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos); + + fCos = cosf(fRAngle); + fSin = sinf(fRAngle); + Matrix3 kZMat(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f); + + return kXMat * (kYMat * kZMat); +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::fromEulerAnglesXZY (float fYAngle, float fPAngle, + float fRAngle) { + + float fCos, fSin; + + fCos = cosf(fYAngle); + fSin = sinf(fYAngle); + Matrix3 kXMat(1.0, 0.0, 0.0, 0.0, fCos, -fSin, 0.0, fSin, fCos); + + fCos = cosf(fPAngle); + fSin = sinf(fPAngle); + Matrix3 kZMat(fCos, -fSin, 0.0, fSin, fCos, 0.0, 0.0, 0.0, 1.0); + + fCos = cosf(fRAngle); + fSin = sinf(fRAngle); + Matrix3 kYMat(fCos, 0.0, fSin, 0.0, 1.0, 0.0, -fSin, 0.0, fCos); + + return kXMat * (kZMat * kYMat); +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::fromEulerAnglesYXZ( + float fYAngle, + float fPAngle, + float fRAngle) { + + float fCos, fSin; + + fCos = cos(fYAngle); + fSin = sin(fYAngle); + Matrix3 kYMat(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos); + + fCos = cos(fPAngle); + fSin = sin(fPAngle); + Matrix3 kXMat(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0f, fSin, fCos); + + fCos = cos(fRAngle); + fSin = sin(fRAngle); + Matrix3 kZMat(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f); + + return kYMat * (kXMat * kZMat); +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::fromEulerAnglesYZX( + float fYAngle, + float fPAngle, + float fRAngle) { + + float fCos, fSin; + + fCos = cos(fYAngle); + fSin = sin(fYAngle); + Matrix3 kYMat(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos); + + fCos = cos(fPAngle); + fSin = sin(fPAngle); + Matrix3 kZMat(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f); + + fCos = cos(fRAngle); + fSin = sin(fRAngle); + Matrix3 kXMat(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0f, fSin, fCos); + + return kYMat * (kZMat * kXMat); +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::fromEulerAnglesZXY (float fYAngle, float fPAngle, + float fRAngle) { + float fCos, fSin; + + fCos = cos(fYAngle); + fSin = sin(fYAngle); + Matrix3 kZMat(fCos, -fSin, 0.0, fSin, fCos, 0.0, 0.0, 0.0, 1.0); + + fCos = cos(fPAngle); + fSin = sin(fPAngle); + Matrix3 kXMat(1.0, 0.0, 0.0, 0.0, fCos, -fSin, 0.0, fSin, fCos); + + fCos = cos(fRAngle); + fSin = sin(fRAngle); + Matrix3 kYMat(fCos, 0.0, fSin, 0.0, 1.0, 0.0, -fSin, 0.0, fCos); + + return kZMat * (kXMat * kYMat); +} + +//---------------------------------------------------------------------------- +Matrix3 Matrix3::fromEulerAnglesZYX (float fYAngle, float fPAngle, + float fRAngle) { + float fCos, fSin; + + fCos = cos(fYAngle); + fSin = sin(fYAngle); + Matrix3 kZMat(fCos, -fSin, 0.0, fSin, fCos, 0.0, 0.0, 0.0, 1.0); + + fCos = cos(fPAngle); + fSin = sin(fPAngle); + Matrix3 kYMat(fCos, 0.0, fSin, 0.0, 1.0, 0.0, -fSin, 0.0, fCos); + + fCos = cos(fRAngle); + fSin = sin(fRAngle); + Matrix3 kXMat(1.0, 0.0, 0.0, 0.0, fCos, -fSin, 0.0, fSin, fCos); + + return kZMat * (kYMat * kXMat); +} + +//---------------------------------------------------------------------------- +void Matrix3::tridiagonal (float afDiag[3], float afSubDiag[3]) { + // Householder reduction T = Q^t M Q + // Input: + // mat, symmetric 3x3 matrix M + // Output: + // mat, orthogonal matrix Q + // diag, diagonal entries of T + // subd, subdiagonal entries of T (T is symmetric) + + float fA = elt[0][0]; + float fB = elt[0][1]; + float fC = elt[0][2]; + float fD = elt[1][1]; + float fE = elt[1][2]; + float fF = elt[2][2]; + + afDiag[0] = fA; + afSubDiag[2] = 0.0; + + if ( G3D::abs(fC) >= EPSILON ) { + float fLength = sqrt(fB * fB + fC * fC); + float fInvLength = 1.0 / fLength; + fB *= fInvLength; + fC *= fInvLength; + float fQ = 2.0 * fB * fE + fC * (fF - fD); + afDiag[1] = fD + fC * fQ; + afDiag[2] = fF - fC * fQ; + afSubDiag[0] = fLength; + afSubDiag[1] = fE - fB * fQ; + elt[0][0] = 1.0; + elt[0][1] = 0.0; + elt[0][2] = 0.0; + elt[1][0] = 0.0; + elt[1][1] = fB; + elt[1][2] = fC; + elt[2][0] = 0.0; + elt[2][1] = fC; + elt[2][2] = -fB; + } else { + afDiag[1] = fD; + afDiag[2] = fF; + afSubDiag[0] = fB; + afSubDiag[1] = fE; + elt[0][0] = 1.0; + elt[0][1] = 0.0; + elt[0][2] = 0.0; + elt[1][0] = 0.0; + elt[1][1] = 1.0; + elt[1][2] = 0.0; + elt[2][0] = 0.0; + elt[2][1] = 0.0; + elt[2][2] = 1.0; + } +} + +//---------------------------------------------------------------------------- +bool Matrix3::qLAlgorithm (float afDiag[3], float afSubDiag[3]) { + // QL iteration with implicit shifting to reduce matrix from tridiagonal + // to diagonal + + for (int i0 = 0; i0 < 3; i0++) { + const int iMaxIter = 32; + int iIter; + + for (iIter = 0; iIter < iMaxIter; iIter++) { + int i1; + + for (i1 = i0; i1 <= 1; i1++) { + float fSum = G3D::abs(afDiag[i1]) + + G3D::abs(afDiag[i1 + 1]); + + if ( G3D::abs(afSubDiag[i1]) + fSum == fSum ) + break; + } + + if ( i1 == i0 ) + break; + + float fTmp0 = (afDiag[i0 + 1] - afDiag[i0]) / (2.0 * afSubDiag[i0]); + + float fTmp1 = sqrt(fTmp0 * fTmp0 + 1.0); + + if ( fTmp0 < 0.0 ) + fTmp0 = afDiag[i1] - afDiag[i0] + afSubDiag[i0] / (fTmp0 - fTmp1); + else + fTmp0 = afDiag[i1] - afDiag[i0] + afSubDiag[i0] / (fTmp0 + fTmp1); + + float fSin = 1.0; + + float fCos = 1.0; + + float fTmp2 = 0.0; + + for (int i2 = i1 - 1; i2 >= i0; i2--) { + float fTmp3 = fSin * afSubDiag[i2]; + float fTmp4 = fCos * afSubDiag[i2]; + + if (G3D::abs(fTmp3) >= G3D::abs(fTmp0)) { + fCos = fTmp0 / fTmp3; + fTmp1 = sqrt(fCos * fCos + 1.0); + afSubDiag[i2 + 1] = fTmp3 * fTmp1; + fSin = 1.0 / fTmp1; + fCos *= fSin; + } else { + fSin = fTmp3 / fTmp0; + fTmp1 = sqrt(fSin * fSin + 1.0); + afSubDiag[i2 + 1] = fTmp0 * fTmp1; + fCos = 1.0 / fTmp1; + fSin *= fCos; + } + + fTmp0 = afDiag[i2 + 1] - fTmp2; + fTmp1 = (afDiag[i2] - fTmp0) * fSin + 2.0 * fTmp4 * fCos; + fTmp2 = fSin * fTmp1; + afDiag[i2 + 1] = fTmp0 + fTmp2; + fTmp0 = fCos * fTmp1 - fTmp4; + + for (int iRow = 0; iRow < 3; iRow++) { + fTmp3 = elt[iRow][i2 + 1]; + elt[iRow][i2 + 1] = fSin * elt[iRow][i2] + + fCos * fTmp3; + elt[iRow][i2] = fCos * elt[iRow][i2] - + fSin * fTmp3; + } + } + + afDiag[i0] -= fTmp2; + afSubDiag[i0] = fTmp0; + afSubDiag[i1] = 0.0; + } + + if ( iIter == iMaxIter ) { + // should not get here under normal circumstances + return false; + } + } + + return true; +} + +//---------------------------------------------------------------------------- +void Matrix3::eigenSolveSymmetric (float afEigenvalue[3], + Vector3 akEigenvector[3]) const { + Matrix3 kMatrix = *this; + float afSubDiag[3]; + kMatrix.tridiagonal(afEigenvalue, afSubDiag); + kMatrix.qLAlgorithm(afEigenvalue, afSubDiag); + + for (int i = 0; i < 3; i++) { + akEigenvector[i][0] = kMatrix[0][i]; + akEigenvector[i][1] = kMatrix[1][i]; + akEigenvector[i][2] = kMatrix[2][i]; + } + + // make eigenvectors form a right--handed system + Vector3 kCross = akEigenvector[1].cross(akEigenvector[2]); + + float fDet = akEigenvector[0].dot(kCross); + + if ( fDet < 0.0 ) { + akEigenvector[2][0] = - akEigenvector[2][0]; + akEigenvector[2][1] = - akEigenvector[2][1]; + akEigenvector[2][2] = - akEigenvector[2][2]; + } +} + +//---------------------------------------------------------------------------- +void Matrix3::tensorProduct (const Vector3& rkU, const Vector3& rkV, + Matrix3& rkProduct) { + for (int iRow = 0; iRow < 3; iRow++) { + for (int iCol = 0; iCol < 3; iCol++) { + rkProduct[iRow][iCol] = rkU[iRow] * rkV[iCol]; + } + } +} + +//---------------------------------------------------------------------------- + +// Runs in 52 cycles on AMD, 76 cycles on Intel Centrino +// +// The loop unrolling is necessary for performance. +// I was unable to improve performance further by flattening the matrices +// into float*'s instead of 2D arrays. +// +// -morgan +void Matrix3::_mul(const Matrix3& A, const Matrix3& B, Matrix3& out) { + const float* ARowPtr = A.elt[0]; + float* outRowPtr = out.elt[0]; + outRowPtr[0] = + ARowPtr[0] * B.elt[0][0] + + ARowPtr[1] * B.elt[1][0] + + ARowPtr[2] * B.elt[2][0]; + outRowPtr[1] = + ARowPtr[0] * B.elt[0][1] + + ARowPtr[1] * B.elt[1][1] + + ARowPtr[2] * B.elt[2][1]; + outRowPtr[2] = + ARowPtr[0] * B.elt[0][2] + + ARowPtr[1] * B.elt[1][2] + + ARowPtr[2] * B.elt[2][2]; + + ARowPtr = A.elt[1]; + outRowPtr = out.elt[1]; + + outRowPtr[0] = + ARowPtr[0] * B.elt[0][0] + + ARowPtr[1] * B.elt[1][0] + + ARowPtr[2] * B.elt[2][0]; + outRowPtr[1] = + ARowPtr[0] * B.elt[0][1] + + ARowPtr[1] * B.elt[1][1] + + ARowPtr[2] * B.elt[2][1]; + outRowPtr[2] = + ARowPtr[0] * B.elt[0][2] + + ARowPtr[1] * B.elt[1][2] + + ARowPtr[2] * B.elt[2][2]; + + ARowPtr = A.elt[2]; + outRowPtr = out.elt[2]; + + outRowPtr[0] = + ARowPtr[0] * B.elt[0][0] + + ARowPtr[1] * B.elt[1][0] + + ARowPtr[2] * B.elt[2][0]; + outRowPtr[1] = + ARowPtr[0] * B.elt[0][1] + + ARowPtr[1] * B.elt[1][1] + + ARowPtr[2] * B.elt[2][1]; + outRowPtr[2] = + ARowPtr[0] * B.elt[0][2] + + ARowPtr[1] * B.elt[1][2] + + ARowPtr[2] * B.elt[2][2]; +} + +//---------------------------------------------------------------------------- +void Matrix3::_transpose(const Matrix3& A, Matrix3& out) { + out[0][0] = A.elt[0][0]; + out[0][1] = A.elt[1][0]; + out[0][2] = A.elt[2][0]; + out[1][0] = A.elt[0][1]; + out[1][1] = A.elt[1][1]; + out[1][2] = A.elt[2][1]; + out[2][0] = A.elt[0][2]; + out[2][1] = A.elt[1][2]; + out[2][2] = A.elt[2][2]; +} + +//----------------------------------------------------------------------------- +std::string Matrix3::toString() const { + return G3D::format("[%g, %g, %g; %g, %g, %g; %g, %g, %g]", + elt[0][0], elt[0][1], elt[0][2], + elt[1][0], elt[1][1], elt[1][2], + elt[2][0], elt[2][1], elt[2][2]); +} + + + +} // namespace + diff --git a/externals/g3dlite/Matrix4.cpp b/externals/g3dlite/Matrix4.cpp new file mode 100644 index 0000000..cd38a1a --- /dev/null +++ b/externals/g3dlite/Matrix4.cpp @@ -0,0 +1,523 @@ +/** + @file Matrix4.cpp + + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-10-02 + @edited 2010-01-29 + */ + +#include "G3D/platform.h" +#include "G3D/Matrix4.h" +#include "G3D/Matrix3.h" +#include "G3D/Vector4.h" +#include "G3D/Vector3.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/CoordinateFrame.h" +#include "G3D/Rect2D.h" +#include "G3D/Any.h" +#include "G3D/stringutils.h" + +namespace G3D { + + +Matrix4::Matrix4(const Any& any) { + any.verifyName("Matrix4"); + any.verifyType(Any::ARRAY); + + const std::string& name = toLower(any.name()); + if (name == "matrix4") { + any.verifySize(16); + + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + elt[r][c] = any[r * 4 + c]; + } + } + } else if (name == "matrix4::scale") { + if (any.size() == 1) { + *this = scale(any[0].number()); + } else if (any.size() == 3) { + *this = scale(any[0], any[1], any[2]); + } else { + any.verify(false, "Matrix4::scale() takes either 1 or 3 arguments"); + } + } else { + any.verify(false, "Expected Matrix4 constructor"); + } +} + + +Matrix4::operator Any() const { + Any any(Any::ARRAY, "Matrix4"); + any.resize(16); + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + any[r * 4 + c] = elt[r][c]; + } + } + + return any; +} + +const Matrix4& Matrix4::identity() { + static Matrix4 m( + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + return m; +} + + +const Matrix4& Matrix4::zero() { + static Matrix4 m( + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0); + return m; +} + + +Matrix4::Matrix4(const class CoordinateFrame& cframe) { + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 3; ++c) { + elt[r][c] = cframe.rotation[r][c]; + } + elt[r][3] = cframe.translation[r]; + } + elt[3][0] = 0.0f; + elt[3][1] = 0.0f; + elt[3][2] = 0.0f; + elt[3][3] = 1.0f; +} + +Matrix4::Matrix4(const Matrix3& upper3x3, const Vector3& lastCol) { + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 3; ++c) { + elt[r][c] = upper3x3[r][c]; + } + elt[r][3] = lastCol[r]; + } + elt[3][0] = 0.0f; + elt[3][1] = 0.0f; + elt[3][2] = 0.0f; + elt[3][3] = 1.0f; +} + + +Matrix3 Matrix4::upper3x3() const { + return Matrix3(elt[0][0], elt[0][1], elt[0][2], + elt[1][0], elt[1][1], elt[1][2], + elt[2][0], elt[2][1], elt[2][2]); +} + + +Matrix4 Matrix4::orthogonalProjection( + const class Rect2D& rect, + float nearval, + float farval, + float upDirection) { + return Matrix4::orthogonalProjection(rect.x0(), rect.x1(), rect.y1(), rect.y0(), nearval, farval, upDirection); +} + + +Matrix4 Matrix4::orthogonalProjection( + float left, + float right, + float bottom, + float top, + float nearval, + float farval, + float upDirection) { + + // Adapted from Mesa. Note that Microsoft (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_8qnj.asp) + // and Linux (http://www.xfree86.org/current/glOrtho.3.html) have different matrices shown in their documentation. + + float x, y, z; + float tx, ty, tz; + + x = 2.0f / (right-left); + y = 2.0f / (top-bottom); + z = -2.0f / (farval-nearval); + tx = -(right+left) / (right-left); + ty = -(top+bottom) / (top-bottom); + tz = -(farval+nearval) / (farval-nearval); + + y *= upDirection; + ty *= upDirection; + + return + Matrix4( x , 0.0f, 0.0f, tx, + 0.0f, y , 0.0f, ty, + 0.0f, 0.0f, z , tz, + 0.0f, 0.0f, 0.0f, 1.0f); +} + + +Matrix4 Matrix4::perspectiveProjection( + float left, + float right, + float bottom, + float top, + float nearval, + float farval, + float upDirection) { + + float x, y, a, b, c, d; + + x = (2.0f*nearval) / (right-left); + y = (2.0f*nearval) / (top-bottom); + a = (right+left) / (right-left); + b = (top+bottom) / (top-bottom); + + if (farval >= finf()) { + // Infinite view frustum + c = -1.0f; + d = -2.0f * nearval; + } else { + c = -(farval+nearval) / (farval-nearval); + d = -(2.0f*farval*nearval) / (farval-nearval); + } + + debugAssertM(abs(upDirection) == 1.0f, "upDirection must be -1 or +1"); + y *= upDirection; + b *= upDirection; + + return Matrix4( + x, 0, a, 0, + 0, y, b, 0, + 0, 0, c, d, + 0, 0, -1, 0); +} + + +void Matrix4::getPerspectiveProjectionParameters( + float& left, + float& right, + float& bottom, + float& top, + float& nearval, + float& farval, + float upDirection) const { + + debugAssertM(abs(upDirection) == 1.0f, "upDirection must be -1 or +1"); + + float x = elt[0][0]; + float y = elt[1][1] * upDirection; + float a = elt[0][2]; + float b = elt[1][2] * upDirection; + float c = elt[2][2]; + float d = elt[2][3]; + + // Verify that this really is a projection matrix + debugAssertM(elt[3][2] == -1, "Not a projection matrix"); + debugAssertM(elt[0][1] == 0, "Not a projection matrix"); + debugAssertM(elt[0][3] == 0, "Not a projection matrix"); + debugAssertM(elt[1][3] == 0, "Not a projection matrix"); + debugAssertM(elt[3][3] == 0, "Not a projection matrix"); + debugAssertM(elt[1][0] == 0, "Not a projection matrix"); + debugAssertM(elt[2][0] == 0, "Not a projection matrix"); + debugAssertM(elt[2][1] == 0, "Not a projection matrix"); + debugAssertM(elt[3][0] == 0, "Not a projection matrix"); + debugAssertM(elt[3][1] == 0, "Not a projection matrix"); + + if (c == -1) { + farval = finf(); + nearval = -d / 2.0f; + } else { + nearval = d * ((c - 1.0f) / (c + 1.0f) - 1.0f) / (-2.0f * (c - 1.0f) / (c + 1.0f)); + farval = nearval * ((c - 1.0f) / (c + 1.0f)); + } + + + left = (a - 1.0f) * nearval / x; + right = 2.0f * nearval / x + left; + + bottom = (b - 1.0f) * nearval / y; + top = 2.0f * nearval / y + bottom; +} + + +Matrix4::Matrix4( + float r1c1, float r1c2, float r1c3, float r1c4, + float r2c1, float r2c2, float r2c3, float r2c4, + float r3c1, float r3c2, float r3c3, float r3c4, + float r4c1, float r4c2, float r4c3, float r4c4) { + elt[0][0] = r1c1; elt[0][1] = r1c2; elt[0][2] = r1c3; elt[0][3] = r1c4; + elt[1][0] = r2c1; elt[1][1] = r2c2; elt[1][2] = r2c3; elt[1][3] = r2c4; + elt[2][0] = r3c1; elt[2][1] = r3c2; elt[2][2] = r3c3; elt[2][3] = r3c4; + elt[3][0] = r4c1; elt[3][1] = r4c2; elt[3][2] = r4c3; elt[3][3] = r4c4; +} + +/** + init should be row major. + */ +Matrix4::Matrix4(const float* init) { + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + elt[r][c] = init[r * 4 + c]; + } + } +} + + +Matrix4::Matrix4(const double* init) { + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + elt[r][c] = (float)init[r * 4 + c]; + } + } +} + + +Matrix4::Matrix4() { + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + elt[r][c] = 0; + } + } +} + + +void Matrix4::setRow(int r, const Vector4& v) { + for (int c = 0; c < 4; ++c) { + elt[r][c] = v[c]; + } +} + + +void Matrix4::setColumn(int c, const Vector4& v) { + for (int r = 0; r < 4; ++r) { + elt[r][c] = v[r]; + } +} + + +const Vector4& Matrix4::row(int r) const { + return reinterpret_cast(elt[r])[0]; +} + + +Vector4 Matrix4::column(int c) const { + Vector4 v; + for (int r = 0; r < 4; ++r) { + v[r] = elt[r][c]; + } + return v; +} + + +Matrix4 Matrix4::operator*(const Matrix4& other) const { + Matrix4 result; + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + for (int i = 0; i < 4; ++i) { + result.elt[r][c] += elt[r][i] * other.elt[i][c]; + } + } + } + + return result; +} + + +Matrix4 Matrix4::operator*(const float s) const { + Matrix4 result; + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + result.elt[r][c] = elt[r][c] * s; + } + } + + return result; +} + + +Vector3 Matrix4::homoMul(const class Vector3& v, float w) const { + Vector4 r = (*this) * Vector4(v, w); + return r.xyz() * (1.0f / r.w); +} + + +Vector4 Matrix4::operator*(const Vector4& vector) const { + Vector4 result(0,0,0,0); + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + result[r] += elt[r][c] * vector[c]; + } + } + + return result; +} + + +Matrix4 Matrix4::transpose() const { + Matrix4 result; + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + result.elt[c][r] = elt[r][c]; + } + } + + return result; +} + + +bool Matrix4::operator!=(const Matrix4& other) const { + return ! (*this == other); +} + + +bool Matrix4::operator==(const Matrix4& other) const { + + // If the bit patterns are identical, they must be + // the same matrix. If not, they *might* still have + // equal elements due to floating point weirdness. + if (memcmp(this, &other, sizeof(Matrix4) == 0)) { + return true; + } + + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + if (elt[r][c] != other.elt[r][c]) { + return false; + } + } + } + + return true; +} + + +float Matrix4::determinant() const { + // Determinant is the dot product of the first row and the first row + // of cofactors (i.e. the first col of the adjoint matrix) + return cofactor().row(0).dot(row(0)); +} + + +Matrix4 Matrix4::adjoint() const { + return cofactor().transpose(); +} + + +Matrix4 Matrix4::inverse() const { + // Inverse = adjoint / determinant + + Matrix4 A = adjoint(); + + // Determinant is the dot product of the first row and the first row + // of cofactors (i.e. the first col of the adjoint matrix) + float det = A.column(0).dot(row(0)); + + return A * (1.0f / det); +} + + +Matrix4 Matrix4::cofactor() const { + Matrix4 out; + + // We'll use i to incrementally compute -1 ^ (r+c) + int i = 1; + + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + // Compute the determinant of the 3x3 submatrix + float det = subDeterminant(r, c); + out.elt[r][c] = i * det; + i = -i; + } + i = -i; + } + + return out; +} + + +float Matrix4::subDeterminant(int excludeRow, int excludeCol) const { + // Compute non-excluded row and column indices + int row[3]; + int col[3]; + + for (int i = 0; i < 3; ++i) { + row[i] = i; + col[i] = i; + + if (i >= excludeRow) { + ++row[i]; + } + if (i >= excludeCol) { + ++col[i]; + } + } + + // Compute the first row of cofactors + float cofactor00 = + elt[row[1]][col[1]] * elt[row[2]][col[2]] - + elt[row[1]][col[2]] * elt[row[2]][col[1]]; + + float cofactor10 = + elt[row[1]][col[2]] * elt[row[2]][col[0]] - + elt[row[1]][col[0]] * elt[row[2]][col[2]]; + + float cofactor20 = + elt[row[1]][col[0]] * elt[row[2]][col[1]] - + elt[row[1]][col[1]] * elt[row[2]][col[0]]; + + // Product of the first row and the cofactors along the first row + return + elt[row[0]][col[0]] * cofactor00 + + elt[row[0]][col[1]] * cofactor10 + + elt[row[0]][col[2]] * cofactor20; +} + + +CoordinateFrame Matrix4::approxCoordinateFrame() const { + CoordinateFrame cframe; + + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 3; ++c) { + cframe.rotation[r][c] = elt[r][c]; + } + cframe.translation[r] = elt[r][3]; + } + + // Ensure that the rotation matrix is orthonormal + cframe.rotation.orthonormalize(); + + return cframe; +} + + +void Matrix4::serialize(class BinaryOutput& b) const { + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + b.writeFloat32(elt[r][c]); + } + } +} + + +void Matrix4::deserialize(class BinaryInput& b) { + for (int r = 0; r < 4; ++r) { + for (int c = 0; c < 4; ++c) { + elt[r][c] = b.readFloat32(); + } + } +} + +std::string Matrix4::toString() const { + return G3D::format("[%g, %g, %g, %g; %g, %g, %g, %g; %g, %g, %g, %g; %g, %g, %g, %g]", + elt[0][0], elt[0][1], elt[0][2], elt[0][3], + elt[1][0], elt[1][1], elt[1][2], elt[1][3], + elt[2][0], elt[2][1], elt[2][2], elt[2][3], + elt[3][0], elt[3][1], elt[3][2], elt[3][3]); +} + +} // namespace + + diff --git a/externals/g3dlite/MemoryManager.cpp b/externals/g3dlite/MemoryManager.cpp new file mode 100644 index 0000000..240188a --- /dev/null +++ b/externals/g3dlite/MemoryManager.cpp @@ -0,0 +1,91 @@ +/** + @file MemoryManager.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2009-04-20 + @edited 2009-05-29 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#include "G3D/MemoryManager.h" +#include "G3D/System.h" + +namespace G3D { + +MemoryManager::MemoryManager() {} + + +void* MemoryManager::alloc(size_t s) { + return System::malloc(s); +} + + +void MemoryManager::free(void* ptr) { + System::free(ptr); +} + + +bool MemoryManager::isThreadsafe() const { + return true; +} + + +MemoryManager::Ref MemoryManager::create() { + static MemoryManager::Ref m = new MemoryManager(); + return m; +} + + +/////////////////////////////////////////////////// + +AlignedMemoryManager::AlignedMemoryManager() {} + + +void* AlignedMemoryManager::alloc(size_t s) { + return System::alignedMalloc(s, 16); +} + + +void AlignedMemoryManager::free(void* ptr) { + System::alignedFree(ptr); +} + + +bool AlignedMemoryManager::isThreadsafe() const { + return true; +} + + +AlignedMemoryManager::Ref AlignedMemoryManager::create() { + static AlignedMemoryManager::Ref m = new AlignedMemoryManager(); + return m; +} + + +/////////////////////////////////////////////////// + +CRTMemoryManager::CRTMemoryManager() {} + + +void* CRTMemoryManager::alloc(size_t s) { + return ::malloc(s); +} + + +void CRTMemoryManager::free(void* ptr) { + return ::free(ptr); +} + + +bool CRTMemoryManager::isThreadsafe() const { + return true; +} + + +CRTMemoryManager::Ref CRTMemoryManager::create() { + static CRTMemoryManager::Ref m = new CRTMemoryManager(); + return m; +} +} diff --git a/externals/g3dlite/Plane.cpp b/externals/g3dlite/Plane.cpp new file mode 100644 index 0000000..9b7991c --- /dev/null +++ b/externals/g3dlite/Plane.cpp @@ -0,0 +1,149 @@ +/** + @file Plane.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2003-02-06 + @edited 2006-01-29 + */ + +#include "G3D/platform.h" +#include "G3D/Plane.h" +#include "G3D/BinaryOutput.h" +#include "G3D/BinaryInput.h" +#include "G3D/stringutils.h" + +namespace G3D { + +Plane::Plane(class BinaryInput& b) { + deserialize(b); +} + + +void Plane::serialize(class BinaryOutput& b) const { + _normal.serialize(b); + b.writeFloat64(_distance); +} + + +void Plane::deserialize(class BinaryInput& b) { + _normal.deserialize(b); + _distance = (float)b.readFloat64(); +} + + +Plane::Plane( + Vector4 point0, + Vector4 point1, + Vector4 point2) { + + debugAssertM( + point0.w != 0 || + point1.w != 0 || + point2.w != 0, + "At least one point must be finite."); + + // Rotate the points around so that the finite points come first. + + while ((point0.w == 0) && + ((point1.w == 0) || (point2.w != 0))) { + Vector4 temp = point0; + point0 = point1; + point1 = point2; + point2 = temp; + } + + Vector3 dir1; + Vector3 dir2; + + if (point1.w == 0) { + // 1 finite, 2 infinite points; the plane must contain + // the direction of the two direcitons + dir1 = point1.xyz(); + dir2 = point2.xyz(); + } else if (point2.w != 0) { + // 3 finite points, the plane must contain the directions + // betwseen the points. + dir1 = point1.xyz() - point0.xyz(); + dir2 = point2.xyz() - point0.xyz(); + } else { + // 2 finite, 1 infinite point; the plane must contain + // the direction between the first two points and the + // direction of the third point. + dir1 = point1.xyz() - point0.xyz(); + dir2 = point2.xyz(); + } + + _normal = dir1.cross(dir2).direction(); + _distance = _normal.dot(point0.xyz()); +} + + +Plane::Plane( + const Vector3& point0, + const Vector3& point1, + const Vector3& point2) { + + _normal = (point1 - point0).cross(point2 - point0).direction(); + _distance = _normal.dot(point0); +} + + +Plane::Plane( + const Vector3& __normal, + const Vector3& point) { + + _normal = __normal.direction(); + _distance = _normal.dot(point); +} + + +Plane Plane::fromEquation(float a, float b, float c, float d) { + Vector3 n(a, b, c); + float magnitude = n.magnitude(); + d /= magnitude; + n /= magnitude; + return Plane(n, -d); +} + + +void Plane::flip() { + _normal = -_normal; + _distance = -_distance; +} + + +void Plane::getEquation(Vector3& n, float& d) const { + double _d; + getEquation(n, _d); + d = (float)_d; +} + +void Plane::getEquation(Vector3& n, double& d) const { + n = _normal; + d = -_distance; +} + + +void Plane::getEquation(float& a, float& b, float& c, float& d) const { + double _a, _b, _c, _d; + getEquation(_a, _b, _c, _d); + a = (float)_a; + b = (float)_b; + c = (float)_c; + d = (float)_d; +} + +void Plane::getEquation(double& a, double& b, double& c, double& d) const { + a = _normal.x; + b = _normal.y; + c = _normal.z; + d = -_distance; +} + + +std::string Plane::toString() const { + return format("Plane(%g, %g, %g, %g)", _normal.x, _normal.y, _normal.z, _distance); +} + +} diff --git a/externals/g3dlite/Quat.cpp b/externals/g3dlite/Quat.cpp new file mode 100644 index 0000000..225c5b5 --- /dev/null +++ b/externals/g3dlite/Quat.cpp @@ -0,0 +1,583 @@ +/** + @file Quat.cpp + + Quaternion implementation based on Watt & Watt page 363 + + @author Morgan McGuire, graphics3d.com + + @created 2002-01-23 + @edited 2006-01-31 + */ + +#include "G3D/Quat.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" + +namespace G3D { + +Quat Quat::fromAxisAngleRotation( + const Vector3& axis, + float angle) { + + Quat q; + + q.w = cos(angle / 2.0f); + q.imag() = axis.direction() * sin(angle / 2.0f); + + return q; +} + + +Quat::Quat( + const Matrix3& rot) { + + static const int plus1mod3[] = {1, 2, 0}; + + // Find the index of the largest diagonal component + // These ? operations hopefully compile to conditional + // move instructions instead of branches. + int i = (rot[1][1] > rot[0][0]) ? 1 : 0; + i = (rot[2][2] > rot[i][i]) ? 2 : i; + + // Find the indices of the other elements + int j = plus1mod3[i]; + int k = plus1mod3[j]; + + // Index the elements of the vector part of the quaternion as a float* + float* v = (float*)(this); + + // If we attempted to pre-normalize and trusted the matrix to be + // perfectly orthonormal, the result would be: + // + // double c = sqrt((rot[i][i] - (rot[j][j] + rot[k][k])) + 1.0) + // v[i] = -c * 0.5 + // v[j] = -(rot[i][j] + rot[j][i]) * 0.5 / c + // v[k] = -(rot[i][k] + rot[k][i]) * 0.5 / c + // w = (rot[j][k] - rot[k][j]) * 0.5 / c + // + // Since we're going to pay the sqrt anyway, we perform a post normalization, which also + // fixes any poorly normalized input. Multiply all elements by 2*c in the above, giving: + + // nc2 = -c^2 + double nc2 = ((rot[j][j] + rot[k][k]) - rot[i][i]) - 1.0; + v[i] = nc2; + w = (rot[j][k] - rot[k][j]); + v[j] = -(rot[i][j] + rot[j][i]); + v[k] = -(rot[i][k] + rot[k][i]); + + // We now have the correct result with the wrong magnitude, so normalize it: + float s = sqrt(x*x + y*y + z*z + w*w); + if (s > 0.00001f) { + s = 1.0f / s; + x *= s; + y *= s; + z *= s; + w *= s; + } else { + // The quaternion is nearly zero. Make it 0 0 0 1 + x = 0.0f; + y = 0.0f; + z = 0.0f; + w = 1.0f; + } +} + + +void Quat::toAxisAngleRotation( + Vector3& axis, + double& angle) const { + + // Decompose the quaternion into an angle and an axis. + + axis = Vector3(x, y, z); + angle = 2 * acos(w); + + float len = sqrt(1.0f - w * w); + + if (fuzzyGt(abs(len), 0.0f)) { + axis /= len; + } + + // Reduce the range of the angle. + + if (angle < 0) { + angle = -angle; + axis = -axis; + } + + while (angle > twoPi()) { + angle -= twoPi(); + } + + if (abs(angle) > pi()) { + angle -= twoPi(); + } + + // Make the angle positive. + + if (angle < 0.0f) { + angle = -angle; + axis = -axis; + } +} + + +Matrix3 Quat::toRotationMatrix() const { + Matrix3 out = Matrix3::zero(); + + toRotationMatrix(out); + + return out; +} + + +void Quat::toRotationMatrix( + Matrix3& rot) const { + + rot = Matrix3(*this); +} + + +Quat Quat::slerp( + const Quat& _quat1, + float alpha, + float threshold) const { + + // From: Game Physics -- David Eberly pg 538-540 + // Modified to include lerp for small angles, which + // is a common practice. + + // See also: + // http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/index.html + + const Quat& quat0 = *this; + Quat quat1 = _quat1; + + // angle between quaternion rotations + float phi; + float cosphi = quat0.dot(quat1); + + + if (cosphi < 0) { + // Change the sign and fix the dot product; we need to + // loop the other way to get the shortest path + quat1 = -quat1; + cosphi = -cosphi; + } + + // Using G3D::aCos will clamp the angle to 0 and pi + phi = static_cast(G3D::aCos(cosphi)); + + if (phi >= threshold) { + // For large angles, slerp + float scale0, scale1; + + scale0 = sin((1.0f - alpha) * phi); + scale1 = sin(alpha * phi); + + return ( (quat0 * scale0) + (quat1 * scale1) ) / sin(phi); + } else { + // For small angles, linear interpolate + return quat0.nlerp(quat1, alpha); + } +} + + +Quat Quat::nlerp( + const Quat& quat1, + float alpha) const { + + Quat result = (*this) * (1.0f - alpha) + quat1 * alpha; + return result / result.magnitude(); +} + + +Quat Quat::operator*(const Quat& other) const { + + // Following Watt & Watt, page 360 + const Vector3& v1 = imag(); + const Vector3& v2 = other.imag(); + float s1 = w; + float s2 = other.w; + + return Quat(s1*v2 + s2*v1 + v1.cross(v2), s1*s2 - v1.dot(v2)); +} + + +// From "Uniform Random Rotations", Ken Shoemake, Graphics Gems III. +Quat Quat::unitRandom() { + float x0 = uniformRandom(); + float r1 = sqrtf(1 - x0), + r2 = sqrtf(x0); + float t1 = (float)G3D::twoPi() * uniformRandom(); + float t2 = (float)G3D::twoPi() * uniformRandom(); + float c1 = cosf(t1), + s1 = sinf(t1); + float c2 = cosf(t2), + s2 = sinf(t2); + return Quat(s1 * r1, c1 * r1, s2 * r2, c2 * r2); +} + + +void Quat::deserialize(class BinaryInput& b) { + x = b.readFloat32(); + y = b.readFloat32(); + z = b.readFloat32(); + w = b.readFloat32(); +} + + +void Quat::serialize(class BinaryOutput& b) const { + b.writeFloat32(x); + b.writeFloat32(y); + b.writeFloat32(z); + b.writeFloat32(w); +} + + +// 2-char swizzles + +Vector2 Quat::xx() const { return Vector2 (x, x); } +Vector2 Quat::yx() const { return Vector2 (y, x); } +Vector2 Quat::zx() const { return Vector2 (z, x); } +Vector2 Quat::wx() const { return Vector2 (w, x); } +Vector2 Quat::xy() const { return Vector2 (x, y); } +Vector2 Quat::yy() const { return Vector2 (y, y); } +Vector2 Quat::zy() const { return Vector2 (z, y); } +Vector2 Quat::wy() const { return Vector2 (w, y); } +Vector2 Quat::xz() const { return Vector2 (x, z); } +Vector2 Quat::yz() const { return Vector2 (y, z); } +Vector2 Quat::zz() const { return Vector2 (z, z); } +Vector2 Quat::wz() const { return Vector2 (w, z); } +Vector2 Quat::xw() const { return Vector2 (x, w); } +Vector2 Quat::yw() const { return Vector2 (y, w); } +Vector2 Quat::zw() const { return Vector2 (z, w); } +Vector2 Quat::ww() const { return Vector2 (w, w); } + +// 3-char swizzles + +Vector3 Quat::xxx() const { return Vector3 (x, x, x); } +Vector3 Quat::yxx() const { return Vector3 (y, x, x); } +Vector3 Quat::zxx() const { return Vector3 (z, x, x); } +Vector3 Quat::wxx() const { return Vector3 (w, x, x); } +Vector3 Quat::xyx() const { return Vector3 (x, y, x); } +Vector3 Quat::yyx() const { return Vector3 (y, y, x); } +Vector3 Quat::zyx() const { return Vector3 (z, y, x); } +Vector3 Quat::wyx() const { return Vector3 (w, y, x); } +Vector3 Quat::xzx() const { return Vector3 (x, z, x); } +Vector3 Quat::yzx() const { return Vector3 (y, z, x); } +Vector3 Quat::zzx() const { return Vector3 (z, z, x); } +Vector3 Quat::wzx() const { return Vector3 (w, z, x); } +Vector3 Quat::xwx() const { return Vector3 (x, w, x); } +Vector3 Quat::ywx() const { return Vector3 (y, w, x); } +Vector3 Quat::zwx() const { return Vector3 (z, w, x); } +Vector3 Quat::wwx() const { return Vector3 (w, w, x); } +Vector3 Quat::xxy() const { return Vector3 (x, x, y); } +Vector3 Quat::yxy() const { return Vector3 (y, x, y); } +Vector3 Quat::zxy() const { return Vector3 (z, x, y); } +Vector3 Quat::wxy() const { return Vector3 (w, x, y); } +Vector3 Quat::xyy() const { return Vector3 (x, y, y); } +Vector3 Quat::yyy() const { return Vector3 (y, y, y); } +Vector3 Quat::zyy() const { return Vector3 (z, y, y); } +Vector3 Quat::wyy() const { return Vector3 (w, y, y); } +Vector3 Quat::xzy() const { return Vector3 (x, z, y); } +Vector3 Quat::yzy() const { return Vector3 (y, z, y); } +Vector3 Quat::zzy() const { return Vector3 (z, z, y); } +Vector3 Quat::wzy() const { return Vector3 (w, z, y); } +Vector3 Quat::xwy() const { return Vector3 (x, w, y); } +Vector3 Quat::ywy() const { return Vector3 (y, w, y); } +Vector3 Quat::zwy() const { return Vector3 (z, w, y); } +Vector3 Quat::wwy() const { return Vector3 (w, w, y); } +Vector3 Quat::xxz() const { return Vector3 (x, x, z); } +Vector3 Quat::yxz() const { return Vector3 (y, x, z); } +Vector3 Quat::zxz() const { return Vector3 (z, x, z); } +Vector3 Quat::wxz() const { return Vector3 (w, x, z); } +Vector3 Quat::xyz() const { return Vector3 (x, y, z); } +Vector3 Quat::yyz() const { return Vector3 (y, y, z); } +Vector3 Quat::zyz() const { return Vector3 (z, y, z); } +Vector3 Quat::wyz() const { return Vector3 (w, y, z); } +Vector3 Quat::xzz() const { return Vector3 (x, z, z); } +Vector3 Quat::yzz() const { return Vector3 (y, z, z); } +Vector3 Quat::zzz() const { return Vector3 (z, z, z); } +Vector3 Quat::wzz() const { return Vector3 (w, z, z); } +Vector3 Quat::xwz() const { return Vector3 (x, w, z); } +Vector3 Quat::ywz() const { return Vector3 (y, w, z); } +Vector3 Quat::zwz() const { return Vector3 (z, w, z); } +Vector3 Quat::wwz() const { return Vector3 (w, w, z); } +Vector3 Quat::xxw() const { return Vector3 (x, x, w); } +Vector3 Quat::yxw() const { return Vector3 (y, x, w); } +Vector3 Quat::zxw() const { return Vector3 (z, x, w); } +Vector3 Quat::wxw() const { return Vector3 (w, x, w); } +Vector3 Quat::xyw() const { return Vector3 (x, y, w); } +Vector3 Quat::yyw() const { return Vector3 (y, y, w); } +Vector3 Quat::zyw() const { return Vector3 (z, y, w); } +Vector3 Quat::wyw() const { return Vector3 (w, y, w); } +Vector3 Quat::xzw() const { return Vector3 (x, z, w); } +Vector3 Quat::yzw() const { return Vector3 (y, z, w); } +Vector3 Quat::zzw() const { return Vector3 (z, z, w); } +Vector3 Quat::wzw() const { return Vector3 (w, z, w); } +Vector3 Quat::xww() const { return Vector3 (x, w, w); } +Vector3 Quat::yww() const { return Vector3 (y, w, w); } +Vector3 Quat::zww() const { return Vector3 (z, w, w); } +Vector3 Quat::www() const { return Vector3 (w, w, w); } + +// 4-char swizzles + +Vector4 Quat::xxxx() const { return Vector4 (x, x, x, x); } +Vector4 Quat::yxxx() const { return Vector4 (y, x, x, x); } +Vector4 Quat::zxxx() const { return Vector4 (z, x, x, x); } +Vector4 Quat::wxxx() const { return Vector4 (w, x, x, x); } +Vector4 Quat::xyxx() const { return Vector4 (x, y, x, x); } +Vector4 Quat::yyxx() const { return Vector4 (y, y, x, x); } +Vector4 Quat::zyxx() const { return Vector4 (z, y, x, x); } +Vector4 Quat::wyxx() const { return Vector4 (w, y, x, x); } +Vector4 Quat::xzxx() const { return Vector4 (x, z, x, x); } +Vector4 Quat::yzxx() const { return Vector4 (y, z, x, x); } +Vector4 Quat::zzxx() const { return Vector4 (z, z, x, x); } +Vector4 Quat::wzxx() const { return Vector4 (w, z, x, x); } +Vector4 Quat::xwxx() const { return Vector4 (x, w, x, x); } +Vector4 Quat::ywxx() const { return Vector4 (y, w, x, x); } +Vector4 Quat::zwxx() const { return Vector4 (z, w, x, x); } +Vector4 Quat::wwxx() const { return Vector4 (w, w, x, x); } +Vector4 Quat::xxyx() const { return Vector4 (x, x, y, x); } +Vector4 Quat::yxyx() const { return Vector4 (y, x, y, x); } +Vector4 Quat::zxyx() const { return Vector4 (z, x, y, x); } +Vector4 Quat::wxyx() const { return Vector4 (w, x, y, x); } +Vector4 Quat::xyyx() const { return Vector4 (x, y, y, x); } +Vector4 Quat::yyyx() const { return Vector4 (y, y, y, x); } +Vector4 Quat::zyyx() const { return Vector4 (z, y, y, x); } +Vector4 Quat::wyyx() const { return Vector4 (w, y, y, x); } +Vector4 Quat::xzyx() const { return Vector4 (x, z, y, x); } +Vector4 Quat::yzyx() const { return Vector4 (y, z, y, x); } +Vector4 Quat::zzyx() const { return Vector4 (z, z, y, x); } +Vector4 Quat::wzyx() const { return Vector4 (w, z, y, x); } +Vector4 Quat::xwyx() const { return Vector4 (x, w, y, x); } +Vector4 Quat::ywyx() const { return Vector4 (y, w, y, x); } +Vector4 Quat::zwyx() const { return Vector4 (z, w, y, x); } +Vector4 Quat::wwyx() const { return Vector4 (w, w, y, x); } +Vector4 Quat::xxzx() const { return Vector4 (x, x, z, x); } +Vector4 Quat::yxzx() const { return Vector4 (y, x, z, x); } +Vector4 Quat::zxzx() const { return Vector4 (z, x, z, x); } +Vector4 Quat::wxzx() const { return Vector4 (w, x, z, x); } +Vector4 Quat::xyzx() const { return Vector4 (x, y, z, x); } +Vector4 Quat::yyzx() const { return Vector4 (y, y, z, x); } +Vector4 Quat::zyzx() const { return Vector4 (z, y, z, x); } +Vector4 Quat::wyzx() const { return Vector4 (w, y, z, x); } +Vector4 Quat::xzzx() const { return Vector4 (x, z, z, x); } +Vector4 Quat::yzzx() const { return Vector4 (y, z, z, x); } +Vector4 Quat::zzzx() const { return Vector4 (z, z, z, x); } +Vector4 Quat::wzzx() const { return Vector4 (w, z, z, x); } +Vector4 Quat::xwzx() const { return Vector4 (x, w, z, x); } +Vector4 Quat::ywzx() const { return Vector4 (y, w, z, x); } +Vector4 Quat::zwzx() const { return Vector4 (z, w, z, x); } +Vector4 Quat::wwzx() const { return Vector4 (w, w, z, x); } +Vector4 Quat::xxwx() const { return Vector4 (x, x, w, x); } +Vector4 Quat::yxwx() const { return Vector4 (y, x, w, x); } +Vector4 Quat::zxwx() const { return Vector4 (z, x, w, x); } +Vector4 Quat::wxwx() const { return Vector4 (w, x, w, x); } +Vector4 Quat::xywx() const { return Vector4 (x, y, w, x); } +Vector4 Quat::yywx() const { return Vector4 (y, y, w, x); } +Vector4 Quat::zywx() const { return Vector4 (z, y, w, x); } +Vector4 Quat::wywx() const { return Vector4 (w, y, w, x); } +Vector4 Quat::xzwx() const { return Vector4 (x, z, w, x); } +Vector4 Quat::yzwx() const { return Vector4 (y, z, w, x); } +Vector4 Quat::zzwx() const { return Vector4 (z, z, w, x); } +Vector4 Quat::wzwx() const { return Vector4 (w, z, w, x); } +Vector4 Quat::xwwx() const { return Vector4 (x, w, w, x); } +Vector4 Quat::ywwx() const { return Vector4 (y, w, w, x); } +Vector4 Quat::zwwx() const { return Vector4 (z, w, w, x); } +Vector4 Quat::wwwx() const { return Vector4 (w, w, w, x); } +Vector4 Quat::xxxy() const { return Vector4 (x, x, x, y); } +Vector4 Quat::yxxy() const { return Vector4 (y, x, x, y); } +Vector4 Quat::zxxy() const { return Vector4 (z, x, x, y); } +Vector4 Quat::wxxy() const { return Vector4 (w, x, x, y); } +Vector4 Quat::xyxy() const { return Vector4 (x, y, x, y); } +Vector4 Quat::yyxy() const { return Vector4 (y, y, x, y); } +Vector4 Quat::zyxy() const { return Vector4 (z, y, x, y); } +Vector4 Quat::wyxy() const { return Vector4 (w, y, x, y); } +Vector4 Quat::xzxy() const { return Vector4 (x, z, x, y); } +Vector4 Quat::yzxy() const { return Vector4 (y, z, x, y); } +Vector4 Quat::zzxy() const { return Vector4 (z, z, x, y); } +Vector4 Quat::wzxy() const { return Vector4 (w, z, x, y); } +Vector4 Quat::xwxy() const { return Vector4 (x, w, x, y); } +Vector4 Quat::ywxy() const { return Vector4 (y, w, x, y); } +Vector4 Quat::zwxy() const { return Vector4 (z, w, x, y); } +Vector4 Quat::wwxy() const { return Vector4 (w, w, x, y); } +Vector4 Quat::xxyy() const { return Vector4 (x, x, y, y); } +Vector4 Quat::yxyy() const { return Vector4 (y, x, y, y); } +Vector4 Quat::zxyy() const { return Vector4 (z, x, y, y); } +Vector4 Quat::wxyy() const { return Vector4 (w, x, y, y); } +Vector4 Quat::xyyy() const { return Vector4 (x, y, y, y); } +Vector4 Quat::yyyy() const { return Vector4 (y, y, y, y); } +Vector4 Quat::zyyy() const { return Vector4 (z, y, y, y); } +Vector4 Quat::wyyy() const { return Vector4 (w, y, y, y); } +Vector4 Quat::xzyy() const { return Vector4 (x, z, y, y); } +Vector4 Quat::yzyy() const { return Vector4 (y, z, y, y); } +Vector4 Quat::zzyy() const { return Vector4 (z, z, y, y); } +Vector4 Quat::wzyy() const { return Vector4 (w, z, y, y); } +Vector4 Quat::xwyy() const { return Vector4 (x, w, y, y); } +Vector4 Quat::ywyy() const { return Vector4 (y, w, y, y); } +Vector4 Quat::zwyy() const { return Vector4 (z, w, y, y); } +Vector4 Quat::wwyy() const { return Vector4 (w, w, y, y); } +Vector4 Quat::xxzy() const { return Vector4 (x, x, z, y); } +Vector4 Quat::yxzy() const { return Vector4 (y, x, z, y); } +Vector4 Quat::zxzy() const { return Vector4 (z, x, z, y); } +Vector4 Quat::wxzy() const { return Vector4 (w, x, z, y); } +Vector4 Quat::xyzy() const { return Vector4 (x, y, z, y); } +Vector4 Quat::yyzy() const { return Vector4 (y, y, z, y); } +Vector4 Quat::zyzy() const { return Vector4 (z, y, z, y); } +Vector4 Quat::wyzy() const { return Vector4 (w, y, z, y); } +Vector4 Quat::xzzy() const { return Vector4 (x, z, z, y); } +Vector4 Quat::yzzy() const { return Vector4 (y, z, z, y); } +Vector4 Quat::zzzy() const { return Vector4 (z, z, z, y); } +Vector4 Quat::wzzy() const { return Vector4 (w, z, z, y); } +Vector4 Quat::xwzy() const { return Vector4 (x, w, z, y); } +Vector4 Quat::ywzy() const { return Vector4 (y, w, z, y); } +Vector4 Quat::zwzy() const { return Vector4 (z, w, z, y); } +Vector4 Quat::wwzy() const { return Vector4 (w, w, z, y); } +Vector4 Quat::xxwy() const { return Vector4 (x, x, w, y); } +Vector4 Quat::yxwy() const { return Vector4 (y, x, w, y); } +Vector4 Quat::zxwy() const { return Vector4 (z, x, w, y); } +Vector4 Quat::wxwy() const { return Vector4 (w, x, w, y); } +Vector4 Quat::xywy() const { return Vector4 (x, y, w, y); } +Vector4 Quat::yywy() const { return Vector4 (y, y, w, y); } +Vector4 Quat::zywy() const { return Vector4 (z, y, w, y); } +Vector4 Quat::wywy() const { return Vector4 (w, y, w, y); } +Vector4 Quat::xzwy() const { return Vector4 (x, z, w, y); } +Vector4 Quat::yzwy() const { return Vector4 (y, z, w, y); } +Vector4 Quat::zzwy() const { return Vector4 (z, z, w, y); } +Vector4 Quat::wzwy() const { return Vector4 (w, z, w, y); } +Vector4 Quat::xwwy() const { return Vector4 (x, w, w, y); } +Vector4 Quat::ywwy() const { return Vector4 (y, w, w, y); } +Vector4 Quat::zwwy() const { return Vector4 (z, w, w, y); } +Vector4 Quat::wwwy() const { return Vector4 (w, w, w, y); } +Vector4 Quat::xxxz() const { return Vector4 (x, x, x, z); } +Vector4 Quat::yxxz() const { return Vector4 (y, x, x, z); } +Vector4 Quat::zxxz() const { return Vector4 (z, x, x, z); } +Vector4 Quat::wxxz() const { return Vector4 (w, x, x, z); } +Vector4 Quat::xyxz() const { return Vector4 (x, y, x, z); } +Vector4 Quat::yyxz() const { return Vector4 (y, y, x, z); } +Vector4 Quat::zyxz() const { return Vector4 (z, y, x, z); } +Vector4 Quat::wyxz() const { return Vector4 (w, y, x, z); } +Vector4 Quat::xzxz() const { return Vector4 (x, z, x, z); } +Vector4 Quat::yzxz() const { return Vector4 (y, z, x, z); } +Vector4 Quat::zzxz() const { return Vector4 (z, z, x, z); } +Vector4 Quat::wzxz() const { return Vector4 (w, z, x, z); } +Vector4 Quat::xwxz() const { return Vector4 (x, w, x, z); } +Vector4 Quat::ywxz() const { return Vector4 (y, w, x, z); } +Vector4 Quat::zwxz() const { return Vector4 (z, w, x, z); } +Vector4 Quat::wwxz() const { return Vector4 (w, w, x, z); } +Vector4 Quat::xxyz() const { return Vector4 (x, x, y, z); } +Vector4 Quat::yxyz() const { return Vector4 (y, x, y, z); } +Vector4 Quat::zxyz() const { return Vector4 (z, x, y, z); } +Vector4 Quat::wxyz() const { return Vector4 (w, x, y, z); } +Vector4 Quat::xyyz() const { return Vector4 (x, y, y, z); } +Vector4 Quat::yyyz() const { return Vector4 (y, y, y, z); } +Vector4 Quat::zyyz() const { return Vector4 (z, y, y, z); } +Vector4 Quat::wyyz() const { return Vector4 (w, y, y, z); } +Vector4 Quat::xzyz() const { return Vector4 (x, z, y, z); } +Vector4 Quat::yzyz() const { return Vector4 (y, z, y, z); } +Vector4 Quat::zzyz() const { return Vector4 (z, z, y, z); } +Vector4 Quat::wzyz() const { return Vector4 (w, z, y, z); } +Vector4 Quat::xwyz() const { return Vector4 (x, w, y, z); } +Vector4 Quat::ywyz() const { return Vector4 (y, w, y, z); } +Vector4 Quat::zwyz() const { return Vector4 (z, w, y, z); } +Vector4 Quat::wwyz() const { return Vector4 (w, w, y, z); } +Vector4 Quat::xxzz() const { return Vector4 (x, x, z, z); } +Vector4 Quat::yxzz() const { return Vector4 (y, x, z, z); } +Vector4 Quat::zxzz() const { return Vector4 (z, x, z, z); } +Vector4 Quat::wxzz() const { return Vector4 (w, x, z, z); } +Vector4 Quat::xyzz() const { return Vector4 (x, y, z, z); } +Vector4 Quat::yyzz() const { return Vector4 (y, y, z, z); } +Vector4 Quat::zyzz() const { return Vector4 (z, y, z, z); } +Vector4 Quat::wyzz() const { return Vector4 (w, y, z, z); } +Vector4 Quat::xzzz() const { return Vector4 (x, z, z, z); } +Vector4 Quat::yzzz() const { return Vector4 (y, z, z, z); } +Vector4 Quat::zzzz() const { return Vector4 (z, z, z, z); } +Vector4 Quat::wzzz() const { return Vector4 (w, z, z, z); } +Vector4 Quat::xwzz() const { return Vector4 (x, w, z, z); } +Vector4 Quat::ywzz() const { return Vector4 (y, w, z, z); } +Vector4 Quat::zwzz() const { return Vector4 (z, w, z, z); } +Vector4 Quat::wwzz() const { return Vector4 (w, w, z, z); } +Vector4 Quat::xxwz() const { return Vector4 (x, x, w, z); } +Vector4 Quat::yxwz() const { return Vector4 (y, x, w, z); } +Vector4 Quat::zxwz() const { return Vector4 (z, x, w, z); } +Vector4 Quat::wxwz() const { return Vector4 (w, x, w, z); } +Vector4 Quat::xywz() const { return Vector4 (x, y, w, z); } +Vector4 Quat::yywz() const { return Vector4 (y, y, w, z); } +Vector4 Quat::zywz() const { return Vector4 (z, y, w, z); } +Vector4 Quat::wywz() const { return Vector4 (w, y, w, z); } +Vector4 Quat::xzwz() const { return Vector4 (x, z, w, z); } +Vector4 Quat::yzwz() const { return Vector4 (y, z, w, z); } +Vector4 Quat::zzwz() const { return Vector4 (z, z, w, z); } +Vector4 Quat::wzwz() const { return Vector4 (w, z, w, z); } +Vector4 Quat::xwwz() const { return Vector4 (x, w, w, z); } +Vector4 Quat::ywwz() const { return Vector4 (y, w, w, z); } +Vector4 Quat::zwwz() const { return Vector4 (z, w, w, z); } +Vector4 Quat::wwwz() const { return Vector4 (w, w, w, z); } +Vector4 Quat::xxxw() const { return Vector4 (x, x, x, w); } +Vector4 Quat::yxxw() const { return Vector4 (y, x, x, w); } +Vector4 Quat::zxxw() const { return Vector4 (z, x, x, w); } +Vector4 Quat::wxxw() const { return Vector4 (w, x, x, w); } +Vector4 Quat::xyxw() const { return Vector4 (x, y, x, w); } +Vector4 Quat::yyxw() const { return Vector4 (y, y, x, w); } +Vector4 Quat::zyxw() const { return Vector4 (z, y, x, w); } +Vector4 Quat::wyxw() const { return Vector4 (w, y, x, w); } +Vector4 Quat::xzxw() const { return Vector4 (x, z, x, w); } +Vector4 Quat::yzxw() const { return Vector4 (y, z, x, w); } +Vector4 Quat::zzxw() const { return Vector4 (z, z, x, w); } +Vector4 Quat::wzxw() const { return Vector4 (w, z, x, w); } +Vector4 Quat::xwxw() const { return Vector4 (x, w, x, w); } +Vector4 Quat::ywxw() const { return Vector4 (y, w, x, w); } +Vector4 Quat::zwxw() const { return Vector4 (z, w, x, w); } +Vector4 Quat::wwxw() const { return Vector4 (w, w, x, w); } +Vector4 Quat::xxyw() const { return Vector4 (x, x, y, w); } +Vector4 Quat::yxyw() const { return Vector4 (y, x, y, w); } +Vector4 Quat::zxyw() const { return Vector4 (z, x, y, w); } +Vector4 Quat::wxyw() const { return Vector4 (w, x, y, w); } +Vector4 Quat::xyyw() const { return Vector4 (x, y, y, w); } +Vector4 Quat::yyyw() const { return Vector4 (y, y, y, w); } +Vector4 Quat::zyyw() const { return Vector4 (z, y, y, w); } +Vector4 Quat::wyyw() const { return Vector4 (w, y, y, w); } +Vector4 Quat::xzyw() const { return Vector4 (x, z, y, w); } +Vector4 Quat::yzyw() const { return Vector4 (y, z, y, w); } +Vector4 Quat::zzyw() const { return Vector4 (z, z, y, w); } +Vector4 Quat::wzyw() const { return Vector4 (w, z, y, w); } +Vector4 Quat::xwyw() const { return Vector4 (x, w, y, w); } +Vector4 Quat::ywyw() const { return Vector4 (y, w, y, w); } +Vector4 Quat::zwyw() const { return Vector4 (z, w, y, w); } +Vector4 Quat::wwyw() const { return Vector4 (w, w, y, w); } +Vector4 Quat::xxzw() const { return Vector4 (x, x, z, w); } +Vector4 Quat::yxzw() const { return Vector4 (y, x, z, w); } +Vector4 Quat::zxzw() const { return Vector4 (z, x, z, w); } +Vector4 Quat::wxzw() const { return Vector4 (w, x, z, w); } +Vector4 Quat::xyzw() const { return Vector4 (x, y, z, w); } +Vector4 Quat::yyzw() const { return Vector4 (y, y, z, w); } +Vector4 Quat::zyzw() const { return Vector4 (z, y, z, w); } +Vector4 Quat::wyzw() const { return Vector4 (w, y, z, w); } +Vector4 Quat::xzzw() const { return Vector4 (x, z, z, w); } +Vector4 Quat::yzzw() const { return Vector4 (y, z, z, w); } +Vector4 Quat::zzzw() const { return Vector4 (z, z, z, w); } +Vector4 Quat::wzzw() const { return Vector4 (w, z, z, w); } +Vector4 Quat::xwzw() const { return Vector4 (x, w, z, w); } +Vector4 Quat::ywzw() const { return Vector4 (y, w, z, w); } +Vector4 Quat::zwzw() const { return Vector4 (z, w, z, w); } +Vector4 Quat::wwzw() const { return Vector4 (w, w, z, w); } +Vector4 Quat::xxww() const { return Vector4 (x, x, w, w); } +Vector4 Quat::yxww() const { return Vector4 (y, x, w, w); } +Vector4 Quat::zxww() const { return Vector4 (z, x, w, w); } +Vector4 Quat::wxww() const { return Vector4 (w, x, w, w); } +Vector4 Quat::xyww() const { return Vector4 (x, y, w, w); } +Vector4 Quat::yyww() const { return Vector4 (y, y, w, w); } +Vector4 Quat::zyww() const { return Vector4 (z, y, w, w); } +Vector4 Quat::wyww() const { return Vector4 (w, y, w, w); } +Vector4 Quat::xzww() const { return Vector4 (x, z, w, w); } +Vector4 Quat::yzww() const { return Vector4 (y, z, w, w); } +Vector4 Quat::zzww() const { return Vector4 (z, z, w, w); } +Vector4 Quat::wzww() const { return Vector4 (w, z, w, w); } +Vector4 Quat::xwww() const { return Vector4 (x, w, w, w); } +Vector4 Quat::ywww() const { return Vector4 (y, w, w, w); } +Vector4 Quat::zwww() const { return Vector4 (z, w, w, w); } +Vector4 Quat::wwww() const { return Vector4 (w, w, w, w); } +} + diff --git a/externals/g3dlite/Random.cpp b/externals/g3dlite/Random.cpp new file mode 100644 index 0000000..2dda744 --- /dev/null +++ b/externals/g3dlite/Random.cpp @@ -0,0 +1,212 @@ +/** + @file Random.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2009-01-02 + @edited 2009-03-29 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ +#include "G3D/Random.h" + +namespace G3D { + +Random& Random::common() { + static Random r; + return r; +} + +Random::Random(void* x) : state(NULL), m_threadsafe(false) { + (void)x; +} + + +Random::Random(uint32 seed, bool threadsafe) : m_threadsafe(threadsafe) { + const uint32 X = 1812433253UL; + + state = new uint32[N]; + state[0] = seed; + for (index = 1; index < (int)N; ++index) { + state[index] = X * (state[index - 1] ^ (state[index - 1] >> 30)) + index; + } +} + + +Random::~Random() { + delete[] state; + state = NULL; +} + + +uint32 Random::bits() { + // See http://en.wikipedia.org/wiki/Mersenne_twister + + // Make a local copy of the index variable to ensure that it + // is not out of bounds + int localIndex = index; + + // Automatically checks for index < 0 if corrupted + // by unsynchronized threads. + if ((unsigned int)localIndex >= (unsigned int)N) { + generate(); + localIndex = 0; + } + // Increment the global index. It may go out of bounds on + // multiple threads, but the above check ensures that the + // array index actually used never goes out of bounds. + // It doesn't matter if we grab the same array index twice + // on two threads, since the distribution of random numbers + // will still be uniform. + ++index; + // Return the next random in the sequence + uint32 r = state[localIndex]; + + // Temper the result + r ^= r >> U; + r ^= (r << S) & B; + r ^= (r << T) & C; + r ^= r >> L; + + return r; +} + + +/** Generate the next N ints, and store them for readback later */ +void Random::generate() { + // Lower R bits + static const uint32 LOWER_MASK = (1LU << R) - 1; + + // Upper (32 - R) bits + static const uint32 UPPER_MASK = 0xFFFFFFFF << R; + static const uint32 mag01[2] = {0UL, (uint32)A}; + + if (m_threadsafe) { + bool contention = ! lock.lock(); + if (contention) { + // Another thread just generated a set of numbers; no need for + // this thread to do it too + lock.unlock(); + return; + } + } + + // First N - M + for (unsigned int i = 0; i < N - M; ++i) { + uint32 x = (state[i] & UPPER_MASK) | (state[i + 1] & LOWER_MASK); + state[i] = state[i + M] ^ (x >> 1) ^ mag01[x & 1]; + } + + // Rest + for (unsigned int i = N - M + 1; i < N - 1; ++i) { + uint32 x = (state[i] & UPPER_MASK) | (state[i + 1] & LOWER_MASK); + state[i] = state[i + (M - N)] ^ (x >> 1) ^ mag01[x & 1]; + } + + uint32 y = (state[N - 1] & UPPER_MASK) | (state[0] & LOWER_MASK); + state[N - 1] = state[M - 1] ^ (y >> 1) ^ mag01[y & 1]; + index = 0; + + if (m_threadsafe) { + lock.unlock(); + } +} + + +int Random::integer(int low, int high) { + int r = iFloor(low + (high - low + 1) * (double)bits() / 0xFFFFFFFFUL); + + // There is a *very small* chance of generating + // a number larger than high. + if (r > high) { + return high; + } else { + return r; + } +} + + +float Random::gaussian(float mean, float stdev) { + + // Using Box-Mueller method from http://www.taygeta.com/random/gaussian.html + // Modified to specify standard deviation and mean of distribution + float w, x1, x2; + + // Loop until w is less than 1 so that log(w) is negative + do { + x1 = uniform(-1.0, 1.0); + x2 = uniform(-1.0, 1.0); + + w = float(square(x1) + square(x2)); + } while (w > 1.0f); + + // Transform to gassian distribution + // Multiply by sigma (stdev ^ 2) and add mean. + return x2 * (float)square(stdev) * sqrtf((-2.0f * logf(w) ) / w) + mean; +} + + +void Random::cosHemi(float& x, float& y, float& z) { + const float e1 = uniform(); + const float e2 = uniform(); + + // Jensen's method + const float sin_theta = sqrtf(1.0f - e1); + const float cos_theta = sqrtf(e1); + const float phi = 6.28318531f * e2; + + x = cos(phi) * sin_theta; + y = sin(phi) * sin_theta; + z = cos_theta; + + // We could also use Malley's method (pbrt p.657), since they are the same cost: + // + // r = sqrt(e1); + // t = 2*pi*e2; + // x = cos(t)*r; + // y = sin(t)*r; + // z = sqrt(1.0 - x*x + y*y); +} + + +void Random::cosPowHemi(const float k, float& x, float& y, float& z) { + const float e1 = uniform(); + const float e2 = uniform(); + + const float cos_theta = pow(e1, 1.0f / (k + 1.0f)); + const float sin_theta = sqrtf(1.0f - square(cos_theta)); + const float phi = 6.28318531f * e2; + + x = cos(phi) * sin_theta; + y = sin(phi) * sin_theta; + z = cos_theta; +} + + +void Random::hemi(float& x, float& y, float& z) { + sphere(x, y, z); + z = fabsf(z); +} + + +void Random::sphere(float& x, float& y, float& z) { + // Squared magnitude + float m2; + + // Rejection sample + do { + x = uniform() * 2.0f - 1.0f, + y = uniform() * 2.0f - 1.0f, + z = uniform() * 2.0f - 1.0f; + m2 = x*x + y*y + z*z; + } while (m2 >= 1.0f); + + // Divide by magnitude to produce a unit vector + float s = rsqrt(m2); + x *= s; + y *= s; + z *= s; +} + +} // G3D diff --git a/externals/g3dlite/Ray.cpp b/externals/g3dlite/Ray.cpp new file mode 100644 index 0000000..0436ef0 --- /dev/null +++ b/externals/g3dlite/Ray.cpp @@ -0,0 +1,218 @@ +/** + @file Ray.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2002-07-12 + @edited 2004-03-19 + */ + +#include "G3D/platform.h" +#include "G3D/Ray.h" +#include "G3D/Plane.h" +#include "G3D/Sphere.h" +#include "G3D/CollisionDetection.h" + +namespace G3D { + +void Ray::set(const Vector3& origin, const Vector3& direction) { + m_origin = origin; + m_direction = direction; + debugAssert(direction.isUnit()); + + m_invDirection = Vector3::one() / direction; + + // ray slope + ibyj = m_direction.x * m_invDirection.y; + jbyi = m_direction.y * m_invDirection.x; + jbyk = m_direction.y * m_invDirection.z; + kbyj = m_direction.z * m_invDirection.y; + ibyk = m_direction.x * m_invDirection.z; + kbyi = m_direction.z * m_invDirection.x; + + // precomputed terms + c_xy = m_origin.y - jbyi * m_origin.x; + c_xz = m_origin.z - kbyi * m_origin.x; + c_yx = m_origin.x - ibyj * m_origin.y; + c_yz = m_origin.z - kbyj * m_origin.y; + c_zx = m_origin.x - ibyk * m_origin.z; + c_zy = m_origin.y - jbyk * m_origin.z; + + //ray slope classification + if (m_direction.x < 0) { + if (m_direction.y < 0) { + if (m_direction.z < 0) { + classification = MMM; + } else if (m_direction.z > 0) { + classification = MMP; + } else { //(m_direction.z >= 0) + classification = MMO; + } + } else { //(m_direction.y >= 0) + if (m_direction.z < 0) { + if (m_direction.y == 0) { + classification = MOM; + } else { + classification = MPM; + } + } else { //(m_direction.z >= 0) + if ((m_direction.y == 0) && (m_direction.z == 0)) { + classification = MOO; + } else if (m_direction.z == 0) { + classification = MPO; + } else if (m_direction.y == 0) { + classification = MOP; + } else { + classification = MPP; + } + } + } + } else { //(m_direction.x >= 0) + if (m_direction.y < 0) { + if (m_direction.z < 0) { + if (m_direction.x == 0) { + classification = OMM; + } else { + classification = PMM; + } + } else { //(m_direction.z >= 0) + if ((m_direction.x == 0) && (m_direction.z == 0)) { + classification = OMO; + } else if (m_direction.z == 0) { + classification = PMO; + } else if (m_direction.x == 0) { + classification = OMP; + } else { + classification = PMP; + } + } + } else { //(m_direction.y >= 0) + if (m_direction.z < 0) { + if ((m_direction.x == 0) && (m_direction.y == 0)) { + classification = OOM; + } else if (m_direction.x == 0) { + classification = OPM; + } else if (m_direction.y == 0) { + classification = POM; + } else { + classification = PPM; + } + } else { //(m_direction.z > 0) + if (m_direction.x == 0) { + if (m_direction.y == 0) { + classification = OOP; + } else if (m_direction.z == 0) { + classification = OPO; + } else { + classification = OPP; + } + } else { + if ((m_direction.y == 0) && (m_direction.z == 0)) { + classification = POO; + } else if (m_direction.y == 0) { + classification = POP; + } else if (m_direction.z == 0) { + classification = PPO; + } else { + classification = PPP; + } + } + } + } + } +} + +Ray::Ray(class BinaryInput& b) { + deserialize(b); +} + + +void Ray::serialize(class BinaryOutput& b) const { + m_origin.serialize(b); + m_direction.serialize(b); +} + + +void Ray::deserialize(class BinaryInput& b) { + m_origin.deserialize(b); + m_direction.deserialize(b); + set(m_origin, m_direction); +} + + +Ray Ray::refract( + const Vector3& newOrigin, + const Vector3& normal, + float iInside, + float iOutside) const { + + Vector3 D = m_direction.refractionDirection(normal, iInside, iOutside); + return Ray(newOrigin + (m_direction + normal * (float)sign(m_direction.dot(normal))) * 0.001f, D); +} + + +Ray Ray::reflect( + const Vector3& newOrigin, + const Vector3& normal) const { + + Vector3 D = m_direction.reflectionDirection(normal); + return Ray(newOrigin + (D + normal) * 0.001f, D); +} + + +Vector3 Ray::intersection(const Plane& plane) const { + float d; + Vector3 normal = plane.normal(); + plane.getEquation(normal, d); + float rate = m_direction.dot(normal); + + if (rate >= 0.0f) { + return Vector3::inf(); + } else { + float t = -(d + m_origin.dot(normal)) / rate; + return m_origin + m_direction * t; + } +} + + +float Ray::intersectionTime(const class Sphere& sphere, bool solid) const { + Vector3 dummy; + return CollisionDetection::collisionTimeForMovingPointFixedSphere( + m_origin, m_direction, sphere, dummy, dummy, solid); +} + + +float Ray::intersectionTime(const class Plane& plane) const { + Vector3 dummy; + return CollisionDetection::collisionTimeForMovingPointFixedPlane( + m_origin, m_direction, plane, dummy); +} + + +float Ray::intersectionTime(const class Box& box) const { + Vector3 dummy; + float time = CollisionDetection::collisionTimeForMovingPointFixedBox( + m_origin, m_direction, box, dummy); + + if ((time == finf()) && (box.contains(m_origin))) { + return 0.0f; + } else { + return time; + } +} + + +float Ray::intersectionTime(const class AABox& box) const { + Vector3 dummy; + bool inside; + float time = CollisionDetection::collisionTimeForMovingPointFixedAABox( + m_origin, m_direction, box, dummy, inside); + + if ((time == finf()) && inside) { + return 0.0f; + } else { + return time; + } +} + +} diff --git a/externals/g3dlite/ReferenceCount.cpp b/externals/g3dlite/ReferenceCount.cpp new file mode 100644 index 0000000..2e1f117 --- /dev/null +++ b/externals/g3dlite/ReferenceCount.cpp @@ -0,0 +1,61 @@ +/** + @file ReferenceCount.cpp + + Reference Counting Garbage Collector for C++ + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @cite Adapted and extended from Justin Miller's "RGC" class that appeared in BYTE magazine. + @cite See also http://www.jelovic.com/articles/cpp_without_memory_errors_slides.htm + + @created 2001-10-23 + @edited 2009-04-25 +*/ +#include "G3D/platform.h" +#include "G3D/ReferenceCount.h" + +namespace G3D { + +ReferenceCountedObject::ReferenceCountedObject() : + ReferenceCountedObject_refCount(0), + ReferenceCountedObject_weakPointer(0) { + + debugAssertM(isValidHeapPointer(this), + "Reference counted objects must be allocated on the heap."); +} + +void ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers() { + // Tell all of my weak pointers that I'm gone. + + _WeakPtrLinkedList* node = ReferenceCountedObject_weakPointer; + + while (node != NULL) { + // Notify the weak pointer that it is going away + node->weakPtr->objectCollected(); + + // Free the node and advance + _WeakPtrLinkedList* tmp = node; + node = node->next; + delete tmp; + } +} + +ReferenceCountedObject::~ReferenceCountedObject() {} + + +ReferenceCountedObject::ReferenceCountedObject(const ReferenceCountedObject& notUsed) : + ReferenceCountedObject_refCount(0), + ReferenceCountedObject_weakPointer(0) { + (void)notUsed; + debugAssertM(G3D::isValidHeapPointer(this), + "Reference counted objects must be allocated on the heap."); +} + +ReferenceCountedObject& ReferenceCountedObject::operator=(const ReferenceCountedObject& other) { + (void)other; + // Nothing changes when I am assigned; the reference count on + // both objects is the same (although my super-class probably + // changes). + return *this; +} + +} // G3D diff --git a/externals/g3dlite/RegistryUtil.cpp b/externals/g3dlite/RegistryUtil.cpp new file mode 100644 index 0000000..fc4cebc --- /dev/null +++ b/externals/g3dlite/RegistryUtil.cpp @@ -0,0 +1,290 @@ +/** + @file RegistryUtil.cpp + + @created 2006-04-06 + @edited 2006-04-24 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. +*/ + +#include "G3D/platform.h" + +// This file is only used on Windows +#ifdef G3D_WIN32 + +#include "G3D/RegistryUtil.h" +#include "G3D/System.h" + +namespace G3D { + +// static helpers +static HKEY getRootKeyFromString(const char* str, size_t length); + + +bool RegistryUtil::keyExists(const std::string& key) { + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if (hkey == NULL) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_READ, &openKey); + + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + RegCloseKey(openKey); + return true; + } else { + return false; + } +} + +bool RegistryUtil::valueExists(const std::string& key, const std::string& value) { + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if ( hkey == NULL ) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_READ, &openKey); + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + uint32 dataSize = 0; + result = RegQueryValueExA(openKey, value.c_str(), NULL, NULL, NULL, reinterpret_cast(&dataSize)); + + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + RegCloseKey(openKey); + } + return (result == ERROR_SUCCESS); +} + + +bool RegistryUtil::readInt32(const std::string& key, const std::string& value, int32& data) { + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if ( hkey == NULL ) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_READ, &openKey); + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + uint32 dataSize = sizeof(int32); + result = RegQueryValueExA(openKey, value.c_str(), NULL, NULL, reinterpret_cast(&data), reinterpret_cast(&dataSize)); + + debugAssertM(result == ERROR_SUCCESS, "Could not read registry key value."); + + RegCloseKey(openKey); + } + return (result == ERROR_SUCCESS); +} + +bool RegistryUtil::readBytes(const std::string& key, const std::string& value, uint8* data, uint32& dataSize) { + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if (hkey == NULL) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_READ, &openKey); + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + if (data == NULL) { + result = RegQueryValueExA(openKey, value.c_str(), NULL, NULL, NULL, reinterpret_cast(&dataSize)); + } else { + result = RegQueryValueExA(openKey, value.c_str(), NULL, NULL, reinterpret_cast(&data), reinterpret_cast(&dataSize)); + } + + debugAssertM(result == ERROR_SUCCESS, "Could not read registry key value."); + + RegCloseKey(openKey); + } + return (result == ERROR_SUCCESS); +} + +bool RegistryUtil::readString(const std::string& key, const std::string& value, std::string& data) { + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if (hkey == NULL) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_READ, &openKey); + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + uint32 dataSize = 0; + + result = RegQueryValueExA(openKey, value.c_str(), NULL, NULL, NULL, reinterpret_cast(&dataSize)); + debugAssertM(result == ERROR_SUCCESS, "Could not read registry key value."); + + // increment datasize to allow for non null-terminated strings in registry + dataSize += 1; + + if (result == ERROR_SUCCESS) { + char* tmpStr = static_cast(System::malloc(dataSize)); + System::memset(tmpStr, 0, dataSize); + + result = RegQueryValueExA(openKey, value.c_str(), NULL, NULL, reinterpret_cast(tmpStr), reinterpret_cast(&dataSize)); + debugAssertM(result == ERROR_SUCCESS, "Could not read registry key value."); + + if (result == ERROR_SUCCESS) { + data = tmpStr; + } + + RegCloseKey(openKey); + System::free(tmpStr); + } + } + return (result == ERROR_SUCCESS); +} + +bool RegistryUtil::writeInt32(const std::string& key, const std::string& value, int32 data) { + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if (hkey == NULL) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_WRITE, &openKey); + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + result = RegSetValueExA(openKey, value.c_str(), 0, REG_DWORD, reinterpret_cast(&data), sizeof(int32)); + + debugAssertM(result == ERROR_SUCCESS, "Could not write registry key value."); + + RegCloseKey(openKey); + } + return (result == ERROR_SUCCESS); +} + +bool RegistryUtil::writeBytes(const std::string& key, const std::string& value, const uint8* data, uint32 dataSize) { + debugAssert(data); + + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if (hkey == NULL) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_WRITE, &openKey); + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + if (data) { + result = RegSetValueExA(openKey, value.c_str(), 0, REG_BINARY, reinterpret_cast(data), dataSize); + } + + debugAssertM(result == ERROR_SUCCESS, "Could not write registry key value."); + + RegCloseKey(openKey); + } + return (result == ERROR_SUCCESS); +} + +bool RegistryUtil::writeString(const std::string& key, const std::string& value, const std::string& data) { + size_t pos = key.find('\\', 0); + if (pos == std::string::npos) { + return false; + } + + HKEY hkey = getRootKeyFromString(key.c_str(), pos); + + if (hkey == NULL) { + return false; + } + + HKEY openKey; + int32 result = RegOpenKeyExA(hkey, (key.c_str() + pos + 1), 0, KEY_WRITE, &openKey); + debugAssert(result == ERROR_SUCCESS || result == ERROR_FILE_NOT_FOUND); + + if (result == ERROR_SUCCESS) { + result = RegSetValueExA(openKey, value.c_str(), 0, REG_SZ, reinterpret_cast(data.c_str()), (data.size() + 1)); + debugAssertM(result == ERROR_SUCCESS, "Could not write registry key value."); + + RegCloseKey(openKey); + } + return (result == ERROR_SUCCESS); +} + + +// static helpers +static HKEY getRootKeyFromString(const char* str, size_t length) { + debugAssert(str); + + if (str) { + if ( strncmp(str, "HKEY_CLASSES_ROOT", length) == 0 ) { + return HKEY_CLASSES_ROOT; + } else if ( strncmp(str, "HKEY_CURRENT_CONFIG", length) == 0 ) { + return HKEY_CURRENT_CONFIG; + } else if ( strncmp(str, "HKEY_CURRENT_USER", length) == 0 ) { + return HKEY_CURRENT_USER; + } else if ( strncmp(str, "HKEY_LOCAL_MACHINE", length) == 0 ) { + return HKEY_LOCAL_MACHINE; + } else if ( strncmp(str, "HKEY_PERFORMANCE_DATA", length) == 0 ) { + return HKEY_PERFORMANCE_DATA; + } else if ( strncmp(str, "HKEY_PERFORMANCE_NLSTEXT", length) == 0 ) { + return HKEY_PERFORMANCE_NLSTEXT; + } else if ( strncmp(str, "HKEY_PERFORMANCE_TEXT", length) == 0 ) { + return HKEY_PERFORMANCE_TEXT; + } else if ( strncmp(str, "HKEY_CLASSES_ROOT", length) == 0 ) { + return HKEY_CLASSES_ROOT; + } else { + return NULL; + } + } else { + return NULL; + } +} + +} // namespace G3D + +#endif // G3D_WIN32 diff --git a/externals/g3dlite/Sphere.cpp b/externals/g3dlite/Sphere.cpp new file mode 100644 index 0000000..4ed0811 --- /dev/null +++ b/externals/g3dlite/Sphere.cpp @@ -0,0 +1,223 @@ +/** + @file Sphere.cpp + + Sphere class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-04-17 + @edited 2009-01-20 + */ + +#include "G3D/platform.h" +#include "G3D/Sphere.h" +#include "G3D/stringutils.h" +#include "G3D/BinaryOutput.h" +#include "G3D/BinaryInput.h" +#include "G3D/AABox.h" +#include "G3D/Plane.h" + +namespace G3D { + +int32 Sphere::dummy; + +Sphere::Sphere(class BinaryInput& b) { + deserialize(b); +} + + +void Sphere::serialize(class BinaryOutput& b) const { + center.serialize(b); + b.writeFloat64(radius); +} + + +void Sphere::deserialize(class BinaryInput& b) { + center.deserialize(b); + radius = (float)b.readFloat64(); +} + + +std::string Sphere::toString() const { + return format("Sphere(<%g, %g, %g>, %g)", + center.x, center.y, center.z, radius); +} + + +bool Sphere::contains(const Vector3& point) const { + float distance = (center - point).squaredMagnitude(); + return distance <= square(radius); +} + + +bool Sphere::contains(const Sphere& other) const { + float distance = (center - other.center).squaredMagnitude(); + return (radius >= other.radius) && (distance <= square(radius - other.radius)); +} + + +bool Sphere::intersects(const Sphere& other) const { + return (other.center - center).length() <= (radius + other.radius); +} + + +void Sphere::merge(const Sphere& other) { + if (other.contains(*this)) { + *this = other; + } else if (! contains(other)) { + // The farthest distance is along the axis between the centers, which + // must not be colocated since neither contains the other. + Vector3 toMe = center - other.center; + // Get a point on the axis from each + toMe = toMe.direction(); + const Vector3& A = center + toMe * radius; + const Vector3& B = other.center - toMe * other.radius; + + // Now just bound the A->B segment + center = (A + B) * 0.5f; + radius = (A - B).length(); + } + // (if this contains other, we're done) +} + + +bool Sphere::culledBy( + const Array& plane, + int& cullingPlaneIndex, + const uint32 inMask, + uint32& outMask) const { + + return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask, outMask); +} + + +bool Sphere::culledBy( + const Array& plane, + int& cullingPlaneIndex, + const uint32 inMask) const { + + return culledBy(plane.getCArray(), plane.size(), cullingPlaneIndex, inMask); +} + + +bool Sphere::culledBy( + const class Plane* plane, + int numPlanes, + int& cullingPlane, + const uint32 _inMask, + uint32& childMask) const { + + if (radius == finf()) { + // No plane can cull the infinite box + return false; + } + + uint32 inMask = _inMask; + assert(numPlanes < 31); + + childMask = 0; + + // See if there is one plane for which all of the + // vertices are in the negative half space. + for (int p = 0; p < numPlanes; p++) { + + // Only test planes that are not masked + if ((inMask & 1) != 0) { + + bool culledLow = ! plane[p].halfSpaceContainsFinite(center + plane[p].normal() * radius); + bool culledHigh = ! plane[p].halfSpaceContainsFinite(center - plane[p].normal() * radius); + + if (culledLow) { + // Plane p culled the sphere + cullingPlane = p; + + // The caller should not recurse into the children, + // since the parent is culled. If they do recurse, + // make them only test against this one plane, which + // will immediately cull the volume. + childMask = 1 << p; + return true; + + } else if (culledHigh) { + // The bounding volume straddled the plane; we have + // to keep testing against this plane + childMask |= (1 << p); + } + } + + // Move on to the next bit. + inMask = inMask >> 1; + } + + // None of the planes could cull this box + cullingPlane = -1; + return false; +} + + +bool Sphere::culledBy( + const class Plane* plane, + int numPlanes, + int& cullingPlane, + const uint32 _inMask) const { + + uint32 inMask = _inMask; + assert(numPlanes < 31); + + // See if there is one plane for which all of the + // vertices are in the negative half space. + for (int p = 0; p < numPlanes; p++) { + + // Only test planes that are not masked + if ((inMask & 1) != 0) { + bool culled = ! plane[p].halfSpaceContains(center + plane[p].normal() * radius); + if (culled) { + // Plane p culled the sphere + cullingPlane = p; + return true; + } + } + + // Move on to the next bit. + inMask = inMask >> 1; + } + + // None of the planes could cull this box + cullingPlane = -1; + return false; +} + + +Vector3 Sphere::randomSurfacePoint() const { + return Vector3::random() * radius + center; +} + + +Vector3 Sphere::randomInteriorPoint() const { + Vector3 result; + do { + result = Vector3(uniformRandom(-1, 1), + uniformRandom(-1, 1), + uniformRandom(-1, 1)); + } while (result.squaredMagnitude() >= 1.0f); + + return result * radius + center; +} + + +float Sphere::volume() const { + return (float)pi() * (4.0f / 3.0f) * powf((float)radius, 3.0f); +} + + +float Sphere::area() const { + return (float)pi() * 4.0f * powf((float)radius, 2.0f); +} + + +void Sphere::getBounds(AABox& out) const { + Vector3 extent(radius, radius, radius); + out = AABox(center - extent, center + extent); +} + +} // namespace diff --git a/externals/g3dlite/System.cpp b/externals/g3dlite/System.cpp new file mode 100644 index 0000000..e03c4e8 --- /dev/null +++ b/externals/g3dlite/System.cpp @@ -0,0 +1,1746 @@ +/** + @file System.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + Note: every routine must call init() first. + + There are two kinds of detection used in this file. At compile + time, the _MSC_VER #define is used to determine whether x86 assembly + can be used at all. At runtime, processor detection is used to + determine if we can safely call the routines that use that assembly. + + @created 2003-01-25 + @edited 2010-01-03 + */ + +#include "G3D/platform.h" +#include "G3D/System.h" +#include "G3D/debug.h" +#include "G3D/fileutils.h" +#include "G3D/TextOutput.h" +#include "G3D/G3DGameUnits.h" +#include "G3D/Crypto.h" +#include "G3D/prompt.h" +#include "G3D/stringutils.h" +#include "G3D/Log.h" +#include "G3D/Table.h" +#include "G3D/GMutex.h" +#include "G3D/units.h" +#include + +#include +#include + +// Uncomment the following line to turn off G3D::System memory +// allocation and use the operating system's malloc. +//#define NO_BUFFERPOOL + +#if defined(__i386__) || defined(__x86_64__) || defined(G3D_WIN32) +# define G3D_NOT_OSX_PPC +#endif + +#include + +#ifdef G3D_WIN32 + +# include +# include +# include "G3D/RegistryUtil.h" + +#elif defined(G3D_LINUX) + +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +#elif defined(G3D_OSX) + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include + #include +#endif + +// SIMM include +#ifdef __SSE__ +#include +#endif + +namespace G3D { + + +/** Checks if the CPUID command is available on the processor (called from init) */ +static bool checkForCPUID(); + +/** Called from init */ +static void getG3DVersion(std::string& s); + +/** Called from init */ +static G3DEndian checkEndian(); + + +System& System::instance() { + static System thesystem; + return thesystem; +} + + +System::System() : + m_initialized(false), + m_cpuSpeed(0), + m_hasCPUID(false), + m_hasRDTSC(false), + m_hasMMX(false), + m_hasSSE(false), + m_hasSSE2(false), + m_hasSSE3(false), + m_has3DNOW(false), + m_has3DNOW2(false), + m_hasAMDMMX(false), + m_cpuVendor("Uninitialized"), + m_numCores(1), + m_machineEndian(G3D_LITTLE_ENDIAN), + m_cpuArch("Uninitialized"), + m_operatingSystem("Uninitialized"), + m_version("Uninitialized"), + m_outOfMemoryCallback(NULL), + m_realWorldGetTickTime0(0), + m_highestCPUIDFunction(0) { + + init(); +} + + +void System::init() { + // NOTE: Cannot use most G3D data structures or utility functions + // in here because they are not initialized. + + if (m_initialized) { + return; + } else { + m_initialized = true; + } + + getG3DVersion(m_version); + + m_machineEndian = checkEndian(); + + m_hasCPUID = checkForCPUID(); + // Process the CPUID information + if (m_hasCPUID) { + // We read the standard CPUID level 0x00000000 which should + // be available on every x86 processor. This fills out + // a string with the processor vendor tag. + unsigned int eaxreg = 0, ebxreg = 0, ecxreg = 0, edxreg = 0; + + cpuid(CPUID_VENDOR_ID, eaxreg, ebxreg, ecxreg, edxreg); + + { + char c[100]; + // Then we connect the single register values to the vendor string + *((unsigned int*) c) = ebxreg; + *((unsigned int*) (c + 4)) = edxreg; + *((unsigned int*) (c + 8)) = ecxreg; + c[12] = '\0'; + m_cpuVendor = c; + } + + switch (ebxreg) { + case 0x756E6547: // GenuineIntel + m_cpuArch = "Intel Processor"; + break; + + case 0x68747541: // AuthenticAMD + m_cpuArch = "AMD Processor"; + break; + + case 0x69727943: // CyrixInstead + m_cpuArch = "Cyrix Processor"; + break; + + default: + m_cpuArch = "Unknown Processor Vendor"; + break; + } + + + unsigned int highestFunction = eaxreg; + if (highestFunction >= CPUID_NUM_CORES) { + cpuid(CPUID_NUM_CORES, eaxreg, ebxreg, ecxreg, edxreg); + // Number of cores is in (eax>>26) + 1 + m_numCores = (eaxreg >> 26) + 1; + } + + cpuid(CPUID_GET_HIGHEST_FUNCTION, m_highestCPUIDFunction, ebxreg, ecxreg, edxreg); + } + + + // Get the operating system name (also happens to read some other information) +# ifdef G3D_WIN32 + // Note that this overrides some of the values computed above + bool success = RegistryUtil::readInt32 + ("HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", + "~MHz", m_cpuSpeed); + + SYSTEM_INFO systemInfo; + GetSystemInfo(&systemInfo); + const char* arch = NULL; + switch (systemInfo.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_INTEL: + arch = "Intel"; + break; + + case PROCESSOR_ARCHITECTURE_MIPS: + arch = "MIPS"; + break; + + case PROCESSOR_ARCHITECTURE_ALPHA: + arch = "Alpha"; + break; + + case PROCESSOR_ARCHITECTURE_PPC: + arch = "Power PC"; + break; + + default: + arch = "Unknown"; + } + + m_numCores = systemInfo.dwNumberOfProcessors; + uint32 maxAddr = (uint32)systemInfo.lpMaximumApplicationAddress; + { + char c[1024]; + sprintf(c, "%d x %d-bit %s processor", + systemInfo.dwNumberOfProcessors, + (int)(::log((double)maxAddr) / ::log(2.0) + 2.0), + arch); + m_cpuArch = c; + } + + OSVERSIONINFO osVersionInfo; + osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + success = GetVersionEx(&osVersionInfo) != 0; + + if (success) { + char c[1000]; + sprintf(c, "Windows %d.%d build %d Platform %d %s", + osVersionInfo.dwMajorVersion, + osVersionInfo.dwMinorVersion, + osVersionInfo.dwBuildNumber, + osVersionInfo.dwPlatformId, + osVersionInfo.szCSDVersion); + m_operatingSystem = c; + } else { + m_operatingSystem = "Windows"; + } + +# elif defined(G3D_LINUX) || defined(G3D_FREEBSD) + + { + // Find the operating system using the 'uname' command + FILE* f = popen("uname -a", "r"); + + int len = 100; + char* r = (char*)::malloc(len * sizeof(char)); + fgets(r, len, f); + // Remove trailing newline + if (r[strlen(r) - 1] == '\n') { + r[strlen(r) - 1] = '\0'; + } + fclose(f); + + m_operatingSystem = r; + ::free(r); + } + +# elif defined(G3D_OSX) + + // Operating System: + SInt32 macVersion; + Gestalt(gestaltSystemVersion, &macVersion); + + int major = (macVersion >> 8) & 0xFF; + int minor = (macVersion >> 4) & 0xF; + int revision = macVersion & 0xF; + + { + char c[1000]; + sprintf(c, "OS X %x.%x.%x", major, minor, revision); + m_operatingSystem = c; + } + + // Clock Cycle Timing Information: + Gestalt('pclk', &m_OSXCPUSpeed); + m_cpuSpeed = iRound((double)m_OSXCPUSpeed / (1024 * 1024)); + m_secondsPerNS = 1.0 / 1.0e9; + + // System Architecture: + const NXArchInfo* pInfo = NXGetLocalArchInfo(); + + if (pInfo) { + m_cpuArch = pInfo->description; + + switch (pInfo->cputype) { + case CPU_TYPE_POWERPC: + switch(pInfo->cpusubtype){ + case CPU_SUBTYPE_POWERPC_750: + case CPU_SUBTYPE_POWERPC_7400: + case CPU_SUBTYPE_POWERPC_7450: + m_cpuVendor = "Motorola"; + break; + case CPU_SUBTYPE_POWERPC_970: + m_cpuVendor = "IBM"; + break; + } + break; + + case CPU_TYPE_I386: + m_cpuVendor = "Intel"; + break; + } + } +# endif + + initTime(); + + getStandardProcessorExtensions(); +} + + +void getG3DVersion(std::string& s) { + char cstr[100]; + if ((G3D_VER % 100) != 0) { + sprintf(cstr, "G3D %d.%02d beta %d", + G3D_VER / 10000, + (G3D_VER / 100) % 100, + G3D_VER % 100); + } else { + sprintf(cstr, "G3D %d.%02d", + G3D_VER / 10000, + (G3D_VER / 100) % 100); + } + s = cstr; +} + +#if 0 // TODO: delete +struct Directory { + std::string path; + Array contents; +}; + +static bool maybeAddDirectory(const std::string& newPath, Array& directoryArray, bool recurse = true) { + if (fileExists(newPath)) { + Directory& d = directoryArray.next(); + d.path = newPath; + getFiles(pathConcat(newPath, "*"), d.contents); + Array dirs; + getDirs(pathConcat(newPath, "*"), dirs); + d.contents.append(dirs); + + if (recurse) { + // Look for subdirectories + static const std::string subdirs[] = + {"font", "gui", "SuperShader", "cubemap", "icon", "material", "image", "md2", "md3", "ifs", "3ds", "sky", ""}; + + for (int j = 0; j < dirs.size(); ++j) { + for (int i = 0; ! subdirs[i].empty(); ++i) { + if (dirs[j] == subdirs[i]) { + maybeAddDirectory(pathConcat(newPath, dirs[j]), directoryArray, false); + } + } + } + } + return true; + } else { + return false; + } +} +#endif + +std::string System::findDataFile +(const std::string& full, + bool errorIfNotFound) { + + // Places where specific files were most recently found. This is + // used to cache seeking of common files. + static Table lastFound; + + // First check if the file exists as requested. This will go + // through the FileSystemCache, so most calls do not touch disk. + if (fileExists(full)) { + return full; + } + + // Now check where we previously found this file. + std::string* last = lastFound.getPointer(full); + if (last != NULL) { + if (fileExists(*last)) { + // Even if cwd has changed the file is still present. + // We won't notice if it has been deleted, however. + return *last; + } else { + // Remove this from the cache it is invalid + lastFound.remove(full); + } + } + + // Places to look + static Array directoryArray; + + if (directoryArray.size() == 0) { + // Initialize the directory array + RealTime t0 = System::time(); + + Array baseDirArray; + + std::string initialAppDataDir(instance().m_appDataDir); + + baseDirArray.append(""); + if (! initialAppDataDir.empty()) { + baseDirArray.append(initialAppDataDir); + } + + const char* g3dPath = getenv("G3DDATA"); + + if (g3dPath && (initialAppDataDir != g3dPath)) { + baseDirArray.append(g3dPath); + } + + static const std::string subdirs[] = + {"font", "gui", "SuperShader", "cubemap", "icon", "material", "image", "md2", "md3", "ifs", "3ds", "sky", ""}; + for (int j = 0; j < baseDirArray.size(); ++j) { + std::string d = baseDirArray[j]; + if (fileExists(d)) { + directoryArray.append(d); + for (int i = 0; ! subdirs[i].empty(); ++i) { + const std::string& p = pathConcat(d, subdirs[i]); + if (fileExists(p)) { + directoryArray.append(p); + } + } + } + } + + logLazyPrintf("Initializing System::findDataFile took %fs\n", System::time() - t0); + } + + for (int i = 0; i < directoryArray.size(); ++i) { + const std::string& p = pathConcat(directoryArray[i], full); + if (fileExists(p)) { + lastFound.set(full, p); + return p; + } + } + + if (errorIfNotFound) { + // Generate an error message + std::string locations; + for (int i = 0; i < directoryArray.size(); ++i) { + locations += pathConcat(directoryArray[i], full) + "\n"; + } + alwaysAssertM(false, "Could not find '" + full + "' in:\n" + locations); + } + + // Not found + return ""; +} + + +void System::setAppDataDir(const std::string& path) { + instance().m_appDataDir = path; +} + + +std::string demoFindData(bool errorIfNotFound) { + static const char* g3dPath = getenv("G3DDATA"); + if (g3dPath) { + return g3dPath; +# ifdef G3D_WIN32 + } else if (fileExists("../data")) { + // G3D install on Windows + return "../data"; + } else if (fileExists("../data-files")) { + // G3D source on Windows + return "../data-files"; +# else + } else if (fileExists("../../../../data")) { + // G3D install on Unix + return "../../../../data"; + } else if (fileExists("../../../../data-files")) { + // G3D source on Unix + return "../../../../data-files"; +# endif + } else { + return ""; + } +} + + +const std::string& System::build() { + const static std::string b = +# ifdef _DEBUG + "Debug"; +# else + "Release"; +# endif + + return b; +} + + +static G3DEndian checkEndian() { + int32 a = 1; + if (*(uint8*)&a == 1) { + return G3D_LITTLE_ENDIAN; + } else { + return G3D_BIG_ENDIAN; + } +} + + +static bool checkForCPUID() { + // all known supported architectures have cpuid + // add cases for incompatible architectures if they are added + // e.g., if we ever support __powerpc__ being defined again + + return true; +} + + +void System::getStandardProcessorExtensions() { +#if ! defined(G3D_OSX) || defined(G3D_OSX_INTEL) + if (! m_hasCPUID) { + return; + } + + uint32 eaxreg = 0, ebxreg = 0, ecxreg = 0, features = 0; + + cpuid(CPUID_PROCESSOR_FEATURES, eaxreg, ebxreg, ecxreg, features); + +# define checkBit(var, bit) ((var & (1 << bit)) ? true : false) + + m_hasRDTSC = checkBit(features, 4); + m_hasMMX = checkBit(features, 23); + m_hasSSE = checkBit(features, 25); + m_hasSSE2 = checkBit(features, 26); + // Bit 28 is HTT; not checked by G3D + + m_hasSSE3 = checkBit(ecxreg, 0); + + if (m_highestCPUIDFunction >= CPUID_EXTENDED_FEATURES) { + cpuid(CPUID_EXTENDED_FEATURES, eaxreg, ebxreg, ecxreg, features); + m_hasAMDMMX = checkBit(features, 22); // Only on AMD + m_has3DNOW = checkBit(features, 31); // Only on AMD + m_has3DNOW2 = checkBit(features, 30); // Only on AMD + } else { + m_hasAMDMMX = false; + m_has3DNOW = false; + m_has3DNOW2 = false; + } + +# undef checkBit +#endif +} + +#if defined(G3D_WIN32) && !defined(G3D_64BIT) + #pragma message("Port System::memcpy SIMD to all platforms") +/** Michael Herf's fast memcpy */ +void memcpyMMX(void* dst, const void* src, int nbytes) { + int remainingBytes = nbytes; + + if (nbytes > 64) { + _asm { + mov esi, src + mov edi, dst + mov ecx, nbytes + shr ecx, 6 // 64 bytes per iteration + + loop1: + movq mm1, 0[ESI] // Read in source data + movq mm2, 8[ESI] + movq mm3, 16[ESI] + movq mm4, 24[ESI] + movq mm5, 32[ESI] + movq mm6, 40[ESI] + movq mm7, 48[ESI] + movq mm0, 56[ESI] + + movntq 0[EDI], mm1 // Non-temporal stores + movntq 8[EDI], mm2 + movntq 16[EDI], mm3 + movntq 24[EDI], mm4 + movntq 32[EDI], mm5 + movntq 40[EDI], mm6 + movntq 48[EDI], mm7 + movntq 56[EDI], mm0 + + add esi, 64 + add edi, 64 + dec ecx + jnz loop1 + + emms + } + remainingBytes -= ((nbytes >> 6) << 6); + } + + if (remainingBytes > 0) { + // Memcpy the rest + memcpy((uint8*)dst + (nbytes - remainingBytes), + (const uint8*)src + (nbytes - remainingBytes), remainingBytes); + } +} +#endif + +void System::memcpy(void* dst, const void* src, size_t numBytes) { +#if defined(G3D_WIN32) && !defined(G3D_64BIT) + memcpyMMX(dst, src, numBytes); +#else + ::memcpy(dst, src, numBytes); +#endif +} + + +/** Michael Herf's fastest memset. n32 must be filled with the same + character repeated. */ +#if defined(G3D_WIN32) && !defined(G3D_64BIT) + #pragma message("Port System::memfill SIMD to all platforms") + +// On x86 processors, use MMX +void memfill(void *dst, int n32, unsigned long i) { + + int originalSize = i; + int bytesRemaining = i; + + if (i > 16) { + + bytesRemaining = i % 16; + i -= bytesRemaining; + __asm { + movq mm0, n32 + punpckldq mm0, mm0 + mov edi, dst + + loopwrite: + + movntq 0[edi], mm0 + movntq 8[edi], mm0 + + add edi, 16 + sub i, 16 + jg loopwrite + + emms + } + } + + if (bytesRemaining > 0) { + ::memset((uint8*)dst + (originalSize - bytesRemaining), n32, bytesRemaining); + } +} +#endif + + +void System::memset(void* dst, uint8 value, size_t numBytes) { +#if defined(G3D_WIN32) && !defined(G3D_64BIT) + uint32 v = value; + v = v + (v << 8) + (v << 16) + (v << 24); + G3D::memfill(dst, v, numBytes); +#else + ::memset(dst, value, numBytes); +#endif +} + + +/** Removes the 'd' that icompile / Morgan's VC convention appends. */ +static std::string computeAppName(const std::string& start) { + if (start.size() < 2) { + return start; + } + + if (start[start.size() - 1] == 'd') { + // Maybe remove the 'd'; see if ../ or ../../ has the same name + char tmp[1024]; + getcwd(tmp, sizeof(tmp)); + std::string drive, base, ext; + Array path; + parseFilename(tmp, drive, path, base, ext); + + std::string shortName = start.substr(0, start.size() - 1); + + if ((path.size() > 1) && (toLower(path.last()) == toLower(shortName))) { + return shortName; + } + + if ((path.size() > 2) && (toLower(path[path.size() - 2]) == toLower(shortName))) { + return shortName; + } + } + + return start; +} + + +std::string& System::appName() { + static std::string n = computeAppName(filenameBase(currentProgramFilename())); + return n; +} + + +std::string System::currentProgramFilename() { + char filename[2048]; + +# ifdef G3D_WIN32 + { + GetModuleFileNameA(NULL, filename, sizeof(filename)); + } +# elif defined(G3D_OSX) + { + // Run the 'ps' program to extract the program name + // from the process ID. + int pid; + FILE* fd; + char cmd[80]; + pid = getpid(); + sprintf(cmd, "ps -p %d -o comm=\"\"", pid); + + fd = popen(cmd, "r"); + int s = fread(filename, 1, sizeof(filename), fd); + // filename will contain a newline. Overwrite it: + filename[s - 1] = '\0'; + } +# else + { + int ret = readlink("/proc/self/exe", filename, sizeof(filename)); + + // In case of an error, leave the handling up to the caller + if (ret == -1) { + return ""; + } + + debugAssert((int)sizeof(filename) > ret); + + // Ensure proper NULL termination + filename[ret] = 0; + } + #endif + + return filename; +} + + +void System::sleep(RealTime t) { + + // Overhead of calling this function, measured from a previous run. + static const RealTime OVERHEAD = 0.00006f; + + RealTime now = time(); + RealTime wakeupTime = now + t - OVERHEAD; + + RealTime remainingTime = wakeupTime - now; + RealTime sleepTime = 0; + + // On Windows, a "time slice" is measured in quanta of 3-5 ms (http://support.microsoft.com/kb/259025) + // Sleep(0) yields the remainder of the time slice, which could be a long time. + // A 1 ms minimum time experimentally kept the "Empty GApp" at nearly no CPU load at 100 fps, + // yet nailed the frame timing perfectly. + static RealTime minRealSleepTime = 3 * units::milliseconds(); + + while (remainingTime > 0) { + + if (remainingTime > minRealSleepTime * 2.5) { + // Safe to use Sleep with a time... sleep for half the remaining time + sleepTime = max(remainingTime * 0.5, 0.0005); + } else if (remainingTime > minRealSleepTime) { + // Safe to use Sleep with a zero time; + // causes the program to yield only + // the current time slice, and then return. + sleepTime = 0; + } else { + // Not safe to use Sleep; busy wait + sleepTime = -1; + } + + if (sleepTime >= 0) { + #ifdef G3D_WIN32 + // Translate to milliseconds + Sleep((int)(sleepTime * 1e3)); + #else + // Translate to microseconds + usleep((int)(sleepTime * 1e6)); + #endif + } + + now = time(); + remainingTime = wakeupTime - now; + } +} + + +void System::consoleClearScreen() { +# ifdef G3D_WIN32 + system("cls"); +# else + system("clear"); +# endif +} + + +bool System::consoleKeyPressed() { + #ifdef G3D_WIN32 + + return _kbhit() != 0; + + #else + + static const int STDIN = 0; + static bool initialized = false; + + if (! initialized) { + // Use termios to turn off line buffering + termios term; + tcgetattr(STDIN, &term); + term.c_lflag &= ~ICANON; + tcsetattr(STDIN, TCSANOW, &term); + setbuf(stdin, NULL); + initialized = true; + } + + #ifdef G3D_LINUX + + int bytesWaiting; + ioctl(STDIN, FIONREAD, &bytesWaiting); + return bytesWaiting; + + #else + + timeval timeout; + fd_set rdset; + + FD_ZERO(&rdset); + FD_SET(STDIN, &rdset); + timeout.tv_sec = 0; + timeout.tv_usec = 0; + + return select(STDIN + 1, &rdset, NULL, NULL, &timeout); + #endif + #endif +} + + +int System::consoleReadKey() { +# ifdef G3D_WIN32 + return _getch(); +# else + char c; + read(0, &c, 1); + return c; +# endif +} + + +void System::initTime() { + #ifdef G3D_WIN32 + if (QueryPerformanceFrequency(&m_counterFrequency)) { + QueryPerformanceCounter(&m_start); + } + + struct _timeb t; + _ftime(&t); + + m_realWorldGetTickTime0 = (RealTime)t.time - t.timezone * G3D::MINUTE + (t.dstflag ? G3D::HOUR : 0); + + #else + gettimeofday(&m_start, NULL); + // "sse" = "seconds since epoch". The time + // function returns the seconds since the epoch + // GMT (perhaps more correctly called UTC). + time_t gmt = ::time(NULL); + + // No call to free or delete is needed, but subsequent + // calls to asctime, ctime, mktime, etc. might overwrite + // local_time_vals. + tm* localTimeVals = localtime(&gmt); + + time_t local = gmt; + + if (localTimeVals) { + // tm_gmtoff is already corrected for daylight savings. + local = local + localTimeVals->tm_gmtoff; + } + + m_realWorldGetTickTime0 = local; + #endif +} + + +RealTime System::time() { +# ifdef G3D_WIN32 + LARGE_INTEGER now; + QueryPerformanceCounter(&now); + + return ((RealTime)(now.QuadPart - instance().m_start.QuadPart) / + instance().m_counterFrequency.QuadPart) + instance().m_realWorldGetTickTime0; +# else + // Linux resolution defaults to 100Hz. + // There is no need to do a separate RDTSC call as gettimeofday + // actually uses RDTSC when on systems that support it, otherwise + // it uses the system clock. + struct timeval now; + gettimeofday(&now, NULL); + + return (now.tv_sec - instance().m_start.tv_sec) + + (now.tv_usec - instance().m_start.tv_usec) / 1e6 + + instance().m_realWorldGetTickTime0; +# endif +} + + +//////////////////////////////////////////////////////////////// + +#define REALPTR_TO_USERPTR(x) ((uint8*)(x) + sizeof (void *)) +#define USERPTR_TO_REALPTR(x) ((uint8*)(x) - sizeof (void *)) +#define REALBLOCK_SIZE(x) ((x) + sizeof (void *)) + +class BufferPool { +public: + + /** Only store buffers up to these sizes (in bytes) in each pool-> + Different pools have different management strategies. + + A large block is preallocated for tiny buffers; they are used with + tremendous frequency. Other buffers are allocated as demanded. + Tiny buffers are 128 bytes long because that seems to align well with + cache sizes on many machines. + */ + enum {tinyBufferSize = 128, smallBufferSize = 1024, medBufferSize = 4096}; + + /** + Most buffers we're allowed to store. + 250000 * 128 = 32 MB (preallocated) + 10000 * 1024 = 10 MB (allocated on demand) + 1024 * 4096 = 4 MB (allocated on demand) + */ + enum {maxTinyBuffers = 250000, maxSmallBuffers = 10000, maxMedBuffers = 1024}; + +private: + + class MemBlock { + public: + void* ptr; + size_t bytes; + + inline MemBlock() : ptr(NULL), bytes(0) {} + inline MemBlock(void* p, size_t b) : ptr(p), bytes(b) {} + }; + + MemBlock smallPool[maxSmallBuffers]; + int smallPoolSize; + + MemBlock medPool[maxMedBuffers]; + int medPoolSize; + + /** The tiny pool is a single block of storage into which all tiny + objects are allocated. This provides better locality for + small objects and avoids the search time, since all tiny + blocks are exactly the same size. */ + void* tinyPool[maxTinyBuffers]; + int tinyPoolSize; + + /** Pointer to the data in the tiny pool */ + void* tinyHeap; + + Spinlock m_lock; + + void lock() { + m_lock.lock(); + } + + void unlock() { + m_lock.unlock(); + } + +#if 0 //-----------------------------------------------old mutex +# ifdef G3D_WIN32 + CRITICAL_SECTION mutex; +# else + pthread_mutex_t mutex; +# endif + + /** Provide synchronization between threads */ + void lock() { +# ifdef G3D_WIN32 + EnterCriticalSection(&mutex); +# else + pthread_mutex_lock(&mutex); +# endif + } + + void unlock() { +# ifdef G3D_WIN32 + LeaveCriticalSection(&mutex); +# else + pthread_mutex_unlock(&mutex); +# endif + } +#endif //-------------------------------------------old mutex + + /** + Malloc out of the tiny heap. Returns NULL if allocation failed. + */ + inline void* tinyMalloc(size_t bytes) { + // Note that we ignore the actual byte size + // and create a constant size block. + (void)bytes; + assert(tinyBufferSize >= bytes); + + void* ptr = NULL; + + if (tinyPoolSize > 0) { + --tinyPoolSize; + + // Return the old last pointer from the freelist + ptr = tinyPool[tinyPoolSize]; + +# ifdef G3D_DEBUG + if (tinyPoolSize > 0) { + assert(tinyPool[tinyPoolSize - 1] != ptr); + // "System::malloc heap corruption detected: " + // "the last two pointers on the freelist are identical (during tinyMalloc)."); + } +# endif + + // NULL out the entry to help detect corruption + tinyPool[tinyPoolSize] = NULL; + } + + return ptr; + } + + /** Returns true if this is a pointer into the tiny heap. */ + bool inTinyHeap(void* ptr) { + return + (ptr >= tinyHeap) && + (ptr < (uint8*)tinyHeap + maxTinyBuffers * tinyBufferSize); + } + + void tinyFree(void* ptr) { + assert(ptr); + assert(tinyPoolSize < maxTinyBuffers); + // "Tried to free a tiny pool buffer when the tiny pool freelist is full."); + +# ifdef G3D_DEBUG + if (tinyPoolSize > 0) { + void* prevOnHeap = tinyPool[tinyPoolSize - 1]; + assert(prevOnHeap != ptr); +// "System::malloc heap corruption detected: " +// "the last two pointers on the freelist are identical (during tinyFree)."); + } +# endif + + assert(tinyPool[tinyPoolSize] == NULL); + + // Put the pointer back into the free list + tinyPool[tinyPoolSize] = ptr; + ++tinyPoolSize; + + } + + void flushPool(MemBlock* pool, int& poolSize) { + for (int i = 0; i < poolSize; ++i) { + ::free(pool[i].ptr); + pool[i].ptr = NULL; + pool[i].bytes = 0; + } + poolSize = 0; + } + + + /** Allocate out of a specific pool-> Return NULL if no suitable + memory was found. + + */ + void* malloc(MemBlock* pool, int& poolSize, size_t bytes) { + + // OPT: find the smallest block that satisfies the request. + + // See if there's something we can use in the buffer pool-> + // Search backwards since usually we'll re-use the last one. + for (int i = (int)poolSize - 1; i >= 0; --i) { + if (pool[i].bytes >= bytes) { + // We found a suitable entry in the pool-> + + // No need to offset the pointer; it is already offset + void* ptr = pool[i].ptr; + + // Remove this element from the pool + --poolSize; + pool[i] = pool[poolSize]; + + return ptr; + } + } + + return NULL; + } + +public: + + /** Count of memory allocations that have occurred. */ + int totalMallocs; + int mallocsFromTinyPool; + int mallocsFromSmallPool; + int mallocsFromMedPool; + + /** Amount of memory currently allocated (according to the application). + This does not count the memory still remaining in the buffer pool, + but does count extra memory required for rounding off to the size + of a buffer. + Primarily useful for detecting leaks.*/ + // TODO: make me an atomic int! + volatile int bytesAllocated; + + BufferPool() { + totalMallocs = 0; + + mallocsFromTinyPool = 0; + mallocsFromSmallPool = 0; + mallocsFromMedPool = 0; + + bytesAllocated = true; + + tinyPoolSize = 0; + tinyHeap = NULL; + + smallPoolSize = 0; + + medPoolSize = 0; + + + // Initialize the tiny heap as a bunch of pointers into one + // pre-allocated buffer. + tinyHeap = ::malloc(maxTinyBuffers * tinyBufferSize); + for (int i = 0; i < maxTinyBuffers; ++i) { + tinyPool[i] = (uint8*)tinyHeap + (tinyBufferSize * i); + } + tinyPoolSize = maxTinyBuffers; + +#if 0 ///---------------------------------- old mutex +# ifdef G3D_WIN32 + InitializeCriticalSection(&mutex); +# else + pthread_mutex_init(&mutex, NULL); +# endif +#endif ///---------------------------------- old mutex + } + + + ~BufferPool() { + ::free(tinyHeap); +#if 0 //-------------------------------- old mutex +# ifdef G3D_WIN32 + DeleteCriticalSection(&mutex); +# else + // No destruction on pthreads +# endif +#endif //--------------------------------old mutex + } + + + void* realloc(void* ptr, size_t bytes) { + if (ptr == NULL) { + return malloc(bytes); + } + + if (inTinyHeap(ptr)) { + if (bytes <= tinyBufferSize) { + // The old pointer actually had enough space. + return ptr; + } else { + // Free the old pointer and malloc + + void* newPtr = malloc(bytes); + System::memcpy(newPtr, ptr, tinyBufferSize); + tinyFree(ptr); + return newPtr; + + } + } else { + // In one of our heaps. + + // See how big the block really was + size_t realSize = *(uint32*)USERPTR_TO_REALPTR(ptr); + if (bytes <= realSize) { + // The old block was big enough. + return ptr; + } + + // Need to reallocate + void* newPtr = malloc(bytes); + System::memcpy(newPtr, ptr, realSize); + free(ptr); + return newPtr; + } + } + + + void* malloc(size_t bytes) { + lock(); + ++totalMallocs; + + if (bytes <= tinyBufferSize) { + + void* ptr = tinyMalloc(bytes); + + if (ptr) { + ++mallocsFromTinyPool; + unlock(); + return ptr; + } + + } + + // Failure to allocate a tiny buffer is allowed to flow + // through to a small buffer + if (bytes <= smallBufferSize) { + + void* ptr = malloc(smallPool, smallPoolSize, bytes); + + if (ptr) { + ++mallocsFromSmallPool; + unlock(); + return ptr; + } + + } else if (bytes <= medBufferSize) { + // Note that a small allocation failure does *not* fall + // through into a medium allocation because that would + // waste the medium buffer's resources. + + void* ptr = malloc(medPool, medPoolSize, bytes); + + if (ptr) { + ++mallocsFromMedPool; + unlock(); + debugAssertM(ptr != NULL, "BufferPool::malloc returned NULL"); + return ptr; + } + } + + bytesAllocated += REALBLOCK_SIZE(bytes); + unlock(); + + // Heap allocate + + // Allocate 4 extra bytes for our size header (unfortunate, + // since malloc already added its own header). + void* ptr = ::malloc(REALBLOCK_SIZE(bytes)); + + if (ptr == NULL) { + // Flush memory pools to try and recover space + flushPool(smallPool, smallPoolSize); + flushPool(medPool, medPoolSize); + ptr = ::malloc(REALBLOCK_SIZE(bytes)); + } + + if (ptr == NULL) { + if ((System::outOfMemoryCallback() != NULL) && + (System::outOfMemoryCallback()(REALBLOCK_SIZE(bytes), true) == true)) { + // Re-attempt the malloc + ptr = ::malloc(REALBLOCK_SIZE(bytes)); + } + } + + if (ptr == NULL) { + if (System::outOfMemoryCallback() != NULL) { + // Notify the application + System::outOfMemoryCallback()(REALBLOCK_SIZE(bytes), false); + } +# ifdef G3D_DEBUG + debugPrintf("::malloc(%d) returned NULL\n", (int)REALBLOCK_SIZE(bytes)); +# endif + debugAssertM(ptr != NULL, + "::malloc returned NULL. Either the " + "operating system is out of memory or the " + "heap is corrupt."); + return NULL; + } + + *(uint32*)ptr = bytes; + + return REALPTR_TO_USERPTR(ptr); + } + + + void free(void* ptr) { + if (ptr == NULL) { + // Free does nothing on null pointers + return; + } + + assert(isValidPointer(ptr)); + + if (inTinyHeap(ptr)) { + lock(); + tinyFree(ptr); + unlock(); + return; + } + + uint32 bytes = *(uint32*)USERPTR_TO_REALPTR(ptr); + + lock(); + if (bytes <= smallBufferSize) { + if (smallPoolSize < maxSmallBuffers) { + smallPool[smallPoolSize] = MemBlock(ptr, bytes); + ++smallPoolSize; + unlock(); + return; + } + } else if (bytes <= medBufferSize) { + if (medPoolSize < maxMedBuffers) { + medPool[medPoolSize] = MemBlock(ptr, bytes); + ++medPoolSize; + unlock(); + return; + } + } + bytesAllocated -= REALBLOCK_SIZE(bytes); + unlock(); + + // Free; the buffer pools are full or this is too big to store. + ::free(USERPTR_TO_REALPTR(ptr)); + } + + std::string performance() const { + if (totalMallocs > 0) { + int pooled = mallocsFromTinyPool + + mallocsFromSmallPool + + mallocsFromMedPool; + + int total = totalMallocs; + + return format("malloc performance: %5.1f%% <= %db, %5.1f%% <= %db, " + "%5.1f%% <= %db, %5.1f%% > %db", + 100.0 * mallocsFromTinyPool / total, + BufferPool::tinyBufferSize, + 100.0 * mallocsFromSmallPool / total, + BufferPool::smallBufferSize, + 100.0 * mallocsFromMedPool / total, + BufferPool::medBufferSize, + 100.0 * (1.0 - (double)pooled / total), + BufferPool::medBufferSize); + } else { + return "No System::malloc calls made yet."; + } + } + + std::string status() const { + return format("preallocated shared buffers: %5d/%d x %db", + maxTinyBuffers - tinyPoolSize, maxTinyBuffers, tinyBufferSize); + } +}; + +// Dynamically allocated because we need to ensure that +// the buffer pool is still around when the last global variable +// is deallocated. +static BufferPool* bufferpool = NULL; + +std::string System::mallocPerformance() { +#ifndef NO_BUFFERPOOL + return bufferpool->performance(); +#else + return "NO_BUFFERPOOL"; +#endif +} + +std::string System::mallocStatus() { +#ifndef NO_BUFFERPOOL + return bufferpool->status(); +#else + return "NO_BUFFERPOOL"; +#endif +} + + +void System::resetMallocPerformanceCounters() { +#ifndef NO_BUFFERPOOL + bufferpool->totalMallocs = 0; + bufferpool->mallocsFromMedPool = 0; + bufferpool->mallocsFromSmallPool = 0; + bufferpool->mallocsFromTinyPool = 0; +#endif +} + + +#ifndef NO_BUFFERPOOL +inline void initMem() { + // Putting the test here ensures that the system is always + // initialized, even when globals are being allocated. + static bool initialized = false; + if (! initialized) { + bufferpool = new BufferPool(); + initialized = true; + } +} +#endif + + +void* System::malloc(size_t bytes) { +#ifndef NO_BUFFERPOOL + initMem(); + return bufferpool->malloc(bytes); +#else + return ::malloc(bytes); +#endif +} + +void* System::calloc(size_t n, size_t x) { +#ifndef NO_BUFFERPOOL + void* b = System::malloc(n * x); + debugAssertM(b != NULL, "System::malloc returned NULL"); + debugAssertM(isValidHeapPointer(b), "System::malloc returned an invalid pointer"); + System::memset(b, 0, n * x); + return b; +#else + return ::calloc(n, x); +#endif +} + + +void* System::realloc(void* block, size_t bytes) { +#ifndef NO_BUFFERPOOL + initMem(); + return bufferpool->realloc(block, bytes); +#else + return ::realloc(block, bytes); +#endif +} + + +void System::free(void* p) { +#ifndef NO_BUFFERPOOL + bufferpool->free(p); +#else + return ::free(p); +#endif +} + + +void* System::alignedMalloc(size_t bytes, size_t alignment) { + + alwaysAssertM(isPow2(alignment), "alignment must be a power of 2"); + + // We must align to at least a word boundary. + alignment = iMax(alignment, sizeof(void *)); + + // Pad the allocation size with the alignment size and the + // size of the redirect pointer. + size_t totalBytes = bytes + alignment + sizeof(void*); + + size_t truePtr = (size_t)System::malloc(totalBytes); + + if (truePtr == 0) { + // malloc returned NULL + return NULL; + } + + debugAssert(isValidHeapPointer((void*)truePtr)); + #ifdef G3D_WIN32 + // The blocks we return will not be valid Win32 debug heap + // pointers because they are offset + // debugAssert(_CrtIsValidPointer((void*)truePtr, totalBytes, TRUE) ); + #endif + + // The return pointer will be the next aligned location (we must at least + // leave space for the redirect pointer, however). + size_t alignedPtr = truePtr + sizeof(void*); + + // 2^n - 1 has the form 1111... in binary. + uint32 bitMask = (alignment - 1); + + // Advance forward until we reach an aligned location. + while ((alignedPtr & bitMask) != 0) { + alignedPtr += sizeof(void*); + } + + debugAssert(alignedPtr - truePtr + bytes <= totalBytes); + + // Immediately before the aligned location, write the true array location + // so that we can free it correctly. + size_t* redirectPtr = (size_t *)(alignedPtr - sizeof(void *)); + redirectPtr[0] = truePtr; + + debugAssert(isValidHeapPointer((void*)truePtr)); + + #ifdef G3D_WIN32 + debugAssert( _CrtIsValidPointer((void*)alignedPtr, bytes, TRUE) ); + #endif + return (void *)alignedPtr; +} + + +void System::alignedFree(void* _ptr) { + if (_ptr == NULL) { + return; + } + + size_t alignedPtr = (size_t)_ptr; + + // Back up one word from the pointer the user passed in. + // We now have a pointer to a pointer to the true start + // of the memory block. + size_t* redirectPtr = (size_t*)(alignedPtr - sizeof(void *)); + + // Dereference that pointer so that ptr = true start + void* truePtr = (void*)redirectPtr[0]; + + debugAssert(isValidHeapPointer((void*)truePtr)); + System::free(truePtr); +} + + +void System::setEnv(const std::string& name, const std::string& value) { + std::string cmd = name + "=" + value; +# ifdef G3D_WIN32 + _putenv(cmd.c_str()); +# else + // Many linux implementations of putenv expect char* + putenv(const_cast(cmd.c_str())); +# endif +} + + +const char* System::getEnv(const std::string& name) { + return getenv(name.c_str()); +} + + +static void var(TextOutput& t, const std::string& name, const std::string& val) { + t.writeSymbols(name,"="); + t.writeString(val); + t.writeNewline(); +} + + +static void var(TextOutput& t, const std::string& name, const bool val) { + t.writeSymbols(name, "=", val ? "Yes" : "No"); + t.writeNewline(); +} + + +static void var(TextOutput& t, const std::string& name, const int val) { + t.writeSymbols(name,"="); + t.writeNumber(val); + t.writeNewline(); +} + + +void System::describeSystem( + std::string& s) { + + TextOutput t; + describeSystem(t); + t.commitString(s); +} + +void System::describeSystem( + TextOutput& t) { + + t.writeSymbols("App", "{"); + t.writeNewline(); + t.pushIndent(); + { + var(t, "Name", System::currentProgramFilename()); + char cwd[1024]; + getcwd(cwd, 1024); + var(t, "cwd", std::string(cwd)); + } + t.popIndent(); + t.writeSymbols("}"); + t.writeNewline(); + t.writeNewline(); + + t.writeSymbols("OS", "{"); + t.writeNewline(); + t.pushIndent(); + { + var(t, "Name", System::operatingSystem()); + } + t.popIndent(); + t.writeSymbols("}"); + t.writeNewline(); + t.writeNewline(); + + t.writeSymbols("CPU", "{"); + t.writeNewline(); + t.pushIndent(); + { + var(t, "Vendor", System::cpuVendor()); + var(t, "Architecture", System::cpuArchitecture()); + var(t, "hasCPUID", System::hasCPUID()); + var(t, "hasMMX", System::hasMMX()); + var(t, "hasSSE", System::hasSSE()); + var(t, "hasSSE2", System::hasSSE2()); + var(t, "hasSSE3", System::hasSSE3()); + var(t, "has3DNow", System::has3DNow()); + var(t, "hasRDTSC", System::hasRDTSC()); + var(t, "numCores", System::numCores()); + } + t.popIndent(); + t.writeSymbols("}"); + t.writeNewline(); + t.writeNewline(); + + t.writeSymbols("G3D", "{"); + t.writeNewline(); + t.pushIndent(); + { + var(t, "Link version", G3D_VER); + var(t, "Compile version", System::version()); + } + t.popIndent(); + t.writeSymbols("}"); + t.writeNewline(); + t.writeNewline(); +} + + +void System::setClipboardText(const std::string& s) { +# ifdef G3D_WIN32 + if (OpenClipboard(NULL)) { + HGLOBAL hMem = GlobalAlloc(GHND | GMEM_DDESHARE, s.size() + 1); + if (hMem) { + char *pMem = (char*)GlobalLock(hMem); + strcpy(pMem, s.c_str()); + GlobalUnlock(hMem); + + EmptyClipboard(); + SetClipboardData(CF_TEXT, hMem); + } + + CloseClipboard(); + GlobalFree(hMem); + } +# endif +} + + +std::string System::getClipboardText() { + std::string s; + +# ifdef G3D_WIN32 + if (OpenClipboard(NULL)) { + HANDLE h = GetClipboardData(CF_TEXT); + + if (h) { + char* temp = (char*)GlobalLock(h); + if (temp) { + s = temp; + } + temp = NULL; + GlobalUnlock(h); + } + CloseClipboard(); + } +# endif + return s; +} + + +std::string System::currentDateString() { + time_t t1; + ::time(&t1); + tm* t = localtime(&t1); + return format("%d-%02d-%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); +} + +#ifdef _MSC_VER + +// VC on Intel +void System::cpuid(CPUIDFunction func, uint32& areg, uint32& breg, uint32& creg, uint32& dreg) { +#if !defined(G3D_64BIT) + // Can't copy from assembler direct to a function argument (which is on the stack) in VC. + uint32 a,b,c,d; + + // Intel assembler syntax + __asm { + mov eax, func // eax <- func + mov ecx, 0 + cpuid + mov a, eax + mov b, ebx + mov c, ecx + mov d, edx + } + areg = a; + breg = b; + creg = c; + dreg = d; +#else + int CPUInfo[4]; + __cpuid(CPUInfo, func); + memcpy(&areg, &CPUInfo[0], 4); + memcpy(&breg, &CPUInfo[1], 4); + memcpy(&creg, &CPUInfo[2], 4); + memcpy(&dreg, &CPUInfo[3], 4); +#endif +} + +#elif defined(G3D_OSX) && ! defined(G3D_OSX_INTEL) + +// non-intel OS X; no CPUID +void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, uint32& edx) { + eax = 0; + ebx = 0; + ecx = 0; + edx = 0; +} + +#else + +// See http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well +// for a discussion of why the second version saves ebx; it allows 32-bit code to compile with the -fPIC option. +// On 64-bit x86, PIC code has a dedicated rip register for PIC so there is no ebx conflict. +void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, uint32& edx) { +#if ! defined(__PIC__) || defined(__x86_64__) + // AT&T assembler syntax + asm volatile( + "movl $0, %%ecx \n\n" /* Wipe ecx */ + "cpuid \n\t" + : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) + : "a"(func)); +#else + // AT&T assembler syntax + asm volatile( + "pushl %%ebx \n\t" /* save ebx */ + "movl $0, %%ecx \n\n" /* Wipe ecx */ + "cpuid \n\t" + "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ + "popl %%ebx \n\t" /* restore the old ebx */ + : "=a"(eax), "=r"(ebx), "=c"(ecx), "=d"(edx) + : "a"(func)); +#endif +} + +#endif + +} // namespace diff --git a/externals/g3dlite/TextInput.cpp b/externals/g3dlite/TextInput.cpp new file mode 100644 index 0000000..7276d8c --- /dev/null +++ b/externals/g3dlite/TextInput.cpp @@ -0,0 +1,1136 @@ +/** + @file TextInput.cpp + + @author Morgan McGuire, graphics3d.com + + @cite Based on a lexer written by Aaron Orenstein. + + @created 2001-11-27 + @edited 2008-07-14 + */ + +#include "G3D/fileutils.h" +#include "G3D/TextInput.h" +#include "G3D/BinaryInput.h" +#include "G3D/stringutils.h" + +#ifdef _MSC_VER +# pragma warning (push) +// conversion from 'int' to 'char', possible loss of data (TODO: fix underlying problems) +# pragma warning (disable: 4244) +#endif + +namespace G3D { + +Token TextInput::readSignificant() { + Token t; + do { + t = read(); + } while ((t.type() == Token::COMMENT) || (t.type() == Token::NEWLINE)); + return t; +} + + +double Token::number() const { + if (_type == NUMBER) { + std::string s = toLower(_string); + if (s == "-1.#ind00") { + return nan(); + } + + if (s == "1.#inf00") { + return inf(); + } + + if (s == "-1.#inf00") { + return -inf(); + } + + double n; + if ((_string.length() > 2) && + (_string[0] == '0') && + (_string[1] == 'x')) { + // Hex + uint32 i; + sscanf(_string.c_str(), "%x", &i); + n = i; + } else { + sscanf(_string.c_str(), "%lg", &n); + } + return n; + } else { + return 0.0; + } +} + + +TextInput::Settings::Settings () : + cppBlockComments(true), + cppLineComments(true), + otherLineComments(true), + escapeSequencesInStrings(true), + otherCommentCharacter('\0'), + otherCommentCharacter2('\0'), + generateCommentTokens(false), + generateNewlineTokens(false), + signedNumbers(true), + singleQuotedStrings(true), + singleQuoteCharacter('\''), + sourceFileName(), + startingLineNumberOffset(0), + msvcSpecials(true), + proofSymbols(false), + caseSensitive(true) +{ + trueSymbols.insert("true"); + falseSymbols.insert("false"); +} + + +Token TextInput::peek() { + if (stack.size() == 0) { + Token t = nextToken(); + push(t); + } + + return stack.front(); +} + + +int TextInput::peekLineNumber() { + return peek().line(); +} + + +int TextInput::peekCharacterNumber() { + return peek().character(); +} + + +Token TextInput::read() { + if (stack.size() > 0) { + Token t = stack.front(); + stack.pop_front(); + return t; + } else { + return nextToken(); + } +} + +static void toUpper(Set& set) { + Array symbols; + set.getMembers(symbols); + set.clear(); + for (int i = 0; i < symbols.size(); ++i) { + set.insert(toUpper(symbols[i])); + } +} + +void TextInput::init() { + currentCharOffset = 0; + charNumber = 1; + lineNumber = 1 + options.startingLineNumberOffset; + + if (! options.caseSensitive) { + // Convert true and false symbols to all uppercase for fast comparisons + toUpper(options.trueSymbols); + toUpper(options.falseSymbols); + } +} + + +void TextInput::push(const Token& t) { + stack.push_front(t); +} + + +bool TextInput::hasMore() { + return (peek()._type != Token::END); +} + + +int TextInput::eatInputChar() { + // Don't go off the end + if (currentCharOffset >= buffer.length()) { + return EOF; + } + + unsigned char c = buffer[currentCharOffset]; + ++currentCharOffset; + + // update lineNumber and charNumber to reflect the location of the *next* + // character which will be read. + + // increment line number for \r, \n and \r\n which matches Token::NEWLINE parsing + if (c == '\r') { + ++lineNumber; + charNumber = 1; + + // check for \r\n + if (currentCharOffset < buffer.length()) { + unsigned char c2 = buffer[currentCharOffset]; + if (c2 == '\n') { + c = c2; + ++currentCharOffset; + } + } + } else if (c == '\n') { + ++lineNumber; + charNumber = 1; + } else { + ++charNumber; + } + + return c; +} + +int TextInput::peekInputChar(int distance) { + // Don't go off the end + if ((currentCharOffset + distance) >= buffer.length()) { + return EOF; + } + + unsigned char c = buffer[currentCharOffset + distance]; + return c; +} + + +Token TextInput::nextToken() { + Token t; + + t._line = lineNumber; + t._character = charNumber; + t._type = Token::END; + t._extendedType = Token::END_TYPE; + + int c = peekInputChar(); + if (c == EOF) { + return t; + } + + // loop through white space, newlines and comments + // found before other tokens + bool whitespaceDone = false; + while (! whitespaceDone) { + whitespaceDone = true; + + // generate newlines tokens for '\n' and '\r' and '\r\n' + if (options.generateNewlineTokens && isNewline(c)) { + t._type = Token::NEWLINE; + t._extendedType = Token::NEWLINE_TYPE; + t._string = c; + + int c2 = peekInputChar(1); + if (c == '\r' && c2 == '\n') { + t._string += c2; + } + + eatInputChar(); + return t; + } else { + // Consume whitespace + while (isWhiteSpace(c)) { + c = eatAndPeekInputChar(); + } + } + + // update line and character number to include discarded whitespace + t._line = lineNumber; + t._character = charNumber; + + int c2 = peekInputChar(1); + + // parse comments and generate tokens if enabled + std::string commentString; + + // check for line comments first + bool isLineComment = false; + if (options.cppLineComments && (c == '/' && c2 == '/')) { + // set start of line comment and eat markers + isLineComment = true; + eatInputChar(); + eatInputChar(); + } else if ( options.otherCommentCharacter && + (options.otherCommentCharacter != '\0' && c == options.otherCommentCharacter) ) { + // set start of line comment and eat markers + isLineComment = true; + eatInputChar(); + } else if ( options.otherCommentCharacter && + (options.otherCommentCharacter2 != '\0' && c == options.otherCommentCharacter2) ) { + // set start of line comment and eat markers + isLineComment = true; + eatInputChar(); + } + + if (isLineComment) { + + // consume line comment to newline or EOF + c = peekInputChar(); + while (! isNewline(c) && c != EOF) { + // build comment string for token + commentString += c; + + c = eatAndPeekInputChar(); + } + + if (options.generateCommentTokens) { + t._type = Token::COMMENT; + t._extendedType = Token::LINE_COMMENT_TYPE; + t._string = commentString; + return t; + } else { + // There is whitespace after the comment (in particular, the + // newline that terminates the comment). There might also be + // whitespace at the start of the next line. + whitespaceDone = false; + } + + } else if (options.cppBlockComments && (c == '/' && c2 == '*')) { + // consume block comment to end-marker or EOF + + // consume both start-comment chars, can't let the trailing one + // help close the comment. + eatInputChar(); + eatInputChar(); + + c = peekInputChar(); + c2 = peekInputChar(1); + while (! ((c == '*') && (c2 == '/')) && (c != EOF)) { + commentString += c; + + eatInputChar(); + c = c2; + c2 = peekInputChar(1); + } + eatInputChar(); // eat closing '*' + eatInputChar(); // eat closing '/' + + c = peekInputChar(); + + if (options.generateCommentTokens) { + t._type = Token::COMMENT; + t._extendedType = Token::BLOCK_COMMENT_TYPE; + t._string = commentString; + return t; + } else { + // There is whitespace after the comment (in particular, the + // newline that terminates the comment). There might also be + // whitespace at the start of the next line. + whitespaceDone = false; + } + } + + } // while (! whitespaceDone) + + t._line = lineNumber; + t._character = charNumber; + + // handle EOF + if (c == EOF) { + return t; + } + + // Extended ASCII parses as itself, except for EOF + if (c > 127 && c < 255) { + t._type = Token::SYMBOL; + t._extendedType = Token::SYMBOL_TYPE; + t._string = c; + c = eatAndPeekInputChar(); + } + + + // Perform appropriate setup for a symbol (including setting up the token + // string to start with c), eat the input character, and overwrite + // 'c' with the peeked next input character. +#define SETUP_SYMBOL(c) \ + { \ + t._type = Token::SYMBOL; \ + t._extendedType = Token::SYMBOL_TYPE; \ + t._string = c; \ + c = eatAndPeekInputChar(); \ + } + + switch (c) { + + case '@': // Simple symbols -> just themselves. + case '(': + case ')': + case ',': + case ';': + case '{': + case '}': + case '[': + case ']': + case '#': + case '$': + case '?': + case '%': + SETUP_SYMBOL(c); + return t; + + case '-': // negative number, -, --, -=, or -> + SETUP_SYMBOL(c); + + switch (c) { + case '>': // -> + case '-': // -- + case '=': // -= + t._string += c; + eatInputChar(); + return t; + } + + if (options.signedNumbers + && (isDigit(c) || (c == '.' && isDigit(peekInputChar(1))))) { + + // Negative number. 'c' is still the first digit, and is + // the next input char. + + goto numLabel; + } + + // plain - + return t; + + case '+': // positive number, +, ++, or += + SETUP_SYMBOL(c); + + switch (c) { + case '+': // ++ + case '=': // += + t._string += c; + eatInputChar(); + return t; + } + + if (options.signedNumbers + && (isDigit(c) || (c == '.' && isDigit(peekInputChar(1))))) { + + // Positive number. 'c' is still the first digit, and is + // the next input char. + + goto numLabel; + } + + return t; + + case ':': // : or :: or ::> or ::= or := or :> + SETUP_SYMBOL(c); + + if (c == ':') { + t._string += c; + eatInputChar(); + + if (options.proofSymbols) { + c = peekInputChar(0); + + if ((c == '>') || (c == '=')) { + t._string += c; + eatInputChar(); + } + } + } + else if (options.proofSymbols && (c == '=' || c == '>')) { + t._string += c; + eatInputChar(); + } + return t; + + case '=': // = or == or => + SETUP_SYMBOL(c); + + if (c == '=') { + t._string += c; + eatInputChar(); + return t; + } else if (options.proofSymbols && (c == '>')) { + t._string += c; + eatInputChar(); + return t; + } + return t; + + case '*': // * or *= + case '/': // / or /= + case '!': // ! or != + case '~': // ~ or ~= + case '^': // ^ or ^= + SETUP_SYMBOL(c); + + if (c == '=') { + t._string += c; + eatInputChar(); + return t; + } + return t; + + case '>': // >, >>,or >= + case '<': // <<, <<, or <= or <- or <: + case '|': // ||, ||, or |= or |- + case '&': // &, &&, or &= + { + int orig_c = c; + SETUP_SYMBOL(c); + + if ((c == '=') || (orig_c == c)) { + t._string += c; + eatInputChar(); + return t; + } else if (options.proofSymbols) { + if ((orig_c == '<') && (c == '-')) { + t._string += c; + eatInputChar(); + } else if ((orig_c == '|') && (c == '-')) { + t._string += c; + eatInputChar(); + } else if ((orig_c == '<') && (c == ':')) { + t._string += c; + + c = eatAndPeekInputChar(); + + if (c == ':') { + t._string += c; + eatInputChar(); + } + } + } + } + return t; + + case '\\': // backslash or escaped comment char. + SETUP_SYMBOL(c); + + if ((options.otherCommentCharacter != '\0' + && c == options.otherCommentCharacter) + || (options.otherCommentCharacter2 != '\0' + && c == options.otherCommentCharacter2)) { + + // escaped comment character. Return the raw comment + // char (no backslash). + + t._string = c; + eatInputChar(); + return t; + } + return t; + + case '.': // number, ., .., or ... + if (isDigit(peekInputChar(1))) { + // We're parsing a float that began without a leading zero + goto numLabel; + } + + SETUP_SYMBOL(c); + + if (c == '.') { // .. or ... + t._string += c; + c = eatAndPeekInputChar(); + + if (c == '.') { // ... + t._string += c; + eatInputChar(); + } + return t; + } + + return t; + + } // switch (c) + +#undef SETUP_SYMBOL + +numLabel: + if (isDigit(c) || (c == '.')) { + + // A number. Note-- single dots have been + // parsed already, so a . indicates a number + // less than 1 in floating point form. + + // [0-9]*(\.[0-9][f]) or [0-9]+ or 0x[0-9,A-F]+ + + if (t._string != "-") { + // If we picked up a leading "-" sign above, keep it, + // otherwise drop the string parsed thus far + t._string = ""; + } + t._type = Token::NUMBER; + if (c == '.') { + t._extendedType = Token::FLOATING_POINT_TYPE; + } else { + t._extendedType = Token::INTEGER_TYPE; + } + + if ((c == '0') && (peekInputChar(1) == 'x')) { + // Hex number + t._string += "0x"; + + // skip the 0x + eatInputChar(); + eatInputChar(); + + c = peekInputChar(); + while (isDigit(c) || ((c >= 'A') && (c <= 'F')) || ((c >= 'a') && (c <= 'f'))) { + t._string += c; + c = eatAndPeekInputChar(); + } + + } else { + // Non-hex number + + // Read the part before the decimal. + while (isDigit(c)) { + t._string += c; + c = eatAndPeekInputChar(); + } + + // True if we are reading a floating-point special type + bool isSpecial = false; + + // Read the decimal, if one exists + if (c == '.') { + t._extendedType = Token::FLOATING_POINT_TYPE; + + // The '.' character was a decimal point, not the start of a + // method or range operator + t._string += c; + c = eatAndPeekInputChar(); + + // Floating point specials (msvc format only) + if (options.msvcSpecials && (c == '#')) { + isSpecial = true; + // We are reading a floating point special value + // of the form -1.#IND00, -1.#INF00, or 1.#INF00 + c = eatAndPeekInputChar(); + char test = c; + if (! options.caseSensitive) { + test = toupper(c); + } + if (test != 'I') { + throw BadMSVCSpecial + ( + "Incorrect floating-point special (inf or nan) " + "format.", + t.line(), charNumber); + } + c = eatAndPeekInputChar(); + test = c; + if (! options.caseSensitive) { + test = toupper(c); + } + if (test != 'N') { + throw BadMSVCSpecial + ( + "Incorrect floating-point special (inf or nan) " + "format.", + t.line(), charNumber); + } + t._string += "#IN"; + c = eatAndPeekInputChar(); + test = c; + if (! options.caseSensitive) { + test = toupper(c); + } + if ((test != 'F') && (test != 'D')) { + throw BadMSVCSpecial + ( + "Incorrect floating-point special (inf or nan) " + "format.", + t.line(), charNumber); + } + t._string += c; + for (int j = 0; j < 2; ++j) { + c = eatAndPeekInputChar(); + if (c != '0') { + throw BadMSVCSpecial + ( + "Incorrect floating-point special (inf or" + "nan) format.", + t.line(), charNumber); + } + t._string += (char)c; + } + + } else { + + // Read the part after the decimal + while (isDigit((char)c)) { + t._string += (char)c; + c = eatAndPeekInputChar(); + } + } + } + + if (! isSpecial && ((c == 'e') || (c == 'E'))) { + // Read exponent + t._extendedType = Token::FLOATING_POINT_TYPE; + t._string += c; + + c = eatAndPeekInputChar(); + if ((c == '-') || (c == '+')) { + t._string += c; + c = eatAndPeekInputChar(); + } + + while (isDigit(c)) { + t._string += c; + c = eatAndPeekInputChar(); + } + } + + if (! isSpecial && (t._extendedType == Token::FLOATING_POINT_TYPE) && (c == 'f')) { + // Trailing f on a float + t._string += c; + c = eatAndPeekInputChar(); + } + } + return t; + + } else if (isLetter(c) || (c == '_')) { + // Identifier or keyword + // [A-Za-z_][A-Za-z_0-9]* + + t._type = Token::SYMBOL; + t._extendedType = Token::SYMBOL_TYPE; + t._string = ""; + do { + t._string += c; + c = eatAndPeekInputChar(); + } while (isLetter(c) || isDigit(c) || (c == '_')); + + // See if this symbol is actually a boolean + if ((options.trueSymbols.size() > 0) || (options.falseSymbols.size() > 0)) { + std::string str = t._string; + if (! options.caseSensitive) { + str = toUpper(str); + } + if (options.trueSymbols.contains(str)) { + t._type = Token::BOOLEAN; + t._extendedType = Token::BOOLEAN_TYPE; + t._bool = true; + } else if (options.falseSymbols.contains(str)) { + t._type = Token::BOOLEAN; + t._extendedType = Token::BOOLEAN_TYPE; + t._bool = false; + } + } + + return t; + + } else if (c == '\"') { + + // Discard the double-quote. + eatInputChar(); + + // Double quoted string + parseQuotedString('\"', t); + return t; + + } else if (c == options.singleQuoteCharacter) { + + // Discard the single-quote. + eatInputChar(); + + if (options.singleQuotedStrings) { + // Single quoted string + parseQuotedString(options.singleQuoteCharacter, t); + } else { + t._string = c; + t._type = Token::SYMBOL; + t._extendedType = Token::SYMBOL_TYPE; + } + return t; + + } // end of special case tokens + + if (c == EOF) { + t._type = Token::END; + t._extendedType = Token::END_TYPE; + t._string = ""; + return t; + } + + // Some unknown token + debugAssertM(false, + format("Unrecognized token type beginning with character '%c' (ASCII %d)", + c, c)); + return t; +} + + +void TextInput::parseQuotedString(unsigned char delimiter, Token& t) { + + t._type = Token::STRING; + + if (delimiter == options.singleQuoteCharacter) { + t._extendedType = Token::SINGLE_QUOTED_TYPE; + } else { + t._extendedType = Token::DOUBLE_QUOTED_TYPE; + } + + while (true) { + // We're definitely going to consume the next input char, so we get + // it right now. This makes the condition handling below a bit easier. + int c = eatInputChar(); + + if (c == EOF) { + // END inside a quoted string. (We finish the string.) + break; + } + + if (options.escapeSequencesInStrings && (c == '\\')) { + // An escaped character. We're definitely going to consume it, + // so we get it (and consume it) now. + + c = eatInputChar(); + + switch (c) { + case 'r': + t._string += '\r'; + break; + case 'n': + t._string += '\n'; + break; + case 't': + t._string += '\t'; + break; + case '0': + t._string += '\0'; + break; + + case '\\': + case '\"': + t._string += (char)c; + break; + + default: + if (c == options.singleQuoteCharacter) { + t._string += (char)c; + break; + } + + if (((c == options.otherCommentCharacter) && + (options.otherCommentCharacter != '\0')) || + ((c == options.otherCommentCharacter2) && + (options.otherCommentCharacter2 != '\0'))) { + t._string += c; + } + // otherwise, some illegal escape sequence; skip it. + break; + + } // switch + + } else if (c == delimiter) { + // End of the string. Already consumed the character. + break; + } else { + // All other chars, go on to the string. Already consumed the + // character. + t._string += (char)c; + } + + } +} + +bool TextInput::readBoolean() { + Token t(read()); + + if (t._type == Token::BOOLEAN) { + return t.boolean(); + } + + // Push initial token back, and throw an error. We intentionally + // indicate that the wrong type is the type of the initial token. + // Logically, the number started there. + push(t); + throw WrongTokenType(options.sourceFileName, t.line(), t.character(), + Token::BOOLEAN, t._type); +} + +double TextInput::readNumber() { + Token t(read()); + + if (t._type == Token::NUMBER) { + return t.number(); + } + + // Even if signedNumbers is disabled, readNumber attempts to + // read a signed number, so we handle that case here. + if (! options.signedNumbers + && (t._type == Token::SYMBOL) + && ((t._string == "-") + || (t._string == "+"))) { + + Token t2(read()); + + if ((t2._type == Token::NUMBER) + && (t2._character == t._character + 1)) { + + if (t._string == "-") { + return -t2.number(); + } else { + return t2.number(); + } + } + + // push back the second token. + push(t2); + } + + // Push initial token back, and throw an error. We intentionally + // indicate that the wrong type is the type of the initial token. + // Logically, the number started there. + push(t); + throw WrongTokenType(options.sourceFileName, t.line(), t.character(), + Token::NUMBER, t._type); +} + + +Token TextInput::readStringToken() { + Token t(read()); + + if (t._type == Token::STRING) { // fast path + return t; + } + + push(t); + throw WrongTokenType(options.sourceFileName, t.line(), t.character(), + Token::STRING, t._type); +} + +std::string TextInput::readString() { + return readStringToken()._string; +} + +void TextInput::readString(const std::string& s) { + Token t(readStringToken()); + + if (t._string == s) { // fast path + return; + } + + push(t); + throw WrongString(options.sourceFileName, t.line(), t.character(), + s, t._string); +} + +Token TextInput::readCommentToken() { + Token t(read()); + + if (t._type == Token::COMMENT) { // fast path + return t; + } + + push(t); + throw WrongTokenType(options.sourceFileName, t.line(), t.character(), + Token::COMMENT, t._type); +} + +std::string TextInput::readComment() { + return readCommentToken()._string; +} + +void TextInput::readComment(const std::string& s) { + Token t(readCommentToken()); + + if (t._string == s) { // fast path + return; + } + + push(t); + throw WrongString(options.sourceFileName, t.line(), t.character(), + s, t._string); +} + +Token TextInput::readNewlineToken() { + Token t(read()); + + if (t._type == Token::NEWLINE) { // fast path + return t; + } + + push(t); + throw WrongTokenType(options.sourceFileName, t.line(), t.character(), + Token::NEWLINE, t._type); +} + +std::string TextInput::readNewline() { + return readNewlineToken()._string; +} + +void TextInput::readNewline(const std::string& s) { + Token t(readNewlineToken()); + + if (t._string == s) { // fast path + return; + } + + push(t); + throw WrongString(options.sourceFileName, t.line(), t.character(), + s, t._string); +} + +Token TextInput::readSymbolToken() { + Token t(read()); + + if (t._type == Token::SYMBOL) { // fast path + return t; + } + + push(t); + throw WrongTokenType(options.sourceFileName, t.line(), t.character(), + Token::SYMBOL, t._type); +} + + +std::string TextInput::readSymbol() { + return readSymbolToken()._string; +} + +void TextInput::readSymbol(const std::string& symbol) { + Token t(readSymbolToken()); + + if (t._string == symbol) { // fast path + return; + } + + push(t); + throw WrongSymbol(options.sourceFileName, t.line(), t.character(), + symbol, t._string); +} + + +TextInput::TextInput(const std::string& filename, const Settings& opt) : options(opt) { + init(); + std::string input = readWholeFile(filename); + + if (options.sourceFileName.empty()) { + options.sourceFileName = filename; + } + int n = input.size(); + buffer.resize(n); + System::memcpy(buffer.getCArray(), input.c_str(), n); +} + + +TextInput::TextInput(FS fs, const std::string& str, const Settings& opt) : options(opt) { + (void)fs; + init(); + if (options.sourceFileName.empty()) { + if (str.length() < 14) { + options.sourceFileName = std::string("\"") + str + "\""; + } else { + options.sourceFileName = std::string("\"") + str.substr(0, 10) + "...\""; + } + } + buffer.resize(str.length()); // we don't bother copying trailing NUL. + System::memcpy(buffer.getCArray(), str.c_str(), buffer.size()); +} + + +const std::string& TextInput::filename() const { + return options.sourceFileName; +} + +/////////////////////////////////////////////////////////////////////////////////// + +TextInput::TokenException::TokenException( + const std::string& src, + int ln, + int ch) : ParseError(src, ln, ch, format("%s(%d) : ", src.c_str(), ln)), + sourceFile(src) { +} + +/////////////////////////////////////////////////////////////////////////////////// + +static const char* tokenTypeToString(Token::Type t) { + switch (t) { + case Token::SYMBOL: + return "Token::SYMBOL"; + case Token::STRING: + return "Token::STRING"; + case Token::NUMBER: + return "Token::NUMBER"; + case Token::END: + return "Token::END"; + default: + debugAssertM(false, "Fell through switch"); + return "?"; + } +} + +TextInput::WrongTokenType::WrongTokenType( + const std::string& src, + int ln, + int ch, + Token::Type e, + Token::Type a) : + TokenException(src, ln, ch), expected(e), actual(a) { + + message += format("Expected token of type %s, found type %s.", + tokenTypeToString(e), tokenTypeToString(a)); +} + + +TextInput::BadMSVCSpecial::BadMSVCSpecial( + const std::string& src, + int ln, + int ch) : + TokenException(src, ln, ch) { +} + + +TextInput::WrongSymbol::WrongSymbol( + const std::string& src, + int ln, + int ch, + const std::string& e, + const std::string& a) : + TokenException(src, ln, ch), expected(e), actual(a) { + + message += format("Expected symbol '%s', found symbol '%s'.", + e.c_str(), a.c_str()); +} + + +TextInput::WrongString::WrongString( + const std::string& src, + int ln, + int ch, + const std::string& e, + const std::string& a) : + TokenException(src, ln, ch), expected(e), actual(a) { + + message += format("Expected string '%s', found string '%s'.", + e.c_str(), a.c_str()); +} + + +void deserialize(bool& b, TextInput& ti) { + b = ti.readSymbol() == "true"; +} + + +void deserialize(int& b, TextInput& ti) { + b = iRound(ti.readNumber()); +} + + +void deserialize(uint8& b, TextInput& ti) { + b = (uint8)iRound(ti.readNumber()); +} + + +void deserialize(double& b, TextInput& ti) { + b = ti.readNumber(); +} + + +void deserialize(float& b, TextInput& ti) { + b = (float)ti.readNumber(); +} + +} // namespace + +#ifdef _MSC_VER +# pragma warning (pop) +#endif diff --git a/externals/g3dlite/TextOutput.cpp b/externals/g3dlite/TextOutput.cpp new file mode 100644 index 0000000..1134725 --- /dev/null +++ b/externals/g3dlite/TextOutput.cpp @@ -0,0 +1,452 @@ +/** + @file TextOutput.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + @created 2004-06-21 + @edited 2006-08-14 + + Copyright 2000-2006, Morgan McGuire. + All rights reserved. + */ + +#include "G3D/TextOutput.h" +#include "G3D/Log.h" +#include "G3D/fileutils.h" + +namespace G3D { + +TextOutput::TextOutput(const TextOutput::Settings& opt) : + startingNewLine(true), + currentColumn(0), + inDQuote(false), + filename(""), + indentLevel(0) +{ + setOptions(opt); +} + + +TextOutput::TextOutput(const std::string& fil, const TextOutput::Settings& opt) : + startingNewLine(true), + currentColumn(0), + inDQuote(false), + filename(fil), + indentLevel(0) +{ + + setOptions(opt); +} + + +void TextOutput::setIndentLevel(int i) { + indentLevel = i; + + // If there were more pops than pushes, don't let that take us below 0 indent. + // Don't ever indent more than the number of columns. + indentSpaces = + iClamp(option.spacesPerIndent * indentLevel, + 0, + option.numColumns - 1); +} + + +void TextOutput::setOptions(const Settings& _opt) { + option = _opt; + + debugAssert(option.numColumns > 1); + + setIndentLevel(indentLevel); + + newline = (option.newlineStyle == Settings::NEWLINE_WINDOWS) ? "\r\n" : "\n"; +} + + +void TextOutput::pushIndent() { + setIndentLevel(indentLevel + 1); +} + + +void TextOutput::popIndent() { + setIndentLevel(indentLevel - 1); +} + + +static std::string escape(const std::string& string) { + std::string result = ""; + + for (std::string::size_type i = 0; i < string.length(); ++i) { + char c = string.at(i); + switch (c) { + case '\0': + result += "\\0"; + break; + + case '\r': + result += "\\r"; + break; + + case '\n': + result += "\\n"; + break; + + case '\t': + result += "\\t"; + break; + + case '\\': + result += "\\\\"; + break; + + default: + result += c; + } + } + + return result; +} + +void TextOutput::writeString(const std::string& string) { + // Convert special characters to escape sequences + this->printf("\"%s\"", escape(string).c_str()); +} + + +void TextOutput::writeBoolean(bool b) { + this->printf("%s ", b ? option.trueSymbol.c_str() : option.falseSymbol.c_str()); +} + +void TextOutput::writeNumber(double n) { + this->printf("%f ", n); +} + + +void TextOutput::writeNumber(int n) { + this->printf("%d ", n); +} + + +void TextOutput::writeSymbol(const std::string& string) { + if (string.size() > 0) { + // TODO: check for legal symbols? + this->printf("%s ", string.c_str()); + } +} + +void TextOutput::writeSymbols( + const std::string& a, + const std::string& b, + const std::string& c, + const std::string& d, + const std::string& e, + const std::string& f) { + + writeSymbol(a); + writeSymbol(b); + writeSymbol(c); + writeSymbol(d); + writeSymbol(e); + writeSymbol(f); +} + + +void TextOutput::printf(const std::string formatString, ...) { + va_list argList; + va_start(argList, formatString); + this->vprintf(formatString.c_str(), argList); + va_end(argList); +} + + +void TextOutput::printf(const char* formatString, ...) { + va_list argList; + va_start(argList, formatString); + this->vprintf(formatString, argList); + va_end(argList); +} + + +void TextOutput::convertNewlines(const std::string& in, std::string& out) { + // TODO: can be significantly optimized in cases where + // single characters are copied in order by walking through + // the array and copying substrings as needed. + + if (option.convertNewlines) { + out = ""; + for (uint32 i = 0; i < in.size(); ++i) { + if (in[i] == '\n') { + // Unix newline + out += newline; + } else if ((in[i] == '\r') && (i + 1 < in.size()) && (in[i + 1] == '\n')) { + // Windows newline + out += newline; + ++i; + } else { + out += in[i]; + } + } + } else { + out = in; + } +} + + +void TextOutput::writeNewline() { + for (uint32 i = 0; i < newline.size(); ++i) { + indentAppend(newline[i]); + } +} + + +void TextOutput::writeNewlines(int numLines) { + for (int i = 0; i < numLines; ++i) { + writeNewline(); + } +} + + +void TextOutput::wordWrapIndentAppend(const std::string& str) { + // TODO: keep track of the last space character we saw so we don't + // have to always search. + + if ((option.wordWrap == Settings::WRAP_NONE) || + (currentColumn + (int)str.size() <= option.numColumns)) { + // No word-wrapping is needed + + // Add one character at a time. + // TODO: optimize for strings without newlines to add multiple + // characters. + for (uint32 i = 0; i < str.size(); ++i) { + indentAppend(str[i]); + } + return; + } + + // Number of columns to wrap against + int cols = option.numColumns - indentSpaces; + + // Copy forward until we exceed the column size, + // and then back up and try to insert newlines as needed. + for (uint32 i = 0; i < str.size(); ++i) { + + indentAppend(str[i]); + if ((str[i] == '\r') && (i + 1 < str.size()) && (str[i + 1] == '\n')) { + // \r\n, we need to hit the \n to enter word wrapping. + ++i; + indentAppend(str[i]); + } + + if (currentColumn >= cols) { + debugAssertM(str[i] != '\n' && str[i] != '\r', + "Should never enter word-wrapping on a newline character"); + + // True when we're allowed to treat a space as a space. + bool unquotedSpace = option.allowWordWrapInsideDoubleQuotes || ! inDQuote; + + // Cases: + // + // 1. Currently in a series of spaces that ends with a newline + // strip all spaces and let the newline + // flow through. + // + // 2. Currently in a series of spaces that does not end with a newline + // strip all spaces and replace them with single newline + // + // 3. Not in a series of spaces + // search backwards for a space, then execute case 2. + + // Index of most recent space + uint32 lastSpace = data.size() - 1; + + // How far back we had to look for a space + uint32 k = 0; + uint32 maxLookBackward = currentColumn - indentSpaces; + + // Search backwards (from current character), looking for a space. + while ((k < maxLookBackward) && + (lastSpace > 0) && + (! ((data[lastSpace] == ' ') && unquotedSpace))) { + --lastSpace; + ++k; + + if ((data[lastSpace] == '\"') && !option.allowWordWrapInsideDoubleQuotes) { + unquotedSpace = ! unquotedSpace; + } + } + + if (k == maxLookBackward) { + // We couldn't find a series of spaces + + if (option.wordWrap == Settings::WRAP_ALWAYS) { + // Strip the last character we wrote, force a newline, + // and replace the last character; + data.pop(); + writeNewline(); + indentAppend(str[i]); + } else { + // Must be Settings::WRAP_WITHOUT_BREAKING + // + // Don't write the newline; we'll come back to + // the word wrap code after writing another character + } + } else { + // We found a series of spaces. If they continue + // to the new string, strip spaces off both. Otherwise + // strip spaces from data only and insert a newline. + + // Find the start of the spaces. firstSpace is the index of the + // first non-space, looking backwards from lastSpace. + uint32 firstSpace = lastSpace; + while ((k < maxLookBackward) && + (firstSpace > 0) && + (data[firstSpace] == ' ')) { + --firstSpace; + ++k; + } + + if (k == maxLookBackward) { + ++firstSpace; + } + + if (lastSpace == (uint32)data.size() - 1) { + // Spaces continued up to the new string + data.resize(firstSpace + 1); + writeNewline(); + + // Delete the spaces from the new string + while ((i < str.size() - 1) && (str[i + 1] == ' ')) { + ++i; + } + } else { + // Spaces were somewhere in the middle of the old string. + // replace them with a newline. + + // Copy over the characters that should be saved + Array temp; + for (uint32 j = lastSpace + 1; j < (uint32)data.size(); ++j) { + char c = data[j]; + + if (c == '\"') { + // Undo changes to quoting (they will be re-done + // when we paste these characters back on). + inDQuote = !inDQuote; + } + temp.append(c); + } + + // Remove those characters and replace with a newline. + data.resize(firstSpace + 1); + writeNewline(); + + // Write them back + for (uint32 j = 0; j < (uint32)temp.size(); ++j) { + indentAppend(temp[j]); + } + + // We are now free to continue adding from the + // new string, which may or may not begin with spaces. + + } // if spaces included new string + } // if hit indent + } // if line exceeded + } // iterate over str +} + + +void TextOutput::indentAppend(char c) { + + if (startingNewLine) { + for (int j = 0; j < indentSpaces; ++j) { + data.push(' '); + } + startingNewLine = false; + currentColumn = indentSpaces; + } + + data.push(c); + + // Don't increment the column count on return character + // newline is taken care of below. + if (c != '\r') { + ++currentColumn; + } + + if (c == '\"') { + inDQuote = ! inDQuote; + } + + startingNewLine = (c == '\n'); + if (startingNewLine) { + currentColumn = 0; + } +} + + +void TextOutput::vprintf(const char* formatString, va_list argPtr) { + std::string str = vformat(formatString, argPtr); + + std::string clean; + convertNewlines(str, clean); + wordWrapIndentAppend(clean); +} + + +void TextOutput::commit(bool flush) { + std::string p = filenamePath(filename); + if (! fileExists(p, false)) { + createDirectory(p); + } + + FILE* f = fopen(filename.c_str(), "wb"); + debugAssertM(f, "Could not open \"" + filename + "\""); + fwrite(data.getCArray(), 1, data.size(), f); + if (flush) { + fflush(f); + } + fclose(f); +} + + +void TextOutput::commitString(std::string& out) { + // Null terminate + data.push('\0'); + out = data.getCArray(); + data.pop(); +} + + +std::string TextOutput::commitString() { + std::string str; + commitString(str); + return str; +} + + + +///////////////////////////////////////////////////////////////////// + +void serialize(const float& b, TextOutput& to) { + to.writeNumber(b); +} + + +void serialize(const bool& b, TextOutput& to) { + to.writeSymbol(b ? "true" : "false"); +} + + +void serialize(const int& b, TextOutput& to) { + to.writeNumber(b); +} + + +void serialize(const uint8& b, TextOutput& to) { + to.writeNumber(b); +} + + +void serialize(const double& b, TextOutput& to) { + to.writeNumber(b); +} + + +} diff --git a/externals/g3dlite/Triangle.cpp b/externals/g3dlite/Triangle.cpp new file mode 100644 index 0000000..253438a --- /dev/null +++ b/externals/g3dlite/Triangle.cpp @@ -0,0 +1,186 @@ +/** + @file Triangle.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-04-06 + @edited 2008-12-28 + + Copyright 2000-2009, Morgan McGuire. + All rights reserved. + */ + +#include "G3D/platform.h" +#include "G3D/Triangle.h" +#include "G3D/Plane.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/debugAssert.h" +#include "G3D/AABox.h" +#include "G3D/Ray.h" + +namespace G3D { + + +void Triangle::init(const Vector3& v0, const Vector3& v1, const Vector3& v2) { + + _plane = Plane(v0, v1, v2); + _vertex[0] = v0; + _vertex[1] = v1; + _vertex[2] = v2; + + static int next[] = {1,2,0}; + + for (int i = 0; i < 3; ++i) { + const Vector3& e = _vertex[next[i]] - _vertex[i]; + edgeMagnitude[i] = e.magnitude(); + + if (edgeMagnitude[i] == 0) { + edgeDirection[i] = Vector3::zero(); + } else { + edgeDirection[i] = e / (float)edgeMagnitude[i]; + } + } + + _edge01 = _vertex[1] - _vertex[0]; + _edge02 = _vertex[2] - _vertex[0]; + + _primaryAxis = _plane.normal().primaryAxis(); + _area = 0.5f * edgeDirection[0].cross(edgeDirection[2]).magnitude() * (edgeMagnitude[0] * edgeMagnitude[2]); + //0.5f * (_vertex[1] - _vertex[0]).cross(_vertex[2] - _vertex[0]).dot(_plane.normal()); +} + + +Triangle::Triangle() { + init(Vector3::zero(), Vector3::zero(), Vector3::zero()); +} + + +Triangle::Triangle(const Vector3& v0, const Vector3& v1, const Vector3& v2) { + init(v0, v1, v2); +} + + +Triangle::~Triangle() { +} + + +Triangle::Triangle(class BinaryInput& b) { + deserialize(b); +} + + +void Triangle::serialize(class BinaryOutput& b) { + _vertex[0].serialize(b); + _vertex[1].serialize(b); + _vertex[2].serialize(b); +} + + +void Triangle::deserialize(class BinaryInput& b) { + _vertex[0].deserialize(b); + _vertex[1].deserialize(b); + _vertex[2].deserialize(b); + init(_vertex[0], _vertex[1], _vertex[2]); +} + + +float Triangle::area() const { + return _area; +} + + +const Vector3& Triangle::normal() const { + return _plane.normal(); +} + + +const Plane& Triangle::plane() const { + return _plane; +} + + +Vector3 Triangle::center() const { + return (_vertex[0] + _vertex[1] + _vertex[2]) / 3.0; +} + +Vector3 Triangle::randomPoint() const { + // Choose a random point in the parallelogram + + float s = uniformRandom(); + float t = uniformRandom(); + + if (t > 1.0f - s) { + // Outside the triangle; reflect about the + // diagonal of the parallelogram + t = 1.0f - t; + s = 1.0f - s; + } + + return _edge01 * s + _edge02 * t + _vertex[0]; +} + + +void Triangle::getBounds(AABox& out) const { + Vector3 lo = _vertex[0]; + Vector3 hi = lo; + + for (int i = 1; i < 3; ++i) { + lo = lo.min(_vertex[i]); + hi = hi.max(_vertex[i]); + } + + out = AABox(lo, hi); +} + + +bool Triangle::intersect(const Ray& ray, float& distance, float baryCoord[3]) const { + static const float EPS = 1e-5f; + + // See RTR2 ch. 13.7 for the algorithm. + + const Vector3& e1 = edge01(); + const Vector3& e2 = edge02(); + const Vector3 p(ray.direction().cross(e2)); + const float a = e1.dot(p); + + if (abs(a) < EPS) { + // Determinant is ill-conditioned; abort early + return false; + } + + const float f = 1.0f / a; + const Vector3 s(ray.origin() - vertex(0)); + const float u = f * s.dot(p); + + if ((u < 0.0f) || (u > 1.0f)) { + // We hit the plane of the m_geometry, but outside the m_geometry + return false; + } + + const Vector3 q(s.cross(e1)); + const float v = f * ray.direction().dot(q); + + if ((v < 0.0f) || ((u + v) > 1.0f)) { + // We hit the plane of the triangle, but outside the triangle + return false; + } + + const float t = f * e2.dot(q); + + if ((t > 0.0f) && (t < distance)) { + // This is a new hit, closer than the previous one + distance = t; + + baryCoord[0] = 1.0 - u - v; + baryCoord[1] = u; + baryCoord[2] = v; + + return true; + } else { + // This hit is after the previous hit, so ignore it + return false; + } +} + +} // G3D diff --git a/externals/g3dlite/UprightFrame.cpp b/externals/g3dlite/UprightFrame.cpp new file mode 100644 index 0000000..c80264b --- /dev/null +++ b/externals/g3dlite/UprightFrame.cpp @@ -0,0 +1,132 @@ +/** + @file UprightFrame.cpp + Box class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2007-05-02 + @edited 2007-05-05 +*/ + +#include "G3D/UprightFrame.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" + +namespace G3D { + +UprightFrame::UprightFrame(const CoordinateFrame& cframe) { + Vector3 look = cframe.lookVector(); + + yaw = G3D::pi() + atan2(look.x, look.z); + pitch = asin(look.y); + + translation = cframe.translation; +} + + +CoordinateFrame UprightFrame::toCoordinateFrame() const { + CoordinateFrame cframe; + + Matrix3 P(Matrix3::fromAxisAngle(Vector3::unitX(), pitch)); + Matrix3 Y(Matrix3::fromAxisAngle(Vector3::unitY(), yaw)); + + cframe.rotation = Y * P; + cframe.translation = translation; + + return cframe; +} + + +UprightFrame UprightFrame::operator+(const UprightFrame& other) const { + return UprightFrame(translation + other.translation, pitch + other.pitch, yaw + other.yaw); +} + + +UprightFrame UprightFrame::operator*(const float k) const { + return UprightFrame(translation * k, pitch * k, yaw * k); +} + + +void UprightFrame::unwrapYaw(UprightFrame* a, int N) { + // Use the first point to establish the wrapping convention + for (int i = 1; i < N; ++i) { + const float prev = a[i - 1].yaw; + float& cur = a[i].yaw; + + // No two angles should be more than pi (i.e., 180-degrees) apart. + if (abs(cur - prev) > G3D::pi()) { + // These angles must have wrapped at zero, causing them + // to be interpolated the long way. + + // Find canonical [0, 2pi] versions of these numbers + float p = wrap(prev, twoPi()); + float c = wrap(cur, twoPi()); + + // Find the difference -pi < diff < pi between the current and previous values + float diff = c - p; + if (diff < -G3D::pi()) { + diff += twoPi(); + } else if (diff > G3D::pi()) { + diff -= twoPi(); + } + + // Offset the current from the previous by the difference + // between them. + cur = prev + diff; + } + } +} + + +void UprightFrame::serialize(class BinaryOutput& b) const { + translation.serialize(b); + b.writeFloat32(pitch); + b.writeFloat32(yaw); +} + + +void UprightFrame::deserialize(class BinaryInput& b) { + translation.deserialize(b); + pitch = b.readFloat32(); + yaw = b.readFloat32(); +} + + +void UprightSpline::serialize(class BinaryOutput& b) const { + b.writeBool8(cyclic); + + b.writeInt32(control.size()); + for (int i = 0; i < control.size(); ++i) { + control[i].serialize(b); + } + b.writeInt32(time.size()); + for (int i = 0; i < time.size(); ++i) { + b.writeFloat32(time[i]); + } +} + + +void UprightSpline::deserialize(class BinaryInput& b) { + cyclic = b.readBool8(); + + control.resize(b.readInt32()); + for (int i = 0; i < control.size(); ++i) { + control[i].deserialize(b); + } + + if (b.hasMore()) { + time.resize(b.readInt32()); + for (int i = 0; i < time.size(); ++i) { + time[i] = b.readFloat32(); + } + debugAssert(time.size() == control.size()); + } else { + // Import legacy path + time.resize(control.size()); + for (int i = 0; i < time.size(); ++i) { + time[i] = i; + } + } +} + +} diff --git a/externals/g3dlite/Vector2.cpp b/externals/g3dlite/Vector2.cpp new file mode 100644 index 0000000..ec0737c --- /dev/null +++ b/externals/g3dlite/Vector2.cpp @@ -0,0 +1,224 @@ +/** + @file Vector2.cpp + + 2D vector class, used for texture coordinates primarily. + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @cite Portions based on Dave Eberly'x Magic Software Library + at http://www.magic-software.com + + @created 2001-06-02 + @edited 2009-11-16 + */ + +#include "G3D/platform.h" +#include +#include "G3D/Vector2.h" +#include "G3D/g3dmath.h" +#include "G3D/format.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/TextInput.h" +#include "G3D/TextOutput.h" +#include "G3D/Any.h" + +namespace G3D { + + +Vector2::Vector2(const Any& any) { + any.verifyName("Vector2"); + any.verifyType(Any::TABLE, Any::ARRAY); + any.verifySize(2); + + if (any.type() == Any::ARRAY) { + x = any[0]; + y = any[1]; + } else { + // Table + x = any["x"]; + y = any["y"]; + } +} + + +Vector2::operator Any() const { + Any any(Any::ARRAY, "Vector2"); + any.append(x, y); + return any; +} + + +const Vector2& Vector2::one() { + static const Vector2 v(1, 1); return v; +} + + +const Vector2& Vector2::zero() { + static Vector2 v(0, 0); + return v; +} + +const Vector2& Vector2::unitX() { + static Vector2 v(1, 0); + return v; +} + +const Vector2& Vector2::unitY() { + static Vector2 v(0, 1); + return v; +} + +const Vector2& Vector2::inf() { + static Vector2 v((float)G3D::finf(), (float)G3D::finf()); + return v; +} + + +const Vector2& Vector2::nan() { + static Vector2 v((float)G3D::fnan(), (float)G3D::fnan()); + return v; +} + + +const Vector2& Vector2::minFinite() { + static Vector2 v(-FLT_MAX, -FLT_MAX); + return v; +} + + +const Vector2& Vector2::maxFinite() { + static Vector2 v(FLT_MAX, FLT_MAX); + return v; +} + + +size_t Vector2::hashCode() const { + unsigned int xhash = (*(int*)(void*)(&x)); + unsigned int yhash = (*(int*)(void*)(&y)); + + return xhash + (yhash * 37); +} + + +Vector2::Vector2(BinaryInput& b) { + deserialize(b); +} + + +void Vector2::deserialize(BinaryInput& b) { + x = b.readFloat32(); + y = b.readFloat32(); +} + + +void Vector2::serialize(BinaryOutput& b) const { + b.writeFloat32(x); + b.writeFloat32(y); +} + + +void Vector2::deserialize(TextInput& t) { + t.readSymbol("("); + x = (float)t.readNumber(); + t.readSymbol(","); + y = (float)t.readNumber(); + t.readSymbol(")"); +} + + +void Vector2::serialize(TextOutput& t) const { + t.writeSymbol("("); + t.writeNumber(x); + t.writeSymbol(","); + t.writeNumber(y); + t.writeSymbol(")"); +} + +//---------------------------------------------------------------------------- + +Vector2 Vector2::random(G3D::Random& r) { + Vector2 result; + + do { + result = Vector2(r.uniform(-1, 1), r.uniform(-1, 1)); + + } while (result.squaredLength() >= 1.0f); + + result.unitize(); + + return result; +} + + +Vector2 Vector2::operator/ (float k) const { + return *this * (1.0f / k); +} + +Vector2& Vector2::operator/= (float k) { + this->x /= k; + this->y /= k; + return *this; +} + +//---------------------------------------------------------------------------- +float Vector2::unitize (float fTolerance) { + float fLength = length(); + + if (fLength > fTolerance) { + float fInvLength = 1.0f / fLength; + x *= fInvLength; + y *= fInvLength; + } else { + fLength = 0.0; + } + + return fLength; +} + +//---------------------------------------------------------------------------- + +std::string Vector2::toString() const { + return G3D::format("(%g, %g)", x, y); +} + +// 2-char swizzles + +Vector2 Vector2::xx() const { return Vector2 (x, x); } +Vector2 Vector2::yx() const { return Vector2 (y, x); } +Vector2 Vector2::xy() const { return Vector2 (x, y); } +Vector2 Vector2::yy() const { return Vector2 (y, y); } + +// 3-char swizzles + +Vector3 Vector2::xxx() const { return Vector3 (x, x, x); } +Vector3 Vector2::yxx() const { return Vector3 (y, x, x); } +Vector3 Vector2::xyx() const { return Vector3 (x, y, x); } +Vector3 Vector2::yyx() const { return Vector3 (y, y, x); } +Vector3 Vector2::xxy() const { return Vector3 (x, x, y); } +Vector3 Vector2::yxy() const { return Vector3 (y, x, y); } +Vector3 Vector2::xyy() const { return Vector3 (x, y, y); } +Vector3 Vector2::yyy() const { return Vector3 (y, y, y); } + +// 4-char swizzles + +Vector4 Vector2::xxxx() const { return Vector4 (x, x, x, x); } +Vector4 Vector2::yxxx() const { return Vector4 (y, x, x, x); } +Vector4 Vector2::xyxx() const { return Vector4 (x, y, x, x); } +Vector4 Vector2::yyxx() const { return Vector4 (y, y, x, x); } +Vector4 Vector2::xxyx() const { return Vector4 (x, x, y, x); } +Vector4 Vector2::yxyx() const { return Vector4 (y, x, y, x); } +Vector4 Vector2::xyyx() const { return Vector4 (x, y, y, x); } +Vector4 Vector2::yyyx() const { return Vector4 (y, y, y, x); } +Vector4 Vector2::xxxy() const { return Vector4 (x, x, x, y); } +Vector4 Vector2::yxxy() const { return Vector4 (y, x, x, y); } +Vector4 Vector2::xyxy() const { return Vector4 (x, y, x, y); } +Vector4 Vector2::yyxy() const { return Vector4 (y, y, x, y); } +Vector4 Vector2::xxyy() const { return Vector4 (x, x, y, y); } +Vector4 Vector2::yxyy() const { return Vector4 (y, x, y, y); } +Vector4 Vector2::xyyy() const { return Vector4 (x, y, y, y); } +Vector4 Vector2::yyyy() const { return Vector4 (y, y, y, y); } + + + +} // namespace diff --git a/externals/g3dlite/Vector3.cpp b/externals/g3dlite/Vector3.cpp new file mode 100644 index 0000000..a53fa82 --- /dev/null +++ b/externals/g3dlite/Vector3.cpp @@ -0,0 +1,507 @@ +/** + @file Vector3.cpp + + 3D vector class + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com + + @created 2001-06-02 + @edited 2009-11-27 + */ + +#include +#include +#include "G3D/Vector3.h" +#include "G3D/g3dmath.h" +#include "G3D/stringutils.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/TextInput.h" +#include "G3D/TextOutput.h" +#include "G3D/Vector3int16.h" +#include "G3D/Matrix3.h" +#include "G3D/Vector2.h" +#include "G3D/Color3.h" +#include "G3D/Vector4int8.h" +#include "G3D/Vector3int32.h" +#include "G3D/Any.h" + +namespace G3D { + +Vector3::Vector3(const Any& any) { + any.verifyName("Vector3"); + any.verifyType(Any::TABLE, Any::ARRAY); + any.verifySize(3); + + if (any.type() == Any::ARRAY) { + x = any[0]; + y = any[1]; + z = any[2]; + } else { + // Table + x = any["x"]; + y = any["y"]; + z = any["z"]; + } +} + +Vector3::operator Any() const { + Any any(Any::ARRAY, "Vector3"); + any.append(x, y, z); + return any; +} + +Vector3::Vector3(const class Color3& v) : x(v.r), y(v.g), z(v.b) {} + +Vector3::Vector3(const class Vector3int32& v) : x((float)v.x), y((float)v.y), z((float)v.z) {} + +Vector3::Vector3(const Vector4int8& v) : x(v.x / 127.0f), y(v.y / 127.0f), z(v.z / 127.0f) {} + +Vector3::Vector3(const class Vector2& v, float _z) : x(v.x), y(v.y), z(_z) { +} + +Vector3& Vector3::ignore() { + static Vector3 v; + return v; +} + +const Vector3& Vector3::zero() { static const Vector3 v(0, 0, 0); return v; } +const Vector3& Vector3::one() { static const Vector3 v(1, 1, 1); return v; } +const Vector3& Vector3::unitX() { static const Vector3 v(1, 0, 0); return v; } +const Vector3& Vector3::unitY() { static const Vector3 v(0, 1, 0); return v; } +const Vector3& Vector3::unitZ() { static const Vector3 v(0, 0, 1); return v; } +const Vector3& Vector3::inf() { static const Vector3 v((float)G3D::finf(), (float)G3D::finf(), (float)G3D::finf()); return v; } +const Vector3& Vector3::nan() { static const Vector3 v((float)G3D::fnan(), (float)G3D::fnan(), (float)G3D::fnan()); return v; } +const Vector3& Vector3::minFinite(){ static const Vector3 v(-FLT_MAX, -FLT_MAX, -FLT_MAX); return v; } +const Vector3& Vector3::maxFinite(){ static const Vector3 v(FLT_MAX, FLT_MAX, FLT_MAX); return v; } + +Vector3::Axis Vector3::primaryAxis() const { + + Axis a = X_AXIS; + + double nx = abs(x); + double ny = abs(y); + double nz = abs(z); + + if (nx > ny) { + if (nx > nz) { + a = X_AXIS; + } else { + a = Z_AXIS; + } + } else { + if (ny > nz) { + a = Y_AXIS; + } else { + a = Z_AXIS; + } + } + + return a; +} + + +size_t Vector3::hashCode() const { + unsigned int xhash = (*(int*)(void*)(&x)); + unsigned int yhash = (*(int*)(void*)(&y)); + unsigned int zhash = (*(int*)(void*)(&z)); + + return xhash + (yhash * 37) + (zhash * 101); +} + +std::ostream& operator<<(std::ostream& os, const Vector3& v) { + return os << v.toString(); +} + + +//---------------------------------------------------------------------------- + +double frand() { + return rand() / (double) RAND_MAX; +} + +Vector3::Vector3(TextInput& t) { + deserialize(t); +} + +Vector3::Vector3(BinaryInput& b) { + deserialize(b); +} + + +Vector3::Vector3(const class Vector3int16& v) { + x = v.x; + y = v.y; + z = v.z; +} + + +void Vector3::deserialize(BinaryInput& b) { + x = b.readFloat32(); + y = b.readFloat32(); + z = b.readFloat32(); +} + + +void Vector3::deserialize(TextInput& t) { + t.readSymbol("("); + x = (float)t.readNumber(); + t.readSymbol(","); + y = (float)t.readNumber(); + t.readSymbol(","); + z = (float)t.readNumber(); + t.readSymbol(")"); +} + + +void Vector3::serialize(TextOutput& t) const { + t.writeSymbol("("); + t.writeNumber(x); + t.writeSymbol(","); + t.writeNumber(y); + t.writeSymbol(","); + t.writeNumber(z); + t.writeSymbol(")"); +} + + +void Vector3::serialize(BinaryOutput& b) const { + b.writeFloat32(x); + b.writeFloat32(y); + b.writeFloat32(z); +} + + +Vector3 Vector3::random(Random& r) { + Vector3 result; + r.sphere(result.x, result.y, result.z); + return result; +} + + +float Vector3::unitize(float fTolerance) { + float fMagnitude = magnitude(); + + if (fMagnitude > fTolerance) { + float fInvMagnitude = 1.0f / fMagnitude; + x *= fInvMagnitude; + y *= fInvMagnitude; + z *= fInvMagnitude; + } else { + fMagnitude = 0.0f; + } + + return fMagnitude; +} + + +Vector3 Vector3::reflectAbout(const Vector3& normal) const { + Vector3 out; + + Vector3 N = normal.direction(); + + // 2 * normal.dot(this) * normal - this + return N * 2 * this->dot(N) - *this; +} + + +Vector3 Vector3::cosHemiRandom(const Vector3& normal, Random& r) { + debugAssertM(G3D::fuzzyEq(normal.length(), 1.0f), + "cosHemiRandom requires its argument to have unit length"); + + float x, y, z; + r.cosHemi(x, y, z); + + // Make a coordinate system + const Vector3& Z = normal; + + Vector3 X, Y; + normal.getTangents(X, Y); + + return + x * X + + y * Y + + z * Z; +} + + +Vector3 Vector3::cosPowHemiRandom(const Vector3& normal, const float k, Random& r) { + debugAssertM(G3D::fuzzyEq(normal.length(), 1.0f), + "cosPowHemiRandom requires its argument to have unit length"); + + float x, y, z; + r.cosPowHemi(k, x, y, z); + + // Make a coordinate system + const Vector3& Z = normal; + + Vector3 X, Y; + normal.getTangents(X, Y); + + return + x * X + + y * Y + + z * Z; +} + + +Vector3 Vector3::hemiRandom(const Vector3& normal, Random& r) { + const Vector3& V = Vector3::random(r); + + if (V.dot(normal) < 0) { + return -V; + } else { + return V; + } +} + +//---------------------------------------------------------------------------- + +Vector3 Vector3::reflectionDirection(const Vector3& normal) const { + return -reflectAbout(normal).direction(); +} + +//---------------------------------------------------------------------------- + +Vector3 Vector3::refractionDirection( + const Vector3& normal, + float iInside, + float iOutside) const { + + // From pg. 24 of Henrik Wann Jensen. Realistic Image Synthesis + // Using Photon Mapping. AK Peters. ISBN: 1568811470. July 2001. + + // Invert the directions from Wann Jensen's formulation + // and normalize the vectors. + const Vector3 W = -direction(); + Vector3 N = normal.direction(); + + float h1 = iOutside; + float h2 = iInside; + + if (normal.dot(*this) > 0.0f) { + h1 = iInside; + h2 = iOutside; + N = -N; + } + + const float hRatio = h1 / h2; + const float WdotN = W.dot(N); + + float det = 1.0f - (float)square(hRatio) * (1.0f - (float)square(WdotN)); + + if (det < 0) { + // Total internal reflection + return Vector3::zero(); + } else { + return -hRatio * (W - WdotN * N) - N * sqrt(det); + } +} + +//---------------------------------------------------------------------------- +void Vector3::orthonormalize (Vector3 akVector[3]) { + // If the input vectors are v0, v1, and v2, then the Gram-Schmidt + // orthonormalization produces vectors u0, u1, and u2 as follows, + // + // u0 = v0/|v0| + // u1 = (v1-(u0*v1)u0)/|v1-(u0*v1)u0| + // u2 = (v2-(u0*v2)u0-(u1*v2)u1)/|v2-(u0*v2)u0-(u1*v2)u1| + // + // where |A| indicates length of vector A and A*B indicates dot + // product of vectors A and B. + + // compute u0 + akVector[0].unitize(); + + // compute u1 + float fDot0 = akVector[0].dot(akVector[1]); + akVector[1] -= akVector[0] * fDot0; + akVector[1].unitize(); + + // compute u2 + float fDot1 = akVector[1].dot(akVector[2]); + fDot0 = akVector[0].dot(akVector[2]); + akVector[2] -= akVector[0] * fDot0 + akVector[1] * fDot1; + akVector[2].unitize(); +} + +//---------------------------------------------------------------------------- +void Vector3::generateOrthonormalBasis (Vector3& rkU, Vector3& rkV, + Vector3& rkW, bool bUnitLengthW) { + if ( !bUnitLengthW ) + rkW.unitize(); + + if ( G3D::abs(rkW.x) >= G3D::abs(rkW.y) + && G3D::abs(rkW.x) >= G3D::abs(rkW.z) ) { + rkU.x = -rkW.y; + rkU.y = + rkW.x; + rkU.z = 0.0; + } else { + rkU.x = 0.0; + rkU.y = + rkW.z; + rkU.z = -rkW.y; + } + + rkU.unitize(); + rkV = rkW.cross(rkU); +} + +//---------------------------------------------------------------------------- + +std::string Vector3::toString() const { + return G3D::format("(%g, %g, %g)", x, y, z); +} + + +//---------------------------------------------------------------------------- + +Matrix3 Vector3::cross() const { + return Matrix3( 0, -z, y, + z, 0, -x, + -y, x, 0); +} + + +void serialize(const Vector3::Axis& a, class BinaryOutput& bo) { + bo.writeUInt8((uint8)a); +} + +void deserialize(Vector3::Axis& a, class BinaryInput& bi) { + a = (Vector3::Axis)bi.readUInt8(); +} + +//---------------------------------------------------------------------------- +// 2-char swizzles + +Vector2 Vector3::xx() const { return Vector2 (x, x); } +Vector2 Vector3::yx() const { return Vector2 (y, x); } +Vector2 Vector3::zx() const { return Vector2 (z, x); } +Vector2 Vector3::xy() const { return Vector2 (x, y); } +Vector2 Vector3::yy() const { return Vector2 (y, y); } +Vector2 Vector3::zy() const { return Vector2 (z, y); } +Vector2 Vector3::xz() const { return Vector2 (x, z); } +Vector2 Vector3::yz() const { return Vector2 (y, z); } +Vector2 Vector3::zz() const { return Vector2 (z, z); } + +// 3-char swizzles + +Vector3 Vector3::xxx() const { return Vector3 (x, x, x); } +Vector3 Vector3::yxx() const { return Vector3 (y, x, x); } +Vector3 Vector3::zxx() const { return Vector3 (z, x, x); } +Vector3 Vector3::xyx() const { return Vector3 (x, y, x); } +Vector3 Vector3::yyx() const { return Vector3 (y, y, x); } +Vector3 Vector3::zyx() const { return Vector3 (z, y, x); } +Vector3 Vector3::xzx() const { return Vector3 (x, z, x); } +Vector3 Vector3::yzx() const { return Vector3 (y, z, x); } +Vector3 Vector3::zzx() const { return Vector3 (z, z, x); } +Vector3 Vector3::xxy() const { return Vector3 (x, x, y); } +Vector3 Vector3::yxy() const { return Vector3 (y, x, y); } +Vector3 Vector3::zxy() const { return Vector3 (z, x, y); } +Vector3 Vector3::xyy() const { return Vector3 (x, y, y); } +Vector3 Vector3::yyy() const { return Vector3 (y, y, y); } +Vector3 Vector3::zyy() const { return Vector3 (z, y, y); } +Vector3 Vector3::xzy() const { return Vector3 (x, z, y); } +Vector3 Vector3::yzy() const { return Vector3 (y, z, y); } +Vector3 Vector3::zzy() const { return Vector3 (z, z, y); } +Vector3 Vector3::xxz() const { return Vector3 (x, x, z); } +Vector3 Vector3::yxz() const { return Vector3 (y, x, z); } +Vector3 Vector3::zxz() const { return Vector3 (z, x, z); } +Vector3 Vector3::xyz() const { return Vector3 (x, y, z); } +Vector3 Vector3::yyz() const { return Vector3 (y, y, z); } +Vector3 Vector3::zyz() const { return Vector3 (z, y, z); } +Vector3 Vector3::xzz() const { return Vector3 (x, z, z); } +Vector3 Vector3::yzz() const { return Vector3 (y, z, z); } +Vector3 Vector3::zzz() const { return Vector3 (z, z, z); } + +// 4-char swizzles + +Vector4 Vector3::xxxx() const { return Vector4 (x, x, x, x); } +Vector4 Vector3::yxxx() const { return Vector4 (y, x, x, x); } +Vector4 Vector3::zxxx() const { return Vector4 (z, x, x, x); } +Vector4 Vector3::xyxx() const { return Vector4 (x, y, x, x); } +Vector4 Vector3::yyxx() const { return Vector4 (y, y, x, x); } +Vector4 Vector3::zyxx() const { return Vector4 (z, y, x, x); } +Vector4 Vector3::xzxx() const { return Vector4 (x, z, x, x); } +Vector4 Vector3::yzxx() const { return Vector4 (y, z, x, x); } +Vector4 Vector3::zzxx() const { return Vector4 (z, z, x, x); } +Vector4 Vector3::xxyx() const { return Vector4 (x, x, y, x); } +Vector4 Vector3::yxyx() const { return Vector4 (y, x, y, x); } +Vector4 Vector3::zxyx() const { return Vector4 (z, x, y, x); } +Vector4 Vector3::xyyx() const { return Vector4 (x, y, y, x); } +Vector4 Vector3::yyyx() const { return Vector4 (y, y, y, x); } +Vector4 Vector3::zyyx() const { return Vector4 (z, y, y, x); } +Vector4 Vector3::xzyx() const { return Vector4 (x, z, y, x); } +Vector4 Vector3::yzyx() const { return Vector4 (y, z, y, x); } +Vector4 Vector3::zzyx() const { return Vector4 (z, z, y, x); } +Vector4 Vector3::xxzx() const { return Vector4 (x, x, z, x); } +Vector4 Vector3::yxzx() const { return Vector4 (y, x, z, x); } +Vector4 Vector3::zxzx() const { return Vector4 (z, x, z, x); } +Vector4 Vector3::xyzx() const { return Vector4 (x, y, z, x); } +Vector4 Vector3::yyzx() const { return Vector4 (y, y, z, x); } +Vector4 Vector3::zyzx() const { return Vector4 (z, y, z, x); } +Vector4 Vector3::xzzx() const { return Vector4 (x, z, z, x); } +Vector4 Vector3::yzzx() const { return Vector4 (y, z, z, x); } +Vector4 Vector3::zzzx() const { return Vector4 (z, z, z, x); } +Vector4 Vector3::xxxy() const { return Vector4 (x, x, x, y); } +Vector4 Vector3::yxxy() const { return Vector4 (y, x, x, y); } +Vector4 Vector3::zxxy() const { return Vector4 (z, x, x, y); } +Vector4 Vector3::xyxy() const { return Vector4 (x, y, x, y); } +Vector4 Vector3::yyxy() const { return Vector4 (y, y, x, y); } +Vector4 Vector3::zyxy() const { return Vector4 (z, y, x, y); } +Vector4 Vector3::xzxy() const { return Vector4 (x, z, x, y); } +Vector4 Vector3::yzxy() const { return Vector4 (y, z, x, y); } +Vector4 Vector3::zzxy() const { return Vector4 (z, z, x, y); } +Vector4 Vector3::xxyy() const { return Vector4 (x, x, y, y); } +Vector4 Vector3::yxyy() const { return Vector4 (y, x, y, y); } +Vector4 Vector3::zxyy() const { return Vector4 (z, x, y, y); } +Vector4 Vector3::xyyy() const { return Vector4 (x, y, y, y); } +Vector4 Vector3::yyyy() const { return Vector4 (y, y, y, y); } +Vector4 Vector3::zyyy() const { return Vector4 (z, y, y, y); } +Vector4 Vector3::xzyy() const { return Vector4 (x, z, y, y); } +Vector4 Vector3::yzyy() const { return Vector4 (y, z, y, y); } +Vector4 Vector3::zzyy() const { return Vector4 (z, z, y, y); } +Vector4 Vector3::xxzy() const { return Vector4 (x, x, z, y); } +Vector4 Vector3::yxzy() const { return Vector4 (y, x, z, y); } +Vector4 Vector3::zxzy() const { return Vector4 (z, x, z, y); } +Vector4 Vector3::xyzy() const { return Vector4 (x, y, z, y); } +Vector4 Vector3::yyzy() const { return Vector4 (y, y, z, y); } +Vector4 Vector3::zyzy() const { return Vector4 (z, y, z, y); } +Vector4 Vector3::xzzy() const { return Vector4 (x, z, z, y); } +Vector4 Vector3::yzzy() const { return Vector4 (y, z, z, y); } +Vector4 Vector3::zzzy() const { return Vector4 (z, z, z, y); } +Vector4 Vector3::xxxz() const { return Vector4 (x, x, x, z); } +Vector4 Vector3::yxxz() const { return Vector4 (y, x, x, z); } +Vector4 Vector3::zxxz() const { return Vector4 (z, x, x, z); } +Vector4 Vector3::xyxz() const { return Vector4 (x, y, x, z); } +Vector4 Vector3::yyxz() const { return Vector4 (y, y, x, z); } +Vector4 Vector3::zyxz() const { return Vector4 (z, y, x, z); } +Vector4 Vector3::xzxz() const { return Vector4 (x, z, x, z); } +Vector4 Vector3::yzxz() const { return Vector4 (y, z, x, z); } +Vector4 Vector3::zzxz() const { return Vector4 (z, z, x, z); } +Vector4 Vector3::xxyz() const { return Vector4 (x, x, y, z); } +Vector4 Vector3::yxyz() const { return Vector4 (y, x, y, z); } +Vector4 Vector3::zxyz() const { return Vector4 (z, x, y, z); } +Vector4 Vector3::xyyz() const { return Vector4 (x, y, y, z); } +Vector4 Vector3::yyyz() const { return Vector4 (y, y, y, z); } +Vector4 Vector3::zyyz() const { return Vector4 (z, y, y, z); } +Vector4 Vector3::xzyz() const { return Vector4 (x, z, y, z); } +Vector4 Vector3::yzyz() const { return Vector4 (y, z, y, z); } +Vector4 Vector3::zzyz() const { return Vector4 (z, z, y, z); } +Vector4 Vector3::xxzz() const { return Vector4 (x, x, z, z); } +Vector4 Vector3::yxzz() const { return Vector4 (y, x, z, z); } +Vector4 Vector3::zxzz() const { return Vector4 (z, x, z, z); } +Vector4 Vector3::xyzz() const { return Vector4 (x, y, z, z); } +Vector4 Vector3::yyzz() const { return Vector4 (y, y, z, z); } +Vector4 Vector3::zyzz() const { return Vector4 (z, y, z, z); } +Vector4 Vector3::xzzz() const { return Vector4 (x, z, z, z); } +Vector4 Vector3::yzzz() const { return Vector4 (y, z, z, z); } +Vector4 Vector3::zzzz() const { return Vector4 (z, z, z, z); } + + + + + + +} // namespace diff --git a/externals/g3dlite/Vector4.cpp b/externals/g3dlite/Vector4.cpp new file mode 100644 index 0000000..f6abc1a --- /dev/null +++ b/externals/g3dlite/Vector4.cpp @@ -0,0 +1,520 @@ +/** + @file Vector4.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2001-07-09 + @edited 2009-11-29 + */ + +#include +#include +#include "G3D/Vector4.h" +#include "G3D/Color4.h" +#include "G3D/g3dmath.h" +#include "G3D/stringutils.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/Vector4int8.h" +#include "G3D/Matrix4.h" +#include "G3D/Any.h" + +namespace G3D { + +Vector4::Vector4(const Any& any) { + any.verifyName("Vector4"); + any.verifyType(Any::TABLE, Any::ARRAY); + any.verifySize(4); + + if (any.type() == Any::ARRAY) { + x = any[0]; + y = any[1]; + z = any[2]; + w = any[3]; + } else { + // Table + x = any["x"]; + y = any["y"]; + z = any["z"]; + w = any["w"]; + } +} + +Vector4::operator Any() const { + Any any(Any::ARRAY, "Vector4"); + any.append(x, y, z, w); + return any; +} + + +Vector4::Vector4(const Vector4int8& v) : x(v.x / 127.0f), y(v.y / 127.0f), z(v.z / 127.0f), w(v.w / 127.0f) { +} + + +const Vector4& Vector4::inf() { + static const Vector4 v((float)G3D::finf(), (float)G3D::finf(), (float)G3D::finf(), (float)G3D::finf()); + return v; +} + + +const Vector4& Vector4::zero() { + static const Vector4 v(0,0,0,0); + return v; +} + +const Vector4& Vector4::nan() { + static Vector4 v((float)G3D::fnan(), (float)G3D::fnan(), (float)G3D::fnan(), (float)G3D::fnan()); + return v; +} + + +size_t Vector4::hashCode() const { + unsigned int xhash = (*(int*)(void*)(&x)); + unsigned int yhash = (*(int*)(void*)(&y)); + unsigned int zhash = (*(int*)(void*)(&z)); + unsigned int whash = (*(int*)(void*)(&w)); + + return xhash + (yhash * 37) + (zhash * 101) + (whash * 241); +} + + +Vector4::Vector4(const class Color4& c) { + x = c.r; + y = c.g; + z = c.b; + w = c.a; +} + + +Vector4::Vector4(const Vector2& v1, const Vector2& v2) { + x = v1.x; + y = v1.y; + z = v2.x; + w = v2.y; +} + + +Vector4::Vector4(const Vector2& v1, float fz, float fw) { + x = v1.x; + y = v1.y; + z = fz; + w = fw; +} + +Vector4::Vector4(BinaryInput& b) { + deserialize(b); +} + + +void Vector4::deserialize(BinaryInput& b) { + x = b.readFloat32(); + y = b.readFloat32(); + z = b.readFloat32(); + w = b.readFloat32(); +} + + +void Vector4::serialize(BinaryOutput& b) const { + b.writeFloat32(x); + b.writeFloat32(y); + b.writeFloat32(z); + b.writeFloat32(w); +} + +//---------------------------------------------------------------------------- + +Vector4 Vector4::operator*(const Matrix4& M) const { + Vector4 result; + for (int i = 0; i < 4; ++i) { + result[i] = 0.0f; + for (int j = 0; j < 4; ++j) { + result[i] += (*this)[j] * M[j][i]; + } + } + return result; +} + + +Vector4 Vector4::operator/ (float fScalar) const { + Vector4 kQuot; + + if ( fScalar != 0.0 ) { + float fInvScalar = 1.0f / fScalar; + kQuot.x = fInvScalar * x; + kQuot.y = fInvScalar * y; + kQuot.z = fInvScalar * z; + kQuot.w = fInvScalar * w; + return kQuot; + } else { + return Vector4::inf(); + } +} + +//---------------------------------------------------------------------------- +Vector4& Vector4::operator/= (float fScalar) { + if (fScalar != 0.0f) { + float fInvScalar = 1.0f / fScalar; + x *= fInvScalar; + y *= fInvScalar; + z *= fInvScalar; + w *= fInvScalar; + } else { + *this = Vector4::inf(); + } + + return *this; +} + + +//---------------------------------------------------------------------------- + +std::string Vector4::toString() const { + return G3D::format("(%g, %g, %g, %g)", x, y, z, w); +} +// 2-char swizzles + +Vector2 Vector4::xx() const { return Vector2 (x, x); } +Vector2 Vector4::yx() const { return Vector2 (y, x); } +Vector2 Vector4::zx() const { return Vector2 (z, x); } +Vector2 Vector4::wx() const { return Vector2 (w, x); } +Vector2 Vector4::xy() const { return Vector2 (x, y); } +Vector2 Vector4::yy() const { return Vector2 (y, y); } +Vector2 Vector4::zy() const { return Vector2 (z, y); } +Vector2 Vector4::wy() const { return Vector2 (w, y); } +Vector2 Vector4::xz() const { return Vector2 (x, z); } +Vector2 Vector4::yz() const { return Vector2 (y, z); } +Vector2 Vector4::zz() const { return Vector2 (z, z); } +Vector2 Vector4::wz() const { return Vector2 (w, z); } +Vector2 Vector4::xw() const { return Vector2 (x, w); } +Vector2 Vector4::yw() const { return Vector2 (y, w); } +Vector2 Vector4::zw() const { return Vector2 (z, w); } +Vector2 Vector4::ww() const { return Vector2 (w, w); } + +// 3-char swizzles + +Vector3 Vector4::xxx() const { return Vector3 (x, x, x); } +Vector3 Vector4::yxx() const { return Vector3 (y, x, x); } +Vector3 Vector4::zxx() const { return Vector3 (z, x, x); } +Vector3 Vector4::wxx() const { return Vector3 (w, x, x); } +Vector3 Vector4::xyx() const { return Vector3 (x, y, x); } +Vector3 Vector4::yyx() const { return Vector3 (y, y, x); } +Vector3 Vector4::zyx() const { return Vector3 (z, y, x); } +Vector3 Vector4::wyx() const { return Vector3 (w, y, x); } +Vector3 Vector4::xzx() const { return Vector3 (x, z, x); } +Vector3 Vector4::yzx() const { return Vector3 (y, z, x); } +Vector3 Vector4::zzx() const { return Vector3 (z, z, x); } +Vector3 Vector4::wzx() const { return Vector3 (w, z, x); } +Vector3 Vector4::xwx() const { return Vector3 (x, w, x); } +Vector3 Vector4::ywx() const { return Vector3 (y, w, x); } +Vector3 Vector4::zwx() const { return Vector3 (z, w, x); } +Vector3 Vector4::wwx() const { return Vector3 (w, w, x); } +Vector3 Vector4::xxy() const { return Vector3 (x, x, y); } +Vector3 Vector4::yxy() const { return Vector3 (y, x, y); } +Vector3 Vector4::zxy() const { return Vector3 (z, x, y); } +Vector3 Vector4::wxy() const { return Vector3 (w, x, y); } +Vector3 Vector4::xyy() const { return Vector3 (x, y, y); } +Vector3 Vector4::yyy() const { return Vector3 (y, y, y); } +Vector3 Vector4::zyy() const { return Vector3 (z, y, y); } +Vector3 Vector4::wyy() const { return Vector3 (w, y, y); } +Vector3 Vector4::xzy() const { return Vector3 (x, z, y); } +Vector3 Vector4::yzy() const { return Vector3 (y, z, y); } +Vector3 Vector4::zzy() const { return Vector3 (z, z, y); } +Vector3 Vector4::wzy() const { return Vector3 (w, z, y); } +Vector3 Vector4::xwy() const { return Vector3 (x, w, y); } +Vector3 Vector4::ywy() const { return Vector3 (y, w, y); } +Vector3 Vector4::zwy() const { return Vector3 (z, w, y); } +Vector3 Vector4::wwy() const { return Vector3 (w, w, y); } +Vector3 Vector4::xxz() const { return Vector3 (x, x, z); } +Vector3 Vector4::yxz() const { return Vector3 (y, x, z); } +Vector3 Vector4::zxz() const { return Vector3 (z, x, z); } +Vector3 Vector4::wxz() const { return Vector3 (w, x, z); } +Vector3 Vector4::xyz() const { return Vector3 (x, y, z); } +Vector3 Vector4::yyz() const { return Vector3 (y, y, z); } +Vector3 Vector4::zyz() const { return Vector3 (z, y, z); } +Vector3 Vector4::wyz() const { return Vector3 (w, y, z); } +Vector3 Vector4::xzz() const { return Vector3 (x, z, z); } +Vector3 Vector4::yzz() const { return Vector3 (y, z, z); } +Vector3 Vector4::zzz() const { return Vector3 (z, z, z); } +Vector3 Vector4::wzz() const { return Vector3 (w, z, z); } +Vector3 Vector4::xwz() const { return Vector3 (x, w, z); } +Vector3 Vector4::ywz() const { return Vector3 (y, w, z); } +Vector3 Vector4::zwz() const { return Vector3 (z, w, z); } +Vector3 Vector4::wwz() const { return Vector3 (w, w, z); } +Vector3 Vector4::xxw() const { return Vector3 (x, x, w); } +Vector3 Vector4::yxw() const { return Vector3 (y, x, w); } +Vector3 Vector4::zxw() const { return Vector3 (z, x, w); } +Vector3 Vector4::wxw() const { return Vector3 (w, x, w); } +Vector3 Vector4::xyw() const { return Vector3 (x, y, w); } +Vector3 Vector4::yyw() const { return Vector3 (y, y, w); } +Vector3 Vector4::zyw() const { return Vector3 (z, y, w); } +Vector3 Vector4::wyw() const { return Vector3 (w, y, w); } +Vector3 Vector4::xzw() const { return Vector3 (x, z, w); } +Vector3 Vector4::yzw() const { return Vector3 (y, z, w); } +Vector3 Vector4::zzw() const { return Vector3 (z, z, w); } +Vector3 Vector4::wzw() const { return Vector3 (w, z, w); } +Vector3 Vector4::xww() const { return Vector3 (x, w, w); } +Vector3 Vector4::yww() const { return Vector3 (y, w, w); } +Vector3 Vector4::zww() const { return Vector3 (z, w, w); } +Vector3 Vector4::www() const { return Vector3 (w, w, w); } + +// 4-char swizzles + +Vector4 Vector4::xxxx() const { return Vector4 (x, x, x, x); } +Vector4 Vector4::yxxx() const { return Vector4 (y, x, x, x); } +Vector4 Vector4::zxxx() const { return Vector4 (z, x, x, x); } +Vector4 Vector4::wxxx() const { return Vector4 (w, x, x, x); } +Vector4 Vector4::xyxx() const { return Vector4 (x, y, x, x); } +Vector4 Vector4::yyxx() const { return Vector4 (y, y, x, x); } +Vector4 Vector4::zyxx() const { return Vector4 (z, y, x, x); } +Vector4 Vector4::wyxx() const { return Vector4 (w, y, x, x); } +Vector4 Vector4::xzxx() const { return Vector4 (x, z, x, x); } +Vector4 Vector4::yzxx() const { return Vector4 (y, z, x, x); } +Vector4 Vector4::zzxx() const { return Vector4 (z, z, x, x); } +Vector4 Vector4::wzxx() const { return Vector4 (w, z, x, x); } +Vector4 Vector4::xwxx() const { return Vector4 (x, w, x, x); } +Vector4 Vector4::ywxx() const { return Vector4 (y, w, x, x); } +Vector4 Vector4::zwxx() const { return Vector4 (z, w, x, x); } +Vector4 Vector4::wwxx() const { return Vector4 (w, w, x, x); } +Vector4 Vector4::xxyx() const { return Vector4 (x, x, y, x); } +Vector4 Vector4::yxyx() const { return Vector4 (y, x, y, x); } +Vector4 Vector4::zxyx() const { return Vector4 (z, x, y, x); } +Vector4 Vector4::wxyx() const { return Vector4 (w, x, y, x); } +Vector4 Vector4::xyyx() const { return Vector4 (x, y, y, x); } +Vector4 Vector4::yyyx() const { return Vector4 (y, y, y, x); } +Vector4 Vector4::zyyx() const { return Vector4 (z, y, y, x); } +Vector4 Vector4::wyyx() const { return Vector4 (w, y, y, x); } +Vector4 Vector4::xzyx() const { return Vector4 (x, z, y, x); } +Vector4 Vector4::yzyx() const { return Vector4 (y, z, y, x); } +Vector4 Vector4::zzyx() const { return Vector4 (z, z, y, x); } +Vector4 Vector4::wzyx() const { return Vector4 (w, z, y, x); } +Vector4 Vector4::xwyx() const { return Vector4 (x, w, y, x); } +Vector4 Vector4::ywyx() const { return Vector4 (y, w, y, x); } +Vector4 Vector4::zwyx() const { return Vector4 (z, w, y, x); } +Vector4 Vector4::wwyx() const { return Vector4 (w, w, y, x); } +Vector4 Vector4::xxzx() const { return Vector4 (x, x, z, x); } +Vector4 Vector4::yxzx() const { return Vector4 (y, x, z, x); } +Vector4 Vector4::zxzx() const { return Vector4 (z, x, z, x); } +Vector4 Vector4::wxzx() const { return Vector4 (w, x, z, x); } +Vector4 Vector4::xyzx() const { return Vector4 (x, y, z, x); } +Vector4 Vector4::yyzx() const { return Vector4 (y, y, z, x); } +Vector4 Vector4::zyzx() const { return Vector4 (z, y, z, x); } +Vector4 Vector4::wyzx() const { return Vector4 (w, y, z, x); } +Vector4 Vector4::xzzx() const { return Vector4 (x, z, z, x); } +Vector4 Vector4::yzzx() const { return Vector4 (y, z, z, x); } +Vector4 Vector4::zzzx() const { return Vector4 (z, z, z, x); } +Vector4 Vector4::wzzx() const { return Vector4 (w, z, z, x); } +Vector4 Vector4::xwzx() const { return Vector4 (x, w, z, x); } +Vector4 Vector4::ywzx() const { return Vector4 (y, w, z, x); } +Vector4 Vector4::zwzx() const { return Vector4 (z, w, z, x); } +Vector4 Vector4::wwzx() const { return Vector4 (w, w, z, x); } +Vector4 Vector4::xxwx() const { return Vector4 (x, x, w, x); } +Vector4 Vector4::yxwx() const { return Vector4 (y, x, w, x); } +Vector4 Vector4::zxwx() const { return Vector4 (z, x, w, x); } +Vector4 Vector4::wxwx() const { return Vector4 (w, x, w, x); } +Vector4 Vector4::xywx() const { return Vector4 (x, y, w, x); } +Vector4 Vector4::yywx() const { return Vector4 (y, y, w, x); } +Vector4 Vector4::zywx() const { return Vector4 (z, y, w, x); } +Vector4 Vector4::wywx() const { return Vector4 (w, y, w, x); } +Vector4 Vector4::xzwx() const { return Vector4 (x, z, w, x); } +Vector4 Vector4::yzwx() const { return Vector4 (y, z, w, x); } +Vector4 Vector4::zzwx() const { return Vector4 (z, z, w, x); } +Vector4 Vector4::wzwx() const { return Vector4 (w, z, w, x); } +Vector4 Vector4::xwwx() const { return Vector4 (x, w, w, x); } +Vector4 Vector4::ywwx() const { return Vector4 (y, w, w, x); } +Vector4 Vector4::zwwx() const { return Vector4 (z, w, w, x); } +Vector4 Vector4::wwwx() const { return Vector4 (w, w, w, x); } +Vector4 Vector4::xxxy() const { return Vector4 (x, x, x, y); } +Vector4 Vector4::yxxy() const { return Vector4 (y, x, x, y); } +Vector4 Vector4::zxxy() const { return Vector4 (z, x, x, y); } +Vector4 Vector4::wxxy() const { return Vector4 (w, x, x, y); } +Vector4 Vector4::xyxy() const { return Vector4 (x, y, x, y); } +Vector4 Vector4::yyxy() const { return Vector4 (y, y, x, y); } +Vector4 Vector4::zyxy() const { return Vector4 (z, y, x, y); } +Vector4 Vector4::wyxy() const { return Vector4 (w, y, x, y); } +Vector4 Vector4::xzxy() const { return Vector4 (x, z, x, y); } +Vector4 Vector4::yzxy() const { return Vector4 (y, z, x, y); } +Vector4 Vector4::zzxy() const { return Vector4 (z, z, x, y); } +Vector4 Vector4::wzxy() const { return Vector4 (w, z, x, y); } +Vector4 Vector4::xwxy() const { return Vector4 (x, w, x, y); } +Vector4 Vector4::ywxy() const { return Vector4 (y, w, x, y); } +Vector4 Vector4::zwxy() const { return Vector4 (z, w, x, y); } +Vector4 Vector4::wwxy() const { return Vector4 (w, w, x, y); } +Vector4 Vector4::xxyy() const { return Vector4 (x, x, y, y); } +Vector4 Vector4::yxyy() const { return Vector4 (y, x, y, y); } +Vector4 Vector4::zxyy() const { return Vector4 (z, x, y, y); } +Vector4 Vector4::wxyy() const { return Vector4 (w, x, y, y); } +Vector4 Vector4::xyyy() const { return Vector4 (x, y, y, y); } +Vector4 Vector4::yyyy() const { return Vector4 (y, y, y, y); } +Vector4 Vector4::zyyy() const { return Vector4 (z, y, y, y); } +Vector4 Vector4::wyyy() const { return Vector4 (w, y, y, y); } +Vector4 Vector4::xzyy() const { return Vector4 (x, z, y, y); } +Vector4 Vector4::yzyy() const { return Vector4 (y, z, y, y); } +Vector4 Vector4::zzyy() const { return Vector4 (z, z, y, y); } +Vector4 Vector4::wzyy() const { return Vector4 (w, z, y, y); } +Vector4 Vector4::xwyy() const { return Vector4 (x, w, y, y); } +Vector4 Vector4::ywyy() const { return Vector4 (y, w, y, y); } +Vector4 Vector4::zwyy() const { return Vector4 (z, w, y, y); } +Vector4 Vector4::wwyy() const { return Vector4 (w, w, y, y); } +Vector4 Vector4::xxzy() const { return Vector4 (x, x, z, y); } +Vector4 Vector4::yxzy() const { return Vector4 (y, x, z, y); } +Vector4 Vector4::zxzy() const { return Vector4 (z, x, z, y); } +Vector4 Vector4::wxzy() const { return Vector4 (w, x, z, y); } +Vector4 Vector4::xyzy() const { return Vector4 (x, y, z, y); } +Vector4 Vector4::yyzy() const { return Vector4 (y, y, z, y); } +Vector4 Vector4::zyzy() const { return Vector4 (z, y, z, y); } +Vector4 Vector4::wyzy() const { return Vector4 (w, y, z, y); } +Vector4 Vector4::xzzy() const { return Vector4 (x, z, z, y); } +Vector4 Vector4::yzzy() const { return Vector4 (y, z, z, y); } +Vector4 Vector4::zzzy() const { return Vector4 (z, z, z, y); } +Vector4 Vector4::wzzy() const { return Vector4 (w, z, z, y); } +Vector4 Vector4::xwzy() const { return Vector4 (x, w, z, y); } +Vector4 Vector4::ywzy() const { return Vector4 (y, w, z, y); } +Vector4 Vector4::zwzy() const { return Vector4 (z, w, z, y); } +Vector4 Vector4::wwzy() const { return Vector4 (w, w, z, y); } +Vector4 Vector4::xxwy() const { return Vector4 (x, x, w, y); } +Vector4 Vector4::yxwy() const { return Vector4 (y, x, w, y); } +Vector4 Vector4::zxwy() const { return Vector4 (z, x, w, y); } +Vector4 Vector4::wxwy() const { return Vector4 (w, x, w, y); } +Vector4 Vector4::xywy() const { return Vector4 (x, y, w, y); } +Vector4 Vector4::yywy() const { return Vector4 (y, y, w, y); } +Vector4 Vector4::zywy() const { return Vector4 (z, y, w, y); } +Vector4 Vector4::wywy() const { return Vector4 (w, y, w, y); } +Vector4 Vector4::xzwy() const { return Vector4 (x, z, w, y); } +Vector4 Vector4::yzwy() const { return Vector4 (y, z, w, y); } +Vector4 Vector4::zzwy() const { return Vector4 (z, z, w, y); } +Vector4 Vector4::wzwy() const { return Vector4 (w, z, w, y); } +Vector4 Vector4::xwwy() const { return Vector4 (x, w, w, y); } +Vector4 Vector4::ywwy() const { return Vector4 (y, w, w, y); } +Vector4 Vector4::zwwy() const { return Vector4 (z, w, w, y); } +Vector4 Vector4::wwwy() const { return Vector4 (w, w, w, y); } +Vector4 Vector4::xxxz() const { return Vector4 (x, x, x, z); } +Vector4 Vector4::yxxz() const { return Vector4 (y, x, x, z); } +Vector4 Vector4::zxxz() const { return Vector4 (z, x, x, z); } +Vector4 Vector4::wxxz() const { return Vector4 (w, x, x, z); } +Vector4 Vector4::xyxz() const { return Vector4 (x, y, x, z); } +Vector4 Vector4::yyxz() const { return Vector4 (y, y, x, z); } +Vector4 Vector4::zyxz() const { return Vector4 (z, y, x, z); } +Vector4 Vector4::wyxz() const { return Vector4 (w, y, x, z); } +Vector4 Vector4::xzxz() const { return Vector4 (x, z, x, z); } +Vector4 Vector4::yzxz() const { return Vector4 (y, z, x, z); } +Vector4 Vector4::zzxz() const { return Vector4 (z, z, x, z); } +Vector4 Vector4::wzxz() const { return Vector4 (w, z, x, z); } +Vector4 Vector4::xwxz() const { return Vector4 (x, w, x, z); } +Vector4 Vector4::ywxz() const { return Vector4 (y, w, x, z); } +Vector4 Vector4::zwxz() const { return Vector4 (z, w, x, z); } +Vector4 Vector4::wwxz() const { return Vector4 (w, w, x, z); } +Vector4 Vector4::xxyz() const { return Vector4 (x, x, y, z); } +Vector4 Vector4::yxyz() const { return Vector4 (y, x, y, z); } +Vector4 Vector4::zxyz() const { return Vector4 (z, x, y, z); } +Vector4 Vector4::wxyz() const { return Vector4 (w, x, y, z); } +Vector4 Vector4::xyyz() const { return Vector4 (x, y, y, z); } +Vector4 Vector4::yyyz() const { return Vector4 (y, y, y, z); } +Vector4 Vector4::zyyz() const { return Vector4 (z, y, y, z); } +Vector4 Vector4::wyyz() const { return Vector4 (w, y, y, z); } +Vector4 Vector4::xzyz() const { return Vector4 (x, z, y, z); } +Vector4 Vector4::yzyz() const { return Vector4 (y, z, y, z); } +Vector4 Vector4::zzyz() const { return Vector4 (z, z, y, z); } +Vector4 Vector4::wzyz() const { return Vector4 (w, z, y, z); } +Vector4 Vector4::xwyz() const { return Vector4 (x, w, y, z); } +Vector4 Vector4::ywyz() const { return Vector4 (y, w, y, z); } +Vector4 Vector4::zwyz() const { return Vector4 (z, w, y, z); } +Vector4 Vector4::wwyz() const { return Vector4 (w, w, y, z); } +Vector4 Vector4::xxzz() const { return Vector4 (x, x, z, z); } +Vector4 Vector4::yxzz() const { return Vector4 (y, x, z, z); } +Vector4 Vector4::zxzz() const { return Vector4 (z, x, z, z); } +Vector4 Vector4::wxzz() const { return Vector4 (w, x, z, z); } +Vector4 Vector4::xyzz() const { return Vector4 (x, y, z, z); } +Vector4 Vector4::yyzz() const { return Vector4 (y, y, z, z); } +Vector4 Vector4::zyzz() const { return Vector4 (z, y, z, z); } +Vector4 Vector4::wyzz() const { return Vector4 (w, y, z, z); } +Vector4 Vector4::xzzz() const { return Vector4 (x, z, z, z); } +Vector4 Vector4::yzzz() const { return Vector4 (y, z, z, z); } +Vector4 Vector4::zzzz() const { return Vector4 (z, z, z, z); } +Vector4 Vector4::wzzz() const { return Vector4 (w, z, z, z); } +Vector4 Vector4::xwzz() const { return Vector4 (x, w, z, z); } +Vector4 Vector4::ywzz() const { return Vector4 (y, w, z, z); } +Vector4 Vector4::zwzz() const { return Vector4 (z, w, z, z); } +Vector4 Vector4::wwzz() const { return Vector4 (w, w, z, z); } +Vector4 Vector4::xxwz() const { return Vector4 (x, x, w, z); } +Vector4 Vector4::yxwz() const { return Vector4 (y, x, w, z); } +Vector4 Vector4::zxwz() const { return Vector4 (z, x, w, z); } +Vector4 Vector4::wxwz() const { return Vector4 (w, x, w, z); } +Vector4 Vector4::xywz() const { return Vector4 (x, y, w, z); } +Vector4 Vector4::yywz() const { return Vector4 (y, y, w, z); } +Vector4 Vector4::zywz() const { return Vector4 (z, y, w, z); } +Vector4 Vector4::wywz() const { return Vector4 (w, y, w, z); } +Vector4 Vector4::xzwz() const { return Vector4 (x, z, w, z); } +Vector4 Vector4::yzwz() const { return Vector4 (y, z, w, z); } +Vector4 Vector4::zzwz() const { return Vector4 (z, z, w, z); } +Vector4 Vector4::wzwz() const { return Vector4 (w, z, w, z); } +Vector4 Vector4::xwwz() const { return Vector4 (x, w, w, z); } +Vector4 Vector4::ywwz() const { return Vector4 (y, w, w, z); } +Vector4 Vector4::zwwz() const { return Vector4 (z, w, w, z); } +Vector4 Vector4::wwwz() const { return Vector4 (w, w, w, z); } +Vector4 Vector4::xxxw() const { return Vector4 (x, x, x, w); } +Vector4 Vector4::yxxw() const { return Vector4 (y, x, x, w); } +Vector4 Vector4::zxxw() const { return Vector4 (z, x, x, w); } +Vector4 Vector4::wxxw() const { return Vector4 (w, x, x, w); } +Vector4 Vector4::xyxw() const { return Vector4 (x, y, x, w); } +Vector4 Vector4::yyxw() const { return Vector4 (y, y, x, w); } +Vector4 Vector4::zyxw() const { return Vector4 (z, y, x, w); } +Vector4 Vector4::wyxw() const { return Vector4 (w, y, x, w); } +Vector4 Vector4::xzxw() const { return Vector4 (x, z, x, w); } +Vector4 Vector4::yzxw() const { return Vector4 (y, z, x, w); } +Vector4 Vector4::zzxw() const { return Vector4 (z, z, x, w); } +Vector4 Vector4::wzxw() const { return Vector4 (w, z, x, w); } +Vector4 Vector4::xwxw() const { return Vector4 (x, w, x, w); } +Vector4 Vector4::ywxw() const { return Vector4 (y, w, x, w); } +Vector4 Vector4::zwxw() const { return Vector4 (z, w, x, w); } +Vector4 Vector4::wwxw() const { return Vector4 (w, w, x, w); } +Vector4 Vector4::xxyw() const { return Vector4 (x, x, y, w); } +Vector4 Vector4::yxyw() const { return Vector4 (y, x, y, w); } +Vector4 Vector4::zxyw() const { return Vector4 (z, x, y, w); } +Vector4 Vector4::wxyw() const { return Vector4 (w, x, y, w); } +Vector4 Vector4::xyyw() const { return Vector4 (x, y, y, w); } +Vector4 Vector4::yyyw() const { return Vector4 (y, y, y, w); } +Vector4 Vector4::zyyw() const { return Vector4 (z, y, y, w); } +Vector4 Vector4::wyyw() const { return Vector4 (w, y, y, w); } +Vector4 Vector4::xzyw() const { return Vector4 (x, z, y, w); } +Vector4 Vector4::yzyw() const { return Vector4 (y, z, y, w); } +Vector4 Vector4::zzyw() const { return Vector4 (z, z, y, w); } +Vector4 Vector4::wzyw() const { return Vector4 (w, z, y, w); } +Vector4 Vector4::xwyw() const { return Vector4 (x, w, y, w); } +Vector4 Vector4::ywyw() const { return Vector4 (y, w, y, w); } +Vector4 Vector4::zwyw() const { return Vector4 (z, w, y, w); } +Vector4 Vector4::wwyw() const { return Vector4 (w, w, y, w); } +Vector4 Vector4::xxzw() const { return Vector4 (x, x, z, w); } +Vector4 Vector4::yxzw() const { return Vector4 (y, x, z, w); } +Vector4 Vector4::zxzw() const { return Vector4 (z, x, z, w); } +Vector4 Vector4::wxzw() const { return Vector4 (w, x, z, w); } +Vector4 Vector4::xyzw() const { return Vector4 (x, y, z, w); } +Vector4 Vector4::yyzw() const { return Vector4 (y, y, z, w); } +Vector4 Vector4::zyzw() const { return Vector4 (z, y, z, w); } +Vector4 Vector4::wyzw() const { return Vector4 (w, y, z, w); } +Vector4 Vector4::xzzw() const { return Vector4 (x, z, z, w); } +Vector4 Vector4::yzzw() const { return Vector4 (y, z, z, w); } +Vector4 Vector4::zzzw() const { return Vector4 (z, z, z, w); } +Vector4 Vector4::wzzw() const { return Vector4 (w, z, z, w); } +Vector4 Vector4::xwzw() const { return Vector4 (x, w, z, w); } +Vector4 Vector4::ywzw() const { return Vector4 (y, w, z, w); } +Vector4 Vector4::zwzw() const { return Vector4 (z, w, z, w); } +Vector4 Vector4::wwzw() const { return Vector4 (w, w, z, w); } +Vector4 Vector4::xxww() const { return Vector4 (x, x, w, w); } +Vector4 Vector4::yxww() const { return Vector4 (y, x, w, w); } +Vector4 Vector4::zxww() const { return Vector4 (z, x, w, w); } +Vector4 Vector4::wxww() const { return Vector4 (w, x, w, w); } +Vector4 Vector4::xyww() const { return Vector4 (x, y, w, w); } +Vector4 Vector4::yyww() const { return Vector4 (y, y, w, w); } +Vector4 Vector4::zyww() const { return Vector4 (z, y, w, w); } +Vector4 Vector4::wyww() const { return Vector4 (w, y, w, w); } +Vector4 Vector4::xzww() const { return Vector4 (x, z, w, w); } +Vector4 Vector4::yzww() const { return Vector4 (y, z, w, w); } +Vector4 Vector4::zzww() const { return Vector4 (z, z, w, w); } +Vector4 Vector4::wzww() const { return Vector4 (w, z, w, w); } +Vector4 Vector4::xwww() const { return Vector4 (x, w, w, w); } +Vector4 Vector4::ywww() const { return Vector4 (y, w, w, w); } +Vector4 Vector4::zwww() const { return Vector4 (z, w, w, w); } +Vector4 Vector4::wwww() const { return Vector4 (w, w, w, w); } + + +}; // namespace diff --git a/externals/g3dlite/debugAssert.cpp b/externals/g3dlite/debugAssert.cpp new file mode 100644 index 0000000..a87161b --- /dev/null +++ b/externals/g3dlite/debugAssert.cpp @@ -0,0 +1,389 @@ +/** + @file debugAssert.cpp + + Windows implementation of assertion routines. + + @maintainer Morgan McGuire, graphics3d.com + + @created 2001-08-26 + @edited 2009-06-02 + */ + +#include "G3D/debugAssert.h" +#include "G3D/platform.h" +#ifdef G3D_WIN32 + #include +#endif +#include "G3D/format.h" +#include "G3D/prompt.h" +#include +#include "G3D/debugPrintf.h" +#include "G3D/Log.h" + +#include + +#ifdef _MSC_VER + // disable: "C++ exception handler used" +# pragma warning (push) +# pragma warning (disable : 4530) +#endif + +using namespace std; + +namespace G3D { namespace _internal { + +ConsolePrintHook _consolePrintHook; +AssertionHook _debugHook = _handleDebugAssert_; +AssertionHook _failureHook = _handleErrorCheck_; + +#ifdef G3D_LINUX +#if SOMEONE_MADE_THIS_USEFUL + Display* x11Display = NULL; + Window x11Window = 0; +#endif +#endif + + +#ifdef G3D_WIN32 +static void postToClipboard(const char *text) { + if (OpenClipboard(NULL)) { + HGLOBAL hMem = GlobalAlloc(GHND | GMEM_DDESHARE, strlen(text) + 1); + if (hMem) { + char *pMem = (char*)GlobalLock(hMem); + strcpy(pMem, text); + GlobalUnlock(hMem); + + EmptyClipboard(); + SetClipboardData(CF_TEXT, hMem); + } + + CloseClipboard(); + GlobalFree(hMem); + } +} +#endif + +/** + outTitle should be set before the call + */ +static void createErrorMessage( + const char* expression, + const std::string& message, + const char* filename, + int lineNumber, + std::string& outTitle, + std::string& outMessage) { + + std::string le = ""; + const char* newline = "\n"; + + #ifdef G3D_WIN32 + newline = "\r\n"; + + // The last error value. (Which is preserved across the call). + DWORD lastErr = GetLastError(); + + // The decoded message from FormatMessage + LPTSTR formatMsg = NULL; + + if (NULL == formatMsg) { + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + lastErr, + 0, + (LPTSTR)&formatMsg, + 0, + NULL); + } + + // Make sure the message got translated into something. + LPTSTR realLastErr; + if (NULL != formatMsg) { + realLastErr = formatMsg; + } else { + realLastErr = _T("Last error code does not exist."); + } + + if (lastErr != 0) { + le = G3D::format("Last Error (0x%08X): %s\r\n\r\n", lastErr, (LPCSTR)realLastErr); + } + + // Get rid of the allocated memory from FormatMessage. + if (NULL != formatMsg) { + LocalFree((LPVOID)formatMsg); + } + + char modulePath[MAX_PATH]; + GetModuleFileNameA(NULL, modulePath, MAX_PATH); + + const char* moduleName = strrchr(modulePath, '\\'); + outTitle = outTitle + string(" - ") + string(moduleName ? (moduleName + 1) : modulePath); + + #endif + + // Build the message. + outMessage = + G3D::format("%s%s%sExpression: %s%s%s:%d%s%s%s", + message.c_str(), newline, newline, expression, newline, + filename, lineNumber, newline, newline, le.c_str()); +} + + +bool _handleDebugAssert_( + const char* expression, + const std::string& message, + const char* filename, + int lineNumber, + bool useGuiPrompt) { + + std::string dialogTitle = "Assertion Failure"; + std::string dialogText = ""; + createErrorMessage(expression, message, filename, lineNumber, dialogTitle, dialogText); + + #ifdef G3D_WIN32 + DWORD lastErr = GetLastError(); + postToClipboard(dialogText.c_str()); + debugPrintf("\n%s\n", dialogText.c_str()); + #endif + + const int cBreak = 0; + const int cIgnore = 1; + const int cAbort = 2; + + static const char* choices[] = {"Debug", "Ignore", "Exit"}; + + // Log the error + Log::common()->print(std::string("\n**************************\n\n") + dialogTitle + "\n" + dialogText); + + int result = G3D::prompt(dialogTitle.c_str(), dialogText.c_str(), (const char**)choices, 3, useGuiPrompt); + +# ifdef G3D_WIN32 + // Put the incoming last error back. + SetLastError(lastErr); +# endif + + switch (result) { + // -1 shouldn't actually occur because it means + // that we're in release mode. + case -1: + case cBreak: + return true; + break; + + case cIgnore: + return false; + break; + + case cAbort: + exit(-1); + break; + } + + // Should never get here + return false; +} + + +bool _handleErrorCheck_( + const char* expression, + const std::string& message, + const char* filename, + int lineNumber, + bool useGuiPrompt) { + + std::string dialogTitle = "Critical Error"; + std::string dialogText = ""; + + createErrorMessage(expression, message, filename, lineNumber, dialogTitle, dialogText); + + // Log the error + Log::common()->print(std::string("\n**************************\n\n") + dialogTitle + "\n" + dialogText); + #ifdef G3D_WIN32 + DWORD lastErr = GetLastError(); + (void)lastErr; + postToClipboard(dialogText.c_str()); + debugPrintf("\n%s\n", dialogText.c_str()); + #endif + + static const char* choices[] = {"Ok"}; + + const std::string& m = + std::string("An internal error has occured in this program and it will now close. " + "The specific error is below. More information has been saved in \"") + + Log::getCommonLogFilename() + "\".\n" + dialogText; + + int result = G3D::prompt("Error", m.c_str(), (const char**)choices, 1, useGuiPrompt); + (void)result; + + return true; +} + + +#ifdef G3D_WIN32 +static HCURSOR oldCursor; +static RECT oldCursorRect; +static POINT oldCursorPos; +static int oldShowCursorCount; +#endif + +void _releaseInputGrab_() { + #ifdef G3D_WIN32 + + GetCursorPos(&oldCursorPos); + + // Stop hiding the cursor if the application hid it. + oldShowCursorCount = ShowCursor(true) - 1; + + if (oldShowCursorCount < -1) { + for (int c = oldShowCursorCount; c < -1; ++c) { + ShowCursor(true); + } + } + + // Set the default cursor in case the application + // set the cursor to NULL. + oldCursor = GetCursor(); + SetCursor(LoadCursor(NULL, IDC_ARROW)); + + // Allow the cursor full access to the screen + GetClipCursor(&oldCursorRect); + ClipCursor(NULL); + + #elif defined(G3D_LINUX) +#if SOMEONE_MADE_THIS_USEFUL + if (x11Display != NULL) { + XUngrabPointer(x11Display, CurrentTime); + XUngrabKeyboard(x11Display, CurrentTime); + if (x11Window != 0) { + //XUndefineCursor(x11Display, x11Window); + // TODO: Note that we leak this cursor; it should be + // freed in the restore code. + Cursor c = XCreateFontCursor(x11Display, 68); + XDefineCursor(x11Display, x11Window, c); + } + XSync(x11Display, false); + XAllowEvents(x11Display, AsyncPointer, CurrentTime); + XFlush(x11Display); + } +#endif + #elif defined(G3D_OSX) + // TODO: OS X + #endif +} + + +void _restoreInputGrab_() { + #ifdef G3D_WIN32 + + // Restore the old clipping region + ClipCursor(&oldCursorRect); + + SetCursorPos(oldCursorPos.x, oldCursorPos.y); + + // Restore the old cursor + SetCursor(oldCursor); + + // Restore old visibility count + if (oldShowCursorCount < 0) { + for (int c = 0; c > oldShowCursorCount; --c) { + ShowCursor(false); + } + } + + #elif defined(G3D_LINUX) + // TODO: Linux + #elif defined(G3D_OSX) + // TODO: OS X + #endif +} + + +}; // internal namespace + +void setAssertionHook(AssertionHook hook) { + G3D::_internal::_debugHook = hook; +} + +AssertionHook assertionHook() { + return G3D::_internal::_debugHook; +} + +void setFailureHook(AssertionHook hook) { + G3D::_internal::_failureHook = hook; +} + +AssertionHook failureHook() { + return G3D::_internal::_failureHook; +} + + +void setConsolePrintHook(ConsolePrintHook h) { + G3D::_internal::_consolePrintHook = h; +} + +ConsolePrintHook consolePrintHook() { + return G3D::_internal::_consolePrintHook; +} + + +std::string __cdecl debugPrint(const std::string& s) { +# ifdef G3D_WIN32 + const int MAX_STRING_LEN = 1024; + + // Windows can't handle really long strings sent to + // the console, so we break the string. + if (s.size() < MAX_STRING_LEN) { + OutputDebugStringA(s.c_str()); + } else { + for (unsigned int i = 0; i < s.size(); i += MAX_STRING_LEN) { + std::string sub = s.substr(i, MAX_STRING_LEN); + OutputDebugStringA(sub.c_str()); + } + } +# else + fprintf(stderr, "%s", s.c_str()); + fflush(stderr); +# endif + + return s; +} + +std::string __cdecl debugPrintf(const char* fmt ...) { + va_list argList; + va_start(argList, fmt); + std::string s = G3D::vformat(fmt, argList); + va_end(argList); + + return debugPrint(s); +// return debugPrint(consolePrint(s)); +} + +std::string consolePrint(const std::string& s) { + FILE* L = Log::common()->getFile(); + fprintf(L, "%s", s.c_str()); + + if (consolePrintHook()) { + consolePrintHook()(s); + } + + fflush(L); + return s; +} + + +std::string __cdecl consolePrintf(const char* fmt ...) { + va_list argList; + va_start(argList, fmt); + std::string s = G3D::vformat(fmt, argList); + va_end(argList); + + return consolePrint(s); +} + +} // namespace + +#ifdef _MSC_VER +# pragma warning (pop) +#endif diff --git a/externals/g3dlite/fileutils.cpp b/externals/g3dlite/fileutils.cpp new file mode 100644 index 0000000..3f5eb57 --- /dev/null +++ b/externals/g3dlite/fileutils.cpp @@ -0,0 +1,1165 @@ +/** + @file fileutils.cpp + + @author Morgan McGuire, graphics3d.com + + @author 2002-06-06 + @edited 2010-02-05 + */ + +#include +#include +#include "G3D/platform.h" +#include "G3D/fileutils.h" +#include "G3D/BinaryInput.h" +#include "G3D/BinaryOutput.h" +#include "G3D/g3dmath.h" +#include "G3D/stringutils.h" +#include "G3D/Set.h" +#include "G3D/g3dfnmatch.h" + +#include +#include +#if _HAVE_ZIP + #include "zip.h" +#endif + +#ifdef G3D_WIN32 + // Needed for _getcwd + #include + #include +#else + #include + #include + #include + #define _getcwd getcwd + #define _stat stat +#endif + + +namespace G3D { + +namespace _internal { + Set currentFilesUsed; +} + +std::string pathConcat(const std::string& dirname, const std::string& file) { + // Ensure that the directory ends in a slash + if ((dirname.size() != 0) && + (dirname[dirname.size() - 1] != '/') && + (dirname[dirname.size() - 1] != '\\') && + (dirname[dirname.size() - 1] != ':')) { + return dirname + '/' + file; + } else { + return dirname + file; + } +} + +std::string resolveFilename(const std::string& filename) { + if (filename.size() >= 1) { + if ((filename[0] == '/') || (filename[0] == '\\')) { + // Already resolved + return filename; + } else { + + #ifdef G3D_WIN32 + if ((filename.size() >= 2) && (filename[1] == ':')) { + // There is a drive spec on the front. + if ((filename.size() >= 3) && ((filename[2] == '\\') || + (filename[2] == '/'))) { + // Already fully qualified + return filename; + } else { + // The drive spec is relative to the + // working directory on that drive. + debugAssertM(false, "Files of the form d:path are" + " not supported (use a fully qualified" + " name)."); + return filename; + } + } + #endif + } + } + + char buffer[1024]; + + // Prepend the working directory. + _getcwd(buffer, 1024); + + return format("%s/%s", buffer, filename.c_str()); +} + +bool zipfileExists(const std::string& filename) { + std::string outZipfile; + std::string outInternalFile; + return zipfileExists(filename, outZipfile, outInternalFile); +} + +std::string readWholeFile( + const std::string& filename) { + + _internal::currentFilesUsed.insert(filename); + + std::string s; + + debugAssert(filename != ""); + if (fileExists(filename, false)) { + + int64 length = fileLength(filename); + + char* buffer = (char*)System::alignedMalloc(length + 1, 16); + debugAssert(buffer); + FILE* f = fopen(filename.c_str(), "rb"); + debugAssert(f); + int ret = fread(buffer, 1, length, f); + debugAssert(ret == length);(void)ret; + fclose(f); + + buffer[length] = '\0'; + s = std::string(buffer); + + System::alignedFree(buffer); + + } else if (zipfileExists(filename)) { + + void* zipBuffer; + size_t length; + zipRead(filename, zipBuffer, length); + + char* buffer = (char*)System::alignedMalloc(length + 1, 16); + System::memcpy(buffer,zipBuffer, length + 1); + zipClose(zipBuffer); + + buffer[length] = '\0'; + s = std::string(buffer); + System::alignedFree(buffer); + } else { + debugAssertM(false, filename + " not found"); + } + + return s; +} + + +void zipRead(const std::string& file, + void*& data, + size_t& length) { + std::string zip, desiredFile; +#if _HAVE_ZIP + if (zipfileExists(file, zip, desiredFile)) { + struct zip *z = zip_open( zip.c_str(), ZIP_CHECKCONS, NULL ); + { + struct zip_stat info; + zip_stat_init( &info ); // TODO: Docs unclear if zip_stat_init is required. + zip_stat( z, desiredFile.c_str(), ZIP_FL_NOCASE, &info ); + length = info.size; + // sets machines up to use MMX, if they want + data = System::alignedMalloc(length, 16); + struct zip_file *zf = zip_fopen( z, desiredFile.c_str(), ZIP_FL_NOCASE ); + { + int test = zip_fread( zf, data, length ); + debugAssertM((size_t)test == length, + desiredFile + " was corrupt because it unzipped to the wrong size."); + (void)test; + } + zip_fclose( zf ); + } + zip_close( z ); + } else { + data = NULL; + } +#else + data = NULL; +#endif +} + + +void zipClose(void* data) { + System::alignedFree(data); +} + + +int64 fileLength(const std::string& filename) { + struct _stat st; + int result = _stat(filename.c_str(), &st); + + if (result == -1) { +#if _HAVE_ZIP + std::string zip, contents; + if(zipfileExists(filename, zip, contents)){ + int64 requiredMem; + + struct zip *z = zip_open( zip.c_str(), ZIP_CHECKCONS, NULL ); + debugAssertM(z != NULL, zip + ": zip open failed."); + { + struct zip_stat info; + zip_stat_init( &info ); // TODO: Docs unclear if zip_stat_init is required. + int success = zip_stat( z, contents.c_str(), ZIP_FL_NOCASE, &info ); + debugAssertM(success == 0, zip + ": " + contents + ": zip stat failed."); + requiredMem = info.size; + } + zip_close( z ); + return requiredMem; + } else { + return -1; + } +#else + return -1; +#endif + } + + return st.st_size; +} + +/** Used by robustTmpfile. Returns nonzero if fread, fwrite, and fseek all +succeed on the file. + @author Morgan McGuire, http://graphics.cs.williams.edu */ +static int isFileGood(FILE* f) { + + int x, n, result; + + /* Must be a valid file handle */ + if (f == NULL) { + return 0; + } + + /* Try to write */ + x = 1234; + n = fwrite(&x, sizeof(int), 1, f); + + if (n != 1) { + return 0; + } + + /* Seek back to the beginning */ + result = fseek(f, 0, SEEK_SET); + if (result != 0) { + return 0; + } + + /* Read */ + n = fread(&x, sizeof(int), 1, f); + if (n != 1) { + return 0; + } + + /* Seek back to the beginning again */ + fseek(f, 0, SEEK_SET); + + return 1; +} + +FILE* createTempFile() { + FILE* t = NULL; + +//# ifdef G3D_WIN32 + t = tmpfile(); +//# else +// // On Unix, tmpfile generates a warning for any code that links against it. +// const char* tempfilename = "/tmp/g3dtemp.XXXXXXXX"; +// mktemp(tempfilename); +// t = fopen(tempfilename, "w"); +//# endif + +# ifdef _WIN32 + char* n = NULL; +# endif + char name[256]; + + if (isFileGood(t)) { + return t; + } + +# ifdef G3D_WIN32 + /* tmpfile failed; try the tmpnam routine */ + t = fopen(tmpnam(NULL), "w+"); + if (isFileGood(t)) { + return t; + } + + n = _tempnam("c:/tmp/", "t"); + /* Try to create something in C:\tmp */ + t = fopen(n, "w+"); + if (isFileGood(t)) { + return t; + } + + /* Try c:\temp */ + n = _tempnam("c:/temp/", "t"); + t = fopen(n, "w+"); + if (isFileGood(t)) { + return t; + } + + /* try the current directory */ + n = _tempnam("./", "t"); + t = fopen(n, "w+"); + if (isFileGood(t)) { + return t; + } + + sprintf(name, "%s/tmp%d", "c:/temp", rand()); + t = fopen(name, "w+"); + if (isFileGood(t)) { + return t; + } + + /* Try some hardcoded paths */ + sprintf(name, "%s/tmp%d", "c:/tmp", rand()); + t = fopen(name, "w+"); + if (isFileGood(t)) { + return t; + } +# else + sprintf(name, "%s/tmp%d", "/tmp", rand()); + t = fopen(name, "w+"); + if (isFileGood(t)) { + return t; + } +#endif + + sprintf(name, "tmp%d", rand()); + t = fopen(name, "w+"); + if (isFileGood(t)) { + return t; + } + + fprintf(stderr, "Unable to create a temporary file; robustTmpfile returning NULL\n"); + + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +void writeWholeFile( + const std::string& filename, + const std::string& str, + bool flush) { + + // Make sure the directory exists. + std::string root, base, ext, path; + Array pathArray; + parseFilename(filename, root, pathArray, base, ext); + + path = root + stringJoin(pathArray, '/'); + if (! fileExists(path, false)) { + createDirectory(path); + } + + FILE* file = fopen(filename.c_str(), "wb"); + + debugAssert(file); + + fwrite(str.c_str(), str.size(), 1, file); + + if (flush) { + fflush(file); + } + fclose(file); +} + +/////////////////////////////////////////////////////////////////////////////// + +/** + Creates the directory (which may optionally end in a /) + and any parents needed to reach it. + */ +void createDirectory( + const std::string& dir) { + + if (dir == "") { + return; + } + + std::string d; + + // Add a trailing / if there isn't one. + switch (dir[dir.size() - 1]) { + case '/': + case '\\': + d = dir; + break; + + default: + d = dir + "/"; + } + + // If it already exists, do nothing + if (fileExists(d.substr(0, d.size() - 1)), false) { + return; + } + + // Parse the name apart + std::string root, base, ext; + Array path; + + std::string lead; + parseFilename(d, root, path, base, ext); + debugAssert(base == ""); + debugAssert(ext == ""); + + // Begin with an extra period so "c:\" becomes "c:\.\" after + // appending a path and "c:" becomes "c:.\", not root: "c:\" + std::string p = root + "."; + + // Create any intermediate that doesn't exist + for (int i = 0; i < path.size(); ++i) { + p += "/" + path[i]; + if (! fileExists(p, false)) { + // Windows only requires one argument to mkdir, + // where as unix also requires the permissions. +# ifndef G3D_WIN32 + mkdir(p.c_str(), 0777); +# else + _mkdir(p.c_str()); +# endif + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +class FileSystemCache { +private: + + Table > m_files; + +public: + + bool fileExists(const std::string& filename) { + const std::string& path = resolveFilename(filenamePath(filename)); + const std::string& name = filenameBaseExt(filename); + + bool neverBeforeSeen = false; + Array& fileList = m_files.getCreate(path, neverBeforeSeen); + if (neverBeforeSeen) { + if (! G3D::fileExists(path, true, false)) { + // The path itself doesn't exist... back out our insertion (which makes fileList& invalid) + m_files.remove(path); + return false; + } + + std::string spec = pathConcat(path, "*"); + + // Will automatically recurse into zipfiles + getFiles(spec, fileList); + getDirs(spec, fileList); + +# ifdef G3D_WIN32 + { + // Case insensitive + for (int i = 0; i < fileList.size(); ++i) { + fileList[i] = toLower(fileList[i]); + } + } +# endif + } + + if (filenameContainsWildcards(name)) { + // See if anything matches + for (int i = 0; i < fileList.size(); ++i) { + if (g3dfnmatch(name.c_str(), fileList[i].c_str(), 0) == 0) { + return true; + } + } + return false; + } else { + // On windows, this is a lower-lower comparison, so it is case insensitive + return fileList.contains(name); + } + } + + void clear() { + m_files.clear(); + } + + static FileSystemCache& instance() { + static FileSystemCache i; + return i; + } +}; + + +void clearFileSystemCache() { + FileSystemCache::instance().clear(); +} + +bool fileExists +(const std::string& _filename, + bool lookInZipfiles, + bool trustCache) { + + if (_filename.empty()) { + return false; + } + + // Remove trailing slash from directories + const std::string& filename = (endsWith(_filename, "/") || endsWith(_filename, "\\")) ? _filename.substr(0, _filename.length() - 1) : _filename; + + if (trustCache && lookInZipfiles) { +# ifdef G3D_WIN32 + // Case insensitive + return FileSystemCache::instance().fileExists(toLower(filename)); +# else + return FileSystemCache::instance().fileExists(filename); +# endif + } + + // Useful for debugging + //char curdir[1024]; _getcwd(curdir, 1024); + + struct _stat st; + int ret = _stat(filename.c_str(), &st); + + // _stat returns zero on success + bool exists = (ret == 0); + + if (! exists && lookInZipfiles) { + // Does not exist standalone, but might exist in a zipfile + + // These output arguments will be ignored + std::string zipDir, internalPath; + return zipfileExists(filename, zipDir, internalPath); + } else { + return exists; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#if _HAVE_ZIP +/* Helper methods for zipfileExists()*/ +// Given a string (the drive) and an array (the path), computes the directory +static void _zip_resolveDirectory(std::string& completeDir, const std::string& drive, const Array& path, const int length){ + completeDir = drive; + int tempLength; + // if the given length is longer than the array, we correct it + if(length > path.length()){ + tempLength = path.length(); + } else{ + tempLength = length; + } + + for(int t = 0; t < tempLength; ++t){ + if(t > 0){ + completeDir += "/"; + } + completeDir += path[t]; + } +} + + +// assumes that zipDir references a .zip file +static bool _zip_zipContains(const std::string& zipDir, const std::string& desiredFile){ + struct zip *z = zip_open( zipDir.c_str(), ZIP_CHECKCONS, NULL ); + //the last parameter, an int, determines case sensitivity: + //1 is sensitive, 2 is not, 0 is default + int test = zip_name_locate( z, desiredFile.c_str(), ZIP_FL_NOCASE ); + zip_close( z ); + if(test == -1){ + return false; + } + return true; +} +#endif + +// If no zipfile exists, outZipfile and outInternalFile are unchanged +bool zipfileExists(const std::string& filename, std::string& outZipfile, + std::string& outInternalFile){ +#if _HAVE_ZIP + Array path; + std::string drive, base, ext, zipfile, infile; + parseFilename(filename, drive, path, base, ext); + + // Put the filename back together + if ((base != "") && (ext != "")) { + infile = base + "." + ext; + } else { + infile = base + ext; + } + + // Remove "." from path + for (int i = 0; i < path.length(); ++i) { + if (path[i] == ".") { + path.remove(i); + --i; + } + } + + // Remove ".." from path + for (int i = 1; i < path.length(); ++i) { + if ((path[i] == "..") && (i > 0) && (path[i - 1] != "..")) { + // Remove both i and i - 1 + path.remove(i - 1, 2); + i -= 2; + } + } + + // Walk the path backwards, accumulating pieces onto the infile until + // we find a zipfile that contains it + for (int t = 0; t < path.length(); ++t){ + _zip_resolveDirectory(zipfile, drive, path, path.length() - t); + if (t > 0) { + infile = path[path.length() - t] + "/" + infile; + } + + if (endsWith(zipfile, "..")) { + return false; + } + + if (fileExists(zipfile, false)) { + // test if it actually is a zipfile + // if not, return false, a bad + // directory structure has been given, + // not a .zip + if (isZipfile(zipfile)){ + + if (_zip_zipContains(zipfile, infile)){ + outZipfile = zipfile; + outInternalFile = infile; + return true; + } else { + return false; + } + } else { + // the directory structure was valid but did not point to a .zip + return false; + } + } + + } +#endif + // not a valid directory structure ever, + // obviously no .zip was found within the path + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +std::string generateFilenameBase(const std::string& prefix, const std::string& suffix) { + Array exist; + + // Note "template" is a reserved word in C++ + std::string templat = prefix + System::currentDateString() + "_"; + getFiles(templat + "*", exist); + + // Remove extensions + for (int i = 0; i < exist.size(); ++i) { + exist[i] = filenameBase(exist[i]); + } + + int num = 0; + std::string result; + templat += "%03d" + suffix; + do { + result = format(templat.c_str(), num); + ++num; + } while (exist.contains(result)); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// + +void copyFile( + const std::string& source, + const std::string& dest) { + + #ifdef G3D_WIN32 + CopyFileA(source.c_str(), dest.c_str(), FALSE); + #else + // TODO: don't use BinaryInput and BinaryOutput + // Read it all in, then dump it out + BinaryInput in(source, G3D_LITTLE_ENDIAN); + BinaryOutput out(dest, G3D_LITTLE_ENDIAN); + out.writeBytes(in.getCArray(), in.size()); + out.commit(false); + #endif +} + +////////////////////////////////////////////////////////////////////////////// + +void parseFilename( + const std::string& filename, + std::string& root, + Array& path, + std::string& base, + std::string& ext) { + + std::string f = filename; + + root = ""; + path.clear(); + base = ""; + ext = ""; + + if (f == "") { + // Empty filename + return; + } + + // See if there is a root/drive spec. + if ((f.size() >= 2) && (f[1] == ':')) { + + if ((f.size() > 2) && isSlash(f[2])) { + + // e.g. c:\foo + root = f.substr(0, 3); + f = f.substr(3, f.size() - 3); + + } else { + + // e.g. c:foo + root = f.substr(2); + f = f.substr(2, f.size() - 2); + + } + + } else if ((f.size() >= 2) & isSlash(f[0]) && isSlash(f[1])) { + + // e.g. //foo + root = f.substr(0, 2); + f = f.substr(2, f.size() - 2); + + } else if (isSlash(f[0])) { + + root = f.substr(0, 1); + f = f.substr(1, f.size() - 1); + + } + + // Pull the extension off + { + // Find the period + size_t i = f.rfind('.'); + + if (i != std::string::npos) { + // Make sure it is after the last slash! + size_t j = iMax(f.rfind('/'), f.rfind('\\')); + if ((j == std::string::npos) || (i > j)) { + ext = f.substr(i + 1, f.size() - i - 1); + f = f.substr(0, i); + } + } + } + + // Pull the basename off + { + // Find the last slash + size_t i = iMax(f.rfind('/'), f.rfind('\\')); + + if (i == std::string::npos) { + + // There is no slash; the basename is the whole thing + base = f; + f = ""; + + } else if ((i != std::string::npos) && (i < f.size() - 1)) { + + base = f.substr(i + 1, f.size() - i - 1); + f = f.substr(0, i); + + } + } + + // Parse what remains into path. + size_t prev, cur = 0; + + while (cur < f.size()) { + prev = cur; + + // Allow either slash + size_t i = f.find('/', prev + 1); + size_t j = f.find('\\', prev + 1); + if (i == std::string::npos) { + i = f.size(); + } + + if (j == std::string::npos) { + j = f.size(); + } + + cur = iMin(i, j); + + if (cur == std::string::npos) { + cur = f.size(); + } + + path.append(f.substr(prev, cur - prev)); + ++cur; + } +} + + +/** + Helper for getFileList and getDirectoryList. + + @param wantFiles If false, returns the directories, otherwise + returns the files. + @param includePath If true, the names include paths + */ +static void getFileOrDirListNormal +(const std::string& filespec, + Array& files, + bool wantFiles, + bool includePath) { + + bool test = wantFiles ? true : false; + + std::string path = ""; + + // Find the place where the path ends and the file-spec begins + size_t i = filespec.rfind('/'); + size_t j = filespec.rfind('\\'); + + // Drive letters on Windows can separate a path + size_t k = filespec.rfind(':'); + + if (((j != std::string::npos) && (j > i)) || + (i == std::string::npos)) { + i = j; + } + + if (((k != std::string::npos) && (k > i)) || + (i == std::string::npos)) { + i = k; + } + + // If there is a path, pull it off + if (i != std::string::npos) { + path = filespec.substr(0, i + 1); + } + + std::string prefix = path; + + if (path.size() > 0) { + // Strip the trailing character + path = path.substr(0, path.size() - 1); + } + +# ifdef G3D_WIN32 + { + struct _finddata_t fileinfo; + + long handle = _findfirst(filespec.c_str(), &fileinfo); + int result = handle; + + while (result != -1) { + if ((((fileinfo.attrib & _A_SUBDIR) == 0) == test) && + strcmp(fileinfo.name, ".") && + strcmp(fileinfo.name, "..")) { + + if (includePath) { + files.append(prefix + fileinfo.name); + } else { + files.append(fileinfo.name); + } + } + + result = _findnext(handle, &fileinfo); + } + } +# else + { + if (path == "") { + // Empty paths don't work on Unix + path = "."; + } + + // Unix implementation + DIR* dir = opendir(path.c_str()); + + if (dir != NULL) { + struct dirent* entry = readdir(dir); + + while (entry != NULL) { + + // Exclude '.' and '..' + if ((strcmp(entry->d_name, ".") != 0) && + (strcmp(entry->d_name, "..") != 0)) { + + // Form a name with a path + std::string filename = prefix + entry->d_name; + // See if this is a file or a directory + struct _stat st; + bool exists = _stat(filename.c_str(), &st) != -1; + + if (exists && + + // Make sure it has the correct type + (((st.st_mode & S_IFDIR) == 0) == test) && + + // Make sure it matches the wildcard + (fnmatch(filespec.c_str(), + filename.c_str(), + FNM_PATHNAME) == 0)) { + + if (includePath) { + files.append(filename); + } else { + files.append(entry->d_name); + } + } + } + + entry = readdir(dir); + } + closedir(dir); + } + } +# endif +} + +#if _HAVE_ZIP +/** + @param path The zipfile name (no trailing slash) + @param prefix Directory inside the zipfile. No leading slash, must have trailing slash if non-empty. + @param file Name inside the zipfile that we are testing to see if it matches prefix + "*" + */ +static void _zip_addEntry(const std::string& path, + const std::string& prefix, + const std::string& file, + Set& files, + bool wantFiles, + bool includePath) { + + // Make certain we are within the desired parent folder (prefix) + if (beginsWith(file, prefix)) { + // validityTest was prefix/file + + // Extract everything to the right of the prefix + std::string s = file.substr(prefix.length()); + + if (s == "") { + // This was the name of the prefix + return; + } + + // See if there are any slashes + size_t slashPos = s.find('/'); + + bool add = false; + + if (slashPos == std::string::npos) { + // No slashes, so s must be a file + add = wantFiles; + } else if (! wantFiles) { + // Not all zipfiles list directories as explicit entries. + // Because of this, if we're looking for directories and see + // any path longer than prefix, we must add the subdirectory. + // The Set will fix duplicates for us. + s = s.substr(0, slashPos); + add = true; + } + + if (add) { + if (includePath) { + files.insert(path + "/" + prefix + s); + } else { + files.insert(s); + } + } + } +} +#endif + +static void getFileOrDirListZip(const std::string& path, + const std::string& prefix, + Array& files, + bool wantFiles, + bool includePath){ +#if _HAVE_ZIP + struct zip *z = zip_open( path.c_str(), ZIP_CHECKCONS, NULL ); + + Set fileSet; + + int count = zip_get_num_files( z ); + for( int i = 0; i < count; ++i ) { + struct zip_stat info; + zip_stat_init( &info ); // TODO: Docs unclear if zip_stat_init is required. + zip_stat_index( z, i, ZIP_FL_NOCASE, &info ); + _zip_addEntry(path, prefix, info.name, fileSet, wantFiles, includePath); + } + + zip_close( z ); + + fileSet.getMembers(files); +#endif +} + + +static void determineFileOrDirList( + const std::string& filespec, + Array& files, + bool wantFiles, + bool includePath) { + + // if it is a .zip, prefix will specify the folder within + // whose contents we want to see + std::string prefix = ""; + std::string path = filenamePath(filespec); + + if ((path.size() > 0) && isSlash(path[path.size() - 1])) { + // Strip the trailing slash + path = path.substr(0, path.length() -1); + } + + if ((path == "") || fileExists(path, false)) { + if ((path != "") && isZipfile(path)) { + // .zip should only work if * is specified as the Base + Ext + // Here, we have been asked for the root's contents + debugAssertM(filenameBaseExt(filespec) == "*", "Can only call getFiles/getDirs on zipfiles using '*' wildcard"); + getFileOrDirListZip(path, prefix, files, wantFiles, includePath); + } else { + // It is a normal directory + getFileOrDirListNormal(filespec, files, wantFiles, includePath); + } + } else if (zipfileExists(filenamePath(filespec), path, prefix)) { + // .zip should only work if * is specified as the Base + Ext + // Here, we have been asked for the contents of a folder within the .zip + debugAssertM(filenameBaseExt(filespec) == "*", "Can only call getFiles/getDirs on zipfiles using '*' wildcard"); + getFileOrDirListZip(path, prefix, files, wantFiles, includePath); + } +} + + +void getFiles(const std::string& filespec, + Array& files, + bool includePath) { + + determineFileOrDirList(filespec, files, true, includePath); +} + + +void getDirs( + const std::string& filespec, + Array& files, + bool includePath) { + + determineFileOrDirList(filespec, files, false, includePath); +} + + +std::string filenameBaseExt(const std::string& filename) { + int i = filename.rfind("/"); + int j = filename.rfind("\\"); + + if ((j > i) && (j >= 0)) { + i = j; + } + +# ifdef G3D_WIN32 + j = filename.rfind(":"); + if ((i == -1) && (j >= 0)) { + i = j; + } +# endif + + if (i == -1) { + return filename; + } else { + return filename.substr(i + 1, filename.length() - i); + } +} + + +std::string filenameBase(const std::string& s) { + std::string drive; + std::string base; + std::string ext; + Array path; + + parseFilename(s, drive, path, base, ext); + return base; +} + + +std::string filenameExt(const std::string& filename) { + int i = filename.rfind("."); + if (i >= 0) { + return filename.substr(i + 1, filename.length() - i); + } else { + return ""; + } +} + + +std::string filenamePath(const std::string& filename) { + int i = filename.rfind("/"); + int j = filename.rfind("\\"); + + if ((j > i) && (j >= 0)) { + i = j; + } + +# ifdef G3D_WIN32 + j = filename.rfind(":"); + if ((i == -1) && (j >= 0)) { + i = j; + } +# endif + + if (i == -1) { + return ""; + } else { + return filename.substr(0, i+1); + } +} + + +bool isZipfile(const std::string& filename) { + + FILE* f = fopen(filename.c_str(), "r"); + if (f == NULL) { + return false; + } + uint8 header[4]; + fread(header, 4, 1, f); + + const uint8 zipHeader[4] = {0x50, 0x4b, 0x03, 0x04}; + for (int i = 0; i < 4; ++i) { + if (header[i] != zipHeader[i]) { + fclose(f); + return false; + } + } + + fclose(f); + return true; +} + + +bool isDirectory(const std::string& filename) { + struct _stat st; + bool exists = _stat(filename.c_str(), &st) != -1; + return exists && ((st.st_mode & S_IFDIR) != 0); +} + + +bool filenameContainsWildcards(const std::string& filename) { + return (filename.find('*') != std::string::npos) || (filename.find('?') != std::string::npos); +} + + +bool fileIsNewer(const std::string& src, const std::string& dst) { + struct _stat sts; + bool sexists = _stat(src.c_str(), &sts) != -1; + + struct _stat dts; + bool dexists = _stat(dst.c_str(), &dts) != -1; + + return sexists && ((! dexists) || (sts.st_mtime > dts.st_mtime)); +} + + +Array filesUsed() { + Array f; + _internal::currentFilesUsed.getMembers(f); + return f; +} + +} + +#ifndef G3D_WIN32 + #undef _stat +#endif diff --git a/externals/g3dlite/format.cpp b/externals/g3dlite/format.cpp new file mode 100644 index 0000000..d9d1b51 --- /dev/null +++ b/externals/g3dlite/format.cpp @@ -0,0 +1,164 @@ +/** + @file format.cpp + + @author Morgan McGuire, graphics3d.com + + @created 2000-09-09 + @edited 2006-08-14 +*/ + +#include "G3D/format.h" +#include "G3D/platform.h" +#include "G3D/System.h" + +#ifdef _MSC_VER + // disable: "C++ exception handler used" +# pragma warning (push) +# pragma warning (disable : 4530) +#endif // _MSC_VER + +// If your platform does not have vsnprintf, you can find a +// implementation at http://www.ijs.si/software/snprintf/ + +namespace G3D { + +std::string __cdecl format(const char* fmt,...) { + va_list argList; + va_start(argList,fmt); + std::string result = vformat(fmt, argList); + va_end(argList); + + return result; +} + +#if defined(_MSC_VER) && (_MSC_VER >= 1300) +// Both MSVC seems to use the non-standard vsnprintf +// so we are using vscprintf to determine buffer size, however +// only MSVC7 and up headers include vscprintf for some reason. +std::string vformat(const char *fmt, va_list argPtr) { + // We draw the line at a 1MB string. + const int maxSize = 1000000; + + // If the string is less than 161 characters, + // allocate it on the stack because this saves + // the malloc/free time. + const int bufSize = 161; + char stackBuffer[bufSize]; + + // MSVC does not support va_copy + int actualSize = _vscprintf(fmt, argPtr) + 1; + + if (actualSize > bufSize) { + + // Now use the heap. + char* heapBuffer = NULL; + + if (actualSize < maxSize) { + + heapBuffer = (char*)System::malloc(maxSize + 1); + _vsnprintf(heapBuffer, maxSize, fmt, argPtr); + heapBuffer[maxSize] = '\0'; + } else { + heapBuffer = (char*)System::malloc(actualSize); + vsprintf(heapBuffer, fmt, argPtr); + } + + std::string formattedString(heapBuffer); + System::free(heapBuffer); + return formattedString; + } else { + + vsprintf(stackBuffer, fmt, argPtr); + return std::string(stackBuffer); + } +} + +#elif defined(_MSC_VER) && (_MSC_VER < 1300) + +std::string vformat(const char *fmt, va_list argPtr) { + // We draw the line at a 1MB string. + const int maxSize = 1000000; + + // If the string is less than 161 characters, + // allocate it on the stack because this saves + // the malloc/free time. + const int bufSize = 161; + char stackBuffer[bufSize]; + + // MSVC6 doesn't support va_copy, however it also seems to compile + // correctly if we just pass our argument list along. Note that + // this whole code block is only compiled if we're on MSVC6 anyway + int actualWritten = _vsnprintf(stackBuffer, bufSize, fmt, argPtr); + + // Not a big enough buffer, bufSize characters written + if (actualWritten == -1) { + + int heapSize = 512; + double powSize = 1.0; + char* heapBuffer = (char*)System::malloc(heapSize); + + while ((_vsnprintf(heapBuffer, heapSize, fmt, argPtr) == -1) && + (heapSize < maxSize)) { + + heapSize = iCeil(heapSize * ::pow((double)2.0, powSize++)); + heapBuffer = (char*)System::realloc(heapBuffer, heapSize); + } + + heapBuffer[heapSize-1] = '\0'; + + std::string heapString(heapBuffer); + System::free(heapBuffer); + + return heapString; + } else { + + return std::string(stackBuffer); + } +} + +#else + +// glibc 2.1 has been updated to the C99 standard +std::string vformat(const char* fmt, va_list argPtr) { + // If the string is less than 161 characters, + // allocate it on the stack because this saves + // the malloc/free time. The number 161 is chosen + // to support two lines of text on an 80 character + // console (plus the null terminator). + const int bufSize = 161; + char stackBuffer[bufSize]; + + va_list argPtrCopy; + va_copy(argPtrCopy, argPtr); + int numChars = vsnprintf(stackBuffer, bufSize, fmt, argPtrCopy); + va_end(argPtrCopy); + + if (numChars >= bufSize) { + // We didn't allocate a big enough string. + char* heapBuffer = (char*)System::malloc((numChars + 1) * sizeof(char)); + + debugAssert(heapBuffer); + int numChars2 = vsnprintf(heapBuffer, numChars + 1, fmt, argPtr); + debugAssert(numChars2 == numChars); + (void)numChars2; + + std::string result(heapBuffer); + + System::free(heapBuffer); + + return result; + + } else { + + return std::string(stackBuffer); + + } +} + +#endif + +} // namespace + +#ifdef _MSC_VER +# pragma warning (pop) +#endif diff --git a/externals/g3dlite/g3dfnmatch.cpp b/externals/g3dlite/g3dfnmatch.cpp new file mode 100644 index 0000000..39ef7b3 --- /dev/null +++ b/externals/g3dlite/g3dfnmatch.cpp @@ -0,0 +1,204 @@ +/*- +* Copyright (c) 1992, 1993 +*The Regents of the University of California. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. 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. +* 3. All advertising materials mentioning features or use of this software +* must display the following acknowledgement: +*This product includes software developed by the University of +*California, Berkeley and its contributors. +* 4. Neither the name of the University 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 OR 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. +* +*@(#)fnmatch.h8.1 (Berkeley) 6/2/93 +* +* From FreeBSD fnmatch.h 1.7 +* $Id: g3dfnmatch.cpp,v 1.2 2010/02/06 10:03:24 corey_taylor Exp $ +*/ +#include "G3D/g3dfnmatch.h" + +#ifdef G3D_WIN32 + +#include +#include +#include + +namespace G3D { + +#define EOS '\0' + +static const char *rangematch(const char *, char, int); + +int g3dfnmatch(const char *pattern, const char *string, int flags) +{ + const char *stringstart; + char c, test; + + for (stringstart = string;;) + switch (c = *pattern++) { + case EOS: + if ((flags & FNM_LEADING_DIR) && *string == '/') + return (0); + return (*string == EOS ? 0 : FNM_NOMATCH); + case '?': + if (*string == EOS) + return (FNM_NOMATCH); + if (*string == '/' && (flags & FNM_PATHNAME)) + return (FNM_NOMATCH); + if (*string == '.' && (flags & FNM_PERIOD) && + (string == stringstart || + ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) + return (FNM_NOMATCH); + ++string; + break; + case '*': + c = *pattern; + /* Collapse multiple stars. */ + while (c == '*') + c = *++pattern; + + if (*string == '.' && (flags & FNM_PERIOD) && + (string == stringstart || + ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) + return (FNM_NOMATCH); + + /* Optimize for pattern with * at end or before /. */ + if (c == EOS) + if (flags & FNM_PATHNAME) + return ((flags & FNM_LEADING_DIR) || + strchr(string, '/') == NULL ? + 0 : FNM_NOMATCH); + else + return (0); + else if (c == '/' && flags & FNM_PATHNAME) { + if ((string = strchr(string, '/')) == NULL) + return (FNM_NOMATCH); + break; + } + + /* General case, use recursion. */ + while ((test = *string) != EOS) { + if (!rangematch(pattern, *string, flags & ~FNM_PERIOD)) + return (0); + if (test == '/' && flags & FNM_PATHNAME) + break; + ++string; + } + return (FNM_NOMATCH); + case '[': + if (*string == EOS) + return (FNM_NOMATCH); + if (*string == '/' && flags & FNM_PATHNAME) + return (FNM_NOMATCH); + if ((pattern = + rangematch(pattern, *string, flags)) == NULL) + return (FNM_NOMATCH); + ++string; + break; + case '\\': + if (!(flags & FNM_NOESCAPE)) { + if ((c = *pattern++) == EOS) { + c = '\\'; + --pattern; + } + } + /* FALLTHROUGH */ + default: + if (c == *string) + ; + else if ((flags & FNM_CASEFOLD) && + (tolower((unsigned char)c) == + tolower((unsigned char)*string))) + ; + else if ((flags & FNM_PREFIX_DIRS) && *string == EOS && + ((c == '/' && string != stringstart) || + (string == stringstart+1 && *stringstart == '/'))) + return (0); + else + return (FNM_NOMATCH); + string++; + break; + } + /* NOTREACHED */ +} + +static const char * +rangematch(const char *pattern, char test, int flags) +{ + int negate, ok; + char c, c2; + + /* + * A bracket expression starting with an unquoted circumflex + * character produces unspecified results (IEEE 1003.2-1992, + * 3.13.2). This implementation treats it like '!', for + * consistency with the regular expression syntax. + * J.T. Conklin (conklin@ngai.kaleida.com) + */ + if ( (negate = (*pattern == '!' || *pattern == '^')) ) + ++pattern; + + if (flags & FNM_CASEFOLD) + test = tolower((unsigned char)test); + + for (ok = 0; (c = *pattern++) != ']';) { + if (c == '\\' && !(flags & FNM_NOESCAPE)) + c = *pattern++; + if (c == EOS) + return (NULL); + + if (flags & FNM_CASEFOLD) + c = tolower((unsigned char)c); + + if (*pattern == '-' + && (c2 = *(pattern+1)) != EOS && c2 != ']') { + pattern += 2; + if (c2 == '\\' && !(flags & FNM_NOESCAPE)) + c2 = *pattern++; + if (c2 == EOS) + return (NULL); + + if (flags & FNM_CASEFOLD) + c2 = tolower((unsigned char)c2); + + if ((unsigned char)c <= (unsigned char)test && + (unsigned char)test <= (unsigned char)c2) + ok = 1; + } else if (c == test) + ok = 1; + } + return (ok == negate ? NULL : pattern); +} + +} + +#else + +namespace G3D { +int g3dfnmatch(const char * a, const char *b, int c) { + return fnmatch(a, b, c); +} +} + +#endif + diff --git a/externals/g3dlite/g3dmath.cpp b/externals/g3dlite/g3dmath.cpp new file mode 100644 index 0000000..ad85e9e --- /dev/null +++ b/externals/g3dlite/g3dmath.cpp @@ -0,0 +1,108 @@ +/** + @file g3dmath.cpp + + @author Morgan McGuire, graphics3d.com + + @created 2001-06-02 + @edited 2004-02-24 + */ + +#include "G3D/g3dmath.h" +#include +#include + +namespace G3D { + +float gaussRandom(float mean, float stdev) { + + // Using Box-Mueller method from http://www.taygeta.com/random/gaussian.html + // Modified to specify standard deviation and mean of distribution + float w, x1, x2; + + // Loop until w is less than 1 so that log(w) is negative + do { + x1 = uniformRandom(-1.0, 1.0); + x2 = uniformRandom(-1.0, 1.0); + + w = float(square(x1) + square(x2)); + } while (w > 1.0f); + + // Transform to gassian distribution + // Multiply by sigma (stdev ^ 2) and add mean. + return x2 * (float)square(stdev) * sqrtf((-2.0f * logf(w) ) / w) + mean; +} + +/** + This value should not be tested against directly, instead + G3D::isNan() and G3D::isFinite() will return reliable results. */ +double inf() { + return std::numeric_limits::infinity(); +} + +bool isNaN(float x) { + static const float n = nan(); + return memcmp(&x, &n, sizeof(float)) == 0; +} + +bool isNaN(double x) { + static const double n = nan(); + return memcmp(&x, &n, sizeof(double)) == 0; +} + + +/** + This value should not be tested against directly, instead + G3D::isNan() and G3D::isFinite() will return reliable results. */ +float finf() { + return std::numeric_limits::infinity(); +} + +/** This value should not be tested against directly, instead + G3D::isNan() and G3D::isFinite() will return reliable results. */ +double nan() { + // double is a standard type and should have quiet NaN + return std::numeric_limits::quiet_NaN(); +} + +float fnan() { + // double is a standard type and should have quiet NaN + return std::numeric_limits::quiet_NaN(); +} + + +int highestBit(uint32 x) { + // Binary search. + int base = 0; + + if (x & 0xffff0000) { + base = 16; + x >>= 16; + } + if (x & 0x0000ff00) { + base += 8; + x >>= 8; + } + if (x & 0x000000f0) { + base += 4; + x >>= 4; + } + + static const int lut[] = {-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3}; + return base + lut[x]; +} + + +int iRandom(int low, int high) { + int r = iFloor(low + (high - low + 1) * (double)rand() / RAND_MAX); + + // There is a *very small* chance of generating + // a number larger than high. + if (r > high) { + return high; + } else { + return r; + } +} + + +} diff --git a/externals/g3dlite/prompt.cpp b/externals/g3dlite/prompt.cpp new file mode 100644 index 0000000..6a28e64 --- /dev/null +++ b/externals/g3dlite/prompt.cpp @@ -0,0 +1,729 @@ +/** + @file prompt.cpp + + @author Morgan McGuire, http://graphics.cs.williams.edu + @cite Windows dialog interface by Max McGuire, mmcguire@ironlore.com + @cite Font setting code by Kurt Miller, kurt@flipcode.com + + @created 2000-08-26 + @edited 2005-01-14 + */ + +#include "G3D/prompt.h" +#include "G3D/platform.h" + +#include + +#ifdef G3D_WIN32 +# include +# include +#else +# define _getch getchar +#endif + +#ifdef G3D_OSX + +/*#ifdef __LP64__ +# undef __LP64__ +#endif +*/ + +# include + +/* +#ifdef G3D_64BIT +# define __LP64__ +#endif +*/ + +#endif + +namespace G3D { + +#ifdef G3D_WIN32 + +namespace _internal { +/** + Generic Win32 dialog facility. + @author Max McGuire + */ +class DialogTemplate { +public: + + DialogTemplate(LPCSTR caption, DWORD style, + int x, int y, int w, int h, + LPCSTR font = NULL, WORD fontSize = 8) { + + usedBufferLength = sizeof(DLGTEMPLATE); + totalBufferLength = usedBufferLength; + + dialogTemplate = (DLGTEMPLATE*)malloc(totalBufferLength); + + dialogTemplate->style = style; + + if (font != NULL) { + dialogTemplate->style |= DS_SETFONT; + } + + dialogTemplate->x = (short)x; + dialogTemplate->y = (short)y; + dialogTemplate->cx = (short)w; + dialogTemplate->cy = (short)h; + dialogTemplate->cdit = 0; + + dialogTemplate->dwExtendedStyle = 0; + + // The dialog box doesn't have a menu or a special class + AppendData("\0", 2); + AppendData("\0", 2); + + // Add the dialog's caption to the template + + AppendString(caption); + + if (font != NULL) { + AppendData(&fontSize, sizeof(WORD)); + AppendString(font); + } + } + + void AddComponent(LPCSTR type, LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) { + + DLGITEMTEMPLATE item; + + item.style = style; + item.x = (short)x; + item.y = (short)y; + item.cx = (short)w; + item.cy = (short)h; + item.id = id; + + item.dwExtendedStyle = exStyle; + + AppendData(&item, sizeof(DLGITEMTEMPLATE)); + + AppendString(type); + AppendString(caption); + + WORD creationDataLength = 0; + AppendData(&creationDataLength, sizeof(WORD)); + + // Increment the component count + dialogTemplate->cdit++; + + } + + + void AddButton(LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) { + + AddStandardComponent(0x0080, caption, style, exStyle, x, y, w, h, id); + + WORD creationDataLength = 0; + AppendData(&creationDataLength, sizeof(WORD)); + + } + + + void AddEditBox(LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) { + + AddStandardComponent(0x0081, caption, style, exStyle, x, y, w, h, id); + + WORD creationDataLength = 0; + AppendData(&creationDataLength, sizeof(WORD)); + + } + + + void AddStatic(LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) { + + AddStandardComponent(0x0082, caption, style, exStyle, x, y, w, h, id); + + WORD creationDataLength = 0; + AppendData(&creationDataLength, sizeof(WORD)); + + } + + + void AddListBox(LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) { + + AddStandardComponent(0x0083, caption, style, exStyle, x, y, w, h, id); + + WORD creationDataLength = sizeof(WORD) + 5 * sizeof(WCHAR); + AppendData(&creationDataLength, sizeof(WORD)); + + AppendString("TEST"); + + } + + + void AddScrollBar(LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) { + + AddStandardComponent(0x0084, caption, style, exStyle, x, y, w, h, id); + + WORD creationDataLength = 0; + AppendData(&creationDataLength, sizeof(WORD)); + + } + + + void AddComboBox(LPCSTR caption, DWORD style, DWORD exStyle, int x, int y, int w, int h, WORD id) { + + AddStandardComponent(0x0085, caption, style, exStyle, x, y, w, h, id); + + WORD creationDataLength = 0; + AppendData(&creationDataLength, sizeof(WORD)); + + } + + + /** + * + * Returns a pointer to the Win32 dialog template which the object + * represents. This pointer may become invalid if additional components + * are added to the template. + * + */ + operator const DLGTEMPLATE*() const { + return dialogTemplate; + } + + virtual ~DialogTemplate() { + free(dialogTemplate); + } + +protected: + + void AddStandardComponent(WORD type, LPCSTR caption, DWORD style, DWORD exStyle, + int x, int y, int w, int h, WORD id, LPSTR font = NULL, WORD fontSize = 8) { + + DLGITEMTEMPLATE item; + + // DWORD align the beginning of the component data + + AlignData(sizeof(DWORD)); + + item.style = style; + if (font != NULL) { + item.style |= DS_SETFONT; + } + item.x = (short)x; + item.y = (short)y; + item.cx = (short)w; + item.cy = (short)h; + item.id = id; + + item.dwExtendedStyle = exStyle; + + AppendData(&item, sizeof(DLGITEMTEMPLATE)); + + WORD preType = 0xFFFF; + + AppendData(&preType, sizeof(WORD)); + AppendData(&type, sizeof(WORD)); + + AppendString(caption); + + if (font != NULL) { + AppendData(&fontSize, sizeof(WORD)); + AppendString(font); + } + + // Increment the component count + dialogTemplate->cdit++; + } + + + void AlignData(int size) { + + int paddingSize = usedBufferLength % size; + + if (paddingSize != 0) { + EnsureSpace(paddingSize); + usedBufferLength += paddingSize; + } + + } + + void AppendString(LPCSTR string) { + + int length = MultiByteToWideChar(CP_ACP, 0, string, -1, NULL, 0); + + WCHAR* wideString = (WCHAR*)malloc(sizeof(WCHAR) * length); + MultiByteToWideChar(CP_ACP, 0, string, -1, wideString, length); + + AppendData(wideString, length * sizeof(WCHAR)); + free(wideString); + + } + + void AppendData(const void* data, int dataLength) { + + EnsureSpace(dataLength); + + memcpy((char*)dialogTemplate + usedBufferLength, data, dataLength); + usedBufferLength += dataLength; + + } + + void EnsureSpace(int length) { + if (length + usedBufferLength > totalBufferLength) { + totalBufferLength += length * 2; + + void* newBuffer = malloc(totalBufferLength); + memcpy(newBuffer, dialogTemplate, usedBufferLength); + + free(dialogTemplate); + dialogTemplate = (DLGTEMPLATE*)newBuffer; + } + } + +private: + + DLGTEMPLATE* dialogTemplate; + + int totalBufferLength; + int usedBufferLength; + +}; + + +struct PromptParams { + const char* message; + const char* title; +}; + +/** + * Constants for controls. + */ +#define IDC_MESSAGE 1000 +#define IDC_BUTTON0 2000 + +INT_PTR CALLBACK PromptDlgProc(HWND hDlg, UINT msg, + WPARAM wParam, LPARAM lParam) { + switch(msg) { + case WM_INITDIALOG: + { + PromptParams *params = (PromptParams*)lParam; + ::SetWindowTextA(::GetDlgItem(hDlg, IDC_MESSAGE), params->message); + + ::SetFocus(::GetDlgItem(hDlg, IDC_BUTTON0)); + + SetWindowTextA(hDlg, params->title); + + HFONT hfont = + CreateFontA(16, 0, 0, 0, FW_NORMAL, + FALSE, FALSE, FALSE, + ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, + PROOF_QUALITY, FIXED_PITCH | FF_MODERN, "Courier New"); + + SendDlgItemMessage(hDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)hfont, MAKELPARAM(TRUE,0)); + + + break; + } + case WM_COMMAND: + { + int choiceNumber = LOWORD(wParam) - IDC_BUTTON0; + if ((choiceNumber >= 0) && (choiceNumber < 10)) { + EndDialog(hDlg, choiceNumber); + return TRUE; + } + } + + break; + + case WM_NCDESTROY: + // Under SDL 1.2.6 we get a NCDESTROY message for no reason and the + // window is immediately closed. This is here to debug the problem. + (void)0; + break; + + } + + return FALSE; +} + +}; // namespace _internal + + +using namespace _internal; + +/** + * Show a dialog prompt. + */ +static int guiPrompt( + const char* windowTitle, + const char* prompt, + const char** choice, + int numChoices) { + + int width = 280; + int height = 128; + + const int buttonSpacing = 2; + const int buttonWidth = + (width - buttonSpacing * 2 - + buttonSpacing * (numChoices - 1)) / numChoices; + const int buttonHeight = 13; + + + DialogTemplate dialogTemplate( + windowTitle, + WS_CAPTION | DS_CENTER | WS_SYSMENU, + 10, 10, width, height, + "Tahoma"); + + dialogTemplate.AddEditBox( + "Edit", WS_VISIBLE | ES_READONLY | ES_OEMCONVERT | ES_MULTILINE | WS_TABSTOP, WS_EX_STATICEDGE, + 2, 2, width - 4, height - buttonHeight - 7, IDC_MESSAGE); + + int i; + for (i = 0; i < numChoices; i++) { + + int x = buttonSpacing + i * (buttonWidth + buttonSpacing); + int y = height - buttonHeight - buttonSpacing; + + dialogTemplate.AddButton(choice[i], WS_VISIBLE | WS_TABSTOP, 0, + x, y, buttonWidth, buttonHeight, IDC_BUTTON0 + (WORD)i); + + } + + // Convert all single \n characters to \r\n for proper printing + int strLen = 0; + const char* pStr = prompt; + + while (*pStr != '\0') { + if ((*pStr == '\n') && (pStr != prompt)) { + if (*(pStr - 1) != '\r') { + ++strLen; + } + } + ++strLen; + ++pStr; + } + + char* newStr = (char*)malloc(strLen + 1); + + const char* pStr2 = prompt; + char* pNew = newStr; + + while (*pStr2 != '\0') { + if ((*pStr2 == '\n') && (pStr2 != prompt)) { + if (*(pStr2 - 1) != '\r') { + *pNew = '\r'; + ++pNew; + } + } + *pNew = *pStr2; + ++pNew; + ++pStr2; + } + + *pNew = '\0'; + + PromptParams params; + params.message = newStr;; + params.title = windowTitle; + + HMODULE module = GetModuleHandle(0); + int ret = DialogBoxIndirectParam(module, dialogTemplate, NULL, (DLGPROC) PromptDlgProc, (DWORD)¶ms); + + free(newStr); + + /* + For debugging when DialogBoxIndirectParam fails: + + // The last error value. (Which is preserved across the call). + DWORD lastErr = GetLastError(); + + // The decoded message from FormatMessage + LPTSTR formatMsg = NULL; + + if (NULL == formatMsg) { + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + lastErr, + 0, + (LPTSTR)&formatMsg, + 0, + NULL); + } + + // Make sure the message got translated into something. + LPTSTR realLastErr; + if (NULL != formatMsg) { + realLastErr = formatMsg; + } else { + realLastErr = "Last error code does not exist."; + } + + // Get rid of the allocated memory from FormatMessage. + if (NULL != formatMsg) { + LocalFree((LPVOID)formatMsg); + } + */ + + return ret; +} + +#endif + + +/** + * Show a prompt on stdout + */ +static int textPrompt( + const char* windowTitle, + const char* prompt, + const char** choice, + int numChoices) { + + printf("\n___________________________________________________\n"); + printf("%s\n", windowTitle); + printf("%s", prompt); + + if (numChoices > 10) { + numChoices = 10; + } + + int c = -1; + if (numChoices > 1) { + printf("\n"); + printf("Choose an option by number:"); + + while ((c < 0) || (c >= numChoices)) { + printf("\n"); + + for (int i = 0; i < numChoices; i++) { + if (numChoices <= 3) { + printf(" (%d) %s ", i, choice[i]); + } else { + printf(" (%d) %s\n", i, choice[i]); + } + } + + printf("\n> "); + c = _getch() - '0'; + + if ((c < 0) || (c >= numChoices)) { + printf("'%d' is not a valid choice.", c); + } else { + printf("%d", c); + } + } + + } else if (numChoices == 1) { + + printf("\nPress any key for '%s'...", choice[0]); + _getch(); + c = 0; + + } else { + + printf("\nPress any key..."); + _getch(); + c = 0; + } + + printf("\n___________________________________________________\n"); + return c; +} + +#ifdef G3D_OSX + +// See http://developer.apple.com/documentation/Carbon/Reference/Carbon_Event_Manager_Ref/index.html + +#define CARBON_COMMANDID_START 128 +#define CARBON_BUTTON_SPACING 12 +#define CARBON_BUTTON_HEIGHT 20 +#define CARBON_BUTTON_MINWIDTH 69 +#define CARBON_WINDOW_PADDING 20 + +struct CallbackData { + WindowRef refWindow; + + /** Index of this particular button */ + int myIndex; + + /** Buttons store their index into here when pressed. */ + int* whichButton; +}; + +/** + Assumes that userData is a pointer to a carbon_evt_data_t. + + */ +static pascal OSStatus DoCommandEvent(EventHandlerCallRef handlerRef, EventRef event, void* userData) { + // See http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/index.html + + CallbackData& callbackData = *(CallbackData*)userData; + +# pragma unused(handlerRef) + + callbackData.whichButton[0] = callbackData.myIndex; + + // If we get here we can close the window + ::QuitAppModalLoopForWindow(callbackData.refWindow); + + // Return noErr to indicate that we handled the event + return noErr; +} + +static int guiPrompt +(const char* windowTitle, + const char* prompt, + const char** choice, + int numChoices) { + + WindowRef window; + + int iNumButtonRows = 0; + int iButtonWidth = -1; + OSStatus err = noErr; + + // Determine number of rows of buttons + while (iButtonWidth < CARBON_BUTTON_MINWIDTH) { + ++iNumButtonRows; + iButtonWidth = + (550 - (CARBON_WINDOW_PADDING*2 + + (CARBON_BUTTON_SPACING*numChoices))) / + (numChoices/iNumButtonRows); + } + + // Window Variables + Rect rectWin = {0, 0, 200 + ((iNumButtonRows-1) * (CARBON_BUTTON_HEIGHT+CARBON_BUTTON_SPACING)), 550}; // top, left, bottom, right + CFStringRef szWindowTitle = CFStringCreateWithCString(kCFAllocatorDefault, windowTitle, kCFStringEncodingUTF8); + + window = NULL; + + err = CreateNewWindow(kMovableAlertWindowClass, kWindowStandardHandlerAttribute|kWindowCompositingAttribute, &rectWin, &window); + err = SetWindowTitleWithCFString(window, szWindowTitle); + err = SetThemeWindowBackground(window, kThemeBrushAlertBackgroundActive, false); + assert(err == noErr); + + // Event Handler Variables + EventTypeSpec buttonSpec[] = {{ kEventClassControl, kEventControlHit }, { kEventClassCommand, kEventCommandProcess }}; + EventHandlerUPP buttonHandler = NewEventHandlerUPP(DoCommandEvent); + + // Static Text Variables + Rect rectStatic = {20, 20, 152, 530}; + CFStringRef szStaticText = CFStringCreateWithCString(kCFAllocatorDefault, prompt, kCFStringEncodingUTF8); + ControlRef refStaticText = NULL; + err = CreateStaticTextControl(window, &rectStatic, szStaticText, NULL, &refStaticText); + + // Button Variables + Rect bounds[numChoices]; + CFStringRef caption[numChoices]; + ControlRef button[numChoices]; + + int whichButton=-1; + CallbackData callbackData[numChoices]; + + // Create the Buttons and assign event handlers + for (int i = 0; i < numChoices; ++i) { + bounds[i].top = 160 + ((CARBON_BUTTON_HEIGHT+CARBON_BUTTON_SPACING)*(i%iNumButtonRows)); + bounds[i].right = 530 - ((iButtonWidth+CARBON_BUTTON_SPACING)*(i/iNumButtonRows)); + bounds[i].left = bounds[i].right - iButtonWidth; + bounds[i].bottom = bounds[i].top + CARBON_BUTTON_HEIGHT; + + // Convert the button captions to Apple strings + caption[i] = CFStringCreateWithCString(kCFAllocatorDefault, choice[i], kCFStringEncodingUTF8); + + err = CreatePushButtonControl(window, &bounds[i], caption[i], &button[i]); + assert(err == noErr); + + err = SetControlCommandID(button[i], CARBON_COMMANDID_START + i); + assert(err == noErr); + + callbackData[i].refWindow = window; + callbackData[i].myIndex = i; + callbackData[i].whichButton = &whichButton; + + err = InstallControlEventHandler(button[i], buttonHandler, + GetEventTypeCount(buttonSpec), buttonSpec, + &callbackData[i], NULL); + assert(err == noErr); + } + + // Show Dialog + err = RepositionWindow(window, NULL, kWindowCenterOnMainScreen); + ShowWindow(window); + BringToFront(window); + err = ActivateWindow(window, true); + + // Hack to get our window/process to the front... + ProcessSerialNumber psn = { 0, kCurrentProcess}; + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + SetFrontProcess (&psn); + + // Run in Modal State + err = RunAppModalLoopForWindow(window); + + // Dispose of Button Related Data + for (int i = 0; i < numChoices; ++i) { + // Dispose of controls + DisposeControl(button[i]); + + // Release CFStrings + CFRelease(caption[i]); + } + + // Dispose of Other Controls + DisposeControl(refStaticText); + + // Dispose of Event Handlers + DisposeEventHandlerUPP(buttonHandler); + + // Dispose of Window + DisposeWindow(window); + + // Release CFStrings + CFRelease(szWindowTitle); + CFRelease(szStaticText); + + // Return Selection + return whichButton; +} + +#endif + +int prompt( + const char* windowTitle, + const char* prompt, + const char** choice, + int numChoices, + bool useGui) { + + #ifdef G3D_WIN32 + if (useGui) { + // Build the message box + return guiPrompt(windowTitle, prompt, choice, numChoices); + } + #endif + + #ifdef G3D_OSX + if (useGui){ + //Will default to text prompt if numChoices > 4 + return guiPrompt(windowTitle, prompt, choice, numChoices); + } + #endif + return textPrompt(windowTitle, prompt, choice, numChoices); +} + + +void msgBox( + const std::string& message, + const std::string& title) { + + const char *choice[] = {"Ok"}; + prompt(title.c_str(), message.c_str(), choice, 1, true); +} + +#ifndef G3D_WIN32 + #undef _getch +#endif + +};// namespace + diff --git a/externals/g3dlite/stringutils.cpp b/externals/g3dlite/stringutils.cpp new file mode 100644 index 0000000..c3876eb --- /dev/null +++ b/externals/g3dlite/stringutils.cpp @@ -0,0 +1,275 @@ +/** + @file stringutils.cpp + + @maintainer Morgan McGuire, http://graphics.cs.williams.edu + + @created 2000-09-09 + @edited 2008-01-10 +*/ + +#include "G3D/platform.h" +#include "G3D/stringutils.h" +#include "G3D/BinaryInput.h" +#include + +namespace G3D { + +#ifdef _MSC_VER + // disable: "C++ exception handler used" +# pragma warning (push) +# pragma warning (disable : 4530) +#endif +#ifdef G3D_WIN32 + const char* NEWLINE = "\r\n"; +#else + const char* NEWLINE = "\n"; + static bool iswspace(int ch) { return (ch==' ' || ch=='\t' || ch=='\n' || ch=='\r'); } +#endif + +void parseCommaSeparated(const std::string s, Array& array, bool stripQuotes) { + array.fastClear(); + if (s == "") { + return; + } + + size_t begin = 0; + const char delimiter = ','; + const char quote = '\"'; + do { + size_t end = begin; + // Find the next comma, or the end of the string + bool inQuotes = false; + while ((end < s.length()) && (inQuotes || (s[end] != delimiter))) { + if (s[end] == quote) { + if ((end < s.length() - 2) && (s[end + 1] == quote) && (s[end + 2]) == quote) { + // Skip over the superquote + end += 2; + } + inQuotes = ! inQuotes; + } + ++end; + } + array.append(s.substr(begin, end - begin)); + begin = end + 1; + } while (begin < s.length()); + + if (stripQuotes) { + for (int i = 0; i < array.length(); ++i) { + std::string& t = array[i]; + int L = t.length(); + if ((L > 1) && (t[0] == quote) && (t[L - 1] == quote)) { + if ((L > 6) && (t[1] == quote) && (t[2] == quote) && (t[L - 3] == quote) && (t[L - 2] == quote)) { + // Triple-quote + t = t.substr(3, L - 6); + } else { + // Double-quote + t = t.substr(1, L - 2); + } + } + } + } +} + +bool beginsWith( + const std::string& test, + const std::string& pattern) { + + if (test.size() >= pattern.size()) { + for (int i = 0; i < (int)pattern.size(); ++i) { + if (pattern[i] != test[i]) { + return false; + } + } + return true; + } else { + return false; + } +} + + +bool endsWith( + const std::string& test, + const std::string& pattern) { + + if (test.size() >= pattern.size()) { + int te = test.size() - 1; + int pe = pattern.size() - 1; + for (int i = pattern.size() - 1; i >= 0; --i) { + if (pattern[pe - i] != test[te - i]) { + return false; + } + } + return true; + } else { + return false; + } +} + + +std::string wordWrap( + const std::string& input, + int numCols) { + + std::string output; + size_t c = 0; + int len; + + // Don't make lines less than this length + int minLength = numCols / 4; + size_t inLen = input.size(); + + bool first = true; + while (c < inLen) { + if (first) { + first = false; + } else { + output += NEWLINE; + } + + if ((int)inLen - (int)c - 1 < numCols) { + // The end + output += input.substr(c, inLen - c); + break; + } + + len = numCols; + + // Look at character c + numCols, see if it is a space. + while ((len > minLength) && + (input[c + len] != ' ')) { + len--; + } + + if (len == minLength) { + // Just crop + len = numCols; + + } + + output += input.substr(c, len); + c += len; + if (c < input.size()) { + // Collapse multiple spaces. + while ((input[c] == ' ') && (c < input.size())) { + c++; + } + } + } + + return output; +} + + +int stringCompare( + const std::string& s1, + const std::string& s2) { + + return stringPtrCompare(&s1, &s2); +} + + +int stringPtrCompare( + const std::string* s1, + const std::string* s2) { + + return s1->compare(*s2); +} + + +std::string toUpper(const std::string& x) { + std::string result = x; + std::transform(result.begin(), result.end(), result.begin(), toupper); + return result; +} + + +std::string toLower(const std::string& x) { + std::string result = x; + std::transform(result.begin(), result.end(), result.begin(), tolower); + return result; +} + + +Array stringSplit( + const std::string& x, + char splitChar) { + + Array out; + + // Pointers to the beginning and end of the substring + const char* start = x.c_str(); + const char* stop = start; + + while ((stop = strchr(start, splitChar))) { + out.append(std::string(start, stop - start)); + start = stop + 1; + } + + // Append the last one + out.append(std::string(start)); + + return out; +} + + +std::string stringJoin( + const Array& a, + char joinChar) { + + std::string out; + + for (int i = 0; i < (int)a.size() - 1; ++i) { + out += a[i] + joinChar; + } + + if (a.size() > 0) { + return out + a.last(); + } else { + return out; + } +} + + +std::string stringJoin( + const Array& a, + const std::string& joinStr) { + + std::string out; + + for (int i = 0; i < (int)a.size() - 1; ++i) { + out += a[i] + joinStr; + } + + if (a.size() > 0) { + return out + a.last(); + } else { + return out; + } +} + + +std::string trimWhitespace( + const std::string& s) { + + size_t left = 0; + + // Trim from left + while ((left < s.length()) && iswspace(s[left])) { + ++left; + } + + int right = s.length() - 1; + // Trim from right + while ((right > (int)left) && iswspace(s[right])) { + --right; + } + + return s.substr(left, right - left + 1); +} + +}; // namespace + +#undef NEWLINE +#ifdef _MSC_VER +# pragma warning (pop) +#endif diff --git a/externals/g3dlite/win/VC90/g3dlite.vcproj b/externals/g3dlite/win/VC90/g3dlite.vcproj new file mode 100644 index 0000000..6d6c4c0 --- /dev/null +++ b/externals/g3dlite/win/VC90/g3dlite.vcproj @@ -0,0 +1,965 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/externals/g3dlite/win/g3dlite.sln b/externals/g3dlite/win/g3dlite.sln new file mode 100644 index 0000000..875374e --- /dev/null +++ b/externals/g3dlite/win/g3dlite.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g3dlite", "VC90\g3dlite.vcproj", "{8072769E-CF10-48BF-B9E1-12752A5DAC6E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Debug|Win32.ActiveCfg = Debug|Win32 + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Debug|Win32.Build.0 = Debug|Win32 + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Debug|x64.ActiveCfg = Debug|x64 + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Debug|x64.Build.0 = Debug|x64 + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|Win32.ActiveCfg = Release|Win32 + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|Win32.Build.0 = Release|Win32 + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.ActiveCfg = Release|x64 + {8072769E-CF10-48BF-B9E1-12752A5DAC6E}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/jemalloc/CMakeLists.txt b/externals/jemalloc/CMakeLists.txt new file mode 100644 index 0000000..d560c6b --- /dev/null +++ b/externals/jemalloc/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +file(GLOB sources *.c) + +set(jemalloc_STAT_SRC + ${sources} +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/internal +) + +add_definitions(-D_GNU_SOURCE -D_REENTRANT) + +add_library(jemalloc STATIC ${sources}) diff --git a/externals/jemalloc/arena.c b/externals/jemalloc/arena.c new file mode 100644 index 0000000..e74b470 --- /dev/null +++ b/externals/jemalloc/arena.c @@ -0,0 +1,2446 @@ +#define JEMALLOC_ARENA_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +size_t opt_lg_qspace_max = LG_QSPACE_MAX_DEFAULT; +size_t opt_lg_cspace_max = LG_CSPACE_MAX_DEFAULT; +ssize_t opt_lg_dirty_mult = LG_DIRTY_MULT_DEFAULT; +uint8_t const *small_size2bin; + +/* Various bin-related settings. */ +unsigned nqbins; +unsigned ncbins; +unsigned nsbins; +unsigned nbins; +size_t qspace_max; +size_t cspace_min; +size_t cspace_max; +size_t sspace_min; +size_t sspace_max; + +size_t lg_mspace; +size_t mspace_mask; + +/* + * const_small_size2bin is a static constant lookup table that in the common + * case can be used as-is for small_size2bin. For dynamically linked programs, + * this avoids a page of memory overhead per process. + */ +#define S2B_1(i) i, +#define S2B_2(i) S2B_1(i) S2B_1(i) +#define S2B_4(i) S2B_2(i) S2B_2(i) +#define S2B_8(i) S2B_4(i) S2B_4(i) +#define S2B_16(i) S2B_8(i) S2B_8(i) +#define S2B_32(i) S2B_16(i) S2B_16(i) +#define S2B_64(i) S2B_32(i) S2B_32(i) +#define S2B_128(i) S2B_64(i) S2B_64(i) +#define S2B_256(i) S2B_128(i) S2B_128(i) +/* + * The number of elements in const_small_size2bin is dependent on page size + * and on the definition for SUBPAGE. If SUBPAGE changes, the '- 255' must also + * change, along with the addition/removal of static lookup table element + * definitions. + */ +static const uint8_t const_small_size2bin[STATIC_PAGE_SIZE - 255] = { + S2B_1(0xffU) /* 0 */ +#if (LG_QUANTUM == 4) +/* 16-byte quantum **********************/ +# ifdef JEMALLOC_TINY +# if (LG_TINY_MIN == 2) + S2B_4(0) /* 4 */ + S2B_4(1) /* 8 */ + S2B_8(2) /* 16 */ +# define S2B_QMIN 2 +# elif (LG_TINY_MIN == 3) + S2B_8(0) /* 8 */ + S2B_8(1) /* 16 */ +# define S2B_QMIN 1 +# else +# error "Unsupported LG_TINY_MIN" +# endif +# else + S2B_16(0) /* 16 */ +# define S2B_QMIN 0 +# endif + S2B_16(S2B_QMIN + 1) /* 32 */ + S2B_16(S2B_QMIN + 2) /* 48 */ + S2B_16(S2B_QMIN + 3) /* 64 */ + S2B_16(S2B_QMIN + 4) /* 80 */ + S2B_16(S2B_QMIN + 5) /* 96 */ + S2B_16(S2B_QMIN + 6) /* 112 */ + S2B_16(S2B_QMIN + 7) /* 128 */ +# define S2B_CMIN (S2B_QMIN + 8) +#else +/* 8-byte quantum ***********************/ +# ifdef JEMALLOC_TINY +# if (LG_TINY_MIN == 2) + S2B_4(0) /* 4 */ + S2B_4(1) /* 8 */ +# define S2B_QMIN 1 +# else +# error "Unsupported LG_TINY_MIN" +# endif +# else + S2B_8(0) /* 8 */ +# define S2B_QMIN 0 +# endif + S2B_8(S2B_QMIN + 1) /* 16 */ + S2B_8(S2B_QMIN + 2) /* 24 */ + S2B_8(S2B_QMIN + 3) /* 32 */ + S2B_8(S2B_QMIN + 4) /* 40 */ + S2B_8(S2B_QMIN + 5) /* 48 */ + S2B_8(S2B_QMIN + 6) /* 56 */ + S2B_8(S2B_QMIN + 7) /* 64 */ + S2B_8(S2B_QMIN + 8) /* 72 */ + S2B_8(S2B_QMIN + 9) /* 80 */ + S2B_8(S2B_QMIN + 10) /* 88 */ + S2B_8(S2B_QMIN + 11) /* 96 */ + S2B_8(S2B_QMIN + 12) /* 104 */ + S2B_8(S2B_QMIN + 13) /* 112 */ + S2B_8(S2B_QMIN + 14) /* 120 */ + S2B_8(S2B_QMIN + 15) /* 128 */ +# define S2B_CMIN (S2B_QMIN + 16) +#endif +/****************************************/ + S2B_64(S2B_CMIN + 0) /* 192 */ + S2B_64(S2B_CMIN + 1) /* 256 */ + S2B_64(S2B_CMIN + 2) /* 320 */ + S2B_64(S2B_CMIN + 3) /* 384 */ + S2B_64(S2B_CMIN + 4) /* 448 */ + S2B_64(S2B_CMIN + 5) /* 512 */ +# define S2B_SMIN (S2B_CMIN + 6) + S2B_256(S2B_SMIN + 0) /* 768 */ + S2B_256(S2B_SMIN + 1) /* 1024 */ + S2B_256(S2B_SMIN + 2) /* 1280 */ + S2B_256(S2B_SMIN + 3) /* 1536 */ + S2B_256(S2B_SMIN + 4) /* 1792 */ + S2B_256(S2B_SMIN + 5) /* 2048 */ + S2B_256(S2B_SMIN + 6) /* 2304 */ + S2B_256(S2B_SMIN + 7) /* 2560 */ + S2B_256(S2B_SMIN + 8) /* 2816 */ + S2B_256(S2B_SMIN + 9) /* 3072 */ + S2B_256(S2B_SMIN + 10) /* 3328 */ + S2B_256(S2B_SMIN + 11) /* 3584 */ + S2B_256(S2B_SMIN + 12) /* 3840 */ +#if (STATIC_PAGE_SHIFT == 13) + S2B_256(S2B_SMIN + 13) /* 4096 */ + S2B_256(S2B_SMIN + 14) /* 4352 */ + S2B_256(S2B_SMIN + 15) /* 4608 */ + S2B_256(S2B_SMIN + 16) /* 4864 */ + S2B_256(S2B_SMIN + 17) /* 5120 */ + S2B_256(S2B_SMIN + 18) /* 5376 */ + S2B_256(S2B_SMIN + 19) /* 5632 */ + S2B_256(S2B_SMIN + 20) /* 5888 */ + S2B_256(S2B_SMIN + 21) /* 6144 */ + S2B_256(S2B_SMIN + 22) /* 6400 */ + S2B_256(S2B_SMIN + 23) /* 6656 */ + S2B_256(S2B_SMIN + 24) /* 6912 */ + S2B_256(S2B_SMIN + 25) /* 7168 */ + S2B_256(S2B_SMIN + 26) /* 7424 */ + S2B_256(S2B_SMIN + 27) /* 7680 */ + S2B_256(S2B_SMIN + 28) /* 7936 */ +#endif +}; +#undef S2B_1 +#undef S2B_2 +#undef S2B_4 +#undef S2B_8 +#undef S2B_16 +#undef S2B_32 +#undef S2B_64 +#undef S2B_128 +#undef S2B_256 +#undef S2B_QMIN +#undef S2B_CMIN +#undef S2B_SMIN + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static void arena_run_split(arena_t *arena, arena_run_t *run, size_t size, + bool large, bool zero); +static arena_chunk_t *arena_chunk_alloc(arena_t *arena); +static void arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk); +static arena_run_t *arena_run_alloc(arena_t *arena, size_t size, bool large, + bool zero); +static void arena_purge(arena_t *arena); +static void arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty); +static void arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, + arena_run_t *run, size_t oldsize, size_t newsize); +static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, + arena_run_t *run, size_t oldsize, size_t newsize, bool dirty); +static arena_run_t *arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin); +static void *arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin); +static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size); +static void arena_dalloc_bin_run(arena_t *arena, arena_chunk_t *chunk, + arena_run_t *run, arena_bin_t *bin); +static void arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, + void *ptr, size_t size, size_t oldsize); +static bool arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, + void *ptr, size_t size, size_t oldsize); +static bool arena_ralloc_large(void *ptr, size_t size, size_t oldsize); +#ifdef JEMALLOC_TINY +static size_t pow2_ceil(size_t x); +#endif +static bool small_size2bin_init(void); +#ifdef JEMALLOC_DEBUG +static void small_size2bin_validate(void); +#endif +static bool small_size2bin_init_hard(void); + +/******************************************************************************/ + +static inline int +arena_run_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) +{ + uintptr_t a_mapelm = (uintptr_t)a; + uintptr_t b_mapelm = (uintptr_t)b; + + assert(a != NULL); + assert(b != NULL); + + return ((a_mapelm > b_mapelm) - (a_mapelm < b_mapelm)); +} + +/* Generate red-black tree functions. */ +rb_gen(static JEMALLOC_ATTR(unused), arena_run_tree_, arena_run_tree_t, + arena_chunk_map_t, u.rb_link, arena_run_comp) + +static inline int +arena_avail_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) +{ + int ret; + size_t a_size = a->bits & ~PAGE_MASK; + size_t b_size = b->bits & ~PAGE_MASK; + + assert((a->bits & CHUNK_MAP_KEY) == CHUNK_MAP_KEY || (a->bits & + CHUNK_MAP_DIRTY) == (b->bits & CHUNK_MAP_DIRTY)); + + ret = (a_size > b_size) - (a_size < b_size); + if (ret == 0) { + uintptr_t a_mapelm, b_mapelm; + + if ((a->bits & CHUNK_MAP_KEY) != CHUNK_MAP_KEY) + a_mapelm = (uintptr_t)a; + else { + /* + * Treat keys as though they are lower than anything + * else. + */ + a_mapelm = 0; + } + b_mapelm = (uintptr_t)b; + + ret = (a_mapelm > b_mapelm) - (a_mapelm < b_mapelm); + } + + return (ret); +} + +/* Generate red-black tree functions. */ +rb_gen(static JEMALLOC_ATTR(unused), arena_avail_tree_, arena_avail_tree_t, + arena_chunk_map_t, u.rb_link, arena_avail_comp) + +static inline void * +arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin) +{ + void *ret; + + assert(run->magic == ARENA_RUN_MAGIC); + assert(run->nfree > 0); + + run->nfree--; + ret = run->avail; + if (ret != NULL) { + run->avail = *(void **)ret; + /* Double free can cause assertion failure.*/ + assert(ret != NULL); + /* Write-after free can cause assertion failure. */ + assert((uintptr_t)ret >= (uintptr_t)run + + (uintptr_t)bin->reg0_offset); + assert((uintptr_t)ret < (uintptr_t)run->next); + assert(((uintptr_t)ret - ((uintptr_t)run + + (uintptr_t)bin->reg0_offset)) % (uintptr_t)bin->reg_size == + 0); + return (ret); + } + ret = run->next; + run->next = (void *)((uintptr_t)ret + (uintptr_t)bin->reg_size); + assert(ret != NULL); + return (ret); +} + +static inline void +arena_run_reg_dalloc(arena_run_t *run, void *ptr) +{ + + assert(run->nfree < run->bin->nregs); + /* Freeing an interior pointer can cause assertion failure. */ + assert(((uintptr_t)ptr - ((uintptr_t)run + + (uintptr_t)run->bin->reg0_offset)) % (uintptr_t)run->bin->reg_size + == 0); + + *(void **)ptr = run->avail; + run->avail = ptr; + run->nfree++; +} + +static void +arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, + bool zero) +{ + arena_chunk_t *chunk; + size_t old_ndirty, run_ind, total_pages, need_pages, rem_pages, i; + size_t flag_dirty; + arena_avail_tree_t *runs_avail; + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); + old_ndirty = chunk->ndirty; + run_ind = (unsigned)(((uintptr_t)run - (uintptr_t)chunk) + >> PAGE_SHIFT); + flag_dirty = chunk->map[run_ind].bits & CHUNK_MAP_DIRTY; + runs_avail = (flag_dirty != 0) ? &arena->runs_avail_dirty : + &arena->runs_avail_clean; + total_pages = (chunk->map[run_ind].bits & ~PAGE_MASK) >> + PAGE_SHIFT; + assert((chunk->map[run_ind+total_pages-1].bits & CHUNK_MAP_DIRTY) == + flag_dirty); + need_pages = (size >> PAGE_SHIFT); + assert(need_pages > 0); + assert(need_pages <= total_pages); + rem_pages = total_pages - need_pages; + + arena_avail_tree_remove(runs_avail, &chunk->map[run_ind]); + arena->nactive += need_pages; + + /* Keep track of trailing unused pages for later use. */ + if (rem_pages > 0) { + if (flag_dirty != 0) { + chunk->map[run_ind+need_pages].bits = (rem_pages << + PAGE_SHIFT) | CHUNK_MAP_DIRTY; + chunk->map[run_ind+total_pages-1].bits = (rem_pages << + PAGE_SHIFT) | CHUNK_MAP_DIRTY; + } else { + chunk->map[run_ind+need_pages].bits = (rem_pages << + PAGE_SHIFT) | (chunk->map[run_ind+need_pages].bits & + CHUNK_MAP_ZEROED); + chunk->map[run_ind+total_pages-1].bits = (rem_pages << + PAGE_SHIFT) | + (chunk->map[run_ind+total_pages-1].bits & + CHUNK_MAP_ZEROED); + } + arena_avail_tree_insert(runs_avail, + &chunk->map[run_ind+need_pages]); + } + + /* Update dirty page accounting. */ + if (flag_dirty != 0) { + chunk->ndirty -= need_pages; + arena->ndirty -= need_pages; + } + + /* + * Update the page map separately for large vs. small runs, since it is + * possible to avoid iteration for large mallocs. + */ + if (large) { + if (zero) { + if (flag_dirty == 0) { + /* + * The run is clean, so some pages may be + * zeroed (i.e. never before touched). + */ + for (i = 0; i < need_pages; i++) { + if ((chunk->map[run_ind + i].bits & + CHUNK_MAP_ZEROED) == 0) { + memset((void *)((uintptr_t) + chunk + ((run_ind + i) << + PAGE_SHIFT)), 0, + PAGE_SIZE); + } + } + } else { + /* + * The run is dirty, so all pages must be + * zeroed. + */ + memset((void *)((uintptr_t)chunk + (run_ind << + PAGE_SHIFT)), 0, (need_pages << + PAGE_SHIFT)); + } + } + + /* + * Set the last element first, in case the run only contains one + * page (i.e. both statements set the same element). + */ + chunk->map[run_ind+need_pages-1].bits = CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED | flag_dirty; + chunk->map[run_ind].bits = size | CHUNK_MAP_LARGE | +#ifdef JEMALLOC_PROF + CHUNK_MAP_CLASS_MASK | +#endif + CHUNK_MAP_ALLOCATED | flag_dirty; + } else { + assert(zero == false); + /* + * Propagate the dirty flag to the allocated small run, so that + * arena_dalloc_bin_run() has the ability to conditionally trim + * clean pages. + */ + chunk->map[run_ind].bits = CHUNK_MAP_ALLOCATED | flag_dirty; + for (i = 1; i < need_pages - 1; i++) { + chunk->map[run_ind + i].bits = (i << PAGE_SHIFT) + | CHUNK_MAP_ALLOCATED; + } + chunk->map[run_ind + need_pages - 1].bits = ((need_pages - 1) << + PAGE_SHIFT) | CHUNK_MAP_ALLOCATED | flag_dirty; + } +} + +static arena_chunk_t * +arena_chunk_alloc(arena_t *arena) +{ + arena_chunk_t *chunk; + size_t i; + + if (arena->spare != NULL) { + arena_avail_tree_t *runs_avail; + + chunk = arena->spare; + arena->spare = NULL; + + /* Insert the run into the appropriate runs_avail_* tree. */ + if ((chunk->map[arena_chunk_header_npages].bits & + CHUNK_MAP_DIRTY) == 0) + runs_avail = &arena->runs_avail_clean; + else + runs_avail = &arena->runs_avail_dirty; + arena_avail_tree_insert(runs_avail, + &chunk->map[arena_chunk_header_npages]); + } else { + bool zero; + size_t zeroed; + + zero = false; + malloc_mutex_unlock(&arena->lock); + chunk = (arena_chunk_t *)chunk_alloc(chunksize, &zero); + malloc_mutex_lock(&arena->lock); + if (chunk == NULL) + return (NULL); +#ifdef JEMALLOC_STATS + arena->stats.mapped += chunksize; +#endif + + chunk->arena = arena; + ql_elm_new(chunk, link_dirty); + chunk->dirtied = false; + + /* + * Claim that no pages are in use, since the header is merely + * overhead. + */ + chunk->ndirty = 0; + + /* + * Initialize the map to contain one maximal free untouched run. + * Mark the pages as zeroed iff chunk_alloc() returned a zeroed + * chunk. + */ + zeroed = zero ? CHUNK_MAP_ZEROED : 0; + for (i = 0; i < arena_chunk_header_npages; i++) + chunk->map[i].bits = 0; + chunk->map[i].bits = arena_maxclass | zeroed; + for (i++; i < chunk_npages-1; i++) + chunk->map[i].bits = zeroed; + chunk->map[chunk_npages-1].bits = arena_maxclass | zeroed; + + /* Insert the run into the runs_avail_clean tree. */ + arena_avail_tree_insert(&arena->runs_avail_clean, + &chunk->map[arena_chunk_header_npages]); + } + + return (chunk); +} + +static void +arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk) +{ + arena_avail_tree_t *runs_avail; + + while (arena->spare != NULL) { + arena_chunk_t *spare = arena->spare; + + arena->spare = NULL; + if (spare->dirtied) { + ql_remove(&chunk->arena->chunks_dirty, spare, + link_dirty); + arena->ndirty -= spare->ndirty; + } + malloc_mutex_unlock(&arena->lock); + chunk_dealloc((void *)spare, chunksize); + malloc_mutex_lock(&arena->lock); +#ifdef JEMALLOC_STATS + arena->stats.mapped -= chunksize; +#endif + } + + /* + * Remove run from the appropriate runs_avail_* tree, so that the arena + * does not use it. + */ + if ((chunk->map[arena_chunk_header_npages].bits & + CHUNK_MAP_DIRTY) == 0) + runs_avail = &arena->runs_avail_clean; + else + runs_avail = &arena->runs_avail_dirty; + arena_avail_tree_remove(runs_avail, + &chunk->map[arena_chunk_header_npages]); + + arena->spare = chunk; +} + +static arena_run_t * +arena_run_alloc(arena_t *arena, size_t size, bool large, bool zero) +{ + arena_chunk_t *chunk; + arena_run_t *run; + arena_chunk_map_t *mapelm, key; + + assert(size <= arena_maxclass); + assert((size & PAGE_MASK) == 0); + + /* Search the arena's chunks for the lowest best fit. */ + key.bits = size | CHUNK_MAP_KEY; + mapelm = arena_avail_tree_nsearch(&arena->runs_avail_dirty, &key); + if (mapelm != NULL) { + arena_chunk_t *run_chunk = CHUNK_ADDR2BASE(mapelm); + size_t pageind = ((uintptr_t)mapelm - (uintptr_t)run_chunk->map) + / sizeof(arena_chunk_map_t); + + run = (arena_run_t *)((uintptr_t)run_chunk + (pageind << + PAGE_SHIFT)); + arena_run_split(arena, run, size, large, zero); + return (run); + } + mapelm = arena_avail_tree_nsearch(&arena->runs_avail_clean, &key); + if (mapelm != NULL) { + arena_chunk_t *run_chunk = CHUNK_ADDR2BASE(mapelm); + size_t pageind = ((uintptr_t)mapelm - (uintptr_t)run_chunk->map) + / sizeof(arena_chunk_map_t); + + run = (arena_run_t *)((uintptr_t)run_chunk + (pageind << + PAGE_SHIFT)); + arena_run_split(arena, run, size, large, zero); + return (run); + } + + /* + * No usable runs. Create a new chunk from which to allocate the run. + */ + chunk = arena_chunk_alloc(arena); + if (chunk != NULL) { + run = (arena_run_t *)((uintptr_t)chunk + + (arena_chunk_header_npages << PAGE_SHIFT)); + arena_run_split(arena, run, size, large, zero); + return (run); + } + + /* + * arena_chunk_alloc() failed, but another thread may have made + * sufficient memory available while this one dropped arena->lock in + * arena_chunk_alloc(), so search one more time. + */ + mapelm = arena_avail_tree_nsearch(&arena->runs_avail_dirty, &key); + if (mapelm != NULL) { + arena_chunk_t *run_chunk = CHUNK_ADDR2BASE(mapelm); + size_t pageind = ((uintptr_t)mapelm - (uintptr_t)run_chunk->map) + / sizeof(arena_chunk_map_t); + + run = (arena_run_t *)((uintptr_t)run_chunk + (pageind << + PAGE_SHIFT)); + arena_run_split(arena, run, size, large, zero); + return (run); + } + mapelm = arena_avail_tree_nsearch(&arena->runs_avail_clean, &key); + if (mapelm != NULL) { + arena_chunk_t *run_chunk = CHUNK_ADDR2BASE(mapelm); + size_t pageind = ((uintptr_t)mapelm - (uintptr_t)run_chunk->map) + / sizeof(arena_chunk_map_t); + + run = (arena_run_t *)((uintptr_t)run_chunk + (pageind << + PAGE_SHIFT)); + arena_run_split(arena, run, size, large, zero); + return (run); + } + + return (NULL); +} + +static inline void +arena_maybe_purge(arena_t *arena) +{ + + /* Enforce opt_lg_dirty_mult. */ + if (opt_lg_dirty_mult >= 0 && arena->ndirty > arena->npurgatory && + (arena->ndirty - arena->npurgatory) > chunk_npages && + (arena->nactive >> opt_lg_dirty_mult) < (arena->ndirty - + arena->npurgatory)) + arena_purge(arena); +} + +static inline void +arena_chunk_purge(arena_t *arena, arena_chunk_t *chunk) +{ + ql_head(arena_chunk_map_t) mapelms; + arena_chunk_map_t *mapelm; + size_t pageind, flag_zeroed; +#ifdef JEMALLOC_DEBUG + size_t ndirty; +#endif +#ifdef JEMALLOC_STATS + size_t nmadvise; +#endif + + ql_new(&mapelms); + + flag_zeroed = +#ifdef JEMALLOC_SWAP + swap_enabled ? 0 : +#endif + CHUNK_MAP_ZEROED; + + /* + * If chunk is the spare, temporarily re-allocate it, 1) so that its + * run is reinserted into runs_avail_dirty, and 2) so that it cannot be + * completely discarded by another thread while arena->lock is dropped + * by this thread. Note that the arena_run_dalloc() call will + * implicitly deallocate the chunk, so no explicit action is required + * in this function to deallocate the chunk. + * + * Note that once a chunk contains dirty pages, it cannot again contain + * a single run unless 1) it is a dirty run, or 2) this function purges + * dirty pages and causes the transition to a single clean run. Thus + * (chunk == arena->spare) is possible, but it is not possible for + * this function to be called on the spare unless it contains a dirty + * run. + */ + if (chunk == arena->spare) { + assert((chunk->map[arena_chunk_header_npages].bits & + CHUNK_MAP_DIRTY) != 0); + arena_chunk_alloc(arena); + } + + /* Temporarily allocate all free dirty runs within chunk. */ + for (pageind = arena_chunk_header_npages; pageind < chunk_npages;) { + mapelm = &chunk->map[pageind]; + if ((mapelm->bits & CHUNK_MAP_ALLOCATED) == 0) { + size_t npages; + + npages = mapelm->bits >> PAGE_SHIFT; + assert(pageind + npages <= chunk_npages); + if (mapelm->bits & CHUNK_MAP_DIRTY) { + size_t i; + + arena_avail_tree_remove( + &arena->runs_avail_dirty, mapelm); + + /* + * Update internal elements in the page map, so + * that CHUNK_MAP_ZEROED is properly set. + * madvise(..., MADV_DONTNEED) results in + * zero-filled pages for anonymous mappings, + * but not for file-backed mappings. + */ + mapelm->bits = (npages << PAGE_SHIFT) | + CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED | + flag_zeroed; + for (i = 1; i < npages - 1; i++) { + chunk->map[pageind + i].bits = + flag_zeroed; + } + if (npages > 1) { + chunk->map[pageind + npages - 1].bits = + (npages << PAGE_SHIFT) | + CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED | + flag_zeroed; + } + + arena->nactive += npages; + /* Append to list for later processing. */ + ql_elm_new(mapelm, u.ql_link); + ql_tail_insert(&mapelms, mapelm, u.ql_link); + } + + pageind += npages; + } else { + /* Skip allocated run. */ + if (mapelm->bits & CHUNK_MAP_LARGE) + pageind += mapelm->bits >> PAGE_SHIFT; + else { + arena_run_t *run = (arena_run_t *)((uintptr_t) + chunk + (uintptr_t)(pageind << PAGE_SHIFT)); + + assert((mapelm->bits >> PAGE_SHIFT) == 0); + assert(run->magic == ARENA_RUN_MAGIC); + pageind += run->bin->run_size >> PAGE_SHIFT; + } + } + } + assert(pageind == chunk_npages); + +#ifdef JEMALLOC_DEBUG + ndirty = chunk->ndirty; +#endif +#ifdef JEMALLOC_STATS + arena->stats.purged += chunk->ndirty; +#endif + arena->ndirty -= chunk->ndirty; + chunk->ndirty = 0; + ql_remove(&arena->chunks_dirty, chunk, link_dirty); + chunk->dirtied = false; + + malloc_mutex_unlock(&arena->lock); +#ifdef JEMALLOC_STATS + nmadvise = 0; +#endif + ql_foreach(mapelm, &mapelms, u.ql_link) { + size_t pageind = ((uintptr_t)mapelm - (uintptr_t)chunk->map) / + sizeof(arena_chunk_map_t); + size_t npages = mapelm->bits >> PAGE_SHIFT; + + assert(pageind + npages <= chunk_npages); +#ifdef JEMALLOC_DEBUG + assert(ndirty >= npages); + ndirty -= npages; +#endif + madvise((void *)((uintptr_t)chunk + (pageind << PAGE_SHIFT)), + (npages << PAGE_SHIFT), MADV_DONTNEED); +#ifdef JEMALLOC_STATS + nmadvise++; +#endif + } +#ifdef JEMALLOC_DEBUG + assert(ndirty == 0); +#endif + malloc_mutex_lock(&arena->lock); +#ifdef JEMALLOC_STATS + arena->stats.nmadvise += nmadvise; +#endif + + /* Deallocate runs. */ + for (mapelm = ql_first(&mapelms); mapelm != NULL; + mapelm = ql_first(&mapelms)) { + size_t pageind = ((uintptr_t)mapelm - (uintptr_t)chunk->map) / + sizeof(arena_chunk_map_t); + arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + + (uintptr_t)(pageind << PAGE_SHIFT)); + + ql_remove(&mapelms, mapelm, u.ql_link); + arena_run_dalloc(arena, run, false); + } +} + +static void +arena_purge(arena_t *arena) +{ + arena_chunk_t *chunk; + size_t npurgatory; +#ifdef JEMALLOC_DEBUG + size_t ndirty = 0; + + ql_foreach(chunk, &arena->chunks_dirty, link_dirty) { + assert(chunk->dirtied); + ndirty += chunk->ndirty; + } + assert(ndirty == arena->ndirty); +#endif + assert(arena->ndirty > arena->npurgatory); + assert(arena->ndirty > chunk_npages); + assert((arena->nactive >> opt_lg_dirty_mult) < arena->ndirty); + +#ifdef JEMALLOC_STATS + arena->stats.npurge++; +#endif + + /* + * Compute the minimum number of pages that this thread should try to + * purge, and add the result to arena->npurgatory. This will keep + * multiple threads from racing to reduce ndirty below the threshold. + */ + npurgatory = (arena->ndirty - arena->npurgatory) - (arena->nactive >> + opt_lg_dirty_mult); + arena->npurgatory += npurgatory; + + while (npurgatory > 0) { + /* Get next chunk with dirty pages. */ + chunk = ql_first(&arena->chunks_dirty); + if (chunk == NULL) { + /* + * This thread was unable to purge as many pages as + * originally intended, due to races with other threads + * that either did some of the purging work, or re-used + * dirty pages. + */ + arena->npurgatory -= npurgatory; + return; + } + while (chunk->ndirty == 0) { + ql_remove(&arena->chunks_dirty, chunk, link_dirty); + chunk->dirtied = false; + chunk = ql_first(&arena->chunks_dirty); + if (chunk == NULL) { + /* Same logic as for above. */ + arena->npurgatory -= npurgatory; + return; + } + } + + if (chunk->ndirty > npurgatory) { + /* + * This thread will, at a minimum, purge all the dirty + * pages in chunk, so set npurgatory to reflect this + * thread's commitment to purge the pages. This tends + * to reduce the chances of the following scenario: + * + * 1) This thread sets arena->npurgatory such that + * (arena->ndirty - arena->npurgatory) is at the + * threshold. + * 2) This thread drops arena->lock. + * 3) Another thread causes one or more pages to be + * dirtied, and immediately determines that it must + * purge dirty pages. + * + * If this scenario *does* play out, that's okay, + * because all of the purging work being done really + * needs to happen. + */ + arena->npurgatory += chunk->ndirty - npurgatory; + npurgatory = chunk->ndirty; + } + + arena->npurgatory -= chunk->ndirty; + npurgatory -= chunk->ndirty; + arena_chunk_purge(arena, chunk); + } +} + +static void +arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty) +{ + arena_chunk_t *chunk; + size_t size, run_ind, run_pages, flag_dirty; + arena_avail_tree_t *runs_avail; + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); + run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) + >> PAGE_SHIFT); + assert(run_ind >= arena_chunk_header_npages); + assert(run_ind < chunk_npages); + if ((chunk->map[run_ind].bits & CHUNK_MAP_LARGE) != 0) + size = chunk->map[run_ind].bits & ~PAGE_MASK; + else + size = run->bin->run_size; + run_pages = (size >> PAGE_SHIFT); + arena->nactive -= run_pages; + + /* + * The run is dirty if the caller claims to have dirtied it, as well as + * if it was already dirty before being allocated. + */ + if ((chunk->map[run_ind].bits & CHUNK_MAP_DIRTY) != 0) + dirty = true; + flag_dirty = dirty ? CHUNK_MAP_DIRTY : 0; + runs_avail = dirty ? &arena->runs_avail_dirty : + &arena->runs_avail_clean; + + /* Mark pages as unallocated in the chunk map. */ + if (dirty) { + chunk->map[run_ind].bits = size | flag_dirty; + chunk->map[run_ind+run_pages-1].bits = size | flag_dirty; + + chunk->ndirty += run_pages; + arena->ndirty += run_pages; + } else { + chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & + CHUNK_MAP_ZEROED); + chunk->map[run_ind+run_pages-1].bits = size | + (chunk->map[run_ind+run_pages-1].bits & CHUNK_MAP_ZEROED); + } + + /* Try to coalesce forward. */ + if (run_ind + run_pages < chunk_npages && + (chunk->map[run_ind+run_pages].bits & CHUNK_MAP_ALLOCATED) == 0 && + (chunk->map[run_ind+run_pages].bits & CHUNK_MAP_DIRTY) == + flag_dirty) { + size_t nrun_size = chunk->map[run_ind+run_pages].bits & + ~PAGE_MASK; + + /* + * Remove successor from runs_avail; the coalesced run is + * inserted later. + */ + arena_avail_tree_remove(runs_avail, + &chunk->map[run_ind+run_pages]); + + size += nrun_size; + run_pages = size >> PAGE_SHIFT; + + assert((chunk->map[run_ind+run_pages-1].bits & ~PAGE_MASK) + == nrun_size); + chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & + CHUNK_MAP_FLAGS_MASK); + chunk->map[run_ind+run_pages-1].bits = size | + (chunk->map[run_ind+run_pages-1].bits & + CHUNK_MAP_FLAGS_MASK); + } + + /* Try to coalesce backward. */ + if (run_ind > arena_chunk_header_npages && (chunk->map[run_ind-1].bits & + CHUNK_MAP_ALLOCATED) == 0 && (chunk->map[run_ind-1].bits & + CHUNK_MAP_DIRTY) == flag_dirty) { + size_t prun_size = chunk->map[run_ind-1].bits & ~PAGE_MASK; + + run_ind -= prun_size >> PAGE_SHIFT; + + /* + * Remove predecessor from runs_avail; the coalesced run is + * inserted later. + */ + arena_avail_tree_remove(runs_avail, &chunk->map[run_ind]); + + size += prun_size; + run_pages = size >> PAGE_SHIFT; + + assert((chunk->map[run_ind].bits & ~PAGE_MASK) == prun_size); + chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & + CHUNK_MAP_FLAGS_MASK); + chunk->map[run_ind+run_pages-1].bits = size | + (chunk->map[run_ind+run_pages-1].bits & + CHUNK_MAP_FLAGS_MASK); + } + + /* Insert into runs_avail, now that coalescing is complete. */ + arena_avail_tree_insert(runs_avail, &chunk->map[run_ind]); + + /* + * Deallocate chunk if it is now completely unused. The bit + * manipulation checks whether the first run is unallocated and extends + * to the end of the chunk. + */ + if ((chunk->map[arena_chunk_header_npages].bits & (~PAGE_MASK | + CHUNK_MAP_ALLOCATED)) == arena_maxclass) + arena_chunk_dealloc(arena, chunk); + + /* + * It is okay to do dirty page processing even if the chunk was + * deallocated above, since in that case it is the spare. Waiting + * until after possible chunk deallocation to do dirty processing + * allows for an old spare to be fully deallocated, thus decreasing the + * chances of spuriously crossing the dirty page purging threshold. + */ + if (dirty) { + if (chunk->dirtied == false) { + ql_tail_insert(&arena->chunks_dirty, chunk, link_dirty); + chunk->dirtied = true; + } + arena_maybe_purge(arena); + } +} + +static void +arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, + size_t oldsize, size_t newsize) +{ + size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t head_npages = (oldsize - newsize) >> PAGE_SHIFT; + size_t flags = chunk->map[pageind].bits & CHUNK_MAP_FLAGS_MASK; + + assert(oldsize > newsize); + + /* + * Update the chunk map so that arena_run_dalloc() can treat the + * leading run as separately allocated. + */ + assert(chunk->map[pageind].bits & CHUNK_MAP_LARGE); + assert(chunk->map[pageind].bits & CHUNK_MAP_ALLOCATED); + chunk->map[pageind].bits = (oldsize - newsize) | flags; + chunk->map[pageind+head_npages].bits = newsize | flags; + + arena_run_dalloc(arena, run, false); +} + +static void +arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, + size_t oldsize, size_t newsize, bool dirty) +{ + size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t npages = newsize >> PAGE_SHIFT; + size_t flags = chunk->map[pageind].bits & CHUNK_MAP_FLAGS_MASK; + + assert(oldsize > newsize); + + /* + * Update the chunk map so that arena_run_dalloc() can treat the + * trailing run as separately allocated. + */ + assert(chunk->map[pageind].bits & CHUNK_MAP_LARGE); + assert(chunk->map[pageind].bits & CHUNK_MAP_ALLOCATED); + chunk->map[pageind].bits = newsize | flags; + chunk->map[pageind+npages-1].bits = newsize | flags; + chunk->map[pageind+npages].bits = (oldsize - newsize) | flags; + + arena_run_dalloc(arena, (arena_run_t *)((uintptr_t)run + newsize), + dirty); +} + +static arena_run_t * +arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin) +{ + arena_chunk_map_t *mapelm; + arena_run_t *run; + + /* Look for a usable run. */ + mapelm = arena_run_tree_first(&bin->runs); + if (mapelm != NULL) { + arena_chunk_t *chunk; + size_t pageind; + + /* run is guaranteed to have available space. */ + arena_run_tree_remove(&bin->runs, mapelm); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(mapelm); + pageind = (((uintptr_t)mapelm - (uintptr_t)chunk->map) / + sizeof(arena_chunk_map_t)); + run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - + (mapelm->bits >> PAGE_SHIFT)) + << PAGE_SHIFT)); +#ifdef JEMALLOC_STATS + bin->stats.reruns++; +#endif + return (run); + } + /* No existing runs have any space available. */ + + /* Allocate a new run. */ + malloc_mutex_unlock(&bin->lock); + /******************************/ + malloc_mutex_lock(&arena->lock); + run = arena_run_alloc(arena, bin->run_size, false, false); + if (run != NULL) { + /* Initialize run internals. */ + run->bin = bin; + run->avail = NULL; + run->next = (void *)(((uintptr_t)run) + + (uintptr_t)bin->reg0_offset); + run->nfree = bin->nregs; +#ifdef JEMALLOC_DEBUG + run->magic = ARENA_RUN_MAGIC; +#endif + } + malloc_mutex_unlock(&arena->lock); + /********************************/ + malloc_mutex_lock(&bin->lock); + if (run != NULL) { +#ifdef JEMALLOC_STATS + bin->stats.nruns++; + bin->stats.curruns++; + if (bin->stats.curruns > bin->stats.highruns) + bin->stats.highruns = bin->stats.curruns; +#endif + return (run); + } + + /* + * arena_run_alloc() failed, but another thread may have made + * sufficient memory available while this one dopped bin->lock above, + * so search one more time. + */ + mapelm = arena_run_tree_first(&bin->runs); + if (mapelm != NULL) { + arena_chunk_t *chunk; + size_t pageind; + + /* run is guaranteed to have available space. */ + arena_run_tree_remove(&bin->runs, mapelm); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(mapelm); + pageind = (((uintptr_t)mapelm - (uintptr_t)chunk->map) / + sizeof(arena_chunk_map_t)); + run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - + (mapelm->bits >> PAGE_SHIFT)) + << PAGE_SHIFT)); +#ifdef JEMALLOC_STATS + bin->stats.reruns++; +#endif + return (run); + } + + return (NULL); +} + +/* Re-fill bin->runcur, then call arena_run_reg_alloc(). */ +static void * +arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin) +{ + void *ret; + arena_run_t *run; + + bin->runcur = NULL; + run = arena_bin_nonfull_run_get(arena, bin); + if (bin->runcur != NULL && bin->runcur->nfree > 0) { + /* + * Another thread updated runcur while this one ran without the + * bin lock in arena_bin_nonfull_run_get(). + */ + assert(bin->runcur->magic == ARENA_RUN_MAGIC); + assert(bin->runcur->nfree > 0); + ret = arena_run_reg_alloc(bin->runcur, bin); + if (run != NULL) { + malloc_mutex_unlock(&bin->lock); + malloc_mutex_lock(&arena->lock); + arena_run_dalloc(arena, run, false); + malloc_mutex_unlock(&arena->lock); + malloc_mutex_lock(&bin->lock); + } + return (ret); + } + + if (run == NULL) + return (NULL); + + bin->runcur = run; + + assert(bin->runcur->magic == ARENA_RUN_MAGIC); + assert(bin->runcur->nfree > 0); + + return (arena_run_reg_alloc(bin->runcur, bin)); +} + +#ifdef JEMALLOC_PROF +void +arena_prof_accum(arena_t *arena, uint64_t accumbytes) +{ + + if (prof_interval != 0) { + arena->prof_accumbytes += accumbytes; + if (arena->prof_accumbytes >= prof_interval) { + prof_idump(); + arena->prof_accumbytes -= prof_interval; + } + } +} +#endif + +#ifdef JEMALLOC_TCACHE +void +arena_tcache_fill_small(arena_t *arena, tcache_bin_t *tbin, size_t binind +# ifdef JEMALLOC_PROF + , uint64_t prof_accumbytes +# endif + ) +{ + unsigned i, nfill; + arena_bin_t *bin; + arena_run_t *run; + void *ptr; + + assert(tbin->ncached == 0); + +#ifdef JEMALLOC_PROF + malloc_mutex_lock(&arena->lock); + arena_prof_accum(arena, prof_accumbytes); + malloc_mutex_unlock(&arena->lock); +#endif + bin = &arena->bins[binind]; + malloc_mutex_lock(&bin->lock); + for (i = 0, nfill = (tbin->ncached_max >> 1); i < nfill; i++) { + if ((run = bin->runcur) != NULL && run->nfree > 0) + ptr = arena_run_reg_alloc(run, bin); + else + ptr = arena_bin_malloc_hard(arena, bin); + if (ptr == NULL) + break; + *(void **)ptr = tbin->avail; + tbin->avail = ptr; + } +#ifdef JEMALLOC_STATS + bin->stats.allocated += (i - tbin->ncached) * bin->reg_size; + bin->stats.nmalloc += i; + bin->stats.nrequests += tbin->tstats.nrequests; + bin->stats.nfills++; + tbin->tstats.nrequests = 0; +#endif + malloc_mutex_unlock(&bin->lock); + tbin->ncached = i; + if (tbin->ncached > tbin->high_water) + tbin->high_water = tbin->ncached; +} +#endif + +/* + * Calculate bin->run_size such that it meets the following constraints: + * + * *) bin->run_size >= min_run_size + * *) bin->run_size <= arena_maxclass + * *) run header overhead <= RUN_MAX_OVRHD (or header overhead relaxed). + * *) run header size < PAGE_SIZE + * + * bin->nregs and bin->reg0_offset are also calculated here, since these + * settings are all interdependent. + */ +static size_t +arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size) +{ + size_t try_run_size, good_run_size; + uint32_t try_nregs, good_nregs; + uint32_t try_hdr_size, good_hdr_size; +#ifdef JEMALLOC_PROF + uint32_t try_cnt0_offset, good_cnt0_offset; +#endif + uint32_t try_reg0_offset, good_reg0_offset; + + assert(min_run_size >= PAGE_SIZE); + assert(min_run_size <= arena_maxclass); + + /* + * Calculate known-valid settings before entering the run_size + * expansion loop, so that the first part of the loop always copies + * valid settings. + * + * The do..while loop iteratively reduces the number of regions until + * the run header and the regions no longer overlap. A closed formula + * would be quite messy, since there is an interdependency between the + * header's mask length and the number of regions. + */ + try_run_size = min_run_size; + try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + + 1; /* Counter-act try_nregs-- in loop. */ + do { + try_nregs--; + try_hdr_size = sizeof(arena_run_t); +#ifdef JEMALLOC_PROF + if (opt_prof && prof_promote == false) { + /* Pad to a quantum boundary. */ + try_hdr_size = QUANTUM_CEILING(try_hdr_size); + try_cnt0_offset = try_hdr_size; + /* Add space for one (prof_thr_cnt_t *) per region. */ + try_hdr_size += try_nregs * sizeof(prof_thr_cnt_t *); + } else + try_cnt0_offset = 0; +#endif + try_reg0_offset = try_run_size - (try_nregs * bin->reg_size); + } while (try_hdr_size > try_reg0_offset); + + /* run_size expansion loop. */ + do { + /* + * Copy valid settings before trying more aggressive settings. + */ + good_run_size = try_run_size; + good_nregs = try_nregs; + good_hdr_size = try_hdr_size; +#ifdef JEMALLOC_PROF + good_cnt0_offset = try_cnt0_offset; +#endif + good_reg0_offset = try_reg0_offset; + + /* Try more aggressive settings. */ + try_run_size += PAGE_SIZE; + try_nregs = ((try_run_size - sizeof(arena_run_t)) / + bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ + do { + try_nregs--; + try_hdr_size = sizeof(arena_run_t); +#ifdef JEMALLOC_PROF + if (opt_prof && prof_promote == false) { + /* Pad to a quantum boundary. */ + try_hdr_size = QUANTUM_CEILING(try_hdr_size); + try_cnt0_offset = try_hdr_size; + /* + * Add space for one (prof_thr_cnt_t *) per + * region. + */ + try_hdr_size += try_nregs * + sizeof(prof_thr_cnt_t *); + } +#endif + try_reg0_offset = try_run_size - (try_nregs * + bin->reg_size); + } while (try_hdr_size > try_reg0_offset); + } while (try_run_size <= arena_maxclass + && try_run_size <= arena_maxclass + && RUN_MAX_OVRHD * (bin->reg_size << 3) > RUN_MAX_OVRHD_RELAX + && (try_reg0_offset << RUN_BFP) > RUN_MAX_OVRHD * try_run_size + && try_hdr_size < PAGE_SIZE); + + assert(good_hdr_size <= good_reg0_offset); + + /* Copy final settings. */ + bin->run_size = good_run_size; + bin->nregs = good_nregs; +#ifdef JEMALLOC_PROF + bin->cnt0_offset = good_cnt0_offset; +#endif + bin->reg0_offset = good_reg0_offset; + + return (good_run_size); +} + +void * +arena_malloc_small(arena_t *arena, size_t size, bool zero) +{ + void *ret; + arena_bin_t *bin; + arena_run_t *run; + size_t binind; + + binind = small_size2bin[size]; + assert(binind < nbins); + bin = &arena->bins[binind]; + size = bin->reg_size; + + malloc_mutex_lock(&bin->lock); + if ((run = bin->runcur) != NULL && run->nfree > 0) + ret = arena_run_reg_alloc(run, bin); + else + ret = arena_bin_malloc_hard(arena, bin); + + if (ret == NULL) { + malloc_mutex_unlock(&bin->lock); + return (NULL); + } + +#ifdef JEMALLOC_STATS + bin->stats.allocated += size; + bin->stats.nmalloc++; + bin->stats.nrequests++; +#endif + malloc_mutex_unlock(&bin->lock); +#ifdef JEMALLOC_PROF + if (isthreaded == false) { + malloc_mutex_lock(&arena->lock); + arena_prof_accum(arena, size); + malloc_mutex_unlock(&arena->lock); + } +#endif + + if (zero == false) { +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + } else + memset(ret, 0, size); + + return (ret); +} + +void * +arena_malloc_large(arena_t *arena, size_t size, bool zero) +{ + void *ret; + + /* Large allocation. */ + size = PAGE_CEILING(size); + malloc_mutex_lock(&arena->lock); + ret = (void *)arena_run_alloc(arena, size, true, zero); + if (ret == NULL) { + malloc_mutex_unlock(&arena->lock); + return (NULL); + } +#ifdef JEMALLOC_STATS + arena->stats.nmalloc_large++; + arena->stats.nrequests_large++; + arena->stats.allocated_large += size; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nmalloc++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nrequests++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns++; + if (arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns > + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns) { + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns = + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns; + } +#endif +#ifdef JEMALLOC_PROF + arena_prof_accum(arena, size); +#endif + malloc_mutex_unlock(&arena->lock); + + if (zero == false) { +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + } + + return (ret); +} + +void * +arena_malloc(size_t size, bool zero) +{ + + assert(size != 0); + assert(QUANTUM_CEILING(size) <= arena_maxclass); + + if (size <= small_maxclass) { +#ifdef JEMALLOC_TCACHE + tcache_t *tcache; + + if ((tcache = tcache_get()) != NULL) + return (tcache_alloc_small(tcache, size, zero)); + else + +#endif + return (arena_malloc_small(choose_arena(), size, zero)); + } else { +#ifdef JEMALLOC_TCACHE + if (size <= tcache_maxclass) { + tcache_t *tcache; + + if ((tcache = tcache_get()) != NULL) + return (tcache_alloc_large(tcache, size, zero)); + else { + return (arena_malloc_large(choose_arena(), + size, zero)); + } + } else +#endif + return (arena_malloc_large(choose_arena(), size, zero)); + } +} + +/* Only handles large allocations that require more than page alignment. */ +void * +arena_palloc(arena_t *arena, size_t alignment, size_t size, size_t alloc_size) +{ + void *ret; + size_t offset; + arena_chunk_t *chunk; + + assert((size & PAGE_MASK) == 0); + assert((alignment & PAGE_MASK) == 0); + + malloc_mutex_lock(&arena->lock); + ret = (void *)arena_run_alloc(arena, alloc_size, true, false); + if (ret == NULL) { + malloc_mutex_unlock(&arena->lock); + return (NULL); + } + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ret); + + offset = (uintptr_t)ret & (alignment - 1); + assert((offset & PAGE_MASK) == 0); + assert(offset < alloc_size); + if (offset == 0) + arena_run_trim_tail(arena, chunk, ret, alloc_size, size, false); + else { + size_t leadsize, trailsize; + + leadsize = alignment - offset; + if (leadsize > 0) { + arena_run_trim_head(arena, chunk, ret, alloc_size, + alloc_size - leadsize); + ret = (void *)((uintptr_t)ret + leadsize); + } + + trailsize = alloc_size - leadsize - size; + if (trailsize != 0) { + /* Trim trailing space. */ + assert(trailsize < alloc_size); + arena_run_trim_tail(arena, chunk, ret, size + trailsize, + size, false); + } + } + +#ifdef JEMALLOC_STATS + arena->stats.nmalloc_large++; + arena->stats.nrequests_large++; + arena->stats.allocated_large += size; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nmalloc++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nrequests++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns++; + if (arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns > + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns) { + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns = + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns; + } +#endif + malloc_mutex_unlock(&arena->lock); + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + return (ret); +} + +/* Return the size of the allocation pointed to by ptr. */ +size_t +arena_salloc(const void *ptr) +{ + size_t ret; + arena_chunk_t *chunk; + size_t pageind, mapbits; + + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapbits = chunk->map[pageind].bits; + assert((mapbits & CHUNK_MAP_ALLOCATED) != 0); + if ((mapbits & CHUNK_MAP_LARGE) == 0) { + arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + + (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << + PAGE_SHIFT)); + assert(run->magic == ARENA_RUN_MAGIC); + assert(((uintptr_t)ptr - ((uintptr_t)run + + (uintptr_t)run->bin->reg0_offset)) % run->bin->reg_size == + 0); + ret = run->bin->reg_size; + } else { + assert(((uintptr_t)ptr & PAGE_MASK) == 0); + ret = mapbits & ~PAGE_MASK; + assert(ret != 0); + } + + return (ret); +} + +#ifdef JEMALLOC_PROF +void +arena_prof_promoted(const void *ptr, size_t size) +{ + arena_chunk_t *chunk; + size_t pageind, binind; + + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + assert(isalloc(ptr) == PAGE_SIZE); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + binind = small_size2bin[size]; + assert(binind < nbins); + chunk->map[pageind].bits = (chunk->map[pageind].bits & + ~CHUNK_MAP_CLASS_MASK) | (binind << CHUNK_MAP_CLASS_SHIFT); +} + +size_t +arena_salloc_demote(const void *ptr) +{ + size_t ret; + arena_chunk_t *chunk; + size_t pageind, mapbits; + + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapbits = chunk->map[pageind].bits; + assert((mapbits & CHUNK_MAP_ALLOCATED) != 0); + if ((mapbits & CHUNK_MAP_LARGE) == 0) { + arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + + (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << + PAGE_SHIFT)); + assert(run->magic == ARENA_RUN_MAGIC); + assert(((uintptr_t)ptr - ((uintptr_t)run + + (uintptr_t)run->bin->reg0_offset)) % run->bin->reg_size == + 0); + ret = run->bin->reg_size; + } else { + assert(((uintptr_t)ptr & PAGE_MASK) == 0); + ret = mapbits & ~PAGE_MASK; + if (prof_promote && ret == PAGE_SIZE && (mapbits & + CHUNK_MAP_CLASS_MASK) != CHUNK_MAP_CLASS_MASK) { + size_t binind = ((mapbits & CHUNK_MAP_CLASS_MASK) >> + CHUNK_MAP_CLASS_SHIFT); + assert(binind < nbins); + ret = chunk->arena->bins[binind].reg_size; + } + assert(ret != 0); + } + + return (ret); +} + +static inline unsigned +arena_run_regind(arena_run_t *run, arena_bin_t *bin, const void *ptr, + size_t size) +{ + unsigned shift, diff, regind; + + assert(run->magic == ARENA_RUN_MAGIC); + + /* + * Avoid doing division with a variable divisor if possible. Using + * actual division here can reduce allocator throughput by over 20%! + */ + diff = (unsigned)((uintptr_t)ptr - (uintptr_t)run - bin->reg0_offset); + + /* Rescale (factor powers of 2 out of the numerator and denominator). */ + shift = ffs(size) - 1; + diff >>= shift; + size >>= shift; + + if (size == 1) { + /* The divisor was a power of 2. */ + regind = diff; + } else { + /* + * To divide by a number D that is not a power of two we + * multiply by (2^21 / D) and then right shift by 21 positions. + * + * X / D + * + * becomes + * + * (X * size_invs[D - 3]) >> SIZE_INV_SHIFT + * + * We can omit the first three elements, because we never + * divide by 0, and 1 and 2 are both powers of two, which are + * handled above. + */ +#define SIZE_INV_SHIFT 21 +#define SIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s)) + 1) + static const unsigned size_invs[] = { + SIZE_INV(3), + SIZE_INV(4), SIZE_INV(5), SIZE_INV(6), SIZE_INV(7), + SIZE_INV(8), SIZE_INV(9), SIZE_INV(10), SIZE_INV(11), + SIZE_INV(12), SIZE_INV(13), SIZE_INV(14), SIZE_INV(15), + SIZE_INV(16), SIZE_INV(17), SIZE_INV(18), SIZE_INV(19), + SIZE_INV(20), SIZE_INV(21), SIZE_INV(22), SIZE_INV(23), + SIZE_INV(24), SIZE_INV(25), SIZE_INV(26), SIZE_INV(27), + SIZE_INV(28), SIZE_INV(29), SIZE_INV(30), SIZE_INV(31) + }; + + if (size <= ((sizeof(size_invs) / sizeof(unsigned)) + 2)) + regind = (diff * size_invs[size - 3]) >> SIZE_INV_SHIFT; + else + regind = diff / size; +#undef SIZE_INV +#undef SIZE_INV_SHIFT + } + assert(diff == regind * size); + assert(regind < bin->nregs); + + return (regind); +} + +prof_thr_cnt_t * +arena_prof_cnt_get(const void *ptr) +{ + prof_thr_cnt_t *ret; + arena_chunk_t *chunk; + size_t pageind, mapbits; + + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapbits = chunk->map[pageind].bits; + assert((mapbits & CHUNK_MAP_ALLOCATED) != 0); + if ((mapbits & CHUNK_MAP_LARGE) == 0) { + if (prof_promote) + ret = (prof_thr_cnt_t *)(uintptr_t)1U; + else { + arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + + (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << + PAGE_SHIFT)); + arena_bin_t *bin = run->bin; + unsigned regind; + + assert(run->magic == ARENA_RUN_MAGIC); + regind = arena_run_regind(run, bin, ptr, bin->reg_size); + ret = *(prof_thr_cnt_t **)((uintptr_t)run + + bin->cnt0_offset + (regind * + sizeof(prof_thr_cnt_t *))); + } + } else + ret = chunk->map[pageind].prof_cnt; + + return (ret); +} + +void +arena_prof_cnt_set(const void *ptr, prof_thr_cnt_t *cnt) +{ + arena_chunk_t *chunk; + size_t pageind, mapbits; + + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapbits = chunk->map[pageind].bits; + assert((mapbits & CHUNK_MAP_ALLOCATED) != 0); + if ((mapbits & CHUNK_MAP_LARGE) == 0) { + if (prof_promote == false) { + arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + + (uintptr_t)((pageind - (mapbits >> PAGE_SHIFT)) << + PAGE_SHIFT)); + arena_bin_t *bin = run->bin; + unsigned regind; + + assert(run->magic == ARENA_RUN_MAGIC); + regind = arena_run_regind(run, bin, ptr, bin->reg_size); + + *((prof_thr_cnt_t **)((uintptr_t)run + bin->cnt0_offset + + (regind * sizeof(prof_thr_cnt_t *)))) = cnt; + } else + assert((uintptr_t)cnt == (uintptr_t)1U); + } else + chunk->map[pageind].prof_cnt = cnt; +} +#endif + +static void +arena_dalloc_bin_run(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, + arena_bin_t *bin) +{ + size_t npages, run_ind, past; + + /* Dissociate run from bin. */ + if (run == bin->runcur) + bin->runcur = NULL; + else if (bin->nregs != 1) { + size_t run_pageind = (((uintptr_t)run - (uintptr_t)chunk)) >> + PAGE_SHIFT; + arena_chunk_map_t *run_mapelm = &chunk->map[run_pageind]; + /* + * This block's conditional is necessary because if the run + * only contains one region, then it never gets inserted into + * the non-full runs tree. + */ + arena_run_tree_remove(&bin->runs, run_mapelm); + } + + malloc_mutex_unlock(&bin->lock); + /******************************/ + npages = bin->run_size >> PAGE_SHIFT; + run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT); + past = (size_t)(((uintptr_t)run->next - (uintptr_t)1U - + (uintptr_t)chunk) >> PAGE_SHIFT) + 1; + malloc_mutex_lock(&arena->lock); + + /* + * If the run was originally clean, and some pages were never touched, + * trim the clean pages before deallocating the dirty portion of the + * run. + */ + if ((chunk->map[run_ind].bits & CHUNK_MAP_DIRTY) == 0 && past - run_ind + < npages) { + /* + * Trim clean pages. Convert to large run beforehand. Set the + * last map element first, in case this is a one-page run. + */ + chunk->map[run_ind+npages-1].bits = CHUNK_MAP_LARGE | + (chunk->map[run_ind].bits & CHUNK_MAP_FLAGS_MASK); + chunk->map[run_ind].bits = bin->run_size | CHUNK_MAP_LARGE | + (chunk->map[run_ind].bits & CHUNK_MAP_FLAGS_MASK); + arena_run_trim_tail(arena, chunk, run, (npages << PAGE_SHIFT), + ((npages - (past - run_ind)) << PAGE_SHIFT), false); + npages = past - run_ind; + } +#ifdef JEMALLOC_DEBUG + run->magic = 0; +#endif + arena_run_dalloc(arena, run, true); + malloc_mutex_unlock(&arena->lock); + /****************************/ + malloc_mutex_lock(&bin->lock); +#ifdef JEMALLOC_STATS + bin->stats.curruns--; +#endif +} + +void +arena_dalloc_bin(arena_t *arena, arena_chunk_t *chunk, void *ptr, + arena_chunk_map_t *mapelm) +{ + size_t pageind; + arena_run_t *run; + arena_bin_t *bin; +#if (defined(JEMALLOC_FILL) || defined(JEMALLOC_STATS)) + size_t size; +#endif + + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - + (mapelm->bits >> PAGE_SHIFT)) << PAGE_SHIFT)); + assert(run->magic == ARENA_RUN_MAGIC); + bin = run->bin; +#if (defined(JEMALLOC_FILL) || defined(JEMALLOC_STATS)) + size = bin->reg_size; +#endif + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ptr, 0x5a, size); +#endif + + arena_run_reg_dalloc(run, ptr); + + if (run->nfree == bin->nregs) + arena_dalloc_bin_run(arena, chunk, run, bin); + else if (run->nfree == 1 && run != bin->runcur) { + /* + * Make sure that bin->runcur always refers to the lowest + * non-full run, if one exists. + */ + if (bin->runcur == NULL) + bin->runcur = run; + else if ((uintptr_t)run < (uintptr_t)bin->runcur) { + /* Switch runcur. */ + if (bin->runcur->nfree > 0) { + arena_chunk_t *runcur_chunk = + CHUNK_ADDR2BASE(bin->runcur); + size_t runcur_pageind = + (((uintptr_t)bin->runcur - + (uintptr_t)runcur_chunk)) >> PAGE_SHIFT; + arena_chunk_map_t *runcur_mapelm = + &runcur_chunk->map[runcur_pageind]; + + /* Insert runcur. */ + arena_run_tree_insert(&bin->runs, + runcur_mapelm); + } + bin->runcur = run; + } else { + size_t run_pageind = (((uintptr_t)run - + (uintptr_t)chunk)) >> PAGE_SHIFT; + arena_chunk_map_t *run_mapelm = + &chunk->map[run_pageind]; + + assert(arena_run_tree_search(&bin->runs, run_mapelm) == + NULL); + arena_run_tree_insert(&bin->runs, run_mapelm); + } + } + +#ifdef JEMALLOC_STATS + bin->stats.allocated -= size; + bin->stats.ndalloc++; +#endif +} + +#ifdef JEMALLOC_STATS +void +arena_stats_merge(arena_t *arena, size_t *nactive, size_t *ndirty, + arena_stats_t *astats, malloc_bin_stats_t *bstats, + malloc_large_stats_t *lstats) +{ + unsigned i; + + malloc_mutex_lock(&arena->lock); + *nactive += arena->nactive; + *ndirty += arena->ndirty; + + astats->mapped += arena->stats.mapped; + astats->npurge += arena->stats.npurge; + astats->nmadvise += arena->stats.nmadvise; + astats->purged += arena->stats.purged; + astats->allocated_large += arena->stats.allocated_large; + astats->nmalloc_large += arena->stats.nmalloc_large; + astats->ndalloc_large += arena->stats.ndalloc_large; + astats->nrequests_large += arena->stats.nrequests_large; + + for (i = 0; i < nlclasses; i++) { + lstats[i].nmalloc += arena->stats.lstats[i].nmalloc; + lstats[i].ndalloc += arena->stats.lstats[i].ndalloc; + lstats[i].nrequests += arena->stats.lstats[i].nrequests; + lstats[i].highruns += arena->stats.lstats[i].highruns; + lstats[i].curruns += arena->stats.lstats[i].curruns; + } + malloc_mutex_unlock(&arena->lock); + + for (i = 0; i < nbins; i++) { + arena_bin_t *bin = &arena->bins[i]; + + malloc_mutex_lock(&bin->lock); + bstats[i].allocated += bin->stats.allocated; + bstats[i].nmalloc += bin->stats.nmalloc; + bstats[i].ndalloc += bin->stats.ndalloc; + bstats[i].nrequests += bin->stats.nrequests; +#ifdef JEMALLOC_TCACHE + bstats[i].nfills += bin->stats.nfills; + bstats[i].nflushes += bin->stats.nflushes; +#endif + bstats[i].nruns += bin->stats.nruns; + bstats[i].reruns += bin->stats.reruns; + bstats[i].highruns += bin->stats.highruns; + bstats[i].curruns += bin->stats.curruns; + malloc_mutex_unlock(&bin->lock); + } +} +#endif + +void +arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr) +{ + + /* Large allocation. */ +#ifdef JEMALLOC_FILL +# ifndef JEMALLOC_STATS + if (opt_junk) +# endif +#endif + { +#if (defined(JEMALLOC_FILL) || defined(JEMALLOC_STATS)) + size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> + PAGE_SHIFT; + size_t size = chunk->map[pageind].bits & ~PAGE_MASK; +#endif + +#ifdef JEMALLOC_FILL +# ifdef JEMALLOC_STATS + if (opt_junk) +# endif + memset(ptr, 0x5a, size); +#endif +#ifdef JEMALLOC_STATS + arena->stats.ndalloc_large++; + arena->stats.allocated_large -= size; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].ndalloc++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns--; +#endif + } + + arena_run_dalloc(arena, (arena_run_t *)ptr, true); +} + +static void +arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, void *ptr, + size_t size, size_t oldsize) +{ + + assert(size < oldsize); + + /* + * Shrink the run, and make trailing pages available for other + * allocations. + */ + malloc_mutex_lock(&arena->lock); + arena_run_trim_tail(arena, chunk, (arena_run_t *)ptr, oldsize, size, + true); +#ifdef JEMALLOC_STATS + arena->stats.ndalloc_large++; + arena->stats.allocated_large -= oldsize; + arena->stats.lstats[(oldsize >> PAGE_SHIFT) - 1].ndalloc++; + arena->stats.lstats[(oldsize >> PAGE_SHIFT) - 1].curruns--; + + arena->stats.nmalloc_large++; + arena->stats.nrequests_large++; + arena->stats.allocated_large += size; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nmalloc++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nrequests++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns++; + if (arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns > + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns) { + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns = + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns; + } +#endif + malloc_mutex_unlock(&arena->lock); +} + +static bool +arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr, + size_t size, size_t oldsize) +{ + size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t npages = oldsize >> PAGE_SHIFT; + + assert(oldsize == (chunk->map[pageind].bits & ~PAGE_MASK)); + + /* Try to extend the run. */ + assert(size > oldsize); + malloc_mutex_lock(&arena->lock); + if (pageind + npages < chunk_npages && (chunk->map[pageind+npages].bits + & CHUNK_MAP_ALLOCATED) == 0 && (chunk->map[pageind+npages].bits & + ~PAGE_MASK) >= size - oldsize) { + /* + * The next run is available and sufficiently large. Split the + * following run, then merge the first part with the existing + * allocation. + */ + arena_run_split(arena, (arena_run_t *)((uintptr_t)chunk + + ((pageind+npages) << PAGE_SHIFT)), size - oldsize, true, + false); + + chunk->map[pageind].bits = size | CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED; + chunk->map[pageind+npages].bits = CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED; + +#ifdef JEMALLOC_STATS + arena->stats.ndalloc_large++; + arena->stats.allocated_large -= oldsize; + arena->stats.lstats[(oldsize >> PAGE_SHIFT) - 1].ndalloc++; + arena->stats.lstats[(oldsize >> PAGE_SHIFT) - 1].curruns--; + + arena->stats.nmalloc_large++; + arena->stats.nrequests_large++; + arena->stats.allocated_large += size; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nmalloc++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].nrequests++; + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns++; + if (arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns > + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns) { + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].highruns = + arena->stats.lstats[(size >> PAGE_SHIFT) - 1].curruns; + } +#endif + malloc_mutex_unlock(&arena->lock); + return (false); + } + malloc_mutex_unlock(&arena->lock); + + return (true); +} + +/* + * Try to resize a large allocation, in order to avoid copying. This will + * always fail if growing an object, and the following run is already in use. + */ +static bool +arena_ralloc_large(void *ptr, size_t size, size_t oldsize) +{ + size_t psize; + + psize = PAGE_CEILING(size); + if (psize == oldsize) { + /* Same size class. */ +#ifdef JEMALLOC_FILL + if (opt_junk && size < oldsize) { + memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - + size); + } +#endif + return (false); + } else { + arena_chunk_t *chunk; + arena_t *arena; + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + arena = chunk->arena; + assert(arena->magic == ARENA_MAGIC); + + if (psize < oldsize) { +#ifdef JEMALLOC_FILL + /* Fill before shrinking in order avoid a race. */ + if (opt_junk) { + memset((void *)((uintptr_t)ptr + size), 0x5a, + oldsize - size); + } +#endif + arena_ralloc_large_shrink(arena, chunk, ptr, psize, + oldsize); + return (false); + } else { + bool ret = arena_ralloc_large_grow(arena, chunk, ptr, + psize, oldsize); +#ifdef JEMALLOC_FILL + if (ret == false && opt_zero) { + memset((void *)((uintptr_t)ptr + oldsize), 0, + size - oldsize); + } +#endif + return (ret); + } + } +} + +void * +arena_ralloc(void *ptr, size_t size, size_t oldsize) +{ + void *ret; + size_t copysize; + + /* Try to avoid moving the allocation. */ + if (oldsize <= arena_maxclass) { + if (oldsize <= small_maxclass) { + if (size <= small_maxclass && small_size2bin[size] == + small_size2bin[oldsize]) + goto IN_PLACE; + } else { + assert(size <= arena_maxclass); + if (size > small_maxclass) { + if (arena_ralloc_large(ptr, size, oldsize) == + false) + return (ptr); + } + } + } + + /* + * If we get here, then size and oldsize are different enough that we + * need to move the object. In that case, fall back to allocating new + * space and copying. + */ + ret = arena_malloc(size, false); + if (ret == NULL) + return (NULL); + + /* Junk/zero-filling were already done by arena_malloc(). */ + copysize = (size < oldsize) ? size : oldsize; + memcpy(ret, ptr, copysize); + idalloc(ptr); + return (ret); +IN_PLACE: +#ifdef JEMALLOC_FILL + if (opt_junk && size < oldsize) + memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); + else if (opt_zero && size > oldsize) + memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); +#endif + return (ptr); +} + +bool +arena_new(arena_t *arena, unsigned ind) +{ + unsigned i; + arena_bin_t *bin; + size_t prev_run_size; + + arena->ind = ind; + + if (malloc_mutex_init(&arena->lock)) + return (true); + +#ifdef JEMALLOC_STATS + memset(&arena->stats, 0, sizeof(arena_stats_t)); + arena->stats.lstats = (malloc_large_stats_t *)base_alloc(nlclasses * + sizeof(malloc_large_stats_t)); + if (arena->stats.lstats == NULL) + return (true); + memset(arena->stats.lstats, 0, nlclasses * + sizeof(malloc_large_stats_t)); +# ifdef JEMALLOC_TCACHE + ql_new(&arena->tcache_ql); +# endif +#endif + +#ifdef JEMALLOC_PROF + arena->prof_accumbytes = 0; +#endif + + /* Initialize chunks. */ + ql_new(&arena->chunks_dirty); + arena->spare = NULL; + + arena->nactive = 0; + arena->ndirty = 0; + arena->npurgatory = 0; + + arena_avail_tree_new(&arena->runs_avail_clean); + arena_avail_tree_new(&arena->runs_avail_dirty); + + /* Initialize bins. */ + prev_run_size = PAGE_SIZE; + + i = 0; +#ifdef JEMALLOC_TINY + /* (2^n)-spaced tiny bins. */ + for (; i < ntbins; i++) { + bin = &arena->bins[i]; + if (malloc_mutex_init(&bin->lock)) + return (true); + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = (1U << (LG_TINY_MIN + i)); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } +#endif + + /* Quantum-spaced bins. */ + for (; i < ntbins + nqbins; i++) { + bin = &arena->bins[i]; + if (malloc_mutex_init(&bin->lock)) + return (true); + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = (i - ntbins + 1) << LG_QUANTUM; + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } + + /* Cacheline-spaced bins. */ + for (; i < ntbins + nqbins + ncbins; i++) { + bin = &arena->bins[i]; + if (malloc_mutex_init(&bin->lock)) + return (true); + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = cspace_min + ((i - (ntbins + nqbins)) << + LG_CACHELINE); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } + + /* Subpage-spaced bins. */ + for (; i < nbins; i++) { + bin = &arena->bins[i]; + if (malloc_mutex_init(&bin->lock)) + return (true); + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = sspace_min + ((i - (ntbins + nqbins + ncbins)) + << LG_SUBPAGE); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } + +#ifdef JEMALLOC_DEBUG + arena->magic = ARENA_MAGIC; +#endif + + return (false); +} + +#ifdef JEMALLOC_TINY +/* Compute the smallest power of 2 that is >= x. */ +static size_t +pow2_ceil(size_t x) +{ + + x--; + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; +#if (SIZEOF_PTR == 8) + x |= x >> 32; +#endif + x++; + return (x); +} +#endif + +#ifdef JEMALLOC_DEBUG +static void +small_size2bin_validate(void) +{ + size_t i, size, binind; + + assert(small_size2bin[0] == 0xffU); + i = 1; +# ifdef JEMALLOC_TINY + /* Tiny. */ + for (; i < (1U << LG_TINY_MIN); i++) { + size = pow2_ceil(1U << LG_TINY_MIN); + binind = ffs((int)(size >> (LG_TINY_MIN + 1))); + assert(small_size2bin[i] == binind); + } + for (; i < qspace_min; i++) { + size = pow2_ceil(i); + binind = ffs((int)(size >> (LG_TINY_MIN + 1))); + assert(small_size2bin[i] == binind); + } +# endif + /* Quantum-spaced. */ + for (; i <= qspace_max; i++) { + size = QUANTUM_CEILING(i); + binind = ntbins + (size >> LG_QUANTUM) - 1; + assert(small_size2bin[i] == binind); + } + /* Cacheline-spaced. */ + for (; i <= cspace_max; i++) { + size = CACHELINE_CEILING(i); + binind = ntbins + nqbins + ((size - cspace_min) >> + LG_CACHELINE); + assert(small_size2bin[i] == binind); + } + /* Sub-page. */ + for (; i <= sspace_max; i++) { + size = SUBPAGE_CEILING(i); + binind = ntbins + nqbins + ncbins + ((size - sspace_min) + >> LG_SUBPAGE); + assert(small_size2bin[i] == binind); + } +} +#endif + +static bool +small_size2bin_init(void) +{ + + if (opt_lg_qspace_max != LG_QSPACE_MAX_DEFAULT + || opt_lg_cspace_max != LG_CSPACE_MAX_DEFAULT + || sizeof(const_small_size2bin) != small_maxclass + 1) + return (small_size2bin_init_hard()); + + small_size2bin = const_small_size2bin; +#ifdef JEMALLOC_DEBUG + assert(sizeof(const_small_size2bin) == small_maxclass + 1); + small_size2bin_validate(); +#endif + return (false); +} + +static bool +small_size2bin_init_hard(void) +{ + size_t i, size, binind; + uint8_t *custom_small_size2bin; + + assert(opt_lg_qspace_max != LG_QSPACE_MAX_DEFAULT + || opt_lg_cspace_max != LG_CSPACE_MAX_DEFAULT + || sizeof(const_small_size2bin) != small_maxclass + 1); + + custom_small_size2bin = (uint8_t *)base_alloc(small_maxclass + 1); + if (custom_small_size2bin == NULL) + return (true); + + custom_small_size2bin[0] = 0xffU; + i = 1; +#ifdef JEMALLOC_TINY + /* Tiny. */ + for (; i < (1U << LG_TINY_MIN); i++) { + size = pow2_ceil(1U << LG_TINY_MIN); + binind = ffs((int)(size >> (LG_TINY_MIN + 1))); + custom_small_size2bin[i] = binind; + } + for (; i < qspace_min; i++) { + size = pow2_ceil(i); + binind = ffs((int)(size >> (LG_TINY_MIN + 1))); + custom_small_size2bin[i] = binind; + } +#endif + /* Quantum-spaced. */ + for (; i <= qspace_max; i++) { + size = QUANTUM_CEILING(i); + binind = ntbins + (size >> LG_QUANTUM) - 1; + custom_small_size2bin[i] = binind; + } + /* Cacheline-spaced. */ + for (; i <= cspace_max; i++) { + size = CACHELINE_CEILING(i); + binind = ntbins + nqbins + ((size - cspace_min) >> + LG_CACHELINE); + custom_small_size2bin[i] = binind; + } + /* Sub-page. */ + for (; i <= sspace_max; i++) { + size = SUBPAGE_CEILING(i); + binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> + LG_SUBPAGE); + custom_small_size2bin[i] = binind; + } + + small_size2bin = custom_small_size2bin; +#ifdef JEMALLOC_DEBUG + small_size2bin_validate(); +#endif + return (false); +} + +bool +arena_boot(void) +{ + size_t header_size; + + /* Set variables according to the value of opt_lg_[qc]space_max. */ + qspace_max = (1U << opt_lg_qspace_max); + cspace_min = CACHELINE_CEILING(qspace_max); + if (cspace_min == qspace_max) + cspace_min += CACHELINE; + cspace_max = (1U << opt_lg_cspace_max); + sspace_min = SUBPAGE_CEILING(cspace_max); + if (sspace_min == cspace_max) + sspace_min += SUBPAGE; + assert(sspace_min < PAGE_SIZE); + sspace_max = PAGE_SIZE - SUBPAGE; + +#ifdef JEMALLOC_TINY + assert(LG_QUANTUM >= LG_TINY_MIN); +#endif + assert(ntbins <= LG_QUANTUM); + nqbins = qspace_max >> LG_QUANTUM; + ncbins = ((cspace_max - cspace_min) >> LG_CACHELINE) + 1; + nsbins = ((sspace_max - sspace_min) >> LG_SUBPAGE) + 1; + nbins = ntbins + nqbins + ncbins + nsbins; + + /* + * The small_size2bin lookup table uses uint8_t to encode each bin + * index, so we cannot support more than 256 small size classes. This + * limit is difficult to exceed (not even possible with 16B quantum and + * 4KiB pages), and such configurations are impractical, but + * nonetheless we need to protect against this case in order to avoid + * undefined behavior. + * + * Further constrain nbins to 255 if prof_promote is true, since all + * small size classes, plus a "not small" size class must be stored in + * 8 bits of arena_chunk_map_t's bits field. + */ +#ifdef JEMALLOC_PROF + if (opt_prof && prof_promote) { + if (nbins > 255) { + char line_buf[UMAX2S_BUFSIZE]; + malloc_write(": Too many small size classes ("); + malloc_write(umax2s(nbins, 10, line_buf)); + malloc_write(" > max 255)\n"); + abort(); + } + } else +#endif + if (nbins > 256) { + char line_buf[UMAX2S_BUFSIZE]; + malloc_write(": Too many small size classes ("); + malloc_write(umax2s(nbins, 10, line_buf)); + malloc_write(" > max 256)\n"); + abort(); + } + + if (small_size2bin_init()) + return (true); + + /* + * Compute the header size such that it is large enough to contain the + * page map. + */ + header_size = sizeof(arena_chunk_t) + + (sizeof(arena_chunk_map_t) * (chunk_npages - 1)); + arena_chunk_header_npages = (header_size >> PAGE_SHIFT) + + ((header_size & PAGE_MASK) != 0); + arena_maxclass = chunksize - (arena_chunk_header_npages << PAGE_SHIFT); + + return (false); +} diff --git a/externals/jemalloc/base.c b/externals/jemalloc/base.c new file mode 100644 index 0000000..605197e --- /dev/null +++ b/externals/jemalloc/base.c @@ -0,0 +1,106 @@ +#define JEMALLOC_BASE_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +malloc_mutex_t base_mtx; + +/* + * Current pages that are being used for internal memory allocations. These + * pages are carved up in cacheline-size quanta, so that there is no chance of + * false cache line sharing. + */ +static void *base_pages; +static void *base_next_addr; +static void *base_past_addr; /* Addr immediately past base_pages. */ +static extent_node_t *base_nodes; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static bool base_pages_alloc(size_t minsize); + +/******************************************************************************/ + +static bool +base_pages_alloc(size_t minsize) +{ + size_t csize; + bool zero; + + assert(minsize != 0); + csize = CHUNK_CEILING(minsize); + zero = false; + base_pages = chunk_alloc(csize, &zero); + if (base_pages == NULL) + return (true); + base_next_addr = base_pages; + base_past_addr = (void *)((uintptr_t)base_pages + csize); + + return (false); +} + +void * +base_alloc(size_t size) +{ + void *ret; + size_t csize; + + /* Round size up to nearest multiple of the cacheline size. */ + csize = CACHELINE_CEILING(size); + + malloc_mutex_lock(&base_mtx); + /* Make sure there's enough space for the allocation. */ + if ((uintptr_t)base_next_addr + csize > (uintptr_t)base_past_addr) { + if (base_pages_alloc(csize)) { + malloc_mutex_unlock(&base_mtx); + return (NULL); + } + } + /* Allocate. */ + ret = base_next_addr; + base_next_addr = (void *)((uintptr_t)base_next_addr + csize); + malloc_mutex_unlock(&base_mtx); + + return (ret); +} + +extent_node_t * +base_node_alloc(void) +{ + extent_node_t *ret; + + malloc_mutex_lock(&base_mtx); + if (base_nodes != NULL) { + ret = base_nodes; + base_nodes = *(extent_node_t **)ret; + malloc_mutex_unlock(&base_mtx); + } else { + malloc_mutex_unlock(&base_mtx); + ret = (extent_node_t *)base_alloc(sizeof(extent_node_t)); + } + + return (ret); +} + +void +base_node_dealloc(extent_node_t *node) +{ + + malloc_mutex_lock(&base_mtx); + *(extent_node_t **)node = base_nodes; + base_nodes = node; + malloc_mutex_unlock(&base_mtx); +} + +bool +base_boot(void) +{ + + base_nodes = NULL; + if (malloc_mutex_init(&base_mtx)) + return (true); + + return (false); +} diff --git a/externals/jemalloc/chunk.c b/externals/jemalloc/chunk.c new file mode 100644 index 0000000..e6e3bcd --- /dev/null +++ b/externals/jemalloc/chunk.c @@ -0,0 +1,150 @@ +#define JEMALLOC_CHUNK_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +size_t opt_lg_chunk = LG_CHUNK_DEFAULT; +#ifdef JEMALLOC_SWAP +bool opt_overcommit = true; +#endif + +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) +malloc_mutex_t chunks_mtx; +chunk_stats_t stats_chunks; +#endif + +/* Various chunk-related settings. */ +size_t chunksize; +size_t chunksize_mask; /* (chunksize - 1). */ +size_t chunk_npages; +size_t arena_chunk_header_npages; +size_t arena_maxclass; /* Max size class for arenas. */ + +/******************************************************************************/ + +/* + * If the caller specifies (*zero == false), it is still possible to receive + * zeroed memory, in which case *zero is toggled to true. arena_chunk_alloc() + * takes advantage of this to avoid demanding zeroed chunks, but taking + * advantage of them if they are returned. + */ +void * +chunk_alloc(size_t size, bool *zero) +{ + void *ret; + + assert(size != 0); + assert((size & chunksize_mask) == 0); + +#ifdef JEMALLOC_SWAP + if (swap_enabled) { + ret = chunk_alloc_swap(size, zero); + if (ret != NULL) + goto RETURN; + } + + if (swap_enabled == false || opt_overcommit) { +#endif +#ifdef JEMALLOC_DSS + ret = chunk_alloc_dss(size, zero); + if (ret != NULL) + goto RETURN; +#endif + ret = chunk_alloc_mmap(size); + if (ret != NULL) { + *zero = true; + goto RETURN; + } +#ifdef JEMALLOC_SWAP + } +#endif + + /* All strategies for allocation failed. */ + ret = NULL; +RETURN: +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + if (ret != NULL) { +# ifdef JEMALLOC_PROF + bool udump; +# endif + malloc_mutex_lock(&chunks_mtx); +# ifdef JEMALLOC_STATS + stats_chunks.nchunks += (size / chunksize); +# endif + stats_chunks.curchunks += (size / chunksize); + if (stats_chunks.curchunks > stats_chunks.highchunks) { + stats_chunks.highchunks = stats_chunks.curchunks; +# ifdef JEMALLOC_PROF + udump = true; +# endif + } +# ifdef JEMALLOC_PROF + else + udump = false; +# endif + malloc_mutex_unlock(&chunks_mtx); +# ifdef JEMALLOC_PROF + if (opt_prof && opt_prof_udump && udump) + prof_udump(); +# endif + } +#endif + + assert(CHUNK_ADDR2BASE(ret) == ret); + return (ret); +} + +void +chunk_dealloc(void *chunk, size_t size) +{ + + assert(chunk != NULL); + assert(CHUNK_ADDR2BASE(chunk) == chunk); + assert(size != 0); + assert((size & chunksize_mask) == 0); + +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + malloc_mutex_lock(&chunks_mtx); + stats_chunks.curchunks -= (size / chunksize); + malloc_mutex_unlock(&chunks_mtx); +#endif + +#ifdef JEMALLOC_SWAP + if (swap_enabled && chunk_dealloc_swap(chunk, size) == false) + return; +#endif +#ifdef JEMALLOC_DSS + if (chunk_dealloc_dss(chunk, size) == false) + return; +#endif + chunk_dealloc_mmap(chunk, size); +} + +bool +chunk_boot(void) +{ + + /* Set variables according to the value of opt_lg_chunk. */ + chunksize = (1LU << opt_lg_chunk); + assert(chunksize >= PAGE_SIZE); + chunksize_mask = chunksize - 1; + chunk_npages = (chunksize >> PAGE_SHIFT); + +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + if (malloc_mutex_init(&chunks_mtx)) + return (true); + memset(&stats_chunks, 0, sizeof(chunk_stats_t)); +#endif + +#ifdef JEMALLOC_SWAP + if (chunk_swap_boot()) + return (true); +#endif +#ifdef JEMALLOC_DSS + if (chunk_dss_boot()) + return (true); +#endif + + return (false); +} diff --git a/externals/jemalloc/chunk_dss.c b/externals/jemalloc/chunk_dss.c new file mode 100644 index 0000000..d9bd63c --- /dev/null +++ b/externals/jemalloc/chunk_dss.c @@ -0,0 +1,268 @@ +#define JEMALLOC_CHUNK_DSS_C_ +#include "jemalloc/internal/jemalloc_internal.h" +#ifdef JEMALLOC_DSS +/******************************************************************************/ +/* Data. */ + +malloc_mutex_t dss_mtx; + +/* Base address of the DSS. */ +static void *dss_base; +/* Current end of the DSS, or ((void *)-1) if the DSS is exhausted. */ +static void *dss_prev; +/* Current upper limit on DSS addresses. */ +static void *dss_max; + +/* + * Trees of chunks that were previously allocated (trees differ only in node + * ordering). These are used when allocating chunks, in an attempt to re-use + * address space. Depending on function, different tree orderings are needed, + * which is why there are two trees with the same contents. + */ +static extent_tree_t dss_chunks_szad; +static extent_tree_t dss_chunks_ad; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static void *chunk_recycle_dss(size_t size, bool *zero); +static extent_node_t *chunk_dealloc_dss_record(void *chunk, size_t size); + +/******************************************************************************/ + +static void * +chunk_recycle_dss(size_t size, bool *zero) +{ + extent_node_t *node, key; + + key.addr = NULL; + key.size = size; + malloc_mutex_lock(&dss_mtx); + node = extent_tree_szad_nsearch(&dss_chunks_szad, &key); + if (node != NULL) { + void *ret = node->addr; + + /* Remove node from the tree. */ + extent_tree_szad_remove(&dss_chunks_szad, node); + if (node->size == size) { + extent_tree_ad_remove(&dss_chunks_ad, node); + base_node_dealloc(node); + } else { + /* + * Insert the remainder of node's address range as a + * smaller chunk. Its position within dss_chunks_ad + * does not change. + */ + assert(node->size > size); + node->addr = (void *)((uintptr_t)node->addr + size); + node->size -= size; + extent_tree_szad_insert(&dss_chunks_szad, node); + } + malloc_mutex_unlock(&dss_mtx); + + if (*zero) + memset(ret, 0, size); + return (ret); + } + malloc_mutex_unlock(&dss_mtx); + + return (NULL); +} + +void * +chunk_alloc_dss(size_t size, bool *zero) +{ + void *ret; + + ret = chunk_recycle_dss(size, zero); + if (ret != NULL) + return (ret); + + /* + * sbrk() uses a signed increment argument, so take care not to + * interpret a huge allocation request as a negative increment. + */ + if ((intptr_t)size < 0) + return (NULL); + + malloc_mutex_lock(&dss_mtx); + if (dss_prev != (void *)-1) { + intptr_t incr; + + /* + * The loop is necessary to recover from races with other + * threads that are using the DSS for something other than + * malloc. + */ + do { + /* Get the current end of the DSS. */ + dss_max = sbrk(0); + + /* + * Calculate how much padding is necessary to + * chunk-align the end of the DSS. + */ + incr = (intptr_t)size + - (intptr_t)CHUNK_ADDR2OFFSET(dss_max); + if (incr == (intptr_t)size) + ret = dss_max; + else { + ret = (void *)((intptr_t)dss_max + incr); + incr += size; + } + + dss_prev = sbrk(incr); + if (dss_prev == dss_max) { + /* Success. */ + dss_max = (void *)((intptr_t)dss_prev + incr); + malloc_mutex_unlock(&dss_mtx); + *zero = true; + return (ret); + } + } while (dss_prev != (void *)-1); + } + malloc_mutex_unlock(&dss_mtx); + + return (NULL); +} + +static extent_node_t * +chunk_dealloc_dss_record(void *chunk, size_t size) +{ + extent_node_t *xnode, *node, *prev, key; + + xnode = NULL; + while (true) { + key.addr = (void *)((uintptr_t)chunk + size); + node = extent_tree_ad_nsearch(&dss_chunks_ad, &key); + /* Try to coalesce forward. */ + if (node != NULL && node->addr == key.addr) { + /* + * Coalesce chunk with the following address range. + * This does not change the position within + * dss_chunks_ad, so only remove/insert from/into + * dss_chunks_szad. + */ + extent_tree_szad_remove(&dss_chunks_szad, node); + node->addr = chunk; + node->size += size; + extent_tree_szad_insert(&dss_chunks_szad, node); + break; + } else if (xnode == NULL) { + /* + * It is possible that base_node_alloc() will cause a + * new base chunk to be allocated, so take care not to + * deadlock on dss_mtx, and recover if another thread + * deallocates an adjacent chunk while this one is busy + * allocating xnode. + */ + malloc_mutex_unlock(&dss_mtx); + xnode = base_node_alloc(); + malloc_mutex_lock(&dss_mtx); + if (xnode == NULL) + return (NULL); + } else { + /* Coalescing forward failed, so insert a new node. */ + node = xnode; + xnode = NULL; + node->addr = chunk; + node->size = size; + extent_tree_ad_insert(&dss_chunks_ad, node); + extent_tree_szad_insert(&dss_chunks_szad, node); + break; + } + } + /* Discard xnode if it ended up unused do to a race. */ + if (xnode != NULL) + base_node_dealloc(xnode); + + /* Try to coalesce backward. */ + prev = extent_tree_ad_prev(&dss_chunks_ad, node); + if (prev != NULL && (void *)((uintptr_t)prev->addr + prev->size) == + chunk) { + /* + * Coalesce chunk with the previous address range. This does + * not change the position within dss_chunks_ad, so only + * remove/insert node from/into dss_chunks_szad. + */ + extent_tree_szad_remove(&dss_chunks_szad, prev); + extent_tree_ad_remove(&dss_chunks_ad, prev); + + extent_tree_szad_remove(&dss_chunks_szad, node); + node->addr = prev->addr; + node->size += prev->size; + extent_tree_szad_insert(&dss_chunks_szad, node); + + base_node_dealloc(prev); + } + + return (node); +} + +bool +chunk_dealloc_dss(void *chunk, size_t size) +{ + bool ret; + + malloc_mutex_lock(&dss_mtx); + if ((uintptr_t)chunk >= (uintptr_t)dss_base + && (uintptr_t)chunk < (uintptr_t)dss_max) { + extent_node_t *node; + + /* Try to coalesce with other unused chunks. */ + node = chunk_dealloc_dss_record(chunk, size); + if (node != NULL) { + chunk = node->addr; + size = node->size; + } + + /* Get the current end of the DSS. */ + dss_max = sbrk(0); + + /* + * Try to shrink the DSS if this chunk is at the end of the + * DSS. The sbrk() call here is subject to a race condition + * with threads that use brk(2) or sbrk(2) directly, but the + * alternative would be to leak memory for the sake of poorly + * designed multi-threaded programs. + */ + if ((void *)((uintptr_t)chunk + size) == dss_max + && (dss_prev = sbrk(-(intptr_t)size)) == dss_max) { + /* Success. */ + dss_max = (void *)((intptr_t)dss_prev - (intptr_t)size); + + if (node != NULL) { + extent_tree_szad_remove(&dss_chunks_szad, node); + extent_tree_ad_remove(&dss_chunks_ad, node); + base_node_dealloc(node); + } + } else + madvise(chunk, size, MADV_DONTNEED); + + ret = false; + goto RETURN; + } + + ret = true; +RETURN: + malloc_mutex_unlock(&dss_mtx); + return (ret); +} + +bool +chunk_dss_boot(void) +{ + + if (malloc_mutex_init(&dss_mtx)) + return (true); + dss_base = sbrk(0); + dss_prev = dss_base; + dss_max = dss_base; + extent_tree_szad_new(&dss_chunks_szad); + extent_tree_ad_new(&dss_chunks_ad); + + return (false); +} + +/******************************************************************************/ +#endif /* JEMALLOC_DSS */ diff --git a/externals/jemalloc/chunk_mmap.c b/externals/jemalloc/chunk_mmap.c new file mode 100644 index 0000000..8f07113 --- /dev/null +++ b/externals/jemalloc/chunk_mmap.c @@ -0,0 +1,201 @@ +#define JEMALLOC_CHUNK_MMAP_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +/* + * Used by chunk_alloc_mmap() to decide whether to attempt the fast path and + * potentially avoid some system calls. We can get away without TLS here, + * since the state of mmap_unaligned only affects performance, rather than + * correct function. + */ +static +#ifndef NO_TLS + __thread +#endif + bool mmap_unaligned +#ifndef NO_TLS + JEMALLOC_ATTR(tls_model("initial-exec")) +#endif + ; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static void *pages_map(void *addr, size_t size); +static void pages_unmap(void *addr, size_t size); +static void *chunk_alloc_mmap_slow(size_t size, bool unaligned); + +/******************************************************************************/ + +static void * +pages_map(void *addr, size_t size) +{ + void *ret; + + /* + * We don't use MAP_FIXED here, because it can cause the *replacement* + * of existing mappings, and we only want to create new mappings. + */ + ret = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, + -1, 0); + assert(ret != NULL); + + if (ret == MAP_FAILED) + ret = NULL; + else if (addr != NULL && ret != addr) { + /* + * We succeeded in mapping memory, but not in the right place. + */ + if (munmap(ret, size) == -1) { + char buf[STRERROR_BUF]; + + strerror_r(errno, buf, sizeof(buf)); + malloc_write(": Error in munmap(): "); + malloc_write(buf); + malloc_write("\n"); + if (opt_abort) + abort(); + } + ret = NULL; + } + + assert(ret == NULL || (addr == NULL && ret != addr) + || (addr != NULL && ret == addr)); + return (ret); +} + +static void +pages_unmap(void *addr, size_t size) +{ + + if (munmap(addr, size) == -1) { + char buf[STRERROR_BUF]; + + strerror_r(errno, buf, sizeof(buf)); + malloc_write(": Error in munmap(): "); + malloc_write(buf); + malloc_write("\n"); + if (opt_abort) + abort(); + } +} + +static void * +chunk_alloc_mmap_slow(size_t size, bool unaligned) +{ + void *ret; + size_t offset; + + /* Beware size_t wrap-around. */ + if (size + chunksize <= size) + return (NULL); + + ret = pages_map(NULL, size + chunksize); + if (ret == NULL) + return (NULL); + + /* Clean up unneeded leading/trailing space. */ + offset = CHUNK_ADDR2OFFSET(ret); + if (offset != 0) { + /* Note that mmap() returned an unaligned mapping. */ + unaligned = true; + + /* Leading space. */ + pages_unmap(ret, chunksize - offset); + + ret = (void *)((uintptr_t)ret + + (chunksize - offset)); + + /* Trailing space. */ + pages_unmap((void *)((uintptr_t)ret + size), + offset); + } else { + /* Trailing space only. */ + pages_unmap((void *)((uintptr_t)ret + size), + chunksize); + } + + /* + * If mmap() returned an aligned mapping, reset mmap_unaligned so that + * the next chunk_alloc_mmap() execution tries the fast allocation + * method. + */ + if (unaligned == false) + mmap_unaligned = false; + + return (ret); +} + +void * +chunk_alloc_mmap(size_t size) +{ + void *ret; + + /* + * Ideally, there would be a way to specify alignment to mmap() (like + * NetBSD has), but in the absence of such a feature, we have to work + * hard to efficiently create aligned mappings. The reliable, but + * slow method is to create a mapping that is over-sized, then trim the + * excess. However, that always results in at least one call to + * pages_unmap(). + * + * A more optimistic approach is to try mapping precisely the right + * amount, then try to append another mapping if alignment is off. In + * practice, this works out well as long as the application is not + * interleaving mappings via direct mmap() calls. If we do run into a + * situation where there is an interleaved mapping and we are unable to + * extend an unaligned mapping, our best option is to switch to the + * slow method until mmap() returns another aligned mapping. This will + * tend to leave a gap in the memory map that is too small to cause + * later problems for the optimistic method. + * + * Another possible confounding factor is address space layout + * randomization (ASLR), which causes mmap(2) to disregard the + * requested address. mmap_unaligned tracks whether the previous + * chunk_alloc_mmap() execution received any unaligned or relocated + * mappings, and if so, the current execution will immediately fall + * back to the slow method. However, we keep track of whether the fast + * method would have succeeded, and if so, we make a note to try the + * fast method next time. + */ + + if (mmap_unaligned == false) { + size_t offset; + + ret = pages_map(NULL, size); + if (ret == NULL) + return (NULL); + + offset = CHUNK_ADDR2OFFSET(ret); + if (offset != 0) { + mmap_unaligned = true; + /* Try to extend chunk boundary. */ + if (pages_map((void *)((uintptr_t)ret + size), + chunksize - offset) == NULL) { + /* + * Extension failed. Clean up, then revert to + * the reliable-but-expensive method. + */ + pages_unmap(ret, size); + ret = chunk_alloc_mmap_slow(size, true); + } else { + /* Clean up unneeded leading space. */ + pages_unmap(ret, chunksize - offset); + ret = (void *)((uintptr_t)ret + (chunksize - + offset)); + } + } + } else + ret = chunk_alloc_mmap_slow(size, false); + + return (ret); +} + +void +chunk_dealloc_mmap(void *chunk, size_t size) +{ + + pages_unmap(chunk, size); +} diff --git a/externals/jemalloc/chunk_swap.c b/externals/jemalloc/chunk_swap.c new file mode 100644 index 0000000..b8c880f --- /dev/null +++ b/externals/jemalloc/chunk_swap.c @@ -0,0 +1,383 @@ +#define JEMALLOC_CHUNK_SWAP_C_ +#include "jemalloc/internal/jemalloc_internal.h" +#ifdef JEMALLOC_SWAP +/******************************************************************************/ +/* Data. */ + +malloc_mutex_t swap_mtx; +bool swap_enabled; +bool swap_prezeroed; +size_t swap_nfds; +int *swap_fds; +#ifdef JEMALLOC_STATS +size_t swap_avail; +#endif + +/* Base address of the mmap()ed file(s). */ +static void *swap_base; +/* Current end of the space in use (<= swap_max). */ +static void *swap_end; +/* Absolute upper limit on file-backed addresses. */ +static void *swap_max; + +/* + * Trees of chunks that were previously allocated (trees differ only in node + * ordering). These are used when allocating chunks, in an attempt to re-use + * address space. Depending on function, different tree orderings are needed, + * which is why there are two trees with the same contents. + */ +static extent_tree_t swap_chunks_szad; +static extent_tree_t swap_chunks_ad; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static void *chunk_recycle_swap(size_t size, bool *zero); +static extent_node_t *chunk_dealloc_swap_record(void *chunk, size_t size); + +/******************************************************************************/ + +static void * +chunk_recycle_swap(size_t size, bool *zero) +{ + extent_node_t *node, key; + + key.addr = NULL; + key.size = size; + malloc_mutex_lock(&swap_mtx); + node = extent_tree_szad_nsearch(&swap_chunks_szad, &key); + if (node != NULL) { + void *ret = node->addr; + + /* Remove node from the tree. */ + extent_tree_szad_remove(&swap_chunks_szad, node); + if (node->size == size) { + extent_tree_ad_remove(&swap_chunks_ad, node); + base_node_dealloc(node); + } else { + /* + * Insert the remainder of node's address range as a + * smaller chunk. Its position within swap_chunks_ad + * does not change. + */ + assert(node->size > size); + node->addr = (void *)((uintptr_t)node->addr + size); + node->size -= size; + extent_tree_szad_insert(&swap_chunks_szad, node); + } +#ifdef JEMALLOC_STATS + swap_avail -= size; +#endif + malloc_mutex_unlock(&swap_mtx); + + if (*zero) + memset(ret, 0, size); + return (ret); + } + malloc_mutex_unlock(&swap_mtx); + + return (NULL); +} + +void * +chunk_alloc_swap(size_t size, bool *zero) +{ + void *ret; + + assert(swap_enabled); + + ret = chunk_recycle_swap(size, zero); + if (ret != NULL) + return (ret); + + malloc_mutex_lock(&swap_mtx); + if ((uintptr_t)swap_end + size <= (uintptr_t)swap_max) { + ret = swap_end; + swap_end = (void *)((uintptr_t)swap_end + size); +#ifdef JEMALLOC_STATS + swap_avail -= size; +#endif + malloc_mutex_unlock(&swap_mtx); + + if (swap_prezeroed) + *zero = true; + else if (*zero) + memset(ret, 0, size); + } else { + malloc_mutex_unlock(&swap_mtx); + return (NULL); + } + + return (ret); +} + +static extent_node_t * +chunk_dealloc_swap_record(void *chunk, size_t size) +{ + extent_node_t *xnode, *node, *prev, key; + + xnode = NULL; + while (true) { + key.addr = (void *)((uintptr_t)chunk + size); + node = extent_tree_ad_nsearch(&swap_chunks_ad, &key); + /* Try to coalesce forward. */ + if (node != NULL && node->addr == key.addr) { + /* + * Coalesce chunk with the following address range. + * This does not change the position within + * swap_chunks_ad, so only remove/insert from/into + * swap_chunks_szad. + */ + extent_tree_szad_remove(&swap_chunks_szad, node); + node->addr = chunk; + node->size += size; + extent_tree_szad_insert(&swap_chunks_szad, node); + break; + } else if (xnode == NULL) { + /* + * It is possible that base_node_alloc() will cause a + * new base chunk to be allocated, so take care not to + * deadlock on swap_mtx, and recover if another thread + * deallocates an adjacent chunk while this one is busy + * allocating xnode. + */ + malloc_mutex_unlock(&swap_mtx); + xnode = base_node_alloc(); + malloc_mutex_lock(&swap_mtx); + if (xnode == NULL) + return (NULL); + } else { + /* Coalescing forward failed, so insert a new node. */ + node = xnode; + xnode = NULL; + node->addr = chunk; + node->size = size; + extent_tree_ad_insert(&swap_chunks_ad, node); + extent_tree_szad_insert(&swap_chunks_szad, node); + break; + } + } + /* Discard xnode if it ended up unused do to a race. */ + if (xnode != NULL) + base_node_dealloc(xnode); + + /* Try to coalesce backward. */ + prev = extent_tree_ad_prev(&swap_chunks_ad, node); + if (prev != NULL && (void *)((uintptr_t)prev->addr + prev->size) == + chunk) { + /* + * Coalesce chunk with the previous address range. This does + * not change the position within swap_chunks_ad, so only + * remove/insert node from/into swap_chunks_szad. + */ + extent_tree_szad_remove(&swap_chunks_szad, prev); + extent_tree_ad_remove(&swap_chunks_ad, prev); + + extent_tree_szad_remove(&swap_chunks_szad, node); + node->addr = prev->addr; + node->size += prev->size; + extent_tree_szad_insert(&swap_chunks_szad, node); + + base_node_dealloc(prev); + } + + return (node); +} + +bool +chunk_dealloc_swap(void *chunk, size_t size) +{ + bool ret; + + assert(swap_enabled); + + malloc_mutex_lock(&swap_mtx); + if ((uintptr_t)chunk >= (uintptr_t)swap_base + && (uintptr_t)chunk < (uintptr_t)swap_max) { + extent_node_t *node; + + /* Try to coalesce with other unused chunks. */ + node = chunk_dealloc_swap_record(chunk, size); + if (node != NULL) { + chunk = node->addr; + size = node->size; + } + + /* + * Try to shrink the in-use memory if this chunk is at the end + * of the in-use memory. + */ + if ((void *)((uintptr_t)chunk + size) == swap_end) { + swap_end = (void *)((uintptr_t)swap_end - size); + + if (node != NULL) { + extent_tree_szad_remove(&swap_chunks_szad, + node); + extent_tree_ad_remove(&swap_chunks_ad, node); + base_node_dealloc(node); + } + } else + madvise(chunk, size, MADV_DONTNEED); + + ret = false; + goto RETURN; + } + + ret = true; +RETURN: +#ifdef JEMALLOC_STATS + swap_avail += size; +#endif + malloc_mutex_unlock(&swap_mtx); + return (ret); +} + +bool +chunk_swap_enable(const int *fds, unsigned nfds, bool prezeroed) +{ + bool ret; + unsigned i; + off_t off; + void *vaddr; + size_t cumsize, voff; + size_t sizes[nfds]; + + malloc_mutex_lock(&swap_mtx); + + /* Get file sizes. */ + for (i = 0, cumsize = 0; i < nfds; i++) { + off = lseek(fds[i], 0, SEEK_END); + if (off == ((off_t)-1)) { + ret = true; + goto RETURN; + } + if (PAGE_CEILING(off) != off) { + /* Truncate to a multiple of the page size. */ + off &= ~PAGE_MASK; + if (ftruncate(fds[i], off) != 0) { + ret = true; + goto RETURN; + } + } + sizes[i] = off; + if (cumsize + off < cumsize) { + /* + * Cumulative file size is greater than the total + * address space. Bail out while it's still obvious + * what the problem is. + */ + ret = true; + goto RETURN; + } + cumsize += off; + } + + /* Round down to a multiple of the chunk size. */ + cumsize &= ~chunksize_mask; + if (cumsize == 0) { + ret = true; + goto RETURN; + } + + /* + * Allocate a chunk-aligned region of anonymous memory, which will + * be the final location for the memory-mapped files. + */ + vaddr = chunk_alloc_mmap(cumsize); + if (vaddr == NULL) { + ret = true; + goto RETURN; + } + + /* Overlay the files onto the anonymous mapping. */ + for (i = 0, voff = 0; i < nfds; i++) { + void *addr = mmap((void *)((uintptr_t)vaddr + voff), sizes[i], + PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fds[i], 0); + if (addr == MAP_FAILED) { + char buf[STRERROR_BUF]; + + strerror_r(errno, buf, sizeof(buf)); + malloc_write( + ": Error in mmap(..., MAP_FIXED, ...): "); + malloc_write(buf); + malloc_write("\n"); + if (opt_abort) + abort(); + if (munmap(vaddr, voff) == -1) { + strerror_r(errno, buf, sizeof(buf)); + malloc_write(": Error in munmap(): "); + malloc_write(buf); + malloc_write("\n"); + } + ret = true; + goto RETURN; + } + assert(addr == (void *)((uintptr_t)vaddr + voff)); + + /* + * Tell the kernel that the mapping will be accessed randomly, + * and that it should not gratuitously sync pages to the + * filesystem. + */ +#ifdef MADV_RANDOM + madvise(addr, sizes[i], MADV_RANDOM); +#endif +#ifdef MADV_NOSYNC + madvise(addr, sizes[i], MADV_NOSYNC); +#endif + + voff += sizes[i]; + } + + swap_prezeroed = prezeroed; + swap_base = vaddr; + swap_end = swap_base; + swap_max = (void *)((uintptr_t)vaddr + cumsize); + + /* Copy the fds array for mallctl purposes. */ + swap_fds = (int *)base_alloc(nfds * sizeof(int)); + if (swap_fds == NULL) { + ret = true; + goto RETURN; + } + memcpy(swap_fds, fds, nfds * sizeof(int)); + swap_nfds = nfds; + +#ifdef JEMALLOC_STATS + swap_avail = cumsize; +#endif + + swap_enabled = true; + + ret = false; +RETURN: + malloc_mutex_unlock(&swap_mtx); + return (ret); +} + +bool +chunk_swap_boot(void) +{ + + if (malloc_mutex_init(&swap_mtx)) + return (true); + + swap_enabled = false; + swap_prezeroed = false; /* swap.* mallctl's depend on this. */ + swap_nfds = 0; + swap_fds = NULL; +#ifdef JEMALLOC_STATS + swap_avail = 0; +#endif + swap_base = NULL; + swap_end = NULL; + swap_max = NULL; + + extent_tree_szad_new(&swap_chunks_szad); + extent_tree_ad_new(&swap_chunks_ad); + + return (false); +} + +/******************************************************************************/ +#endif /* JEMALLOC_SWAP */ diff --git a/externals/jemalloc/ckh.c b/externals/jemalloc/ckh.c new file mode 100644 index 0000000..a0c4162 --- /dev/null +++ b/externals/jemalloc/ckh.c @@ -0,0 +1,601 @@ +/* + ******************************************************************************* + * Implementation of (2^1+,2) cuckoo hashing, where 2^1+ indicates that each + * hash bucket contains 2^n cells, for n >= 1, and 2 indicates that two hash + * functions are employed. The original cuckoo hashing algorithm was described + * in: + * + * Pagh, R., F.F. Rodler (2004) Cuckoo Hashing. Journal of Algorithms + * 51(2):122-144. + * + * Generalization of cuckoo hashing was discussed in: + * + * Erlingsson, U., M. Manasse, F. McSherry (2006) A cool and practical + * alternative to traditional hash tables. In Proceedings of the 7th + * Workshop on Distributed Data and Structures (WDAS'06), Santa Clara, CA, + * January 2006. + * + * This implementation uses precisely two hash functions because that is the + * fewest that can work, and supporting multiple hashes is an implementation + * burden. Here is a reproduction of Figure 1 from Erlingsson et al. (2006) + * that shows approximate expected maximum load factors for various + * configurations: + * + * | #cells/bucket | + * #hashes | 1 | 2 | 4 | 8 | + * --------+-------+-------+-------+-------+ + * 1 | 0.006 | 0.006 | 0.03 | 0.12 | + * 2 | 0.49 | 0.86 |>0.93< |>0.96< | + * 3 | 0.91 | 0.97 | 0.98 | 0.999 | + * 4 | 0.97 | 0.99 | 0.999 | | + * + * The number of cells per bucket is chosen such that a bucket fits in one cache + * line. So, on 32- and 64-bit systems, we use (8,2) and (4,2) cuckoo hashing, + * respectively. + * + ******************************************************************************/ +#define CKH_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static bool ckh_grow(ckh_t *ckh); +static void ckh_shrink(ckh_t *ckh); + +/******************************************************************************/ + +/* + * Search bucket for key and return the cell number if found; SIZE_T_MAX + * otherwise. + */ +JEMALLOC_INLINE size_t +ckh_bucket_search(ckh_t *ckh, size_t bucket, const void *key) +{ + ckhc_t *cell; + unsigned i; + + for (i = 0; i < (ZU(1) << LG_CKH_BUCKET_CELLS); i++) { + cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + i]; + if (cell->key != NULL && ckh->keycomp(key, cell->key)) + return ((bucket << LG_CKH_BUCKET_CELLS) + i); + } + + return (SIZE_T_MAX); +} + +/* + * Search table for key and return cell number if found; SIZE_T_MAX otherwise. + */ +JEMALLOC_INLINE size_t +ckh_isearch(ckh_t *ckh, const void *key) +{ + size_t hash1, hash2, bucket, cell; + + assert(ckh != NULL); + assert(ckh->magic = CKH_MAGIG); + + ckh->hash(key, ckh->lg_curbuckets, &hash1, &hash2); + + /* Search primary bucket. */ + bucket = hash1 & ((ZU(1) << ckh->lg_curbuckets) - 1); + cell = ckh_bucket_search(ckh, bucket, key); + if (cell != SIZE_T_MAX) + return (cell); + + /* Search secondary bucket. */ + bucket = hash2 & ((ZU(1) << ckh->lg_curbuckets) - 1); + cell = ckh_bucket_search(ckh, bucket, key); + return (cell); +} + +JEMALLOC_INLINE bool +ckh_try_bucket_insert(ckh_t *ckh, size_t bucket, const void *key, + const void *data) +{ + ckhc_t *cell; + unsigned offset, i; + + /* + * Cycle through the cells in the bucket, starting at a random position. + * The randomness avoids worst-case search overhead as buckets fill up. + */ + prn32(offset, LG_CKH_BUCKET_CELLS, ckh->prn_state, CKH_A, CKH_C); + for (i = 0; i < (ZU(1) << LG_CKH_BUCKET_CELLS); i++) { + cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + + ((i + offset) & ((ZU(1) << LG_CKH_BUCKET_CELLS) - 1))]; + if (cell->key == NULL) { + cell->key = key; + cell->data = data; + ckh->count++; + return (false); + } + } + + return (true); +} + +/* + * No space is available in bucket. Randomly evict an item, then try to find an + * alternate location for that item. Iteratively repeat this + * eviction/relocation procedure until either success or detection of an + * eviction/relocation bucket cycle. + */ +JEMALLOC_INLINE bool +ckh_evict_reloc_insert(ckh_t *ckh, size_t argbucket, void const **argkey, + void const **argdata) +{ + const void *key, *data, *tkey, *tdata; + ckhc_t *cell; + size_t hash1, hash2, bucket, tbucket; + unsigned i; + + bucket = argbucket; + key = *argkey; + data = *argdata; + while (true) { + /* + * Choose a random item within the bucket to evict. This is + * critical to correct function, because without (eventually) + * evicting all items within a bucket during iteration, it + * would be possible to get stuck in an infinite loop if there + * were an item for which both hashes indicated the same + * bucket. + */ + prn32(i, LG_CKH_BUCKET_CELLS, ckh->prn_state, CKH_A, CKH_C); + cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + i]; + assert(cell->key != NULL); + + /* Swap cell->{key,data} and {key,data} (evict). */ + tkey = cell->key; tdata = cell->data; + cell->key = key; cell->data = data; + key = tkey; data = tdata; + +#ifdef CKH_COUNT + ckh->nrelocs++; +#endif + + /* Find the alternate bucket for the evicted item. */ + ckh->hash(key, ckh->lg_curbuckets, &hash1, &hash2); + tbucket = hash2 & ((ZU(1) << ckh->lg_curbuckets) - 1); + if (tbucket == bucket) { + tbucket = hash1 & ((ZU(1) << ckh->lg_curbuckets) - 1); + /* + * It may be that (tbucket == bucket) still, if the + * item's hashes both indicate this bucket. However, + * we are guaranteed to eventually escape this bucket + * during iteration, assuming pseudo-random item + * selection (true randomness would make infinite + * looping a remote possibility). The reason we can + * never get trapped forever is that there are two + * cases: + * + * 1) This bucket == argbucket, so we will quickly + * detect an eviction cycle and terminate. + * 2) An item was evicted to this bucket from another, + * which means that at least one item in this bucket + * has hashes that indicate distinct buckets. + */ + } + /* Check for a cycle. */ + if (tbucket == argbucket) { + *argkey = key; + *argdata = data; + return (true); + } + + bucket = tbucket; + if (ckh_try_bucket_insert(ckh, bucket, key, data) == false) + return (false); + } +} + +JEMALLOC_INLINE bool +ckh_try_insert(ckh_t *ckh, void const**argkey, void const**argdata) +{ + size_t hash1, hash2, bucket; + const void *key = *argkey; + const void *data = *argdata; + + ckh->hash(key, ckh->lg_curbuckets, &hash1, &hash2); + + /* Try to insert in primary bucket. */ + bucket = hash1 & ((ZU(1) << ckh->lg_curbuckets) - 1); + if (ckh_try_bucket_insert(ckh, bucket, key, data) == false) + return (false); + + /* Try to insert in secondary bucket. */ + bucket = hash2 & ((ZU(1) << ckh->lg_curbuckets) - 1); + if (ckh_try_bucket_insert(ckh, bucket, key, data) == false) + return (false); + + /* + * Try to find a place for this item via iterative eviction/relocation. + */ + return (ckh_evict_reloc_insert(ckh, bucket, argkey, argdata)); +} + +/* + * Try to rebuild the hash table from scratch by inserting all items from the + * old table into the new. + */ +JEMALLOC_INLINE bool +ckh_rebuild(ckh_t *ckh, ckhc_t *aTab) +{ + size_t count, i, nins; + const void *key, *data; + + count = ckh->count; + ckh->count = 0; + for (i = nins = 0; nins < count; i++) { + if (aTab[i].key != NULL) { + key = aTab[i].key; + data = aTab[i].data; + if (ckh_try_insert(ckh, &key, &data)) { + ckh->count = count; + return (true); + } + nins++; + } + } + + return (false); +} + +static bool +ckh_grow(ckh_t *ckh) +{ + bool ret; + ckhc_t *tab, *ttab; + size_t lg_curcells; + unsigned lg_prevbuckets; + +#ifdef CKH_COUNT + ckh->ngrows++; +#endif + + /* + * It is possible (though unlikely, given well behaved hashes) that the + * table will have to be doubled more than once in order to create a + * usable table. + */ + lg_prevbuckets = ckh->lg_curbuckets; + lg_curcells = ckh->lg_curbuckets + LG_CKH_BUCKET_CELLS; + while (true) { + lg_curcells++; + tab = (ckhc_t *) ipalloc((ZU(1) << LG_CACHELINE), + sizeof(ckhc_t) << lg_curcells); + if (tab == NULL) { + ret = true; + goto RETURN; + } + memset(tab, 0, sizeof(ckhc_t) << lg_curcells); + /* Swap in new table. */ + ttab = ckh->tab; + ckh->tab = tab; + tab = ttab; + ckh->lg_curbuckets = lg_curcells - LG_CKH_BUCKET_CELLS; + + if (ckh_rebuild(ckh, tab) == false) { + idalloc(tab); + break; + } + + /* Rebuilding failed, so back out partially rebuilt table. */ + idalloc(ckh->tab); + ckh->tab = tab; + ckh->lg_curbuckets = lg_prevbuckets; + } + + ret = false; +RETURN: + return (ret); +} + +static void +ckh_shrink(ckh_t *ckh) +{ + ckhc_t *tab, *ttab; + size_t lg_curcells; + unsigned lg_prevbuckets; + + /* + * It is possible (though unlikely, given well behaved hashes) that the + * table rebuild will fail. + */ + lg_prevbuckets = ckh->lg_curbuckets; + lg_curcells = ckh->lg_curbuckets + LG_CKH_BUCKET_CELLS - 1; + tab = (ckhc_t *)ipalloc((ZU(1) << LG_CACHELINE), + sizeof(ckhc_t) << lg_curcells); + if (tab == NULL) { + /* + * An OOM error isn't worth propagating, since it doesn't + * prevent this or future operations from proceeding. + */ + return; + } + memset(tab, 0, sizeof(ckhc_t) << lg_curcells); + /* Swap in new table. */ + ttab = ckh->tab; + ckh->tab = tab; + tab = ttab; + ckh->lg_curbuckets = lg_curcells - LG_CKH_BUCKET_CELLS; + + if (ckh_rebuild(ckh, tab) == false) { + idalloc(tab); +#ifdef CKH_COUNT + ckh->nshrinks++; +#endif + return; + } + + /* Rebuilding failed, so back out partially rebuilt table. */ + idalloc(ckh->tab); + ckh->tab = tab; + ckh->lg_curbuckets = lg_prevbuckets; +#ifdef CKH_COUNT + ckh->nshrinkfails++; +#endif +} + +bool +ckh_new(ckh_t *ckh, size_t minitems, ckh_hash_t *hash, ckh_keycomp_t *keycomp) +{ + bool ret; + size_t mincells; + unsigned lg_mincells; + + assert(minitems > 0); + assert(hash != NULL); + assert(keycomp != NULL); + +#ifdef CKH_COUNT + ckh->ngrows = 0; + ckh->nshrinks = 0; + ckh->nshrinkfails = 0; + ckh->ninserts = 0; + ckh->nrelocs = 0; +#endif + ckh->prn_state = 42; /* Value doesn't really matter. */ + ckh->count = 0; + + /* + * Find the minimum power of 2 that is large enough to fit aBaseCount + * entries. We are using (2+,2) cuckoo hashing, which has an expected + * maximum load factor of at least ~0.86, so 0.75 is a conservative load + * factor that will typically allow 2^aLgMinItems to fit without ever + * growing the table. + */ + assert(LG_CKH_BUCKET_CELLS > 0); + mincells = ((minitems + (3 - (minitems % 3))) / 3) << 2; + for (lg_mincells = LG_CKH_BUCKET_CELLS; + (ZU(1) << lg_mincells) < mincells; + lg_mincells++) + ; /* Do nothing. */ + ckh->lg_minbuckets = lg_mincells - LG_CKH_BUCKET_CELLS; + ckh->lg_curbuckets = lg_mincells - LG_CKH_BUCKET_CELLS; + ckh->hash = hash; + ckh->keycomp = keycomp; + + ckh->tab = (ckhc_t *)ipalloc((ZU(1) << LG_CACHELINE), + sizeof(ckhc_t) << lg_mincells); + if (ckh->tab == NULL) { + ret = true; + goto RETURN; + } + memset(ckh->tab, 0, sizeof(ckhc_t) << lg_mincells); + +#ifdef JEMALLOC_DEBUG + ckh->magic = CKH_MAGIG; +#endif + + ret = false; +RETURN: + return (ret); +} + +void +ckh_delete(ckh_t *ckh) +{ + + assert(ckh != NULL); + assert(ckh->magic = CKH_MAGIG); + +#ifdef CKH_VERBOSE + malloc_printf( + "%s(%p): ngrows: %"PRIu64", nshrinks: %"PRIu64"," + " nshrinkfails: %"PRIu64", ninserts: %"PRIu64"," + " nrelocs: %"PRIu64"\n", __func__, ckh, + (unsigned long long)ckh->ngrows, + (unsigned long long)ckh->nshrinks, + (unsigned long long)ckh->nshrinkfails, + (unsigned long long)ckh->ninserts, + (unsigned long long)ckh->nrelocs); +#endif + + idalloc(ckh->tab); +#ifdef JEMALLOC_DEBUG + memset(ckh, 0x5a, sizeof(ckh_t)); +#endif +} + +size_t +ckh_count(ckh_t *ckh) +{ + + assert(ckh != NULL); + assert(ckh->magic = CKH_MAGIG); + + return (ckh->count); +} + +bool +ckh_iter(ckh_t *ckh, size_t *tabind, void **key, void **data) +{ + size_t i, ncells; + + for (i = *tabind, ncells = (ZU(1) << (ckh->lg_curbuckets + + LG_CKH_BUCKET_CELLS)); i < ncells; i++) { + if (ckh->tab[i].key != NULL) { + if (key != NULL) + *key = (void *)ckh->tab[i].key; + if (data != NULL) + *data = (void *)ckh->tab[i].data; + *tabind = i + 1; + return (false); + } + } + + return (true); +} + +bool +ckh_insert(ckh_t *ckh, const void *key, const void *data) +{ + bool ret; + + assert(ckh != NULL); + assert(ckh->magic = CKH_MAGIG); + assert(ckh_search(ckh, key, NULL, NULL)); + +#ifdef CKH_COUNT + ckh->ninserts++; +#endif + + while (ckh_try_insert(ckh, &key, &data)) { + if (ckh_grow(ckh)) { + ret = true; + goto RETURN; + } + } + + ret = false; +RETURN: + return (ret); +} + +bool +ckh_remove(ckh_t *ckh, const void *searchkey, void **key, void **data) +{ + size_t cell; + + assert(ckh != NULL); + assert(ckh->magic = CKH_MAGIG); + + cell = ckh_isearch(ckh, searchkey); + if (cell != SIZE_T_MAX) { + if (key != NULL) + *key = (void *)ckh->tab[cell].key; + if (data != NULL) + *data = (void *)ckh->tab[cell].data; + ckh->tab[cell].key = NULL; + ckh->tab[cell].data = NULL; /* Not necessary. */ + + ckh->count--; + /* Try to halve the table if it is less than 1/4 full. */ + if (ckh->count < (ZU(1) << (ckh->lg_curbuckets + + LG_CKH_BUCKET_CELLS - 2)) && ckh->lg_curbuckets + > ckh->lg_minbuckets) { + /* Ignore error due to OOM. */ + ckh_shrink(ckh); + } + + return (false); + } + + return (true); +} + +bool +ckh_search(ckh_t *ckh, const void *searchkey, void **key, void **data) +{ + size_t cell; + + assert(ckh != NULL); + assert(ckh->magic = CKH_MAGIG); + + cell = ckh_isearch(ckh, searchkey); + if (cell != SIZE_T_MAX) { + if (key != NULL) + *key = (void *)ckh->tab[cell].key; + if (data != NULL) + *data = (void *)ckh->tab[cell].data; + return (false); + } + + return (true); +} + +void +ckh_string_hash(const void *key, unsigned minbits, size_t *hash1, size_t *hash2) +{ + size_t ret1, ret2; + uint64_t h; + + assert(minbits <= 32 || (SIZEOF_PTR == 8 && minbits <= 64)); + assert(hash1 != NULL); + assert(hash2 != NULL); + + h = hash(key, strlen((const char *)key), 0x94122f335b332aeaLLU); + if (minbits <= 32) { + /* + * Avoid doing multiple hashes, since a single hash provides + * enough bits. + */ + ret1 = h & ZU(0xffffffffU); + ret2 = h >> 32; + } else { + ret1 = h; + ret2 = hash(key, strlen((const char *)key), + 0x8432a476666bbc13U); + } + + *hash1 = ret1; + *hash2 = ret2; +} + +bool +ckh_string_keycomp(const void *k1, const void *k2) +{ + + assert(k1 != NULL); + assert(k2 != NULL); + + return (strcmp((char *)k1, (char *)k2) ? false : true); +} + +void +ckh_pointer_hash(const void *key, unsigned minbits, size_t *hash1, + size_t *hash2) +{ + size_t ret1, ret2; + uint64_t h; + + assert(minbits <= 32 || (SIZEOF_PTR == 8 && minbits <= 64)); + assert(hash1 != NULL); + assert(hash2 != NULL); + + h = hash(&key, sizeof(void *), 0xd983396e68886082LLU); + if (minbits <= 32) { + /* + * Avoid doing multiple hashes, since a single hash provides + * enough bits. + */ + ret1 = h & ZU(0xffffffffU); + ret2 = h >> 32; + } else { + assert(SIZEOF_PTR == 8); + ret1 = h; + ret2 = hash(&key, sizeof(void *), 0x5e2be9aff8709a5dLLU); + } + + *hash1 = ret1; + *hash2 = ret2; +} + +bool +ckh_pointer_keycomp(const void *k1, const void *k2) +{ + + return ((k1 == k2) ? true : false); +} diff --git a/externals/jemalloc/ctl.c b/externals/jemalloc/ctl.c new file mode 100644 index 0000000..ffb732d --- /dev/null +++ b/externals/jemalloc/ctl.c @@ -0,0 +1,1482 @@ +#define JEMALLOC_CTL_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +static malloc_mutex_t ctl_mtx; +static bool ctl_initialized; +static uint64_t ctl_epoch; +static ctl_stats_t ctl_stats; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +#define CTL_PROTO(n) \ +static int n##_ctl(const size_t *mib, size_t miblen, void *oldp, \ + size_t *oldlenp, void *newp, size_t newlen); + +#define INDEX_PROTO(n) \ +const ctl_node_t *n##_index(const size_t *mib, size_t miblen, \ + size_t i); + +#ifdef JEMALLOC_STATS +static bool ctl_arena_init(ctl_arena_stats_t *astats); +#endif +static void ctl_arena_clear(ctl_arena_stats_t *astats); +#ifdef JEMALLOC_STATS +static void ctl_arena_stats_amerge(ctl_arena_stats_t *cstats, + arena_t *arena); +static void ctl_arena_stats_smerge(ctl_arena_stats_t *sstats, + ctl_arena_stats_t *astats); +#endif +static void ctl_arena_refresh(arena_t *arena, unsigned i); +static void ctl_refresh(void); +static bool ctl_init(void); +static int ctl_lookup(const char *name, ctl_node_t const **nodesp, + size_t *mibp, size_t *depthp); + +CTL_PROTO(version) +CTL_PROTO(epoch) +#ifdef JEMALLOC_TCACHE +CTL_PROTO(tcache_flush) +#endif +CTL_PROTO(config_debug) +CTL_PROTO(config_dss) +CTL_PROTO(config_dynamic_page_shift) +CTL_PROTO(config_fill) +CTL_PROTO(config_lazy_lock) +CTL_PROTO(config_prof) +CTL_PROTO(config_prof_libgcc) +CTL_PROTO(config_prof_libunwind) +CTL_PROTO(config_stats) +CTL_PROTO(config_swap) +CTL_PROTO(config_sysv) +CTL_PROTO(config_tcache) +CTL_PROTO(config_tiny) +CTL_PROTO(config_tls) +CTL_PROTO(config_xmalloc) +CTL_PROTO(opt_abort) +#ifdef JEMALLOC_FILL +CTL_PROTO(opt_junk) +#endif +#ifdef JEMALLOC_SYSV +CTL_PROTO(opt_sysv) +#endif +#ifdef JEMALLOC_XMALLOC +CTL_PROTO(opt_xmalloc) +#endif +#ifdef JEMALLOC_ZERO +CTL_PROTO(opt_zero) +#endif +#ifdef JEMALLOC_TCACHE +CTL_PROTO(opt_tcache) +CTL_PROTO(opt_lg_tcache_gc_sweep) +#endif +#ifdef JEMALLOC_PROF +CTL_PROTO(opt_prof) +CTL_PROTO(opt_prof_active) +CTL_PROTO(opt_lg_prof_bt_max) +CTL_PROTO(opt_lg_prof_sample) +CTL_PROTO(opt_lg_prof_interval) +CTL_PROTO(opt_prof_udump) +CTL_PROTO(opt_prof_leak) +#endif +CTL_PROTO(opt_stats_print) +CTL_PROTO(opt_lg_qspace_max) +CTL_PROTO(opt_lg_cspace_max) +CTL_PROTO(opt_lg_dirty_mult) +CTL_PROTO(opt_lg_chunk) +#ifdef JEMALLOC_SWAP +CTL_PROTO(opt_overcommit) +#endif +CTL_PROTO(arenas_bin_i_size) +CTL_PROTO(arenas_bin_i_nregs) +CTL_PROTO(arenas_bin_i_run_size) +INDEX_PROTO(arenas_bin_i) +CTL_PROTO(arenas_lrun_i_size) +INDEX_PROTO(arenas_lrun_i) +CTL_PROTO(arenas_narenas) +CTL_PROTO(arenas_initialized) +CTL_PROTO(arenas_quantum) +CTL_PROTO(arenas_cacheline) +CTL_PROTO(arenas_subpage) +CTL_PROTO(arenas_pagesize) +CTL_PROTO(arenas_chunksize) +#ifdef JEMALLOC_TINY +CTL_PROTO(arenas_tspace_min) +CTL_PROTO(arenas_tspace_max) +#endif +CTL_PROTO(arenas_qspace_min) +CTL_PROTO(arenas_qspace_max) +CTL_PROTO(arenas_cspace_min) +CTL_PROTO(arenas_cspace_max) +CTL_PROTO(arenas_sspace_min) +CTL_PROTO(arenas_sspace_max) +#ifdef JEMALLOC_TCACHE +CTL_PROTO(arenas_tcache_max) +#endif +CTL_PROTO(arenas_ntbins) +CTL_PROTO(arenas_nqbins) +CTL_PROTO(arenas_ncbins) +CTL_PROTO(arenas_nsbins) +CTL_PROTO(arenas_nbins) +#ifdef JEMALLOC_TCACHE +CTL_PROTO(arenas_nhbins) +#endif +CTL_PROTO(arenas_nlruns) +#ifdef JEMALLOC_PROF +CTL_PROTO(prof_active) +CTL_PROTO(prof_dump) +CTL_PROTO(prof_interval) +#endif +#ifdef JEMALLOC_STATS +CTL_PROTO(stats_chunks_current) +CTL_PROTO(stats_chunks_total) +CTL_PROTO(stats_chunks_high) +CTL_PROTO(stats_huge_allocated) +CTL_PROTO(stats_huge_nmalloc) +CTL_PROTO(stats_huge_ndalloc) +CTL_PROTO(stats_arenas_i_small_allocated) +CTL_PROTO(stats_arenas_i_small_nmalloc) +CTL_PROTO(stats_arenas_i_small_ndalloc) +CTL_PROTO(stats_arenas_i_small_nrequests) +CTL_PROTO(stats_arenas_i_large_allocated) +CTL_PROTO(stats_arenas_i_large_nmalloc) +CTL_PROTO(stats_arenas_i_large_ndalloc) +CTL_PROTO(stats_arenas_i_large_nrequests) +CTL_PROTO(stats_arenas_i_bins_j_allocated) +CTL_PROTO(stats_arenas_i_bins_j_nmalloc) +CTL_PROTO(stats_arenas_i_bins_j_ndalloc) +CTL_PROTO(stats_arenas_i_bins_j_nrequests) +#ifdef JEMALLOC_TCACHE +CTL_PROTO(stats_arenas_i_bins_j_nfills) +CTL_PROTO(stats_arenas_i_bins_j_nflushes) +#endif +CTL_PROTO(stats_arenas_i_bins_j_nruns) +CTL_PROTO(stats_arenas_i_bins_j_nreruns) +CTL_PROTO(stats_arenas_i_bins_j_highruns) +CTL_PROTO(stats_arenas_i_bins_j_curruns) +INDEX_PROTO(stats_arenas_i_bins_j) +CTL_PROTO(stats_arenas_i_lruns_j_nmalloc) +CTL_PROTO(stats_arenas_i_lruns_j_ndalloc) +CTL_PROTO(stats_arenas_i_lruns_j_nrequests) +CTL_PROTO(stats_arenas_i_lruns_j_highruns) +CTL_PROTO(stats_arenas_i_lruns_j_curruns) +INDEX_PROTO(stats_arenas_i_lruns_j) +#endif +CTL_PROTO(stats_arenas_i_pactive) +CTL_PROTO(stats_arenas_i_pdirty) +#ifdef JEMALLOC_STATS +CTL_PROTO(stats_arenas_i_mapped) +CTL_PROTO(stats_arenas_i_npurge) +CTL_PROTO(stats_arenas_i_nmadvise) +CTL_PROTO(stats_arenas_i_purged) +#endif +INDEX_PROTO(stats_arenas_i) +#ifdef JEMALLOC_STATS +CTL_PROTO(stats_allocated) +CTL_PROTO(stats_active) +CTL_PROTO(stats_mapped) +#endif +#ifdef JEMALLOC_SWAP +# ifdef JEMALLOC_STATS +CTL_PROTO(swap_avail) +# endif +CTL_PROTO(swap_prezeroed) +CTL_PROTO(swap_nfds) +CTL_PROTO(swap_fds) +#endif + +/******************************************************************************/ +/* mallctl tree. */ + +/* Maximum tree depth. */ +#define CTL_MAX_DEPTH 6 + +#define NAME(n) true, {.named = {n +#define CHILD(c) sizeof(c##_node) / sizeof(ctl_node_t), c##_node}}, NULL +#define CTL(c) 0, NULL}}, c##_ctl + +/* + * Only handles internal indexed nodes, since there are currently no external + * ones. + */ +#define INDEX(i) false, {.indexed = {i##_index}}, NULL + +#ifdef JEMALLOC_TCACHE +static const ctl_node_t tcache_node[] = { + {NAME("flush"), CTL(tcache_flush)} +}; +#endif + +static const ctl_node_t config_node[] = { + {NAME("debug"), CTL(config_debug)}, + {NAME("dss"), CTL(config_dss)}, + {NAME("dynamic_page_shift"), CTL(config_dynamic_page_shift)}, + {NAME("fill"), CTL(config_fill)}, + {NAME("lazy_lock"), CTL(config_lazy_lock)}, + {NAME("prof"), CTL(config_prof)}, + {NAME("prof_libgcc"), CTL(config_prof_libgcc)}, + {NAME("prof_libunwind"), CTL(config_prof_libunwind)}, + {NAME("stats"), CTL(config_stats)}, + {NAME("swap"), CTL(config_swap)}, + {NAME("sysv"), CTL(config_sysv)}, + {NAME("tcache"), CTL(config_tcache)}, + {NAME("tiny"), CTL(config_tiny)}, + {NAME("tls"), CTL(config_tls)}, + {NAME("xmalloc"), CTL(config_xmalloc)} +}; + +static const ctl_node_t opt_node[] = { + {NAME("abort"), CTL(opt_abort)}, +#ifdef JEMALLOC_FILL + {NAME("junk"), CTL(opt_junk)}, +#endif +#ifdef JEMALLOC_SYSV + {NAME("sysv"), CTL(opt_sysv)}, +#endif +#ifdef JEMALLOC_XMALLOC + {NAME("xmalloc"), CTL(opt_xmalloc)}, +#endif +#ifdef JEMALLOC_ZERO + {NAME("zero"), CTL(opt_zero)}, +#endif +#ifdef JEMALLOC_TCACHE + {NAME("tcache"), CTL(opt_tcache)}, + {NAME("lg_tcache_gc_sweep"), CTL(opt_lg_tcache_gc_sweep)}, +#endif +#ifdef JEMALLOC_PROF + {NAME("prof"), CTL(opt_prof)}, + {NAME("prof_active"), CTL(opt_prof_active)}, + {NAME("lg_prof_bt_max"), CTL(opt_lg_prof_bt_max)}, + {NAME("lg_prof_sample"), CTL(opt_lg_prof_sample)}, + {NAME("lg_prof_interval"), CTL(opt_lg_prof_interval)}, + {NAME("prof_udump"), CTL(opt_prof_udump)}, + {NAME("prof_leak"), CTL(opt_prof_leak)}, +#endif + {NAME("stats_print"), CTL(opt_stats_print)}, + {NAME("lg_qspace_max"), CTL(opt_lg_qspace_max)}, + {NAME("lg_cspace_max"), CTL(opt_lg_cspace_max)}, + {NAME("lg_dirty_mult"), CTL(opt_lg_dirty_mult)}, + {NAME("lg_chunk"), CTL(opt_lg_chunk)} +#ifdef JEMALLOC_SWAP + , + {NAME("overcommit"), CTL(opt_overcommit)} +#endif +}; + +static const ctl_node_t arenas_bin_i_node[] = { + {NAME("size"), CTL(arenas_bin_i_size)}, + {NAME("nregs"), CTL(arenas_bin_i_nregs)}, + {NAME("run_size"), CTL(arenas_bin_i_run_size)} +}; +static const ctl_node_t super_arenas_bin_i_node[] = { + {NAME(""), CHILD(arenas_bin_i)} +}; + +static const ctl_node_t arenas_bin_node[] = { + {INDEX(arenas_bin_i)} +}; + +static const ctl_node_t arenas_lrun_i_node[] = { + {NAME("size"), CTL(arenas_lrun_i_size)} +}; +static const ctl_node_t super_arenas_lrun_i_node[] = { + {NAME(""), CHILD(arenas_lrun_i)} +}; + +static const ctl_node_t arenas_lrun_node[] = { + {INDEX(arenas_lrun_i)} +}; + +static const ctl_node_t arenas_node[] = { + {NAME("narenas"), CTL(arenas_narenas)}, + {NAME("initialized"), CTL(arenas_initialized)}, + {NAME("quantum"), CTL(arenas_quantum)}, + {NAME("cacheline"), CTL(arenas_cacheline)}, + {NAME("subpage"), CTL(arenas_subpage)}, + {NAME("pagesize"), CTL(arenas_pagesize)}, + {NAME("chunksize"), CTL(arenas_chunksize)}, +#ifdef JEMALLOC_TINY + {NAME("tspace_min"), CTL(arenas_tspace_min)}, + {NAME("tspace_max"), CTL(arenas_tspace_max)}, +#endif + {NAME("qspace_min"), CTL(arenas_qspace_min)}, + {NAME("qspace_max"), CTL(arenas_qspace_max)}, + {NAME("cspace_min"), CTL(arenas_cspace_min)}, + {NAME("cspace_max"), CTL(arenas_cspace_max)}, + {NAME("sspace_min"), CTL(arenas_sspace_min)}, + {NAME("sspace_max"), CTL(arenas_sspace_max)}, +#ifdef JEMALLOC_TCACHE + {NAME("tcache_max"), CTL(arenas_tcache_max)}, +#endif + {NAME("ntbins"), CTL(arenas_ntbins)}, + {NAME("nqbins"), CTL(arenas_nqbins)}, + {NAME("ncbins"), CTL(arenas_ncbins)}, + {NAME("nsbins"), CTL(arenas_nsbins)}, + {NAME("nbins"), CTL(arenas_nbins)}, +#ifdef JEMALLOC_TCACHE + {NAME("nhbins"), CTL(arenas_nhbins)}, +#endif + {NAME("bin"), CHILD(arenas_bin)}, + {NAME("nlruns"), CTL(arenas_nlruns)}, + {NAME("lrun"), CHILD(arenas_lrun)} +}; + +#ifdef JEMALLOC_PROF +static const ctl_node_t prof_node[] = { + {NAME("active"), CTL(prof_active)}, + {NAME("dump"), CTL(prof_dump)}, + {NAME("interval"), CTL(prof_interval)} +}; +#endif + +#ifdef JEMALLOC_STATS +static const ctl_node_t stats_chunks_node[] = { + {NAME("current"), CTL(stats_chunks_current)}, + {NAME("total"), CTL(stats_chunks_total)}, + {NAME("high"), CTL(stats_chunks_high)} +}; + +static const ctl_node_t stats_huge_node[] = { + {NAME("allocated"), CTL(stats_huge_allocated)}, + {NAME("nmalloc"), CTL(stats_huge_nmalloc)}, + {NAME("ndalloc"), CTL(stats_huge_ndalloc)} +}; + +static const ctl_node_t stats_arenas_i_small_node[] = { + {NAME("allocated"), CTL(stats_arenas_i_small_allocated)}, + {NAME("nmalloc"), CTL(stats_arenas_i_small_nmalloc)}, + {NAME("ndalloc"), CTL(stats_arenas_i_small_ndalloc)}, + {NAME("nrequests"), CTL(stats_arenas_i_small_nrequests)} +}; + +static const ctl_node_t stats_arenas_i_large_node[] = { + {NAME("allocated"), CTL(stats_arenas_i_large_allocated)}, + {NAME("nmalloc"), CTL(stats_arenas_i_large_nmalloc)}, + {NAME("ndalloc"), CTL(stats_arenas_i_large_ndalloc)}, + {NAME("nrequests"), CTL(stats_arenas_i_large_nrequests)} +}; + +static const ctl_node_t stats_arenas_i_bins_j_node[] = { + {NAME("allocated"), CTL(stats_arenas_i_bins_j_allocated)}, + {NAME("nmalloc"), CTL(stats_arenas_i_bins_j_nmalloc)}, + {NAME("ndalloc"), CTL(stats_arenas_i_bins_j_ndalloc)}, + {NAME("nrequests"), CTL(stats_arenas_i_bins_j_nrequests)}, +#ifdef JEMALLOC_TCACHE + {NAME("nfills"), CTL(stats_arenas_i_bins_j_nfills)}, + {NAME("nflushes"), CTL(stats_arenas_i_bins_j_nflushes)}, +#endif + {NAME("nruns"), CTL(stats_arenas_i_bins_j_nruns)}, + {NAME("nreruns"), CTL(stats_arenas_i_bins_j_nreruns)}, + {NAME("highruns"), CTL(stats_arenas_i_bins_j_highruns)}, + {NAME("curruns"), CTL(stats_arenas_i_bins_j_curruns)} +}; +static const ctl_node_t super_stats_arenas_i_bins_j_node[] = { + {NAME(""), CHILD(stats_arenas_i_bins_j)} +}; + +static const ctl_node_t stats_arenas_i_bins_node[] = { + {INDEX(stats_arenas_i_bins_j)} +}; + +static const ctl_node_t stats_arenas_i_lruns_j_node[] = { + {NAME("nmalloc"), CTL(stats_arenas_i_lruns_j_nmalloc)}, + {NAME("ndalloc"), CTL(stats_arenas_i_lruns_j_ndalloc)}, + {NAME("nrequests"), CTL(stats_arenas_i_lruns_j_nrequests)}, + {NAME("highruns"), CTL(stats_arenas_i_lruns_j_highruns)}, + {NAME("curruns"), CTL(stats_arenas_i_lruns_j_curruns)} +}; +static const ctl_node_t super_stats_arenas_i_lruns_j_node[] = { + {NAME(""), CHILD(stats_arenas_i_lruns_j)} +}; + +static const ctl_node_t stats_arenas_i_lruns_node[] = { + {INDEX(stats_arenas_i_lruns_j)} +}; +#endif + +static const ctl_node_t stats_arenas_i_node[] = { + {NAME("pactive"), CTL(stats_arenas_i_pactive)}, + {NAME("pdirty"), CTL(stats_arenas_i_pdirty)} +#ifdef JEMALLOC_STATS + , + {NAME("mapped"), CTL(stats_arenas_i_mapped)}, + {NAME("npurge"), CTL(stats_arenas_i_npurge)}, + {NAME("nmadvise"), CTL(stats_arenas_i_nmadvise)}, + {NAME("purged"), CTL(stats_arenas_i_purged)}, + {NAME("small"), CHILD(stats_arenas_i_small)}, + {NAME("large"), CHILD(stats_arenas_i_large)}, + {NAME("bins"), CHILD(stats_arenas_i_bins)}, + {NAME("lruns"), CHILD(stats_arenas_i_lruns)} +#endif +}; +static const ctl_node_t super_stats_arenas_i_node[] = { + {NAME(""), CHILD(stats_arenas_i)} +}; + +static const ctl_node_t stats_arenas_node[] = { + {INDEX(stats_arenas_i)} +}; + +static const ctl_node_t stats_node[] = { +#ifdef JEMALLOC_STATS + {NAME("allocated"), CTL(stats_allocated)}, + {NAME("active"), CTL(stats_active)}, + {NAME("mapped"), CTL(stats_mapped)}, + {NAME("chunks"), CHILD(stats_chunks)}, + {NAME("huge"), CHILD(stats_huge)}, +#endif + {NAME("arenas"), CHILD(stats_arenas)} +}; + +#ifdef JEMALLOC_SWAP +static const ctl_node_t swap_node[] = { +# ifdef JEMALLOC_STATS + {NAME("avail"), CTL(swap_avail)}, +# endif + {NAME("prezeroed"), CTL(swap_prezeroed)}, + {NAME("nfds"), CTL(swap_nfds)}, + {NAME("fds"), CTL(swap_fds)} +}; +#endif + +static const ctl_node_t root_node[] = { + {NAME("version"), CTL(version)}, + {NAME("epoch"), CTL(epoch)}, +#ifdef JEMALLOC_TCACHE + {NAME("tcache"), CHILD(tcache)}, +#endif + {NAME("config"), CHILD(config)}, + {NAME("opt"), CHILD(opt)}, + {NAME("arenas"), CHILD(arenas)}, +#ifdef JEMALLOC_PROF + {NAME("prof"), CHILD(prof)}, +#endif + {NAME("stats"), CHILD(stats)} +#ifdef JEMALLOC_SWAP + , + {NAME("swap"), CHILD(swap)} +#endif +}; +static const ctl_node_t super_root_node[] = { + {NAME(""), CHILD(root)} +}; + +#undef NAME +#undef CHILD +#undef CTL +#undef INDEX + +/******************************************************************************/ + +#ifdef JEMALLOC_STATS +static bool +ctl_arena_init(ctl_arena_stats_t *astats) +{ + + if (astats->bstats == NULL) { + astats->bstats = (malloc_bin_stats_t *)base_alloc(nbins * + sizeof(malloc_bin_stats_t)); + if (astats->bstats == NULL) + return (true); + } + if (astats->lstats == NULL) { + astats->lstats = (malloc_large_stats_t *)base_alloc(nlclasses * + sizeof(malloc_large_stats_t)); + if (astats->lstats == NULL) + return (true); + } + + return (false); +} +#endif + +static void +ctl_arena_clear(ctl_arena_stats_t *astats) +{ + + astats->pactive = 0; + astats->pdirty = 0; +#ifdef JEMALLOC_STATS + memset(&astats->astats, 0, sizeof(arena_stats_t)); + astats->allocated_small = 0; + astats->nmalloc_small = 0; + astats->ndalloc_small = 0; + astats->nrequests_small = 0; + memset(astats->bstats, 0, nbins * sizeof(malloc_bin_stats_t)); + memset(astats->lstats, 0, nlclasses * sizeof(malloc_large_stats_t)); +#endif +} + +#ifdef JEMALLOC_STATS +static void +ctl_arena_stats_amerge(ctl_arena_stats_t *cstats, arena_t *arena) +{ + unsigned i; + + arena_stats_merge(arena, &cstats->pactive, &cstats->pdirty, + &cstats->astats, cstats->bstats, cstats->lstats); + + for (i = 0; i < nbins; i++) { + cstats->allocated_small += cstats->bstats[i].allocated; + cstats->nmalloc_small += cstats->bstats[i].nmalloc; + cstats->ndalloc_small += cstats->bstats[i].ndalloc; + cstats->nrequests_small += cstats->bstats[i].nrequests; + } +} + +static void +ctl_arena_stats_smerge(ctl_arena_stats_t *sstats, ctl_arena_stats_t *astats) +{ + unsigned i; + + sstats->pactive += astats->pactive; + sstats->pdirty += astats->pdirty; + + sstats->astats.mapped += astats->astats.mapped; + sstats->astats.npurge += astats->astats.npurge; + sstats->astats.nmadvise += astats->astats.nmadvise; + sstats->astats.purged += astats->astats.purged; + + sstats->allocated_small += astats->allocated_small; + sstats->nmalloc_small += astats->nmalloc_small; + sstats->ndalloc_small += astats->ndalloc_small; + sstats->nrequests_small += astats->nrequests_small; + + sstats->astats.allocated_large += astats->astats.allocated_large; + sstats->astats.nmalloc_large += astats->astats.nmalloc_large; + sstats->astats.ndalloc_large += astats->astats.ndalloc_large; + sstats->astats.nrequests_large += astats->astats.nrequests_large; + + for (i = 0; i < nlclasses; i++) { + sstats->lstats[i].nmalloc += astats->lstats[i].nmalloc; + sstats->lstats[i].ndalloc += astats->lstats[i].ndalloc; + sstats->lstats[i].nrequests += astats->lstats[i].nrequests; + sstats->lstats[i].highruns += astats->lstats[i].highruns; + sstats->lstats[i].curruns += astats->lstats[i].curruns; + } + + for (i = 0; i < nbins; i++) { + sstats->bstats[i].allocated += astats->bstats[i].allocated; + sstats->bstats[i].nmalloc += astats->bstats[i].nmalloc; + sstats->bstats[i].ndalloc += astats->bstats[i].ndalloc; + sstats->bstats[i].nrequests += astats->bstats[i].nrequests; +#ifdef JEMALLOC_TCACHE + sstats->bstats[i].nfills += astats->bstats[i].nfills; + sstats->bstats[i].nflushes += astats->bstats[i].nflushes; +#endif + sstats->bstats[i].nruns += astats->bstats[i].nruns; + sstats->bstats[i].reruns += astats->bstats[i].reruns; + sstats->bstats[i].highruns += astats->bstats[i].highruns; + sstats->bstats[i].curruns += astats->bstats[i].curruns; + } +} +#endif + +static void +ctl_arena_refresh(arena_t *arena, unsigned i) +{ + ctl_arena_stats_t *astats = &ctl_stats.arenas[i]; + ctl_arena_stats_t *sstats = &ctl_stats.arenas[narenas]; + + ctl_arena_clear(astats); + +#ifdef JEMALLOC_STATS + ctl_arena_stats_amerge(astats, arena); + /* Merge into sum stats as well. */ + ctl_arena_stats_smerge(sstats, astats); +#else + astats->pactive += arena->nactive; + astats->pdirty += arena->ndirty; + /* Merge into sum stats as well. */ + sstats->pactive += arena->nactive; + sstats->pdirty += arena->ndirty; +#endif +} + +static void +ctl_refresh(void) +{ + unsigned i; + arena_t *tarenas[narenas]; + +#ifdef JEMALLOC_STATS + malloc_mutex_lock(&chunks_mtx); + ctl_stats.chunks.current = stats_chunks.curchunks; + ctl_stats.chunks.total = stats_chunks.nchunks; + ctl_stats.chunks.high = stats_chunks.highchunks; + malloc_mutex_unlock(&chunks_mtx); + + malloc_mutex_lock(&huge_mtx); + ctl_stats.huge.allocated = huge_allocated; + ctl_stats.huge.nmalloc = huge_nmalloc; + ctl_stats.huge.ndalloc = huge_ndalloc; + malloc_mutex_unlock(&huge_mtx); +#endif + + /* + * Clear sum stats, since they will be merged into by + * ctl_arena_refresh(). + */ + ctl_arena_clear(&ctl_stats.arenas[narenas]); + + malloc_mutex_lock(&arenas_lock); + memcpy(tarenas, arenas, sizeof(arena_t *) * narenas); + malloc_mutex_unlock(&arenas_lock); + for (i = 0; i < narenas; i++) { + bool initialized = (tarenas[i] != NULL); + + ctl_stats.arenas[i].initialized = initialized; + if (initialized) + ctl_arena_refresh(tarenas[i], i); + } + +#ifdef JEMALLOC_STATS + ctl_stats.allocated = ctl_stats.arenas[narenas].allocated_small + + ctl_stats.arenas[narenas].astats.allocated_large + + ctl_stats.huge.allocated; + ctl_stats.active = (ctl_stats.arenas[narenas].pactive << PAGE_SHIFT) + + ctl_stats.huge.allocated; + ctl_stats.mapped = (ctl_stats.chunks.current << opt_lg_chunk); + +# ifdef JEMALLOC_SWAP + malloc_mutex_lock(&swap_mtx); + ctl_stats.swap_avail = swap_avail; + malloc_mutex_unlock(&swap_mtx); +# endif +#endif + + ctl_epoch++; +} + +static bool +ctl_init(void) +{ + + if (ctl_initialized == false) { +#ifdef JEMALLOC_STATS + unsigned i; +#endif + + /* + * Allocate space for one extra arena stats element, which + * contains summed stats across all arenas. + */ + ctl_stats.arenas = (ctl_arena_stats_t *)base_alloc( + (narenas + 1) * sizeof(ctl_arena_stats_t)); + if (ctl_stats.arenas == NULL) + return (true); + memset(ctl_stats.arenas, 0, (narenas + 1) * + sizeof(ctl_arena_stats_t)); + + /* + * Initialize all stats structures, regardless of whether they + * ever get used. Lazy initialization would allow errors to + * cause inconsistent state to be viewable by the application. + */ +#ifdef JEMALLOC_STATS + for (i = 0; i <= narenas; i++) { + if (ctl_arena_init(&ctl_stats.arenas[i])) + return (true); + } +#endif + ctl_stats.arenas[narenas].initialized = true; + + ctl_epoch = 0; + ctl_refresh(); + ctl_initialized = true; + } + + return (false); +} + +static int +ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp, + size_t *depthp) +{ + int ret; + const char *elm, *tdot, *dot; + size_t elen, i, j; + const ctl_node_t *node; + + elm = name; + /* Equivalent to strchrnul(). */ + dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot : strchr(elm, '\0'); + elen = (size_t)((uintptr_t)dot - (uintptr_t)elm); + if (elen == 0) { + ret = ENOENT; + goto RETURN; + } + node = super_root_node; + for (i = 0; i < *depthp; i++) { + assert(node->named); + assert(node->u.named.nchildren > 0); + if (node->u.named.children[0].named) { + const ctl_node_t *pnode = node; + + /* Children are named. */ + for (j = 0; j < node->u.named.nchildren; j++) { + const ctl_node_t *child = + &node->u.named.children[j]; + if (strlen(child->u.named.name) == elen + && strncmp(elm, child->u.named.name, + elen) == 0) { + node = child; + if (nodesp != NULL) + nodesp[i] = node; + mibp[i] = j; + break; + } + } + if (node == pnode) { + ret = ENOENT; + goto RETURN; + } + } else { + unsigned long index; + const ctl_node_t *inode; + + /* Children are indexed. */ + index = strtoul(elm, NULL, 10); + if (index == ULONG_MAX) { + ret = ENOENT; + goto RETURN; + } + + inode = &node->u.named.children[0]; + node = inode->u.indexed.index(mibp, *depthp, + index); + if (node == NULL) { + ret = ENOENT; + goto RETURN; + } + + if (nodesp != NULL) + nodesp[i] = node; + mibp[i] = (size_t)index; + } + + if (node->ctl != NULL) { + /* Terminal node. */ + if (*dot != '\0') { + /* + * The name contains more elements than are + * in this path through the tree. + */ + ret = ENOENT; + goto RETURN; + } + /* Complete lookup successful. */ + *depthp = i + 1; + break; + } + + /* Update elm. */ + if (*dot == '\0') { + /* No more elements. */ + ret = ENOENT; + goto RETURN; + } + elm = &dot[1]; + dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot : + strchr(elm, '\0'); + elen = (size_t)((uintptr_t)dot - (uintptr_t)elm); + } + + ret = 0; +RETURN: + return (ret); +} + +int +ctl_byname(const char *name, void *oldp, size_t *oldlenp, void *newp, + size_t newlen) +{ + int ret; + size_t depth; + ctl_node_t const *nodes[CTL_MAX_DEPTH]; + size_t mib[CTL_MAX_DEPTH]; + + malloc_mutex_lock(&ctl_mtx); + if (ctl_init()) { + ret = EAGAIN; + goto RETURN; + } + + depth = CTL_MAX_DEPTH; + ret = ctl_lookup(name, nodes, mib, &depth); + if (ret != 0) + goto RETURN; + + if (nodes[depth-1]->ctl == NULL) { + /* The name refers to a partial path through the ctl tree. */ + ret = ENOENT; + goto RETURN; + } + ret = nodes[depth-1]->ctl(mib, depth, oldp, oldlenp, newp, newlen); + +RETURN: + malloc_mutex_unlock(&ctl_mtx); + return(ret); +} + +int +ctl_nametomib(const char *name, size_t *mibp, size_t *miblenp) +{ + int ret; + + malloc_mutex_lock(&ctl_mtx); + if (ctl_init()) { + ret = EAGAIN; + goto RETURN; + } + + ret = ctl_lookup(name, NULL, mibp, miblenp); + +RETURN: + malloc_mutex_unlock(&ctl_mtx); + return(ret); +} + +int +ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + int ret; + const ctl_node_t *node; + size_t i; + + malloc_mutex_lock(&ctl_mtx); + if (ctl_init()) { + ret = EAGAIN; + goto RETURN; + } + + /* Iterate down the tree. */ + node = super_root_node; + for (i = 0; i < miblen; i++) { + if (node->u.named.children[0].named) { + /* Children are named. */ + if (node->u.named.nchildren <= mib[i]) { + ret = ENOENT; + goto RETURN; + } + node = &node->u.named.children[mib[i]]; + } else { + const ctl_node_t *inode; + + /* Indexed element. */ + inode = &node->u.named.children[0]; + node = inode->u.indexed.index(mib, miblen, mib[i]); + if (node == NULL) { + ret = ENOENT; + goto RETURN; + } + } + } + + /* Call the ctl function. */ + if (node->ctl == NULL) { + /* Partial MIB. */ + ret = ENOENT; + goto RETURN; + } + ret = node->ctl(mib, miblen, oldp, oldlenp, newp, newlen); + +RETURN: + malloc_mutex_unlock(&ctl_mtx); + return(ret); +} + +bool +ctl_boot(void) +{ + + if (malloc_mutex_init(&ctl_mtx)) + return (true); + + ctl_initialized = false; + + return (false); +} + +/******************************************************************************/ +/* *_ctl() functions. */ + +#define READONLY() do { \ + if (newp != NULL || newlen != 0) { \ + ret = EPERM; \ + goto RETURN; \ + } \ +} while (0) + +#define WRITEONLY() do { \ + if (oldp != NULL || oldlenp != NULL) { \ + ret = EPERM; \ + goto RETURN; \ + } \ +} while (0) + +#define VOID() do { \ + READONLY(); \ + WRITEONLY(); \ +} while (0) + +#define READ(v, t) do { \ + if (oldp != NULL && oldlenp != NULL) { \ + if (*oldlenp != sizeof(t)) { \ + size_t copylen = (sizeof(t) <= *oldlenp) \ + ? sizeof(t) : *oldlenp; \ + memcpy(oldp, (void *)&v, copylen); \ + ret = EINVAL; \ + goto RETURN; \ + } else \ + *(t *)oldp = v; \ + } \ +} while (0) + +#define WRITE(v, t) do { \ + if (newp != NULL) { \ + if (newlen != sizeof(t)) { \ + ret = EINVAL; \ + goto RETURN; \ + } \ + v = *(t *)newp; \ + } \ +} while (0) + +#define CTL_RO_GEN(n, v, t) \ +static int \ +n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \ + void *newp, size_t newlen) \ +{ \ + int ret; \ + t oldval; \ + \ + READONLY(); \ + oldval = v; \ + READ(oldval, t); \ + \ + ret = 0; \ +RETURN: \ + return (ret); \ +} + +#define CTL_RO_TRUE_GEN(n) \ +static int \ +n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \ + void *newp, size_t newlen) \ +{ \ + int ret; \ + bool oldval; \ + \ + READONLY(); \ + oldval = true; \ + READ(oldval, bool); \ + \ + ret = 0; \ +RETURN: \ + return (ret); \ +} + +#define CTL_RO_FALSE_GEN(n) \ +static int \ +n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \ + void *newp, size_t newlen) \ +{ \ + int ret; \ + bool oldval; \ + \ + READONLY(); \ + oldval = false; \ + READ(oldval, bool); \ + \ + ret = 0; \ +RETURN: \ + return (ret); \ +} + +CTL_RO_GEN(version, JEMALLOC_VERSION, const char *) + +static int +epoch_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + int ret; + uint64_t newval; + + newval = 0; + WRITE(newval, uint64_t); + if (newval != 0) + ctl_refresh(); + READ(ctl_epoch, uint64_t); + + ret = 0; +RETURN: + return (ret); +} + +#ifdef JEMALLOC_TCACHE +static int +tcache_flush_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + int ret; + tcache_t *tcache; + + VOID(); + + tcache = tcache_tls; + if (tcache == NULL) { + ret = 0; + goto RETURN; + } + tcache_destroy(tcache); + tcache_tls = NULL; + + ret = 0; +RETURN: + return (ret); +} +#endif + +/******************************************************************************/ + +#ifdef JEMALLOC_DEBUG +CTL_RO_TRUE_GEN(config_debug) +#else +CTL_RO_FALSE_GEN(config_debug) +#endif + +#ifdef JEMALLOC_DSS +CTL_RO_TRUE_GEN(config_dss) +#else +CTL_RO_FALSE_GEN(config_dss) +#endif + +#ifdef JEMALLOC_DYNAMIC_PAGE_SHIFT +CTL_RO_TRUE_GEN(config_dynamic_page_shift) +#else +CTL_RO_FALSE_GEN(config_dynamic_page_shift) +#endif + +#ifdef JEMALLOC_FILL +CTL_RO_TRUE_GEN(config_fill) +#else +CTL_RO_FALSE_GEN(config_fill) +#endif + +#ifdef JEMALLOC_LAZY_LOCK +CTL_RO_TRUE_GEN(config_lazy_lock) +#else +CTL_RO_FALSE_GEN(config_lazy_lock) +#endif + +#ifdef JEMALLOC_PROF +CTL_RO_TRUE_GEN(config_prof) +#else +CTL_RO_FALSE_GEN(config_prof) +#endif + +#ifdef JEMALLOC_PROF_LIBGCC +CTL_RO_TRUE_GEN(config_prof_libgcc) +#else +CTL_RO_FALSE_GEN(config_prof_libgcc) +#endif + +#ifdef JEMALLOC_PROF_LIBUNWIND +CTL_RO_TRUE_GEN(config_prof_libunwind) +#else +CTL_RO_FALSE_GEN(config_prof_libunwind) +#endif + +#ifdef JEMALLOC_STATS +CTL_RO_TRUE_GEN(config_stats) +#else +CTL_RO_FALSE_GEN(config_stats) +#endif + +#ifdef JEMALLOC_SWAP +CTL_RO_TRUE_GEN(config_swap) +#else +CTL_RO_FALSE_GEN(config_swap) +#endif + +#ifdef JEMALLOC_SYSV +CTL_RO_TRUE_GEN(config_sysv) +#else +CTL_RO_FALSE_GEN(config_sysv) +#endif + +#ifdef JEMALLOC_TCACHE +CTL_RO_TRUE_GEN(config_tcache) +#else +CTL_RO_FALSE_GEN(config_tcache) +#endif + +#ifdef JEMALLOC_TINY +CTL_RO_TRUE_GEN(config_tiny) +#else +CTL_RO_FALSE_GEN(config_tiny) +#endif + +#ifdef JEMALLOC_TLS +CTL_RO_TRUE_GEN(config_tls) +#else +CTL_RO_FALSE_GEN(config_tls) +#endif + +#ifdef JEMALLOC_XMALLOC +CTL_RO_TRUE_GEN(config_xmalloc) +#else +CTL_RO_FALSE_GEN(config_xmalloc) +#endif + +/******************************************************************************/ + +CTL_RO_GEN(opt_abort, opt_abort, bool) +#ifdef JEMALLOC_FILL +CTL_RO_GEN(opt_junk, opt_junk, bool) +#endif +#ifdef JEMALLOC_SYSV +CTL_RO_GEN(opt_sysv, opt_sysv, bool) +#endif +#ifdef JEMALLOC_XMALLOC +CTL_RO_GEN(opt_xmalloc, opt_xmalloc, bool) +#endif +#ifdef JEMALLOC_ZERO +CTL_RO_GEN(opt_zero, opt_zero, bool) +#endif +#ifdef JEMALLOC_TCACHE +CTL_RO_GEN(opt_tcache, opt_tcache, bool) +CTL_RO_GEN(opt_lg_tcache_gc_sweep, opt_lg_tcache_gc_sweep, ssize_t) +#endif +#ifdef JEMALLOC_PROF +CTL_RO_GEN(opt_prof, opt_prof, bool) +CTL_RO_GEN(opt_prof_active, opt_prof_active, bool) +CTL_RO_GEN(opt_lg_prof_bt_max, opt_lg_prof_bt_max, size_t) +CTL_RO_GEN(opt_lg_prof_sample, opt_lg_prof_sample, size_t) +CTL_RO_GEN(opt_lg_prof_interval, opt_lg_prof_interval, ssize_t) +CTL_RO_GEN(opt_prof_udump, opt_prof_udump, bool) +CTL_RO_GEN(opt_prof_leak, opt_prof_leak, bool) +#endif +CTL_RO_GEN(opt_stats_print, opt_stats_print, bool) +CTL_RO_GEN(opt_lg_qspace_max, opt_lg_qspace_max, size_t) +CTL_RO_GEN(opt_lg_cspace_max, opt_lg_cspace_max, size_t) +CTL_RO_GEN(opt_lg_dirty_mult, opt_lg_dirty_mult, ssize_t) +CTL_RO_GEN(opt_lg_chunk, opt_lg_chunk, size_t) +#ifdef JEMALLOC_SWAP +CTL_RO_GEN(opt_overcommit, opt_overcommit, bool) +#endif + +/******************************************************************************/ + +CTL_RO_GEN(arenas_bin_i_size, arenas[0]->bins[mib[2]].reg_size, size_t) +CTL_RO_GEN(arenas_bin_i_nregs, arenas[0]->bins[mib[2]].nregs, uint32_t) +CTL_RO_GEN(arenas_bin_i_run_size, arenas[0]->bins[mib[2]].run_size, size_t) +const ctl_node_t * +arenas_bin_i_index(const size_t *mib, size_t miblen, size_t i) +{ + + if (i > nbins) + return (NULL); + return (super_arenas_bin_i_node); +} + +CTL_RO_GEN(arenas_lrun_i_size, ((mib[2]+1) << PAGE_SHIFT), size_t) +const ctl_node_t * +arenas_lrun_i_index(const size_t *mib, size_t miblen, size_t i) +{ + + if (i > nlclasses) + return (NULL); + return (super_arenas_lrun_i_node); +} + +CTL_RO_GEN(arenas_narenas, narenas, unsigned) + +static int +arenas_initialized_ctl(const size_t *mib, size_t miblen, void *oldp, + size_t *oldlenp, void *newp, size_t newlen) +{ + int ret; + unsigned nread, i; + + READONLY(); + if (*oldlenp != narenas * sizeof(bool)) { + ret = EINVAL; + nread = (*oldlenp < narenas * sizeof(bool)) + ? (*oldlenp / sizeof(bool)) : narenas; + } else { + ret = 0; + nread = narenas; + } + + for (i = 0; i < nread; i++) + ((bool *)oldp)[i] = ctl_stats.arenas[i].initialized; + +RETURN: + return (ret); +} + +CTL_RO_GEN(arenas_quantum, QUANTUM, size_t) +CTL_RO_GEN(arenas_cacheline, CACHELINE, size_t) +CTL_RO_GEN(arenas_subpage, SUBPAGE, size_t) +CTL_RO_GEN(arenas_pagesize, PAGE_SIZE, size_t) +CTL_RO_GEN(arenas_chunksize, chunksize, size_t) +#ifdef JEMALLOC_TINY +CTL_RO_GEN(arenas_tspace_min, (1U << LG_TINY_MIN), size_t) +CTL_RO_GEN(arenas_tspace_max, (qspace_min >> 1), size_t) +#endif +CTL_RO_GEN(arenas_qspace_min, qspace_min, size_t) +CTL_RO_GEN(arenas_qspace_max, qspace_max, size_t) +CTL_RO_GEN(arenas_cspace_min, cspace_min, size_t) +CTL_RO_GEN(arenas_cspace_max, cspace_max, size_t) +CTL_RO_GEN(arenas_sspace_min, sspace_min, size_t) +CTL_RO_GEN(arenas_sspace_max, sspace_max, size_t) +#ifdef JEMALLOC_TCACHE +CTL_RO_GEN(arenas_tcache_max, tcache_maxclass, size_t) +#endif +CTL_RO_GEN(arenas_ntbins, ntbins, unsigned) +CTL_RO_GEN(arenas_nqbins, nqbins, unsigned) +CTL_RO_GEN(arenas_ncbins, ncbins, unsigned) +CTL_RO_GEN(arenas_nsbins, nsbins, unsigned) +CTL_RO_GEN(arenas_nbins, nbins, unsigned) +#ifdef JEMALLOC_TCACHE +CTL_RO_GEN(arenas_nhbins, nhbins, unsigned) +#endif +CTL_RO_GEN(arenas_nlruns, nlclasses, size_t) + +/******************************************************************************/ + +#ifdef JEMALLOC_PROF +static int +prof_active_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + int ret; + bool oldval; + + oldval = opt_prof_active; + if (newp != NULL) { + /* + * The memory barriers will tend to make opt_prof_active + * propagate faster on systems with weak memory ordering. + */ + mb_write(); + WRITE(opt_prof_active, bool); + mb_write(); + } + READ(oldval, bool); + + ret = 0; +RETURN: + return (ret); +} + +static int +prof_dump_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + int ret; + const char *filename = NULL; + + WRITEONLY(); + WRITE(filename, const char *); + + if (prof_mdump(filename)) { + ret = EFAULT; + goto RETURN; + } + + ret = 0; +RETURN: + return (ret); +} + +CTL_RO_GEN(prof_interval, prof_interval, uint64_t) +#endif + +/******************************************************************************/ + +#ifdef JEMALLOC_STATS +CTL_RO_GEN(stats_chunks_current, ctl_stats.chunks.current, size_t) +CTL_RO_GEN(stats_chunks_total, ctl_stats.chunks.total, uint64_t) +CTL_RO_GEN(stats_chunks_high, ctl_stats.chunks.high, size_t) +CTL_RO_GEN(stats_huge_allocated, huge_allocated, size_t) +CTL_RO_GEN(stats_huge_nmalloc, huge_nmalloc, uint64_t) +CTL_RO_GEN(stats_huge_ndalloc, huge_ndalloc, uint64_t) +CTL_RO_GEN(stats_arenas_i_small_allocated, + ctl_stats.arenas[mib[2]].allocated_small, size_t) +CTL_RO_GEN(stats_arenas_i_small_nmalloc, + ctl_stats.arenas[mib[2]].nmalloc_small, uint64_t) +CTL_RO_GEN(stats_arenas_i_small_ndalloc, + ctl_stats.arenas[mib[2]].ndalloc_small, uint64_t) +CTL_RO_GEN(stats_arenas_i_small_nrequests, + ctl_stats.arenas[mib[2]].nrequests_small, uint64_t) +CTL_RO_GEN(stats_arenas_i_large_allocated, + ctl_stats.arenas[mib[2]].astats.allocated_large, size_t) +CTL_RO_GEN(stats_arenas_i_large_nmalloc, + ctl_stats.arenas[mib[2]].astats.nmalloc_large, uint64_t) +CTL_RO_GEN(stats_arenas_i_large_ndalloc, + ctl_stats.arenas[mib[2]].astats.ndalloc_large, uint64_t) +CTL_RO_GEN(stats_arenas_i_large_nrequests, + ctl_stats.arenas[mib[2]].astats.nrequests_large, uint64_t) + +CTL_RO_GEN(stats_arenas_i_bins_j_allocated, + ctl_stats.arenas[mib[2]].bstats[mib[4]].allocated, size_t) +CTL_RO_GEN(stats_arenas_i_bins_j_nmalloc, + ctl_stats.arenas[mib[2]].bstats[mib[4]].nmalloc, uint64_t) +CTL_RO_GEN(stats_arenas_i_bins_j_ndalloc, + ctl_stats.arenas[mib[2]].bstats[mib[4]].ndalloc, uint64_t) +CTL_RO_GEN(stats_arenas_i_bins_j_nrequests, + ctl_stats.arenas[mib[2]].bstats[mib[4]].nrequests, uint64_t) +#ifdef JEMALLOC_TCACHE +CTL_RO_GEN(stats_arenas_i_bins_j_nfills, + ctl_stats.arenas[mib[2]].bstats[mib[4]].nfills, uint64_t) +CTL_RO_GEN(stats_arenas_i_bins_j_nflushes, + ctl_stats.arenas[mib[2]].bstats[mib[4]].nflushes, uint64_t) +#endif +CTL_RO_GEN(stats_arenas_i_bins_j_nruns, + ctl_stats.arenas[mib[2]].bstats[mib[4]].nruns, uint64_t) +CTL_RO_GEN(stats_arenas_i_bins_j_nreruns, + ctl_stats.arenas[mib[2]].bstats[mib[4]].reruns, uint64_t) +CTL_RO_GEN(stats_arenas_i_bins_j_highruns, + ctl_stats.arenas[mib[2]].bstats[mib[4]].highruns, size_t) +CTL_RO_GEN(stats_arenas_i_bins_j_curruns, + ctl_stats.arenas[mib[2]].bstats[mib[4]].curruns, size_t) + +const ctl_node_t * +stats_arenas_i_bins_j_index(const size_t *mib, size_t miblen, size_t j) +{ + + if (j > nbins) + return (NULL); + return (super_stats_arenas_i_bins_j_node); +} + +CTL_RO_GEN(stats_arenas_i_lruns_j_nmalloc, + ctl_stats.arenas[mib[2]].lstats[mib[4]].nmalloc, uint64_t) +CTL_RO_GEN(stats_arenas_i_lruns_j_ndalloc, + ctl_stats.arenas[mib[2]].lstats[mib[4]].ndalloc, uint64_t) +CTL_RO_GEN(stats_arenas_i_lruns_j_nrequests, + ctl_stats.arenas[mib[2]].lstats[mib[4]].nrequests, uint64_t) +CTL_RO_GEN(stats_arenas_i_lruns_j_curruns, + ctl_stats.arenas[mib[2]].lstats[mib[4]].curruns, size_t) +CTL_RO_GEN(stats_arenas_i_lruns_j_highruns, + ctl_stats.arenas[mib[2]].lstats[mib[4]].highruns, size_t) + +const ctl_node_t * +stats_arenas_i_lruns_j_index(const size_t *mib, size_t miblen, size_t j) +{ + + if (j > nlclasses) + return (NULL); + return (super_stats_arenas_i_lruns_j_node); +} + +#endif +CTL_RO_GEN(stats_arenas_i_pactive, ctl_stats.arenas[mib[2]].pactive, size_t) +CTL_RO_GEN(stats_arenas_i_pdirty, ctl_stats.arenas[mib[2]].pdirty, size_t) +#ifdef JEMALLOC_STATS +CTL_RO_GEN(stats_arenas_i_mapped, ctl_stats.arenas[mib[2]].astats.mapped, + size_t) +CTL_RO_GEN(stats_arenas_i_npurge, ctl_stats.arenas[mib[2]].astats.npurge, + uint64_t) +CTL_RO_GEN(stats_arenas_i_nmadvise, ctl_stats.arenas[mib[2]].astats.nmadvise, + uint64_t) +CTL_RO_GEN(stats_arenas_i_purged, ctl_stats.arenas[mib[2]].astats.purged, + uint64_t) +#endif + +const ctl_node_t * +stats_arenas_i_index(const size_t *mib, size_t miblen, size_t i) +{ + + if (ctl_stats.arenas[i].initialized == false) + return (NULL); + return (super_stats_arenas_i_node); +} + +#ifdef JEMALLOC_STATS +CTL_RO_GEN(stats_allocated, ctl_stats.allocated, size_t) +CTL_RO_GEN(stats_active, ctl_stats.active, size_t) +CTL_RO_GEN(stats_mapped, ctl_stats.mapped, size_t) +#endif + +/******************************************************************************/ + +#ifdef JEMALLOC_SWAP +# ifdef JEMALLOC_STATS +CTL_RO_GEN(swap_avail, ctl_stats.swap_avail, size_t) +# endif + +static int +swap_prezeroed_ctl(const size_t *mib, size_t miblen, void *oldp, + size_t *oldlenp, void *newp, size_t newlen) +{ + int ret; + + if (swap_enabled) { + READONLY(); + } else { + /* + * swap_prezeroed isn't actually used by the swap code until it + * is set during a successful chunk_swap_enabled() call. We + * use it here to store the value that we'll pass to + * chunk_swap_enable() in a swap.fds mallctl(). This is not + * very clean, but the obvious alternatives are even worse. + */ + WRITE(swap_prezeroed, bool); + } + + READ(swap_prezeroed, bool); + + ret = 0; +RETURN: + return (ret); +} + +CTL_RO_GEN(swap_nfds, swap_nfds, size_t) + +static int +swap_fds_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen) +{ + int ret; + + if (swap_enabled) { + READONLY(); + } else if (newp != NULL) { + size_t nfds = newlen / sizeof(int); + + { + int fds[nfds]; + + memcpy(fds, newp, nfds * sizeof(int)); + if (chunk_swap_enable(fds, nfds, swap_prezeroed)) { + ret = EFAULT; + goto RETURN; + } + } + } + + if (oldp != NULL && oldlenp != NULL) { + if (*oldlenp != swap_nfds * sizeof(int)) { + size_t copylen = (swap_nfds * sizeof(int) <= *oldlenp) + ? swap_nfds * sizeof(int) : *oldlenp; + + memcpy(oldp, swap_fds, copylen); + ret = EINVAL; + goto RETURN; + } else + memcpy(oldp, swap_fds, *oldlenp); + } + + ret = 0; +RETURN: + return (ret); +} +#endif diff --git a/externals/jemalloc/extent.c b/externals/jemalloc/extent.c new file mode 100644 index 0000000..3c04d3a --- /dev/null +++ b/externals/jemalloc/extent.c @@ -0,0 +1,41 @@ +#define JEMALLOC_EXTENT_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ + +#if (defined(JEMALLOC_SWAP) || defined(JEMALLOC_DSS)) +static inline int +extent_szad_comp(extent_node_t *a, extent_node_t *b) +{ + int ret; + size_t a_size = a->size; + size_t b_size = b->size; + + ret = (a_size > b_size) - (a_size < b_size); + if (ret == 0) { + uintptr_t a_addr = (uintptr_t)a->addr; + uintptr_t b_addr = (uintptr_t)b->addr; + + ret = (a_addr > b_addr) - (a_addr < b_addr); + } + + return (ret); +} + +/* Generate red-black tree functions. */ +rb_gen(, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad, + extent_szad_comp) +#endif + +static inline int +extent_ad_comp(extent_node_t *a, extent_node_t *b) +{ + uintptr_t a_addr = (uintptr_t)a->addr; + uintptr_t b_addr = (uintptr_t)b->addr; + + return ((a_addr > b_addr) - (a_addr < b_addr)); +} + +/* Generate red-black tree functions. */ +rb_gen(, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad, + extent_ad_comp) diff --git a/externals/jemalloc/hash.c b/externals/jemalloc/hash.c new file mode 100644 index 0000000..6a13d7a --- /dev/null +++ b/externals/jemalloc/hash.c @@ -0,0 +1,2 @@ +#define HASH_C_ +#include "jemalloc/internal/jemalloc_internal.h" diff --git a/externals/jemalloc/huge.c b/externals/jemalloc/huge.c new file mode 100644 index 0000000..d35aa5c --- /dev/null +++ b/externals/jemalloc/huge.c @@ -0,0 +1,298 @@ +#define JEMALLOC_HUGE_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +#ifdef JEMALLOC_STATS +uint64_t huge_nmalloc; +uint64_t huge_ndalloc; +size_t huge_allocated; +#endif + +malloc_mutex_t huge_mtx; + +/******************************************************************************/ + +/* Tree of chunks that are stand-alone huge allocations. */ +static extent_tree_t huge; + +void * +huge_malloc(size_t size, bool zero) +{ + void *ret; + size_t csize; + extent_node_t *node; + + /* Allocate one or more contiguous chunks for this request. */ + + csize = CHUNK_CEILING(size); + if (csize == 0) { + /* size is large enough to cause size_t wrap-around. */ + return (NULL); + } + + /* Allocate an extent node with which to track the chunk. */ + node = base_node_alloc(); + if (node == NULL) + return (NULL); + + ret = chunk_alloc(csize, &zero); + if (ret == NULL) { + base_node_dealloc(node); + return (NULL); + } + + /* Insert node into huge. */ + node->addr = ret; + node->size = csize; + + malloc_mutex_lock(&huge_mtx); + extent_tree_ad_insert(&huge, node); +#ifdef JEMALLOC_STATS + huge_nmalloc++; + huge_allocated += csize; +#endif + malloc_mutex_unlock(&huge_mtx); + +#ifdef JEMALLOC_FILL + if (zero == false) { + if (opt_junk) + memset(ret, 0xa5, csize); + else if (opt_zero) + memset(ret, 0, csize); + } +#endif + + return (ret); +} + +/* Only handles large allocations that require more than chunk alignment. */ +void * +huge_palloc(size_t alignment, size_t size) +{ + void *ret; + size_t alloc_size, chunk_size, offset; + extent_node_t *node; + bool zero; + + /* + * This allocation requires alignment that is even larger than chunk + * alignment. This means that huge_malloc() isn't good enough. + * + * Allocate almost twice as many chunks as are demanded by the size or + * alignment, in order to assure the alignment can be achieved, then + * unmap leading and trailing chunks. + */ + assert(alignment >= chunksize); + + chunk_size = CHUNK_CEILING(size); + + if (size >= alignment) + alloc_size = chunk_size + alignment - chunksize; + else + alloc_size = (alignment << 1) - chunksize; + + /* Allocate an extent node with which to track the chunk. */ + node = base_node_alloc(); + if (node == NULL) + return (NULL); + + zero = false; + ret = chunk_alloc(alloc_size, &zero); + if (ret == NULL) { + base_node_dealloc(node); + return (NULL); + } + + offset = (uintptr_t)ret & (alignment - 1); + assert((offset & chunksize_mask) == 0); + assert(offset < alloc_size); + if (offset == 0) { + /* Trim trailing space. */ + chunk_dealloc((void *)((uintptr_t)ret + chunk_size), alloc_size + - chunk_size); + } else { + size_t trailsize; + + /* Trim leading space. */ + chunk_dealloc(ret, alignment - offset); + + ret = (void *)((uintptr_t)ret + (alignment - offset)); + + trailsize = alloc_size - (alignment - offset) - chunk_size; + if (trailsize != 0) { + /* Trim trailing space. */ + assert(trailsize < alloc_size); + chunk_dealloc((void *)((uintptr_t)ret + chunk_size), + trailsize); + } + } + + /* Insert node into huge. */ + node->addr = ret; + node->size = chunk_size; + + malloc_mutex_lock(&huge_mtx); + extent_tree_ad_insert(&huge, node); +#ifdef JEMALLOC_STATS + huge_nmalloc++; + huge_allocated += chunk_size; +#endif + malloc_mutex_unlock(&huge_mtx); + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, chunk_size); + else if (opt_zero) + memset(ret, 0, chunk_size); +#endif + + return (ret); +} + +void * +huge_ralloc(void *ptr, size_t size, size_t oldsize) +{ + void *ret; + size_t copysize; + + /* Avoid moving the allocation if the size class would not change. */ + if (oldsize > arena_maxclass && + CHUNK_CEILING(size) == CHUNK_CEILING(oldsize)) { +#ifdef JEMALLOC_FILL + if (opt_junk && size < oldsize) { + memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize + - size); + } else if (opt_zero && size > oldsize) { + memset((void *)((uintptr_t)ptr + oldsize), 0, size + - oldsize); + } +#endif + return (ptr); + } + + /* + * If we get here, then size and oldsize are different enough that we + * need to use a different size class. In that case, fall back to + * allocating new space and copying. + */ + ret = huge_malloc(size, false); + if (ret == NULL) + return (NULL); + + copysize = (size < oldsize) ? size : oldsize; + memcpy(ret, ptr, copysize); + idalloc(ptr); + return (ret); +} + +void +huge_dalloc(void *ptr) +{ + extent_node_t *node, key; + + malloc_mutex_lock(&huge_mtx); + + /* Extract from tree of huge allocations. */ + key.addr = ptr; + node = extent_tree_ad_search(&huge, &key); + assert(node != NULL); + assert(node->addr == ptr); + extent_tree_ad_remove(&huge, node); + +#ifdef JEMALLOC_STATS + huge_ndalloc++; + huge_allocated -= node->size; +#endif + + malloc_mutex_unlock(&huge_mtx); + + /* Unmap chunk. */ +#ifdef JEMALLOC_FILL +#if (defined(JEMALLOC_SWAP) || defined(JEMALLOC_DSS)) + if (opt_junk) + memset(node->addr, 0x5a, node->size); +#endif +#endif + chunk_dealloc(node->addr, node->size); + + base_node_dealloc(node); +} + +size_t +huge_salloc(const void *ptr) +{ + size_t ret; + extent_node_t *node, key; + + malloc_mutex_lock(&huge_mtx); + + /* Extract from tree of huge allocations. */ + key.addr = __DECONST(void *, ptr); + node = extent_tree_ad_search(&huge, &key); + assert(node != NULL); + + ret = node->size; + + malloc_mutex_unlock(&huge_mtx); + + return (ret); +} + +#ifdef JEMALLOC_PROF +prof_thr_cnt_t * +huge_prof_cnt_get(const void *ptr) +{ + prof_thr_cnt_t *ret; + extent_node_t *node, key; + + malloc_mutex_lock(&huge_mtx); + + /* Extract from tree of huge allocations. */ + key.addr = __DECONST(void *, ptr); + node = extent_tree_ad_search(&huge, &key); + assert(node != NULL); + + ret = node->prof_cnt; + + malloc_mutex_unlock(&huge_mtx); + + return (ret); +} + +void +huge_prof_cnt_set(const void *ptr, prof_thr_cnt_t *cnt) +{ + extent_node_t *node, key; + + malloc_mutex_lock(&huge_mtx); + + /* Extract from tree of huge allocations. */ + key.addr = __DECONST(void *, ptr); + node = extent_tree_ad_search(&huge, &key); + assert(node != NULL); + + node->prof_cnt = cnt; + + malloc_mutex_unlock(&huge_mtx); +} +#endif + +bool +huge_boot(void) +{ + + /* Initialize chunks data. */ + if (malloc_mutex_init(&huge_mtx)) + return (true); + extent_tree_ad_new(&huge); + +#ifdef JEMALLOC_STATS + huge_nmalloc = 0; + huge_ndalloc = 0; + huge_allocated = 0; +#endif + + return (false); +} diff --git a/externals/jemalloc/jemalloc.c b/externals/jemalloc/jemalloc.c new file mode 100644 index 0000000..e01de0d --- /dev/null +++ b/externals/jemalloc/jemalloc.c @@ -0,0 +1,1349 @@ +/*- + * This allocator implementation is designed to provide scalable performance + * for multi-threaded programs on multi-processor systems. The following + * features are included for this purpose: + * + * + Multiple arenas are used if there are multiple CPUs, which reduces lock + * contention and cache sloshing. + * + * + Thread-specific caching is used if there are multiple threads, which + * reduces the amount of locking. + * + * + Cache line sharing between arenas is avoided for internal data + * structures. + * + * + Memory is managed in chunks and runs (chunks can be split into runs), + * rather than as individual pages. This provides a constant-time + * mechanism for associating allocations with particular arenas. + * + * Allocation requests are rounded up to the nearest size class, and no record + * of the original request size is maintained. Allocations are broken into + * categories according to size class. Assuming 1 MiB chunks, 4 KiB pages and + * a 16 byte quantum on a 32-bit system, the size classes in each category are + * as follows: + * + * |========================================| + * | Category | Subcategory | Size | + * |========================================| + * | Small | Tiny | 2 | + * | | | 4 | + * | | | 8 | + * | |------------------+----------| + * | | Quantum-spaced | 16 | + * | | | 32 | + * | | | 48 | + * | | | ... | + * | | | 96 | + * | | | 112 | + * | | | 128 | + * | |------------------+----------| + * | | Cacheline-spaced | 192 | + * | | | 256 | + * | | | 320 | + * | | | 384 | + * | | | 448 | + * | | | 512 | + * | |------------------+----------| + * | | Sub-page | 760 | + * | | | 1024 | + * | | | 1280 | + * | | | ... | + * | | | 3328 | + * | | | 3584 | + * | | | 3840 | + * |========================================| + * | Large | 4 KiB | + * | | 8 KiB | + * | | 12 KiB | + * | | ... | + * | | 1012 KiB | + * | | 1016 KiB | + * | | 1020 KiB | + * |========================================| + * | Huge | 1 MiB | + * | | 2 MiB | + * | | 3 MiB | + * | | ... | + * |========================================| + * + * Different mechanisms are used accoding to category: + * + * Small: Each size class is segregated into its own set of runs. Each run + * maintains a bitmap of which regions are free/allocated. + * + * Large : Each allocation is backed by a dedicated run. Metadata are stored + * in the associated arena chunk header maps. + * + * Huge : Each allocation is backed by a dedicated contiguous set of chunks. + * Metadata are stored in a separate red-black tree. + * + ******************************************************************************* + */ + +#define JEMALLOC_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +malloc_mutex_t arenas_lock; +arena_t **arenas; +unsigned narenas; +#ifndef NO_TLS +static unsigned next_arena; +#endif + +#ifndef NO_TLS +__thread arena_t *arenas_map JEMALLOC_ATTR(tls_model("initial-exec")); +#endif + +/* Set to true once the allocator has been initialized. */ +static bool malloc_initialized = false; + +/* Used to let the initializing thread recursively allocate. */ +static pthread_t malloc_initializer = (unsigned long)0; + +/* Used to avoid initialization races. */ +static malloc_mutex_t init_lock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; + +#ifdef DYNAMIC_PAGE_SHIFT +size_t pagesize; +size_t pagesize_mask; +size_t lg_pagesize; +#endif + +unsigned ncpus; + +/* Runtime configuration options. */ +const char *JEMALLOC_P(malloc_options) + JEMALLOC_ATTR(visibility("default")); +#ifdef JEMALLOC_DEBUG +bool opt_abort = true; +# ifdef JEMALLOC_FILL +bool opt_junk = true; +# endif +#else +bool opt_abort = false; +# ifdef JEMALLOC_FILL +bool opt_junk = false; +# endif +#endif +#ifdef JEMALLOC_SYSV +bool opt_sysv = false; +#endif +#ifdef JEMALLOC_XMALLOC +bool opt_xmalloc = false; +#endif +#ifdef JEMALLOC_FILL +bool opt_zero = false; +#endif +static int opt_narenas_lshift = 0; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static void wrtmessage(void *cbopaque, const char *s); +static void stats_print_atexit(void); +static unsigned malloc_ncpus(void); +static bool malloc_init_hard(void); +static void jemalloc_prefork(void); +static void jemalloc_postfork(void); + +/******************************************************************************/ +/* malloc_message() setup. */ + +#ifdef JEMALLOC_HAVE_ATTR +JEMALLOC_ATTR(visibility("hidden")) +#else +static +#endif +void +wrtmessage(void *cbopaque, const char *s) +{ + + write(STDERR_FILENO, s, strlen(s)); +} + +void (*JEMALLOC_P(malloc_message))(void *, const char *s) + JEMALLOC_ATTR(visibility("default")) = wrtmessage; + +/******************************************************************************/ +/* + * Begin miscellaneous support functions. + */ + +/* Create a new arena and insert it into the arenas array at index ind. */ +arena_t * +arenas_extend(unsigned ind) +{ + arena_t *ret; + + /* Allocate enough space for trailing bins. */ + ret = (arena_t *)base_alloc(sizeof(arena_t) + + (sizeof(arena_bin_t) * (nbins - 1))); + if (ret != NULL && arena_new(ret, ind) == false) { + arenas[ind] = ret; + return (ret); + } + /* Only reached if there is an OOM error. */ + + /* + * OOM here is quite inconvenient to propagate, since dealing with it + * would require a check for failure in the fast path. Instead, punt + * by using arenas[0]. In practice, this is an extremely unlikely + * failure. + */ + malloc_write(": Error initializing arena\n"); + if (opt_abort) + abort(); + + return (arenas[0]); +} + +#ifndef NO_TLS +/* + * Choose an arena based on a per-thread value (slow-path code only, called + * only by choose_arena()). + */ +arena_t * +choose_arena_hard(void) +{ + arena_t *ret; + + if (narenas > 1) { + malloc_mutex_lock(&arenas_lock); + if ((ret = arenas[next_arena]) == NULL) + ret = arenas_extend(next_arena); + next_arena = (next_arena + 1) % narenas; + malloc_mutex_unlock(&arenas_lock); + } else + ret = arenas[0]; + + arenas_map = ret; + + return (ret); +} +#endif + +static void +stats_print_atexit(void) +{ + +#if (defined(JEMALLOC_TCACHE) && defined(JEMALLOC_STATS)) + unsigned i; + + /* + * Merge stats from extant threads. This is racy, since individual + * threads do not lock when recording tcache stats events. As a + * consequence, the final stats may be slightly out of date by the time + * they are reported, if other threads continue to allocate. + */ + for (i = 0; i < narenas; i++) { + arena_t *arena = arenas[i]; + if (arena != NULL) { + tcache_t *tcache; + + /* + * tcache_stats_merge() locks bins, so if any code is + * introduced that acquires both arena and bin locks in + * the opposite order, deadlocks may result. + */ + malloc_mutex_lock(&arena->lock); + ql_foreach(tcache, &arena->tcache_ql, link) { + tcache_stats_merge(tcache, arena); + } + malloc_mutex_unlock(&arena->lock); + } + } +#endif + JEMALLOC_P(malloc_stats_print)(NULL, NULL, NULL); +} + +/* + * End miscellaneous support functions. + */ +/******************************************************************************/ +/* + * Begin initialization functions. + */ + +static unsigned +malloc_ncpus(void) +{ + unsigned ret; + long result; + + result = sysconf(_SC_NPROCESSORS_ONLN); + if (result == -1) { + /* Error. */ + ret = 1; + } + ret = (unsigned)result; + + return (ret); +} + +/* + * FreeBSD's pthreads implementation calls malloc(3), so the malloc + * implementation has to take pains to avoid infinite recursion during + * initialization. + */ +static inline bool +malloc_init(void) +{ + + if (malloc_initialized == false) + return (malloc_init_hard()); + + return (false); +} + +static bool +malloc_init_hard(void) +{ + unsigned i; + int linklen; + char buf[PATH_MAX + 1]; + const char *opts; + arena_t *init_arenas[1]; + + malloc_mutex_lock(&init_lock); + if (malloc_initialized || malloc_initializer == pthread_self()) { + /* + * Another thread initialized the allocator before this one + * acquired init_lock, or this thread is the initializing + * thread, and it is recursively allocating. + */ + malloc_mutex_unlock(&init_lock); + return (false); + } + if (malloc_initializer != (unsigned long)0) { + /* Busy-wait until the initializing thread completes. */ + do { + malloc_mutex_unlock(&init_lock); + CPU_SPINWAIT; + malloc_mutex_lock(&init_lock); + } while (malloc_initialized == false); + return (false); + } + +#ifdef DYNAMIC_PAGE_SHIFT + /* Get page size. */ + { + long result; + + result = sysconf(_SC_PAGESIZE); + assert(result != -1); + pagesize = (unsigned)result; + + /* + * We assume that pagesize is a power of 2 when calculating + * pagesize_mask and lg_pagesize. + */ + assert(((result - 1) & result) == 0); + pagesize_mask = result - 1; + lg_pagesize = ffs((int)result) - 1; + } +#endif + + for (i = 0; i < 3; i++) { + unsigned j; + + /* Get runtime configuration. */ + switch (i) { + case 0: + if ((linklen = readlink("/etc/jemalloc.conf", buf, + sizeof(buf) - 1)) != -1) { + /* + * Use the contents of the "/etc/jemalloc.conf" + * symbolic link's name. + */ + buf[linklen] = '\0'; + opts = buf; + } else { + /* No configuration specified. */ + buf[0] = '\0'; + opts = buf; + } + break; + case 1: + if ((opts = getenv("JEMALLOC_OPTIONS")) != NULL) { + /* + * Do nothing; opts is already initialized to + * the value of the JEMALLOC_OPTIONS + * environment variable. + */ + } else { + /* No configuration specified. */ + buf[0] = '\0'; + opts = buf; + } + break; + case 2: + if (JEMALLOC_P(malloc_options) != NULL) { + /* + * Use options that were compiled into the + * program. + */ + opts = JEMALLOC_P(malloc_options); + } else { + /* No configuration specified. */ + buf[0] = '\0'; + opts = buf; + } + break; + default: + /* NOTREACHED */ + assert(false); + buf[0] = '\0'; + opts = buf; + } + + for (j = 0; opts[j] != '\0'; j++) { + unsigned k, nreps; + bool nseen; + + /* Parse repetition count, if any. */ + for (nreps = 0, nseen = false;; j++, nseen = true) { + switch (opts[j]) { + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': + nreps *= 10; + nreps += opts[j] - '0'; + break; + default: + goto MALLOC_OUT; + } + } +MALLOC_OUT: + if (nseen == false) + nreps = 1; + + for (k = 0; k < nreps; k++) { + switch (opts[j]) { + case 'a': + opt_abort = false; + break; + case 'A': + opt_abort = true; + break; +#ifdef JEMALLOC_PROF + case 'b': + if (opt_lg_prof_bt_max > 0) + opt_lg_prof_bt_max--; + break; + case 'B': + if (opt_lg_prof_bt_max < LG_PROF_BT_MAX) + opt_lg_prof_bt_max++; + break; +#endif + case 'c': + if (opt_lg_cspace_max - 1 > + opt_lg_qspace_max && + opt_lg_cspace_max > + LG_CACHELINE) + opt_lg_cspace_max--; + break; + case 'C': + if (opt_lg_cspace_max < PAGE_SHIFT + - 1) + opt_lg_cspace_max++; + break; + case 'd': + if (opt_lg_dirty_mult + 1 < + (sizeof(size_t) << 3)) + opt_lg_dirty_mult++; + break; + case 'D': + if (opt_lg_dirty_mult >= 0) + opt_lg_dirty_mult--; + break; +#ifdef JEMALLOC_PROF + case 'e': + opt_prof_active = false; + break; + case 'E': + opt_prof_active = true; + break; + case 'f': + opt_prof = false; + break; + case 'F': + opt_prof = true; + break; +#endif +#ifdef JEMALLOC_TCACHE + case 'g': + if (opt_lg_tcache_gc_sweep >= 0) + opt_lg_tcache_gc_sweep--; + break; + case 'G': + if (opt_lg_tcache_gc_sweep + 1 < + (sizeof(size_t) << 3)) + opt_lg_tcache_gc_sweep++; + break; + case 'h': + opt_tcache = false; + break; + case 'H': + opt_tcache = true; + break; +#endif +#ifdef JEMALLOC_PROF + case 'i': + if (opt_lg_prof_interval >= 0) + opt_lg_prof_interval--; + break; + case 'I': + if (opt_lg_prof_interval + 1 < + (sizeof(uint64_t) << 3)) + opt_lg_prof_interval++; + break; +#endif +#ifdef JEMALLOC_FILL + case 'j': + opt_junk = false; + break; + case 'J': + opt_junk = true; + break; +#endif + case 'k': + /* + * Chunks always require at least one + * header page, plus one data page. + */ + if ((1U << (opt_lg_chunk - 1)) >= + (2U << PAGE_SHIFT)) + opt_lg_chunk--; + break; + case 'K': + if (opt_lg_chunk + 1 < + (sizeof(size_t) << 3)) + opt_lg_chunk++; + break; +#ifdef JEMALLOC_PROF + case 'l': + opt_prof_leak = false; + break; + case 'L': + opt_prof_leak = true; + break; +#endif +#ifdef JEMALLOC_TCACHE + case 'm': + if (opt_lg_tcache_maxclass >= 0) + opt_lg_tcache_maxclass--; + break; + case 'M': + if (opt_lg_tcache_maxclass + 1 < + (sizeof(size_t) << 3)) + opt_lg_tcache_maxclass++; + break; +#endif + case 'n': + opt_narenas_lshift--; + break; + case 'N': + opt_narenas_lshift++; + break; +#ifdef JEMALLOC_SWAP + case 'o': + opt_overcommit = false; + break; + case 'O': + opt_overcommit = true; + break; +#endif + case 'p': + opt_stats_print = false; + break; + case 'P': + opt_stats_print = true; + break; + case 'q': + if (opt_lg_qspace_max > LG_QUANTUM) + opt_lg_qspace_max--; + break; + case 'Q': + if (opt_lg_qspace_max + 1 < + opt_lg_cspace_max) + opt_lg_qspace_max++; + break; +#ifdef JEMALLOC_PROF + case 's': + if (opt_lg_prof_sample > 0) + opt_lg_prof_sample--; + break; + case 'S': + if (opt_lg_prof_sample + 1 < + (sizeof(uint64_t) << 3)) + opt_lg_prof_sample++; + break; + case 'u': + opt_prof_udump = false; + break; + case 'U': + opt_prof_udump = true; + break; +#endif +#ifdef JEMALLOC_SYSV + case 'v': + opt_sysv = false; + break; + case 'V': + opt_sysv = true; + break; +#endif +#ifdef JEMALLOC_XMALLOC + case 'x': + opt_xmalloc = false; + break; + case 'X': + opt_xmalloc = true; + break; +#endif +#ifdef JEMALLOC_FILL + case 'z': + opt_zero = false; + break; + case 'Z': + opt_zero = true; + break; +#endif + default: { + char cbuf[2]; + + cbuf[0] = opts[j]; + cbuf[1] = '\0'; + malloc_write( + ": Unsupported character " + "in malloc options: '"); + malloc_write(cbuf); + malloc_write("'\n"); + } + } + } + } + } + + /* Register fork handlers. */ + if (pthread_atfork(jemalloc_prefork, jemalloc_postfork, + jemalloc_postfork) != 0) { + malloc_write(": Error in pthread_atfork()\n"); + if (opt_abort) + abort(); + } + + if (ctl_boot()) { + malloc_mutex_unlock(&init_lock); + return (true); + } + + if (opt_stats_print) { + /* Print statistics at exit. */ + if (atexit(stats_print_atexit) != 0) { + malloc_write(": Error in atexit()\n"); + if (opt_abort) + abort(); + } + } + + if (chunk_boot()) { + malloc_mutex_unlock(&init_lock); + return (true); + } + + if (base_boot()) { + malloc_mutex_unlock(&init_lock); + return (true); + } + +#ifdef JEMALLOC_PROF + prof_boot0(); +#endif + + if (arena_boot()) { + malloc_mutex_unlock(&init_lock); + return (true); + } + +#ifdef JEMALLOC_TCACHE + tcache_boot(); +#endif + + if (huge_boot()) { + malloc_mutex_unlock(&init_lock); + return (true); + } + + /* + * Create enough scaffolding to allow recursive allocation in + * malloc_ncpus(). + */ + narenas = 1; + arenas = init_arenas; + memset(arenas, 0, sizeof(arena_t *) * narenas); + + /* + * Initialize one arena here. The rest are lazily created in + * choose_arena_hard(). + */ + arenas_extend(0); + if (arenas[0] == NULL) { + malloc_mutex_unlock(&init_lock); + return (true); + } + +#ifndef NO_TLS + /* + * Assign the initial arena to the initial thread, in order to avoid + * spurious creation of an extra arena if the application switches to + * threaded mode. + */ + arenas_map = arenas[0]; +#endif + + malloc_mutex_init(&arenas_lock); + +#ifdef JEMALLOC_PROF + if (prof_boot1()) { + malloc_mutex_unlock(&init_lock); + return (true); + } +#endif + + /* Get number of CPUs. */ + malloc_initializer = pthread_self(); + malloc_mutex_unlock(&init_lock); + ncpus = malloc_ncpus(); + malloc_mutex_lock(&init_lock); + + if (ncpus > 1) { + /* + * For SMP systems, create more than one arena per CPU by + * default. + */ + opt_narenas_lshift += 2; + } + + /* Determine how many arenas to use. */ + narenas = ncpus; + if (opt_narenas_lshift > 0) { + if ((narenas << opt_narenas_lshift) > narenas) + narenas <<= opt_narenas_lshift; + /* + * Make sure not to exceed the limits of what base_alloc() can + * handle. + */ + if (narenas * sizeof(arena_t *) > chunksize) + narenas = chunksize / sizeof(arena_t *); + } else if (opt_narenas_lshift < 0) { + if ((narenas >> -opt_narenas_lshift) < narenas) + narenas >>= -opt_narenas_lshift; + /* Make sure there is at least one arena. */ + if (narenas == 0) + narenas = 1; + } + +#ifdef NO_TLS + if (narenas > 1) { + static const unsigned primes[] = {1, 3, 5, 7, 11, 13, 17, 19, + 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, + 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, + 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, + 223, 227, 229, 233, 239, 241, 251, 257, 263}; + unsigned nprimes, parenas; + + /* + * Pick a prime number of hash arenas that is more than narenas + * so that direct hashing of pthread_self() pointers tends to + * spread allocations evenly among the arenas. + */ + assert((narenas & 1) == 0); /* narenas must be even. */ + nprimes = (sizeof(primes) >> LG_SIZEOF_INT); + parenas = primes[nprimes - 1]; /* In case not enough primes. */ + for (i = 1; i < nprimes; i++) { + if (primes[i] > narenas) { + parenas = primes[i]; + break; + } + } + narenas = parenas; + } +#endif + +#ifndef NO_TLS + next_arena = 0; +#endif + + /* Allocate and initialize arenas. */ + arenas = (arena_t **)base_alloc(sizeof(arena_t *) * narenas); + if (arenas == NULL) { + malloc_mutex_unlock(&init_lock); + return (true); + } + /* + * Zero the array. In practice, this should always be pre-zeroed, + * since it was just mmap()ed, but let's be sure. + */ + memset(arenas, 0, sizeof(arena_t *) * narenas); + /* Copy the pointer to the one arena that was already initialized. */ + arenas[0] = init_arenas[0]; + + malloc_initialized = true; + malloc_mutex_unlock(&init_lock); + return (false); +} + +/* + * End initialization functions. + */ +/******************************************************************************/ +/* + * Begin malloc(3)-compatible functions. + */ + +JEMALLOC_ATTR(malloc) +JEMALLOC_ATTR(visibility("default")) +void * +JEMALLOC_P(malloc)(size_t size) +{ + void *ret; +#ifdef JEMALLOC_PROF + prof_thr_cnt_t *cnt; +#endif + + if (malloc_init()) { + ret = NULL; + goto OOM; + } + + if (size == 0) { +#ifdef JEMALLOC_SYSV + if (opt_sysv == false) +#endif + size = 1; +#ifdef JEMALLOC_SYSV + else { +# ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in malloc(): " + "invalid size 0\n"); + abort(); + } +# endif + ret = NULL; + goto RETURN; + } +#endif + } + +#ifdef JEMALLOC_PROF + if (opt_prof) { + if ((cnt = prof_alloc_prep(size)) == NULL) { + ret = NULL; + goto OOM; + } + if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && size <= + small_maxclass) { + ret = imalloc(small_maxclass+1); + if (ret != NULL) + arena_prof_promoted(ret, size); + } else + ret = imalloc(size); + } else +#endif + ret = imalloc(size); + +OOM: + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in malloc(): " + "out of memory\n"); + abort(); + } +#endif + errno = ENOMEM; + } + +#ifdef JEMALLOC_SYSV +RETURN: +#endif +#ifdef JEMALLOC_PROF + if (opt_prof && ret != NULL) + prof_malloc(ret, cnt); +#endif + return (ret); +} + +JEMALLOC_ATTR(nonnull(1)) +JEMALLOC_ATTR(visibility("default")) +int +JEMALLOC_P(posix_memalign)(void **memptr, size_t alignment, size_t size) +{ + int ret; + void *result; +#ifdef JEMALLOC_PROF + prof_thr_cnt_t *cnt; +#endif + + if (malloc_init()) + result = NULL; + else { + if (size == 0) { +#ifdef JEMALLOC_SYSV + if (opt_sysv == false) +#endif + size = 1; +#ifdef JEMALLOC_SYSV + else { +# ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in " + "posix_memalign(): invalid size " + "0\n"); + abort(); + } +# endif + result = NULL; + *memptr = NULL; + ret = 0; + goto RETURN; + } +#endif + } + + /* Make sure that alignment is a large enough power of 2. */ + if (((alignment - 1) & alignment) != 0 + || alignment < sizeof(void *)) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in " + "posix_memalign(): invalid alignment\n"); + abort(); + } +#endif + result = NULL; + ret = EINVAL; + goto RETURN; + } + +#ifdef JEMALLOC_PROF + if (opt_prof) { + if ((cnt = prof_alloc_prep(size)) == NULL) { + result = NULL; + ret = EINVAL; + } else { + if (prof_promote && (uintptr_t)cnt != + (uintptr_t)1U && size <= small_maxclass) { + result = ipalloc(alignment, + small_maxclass+1); + if (result != NULL) { + arena_prof_promoted(result, + size); + } + } else + result = ipalloc(alignment, size); + } + } else +#endif + result = ipalloc(alignment, size); + } + + if (result == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in posix_memalign(): " + "out of memory\n"); + abort(); + } +#endif + ret = ENOMEM; + goto RETURN; + } + + *memptr = result; + ret = 0; + +RETURN: +#ifdef JEMALLOC_PROF + if (opt_prof && result != NULL) + prof_malloc(result, cnt); +#endif + return (ret); +} + +JEMALLOC_ATTR(malloc) +JEMALLOC_ATTR(visibility("default")) +void * +JEMALLOC_P(calloc)(size_t num, size_t size) +{ + void *ret; + size_t num_size; +#ifdef JEMALLOC_PROF + prof_thr_cnt_t *cnt; +#endif + + if (malloc_init()) { + num_size = 0; + ret = NULL; + goto RETURN; + } + + num_size = num * size; + if (num_size == 0) { +#ifdef JEMALLOC_SYSV + if ((opt_sysv == false) && ((num == 0) || (size == 0))) +#endif + num_size = 1; +#ifdef JEMALLOC_SYSV + else { + ret = NULL; + goto RETURN; + } +#endif + /* + * Try to avoid division here. We know that it isn't possible to + * overflow during multiplication if neither operand uses any of the + * most significant half of the bits in a size_t. + */ + } else if (((num | size) & (SIZE_T_MAX << (sizeof(size_t) << 2))) + && (num_size / size != num)) { + /* size_t overflow. */ + ret = NULL; + goto RETURN; + } + +#ifdef JEMALLOC_PROF + if (opt_prof) { + if ((cnt = prof_alloc_prep(num_size)) == NULL) { + ret = NULL; + goto RETURN; + } + if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && num_size + <= small_maxclass) { + ret = icalloc(small_maxclass+1); + if (ret != NULL) + arena_prof_promoted(ret, num_size); + } else + ret = icalloc(num_size); + } else +#endif + ret = icalloc(num_size); + +RETURN: + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in calloc(): out of " + "memory\n"); + abort(); + } +#endif + errno = ENOMEM; + } + +#ifdef JEMALLOC_PROF + if (opt_prof && ret != NULL) + prof_malloc(ret, cnt); +#endif + return (ret); +} + +JEMALLOC_ATTR(visibility("default")) +void * +JEMALLOC_P(realloc)(void *ptr, size_t size) +{ + void *ret; +#ifdef JEMALLOC_PROF + size_t old_size; + prof_thr_cnt_t *cnt, *old_cnt; +#endif + + if (size == 0) { +#ifdef JEMALLOC_SYSV + if (opt_sysv == false) +#endif + size = 1; +#ifdef JEMALLOC_SYSV + else { + if (ptr != NULL) { +#ifdef JEMALLOC_PROF + if (opt_prof) { + old_size = isalloc(ptr); + old_cnt = prof_cnt_get(ptr); + cnt = NULL; + } +#endif + idalloc(ptr); + } +#ifdef JEMALLOC_PROF + else if (opt_prof) { + old_size = 0; + old_cnt = NULL; + cnt = NULL; + } +#endif + ret = NULL; + goto RETURN; + } +#endif + } + + if (ptr != NULL) { + assert(malloc_initialized || malloc_initializer == + pthread_self()); + +#ifdef JEMALLOC_PROF + if (opt_prof) { + old_size = isalloc(ptr); + old_cnt = prof_cnt_get(ptr); + if ((cnt = prof_alloc_prep(size)) == NULL) { + ret = NULL; + goto OOM; + } + if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && + size <= small_maxclass) { + ret = iralloc(ptr, small_maxclass+1); + if (ret != NULL) + arena_prof_promoted(ret, size); + } else + ret = iralloc(ptr, size); + } else +#endif + ret = iralloc(ptr, size); + +#ifdef JEMALLOC_PROF +OOM: +#endif + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in realloc(): " + "out of memory\n"); + abort(); + } +#endif + errno = ENOMEM; + } + } else { +#ifdef JEMALLOC_PROF + if (opt_prof) { + old_size = 0; + old_cnt = NULL; + } +#endif + if (malloc_init()) { +#ifdef JEMALLOC_PROF + if (opt_prof) + cnt = NULL; +#endif + ret = NULL; + } else { +#ifdef JEMALLOC_PROF + if (opt_prof) { + if ((cnt = prof_alloc_prep(size)) == NULL) + ret = NULL; + else { + if (prof_promote && (uintptr_t)cnt != + (uintptr_t)1U && size <= + small_maxclass) { + ret = imalloc(small_maxclass+1); + if (ret != NULL) { + arena_prof_promoted(ret, + size); + } + } else + ret = imalloc(size); + } + } else +#endif + ret = imalloc(size); + } + + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + malloc_write(": Error in realloc(): " + "out of memory\n"); + abort(); + } +#endif + errno = ENOMEM; + } + } + +#ifdef JEMALLOC_SYSV +RETURN: +#endif +#ifdef JEMALLOC_PROF + if (opt_prof) + prof_realloc(ret, cnt, ptr, old_size, old_cnt); +#endif + return (ret); +} + +JEMALLOC_ATTR(visibility("default")) +void +JEMALLOC_P(free)(void *ptr) +{ + + if (ptr != NULL) { + assert(malloc_initialized || malloc_initializer == + pthread_self()); + +#ifdef JEMALLOC_PROF + if (opt_prof) + prof_free(ptr); +#endif + idalloc(ptr); + } +} + +/* + * End malloc(3)-compatible functions. + */ +/******************************************************************************/ +/* + * Begin non-standard functions. + */ + +JEMALLOC_ATTR(visibility("default")) +size_t +JEMALLOC_P(malloc_usable_size)(const void *ptr) +{ + size_t ret; + + assert(ptr != NULL); + ret = isalloc(ptr); + + return (ret); +} + +#ifdef JEMALLOC_SWAP +JEMALLOC_ATTR(visibility("default")) +int +JEMALLOC_P(malloc_swap_enable)(const int *fds, unsigned nfds, int prezeroed) +{ + + /* + * Make sure malloc is initialized, because we need page size, chunk + * size, etc. + */ + if (malloc_init()) + return (-1); + + return (chunk_swap_enable(fds, nfds, (prezeroed != 0)) ? -1 : 0); +} +#endif + +JEMALLOC_ATTR(visibility("default")) +void +JEMALLOC_P(malloc_stats_print)(void (*write_cb)(void *, const char *), + void *cbopaque, const char *opts) +{ + + stats_print(write_cb, cbopaque, opts); +} + +JEMALLOC_ATTR(visibility("default")) +int +JEMALLOC_P(mallctl)(const char *name, void *oldp, size_t *oldlenp, void *newp, + size_t newlen) +{ + + if (malloc_init()) + return (EAGAIN); + + return (ctl_byname(name, oldp, oldlenp, newp, newlen)); +} + +JEMALLOC_ATTR(visibility("default")) +int +JEMALLOC_P(mallctlnametomib)(const char *name, size_t *mibp, size_t *miblenp) +{ + + if (malloc_init()) + return (EAGAIN); + + return (ctl_nametomib(name, mibp, miblenp)); +} + +JEMALLOC_ATTR(visibility("default")) +int +JEMALLOC_P(mallctlbymib)(const size_t *mib, size_t miblen, void *oldp, + size_t *oldlenp, void *newp, size_t newlen) +{ + + if (malloc_init()) + return (EAGAIN); + + return (ctl_bymib(mib, miblen, oldp, oldlenp, newp, newlen)); +} + +/* + * End non-standard functions. + */ +/******************************************************************************/ + +/* + * The following functions are used by threading libraries for protection of + * malloc during fork(). These functions are only called if the program is + * running in threaded mode, so there is no need to check whether the program + * is threaded here. + */ + +static void +jemalloc_prefork(void) +{ + unsigned i; + + /* Acquire all mutexes in a safe order. */ + + malloc_mutex_lock(&arenas_lock); + for (i = 0; i < narenas; i++) { + if (arenas[i] != NULL) + malloc_mutex_lock(&arenas[i]->lock); + } + + malloc_mutex_lock(&base_mtx); + + malloc_mutex_lock(&huge_mtx); + +#ifdef JEMALLOC_DSS + malloc_mutex_lock(&dss_mtx); +#endif + +#ifdef JEMALLOC_SWAP + malloc_mutex_lock(&swap_mtx); +#endif +} + +static void +jemalloc_postfork(void) +{ + unsigned i; + + /* Release all mutexes, now that fork() has completed. */ + +#ifdef JEMALLOC_SWAP + malloc_mutex_unlock(&swap_mtx); +#endif + +#ifdef JEMALLOC_DSS + malloc_mutex_unlock(&dss_mtx); +#endif + + malloc_mutex_unlock(&huge_mtx); + + malloc_mutex_unlock(&base_mtx); + + for (i = 0; i < narenas; i++) { + if (arenas[i] != NULL) + malloc_mutex_unlock(&arenas[i]->lock); + } + malloc_mutex_unlock(&arenas_lock); +} diff --git a/externals/jemalloc/jemalloc/internal/arena.h b/externals/jemalloc/jemalloc/internal/arena.h new file mode 100644 index 0000000..bb4ce2a --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/arena.h @@ -0,0 +1,537 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +/* + * Subpages are an artificially designated partitioning of pages. Their only + * purpose is to support subpage-spaced size classes. + * + * There must be at least 4 subpages per page, due to the way size classes are + * handled. + */ +#define LG_SUBPAGE 8 +#define SUBPAGE ((size_t)(1U << LG_SUBPAGE)) +#define SUBPAGE_MASK (SUBPAGE - 1) + +/* Return the smallest subpage multiple that is >= s. */ +#define SUBPAGE_CEILING(s) \ + (((s) + SUBPAGE_MASK) & ~SUBPAGE_MASK) + +#ifdef JEMALLOC_TINY + /* Smallest size class to support. */ +# define LG_TINY_MIN LG_SIZEOF_PTR +#endif + +/* + * Maximum size class that is a multiple of the quantum, but not (necessarily) + * a power of 2. Above this size, allocations are rounded up to the nearest + * power of 2. + */ +#define LG_QSPACE_MAX_DEFAULT 7 + +/* + * Maximum size class that is a multiple of the cacheline, but not (necessarily) + * a power of 2. Above this size, allocations are rounded up to the nearest + * power of 2. + */ +#define LG_CSPACE_MAX_DEFAULT 9 + +/* + * RUN_MAX_OVRHD indicates maximum desired run header overhead. Runs are sized + * as small as possible such that this setting is still honored, without + * violating other constraints. The goal is to make runs as small as possible + * without exceeding a per run external fragmentation threshold. + * + * We use binary fixed point math for overhead computations, where the binary + * point is implicitly RUN_BFP bits to the left. + * + * Note that it is possible to set RUN_MAX_OVRHD low enough that it cannot be + * honored for some/all object sizes, since there is one bit of header overhead + * per object (plus a constant). This constraint is relaxed (ignored) for runs + * that are so small that the per-region overhead is greater than: + * + * (RUN_MAX_OVRHD / (reg_size << (3+RUN_BFP)) + */ +#define RUN_BFP 12 +/* \/ Implicit binary fixed point. */ +#define RUN_MAX_OVRHD 0x0000003dU +#define RUN_MAX_OVRHD_RELAX 0x00001800U + +/* + * The minimum ratio of active:dirty pages per arena is computed as: + * + * (nactive >> opt_lg_dirty_mult) >= ndirty + * + * So, supposing that opt_lg_dirty_mult is 5, there can be no less than 32 + * times as many active pages as dirty pages. + */ +#define LG_DIRTY_MULT_DEFAULT 5 + +typedef struct arena_chunk_map_s arena_chunk_map_t; +typedef struct arena_chunk_s arena_chunk_t; +typedef struct arena_run_s arena_run_t; +typedef struct arena_bin_s arena_bin_t; +typedef struct arena_s arena_t; + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +/* Each element of the chunk map corresponds to one page within the chunk. */ +struct arena_chunk_map_s { + union { + /* + * Linkage for run trees. There are two disjoint uses: + * + * 1) arena_t's runs_avail_{clean,dirty} trees. + * 2) arena_run_t conceptually uses this linkage for in-use + * non-full runs, rather than directly embedding linkage. + */ + rb_node(arena_chunk_map_t) rb_link; + /* + * List of runs currently in purgatory. arena_chunk_purge() + * temporarily allocates runs that contain dirty pages while + * purging, so that other threads cannot use the runs while the + * purging thread is operating without the arena lock held. + */ + ql_elm(arena_chunk_map_t) ql_link; + } u; + +#ifdef JEMALLOC_PROF + /* Profile counters, used for large object runs. */ + prof_thr_cnt_t *prof_cnt; +#endif + + /* + * Run address (or size) and various flags are stored together. The bit + * layout looks like (assuming 32-bit system): + * + * ???????? ???????? ????---- ----dzla + * + * ? : Unallocated: Run address for first/last pages, unset for internal + * pages. + * Small: Run page offset. + * Large: Run size for first page, unset for trailing pages. + * - : Unused. + * d : dirty? + * z : zeroed? + * l : large? + * a : allocated? + * + * Following are example bit patterns for the three types of runs. + * + * p : run page offset + * s : run size + * c : size class (used only if prof_promote is true) + * x : don't care + * - : 0 + * + : 1 + * [DZLA] : bit set + * [dzla] : bit unset + * + * Unallocated (clean): + * ssssssss ssssssss ssss---- ----dz-- + * xxxxxxxx xxxxxxxx xxxx---- -----Zxx + * ssssssss ssssssss ssss---- ----dZ-- + * + * Unallocated (dirty): + * ssssssss ssssssss ssss---- ----D--- + * xxxxxxxx xxxxxxxx xxxx---- ----xxxx + * ssssssss ssssssss ssss---- ----D--- + * + * Small: + * pppppppp pppppppp pppp---- ----d--a + * pppppppp pppppppp pppp---- -------a + * pppppppp pppppppp pppp---- ----d--a + * + * Large: + * ssssssss ssssssss ssss++++ ++++D-la + * xxxxxxxx xxxxxxxx xxxx---- ----xxxx + * -------- -------- -------- ----D-la + * + * Large (sampled, size <= PAGE_SIZE): + * ssssssss ssssssss sssscccc ccccD-la + * + * Large (not sampled, size == PAGE_SIZE): + * ssssssss ssssssss ssss++++ ++++D-la + */ + size_t bits; +#ifdef JEMALLOC_PROF +#define CHUNK_MAP_CLASS_SHIFT 4 +#define CHUNK_MAP_CLASS_MASK ((size_t)0xff0U) +#endif +#define CHUNK_MAP_FLAGS_MASK ((size_t)0xfU) +#define CHUNK_MAP_DIRTY ((size_t)0x8U) +#define CHUNK_MAP_ZEROED ((size_t)0x4U) +#define CHUNK_MAP_LARGE ((size_t)0x2U) +#define CHUNK_MAP_ALLOCATED ((size_t)0x1U) +#define CHUNK_MAP_KEY CHUNK_MAP_ALLOCATED +}; +typedef rb_tree(arena_chunk_map_t) arena_avail_tree_t; +typedef rb_tree(arena_chunk_map_t) arena_run_tree_t; + +/* Arena chunk header. */ +struct arena_chunk_s { + /* Arena that owns the chunk. */ + arena_t *arena; + + /* Linkage for the arena's chunks_dirty list. */ + ql_elm(arena_chunk_t) link_dirty; + + /* + * True if the chunk is currently in the chunks_dirty list, due to + * having at some point contained one or more dirty pages. Removal + * from chunks_dirty is lazy, so (dirtied && ndirty == 0) is possible. + */ + bool dirtied; + + /* Number of dirty pages. */ + size_t ndirty; + + /* Map of pages within chunk that keeps track of free/large/small. */ + arena_chunk_map_t map[1]; /* Dynamically sized. */ +}; +typedef rb_tree(arena_chunk_t) arena_chunk_tree_t; + +struct arena_run_s { +#ifdef JEMALLOC_DEBUG + uint32_t magic; +# define ARENA_RUN_MAGIC 0x384adf93 +#endif + + /* Bin this run is associated with. */ + arena_bin_t *bin; + + /* Stack of available freed regions, or NULL. */ + void *avail; + + /* Next region that has never been allocated, or run boundary. */ + void *next; + + /* Number of free regions in run. */ + unsigned nfree; +}; + +struct arena_bin_s { + /* + * All operations on runcur, runs, and stats require that lock be + * locked. Run allocation/deallocation are protected by the arena lock, + * which may be acquired while holding one or more bin locks, but not + * vise versa. + */ + malloc_mutex_t lock; + + /* + * Current run being used to service allocations of this bin's size + * class. + */ + arena_run_t *runcur; + + /* + * Tree of non-full runs. This tree is used when looking for an + * existing run when runcur is no longer usable. We choose the + * non-full run that is lowest in memory; this policy tends to keep + * objects packed well, and it can also help reduce the number of + * almost-empty chunks. + */ + arena_run_tree_t runs; + + /* Size of regions in a run for this bin's size class. */ + size_t reg_size; + + /* Total size of a run for this bin's size class. */ + size_t run_size; + + /* Total number of regions in a run for this bin's size class. */ + uint32_t nregs; + +#ifdef JEMALLOC_PROF + /* + * Offset of first (prof_cnt_t *) in a run header for this bin's size + * class, or 0 if (opt_prof == false). + */ + uint32_t cnt0_offset; +#endif + + /* Offset of first region in a run for this bin's size class. */ + uint32_t reg0_offset; + +#ifdef JEMALLOC_STATS + /* Bin statistics. */ + malloc_bin_stats_t stats; +#endif +}; + +struct arena_s { +#ifdef JEMALLOC_DEBUG + uint32_t magic; +# define ARENA_MAGIC 0x947d3d24 +#endif + + /* This arena's index within the arenas array. */ + unsigned ind; + + /* + * All non-bin-related operations on this arena require that lock be + * locked. + */ + malloc_mutex_t lock; + +#ifdef JEMALLOC_STATS + arena_stats_t stats; +# ifdef JEMALLOC_TCACHE + /* + * List of tcaches for extant threads associated with this arena. + * Stats from these are merged incrementally, and at exit. + */ + ql_head(tcache_t) tcache_ql; +# endif +#endif + +#ifdef JEMALLOC_PROF + uint64_t prof_accumbytes; +#endif + + /* List of dirty-page-containing chunks this arena manages. */ + ql_head(arena_chunk_t) chunks_dirty; + + /* + * In order to avoid rapid chunk allocation/deallocation when an arena + * oscillates right on the cusp of needing a new chunk, cache the most + * recently freed chunk. The spare is left in the arena's chunk trees + * until it is deleted. + * + * There is one spare chunk per arena, rather than one spare total, in + * order to avoid interactions between multiple threads that could make + * a single spare inadequate. + */ + arena_chunk_t *spare; + + /* Number of pages in active runs. */ + size_t nactive; + + /* + * Current count of pages within unused runs that are potentially + * dirty, and for which madvise(... MADV_DONTNEED) has not been called. + * By tracking this, we can institute a limit on how much dirty unused + * memory is mapped for each arena. + */ + size_t ndirty; + + /* + * Approximate number of pages being purged. It is possible for + * multiple threads to purge dirty pages concurrently, and they use + * npurgatory to indicate the total number of pages all threads are + * attempting to purge. + */ + size_t npurgatory; + + /* + * Size/address-ordered trees of this arena's available runs. The trees + * are used for first-best-fit run allocation. The dirty tree contains + * runs with dirty pages (i.e. very likely to have been touched and + * therefore have associated physical pages), whereas the clean tree + * contains runs with pages that either have no associated physical + * pages, or have pages that the kernel may recycle at any time due to + * previous madvise(2) calls. The dirty tree is used in preference to + * the clean tree for allocations, because using dirty pages reduces + * the amount of dirty purging necessary to keep the active:dirty page + * ratio below the purge threshold. + */ + arena_avail_tree_t runs_avail_clean; + arena_avail_tree_t runs_avail_dirty; + + /* + * bins is used to store trees of free regions of the following sizes, + * assuming a 16-byte quantum, 4 KiB page size, and default + * JEMALLOC_OPTIONS. + * + * bins[i] | size | + * --------+--------+ + * 0 | 2 | + * 1 | 4 | + * 2 | 8 | + * --------+--------+ + * 3 | 16 | + * 4 | 32 | + * 5 | 48 | + * : : + * 8 | 96 | + * 9 | 112 | + * 10 | 128 | + * --------+--------+ + * 11 | 192 | + * 12 | 256 | + * 13 | 320 | + * 14 | 384 | + * 15 | 448 | + * 16 | 512 | + * --------+--------+ + * 17 | 768 | + * 18 | 1024 | + * 19 | 1280 | + * : : + * 27 | 3328 | + * 28 | 3584 | + * 29 | 3840 | + * --------+--------+ + * 30 | 4 KiB | + * 31 | 6 KiB | + * 33 | 8 KiB | + * : : + * 43 | 28 KiB | + * 44 | 30 KiB | + * 45 | 32 KiB | + * --------+--------+ + */ + arena_bin_t bins[1]; /* Dynamically sized. */ +}; + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +extern size_t opt_lg_qspace_max; +extern size_t opt_lg_cspace_max; +extern ssize_t opt_lg_dirty_mult; +extern uint8_t const *small_size2bin; + +/* Various bin-related settings. */ +#ifdef JEMALLOC_TINY /* Number of (2^n)-spaced tiny bins. */ +# define ntbins ((unsigned)(LG_QUANTUM - LG_TINY_MIN)) +#else +# define ntbins 0 +#endif +extern unsigned nqbins; /* Number of quantum-spaced bins. */ +extern unsigned ncbins; /* Number of cacheline-spaced bins. */ +extern unsigned nsbins; /* Number of subpage-spaced bins. */ +extern unsigned nbins; +#ifdef JEMALLOC_TINY +# define tspace_max ((size_t)(QUANTUM >> 1)) +#endif +#define qspace_min QUANTUM +extern size_t qspace_max; +extern size_t cspace_min; +extern size_t cspace_max; +extern size_t sspace_min; +extern size_t sspace_max; +#define small_maxclass sspace_max + +#define nlclasses (chunk_npages - arena_chunk_header_npages) + +#ifdef JEMALLOC_TCACHE +void arena_tcache_fill_small(arena_t *arena, tcache_bin_t *tbin, + size_t binind +# ifdef JEMALLOC_PROF + , uint64_t prof_accumbytes +# endif + ); +#endif +#ifdef JEMALLOC_PROF +void arena_prof_accum(arena_t *arena, uint64_t accumbytes); +#endif +void *arena_malloc_small(arena_t *arena, size_t size, bool zero); +void *arena_malloc_large(arena_t *arena, size_t size, bool zero); +void *arena_malloc(size_t size, bool zero); +void *arena_palloc(arena_t *arena, size_t alignment, size_t size, + size_t alloc_size); +size_t arena_salloc(const void *ptr); +#ifdef JEMALLOC_PROF +void arena_prof_promoted(const void *ptr, size_t size); +size_t arena_salloc_demote(const void *ptr); +prof_thr_cnt_t *arena_prof_cnt_get(const void *ptr); +void arena_prof_cnt_set(const void *ptr, prof_thr_cnt_t *cnt); +#endif +void arena_dalloc_bin(arena_t *arena, arena_chunk_t *chunk, void *ptr, + arena_chunk_map_t *mapelm); +void arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr); +#ifdef JEMALLOC_STATS +void arena_stats_merge(arena_t *arena, size_t *nactive, size_t *ndirty, + arena_stats_t *astats, malloc_bin_stats_t *bstats, + malloc_large_stats_t *lstats); +#endif +void *arena_ralloc(void *ptr, size_t size, size_t oldsize); +bool arena_new(arena_t *arena, unsigned ind); +bool arena_boot(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#ifndef JEMALLOC_ENABLE_INLINE +void arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ARENA_C_)) +JEMALLOC_INLINE void +arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr) +{ + size_t pageind; + arena_chunk_map_t *mapelm; + + assert(arena != NULL); + assert(arena->magic == ARENA_MAGIC); + assert(chunk->arena == arena); + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapelm = &chunk->map[pageind]; + assert((mapelm->bits & CHUNK_MAP_ALLOCATED) != 0); + if ((mapelm->bits & CHUNK_MAP_LARGE) == 0) { + /* Small allocation. */ +#ifdef JEMALLOC_TCACHE + tcache_t *tcache; + + if ((tcache = tcache_get()) != NULL) + tcache_dalloc_small(tcache, ptr); + else { +#endif + arena_run_t *run; + arena_bin_t *bin; + + run = (arena_run_t *)((uintptr_t)chunk + + (uintptr_t)((pageind - (mapelm->bits >> + PAGE_SHIFT)) << PAGE_SHIFT)); + assert(run->magic == ARENA_RUN_MAGIC); + assert(((uintptr_t)ptr - ((uintptr_t)run + + (uintptr_t)run->bin->reg0_offset)) % + run->bin->reg_size == 0); + bin = run->bin; + malloc_mutex_lock(&bin->lock); + arena_dalloc_bin(arena, chunk, ptr, mapelm); + malloc_mutex_unlock(&bin->lock); +#ifdef JEMALLOC_TCACHE + } +#endif + } else { +#ifdef JEMALLOC_TCACHE + size_t size = mapelm->bits & ~PAGE_MASK; + + assert(((uintptr_t)ptr & PAGE_MASK) == 0); + if (size <= tcache_maxclass) { + tcache_t *tcache; + + if ((tcache = tcache_get()) != NULL) + tcache_dalloc_large(tcache, ptr, size); + else { + malloc_mutex_lock(&arena->lock); + arena_dalloc_large(arena, chunk, ptr); + malloc_mutex_unlock(&arena->lock); + } + } else { + malloc_mutex_lock(&arena->lock); + arena_dalloc_large(arena, chunk, ptr); + malloc_mutex_unlock(&arena->lock); + } +#else + assert(((uintptr_t)ptr & PAGE_MASK) == 0); + malloc_mutex_lock(&arena->lock); + arena_dalloc_large(arena, chunk, ptr); + malloc_mutex_unlock(&arena->lock); +#endif + } +} +#endif + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/base.h b/externals/jemalloc/jemalloc/internal/base.h new file mode 100644 index 0000000..e353f30 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/base.h @@ -0,0 +1,24 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +extern malloc_mutex_t base_mtx; + +void *base_alloc(size_t size); +extent_node_t *base_node_alloc(void); +void base_node_dealloc(extent_node_t *node); +bool base_boot(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/chunk.h b/externals/jemalloc/jemalloc/internal/chunk.h new file mode 100644 index 0000000..1f6abf7 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/chunk.h @@ -0,0 +1,61 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +/* + * Size and alignment of memory chunks that are allocated by the OS's virtual + * memory system. + */ +#define LG_CHUNK_DEFAULT 22 + +/* Return the chunk address for allocation address a. */ +#define CHUNK_ADDR2BASE(a) \ + ((void *)((uintptr_t)(a) & ~chunksize_mask)) + +/* Return the chunk offset of address a. */ +#define CHUNK_ADDR2OFFSET(a) \ + ((size_t)((uintptr_t)(a) & chunksize_mask)) + +/* Return the smallest chunk multiple that is >= s. */ +#define CHUNK_CEILING(s) \ + (((s) + chunksize_mask) & ~chunksize_mask) + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +extern size_t opt_lg_chunk; +#ifdef JEMALLOC_SWAP +extern bool opt_overcommit; +#endif + +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) +/* Protects stats_chunks; currently not used for any other purpose. */ +extern malloc_mutex_t chunks_mtx; +/* Chunk statistics. */ +extern chunk_stats_t stats_chunks; +#endif + +extern size_t chunksize; +extern size_t chunksize_mask; /* (chunksize - 1). */ +extern size_t chunk_npages; +extern size_t arena_chunk_header_npages; +extern size_t arena_maxclass; /* Max size class for arenas. */ + +void *chunk_alloc(size_t size, bool *zero); +void chunk_dealloc(void *chunk, size_t size); +bool chunk_boot(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ + +#include "jemalloc/internal/chunk_swap.h" +#include "jemalloc/internal/chunk_dss.h" +#include "jemalloc/internal/chunk_mmap.h" diff --git a/externals/jemalloc/jemalloc/internal/chunk_dss.h b/externals/jemalloc/jemalloc/internal/chunk_dss.h new file mode 100644 index 0000000..6be4ad1 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/chunk_dss.h @@ -0,0 +1,29 @@ +#ifdef JEMALLOC_DSS +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +/* + * Protects sbrk() calls. This avoids malloc races among threads, though it + * does not protect against races with threads that call sbrk() directly. + */ +extern malloc_mutex_t dss_mtx; + +void *chunk_alloc_dss(size_t size, bool *zero); +bool chunk_dealloc_dss(void *chunk, size_t size); +bool chunk_dss_boot(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ +#endif /* JEMALLOC_DSS */ diff --git a/externals/jemalloc/jemalloc/internal/chunk_mmap.h b/externals/jemalloc/jemalloc/internal/chunk_mmap.h new file mode 100644 index 0000000..8fb90b7 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/chunk_mmap.h @@ -0,0 +1,20 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +void *chunk_alloc_mmap(size_t size); +void chunk_dealloc_mmap(void *chunk, size_t size); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/chunk_swap.h b/externals/jemalloc/jemalloc/internal/chunk_swap.h new file mode 100644 index 0000000..d50cb19 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/chunk_swap.h @@ -0,0 +1,33 @@ +#ifdef JEMALLOC_SWAP +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +extern malloc_mutex_t swap_mtx; +extern bool swap_enabled; +extern bool swap_prezeroed; +extern size_t swap_nfds; +extern int *swap_fds; +#ifdef JEMALLOC_STATS +extern size_t swap_avail; +#endif + +void *chunk_alloc_swap(size_t size, bool *zero); +bool chunk_dealloc_swap(void *chunk, size_t size); +bool chunk_swap_enable(const int *fds, unsigned nfds, bool prezeroed); +bool chunk_swap_boot(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ +#endif /* JEMALLOC_SWAP */ diff --git a/externals/jemalloc/jemalloc/internal/ckh.h b/externals/jemalloc/jemalloc/internal/ckh.h new file mode 100644 index 0000000..c39ea5c --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/ckh.h @@ -0,0 +1,95 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +typedef struct ckh_s ckh_t; +typedef struct ckhc_s ckhc_t; + +/* Typedefs to allow easy function pointer passing. */ +typedef void ckh_hash_t (const void *, unsigned, size_t *, size_t *); +typedef bool ckh_keycomp_t (const void *, const void *); + +/* Maintain counters used to get an idea of performance. */ +/* #define CKH_COUNT */ +/* Print counter values in ckh_delete() (requires CKH_COUNT). */ +/* #define CKH_VERBOSE */ + +/* + * There are 2^LG_CKH_BUCKET_CELLS cells in each hash table bucket. Try to fit + * one bucket per L1 cache line. + */ +#define LG_CKH_BUCKET_CELLS (LG_CACHELINE - LG_SIZEOF_PTR - 1) + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +/* Hash table cell. */ +struct ckhc_s { + const void *key; + const void *data; +}; + +struct ckh_s { +#ifdef JEMALLOC_DEBUG +#define CKH_MAGIG 0x3af2489d + uint32_t magic; +#endif + +#ifdef CKH_COUNT + /* Counters used to get an idea of performance. */ + uint64_t ngrows; + uint64_t nshrinks; + uint64_t nshrinkfails; + uint64_t ninserts; + uint64_t nrelocs; +#endif + + /* Used for pseudo-random number generation. */ +#define CKH_A 12345 +#define CKH_C 12347 + uint32_t prn_state; + + /* Total number of items. */ + size_t count; + + /* + * Minimum and current number of hash table buckets. There are + * 2^LG_CKH_BUCKET_CELLS cells per bucket. + */ + unsigned lg_minbuckets; + unsigned lg_curbuckets; + + /* Hash and comparison functions. */ + ckh_hash_t *hash; + ckh_keycomp_t *keycomp; + + /* Hash table with 2^lg_curbuckets buckets. */ + ckhc_t *tab; +}; + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +bool ckh_new(ckh_t *ckh, size_t minitems, ckh_hash_t *hash, + ckh_keycomp_t *keycomp); +void ckh_delete(ckh_t *ckh); +size_t ckh_count(ckh_t *ckh); +bool ckh_iter(ckh_t *ckh, size_t *tabind, void **key, void **data); +bool ckh_insert(ckh_t *ckh, const void *key, const void *data); +bool ckh_remove(ckh_t *ckh, const void *searchkey, void **key, + void **data); +bool ckh_search(ckh_t *ckh, const void *seachkey, void **key, void **data); +void ckh_string_hash(const void *key, unsigned minbits, size_t *hash1, + size_t *hash2); +bool ckh_string_keycomp(const void *k1, const void *k2); +void ckh_pointer_hash(const void *key, unsigned minbits, size_t *hash1, + size_t *hash2); +bool ckh_pointer_keycomp(const void *k1, const void *k2); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/ctl.h b/externals/jemalloc/jemalloc/internal/ctl.h new file mode 100644 index 0000000..7bbf21e --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/ctl.h @@ -0,0 +1,117 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +typedef struct ctl_node_s ctl_node_t; +typedef struct ctl_arena_stats_s ctl_arena_stats_t; +typedef struct ctl_stats_s ctl_stats_t; + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +struct ctl_node_s { + bool named; + union { + struct { + const char *name; + /* If (nchildren == 0), this is a terminal node. */ + unsigned nchildren; + const ctl_node_t *children; + } named; + struct { + const ctl_node_t *(*index)(const size_t *, size_t, + size_t); + } indexed; + } u; + int (*ctl)(const size_t *, size_t, void *, size_t *, void *, + size_t); +}; + +struct ctl_arena_stats_s { + bool initialized; + size_t pactive; + size_t pdirty; +#ifdef JEMALLOC_STATS + arena_stats_t astats; + + /* Aggregate stats for small size classes, based on bin stats. */ + size_t allocated_small; + uint64_t nmalloc_small; + uint64_t ndalloc_small; + uint64_t nrequests_small; + + malloc_bin_stats_t *bstats; /* nbins elements. */ + malloc_large_stats_t *lstats; /* nlclasses elements. */ +#endif +}; + +struct ctl_stats_s { +#ifdef JEMALLOC_STATS + size_t allocated; + size_t active; + size_t mapped; + struct { + size_t current; /* stats_chunks.curchunks */ + uint64_t total; /* stats_chunks.nchunks */ + size_t high; /* stats_chunks.highchunks */ + } chunks; + struct { + size_t allocated; /* huge_allocated */ + uint64_t nmalloc; /* huge_nmalloc */ + uint64_t ndalloc; /* huge_ndalloc */ + } huge; +#endif + ctl_arena_stats_t *arenas; /* (narenas + 1) elements. */ +#ifdef JEMALLOC_SWAP + size_t swap_avail; +#endif +}; + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +int ctl_byname(const char *name, void *oldp, size_t *oldlenp, void *newp, + size_t newlen); +int ctl_nametomib(const char *name, size_t *mibp, size_t *miblenp); + +int ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); +bool ctl_boot(void); + +#define xmallctl(name, oldp, oldlenp, newp, newlen) do { \ + if (JEMALLOC_P(mallctl)(name, oldp, oldlenp, newp, newlen) \ + != 0) { \ + malloc_write(": Invalid xmallctl(\""); \ + malloc_write(name); \ + malloc_write("\", ...) call\n"); \ + abort(); \ + } \ +} while (0) + +#define xmallctlnametomib(name, mibp, miblenp) do { \ + if (JEMALLOC_P(mallctlnametomib)(name, mibp, miblenp) != 0) { \ + malloc_write( \ + ": Invalid xmallctlnametomib(\""); \ + malloc_write(name); \ + malloc_write("\", ...) call\n"); \ + abort(); \ + } \ +} while (0) + +#define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \ + if (JEMALLOC_P(mallctlbymib)(mib, miblen, oldp, oldlenp, newp, \ + newlen) != 0) { \ + malloc_write( \ + ": Invalid xmallctlbymib() call\n"); \ + abort(); \ + } \ +} while (0) + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ + diff --git a/externals/jemalloc/jemalloc/internal/extent.h b/externals/jemalloc/jemalloc/internal/extent.h new file mode 100644 index 0000000..33a4e9a --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/extent.h @@ -0,0 +1,49 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +typedef struct extent_node_s extent_node_t; + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +/* Tree of extents. */ +struct extent_node_s { +#if (defined(JEMALLOC_SWAP) || defined(JEMALLOC_DSS)) + /* Linkage for the size/address-ordered tree. */ + rb_node(extent_node_t) link_szad; +#endif + + /* Linkage for the address-ordered tree. */ + rb_node(extent_node_t) link_ad; + +#ifdef JEMALLOC_PROF + /* Profile counters, used for huge objects. */ + prof_thr_cnt_t *prof_cnt; +#endif + + /* Pointer to the extent that this tree node is responsible for. */ + void *addr; + + /* Total region size. */ + size_t size; +}; +typedef rb_tree(extent_node_t) extent_tree_t; + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +#if (defined(JEMALLOC_SWAP) || defined(JEMALLOC_DSS)) +rb_proto(, extent_tree_szad_, extent_tree_t, extent_node_t) +#endif + +rb_proto(, extent_tree_ad_, extent_tree_t, extent_node_t) + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ + diff --git a/externals/jemalloc/jemalloc/internal/hash.h b/externals/jemalloc/jemalloc/internal/hash.h new file mode 100644 index 0000000..d12cdb8 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/hash.h @@ -0,0 +1,70 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#ifndef JEMALLOC_ENABLE_INLINE +uint64_t hash(const void *key, size_t len, uint64_t seed); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(HASH_C_)) +/* + * The following hash function is based on MurmurHash64A(), placed into the + * public domain by Austin Appleby. See http://murmurhash.googlepages.com/ for + * details. + */ +JEMALLOC_INLINE uint64_t +hash(const void *key, size_t len, uint64_t seed) +{ + const uint64_t m = 0xc6a4a7935bd1e995; + const int r = 47; + uint64_t h = seed ^ (len * m); + const uint64_t *data = (const uint64_t *)key; + const uint64_t *end = data + (len/8); + const unsigned char *data2; + + assert(((uintptr_t)key & 0x7) == 0); + + while(data != end) { + uint64_t k = *data++; + + k *= m; + k ^= k >> r; + k *= m; + + h ^= k; + h *= m; + } + + data2 = (const unsigned char *)data; + switch(len & 7) { + case 7: h ^= ((uint64_t)(data2[6])) << 48; + case 6: h ^= ((uint64_t)(data2[5])) << 40; + case 5: h ^= ((uint64_t)(data2[4])) << 32; + case 4: h ^= ((uint64_t)(data2[3])) << 24; + case 3: h ^= ((uint64_t)(data2[2])) << 16; + case 2: h ^= ((uint64_t)(data2[1])) << 8; + case 1: h ^= ((uint64_t)(data2[0])); + h *= m; + } + + h ^= h >> r; + h *= m; + h ^= h >> r; + + return h; +} +#endif + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/huge.h b/externals/jemalloc/jemalloc/internal/huge.h new file mode 100644 index 0000000..3cf32f7 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/huge.h @@ -0,0 +1,38 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +#ifdef JEMALLOC_STATS +/* Huge allocation statistics. */ +extern uint64_t huge_nmalloc; +extern uint64_t huge_ndalloc; +extern size_t huge_allocated; +#endif + +/* Protects chunk-related data structures. */ +extern malloc_mutex_t huge_mtx; + +void *huge_malloc(size_t size, bool zero); +void *huge_palloc(size_t alignment, size_t size); +void *huge_ralloc(void *ptr, size_t size, size_t oldsize); +void huge_dalloc(void *ptr); +size_t huge_salloc(const void *ptr); +#ifdef JEMALLOC_PROF +prof_thr_cnt_t *huge_prof_cnt_get(const void *ptr); +void huge_prof_cnt_set(const void *ptr, prof_thr_cnt_t *cnt); +#endif +bool huge_boot(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/jemalloc_internal.h b/externals/jemalloc/jemalloc/internal/jemalloc_internal.h new file mode 100644 index 0000000..03782dd --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/jemalloc_internal.h @@ -0,0 +1,561 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#ifndef SIZE_T_MAX +# define SIZE_T_MAX SIZE_MAX +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define JEMALLOC_MANGLE +#include "../jemalloc.h" + +#ifdef JEMALLOC_LAZY_LOCK +#include +#endif + +#define RB_COMPACT +#include "jemalloc/internal/rb.h" +#include "jemalloc/internal/qr.h" +#include "jemalloc/internal/ql.h" + +extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); + +/* + * Define a custom assert() in order to reduce the chances of deadlock during + * assertion failure. + */ +#ifdef JEMALLOC_DEBUG +# define assert(e) do { \ + if (!(e)) { \ + char line_buf[UMAX2S_BUFSIZE]; \ + malloc_write(": "); \ + malloc_write(__FILE__); \ + malloc_write(":"); \ + malloc_write(umax2s(__LINE__, 10, line_buf)); \ + malloc_write(": Failed assertion: "); \ + malloc_write("\""); \ + malloc_write(#e); \ + malloc_write("\"\n"); \ + abort(); \ + } \ +} while (0) +#else +#define assert(e) +#endif + +/* + * jemalloc can conceptually be broken into components (arena, tcache, etc.), + * but there are circular dependencies that cannot be broken without + * substantial performance degradation. In order to reduce the effect on + * visual code flow, read the header files in multiple passes, with one of the + * following cpp variables defined during each pass: + * + * JEMALLOC_H_TYPES : Preprocessor-defined constants and psuedo-opaque data + * types. + * JEMALLOC_H_STRUCTS : Data structures. + * JEMALLOC_H_EXTERNS : Extern data declarations and function prototypes. + * JEMALLOC_H_INLINES : Inline functions. + */ +/******************************************************************************/ +#define JEMALLOC_H_TYPES + +#define ZU(z) ((size_t)z) + +#ifndef __DECONST +# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) +#endif + +#ifdef JEMALLOC_DEBUG + /* Disable inlining to make debugging easier. */ +# define JEMALLOC_INLINE +# define inline +#else +# define JEMALLOC_ENABLE_INLINE +# define JEMALLOC_INLINE static inline +#endif + +/* Size of stack-allocated buffer passed to strerror_r(). */ +#define STRERROR_BUF 64 + +/* Minimum alignment of allocations is 2^LG_QUANTUM bytes. */ +#ifdef __i386__ +# define LG_QUANTUM 4 +#endif +#ifdef __ia64__ +# define LG_QUANTUM 4 +#endif +#ifdef __alpha__ +# define LG_QUANTUM 4 +#endif +#ifdef __sparc64__ +# define LG_QUANTUM 4 +#endif +#if (defined(__amd64__) || defined(__x86_64__)) +# define LG_QUANTUM 4 +#endif +#ifdef __arm__ +# define LG_QUANTUM 3 +#endif +#ifdef __mips__ +# define LG_QUANTUM 3 +#endif +#ifdef __powerpc__ +# define LG_QUANTUM 4 +#endif +#ifdef __s390x__ +# define LG_QUANTUM 4 +#endif + +#define QUANTUM ((size_t)(1U << LG_QUANTUM)) +#define QUANTUM_MASK (QUANTUM - 1) + +/* Return the smallest quantum multiple that is >= a. */ +#define QUANTUM_CEILING(a) \ + (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) + +#define SIZEOF_PTR (1U << LG_SIZEOF_PTR) + +/* We can't use TLS in non-PIC programs, since TLS relies on loader magic. */ +#if (!defined(PIC) && !defined(NO_TLS)) +# define NO_TLS +#endif + +/* + * Maximum size of L1 cache line. This is used to avoid cache line aliasing. + * In addition, this controls the spacing of cacheline-spaced size classes. + */ +#define LG_CACHELINE 6 +#define CACHELINE ((size_t)(1U << LG_CACHELINE)) +#define CACHELINE_MASK (CACHELINE - 1) + +/* Return the smallest cacheline multiple that is >= s. */ +#define CACHELINE_CEILING(s) \ + (((s) + CACHELINE_MASK) & ~CACHELINE_MASK) + +/* + * Page size. STATIC_PAGE_SHIFT is determined by the configure script. If + * DYNAMIC_PAGE_SHIFT is enabled, only use the STATIC_PAGE_* macros where + * compile-time values are required for the purposes of defining data + * structures. + */ +#define STATIC_PAGE_SIZE ((size_t)(1U << STATIC_PAGE_SHIFT)) +#define STATIC_PAGE_MASK ((size_t)(STATIC_PAGE_SIZE - 1)) + +#ifdef DYNAMIC_PAGE_SHIFT +# define PAGE_SHIFT lg_pagesize +# define PAGE_SIZE pagesize +# define PAGE_MASK pagesize_mask +#else +# define PAGE_SHIFT STATIC_PAGE_SHIFT +# define PAGE_SIZE STATIC_PAGE_SIZE +# define PAGE_MASK STATIC_PAGE_MASK +#endif + +/* Return the smallest pagesize multiple that is >= s. */ +#define PAGE_CEILING(s) \ + (((s) + PAGE_MASK) & ~PAGE_MASK) + +#include "jemalloc/internal/totally_not_p_r_n.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#undef JEMALLOC_H_TYPES +/******************************************************************************/ +#define JEMALLOC_H_STRUCTS + +#include "jemalloc/internal/totally_not_p_r_n.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#undef JEMALLOC_H_STRUCTS +/******************************************************************************/ +#define JEMALLOC_H_EXTERNS + +extern bool opt_abort; +#ifdef JEMALLOC_FILL +extern bool opt_junk; +#endif +#ifdef JEMALLOC_SYSV +extern bool opt_sysv; +#endif +#ifdef JEMALLOC_XMALLOC +extern bool opt_xmalloc; +#endif +#ifdef JEMALLOC_FILL +extern bool opt_zero; +#endif + +#ifdef DYNAMIC_PAGE_SHIFT +extern size_t pagesize; +extern size_t pagesize_mask; +extern size_t lg_pagesize; +#endif + +/* Number of CPUs. */ +extern unsigned ncpus; + +extern malloc_mutex_t arenas_lock; /* Protects arenas initialization. */ +#ifndef NO_TLS +/* + * Map of pthread_self() --> arenas[???], used for selecting an arena to use + * for allocations. + */ +extern __thread arena_t *arenas_map JEMALLOC_ATTR(tls_model("initial-exec")); +#endif +/* + * Arenas that are used to service external requests. Not all elements of the + * arenas array are necessarily used; arenas are created lazily as needed. + */ +extern arena_t **arenas; +extern unsigned narenas; + +arena_t *arenas_extend(unsigned ind); +#ifndef NO_TLS +arena_t *choose_arena_hard(void); +#endif + +#include "jemalloc/internal/totally_not_p_r_n.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#undef JEMALLOC_H_EXTERNS +/******************************************************************************/ +#define JEMALLOC_H_INLINES + +#include "jemalloc/internal/totally_not_p_r_n.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" + +#ifndef JEMALLOC_ENABLE_INLINE +void malloc_write(const char *s); +arena_t *choose_arena(void); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_)) +/* + * Wrapper around malloc_message() that avoids the need for + * JEMALLOC_P(malloc_message)(...) throughout the code. + */ +JEMALLOC_INLINE void +malloc_write(const char *s) +{ + + JEMALLOC_P(malloc_message)(NULL, s); +} + +/* + * Choose an arena based on a per-thread value (fast-path code, calls slow-path + * code if necessary). + */ +JEMALLOC_INLINE arena_t * +choose_arena(void) +{ + arena_t *ret; + + /* + * We can only use TLS if this is a PIC library, since for the static + * library version, libc's malloc is used by TLS allocation, which + * introduces a bootstrapping issue. + */ +#ifndef NO_TLS + ret = arenas_map; + if (ret == NULL) { + ret = choose_arena_hard(); + assert(ret != NULL); + } +#else + if (isthreaded && narenas > 1) { + unsigned long ind; + + /* + * Hash pthread_self() to one of the arenas. There is a prime + * number of arenas, so this has a reasonable chance of + * working. Even so, the hashing can be easily thwarted by + * inconvenient pthread_self() values. Without specific + * knowledge of how pthread_self() calculates values, we can't + * easily do much better than this. + */ + ind = (unsigned long) pthread_self() % narenas; + + /* + * Optimistially assume that arenas[ind] has been initialized. + * At worst, we find out that some other thread has already + * done so, after acquiring the lock in preparation. Note that + * this lazy locking also has the effect of lazily forcing + * cache coherency; without the lock acquisition, there's no + * guarantee that modification of arenas[ind] by another thread + * would be seen on this CPU for an arbitrary amount of time. + * + * In general, this approach to modifying a synchronized value + * isn't a good idea, but in this case we only ever modify the + * value once, so things work out well. + */ + ret = arenas[ind]; + if (ret == NULL) { + /* + * Avoid races with another thread that may have already + * initialized arenas[ind]. + */ + malloc_mutex_lock(&arenas_lock); + if (arenas[ind] == NULL) + ret = arenas_extend((unsigned)ind); + else + ret = arenas[ind]; + malloc_mutex_unlock(&arenas_lock); + } + } else + ret = arenas[0]; +#endif + + assert(ret != NULL); + return (ret); +} +#endif + +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#ifndef JEMALLOC_ENABLE_INLINE +void *imalloc(size_t size); +void *icalloc(size_t size); +void *ipalloc(size_t alignment, size_t size); +size_t isalloc(const void *ptr); +void *iralloc(void *ptr, size_t size); +void idalloc(void *ptr); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_)) +JEMALLOC_INLINE void * +imalloc(size_t size) +{ + + assert(size != 0); + + if (size <= arena_maxclass) + return (arena_malloc(size, false)); + else + return (huge_malloc(size, false)); +} + +JEMALLOC_INLINE void * +icalloc(size_t size) +{ + + if (size <= arena_maxclass) + return (arena_malloc(size, true)); + else + return (huge_malloc(size, true)); +} + +JEMALLOC_INLINE void * +ipalloc(size_t alignment, size_t size) +{ + void *ret; + size_t ceil_size; + + /* + * Round size up to the nearest multiple of alignment. + * + * This done, we can take advantage of the fact that for each small + * size class, every object is aligned at the smallest power of two + * that is non-zero in the base two representation of the size. For + * example: + * + * Size | Base 2 | Minimum alignment + * -----+----------+------------------ + * 96 | 1100000 | 32 + * 144 | 10100000 | 32 + * 192 | 11000000 | 64 + * + * Depending on runtime settings, it is possible that arena_malloc() + * will further round up to a power of two, but that never causes + * correctness issues. + */ + ceil_size = (size + (alignment - 1)) & (-alignment); + /* + * (ceil_size < size) protects against the combination of maximal + * alignment and size greater than maximal alignment. + */ + if (ceil_size < size) { + /* size_t overflow. */ + return (NULL); + } + + if (ceil_size <= PAGE_SIZE || (alignment <= PAGE_SIZE + && ceil_size <= arena_maxclass)) + ret = arena_malloc(ceil_size, false); + else { + size_t run_size; + + /* + * We can't achieve subpage alignment, so round up alignment + * permanently; it makes later calculations simpler. + */ + alignment = PAGE_CEILING(alignment); + ceil_size = PAGE_CEILING(size); + /* + * (ceil_size < size) protects against very large sizes within + * PAGE_SIZE of SIZE_T_MAX. + * + * (ceil_size + alignment < ceil_size) protects against the + * combination of maximal alignment and ceil_size large enough + * to cause overflow. This is similar to the first overflow + * check above, but it needs to be repeated due to the new + * ceil_size value, which may now be *equal* to maximal + * alignment, whereas before we only detected overflow if the + * original size was *greater* than maximal alignment. + */ + if (ceil_size < size || ceil_size + alignment < ceil_size) { + /* size_t overflow. */ + return (NULL); + } + + /* + * Calculate the size of the over-size run that arena_palloc() + * would need to allocate in order to guarantee the alignment. + */ + if (ceil_size >= alignment) + run_size = ceil_size + alignment - PAGE_SIZE; + else { + /* + * It is possible that (alignment << 1) will cause + * overflow, but it doesn't matter because we also + * subtract PAGE_SIZE, which in the case of overflow + * leaves us with a very large run_size. That causes + * the first conditional below to fail, which means + * that the bogus run_size value never gets used for + * anything important. + */ + run_size = (alignment << 1) - PAGE_SIZE; + } + + if (run_size <= arena_maxclass) { + ret = arena_palloc(choose_arena(), alignment, ceil_size, + run_size); + } else if (alignment <= chunksize) + ret = huge_malloc(ceil_size, false); + else + ret = huge_palloc(alignment, ceil_size); + } + + assert(((uintptr_t)ret & (alignment - 1)) == 0); + return (ret); +} + +JEMALLOC_INLINE size_t +isalloc(const void *ptr) +{ + size_t ret; + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) { + /* Region. */ + assert(chunk->arena->magic == ARENA_MAGIC); + +#ifdef JEMALLOC_PROF + ret = arena_salloc_demote(ptr); +#else + ret = arena_salloc(ptr); +#endif + } else + ret = huge_salloc(ptr); + + return (ret); +} + +JEMALLOC_INLINE void * +iralloc(void *ptr, size_t size) +{ + size_t oldsize; + + assert(ptr != NULL); + assert(size != 0); + + oldsize = isalloc(ptr); + + if (size <= arena_maxclass) + return (arena_ralloc(ptr, size, oldsize)); + else + return (huge_ralloc(ptr, size, oldsize)); +} + +JEMALLOC_INLINE void +idalloc(void *ptr) +{ + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) + arena_dalloc(chunk->arena, chunk, ptr); + else + huge_dalloc(ptr); +} +#endif + +#undef JEMALLOC_H_INLINES +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/jemalloc_internal.h.in b/externals/jemalloc/jemalloc/internal/jemalloc_internal.h.in new file mode 100644 index 0000000..2c3f32f --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/jemalloc_internal.h.in @@ -0,0 +1,561 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#ifndef SIZE_T_MAX +# define SIZE_T_MAX SIZE_MAX +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define JEMALLOC_MANGLE +#include "../jemalloc@install_suffix@.h" + +#ifdef JEMALLOC_LAZY_LOCK +#include +#endif + +#define RB_COMPACT +#include "jemalloc/internal/rb.h" +#include "jemalloc/internal/qr.h" +#include "jemalloc/internal/ql.h" + +extern void (*JEMALLOC_P(malloc_message))(void *wcbopaque, const char *s); + +/* + * Define a custom assert() in order to reduce the chances of deadlock during + * assertion failure. + */ +#ifdef JEMALLOC_DEBUG +# define assert(e) do { \ + if (!(e)) { \ + char line_buf[UMAX2S_BUFSIZE]; \ + malloc_write(": "); \ + malloc_write(__FILE__); \ + malloc_write(":"); \ + malloc_write(umax2s(__LINE__, 10, line_buf)); \ + malloc_write(": Failed assertion: "); \ + malloc_write("\""); \ + malloc_write(#e); \ + malloc_write("\"\n"); \ + abort(); \ + } \ +} while (0) +#else +#define assert(e) +#endif + +/* + * jemalloc can conceptually be broken into components (arena, tcache, etc.), + * but there are circular dependencies that cannot be broken without + * substantial performance degradation. In order to reduce the effect on + * visual code flow, read the header files in multiple passes, with one of the + * following cpp variables defined during each pass: + * + * JEMALLOC_H_TYPES : Preprocessor-defined constants and psuedo-opaque data + * types. + * JEMALLOC_H_STRUCTS : Data structures. + * JEMALLOC_H_EXTERNS : Extern data declarations and function prototypes. + * JEMALLOC_H_INLINES : Inline functions. + */ +/******************************************************************************/ +#define JEMALLOC_H_TYPES + +#define ZU(z) ((size_t)z) + +#ifndef __DECONST +# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) +#endif + +#ifdef JEMALLOC_DEBUG + /* Disable inlining to make debugging easier. */ +# define JEMALLOC_INLINE +# define inline +#else +# define JEMALLOC_ENABLE_INLINE +# define JEMALLOC_INLINE static inline +#endif + +/* Size of stack-allocated buffer passed to strerror_r(). */ +#define STRERROR_BUF 64 + +/* Minimum alignment of allocations is 2^LG_QUANTUM bytes. */ +#ifdef __i386__ +# define LG_QUANTUM 4 +#endif +#ifdef __ia64__ +# define LG_QUANTUM 4 +#endif +#ifdef __alpha__ +# define LG_QUANTUM 4 +#endif +#ifdef __sparc64__ +# define LG_QUANTUM 4 +#endif +#if (defined(__amd64__) || defined(__x86_64__)) +# define LG_QUANTUM 4 +#endif +#ifdef __arm__ +# define LG_QUANTUM 3 +#endif +#ifdef __mips__ +# define LG_QUANTUM 3 +#endif +#ifdef __powerpc__ +# define LG_QUANTUM 4 +#endif +#ifdef __s390x__ +# define LG_QUANTUM 4 +#endif + +#define QUANTUM ((size_t)(1U << LG_QUANTUM)) +#define QUANTUM_MASK (QUANTUM - 1) + +/* Return the smallest quantum multiple that is >= a. */ +#define QUANTUM_CEILING(a) \ + (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) + +#define SIZEOF_PTR (1U << LG_SIZEOF_PTR) + +/* We can't use TLS in non-PIC programs, since TLS relies on loader magic. */ +#if (!defined(PIC) && !defined(NO_TLS)) +# define NO_TLS +#endif + +/* + * Maximum size of L1 cache line. This is used to avoid cache line aliasing. + * In addition, this controls the spacing of cacheline-spaced size classes. + */ +#define LG_CACHELINE 6 +#define CACHELINE ((size_t)(1U << LG_CACHELINE)) +#define CACHELINE_MASK (CACHELINE - 1) + +/* Return the smallest cacheline multiple that is >= s. */ +#define CACHELINE_CEILING(s) \ + (((s) + CACHELINE_MASK) & ~CACHELINE_MASK) + +/* + * Page size. STATIC_PAGE_SHIFT is determined by the configure script. If + * DYNAMIC_PAGE_SHIFT is enabled, only use the STATIC_PAGE_* macros where + * compile-time values are required for the purposes of defining data + * structures. + */ +#define STATIC_PAGE_SIZE ((size_t)(1U << STATIC_PAGE_SHIFT)) +#define STATIC_PAGE_MASK ((size_t)(STATIC_PAGE_SIZE - 1)) + +#ifdef DYNAMIC_PAGE_SHIFT +# define PAGE_SHIFT lg_pagesize +# define PAGE_SIZE pagesize +# define PAGE_MASK pagesize_mask +#else +# define PAGE_SHIFT STATIC_PAGE_SHIFT +# define PAGE_SIZE STATIC_PAGE_SIZE +# define PAGE_MASK STATIC_PAGE_MASK +#endif + +/* Return the smallest pagesize multiple that is >= s. */ +#define PAGE_CEILING(s) \ + (((s) + PAGE_MASK) & ~PAGE_MASK) + +#include "jemalloc/internal/prn.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#undef JEMALLOC_H_TYPES +/******************************************************************************/ +#define JEMALLOC_H_STRUCTS + +#include "jemalloc/internal/prn.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#undef JEMALLOC_H_STRUCTS +/******************************************************************************/ +#define JEMALLOC_H_EXTERNS + +extern bool opt_abort; +#ifdef JEMALLOC_FILL +extern bool opt_junk; +#endif +#ifdef JEMALLOC_SYSV +extern bool opt_sysv; +#endif +#ifdef JEMALLOC_XMALLOC +extern bool opt_xmalloc; +#endif +#ifdef JEMALLOC_FILL +extern bool opt_zero; +#endif + +#ifdef DYNAMIC_PAGE_SHIFT +extern size_t pagesize; +extern size_t pagesize_mask; +extern size_t lg_pagesize; +#endif + +/* Number of CPUs. */ +extern unsigned ncpus; + +extern malloc_mutex_t arenas_lock; /* Protects arenas initialization. */ +#ifndef NO_TLS +/* + * Map of pthread_self() --> arenas[???], used for selecting an arena to use + * for allocations. + */ +extern __thread arena_t *arenas_map JEMALLOC_ATTR(tls_model("initial-exec")); +#endif +/* + * Arenas that are used to service external requests. Not all elements of the + * arenas array are necessarily used; arenas are created lazily as needed. + */ +extern arena_t **arenas; +extern unsigned narenas; + +arena_t *arenas_extend(unsigned ind); +#ifndef NO_TLS +arena_t *choose_arena_hard(void); +#endif + +#include "jemalloc/internal/prn.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#undef JEMALLOC_H_EXTERNS +/******************************************************************************/ +#define JEMALLOC_H_INLINES + +#include "jemalloc/internal/prn.h" +#include "jemalloc/internal/ckh.h" +#include "jemalloc/internal/stats.h" +#include "jemalloc/internal/ctl.h" +#include "jemalloc/internal/mutex.h" +#include "jemalloc/internal/mb.h" +#include "jemalloc/internal/extent.h" +#include "jemalloc/internal/base.h" +#include "jemalloc/internal/chunk.h" +#include "jemalloc/internal/huge.h" + +#ifndef JEMALLOC_ENABLE_INLINE +void malloc_write(const char *s); +arena_t *choose_arena(void); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_)) +/* + * Wrapper around malloc_message() that avoids the need for + * JEMALLOC_P(malloc_message)(...) throughout the code. + */ +JEMALLOC_INLINE void +malloc_write(const char *s) +{ + + JEMALLOC_P(malloc_message)(NULL, s); +} + +/* + * Choose an arena based on a per-thread value (fast-path code, calls slow-path + * code if necessary). + */ +JEMALLOC_INLINE arena_t * +choose_arena(void) +{ + arena_t *ret; + + /* + * We can only use TLS if this is a PIC library, since for the static + * library version, libc's malloc is used by TLS allocation, which + * introduces a bootstrapping issue. + */ +#ifndef NO_TLS + ret = arenas_map; + if (ret == NULL) { + ret = choose_arena_hard(); + assert(ret != NULL); + } +#else + if (isthreaded && narenas > 1) { + unsigned long ind; + + /* + * Hash pthread_self() to one of the arenas. There is a prime + * number of arenas, so this has a reasonable chance of + * working. Even so, the hashing can be easily thwarted by + * inconvenient pthread_self() values. Without specific + * knowledge of how pthread_self() calculates values, we can't + * easily do much better than this. + */ + ind = (unsigned long) pthread_self() % narenas; + + /* + * Optimistially assume that arenas[ind] has been initialized. + * At worst, we find out that some other thread has already + * done so, after acquiring the lock in preparation. Note that + * this lazy locking also has the effect of lazily forcing + * cache coherency; without the lock acquisition, there's no + * guarantee that modification of arenas[ind] by another thread + * would be seen on this CPU for an arbitrary amount of time. + * + * In general, this approach to modifying a synchronized value + * isn't a good idea, but in this case we only ever modify the + * value once, so things work out well. + */ + ret = arenas[ind]; + if (ret == NULL) { + /* + * Avoid races with another thread that may have already + * initialized arenas[ind]. + */ + malloc_mutex_lock(&arenas_lock); + if (arenas[ind] == NULL) + ret = arenas_extend((unsigned)ind); + else + ret = arenas[ind]; + malloc_mutex_unlock(&arenas_lock); + } + } else + ret = arenas[0]; +#endif + + assert(ret != NULL); + return (ret); +} +#endif + +#include "jemalloc/internal/tcache.h" +#include "jemalloc/internal/arena.h" +#include "jemalloc/internal/hash.h" +#include "jemalloc/internal/prof.h" + +#ifndef JEMALLOC_ENABLE_INLINE +void *imalloc(size_t size); +void *icalloc(size_t size); +void *ipalloc(size_t alignment, size_t size); +size_t isalloc(const void *ptr); +void *iralloc(void *ptr, size_t size); +void idalloc(void *ptr); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_)) +JEMALLOC_INLINE void * +imalloc(size_t size) +{ + + assert(size != 0); + + if (size <= arena_maxclass) + return (arena_malloc(size, false)); + else + return (huge_malloc(size, false)); +} + +JEMALLOC_INLINE void * +icalloc(size_t size) +{ + + if (size <= arena_maxclass) + return (arena_malloc(size, true)); + else + return (huge_malloc(size, true)); +} + +JEMALLOC_INLINE void * +ipalloc(size_t alignment, size_t size) +{ + void *ret; + size_t ceil_size; + + /* + * Round size up to the nearest multiple of alignment. + * + * This done, we can take advantage of the fact that for each small + * size class, every object is aligned at the smallest power of two + * that is non-zero in the base two representation of the size. For + * example: + * + * Size | Base 2 | Minimum alignment + * -----+----------+------------------ + * 96 | 1100000 | 32 + * 144 | 10100000 | 32 + * 192 | 11000000 | 64 + * + * Depending on runtime settings, it is possible that arena_malloc() + * will further round up to a power of two, but that never causes + * correctness issues. + */ + ceil_size = (size + (alignment - 1)) & (-alignment); + /* + * (ceil_size < size) protects against the combination of maximal + * alignment and size greater than maximal alignment. + */ + if (ceil_size < size) { + /* size_t overflow. */ + return (NULL); + } + + if (ceil_size <= PAGE_SIZE || (alignment <= PAGE_SIZE + && ceil_size <= arena_maxclass)) + ret = arena_malloc(ceil_size, false); + else { + size_t run_size; + + /* + * We can't achieve subpage alignment, so round up alignment + * permanently; it makes later calculations simpler. + */ + alignment = PAGE_CEILING(alignment); + ceil_size = PAGE_CEILING(size); + /* + * (ceil_size < size) protects against very large sizes within + * PAGE_SIZE of SIZE_T_MAX. + * + * (ceil_size + alignment < ceil_size) protects against the + * combination of maximal alignment and ceil_size large enough + * to cause overflow. This is similar to the first overflow + * check above, but it needs to be repeated due to the new + * ceil_size value, which may now be *equal* to maximal + * alignment, whereas before we only detected overflow if the + * original size was *greater* than maximal alignment. + */ + if (ceil_size < size || ceil_size + alignment < ceil_size) { + /* size_t overflow. */ + return (NULL); + } + + /* + * Calculate the size of the over-size run that arena_palloc() + * would need to allocate in order to guarantee the alignment. + */ + if (ceil_size >= alignment) + run_size = ceil_size + alignment - PAGE_SIZE; + else { + /* + * It is possible that (alignment << 1) will cause + * overflow, but it doesn't matter because we also + * subtract PAGE_SIZE, which in the case of overflow + * leaves us with a very large run_size. That causes + * the first conditional below to fail, which means + * that the bogus run_size value never gets used for + * anything important. + */ + run_size = (alignment << 1) - PAGE_SIZE; + } + + if (run_size <= arena_maxclass) { + ret = arena_palloc(choose_arena(), alignment, ceil_size, + run_size); + } else if (alignment <= chunksize) + ret = huge_malloc(ceil_size, false); + else + ret = huge_palloc(alignment, ceil_size); + } + + assert(((uintptr_t)ret & (alignment - 1)) == 0); + return (ret); +} + +JEMALLOC_INLINE size_t +isalloc(const void *ptr) +{ + size_t ret; + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) { + /* Region. */ + assert(chunk->arena->magic == ARENA_MAGIC); + +#ifdef JEMALLOC_PROF + ret = arena_salloc_demote(ptr); +#else + ret = arena_salloc(ptr); +#endif + } else + ret = huge_salloc(ptr); + + return (ret); +} + +JEMALLOC_INLINE void * +iralloc(void *ptr, size_t size) +{ + size_t oldsize; + + assert(ptr != NULL); + assert(size != 0); + + oldsize = isalloc(ptr); + + if (size <= arena_maxclass) + return (arena_ralloc(ptr, size, oldsize)); + else + return (huge_ralloc(ptr, size, oldsize)); +} + +JEMALLOC_INLINE void +idalloc(void *ptr) +{ + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) + arena_dalloc(chunk->arena, chunk, ptr); + else + huge_dalloc(ptr); +} +#endif + +#undef JEMALLOC_H_INLINES +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/mb.h b/externals/jemalloc/jemalloc/internal/mb.h new file mode 100644 index 0000000..1707aa9 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/mb.h @@ -0,0 +1,108 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#ifndef JEMALLOC_ENABLE_INLINE +void mb_write(void); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(MB_C_)) +#ifdef __i386__ +/* + * According to the Intel Architecture Software Developer's Manual, current + * processors execute instructions in order from the perspective of other + * processors in a multiprocessor system, but 1) Intel reserves the right to + * change that, and 2) the compiler's optimizer could re-order instructions if + * there weren't some form of barrier. Therefore, even if running on an + * architecture that does not need memory barriers (everything through at least + * i686), an "optimizer barrier" is necessary. + */ +JEMALLOC_INLINE void +mb_write(void) +{ + +# if 0 + /* This is a true memory barrier. */ + asm volatile ("pusha;" + "xor %%eax,%%eax;" + "cpuid;" + "popa;" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +#else + /* + * This is hopefully enough to keep the compiler from reordering + * instructions around this one. + */ + asm volatile ("nop;" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +#endif +} +#elif (defined(__amd64_) || defined(__x86_64__)) +JEMALLOC_INLINE void +mb_write(void) +{ + + asm volatile ("sfence" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +} +#elif defined(__powerpc__) +JEMALLOC_INLINE void +mb_write(void) +{ + + asm volatile ("eieio" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +} +#elif defined(__sparc64__) +JEMALLOC_INLINE void +mb_write(void) +{ + + asm volatile ("membar #StoreStore" + : /* Outputs. */ + : /* Inputs. */ + : "memory" /* Clobbers. */ + ); +} +#else +/* + * This is much slower than a simple memory barrier, but the semantics of mutex + * unlock make this work. + */ +JEMALLOC_INLINE void +mb_write(void) +{ + malloc_mutex_t mtx; + + malloc_mutex_init(&mtx); + malloc_mutex_lock(&mtx); + malloc_mutex_unlock(&mtx); +} +#endif +#endif + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/mutex.h b/externals/jemalloc/jemalloc/internal/mutex.h new file mode 100644 index 0000000..108bfa8 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/mutex.h @@ -0,0 +1,61 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +typedef pthread_mutex_t malloc_mutex_t; + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +#ifdef JEMALLOC_LAZY_LOCK +extern bool isthreaded; +#else +# define isthreaded true +#endif + +bool malloc_mutex_init(malloc_mutex_t *mutex); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#ifndef JEMALLOC_ENABLE_INLINE +void malloc_mutex_lock(malloc_mutex_t *mutex); +bool malloc_mutex_trylock(malloc_mutex_t *mutex); +void malloc_mutex_unlock(malloc_mutex_t *mutex); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_MUTEX_C_)) +JEMALLOC_INLINE void +malloc_mutex_lock(malloc_mutex_t *mutex) +{ + + if (isthreaded) + pthread_mutex_lock(mutex); +} + +JEMALLOC_INLINE bool +malloc_mutex_trylock(malloc_mutex_t *mutex) +{ + + if (isthreaded) + return (pthread_mutex_trylock(mutex) != 0); + else + return (false); +} + +JEMALLOC_INLINE void +malloc_mutex_unlock(malloc_mutex_t *mutex) +{ + + if (isthreaded) + pthread_mutex_unlock(mutex); +} +#endif + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/prof.h b/externals/jemalloc/jemalloc/internal/prof.h new file mode 100644 index 0000000..6e71552 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/prof.h @@ -0,0 +1,171 @@ +#ifdef JEMALLOC_PROF +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +typedef struct prof_bt_s prof_bt_t; +typedef struct prof_cnt_s prof_cnt_t; +typedef struct prof_thr_cnt_s prof_thr_cnt_t; +typedef struct prof_ctx_s prof_ctx_t; +typedef struct prof_s prof_t; + +/* Option defaults. */ +#define LG_PROF_BT_MAX_DEFAULT 2 +#define LG_PROF_SAMPLE_DEFAULT 0 +#define LG_PROF_INTERVAL_DEFAULT 30 + +/* + * Hard limit on stack backtrace depth. Note that the version of + * prof_backtrace() that is based on __builtin_return_address() necessarily has + * a hard-coded number of backtrace frame handlers, so increasing + * LG_PROF_BT_MAX requires changing prof_backtrace(). + */ +#define LG_PROF_BT_MAX 7 /* >= LG_PROF_BT_MAX_DEFAULT */ +#define PROF_BT_MAX (1U << LG_PROF_BT_MAX) + +/* Initial hash table size. */ +#define PROF_CKH_MINITEMS 64 + +/* Size of memory buffer to use when writing dump files. */ +#define PROF_DUMP_BUF_SIZE 65536 + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +struct prof_bt_s { + /* Backtrace, stored as len program counters. */ + void **vec; + unsigned len; +}; + +#ifdef JEMALLOC_PROF_LIBGCC +/* Data structure passed to libgcc _Unwind_Backtrace() callback functions. */ +typedef struct { + prof_bt_t *bt; + unsigned nignore; + unsigned max; +} prof_unwind_data_t; +#endif + +struct prof_cnt_s { + /* + * Profiling counters. An allocation/deallocation pair can operate on + * different prof_thr_cnt_t objects that are linked into the same + * prof_ctx_t sets_ql, so it is possible for the cur* counters to go + * negative. In principle it is possible for the *bytes counters to + * overflow/underflow, but a general solution would require some form + * of 128-bit counter solution; this implementation doesn't bother to + * solve that problem. + */ + int64_t curobjs; + int64_t curbytes; + uint64_t accumobjs; + uint64_t accumbytes; +}; + +struct prof_thr_cnt_s { + /* Linkage into prof_ctx_t's sets_ql. */ + ql_elm(prof_thr_cnt_t) link; + + /* + * Associated context. If a thread frees an object that it did not + * allocate, it is possible that the context is not cached in the + * thread's hash table, in which case it must be able to look up the + * context, insert a new prof_thr_cnt_t into the thread's hash table, + * and link it into the prof_ctx_t's sets_ql. + */ + prof_ctx_t *ctx; + + /* + * Threads use memory barriers to update the counters. Since there is + * only ever one writer, the only challenge is for the reader to get a + * consistent read of the counters. + * + * The writer uses this series of operations: + * + * 1) Increment epoch to an odd number. + * 2) Update counters. + * 3) Increment epoch to an even number. + * + * The reader must assure 1) that the epoch is even while it reads the + * counters, and 2) that the epoch doesn't change between the time it + * starts and finishes reading the counters. + */ + unsigned epoch; + + /* Profiling counters. */ + prof_cnt_t cnts; +}; + +struct prof_ctx_s { + /* Protects cnt_merged and sets_ql. */ + malloc_mutex_t lock; + + /* Temporary storage for aggregation during dump. */ + prof_cnt_t cnt_dump; + + /* When threads exit, they merge their stats into cnt_merged. */ + prof_cnt_t cnt_merged; + + /* + * List of profile counters, one for each thread that has allocated in + * this context. + */ + ql_head(prof_thr_cnt_t) cnts_ql; +}; + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +extern bool opt_prof; +/* + * Even if opt_prof is true, sampling can be temporarily disabled by setting + * opt_prof_active to false. No locking is used when updating opt_prof_active, + * so there are no guarantees regarding how long it will take for all threads + * to notice state changes. + */ +extern bool opt_prof_active; +extern size_t opt_lg_prof_bt_max; /* Maximum backtrace depth. */ +extern size_t opt_lg_prof_sample; /* Mean bytes between samples. */ +extern ssize_t opt_lg_prof_interval; /* lg(prof_interval). */ +extern bool opt_prof_udump; /* High-water memory dumping. */ +extern bool opt_prof_leak; /* Dump leak summary at exit. */ + +/* + * Profile dump interval, measured in bytes allocated. Each arena triggers a + * profile dump when it reaches this threshold. The effect is that the + * interval between profile dumps averages prof_interval, though the actual + * interval between dumps will tend to be sporadic, and the interval will be a + * maximum of approximately (prof_interval * narenas). + */ +extern uint64_t prof_interval; + +/* + * If true, promote small sampled objects to large objects, since small run + * headers do not have embedded profile context pointers. + */ +extern bool prof_promote; + +bool prof_init(prof_t *prof, bool master); +void prof_destroy(prof_t *prof); + +prof_thr_cnt_t *prof_alloc_prep(size_t size); +prof_thr_cnt_t *prof_cnt_get(const void *ptr); +void prof_malloc(const void *ptr, prof_thr_cnt_t *cnt); +void prof_realloc(const void *ptr, prof_thr_cnt_t *cnt, const void *old_ptr, + size_t old_size, prof_thr_cnt_t *old_cnt); +void prof_free(const void *ptr); +void prof_idump(void); +bool prof_mdump(const char *filename); +void prof_udump(void); +void prof_boot0(void); +bool prof_boot1(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ +#endif /* JEMALLOC_PROF */ diff --git a/externals/jemalloc/jemalloc/internal/ql.h b/externals/jemalloc/jemalloc/internal/ql.h new file mode 100644 index 0000000..a9ed239 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/ql.h @@ -0,0 +1,83 @@ +/* + * List definitions. + */ +#define ql_head(a_type) \ +struct { \ + a_type *qlh_first; \ +} + +#define ql_head_initializer(a_head) {NULL} + +#define ql_elm(a_type) qr(a_type) + +/* List functions. */ +#define ql_new(a_head) do { \ + (a_head)->qlh_first = NULL; \ +} while (0) + +#define ql_elm_new(a_elm, a_field) qr_new((a_elm), a_field) + +#define ql_first(a_head) ((a_head)->qlh_first) + +#define ql_last(a_head, a_field) \ + ((ql_first(a_head) != NULL) \ + ? qr_prev(ql_first(a_head), a_field) : NULL) + +#define ql_next(a_head, a_elm, a_field) \ + ((ql_last(a_head, a_field) != (a_elm)) \ + ? qr_next((a_elm), a_field) : NULL) + +#define ql_prev(a_head, a_elm, a_field) \ + ((ql_first(a_head) != (a_elm)) ? qr_prev((a_elm), a_field) \ + : NULL) + +#define ql_before_insert(a_head, a_qlelm, a_elm, a_field) do { \ + qr_before_insert((a_qlelm), (a_elm), a_field); \ + if (ql_first(a_head) == (a_qlelm)) { \ + ql_first(a_head) = (a_elm); \ + } \ +} while (0) + +#define ql_after_insert(a_qlelm, a_elm, a_field) \ + qr_after_insert((a_qlelm), (a_elm), a_field) + +#define ql_head_insert(a_head, a_elm, a_field) do { \ + if (ql_first(a_head) != NULL) { \ + qr_before_insert(ql_first(a_head), (a_elm), a_field); \ + } \ + ql_first(a_head) = (a_elm); \ +} while (0) + +#define ql_tail_insert(a_head, a_elm, a_field) do { \ + if (ql_first(a_head) != NULL) { \ + qr_before_insert(ql_first(a_head), (a_elm), a_field); \ + } \ + ql_first(a_head) = qr_next((a_elm), a_field); \ +} while (0) + +#define ql_remove(a_head, a_elm, a_field) do { \ + if (ql_first(a_head) == (a_elm)) { \ + ql_first(a_head) = qr_next(ql_first(a_head), a_field); \ + } \ + if (ql_first(a_head) != (a_elm)) { \ + qr_remove((a_elm), a_field); \ + } else { \ + ql_first(a_head) = NULL; \ + } \ +} while (0) + +#define ql_head_remove(a_head, a_type, a_field) do { \ + a_type *t = ql_first(a_head); \ + ql_remove((a_head), t, a_field); \ +} while (0) + +#define ql_tail_remove(a_head, a_type, a_field) do { \ + a_type *t = ql_last(a_head, a_field); \ + ql_remove((a_head), t, a_field); \ +} while (0) + +#define ql_foreach(a_var, a_head, a_field) \ + qr_foreach((a_var), ql_first(a_head), a_field) + +#define ql_reverse_foreach(a_var, a_head, a_field) \ + qr_reverse_foreach((a_var), ql_first(a_head), a_field) diff --git a/externals/jemalloc/jemalloc/internal/qr.h b/externals/jemalloc/jemalloc/internal/qr.h new file mode 100644 index 0000000..fe22352 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/qr.h @@ -0,0 +1,67 @@ +/* Ring definitions. */ +#define qr(a_type) \ +struct { \ + a_type *qre_next; \ + a_type *qre_prev; \ +} + +/* Ring functions. */ +#define qr_new(a_qr, a_field) do { \ + (a_qr)->a_field.qre_next = (a_qr); \ + (a_qr)->a_field.qre_prev = (a_qr); \ +} while (0) + +#define qr_next(a_qr, a_field) ((a_qr)->a_field.qre_next) + +#define qr_prev(a_qr, a_field) ((a_qr)->a_field.qre_prev) + +#define qr_before_insert(a_qrelm, a_qr, a_field) do { \ + (a_qr)->a_field.qre_prev = (a_qrelm)->a_field.qre_prev; \ + (a_qr)->a_field.qre_next = (a_qrelm); \ + (a_qr)->a_field.qre_prev->a_field.qre_next = (a_qr); \ + (a_qrelm)->a_field.qre_prev = (a_qr); \ +} while (0) + +#define qr_after_insert(a_qrelm, a_qr, a_field) \ + do \ + { \ + (a_qr)->a_field.qre_next = (a_qrelm)->a_field.qre_next; \ + (a_qr)->a_field.qre_prev = (a_qrelm); \ + (a_qr)->a_field.qre_next->a_field.qre_prev = (a_qr); \ + (a_qrelm)->a_field.qre_next = (a_qr); \ + } while (0) + +#define qr_meld(a_qr_a, a_qr_b, a_field) do { \ + void *t; \ + (a_qr_a)->a_field.qre_prev->a_field.qre_next = (a_qr_b); \ + (a_qr_b)->a_field.qre_prev->a_field.qre_next = (a_qr_a); \ + t = (a_qr_a)->a_field.qre_prev; \ + (a_qr_a)->a_field.qre_prev = (a_qr_b)->a_field.qre_prev; \ + (a_qr_b)->a_field.qre_prev = t; \ +} while (0) + +/* qr_meld() and qr_split() are functionally equivalent, so there's no need to + * have two copies of the code. */ +#define qr_split(a_qr_a, a_qr_b, a_field) \ + qr_meld((a_qr_a), (a_qr_b), a_field) + +#define qr_remove(a_qr, a_field) do { \ + (a_qr)->a_field.qre_prev->a_field.qre_next \ + = (a_qr)->a_field.qre_next; \ + (a_qr)->a_field.qre_next->a_field.qre_prev \ + = (a_qr)->a_field.qre_prev; \ + (a_qr)->a_field.qre_next = (a_qr); \ + (a_qr)->a_field.qre_prev = (a_qr); \ +} while (0) + +#define qr_foreach(var, a_qr, a_field) \ + for ((var) = (a_qr); \ + (var) != NULL; \ + (var) = (((var)->a_field.qre_next != (a_qr)) \ + ? (var)->a_field.qre_next : NULL)) + +#define qr_reverse_foreach(var, a_qr, a_field) \ + for ((var) = ((a_qr) != NULL) ? qr_prev(a_qr, a_field) : NULL; \ + (var) != NULL; \ + (var) = (((var) != (a_qr)) \ + ? (var)->a_field.qre_prev : NULL)) diff --git a/externals/jemalloc/jemalloc/internal/rb.h b/externals/jemalloc/jemalloc/internal/rb.h new file mode 100644 index 0000000..ee9b009 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/rb.h @@ -0,0 +1,973 @@ +/*- + ******************************************************************************* + * + * cpp macro implementation of left-leaning 2-3 red-black trees. Parent + * pointers are not used, and color bits are stored in the least significant + * bit of right-child pointers (if RB_COMPACT is defined), thus making node + * linkage as compact as is possible for red-black trees. + * + * Usage: + * + * #include + * #include + * #define NDEBUG // (Optional, see assert(3).) + * #include + * #define RB_COMPACT // (Optional, embed color bits in right-child pointers.) + * #include + * ... + * + ******************************************************************************* + */ + +#ifndef RB_H_ +#define RB_H_ + +#if 0 +__FBSDID("$FreeBSD: head/lib/libc/stdlib/rb.h 204493 2010-02-28 22:57:13Z jasone $"); +#endif + +#ifdef RB_COMPACT +/* Node structure. */ +#define rb_node(a_type) \ +struct { \ + a_type *rbn_left; \ + a_type *rbn_right_red; \ +} +#else +#define rb_node(a_type) \ +struct { \ + a_type *rbn_left; \ + a_type *rbn_right; \ + bool rbn_red; \ +} +#endif + +/* Root structure. */ +#define rb_tree(a_type) \ +struct { \ + a_type *rbt_root; \ + a_type rbt_nil; \ +} + +/* Left accessors. */ +#define rbtn_left_get(a_type, a_field, a_node) \ + ((a_node)->a_field.rbn_left) +#define rbtn_left_set(a_type, a_field, a_node, a_left) do { \ + (a_node)->a_field.rbn_left = a_left; \ +} while (0) + +#ifdef RB_COMPACT +/* Right accessors. */ +#define rbtn_right_get(a_type, a_field, a_node) \ + ((a_type *) (((intptr_t) (a_node)->a_field.rbn_right_red) \ + & ((ssize_t)-2))) +#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) a_right) \ + | (((uintptr_t) (a_node)->a_field.rbn_right_red) & ((size_t)1))); \ +} while (0) + +/* Color accessors. */ +#define rbtn_red_get(a_type, a_field, a_node) \ + ((bool) (((uintptr_t) (a_node)->a_field.rbn_right_red) \ + & ((size_t)1))) +#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) ((((intptr_t) \ + (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)) \ + | ((ssize_t)a_red)); \ +} while (0) +#define rbtn_red_set(a_type, a_field, a_node) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) \ + (a_node)->a_field.rbn_right_red) | ((size_t)1)); \ +} while (0) +#define rbtn_black_set(a_type, a_field, a_node) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \ + (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \ +} while (0) +#else +/* Right accessors. */ +#define rbtn_right_get(a_type, a_field, a_node) \ + ((a_node)->a_field.rbn_right) +#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \ + (a_node)->a_field.rbn_right = a_right; \ +} while (0) + +/* Color accessors. */ +#define rbtn_red_get(a_type, a_field, a_node) \ + ((a_node)->a_field.rbn_red) +#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \ + (a_node)->a_field.rbn_red = (a_red); \ +} while (0) +#define rbtn_red_set(a_type, a_field, a_node) do { \ + (a_node)->a_field.rbn_red = true; \ +} while (0) +#define rbtn_black_set(a_type, a_field, a_node) do { \ + (a_node)->a_field.rbn_red = false; \ +} while (0) +#endif + +/* Node initializer. */ +#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \ + rbtn_left_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \ + rbtn_right_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \ + rbtn_red_set(a_type, a_field, (a_node)); \ +} while (0) + +/* Tree initializer. */ +#define rb_new(a_type, a_field, a_rbt) do { \ + (a_rbt)->rbt_root = &(a_rbt)->rbt_nil; \ + rbt_node_new(a_type, a_field, a_rbt, &(a_rbt)->rbt_nil); \ + rbtn_black_set(a_type, a_field, &(a_rbt)->rbt_nil); \ +} while (0) + +/* Internal utility macros. */ +#define rbtn_first(a_type, a_field, a_rbt, a_root, r_node) do { \ + (r_node) = (a_root); \ + if ((r_node) != &(a_rbt)->rbt_nil) { \ + for (; \ + rbtn_left_get(a_type, a_field, (r_node)) != &(a_rbt)->rbt_nil;\ + (r_node) = rbtn_left_get(a_type, a_field, (r_node))) { \ + } \ + } \ +} while (0) + +#define rbtn_last(a_type, a_field, a_rbt, a_root, r_node) do { \ + (r_node) = (a_root); \ + if ((r_node) != &(a_rbt)->rbt_nil) { \ + for (; rbtn_right_get(a_type, a_field, (r_node)) != \ + &(a_rbt)->rbt_nil; (r_node) = rbtn_right_get(a_type, a_field, \ + (r_node))) { \ + } \ + } \ +} while (0) + +#define rbtn_rotate_left(a_type, a_field, a_node, r_node) do { \ + (r_node) = rbtn_right_get(a_type, a_field, (a_node)); \ + rbtn_right_set(a_type, a_field, (a_node), \ + rbtn_left_get(a_type, a_field, (r_node))); \ + rbtn_left_set(a_type, a_field, (r_node), (a_node)); \ +} while (0) + +#define rbtn_rotate_right(a_type, a_field, a_node, r_node) do { \ + (r_node) = rbtn_left_get(a_type, a_field, (a_node)); \ + rbtn_left_set(a_type, a_field, (a_node), \ + rbtn_right_get(a_type, a_field, (r_node))); \ + rbtn_right_set(a_type, a_field, (r_node), (a_node)); \ +} while (0) + +/* + * The rb_proto() macro generates function prototypes that correspond to the + * functions generated by an equivalently parameterized call to rb_gen(). + */ + +#define rb_proto(a_attr, a_prefix, a_rbt_type, a_type) \ +a_attr void \ +a_prefix##new(a_rbt_type *rbtree); \ +a_attr a_type * \ +a_prefix##first(a_rbt_type *rbtree); \ +a_attr a_type * \ +a_prefix##last(a_rbt_type *rbtree); \ +a_attr a_type * \ +a_prefix##next(a_rbt_type *rbtree, a_type *node); \ +a_attr a_type * \ +a_prefix##prev(a_rbt_type *rbtree, a_type *node); \ +a_attr a_type * \ +a_prefix##search(a_rbt_type *rbtree, a_type *key); \ +a_attr a_type * \ +a_prefix##nsearch(a_rbt_type *rbtree, a_type *key); \ +a_attr a_type * \ +a_prefix##psearch(a_rbt_type *rbtree, a_type *key); \ +a_attr void \ +a_prefix##insert(a_rbt_type *rbtree, a_type *node); \ +a_attr void \ +a_prefix##remove(a_rbt_type *rbtree, a_type *node); \ +a_attr a_type * \ +a_prefix##iter(a_rbt_type *rbtree, a_type *start, a_type *(*cb)( \ + a_rbt_type *, a_type *, void *), void *arg); \ +a_attr a_type * \ +a_prefix##reverse_iter(a_rbt_type *rbtree, a_type *start, \ + a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg); + +/* + * The rb_gen() macro generates a type-specific red-black tree implementation, + * based on the above cpp macros. + * + * Arguments: + * + * a_attr : Function attribute for generated functions (ex: static). + * a_prefix : Prefix for generated functions (ex: ex_). + * a_rb_type : Type for red-black tree data structure (ex: ex_t). + * a_type : Type for red-black tree node data structure (ex: ex_node_t). + * a_field : Name of red-black tree node linkage (ex: ex_link). + * a_cmp : Node comparison function name, with the following prototype: + * int (a_cmp *)(a_type *a_node, a_type *a_other); + * ^^^^^^ + * or a_key + * Interpretation of comparision function return values: + * -1 : a_node < a_other + * 0 : a_node == a_other + * 1 : a_node > a_other + * In all cases, the a_node or a_key macro argument is the first + * argument to the comparison function, which makes it possible + * to write comparison functions that treat the first argument + * specially. + * + * Assuming the following setup: + * + * typedef struct ex_node_s ex_node_t; + * struct ex_node_s { + * rb_node(ex_node_t) ex_link; + * }; + * typedef rb_tree(ex_node_t) ex_t; + * rb_gen(static, ex_, ex_t, ex_node_t, ex_link, ex_cmp) + * + * The following API is generated: + * + * static void + * ex_new(ex_t *extree); + * Description: Initialize a red-black tree structure. + * Args: + * extree: Pointer to an uninitialized red-black tree object. + * + * static ex_node_t * + * ex_first(ex_t *extree); + * static ex_node_t * + * ex_last(ex_t *extree); + * Description: Get the first/last node in extree. + * Args: + * extree: Pointer to an initialized red-black tree object. + * Ret: First/last node in extree, or NULL if extree is empty. + * + * static ex_node_t * + * ex_next(ex_t *extree, ex_node_t *node); + * static ex_node_t * + * ex_prev(ex_t *extree, ex_node_t *node); + * Description: Get node's successor/predecessor. + * Args: + * extree: Pointer to an initialized red-black tree object. + * node : A node in extree. + * Ret: node's successor/predecessor in extree, or NULL if node is + * last/first. + * + * static ex_node_t * + * ex_search(ex_t *extree, ex_node_t *key); + * Description: Search for node that matches key. + * Args: + * extree: Pointer to an initialized red-black tree object. + * key : Search key. + * Ret: Node in extree that matches key, or NULL if no match. + * + * static ex_node_t * + * ex_nsearch(ex_t *extree, ex_node_t *key); + * static ex_node_t * + * ex_psearch(ex_t *extree, ex_node_t *key); + * Description: Search for node that matches key. If no match is found, + * return what would be key's successor/predecessor, were + * key in extree. + * Args: + * extree: Pointer to an initialized red-black tree object. + * key : Search key. + * Ret: Node in extree that matches key, or if no match, hypothetical + * node's successor/predecessor (NULL if no successor/predecessor). + * + * static void + * ex_insert(ex_t *extree, ex_node_t *node); + * Description: Insert node into extree. + * Args: + * extree: Pointer to an initialized red-black tree object. + * node : Node to be inserted into extree. + * + * static void + * ex_remove(ex_t *extree, ex_node_t *node); + * Description: Remove node from extree. + * Args: + * extree: Pointer to an initialized red-black tree object. + * node : Node in extree to be removed. + * + * static ex_node_t * + * ex_iter(ex_t *extree, ex_node_t *start, ex_node_t *(*cb)(ex_t *, + * ex_node_t *, void *), void *arg); + * static ex_node_t * + * ex_reverse_iter(ex_t *extree, ex_node_t *start, ex_node *(*cb)(ex_t *, + * ex_node_t *, void *), void *arg); + * Description: Iterate forward/backward over extree, starting at node. + * If extree is modified, iteration must be immediately + * terminated by the callback function that causes the + * modification. + * Args: + * extree: Pointer to an initialized red-black tree object. + * start : Node at which to start iteration, or NULL to start at + * first/last node. + * cb : Callback function, which is called for each node during + * iteration. Under normal circumstances the callback function + * should return NULL, which causes iteration to continue. If a + * callback function returns non-NULL, iteration is immediately + * terminated and the non-NULL return value is returned by the + * iterator. This is useful for re-starting iteration after + * modifying extree. + * arg : Opaque pointer passed to cb(). + * Ret: NULL if iteration completed, or the non-NULL callback return value + * that caused termination of the iteration. + */ +#define rb_gen(a_attr, a_prefix, a_rbt_type, a_type, a_field, a_cmp) \ +a_attr void \ +a_prefix##new(a_rbt_type *rbtree) { \ + rb_new(a_type, a_field, rbtree); \ +} \ +a_attr a_type * \ +a_prefix##first(a_rbt_type *rbtree) { \ + a_type *ret; \ + rbtn_first(a_type, a_field, rbtree, rbtree->rbt_root, ret); \ + if (ret == &rbtree->rbt_nil) { \ + ret = NULL; \ + } \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##last(a_rbt_type *rbtree) { \ + a_type *ret; \ + rbtn_last(a_type, a_field, rbtree, rbtree->rbt_root, ret); \ + if (ret == &rbtree->rbt_nil) { \ + ret = NULL; \ + } \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##next(a_rbt_type *rbtree, a_type *node) { \ + a_type *ret; \ + if (rbtn_right_get(a_type, a_field, node) != &rbtree->rbt_nil) { \ + rbtn_first(a_type, a_field, rbtree, rbtn_right_get(a_type, \ + a_field, node), ret); \ + } else { \ + a_type *tnode = rbtree->rbt_root; \ + assert(tnode != &rbtree->rbt_nil); \ + ret = &rbtree->rbt_nil; \ + while (true) { \ + int cmp = (a_cmp)(node, tnode); \ + if (cmp < 0) { \ + ret = tnode; \ + tnode = rbtn_left_get(a_type, a_field, tnode); \ + } else if (cmp > 0) { \ + tnode = rbtn_right_get(a_type, a_field, tnode); \ + } else { \ + break; \ + } \ + assert(tnode != &rbtree->rbt_nil); \ + } \ + } \ + if (ret == &rbtree->rbt_nil) { \ + ret = (NULL); \ + } \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##prev(a_rbt_type *rbtree, a_type *node) { \ + a_type *ret; \ + if (rbtn_left_get(a_type, a_field, node) != &rbtree->rbt_nil) { \ + rbtn_last(a_type, a_field, rbtree, rbtn_left_get(a_type, \ + a_field, node), ret); \ + } else { \ + a_type *tnode = rbtree->rbt_root; \ + assert(tnode != &rbtree->rbt_nil); \ + ret = &rbtree->rbt_nil; \ + while (true) { \ + int cmp = (a_cmp)(node, tnode); \ + if (cmp < 0) { \ + tnode = rbtn_left_get(a_type, a_field, tnode); \ + } else if (cmp > 0) { \ + ret = tnode; \ + tnode = rbtn_right_get(a_type, a_field, tnode); \ + } else { \ + break; \ + } \ + assert(tnode != &rbtree->rbt_nil); \ + } \ + } \ + if (ret == &rbtree->rbt_nil) { \ + ret = (NULL); \ + } \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##search(a_rbt_type *rbtree, a_type *key) { \ + a_type *ret; \ + int cmp; \ + ret = rbtree->rbt_root; \ + while (ret != &rbtree->rbt_nil \ + && (cmp = (a_cmp)(key, ret)) != 0) { \ + if (cmp < 0) { \ + ret = rbtn_left_get(a_type, a_field, ret); \ + } else { \ + ret = rbtn_right_get(a_type, a_field, ret); \ + } \ + } \ + if (ret == &rbtree->rbt_nil) { \ + ret = (NULL); \ + } \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##nsearch(a_rbt_type *rbtree, a_type *key) { \ + a_type *ret; \ + a_type *tnode = rbtree->rbt_root; \ + ret = &rbtree->rbt_nil; \ + while (tnode != &rbtree->rbt_nil) { \ + int cmp = (a_cmp)(key, tnode); \ + if (cmp < 0) { \ + ret = tnode; \ + tnode = rbtn_left_get(a_type, a_field, tnode); \ + } else if (cmp > 0) { \ + tnode = rbtn_right_get(a_type, a_field, tnode); \ + } else { \ + ret = tnode; \ + break; \ + } \ + } \ + if (ret == &rbtree->rbt_nil) { \ + ret = (NULL); \ + } \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##psearch(a_rbt_type *rbtree, a_type *key) { \ + a_type *ret; \ + a_type *tnode = rbtree->rbt_root; \ + ret = &rbtree->rbt_nil; \ + while (tnode != &rbtree->rbt_nil) { \ + int cmp = (a_cmp)(key, tnode); \ + if (cmp < 0) { \ + tnode = rbtn_left_get(a_type, a_field, tnode); \ + } else if (cmp > 0) { \ + ret = tnode; \ + tnode = rbtn_right_get(a_type, a_field, tnode); \ + } else { \ + ret = tnode; \ + break; \ + } \ + } \ + if (ret == &rbtree->rbt_nil) { \ + ret = (NULL); \ + } \ + return (ret); \ +} \ +a_attr void \ +a_prefix##insert(a_rbt_type *rbtree, a_type *node) { \ + struct { \ + a_type *node; \ + int cmp; \ + } path[sizeof(void *) << 4], *pathp; \ + rbt_node_new(a_type, a_field, rbtree, node); \ + /* Wind. */ \ + path->node = rbtree->rbt_root; \ + for (pathp = path; pathp->node != &rbtree->rbt_nil; pathp++) { \ + int cmp = pathp->cmp = a_cmp(node, pathp->node); \ + assert(cmp != 0); \ + if (cmp < 0) { \ + pathp[1].node = rbtn_left_get(a_type, a_field, \ + pathp->node); \ + } else { \ + pathp[1].node = rbtn_right_get(a_type, a_field, \ + pathp->node); \ + } \ + } \ + pathp->node = node; \ + /* Unwind. */ \ + for (pathp--; (uintptr_t)pathp >= (uintptr_t)path; pathp--) { \ + a_type *cnode = pathp->node; \ + if (pathp->cmp < 0) { \ + a_type *left = pathp[1].node; \ + rbtn_left_set(a_type, a_field, cnode, left); \ + if (rbtn_red_get(a_type, a_field, left)) { \ + a_type *leftleft = rbtn_left_get(a_type, a_field, left);\ + if (rbtn_red_get(a_type, a_field, leftleft)) { \ + /* Fix up 4-node. */ \ + a_type *tnode; \ + rbtn_black_set(a_type, a_field, leftleft); \ + rbtn_rotate_right(a_type, a_field, cnode, tnode); \ + cnode = tnode; \ + } \ + } else { \ + return; \ + } \ + } else { \ + a_type *right = pathp[1].node; \ + rbtn_right_set(a_type, a_field, cnode, right); \ + if (rbtn_red_get(a_type, a_field, right)) { \ + a_type *left = rbtn_left_get(a_type, a_field, cnode); \ + if (rbtn_red_get(a_type, a_field, left)) { \ + /* Split 4-node. */ \ + rbtn_black_set(a_type, a_field, left); \ + rbtn_black_set(a_type, a_field, right); \ + rbtn_red_set(a_type, a_field, cnode); \ + } else { \ + /* Lean left. */ \ + a_type *tnode; \ + bool tred = rbtn_red_get(a_type, a_field, cnode); \ + rbtn_rotate_left(a_type, a_field, cnode, tnode); \ + rbtn_color_set(a_type, a_field, tnode, tred); \ + rbtn_red_set(a_type, a_field, cnode); \ + cnode = tnode; \ + } \ + } else { \ + return; \ + } \ + } \ + pathp->node = cnode; \ + } \ + /* Set root, and make it black. */ \ + rbtree->rbt_root = path->node; \ + rbtn_black_set(a_type, a_field, rbtree->rbt_root); \ +} \ +a_attr void \ +a_prefix##remove(a_rbt_type *rbtree, a_type *node) { \ + struct { \ + a_type *node; \ + int cmp; \ + } *pathp, *nodep, path[sizeof(void *) << 4]; \ + /* Wind. */ \ + nodep = NULL; /* Silence compiler warning. */ \ + path->node = rbtree->rbt_root; \ + for (pathp = path; pathp->node != &rbtree->rbt_nil; pathp++) { \ + int cmp = pathp->cmp = a_cmp(node, pathp->node); \ + if (cmp < 0) { \ + pathp[1].node = rbtn_left_get(a_type, a_field, \ + pathp->node); \ + } else { \ + pathp[1].node = rbtn_right_get(a_type, a_field, \ + pathp->node); \ + if (cmp == 0) { \ + /* Find node's successor, in preparation for swap. */ \ + pathp->cmp = 1; \ + nodep = pathp; \ + for (pathp++; pathp->node != &rbtree->rbt_nil; \ + pathp++) { \ + pathp->cmp = -1; \ + pathp[1].node = rbtn_left_get(a_type, a_field, \ + pathp->node); \ + } \ + break; \ + } \ + } \ + } \ + assert(nodep->node == node); \ + pathp--; \ + if (pathp->node != node) { \ + /* Swap node with its successor. */ \ + bool tred = rbtn_red_get(a_type, a_field, pathp->node); \ + rbtn_color_set(a_type, a_field, pathp->node, \ + rbtn_red_get(a_type, a_field, node)); \ + rbtn_left_set(a_type, a_field, pathp->node, \ + rbtn_left_get(a_type, a_field, node)); \ + /* If node's successor is its right child, the following code */\ + /* will do the wrong thing for the right child pointer. */\ + /* However, it doesn't matter, because the pointer will be */\ + /* properly set when the successor is pruned. */\ + rbtn_right_set(a_type, a_field, pathp->node, \ + rbtn_right_get(a_type, a_field, node)); \ + rbtn_color_set(a_type, a_field, node, tred); \ + /* The pruned leaf node's child pointers are never accessed */\ + /* again, so don't bother setting them to nil. */\ + nodep->node = pathp->node; \ + pathp->node = node; \ + if (nodep == path) { \ + rbtree->rbt_root = nodep->node; \ + } else { \ + if (nodep[-1].cmp < 0) { \ + rbtn_left_set(a_type, a_field, nodep[-1].node, \ + nodep->node); \ + } else { \ + rbtn_right_set(a_type, a_field, nodep[-1].node, \ + nodep->node); \ + } \ + } \ + } else { \ + a_type *left = rbtn_left_get(a_type, a_field, node); \ + if (left != &rbtree->rbt_nil) { \ + /* node has no successor, but it has a left child. */\ + /* Splice node out, without losing the left child. */\ + assert(rbtn_red_get(a_type, a_field, node) == false); \ + assert(rbtn_red_get(a_type, a_field, left)); \ + rbtn_black_set(a_type, a_field, left); \ + if (pathp == path) { \ + rbtree->rbt_root = left; \ + } else { \ + if (pathp[-1].cmp < 0) { \ + rbtn_left_set(a_type, a_field, pathp[-1].node, \ + left); \ + } else { \ + rbtn_right_set(a_type, a_field, pathp[-1].node, \ + left); \ + } \ + } \ + return; \ + } else if (pathp == path) { \ + /* The tree only contained one node. */ \ + rbtree->rbt_root = &rbtree->rbt_nil; \ + return; \ + } \ + } \ + if (rbtn_red_get(a_type, a_field, pathp->node)) { \ + /* Prune red node, which requires no fixup. */ \ + assert(pathp[-1].cmp < 0); \ + rbtn_left_set(a_type, a_field, pathp[-1].node, \ + &rbtree->rbt_nil); \ + return; \ + } \ + /* The node to be pruned is black, so unwind until balance is */\ + /* restored. */\ + pathp->node = &rbtree->rbt_nil; \ + for (pathp--; (uintptr_t)pathp >= (uintptr_t)path; pathp--) { \ + assert(pathp->cmp != 0); \ + if (pathp->cmp < 0) { \ + rbtn_left_set(a_type, a_field, pathp->node, \ + pathp[1].node); \ + assert(rbtn_red_get(a_type, a_field, pathp[1].node) \ + == false); \ + if (rbtn_red_get(a_type, a_field, pathp->node)) { \ + a_type *right = rbtn_right_get(a_type, a_field, \ + pathp->node); \ + a_type *rightleft = rbtn_left_get(a_type, a_field, \ + right); \ + a_type *tnode; \ + if (rbtn_red_get(a_type, a_field, rightleft)) { \ + /* In the following diagrams, ||, //, and \\ */\ + /* indicate the path to the removed node. */\ + /* */\ + /* || */\ + /* pathp(r) */\ + /* // \ */\ + /* (b) (b) */\ + /* / */\ + /* (r) */\ + /* */\ + rbtn_black_set(a_type, a_field, pathp->node); \ + rbtn_rotate_right(a_type, a_field, right, tnode); \ + rbtn_right_set(a_type, a_field, pathp->node, tnode);\ + rbtn_rotate_left(a_type, a_field, pathp->node, \ + tnode); \ + } else { \ + /* || */\ + /* pathp(r) */\ + /* // \ */\ + /* (b) (b) */\ + /* / */\ + /* (b) */\ + /* */\ + rbtn_rotate_left(a_type, a_field, pathp->node, \ + tnode); \ + } \ + /* Balance restored, but rotation modified subtree */\ + /* root. */\ + assert((uintptr_t)pathp > (uintptr_t)path); \ + if (pathp[-1].cmp < 0) { \ + rbtn_left_set(a_type, a_field, pathp[-1].node, \ + tnode); \ + } else { \ + rbtn_right_set(a_type, a_field, pathp[-1].node, \ + tnode); \ + } \ + return; \ + } else { \ + a_type *right = rbtn_right_get(a_type, a_field, \ + pathp->node); \ + a_type *rightleft = rbtn_left_get(a_type, a_field, \ + right); \ + if (rbtn_red_get(a_type, a_field, rightleft)) { \ + /* || */\ + /* pathp(b) */\ + /* // \ */\ + /* (b) (b) */\ + /* / */\ + /* (r) */\ + a_type *tnode; \ + rbtn_black_set(a_type, a_field, rightleft); \ + rbtn_rotate_right(a_type, a_field, right, tnode); \ + rbtn_right_set(a_type, a_field, pathp->node, tnode);\ + rbtn_rotate_left(a_type, a_field, pathp->node, \ + tnode); \ + /* Balance restored, but rotation modified */\ + /* subree root, which may actually be the tree */\ + /* root. */\ + if (pathp == path) { \ + /* Set root. */ \ + rbtree->rbt_root = tnode; \ + } else { \ + if (pathp[-1].cmp < 0) { \ + rbtn_left_set(a_type, a_field, \ + pathp[-1].node, tnode); \ + } else { \ + rbtn_right_set(a_type, a_field, \ + pathp[-1].node, tnode); \ + } \ + } \ + return; \ + } else { \ + /* || */\ + /* pathp(b) */\ + /* // \ */\ + /* (b) (b) */\ + /* / */\ + /* (b) */\ + a_type *tnode; \ + rbtn_red_set(a_type, a_field, pathp->node); \ + rbtn_rotate_left(a_type, a_field, pathp->node, \ + tnode); \ + pathp->node = tnode; \ + } \ + } \ + } else { \ + a_type *left; \ + rbtn_right_set(a_type, a_field, pathp->node, \ + pathp[1].node); \ + left = rbtn_left_get(a_type, a_field, pathp->node); \ + if (rbtn_red_get(a_type, a_field, left)) { \ + a_type *tnode; \ + a_type *leftright = rbtn_right_get(a_type, a_field, \ + left); \ + a_type *leftrightleft = rbtn_left_get(a_type, a_field, \ + leftright); \ + if (rbtn_red_get(a_type, a_field, leftrightleft)) { \ + /* || */\ + /* pathp(b) */\ + /* / \\ */\ + /* (r) (b) */\ + /* \ */\ + /* (b) */\ + /* / */\ + /* (r) */\ + a_type *unode; \ + rbtn_black_set(a_type, a_field, leftrightleft); \ + rbtn_rotate_right(a_type, a_field, pathp->node, \ + unode); \ + rbtn_rotate_right(a_type, a_field, pathp->node, \ + tnode); \ + rbtn_right_set(a_type, a_field, unode, tnode); \ + rbtn_rotate_left(a_type, a_field, unode, tnode); \ + } else { \ + /* || */\ + /* pathp(b) */\ + /* / \\ */\ + /* (r) (b) */\ + /* \ */\ + /* (b) */\ + /* / */\ + /* (b) */\ + assert(leftright != &rbtree->rbt_nil); \ + rbtn_red_set(a_type, a_field, leftright); \ + rbtn_rotate_right(a_type, a_field, pathp->node, \ + tnode); \ + rbtn_black_set(a_type, a_field, tnode); \ + } \ + /* Balance restored, but rotation modified subtree */\ + /* root, which may actually be the tree root. */\ + if (pathp == path) { \ + /* Set root. */ \ + rbtree->rbt_root = tnode; \ + } else { \ + if (pathp[-1].cmp < 0) { \ + rbtn_left_set(a_type, a_field, pathp[-1].node, \ + tnode); \ + } else { \ + rbtn_right_set(a_type, a_field, pathp[-1].node, \ + tnode); \ + } \ + } \ + return; \ + } else if (rbtn_red_get(a_type, a_field, pathp->node)) { \ + a_type *leftleft = rbtn_left_get(a_type, a_field, left);\ + if (rbtn_red_get(a_type, a_field, leftleft)) { \ + /* || */\ + /* pathp(r) */\ + /* / \\ */\ + /* (b) (b) */\ + /* / */\ + /* (r) */\ + a_type *tnode; \ + rbtn_black_set(a_type, a_field, pathp->node); \ + rbtn_red_set(a_type, a_field, left); \ + rbtn_black_set(a_type, a_field, leftleft); \ + rbtn_rotate_right(a_type, a_field, pathp->node, \ + tnode); \ + /* Balance restored, but rotation modified */\ + /* subtree root. */\ + assert((uintptr_t)pathp > (uintptr_t)path); \ + if (pathp[-1].cmp < 0) { \ + rbtn_left_set(a_type, a_field, pathp[-1].node, \ + tnode); \ + } else { \ + rbtn_right_set(a_type, a_field, pathp[-1].node, \ + tnode); \ + } \ + return; \ + } else { \ + /* || */\ + /* pathp(r) */\ + /* / \\ */\ + /* (b) (b) */\ + /* / */\ + /* (b) */\ + rbtn_red_set(a_type, a_field, left); \ + rbtn_black_set(a_type, a_field, pathp->node); \ + /* Balance restored. */ \ + return; \ + } \ + } else { \ + a_type *leftleft = rbtn_left_get(a_type, a_field, left);\ + if (rbtn_red_get(a_type, a_field, leftleft)) { \ + /* || */\ + /* pathp(b) */\ + /* / \\ */\ + /* (b) (b) */\ + /* / */\ + /* (r) */\ + a_type *tnode; \ + rbtn_black_set(a_type, a_field, leftleft); \ + rbtn_rotate_right(a_type, a_field, pathp->node, \ + tnode); \ + /* Balance restored, but rotation modified */\ + /* subtree root, which may actually be the tree */\ + /* root. */\ + if (pathp == path) { \ + /* Set root. */ \ + rbtree->rbt_root = tnode; \ + } else { \ + if (pathp[-1].cmp < 0) { \ + rbtn_left_set(a_type, a_field, \ + pathp[-1].node, tnode); \ + } else { \ + rbtn_right_set(a_type, a_field, \ + pathp[-1].node, tnode); \ + } \ + } \ + return; \ + } else { \ + /* || */\ + /* pathp(b) */\ + /* / \\ */\ + /* (b) (b) */\ + /* / */\ + /* (b) */\ + rbtn_red_set(a_type, a_field, left); \ + } \ + } \ + } \ + } \ + /* Set root. */ \ + rbtree->rbt_root = path->node; \ + assert(rbtn_red_get(a_type, a_field, rbtree->rbt_root) == false); \ +} \ +a_attr a_type * \ +a_prefix##iter_recurse(a_rbt_type *rbtree, a_type *node, \ + a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \ + if (node == &rbtree->rbt_nil) { \ + return (&rbtree->rbt_nil); \ + } else { \ + a_type *ret; \ + if ((ret = a_prefix##iter_recurse(rbtree, rbtn_left_get(a_type, \ + a_field, node), cb, arg)) != &rbtree->rbt_nil \ + || (ret = cb(rbtree, node, arg)) != NULL) { \ + return (ret); \ + } \ + return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \ + a_field, node), cb, arg)); \ + } \ +} \ +a_attr a_type * \ +a_prefix##iter_start(a_rbt_type *rbtree, a_type *start, a_type *node, \ + a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \ + int cmp = a_cmp(start, node); \ + if (cmp < 0) { \ + a_type *ret; \ + if ((ret = a_prefix##iter_start(rbtree, start, \ + rbtn_left_get(a_type, a_field, node), cb, arg)) != \ + &rbtree->rbt_nil || (ret = cb(rbtree, node, arg)) != NULL) { \ + return (ret); \ + } \ + return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \ + a_field, node), cb, arg)); \ + } else if (cmp > 0) { \ + return (a_prefix##iter_start(rbtree, start, \ + rbtn_right_get(a_type, a_field, node), cb, arg)); \ + } else { \ + a_type *ret; \ + if ((ret = cb(rbtree, node, arg)) != NULL) { \ + return (ret); \ + } \ + return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \ + a_field, node), cb, arg)); \ + } \ +} \ +a_attr a_type * \ +a_prefix##iter(a_rbt_type *rbtree, a_type *start, a_type *(*cb)( \ + a_rbt_type *, a_type *, void *), void *arg) { \ + a_type *ret; \ + if (start != NULL) { \ + ret = a_prefix##iter_start(rbtree, start, rbtree->rbt_root, \ + cb, arg); \ + } else { \ + ret = a_prefix##iter_recurse(rbtree, rbtree->rbt_root, cb, arg);\ + } \ + if (ret == &rbtree->rbt_nil) { \ + ret = NULL; \ + } \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##reverse_iter_recurse(a_rbt_type *rbtree, a_type *node, \ + a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \ + if (node == &rbtree->rbt_nil) { \ + return (&rbtree->rbt_nil); \ + } else { \ + a_type *ret; \ + if ((ret = a_prefix##reverse_iter_recurse(rbtree, \ + rbtn_right_get(a_type, a_field, node), cb, arg)) != \ + &rbtree->rbt_nil || (ret = cb(rbtree, node, arg)) != NULL) { \ + return (ret); \ + } \ + return (a_prefix##reverse_iter_recurse(rbtree, \ + rbtn_left_get(a_type, a_field, node), cb, arg)); \ + } \ +} \ +a_attr a_type * \ +a_prefix##reverse_iter_start(a_rbt_type *rbtree, a_type *start, \ + a_type *node, a_type *(*cb)(a_rbt_type *, a_type *, void *), \ + void *arg) { \ + int cmp = a_cmp(start, node); \ + if (cmp > 0) { \ + a_type *ret; \ + if ((ret = a_prefix##reverse_iter_start(rbtree, start, \ + rbtn_right_get(a_type, a_field, node), cb, arg)) != \ + &rbtree->rbt_nil || (ret = cb(rbtree, node, arg)) != NULL) { \ + return (ret); \ + } \ + return (a_prefix##reverse_iter_recurse(rbtree, \ + rbtn_left_get(a_type, a_field, node), cb, arg)); \ + } else if (cmp < 0) { \ + return (a_prefix##reverse_iter_start(rbtree, start, \ + rbtn_left_get(a_type, a_field, node), cb, arg)); \ + } else { \ + a_type *ret; \ + if ((ret = cb(rbtree, node, arg)) != NULL) { \ + return (ret); \ + } \ + return (a_prefix##reverse_iter_recurse(rbtree, \ + rbtn_left_get(a_type, a_field, node), cb, arg)); \ + } \ +} \ +a_attr a_type * \ +a_prefix##reverse_iter(a_rbt_type *rbtree, a_type *start, \ + a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \ + a_type *ret; \ + if (start != NULL) { \ + ret = a_prefix##reverse_iter_start(rbtree, start, \ + rbtree->rbt_root, cb, arg); \ + } else { \ + ret = a_prefix##reverse_iter_recurse(rbtree, rbtree->rbt_root, \ + cb, arg); \ + } \ + if (ret == &rbtree->rbt_nil) { \ + ret = NULL; \ + } \ + return (ret); \ +} + +#endif /* RB_H_ */ diff --git a/externals/jemalloc/jemalloc/internal/stats.h b/externals/jemalloc/jemalloc/internal/stats.h new file mode 100644 index 0000000..cbf035f --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/stats.h @@ -0,0 +1,174 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +#define UMAX2S_BUFSIZE 65 + +#ifdef JEMALLOC_STATS +typedef struct tcache_bin_stats_s tcache_bin_stats_t; +typedef struct malloc_bin_stats_s malloc_bin_stats_t; +typedef struct malloc_large_stats_s malloc_large_stats_t; +typedef struct arena_stats_s arena_stats_t; +#endif +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) +typedef struct chunk_stats_s chunk_stats_t; +#endif + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#ifdef JEMALLOC_STATS + +#ifdef JEMALLOC_TCACHE +struct tcache_bin_stats_s { + /* + * Number of allocation requests that corresponded to the size of this + * bin. + */ + uint64_t nrequests; +}; +#endif + +struct malloc_bin_stats_s { + /* + * Current number of bytes allocated, including objects currently + * cached by tcache. + */ + size_t allocated; + + /* + * Total number of allocation/deallocation requests served directly by + * the bin. Note that tcache may allocate an object, then recycle it + * many times, resulting many increments to nrequests, but only one + * each to nmalloc and ndalloc. + */ + uint64_t nmalloc; + uint64_t ndalloc; + + /* + * Number of allocation requests that correspond to the size of this + * bin. This includes requests served by tcache, though tcache only + * periodically merges into this counter. + */ + uint64_t nrequests; + +#ifdef JEMALLOC_TCACHE + /* Number of tcache fills from this bin. */ + uint64_t nfills; + + /* Number of tcache flushes to this bin. */ + uint64_t nflushes; +#endif + + /* Total number of runs created for this bin's size class. */ + uint64_t nruns; + + /* + * Total number of runs reused by extracting them from the runs tree for + * this bin's size class. + */ + uint64_t reruns; + + /* High-water mark for this bin. */ + size_t highruns; + + /* Current number of runs in this bin. */ + size_t curruns; +}; + +struct malloc_large_stats_s { + /* + * Total number of allocation/deallocation requests served directly by + * the arena. Note that tcache may allocate an object, then recycle it + * many times, resulting many increments to nrequests, but only one + * each to nmalloc and ndalloc. + */ + uint64_t nmalloc; + uint64_t ndalloc; + + /* + * Number of allocation requests that correspond to this size class. + * This includes requests served by tcache, though tcache only + * periodically merges into this counter. + */ + uint64_t nrequests; + + /* High-water mark for this size class. */ + size_t highruns; + + /* Current number of runs of this size class. */ + size_t curruns; +}; + +struct arena_stats_s { + /* Number of bytes currently mapped. */ + size_t mapped; + + /* + * Total number of purge sweeps, total number of madvise calls made, + * and total pages purged in order to keep dirty unused memory under + * control. + */ + uint64_t npurge; + uint64_t nmadvise; + uint64_t purged; + + /* Per-size-category statistics. */ + size_t allocated_large; + uint64_t nmalloc_large; + uint64_t ndalloc_large; + uint64_t nrequests_large; + + /* + * One element for each possible size class, including sizes that + * overlap with bin size classes. This is necessary because ipalloc() + * sometimes has to use such large objects in order to assure proper + * alignment. + */ + malloc_large_stats_t *lstats; +}; +#endif /* JEMALLOC_STATS */ + +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) +struct chunk_stats_s { +# ifdef JEMALLOC_STATS + /* Number of chunks that were allocated. */ + uint64_t nchunks; +# endif + + /* High-water mark for number of chunks allocated. */ + size_t highchunks; + + /* + * Current number of chunks allocated. This value isn't maintained for + * any other purpose, so keep track of it in order to be able to set + * highchunks. + */ + size_t curchunks; +}; +#endif /* JEMALLOC_STATS */ + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +extern bool opt_stats_print; + +char *umax2s(uintmax_t x, unsigned base, char *s); +#ifdef JEMALLOC_STATS +void malloc_cprintf(void (*write)(void *, const char *), void *cbopaque, + const char *format, ...) JEMALLOC_ATTR(format(printf, 3, 4)); +void malloc_printf(const char *format, ...) + JEMALLOC_ATTR(format(printf, 1, 2)); +#endif +void stats_print(void (*write)(void *, const char *), void *cbopaque, + const char *opts); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_STATS +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +#endif /* JEMALLOC_STATS */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/internal/tcache.h b/externals/jemalloc/jemalloc/internal/tcache.h new file mode 100644 index 0000000..c76597f --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/tcache.h @@ -0,0 +1,380 @@ +#ifdef JEMALLOC_TCACHE +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +typedef struct tcache_bin_s tcache_bin_t; +typedef struct tcache_s tcache_t; + +/* + * Absolute maximum number of cache slots for each small bin in the thread + * cache. This is an additional constraint beyond that imposed as: twice the + * number of regions per run for this size class. + * + * This constant must be an even number. + */ +#define TCACHE_NSLOTS_SMALL_MAX 200 + +/* Number of cache slots for large size classes. */ +#define TCACHE_NSLOTS_LARGE 20 + +/* (1U << opt_lg_tcache_maxclass) is used to compute tcache_maxclass. */ +#define LG_TCACHE_MAXCLASS_DEFAULT 15 + +/* + * (1U << opt_lg_tcache_gc_sweep) is the approximate number of allocation + * events between full GC sweeps (-1: disabled). Integer rounding may cause + * the actual number to be slightly higher, since GC is performed + * incrementally. + */ +#define LG_TCACHE_GC_SWEEP_DEFAULT 13 + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +struct tcache_bin_s { +# ifdef JEMALLOC_STATS + tcache_bin_stats_t tstats; +# endif + unsigned low_water; /* Min # cached since last GC. */ + unsigned high_water; /* Max # cached since last GC. */ + unsigned ncached; /* # of cached objects. */ + unsigned ncached_max; /* Upper limit on ncached. */ + void *avail; /* Chain of available objects. */ +}; + +struct tcache_s { +# ifdef JEMALLOC_STATS + ql_elm(tcache_t) link; /* Used for aggregating stats. */ +# endif +# ifdef JEMALLOC_PROF + uint64_t prof_accumbytes;/* Cleared after arena_prof_accum() */ +# endif + arena_t *arena; /* This thread's arena. */ + unsigned ev_cnt; /* Event count since incremental GC. */ + unsigned next_gc_bin; /* Next bin to GC. */ + tcache_bin_t tbins[1]; /* Dynamically sized. */ +}; + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +extern bool opt_tcache; +extern ssize_t opt_lg_tcache_maxclass; +extern ssize_t opt_lg_tcache_gc_sweep; + +/* Map of thread-specific caches. */ +extern __thread tcache_t *tcache_tls + JEMALLOC_ATTR(tls_model("initial-exec")); + +/* + * Number of tcache bins. There are nbins small-object bins, plus 0 or more + * large-object bins. + */ +extern size_t nhbins; + +/* Maximum cached size class. */ +extern size_t tcache_maxclass; + +/* Number of tcache allocation/deallocation events between incremental GCs. */ +extern unsigned tcache_gc_incr; + +void tcache_bin_flush_small(tcache_bin_t *tbin, size_t binind, unsigned rem +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache_t *tcache +#endif + ); +void tcache_bin_flush_large(tcache_bin_t *tbin, size_t binind, unsigned rem +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache_t *tcache +#endif + ); +tcache_t *tcache_create(arena_t *arena); +void *tcache_alloc_small_hard(tcache_t *tcache, tcache_bin_t *tbin, + size_t binind); +void tcache_destroy(tcache_t *tcache); +#ifdef JEMALLOC_STATS +void tcache_stats_merge(tcache_t *tcache, arena_t *arena); +#endif +void tcache_boot(void); + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#ifndef JEMALLOC_ENABLE_INLINE +void tcache_event(tcache_t *tcache); +tcache_t *tcache_get(void); +void *tcache_alloc_easy(tcache_bin_t *tbin); +void *tcache_alloc_small(tcache_t *tcache, size_t size, bool zero); +void *tcache_alloc_large(tcache_t *tcache, size_t size, bool zero); +void tcache_dalloc_small(tcache_t *tcache, void *ptr); +void tcache_dalloc_large(tcache_t *tcache, void *ptr, size_t size); +#endif + +#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_TCACHE_C_)) +JEMALLOC_INLINE tcache_t * +tcache_get(void) +{ + tcache_t *tcache; + + if ((isthreaded & opt_tcache) == false) + return (NULL); + + tcache = tcache_tls; + if ((uintptr_t)tcache <= (uintptr_t)1) { + if (tcache == NULL) { + tcache = tcache_create(choose_arena()); + if (tcache == NULL) + return (NULL); + } else + return (NULL); + } + + return (tcache); +} + +JEMALLOC_INLINE void +tcache_event(tcache_t *tcache) +{ + + if (tcache_gc_incr == 0) + return; + + tcache->ev_cnt++; + assert(tcache->ev_cnt <= tcache_gc_incr); + if (tcache->ev_cnt == tcache_gc_incr) { + size_t binind = tcache->next_gc_bin; + tcache_bin_t *tbin = &tcache->tbins[binind]; + + if (tbin->low_water > 0) { + /* + * Flush (ceiling) 3/4 of the objects below the low + * water mark. + */ + if (binind < nbins) { + tcache_bin_flush_small(tbin, binind, + tbin->ncached - tbin->low_water + + (tbin->low_water >> 2) +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache +#endif + ); + } else { + tcache_bin_flush_large(tbin, binind, + tbin->ncached - tbin->low_water + + (tbin->low_water >> 2) +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache +#endif + ); + } + } + tbin->low_water = tbin->ncached; + tbin->high_water = tbin->ncached; + + tcache->next_gc_bin++; + if (tcache->next_gc_bin == nhbins) + tcache->next_gc_bin = 0; + tcache->ev_cnt = 0; + } +} + +JEMALLOC_INLINE void * +tcache_alloc_easy(tcache_bin_t *tbin) +{ + void *ret; + + if (tbin->ncached == 0) + return (NULL); + tbin->ncached--; + if (tbin->ncached < tbin->low_water) + tbin->low_water = tbin->ncached; + ret = tbin->avail; + tbin->avail = *(void **)ret; + return (ret); +} + +JEMALLOC_INLINE void * +tcache_alloc_small(tcache_t *tcache, size_t size, bool zero) +{ + void *ret; + size_t binind; + tcache_bin_t *tbin; + + binind = small_size2bin[size]; + assert(binind < nbins); + tbin = &tcache->tbins[binind]; + ret = tcache_alloc_easy(tbin); + if (ret == NULL) { + ret = tcache_alloc_small_hard(tcache, tbin, binind); + if (ret == NULL) + return (NULL); + } + assert(arena_salloc(ret) == tcache->arena->bins[binind].reg_size); + + if (zero == false) { +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + } else + memset(ret, 0, size); + +#ifdef JEMALLOC_STATS + tbin->tstats.nrequests++; +#endif +#ifdef JEMALLOC_PROF + tcache->prof_accumbytes += tcache->arena->bins[binind].reg_size; +#endif + tcache_event(tcache); + return (ret); +} + +JEMALLOC_INLINE void * +tcache_alloc_large(tcache_t *tcache, size_t size, bool zero) +{ + void *ret; + size_t binind; + tcache_bin_t *tbin; + + size = PAGE_CEILING(size); + assert(size <= tcache_maxclass); + binind = nbins + (size >> PAGE_SHIFT) - 1; + assert(binind < nhbins); + tbin = &tcache->tbins[binind]; + ret = tcache_alloc_easy(tbin); + if (ret == NULL) { + /* + * Only allocate one large object at a time, because it's quite + * expensive to create one and not use it. + */ + ret = arena_malloc_large(tcache->arena, size, zero); + if (ret == NULL) + return (NULL); + } else { +#ifdef JEMALLOC_PROF + arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ret); + size_t pageind = (unsigned)(((uintptr_t)ret - (uintptr_t)chunk) + >> PAGE_SHIFT); + chunk->map[pageind].bits |= CHUNK_MAP_CLASS_MASK; +#endif + if (zero == false) { +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + } else + memset(ret, 0, size); + +#ifdef JEMALLOC_STATS + tbin->tstats.nrequests++; +#endif +#ifdef JEMALLOC_PROF + tcache->prof_accumbytes += size; +#endif + } + + tcache_event(tcache); + return (ret); +} + +JEMALLOC_INLINE void +tcache_dalloc_small(tcache_t *tcache, void *ptr) +{ + arena_t *arena; + arena_chunk_t *chunk; + arena_run_t *run; + arena_bin_t *bin; + tcache_bin_t *tbin; + size_t pageind, binind; + arena_chunk_map_t *mapelm; + + assert(arena_salloc(ptr) <= small_maxclass); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + arena = chunk->arena; + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapelm = &chunk->map[pageind]; + run = (arena_run_t *)((uintptr_t)chunk + (uintptr_t)((pageind - + (mapelm->bits >> PAGE_SHIFT)) << PAGE_SHIFT)); + assert(run->magic == ARENA_RUN_MAGIC); + bin = run->bin; + binind = ((uintptr_t)bin - (uintptr_t)&arena->bins) / + sizeof(arena_bin_t); + assert(binind < nbins); + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ptr, 0x5a, bin->reg_size); +#endif + + tbin = &tcache->tbins[binind]; + if (tbin->ncached == tbin->ncached_max) { + tcache_bin_flush_small(tbin, binind, (tbin->ncached_max >> 1) +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache +#endif + ); + } + assert(tbin->ncached < tbin->ncached_max); + *(void **)ptr = tbin->avail; + tbin->avail = ptr; + tbin->ncached++; + if (tbin->ncached > tbin->high_water) + tbin->high_water = tbin->ncached; + + tcache_event(tcache); +} + +JEMALLOC_INLINE void +tcache_dalloc_large(tcache_t *tcache, void *ptr, size_t size) +{ + arena_t *arena; + arena_chunk_t *chunk; + size_t pageind, binind; + tcache_bin_t *tbin; + arena_chunk_map_t *mapelm; + + assert((size & PAGE_MASK) == 0); + assert(arena_salloc(ptr) > small_maxclass); + assert(arena_salloc(ptr) <= tcache_maxclass); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + arena = chunk->arena; + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapelm = &chunk->map[pageind]; + binind = nbins + (size >> PAGE_SHIFT) - 1; + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ptr, 0x5a, bin->reg_size); +#endif + + tbin = &tcache->tbins[binind]; + if (tbin->ncached == tbin->ncached_max) { + tcache_bin_flush_large(tbin, binind, (tbin->ncached_max >> 1) +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache +#endif + ); + } + assert(tbin->ncached < tbin->ncached_max); + *(void **)ptr = tbin->avail; + tbin->avail = ptr; + tbin->ncached++; + if (tbin->ncached > tbin->high_water) + tbin->high_water = tbin->ncached; + + tcache_event(tcache); +} +#endif + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ +#endif /* JEMALLOC_TCACHE */ diff --git a/externals/jemalloc/jemalloc/internal/totally_not_p_r_n.h b/externals/jemalloc/jemalloc/internal/totally_not_p_r_n.h new file mode 100644 index 0000000..0709d70 --- /dev/null +++ b/externals/jemalloc/jemalloc/internal/totally_not_p_r_n.h @@ -0,0 +1,60 @@ +/******************************************************************************/ +#ifdef JEMALLOC_H_TYPES + +/* + * Simple linear congruential pseudo-random number generator: + * + * prn(y) = (a*x + c) % m + * + * where the following constants ensure maximal period: + * + * a == Odd number (relatively prime to 2^n), and (a-1) is a multiple of 4. + * c == Odd number (relatively prime to 2^n). + * m == 2^32 + * + * See Knuth's TAOCP 3rd Ed., Vol. 2, pg. 17 for details on these constraints. + * + * This choice of m has the disadvantage that the quality of the bits is + * proportional to bit position. For example. the lowest bit has a cycle of 2, + * the next has a cycle of 4, etc. For this reason, we prefer to use the upper + * bits. + * + * Macro parameters: + * uint32_t r : Result. + * unsigned lg_range : (0..32], number of least significant bits to return. + * uint32_t state : Seed value. + * const uint32_t a, c : See above discussion. + */ +#define prn32(r, lg_range, state, a, c) do { \ + assert(lg_range > 0); \ + assert(lg_range <= 32); \ + \ + r = (state * (a)) + (c); \ + state = r; \ + r >>= (32 - lg_range); \ +} while (false) + +/* Same as prn32(), but 64 bits of pseudo-randomness, using uint64_t. */ +#define prn64(r, lg_range, state, a, c) do { \ + assert(lg_range > 0); \ + assert(lg_range <= 64); \ + \ + r = (state * (a)) + (c); \ + state = r; \ + r >>= (64 - lg_range); \ +} while (false) + +#endif /* JEMALLOC_H_TYPES */ +/******************************************************************************/ +#ifdef JEMALLOC_H_STRUCTS + +#endif /* JEMALLOC_H_STRUCTS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_EXTERNS + +#endif /* JEMALLOC_H_EXTERNS */ +/******************************************************************************/ +#ifdef JEMALLOC_H_INLINES + +#endif /* JEMALLOC_H_INLINES */ +/******************************************************************************/ diff --git a/externals/jemalloc/jemalloc/jemalloc.h b/externals/jemalloc/jemalloc/jemalloc.h new file mode 100644 index 0000000..d9bafbf --- /dev/null +++ b/externals/jemalloc/jemalloc/jemalloc.h @@ -0,0 +1,42 @@ +#ifndef JEMALLOC_H_ +#define JEMALLOC_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#define JEMALLOC_VERSION "1.0.0-0-g5523399" +#define JEMALLOC_VERSION_MAJOR 1 +#define JEMALLOC_VERSION_MINOR 0 +#define JEMALLOC_VERSION_BUGFIX 0 +#define JEMALLOC_VERSION_NREV 0 +#define JEMALLOC_VERSION_GID "5523399" + +#include "jemalloc_defs.h" +#ifndef JEMALLOC_P +# define JEMALLOC_P(s) s +#endif + +extern const char *JEMALLOC_P(malloc_options); +extern void (*JEMALLOC_P(malloc_message))(void *, const char *); + +void *JEMALLOC_P(malloc)(size_t size) JEMALLOC_ATTR(malloc); +void *JEMALLOC_P(calloc)(size_t num, size_t size) JEMALLOC_ATTR(malloc); +int JEMALLOC_P(posix_memalign)(void **memptr, size_t alignment, size_t size) + JEMALLOC_ATTR(nonnull(1)); +void *JEMALLOC_P(realloc)(void *ptr, size_t size); +void JEMALLOC_P(free)(void *ptr); + +size_t JEMALLOC_P(malloc_usable_size)(const void *ptr); +void JEMALLOC_P(malloc_stats_print)(void (*write_cb)(void *, const char *), + void *cbopaque, const char *opts); +int JEMALLOC_P(mallctl)(const char *name, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); +int JEMALLOC_P(mallctlnametomib)(const char *name, size_t *mibp, + size_t *miblenp); +int JEMALLOC_P(mallctlbymib)(const size_t *mib, size_t miblen, void *oldp, + size_t *oldlenp, void *newp, size_t newlen); + +#ifdef __cplusplus +}; +#endif +#endif /* JEMALLOC_H_ */ diff --git a/externals/jemalloc/jemalloc/jemalloc.h.in b/externals/jemalloc/jemalloc/jemalloc.h.in new file mode 100644 index 0000000..8ef8183 --- /dev/null +++ b/externals/jemalloc/jemalloc/jemalloc.h.in @@ -0,0 +1,42 @@ +#ifndef JEMALLOC_H_ +#define JEMALLOC_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#define JEMALLOC_VERSION "@jemalloc_version@" +#define JEMALLOC_VERSION_MAJOR @jemalloc_version_major@ +#define JEMALLOC_VERSION_MINOR @jemalloc_version_minor@ +#define JEMALLOC_VERSION_BUGFIX @jemalloc_version_bugfix@ +#define JEMALLOC_VERSION_NREV @jemalloc_version_nrev@ +#define JEMALLOC_VERSION_GID "@jemalloc_version_gid@" + +#include "jemalloc_defs@install_suffix@.h" +#ifndef JEMALLOC_P +# define JEMALLOC_P(s) s +#endif + +extern const char *JEMALLOC_P(malloc_options); +extern void (*JEMALLOC_P(malloc_message))(void *, const char *); + +void *JEMALLOC_P(malloc)(size_t size) JEMALLOC_ATTR(malloc); +void *JEMALLOC_P(calloc)(size_t num, size_t size) JEMALLOC_ATTR(malloc); +int JEMALLOC_P(posix_memalign)(void **memptr, size_t alignment, size_t size) + JEMALLOC_ATTR(nonnull(1)); +void *JEMALLOC_P(realloc)(void *ptr, size_t size); +void JEMALLOC_P(free)(void *ptr); + +size_t JEMALLOC_P(malloc_usable_size)(const void *ptr); +void JEMALLOC_P(malloc_stats_print)(void (*write_cb)(void *, const char *), + void *cbopaque, const char *opts); +int JEMALLOC_P(mallctl)(const char *name, void *oldp, size_t *oldlenp, + void *newp, size_t newlen); +int JEMALLOC_P(mallctlnametomib)(const char *name, size_t *mibp, + size_t *miblenp); +int JEMALLOC_P(mallctlbymib)(const size_t *mib, size_t miblen, void *oldp, + size_t *oldlenp, void *newp, size_t newlen); + +#ifdef __cplusplus +}; +#endif +#endif /* JEMALLOC_H_ */ diff --git a/externals/jemalloc/jemalloc/jemalloc_defs.h b/externals/jemalloc/jemalloc/jemalloc_defs.h new file mode 100644 index 0000000..e8acaed --- /dev/null +++ b/externals/jemalloc/jemalloc/jemalloc_defs.h @@ -0,0 +1,102 @@ +/* include/jemalloc/jemalloc_defs.h. Generated from jemalloc_defs.h.in by configure. */ +#ifndef JEMALLOC_DEFS_H_ +#define JEMALLOC_DEFS_H_ + +/* + * If JEMALLOC_PREFIX is defined, it will cause all public APIs to be prefixed. + * This makes it possible, with some care, to use multiple allocators + * simultaneously. + * + * In many cases it is more convenient to manually prefix allocator function + * calls than to let macros do it automatically, particularly when using + * multiple allocators simultaneously. Define JEMALLOC_MANGLE before + * #include'ing jemalloc.h in order to cause name mangling that corresponds to + * the API prefixing. + */ +/* #undef JEMALLOC_PREFIX */ +#if (defined(JEMALLOC_PREFIX) && defined(JEMALLOC_MANGLE)) +/* #undef JEMALLOC_P */ +#endif + +/* + * Hyper-threaded CPUs may need a special instruction inside spin loops in + * order to yield to another virtual CPU. + */ +#define CPU_SPINWAIT __asm__ volatile("pause") + +/* Defined if __attribute__((...)) syntax is supported. */ +#define JEMALLOC_HAVE_ATTR +#ifdef JEMALLOC_HAVE_ATTR +# define JEMALLOC_ATTR(s) __attribute__((s)) +#else +# define JEMALLOC_ATTR(s) +#endif + +/* + * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables + * inline functions. + */ +/* #undef JEMALLOC_DEBUG */ + +/* JEMALLOC_STATS enables statistics calculation. */ +/* #undef JEMALLOC_STATS */ + +/* JEMALLOC_PROF enables allocation profiling. */ +/* #undef JEMALLOC_PROF */ + +/* Use libunwind for profile backtracing if defined. */ +/* #undef JEMALLOC_PROF_LIBUNWIND */ + +/* Use libgcc for profile backtracing if defined. */ +/* #undef JEMALLOC_PROF_LIBGCC */ + +/* + * JEMALLOC_TINY enables support for tiny objects, which are smaller than one + * quantum. + */ +#define JEMALLOC_TINY + +/* + * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects. + * This makes it possible to allocate/deallocate objects without any locking + * when the cache is in the steady state. + */ +#define JEMALLOC_TCACHE + +/* + * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage + * segment (DSS). + */ +/* #undef JEMALLOC_DSS */ + +/* JEMALLOC_SWAP enables mmap()ed swap file support. */ +/* #undef JEMALLOC_SWAP */ + +/* Support memory filling (junk/zero). */ +/* #undef JEMALLOC_FILL */ + +/* Support optional abort() on OOM. */ +/* #undef JEMALLOC_XMALLOC */ + +/* Support SYSV semantics. */ +/* #undef JEMALLOC_SYSV */ + +/* Support lazy locking (avoid locking unless a second thread is launched). */ +#define JEMALLOC_LAZY_LOCK + +/* Determine page size at run time if defined. */ +/* #undef DYNAMIC_PAGE_SHIFT */ + +/* One page is 2^STATIC_PAGE_SHIFT bytes. */ +#define STATIC_PAGE_SHIFT 12 + +/* TLS is used to map arenas and magazine caches to threads. */ +/* #undef NO_TLS */ + +/* sizeof(void *) == 2^LG_SIZEOF_PTR. */ +#define LG_SIZEOF_PTR 3 + +/* sizeof(int) == 2^LG_SIZEOF_INT. */ +#define LG_SIZEOF_INT 2 + +#endif /* JEMALLOC_DEFS_H_ */ diff --git a/externals/jemalloc/jemalloc/jemalloc_defs.h.in b/externals/jemalloc/jemalloc/jemalloc_defs.h.in new file mode 100644 index 0000000..8b98d67 --- /dev/null +++ b/externals/jemalloc/jemalloc/jemalloc_defs.h.in @@ -0,0 +1,101 @@ +#ifndef JEMALLOC_DEFS_H_ +#define JEMALLOC_DEFS_H_ + +/* + * If JEMALLOC_PREFIX is defined, it will cause all public APIs to be prefixed. + * This makes it possible, with some care, to use multiple allocators + * simultaneously. + * + * In many cases it is more convenient to manually prefix allocator function + * calls than to let macros do it automatically, particularly when using + * multiple allocators simultaneously. Define JEMALLOC_MANGLE before + * #include'ing jemalloc.h in order to cause name mangling that corresponds to + * the API prefixing. + */ +#undef JEMALLOC_PREFIX +#if (defined(JEMALLOC_PREFIX) && defined(JEMALLOC_MANGLE)) +#undef JEMALLOC_P +#endif + +/* + * Hyper-threaded CPUs may need a special instruction inside spin loops in + * order to yield to another virtual CPU. + */ +#undef CPU_SPINWAIT + +/* Defined if __attribute__((...)) syntax is supported. */ +#undef JEMALLOC_HAVE_ATTR +#ifdef JEMALLOC_HAVE_ATTR +# define JEMALLOC_ATTR(s) __attribute__((s)) +#else +# define JEMALLOC_ATTR(s) +#endif + +/* + * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables + * inline functions. + */ +#undef JEMALLOC_DEBUG + +/* JEMALLOC_STATS enables statistics calculation. */ +#undef JEMALLOC_STATS + +/* JEMALLOC_PROF enables allocation profiling. */ +#undef JEMALLOC_PROF + +/* Use libunwind for profile backtracing if defined. */ +#undef JEMALLOC_PROF_LIBUNWIND + +/* Use libgcc for profile backtracing if defined. */ +#undef JEMALLOC_PROF_LIBGCC + +/* + * JEMALLOC_TINY enables support for tiny objects, which are smaller than one + * quantum. + */ +#undef JEMALLOC_TINY + +/* + * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects. + * This makes it possible to allocate/deallocate objects without any locking + * when the cache is in the steady state. + */ +#undef JEMALLOC_TCACHE + +/* + * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage + * segment (DSS). + */ +#undef JEMALLOC_DSS + +/* JEMALLOC_SWAP enables mmap()ed swap file support. */ +#undef JEMALLOC_SWAP + +/* Support memory filling (junk/zero). */ +#undef JEMALLOC_FILL + +/* Support optional abort() on OOM. */ +#undef JEMALLOC_XMALLOC + +/* Support SYSV semantics. */ +#undef JEMALLOC_SYSV + +/* Support lazy locking (avoid locking unless a second thread is launched). */ +#undef JEMALLOC_LAZY_LOCK + +/* Determine page size at run time if defined. */ +#undef DYNAMIC_PAGE_SHIFT + +/* One page is 2^STATIC_PAGE_SHIFT bytes. */ +#undef STATIC_PAGE_SHIFT + +/* TLS is used to map arenas and magazine caches to threads. */ +#undef NO_TLS + +/* sizeof(void *) == 2^LG_SIZEOF_PTR. */ +#undef LG_SIZEOF_PTR + +/* sizeof(int) == 2^LG_SIZEOF_INT. */ +#undef LG_SIZEOF_INT + +#endif /* JEMALLOC_DEFS_H_ */ diff --git a/externals/jemalloc/mb.c b/externals/jemalloc/mb.c new file mode 100644 index 0000000..30a1a2e --- /dev/null +++ b/externals/jemalloc/mb.c @@ -0,0 +1,2 @@ +#define MB_C_ +#include "jemalloc/internal/jemalloc_internal.h" diff --git a/externals/jemalloc/mutex.c b/externals/jemalloc/mutex.c new file mode 100644 index 0000000..3b6081a --- /dev/null +++ b/externals/jemalloc/mutex.c @@ -0,0 +1,70 @@ +#define JEMALLOC_MUTEX_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +/******************************************************************************/ +/* Data. */ + +#ifdef JEMALLOC_LAZY_LOCK +bool isthreaded = false; +#endif + +#ifdef JEMALLOC_LAZY_LOCK +static void pthread_create_once(void); +#endif + +/******************************************************************************/ +/* + * We intercept pthread_create() calls in order to toggle isthreaded if the + * process goes multi-threaded. + */ + +#ifdef JEMALLOC_LAZY_LOCK +static int (*pthread_create_fptr)(pthread_t *__restrict, const pthread_attr_t *, + void *(*)(void *), void *__restrict); + +static void +pthread_create_once(void) +{ + + pthread_create_fptr = dlsym(RTLD_NEXT, "pthread_create"); + if (pthread_create_fptr == NULL) { + malloc_write(": Error in dlsym(RTLD_NEXT, " + "\"pthread_create\")\n"); + abort(); + } + + isthreaded = true; +} + +JEMALLOC_ATTR(visibility("default")) +int +pthread_create(pthread_t *__restrict thread, + const pthread_attr_t *__restrict attr, void *(*start_routine)(void *), + void *__restrict arg) +{ + static pthread_once_t once_control = PTHREAD_ONCE_INIT; + + pthread_once(&once_control, pthread_create_once); + + return (pthread_create_fptr(thread, attr, start_routine, arg)); +} +#endif + +/******************************************************************************/ + +bool +malloc_mutex_init(malloc_mutex_t *mutex) +{ + pthread_mutexattr_t attr; + + if (pthread_mutexattr_init(&attr) != 0) + return (true); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); + if (pthread_mutex_init(mutex, &attr) != 0) { + pthread_mutexattr_destroy(&attr); + return (true); + } + pthread_mutexattr_destroy(&attr); + + return (false); +} diff --git a/externals/jemalloc/prof.c b/externals/jemalloc/prof.c new file mode 100644 index 0000000..6326188 --- /dev/null +++ b/externals/jemalloc/prof.c @@ -0,0 +1,1328 @@ +#define JEMALLOC_PROF_C_ +#include "jemalloc/internal/jemalloc_internal.h" +#ifdef JEMALLOC_PROF +/******************************************************************************/ + +#ifdef JEMALLOC_PROF_LIBGCC +#include +#endif + +#ifdef JEMALLOC_PROF_LIBUNWIND +#define UNW_LOCAL_ONLY +#include +#endif + +#include + +/******************************************************************************/ +/* Data. */ + +bool opt_prof = false; +bool opt_prof_active = true; +size_t opt_lg_prof_bt_max = LG_PROF_BT_MAX_DEFAULT; +size_t opt_lg_prof_sample = LG_PROF_SAMPLE_DEFAULT; +ssize_t opt_lg_prof_interval = LG_PROF_INTERVAL_DEFAULT; +bool opt_prof_udump = false; +bool opt_prof_leak = false; + +uint64_t prof_interval; +bool prof_promote; + +/* + * Global hash of (prof_bt_t *)-->(prof_ctx_t *). This is the master data + * structure that knows about all backtraces ever captured. + */ +static ckh_t bt2ctx; +static malloc_mutex_t bt2ctx_mtx; + +/* + * Thread-specific hash of (prof_bt_t *)-->(prof_thr_cnt_t *). Each thread + * keeps a cache of backtraces, with associated thread-specific prof_thr_cnt_t + * objects. Other threads may read the prof_thr_cnt_t contents, but no others + * will ever write them. + * + * Upon thread exit, the thread must merge all the prof_thr_cnt_t counter data + * into the associated prof_ctx_t objects, and unlink/free the prof_thr_cnt_t + * objects. + */ +static __thread ckh_t *bt2cnt_tls JEMALLOC_ATTR(tls_model("initial-exec")); + +/* + * Same contents as b2cnt, but initialized such that the TSD destructor is + * called when a thread exits, so that bt2cnt_tls contents can be merged, + * unlinked, and deallocated. + */ +static pthread_key_t bt2cnt_tsd; + +/* (1U << opt_lg_prof_bt_max). */ +static unsigned prof_bt_max; + +static __thread uint64_t prof_sample_prn_state + JEMALLOC_ATTR(tls_model("initial-exec")); +static __thread uint64_t prof_sample_threshold + JEMALLOC_ATTR(tls_model("initial-exec")); +static __thread uint64_t prof_sample_accum + JEMALLOC_ATTR(tls_model("initial-exec")); + +static malloc_mutex_t prof_dump_seq_mtx; +static uint64_t prof_dump_seq; +static uint64_t prof_dump_iseq; +static uint64_t prof_dump_mseq; +static uint64_t prof_dump_useq; + +/* + * This buffer is rather large for stack allocation, so use a single buffer for + * all profile dumps. The buffer is implicitly protected by bt2ctx_mtx, since + * it must be locked anyway during dumping. + */ +static char prof_dump_buf[PROF_DUMP_BUF_SIZE]; +static unsigned prof_dump_buf_end; +static int prof_dump_fd; + +/* Do not dump any profiles until bootstrapping is complete. */ +static bool prof_booted = false; + +static malloc_mutex_t enq_mtx; +static bool enq; +static bool enq_idump; +static bool enq_udump; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static prof_bt_t *bt_dup(prof_bt_t *bt); +static void bt_init(prof_bt_t *bt, void **vec); +#ifdef JEMALLOC_PROF_LIBGCC +static _Unwind_Reason_Code prof_unwind_init_callback( + struct _Unwind_Context *context, void *arg); +static _Unwind_Reason_Code prof_unwind_callback( + struct _Unwind_Context *context, void *arg); +#endif +static void prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max); +static prof_thr_cnt_t *prof_lookup(prof_bt_t *bt); +static void prof_cnt_set(const void *ptr, prof_thr_cnt_t *cnt); +static bool prof_flush(bool propagate_err); +static bool prof_write(const char *s, bool propagate_err); +static void prof_ctx_merge(prof_ctx_t *ctx, prof_cnt_t *cnt_all, + size_t *leak_nctx); +static bool prof_dump_ctx(prof_ctx_t *ctx, prof_bt_t *bt, + bool propagate_err); +static bool prof_dump_maps(bool propagate_err); +static bool prof_dump(const char *filename, bool leakcheck, + bool propagate_err); +static void prof_dump_filename(char *filename, char v, int64_t vseq); +static void prof_fdump(void); +static void prof_bt_hash(const void *key, unsigned minbits, size_t *hash1, + size_t *hash2); +static bool prof_bt_keycomp(const void *k1, const void *k2); +static void bt2cnt_thread_cleanup(void *arg); + +/******************************************************************************/ + +static void +bt_init(prof_bt_t *bt, void **vec) +{ + + bt->vec = vec; + bt->len = 0; +} + +static prof_bt_t * +bt_dup(prof_bt_t *bt) +{ + prof_bt_t *ret; + + /* + * Create a single allocation that has space for vec immediately + * following the prof_bt_t structure. The backtraces that get + * stored in the backtrace caches are copied from stack-allocated + * temporary variables, so size is known at creation time. Making this + * a contiguous object improves cache locality. + */ + ret = (prof_bt_t *)imalloc(QUANTUM_CEILING(sizeof(prof_bt_t)) + + (bt->len * sizeof(void *))); + if (ret == NULL) + return (NULL); + ret->vec = (void **)((uintptr_t)ret + + QUANTUM_CEILING(sizeof(prof_bt_t))); + memcpy(ret->vec, bt->vec, bt->len * sizeof(void *)); + ret->len = bt->len; + + return (ret); +} + +static inline void +prof_enter(void) +{ + + malloc_mutex_lock(&enq_mtx); + enq = true; + malloc_mutex_unlock(&enq_mtx); + + malloc_mutex_lock(&bt2ctx_mtx); +} + +static inline void +prof_leave(void) +{ + bool idump, udump; + + malloc_mutex_unlock(&bt2ctx_mtx); + + malloc_mutex_lock(&enq_mtx); + enq = false; + idump = enq_idump; + enq_idump = false; + udump = enq_udump; + enq_udump = false; + malloc_mutex_unlock(&enq_mtx); + + if (idump) + prof_idump(); + if (udump) + prof_udump(); +} + +#ifdef JEMALLOC_PROF_LIBGCC +static _Unwind_Reason_Code +prof_unwind_init_callback(struct _Unwind_Context *context, void *arg) +{ + + return (_URC_NO_REASON); +} + +static _Unwind_Reason_Code +prof_unwind_callback(struct _Unwind_Context *context, void *arg) +{ + prof_unwind_data_t *data = (prof_unwind_data_t *)arg; + + if (data->nignore > 0) + data->nignore--; + else { + data->bt->vec[data->bt->len] = (void *)_Unwind_GetIP(context); + data->bt->len++; + if (data->bt->len == data->max) + return (_URC_END_OF_STACK); + } + + return (_URC_NO_REASON); +} + +static void +prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) +{ + prof_unwind_data_t data = {bt, nignore, max}; + + _Unwind_Backtrace(prof_unwind_callback, &data); +} +#elif defined(JEMALLOC_PROF_LIBUNWIND) +static void +prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) +{ + unw_context_t uc; + unw_cursor_t cursor; + unsigned i; + int err; + + assert(bt->len == 0); + assert(bt->vec != NULL); + assert(max <= (1U << opt_lg_prof_bt_max)); + + unw_getcontext(&uc); + unw_init_local(&cursor, &uc); + + /* Throw away (nignore+1) stack frames, if that many exist. */ + for (i = 0; i < nignore + 1; i++) { + err = unw_step(&cursor); + if (err <= 0) + return; + } + + /* + * Iterate over stack frames until there are no more. Heap-allocate + * and iteratively grow a larger bt if necessary. + */ + for (i = 0; i < max; i++) { + unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *)&bt->vec[i]); + err = unw_step(&cursor); + if (err <= 0) { + bt->len = i; + break; + } + } +} +#else +static void +prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max) +{ +#define NIGNORE 3 +#define BT_FRAME(i) \ + if ((i) < NIGNORE + max) { \ + void *p; \ + if (__builtin_frame_address(i) == 0) \ + return; \ + p = __builtin_return_address(i); \ + if (p == NULL) \ + return; \ + if (i >= NIGNORE) { \ + bt->vec[(i) - NIGNORE] = p; \ + bt->len = (i) - NIGNORE + 1; \ + } \ + } else \ + return; + + assert(max <= (1U << opt_lg_prof_bt_max)); + + /* + * Ignore the first three frames, since they are: + * + * 0: prof_backtrace() + * 1: prof_alloc_prep() + * 2: malloc(), calloc(), etc. + */ +#if 1 + assert(nignore + 1 == NIGNORE); +#else + BT_FRAME(0) + BT_FRAME(1) + BT_FRAME(2) +#endif + BT_FRAME(3) + BT_FRAME(4) + BT_FRAME(5) + BT_FRAME(6) + BT_FRAME(7) + BT_FRAME(8) + BT_FRAME(9) + + BT_FRAME(10) + BT_FRAME(11) + BT_FRAME(12) + BT_FRAME(13) + BT_FRAME(14) + BT_FRAME(15) + BT_FRAME(16) + BT_FRAME(17) + BT_FRAME(18) + BT_FRAME(19) + + BT_FRAME(20) + BT_FRAME(21) + BT_FRAME(22) + BT_FRAME(23) + BT_FRAME(24) + BT_FRAME(25) + BT_FRAME(26) + BT_FRAME(27) + BT_FRAME(28) + BT_FRAME(29) + + BT_FRAME(30) + BT_FRAME(31) + BT_FRAME(32) + BT_FRAME(33) + BT_FRAME(34) + BT_FRAME(35) + BT_FRAME(36) + BT_FRAME(37) + BT_FRAME(38) + BT_FRAME(39) + + BT_FRAME(40) + BT_FRAME(41) + BT_FRAME(42) + BT_FRAME(43) + BT_FRAME(44) + BT_FRAME(45) + BT_FRAME(46) + BT_FRAME(47) + BT_FRAME(48) + BT_FRAME(49) + + BT_FRAME(50) + BT_FRAME(51) + BT_FRAME(52) + BT_FRAME(53) + BT_FRAME(54) + BT_FRAME(55) + BT_FRAME(56) + BT_FRAME(57) + BT_FRAME(58) + BT_FRAME(59) + + BT_FRAME(60) + BT_FRAME(61) + BT_FRAME(62) + BT_FRAME(63) + BT_FRAME(64) + BT_FRAME(65) + BT_FRAME(66) + BT_FRAME(67) + BT_FRAME(68) + BT_FRAME(69) + + BT_FRAME(70) + BT_FRAME(71) + BT_FRAME(72) + BT_FRAME(73) + BT_FRAME(74) + BT_FRAME(75) + BT_FRAME(76) + BT_FRAME(77) + BT_FRAME(78) + BT_FRAME(79) + + BT_FRAME(80) + BT_FRAME(81) + BT_FRAME(82) + BT_FRAME(83) + BT_FRAME(84) + BT_FRAME(85) + BT_FRAME(86) + BT_FRAME(87) + BT_FRAME(88) + BT_FRAME(89) + + BT_FRAME(90) + BT_FRAME(91) + BT_FRAME(92) + BT_FRAME(93) + BT_FRAME(94) + BT_FRAME(95) + BT_FRAME(96) + BT_FRAME(97) + BT_FRAME(98) + BT_FRAME(99) + + BT_FRAME(100) + BT_FRAME(101) + BT_FRAME(102) + BT_FRAME(103) + BT_FRAME(104) + BT_FRAME(105) + BT_FRAME(106) + BT_FRAME(107) + BT_FRAME(108) + BT_FRAME(109) + + BT_FRAME(110) + BT_FRAME(111) + BT_FRAME(112) + BT_FRAME(113) + BT_FRAME(114) + BT_FRAME(115) + BT_FRAME(116) + BT_FRAME(117) + BT_FRAME(118) + BT_FRAME(119) + + BT_FRAME(120) + BT_FRAME(121) + BT_FRAME(122) + BT_FRAME(123) + BT_FRAME(124) + BT_FRAME(125) + BT_FRAME(126) + BT_FRAME(127) + + /* Extras to compensate for NIGNORE. */ + BT_FRAME(128) + BT_FRAME(129) + BT_FRAME(130) +#undef BT_FRAME +} +#endif + +static prof_thr_cnt_t * +prof_lookup(prof_bt_t *bt) +{ + prof_thr_cnt_t *ret; + ckh_t *bt2cnt = bt2cnt_tls; + + if (bt2cnt == NULL) { + /* Initialize an empty cache for this thread. */ + bt2cnt = (ckh_t *)imalloc(sizeof(ckh_t)); + if (bt2cnt == NULL) + return (NULL); + if (ckh_new(bt2cnt, PROF_CKH_MINITEMS, prof_bt_hash, + prof_bt_keycomp)) { + idalloc(bt2cnt); + return (NULL); + } + bt2cnt_tls = bt2cnt; + } + + if (ckh_search(bt2cnt, bt, NULL, (void **)&ret)) { + prof_bt_t *btkey; + prof_ctx_t *ctx; + + /* + * This thread's cache lacks bt. Look for it in the global + * cache. + */ + prof_enter(); + if (ckh_search(&bt2ctx, bt, (void **)&btkey, (void **)&ctx)) { + + /* bt has never been seen before. Insert it. */ + ctx = (prof_ctx_t *)imalloc(sizeof(prof_ctx_t)); + if (ctx == NULL) { + prof_leave(); + return (NULL); + } + btkey = bt_dup(bt); + if (btkey == NULL) { + prof_leave(); + idalloc(ctx); + return (NULL); + } + if (malloc_mutex_init(&ctx->lock)) { + prof_leave(); + idalloc(btkey); + idalloc(ctx); + return (NULL); + } + memset(&ctx->cnt_merged, 0, sizeof(prof_cnt_t)); + ql_new(&ctx->cnts_ql); + if (ckh_insert(&bt2ctx, btkey, ctx)) { + /* OOM. */ + prof_leave(); + idalloc(btkey); + idalloc(ctx); + return (NULL); + } + } + prof_leave(); + + /* Link a prof_thd_cnt_t into ctx for this thread. */ + ret = (prof_thr_cnt_t *)imalloc(sizeof(prof_thr_cnt_t)); + if (ret == NULL) + return (NULL); + ql_elm_new(ret, link); + ret->ctx = ctx; + ret->epoch = 0; + memset(&ret->cnts, 0, sizeof(prof_cnt_t)); + if (ckh_insert(bt2cnt, btkey, ret)) { + idalloc(ret); + return (NULL); + } + malloc_mutex_lock(&ctx->lock); + ql_tail_insert(&ctx->cnts_ql, ret, link); + malloc_mutex_unlock(&ctx->lock); + } + + return (ret); +} + +static inline void +prof_sample_threshold_update(void) +{ + uint64_t r; + double u; + + /* + * Compute prof_sample_threshold as a geometrically distributed random + * variable with mean (2^opt_lg_prof_sample). + */ + prn64(r, 53, prof_sample_prn_state, (uint64_t)1125899906842625LLU, + 1058392653243283975); + u = (double)r * (1.0/9007199254740992.0L); + prof_sample_threshold = (uint64_t)(log(u) / + log(1.0 - (1.0 / (double)((uint64_t)1U << opt_lg_prof_sample)))) + + (uint64_t)1U; +} + +prof_thr_cnt_t * +prof_alloc_prep(size_t size) +{ + prof_thr_cnt_t *ret; + void *vec[prof_bt_max]; + prof_bt_t bt; + + if (opt_prof_active == false) { + /* Sampling is currently inactive, so avoid sampling. */ + ret = (prof_thr_cnt_t *)(uintptr_t)1U; + } else if (opt_lg_prof_sample == 0) { + /* + * Don't bother with sampling logic, since sampling interval is + * 1. + */ + bt_init(&bt, vec); + prof_backtrace(&bt, 2, prof_bt_max); + ret = prof_lookup(&bt); + } else { + if (prof_sample_threshold == 0) { + /* + * Initialize. Seed the prng differently for each + * thread. + */ + prof_sample_prn_state = (uint64_t)(uintptr_t)&size; + prof_sample_threshold_update(); + } + + /* + * Determine whether to capture a backtrace based on whether + * size is enough for prof_accum to reach + * prof_sample_threshold. However, delay updating these + * variables until prof_{m,re}alloc(), because we don't know + * for sure that the allocation will succeed. + * + * Use subtraction rather than addition to avoid potential + * integer overflow. + */ + if (size >= prof_sample_threshold - prof_sample_accum) { + bt_init(&bt, vec); + prof_backtrace(&bt, 2, prof_bt_max); + ret = prof_lookup(&bt); + } else + ret = (prof_thr_cnt_t *)(uintptr_t)1U; + } + + return (ret); +} + +prof_thr_cnt_t * +prof_cnt_get(const void *ptr) +{ + prof_thr_cnt_t *ret; + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) { + /* Region. */ + assert(chunk->arena->magic == ARENA_MAGIC); + + ret = arena_prof_cnt_get(ptr); + } else + ret = huge_prof_cnt_get(ptr); + + return (ret); +} + +static void +prof_cnt_set(const void *ptr, prof_thr_cnt_t *cnt) +{ + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) { + /* Region. */ + assert(chunk->arena->magic == ARENA_MAGIC); + + arena_prof_cnt_set(ptr, cnt); + } else + huge_prof_cnt_set(ptr, cnt); +} + +static inline void +prof_sample_accum_update(size_t size) +{ + + if (opt_lg_prof_sample == 0) { + /* + * Don't bother with sampling logic, since sampling interval is + * 1. + */ + return; + } + + /* Take care to avoid integer overflow. */ + if (size >= prof_sample_threshold - prof_sample_accum) { + prof_sample_accum -= (prof_sample_threshold - size); + /* Compute new prof_sample_threshold. */ + prof_sample_threshold_update(); + while (prof_sample_accum >= prof_sample_threshold) { + prof_sample_accum -= prof_sample_threshold; + prof_sample_threshold_update(); + } + } else + prof_sample_accum += size; +} + +void +prof_malloc(const void *ptr, prof_thr_cnt_t *cnt) +{ + size_t size = isalloc(ptr); + + assert(ptr != NULL); + + prof_cnt_set(ptr, cnt); + prof_sample_accum_update(size); + + if ((uintptr_t)cnt > (uintptr_t)1U) { + cnt->epoch++; + /*********/ + mb_write(); + /*********/ + cnt->cnts.curobjs++; + cnt->cnts.curbytes += size; + cnt->cnts.accumobjs++; + cnt->cnts.accumbytes += size; + /*********/ + mb_write(); + /*********/ + cnt->epoch++; + /*********/ + mb_write(); + /*********/ + } +} + +void +prof_realloc(const void *ptr, prof_thr_cnt_t *cnt, const void *old_ptr, + size_t old_size, prof_thr_cnt_t *old_cnt) +{ + size_t size = isalloc(ptr); + + if (ptr != NULL) { + prof_cnt_set(ptr, cnt); + prof_sample_accum_update(size); + } + + if ((uintptr_t)old_cnt > (uintptr_t)1U) + old_cnt->epoch++; + if ((uintptr_t)cnt > (uintptr_t)1U) + cnt->epoch++; + /*********/ + mb_write(); + /*********/ + if ((uintptr_t)old_cnt > (uintptr_t)1U) { + old_cnt->cnts.curobjs--; + old_cnt->cnts.curbytes -= old_size; + } + if ((uintptr_t)cnt > (uintptr_t)1U) { + cnt->cnts.curobjs++; + cnt->cnts.curbytes += size; + cnt->cnts.accumobjs++; + cnt->cnts.accumbytes += size; + } + /*********/ + mb_write(); + /*********/ + if ((uintptr_t)old_cnt > (uintptr_t)1U) + old_cnt->epoch++; + if ((uintptr_t)cnt > (uintptr_t)1U) + cnt->epoch++; + /*********/ + mb_write(); /* Not strictly necessary. */ +} + +void +prof_free(const void *ptr) +{ + prof_thr_cnt_t *cnt = prof_cnt_get(ptr); + + if ((uintptr_t)cnt > (uintptr_t)1) { + size_t size = isalloc(ptr); + + cnt->epoch++; + /*********/ + mb_write(); + /*********/ + cnt->cnts.curobjs--; + cnt->cnts.curbytes -= size; + /*********/ + mb_write(); + /*********/ + cnt->epoch++; + /*********/ + mb_write(); + /*********/ + } +} + +static bool +prof_flush(bool propagate_err) +{ + bool ret = false; + ssize_t err; + + err = write(prof_dump_fd, prof_dump_buf, prof_dump_buf_end); + if (err == -1) { + if (propagate_err == false) { + malloc_write(": write() failed during heap " + "profile flush\n"); + if (opt_abort) + abort(); + } + ret = true; + } + prof_dump_buf_end = 0; + + return (ret); +} + +static bool +prof_write(const char *s, bool propagate_err) +{ + unsigned i, slen, n; + + i = 0; + slen = strlen(s); + while (i < slen) { + /* Flush the buffer if it is full. */ + if (prof_dump_buf_end == PROF_DUMP_BUF_SIZE) + if (prof_flush(propagate_err) && propagate_err) + return (true); + + if (prof_dump_buf_end + slen <= PROF_DUMP_BUF_SIZE) { + /* Finish writing. */ + n = slen - i; + } else { + /* Write as much of s as will fit. */ + n = PROF_DUMP_BUF_SIZE - prof_dump_buf_end; + } + memcpy(&prof_dump_buf[prof_dump_buf_end], &s[i], n); + prof_dump_buf_end += n; + i += n; + } + + return (false); +} + +static void +prof_ctx_merge(prof_ctx_t *ctx, prof_cnt_t *cnt_all, size_t *leak_nctx) +{ + prof_thr_cnt_t *thr_cnt; + prof_cnt_t tcnt; + + malloc_mutex_lock(&ctx->lock); + + memcpy(&ctx->cnt_dump, &ctx->cnt_merged, sizeof(prof_cnt_t)); + ql_foreach(thr_cnt, &ctx->cnts_ql, link) { + volatile unsigned *epoch = &thr_cnt->epoch; + + while (true) { + unsigned epoch0 = *epoch; + + /* Make sure epoch is even. */ + if (epoch0 & 1U) + continue; + + memcpy(&tcnt, &thr_cnt->cnts, sizeof(prof_cnt_t)); + + /* Terminate if epoch didn't change while reading. */ + if (*epoch == epoch0) + break; + } + + ctx->cnt_dump.curobjs += tcnt.curobjs; + ctx->cnt_dump.curbytes += tcnt.curbytes; + ctx->cnt_dump.accumobjs += tcnt.accumobjs; + ctx->cnt_dump.accumbytes += tcnt.accumbytes; + + if (tcnt.curobjs != 0) + (*leak_nctx)++; + } + + /* Merge into cnt_all. */ + cnt_all->curobjs += ctx->cnt_dump.curobjs; + cnt_all->curbytes += ctx->cnt_dump.curbytes; + cnt_all->accumobjs += ctx->cnt_dump.accumobjs; + cnt_all->accumbytes += ctx->cnt_dump.accumbytes; + + malloc_mutex_unlock(&ctx->lock); +} + +static bool +prof_dump_ctx(prof_ctx_t *ctx, prof_bt_t *bt, bool propagate_err) +{ + char buf[UMAX2S_BUFSIZE]; + unsigned i; + + if (prof_write(umax2s(ctx->cnt_dump.curobjs, 10, buf), propagate_err) + || prof_write(": ", propagate_err) + || prof_write(umax2s(ctx->cnt_dump.curbytes, 10, buf), + propagate_err) + || prof_write(" [", propagate_err) + || prof_write(umax2s(ctx->cnt_dump.accumobjs, 10, buf), + propagate_err) + || prof_write(": ", propagate_err) + || prof_write(umax2s(ctx->cnt_dump.accumbytes, 10, buf), + propagate_err) + || prof_write("] @", propagate_err)) + return (true); + + for (i = 0; i < bt->len; i++) { + if (prof_write(" 0x", propagate_err) + || prof_write(umax2s((uintptr_t)bt->vec[i], 16, buf), + propagate_err)) + return (true); + } + + if (prof_write("\n", propagate_err)) + return (true); + + return (false); +} + +static bool +prof_dump_maps(bool propagate_err) +{ + int mfd; + char buf[UMAX2S_BUFSIZE]; + char *s; + unsigned i, slen; + /* /proc//maps\0 */ + char mpath[6 + UMAX2S_BUFSIZE + + 5 + 1]; + + i = 0; + + s = "/proc/"; + slen = strlen(s); + memcpy(&mpath[i], s, slen); + i += slen; + + s = umax2s(getpid(), 10, buf); + slen = strlen(s); + memcpy(&mpath[i], s, slen); + i += slen; + + s = "/maps"; + slen = strlen(s); + memcpy(&mpath[i], s, slen); + i += slen; + + mpath[i] = '\0'; + + mfd = open(mpath, O_RDONLY); + if (mfd != -1) { + ssize_t nread; + + if (prof_write("\nMAPPED_LIBRARIES:\n", propagate_err) && + propagate_err) + return (true); + nread = 0; + do { + prof_dump_buf_end += nread; + if (prof_dump_buf_end == PROF_DUMP_BUF_SIZE) { + /* Make space in prof_dump_buf before read(). */ + if (prof_flush(propagate_err) && propagate_err) + return (true); + } + nread = read(mfd, &prof_dump_buf[prof_dump_buf_end], + PROF_DUMP_BUF_SIZE - prof_dump_buf_end); + } while (nread > 0); + close(mfd); + } else + return (true); + + return (false); +} + +static bool +prof_dump(const char *filename, bool leakcheck, bool propagate_err) +{ + prof_cnt_t cnt_all; + size_t tabind; + prof_bt_t *bt; + prof_ctx_t *ctx; + char buf[UMAX2S_BUFSIZE]; + size_t leak_nctx; + + prof_enter(); + prof_dump_fd = creat(filename, 0644); + if (prof_dump_fd == -1) { + if (propagate_err == false) { + malloc_write(": creat(\""); + malloc_write(filename); + malloc_write("\", 0644) failed\n"); + if (opt_abort) + abort(); + } + goto ERROR; + } + + /* Merge per thread profile stats, and sum them in cnt_all. */ + memset(&cnt_all, 0, sizeof(prof_cnt_t)); + leak_nctx = 0; + for (tabind = 0; ckh_iter(&bt2ctx, &tabind, NULL, (void **)&ctx) + == false;) { + prof_ctx_merge(ctx, &cnt_all, &leak_nctx); + } + + /* Dump profile header. */ + if (prof_write("heap profile: ", propagate_err) + || prof_write(umax2s(cnt_all.curobjs, 10, buf), propagate_err) + || prof_write(": ", propagate_err) + || prof_write(umax2s(cnt_all.curbytes, 10, buf), propagate_err) + || prof_write(" [", propagate_err) + || prof_write(umax2s(cnt_all.accumobjs, 10, buf), propagate_err) + || prof_write(": ", propagate_err) + || prof_write(umax2s(cnt_all.accumbytes, 10, buf), propagate_err)) + goto ERROR; + + if (opt_lg_prof_sample == 0) { + if (prof_write("] @ heapprofile\n", propagate_err)) + goto ERROR; + } else { + if (prof_write("] @ heap_v2/", propagate_err) + || prof_write(umax2s((uint64_t)1U << opt_lg_prof_sample, 10, + buf), propagate_err) + || prof_write("\n", propagate_err)) + goto ERROR; + } + + /* Dump per ctx profile stats. */ + for (tabind = 0; ckh_iter(&bt2ctx, &tabind, (void **)&bt, (void **)&ctx) + == false;) { + if (prof_dump_ctx(ctx, bt, propagate_err)) + goto ERROR; + } + + /* Dump /proc//maps if possible. */ + if (prof_dump_maps(propagate_err)) + goto ERROR; + + if (prof_flush(propagate_err)) + goto ERROR; + close(prof_dump_fd); + prof_leave(); + + if (leakcheck && cnt_all.curbytes != 0) { + malloc_write(": Leak summary: "); + malloc_write(umax2s(cnt_all.curbytes, 10, buf)); + malloc_write((cnt_all.curbytes != 1) ? " bytes, " : " byte, "); + malloc_write(umax2s(cnt_all.curobjs, 10, buf)); + malloc_write((cnt_all.curobjs != 1) ? " objects, " : + " object, "); + malloc_write(umax2s(leak_nctx, 10, buf)); + malloc_write((leak_nctx != 1) ? " contexts\n" : " context\n"); + malloc_write(": Run pprof on \""); + malloc_write(filename); + malloc_write("\" for leak detail\n"); + } + + return (false); +ERROR: + prof_leave(); + return (true); +} + +#define DUMP_FILENAME_BUFSIZE (PATH_MAX+ UMAX2S_BUFSIZE \ + + 1 \ + + UMAX2S_BUFSIZE \ + + 2 \ + + UMAX2S_BUFSIZE \ + + 5 + 1) +static void +prof_dump_filename(char *filename, char v, int64_t vseq) +{ + char buf[UMAX2S_BUFSIZE]; + char *s; + unsigned i, slen; + + /* + * Construct a filename of the form: + * + * ...v.heap\0 + * or + * jeprof...v.heap\0 + */ + + i = 0; + + /* + * Use JEMALLOC_PROF_PREFIX if it's set, and if it is short enough to + * avoid overflowing DUMP_FILENAME_BUFSIZE. The result may exceed + * PATH_MAX, but creat(2) will catch that problem. + */ + if ((s = getenv("JEMALLOC_PROF_PREFIX")) != NULL + && strlen(s) + (DUMP_FILENAME_BUFSIZE - PATH_MAX) <= PATH_MAX) { + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + + s = "."; + } else + s = "jeprof."; + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + + s = umax2s(getpid(), 10, buf); + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + + s = "."; + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + + s = umax2s(prof_dump_seq, 10, buf); + prof_dump_seq++; + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + + s = "."; + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + + filename[i] = v; + i++; + + if (vseq != 0xffffffffffffffffLLU) { + s = umax2s(vseq, 10, buf); + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + } + + s = ".heap"; + slen = strlen(s); + memcpy(&filename[i], s, slen); + i += slen; + + filename[i] = '\0'; +} + +static void +prof_fdump(void) +{ + char filename[DUMP_FILENAME_BUFSIZE]; + + if (prof_booted == false) + return; + + malloc_mutex_lock(&prof_dump_seq_mtx); + prof_dump_filename(filename, 'f', 0xffffffffffffffffLLU); + malloc_mutex_unlock(&prof_dump_seq_mtx); + prof_dump(filename, opt_prof_leak, false); +} + +void +prof_idump(void) +{ + char filename[DUMP_FILENAME_BUFSIZE]; + + if (prof_booted == false) + return; + malloc_mutex_lock(&enq_mtx); + if (enq) { + enq_idump = true; + malloc_mutex_unlock(&enq_mtx); + return; + } + malloc_mutex_unlock(&enq_mtx); + + malloc_mutex_lock(&prof_dump_seq_mtx); + prof_dump_filename(filename, 'i', prof_dump_iseq); + prof_dump_iseq++; + malloc_mutex_unlock(&prof_dump_seq_mtx); + prof_dump(filename, false, false); +} + +bool +prof_mdump(const char *filename) +{ + char filename_buf[DUMP_FILENAME_BUFSIZE]; + + if (opt_prof == false || prof_booted == false) + return (true); + + if (filename == NULL) { + /* No filename specified, so automatically generate one. */ + malloc_mutex_lock(&prof_dump_seq_mtx); + prof_dump_filename(filename_buf, 'm', prof_dump_mseq); + prof_dump_mseq++; + malloc_mutex_unlock(&prof_dump_seq_mtx); + filename = filename_buf; + } + return (prof_dump(filename, false, true)); +} + +void +prof_udump(void) +{ + char filename[DUMP_FILENAME_BUFSIZE]; + + if (prof_booted == false) + return; + malloc_mutex_lock(&enq_mtx); + if (enq) { + enq_udump = true; + malloc_mutex_unlock(&enq_mtx); + return; + } + malloc_mutex_unlock(&enq_mtx); + + malloc_mutex_lock(&prof_dump_seq_mtx); + prof_dump_filename(filename, 'u', prof_dump_useq); + prof_dump_useq++; + malloc_mutex_unlock(&prof_dump_seq_mtx); + prof_dump(filename, false, false); +} + +static void +prof_bt_hash(const void *key, unsigned minbits, size_t *hash1, size_t *hash2) +{ + size_t ret1, ret2; + uint64_t h; + prof_bt_t *bt = (prof_bt_t *)key; + + assert(minbits <= 32 || (SIZEOF_PTR == 8 && minbits <= 64)); + assert(hash1 != NULL); + assert(hash2 != NULL); + + h = hash(bt->vec, bt->len * sizeof(void *), 0x94122f335b332aeaLLU); + if (minbits <= 32) { + /* + * Avoid doing multiple hashes, since a single hash provides + * enough bits. + */ + ret1 = h & ZU(0xffffffffU); + ret2 = h >> 32; + } else { + ret1 = h; + ret2 = hash(bt->vec, bt->len * sizeof(void *), + 0x8432a476666bbc13U); + } + + *hash1 = ret1; + *hash2 = ret2; +} + +static bool +prof_bt_keycomp(const void *k1, const void *k2) +{ + const prof_bt_t *bt1 = (prof_bt_t *)k1; + const prof_bt_t *bt2 = (prof_bt_t *)k2; + + if (bt1->len != bt2->len) + return (false); + return (memcmp(bt1->vec, bt2->vec, bt1->len * sizeof(void *)) == 0); +} + +static void +bt2cnt_thread_cleanup(void *arg) +{ + ckh_t *bt2cnt; + + bt2cnt = bt2cnt_tls; + if (bt2cnt != NULL) { + ql_head(prof_thr_cnt_t) cnts_ql; + size_t tabind; + prof_thr_cnt_t *cnt; + + /* Iteratively merge cnt's into the global stats. */ + ql_new(&cnts_ql); + tabind = 0; + while (ckh_iter(bt2cnt, &tabind, NULL, (void **)&cnt) == + false) { + prof_ctx_t *ctx = cnt->ctx; + /* Merge stats and detach from ctx. */ + malloc_mutex_lock(&ctx->lock); + ctx->cnt_merged.curobjs += cnt->cnts.curobjs; + ctx->cnt_merged.curbytes += cnt->cnts.curbytes; + ctx->cnt_merged.accumobjs += cnt->cnts.accumobjs; + ctx->cnt_merged.accumbytes += cnt->cnts.accumbytes; + ql_remove(&ctx->cnts_ql, cnt, link); + malloc_mutex_unlock(&ctx->lock); + + /* + * Stash cnt for deletion after finishing with + * ckh_iter(). + */ + ql_tail_insert(&cnts_ql, cnt, link); + } + + /* + * Delete the hash table now that cnts_ql has a list of all + * cnt's. + */ + ckh_delete(bt2cnt); + idalloc(bt2cnt); + bt2cnt_tls = NULL; + + /* Delete cnt's. */ + while ((cnt = ql_last(&cnts_ql, link)) != NULL) { + ql_remove(&cnts_ql, cnt, link); + idalloc(cnt); + } + } +} + +void +prof_boot0(void) +{ + + /* + * opt_prof and prof_promote must be in their final state before any + * arenas are initialized, so this function must be executed early. + */ + + if (opt_prof_leak && opt_prof == false) { + /* + * Enable opt_prof, but in such a way that profiles are never + * automatically dumped. + */ + opt_prof = true; + opt_prof_udump = false; + prof_interval = 0; + } else if (opt_prof) { + if (opt_lg_prof_interval >= 0) { + prof_interval = (((uint64_t)1U) << + opt_lg_prof_interval); + } else + prof_interval = 0; + } + + prof_promote = (opt_prof && opt_lg_prof_sample > PAGE_SHIFT); +} + +bool +prof_boot1(void) +{ + + if (opt_prof) { + if (ckh_new(&bt2ctx, PROF_CKH_MINITEMS, prof_bt_hash, + prof_bt_keycomp)) + return (true); + if (malloc_mutex_init(&bt2ctx_mtx)) + return (true); + if (pthread_key_create(&bt2cnt_tsd, bt2cnt_thread_cleanup) + != 0) { + malloc_write( + ": Error in pthread_key_create()\n"); + abort(); + } + + prof_bt_max = (1U << opt_lg_prof_bt_max); + if (malloc_mutex_init(&prof_dump_seq_mtx)) + return (true); + + if (malloc_mutex_init(&enq_mtx)) + return (true); + enq = false; + enq_idump = false; + enq_udump = false; + + if (atexit(prof_fdump) != 0) { + malloc_write(": Error in atexit()\n"); + if (opt_abort) + abort(); + } + } + +#ifdef JEMALLOC_PROF_LIBGCC + /* + * Cause the backtracing machinery to allocate its internal state + * before enabling profiling. + */ + _Unwind_Backtrace(prof_unwind_init_callback, NULL); +#endif + + prof_booted = true; + + return (false); +} + +/******************************************************************************/ +#endif /* JEMALLOC_PROF */ diff --git a/externals/jemalloc/stats.c b/externals/jemalloc/stats.c new file mode 100644 index 0000000..9dc7529 --- /dev/null +++ b/externals/jemalloc/stats.c @@ -0,0 +1,717 @@ +#define JEMALLOC_STATS_C_ +#include "jemalloc/internal/jemalloc_internal.h" + +#define CTL_GET(n, v, t) do { \ + size_t sz = sizeof(t); \ + xmallctl(n, v, &sz, NULL, 0); \ +} while (0) + +#define CTL_I_GET(n, v, t) do { \ + size_t mib[6]; \ + size_t miblen = sizeof(mib) / sizeof(size_t); \ + size_t sz = sizeof(t); \ + xmallctlnametomib(n, mib, &miblen); \ + mib[2] = i; \ + xmallctlbymib(mib, miblen, v, &sz, NULL, 0); \ +} while (0) + +#define CTL_J_GET(n, v, t) do { \ + size_t mib[6]; \ + size_t miblen = sizeof(mib) / sizeof(size_t); \ + size_t sz = sizeof(t); \ + xmallctlnametomib(n, mib, &miblen); \ + mib[2] = j; \ + xmallctlbymib(mib, miblen, v, &sz, NULL, 0); \ +} while (0) + +#define CTL_IJ_GET(n, v, t) do { \ + size_t mib[6]; \ + size_t miblen = sizeof(mib) / sizeof(size_t); \ + size_t sz = sizeof(t); \ + xmallctlnametomib(n, mib, &miblen); \ + mib[2] = i; \ + mib[4] = j; \ + xmallctlbymib(mib, miblen, v, &sz, NULL, 0); \ +} while (0) + +/******************************************************************************/ +/* Data. */ + +bool opt_stats_print = false; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +#ifdef JEMALLOC_STATS +static void malloc_vcprintf(void (*write_cb)(void *, const char *), + void *cbopaque, const char *format, va_list ap); +static void stats_arena_bins_print(void (*write_cb)(void *, const char *), + void *cbopaque, unsigned i); +static void stats_arena_lruns_print(void (*write_cb)(void *, const char *), + void *cbopaque, unsigned i); +static void stats_arena_print(void (*write_cb)(void *, const char *), + void *cbopaque, unsigned i); +#endif + +/******************************************************************************/ + +/* + * We don't want to depend on vsnprintf() for production builds, since that can + * cause unnecessary bloat for static binaries. umax2s() provides minimal + * integer printing functionality, so that malloc_printf() use can be limited to + * JEMALLOC_STATS code. + */ +char * +umax2s(uintmax_t x, unsigned base, char *s) +{ + unsigned i; + + i = UMAX2S_BUFSIZE - 1; + s[i] = '\0'; + switch (base) { + case 10: + do { + i--; + s[i] = "0123456789"[x % 10]; + x /= 10; + } while (x > 0); + break; + case 16: + do { + i--; + s[i] = "0123456789abcdef"[x & 0xf]; + x >>= 4; + } while (x > 0); + break; + default: + do { + i--; + s[i] = "0123456789abcdefghijklmnopqrstuvwxyz"[x % base]; + x /= base; + } while (x > 0); + } + + return (&s[i]); +} + +#ifdef JEMALLOC_STATS +static void +malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque, + const char *format, va_list ap) +{ + char buf[4096]; + + if (write_cb == NULL) { + /* + * The caller did not provide an alternate write_cb callback + * function, so use the default one. malloc_write() is an + * inline function, so use malloc_message() directly here. + */ + write_cb = JEMALLOC_P(malloc_message); + cbopaque = NULL; + } + + vsnprintf(buf, sizeof(buf), format, ap); + write_cb(cbopaque, buf); +} + +/* + * Print to a callback function in such a way as to (hopefully) avoid memory + * allocation. + */ +JEMALLOC_ATTR(format(printf, 3, 4)) +void +malloc_cprintf(void (*write_cb)(void *, const char *), void *cbopaque, + const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + malloc_vcprintf(write_cb, cbopaque, format, ap); + va_end(ap); +} + +/* + * Print to stderr in such a way as to (hopefully) avoid memory allocation. + */ +JEMALLOC_ATTR(format(printf, 1, 2)) +void +malloc_printf(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + malloc_vcprintf(NULL, NULL, format, ap); + va_end(ap); +} +#endif + +#ifdef JEMALLOC_STATS +static void +stats_arena_bins_print(void (*write_cb)(void *, const char *), void *cbopaque, + unsigned i) +{ + size_t pagesize; + bool config_tcache; + unsigned nbins, j, gap_start; + + CTL_GET("arenas.pagesize", &pagesize, size_t); + + CTL_GET("config.tcache", &config_tcache, bool); + if (config_tcache) { + malloc_cprintf(write_cb, cbopaque, + "bins: bin size regs pgs allocated nmalloc" + " ndalloc nrequests nfills nflushes" + " newruns reruns maxruns curruns\n"); + } else { + malloc_cprintf(write_cb, cbopaque, + "bins: bin size regs pgs allocated nmalloc" + " ndalloc newruns reruns maxruns" + " curruns\n"); + } + CTL_GET("arenas.nbins", &nbins, unsigned); + for (j = 0, gap_start = UINT_MAX; j < nbins; j++) { + uint64_t nruns; + + CTL_IJ_GET("stats.arenas.0.bins.0.nruns", &nruns, uint64_t); + if (nruns == 0) { + if (gap_start == UINT_MAX) + gap_start = j; + } else { + unsigned ntbins_, nqbins, ncbins, nsbins; + size_t reg_size, run_size, allocated; + uint32_t nregs; + uint64_t nmalloc, ndalloc, nrequests, nfills, nflushes; + uint64_t reruns; + size_t highruns, curruns; + + if (gap_start != UINT_MAX) { + if (j > gap_start + 1) { + /* Gap of more than one size class. */ + malloc_cprintf(write_cb, cbopaque, + "[%u..%u]\n", gap_start, + j - 1); + } else { + /* Gap of one size class. */ + malloc_cprintf(write_cb, cbopaque, + "[%u]\n", gap_start); + } + gap_start = UINT_MAX; + } + CTL_GET("arenas.ntbins", &ntbins_, unsigned); + CTL_GET("arenas.nqbins", &nqbins, unsigned); + CTL_GET("arenas.ncbins", &ncbins, unsigned); + CTL_GET("arenas.nsbins", &nsbins, unsigned); + CTL_J_GET("arenas.bin.0.size", ®_size, size_t); + CTL_J_GET("arenas.bin.0.nregs", &nregs, uint32_t); + CTL_J_GET("arenas.bin.0.run_size", &run_size, size_t); + CTL_IJ_GET("stats.arenas.0.bins.0.allocated", + &allocated, size_t); + CTL_IJ_GET("stats.arenas.0.bins.0.nmalloc", + &nmalloc, uint64_t); + CTL_IJ_GET("stats.arenas.0.bins.0.ndalloc", + &ndalloc, uint64_t); + if (config_tcache) { + CTL_IJ_GET("stats.arenas.0.bins.0.nrequests", + &nrequests, uint64_t); + CTL_IJ_GET("stats.arenas.0.bins.0.nfills", + &nfills, uint64_t); + CTL_IJ_GET("stats.arenas.0.bins.0.nflushes", + &nflushes, uint64_t); + } + CTL_IJ_GET("stats.arenas.0.bins.0.nreruns", &reruns, + uint64_t); + CTL_IJ_GET("stats.arenas.0.bins.0.highruns", &highruns, + size_t); + CTL_IJ_GET("stats.arenas.0.bins.0.curruns", &curruns, + size_t); + if (config_tcache) { + malloc_cprintf(write_cb, cbopaque, + "%13u %1s %5zu %4u %3zu %12zu %12"PRIu64 + " %12"PRIu64" %12"PRIu64" %12"PRIu64 + " %12"PRIu64" %12"PRIu64" %12"PRIu64 + " %12zu %12zu\n", + j, + j < ntbins_ ? "T" : j < ntbins_ + nqbins ? + "Q" : j < ntbins_ + nqbins + ncbins ? "C" : + "S", + reg_size, nregs, run_size / pagesize, + allocated, nmalloc, ndalloc, nrequests, + nfills, nflushes, nruns, reruns, highruns, + curruns); + } else { + malloc_cprintf(write_cb, cbopaque, + "%13u %1s %5zu %4u %3zu %12zu %12"PRIu64 + " %12"PRIu64" %12"PRIu64" %12"PRIu64 + " %12zu %12zu\n", + j, + j < ntbins_ ? "T" : j < ntbins_ + nqbins ? + "Q" : j < ntbins_ + nqbins + ncbins ? "C" : + "S", + reg_size, nregs, run_size / pagesize, + allocated, nmalloc, ndalloc, nruns, reruns, + highruns, curruns); + } + } + } + if (gap_start != UINT_MAX) { + if (j > gap_start + 1) { + /* Gap of more than one size class. */ + malloc_cprintf(write_cb, cbopaque, "[%u..%u]\n", + gap_start, j - 1); + } else { + /* Gap of one size class. */ + malloc_cprintf(write_cb, cbopaque, "[%u]\n", gap_start); + } + } +} + +static void +stats_arena_lruns_print(void (*write_cb)(void *, const char *), void *cbopaque, + unsigned i) +{ + size_t pagesize, nlruns, j; + ssize_t gap_start; + + CTL_GET("arenas.pagesize", &pagesize, size_t); + + malloc_cprintf(write_cb, cbopaque, + "large: size pages nmalloc ndalloc nrequests" + " maxruns curruns\n"); + CTL_GET("arenas.nlruns", &nlruns, size_t); + for (j = 0, gap_start = -1; j < nlruns; j++) { + uint64_t nmalloc, ndalloc, nrequests; + size_t run_size, highruns, curruns; + + CTL_IJ_GET("stats.arenas.0.lruns.0.nmalloc", &nmalloc, + uint64_t); + CTL_IJ_GET("stats.arenas.0.lruns.0.ndalloc", &ndalloc, + uint64_t); + CTL_IJ_GET("stats.arenas.0.lruns.0.nrequests", &nrequests, + uint64_t); + if (nrequests == 0) { + if (gap_start == -1) + gap_start = j; + } else { + CTL_J_GET("arenas.lrun.0.size", &run_size, size_t); + CTL_IJ_GET("stats.arenas.0.lruns.0.highruns", &highruns, + size_t); + CTL_IJ_GET("stats.arenas.0.lruns.0.curruns", &curruns, + size_t); + if (gap_start != -1) { + malloc_cprintf(write_cb, cbopaque, "[%zu]\n", + j - gap_start); + gap_start = -1; + } + malloc_cprintf(write_cb, cbopaque, + "%13zu %5zu %12"PRIu64" %12"PRIu64" %12"PRIu64 + " %12zu %12zu\n", + run_size, run_size / pagesize, nmalloc, ndalloc, + nrequests, highruns, curruns); + } + } + if (gap_start != -1) + malloc_cprintf(write_cb, cbopaque, "[%zu]\n", j - gap_start); +} + +static void +stats_arena_print(void (*write_cb)(void *, const char *), void *cbopaque, + unsigned i) +{ + size_t pagesize, pactive, pdirty, mapped; + uint64_t npurge, nmadvise, purged; + size_t small_allocated; + uint64_t small_nmalloc, small_ndalloc, small_nrequests; + size_t large_allocated; + uint64_t large_nmalloc, large_ndalloc, large_nrequests; + + CTL_GET("arenas.pagesize", &pagesize, size_t); + + CTL_I_GET("stats.arenas.0.pactive", &pactive, size_t); + CTL_I_GET("stats.arenas.0.pdirty", &pdirty, size_t); + CTL_I_GET("stats.arenas.0.npurge", &npurge, uint64_t); + CTL_I_GET("stats.arenas.0.nmadvise", &nmadvise, uint64_t); + CTL_I_GET("stats.arenas.0.purged", &purged, uint64_t); + malloc_cprintf(write_cb, cbopaque, + "dirty pages: %zu:%zu active:dirty, %"PRIu64" sweep%s," + " %"PRIu64" madvise%s, %"PRIu64" purged\n", + pactive, pdirty, npurge, npurge == 1 ? "" : "s", + nmadvise, nmadvise == 1 ? "" : "s", purged); + + malloc_cprintf(write_cb, cbopaque, + " allocated nmalloc ndalloc nrequests\n"); + CTL_I_GET("stats.arenas.0.small.allocated", &small_allocated, size_t); + CTL_I_GET("stats.arenas.0.small.nmalloc", &small_nmalloc, uint64_t); + CTL_I_GET("stats.arenas.0.small.ndalloc", &small_ndalloc, uint64_t); + CTL_I_GET("stats.arenas.0.small.nrequests", &small_nrequests, uint64_t); + malloc_cprintf(write_cb, cbopaque, + "small: %12zu %12"PRIu64" %12"PRIu64" %12"PRIu64"\n", + small_allocated, small_nmalloc, small_ndalloc, small_nrequests); + CTL_I_GET("stats.arenas.0.large.allocated", &large_allocated, size_t); + CTL_I_GET("stats.arenas.0.large.nmalloc", &large_nmalloc, uint64_t); + CTL_I_GET("stats.arenas.0.large.ndalloc", &large_ndalloc, uint64_t); + CTL_I_GET("stats.arenas.0.large.nrequests", &large_nrequests, uint64_t); + malloc_cprintf(write_cb, cbopaque, + "large: %12zu %12"PRIu64" %12"PRIu64" %12"PRIu64"\n", + large_allocated, large_nmalloc, large_ndalloc, large_nrequests); + malloc_cprintf(write_cb, cbopaque, + "total: %12zu %12"PRIu64" %12"PRIu64" %12"PRIu64"\n", + small_allocated + large_allocated, + small_nmalloc + large_nmalloc, + small_ndalloc + large_ndalloc, + small_nrequests + large_nrequests); + malloc_cprintf(write_cb, cbopaque, "active: %12zu\n", + pactive * pagesize ); + CTL_I_GET("stats.arenas.0.mapped", &mapped, size_t); + malloc_cprintf(write_cb, cbopaque, "mapped: %12zu\n", mapped); + + stats_arena_bins_print(write_cb, cbopaque, i); + stats_arena_lruns_print(write_cb, cbopaque, i); +} +#endif + +void +stats_print(void (*write_cb)(void *, const char *), void *cbopaque, + const char *opts) +{ + uint64_t epoch; + size_t u64sz; + char s[UMAX2S_BUFSIZE]; + bool general = true; + bool merged = true; + bool unmerged = true; + bool bins = true; + bool large = true; + + /* Refresh stats, in case mallctl() was called by the application. */ + epoch = 1; + u64sz = sizeof(uint64_t); + xmallctl("epoch", &epoch, &u64sz, &epoch, sizeof(uint64_t)); + + if (write_cb == NULL) { + /* + * The caller did not provide an alternate write_cb callback + * function, so use the default one. malloc_write() is an + * inline function, so use malloc_message() directly here. + */ + write_cb = JEMALLOC_P(malloc_message); + cbopaque = NULL; + } + + if (opts != NULL) { + unsigned i; + + for (i = 0; opts[i] != '\0'; i++) { + switch (opts[i]) { + case 'g': + general = false; + break; + case 'm': + merged = false; + break; + case 'a': + unmerged = false; + break; + case 'b': + bins = false; + break; + case 'l': + large = false; + break; + default:; + } + } + } + + write_cb(cbopaque, "___ Begin jemalloc statistics ___\n"); + if (general) { + int err; + const char *cpv; + bool bv; + unsigned uv; + ssize_t ssv; + size_t sv, bsz, ssz; + + bsz = sizeof(bool); + ssz = sizeof(size_t); + + CTL_GET("version", &cpv, const char *); + write_cb(cbopaque, "Version: "); + write_cb(cbopaque, cpv); + write_cb(cbopaque, "\n"); + CTL_GET("config.debug", &bv, bool); + write_cb(cbopaque, "Assertions "); + write_cb(cbopaque, bv ? "enabled" : "disabled"); + write_cb(cbopaque, "\n"); + + write_cb(cbopaque, "Boolean JEMALLOC_OPTIONS: "); + if ((err = JEMALLOC_P(mallctl)("opt.abort", &bv, &bsz, NULL, 0)) + == 0) + write_cb(cbopaque, bv ? "A" : "a"); + if ((err = JEMALLOC_P(mallctl)("prof.active", &bv, &bsz, + NULL, 0)) == 0) + write_cb(cbopaque, bv ? "E" : "e"); + if ((err = JEMALLOC_P(mallctl)("opt.prof", &bv, &bsz, NULL, 0)) + == 0) + write_cb(cbopaque, bv ? "F" : "f"); + if ((err = JEMALLOC_P(mallctl)("opt.tcache", &bv, &bsz, NULL, + 0)) == 0) + write_cb(cbopaque, bv ? "H" : "h"); + if ((err = JEMALLOC_P(mallctl)("opt.junk", &bv, &bsz, NULL, 0)) + == 0) + write_cb(cbopaque, bv ? "J" : "j"); + if ((err = JEMALLOC_P(mallctl)("opt.prof_leak", &bv, &bsz, NULL, + 0)) == 0) + write_cb(cbopaque, bv ? "L" : "l"); + if ((err = JEMALLOC_P(mallctl)("opt.overcommit", &bv, &bsz, + NULL, 0)) == 0) + write_cb(cbopaque, bv ? "O" : "o"); + if ((err = JEMALLOC_P(mallctl)("opt.stats_print", &bv, &bsz, + NULL, 0)) == 0) + write_cb(cbopaque, bv ? "P" : "p"); + if ((err = JEMALLOC_P(mallctl)("opt.prof_udump", &bv, &bsz, + NULL, 0)) == 0) + write_cb(cbopaque, bv ? "U" : "u"); + if ((err = JEMALLOC_P(mallctl)("opt.sysv", &bv, &bsz, NULL, 0)) + == 0) + write_cb(cbopaque, bv ? "V" : "v"); + if ((err = JEMALLOC_P(mallctl)("opt.xmalloc", &bv, &bsz, NULL, + 0)) == 0) + write_cb(cbopaque, bv ? "X" : "x"); + if ((err = JEMALLOC_P(mallctl)("opt.zero", &bv, &bsz, NULL, 0)) + == 0) + write_cb(cbopaque, bv ? "Z" : "z"); + write_cb(cbopaque, "\n"); + + write_cb(cbopaque, "CPUs: "); + write_cb(cbopaque, umax2s(ncpus, 10, s)); + write_cb(cbopaque, "\n"); + + CTL_GET("arenas.narenas", &uv, unsigned); + write_cb(cbopaque, "Max arenas: "); + write_cb(cbopaque, umax2s(uv, 10, s)); + write_cb(cbopaque, "\n"); + + write_cb(cbopaque, "Pointer size: "); + write_cb(cbopaque, umax2s(sizeof(void *), 10, s)); + write_cb(cbopaque, "\n"); + + CTL_GET("arenas.quantum", &sv, size_t); + write_cb(cbopaque, "Quantum size: "); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "\n"); + + CTL_GET("arenas.cacheline", &sv, size_t); + write_cb(cbopaque, "Cacheline size (assumed): "); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "\n"); + + CTL_GET("arenas.subpage", &sv, size_t); + write_cb(cbopaque, "Subpage spacing: "); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "\n"); + + if ((err = JEMALLOC_P(mallctl)("arenas.tspace_min", &sv, &ssz, + NULL, 0)) == 0) { + write_cb(cbopaque, "Tiny 2^n-spaced sizes: ["); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, ".."); + + CTL_GET("arenas.tspace_max", &sv, size_t); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "]\n"); + } + + CTL_GET("arenas.qspace_min", &sv, size_t); + write_cb(cbopaque, "Quantum-spaced sizes: ["); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, ".."); + CTL_GET("arenas.qspace_max", &sv, size_t); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "]\n"); + + CTL_GET("arenas.cspace_min", &sv, size_t); + write_cb(cbopaque, "Cacheline-spaced sizes: ["); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, ".."); + CTL_GET("arenas.cspace_max", &sv, size_t); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "]\n"); + + CTL_GET("arenas.sspace_min", &sv, size_t); + write_cb(cbopaque, "Subpage-spaced sizes: ["); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, ".."); + CTL_GET("arenas.sspace_max", &sv, size_t); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "]\n"); + + CTL_GET("opt.lg_dirty_mult", &ssv, ssize_t); + if (ssv >= 0) { + write_cb(cbopaque, + "Min active:dirty page ratio per arena: "); + write_cb(cbopaque, umax2s((1U << ssv), 10, s)); + write_cb(cbopaque, ":1\n"); + } else { + write_cb(cbopaque, + "Min active:dirty page ratio per arena: N/A\n"); + } + if ((err = JEMALLOC_P(mallctl)("arenas.tcache_max", &sv, + &ssz, NULL, 0)) == 0) { + write_cb(cbopaque, + "Maximum thread-cached size class: "); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, "\n"); + } + if ((err = JEMALLOC_P(mallctl)("opt.lg_tcache_gc_sweep", &ssv, + &ssz, NULL, 0)) == 0) { + size_t tcache_gc_sweep = (1U << ssv); + bool tcache_enabled; + CTL_GET("opt.tcache", &tcache_enabled, bool); + write_cb(cbopaque, "Thread cache GC sweep interval: "); + write_cb(cbopaque, tcache_enabled && ssv >= 0 ? + umax2s(tcache_gc_sweep, 10, s) : "N/A"); + write_cb(cbopaque, "\n"); + } + if ((err = JEMALLOC_P(mallctl)("opt.prof", &bv, &bsz, NULL, 0)) + == 0 && bv) { + CTL_GET("opt.lg_prof_bt_max", &sv, size_t); + write_cb(cbopaque, "Maximum profile backtrace depth: "); + write_cb(cbopaque, umax2s((1U << sv), 10, s)); + write_cb(cbopaque, "\n"); + + CTL_GET("opt.lg_prof_sample", &sv, size_t); + write_cb(cbopaque, "Average profile sample interval: "); + write_cb(cbopaque, umax2s((1U << sv), 10, s)); + write_cb(cbopaque, " (2^"); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, ")\n"); + + CTL_GET("opt.lg_prof_interval", &ssv, ssize_t); + write_cb(cbopaque, "Average profile dump interval: "); + if (ssv >= 0) { + write_cb(cbopaque, umax2s((1U << ssv), 10, s)); + write_cb(cbopaque, " (2^"); + write_cb(cbopaque, umax2s(ssv, 10, s)); + write_cb(cbopaque, ")\n"); + } else + write_cb(cbopaque, "N/A\n"); + } + CTL_GET("arenas.chunksize", &sv, size_t); + write_cb(cbopaque, "Chunk size: "); + write_cb(cbopaque, umax2s(sv, 10, s)); + CTL_GET("opt.lg_chunk", &sv, size_t); + write_cb(cbopaque, " (2^"); + write_cb(cbopaque, umax2s(sv, 10, s)); + write_cb(cbopaque, ")\n"); + } + +#ifdef JEMALLOC_STATS + { + int err; + size_t ssz; + size_t allocated, active, mapped; + size_t chunks_current, chunks_high, swap_avail; + uint64_t chunks_total; + size_t huge_allocated; + uint64_t huge_nmalloc, huge_ndalloc; + + ssz = sizeof(size_t); + + CTL_GET("stats.allocated", &allocated, size_t); + CTL_GET("stats.active", &active, size_t); + CTL_GET("stats.mapped", &mapped, size_t); + malloc_cprintf(write_cb, cbopaque, + "Allocated: %zu, active: %zu, mapped: %zu\n", allocated, + active, mapped); + + /* Print chunk stats. */ + CTL_GET("stats.chunks.total", &chunks_total, uint64_t); + CTL_GET("stats.chunks.high", &chunks_high, size_t); + CTL_GET("stats.chunks.current", &chunks_current, size_t); + if ((err = JEMALLOC_P(mallctl)("swap.avail", &swap_avail, &ssz, + NULL, 0)) == 0) { + size_t lg_chunk; + + malloc_cprintf(write_cb, cbopaque, "chunks: nchunks " + "highchunks curchunks swap_avail\n"); + CTL_GET("opt.lg_chunk", &lg_chunk, size_t); + malloc_cprintf(write_cb, cbopaque, + " %13"PRIu64"%13zu%13zu%13zu\n", + chunks_total, chunks_high, chunks_current, + swap_avail << lg_chunk); + } else { + malloc_cprintf(write_cb, cbopaque, "chunks: nchunks " + "highchunks curchunks\n"); + malloc_cprintf(write_cb, cbopaque, + " %13"PRIu64"%13zu%13zu\n", + chunks_total, chunks_high, chunks_current); + } + + /* Print huge stats. */ + CTL_GET("stats.huge.nmalloc", &huge_nmalloc, uint64_t); + CTL_GET("stats.huge.ndalloc", &huge_ndalloc, uint64_t); + CTL_GET("stats.huge.allocated", &huge_allocated, size_t); + malloc_cprintf(write_cb, cbopaque, + "huge: nmalloc ndalloc allocated\n"); + malloc_cprintf(write_cb, cbopaque, + " %12"PRIu64" %12"PRIu64" %12zu\n", + huge_nmalloc, huge_ndalloc, huge_allocated); + + if (merged) { + unsigned narenas; + + CTL_GET("arenas.narenas", &narenas, unsigned); + { + bool initialized[narenas]; + size_t isz; + unsigned i, ninitialized; + + isz = sizeof(initialized); + xmallctl("arenas.initialized", initialized, + &isz, NULL, 0); + for (i = ninitialized = 0; i < narenas; i++) { + if (initialized[i]) + ninitialized++; + } + + if (ninitialized > 1) { + /* Print merged arena stats. */ + malloc_cprintf(write_cb, cbopaque, + "\nMerged arenas stats:\n"); + stats_arena_print(write_cb, cbopaque, + narenas); + } + } + } + + if (unmerged) { + unsigned narenas; + + /* Print stats for each arena. */ + + CTL_GET("arenas.narenas", &narenas, unsigned); + { + bool initialized[narenas]; + size_t isz; + unsigned i; + + isz = sizeof(initialized); + xmallctl("arenas.initialized", initialized, + &isz, NULL, 0); + + for (i = 0; i < narenas; i++) { + if (initialized[i]) { + malloc_cprintf(write_cb, + cbopaque, + "\narenas[%u]:\n", i); + stats_arena_print(write_cb, + cbopaque, i); + } + } + } + } + } +#endif /* #ifdef JEMALLOC_STATS */ + write_cb(cbopaque, "--- End jemalloc statistics ---\n"); +} diff --git a/externals/jemalloc/tcache.c b/externals/jemalloc/tcache.c new file mode 100644 index 0000000..ce6ec99 --- /dev/null +++ b/externals/jemalloc/tcache.c @@ -0,0 +1,403 @@ +#define JEMALLOC_TCACHE_C_ +#include "jemalloc/internal/jemalloc_internal.h" +#ifdef JEMALLOC_TCACHE +/******************************************************************************/ +/* Data. */ + +bool opt_tcache = true; +ssize_t opt_lg_tcache_maxclass = LG_TCACHE_MAXCLASS_DEFAULT; +ssize_t opt_lg_tcache_gc_sweep = LG_TCACHE_GC_SWEEP_DEFAULT; + +/* Map of thread-specific caches. */ +__thread tcache_t *tcache_tls JEMALLOC_ATTR(tls_model("initial-exec")); + +/* + * Same contents as tcache, but initialized such that the TSD destructor is + * called when a thread exits, so that the cache can be cleaned up. + */ +static pthread_key_t tcache_tsd; + +size_t nhbins; +size_t tcache_maxclass; +unsigned tcache_gc_incr; + +/******************************************************************************/ +/* Function prototypes for non-inline static functions. */ + +static void tcache_thread_cleanup(void *arg); + +/******************************************************************************/ + +void * +tcache_alloc_small_hard(tcache_t *tcache, tcache_bin_t *tbin, size_t binind) +{ + void *ret; + + arena_tcache_fill_small(tcache->arena, tbin, binind +#ifdef JEMALLOC_PROF + , tcache->prof_accumbytes +#endif + ); +#ifdef JEMALLOC_PROF + tcache->prof_accumbytes = 0; +#endif + ret = tcache_alloc_easy(tbin); + + return (ret); +} + +void +tcache_bin_flush_small(tcache_bin_t *tbin, size_t binind, unsigned rem +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache_t *tcache +#endif + ) +{ + void *flush, *deferred, *ptr; + unsigned i, nflush, ndeferred; + + assert(binind < nbins); + assert(rem <= tbin->ncached); + + for (flush = tbin->avail, nflush = tbin->ncached - rem; flush != NULL; + flush = deferred, nflush = ndeferred) { + /* Lock the arena bin associated with the first object. */ + arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(flush); + arena_t *arena = chunk->arena; + arena_bin_t *bin = &arena->bins[binind]; + +#ifdef JEMALLOC_PROF + if (arena == tcache->arena) { + malloc_mutex_lock(&arena->lock); + arena_prof_accum(arena, tcache->prof_accumbytes); + malloc_mutex_unlock(&arena->lock); + tcache->prof_accumbytes = 0; + } +#endif + + malloc_mutex_lock(&bin->lock); +#ifdef JEMALLOC_STATS + if (arena == tcache->arena) { + bin->stats.nflushes++; + bin->stats.nrequests += tbin->tstats.nrequests; + tbin->tstats.nrequests = 0; + } +#endif + deferred = NULL; + ndeferred = 0; + for (i = 0; i < nflush; i++) { + ptr = flush; + assert(ptr != NULL); + flush = *(void **)ptr; + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk->arena == arena) { + size_t pageind = (((uintptr_t)ptr - + (uintptr_t)chunk) >> PAGE_SHIFT); + arena_chunk_map_t *mapelm = + &chunk->map[pageind]; + arena_dalloc_bin(arena, chunk, ptr, mapelm); + } else { + /* + * This object was allocated via a different + * arena bin than the one that is currently + * locked. Stash the object, so that it can be + * handled in a future pass. + */ + *(void **)ptr = deferred; + deferred = ptr; + ndeferred++; + } + } + malloc_mutex_unlock(&bin->lock); + + if (flush != NULL) { + /* + * This was the first pass, and rem cached objects + * remain. + */ + tbin->avail = flush; + } + } + + tbin->ncached = rem; + if (tbin->ncached < tbin->low_water) + tbin->low_water = tbin->ncached; +} + +void +tcache_bin_flush_large(tcache_bin_t *tbin, size_t binind, unsigned rem +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache_t *tcache +#endif + ) +{ + void *flush, *deferred, *ptr; + unsigned i, nflush, ndeferred; + + assert(binind < nhbins); + assert(rem <= tbin->ncached); + + for (flush = tbin->avail, nflush = tbin->ncached - rem; flush != NULL; + flush = deferred, nflush = ndeferred) { + /* Lock the arena associated with the first object. */ + arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(flush); + arena_t *arena = chunk->arena; + + malloc_mutex_lock(&arena->lock); +#if (defined(JEMALLOC_PROF) || defined(JEMALLOC_STATS)) + if (arena == tcache->arena) { +#endif +#ifdef JEMALLOC_PROF + arena_prof_accum(arena, tcache->prof_accumbytes); + tcache->prof_accumbytes = 0; +#endif +#ifdef JEMALLOC_STATS + arena->stats.nrequests_large += tbin->tstats.nrequests; + arena->stats.lstats[binind - nbins].nrequests += + tbin->tstats.nrequests; + tbin->tstats.nrequests = 0; +#endif +#if (defined(JEMALLOC_PROF) || defined(JEMALLOC_STATS)) + } +#endif + deferred = NULL; + ndeferred = 0; + for (i = 0; i < nflush; i++) { + ptr = flush; + assert(ptr != NULL); + flush = *(void **)ptr; + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk->arena == arena) + arena_dalloc_large(arena, chunk, ptr); + else { + /* + * This object was allocated via a different + * arena than the one that is currently locked. + * Stash the object, so that it can be handled + * in a future pass. + */ + *(void **)ptr = deferred; + deferred = ptr; + ndeferred++; + } + } + malloc_mutex_unlock(&arena->lock); + + if (flush != NULL) { + /* + * This was the first pass, and rem cached objects + * remain. + */ + tbin->avail = flush; + } + } + + tbin->ncached = rem; + if (tbin->ncached < tbin->low_water) + tbin->low_water = tbin->ncached; +} + +tcache_t * +tcache_create(arena_t *arena) +{ + tcache_t *tcache; + size_t size; + unsigned i; + + size = sizeof(tcache_t) + (sizeof(tcache_bin_t) * (nhbins - 1)); + /* + * Round up to the nearest multiple of the cacheline size, in order to + * avoid the possibility of false cacheline sharing. + * + * That this works relies on the same logic as in ipalloc(). + */ + size = (size + CACHELINE_MASK) & (-CACHELINE); + + if (size <= small_maxclass) + tcache = (tcache_t *)arena_malloc_small(arena, size, true); + else + tcache = (tcache_t *)icalloc(size); + + if (tcache == NULL) + return (NULL); + +#ifdef JEMALLOC_STATS + /* Link into list of extant tcaches. */ + malloc_mutex_lock(&arena->lock); + ql_elm_new(tcache, link); + ql_tail_insert(&arena->tcache_ql, tcache, link); + malloc_mutex_unlock(&arena->lock); +#endif + + tcache->arena = arena; + assert((TCACHE_NSLOTS_SMALL_MAX & 1U) == 0); + for (i = 0; i < nbins; i++) { + if ((arena->bins[i].nregs << 1) <= TCACHE_NSLOTS_SMALL_MAX) { + tcache->tbins[i].ncached_max = (arena->bins[i].nregs << + 1); + } else + tcache->tbins[i].ncached_max = TCACHE_NSLOTS_SMALL_MAX; + } + for (; i < nhbins; i++) + tcache->tbins[i].ncached_max = TCACHE_NSLOTS_LARGE; + + tcache_tls = tcache; + pthread_setspecific(tcache_tsd, tcache); + + return (tcache); +} + +void +tcache_destroy(tcache_t *tcache) +{ + unsigned i; + +#ifdef JEMALLOC_STATS + /* Unlink from list of extant tcaches. */ + malloc_mutex_lock(&tcache->arena->lock); + ql_remove(&tcache->arena->tcache_ql, tcache, link); + malloc_mutex_unlock(&tcache->arena->lock); + tcache_stats_merge(tcache, tcache->arena); +#endif + + for (i = 0; i < nbins; i++) { + tcache_bin_t *tbin = &tcache->tbins[i]; + tcache_bin_flush_small(tbin, i, 0 +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache +#endif + ); + +#ifdef JEMALLOC_STATS + if (tbin->tstats.nrequests != 0) { + arena_t *arena = tcache->arena; + arena_bin_t *bin = &arena->bins[i]; + malloc_mutex_lock(&bin->lock); + bin->stats.nrequests += tbin->tstats.nrequests; + malloc_mutex_unlock(&bin->lock); + } +#endif + } + + for (; i < nhbins; i++) { + tcache_bin_t *tbin = &tcache->tbins[i]; + tcache_bin_flush_large(tbin, i, 0 +#if (defined(JEMALLOC_STATS) || defined(JEMALLOC_PROF)) + , tcache +#endif + ); + +#ifdef JEMALLOC_STATS + if (tbin->tstats.nrequests != 0) { + arena_t *arena = tcache->arena; + malloc_mutex_lock(&arena->lock); + arena->stats.nrequests_large += tbin->tstats.nrequests; + arena->stats.lstats[i - nbins].nrequests += + tbin->tstats.nrequests; + malloc_mutex_unlock(&arena->lock); + } +#endif + } + +#ifdef JEMALLOC_PROF + if (tcache->prof_accumbytes > 0) { + malloc_mutex_lock(&tcache->arena->lock); + arena_prof_accum(tcache->arena, tcache->prof_accumbytes); + malloc_mutex_unlock(&tcache->arena->lock); + } +#endif + + if (arena_salloc(tcache) <= small_maxclass) { + arena_chunk_t *chunk = CHUNK_ADDR2BASE(tcache); + arena_t *arena = chunk->arena; + size_t pageind = (((uintptr_t)tcache - (uintptr_t)chunk) >> + PAGE_SHIFT); + arena_chunk_map_t *mapelm = &chunk->map[pageind]; + arena_run_t *run = (arena_run_t *)((uintptr_t)chunk + + (uintptr_t)((pageind - (mapelm->bits >> PAGE_SHIFT)) << + PAGE_SHIFT)); + arena_bin_t *bin = run->bin; + + malloc_mutex_lock(&bin->lock); + arena_dalloc_bin(arena, chunk, tcache, mapelm); + malloc_mutex_unlock(&bin->lock); + } else + idalloc(tcache); +} + +static void +tcache_thread_cleanup(void *arg) +{ + tcache_t *tcache = (tcache_t *)arg; + + assert(tcache == tcache_tls); + if (tcache != NULL) { + assert(tcache != (void *)(uintptr_t)1); + tcache_destroy(tcache); + tcache_tls = (void *)(uintptr_t)1; + } +} + +#ifdef JEMALLOC_STATS +void +tcache_stats_merge(tcache_t *tcache, arena_t *arena) +{ + unsigned i; + + /* Merge and reset tcache stats. */ + for (i = 0; i < nbins; i++) { + arena_bin_t *bin = &arena->bins[i]; + tcache_bin_t *tbin = &tcache->tbins[i]; + malloc_mutex_lock(&bin->lock); + bin->stats.nrequests += tbin->tstats.nrequests; + malloc_mutex_unlock(&bin->lock); + tbin->tstats.nrequests = 0; + } + + for (; i < nhbins; i++) { + malloc_large_stats_t *lstats = &arena->stats.lstats[i - nbins]; + tcache_bin_t *tbin = &tcache->tbins[i]; + arena->stats.nrequests_large += tbin->tstats.nrequests; + lstats->nrequests += tbin->tstats.nrequests; + tbin->tstats.nrequests = 0; + } +} +#endif + +void +tcache_boot(void) +{ + + if (opt_tcache) { + /* + * If necessary, clamp opt_lg_tcache_maxclass, now that + * small_maxclass and arena_maxclass are known. + */ + if (opt_lg_tcache_maxclass < 0 || (1U << + opt_lg_tcache_maxclass) < small_maxclass) + tcache_maxclass = small_maxclass; + else if ((1U << opt_lg_tcache_maxclass) > arena_maxclass) + tcache_maxclass = arena_maxclass; + else + tcache_maxclass = (1U << opt_lg_tcache_maxclass); + + nhbins = nbins + (tcache_maxclass >> PAGE_SHIFT); + + /* Compute incremental GC event threshold. */ + if (opt_lg_tcache_gc_sweep >= 0) { + tcache_gc_incr = ((1U << opt_lg_tcache_gc_sweep) / + nbins) + (((1U << opt_lg_tcache_gc_sweep) % nbins == + 0) ? 0 : 1); + } else + tcache_gc_incr = 0; + + if (pthread_key_create(&tcache_tsd, tcache_thread_cleanup) != + 0) { + malloc_write( + ": Error in pthread_key_create()\n"); + abort(); + } + } +} +/******************************************************************************/ +#endif /* JEMALLOC_TCACHE */ diff --git a/externals/lib/Win32_Debug/dbghelp.dll b/externals/lib/Win32_Debug/dbghelp.dll new file mode 100644 index 0000000..6f646de Binary files /dev/null and b/externals/lib/Win32_Debug/dbghelp.dll differ diff --git a/externals/lib/Win32_Debug/libeay32.dll b/externals/lib/Win32_Debug/libeay32.dll new file mode 100644 index 0000000..79f5597 Binary files /dev/null and b/externals/lib/Win32_Debug/libeay32.dll differ diff --git a/externals/lib/Win32_Debug/libeay32.lib b/externals/lib/Win32_Debug/libeay32.lib new file mode 100644 index 0000000..590c39e Binary files /dev/null and b/externals/lib/Win32_Debug/libeay32.lib differ diff --git a/externals/lib/Win32_Debug/ssleay32.dll b/externals/lib/Win32_Debug/ssleay32.dll new file mode 100644 index 0000000..536442d Binary files /dev/null and b/externals/lib/Win32_Debug/ssleay32.dll differ diff --git a/externals/lib/Win32_Debug/ssleay32.lib b/externals/lib/Win32_Debug/ssleay32.lib new file mode 100644 index 0000000..73836a3 Binary files /dev/null and b/externals/lib/Win32_Debug/ssleay32.lib differ diff --git a/externals/lib/Win32_Release/dbghelp.dll b/externals/lib/Win32_Release/dbghelp.dll new file mode 100644 index 0000000..597188d Binary files /dev/null and b/externals/lib/Win32_Release/dbghelp.dll differ diff --git a/externals/lib/Win32_Release/libeay32.dll b/externals/lib/Win32_Release/libeay32.dll new file mode 100644 index 0000000..9b7dc65 Binary files /dev/null and b/externals/lib/Win32_Release/libeay32.dll differ diff --git a/externals/lib/Win32_Release/libeay32.lib b/externals/lib/Win32_Release/libeay32.lib new file mode 100644 index 0000000..fb5a244 Binary files /dev/null and b/externals/lib/Win32_Release/libeay32.lib differ diff --git a/externals/lib/Win32_Release/ssleay32.dll b/externals/lib/Win32_Release/ssleay32.dll new file mode 100644 index 0000000..536442d Binary files /dev/null and b/externals/lib/Win32_Release/ssleay32.dll differ diff --git a/externals/lib/Win32_Release/ssleay32.lib b/externals/lib/Win32_Release/ssleay32.lib new file mode 100644 index 0000000..73836a3 Binary files /dev/null and b/externals/lib/Win32_Release/ssleay32.lib differ diff --git a/externals/lib/x64_Debug/libeay32.dll b/externals/lib/x64_Debug/libeay32.dll new file mode 100644 index 0000000..d9df5ec Binary files /dev/null and b/externals/lib/x64_Debug/libeay32.dll differ diff --git a/externals/lib/x64_Debug/libeay32.lib b/externals/lib/x64_Debug/libeay32.lib new file mode 100644 index 0000000..a495e92 Binary files /dev/null and b/externals/lib/x64_Debug/libeay32.lib differ diff --git a/externals/lib/x64_Debug/ssleay32.dll b/externals/lib/x64_Debug/ssleay32.dll new file mode 100644 index 0000000..dfeb955 Binary files /dev/null and b/externals/lib/x64_Debug/ssleay32.dll differ diff --git a/externals/lib/x64_Debug/ssleay32.lib b/externals/lib/x64_Debug/ssleay32.lib new file mode 100644 index 0000000..4247f82 Binary files /dev/null and b/externals/lib/x64_Debug/ssleay32.lib differ diff --git a/externals/lib/x64_Release/libeay32.dll b/externals/lib/x64_Release/libeay32.dll new file mode 100644 index 0000000..4535790 Binary files /dev/null and b/externals/lib/x64_Release/libeay32.dll differ diff --git a/externals/lib/x64_Release/libeay32.lib b/externals/lib/x64_Release/libeay32.lib new file mode 100644 index 0000000..750e837 Binary files /dev/null and b/externals/lib/x64_Release/libeay32.lib differ diff --git a/externals/lib/x64_Release/ssleay32.dll b/externals/lib/x64_Release/ssleay32.dll new file mode 100644 index 0000000..dfeb955 Binary files /dev/null and b/externals/lib/x64_Release/ssleay32.dll differ diff --git a/externals/lib/x64_Release/ssleay32.lib b/externals/lib/x64_Release/ssleay32.lib new file mode 100644 index 0000000..4247f82 Binary files /dev/null and b/externals/lib/x64_Release/ssleay32.lib differ diff --git a/externals/libmpq/AUTHORS b/externals/libmpq/AUTHORS new file mode 100644 index 0000000..3d7da7b --- /dev/null +++ b/externals/libmpq/AUTHORS @@ -0,0 +1,10 @@ +Project Initiator: + + * Maik Broemme + +Developers: + + * Maik Broemme + * Tilman Sauerbeck + * Forrest Voight + * Georg Lukas diff --git a/externals/libmpq/COPYING b/externals/libmpq/COPYING new file mode 100644 index 0000000..4189933 --- /dev/null +++ b/externals/libmpq/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111 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 + + Appendix: 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) 19yy + + 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., 59 Temple Place, Suite 330, Boston, MA 02111 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) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/externals/libmpq/FAQ b/externals/libmpq/FAQ new file mode 100644 index 0000000..52ca9f3 --- /dev/null +++ b/externals/libmpq/FAQ @@ -0,0 +1,68 @@ +FAQ - Frequently Asked Questions +================================ + +Q: What is libmpq? +A: libmpq is a library for manipulating MoPaQ mpq archives mostly used + used by Blizzard in their games. + +Q: What can i do with libmpq? +A: With libmpq you can write applications which can extract, create + and manipulate mpq archives. + +Q: Is it legal? +A: Yes, i think so. I have no idea why it should not, all informations + about the fileformat are available. + +Q: Is there a description of the functions? +A: Since version 0.4.0 libmpq comes with a API documentation for + developers. The documentation is written as manual pages. + +Q: Can i help? +A: Yes, help is needed, not only with developing, also with testing. + A good point to start is using a recent SVN version of libmpq and + trying to use it with every mpq archive you could get :) + +Q: Can you give a small example to demonstrate the usage? +A: Of course :) The example below takes first parameter as mpq archive + and extracts the first file to a buffer. + + /* + * Compile with: + * + * x86_32: + * + * gcc \ + * -D_FILE_OFFSET_BITS=64 \ + * -D_LARGE_FILES=1 \ + * -D_LARGEFILE_SOURCE=1 \ + * mpq-example.c -o mpq-example -lmpq -lz -lbz2 -I/usr/local/include/libmpq + * + * x86_64: + * + * gcc \ + * -D_LARGE_FILES=1 \ + * mpq-example.c -o mpq-example -lmpq -lz -lbz2 -I/usr/local/include/libmpq + */ + + #include + #include + #include + + int main(int argc, char **argv) { + mpq_archive_s *mpq_archive; + off_t out_size; + char *out_buf; + + /* open the mpq archive given as first parameter. */ + libmpq__archive_open(&mpq_archive, argv[1], -1); + + /* get size of first file (0) and malloc output buffer. */ + libmpq__file_unpacked_size(mpq_archive, 0, &out_size); + out_buf = malloc(out_size); + + /* read, decrypt and unpack file to output buffer. */ + libmpq__file_read(mpq_archive, 0, out_buf, out_size, NULL); + + /* close the mpq archive. */ + libmpq__archive_close(mpq_archive); + } diff --git a/externals/libmpq/INSTALL b/externals/libmpq/INSTALL new file mode 100644 index 0000000..d3c5b40 --- /dev/null +++ b/externals/libmpq/INSTALL @@ -0,0 +1,237 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007 Free Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 6. Often, you can also type `make uninstall' to remove the installed + files again. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/externals/libmpq/Makefile.am b/externals/libmpq/Makefile.am new file mode 100644 index 0000000..0a9b54c --- /dev/null +++ b/externals/libmpq/Makefile.am @@ -0,0 +1,26 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# any directories which should be built and installed. +SUBDIRS = libmpq bindings doc + +# the directories which are part of the distribution. +DIST_SUBDIRS = $(SUBDIRS) + +# libmpq runtime configuration script. +bin_SCRIPTS = libmpq-config + +# pkg-config installation directory. +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libmpq.pc + +# extra stuff. +EXTRA_DIST = \ + AUTHORS \ + COPYING \ + FAQ \ + INSTALL \ + NEWS \ + README \ + THANKS \ + TODO diff --git a/externals/libmpq/NEWS b/externals/libmpq/NEWS new file mode 100644 index 0000000..74850a8 --- /dev/null +++ b/externals/libmpq/NEWS @@ -0,0 +1,76 @@ +Changes version 0.4.2 (2008-05-16) +================================== + + * added full extraction support for protected maps used in + warcraft 3. + + * added full extraction support for all blizzard titles until + world of warcraft - the burning crusade. + + * added support for archives version 2 with extended header and + extended block table. + + * added support for the bzip2 compression algorithm. + + * added support for archives and files inside archive > 2gb. + + * added generic read functions, which will do decryption, + decompression or exploding. + + * the info functions are no longer exported by the library and + were replaced by separate api functions. + + * the file number and block number are count from 0 instead + of 1. + + * added python bindings. + + * linking against libmpq requires from now on the usual largefile + macros -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES=1 -D_LARGEFILE_SOURCE=1 + +Changes version 0.4.1 (2008-04-02) +================================== + + * memory, speed and stability improvements. + + * split sourcecode into library and utility package. + +Changes version 0.4.0 (2008-03-31) +================================== + + * added robust error handling to make the library and extracting + utility more stable. + + * added c++ bindings to public include and moved internal defines + and functions to private include. + + * added support for 64-bit architectures and removed any stupid + pointer to int arithmetics. + + * added much better member names to the structures to make + developers able to understand the code on reading. + + * added full api documentation using manual pages. + + * added full extraction support for all blizzard titles until + warcraft 3 - the frozen throne. + + * added support for single sector and stored files (neither + compressed nor imploded). + + * added support for files which have compressed size greater than + uncompressed size. + + * removed the external listfile database support from 0.3.0 it + was a weird implementation. + +Changes version 0.3.0 (2004-02-12) +================================== + + * added listfile database support from external files. + +Initial version 0.2.1 (2004-01-17) +================================== + + * first version which was able to extract some of the older mopaq + archives. diff --git a/externals/libmpq/README b/externals/libmpq/README new file mode 100644 index 0000000..3f1bd3a --- /dev/null +++ b/externals/libmpq/README @@ -0,0 +1,34 @@ +Introduction +============ + +'libmpq' is a library which can be easily used in own applications +to extract, create or manipulate MoPaQ mpq archives. + +MPQ, or MoPaQ, is a proprietary archive format created by +Mike O'Brien, the man hailed as Blizzard's multiplayer engine +genius, back in 1996 as a general purpose archive for use with +Diablo, and named narcissistically for its creator +"Mike O'brien PaCK". The copyrights to it, however, are held by +Havas Interactive, Blizzard's parent company. The archive format +is used by many Blizzard titles like Diablo, Diablo 2, Starcraft, +Warcraft 2: BNE, a newer version in Warcraft 3 and World of +Warcraft (WoW). + +Manual +====== + +Since version 0.4.0 the 'libmpq' package comes with a manpage for +every library function. If you use 'libmpq' first time it is a good +idea to read the `FAQ' file. + +Reporting Bugs +============== + +Bug reports for 'libmpq' can be send to me directly. + + * Maik Broemme + +Enjoy! + +Maik Broemme +http://www.babelize.org/ diff --git a/externals/libmpq/THANKS b/externals/libmpq/THANKS new file mode 100644 index 0000000..42da123 --- /dev/null +++ b/externals/libmpq/THANKS @@ -0,0 +1,21 @@ +'libmpq' was originaly created by Maik Broemme +and i want to thank some people which helped by supplying knowledge, code or +something else. + + * Romy Trompke + - my lovely girlfriend for her patience + + * Ladislav Zezula + - stormlib creator + + * Marko Friedemann + - initial port of stormlib to linux + + * Tom Amigo + - first people who decrypts the MoPaQ archive format + + * ShadowFlare + - creator of the ShadowFlare MPQ API + + * Justin Olbrantz (Quantam) + - creator of the client using ShadowFlare MPQ API diff --git a/externals/libmpq/TODO b/externals/libmpq/TODO new file mode 100644 index 0000000..0c1951f --- /dev/null +++ b/externals/libmpq/TODO @@ -0,0 +1,10 @@ +Features and functionality which should be added in the future. + + * Porting for big endian systems. + * Porting for Windows? :) + * Creating mpq archives. + * Brute all unknown filenames, Blizzard uses in their + archives. + +Look at the AUTHORS file if you want help me with 'libmpq', or +if you have other interesting features which should be added. diff --git a/externals/libmpq/autogen.sh b/externals/libmpq/autogen.sh new file mode 100755 index 0000000..16871ed --- /dev/null +++ b/externals/libmpq/autogen.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +echo "Generating build information using aclocal, autoheader, automake and autoconf" +echo "This may take a while ..." + +# Touch the timestamps on all the files since CVS messes them up +directory=`dirname $0` +touch $directory/configure.ac + +# Regenerate configuration files +libtoolize --copy +aclocal +autoheader +automake --foreign --add-missing --copy +autoconf + +# Run configure for this platform +#./configure $* +echo "Now you are ready to run ./configure" diff --git a/externals/libmpq/bindings/Makefile.am b/externals/libmpq/bindings/Makefile.am new file mode 100644 index 0000000..b9fefe3 --- /dev/null +++ b/externals/libmpq/bindings/Makefile.am @@ -0,0 +1,6 @@ +# any directories which should be built and installed. +SUBDIRS = d + +if HAVE_PYTHON +SUBDIRS += python +endif diff --git a/externals/libmpq/bindings/d/Makefile.am b/externals/libmpq/bindings/d/Makefile.am new file mode 100644 index 0000000..4de7285 --- /dev/null +++ b/externals/libmpq/bindings/d/Makefile.am @@ -0,0 +1,6 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# install D binding to /usr/include/d by default +libmpq_includedir = $(includedir)/d +libmpq_include_HEADERS = mpq.d diff --git a/externals/libmpq/bindings/d/dsss.conf b/externals/libmpq/bindings/d/dsss.conf new file mode 100644 index 0000000..252482c --- /dev/null +++ b/externals/libmpq/bindings/d/dsss.conf @@ -0,0 +1,2 @@ +[mpq.d] +type=sourcelibrary diff --git a/externals/libmpq/bindings/d/mpq.d b/externals/libmpq/bindings/d/mpq.d new file mode 100644 index 0000000..d72c2d2 --- /dev/null +++ b/externals/libmpq/bindings/d/mpq.d @@ -0,0 +1,318 @@ +/* + * mpq.d -- D programming language module for libmpq + * + * Copyright (c) 2008 Georg Lukas + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * This module is written to support Phobos. Patches to allow binding to + * Tango are welcome. + */ + +module mpq; + +/* the following pragma does not work on DMD/Linux, generates a warning on + * GDC/Linux and has not been tested on Windows. Commented out for now. */ +// pragma(lib, "libmpq"); + +import std.string; // for format() and toStringz() +import std.traits; // for ParameterTypeTuple!() + +/* XXX: this assumes that libmpq is compiled with Large File Support on */ +alias long off_t; + +/* libmpq error return values */ +const LIBMPQ_ERROR_OPEN = -1; /* open error on file. */ +const LIBMPQ_ERROR_CLOSE = -2; /* close error on file. */ +const LIBMPQ_ERROR_SEEK = -3; /* lseek error on file. */ +const LIBMPQ_ERROR_READ = -4; /* read error on file. */ +const LIBMPQ_ERROR_WRITE = -5; /* write error on file. */ +const LIBMPQ_ERROR_MALLOC = -6; /* memory allocation error. */ +const LIBMPQ_ERROR_FORMAT = -7; /* format errror. */ +const LIBMPQ_ERROR_NOT_INITIALIZED = -8; /* init() wasn't called. */ +const LIBMPQ_ERROR_SIZE = -9; /* buffer size is to small. */ +const LIBMPQ_ERROR_EXIST = -10; /* file or block does not exist in archive. */ +const LIBMPQ_ERROR_DECRYPT = -11; /* we don't know the decryption seed. */ +const LIBMPQ_ERROR_UNPACK = -12; /* error on unpacking file. */ + +/** libmpq internal meta-data for an archive */ +extern struct mpq_archive_s; + +extern(C) { + +/* libmpq__generic information about library. */ +char *libmpq__version(); + +/* libmpq__generic mpq archive information. */ +int libmpq__archive_open(mpq_archive_s **mpq_archive, char *mpq_filename, off_t archive_offset); +int libmpq__archive_close(mpq_archive_s *mpq_archive); +int libmpq__archive_packed_size(mpq_archive_s *mpq_archive, off_t *packed_size); +int libmpq__archive_unpacked_size(mpq_archive_s *mpq_archive, off_t *unpacked_size); +int libmpq__archive_offset(mpq_archive_s *mpq_archive, off_t *offset); +int libmpq__archive_version(mpq_archive_s *mpq_archive, uint *version_); +int libmpq__archive_files(mpq_archive_s *mpq_archive, uint *files); + +/* libmpq__generic file processing functions. */ +int libmpq__file_packed_size(mpq_archive_s *mpq_archive, uint file_number, off_t *packed_size); +int libmpq__file_unpacked_size(mpq_archive_s *mpq_archive, uint file_number, off_t *unpacked_size); +int libmpq__file_offset(mpq_archive_s *mpq_archive, uint file_number, off_t *offset); +int libmpq__file_blocks(mpq_archive_s *mpq_archive, uint file_number, uint *blocks); +int libmpq__file_encrypted(mpq_archive_s *mpq_archive, uint file_number, uint *encrypted); +int libmpq__file_compressed(mpq_archive_s *mpq_archive, uint file_number, uint *compressed); +int libmpq__file_imploded(mpq_archive_s *mpq_archive, uint file_number, uint *imploded); +int libmpq__file_number(mpq_archive_s *mpq_archive, char *filename, uint *number); +int libmpq__file_read(mpq_archive_s *mpq_archive, uint file_number, ubyte *out_buf, off_t out_size, off_t *transferred); + +/* libmpq__generic block processing functions. */ +int libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint file_number); +int libmpq__block_close_offset(mpq_archive_s *mpq_archive, uint file_number); +int libmpq__block_unpacked_size(mpq_archive_s *mpq_archive, uint file_number, uint block_number, off_t *unpacked_size); +int libmpq__block_read(mpq_archive_s *mpq_archive, uint file_number, uint block_number, ubyte *out_buf, off_t out_size, off_t *transferred); + +} + + +/** exception class for failed libmpq calls */ +class MPQException : Exception { + const string[] Errors = [ + "unknown error", + "open error on file", + "close error on file", + "lseek error on file", + "read error on file", + "write error on file", + "memory allocation error", + "format errror", + "init() wasn't called", + "buffer size is to small", + "file or block does not exist in archive", + "we don't know the decryption seed", + "error on unpacking file"]; + + public int errno; + this(char[] fnname = "unknown_function", int errno = 0) { + + this.errno = errno; + if (-errno >= Errors.length) + errno = 0; + super(std.string.format("Error in %s(): %s (%d)", + fnname, Errors[-errno], errno)); + } +} + + +/** template to wrap function calls and throw exceptions in case of error + * + * thanks for the idea to while(nan) blog, + * http://while-nan.blogspot.com/2007/06/wrapping-functions-for-fun-and-profit.html + * + * use: MPQ_CHECKERR(libmpq__archive_open)(&m, "foo.mpq", -1); + * returns the retval of archive_open on success; + * throws an MPQException on failure. + * + * @param Fn libmpq__function reference + * @param args libmpq__function parameters + * @return return value of libmpq__function on success + * @throw MPQException on error + */ +int MPQ_CHECKERR(alias Fn)(ParameterTypeTuple!(Fn) args) +{ + int result = Fn(args); + if (result < 0) { + /* XXX: relying on non-specified stringof() behaviour */ + throw new MPQException((&Fn).stringof[2..$], result); + } + return result; +} + + +/** mixin alias to wrap library functions into MPQ_CHECKERR. + * + * alias mpq.func_name(...) to MPQ_CHECKERR(libmpq__func_name)(...) + * @param func_name name of the function to be wrapped + */ +template MPQ_FUNC(char[] func_name) { + const char[] MPQ_FUNC = "alias MPQ_CHECKERR!(libmpq__" ~ func_name ~ ") " ~ func_name ~ ";"; +} + +alias libmpq__version libversion; /* must be direct alias because it returns char*, not error int */ +mixin(MPQ_FUNC!("archive_open")); +mixin(MPQ_FUNC!("archive_close")); +mixin(MPQ_FUNC!("archive_packed_size")); +mixin(MPQ_FUNC!("archive_unpacked_size")); +mixin(MPQ_FUNC!("archive_offset")); +mixin(MPQ_FUNC!("archive_version")); +mixin(MPQ_FUNC!("archive_files")); +mixin(MPQ_FUNC!("file_packed_size")); +mixin(MPQ_FUNC!("file_unpacked_size")); +mixin(MPQ_FUNC!("file_offset")); +mixin(MPQ_FUNC!("file_blocks")); +mixin(MPQ_FUNC!("file_encrypted")); +mixin(MPQ_FUNC!("file_compressed")); +mixin(MPQ_FUNC!("file_imploded")); +mixin(MPQ_FUNC!("file_number")); +mixin(MPQ_FUNC!("file_read")); +mixin(MPQ_FUNC!("block_open_offset")); +mixin(MPQ_FUNC!("block_close_offset")); +mixin(MPQ_FUNC!("block_unpacked_size")); +mixin(MPQ_FUNC!("block_read")); + +/** getter function named name for returning archive_* single values: + * + * Archive.() { return libmpq__archive_() } + * + * @param type return type for the original function reference + * @param name name of the original function + * @param name2 name for the prototype (defaults to name, used for "version") + * @return getter function mixin + */ +template MPQ_A_GET(char[] type, char[] name, char[] name2 = name) { + const char[] MPQ_A_GET = type ~ " " ~ name2 ~ "() { " ~ + type ~ " ret; " ~ + "archive_" ~ name ~ "(m, &ret); return ret;" ~ + "}"; +} + +/** wrapper class for an MPQ Archive + * + * syntax: auto a = new mpq.Archive("somefile.mpq"); + */ +class Archive { + mpq_archive_s *m; + File listfile; + char[][] listfiledata; + + this(char[] archivename, off_t offset = -1) { + archive_open(&m, toStringz(archivename), offset); + } + + mixin(MPQ_A_GET!("off_t", "packed_size")); + mixin(MPQ_A_GET!("off_t", "unpacked_size")); + mixin(MPQ_A_GET!("off_t", "offset")); + mixin(MPQ_A_GET!("uint", "version", "version_")); + mixin(MPQ_A_GET!("uint", "files")); + + ~this() { + archive_close(m); + } + + mpq_archive_s* archive() { + return m; + } + + File opIndex(char[] fname) { + return new File(this, fname); + } + File opIndex(int fno) { + return new File(this, fno); + } + + char[][] filelist() { + try { + if (!listfile) { + listfile = this["(listfile)"]; + listfiledata = (cast(char[])listfile.read()).splitlines(); + } + return listfiledata; + } catch (MPQException e) { + return []; + } + } + + /+uint filenumber(char[] filename) { + try { + if (!listfile) { + listfile = this["(listfile)"]; + listfiledata = (cast(char[])listfile.read()).splitlines(); + } + return listfiledata; + } catch (MPQException e) { + return []; + } + }+/ + +} + + +/** getter function named name for returning file_* single values: + * + * File.() { return libmpq__file_() } + * + * @param type return type for the original function reference + * @param name name of the original function + * @param name2 name for the prototype (defaults to name, used for "version") + * @return getter function mixin + */ +template MPQ_F_GET(char[] type, char[] name, char[] name2 = name) { + const char[] MPQ_F_GET = type ~ " " ~ name2 ~ "() { " ~ + type ~ " ret; " ~ + "file_" ~ name ~ "(am, fileno, &ret); " ~ + "return ret;" ~ + "}"; +} + +/** wrapper class for a single file in an MPQ Archive + * + * syntax: + * auto a = new mpq.Archive("somefile.mpq"); + * auto f = a["(listfile)"]; + * auto f2 = a[0]; + * auto f3 = new File(a, "(listfile)"); + */ +class File { + Archive a; + mpq_archive_s* am; + char[] filename; + uint fileno; + + this(Archive a, int fileno) { + this.a = a; + this.am = a.archive(); + if (fileno >= a.files) { + throw new MPQException(format("File(%d)", fileno), + LIBMPQ_ERROR_EXIST); + } + this.filename = format("file%04d.xxx", fileno); + this.fileno = fileno; + } + + this(Archive a, char[] filename) { + this.a = a; + this.am = a.archive(); + this.filename = filename; + /* this line will throw an exception when the file is not there */ + mpq.file_number(am, toStringz(filename), &this.fileno); + } + + mixin(MPQ_F_GET!("off_t", "packed_size")); + mixin(MPQ_F_GET!("off_t", "unpacked_size")); + mixin(MPQ_F_GET!("off_t", "offset")); + mixin(MPQ_F_GET!("uint", "blocks")); + mixin(MPQ_F_GET!("uint", "encrypted")); + mixin(MPQ_F_GET!("uint", "compressed")); + mixin(MPQ_F_GET!("uint", "imploded")); + + uint no() { return fileno; } + char[] name() { return filename; } + + ubyte[] read() { + ubyte[] content; + content.length = this.unpacked_size(); + off_t trans; + mpq.file_read(am, fileno, content.ptr, content.length, &trans); + content.length = trans; + return content; + } +} diff --git a/externals/libmpq/bindings/python/Makefile.am b/externals/libmpq/bindings/python/Makefile.am new file mode 100644 index 0000000..6971a9b --- /dev/null +++ b/externals/libmpq/bindings/python/Makefile.am @@ -0,0 +1,5 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# library information and headers which should not be installed. +python_PYTHON = mpq.py diff --git a/externals/libmpq/bindings/python/mpq-info b/externals/libmpq/bindings/python/mpq-info new file mode 100755 index 0000000..2c67aa1 --- /dev/null +++ b/externals/libmpq/bindings/python/mpq-info @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +from __future__ import division + +import sys + +import mpq + +archive = mpq.Archive(sys.argv[1]) + +print "Name: %s" % sys.argv[1] +print "Version: %s" % archive.filename +print "Offset: %s" % archive.offset +print "Packed size: %s" % archive.packed_size +print "Unpacked size: %s" % archive.unpacked_size +print "Compression ratio: %s" % (archive.packed_size/archive.unpacked_size) diff --git a/externals/libmpq/bindings/python/mpq.py b/externals/libmpq/bindings/python/mpq.py new file mode 100644 index 0000000..cf6ecaa --- /dev/null +++ b/externals/libmpq/bindings/python/mpq.py @@ -0,0 +1,322 @@ +"""wrapper for libmpq""" + +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +import ctypes +import ctypes.util +import os + +libmpq = ctypes.CDLL(ctypes.util.find_library("mpq")) + +class Error(Exception): + pass + +errors = { + -1: (IOError, "open"), + -2: (IOError, "close"), + -3: (IOError, "seek"), + -4: (IOError, "read"), + -5: (IOError, "write"), + -6: (MemoryError,), + -7: (Error, "file is not an mpq or is corrupted"), + -8: (AssertionError, "not initialized"), + -9: (AssertionError, "buffer size too small"), + -10: (IndexError, "file not in archive"), + -11: (AssertionError, "decrypt"), + -12: (AssertionError, "unpack"), +} + +def check_error(result, func, arguments, errors=errors): + try: + error = errors[result] + except KeyError: + return result + else: + raise error[0](*error[1:]) + +libmpq.libmpq__version.restype = ctypes.c_char_p + +libmpq.libmpq__archive_open.errcheck = check_error +libmpq.libmpq__archive_close.errcheck = check_error +libmpq.libmpq__archive_packed_size.errcheck = check_error +libmpq.libmpq__archive_unpacked_size.errcheck = check_error +libmpq.libmpq__archive_offset.errcheck = check_error +libmpq.libmpq__archive_version.errcheck = check_error +libmpq.libmpq__archive_files.errcheck = check_error + +libmpq.libmpq__file_packed_size.errcheck = check_error +libmpq.libmpq__file_unpacked_size.errcheck = check_error +libmpq.libmpq__file_offset.errcheck = check_error +libmpq.libmpq__file_blocks.errcheck = check_error +libmpq.libmpq__file_encrypted.errcheck = check_error +libmpq.libmpq__file_compressed.errcheck = check_error +libmpq.libmpq__file_imploded.errcheck = check_error +libmpq.libmpq__file_number.errcheck = check_error +libmpq.libmpq__file_read.errcheck = check_error + +libmpq.libmpq__block_open_offset.errcheck = check_error +libmpq.libmpq__block_close_offset.errcheck = check_error +libmpq.libmpq__block_unpacked_size.errcheck = check_error +libmpq.libmpq__block_read.errcheck = check_error + +__version__ = libmpq.libmpq__version() + + +class Reader(object): + def __init__(self, file, libmpq=libmpq): + self._file = file + self._pos = 0 + self._buf = [] + self._cur_block = 0 + libmpq.libmpq__block_open_offset(self._file._archive._mpq, + self._file.number) + + def __iter__(self): + return self + + def __repr__(self): + return "iter(%r)" % self._file + + def seek(self, offset, whence=os.SEEK_SET, os=os): + if whence == os.SEEK_SET: + pass + elif whence == os.SEEK_CUR: + offset += self._pos + elif whence == os.SEEK_END: + offset += self._file.unpacked_size + else: + raise ValueError, "invalid whence" + + if offset >= self._pos: + self.read(offset - self._pos) + else: + self._pos = 0 + self._buf = [] + self._cur_block = 0 + self.read(offset) + + def tell(self): + return self._pos + + def _read_block(self, ctypes=ctypes, libmpq=libmpq): + block_size = ctypes.c_uint64() + libmpq.libmpq__block_unpacked_size(self._file._archive._mpq, + self._file.number, self._cur_block, ctypes.byref(block_size)) + block_data = ctypes.create_string_buffer(block_size.value) + libmpq.libmpq__block_read(self._file._archive._mpq, + self._file.number, self._cur_block, + block_data, ctypes.c_uint64(len(block_data)), None) + self._buf.append(block_data.raw) + self._cur_block += 1 + + def read(self, size=-1): + while size < 0 or sum(map(len, self._buf)) < size: + if self._cur_block == self._file.blocks: + break + self._read_block() + buf = "".join(self._buf) + if size < 0: + ret = buf + self._buf = [] + else: + ret = buf[:size] + self._buf = [buf[size:]] + self._pos += len(ret) + return ret + + def readline(self, os=os): + line = [] + while True: + char = self.read(1) + if char == "": + break + if char not in '\r\n' and line and line[-1] in '\r\n': + self.seek(-1, os.SEEK_CUR) + break + line.append(char) + return ''.join(line) + + def next(self): + line = self.readline() + if not line: + raise StopIteration + return line + + def readlines(self, sizehint=-1): + res = [] + while sizehint < 0 or sum(map(len, res)) < sizehint: + line = self.readline() + if not line: + break + res.append(line) + return res + + xreadlines = __iter__ + + def __del__(self, libmpq=libmpq): + libmpq.libmpq__block_close_offset(self._file._archive._mpq, + self._file.number) + + +class File(object): + def __init__(self, archive, number, ctypes=ctypes, libmpq=libmpq): + self._archive = archive + self.number = number + + for name, atype in [ + ("packed_size", ctypes.c_uint64), + ("unpacked_size", ctypes.c_uint64), + ("offset", ctypes.c_uint64), + ("blocks", ctypes.c_uint32), + ("encrypted", ctypes.c_uint32), + ("compressed", ctypes.c_uint32), + ("imploded", ctypes.c_uint32), + ]: + data = atype() + func = getattr(libmpq, "libmpq__file_"+name) + func(self._archive._mpq, self.number, ctypes.byref(data)) + setattr(self, name, data.value) + + def __str__(self, ctypes=ctypes, libmpq=libmpq): + data = ctypes.create_string_buffer(self.unpacked_size) + libmpq.libmpq__file_read(self._archive._mpq, self.number, + data, ctypes.c_uint64(len(data)), None) + return data.raw + + def __repr__(self): + return "%r[%i]" % (self._archive, self.number) + + def __iter__(self, Reader=Reader): + return Reader(self) + + +class Archive(object): + def __init__(self, source, ctypes=ctypes, File=File, libmpq=libmpq): + self._source = source + if isinstance(source, File): + assert not source.encrypted + assert not source.compressed + assert not source.imploded + self.filename = source._archive.filename + offset = source._archive.offset + source.offset + else: + self.filename = source + offset = -1 + + self._mpq = ctypes.c_void_p() + libmpq.libmpq__archive_open(ctypes.byref(self._mpq), self.filename, + ctypes.c_uint64(offset)) + self._opened = True + + for field_name, field_type in [ + ("packed_size", ctypes.c_uint64), + ("unpacked_size", ctypes.c_uint64), + ("offset", ctypes.c_uint64), + ("version", ctypes.c_uint32), + ("files", ctypes.c_uint32), + ]: + func = getattr(libmpq, "libmpq__archive_" + field_name) + data = field_type() + func(self._mpq, ctypes.byref(data)) + setattr(self, field_name, data.value) + + def __del__(self, libmpq=libmpq): + if getattr(self, "_opened", False): + libmpq.libmpq__archive_close(self._mpq) + + def __len__(self): + return self.files + + def __contains__(self, item, ctypes=ctypes, libmpq=libmpq): + if isinstance(item, str): + data = ctypes.c_uint32() + try: + libmpq.libmpq__file_number(self._mpq, ctypes.c_char_p(item), + ctypes.byref(data)) + except IndexError: + return False + return True + return 0 <= item < self.files + + def __getitem__(self, item, ctypes=ctypes, File=File, libmpq=libmpq): + if isinstance(item, str): + data = ctypes.c_int() + libmpq.libmpq__file_number(self._mpq, ctypes.c_char_p(item), + ctypes.byref(data)) + item = data.value + else: + if not 0 <= item < self.files: + raise IndexError, "file not in archive" + return File(self, item) + + def __repr__(self): + return "mpq.Archive(%r)" % self._source + +# Remove clutter - everything except Error and Archive. +del os, check_error, ctypes, errors, File, libmpq, Reader + +if __name__ == "__main__": + import sys, random + archive = Archive(sys.argv[1]) + print repr(archive) + for k, v in archive.__dict__.iteritems(): + #if k[0] == '_': continue + print " " * (4 - 1), k, v + assert '(listfile)' in archive + assert 0 in archive + assert len(archive) == archive.files + files = [x.strip() for x in archive['(listfile)']] + files.extend(xrange(archive.files)) + for key in files: #sys.argv[2:] if sys.argv[2:] else xrange(archive.files): + file = archive[key] + print + print " " * (4 - 1), repr(file) + for k, v in file.__dict__.iteritems(): + #if k[0] == '_': continue + print " " * (8 - 1), k, v + + a = str(file) + + b = iter(file).read() + + reader = iter(file) + c = [] + while True: + l = random.randrange(1, 10) + d = reader.read(l) + if not d: break + assert len(d) <= l + c.append(d) + c = "".join(c) + + d = [] + reader.seek(0) + for line in reader: + d.append(line) + d = "".join(d) + + assert a == b == c == d, map(hash, [a,b,c,d]) + assert len(a) == file.unpacked_size + + repr(iter(file)) + + + reader.seek(0) + a = reader.readlines() + + reader.seek(0) + b = list(reader) + + assert a == b diff --git a/externals/libmpq/config.h b/externals/libmpq/config.h new file mode 100644 index 0000000..4026183 --- /dev/null +++ b/externals/libmpq/config.h @@ -0,0 +1,74 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +#define HAVE_LIBBZ2 1 + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Name of package */ +#define PACKAGE "libmpq" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "mbroemme@plusserver.de" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libmpq" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libmpq 0.4.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libmpq" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.4.2" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.4.2" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ diff --git a/externals/libmpq/configure.ac b/externals/libmpq/configure.ac new file mode 100644 index 0000000..d274eab --- /dev/null +++ b/externals/libmpq/configure.ac @@ -0,0 +1,84 @@ +# the autoconf initilization. +AC_INIT(libmpq, 0.4.2, [mbroemme@plusserver.de], [libmpq]) + +# detect the canonical host and target build environment. +AC_CANONICAL_SYSTEM + +# initialize autoconf and automake system. +AM_INIT_AUTOMAKE([no-dependencies]) +AC_CONFIG_HEADERS([config.h:config.h.in]) + +# notices. +AC_PREREQ(2.53) +AC_REVISION($Revision: 1.6 $) + +# checking for programs. +AC_PROG_LIBTOOL +AC_PROG_MAKE_SET +AC_PROG_CC +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO + +# check if we need to export some largefile flags. +if test "$enable_largefile" != no; then + if test "$ac_cv_sys_file_offset_bits" != 'no'; then + if test -z "$LFS_CFLAGS" ; then + LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" + else + LFS_CFLAGS="$LFS_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" + fi + fi + if test "$ac_cv_sys_large_files" != 'no'; then + if test -z "$LFS_CFLAGS" ; then + LFS_CFLAGS="-D_LARGE_FILES=1" + else + LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES=1" + fi + fi + if test "$ac_cv_sys_largefile_source" != 'no'; then + if test -z "$LFS_CFLAGS" ; then + LFS_CFLAGS="-D_LARGEFILE_SOURCE=1" + else + LFS_CFLAGS="$LFS_CFLAGS -D_LARGEFILE_SOURCE=1" + fi + fi +fi + +# export largefile flags. +AC_SUBST(LFS_CFLAGS) + +# check for zlib library. +AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([*** zlib.h is required, install zlib header files])]) +AC_CHECK_LIB([z], [inflateEnd], [], [AC_MSG_ERROR([*** inflateEnd is required, install zlib library files])]) + +# check for bzlib2 library. +AC_CHECK_HEADER([bzlib.h], [], [AC_MSG_ERROR([*** bzlib.h is required, install bzip2 header files])]) +AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [], [AC_MSG_ERROR([*** BZ2_bzDecompressInit is required, install bzip2 library files])]) + +# When we're running gcc 4 or greater, compile with -fvisibility=hidden. +AC_TRY_COMPILE([ +#if !defined(__GNUC__) || (__GNUC__ < 4) +#error not gcc4 +#endif +], [], [CFLAGS="$CFLAGS -fvisibility=hidden"]) + +# find python for binding +AM_PATH_PYTHON([2.4],,[:]) +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) + +# configuration files. +AC_CONFIG_FILES([libmpq.pc]) +AC_CONFIG_FILES([libmpq-config],[chmod +x libmpq-config]) + +# creating files. +AC_OUTPUT([ +Makefile +libmpq/Makefile +bindings/Makefile +bindings/d/Makefile +bindings/python/Makefile +doc/Makefile +doc/man1/Makefile +doc/man3/Makefile +tools/Makefile +]) diff --git a/externals/libmpq/debian/changelog b/externals/libmpq/debian/changelog new file mode 100644 index 0000000..55d2d91 --- /dev/null +++ b/externals/libmpq/debian/changelog @@ -0,0 +1,35 @@ +libmpq (0.4.2-svn288-1) unstable; urgency=low + + [ babyface ] + * Due to the nature of MPQ archives which can have valid block entries + * removed function libmpq__init() and libmpq__shutdown(), because they + are no longer required and libmpq__file_name(), because it is up to + the application to provide listfile support + * updated documentation to latest API changes + * removed API documentation for removed function prototypes + * removed no longer required files from target + + [ forrestv ] + * mpq.py fix + * spelling - huffmann to huffman + * changed pkware/pkzip to pkzip and used constants instead of numbers + in extract.c + * sanified huffman decoder a bit + * cleanup + update of mpq.py + * Added support for library finding on platforms besides Linux. + * python bindings - sequence methods on Archive, example code + + [ georg ] + * libmpq: file number search now continued over hashtable end + * debian debug package + + -- Georg Lukas Fri, 22 May 2009 22:38:26 +0200 + +libmpq (0.4.2-svn270-1) unstable; urgency=low + + * First debian package + * compatible to new libmpq API (post 0.4.2) + * contains preliminary python-mpq package + + -- Georg Lukas Tue, 07 Oct 2008 14:38:58 +0200 + diff --git a/externals/libmpq/debian/compat b/externals/libmpq/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/externals/libmpq/debian/compat @@ -0,0 +1 @@ +7 diff --git a/externals/libmpq/debian/control b/externals/libmpq/debian/control new file mode 100644 index 0000000..f35bb06 --- /dev/null +++ b/externals/libmpq/debian/control @@ -0,0 +1,50 @@ +Source: libmpq +Priority: extra +Maintainer: Georg Lukas +Build-Depends: debhelper (>= 7), autotools-dev, libbz2-dev +Standards-Version: 3.7.3 +Section: libs +Homepage: https://libmpq.org/ + +Package: libmpq-dev +Section: libdevel +Architecture: any +Depends: libmpq0 (= ${binary:Version}) +Description: Headers for libmpq, a library for MoPaQ mpq archives + libmpq is a library for extracting and manipulating MoPaQ mpq archives. + This package provides header files and bindings for applications using + the libmpq library for the following languages: + * C + * Python + * D + +Package: libmpq0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: A library for extracting and manipulating MoPaQ mpq archives + MPQ, or MoPaQ, is a proprietary archive format created by + Mike O'Brien, the man hailed as Blizzard's multiplayer engine + genius, back in 1996 as a general purpose archive for use with + Diablo, and named narcissistically for its creator + "Mike O'brien PaCK". The copyrights to it, however, are held by + Havas Interactive, Blizzard's parent company. The archive format + is used by many Blizzard titles like Diablo, Diablo 2, Starcraft, + Warcraft 2: BNE, a newer version in Warcraft 3 and World of + Warcraft (WoW). + +Package: libmpq0-dbg +Section: libdevel +Architecture: any +Depends: libmpq0 (= ${binary:Version}) +Description: Debug symbols for libmpq0 library package + +Package: python-mpq +Architecture: all +Depends: ${python:Depends} +XB-Python-Version: ${python:Versions} +XS-Python-Version: current +Description: Python bindings for libmpq, a library for MoPaQ mpq archives + libmpq is a library for extracting and manipulating MoPaQ mpq archives. + This package provides the python bindings for libmpq. + diff --git a/externals/libmpq/debian/copyright b/externals/libmpq/debian/copyright new file mode 100644 index 0000000..f014cf1 --- /dev/null +++ b/externals/libmpq/debian/copyright @@ -0,0 +1,23 @@ +This package was debianized by Georg Lukas on +Fri, 04 Jul 2008 18:17:08 +0200. + +It was downloaded from + +Upstream Author: + + Maik Broemme + +Copyright: + + Copyright (C) 2008 Maik Broemme + +License: + + 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. + + +The Debian packaging is (C) 2008, Georg Lukas and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. diff --git a/externals/libmpq/debian/libmpq-dev.dirs b/externals/libmpq/debian/libmpq-dev.dirs new file mode 100644 index 0000000..7b6c7ee --- /dev/null +++ b/externals/libmpq/debian/libmpq-dev.dirs @@ -0,0 +1,6 @@ +usr/bin +usr/lib +usr/lib/pkgconfig +usr/include +usr/share/man/man1 +usr/share/man/man3 diff --git a/externals/libmpq/debian/libmpq-dev.install b/externals/libmpq/debian/libmpq-dev.install new file mode 100644 index 0000000..4e6ab32 --- /dev/null +++ b/externals/libmpq/debian/libmpq-dev.install @@ -0,0 +1,6 @@ +usr/bin/* +usr/include/* +usr/lib/lib*.a +usr/lib/pkgconfig/* +usr/lib/*.la +usr/share/man/man?/* diff --git a/externals/libmpq/debian/libmpq0.dirs b/externals/libmpq/debian/libmpq0.dirs new file mode 100644 index 0000000..6845771 --- /dev/null +++ b/externals/libmpq/debian/libmpq0.dirs @@ -0,0 +1 @@ +usr/lib diff --git a/externals/libmpq/debian/libmpq0.docs b/externals/libmpq/debian/libmpq0.docs new file mode 100644 index 0000000..5ac7060 --- /dev/null +++ b/externals/libmpq/debian/libmpq0.docs @@ -0,0 +1,6 @@ +FAQ +NEWS +README +TODO +THANKS +AUTHORS diff --git a/externals/libmpq/debian/libmpq0.install b/externals/libmpq/debian/libmpq0.install new file mode 100644 index 0000000..8aa4466 --- /dev/null +++ b/externals/libmpq/debian/libmpq0.install @@ -0,0 +1 @@ +usr/lib/lib*.so* diff --git a/externals/libmpq/debian/python-mpq.install b/externals/libmpq/debian/python-mpq.install new file mode 100644 index 0000000..a7aba20 --- /dev/null +++ b/externals/libmpq/debian/python-mpq.install @@ -0,0 +1 @@ +usr/lib/python?.? diff --git a/externals/libmpq/debian/rules b/externals/libmpq/debian/rules new file mode 100755 index 0000000..5d11fe0 --- /dev/null +++ b/externals/libmpq/debian/rules @@ -0,0 +1,112 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) +CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +else +CROSS= --build $(DEB_BUILD_GNU_TYPE) +endif + + + + +# shared library versions, option 1 +version=2.0.5 +major=2 +# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so +#version=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` +#major=`ls src/.libs/lib*.so.* | \ +# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` + +config.status: configure + dh_testdir + # Add here commands to configure the package. +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" + + +build: build-stamp +build-stamp: config.status + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + [ ! -f Makefile ] || $(MAKE) distclean + rm -f config.sub config.guess + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + +# Build architecture-independent files here. +binary-indep: build install + dh_pysupport usr/lib/python?.?/site-packages + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip --dbg-package=libmpq0-dbg + dh_compress + dh_fixperms +# dh_perl + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/externals/libmpq/doc/Makefile.am b/externals/libmpq/doc/Makefile.am new file mode 100644 index 0000000..e7ccd5f --- /dev/null +++ b/externals/libmpq/doc/Makefile.am @@ -0,0 +1,5 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# any directories which should be built and installed. +SUBDIRS = man1 man3 diff --git a/externals/libmpq/doc/man1/Makefile.am b/externals/libmpq/doc/man1/Makefile.am new file mode 100644 index 0000000..055f1aa --- /dev/null +++ b/externals/libmpq/doc/man1/Makefile.am @@ -0,0 +1,9 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# manual page directory. +EXTRA_DIST = $(man_MANS) + +# manual pages for the installed binaries. +man_MANS = \ + libmpq-config.1 diff --git a/externals/libmpq/doc/man1/libmpq-config.1 b/externals/libmpq/doc/man1/libmpq-config.1 new file mode 100644 index 0000000..c025f5c --- /dev/null +++ b/externals/libmpq/doc/man1/libmpq-config.1 @@ -0,0 +1,69 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 1 2008-02-10 "The MoPaQ archive library" +.SH NAME +libmpq-config \- script to get information about the installed version of libmpq. +.SH SYNOPSIS +.B libmpq-config +[\-\-prefix\fI[=DIR]\fP] [\-\-exec\-prefix\fI[=DIR]\fP] [\-\-version] +.br +[\-\-cflags] [\-\-libs] [\-\-static\-libs] +.SH DESCRIPTION +.PP +\fIlibmpq-config\fP is a tool that is used to determine the compiler and linker flags that should be used to compile and link programs that use \fIlibmpq\fP. Finally, it's also used internally by the .m4 macros for GNU autoconf that are included with \fIlibmpq\fP. +.SH OPTIONS +\fIlibmpq-config\fP accepts the following options: +.TP 8 +.B \-\-version +.ti 15 +Print the currently installed version of \fIlibmpq\fP on the standard output. +.TP 8 +.B \-\-libs +.ti 15 +Print the linker flags that are necessary to link \fIlibmpq\fP to a program. +.TP 8 +.B \-\-static\-libs +.ti 15 +Print the linker flags that are necessary to statically link \fIlibmpq\fP to a program. +.TP 8 +.B \-\-cflags +.ti 15 +Print the compiler flags that are necessary to compile a program that use \fIlibmpq\fP. +.TP 8 +.B \-\-prefix=PREFIX +.ti 15 +If specified, use PREFIX instead of the installation prefix that \fIlibmpq\fP was built with when computing the output for the \-\-cflags and \-\-libs options. This option is also used for the exec prefix if \-\-exec\-prefix was not specified. This option must be specified before any \-\-libs or \-\-cflags options. +.TP 8 +.B \-\-exec\-prefix=PREFIX +.ti 15 +If specified, use PREFIX instead of the installation exec prefix that \fIlibmpq\fP was built with when computing the output for the \-\-cflags and \-\-libs options. This option must be specified before any \-\-libs or \-\-cflags options. +.SH NOTE +Instead of using this configuration script you should better use the pkg-config version because this would be more platform independent and makes the usage within GNU autoconf much easier. +.SH SEE ALSO +\fBlibmpq\fR(3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/Makefile.am b/externals/libmpq/doc/man3/Makefile.am new file mode 100644 index 0000000..80bff4e --- /dev/null +++ b/externals/libmpq/doc/man3/Makefile.am @@ -0,0 +1,30 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# manual page directory. +EXTRA_DIST = $(man_MANS) + +# manual pages for the installed binaries. +man_MANS = \ + libmpq.3 \ + libmpq__archive_close.3 \ + libmpq__archive_files.3 \ + libmpq__archive_offset.3 \ + libmpq__archive_open.3 \ + libmpq__archive_packed_size.3 \ + libmpq__archive_unpacked_size.3 \ + libmpq__archive_version.3 \ + libmpq__block_close_offset.3 \ + libmpq__block_open_offset.3 \ + libmpq__block_read.3 \ + libmpq__block_unpacked_size.3 \ + libmpq__file_blocks.3 \ + libmpq__file_compressed.3 \ + libmpq__file_encrypted.3 \ + libmpq__file_imploded.3 \ + libmpq__file_number.3 \ + libmpq__file_offset.3 \ + libmpq__file_packed_size.3 \ + libmpq__file_read.3 \ + libmpq__file_unpacked_size.3 \ + libmpq__version.3 diff --git a/externals/libmpq/doc/man3/libmpq.3 b/externals/libmpq/doc/man3/libmpq.3 new file mode 100644 index 0000000..349451f --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq.3 @@ -0,0 +1,204 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-04-29 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "const char *libmpq__version();" +.sp +.BI "int32_t libmpq__archive_open(" +.BI " mpq_archive_s **" "mpq_archive", +.BI " const char *" "mpq_filename", +.BI " off_t " "archive_offset" +.BI ");" +.sp +.BI "int32_t libmpq__archive_close(" +.BI " mpq_archive_s *" "mpq_archive" +.BI ");" +.sp +.BI "int32_t libmpq__archive_packed_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " off_t *" "packed_size" +.BI ");" +.sp +.BI "int32_t libmpq__archive_unpacked_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " off_t *" "unpacked_size" +.BI ");" +.sp +.BI "int32_t libmpq__archive_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " off_t *" "offset" +.BI ");" +.sp +.BI "int32_t libmpq__archive_version(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t *" "version" +.BI ");" +.sp +.BI "int32_t libmpq__archive_files(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t *" "files" +.BI ");" +.sp +.BI "int32_t libmpq__file_packed_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "packed_size" +.BI ");" +.sp +.BI "int32_t libmpq__file_unpacked_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "unpacked_size" +.BI ");" +.sp +.BI "int32_t libmpq__file_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "offset" +.BI ");" +.sp +.BI "int32_t libmpq__file_blocks(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "blocks" +.BI ");" +.sp +.BI "int32_t libmpq__file_encrypted(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "encrypted" +.BI ");" +.sp +.BI "int32_t libmpq__file_compressed(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "compressed" +.BI ");" +.sp +.BI "int32_t libmpq__file_imploded(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "imploded" +.BI ");" +.sp +.BI "int32_t libmpq__file_number(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " const char *" "filename", +.BI " uint32_t *" "number" +.BI ");" +.sp +.BI "int32_t libmpq__file_read(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint8_t *" "out_buf", +.BI " off_t " "out_size", +.BI " off_t *" "transferred" +.BI ");" +.sp +.BI "int32_t libmpq__block_open_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number" +.BI ");" +.sp +.BI "int32_t libmpq__block_close_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number" +.BI ");" +.sp +.BI "int32_t libmpq__block_packed_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t " "block_number", +.BI " off_t *" "packed_size" +.BI ");" +.sp +.BI "int32_t libmpq__block_unpacked_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t " "block_number", +.BI " off_t *" "unpacked_size" +.BI ");" +.sp +.BI "int32_t libmpq__block_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t " "block_number", +.BI " off_t *" "offset" +.BI ");" +.sp +.BI "int32_t libmpq__block_seed(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t " "block_number", +.BI " uint32_t *" "seed" +.BI ");" +.sp +.BI "int32_t libmpq__block_read(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t " "block_number", +.BI " uint8_t *" "out_buf", +.BI " off_t " "out_size", +.BI " off_t *" "transferred" +.BI ");" +.fi +.SH DESCRIPTION +.PP +The \fIlibmpq\fP library supports decrypting, decompressing, exploding and various manipulations of the MoPaQ archive files. It uses \fIzlib(3)\fP and \fIbzip2(1)\fP compression library. At this moment \fIlibmpq\fP is not able to create MoPaQ archives, this limitation will be removed in a future version. +.SH SEE ALSO +.BR libmpq__version (3), +.BR libmpq__archive_open (3), +.BR libmpq__archive_close (3), +.BR libmpq__archive_packed_size (3), +.BR libmpq__archive_unpacked_size (3), +.BR libmpq__archive_offset (3), +.BR libmpq__archive_version (3), +.BR libmpq__archive_files (3), +.BR libmpq__file_packed_size (3), +.BR libmpq__file_unpacked_size (3), +.BR libmpq__file_offset (3), +.BR libmpq__file_blocks (3), +.BR libmpq__file_encrypted (3), +.BR libmpq__file_compressed (3), +.BR libmpq__file_imploded (3), +.BR libmpq__file_number (3), +.BR libmpq__file_read (3), +.BR libmpq__block_open_offset (3), +.BR libmpq__block_close_offset (3), +.BR libmpq__block_packed_size (3), +.BR libmpq__block_unpacked_size (3), +.BR libmpq__block_offset (3), +.BR libmpq__block_seed (3), +.BR libmpq__block_read (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__archive_close.3 b/externals/libmpq/doc/man3/libmpq__archive_close.3 new file mode 100644 index 0000000..dfc652a --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__archive_close.3 @@ -0,0 +1,57 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-04-29 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__archive_close(" +.BI " mpq_archive_s *" "mpq_archive" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__archive_close\fP() to close a mpq archive which was opened by \fBlibmpq__archive_open\fP(). The function frees the archive structure itself and the contents of it. +.LP +The \fBlibmpq__archive_close\fP() function one takes one argument of the archive structure \fImpq_archive\fP which has to be set by \fBlibmpq__archive_open\fP. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_CLOSE +The given file could not be closed. +.SH SEE ALSO +.BR libmpq__archive_open (3), +.BR libmpq__archive_packed_size (3), +.BR libmpq__archive_unpacked_size (3), +.BR libmpq__archive_offset (3), +.BR libmpq__archive_version (3), +.BR libmpq__archive_files (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__archive_files.3 b/externals/libmpq/doc/man3/libmpq__archive_files.3 new file mode 100644 index 0000000..6663b99 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__archive_files.3 @@ -0,0 +1,50 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-14 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__archive_files(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t *" "files" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__archive_files\fP() to get the number of files inside the archive. It will count only valid files and skip files which have deleted or freed hash entries. +.LP +The \fBlibmpq__archive_files\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the number of \fIfiles\fP in the archive. +.SH RETURN VALUE +On success, a zero is returned. +.SH SEE ALSO +.BR libmpq__file_blocks (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__archive_offset.3 b/externals/libmpq/doc/man3/libmpq__archive_offset.3 new file mode 100644 index 0000000..696ac5e --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__archive_offset.3 @@ -0,0 +1,51 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-14 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__archive_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " off_t *" "offset" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__archive_offset\fP() to get the offset of the archive, which is the absolute position in the file. It also supports archives within archives. +.LP +The \fBlibmpq__archive_offset\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the archive starting position \fIoffset\fP in file. +.SH RETURN VALUE +On success, a zero is returned. +.SH SEE ALSO +.BR libmpq__file_offset (3), +.BR libmpq__block_offset (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__archive_open.3 b/externals/libmpq/doc/man3/libmpq__archive_open.3 new file mode 100644 index 0000000..02c021f --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__archive_open.3 @@ -0,0 +1,71 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-04-29 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__archive_open(" +.BI " mpq_archive_s **" "mpq_archive", +.BI " const char *" "mpq_filename", +.BI " off_t " "archive_offset" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__archive_open\fP() to open a given mpq archive for later use to extract or manipulate files inside the archive. It will create all required file structures and you have to call \fBlibmpq__archive_close\fP() on success to clean the opened structures. On failure there is no need to call \fBlibmpq__archive_close\fP() because everything will be cleaned up. +.LP +The \fBlibmpq__archive_open\fP() function takes as first argument a reference to the archive structure \fImpq_archive\fP and will open the file \fImpq_filename\fP to the structure pointed to by \fImpq_archive\fP. The last argument, \fIarchive_offset\fP is normally -1, but can be specified when the archive offset is known, or not 512-byte aligned. +.SH RETURN VALUE +On success, *\fImpq_archive\fP is set to a new \fBmpq_archive_s\fP* and zero is returned, and on error one of the following constants is returned. +.TP +.B LIBMPQ_ERROR_OPEN +The given file could not be opened. +.TP +.B LIBMPQ_ERROR_MALLOC +Not enough memory for creating required structures. +.TP +.B LIBMPQ_ERROR_SEEK +Seeking in file failed. +.TP +.B LIBMPQ_ERROR_FORMAT +The given file is no valid mpq archive. +.TP +.B LIBMPQ_ERROR_READ +Reading in archive failed. +.SH SEE ALSO +.BR libmpq__archive_close (3), +.BR libmpq__archive_packed_size (3), +.BR libmpq__archive_unpacked_size (3), +.BR libmpq__archive_offset (3), +.BR libmpq__archive_version (3), +.BR libmpq__archive_files (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__archive_packed_size.3 b/externals/libmpq/doc/man3/libmpq__archive_packed_size.3 new file mode 100644 index 0000000..6c3061f --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__archive_packed_size.3 @@ -0,0 +1,51 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-04-29 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__archive_packed_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " off_t *" "packed_size" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__archive_packed_size\fP() to get the packed size of all files in the archive. It will count compressed and imploded files as well as stored only. +.LP +The \fBlibmpq__archive_packed_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the compressed, imploded or stored size \fIpacked_size\fP of file. +.SH RETURN VALUE +On success, a zero is returned. +.SH SEE ALSO +.BR libmpq__file_packed_size (3), +.BR libmpq__block_packed_size (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__archive_unpacked_size.3 b/externals/libmpq/doc/man3/libmpq__archive_unpacked_size.3 new file mode 100644 index 0000000..d2ba923 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__archive_unpacked_size.3 @@ -0,0 +1,51 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-04-29 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__archive_unpacked_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " off_t *" "unpacked_size" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__archive_unpacked_size\fP() to get the unpacked size of all files in the archive. It will count uncompressed and exploded files as well as stored only. +.LP +The \fBlibmpq__archive_unpacked_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of file. +.SH RETURN VALUE +On success, a zero is returned. +.SH SEE ALSO +.BR libmpq__file_unpacked_size (3), +.BR libmpq__block_unpacked_size (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__archive_version.3 b/externals/libmpq/doc/man3/libmpq__archive_version.3 new file mode 100644 index 0000000..1764046 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__archive_version.3 @@ -0,0 +1,48 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-14 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__archive_version(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t *" "version" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__archive_version\fP() to get the archive version. Currently there exist two known versions, version 1 which supports archives until 2GB total size and version 2 which supports archives above 2GB total size and both are supported. +.LP +The \fBlibmpq__archive_version\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument is a reference to the \fIversion\fP of archive. +.SH RETURN VALUE +On success, a zero is returned. +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__block_close_offset.3 b/externals/libmpq/doc/man3/libmpq__block_close_offset.3 new file mode 100644 index 0000000..1ec0c06 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__block_close_offset.3 @@ -0,0 +1,53 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__block_close_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__block_close_offset\fP() to close the block offset table for the given file. It will close the block offset table regardless of compression (compressed, imploded or stored) type of file. +.LP +The \fBlibmpq__block_close_offset\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file to close. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File or block does not exist in archive. +.SH SEE ALSO +.BR libmpq__block_open_offset (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__block_open_offset.3 b/externals/libmpq/doc/man3/libmpq__block_open_offset.3 new file mode 100644 index 0000000..a60b133 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__block_open_offset.3 @@ -0,0 +1,65 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__block_open_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__block_open_offset\fP() to open the block offset table for the given file. It will open the block offset table regardless of compression (compressed, imploded or stored) type of file. +.LP +The \fBlibmpq__block_open_offset\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file to open. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File or block does not exist in archive. +.TP +.B LIBMPQ_ERROR_SEEK +Seeking in file failed. +.TP +.B LIBMPQ_ERROR_MALLOC +Not enough memory for creating required structures. +.TP +.B LIBMPQ_ERROR_READ +Reading in archive failed. +.TP +.B LIBMPQ_ERROR_DECRYPT +Decrypting block failed. +.SH SEE ALSO +.BR libmpq__block_close_offset (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__block_read.3 b/externals/libmpq/doc/man3/libmpq__block_read.3 new file mode 100644 index 0000000..3272c64 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__block_read.3 @@ -0,0 +1,78 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__block_read(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t " "block_number, +.BI " uint8_t *" "out_buf", +.BI " off_t " "out_size", +.BI " off_t " "transferred" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__block_read\fP() to read a given block into memory. If the block is encrypted it will be first decrypted and then if it is packed (compressed or imploded) it will be unpacked. +.LP +The \fBlibmpq__block_read\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file, the third argument \fIblock_number\fP is the number of block. The fourth argument \fIout_buf\fP is the output data buffer which contains the extracted data and the fifth argument \fIout_size\fP is the size of \fIout_buf\fP. The sixth argument is a reference to the \fItransferred\fP bytes of the file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +Block does not exist in archive. +.TP +.B LIBMPQ_ERROR_OPEN +Block offset table was not opened by calling \fBlibmpq__block_open_offset\fP(), or it was closed by an \fBlibmpq__block_close_offset\fP() call. +.TP +.B LIBMPQ_ERROR_SIZE +The output buffer is to small. +.TP +.B LIBMPQ_ERROR_SEEK +Seeking in file failed. +.TP +.B LIBMPQ_ERROR_MALLOC +Not enough memory for creating required structures. +.TP +.B LIBMPQ_ERROR_READ +Reading in archive failed. +.TP +.B LIBMPQ_ERROR_DECRYPT +Decrypting block failed. +.TP +.B LIBMPQ_ERROR_UNPACK +Unpacking block failed. +.SH SEE ALSO +.BR libmpq__file_read (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__block_unpacked_size.3 b/externals/libmpq/doc/man3/libmpq__block_unpacked_size.3 new file mode 100644 index 0000000..a21ca48 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__block_unpacked_size.3 @@ -0,0 +1,59 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__block_unpacked_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t " "block_number", +.BI " off_t *" "unpacked_size" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__block_unpacked_size\fP() to get the unpacked size of a given block in the file. It will return a valid size for compressed and imploded blocks as well as stored only. +.LP +The \fBlibmpq__block_unpacked_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file, the third argument \fIblock_number\fP is the number of block and the fourth argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of block. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File or block does not exist in archive. +.TP +.B LIBMPQ_ERROR_OPEN +Block offset table was not opened by calling \fBlibmpq__block_open_offset\fP(), or it was closed by an \fBlibmpq__block_close_offset\fP() call. +.SH SEE ALSO +.BR libmpq__archive_unpacked_size (3), +.BR libmpq__file_unpacked_size (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_blocks.3 b/externals/libmpq/doc/man3/libmpq__file_blocks.3 new file mode 100644 index 0000000..85baeff --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_blocks.3 @@ -0,0 +1,54 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_blocks(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t *" "blocks" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_blocks\fP() to get the number of blocks for a given file. It will count all blocks for files stored in multiple sectors or count one for files stored in single sector. +.LP +The \fBlibmpq__file_blocks\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the number of \fIblocks\fP of the file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH SEE ALSO +.BR libmpq__archive_files (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_compressed.3 b/externals/libmpq/doc/man3/libmpq__file_compressed.3 new file mode 100644 index 0000000..24b44f0 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_compressed.3 @@ -0,0 +1,54 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_compressed(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t *" "compressed" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_compressed\fP() to get the compression status of the given file. It will return true for compressed files and false otherwise. +.LP +The \fBlibmpq__file_compressed\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the compression status \fIcompressed\fP of the file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH SEE ALSO +.BR libmpq__archive_files (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_encrypted.3 b/externals/libmpq/doc/man3/libmpq__file_encrypted.3 new file mode 100644 index 0000000..798f401 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_encrypted.3 @@ -0,0 +1,54 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_encrypted(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t *" "encrypted" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_encrypted\fP() to get the encryption status of the given file. It will return true for encrypted files and false otherwise. +.LP +The \fBlibmpq__file_encrypted\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the encryption status \fIencrypted\fP of the file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH SEE ALSO +.BR libmpq__archive_files (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_imploded.3 b/externals/libmpq/doc/man3/libmpq__file_imploded.3 new file mode 100644 index 0000000..9adce38 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_imploded.3 @@ -0,0 +1,54 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_imploded(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint32_t *" "imploded" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_imploded\fP() to get the implosion status of the given file. It will return true for imploded files and false otherwise. +.LP +The \fBlibmpq__file_imploded\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the implosion status \fIimploded\fP of the file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH SEE ALSO +.BR libmpq__archive_files (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_number.3 b/externals/libmpq/doc/man3/libmpq__file_number.3 new file mode 100644 index 0000000..8d7a477 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_number.3 @@ -0,0 +1,52 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_number(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " const char *" "filename", +.BI " uint32_t *" "number" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_number\fP() to get the number of a given file in the archive. This function will return a file number regardless of a known or opened listfile. +.LP +The \fBlibmpq__file_number\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfilename\fP is the name of the file and the third argument is a reference to the \fInumber\fP of the file. +.SH RETURN VALUE +On success, the number of the file is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_offset.3 b/externals/libmpq/doc/man3/libmpq__file_offset.3 new file mode 100644 index 0000000..392a66d --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_offset.3 @@ -0,0 +1,55 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-15 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_offset(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "offset" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_offset\fP() to get the offset of the file, which is the absolute position in the archive. It also supports archives within archives. +.LP +The \fBlibmpq__file_offset\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the file starting position \fIoffset\fP in archive. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH SEE ALSO +.BR libmpq__archive_offset (3), +.BR libmpq__block_offset (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_packed_size.3 b/externals/libmpq/doc/man3/libmpq__file_packed_size.3 new file mode 100644 index 0000000..b584ddf --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_packed_size.3 @@ -0,0 +1,55 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-15 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_packed_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "packed_size" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_packed_size\fP() to get the packed size of a given file in the archive. It will return a valid size for compressed and imploded files as well as stored only. +.LP +The \fBlibmpq__file_packed_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the compressed, imploded or stored size \fIpacked_size\fP of file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH SEE ALSO +.BR libmpq__archive_packed_size (3), +.BR libmpq__block_packed_size (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_read.3 b/externals/libmpq/doc/man3/libmpq__file_read.3 new file mode 100644 index 0000000..cbfafbd --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_read.3 @@ -0,0 +1,77 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-16 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_read(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " uint8_t *" "out_buf", +.BI " off_t " "out_size", +.BI " off_t *" "transferred" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_read\fP() to read a given file into memory. If the file is encrypted it will be first decrypted and then if it is packed (compressed or imploded) it will be unpacked. +.LP +The \fBlibmpq__file_read\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the file to extract, the third argument \fIout_buf\fP is the output data buffer which contains the extracted data. The fourth argument \fIout_size\fP is the size of \fIout_buf\fP and the fifth argument is a reference to the \fItransferred\fP bytes of the file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.TP +.B LIBMPQ_ERROR_OPEN +Block offset table was not opened by calling \fBlibmpq__block_open_offset\fP(), or it was closed by an \fBlibmpq__block_close_offset\fP() call. +.TP +.B LIBMPQ_ERROR_SIZE +The output buffer is to small. +.TP +.B LIBMPQ_ERROR_SEEK +Seeking in file failed. +.TP +.B LIBMPQ_ERROR_MALLOC +Not enough memory for creating required structures. +.TP +.B LIBMPQ_ERROR_READ +Reading in archive failed. +.TP +.B LIBMPQ_ERROR_DECRYPT +Decrypting file failed. +.TP +.B LIBMPQ_ERROR_UNPACK +Unpacking file failed. +.SH SEE ALSO +.BR libmpq__block_read (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__file_unpacked_size.3 b/externals/libmpq/doc/man3/libmpq__file_unpacked_size.3 new file mode 100644 index 0000000..a81cf7a --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__file_unpacked_size.3 @@ -0,0 +1,55 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-05-15 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "int32_t libmpq__file_unpacked_size(" +.BI " mpq_archive_s *" "mpq_archive", +.BI " uint32_t " "file_number", +.BI " off_t *" "unpacked_size" +.BI ");" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__file_unpacked_size\fP() to get the unpacked size of a given file in the archive. It will return a valid size for compressed and imploded files as well as stored only. +.LP +The \fBlibmpq__file_unpacked_size\fP() function takes as first argument the archive structure \fImpq_archive\fP which have to be allocated first and opened by \fBlibmpq__archive_open\fP(). The second argument \fIfile_number\fP is the number of file and the third argument is a reference to the uncompressed, exploded or stored size \fIunpacked_size\fP of file. +.SH RETURN VALUE +On success, a zero is returned and on error one of the following constants. +.TP +.B LIBMPQ_ERROR_EXIST +File does not exist in archive. +.SH SEE ALSO +.BR libmpq__archive_unpacked_size (3), +.BR libmpq__block_unpacked_size (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/doc/man3/libmpq__version.3 b/externals/libmpq/doc/man3/libmpq__version.3 new file mode 100644 index 0000000..5500d73 --- /dev/null +++ b/externals/libmpq/doc/man3/libmpq__version.3 @@ -0,0 +1,45 @@ +.\" Copyright (c) 2003-2008 Maik Broemme +.\" +.\" This is free documentation; 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. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual 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 manual; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, +.\" USA. +.TH libmpq 3 2008-03-31 "The MoPaQ archive library" +.SH NAME +libmpq \- cross-platform C library for manipulating mpq archives. +.SH SYNOPSIS +.nf +.B +#include +.sp +.BI "const char *libmpq__version();" +.fi +.SH DESCRIPTION +.PP +Call \fBlibmpq__version\fP() to get information about the version of the library, it is useful to create minimum required version verifications. +.SH RETURN VALUE +The function returns the library version. +.SH SEE ALSO +.BR libmpq (3) +.SH AUTHOR +Check documentation. +.TP +libmpq is (c) 2003-2008 +.B Maik Broemme +.PP +The above e-mail address can be used to send bug reports, feedbacks or library enhancements. diff --git a/externals/libmpq/libmpq-config.in b/externals/libmpq/libmpq-config.in new file mode 100644 index 0000000..d345efd --- /dev/null +++ b/externals/libmpq/libmpq-config.in @@ -0,0 +1,57 @@ +#!/bin/sh + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +exec_prefix_set=no + +usage="\ +Usage: libmpq-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" + +if test "$#" -eq "0"; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test "$#" -gt "0"; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case "$1" in + --prefix=*) + prefix="$optarg" + if test "$exec_prefix_set" = "no" ; then + exec_prefix="$optarg" + fi + ;; + --prefix) + echo "$prefix" + ;; + --exec-prefix=*) + exec_prefix="$optarg" + exec_prefix_set=yes + ;; + --exec-prefix) + echo "$exec_prefix" + ;; + --version) + echo "@VERSION@" + ;; + --cflags) + largefile="@LFS_CFLAGS@" + includes=-I@includedir@/libmpq + echo "$includes $largefile" + ;; + --libs) + libdirs="-L@libdir@" + echo "$libdirs -lmpq" + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done + diff --git a/externals/libmpq/libmpq.pc.in b/externals/libmpq/libmpq.pc.in new file mode 100644 index 0000000..8c53bea --- /dev/null +++ b/externals/libmpq/libmpq.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libmpq +Description: GPL version of the libmpq library +Version: @VERSION@ +Libs: -L${libdir} -lmpq +Cflags: -I${includedir}/libmpq @LFS_CFLAGS@ diff --git a/externals/libmpq/libmpq/Makefile.am b/externals/libmpq/libmpq/Makefile.am new file mode 100644 index 0000000..409e3df --- /dev/null +++ b/externals/libmpq/libmpq/Makefile.am @@ -0,0 +1,23 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# library information and headers which should not be installed. +lib_LTLIBRARIES = libmpq.la +noinst_HEADERS = common.h explode.h extract.h huffman.h mpq-internal.h wave.h + +# directory where the include files will be installed. +libmpq_includedir = $(includedir)/libmpq + +# header files to install. +libmpq_include_HEADERS = mpq.h + +libmpq_la_SOURCES = $(GENERAL_SRCS) +libmpq_la_LDFLAGS = -release $(PACKAGE_VERSION) + +GENERAL_SRCS = \ + common.c \ + huffman.c \ + extract.c \ + explode.c \ + mpq.c \ + wave.c diff --git a/externals/libmpq/libmpq/common.c b/externals/libmpq/libmpq/common.c new file mode 100644 index 0000000..c17e403 --- /dev/null +++ b/externals/libmpq/libmpq/common.c @@ -0,0 +1,219 @@ +/* + * common.c -- shared functions used by mpq-tools. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* generic includes. */ +#include +#include +#include +#include + +/* libmpq main includes. */ +#include "mpq.h" +#include "mpq-internal.h" + +/* libmpq generic includes. */ +#include "extract.h" + +#include "common.h" + +/* the global shared decryption buffer. it's a static array compiled into the + * library, and can be re-created by compiling and running crypt_buf_gen.c + */ +#include "crypt_buf.h" + +/* function to return the hash to a given string. */ +uint32_t libmpq__hash_string(const char *key, uint32_t offset) { + + /* some common variables. */ + uint32_t seed1 = 0x7FED7FED; + uint32_t seed2 = 0xEEEEEEEE; + + /* one key character. */ + uint32_t ch; + + /* prepare seeds. */ + while (*key != 0) { + ch = toupper(*key++); + seed1 = crypt_buf[offset + ch] ^ (seed1 + seed2); + seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3; + } + + return seed1; +} + +/* function to encrypt a block. */ +int32_t libmpq__encrypt_block(uint32_t *in_buf, uint32_t in_size, uint32_t seed) { + + /* some common variables. */ + uint32_t seed2 = 0xEEEEEEEE; + uint32_t ch; + + /* we're processing the data 4 bytes at a time. */ + for (; in_size >= 4; in_size -= 4) { + seed2 += crypt_buf[0x400 + (seed & 0xFF)]; + ch = *in_buf ^ (seed + seed2); + seed = ((~seed << 0x15) + 0x11111111) | (seed >> 0x0B); + seed2 = *in_buf + seed2 + (seed2 << 5) + 3; + *in_buf++ = ch; + } + + /* if no error was found, return decrypted bytes. */ + return LIBMPQ_SUCCESS; +} + + +/* function to decrypt a block. */ +int32_t libmpq__decrypt_block(uint32_t *in_buf, uint32_t in_size, uint32_t seed) { + + /* some common variables. */ + uint32_t seed2 = 0xEEEEEEEE; + uint32_t ch; + + /* we're processing the data 4 bytes at a time. */ + for (; in_size >= 4; in_size -= 4) { + seed2 += crypt_buf[0x400 + (seed & 0xFF)]; + ch = *in_buf ^ (seed + seed2); + seed = ((~seed << 0x15) + 0x11111111) | (seed >> 0x0B); + seed2 = ch + seed2 + (seed2 << 5) + 3; + *in_buf++ = ch; + } + + /* if no error was found, return decrypted bytes. */ + return LIBMPQ_SUCCESS; +} + +/* function to detect decryption key. */ +int32_t libmpq__decrypt_key(uint8_t *in_buf, uint32_t in_size, uint32_t block_size) { + + /* some common variables. */ + uint32_t saveseed1; + + /* temp = seed1 + seed2 */ + uint32_t temp; + uint32_t i = 0; + + /* temp = seed1 + buffer[0x400 + (seed1 & 0xFF)] */ + temp = (*(uint32_t *)in_buf ^ in_size) - 0xEEEEEEEE; + + /* try all 255 possibilities. */ + for (i = 0; i < 0x100; i++) { + + /* some common variables. */ + uint32_t seed1; + uint32_t seed2 = 0xEEEEEEEE; + uint32_t ch; + uint32_t ch2; + + /* try the first uint32_t's (we exactly know the value). */ + seed1 = temp - crypt_buf[0x400 + i]; + seed2 += crypt_buf[0x400 + (seed1 & 0xFF)]; + ch = ((uint32_t *)in_buf)[0] ^ (seed1 + seed2); + + if (ch != in_size) { + continue; + } + + /* add one because we are decrypting block positions. */ + saveseed1 = seed1 + 1; + ch2 = ch; + + /* + * if ok, continue and test the second value. we don't know exactly the value, + * but we know that the second one has lower 16 bits set to zero (no compressed + * block is larger than 0xFFFF bytes) + */ + seed1 = ((~seed1 << 0x15) + 0x11111111) | (seed1 >> 0x0B); + seed2 = ch + seed2 + (seed2 << 5) + 3; + seed2 += crypt_buf[0x400 + (seed1 & 0xFF)]; + ch = ((uint32_t *)in_buf)[1] ^ (seed1 + seed2); + + /* check if we found the file seed. */ + if ((ch - ch2) <= block_size) { + + /* file seed found, so return it. */ + return saveseed1; + } + } + + /* if no file seed was found return with error. */ + return LIBMPQ_ERROR_DECRYPT; +} + +/* function to decompress or explode a block from mpq archive. */ +int32_t libmpq__decompress_block(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size, uint32_t compression_type) { + + /* some common variables. */ + int32_t tb = 0; + + /* check if buffer is not compressed. */ + if (compression_type == LIBMPQ_FLAG_COMPRESS_NONE) { + + /* no compressed data, so copy input buffer to output buffer. */ + memcpy(out_buf, in_buf, out_size); + + /* store number of bytes copied. */ + tb = out_size; + } + + /* check if one compression mode is used. */ + else if (compression_type == LIBMPQ_FLAG_COMPRESS_PKZIP || + compression_type == LIBMPQ_FLAG_COMPRESS_MULTI) { + + /* check if block is really compressed, some blocks have set the compression flag, but are not compressed. */ + if (in_size < out_size) { + + /* check if we are using pkzip compression algorithm. */ + if (compression_type == LIBMPQ_FLAG_COMPRESS_PKZIP) { + + /* decompress using pkzip. */ + if ((tb = libmpq__decompress_pkzip(in_buf, in_size, out_buf, out_size)) < 0) { + + /* something on decompression failed. */ + return tb; + } + } + + /* check if we are using multiple compression algorithm. */ + else if (compression_type == LIBMPQ_FLAG_COMPRESS_MULTI) { + + /* + * check if it is a file compressed by blizzard's multiple compression, note that storm.dll + * version 1.0.9 distributed with warcraft 3 passes the full path name of the opened archive + * as the new last parameter. + */ + if ((tb = libmpq__decompress_multi(in_buf, in_size, out_buf, out_size)) < 0) { + + /* something on decompression failed. */ + return tb; + } + } + } else { + + /* block has set compression flag, but is not compressed, so copy data to output buffer. */ + memcpy(out_buf, in_buf, out_size); + + /* save the number of transferred bytes. */ + tb = in_size; + } + } + + /* if no error was found, return transferred bytes. */ + return tb; +} diff --git a/externals/libmpq/libmpq/common.h b/externals/libmpq/libmpq/common.h new file mode 100644 index 0000000..12d6008 --- /dev/null +++ b/externals/libmpq/libmpq/common.h @@ -0,0 +1,60 @@ +/* + * common.h -- header functions used by mpq-tools. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _COMMON_H +#define _COMMON_H + +/* function to return the hash to a given string. */ +uint32_t libmpq__hash_string( + const char *key, + uint32_t offset +); + +/* function to encrypt a block. */ +int32_t libmpq__encrypt_block( + uint32_t *in_buf, + uint32_t in_size, + uint32_t seed +); + +/* function to decrypt a block. */ +int32_t libmpq__decrypt_block( + uint32_t *in_buf, + uint32_t in_size, + uint32_t seed +); + +/* function to detect decryption key. */ +int32_t libmpq__decrypt_key( + uint8_t *in_buf, + uint32_t in_size, + uint32_t block_size +); + +/* function to decompress or explode block from archive. */ +int32_t libmpq__decompress_block( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size, + uint32_t compression_type +); + +#endif /* _COMMON_H */ diff --git a/externals/libmpq/libmpq/crypt_buf.h b/externals/libmpq/libmpq/crypt_buf.h new file mode 100644 index 0000000..34184b0 --- /dev/null +++ b/externals/libmpq/libmpq/crypt_buf.h @@ -0,0 +1,217 @@ +/* DO NOT CHANGE! this file is auto-generated by crypt_buf_gen.c */ +static const uint32_t crypt_buf[0x500] = { + 0x55c636e2, 0x02be0170, 0x584b71d4, 0x2984f00e, 0xb682c809, 0x91cf876b, + 0x775a9c24, 0x597d5ca5, 0x5a1afeb2, 0xd3e9ce0d, 0x32cdcdf8, 0xb18201cd, + 0x3cce05ce, 0xa55d13be, 0xbb0afe71, 0x9376ab33, 0x848f645e, 0x87e45a45, + 0x45b86017, 0x5e656ca8, 0x1b851a95, 0x2542dbd7, 0xab4df9e4, 0x5976ae9b, + 0x6c317e7d, 0xcddd2f94, 0x3c3c13e5, 0x335b1371, 0x31a592ca, 0x51e4fc4c, + 0xf7db5b2f, 0x8abdbe41, 0x8beaa674, 0x20d6b319, 0xde6c9a9d, 0xc5ac84e5, + 0x445a5feb, 0x94958cb0, 0x1e7d3847, 0xf35d29b0, 0xca5cceda, 0xb732c8b5, + 0xfdcc41dd, 0x0edcec16, 0x9d01feae, 0x1165d38e, 0x9ee193c8, 0xbf33b13c, + 0x61bc0dfc, 0xef3e7be9, 0xf8d4d4c5, 0xc79b7694, 0x5a255943, 0x0b3dd20a, + 0x9d1ab5a3, 0xcfa8ba57, 0x5e6d7069, 0xcb89b731, 0x3dc0d15b, 0x0d4d7e7e, + 0x97e37f2b, 0xfefc2bb1, 0xf95b16b5, 0x27a55b93, 0x45f22729, 0x4c986630, + 0x7c666862, 0x5fa40847, 0xa3f16205, 0x791b7764, 0x386b36d6, 0x6e6c3fef, + 0xc75855db, 0x4abc7dc7, 0x4a328f9b, 0xcef20c0f, 0x60b88f07, 0xf7bb4b8f, + 0x830b5192, 0x94f711ec, 0x20250752, 0x399d21a3, 0xe5c0840d, 0xe76cffa5, + 0x624fab29, 0x5df133e6, 0x83e0b9b8, 0xc5796bfb, 0x4a7ab2d0, 0xba59a821, + 0x03a81e4c, 0xcd3adfdb, 0x32b26b8c, 0x8e35c533, 0x9e6300e9, 0x8cf92ac5, + 0x880d18eb, 0x131a53b3, 0x2ed2dc64, 0xb23257c1, 0xa06450c1, 0x1b92cb8e, + 0x72ed730e, 0x19a685f0, 0x82836483, 0x42d94e8a, 0xee9bd6f6, 0x556d0b6a, + 0xba65589a, 0xde24cce4, 0x53329f6c, 0xc754fe8b, 0x503d2dc7, 0x10027ba4, + 0xd3b60a8b, 0x68e68d83, 0x0a9128a9, 0x595fa35f, 0x0b03b5be, 0x150a45c4, + 0xb1629cce, 0xe5f7497b, 0x8a7098a4, 0xb8233e69, 0x8ea0f978, 0x5b579970, + 0xeab14318, 0x4b28b263, 0xb6766cef, 0x06782877, 0x155c6dd0, 0xc711333c, + 0xf819cedf, 0x00eb1d68, 0xd6fffa6e, 0x439e5962, 0xd765d6db, 0xcb0bcee9, + 0x6d3c5647, 0x965466f3, 0x0ca983c9, 0x74ecc1ce, 0xfc0563b6, 0x42b08fee, + 0xc5b38853, 0xfe502ceb, 0x7b432faf, 0xc309e610, 0x2c3997d8, 0x43774654, + 0x15bd9d2c, 0xed6a420d, 0xc7ff520c, 0xb8a97fd1, 0x5e4d60cc, 0xb9738d11, + 0xda2181ff, 0x73ac2597, 0x3a8eec8d, 0xac85e779, 0xf3f975d6, 0xb9fe7b91, + 0x0f155d1e, 0x2860b6dd, 0x835977cb, 0xb0607436, 0x9cab7f6b, 0x8ab91186, + 0xc12b51e9, 0x20084e8b, 0x44ba8ead, 0xa542b130, 0x82bcd5c4, 0xcc747f4e, + 0x0f1909d8, 0xda242e1c, 0x6f7d1aa0, 0xd2626486, 0x88d0781e, 0xab695ccd, + 0xfa569145, 0xb4feb55c, 0xbe47e896, 0xe70a7a88, 0xd56185a2, 0xacf4c871, + 0x09282332, 0x1ddeeaa8, 0x590c7adb, 0xf4a97667, 0xbfd85705, 0x0ea77ccc, + 0xa9f85364, 0x83195869, 0x8bfb041a, 0xdb842f5c, 0xd6f0f315, 0xa7756ea7, + 0x0a51b439, 0xa9edf8a3, 0xd9084e2f, 0x827407f8, 0xd4ac8284, 0x09739d0d, + 0xb3bb6cfc, 0xd539c77d, 0x6bbc9ac0, 0x35c641aa, 0x934c96b0, 0xd17af317, + 0x29c6baef, 0xb275cdac, 0xd72662de, 0x9f5c2544, 0xc1a98f75, 0xd98e8f9a, + 0x47bd5c86, 0x70c610a6, 0xb5482ed4, 0x23b9c68c, 0x3c1bae66, 0x69556e7f, + 0xd902f5e0, 0x653d195b, 0xde6541fb, 0x07bcc6ac, 0xc6ee7788, 0x801534d4, + 0x2c1f35c0, 0xd9de614d, 0xbdccac85, 0xb4d4a0da, 0x242d549b, 0x9d964796, + 0xb9ceb982, 0x59fa99a9, 0xd8986cc1, 0x9e90c1a1, 0x01bbd82f, 0xd7f1c5fd, + 0xdd847eba, 0x883d305d, 0x25f13152, 0x4a92694d, 0x77f1e601, 0x8024e6e7, + 0x02a5f53d, 0x9c3ef4d9, 0xaf403ccc, 0xe2ad03c0, 0x46edf6ec, 0x6f9bd3e6, + 0xcc24ad7a, 0x47afab12, 0x82298df7, 0x708c9eec, 0x76f8c1b1, 0xb39459d2, + 0x3f1e26d9, 0xe1811be7, 0x56ed1c4d, 0xc9d18af8, 0xe828060e, 0x91cada2e, + 0x5ccbf9b7, 0xf1a552d4, 0x3c9d4343, 0xe1008785, 0x2adfeebf, 0xf90240a0, + 0x3d08cce7, 0x426e6fb0, 0x573c984f, 0x13a843ae, 0x406b7439, 0x636085d9, + 0x5000ba9a, 0xad4a47ab, 0xaf001d8d, 0x419907ae, 0x185c8f96, 0xe5e9ed4d, + 0x61764133, 0xd3703d97, 0xac98f0c6, 0xdbc3a37c, 0x85f010c4, 0x90491e32, + 0xf12e18bf, 0xc88c96e1, 0xd3fbd6d9, 0xe3c28b08, 0xd5bf08cc, 0xb1e78859, + 0x2546ddcf, 0xb030b200, 0xaafd2811, 0x55b22d21, 0xd38bf567, 0x469c7a2b, + 0x5ad05792, 0xa1a5981e, 0x7dfb8384, 0x34d1ca0a, 0x7eb0dbe0, 0xd61ce0f6, + 0x398068b7, 0xe6406d1f, 0x95ae6b47, 0xe4281230, 0xb0843061, 0xa70a3a68, + 0xe340f625, 0x72dcbffd, 0x8eb8afcd, 0x18b6661f, 0x17ef5a5c, 0x000c5b22, + 0x6ba13836, 0x6165e383, 0x74481c5b, 0xe56f0711, 0xa26f5024, 0x5ff22e60, + 0x31a5e829, 0xa1094bf0, 0xc680ec6c, 0x8cf327d7, 0xebf1348a, 0x6a227d2f, + 0x74065184, 0x8df65112, 0x2bbd05ee, 0xe4d00ed6, 0x2980ee1a, 0x6ae1da73, + 0xe84614da, 0x6c9906ab, 0xcf8e02db, 0xd3723e97, 0x92f66caf, 0xac8491c7, + 0xaec65696, 0xb98997cf, 0xfa16c762, 0x6d73c65f, 0x205d22a6, 0x4dd3aaa5, + 0x2deb6bc0, 0x9f37686c, 0x71a5282b, 0x376bb9e0, 0x7fff2a1b, 0xde67982f, + 0x9cbf33ce, 0x2e6dab37, 0x6e3424b9, 0x0ee143bc, 0x832a60d9, 0xbb6329e1, + 0x13f6befd, 0x5965fb84, 0xf60b233c, 0x3d695183, 0x433224a1, 0xb5d9cae5, + 0x82459bab, 0x9f21b311, 0xaf6c5247, 0xb447b13a, 0x7b2676c3, 0xc38979cd, + 0x8526ae25, 0xc550ad5b, 0x685099a7, 0x65e9c2bd, 0xe5c6dc36, 0xe10b37a9, + 0x88016878, 0xce81d4e4, 0x24d6fc80, 0x4106152d, 0x6d4f5f90, 0xc4dc74be, + 0xdb48676c, 0x6cb569b7, 0xf3bf598f, 0x042b08d9, 0x02ccb2de, 0xb1056f65, + 0x47994af4, 0xfa141ba4, 0x9376ab2e, 0x07a76737, 0x75e7e6fc, 0x449d80a1, + 0x03b7259d, 0xf6df358a, 0x5a75d5b9, 0x47286923, 0x3b1a30ef, 0xeebe3d6a, + 0x9db1aa00, 0x007a90d9, 0x24667071, 0x019c73cf, 0x69039bcd, 0x95900744, + 0x6518b1eb, 0x6905f202, 0xee3951b2, 0xe141fca9, 0x797fa832, 0x5a95e55b, + 0xd6263b15, 0x5b61f394, 0x897acb1c, 0x005f83a9, 0x22420f71, 0xf495176e, + 0x7e138f3d, 0x1392e384, 0x373bf7aa, 0x8e512816, 0xa960b3ca, 0x0474d74c, + 0xffacd6d7, 0x2ef5ed9e, 0x60992aaa, 0x7e690e99, 0x23c0749d, 0xd8e29105, + 0x555d5909, 0x15631bfe, 0xa69c5a1c, 0x501017ca, 0x99438048, 0x38733ac7, + 0xe682e2c8, 0xd4655fd6, 0x956e4c04, 0x347df643, 0x2f4b177b, 0x93ed3aa4, + 0xa77e1dd5, 0x7ae55702, 0xd2a52fd9, 0xef8ba18c, 0xb7d3c1ee, 0x8078ba8d, + 0xab5aaadb, 0x752be08f, 0x068b31c1, 0x078aae3c, 0xaa5a8343, 0x123d9268, + 0x2ceaee43, 0x8ebdb239, 0x650251f3, 0x04883648, 0x8c62e12e, 0x12b32167, + 0xe5112e9a, 0x10002548, 0x3e7a818d, 0x077e5327, 0xf140cc21, 0x6ce7d75d, + 0x9b99f9a5, 0x3215741c, 0xb6aadbae, 0x738768dc, 0x82a3742f, 0x76517020, + 0xdd872ad8, 0x9d0902b2, 0x7d1a6b04, 0x49381592, 0x63a652a5, 0x0c15e626, + 0xe22f70d6, 0x01e84385, 0xb29de134, 0x20c5000e, 0xe961f443, 0x2d31662e, + 0x3ce6bc28, 0x34f9dd94, 0xfa45de53, 0x497588bd, 0x9468215b, 0x0777fa5c, + 0x6f7114c0, 0xe0e82694, 0xe4371986, 0x57112de2, 0xe0cac289, 0xf2a3cee0, + 0x6a41e1b9, 0xbfcea77d, 0xf927fd52, 0x69747d98, 0xbea76cdb, 0x8dd39557, + 0x04db5ece, 0x2a0885c8, 0x3be4e8ee, 0x21d785dc, 0x09de7c0e, 0x3258ea33, + 0x51922982, 0xee8dd024, 0x3df6965d, 0x30c1237b, 0xf7f6686a, 0x9faca186, + 0x7c400076, 0x85acef8a, 0xf4b6d220, 0xddc3481c, 0x439eaec4, 0x717bbe63, + 0x8259faa7, 0xd682bd68, 0x932a8610, 0x38bf0a7f, 0x6212e2c7, 0x88ee3168, + 0xb3c27047, 0x6133cb1e, 0x15295506, 0x5ae66246, 0x1d208ddd, 0xa91d3dba, + 0xc315968d, 0x6aa2664b, 0x716d0cca, 0x891f4956, 0x80866bff, 0xbd56c847, + 0x9093425a, 0x28dd9e87, 0x84ef3e08, 0x690a49d6, 0x6a7eff82, 0xabcfe400, + 0x3d3be5ca, 0x381b650c, 0x4b7c8622, 0x3e0246f3, 0xa3561654, 0x9488865c, + 0x3aef1bf2, 0x5e5d68a2, 0xd32f1ddc, 0x51972bf0, 0x177a213b, 0x469375c2, + 0x37640bd0, 0xfc3324c8, 0x07091a09, 0x2d63d3fb, 0x2153f023, 0x48223875, + 0x61a55826, 0x8c136538, 0x49f71d98, 0x84c7d51e, 0x85551a73, 0x13d604c5, + 0xd701a626, 0x87b844ca, 0x741eb29d, 0x2a2c977c, 0xc797ca03, 0x6c4085d7, + 0x2dacf79b, 0x734fa2eb, 0xcc290557, 0xfa1e75e4, 0x06b29a27, 0xbece2a7a, + 0x70a4554b, 0xc935942e, 0xa764bbc1, 0x1fe391d6, 0x7807f0c2, 0x40606ed9, + 0xe5153086, 0xe91d7dd2, 0xed5d3ba9, 0xaa14b64a, 0x83b24dd9, 0xec1ff5cd, + 0xba33ead3, 0xe4ef735c, 0xbc062438, 0xd8bfd523, 0x473d1e04, 0x2007f8a7, + 0xb02903ed, 0x86ea8ada, 0x95ab69cf, 0xfd1f9809, 0x9cb3d8bb, 0x51f45958, + 0x9cdd4276, 0xc245865e, 0x8f0c836b, 0x4ee7dc07, 0xf6368d9d, 0xef2c1dc1, + 0xee56b54b, 0xbd62ce2f, 0xf4916aad, 0xc81cb594, 0x41729f49, 0x24bef0a4, + 0xdef487a9, 0x222e05b8, 0x8d3bf5c6, 0x11b55009, 0xad09d2b3, 0x19db9fd1, + 0xd7427085, 0x33dbfc8b, 0x526b9378, 0x790e1bc8, 0xb2998a00, 0xa5641703, + 0x0676d249, 0x6b9185cc, 0x30e4348f, 0x82c52f65, 0x57c7dc24, 0x489c1ecd, + 0x9fcab02a, 0x56d61117, 0xfe869cac, 0x55fc5140, 0x7fbbb382, 0x9e5afc79, + 0x10047c99, 0xfc9f5984, 0x56587e2d, 0xb98193f0, 0x98fe5e8e, 0x29b15b6b, + 0x9561f055, 0xbb0caa25, 0x1e4ecc15, 0x23f5393b, 0x0845b458, 0xceff67ca, + 0xb099900c, 0x00b1564f, 0x39eef3d1, 0xfcc1bf84, 0xac8893b5, 0x6484bf0e, + 0x91c02ab3, 0x8c0c0c70, 0x686fa8c6, 0xe171bed6, 0xdfae37df, 0xd5a1a4e7, + 0xe3eb49a1, 0x5e6014e0, 0x205b21ac, 0xfd58b3da, 0x2e7c07cd, 0xef2cc85a, + 0xd7587b46, 0xf417847d, 0x8a30cec1, 0x70984f6c, 0xf0b63388, 0xc220c98d, + 0xede62936, 0x92c0a7b3, 0x1ef371e8, 0x2005f7af, 0x91a47265, 0xb0cf5504, + 0xd500aba8, 0xcb5c4bd3, 0x9b3bcbc3, 0xcf6644b5, 0xce9488ef, 0x003fc96e, + 0xaa42222f, 0x4844f3d0, 0x4db89d77, 0x08681aae, 0x662f3a28, 0x761552db, + 0x1df7a17a, 0x93feed9a, 0xcc496a4f, 0xa217cfcd, 0x3ba3c930, 0x268f7e77, + 0x0797b4a1, 0x8bebfc51, 0x068930c4, 0x16c874e2, 0xc242da24, 0xfb229f76, + 0xa0795b02, 0x689fc036, 0x17a73732, 0xd21aec00, 0xac00a692, 0x5b217f18, + 0xae421624, 0x2bc05cc0, 0x48c1db7a, 0x4f4e63b4, 0x1667f04e, 0x34020f94, + 0x972b2555, 0x9a07355b, 0x01665970, 0x7db60c6f, 0x3ad7103b, 0x5c3d09c0, + 0xeea3dada, 0x88c21c10, 0x102436d7, 0x6a3b3400, 0xeb523c4c, 0xfb97d896, + 0x964cb86b, 0xdd878038, 0x0529da4d, 0x0b1468a5, 0x18739ac8, 0xf7f26668, + 0xf64f4471, 0x5c14f5c3, 0x44a081fb, 0x39ac7e37, 0x8a17c26b, 0x868f5e67, + 0x3931978d, 0x6edf7817, 0x4951cc67, 0x943407f3, 0xcc5e748f, 0x2b7ee729, + 0xcbb320f0, 0x11fec8e7, 0xfccfc658, 0x03454354, 0x373aa1ec, 0x1d58fe9a, + 0x064710ae, 0xa88aa0ba, 0xd183a23e, 0x40d150a3, 0xf531b8d1, 0xa7d99f85, + 0x11838cd5, 0xb19e64b3, 0x3d67a5e9, 0xb02c5ac6, 0x99b9b9e8, 0x4c202b7a, + 0x15f261d3, 0xa84c2d0d, 0x50f185a6, 0x33ba41d5, 0x39791013, 0x4baff44e, + 0xeeeeaa1c, 0xe0488314, 0x559ccd2b, 0xa104f445, 0x636f37c4, 0x264d5e3b, + 0x75c17f35, 0x75424131, 0xbb115739, 0x74fe755a, 0x7d3a7aa6, 0x2d8be784, + 0x83ed154a, 0xfc2673d8, 0x44dd4a7f, 0x79056cc8, 0x82cc8831, 0x9d3c1b7c, + 0xe9453bfa, 0x24315694, 0x661f3253, 0x75549f5c, 0xbb2b63ed, 0x67e00d96, + 0xf48966c7, 0x0d7bea56, 0xc25f92ef, 0xa947a79d, 0xde4adf6f, 0xac0f0342, + 0xd3eb246b, 0xa4aa118e, 0x3c3e6a46, 0x457f4441, 0xa50a406f, 0x6c508d9f, + 0xe9ac18e7, 0x1ecdb4ba, 0x39ac7e3a, 0x7fb304fa, 0x6f38f8e8, 0x4aecea6d, + 0x61035e73, 0x81708907, 0xebc07205, 0x90fd7614, 0xb52d217f, 0x6c4de195, + 0x1dd49084, 0x64ee482c, 0x94c7a521, 0x540c09d8, 0x75df8dd5, 0x414131f7, + 0x3698fd76, 0xf784db4f, 0xf8c97a03, 0x048f39b9, 0x3bf4f0bd, 0x8cb50992, + 0x9b58d9ee, 0xe5ab79cc, 0x9a5f6052, 0xbd9591b0, 0xfad2232b, 0x5a632254, + 0x0286e618, 0x8ad3c8f7, 0xe4060176, 0x754c4617, 0x5c10490b, 0x6f7d6fff, + 0x2187b42a, 0x5775095b, 0x02f4c663, 0x5a5dca06, 0xfe4ad4c7, 0x53e19f7d, + 0x59ff46b5, 0xbcc42ba5, 0xfd2f4a97, 0xbed6d905, 0x95629b6b, 0x21a1c0db, + 0xaa10b45d, 0xe6ef6d58, 0x2892cf4d, 0x9fed6c10, 0x1e386bf7, 0x9be0c6e8, + 0x2b2f15ef, 0x19f5ac7b, 0x7aff0e72, 0x31da576f, 0x30252cb4, 0x577960ac, + 0x166e9e5a, 0xa9374a61, 0x71369c96, 0x7ff826ae, 0xe8175326, 0xcabbfd33, + 0x0191190e, 0x699d3c3e, 0x36b40b22, 0xb3950513, 0x9b889bfa, 0xa52a5007, + 0xac290fed, 0x3b4e4a4f, 0xb753d8d6, 0x3c531f22, 0x582f6427, 0xa9cd93a9, + 0x546e39ae, 0x242faad2, 0xd2e0f747, 0x09f6325d, 0x59d48719, 0xad7eb66e, + 0xd5512878, 0x56debf9d, 0x5107e5a5, 0xf1c00aa4, 0x814ccca8, 0x600d90f0, + 0x9be97619, 0x915fa5f2, 0x2b5628dd, 0xa33d5f5a, 0x595df7c1, 0x6966215d, + 0x50ec8337, 0xf1d21372, 0x0ee2eefb, 0xad9e70b7, 0xab0d2fe4, 0xcf277b5d, + 0x62585a2c, 0x835a7844, 0x74b1fa6b, 0x49baffd5, 0x2ea9c864, 0x129311a8, + 0xbdfa1867, 0x83ca5997, 0x9d1db719, 0x84bb79e6, 0x9e3f99f2, 0x313f6101, + 0x1b99245b, 0xd15d8fb2, 0xcef90f81, 0x2945268d, 0xdbbcf573, 0xb1021886, + 0x9ee7ec1d, 0x1cf824f7, 0x7eaa2e32, 0x69c0a2b5, 0x7494419c, 0xe253d7d3, + 0x48da3d12, 0x45b8b571, 0xdb4d147a, 0xd82d8dde, 0x265d10a2, 0xb0a6eb9a, + 0x7e1c93a6, 0x36fe2f46, 0xdcad6b00, 0x05439191, 0xb0ce5484, 0x61d1c309, + 0x8da62a03, 0x06d0fe2f, 0xbac6dd3c, 0xca2006f3, 0x8321b1af, 0x0411a6f3, + 0xe8918eac, 0x21a2c152, 0x91c0d54f, 0x6aaa14fa, 0xdd22a440, 0x88cb2075, + 0x7a4eb813, 0x67afa071, 0xd8d98c9c, 0x31f10d47, 0x6ff1a8a8, 0x2faaf0a1, + 0x48a221bb, 0x3be6948b, 0xaa79e79b, 0x0ea7278c, 0x7a3857ef, 0x49b7fe55, + 0xd51cb931, 0x041c018d, 0x00b90501, 0x45ea7881, 0x8fc1dbcf, 0xb80b32a9, + 0xabacd2e9, 0x677bdc40, 0xecace542, 0x6d6514eb, 0x31c09ff7, 0x5e6c1abd, + 0x1c391d0f, 0x0e9d77f1, 0x7119392d, 0x6be9b0ba, 0x6194fa77, 0x45e62148, + 0x42234af2, 0xc3239d66, 0x939cbdbc, 0x56200d9c, 0x6b275208, 0x001a61f3, + 0xccc2a546, 0x4b722be0, 0xee25f2b7, 0x6d86cf9e, 0xaa6be0cd, 0x4dcda7b6, + 0x78d4aa13, 0x36ea7ad9, 0x3f29d700, 0xdeea2d84, 0x6a6af5bd, 0x18afb81c, + 0xd8e4e73c, 0x8aa708ba, 0x658b94d9, 0xa676478c, 0xcfa10c22, 0x25593c74, + 0x8d962235, 0x5f980270, 0x3df6ebc0, 0x8e7d92fa, 0xc3ee55e1, 0xd5f72447, + 0x02b0fa95, 0x52b0b520, 0x70d2c11f, 0x3a6fdd6c, 0x193aa698, 0x5496f7d5, + 0x4208931b, 0x7a4106ec, 0x83e86840, 0xf49b6f8c, 0xba3d9a51, 0x55f54ddd, + 0x2de51372, 0x9afb571b, 0x3ab35406, 0xad64ff1f, 0xc77764fe, 0x7f864466, + 0x416d9cd4, 0xa2489278, 0xe30b86e4, 0x0b5231b6, 0xba67aed6, 0xe5ab2467, + 0x60028b90, 0x1d9e20c6, 0x2a7c692a, 0x6b691cdb, 0x9e51f817, 0x9b763dec, + 0x3d29323f, 0xcfe12b68, 0x754b459b, 0xa2238047, 0xd9c55514, 0x6bdcffc1, + 0x693e6340, 0x82383fe7, 0x1916ea5f, 0xec7bcd59, 0x72de165a, 0xe79a1617, + 0x8ec86234, 0xa8f0d284, 0x20c90226, 0x7bf98884, 0x28a58331, 0x3ec3fa6e, + 0x4ce0895b, 0xc353b4d0, 0x33ef064f, 0x21e5e210, 0xc8bb589d, 0xe85dcab2, + 0xac65829f, 0xa7bf92d0, 0x05a6174d, 0x25a50c2e, 0xe5c78777, 0x3d75021f, + 0x4baa9c98, 0x23bdc884, 0x9653bbd7, 0xbadce7f5, 0xc283a484, 0xc040df2e, + 0x9370a841, 0x2f316022, 0x36eed231, 0xac2cbc0c, 0x13c0a49b, 0xcdd12997, + 0x07fe91b2, 0xcd7eabcd, 0x2c01271d, 0x18432df8, 0x599c6bc7, 0x75e93d5a, + 0xb67a6ee2, 0x8e738e16, 0xff9073fd, 0xaf77026a, 0xf86ea2fc, 0x91509ea3, + 0x33a78dc6, 0x4f79234a, 0x3a7535bc, 0x3539fcb1, 0x3103ee52, 0x4f6f1e69, + 0x6bb3ebbc, 0x4cb77555, 0x8dd1e999, 0x2ade439d, 0x11521fae, 0xb94d2545, + 0x8dde9abd, 0x1909393f, 0xb792a23d, 0x749c455b, 0xb5b60f2c, 0x380459ce, + 0x0dad5820, 0xb130845b, 0x291cbd52, 0xde9a5bb7, 0x51def961, 0x515b6408, + 0xca6e823e, 0x382e6e74, 0xeebe3d71, 0x4c8f0c6a, 0xe676dcea, 0x14e1dc7c, + 0x6f7fc634, 0xcf85a943, 0xd39ea96e, 0x136e7c93, 0x7164b304, 0xf32f1333, + 0x35c34034, 0xde39d721, 0x91a87439, 0xc410111f, 0x29f17aac, 0x1316a6ff, + 0x12f194ee, 0x420b9499, 0xf72db0dc, 0x690b9f93, 0x17d14bb2, 0x8f931ab8, + 0x217500bc, 0x875413f8, 0x98b2e43d, 0xc51f9571, 0x54cebdca, 0x0719cc79, + 0xf3c7080d, 0xe4286771, 0xa3eab3cd, 0x4a6b00e0, 0x11cf0759, 0x7e897379, + 0x5b32876c, 0x5e8cd4f6, 0x0cedfa64, 0x919ac2c7, 0xb214f3b3, 0x0e89c38c, + 0xf0c43a39, 0xeae10522, 0x835bce06, 0x9eec43c2, 0xea26a9d6, 0x69531821, + 0x6725b24a, 0xda81b0e2, 0xd5b4ae33, 0x080f99fb, 0x15a83daf, 0x29dfc720, + 0x91e1900f, 0x28163d58, 0x83d107a2, 0x4eac149a, 0x9f71da18, 0x61d5c4fa, + 0xe3ab2a5f, 0xc7b0d63f, 0xb3cc752a, 0x61ebcfb6, 0x26ffb52a, 0xed789e3f, + 0xaa3bc958, 0x455a8788, 0xc9c082a9, 0x0a1bef0e, 0xc29a5a7e, 0x150d4735, + 0x943809e0, 0x69215510, 0xef0b0da9, 0x3b4e9fb3, 0xd8b5d04c, 0xc7a023a8, + 0xb0d50288, 0x64821375, 0xc260e8cf, 0x8496bd2c, 0xff4f5435, 0x0fb5560c, + 0x7cd74a52, 0x93589c80, 0x88975c47, 0x83bda89d, 0x8bcc4296, 0x01b82c21, + 0xfd821dbf, 0x26520b47, 0x04983e19, 0xd3e1ca27, 0x782c580f, 0x326ff573, + 0xc157bcc7, 0x4f5e6b84, 0x44ebfbfb, 0xda26d9d8, 0x6cd9d08e, 0x1719f1d8, + 0x715c0487, 0x2c2d3c92, 0x53faaba9, 0xbc836146, 0x510c92d6, 0xe089f82a, + 0x4680171f, 0x369f00de, 0x70ec2331, 0x0e253d55, 0xdafb9717, 0xe5dd922d, + 0x95915d21, 0xa0202f96, 0xa161cc47, 0xeacfa6f1, 0xed5e9189, 0xdab87684, + 0xa4b76d4a, 0xfa704897, 0x631f10ba, 0xd39da8f9, 0x5db4c0e4, 0x16fde42a, + 0x2dff7580, 0xb56fec7e, 0xc3ffb370, 0x8e6f36bc, 0x6097d459, 0x514d5d36, + 0xa5a737e2, 0x3977b9b3, 0xfd31a0ca, 0x903368db, 0xe8370d61, 0x98109520, + 0xade23cac, 0x99f82e04, 0x41de7ea3, 0x84a1c295, 0x09191be0, 0x30930d02, + 0x1c9fa44a, 0xc406b6d7, 0xeedca152, 0x6149809c, 0xb0099ef4, 0xc5f653a5, + 0x4c10790d, 0x7303286c +}; diff --git a/externals/libmpq/libmpq/explode.c b/externals/libmpq/libmpq/explode.c new file mode 100644 index 0000000..2d778d2 --- /dev/null +++ b/externals/libmpq/libmpq/explode.c @@ -0,0 +1,602 @@ +/* + * explode.c -- explode function of pkware data compression library. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * This source was adepted from the C++ version of pkware.cpp included + * in stormlib. The C++ version belongs to the following authors: + * + * Ladislav Zezula + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* generic includes. */ +#include + +/* libmpq main includes. */ +#include "mpq.h" + +/* libmpq generic includes. */ +#include "explode.h" + +/* tables used for data extraction. */ +static const uint8_t pkzip_dist_bits[] = { + 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 +}; + +/* tables used for data extraction. */ +static const uint8_t pkzip_dist_code[] = { + 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A, + 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C, + 0x74, 0x34, 0x54, 0x14, 0x64, 0x24, 0x44, 0x04, 0x78, 0x38, 0x58, 0x18, 0x68, 0x28, 0x48, 0x08, + 0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00 +}; + +/* tables used for data extraction. */ +static const uint8_t pkzip_clen_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 +}; + +/* tables used for data extraction. */ +static const uint16_t pkzip_len_base[] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x000A, 0x000E, 0x0016, 0x0026, 0x0046, 0x0086, 0x0106 +}; + +/* tables used for data extraction. */ +static const uint8_t pkzip_slen_bits[] = { + 0x03, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x07, 0x07 +}; + +/* tables used for data extraction. */ +static const uint8_t pkzip_len_code[] = { + 0x05, 0x03, 0x01, 0x06, 0x0A, 0x02, 0x0C, 0x14, 0x04, 0x18, 0x08, 0x30, 0x10, 0x20, 0x40, 0x00 +}; + +/* tables used for data extraction. */ +static const uint8_t pkzip_bits_asc[] = { + 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x07, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x04, 0x0A, 0x08, 0x0C, 0x0A, 0x0C, 0x0A, 0x08, 0x07, 0x07, 0x08, 0x09, 0x07, 0x06, 0x07, 0x08, + 0x07, 0x06, 0x07, 0x07, 0x07, 0x07, 0x08, 0x07, 0x07, 0x08, 0x08, 0x0C, 0x0B, 0x07, 0x09, 0x0B, + 0x0C, 0x06, 0x07, 0x06, 0x06, 0x05, 0x07, 0x08, 0x08, 0x06, 0x0B, 0x09, 0x06, 0x07, 0x06, 0x06, + 0x07, 0x0B, 0x06, 0x06, 0x06, 0x07, 0x09, 0x08, 0x09, 0x09, 0x0B, 0x08, 0x0B, 0x09, 0x0C, 0x08, + 0x0C, 0x05, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x0B, 0x07, 0x05, 0x06, 0x05, 0x05, + 0x06, 0x0A, 0x05, 0x05, 0x05, 0x05, 0x08, 0x07, 0x08, 0x08, 0x0A, 0x0B, 0x0B, 0x0C, 0x0C, 0x0C, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, + 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0C, 0x0D, + 0x0D, 0x0D, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D +}; + +/* tables used for data extraction. */ +static const uint16_t pkzip_code_asc[] = { + 0x0490, 0x0FE0, 0x07E0, 0x0BE0, 0x03E0, 0x0DE0, 0x05E0, 0x09E0, + 0x01E0, 0x00B8, 0x0062, 0x0EE0, 0x06E0, 0x0022, 0x0AE0, 0x02E0, + 0x0CE0, 0x04E0, 0x08E0, 0x00E0, 0x0F60, 0x0760, 0x0B60, 0x0360, + 0x0D60, 0x0560, 0x1240, 0x0960, 0x0160, 0x0E60, 0x0660, 0x0A60, + 0x000F, 0x0250, 0x0038, 0x0260, 0x0050, 0x0C60, 0x0390, 0x00D8, + 0x0042, 0x0002, 0x0058, 0x01B0, 0x007C, 0x0029, 0x003C, 0x0098, + 0x005C, 0x0009, 0x001C, 0x006C, 0x002C, 0x004C, 0x0018, 0x000C, + 0x0074, 0x00E8, 0x0068, 0x0460, 0x0090, 0x0034, 0x00B0, 0x0710, + 0x0860, 0x0031, 0x0054, 0x0011, 0x0021, 0x0017, 0x0014, 0x00A8, + 0x0028, 0x0001, 0x0310, 0x0130, 0x003E, 0x0064, 0x001E, 0x002E, + 0x0024, 0x0510, 0x000E, 0x0036, 0x0016, 0x0044, 0x0030, 0x00C8, + 0x01D0, 0x00D0, 0x0110, 0x0048, 0x0610, 0x0150, 0x0060, 0x0088, + 0x0FA0, 0x0007, 0x0026, 0x0006, 0x003A, 0x001B, 0x001A, 0x002A, + 0x000A, 0x000B, 0x0210, 0x0004, 0x0013, 0x0032, 0x0003, 0x001D, + 0x0012, 0x0190, 0x000D, 0x0015, 0x0005, 0x0019, 0x0008, 0x0078, + 0x00F0, 0x0070, 0x0290, 0x0410, 0x0010, 0x07A0, 0x0BA0, 0x03A0, + 0x0240, 0x1C40, 0x0C40, 0x1440, 0x0440, 0x1840, 0x0840, 0x1040, + 0x0040, 0x1F80, 0x0F80, 0x1780, 0x0780, 0x1B80, 0x0B80, 0x1380, + 0x0380, 0x1D80, 0x0D80, 0x1580, 0x0580, 0x1980, 0x0980, 0x1180, + 0x0180, 0x1E80, 0x0E80, 0x1680, 0x0680, 0x1A80, 0x0A80, 0x1280, + 0x0280, 0x1C80, 0x0C80, 0x1480, 0x0480, 0x1880, 0x0880, 0x1080, + 0x0080, 0x1F00, 0x0F00, 0x1700, 0x0700, 0x1B00, 0x0B00, 0x1300, + 0x0DA0, 0x05A0, 0x09A0, 0x01A0, 0x0EA0, 0x06A0, 0x0AA0, 0x02A0, + 0x0CA0, 0x04A0, 0x08A0, 0x00A0, 0x0F20, 0x0720, 0x0B20, 0x0320, + 0x0D20, 0x0520, 0x0920, 0x0120, 0x0E20, 0x0620, 0x0A20, 0x0220, + 0x0C20, 0x0420, 0x0820, 0x0020, 0x0FC0, 0x07C0, 0x0BC0, 0x03C0, + 0x0DC0, 0x05C0, 0x09C0, 0x01C0, 0x0EC0, 0x06C0, 0x0AC0, 0x02C0, + 0x0CC0, 0x04C0, 0x08C0, 0x00C0, 0x0F40, 0x0740, 0x0B40, 0x0340, + 0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900, + 0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600, + 0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200, + 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000 +}; + +/* local unused variables. */ +char pkware_copyright[] = "PKWARE Data Compression Library for Win32\r\n" + "Copyright 1989-1995 PKWARE Inc. All Rights Reserved\r\n" + "Patent No. 5,051,745\r\n" + "PKWARE Data Compression Library Reg. U.S. Pat. and Tm. Off.\r\n" + "Version 1.11\r\n"; + +/* skips given number of bits. */ +static int32_t skip_bit(pkzip_cmp_s *mpq_pkzip, uint32_t bits) { + + /* check if number of bits required is less than number of bits in the buffer. */ + if (bits <= mpq_pkzip->extra_bits) { + mpq_pkzip->extra_bits -= bits; + mpq_pkzip->bit_buf >>= bits; + return 0; + } + + /* load input buffer if necessary. */ + mpq_pkzip->bit_buf >>= mpq_pkzip->extra_bits; + if (mpq_pkzip->in_pos == mpq_pkzip->in_bytes) { + mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf); + if ((mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param)) == 0) { + return 1; + } + mpq_pkzip->in_pos = 0; + } + + /* update bit buffer. */ + mpq_pkzip->bit_buf |= (mpq_pkzip->in_buf[mpq_pkzip->in_pos++] << 8); + mpq_pkzip->bit_buf >>= (bits - mpq_pkzip->extra_bits); + mpq_pkzip->extra_bits = (mpq_pkzip->extra_bits - bits) + 8; + + /* if no error was found, return zero. */ + return 0; +} + +/* this function generate the decode tables used for decryption. */ +static void generate_tables_decode(int32_t count, uint8_t *bits, const uint8_t *code, uint8_t *buf2) { + + /* some common variables. */ + int32_t i; + + /* EBX - count */ + for (i = count-1; i >= 0; i--) { + + /* some common variables. */ + uint32_t idx1 = code[i]; + uint32_t idx2 = 1 << bits[i]; + + /* loop until table is ready. */ + do { + buf2[idx1] = (uint8_t)i; + idx1 += idx2; + } while (idx1 < 0x100); + } +} + +/* this function generate the tables for ascii decompression. */ +static void generate_tables_ascii(pkzip_cmp_s *mpq_pkzip) { + + /* some common variables. */ + const uint16_t *code_asc = &pkzip_code_asc[0xFF]; + uint32_t acc; + uint32_t add; + uint16_t count; + + /* loop through ascii table. */ + for (count = 0x00FF; code_asc >= pkzip_code_asc; code_asc--, count--) { + uint8_t *bits_asc = mpq_pkzip->bits_asc + count; + uint8_t bits_tmp = *bits_asc; + + /* check if byte is finished. */ + if (bits_tmp <= 8) { + add = (1 << bits_tmp); + acc = *code_asc; + do { + mpq_pkzip->offs_2c34[acc] = (uint8_t)count; + acc += add; + } while (acc < 0x100); + } else { + if ((acc = (*code_asc & 0xFF)) != 0) { + mpq_pkzip->offs_2c34[acc] = 0xFF; + if (*code_asc & 0x3F) { + + /* decrease bit by four. */ + bits_tmp -= 4; + *bits_asc = bits_tmp; + add = (1 << bits_tmp); + acc = *code_asc >> 4; + do { + mpq_pkzip->offs_2d34[acc] = (uint8_t)count; + acc += add; + } while (acc < 0x100); + } else { + + /* decrease bit by six. */ + bits_tmp -= 6; + *bits_asc = bits_tmp; + add = (1 << bits_tmp); + acc = *code_asc >> 6; + do { + mpq_pkzip->offs_2e34[acc] = (uint8_t)count; + acc += add; + } while (acc < 0x80); + } + } else { + + /* decrease bit by eight. (one byte) */ + bits_tmp -= 8; + *bits_asc = bits_tmp; + add = (1 << bits_tmp); + acc = *code_asc >> 8; + do { + mpq_pkzip->offs_2eb4[acc] = (uint8_t)count; + acc += add; + } while (acc < 0x100); + } + } + } +} + +/* + * decompress the imploded data using coded literals. + * + * returns: 0x000 - 0x0FF : one byte from compressed file. + * 0x100 - 0x305 : copy previous block. (0x100 = 1 byte) + * 0x306 : out of buffer? + */ +static uint32_t decode_literal(pkzip_cmp_s *mpq_pkzip) { + + /* number of bits to skip. */ + uint32_t bits; + + /* position in buffers. */ + uint32_t value; + + /* check if bit the current buffer is set, if not return the next byte. */ + if (mpq_pkzip->bit_buf & 1) { + + /* skip current bit in the buffer. */ + if (skip_bit(mpq_pkzip, 1)) { + return 0x306; + } + + /* the next bits are position in buffers. */ + value = mpq_pkzip->pos2[(mpq_pkzip->bit_buf & 0xFF)]; + + /* get number of bits to skip. */ + if (skip_bit(mpq_pkzip, mpq_pkzip->slen_bits[value])) { + return 0x306; + } + + /* check bits. */ + if ((bits = mpq_pkzip->clen_bits[value]) != 0) { + + /* some common variables. */ + uint32_t val2 = mpq_pkzip->bit_buf & ((1 << bits) - 1); + + /* check if we should skip one bit. */ + if (skip_bit(mpq_pkzip, bits)) { + + /* check position if we should skip the bit. */ + if ((value + val2) != 0x10E) { + return 0x306; + } + } + + /* fill values. */ + value = mpq_pkzip->len_base[value] + val2; + } + + /* return number of bytes to repeat. */ + return value + 0x100; + } + + /* skip one bit. */ + if (skip_bit(mpq_pkzip, 1)) { + return 0x306; + } + + /* check the binary compression type, read 8 bits and return them as one byte. */ + if (mpq_pkzip->cmp_type == LIBMPQ_PKZIP_CMP_BINARY) { + + /* fill values. */ + value = mpq_pkzip->bit_buf & 0xFF; + + /* check if we should skip one bit. */ + if (skip_bit(mpq_pkzip, 8)) { + return 0x306; + } + + /* return value from bit buffer. */ + return value; + } + + /* check if ascii compression is used. */ + if (mpq_pkzip->bit_buf & 0xFF) { + + /* fill values. */ + value = mpq_pkzip->offs_2c34[mpq_pkzip->bit_buf & 0xFF]; + + /* check value. */ + if (value == 0xFF) { + if (mpq_pkzip->bit_buf & 0x3F) { + + /* check if four bits are in bit buffer for skipping. */ + if (skip_bit(mpq_pkzip, 4)) { + return 0x306; + } + + /* fill values. */ + value = mpq_pkzip->offs_2d34[mpq_pkzip->bit_buf & 0xFF]; + } else { + + /* check if six bits are in bit buffer for skipping. */ + if (skip_bit(mpq_pkzip, 6)) { + return 0x306; + } + + /* fill values. */ + value = mpq_pkzip->offs_2e34[mpq_pkzip->bit_buf & 0x7F]; + } + } + } else { + + /* check if eight bits are in bit buffer for skipping. */ + if (skip_bit(mpq_pkzip, 8)) { + return 0x306; + } + + /* fill values. */ + value = mpq_pkzip->offs_2eb4[mpq_pkzip->bit_buf & 0xFF]; + } + + /* return out of buffer error (0x306) or position in buffer. */ + return skip_bit(mpq_pkzip, mpq_pkzip->bits_asc[value]) ? 0x306 : value; +} + +/* this function retrieves the number of bytes to move back. */ +static uint32_t decode_distance(pkzip_cmp_s *mpq_pkzip, uint32_t length) { + + /* some common variables. */ + uint32_t pos = mpq_pkzip->pos1[(mpq_pkzip->bit_buf & 0xFF)]; + + /* number of bits to skip. */ + uint32_t skip = mpq_pkzip->dist_bits[pos]; + + /* skip the appropriate number of bits. */ + if (skip_bit(mpq_pkzip, skip) == 1) { + return 0; + } + + /* check if length is two. */ + if (length == 2) { + pos = (pos << 2) | (mpq_pkzip->bit_buf & 0x03); + + /* skip the bits. */ + if (skip_bit(mpq_pkzip, 2) == 1) { + return 0; + } + } else { + pos = (pos << mpq_pkzip->dsize_bits) | (mpq_pkzip->bit_buf & mpq_pkzip->dsize_mask); + + /* skip the bits */ + if (skip_bit(mpq_pkzip, mpq_pkzip->dsize_bits) == 1) { + return 0; + } + } + + /* return the bytes to move back. */ + return pos + 1; +} + +/* + * function loads data from the input buffer used by mpq_pkzip + * "implode" and "explode" function as user defined callback and + * returns number of bytes loaded. + * + * char *buf - pointer to a buffer where to store loaded data. + * uint32_t *size - maximum number of bytes to read. + * void *param - custom pointer, parameter of implode/explode. + */ +static uint32_t data_read_input(char *buf, uint32_t *size, void *param) { + + /* some common variables. */ + pkzip_data_s *info = (pkzip_data_s *)param; + uint32_t max_avail = (info->in_bytes - info->in_pos); + uint32_t to_read = *size; + + /* check the case when not enough data available. */ + if (to_read > max_avail) { + to_read = max_avail; + } + + /* load data and increment offsets. */ + memcpy(buf, info->in_buf + info->in_pos, to_read); + info->in_pos += to_read; + + /* return bytes read. */ + return to_read; +} + +/* + * function for store output data used by mpq_pkzip "implode" and + * "explode" as userdefined callback. + * + * char *buf - pointer to data to be written. + * uint32_t *size - number of bytes to write. + * void *param - custom pointer, parameter of implode/explode. + */ +static void data_write_output(char *buf, uint32_t *size, void *param) { + + /* some common variables. */ + pkzip_data_s *info = (pkzip_data_s *)param; + uint32_t max_write = (info->max_out - info->out_pos); + uint32_t to_write = *size; + + /* check the case when not enough space in the output buffer. */ + if (to_write > max_write) { + to_write = max_write; + } + + /* write output data and increments offsets. */ + memcpy(info->out_buf + info->out_pos, buf, to_write); + info->out_pos += to_write; +} + +/* this function extract the data from input stream. */ +static uint32_t expand(pkzip_cmp_s *mpq_pkzip) { + + /* number of bytes to copy. */ + uint32_t copy_bytes; + + /* one byte from compressed file. */ + uint32_t one_byte; + + /* some common variables. */ + uint32_t result; + + /* initialize output buffer position. */ + mpq_pkzip->out_pos = 0x1000; + + /* check if end of data or error, so terminate decompress. */ + while ((result = one_byte = decode_literal(mpq_pkzip)) < 0x305) { + + /* check if one byte is greater than 0x100, which means 'repeat n - 0xFE bytes'. */ + if (one_byte >= 0x100) { + + /* ECX */ + uint8_t *source; + + /* EDX */ + uint8_t *target; + + /* some common variables. */ + uint32_t copy_length = one_byte - 0xFE; + uint32_t move_back; + + /* get length of data to copy. */ + if ((move_back = decode_distance(mpq_pkzip, copy_length)) == 0) { + result = 0x306; + break; + } + + /* target and source pointer. */ + target = &mpq_pkzip->out_buf[mpq_pkzip->out_pos]; + source = target - move_back; + mpq_pkzip->out_pos += copy_length; + + /* copy until nothing left. */ + while (copy_length-- > 0) { + *target++ = *source++; + } + } else { + + /* byte is 0x100 great, so add one byte. */ + mpq_pkzip->out_buf[mpq_pkzip->out_pos++] = (uint8_t)one_byte; + } + + /* check if number of extracted bytes has reached 1/2 of output buffer, so flush output buffer. */ + if (mpq_pkzip->out_pos >= 0x2000) { + + /* copy decompressed data into user buffer. */ + copy_bytes = 0x1000; + mpq_pkzip->write_buf((char *)&mpq_pkzip->out_buf[0x1000], ©_bytes, mpq_pkzip->param); + + /* check if there are some data left, keep them alive. */ + memcpy(mpq_pkzip->out_buf, &mpq_pkzip->out_buf[0x1000], mpq_pkzip->out_pos - 0x1000); + mpq_pkzip->out_pos -= 0x1000; + } + } + + /* copy the rest. */ + copy_bytes = mpq_pkzip->out_pos - 0x1000; + mpq_pkzip->write_buf((char *)&mpq_pkzip->out_buf[0x1000], ©_bytes, mpq_pkzip->param); + + /* return copied bytes. */ + return result; +} + +/* this function explode the data stream. */ +uint32_t libmpq__do_decompress_pkzip(uint8_t *work_buf, void *param) { + + /* some common variables. */ + pkzip_cmp_s *mpq_pkzip = (pkzip_cmp_s *)work_buf; + + /* set the whole work buffer to zeros. */ + memset(mpq_pkzip, 0, sizeof(pkzip_cmp_s)); + + /* initialize work struct and load compressed data. */ + mpq_pkzip->read_buf = data_read_input; + mpq_pkzip->write_buf = data_write_output; + mpq_pkzip->param = param; + mpq_pkzip->in_pos = sizeof(mpq_pkzip->in_buf); + mpq_pkzip->in_bytes = mpq_pkzip->read_buf((char *)mpq_pkzip->in_buf, &mpq_pkzip->in_pos, mpq_pkzip->param); + + /* check if we have pkzip data. */ + if (mpq_pkzip->in_bytes <= 4) { + return LIBMPQ_PKZIP_CMP_BAD_DATA; + } + + /* get the compression type. */ + mpq_pkzip->cmp_type = mpq_pkzip->in_buf[0]; + + /* get the dictionary size. */ + mpq_pkzip->dsize_bits = mpq_pkzip->in_buf[1]; + + /* initialize 16-bit bit buffer. */ + mpq_pkzip->bit_buf = mpq_pkzip->in_buf[2]; + + /* extra (over 8) bits. */ + mpq_pkzip->extra_bits = 0; + + /* position in input buffer. */ + mpq_pkzip->in_pos = 3; + + /* check if valid dictionary size. */ + if (4 > mpq_pkzip->dsize_bits || mpq_pkzip->dsize_bits > 6) { + return LIBMPQ_PKZIP_CMP_INV_DICTSIZE; + } + + /* shifted by 'sar' instruction. */ + mpq_pkzip->dsize_mask = 0xFFFF >> (0x10 - mpq_pkzip->dsize_bits); + + /* check if we are using binary compression. */ + if (mpq_pkzip->cmp_type != LIBMPQ_PKZIP_CMP_BINARY) { + + /* check if we are using ascii compression. */ + if (mpq_pkzip->cmp_type != LIBMPQ_PKZIP_CMP_ASCII) { + return LIBMPQ_PKZIP_CMP_INV_MODE; + } + + /* create ascii buffer. */ + memcpy(mpq_pkzip->bits_asc, pkzip_bits_asc, sizeof(mpq_pkzip->bits_asc)); + generate_tables_ascii(mpq_pkzip); + } + + /* create the tables for decode. */ + memcpy(mpq_pkzip->slen_bits, pkzip_slen_bits, sizeof(mpq_pkzip->slen_bits)); + generate_tables_decode(0x10, mpq_pkzip->slen_bits, pkzip_len_code, mpq_pkzip->pos2); + + /* create the tables for decode. */ + memcpy(mpq_pkzip->clen_bits, pkzip_clen_bits, sizeof(mpq_pkzip->clen_bits)); + memcpy(mpq_pkzip->len_base, pkzip_len_base, sizeof(mpq_pkzip->len_base)); + memcpy(mpq_pkzip->dist_bits, pkzip_dist_bits, sizeof(mpq_pkzip->dist_bits)); + generate_tables_decode(0x40, mpq_pkzip->dist_bits, pkzip_dist_code, mpq_pkzip->pos1); + + /* check if data extraction works. */ + if (expand(mpq_pkzip) != 0x306) { + return LIBMPQ_PKZIP_CMP_NO_ERROR; + } + + /* something failed, so return error. */ + return LIBMPQ_PKZIP_CMP_ABORT; +} diff --git a/externals/libmpq/libmpq/explode.h b/externals/libmpq/libmpq/explode.h new file mode 100644 index 0000000..1d14dfc --- /dev/null +++ b/externals/libmpq/libmpq/explode.h @@ -0,0 +1,87 @@ +/* + * explode.h -- header file for pkware data decompression library + * used by mpq-tools. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * This source was adepted from the C++ version of pklib.h included + * in stormlib. The C++ version belongs to the following authors: + * + * Ladislav Zezula + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _EXPLODE_H +#define _EXPLODE_H + +/* define compression constants and return values. */ +#define LIBMPQ_PKZIP_CMP_BINARY 0 /* binary compression. */ +#define LIBMPQ_PKZIP_CMP_ASCII 1 /* ascii compression. */ +#define LIBMPQ_PKZIP_CMP_NO_ERROR 0 +#define LIBMPQ_PKZIP_CMP_INV_DICTSIZE 1 +#define LIBMPQ_PKZIP_CMP_INV_MODE 2 +#define LIBMPQ_PKZIP_CMP_BAD_DATA 3 +#define LIBMPQ_PKZIP_CMP_ABORT 4 + +#include "pack_begin.h" +/* compression structure. */ +typedef struct { + uint32_t offs0000; /* 0000 - start. */ + uint32_t cmp_type; /* 0004 - compression type (binary or ascii). */ + uint32_t out_pos; /* 0008 - position in output buffer. */ + uint32_t dsize_bits; /* 000C - dict size (4, 5, 6 for 0x400, 0x800, 0x1000). */ + uint32_t dsize_mask; /* 0010 - dict size bitmask (0x0F, 0x1F, 0x3F for 0x400, 0x800, 0x1000). */ + uint32_t bit_buf; /* 0014 - 16-bit buffer for processing input data. */ + uint32_t extra_bits; /* 0018 - number of extra (above 8) bits in bit buffer. */ + uint32_t in_pos; /* 001C - position in in_buf. */ + uint32_t in_bytes; /* 0020 - number of bytes in input buffer. */ + void *param; /* 0024 - custom parameter. */ + uint32_t (*read_buf)(char *buf, uint32_t *size, void *param); /* 0028 offset.*/ + void (*write_buf)(char *buf, uint32_t *size, void *param); /* 002C offset. */ + uint8_t out_buf[0x2000]; /* 0030 - output circle buffer, starting position is 0x1000. */ + uint8_t offs_2030[0x204]; /* 2030 - whats that? */ + uint8_t in_buf[0x800]; /* 2234 - buffer for data to be decompressed. */ + uint8_t pos1[0x100]; /* 2A34 - positions in buffers. */ + uint8_t pos2[0x100]; /* 2B34 - positions in buffers. */ + uint8_t offs_2c34[0x100]; /* 2C34 - buffer. */ + uint8_t offs_2d34[0x100]; /* 2D34 - buffer. */ + uint8_t offs_2e34[0x80]; /* 2EB4 - buffer. */ + uint8_t offs_2eb4[0x100]; /* 2EB4 - buffer. */ + uint8_t bits_asc[0x100]; /* 2FB4 - buffer. */ + uint8_t dist_bits[0x40]; /* 30B4 - numbers of bytes to skip copied block length. */ + uint8_t slen_bits[0x10]; /* 30F4 - numbers of bits for skip copied block length. */ + uint8_t clen_bits[0x10]; /* 3104 - number of valid bits for copied block. */ + uint16_t len_base[0x10]; /* 3114 - buffer. */ +} PACK_STRUCT pkzip_cmp_s; +#include "pack_end.h" + +/* data structure. */ +typedef struct { + uint8_t *in_buf; /* pointer to input data buffer. */ + uint32_t in_pos; /* current offset in input data buffer. */ + int32_t in_bytes; /* number of bytes in the input buffer. */ + uint8_t *out_buf; /* pointer to output data buffer. */ + uint32_t out_pos; /* position in the output buffer. */ + int32_t max_out; /* maximum number of bytes in the output buffer. */ +} pkzip_data_s; + +/* decompress the stream using pkzip compression. */ +uint32_t libmpq__do_decompress_pkzip( + uint8_t *work_buf, + void *param +); + +#endif /* _EXPLODE_H */ diff --git a/externals/libmpq/libmpq/extract.c b/externals/libmpq/libmpq/extract.c new file mode 100644 index 0000000..11de107 --- /dev/null +++ b/externals/libmpq/libmpq/extract.c @@ -0,0 +1,361 @@ +/* + * extract.c -- global extracting function for all known file compressions + * in a mpq archive. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* generic includes. */ +#include +#include + +/* zlib includes. */ +#include +#include + +/* libmpq main includes. */ +#include "mpq.h" + +/* libmpq generic includes. */ +#include "explode.h" +#include "extract.h" +#include "huffman.h" +#include "wave.h" + +/* table with decompression bits and functions. */ +static decompress_table_s dcmp_table[] = { + {LIBMPQ_COMPRESSION_HUFFMAN, libmpq__decompress_huffman}, /* decompression using huffman trees. */ + {LIBMPQ_COMPRESSION_ZLIB, libmpq__decompress_zlib}, /* decompression with the zlib library. */ + {LIBMPQ_COMPRESSION_PKZIP, libmpq__decompress_pkzip}, /* decompression with pkware data compression library. */ + {LIBMPQ_COMPRESSION_BZIP2, libmpq__decompress_bzip2}, /* decompression with bzip2 library. */ + {LIBMPQ_COMPRESSION_WAVE_MONO, libmpq__decompress_wave_mono}, /* decompression for mono waves. */ + {LIBMPQ_COMPRESSION_WAVE_STEREO, libmpq__decompress_wave_stereo} /* decompression for stereo waves. */ +}; + +/* this function decompress a stream using huffman algorithm. */ +int32_t libmpq__decompress_huffman(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + + /* TODO: make typdefs of this structs? */ + /* some common variables. */ + int32_t tb = 0; + struct huffman_tree_s *ht; + struct huffman_input_stream_s *is; + + /* allocate memory for the huffman tree. */ + if ((ht = malloc(sizeof(struct huffman_tree_s))) == NULL || + (is = malloc(sizeof(struct huffman_input_stream_s))) == NULL) { + + /* memory allocation problem. */ + return LIBMPQ_ERROR_MALLOC; + } + + /* cleanup structures. */ + memset(ht, 0, sizeof(struct huffman_tree_s)); + memset(is, 0, sizeof(struct huffman_input_stream_s)); + + /* initialize input stream. */ + is->bit_buf = *(uint32_t *)in_buf; + in_buf += sizeof(int32_t); + is->in_buf = (uint8_t *)in_buf; + is->bits = 32; + +// TODO: add all the mallocs to init function and add function libmpq__huffman_tree_free() */ +// if ((result = libmpq__huffman_tree_init(ht, LIBMPQ_HUFF_DECOMPRESS)) < 0) { +// +// /* something on zlib initialization failed. */ +// return LIBMPQ_ERROR_UNPACK; +// } + + /* initialize the huffman tree for decompression. */ + libmpq__huffman_tree_init(ht, LIBMPQ_HUFF_DECOMPRESS); + + /* save the number of copied bytes. */ + tb = libmpq__do_decompress_huffman(ht, is, out_buf, out_size); + + /* free structures. */ + free(is); + free(ht); + + /* return transferred bytes. */ + return tb; +} + +/* this function decompress a stream using zlib algorithm. */ +int32_t libmpq__decompress_zlib(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + + /* some common variables. */ + int32_t result = 0; + int32_t tb = 0; + z_stream z; + + /* fill the stream structure for zlib. */ + z.next_in = (Bytef *)in_buf; + z.avail_in = (uInt)in_size; + z.total_in = in_size; + z.next_out = (Bytef *)out_buf; + z.avail_out = (uInt)out_size; + z.total_out = 0; + z.zalloc = NULL; + z.zfree = NULL; + + /* initialize the decompression structure, storm.dll uses zlib version 1.1.3. */ + if ((result = inflateInit(&z)) != Z_OK) { + + /* something on zlib initialization failed. */ + return result; + } + + /* call zlib to decompress the data. */ + if ((result = inflate(&z, Z_FINISH)) != Z_STREAM_END) { + + /* something on zlib decompression failed. */ + return result; + } + + /* save transferred bytes. */ + tb = z.total_out; + + /* cleanup zlib. */ + if ((result = inflateEnd(&z)) != Z_OK) { + + /* something on zlib finalization failed. */ + return result; + } + + /* return transferred bytes. */ + return tb; +} + +/* this function decompress a stream using pkzip algorithm. */ +int32_t libmpq__decompress_pkzip(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + + /* some common variables. */ + int32_t tb = 0; + uint8_t *work_buf; + pkzip_data_s info; + + /* allocate memory for pkzip data structure. */ + if ((work_buf = malloc(sizeof(pkzip_cmp_s))) == NULL) { + + /* memory allocation problem. */ + return LIBMPQ_ERROR_MALLOC; + } + + /* cleanup. */ + memset(work_buf, 0, sizeof(pkzip_cmp_s)); + + /* fill data information structure. */ + info.in_buf = in_buf; + info.in_pos = 0; + info.in_bytes = in_size; + info.out_buf = out_buf; + info.out_pos = 0; + info.max_out = out_size; + + /* do the decompression. */ + if ((tb = libmpq__do_decompress_pkzip(work_buf, &info)) < 0) { + + /* free working buffer. */ + free(work_buf); + + /* something failed on pkzip decompression. */ + return tb; + } + + /* save transferred bytes. */ + tb = info.out_pos; + + /* free working buffer. */ + free(work_buf); + + /* return transferred bytes. */ + return tb; +} + +/* this function decompress a stream using bzip2 library. */ +int32_t libmpq__decompress_bzip2(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + + /* some common variables. */ + int32_t result = 0; + int32_t tb = 0; + bz_stream strm; + + /* initialize the bzlib decompression. */ + strm.bzalloc = NULL; + strm.bzfree = NULL; + + /* initialize the structure. */ + if ((result = BZ2_bzDecompressInit(&strm, 0, 0)) != BZ_OK) { + + /* something on bzlib initialization failed. */ + return result; + } + + /* fill the stream structure for bzlib. */ + strm.next_in = (char *)in_buf; + strm.avail_in = in_size; + strm.next_out = (char *)out_buf; + strm.avail_out = out_size; + + /* do the decompression. */ + while (BZ2_bzDecompress(&strm) != BZ_STREAM_END); + + /* save transferred bytes. */ + tb = strm.total_out_lo32; + + /* cleanup of bzip stream. */ + BZ2_bzDecompressEnd(&strm); + + /* return transferred bytes. */ + return tb; +} + +/* this function decompress a stream using wave algorithm. (1 channel) */ +int32_t libmpq__decompress_wave_mono(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + + /* some common variables. */ + int32_t tb = 0; + + /* save the number of copied bytes. */ + if ((tb = libmpq__do_decompress_wave(out_buf, out_size, in_buf, in_size, 1)) < 0) { + + /* something on wave decompression failed. */ + return tb; + } + + /* return transferred bytes. */ + return tb; +} + +/* this function decompress a stream using wave algorithm. (2 channels) */ +int32_t libmpq__decompress_wave_stereo(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + + /* some common variables. */ + int32_t tb = 0; + + /* save the number of copied bytes. */ + if ((tb = libmpq__do_decompress_wave(out_buf, out_size, in_buf, in_size, 2)) < 0) { + + /* something on wave decompression failed. */ + return tb; + } + + /* return transferred bytes. */ + return tb; +} + +/* this function decompress a stream using a combination of the other compression algorithm. */ +int32_t libmpq__decompress_multi(uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + + /* some common variables. */ + int32_t tb = 0; + uint32_t count = 0; + uint32_t entries = (sizeof(dcmp_table) / sizeof(decompress_table_s)); + uint8_t *temp_buf = NULL; + uint8_t *work_buf = 0; + uint8_t decompress_flag, decompress_unsupp; + uint32_t i; + + /* get applied compression types. */ + decompress_flag = decompress_unsupp = *in_buf++; + + /* decrement data size. */ + in_size--; + + /* search decompression table type and get all types of compression. */ + for (i = 0; i < entries; i++) { + + /* check if have to apply this decompression. */ + if (decompress_flag & dcmp_table[i].mask) { + + /* increase counter for used compression algorithms. */ + count++; + /* this algorithm is supported, remove from unsupp mask */ + decompress_unsupp &= ~dcmp_table[i].mask; + } + } + + /* check if there is some method unhandled. (e.g. compressed by future versions) */ + if (decompress_unsupp) { + + /* compression type is unknown and we need to implement it. :) */ + return LIBMPQ_ERROR_UNPACK; + } + + /* if multiple decompressions should be made, we need temporary buffer for the data. */ + if (count > 1) { + + /* allocate memory for temporary buffer. */ + if ((temp_buf = malloc(out_size)) == NULL) { + + /* memory allocation problem. */ + return LIBMPQ_ERROR_MALLOC; + } + + /* cleanup. */ + memset(temp_buf, 0, out_size); + } + + /* apply all decompressions. */ + for (i = 0, count = 0; i < entries; i++) { + + /* check if not used this kind of compression. */ + if (decompress_flag & dcmp_table[i].mask) { + + /* if multiple decompressions should be made, we need temporary buffer for the data. */ + if (count == 0) { + + /* use output buffer as working buffer. */ + work_buf = out_buf; + } else { + + /* use temporary buffer as working buffer. */ + work_buf = temp_buf; + } + + /* decompress buffer using corresponding function. */ + if ((tb = dcmp_table[i].decompress(in_buf, in_size, work_buf, out_size)) < 0) { + + /* free temporary buffer. */ + free(temp_buf); + + /* something on decompression failed. */ + return tb; + } + + /* move output size to source size for next compression. */ + in_size = out_size; + in_buf = work_buf; + + /* increase counter. */ + count++; + } + } + + /* if output buffer is not the same like target buffer, we have to copy data (this will happen on multiple decompressions). */ + if (work_buf != out_buf) { + + /* copy buffer. */ + memcpy(out_buf, in_buf, out_size); + } + + /* free temporary buffer. */ + free(temp_buf); + + /* return transferred bytes. */ + return tb; +} diff --git a/externals/libmpq/libmpq/extract.h b/externals/libmpq/libmpq/extract.h new file mode 100644 index 0000000..d6ea794 --- /dev/null +++ b/externals/libmpq/libmpq/extract.h @@ -0,0 +1,106 @@ +/* + * extract.h -- header for the extraction functions used by mpq-tools. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _EXTRACT_H +#define _EXTRACT_H + +/* define compression types for multilpe compressions. */ +#define LIBMPQ_COMPRESSION_HUFFMAN 0x01 /* huffman compression. (used on wave files only and introduced in starcraft) */ +#define LIBMPQ_COMPRESSION_ZLIB 0x02 /* zlib compression. (introduced in warcraft 3) */ +#define LIBMPQ_COMPRESSION_PKZIP 0x08 /* pkware dcl compression. (first used compression algorithm) */ +#define LIBMPQ_COMPRESSION_BZIP2 0x10 /* bzip compression. (introduced in warcraft 3 - the frozen throne) */ +#define LIBMPQ_COMPRESSION_WAVE_MONO 0x40 /* adpcm 4:1 compression. (introduced in starcraft) */ +#define LIBMPQ_COMPRESSION_WAVE_STEREO 0x80 /* adpcm 4:1 compression. (introduced in starcraft) */ + +/* + * table for decompression functions, return value for all functions + * is the transferred data size or one of the following error constants: + * + * LIBMPQ_ERROR_MALLOC + * LIBMPQ_ERROR_DECOMPRESS + */ +typedef int32_t (*DECOMPRESS)(uint8_t *, uint32_t, uint8_t *, uint32_t); +typedef struct { + uint32_t mask; /* decompression bit. */ + DECOMPRESS decompress; /* decompression function. */ +} decompress_table_s; + +/* + * huffman decompression routine, the in_size parameter is not used, + * but needs to be specified due to compatibility reasons. + * + * 1500F5F0 + */ +extern int32_t libmpq__decompress_huffman( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size +); + +/* decompression using zlib. */ +extern int32_t libmpq__decompress_zlib( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size +); + +/* decompression using pkzip. */ +extern int32_t libmpq__decompress_pkzip( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size +); + +/* decompression using bzip2. */ +extern int32_t libmpq__decompress_bzip2( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size +); + +/* decompression using wave. (1 channel) */ +extern int32_t libmpq__decompress_wave_mono( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size +); + +/* decompression using wave. (2 channels) */ +extern int32_t libmpq__decompress_wave_stereo( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size +); + +/* decompression using multiple of the above algorithm. */ +extern int32_t libmpq__decompress_multi( + uint8_t *in_buf, + uint32_t in_size, + uint8_t *out_buf, + uint32_t out_size +); + +#endif /* _EXTRACT_H */ diff --git a/externals/libmpq/libmpq/huffman.c b/externals/libmpq/libmpq/huffman.c new file mode 100644 index 0000000..8fc87be --- /dev/null +++ b/externals/libmpq/libmpq/huffman.c @@ -0,0 +1,1101 @@ +/* + * huffman.c -- functions do decompress files in mpq files which + * uses a modified huffman version. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * Differences between C++ and C version: + * + * - Removed the object oriented stuff. + * - Replaced the goto things with some better C code. + * + * This source was adepted from the C++ version of huffman.cpp included + * in stormlib. The C++ version belongs to the following authors: + * + * Ladislav Zezula + * ShadowFlare + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* generic includes. */ +#include +#include + +/* libmpq main includes. */ +#include "mpq.h" +#include "mpq-internal.h" + +/* libmpq generic includes. */ +#include "huffman.h" + +/* tables for huffman tree. */ +static const uint8_t table_1502A630[] = { + + /* data for compression type 0x00. */ + 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, + + /* data for compression type 0x01. */ + 0x54, 0x16, 0x16, 0x0D, 0x0C, 0x08, 0x06, 0x05, 0x06, 0x05, 0x06, 0x03, 0x04, 0x04, 0x03, 0x05, + 0x0E, 0x0B, 0x14, 0x13, 0x13, 0x09, 0x0B, 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, + 0x0D, 0x07, 0x09, 0x06, 0x06, 0x04, 0x03, 0x02, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, + 0x09, 0x06, 0x04, 0x04, 0x04, 0x04, 0x03, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x04, + 0x08, 0x03, 0x04, 0x07, 0x09, 0x05, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, + 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, + 0x06, 0x0A, 0x08, 0x08, 0x06, 0x07, 0x04, 0x03, 0x04, 0x04, 0x02, 0x02, 0x04, 0x02, 0x03, 0x03, + 0x04, 0x03, 0x07, 0x07, 0x09, 0x06, 0x04, 0x03, 0x03, 0x02, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, + 0x0A, 0x02, 0x02, 0x03, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x06, 0x03, 0x05, 0x02, 0x03, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x03, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x09, 0x08, 0x0C, 0x02, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x03, + 0x04, 0x01, 0x02, 0x04, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x02, 0x02, 0x06, 0x4B, + 0x00, 0x00, + + /* data for compression type 0x02. */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x27, 0x00, 0x00, 0x23, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x06, 0x0E, 0x10, 0x04, + 0x06, 0x08, 0x05, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x01, 0x01, 0x02, 0x01, 0x01, + 0x01, 0x04, 0x02, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01, 0x04, 0x01, 0x01, 0x02, 0x03, 0x03, 0x02, + 0x03, 0x01, 0x03, 0x06, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, + 0x01, 0x29, 0x07, 0x16, 0x12, 0x40, 0x0A, 0x0A, 0x11, 0x25, 0x01, 0x03, 0x17, 0x10, 0x26, 0x2A, + 0x10, 0x01, 0x23, 0x23, 0x2F, 0x10, 0x06, 0x07, 0x02, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + + /* data for compression type 0x03. */ + 0xFF, 0x0B, 0x07, 0x05, 0x0B, 0x02, 0x02, 0x02, 0x06, 0x02, 0x02, 0x01, 0x04, 0x02, 0x01, 0x03, + 0x09, 0x01, 0x01, 0x01, 0x03, 0x04, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x05, 0x01, 0x01, 0x01, 0x0D, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x0A, 0x04, 0x02, 0x01, 0x06, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x01, + 0x05, 0x02, 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x03, 0x03, + 0x01, 0x03, 0x01, 0x01, 0x02, 0x05, 0x01, 0x01, 0x04, 0x03, 0x05, 0x01, 0x03, 0x01, 0x03, 0x03, + 0x02, 0x01, 0x04, 0x03, 0x0A, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x02, 0x01, 0x0A, 0x02, 0x05, 0x01, 0x01, 0x02, 0x07, 0x02, 0x17, 0x01, 0x05, 0x01, 0x01, + 0x0E, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x06, 0x02, 0x01, 0x04, 0x05, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x11, + 0x00, 0x00, + + /* data for compression type 0x04. */ + 0xFF, 0xFB, 0x98, 0x9A, 0x84, 0x85, 0x63, 0x64, 0x3E, 0x3E, 0x22, 0x22, 0x13, 0x13, 0x18, 0x17, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + + /* data for compression type 0x05. */ + 0xFF, 0xF1, 0x9D, 0x9E, 0x9A, 0x9B, 0x9A, 0x97, 0x93, 0x93, 0x8C, 0x8E, 0x86, 0x88, 0x80, 0x82, + 0x7C, 0x7C, 0x72, 0x73, 0x69, 0x6B, 0x5F, 0x60, 0x55, 0x56, 0x4A, 0x4B, 0x40, 0x41, 0x37, 0x37, + 0x2F, 0x2F, 0x27, 0x27, 0x21, 0x21, 0x1B, 0x1C, 0x17, 0x17, 0x13, 0x13, 0x10, 0x10, 0x0D, 0x0D, + 0x0B, 0x0B, 0x09, 0x09, 0x08, 0x08, 0x07, 0x07, 0x06, 0x05, 0x05, 0x04, 0x04, 0x04, 0x19, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + + /* data for compression type 0x06. */ + 0xC3, 0xCB, 0xF5, 0x41, 0xFF, 0x7B, 0xF7, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xBF, 0xCC, 0xF2, 0x40, 0xFD, 0x7C, 0xF7, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7A, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + + /* data for compression type 0x07. */ + 0xC3, 0xD9, 0xEF, 0x3D, 0xF9, 0x7C, 0xE9, 0x1E, 0xFD, 0xAB, 0xF1, 0x2C, 0xFC, 0x5B, 0xFE, 0x17, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xBD, 0xD9, 0xEC, 0x3D, 0xF5, 0x7D, 0xE8, 0x1D, 0xFB, 0xAE, 0xF0, 0x2C, 0xFB, 0x5C, 0xFF, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + + /* data for compression type 0x08. */ + 0xBA, 0xC5, 0xDA, 0x33, 0xE3, 0x6D, 0xD8, 0x18, 0xE5, 0x94, 0xDA, 0x23, 0xDF, 0x4A, 0xD1, 0x10, + 0xEE, 0xAF, 0xE4, 0x2C, 0xEA, 0x5A, 0xDE, 0x15, 0xF4, 0x87, 0xE9, 0x21, 0xF6, 0x43, 0xFC, 0x12, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xB0, 0xC7, 0xD8, 0x33, 0xE3, 0x6B, 0xD6, 0x18, 0xE7, 0x95, 0xD8, 0x23, 0xDB, 0x49, 0xD0, 0x11, + 0xE9, 0xB2, 0xE2, 0x2B, 0xE8, 0x5C, 0xDD, 0x15, 0xF1, 0x87, 0xE7, 0x20, 0xF7, 0x44, 0xFF, 0x13, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5F, 0x9E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 +}; + +/* this function insert an item to a huffman tree. */ +void libmpq__huffman_insert_item(struct huffman_tree_item_s **p_item, struct huffman_tree_item_s *item, uint32_t where, struct huffman_tree_item_s *item2) { + + /* EDI - next to the first item. */ + struct huffman_tree_item_s *next = item->next; + + /* ESI - prev to the first item. */ + struct huffman_tree_item_s *prev = item->prev; + + /* pointer to previous item. */ + struct huffman_tree_item_s *prev2; + + /* pointer to next item. */ + long next2; + + /* check the first item already has next one. */ + if (next != 0) { + + /* check if previous item exist. */ + if (PTR_INT(prev) < 0) { + + /* return previous item. */ + prev = PTR_NOT(prev); + } else { + + /* add item. */ + prev += (item - next->prev); + } + + /* 150083C1 - remove the item from the tree. */ + prev->next = next; + next->prev = prev; + + /* invalidate prev and next pointer. */ + item->next = 0; + item->prev = 0; + } + + /* EDX - check if the second item is not entered. */ + if (item2 == NULL) { + + /* take the first tree item. */ + item2 = PTR_PTR(&p_item[1]); + } + + /* check if items should be switched or new one inserted. */ + switch (where) { + case SWITCH_ITEMS: + + /* item2->next (pointer to pointer to first). */ + item->next = item2->next; + item->prev = item2->next->prev; + item2->next->prev = item; + + /* set the first item. */ + item2->next = item; + + /* return from function. */ + return; + case INSERT_ITEM: + + /* set next item (or pointer to pointer to first item) - insert as last item. */ + item->next = item2; + + /* set previous item (or last item in the tree). */ + item->prev = item2->prev; + + /* usually NULL. */ + next2 = PTR_INT(p_item[0]); + + /* previous item to the second (or last tree item). */ + prev2 = item2->prev; + + /* check if previous item is a valid pointer. */ + if (PTR_INT(prev2) < 0) { + + /* set values. */ + prev2 = PTR_NOT(prev); + prev2->next = item; + + /* next after last item. */ + item2->prev = item; + + /* return from function. */ + return; + } + + /* check if next item is empty. */ + if (next2 < 0) { + + /* set next item. */ + next2 = item2 - item2->next->prev; + } + + /* add next item to previous one. */ + prev2 += next2; + prev2->next = item; + + /* set the next and last item. */ + item2->prev = item; + + /* return from function. */ + return; + default: + + /* nothing to do, so return from function. */ + return; + } +} + +/* 1500BC90 - remove item from huffman tree.*/ +void libmpq__huffman_remove_item(struct huffman_tree_item_s *hi) { + + /* EDX - some common variables. */ + struct huffman_tree_item_s *temp; + + /* check if next item is not empty. */ + if (hi->next != NULL) { + + /* fetch previous item. */ + temp = hi->prev; + + /* check if previous item is a pointer. */ + if (PTR_INT(temp) <= 0) { + temp = PTR_NOT(temp); + } else { + temp += (hi - hi->next->prev); + } + + /* reorganize tree. */ + temp->next = hi->next; + hi->next->prev = hi->prev; + hi->next = hi->prev = NULL; + } +} + +/* get previous huffman tree item. */ +struct huffman_tree_item_s *libmpq__huffman_previous_item(struct huffman_tree_item_s *hi, long value) { + + /* check if previous item exist. */ + if (PTR_INT(hi->prev) < 0) { + + /* return previous item. */ + return PTR_NOT(hi->prev); + } + + /* check if something else should returned. */ + if (value < 0) { + + /* fetch previous item of next item. */ + value = hi - hi->next->prev; + } + + /* return previous item with value. */ + return hi->prev + value; +} + +/* get one bit from input stream. */ +uint32_t libmpq__huffman_get_1bit(struct huffman_input_stream_s *is) { + + /* some common variables. */ + uint32_t bit = (is->bit_buf & 1); + + /* shift bit right by one. */ + is->bit_buf >>= 1; + + /* check if we should extract bits. */ + if (--is->bits == 0) { + is->bit_buf = *(uint32_t *)is->in_buf; + is->in_buf += sizeof(int32_t); + is->bits = 32; + } + + /* return the bit. */ + return bit; +} + +/* get 7 bits from the input stream. */ +uint32_t libmpq__huffman_get_7bit(struct huffman_input_stream_s *is) { + + /* check if we should extract bits. */ + if (is->bits <= 7) { + is->bit_buf |= *(uint16_t *)is->in_buf << is->bits; + is->in_buf += sizeof(int16_t); + is->bits += 16; + } + + /* get 7 bits from input stream. */ + return (is->bit_buf & 0x7F); +} + +/* get the whole byte from the input stream. */ +uint32_t libmpq__huffman_get_8bit(struct huffman_input_stream_s *is) { + + /* some common variables. */ + uint32_t one_byte; + + /* check if we should extract bits. */ + if (is->bits <= 8) { + is->bit_buf |= *(uint16_t *)is->in_buf << is->bits; + is->in_buf += sizeof(int16_t); + is->bits += 16; + } + + /* fill values. */ + one_byte = (is->bit_buf & 0xFF); + is->bit_buf >>= 8; + is->bits -= 8; + + /* return the 8 bits. */ + return one_byte; +} + +/* return struct for 1500E740. */ +struct huffman_tree_item_s *libmpq__huffman_call_1500E740(struct huffman_tree_s *ht) { + + /* EDX */ + struct huffman_tree_item_s *p_item1 = ht->item3058; + + /* EAX */ + struct huffman_tree_item_s *p_item2; + + /* some common variables. */ + struct huffman_tree_item_s *p_next; + struct huffman_tree_item_s *p_prev; + struct huffman_tree_item_s **pp_item; + + /* check if item is empty. */ + if (PTR_INT(p_item1) <= 0 || (p_item2 = p_item1) == NULL) { + + /* check if item is not empty. */ + if ((p_item2 = &ht->items0008[ht->items++]) != NULL) { + p_item1 = p_item2; + } else { + p_item1 = ht->first; + } + } else { + p_item1 = p_item2; + } + + /* set next item. */ + p_next = p_item1->next; + + /* check if next item is not empty. */ + if (p_next != NULL) { + + /* set previous item. */ + p_prev = p_item1->prev; + + /* check if previous item is a valid pointer. */ + if (PTR_INT(p_prev) <= 0) { + p_prev = PTR_NOT(p_prev); + } else { + p_prev += (p_item1 - p_item1->next->prev); + } + + /* fill values. */ + p_prev->next = p_next; + p_next->prev = p_prev; + p_item1->next = NULL; + p_item1->prev = NULL; + } + + /* ESI */ + pp_item = &ht->first; + p_item1->next = (struct huffman_tree_item_s *)pp_item; + p_item1->prev = pp_item[1]; + + /* EDI = ht->item305C - ECX */ + p_prev = pp_item[1]; + + /* check if previous pointer is valid. */ + if (p_prev <= 0) { + + /* fill values. */ + p_prev = PTR_NOT(p_prev); + p_prev->next = p_item1; + p_prev->prev = p_item2; + p_item2->parent = NULL; + p_item2->child = NULL; + } else { + + /* check if pointer is valid. */ + if (PTR_INT(ht->item305C) < 0) { + p_prev += (struct huffman_tree_item_s *)pp_item - (*pp_item)->prev; + } else { + p_prev += PTR_INT(ht->item305C); + } + + /* fill values. */ + p_prev->next = p_item1; + pp_item[1] = p_item2; + p_item2->parent = NULL; + p_item2->child = NULL; + } + + /* return item. */ + return p_item2; +} + +/* return struct for 1500E820. */ +void libmpq__huffman_call_1500E820(struct huffman_tree_s *ht, struct huffman_tree_item_s *p_item) { + + /* EDI */ + struct huffman_tree_item_s *p_item1; + + /* EAX */ + struct huffman_tree_item_s *p_item2 = NULL; + + /* EDX */ + struct huffman_tree_item_s *p_item3; + + /* EBX */ + struct huffman_tree_item_s *p_prev; + + /* loop through parent items. */ + for (; p_item != NULL; p_item = p_item->parent) { + + /* increase byte counter. */ + p_item->byte_value++; + + /* loop through previous items. */ + for (p_item1 = p_item; ; p_item1 = p_prev) { + + /* set previous item. */ + p_prev = p_item1->prev; + + /* check if pointer is valid. */ + if (PTR_INT(p_prev) <= 0) { + p_prev = NULL; + break; + } + + /* check if byte value of previous item is higher than actual item. */ + if (p_prev->byte_value >= p_item->byte_value) { + break; + } + } + + /* check if previous item is same like actual item. */ + if (p_item1 == p_item) { + continue; + } + + /* check if next item is not empty, */ + if (p_item1->next != NULL) { + + /* fill values. */ + p_item2 = libmpq__huffman_previous_item(p_item1, -1); + p_item2->next = p_item1->next; + p_item1->next->prev = p_item1->prev; + p_item1->next = NULL; + p_item1->prev = NULL; + } + + /* fill values. */ + p_item2 = p_item->next; + p_item1->next = p_item2; + p_item1->prev = p_item2->prev; + p_item2->prev = p_item1; + p_item->next = p_item1; + + /* check if both items are not empty. */ + if ((p_item2 = p_item1) != NULL) { + + /* fill values. */ + p_item2 = libmpq__huffman_previous_item(p_item, -1); + p_item2->next = p_item->next; + p_item->next->prev = p_item->prev; + p_item->next = NULL; + p_item->prev = NULL; + } + + /* check if previous item is empty. */ + if (p_prev == NULL) { + p_prev = PTR_PTR(&ht->first); + } + + /* fill values. */ + p_item2 = p_prev->next; + p_item->next = p_item2; + p_item->prev = p_item2->prev; + p_item2->prev = p_item; + p_prev->next = p_item; + p_item3 = p_item1->parent->child; + p_item2 = p_item->parent; + + /* check if child item and parent item match. */ + if (p_item2->child == p_item) { + p_item2->child = p_item1; + } + + /* check if items match. */ + if (p_item3 == p_item1) { + p_item1->parent->child = p_item; + } + + /* fill values. */ + p_item2 = p_item->parent; + p_item->parent = p_item1->parent; + p_item1->parent = p_item2; + + /* increase counter. */ + ht->offs0004++; + } +} + +/* this function initialize a huffman tree. */ +void libmpq__huffman_tree_init(struct huffman_tree_s *ht, uint32_t cmp) { + + /* some common variables. */ + uint32_t count; + struct huffman_tree_item_s *hi; + + /* clear links for all the items in the tree. */ + for (hi = ht->items0008, count = 0x203; count != 0; hi++, count--) { + hi->next = hi->prev = NULL; + } + + /* fill values. */ + ht->item3050 = NULL; + ht->item3054 = PTR_PTR(&ht->item3054); + ht->item3058 = PTR_NOT(ht->item3054); + ht->item305C = NULL; + ht->first = PTR_PTR(&ht->first); + ht->last = PTR_NOT(ht->first); + ht->offs0004 = 1; + ht->items = 0; + + /* clear all huffman decompress items, do this only if preparing for decompression. */ + if (cmp == LIBMPQ_HUFF_DECOMPRESS) { + for (count = 0; count < sizeof(ht->qd3474) / sizeof(struct huffman_decompress_s); count++) { + ht->qd3474[count].offs00 = 0; + } + } +} + +/* this function build a huffman tree, called with the first 8 bits loaded from input stream. */ +void libmpq__huffman_tree_build(struct huffman_tree_s *ht, uint32_t cmp_type) { + + /* [ESP+10] - the greatest character found in table. */ + uint32_t max_byte; + + /* [ESP+1C] - pointer to uint8_t in table_1502A630. */ + const uint8_t *byte_array; + + /* thats needed to replace the goto stuff from original source. :) */ + uint32_t found; + + /* [ESP+14] - Pointer to Huffman tree item pointer array. */ + struct huffman_tree_item_s **p_item; + struct huffman_tree_item_s *child1; + + /* some common variables. */ + uint32_t i; + + /* ESI - loop while pointer has a negative value (last entry). */ + while (PTR_INT(ht->last) > 0) { + + /* EAX */ + struct huffman_tree_item_s *temp; + + /* ESI->next */ + if (ht->last->next != NULL) { + libmpq__huffman_remove_item(ht->last); + } + + /* [EDI+4] */ + ht->item3058 = PTR_PTR(&ht->item3054); + + /* EAX */ + ht->last->prev = ht->item3058; + temp = libmpq__huffman_previous_item(PTR_PTR(&ht->item3054), PTR_INT(&ht->item3050)); + temp->next = ht->last; + ht->item3054 = ht->last; + } + + /* clear all pointers in huffman tree item array. */ + memset(ht->items306C, 0, sizeof(ht->items306C)); + + /* greatest character found init to zero. */ + max_byte = 0; + + /* pointer to current entry in huffman tree item pointer array. */ + p_item = (struct huffman_tree_item_s **)&ht->items306C; + + /* ensure we have low 8 bits only. */ + cmp_type &= 0xFF; + + /* EDI also. */ + byte_array = table_1502A630 + cmp_type * 258; + + /* loop to build huffman tree. */ + for (i = 0; i < 0x100; i++, p_item++) { + + /* item to be created. */ + struct huffman_tree_item_s *item = ht->item3058; + struct huffman_tree_item_s *p_item3 = ht->item3058; + uint8_t one_byte = byte_array[i]; + + /* skip all the bytes which are zero. */ + if (byte_array[i] == 0) { + continue; + } + + /* if not valid pointer, take the first available item in the array. */ + if (PTR_INT(item) <= 0) { + item = &ht->items0008[ht->items++]; + } + + /* insert this item as the top of the tree. */ + libmpq__huffman_insert_item(&ht->item305C, item, SWITCH_ITEMS, NULL); + + /* invalidate child and parent. */ + item->parent = NULL; + item->child = NULL; + + /* store pointer into pointer array. */ + *p_item = item; + + /* store counter. */ + item->dcmp_byte = i; + + /* store byte value. */ + item->byte_value = one_byte; + + /* check if byte is to big. */ + if (one_byte >= max_byte) { + + /* set max byte to highest value. */ + max_byte = one_byte; + + /* continue loop. */ + continue; + } + + /* find the first item which has byte value greater than current one byte. */ + found = 0; + + /* EDI - Pointer to the last item. */ + if (PTR_INT((p_item3 = ht->last)) > 0) { + + /* 15006AF7 */ + if (p_item3 != NULL) { + + /* 15006AFB */ + do { + + /* check if we found item. */ + if (p_item3->byte_value >= one_byte) { + found = 1; + break; + } + + /* switch to previous item. */ + p_item3 = p_item3->prev; + } while (PTR_INT(p_item3) > 0); + } + } + + /* check if item was not found. */ + if (found == 0) { + p_item3 = NULL; + } + + /* 15006B09 */ + if (item->next != NULL) { + libmpq__huffman_remove_item(item); + } + + /* 15006B15 */ + if (p_item3 == NULL) { + p_item3 = PTR_PTR(&ht->first); + } + + /* 15006B1F */ + item->next = p_item3->next; + item->prev = p_item3->next->prev; + p_item3->next->prev = item; + p_item3->next = item; + } + + /* 15006B4A */ + for (; i < 0x102; i++) { + + /* EDI */ + struct huffman_tree_item_s **p_item2 = &ht->items306C[i]; + + /* 15006B59 - ESI */ + struct huffman_tree_item_s *item2 = ht->item3058; + + /* check if item is a valid pointer. */ + if (PTR_INT(item2) <= 0) { + item2 = &ht->items0008[ht->items++]; + } + + /* insert the item into tree. */ + libmpq__huffman_insert_item(&ht->item305C, item2, INSERT_ITEM, NULL); + + /* 15006B89 */ + item2->dcmp_byte = i; + item2->byte_value = 1; + item2->parent = NULL; + item2->child = NULL; + *p_item2++ = item2; + } + + /* 15006BAA - EDI - last item (first child to item). */ + if (PTR_INT((child1 = ht->last)) > 0) { + + /* EBP */ + struct huffman_tree_item_s *child2; + + /* ESI */ + struct huffman_tree_item_s *item; + + /* 15006BB8 */ + while (PTR_INT((child2 = child1->prev)) > 0) { + if (PTR_INT((item = ht->item3058)) <= 0) { + item = &ht->items0008[ht->items++]; + } + + /* 15006BE3 */ + libmpq__huffman_insert_item(&ht->item305C, item, SWITCH_ITEMS, NULL); + + /* 15006BF3 */ + item->parent = NULL; + item->child = NULL; + + /* + * EDX = child2->byte_value + child1->byte_value; + * EAX = child1->byte_value; + * ECX = max_byte; (the greatest character (0xFF usually)) + * item->byte_value (0x02 usually) + */ + item->byte_value = child1->byte_value + child2->byte_value; + + /* previous item in the tree. */ + item->child = child1; + child1->parent = item; + child2->parent = item; + + /* EAX = item->byte_value */ + if (item->byte_value >= max_byte) { + max_byte = item->byte_value; + } else { + + /* EDI */ + struct huffman_tree_item_s *p_item2 = child2->prev; + found = 0; + + /* check if item is a valid pointer. */ + if (PTR_INT(p_item2) > 0) { + + /* 15006C2D */ + do { + + /* check if we found item. */ + if (p_item2->byte_value >= item->byte_value) { + found = 1; + break; + } + + /* switch to previous item. */ + p_item2 = p_item2->prev; + } while (PTR_INT(p_item2) > 0); + } + + /* check if item was not found. */ + if (found == 0) { + p_item2 = NULL; + } + + /* check if next item exist. */ + if (item->next != 0) { + + /* some common variables. */ + struct huffman_tree_item_s *temp4 = libmpq__huffman_previous_item(item, -1); + + /* zhe first item changed. */ + temp4->next = item->next; + + /* first->prev changed to negative value. */ + item->next->prev = item->prev; + item->next = NULL; + item->prev = NULL; + } + + /* 15006C62 */ + if (p_item2 == NULL) { + p_item2 = PTR_PTR(&ht->first); + } + + /* set item with 0x100 byte value. */ + item->next = p_item2->next; + + /* set item with 0x17 byte value. */ + item->prev = p_item2->next->prev; + + /* changed prev of item with. */ + p_item2->next->prev = item; + p_item2->next = item; + } + + /* 15006C7B */ + if (PTR_INT((child1 = child2->prev)) <= 0) { + break; + } + } + } + + /* 15006C88 */ + ht->offs0004 = 1; +} + +/* this function did the real decompression. */ +int32_t libmpq__do_decompress_huffman(struct huffman_tree_s *ht, struct huffman_input_stream_s *is, uint8_t *out_buf, uint32_t out_length) { + + /* some common variables. */ + uint32_t dcmp_byte = 0; + uint8_t *out_pos = out_buf; + uint32_t bit_count; + struct huffman_decompress_s *qd; + struct huffman_tree_item_s *p_item1; + struct huffman_tree_item_s *p_item2; + + /* 8 bits loaded from input stream. */ + uint32_t n8bits; + + /* 7 bits loaded from input stream. */ + uint32_t n7bits; + + /* thats needed to replace the goto stuff from original source. :) */ + uint32_t found; + + /* can we use quick decompression */ + uint32_t has_qd; + + /* test the output length, must not be non zero. */ + if (out_length == 0) { + return 0; + } + + /* get the compression type from the input stream. */ + n8bits = libmpq__huffman_get_8bit(is); + + /* build the Huffman tree. */ + libmpq__huffman_tree_build(ht, n8bits); + + /* compression 8 bit or not? */ + ht->cmp0 = (n8bits == 0) ? TRUE : FALSE; + + /* loop until break. */ + for(;;) { + + /* get 7 bits from input stream. */ + n7bits = libmpq__huffman_get_7bit(is); + + /* try to use quick decompression, check huffman decompress struct for corresponding item. */ + qd = &ht->qd3474[n7bits]; + + /* if there is a quick-pass possible (ebx). */ + has_qd = (qd->offs00 >= ht->offs0004) ? TRUE : FALSE; + + /* if we can use quick decompress, use it. */ + if (has_qd) { + found = 0; + if (qd->bits > 7) { + is->bit_buf >>= 7; + is->bits -= 7; + p_item1 = qd->p_item; + found = 1; + } + if (found == 0) { + is->bit_buf >>= qd->bits; + is->bits -= qd->bits; + dcmp_byte = qd->dcmp_byte; + } + } else { + found = 1; + p_item1 = ht->first->next->prev; + if (PTR_INT(p_item1) <= 0) { + p_item1 = NULL; + } + } + + /* check if item was found. */ + if (found == 1) { + bit_count = 0; + p_item2 = NULL; + + /* loop until tree has no deeper level. */ + do { + + /* move down by one level. */ + p_item1 = p_item1->child; + + /* check if current bit is set, move to previous. */ + if (libmpq__huffman_get_1bit(is)) { + p_item1 = p_item1->prev; + } + + /* check if we are at 7th bit, save current huffman tree item. */ + if (++bit_count == 7) { + p_item2 = p_item1; + } + } while (p_item1->child != NULL); + + /* no quick decompression. :( */ + if (has_qd == FALSE) { + + /* check bit counter. */ + if (bit_count > 7) { + qd->offs00 = ht->offs0004; + qd->bits = bit_count; + qd->p_item = p_item2; + } else { + uint32_t index = n7bits & (0xFFFFFFFF >> (32 - bit_count)); + uint32_t add = (1 << bit_count); + + /* loop through compression. */ + for (qd = &ht->qd3474[index]; index <= 0x7F; index += add, qd += add) { + qd->offs00 = ht->offs0004; + qd->bits = bit_count; + qd->dcmp_byte = p_item1->dcmp_byte; + } + } + } + + /* set compression byte. */ + dcmp_byte = p_item1->dcmp_byte; + } + + /* check if huffman tree needs to be modified. */ + if (dcmp_byte == 0x101) { + + /* fill values. */ + n8bits = libmpq__huffman_get_8bit(is); + p_item1 = (ht->last <= 0) ? NULL : ht->last; + p_item2 = libmpq__huffman_call_1500E740(ht); + p_item2->parent = p_item1; + p_item2->dcmp_byte = p_item1->dcmp_byte; + p_item2->byte_value = p_item1->byte_value; + ht->items306C[p_item2->dcmp_byte] = p_item2; + p_item2 = libmpq__huffman_call_1500E740(ht); + p_item2->parent = p_item1; + p_item2->dcmp_byte = n8bits; + p_item2->byte_value = 0; + ht->items306C[p_item2->dcmp_byte] = p_item2; + p_item1->child = p_item2; + + /* call 1500E820. */ + libmpq__huffman_call_1500E820(ht, p_item2); + + /* check if compression is not set. */ + if (ht->cmp0 == 0) { + libmpq__huffman_call_1500E820(ht, ht->items306C[n8bits]); + } + + /* set compression byte. */ + dcmp_byte = n8bits; + } + + /* check for compression. */ + if (dcmp_byte == 0x100) { + break; + } + + /* increase position by compression byte. */ + *out_pos++ = (uint8_t)dcmp_byte; + if (--out_length == 0) { + break; + } + + /* check if compression is not set. */ + if (ht->cmp0) { + libmpq__huffman_call_1500E820(ht, ht->items306C[dcmp_byte]); + } + } + + /* return copied bytes. */ + return (out_pos - out_buf); +} diff --git a/externals/libmpq/libmpq/huffman.h b/externals/libmpq/libmpq/huffman.h new file mode 100644 index 0000000..6f69108 --- /dev/null +++ b/externals/libmpq/libmpq/huffman.h @@ -0,0 +1,151 @@ +/* + * huffman.h -- structures used for huffman compression. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * This source was adepted from the C++ version of huffman.h included + * in stormlib. The C++ version belongs to the following authors: + * + * Ladislav Zezula + * ShadowFlare + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _HUFFMAN_H +#define _HUFFMAN_H + +/* define huffman compression and decompression values. */ +#define LIBMPQ_HUFF_DECOMPRESS 0 /* we want to decompress using huffman trees. */ + +/* define pointer conversions. */ +#define PTR_NOT(ptr) (struct huffman_tree_item_s *)(~(unsigned long)(ptr)) +#define PTR_PTR(ptr) ((struct huffman_tree_item_s *)(ptr)) +#define PTR_INT(ptr) (long)(ptr) + +/* define item handling. */ +#define INSERT_ITEM 1 /* insert item into huffman tree. */ +#define SWITCH_ITEMS 2 /* switch items isnide huffman tree. */ + +/* input stream for huffman decompression. */ +struct huffman_input_stream_s { + uint8_t *in_buf; /* 00 - input data. */ + uint32_t bit_buf; /* 04 - input bit buffer. */ + uint32_t bits; /* 08 - number of bits remaining in byte. */ +}; + +/* huffman tree item. */ +struct huffman_tree_item_s { + struct huffman_tree_item_s *next; /* 00 - pointer to next huffman tree item. */ + struct huffman_tree_item_s *prev; /* 04 - pointer to prev huffman tree item (< 0 if none). */ + uint32_t dcmp_byte; /* 08 - index of this item in item pointer array, decompressed byte value. */ + uint32_t byte_value; /* 0C - some byte value. */ + struct huffman_tree_item_s *parent; /* 10 - pointer to parent huffman tree item (NULL if none). */ + struct huffman_tree_item_s *child; /* 14 - pointer to child huffman tree item. */ +}; + +/* structure used for quick decompression. */ +struct huffman_decompress_s { + uint32_t offs00; /* 00 - 1 if resolved. */ + uint32_t bits; /* 04 - bit count. */ + union { + uint32_t dcmp_byte; /* 08 - byte value for decompress (if bitCount <= 7). */ + struct huffman_tree_item_s *p_item; /* 08 - huffman tree item (if number of bits is greater than 7). */ + }; +}; + +/* structure for huffman tree. */ +struct huffman_tree_s { + uint32_t cmp0; /* 0000 - 1 if compression type 0. */ + uint32_t offs0004; /* 0004 - some flag. */ + struct huffman_tree_item_s items0008[0x203]; /* 0008 - huffman tree items. */ + struct huffman_tree_item_s *item3050; /* 3050 - always NULL? */ + struct huffman_tree_item_s *item3054; /* 3054 - pointer to huffman tree item. */ + struct huffman_tree_item_s *item3058; /* 3058 - pointer to huffman tree item (< 0 if invalid). */ + struct huffman_tree_item_s *item305C; /* 305C - usually NULL. */ + struct huffman_tree_item_s *first; /* 3060 - pointer to top (first) huffman tree item. */ + struct huffman_tree_item_s *last; /* 3064 - pointer to bottom (last) huffman tree item (< 0 if invalid). */ + uint32_t items; /* 3068 - number of used huffman tree items. */ + struct huffman_tree_item_s *items306C[0x102]; /* 306C - huffman tree item pointer array. */ + struct huffman_decompress_s qd3474[0x80]; /* 3474 - array for quick decompression. */ + uint8_t table_1502A630[]; /* some table to make struct size flexible. */ +}; + +/* insert a new item into huffman tree. */ +void libmpq__huffman_insert_item( + struct huffman_tree_item_s **p_item, + struct huffman_tree_item_s *item, + uint32_t where, + struct huffman_tree_item_s *item2 +); + +/* remove item from huffman tree. */ +void libmpq__huffman_remove_item( + struct huffman_tree_item_s *hi +); + +/* get previous item from huffman tree. */ +struct huffman_tree_item_s *libmpq__huffman_previous_item( + struct huffman_tree_item_s *hi, + long value +); + +/* get one bit from stream. */ +uint32_t libmpq__huffman_get_1bit( + struct huffman_input_stream_s *is +); + +/* get seven bit from stream. */ +uint32_t libmpq__huffman_get_7bit( + struct huffman_input_stream_s *is +); + +/* get eight bit from stream. */ +uint32_t libmpq__huffman_get_8bit( + struct huffman_input_stream_s *is +); + +/* call 1500E740. */ +struct huffman_tree_item_s *libmpq__huffman_call_1500E740( + struct huffman_tree_s *ht +); + +/* call 1500E820- */ +void libmpq__huffman_call_1500E820( + struct huffman_tree_s *ht, + struct huffman_tree_item_s *p_item +); + +/* initialize the huffman tree. */ +void libmpq__huffman_tree_init( + struct huffman_tree_s *ht, + uint32_t cmp +); + +/* build the huffman tree. */ +void libmpq__huffman_tree_build( + struct huffman_tree_s *ht, + uint32_t cmp_type +); + +/* decompress the stream using huffman compression. */ +int32_t libmpq__do_decompress_huffman( + struct huffman_tree_s *ht, + struct huffman_input_stream_s *is, + uint8_t *out_buf, + uint32_t out_length +); + +#endif /* _HUFFMAN_H */ diff --git a/externals/libmpq/libmpq/mpq-internal.h b/externals/libmpq/libmpq/mpq-internal.h new file mode 100644 index 0000000..76eabe4 --- /dev/null +++ b/externals/libmpq/libmpq/mpq-internal.h @@ -0,0 +1,145 @@ +/* + * mpq-internal.h -- some default types and defines, but only required for + * compilation of the library. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MPQ_INTERNAL_H +#define _MPQ_INTERNAL_H + +/* generic includes. */ +#include +#include + +/* define return value if nothing failed. */ +#define LIBMPQ_SUCCESS 0 /* return value for all functions which success. */ + +/* define generic mpq archive information. */ +#define LIBMPQ_HEADER 0x1A51504D /* mpq archive header ('MPQ\x1A') */ + +/* define the known archive versions. */ +#define LIBMPQ_ARCHIVE_VERSION_ONE 0 /* version one used until world of warcraft. */ +#define LIBMPQ_ARCHIVE_VERSION_TWO 1 /* version two used from world of warcraft - the burning crusade. */ + +/* define values used by blizzard as flags. */ +#define LIBMPQ_FLAG_EXISTS 0x80000000 /* set if file exists, reset when the file was deleted. */ +#define LIBMPQ_FLAG_ENCRYPTED 0x00010000 /* indicates whether file is encrypted. */ +#define LIBMPQ_FLAG_COMPRESSED 0x0000FF00 /* file is compressed. */ +#define LIBMPQ_FLAG_COMPRESS_PKZIP 0x00000100 /* compression made by pkware data compression library. */ +#define LIBMPQ_FLAG_COMPRESS_MULTI 0x00000200 /* multiple compressions. */ +#define LIBMPQ_FLAG_COMPRESS_NONE 0x00000300 /* no compression (no blizzard flag used by myself). */ +#define LIBMPQ_FLAG_SINGLE 0x01000000 /* file is stored in one single sector, first seen in world of warcraft. */ +#define LIBMPQ_FLAG_CRC 0x04000000 /* compressed block offset table has CRC checksum. */ + +/* define generic hash values. */ +#define LIBMPQ_HASH_FREE 0xFFFFFFFF /* hash table entry is empty and has always been empty. */ + +/* define special files. */ +#define LIBMPQ_LISTFILE_NAME "(listfile)" /* internal listfile. */ +#define LIBMPQ_SIGNATURE_NAME "(signature)" /* internal signature file. */ +#define LIBMPQ_ATTRIBUTES_NAME "(attributes)" /* internal attributes file. */ + +/* define true and false, because not all systems have them. */ +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + +#include "pack_begin.h" +/* mpq archive header. */ +typedef struct { + uint32_t mpq_magic; /* the 0x1A51504D ('MPQ\x1A') signature. */ + uint32_t header_size; /* mpq archive header size. */ + uint32_t archive_size; /* size of mpq archive. */ + uint16_t version; /* 0000 for starcraft and broodwar. */ + uint16_t block_size; /* size of file block is (512 * 2 ^ block size). */ + uint32_t hash_table_offset; /* file position of mpq_hash. */ + uint32_t block_table_offset; /* file position of mpq_block, each entry has 16 bytes. */ + uint32_t hash_table_count; /* number of entries in hash table. */ + uint32_t block_table_count; /* number of entries in the block table. */ +} PACK_STRUCT mpq_header_s; + +/* mpq extended archive header, used since world of warcraft - the burning crusade. */ +typedef struct { + uint64_t extended_offset; /* offset to the beginning of the extended block table, relative to the beginning of the archive. */ + uint16_t hash_table_offset_high; /* upper 16 bits of the hash table offset for large archives. */ + uint16_t block_table_offset_high;/* upper 16 bits of the block table offset for large archives.*/ +} PACK_STRUCT mpq_header_ex_s; + +/* hash entry, all files in the archive are searched by their hashes. */ +typedef struct { + uint32_t hash_a; /* the first two uint32_ts are the encrypted file. */ + uint32_t hash_b; /* the first two uint32_ts are the encrypted file. */ + uint16_t locale; /* locale information. */ + uint16_t platform; /* platform information and zero is default. */ + uint32_t block_table_index; /* index to file description block. */ +} PACK_STRUCT mpq_hash_s; + +/* file description block contains informations about the file. */ +typedef struct { + uint32_t offset; /* block file starting position in the archive. */ + uint32_t packed_size; /* packed file size. */ + uint32_t unpacked_size; /* unpacked file size. */ + uint32_t flags; /* flags. */ +} PACK_STRUCT mpq_block_s; + +/* extended file description block contains information about the offset beyond 2^32 (4GB). */ +typedef struct { + uint16_t offset_high; /* upper 16 bit of the file offset in archive. */ +} PACK_STRUCT mpq_block_ex_s; + +/* file structure used since diablo 1.00 (0x38 bytes). */ +typedef struct { + uint32_t seed; /* seed used for file decrypt. */ + uint32_t *packed_offset; /* position of each file block (only for packed files). */ + uint32_t open_count; /* number of times it has been opened - used for freeing */ +} PACK_STRUCT mpq_file_s; + +/* map structure for valid blocks and hashes (first seen in warcraft 3 archives). */ +typedef struct { + uint32_t block_table_indices; /* real mapping for file number to block entry. */ + uint32_t block_table_diff; /* block table difference between valid blocks and invalid blocks before. */ +} PACK_STRUCT mpq_map_s; +#include "pack_end.h" + +/* archive structure used since diablo 1.00 by blizzard. */ +struct mpq_archive { + + /* generic file information. */ + FILE *fp; /* file handle. */ + + /* generic size information. */ + uint32_t block_size; /* size of the mpq block. */ + off_t archive_offset; /* absolute start position of archive. */ + + /* archive related buffers and tables. */ + mpq_header_s mpq_header; /* mpq file header. */ + mpq_header_ex_s mpq_header_ex; /* mpq extended file header. */ + mpq_hash_s *mpq_hash; /* hash table. */ + mpq_block_s *mpq_block; /* block table. */ + mpq_block_ex_s *mpq_block_ex; /* extended block table. */ + mpq_file_s **mpq_file; /* pointer to the file pointers which are opened. */ + + /* non archive structure related members. */ + mpq_map_s *mpq_map; /* map table between valid blocks and hashes. */ + uint32_t files; /* number of files in archive, which could be extracted. */ +}; + +#endif /* _MPQ_INTERNAL_H */ diff --git a/externals/libmpq/libmpq/mpq.c b/externals/libmpq/libmpq/mpq.c new file mode 100644 index 0000000..83d5533 --- /dev/null +++ b/externals/libmpq/libmpq/mpq.c @@ -0,0 +1,978 @@ +/* + * mpq.c -- functions for developers using libmpq. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* mpq-tools configuration includes. */ +#include "config.h" + +/* libmpq main includes. */ +#include "mpq.h" +#include "mpq-internal.h" + +/* libmpq generic includes. */ +#include "common.h" + +/* generic includes. */ +#include +#include +#include +#include + +/* support for platform specific things */ +#include "platform.h" + +/* this function returns the library version information. */ +const char *libmpq__version(void) { + + /* return version information. */ + return VERSION; +} + +/* this function read a file and verify if it is a valid mpq archive, then it read and decrypt the hash table. */ +int32_t libmpq__archive_open(mpq_archive_s **mpq_archive, const char *mpq_filename, libmpq__off_t archive_offset) { + + /* some common variables. */ + uint32_t rb = 0; + uint32_t i = 0; + uint32_t count = 0; + int32_t result = 0; + uint32_t header_search = FALSE; + + if (archive_offset == -1) { + archive_offset = 0; + header_search = TRUE; + } + + if ((*mpq_archive = calloc(1, sizeof(mpq_archive_s))) == NULL) { + + /* archive struct could not be allocated */ + return LIBMPQ_ERROR_MALLOC; + } + + /* check if file exists and is readable */ + if (((*mpq_archive)->fp = fopen(mpq_filename, "rb")) == NULL) { + + /* file could not be opened. */ + result = LIBMPQ_ERROR_OPEN; + goto error; + } + + /* assign some default values. */ + (*mpq_archive)->mpq_header.mpq_magic = 0; + (*mpq_archive)->files = 0; + + /* loop through file and search for mpq signature. */ + while (TRUE) { + + /* reset header values. */ + (*mpq_archive)->mpq_header.mpq_magic = 0; + + /* seek in file. */ + if (fseeko((*mpq_archive)->fp, archive_offset, SEEK_SET) < 0) { + + /* seek in file failed. */ + result = LIBMPQ_ERROR_SEEK; + goto error; + } + + /* read header from file. */ + if ((rb = fread(&(*mpq_archive)->mpq_header, 1, sizeof(mpq_header_s), (*mpq_archive)->fp)) != sizeof(mpq_header_s)) { + + /* no valid mpq archive. */ + result = LIBMPQ_ERROR_FORMAT; + goto error; + } + + /* check if we found a valid mpq header. */ + if ((*mpq_archive)->mpq_header.mpq_magic == LIBMPQ_HEADER) { + + /* check if we process old mpq archive version. */ + if ((*mpq_archive)->mpq_header.version == LIBMPQ_ARCHIVE_VERSION_ONE) { + + /* check if the archive is protected. */ + if ((*mpq_archive)->mpq_header.header_size != sizeof(mpq_header_s)) { + + /* correct header size. */ + (*mpq_archive)->mpq_header.header_size = sizeof(mpq_header_s); + } + } + + /* check if we process new mpq archive version. */ + if ((*mpq_archive)->mpq_header.version == LIBMPQ_ARCHIVE_VERSION_TWO) { + + /* check if the archive is protected. */ + if ((*mpq_archive)->mpq_header.header_size != sizeof(mpq_header_s) + sizeof(mpq_header_ex_s)) { + + /* correct header size. */ + (*mpq_archive)->mpq_header.header_size = sizeof(mpq_header_s) + sizeof(mpq_header_ex_s); + } + } + + /* break the loop, because header was found. */ + break; + } + + /* move to the next possible offset. */ + if (!header_search) { + + /* no valid mpq archive. */ + result = LIBMPQ_ERROR_FORMAT; + goto error; + } + archive_offset += 512; + } + + /* store block size for later use. */ + (*mpq_archive)->block_size = 512 << (*mpq_archive)->mpq_header.block_size; + + /* store archive offset and size for later use. */ + (*mpq_archive)->archive_offset = archive_offset; + + /* check if we process new mpq archive version. */ + if ((*mpq_archive)->mpq_header.version == LIBMPQ_ARCHIVE_VERSION_TWO) { + + /* seek in file. */ + if (fseeko((*mpq_archive)->fp, sizeof(mpq_header_s) + archive_offset, SEEK_SET) < 0) { + + /* seek in file failed. */ + result = LIBMPQ_ERROR_SEEK; + goto error; + } + + /* read header from file. */ + if ((rb = fread(&(*mpq_archive)->mpq_header_ex, 1, sizeof(mpq_header_ex_s), (*mpq_archive)->fp)) != sizeof(mpq_header_ex_s)) { + + /* no valid mpq archive. */ + result = LIBMPQ_ERROR_FORMAT; + goto error; + } + } + + /* allocate memory for the block table, hash table, file and block table to file mapping. */ + if (((*mpq_archive)->mpq_block = calloc((*mpq_archive)->mpq_header.block_table_count, sizeof(mpq_block_s))) == NULL || + ((*mpq_archive)->mpq_block_ex = calloc((*mpq_archive)->mpq_header.block_table_count, sizeof(mpq_block_ex_s))) == NULL || + ((*mpq_archive)->mpq_hash = calloc((*mpq_archive)->mpq_header.hash_table_count, sizeof(mpq_hash_s))) == NULL || + ((*mpq_archive)->mpq_file = calloc((*mpq_archive)->mpq_header.block_table_count, sizeof(mpq_file_s))) == NULL || + ((*mpq_archive)->mpq_map = calloc((*mpq_archive)->mpq_header.block_table_count, sizeof(mpq_map_s))) == NULL) { + + /* memory allocation problem. */ + result = LIBMPQ_ERROR_MALLOC; + goto error; + } + + /* seek in file. */ + if (fseeko((*mpq_archive)->fp, (*mpq_archive)->mpq_header.hash_table_offset + (((long long)((*mpq_archive)->mpq_header_ex.hash_table_offset_high)) << 32) + (*mpq_archive)->archive_offset, SEEK_SET) < 0) { + + /* seek in file failed. */ + result = LIBMPQ_ERROR_SEEK; + goto error; + } + + /* read the hash table into the buffer. */ + if ((rb = fread((*mpq_archive)->mpq_hash, 1, (*mpq_archive)->mpq_header.hash_table_count * sizeof(mpq_hash_s), (*mpq_archive)->fp)) < 0) { + + /* something on read failed. */ + result = LIBMPQ_ERROR_READ; + goto error; + } + + /* decrypt the hashtable. */ + libmpq__decrypt_block((uint32_t *)((*mpq_archive)->mpq_hash), (*mpq_archive)->mpq_header.hash_table_count * sizeof(mpq_hash_s), libmpq__hash_string("(hash table)", 0x300)); + + /* seek in file. */ + if (fseeko((*mpq_archive)->fp, (*mpq_archive)->mpq_header.block_table_offset + (((long long)((*mpq_archive)->mpq_header_ex.block_table_offset_high)) << 32) + (*mpq_archive)->archive_offset, SEEK_SET) < 0) { + + /* seek in file failed. */ + result = LIBMPQ_ERROR_SEEK; + goto error; + } + + /* read the block table into the buffer. */ + if ((rb = fread((*mpq_archive)->mpq_block, 1, (*mpq_archive)->mpq_header.block_table_count * sizeof(mpq_block_s), (*mpq_archive)->fp)) < 0) { + + /* something on read failed. */ + result = LIBMPQ_ERROR_READ; + goto error; + } + + /* decrypt block table. */ + libmpq__decrypt_block((uint32_t *)((*mpq_archive)->mpq_block), (*mpq_archive)->mpq_header.block_table_count * sizeof(mpq_block_s), libmpq__hash_string("(block table)", 0x300)); + + /* check if extended block table is present, regardless of version 2 it is only present in archives > 4GB. */ + if ((*mpq_archive)->mpq_header_ex.extended_offset > 0) { + + /* seek in file. */ + if (fseeko((*mpq_archive)->fp, (*mpq_archive)->mpq_header_ex.extended_offset + archive_offset, SEEK_SET) < 0) { + + /* seek in file failed. */ + result = LIBMPQ_ERROR_SEEK; + goto error; + } + + /* read header from file. */ + if ((rb = fread((*mpq_archive)->mpq_block_ex, 1, (*mpq_archive)->mpq_header.block_table_count * sizeof(mpq_block_ex_s), (*mpq_archive)->fp)) < 0) { + + /* no valid mpq archive. */ + result = LIBMPQ_ERROR_FORMAT; + goto error; + } + } + + /* loop through all files in mpq archive and check if they are valid. */ + for (i = 0; i < (*mpq_archive)->mpq_header.block_table_count; i++) { + + /* save block difference between valid and invalid blocks. */ + (*mpq_archive)->mpq_map[i].block_table_diff = i - count; + + /* check if file exists, sizes and offsets are correct. */ + if (((*mpq_archive)->mpq_block[i].flags & LIBMPQ_FLAG_EXISTS) == 0) { + + /* file does not exist, so nothing to do with that block. */ + continue; + } + + /* create final indices tables. */ + (*mpq_archive)->mpq_map[count].block_table_indices = i; + + /* increase file counter. */ + count++; + } + + /* save the number of files. */ + (*mpq_archive)->files = count; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; + +error: + if ((*mpq_archive)->fp) + fclose((*mpq_archive)->fp); + + free((*mpq_archive)->mpq_map); + free((*mpq_archive)->mpq_file); + free((*mpq_archive)->mpq_hash); + free((*mpq_archive)->mpq_block); + free((*mpq_archive)->mpq_block_ex); + free(*mpq_archive); + + *mpq_archive = NULL; + + return result; +} + +/* this function close the file descriptor, free the decryption buffer and the file list. */ +int32_t libmpq__archive_close(mpq_archive_s *mpq_archive) { + + /* try to close the file */ + if ((fclose(mpq_archive->fp)) < 0) { + + /* don't free anything here, so the caller can try calling us + * again. + */ + return LIBMPQ_ERROR_CLOSE; + } + + /* free header, tables and list. */ + free(mpq_archive->mpq_map); + free(mpq_archive->mpq_file); + free(mpq_archive->mpq_hash); + free(mpq_archive->mpq_block); + free(mpq_archive->mpq_block_ex); + free(mpq_archive); + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the packed size of all files in the archive. */ +int32_t libmpq__archive_packed_size(mpq_archive_s *mpq_archive, libmpq__off_t *packed_size) { + + /* some common variables. */ + uint32_t i; + + /* loop through all files in archive and count packed size. */ + for (i = 0; i < mpq_archive->files; i++) { + *packed_size += mpq_archive->mpq_block[mpq_archive->mpq_map[i].block_table_indices].packed_size; + } + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the unpacked size of all files in the archive. */ +int32_t libmpq__archive_unpacked_size(mpq_archive_s *mpq_archive, libmpq__off_t *unpacked_size) { + + /* some common variables. */ + uint32_t i; + + /* loop through all files in archive and count unpacked size. */ + for (i = 0; i < mpq_archive->files; i++) { + *unpacked_size += mpq_archive->mpq_block[mpq_archive->mpq_map[i].block_table_indices].unpacked_size; + } + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the archive offset (beginning of archive in file). */ +int32_t libmpq__archive_offset(mpq_archive_s *mpq_archive, libmpq__off_t *offset) { + + /* return archive offset. */ + *offset = mpq_archive->archive_offset; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the archive offset. */ +int32_t libmpq__archive_version(mpq_archive_s *mpq_archive, uint32_t *version) { + + /* return archive version. */ + *version = mpq_archive->mpq_header.version + 1; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the number of valid files in archive. */ +int32_t libmpq__archive_files(mpq_archive_s *mpq_archive, uint32_t *files) { + + /* return archive version. */ + *files = mpq_archive->files; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +#define CHECK_FILE_NUM(file_number, mpq_archive) \ + if (file_number < 0 || file_number > mpq_archive->files - 1) { \ + return LIBMPQ_ERROR_EXIST; \ + } + +#define CHECK_BLOCK_NUM(block_number, mpq_archive) \ + if (block_number < 0 || block_number >= ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_SINGLE) != 0 ? 1 : (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size + mpq_archive->block_size - 1) / mpq_archive->block_size)) { \ + return LIBMPQ_ERROR_EXIST; \ + } + +/* this function return the packed size of the given files in the archive. */ +int32_t libmpq__file_packed_size(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *packed_size) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* get the packed size of file. */ + *packed_size = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].packed_size; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the unpacked size of the given file in the archive. */ +int32_t libmpq__file_unpacked_size(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *unpacked_size) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* get the unpacked size of file. */ + *unpacked_size = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the file offset (beginning of file in archive). */ +int32_t libmpq__file_offset(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *offset) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* return file offset relative to archive start. */ + *offset = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].offset + (((long long)mpq_archive->mpq_block_ex[mpq_archive->mpq_map[file_number].block_table_indices].offset_high) << 32); + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the number of blocks for the given file in the archive. */ +int32_t libmpq__file_blocks(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *blocks) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* return the number of blocks for the given file. */ + *blocks = (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_SINGLE) != 0 ? 1 : (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size + mpq_archive->block_size - 1) / mpq_archive->block_size; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return if the file is encrypted or not. */ +int32_t libmpq__file_encrypted(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *encrypted) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* return the encryption status of file. */ + *encrypted = (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_ENCRYPTED) != 0 ? TRUE : FALSE; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return if the file is compressed or not. */ +int32_t libmpq__file_compressed(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *compressed) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* return the compression status of file. */ + *compressed = (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_COMPRESS_MULTI) != 0 ? TRUE : FALSE; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return if the file is imploded or not. */ +int32_t libmpq__file_imploded(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *imploded) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* return the implosion status of file. */ + *imploded = (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_COMPRESS_PKZIP) != 0 ? TRUE : FALSE; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return filenumber by the given name. */ +int32_t libmpq__file_number(mpq_archive_s *mpq_archive, const char *filename, uint32_t *number) { + + /* some common variables. */ + uint32_t i, hash1, hash2, hash3, ht_count; + + /* if the list of file names doesn't include this one, we'll have + * to figure out the file number the "hard" way. + */ + ht_count = mpq_archive->mpq_header.hash_table_count; + + hash1 = libmpq__hash_string (filename, 0x0) & (ht_count - 1); + hash2 = libmpq__hash_string (filename, 0x100); + hash3 = libmpq__hash_string (filename, 0x200); + + /* loop through all files in mpq archive. + * hash1 gives us a clue about the starting position of this + * search. + */ + for (i = hash1; mpq_archive->mpq_hash[i].block_table_index != LIBMPQ_HASH_FREE; i = (i + 1) & (ht_count - 1)) { + + /* if the other two hashes match, we found our file number. */ + if (mpq_archive->mpq_hash[i].hash_a == hash2 && + mpq_archive->mpq_hash[i].hash_b == hash3) { + + /* return the file number. */ + *number = mpq_archive->mpq_hash[i].block_table_index - mpq_archive->mpq_map[mpq_archive->mpq_hash[i].block_table_index].block_table_diff; + + /* we found our file, return zero. */ + return LIBMPQ_SUCCESS; + } + + /* check if we have cycled through the whole hash table */ + if (((i + 1) & (ht_count - 1)) == hash1) { + break; + } + } + + /* if no matching entry found, so return error. */ + return LIBMPQ_ERROR_EXIST; +} + +/* this function read the given file from archive into a buffer. */ +int32_t libmpq__file_read(mpq_archive_s *mpq_archive, uint32_t file_number, uint8_t *out_buf, libmpq__off_t out_size, libmpq__off_t *transferred) { + + /* some common variables. */ + uint32_t i; + uint32_t blocks = 0; + int32_t result = 0; + libmpq__off_t file_offset = 0; + libmpq__off_t unpacked_size = 0; + libmpq__off_t transferred_block = 0; + libmpq__off_t transferred_total = 0; + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* get target size of block. */ + libmpq__file_unpacked_size(mpq_archive, file_number, &unpacked_size); + + /* check if target buffer is to small. */ + if (unpacked_size > out_size) { + + /* output buffer size is to small or block size is unknown. */ + return LIBMPQ_ERROR_SIZE; + } + + /* fetch file offset. */ + libmpq__file_offset(mpq_archive, file_number, &file_offset); + + /* get block count for file. */ + libmpq__file_blocks(mpq_archive, file_number, &blocks); + + /* open the packed block offset table. */ + if ((result = libmpq__block_open_offset(mpq_archive, file_number)) < 0) { + + /* something on opening packed block offset table failed. */ + return result; + } + + /* loop through all blocks. */ + for (i = 0; i < blocks; i++) { + + /* cleanup size variable. */ + unpacked_size = 0; + + /* get unpacked block size. */ + libmpq__block_unpacked_size(mpq_archive, file_number, i, &unpacked_size); + + /* read block. */ + if ((result = libmpq__block_read(mpq_archive, file_number, i, out_buf + transferred_total, unpacked_size, &transferred_block)) < 0) { + + /* close the packed block offset table. */ + libmpq__block_close_offset(mpq_archive, file_number); + + /* something on reading block failed. */ + return result; + } + + transferred_total += transferred_block; + + } + + /* close the packed block offset table. */ + libmpq__block_close_offset(mpq_archive, file_number); + + /* check for null pointer. */ + if (transferred != NULL) { + + /* store transferred bytes. */ + *transferred = transferred_total; + } + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function open a file in the given archive and caches the block offset information. */ +int32_t libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint32_t file_number) { + + /* some common variables. */ + uint32_t i; + uint32_t packed_size; + int32_t rb = 0; + int32_t result = 0; + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + if (mpq_archive->mpq_file[file_number]) { + + /* file already opened, so increment counter */ + mpq_archive->mpq_file[file_number]->open_count++; + return LIBMPQ_SUCCESS; + } + + /* check if file is not stored in a single sector. */ + if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_SINGLE) == 0) { + + /* get packed size based on block size and block count. */ + packed_size = sizeof(uint32_t) * (((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size + mpq_archive->block_size - 1) / mpq_archive->block_size) + 1); + } else { + + /* file is stored in single sector and we need only two entries for the packed block offset table. */ + packed_size = sizeof(uint32_t) * 2; + } + + /* check if data has one extra entry. */ + if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_CRC) != 0) { + + /* add one uint32_t. */ + packed_size += sizeof(uint32_t); + } + + /* allocate memory for the file. */ + if ((mpq_archive->mpq_file[file_number] = calloc(1, sizeof(mpq_file_s))) == NULL) { + + /* memory allocation problem. */ + result = LIBMPQ_ERROR_MALLOC; + goto error; + } + + /* allocate memory for the packed block offset table. */ + if ((mpq_archive->mpq_file[file_number]->packed_offset = calloc(1, packed_size)) == NULL) { + + /* memory allocation problem. */ + result = LIBMPQ_ERROR_MALLOC; + goto error; + } + + /* initialize counter to one opening */ + mpq_archive->mpq_file[file_number]->open_count = 1; + + /* check if we need to load the packed block offset table, we will maintain this table for unpacked files too. */ + if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_COMPRESSED) != 0 && + (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_SINGLE) == 0) { + + /* seek to block position. */ + if (fseeko(mpq_archive->fp, mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].offset + (((long long)mpq_archive->mpq_block_ex[mpq_archive->mpq_map[file_number].block_table_indices].offset_high) << 32) + mpq_archive->archive_offset, SEEK_SET) < 0) { + + /* seek in file failed. */ + result = LIBMPQ_ERROR_SEEK; + goto error; + } + + /* read block positions from begin of file. */ + if ((rb = fread(mpq_archive->mpq_file[file_number]->packed_offset, 1, packed_size, mpq_archive->fp)) < 0) { + + /* something on read from archive failed. */ + result = LIBMPQ_ERROR_READ; + goto error; + } + + /* check if the archive is protected some way, sometimes the file appears not to be encrypted, but it is. + * a special case are files with an additional sector but LIBMPQ_FLAG_CRC not set. we don't want to handle + * them as encrypted. */ + if (mpq_archive->mpq_file[file_number]->packed_offset[0] != rb && + mpq_archive->mpq_file[file_number]->packed_offset[0] != rb + 4) { + + /* file is encrypted. */ + mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags |= LIBMPQ_FLAG_ENCRYPTED; + } + + /* check if packed offset block is encrypted, we have to decrypt it. */ + if (mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_ENCRYPTED) { + + /* check if we don't know the file seed, try to find it. */ + if ((mpq_archive->mpq_file[file_number]->seed = libmpq__decrypt_key((uint8_t *)mpq_archive->mpq_file[file_number]->packed_offset, packed_size, mpq_archive->block_size)) < 0) { + + /* sorry without seed, we cannot extract file. */ + result = LIBMPQ_ERROR_DECRYPT; + goto error; + } + + /* decrypt block in input buffer. */ + if (libmpq__decrypt_block(mpq_archive->mpq_file[file_number]->packed_offset, packed_size, mpq_archive->mpq_file[file_number]->seed - 1) < 0 ) { + + /* something on decrypt failed. */ + result = LIBMPQ_ERROR_DECRYPT; + goto error; + } + + /* check if the block positions are correctly decrypted. */ + if (mpq_archive->mpq_file[file_number]->packed_offset[0] != packed_size) { + + /* sorry without seed, we cannot extract file. */ + result = LIBMPQ_ERROR_DECRYPT; + goto error; + } + } + } else { + + /* check if file is not stored in a single sector. */ + if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_SINGLE) == 0) { + + /* loop through all blocks and create packed block offset table based on block size. */ + for (i = 0; i < ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size + mpq_archive->block_size - 1) / mpq_archive->block_size + 1); i++) { + + /* check if we process the last block. */ + if (i == ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size + mpq_archive->block_size - 1) / mpq_archive->block_size)) { + + /* store size of last block. */ + mpq_archive->mpq_file[file_number]->packed_offset[i] = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size; + } else { + + /* store default block size. */ + mpq_archive->mpq_file[file_number]->packed_offset[i] = i * mpq_archive->block_size; + } + } + } else { + + /* store offsets. */ + mpq_archive->mpq_file[file_number]->packed_offset[0] = 0; + mpq_archive->mpq_file[file_number]->packed_offset[1] = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].packed_size; + } + } + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; + +error: + + /* free packed block offset table and file pointer. */ + free(mpq_archive->mpq_file[file_number]->packed_offset); + free(mpq_archive->mpq_file[file_number]); + + /* return error constant. */ + return result; +} + +/* this function free the file pointer to the opened file in archive. */ +int32_t libmpq__block_close_offset(mpq_archive_s *mpq_archive, uint32_t file_number) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + if (mpq_archive->mpq_file[file_number] == NULL) { + + /* packed block offset table is not opened. */ + return LIBMPQ_ERROR_OPEN; + } + + mpq_archive->mpq_file[file_number]->open_count--; + + if (mpq_archive->mpq_file[file_number]->open_count != 0) { + + /* still in use */ + return LIBMPQ_SUCCESS; + } + + /* free packed block offset table and file pointer. */ + free(mpq_archive->mpq_file[file_number]->packed_offset); + free(mpq_archive->mpq_file[file_number]); + + /* mark it as unopened - libmpq__block_open_offset checks for this to decide whether to increment the counter */ + mpq_archive->mpq_file[file_number] = NULL; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the unpacked size of the given file and block in the archive. */ +int32_t libmpq__block_unpacked_size(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t block_number, libmpq__off_t *unpacked_size) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* check if given block number is not out of range. */ + CHECK_BLOCK_NUM(block_number, mpq_archive) + + /* check if packed block offset table is opened. */ + if (mpq_archive->mpq_file[file_number] == NULL || + mpq_archive->mpq_file[file_number]->packed_offset == NULL) { + + /* packed block offset table is not opened. */ + return LIBMPQ_ERROR_OPEN; + } + + /* check if block is stored as single sector. */ + if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_SINGLE) != 0) { + + /* return the unpacked size of the block in the mpq archive. */ + *unpacked_size = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size; + } + + /* check if block is not stored as single sector. */ + if ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].flags & LIBMPQ_FLAG_SINGLE) == 0) { + + /* check if we not process the last block. */ + if (block_number < ((mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size + mpq_archive->block_size - 1) / mpq_archive->block_size) - 1) { + + /* return the block size as unpacked size. */ + *unpacked_size = mpq_archive->block_size; + } else { + + /* return the unpacked size of the last block in the mpq archive. */ + *unpacked_size = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].unpacked_size - mpq_archive->block_size * block_number; + } + } + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function return the decryption seed for the given file and block. */ +int32_t libmpq__block_seed(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t block_number, uint32_t *seed) { + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* check if given block number is not out of range. */ + CHECK_BLOCK_NUM(block_number, mpq_archive) + + /* check if packed block offset table is opened. */ + if (mpq_archive->mpq_file[file_number] == NULL || + mpq_archive->mpq_file[file_number]->packed_offset == NULL) { + + /* packed block offset table is not opened. */ + return LIBMPQ_ERROR_OPEN; + } + + /* return the decryption key. */ + *seed = mpq_archive->mpq_file[file_number]->seed + block_number; + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} + +/* this function read the given block from archive into a buffer. */ +int32_t libmpq__block_read(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t block_number, uint8_t *out_buf, libmpq__off_t out_size, libmpq__off_t *transferred) { + + /* some common variables. */ + uint8_t *in_buf; + uint32_t seed = 0; + uint32_t encrypted = 0; + uint32_t compressed = 0; + uint32_t imploded = 0; + int32_t tb = 0; + libmpq__off_t block_offset = 0; + off_t in_size = 0; + libmpq__off_t unpacked_size = 0; + + /* check if given file number is not out of range. */ + CHECK_FILE_NUM(file_number, mpq_archive) + + /* check if given block number is not out of range. */ + CHECK_BLOCK_NUM(block_number, mpq_archive) + + /* check if packed block offset table is opened. */ + if (mpq_archive->mpq_file[file_number] == NULL || + mpq_archive->mpq_file[file_number]->packed_offset == NULL) { + + /* packed block offset table is not opened. */ + return LIBMPQ_ERROR_OPEN; + } + + /* get target size of block. */ + libmpq__block_unpacked_size(mpq_archive, file_number, block_number, &unpacked_size); + + /* check if target buffer is to small. */ + if (unpacked_size > out_size) { + + /* output buffer size is to small or block size is unknown. */ + return LIBMPQ_ERROR_SIZE; + } + + /* fetch some required values like input buffer size and block offset. */ + block_offset = mpq_archive->mpq_block[mpq_archive->mpq_map[file_number].block_table_indices].offset + (((long long)mpq_archive->mpq_block_ex[mpq_archive->mpq_map[file_number].block_table_indices].offset_high) << 32) + mpq_archive->mpq_file[file_number]->packed_offset[block_number]; + in_size = mpq_archive->mpq_file[file_number]->packed_offset[block_number + 1] - mpq_archive->mpq_file[file_number]->packed_offset[block_number]; + + /* seek in file. */ + if (fseeko(mpq_archive->fp, block_offset + mpq_archive->archive_offset, SEEK_SET) < 0) { + + /* something with seek in file failed. */ + return LIBMPQ_ERROR_SEEK; + } + + /* allocate memory for the read buffer. */ + if ((in_buf = calloc(1, in_size)) == NULL) { + + /* memory allocation problem. */ + return LIBMPQ_ERROR_MALLOC; + } + + /* read block from file. */ + if (fread(in_buf, 1, in_size, mpq_archive->fp) < 0) { + + /* free buffers. */ + free(in_buf); + + /* something on reading block failed. */ + return LIBMPQ_ERROR_READ; + } + + /* get encryption status. */ + libmpq__file_encrypted(mpq_archive, file_number, &encrypted); + + /* check if file is encrypted. */ + if (encrypted == 1) { + + /* get decryption key. */ + libmpq__block_seed(mpq_archive, file_number, block_number, &seed); + + /* decrypt block. */ + if (libmpq__decrypt_block((uint32_t *)in_buf, in_size, seed) < 0) { + + /* free buffers. */ + free(in_buf); + + /* something on decrypting block failed. */ + return LIBMPQ_ERROR_DECRYPT; + } + } + + /* get compression status. */ + libmpq__file_compressed(mpq_archive, file_number, &compressed); + + /* check if file is compressed. */ + if (compressed == 1) { + + /* decompress block. */ + if ((tb = libmpq__decompress_block(in_buf, in_size, out_buf, out_size, LIBMPQ_FLAG_COMPRESS_MULTI)) < 0) { + + /* free temporary buffer. */ + free(in_buf); + + /* something on decompressing block failed. */ + return LIBMPQ_ERROR_UNPACK; + } + } + + /* get implosion status. */ + libmpq__file_imploded(mpq_archive, file_number, &imploded); + + /* check if file is imploded. */ + if (imploded == 1) { + + /* explode block. */ + if ((tb = libmpq__decompress_block(in_buf, in_size, out_buf, out_size, LIBMPQ_FLAG_COMPRESS_PKZIP)) < 0) { + + /* free temporary buffer. */ + free(in_buf); + + /* something on decompressing block failed. */ + return LIBMPQ_ERROR_UNPACK; + } + } + + /* check if file is neither compressed nor imploded. */ + if (compressed == 0 && imploded == 0) { + + /* copy block. */ + if ((tb = libmpq__decompress_block(in_buf, in_size, out_buf, out_size, LIBMPQ_FLAG_COMPRESS_NONE)) < 0) { + + /* free temporary buffer. */ + free(in_buf); + + /* something on decompressing block failed. */ + return LIBMPQ_ERROR_UNPACK; + } + } + + /* free read buffer. */ + free(in_buf); + + /* check for null pointer. */ + if (transferred != NULL) { + + /* store transferred bytes. */ + *transferred = tb; + } + + /* if no error was found, return zero. */ + return LIBMPQ_SUCCESS; +} diff --git a/externals/libmpq/libmpq/mpq.h b/externals/libmpq/libmpq/mpq.h new file mode 100644 index 0000000..3d53e06 --- /dev/null +++ b/externals/libmpq/libmpq/mpq.h @@ -0,0 +1,98 @@ +/* + * mpq.h -- some default types and defines. + * + * Copyright (c) 2003-2008 Maik Broemme + * + * Some parts (the encryption and decryption stuff) were adapted from + * the C++ version of StormLib.h and StormPort.h included in stormlib. + * The C++ version belongs to the following authors: + * + * Ladislav Zezula + * Marko Friedemann + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MPQ_H +#define _MPQ_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* generic includes. */ +#include +#include + +#if defined(__GNUC__) && (__GNUC__ >= 4) +# define LIBMPQ_API __attribute__((visibility("default"))) +#else +# define LIBMPQ_API +#endif + +/* define errors. */ +#define LIBMPQ_ERROR_OPEN -1 /* open error on file. */ +#define LIBMPQ_ERROR_CLOSE -2 /* close error on file. */ +#define LIBMPQ_ERROR_SEEK -3 /* lseek error on file. */ +#define LIBMPQ_ERROR_READ -4 /* read error on file. */ +#define LIBMPQ_ERROR_WRITE -5 /* write error on file. */ +#define LIBMPQ_ERROR_MALLOC -6 /* memory allocation error. */ +#define LIBMPQ_ERROR_FORMAT -7 /* format errror. */ +#define LIBMPQ_ERROR_NOT_INITIALIZED -8 /* libmpq__init() wasn't called. */ +#define LIBMPQ_ERROR_SIZE -9 /* buffer size is to small. */ +#define LIBMPQ_ERROR_EXIST -10 /* file or block does not exist in archive. */ +#define LIBMPQ_ERROR_DECRYPT -11 /* we don't know the decryption seed. */ +#define LIBMPQ_ERROR_UNPACK -12 /* error on unpacking file. */ + +/* internal data structure. */ +typedef struct mpq_archive mpq_archive_s; + +/* file offset data type for API*/ +typedef int64_t libmpq__off_t; + +/* generic information about library. */ +extern LIBMPQ_API const char *libmpq__version(void); + +/* generic mpq archive information. */ +extern LIBMPQ_API int32_t libmpq__archive_open(mpq_archive_s **mpq_archive, const char *mpq_filename, libmpq__off_t archive_offset); +extern LIBMPQ_API int32_t libmpq__archive_close(mpq_archive_s *mpq_archive); +extern LIBMPQ_API int32_t libmpq__archive_packed_size(mpq_archive_s *mpq_archive, libmpq__off_t *packed_size); +extern LIBMPQ_API int32_t libmpq__archive_unpacked_size(mpq_archive_s *mpq_archive, libmpq__off_t *unpacked_size); +extern LIBMPQ_API int32_t libmpq__archive_offset(mpq_archive_s *mpq_archive, libmpq__off_t *offset); +extern LIBMPQ_API int32_t libmpq__archive_version(mpq_archive_s *mpq_archive, uint32_t *version); +extern LIBMPQ_API int32_t libmpq__archive_files(mpq_archive_s *mpq_archive, uint32_t *files); + +/* generic file processing functions. */ +extern LIBMPQ_API int32_t libmpq__file_packed_size(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *packed_size); +extern LIBMPQ_API int32_t libmpq__file_unpacked_size(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *unpacked_size); +extern LIBMPQ_API int32_t libmpq__file_offset(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *offset); +extern LIBMPQ_API int32_t libmpq__file_blocks(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *blocks); +extern LIBMPQ_API int32_t libmpq__file_encrypted(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *encrypted); +extern LIBMPQ_API int32_t libmpq__file_compressed(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *compressed); +extern LIBMPQ_API int32_t libmpq__file_imploded(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *imploded); +extern LIBMPQ_API int32_t libmpq__file_number(mpq_archive_s *mpq_archive, const char *filename, uint32_t *number); +extern LIBMPQ_API int32_t libmpq__file_read(mpq_archive_s *mpq_archive, uint32_t file_number, uint8_t *out_buf, libmpq__off_t out_size, libmpq__off_t *transferred); + +/* generic block processing functions. */ +extern LIBMPQ_API int32_t libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint32_t file_number); +extern LIBMPQ_API int32_t libmpq__block_close_offset(mpq_archive_s *mpq_archive, uint32_t file_number); +extern LIBMPQ_API int32_t libmpq__block_unpacked_size(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t block_number, libmpq__off_t *unpacked_size); +extern LIBMPQ_API int32_t libmpq__block_read(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t block_number, uint8_t *out_buf, libmpq__off_t out_size, libmpq__off_t *transferred); + +#ifdef __cplusplus +} +#endif + +#endif /* _MPQ_H */ diff --git a/externals/libmpq/libmpq/pack_begin.h b/externals/libmpq/libmpq/pack_begin.h new file mode 100644 index 0000000..eb4a6dd --- /dev/null +++ b/externals/libmpq/libmpq/pack_begin.h @@ -0,0 +1,34 @@ +/* + * pack_begin.h -- header file for struct packing used by libmpq. + * + * Copyright (c) 2010 Georg Lukas + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _PACK_BEGIN +#define _PACK_BEGIN +#else +#error "pack_begin.h may not be included twice!" +#endif + +#ifdef _MSC_VER + #pragma pack(push,1) + #define PACK_STRUCT +#else + /* we assume GNU here */ + #define PACK_STRUCT __attribute__((packed)) +#endif + diff --git a/externals/libmpq/libmpq/pack_end.h b/externals/libmpq/libmpq/pack_end.h new file mode 100644 index 0000000..a8a3511 --- /dev/null +++ b/externals/libmpq/libmpq/pack_end.h @@ -0,0 +1,31 @@ +/* + * pack_end.h -- header file for struct packing used by libmpq. + * + * Copyright (c) 2010 Georg Lukas + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef _PACK_BEGIN +#undef _PACK_BEGIN +#else +#error "pack_begin.h must be includede before pack_end.h" +#endif + +#ifdef _MSC_VER + #pragma pack(pop) +#endif + +#undef PACK_STRUCT diff --git a/externals/libmpq/libmpq/platform.h b/externals/libmpq/libmpq/platform.h new file mode 100644 index 0000000..68fdfdc --- /dev/null +++ b/externals/libmpq/libmpq/platform.h @@ -0,0 +1,28 @@ +/* + * platform.h -- header file for platform specific parts. + * + * Copyright (c) 2010 Georg Lukas + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _PLATFORM_H +#define _PLATFORM_H + +#ifdef _MSC_VER + #define fseeko _fseeki64 +#endif + +#endif /* _PLATFORM_H */ diff --git a/externals/libmpq/libmpq/wave.c b/externals/libmpq/libmpq/wave.c new file mode 100644 index 0000000..4f2b73b --- /dev/null +++ b/externals/libmpq/libmpq/wave.c @@ -0,0 +1,250 @@ +/* + * wave.c -- this file contains decompression methods used by mpq-tools + * to decompress wave files. + * + * Copyright (c) 2003-2007 Maik Broemme + * + * This source was adepted from the C++ version of wave.cpp included + * in stormlib. The C++ version belongs to the following authors: + * + * Ladislav Zezula + * Tom Amigo + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* generic includes. */ +#include + +/* libmpq generic includes. */ +#include "wave.h" + +/* table necessary dor decompression. */ +static const uint32_t wave_table_1503f120[] = { + 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000006, + 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, + 0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007, + 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000006, 0xFFFFFFFF, 0x00000008 +}; + +/* table necessary dor decompression. */ +static const uint32_t wave_table_1503f1a0[] = { + 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, + 0x00000010, 0x00000011, 0x00000013, 0x00000015, 0x00000017, 0x00000019, 0x0000001C, 0x0000001F, + 0x00000022, 0x00000025, 0x00000029, 0x0000002D, 0x00000032, 0x00000037, 0x0000003C, 0x00000042, + 0x00000049, 0x00000050, 0x00000058, 0x00000061, 0x0000006B, 0x00000076, 0x00000082, 0x0000008F, + 0x0000009D, 0x000000AD, 0x000000BE, 0x000000D1, 0x000000E6, 0x000000FD, 0x00000117, 0x00000133, + 0x00000151, 0x00000173, 0x00000198, 0x000001C1, 0x000001EE, 0x00000220, 0x00000256, 0x00000292, + 0x000002D4, 0x0000031C, 0x0000036C, 0x000003C3, 0x00000424, 0x0000048E, 0x00000502, 0x00000583, + 0x00000610, 0x000006AB, 0x00000756, 0x00000812, 0x000008E0, 0x000009C3, 0x00000ABD, 0x00000BD0, + 0x00000CFF, 0x00000E4C, 0x00000FBA, 0x0000114C, 0x00001307, 0x000014EE, 0x00001706, 0x00001954, + 0x00001BDC, 0x00001EA5, 0x000021B6, 0x00002515, 0x000028CA, 0x00002CDF, 0x0000315B, 0x0000364B, + 0x00003BB9, 0x000041B2, 0x00004844, 0x00004F7E, 0x00005771, 0x0000602F, 0x000069CE, 0x00007462, + 0x00007FFF +}; + +/* this function decompress a wave file, mono or stereo, 1500F230 offset. */ +int32_t libmpq__do_decompress_wave(uint8_t *out_buf, int32_t out_length, uint8_t *in_buf, int32_t in_length, int32_t channels) { + + /* some common variables. */ + byte_and_int16_t out; + byte_and_int16_t in; + uint32_t index; + int32_t nr_array1[2]; + int32_t nr_array2[2]; + uint32_t count = 0; + + /* end on input buffer. */ + uint8_t *in_end = in_buf + in_length; + + /* assign default values. */ + out.pb = out_buf; + in.pb = in_buf; + nr_array1[0] = 0x2C; + nr_array1[1] = 0x2C; + + /* increase. */ + in.pw++; + + /* 15007AD7 */ + for (count = 0; count < channels; count++) { + + /* some common variables. */ + int32_t temp; + + /* save pointer. */ + temp = *(int16_t *)in.pw++; + nr_array2[count] = temp; + + /* check if should break. */ + if (out_length < 2) { + return out.pb - out_buf; + } + + /* return values. */ + *out.pw++ = (uint16_t)temp; + out_length -= 2; + } + + /* decrease channels. */ + index = channels - 1; + + /* loop through input buffer until end reached. */ + while (in.pb < in_end) { + + /* save the byte. */ + uint8_t one_byte = *in.pb++; + + /* check how many channels and set index. */ + if (channels == 2) { + index = (index == 0) ? 1 : 0; + } + + /* 15007B25 - get one byte from input buffer. */ + if (one_byte & 0x80) { + + /* 15007B32 */ + switch (one_byte & 0x7F) { + case 0: + + /* 15007B8E */ + if (nr_array1[index] != 0) { + nr_array1[index]--; + } + + /* check if should break. */ + if (out_length < 2) { + break; + } + + /* return values. */ + *out.pw++ = (uint16_t)nr_array2[index]; + out_length -= 2; + + /* continue loop. */ + continue; + case 1: + /* 15007B72 and EBX. */ + nr_array1[index] += 8; + + /* check index. */ + if (nr_array1[index] > 0x58) { + nr_array1[index] = 0x58; + } + + /* check how many channels and set index. */ + if (channels == 2) { + index = (index == 0) ? 1 : 0; + } + + /* continue loop. */ + continue; + case 2: + + /* nothing todo, so continue. */ + continue; + default: + + /* decrease index. */ + nr_array1[index] -= 8; + + /* check index. */ + if (nr_array1[index] < 0) { + nr_array1[index] = 0; + } + + /* check if two channels left. */ + if (channels != 2) { + continue; + } + index = (index == 0) ? 1 : 0; + + /* continue loop. */ + continue; + } + } else { + + /* EDI */ + uint32_t temp1 = wave_table_1503f1a0[nr_array1[index]]; + + /* ESI */ + uint32_t temp2 = temp1 >> in_buf[1]; + + /* ECX */ + int32_t temp3 = nr_array2[index]; + + /* EBX = one byte. */ + if (one_byte & 0x01) { + temp2 += (temp1 >> 0); + } + if (one_byte & 0x02) { + temp2 += (temp1 >> 1); + } + if (one_byte & 0x04) { + temp2 += (temp1 >> 2); + } + if (one_byte & 0x08) { + temp2 += (temp1 >> 3); + } + if (one_byte & 0x10) { + temp2 += (temp1 >> 4); + } + if (one_byte & 0x20) { + temp2 += (temp1 >> 5); + } + if (one_byte & 0x40) { + temp3 -= temp2; + if (temp3 <= (int32_t)0xFFFF8000) { + temp3 = (int32_t)0xFFFF8000; + } + } else { + temp3 += temp2; + if (temp3 >= 0x7FFF) { + temp3 = 0x7FFF; + } + } + + /* restore index. */ + nr_array2[index] = temp3; + + /* check if should break. */ + if (out_length < 2) { + break; + } + + /* assign values. */ + temp2 = nr_array1[index]; + one_byte &= 0x1F; + *out.pw++ = (uint16_t)temp3; + out_length -= 2; + temp2 += wave_table_1503f120[one_byte]; + nr_array1[index] = temp2; + + /* check index. */ + if (nr_array1[index] < 0) { + nr_array1[index] = 0; + } else { + + /* check index. */ + if (nr_array1[index] > 0x58) { + nr_array1[index] = 0x58; + } + } + } + } + + /* return copied bytes. */ + return (out.pb - out_buf); +} diff --git a/externals/libmpq/libmpq/wave.h b/externals/libmpq/libmpq/wave.h new file mode 100644 index 0000000..1b9491b --- /dev/null +++ b/externals/libmpq/libmpq/wave.h @@ -0,0 +1,45 @@ +/* + * wave.h -- header file for wav unplode functions used by mpq-tools. + * + * Copyright (c) 2003-2007 Maik Broemme + * + * This source was adepted from the C++ version of wave.h included + * in stormlib. The C++ version belongs to the following authors: + * + * Ladislav Zezula + * Tom Amigo + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _WAVE_H +#define _WAVE_H + +/* buffer. */ +typedef union { + uint16_t *pw; + uint8_t *pb; +} byte_and_int16_t; + +/* decompress a wave file, mono or stereo, 1500F230 offset. */ +int32_t libmpq__do_decompress_wave( + uint8_t *out_buf, + int32_t out_length, + uint8_t *in_buf, + int32_t in_length, + int32_t channels +); + +#endif /* _WAVE_H */ diff --git a/externals/libmpq/tools/Makefile.am b/externals/libmpq/tools/Makefile.am new file mode 100644 index 0000000..6072053 --- /dev/null +++ b/externals/libmpq/tools/Makefile.am @@ -0,0 +1,8 @@ +# minimum required automake 1.6 +AUTOMAKE_OPTIONS = 1.6 + +# the main programs. +bin_PROGRAMS = crypt_buf_gen + +# sources for crypt_buf_gen program. +crypt_buf_gen_SOURCES = crypt_buf_gen.c diff --git a/externals/libmpq/tools/crypt_buf_gen.c b/externals/libmpq/tools/crypt_buf_gen.c new file mode 100644 index 0000000..3d150fc --- /dev/null +++ b/externals/libmpq/tools/crypt_buf_gen.c @@ -0,0 +1,85 @@ +/* + * crypt_buf_gen.c -- tool to re-create the static decryption buffer. + * + * Copyright (c) 2003-2008 Maik Broemme + * Copyright (c) 2008 Georg Lukas + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Usage: + * $ make crypt_buf_gen + * $ ./crypt_buf_gen > crypt_buf.h + * + */ +#include +#include +#include + +static uint32_t *buffer; + +int32_t libmpq__buffer_init() { + buffer = malloc(sizeof(uint32_t) * 0x500); + + if (!buffer) + return -1; + + /* some common variables. */ + uint32_t seed = 0x00100001; + uint32_t index1 = 0; + uint32_t index2 = 0; + uint32_t i; + + /* initialize the decryption buffer. */ + for (index1 = 0; index1 < 0x100; index1++) { + for(index2 = index1, i = 0; i < 5; i++, index2 += 0x100) { + + /* some common variables. */ + uint32_t temp1, temp2; + + /* temporary copy. */ + seed = (seed * 125 + 3) % 0x2AAAAB; + temp1 = (seed & 0xFFFF) << 0x10; + + /* temporary copy. */ + seed = (seed * 125 + 3) % 0x2AAAAB; + temp2 = (seed & 0xFFFF); + + /* assign buffer. */ + buffer[index2] = (temp1 | temp2); + } + } + + /* if no error was found, return zero. */ + return 0; +} + +int main() { + if (libmpq__buffer_init() != 0) + perror("libmpq__buffer_init()"); + int x; + printf("/* DO NOT CHANGE! this file is auto-generated by crypt_buf_gen.c */\n"); + printf("static const uint32_t crypt_buf[0x500] = {\n\t"); + for (x = 0; x < 0x500; x++) { + printf("0x%08x", buffer[x]); + if (x < 0x500 - 1) { + if (x % 6 == 5) + printf(",\n\t"); + else + printf(", "); + } + } + printf("\n};\n"); +} diff --git a/externals/libmpq/win/VC90/libmpq.vcproj b/externals/libmpq/win/VC90/libmpq.vcproj new file mode 100644 index 0000000..8394785 --- /dev/null +++ b/externals/libmpq/win/VC90/libmpq.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/externals/libmpq/win/VS100/libmpq.vcxproj b/externals/libmpq/win/VS100/libmpq.vcxproj new file mode 100644 index 0000000..e68a67c --- /dev/null +++ b/externals/libmpq/win/VS100/libmpq.vcxproj @@ -0,0 +1,115 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + libmpq + {03AB0F44-628E-4855-99A0-C98A1EB52C50} + libmpq + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\..\bin\$(Platform)_$(Configuration)\ + ..\bin\$(ProjectName)__$(Platform)_$(Configuration)\ + ..\..\bin\$(Platform)_$(Configuration)\ + ..\bin\$(ProjectName)__$(Platform)_$(Configuration)\ + + + + Disabled + ..\; ..\..\..\..\dep\include\zlib; ..\..\..\..\dep\include\bzip2;%(AdditionalIncludeDirectories) + WIN32;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + EditAndContinue + CompileAsC + + + true + + + ..\dep\lib\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) + + + + + MaxSpeed + true + ..\; ..\..\..\..\dep\include\zlib; ..\..\..\..\dep\include\bzip2;%(AdditionalIncludeDirectories) + WIN32;%(PreprocessorDefinitions) + MultiThreadedDLL + true + StreamingSIMDExtensions + Level3 + ProgramDatabase + CompileAsC + + + true + + + ..\dep\lib\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + {b96f612a-c91d-43b3-a4c3-d4294817ec6c} + false + + + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} + false + + + + + + \ No newline at end of file diff --git a/externals/libmpq/win/config.h b/externals/libmpq/win/config.h new file mode 100644 index 0000000..6833494 --- /dev/null +++ b/externals/libmpq/win/config.h @@ -0,0 +1,81 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +#define HAVE_LIBBZ2 1 + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 0 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libmpq" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "mbroemme@plusserver.de" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libmpq" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libmpq 0.4.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libmpq" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.4.2" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.4.2" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ diff --git a/externals/libmpq/win/dirent.h b/externals/libmpq/win/dirent.h new file mode 100644 index 0000000..6425174 --- /dev/null +++ b/externals/libmpq/win/dirent.h @@ -0,0 +1,230 @@ +/***************************************************************************** + * dirent.h - dirent API for Microsoft Visual Studio + * + * Copyright (C) 2006 Toni Ronkko + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * ``Software''), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Dec 15, 2009, John Cunningham + * Added rewinddir member function + * + * Jan 18, 2008, Toni Ronkko + * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string + * between multi-byte and unicode representations. This makes the + * code simpler and also allows the code to be compiled under MingW. Thanks + * to Azriel Fasten for the suggestion. + * + * Mar 4, 2007, Toni Ronkko + * Bug fix: due to the strncpy_s() function this file only compiled in + * Visual Studio 2005. Using the new string functions only when the + * compiler version allows. + * + * Nov 2, 2006, Toni Ronkko + * Major update: removed support for Watcom C, MS-DOS and Turbo C to + * simplify the file, updated the code to compile cleanly on Visual + * Studio 2005 with both unicode and multi-byte character strings, + * removed rewinddir() as it had a bug. + * + * Aug 20, 2006, Toni Ronkko + * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified + * comments by removing SGML tags. + * + * May 14 2002, Toni Ronkko + * Embedded the function definitions directly to the header so that no + * source modules need to be included in the Visual Studio project. Removed + * all the dependencies to other projects so that this very header can be + * used independently. + * + * May 28 1998, Toni Ronkko + * First version. + *****************************************************************************/ +#ifndef DIRENT_H +#define DIRENT_H + +#include +#include +#include + + +typedef struct dirent +{ + char d_name[MAX_PATH + 1]; /* current dir entry (multi-byte char string) */ + WIN32_FIND_DATAA data; /* file attributes */ +} dirent; + + +typedef struct DIR +{ + dirent current; /* Current directory entry */ + int cached; /* Indicates un-processed entry in memory */ + HANDLE search_handle; /* File search handle */ + char patt[MAX_PATH + 3]; /* search pattern (3 = pattern + "\\*\0") */ +} DIR; + + +/* Forward declarations */ +static DIR *opendir (const char *dirname); +static struct dirent *readdir (DIR *dirp); +static int closedir (DIR *dirp); +static void rewinddir(DIR* dirp); + + +/* Use the new safe string functions introduced in Visual Studio 2005 */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE) +#else +# define STRNCPY(dest,src,size) strncpy((dest),(src),(size)) +#endif + + +/***************************************************************************** + * Open directory stream DIRNAME for read and return a pointer to the + * internal working area that is used to retrieve individual directory + * entries. + */ +static DIR *opendir(const char *dirname) +{ + DIR *dirp; + assert (dirname != NULL); + assert (strlen (dirname) < MAX_PATH); + + /* construct new DIR structure */ + dirp = (DIR*) malloc (sizeof (struct DIR)); + if (dirp != NULL) { + char *p; + + /* take directory name... */ + STRNCPY (dirp->patt, dirname, sizeof(dirp->patt)); + dirp->patt[MAX_PATH] = '\0'; + + /* ... and append search pattern to it */ + p = strchr (dirp->patt, '\0'); + if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') { + *p++ = '\\'; + } + *p++ = '*'; + *p = '\0'; + + /* open stream and retrieve first file */ + dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* invalid search pattern? */ + free (dirp); + return NULL; + } + + /* there is an un-processed directory entry in memory now */ + dirp->cached = 1; + } + + return dirp; +} + + +/***************************************************************************** + * Read a directory entry, and return a pointer to a dirent structure + * containing the name of the entry in d_name field. Individual directory + * entries returned by this very function include regular files, + * sub-directories, pseudo-directories "." and "..", but also volume labels, + * hidden files and system files may be returned. + */ +static struct dirent *readdir(DIR *dirp) +{ + assert (dirp != NULL); + + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* directory stream was opened/rewound incorrectly or ended normally */ + return NULL; + } + + /* get next directory entry */ + if (dirp->cached != 0) { + /* a valid directory entry already in memory */ + dirp->cached = 0; + } else { + /* read next directory entry from disk */ + if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) { + /* the very last file has been processed or an error occured */ + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + return NULL; + } + } + + /* copy as a multibyte character string */ + STRNCPY ( dirp->current.d_name, + dirp->current.data.cFileName, + sizeof(dirp->current.d_name) ); + dirp->current.d_name[MAX_PATH] = '\0'; + + return &dirp->current; +} + + +/***************************************************************************** + * Close directory stream opened by opendir() function. Close of the + * directory stream invalidates the DIR structure as well as any previously + * read directory entry. + */ +static int closedir(DIR *dirp) +{ + assert (dirp != NULL); + + /* release search handle */ + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + } + + /* release directory handle */ + free (dirp); + return 0; +} + + +/***************************************************************************** + * Resets the position of the directory stream to which dirp refers to the + * beginning of the directory. It also causes the directory stream to refer + * to the current state of the corresponding directory, as a call to opendir() + * would have done. If dirp does not refer to a directory stream, the effect + * is undefined. + */ +static void rewinddir(DIR* dirp) +{ + /* release search handle */ + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + } + + /* open new search handle and retrieve first file */ + dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* invalid search pattern? */ + free (dirp); + return; + } + + /* there is an un-processed directory entry in memory now */ + dirp->cached = 1; +} + + +#endif /*DIRENT_H*/ diff --git a/externals/libmpq/win/libmpq_VC100.sln b/externals/libmpq/win/libmpq_VC100.sln new file mode 100644 index 0000000..5c88e2e --- /dev/null +++ b/externals/libmpq/win/libmpq_VC100.sln @@ -0,0 +1,31 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmpq", "VS100\libmpq.vcxproj", "{03AB0F44-628E-4855-99A0-C98A1EB52C50}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\win\VC100\zlib.vcxproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "..\..\..\win\VC100\bzip2.vcxproj", "{B96F612A-C91D-43B3-A4C3-D4294817EC6C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Debug|Win32.ActiveCfg = Debug|Win32 + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Debug|Win32.Build.0 = Debug|Win32 + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Release|Win32.ActiveCfg = Release|Win32 + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Release|Win32.Build.0 = Release|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.ActiveCfg = Debug|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.Build.0 = Debug|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.ActiveCfg = Release|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.Build.0 = Release|Win32 + {B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Debug|Win32.ActiveCfg = Debug|Win32 + {B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Debug|Win32.Build.0 = Debug|Win32 + {B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Release|Win32.ActiveCfg = Release|Win32 + {B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/libmpq/win/libmpq_VC90.sln b/externals/libmpq/win/libmpq_VC90.sln new file mode 100644 index 0000000..c55968a --- /dev/null +++ b/externals/libmpq/win/libmpq_VC90.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmpq", "VC90\libmpq.vcproj", "{03AB0F44-628E-4855-99A0-C98A1EB52C50}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Debug|Win32.ActiveCfg = Debug|Win32 + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Debug|Win32.Build.0 = Debug|Win32 + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Release|Win32.ActiveCfg = Release|Win32 + {03AB0F44-628E-4855-99A0-C98A1EB52C50}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/libmpq/win/stdint.h b/externals/libmpq/win/stdint.h new file mode 100644 index 0000000..d02608a --- /dev/null +++ b/externals/libmpq/win/stdint.h @@ -0,0 +1,247 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. 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. +// +// 3. The name of the author may 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. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + + +#endif // _MSC_STDINT_H_ ] diff --git a/externals/mersennetwister/MersenneTwister.h b/externals/mersennetwister/MersenneTwister.h new file mode 100644 index 0000000..1cff879 --- /dev/null +++ b/externals/mersennetwister/MersenneTwister.h @@ -0,0 +1,405 @@ +// MersenneTwister.h +// Mersenne Twister random number generator -- a C++ class MTRand +// Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus +// Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com + +// The Mersenne Twister is an algorithm for generating random numbers. It +// was designed with consideration of the flaws in various other generators. +// The period, 2^19937-1, and the order of equidistribution, 623 dimensions, +// are far greater. The generator is also fast; it avoids multiplication and +// division, and it benefits from caches and pipelines. For more information +// see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html + +// Reference +// M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally +// Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on +// Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. + +// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +// Copyright (C) 2000 - 2003, Richard J. Wagner +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. 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. +// +// 3. The names of its contributors may not be used to endorse or promote +// products derived from this software without specific prior written +// permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR +// 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. + +// The original code included the following notice: +// +// When you use this, send an email to: matumoto@math.keio.ac.jp +// with an appropriate reference to your work. +// +// It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu +// when you write. + +#ifndef MERSENNETWISTER_H +#define MERSENNETWISTER_H + +// Not thread safe (unless auto-initialization is avoided and each thread has +// its own MTRand object) + +#include"Define.h" + +#include +#include +#include + +class MTRand { +// Data +public: + typedef ::uint32 uint32; + enum { N = 624 }; // length of state vector + enum { SAVE = N + 1 }; // length of array for save() + +protected: + enum { M = 397 }; // period parameter + + uint32 state[N]; // internal state + uint32 *pNext; // next value to get from state + int left; // number of values left before reload needed + +//Methods +public: + MTRand( const uint32& oneSeed ); // initialize with a simple uint32 + MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array + MTRand(); // auto-initialize with /dev/urandom or time() and clock() + MTRand(const MTRand&); // prevent copy constructor + MTRand& operator=(const MTRand&); // no-op operator= + + // Do NOT use for CRYPTOGRAPHY without securely hashing several returned + // values together, otherwise the generator state can be learned after + // reading 624 consecutive values. + + // Access to 32-bit random numbers + double rand(); // real number in [0,1] + double rand( const double& n ); // real number in [0,n] + double randExc(); // real number in [0,1) + double randExc( const double& n ); // real number in [0,n) + double randDblExc(); // real number in (0,1) + double randDblExc( const double& n ); // real number in (0,n) + uint32 randInt(); // integer in [0,2^32-1] + uint32 randInt( const uint32& n ); // integer in [0,n] for n < 2^32 + double operator()() { return rand(); } // same as rand() + + // Access to 53-bit random numbers (capacity of IEEE double precision) + double rand53(); // real number in [0,1) + + // Access to nonuniform random number distributions + double randNorm( const double& mean = 0.0, const double& variance = 0.0 ); + + // Re-seeding functions with same behavior as initializers + void seed( const uint32 oneSeed ); + void seed( uint32 *const bigSeed, const uint32 seedLength = N ); + void seed(); + + // Saving and loading generator state + void save( uint32* saveArray ) const; // to array of size SAVE + void load( uint32 *const loadArray ); // from such array + /* Trinity not use streams for random values output + friend std::ostream& operator<<( std::ostream& os, const MTRand& mtrand ); + friend std::istream& operator>>( std::istream& is, MTRand& mtrand ); + */ +protected: + void initialize( const uint32 oneSeed ); + void reload(); + uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; } + uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; } + uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; } + uint32 mixBits( const uint32& u, const uint32& v ) const + { return hiBit(u) | loBits(v); } + uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const + { return m ^ (mixBits(s0,s1)>>1) ^ uint32(-(int32)(loBit(s1) & 0x9908b0dfUL)); } + static uint32 hash( time_t t, clock_t c ); +}; + +inline MTRand::MTRand(const MTRand&) + { seed(); } + +inline MTRand& MTRand::operator=(const MTRand&) + { return *this; } + +inline MTRand::MTRand( const uint32& oneSeed ) + { seed(oneSeed); } + +inline MTRand::MTRand( uint32 *const bigSeed, const uint32 seedLength ) + { seed(bigSeed,seedLength); } + +inline MTRand::MTRand() + { seed(); } + +inline double MTRand::rand() + { return double(randInt()) * (1.0/4294967295.0); } + +inline double MTRand::rand( const double& n ) + { return rand() * n; } + +inline double MTRand::randExc() + { return double(randInt()) * (1.0/4294967296.0); } + +inline double MTRand::randExc( const double& n ) + { return randExc() * n; } + +inline double MTRand::randDblExc() + { return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); } + +inline double MTRand::randDblExc( const double& n ) + { return randDblExc() * n; } + +inline double MTRand::rand53() +{ + uint32 a = randInt() >> 5, b = randInt() >> 6; + return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0); // by Isaku Wada +} + +inline double MTRand::randNorm( const double& mean, const double& variance ) +{ + // Return a real number from a normal (Gaussian) distribution with given + // mean and variance by Box-Muller method + double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance; + double phi = 2.0 * 3.14159265358979323846264338328 * randExc(); + return mean + r * cos(phi); +} + +inline MTRand::uint32 MTRand::randInt() +{ + // Pull a 32-bit integer from the generator state + // Every other access function simply transforms the numbers extracted here + + if( left == 0 ) reload(); + --left; + + register uint32 s1; + s1 = *pNext++; + s1 ^= (s1 >> 11); + s1 ^= (s1 << 7) & 0x9d2c5680UL; + s1 ^= (s1 << 15) & 0xefc60000UL; + return ( s1 ^ (s1 >> 18) ); +} + +inline MTRand::uint32 MTRand::randInt( const uint32& n ) +{ + // Find which bits are used in n + // Optimized by Magnus Jonsson (magnus@smartelectronix.com) + uint32 used = n; + used |= used >> 1; + used |= used >> 2; + used |= used >> 4; + used |= used >> 8; + used |= used >> 16; + + // Draw numbers until one is found in [0,n] + uint32 i; + do + i = randInt() & used; // toss unused bits to shorten search + while( i > n ); + return i; +} + +inline void MTRand::seed( const uint32 oneSeed ) +{ + // Seed the generator with a simple uint32 + initialize(oneSeed); + reload(); +} + +inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength ) +{ + // Seed the generator with an array of uint32's + // There are 2^19937-1 possible initial states. This function allows + // all of those to be accessed by providing at least 19937 bits (with a + // default seed length of N = 624 uint32's). Any bits above the lower 32 + // in each element are discarded. + // Just call seed() if you want to get array from /dev/urandom + initialize(19650218UL); + register int i = 1; + register uint32 j = 0; + register int k = ( N > int(seedLength) ? N : int(seedLength) ); + for (; k; --k ) + { + state[i] = + state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL ); + state[i] += ( bigSeed[j] & 0xffffffffUL ) + j; + state[i] &= 0xffffffffUL; + ++i; ++j; + if( i >= N ) { state[0] = state[N-1]; i = 1; } + if( j >= seedLength ) j = 0; + } + for (k = N - 1; k; --k ) + { + state[i] = + state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL ); + state[i] -= i; + state[i] &= 0xffffffffUL; + ++i; + if( i >= N ) { state[0] = state[N-1]; i = 1; } + } + state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array + reload(); +} + +inline void MTRand::seed() +{ + // Seed the generator with hash of time() and clock() values + seed( hash( time(NULL), clock() ) ); +} + +inline void MTRand::initialize( const uint32 seed ) +{ + // Initialize generator state with seed + // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. + // In previous versions, most significant bits (MSBs) of the seed affect + // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. + register uint32 *s = state; + register uint32 *r = state; + register int i = 1; + *s++ = seed & 0xffffffffUL; + for (; i < N; ++i ) + { + *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL; + r++; + } +} + +inline void MTRand::reload() +{ + // Generate N new values in state + // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) + register uint32 *p = state; + register int i; + for (i = N - M; i--; ++p ) + *p = twist( p[M], p[0], p[1] ); + for (i = M; --i; ++p ) + *p = twist( p[M-N], p[0], p[1] ); + *p = twist( p[M-N], p[0], state[0] ); + + left = N, pNext = state; +} + +inline MTRand::uint32 MTRand::hash( time_t t, clock_t c ) +{ + // Get a uint32 from t and c + // Better than uint32(x) in case x is floating point in [0,1] + // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk) + + static uint32 differ = 0; // guarantee time-based seeds will change + + uint32 h1 = 0; + unsigned char *p = (unsigned char *) &t; + for (size_t i = 0; i < sizeof(t); ++i ) + { + h1 *= UCHAR_MAX + 2U; + h1 += p[i]; + } + uint32 h2 = 0; + p = (unsigned char *) &c; + for (size_t j = 0; j < sizeof(c); ++j ) + { + h2 *= UCHAR_MAX + 2U; + h2 += p[j]; + } + return ( h1 + differ++ ) ^ h2; +} + +inline void MTRand::save( uint32* saveArray ) const +{ + register uint32 *sa = saveArray; + register const uint32 *s = state; + register int i = N; + for (; i--; *sa++ = *s++ ) {} + *sa = left; +} + +inline void MTRand::load( uint32 *const loadArray ) +{ + register uint32 *s = state; + register uint32 *la = loadArray; + register int i = N; + for (; i--; *s++ = *la++ ) {} + left = *la; + pNext = &state[N-left]; +} + +/* Trinity not use streams for random values output +inline std::ostream& operator<<( std::ostream& os, const MTRand& mtrand ) +{ + register const MTRand::uint32 *s = mtrand.state; + register int i = mtrand.N; + for (; i--; os << *s++ << "\t" ) {} + return os << mtrand.left; +} + +inline std::istream& operator>>( std::istream& is, MTRand& mtrand ) +{ + register MTRand::uint32 *s = mtrand.state; + register int i = mtrand.N; + for (; i--; is >> *s++ ) {} + is >> mtrand.left; + mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left]; + return is; +} +*/ + +#endif // MERSENNETWISTER_H + +// Change log: +// +// v0.1 - First release on 15 May 2000 +// - Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus +// - Translated from C to C++ +// - Made completely ANSI compliant +// - Designed convenient interface for initialization, seeding, and +// obtaining numbers in default or user-defined ranges +// - Added automatic seeding from /dev/urandom or time() and clock() +// - Provided functions for saving and loading generator state +// +// v0.2 - Fixed bug which reloaded generator one step too late +// +// v0.3 - Switched to clearer, faster reload() code from Matthew Bellew +// +// v0.4 - Removed trailing newline in saved generator format to be consistent +// with output format of built-in types +// +// v0.5 - Improved portability by replacing static const int's with enum's and +// clarifying return values in seed(); suggested by Eric Heimburg +// - Removed MAXINT constant; use 0xffffffffUL instead +// +// v0.6 - Eliminated seed overflow when uint32 is larger than 32 bits +// - Changed integer [0,n] generator to give better uniformity +// +// v0.7 - Fixed operator precedence ambiguity in reload() +// - Added access for real numbers in (0,1) and (0,n) +// +// v0.8 - Included time.h header to properly support time_t and clock_t +// +// v1.0 - Revised seeding to match 26 Jan 2002 update of Nishimura and Matsumoto +// - Allowed for seeding with arrays of any length +// - Added access for real numbers in [0,1) with 53-bit resolution +// - Added access for real numbers from normal (Gaussian) distributions +// - Increased overall speed by optimizing twist() +// - Doubled speed of integer [0,n] generation +// - Fixed out-of-range number generation on 64-bit machines +// - Improved portability by substituting literal constants for long enum's +// - Changed license from GNU LGPL to BSD + diff --git a/externals/mysql/atomic/gcc_builtins.h b/externals/mysql/atomic/gcc_builtins.h new file mode 100644 index 0000000..4600a0e --- /dev/null +++ b/externals/mysql/atomic/gcc_builtins.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2008 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define MY_ATOMIC_MODE "atomic_builtins" + +#define make_atomic_add_body(S) \ + v= __sync_fetch_and_add(a, v); +#define make_atomic_swap_body(S) \ + v= __sync_lock_test_and_set(a, v); +#define make_atomic_cas_body(S) \ + int ## S sav; \ + sav= __sync_val_compare_and_swap(a, *cmp, set); \ + if (!(ret= (sav == *cmp))) *cmp= sav; + +#ifdef MY_ATOMIC_MODE_DUMMY +#define make_atomic_load_body(S) ret= *a +#define make_atomic_store_body(S) *a= v +#define MY_ATOMIC_MODE "gcc-builtins-up" + +#else +#define MY_ATOMIC_MODE "gcc-builtins-smp" +#define make_atomic_load_body(S) \ + ret= __sync_fetch_and_or(a, 0); +#define make_atomic_store_body(S) \ + (void) __sync_lock_test_and_set(a, v); +#endif diff --git a/externals/mysql/atomic/generic-msvc.h b/externals/mysql/atomic/generic-msvc.h new file mode 100644 index 0000000..a8601e9 --- /dev/null +++ b/externals/mysql/atomic/generic-msvc.h @@ -0,0 +1,115 @@ +/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _atomic_h_cleanup_ +#define _atomic_h_cleanup_ "atomic/generic-msvc.h" + +/* + We don't implement anything specific for MY_ATOMIC_MODE_DUMMY, always use + intrinsics. + 8 and 16-bit atomics are not implemented, but it can be done if necessary. +*/ + +/* + x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate + function calls to kernel32 instead, even in the optimized build. + We force intrinsics as described in MSDN documentation for + _InterlockedCompareExchange. +*/ +#ifdef _M_IX86 + +#if (_MSC_VER >= 1500) +#include +#else +C_MODE_START +/*Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics*/ +LONG _InterlockedExchange (LONG volatile *Target,LONG Value); +LONG _InterlockedCompareExchange (LONG volatile *Target, LONG Value, LONG Comp); +LONG _InterlockedExchangeAdd (LONG volatile *Addend, LONG Value); +C_MODE_END + +#pragma intrinsic(_InterlockedExchangeAdd) +#pragma intrinsic(_InterlockedCompareExchange) +#pragma intrinsic(_InterlockedExchange) +#endif + +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +/* + No need to do something special for InterlockedCompareExchangePointer + as it is a #define to InterlockedCompareExchange. The same applies to + InterlockedExchangePointer. +*/ +#endif /*_M_IX86*/ + +#define MY_ATOMIC_MODE "msvc-intrinsics" +#define IL_EXCHG_ADD32(X,Y) InterlockedExchangeAdd((volatile LONG *)(X),(Y)) +#define IL_COMP_EXCHG32(X,Y,Z) InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z)) +#define IL_COMP_EXCHGptr InterlockedCompareExchangePointer +#define IL_EXCHG32(X,Y) InterlockedExchange((volatile LONG *)(X),(Y)) +#define IL_EXCHGptr InterlockedExchangePointer +#define make_atomic_add_body(S) \ + v= IL_EXCHG_ADD ## S (a, v) +#define make_atomic_cas_body(S) \ + int ## S initial_cmp= *cmp; \ + int ## S initial_a= IL_COMP_EXCHG ## S (a, set, initial_cmp); \ + if (!(ret= (initial_a == initial_cmp))) *cmp= initial_a; +#define make_atomic_swap_body(S) \ + v= IL_EXCHG ## S (a, v) +#define make_atomic_load_body(S) \ + ret= 0; /* avoid compiler warning */ \ + ret= IL_COMP_EXCHG ## S (a, ret, ret); + +/* + my_yield_processor (equivalent of x86 PAUSE instruction) should be used + to improve performance on hyperthreaded CPUs. Intel recommends to use it in + spin loops also on non-HT machines to reduce power consumption (see e.g + http://softwarecommunity.intel.com/articles/eng/2004.htm) + + Running benchmarks for spinlocks implemented with InterlockedCompareExchange + and YieldProcessor shows that much better performance is achieved by calling + YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting + loop count in the range 200-300 brought best results. + */ +#ifndef YIELD_LOOPS +#define YIELD_LOOPS 200 +#endif + +static __inline int my_yield_processor() +{ + int i; + for(i=0; irw) +#define my_atomic_rwlock_init(name) pthread_mutex_init(& (name)->rw, 0) +#define my_atomic_rwlock_rdlock(name) pthread_mutex_lock(& (name)->rw) +#define my_atomic_rwlock_wrlock(name) pthread_mutex_lock(& (name)->rw) +#define my_atomic_rwlock_rdunlock(name) pthread_mutex_unlock(& (name)->rw) +#define my_atomic_rwlock_wrunlock(name) pthread_mutex_unlock(& (name)->rw) +#define MY_ATOMIC_MODE "mutex" +#ifndef MY_ATOMIC_MODE_RWLOCKS +#define MY_ATOMIC_MODE_RWLOCKS 1 +#endif +#endif + +#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav; +#define make_atomic_fas_body(S) int ## S sav; sav= *a; *a= v; v=sav; +#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a; +#define make_atomic_load_body(S) ret= *a; +#define make_atomic_store_body(S) *a= v; + diff --git a/externals/mysql/atomic/x86-gcc.h b/externals/mysql/atomic/x86-gcc.h new file mode 100644 index 0000000..5a34bc2 --- /dev/null +++ b/externals/mysql/atomic/x86-gcc.h @@ -0,0 +1,69 @@ +/* Copyright (C) 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + XXX 64-bit atomic operations can be implemented using + cmpxchg8b, if necessary. Though I've heard that not all 64-bit + architectures support double-word (128-bit) cas. +*/ + +#ifdef __x86_64__ +# ifdef MY_ATOMIC_NO_XADD +# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd" +# else +# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix +# endif +#else +# ifdef MY_ATOMIC_NO_XADD +# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix "-no-xadd" +# else +# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix +# endif +#endif + +/* fix -ansi errors while maintaining readability */ +#ifndef asm +#define asm __asm__ +#endif + +#ifndef MY_ATOMIC_NO_XADD +#define make_atomic_add_body(S) \ + asm volatile (LOCK_prefix "; xadd %0, %1;" : "+r" (v) , "+m" (*a)) +#endif +#define make_atomic_fas_body(S) \ + asm volatile ("xchg %0, %1;" : "+r" (v) , "+m" (*a)) +#define make_atomic_cas_body(S) \ + asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \ + : "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set)) + +#ifdef MY_ATOMIC_MODE_DUMMY +#define make_atomic_load_body(S) ret=*a +#define make_atomic_store_body(S) *a=v +#else +/* + Actually 32-bit reads/writes are always atomic on x86 + But we add LOCK_prefix here anyway to force memory barriers +*/ +#define make_atomic_load_body(S) \ + ret=0; \ + asm volatile (LOCK_prefix "; cmpxchg %2, %0" \ + : "+m" (*a), "+a" (ret): "r" (ret)) +#define make_atomic_store_body(S) \ + asm volatile ("; xchg %0, %1;" : "+m" (*a), "+r" (v)) +#endif + +/* TODO test on intel whether the below helps. on AMD it makes no difference */ +//#define LF_BACKOFF ({asm volatile ("rep; nop"); 1; }) + diff --git a/externals/mysql/base64.h b/externals/mysql/base64.h new file mode 100644 index 0000000..155d669 --- /dev/null +++ b/externals/mysql/base64.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef __BASE64_H_INCLUDED__ +#define __BASE64_H_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + Calculate how much memory needed for dst of base64_encode() +*/ +int my_base64_needed_encoded_length(int length_of_data); + +/* + Calculate how much memory needed for dst of base64_decode() +*/ +int my_base64_needed_decoded_length(int length_of_encoded_data); + + +/* + Encode data as a base64 string +*/ +int my_base64_encode(const void *src, size_t src_len, char *dst); + +/* + Decode a base64 string into data +*/ +int my_base64_decode(const char *src, size_t src_len, + void *dst, const char **end_ptr); + + +#ifdef __cplusplus +} +#endif +#endif /* !__BASE64_H_INCLUDED__ */ diff --git a/externals/mysql/config-win.h b/externals/mysql/config-win.h new file mode 100644 index 0000000..9457721 --- /dev/null +++ b/externals/mysql/config-win.h @@ -0,0 +1,392 @@ +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Defines for Win32 to make it compatible for MySQL */ + +#define BIG_TABLES + +/* + Minimal version of Windows we should be able to run on. + Currently Windows 2000 +*/ +#define _WIN32_WINNT 0x0500 + + +#if defined(_MSC_VER) && _MSC_VER >= 1400 +/* Avoid endless warnings about sprintf() etc. being unsafe. */ +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + +#include +#include /* chmod() constants*/ +#include +#include +#include +#include +#include +#include +#include /* getpid()*/ + +#define HAVE_SMEM 1 + +#if defined(_WIN64) || defined(WIN64) +#define SYSTEM_TYPE "Win64" +#elif defined(_WIN32) || defined(WIN32) +#define SYSTEM_TYPE "Win32" +#else +#define SYSTEM_TYPE "Windows" +#endif + +#if defined(_M_IA64) +#define MACHINE_TYPE "ia64" +#elif defined(_M_IX86) +#define MACHINE_TYPE "ia32" +#elif defined(_M_ALPHA) +#define MACHINE_TYPE "axp" +#else +#define MACHINE_TYPE "unknown" /* Define to machine type name */ +#endif + +#if !(defined(_WIN64) || defined(WIN64)) +#ifndef _WIN32 +#define _WIN32 /* Compatible with old source */ +#endif +#ifndef __WIN32__ +#define __WIN32__ +#endif +#endif /* _WIN64 */ +#ifndef __WIN__ +#define __WIN__ /* To make it easier in VC++ */ +#endif + +#ifndef MAX_INDEXES +#define MAX_INDEXES 64 +#endif + +/* File and lock constants */ +#ifdef __BORLANDC__ +#define F_RDLCK LK_NBLCK /* read lock */ +#define F_WRLCK LK_NBRLCK /* write lock */ +#define F_UNLCK LK_UNLCK /* remove lock(s) */ +#else +#define F_RDLCK _LK_NBLCK /* read lock */ +#define F_WRLCK _LK_NBRLCK /* write lock */ +#define F_UNLCK _LK_UNLCK /* remove lock(s) */ +#endif + +#define F_EXCLUSIVE 1 /* We have only exclusive locking */ +#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */ +#define F_OK 0 /* parameter to access() */ +#define W_OK 2 + +#define S_IROTH S_IREAD /* for my_lib */ + +/* for MY_S_ISFIFO() macro from my_lib */ +#if defined (_S_IFIFO) && !defined (S_IFIFO) +#define S_IFIFO _S_IFIFO +#endif + +/* Winsock2 constant (Vista SDK and later)*/ +#define IPPROTO_IPV6 41 +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif + +/* + Constants used by chmod. Note, that group/others is ignored + - because unsupported by Windows due to different access control model. +*/ +#define S_IRWXU S_IREAD|S_IWRITE +#define S_IRWXG 0 +#define S_IRWXO 0 +typedef int mode_t; + +#ifdef __BORLANDC__ +#define FILE_BINARY O_BINARY /* my_fopen in binary mode */ +#define O_TEMPORARY 0 +#define O_SHORT_LIVED 0 +#define SH_DENYNO _SH_DENYNO +#else +#define O_BINARY _O_BINARY /* compability with older style names */ +#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */ +#define O_TEMPORARY _O_TEMPORARY +#define O_SHORT_LIVED _O_SHORT_LIVED +#define SH_DENYNO _SH_DENYNO +#endif +#define NO_OPEN_3 /* For my_create() */ + +#define SIGQUIT SIGTERM /* No SIGQUIT */ + +#undef _REENTRANT /* Crashes something for win32 */ +#undef SAFE_MUTEX /* Can't be used on windows */ + +#define LONGLONG_MIN 0x8000000000000000LL +#define LONGLONG_MAX 0x7FFFFFFFFFFFFFFFLL +#define ULONGLONG_MAX 0xFFFFFFFFFFFFFFFFULL + +/* Type information */ + +#if !defined(HAVE_UINT) +#undef HAVE_UINT +#define HAVE_UINT +typedef unsigned short ushort; +typedef unsigned int uint; +#endif /* !defined(HAVE_UINT) */ + +typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */ +typedef __int64 longlong; +#ifndef HAVE_SIGSET_T +typedef int sigset_t; +#endif +#define longlong_defined +/* + off_t should not be __int64 because of conflicts in header files; + Use my_off_t or os_off_t instead +*/ +#ifndef HAVE_OFF_T +typedef long off_t; +#endif +typedef __int64 os_off_t; +#ifdef _WIN64 +typedef UINT_PTR rf_SetTimer; +#else +typedef uint rf_SetTimer; +#endif + +#ifndef HAVE_SIZE_T +#ifndef _SIZE_T_DEFINED +typedef SIZE_T size_t; +#define _SIZE_T_DEFINED +#endif +#endif + +#ifndef HAVE_SSIZE_T +#ifndef _SSIZE_T_DEFINED +typedef SSIZE_T ssize_t; +#define _SSIZE_T_DEFINED +#endif +#endif + +#define Socket_defined +#define my_socket SOCKET +#define SIGPIPE SIGINT +#define RETQSORTTYPE void +#define QSORT_TYPE_IS_VOID +#define SOCKET_SIZE_TYPE int +#define my_socket_defined +#define byte_defined +#define HUGE_PTR +#define STDCALL __stdcall /* Used by libmysql.dll */ +#define isnan(X) _isnan(X) +#define finite(X) _finite(X) + +#ifndef UNDEF_THREAD_HACK +#define THREAD +#endif +#define VOID_SIGHANDLER +#define SIZEOF_CHAR 1 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_OFF_T 8 +#ifdef _WIN64 +#define SIZEOF_CHARP 8 +#else +#define SIZEOF_CHARP 4 +#endif +#define HAVE_BROKEN_NETINET_INCLUDES +#ifdef _WIN32 +#define HAVE_NAMED_PIPE /* We can only create pipes on NT */ +#endif + +/* ERROR is defined in wingdi.h */ +#undef ERROR + +/* We need to close files to break connections on shutdown */ +#ifndef SIGNAL_WITH_VIO_CLOSE +#define SIGNAL_WITH_VIO_CLOSE +#endif + +/* All windows servers should support .sym files */ +#undef USE_SYMDIR +#define USE_SYMDIR + +/* If LOAD DATA LOCAL INFILE should be enabled by default */ +#define ENABLED_LOCAL_INFILE 1 + +/* If query profiling should be enabled by default */ +#define ENABLED_PROFILING 1 + +/* Convert some simple functions to Posix */ + +#define my_sigset(A,B) signal((A),(B)) +#define finite(A) _finite(A) +#define sleep(A) Sleep((A)*1000) +#define popen(A,B) _popen((A),(B)) +#define pclose(A) _pclose(A) + +#ifndef __BORLANDC__ +#define access(A,B) _access(A,B) +#endif + +#if !defined(__cplusplus) +#define inline __inline +#endif /* __cplusplus */ + +#ifdef _WIN64 +#define ulonglong2double(A) ((double) (ulonglong) (A)) +#define my_off_t2double(A) ((double) (my_off_t) (A)) + +#else +inline double ulonglong2double(ulonglong value) +{ + longlong nr=(longlong) value; + if (nr >= 0) + return (double) nr; + return (18446744073709551616.0 + (double) nr); +} +#define my_off_t2double(A) ulonglong2double(A) +#endif /* _WIN64 */ + +inline ulonglong double2ulonglong(double d) +{ + double t= d - (double) 0x8000000000000000ULL; + + if (t >= 0) + return ((ulonglong) t) + 0x8000000000000000ULL; + return (ulonglong) d; +} + +#if SIZEOF_OFF_T > 4 +#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C)) +#define tell(A) _telli64(A) +#endif + +#define STACK_DIRECTION -1 + +/* Difference between GetSystemTimeAsFileTime() and now() */ +#define OFFSET_TO_EPOCH 116444736000000000ULL + +#define HAVE_PERROR +#define HAVE_VFPRINT +#define HAVE_RENAME /* Have rename() as function */ +#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */ +#define HAVE_LONG_JMP /* Have long jump function */ +#define HAVE_LOCKING /* have locking() call */ +#define HAVE_ERRNO_AS_DEFINE /* errno is a define */ +#define HAVE_STDLIB /* everything is include in this file */ +#define HAVE_MEMCPY +#define HAVE_MEMMOVE +#define HAVE_GETCWD +#define HAVE_TELL +#define HAVE_TZNAME +#define HAVE_PUTENV +#define HAVE_SELECT +#define HAVE_SETLOCALE +#define HAVE_SOCKET /* Giangi */ +#define HAVE_FLOAT_H +#define HAVE_LIMITS_H +#define HAVE_STDDEF_H +#define NO_FCNTL_NONBLOCK /* No FCNTL */ +#define HAVE_ALLOCA +#define HAVE_STRPBRK +#define HAVE_STRSTR +#define HAVE_COMPRESS +#define HAVE_CREATESEMAPHORE +#define HAVE_ISNAN +#define HAVE_FINITE +#define HAVE_QUERY_CACHE +#define SPRINTF_RETURNS_INT +#define HAVE_SETFILEPOINTER +#define HAVE_VIO_READ_BUFF +#if defined(_MSC_VER) && _MSC_VER >= 1400 +/* strnlen() appeared in Studio 2005 */ +#define HAVE_STRNLEN +#endif +#define HAVE_WINSOCK2 + +#define strcasecmp stricmp +#define strncasecmp strnicmp + +#ifndef _WIN32 +#undef FILE_SHARE_DELETE +#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */ +#endif + +#ifdef NOT_USED +#define HAVE_SNPRINTF /* Gave link error */ +#define _snprintf snprintf +#endif + +#ifdef _MSC_VER +#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */ +#define HAVE_ANSI_INCLUDE +#define HAVE_SYS_UTIME_H +#define HAVE_STRTOUL +#endif +#define my_reinterpret_cast(A) reinterpret_cast +#define my_const_cast(A) const_cast + + +/* MYSQL OPTIONS */ + +#ifdef _CUSTOMCONFIG_ +#include +#else +#define DEFAULT_MYSQL_HOME "c:\\mysql" +#define DATADIR "c:\\mysql\\data" +#define PACKAGE "mysql" +#define DEFAULT_BASEDIR "C:\\" +#define SHAREDIR "share" +#define DEFAULT_CHARSET_HOME "C:/mysql/" +#endif +#ifndef DEFAULT_HOME_ENV +#define DEFAULT_HOME_ENV MYSQL_HOME +#endif +#ifndef DEFAULT_GROUP_SUFFIX_ENV +#define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX +#endif + +/* File name handling */ + +#define FN_LIBCHAR '\\' +#define FN_ROOTDIR "\\" +#define FN_DEVCHAR ':' +#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ +#define FN_NO_CASE_SENCE /* Files are not case-sensitive */ +#define OS_FILE_LIMIT UINT_MAX /* No limit*/ + +#define DO_NOT_REMOVE_THREAD_WRAPPERS +#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) +#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) +/* The following is only used for statistics, so it should be good enough */ +#ifdef _WIN32 /* This should also work on Win98 but .. */ +#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) +#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) +#endif + +#define shared_memory_buffer_length 16000 +#define default_shared_memory_base_name "MYSQL" + +#define HAVE_SPATIAL 1 +#define HAVE_RTREE_KEYS 1 + +#define HAVE_OPENSSL 1 +#define HAVE_YASSL 1 + +#define COMMUNITY_SERVER 1 +#define ENABLED_PROFILING 1 + +#define HAVE_BOOL 1 diff --git a/externals/mysql/decimal.h b/externals/mysql/decimal.h new file mode 100644 index 0000000..530ed9e --- /dev/null +++ b/externals/mysql/decimal.h @@ -0,0 +1,107 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _decimal_h +#define _decimal_h + +typedef enum +{TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} + decimal_round_mode; +typedef int32 decimal_digit_t; + +typedef struct st_decimal_t { + int intg, frac, len; + my_bool sign; + decimal_digit_t *buf; +} decimal_t; + +int internal_str2dec(const char *from, decimal_t *to, char **end, + my_bool fixed); +int decimal2string(decimal_t *from, char *to, int *to_len, + int fixed_precision, int fixed_decimals, + char filler); +int decimal2ulonglong(decimal_t *from, ulonglong *to); +int ulonglong2decimal(ulonglong from, decimal_t *to); +int decimal2longlong(decimal_t *from, longlong *to); +int longlong2decimal(longlong from, decimal_t *to); +int decimal2double(decimal_t *from, double *to); +int double2decimal(double from, decimal_t *to); +int decimal_actual_fraction(decimal_t *from); +int decimal2bin(decimal_t *from, uchar *to, int precision, int scale); +int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale); + +int decimal_size(int precision, int scale); +int decimal_bin_size(int precision, int scale); +int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, + int param); + +int decimal_intg(decimal_t *from); +int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_cmp(decimal_t *from1, decimal_t *from2); +int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to, + int scale_incr); +int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to); +int decimal_round(decimal_t *from, decimal_t *to, int new_scale, + decimal_round_mode mode); +int decimal_is_zero(decimal_t *from); +void max_decimal(int precision, int frac, decimal_t *to); + +#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0) +#define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1) + +/* set a decimal_t to zero */ + +#define decimal_make_zero(dec) do { \ + (dec)->buf[0]=0; \ + (dec)->intg=1; \ + (dec)->frac=0; \ + (dec)->sign=0; \ + } while(0) + +/* + returns the length of the buffer to hold string representation + of the decimal (including decimal dot, possible sign and \0) +*/ + +#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \ + (dec)->frac + ((dec)->frac > 0) + 2) + +/* negate a decimal */ +#define decimal_neg(dec) do { (dec)->sign^=1; } while(0) + +/* + conventions: + + decimal_smth() == 0 -- everything's ok + decimal_smth() <= 1 -- result is usable, but precision loss is possible + decimal_smth() <= 2 -- result can be unusable, most significant digits + could've been lost + decimal_smth() > 2 -- no result was generated +*/ + +#define E_DEC_OK 0 +#define E_DEC_TRUNCATED 1 +#define E_DEC_OVERFLOW 2 +#define E_DEC_DIV_ZERO 4 +#define E_DEC_BAD_NUM 8 +#define E_DEC_OOM 16 + +#define E_DEC_ERROR 31 +#define E_DEC_FATAL_ERROR 30 + +#endif + diff --git a/externals/mysql/errmsg.h b/externals/mysql/errmsg.h new file mode 100644 index 0000000..92d70ab --- /dev/null +++ b/externals/mysql/errmsg.h @@ -0,0 +1,103 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Error messages for MySQL clients */ +/* (Error messages for the daemon are in sql/share/errmsg.txt) */ + +#ifdef __cplusplus +extern "C" { +#endif +void init_client_errs(void); +void finish_client_errs(void); +extern const char *client_errors[]; /* Error messages */ +#ifdef __cplusplus +} +#endif + +#define CR_MIN_ERROR 2000 /* For easier client code */ +#define CR_MAX_ERROR 2999 +#if !defined(ER) +#define ER(X) client_errors[(X)-CR_MIN_ERROR] +#endif +#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */ + +/* Do not add error numbers before CR_ERROR_FIRST. */ +/* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */ +#define CR_ERROR_FIRST 2000 /*Copy first error nr.*/ +#define CR_UNKNOWN_ERROR 2000 +#define CR_SOCKET_CREATE_ERROR 2001 +#define CR_CONNECTION_ERROR 2002 +#define CR_CONN_HOST_ERROR 2003 +#define CR_IPSOCK_ERROR 2004 +#define CR_UNKNOWN_HOST 2005 +#define CR_SERVER_GONE_ERROR 2006 +#define CR_VERSION_ERROR 2007 +#define CR_OUT_OF_MEMORY 2008 +#define CR_WRONG_HOST_INFO 2009 +#define CR_LOCALHOST_CONNECTION 2010 +#define CR_TCP_CONNECTION 2011 +#define CR_SERVER_HANDSHAKE_ERR 2012 +#define CR_SERVER_LOST 2013 +#define CR_COMMANDS_OUT_OF_SYNC 2014 +#define CR_NAMEDPIPE_CONNECTION 2015 +#define CR_NAMEDPIPEWAIT_ERROR 2016 +#define CR_NAMEDPIPEOPEN_ERROR 2017 +#define CR_NAMEDPIPESETSTATE_ERROR 2018 +#define CR_CANT_READ_CHARSET 2019 +#define CR_NET_PACKET_TOO_LARGE 2020 +#define CR_EMBEDDED_CONNECTION 2021 +#define CR_PROBE_SLAVE_STATUS 2022 +#define CR_PROBE_SLAVE_HOSTS 2023 +#define CR_PROBE_SLAVE_CONNECT 2024 +#define CR_PROBE_MASTER_CONNECT 2025 +#define CR_SSL_CONNECTION_ERROR 2026 +#define CR_MALFORMED_PACKET 2027 +#define CR_WRONG_LICENSE 2028 + +/* new 4.1 error codes */ +#define CR_NULL_POINTER 2029 +#define CR_NO_PREPARE_STMT 2030 +#define CR_PARAMS_NOT_BOUND 2031 +#define CR_DATA_TRUNCATED 2032 +#define CR_NO_PARAMETERS_EXISTS 2033 +#define CR_INVALID_PARAMETER_NO 2034 +#define CR_INVALID_BUFFER_USE 2035 +#define CR_UNSUPPORTED_PARAM_TYPE 2036 + +#define CR_SHARED_MEMORY_CONNECTION 2037 +#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038 +#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039 +#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040 +#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041 +#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042 +#define CR_SHARED_MEMORY_MAP_ERROR 2043 +#define CR_SHARED_MEMORY_EVENT_ERROR 2044 +#define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045 +#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046 +#define CR_CONN_UNKNOW_PROTOCOL 2047 +#define CR_INVALID_CONN_HANDLE 2048 +#define CR_SECURE_AUTH 2049 +#define CR_FETCH_CANCELED 2050 +#define CR_NO_DATA 2051 +#define CR_NO_STMT_METADATA 2052 +#define CR_NO_RESULT_SET 2053 +#define CR_NOT_IMPLEMENTED 2054 +#define CR_SERVER_LOST_EXTENDED 2055 +#define CR_STMT_CLOSED 2056 +#define CR_NEW_STMT_METADATA 2057 +#define CR_ALREADY_CONNECTED 2058 +#define CR_ERROR_LAST /*Copy last error nr:*/ 2058 +/* Add error numbers before CR_ERROR_LAST and change it accordingly. */ + diff --git a/externals/mysql/extlib/dbug/dbug.c b/externals/mysql/extlib/dbug/dbug.c new file mode 100644 index 0000000..68932ad --- /dev/null +++ b/externals/mysql/extlib/dbug/dbug.c @@ -0,0 +1,2583 @@ +/****************************************************************************** + * * + * N O T I C E * + * * + * Copyright Abandoned, 1987, Fred Fish * + * * + * * + * This previously copyrighted work has been placed into the public * + * domain by the author and may be freely used for any purpose, * + * private or commercial. * + * * + * Because of the number of inquiries I was receiving about the use * + * of this product in commercially developed works I have decided to * + * simply make it public domain to further its unrestricted use. I * + * specifically would be most happy to see this material become a * + * part of the standard Unix distributions by AT&T and the Berkeley * + * Computer Science Research Group, and a standard part of the GNU * + * system from the Free Software Foundation. * + * * + * I would appreciate it, as a courtesy, if this notice is left in * + * all copies and derivative works. Thank you. * + * * + * The author makes no warranty of any kind with respect to this * + * product and explicitly disclaims any implied warranties of mer- * + * chantability or fitness for any particular purpose. * + * * + ****************************************************************************** + */ + +/* + * FILE + * + * dbug.c runtime support routines for dbug package + * + * SCCS + * + * @(#)dbug.c 1.25 7/25/89 + * + * DESCRIPTION + * + * These are the runtime support routines for the dbug package. + * The dbug package has two main components; the user include + * file containing various macro definitions, and the runtime + * support routines which are called from the macro expansions. + * + * Externally visible functions in the runtime support module + * use the naming convention pattern "_db_xx...xx_", thus + * they are unlikely to collide with user defined function names. + * + * AUTHOR(S) + * + * Fred Fish (base code) + * Enhanced Software Technologies, Tempe, AZ + * asuvax!mcdphx!estinc!fnf + * + * Binayak Banerjee (profiling enhancements) + * seismo!bpa!sjuvax!bbanerje + * + * Michael Widenius: + * DBUG_DUMP - To dump a block of memory. + * PUSH_FLAG "O" - To be used insted of "o" if we + * want flushing after each write + * PUSH_FLAG "A" - as 'O', but we will append to the out file instead + * of creating a new one. + * Check of malloc on entry/exit (option "S") + * + * Sergei Golubchik: + * DBUG_EXECUTE_IF + * incremental mode (-#+t:-d,info ...) + * DBUG_SET, _db_explain_ + * thread-local settings + * negative lists (-#-d,info => everything but "info") + * + * function/ syntax + * (the logic is - think of a call stack as of a path. + * "function" means only this function, "function/" means the hierarchy. + * in the future, filters like function1/function2 could be supported. + * following this logic glob(7) wildcards are supported.) + * + */ + +/* + We can't have SAFE_MUTEX defined here as this will cause recursion + in pthread_mutex_lock +*/ + +#undef SAFE_MUTEX +#include +#include +#include + +#ifdef HAVE_FNMATCH_H +#include +#else +#define fnmatch(A,B,C) strcmp(A,B) +#endif + +#if defined(MSDOS) || defined(__WIN__) +#include +#endif + +#ifndef DBUG_OFF + + +/* + * Manifest constants which may be "tuned" if desired. + */ + +#define PRINTBUF 1024 /* Print buffer size */ +#define INDENT 2 /* Indentation per trace level */ +#define MAXDEPTH 200 /* Maximum trace depth default */ + +/* + * The following flags are used to determine which + * capabilities the user has enabled with the settings + * push macro. + * + * TRACE_ON is also used in _db_stack_frame_->level + * (until we add flags to _db_stack_frame_, increasing it by 4 bytes) + */ + +#define DEBUG_ON (1 << 1) /* Debug enabled */ +#define FILE_ON (1 << 2) /* File name print enabled */ +#define LINE_ON (1 << 3) /* Line number print enabled */ +#define DEPTH_ON (1 << 4) /* Function nest level print enabled */ +#define PROCESS_ON (1 << 5) /* Process name print enabled */ +#define NUMBER_ON (1 << 6) /* Number each line of output */ +#define PROFILE_ON (1 << 7) /* Print out profiling code */ +#define PID_ON (1 << 8) /* Identify each line with process id */ +#define TIMESTAMP_ON (1 << 9) /* timestamp every line of output */ +#define SANITY_CHECK_ON (1 << 10) /* Check safemalloc on DBUG_ENTER */ +#define FLUSH_ON_WRITE (1 << 11) /* Flush on every write */ +#define OPEN_APPEND (1 << 12) /* Open for append */ +#define TRACE_ON ((uint)1 << 31) /* Trace enabled. MUST be the highest bit!*/ + +#define TRACING (cs->stack->flags & TRACE_ON) +#define DEBUGGING (cs->stack->flags & DEBUG_ON) +#define PROFILING (cs->stack->flags & PROFILE_ON) + +/* + * Typedefs to make things more obvious. + */ + +#define BOOLEAN my_bool + +/* + * Make it easy to change storage classes if necessary. + */ + +#define IMPORT extern /* Names defined externally */ +#define EXPORT /* Allocated here, available globally */ +#define AUTO auto /* Names to be allocated on stack */ +#define REGISTER register /* Names to be placed in registers */ + +/* + * The default file for profiling. Could also add another flag + * (G?) which allowed the user to specify this. + * + * If the automatic variables get allocated on the stack in + * reverse order from their declarations, then define AUTOS_REVERSE to 1. + * This is used by the code that keeps track of stack usage. For + * forward allocation, the difference in the dbug frame pointers + * represents stack used by the callee function. For reverse allocation, + * the difference represents stack used by the caller function. + * + */ + +#define PROF_FILE "dbugmon.out" +#define PROF_EFMT "E\t%ld\t%s\n" +#define PROF_SFMT "S\t%lx\t%lx\t%s\n" +#define PROF_XFMT "X\t%ld\t%s\n" + +#ifdef M_I386 /* predefined by xenix 386 compiler */ +#define AUTOS_REVERSE 1 +#else +#define AUTOS_REVERSE 0 +#endif + +/* + * Externally supplied functions. + */ + +#ifndef HAVE_PERROR +static void perror(); /* Fake system/library error print routine */ +#endif + +#ifdef SAFEMALLOC +IMPORT int _sanity(const char *file,uint line); /* safemalloc sanity checker */ +#else +#define _sanity(X,Y) (1) +#endif + +/* + * The user may specify a list of functions to trace or + * debug. These lists are kept in a linear linked list, + * a very simple implementation. + */ + +struct link { + struct link *next_link; /* Pointer to the next link */ + char flags; + char str[1]; /* Pointer to link's contents */ +}; + +/* flags for struct link and return flags of InList */ +#define SUBDIR 1 /* this MUST be 1 */ +#define INCLUDE 2 +#define EXCLUDE 4 +/* this is not a struct link flag, but only a return flags of InList */ +#define MATCHED 65536 +#define NOT_MATCHED 0 + +/* + * Debugging settings can be pushed or popped off of a + * stack which is implemented as a linked list. Note + * that the head of the list is the current settings and the + * stack is pushed by adding a new settings to the head of the + * list or popped by removing the first link. + * + * Note: if out_file is NULL, the other fields are not initialized at all! + */ + +struct settings { + uint flags; /* Current settings flags */ + uint maxdepth; /* Current maximum trace depth */ + uint delay; /* Delay after each output line */ + uint sub_level; /* Sub this from code_state->level */ + FILE *out_file; /* Current output stream */ + FILE *prof_file; /* Current profiling stream */ + char name[FN_REFLEN]; /* Name of output file */ + struct link *functions; /* List of functions */ + struct link *p_functions; /* List of profiled functions */ + struct link *keywords; /* List of debug keywords */ + struct link *processes; /* List of process names */ + struct settings *next; /* Next settings in the list */ +}; + +#define is_shared(S, V) ((S)->next && (S)->next->V == (S)->V) + +/* + * Local variables not seen by user. + */ + + +static BOOLEAN init_done= FALSE; /* Set to TRUE when initialization done */ +static struct settings init_settings; +static const char *db_process= 0;/* Pointer to process name; argv[0] */ +my_bool _dbug_on_= TRUE; /* FALSE if no debugging at all */ + +typedef struct _db_code_state_ { + const char *process; /* Pointer to process name; usually argv[0] */ + const char *func; /* Name of current user function */ + const char *file; /* Name of current user file */ + struct _db_stack_frame_ *framep; /* Pointer to current frame */ + struct settings *stack; /* debugging settings */ + const char *jmpfunc; /* Remember current function for setjmp */ + const char *jmpfile; /* Remember current file for setjmp */ + int lineno; /* Current debugger output line number */ + uint level; /* Current function nesting level */ + int jmplevel; /* Remember nesting level at setjmp() */ + +/* + * The following variables are used to hold the state information + * between the call to _db_pargs_() and _db_doprnt_(), during + * expansion of the DBUG_PRINT macro. This is the only macro + * that currently uses these variables. + * + * These variables are currently used only by _db_pargs_() and + * _db_doprnt_(). + */ + + uint u_line; /* User source code line number */ + int locked; /* If locked with _db_lock_file_ */ + const char *u_keyword; /* Keyword for current macro */ +} CODE_STATE; + +/* + The test below is so we could call functions with DBUG_ENTER before + my_thread_init(). +*/ +#define get_code_state_if_not_set_or_return if (!cs && !((cs=code_state()))) return +#define get_code_state_or_return if (!((cs=code_state()))) return + + /* Handling lists */ +#define ListAdd(A,B,C) ListAddDel(A,B,C,INCLUDE) +#define ListDel(A,B,C) ListAddDel(A,B,C,EXCLUDE) +static struct link *ListAddDel(struct link *, const char *, const char *, int); +static struct link *ListCopy(struct link *); +static int InList(struct link *linkp,const char *cp); +static uint ListFlags(struct link *linkp); +static void FreeList(struct link *linkp); + + /* OpenClose debug output stream */ +static void DBUGOpenFile(CODE_STATE *,const char *, const char *, int); +static void DBUGCloseFile(CODE_STATE *cs, FILE *fp); + /* Push current debug settings */ +static void PushState(CODE_STATE *cs); + /* Free memory associated with debug state. */ +static void FreeState (CODE_STATE *cs, struct settings *state, int free_state); + /* Test for tracing enabled */ +static int DoTrace(CODE_STATE *cs); +/* + return values of DoTrace. + Can also be used as bitmask: ret & DO_TRACE +*/ +#define DO_TRACE 1 +#define DONT_TRACE 2 +#define ENABLE_TRACE 3 +#define DISABLE_TRACE 4 + + /* Test to see if file is writable */ +#if defined(HAVE_ACCESS) && !defined(MSDOS) +static BOOLEAN Writable(const char *pathname); + /* Change file owner and group */ +static void ChangeOwner(CODE_STATE *cs, char *pathname); + /* Allocate memory for runtime support */ +#endif + +static void DoPrefix(CODE_STATE *cs, uint line); + +static char *DbugMalloc(size_t size); +static const char *BaseName(const char *pathname); +static void Indent(CODE_STATE *cs, int indent); +static void DbugFlush(CODE_STATE *); +static void DbugExit(const char *why); +static const char *DbugStrTok(const char *s); +static void DbugFprintf(FILE *stream, const char* format, va_list args); + +#ifndef THREAD + /* Open profile output stream */ +static FILE *OpenProfile(CODE_STATE *cs, const char *name); + /* Profile if asked for it */ +static BOOLEAN DoProfile(CODE_STATE *); + /* Return current user time (ms) */ +static unsigned long Clock(void); +#endif + +/* + * Miscellaneous printf format strings. + */ + +#define ERR_MISSING_RETURN "%s: missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"%s\"\n" +#define ERR_OPEN "%s: can't open debug output stream \"%s\": " +#define ERR_CLOSE "%s: can't close debug file: " +#define ERR_ABORT "%s: debugger aborting because %s\n" +#define ERR_CHOWN "%s: can't change owner/group of \"%s\": " + +/* + * Macros and defines for testing file accessibility under UNIX and MSDOS. + */ + +#undef EXISTS +#if !defined(HAVE_ACCESS) || defined(MSDOS) +#define EXISTS(pathname) (FALSE) /* Assume no existance */ +#define Writable(name) (TRUE) +#else +#define EXISTS(pathname) (access(pathname, F_OK) == 0) +#define WRITABLE(pathname) (access(pathname, W_OK) == 0) +#endif +#ifndef MSDOS +#define ChangeOwner(cs,name) +#endif + + +/* +** Macros to allow dbugging with threads +*/ + +#ifdef THREAD +#include +static pthread_mutex_t THR_LOCK_dbug; + +static CODE_STATE *code_state(void) +{ + CODE_STATE *cs, **cs_ptr; + + /* + _dbug_on_ is reset if we don't plan to use any debug commands at all and + we want to run on maximum speed + */ + if (!_dbug_on_) + return 0; + + if (!init_done) + { + init_done=TRUE; + pthread_mutex_init(&THR_LOCK_dbug,MY_MUTEX_INIT_FAST); + bzero(&init_settings, sizeof(init_settings)); + init_settings.out_file=stderr; + init_settings.flags=OPEN_APPEND; + } + + if (!(cs_ptr= (CODE_STATE**) my_thread_var_dbug())) + return 0; /* Thread not initialised */ + if (!(cs= *cs_ptr)) + { + cs=(CODE_STATE*) DbugMalloc(sizeof(*cs)); + bzero((uchar*) cs,sizeof(*cs)); + cs->process= db_process ? db_process : "dbug"; + cs->func="?func"; + cs->file="?file"; + cs->stack=&init_settings; + *cs_ptr= cs; + } + return cs; +} + +#else /* !THREAD */ + +static CODE_STATE static_code_state= +{ + "dbug", "?func", "?file", NULL, &init_settings, + NullS, NullS, 0,0,0,0,0,NullS +}; + +static CODE_STATE *code_state(void) +{ + if (!init_done) + { + bzero(&init_settings, sizeof(init_settings)); + init_settings.out_file=stderr; + init_settings.flags=OPEN_APPEND; + init_done=TRUE; + } + return &static_code_state; +} + +#define pthread_mutex_lock(A) {} +#define pthread_mutex_unlock(A) {} +#endif + +/* + * Translate some calls among different systems. + */ + +#ifdef HAVE_SLEEP +/* sleep() wants seconds */ +#define Delay(A) sleep(((uint) A)/10) +#else +#define Delay(A) (0) +#endif + +/* + * FUNCTION + * + * _db_process_ give the name to the current process/thread + * + * SYNOPSIS + * + * VOID _process_(name) + * char *name; + * + */ + +void _db_process_(const char *name) +{ + CODE_STATE *cs; + + if (!db_process) + db_process= name; + + get_code_state_or_return; + cs->process= name; +} + +/* + * FUNCTION + * + * DbugParse parse control string and set current debugger settings + * + * DESCRIPTION + * + * Given pointer to a debug control string in "control", + * parses the control string, and sets + * up a current debug settings. + * + * The debug control string is a sequence of colon separated fields + * as follows: + * + * [+]::...: + * + * Each field consists of a mandatory flag character followed by + * an optional "," and comma separated list of modifiers: + * + * [sign]flag[,modifier,modifier,...,modifier] + * + * See the manual for the list of supported signs, flags, and modifiers + * + * For convenience, any leading "-#" is stripped off. + * + * RETURN + * 1 - a list of functions ("f" flag) was possibly changed + * 0 - a list of functions was not changed + */ + +int DbugParse(CODE_STATE *cs, const char *control) +{ + const char *end; + int rel, f_used=0; + struct settings *stack; + + stack= cs->stack; + + if (control[0] == '-' && control[1] == '#') + control+=2; + + rel= control[0] == '+' || control[0] == '-'; + if ((!rel || (!stack->out_file && !stack->next))) + { + FreeState(cs, stack, 0); + stack->flags= 0; + stack->delay= 0; + stack->maxdepth= 0; + stack->sub_level= 0; + stack->out_file= stderr; + stack->prof_file= NULL; + stack->functions= NULL; + stack->p_functions= NULL; + stack->keywords= NULL; + stack->processes= NULL; + } + else if (!stack->out_file) + { + stack->flags= stack->next->flags; + stack->delay= stack->next->delay; + stack->maxdepth= stack->next->maxdepth; + stack->sub_level= stack->next->sub_level; + strcpy(stack->name, stack->next->name); + stack->out_file= stack->next->out_file; + stack->prof_file= stack->next->prof_file; + if (stack->next == &init_settings) + { + /* never share with the global parent - it can change under your feet */ + stack->functions= ListCopy(init_settings.functions); + stack->p_functions= ListCopy(init_settings.p_functions); + stack->keywords= ListCopy(init_settings.keywords); + stack->processes= ListCopy(init_settings.processes); + } + else + { + stack->functions= stack->next->functions; + stack->p_functions= stack->next->p_functions; + stack->keywords= stack->next->keywords; + stack->processes= stack->next->processes; + } + } + + end= DbugStrTok(control); + while (control < end) + { + int c, sign= (*control == '+') ? 1 : (*control == '-') ? -1 : 0; + if (sign) control++; + c= *control++; + if (*control == ',') control++; + /* XXX when adding new cases here, don't forget _db_explain_ ! */ + switch (c) { + case 'd': + if (sign < 0 && control == end) + { + if (!is_shared(stack, keywords)) + FreeList(stack->keywords); + stack->keywords=NULL; + stack->flags &= ~DEBUG_ON; + break; + } + if (rel && is_shared(stack, keywords)) + stack->keywords= ListCopy(stack->keywords); + if (sign < 0) + { + if (DEBUGGING) + stack->keywords= ListDel(stack->keywords, control, end); + break; + } + stack->keywords= ListAdd(stack->keywords, control, end); + stack->flags |= DEBUG_ON; + break; + case 'D': + stack->delay= atoi(control); + break; + case 'f': + f_used= 1; + if (sign < 0 && control == end) + { + if (!is_shared(stack,functions)) + FreeList(stack->functions); + stack->functions=NULL; + break; + } + if (rel && is_shared(stack,functions)) + stack->functions= ListCopy(stack->functions); + if (sign < 0) + stack->functions= ListDel(stack->functions, control, end); + else + stack->functions= ListAdd(stack->functions, control, end); + break; + case 'F': + if (sign < 0) + stack->flags &= ~FILE_ON; + else + stack->flags |= FILE_ON; + break; + case 'i': + if (sign < 0) + stack->flags &= ~PID_ON; + else + stack->flags |= PID_ON; + break; +#ifndef THREAD + case 'g': + if (OpenProfile(cs, PROF_FILE)) + { + stack->flags |= PROFILE_ON; + stack->p_functions= ListAdd(stack->p_functions, control, end); + } + break; +#endif + case 'L': + if (sign < 0) + stack->flags &= ~LINE_ON; + else + stack->flags |= LINE_ON; + break; + case 'n': + if (sign < 0) + stack->flags &= ~DEPTH_ON; + else + stack->flags |= DEPTH_ON; + break; + case 'N': + if (sign < 0) + stack->flags &= ~NUMBER_ON; + else + stack->flags |= NUMBER_ON; + break; + case 'A': + case 'O': + stack->flags |= FLUSH_ON_WRITE; + /* fall through */ + case 'a': + case 'o': + if (sign < 0) + { + if (!is_shared(stack, out_file)) + DBUGCloseFile(cs, stack->out_file); + stack->flags &= ~FLUSH_ON_WRITE; + stack->out_file= stderr; + break; + } + if (c == 'a' || c == 'A') + stack->flags |= OPEN_APPEND; + else + stack->flags &= ~OPEN_APPEND; + if (control != end) + DBUGOpenFile(cs, control, end, stack->flags & OPEN_APPEND); + else + DBUGOpenFile(cs, "-",0,0); + break; + case 'p': + if (sign < 0 && control == end) + { + if (!is_shared(stack,processes)) + FreeList(stack->processes); + stack->processes=NULL; + break; + } + if (rel && is_shared(stack, processes)) + stack->processes= ListCopy(stack->processes); + if (sign < 0) + stack->processes= ListDel(stack->processes, control, end); + else + stack->processes= ListAdd(stack->processes, control, end); + break; + case 'P': + if (sign < 0) + stack->flags &= ~PROCESS_ON; + else + stack->flags |= PROCESS_ON; + break; + case 'r': + stack->sub_level= cs->level; + break; + case 't': + if (sign < 0) + { + if (control != end) + stack->maxdepth-= atoi(control); + else + stack->maxdepth= 0; + } + else + { + if (control != end) + stack->maxdepth+= atoi(control); + else + stack->maxdepth= MAXDEPTH; + } + if (stack->maxdepth > 0) + stack->flags |= TRACE_ON; + else + stack->flags &= ~TRACE_ON; + break; + case 'T': + if (sign < 0) + stack->flags &= ~TIMESTAMP_ON; + else + stack->flags |= TIMESTAMP_ON; + break; + case 'S': + if (sign < 0) + stack->flags &= ~SANITY_CHECK_ON; + else + stack->flags |= SANITY_CHECK_ON; + break; + } + if (!*end) + break; + control=end+1; + end= DbugStrTok(control); + } + return !rel || f_used; +} + +#define framep_trace_flag(cs, frp) (frp ? \ + frp->level & TRACE_ON : \ + (ListFlags(cs->stack->functions) & INCLUDE) ? \ + 0 : (uint)TRACE_ON) + +void FixTraceFlags_helper(CODE_STATE *cs, const char *func, + struct _db_stack_frame_ *framep) +{ + if (framep->prev) + FixTraceFlags_helper(cs, framep->func, framep->prev); + + cs->func= func; + cs->level= framep->level & ~TRACE_ON; + framep->level= cs->level | framep_trace_flag(cs, framep->prev); + /* + we don't set cs->framep correctly, even though DoTrace uses it. + It's ok, because cs->framep may only affect DO_TRACE/DONT_TRACE return + values, but we ignore them here anyway + */ + switch(DoTrace(cs)) { + case ENABLE_TRACE: + framep->level|= TRACE_ON; + break; + case DISABLE_TRACE: + framep->level&= ~TRACE_ON; + break; + } +} + +#define fflags(cs) cs->stack->out_file ? ListFlags(cs->stack->functions) : TRACE_ON; + +void FixTraceFlags(uint old_fflags, CODE_STATE *cs) +{ + const char *func; + uint new_fflags, traceon, level; + struct _db_stack_frame_ *framep; + + /* + first (a.k.a. safety) check: + if we haven't started tracing yet, no call stack at all - we're safe. + */ + framep=cs->framep; + if (framep == 0) + return; + + /* + Ok, the tracing has started, call stack isn't empty. + + second check: does the new list have a SUBDIR rule ? + */ + new_fflags=fflags(cs); + if (new_fflags & SUBDIR) + goto yuck; + + /* + Ok, new list doesn't use SUBDIR. + + third check: we do NOT need to re-scan if + neither old nor new lists used SUBDIR flag and if a default behavior + (whether an unlisted function is traced) hasn't changed. + Default behavior depends on whether there're INCLUDE elements in the list. + */ + if (!(old_fflags & SUBDIR) && !((new_fflags^old_fflags) & INCLUDE)) + return; + + /* + Ok, old list may've used SUBDIR, or defaults could've changed. + + fourth check: are we inside a currently active SUBDIR rule ? + go up the call stack, if TRACE_ON flag ever changes its value - we are. + */ + for (traceon=framep->level; framep; framep=framep->prev) + if ((traceon ^ framep->level) & TRACE_ON) + goto yuck; + + /* + Ok, TRACE_ON flag doesn't change in the call stack. + + fifth check: but is the top-most value equal to a default one ? + */ + if (((traceon & TRACE_ON) != 0) == ((new_fflags & INCLUDE) == 0)) + return; + +yuck: + /* + Yuck! function list was changed, and one of the currently active rules + was possibly affected. For example, a tracing could've been enabled or + disabled for a function somewhere up the call stack. + To react correctly, we must go up the call stack all the way to + the top and re-match rules to set TRACE_ON bit correctly. + + We must traverse the stack forwards, not backwards. + That's what a recursive helper is doing. + It'll destroy two CODE_STATE fields, save them now. + */ + func= cs->func; + level= cs->level; + FixTraceFlags_helper(cs, func, cs->framep); + /* now we only need to restore CODE_STATE fields, and we're done */ + cs->func= func; + cs->level= level; +} + +/* + * FUNCTION + * + * _db_set_ set current debugger settings + * + * SYNOPSIS + * + * VOID _db_set_(control) + * char *control; + * + * DESCRIPTION + * + * Given pointer to a debug control string in "control", + * parses the control string, and sets up a current debug + * settings. Pushes a new debug settings if the current is + * set to the initial debugger settings. + * + */ + +void _db_set_(const char *control) +{ + CODE_STATE *cs; + uint old_fflags; + get_code_state_or_return; + old_fflags=fflags(cs); + if (cs->stack == &init_settings) + PushState(cs); + if (DbugParse(cs, control)) + FixTraceFlags(old_fflags, cs); +} + +/* + * FUNCTION + * + * _db_push_ push current debugger settings and set up new one + * + * SYNOPSIS + * + * VOID _db_push_(control) + * char *control; + * + * DESCRIPTION + * + * Given pointer to a debug control string in "control", pushes + * the current debug settings, parses the control string, and sets + * up a new debug settings with DbugParse() + * + */ + +void _db_push_(const char *control) +{ + CODE_STATE *cs; + uint old_fflags; + get_code_state_or_return; + old_fflags=fflags(cs); + PushState(cs); + if (DbugParse(cs, control)) + FixTraceFlags(old_fflags, cs); +} + + +/** + Returns TRUE if session-local settings have been set. +*/ + +int _db_is_pushed_() +{ + CODE_STATE *cs= NULL; + get_code_state_or_return FALSE; + return (cs->stack != &init_settings); +} + +/* + * FUNCTION + * + * _db_set_init_ set initial debugger settings + * + * SYNOPSIS + * + * VOID _db_set_init_(control) + * char *control; + * + * DESCRIPTION + * see _db_set_ + * + */ + +void _db_set_init_(const char *control) +{ + CODE_STATE tmp_cs; + bzero((uchar*) &tmp_cs, sizeof(tmp_cs)); + tmp_cs.stack= &init_settings; + DbugParse(&tmp_cs, control); +} + +/* + * FUNCTION + * + * _db_pop_ pop the debug stack + * + * DESCRIPTION + * + * Pops the debug stack, returning the debug settings to its + * condition prior to the most recent _db_push_ invocation. + * Note that the pop will fail if it would remove the last + * valid settings from the stack. This prevents user errors + * in the push/pop sequence from screwing up the debugger. + * Maybe there should be some kind of warning printed if the + * user tries to pop too many states. + * + */ + +void _db_pop_() +{ + struct settings *discard; + uint old_fflags; + CODE_STATE *cs; + + get_code_state_or_return; + + discard= cs->stack; + if (discard != &init_settings) + { + old_fflags=fflags(cs); + cs->stack= discard->next; + FreeState(cs, discard, 1); + FixTraceFlags(old_fflags, cs); + } +} + +/* + * FUNCTION + * + * _db_explain_ generates 'control' string for the current settings + * + * RETURN + * 0 - ok + * 1 - buffer too short, output truncated + * + */ + +/* helper macros */ +#define char_to_buf(C) do { \ + *buf++=(C); \ + if (buf >= end) goto overflow; \ + } while (0) +#define str_to_buf(S) do { \ + char_to_buf(','); \ + buf=strnmov(buf, (S), len+1); \ + if (buf >= end) goto overflow; \ + } while (0) +#define list_to_buf(l, f) do { \ + struct link *listp=(l); \ + while (listp) \ + { \ + if (listp->flags & (f)) \ + { \ + str_to_buf(listp->str); \ + if (listp->flags & SUBDIR) \ + char_to_buf('/'); \ + } \ + listp=listp->next_link; \ + } \ + } while (0) +#define int_to_buf(i) do { \ + char b[50]; \ + int10_to_str((i), b, 10); \ + str_to_buf(b); \ + } while (0) +#define colon_to_buf do { \ + if (buf != start) char_to_buf(':'); \ + } while(0) +#define op_int_to_buf(C, val, def) do { \ + if ((val) != (def)) \ + { \ + colon_to_buf; \ + char_to_buf((C)); \ + int_to_buf(val); \ + } \ + } while (0) +#define op_intf_to_buf(C, val, def, cond) do { \ + if ((cond)) \ + { \ + colon_to_buf; \ + char_to_buf((C)); \ + if ((val) != (def)) int_to_buf(val); \ + } \ + } while (0) +#define op_str_to_buf(C, val, cond) do { \ + if ((cond)) \ + { \ + char *s=(val); \ + colon_to_buf; \ + char_to_buf((C)); \ + if (*s) str_to_buf(s); \ + } \ + } while (0) +#define op_list_to_buf(C, val, cond) do { \ + if ((cond)) \ + { \ + int f=ListFlags(val); \ + colon_to_buf; \ + char_to_buf((C)); \ + if (f & INCLUDE) \ + list_to_buf(val, INCLUDE); \ + if (f & EXCLUDE) \ + { \ + colon_to_buf; \ + char_to_buf('-'); \ + char_to_buf((C)); \ + list_to_buf(val, EXCLUDE); \ + } \ + } \ + } while (0) +#define op_bool_to_buf(C, cond) do { \ + if ((cond)) \ + { \ + colon_to_buf; \ + char_to_buf((C)); \ + } \ + } while (0) + +int _db_explain_ (CODE_STATE *cs, char *buf, size_t len) +{ + char *start=buf, *end=buf+len-4; + + get_code_state_if_not_set_or_return *buf=0; + + op_list_to_buf('d', cs->stack->keywords, DEBUGGING); + op_int_to_buf ('D', cs->stack->delay, 0); + op_list_to_buf('f', cs->stack->functions, cs->stack->functions); + op_bool_to_buf('F', cs->stack->flags & FILE_ON); + op_bool_to_buf('i', cs->stack->flags & PID_ON); + op_list_to_buf('g', cs->stack->p_functions, PROFILING); + op_bool_to_buf('L', cs->stack->flags & LINE_ON); + op_bool_to_buf('n', cs->stack->flags & DEPTH_ON); + op_bool_to_buf('N', cs->stack->flags & NUMBER_ON); + op_str_to_buf( + ((cs->stack->flags & FLUSH_ON_WRITE ? 0 : 32) | + (cs->stack->flags & OPEN_APPEND ? 'A' : 'O')), + cs->stack->name, cs->stack->out_file != stderr); + op_list_to_buf('p', cs->stack->processes, cs->stack->processes); + op_bool_to_buf('P', cs->stack->flags & PROCESS_ON); + op_bool_to_buf('r', cs->stack->sub_level != 0); + op_intf_to_buf('t', cs->stack->maxdepth, MAXDEPTH, TRACING); + op_bool_to_buf('T', cs->stack->flags & TIMESTAMP_ON); + op_bool_to_buf('S', cs->stack->flags & SANITY_CHECK_ON); + + *buf= '\0'; + return 0; + +overflow: + *end++= '.'; + *end++= '.'; + *end++= '.'; + *end= '\0'; + return 1; +} + +#undef char_to_buf +#undef str_to_buf +#undef list_to_buf +#undef int_to_buf +#undef colon_to_buf +#undef op_int_to_buf +#undef op_intf_to_buf +#undef op_str_to_buf +#undef op_list_to_buf +#undef op_bool_to_buf + +/* + * FUNCTION + * + * _db_explain_init_ explain initial debugger settings + * + * DESCRIPTION + * see _db_explain_ + */ + +int _db_explain_init_(char *buf, size_t len) +{ + CODE_STATE cs; + bzero((uchar*) &cs,sizeof(cs)); + cs.stack=&init_settings; + return _db_explain_(&cs, buf, len); +} + +/* + * FUNCTION + * + * _db_enter_ process entry point to user function + * + * SYNOPSIS + * + * VOID _db_enter_(_func_, _file_, _line_, _stack_frame_) + * char *_func_; points to current function name + * char *_file_; points to current file name + * int _line_; called from source line number + * struct _db_stack_frame_ allocated on the caller's stack + * + * DESCRIPTION + * + * Called at the beginning of each user function to tell + * the debugger that a new function has been entered. + * Note that the pointers to the previous user function + * name and previous user file name are stored on the + * caller's stack (this is why the ENTER macro must be + * the first "executable" code in a function, since it + * allocates these storage locations). The previous nesting + * level is also stored on the callers stack for internal + * self consistency checks. + * + * Also prints a trace line if tracing is enabled and + * increments the current function nesting depth. + * + * Note that this mechanism allows the debugger to know + * what the current user function is at all times, without + * maintaining an internal stack for the function names. + * + */ + +void _db_enter_(const char *_func_, const char *_file_, + uint _line_, struct _db_stack_frame_ *_stack_frame_) +{ + int save_errno; + CODE_STATE *cs; + if (!((cs=code_state()))) + { + _stack_frame_->level= 0; /* Set to avoid valgrind warnings if dbug is enabled later */ + _stack_frame_->prev= 0; + return; + } + save_errno= errno; + + _stack_frame_->func= cs->func; + _stack_frame_->file= cs->file; + cs->func= _func_; + cs->file= _file_; + _stack_frame_->prev= cs->framep; + _stack_frame_->level= ++cs->level | framep_trace_flag(cs, cs->framep); + cs->framep= _stack_frame_; +#ifndef THREAD + if (DoProfile(cs)) + { + long stackused; + if (cs->framep->prev == NULL) + stackused= 0; + else + { + stackused= (char*)(cs->framep->prev) - (char*)(cs->framep); + stackused= stackused > 0 ? stackused : -stackused; + } + (void) fprintf(cs->stack->prof_file, PROF_EFMT , Clock(), cs->func); + (void) fprintf(cs->stack->prof_file, PROF_SFMT, (ulong) cs->framep, stackused, + AUTOS_REVERSE ? _stack_frame_->func : cs->func); + (void) fflush(cs->stack->prof_file); + } +#endif + switch (DoTrace(cs)) { + case ENABLE_TRACE: + cs->framep->level|= TRACE_ON; + if (!TRACING) break; + /* fall through */ + case DO_TRACE: + if ((cs->stack->flags & SANITY_CHECK_ON) && _sanity(_file_,_line_)) + cs->stack->flags &= ~SANITY_CHECK_ON; + if (TRACING) + { + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + DoPrefix(cs, _line_); + Indent(cs, cs->level); + (void) fprintf(cs->stack->out_file, ">%s\n", cs->func); + DbugFlush(cs); /* This does a unlock */ + } + break; + case DISABLE_TRACE: + cs->framep->level&= ~TRACE_ON; + /* fall through */ + case DONT_TRACE: + break; + } + errno=save_errno; +} + +/* + * FUNCTION + * + * _db_return_ process exit from user function + * + * SYNOPSIS + * + * VOID _db_return_(_line_, _stack_frame_) + * int _line_; current source line number + * struct _db_stack_frame_ allocated on the caller's stack + * + * DESCRIPTION + * + * Called just before user function executes an explicit or implicit + * return. Prints a trace line if trace is enabled, decrements + * the current nesting level, and restores the current function and + * file names from the defunct function's stack. + * + */ + +/* helper macro */ +void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_) +{ + int save_errno=errno; + uint _slevel_= _stack_frame_->level & ~TRACE_ON; + CODE_STATE *cs; + get_code_state_or_return; + + if (cs->level != _slevel_) + { + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + (void) fprintf(cs->stack->out_file, ERR_MISSING_RETURN, cs->process, + cs->func); + DbugFlush(cs); + } + else + { +#ifndef THREAD + if (DoProfile(cs)) + (void) fprintf(cs->stack->prof_file, PROF_XFMT, Clock(), cs->func); +#endif + if (DoTrace(cs) & DO_TRACE) + { + if ((cs->stack->flags & SANITY_CHECK_ON) && + _sanity(_stack_frame_->file,_line_)) + cs->stack->flags &= ~SANITY_CHECK_ON; + if (TRACING) + { + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + DoPrefix(cs, _line_); + Indent(cs, cs->level); + (void) fprintf(cs->stack->out_file, "<%s\n", cs->func); + DbugFlush(cs); + } + } + } + /* + Check to not set level < 0. This can happen if DBUG was disabled when + function was entered and enabled in function. + */ + cs->level= _slevel_ != 0 ? _slevel_ - 1 : 0; + cs->func= _stack_frame_->func; + cs->file= _stack_frame_->file; + if (cs->framep != NULL) + cs->framep= cs->framep->prev; + errno=save_errno; +} + + +/* + * FUNCTION + * + * _db_pargs_ log arguments for subsequent use by _db_doprnt_() + * + * SYNOPSIS + * + * VOID _db_pargs_(_line_, keyword) + * int _line_; + * char *keyword; + * + * DESCRIPTION + * + * The new universal printing macro DBUG_PRINT, which replaces + * all forms of the DBUG_N macros, needs two calls to runtime + * support routines. The first, this function, remembers arguments + * that are used by the subsequent call to _db_doprnt_(). + * + */ + +void _db_pargs_(uint _line_, const char *keyword) +{ + CODE_STATE *cs; + get_code_state_or_return; + cs->u_line= _line_; + cs->u_keyword= keyword; +} + + +/* + * FUNCTION + * + * _db_doprnt_ handle print of debug lines + * + * SYNOPSIS + * + * VOID _db_doprnt_(format, va_alist) + * char *format; + * va_dcl; + * + * DESCRIPTION + * + * When invoked via one of the DBUG macros, tests the current keyword + * set by calling _db_pargs_() to see if that macro has been selected + * for processing via the debugger control string, and if so, handles + * printing of the arguments via the format string. The line number + * of the DBUG macro in the source is found in u_line. + * + * Note that the format string SHOULD NOT include a terminating + * newline, this is supplied automatically. + * + */ + +#include + +void _db_doprnt_(const char *format,...) +{ + va_list args; + CODE_STATE *cs; + get_code_state_or_return; + + va_start(args,format); + + if (_db_keyword_(cs, cs->u_keyword, 0)) + { + int save_errno=errno; + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + DoPrefix(cs, cs->u_line); + if (TRACING) + Indent(cs, cs->level + 1); + else + (void) fprintf(cs->stack->out_file, "%s: ", cs->func); + (void) fprintf(cs->stack->out_file, "%s: ", cs->u_keyword); + DbugFprintf(cs->stack->out_file, format, args); + DbugFlush(cs); + errno=save_errno; + } + va_end(args); +} + +/* + * fprintf clone with consistent, platform independent output for + * problematic formats like %p, %zd and %lld. + */ +static void DbugFprintf(FILE *stream, const char* format, va_list args) +{ + char cvtbuf[1024]; + size_t len; + len = my_vsnprintf(cvtbuf, sizeof(cvtbuf), format, args); + (void) fprintf(stream, "%s\n", cvtbuf); +} + + +/* + * FUNCTION + * + * _db_dump_ dump a string in hex + * + * SYNOPSIS + * + * void _db_dump_(_line_,keyword,memory,length) + * int _line_; current source line number + * char *keyword; + * char *memory; Memory to print + * int length; Bytes to print + * + * DESCRIPTION + * Dump N characters in a binary array. + * Is used to examine corrputed memory or arrays. + */ + +void _db_dump_(uint _line_, const char *keyword, + const unsigned char *memory, size_t length) +{ + int pos; + char dbuff[90]; + CODE_STATE *cs; + get_code_state_or_return; + + if (_db_keyword_(cs, keyword, 0)) + { + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); + DoPrefix(cs, _line_); + if (TRACING) + { + Indent(cs, cs->level + 1); + pos= min(max(cs->level-cs->stack->sub_level,0)*INDENT,80); + } + else + { + fprintf(cs->stack->out_file, "%s: ", cs->func); + } + sprintf(dbuff,"%s: Memory: 0x%lx Bytes: (%ld)\n", + keyword, (ulong) memory, (long) length); + (void) fputs(dbuff,cs->stack->out_file); + + pos=0; + while (length-- > 0) + { + uint tmp= *((unsigned char*) memory++); + if ((pos+=3) >= 80) + { + fputc('\n',cs->stack->out_file); + pos=3; + } + fputc(_dig_vec_upper[((tmp >> 4) & 15)], cs->stack->out_file); + fputc(_dig_vec_upper[tmp & 15], cs->stack->out_file); + fputc(' ',cs->stack->out_file); + } + (void) fputc('\n',cs->stack->out_file); + DbugFlush(cs); + } +} + + +/* + * FUNCTION + * + * ListAddDel modify the list according to debug control string + * + * DESCRIPTION + * + * Given pointer to a comma separated list of strings in "cltp", + * parses the list, and modifies "listp", returning a pointer + * to the new list. + * + * The mode of operation is defined by "todo" parameter. + * + * If it is INCLUDE, elements (strings from "cltp") are added to the + * list, they will have INCLUDE flag set. If the list already contains + * the string in question, new element is not added, but a flag of + * the existing element is adjusted (INCLUDE bit is set, EXCLUDE bit + * is removed). + * + * If it is EXCLUDE, elements are added to the list with the EXCLUDE + * flag set. If the list already contains the string in question, + * it is removed, new element is not added. + */ + +static struct link *ListAddDel(struct link *head, const char *ctlp, + const char *end, int todo) +{ + const char *start; + struct link **cur; + size_t len; + int subdir; + + ctlp--; +next: + while (++ctlp < end) + { + start= ctlp; + subdir=0; + while (ctlp < end && *ctlp != ',') + ctlp++; + len=ctlp-start; + if (start[len-1] == '/') + { + len--; + subdir=SUBDIR; + } + if (len == 0) continue; + for (cur=&head; *cur; cur=&((*cur)->next_link)) + { + if (!strncmp((*cur)->str, start, len)) + { + if ((*cur)->flags & todo) /* same action ? */ + (*cur)->flags|= subdir; /* just merge the SUBDIR flag */ + else if (todo == EXCLUDE) + { + struct link *delme=*cur; + *cur=(*cur)->next_link; + free((void*) delme); + } + else + { + (*cur)->flags&=~(EXCLUDE & SUBDIR); + (*cur)->flags|=INCLUDE | subdir; + } + goto next; + } + } + *cur= (struct link *) DbugMalloc(sizeof(struct link)+len); + memcpy((*cur)->str, start, len); + (*cur)->str[len]=0; + (*cur)->flags=todo | subdir; + (*cur)->next_link=0; + } + return head; +} + +/* + * FUNCTION + * + * ListCopy make a copy of the list + * + * SYNOPSIS + * + * static struct link *ListCopy(orig) + * struct link *orig; + * + * DESCRIPTION + * + * Given pointer to list, which contains a copy of every element from + * the original list. + * + * the orig pointer can be NULL + * + * Note that since each link is added at the head of the list, + * the final list will be in "reverse order", which is not + * significant for our usage here. + * + */ + +static struct link *ListCopy(struct link *orig) +{ + struct link *new_malloc; + struct link *head; + size_t len; + + head= NULL; + while (orig != NULL) + { + len= strlen(orig->str); + new_malloc= (struct link *) DbugMalloc(sizeof(struct link)+len); + memcpy(new_malloc->str, orig->str, len); + new_malloc->str[len]= 0; + new_malloc->flags=orig->flags; + new_malloc->next_link= head; + head= new_malloc; + orig= orig->next_link; + } + return head; +} + +/* + * FUNCTION + * + * InList test a given string for member of a given list + * + * DESCRIPTION + * + * Tests the string pointed to by "cp" to determine if it is in + * the list pointed to by "linkp". Linkp points to the first + * link in the list. If linkp is NULL or contains only EXCLUDE + * elements then the string is treated as if it is in the list. + * This may seem rather strange at first but leads to the desired + * operation if no list is given. The net effect is that all + * strings will be accepted when there is no list, and when there + * is a list, only those strings in the list will be accepted. + * + * RETURN + * combination of SUBDIR, INCLUDE, EXCLUDE, MATCHED flags + * + */ + +static int InList(struct link *linkp, const char *cp) +{ + int result; + + for (result=MATCHED; linkp != NULL; linkp= linkp->next_link) + { + if (!fnmatch(linkp->str, cp, 0)) + return linkp->flags; + if (!(linkp->flags & EXCLUDE)) + result=NOT_MATCHED; + if (linkp->flags & SUBDIR) + result|=SUBDIR; + } + return result; +} + +/* + * FUNCTION + * + * ListFlags returns aggregated list flags (ORed over all elements) + * + */ + +static uint ListFlags(struct link *linkp) +{ + uint f; + for (f=0; linkp != NULL; linkp= linkp->next_link) + f|= linkp->flags; + return f; +} + +/* + * FUNCTION + * + * PushState push current settings onto stack and set up new one + * + * SYNOPSIS + * + * static VOID PushState() + * + * DESCRIPTION + * + * Pushes the current settings on the settings stack, and creates + * a new settings. The new settings is NOT initialized + * + * The settings stack is a linked list of settings, with the new + * settings added at the head. This allows the stack to grow + * to the limits of memory if necessary. + * + */ + +static void PushState(CODE_STATE *cs) +{ + struct settings *new_malloc; + + new_malloc= (struct settings *) DbugMalloc(sizeof(struct settings)); + bzero(new_malloc, sizeof(*new_malloc)); + new_malloc->next= cs->stack; + cs->stack= new_malloc; +} + +/* + * FUNCTION + * + * FreeState Free memory associated with a struct state. + * + * SYNOPSIS + * + * static void FreeState (state) + * struct state *state; + * int free_state; + * + * DESCRIPTION + * + * Deallocates the memory allocated for various information in a + * state. If free_state is set, also free 'state' + * + */ +static void FreeState(CODE_STATE *cs, struct settings *state, int free_state) +{ + if (!is_shared(state, keywords)) + FreeList(state->keywords); + if (!is_shared(state, functions)) + FreeList(state->functions); + if (!is_shared(state, processes)) + FreeList(state->processes); + if (!is_shared(state, p_functions)) + FreeList(state->p_functions); + + if (!is_shared(state, out_file)) + DBUGCloseFile(cs, state->out_file); + else + (void) fflush(state->out_file); + + if (!is_shared(state, prof_file)) + DBUGCloseFile(cs, state->prof_file); + else + (void) fflush(state->prof_file); + + if (free_state) + free((void*) state); +} + + +/* + * FUNCTION + * + * _db_end_ End debugging, freeing state stack memory. + * + * SYNOPSIS + * + * static VOID _db_end_ () + * + * DESCRIPTION + * + * Ends debugging, de-allocating the memory allocated to the + * state stack. + * + * To be called at the very end of the program. + * + */ +void _db_end_() +{ + struct settings *discard; + static struct settings tmp; + CODE_STATE *cs; + /* + Set _dbug_on_ to be able to do full reset even when DEBUGGER_OFF was + called after dbug was initialized + */ + _dbug_on_= 1; + get_code_state_or_return; + + while ((discard= cs->stack)) + { + if (discard == &init_settings) + break; + cs->stack= discard->next; + FreeState(cs, discard, 1); + } + tmp= init_settings; + + /* Use mutex lock to make it less likely anyone access out_file */ + pthread_mutex_lock(&THR_LOCK_dbug); + init_settings.flags= OPEN_APPEND; + init_settings.out_file= stderr; + init_settings.prof_file= stderr; + init_settings.maxdepth= 0; + init_settings.delay= 0; + init_settings.sub_level= 0; + init_settings.functions= 0; + init_settings.p_functions= 0; + init_settings.keywords= 0; + init_settings.processes= 0; + pthread_mutex_unlock(&THR_LOCK_dbug); + FreeState(cs, &tmp, 0); +} + + +/* + * FUNCTION + * + * DoTrace check to see if tracing is current enabled + * + * DESCRIPTION + * + * Checks to see if dbug in this function is enabled based on + * whether the maximum trace depth has been reached, the current + * function is selected, and the current process is selected. + * + */ + +static int DoTrace(CODE_STATE *cs) +{ + if ((cs->stack->maxdepth == 0 || cs->level <= cs->stack->maxdepth) && + InList(cs->stack->processes, cs->process) & (MATCHED|INCLUDE)) + switch(InList(cs->stack->functions, cs->func)) { + case INCLUDE|SUBDIR: return ENABLE_TRACE; + case INCLUDE: return DO_TRACE; + case MATCHED|SUBDIR: + case NOT_MATCHED|SUBDIR: + case MATCHED: return framep_trace_flag(cs, cs->framep) ? + DO_TRACE : DONT_TRACE; + case EXCLUDE: + case NOT_MATCHED: return DONT_TRACE; + case EXCLUDE|SUBDIR: return DISABLE_TRACE; + } + return DONT_TRACE; +} + + +/* + * FUNCTION + * + * DoProfile check to see if profiling is current enabled + * + * SYNOPSIS + * + * static BOOLEAN DoProfile() + * + * DESCRIPTION + * + * Checks to see if profiling is enabled based on whether the + * user has specified profiling, the maximum trace depth has + * not yet been reached, the current function is selected, + * and the current process is selected. Returns TRUE if + * profiling is enabled, FALSE otherwise. + * + */ + +#ifndef THREAD +static BOOLEAN DoProfile(CODE_STATE *cs) +{ + return PROFILING && + cs->level <= cs->stack->maxdepth && + InList(cs->stack->p_functions, cs->func) & (INCLUDE|MATCHED) && + InList(cs->stack->processes, cs->process) & (INCLUDE|MATCHED); +} +#endif + +FILE *_db_fp_(void) +{ + CODE_STATE *cs; + get_code_state_or_return NULL; + return cs->stack->out_file; +} + +/* + * FUNCTION + * + * _db_keyword_ test keyword for member of keyword list + * + * DESCRIPTION + * + * Test a keyword to determine if it is in the currently active + * keyword list. If strict=0, a keyword is accepted + * if the list is null, otherwise it must match one of the list + * members. When debugging is not on, no keywords are accepted. + * After the maximum trace level is exceeded, no keywords are + * accepted (this behavior subject to change). Additionally, + * the current function and process must be accepted based on + * their respective lists. + * + * Returns TRUE if keyword accepted, FALSE otherwise. + * + */ + +BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword, int strict) +{ + get_code_state_if_not_set_or_return FALSE; + strict=strict ? INCLUDE : INCLUDE|MATCHED; + + return DEBUGGING && DoTrace(cs) & DO_TRACE && + InList(cs->stack->keywords, keyword) & strict; +} + +/* + * FUNCTION + * + * Indent indent a line to the given indentation level + * + * SYNOPSIS + * + * static VOID Indent(indent) + * int indent; + * + * DESCRIPTION + * + * Indent a line to the given level. Note that this is + * a simple minded but portable implementation. + * There are better ways. + * + * Also, the indent must be scaled by the compile time option + * of character positions per nesting level. + * + */ + +static void Indent(CODE_STATE *cs, int indent) +{ + REGISTER int count; + + indent= max(indent-1-cs->stack->sub_level,0)*INDENT; + for (count= 0; count < indent ; count++) + { + if ((count % INDENT) == 0) + fputc('|',cs->stack->out_file); + else + fputc(' ',cs->stack->out_file); + } +} + + +/* + * FUNCTION + * + * FreeList free all memory associated with a linked list + * + * SYNOPSIS + * + * static VOID FreeList(linkp) + * struct link *linkp; + * + * DESCRIPTION + * + * Given pointer to the head of a linked list, frees all + * memory held by the list and the members of the list. + * + */ + +static void FreeList(struct link *linkp) +{ + REGISTER struct link *old; + + while (linkp != NULL) + { + old= linkp; + linkp= linkp->next_link; + free((void*) old); + } +} + + +/* + * FUNCTION + * + * DoPrefix print debugger line prefix prior to indentation + * + * SYNOPSIS + * + * static VOID DoPrefix(_line_) + * int _line_; + * + * DESCRIPTION + * + * Print prefix common to all debugger output lines, prior to + * doing indentation if necessary. Print such information as + * current process name, current source file name and line number, + * and current function nesting depth. + * + */ + +static void DoPrefix(CODE_STATE *cs, uint _line_) +{ + cs->lineno++; + if (cs->stack->flags & PID_ON) + { +#ifdef THREAD + (void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name()); +#else + (void) fprintf(cs->stack->out_file, "%5d: ", (int) getpid()); +#endif + } + if (cs->stack->flags & NUMBER_ON) + (void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno); + if (cs->stack->flags & TIMESTAMP_ON) + { +#ifdef __WIN__ + /* FIXME This doesn't give microseconds as in Unix case, and the resolution is + in system ticks, 10 ms intervals. See my_getsystime.c for high res */ + SYSTEMTIME loc_t; + GetLocalTime(&loc_t); + (void) fprintf (cs->stack->out_file, + /* "%04d-%02d-%02d " */ + "%02d:%02d:%02d.%06d ", + /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/ + loc_t.wHour, loc_t.wMinute, loc_t.wSecond, loc_t.wMilliseconds); +#else + struct timeval tv; + struct tm *tm_p; + if (gettimeofday(&tv, NULL) != -1) + { + if ((tm_p= localtime((const time_t *)&tv.tv_sec))) + { + (void) fprintf (cs->stack->out_file, + /* "%04d-%02d-%02d " */ + "%02d:%02d:%02d.%06d ", + /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/ + tm_p->tm_hour, tm_p->tm_min, tm_p->tm_sec, + (int) (tv.tv_usec)); + } + } +#endif + } + if (cs->stack->flags & PROCESS_ON) + (void) fprintf(cs->stack->out_file, "%s: ", cs->process); + if (cs->stack->flags & FILE_ON) + (void) fprintf(cs->stack->out_file, "%14s: ", BaseName(cs->file)); + if (cs->stack->flags & LINE_ON) + (void) fprintf(cs->stack->out_file, "%5d: ", _line_); + if (cs->stack->flags & DEPTH_ON) + (void) fprintf(cs->stack->out_file, "%4d: ", cs->level); +} + + +/* + * FUNCTION + * + * DBUGOpenFile open new output stream for debugger output + * + * SYNOPSIS + * + * static VOID DBUGOpenFile(name) + * char *name; + * + * DESCRIPTION + * + * Given name of a new file (or "-" for stdout) opens the file + * and sets the output stream to the new file. + * + */ + +static void DBUGOpenFile(CODE_STATE *cs, + const char *name,const char *end,int append) +{ + REGISTER FILE *fp; + REGISTER BOOLEAN newfile; + + if (name != NULL) + { + if (end) + { + size_t len=end-name; + memcpy(cs->stack->name, name, len); + cs->stack->name[len]=0; + } + else + strmov(cs->stack->name,name); + name=cs->stack->name; + if (strcmp(name, "-") == 0) + { + cs->stack->out_file= stdout; + cs->stack->flags |= FLUSH_ON_WRITE; + cs->stack->name[0]=0; + } + else + { + if (!Writable(name)) + { + (void) fprintf(stderr, ERR_OPEN, cs->process, name); + perror(""); + fflush(stderr); + } + else + { + newfile= !EXISTS(name); + if (!(fp= fopen(name, append ? "a+" : "w"))) + { + (void) fprintf(stderr, ERR_OPEN, cs->process, name); + perror(""); + fflush(stderr); + } + else + { + cs->stack->out_file= fp; + if (newfile) + { + ChangeOwner(cs, name); + } + } + } + } + } +} + + +/* + * FUNCTION + * + * OpenProfile open new output stream for profiler output + * + * SYNOPSIS + * + * static FILE *OpenProfile(name) + * char *name; + * + * DESCRIPTION + * + * Given name of a new file, opens the file + * and sets the profiler output stream to the new file. + * + * It is currently unclear whether the prefered behavior is + * to truncate any existing file, or simply append to it. + * The latter behavior would be desirable for collecting + * accumulated runtime history over a number of separate + * runs. It might take some changes to the analyzer program + * though, and the notes that Binayak sent with the profiling + * diffs indicated that append was the normal mode, but this + * does not appear to agree with the actual code. I haven't + * investigated at this time [fnf; 24-Jul-87]. + */ + +#ifndef THREAD +static FILE *OpenProfile(CODE_STATE *cs, const char *name) +{ + REGISTER FILE *fp; + REGISTER BOOLEAN newfile; + + fp=0; + if (!Writable(name)) + { + (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); + perror(""); + (void) Delay(cs->stack->delay); + } + else + { + newfile= !EXISTS(name); + if (!(fp= fopen(name, "w"))) + { + (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); + perror(""); + } + else + { + cs->stack->prof_file= fp; + if (newfile) + { + ChangeOwner(cs, name); + } + } + } + return fp; +} +#endif + +/* + * FUNCTION + * + * DBUGCloseFile close the debug output stream + * + * SYNOPSIS + * + * static VOID DBUGCloseFile(fp) + * FILE *fp; + * + * DESCRIPTION + * + * Closes the debug output stream unless it is standard output + * or standard error. + * + */ + +static void DBUGCloseFile(CODE_STATE *cs, FILE *fp) +{ + if (fp && fp != stderr && fp != stdout && fclose(fp) == EOF) + { + pthread_mutex_lock(&THR_LOCK_dbug); + (void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process); + perror(""); + DbugFlush(cs); + } +} + + +/* + * FUNCTION + * + * DbugExit print error message and exit + * + * SYNOPSIS + * + * static VOID DbugExit(why) + * char *why; + * + * DESCRIPTION + * + * Prints error message using current process name, the reason for + * aborting (typically out of memory), and exits with status 1. + * This should probably be changed to use a status code + * defined in the user's debugger include file. + * + */ + +static void DbugExit(const char *why) +{ + CODE_STATE *cs=code_state(); + (void) fprintf(stderr, ERR_ABORT, cs ? cs->process : "(null)", why); + (void) fflush(stderr); + exit(1); +} + + +/* + * FUNCTION + * + * DbugMalloc allocate memory for debugger runtime support + * + * SYNOPSIS + * + * static long *DbugMalloc(size) + * int size; + * + * DESCRIPTION + * + * Allocate more memory for debugger runtime support functions. + * Failure to to allocate the requested number of bytes is + * immediately fatal to the current process. This may be + * rather unfriendly behavior. It might be better to simply + * print a warning message, freeze the current debugger cs, + * and continue execution. + * + */ + +static char *DbugMalloc(size_t size) +{ + register char *new_malloc; + + if (!(new_malloc= (char*) malloc(size))) + DbugExit("out of memory"); + return new_malloc; +} + + +/* + * strtok lookalike - splits on ':', magically handles ::, :\ and :/ + */ + +static const char *DbugStrTok(const char *s) +{ + while (s[0] && (s[0] != ':' || + (s[1] == '\\' || s[1] == '/' || (s[1] == ':' && s++)))) + s++; + return s; +} + + +/* + * FUNCTION + * + * BaseName strip leading pathname components from name + * + * SYNOPSIS + * + * static char *BaseName(pathname) + * char *pathname; + * + * DESCRIPTION + * + * Given pointer to a complete pathname, locates the base file + * name at the end of the pathname and returns a pointer to + * it. + * + */ + +static const char *BaseName(const char *pathname) +{ + register const char *base; + + base= strrchr(pathname, FN_LIBCHAR); + if (base++ == NullS) + base= pathname; + return base; +} + + +/* + * FUNCTION + * + * Writable test to see if a pathname is writable/creatable + * + * SYNOPSIS + * + * static BOOLEAN Writable(pathname) + * char *pathname; + * + * DESCRIPTION + * + * Because the debugger might be linked in with a program that + * runs with the set-uid-bit (suid) set, we have to be careful + * about opening a user named file for debug output. This consists + * of checking the file for write access with the real user id, + * or checking the directory where the file will be created. + * + * Returns TRUE if the user would normally be allowed write or + * create access to the named file. Returns FALSE otherwise. + * + */ + + +#ifndef Writable + +static BOOLEAN Writable(const char *pathname) +{ + REGISTER BOOLEAN granted; + REGISTER char *lastslash; + + granted= FALSE; + if (EXISTS(pathname)) + { + if (WRITABLE(pathname)) + granted= TRUE; + } + else + { + lastslash= strrchr(pathname, '/'); + if (lastslash != NULL) + *lastslash= '\0'; + else + pathname= "."; + if (WRITABLE(pathname)) + granted= TRUE; + if (lastslash != NULL) + *lastslash= '/'; + } + return granted; +} +#endif + + +/* + * FUNCTION + * + * ChangeOwner change owner to real user for suid programs + * + * SYNOPSIS + * + * static VOID ChangeOwner(pathname) + * + * DESCRIPTION + * + * For unix systems, change the owner of the newly created debug + * file to the real owner. This is strictly for the benefit of + * programs that are running with the set-user-id bit set. + * + * Note that at this point, the fact that pathname represents + * a newly created file has already been established. If the + * program that the debugger is linked to is not running with + * the suid bit set, then this operation is redundant (but + * harmless). + * + */ + +#ifndef ChangeOwner +static void ChangeOwner(CODE_STATE *cs, char *pathname) +{ + if (chown(pathname, getuid(), getgid()) == -1) + { + (void) fprintf(stderr, ERR_CHOWN, cs->process, pathname); + perror(""); + (void) fflush(stderr); + } +} +#endif + + +/* + * FUNCTION + * + * _db_setjmp_ save debugger environment + * + * SYNOPSIS + * + * VOID _db_setjmp_() + * + * DESCRIPTION + * + * Invoked as part of the user's DBUG_SETJMP macro to save + * the debugger environment in parallel with saving the user's + * environment. + * + */ + +#ifdef HAVE_LONGJMP + +EXPORT void _db_setjmp_() +{ + CODE_STATE *cs; + get_code_state_or_return; + + cs->jmplevel= cs->level; + cs->jmpfunc= cs->func; + cs->jmpfile= cs->file; +} + +/* + * FUNCTION + * + * _db_longjmp_ restore previously saved debugger environment + * + * SYNOPSIS + * + * VOID _db_longjmp_() + * + * DESCRIPTION + * + * Invoked as part of the user's DBUG_LONGJMP macro to restore + * the debugger environment in parallel with restoring the user's + * previously saved environment. + * + */ + +EXPORT void _db_longjmp_() +{ + CODE_STATE *cs; + get_code_state_or_return; + + cs->level= cs->jmplevel; + if (cs->jmpfunc) + cs->func= cs->jmpfunc; + if (cs->jmpfile) + cs->file= cs->jmpfile; +} +#endif + +/* + * FUNCTION + * + * perror perror simulation for systems that don't have it + * + * SYNOPSIS + * + * static VOID perror(s) + * char *s; + * + * DESCRIPTION + * + * Perror produces a message on the standard error stream which + * provides more information about the library or system error + * just encountered. The argument string s is printed, followed + * by a ':', a blank, and then a message and a newline. + * + * An undocumented feature of the unix perror is that if the string + * 's' is a null string (NOT a NULL pointer!), then the ':' and + * blank are not printed. + * + * This version just complains about an "unknown system error". + * + */ + +#ifndef HAVE_PERROR +static void perror(s) +char *s; +{ + if (s && *s != '\0') + (void) fprintf(stderr, "%s: ", s); + (void) fprintf(stderr, "\n"); +} +#endif /* HAVE_PERROR */ + + + /* flush dbug-stream, free mutex lock & wait delay */ + /* This is because some systems (MSDOS!!) dosn't flush fileheader */ + /* and dbug-file isn't readable after a system crash !! */ + +static void DbugFlush(CODE_STATE *cs) +{ + if (cs->stack->flags & FLUSH_ON_WRITE) + { + (void) fflush(cs->stack->out_file); + if (cs->stack->delay) + (void) Delay(cs->stack->delay); + } + if (!cs->locked) + pthread_mutex_unlock(&THR_LOCK_dbug); +} /* DbugFlush */ + + +/* For debugging */ + +void _db_flush_() +{ + CODE_STATE *cs; + get_code_state_or_return; + (void) fflush(cs->stack->out_file); +} + + +void _db_lock_file_() +{ + CODE_STATE *cs; + get_code_state_or_return; + pthread_mutex_lock(&THR_LOCK_dbug); + cs->locked=1; +} + +void _db_unlock_file_() +{ + CODE_STATE *cs; + get_code_state_or_return; + cs->locked=0; + pthread_mutex_unlock(&THR_LOCK_dbug); +} + +/* + * Here we need the definitions of the clock routine. Add your + * own for whatever system that you have. + */ + +#ifndef THREAD +#if defined(HAVE_GETRUSAGE) + +#include +#include + +/* extern int getrusage(int, struct rusage *); */ + +/* + * Returns the user time in milliseconds used by this process so + * far. + */ + +static unsigned long Clock() +{ + struct rusage ru; + + (void) getrusage(RUSAGE_SELF, &ru); + return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000; +} + +#elif defined(MSDOS) || defined(__WIN__) + +static ulong Clock() +{ + return clock()*(1000/CLOCKS_PER_SEC); +} +#elif defined(amiga) + +struct DateStamp { /* Yes, this is a hack, but doing it right */ + long ds_Days; /* is incredibly ugly without splitting this */ + long ds_Minute; /* off into a separate file */ + long ds_Tick; +}; + +static int first_clock= TRUE; +static struct DateStamp begin; +static struct DateStamp elapsed; + +static unsigned long Clock() +{ + register struct DateStamp *now; + register unsigned long millisec= 0; + extern VOID *AllocMem(); + + now= (struct DateStamp *) AllocMem((long) sizeof(struct DateStamp), 0L); + if (now != NULL) + { + if (first_clock == TRUE) + { + first_clock= FALSE; + (void) DateStamp(now); + begin= *now; + } + (void) DateStamp(now); + millisec= 24 * 3600 * (1000 / HZ) * (now->ds_Days - begin.ds_Days); + millisec += 60 * (1000 / HZ) * (now->ds_Minute - begin.ds_Minute); + millisec += (1000 / HZ) * (now->ds_Tick - begin.ds_Tick); + (void) FreeMem(now, (long) sizeof(struct DateStamp)); + } + return millisec; +} +#else +static unsigned long Clock() +{ + return 0; +} +#endif /* RUSAGE */ +#endif /* THREADS */ + +#ifdef NO_VARARGS + +/* + * Fake vfprintf for systems that don't support it. If this + * doesn't work, you are probably SOL... + */ + +static int vfprintf(stream, format, ap) +FILE *stream; +char *format; +va_list ap; +{ + int rtnval; + ARGS_DCL; + + ARG0= va_arg(ap, ARGS_TYPE); + ARG1= va_arg(ap, ARGS_TYPE); + ARG2= va_arg(ap, ARGS_TYPE); + ARG3= va_arg(ap, ARGS_TYPE); + ARG4= va_arg(ap, ARGS_TYPE); + ARG5= va_arg(ap, ARGS_TYPE); + ARG6= va_arg(ap, ARGS_TYPE); + ARG7= va_arg(ap, ARGS_TYPE); + ARG8= va_arg(ap, ARGS_TYPE); + ARG9= va_arg(ap, ARGS_TYPE); + rtnval= fprintf(stream, format, ARGS_LIST); + return rtnval; +} + +#endif /* NO_VARARGS */ + +#else + +/* + * Dummy function, workaround for MySQL bug#14420 related + * build failure on a platform where linking with an empty + * archive fails. + * + * This block can be removed as soon as a fix for bug#14420 + * is implemented. + */ +int i_am_a_dummy_function() { + return 0; +} + +#endif diff --git a/externals/mysql/extlib/dbug/dbug_analyze.c b/externals/mysql/extlib/dbug/dbug_analyze.c new file mode 100644 index 0000000..3263b2c --- /dev/null +++ b/externals/mysql/extlib/dbug/dbug_analyze.c @@ -0,0 +1,726 @@ +/* + * Analyze the profile file (cmon.out) written out by the dbug + * routines with profiling enabled. + * + * Copyright June 1987, Binayak Banerjee + * All rights reserved. + * + * This program may be freely distributed under the same terms and + * conditions as Fred Fish's Dbug package. + * + * Compile with -- cc -O -s -o %s analyze.c + * + * Analyze will read an trace file created by the dbug package + * (when run with traceing enabled). It will then produce a + * summary on standard output listing the name of each traced + * function, the number of times it was called, the percentage + * of total calls, the time spent executing the function, the + * proportion of the total time and the 'importance'. The last + * is a metric which is obtained by multiplying the proportions + * of calls and the proportions of time for each function. The + * greater the importance, the more likely it is that a speedup + * could be obtained by reducing the time taken by that function. + * + * Note that the timing values that you obtain are only rough + * measures. The overhead of the dbug package is included + * within. However, there is no need to link in special profiled + * libraries and the like. + * + * CHANGES: + * + * 2-Mar-89: fnf + * Changes to support tracking of stack usage. This required + * reordering the fields in the profile log file to make + * parsing of different record types easier. Corresponding + * changes made in dbug runtime library. Also used this + * opportunity to reformat the code more to my liking (my + * apologies to Binayak Banerjee for "uglifying" his code). + * + * 24-Jul-87: fnf + * Because I tend to use functions names like + * "ExternalFunctionDoingSomething", I've rearranged the + * printout to put the function name last in each line, so + * long names don't screw up the formatting unless they are + * *very* long and wrap around the screen width... + * + * 24-Jul-87: fnf + * Modified to put out table very similar to Unix profiler + * by default, but also puts out original verbose table + * if invoked with -v flag. + */ + +#include +#include +#include + +static char *my_name; +static int verbose; + +/* + * Structure of the stack. + */ + +#define PRO_FILE "dbugmon.out" /* Default output file name */ +#define STACKSIZ 100 /* Maximum function nesting */ +#define MAXPROCS 10000 /* Maximum number of function calls */ + +# ifdef BSD +# include +# else +# define EX_SOFTWARE 1 +# define EX_DATAERR 1 +# define EX_USAGE 1 +# define EX_OSERR 1 +# define EX_IOERR 1 +#ifndef EX_OK +# define EX_OK 0 +#endif +# endif + +#define __MERF_OO_ "%s: Malloc Failed in %s: %d\n" + +#define MALLOC(Ptr,Num,Typ) do /* Malloc w/error checking & exit */ \ + if (!(Ptr = (Typ *)malloc((Num)*(sizeof(Typ))))) \ + {fprintf(stderr,__MERF_OO_,my_name,__FILE__,__LINE__);\ + exit(EX_OSERR);} while(0) + +#define Malloc(Ptr,Num,Typ) do /* Weaker version of above */\ + if (!(Ptr = (Typ *)malloc((Num)*(sizeof(Typ))))) \ + fprintf(stderr,__MERF_OO_,my_name,__FILE__,__LINE__);\ + while(0) + +#define FILEOPEN(Fp,Fn,Mod) do /* File open with error exit */ \ + if (!(Fp = fopen(Fn,Mod)))\ + {fprintf(stderr,"%s: Couldn't open %s\n",my_name,Fn);\ + exit(EX_IOERR);} while(0) + +#define Fileopen(Fp,Fn,Mod) do /* Weaker version of above */ \ + if(!(Fp = fopen(Fn,Mod))) \ + fprintf(stderr,"%s: Couldn't open %s\n",my_name,Fn);\ + while(0) + + +struct stack_t { + unsigned int pos; /* which function? */ + unsigned long time; /* Time that this was entered */ + unsigned long children; /* Time spent in called funcs */ +}; + +static struct stack_t fn_stack[STACKSIZ+1]; + +static unsigned int stacktop = 0; /* Lowest stack position is a dummy */ + +static unsigned long tot_time = 0; +static unsigned long tot_calls = 0; +static unsigned long highstack = 0; +static unsigned long lowstack = (ulong) ~0; + +/* + * top() returns a pointer to the top item on the stack. + * (was a function, now a macro) + */ + +#define top() &fn_stack[stacktop] + +/* + * Push - Push the given record on the stack. + */ + +void push (name_pos, time_entered) +register unsigned int name_pos; +register unsigned long time_entered; +{ + register struct stack_t *t; + + DBUG_ENTER("push"); + if (++stacktop > STACKSIZ) { + fprintf (DBUG_FILE,"%s: stack overflow (%s:%d)\n", + my_name, __FILE__, __LINE__); + exit (EX_SOFTWARE); + } + DBUG_PRINT ("push", ("%d %ld",name_pos,time_entered)); + t = &fn_stack[stacktop]; + t -> pos = name_pos; + t -> time = time_entered; + t -> children = 0; + DBUG_VOID_RETURN; +} + +/* + * Pop - pop the top item off the stack, assigning the field values + * to the arguments. Returns 0 on stack underflow, or on popping first + * item off stack. + */ + +unsigned int pop (name_pos, time_entered, child_time) +register unsigned int *name_pos; +register unsigned long *time_entered; +register unsigned long *child_time; +{ + register struct stack_t *temp; + register unsigned int rtnval; + + DBUG_ENTER ("pop"); + + if (stacktop < 1) { + rtnval = 0; + } else { + temp = &fn_stack[stacktop]; + *name_pos = temp->pos; + *time_entered = temp->time; + *child_time = temp->children; + DBUG_PRINT ("pop", ("%d %lu %lu",*name_pos,*time_entered,*child_time)); + rtnval = stacktop--; + } + DBUG_RETURN (rtnval); +} + +/* + * We keep the function info in another array (serves as a simple + * symbol table) + */ + +struct module_t { + char *name; + unsigned long m_time; + unsigned long m_calls; + unsigned long m_stkuse; +}; + +static struct module_t modules[MAXPROCS]; + +/* + * We keep a binary search tree in order to look up function names + * quickly (and sort them at the end. + */ + +struct bnode { + unsigned int lchild; /* Index of left subtree */ + unsigned int rchild; /* Index of right subtree */ + unsigned int pos; /* Index of module_name entry */ +}; + +static struct bnode s_table[MAXPROCS]; + +static unsigned int n_items = 0; /* No. of items in the array so far */ + +/* + * Need a function to allocate space for a string and squirrel it away. + */ + +char *strsave (s) +char *s; +{ + register char *retval; + register unsigned int len; + + DBUG_ENTER ("strsave"); + DBUG_PRINT ("strsave", ("%s",s)); + if (!s || (len = strlen (s)) == 0) { + DBUG_RETURN (0); + } + MALLOC (retval, ++len, char); + strcpy (retval, s); + DBUG_RETURN (retval); +} + +/* + * add() - adds m_name to the table (if not already there), and returns + * the index of its location in the table. Checks s_table (which is a + * binary search tree) to see whether or not it should be added. + */ + +unsigned int add (m_name) +char *m_name; +{ + register unsigned int ind = 0; + register int cmp; + + DBUG_ENTER ("add"); + if (n_items == 0) { /* First item to be added */ + s_table[0].pos = ind; + s_table[0].lchild = s_table[0].rchild = MAXPROCS; + addit: + modules[n_items].name = strsave (m_name); + modules[n_items].m_time = 0; + modules[n_items].m_calls = 0; + modules[n_items].m_stkuse = 0; + DBUG_RETURN (n_items++); + } + while ((cmp = strcmp (m_name,modules[ind].name))) { + if (cmp < 0) { /* In left subtree */ + if (s_table[ind].lchild == MAXPROCS) { + /* Add as left child */ + if (n_items >= MAXPROCS) { + fprintf (DBUG_FILE, + "%s: Too many functions being profiled\n", + my_name); + exit (EX_SOFTWARE); + } + s_table[n_items].pos = s_table[ind].lchild = n_items; + s_table[n_items].lchild = s_table[n_items].rchild = MAXPROCS; +#ifdef notdef + modules[n_items].name = strsave (m_name); + modules[n_items].m_time = modules[n_items].m_calls = 0; + DBUG_RETURN (n_items++); +#else + goto addit; +#endif + + } + ind = s_table[ind].lchild; /* else traverse l-tree */ + } else { + if (s_table[ind].rchild == MAXPROCS) { + /* Add as right child */ + if (n_items >= MAXPROCS) { + fprintf (DBUG_FILE, + "%s: Too many functions being profiled\n", + my_name); + exit (EX_SOFTWARE); + } + s_table[n_items].pos = s_table[ind].rchild = n_items; + s_table[n_items].lchild = s_table[n_items].rchild = MAXPROCS; +#ifdef notdef + modules[n_items].name = strsave (m_name); + modules[n_items].m_time = modules[n_items].m_calls = 0; + DBUG_RETURN (n_items++); +#else + goto addit; +#endif + + } + ind = s_table[ind].rchild; /* else traverse r-tree */ + } + } + DBUG_RETURN (ind); +} + +/* + * process() - process the input file, filling in the modules table. + */ + +void process (inf) +FILE *inf; +{ + char buf[BUFSIZ]; + char fn_name[64]; /* Max length of fn_name */ + unsigned long fn_time; + unsigned long fn_sbot; + unsigned long fn_ssz; + unsigned long lastuse; + unsigned int pos; + unsigned long local_time; + unsigned int oldpos; + unsigned long oldtime; + unsigned long oldchild; + struct stack_t *t; + + DBUG_ENTER ("process"); + while (fgets (buf,BUFSIZ,inf) != NULL) { + switch (buf[0]) { + case 'E': + sscanf (buf+2, "%ld %64s", &fn_time, fn_name); + DBUG_PRINT ("erec", ("%ld %s", fn_time, fn_name)); + pos = add (fn_name); + push (pos, fn_time); + break; + case 'X': + sscanf (buf+2, "%ld %64s", &fn_time, fn_name); + DBUG_PRINT ("xrec", ("%ld %s", fn_time, fn_name)); + pos = add (fn_name); + /* + * An exited function implies that all stacked + * functions are also exited, until the matching + * function is found on the stack. + */ + while (pop (&oldpos, &oldtime, &oldchild)) { + DBUG_PRINT ("popped", ("%lu %lu", oldtime, oldchild)); + local_time = fn_time - oldtime; + t = top (); + t -> children += local_time; + DBUG_PRINT ("update", ("%s", modules[t -> pos].name)); + DBUG_PRINT ("update", ("%lu", t -> children)); + local_time -= oldchild; + modules[oldpos].m_time += local_time; + modules[oldpos].m_calls++; + tot_time += local_time; + tot_calls++; + if (pos == oldpos) { + goto next_line; /* Should be a break2 */ + } + } + /* + * Assume that item seen started at time 0. + * (True for function main). But initialize + * it so that it works the next time too. + */ + t = top (); + local_time = fn_time - t -> time - t -> children; + t -> time = fn_time; t -> children = 0; + modules[pos].m_time += local_time; + modules[pos].m_calls++; + tot_time += local_time; + tot_calls++; + break; + case 'S': + sscanf (buf+2, "%lx %lx %64s", &fn_sbot, &fn_ssz, fn_name); + DBUG_PRINT ("srec", ("%lx %lx %s", fn_sbot, fn_ssz, fn_name)); + pos = add (fn_name); + lastuse = modules[pos].m_stkuse; +#if 0 + /* + * Needs further thought. Stack use is determined by + * difference in stack between two functions with DBUG_ENTER + * macros. If A calls B calls C, where A and C have the + * macros, and B doesn't, then B's stack use will be lumped + * in with either A's or C's. If somewhere else A calls + * C directly, the stack use will seem to change. Just + * take the biggest for now... + */ + if (lastuse > 0 && lastuse != fn_ssz) { + fprintf (stderr, + "warning - %s stack use changed (%lx to %lx)\n", + fn_name, lastuse, fn_ssz); + } +#endif + if (fn_ssz > lastuse) { + modules[pos].m_stkuse = fn_ssz; + } + if (fn_sbot > highstack) { + highstack = fn_sbot; + } else if (fn_sbot < lowstack) { + lowstack = fn_sbot; + } + break; + default: + fprintf (stderr, "unknown record type '%c'\n", buf[0]); + break; + } + next_line:; + } + + /* + * Now, we've hit eof. If we still have stuff stacked, then we + * assume that the user called exit, so give everything the exited + * time of fn_time. + */ + while (pop (&oldpos,&oldtime,&oldchild)) { + local_time = fn_time - oldtime; + t = top (); + t -> children += local_time; + local_time -= oldchild; + modules[oldpos].m_time += local_time; + modules[oldpos].m_calls++; + tot_time += local_time; + tot_calls++; + } + DBUG_VOID_RETURN; +} + +/* + * out_header () -- print out the header of the report. + */ + +void out_header (outf) +FILE *outf; +{ + DBUG_ENTER ("out_header"); + if (verbose) { + fprintf (outf, "Profile of Execution\n"); + fprintf (outf, "Execution times are in milliseconds\n\n"); + fprintf (outf, " Calls\t\t\t Time\n"); + fprintf (outf, " -----\t\t\t ----\n"); + fprintf (outf, "Times\tPercentage\tTime Spent\tPercentage\n"); + fprintf (outf, "Called\tof total\tin Function\tof total Importance\tFunction\n"); + fprintf (outf, "======\t==========\t===========\t========== ==========\t========\t\n"); + } else { + fprintf (outf, "%ld bytes of stack used, from %lx down to %lx\n\n", + highstack - lowstack, highstack, lowstack); + fprintf (outf, + " %%time sec #call ms/call %%calls weight stack name\n"); + } + DBUG_VOID_RETURN; +} + +/* + * out_trailer () - writes out the summary line of the report. + */ + +void out_trailer (outf,sum_calls,sum_time) +FILE *outf; +unsigned long int sum_calls, sum_time; +{ + DBUG_ENTER ("out_trailer"); + if (verbose) + { + fprintf(outf, "======\t==========\t===========\t==========\t========\n"); + fprintf(outf, "%6ld\t%10.2f\t%11ld\t%10.2f\t\t%-15s\n", + sum_calls, 100.0, sum_time, 100.0, "Totals"); + } + DBUG_VOID_RETURN; +} + +/* + * out_item () - prints out the output line for a single entry, + * and sets the calls and time fields appropriately. + */ + +void out_item (outf, m,called,timed) +FILE *outf; +register struct module_t *m; +unsigned long int *called, *timed; +{ + char *name = m -> name; + register unsigned int calls = m -> m_calls; + register unsigned long local_time = m -> m_time; + register unsigned long stkuse = m -> m_stkuse; + unsigned int import; + double per_time = 0.0; + double per_calls = 0.0; + double ms_per_call, local_ftime; + + DBUG_ENTER ("out_item"); + + if (tot_time > 0) { + per_time = (double) (local_time * 100) / (double) tot_time; + } + if (tot_calls > 0) { + per_calls = (double) (calls * 100) / (double) tot_calls; + } + import = (unsigned int) (per_time * per_calls); + + if (verbose) { + fprintf (outf, "%6d\t%10.2f\t%11ld\t%10.2f %10d\t%-15s\n", + calls, per_calls, local_time, per_time, import, name); + } else { + ms_per_call = local_time; + ms_per_call /= calls; + local_ftime = local_time; + local_ftime /= 1000; + fprintf(outf, "%8.2f%8.3f%8u%8.3f%8.2f%8u%8lu %-s\n", + per_time, local_ftime, calls, ms_per_call, per_calls, import, + stkuse, name); + } + *called = calls; + *timed = local_time; + DBUG_VOID_RETURN; +} + +/* + * out_body (outf, root,s_calls,s_time) -- Performs an inorder traversal + * on the binary search tree (root). Calls out_item to actually print + * the item out. + */ + +void out_body (outf, root,s_calls,s_time) +FILE *outf; +register unsigned int root; +register unsigned long int *s_calls, *s_time; +{ + unsigned long int calls, local_time; + + DBUG_ENTER ("out_body"); + DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time)); + if (root == MAXPROCS) { + DBUG_PRINT ("out_body", ("%lu,%lu",*s_calls,*s_time)); + } else { + while (root != MAXPROCS) { + out_body (outf, s_table[root].lchild,s_calls,s_time); + out_item (outf, &modules[s_table[root].pos],&calls,&local_time); + DBUG_PRINT ("out_body", ("-- %lu -- %lu --", calls, local_time)); + *s_calls += calls; + *s_time += local_time; + root = s_table[root].rchild; + } + DBUG_PRINT ("out_body", ("%lu,%lu", *s_calls, *s_time)); + } + DBUG_VOID_RETURN; +} + +/* + * output () - print out a nice sorted output report on outf. + */ + +void output (outf) +FILE *outf; +{ + unsigned long int sum_calls = 0; + unsigned long int sum_time = 0; + + DBUG_ENTER ("output"); + if (n_items == 0) { + fprintf (outf, "%s: No functions to trace\n", my_name); + exit (EX_DATAERR); + } + out_header (outf); + out_body (outf, 0,&sum_calls,&sum_time); + out_trailer (outf, sum_calls,sum_time); + DBUG_VOID_RETURN; +} + + +#define usage() fprintf (DBUG_FILE,"Usage: %s [-v] [prof-file]\n",my_name) + +#ifdef MSDOS +extern int getopt(int argc, char **argv, char *opts); +#endif +extern int optind; +extern char *optarg; + +int main (int argc, char **argv) +{ + register int c; + int badflg = 0; + FILE *infile; + FILE *outfile = {stdout}; + +#ifdef THREAD +#if defined(HAVE_PTHREAD_INIT) + pthread_init(); /* Must be called before DBUG_ENTER */ +#endif + my_thread_global_init(); +#endif /* THREAD */ + { + DBUG_ENTER ("main"); + DBUG_PROCESS (argv[0]); + my_name = argv[0]; + while ((c = getopt (argc,argv,"#:v")) != EOF) { + switch (c) { + case '#': /* Debugging Macro enable */ + DBUG_PUSH (optarg); + break; + case 'v': /* Verbose mode */ + verbose++; + break; + default: + badflg++; + break; + } + } + if (badflg) { + usage (); + DBUG_RETURN (EX_USAGE); + } + if (optind < argc) { + FILEOPEN (infile, argv[optind], "r"); + } else { + FILEOPEN (infile, PRO_FILE, "r"); + } + process (infile); + output (outfile); + DBUG_RETURN (EX_OK); +} +} + +#ifdef MSDOS + +/* + * From std-unix@ut-sally.UUCP (Moderator, John Quarterman) Sun Nov 3 14:34:15 1985 + * Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gatech.CSNET + * Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP + * Path: gatech!akgua!mhuxv!mhuxt!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!std-unix + * From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) + * Newsgroups: mod.std.unix + * Subject: public domain AT&T getopt source + * Message-ID: <3352@ut-sally.UUCP> + * Date: 3 Nov 85 19:34:15 GMT + * Date-Received: 4 Nov 85 12:25:09 GMT + * Organization: IEEE/P1003 Portable Operating System Environment Committee + * Lines: 91 + * Approved: jsq@ut-sally.UUCP + * + * Here's something you've all been waiting for: the AT&T public domain + * source for getopt(3). It is the code which was given out at the 1985 + * UNIFORUM conference in Dallas. I obtained it by electronic mail + * directly from AT&T. The people there assure me that it is indeed + * in the public domain. + * + * There is no manual page. That is because the one they gave out at + * UNIFORUM was slightly different from the current System V Release 2 + * manual page. The difference apparently involved a note about the + * famous rules 5 and 6, recommending using white space between an option + * and its first argument, and not grouping options that have arguments. + * Getopt itself is currently lenient about both of these things White + * space is allowed, but not mandatory, and the last option in a group can + * have an argument. That particular version of the man page evidently + * has no official existence, and my source at AT&T did not send a copy. + * The current SVR2 man page reflects the actual behavor of this getopt. + * However, I am not about to post a copy of anything licensed by AT&T. + * + * I will submit this source to Berkeley as a bug fix. + * + * I, personally, make no claims or guarantees of any kind about the + * following source. I did compile it to get some confidence that + * it arrived whole, but beyond that you're on your own. + * + */ + +/*LINTLIBRARY*/ + +int opterr = 1; +int optind = 1; +int optopt; +char *optarg; + +static void _ERR(s,c,argv) +char *s; +int c; +char *argv[]; +{ + char errbuf[3]; + + if (opterr) { + errbuf[0] = c; + errbuf[1] = '\n'; + (void) fprintf(stderr, "%s", argv[0]); + (void) fprintf(stderr, "%s", s); + (void) fprintf(stderr, "%s", errbuf); + } +} + +int getopt(argc, argv, opts) +int argc; +char **argv, *opts; +{ + static int sp = 1; + register int c; + register char *cp; + + if(sp == 1) + if(optind >= argc || + argv[optind][0] != '-' || argv[optind][1] == '\0') + return(EOF); + else if(strcmp(argv[optind], "--") == 0) { + optind++; + return(EOF); + } + optopt = c = argv[optind][sp]; + if(c == ':' || (cp=strchr(opts, c)) == NULL) { + _ERR(": illegal option -- ", c, argv); + if(argv[optind][++sp] == '\0') { + optind++; + sp = 1; + } + return('?'); + } + if(*++cp == ':') { + if(argv[optind][sp+1] != '\0') + optarg = &argv[optind++][sp+1]; + else if(++optind >= argc) { + _ERR(": option requires an argument -- ", c, argv); + sp = 1; + return('?'); + } else + optarg = argv[optind++]; + sp = 1; + } else { + if(argv[optind][++sp] == '\0') { + sp = 1; + optind++; + } + optarg = NULL; + } + return(c); +} + +#endif /* !unix && !xenix */ diff --git a/externals/mysql/extlib/dbug/dbug_long.h b/externals/mysql/extlib/dbug/dbug_long.h new file mode 100644 index 0000000..829df18 --- /dev/null +++ b/externals/mysql/extlib/dbug/dbug_long.h @@ -0,0 +1,160 @@ +#error This file is not used in MySQL - see ../include/my_dbug.h instead +/****************************************************************************** + * * + * N O T I C E * + * * + * Copyright Abandoned, 1987, Fred Fish * + * * + * * + * This previously copyrighted work has been placed into the public * + * domain by the author and may be freely used for any purpose, * + * private or commercial. * + * * + * Because of the number of inquiries I was receiving about the use * + * of this product in commercially developed works I have decided to * + * simply make it public domain to further its unrestricted use. I * + * specifically would be most happy to see this material become a * + * part of the standard Unix distributions by AT&T and the Berkeley * + * Computer Science Research Group, and a standard part of the GNU * + * system from the Free Software Foundation. * + * * + * I would appreciate it, as a courtesy, if this notice is left in * + * all copies and derivative works. Thank you. * + * * + * The author makes no warranty of any kind with respect to this * + * product and explicitly disclaims any implied warranties of mer- * + * chantability or fitness for any particular purpose. * + * * + ****************************************************************************** + */ + +/* + * FILE + * + * dbug.h user include file for programs using the dbug package + * + * SYNOPSIS + * + * #include + * + * SCCS ID + * + * @(#)dbug.h 1.13 7/17/89 + * + * DESCRIPTION + * + * Programs which use the dbug package must include this file. + * It contains the appropriate macros to call support routines + * in the dbug runtime library. + * + * To disable compilation of the macro expansions define the + * preprocessor symbol "DBUG_OFF". This will result in null + * macros expansions so that the resulting code will be smaller + * and faster. (The difference may be smaller than you think + * so this step is recommended only when absolutely necessary). + * In general, tradeoffs between space and efficiency are + * decided in favor of efficiency since space is seldom a + * problem on the new machines). + * + * All externally visible symbol names follow the pattern + * "_db_xxx..xx_" to minimize the possibility of a dbug package + * symbol colliding with a user defined symbol. + * + * The DBUG_ style macros are obsolete and should not be used + * in new code. Macros to map them to instances of DBUG_PRINT + * are provided for compatibility with older code. They may go + * away completely in subsequent releases. + * + * AUTHOR + * + * Fred Fish + * (Currently employed by Motorola Computer Division, Tempe, Az.) + * hao!noao!mcdsun!fnf + * (602) 438-3614 + * + */ + +/* + * Internally used dbug variables which must be global. + */ + +#ifndef DBUG_OFF + extern int _db_on_; /* TRUE if debug currently enabled */ + extern FILE *_db_fp_; /* Current debug output stream */ + extern char *_db_process_; /* Name of current process */ + extern int _db_keyword_ (); /* Accept/reject keyword */ + extern void _db_push_ (); /* Push state, set up new state */ + extern void _db_pop_ (); /* Pop previous debug state */ + extern void _db_enter_ (); /* New user function entered */ + extern void _db_return_ (); /* User function return */ + extern void _db_pargs_ (); /* Remember args for line */ + extern void _db_doprnt_ (); /* Print debug output */ + extern void _db_setjmp_ (); /* Save debugger environment */ + extern void _db_longjmp_ (); /* Restore debugger environment */ + extern void _db_dump_(); /* Dump memory */ +# endif + + +/* + * These macros provide a user interface into functions in the + * dbug runtime support library. They isolate users from changes + * in the MACROS and/or runtime support. + * + * The symbols "__LINE__" and "__FILE__" are expanded by the + * preprocessor to the current source file line number and file + * name respectively. + * + * WARNING --- Because the DBUG_ENTER macro allocates space on + * the user function's stack, it must precede any executable + * statements in the user function. + * + */ + +# ifdef DBUG_OFF +# define DBUG_ENTER(a1) +# define DBUG_RETURN(a1) return(a1) +# define DBUG_VOID_RETURN return +# define DBUG_EXECUTE(keyword,a1) +# define DBUG_PRINT(keyword,arglist) +# define DBUG_2(keyword,format) /* Obsolete */ +# define DBUG_3(keyword,format,a1) /* Obsolete */ +# define DBUG_4(keyword,format,a1,a2) /* Obsolete */ +# define DBUG_5(keyword,format,a1,a2,a3) /* Obsolete */ +# define DBUG_PUSH(a1) +# define DBUG_POP() +# define DBUG_PROCESS(a1) +# define DBUG_FILE (stderr) +# define DBUG_SETJMP setjmp +# define DBUG_LONGJMP longjmp +# define DBUG_DUMP(keyword,a1) +# else +# define DBUG_ENTER(a) \ + auto char *_db_func_; auto char *_db_file_; auto int _db_level_; \ + auto char **_db_framep_; \ + _db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \ + &_db_framep_) +# define DBUG_LEAVE \ + (_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)) +# define DBUG_RETURN(a1) return (DBUG_LEAVE, (a1)) +/* define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);} Alternate form */ +# define DBUG_VOID_RETURN {DBUG_LEAVE; return;} +# define DBUG_EXECUTE(keyword,a1) \ + {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}} +# define DBUG_PRINT(keyword,arglist) \ + {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}} +# define DBUG_2(keyword,format) \ + DBUG_PRINT(keyword,(format)) /* Obsolete */ +# define DBUG_3(keyword,format,a1) \ + DBUG_PRINT(keyword,(format,a1)) /* Obsolete */ +# define DBUG_4(keyword,format,a1,a2) \ + DBUG_PRINT(keyword,(format,a1,a2)) /* Obsolete */ +# define DBUG_5(keyword,format,a1,a2,a3) \ + DBUG_PRINT(keyword,(format,a1,a2,a3)) /* Obsolete */ +# define DBUG_PUSH(a1) _db_push_ (a1) +# define DBUG_POP() _db_pop_ () +# define DBUG_PROCESS(a1) (_db_process_ = a1) +# define DBUG_FILE (_db_fp_) +# define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) +# define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) +# define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) +# endif diff --git a/externals/mysql/extlib/dbug/example1.c b/externals/mysql/extlib/dbug/example1.c new file mode 100644 index 0000000..7b3c3fc --- /dev/null +++ b/externals/mysql/extlib/dbug/example1.c @@ -0,0 +1,10 @@ +main (argc, argv) +int argc; +char *argv[]; +{ + printf ("argv[0] = %d\n", argv[0]); + /* + * Rest of program + */ + printf ("== done ==\n"); +} diff --git a/externals/mysql/extlib/dbug/example2.c b/externals/mysql/extlib/dbug/example2.c new file mode 100644 index 0000000..75fc132 --- /dev/null +++ b/externals/mysql/extlib/dbug/example2.c @@ -0,0 +1,15 @@ +int debug = 0; + +main (argc, argv) +int argc; +char *argv[]; +{ + /* printf ("argv = %x\n", argv) */ + if (debug) printf ("argv[0] = %d\n", argv[0]); + /* + * Rest of program + */ +#ifdef DEBUG + printf ("== done ==\n"); +#endif +} diff --git a/externals/mysql/extlib/dbug/example3.c b/externals/mysql/extlib/dbug/example3.c new file mode 100644 index 0000000..c035cdf --- /dev/null +++ b/externals/mysql/extlib/dbug/example3.c @@ -0,0 +1,14 @@ +main (argc, argv) +int argc; +char *argv[]; +{ +# ifdef DEBUG + printf ("argv[0] = %d\n", argv[0]); +# endif + /* + * Rest of program + */ +# ifdef DEBUG + printf ("== done ==\n"); +# endif +} diff --git a/externals/mysql/extlib/dbug/factorial.c b/externals/mysql/extlib/dbug/factorial.c new file mode 100644 index 0000000..7b190ea --- /dev/null +++ b/externals/mysql/extlib/dbug/factorial.c @@ -0,0 +1,27 @@ +#ifdef DBUG_OFF /* We are testing dbug */ + +int factorial(register int value) { + if(value > 1) { + value *= factorial(value-1); + } + return value; +} + +#else + +#include + +int factorial ( +register int value) +{ + DBUG_ENTER ("factorial"); + DBUG_PRINT ("find", ("find %d factorial", value)); + if (value > 1) { + value *= factorial (value - 1); + } + DBUG_PRINT ("result", ("result is %d", value)); + DBUG_RETURN (value); +} + +#endif + diff --git a/externals/mysql/extlib/dbug/main.c b/externals/mysql/extlib/dbug/main.c new file mode 100644 index 0000000..00e80c8 --- /dev/null +++ b/externals/mysql/extlib/dbug/main.c @@ -0,0 +1,24 @@ +#include + +int main (argc, argv) +int argc; +char *argv[]; +{ + int result, ix; + extern int factorial(int); + DBUG_ENTER ("main"); + DBUG_PROCESS (argv[0]); + for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) { + switch (argv[ix][1]) { + case '#': + DBUG_PUSH (&(argv[ix][2])); + break; + } + } + for (; ix < argc; ix++) { + DBUG_PRINT ("args", ("argv[%d] = %s", ix, argv[ix])); + result = factorial (atoi(argv[ix])); + printf ("%d\n", result); + } + DBUG_RETURN (0); +} diff --git a/externals/mysql/extlib/dbug/my_main.c b/externals/mysql/extlib/dbug/my_main.c new file mode 100644 index 0000000..31c15aa --- /dev/null +++ b/externals/mysql/extlib/dbug/my_main.c @@ -0,0 +1,42 @@ +/* + this is modified version of the original example main.c + fixed so that it could compile and run in MySQL source tree +*/ + +#ifdef DBUG_OFF /* We are testing dbug */ +#undef DBUG_OFF +#endif + +#include /* This includes dbug.h */ +#include + +int main (argc, argv) +int argc; +char *argv[]; +{ + register int result, ix; + extern int factorial(int); +#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) + pthread_init(); /* Must be called before DBUG_ENTER */ +#endif +#ifdef THREAD + my_thread_global_init(); +#endif + { + DBUG_ENTER ("main"); + DBUG_PROCESS (argv[0]); + for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) { + switch (argv[ix][1]) { + case '#': + DBUG_PUSH (&(argv[ix][2])); + break; + } + } + for (; ix < argc; ix++) { + DBUG_PRINT ("args", ("argv[%d] = %s", ix, argv[ix])); + result = factorial (atoi(argv[ix])); + printf ("%d\n", result); + } + DBUG_RETURN (0); + } +} diff --git a/externals/mysql/extlib/dbug/sanity.c b/externals/mysql/extlib/dbug/sanity.c new file mode 100644 index 0000000..df43fc1 --- /dev/null +++ b/externals/mysql/extlib/dbug/sanity.c @@ -0,0 +1,13 @@ +/* Declarate _sanity() if not declared in main program */ + +#include + +extern int _sanity(const char *file,uint line); + +#if defined(SAFEMALLOC) && !defined(MASTER) /* Avoid errors in MySQL */ +int _sanity(const char * file __attribute__((unused)), + uint line __attribute__((unused))) +{ + return 0; +} +#endif diff --git a/externals/mysql/extlib/dbug/tests.c b/externals/mysql/extlib/dbug/tests.c new file mode 100644 index 0000000..d76266d --- /dev/null +++ b/externals/mysql/extlib/dbug/tests.c @@ -0,0 +1,87 @@ +/* + A program to test DBUG features. Used by tests-t.pl +*/ + +char *push1=0; + +#include /* This includes dbug.h */ +#include +#include + +const char *func3() +{ + DBUG_ENTER("func3"); + DBUG_RETURN(DBUG_EVALUATE("ret3", "ok", "ko")); +} + +void func2() +{ + const char *s; + DBUG_ENTER("func2"); + s=func3(); + DBUG_PRINT("info", ("s=%s", s)); + DBUG_VOID_RETURN; +} + +int func1() +{ + DBUG_ENTER("func1"); + func2(); + if (push1) + { + DBUG_PUSH(push1); + fprintf(DBUG_FILE, "=> push1\n"); + } + DBUG_RETURN(10); +} + +int main (int argc, char *argv[]) +{ + int i; +#ifdef DBUG_OFF + return 1; +#endif + if (argc == 1) + return 0; + +#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) + pthread_init(); /* Must be called before DBUG_ENTER */ +#endif +#ifdef THREAD + my_thread_global_init(); +#endif + dup2(1, 2); + for (i = 1; i < argc; i++) + { + if (strncmp(argv[i], "--push1=", 8) == 0) + push1=argv[i]+8; + else + DBUG_PUSH (argv[i]); + } + { + DBUG_ENTER ("main"); + DBUG_PROCESS ("dbug-tests"); + func1(); + DBUG_EXECUTE_IF("dump", + { + char s[1000]; + DBUG_EXPLAIN(s, sizeof(s)-1); + DBUG_DUMP("dump", (uchar*)s, strlen(s)); + }); + DBUG_EXECUTE_IF("push", DBUG_PUSH("+t"); ); + DBUG_EXECUTE("execute", fprintf(DBUG_FILE, "=> execute\n"); ); + DBUG_EXECUTE_IF("set", DBUG_SET("+F"); ); + fprintf(DBUG_FILE, "=> evaluate: %s\n", + DBUG_EVALUATE("evaluate", "ON", "OFF")); + fprintf(DBUG_FILE, "=> evaluate_if: %s\n", + DBUG_EVALUATE_IF("evaluate_if", "ON", "OFF")); + DBUG_EXECUTE_IF("pop", DBUG_POP(); ); + { + char s[1000] __attribute__((unused)); + DBUG_EXPLAIN(s, sizeof(s)-1); + DBUG_PRINT("explain", ("dbug explained: %s", s)); + } + func2(); + DBUG_RETURN (0); + } +} diff --git a/externals/mysql/extlib/regex/cclass.h b/externals/mysql/extlib/regex/cclass.h new file mode 100644 index 0000000..b877b5d --- /dev/null +++ b/externals/mysql/extlib/regex/cclass.h @@ -0,0 +1,22 @@ +/* character-class table */ + +#define CCLASS_ALNUM 0 +#define CCLASS_ALPHA 1 +#define CCLASS_BLANK 2 +#define CCLASS_CNTRL 3 +#define CCLASS_DIGIT 4 +#define CCLASS_GRAPH 5 +#define CCLASS_LOWER 6 +#define CCLASS_PRINT 7 +#define CCLASS_PUNCT 8 +#define CCLASS_SPACE 9 +#define CCLASS_UPPER 10 +#define CCLASS_XDIGIT 11 +#define CCLASS_LAST 12 + +extern struct cclass { + const char *name; + const char *chars; + const char *multis; + uint mask; +} cclasses[]; diff --git a/externals/mysql/extlib/regex/cname.h b/externals/mysql/extlib/regex/cname.h new file mode 100644 index 0000000..06865f3 --- /dev/null +++ b/externals/mysql/extlib/regex/cname.h @@ -0,0 +1,104 @@ +/* character-name table */ +static struct cname { + const char *name; + const char code; +} cnames[] = { + {"NUL", '\0'}, + {"SOH", '\001'}, + {"STX", '\002'}, + {"ETX", '\003'}, + {"EOT", '\004'}, + {"ENQ", '\005'}, + {"ACK", '\006'}, + {"BEL", '\007'}, + {"alert", '\007'}, + {"BS", '\010'}, + {"backspace", '\b'}, + {"HT", '\011'}, + {"tab", '\t'}, + {"LF", '\012'}, + {"newline", '\n'}, + {"VT", '\013'}, + {"vertical-tab",'\v'}, + {"FF", '\014'}, + {"form-feed", '\f'}, + {"CR", '\015'}, + {"carriage-return", '\r'}, + {"SO", '\016'}, + {"SI", '\017'}, + {"DLE", '\020'}, + {"DC1", '\021'}, + {"DC2", '\022'}, + {"DC3", '\023'}, + {"DC4", '\024'}, + {"NAK", '\025'}, + {"SYN", '\026'}, + {"ETB", '\027'}, + {"CAN", '\030'}, + {"EM", '\031'}, + {"SUB", '\032'}, + {"ESC", '\033'}, + {"IS4", '\034'}, + {"FS", '\034'}, + {"IS3", '\035'}, + {"GS", '\035'}, + {"IS2", '\036'}, + {"RS", '\036'}, + {"IS1", '\037'}, + {"US", '\037'}, + {"space", ' '}, + {"exclamation-mark", '!'}, + {"quotation-mark", '"'}, + {"number-sign", '#'}, + {"dollar-sign", '$'}, + {"percent-sign", '%'}, + {"ampersand", '&'}, + {"apostrophe", '\''}, + {"left-parenthesis", '('}, + {"right-parenthesis", ')'}, + {"asterisk", '*'}, + {"plus-sign", '+'}, + {"comma", ','}, + {"hyphen", '-'}, + {"hyphen-minus", '-'}, + {"period", '.'}, + {"full-stop", '.'}, + {"slash", '/'}, + {"solidus", '/'}, + {"zero", '0'}, + {"one", '1'}, + {"two", '2'}, + {"three", '3'}, + {"four", '4'}, + {"five", '5'}, + {"six", '6'}, + {"seven", '7'}, + {"eight", '8'}, + {"nine", '9'}, + {"colon", ':'}, + {"semicolon", ';'}, + {"less-than-sign", '<'}, + {"equals-sign", '='}, + {"greater-than-sign", '>'}, + {"question-mark", '?'}, + {"commercial-at", '@'}, + {"left-square-bracket", '['}, + {"backslash", '\\'}, + {"reverse-solidus", '\\'}, + {"right-square-bracket",']'}, + {"circumflex", '^'}, + {"circumflex-accent", '^'}, + {"underscore", '_'}, + {"low-line", '_'}, + {"grave-accent", '`'}, + {"left-brace", '{'}, + {"left-curly-bracket", '{'}, + {"vertical-line", '|'}, + {"right-brace", '}'}, + {"right-curly-bracket", '}'}, + {"tilde", '~'}, + {"DEL", '\177'}, + {NULL, 0}, +}; + + diff --git a/externals/mysql/extlib/regex/debug.c b/externals/mysql/extlib/regex/debug.c new file mode 100644 index 0000000..271b09b --- /dev/null +++ b/externals/mysql/extlib/regex/debug.c @@ -0,0 +1,246 @@ +#include +#include +#include +#include + +#include "my_regex.h" +#include "utils.h" +#include "regex2.h" +#include "debug.ih" + +/* Added extra paramter to regchar to remove static buffer ; Monty 96.11.27 */ + +/* + - regprint - print a regexp for debugging + == void regprint(regex_t *r, FILE *d); + */ +void +regprint(r, d) +my_regex_t *r; +FILE *d; +{ + register struct re_guts *g = r->re_g; + register int i; + register int c; + register int last; + int nincat[NC]; + char buf[10]; + + fprintf(d, "%ld states, %d categories", (long)g->nstates, + g->ncategories); + fprintf(d, ", first %ld last %ld", (long)g->firststate, + (long)g->laststate); + if (g->iflags&USEBOL) + fprintf(d, ", USEBOL"); + if (g->iflags&USEEOL) + fprintf(d, ", USEEOL"); + if (g->iflags&BAD) + fprintf(d, ", BAD"); + if (g->nsub > 0) + fprintf(d, ", nsub=%ld", (long)g->nsub); + if (g->must != NULL) + fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen, + g->must); + if (g->backrefs) + fprintf(d, ", backrefs"); + if (g->nplus > 0) + fprintf(d, ", nplus %ld", (long)g->nplus); + fprintf(d, "\n"); + s_print(r->charset, g, d); + for (i = 0; i < g->ncategories; i++) { + nincat[i] = 0; + for (c = CHAR_MIN; c <= CHAR_MAX; c++) + if (g->categories[c] == i) + nincat[i]++; + } + fprintf(d, "cc0#%d", nincat[0]); + for (i = 1; i < g->ncategories; i++) + if (nincat[i] == 1) { + for (c = CHAR_MIN; c <= CHAR_MAX; c++) + if (g->categories[c] == i) + break; + fprintf(d, ", %d=%s", i, regchar(r->charset,c,buf)); + } + fprintf(d, "\n"); + for (i = 1; i < g->ncategories; i++) + if (nincat[i] != 1) { + fprintf(d, "cc%d\t", i); + last = -1; + for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */ + if (c <= CHAR_MAX && g->categories[c] == i) { + if (last < 0) { + fprintf(d, "%s", regchar(r->charset,c,buf)); + last = c; + } + } else { + if (last >= 0) { + if (last != c-1) + fprintf(d, "-%s", + regchar(r->charset,c-1,buf)); + last = -1; + } + } + fprintf(d, "\n"); + } +} + +/* + - s_print - print the strip for debugging + == static void s_print(register struct re_guts *g, FILE *d); + */ +static void +s_print(charset, g, d) +CHARSET_INFO *charset; +register struct re_guts *g; +FILE *d; +{ + register sop *s; + register cset *cs; + register int i; + register int done = 0; + register sop opnd; + register int col = 0; + register int last; + register sopno offset = 2; + char buf[10]; +# define GAP() { if (offset % 5 == 0) { \ + if (col > 40) { \ + fprintf(d, "\n\t"); \ + col = 0; \ + } else { \ + fprintf(d, " "); \ + col++; \ + } \ + } else \ + col++; \ + offset++; \ + } + + if (OP(g->strip[0]) != OEND) + fprintf(d, "missing initial OEND!\n"); + for (s = &g->strip[1]; !done; s++) { + opnd = OPND(*s); + switch (OP(*s)) { + case OEND: + fprintf(d, "\n"); + done = 1; + break; + case OCHAR: + if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL) + fprintf(d, "\\%c", (char)opnd); + else + fprintf(d, "%s", regchar(charset,(char)opnd,buf)); + break; + case OBOL: + fprintf(d, "^"); + break; + case OEOL: + fprintf(d, "$"); + break; + case OBOW: + fprintf(d, "\\{"); + break; + case OEOW: + fprintf(d, "\\}"); + break; + case OANY: + fprintf(d, "."); + break; + case OANYOF: + fprintf(d, "[(%ld)", (long)opnd); + cs = &g->sets[opnd]; + last = -1; + for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */ + if (CHIN(cs, i) && i < g->csetsize) { + if (last < 0) { + fprintf(d, "%s", regchar(charset,i,buf)); + last = i; + } + } else { + if (last >= 0) { + if (last != i-1) + fprintf(d, "-%s", + regchar(charset,i-1,buf)); + last = -1; + } + } + fprintf(d, "]"); + break; + case OBACK_: + fprintf(d, "(\\<%ld>", (long)opnd); + break; + case O_BACK: + fprintf(d, "<%ld>\\)", (long)opnd); + break; + case OPLUS_: + fprintf(d, "(+"); + if (OP(*(s+opnd)) != O_PLUS) + fprintf(d, "<%ld>", (long)opnd); + break; + case O_PLUS: + if (OP(*(s-opnd)) != OPLUS_) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, "+)"); + break; + case OQUEST_: + fprintf(d, "(?"); + if (OP(*(s+opnd)) != O_QUEST) + fprintf(d, "<%ld>", (long)opnd); + break; + case O_QUEST: + if (OP(*(s-opnd)) != OQUEST_) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, "?)"); + break; + case OLPAREN: + fprintf(d, "((<%ld>", (long)opnd); + break; + case ORPAREN: + fprintf(d, "<%ld>))", (long)opnd); + break; + case OCH_: + fprintf(d, "<"); + if (OP(*(s+opnd)) != OOR2) + fprintf(d, "<%ld>", (long)opnd); + break; + case OOR1: + if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, "|"); + break; + case OOR2: + fprintf(d, "|"); + if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH) + fprintf(d, "<%ld>", (long)opnd); + break; + case O_CH: + if (OP(*(s-opnd)) != OOR1) + fprintf(d, "<%ld>", (long)opnd); + fprintf(d, ">"); + break; + default: + fprintf(d, "!%ld(%ld)!", OP(*s), opnd); + break; + } + if (!done) + GAP(); + } +} + +/* + - regchar - make a character printable + == static char *regchar(int ch); + */ +static char * /* -> representation */ +regchar(charset,ch,buf) +CHARSET_INFO *charset; +int ch; +char *buf; +{ + + if (my_isprint(charset,ch) || ch == ' ') + sprintf(buf, "%c", ch); + else + sprintf(buf, "\\%o", ch); + return(buf); +} diff --git a/externals/mysql/extlib/regex/engine.c b/externals/mysql/extlib/regex/engine.c new file mode 100644 index 0000000..1968ca6 --- /dev/null +++ b/externals/mysql/extlib/regex/engine.c @@ -0,0 +1,1031 @@ +/* + * The matching engine and friends. This file is #included by regexec.c + * after suitable #defines of a variety of macros used herein, so that + * different state representations can be used without duplicating masses + * of code. + */ + +#ifdef SNAMES +#define matcher smatcher +#define fast sfast +#define slow sslow +#define dissect sdissect +#define backref sbackref +#define step sstep +#define print sprint +#define at sat +#define match smat +#endif +#ifdef LNAMES +#define matcher lmatcher +#define fast lfast +#define slow lslow +#define dissect ldissect +#define backref lbackref +#define step lstep +#define print lprint +#define at lat +#define match lmat +#endif + +/* another structure passed up and down to avoid zillions of parameters */ +struct match { + struct re_guts *g; + int eflags; + my_regmatch_t *pmatch; /* [nsub+1] (0 element unused) */ + char *offp; /* offsets work from here */ + char *beginp; /* start of string -- virtual NUL precedes */ + char *endp; /* end of string -- virtual NUL here */ + char *coldp; /* can be no match starting before here */ + char **lastpos; /* [nplus+1] */ + STATEVARS; + states st; /* current states */ + states fresh; /* states for a fresh start */ + states tmp; /* temporary */ + states empty; /* empty set of states */ +}; + +#include "engine.ih" + +#ifdef REDEBUG +#define SP(t, s, c) print(m, t, s, c, stdout) +#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2) +#define NOTE(str) { if (m->eflags®_TRACE) printf("=%s\n", (str)); } +#else +#define SP(t, s, c) /* nothing */ +#define AT(t, p1, p2, s1, s2) /* nothing */ +#define NOTE(s) /* nothing */ +#endif + +/* + - matcher - the actual matching engine + == static int matcher(register struct re_guts *g, char *string, \ + == size_t nmatch, regmatch_t pmatch[], int eflags); + */ +static int /* 0 success, REG_NOMATCH failure */ +matcher(charset,g, str, nmatch, pmatch, eflags) +CHARSET_INFO *charset; +register struct re_guts *g; +char *str; +size_t nmatch; +my_regmatch_t pmatch[]; +int eflags; +{ + register char *endp; + register uint i; + struct match mv; + register struct match *m = &mv; + register char *dp; + register const sopno gf = g->firststate+1; /* +1 for OEND */ + register const sopno gl = g->laststate; + char *start; + char *stop; + + /* simplify the situation where possible */ + if (g->cflags®_NOSUB) + nmatch = 0; + if (eflags®_STARTEND) { + start = str + pmatch[0].rm_so; + stop = str + pmatch[0].rm_eo; + } else { + start = str; + stop = start + strlen(start); + } + if (stop < start) + return(REG_INVARG); + + /* prescreening; this does wonders for this rather slow code */ + if (g->must != NULL) { + for (dp = start; dp < stop; dp++) + if (*dp == g->must[0] && stop - dp >= g->mlen && + memcmp(dp, g->must, (size_t)g->mlen) == 0) + break; + if (dp == stop) /* we didn't find g->must */ + return(REG_NOMATCH); + } + + /* match struct setup */ + m->g = g; + m->eflags = eflags; + m->pmatch = NULL; + m->lastpos = NULL; + m->offp = str; + m->beginp = start; + m->endp = stop; + STATESETUP(m, 4); + SETUP(m->st); + SETUP(m->fresh); + SETUP(m->tmp); + SETUP(m->empty); + CLEAR(m->empty); + + /* this loop does only one repetition except for backrefs */ + for (;;) { + endp = fast(charset, m, start, stop, gf, gl); + if (endp == NULL) { /* a miss */ + if (m->pmatch != NULL) + free((char *)m->pmatch); + if (m->lastpos != NULL) + free((char *)m->lastpos); + STATETEARDOWN(m); + return(REG_NOMATCH); + } + if (nmatch == 0 && !g->backrefs) + break; /* no further info needed */ + + /* where? */ + assert(m->coldp != NULL); + for (;;) { + NOTE("finding start"); + endp = slow(charset, m, m->coldp, stop, gf, gl); + if (endp != NULL) + break; + assert(m->coldp < m->endp); + m->coldp++; + } + if (nmatch == 1 && !g->backrefs) + break; /* no further info needed */ + + /* oh my, he wants the subexpressions... */ + if (m->pmatch == NULL) + m->pmatch = (my_regmatch_t *)malloc((m->g->nsub + 1) * + sizeof(my_regmatch_t)); + if (m->pmatch == NULL) { + if (m->lastpos != NULL) + free((char *)m->lastpos); + STATETEARDOWN(m); + return(REG_ESPACE); + } + for (i = 1; i <= m->g->nsub; i++) + m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1; + if (!g->backrefs && !(m->eflags®_BACKR)) { + NOTE("dissecting"); + dp = dissect(charset, m, m->coldp, endp, gf, gl); + } else { + if (g->nplus > 0 && m->lastpos == NULL) + m->lastpos = (char **)malloc((g->nplus+1) * + sizeof(char *)); + if (g->nplus > 0 && m->lastpos == NULL) { + free(m->pmatch); + STATETEARDOWN(m); + return(REG_ESPACE); + } + NOTE("backref dissect"); + dp = backref(charset, m, m->coldp, endp, gf, gl, (sopno)0); + } + if (dp != NULL) + break; + + /* uh-oh... we couldn't find a subexpression-level match */ + assert(g->backrefs); /* must be back references doing it */ + assert(g->nplus == 0 || m->lastpos != NULL); + for (;;) { + if (dp != NULL || endp <= m->coldp) + break; /* defeat */ + NOTE("backoff"); + endp = slow(charset, m, m->coldp, endp-1, gf, gl); + if (endp == NULL) + break; /* defeat */ + /* try it on a shorter possibility */ +#ifndef NDEBUG + for (i = 1; i <= m->g->nsub; i++) { + assert(m->pmatch[i].rm_so == -1); + assert(m->pmatch[i].rm_eo == -1); + } +#endif + NOTE("backoff dissect"); + dp = backref(charset, m, m->coldp, endp, gf, gl, (sopno)0); + } + assert(dp == NULL || dp == endp); + if (dp != NULL) /* found a shorter one */ + break; + + /* despite initial appearances, there is no match here */ + NOTE("false alarm"); + start = m->coldp + 1; /* recycle starting later */ + assert(start <= stop); + } + + /* fill in the details if requested */ + if (nmatch > 0) { + pmatch[0].rm_so = m->coldp - m->offp; + pmatch[0].rm_eo = endp - m->offp; + } + if (nmatch > 1) { + assert(m->pmatch != NULL); + for (i = 1; i < nmatch; i++) + if (i <= m->g->nsub) + pmatch[i] = m->pmatch[i]; + else { + pmatch[i].rm_so = -1; + pmatch[i].rm_eo = -1; + } + } + + if (m->pmatch != NULL) + free((char *)m->pmatch); + if (m->lastpos != NULL) + free((char *)m->lastpos); + STATETEARDOWN(m); + return(0); +} + +/* + - dissect - figure out what matched what, no back references + == static char *dissect(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst); + */ +static char * /* == stop (success) always */ +dissect(charset, m, start, stop, startst, stopst) +CHARSET_INFO *charset; +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + register uint i; + register sopno ss; /* start sop of current subRE */ + register sopno es; /* end sop of current subRE */ + register char *sp; /* start of string matched by it */ + register char *stp; /* string matched by it cannot pass here */ + register char *rest; /* start of rest of string */ + register char *tail; /* string unmatched by rest of RE */ + register sopno ssub; /* start sop of subsubRE */ + register sopno esub; /* end sop of subsubRE */ + register char *ssp; /* start of string matched by subsubRE */ + register char *sep; /* end of string matched by subsubRE */ + register char *oldssp; /* previous ssp */ + register char *dp; /* used in debug mode to check asserts */ + + AT("diss", start, stop, startst, stopst); + sp = start; + for (ss = startst; ss < stopst; ss = es) { + /* identify end of subRE */ + es = ss; + switch (OP(m->g->strip[es])) { + case OPLUS_: + case OQUEST_: + es += OPND(m->g->strip[es]); + break; + case OCH_: + while (OP(m->g->strip[es]) != O_CH) + es += OPND(m->g->strip[es]); + break; + } + es++; + + /* figure out what it matched */ + switch (OP(m->g->strip[ss])) { + case OEND: + assert(nope); + break; + case OCHAR: + sp++; + break; + case OBOL: + case OEOL: + case OBOW: + case OEOW: + break; + case OANY: + case OANYOF: + sp++; + break; + case OBACK_: + case O_BACK: + assert(nope); + break; + /* cases where length of match is hard to find */ + case OQUEST_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(charset, m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(charset, m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = es - 1; + /* did innards match? */ + if (slow(charset, m, sp, rest, ssub, esub) != NULL) { + dp = dissect(charset, m, sp, rest, ssub, esub); + assert(dp == rest); + } else /* no */ + assert(sp == rest); + sp = rest; + break; + case OPLUS_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(charset, m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(charset, m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = es - 1; + ssp = sp; + oldssp = ssp; + for (;;) { /* find last match of innards */ + sep = slow(charset, m, ssp, rest, ssub, esub); + if (sep == NULL || sep == ssp) + break; /* failed or matched null */ + oldssp = ssp; /* on to next try */ + ssp = sep; + } + if (sep == NULL) { + /* last successful match */ + sep = ssp; + ssp = oldssp; + } + assert(sep == rest); /* must exhaust substring */ + assert(slow(charset, m, ssp, sep, ssub, esub) == rest); + dp = dissect(charset, m, ssp, sep, ssub, esub); + assert(dp == sep); + sp = rest; + break; + case OCH_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(charset, m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(charset, m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = ss + OPND(m->g->strip[ss]) - 1; + assert(OP(m->g->strip[esub]) == OOR1); + for (;;) { /* find first matching branch */ + if (slow(charset, m, sp, rest, ssub, esub) == rest) + break; /* it matched all of it */ + /* that one missed, try next one */ + assert(OP(m->g->strip[esub]) == OOR1); + esub++; + assert(OP(m->g->strip[esub]) == OOR2); + ssub = esub + 1; + esub += OPND(m->g->strip[esub]); + if (OP(m->g->strip[esub]) == OOR2) + esub--; + else + assert(OP(m->g->strip[esub]) == O_CH); + } + dp = dissect(charset, m, sp, rest, ssub, esub); + assert(dp == rest); + sp = rest; + break; + case O_PLUS: + case O_QUEST: + case OOR1: + case OOR2: + case O_CH: + assert(nope); + break; + case OLPAREN: + i = OPND(m->g->strip[ss]); + assert(0 < i && i <= m->g->nsub); + m->pmatch[i].rm_so = sp - m->offp; + break; + case ORPAREN: + i = OPND(m->g->strip[ss]); + assert(0 < i && i <= m->g->nsub); + m->pmatch[i].rm_eo = sp - m->offp; + break; + default: /* uh oh */ + assert(nope); + break; + } + } + + assert(sp == stop); + return(sp); +} + +/* + - backref - figure out what matched what, figuring in back references + == static char *backref(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst, sopno lev); + */ +static char * /* == stop (success) or NULL (failure) */ +backref(charset,m, start, stop, startst, stopst, lev) +CHARSET_INFO *charset; +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +sopno lev; /* PLUS nesting level */ +{ + register uint i; + register sopno ss; /* start sop of current subRE */ + register char *sp; /* start of string matched by it */ + register sopno ssub; /* start sop of subsubRE */ + register sopno esub; /* end sop of subsubRE */ + register char *ssp; /* start of string matched by subsubRE */ + register char *dp; + register size_t len; + register int hard; + register sop s; + register regoff_t offsave; + register cset *cs; + + AT("back", start, stop, startst, stopst); + sp = start; + + /* get as far as we can with easy stuff */ + hard = 0; + for (ss = startst; !hard && ss < stopst; ss++) + switch (OP(s = m->g->strip[ss])) { + case OCHAR: + if (sp == stop || *sp++ != (char)OPND(s)) + return(NULL); + break; + case OANY: + if (sp == stop) + return(NULL); + sp++; + break; + case OANYOF: + cs = &m->g->sets[OPND(s)]; + if (sp == stop || !CHIN(cs, *sp++)) + return(NULL); + break; + case OBOL: + if ( (sp == m->beginp && !(m->eflags®_NOTBOL)) || + (sp < m->endp && *(sp-1) == '\n' && + (m->g->cflags®_NEWLINE)) ) + { /* yes */ } + else + return(NULL); + break; + case OEOL: + if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || + (sp < m->endp && *sp == '\n' && + (m->g->cflags®_NEWLINE)) ) + { /* yes */ } + else + return(NULL); + break; + case OBOW: + if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || + (sp < m->endp && *(sp-1) == '\n' && + (m->g->cflags®_NEWLINE)) || + (sp > m->beginp && + !ISWORD(charset,*(sp-1))) ) && + (sp < m->endp && ISWORD(charset,*sp)) ) + { /* yes */ } + else + return(NULL); + break; + case OEOW: + if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || + (sp < m->endp && *sp == '\n' && + (m->g->cflags®_NEWLINE)) || + (sp < m->endp && !ISWORD(charset,*sp)) ) && + (sp > m->beginp && ISWORD(charset,*(sp-1))) ) + { /* yes */ } + else + return(NULL); + break; + case O_QUEST: + break; + case OOR1: /* matches null but needs to skip */ + ss++; + s = m->g->strip[ss]; + do { + assert(OP(s) == OOR2); + ss += OPND(s); + } while (OP(s = m->g->strip[ss]) != O_CH); + /* note that the ss++ gets us past the O_CH */ + break; + default: /* have to make a choice */ + hard = 1; + break; + } + if (!hard) { /* that was it! */ + if (sp != stop) + return(NULL); + return(sp); + } + ss--; /* adjust for the for's final increment */ + + /* the hard stuff */ + AT("hard", sp, stop, ss, stopst); + s = m->g->strip[ss]; + switch (OP(s)) { + case OBACK_: /* the vilest depths */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + if (m->pmatch[i].rm_eo == -1) + return(NULL); + assert(m->pmatch[i].rm_so != -1); + len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so; + assert((size_t) (stop - m->beginp) >= len); + if (sp > stop - len) + return(NULL); /* not enough left to match */ + ssp = m->offp + m->pmatch[i].rm_so; + if (memcmp(sp, ssp, len) != 0) + return(NULL); + while (m->g->strip[ss] != SOP(O_BACK, i)) + ss++; + return(backref(charset, m, sp+len, stop, ss+1, stopst, lev)); + break; + case OQUEST_: /* to null or not */ + dp = backref(charset, m, sp, stop, ss+1, stopst, lev); + if (dp != NULL) + return(dp); /* not */ + return(backref(charset, m, sp, stop, ss+OPND(s)+1, stopst, lev)); + break; + case OPLUS_: + assert(m->lastpos != NULL); + assert(lev+1 <= m->g->nplus); + m->lastpos[lev+1] = sp; + return(backref(charset, m, sp, stop, ss+1, stopst, lev+1)); + break; + case O_PLUS: + if (sp == m->lastpos[lev]) /* last pass matched null */ + return(backref(charset, m, sp, stop, ss+1, stopst, lev-1)); + /* try another pass */ + m->lastpos[lev] = sp; + dp = backref(charset, m, sp, stop, ss-OPND(s)+1, stopst, lev); + if (dp == NULL) + return(backref(charset, m, sp, stop, ss+1, stopst, lev-1)); + else + return(dp); + break; + case OCH_: /* find the right one, if any */ + ssub = ss + 1; + esub = ss + OPND(s) - 1; + assert(OP(m->g->strip[esub]) == OOR1); + for (;;) { /* find first matching branch */ + dp = backref(charset, m, sp, stop, ssub, esub, lev); + if (dp != NULL) + return(dp); + /* that one missed, try next one */ + if (OP(m->g->strip[esub]) == O_CH) + return(NULL); /* there is none */ + esub++; + assert(OP(m->g->strip[esub]) == OOR2); + ssub = esub + 1; + esub += OPND(m->g->strip[esub]); + if (OP(m->g->strip[esub]) == OOR2) + esub--; + else + assert(OP(m->g->strip[esub]) == O_CH); + } + break; + case OLPAREN: /* must undo assignment if rest fails */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + offsave = m->pmatch[i].rm_so; + m->pmatch[i].rm_so = sp - m->offp; + dp = backref(charset, m, sp, stop, ss+1, stopst, lev); + if (dp != NULL) + return(dp); + m->pmatch[i].rm_so = offsave; + return(NULL); + break; + case ORPAREN: /* must undo assignment if rest fails */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + offsave = m->pmatch[i].rm_eo; + m->pmatch[i].rm_eo = sp - m->offp; + dp = backref(charset, m, sp, stop, ss+1, stopst, lev); + if (dp != NULL) + return(dp); + m->pmatch[i].rm_eo = offsave; + return(NULL); + break; + default: /* uh oh */ + assert(nope); + break; + } + + /* "can't happen" */ + assert(nope); + /* NOTREACHED */ + return 0; /* Keep gcc happy */ +} + +/* + - fast - step through the string at top speed + == static char *fast(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst); + */ +static char * /* where tentative match ended, or NULL */ +fast(charset, m, start, stop, startst, stopst) +CHARSET_INFO *charset; +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + register states st = m->st; + register states fresh = m->fresh; + register states tmp = m->tmp; + register char *p = start; + register int c = (start == m->beginp) ? OUT : *(start-1); + register int lastc; /* previous c */ + register int flagch; + register int i; + register char *coldp; /* last p after which no match was underway */ + + CLEAR(st); + SET1(st, startst); + st = step(m->g, startst, stopst, st, NOTHING, st); + ASSIGN(fresh, st); + SP("start", st, *p); + coldp = NULL; + for (;;) { + /* next character */ + lastc = c; + c = (p == m->endp) ? OUT : *p; + if (EQ(st, fresh)) + coldp = p; + + /* is there an EOL and/or BOL between lastc and c? */ + flagch = '\0'; + i = 0; + if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + flagch = BOL; + i = m->g->nbol; + } + if ( (c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL)) ) { + flagch = (flagch == BOL) ? BOLEOL : EOL; + i += m->g->neol; + } + if (i != 0) { + for (; i > 0; i--) + st = step(m->g, startst, stopst, st, flagch, st); + SP("boleol", st, c); + } + + /* how about a word boundary? */ + if ( (flagch == BOL || (lastc != OUT && !ISWORD(charset,lastc))) && + (c != OUT && ISWORD(charset,c)) ) { + flagch = BOW; + } + if ( (lastc != OUT && ISWORD(charset,lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(charset,c))) ) { + flagch = EOW; + } + if (flagch == BOW || flagch == EOW) { + st = step(m->g, startst, stopst, st, flagch, st); + SP("boweow", st, c); + } + + /* are we done? */ + if (ISSET(st, stopst) || p == stop) + break; /* NOTE BREAK OUT */ + + /* no, we must deal with this character */ + ASSIGN(tmp, st); + ASSIGN(st, fresh); + assert(c != OUT); + st = step(m->g, startst, stopst, tmp, c, st); + SP("aft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p++; + } + + assert(coldp != NULL); + m->coldp = coldp; + if (ISSET(st, stopst)) + return(p+1); + else + return(NULL); +} + +/* + - slow - step through the string more deliberately + == static char *slow(register struct match *m, char *start, \ + == char *stop, sopno startst, sopno stopst); + */ +static char * /* where it ended */ +slow(charset, m, start, stop, startst, stopst) +CHARSET_INFO *charset; +register struct match *m; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + register states st = m->st; + register states empty = m->empty; + register states tmp = m->tmp; + register char *p = start; + register int c = (start == m->beginp) ? OUT : *(start-1); + register int lastc; /* previous c */ + register int flagch; + register int i; + register char *matchp; /* last p at which a match ended */ + + AT("slow", start, stop, startst, stopst); + CLEAR(st); + SET1(st, startst); + SP("sstart", st, *p); + st = step(m->g, startst, stopst, st, NOTHING, st); + matchp = NULL; + for (;;) { + /* next character */ + lastc = c; + c = (p == m->endp) ? OUT : *p; + + /* is there an EOL and/or BOL between lastc and c? */ + flagch = '\0'; + i = 0; + if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + flagch = BOL; + i = m->g->nbol; + } + if ( (c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL)) ) { + flagch = (flagch == BOL) ? BOLEOL : EOL; + i += m->g->neol; + } + if (i != 0) { + for (; i > 0; i--) + st = step(m->g, startst, stopst, st, flagch, st); + SP("sboleol", st, c); + } + + /* how about a word boundary? */ + if ( (flagch == BOL || (lastc != OUT && !ISWORD(charset,lastc))) && + (c != OUT && ISWORD(charset,c)) ) { + flagch = BOW; + } + if ( (lastc != OUT && ISWORD(charset,lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(charset,c))) ) { + flagch = EOW; + } + if (flagch == BOW || flagch == EOW) { + st = step(m->g, startst, stopst, st, flagch, st); + SP("sboweow", st, c); + } + + /* are we done? */ + if (ISSET(st, stopst)) + matchp = p; + if (EQ(st, empty) || p == stop) + break; /* NOTE BREAK OUT */ + + /* no, we must deal with this character */ + ASSIGN(tmp, st); + ASSIGN(st, empty); + assert(c != OUT); + st = step(m->g, startst, stopst, tmp, c, st); + SP("saft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p++; + } + + return(matchp); +} + + +/* + - step - map set of states reachable before char to set reachable after + == static states step(register struct re_guts *g, sopno start, sopno stop, \ + == register states bef, int ch, register states aft); + == #define BOL (OUT+1) + == #define EOL (BOL+1) + == #define BOLEOL (BOL+2) + == #define NOTHING (BOL+3) + == #define BOW (BOL+4) + == #define EOW (BOL+5) + == #define CODEMAX (BOL+5) // highest code used + == #define NONCHAR(c) ((c) > CHAR_MAX) + == #define NNONCHAR (CODEMAX-CHAR_MAX) + */ +static states +step(g, start, stop, bef, ch, aft) +register struct re_guts *g; +sopno start; /* start state within strip */ +sopno stop; /* state after stop state within strip */ +register states bef; /* states reachable before */ +int ch; /* character or NONCHAR code */ +register states aft; /* states already known reachable after */ +{ + register cset *cs; + register sop s; + register sopno pc; + register onestate here; /* note, macros know this name */ + register sopno look; + register onestate i; /* Changed from int by Monty */ + + for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) { + s = g->strip[pc]; + switch (OP(s)) { + case OEND: + assert(pc == stop-1); + break; + case OCHAR: + /* only characters can match */ + assert(!NONCHAR(ch) || ch != (char)OPND(s)); + if (ch == (char)OPND(s)) + FWD(aft, bef, 1); + break; + case OBOL: + if (ch == BOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OEOL: + if (ch == EOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OBOW: + if (ch == BOW) + FWD(aft, bef, 1); + break; + case OEOW: + if (ch == EOW) + FWD(aft, bef, 1); + break; + case OANY: + if (!NONCHAR(ch)) + FWD(aft, bef, 1); + break; + case OANYOF: + cs = &g->sets[OPND(s)]; + if (!NONCHAR(ch) && CHIN(cs, ch)) + FWD(aft, bef, 1); + break; + case OBACK_: /* ignored here */ + case O_BACK: + FWD(aft, aft, 1); + break; + case OPLUS_: /* forward, this is just an empty */ + FWD(aft, aft, 1); + break; + case O_PLUS: /* both forward and back */ + FWD(aft, aft, 1); + i = ISSETBACK(aft, OPND(s)); + BACK(aft, aft, OPND(s)); + if (!i && ISSETBACK(aft, OPND(s))) { + /* oho, must reconsider loop body */ + pc -= OPND(s) + 1; + INIT(here, pc); + } + break; + case OQUEST_: /* two branches, both forward */ + FWD(aft, aft, 1); + FWD(aft, aft, OPND(s)); + break; + case O_QUEST: /* just an empty */ + FWD(aft, aft, 1); + break; + case OLPAREN: /* not significant here */ + case ORPAREN: + FWD(aft, aft, 1); + break; + case OCH_: /* mark the first two branches */ + FWD(aft, aft, 1); + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + break; + case OOR1: /* done a branch, find the O_CH */ + if (ISSTATEIN(aft, here)) { + for (look = 1; + OP(s = g->strip[pc+look]) != O_CH; + look += OPND(s)) + assert(OP(s) == OOR2); + FWD(aft, aft, look); + } + break; + case OOR2: /* propagate OCH_'s marking */ + FWD(aft, aft, 1); + if (OP(g->strip[pc+OPND(s)]) != O_CH) { + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + } + break; + case O_CH: /* just empty */ + FWD(aft, aft, 1); + break; + default: /* ooooops... */ + assert(nope); + break; + } + } + + return(aft); +} + +#ifdef REDEBUG +/* + - print - print a set of states + == #ifdef REDEBUG + == static void print(struct match *m, char *caption, states st, \ + == int ch, FILE *d); + == #endif + */ +static void +print(m, caption, st, ch, d) +struct match *m; +char *caption; +states st; +int ch; +FILE *d; +{ + register struct re_guts *g = m->g; + register int i; + register int first = 1; + char buf[10]; + + if (!(m->eflags®_TRACE)) + return; + + fprintf(d, "%s", caption); + if (ch != '\0') + fprintf(d, " %s", printchar(ch,buf)); + for (i = 0; i < g->nstates; i++) + if (ISSET(st, i)) { + fprintf(d, "%s%d", (first) ? "\t" : ", ", i); + first = 0; + } + fprintf(d, "\n"); +} + +/* + - at - print current situation + == #ifdef REDEBUG + == static void at(struct match *m, char *title, char *start, char *stop, \ + == sopno startst, sopno stopst); + == #endif + */ +static void +at(m, title, start, stop, startst, stopst) +struct match *m; +char *title; +char *start; +char *stop; +sopno startst; +sopno stopst; +{ + char buf[10]; + if (!(m->eflags®_TRACE)) + return; + + printf("%s %s-", title, printchar(*start,buf)); + printf("%s ", printchar(*stop,buf)); + printf("%ld-%ld\n", (long)startst, (long)stopst,buf); +} + +#ifndef PCHARDONE +#define PCHARDONE /* never again */ +/* + - printchar - make a character printable + == #ifdef REDEBUG + == static char *printchar(int ch); + == #endif + * + * Is this identical to regchar() over in debug.c? Well, yes. But a + * duplicate here avoids having a debugging-capable regexec.o tied to + * a matching debug.o, and this is convenient. It all disappears in + * the non-debug compilation anyway, so it doesn't matter much. + */ +static char * /* -> representation */ +printchar(ch,pbuf) +int ch; +char *pbuf; +{ + if (isprint(ch) || ch == ' ') + sprintf(pbuf, "%c", ch); + else + sprintf(pbuf, "\\%o", ch); + return(pbuf); +} +#endif +#endif + +#undef matcher +#undef fast +#undef slow +#undef dissect +#undef backref +#undef step +#undef print +#undef at +#undef match diff --git a/externals/mysql/extlib/regex/main.c b/externals/mysql/extlib/regex/main.c new file mode 100644 index 0000000..fa97ca8 --- /dev/null +++ b/externals/mysql/extlib/regex/main.c @@ -0,0 +1,509 @@ +#include +#include +#include +#include + +#include "my_regex.h" +#include "main.ih" + +char *progname; +int debug = 0; +int line = 0; +int status = 0; + +int copts = REG_EXTENDED; +int eopts = 0; +regoff_t startoff = 0; +regoff_t endoff = 0; + + +extern int split(); +extern void regprint(); + +/* + - main - do the simple case, hand off to regress() for regression + */ +int main(argc, argv) +int argc; +char *argv[]; +{ + my_regex_t re; +# define NS 10 + my_regmatch_t subs[NS]; + char erbuf[100]; + int err; + size_t len; + int c; + int errflg = 0; + register int i; + extern int optind; + extern char *optarg; + + progname = argv[0]; + + while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF) + switch (c) { + case 'c': /* compile options */ + copts = options('c', optarg); + break; + case 'e': /* execute options */ + eopts = options('e', optarg); + break; + case 'S': /* start offset */ + startoff = (regoff_t)atoi(optarg); + break; + case 'E': /* end offset */ + endoff = (regoff_t)atoi(optarg); + break; + case 'x': /* Debugging. */ + debug++; + break; + case '?': + default: + errflg++; + break; + } + if (errflg) { + fprintf(stderr, "usage: %s ", progname); + fprintf(stderr, "[-c copt][-C][-d] [re]\n"); + exit(2); + } + + if (optind >= argc) { + regress(stdin); + exit(status); + } + + err = my_regcomp(&re, argv[optind++], copts, &my_charset_latin1); + if (err) { + len = my_regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "error %s, %d/%d `%s'\n", + eprint(err), (int) len, (int) sizeof(erbuf), erbuf); + exit(status); + } + regprint(&re, stdout); + + if (optind >= argc) { + my_regfree(&re); + exit(status); + } + + if (eopts®_STARTEND) { + subs[0].rm_so = startoff; + subs[0].rm_eo = strlen(argv[optind]) - endoff; + } + err = my_regexec(&re, argv[optind], (size_t)NS, subs, eopts); + if (err) { + len = my_regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "error %s, %d/%d `%s'\n", + eprint(err), (int) len, (int) sizeof(erbuf), erbuf); + exit(status); + } + if (!(copts®_NOSUB)) { + len = (int)(subs[0].rm_eo - subs[0].rm_so); + if (subs[0].rm_so != -1) { + if (len != 0) + printf("match `%.*s'\n", (int)len, + argv[optind] + subs[0].rm_so); + else + printf("match `'@%.1s\n", + argv[optind] + subs[0].rm_so); + } + for (i = 1; i < NS; i++) + if (subs[i].rm_so != -1) + printf("(%d) `%.*s'\n", i, + (int)(subs[i].rm_eo - subs[i].rm_so), + argv[optind] + subs[i].rm_so); + } + exit(status); +} + +/* + - regress - main loop of regression test + == void regress(FILE *in); + */ +void +regress(in) +FILE *in; +{ + char inbuf[1000]; +# define MAXF 10 + char *f[MAXF]; + int nf; + int i; + char erbuf[100]; + size_t ne; + const char *badpat = "invalid regular expression"; +# define SHORT 10 + const char *bpname = "REG_BADPAT"; + my_regex_t re; + + while (fgets(inbuf, sizeof(inbuf), in) != NULL) { + line++; + if (inbuf[0] == '#' || inbuf[0] == '\n') + continue; /* NOTE CONTINUE */ + inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */ + if (debug) + fprintf(stdout, "%d:\n", line); + nf = split(inbuf, f, MAXF, "\t\t"); + if (nf < 3) { + fprintf(stderr, "bad input, line %d\n", line); + exit(1); + } + for (i = 0; i < nf; i++) + if (strcmp(f[i], "\"\"") == 0) + f[i] = (char*) ""; + if (nf <= 3) + f[3] = NULL; + if (nf <= 4) + f[4] = NULL; + rx_try(f[0], f[1], f[2], f[3], f[4], options('c', f[1])); + if (opt('&', f[1])) /* try with either type of RE */ + rx_try(f[0], f[1], f[2], f[3], f[4], + options('c', f[1]) &~ REG_EXTENDED); + } + + ne = my_regerror(REG_BADPAT, (my_regex_t *)NULL, erbuf, sizeof(erbuf)); + if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) { + fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n", + erbuf, badpat); + status = 1; + } + ne = my_regerror(REG_BADPAT, (my_regex_t *)NULL, erbuf, (size_t)SHORT); + if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' || + ne != strlen(badpat)+1) { + fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n", + erbuf, SHORT-1, badpat); + status = 1; + } + ne = my_regerror(REG_ITOA|REG_BADPAT, (my_regex_t *)NULL, erbuf, sizeof(erbuf)); + if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) { + fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n", + erbuf, bpname); + status = 1; + } + re.re_endp = bpname; + ne = my_regerror(REG_ATOI, &re, erbuf, sizeof(erbuf)); + if (atoi(erbuf) != (int)REG_BADPAT) { + fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n", + erbuf, (long)REG_BADPAT); + status = 1; + } else if (ne != strlen(erbuf)+1) { + fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n", + erbuf, (long)REG_BADPAT); + status = 1; + } +} + +/* + - rx_try - try it, and report on problems + == void rx_try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts); + */ +void +rx_try(f0, f1, f2, f3, f4, opts) +char *f0; +char *f1; +char *f2; +char *f3; +char *f4; +int opts; /* may not match f1 */ +{ + my_regex_t re; +# define NSUBS 10 + my_regmatch_t subs[NSUBS]; +# define NSHOULD 15 + char *should[NSHOULD]; + int nshould; + char erbuf[100]; + int err; + int len; + const char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE"; + register int i; + char *grump; + char f0copy[1000]; + char f2copy[1000]; + + strcpy(f0copy, f0); + re.re_endp = (opts®_PEND) ? f0copy + strlen(f0copy) : NULL; + fixstr(f0copy); + err = my_regcomp(&re, f0copy, opts, &my_charset_latin1); + if (err != 0 && (!opt('C', f1) || err != efind(f2))) { + /* unexpected error or wrong error */ + len = my_regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n", + line, type, eprint(err), len, + (int) sizeof(erbuf), erbuf); + status = 1; + } else if (err == 0 && opt('C', f1)) { + /* unexpected success */ + fprintf(stderr, "%d: %s should have given REG_%s\n", + line, type, f2); + status = 1; + err = 1; /* so we won't try regexec */ + } + + if (err != 0) { + my_regfree(&re); + return; + } + + strcpy(f2copy, f2); + fixstr(f2copy); + + if (options('e', f1)®_STARTEND) { + if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL) + fprintf(stderr, "%d: bad STARTEND syntax\n", line); + subs[0].rm_so = strchr(f2, '(') - f2 + 1; + subs[0].rm_eo = strchr(f2, ')') - f2; + } + err = my_regexec(&re, f2copy, NSUBS, subs, options('e', f1)); + + if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) { + /* unexpected error or wrong error */ + len = my_regerror(err, &re, erbuf, sizeof(erbuf)); + fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n", + line, type, eprint(err), len, + (int) sizeof(erbuf), erbuf); + status = 1; + } else if (err != 0) { + /* nothing more to check */ + } else if (f3 == NULL) { + /* unexpected success */ + fprintf(stderr, "%d: %s exec should have failed\n", + line, type); + status = 1; + err = 1; /* just on principle */ + } else if (opts®_NOSUB) { + /* nothing more to check */ + } else if ((grump = check(f2, subs[0], f3)) != NULL) { + fprintf(stderr, "%d: %s %s\n", line, type, grump); + status = 1; + err = 1; + } + + if (err != 0 || f4 == NULL) { + my_regfree(&re); + return; + } + + for (i = 1; i < NSHOULD; i++) + should[i] = NULL; + nshould = split(f4, should+1, NSHOULD-1, ","); + if (nshould == 0) { + nshould = 1; + should[1] = (char*) ""; + } + for (i = 1; i < NSUBS; i++) { + grump = check(f2, subs[i], should[i]); + if (grump != NULL) { + fprintf(stderr, "%d: %s $%d %s\n", line, + type, i, grump); + status = 1; + err = 1; + } + } + + my_regfree(&re); +} + +/* + - options - pick options out of a regression-test string + == int options(int type, char *s); + */ +int +options(type, s) +int type; /* 'c' compile, 'e' exec */ +char *s; +{ + register char *p; + register int o = (type == 'c') ? copts : eopts; + register const char *legal = (type == 'c') ? "bisnmp" : "^$#tl"; + + for (p = s; *p != '\0'; p++) + if (strchr(legal, *p) != NULL) + switch (*p) { + case 'b': + o &= ~REG_EXTENDED; + break; + case 'i': + o |= REG_ICASE; + break; + case 's': + o |= REG_NOSUB; + break; + case 'n': + o |= REG_NEWLINE; + break; + case 'm': + o &= ~REG_EXTENDED; + o |= REG_NOSPEC; + break; + case 'p': + o |= REG_PEND; + break; + case '^': + o |= REG_NOTBOL; + break; + case '$': + o |= REG_NOTEOL; + break; + case '#': + o |= REG_STARTEND; + break; + case 't': /* trace */ + o |= REG_TRACE; + break; + case 'l': /* force long representation */ + o |= REG_LARGE; + break; + case 'r': /* force backref use */ + o |= REG_BACKR; + break; + } + return(o); +} + +/* + - opt - is a particular option in a regression string? + == int opt(int c, char *s); + */ +int /* predicate */ +opt(c, s) +int c; +char *s; +{ + return(strchr(s, c) != NULL); +} + +/* + - fixstr - transform magic characters in strings + == void fixstr(register char *p); + */ +void +fixstr(p) +register char *p; +{ + if (p == NULL) + return; + + for (; *p != '\0'; p++) + if (*p == 'N') + *p = '\n'; + else if (*p == 'T') + *p = '\t'; + else if (*p == 'S') + *p = ' '; + else if (*p == 'Z') + *p = '\0'; +} + +/* + - check - check a substring match + == char *check(char *str, regmatch_t sub, char *should); + */ +char * /* NULL or complaint */ +check(str, sub, should) +char *str; +my_regmatch_t sub; +char *should; +{ + register int len; + register int shlen; + register char *p; + static char grump[500]; + register char *at = NULL; + + if (should != NULL && strcmp(should, "-") == 0) + should = NULL; + if (should != NULL && should[0] == '@') { + at = should + 1; + should = (char*) ""; + } + + /* check rm_so and rm_eo for consistency */ + if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) || + (sub.rm_so != -1 && sub.rm_eo == -1) || + (sub.rm_so != -1 && sub.rm_so < 0) || + (sub.rm_eo != -1 && sub.rm_eo < 0) ) { + sprintf(grump, "start %ld end %ld", (long)sub.rm_so, + (long)sub.rm_eo); + return(grump); + } + + /* check for no match */ + if (sub.rm_so == -1 && should == NULL) + return(NULL); + if (sub.rm_so == -1) + return((char*) "did not match"); + + /* check for in range */ + if ((int) sub.rm_eo > (int) strlen(str)) { + sprintf(grump, "start %ld end %ld, past end of string", + (long)sub.rm_so, (long)sub.rm_eo); + return(grump); + } + + len = (int)(sub.rm_eo - sub.rm_so); + shlen = (int)strlen(should); + p = str + sub.rm_so; + + /* check for not supposed to match */ + if (should == NULL) { + sprintf(grump, "matched `%.*s'", len, p); + return(grump); + } + + /* check for wrong match */ + if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) { + sprintf(grump, "matched `%.*s' instead", len, p); + return(grump); + } + if (shlen > 0) + return(NULL); + + /* check null match in right place */ + if (at == NULL) + return(NULL); + shlen = strlen(at); + if (shlen == 0) + shlen = 1; /* force check for end-of-string */ + if (strncmp(p, at, shlen) != 0) { + sprintf(grump, "matched null at `%.20s'", p); + return(grump); + } + return(NULL); +} + +/* + - eprint - convert error number to name + == static char *eprint(int err); + */ +static char * +eprint(err) +int err; +{ + static char epbuf[100]; + size_t len; + + len = my_regerror(REG_ITOA|err, (my_regex_t *)NULL, epbuf, sizeof(epbuf)); + assert(len <= sizeof(epbuf)); + return(epbuf); +} + +/* + - efind - convert error name to number + == static int efind(char *name); + */ +static int +efind(name) +char *name; +{ + static char efbuf[100]; + my_regex_t re; + + sprintf(efbuf, "REG_%s", name); + assert(strlen(efbuf) < sizeof(efbuf)); + re.re_endp = efbuf; + (void) my_regerror(REG_ATOI, &re, efbuf, sizeof(efbuf)); + return(atoi(efbuf)); +} diff --git a/externals/mysql/extlib/regex/my_regex.h b/externals/mysql/extlib/regex/my_regex.h new file mode 100644 index 0000000..0d1cedf --- /dev/null +++ b/externals/mysql/extlib/regex/my_regex.h @@ -0,0 +1,86 @@ +#ifndef _REGEX_H_ +#define _REGEX_H_ /* never again */ +/* ========= begin header generated by ./mkh ========= */ +#ifdef __cplusplus +extern "C" { +#endif + +#include "m_ctype.h" + +/* === regex2.h === */ +#ifdef _WIN64 +typedef __int64 regoff_t; +#else +typedef off_t regoff_t; +#endif +struct re_guts; /* none of your business :-) */ +typedef struct { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ + CHARSET_INFO *charset; /* For ctype things */ +} my_regex_t; +typedef struct { + regoff_t rm_so; /* start of match */ + regoff_t rm_eo; /* end of match */ +} my_regmatch_t; + + +/* === regcomp.c === */ +extern int my_regcomp(my_regex_t *, const char *, int, CHARSET_INFO *charset); +#define REG_BASIC 0000 +#define REG_EXTENDED 0001 +#define REG_ICASE 0002 +#define REG_NOSUB 0004 +#define REG_NEWLINE 0010 +#define REG_NOSPEC 0020 +#define REG_PEND 0040 +#define REG_DUMP 0200 + + +/* === regerror.c === */ +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 +#define REG_EMPTY 14 +#define REG_ASSERT 15 +#define REG_INVARG 16 +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ +extern size_t my_regerror(int, const my_regex_t *, char *, size_t); + + +/* === regexec.c === */ +extern int my_regexec(const my_regex_t *, const char *, size_t, my_regmatch_t [], int); +#define REG_NOTBOL 00001 +#define REG_NOTEOL 00002 +#define REG_STARTEND 00004 +#define REG_TRACE 00400 /* tracing of execution */ +#define REG_LARGE 01000 /* force large representation */ +#define REG_BACKR 02000 /* force use of backref code */ + + +/* === regfree.c === */ +extern void my_regfree(my_regex_t *); + +/* === reginit.c === */ + +extern void my_regex_init(CHARSET_INFO *cs); /* Should be called for multithread progs */ +extern void my_regex_end(void); /* If one wants a clean end */ + +#ifdef __cplusplus +} +#endif +/* ========= end header generated by ./mkh ========= */ +#endif diff --git a/externals/mysql/extlib/regex/regcomp.c b/externals/mysql/extlib/regex/regcomp.c new file mode 100644 index 0000000..398e132 --- /dev/null +++ b/externals/mysql/extlib/regex/regcomp.c @@ -0,0 +1,1672 @@ +#include +#include +#include +#ifdef __WIN__ +#include +#endif + +#include "my_regex.h" +#include "utils.h" +#include "regex2.h" + +#include "cclass.h" +#include "cname.h" + +/* + * parse structure, passed up and down to avoid global variables and + * other clumsinesses + */ +struct parse { + char *next; /* next character in RE */ + char *end; /* end of string (-> NUL normally) */ + int error; /* has an error been seen? */ + sop *strip; /* malloced strip */ + sopno ssize; /* malloced strip size (allocated) */ + sopno slen; /* malloced strip length (used) */ + int ncsalloc; /* number of csets allocated */ + struct re_guts *g; +# define NPAREN 10 /* we need to remember () 1-9 for back refs */ + sopno pbegin[NPAREN]; /* -> ( ([0] unused) */ + sopno pend[NPAREN]; /* -> ) ([0] unused) */ + CHARSET_INFO *charset; /* for ctype things */ +}; + +#include "regcomp.ih" + +static char nuls[10]; /* place to point scanner in event of error */ + +struct cclass cclasses[CCLASS_LAST+1]= { + { "alnum", "","", _MY_U | _MY_L | _MY_NMR}, + { "alpha", "","", _MY_U | _MY_L }, + { "blank", "","", _MY_B }, + { "cntrl", "","", _MY_CTR }, + { "digit", "","", _MY_NMR }, + { "graph", "","", _MY_PNT | _MY_U | _MY_L | _MY_NMR}, + { "lower", "","", _MY_L }, + { "print", "","", _MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B }, + { "punct", "","", _MY_PNT }, + { "space", "","", _MY_SPC }, + { "upper", "","", _MY_U }, + { "xdigit", "","", _MY_X }, + { NULL,NULL,NULL, 0 } +}; + +/* + * macros for use with parse structure + * BEWARE: these know that the parse structure is named `p' !!! + */ +#define PEEK() (*p->next) +#define PEEK2() (*(p->next+1)) +#define MORE() (p->next < p->end) +#define MORE2() (p->next+1 < p->end) +#define SEE(c) (MORE() && PEEK() == (c)) +#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b)) +#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) +#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) +#define NEXT() (p->next++) +#define NEXT2() (p->next += 2) +#define NEXTn(n) (p->next += (n)) +#define GETNEXT() (*p->next++) +#define SETERROR(e) seterr(p, (e)) +#define REQUIRE(co, e) ((co) || SETERROR(e)) +#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) +#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) +#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) +#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd)) +#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos) +#define AHEAD(pos) dofwd(p, pos, HERE()-(pos)) +#define ASTERN(sop, pos) EMIT(sop, HERE()-pos) +#define HERE() (p->slen) +#define THERE() (p->slen - 1) +#define THERETHERE() (p->slen - 2) +#define DROP(n) (p->slen -= (n)) + +#ifndef NDEBUG +static int never = 0; /* for use in asserts; shuts lint up */ +#else +#define never 0 /* some s have bugs too */ +#endif + +/* + - regcomp - interface for parser and compilation + = extern int regcomp(regex_t *, const char *, int); + = #define REG_BASIC 0000 + = #define REG_EXTENDED 0001 + = #define REG_ICASE 0002 + = #define REG_NOSUB 0004 + = #define REG_NEWLINE 0010 + = #define REG_NOSPEC 0020 + = #define REG_PEND 0040 + = #define REG_DUMP 0200 + */ +int /* 0 success, otherwise REG_something */ +my_regcomp(preg, pattern, cflags, charset) +my_regex_t *preg; +const char *pattern; +int cflags; +CHARSET_INFO *charset; +{ + struct parse pa; + register struct re_guts *g; + register struct parse *p = &pa; + register int i; + register size_t len; +#ifdef REDEBUG +# define GOODFLAGS(f) (f) +#else +# define GOODFLAGS(f) ((f)&~REG_DUMP) +#endif + + my_regex_init(charset); /* Init cclass if neaded */ + preg->charset=charset; + cflags = GOODFLAGS(cflags); + if ((cflags®_EXTENDED) && (cflags®_NOSPEC)) + return(REG_INVARG); + + if (cflags®_PEND) { + if (preg->re_endp < pattern) + return(REG_INVARG); + len = preg->re_endp - pattern; + } else + len = strlen((char *)pattern); + + /* do the mallocs early so failure handling is easy */ + g = (struct re_guts *)malloc(sizeof(struct re_guts) + + (NC-1)*sizeof(cat_t)); + if (g == NULL) + return(REG_ESPACE); + p->ssize = (long) (len/(size_t)2*(size_t)3 + (size_t)1); /* ugh */ + p->strip = (sop *)malloc(p->ssize * sizeof(sop)); + p->slen = 0; + if (p->strip == NULL) { + free((char *)g); + return(REG_ESPACE); + } + + /* set things up */ + p->g = g; + p->next = (char *)pattern; /* convenience; we do not modify it */ + p->end = p->next + len; + p->error = 0; + p->ncsalloc = 0; + p->charset = preg->charset; + for (i = 0; i < NPAREN; i++) { + p->pbegin[i] = 0; + p->pend[i] = 0; + } + g->csetsize = NC; + g->sets = NULL; + g->setbits = NULL; + g->ncsets = 0; + g->cflags = cflags; + g->iflags = 0; + g->nbol = 0; + g->neol = 0; + g->must = NULL; + g->mlen = 0; + g->nsub = 0; + g->ncategories = 1; /* category 0 is "everything else" */ + g->categories = &g->catspace[-(CHAR_MIN)]; + (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t)); + g->backrefs = 0; + + /* do it */ + EMIT(OEND, 0); + g->firststate = THERE(); + if (cflags®_EXTENDED) + p_ere(p, OUT); + else if (cflags®_NOSPEC) + p_str(p); + else + p_bre(p, OUT, OUT); + EMIT(OEND, 0); + g->laststate = THERE(); + + /* tidy up loose ends and fill things in */ + categorize(p, g); + stripsnug(p, g); + findmust(p, g); + g->nplus = pluscount(p, g); + g->magic = MAGIC2; + preg->re_nsub = g->nsub; + preg->re_g = g; + preg->re_magic = MAGIC1; +#ifndef REDEBUG + /* not debugging, so can't rely on the assert() in regexec() */ + if (g->iflags&BAD) + SETERROR(REG_ASSERT); +#endif + + /* win or lose, we're done */ + if (p->error != 0) /* lose */ + my_regfree(preg); + return(p->error); +} + +/* + - p_ere - ERE parser top level, concatenation and alternation + == static void p_ere(register struct parse *p, int stop); + */ +static void +p_ere(p, stop) +register struct parse *p; +int stop; /* character this ERE should end at */ +{ + register char c; + register sopno prevback; + register sopno prevfwd; + register sopno conc; + register int first = 1; /* is this the first alternative? */ + LINT_INIT(prevback); LINT_INIT(prevfwd); + for (;;) { + /* do a bunch of concatenated expressions */ + conc = HERE(); + while (MORE() && (c = PEEK()) != '|' && c != stop) + p_ere_exp(p); + if(REQUIRE(HERE() != conc, REG_EMPTY)) {}/* require nonempty */ + + if (!EAT('|')) + break; /* NOTE BREAK OUT */ + + if (first) { + INSERT(OCH_, conc); /* offset is wrong */ + prevfwd = conc; + prevback = conc; + first = 0; + } + ASTERN(OOR1, prevback); + prevback = THERE(); + AHEAD(prevfwd); /* fix previous offset */ + prevfwd = HERE(); + EMIT(OOR2, 0); /* offset is very wrong */ + } + + if (!first) { /* tail-end fixups */ + AHEAD(prevfwd); + ASTERN(O_CH, prevback); + } + + assert(!MORE() || SEE(stop)); +} + +/* + - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op + == static void p_ere_exp(register struct parse *p); + */ +static void +p_ere_exp(p) +register struct parse *p; +{ + register char c; + register sopno pos; + register int count; + register int count2; + register sopno subno; + int wascaret = 0; + + assert(MORE()); /* caller should have ensured this */ + c = GETNEXT(); + + pos = HERE(); + switch (c) { + case '(': + if(REQUIRE(MORE(), REG_EPAREN)) {} + p->g->nsub++; + subno = (sopno) p->g->nsub; + if (subno < NPAREN) + p->pbegin[subno] = HERE(); + EMIT(OLPAREN, subno); + if (!SEE(')')) + p_ere(p, ')'); + if (subno < NPAREN) { + p->pend[subno] = HERE(); + assert(p->pend[subno] != 0); + } + EMIT(ORPAREN, subno); + if(MUSTEAT(')', REG_EPAREN)) {} + break; +#ifndef POSIX_MISTAKE + case ')': /* happens only if no current unmatched ( */ + /* + * You may ask, why the ifndef? Because I didn't notice + * this until slightly too late for 1003.2, and none of the + * other 1003.2 regular-expression reviewers noticed it at + * all. So an unmatched ) is legal POSIX, at least until + * we can get it fixed. + */ + SETERROR(REG_EPAREN); + break; +#endif + case '^': + EMIT(OBOL, 0); + p->g->iflags |= USEBOL; + p->g->nbol++; + wascaret = 1; + break; + case '$': + EMIT(OEOL, 0); + p->g->iflags |= USEEOL; + p->g->neol++; + break; + case '|': + SETERROR(REG_EMPTY); + break; + case '*': + case '+': + case '?': + SETERROR(REG_BADRPT); + break; + case '.': + if (p->g->cflags®_NEWLINE) + nonnewline(p); + else + EMIT(OANY, 0); + break; + case '[': + p_bracket(p); + break; + case '\\': + if(REQUIRE(MORE(), REG_EESCAPE)) {} + c = GETNEXT(); + ordinary(p, c); + break; + case '{': /* okay as ordinary except if digit follows */ + if(REQUIRE(!MORE() || !my_isdigit(p->charset,PEEK()), REG_BADRPT)) {} + /* FALLTHROUGH */ + default: + ordinary(p, c); + break; + } + + if (!MORE()) + return; + c = PEEK(); + /* we call { a repetition if followed by a digit */ + if (!( c == '*' || c == '+' || c == '?' || + (c == '{' && MORE2() && + my_isdigit(p->charset,PEEK2())) )) + return; /* no repetition, we're done */ + NEXT(); + + if(REQUIRE(!wascaret, REG_BADRPT)) {} + switch (c) { + case '*': /* implemented as +? */ + /* this case does not require the (y|) trick, noKLUDGE */ + INSERT(OPLUS_, pos); + ASTERN(O_PLUS, pos); + INSERT(OQUEST_, pos); + ASTERN(O_QUEST, pos); + break; + case '+': + INSERT(OPLUS_, pos); + ASTERN(O_PLUS, pos); + break; + case '?': + /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ + INSERT(OCH_, pos); /* offset slightly wrong */ + ASTERN(OOR1, pos); /* this one's right */ + AHEAD(pos); /* fix the OCH_ */ + EMIT(OOR2, 0); /* offset very wrong... */ + AHEAD(THERE()); /* ...so fix it */ + ASTERN(O_CH, THERETHERE()); + break; + case '{': + count = p_count(p); + if (EAT(',')) { + if (my_isdigit(p->charset,PEEK())) { + count2 = p_count(p); + if(REQUIRE(count <= count2, REG_BADBR)) {} + } else /* single number with comma */ + count2 = RE_INFINITY; + } else /* just a single number */ + count2 = count; + repeat(p, pos, count, count2); + if (!EAT('}')) { /* error heuristics */ + while (MORE() && PEEK() != '}') + NEXT(); + if(REQUIRE(MORE(), REG_EBRACE)) {} + SETERROR(REG_BADBR); + } + break; + } + + if (!MORE()) + return; + c = PEEK(); + if (!( c == '*' || c == '+' || c == '?' || + (c == '{' && MORE2() && + my_isdigit(p->charset,PEEK2())) ) ) + return; + SETERROR(REG_BADRPT); +} + +/* + - p_str - string (no metacharacters) "parser" + == static void p_str(register struct parse *p); + */ +static void +p_str(p) +register struct parse *p; +{ + if(REQUIRE(MORE(), REG_EMPTY)) {} + while (MORE()) + ordinary(p, GETNEXT()); +} + +/* + - p_bre - BRE parser top level, anchoring and concatenation + == static void p_bre(register struct parse *p, register int end1, \ + == register int end2); + * Giving end1 as OUT essentially eliminates the end1/end2 check. + * + * This implementation is a bit of a kludge, in that a trailing $ is first + * taken as an ordinary character and then revised to be an anchor. The + * only undesirable side effect is that '$' gets included as a character + * category in such cases. This is fairly harmless; not worth fixing. + * The amount of lookahead needed to avoid this kludge is excessive. + */ +static void +p_bre(p, end1, end2) +register struct parse *p; +register int end1; /* first terminating character */ +register int end2; /* second terminating character */ +{ + register sopno start = HERE(); + register int first = 1; /* first subexpression? */ + register int wasdollar = 0; + + if (EAT('^')) { + EMIT(OBOL, 0); + p->g->iflags |= USEBOL; + p->g->nbol++; + } + while (MORE() && !SEETWO(end1, end2)) { + wasdollar = p_simp_re(p, first); + first = 0; + } + if (wasdollar) { /* oops, that was a trailing anchor */ + DROP(1); + EMIT(OEOL, 0); + p->g->iflags |= USEEOL; + p->g->neol++; + } + + if(REQUIRE(HERE() != start, REG_EMPTY)) {} /* require nonempty */ +} + +/* + - p_simp_re - parse a simple RE, an atom possibly followed by a repetition + == static int p_simp_re(register struct parse *p, int starordinary); + */ +static int /* was the simple RE an unbackslashed $? */ +p_simp_re(p, starordinary) +register struct parse *p; +int starordinary; /* is a leading * an ordinary character? */ +{ + register int c; + register int count; + register int count2; + register sopno pos; + register int i; + register sopno subno; +# define BACKSL (1<g->cflags®_NEWLINE) + nonnewline(p); + else + EMIT(OANY, 0); + break; + case '[': + p_bracket(p); + break; + case BACKSL|'{': + SETERROR(REG_BADRPT); + break; + case BACKSL|'(': + p->g->nsub++; + subno = (sopno) p->g->nsub; + if (subno < NPAREN) + p->pbegin[subno] = HERE(); + EMIT(OLPAREN, subno); + /* the MORE here is an error heuristic */ + if (MORE() && !SEETWO('\\', ')')) + p_bre(p, '\\', ')'); + if (subno < NPAREN) { + p->pend[subno] = HERE(); + assert(p->pend[subno] != 0); + } + EMIT(ORPAREN, subno); + if(REQUIRE(EATTWO('\\', ')'), REG_EPAREN)) {} + break; + case BACKSL|')': /* should not get here -- must be user */ + case BACKSL|'}': + SETERROR(REG_EPAREN); + break; + case BACKSL|'1': + case BACKSL|'2': + case BACKSL|'3': + case BACKSL|'4': + case BACKSL|'5': + case BACKSL|'6': + case BACKSL|'7': + case BACKSL|'8': + case BACKSL|'9': + i = (c&~BACKSL) - '0'; + assert(i < NPAREN); + if (p->pend[i] != 0) { + assert((uint) i <= p->g->nsub); + EMIT(OBACK_, i); + assert(p->pbegin[i] != 0); + assert(OP(p->strip[p->pbegin[i]]) == OLPAREN); + assert(OP(p->strip[p->pend[i]]) == ORPAREN); + (void) dupl(p, p->pbegin[i]+1, p->pend[i]); + EMIT(O_BACK, i); + } else + SETERROR(REG_ESUBREG); + p->g->backrefs = 1; + break; + case '*': + if(REQUIRE(starordinary, REG_BADRPT)) {} + /* FALLTHROUGH */ + default: + ordinary(p, c &~ BACKSL); + break; + } + + if (EAT('*')) { /* implemented as +? */ + /* this case does not require the (y|) trick, noKLUDGE */ + INSERT(OPLUS_, pos); + ASTERN(O_PLUS, pos); + INSERT(OQUEST_, pos); + ASTERN(O_QUEST, pos); + } else if (EATTWO('\\', '{')) { + count = p_count(p); + if (EAT(',')) { + if (MORE() && my_isdigit(p->charset,PEEK())) { + count2 = p_count(p); + if(REQUIRE(count <= count2, REG_BADBR)) {} + } else /* single number with comma */ + count2 = RE_INFINITY; + } else /* just a single number */ + count2 = count; + repeat(p, pos, count, count2); + if (!EATTWO('\\', '}')) { /* error heuristics */ + while (MORE() && !SEETWO('\\', '}')) + NEXT(); + if(REQUIRE(MORE(), REG_EBRACE)) {} + SETERROR(REG_BADBR); + } + } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */ + return(1); + + return(0); +} + +/* + - p_count - parse a repetition count + == static int p_count(register struct parse *p); + */ +static int /* the value */ +p_count(p) +register struct parse *p; +{ + register int count = 0; + register int ndigits = 0; + + while (MORE() && my_isdigit(p->charset,PEEK()) && count <= DUPMAX) { + count = count*10 + (GETNEXT() - '0'); + ndigits++; + } + + if(REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR)) {} + return(count); +} + +/* + - p_bracket - parse a bracketed character list + == static void p_bracket(register struct parse *p); + * + * Note a significant property of this code: if the allocset() did SETERROR, + * no set operations are done. + */ +static void +p_bracket(p) +register struct parse *p; +{ + register cset *cs = allocset(p); + register int invert = 0; + + /* Dept of Truly Sickening Special-Case Kludges */ + if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) { + EMIT(OBOW, 0); + NEXTn(6); + return; + } + if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) { + EMIT(OEOW, 0); + NEXTn(6); + return; + } + + if (EAT('^')) + invert++; /* make note to invert set at end */ + if (EAT(']')) + CHadd(cs, ']'); + else if (EAT('-')) + CHadd(cs, '-'); + while (MORE() && PEEK() != ']' && !SEETWO('-', ']')) + p_b_term(p, cs); + if (EAT('-')) + CHadd(cs, '-'); + if(MUSTEAT(']', REG_EBRACK)) {} + + if (p->error != 0) /* don't mess things up further */ + return; + + if (p->g->cflags®_ICASE) { + register int i; + register int ci; + + for (i = p->g->csetsize - 1; i >= 0; i--) + if (CHIN(cs, i) && my_isalpha(p->charset,i)) { + ci = othercase(p->charset,i); + if (ci != i) + CHadd(cs, ci); + } + if (cs->multis != NULL) + mccase(p, cs); + } + if (invert) { + register int i; + + for (i = p->g->csetsize - 1; i >= 0; i--) + if (CHIN(cs, i)) + CHsub(cs, i); + else + CHadd(cs, i); + if (p->g->cflags®_NEWLINE) + CHsub(cs, '\n'); + if (cs->multis != NULL) + mcinvert(p, cs); + } + + assert(cs->multis == NULL); /* xxx */ + + if (nch(p, cs) == 1) { /* optimize singleton sets */ + ordinary(p, firstch(p, cs)); + freeset(p, cs); + } else + EMIT(OANYOF, freezeset(p, cs)); +} + +/* + - p_b_term - parse one term of a bracketed character list + == static void p_b_term(register struct parse *p, register cset *cs); + */ +static void +p_b_term(p, cs) +register struct parse *p; +register cset *cs; +{ + register char c; + register char start, finish; + register int i; + + /* classify what we've got */ + switch ((MORE()) ? PEEK() : '\0') { + case '[': + c = (MORE2()) ? PEEK2() : '\0'; + break; + case '-': + SETERROR(REG_ERANGE); + return; /* NOTE RETURN */ + break; + default: + c = '\0'; + break; + } + + switch (c) { + case ':': /* character class */ + NEXT2(); + if(REQUIRE(MORE(), REG_EBRACK)) {} + c = PEEK(); + if(REQUIRE(c != '-' && c != ']', REG_ECTYPE)) {} + p_b_cclass(p, cs); + if(REQUIRE(MORE(), REG_EBRACK)) {} + if(REQUIRE(EATTWO(':', ']'), REG_ECTYPE)) {} + break; + case '=': /* equivalence class */ + NEXT2(); + if(REQUIRE(MORE(), REG_EBRACK)) {} + c = PEEK(); + if(REQUIRE(c != '-' && c != ']', REG_ECOLLATE)) {} + p_b_eclass(p, cs); + if(REQUIRE(MORE(), REG_EBRACK)) {} + if(REQUIRE(EATTWO('=', ']'), REG_ECOLLATE)) {} + break; + default: /* symbol, ordinary character, or range */ +/* xxx revision needed for multichar stuff */ + start = p_b_symbol(p); + if (SEE('-') && MORE2() && PEEK2() != ']') { + /* range */ + NEXT(); + if (EAT('-')) + finish = '-'; + else + finish = p_b_symbol(p); + } else + finish = start; +/* xxx what about signed chars here... */ + if(REQUIRE(start <= finish, REG_ERANGE)) {} + for (i = start; i <= finish; i++) + CHadd(cs, i); + break; + } +} + +/* + - p_b_cclass - parse a character-class name and deal with it + == static void p_b_cclass(register struct parse *p, register cset *cs); + */ +static void +p_b_cclass(p, cs) +register struct parse *p; +register cset *cs; +{ + register char *sp = p->next; + register struct cclass *cp; + register size_t len; + + while (MORE() && my_isalpha(p->charset,PEEK())) + NEXT(); + len = p->next - sp; + for (cp = cclasses; cp->name != NULL; cp++) + if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') + break; + if (cp->name == NULL) { + /* oops, didn't find it */ + SETERROR(REG_ECTYPE); + return; + } + +#ifndef USE_ORIG_REGEX_CODE + { + register size_t i; + for (i=1 ; i<256 ; i++) + if (p->charset->ctype[i+1] & cp->mask) + CHadd(cs, i); + } +#else + { + register char *u = (char*) cp->chars; + register char c; + + while ((c = *u++) != '\0') + CHadd(cs, c); + + for (u = (char*) cp->multis; *u != '\0'; u += strlen(u) + 1) + MCadd(p, cs, u); + } +#endif + +} + +/* + - p_b_eclass - parse an equivalence-class name and deal with it + == static void p_b_eclass(register struct parse *p, register cset *cs); + * + * This implementation is incomplete. xxx + */ +static void +p_b_eclass(p, cs) +register struct parse *p; +register cset *cs; +{ + register char c; + + c = p_b_coll_elem(p, '='); + CHadd(cs, c); +} + +/* + - p_b_symbol - parse a character or [..]ed multicharacter collating symbol + == static char p_b_symbol(register struct parse *p); + */ +static char /* value of symbol */ +p_b_symbol(p) +register struct parse *p; +{ + register char value; + + if(REQUIRE(MORE(), REG_EBRACK)) {} + if (!EATTWO('[', '.')) + return(GETNEXT()); + + /* collating symbol */ + value = p_b_coll_elem(p, '.'); + if(REQUIRE(EATTWO('.', ']'), REG_ECOLLATE)) {} + return(value); +} + +/* + - p_b_coll_elem - parse a collating-element name and look it up + == static char p_b_coll_elem(register struct parse *p, int endc); + */ +static char /* value of collating element */ +p_b_coll_elem(p, endc) +register struct parse *p; +int endc; /* name ended by endc,']' */ +{ + register char *sp = p->next; + register struct cname *cp; +#ifdef _WIN64 + register __int64 len; +#else + register int len; +#endif + while (MORE() && !SEETWO(endc, ']')) + NEXT(); + if (!MORE()) { + SETERROR(REG_EBRACK); + return(0); + } + len = p->next - sp; + for (cp = cnames; cp->name != NULL; cp++) + if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') + return(cp->code); /* known name */ + if (len == 1) + return(*sp); /* single character */ + SETERROR(REG_ECOLLATE); /* neither */ + return(0); +} + +/* + - othercase - return the case counterpart of an alphabetic + == static char othercase(int ch); + */ +static char /* if no counterpart, return ch */ +othercase(charset,ch) +CHARSET_INFO *charset; +int ch; +{ + /* + In MySQL some multi-byte character sets + have 'ctype' array but don't have 'to_lower' + and 'to_upper' arrays. In this case we handle + only basic latin letters a..z and A..Z. + + If 'to_lower' and 'to_upper' arrays are empty in a character set, + then my_isalpha(cs, ch) should never return TRUE for characters + other than basic latin letters. Otherwise it should be + considered as a mistake in character set definition. + */ + assert(my_isalpha(charset,ch)); + if (my_isupper(charset,ch)) + { + return(charset->to_lower ? my_tolower(charset,ch) : + ch - 'A' + 'a'); + } + else if (my_islower(charset,ch)) + { + return(charset->to_upper ? my_toupper(charset,ch) : + ch - 'a' + 'A'); + } + else /* peculiar, but could happen */ + return(ch); +} + +/* + - bothcases - emit a dualcase version of a two-case character + == static void bothcases(register struct parse *p, int ch); + * + * Boy, is this implementation ever a kludge... + */ +static void +bothcases(p, ch) +register struct parse *p; +int ch; +{ + register char *oldnext = p->next; + register char *oldend = p->end; + char bracket[3]; + + assert(othercase(p->charset, ch) != ch); /* p_bracket() would recurse */ + p->next = bracket; + p->end = bracket+2; + bracket[0] = ch; + bracket[1] = ']'; + bracket[2] = '\0'; + p_bracket(p); + assert(p->next == bracket+2); + p->next = oldnext; + p->end = oldend; +} + +/* + - ordinary - emit an ordinary character + == static void ordinary(register struct parse *p, register int ch); + */ +static void +ordinary(p, ch) +register struct parse *p; +register int ch; +{ + register cat_t *cap = p->g->categories; + + if ((p->g->cflags®_ICASE) && my_isalpha(p->charset,ch) && + othercase(p->charset,ch) != ch) + bothcases(p, ch); + else { + EMIT(OCHAR, (unsigned char)ch); + if (cap[ch] == 0) + cap[ch] = p->g->ncategories++; + } +} + +/* + - nonnewline - emit REG_NEWLINE version of OANY + == static void nonnewline(register struct parse *p); + * + * Boy, is this implementation ever a kludge... + */ +static void +nonnewline(p) +register struct parse *p; +{ + register char *oldnext = p->next; + register char *oldend = p->end; + char bracket[4]; + + p->next = bracket; + p->end = bracket+3; + bracket[0] = '^'; + bracket[1] = '\n'; + bracket[2] = ']'; + bracket[3] = '\0'; + p_bracket(p); + assert(p->next == bracket+3); + p->next = oldnext; + p->end = oldend; +} + +/* + - repeat - generate code for a bounded repetition, recursively if needed + == static void repeat(register struct parse *p, sopno start, int from, int to); + */ +static void +repeat(p, start, from, to) +register struct parse *p; +sopno start; /* operand from here to end of strip */ +int from; /* repeated from this number */ +int to; /* to this number of times (maybe RE_INFINITY) */ +{ + register sopno finish = HERE(); +# define N 2 +# define INF 3 +# define REP(f, t) ((f)*8 + (t)) +# define MAP(n) (((n) <= 1) ? (n) : ((n) == RE_INFINITY) ? INF : N) + register sopno copy; + + if (p->error != 0) /* head off possible runaway recursion */ + return; + + assert(from <= to); + + switch (REP(MAP(from), MAP(to))) { + case REP(0, 0): /* must be user doing this */ + DROP(finish-start); /* drop the operand */ + break; + case REP(0, 1): /* as x{1,1}? */ + case REP(0, N): /* as x{1,n}? */ + case REP(0, INF): /* as x{1,}? */ + /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ + INSERT(OCH_, start); /* offset is wrong... */ + repeat(p, start+1, 1, to); + ASTERN(OOR1, start); + AHEAD(start); /* ... fix it */ + EMIT(OOR2, 0); + AHEAD(THERE()); + ASTERN(O_CH, THERETHERE()); + break; + case REP(1, 1): /* trivial case */ + /* done */ + break; + case REP(1, N): /* as x?x{1,n-1} */ + /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ + INSERT(OCH_, start); + ASTERN(OOR1, start); + AHEAD(start); + EMIT(OOR2, 0); /* offset very wrong... */ + AHEAD(THERE()); /* ...so fix it */ + ASTERN(O_CH, THERETHERE()); + copy = dupl(p, start+1, finish+1); + assert(copy == finish+4); + repeat(p, copy, 1, to-1); + break; + case REP(1, INF): /* as x+ */ + INSERT(OPLUS_, start); + ASTERN(O_PLUS, start); + break; + case REP(N, N): /* as xx{m-1,n-1} */ + copy = dupl(p, start, finish); + repeat(p, copy, from-1, to-1); + break; + case REP(N, INF): /* as xx{n-1,INF} */ + copy = dupl(p, start, finish); + repeat(p, copy, from-1, to); + break; + default: /* "can't happen" */ + SETERROR(REG_ASSERT); /* just in case */ + break; + } +} + +/* + - seterr - set an error condition + == static int seterr(register struct parse *p, int e); + */ +static int /* useless but makes type checking happy */ +seterr(p, e) +register struct parse *p; +int e; +{ + if (p->error == 0) /* keep earliest error condition */ + p->error = e; + p->next = nuls; /* try to bring things to a halt */ + p->end = nuls; + return(0); /* make the return value well-defined */ +} + +/* + - allocset - allocate a set of characters for [] + == static cset *allocset(register struct parse *p); + */ +static cset * +allocset(p) +register struct parse *p; +{ + register int no = p->g->ncsets++; + register size_t nc; + register size_t nbytes; + register cset *cs; + register size_t css = (size_t)p->g->csetsize; + register int i; + + if (no >= p->ncsalloc) { /* need another column of space */ + p->ncsalloc += CHAR_BIT; + nc = p->ncsalloc; + assert(nc % CHAR_BIT == 0); + nbytes = nc / CHAR_BIT * css; + if (p->g->sets == NULL) + p->g->sets = (cset *)malloc(nc * sizeof(cset)); + else + p->g->sets = (cset *)realloc((char *)p->g->sets, + nc * sizeof(cset)); + if (p->g->setbits == NULL) + p->g->setbits = (uch *)malloc(nbytes); + else { + p->g->setbits = (uch *)realloc((char *)p->g->setbits, + nbytes); + /* xxx this isn't right if setbits is now NULL */ + for (i = 0; i < no; i++) + p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT); + } + if (p->g->sets != NULL && p->g->setbits != NULL) + (void) memset((char *)p->g->setbits + (nbytes - css), + 0, css); + else { + no = 0; + SETERROR(REG_ESPACE); + /* caller's responsibility not to do set ops */ + } + } + + assert(p->g->sets != NULL); /* xxx */ + cs = &p->g->sets[no]; + cs->ptr = p->g->setbits + css*((no)/CHAR_BIT); + cs->mask = 1 << ((no) % CHAR_BIT); + cs->hash = 0; + cs->smultis = 0; + cs->multis = NULL; + + return(cs); +} + +/* + - freeset - free a now-unused set + == static void freeset(register struct parse *p, register cset *cs); + */ +static void +freeset(p, cs) +register struct parse *p; +register cset *cs; +{ + register size_t i; + register cset *top = &p->g->sets[p->g->ncsets]; + register size_t css = (size_t)p->g->csetsize; + + for (i = 0; i < css; i++) + CHsub(cs, i); + if (cs == top-1) /* recover only the easy case */ + p->g->ncsets--; +} + +/* + - freezeset - final processing on a set of characters + == static int freezeset(register struct parse *p, register cset *cs); + * + * The main task here is merging identical sets. This is usually a waste + * of time (although the hash code minimizes the overhead), but can win + * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash + * is done using addition rather than xor -- all ASCII [aA] sets xor to + * the same value! + */ +static int /* set number */ +freezeset(p, cs) +register struct parse *p; +register cset *cs; +{ + register uch h = cs->hash; + register size_t i; + register cset *top = &p->g->sets[p->g->ncsets]; + register cset *cs2; + register size_t css = (size_t)p->g->csetsize; + + /* look for an earlier one which is the same */ + for (cs2 = &p->g->sets[0]; cs2 < top; cs2++) + if (cs2->hash == h && cs2 != cs) { + /* maybe */ + for (i = 0; i < css; i++) + if (!!CHIN(cs2, i) != !!CHIN(cs, i)) + break; /* no */ + if (i == css) + break; /* yes */ + } + + if (cs2 < top) { /* found one */ + freeset(p, cs); + cs = cs2; + } + + return((int)(cs - p->g->sets)); +} + +/* + - firstch - return first character in a set (which must have at least one) + == static int firstch(register struct parse *p, register cset *cs); + */ +static int /* character; there is no "none" value */ +firstch(p, cs) +register struct parse *p; +register cset *cs; +{ + register size_t i; + register size_t css = (size_t)p->g->csetsize; + + for (i = 0; i < css; i++) + if (CHIN(cs, i)) + return((char)i); + assert(never); + return(0); /* arbitrary */ +} + +/* + - nch - number of characters in a set + == static int nch(register struct parse *p, register cset *cs); + */ +static int +nch(p, cs) +register struct parse *p; +register cset *cs; +{ + register size_t i; + register size_t css = (size_t)p->g->csetsize; + register int n = 0; + + for (i = 0; i < css; i++) + if (CHIN(cs, i)) + n++; + return(n); +} + +#ifdef USE_ORIG_REGEX_CODE +/* + - mcadd - add a collating element to a cset + == static void mcadd(register struct parse *p, register cset *cs, \ + == register char *cp); + */ +static void +mcadd(p, cs, cp) +register struct parse *p; +register cset *cs; +register char *cp; +{ + register size_t oldend = cs->smultis; + + cs->smultis += strlen(cp) + 1; + if (cs->multis == NULL) + cs->multis = malloc(cs->smultis); + else + cs->multis = realloc(cs->multis, cs->smultis); + if (cs->multis == NULL) { + SETERROR(REG_ESPACE); + return; + } + + (void) strcpy(cs->multis + oldend - 1, cp); + cs->multis[cs->smultis - 1] = '\0'; +} +#endif + +#ifdef NOT_USED +/* + - mcsub - subtract a collating element from a cset + == static void mcsub(register cset *cs, register char *cp); + */ +static void +mcsub(cs, cp) +register cset *cs; +register char *cp; +{ + register char *fp = mcfind(cs, cp); + register size_t len = strlen(fp); + + assert(fp != NULL); + (void) memmove(fp, fp + len + 1, + cs->smultis - (fp + len + 1 - cs->multis)); + cs->smultis -= len; + + if (cs->smultis == 0) { + free(cs->multis); + cs->multis = NULL; + return; + } + + cs->multis = realloc(cs->multis, cs->smultis); + assert(cs->multis != NULL); +} + +/* + - mcin - is a collating element in a cset? + == static int mcin(register cset *cs, register char *cp); + */ +static int +mcin(cs, cp) +register cset *cs; +register char *cp; +{ + return(mcfind(cs, cp) != NULL); +} + +/* + - mcfind - find a collating element in a cset + == static char *mcfind(register cset *cs, register char *cp); + */ +static char * +mcfind(cs, cp) +register cset *cs; +register char *cp; +{ + register char *p; + + if (cs->multis == NULL) + return(NULL); + for (p = cs->multis; *p != '\0'; p += strlen(p) + 1) + if (strcmp(cp, p) == 0) + return(p); + return(NULL); +} +#endif + +/* + - mcinvert - invert the list of collating elements in a cset + == static void mcinvert(register struct parse *p, register cset *cs); + * + * This would have to know the set of possibilities. Implementation + * is deferred. + */ +static void +mcinvert(p, cs) + register struct parse *p __attribute__((unused)); + register cset *cs __attribute__((unused)); +{ + assert(cs->multis == NULL); /* xxx */ +} + +/* + - mccase - add case counterparts of the list of collating elements in a cset + == static void mccase(register struct parse *p, register cset *cs); + * + * This would have to know the set of possibilities. Implementation + * is deferred. + */ +static void +mccase(p, cs) +register struct parse *p __attribute__((unused)); +register cset *cs __attribute__((unused)); +{ + assert(cs->multis == NULL); /* xxx */ +} + +/* + - isinsets - is this character in any sets? + == static int isinsets(register struct re_guts *g, int c); + */ +static int /* predicate */ +isinsets(g, c) +register struct re_guts *g; +int c; +{ + register uch *col; + register int i; + register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; + register unsigned uc = (unsigned char)c; + + for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) + if (col[uc] != 0) + return(1); + return(0); +} + +/* + - samesets - are these two characters in exactly the same sets? + == static int samesets(register struct re_guts *g, int c1, int c2); + */ +static int /* predicate */ +samesets(g, c1, c2) +register struct re_guts *g; +int c1; +int c2; +{ + register uch *col; + register int i; + register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; + register unsigned uc1 = (unsigned char)c1; + register unsigned uc2 = (unsigned char)c2; + + for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) + if (col[uc1] != col[uc2]) + return(0); + return(1); +} + +/* + - categorize - sort out character categories + == static void categorize(struct parse *p, register struct re_guts *g); + */ +static void +categorize(p, g) +struct parse *p; +register struct re_guts *g; +{ + register cat_t *cats = g->categories; + register int c; + register int c2; + register cat_t cat; + + /* avoid making error situations worse */ + if (p->error != 0) + return; + + for (c = CHAR_MIN; c <= CHAR_MAX; c++) + if (cats[c] == 0 && isinsets(g, c)) { + cat = g->ncategories++; + cats[c] = cat; + for (c2 = c+1; c2 <= CHAR_MAX; c2++) + if (cats[c2] == 0 && samesets(g, c, c2)) + cats[c2] = cat; + } +} + +/* + - dupl - emit a duplicate of a bunch of sops + == static sopno dupl(register struct parse *p, sopno start, sopno finish); + */ +static sopno /* start of duplicate */ +dupl(p, start, finish) +register struct parse *p; +sopno start; /* from here */ +sopno finish; /* to this less one */ +{ + register sopno ret = HERE(); + register sopno len = finish - start; + + assert(finish >= start); + if (len == 0) + return(ret); + enlarge(p, p->ssize + len); /* this many unexpected additions */ + assert(p->ssize >= p->slen + len); + (void) memcpy((char *)(p->strip + p->slen), + (char *)(p->strip + start), (size_t)len*sizeof(sop)); + p->slen += len; + return(ret); +} + +/* + - doemit - emit a strip operator + == static void doemit(register struct parse *p, sop op, size_t opnd); + * + * It might seem better to implement this as a macro with a function as + * hard-case backup, but it's just too big and messy unless there are + * some changes to the data structures. Maybe later. + */ +static void +doemit(p, op, opnd) +register struct parse *p; +sop op; +size_t opnd; +{ + /* avoid making error situations worse */ + if (p->error != 0) + return; + + /* deal with oversize operands ("can't happen", more or less) */ + assert(opnd < 1<slen >= p->ssize) + enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */ + assert(p->slen < p->ssize); + + /* finally, it's all reduced to the easy case */ + p->strip[p->slen++] = SOP(op, opnd); +} + +/* + - doinsert - insert a sop into the strip + == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos); + */ +static void +doinsert(p, op, opnd, pos) +register struct parse *p; +sop op; +size_t opnd; +sopno pos; +{ + register sopno sn; + register sop s; + register int i; + + /* avoid making error situations worse */ + if (p->error != 0) + return; + + sn = HERE(); + EMIT(op, opnd); /* do checks, ensure space */ + assert(HERE() == sn+1); + s = p->strip[sn]; + + /* adjust paren pointers */ + assert(pos > 0); + for (i = 1; i < NPAREN; i++) { + if (p->pbegin[i] >= pos) { + p->pbegin[i]++; + } + if (p->pend[i] >= pos) { + p->pend[i]++; + } + } + { + int length=(HERE()-pos-1)*sizeof(sop); + bmove_upp((uchar *) &p->strip[pos+1]+length, + (uchar *) &p->strip[pos]+length, + length); + } +#ifdef OLD_CODE + memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos], + (HERE()-pos-1)*sizeof(sop)); +#endif + p->strip[pos] = s; +} + +/* + - dofwd - complete a forward reference + == static void dofwd(register struct parse *p, sopno pos, sop value); + */ +static void +dofwd(p, pos, value) +register struct parse *p; +register sopno pos; +sop value; +{ + /* avoid making error situations worse */ + if (p->error != 0) + return; + + assert(value < 1<strip[pos] = OP(p->strip[pos]) | value; +} + +/* + - enlarge - enlarge the strip + == static void enlarge(register struct parse *p, sopno size); + */ +static void +enlarge(p, size) +register struct parse *p; +register sopno size; +{ + register sop *sp; + + if (p->ssize >= size) + return; + + sp = (sop *)realloc(p->strip, size*sizeof(sop)); + if (sp == NULL) { + SETERROR(REG_ESPACE); + return; + } + p->strip = sp; + p->ssize = size; +} + +/* + - stripsnug - compact the strip + == static void stripsnug(register struct parse *p, register struct re_guts *g); + */ +static void +stripsnug(p, g) +register struct parse *p; +register struct re_guts *g; +{ + g->nstates = p->slen; + g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop)); + if (g->strip == NULL) { + SETERROR(REG_ESPACE); + g->strip = p->strip; + } +} + +/* + - findmust - fill in must and mlen with longest mandatory literal string + == static void findmust(register struct parse *p, register struct re_guts *g); + * + * This algorithm could do fancy things like analyzing the operands of | + * for common subsequences. Someday. This code is simple and finds most + * of the interesting cases. + * + * Note that must and mlen got initialized during setup. + */ +static void +findmust(p, g) +struct parse *p; +register struct re_guts *g; +{ + register sop *scan; + sop *start; + register sop *newstart; + register sopno newlen; + register sop s; + register char *cp; + register sopno i; + LINT_INIT(start); LINT_INIT(newstart); + /* avoid making error situations worse */ + if (p->error != 0) + return; + + /* find the longest OCHAR sequence in strip */ + newlen = 0; + scan = g->strip + 1; + do { + s = *scan++; + switch (OP(s)) { + case OCHAR: /* sequence member */ + if (newlen == 0) /* new sequence */ + newstart = scan - 1; + newlen++; + break; + case OPLUS_: /* things that don't break one */ + case OLPAREN: + case ORPAREN: + break; + case OQUEST_: /* things that must be skipped */ + case OCH_: + scan--; + do { + scan += OPND(s); + s = *scan; + /* assert() interferes w debug printouts */ + if (OP(s) != O_QUEST && OP(s) != O_CH && + OP(s) != OOR2) { + g->iflags |= BAD; + return; + } + } while (OP(s) != O_QUEST && OP(s) != O_CH); + /* fallthrough */ + default: /* things that break a sequence */ + if (newlen > g->mlen) { /* ends one */ + start = newstart; + g->mlen = newlen; + } + newlen = 0; + break; + } + } while (OP(s) != OEND); + + if (g->mlen == 0) /* there isn't one */ + return; + + /* turn it into a character string */ + g->must = malloc((size_t)g->mlen + 1); + if (g->must == NULL) { /* argh; just forget it */ + g->mlen = 0; + return; + } + cp = g->must; + scan = start; + for (i = g->mlen; i > 0; i--) { + while (OP(s = *scan++) != OCHAR) + continue; + assert(cp < g->must + g->mlen); + *cp++ = (char)OPND(s); + } + assert(cp == g->must + g->mlen); + *cp++ = '\0'; /* just on general principles */ +} + +/* + - pluscount - count + nesting + == static sopno pluscount(register struct parse *p, register struct re_guts *g); + */ +static sopno /* nesting depth */ +pluscount(p, g) +struct parse *p; +register struct re_guts *g; +{ + register sop *scan; + register sop s; + register sopno plusnest = 0; + register sopno maxnest = 0; + + if (p->error != 0) + return(0); /* there may not be an OEND */ + + scan = g->strip + 1; + do { + s = *scan++; + switch (OP(s)) { + case OPLUS_: + plusnest++; + break; + case O_PLUS: + if (plusnest > maxnest) + maxnest = plusnest; + plusnest--; + break; + } + } while (OP(s) != OEND); + if (plusnest != 0) + g->iflags |= BAD; + return(maxnest); +} diff --git a/externals/mysql/extlib/regex/regerror.c b/externals/mysql/extlib/regex/regerror.c new file mode 100644 index 0000000..489f2e3 --- /dev/null +++ b/externals/mysql/extlib/regex/regerror.c @@ -0,0 +1,116 @@ +#include +#include +#include + +#include "my_regex.h" +#include "utils.h" +#include "regerror.ih" + +/* + = #define REG_NOMATCH 1 + = #define REG_BADPAT 2 + = #define REG_ECOLLATE 3 + = #define REG_ECTYPE 4 + = #define REG_EESCAPE 5 + = #define REG_ESUBREG 6 + = #define REG_EBRACK 7 + = #define REG_EPAREN 8 + = #define REG_EBRACE 9 + = #define REG_BADBR 10 + = #define REG_ERANGE 11 + = #define REG_ESPACE 12 + = #define REG_BADRPT 13 + = #define REG_EMPTY 14 + = #define REG_ASSERT 15 + = #define REG_INVARG 16 + = #define REG_ATOI 255 // convert name to number (!) + = #define REG_ITOA 0400 // convert number to name (!) + */ +static struct rerr { + int code; + const char *name; + const char *explain; +} rerrs[] = { + {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"}, + {REG_BADPAT, "REG_BADPAT", "invalid regular expression"}, + {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"}, + {REG_ECTYPE, "REG_ECTYPE", "invalid character class"}, + {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"}, + {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"}, + {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"}, + {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"}, + {REG_EBRACE, "REG_EBRACE", "braces not balanced"}, + {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"}, + {REG_ERANGE, "REG_ERANGE", "invalid character range"}, + {REG_ESPACE, "REG_ESPACE", "out of memory"}, + {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"}, + {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"}, + {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"}, + {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"}, + {0, "", "*** unknown regexp error code ***"}, +}; + +/* + - regerror - the interface to error numbers + = extern size_t regerror(int, const regex_t *, char *, size_t); + */ +/* ARGSUSED */ +size_t +my_regerror(int errcode, const my_regex_t *preg, char *errbuf, size_t errbuf_size) +{ + register struct rerr *r; + register size_t len; + register int target = errcode &~ REG_ITOA; + register char *s; + char convbuf[50]; + + if (errcode == REG_ATOI) + s = regatoi(preg, convbuf); + else { + for (r = rerrs; r->code != 0; r++) + if (r->code == target) + break; + + if (errcode®_ITOA) { + if (r->code != 0) + (void) strcpy(convbuf, r->name); + else + sprintf(convbuf, "REG_0x%x", target); + assert(strlen(convbuf) < sizeof(convbuf)); + s = convbuf; + } else + s = (char*) r->explain; + } + + len = strlen(s) + 1; + if (errbuf_size > 0) { + if (errbuf_size > len) + (void) strcpy(errbuf, s); + else { + (void) strncpy(errbuf, s, errbuf_size-1); + errbuf[errbuf_size-1] = '\0'; + } + } + + return(len); +} + +/* + - regatoi - internal routine to implement REG_ATOI + == static char *regatoi(const regex_t *preg, char *localbuf); + */ +static char * +regatoi(preg, localbuf) +const my_regex_t *preg; +char *localbuf; +{ + register struct rerr *r; + for (r = rerrs; r->code != 0; r++) + if (strcmp(r->name, preg->re_endp) == 0) + break; + if (r->code == 0) + return((char*) "0"); + + sprintf(localbuf, "%d", r->code); + return(localbuf); +} diff --git a/externals/mysql/extlib/regex/regex2.h b/externals/mysql/extlib/regex/regex2.h new file mode 100644 index 0000000..bba54ea --- /dev/null +++ b/externals/mysql/extlib/regex/regex2.h @@ -0,0 +1,145 @@ +/* + * First, the stuff that ends up in the outside-world include file + = typedef off_t regoff_t; + = typedef struct { + = int re_magic; + = size_t re_nsub; // number of parenthesized subexpressions + = const char *re_endp; // end pointer for REG_PEND + = struct re_guts *re_g; // none of your business :-) + = } regex_t; + = typedef struct { + = regoff_t rm_so; // start of match + = regoff_t rm_eo; // end of match + = } regmatch_t; + */ +/* + * internals of regex_t + */ +#ifndef __regex2_h__ +#define __regex2_h__ + +#define MAGIC1 ((('r'^0200)<<8) | 'e') + +/* + * The internal representation is a *strip*, a sequence of + * operators ending with an endmarker. (Some terminology etc. is a + * historical relic of earlier versions which used multiple strips.) + * Certain oddities in the representation are there to permit running + * the machinery backwards; in particular, any deviation from sequential + * flow must be marked at both its source and its destination. Some + * fine points: + * + * - OPLUS_ and O_PLUS are *inside* the loop they create. + * - OQUEST_ and O_QUEST are *outside* the bypass they create. + * - OCH_ and O_CH are *outside* the multi-way branch they create, while + * OOR1 and OOR2 are respectively the end and the beginning of one of + * the branches. Note that there is an implicit OOR2 following OCH_ + * and an implicit OOR1 preceding O_CH. + * + * In state representations, an operator's bit is on to signify a state + * immediately *preceding* "execution" of that operator. + */ +typedef unsigned long sop; /* strip operator */ +typedef long sopno; +#define OPRMASK 0xf8000000 +#define OPDMASK 0x07ffffff +#define OPSHIFT ((unsigned long)27) +#define OP(n) ((unsigned long) ((n)&OPRMASK)) +#define OPND(n) ((unsigned long) ((n)&OPDMASK)) +#define SOP(op, opnd) (unsigned long) ((op)|(opnd)) +#define OSHIFT(A) ((unsigned long) (A) << OPSHIFT) +/* operators meaning operand */ +/* (back, fwd are offsets) */ +#define OEND OSHIFT(1) /* endmarker - */ +#define OCHAR OSHIFT(2) /* character unsigned char */ +#define OBOL OSHIFT(3) /* left anchor - */ +#define OEOL OSHIFT(4) /* right anchor - */ +#define OANY OSHIFT(5) /* . - */ +#define OANYOF OSHIFT(6) /* [...] set number */ +#define OBACK_ OSHIFT(7) /* begin \d paren number */ +#define O_BACK OSHIFT(8) /* end \d paren number */ +#define OPLUS_ OSHIFT(9) /* + prefix fwd to suffix */ +#define O_PLUS OSHIFT(10) /* + suffix back to prefix */ +#define OQUEST_ OSHIFT(11) /* ? prefix fwd to suffix */ +#define O_QUEST OSHIFT(12) /* ? suffix back to prefix */ +#define OLPAREN OSHIFT(13) /* ( fwd to ) */ +#define ORPAREN OSHIFT(14) /* ) back to ( */ +#define OCH_ OSHIFT(15) /* begin choice fwd to OOR2 */ +#define OOR1 OSHIFT(16) /* | pt. 1 back to OOR1 or OCH_ */ +#define OOR2 OSHIFT(17) /* | pt. 2 fwd to OOR2 or O_CH */ +#define O_CH OSHIFT(18) /* end choice back to OOR1 */ +#define OBOW OSHIFT(19) /* begin word - */ +#define OEOW OSHIFT(20) /* end word - */ + +/* + * Structure for [] character-set representation. Character sets are + * done as bit vectors, grouped 8 to a byte vector for compactness. + * The individual set therefore has both a pointer to the byte vector + * and a mask to pick out the relevant bit of each byte. A hash code + * simplifies testing whether two sets could be identical. + * + * This will get trickier for multicharacter collating elements. As + * preliminary hooks for dealing with such things, we also carry along + * a string of multi-character elements, and decide the size of the + * vectors at run time. + */ +#ifdef __WIN__ +typedef unsigned char uch ; +#endif + +typedef struct { + uch *ptr; /* -> uch [csetsize] */ + uch mask; /* bit within array */ + uch hash; /* hash code */ + size_t smultis; + char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */ +} cset; +/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ +#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (uch) (c)) +#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (uch)(c)) +#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask) +#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */ +#define MCsub(p, cs, cp) mcsub(p, cs, cp) +#define MCin(p, cs, cp) mcin(p, cs, cp) + +/* stuff for character categories */ +typedef unsigned char cat_t; + +/* + * main compiled-expression structure + */ +struct re_guts { + int magic; +# define MAGIC2 ((('R'^0200)<<8)|'E') + sop *strip; /* malloced area for strip */ + int csetsize; /* number of bits in a cset vector */ + int ncsets; /* number of csets in use */ + cset *sets; /* -> cset [ncsets] */ + uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */ + int cflags; /* copy of regcomp() cflags argument */ + sopno nstates; /* = number of sops */ + sopno firststate; /* the initial OEND (normally 0) */ + sopno laststate; /* the final OEND */ + int iflags; /* internal flags */ +# define USEBOL 01 /* used ^ */ +# define USEEOL 02 /* used $ */ +# define BAD 04 /* something wrong */ + int nbol; /* number of ^ used */ + int neol; /* number of $ used */ + int ncategories; /* how many character categories */ + cat_t *categories; /* ->catspace[-CHAR_MIN] */ + char *must; /* match must contain this string */ + int mlen; /* length of must */ + size_t nsub; /* copy of re_nsub */ + int backrefs; /* does it use back references? */ + sopno nplus; /* how deep does it nest +s? */ + /* catspace must be last */ + cat_t catspace[1]; /* actually [NC] */ +}; + +/* misc utilities */ +#undef OUT /* May be defined in windows */ +#define OUT (CHAR_MAX+1) /* a non-character value */ +#define ISWORD(s,c) (my_isalnum(s,c) || (c) == '_') + +#endif /* __regex2_h__ */ diff --git a/externals/mysql/extlib/regex/regexec.c b/externals/mysql/extlib/regex/regexec.c new file mode 100644 index 0000000..338c1bf --- /dev/null +++ b/externals/mysql/extlib/regex/regexec.c @@ -0,0 +1,139 @@ +/* + * the outer shell of regexec() + * + * This file includes engine.c *twice*, after muchos fiddling with the + * macros that code uses. This lets the same code operate on two different + * representations for state sets. + */ +#include +#include +#include +#ifdef __WIN__ +#include +#endif +#include "my_regex.h" +#include "utils.h" +#include "regex2.h" + +/* for use in asserts */ +#define nope 0 + +/* macros for manipulating states, small version */ +#define states long +#define states1 long /* for later use in regexec() decision. Ensure Win64 definition is correct.*/ +#define CLEAR(v) ((v) = 0) +#define SET0(v, n) ((v) &= ~((states) 1 << (n))) +#define SET1(v, n) ((v) |= (states) 1 << (n)) +#define ISSET(v, n) ((v) & ((states) 1 << (n))) +#define ASSIGN(d, s) ((d) = (s)) +#define EQ(a, b) ((a) == (b)) +#define STATEVARS int dummy /* dummy version */ +#define STATESETUP(m, n) /* nothing */ +#define STATETEARDOWN(m) /* nothing */ +#define SETUP(v) ((v) = 0) +#define onestate long /* Changed from int by Monty */ +#define INIT(o, n) ((o) = (unsigned states)1 << (n)) +#define INC(o) ((o) <<= 1) +#define ISSTATEIN(v, o) ((v) & (o)) +/* some abbreviations; note that some of these know variable names! */ +/* do "if I'm here, I can also be there" etc without branches */ +#define FWD(dst, src, n) ((dst) |= ((unsigned states)(src)&(here)) << (n)) +#define BACK(dst, src, n) ((dst) |= ((unsigned states)(src)&(here)) >> (n)) +#define ISSETBACK(v, n) ((v) & ((unsigned states)here >> (n))) +/* function names */ +#define SNAMES /* engine.c looks after details */ + +#include "engine.c" + +/* now undo things */ +#undef states +#undef CLEAR +#undef SET0 +#undef SET1 +#undef ISSET +#undef ASSIGN +#undef EQ +#undef STATEVARS +#undef STATESETUP +#undef STATETEARDOWN +#undef SETUP +#undef onestate +#undef INIT +#undef INC +#undef ISSTATEIN +#undef FWD +#undef BACK +#undef ISSETBACK +#undef SNAMES + +/* macros for manipulating states, large version */ +#define states char * +#define CLEAR(v) memset(v, 0, m->g->nstates) +#define SET0(v, n) ((v)[n] = 0) +#define SET1(v, n) ((v)[n] = 1) +#define ISSET(v, n) ((v)[n]) +#define ASSIGN(d, s) memcpy(d, s, m->g->nstates) +#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0) +#define STATEVARS int vn; char *space +#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \ + if ((m)->space == NULL) return(REG_ESPACE); \ + (m)->vn = 0; } +#define STATETEARDOWN(m) { free((m)->space); } +#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates]) +#define onestate int +#define INIT(o, n) ((o) = (n)) +#define INC(o) ((o)++) +#define ISSTATEIN(v, o) ((v)[o]) +/* some abbreviations; note that some of these know variable names! */ +/* do "if I'm here, I can also be there" etc without branches */ +#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here]) +#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here]) +#define ISSETBACK(v, n) ((v)[here - (n)]) +/* function names */ +#define LNAMES /* flag */ + +#include "engine.c" + +/* + - regexec - interface for matching + = extern int regexec(const regex_t *, const char *, size_t, \ + = regmatch_t [], int); + = #define REG_NOTBOL 00001 + = #define REG_NOTEOL 00002 + = #define REG_STARTEND 00004 + = #define REG_TRACE 00400 // tracing of execution + = #define REG_LARGE 01000 // force large representation + = #define REG_BACKR 02000 // force use of backref code + * + * We put this here so we can exploit knowledge of the state representation + * when choosing which matcher to call. Also, by this point the matchers + * have been prototyped. + */ +int /* 0 success, REG_NOMATCH failure */ +my_regexec(preg, str, nmatch, pmatch, eflags) +const my_regex_t *preg; +const char *str; +size_t nmatch; +my_regmatch_t pmatch[]; +int eflags; +{ + register struct re_guts *g = preg->re_g; +#ifdef REDEBUG +# define GOODFLAGS(f) (f) +#else +# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND)) +#endif + + if (preg->re_magic != MAGIC1 || g->magic != MAGIC2) + return(REG_BADPAT); + assert(!(g->iflags&BAD)); + if (g->iflags&BAD) /* backstop for no-debug case */ + return(REG_BADPAT); + eflags = GOODFLAGS(eflags); + + if ((size_t) g->nstates <= CHAR_BIT*sizeof(states1) && + !(eflags®_LARGE)) + return(smatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags)); + else + return(lmatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags)); +} diff --git a/externals/mysql/extlib/regex/regexp.c b/externals/mysql/extlib/regex/regexp.c new file mode 100644 index 0000000..8ddf90f --- /dev/null +++ b/externals/mysql/extlib/regex/regexp.c @@ -0,0 +1,1348 @@ +/* + * + * regexp.c - regular expression matching + * + * DESCRIPTION + * + * Underneath the reformatting and comment blocks which were added to + * make it consistent with the rest of the code, you will find a + * modified version of Henry Specer's regular expression library. + * Henry's functions were modified to provide the minimal regular + * expression matching, as required by P1003. Henry's code was + * copyrighted, and copy of the copyright message and restrictions + * are provided, verbatim, below: + * + * Copyright (c) 1986 by University of Toronto. + * Written by Henry Spencer. Not derived from licensed software. + * + * Permission is granted to anyone to use this software for any + * purpose on any computer system, and to redistribute it freely, + * subject to the following restrictions: + * + * 1. The author is not responsible for the consequences of use of + * this software, no matter how awful, even if they arise + * from defects in it. + * + * 2. The origin of this software must not be misrepresented, either + * by explicit claim or by omission. + * + * 3. Altered versions must be plainly marked as such, and must not + * be misrepresented as being the original software. + * + * + * This version modified by Ian Phillipps to return pointer to terminating + * NUL on substitution string. [ Temp mail address ex-igp@camcon.co.uk ] + * + * Altered by amylaar to support excompatible option and the + * operators \< and >\ . ( 7.Sep. 1991 ) + * + * regsub altered by amylaar to take an additional parameter specifying + * maximum number of bytes that can be written to the memory region + * pointed to by dest + * + * Also altered by Fredrik Hubinette to handle the + operator and + * eight-bit chars. Mars 22 1996 + * + * + * Beware that some of this code is subtly aware of the way operator + * precedence is structured in regular expressions. Serious changes in + * regular-expression syntax might require a total rethink. + * + * AUTHORS + * + * Mark H. Colburn, NAPS International (mark@jhereg.mn.org) + * Henry Spencer, University of Torronto (henry@utzoo.edu) + * + * Sponsored by The USENIX Association for public distribution. + * + */ + +/* Headers */ +#include "my_global.h" +#include +#include "regexp.h" +#ifdef __WIN__ +#include +#else +#include "memory.h" +#include "error.h" +#endif + +/* + * The "internal use only" fields in regexp.h are present to pass info from + * compile to execute that permits the execute phase to run lots faster on + * simple cases. They are: + * + * regstart char that must begin a match; '\0' if none obvious + * reganch is the match anchored (at beginning-of-line only)? + * regmust string (pointer into program) that match must include, or NULL + * regmlen length of regmust string + * + * Regstart and reganch permit very fast decisions on suitable starting points + * for a match, cutting down the work a lot. Regmust permits fast rejection + * of lines that cannot possibly match. The regmust tests are costly enough + * that regcomp() supplies a regmust only if the r.e. contains something + * potentially expensive (at present, the only such thing detected is * or + + * at the start of the r.e., which can involve a lot of backup). Regmlen is + * supplied because the test in regexec() needs it and regcomp() is computing + * it anyway. + */ + +/* + * Structure for regexp "program". This is essentially a linear encoding + * of a nondeterministic finite-state machine (aka syntax charts or + * "railroad normal form" in parsing technology). Each node is an opcode + * plus a "nxt" pointer, possibly plus an operand. "Nxt" pointers of + * all nodes except BRANCH implement concatenation; a "nxt" pointer with + * a BRANCH on both ends of it is connecting two alternatives. (Here we + * have one of the subtle syntax dependencies: an individual BRANCH (as + * opposed to a collection of them) is never concatenated with anything + * because of operator precedence.) The operand of some types of node is + * a literal string; for others, it is a node leading into a sub-FSM. In + * particular, the operand of a BRANCH node is the first node of the branch. + * (NB this is *not* a tree structure: the tail of the branch connects + * to the thing following the set of BRANCHes.) The opcodes are: + */ + +/* definition number opnd? meaning */ +#define END 0 /* no End of program. */ +#define BOL 1 /* no Match "" at beginning of line. */ +#define EOL 2 /* no Match "" at end of line. */ +#define ANY 3 /* no Match any one character. */ +#define ANYOF 4 /* str Match any character in this string. */ +#define ANYBUT 5 /* str Match any character not in this + * string. */ +#define BRANCH 6 /* node Match this alternative, or the + * nxt... */ +#define BACK 7 /* no Match "", "nxt" ptr points backward. */ +#define EXACTLY 8 /* str Match this string. */ +#define NOTHING 9 /* no Match empty string. */ +#define STAR 10 /* node Match this (simple) thing 0 or more + * times. */ +#define WORDSTART 11 /* node matching a start of a word */ +#define WORDEND 12 /* node matching an end of a word */ +#define OPEN 20 /* no Mark this point in input as start of + * #n. */ + /* OPEN+1 is number 1, etc. */ +#define CLOSE 30 /* no Analogous to OPEN. */ + +/* + * Opcode notes: + * + * BRANCH The set of branches constituting a single choice are hooked + * together with their "nxt" pointers, since precedence prevents + * anything being concatenated to any individual branch. The + * "nxt" pointer of the last BRANCH in a choice points to the + * thing following the whole choice. This is also where the + * final "nxt" pointer of each individual branch points; each + * branch starts with the operand node of a BRANCH node. + * + * BACK Normal "nxt" pointers all implicitly point forward; BACK + * exists to make loop structures possible. + * + * STAR complex '*', are implemented as circular BRANCH structures + * using BACK. Simple cases (one character per match) are + * implemented with STAR for speed and to minimize recursive + * plunges. + * + * OPEN,CLOSE ...are numbered at compile time. + */ + +/* + * A node is one char of opcode followed by two chars of "nxt" pointer. + * "Nxt" pointers are stored as two 8-bit pieces, high order first. The + * value is a positive offset from the opcode of the node containing it. + * An operand, if any, simply follows the node. (Note that much of the + * code generation knows about this implicit relationship.) + * + * Using two bytes for the "nxt" pointer is vast overkill for most things, + * but allows patterns to get big without disasters. + */ +#define OP(p) (*(p)) +#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) +#define OPERAND(p) ((p) + 3) + +/* + * The first byte of the regexp internal "program" is actually this magic + * number; the start node begins in the second byte. + */ +#define MAGIC 0234 + +/* + * Utility definitions. + */ + +#ifdef __WIN__ +#define error(X,Y) fprintf(stderr, X, Y) +#endif +#define regerror(X) error("Regexp: %s\n",X); +#define SPECIAL 0x100 +#define LBRAC ('('|SPECIAL) +#define RBRAC (')'|SPECIAL) +#define ASTERIX ('*'|SPECIAL) +#define PLUS ('+'|SPECIAL) +#define OR_OP ('|'|SPECIAL) +#define DOLLAR ('$'|SPECIAL) +#define DOT ('.'|SPECIAL) +#define CARET ('^'|SPECIAL) +#define LSQBRAC ('['|SPECIAL) +#define RSQBRAC (']'|SPECIAL) +#define LSHBRAC ('<'|SPECIAL) +#define RSHBRAC ('>'|SPECIAL) +#define FAIL(m) { regerror(m); return(NULL); } +#define ISMULT(c) ((c) == ASTERIX || (c)==PLUS) +#define META "^$.[()|*+\\" +#ifndef CHARBITS +#define CHARBITS 0xff +#define UCHARAT(p) ((int)*(unsigned char *)(p)) +#else +#define UCHARAT(p) ((int)*(p)&CHARBITS) +#endif +#define ISWORDPART(c) ( isalnum(c) || (c) == '_' ) + +/* + * Flags to be passed up and down. + */ +#define HASWIDTH 01 /* Known never to match null string. */ +#define SIMPLE 02 /* Simple enough to be STAR operand. */ +#define SPSTART 04 /* Starts with * */ +#define WORST 0 /* Worst case. */ +#ifdef __WIN__ +#define STRCHR(A,B) strchr(A,B) +#endif + +/* + * Global work variables for regcomp(). + */ +static short *regparse; /* Input-scan pointer. */ +static int regnpar; /* () count. */ +static char regdummy; +static char *regcode; /* Code-emit pointer; ®dummy = don't. */ +static long regsize; /* Code size. */ + +/* + * Forward declarations for regcomp()'s friends. + */ +#ifndef STATIC +#define STATIC static +#endif +STATIC char *reg(); +STATIC char *regbranch(); +STATIC char *regpiece(); +STATIC char *regatom(); +STATIC char *regnode(); +STATIC char *regnext(); +STATIC void regc(); +STATIC void reginsert(); +STATIC void regtail(); +STATIC void regoptail(); + +/* + - regcomp - compile a regular expression into internal code + * + * We can't allocate space until we know how big the compiled form will be, + * but we can't compile it (and thus know how big it is) until we've got a + * place to put the code. So we cheat: we compile it twice, once with code + * generation turned off and size counting turned on, and once "for real". + * This also means that we don't allocate space until we are sure that the + * thing really will compile successfully, and we never have to move the + * code and thus invalidate pointers into it. (Note that it has to be in + * one piece because free() must be able to free it all.) + * + * Beware that the optimization-preparation code in here knows about some + * of the structure of the compiled regexp. + */ +regexp *regcomp(exp,excompat) +char *exp; +int excompat; /* \( \) operators like in unix ex */ +{ + register regexp *r; + register char *scan; + register char *longest; + register int len; + int flags; + short *exp2,*dest,c; + + if (exp == (char *)NULL) + FAIL("NULL argument"); + + exp2=(short*)malloc( (strlen(exp)+1) * (sizeof(short[8])/sizeof(char[8])) ); + for ( scan=exp,dest=exp2;( c= UCHARAT(scan++)); ) { + switch (c) { + case '(': + case ')': + *dest++ = excompat ? c : c | SPECIAL; + break; + case '.': + case '*': + case '+': + case '|': + case '$': + case '^': + case '[': + case ']': + *dest++ = c | SPECIAL; + break; + case '\\': + switch ( c = *scan++ ) { + case '(': + case ')': + *dest++ = excompat ? c | SPECIAL : c; + break; + case '<': + case '>': + *dest++ = c | SPECIAL; + break; + case '{': + case '}': + FAIL("sorry, unimplemented operator"); + case 'b': *dest++ = '\b'; break; + case 't': *dest++ = '\t'; break; + case 'r': *dest++ = '\r'; break; + default: + *dest++ = c; + } + break; + default: + *dest++ = c; + } + } + *dest=0; + /* First pass: determine size, legality. */ + regparse = exp2; + regnpar = 1; + regsize = 0L; + regcode = ®dummy; + regc(MAGIC); + if (reg(0, &flags) == (char *)NULL) + return ((regexp *)NULL); + + /* Small enough for pointer-storage convention? */ + if (regsize >= 32767L) /* Probably could be 65535L. */ + FAIL("regexp too big"); + + /* Allocate space. */ + r = (regexp *) malloc(sizeof(regexp) + (unsigned) regsize); + if (r == (regexp *) NULL) + FAIL("out of space"); + (void) bzero(r, sizeof(regexp) + (unsigned)regsize); + + /* Second pass: emit code. */ + regparse = exp2; + regnpar = 1; + regcode = r->program; + regc(MAGIC); + if (reg(0, &flags) == NULL) + return ((regexp *) NULL); + + /* Dig out information for optimizations. */ + r->regstart = '\0'; /* Worst-case defaults. */ + r->reganch = 0; + r->regmust = NULL; + r->regmlen = 0; + scan = r->program + 1; /* First BRANCH. */ + if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ + scan = OPERAND(scan); + + /* Starting-point info. */ + if (OP(scan) == EXACTLY) + r->regstart = *OPERAND(scan); + else if (OP(scan) == BOL) + r->reganch++; + + /* + * If there's something expensive in the r.e., find the longest + * literal string that must appear and make it the regmust. Resolve + * ties in favor of later strings, since the regstart check works + * with the beginning of the r.e. and avoiding duplication + * strengthens checking. Not a strong reason, but sufficient in the + * absence of others. + */ + if (flags & SPSTART) { + longest = NULL; + len = 0; + for (; scan != NULL; scan = regnext(scan)) + if (OP(scan) == EXACTLY && + (int)strlen(OPERAND(scan)) >= len) { + longest = OPERAND(scan); + len = strlen(OPERAND(scan)); + } + r->regmust = longest; + r->regmlen = len; + } + } + free((char*)exp2); + return (r); +} + +/* + - reg - regular expression, i.e. main body or parenthesized thing + * + * Caller must absorb opening parenthesis. + * + * Combining parenthesis handling with the base level of regular expression + * is a trifle forced, but the need to tie the tails of the branches to what + * follows makes it hard to avoid. + */ +static char *reg(paren, flagp) +int paren; /* Parenthesized? */ +int *flagp; +{ + register char *ret; + register char *br; + register char *ender; + register int parno=0; /* make gcc happy */ + int flags; + + *flagp = HASWIDTH; /* Tentatively. */ + + /* Make an OPEN node, if parenthesized. */ + if (paren) { + if (regnpar >= NSUBEXP) + FAIL("too many ()"); + parno = regnpar; + regnpar++; + ret = regnode(OPEN + parno); + } else + ret = (char *)NULL; + + /* Pick up the branches, linking them together. */ + br = regbranch(&flags); + if (br == (char *)NULL) + return ((char *)NULL); + if (ret != (char *)NULL) + regtail(ret, br); /* OPEN -> first. */ + else + ret = br; + if (!(flags & HASWIDTH)) + *flagp &= ~HASWIDTH; + *flagp |= flags & SPSTART; + while (*regparse == OR_OP) { + regparse++; + br = regbranch(&flags); + if (br == (char *)NULL) + return ((char *)NULL); + regtail(ret, br); /* BRANCH -> BRANCH. */ + if (!(flags & HASWIDTH)) + *flagp &= ~HASWIDTH; + *flagp |= flags & SPSTART; + } + + /* Make a closing node, and hook it on the end. */ + ender = regnode((paren) ? CLOSE + parno : END); + regtail(ret, ender); + + /* Hook the tails of the branches to the closing node. */ + for (br = ret; br != (char *)NULL; br = regnext(br)) + regoptail(br, ender); + + /* Check for proper termination. */ + if (paren && *regparse++ != RBRAC) { + FAIL("unmatched ()"); + } else if (!paren && *regparse != '\0') { + if (*regparse == RBRAC) { + FAIL("unmatched ()"); + } else + FAIL("junk on end");/* "Can't happen". */ + /* NOTREACHED */ + } + return (ret); +} + +/* + - regbranch - one alternative of an | operator + * + * Implements the concatenation operator. + */ +static char *regbranch(flagp) +int *flagp; +{ + register char *ret; + register char *chain; + register char *latest; + int flags; + + *flagp = WORST; /* Tentatively. */ + + ret = regnode(BRANCH); + chain = (char *)NULL; + while (*regparse != '\0' && *regparse != OR_OP && *regparse != RBRAC) { + latest = regpiece(&flags); + if (latest == (char *)NULL) + return ((char *)NULL); + *flagp |= flags & HASWIDTH; + if (chain == (char *)NULL) /* First piece. */ + *flagp |= flags & SPSTART; + else + regtail(chain, latest); + chain = latest; + } + if (chain == (char *)NULL) /* Loop ran zero times. */ + regnode(NOTHING); + + return (ret); +} + +/* + - regpiece - something followed by possible [*] + * + * Note that the branching code sequence used for * is somewhat optimized: + * they use the same NOTHING node as both the endmarker for their branch + * list and the body of the last branch. It might seem that this node could + * be dispensed with entirely, but the endmarker role is not redundant. + */ +static char *regpiece(flagp) +int *flagp; +{ + register char *ret; + register short op; + /* register char *nxt; */ + int flags; + + ret = regatom(&flags); + if (ret == (char *)NULL) + return ((char *)NULL); + + op = *regparse; + if (!ISMULT(op)) { + *flagp = flags; + return (ret); + } + if (!(flags & HASWIDTH)) + FAIL("* or + operand could be empty"); + *flagp = (WORST | SPSTART); + + if(op == ASTERIX) + { + if (flags & SIMPLE) + { + reginsert(STAR, ret); + } + else + { + /* Emit x* as (x&|), where & means "self". */ + reginsert(BRANCH, ret); /* Either x */ + regoptail(ret, regnode(BACK)); /* and loop */ + regoptail(ret, ret); /* back */ + regtail(ret, regnode(BRANCH)); /* or */ + regtail(ret, regnode(NOTHING)); /* null. */ + } + } + else if(op == PLUS) + { + /* Emit a+ as (a&) where & means "self" /Fredrik Hubinette */ + char *tmp; + tmp=regnode(BACK); + reginsert(BRANCH, tmp); + regtail(ret, tmp); + regoptail(tmp, ret); + regtail(ret, regnode(BRANCH)); + regtail(ret, regnode(NOTHING)); + } + + regparse++; + if (ISMULT(*regparse)) + FAIL("nested * or +"); + + return (ret); +} + + +/* + - regatom - the lowest level + * + * Optimization: gobbles an entire sequence of ordinary characters so that + * it can turn them into a single node, which is smaller to store and + * faster to run. + */ +static char *regatom(flagp) +int *flagp; +{ + register char *ret; + int flags; + + *flagp = WORST; /* Tentatively. */ + + switch (*regparse++) { + case CARET: + ret = regnode(BOL); + break; + case DOLLAR: + ret = regnode(EOL); + break; + case DOT: + ret = regnode(ANY); + *flagp |= HASWIDTH | SIMPLE; + break; + case LSHBRAC: + ret = regnode(WORDSTART); + break; + case RSHBRAC: + ret = regnode(WORDEND); + break; + case LSQBRAC:{ + register int class; + register int classend; + + if (*regparse == CARET) { /* Complement of range. */ + ret = regnode(ANYBUT); + regparse++; + } else + ret = regnode(ANYOF); + if (*regparse == RSQBRAC || *regparse == '-') + regc(*regparse++); + while (*regparse != '\0' && *regparse != RSQBRAC) { + if (*regparse == '-') { + regparse++; + if (*regparse == RSQBRAC || *regparse == '\0') + regc('-'); + else { + class = (CHARBITS & *(regparse - 2)) + 1; + classend = (CHARBITS & *(regparse)); + if (class > classend + 1) + FAIL("invalid [] range"); + for (; class <= classend; class++) + regc(class); + regparse++; + } + } else + regc(*regparse++); + } + regc('\0'); + if (*regparse != RSQBRAC) + FAIL("unmatched []"); + regparse++; + *flagp |= HASWIDTH | SIMPLE; + } + break; + case LBRAC: + ret = reg(1, &flags); + if (ret == (char *)NULL) + return ((char *)NULL); + *flagp |= flags & (HASWIDTH | SPSTART); + break; + case '\0': + case OR_OP: + case RBRAC: + FAIL("internal urp"); /* Supposed to be caught earlier. */ + + case ASTERIX: + FAIL("* follows nothing\n"); + + default:{ + register int len; + register short ender; + + regparse--; + for (len=0; regparse[len] && + !(regparse[len]&SPECIAL) && regparse[len] != RSQBRAC; len++) ; + if (len <= 0) + { + FAIL("internal disaster"); + } + ender = *(regparse + len); + if (len > 1 && ISMULT(ender)) + len--; /* Back off clear of * operand. */ + *flagp |= HASWIDTH; + if (len == 1) + *flagp |= SIMPLE; + ret = regnode(EXACTLY); + while (len > 0) { + regc(*regparse++); + len--; + } + regc('\0'); + } + break; + } + + return (ret); +} + +/* + - regnode - emit a node + */ +static char *regnode(op) +char op; +{ + register char *ret; + register char *ptr; + + ret = regcode; + if (ret == ®dummy) { + regsize += 3; + return (ret); + } + ptr = ret; + *ptr++ = op; + *ptr++ = '\0'; /* Null "nxt" pointer. */ + *ptr++ = '\0'; + regcode = ptr; + + return (ret); +} + +/* + - regc - emit (if appropriate) a byte of code + */ +static void regc(b) +char b; +{ + if (regcode != ®dummy) + *regcode++ = b; + else + regsize++; +} + +/* + - reginsert - insert an operator in front of already-emitted operand + * + * Means relocating the operand. + */ +static void reginsert(op, opnd) +char op; +char *opnd; +{ + register char *src; + register char *dst; + register char *place; + + if (regcode == ®dummy) { + regsize += 3; + return; + } + src = regcode; + regcode += 3; + dst = regcode; + while (src > opnd) + *--dst = *--src; + + place = opnd; /* Op node, where operand used to be. */ + *place++ = op; + *place++ = '\0'; + *place++ = '\0'; +} + +/* + - regtail - set the next-pointer at the end of a node chain + */ +static void regtail(p, val) +char *p; +char *val; +{ + register char *scan; + register char *temp; + register int offset; + + if (p == ®dummy) + return; + + /* Find last node. */ + scan = p; + for (;;) { + temp = regnext(scan); + if (temp == (char *)NULL) + break; + scan = temp; + } + + if (OP(scan) == BACK) + offset = scan - val; + else + offset = val - scan; + *(scan + 1) = (offset >> 8) & 0377; + *(scan + 2) = offset & 0377; +} + +/* + - regoptail - regtail on operand of first argument; nop if operandless + */ +static void regoptail(p, val) +char *p; +char *val; +{ + /* "Operandless" and "op != BRANCH" are synonymous in practice. */ + if (p == (char *)NULL || p == ®dummy || OP(p) != BRANCH) + return; + regtail(OPERAND(p), val); +} + +/* + * regexec and friends + */ + +/* + * Global work variables for regexec(). + */ +static char *reginput; /* String-input pointer. */ +static char *regbol; /* Beginning of input, for ^ check. */ +static char **regstartp; /* Pointer to startp array. */ +static char **regendp; /* Ditto for endp. */ + +/* + * Forwards. + */ +STATIC int regtry(); +STATIC int regmatch(); +STATIC int regrepeat(); + +#ifdef DEBUG +int regnarrate = 0; +void regdump(); +STATIC char *regprop(); +#endif + +/* + - regexec - match a regexp against a string + */ +int regexec(prog, string) +register regexp *prog; +register char *string; +{ + register char *s; + + /* Be paranoid... */ + if (prog == (regexp *)NULL || string == (char *)NULL) { + regerror("NULL parameter"); + return (0); + } + /* Check validity of program. */ + if (UCHARAT(prog->program) != MAGIC) { + regerror("corrupted program"); + return (0); + } + /* If there is a "must appear" string, look for it. */ + if (prog->regmust != (char *)NULL) { + s = string; + while ((s = STRCHR(s, prog->regmust[0])) != (char *)NULL) { + if (strncmp(s, prog->regmust, prog->regmlen) == 0) + break; /* Found it. */ + s++; + } + if (s == (char *)NULL) /* Not present. */ + return (0); + } + /* Mark beginning of line for ^ . */ + regbol = string; + + /* Simplest case: anchored match need be tried only once. */ + if (prog->reganch) + return (regtry(prog, string)); + + /* Messy cases: unanchored match. */ + s = string; + if (prog->regstart != '\0') + /* We know what char it must start with. */ + while ((s = STRCHR(s, prog->regstart)) != (char *)NULL) { + if (regtry(prog, s)) + return (1); + s++; + } + else + /* We don't -- general case. */ + do { + if (regtry(prog, s)) + return (1); + } while (*s++ != '\0'); + + /* Failure. */ + return (0); +} + +/* + - regtry - try match at specific point + */ + +static int regtry(regexp *prog, char *string) +{ + register int i; + register char **sp; + register char **ep; + + reginput = string; + regstartp = prog->startp; + regendp = prog->endp; + + sp = prog->startp; + ep = prog->endp; + for (i = NSUBEXP; i > 0; i--) { + *sp++ = (char *)NULL; + *ep++ = (char *)NULL; + } + if (regmatch(prog->program + 1)) { + prog->startp[0] = string; + prog->endp[0] = reginput; + return (1); + } else + return (0); +} + +/* + - regmatch - main matching routine + * + * Conceptually the strategy is simple: check to see whether the current + * node matches, call self recursively to see whether the rest matches, + * and then act accordingly. In practice we make some effort to avoid + * recursion, in particular by going through "ordinary" nodes (that don't + * need to know whether the rest of the match failed) by a loop instead of + * by recursion. + */ + +static int regmatch(char *prog) +{ + register char *scan; /* Current node. */ + char *nxt; /* nxt node. */ + + scan = prog; +#ifdef DEBUG + if (scan != (char *)NULL && regnarrate) + fprintf(stderr, "%s(\n", regprop(scan)); +#endif + while (scan != (char *)NULL) { +#ifdef DEBUG + if (regnarrate) + fprintf(stderr, "%s...\n", regprop(scan)); +#endif + nxt = regnext(scan); + + switch (OP(scan)) { + case BOL: + if (reginput != regbol) + return (0); + break; + case EOL: + if (*reginput != '\0') + return (0); + break; + case ANY: + if (*reginput == '\0') + return (0); + reginput++; + break; + case WORDSTART: + if (reginput == regbol) + break; + if (*reginput == '\0' || + ISWORDPART( *(reginput-1) ) || !ISWORDPART( *reginput ) ) + return (0); + break; + case WORDEND: + if (*reginput == '\0') + break; + if ( reginput == regbol || + !ISWORDPART( *(reginput-1) ) || ISWORDPART( *reginput ) ) + return (0); + break; + case EXACTLY:{ + register int len; + register char *opnd; + + opnd = OPERAND(scan); + /* Inline the first character, for speed. */ + if (*opnd != *reginput) + return (0); + len = strlen(opnd); + if (len > 1 && strncmp(opnd, reginput, len) != 0) + return (0); + reginput += len; + } + break; + case ANYOF: + if (*reginput == '\0' || + STRCHR(OPERAND(scan), *reginput) == (char *)NULL) + return (0); + reginput++; + break; + case ANYBUT: + if (*reginput == '\0' || + STRCHR(OPERAND(scan), *reginput) != (char *)NULL) + return (0); + reginput++; + break; + case NOTHING: + break; + case BACK: + break; + case OPEN + 1: + case OPEN + 2: + case OPEN + 3: + case OPEN + 4: + case OPEN + 5: + case OPEN + 6: + case OPEN + 7: + case OPEN + 8: + case OPEN + 9:{ + register int no; + register char *save; + + no = OP(scan) - OPEN; + save = reginput; + + if (regmatch(nxt)) { + /* + * Don't set startp if some later invocation of the same + * parentheses already has. + */ + if (regstartp[no] == (char *)NULL) + regstartp[no] = save; + return (1); + } else + return (0); + } + + case CLOSE + 1: + case CLOSE + 2: + case CLOSE + 3: + case CLOSE + 4: + case CLOSE + 5: + case CLOSE + 6: + case CLOSE + 7: + case CLOSE + 8: + case CLOSE + 9:{ + register int no; + register char *save; + + no = OP(scan) - CLOSE; + save = reginput; + + if (regmatch(nxt)) { + /* + * Don't set endp if some later invocation of the same + * parentheses already has. + */ + if (regendp[no] == (char *)NULL) + regendp[no] = save; + return (1); + } else + return (0); + } + + case BRANCH:{ + register char *save; + + if (OP(nxt) != BRANCH) /* No choice. */ + nxt = OPERAND(scan); /* Avoid recursion. */ + else { + do { + save = reginput; + if (regmatch(OPERAND(scan))) + return (1); + reginput = save; + scan = regnext(scan); + } while (scan != (char *)NULL && OP(scan) == BRANCH); + return (0); + /* NOTREACHED */ + } + } + break; + case STAR:{ + register char nextch; + register int no; + register char *save; + register int minimum; + + /* + * Lookahead to avoid useless match attempts when we know + * what character comes next. + */ + nextch = '\0'; + if (OP(nxt) == EXACTLY) + nextch = *OPERAND(nxt); + minimum = (OP(scan) == STAR) ? 0 : 1; + save = reginput; + no = regrepeat(OPERAND(scan)); + while (no >= minimum) { + /* If it could work, try it. */ + if (nextch == '\0' || *reginput == nextch) + if (regmatch(nxt)) + return (1); + /* Couldn't or didn't -- back up. */ + no--; + reginput = save + no; + } + return (0); + } + + case END: + return (1); /* Success! */ + + default: + regerror("memory corruption"); + return (0); + + } + + scan = nxt; + } + + /* + * We get here only if there's trouble -- normally "case END" is the + * terminating point. + */ + regerror("corrupted pointers"); + return (0); +} + +/* + - regrepeat - repeatedly match something simple, report how many + */ + +static int regrepeat(char *p) +{ + register int count = 0; + register char *scan; + register char *opnd; + + scan = reginput; + opnd = OPERAND(p); + switch (OP(p)) { + case ANY: + count = strlen(scan); + scan += count; + break; + case EXACTLY: + while (*opnd == *scan) { + count++; + scan++; + } + break; + case ANYOF: + while (*scan != '\0' && STRCHR(opnd, *scan) != (char *)NULL) { + count++; + scan++; + } + break; + case ANYBUT: + while (*scan != '\0' && STRCHR(opnd, *scan) == (char *)NULL) { + count++; + scan++; + } + break; + default: /* Oh dear. Called inappropriately. */ + regerror("internal foulup"); + count = 0; /* Best compromise. */ + break; + } + reginput = scan; + + return (count); +} + + +/* + - regnext - dig the "nxt" pointer out of a node + */ + +static char *regnext(register char *p) +{ + register int offset; + + if (p == ®dummy) + return ((char *)NULL); + + offset = NEXT(p); + if (offset == 0) + return ((char *)NULL); + + if (OP(p) == BACK) + return (p - offset); + else + return (p + offset); +} + +#ifdef DEBUG + +STATIC char *regprop(); + +/* + - regdump - dump a regexp onto stdout in vaguely comprehensible form + */ +void regdump(regexp *r) +{ + register char *s; + register char op = EXACTLY; /* Arbitrary non-END op. */ + register char *nxt; + + s = r->program + 1; + while (op != END) { /* While that wasn't END last time... */ + op = OP(s); + printf("%2ld%s", (long)(s - r->program), regprop(s)); /* Where, what. */ + nxt = regnext(s); + if (nxt == (char *)NULL) /* nxt ptr. */ + printf("(0)"); + else + printf("(%ld)", (long)( (s - r->program) + (nxt - s))); + s += 3; + if (op == ANYOF || op == ANYBUT || op == EXACTLY) { + /* Literal string, where present. */ + while (*s != '\0') { + putchar(*s); + s++; + } + s++; + } + putchar('\n'); + } + + /* Header fields of interest. */ + if (r->regstart != '\0') + printf("start `%c' ", r->regstart); + if (r->reganch) + printf("anchored "); + if (r->regmust != (char *)NULL) + printf("must have \"%s\"", r->regmust); + printf("\n"); +} + +/* + - regprop - printable representation of opcode + */ + +static char *regprop(char *op) +{ + register char *p; + static char buf[50]; + + strcpy(buf, ":"); + + switch (OP(op)) { + case BOL: + p = "BOL"; + break; + case EOL: + p = "EOL"; + break; + case ANY: + p = "ANY"; + break; + case ANYOF: + p = "ANYOF"; + break; + case ANYBUT: + p = "ANYBUT"; + break; + case BRANCH: + p = "BRANCH"; + break; + case EXACTLY: + p = "EXACTLY"; + break; + case NOTHING: + p = "NOTHING"; + break; + case BACK: + p = "BACK"; + break; + case END: + p = "END"; + break; + case OPEN + 1: + case OPEN + 2: + case OPEN + 3: + case OPEN + 4: + case OPEN + 5: + case OPEN + 6: + case OPEN + 7: + case OPEN + 8: + case OPEN + 9: + sprintf(buf + strlen(buf), "OPEN%d", OP(op) - OPEN); + p = (char *)NULL; + break; + case CLOSE + 1: + case CLOSE + 2: + case CLOSE + 3: + case CLOSE + 4: + case CLOSE + 5: + case CLOSE + 6: + case CLOSE + 7: + case CLOSE + 8: + case CLOSE + 9: + sprintf(buf + strlen(buf), "CLOSE%d", OP(op) - CLOSE); + p = (char *)NULL; + break; + case STAR: + p = "STAR"; + break; + default: + regerror("corrupted opcode"); + p=(char *)NULL; + break; + } + if (p != (char *)NULL) + strcat(buf, p); + return (buf); +} +#endif + +/* + - regsub - perform substitutions after a regexp match + */ + +char *regsub(regexp *prog, char *source, char *dest, int n) +{ + register char *src; + register char *dst; + register char c; + register int no; + register int len; + extern char *strncpy(); + + if (prog == (regexp *)NULL || + source == (char *)NULL || dest == (char *)NULL) { + regerror("NULL parm to regsub"); + return NULL; + } + if (UCHARAT(prog->program) != MAGIC) { + regerror("damaged regexp fed to regsub"); + return NULL; + } + src = source; + dst = dest; + while ((c = *src++) != '\0') { + if (c == '&') + no = 0; + else if (c == '\\' && '0' <= *src && *src <= '9') + no = *src++ - '0'; + else + no = -1; + + if (no < 0) { /* Ordinary character. */ + if (c == '\\' && (*src == '\\' || *src == '&')) + c = *src++; + if (--n < 0) { /* amylaar */ + regerror("line too long"); + return NULL; + } + *dst++ = c; + } else if (prog->startp[no] != (char *)NULL && + prog->endp[no] != (char *)NULL) { + len = prog->endp[no] - prog->startp[no]; + if ( (n-=len) < 0 ) { /* amylaar */ + regerror("line too long"); + return NULL; + } + strncpy(dst, prog->startp[no], len); + dst += len; + if (len != 0 && *(dst - 1) == '\0') { /* strncpy hit NUL. */ + regerror("damaged match string"); + return NULL; + } + } + } + if (--n < 0) { /* amylaar */ + regerror("line too long"); + return NULL; + } + *dst = '\0'; + return dst; +} + + +#if 0 /* Use the local regerror() in ed.c */ + +void regerror(char *s) +{ + fprintf(stderr, "regexp(3): %s", s); + exit(1); +} +#endif /* 0 */ diff --git a/externals/mysql/extlib/regex/regfree.c b/externals/mysql/extlib/regex/regfree.c new file mode 100644 index 0000000..f764fcd --- /dev/null +++ b/externals/mysql/extlib/regex/regfree.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include "my_regex.h" + +#include "utils.h" +#include "regex2.h" + +/* + - regfree - free everything + = extern void regfree(regex_t *); + */ +void +my_regfree(preg) +my_regex_t *preg; +{ + register struct re_guts *g; + + if (preg->re_magic != MAGIC1) /* oops */ + return; /* nice to complain, but hard */ + + g = preg->re_g; + if (g == NULL || g->magic != MAGIC2) /* oops again */ + return; + preg->re_magic = 0; /* mark it invalid */ + g->magic = 0; /* mark it invalid */ + + if (g->strip != NULL) + free((char *)g->strip); + if (g->sets != NULL) + free((char *)g->sets); + if (g->setbits != NULL) + free((char *)g->setbits); + if (g->must != NULL) + free(g->must); + free((char *)g); +} diff --git a/externals/mysql/extlib/regex/reginit.c b/externals/mysql/extlib/regex/reginit.c new file mode 100644 index 0000000..5980de2 --- /dev/null +++ b/externals/mysql/extlib/regex/reginit.c @@ -0,0 +1,81 @@ +/* Init cclasses array from ctypes */ + +#include +#include +#include +#include "cclass.h" + +static my_bool regex_inited=0; + +void my_regex_init(CHARSET_INFO *cs) +{ + char buff[CCLASS_LAST][256]; + int count[CCLASS_LAST]; + uint i; + + if (!regex_inited) + { + regex_inited=1; + bzero((uchar*) &count,sizeof(count)); + + for (i=1 ; i<= 255; i++) + { + if (my_isalnum(cs,i)) + buff[CCLASS_ALNUM][count[CCLASS_ALNUM]++]=(char) i; + if (my_isalpha(cs,i)) + buff[CCLASS_ALPHA][count[CCLASS_ALPHA]++]=(char) i; + if (my_iscntrl(cs,i)) + buff[CCLASS_CNTRL][count[CCLASS_CNTRL]++]=(char) i; + if (my_isdigit(cs,i)) + buff[CCLASS_DIGIT][count[CCLASS_DIGIT]++]=(char) i; + if (my_isgraph(cs,i)) + buff[CCLASS_GRAPH][count[CCLASS_GRAPH]++]=(char) i; + if (my_islower(cs,i)) + buff[CCLASS_LOWER][count[CCLASS_LOWER]++]=(char) i; + if (my_isprint(cs,i)) + buff[CCLASS_PRINT][count[CCLASS_PRINT]++]=(char) i; + if (my_ispunct(cs,i)) + buff[CCLASS_PUNCT][count[CCLASS_PUNCT]++]=(char) i; + if (my_isspace(cs,i)) + buff[CCLASS_SPACE][count[CCLASS_SPACE]++]=(char) i; + if (my_isupper(cs,i)) + buff[CCLASS_UPPER][count[CCLASS_UPPER]++]=(char) i; + if (my_isxdigit(cs,i)) + buff[CCLASS_XDIGIT][count[CCLASS_XDIGIT]++]=(char) i; + } + buff[CCLASS_BLANK][0]=' '; + buff[CCLASS_BLANK][1]='\t'; + count[CCLASS_BLANK]=2; + for (i=0; i < CCLASS_LAST ; i++) + { + char *tmp=(char*) malloc(count[i]+1); + if (!tmp) + { + /* + This is very unlikely to happen as this function is called once + at program startup + */ + fprintf(stderr, + "Fatal error: Can't allocate memory in regex_init\n"); + exit(1); + } + memcpy(tmp,buff[i],count[i]*sizeof(char)); + tmp[count[i]]=0; + cclasses[i].chars=tmp; + } + } + return; +} + +void my_regex_end() +{ + if (regex_inited) + { + int i; + for (i=0; i < CCLASS_LAST ; i++) + free((char*) cclasses[i].chars); + regex_inited=0; + } +} + + diff --git a/externals/mysql/extlib/regex/split.c b/externals/mysql/extlib/regex/split.c new file mode 100644 index 0000000..bd2a53c --- /dev/null +++ b/externals/mysql/extlib/regex/split.c @@ -0,0 +1,316 @@ +#include +#include + +/* + - split - divide a string into fields, like awk split() + = int split(char *string, char *fields[], int nfields, char *sep); + */ +int /* number of fields, including overflow */ +split(string, fields, nfields, sep) +char *string; +char *fields[]; /* list is not NULL-terminated */ +int nfields; /* number of entries available in fields[] */ +char *sep; /* "" white, "c" single char, "ab" [ab]+ */ +{ + register char *p = string; + register char c; /* latest character */ + register char sepc = sep[0]; + register char sepc2; + register int fn; + register char **fp = fields; + register char *sepp; + register int trimtrail; + + /* white space */ + if (sepc == '\0') { + while ((c = *p++) == ' ' || c == '\t') + continue; + p--; + trimtrail = 1; + sep = (char*) " \t"; /* note, code below knows this is 2 long */ + sepc = ' '; + } else + trimtrail = 0; + sepc2 = sep[1]; /* now we can safely pick this up */ + + /* catch empties */ + if (*p == '\0') + return(0); + + /* single separator */ + if (sepc2 == '\0') { + fn = nfields; + for (;;) { + *fp++ = p; + fn--; + if (fn == 0) + break; + while ((c = *p++) != sepc) + if (c == '\0') + return(nfields - fn); + *(p-1) = '\0'; + } + /* we have overflowed the fields vector -- just count them */ + fn = nfields; + for (;;) { + while ((c = *p++) != sepc) + if (c == '\0') + return(fn); + fn++; + } + /* not reached */ + } + + /* two separators */ + if (sep[2] == '\0') { + fn = nfields; + for (;;) { + *fp++ = p; + fn--; + while ((c = *p++) != sepc && c != sepc2) + if (c == '\0') { + if (trimtrail && **(fp-1) == '\0') + fn++; + return(nfields - fn); + } + if (fn == 0) + break; + *(p-1) = '\0'; + while ((c = *p++) == sepc || c == sepc2) + continue; + p--; + } + /* we have overflowed the fields vector -- just count them */ + fn = nfields; + while (c != '\0') { + while ((c = *p++) == sepc || c == sepc2) + continue; + p--; + fn++; + while ((c = *p++) != '\0' && c != sepc && c != sepc2) + continue; + } + /* might have to trim trailing white space */ + if (trimtrail) { + p--; + while ((c = *--p) == sepc || c == sepc2) + continue; + p++; + if (*p != '\0') { + if (fn == nfields+1) + *p = '\0'; + fn--; + } + } + return(fn); + } + + /* n separators */ + fn = 0; + for (;;) { + if (fn < nfields) + *fp++ = p; + fn++; + for (;;) { + c = *p++; + if (c == '\0') + return(fn); + sepp = sep; + while ((sepc = *sepp++) != '\0' && sepc != c) + continue; + if (sepc != '\0') /* it was a separator */ + break; + } + if (fn < nfields) + *(p-1) = '\0'; + for (;;) { + c = *p++; + sepp = sep; + while ((sepc = *sepp++) != '\0' && sepc != c) + continue; + if (sepc == '\0') /* it wasn't a separator */ + break; + } + p--; + } + + /* not reached */ +} + +#ifdef TEST_SPLIT + + +/* + * test program + * pgm runs regression + * pgm sep splits stdin lines by sep + * pgm str sep splits str by sep + * pgm str sep n splits str by sep n times + */ +int +main(argc, argv) +int argc; +char *argv[]; +{ + char buf[512]; + register int n; +# define MNF 10 + char *fields[MNF]; + + if (argc > 4) + for (n = atoi(argv[3]); n > 0; n--) { + (void) strcpy(buf, argv[1]); + } + else if (argc > 3) + for (n = atoi(argv[3]); n > 0; n--) { + (void) strcpy(buf, argv[1]); + (void) split(buf, fields, MNF, argv[2]); + } + else if (argc > 2) + dosplit(argv[1], argv[2]); + else if (argc > 1) + while (fgets(buf, sizeof(buf), stdin) != NULL) { + buf[strlen(buf)-1] = '\0'; /* stomp newline */ + dosplit(buf, argv[1]); + } + else + regress(); + + exit(0); +} + +dosplit(string, seps) +char *string; +char *seps; +{ +# define NF 5 + char *fields[NF]; + register int nf; + + nf = split(string, fields, NF, seps); + print(nf, NF, fields); +} + +print(nf, nfp, fields) +int nf; +int nfp; +char *fields[]; +{ + register int fn; + register int bound; + + bound = (nf > nfp) ? nfp : nf; + printf("%d:\t", nf); + for (fn = 0; fn < bound; fn++) + printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n"); +} + +#define RNF 5 /* some table entries know this */ +struct { + char *str; + char *seps; + int nf; + char *fi[RNF]; +} tests[] = { + "", " ", 0, { "" }, + " ", " ", 2, { "", "" }, + "x", " ", 1, { "x" }, + "xy", " ", 1, { "xy" }, + "x y", " ", 2, { "x", "y" }, + "abc def g ", " ", 5, { "abc", "def", "", "g", "" }, + " a bcd", " ", 4, { "", "", "a", "bcd" }, + "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" }, + " a b c d ", " ", 6, { "", "a", "b", "c", "d " }, + + "", " _", 0, { "" }, + " ", " _", 2, { "", "" }, + "x", " _", 1, { "x" }, + "x y", " _", 2, { "x", "y" }, + "ab _ cd", " _", 2, { "ab", "cd" }, + " a_b c ", " _", 5, { "", "a", "b", "c", "" }, + "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" }, + " a b c d ", " _", 6, { "", "a", "b", "c", "d " }, + + "", " _~", 0, { "" }, + " ", " _~", 2, { "", "" }, + "x", " _~", 1, { "x" }, + "x y", " _~", 2, { "x", "y" }, + "ab _~ cd", " _~", 2, { "ab", "cd" }, + " a_b c~", " _~", 5, { "", "a", "b", "c", "" }, + "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" }, + "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " }, + + "", " _~-", 0, { "" }, + " ", " _~-", 2, { "", "" }, + "x", " _~-", 1, { "x" }, + "x y", " _~-", 2, { "x", "y" }, + "ab _~- cd", " _~-", 2, { "ab", "cd" }, + " a_b c~", " _~-", 5, { "", "a", "b", "c", "" }, + "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" }, + "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " }, + + "", " ", 0, { "" }, + " ", " ", 2, { "", "" }, + "x", " ", 1, { "x" }, + "xy", " ", 1, { "xy" }, + "x y", " ", 2, { "x", "y" }, + "abc def g ", " ", 4, { "abc", "def", "g", "" }, + " a bcd", " ", 3, { "", "a", "bcd" }, + "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" }, + " a b c d ", " ", 6, { "", "a", "b", "c", "d " }, + + "", "", 0, { "" }, + " ", "", 0, { "" }, + "x", "", 1, { "x" }, + "xy", "", 1, { "xy" }, + "x y", "", 2, { "x", "y" }, + "abc def g ", "", 3, { "abc", "def", "g" }, + "\t a bcd", "", 2, { "a", "bcd" }, + " a \tb\t c ", "", 3, { "a", "b", "c" }, + "a b c d e ", "", 5, { "a", "b", "c", "d", "e" }, + "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" }, + " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " }, + + NULL, NULL, 0, { NULL }, +}; + +regress() +{ + char buf[512]; + register int n; + char *fields[RNF+1]; + register int nf; + register int i; + register int printit; + register char *f; + + for (n = 0; tests[n].str != NULL; n++) { + (void) strcpy(buf, tests[n].str); + fields[RNF] = NULL; + nf = split(buf, fields, RNF, tests[n].seps); + printit = 0; + if (nf != tests[n].nf) { + printf("split `%s' by `%s' gave %d fields, not %d\n", + tests[n].str, tests[n].seps, nf, tests[n].nf); + printit = 1; + } else if (fields[RNF] != NULL) { + printf("split() went beyond array end\n"); + printit = 1; + } else { + for (i = 0; i < nf && i < RNF; i++) { + f = fields[i]; + if (f == NULL) + f = "(NULL)"; + if (strcmp(f, tests[n].fi[i]) != 0) { + printf("split `%s' by `%s', field %d is `%s', not `%s'\n", + tests[n].str, tests[n].seps, + i, fields[i], tests[n].fi[i]); + printit = 1; + } + } + } + if (printit) + print(nf, RNF, fields); + } +} +#endif diff --git a/externals/mysql/extlib/regex/utils.h b/externals/mysql/extlib/regex/utils.h new file mode 100644 index 0000000..8f85b70 --- /dev/null +++ b/externals/mysql/extlib/regex/utils.h @@ -0,0 +1,22 @@ +/* utility definitions */ +#ifdef _POSIX2_RE_DUP_MAX +#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */ +#else +#define DUPMAX 255 +#endif +#define RE_INFINITY (DUPMAX + 1) +#define NC (CHAR_MAX - CHAR_MIN + 1) +typedef unsigned char uch; + +/* switch off assertions (if not already off) if no REDEBUG */ +#ifndef REDEBUG +#ifndef NDEBUG +#define NDEBUG /* no assertions please */ +#endif +#endif +#include + +/* for old systems with bcopy() but no memmove() */ +#ifdef USEBCOPY +#define memmove(d, s, c) bcopy(s, d, c) +#endif diff --git a/externals/mysql/extlib/yassl/include/buffer.hpp b/externals/mysql/extlib/yassl/include/buffer.hpp new file mode 100644 index 0000000..a51bca9 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/buffer.hpp @@ -0,0 +1,207 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL buffer header defines input and output buffers to simulate streaming + * with SSL types and sockets + */ + +#ifndef yaSSL_BUFFER_HPP +#define yaSSL_BUFFER_HPP + +#include // assert +#include "yassl_types.hpp" // ysDelete +#include "memory.hpp" // mySTL::auto_ptr +#include STL_ALGORITHM_FILE + + +namespace STL = STL_NAMESPACE; + + +#ifdef _MSC_VER + // disable truncated debug symbols + #pragma warning(disable:4786) +#endif + + +namespace yaSSL { + +typedef unsigned char byte; +typedef unsigned int uint; +const uint AUTO = 0xFEEDBEEF; + + +// Checking Policy should implement a check function that tests whether the +// index is within the size limit of the array +struct Check { + void check(uint i, uint limit); +}; + + +struct NoCheck { + void check(uint, uint); +}; + +/* input_buffer operates like a smart c style array with a checking option, + * meant to be read from through [] with AUTO index or read(). + * Should only write to at/near construction with assign() or raw (e.g., recv) + * followed by add_size with the number of elements added by raw write. + * + * Not using vector because need checked []access, offset, and the ability to + * write to the buffer bulk wise and have the correct size + */ + +class input_buffer : public Check { + uint size_; // number of elements in buffer + uint current_; // current offset position in buffer + byte* buffer_; // storage for buffer + byte* end_; // end of storage marker +public: + input_buffer(); + + explicit input_buffer(uint s); + + // with assign + input_buffer(uint s, const byte* t, uint len); + + ~input_buffer(); + + // users can pass defualt zero length buffer and then allocate + void allocate(uint s); + + // for passing to raw writing functions at beginning, then use add_size + byte* get_buffer() const; + + // after a raw write user can set new size + // if you know the size before the write use assign() + void add_size(uint i); + + uint get_capacity() const; + + uint get_current() const; + + uint get_size() const; + + uint get_remaining() const; + + void set_current(uint i); + + // read only access through [], advance current + // user passes in AUTO index for ease of use + const byte& operator[](uint i); + + // end of input test + bool eof(); + + // peek ahead + byte peek() const; + + // write function, should use at/near construction + void assign(const byte* t, uint s); + + // use read to query input, adjusts current + void read(byte* dst, uint length); + +private: + input_buffer(const input_buffer&); // hide copy + input_buffer& operator=(const input_buffer&); // and assign +}; + + +/* output_buffer operates like a smart c style array with a checking option. + * Meant to be written to through [] with AUTO index or write(). + * Size (current) counter increases when written to. Can be constructed with + * zero length buffer but be sure to allocate before first use. + * Don't use add write for a couple bytes, use [] instead, way less overhead. + * + * Not using vector because need checked []access and the ability to + * write to the buffer bulk wise and retain correct size + */ +class output_buffer : public Check { + uint current_; // current offset and elements in buffer + byte* buffer_; // storage for buffer + byte* end_; // end of storage marker +public: + // default + output_buffer(); + + // with allocate + explicit output_buffer(uint s); + + // with assign + output_buffer(uint s, const byte* t, uint len); + + ~output_buffer(); + + uint get_size() const; + + uint get_capacity() const; + + void set_current(uint c); + + // users can pass defualt zero length buffer and then allocate + void allocate(uint s); + + // for passing to reading functions when finished + const byte* get_buffer() const; + + // allow write access through [], update current + // user passes in AUTO as index for ease of use + byte& operator[](uint i); + + // end of output test + bool eof(); + + void write(const byte* t, uint s); + +private: + output_buffer(const output_buffer&); // hide copy + output_buffer& operator=(const output_buffer&); // and assign +}; + + + + +// turn delete an incomplete type into comipler error instead of warning +template +inline void checked_delete(T* p) +{ + typedef char complete_type[sizeof(T) ? 1 : -1]; + (void)sizeof(complete_type); + ysDelete(p); +} + + +// checked delete functor increases effeciency, no indirection on function call +// sets pointer to zero so safe for std conatiners +struct del_ptr_zero +{ + template + void operator()(T*& p) const + { + T* tmp = 0; + STL::swap(tmp, p); + checked_delete(tmp); + } +}; + + + +} // naemspace + +#endif // yaSSL_BUUFER_HPP diff --git a/externals/mysql/extlib/yassl/include/cert_wrapper.hpp b/externals/mysql/extlib/yassl/include/cert_wrapper.hpp new file mode 100644 index 0000000..572b9f8 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/cert_wrapper.hpp @@ -0,0 +1,132 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* The certificate wrapper header defines certificate management functions + * + */ + + +#ifndef yaSSL_CERT_WRAPPER_HPP +#define yaSSL_CERT_WRAPPER_HPP + +#ifdef _MSC_VER + // disable truncated debug symbols + #pragma warning(disable:4786) +#endif + + +#include "yassl_types.hpp" // SignatureAlgorithm +#include "buffer.hpp" // input_buffer +#include "asn.hpp" // SignerList +#include "openssl/ssl.h" // internal and external use +#include STL_LIST_FILE +#include STL_ALGORITHM_FILE + + +namespace STL = STL_NAMESPACE; + + +namespace yaSSL { + +typedef unsigned char opaque; +class X509; // forward openSSL type + +using TaoCrypt::SignerList; + +// an x509 version 3 certificate +class x509 { + uint length_; + opaque* buffer_; +public: + explicit x509(uint sz); + ~x509(); + + uint get_length() const; + const opaque* get_buffer() const; + opaque* use_buffer(); + + x509(const x509&); + x509& operator=(const x509&); +private: + void Swap(x509&); +}; + + +// Certificate Manager keeps a list of the cert chain and public key +class CertManager { + typedef STL::list CertList; + + CertList list_; // self + input_buffer privateKey_; + + CertList peerList_; // peer + input_buffer peerPublicKey_; + X509* peerX509_; // peer's openSSL X509 + + SignatureAlgorithm keyType_; // self key type + SignatureAlgorithm peerKeyType_; // peer's key type + + SignerList signers_; // decoded CA keys and names + // plus verified chained certs + bool verifyPeer_; + bool verifyNone_; // no error if verify fails + bool failNoCert_; + bool sendVerify_; + VerifyCallback verifyCallback_; // user verify callback +public: + CertManager(); + ~CertManager(); + + void AddPeerCert(x509* x); // take ownership + void CopySelfCert(const x509* x); + int CopyCaCert(const x509* x); + int Validate(); + + int SetPrivateKey(const x509&); + + const x509* get_cert() const; + const opaque* get_peerKey() const; + const opaque* get_privateKey() const; + X509* get_peerX509() const; + SignatureAlgorithm get_keyType() const; + SignatureAlgorithm get_peerKeyType() const; + + uint get_peerKeyLength() const; + uint get_privateKeyLength() const; + + bool verifyPeer() const; + bool verifyNone() const; + bool failNoCert() const; + bool sendVerify() const; + + void setVerifyPeer(); + void setVerifyNone(); + void setFailNoCert(); + void setSendVerify(); + void setPeerX509(X509*); + void setVerifyCallback(VerifyCallback); +private: + CertManager(const CertManager&); // hide copy + CertManager& operator=(const CertManager&); // and assign +}; + + +} // naemspace + +#endif // yaSSL_CERT_WRAPPER_HPP diff --git a/externals/mysql/extlib/yassl/include/config.h b/externals/mysql/extlib/yassl/include/config.h new file mode 100644 index 0000000..adea8db --- /dev/null +++ b/externals/mysql/extlib/yassl/include/config.h @@ -0,0 +1,295 @@ + +/* Headers we may want to use. */ +/* #undef HAVE_ALLOCA_H */ +/* #undef HAVE_ARPA_INET_H */ +/* #undef HAVE_CRYPT_H */ +/* #undef HAVE_DIRENT_H */ +/* #undef HAVE_EXECINFO_H */ +#define HAVE_FCNTL_H 1 +/* #undef HAVE_FENV_H */ +#define HAVE_FLOAT_H 1 +/* #undef HAVE_FPU_CONTROL_H */ +/* #undef HAVE_GRP_H */ +/* #undef HAVE_IEEEFP_H */ +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +/* #undef HAVE_NETINET_IN_H */ +/* #undef HAVE_PATHS_H */ +/* #undef HAVE_PWD_H */ +/* #undef HAVE_SCHED_H */ +/* #undef HAVE_SELECT_H */ +#define HAVE_STDDEF_H 1 +#define HAVE_STDLIB_H 1 +/* #undef HAVE_STRINGS_H */ +#define HAVE_STRING_H 1 +/* #undef HAVE_SYNCH_H */ +/* #undef HAVE_SYSENT_H */ +/* #undef HAVE_SYS_FPU_H */ +/* #undef HAVE_SYS_IOCTL_H */ +/* #undef HAVE_SYS_IPC_H */ +/* #undef HAVE_SYS_MMAN_H */ +/* #undef HAVE_SYS_PRCTL_H */ +/* #undef HAVE_SYS_SELECT_H */ +/* #undef HAVE_SYS_SHM_H */ +/* #undef HAVE_SYS_SOCKET_H */ +#define HAVE_SYS_STAT_H 1 +/* #undef HAVE_SYS_STREAM_H */ +#define HAVE_SYS_TIMEB_H 1 +#define HAVE_SYS_TYPES_H 1 +/* #undef HAVE_SYS_UN_H */ +/* #undef HAVE_TERMIOS_H */ +/* #undef HAVE_TERMIO_H */ +/* #undef HAVE_UNISTD_H */ +/* #undef HAVE_UTIME_H */ + +/* Functions we may want to use. */ +#define HAVE_ACCESS 1 +/* #undef HAVE_AIOWAIT */ +/* #undef HAVE_ALARM */ +/* #undef HAVE_ALLOCA */ +/* #undef HAVE_BCMP */ +/* #undef HAVE_BFILL */ +/* #undef HAVE_BMOVE */ +/* #undef HAVE_BZERO */ +/* #undef HAVE_CLOCK_GETTIME */ +/* #undef HAVE_COMPRESS */ +/* #undef HAVE_CRYPT */ +/* #undef HAVE_DLERROR */ +/* #undef HAVE_DLOPEN */ +/* #undef HAVE_FCHMOD */ +/* #undef HAVE_FCNTL */ +/* #undef HAVE_FCONVERT */ +/* #undef HAVE_FDATASYNC */ +/* #undef HAVE_FESETROUND */ +/* #undef HAVE_FINITE */ +/* #undef HAVE_FP_EXCEPT */ +/* #undef HAVE_FSEEKO */ +/* #undef HAVE_FSYNC */ +/* #undef HAVE_GETADDRINFO */ +#define HAVE_GETCWD 1 +/* #undef HAVE_GETHOSTBYADDR_R */ +/* #undef HAVE_GETHOSTBYNAME_R */ +/* #undef HAVE_GETHRTIME */ +/* #undef HAVE_GETNAMEINFO */ +/* #undef HAVE_GETPAGESIZE */ +/* #undef HAVE_GETPASS */ +/* #undef HAVE_GETPASSPHRASE */ +/* #undef HAVE_GETPWNAM */ +/* #undef HAVE_GETPWUID */ +/* #undef HAVE_GETRLIMIT */ +/* #undef HAVE_GETRUSAGE */ +/* #undef HAVE_GETWD */ +/* #undef HAVE_GMTIME_R */ +/* #undef HAVE_INITGROUPS */ +/* #undef HAVE_ISNAN */ +#define HAVE_LDIV 1 +/* #undef HAVE_LOCALTIME_R */ +/* #undef HAVE_LOG2 */ +#define HAVE_LONGJMP 1 +/* #undef HAVE_LSTAT */ +/* #undef HAVE_MADVISE */ +/* #undef HAVE_DECL_MADVISE */ +/* #undef HAVE_MALLINFO */ +#define HAVE_MEMCPY 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMMOVE 1 +/* #undef HAVE_MKSTEMP */ +/* #undef HAVE_MLOCK */ +/* #undef HAVE_MLOCKALL */ +/* #undef HAVE_MMAP */ +/* #undef HAVE_MMAP64 */ +#define HAVE_PERROR 1 +/* #undef HAVE_POLL */ +/* #undef HAVE_PREAD */ +/* #undef HAVE_PTHREAD_ATTR_CREATE */ +/* #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE */ +/* #undef HAVE_PTHREAD_ATTR_SETPRIO */ +/* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */ +/* #undef HAVE_PTHREAD_ATTR_SETSCOPE */ +/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ +/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ +/* #undef HAVE_PTHREAD_INIT */ +/* #undef HAVE_PTHREAD_KEY_DELETE */ +/* #undef HAVE_PTHREAD_KEY_DELETE */ +/* #undef HAVE_PTHREAD_KILL */ +/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */ +/* #undef HAVE_PTHREAD_SETPRIO_NP */ +/* #undef HAVE_PTHREAD_SETSCHEDPARAM */ +/* #undef HAVE_PTHREAD_SIGMASK */ +/* #undef HAVE_PTHREAD_THREADMASK */ +/* #undef HAVE_PTHREAD_YIELD_NP */ +/* #undef HAVE_READDIR_R */ +/* #undef HAVE_READLINK */ +/* #undef HAVE_REALPATH */ +#define HAVE_RENAME 1 +/* #undef HAVE_RINT */ +/* #undef HAVE_SCHED_YIELD */ +/* #undef HAVE_SELECT */ +/* #undef HAVE_SETFD */ +/* #undef HAVE_SETFILEPOINTER */ +/* #undef HAVE_SIGACTION */ +/* #undef HAVE_SIGTHREADMASK */ +/* #undef HAVE_SIGWAIT */ +/* #undef HAVE_SLEEP */ +/* #undef HAVE_SNPRINTF */ +/* #undef HAVE_STPCPY */ +#define HAVE_STRERROR 1 +/* #undef HAVE_STRLCPY */ +#define HAVE_STRNLEN 1 +#define HAVE_STRPBRK 1 +/* #undef HAVE_STRSEP */ +#define HAVE_STRSTR 1 +/* #undef HAVE_STRTOK_R */ +/* #undef HAVE_STRTOK_R */ +#define HAVE_STRTOL 1 +/* #undef HAVE_STRTOLL */ +#define HAVE_STRTOUL 1 +/* #undef HAVE_STRTOULL */ +#define HAVE_TELL 1 +/* #undef HAVE_THR_SETCONCURRENCY */ +/* #undef HAVE_THR_YIELD */ +/* #undef HAVE_VASPRINTF */ +#define HAVE_VSNPRINTF 1 + +/* Symbols we may use */ +/* #undef HAVE_SYS_ERRLIST */ +/* used by stacktrace functions */ +/* #undef HAVE_BSS_START */ + +/* Does "struct timespec" have a "sec" and "nsec" field? */ +/* #undef HAVE_TIMESPEC_TS_SEC */ + +/* Types we may use */ +#define SIZEOF_CHAR 1 +#if SIZEOF_CHAR +# define HAVE_CHAR 1 +#endif + +#define SIZEOF_CHARP 4 +#if SIZEOF_CHARP +# define HAVE_CHARP 1 +#endif + +#define SIZEOF_SHORT 2 +#if SIZEOF_SHORT +# define HAVE_SHORT 1 +#endif + +#define SIZEOF_INT 4 +#if SIZEOF_INT +# define HAVE_INT 1 +#endif + +#define SIZEOF_LONG 4 +#if SIZEOF_LONG +# define HAVE_LONG 1 +#endif + +#define SIZEOF_LONG_LONG 8 +#if SIZEOF_LONG_LONG +# define HAVE_LONG_LONG 1 +#endif + +#define SIZEOF_OFF_T 4 +#if SIZEOF_OFF_T +# define HAVE_OFF_T 1 +#endif + +/* #undef SIZEOF_SIGSET_T */ +#if SIZEOF_SIGSET_T +# define HAVE_SIGSET_T 1 +#endif + +#define SIZEOF_SIZE_T 4 +#if SIZEOF_SIZE_T +# define HAVE_SIZE_T 1 +#endif + +/* #undef SIZEOF_UCHAR */ +#if SIZEOF_UCHAR +# define HAVE_UCHAR 1 +#endif + +/* #undef SIZEOF_UINT */ +#if SIZEOF_UINT +# define HAVE_UINT 1 +#endif + +/* #undef SIZEOF_ULONG */ +#if SIZEOF_ULONG +# define HAVE_ULONG 1 +#endif + +/* #undef SIZEOF_INT8 */ +#if SIZEOF_INT8 +# define HAVE_INT8 1 +#endif +/* #undef SIZEOF_UINT8 */ +#if SIZEOF_UINT8 +# define HAVE_UINT8 1 +#endif + +/* #undef SIZEOF_INT16 */ +#if SIZEOF_INT16 +# define HAVE_INT16 1 +#endif +/* #undef SIZEOF_UINT16 */ +#if SIZEOF_UINT16 +# define HAVE_UINT16 1 +#endif + +/* #undef SIZEOF_INT32 */ +#if SIZEOF_INT32 +# define HAVE_INT32 1 +#endif +/* #undef SIZEOF_UINT32 */ +#if SIZEOF_UINT32 +# define HAVE_UINT32 1 +#endif +/* #undef SIZEOF_U_INT32_T */ +#if SIZEOF_U_INT32_T +# define HAVE_U_INT32_T 1 +#endif + +/* #undef SIZEOF_INT64 */ +#if SIZEOF_INT64 +# define HAVE_INT64 1 +#endif +/* #undef SIZEOF_UINT64 */ +#if SIZEOF_UINT64 +# define HAVE_UINT64 1 +#endif + +/* #undef SIZEOF_SOCKLEN_T */ +#if SIZEOF_SOCKLEN_T +# define HAVE_SOCKLEN_T 1 +#endif + +/* XXX mysql_client_test uses this -- rip it out, please! */ +#define MAX_INDEXES 64 + +#define QSORT_TYPE_IS_VOID 1 +#define RETQSORTTYPE void + +#define SIGNAL_RETURN_TYPE_IS_VOID 1 +#define RETSIGTYPE void + +/* #undef WORDS_BIGENDIAN */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler calls + it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +# define inline +#endif + +#define TIME_WITH_SYS_TIME 1 + +#define STACK_DIRECTION -1 + +#define SHAREDIR "share" +#define THREAD 1 +#define THREAD_SAFE_CLIENT 1 + +#define DEFAULT_CHARSET_HOME "C:/mysql/" diff --git a/externals/mysql/extlib/yassl/include/crypto_wrapper.hpp b/externals/mysql/extlib/yassl/include/crypto_wrapper.hpp new file mode 100644 index 0000000..07b5925 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/crypto_wrapper.hpp @@ -0,0 +1,427 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* The crypto wrapper header is used to define policies for the cipher + * components used by SSL. There are 3 policies to consider: + * + * 1) MAC, the Message Authentication Code used for each Message + * 2) Bulk Cipher, the Cipher used to encrypt/decrypt each Message + * 3) Atuhentication, the Digitial Signing/Verifiaction scheme used + * + * This header doesn't rely on a specific crypto libraries internals, + * only the implementation should. + */ + + +#ifndef yaSSL_CRYPTO_WRAPPER_HPP +#define yaSSL_CRYPTO_WRAPPER_HPP + +#include "yassl_types.hpp" +#include // FILE + + +namespace yaSSL { + + +// Digest policy should implement a get_digest, update, and get sizes for pad +// and digest +struct Digest : public virtual_base { + virtual void get_digest(byte*) = 0; + virtual void get_digest(byte*, const byte*, unsigned int) = 0; + virtual void update(const byte*, unsigned int) = 0; + virtual uint get_digestSize() const = 0; + virtual uint get_padSize() const = 0; + virtual ~Digest() {} +}; + + +// For use with NULL Digests +struct NO_MAC : public Digest { + void get_digest(byte*); + void get_digest(byte*, const byte*, unsigned int); + void update(const byte*, unsigned int); + uint get_digestSize() const; + uint get_padSize() const; +}; + + +// MD5 Digest +class MD5 : public Digest { +public: + void get_digest(byte*); + void get_digest(byte*, const byte*, unsigned int); + void update(const byte*, unsigned int); + uint get_digestSize() const; + uint get_padSize() const; + MD5(); + ~MD5(); + MD5(const MD5&); + MD5& operator=(const MD5&); +private: + struct MD5Impl; + MD5Impl* pimpl_; +}; + + +// SHA-1 Digest +class SHA : public Digest { +public: + void get_digest(byte*); + void get_digest(byte*, const byte*, unsigned int); + void update(const byte*, unsigned int); + uint get_digestSize() const; + uint get_padSize() const; + SHA(); + ~SHA(); + SHA(const SHA&); + SHA& operator=(const SHA&); +private: + struct SHAImpl; + SHAImpl* pimpl_; + +}; + + +// RIPEMD-160 Digest +class RMD : public Digest { +public: + void get_digest(byte*); + void get_digest(byte*, const byte*, unsigned int); + void update(const byte*, unsigned int); + uint get_digestSize() const; + uint get_padSize() const; + RMD(); + ~RMD(); + RMD(const RMD&); + RMD& operator=(const RMD&); +private: + struct RMDImpl; + RMDImpl* pimpl_; + +}; + + +// HMAC_MD5 +class HMAC_MD5 : public Digest { +public: + void get_digest(byte*); + void get_digest(byte*, const byte*, unsigned int); + void update(const byte*, unsigned int); + uint get_digestSize() const; + uint get_padSize() const; + HMAC_MD5(const byte*, unsigned int); + ~HMAC_MD5(); +private: + struct HMAC_MD5Impl; + HMAC_MD5Impl* pimpl_; + + HMAC_MD5(const HMAC_MD5&); + HMAC_MD5& operator=(const HMAC_MD5&); +}; + + +// HMAC_SHA-1 +class HMAC_SHA : public Digest { +public: + void get_digest(byte*); + void get_digest(byte*, const byte*, unsigned int); + void update(const byte*, unsigned int); + uint get_digestSize() const; + uint get_padSize() const; + HMAC_SHA(const byte*, unsigned int); + ~HMAC_SHA(); +private: + struct HMAC_SHAImpl; + HMAC_SHAImpl* pimpl_; + + HMAC_SHA(const HMAC_SHA&); + HMAC_SHA& operator=(const HMAC_SHA&); +}; + + +// HMAC_RMD +class HMAC_RMD : public Digest { +public: + void get_digest(byte*); + void get_digest(byte*, const byte*, unsigned int); + void update(const byte*, unsigned int); + uint get_digestSize() const; + uint get_padSize() const; + HMAC_RMD(const byte*, unsigned int); + ~HMAC_RMD(); +private: + struct HMAC_RMDImpl; + HMAC_RMDImpl* pimpl_; + + HMAC_RMD(const HMAC_RMD&); + HMAC_RMD& operator=(const HMAC_RMD&); +}; + + +// BulkCipher policy should implement encrypt, decrypt, get block size, +// and set keys for encrypt and decrypt +struct BulkCipher : public virtual_base { + virtual void encrypt(byte*, const byte*, unsigned int) = 0; + virtual void decrypt(byte*, const byte*, unsigned int) = 0; + virtual void set_encryptKey(const byte*, const byte* = 0) = 0; + virtual void set_decryptKey(const byte*, const byte* = 0) = 0; + virtual uint get_blockSize() const = 0; + virtual int get_keySize() const = 0; + virtual int get_ivSize() const = 0; + virtual ~BulkCipher() {} +}; + + +// For use with NULL Ciphers +struct NO_Cipher : public BulkCipher { + void encrypt(byte*, const byte*, unsigned int) {} + void decrypt(byte*, const byte*, unsigned int) {} + void set_encryptKey(const byte*, const byte*) {} + void set_decryptKey(const byte*, const byte*) {} + uint get_blockSize() const { return 0; } + int get_keySize() const { return 0; } + int get_ivSize() const { return 0; } +}; + + +// SSLv3 and TLSv1 always use DES in CBC mode so IV is required +class DES : public BulkCipher { +public: + void encrypt(byte*, const byte*, unsigned int); + void decrypt(byte*, const byte*, unsigned int); + void set_encryptKey(const byte*, const byte*); + void set_decryptKey(const byte*, const byte*); + uint get_blockSize() const { return DES_BLOCK; } + int get_keySize() const { return DES_KEY_SZ; } + int get_ivSize() const { return DES_IV_SZ; } + DES(); + ~DES(); +private: + struct DESImpl; + DESImpl* pimpl_; + + DES(const DES&); // hide copy + DES& operator=(const DES&); // & assign +}; + + +// 3DES Encrypt-Decrypt-Encrypt in CBC mode +class DES_EDE : public BulkCipher { +public: + void encrypt(byte*, const byte*, unsigned int); + void decrypt(byte*, const byte*, unsigned int); + void set_encryptKey(const byte*, const byte*); + void set_decryptKey(const byte*, const byte*); + uint get_blockSize() const { return DES_BLOCK; } + int get_keySize() const { return DES_EDE_KEY_SZ; } + int get_ivSize() const { return DES_IV_SZ; } + DES_EDE(); + ~DES_EDE(); +private: + struct DES_EDEImpl; + DES_EDEImpl* pimpl_; + + DES_EDE(const DES_EDE&); // hide copy + DES_EDE& operator=(const DES_EDE&); // & assign +}; + + +// Alledged RC4 +class RC4 : public BulkCipher { +public: + void encrypt(byte*, const byte*, unsigned int); + void decrypt(byte*, const byte*, unsigned int); + void set_encryptKey(const byte*, const byte*); + void set_decryptKey(const byte*, const byte*); + uint get_blockSize() const { return 0; } + int get_keySize() const { return RC4_KEY_SZ; } + int get_ivSize() const { return 0; } + RC4(); + ~RC4(); +private: + struct RC4Impl; + RC4Impl* pimpl_; + + RC4(const RC4&); // hide copy + RC4& operator=(const RC4&); // & assign +}; + + +// AES +class AES : public BulkCipher { +public: + void encrypt(byte*, const byte*, unsigned int); + void decrypt(byte*, const byte*, unsigned int); + void set_encryptKey(const byte*, const byte*); + void set_decryptKey(const byte*, const byte*); + uint get_blockSize() const { return AES_BLOCK_SZ; } + int get_keySize() const; + int get_ivSize() const { return AES_IV_SZ; } + explicit AES(unsigned int = AES_128_KEY_SZ); + ~AES(); +private: + struct AESImpl; + AESImpl* pimpl_; + + AES(const AES&); // hide copy + AES& operator=(const AES&); // & assign +}; + + +// Random number generator +class RandomPool { +public: + void Fill(opaque* dst, uint sz) const; + RandomPool(); + ~RandomPool(); + + int GetError() const; + + friend class RSA; + friend class DSS; + friend class DiffieHellman; +private: + struct RandomImpl; + RandomImpl* pimpl_; + + RandomPool(const RandomPool&); // hide copy + RandomPool& operator=(const RandomPool&); // & assign +}; + + +// Authentication policy should implement sign, and verify +struct Auth : public virtual_base { + virtual void sign(byte*, const byte*, unsigned int, const RandomPool&) = 0; + virtual bool verify(const byte*, unsigned int, const byte*, + unsigned int) = 0; + virtual uint get_signatureLength() const = 0; + virtual ~Auth() {} +}; + + +// For use with NULL Authentication schemes +struct NO_Auth : public Auth { + void sign(byte*, const byte*, unsigned int, const RandomPool&) {} + bool verify(const byte*, unsigned int, const byte*, unsigned int) + { return true; } +}; + + +// Digitial Signature Standard scheme +class DSS : public Auth { +public: + void sign(byte*, const byte*, unsigned int, const RandomPool&); + bool verify(const byte*, unsigned int, const byte*, unsigned int); + uint get_signatureLength() const; + DSS(const byte*, unsigned int, bool publicKey = true); + ~DSS(); +private: + struct DSSImpl; + DSSImpl* pimpl_; + + DSS(const DSS&); + DSS& operator=(const DSS&); +}; + + +// RSA Authentication and exchange +class RSA : public Auth { +public: + void sign(byte*, const byte*, unsigned int, const RandomPool&); + bool verify(const byte*, unsigned int, const byte*, unsigned int); + void encrypt(byte*, const byte*, unsigned int, const RandomPool&); + void decrypt(byte*, const byte*, unsigned int, const RandomPool&); + uint get_signatureLength() const; + uint get_cipherLength() const; + RSA(const byte*, unsigned int, bool publicKey = true); + ~RSA(); +private: + struct RSAImpl; + RSAImpl* pimpl_; + + RSA(const RSA&); // hide copy + RSA& operator=(const RSA&); // & assing +}; + + +class Integer; + +// Diffie-Hellman agreement +// hide for now TODO: figure out a way to give access to C clients p and g args +class DiffieHellman { +public: + DiffieHellman(const byte*, unsigned int, const byte*, unsigned int, + const byte*, unsigned int, const RandomPool& random); + //DiffieHellman(const char*, const RandomPool&); + DiffieHellman(const Integer&, const Integer&, const RandomPool&); + ~DiffieHellman(); + + DiffieHellman(const DiffieHellman&); + DiffieHellman& operator=(const DiffieHellman&); + + uint get_agreedKeyLength() const; + const byte* get_agreedKey() const; + const byte* get_publicKey() const; + void makeAgreement(const byte*, unsigned int); + + void set_sizes(int&, int&, int&) const; + void get_parms(byte*, byte*, byte*) const; +private: + struct DHImpl; + DHImpl* pimpl_; +}; + + +// Lagrge Integer +class Integer { +public: + Integer(); + ~Integer(); + + Integer(const Integer&); + Integer& operator=(const Integer&); + + void assign(const byte*, unsigned int); + + friend class DiffieHellman; +private: + struct IntegerImpl; + IntegerImpl* pimpl_; +}; + + +class x509; + + +struct EncryptedInfo { + enum { IV_SZ = 32, NAME_SZ = 80 }; + char name[NAME_SZ]; // max one line + byte iv[IV_SZ]; // in base16 rep + uint ivSz; + bool set; + + EncryptedInfo() : ivSz(0), set(false) {} +}; + +x509* PemToDer(FILE*, CertType, EncryptedInfo* info = 0); + + +} // naemspace + +#endif // yaSSL_CRYPTO_WRAPPER_HPP diff --git a/externals/mysql/extlib/yassl/include/factory.hpp b/externals/mysql/extlib/yassl/include/factory.hpp new file mode 100644 index 0000000..e66e32d --- /dev/null +++ b/externals/mysql/extlib/yassl/include/factory.hpp @@ -0,0 +1,101 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* The factory header defines an Object Factory, used by SSL message and + * handshake types. + * + * See Desgin Pattern in GoF and Alexandrescu's chapter in Modern C++ Design, + * page 208 + */ + + + +#ifndef yaSSL_FACTORY_HPP +#define yaSSL_FACTORY_HPP + +#include STL_VECTOR_FILE +#include STL_PAIR_FILE + + +namespace STL = STL_NAMESPACE; + + + + + +namespace yaSSL { + + +// Factory uses its callback map to create objects by id, +// returning an abstract base pointer +template +class Factory { + typedef STL::pair CallBack; + typedef STL::vector CallBackVector; + + CallBackVector callbacks_; +public: + // pass function pointer to register all callbacks upon creation + explicit Factory(void (*init)(Factory&)) + { + init(*this); + } + + // reserve place in vector before registering, used by init funcion + void Reserve(size_t sz) + { + callbacks_.reserve(sz); + } + + // register callback + void Register(const IdentifierType& id, ProductCreator pc) + { + callbacks_.push_back(STL::make_pair(id, pc)); + } + + // THE Creator, returns a new object of the proper type or 0 + AbstractProduct* CreateObject(const IdentifierType& id) const + { + typedef typename STL::vector::const_iterator cIter; + + cIter first = callbacks_.begin(); + cIter last = callbacks_.end(); + + while (first != last) { + if (first->first == id) + break; + ++first; + } + + if (first == callbacks_.end()) + return 0; + return (first->second)(); + } +private: + Factory(const Factory&); // hide copy + Factory& operator=(const Factory&); // and assign +}; + + +} // naemspace + +#endif // yaSSL_FACTORY_HPP diff --git a/externals/mysql/extlib/yassl/include/handshake.hpp b/externals/mysql/extlib/yassl/include/handshake.hpp new file mode 100644 index 0000000..549a31b --- /dev/null +++ b/externals/mysql/extlib/yassl/include/handshake.hpp @@ -0,0 +1,69 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* The handshake header declares function prototypes for creating and reading + * the various handshake messages. + */ + + + +#ifndef yaSSL_HANDSHAKE_HPP +#define yaSSL_HANDSHAKE_HPP + +#include "yassl_types.hpp" + + +namespace yaSSL { + +// forward decls +class SSL; +class Finished; +class Data; +class Alert; +struct Hashes; + +enum BufferOutput { buffered, unbuffered }; + +void sendClientHello(SSL&); +void sendServerHello(SSL&, BufferOutput = buffered); +void sendServerHelloDone(SSL&, BufferOutput = buffered); +void sendClientKeyExchange(SSL&, BufferOutput = buffered); +void sendServerKeyExchange(SSL&, BufferOutput = buffered); +void sendChangeCipher(SSL&, BufferOutput = buffered); +void sendFinished(SSL&, ConnectionEnd, BufferOutput = buffered); +void sendCertificate(SSL&, BufferOutput = buffered); +void sendCertificateRequest(SSL&, BufferOutput = buffered); +void sendCertificateVerify(SSL&, BufferOutput = buffered); +int sendData(SSL&, const void*, int); +int sendAlert(SSL& ssl, const Alert& alert); + +int receiveData(SSL&, Data&, bool peek = false); +void processReply(SSL&); + +void buildFinished(SSL&, Finished&, const opaque*); +void build_certHashes(SSL&, Hashes&); + +void hmac(SSL&, byte*, const byte*, uint, ContentType, bool verify = false); +void TLS_hmac(SSL&, byte*, const byte*, uint, ContentType, + bool verify = false); +void PRF(byte* digest, uint digLen, const byte* secret, uint secLen, + const byte* label, uint labLen, const byte* seed, uint seedLen); + +} // naemspace + +#endif // yaSSL_HANDSHAKE_HPP diff --git a/externals/mysql/extlib/yassl/include/lock.hpp b/externals/mysql/extlib/yassl/include/lock.hpp new file mode 100644 index 0000000..0525943 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/lock.hpp @@ -0,0 +1,87 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* lock.hpp provides an os specific Lock, locks mutex on entry and unlocks + * automatically upon exit, no-ops provided for Single Threaded +*/ + +#ifndef yaSSL_LOCK_HPP +#define yaSSL_LOCK_HPP + + +namespace yaSSL { + + +#ifdef MULTI_THREADED + #ifdef _WIN32 + #include + + class Mutex { + CRITICAL_SECTION cs_; + public: + Mutex(); + ~Mutex(); + + class Lock; + friend class Lock; + + class Lock { + Mutex& mutex_; + public: + explicit Lock(Mutex& lm); + ~Lock(); + }; + }; + #else // _WIN32 + #include + + class Mutex { + pthread_mutex_t mutex_; + public: + + Mutex(); + ~Mutex(); + + class Lock; + friend class Lock; + + class Lock { + Mutex& mutex_; + public: + explicit Lock(Mutex& lm); + ~Lock(); + }; + }; + + #endif // _WIN32 +#else // MULTI_THREADED (WE'RE SINGLE) + + class Mutex { + public: + class Lock { + public: + explicit Lock(Mutex&) {} + }; + }; + +#endif // MULTI_THREADED + + + +} // namespace +#endif // yaSSL_LOCK_HPP diff --git a/externals/mysql/extlib/yassl/include/log.hpp b/externals/mysql/extlib/yassl/include/log.hpp new file mode 100644 index 0000000..fb480ee --- /dev/null +++ b/externals/mysql/extlib/yassl/include/log.hpp @@ -0,0 +1,55 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL log interface + * + */ + +#ifndef yaSSL_LOG_HPP +#define yaSSL_LOG_HPP + +#include "socket_wrapper.hpp" + +#ifdef YASSL_LOG +#include +#endif + +namespace yaSSL { + +typedef unsigned int uint; + + +// Debug logger +class Log { +#ifdef YASSL_LOG + FILE* log_; +#endif +public: + explicit Log(const char* str = "yaSSL.log"); + ~Log(); + + void Trace(const char*); + void ShowTCP(socket_t, bool ended = false); + void ShowData(uint, bool sent = false); +}; + + +} // naemspace + +#endif // yaSSL_LOG_HPP diff --git a/externals/mysql/extlib/yassl/include/openssl/crypto.h b/externals/mysql/extlib/yassl/include/openssl/crypto.h new file mode 100644 index 0000000..f53e523 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/crypto.h @@ -0,0 +1,18 @@ +/* crypto.h for openSSL */ + +#ifndef ysSSL_crypto_h__ +#define yaSSL_crypto_h__ + +#ifdef YASSL_PREFIX +#include "prefix_crypto.h" +#endif + +const char* SSLeay_version(int type); + +#define SSLEAY_NUMBER_DEFINED +#define SSLEAY_VERSION 0x0900L +#define SSLEAY_VERSION_NUMBER SSLEAY_VERSION + + +#endif /* yaSSL_crypto_h__ */ + diff --git a/externals/mysql/extlib/yassl/include/openssl/des.h b/externals/mysql/extlib/yassl/include/openssl/des.h new file mode 100644 index 0000000..67be7ee --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/des.h @@ -0,0 +1 @@ +/* des.h for openssl */ diff --git a/externals/mysql/extlib/yassl/include/openssl/des_old.h b/externals/mysql/extlib/yassl/include/openssl/des_old.h new file mode 100644 index 0000000..40e8fbc --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/des_old.h @@ -0,0 +1 @@ +/* des_old.h for openvn */ diff --git a/externals/mysql/extlib/yassl/include/openssl/engine.h b/externals/mysql/extlib/yassl/include/openssl/engine.h new file mode 100644 index 0000000..39952fc --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/engine.h @@ -0,0 +1,5 @@ +/* engine.h for libcurl */ + +#undef HAVE_OPENSSL_ENGINE_H + + diff --git a/externals/mysql/extlib/yassl/include/openssl/err.h b/externals/mysql/extlib/yassl/include/openssl/err.h new file mode 100644 index 0000000..45ac1ca --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/err.h @@ -0,0 +1,8 @@ +/* err.h for openssl */ + +#ifndef yaSSL_err_h__ +#define yaSSL_err_h__ + + + +#endif /* yaSSL_err_h__ */ diff --git a/externals/mysql/extlib/yassl/include/openssl/evp.h b/externals/mysql/extlib/yassl/include/openssl/evp.h new file mode 100644 index 0000000..1d66b08 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/evp.h @@ -0,0 +1,10 @@ +/* evp.h for openSSL */ + +#ifndef SSLEAY_NUMBER_DEFINED +#define SSLEAY_NUMBER_DEFINED + +/* for OpenVPN */ +#define SSLEAY_VERSION_NUMBER 0x0090700f + + +#endif /* SSLEAY_NUMBER_DEFINED */ diff --git a/externals/mysql/extlib/yassl/include/openssl/generate_prefix_files.pl b/externals/mysql/extlib/yassl/include/openssl/generate_prefix_files.pl new file mode 100644 index 0000000..da591b3 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/generate_prefix_files.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl +# +# This script generates defines for all functions +# in yassl/include/openssl/ so they are renamed to +# ya. Hopefully that is unique enough. +# +# The script is to be run manually when we import +# a new version of yaSSL +# + + + +# Find all functions in "input" and add macros +# to prefix/rename them into "output +sub generate_prefix($$) +{ + my $input= shift; + my $output= shift; + open(IN, $input) + or die("Can't open input file $input: $!"); + open(OUT, ">", $output) + or mtr_error("Can't open output file $output: $!"); + + while () + { + chomp; + + if ( /typedef/ ) + { + next; + } + + if ( /^\s*[a-zA-Z0-9*_ ]+\s+\*?([_a-zA-Z0-9]+)\s*\(/ ) + { + print OUT "#define $1 ya$1\n"; + } + } + + close OUT; + close IN; +} + +generate_prefix("ssl.h", "prefix_ssl.h"); +generate_prefix("crypto.h", "prefix_crypto.h"); + diff --git a/externals/mysql/extlib/yassl/include/openssl/hmac.h b/externals/mysql/extlib/yassl/include/openssl/hmac.h new file mode 100644 index 0000000..a2eae4c --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/hmac.h @@ -0,0 +1 @@ +/* hmac.h for openvpn */ diff --git a/externals/mysql/extlib/yassl/include/openssl/lhash.h b/externals/mysql/extlib/yassl/include/openssl/lhash.h new file mode 100644 index 0000000..01f8535 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/lhash.h @@ -0,0 +1,2 @@ +/* lhash.h for openSSL */ + diff --git a/externals/mysql/extlib/yassl/include/openssl/md4.h b/externals/mysql/extlib/yassl/include/openssl/md4.h new file mode 100644 index 0000000..2e99f97 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/md4.h @@ -0,0 +1 @@ +/* md4.h for libcurl */ diff --git a/externals/mysql/extlib/yassl/include/openssl/md5.h b/externals/mysql/extlib/yassl/include/openssl/md5.h new file mode 100644 index 0000000..dfaf979 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/md5.h @@ -0,0 +1,4 @@ +/* md5.h for openssl */ + +#include "ssl.h" /* in there for now */ + diff --git a/externals/mysql/extlib/yassl/include/openssl/objects.h b/externals/mysql/extlib/yassl/include/openssl/objects.h new file mode 100644 index 0000000..99f2326 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/objects.h @@ -0,0 +1 @@ +/* objects.h for openvpn */ diff --git a/externals/mysql/extlib/yassl/include/openssl/opensslv.h b/externals/mysql/extlib/yassl/include/openssl/opensslv.h new file mode 100644 index 0000000..d932130 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/opensslv.h @@ -0,0 +1,12 @@ +/* opensslv.h compatibility */ + +#ifndef yaSSL_opensslv_h__ +#define yaSSL_opensslv_h__ + + +/* api version compatibility */ +#define OPENSSL_VERSION_NUMBER 0x0090700f + + +#endif /* yaSSLopensslv_h__ */ + diff --git a/externals/mysql/extlib/yassl/include/openssl/pem.h b/externals/mysql/extlib/yassl/include/openssl/pem.h new file mode 100644 index 0000000..b4c63d5 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/pem.h @@ -0,0 +1 @@ +/* pem.h for libcurl */ diff --git a/externals/mysql/extlib/yassl/include/openssl/pkcs12.h b/externals/mysql/extlib/yassl/include/openssl/pkcs12.h new file mode 100644 index 0000000..e452fc8 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/pkcs12.h @@ -0,0 +1,5 @@ +/* pkcs12.h for libcurl */ + + +#undef HAVE_OPENSSL_PKCS12_H + diff --git a/externals/mysql/extlib/yassl/include/openssl/prefix_crypto.h b/externals/mysql/extlib/yassl/include/openssl/prefix_crypto.h new file mode 100644 index 0000000..3fa5f32 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/prefix_crypto.h @@ -0,0 +1 @@ +#define SSLeay_version yaSSLeay_version diff --git a/externals/mysql/extlib/yassl/include/openssl/prefix_ssl.h b/externals/mysql/extlib/yassl/include/openssl/prefix_ssl.h new file mode 100644 index 0000000..138d9fb --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/prefix_ssl.h @@ -0,0 +1,169 @@ +#define Copyright yaCopyright +#define yaSSL_CleanUp yayaSSL_CleanUp +#define BN_bin2bn yaBN_bin2bn +#define DH_new yaDH_new +#define DH_free yaDH_free +#define RSA_free yaRSA_free +#define RSA_generate_key yaRSA_generate_key +#define X509_free yaX509_free +#define X509_STORE_CTX_get_current_cert yaX509_STORE_CTX_get_current_cert +#define X509_STORE_CTX_get_error yaX509_STORE_CTX_get_error +#define X509_STORE_CTX_get_error_depth yaX509_STORE_CTX_get_error_depth +#define X509_NAME_oneline yaX509_NAME_oneline +#define X509_get_issuer_name yaX509_get_issuer_name +#define X509_get_subject_name yaX509_get_subject_name +#define X509_verify_cert_error_string yaX509_verify_cert_error_string +#define X509_LOOKUP_add_dir yaX509_LOOKUP_add_dir +#define X509_LOOKUP_load_file yaX509_LOOKUP_load_file +#define X509_LOOKUP_hash_dir yaX509_LOOKUP_hash_dir +#define X509_LOOKUP_file yaX509_LOOKUP_file +#define X509_STORE_add_lookup yaX509_STORE_add_lookup +#define X509_STORE_new yaX509_STORE_new +#define X509_STORE_get_by_subject yaX509_STORE_get_by_subject +#define ERR_get_error_line_data yaERR_get_error_line_data +#define ERR_print_errors_fp yaERR_print_errors_fp +#define ERR_error_string yaERR_error_string +#define ERR_remove_state yaERR_remove_state +#define ERR_get_error yaERR_get_error +#define ERR_peek_error yaERR_peek_error +#define ERR_GET_REASON yaERR_GET_REASON +#define SSL_CTX_new yaSSL_CTX_new +#define SSL_new yaSSL_new +#define SSL_set_fd yaSSL_set_fd +#define SSL_get_fd yaSSL_get_fd +#define SSL_connect yaSSL_connect +#define SSL_write yaSSL_write +#define SSL_read yaSSL_read +#define SSL_accept yaSSL_accept +#define SSL_CTX_free yaSSL_CTX_free +#define SSL_free yaSSL_free +#define SSL_clear yaSSL_clear +#define SSL_shutdown yaSSL_shutdown +#define SSL_set_connect_state yaSSL_set_connect_state +#define SSL_set_accept_state yaSSL_set_accept_state +#define SSL_do_handshake yaSSL_do_handshake +#define SSL_get_cipher yaSSL_get_cipher +#define SSL_get_cipher_name yaSSL_get_cipher_name +#define SSL_get_shared_ciphers yaSSL_get_shared_ciphers +#define SSL_get_cipher_list yaSSL_get_cipher_list +#define SSL_get_version yaSSL_get_version +#define SSLeay_version yaSSLeay_version +#define SSL_get_error yaSSL_get_error +#define SSL_load_error_strings yaSSL_load_error_strings +#define SSL_set_session yaSSL_set_session +#define SSL_get_session yaSSL_get_session +#define SSL_flush_sessions yaSSL_flush_sessions +#define SSL_SESSION_set_timeout yaSSL_SESSION_set_timeout +#define SSL_CTX_set_session_cache_mode yaSSL_CTX_set_session_cache_mode +#define SSL_get_peer_certificate yaSSL_get_peer_certificate +#define SSL_get_verify_result yaSSL_get_verify_result +#define SSL_CTX_set_verify yaSSL_CTX_set_verify +#define SSL_CTX_load_verify_locations yaSSL_CTX_load_verify_locations +#define SSL_CTX_set_default_verify_paths yaSSL_CTX_set_default_verify_paths +#define SSL_CTX_check_private_key yaSSL_CTX_check_private_key +#define SSL_CTX_set_session_id_context yaSSL_CTX_set_session_id_context +#define SSL_CTX_set_tmp_rsa_callback yaSSL_CTX_set_tmp_rsa_callback +#define SSL_CTX_set_options yaSSL_CTX_set_options +#define SSL_CTX_set_session_cache_mode yaSSL_CTX_set_session_cache_mode +#define SSL_CTX_set_timeout yaSSL_CTX_set_timeout +#define SSL_CTX_use_certificate_chain_file yaSSL_CTX_use_certificate_chain_file +#define SSL_CTX_set_default_passwd_cb yaSSL_CTX_set_default_passwd_cb +#define SSL_CTX_use_RSAPrivateKey_file yaSSL_CTX_use_RSAPrivateKey_file +#define SSL_CTX_set_info_callback yaSSL_CTX_set_info_callback +#define SSL_CTX_sess_accept yaSSL_CTX_sess_accept +#define SSL_CTX_sess_connect yaSSL_CTX_sess_connect +#define SSL_CTX_sess_accept_good yaSSL_CTX_sess_accept_good +#define SSL_CTX_sess_connect_good yaSSL_CTX_sess_connect_good +#define SSL_CTX_sess_accept_renegotiate yaSSL_CTX_sess_accept_renegotiate +#define SSL_CTX_sess_connect_renegotiate yaSSL_CTX_sess_connect_renegotiate +#define SSL_CTX_sess_hits yaSSL_CTX_sess_hits +#define SSL_CTX_sess_cb_hits yaSSL_CTX_sess_cb_hits +#define SSL_CTX_sess_cache_full yaSSL_CTX_sess_cache_full +#define SSL_CTX_sess_misses yaSSL_CTX_sess_misses +#define SSL_CTX_sess_timeouts yaSSL_CTX_sess_timeouts +#define SSL_CTX_sess_number yaSSL_CTX_sess_number +#define SSL_CTX_sess_get_cache_size yaSSL_CTX_sess_get_cache_size +#define SSL_CTX_get_verify_mode yaSSL_CTX_get_verify_mode +#define SSL_get_verify_mode yaSSL_get_verify_mode +#define SSL_CTX_get_verify_depth yaSSL_CTX_get_verify_depth +#define SSL_get_verify_depth yaSSL_get_verify_depth +#define SSL_get_default_timeout yaSSL_get_default_timeout +#define SSL_CTX_get_session_cache_mode yaSSL_CTX_get_session_cache_mode +#define SSL_session_reused yaSSL_session_reused +#define SSL_set_rfd yaSSL_set_rfd +#define SSL_set_wfd yaSSL_set_wfd +#define SSL_set_shutdown yaSSL_set_shutdown +#define SSL_set_quiet_shutdown yaSSL_set_quiet_shutdown +#define SSL_get_quiet_shutdown yaSSL_get_quiet_shutdown +#define SSL_want_read yaSSL_want_read +#define SSL_want_write yaSSL_want_write +#define SSL_pending yaSSL_pending +#define SSLv3_method yaSSLv3_method +#define SSLv3_server_method yaSSLv3_server_method +#define SSLv3_client_method yaSSLv3_client_method +#define TLSv1_server_method yaTLSv1_server_method +#define TLSv1_client_method yaTLSv1_client_method +#define TLSv1_1_server_method yaTLSv1_1_server_method +#define TLSv1_1_client_method yaTLSv1_1_client_method +#define SSLv23_server_method yaSSLv23_server_method +#define SSL_CTX_use_certificate_file yaSSL_CTX_use_certificate_file +#define SSL_CTX_use_PrivateKey_file yaSSL_CTX_use_PrivateKey_file +#define SSL_CTX_set_cipher_list yaSSL_CTX_set_cipher_list +#define SSL_CTX_sess_set_cache_size yaSSL_CTX_sess_set_cache_size +#define SSL_CTX_set_tmp_dh yaSSL_CTX_set_tmp_dh +#define OpenSSL_add_all_algorithms yaOpenSSL_add_all_algorithms +#define SSL_library_init yaSSL_library_init +#define SSLeay_add_ssl_algorithms yaSSLeay_add_ssl_algorithms +#define SSL_get_current_cipher yaSSL_get_current_cipher +#define SSL_CIPHER_description yaSSL_CIPHER_description +#define SSL_alert_type_string_long yaSSL_alert_type_string_long +#define SSL_alert_desc_string_long yaSSL_alert_desc_string_long +#define SSL_state_string_long yaSSL_state_string_long +#define EVP_md5 yaEVP_md5 +#define EVP_des_ede3_cbc yaEVP_des_ede3_cbc +#define EVP_BytesToKey yaEVP_BytesToKey +#define DES_set_key_unchecked yaDES_set_key_unchecked +#define DES_ede3_cbc_encrypt yaDES_ede3_cbc_encrypt +#define RAND_screen yaRAND_screen +#define RAND_file_name yaRAND_file_name +#define RAND_write_file yaRAND_write_file +#define RAND_load_file yaRAND_load_file +#define RAND_status yaRAND_status +#define RAND_bytes yaRAND_bytes +#define DES_set_key yaDES_set_key +#define DES_set_odd_parity yaDES_set_odd_parity +#define DES_ecb_encrypt yaDES_ecb_encrypt +#define SSL_CTX_set_default_passwd_cb_userdata yaSSL_CTX_set_default_passwd_cb_userdata +#define SSL_SESSION_free yaSSL_SESSION_free +#define SSL_peek yaSSL_peek +#define SSL_get_certificate yaSSL_get_certificate +#define SSL_get_privatekey yaSSL_get_privatekey +#define X509_get_pubkey yaX509_get_pubkey +#define EVP_PKEY_copy_parameters yaEVP_PKEY_copy_parameters +#define EVP_PKEY_free yaEVP_PKEY_free +#define ERR_error_string_n yaERR_error_string_n +#define ERR_free_strings yaERR_free_strings +#define EVP_cleanup yaEVP_cleanup +#define X509_get_ext_d2i yaX509_get_ext_d2i +#define GENERAL_NAMES_free yaGENERAL_NAMES_free +#define sk_GENERAL_NAME_num yask_GENERAL_NAME_num +#define sk_GENERAL_NAME_value yask_GENERAL_NAME_value +#define ASN1_STRING_data yaASN1_STRING_data +#define ASN1_STRING_length yaASN1_STRING_length +#define ASN1_STRING_type yaASN1_STRING_type +#define X509_NAME_get_index_by_NID yaX509_NAME_get_index_by_NID +#define X509_NAME_ENTRY_get_data yaX509_NAME_ENTRY_get_data +#define X509_NAME_get_entry yaX509_NAME_get_entry +#define ASN1_STRING_to_UTF8 yaASN1_STRING_to_UTF8 +#define SSLv23_client_method yaSSLv23_client_method +#define SSLv2_client_method yaSSLv2_client_method +#define SSL_get1_session yaSSL_get1_session +#define X509_get_notBefore yaX509_get_notBefore +#define X509_get_notAfter yaX509_get_notAfter +#define MD4_Init yaMD4_Init +#define MD4_Update yaMD4_Update +#define MD4_Final yaMD4_Final +#define MD5_Init yaMD5_Init +#define MD5_Update yaMD5_Update +#define MD5_Final yaMD5_Final +#define SSL_set_compression yaSSL_set_compression diff --git a/externals/mysql/extlib/yassl/include/openssl/rand.h b/externals/mysql/extlib/yassl/include/openssl/rand.h new file mode 100644 index 0000000..df9c902 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/rand.h @@ -0,0 +1,2 @@ +/* rand.h for openSSL */ + diff --git a/externals/mysql/extlib/yassl/include/openssl/rsa.h b/externals/mysql/extlib/yassl/include/openssl/rsa.h new file mode 100644 index 0000000..fe64e65 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/rsa.h @@ -0,0 +1,10 @@ +/* rsa.h for openSSL */ + + +#ifndef yaSSL_rsa_h__ +#define yaSSL_rsa_h__ + +enum { RSA_F4 = 1 }; + + +#endif /* yaSSL_rsa_h__ */ diff --git a/externals/mysql/extlib/yassl/include/openssl/sha.h b/externals/mysql/extlib/yassl/include/openssl/sha.h new file mode 100644 index 0000000..bb487c0 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/sha.h @@ -0,0 +1 @@ +/* sha.h for openvpn */ diff --git a/externals/mysql/extlib/yassl/include/openssl/ssl.h b/externals/mysql/extlib/yassl/include/openssl/ssl.h new file mode 100644 index 0000000..05b34a0 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/ssl.h @@ -0,0 +1,554 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* ssl.h defines openssl compatibility layer + * + */ + + + +#ifndef yaSSL_openssl_h__ +#define yaSSL_openssl_h__ + +#ifdef YASSL_PREFIX +#include "prefix_ssl.h" +#endif + +#include /* ERR_print fp */ +#include "opensslv.h" /* for version number */ +#include "rsa.h" + + +#define YASSL_VERSION "1.7.2" + + +#if defined(__cplusplus) +extern "C" { +#endif + + void yaSSL_CleanUp(); /* call once at end of application use to + free static singleton memory holders, + not a leak per se, but helpful when + looking for them */ + +#if defined(__cplusplus) +} // extern +#endif + +#if defined(__cplusplus) && !defined(YASSL_MYSQL_COMPATIBLE) +namespace yaSSL { +extern "C" { +#endif + +#undef X509_NAME /* wincrypt.h clash */ + +#if defined(__cplusplus) && !defined(YASSL_MYSQL_COMPATIBLE) + class SSL; + class SSL_SESSION; + class SSL_METHOD; + class SSL_CTX; + class SSL_CIPHER; + + class RSA; + + class X509; + class X509_NAME; +#else + typedef struct SSL SSL; + typedef struct SSL_SESSION SSL_SESSION; + typedef struct SSL_METHOD SSL_METHOD; + typedef struct SSL_CTX SSL_CTX; + typedef struct SSL_CIPHER SSL_CIPHER; + + typedef struct RSA RSA; + + typedef struct X509 X509; + typedef struct X509_NAME X509_NAME; +#endif + + +/* Big Number stuff, different file? */ +typedef struct BIGNUM BIGNUM; + +BIGNUM *BN_bin2bn(const unsigned char*, int, BIGNUM*); + + +/* Diffie-Hellman stuff, different file? */ +/* mySQL deferences to set group parameters */ +typedef struct DH { + BIGNUM* p; + BIGNUM* g; +} DH; + +DH* DH_new(void); +void DH_free(DH*); + +/* RSA stuff */ + +void RSA_free(RSA*); +RSA* RSA_generate_key(int, unsigned long, void(*)(int, int, void*), void*); + + +/* X509 stuff, different file? */ + +typedef struct X509_STORE X509_STORE; +typedef struct X509_LOOKUP X509_LOOKUP; +typedef struct X509_OBJECT { char c; } X509_OBJECT; +typedef struct X509_CRL X509_CRL; +typedef struct X509_REVOKED X509_REVOKED; +typedef struct X509_LOOKUP_METHOD X509_LOOKUP_METHOD; + + +void X509_free(X509*); + + +/* bio stuff */ +typedef struct BIO BIO; + +/* ASN stuff */ + + + +/* because mySQL dereferences to use error and current_cert, even after calling + * get functions for local references */ +typedef struct X509_STORE_CTX { + int error; + int error_depth; + X509* current_cert; +} X509_STORE_CTX; + + + +X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX*); +int X509_STORE_CTX_get_error(X509_STORE_CTX*); +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX*); + +char* X509_NAME_oneline(X509_NAME*, char*, int); +X509_NAME* X509_get_issuer_name(X509*); +X509_NAME* X509_get_subject_name(X509*); +const char* X509_verify_cert_error_string(long); + +int X509_LOOKUP_add_dir(X509_LOOKUP*, const char*, long); +int X509_LOOKUP_load_file(X509_LOOKUP*, const char*, long); +X509_LOOKUP_METHOD* X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD* X509_LOOKUP_file(void); + +X509_LOOKUP* X509_STORE_add_lookup(X509_STORE*, X509_LOOKUP_METHOD*); +X509_STORE* X509_STORE_new(void); +int X509_STORE_get_by_subject(X509_STORE_CTX*, int, X509_NAME*, + X509_OBJECT*); + + + + +enum { /* X509 Constants */ + X509_V_OK = 0, + X509_V_ERR_CERT_CHAIN_TOO_LONG = 1, + X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT = 2, + X509_V_ERR_CERT_NOT_YET_VALID = 3, + X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD = 4, + X509_V_ERR_CERT_HAS_EXPIRED = 5, + X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD = 6, + X509_FILETYPE_PEM = 7, + X509_LU_X509 = 8, + X509_LU_CRL = 9, + X509_V_ERR_CRL_SIGNATURE_FAILURE = 10, + X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD = 11, + X509_V_ERR_CRL_HAS_EXPIRED = 12, + X509_V_ERR_CERT_REVOKED = 13, + X509_V_FLAG_CRL_CHECK = 14, + X509_V_FLAG_CRL_CHECK_ALL = 15 +}; + + +/* Error stuff, could move to yassl_error */ +unsigned long ERR_get_error_line_data(const char**, int*, const char**, int *); +void ERR_print_errors_fp(FILE*); +char* ERR_error_string(unsigned long,char*); +void ERR_remove_state(unsigned long); +unsigned long ERR_get_error(void); +unsigned long ERR_peek_error(void); +int ERR_GET_REASON(int); + + +enum { /* ERR Constants */ + ERR_TXT_STRING = 1, + EVP_R_BAD_DECRYPT = 2 +}; + +/* + Allow type used by SSL_set_fd to be changed, default to int + in order to be compatible with OpenSSL + */ +#ifndef YASSL_SOCKET_T_DEFINED +typedef int YASSL_SOCKET_T; +#endif + +SSL_CTX* SSL_CTX_new(SSL_METHOD*); +SSL* SSL_new(SSL_CTX*); +int SSL_set_fd (SSL*, YASSL_SOCKET_T); +YASSL_SOCKET_T SSL_get_fd(const SSL*); +int SSL_connect(SSL*); /* if you get an error from connect + see note at top of REAMDE */ +int SSL_write(SSL*, const void*, int); +int SSL_read(SSL*, void*, int); +int SSL_accept(SSL*); +void SSL_CTX_free(SSL_CTX*); +void SSL_free(SSL*); +int SSL_clear(SSL*); +int SSL_shutdown(SSL*); + +void SSL_set_connect_state(SSL*); +void SSL_set_accept_state(SSL*); +int SSL_do_handshake(SSL*); + +const char* SSL_get_cipher(SSL*); +const char* SSL_get_cipher_name(SSL*); /* uses SSL_get_cipher */ +char* SSL_get_shared_ciphers(SSL*, char*, int); +const char* SSL_get_cipher_list(SSL*, int); +const char* SSL_get_version(SSL*); +const char* SSLeay_version(int); + +int SSL_get_error(SSL*, int); +void SSL_load_error_strings(void); + +int SSL_set_session(SSL *ssl, SSL_SESSION *session); +SSL_SESSION* SSL_get_session(SSL* ssl); +void SSL_flush_sessions(SSL_CTX *ctx, long tm); +long SSL_SESSION_set_timeout(SSL_SESSION*, long); +long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode); +X509* SSL_get_peer_certificate(SSL*); +long SSL_get_verify_result(SSL*); + + +typedef int (*VerifyCallback)(int, X509_STORE_CTX*); +typedef int (*pem_password_cb)(char*, int, int, void*); + +void SSL_CTX_set_verify(SSL_CTX*, int, VerifyCallback verify_callback); +int SSL_CTX_load_verify_locations(SSL_CTX*, const char*, const char*); +int SSL_CTX_set_default_verify_paths(SSL_CTX*); +int SSL_CTX_check_private_key(SSL_CTX*); +int SSL_CTX_set_session_id_context(SSL_CTX*, const unsigned char*, + unsigned int); + +void SSL_CTX_set_tmp_rsa_callback(SSL_CTX*, RSA*(*)(SSL*, int, int)); +long SSL_CTX_set_options(SSL_CTX*, long); +long SSL_CTX_set_session_cache_mode(SSL_CTX*, long); +long SSL_CTX_set_timeout(SSL_CTX*, long); +int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*); +void SSL_CTX_set_default_passwd_cb(SSL_CTX*, pem_password_cb); +int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX*, const char*, int); +void SSL_CTX_set_info_callback(SSL_CTX*, void (*)()); + +long SSL_CTX_sess_accept(SSL_CTX*); +long SSL_CTX_sess_connect(SSL_CTX*); +long SSL_CTX_sess_accept_good(SSL_CTX*); +long SSL_CTX_sess_connect_good(SSL_CTX*); +long SSL_CTX_sess_accept_renegotiate(SSL_CTX*); +long SSL_CTX_sess_connect_renegotiate(SSL_CTX*); +long SSL_CTX_sess_hits(SSL_CTX*); +long SSL_CTX_sess_cb_hits(SSL_CTX*); +long SSL_CTX_sess_cache_full(SSL_CTX*); +long SSL_CTX_sess_misses(SSL_CTX*); +long SSL_CTX_sess_timeouts(SSL_CTX*); +long SSL_CTX_sess_number(SSL_CTX*); +long SSL_CTX_sess_get_cache_size(SSL_CTX*); + +int SSL_CTX_get_verify_mode(SSL_CTX*); +int SSL_get_verify_mode(SSL*); +int SSL_CTX_get_verify_depth(SSL_CTX*); +int SSL_get_verify_depth(SSL*); + +long SSL_get_default_timeout(SSL*); +long SSL_CTX_get_session_cache_mode(SSL_CTX*); +int SSL_session_reused(SSL*); + +int SSL_set_rfd(SSL*, int); +int SSL_set_wfd(SSL*, int); +void SSL_set_shutdown(SSL*, int); +void SSL_set_quiet_shutdown(SSL *ssl,int mode); +int SSL_get_quiet_shutdown(SSL *ssl); + +int SSL_want_read(SSL*); +int SSL_want_write(SSL*); + +int SSL_pending(SSL*); + + +enum { /* ssl Constants */ + SSL_WOULD_BLOCK = -8, + SSL_BAD_STAT = -7, + SSL_BAD_PATH = -6, + SSL_BAD_FILETYPE = -5, + SSL_BAD_FILE = -4, + SSL_NOT_IMPLEMENTED = -3, + SSL_UNKNOWN = -2, + SSL_FATAL_ERROR = -1, + SSL_NORMAL_SHUTDOWN = 0, + SSL_ERROR_NONE = 0, /* for most functions */ + SSL_FAILURE = 0, /* for some functions */ + SSL_SUCCESS = 1, + + SSL_FILETYPE_ASN1 = 10, + SSL_FILETYPE_PEM = 11, + SSL_FILETYPE_DEFAULT = 10, /* ASN1 */ + + SSL_VERIFY_NONE = 0, + SSL_VERIFY_PEER = 1, + SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2, + SSL_VERIFY_CLIENT_ONCE = 4, + + SSL_SESS_CACHE_OFF = 30, + SSL_SESS_CACHE_CLIENT = 31, + SSL_SESS_CACHE_SERVER = 32, + SSL_SESS_CACHE_BOTH = 33, + SSL_SESS_CACHE_NO_AUTO_CLEAR = 34, + SSL_SESS_CACHE_NO_INTERNAL_LOOKUP = 35, + + SSL_OP_MICROSOFT_SESS_ID_BUG = 50, + SSL_OP_NETSCAPE_CHALLENGE_BUG = 51, + SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG = 52, + SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG = 53, + SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER = 54, + SSL_OP_MSIE_SSLV2_RSA_PADDING = 55, + SSL_OP_SSLEAY_080_CLIENT_DH_BUG = 56, + SSL_OP_TLS_D5_BUG = 57, + SSL_OP_TLS_BLOCK_PADDING_BUG = 58, + SSL_OP_TLS_ROLLBACK_BUG = 59, + SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 60, + SSL_OP_ALL = 61, + SSL_OP_SINGLE_DH_USE = 62, + SSL_OP_EPHEMERAL_RSA = 63, + SSL_OP_NO_SSLv2 = 64, + SSL_OP_NO_SSLv3 = 65, + SSL_OP_NO_TLSv1 = 66, + SSL_OP_PKCS1_CHECK_1 = 67, + SSL_OP_PKCS1_CHECK_2 = 68, + SSL_OP_NETSCAPE_CA_DN_BUG = 69, + SSL_OP_NON_EXPORT_FIRST = 70, + SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 71, + + SSL_ERROR_WANT_READ = 80, + SSL_ERROR_WANT_WRITE = 81, + SSL_ERROR_SYSCALL = 82, + SSL_ERROR_WANT_X509_LOOKUP = 83, + SSL_ERROR_ZERO_RETURN = 84, + SSL_ERROR_SSL = 85, + + SSL_SENT_SHUTDOWN = 90, + SSL_RECEIVED_SHUTDOWN = 91, + SSL_CB_LOOP = 92, + SSL_ST_CONNECT = 93, + SSL_ST_ACCEPT = 94, + SSL_CB_ALERT = 95, + SSL_CB_READ = 96, + SSL_CB_HANDSHAKE_DONE = 97 + +}; + + +SSL_METHOD *SSLv3_method(void); +SSL_METHOD *SSLv3_server_method(void); +SSL_METHOD *SSLv3_client_method(void); +SSL_METHOD *TLSv1_server_method(void); +SSL_METHOD *TLSv1_client_method(void); +SSL_METHOD *TLSv1_1_server_method(void); +SSL_METHOD *TLSv1_1_client_method(void); +SSL_METHOD *SSLv23_server_method(void); + +int SSL_CTX_use_certificate_file(SSL_CTX*, const char*, int); +int SSL_CTX_use_PrivateKey_file(SSL_CTX*, const char*, int); +int SSL_CTX_set_cipher_list(SSL_CTX*, const char*); + +long SSL_CTX_sess_set_cache_size(SSL_CTX*, long); +long SSL_CTX_set_tmp_dh(SSL_CTX*, DH*); + +void OpenSSL_add_all_algorithms(void); +int SSL_library_init(); +int SSLeay_add_ssl_algorithms(void); + + +SSL_CIPHER* SSL_get_current_cipher(SSL*); +char* SSL_CIPHER_description(SSL_CIPHER*, char*, int); + + +char* SSL_alert_type_string_long(int); +char* SSL_alert_desc_string_long(int); +char* SSL_state_string_long(SSL*); + + +/* EVP stuff, des and md5, different file? */ +typedef char EVP_MD; + +typedef char EVP_CIPHER; + +typedef struct EVP_PKEY EVP_PKEY; + +typedef unsigned char DES_cblock[8]; +typedef const DES_cblock const_DES_cblock; +typedef DES_cblock DES_key_schedule; + +enum { + DES_ENCRYPT = 1, + DES_DECRYPT = 0 +}; + +const EVP_MD* EVP_md5(void); +const EVP_CIPHER* EVP_des_ede3_cbc(void); + +typedef unsigned char opaque; + +int EVP_BytesToKey(const EVP_CIPHER*, const EVP_MD*, const opaque*, + const opaque*, int, int, opaque*, opaque*); + +void DES_set_key_unchecked(const_DES_cblock*, DES_key_schedule*); +void DES_ede3_cbc_encrypt(const opaque*, opaque*, long, DES_key_schedule*, + DES_key_schedule*, DES_key_schedule*, DES_cblock*, int); + + +/* RAND stuff */ +void RAND_screen(void); +const char* RAND_file_name(char*, size_t); +int RAND_write_file(const char*); +int RAND_load_file(const char*, long); + + +/* for libcurl */ +int RAND_status(void); +int RAND_bytes(unsigned char* buf, int num); + +int DES_set_key(const_DES_cblock*, DES_key_schedule*); +void DES_set_odd_parity(DES_cblock*); +void DES_ecb_encrypt(DES_cblock*, DES_cblock*, DES_key_schedule*, int); + +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX*, void* userdata); +void SSL_SESSION_free(SSL_SESSION* session); +int SSL_peek(SSL* ssl, void* buf, int num); + +X509* SSL_get_certificate(SSL* ssl); +EVP_PKEY* SSL_get_privatekey(SSL* ssl); +EVP_PKEY* X509_get_pubkey(X509* x); + +int EVP_PKEY_copy_parameters(EVP_PKEY* to, const EVP_PKEY* from); +void EVP_PKEY_free(EVP_PKEY* pkey); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +void ERR_free_strings(void); +void EVP_cleanup(void); + +void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx); + +#define GEN_IPADD 7 +#define NID_subject_alt_name 85 +#define STACK_OF(x) x + + +/* defined here because libcurl dereferences */ +typedef struct ASN1_STRING { + int type; + int length; + unsigned char* data; +} ASN1_STRING; + + +typedef struct GENERAL_NAME { + int type; + union { + ASN1_STRING* ia5; + } d; +} GENERAL_NAME; + +void GENERAL_NAMES_free(STACK_OF(GENERAL_NAME) *x); + +int sk_GENERAL_NAME_num(STACK_OF(GENERAL_NAME) *x); +GENERAL_NAME* sk_GENERAL_NAME_value(STACK_OF(GENERAL_NAME) *x, int i); + + +unsigned char* ASN1_STRING_data(ASN1_STRING* x); +int ASN1_STRING_length(ASN1_STRING* x); +int ASN1_STRING_type(ASN1_STRING *x); + +typedef ASN1_STRING X509_NAME_ENTRY; + +int X509_NAME_get_index_by_NID(X509_NAME* name,int nid, int lastpos); + +ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY* ne); +X509_NAME_ENTRY* X509_NAME_get_entry(X509_NAME* name, int loc); + +#define OPENSSL_malloc(x) malloc(x) +#define OPENSSL_free(x) free(x) + +int ASN1_STRING_to_UTF8(unsigned char** out, ASN1_STRING* in); + +SSL_METHOD* SSLv23_client_method(void); /* doesn't actually roll back */ +SSL_METHOD* SSLv2_client_method(void); /* will never work, no v 2 */ + + +SSL_SESSION* SSL_get1_session(SSL* ssl); /* what's ref count */ + + +#define CRYPTO_free(x) free(x) +#define ASN1_TIME ASN1_STRING + +ASN1_TIME* X509_get_notBefore(X509* x); +ASN1_TIME* X509_get_notAfter(X509* x); + + +#define ASN1_UTCTIME ASN1_STRING +#define NID_commonName 13 +#define V_ASN1_UTF8STRING 12 +#define GEN_DNS 2 + +#define CERTFICATE_ERROR 0x14090086 /* SSLv3 error */ + + +typedef struct MD4_CTX { + int buffer[32]; /* big enough to hold, check size in Init */ +} MD4_CTX; + +void MD4_Init(MD4_CTX*); +void MD4_Update(MD4_CTX*, const void*, unsigned long); +void MD4_Final(unsigned char*, MD4_CTX*); + + +typedef struct MD5_CTX { + int buffer[32]; /* big enough to hold, check size in Init */ +} MD5_CTX; + +void MD5_Init(MD5_CTX*); +void MD5_Update(MD5_CTX*, const void*, unsigned long); +void MD5_Final(unsigned char*, MD5_CTX*); + +#define MD5_DIGEST_LENGTH 16 + + +#define SSL_DEFAULT_CIPHER_LIST "" /* default all */ + + +/* yaSSL adds */ +int SSL_set_compression(SSL*); /* turn on yaSSL zlib compression */ + + + + +#if defined(__cplusplus) && !defined(YASSL_MYSQL_COMPATIBLE) +} /* namespace */ +} /* extern "C" */ +#endif + + +#endif /* yaSSL_openssl_h__ */ diff --git a/externals/mysql/extlib/yassl/include/openssl/x509.h b/externals/mysql/extlib/yassl/include/openssl/x509.h new file mode 100644 index 0000000..dcd847c --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/x509.h @@ -0,0 +1 @@ +/* x509.h for libcurl */ diff --git a/externals/mysql/extlib/yassl/include/openssl/x509v3.h b/externals/mysql/extlib/yassl/include/openssl/x509v3.h new file mode 100644 index 0000000..adf94af --- /dev/null +++ b/externals/mysql/extlib/yassl/include/openssl/x509v3.h @@ -0,0 +1 @@ +/* x509v3.h for libcurl */ diff --git a/externals/mysql/extlib/yassl/include/socket_wrapper.hpp b/externals/mysql/extlib/yassl/include/socket_wrapper.hpp new file mode 100644 index 0000000..308704c --- /dev/null +++ b/externals/mysql/extlib/yassl/include/socket_wrapper.hpp @@ -0,0 +1,96 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* The socket wrapper header defines a Socket class that hides the differences + * between Berkely style sockets and Windows sockets, allowing transparent TCP + * access. + */ + + +#ifndef yaSSL_SOCKET_WRAPPER_HPP +#define yaSSL_SOCKET_WRAPPER_HPP + +#include + +#ifdef _WIN32 + #include +#else + #include + #include + #include + #include + #include + #include +#endif + + +namespace yaSSL { + +typedef unsigned int uint; + +#ifdef _WIN32 + typedef SOCKET socket_t; +#else + typedef int socket_t; + const socket_t INVALID_SOCKET = -1; + const int SD_RECEIVE = 0; + const int SD_SEND = 1; + const int SD_BOTH = 2; + const int SOCKET_ERROR = -1; +#endif + + + +typedef unsigned char byte; + + +// Wraps Windows Sockets and BSD Sockets +class Socket { + socket_t socket_; // underlying socket descriptor + bool wouldBlock_; // if non-blocking data, for last read + bool nonBlocking_; // is option set +public: + explicit Socket(socket_t s = INVALID_SOCKET); + ~Socket(); + + void set_fd(socket_t s); + uint get_ready() const; + socket_t get_fd() const; + + uint send(const byte* buf, unsigned int len, int flags = 0) const; + uint receive(byte* buf, unsigned int len, int flags = 0); + + bool wait(); + bool WouldBlock() const; + bool IsNonBlocking() const; + + void closeSocket(); + void shutDown(int how = SD_SEND); + + static int get_lastError(); + static void set_lastError(int error); +private: + Socket(const Socket&); // hide copy + Socket& operator= (const Socket&); // and assign +}; + + +} // naemspace + +#endif // yaSSL_SOCKET_WRAPPER_HPP diff --git a/externals/mysql/extlib/yassl/include/timer.hpp b/externals/mysql/extlib/yassl/include/timer.hpp new file mode 100644 index 0000000..725e73c --- /dev/null +++ b/externals/mysql/extlib/yassl/include/timer.hpp @@ -0,0 +1,40 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* timer.hpp provides a high res and low res timers + * +*/ + + +#ifndef yaSSL_TIMER_HPP +#define yaSSL_TIMER_HPP + +namespace yaSSL { + +typedef double timer_d; +typedef unsigned int uint; + + + +timer_d timer(); +uint lowResTimer(); + + + +} // namespace +#endif // yaSSL_TIMER_HPP diff --git a/externals/mysql/extlib/yassl/include/yassl.hpp b/externals/mysql/extlib/yassl/include/yassl.hpp new file mode 100644 index 0000000..29e0a5d --- /dev/null +++ b/externals/mysql/extlib/yassl/include/yassl.hpp @@ -0,0 +1,85 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL externel header defines yaSSL API + */ + + +#ifndef yaSSL_EXT_HPP +#define yaSSL_EXT_HPP + + +namespace yaSSL { + + +#ifdef _WIN32 + typedef unsigned int SOCKET_T; +#else + typedef int SOCKET_T; +#endif + + +class Client { +public: + Client(); + ~Client(); + + // basics + int Connect(SOCKET_T); + int Write(const void*, int); + int Read(void*, int); + + // options + void SetCA(const char*); + void SetCert(const char*); + void SetKey(const char*); +private: + struct ClientImpl; + ClientImpl* pimpl_; + + Client(const Client&); // hide copy + Client& operator=(const Client&); // and assign +}; + + +class Server { +public: + Server(); + ~Server(); + + // basics + int Accept(SOCKET_T); + int Write(const void*, int); + int Read(void*, int); + + // options + void SetCA(const char*); + void SetCert(const char*); + void SetKey(const char*); +private: + struct ServerImpl; + ServerImpl* pimpl_; + + Server(const Server&); // hide copy + Server& operator=(const Server&); // and assign +}; + + +} // namespace yaSSL +#endif // yaSSL_EXT_HPP diff --git a/externals/mysql/extlib/yassl/include/yassl_error.hpp b/externals/mysql/extlib/yassl/include/yassl_error.hpp new file mode 100644 index 0000000..63fa9a7 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/yassl_error.hpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL error header defines error codes and an exception class + */ + +#ifndef yaSSL_ERROR_HPP +#define yaSSL_ERROR_HPP + + + +namespace yaSSL { + + +enum YasslError { + no_error = 0, + + // 10 - 47 from AlertDescription, 0 also close_notify + + range_error = 101, + realloc_error = 102, + factory_error = 103, + unknown_cipher = 104, + prefix_error = 105, + record_layer = 106, + handshake_layer = 107, + out_of_order = 108, + bad_input = 109, + match_error = 110, + no_key_file = 111, + verify_error = 112, + send_error = 113, + receive_error = 114, + certificate_error = 115, + privateKey_error = 116, + badVersion_error = 117, + compress_error = 118, + decompress_error = 119, + pms_version_error = 120 + + // !!!! add error message to .cpp !!!! + + // 1000+ from TaoCrypt error.hpp + +}; + + +enum Library { yaSSL_Lib = 0, CryptoLib, SocketLib }; +enum { MAX_ERROR_SZ = 80 }; + +void SetErrorString(YasslError, char*); + +/* remove for now, if go back to exceptions use this wrapper +// Base class for all yaSSL exceptions +class Error : public mySTL::runtime_error { + YasslError error_; + Library lib_; +public: + explicit Error(const char* s = "", YasslError e = no_error, + Library l = yaSSL_Lib); + + YasslError get_number() const; + Library get_lib() const; +}; +*/ + + +} // naemspace + +#endif // yaSSL_ERROR_HPP diff --git a/externals/mysql/extlib/yassl/include/yassl_imp.hpp b/externals/mysql/extlib/yassl/include/yassl_imp.hpp new file mode 100644 index 0000000..8893ba8 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/yassl_imp.hpp @@ -0,0 +1,748 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* yaSSL implementation header defines all strucutres from the SSL.v3 + * specification "draft-freier-ssl-version3-02.txt" + * all page citations refer to this document unless otherwise noted. + */ + + +#ifndef yaSSL_IMP_HPP +#define yaSSL_IMP_HPP + +#ifdef _MSC_VER + // disable truncated debug symbols + #pragma warning(disable:4786) +#endif + +#include "yassl_types.hpp" +#include "factory.hpp" +#include STL_LIST_FILE + + +namespace STL = STL_NAMESPACE; + + +namespace yaSSL { + + +class SSL; // forward decls +class input_buffer; +class output_buffer; + + +struct ProtocolVersion { + uint8 major_; + uint8 minor_; // major and minor SSL/TLS version numbers + + ProtocolVersion(uint8 maj = 3, uint8 min = 0); +}; + + +// Record Layer Header for PlainText, Compressed, and CipherText +struct RecordLayerHeader { + ContentType type_; + ProtocolVersion version_; + uint16 length_; // should not exceed 2^14 +}; + + +// base for all messages +struct Message : public virtual_base { + virtual input_buffer& set(input_buffer&) =0; + virtual output_buffer& get(output_buffer&) const =0; + + virtual void Process(input_buffer&, SSL&) =0; + virtual ContentType get_type() const =0; + virtual uint16 get_length() const =0; + + virtual ~Message() {} +}; + + +class ChangeCipherSpec : public Message { + CipherChoice type_; +public: + ChangeCipherSpec(); + + friend input_buffer& operator>>(input_buffer&, ChangeCipherSpec&); + friend output_buffer& operator<<(output_buffer&, const ChangeCipherSpec&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + ContentType get_type() const; + uint16 get_length() const; + void Process(input_buffer&, SSL&); +private: + ChangeCipherSpec(const ChangeCipherSpec&); // hide copy + ChangeCipherSpec& operator=(const ChangeCipherSpec&); // and assign +}; + + + +class Alert : public Message { + AlertLevel level_; + AlertDescription description_; +public: + Alert() {} + Alert(AlertLevel al, AlertDescription ad); + + ContentType get_type() const; + uint16 get_length() const; + void Process(input_buffer&, SSL&); + + friend input_buffer& operator>>(input_buffer&, Alert&); + friend output_buffer& operator<<(output_buffer&, const Alert&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; +private: + Alert(const Alert&); // hide copy + Alert& operator=(const Alert&); // and assign +}; + + +class Data : public Message { + uint16 length_; + opaque* buffer_; // read buffer used by fillData input + const opaque* write_buffer_; // write buffer used by output operator +public: + Data(); + Data(uint16 len, opaque* b); + + friend output_buffer& operator<<(output_buffer&, const Data&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + ContentType get_type() const; + uint16 get_length() const; + void set_length(uint16 l); + opaque* set_buffer(); + void SetData(uint16, const opaque*); + void Process(input_buffer&, SSL&); +private: + Data(const Data&); // hide copy + Data& operator=(const Data&); // and assign +}; + + +uint32 c24to32(const uint24); // forward form internal header +void c32to24(uint32, uint24&); + + +// HandShake header, same for each message type from page 20/21 +class HandShakeHeader : public Message { + HandShakeType type_; + uint24 length_; // length of message +public: + HandShakeHeader() {} + + ContentType get_type() const; + uint16 get_length() const; + HandShakeType get_handshakeType() const; + void Process(input_buffer&, SSL&); + + void set_type(HandShakeType hst); + void set_length(uint32 u32); + + friend input_buffer& operator>>(input_buffer&, HandShakeHeader&); + friend output_buffer& operator<<(output_buffer&, const HandShakeHeader&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; +private: + HandShakeHeader(const HandShakeHeader&); // hide copy + HandShakeHeader& operator=(const HandShakeHeader&); // and assign +}; + + +// Base Class for all handshake messages +class HandShakeBase : public virtual_base { + int length_; +public: + int get_length() const; + void set_length(int); + + // for building buffer's type field + virtual HandShakeType get_type() const =0; + + // handles dispactch of proper >> + virtual input_buffer& set(input_buffer& in) =0; + virtual output_buffer& get(output_buffer& out) const =0; + + virtual void Process(input_buffer&, SSL&) =0; + + virtual ~HandShakeBase() {} +}; + + +struct HelloRequest : public HandShakeBase { + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + void Process(input_buffer&, SSL&); + + HandShakeType get_type() const; +}; + + +// The Client's Hello Message from page 23 +class ClientHello : public HandShakeBase { + ProtocolVersion client_version_; + Random random_; + uint8 id_len_; // session id length + opaque session_id_[ID_LEN]; + uint16 suite_len_; // cipher suite length + opaque cipher_suites_[MAX_SUITE_SZ]; + uint8 comp_len_; // compression length + CompressionMethod compression_methods_; +public: + friend input_buffer& operator>>(input_buffer&, ClientHello&); + friend output_buffer& operator<<(output_buffer&, const ClientHello&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + HandShakeType get_type() const; + void Process(input_buffer&, SSL&); + + const opaque* get_random() const; + friend void buildClientHello(SSL&, ClientHello&); + friend void ProcessOldClientHello(input_buffer& input, SSL& ssl); + + ClientHello(); + ClientHello(ProtocolVersion pv, bool useCompression); +private: + ClientHello(const ClientHello&); // hide copy + ClientHello& operator=(const ClientHello&); // and assign +}; + + + +// The Server's Hello Message from page 24 +class ServerHello : public HandShakeBase { + ProtocolVersion server_version_; + Random random_; + uint8 id_len_; // session id length + opaque session_id_[ID_LEN]; + opaque cipher_suite_[SUITE_LEN]; + CompressionMethod compression_method_; +public: + ServerHello(ProtocolVersion pv, bool useCompression); + ServerHello(); + + friend input_buffer& operator>>(input_buffer&, ServerHello&); + friend output_buffer& operator<<(output_buffer&, const ServerHello&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + HandShakeType get_type() const; + void Process(input_buffer&, SSL&); + + const opaque* get_random() const; + friend void buildServerHello(SSL&, ServerHello&); +private: + ServerHello(const ServerHello&); // hide copy + ServerHello& operator=(const ServerHello&); // and assign +}; + + +class x509; + +// Certificate could be a chain +class Certificate : public HandShakeBase { + const x509* cert_; +public: + Certificate(); + explicit Certificate(const x509* cert); + friend output_buffer& operator<<(output_buffer&, const Certificate&); + + const opaque* get_buffer() const; + + // Process handles input, needs SSL + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + HandShakeType get_type() const; + void Process(input_buffer&, SSL&); +private: + Certificate(const Certificate&); // hide copy + Certificate& operator=(const Certificate&); // and assign +}; + + + +// RSA Public Key +struct ServerRSAParams { + opaque* rsa_modulus_; + opaque* rsa_exponent_; +}; + + +// Ephemeral Diffie-Hellman Parameters +class ServerDHParams { + int pSz_; + int gSz_; + int pubSz_; + opaque* p_; + opaque* g_; + opaque* Ys_; +public: + ServerDHParams(); + ~ServerDHParams(); + + int get_pSize() const; + int get_gSize() const; + int get_pubSize() const; + + const opaque* get_p() const; + const opaque* get_g() const; + const opaque* get_pub() const; + + opaque* alloc_p(int sz); + opaque* alloc_g(int sz); + opaque* alloc_pub(int sz); +private: + ServerDHParams(const ServerDHParams&); // hide copy + ServerDHParams& operator=(const ServerDHParams&); // and assign +}; + + +struct ServerKeyBase : public virtual_base { + virtual ~ServerKeyBase() {} + virtual void build(SSL&) {} + virtual void read(SSL&, input_buffer&) {} + virtual int get_length() const; + virtual opaque* get_serverKey() const; +}; + + +// Server random number for FORTEZZA KEA +struct Fortezza_Server : public ServerKeyBase { + opaque r_s_[FORTEZZA_MAX]; +}; + + +struct SignatureBase : public virtual_base { + virtual ~SignatureBase() {} +}; + +struct anonymous_sa : public SignatureBase {}; + + +struct Hashes { + uint8 md5_[MD5_LEN]; + uint8 sha_[SHA_LEN]; +}; + + +struct rsa_sa : public SignatureBase { + Hashes hashes_; +}; + + +struct dsa_sa : public SignatureBase { + uint8 sha_[SHA_LEN]; +}; + + +// Server's Diffie-Hellman exchange +class DH_Server : public ServerKeyBase { + ServerDHParams parms_; + opaque* signature_; + + int length_; // total length of message + opaque* keyMessage_; // total exchange message +public: + DH_Server(); + ~DH_Server(); + + void build(SSL&); + void read(SSL&, input_buffer&); + int get_length() const; + opaque* get_serverKey() const; +private: + DH_Server(const DH_Server&); // hide copy + DH_Server& operator=(const DH_Server&); // and assign +}; + + +// Server's RSA exchange +struct RSA_Server : public ServerKeyBase { + ServerRSAParams params_; + opaque* signature_; // signed rsa_sa hashes +}; + + +class ServerKeyExchange : public HandShakeBase { + ServerKeyBase* server_key_; +public: + explicit ServerKeyExchange(SSL&); + ServerKeyExchange(); + ~ServerKeyExchange(); + + void createKey(SSL&); + void build(SSL& ssl); + + const opaque* getKey() const; + int getKeyLength() const; + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + friend output_buffer& operator<<(output_buffer&, const ServerKeyExchange&); + + void Process(input_buffer&, SSL&); + HandShakeType get_type() const; +private: + ServerKeyExchange(const ServerKeyExchange&); // hide copy + ServerKeyExchange& operator=(const ServerKeyExchange&); // and assign +}; + + + +class CertificateRequest : public HandShakeBase { + ClientCertificateType certificate_types_[CERT_TYPES]; + int typeTotal_; + STL::list certificate_authorities_; +public: + CertificateRequest(); + ~CertificateRequest(); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + friend input_buffer& operator>>(input_buffer&, CertificateRequest&); + friend output_buffer& operator<<(output_buffer&, + const CertificateRequest&); + + void Process(input_buffer&, SSL&); + HandShakeType get_type() const; + + void Build(); +private: + CertificateRequest(const CertificateRequest&); // hide copy + CertificateRequest& operator=(const CertificateRequest&); // and assign +}; + + +struct ServerHelloDone : public HandShakeBase { + ServerHelloDone(); + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + void Process(input_buffer& input, SSL& ssl); + + HandShakeType get_type() const; +}; + + +struct PreMasterSecret { + opaque random_[SECRET_LEN]; // first two bytes Protocol Version +}; + + +struct ClientKeyBase : public virtual_base { + virtual ~ClientKeyBase() {} + virtual void build(SSL&) {} + virtual void read(SSL&, input_buffer&) {} + virtual int get_length() const; + virtual opaque* get_clientKey() const; +}; + + +class EncryptedPreMasterSecret : public ClientKeyBase { + opaque* secret_; + int length_; +public: + EncryptedPreMasterSecret(); + ~EncryptedPreMasterSecret(); + + void build(SSL&); + void read(SSL&, input_buffer&); + int get_length() const; + opaque* get_clientKey() const; + void alloc(int sz); +private: + // hide copy and assign + EncryptedPreMasterSecret(const EncryptedPreMasterSecret&); + EncryptedPreMasterSecret& operator=(const EncryptedPreMasterSecret&); +}; + + +// Fortezza Key Parameters from page 29 +// hard code lengths cause only used here +struct FortezzaKeys : public ClientKeyBase { + opaque y_c_ [128]; // client's Yc, public value + opaque r_c_ [128]; // client's Rc + opaque y_signature_ [40]; // DSS signed public key + opaque wrapped_client_write_key_ [12]; // wrapped by the TEK + opaque wrapped_server_write_key_ [12]; // wrapped by the TEK + opaque client_write_iv_ [24]; + opaque server_write_iv_ [24]; + opaque master_secret_iv_ [24]; // IV used to encrypt preMaster + opaque encrypted_preMasterSecret_[48]; // random & crypted by the TEK +}; + + + +// Diffie-Hellman public key from page 40/41 +class ClientDiffieHellmanPublic : public ClientKeyBase { + PublicValueEncoding public_value_encoding_; + int length_; // includes two byte length for message + opaque* Yc_; // length + Yc_ + // dh_Yc only if explicit, otherwise sent in certificate + enum { KEY_OFFSET = 2 }; +public: + ClientDiffieHellmanPublic(); + ~ClientDiffieHellmanPublic(); + + void build(SSL&); + void read(SSL&, input_buffer&); + int get_length() const; + opaque* get_clientKey() const; + void alloc(int sz, bool offset = false); +private: + // hide copy and assign + ClientDiffieHellmanPublic(const ClientDiffieHellmanPublic&); + ClientDiffieHellmanPublic& operator=(const ClientDiffieHellmanPublic&); +}; + + +class ClientKeyExchange : public HandShakeBase { + ClientKeyBase* client_key_; +public: + explicit ClientKeyExchange(SSL& ssl); + ClientKeyExchange(); + ~ClientKeyExchange(); + + void createKey(SSL&); + void build(SSL& ssl); + + const opaque* getKey() const; + int getKeyLength() const; + + friend output_buffer& operator<<(output_buffer&, const ClientKeyExchange&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + HandShakeType get_type() const; + void Process(input_buffer&, SSL&); +private: + ClientKeyExchange(const ClientKeyExchange&); // hide copy + ClientKeyExchange& operator=(const ClientKeyExchange&); // and assign +}; + + +class CertificateVerify : public HandShakeBase { + Hashes hashes_; + byte* signature_; // owns +public: + CertificateVerify(); + ~CertificateVerify(); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + friend input_buffer& operator>>(input_buffer&, CertificateVerify&); + friend output_buffer& operator<<(output_buffer&, const CertificateVerify&); + + void Process(input_buffer&, SSL&); + HandShakeType get_type() const; + + void Build(SSL&); +private: + CertificateVerify(const CertificateVerify&); // hide copy + CertificateVerify& operator=(const CertificateVerify&); // and assign +}; + + +class Finished : public HandShakeBase { + Hashes hashes_; +public: + Finished(); + + uint8* set_md5(); + uint8* set_sha(); + + friend input_buffer& operator>>(input_buffer&, Finished&); + friend output_buffer& operator<<(output_buffer&, const Finished&); + + input_buffer& set(input_buffer& in); + output_buffer& get(output_buffer& out) const; + + void Process(input_buffer&, SSL&); + + HandShakeType get_type() const; +private: + Finished(const Finished&); // hide copy + Finished& operator=(const Finished&); // and assign +}; + + +class RandomPool; // forward for connection + + +// SSL Connection defined on page 11 +struct Connection { + opaque *pre_master_secret_; + opaque master_secret_[SECRET_LEN]; + opaque client_random_[RAN_LEN]; + opaque server_random_[RAN_LEN]; + opaque sessionID_[ID_LEN]; + opaque client_write_MAC_secret_[SHA_LEN]; // sha is max size + opaque server_write_MAC_secret_[SHA_LEN]; + opaque client_write_key_[AES_256_KEY_SZ]; // aes 256bit is max sz + opaque server_write_key_[AES_256_KEY_SZ]; + opaque client_write_IV_[AES_IV_SZ]; // aes is max size + opaque server_write_IV_[AES_IV_SZ]; + uint32 sequence_number_; + uint32 peer_sequence_number_; + uint32 pre_secret_len_; // pre master length + bool send_server_key_; // server key exchange? + bool master_clean_; // master secret clean? + bool TLS_; // TLSv1 or greater + bool TLSv1_1_; // TLSv1.1 or greater + bool sessionID_Set_; // do we have a session + bool compression_; // zlib compression? + ProtocolVersion version_; // negotiated version + ProtocolVersion chVersion_; // client hello version + RandomPool& random_; + + Connection(ProtocolVersion v, RandomPool& ran); + ~Connection(); + + void AllocPreSecret(uint sz); + void CleanPreMaster(); + void CleanMaster(); + void TurnOffTLS(); + void TurnOffTLS1_1(); +private: + Connection(const Connection&); // hide copy + Connection& operator=(const Connection&); // and assign +}; + + +struct Ciphers; // forward + + +// TLSv1 Security Spec, defined on page 56 of RFC 2246 +struct Parameters { + ConnectionEnd entity_; + BulkCipherAlgorithm bulk_cipher_algorithm_; + CipherType cipher_type_; + uint8 key_size_; + uint8 iv_size_; + IsExportable is_exportable_; + MACAlgorithm mac_algorithm_; + uint8 hash_size_; + CompressionMethod compression_algorithm_; + KeyExchangeAlgorithm kea_; // yassl additions + SignatureAlgorithm sig_algo_; // signature auth type + SignatureAlgorithm verify_algo_; // cert verify auth type + bool pending_; + bool resumable_; // new conns by session + uint16 encrypt_size_; // current msg encrypt sz + Cipher suite_[SUITE_LEN]; // choosen suite + uint8 suites_size_; + Cipher suites_[MAX_SUITE_SZ]; + char cipher_name_[MAX_SUITE_NAME]; + char cipher_list_[MAX_CIPHERS][MAX_SUITE_NAME]; + bool removeDH_; // for server's later use + + Parameters(ConnectionEnd, const Ciphers&, ProtocolVersion, bool haveDH); + + void SetSuites(ProtocolVersion pv, bool removeDH = false, + bool removeRSA = false, bool removeDSA = false); + void SetCipherNames(); +private: + Parameters(const Parameters&); // hide copy + Parameters& operator=(const Parameters&); // and assing +}; + + +input_buffer& operator>>(input_buffer&, RecordLayerHeader&); +output_buffer& operator<<(output_buffer&, const RecordLayerHeader&); + +input_buffer& operator>>(input_buffer&, Message&); +output_buffer& operator<<(output_buffer&, const Message&); + +input_buffer& operator>>(input_buffer&, HandShakeBase&); +output_buffer& operator<<(output_buffer&, const HandShakeBase&); + + +// Message Factory definition +// uses the ContentType enumeration for unique id +typedef Factory MessageFactory; +void InitMessageFactory(MessageFactory&); // registers derived classes + +// HandShake Factory definition +// uses the HandShakeType enumeration for unique id +typedef Factory HandShakeFactory; +void InitHandShakeFactory(HandShakeFactory&); // registers derived classes + +// ServerKey Factory definition +// uses KeyExchangeAlgorithm enumeration for unique id +typedef Factory ServerKeyFactory; +void InitServerKeyFactory(ServerKeyFactory&); + +// ClientKey Factory definition +// uses KeyExchangeAlgorithm enumeration for unique id +typedef Factory ClientKeyFactory; +void InitClientKeyFactory(ClientKeyFactory&); + + +// Message Creators +Message* CreateHandShake(); +Message* CreateCipherSpec(); +Message* CreateAlert(); +Message* CreateData(); + + +// HandShake Creators +HandShakeBase* CreateCertificate(); +HandShakeBase* CreateHelloRequest(); +HandShakeBase* CreateClientHello(); +HandShakeBase* CreateServerHello(); +HandShakeBase* CreateServerKeyExchange(); +HandShakeBase* CreateCertificateRequest(); +HandShakeBase* CreateServerHelloDone(); +HandShakeBase* CreateClientKeyExchange(); +HandShakeBase* CreateCertificateVerify(); +HandShakeBase* CreateFinished(); + + +// ServerKey Exchange Creators +ServerKeyBase* CreateRSAServerKEA(); +ServerKeyBase* CreateDHServerKEA(); +ServerKeyBase* CreateFortezzaServerKEA(); + +// ClientKey Exchange Creators +ClientKeyBase* CreateRSAClient(); +ClientKeyBase* CreateDHClient(); +ClientKeyBase* CreateFortezzaClient(); + + + +} // naemspace + +#endif // yaSSL_IMP_HPP diff --git a/externals/mysql/extlib/yassl/include/yassl_int.hpp b/externals/mysql/extlib/yassl/include/yassl_int.hpp new file mode 100644 index 0000000..d18dc41 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/yassl_int.hpp @@ -0,0 +1,693 @@ +/* + Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL internal header defines SSL supporting types not specified in the + * draft along with type conversion functions and openssl compatibility + */ + + +#ifndef yaSSL_INT_HPP +#define yaSSL_INT_HPP + +#include "yassl_imp.hpp" +#include "yassl_error.hpp" +#include "crypto_wrapper.hpp" +#include "cert_wrapper.hpp" +#include "log.hpp" +#include "lock.hpp" +#include "openssl/ssl.h" // ASN1_STRING and DH + +// Check if _POSIX_THREADS should be forced +#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux)) +// HPUX does not define _POSIX_THREADS as it's not _fully_ implemented +// Netware supports pthreads but does not announce it +#define _POSIX_THREADS +#endif + +#ifdef _POSIX_THREADS + #include +#endif + + +namespace STL = STL_NAMESPACE; + + +namespace yaSSL { + + +// State Machine for Record Layer Protocol +enum RecordLayerState { + recordNotReady = 0, // fatal error, no more processing + recordReady +}; + + +// State Machine for HandShake Protocol +enum HandShakeState { + handShakeNotReady = 0, // fatal error, no more processing + preHandshake, // initial state + inHandshake, // handshake started + handShakeReady // handshake done +}; + + +// client input HandShake state, use if HandShakeState == inHandShake +enum ClientState { + serverNull = 0, + serverHelloComplete, + serverCertComplete, + serverKeyExchangeComplete, + serverHelloDoneComplete, + serverFinishedComplete +}; + + +// server input HandShake state, use if HandShakeState == inHandShake +enum ServerState { + clientNull = 0, + clientHelloComplete, + clientKeyExchangeComplete, + clientFinishedComplete +}; + + +// client connect state for nonblocking restart +enum ConnectState { + CONNECT_BEGIN = 0, + CLIENT_HELLO_SENT, + FIRST_REPLY_DONE, + FINISHED_DONE, + SECOND_REPLY_DONE +}; + + +// server accpet state for nonblocking restart +enum AcceptState { + ACCEPT_BEGIN = 0, + ACCEPT_FIRST_REPLY_DONE, + SERVER_HELLO_DONE, + ACCEPT_SECOND_REPLY_DONE, + ACCEPT_FINISHED_DONE, + ACCEPT_THIRD_REPLY_DONE +}; + + +// combines all states +class States { + RecordLayerState recordLayer_; + HandShakeState handshakeLayer_; + ClientState clientState_; + ServerState serverState_; + ConnectState connectState_; + AcceptState acceptState_; + char errorString_[MAX_ERROR_SZ]; + YasslError what_; +public: + States(); + + const RecordLayerState& getRecord() const; + const HandShakeState& getHandShake() const; + const ClientState& getClient() const; + const ServerState& getServer() const; + const ConnectState& GetConnect() const; + const AcceptState& GetAccept() const; + const char* getString() const; + YasslError What() const; + + RecordLayerState& useRecord(); + HandShakeState& useHandShake(); + ClientState& useClient(); + ServerState& useServer(); + ConnectState& UseConnect(); + AcceptState& UseAccept(); + char* useString(); + void SetError(YasslError); +private: + States(const States&); // hide copy + States& operator=(const States&); // and assign +}; + + +// holds all factories +class sslFactory { + MessageFactory messageFactory_; // creates new messages by type + HandShakeFactory handShakeFactory_; // creates new handshake types + ServerKeyFactory serverKeyFactory_; // creates new server key types + ClientKeyFactory clientKeyFactory_; // creates new client key types + + sslFactory(); // only GetSSL_Factory creates +public: + const MessageFactory& getMessage() const; + const HandShakeFactory& getHandShake() const; + const ServerKeyFactory& getServerKey() const; + const ClientKeyFactory& getClientKey() const; + + friend sslFactory& GetSSL_Factory(); // singleton creator +private: + sslFactory(const sslFactory&); // hide copy + sslFactory& operator=(const sslFactory&); // and assign +}; + + +#undef X509_NAME // wincrypt.h clash + +// openSSL X509 names +class X509_NAME { + char* name_; + size_t sz_; + ASN1_STRING entry_; +public: + X509_NAME(const char*, size_t sz); + ~X509_NAME(); + + const char* GetName() const; + ASN1_STRING* GetEntry(int i); + size_t GetLength() const; +private: + X509_NAME(const X509_NAME&); // hide copy + X509_NAME& operator=(const X509_NAME&); // and assign +}; + + +class StringHolder { + ASN1_STRING asnString_; +public: + StringHolder(const char* str, int sz); + ~StringHolder(); + + ASN1_STRING* GetString(); +private: + StringHolder(const StringHolder&); // hide copy + StringHolder& operator=(const StringHolder&); // and assign +}; + + +// openSSL X509 +class X509 { + X509_NAME issuer_; + X509_NAME subject_; + StringHolder beforeDate_; // not valid before + StringHolder afterDate_; // not valid after +public: + X509(const char* i, size_t, const char* s, size_t, + const char* b, int, const char* a, int); + ~X509() {} + + X509_NAME* GetIssuer(); + X509_NAME* GetSubject(); + + ASN1_STRING* GetBefore(); + ASN1_STRING* GetAfter(); + +private: + X509(const X509&); // hide copy + X509& operator=(const X509&); // and assign +}; + + +// openSSL bignum +struct BIGNUM { + /* + gcc 2.96 fix: because of two Integer classes (yaSSL::Integer and + TaoCrypt::Integer), we need to explicitly state the namespace + here to let gcc 2.96 deduce the correct type. + */ + yaSSL::Integer int_; + void assign(const byte* b, uint s) { int_.assign(b,s); } +}; + + +// openSSL session +class SSL_SESSION { + opaque sessionID_[ID_LEN]; + opaque master_secret_[SECRET_LEN]; + Cipher suite_[SUITE_LEN]; + uint bornOn_; // create time in seconds + uint timeout_; // timeout in seconds + RandomPool& random_; // will clean master secret + X509* peerX509_; +public: + explicit SSL_SESSION(RandomPool&); + SSL_SESSION(const SSL&, RandomPool&); + ~SSL_SESSION(); + + const opaque* GetID() const; + const opaque* GetSecret() const; + const Cipher* GetSuite() const; + uint GetBornOn() const; + uint GetTimeOut() const; + X509* GetPeerX509() const; + void SetTimeOut(uint); + + SSL_SESSION& operator=(const SSL_SESSION&); // allow assign for resumption +private: + SSL_SESSION(const SSL_SESSION&); // hide copy + + void CopyX509(X509*); +}; + + +// holds all sessions +class Sessions { + STL::list list_; + RandomPool random_; // for session cleaning + Mutex mutex_; // no-op for single threaded + int count_; // flush counter + + Sessions() : count_(0) {} // only GetSessions can create +public: + SSL_SESSION* lookup(const opaque*, SSL_SESSION* copy = 0); + void add(const SSL&); + void remove(const opaque*); + void Flush(); + + ~Sessions(); + + friend Sessions& GetSessions(); // singleton creator +private: + Sessions(const Sessions&); // hide copy + Sessions& operator=(const Sessions&); // and assign +}; + + +#ifdef _POSIX_THREADS + typedef pthread_t THREAD_ID_T; +#else + typedef DWORD THREAD_ID_T; +#endif + +// thread error data +struct ThreadError { + THREAD_ID_T threadID_; + int errorID_; +}; + + +// holds all errors +class Errors { + STL::list list_; + Mutex mutex_; + + Errors() {} // only GetErrors can create +public: + int Lookup(bool peek); // self lookup + void Add(int); + void Remove(); // remove self + + ~Errors() {} + + friend Errors& GetErrors(); // singleton creator +private: + Errors(const Errors&); // hide copy + Errors& operator=(const Errors); // and assign +}; + + +Sessions& GetSessions(); // forward singletons +sslFactory& GetSSL_Factory(); +Errors& GetErrors(); + + +// openSSL method and context types +class SSL_METHOD { + ProtocolVersion version_; + ConnectionEnd side_; + bool verifyPeer_; // request or send certificate + bool verifyNone_; // whether to verify certificate + bool failNoCert_; + bool multipleProtocol_; // for SSLv23 compatibility +public: + SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv, + bool multipleProtocol = false); + + ProtocolVersion getVersion() const; + ConnectionEnd getSide() const; + + void setVerifyPeer(); + void setVerifyNone(); + void setFailNoCert(); + + bool verifyPeer() const; + bool verifyNone() const; + bool failNoCert() const; + bool multipleProtocol() const; +private: + SSL_METHOD(const SSL_METHOD&); // hide copy + SSL_METHOD& operator=(const SSL_METHOD&); // and assign +}; + + +struct Ciphers { + bool setSuites_; // user set suites from default + byte suites_[MAX_SUITE_SZ]; // new suites + int suiteSz_; // suite length in bytes + + Ciphers() : setSuites_(false), suiteSz_(0) {} +}; + + +struct DH; // forward + + +// save for SSL construction +struct DH_Parms { + Integer p_; + Integer g_; + bool set_; // if set by user + + DH_Parms() : set_(false) {} +}; + + +enum StatsField { + Accept, Connect, AcceptGood, ConnectGood, AcceptRenegotiate, + ConnectRenegotiate, Hits, CbHits, CacheFull, Misses, Timeouts, Number, + GetCacheSize, VerifyMode, VerifyDepth +}; + + +// SSL stats +struct Stats { + long accept_; + long connect_; + long acceptGood_; + long connectGood_; + long acceptRenegotiate_; + long connectRenegotiate_; + + long hits_; + long cbHits_; + long cacheFull_; + long misses_; + long timeouts_; + long number_; + long getCacheSize_; + + int verifyMode_; + int verifyDepth_; +public: + Stats() : accept_(0), connect_(0), acceptGood_(0), connectGood_(0), + acceptRenegotiate_(0), connectRenegotiate_(0), hits_(0), cbHits_(0), + cacheFull_(0), misses_(0), timeouts_(0), number_(0), getCacheSize_(0), + verifyMode_(0), verifyDepth_(0) + {} +private: + Stats(const Stats&); // hide copy + Stats& operator=(const Stats&); // and assign +}; + + +// the SSL context +class SSL_CTX { +public: + typedef STL::list CertList; +private: + SSL_METHOD* method_; + x509* certificate_; + x509* privateKey_; + CertList caList_; + Ciphers ciphers_; + DH_Parms dhParms_; + pem_password_cb passwordCb_; + void* userData_; + bool sessionCacheOff_; + bool sessionCacheFlushOff_; + Stats stats_; + Mutex mutex_; // for Stats + VerifyCallback verifyCallback_; +public: + explicit SSL_CTX(SSL_METHOD* meth); + ~SSL_CTX(); + + const x509* getCert() const; + const x509* getKey() const; + const SSL_METHOD* getMethod() const; + const Ciphers& GetCiphers() const; + const DH_Parms& GetDH_Parms() const; + const Stats& GetStats() const; + const VerifyCallback getVerifyCallback() const; + pem_password_cb GetPasswordCb() const; + void* GetUserData() const; + bool GetSessionCacheOff() const; + bool GetSessionCacheFlushOff() const; + + void setVerifyPeer(); + void setVerifyNone(); + void setFailNoCert(); + void setVerifyCallback(VerifyCallback); + bool SetCipherList(const char*); + bool SetDH(const DH&); + void SetPasswordCb(pem_password_cb cb); + void SetUserData(void*); + void SetSessionCacheOff(); + void SetSessionCacheFlushOff(); + + void IncrementStats(StatsField); + void AddCA(x509* ca); + const CertList& GetCA_List() const; + + friend int read_file(SSL_CTX*, const char*, int, CertType); +private: + SSL_CTX(const SSL_CTX&); // hide copy + SSL_CTX& operator=(const SSL_CTX&); // and assign +}; + + +// holds all cryptographic types +class Crypto { + Digest* digest_; // agreed upon digest + BulkCipher* cipher_; // agreed upon cipher + DiffieHellman* dh_; // dh parms + RandomPool random_; // random number generator + CertManager cert_; // manages certificates +public: + explicit Crypto(); + ~Crypto(); + + const Digest& get_digest() const; + const BulkCipher& get_cipher() const; + const DiffieHellman& get_dh() const; + const RandomPool& get_random() const; + const CertManager& get_certManager() const; + + Digest& use_digest(); + BulkCipher& use_cipher(); + DiffieHellman& use_dh(); + RandomPool& use_random(); + CertManager& use_certManager(); + + void SetDH(DiffieHellman*); + void SetDH(const DH_Parms&); + void setDigest(Digest*); + void setCipher(BulkCipher*); + + bool DhSet(); +private: + Crypto(const Crypto&); // hide copy + Crypto& operator=(const Crypto&); // and assign +}; + + +// holds all handshake and verify hashes +class sslHashes { + MD5 md5HandShake_; // md5 handshake hash + SHA shaHandShake_; // sha handshake hash + Finished verify_; // peer's verify hash + Hashes certVerify_; // peer's cert verify hash +public: + sslHashes() {} + + const MD5& get_MD5() const; + const SHA& get_SHA() const; + const Finished& get_verify() const; + const Hashes& get_certVerify() const; + + MD5& use_MD5(); + SHA& use_SHA(); + Finished& use_verify(); + Hashes& use_certVerify(); +private: + sslHashes(const sslHashes&); // hide copy + sslHashes& operator=(const sslHashes&); // and assign +}; + + +// holds input and output buffers +class Buffers { +public: + typedef STL::list inputList; + typedef STL::list outputList; +private: + inputList dataList_; // list of users app data / handshake + outputList handShakeList_; // buffered handshake msgs + input_buffer* rawInput_; // buffered raw input yet to process +public: + Buffers(); + ~Buffers(); + + const inputList& getData() const; + const outputList& getHandShake() const; + + inputList& useData(); + outputList& useHandShake(); + + void SetRawInput(input_buffer*); // takes ownership + input_buffer* TakeRawInput(); // takes ownership +private: + Buffers(const Buffers&); // hide copy + Buffers& operator=(const Buffers&); // and assign +}; + + +// wraps security parameters +class Security { + Connection conn_; // connection information + Parameters parms_; // may be pending + SSL_SESSION resumeSession_; // if resuming + SSL_CTX* ctx_; // context used to init + bool resuming_; // trying to resume +public: + Security(ProtocolVersion, RandomPool&, ConnectionEnd, const Ciphers&, + SSL_CTX*, bool); + + const SSL_CTX* GetContext() const; + const Connection& get_connection() const; + const Parameters& get_parms() const; + const SSL_SESSION& get_resume() const; + bool get_resuming() const; + + Connection& use_connection(); + Parameters& use_parms(); + SSL_SESSION& use_resume(); + + void set_resuming(bool b); +private: + Security(const Security&); // hide copy + Security& operator=(const Security&); // and assign +}; + + +// THE SSL type +class SSL { + Crypto crypto_; // agreed crypto agents + Security secure_; // Connection and Session parms + States states_; // Record and HandShake states + sslHashes hashes_; // handshake, finished hashes + Socket socket_; // socket wrapper + Buffers buffers_; // buffered handshakes and data + Log log_; // logger + bool quietShutdown_; + + // optimization variables + bool has_data_; // buffered data ready? +public: + SSL(SSL_CTX* ctx); + + // gets and uses + const Crypto& getCrypto() const; + const Security& getSecurity() const; + const States& getStates() const; + const sslHashes& getHashes() const; + const sslFactory& getFactory() const; + const Socket& getSocket() const; + YasslError GetError() const; + bool GetMultiProtocol() const; + bool CompressionOn() const; + + Crypto& useCrypto(); + Security& useSecurity(); + States& useStates(); + sslHashes& useHashes(); + Socket& useSocket(); + Log& useLog(); + Buffers& useBuffers(); + + bool HasData() const; + bool GetQuietShutdown() const; + + // sets + void set_pending(Cipher suite); + void set_random(const opaque*, ConnectionEnd); + void set_sessionID(const opaque*); + void set_session(SSL_SESSION*); + void set_preMaster(const opaque*, uint); + void set_masterSecret(const opaque*); + void SetError(YasslError); + int SetCompression(); + void UnSetCompression(); + void SetQuietShutdown(bool mode); + + // helpers + bool isTLS() const; + bool isTLSv1_1() const; + void order_error(); + void makeMasterSecret(); + void makeTLSMasterSecret(); + void addData(input_buffer* data); + void fillData(Data&); + void PeekData(Data&); + void addBuffer(output_buffer* b); + void flushBuffer(); + void verifyState(const RecordLayerHeader&); + void verifyState(const HandShakeHeader&); + void verifyState(ClientState); + void verifyState(ServerState); + void verfiyHandShakeComplete(); + void matchSuite(const opaque*, uint length); + void deriveKeys(); + void deriveTLSKeys(); + void Send(const byte*, uint); + + uint bufferedData(); + uint get_SEQIncrement(bool); + + const byte* get_macSecret(bool); +private: + void storeKeys(const opaque*); + void setKeys(); + void verifyClientState(HandShakeType); + void verifyServerState(HandShakeType); + + SSL(const SSL&); // hide copy + const SSL& operator=(const SSL&); // and assign +}; + + +// compression +int Compress(const byte*, int, input_buffer&); +int DeCompress(input_buffer&, int, input_buffer&); + + +// conversion functions +void c32to24(uint32, uint24&); +void c24to32(const uint24, uint32&); + +uint32 c24to32(const uint24); + +void ato16(const opaque*, uint16&); +void ato24(const opaque*, uint24&); + +void c16toa(uint16, opaque*); +void c24toa(const uint24, opaque*); +void c32toa(uint32 u32, opaque*); + + +} // naemspace + +#endif // yaSSL_INT_HPP diff --git a/externals/mysql/extlib/yassl/include/yassl_types.hpp b/externals/mysql/extlib/yassl/include/yassl_types.hpp new file mode 100644 index 0000000..1af9e90 --- /dev/null +++ b/externals/mysql/extlib/yassl/include/yassl_types.hpp @@ -0,0 +1,528 @@ +/* + Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* yaSSL types header defines all constants, enums, and typedefs + * from the SSL.v3 specification "draft-freier-ssl-version3-02.txt" + */ + + +#ifndef yaSSL_TYPES_HPP +#define yaSSL_TYPES_HPP + +#include +#include +#include "type_traits.hpp" + + +#ifdef _MSC_VER + // disable conversion warning + // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy + #pragma warning(disable:4244 4996) +#endif + + +namespace yaSSL { + +#define YASSL_LIB + + +#ifdef YASSL_PURE_C + + // library allocation + struct new_t {}; // yaSSL New type + extern new_t ys; // pass in parameter + + } // namespace yaSSL + + void* operator new (size_t, yaSSL::new_t); + void* operator new[](size_t, yaSSL::new_t); + + void operator delete (void*, yaSSL::new_t); + void operator delete[](void*, yaSSL::new_t); + + + namespace yaSSL { + + + template + void ysDelete(T* ptr) + { + if (ptr) ptr->~T(); + ::operator delete(ptr, yaSSL::ys); + } + + template + void ysArrayDelete(T* ptr) + { + // can't do array placement destruction since not tracking size in + // allocation, only allow builtins to use array placement since they + // don't need destructors called + typedef char builtin[TaoCrypt::IsFundamentalType::Yes ? 1 : -1]; + (void)sizeof(builtin); + + ::operator delete[](ptr, yaSSL::ys); + } + + #define NEW_YS new (yaSSL::ys) + + // to resolve compiler generated operator delete on base classes with + // virtual destructors (when on stack), make sure doesn't get called + class virtual_base { + public: + static void operator delete(void*) { assert(0); } + }; + + +#else // YASSL_PURE_C + + + template + void ysDelete(T* ptr) + { + delete ptr; + } + + template + void ysArrayDelete(T* ptr) + { + delete[] ptr; + } + + #define NEW_YS new + + class virtual_base {}; + + + +#endif // YASSL_PURE_C + + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned int uint32; +typedef uint8 uint24[3]; +typedef uint32 uint64[2]; + +typedef uint8 opaque; +typedef opaque byte; + +typedef unsigned int uint; + + +#ifdef USE_SYS_STL + // use system STL + #define STL_VECTOR_FILE + #define STL_LIST_FILE + #define STL_ALGORITHM_FILE + #define STL_MEMORY_FILE + #define STL_PAIR_FILE + + #define STL_NAMESPACE std +#else + // use mySTL + #define STL_VECTOR_FILE "vector.hpp" + #define STL_LIST_FILE "list.hpp" + #define STL_ALGORITHM_FILE "algorithm.hpp" + #define STL_MEMORY_FILE "memory.hpp" + #define STL_PAIR_FILE "pair.hpp" + + #define STL_NAMESPACE mySTL +#endif + + +#ifndef min +template +T min(T a, T b) +{ + return a < b ? a : b; +} +#endif + + + +// all length constants in bytes +const int ID_LEN = 32; // session id length +const int SUITE_LEN = 2; // cipher suite length +const int SECRET_LEN = 48; // pre RSA and all master secret length +const int MASTER_ROUNDS = 3; // master secret derivation rounds +const int RAN_LEN = 32; // client and server random length +const int MAC_BLOCK_SZ = 64; // MAC block size, & padding +const int MD5_LEN = 16; // MD5 digest length +const int SHA_LEN = 20; // SHA digest length +const int RMD_LEN = 20; // RIPEMD-160 digest length +const int PREFIX = 3; // up to 3 prefix letters for secret rounds +const int KEY_PREFIX = 7; // up to 7 prefix letters for key rounds +const int FORTEZZA_MAX = 128; // Maximum Fortezza Key length +const int MAX_SUITE_SZ = 128; // 64 max suites * sizeof(suite) +const int MAX_SUITE_NAME = 48; // max length of suite name +const int MAX_CIPHERS = 32; // max supported ciphers for cipher list +const int SIZEOF_ENUM = 1; // SSL considers an enum 1 byte, not 4 +const int SIZEOF_SENDER = 4; // Sender constant, for finished generation +const int PAD_MD5 = 48; // pad length 1 and 2 for md5 finished +const int PAD_SHA = 40; // should be 44, specd wrong by netscape +const int PAD_RMD = 44; // pad length for RIPEMD-160, some use 40?? +const int CERT_HEADER = 3; // always use 3 bytes for certificate +const int CERT_TYPES = 7; // certificate request types +const int REQUEST_HEADER = 2; // request uses 2 bytes +const int VERIFY_HEADER = 2; // verify length field +const int MIN_CERT_TYPES = 1; // minimum certificate request types +const int MIN_DIS_NAMES = 3; // minimum distinguished names +const int MIN_DIS_SIZE = 1; // minimum distinguished name size +const int RECORD_HEADER = 5; // type + version + length(2) +const int HANDSHAKE_HEADER = 4; // type + length(3) +const int FINISHED_SZ = MD5_LEN + SHA_LEN; // sizeof finished data +const int TLS_FINISHED_SZ = 12; // TLS verify data size +const int SEQ_SZ = 8; // 64 bit sequence number +const int LENGTH_SZ = 2; // length field for HMAC, data only +const int VERSION_SZ = SIZEOF_ENUM * 2; // SSL/TLS length of version +const int DES_KEY_SZ = 8; // DES Key length +const int DES_EDE_KEY_SZ = 24; // DES EDE Key length +const int DES_BLOCK = 8; // DES is always fixed block size 8 +const int DES_IV_SZ = DES_BLOCK; // Init Vector length for DES +const int RC4_KEY_SZ = 16; // RC4 Key length +const int AES_128_KEY_SZ = 16; // AES 128bit Key length +const int AES_192_KEY_SZ = 24; // AES 192bit Key length +const int AES_256_KEY_SZ = 32; // AES 256bit Key length +const int AES_BLOCK_SZ = 16; // AES 128bit block size, rfc 3268 +const int AES_IV_SZ = AES_BLOCK_SZ; // AES Init Vector length +const int DSS_SIG_SZ = 40; // two 20 byte high byte first Integers +const int DSS_ENCODED_EXTRA = 6; // seqID + len(1) + (intID + len(1)) * 2 +const int EVP_SALT_SZ = 8; +const int MASTER_LABEL_SZ = 13; // TLS master secret label size +const int KEY_LABEL_SZ = 13; // TLS key block expansion size +const int FINISHED_LABEL_SZ = 15; // TLS finished lable length +const int SEED_LEN = RAN_LEN * 2; // TLS seed, client + server random +const int DEFAULT_TIMEOUT = 500; // Default Session timeout in seconds +const int MAX_RECORD_SIZE = 16384; // 2^14, max size by standard +const int COMPRESS_EXTRA = 1024; // extra compression possible addition +const int SESSION_FLUSH_COUNT = 256; // when to flush session cache + + +typedef uint8 Cipher; // first byte is always 0x00 for SSLv3 & TLS + +typedef opaque Random[RAN_LEN]; + +typedef opaque* DistinguishedName; + +typedef bool IsExportable; + + +enum CompressionMethod { no_compression = 0, zlib = 221 }; + +enum CipherType { stream, block }; + +enum CipherChoice { change_cipher_spec_choice = 1 }; + +enum PublicValueEncoding { implicit_encoding, explicit_encoding }; + +enum ConnectionEnd { server_end, client_end }; + +enum AlertLevel { warning = 1, fatal = 2 }; + + + +// Record Layer Header identifier from page 12 +enum ContentType { + no_type = 0, + change_cipher_spec = 20, + alert = 21, + handshake = 22, + application_data = 23 +}; + + +// HandShake Layer Header identifier from page 20 +enum HandShakeType { + no_shake = -1, + hello_request = 0, + client_hello = 1, + server_hello = 2, + certificate = 11, + server_key_exchange = 12, + certificate_request = 13, + server_hello_done = 14, + certificate_verify = 15, + client_key_exchange = 16, + finished = 20 +}; + + +// Valid Alert types from page 16/17 +enum AlertDescription { + close_notify = 0, + unexpected_message = 10, + bad_record_mac = 20, + decompression_failure = 30, + handshake_failure = 40, + no_certificate = 41, + bad_certificate = 42, + unsupported_certificate = 43, + certificate_revoked = 44, + certificate_expired = 45, + certificate_unknown = 46, + illegal_parameter = 47 +}; + + +// Supported Key Exchange Protocols +enum KeyExchangeAlgorithm { + no_kea = 0, + rsa_kea, + diffie_hellman_kea, + fortezza_kea +}; + + +// Supported Authentication Schemes +enum SignatureAlgorithm { + anonymous_sa_algo = 0, + rsa_sa_algo, + dsa_sa_algo +}; + + +// Valid client certificate request types from page 27 +enum ClientCertificateType { + rsa_sign = 1, + dss_sign = 2, + rsa_fixed_dh = 3, + dss_fixed_dh = 4, + rsa_ephemeral_dh = 5, + dss_ephemeral_dh = 6, + fortezza_kea_cert = 20 +}; + + +// Supported Ciphers from page 43 +enum BulkCipherAlgorithm { + cipher_null, + rc4, + rc2, + des, + triple_des, // leading 3 (3des) not valid identifier + des40, + idea, + aes +}; + + +// Supported Message Authentication Codes from page 43 +enum MACAlgorithm { + no_mac, + md5, + sha, + rmd +}; + + +// Certificate file Type +enum CertType { Cert = 0, PrivateKey, CA }; + + +// all Cipher Suites from pages 41/42 +const Cipher SSL_NULL_WITH_NULL_NULL = 0; // { 0x00, 0x00 } +const Cipher SSL_RSA_WITH_NULL_MD5 = 1; // { 0x00, 0x01 } +const Cipher SSL_RSA_WITH_NULL_SHA = 2; // { 0x00, 0x02 } +const Cipher SSL_RSA_EXPORT_WITH_RC4_40_MD5 = 3; // { 0x00, 0x03 } +const Cipher SSL_RSA_WITH_RC4_128_MD5 = 4; // { 0x00, 0x04 } +const Cipher SSL_RSA_WITH_RC4_128_SHA = 5; // { 0x00, 0x05 } +const Cipher SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 6; // { 0x00, 0x06 } +const Cipher SSL_RSA_WITH_IDEA_CBC_SHA = 7; // { 0x00, 0x07 } +const Cipher SSL_RSA_EXPORT_WITH_DES40_CBC_SHA = 8; // { 0x00, 0x08 } +const Cipher SSL_RSA_WITH_DES_CBC_SHA = 9; // { 0x00, 0x09 } +const Cipher SSL_RSA_WITH_3DES_EDE_CBC_SHA = 10; // { 0x00, 0x0A } +const Cipher SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 11; // { 0x00, 0x0B } +const Cipher SSL_DH_DSS_WITH_DES_CBC_SHA = 12; // { 0x00, 0x0C } +const Cipher SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA = 13; // { 0x00, 0x0D } +const Cipher SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 14; // { 0x00, 0x0E } +const Cipher SSL_DH_RSA_WITH_DES_CBC_SHA = 15; // { 0x00, 0x0F } +const Cipher SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA = 16; // { 0x00, 0x10 } +const Cipher SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 17; // { 0x00, 0x11 } +const Cipher SSL_DHE_DSS_WITH_DES_CBC_SHA = 18; // { 0x00, 0x12 } +const Cipher SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 19; // { 0x00, 0x13 } +const Cipher SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 20; // { 0x00, 0x14 } +const Cipher SSL_DHE_RSA_WITH_DES_CBC_SHA = 21; // { 0x00, 0x15 } +const Cipher SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 22; // { 0x00, 0x16 } +const Cipher SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 = 23; // { 0x00, 0x17 } +const Cipher SSL_DH_anon_WITH_RC4_128_MD5 = 24; // { 0x00, 0x18 } +const Cipher SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 25; // { 0x00, 0x19 } +const Cipher SSL_DH_anon_WITH_DES_CBC_SHA = 26; // { 0x00, 0x1A } +const Cipher SSL_DH_anon_WITH_3DES_EDE_CBC_SHA = 27; // { 0x00, 0x1B } +const Cipher SSL_FORTEZZA_KEA_WITH_NULL_SHA = 28; // { 0x00, 0x1C } +const Cipher SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA = 29; // { 0x00, 0x1D } +const Cipher SSL_FORTEZZA_KEA_WITH_RC4_128_SHA = 30; // { 0x00, 0x1E } + +// .. to 0x2B uses Kerberos Authentication + + +// TLS AES extensions +const Cipher TLS_RSA_WITH_AES_128_CBC_SHA = 47; // { 0x00, 0x2F } +const Cipher TLS_DH_DSS_WITH_AES_128_CBC_SHA = 48; // { 0x00, 0x30 } +const Cipher TLS_DH_RSA_WITH_AES_128_CBC_SHA = 49; // { 0x00, 0x31 } +const Cipher TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 50; // { 0x00, 0x32 } +const Cipher TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 51; // { 0x00, 0x33 } +const Cipher TLS_DH_anon_WITH_AES_128_CBC_SHA = 52; // { 0x00, 0x34 } + +const Cipher TLS_RSA_WITH_AES_256_CBC_SHA = 53; // { 0x00, 0x35 } +const Cipher TLS_DH_DSS_WITH_AES_256_CBC_SHA = 54; // { 0x00, 0x36 } +const Cipher TLS_DH_RSA_WITH_AES_256_CBC_SHA = 55; // { 0x00, 0x37 } +const Cipher TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 56; // { 0x00, 0x38 } +const Cipher TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 57; // { 0x00, 0x39 } +const Cipher TLS_DH_anon_WITH_AES_256_CBC_SHA = 58; // { 0x00, 0x3A } + + +// OpenPGP extensions + +const Cipher TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160 = 114; // { 0x00, 0x72 }; +const Cipher TLS_DHE_DSS_WITH_AES_128_CBC_RMD160 = 115; // { 0x00, 0x73 }; +const Cipher TLS_DHE_DSS_WITH_AES_256_CBC_RMD160 = 116; // { 0x00, 0x74 }; +const Cipher TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160 = 119; // { 0x00, 0x77 }; +const Cipher TLS_DHE_RSA_WITH_AES_128_CBC_RMD160 = 120; // { 0x00, 0x78 }; +const Cipher TLS_DHE_RSA_WITH_AES_256_CBC_RMD160 = 121; // { 0x00, 0x79 }; +const Cipher TLS_RSA_WITH_3DES_EDE_CBC_RMD160 = 124; // { 0x00, 0x7C }; +const Cipher TLS_RSA_WITH_AES_128_CBC_RMD160 = 125; // { 0x00, 0x7D }; +const Cipher TLS_RSA_WITH_AES_256_CBC_RMD160 = 126; // { 0x00, 0x7E }; + + +const char* const null_str = ""; + +const char* const cipher_names[128] = +{ + null_str, // SSL_NULL_WITH_NULL_NULL = 0 + null_str, // SSL_RSA_WITH_NULL_MD5 = 1 + null_str, // SSL_RSA_WITH_NULL_SHA = 2 + null_str, // SSL_RSA_EXPORT_WITH_RC4_40_MD5 = 3 + "RC4-MD5", // SSL_RSA_WITH_RC4_128_MD5 = 4 + "RC4-SHA", // SSL_RSA_WITH_RC4_128_SHA = 5 + null_str, // SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 6 + null_str, // SSL_RSA_WITH_IDEA_CBC_SHA = 7 + null_str, // SSL_RSA_EXPORT_WITH_DES40_CBC_SHA = 8 + "DES-CBC-SHA", // SSL_RSA_WITH_DES_CBC_SHA = 9 + "DES-CBC3-SHA", // SSL_RSA_WITH_3DES_EDE_CBC_SHA = 10 + + null_str, // SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 11 + null_str, // SSL_DH_DSS_WITH_DES_CBC_SHA = 12 + null_str, // SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA = 13 + null_str, // SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 14 + null_str, // SSL_DH_RSA_WITH_DES_CBC_SHA = 15 + null_str, // SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA = 16 + null_str, // SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 17 + "EDH-DSS-DES-CBC-SHA", // SSL_DHE_DSS_WITH_DES_CBC_SHA = 18 + "EDH-DSS-DES-CBC3-SHA", // SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 19 + null_str, // SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 20 + + "EDH-RSA-DES-CBC-SHA", // SSL_DHE_RSA_WITH_DES_CBC_SHA = 21 + "EDH-RSA-DES-CBC3-SHA", // SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 22 + null_str, // SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 = 23 + null_str, // SSL_DH_anon_WITH_RC4_128_MD5 = 24 + null_str, // SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 25 + null_str, // SSL_DH_anon_WITH_DES_CBC_SHA = 26 + null_str, // SSL_DH_anon_WITH_3DES_EDE_CBC_SHA = 27 + null_str, // SSL_FORTEZZA_KEA_WITH_NULL_SHA = 28 + null_str, // SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA = 29 + null_str, // SSL_FORTEZZA_KEA_WITH_RC4_128_SHA = 30 + + null_str, null_str, null_str, null_str, null_str, // 31 - 35 + null_str, null_str, null_str, null_str, null_str, // 36 - 40 + null_str, null_str, null_str, null_str, null_str, // 41 - 45 + null_str, // 46 + + // TLS AES extensions + "AES128-SHA", // TLS_RSA_WITH_AES_128_CBC_SHA = 47 + null_str, // TLS_DH_DSS_WITH_AES_128_CBC_SHA = 48 + null_str, // TLS_DH_RSA_WITH_AES_128_CBC_SHA = 49 + "DHE-DSS-AES128-SHA", // TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 50 + "DHE-RSA-AES128-SHA", // TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 51 + null_str, // TLS_DH_anon_WITH_AES_128_CBC_SHA = 52 + + "AES256-SHA", // TLS_RSA_WITH_AES_256_CBC_SHA = 53 + null_str, // TLS_DH_DSS_WITH_AES_256_CBC_SHA = 54 + null_str, // TLS_DH_RSA_WITH_AES_256_CBC_SHA = 55 + "DHE-DSS-AES256-SHA", // TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 56 + "DHE-RSA-AES256-SHA", // TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 57 + null_str, // TLS_DH_anon_WITH_AES_256_CBC_SHA = 58 + + null_str, // 59 + null_str, // 60 + null_str, null_str, null_str, null_str, null_str, // 61 - 65 + null_str, null_str, null_str, null_str, null_str, // 66 - 70 + null_str, null_str, null_str, null_str, null_str, // 71 - 75 + null_str, null_str, null_str, null_str, null_str, // 76 - 80 + null_str, null_str, null_str, null_str, null_str, // 81 - 85 + null_str, null_str, null_str, null_str, null_str, // 86 - 90 + null_str, null_str, null_str, null_str, null_str, // 91 - 95 + null_str, null_str, null_str, null_str, null_str, // 96 - 100 + null_str, null_str, null_str, null_str, null_str, // 101 - 105 + null_str, null_str, null_str, null_str, null_str, // 106 - 110 + null_str, null_str, null_str, // 111 - 113 + + "DHE-DSS-DES-CBC3-RMD", // TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160 = 114 + "DHE-DSS-AES128-RMD", // TLS_DHE_DSS_WITH_AES_128_CBC_RMD160 = 115 + "DHE-DSS-AES256-RMD", // TLS_DHE_DSS_WITH_AES_256_CBC_RMD160 = 116 + null_str, // 117 + null_str, // 118 + "DHE-RSA-DES-CBC3-RMD", // TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160 = 119 + "DHE-RSA-AES128-RMD", // TLS_DHE_RSA_WITH_AES_128_CBC_RMD160 = 120 + "DHE-RSA-AES256-RMD", // TLS_DHE_RSA_WITH_AES_256_CBC_RMD160 = 121 + null_str, // 122 + null_str, // 123 + "DES-CBC3-RMD", // TLS_RSA_WITH_3DES_EDE_CBC_RMD160 = 124 + "AES128-RMD", // TLS_RSA_WITH_AES_128_CBC_RMD160 = 125 + "AES256-RMD", // TLS_RSA_WITH_AES_256_CBC_RMD160 = 126 + null_str // 127 +}; + +// fill with MD5 pad size since biggest required +const opaque PAD1[PAD_MD5] = { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 + }; +const opaque PAD2[PAD_MD5] = { 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, + 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, + 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, + 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, + 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, + 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c + }; + +const opaque client[SIZEOF_SENDER] = { 0x43, 0x4C, 0x4E, 0x54 }; +const opaque server[SIZEOF_SENDER] = { 0x53, 0x52, 0x56, 0x52 }; + +const opaque tls_client[FINISHED_LABEL_SZ + 1] = "client finished"; +const opaque tls_server[FINISHED_LABEL_SZ + 1] = "server finished"; + +const opaque master_label[MASTER_LABEL_SZ + 1] = "master secret"; +const opaque key_label [KEY_LABEL_SZ + 1] = "key expansion"; + + +} // naemspace + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 +/* + gcc 2.96 bails out because of two declarations of byte: yaSSL::byte and + TaoCrypt::byte. TODO: define global types.hpp and move the declaration of + 'byte' there. +*/ +using yaSSL::byte; +#endif + + +#endif // yaSSL_TYPES_HPP diff --git a/externals/mysql/extlib/yassl/src/buffer.cpp b/externals/mysql/extlib/yassl/src/buffer.cpp new file mode 100644 index 0000000..0c3f23b --- /dev/null +++ b/externals/mysql/extlib/yassl/src/buffer.cpp @@ -0,0 +1,279 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL buffer header implements input/output buffers to simulate streaming + * with SSL types and sockets + */ + + +#include // memcpy +#include "runtime.hpp" +#include "buffer.hpp" +#include "yassl_types.hpp" + +namespace yaSSL { + + + +// Checking Policy should implement a check function that tests whether the +// index is within the size limit of the array + +void Check::check(uint i, uint limit) +{ + assert(i < limit); +} + + +void NoCheck::check(uint, uint) +{ +} + + +/* input_buffer operates like a smart c style array with a checking option, + * meant to be read from through [] with AUTO index or read(). + * Should only write to at/near construction with assign() or raw (e.g., recv) + * followed by add_size with the number of elements added by raw write. + * + * Not using vector because need checked []access, offset, and the ability to + * write to the buffer bulk wise and have the correct size + */ + + +input_buffer::input_buffer() + : size_(0), current_(0), buffer_(0), end_(0) +{} + + +input_buffer::input_buffer(uint s) + : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) +{} + + +// with assign +input_buffer::input_buffer(uint s, const byte* t, uint len) + : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) +{ + assign(t, len); +} + + +input_buffer::~input_buffer() +{ + ysArrayDelete(buffer_); +} + + +// users can pass defualt zero length buffer and then allocate +void input_buffer::allocate(uint s) +{ + assert(!buffer_); // find realloc error + buffer_ = NEW_YS byte[s]; + end_ = buffer_ + s; +} + + +// for passing to raw writing functions at beginning, then use add_size +byte* input_buffer::get_buffer() const +{ + return buffer_; +} + + +// after a raw write user can set NEW_YS size +// if you know the size before the write use assign() +void input_buffer::add_size(uint i) +{ + check(size_ + i-1, get_capacity()); + size_ += i; +} + + +uint input_buffer::get_capacity() const +{ + return end_ - buffer_; +} + + +uint input_buffer::get_current() const +{ + return current_; +} + + +uint input_buffer::get_size() const +{ + return size_; +} + + +uint input_buffer::get_remaining() const +{ + return size_ - current_; +} + + +void input_buffer::set_current(uint i) +{ + if (i) + check(i - 1, size_); + current_ = i; +} + + +// read only access through [], advance current +// user passes in AUTO index for ease of use +const byte& input_buffer::operator[](uint i) +{ + assert (i == AUTO); + check(current_, size_); + return buffer_[current_++]; +} + + +// end of input test +bool input_buffer::eof() +{ + return current_ >= size_; +} + + +// peek ahead +byte input_buffer::peek() const +{ + return buffer_[current_]; +} + + +// write function, should use at/near construction +void input_buffer::assign(const byte* t, uint s) +{ + check(current_, get_capacity()); + add_size(s); + memcpy(&buffer_[current_], t, s); +} + + +// use read to query input, adjusts current +void input_buffer::read(byte* dst, uint length) +{ + check(current_ + length - 1, size_); + memcpy(dst, &buffer_[current_], length); + current_ += length; +} + + + +/* output_buffer operates like a smart c style array with a checking option. + * Meant to be written to through [] with AUTO index or write(). + * Size (current) counter increases when written to. Can be constructed with + * zero length buffer but be sure to allocate before first use. + * Don't use add write for a couple bytes, use [] instead, way less overhead. + * + * Not using vector because need checked []access and the ability to + * write to the buffer bulk wise and retain correct size + */ + + +output_buffer::output_buffer() + : current_(0), buffer_(0), end_(0) +{} + + +// with allocate +output_buffer::output_buffer(uint s) + : current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) +{} + + +// with assign +output_buffer::output_buffer(uint s, const byte* t, uint len) + : current_(0), buffer_(NEW_YS byte[s]), end_(buffer_+ s) +{ + write(t, len); +} + + +output_buffer::~output_buffer() +{ + ysArrayDelete(buffer_); +} + + +uint output_buffer::get_size() const +{ + return current_; +} + + +uint output_buffer::get_capacity() const +{ + return end_ - buffer_; +} + + +void output_buffer::set_current(uint c) +{ + check(c, get_capacity()); + current_ = c; +} + + +// users can pass defualt zero length buffer and then allocate +void output_buffer::allocate(uint s) +{ + assert(!buffer_); // find realloc error + buffer_ = NEW_YS byte[s]; end_ = buffer_ + s; +} + + +// for passing to reading functions when finished +const byte* output_buffer::get_buffer() const +{ + return buffer_; +} + + +// allow write access through [], update current +// user passes in AUTO as index for ease of use +byte& output_buffer::operator[](uint i) +{ + assert(i == AUTO); + check(current_, get_capacity()); + return buffer_[current_++]; +} + + +// end of output test +bool output_buffer::eof() +{ + return current_ >= get_capacity(); +} + + +void output_buffer::write(const byte* t, uint s) +{ + check(current_ + s - 1, get_capacity()); + memcpy(&buffer_[current_], t, s); + current_ += s; +} + + + +} // naemspace + diff --git a/externals/mysql/extlib/yassl/src/cert_wrapper.cpp b/externals/mysql/extlib/yassl/src/cert_wrapper.cpp new file mode 100644 index 0000000..ebec088 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/cert_wrapper.cpp @@ -0,0 +1,370 @@ +/* + Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* The certificate wrapper source implements certificate management functions + * + */ + +#include "runtime.hpp" +#include "cert_wrapper.hpp" +#include "yassl_int.hpp" +#include "error.hpp" + +#if defined(USE_CML_LIB) + #include "cmapi_cpp.h" +#else + #include "asn.hpp" + #include "file.hpp" +#endif // USE_CML_LIB + + +namespace yaSSL { + + +x509::x509(uint sz) : length_(sz), buffer_(NEW_YS opaque[sz]) +{ +} + + +x509::~x509() +{ + ysArrayDelete(buffer_); +} + + +x509::x509(const x509& that) : length_(that.length_), + buffer_(NEW_YS opaque[length_]) +{ + memcpy(buffer_, that.buffer_, length_); +} + + +void x509::Swap(x509& that) +{ + STL::swap(length_, that.length_); + STL::swap(buffer_, that.buffer_); +} + + +x509& x509::operator=(const x509& that) +{ + x509 temp(that); + Swap(temp); + return *this; +} + + +uint x509::get_length() const +{ + return length_; +} + + +const opaque* x509::get_buffer() const +{ + return buffer_; +} + + +opaque* x509::use_buffer() +{ + return buffer_; +} + + +//CertManager +CertManager::CertManager() + : peerX509_(0), verifyPeer_(false), verifyNone_(false), failNoCert_(false), + sendVerify_(false), verifyCallback_(0) +{} + + +CertManager::~CertManager() +{ + ysDelete(peerX509_); + + STL::for_each(signers_.begin(), signers_.end(), del_ptr_zero()) ; + + STL::for_each(peerList_.begin(), peerList_.end(), del_ptr_zero()) ; + + STL::for_each(list_.begin(), list_.end(), del_ptr_zero()) ; +} + + +bool CertManager::verifyPeer() const +{ + return verifyPeer_; +} + + +bool CertManager::verifyNone() const +{ + return verifyNone_; +} + + +bool CertManager::failNoCert() const +{ + return failNoCert_; +} + + +bool CertManager::sendVerify() const +{ + return sendVerify_; +} + + +void CertManager::setVerifyPeer() +{ + verifyPeer_ = true; +} + + +void CertManager::setVerifyNone() +{ + verifyNone_ = true; +} + + +void CertManager::setFailNoCert() +{ + failNoCert_ = true; +} + + +void CertManager::setSendVerify() +{ + sendVerify_ = true; +} + + +void CertManager::setVerifyCallback(VerifyCallback vc) +{ + verifyCallback_ = vc; +} + + +void CertManager::AddPeerCert(x509* x) +{ + peerList_.push_back(x); // take ownership +} + + +void CertManager::CopySelfCert(const x509* x) +{ + if (x) + list_.push_back(NEW_YS x509(*x)); +} + + +// add to signers +int CertManager::CopyCaCert(const x509* x) +{ + TaoCrypt::Source source(x->get_buffer(), x->get_length()); + TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_, + TaoCrypt::CertDecoder::CA); + + if (!cert.GetError().What()) { + const TaoCrypt::PublicKey& key = cert.GetPublicKey(); + signers_.push_back(NEW_YS TaoCrypt::Signer(key.GetKey(), key.size(), + cert.GetCommonName(), cert.GetHash())); + } + // just don't add, not an error return cert.GetError().What(); + return 0; +} + + +const x509* CertManager::get_cert() const +{ + return list_.front(); +} + + +const opaque* CertManager::get_peerKey() const +{ + return peerPublicKey_.get_buffer(); +} + + +X509* CertManager::get_peerX509() const +{ + return peerX509_; +} + + +SignatureAlgorithm CertManager::get_peerKeyType() const +{ + return peerKeyType_; +} + + +SignatureAlgorithm CertManager::get_keyType() const +{ + return keyType_; +} + + +uint CertManager::get_peerKeyLength() const +{ + return peerPublicKey_.get_size(); +} + + +const opaque* CertManager::get_privateKey() const +{ + return privateKey_.get_buffer(); +} + + +uint CertManager::get_privateKeyLength() const +{ + return privateKey_.get_size(); +} + + +// Validate the peer's certificate list, from root to peer (last to first) +int CertManager::Validate() +{ + CertList::reverse_iterator last = peerList_.rbegin(); + size_t count = peerList_.size(); + + while ( count > 1 ) { + TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); + TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_); + + if (int err = cert.GetError().What()) + return err; + + const TaoCrypt::PublicKey& key = cert.GetPublicKey(); + signers_.push_back(NEW_YS TaoCrypt::Signer(key.GetKey(), key.size(), + cert.GetCommonName(), cert.GetHash())); + ++last; + --count; + } + + if (count) { + // peer's is at the front + TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); + TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_); + + int err = cert.GetError().What(); + if ( err ) + return err; + + uint sz = cert.GetPublicKey().size(); + peerPublicKey_.allocate(sz); + peerPublicKey_.assign(cert.GetPublicKey().GetKey(), sz); + + if (cert.GetKeyType() == TaoCrypt::RSAk) + peerKeyType_ = rsa_sa_algo; + else + peerKeyType_ = dsa_sa_algo; + + size_t iSz = strlen(cert.GetIssuer()) + 1; + size_t sSz = strlen(cert.GetCommonName()) + 1; + int bSz = (int)strlen(cert.GetBeforeDate()) + 1; + int aSz = (int)strlen(cert.GetAfterDate()) + 1; + peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(), + sSz, cert.GetBeforeDate(), bSz, + cert.GetAfterDate(), aSz); + + if (err == TaoCrypt::SIG_OTHER_E && verifyCallback_) { + X509_STORE_CTX store; + store.error = err; + store.error_depth = static_cast(count) - 1; + store.current_cert = peerX509_; + + int ok = verifyCallback_(0, &store); + if (ok) return 0; + } + + if (err == TaoCrypt::SIG_OTHER_E) return err; + } + return 0; +} + + +// Set the private key +int CertManager::SetPrivateKey(const x509& key) +{ + privateKey_.allocate(key.get_length()); + privateKey_.assign(key.get_buffer(), key.get_length()); + + // set key type + if (x509* cert = list_.front()) { + TaoCrypt::Source source(cert->get_buffer(), cert->get_length()); + TaoCrypt::CertDecoder cd(source, false); + cd.DecodeToKey(); + if (int err = cd.GetError().What()) + return err; + if (cd.GetKeyType() == TaoCrypt::RSAk) + keyType_ = rsa_sa_algo; + else + keyType_ = dsa_sa_algo; + } + return 0; +} + + +// Store OpenSSL type peer's cert +void CertManager::setPeerX509(X509* x) +{ + assert(peerX509_ == 0); + if (x == 0) return; + + X509_NAME* issuer = x->GetIssuer(); + X509_NAME* subject = x->GetSubject(); + ASN1_STRING* before = x->GetBefore(); + ASN1_STRING* after = x->GetAfter(); + + peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), + subject->GetName(), subject->GetLength(), (const char*) before->data, + before->length, (const char*) after->data, after->length); +} + + +#if defined(USE_CML_LIB) + +// Get the peer's certificate, extract and save public key +void CertManager::SetPeerKey() +{ + // first cert is the peer's + x509* main = peerList_.front(); + + Bytes_struct cert; + cert.num = main->get_length(); + cert.data = main->set_buffer(); + + CML::Certificate cm(cert); + const CML::ASN::Cert& raw = cm.base(); + CTIL::CSM_Buffer key = raw.pubKeyInfo.key; + + uint sz; + opaque* key_buffer = reinterpret_cast(key.Get(sz)); + peerPublicKey_.allocate(sz); + peerPublicKey_.assign(key_buffer, sz); +} + + +#endif // USE_CML_LIB + + + +} // namespace diff --git a/externals/mysql/extlib/yassl/src/crypto_wrapper.cpp b/externals/mysql/extlib/yassl/src/crypto_wrapper.cpp new file mode 100644 index 0000000..28d7f1b --- /dev/null +++ b/externals/mysql/extlib/yassl/src/crypto_wrapper.cpp @@ -0,0 +1,1013 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* The crypto wrapper source implements the policies for the cipher + * components used by SSL. + * + * The implementation relies on a specfic library, taoCrypt. + */ + +#if !defined(USE_CRYPTOPP_LIB) + +#include "runtime.hpp" +#include "crypto_wrapper.hpp" +#include "cert_wrapper.hpp" + +#include "md5.hpp" +#include "sha.hpp" +#include "ripemd.hpp" +#include "hmac.hpp" +#include "modes.hpp" +#include "des.hpp" +#include "arc4.hpp" +#include "aes.hpp" +#include "rsa.hpp" +#include "dsa.hpp" +#include "dh.hpp" +#include "random.hpp" +#include "file.hpp" +#include "coding.hpp" + + +namespace yaSSL { + + +// MD5 Implementation +struct MD5::MD5Impl { + TaoCrypt::MD5 md5_; + MD5Impl() {} + explicit MD5Impl(const TaoCrypt::MD5& md5) : md5_(md5) {} +}; + + +MD5::MD5() : pimpl_(NEW_YS MD5Impl) {} + + +MD5::~MD5() { ysDelete(pimpl_); } + + +MD5::MD5(const MD5& that) : Digest(), pimpl_(NEW_YS + MD5Impl(that.pimpl_->md5_)) {} + + +MD5& MD5::operator=(const MD5& that) +{ + pimpl_->md5_ = that.pimpl_->md5_; + return *this; +} + + +uint MD5::get_digestSize() const +{ + return MD5_LEN; +} + + +uint MD5::get_padSize() const +{ + return PAD_MD5; +} + + +// Fill out with MD5 digest from in that is sz bytes, out must be >= digest sz +void MD5::get_digest(byte* out, const byte* in, unsigned int sz) +{ + pimpl_->md5_.Update(in, sz); + pimpl_->md5_.Final(out); +} + +// Fill out with MD5 digest from previous updates +void MD5::get_digest(byte* out) +{ + pimpl_->md5_.Final(out); +} + + +// Update the current digest +void MD5::update(const byte* in, unsigned int sz) +{ + pimpl_->md5_.Update(in, sz); +} + + +// SHA Implementation +struct SHA::SHAImpl { + TaoCrypt::SHA sha_; + SHAImpl() {} + explicit SHAImpl(const TaoCrypt::SHA& sha) : sha_(sha) {} +}; + + +SHA::SHA() : pimpl_(NEW_YS SHAImpl) {} + + +SHA::~SHA() { ysDelete(pimpl_); } + + +SHA::SHA(const SHA& that) : Digest(), pimpl_(NEW_YS SHAImpl(that.pimpl_->sha_)) {} + +SHA& SHA::operator=(const SHA& that) +{ + pimpl_->sha_ = that.pimpl_->sha_; + return *this; +} + + +uint SHA::get_digestSize() const +{ + return SHA_LEN; +} + + +uint SHA::get_padSize() const +{ + return PAD_SHA; +} + + +// Fill out with SHA digest from in that is sz bytes, out must be >= digest sz +void SHA::get_digest(byte* out, const byte* in, unsigned int sz) +{ + pimpl_->sha_.Update(in, sz); + pimpl_->sha_.Final(out); +} + + +// Fill out with SHA digest from previous updates +void SHA::get_digest(byte* out) +{ + pimpl_->sha_.Final(out); +} + + +// Update the current digest +void SHA::update(const byte* in, unsigned int sz) +{ + pimpl_->sha_.Update(in, sz); +} + + +// RMD-160 Implementation +struct RMD::RMDImpl { + TaoCrypt::RIPEMD160 rmd_; + RMDImpl() {} + explicit RMDImpl(const TaoCrypt::RIPEMD160& rmd) : rmd_(rmd) {} +}; + + +RMD::RMD() : pimpl_(NEW_YS RMDImpl) {} + + +RMD::~RMD() { ysDelete(pimpl_); } + + +RMD::RMD(const RMD& that) : Digest(), pimpl_(NEW_YS RMDImpl(that.pimpl_->rmd_)) {} + +RMD& RMD::operator=(const RMD& that) +{ + pimpl_->rmd_ = that.pimpl_->rmd_; + return *this; +} + + +uint RMD::get_digestSize() const +{ + return RMD_LEN; +} + + +uint RMD::get_padSize() const +{ + return PAD_RMD; +} + + +// Fill out with RMD digest from in that is sz bytes, out must be >= digest sz +void RMD::get_digest(byte* out, const byte* in, unsigned int sz) +{ + pimpl_->rmd_.Update(in, sz); + pimpl_->rmd_.Final(out); +} + + +// Fill out with RMD digest from previous updates +void RMD::get_digest(byte* out) +{ + pimpl_->rmd_.Final(out); +} + + +// Update the current digest +void RMD::update(const byte* in, unsigned int sz) +{ + pimpl_->rmd_.Update(in, sz); +} + + +// HMAC_MD5 Implementation +struct HMAC_MD5::HMAC_MD5Impl { + TaoCrypt::HMAC mac_; + HMAC_MD5Impl() {} +}; + + +HMAC_MD5::HMAC_MD5(const byte* secret, unsigned int len) + : pimpl_(NEW_YS HMAC_MD5Impl) +{ + pimpl_->mac_.SetKey(secret, len); +} + + +HMAC_MD5::~HMAC_MD5() { ysDelete(pimpl_); } + + +uint HMAC_MD5::get_digestSize() const +{ + return MD5_LEN; +} + + +uint HMAC_MD5::get_padSize() const +{ + return PAD_MD5; +} + + +// Fill out with MD5 digest from in that is sz bytes, out must be >= digest sz +void HMAC_MD5::get_digest(byte* out, const byte* in, unsigned int sz) +{ + pimpl_->mac_.Update(in, sz); + pimpl_->mac_.Final(out); +} + +// Fill out with MD5 digest from previous updates +void HMAC_MD5::get_digest(byte* out) +{ + pimpl_->mac_.Final(out); +} + + +// Update the current digest +void HMAC_MD5::update(const byte* in, unsigned int sz) +{ + pimpl_->mac_.Update(in, sz); +} + + +// HMAC_SHA Implementation +struct HMAC_SHA::HMAC_SHAImpl { + TaoCrypt::HMAC mac_; + HMAC_SHAImpl() {} +}; + + +HMAC_SHA::HMAC_SHA(const byte* secret, unsigned int len) + : pimpl_(NEW_YS HMAC_SHAImpl) +{ + pimpl_->mac_.SetKey(secret, len); +} + + +HMAC_SHA::~HMAC_SHA() { ysDelete(pimpl_); } + + +uint HMAC_SHA::get_digestSize() const +{ + return SHA_LEN; +} + + +uint HMAC_SHA::get_padSize() const +{ + return PAD_SHA; +} + + +// Fill out with SHA digest from in that is sz bytes, out must be >= digest sz +void HMAC_SHA::get_digest(byte* out, const byte* in, unsigned int sz) +{ + pimpl_->mac_.Update(in, sz); + pimpl_->mac_.Final(out); +} + +// Fill out with SHA digest from previous updates +void HMAC_SHA::get_digest(byte* out) +{ + pimpl_->mac_.Final(out); +} + + +// Update the current digest +void HMAC_SHA::update(const byte* in, unsigned int sz) +{ + pimpl_->mac_.Update(in, sz); +} + + + +// HMAC_RMD Implementation +struct HMAC_RMD::HMAC_RMDImpl { + TaoCrypt::HMAC mac_; + HMAC_RMDImpl() {} +}; + + +HMAC_RMD::HMAC_RMD(const byte* secret, unsigned int len) + : pimpl_(NEW_YS HMAC_RMDImpl) +{ + pimpl_->mac_.SetKey(secret, len); +} + + +HMAC_RMD::~HMAC_RMD() { ysDelete(pimpl_); } + + +uint HMAC_RMD::get_digestSize() const +{ + return RMD_LEN; +} + + +uint HMAC_RMD::get_padSize() const +{ + return PAD_RMD; +} + + +// Fill out with RMD digest from in that is sz bytes, out must be >= digest sz +void HMAC_RMD::get_digest(byte* out, const byte* in, unsigned int sz) +{ + pimpl_->mac_.Update(in, sz); + pimpl_->mac_.Final(out); +} + +// Fill out with RMD digest from previous updates +void HMAC_RMD::get_digest(byte* out) +{ + pimpl_->mac_.Final(out); +} + + +// Update the current digest +void HMAC_RMD::update(const byte* in, unsigned int sz) +{ + pimpl_->mac_.Update(in, sz); +} + + +struct DES::DESImpl { + TaoCrypt::DES_CBC_Encryption encryption; + TaoCrypt::DES_CBC_Decryption decryption; +}; + + +DES::DES() : pimpl_(NEW_YS DESImpl) {} + +DES::~DES() { ysDelete(pimpl_); } + + +void DES::set_encryptKey(const byte* k, const byte* iv) +{ + pimpl_->encryption.SetKey(k, DES_KEY_SZ, iv); +} + + +void DES::set_decryptKey(const byte* k, const byte* iv) +{ + pimpl_->decryption.SetKey(k, DES_KEY_SZ, iv); +} + +// DES encrypt plain of length sz into cipher +void DES::encrypt(byte* cipher, const byte* plain, unsigned int sz) +{ + pimpl_->encryption.Process(cipher, plain, sz); +} + + +// DES decrypt cipher of length sz into plain +void DES::decrypt(byte* plain, const byte* cipher, unsigned int sz) +{ + pimpl_->decryption.Process(plain, cipher, sz); +} + + +struct DES_EDE::DES_EDEImpl { + TaoCrypt::DES_EDE3_CBC_Encryption encryption; + TaoCrypt::DES_EDE3_CBC_Decryption decryption; +}; + + +DES_EDE::DES_EDE() : pimpl_(NEW_YS DES_EDEImpl) {} + +DES_EDE::~DES_EDE() { ysDelete(pimpl_); } + + +void DES_EDE::set_encryptKey(const byte* k, const byte* iv) +{ + pimpl_->encryption.SetKey(k, DES_EDE_KEY_SZ, iv); +} + + +void DES_EDE::set_decryptKey(const byte* k, const byte* iv) +{ + pimpl_->decryption.SetKey(k, DES_EDE_KEY_SZ, iv); +} + + +// 3DES encrypt plain of length sz into cipher +void DES_EDE::encrypt(byte* cipher, const byte* plain, unsigned int sz) +{ + pimpl_->encryption.Process(cipher, plain, sz); +} + + +// 3DES decrypt cipher of length sz into plain +void DES_EDE::decrypt(byte* plain, const byte* cipher, unsigned int sz) +{ + pimpl_->decryption.Process(plain, cipher, sz); +} + + +// Implementation of alledged RC4 +struct RC4::RC4Impl { + TaoCrypt::ARC4::Encryption encryption; + TaoCrypt::ARC4::Decryption decryption; +}; + + +RC4::RC4() : pimpl_(NEW_YS RC4Impl) {} + +RC4::~RC4() { ysDelete(pimpl_); } + + +void RC4::set_encryptKey(const byte* k, const byte*) +{ + pimpl_->encryption.SetKey(k, RC4_KEY_SZ); +} + + +void RC4::set_decryptKey(const byte* k, const byte*) +{ + pimpl_->decryption.SetKey(k, RC4_KEY_SZ); +} + + +// RC4 encrypt plain of length sz into cipher +void RC4::encrypt(byte* cipher, const byte* plain, unsigned int sz) +{ + pimpl_->encryption.Process(cipher, plain, sz); +} + + +// RC4 decrypt cipher of length sz into plain +void RC4::decrypt(byte* plain, const byte* cipher, unsigned int sz) +{ + pimpl_->decryption.Process(plain, cipher, sz); +} + + + +// Implementation of AES +struct AES::AESImpl { + TaoCrypt::AES_CBC_Encryption encryption; + TaoCrypt::AES_CBC_Decryption decryption; + unsigned int keySz_; + + AESImpl(unsigned int ks) : keySz_(ks) {} +}; + + +AES::AES(unsigned int ks) : pimpl_(NEW_YS AESImpl(ks)) {} + +AES::~AES() { ysDelete(pimpl_); } + + +int AES::get_keySize() const +{ + return pimpl_->keySz_; +} + + +void AES::set_encryptKey(const byte* k, const byte* iv) +{ + pimpl_->encryption.SetKey(k, pimpl_->keySz_, iv); +} + + +void AES::set_decryptKey(const byte* k, const byte* iv) +{ + pimpl_->decryption.SetKey(k, pimpl_->keySz_, iv); +} + + +// AES encrypt plain of length sz into cipher +void AES::encrypt(byte* cipher, const byte* plain, unsigned int sz) +{ + pimpl_->encryption.Process(cipher, plain, sz); +} + + +// AES decrypt cipher of length sz into plain +void AES::decrypt(byte* plain, const byte* cipher, unsigned int sz) +{ + pimpl_->decryption.Process(plain, cipher, sz); +} + + +struct RandomPool::RandomImpl { + TaoCrypt::RandomNumberGenerator RNG_; +}; + +RandomPool::RandomPool() : pimpl_(NEW_YS RandomImpl) {} + +RandomPool::~RandomPool() { ysDelete(pimpl_); } + +int RandomPool::GetError() const +{ + return pimpl_->RNG_.GetError(); +} + +void RandomPool::Fill(opaque* dst, uint sz) const +{ + pimpl_->RNG_.GenerateBlock(dst, sz); +} + + +// Implementation of DSS Authentication +struct DSS::DSSImpl { + void SetPublic (const byte*, unsigned int); + void SetPrivate(const byte*, unsigned int); + TaoCrypt::DSA_PublicKey publicKey_; + TaoCrypt::DSA_PrivateKey privateKey_; +}; + + +// Decode and store the public key +void DSS::DSSImpl::SetPublic(const byte* key, unsigned int sz) +{ + TaoCrypt::Source source(key, sz); + publicKey_.Initialize(source); +} + + +// Decode and store the public key +void DSS::DSSImpl::SetPrivate(const byte* key, unsigned int sz) +{ + TaoCrypt::Source source(key, sz); + privateKey_.Initialize(source); + publicKey_ = TaoCrypt::DSA_PublicKey(privateKey_); + +} + + +// Set public or private key +DSS::DSS(const byte* key, unsigned int sz, bool publicKey) + : pimpl_(NEW_YS DSSImpl) +{ + if (publicKey) + pimpl_->SetPublic(key, sz); + else + pimpl_->SetPrivate(key, sz); +} + + +DSS::~DSS() +{ + ysDelete(pimpl_); +} + + +uint DSS::get_signatureLength() const +{ + return pimpl_->publicKey_.SignatureLength(); +} + + +// DSS Sign message of length sz into sig +void DSS::sign(byte* sig, const byte* sha_digest, unsigned int /* shaSz */, + const RandomPool& random) +{ + using namespace TaoCrypt; + + DSA_Signer signer(pimpl_->privateKey_); + signer.Sign(sha_digest, sig, random.pimpl_->RNG_); +} + + +// DSS Verify message of length sz against sig, is it correct? +bool DSS::verify(const byte* sha_digest, unsigned int /* shaSz */, + const byte* sig, unsigned int /* sigSz */) +{ + using namespace TaoCrypt; + + DSA_Verifier ver(pimpl_->publicKey_); + return ver.Verify(sha_digest, sig); +} + + +// Implementation of RSA key interface +struct RSA::RSAImpl { + void SetPublic (const byte*, unsigned int); + void SetPrivate(const byte*, unsigned int); + TaoCrypt::RSA_PublicKey publicKey_; + TaoCrypt::RSA_PrivateKey privateKey_; +}; + + +// Decode and store the public key +void RSA::RSAImpl::SetPublic(const byte* key, unsigned int sz) +{ + TaoCrypt::Source source(key, sz); + publicKey_.Initialize(source); +} + + +// Decode and store the private key +void RSA::RSAImpl::SetPrivate(const byte* key, unsigned int sz) +{ + TaoCrypt::Source source(key, sz); + privateKey_.Initialize(source); + publicKey_ = TaoCrypt::RSA_PublicKey(privateKey_); +} + + +// Set public or private key +RSA::RSA(const byte* key, unsigned int sz, bool publicKey) + : pimpl_(NEW_YS RSAImpl) +{ + if (publicKey) + pimpl_->SetPublic(key, sz); + else + pimpl_->SetPrivate(key, sz); +} + +RSA::~RSA() +{ + ysDelete(pimpl_); +} + + +// get cipher text length, varies on key size +unsigned int RSA::get_cipherLength() const +{ + return pimpl_->publicKey_.FixedCiphertextLength(); +} + + +// get signautre length, varies on key size +unsigned int RSA::get_signatureLength() const +{ + return get_cipherLength(); +} + + +// RSA Sign message of length sz into sig +void RSA::sign(byte* sig, const byte* message, unsigned int sz, + const RandomPool& random) +{ + TaoCrypt::RSAES_Decryptor dec(pimpl_->privateKey_); + dec.SSL_Sign(message, sz, sig, random.pimpl_->RNG_); +} + + +// RSA Verify message of length sz against sig +bool RSA::verify(const byte* message, unsigned int sz, const byte* sig, + unsigned int) +{ + TaoCrypt::RSAES_Encryptor enc(pimpl_->publicKey_); + return enc.SSL_Verify(message, sz, sig); +} + + +// RSA public encrypt plain of length sz into cipher +void RSA::encrypt(byte* cipher, const byte* plain, unsigned int sz, + const RandomPool& random) +{ + + TaoCrypt::RSAES_Encryptor enc(pimpl_->publicKey_); + enc.Encrypt(plain, sz, cipher, random.pimpl_->RNG_); +} + + +// RSA private decrypt cipher of length sz into plain +void RSA::decrypt(byte* plain, const byte* cipher, unsigned int sz, + const RandomPool& random) +{ + TaoCrypt::RSAES_Decryptor dec(pimpl_->privateKey_); + dec.Decrypt(cipher, sz, plain, random.pimpl_->RNG_); +} + + +struct Integer::IntegerImpl { + TaoCrypt::Integer int_; + + IntegerImpl() {} + explicit IntegerImpl(const TaoCrypt::Integer& i) : int_(i) {} +}; + +Integer::Integer() : pimpl_(NEW_YS IntegerImpl) {} + +Integer::~Integer() { ysDelete(pimpl_); } + + + +Integer::Integer(const Integer& other) : pimpl_(NEW_YS + IntegerImpl(other.pimpl_->int_)) +{} + + +Integer& Integer::operator=(const Integer& that) +{ + pimpl_->int_ = that.pimpl_->int_; + + return *this; +} + + +void Integer::assign(const byte* num, unsigned int sz) +{ + pimpl_->int_ = TaoCrypt::Integer(num, sz); +} + + +struct DiffieHellman::DHImpl { + TaoCrypt::DH dh_; + TaoCrypt::RandomNumberGenerator& ranPool_; + byte* publicKey_; + byte* privateKey_; + byte* agreedKey_; + + DHImpl(TaoCrypt::RandomNumberGenerator& r) : ranPool_(r), publicKey_(0), + privateKey_(0), agreedKey_(0) {} + ~DHImpl() + { + ysArrayDelete(agreedKey_); + ysArrayDelete(privateKey_); + ysArrayDelete(publicKey_); + } + + DHImpl(const DHImpl& that) : dh_(that.dh_), ranPool_(that.ranPool_), + publicKey_(0), privateKey_(0), agreedKey_(0) + { + uint length = dh_.GetByteLength(); + AllocKeys(length, length, length); + } + + void AllocKeys(unsigned int pubSz, unsigned int privSz, unsigned int agrSz) + { + publicKey_ = NEW_YS byte[pubSz]; + privateKey_ = NEW_YS byte[privSz]; + agreedKey_ = NEW_YS byte[agrSz]; + } +}; + + + +/* +// server Side DH, server's view +DiffieHellman::DiffieHellman(const char* file, const RandomPool& random) + : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_)) +{ + using namespace TaoCrypt; + Source source; + FileSource(file, source); + if (source.size() == 0) + return; // TODO add error state, and force check + HexDecoder hd(source); + + pimpl_->dh_.Initialize(source); + + uint length = pimpl_->dh_.GetByteLength(); + + pimpl_->AllocKeys(length, length, length); + pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, + pimpl_->publicKey_); +} +*/ + + +// server Side DH, client's view +DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g, + unsigned int gSz, const byte* pub, + unsigned int pubSz, const RandomPool& random) + : pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_)) +{ + using TaoCrypt::Integer; + + pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref()); + pimpl_->publicKey_ = NEW_YS opaque[pubSz]; + memcpy(pimpl_->publicKey_, pub, pubSz); +} + + +// Server Side DH, server's view +DiffieHellman::DiffieHellman(const Integer& p, const Integer& g, + const RandomPool& random) +: pimpl_(NEW_YS DHImpl(random.pimpl_->RNG_)) +{ + using TaoCrypt::Integer; + + pimpl_->dh_.Initialize(p.pimpl_->int_, g.pimpl_->int_); + + uint length = pimpl_->dh_.GetByteLength(); + + pimpl_->AllocKeys(length, length, length); + pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, + pimpl_->publicKey_); +} + +DiffieHellman::~DiffieHellman() { ysDelete(pimpl_); } + + +// Client side and view, use server that for p and g +DiffieHellman::DiffieHellman(const DiffieHellman& that) + : pimpl_(NEW_YS DHImpl(*that.pimpl_)) +{ + pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, + pimpl_->publicKey_); +} + + +DiffieHellman& DiffieHellman::operator=(const DiffieHellman& that) +{ + pimpl_->dh_ = that.pimpl_->dh_; + pimpl_->dh_.GenerateKeyPair(pimpl_->ranPool_, pimpl_->privateKey_, + pimpl_->publicKey_); + return *this; +} + + +void DiffieHellman::makeAgreement(const byte* other, unsigned int otherSz) +{ + pimpl_->dh_.Agree(pimpl_->agreedKey_, pimpl_->privateKey_, other, otherSz); +} + + +uint DiffieHellman::get_agreedKeyLength() const +{ + return pimpl_->dh_.GetByteLength(); +} + + +const byte* DiffieHellman::get_agreedKey() const +{ + return pimpl_->agreedKey_; +} + + +const byte* DiffieHellman::get_publicKey() const +{ + return pimpl_->publicKey_; +} + + +void DiffieHellman::set_sizes(int& pSz, int& gSz, int& pubSz) const +{ + using TaoCrypt::Integer; + Integer p = pimpl_->dh_.GetP(); + Integer g = pimpl_->dh_.GetG(); + + pSz = p.ByteCount(); + gSz = g.ByteCount(); + pubSz = pimpl_->dh_.GetByteLength(); +} + + +void DiffieHellman::get_parms(byte* bp, byte* bg, byte* bpub) const +{ + using TaoCrypt::Integer; + Integer p = pimpl_->dh_.GetP(); + Integer g = pimpl_->dh_.GetG(); + + p.Encode(bp, p.ByteCount()); + g.Encode(bg, g.ByteCount()); + memcpy(bpub, pimpl_->publicKey_, pimpl_->dh_.GetByteLength()); +} + + +// convert PEM file to DER x509 type +x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info) +{ + using namespace TaoCrypt; + + char header[80]; + char footer[80]; + + if (type == Cert) { + strncpy(header, "-----BEGIN CERTIFICATE-----", sizeof(header)); + strncpy(footer, "-----END CERTIFICATE-----", sizeof(footer)); + } else { + strncpy(header, "-----BEGIN RSA PRIVATE KEY-----", sizeof(header)); + strncpy(footer, "-----END RSA PRIVATE KEY-----", sizeof(header)); + } + + long begin = -1; + long end = 0; + bool foundEnd = false; + + char line[80]; + + while(fgets(line, sizeof(line), file)) + if (strncmp(header, line, strlen(header)) == 0) { + begin = ftell(file); + break; + } + + // remove encrypted header if there + if (fgets(line, sizeof(line), file)) { + char encHeader[] = "Proc-Type"; + if (strncmp(encHeader, line, strlen(encHeader)) == 0 && + fgets(line,sizeof(line), file)) { + + char* start = strstr(line, "DES"); + char* finish = strstr(line, ","); + if (!start) + start = strstr(line, "AES"); + + if (!info) return 0; + + if ( start && finish && (start < finish)) { + memcpy(info->name, start, finish - start); + info->name[finish - start] = 0; + memcpy(info->iv, finish + 1, sizeof(info->iv)); + + char* newline = strstr(line, "\r"); + if (!newline) newline = strstr(line, "\n"); + if (newline && (newline > finish)) { + info->ivSz = newline - (finish + 1); + info->set = true; + } + } + fgets(line,sizeof(line), file); // get blank line + begin = ftell(file); + } + + } + + while(fgets(line, sizeof(line), file)) + if (strncmp(footer, line, strlen(footer)) == 0) { + foundEnd = true; + break; + } + else + end = ftell(file); + + if (begin == -1 || !foundEnd) + return 0; + + input_buffer tmp(end - begin); + fseek(file, begin, SEEK_SET); + size_t bytes = fread(tmp.get_buffer(), end - begin, 1, file); + if (bytes != 1) + return 0; + + Source der(tmp.get_buffer(), end - begin); + Base64Decoder b64Dec(der); + + uint sz = der.size(); + mySTL::auto_ptr x(NEW_YS x509(sz)); + memcpy(x->use_buffer(), der.get_buffer(), sz); + + return x.release(); +} + + +} // namespace + + +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION +namespace yaSSL { +template void ysDelete(DiffieHellman::DHImpl*); +template void ysDelete(Integer::IntegerImpl*); +template void ysDelete(RSA::RSAImpl*); +template void ysDelete(DSS::DSSImpl*); +template void ysDelete(RandomPool::RandomImpl*); +template void ysDelete(AES::AESImpl*); +template void ysDelete(RC4::RC4Impl*); +template void ysDelete(DES_EDE::DES_EDEImpl*); +template void ysDelete(DES::DESImpl*); +template void ysDelete(HMAC_RMD::HMAC_RMDImpl*); +template void ysDelete(HMAC_SHA::HMAC_SHAImpl*); +template void ysDelete(HMAC_MD5::HMAC_MD5Impl*); +template void ysDelete(RMD::RMDImpl*); +template void ysDelete(SHA::SHAImpl*); +template void ysDelete(MD5::MD5Impl*); +} +#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION + +#endif // !USE_CRYPTOPP_LIB diff --git a/externals/mysql/extlib/yassl/src/dummy.cpp b/externals/mysql/extlib/yassl/src/dummy.cpp new file mode 100644 index 0000000..19b7fe8 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/dummy.cpp @@ -0,0 +1,4 @@ +/* + To make libtool always use a C++ linker when compiling with yaSSL we need + to add a dummy C++ file to the source list. +*/ diff --git a/externals/mysql/extlib/yassl/src/handshake.cpp b/externals/mysql/extlib/yassl/src/handshake.cpp new file mode 100644 index 0000000..262b5cb --- /dev/null +++ b/externals/mysql/extlib/yassl/src/handshake.cpp @@ -0,0 +1,1117 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* The handshake source implements functions for creating and reading + * the various handshake messages. + */ + + + +#include "runtime.hpp" +#include "handshake.hpp" +#include "yassl_int.hpp" + + +namespace yaSSL { + + + +// Build a client hello message from cipher suites and compression method +void buildClientHello(SSL& ssl, ClientHello& hello) +{ + // store for pre master secret + ssl.useSecurity().use_connection().chVersion_ = hello.client_version_; + + ssl.getCrypto().get_random().Fill(hello.random_, RAN_LEN); + if (ssl.getSecurity().get_resuming()) { + hello.id_len_ = ID_LEN; + memcpy(hello.session_id_, ssl.getSecurity().get_resume().GetID(), + ID_LEN); + } + else + hello.id_len_ = 0; + hello.suite_len_ = ssl.getSecurity().get_parms().suites_size_; + memcpy(hello.cipher_suites_, ssl.getSecurity().get_parms().suites_, + hello.suite_len_); + hello.comp_len_ = 1; + + hello.set_length(sizeof(ProtocolVersion) + + RAN_LEN + + hello.id_len_ + sizeof(hello.id_len_) + + hello.suite_len_ + sizeof(hello.suite_len_) + + hello.comp_len_ + sizeof(hello.comp_len_)); +} + + +// Build a server hello message +void buildServerHello(SSL& ssl, ServerHello& hello) +{ + if (ssl.getSecurity().get_resuming()) { + memcpy(hello.random_,ssl.getSecurity().get_connection().server_random_, + RAN_LEN); + memcpy(hello.session_id_, ssl.getSecurity().get_resume().GetID(), + ID_LEN); + } + else { + ssl.getCrypto().get_random().Fill(hello.random_, RAN_LEN); + ssl.getCrypto().get_random().Fill(hello.session_id_, ID_LEN); + } + hello.id_len_ = ID_LEN; + ssl.set_sessionID(hello.session_id_); + + hello.cipher_suite_[0] = ssl.getSecurity().get_parms().suite_[0]; + hello.cipher_suite_[1] = ssl.getSecurity().get_parms().suite_[1]; + hello.compression_method_ = hello.compression_method_; + + hello.set_length(sizeof(ProtocolVersion) + RAN_LEN + ID_LEN + + sizeof(hello.id_len_) + SUITE_LEN + SIZEOF_ENUM); +} + + +// add handshake from buffer into md5 and sha hashes, use handshake header +void hashHandShake(SSL& ssl, const input_buffer& input, uint sz) +{ + const opaque* buffer = input.get_buffer() + input.get_current() - + HANDSHAKE_HEADER; + sz += HANDSHAKE_HEADER; + ssl.useHashes().use_MD5().update(buffer, sz); + ssl.useHashes().use_SHA().update(buffer, sz); +} + + +// locals +namespace { + +// Write a plaintext record to buffer +void buildOutput(output_buffer& buffer, const RecordLayerHeader& rlHdr, + const Message& msg) +{ + buffer.allocate(RECORD_HEADER + rlHdr.length_); + buffer << rlHdr << msg; +} + + +// Write a plaintext record to buffer +void buildOutput(output_buffer& buffer, const RecordLayerHeader& rlHdr, + const HandShakeHeader& hsHdr, const HandShakeBase& shake) +{ + buffer.allocate(RECORD_HEADER + rlHdr.length_); + buffer << rlHdr << hsHdr << shake; +} + + +// Build Record Layer header for Message without handshake header +void buildHeader(SSL& ssl, RecordLayerHeader& rlHeader, const Message& msg) +{ + ProtocolVersion pv = ssl.getSecurity().get_connection().version_; + rlHeader.type_ = msg.get_type(); + rlHeader.version_.major_ = pv.major_; + rlHeader.version_.minor_ = pv.minor_; + rlHeader.length_ = msg.get_length(); +} + + +// Build HandShake and RecordLayer Headers for handshake output +void buildHeaders(SSL& ssl, HandShakeHeader& hsHeader, + RecordLayerHeader& rlHeader, const HandShakeBase& shake) +{ + int sz = shake.get_length(); + + hsHeader.set_type(shake.get_type()); + hsHeader.set_length(sz); + + ProtocolVersion pv = ssl.getSecurity().get_connection().version_; + rlHeader.type_ = handshake; + rlHeader.version_.major_ = pv.major_; + rlHeader.version_.minor_ = pv.minor_; + rlHeader.length_ = sz + HANDSHAKE_HEADER; +} + + +// add handshake from buffer into md5 and sha hashes, exclude record header +void hashHandShake(SSL& ssl, const output_buffer& output, bool removeIV = false) +{ + uint sz = output.get_size() - RECORD_HEADER; + + const opaque* buffer = output.get_buffer() + RECORD_HEADER; + + if (removeIV) { // TLSv1_1 IV + uint blockSz = ssl.getCrypto().get_cipher().get_blockSize(); + sz -= blockSz; + buffer += blockSz; + } + + ssl.useHashes().use_MD5().update(buffer, sz); + ssl.useHashes().use_SHA().update(buffer, sz); +} + + +// calculate MD5 hash for finished +void buildMD5(SSL& ssl, Finished& fin, const opaque* sender) +{ + + opaque md5_result[MD5_LEN]; + opaque md5_inner[SIZEOF_SENDER + SECRET_LEN + PAD_MD5]; + opaque md5_outer[SECRET_LEN + PAD_MD5 + MD5_LEN]; + + const opaque* master_secret = + ssl.getSecurity().get_connection().master_secret_; + + // make md5 inner + memcpy(md5_inner, sender, SIZEOF_SENDER); + memcpy(&md5_inner[SIZEOF_SENDER], master_secret, SECRET_LEN); + memcpy(&md5_inner[SIZEOF_SENDER + SECRET_LEN], PAD1, PAD_MD5); + + ssl.useHashes().use_MD5().get_digest(md5_result, md5_inner, + sizeof(md5_inner)); + + // make md5 outer + memcpy(md5_outer, master_secret, SECRET_LEN); + memcpy(&md5_outer[SECRET_LEN], PAD2, PAD_MD5); + memcpy(&md5_outer[SECRET_LEN + PAD_MD5], md5_result, MD5_LEN); + + ssl.useHashes().use_MD5().get_digest(fin.set_md5(), md5_outer, + sizeof(md5_outer)); +} + + +// calculate SHA hash for finished +void buildSHA(SSL& ssl, Finished& fin, const opaque* sender) +{ + + opaque sha_result[SHA_LEN]; + opaque sha_inner[SIZEOF_SENDER + SECRET_LEN + PAD_SHA]; + opaque sha_outer[SECRET_LEN + PAD_SHA + SHA_LEN]; + + const opaque* master_secret = + ssl.getSecurity().get_connection().master_secret_; + + // make sha inner + memcpy(sha_inner, sender, SIZEOF_SENDER); + memcpy(&sha_inner[SIZEOF_SENDER], master_secret, SECRET_LEN); + memcpy(&sha_inner[SIZEOF_SENDER + SECRET_LEN], PAD1, PAD_SHA); + + ssl.useHashes().use_SHA().get_digest(sha_result, sha_inner, + sizeof(sha_inner)); + + // make sha outer + memcpy(sha_outer, master_secret, SECRET_LEN); + memcpy(&sha_outer[SECRET_LEN], PAD2, PAD_SHA); + memcpy(&sha_outer[SECRET_LEN + PAD_SHA], sha_result, SHA_LEN); + + ssl.useHashes().use_SHA().get_digest(fin.set_sha(), sha_outer, + sizeof(sha_outer)); +} + + +// decrypt input message in place, store size in case needed later +void decrypt_message(SSL& ssl, input_buffer& input, uint sz) +{ + input_buffer plain(sz); + opaque* cipher = input.get_buffer() + input.get_current(); + + ssl.useCrypto().use_cipher().decrypt(plain.get_buffer(), cipher, sz); + memcpy(cipher, plain.get_buffer(), sz); + ssl.useSecurity().use_parms().encrypt_size_ = sz; + + if (ssl.isTLSv1_1()) // IV + input.set_current(input.get_current() + + ssl.getCrypto().get_cipher().get_blockSize()); +} + + +// output operator for input_buffer +output_buffer& operator<<(output_buffer& output, const input_buffer& input) +{ + output.write(input.get_buffer(), input.get_size()); + return output; +} + + +// write headers, handshake hash, mac, pad, and encrypt +void cipherFinished(SSL& ssl, Finished& fin, output_buffer& output) +{ + uint digestSz = ssl.getCrypto().get_digest().get_digestSize(); + uint finishedSz = ssl.isTLS() ? TLS_FINISHED_SZ : FINISHED_SZ; + uint sz = RECORD_HEADER + HANDSHAKE_HEADER + finishedSz + digestSz; + uint pad = 0; + uint blockSz = ssl.getCrypto().get_cipher().get_blockSize(); + + if (ssl.getSecurity().get_parms().cipher_type_ == block) { + if (ssl.isTLSv1_1()) + sz += blockSz; // IV + sz += 1; // pad byte + pad = (sz - RECORD_HEADER) % blockSz; + pad = blockSz - pad; + sz += pad; + } + + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + buildHeaders(ssl, hsHeader, rlHeader, fin); + rlHeader.length_ = sz - RECORD_HEADER; // record header includes mac + // and pad, hanshake doesn't + input_buffer iv; + if (ssl.isTLSv1_1() && ssl.getSecurity().get_parms().cipher_type_== block){ + iv.allocate(blockSz); + ssl.getCrypto().get_random().Fill(iv.get_buffer(), blockSz); + iv.add_size(blockSz); + } + uint ivSz = iv.get_size(); + output.allocate(sz); + output << rlHeader << iv << hsHeader << fin; + + hashHandShake(ssl, output, ssl.isTLSv1_1() ? true : false); + opaque digest[SHA_LEN]; // max size + if (ssl.isTLS()) + TLS_hmac(ssl, digest, output.get_buffer() + RECORD_HEADER + ivSz, + output.get_size() - RECORD_HEADER - ivSz, handshake); + else + hmac(ssl, digest, output.get_buffer() + RECORD_HEADER, + output.get_size() - RECORD_HEADER, handshake); + output.write(digest, digestSz); + + if (ssl.getSecurity().get_parms().cipher_type_ == block) + for (uint i = 0; i <= pad; i++) output[AUTO] = pad; // pad byte gets + // pad value too + input_buffer cipher(rlHeader.length_); + ssl.useCrypto().use_cipher().encrypt(cipher.get_buffer(), + output.get_buffer() + RECORD_HEADER, output.get_size() - RECORD_HEADER); + output.set_current(RECORD_HEADER); + output.write(cipher.get_buffer(), cipher.get_capacity()); +} + + +// build an encrypted data or alert message for output +void buildMessage(SSL& ssl, output_buffer& output, const Message& msg) +{ + uint digestSz = ssl.getCrypto().get_digest().get_digestSize(); + uint sz = RECORD_HEADER + msg.get_length() + digestSz; + uint pad = 0; + uint blockSz = ssl.getCrypto().get_cipher().get_blockSize(); + + if (ssl.getSecurity().get_parms().cipher_type_ == block) { + if (ssl.isTLSv1_1()) // IV + sz += blockSz; + sz += 1; // pad byte + pad = (sz - RECORD_HEADER) % blockSz; + pad = blockSz - pad; + sz += pad; + } + + RecordLayerHeader rlHeader; + buildHeader(ssl, rlHeader, msg); + rlHeader.length_ = sz - RECORD_HEADER; // record header includes mac + // and pad, hanshake doesn't + input_buffer iv; + if (ssl.isTLSv1_1() && ssl.getSecurity().get_parms().cipher_type_== block){ + iv.allocate(blockSz); + ssl.getCrypto().get_random().Fill(iv.get_buffer(), blockSz); + iv.add_size(blockSz); + } + + uint ivSz = iv.get_size(); + output.allocate(sz); + output << rlHeader << iv << msg; + + opaque digest[SHA_LEN]; // max size + if (ssl.isTLS()) + TLS_hmac(ssl, digest, output.get_buffer() + RECORD_HEADER + ivSz, + output.get_size() - RECORD_HEADER - ivSz, msg.get_type()); + else + hmac(ssl, digest, output.get_buffer() + RECORD_HEADER, + output.get_size() - RECORD_HEADER, msg.get_type()); + output.write(digest, digestSz); + + if (ssl.getSecurity().get_parms().cipher_type_ == block) + for (uint i = 0; i <= pad; i++) output[AUTO] = pad; // pad byte gets + // pad value too + input_buffer cipher(rlHeader.length_); + ssl.useCrypto().use_cipher().encrypt(cipher.get_buffer(), + output.get_buffer() + RECORD_HEADER, output.get_size() - RECORD_HEADER); + output.set_current(RECORD_HEADER); + output.write(cipher.get_buffer(), cipher.get_capacity()); +} + + +// build alert message +void buildAlert(SSL& ssl, output_buffer& output, const Alert& alert) +{ + if (ssl.getSecurity().get_parms().pending_ == false) // encrypted + buildMessage(ssl, output, alert); + else { + RecordLayerHeader rlHeader; + buildHeader(ssl, rlHeader, alert); + buildOutput(output, rlHeader, alert); + } +} + + +// build TLS finished message +void buildFinishedTLS(SSL& ssl, Finished& fin, const opaque* sender) +{ + opaque handshake_hash[FINISHED_SZ]; + + ssl.useHashes().use_MD5().get_digest(handshake_hash); + ssl.useHashes().use_SHA().get_digest(&handshake_hash[MD5_LEN]); + + const opaque* side; + if ( strncmp((const char*)sender, (const char*)client, SIZEOF_SENDER) == 0) + side = tls_client; + else + side = tls_server; + + PRF(fin.set_md5(), TLS_FINISHED_SZ, + ssl.getSecurity().get_connection().master_secret_, SECRET_LEN, + side, FINISHED_LABEL_SZ, + handshake_hash, FINISHED_SZ); + + fin.set_length(TLS_FINISHED_SZ); // shorter length for TLS +} + + +// compute p_hash for MD5 or SHA-1 for TLSv1 PRF +void p_hash(output_buffer& result, const output_buffer& secret, + const output_buffer& seed, MACAlgorithm hash) +{ + uint len = hash == md5 ? MD5_LEN : SHA_LEN; + uint times = result.get_capacity() / len; + uint lastLen = result.get_capacity() % len; + opaque previous[SHA_LEN]; // max size + opaque current[SHA_LEN]; // max size + mySTL::auto_ptr hmac; + + if (lastLen) times += 1; + + if (hash == md5) + hmac.reset(NEW_YS HMAC_MD5(secret.get_buffer(), secret.get_size())); + else + hmac.reset(NEW_YS HMAC_SHA(secret.get_buffer(), secret.get_size())); + // A0 = seed + hmac->get_digest(previous, seed.get_buffer(), seed.get_size());// A1 + uint lastTime = times - 1; + + for (uint i = 0; i < times; i++) { + hmac->update(previous, len); + hmac->get_digest(current, seed.get_buffer(), seed.get_size()); + + if (lastLen && (i == lastTime)) + result.write(current, lastLen); + else { + result.write(current, len); + //memcpy(previous, current, len); + hmac->get_digest(previous, previous, len); + } + } +} + + +// calculate XOR for TLSv1 PRF +void get_xor(byte *digest, uint digLen, output_buffer& md5, + output_buffer& sha) +{ + for (uint i = 0; i < digLen; i++) + digest[i] = md5[AUTO] ^ sha[AUTO]; +} + + +// build MD5 part of certificate verify +void buildMD5_CertVerify(SSL& ssl, byte* digest) +{ + opaque md5_result[MD5_LEN]; + opaque md5_inner[SECRET_LEN + PAD_MD5]; + opaque md5_outer[SECRET_LEN + PAD_MD5 + MD5_LEN]; + + const opaque* master_secret = + ssl.getSecurity().get_connection().master_secret_; + + // make md5 inner + memcpy(md5_inner, master_secret, SECRET_LEN); + memcpy(&md5_inner[SECRET_LEN], PAD1, PAD_MD5); + + ssl.useHashes().use_MD5().get_digest(md5_result, md5_inner, + sizeof(md5_inner)); + + // make md5 outer + memcpy(md5_outer, master_secret, SECRET_LEN); + memcpy(&md5_outer[SECRET_LEN], PAD2, PAD_MD5); + memcpy(&md5_outer[SECRET_LEN + PAD_MD5], md5_result, MD5_LEN); + + ssl.useHashes().use_MD5().get_digest(digest, md5_outer, sizeof(md5_outer)); +} + + +// build SHA part of certificate verify +void buildSHA_CertVerify(SSL& ssl, byte* digest) +{ + opaque sha_result[SHA_LEN]; + opaque sha_inner[SECRET_LEN + PAD_SHA]; + opaque sha_outer[SECRET_LEN + PAD_SHA + SHA_LEN]; + + const opaque* master_secret = + ssl.getSecurity().get_connection().master_secret_; + + // make sha inner + memcpy(sha_inner, master_secret, SECRET_LEN); + memcpy(&sha_inner[SECRET_LEN], PAD1, PAD_SHA); + + ssl.useHashes().use_SHA().get_digest(sha_result, sha_inner, + sizeof(sha_inner)); + + // make sha outer + memcpy(sha_outer, master_secret, SECRET_LEN); + memcpy(&sha_outer[SECRET_LEN], PAD2, PAD_SHA); + memcpy(&sha_outer[SECRET_LEN + PAD_SHA], sha_result, SHA_LEN); + + ssl.useHashes().use_SHA().get_digest(digest, sha_outer, sizeof(sha_outer)); +} + + +} // namespace for locals + + +// some clients still send sslv2 client hello +void ProcessOldClientHello(input_buffer& input, SSL& ssl) +{ + if (input.get_remaining() < 2) { + ssl.SetError(bad_input); + return; + } + byte b0 = input[AUTO]; + byte b1 = input[AUTO]; + + uint16 sz = ((b0 & 0x7f) << 8) | b1; + + if (sz > input.get_remaining()) { + ssl.SetError(bad_input); + return; + } + + // hashHandShake manually + const opaque* buffer = input.get_buffer() + input.get_current(); + ssl.useHashes().use_MD5().update(buffer, sz); + ssl.useHashes().use_SHA().update(buffer, sz); + + b1 = input[AUTO]; // does this value mean client_hello? + + ClientHello ch; + ch.client_version_.major_ = input[AUTO]; + ch.client_version_.minor_ = input[AUTO]; + + byte len[2]; + + input.read(len, sizeof(len)); + ato16(len, ch.suite_len_); + + input.read(len, sizeof(len)); + uint16 sessionLen; + ato16(len, sessionLen); + ch.id_len_ = sessionLen; + + input.read(len, sizeof(len)); + uint16 randomLen; + ato16(len, randomLen); + if (ch.suite_len_ > MAX_SUITE_SZ || sessionLen > ID_LEN || + randomLen > RAN_LEN) { + ssl.SetError(bad_input); + return; + } + + int j = 0; + for (uint16 i = 0; i < ch.suite_len_; i += 3) { + byte first = input[AUTO]; + if (first) // sslv2 type + input.read(len, SUITE_LEN); // skip + else { + input.read(&ch.cipher_suites_[j], SUITE_LEN); + j += SUITE_LEN; + } + } + ch.suite_len_ = j; + + if (ch.id_len_) + input.read(ch.session_id_, ch.id_len_); + + if (randomLen < RAN_LEN) + memset(ch.random_, 0, RAN_LEN - randomLen); + input.read(&ch.random_[RAN_LEN - randomLen], randomLen); + + + ch.Process(input, ssl); +} + + +// Build a finished message, see 7.6.9 +void buildFinished(SSL& ssl, Finished& fin, const opaque* sender) +{ + // store current states, building requires get_digest which resets state + MD5 md5(ssl.getHashes().get_MD5()); + SHA sha(ssl.getHashes().get_SHA()); + + if (ssl.isTLS()) + buildFinishedTLS(ssl, fin, sender); + else { + buildMD5(ssl, fin, sender); + buildSHA(ssl, fin, sender); + } + + // restore + ssl.useHashes().use_MD5() = md5; + ssl.useHashes().use_SHA() = sha; +} + + +/* compute SSLv3 HMAC into digest see + * buffer is of sz size and includes HandShake Header but not a Record Header + * verify means to check peers hmac +*/ +void hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz, + ContentType content, bool verify) +{ + Digest& mac = ssl.useCrypto().use_digest(); + opaque inner[SHA_LEN + PAD_MD5 + SEQ_SZ + SIZEOF_ENUM + LENGTH_SZ]; + opaque outer[SHA_LEN + PAD_MD5 + SHA_LEN]; + opaque result[SHA_LEN]; // max possible sizes + uint digestSz = mac.get_digestSize(); // actual sizes + uint padSz = mac.get_padSize(); + uint innerSz = digestSz + padSz + SEQ_SZ + SIZEOF_ENUM + LENGTH_SZ; + uint outerSz = digestSz + padSz + digestSz; + + // data + const opaque* mac_secret = ssl.get_macSecret(verify); + opaque seq[SEQ_SZ] = { 0x00, 0x00, 0x00, 0x00 }; + opaque length[LENGTH_SZ]; + c16toa(sz, length); + c32toa(ssl.get_SEQIncrement(verify), &seq[sizeof(uint32)]); + + // make inner + memcpy(inner, mac_secret, digestSz); + memcpy(&inner[digestSz], PAD1, padSz); + memcpy(&inner[digestSz + padSz], seq, SEQ_SZ); + inner[digestSz + padSz + SEQ_SZ] = content; + memcpy(&inner[digestSz + padSz + SEQ_SZ + SIZEOF_ENUM], length, LENGTH_SZ); + + mac.update(inner, innerSz); + mac.get_digest(result, buffer, sz); // append content buffer + + // make outer + memcpy(outer, mac_secret, digestSz); + memcpy(&outer[digestSz], PAD2, padSz); + memcpy(&outer[digestSz + padSz], result, digestSz); + + mac.get_digest(digest, outer, outerSz); +} + + +// TLS type HAMC +void TLS_hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz, + ContentType content, bool verify) +{ + mySTL::auto_ptr hmac; + opaque seq[SEQ_SZ] = { 0x00, 0x00, 0x00, 0x00 }; + opaque length[LENGTH_SZ]; + opaque inner[SIZEOF_ENUM + VERSION_SZ + LENGTH_SZ]; // type + version + len + + c16toa(sz, length); + c32toa(ssl.get_SEQIncrement(verify), &seq[sizeof(uint32)]); + + MACAlgorithm algo = ssl.getSecurity().get_parms().mac_algorithm_; + + if (algo == sha) + hmac.reset(NEW_YS HMAC_SHA(ssl.get_macSecret(verify), SHA_LEN)); + else if (algo == rmd) + hmac.reset(NEW_YS HMAC_RMD(ssl.get_macSecret(verify), RMD_LEN)); + else + hmac.reset(NEW_YS HMAC_MD5(ssl.get_macSecret(verify), MD5_LEN)); + + hmac->update(seq, SEQ_SZ); // seq_num + inner[0] = content; // type + inner[SIZEOF_ENUM] = ssl.getSecurity().get_connection().version_.major_; + inner[SIZEOF_ENUM + SIZEOF_ENUM] = + ssl.getSecurity().get_connection().version_.minor_; // version + memcpy(&inner[SIZEOF_ENUM + VERSION_SZ], length, LENGTH_SZ); // length + hmac->update(inner, sizeof(inner)); + hmac->get_digest(digest, buffer, sz); // content +} + + +// compute TLSv1 PRF (pseudo random function using HMAC) +void PRF(byte* digest, uint digLen, const byte* secret, uint secLen, + const byte* label, uint labLen, const byte* seed, uint seedLen) +{ + uint half = (secLen + 1) / 2; + + output_buffer md5_half(half); + output_buffer sha_half(half); + output_buffer labelSeed(labLen + seedLen); + + md5_half.write(secret, half); + sha_half.write(secret + half - secLen % 2, half); + labelSeed.write(label, labLen); + labelSeed.write(seed, seedLen); + + output_buffer md5_result(digLen); + output_buffer sha_result(digLen); + + p_hash(md5_result, md5_half, labelSeed, md5); + p_hash(sha_result, sha_half, labelSeed, sha); + + md5_result.set_current(0); + sha_result.set_current(0); + get_xor(digest, digLen, md5_result, sha_result); +} + + +// build certificate hashes +void build_certHashes(SSL& ssl, Hashes& hashes) +{ + // store current states, building requires get_digest which resets state + MD5 md5(ssl.getHashes().get_MD5()); + SHA sha(ssl.getHashes().get_SHA()); + + if (ssl.isTLS()) { + ssl.useHashes().use_MD5().get_digest(hashes.md5_); + ssl.useHashes().use_SHA().get_digest(hashes.sha_); + } + else { + buildMD5_CertVerify(ssl, hashes.md5_); + buildSHA_CertVerify(ssl, hashes.sha_); + } + + // restore + ssl.useHashes().use_MD5() = md5; + ssl.useHashes().use_SHA() = sha; +} + + + +// do process input requests, return 0 is done, 1 is call again to complete +int DoProcessReply(SSL& ssl) +{ + // wait for input if blocking + if (!ssl.useSocket().wait()) { + ssl.SetError(receive_error); + return 0; + } + uint ready = ssl.getSocket().get_ready(); + if (!ready) return 1; + + // add buffered data if its there + input_buffer* buffered = ssl.useBuffers().TakeRawInput(); + uint buffSz = buffered ? buffered->get_size() : 0; + input_buffer buffer(buffSz + ready); + if (buffSz) { + buffer.assign(buffered->get_buffer(), buffSz); + ysDelete(buffered); + buffered = 0; + } + + // add new data + uint read = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready); + if (read == static_cast(-1)) { + ssl.SetError(receive_error); + return 0; + } + buffer.add_size(read); + uint offset = 0; + const MessageFactory& mf = ssl.getFactory().getMessage(); + + // old style sslv2 client hello? + if (ssl.getSecurity().get_parms().entity_ == server_end && + ssl.getStates().getServer() == clientNull) + if (buffer.peek() != handshake) { + ProcessOldClientHello(buffer, ssl); + if (ssl.GetError()) + return 0; + } + + while(!buffer.eof()) { + // each record + RecordLayerHeader hdr; + bool needHdr = false; + + if (static_cast(RECORD_HEADER) > buffer.get_remaining()) + needHdr = true; + else { + buffer >> hdr; + ssl.verifyState(hdr); + } + + // make sure we have enough input in buffer to process this record + if (needHdr || hdr.length_ > buffer.get_remaining()) { + // put header in front for next time processing + uint extra = needHdr ? 0 : RECORD_HEADER; + uint sz = buffer.get_remaining() + extra; + ssl.useBuffers().SetRawInput(NEW_YS input_buffer(sz, + buffer.get_buffer() + buffer.get_current() - extra, sz)); + return 1; + } + + while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) { + // each message in record, can be more than 1 if not encrypted + if (ssl.getSecurity().get_parms().pending_ == false) // cipher on + decrypt_message(ssl, buffer, hdr.length_); + + mySTL::auto_ptr msg(mf.CreateObject(hdr.type_)); + if (!msg.get()) { + ssl.SetError(factory_error); + return 0; + } + buffer >> *msg; + msg->Process(buffer, ssl); + if (ssl.GetError()) + return 0; + } + offset += hdr.length_ + RECORD_HEADER; + } + return 0; +} + + +// process input requests +void processReply(SSL& ssl) +{ + if (ssl.GetError()) return; + + if (DoProcessReply(ssl)) + // didn't complete process + if (!ssl.getSocket().IsNonBlocking()) { + // keep trying now, blocking ok + while (!ssl.GetError()) + if (DoProcessReply(ssl) == 0) break; + } + else + // user will have try again later, non blocking + ssl.SetError(YasslError(SSL_ERROR_WANT_READ)); +} + + +// send client_hello, no buffering +void sendClientHello(SSL& ssl) +{ + ssl.verifyState(serverNull); + if (ssl.GetError()) return; + + ClientHello ch(ssl.getSecurity().get_connection().version_, + ssl.getSecurity().get_connection().compression_); + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + output_buffer out; + + buildClientHello(ssl, ch); + ssl.set_random(ch.get_random(), client_end); + buildHeaders(ssl, hsHeader, rlHeader, ch); + buildOutput(out, rlHeader, hsHeader, ch); + hashHandShake(ssl, out); + + ssl.Send(out.get_buffer(), out.get_size()); +} + + +// send client key exchange +void sendClientKeyExchange(SSL& ssl, BufferOutput buffer) +{ + ssl.verifyState(serverHelloDoneComplete); + if (ssl.GetError()) return; + + ClientKeyExchange ck(ssl); + ck.build(ssl); + ssl.makeMasterSecret(); + + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + mySTL::auto_ptr out(NEW_YS output_buffer); + buildHeaders(ssl, hsHeader, rlHeader, ck); + buildOutput(*out.get(), rlHeader, hsHeader, ck); + hashHandShake(ssl, *out.get()); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send server key exchange +void sendServerKeyExchange(SSL& ssl, BufferOutput buffer) +{ + if (ssl.GetError()) return; + ServerKeyExchange sk(ssl); + sk.build(ssl); + + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + mySTL::auto_ptr out(NEW_YS output_buffer); + buildHeaders(ssl, hsHeader, rlHeader, sk); + buildOutput(*out.get(), rlHeader, hsHeader, sk); + hashHandShake(ssl, *out.get()); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send change cipher +void sendChangeCipher(SSL& ssl, BufferOutput buffer) +{ + if (ssl.getSecurity().get_parms().entity_ == server_end) + if (ssl.getSecurity().get_resuming()) + ssl.verifyState(clientKeyExchangeComplete); + else + ssl.verifyState(clientFinishedComplete); + if (ssl.GetError()) return; + + ChangeCipherSpec ccs; + RecordLayerHeader rlHeader; + buildHeader(ssl, rlHeader, ccs); + mySTL::auto_ptr out(NEW_YS output_buffer); + buildOutput(*out.get(), rlHeader, ccs); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send finished +void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer) +{ + if (ssl.GetError()) return; + + Finished fin; + buildFinished(ssl, fin, side == client_end ? client : server); + mySTL::auto_ptr out(NEW_YS output_buffer); + cipherFinished(ssl, fin, *out.get()); // hashes handshake + + if (ssl.getSecurity().get_resuming()) { + if (side == server_end) + buildFinished(ssl, ssl.useHashes().use_verify(), client); // client + } + else { + if (!ssl.getSecurity().GetContext()->GetSessionCacheOff()) + GetSessions().add(ssl); // store session + if (side == client_end) + buildFinished(ssl, ssl.useHashes().use_verify(), server); // server + } + ssl.useSecurity().use_connection().CleanMaster(); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send data +int sendData(SSL& ssl, const void* buffer, int sz) +{ + if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ)) + ssl.SetError(no_error); + + ssl.verfiyHandShakeComplete(); + if (ssl.GetError()) return -1; + int sent = 0; + + for (;;) { + int len = min(sz - sent, MAX_RECORD_SIZE); + output_buffer out; + input_buffer tmp; + + Data data; + + if (ssl.CompressionOn()) { + if (Compress(static_cast(buffer) + sent, len, + tmp) == -1) { + ssl.SetError(compress_error); + return -1; + } + data.SetData(tmp.get_size(), tmp.get_buffer()); + } + else + data.SetData(len, static_cast(buffer) + sent); + + buildMessage(ssl, out, data); + ssl.Send(out.get_buffer(), out.get_size()); + + if (ssl.GetError()) return -1; + sent += len; + if (sent == sz) break; + } + ssl.useLog().ShowData(sent, true); + return sent; +} + + +// send alert +int sendAlert(SSL& ssl, const Alert& alert) +{ + output_buffer out; + buildAlert(ssl, out, alert); + ssl.Send(out.get_buffer(), out.get_size()); + + return alert.get_length(); +} + + +// process input data +int receiveData(SSL& ssl, Data& data, bool peek) +{ + if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ)) + ssl.SetError(no_error); + + ssl.verfiyHandShakeComplete(); + if (ssl.GetError()) return -1; + + if (!ssl.HasData()) + processReply(ssl); + + if (peek) + ssl.PeekData(data); + else + ssl.fillData(data); + + ssl.useLog().ShowData(data.get_length()); + if (ssl.GetError()) return -1; + + if (data.get_length() == 0 && ssl.getSocket().WouldBlock()) { + ssl.SetError(YasslError(SSL_ERROR_WANT_READ)); + return SSL_WOULD_BLOCK; + } + return data.get_length(); +} + + +// send server hello +void sendServerHello(SSL& ssl, BufferOutput buffer) +{ + if (ssl.getSecurity().get_resuming()) + ssl.verifyState(clientKeyExchangeComplete); + else + ssl.verifyState(clientHelloComplete); + if (ssl.GetError()) return; + + ServerHello sh(ssl.getSecurity().get_connection().version_, + ssl.getSecurity().get_connection().compression_); + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + mySTL::auto_ptr out(NEW_YS output_buffer); + + buildServerHello(ssl, sh); + ssl.set_random(sh.get_random(), server_end); + buildHeaders(ssl, hsHeader, rlHeader, sh); + buildOutput(*out.get(), rlHeader, hsHeader, sh); + hashHandShake(ssl, *out.get()); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send server hello done +void sendServerHelloDone(SSL& ssl, BufferOutput buffer) +{ + if (ssl.GetError()) return; + + ServerHelloDone shd; + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + mySTL::auto_ptr out(NEW_YS output_buffer); + + buildHeaders(ssl, hsHeader, rlHeader, shd); + buildOutput(*out.get(), rlHeader, hsHeader, shd); + hashHandShake(ssl, *out.get()); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send certificate +void sendCertificate(SSL& ssl, BufferOutput buffer) +{ + if (ssl.GetError()) return; + + Certificate cert(ssl.getCrypto().get_certManager().get_cert()); + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + mySTL::auto_ptr out(NEW_YS output_buffer); + + buildHeaders(ssl, hsHeader, rlHeader, cert); + buildOutput(*out.get(), rlHeader, hsHeader, cert); + hashHandShake(ssl, *out.get()); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send certificate request +void sendCertificateRequest(SSL& ssl, BufferOutput buffer) +{ + if (ssl.GetError()) return; + + CertificateRequest request; + request.Build(); + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + mySTL::auto_ptr out(NEW_YS output_buffer); + + buildHeaders(ssl, hsHeader, rlHeader, request); + buildOutput(*out.get(), rlHeader, hsHeader, request); + hashHandShake(ssl, *out.get()); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +// send certificate verify +void sendCertificateVerify(SSL& ssl, BufferOutput buffer) +{ + if (ssl.GetError()) return; + + CertificateVerify verify; + verify.Build(ssl); + RecordLayerHeader rlHeader; + HandShakeHeader hsHeader; + mySTL::auto_ptr out(NEW_YS output_buffer); + + buildHeaders(ssl, hsHeader, rlHeader, verify); + buildOutput(*out.get(), rlHeader, hsHeader, verify); + hashHandShake(ssl, *out.get()); + + if (buffer == buffered) + ssl.addBuffer(out.release()); + else + ssl.Send(out->get_buffer(), out->get_size()); +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/src/lock.cpp b/externals/mysql/extlib/yassl/src/lock.cpp new file mode 100644 index 0000000..6d8e9c1 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/lock.cpp @@ -0,0 +1,87 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* Locking functions + */ + +#include "runtime.hpp" +#include "lock.hpp" + + +namespace yaSSL { + + +#ifdef MULTI_THREADED + #ifdef _WIN32 + + Mutex::Mutex() + { + InitializeCriticalSection(&cs_); + } + + + Mutex::~Mutex() + { + DeleteCriticalSection(&cs_); + } + + + Mutex::Lock::Lock(Mutex& lm) : mutex_(lm) + { + EnterCriticalSection(&mutex_.cs_); + } + + + Mutex::Lock::~Lock() + { + LeaveCriticalSection(&mutex_.cs_); + } + + #else // _WIN32 + + Mutex::Mutex() + { + pthread_mutex_init(&mutex_, 0); + } + + + Mutex::~Mutex() + { + pthread_mutex_destroy(&mutex_); + } + + + Mutex::Lock::Lock(Mutex& lm) : mutex_(lm) + { + pthread_mutex_lock(&mutex_.mutex_); + } + + + Mutex::Lock::~Lock() + { + pthread_mutex_unlock(&mutex_.mutex_); + } + + + #endif // _WIN32 +#endif // MULTI_THREADED + + + +} // namespace yaSSL + diff --git a/externals/mysql/extlib/yassl/src/log.cpp b/externals/mysql/extlib/yassl/src/log.cpp new file mode 100644 index 0000000..35db413 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/log.cpp @@ -0,0 +1,146 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* Debug logging functions + */ + + +#include "runtime.hpp" +#include "log.hpp" + +#ifdef YASSL_LOG + #include + #include + #include +#endif + + + +namespace yaSSL { + + +#ifdef YASSL_LOG + + enum { MAX_MSG = 81 }; + + Log::Log(const char* str) + { + log_ = fopen(str, "w"); + Trace("********** Logger Attached **********"); + } + + + Log::~Log() + { + Trace("********** Logger Detached **********"); + fclose(log_); + } + + + // Trace a message + void Log::Trace(const char* str) + { + if (!log_) return; + + time_t clicks = time(0); + char timeStr[32]; + + // get rid of newline + strncpy(timeStr, ctime(&clicks), sizeof(timeStr)); + unsigned int len = strlen(timeStr); + timeStr[len - 1] = 0; + + char msg[MAX_MSG]; + + strncpy(msg, timeStr, sizeof(timeStr)); + strncat(msg, ":", 1); + strncat(msg, str, MAX_MSG - sizeof(timeStr) - 2); + strncat(msg, "\n", 1); + msg[MAX_MSG - 1] = 0; + + fputs(msg, log_); + } + + + #if defined(_WIN32) || defined(__MACH__) || defined(__hpux__) + typedef int socklen_t; + #endif + + + // write tcp address + void Log::ShowTCP(socket_t fd, bool ended) + { + sockaddr_in peeraddr; + socklen_t len = sizeof(peeraddr); + if (getpeername(fd, (sockaddr*)&peeraddr, &len) != 0) + return; + + const char* p = reinterpret_cast(&peeraddr.sin_addr); + char msg[MAX_MSG]; + char number[16]; + + if (ended) + strncpy(msg, "yaSSL conn DONE w/ peer ", 26); + else + strncpy(msg, "yaSSL conn BEGUN w/ peer ", 26); + for (int i = 0; i < 4; ++i) { + sprintf(number, "%u", static_cast(p[i])); + strncat(msg, number, 8); + if (i < 3) + strncat(msg, ".", 1); + } + strncat(msg, " port ", 8); + sprintf(number, "%d", htons(peeraddr.sin_port)); + strncat(msg, number, 8); + + msg[MAX_MSG - 1] = 0; + Trace(msg); + } + + + // log processed data + void Log::ShowData(uint bytes, bool sent) + { + char msg[MAX_MSG]; + char number[16]; + + if (sent) + strncpy(msg, "Sent ", 10); + else + strncpy(msg, "Received ", 10); + sprintf(number, "%u", bytes); + strncat(msg, number, 8); + strncat(msg, " bytes of application data", 27); + + msg[MAX_MSG - 1] = 0; + Trace(msg); + } + + +#else // no YASSL_LOG + + + Log::Log(const char*) {} + Log::~Log() {} + void Log::Trace(const char*) {} + void Log::ShowTCP(socket_t, bool) {} + void Log::ShowData(uint, bool) {} + + +#endif // YASSL_LOG +} // namespace diff --git a/externals/mysql/extlib/yassl/src/socket_wrapper.cpp b/externals/mysql/extlib/yassl/src/socket_wrapper.cpp new file mode 100644 index 0000000..eee5d47 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/socket_wrapper.cpp @@ -0,0 +1,199 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* The socket wrapper source implements a Socket class that hides the + * differences between Berkely style sockets and Windows sockets, allowing + * transparent TCP access. + */ + + +#include "runtime.hpp" +#include "socket_wrapper.hpp" + +#ifndef _WIN32 + #include + #include + #include + #include + #include + #include + #include + #include +#endif // _WIN32 + +#if defined(__sun) || defined(__SCO_VERSION__) || defined(__NETWARE__) + #include +#endif + +#ifdef _WIN32 + const int SOCKET_EINVAL = WSAEINVAL; + const int SOCKET_EWOULDBLOCK = WSAEWOULDBLOCK; + const int SOCKET_EAGAIN = WSAEWOULDBLOCK; +#else + const int SOCKET_EINVAL = EINVAL; + const int SOCKET_EWOULDBLOCK = EWOULDBLOCK; + const int SOCKET_EAGAIN = EAGAIN; +#endif // _WIN32 + + +namespace yaSSL { + + +Socket::Socket(socket_t s) + : socket_(s), wouldBlock_(false), nonBlocking_(false) +{} + + +void Socket::set_fd(socket_t s) +{ + socket_ = s; +} + + +socket_t Socket::get_fd() const +{ + return socket_; +} + + +Socket::~Socket() +{ + // don't close automatically now +} + + +void Socket::closeSocket() +{ + if (socket_ != INVALID_SOCKET) { +#ifdef _WIN32 + closesocket(socket_); +#else + close(socket_); +#endif + socket_ = INVALID_SOCKET; + } +} + + +uint Socket::get_ready() const +{ +#ifdef _WIN32 + unsigned long ready = 0; + ioctlsocket(socket_, FIONREAD, &ready); +#else + /* + 64-bit Solaris requires the variable passed to + FIONREAD be a 32-bit value. + */ + unsigned int ready = 0; + ioctl(socket_, FIONREAD, &ready); +#endif + + return ready; +} + + +uint Socket::send(const byte* buf, unsigned int sz, int flags) const +{ + const byte* pos = buf; + const byte* end = pos + sz; + + while (pos != end) { + int sent = ::send(socket_, reinterpret_cast(pos), + static_cast(end - pos), flags); + + if (sent == -1) + return 0; + + pos += sent; + } + + return sz; +} + + +uint Socket::receive(byte* buf, unsigned int sz, int flags) +{ + wouldBlock_ = false; + + int recvd = ::recv(socket_, reinterpret_cast(buf), sz, flags); + + // idea to seperate error from would block by arnetheduck@gmail.com + if (recvd == -1) { + if (get_lastError() == SOCKET_EWOULDBLOCK || + get_lastError() == SOCKET_EAGAIN) { + wouldBlock_ = true; // would have blocked this time only + nonBlocking_ = true; // socket nonblocking, win32 only way to tell + return 0; + } + } + else if (recvd == 0) + return static_cast(-1); + + return recvd; +} + + +// wait if blocking for input, return false for error +bool Socket::wait() +{ + byte b; + return receive(&b, 1, MSG_PEEK) != static_cast(-1); +} + + +void Socket::shutDown(int how) +{ + shutdown(socket_, how); +} + + +int Socket::get_lastError() +{ +#ifdef _WIN32 + return WSAGetLastError(); +#else + return errno; +#endif +} + + +bool Socket::WouldBlock() const +{ + return wouldBlock_; +} + + +bool Socket::IsNonBlocking() const +{ + return nonBlocking_; +} + + +void Socket::set_lastError(int errorCode) +{ +#ifdef _WIN32 + WSASetLastError(errorCode); +#else + errno = errorCode; +#endif +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/src/ssl.cpp b/externals/mysql/extlib/yassl/src/ssl.cpp new file mode 100644 index 0000000..29aa034 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/ssl.cpp @@ -0,0 +1,1672 @@ +/* + Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* SSL source implements all openssl compatibility API functions + * + * TODO: notes are mostly api additions to allow compilation with mysql + * they don't affect normal modes but should be provided for completeness + + * stunnel functions at end of file + */ + + + + +/* see man pages for function descriptions */ + +#include "runtime.hpp" +#include "openssl/ssl.h" +#include "handshake.hpp" +#include "yassl_int.hpp" +#include "md5.hpp" // for TaoCrypt MD5 size assert +#include "md4.hpp" // for TaoCrypt MD4 size assert +#include "file.hpp" // for TaoCrypt Source +#include "coding.hpp" // HexDecoder +#include "helpers.hpp" // for placement new hack +#include + +#ifdef _WIN32 + #include // FindFirstFile etc.. +#else + #include // file helper + #include // stat + #include // opendir +#endif + + +namespace yaSSL { + + + +int read_file(SSL_CTX* ctx, const char* file, int format, CertType type) +{ + if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM) + return SSL_BAD_FILETYPE; + + if (file == NULL || !file[0]) + return SSL_BAD_FILE; + + FILE* input = fopen(file, "rb"); + if (!input) + return SSL_BAD_FILE; + + if (type == CA) { + // may have a bunch of CAs + x509* ptr; + while ( (ptr = PemToDer(input, Cert)) ) + ctx->AddCA(ptr); + + if (!feof(input)) { + fclose(input); + return SSL_BAD_FILE; + } + } + else { + x509*& x = (type == Cert) ? ctx->certificate_ : ctx->privateKey_; + + if (format == SSL_FILETYPE_ASN1) { + fseek(input, 0, SEEK_END); + long sz = ftell(input); + rewind(input); + x = NEW_YS x509(sz); // takes ownership + size_t bytes = fread(x->use_buffer(), sz, 1, input); + if (bytes != 1) { + fclose(input); + return SSL_BAD_FILE; + } + } + else { + EncryptedInfo info; + x = PemToDer(input, type, &info); + if (!x) { + fclose(input); + return SSL_BAD_FILE; + } + if (info.set) { + // decrypt + char password[80]; + pem_password_cb cb = ctx->GetPasswordCb(); + if (!cb) { + fclose(input); + return SSL_BAD_FILE; + } + int passwordSz = cb(password, sizeof(password), 0, + ctx->GetUserData()); + byte key[AES_256_KEY_SZ]; // max sizes + byte iv[AES_IV_SZ]; + + // use file's salt for key derivation, but not real iv + TaoCrypt::Source source(info.iv, info.ivSz); + TaoCrypt::HexDecoder dec(source); + memcpy(info.iv, source.get_buffer(), min((uint)sizeof(info.iv), + source.size())); + EVP_BytesToKey(info.name, "MD5", info.iv, (byte*)password, + passwordSz, 1, key, iv); + + mySTL::auto_ptr cipher; + if (strncmp(info.name, "DES-CBC", 7) == 0) + cipher.reset(NEW_YS DES); + else if (strncmp(info.name, "DES-EDE3-CBC", 13) == 0) + cipher.reset(NEW_YS DES_EDE); + else if (strncmp(info.name, "AES-128-CBC", 13) == 0) + cipher.reset(NEW_YS AES(AES_128_KEY_SZ)); + else if (strncmp(info.name, "AES-192-CBC", 13) == 0) + cipher.reset(NEW_YS AES(AES_192_KEY_SZ)); + else if (strncmp(info.name, "AES-256-CBC", 13) == 0) + cipher.reset(NEW_YS AES(AES_256_KEY_SZ)); + else { + fclose(input); + return SSL_BAD_FILE; + } + cipher->set_decryptKey(key, info.iv); + mySTL::auto_ptr newx(NEW_YS x509(x->get_length())); + cipher->decrypt(newx->use_buffer(), x->get_buffer(), + x->get_length()); + ysDelete(x); + x = newx.release(); + } + } + } + fclose(input); + return SSL_SUCCESS; +} + + +extern "C" { + + +SSL_METHOD* SSLv3_method() +{ + return SSLv3_client_method(); +} + + +SSL_METHOD* SSLv3_server_method() +{ + return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,0)); +} + + +SSL_METHOD* SSLv3_client_method() +{ + return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,0)); +} + + +SSL_METHOD* TLSv1_server_method() +{ + return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,1)); +} + + +SSL_METHOD* TLSv1_client_method() +{ + return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,1)); +} + + +SSL_METHOD* TLSv1_1_server_method() +{ + return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,2)); +} + + +SSL_METHOD* TLSv1_1_client_method() +{ + return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,2)); +} + + +SSL_METHOD* SSLv23_server_method() +{ + // compatibility only, no version 2 support, but does SSL 3 and TLS 1 + return NEW_YS SSL_METHOD(server_end, ProtocolVersion(3,2), true); +} + + +SSL_METHOD* SSLv23_client_method() +{ + // compatibility only, no version 2 support, but does SSL 3 and TLS 1 + // though it sends TLS1 hello not SSLv2 so SSLv3 only servers will decline + // TODO: maybe add support to send SSLv2 hello ??? + return NEW_YS SSL_METHOD(client_end, ProtocolVersion(3,2), true); +} + + +SSL_CTX* SSL_CTX_new(SSL_METHOD* method) +{ + return NEW_YS SSL_CTX(method); +} + + +void SSL_CTX_free(SSL_CTX* ctx) +{ + ysDelete(ctx); +} + + +SSL* SSL_new(SSL_CTX* ctx) +{ + return NEW_YS SSL(ctx); +} + + +void SSL_free(SSL* ssl) +{ + ysDelete(ssl); +} + + +int SSL_set_fd(SSL* ssl, YASSL_SOCKET_T fd) +{ + ssl->useSocket().set_fd(fd); + return SSL_SUCCESS; +} + + +YASSL_SOCKET_T SSL_get_fd(const SSL* ssl) +{ + return ssl->getSocket().get_fd(); +} + + +// if you get an error from connect see note at top of README +int SSL_connect(SSL* ssl) +{ + if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ)) + ssl->SetError(no_error); + + ClientState neededState; + + switch (ssl->getStates().GetConnect()) { + + case CONNECT_BEGIN : + sendClientHello(*ssl); + if (!ssl->GetError()) + ssl->useStates().UseConnect() = CLIENT_HELLO_SENT; + + case CLIENT_HELLO_SENT : + neededState = ssl->getSecurity().get_resuming() ? + serverFinishedComplete : serverHelloDoneComplete; + while (ssl->getStates().getClient() < neededState) { + if (ssl->GetError()) break; + processReply(*ssl); + } + if (!ssl->GetError()) + ssl->useStates().UseConnect() = FIRST_REPLY_DONE; + + case FIRST_REPLY_DONE : + if(ssl->getCrypto().get_certManager().sendVerify()) + sendCertificate(*ssl); + + if (!ssl->getSecurity().get_resuming()) + sendClientKeyExchange(*ssl); + + if(ssl->getCrypto().get_certManager().sendVerify()) + sendCertificateVerify(*ssl); + + sendChangeCipher(*ssl); + sendFinished(*ssl, client_end); + ssl->flushBuffer(); + + if (!ssl->GetError()) + ssl->useStates().UseConnect() = FINISHED_DONE; + + case FINISHED_DONE : + if (!ssl->getSecurity().get_resuming()) + while (ssl->getStates().getClient() < serverFinishedComplete) { + if (ssl->GetError()) break; + processReply(*ssl); + } + if (!ssl->GetError()) + ssl->useStates().UseConnect() = SECOND_REPLY_DONE; + + case SECOND_REPLY_DONE : + ssl->verifyState(serverFinishedComplete); + ssl->useLog().ShowTCP(ssl->getSocket().get_fd()); + + if (ssl->GetError()) { + GetErrors().Add(ssl->GetError()); + return SSL_FATAL_ERROR; + } + return SSL_SUCCESS; + + default : + return SSL_FATAL_ERROR; // unkown state + } +} + + +int SSL_write(SSL* ssl, const void* buffer, int sz) +{ + return sendData(*ssl, buffer, sz); +} + + +int SSL_read(SSL* ssl, void* buffer, int sz) +{ + Data data(min(sz, MAX_RECORD_SIZE), static_cast(buffer)); + return receiveData(*ssl, data); +} + + +int SSL_accept(SSL* ssl) +{ + if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ)) + ssl->SetError(no_error); + + switch (ssl->getStates().GetAccept()) { + + case ACCEPT_BEGIN : + processReply(*ssl); + if (!ssl->GetError()) + ssl->useStates().UseAccept() = ACCEPT_FIRST_REPLY_DONE; + + case ACCEPT_FIRST_REPLY_DONE : + sendServerHello(*ssl); + + if (!ssl->getSecurity().get_resuming()) { + sendCertificate(*ssl); + + if (ssl->getSecurity().get_connection().send_server_key_) + sendServerKeyExchange(*ssl); + + if(ssl->getCrypto().get_certManager().verifyPeer()) + sendCertificateRequest(*ssl); + + sendServerHelloDone(*ssl); + ssl->flushBuffer(); + } + + if (!ssl->GetError()) + ssl->useStates().UseAccept() = SERVER_HELLO_DONE; + + case SERVER_HELLO_DONE : + if (!ssl->getSecurity().get_resuming()) { + while (ssl->getStates().getServer() < clientFinishedComplete) { + if (ssl->GetError()) break; + processReply(*ssl); + } + } + if (!ssl->GetError()) + ssl->useStates().UseAccept() = ACCEPT_SECOND_REPLY_DONE; + + case ACCEPT_SECOND_REPLY_DONE : + sendChangeCipher(*ssl); + sendFinished(*ssl, server_end); + ssl->flushBuffer(); + + if (!ssl->GetError()) + ssl->useStates().UseAccept() = ACCEPT_FINISHED_DONE; + + case ACCEPT_FINISHED_DONE : + if (ssl->getSecurity().get_resuming()) { + while (ssl->getStates().getServer() < clientFinishedComplete) { + if (ssl->GetError()) break; + processReply(*ssl); + } + } + if (!ssl->GetError()) + ssl->useStates().UseAccept() = ACCEPT_THIRD_REPLY_DONE; + + case ACCEPT_THIRD_REPLY_DONE : + ssl->useLog().ShowTCP(ssl->getSocket().get_fd()); + + if (ssl->GetError()) { + GetErrors().Add(ssl->GetError()); + return SSL_FATAL_ERROR; + } + return SSL_SUCCESS; + + default: + return SSL_FATAL_ERROR; // unknown state + } +} + + +int SSL_do_handshake(SSL* ssl) +{ + if (ssl->getSecurity().get_parms().entity_ == client_end) + return SSL_connect(ssl); + else + return SSL_accept(ssl); +} + + +int SSL_clear(SSL* ssl) +{ + GetErrors().Remove(); + + return SSL_SUCCESS; +} + + +int SSL_shutdown(SSL* ssl) +{ + if (!ssl->GetQuietShutdown()) { + Alert alert(warning, close_notify); + sendAlert(*ssl, alert); + } + ssl->useLog().ShowTCP(ssl->getSocket().get_fd(), true); + + GetErrors().Remove(); + + return SSL_SUCCESS; +} + + +void SSL_set_quiet_shutdown(SSL *ssl,int mode) +{ + ssl->SetQuietShutdown(mode != 0); +} + + +int SSL_get_quiet_shutdown(SSL *ssl) +{ + return ssl->GetQuietShutdown(); +} + + +/* on by default but allow user to turn off */ +long SSL_CTX_set_session_cache_mode(SSL_CTX* ctx, long mode) +{ + if (mode == SSL_SESS_CACHE_OFF) + ctx->SetSessionCacheOff(); + + if (mode == SSL_SESS_CACHE_NO_AUTO_CLEAR) + ctx->SetSessionCacheFlushOff(); + + return SSL_SUCCESS; +} + + +SSL_SESSION* SSL_get_session(SSL* ssl) +{ + if (ssl->getSecurity().GetContext()->GetSessionCacheOff()) + return 0; + + return GetSessions().lookup( + ssl->getSecurity().get_connection().sessionID_); +} + + +int SSL_set_session(SSL* ssl, SSL_SESSION* session) +{ + if (ssl->getSecurity().GetContext()->GetSessionCacheOff()) + return SSL_FAILURE; + + ssl->set_session(session); + return SSL_SUCCESS; +} + + +int SSL_session_reused(SSL* ssl) +{ + return ssl->getSecurity().get_resuming(); +} + + +long SSL_SESSION_set_timeout(SSL_SESSION* sess, long t) +{ + if (!sess) + return SSL_ERROR_NONE; + + sess->SetTimeOut(t); + return SSL_SUCCESS; +} + + +long SSL_get_default_timeout(SSL* /*ssl*/) +{ + return DEFAULT_TIMEOUT; +} + + +void SSL_flush_sessions(SSL_CTX *ctx, long /* tm */) +{ + if (ctx->GetSessionCacheOff()) + return; + + GetSessions().Flush(); +} + + +const char* SSL_get_cipher_name(SSL* ssl) +{ + return SSL_get_cipher(ssl); +} + + +const char* SSL_get_cipher(SSL* ssl) +{ + return ssl->getSecurity().get_parms().cipher_name_; +} + + +// SSLv2 only, not implemented +char* SSL_get_shared_ciphers(SSL* /*ssl*/, char* buf, int len) +{ + return strncpy(buf, "Not Implemented, SSLv2 only", len); +} + + +const char* SSL_get_cipher_list(SSL* ssl, int priority) +{ + if (priority < 0 || priority >= MAX_CIPHERS) + return 0; + + if (ssl->getSecurity().get_parms().cipher_list_[priority][0]) + return ssl->getSecurity().get_parms().cipher_list_[priority]; + + return 0; +} + + +int SSL_CTX_set_cipher_list(SSL_CTX* ctx, const char* list) +{ + if (ctx->SetCipherList(list)) + return SSL_SUCCESS; + else + return SSL_FAILURE; +} + + +const char* SSL_get_version(SSL* ssl) +{ + static const char* version3 = "SSLv3"; + static const char* version31 = "TLSv1"; + + return ssl->isTLS() ? version31 : version3; +} + +const char* SSLeay_version(int) +{ + static const char* version = "SSLeay yaSSL compatibility"; + return version; +} + + +int SSL_get_error(SSL* ssl, int /*previous*/) +{ + return ssl->getStates().What(); +} + + + +/* turn on yaSSL zlib compression + returns 0 for success, else error (not built in) + only need to turn on for client, becuase server on by default if built in + but calling for server will tell you whether it's available or not +*/ +int SSL_set_compression(SSL* ssl) /* Chad didn't rename to ya~ because it is prob. bug. */ +{ + return ssl->SetCompression(); +} + + + +X509* SSL_get_peer_certificate(SSL* ssl) +{ + return ssl->getCrypto().get_certManager().get_peerX509(); +} + + +void X509_free(X509* /*x*/) +{ + // peer cert set for deletion during destruction + // no need to delete now +} + + +X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX* ctx) +{ + return ctx->current_cert; +} + + +int X509_STORE_CTX_get_error(X509_STORE_CTX* ctx) +{ + return ctx->error; +} + + +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX* ctx) +{ + return ctx->error_depth; +} + + +// copy name into buffer, at most sz bytes, if buffer is null +// will malloc buffer, caller responsible for freeing +char* X509_NAME_oneline(X509_NAME* name, char* buffer, int sz) +{ + if (!name->GetName()) return buffer; + + int len = (int)strlen(name->GetName()) + 1; + int copySz = min(len, sz); + + if (!buffer) { + buffer = (char*)malloc(len); + if (!buffer) return buffer; + copySz = len; + } + + if (copySz == 0) + return buffer; + + memcpy(buffer, name->GetName(), copySz - 1); + buffer[copySz - 1] = 0; + + return buffer; +} + + +X509_NAME* X509_get_issuer_name(X509* x) +{ + return x->GetIssuer(); +} + + +X509_NAME* X509_get_subject_name(X509* x) +{ + return x->GetSubject(); +} + + +void SSL_load_error_strings() // compatibility only +{} + + +void SSL_set_connect_state(SSL*) +{ + // already a client by default +} + + +void SSL_set_accept_state(SSL* ssl) +{ + ssl->useSecurity().use_parms().entity_ = server_end; +} + + +long SSL_get_verify_result(SSL*) +{ + // won't get here if not OK + return X509_V_OK; +} + + +long SSL_CTX_sess_set_cache_size(SSL_CTX* /*ctx*/, long /*sz*/) +{ + // unlimited size, can't set for now + return 0; +} + + +long SSL_CTX_get_session_cache_mode(SSL_CTX*) +{ + // always 0, unlimited size for now + return 0; +} + + +long SSL_CTX_set_tmp_dh(SSL_CTX* ctx, DH* dh) +{ + if (ctx->SetDH(*dh)) + return SSL_SUCCESS; + else + return SSL_FAILURE; +} + + +int SSL_CTX_use_certificate_file(SSL_CTX* ctx, const char* file, int format) +{ + return read_file(ctx, file, format, Cert); +} + + +int SSL_CTX_use_PrivateKey_file(SSL_CTX* ctx, const char* file, int format) +{ + return read_file(ctx, file, format, PrivateKey); +} + + +void SSL_CTX_set_verify(SSL_CTX* ctx, int mode, VerifyCallback vc) +{ + if (mode & SSL_VERIFY_PEER) + ctx->setVerifyPeer(); + + if (mode == SSL_VERIFY_NONE) + ctx->setVerifyNone(); + + if (mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT) + ctx->setFailNoCert(); + + ctx->setVerifyCallback(vc); +} + + +int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, + const char* path) +{ + int ret = SSL_SUCCESS; + const int HALF_PATH = 128; + + if (file) ret = read_file(ctx, file, SSL_FILETYPE_PEM, CA); + + if (ret == SSL_SUCCESS && path) { + // call read_file for each reqular file in path +#ifdef _WIN32 + + WIN32_FIND_DATA FindFileData; + HANDLE hFind; + + char name[MAX_PATH + 1]; // directory specification + strncpy(name, path, MAX_PATH - 3); + strncat(name, "\\*", 3); + + hFind = FindFirstFile(name, &FindFileData); + if (hFind == INVALID_HANDLE_VALUE) return SSL_BAD_PATH; + + do { + if (FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) { + strncpy(name, path, MAX_PATH - 2 - HALF_PATH); + strncat(name, "\\", 2); + strncat(name, FindFileData.cFileName, HALF_PATH); + ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA); + } + } while (ret == SSL_SUCCESS && FindNextFile(hFind, &FindFileData)); + + FindClose(hFind); + +#else // _WIN32 + + const int MAX_PATH = 260; + + DIR* dir = opendir(path); + if (!dir) return SSL_BAD_PATH; + + struct dirent* entry; + struct stat buf; + char name[MAX_PATH + 1]; + + while (ret == SSL_SUCCESS && (entry = readdir(dir))) { + strncpy(name, path, MAX_PATH - 1 - HALF_PATH); + strncat(name, "/", 1); + strncat(name, entry->d_name, HALF_PATH); + if (stat(name, &buf) < 0) return SSL_BAD_STAT; + + if (S_ISREG(buf.st_mode)) + ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA); + } + + closedir(dir); + +#endif + } + + return ret; +} + + +int SSL_CTX_set_default_verify_paths(SSL_CTX* /*ctx*/) +{ + // TODO: figure out way to set/store default path, then call load_verify + return SSL_NOT_IMPLEMENTED; +} + + +int SSL_CTX_set_session_id_context(SSL_CTX*, const unsigned char*, + unsigned int) +{ + // No application specific context needed for yaSSL + return SSL_SUCCESS; +} + + +int SSL_CTX_check_private_key(SSL_CTX* /*ctx*/) +{ + // TODO: check private against public for RSA match + return SSL_NOT_IMPLEMENTED; +} + + +// TODO: all session stats +long SSL_CTX_sess_accept(SSL_CTX* ctx) +{ + return ctx->GetStats().accept_; +} + + +long SSL_CTX_sess_connect(SSL_CTX* ctx) +{ + return ctx->GetStats().connect_; +} + + +long SSL_CTX_sess_accept_good(SSL_CTX* ctx) +{ + return ctx->GetStats().acceptGood_; +} + + +long SSL_CTX_sess_connect_good(SSL_CTX* ctx) +{ + return ctx->GetStats().connectGood_; +} + + +long SSL_CTX_sess_accept_renegotiate(SSL_CTX* ctx) +{ + return ctx->GetStats().acceptRenegotiate_; +} + + +long SSL_CTX_sess_connect_renegotiate(SSL_CTX* ctx) +{ + return ctx->GetStats().connectRenegotiate_; +} + + +long SSL_CTX_sess_hits(SSL_CTX* ctx) +{ + return ctx->GetStats().hits_; +} + + +long SSL_CTX_sess_cb_hits(SSL_CTX* ctx) +{ + return ctx->GetStats().cbHits_; +} + + +long SSL_CTX_sess_cache_full(SSL_CTX* ctx) +{ + return ctx->GetStats().cacheFull_; +} + + +long SSL_CTX_sess_misses(SSL_CTX* ctx) +{ + return ctx->GetStats().misses_; +} + + +long SSL_CTX_sess_timeouts(SSL_CTX* ctx) +{ + return ctx->GetStats().timeouts_; +} + + +long SSL_CTX_sess_number(SSL_CTX* ctx) +{ + return ctx->GetStats().number_; +} + + +long SSL_CTX_sess_get_cache_size(SSL_CTX* ctx) +{ + return ctx->GetStats().getCacheSize_; +} +// end session stats TODO: + + +int SSL_CTX_get_verify_mode(SSL_CTX* ctx) +{ + return ctx->GetStats().verifyMode_; +} + + +int SSL_get_verify_mode(SSL* ssl) +{ + return ssl->getSecurity().GetContext()->GetStats().verifyMode_; +} + + +int SSL_CTX_get_verify_depth(SSL_CTX* ctx) +{ + return ctx->GetStats().verifyDepth_; +} + + +int SSL_get_verify_depth(SSL* ssl) +{ + return ssl->getSecurity().GetContext()->GetStats().verifyDepth_; +} + + +long SSL_CTX_set_options(SSL_CTX*, long) +{ + // TDOD: + return SSL_SUCCESS; +} + + +void SSL_CTX_set_info_callback(SSL_CTX*, void (*)()) +{ + // TDOD: +} + + +void OpenSSL_add_all_algorithms() // compatibility only +{} + + +int SSL_library_init() // compatiblity only +{ + return 1; +} + + +DH* DH_new(void) +{ + DH* dh = NEW_YS DH; + if (dh) + dh->p = dh->g = 0; + return dh; +} + + +void DH_free(DH* dh) +{ + ysDelete(dh->g); + ysDelete(dh->p); + ysDelete(dh); +} + + +// convert positive big-endian num of length sz into retVal, which may need to +// be created +BIGNUM* BN_bin2bn(const unsigned char* num, int sz, BIGNUM* retVal) +{ + bool created = false; + mySTL::auto_ptr bn; + + if (!retVal) { + created = true; + bn.reset(NEW_YS BIGNUM); + retVal = bn.get(); + } + + retVal->assign(num, sz); + + if (created) + return bn.release(); + else + return retVal; +} + + +unsigned long ERR_get_error_line_data(const char**, int*, const char**, int *) +{ + //return SSL_NOT_IMPLEMENTED; + return 0; +} + + +void ERR_print_errors_fp(FILE* /*fp*/) +{ + // need ssl access to implement TODO: + //fprintf(fp, "%s", ssl.get_states().errorString_.c_str()); +} + + +char* ERR_error_string(unsigned long errNumber, char* buffer) +{ + static char* msg = (char*)"Please supply a buffer for error string"; + + if (buffer) { + SetErrorString(YasslError(errNumber), buffer); + return buffer; + } + + return msg; +} + + +const char* X509_verify_cert_error_string(long /* error */) +{ + // TODO: + static const char* msg = "Not Implemented"; + return msg; +} + + +const EVP_MD* EVP_md5(void) +{ + static const char* type = "MD5"; + return type; +} + + +const EVP_CIPHER* EVP_des_ede3_cbc(void) +{ + static const char* type = "DES-EDE3-CBC"; + return type; +} + + +int EVP_BytesToKey(const EVP_CIPHER* type, const EVP_MD* md, const byte* salt, + const byte* data, int sz, int count, byte* key, byte* iv) +{ + // only support MD5 for now + if (strncmp(md, "MD5", 3)) return 0; + + int keyLen = 0; + int ivLen = 0; + + // only support CBC DES and AES for now + if (strncmp(type, "DES-CBC", 7) == 0) { + keyLen = DES_KEY_SZ; + ivLen = DES_IV_SZ; + } + else if (strncmp(type, "DES-EDE3-CBC", 12) == 0) { + keyLen = DES_EDE_KEY_SZ; + ivLen = DES_IV_SZ; + } + else if (strncmp(type, "AES-128-CBC", 11) == 0) { + keyLen = AES_128_KEY_SZ; + ivLen = AES_IV_SZ; + } + else if (strncmp(type, "AES-192-CBC", 11) == 0) { + keyLen = AES_192_KEY_SZ; + ivLen = AES_IV_SZ; + } + else if (strncmp(type, "AES-256-CBC", 11) == 0) { + keyLen = AES_256_KEY_SZ; + ivLen = AES_IV_SZ; + } + else + return 0; + + yaSSL::MD5 myMD; + uint digestSz = myMD.get_digestSize(); + byte digest[SHA_LEN]; // max size + + int keyLeft = keyLen; + int ivLeft = ivLen; + int keyOutput = 0; + + while (keyOutput < (keyLen + ivLen)) { + int digestLeft = digestSz; + // D_(i - 1) + if (keyOutput) // first time D_0 is empty + myMD.update(digest, digestSz); + // data + myMD.update(data, sz); + // salt + if (salt) + myMD.update(salt, EVP_SALT_SZ); + myMD.get_digest(digest); + // count + for (int j = 1; j < count; j++) { + myMD.update(digest, digestSz); + myMD.get_digest(digest); + } + + if (keyLeft) { + int store = min(keyLeft, static_cast(digestSz)); + memcpy(&key[keyLen - keyLeft], digest, store); + + keyOutput += store; + keyLeft -= store; + digestLeft -= store; + } + + if (ivLeft && digestLeft) { + int store = min(ivLeft, digestLeft); + memcpy(&iv[ivLen - ivLeft], &digest[digestSz - digestLeft], store); + + keyOutput += store; + ivLeft -= store; + } + } + assert(keyOutput == (keyLen + ivLen)); + return keyOutput; +} + + + +void DES_set_key_unchecked(const_DES_cblock* key, DES_key_schedule* schedule) +{ + memcpy(schedule, key, sizeof(const_DES_cblock)); +} + + +void DES_ede3_cbc_encrypt(const byte* input, byte* output, long sz, + DES_key_schedule* ks1, DES_key_schedule* ks2, + DES_key_schedule* ks3, DES_cblock* ivec, int enc) +{ + DES_EDE des; + byte key[DES_EDE_KEY_SZ]; + + memcpy(key, *ks1, DES_BLOCK); + memcpy(&key[DES_BLOCK], *ks2, DES_BLOCK); + memcpy(&key[DES_BLOCK * 2], *ks3, DES_BLOCK); + + if (enc) { + des.set_encryptKey(key, *ivec); + des.encrypt(output, input, sz); + } + else { + des.set_decryptKey(key, *ivec); + des.decrypt(output, input, sz); + } +} + + +// functions for libcurl +int RAND_status() +{ + return 1; /* TaoCrypt provides enough seed */ +} + + +int DES_set_key(const_DES_cblock* key, DES_key_schedule* schedule) +{ + memcpy(schedule, key, sizeof(const_DES_cblock)); + return 1; +} + + +void DES_set_odd_parity(DES_cblock* key) +{ + // not needed now for TaoCrypt +} + + +void DES_ecb_encrypt(DES_cblock* input, DES_cblock* output, + DES_key_schedule* key, int enc) +{ + DES des; + + if (enc) { + des.set_encryptKey(*key, 0); + des.encrypt(*output, *input, DES_BLOCK); + } + else { + des.set_decryptKey(*key, 0); + des.decrypt(*output, *input, DES_BLOCK); + } +} + + +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX* ctx, void* userdata) +{ + ctx->SetUserData(userdata); +} + + +X509* SSL_get_certificate(SSL* ssl) +{ + // only used to pass to get_privatekey which isn't used + return 0; +} + + +EVP_PKEY* SSL_get_privatekey(SSL* ssl) +{ + // only called, not used + return 0; +} + + +void SSL_SESSION_free(SSL_SESSION* session) +{ + // managed by singleton +} + + + +EVP_PKEY* X509_get_pubkey(X509* x) +{ + // called, not used though + return 0; +} + + +int EVP_PKEY_copy_parameters(EVP_PKEY* to, const EVP_PKEY* from) +{ + // called, not used though + return 0; +} + + +void EVP_PKEY_free(EVP_PKEY* pkey) +{ + // never allocated from above +} + + +void ERR_error_string_n(unsigned long e, char *buf, size_t len) +{ + if (len) ERR_error_string(e, buf); +} + + +void ERR_free_strings(void) +{ + // handled internally +} + + +void EVP_cleanup(void) +{ + // nothing to do yet +} + + +ASN1_TIME* X509_get_notBefore(X509* x) +{ + if (x) return x->GetBefore(); + return 0; +} + + +ASN1_TIME* X509_get_notAfter(X509* x) +{ + if (x) return x->GetAfter(); + return 0; +} + + +SSL_METHOD* SSLv2_client_method(void) /* will never work, no v 2 */ +{ + return 0; +} + + +SSL_SESSION* SSL_get1_session(SSL* ssl) /* what's ref count */ +{ + return SSL_get_session(ssl); +} + + +void GENERAL_NAMES_free(STACK_OF(GENERAL_NAME) *x) +{ + // no extension names supported yet +} + + +int sk_GENERAL_NAME_num(STACK_OF(GENERAL_NAME) *x) +{ + // no extension names supported yet + return 0; +} + + +GENERAL_NAME* sk_GENERAL_NAME_value(STACK_OF(GENERAL_NAME) *x, int i) +{ + // no extension names supported yet + return 0; +} + + +unsigned char* ASN1_STRING_data(ASN1_STRING* x) +{ + if (x) return x->data; + return 0; +} + + +int ASN1_STRING_length(ASN1_STRING* x) +{ + if (x) return x->length; + return 0; +} + + +int ASN1_STRING_type(ASN1_STRING *x) +{ + if (x) return x->type; + return 0; +} + + +int X509_NAME_get_index_by_NID(X509_NAME* name,int nid, int lastpos) +{ + int idx = -1; // not found + const char* start = &name->GetName()[lastpos + 1]; + + switch (nid) { + case NID_commonName: + const char* found = strstr(start, "/CN="); + if (found) { + found += 4; // advance to str + idx = found - start + lastpos + 1; + } + break; + } + + return idx; +} + + +ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY* ne) +{ + // the same in yaSSL + return ne; +} + + +X509_NAME_ENTRY* X509_NAME_get_entry(X509_NAME* name, int loc) +{ + return name->GetEntry(loc); +} + + +// already formatted, caller responsible for freeing *out +int ASN1_STRING_to_UTF8(unsigned char** out, ASN1_STRING* in) +{ + if (!in) return 0; + + *out = (unsigned char*)malloc(in->length + 1); + if (*out) { + memcpy(*out, in->data, in->length); + (*out)[in->length] = 0; + } + return in->length; +} + + +void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx) +{ + // no extensions supported yet + return 0; +} + + +void MD4_Init(MD4_CTX* md4) +{ + // make sure we have a big enough buffer + typedef char ok[sizeof(md4->buffer) >= sizeof(TaoCrypt::MD4) ? 1 : -1]; + (void) sizeof(ok); + + // using TaoCrypt since no dynamic memory allocated + // and no destructor will be called + new (reinterpret_cast(md4->buffer)) TaoCrypt::MD4(); +} + + +void MD4_Update(MD4_CTX* md4, const void* data, unsigned long sz) +{ + reinterpret_cast(md4->buffer)->Update( + static_cast(data), static_cast(sz)); +} + + +void MD4_Final(unsigned char* hash, MD4_CTX* md4) +{ + reinterpret_cast(md4->buffer)->Final(hash); +} + + +void MD5_Init(MD5_CTX* md5) +{ + // make sure we have a big enough buffer + typedef char ok[sizeof(md5->buffer) >= sizeof(TaoCrypt::MD5) ? 1 : -1]; + (void) sizeof(ok); + + // using TaoCrypt since no dynamic memory allocated + // and no destructor will be called + new (reinterpret_cast(md5->buffer)) TaoCrypt::MD5(); +} + + +void MD5_Update(MD5_CTX* md5, const void* data, unsigned long sz) +{ + reinterpret_cast(md5->buffer)->Update( + static_cast(data), static_cast(sz)); +} + + +void MD5_Final(unsigned char* hash, MD5_CTX* md5) +{ + reinterpret_cast(md5->buffer)->Final(hash); +} + + +int RAND_bytes(unsigned char* buf, int num) +{ + RandomPool ran; + + if (ran.GetError()) return 0; + + ran.Fill(buf, num); + return 1; +} + + +int SSL_peek(SSL* ssl, void* buffer, int sz) +{ + Data data(min(sz, MAX_RECORD_SIZE), static_cast(buffer)); + return receiveData(*ssl, data, true); +} + + +int SSL_pending(SSL* ssl) +{ + // Just in case there's pending data that hasn't been processed yet... + char c; + SSL_peek(ssl, &c, 1); + + return ssl->bufferedData(); +} + + +void SSL_CTX_set_default_passwd_cb(SSL_CTX* ctx, pem_password_cb cb) +{ + ctx->SetPasswordCb(cb); +} + + +int SSLeay_add_ssl_algorithms() // compatibility only +{ + return 1; +} + + +void ERR_remove_state(unsigned long) +{ + GetErrors().Remove(); +} + + +int ERR_GET_REASON(int l) +{ + return l & 0xfff; +} + + +unsigned long err_helper(bool peek = false) +{ + int ysError = GetErrors().Lookup(peek); + + // translate cert error for libcurl, it uses OpenSSL hex code + switch (ysError) { + case TaoCrypt::SIG_OTHER_E: + return CERTFICATE_ERROR; + break; + default : + return 0; + } + + return 0; // shut up compiler +} + + +unsigned long ERR_peek_error() +{ + return err_helper(true); +} + + +unsigned long ERR_get_error() +{ + return err_helper(); +} + + + // functions for stunnel + + void RAND_screen() + { + // TODO: + } + + + const char* RAND_file_name(char*, size_t) + { + // TODO: + return 0; + } + + + int RAND_write_file(const char*) + { + // TODO: + return 0; + } + + + int RAND_load_file(const char*, long) + { + // TODO: + return 0; + } + + + void RSA_free(RSA*) + { + // TODO: + } + + + RSA* RSA_generate_key(int, unsigned long, void(*)(int, int, void*), void*) + { + // TODO: + return 0; + } + + + int X509_LOOKUP_add_dir(X509_LOOKUP*, const char*, long) + { + // TODO: + return SSL_SUCCESS; + } + + + int X509_LOOKUP_load_file(X509_LOOKUP*, const char*, long) + { + // TODO: + return SSL_SUCCESS; + } + + + X509_LOOKUP_METHOD* X509_LOOKUP_hash_dir(void) + { + // TODO: + return 0; + } + + + X509_LOOKUP_METHOD* X509_LOOKUP_file(void) + { + // TODO: + return 0; + } + + + X509_LOOKUP* X509_STORE_add_lookup(X509_STORE*, X509_LOOKUP_METHOD*) + { + // TODO: + return 0; + } + + + int X509_STORE_get_by_subject(X509_STORE_CTX*, int, X509_NAME*, X509_OBJECT*) + { + // TODO: + return SSL_SUCCESS; + } + + + X509_STORE* X509_STORE_new(void) + { + // TODO: + return 0; + } + + char* SSL_alert_type_string_long(int) + { + // TODO: + return 0; + } + + + char* SSL_alert_desc_string_long(int) + { + // TODO: + return 0; + } + + + char* SSL_state_string_long(SSL*) + { + // TODO: + return 0; + } + + + void SSL_CTX_set_tmp_rsa_callback(SSL_CTX*, RSA*(*)(SSL*, int, int)) + { + // TDOD: + } + + + long SSL_CTX_set_timeout(SSL_CTX*, long) + { + // TDOD: + return SSL_SUCCESS; + } + + + int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*) + { + // TDOD: + return SSL_SUCCESS; + } + + + int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX*, const char*, int) + { + // TDOD: + return SSL_SUCCESS; + } + + + int SSL_set_rfd(SSL*, int) + { + return SSL_SUCCESS; // TODO: + } + + + int SSL_set_wfd(SSL*, int) + { + return SSL_SUCCESS; // TODO: + } + + + int SSL_want_read(SSL*) + { + return 0; // TODO: + } + + + int SSL_want_write(SSL*) + { + return 0; // TODO: + } + + + void SSL_set_shutdown(SSL*, int) + { + // TODO: + } + + + SSL_CIPHER* SSL_get_current_cipher(SSL*) + { + // TODO: + return 0; + } + + + char* SSL_CIPHER_description(SSL_CIPHER*, char*, int) + { + // TODO: + return 0; + } + + + + // end stunnel needs + + +} // extern "C" +} // namespace diff --git a/externals/mysql/extlib/yassl/src/template_instnt.cpp b/externals/mysql/extlib/yassl/src/template_instnt.cpp new file mode 100644 index 0000000..fe3a251 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/template_instnt.cpp @@ -0,0 +1,110 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* Explicit template instantiation requests + */ + + +#include "runtime.hpp" +#include "handshake.hpp" +#include "yassl_int.hpp" +#include "crypto_wrapper.hpp" +#include "hmac.hpp" +#include "md5.hpp" +#include "sha.hpp" +#include "ripemd.hpp" +#include "openssl/ssl.h" + +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION + +namespace mySTL { +template class list; +template yaSSL::del_ptr_zero for_each(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template pair* uninit_copy*, mySTL::pair*>(mySTL::pair*, mySTL::pair*, mySTL::pair*); +template pair* uninit_copy*, mySTL::pair*>(mySTL::pair*, mySTL::pair*, mySTL::pair*); +template void destroy*>(mySTL::pair*, mySTL::pair*); +template void destroy*>(mySTL::pair*, mySTL::pair*); +template pair* uninit_copy*, mySTL::pair*>(mySTL::pair*, mySTL::pair*, mySTL::pair*); +template void destroy*>(mySTL::pair*, mySTL::pair*); +template pair* uninit_copy*, mySTL::pair*>(mySTL::pair*, mySTL::pair*, mySTL::pair*); +template class list; +template class list; +template class list; +template class list; +template class list; +template class list; +template class list; +template void destroy*>(mySTL::pair*, mySTL::pair*); +template yaSSL::del_ptr_zero for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template yaSSL::del_ptr_zero for_each::iterator, yaSSL::del_ptr_zero>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::del_ptr_zero); +template bool list::erase(list::iterator); +template void list::push_back(yaSSL::ThreadError); +template void list::pop_front(); +template void list::pop_back(); +template list::~list(); +template pair* GetArrayMemory >(size_t); +template void FreeArrayMemory >(pair*); +template pair* GetArrayMemory >(size_t); +template void FreeArrayMemory >(pair*); +template pair* GetArrayMemory >(size_t); +template void FreeArrayMemory >(pair*); +template pair* GetArrayMemory >(size_t); +template void FreeArrayMemory >(pair*); +} + +namespace yaSSL { +template void ysDelete(yaSSL::SSL_CTX*); +template void ysDelete(yaSSL::SSL*); +template void ysDelete(yaSSL::BIGNUM*); +template void ysDelete(unsigned char*); +template void ysDelete(yaSSL::DH*); +template void ysDelete(TaoCrypt::Signer*); +template void ysDelete(yaSSL::SSL_SESSION*); +template void ysDelete(input_buffer*); +template void ysDelete(output_buffer*); +template void ysDelete(x509*); +template void ysDelete(Auth*); +template void ysDelete(HandShakeBase*); +template void ysDelete(ServerKeyBase*); +template void ysDelete(ClientKeyBase*); +template void ysDelete(SSL_METHOD*); +template void ysDelete(DiffieHellman*); +template void ysDelete(BulkCipher*); +template void ysDelete(Digest*); +template void ysDelete(X509*); +template void ysDelete(Message*); +template void ysDelete(sslFactory*); +template void ysDelete(Sessions*); +template void ysDelete(Errors*); +template void ysArrayDelete(unsigned char*); +template void ysArrayDelete(char*); + +template int min(int, int); +template uint16 min(uint16, uint16); +template unsigned int min(unsigned int, unsigned int); +template unsigned long min(unsigned long, unsigned long); +} + +#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION + diff --git a/externals/mysql/extlib/yassl/src/timer.cpp b/externals/mysql/extlib/yassl/src/timer.cpp new file mode 100644 index 0000000..c1286b0 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/timer.cpp @@ -0,0 +1,81 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* timer.cpp implements a high res and low res timer + * +*/ + +#include "runtime.hpp" +#include "timer.hpp" + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#else +#include +#endif + +namespace yaSSL { + +#ifdef _WIN32 + + timer_d timer() + { + static bool init(false); + static LARGE_INTEGER freq; + + if (!init) { + QueryPerformanceFrequency(&freq); + init = true; + } + + LARGE_INTEGER count; + QueryPerformanceCounter(&count); + + return static_cast(count.QuadPart) / freq.QuadPart; + } + + + uint lowResTimer() + { + return static_cast(timer()); + } + +#else // _WIN32 + + timer_d timer() + { + struct timeval tv; + gettimeofday(&tv, 0); + + return static_cast(tv.tv_sec) + + static_cast(tv.tv_usec) / 1000000; + } + + + uint lowResTimer() + { + struct timeval tv; + gettimeofday(&tv, 0); + + return tv.tv_sec; + } + + +#endif // _WIN32 +} // namespace yaSSL diff --git a/externals/mysql/extlib/yassl/src/yassl.cpp b/externals/mysql/extlib/yassl/src/yassl.cpp new file mode 100644 index 0000000..815277c --- /dev/null +++ b/externals/mysql/extlib/yassl/src/yassl.cpp @@ -0,0 +1,229 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL implements external API + */ + +#include "runtime.hpp" +#include "yassl.hpp" +#include "yassl_int.hpp" +#include "handshake.hpp" +#include + +#include "openssl/ssl.h" // get rid of this + + + +namespace yaSSL { + + + +struct Base { + SSL_METHOD* method_; + SSL_CTX* ctx_; + SSL* ssl_; + + char* ca_; + char* cert_; + char* key_; + + DH* dh_; + + Base() : method_(0), ctx_(0), ssl_(0), ca_(0), cert_(0), key_(0), dh_(0) + {} + + ~Base() + { + if (dh_) DH_free(dh_); + delete[] key_; + delete[] cert_; + delete[] ca_; + SSL_CTX_free(ctx_); // frees method_ too + SSL_free(ssl_); + } +}; + + +void SetDH(Base&); + +void SetUpBase(Base& base, ConnectionEnd end, SOCKET_T s) +{ + base.method_ = new SSL_METHOD(end, ProtocolVersion(3,1)); + base.ctx_ = new SSL_CTX(base.method_); + + if (base.ca_) + if (SSL_CTX_load_verify_locations(base.ctx_, + base.ca_, 0) != SSL_SUCCESS) assert(0); + if (base.cert_) + if (SSL_CTX_use_certificate_file(base.ctx_, + base.cert_, SSL_FILETYPE_PEM) != SSL_SUCCESS) assert(0); + if (base.key_) + if (SSL_CTX_use_PrivateKey_file(base.ctx_, base.key_, + SSL_FILETYPE_PEM) != SSL_SUCCESS) assert(0); + + if (end == server_end) SetDH(base); + + base.ssl_ = new SSL(base.ctx_); + base.ssl_->useSocket().set_fd(s); +} + + +void SetDH(Base& base) +{ + static unsigned char dh512_p[] = + { + 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75, + 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F, + 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3, + 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12, + 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C, + 0x47,0x74,0xE8,0x33, + }; + + static unsigned char dh512_g[] = + { + 0x02, + }; + + if ( (base.dh_ = DH_new()) ) { + base.dh_->p = BN_bin2bn(dh512_p, sizeof(dh512_p), 0); + base.dh_->g = BN_bin2bn(dh512_g, sizeof(dh512_g), 0); + } + if (!base.dh_->p || !base.dh_->g) { + DH_free(base.dh_); + base.dh_ = 0; + } + SSL_CTX_set_tmp_dh(base.ctx_, base.dh_); +} + + +void NewCopy(char*& dst, const char* src) +{ + size_t len = strlen(src) + 1; + dst = new char[len]; + + strncpy(dst, src, len); +} + + +// Client Implementation +struct Client::ClientImpl { + Base base_; +}; + + +Client::Client() : pimpl_(new ClientImpl) +{} + + +Client::~Client() { delete pimpl_; } + + +int Client::Connect(SOCKET_T s) +{ + SetUpBase(pimpl_->base_, client_end, s); + return SSL_connect(pimpl_->base_.ssl_); +} + + +int Client::Write(const void* buffer, int sz) +{ + return sendData(*pimpl_->base_.ssl_, buffer, sz); +} + + +int Client::Read(void* buffer, int sz) +{ + Data data(min(sz, MAX_RECORD_SIZE), static_cast(buffer)); + return receiveData(*pimpl_->base_.ssl_, data); +} + + +void Client::SetCA(const char* name) +{ + NewCopy(pimpl_->base_.ca_, name); +} + + +void Client::SetCert(const char* name) +{ + NewCopy(pimpl_->base_.cert_, name); +} + + +void Client::SetKey(const char* name) +{ + NewCopy(pimpl_->base_.key_, name); +} + + + +// Server Implementation +struct Server::ServerImpl { + Base base_; +}; + + +Server::Server() : pimpl_(new ServerImpl) +{} + + +Server::~Server() { delete pimpl_; } + + +int Server::Accept(SOCKET_T s) +{ + SetUpBase(pimpl_->base_, server_end, s); + return SSL_accept(pimpl_->base_.ssl_); +} + + +int Server::Write(const void* buffer, int sz) +{ + return sendData(*pimpl_->base_.ssl_, buffer, sz); +} + + +int Server::Read(void* buffer, int sz) +{ + Data data(min(sz, MAX_RECORD_SIZE), static_cast(buffer)); + return receiveData(*pimpl_->base_.ssl_, data); +} + + +void Server::SetCA(const char* name) +{ + NewCopy(pimpl_->base_.ca_, name); +} + + +void Server::SetCert(const char* name) +{ + NewCopy(pimpl_->base_.cert_, name); +} + + +void Server::SetKey(const char* name) +{ + NewCopy(pimpl_->base_.key_, name); +} + + + +} // namespace yaSSL diff --git a/externals/mysql/extlib/yassl/src/yassl_error.cpp b/externals/mysql/extlib/yassl/src/yassl_error.cpp new file mode 100644 index 0000000..a1ef857 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/yassl_error.cpp @@ -0,0 +1,275 @@ +/* + Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL error implements and an exception class + */ + +#include "runtime.hpp" +#include "yassl_error.hpp" +#include "error.hpp" // TaoCrypt error numbers +#include "openssl/ssl.h" // SSL_ERROR_WANT_READ +#include // strncpy + +#ifdef _MSC_VER + // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy + #pragma warning(disable: 4996) +#endif + +namespace yaSSL { + + +/* may bring back in future +Error::Error(const char* s, YasslError e, Library l) + : mySTL::runtime_error(s), error_(e), lib_(l) +{ +} + + +YasslError Error::get_number() const +{ + return error_; +} + + +Library Error::get_lib() const +{ + + return lib_; +} +*/ + + +void SetErrorString(YasslError error, char* buffer) +{ + using namespace TaoCrypt; + const int max = MAX_ERROR_SZ; // shorthand + + switch (error) { + + // yaSSL proper errors + case range_error : + strncpy(buffer, "buffer index error, out of range", max); + break; + + case realloc_error : + strncpy(buffer, "trying to realloc a fixed buffer", max); + break; + + case factory_error : + strncpy(buffer, "unknown factory create request", max); + break; + + case unknown_cipher : + strncpy(buffer, "trying to use an unknown cipher", max); + break; + + case prefix_error : + strncpy(buffer, "bad master secret derivation, prefix too big", max); + break; + + case record_layer : + strncpy(buffer, "record layer not ready yet", max); + break; + + case handshake_layer : + strncpy(buffer, "handshake layer not ready yet", max); + break; + + case out_of_order : + strncpy(buffer, "handshake message received in wrong order", max); + break; + + case bad_input : + strncpy(buffer, "bad cipher suite input", max); + break; + + case match_error : + strncpy(buffer, "unable to match a supported cipher suite", max); + break; + + case no_key_file : + strncpy(buffer, "the server needs a private key file", max); + break; + + case verify_error : + strncpy(buffer, "unable to verify peer checksum", max); + break; + + case send_error : + strncpy(buffer, "socket layer send error", max); + break; + + case receive_error : + strncpy(buffer, "socket layer receive error", max); + break; + + case certificate_error : + strncpy(buffer, "unable to proccess cerificate", max); + break; + + case privateKey_error : + strncpy(buffer, "unable to proccess private key, bad format", max); + break; + + case badVersion_error : + strncpy(buffer, "protocl version mismatch", max); + break; + + case compress_error : + strncpy(buffer, "compression error", max); + break; + + case decompress_error : + strncpy(buffer, "decompression error", max); + break; + + case pms_version_error : + strncpy(buffer, "bad PreMasterSecret version error", max); + break; + + // openssl errors + case SSL_ERROR_WANT_READ : + strncpy(buffer, "the read operation would block", max); + break; + + case CERTFICATE_ERROR : + strncpy(buffer, "Unable to verify certificate", max); + break; + + // TaoCrypt errors + case NO_ERROR_E : + strncpy(buffer, "not in error state", max); + break; + + case WINCRYPT_E : + strncpy(buffer, "bad wincrypt acquire", max); + break; + + case CRYPTGEN_E : + strncpy(buffer, "CryptGenRandom error", max); + break; + + case OPEN_RAN_E : + strncpy(buffer, "unable to use random device", max); + break; + + case READ_RAN_E : + strncpy(buffer, "unable to use random device", max); + break; + + case INTEGER_E : + strncpy(buffer, "ASN: bad DER Integer Header", max); + break; + + case SEQUENCE_E : + strncpy(buffer, "ASN: bad Sequence Header", max); + break; + + case SET_E : + strncpy(buffer, "ASN: bad Set Header", max); + break; + + case VERSION_E : + strncpy(buffer, "ASN: version length not 1", max); + break; + + case SIG_OID_E : + strncpy(buffer, "ASN: signature OID mismatch", max); + break; + + case BIT_STR_E : + strncpy(buffer, "ASN: bad BitString Header", max); + break; + + case UNKNOWN_OID_E : + strncpy(buffer, "ASN: unknown key OID type", max); + break; + + case OBJECT_ID_E : + strncpy(buffer, "ASN: bad Ojbect ID Header", max); + break; + + case TAG_NULL_E : + strncpy(buffer, "ASN: expected TAG NULL", max); + break; + + case EXPECT_0_E : + strncpy(buffer, "ASN: expected 0", max); + break; + + case OCTET_STR_E : + strncpy(buffer, "ASN: bad Octet String Header", max); + break; + + case TIME_E : + strncpy(buffer, "ASN: bad TIME", max); + break; + + case DATE_SZ_E : + strncpy(buffer, "ASN: bad Date Size", max); + break; + + case SIG_LEN_E : + strncpy(buffer, "ASN: bad Signature Length", max); + break; + + case UNKOWN_SIG_E : + strncpy(buffer, "ASN: unknown signature OID", max); + break; + + case UNKOWN_HASH_E : + strncpy(buffer, "ASN: unknown hash OID", max); + break; + + case DSA_SZ_E : + strncpy(buffer, "ASN: bad DSA r or s size", max); + break; + + case BEFORE_DATE_E : + strncpy(buffer, "ASN: before date in the future", max); + break; + + case AFTER_DATE_E : + strncpy(buffer, "ASN: after date in the past", max); + break; + + case SIG_CONFIRM_E : + strncpy(buffer, "ASN: bad self signature confirmation", max); + break; + + case SIG_OTHER_E : + strncpy(buffer, "ASN: bad other signature confirmation", max); + break; + + case CONTENT_E : + strncpy(buffer, "bad content processing", max); + break; + + case PEM_E : + strncpy(buffer, "bad PEM format processing", max); + break; + + default : + strncpy(buffer, "unknown error number", max); + } +} + + + +} // namespace yaSSL diff --git a/externals/mysql/extlib/yassl/src/yassl_imp.cpp b/externals/mysql/extlib/yassl/src/yassl_imp.cpp new file mode 100644 index 0000000..20dfe50 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/yassl_imp.cpp @@ -0,0 +1,2287 @@ +/* + Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* yaSSL source implements all SSL.v3 secification structures. + */ + +#include "runtime.hpp" +#include "yassl_int.hpp" +#include "handshake.hpp" + +#include "asn.hpp" // provide crypto wrapper?? + + + +namespace yaSSL { + + +namespace { // locals + +bool isTLS(ProtocolVersion pv) +{ + if (pv.major_ >= 3 && pv.minor_ >= 1) + return true; + + return false; +} + + +} // namespace (locals) + + +void hashHandShake(SSL&, const input_buffer&, uint); + + +ProtocolVersion::ProtocolVersion(uint8 maj, uint8 min) + : major_(maj), minor_(min) +{} + + +// construct key exchange with known ssl parms +void ClientKeyExchange::createKey(SSL& ssl) +{ + const ClientKeyFactory& ckf = ssl.getFactory().getClientKey(); + client_key_ = ckf.CreateObject(ssl.getSecurity().get_parms().kea_); + + if (!client_key_) + ssl.SetError(factory_error); +} + + +// construct key exchange with known ssl parms +void ServerKeyExchange::createKey(SSL& ssl) +{ + const ServerKeyFactory& skf = ssl.getFactory().getServerKey(); + server_key_ = skf.CreateObject(ssl.getSecurity().get_parms().kea_); + + if (!server_key_) + ssl.SetError(factory_error); +} + + +// build/set PreMaster secret and encrypt, client side +void EncryptedPreMasterSecret::build(SSL& ssl) +{ + opaque tmp[SECRET_LEN]; + memset(tmp, 0, sizeof(tmp)); + ssl.getCrypto().get_random().Fill(tmp, SECRET_LEN); + ProtocolVersion pv = ssl.getSecurity().get_connection().chVersion_; + tmp[0] = pv.major_; + tmp[1] = pv.minor_; + ssl.set_preMaster(tmp, SECRET_LEN); + + const CertManager& cert = ssl.getCrypto().get_certManager(); + RSA rsa(cert.get_peerKey(), cert.get_peerKeyLength()); + bool tls = ssl.isTLS(); // if TLS, put length for encrypted data + alloc(rsa.get_cipherLength() + (tls ? 2 : 0)); + byte* holder = secret_; + if (tls) { + byte len[2]; + c16toa(rsa.get_cipherLength(), len); + memcpy(secret_, len, sizeof(len)); + holder += 2; + } + rsa.encrypt(holder, tmp, SECRET_LEN, ssl.getCrypto().get_random()); +} + + +// build/set premaster and Client Public key, client side +void ClientDiffieHellmanPublic::build(SSL& ssl) +{ + DiffieHellman& dhServer = ssl.useCrypto().use_dh(); + DiffieHellman dhClient(dhServer); + + uint keyLength = dhClient.get_agreedKeyLength(); // pub and agree same + + alloc(keyLength, true); + dhClient.makeAgreement(dhServer.get_publicKey(), keyLength); + c16toa(keyLength, Yc_); + memcpy(Yc_ + KEY_OFFSET, dhClient.get_publicKey(), keyLength); + + // because of encoding first byte might be zero, don't use it for preMaster + if (*dhClient.get_agreedKey() == 0) + ssl.set_preMaster(dhClient.get_agreedKey() + 1, keyLength - 1); + else + ssl.set_preMaster(dhClient.get_agreedKey(), keyLength); +} + + +// build server exhange, server side +void DH_Server::build(SSL& ssl) +{ + DiffieHellman& dhServer = ssl.useCrypto().use_dh(); + + int pSz, gSz, pubSz; + dhServer.set_sizes(pSz, gSz, pubSz); + dhServer.get_parms(parms_.alloc_p(pSz), parms_.alloc_g(gSz), + parms_.alloc_pub(pubSz)); + + short sigSz = 0; + mySTL::auto_ptr auth; + const CertManager& cert = ssl.getCrypto().get_certManager(); + + if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) + { + if (cert.get_keyType() != rsa_sa_algo) { + ssl.SetError(privateKey_error); + return; + } + auth.reset(NEW_YS RSA(cert.get_privateKey(), + cert.get_privateKeyLength(), false)); + } + else { + if (cert.get_keyType() != dsa_sa_algo) { + ssl.SetError(privateKey_error); + return; + } + auth.reset(NEW_YS DSS(cert.get_privateKey(), + cert.get_privateKeyLength(), false)); + sigSz += DSS_ENCODED_EXTRA; + } + + sigSz += auth->get_signatureLength(); + if (!sigSz) { + ssl.SetError(privateKey_error); + return; + } + + length_ = 8; // pLen + gLen + YsLen + SigLen + length_ += pSz + gSz + pubSz + sigSz; + + output_buffer tmp(length_); + byte len[2]; + // P + c16toa(pSz, len); + tmp.write(len, sizeof(len)); + tmp.write(parms_.get_p(), pSz); + // G + c16toa(gSz, len); + tmp.write(len, sizeof(len)); + tmp.write(parms_.get_g(), gSz); + // Ys + c16toa(pubSz, len); + tmp.write(len, sizeof(len)); + tmp.write(parms_.get_pub(), pubSz); + + // Sig + byte hash[FINISHED_SZ]; + MD5 md5; + SHA sha; + signature_ = NEW_YS byte[sigSz]; + + const Connection& conn = ssl.getSecurity().get_connection(); + // md5 + md5.update(conn.client_random_, RAN_LEN); + md5.update(conn.server_random_, RAN_LEN); + md5.update(tmp.get_buffer(), tmp.get_size()); + md5.get_digest(hash); + + // sha + sha.update(conn.client_random_, RAN_LEN); + sha.update(conn.server_random_, RAN_LEN); + sha.update(tmp.get_buffer(), tmp.get_size()); + sha.get_digest(&hash[MD5_LEN]); + + if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) + auth->sign(signature_, hash, sizeof(hash), + ssl.getCrypto().get_random()); + else { + auth->sign(signature_, &hash[MD5_LEN], SHA_LEN, + ssl.getCrypto().get_random()); + byte encoded[DSS_SIG_SZ + DSS_ENCODED_EXTRA]; + TaoCrypt::EncodeDSA_Signature(signature_, encoded); + memcpy(signature_, encoded, sizeof(encoded)); + } + + c16toa(sigSz, len); + tmp.write(len, sizeof(len)); + tmp.write(signature_, sigSz); + + // key message + keyMessage_ = NEW_YS opaque[length_]; + memcpy(keyMessage_, tmp.get_buffer(), tmp.get_size()); +} + + +// read PreMaster secret and decrypt, server side +void EncryptedPreMasterSecret::read(SSL& ssl, input_buffer& input) +{ + const CertManager& cert = ssl.getCrypto().get_certManager(); + RSA rsa(cert.get_privateKey(), cert.get_privateKeyLength(), false); + uint16 cipherLen = rsa.get_cipherLength(); + if (ssl.isTLS()) { + byte len[2]; + input.read(len, sizeof(len)); + ato16(len, cipherLen); + } + alloc(cipherLen); + input.read(secret_, length_); + + opaque preMasterSecret[SECRET_LEN]; + rsa.decrypt(preMasterSecret, secret_, length_, + ssl.getCrypto().get_random()); + + ProtocolVersion pv = ssl.getSecurity().get_connection().chVersion_; + if (pv.major_ != preMasterSecret[0] || pv.minor_ != preMasterSecret[1]) + ssl.SetError(pms_version_error); // continue deriving for timing attack + + ssl.set_preMaster(preMasterSecret, SECRET_LEN); + ssl.makeMasterSecret(); +} + + +EncryptedPreMasterSecret::EncryptedPreMasterSecret() + : secret_(0), length_(0) +{} + + +EncryptedPreMasterSecret::~EncryptedPreMasterSecret() +{ + ysArrayDelete(secret_); +} + + +int EncryptedPreMasterSecret::get_length() const +{ + return length_; +} + + +opaque* EncryptedPreMasterSecret::get_clientKey() const +{ + return secret_; +} + + +void EncryptedPreMasterSecret::alloc(int sz) +{ + length_ = sz; + secret_ = NEW_YS opaque[sz]; +} + + +// read client's public key, server side +void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input) +{ + DiffieHellman& dh = ssl.useCrypto().use_dh(); + + uint16 keyLength; + byte tmp[2]; + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + ato16(tmp, keyLength); + + alloc(keyLength); + input.read(Yc_, keyLength); + dh.makeAgreement(Yc_, keyLength); + + // because of encoding, first byte might be 0, don't use for preMaster + if (*dh.get_agreedKey() == 0) + ssl.set_preMaster(dh.get_agreedKey() + 1, dh.get_agreedKeyLength() - 1); + else + ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength()); + ssl.makeMasterSecret(); +} + + +ClientDiffieHellmanPublic::ClientDiffieHellmanPublic() + : length_(0), Yc_(0) +{} + + +ClientDiffieHellmanPublic::~ClientDiffieHellmanPublic() +{ + ysArrayDelete(Yc_); +} + + +int ClientDiffieHellmanPublic::get_length() const +{ + return length_; +} + + +opaque* ClientDiffieHellmanPublic::get_clientKey() const +{ + return Yc_; +} + + +void ClientDiffieHellmanPublic::alloc(int sz, bool offset) +{ + length_ = sz + (offset ? KEY_OFFSET : 0); + Yc_ = NEW_YS opaque[length_]; +} + + +// read server's p, g, public key and sig, client side +void DH_Server::read(SSL& ssl, input_buffer& input) +{ + uint16 length, messageTotal = 6; // pSz + gSz + pubSz + byte tmp[2]; + + // p + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + ato16(tmp, length); + messageTotal += length; + + input.read(parms_.alloc_p(length), length); + + // g + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + ato16(tmp, length); + messageTotal += length; + + input.read(parms_.alloc_g(length), length); + + // pub + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + ato16(tmp, length); + messageTotal += length; + + input.read(parms_.alloc_pub(length), length); + + // save message for hash verify + input_buffer message(messageTotal); + input.set_current(input.get_current() - messageTotal); + input.read(message.get_buffer(), messageTotal); + message.add_size(messageTotal); + + // signature + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + ato16(tmp, length); + + signature_ = NEW_YS byte[length]; + input.read(signature_, length); + + // verify signature + byte hash[FINISHED_SZ]; + MD5 md5; + SHA sha; + + const Connection& conn = ssl.getSecurity().get_connection(); + // md5 + md5.update(conn.client_random_, RAN_LEN); + md5.update(conn.server_random_, RAN_LEN); + md5.update(message.get_buffer(), message.get_size()); + md5.get_digest(hash); + + // sha + sha.update(conn.client_random_, RAN_LEN); + sha.update(conn.server_random_, RAN_LEN); + sha.update(message.get_buffer(), message.get_size()); + sha.get_digest(&hash[MD5_LEN]); + + const CertManager& cert = ssl.getCrypto().get_certManager(); + + if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) { + RSA rsa(cert.get_peerKey(), cert.get_peerKeyLength()); + if (!rsa.verify(hash, sizeof(hash), signature_, length)) + ssl.SetError(verify_error); + } + else { + byte decodedSig[DSS_SIG_SZ]; + length = TaoCrypt::DecodeDSA_Signature(decodedSig, signature_, length); + + DSS dss(cert.get_peerKey(), cert.get_peerKeyLength()); + if (!dss.verify(&hash[MD5_LEN], SHA_LEN, decodedSig, length)) + ssl.SetError(verify_error); + } + + // save input + ssl.useCrypto().SetDH(NEW_YS DiffieHellman(parms_.get_p(), + parms_.get_pSize(), parms_.get_g(), parms_.get_gSize(), + parms_.get_pub(), parms_.get_pubSize(), + ssl.getCrypto().get_random())); +} + + +DH_Server::DH_Server() + : signature_(0), length_(0), keyMessage_(0) +{} + + +DH_Server::~DH_Server() +{ + ysArrayDelete(keyMessage_); + ysArrayDelete(signature_); +} + + +int DH_Server::get_length() const +{ + return length_; +} + + +opaque* DH_Server::get_serverKey() const +{ + return keyMessage_; +} + + +// set available suites +Parameters::Parameters(ConnectionEnd ce, const Ciphers& ciphers, + ProtocolVersion pv, bool haveDH) : entity_(ce) +{ + pending_ = true; // suite not set yet + strncpy(cipher_name_, "NONE", 5); + + removeDH_ = !haveDH; // only use on server side for set suites + + if (ciphers.setSuites_) { // use user set list + suites_size_ = ciphers.suiteSz_; + memcpy(suites_, ciphers.suites_, ciphers.suiteSz_); + SetCipherNames(); + } + else + SetSuites(pv, ce == server_end && removeDH_); // defaults + +} + + +void Parameters::SetSuites(ProtocolVersion pv, bool removeDH, bool removeRSA, + bool removeDSA) +{ + int i = 0; + // available suites, best first + // when adding more, make sure cipher_names is updated and + // MAX_CIPHERS is big enough + + if (isTLS(pv)) { + if (!removeDH) { + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_SHA; + } + if (!removeDSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_DSS_WITH_AES_256_CBC_SHA; + } + } + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_RSA_WITH_AES_256_CBC_SHA; + } + if (!removeDH) { + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_RSA_WITH_AES_128_CBC_SHA; + } + if (!removeDSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_DSS_WITH_AES_128_CBC_SHA; + } + } + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_RSA_WITH_AES_128_CBC_SHA; + suites_[i++] = 0x00; + suites_[i++] = TLS_RSA_WITH_AES_256_CBC_RMD160; + suites_[i++] = 0x00; + suites_[i++] = TLS_RSA_WITH_AES_128_CBC_RMD160; + suites_[i++] = 0x00; + suites_[i++] = TLS_RSA_WITH_3DES_EDE_CBC_RMD160; + } + if (!removeDH) { + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_RSA_WITH_AES_256_CBC_RMD160; + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_RSA_WITH_AES_128_CBC_RMD160; + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160; + } + if (!removeDSA) { + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_DSS_WITH_AES_256_CBC_RMD160; + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_DSS_WITH_AES_128_CBC_RMD160; + suites_[i++] = 0x00; + suites_[i++] = TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160; + } + } + } + + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = SSL_RSA_WITH_RC4_128_SHA; + suites_[i++] = 0x00; + suites_[i++] = SSL_RSA_WITH_RC4_128_MD5; + + suites_[i++] = 0x00; + suites_[i++] = SSL_RSA_WITH_3DES_EDE_CBC_SHA; + suites_[i++] = 0x00; + suites_[i++] = SSL_RSA_WITH_DES_CBC_SHA; + } + if (!removeDH) { + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA; + } + if (!removeDSA) { + suites_[i++] = 0x00; + suites_[i++] = SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA; + } + if (!removeRSA) { + suites_[i++] = 0x00; + suites_[i++] = SSL_DHE_RSA_WITH_DES_CBC_SHA; + } + if (!removeDSA) { + suites_[i++] = 0x00; + suites_[i++] = SSL_DHE_DSS_WITH_DES_CBC_SHA; + } + } + + suites_size_ = i; + + SetCipherNames(); +} + + +void Parameters::SetCipherNames() +{ + const int suites = suites_size_ / 2; + int pos = 0; + + for (int j = 0; j < suites; j++) { + int index = suites_[j*2 + 1]; // every other suite is suite id + size_t len = strlen(cipher_names[index]) + 1; + strncpy(cipher_list_[pos++], cipher_names[index], len); + } + cipher_list_[pos][0] = 0; +} + + +// input operator for RecordLayerHeader, adjust stream +input_buffer& operator>>(input_buffer& input, RecordLayerHeader& hdr) +{ + hdr.type_ = ContentType(input[AUTO]); + hdr.version_.major_ = input[AUTO]; + hdr.version_.minor_ = input[AUTO]; + + // length + byte tmp[2]; + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + ato16(tmp, hdr.length_); + + return input; +} + + +// output operator for RecordLayerHeader +output_buffer& operator<<(output_buffer& output, const RecordLayerHeader& hdr) +{ + output[AUTO] = hdr.type_; + output[AUTO] = hdr.version_.major_; + output[AUTO] = hdr.version_.minor_; + + // length + byte tmp[2]; + c16toa(hdr.length_, tmp); + output[AUTO] = tmp[0]; + output[AUTO] = tmp[1]; + + return output; +} + + +// virtual input operator for Messages +input_buffer& operator>>(input_buffer& input, Message& msg) +{ + return msg.set(input); +} + +// virtual output operator for Messages +output_buffer& operator<<(output_buffer& output, const Message& msg) +{ + return msg.get(output); +} + + +// input operator for HandShakeHeader +input_buffer& operator>>(input_buffer& input, HandShakeHeader& hs) +{ + hs.type_ = HandShakeType(input[AUTO]); + + hs.length_[0] = input[AUTO]; + hs.length_[1] = input[AUTO]; + hs.length_[2] = input[AUTO]; + + return input; +} + + +// output operator for HandShakeHeader +output_buffer& operator<<(output_buffer& output, const HandShakeHeader& hdr) +{ + output[AUTO] = hdr.type_; + output.write(hdr.length_, sizeof(hdr.length_)); + return output; +} + + +// HandShake Header Processing function +void HandShakeHeader::Process(input_buffer& input, SSL& ssl) +{ + ssl.verifyState(*this); + if (ssl.GetError()) return; + const HandShakeFactory& hsf = ssl.getFactory().getHandShake(); + mySTL::auto_ptr hs(hsf.CreateObject(type_)); + if (!hs.get()) { + ssl.SetError(factory_error); + return; + } + + uint len = c24to32(length_); + if (len > input.get_remaining()) { + ssl.SetError(bad_input); + return; + } + hashHandShake(ssl, input, len); + + hs->set_length(len); + input >> *hs; + hs->Process(input, ssl); +} + + +ContentType HandShakeHeader::get_type() const +{ + return handshake; +} + + +uint16 HandShakeHeader::get_length() const +{ + return c24to32(length_); +} + + +HandShakeType HandShakeHeader::get_handshakeType() const +{ + return type_; +} + + +void HandShakeHeader::set_type(HandShakeType hst) +{ + type_ = hst; +} + + +void HandShakeHeader::set_length(uint32 u32) +{ + c32to24(u32, length_); +} + + +input_buffer& HandShakeHeader::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& HandShakeHeader::get(output_buffer& out) const +{ + return out << *this; +} + + + +int HandShakeBase::get_length() const +{ + return length_; +} + + +void HandShakeBase::set_length(int l) +{ + length_ = l; +} + + +// for building buffer's type field +HandShakeType HandShakeBase::get_type() const +{ + return no_shake; +} + + +input_buffer& HandShakeBase::set(input_buffer& in) +{ + return in; +} + + +output_buffer& HandShakeBase::get(output_buffer& out) const +{ + return out; +} + + +void HandShakeBase::Process(input_buffer&, SSL&) +{} + + +input_buffer& HelloRequest::set(input_buffer& in) +{ + return in; +} + + +output_buffer& HelloRequest::get(output_buffer& out) const +{ + return out; +} + + +void HelloRequest::Process(input_buffer&, SSL&) +{} + + +HandShakeType HelloRequest::get_type() const +{ + return hello_request; +} + + +// input operator for CipherSpec +input_buffer& operator>>(input_buffer& input, ChangeCipherSpec& cs) +{ + cs.type_ = CipherChoice(input[AUTO]); + return input; +} + +// output operator for CipherSpec +output_buffer& operator<<(output_buffer& output, const ChangeCipherSpec& cs) +{ + output[AUTO] = cs.type_; + return output; +} + + +ChangeCipherSpec::ChangeCipherSpec() + : type_(change_cipher_spec_choice) +{} + + +input_buffer& ChangeCipherSpec::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& ChangeCipherSpec::get(output_buffer& out) const +{ + return out << *this; +} + + +ContentType ChangeCipherSpec::get_type() const +{ + return change_cipher_spec; +} + + +uint16 ChangeCipherSpec::get_length() const +{ + return SIZEOF_ENUM; +} + + +// CipherSpec processing handler +void ChangeCipherSpec::Process(input_buffer&, SSL& ssl) +{ + ssl.useSecurity().use_parms().pending_ = false; + if (ssl.getSecurity().get_resuming()) { + if (ssl.getSecurity().get_parms().entity_ == client_end) + buildFinished(ssl, ssl.useHashes().use_verify(), server); // server + } + else if (ssl.getSecurity().get_parms().entity_ == server_end) + buildFinished(ssl, ssl.useHashes().use_verify(), client); // client +} + + +Alert::Alert(AlertLevel al, AlertDescription ad) + : level_(al), description_(ad) +{} + + +ContentType Alert::get_type() const +{ + return alert; +} + + +uint16 Alert::get_length() const +{ + return SIZEOF_ENUM * 2; +} + + +input_buffer& Alert::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& Alert::get(output_buffer& out) const +{ + return out << *this; +} + + +// input operator for Alert +input_buffer& operator>>(input_buffer& input, Alert& a) +{ + a.level_ = AlertLevel(input[AUTO]); + a.description_ = AlertDescription(input[AUTO]); + + return input; +} + + +// output operator for Alert +output_buffer& operator<<(output_buffer& output, const Alert& a) +{ + output[AUTO] = a.level_; + output[AUTO] = a.description_; + return output; +} + + +// Alert processing handler +void Alert::Process(input_buffer& input, SSL& ssl) +{ + if (ssl.getSecurity().get_parms().pending_ == false) { // encrypted alert + int aSz = get_length(); // alert size already read on input + opaque verify[SHA_LEN]; + const opaque* data = input.get_buffer() + input.get_current() - aSz; + + if (ssl.isTLS()) + TLS_hmac(ssl, verify, data, aSz, alert, true); + else + hmac(ssl, verify, data, aSz, alert, true); + + // read mac and fill + int digestSz = ssl.getCrypto().get_digest().get_digestSize(); + opaque mac[SHA_LEN]; + input.read(mac, digestSz); + + if (ssl.getSecurity().get_parms().cipher_type_ == block) { + int ivExtra = 0; + opaque fill; + + if (ssl.isTLSv1_1()) + ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); + int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - + aSz - digestSz; + for (int i = 0; i < padSz; i++) + fill = input[AUTO]; + } + + // verify + if (memcmp(mac, verify, digestSz)) { + ssl.SetError(verify_error); + return; + } + } + if (level_ == fatal) { + ssl.useStates().useRecord() = recordNotReady; + ssl.useStates().useHandShake() = handShakeNotReady; + ssl.SetError(YasslError(description_)); + } +} + + +Data::Data() + : length_(0), buffer_(0), write_buffer_(0) +{} + + +Data::Data(uint16 len, opaque* b) + : length_(len), buffer_(b), write_buffer_(0) +{} + + +void Data::SetData(uint16 len, const opaque* buffer) +{ + assert(write_buffer_ == 0); + + length_ = len; + write_buffer_ = buffer; +} + +input_buffer& Data::set(input_buffer& in) +{ + return in; +} + + +output_buffer& Data::get(output_buffer& out) const +{ + return out << *this; +} + + +ContentType Data::get_type() const +{ + return application_data; +} + + +uint16 Data::get_length() const +{ + return length_; +} + + +void Data::set_length(uint16 l) +{ + length_ = l; +} + + +opaque* Data::set_buffer() +{ + return buffer_; +} + + +// output operator for Data +output_buffer& operator<<(output_buffer& output, const Data& data) +{ + output.write(data.write_buffer_, data.length_); + return output; +} + + +// Process handler for Data +void Data::Process(input_buffer& input, SSL& ssl) +{ + int msgSz = ssl.getSecurity().get_parms().encrypt_size_; + int pad = 0, padByte = 0; + int ivExtra = 0; + + if (ssl.getSecurity().get_parms().cipher_type_ == block) { + if (ssl.isTLSv1_1()) // IV + ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); + pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1); + padByte = 1; + } + int digestSz = ssl.getCrypto().get_digest().get_digestSize(); + int dataSz = msgSz - ivExtra - digestSz - pad - padByte; + opaque verify[SHA_LEN]; + + const byte* rawData = input.get_buffer() + input.get_current(); + + // read data + if (dataSz) { // could be compressed + if (ssl.CompressionOn()) { + input_buffer tmp; + if (DeCompress(input, dataSz, tmp) == -1) { + ssl.SetError(decompress_error); + return; + } + ssl.addData(NEW_YS input_buffer(tmp.get_size(), + tmp.get_buffer(), tmp.get_size())); + } + else { + input_buffer* data; + ssl.addData(data = NEW_YS input_buffer(dataSz)); + input.read(data->get_buffer(), dataSz); + data->add_size(dataSz); + } + + if (ssl.isTLS()) + TLS_hmac(ssl, verify, rawData, dataSz, application_data, true); + else + hmac(ssl, verify, rawData, dataSz, application_data, true); + } + + // read mac and fill + opaque mac[SHA_LEN]; + opaque fill; + input.read(mac, digestSz); + for (int i = 0; i < pad; i++) + fill = input[AUTO]; + if (padByte) + fill = input[AUTO]; + + // verify + if (dataSz) { + if (memcmp(mac, verify, digestSz)) { + ssl.SetError(verify_error); + return; + } + } + else + ssl.get_SEQIncrement(true); // even though no data, increment verify +} + + +// virtual input operator for HandShakes +input_buffer& operator>>(input_buffer& input, HandShakeBase& hs) +{ + return hs.set(input); +} + + +// virtual output operator for HandShakes +output_buffer& operator<<(output_buffer& output, const HandShakeBase& hs) +{ + return hs.get(output); +} + + +Certificate::Certificate(const x509* cert) : cert_(cert) +{ + set_length(cert_->get_length() + 2 * CERT_HEADER); // list and cert size +} + + +const opaque* Certificate::get_buffer() const +{ + return cert_->get_buffer(); +} + + +// output operator for Certificate +output_buffer& operator<<(output_buffer& output, const Certificate& cert) +{ + uint sz = cert.get_length() - 2 * CERT_HEADER; + opaque tmp[CERT_HEADER]; + + c32to24(sz + CERT_HEADER, tmp); + output.write(tmp, CERT_HEADER); + c32to24(sz, tmp); + output.write(tmp, CERT_HEADER); + output.write(cert.get_buffer(), sz); + + return output; +} + + +// certificate processing handler +void Certificate::Process(input_buffer& input, SSL& ssl) +{ + CertManager& cm = ssl.useCrypto().use_certManager(); + + uint32 list_sz; + byte tmp[3]; + + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + tmp[2] = input[AUTO]; + c24to32(tmp, list_sz); + + while (list_sz) { + // cert size + uint32 cert_sz; + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + tmp[2] = input[AUTO]; + c24to32(tmp, cert_sz); + + x509* myCert; + cm.AddPeerCert(myCert = NEW_YS x509(cert_sz)); + input.read(myCert->use_buffer(), myCert->get_length()); + + list_sz -= cert_sz + CERT_HEADER; + } + if (int err = cm.Validate()) + ssl.SetError(YasslError(err)); + else if (ssl.getSecurity().get_parms().entity_ == client_end) + ssl.useStates().useClient() = serverCertComplete; +} + + +Certificate::Certificate() + : cert_(0) +{} + + +input_buffer& Certificate::set(input_buffer& in) +{ + return in; +} + + +output_buffer& Certificate::get(output_buffer& out) const +{ + return out << *this; +} + + +HandShakeType Certificate::get_type() const +{ + return certificate; +} + + +ServerDHParams::ServerDHParams() + : pSz_(0), gSz_(0), pubSz_(0), p_(0), g_(0), Ys_(0) +{} + + +ServerDHParams::~ServerDHParams() +{ + ysArrayDelete(Ys_); + ysArrayDelete(g_); + ysArrayDelete(p_); +} + + +int ServerDHParams::get_pSize() const +{ + return pSz_; +} + + +int ServerDHParams::get_gSize() const +{ + return gSz_; +} + + +int ServerDHParams::get_pubSize() const +{ + return pubSz_; +} + + +const opaque* ServerDHParams::get_p() const +{ + return p_; +} + + +const opaque* ServerDHParams::get_g() const +{ + return g_; +} + + +const opaque* ServerDHParams::get_pub() const +{ + return Ys_; +} + + +opaque* ServerDHParams::alloc_p(int sz) +{ + p_ = NEW_YS opaque[pSz_ = sz]; + return p_; +} + + +opaque* ServerDHParams::alloc_g(int sz) +{ + g_ = NEW_YS opaque[gSz_ = sz]; + return g_; +} + + +opaque* ServerDHParams::alloc_pub(int sz) +{ + Ys_ = NEW_YS opaque[pubSz_ = sz]; + return Ys_; +} + + +int ServerKeyBase::get_length() const +{ + return 0; +} + + +opaque* ServerKeyBase::get_serverKey() const +{ + return 0; +} + + +// input operator for ServerHello +input_buffer& operator>>(input_buffer& input, ServerHello& hello) +{ + // Protocol + hello.server_version_.major_ = input[AUTO]; + hello.server_version_.minor_ = input[AUTO]; + + // Random + input.read(hello.random_, RAN_LEN); + + // Session + hello.id_len_ = input[AUTO]; + if (hello.id_len_) + input.read(hello.session_id_, hello.id_len_); + + // Suites + hello.cipher_suite_[0] = input[AUTO]; + hello.cipher_suite_[1] = input[AUTO]; + + // Compression + hello.compression_method_ = CompressionMethod(input[AUTO]); + + return input; +} + + +// output operator for ServerHello +output_buffer& operator<<(output_buffer& output, const ServerHello& hello) +{ + // Protocol + output[AUTO] = hello.server_version_.major_; + output[AUTO] = hello.server_version_.minor_; + + // Random + output.write(hello.random_, RAN_LEN); + + // Session + output[AUTO] = hello.id_len_; + output.write(hello.session_id_, ID_LEN); + + // Suites + output[AUTO] = hello.cipher_suite_[0]; + output[AUTO] = hello.cipher_suite_[1]; + + // Compression + output[AUTO] = hello.compression_method_; + + return output; +} + + +// Server Hello processing handler +void ServerHello::Process(input_buffer&, SSL& ssl) +{ + if (ssl.GetMultiProtocol()) { // SSLv23 support + if (ssl.isTLS() && server_version_.minor_ < 1) + // downgrade to SSLv3 + ssl.useSecurity().use_connection().TurnOffTLS(); + else if (ssl.isTLSv1_1() && server_version_.minor_ == 1) + // downdrage to TLSv1 + ssl.useSecurity().use_connection().TurnOffTLS1_1(); + } + else if (ssl.isTLSv1_1() && server_version_.minor_ < 2) { + ssl.SetError(badVersion_error); + return; + } + else if (ssl.isTLS() && server_version_.minor_ < 1) { + ssl.SetError(badVersion_error); + return; + } + else if (!ssl.isTLS() && (server_version_.major_ == 3 && + server_version_.minor_ >= 1)) { + ssl.SetError(badVersion_error); + return; + } + ssl.set_pending(cipher_suite_[1]); + ssl.set_random(random_, server_end); + if (id_len_) + ssl.set_sessionID(session_id_); + else + ssl.useSecurity().use_connection().sessionID_Set_ = false; + + if (ssl.getSecurity().get_resuming()) + if (memcmp(session_id_, ssl.getSecurity().get_resume().GetID(), + ID_LEN) == 0) { + ssl.set_masterSecret(ssl.getSecurity().get_resume().GetSecret()); + if (ssl.isTLS()) + ssl.deriveTLSKeys(); + else + ssl.deriveKeys(); + ssl.useStates().useClient() = serverHelloDoneComplete; + return; + } + else { + ssl.useSecurity().set_resuming(false); + ssl.useLog().Trace("server denied resumption"); + } + + if (ssl.CompressionOn() && !compression_method_) + ssl.UnSetCompression(); // server isn't supporting yaSSL zlib request + + ssl.useStates().useClient() = serverHelloComplete; +} + + +ServerHello::ServerHello() +{ + memset(random_, 0, RAN_LEN); + memset(session_id_, 0, ID_LEN); +} + + +ServerHello::ServerHello(ProtocolVersion pv, bool useCompression) + : server_version_(pv), + compression_method_(useCompression ? zlib : no_compression) +{ + memset(random_, 0, RAN_LEN); + memset(session_id_, 0, ID_LEN); +} + + +input_buffer& ServerHello::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& ServerHello::get(output_buffer& out) const +{ + return out << *this; +} + + +HandShakeType ServerHello::get_type() const +{ + return server_hello; +} + + +const opaque* ServerHello::get_random() const +{ + return random_; +} + + +// Server Hello Done processing handler +void ServerHelloDone::Process(input_buffer&, SSL& ssl) +{ + ssl.useStates().useClient() = serverHelloDoneComplete; +} + + +ServerHelloDone::ServerHelloDone() +{ + set_length(0); +} + + +input_buffer& ServerHelloDone::set(input_buffer& in) +{ + return in; +} + + +output_buffer& ServerHelloDone::get(output_buffer& out) const +{ + return out; +} + + +HandShakeType ServerHelloDone::get_type() const +{ + return server_hello_done; +} + + +int ClientKeyBase::get_length() const +{ + return 0; +} + + +opaque* ClientKeyBase::get_clientKey() const +{ + return 0; +} + + +// input operator for Client Hello +input_buffer& operator>>(input_buffer& input, ClientHello& hello) +{ + uint begin = input.get_current(); // could have extensions at end + + // Protocol + hello.client_version_.major_ = input[AUTO]; + hello.client_version_.minor_ = input[AUTO]; + + // Random + input.read(hello.random_, RAN_LEN); + + // Session + hello.id_len_ = input[AUTO]; + if (hello.id_len_) input.read(hello.session_id_, ID_LEN); + + // Suites + byte tmp[2]; + uint16 len; + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; + ato16(tmp, len); + + hello.suite_len_ = min(len, static_cast(MAX_SUITE_SZ)); + input.read(hello.cipher_suites_, hello.suite_len_); + if (len > hello.suite_len_) // ignore extra suites + input.set_current(input.get_current() + len - hello.suite_len_); + + // Compression + hello.comp_len_ = input[AUTO]; + hello.compression_methods_ = no_compression; + while (hello.comp_len_--) { + CompressionMethod cm = CompressionMethod(input[AUTO]); + if (cm == zlib) + hello.compression_methods_ = zlib; + } + + uint read = input.get_current() - begin; + uint expected = hello.get_length(); + + // ignore client hello extensions for now + if (read < expected) + input.set_current(input.get_current() + expected - read); + + return input; +} + + +// output operaotr for Client Hello +output_buffer& operator<<(output_buffer& output, const ClientHello& hello) +{ + // Protocol + output[AUTO] = hello.client_version_.major_; + output[AUTO] = hello.client_version_.minor_; + + // Random + output.write(hello.random_, RAN_LEN); + + // Session + output[AUTO] = hello.id_len_; + if (hello.id_len_) output.write(hello.session_id_, ID_LEN); + + // Suites + byte tmp[2]; + c16toa(hello.suite_len_, tmp); + output[AUTO] = tmp[0]; + output[AUTO] = tmp[1]; + output.write(hello.cipher_suites_, hello.suite_len_); + + // Compression + output[AUTO] = hello.comp_len_; + output[AUTO] = hello.compression_methods_; + + return output; +} + + +// Client Hello processing handler +void ClientHello::Process(input_buffer&, SSL& ssl) +{ + // store version for pre master secret + ssl.useSecurity().use_connection().chVersion_ = client_version_; + + if (client_version_.major_ != 3) { + ssl.SetError(badVersion_error); + return; + } + if (ssl.GetMultiProtocol()) { // SSLv23 support + if (ssl.isTLS() && client_version_.minor_ < 1) { + // downgrade to SSLv3 + ssl.useSecurity().use_connection().TurnOffTLS(); + ProtocolVersion pv = ssl.getSecurity().get_connection().version_; + bool removeDH = ssl.getSecurity().get_parms().removeDH_; + bool removeRSA = false; + bool removeDSA = false; + + const CertManager& cm = ssl.getCrypto().get_certManager(); + if (cm.get_keyType() == rsa_sa_algo) + removeDSA = true; + else + removeRSA = true; + + // reset w/ SSL suites + ssl.useSecurity().use_parms().SetSuites(pv, removeDH, removeRSA, + removeDSA); + } + else if (ssl.isTLSv1_1() && client_version_.minor_ == 1) + // downgrade to TLSv1, but use same suites + ssl.useSecurity().use_connection().TurnOffTLS1_1(); + } + else if (ssl.isTLSv1_1() && client_version_.minor_ < 2) { + ssl.SetError(badVersion_error); + return; + } + else if (ssl.isTLS() && client_version_.minor_ < 1) { + ssl.SetError(badVersion_error); + return; + } + else if (!ssl.isTLS() && client_version_.minor_ >= 1) { + ssl.SetError(badVersion_error); + return; + } + + ssl.set_random(random_, client_end); + + while (id_len_) { // trying to resume + SSL_SESSION* session = 0; + if (!ssl.getSecurity().GetContext()->GetSessionCacheOff()) + session = GetSessions().lookup(session_id_); + if (!session) { + ssl.useLog().Trace("session lookup failed"); + break; + } + ssl.set_session(session); + ssl.useSecurity().set_resuming(true); + ssl.matchSuite(session->GetSuite(), SUITE_LEN); + ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]); + ssl.set_masterSecret(session->GetSecret()); + + opaque serverRandom[RAN_LEN]; + ssl.getCrypto().get_random().Fill(serverRandom, sizeof(serverRandom)); + ssl.set_random(serverRandom, server_end); + if (ssl.isTLS()) + ssl.deriveTLSKeys(); + else + ssl.deriveKeys(); + ssl.useStates().useServer() = clientKeyExchangeComplete; + return; + } + ssl.matchSuite(cipher_suites_, suite_len_); + if (ssl.GetError()) return; + ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]); + + if (compression_methods_ == zlib) + ssl.SetCompression(); + + ssl.useStates().useServer() = clientHelloComplete; +} + + +input_buffer& ClientHello::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& ClientHello::get(output_buffer& out) const +{ + return out << *this; +} + + +HandShakeType ClientHello::get_type() const +{ + return client_hello; +} + + +const opaque* ClientHello::get_random() const +{ + return random_; +} + + +ClientHello::ClientHello() +{ + memset(random_, 0, RAN_LEN); +} + + +ClientHello::ClientHello(ProtocolVersion pv, bool useCompression) + : client_version_(pv), + compression_methods_(useCompression ? zlib : no_compression) +{ + memset(random_, 0, RAN_LEN); +} + + +// output operator for ServerKeyExchange +output_buffer& operator<<(output_buffer& output, const ServerKeyExchange& sk) +{ + output.write(sk.getKey(), sk.getKeyLength()); + return output; +} + + +// Server Key Exchange processing handler +void ServerKeyExchange::Process(input_buffer& input, SSL& ssl) +{ + createKey(ssl); + if (ssl.GetError()) return; + server_key_->read(ssl, input); + + ssl.useStates().useClient() = serverKeyExchangeComplete; +} + + +ServerKeyExchange::ServerKeyExchange(SSL& ssl) +{ + createKey(ssl); +} + + +ServerKeyExchange::ServerKeyExchange() + : server_key_(0) +{} + + +ServerKeyExchange::~ServerKeyExchange() +{ + ysDelete(server_key_); +} + + +void ServerKeyExchange::build(SSL& ssl) +{ + server_key_->build(ssl); + set_length(server_key_->get_length()); +} + + +const opaque* ServerKeyExchange::getKey() const +{ + return server_key_->get_serverKey(); +} + + +int ServerKeyExchange::getKeyLength() const +{ + return server_key_->get_length(); +} + + +input_buffer& ServerKeyExchange::set(input_buffer& in) +{ + return in; // process does +} + + +output_buffer& ServerKeyExchange::get(output_buffer& out) const +{ + return out << *this; +} + + +HandShakeType ServerKeyExchange::get_type() const +{ + return server_key_exchange; +} + + +// CertificateRequest +CertificateRequest::CertificateRequest() + : typeTotal_(0) +{ + memset(certificate_types_, 0, sizeof(certificate_types_)); +} + + +CertificateRequest::~CertificateRequest() +{ + + STL::for_each(certificate_authorities_.begin(), + certificate_authorities_.end(), + del_ptr_zero()) ; +} + + +void CertificateRequest::Build() +{ + certificate_types_[0] = rsa_sign; + certificate_types_[1] = dss_sign; + + typeTotal_ = 2; + + uint16 authCount = 0; + uint16 authSz = 0; + + for (int j = 0; j < authCount; j++) { + int sz = REQUEST_HEADER + MIN_DIS_SIZE; + DistinguishedName dn; + certificate_authorities_.push_back(dn = NEW_YS byte[sz]); + + opaque tmp[REQUEST_HEADER]; + c16toa(MIN_DIS_SIZE, tmp); + memcpy(dn, tmp, sizeof(tmp)); + + // fill w/ junk for now + memcpy(dn, tmp, MIN_DIS_SIZE); + authSz += sz; + } + + set_length(SIZEOF_ENUM + typeTotal_ + REQUEST_HEADER + authSz); +} + + +input_buffer& CertificateRequest::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& CertificateRequest::get(output_buffer& out) const +{ + return out << *this; +} + + +// input operator for CertificateRequest +input_buffer& operator>>(input_buffer& input, CertificateRequest& request) +{ + // types + request.typeTotal_ = input[AUTO]; + for (int i = 0; i < request.typeTotal_; i++) + request.certificate_types_[i] = ClientCertificateType(input[AUTO]); + + byte tmp[REQUEST_HEADER]; + input.read(tmp, sizeof(tmp)); + uint16 sz; + ato16(tmp, sz); + + // authorities + while (sz) { + uint16 dnSz; + input.read(tmp, sizeof(tmp)); + ato16(tmp, dnSz); + + DistinguishedName dn; + request.certificate_authorities_.push_back(dn = NEW_YS + byte[REQUEST_HEADER + dnSz]); + memcpy(dn, tmp, REQUEST_HEADER); + input.read(&dn[REQUEST_HEADER], dnSz); + + sz -= dnSz + REQUEST_HEADER; + } + + return input; +} + + +// output operator for CertificateRequest +output_buffer& operator<<(output_buffer& output, + const CertificateRequest& request) +{ + // types + output[AUTO] = request.typeTotal_; + for (int i = 0; i < request.typeTotal_; i++) + output[AUTO] = request.certificate_types_[i]; + + // authorities + opaque tmp[REQUEST_HEADER]; + c16toa(request.get_length() - SIZEOF_ENUM - + request.typeTotal_ - REQUEST_HEADER, tmp); + output.write(tmp, sizeof(tmp)); + + STL::list::const_iterator first = + request.certificate_authorities_.begin(); + STL::list::const_iterator last = + request.certificate_authorities_.end(); + while (first != last) { + uint16 sz; + ato16(*first, sz); + output.write(*first, sz + REQUEST_HEADER); + + ++first; + } + + return output; +} + + +// CertificateRequest processing handler +void CertificateRequest::Process(input_buffer&, SSL& ssl) +{ + CertManager& cm = ssl.useCrypto().use_certManager(); + + // make sure user provided cert and key before sending and using + if (cm.get_cert() && cm.get_privateKey()) + cm.setSendVerify(); +} + + +HandShakeType CertificateRequest::get_type() const +{ + return certificate_request; +} + + +// CertificateVerify +CertificateVerify::CertificateVerify() : signature_(0) +{} + + +CertificateVerify::~CertificateVerify() +{ + ysArrayDelete(signature_); +} + + +void CertificateVerify::Build(SSL& ssl) +{ + build_certHashes(ssl, hashes_); + + uint16 sz = 0; + byte len[VERIFY_HEADER]; + mySTL::auto_array sig; + + // sign + const CertManager& cert = ssl.getCrypto().get_certManager(); + if (cert.get_keyType() == rsa_sa_algo) { + RSA rsa(cert.get_privateKey(), cert.get_privateKeyLength(), false); + + sz = rsa.get_cipherLength() + VERIFY_HEADER; + sig.reset(NEW_YS byte[sz]); + + c16toa(sz - VERIFY_HEADER, len); + memcpy(sig.get(), len, VERIFY_HEADER); + rsa.sign(sig.get() + VERIFY_HEADER, hashes_.md5_, sizeof(Hashes), + ssl.getCrypto().get_random()); + } + else { // DSA + DSS dss(cert.get_privateKey(), cert.get_privateKeyLength(), false); + + sz = DSS_SIG_SZ + DSS_ENCODED_EXTRA + VERIFY_HEADER; + sig.reset(NEW_YS byte[sz]); + + c16toa(sz - VERIFY_HEADER, len); + memcpy(sig.get(), len, VERIFY_HEADER); + dss.sign(sig.get() + VERIFY_HEADER, hashes_.sha_, SHA_LEN, + ssl.getCrypto().get_random()); + + byte encoded[DSS_SIG_SZ + DSS_ENCODED_EXTRA]; + TaoCrypt::EncodeDSA_Signature(sig.get() + VERIFY_HEADER, encoded); + memcpy(sig.get() + VERIFY_HEADER, encoded, sizeof(encoded)); + } + set_length(sz); + signature_ = sig.release(); +} + + +input_buffer& CertificateVerify::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& CertificateVerify::get(output_buffer& out) const +{ + return out << *this; +} + + +// input operator for CertificateVerify +input_buffer& operator>>(input_buffer& input, CertificateVerify& request) +{ + byte tmp[VERIFY_HEADER]; + input.read(tmp, sizeof(tmp)); + + uint16 sz = 0; + ato16(tmp, sz); + request.set_length(sz); + + request.signature_ = NEW_YS byte[sz]; + input.read(request.signature_, sz); + + return input; +} + + +// output operator for CertificateVerify +output_buffer& operator<<(output_buffer& output, + const CertificateVerify& verify) +{ + output.write(verify.signature_, verify.get_length()); + + return output; +} + + +// CertificateVerify processing handler +void CertificateVerify::Process(input_buffer&, SSL& ssl) +{ + const Hashes& hashVerify = ssl.getHashes().get_certVerify(); + const CertManager& cert = ssl.getCrypto().get_certManager(); + + if (cert.get_peerKeyType() == rsa_sa_algo) { + RSA rsa(cert.get_peerKey(), cert.get_peerKeyLength()); + + if (!rsa.verify(hashVerify.md5_, sizeof(hashVerify), signature_, + get_length())) + ssl.SetError(verify_error); + } + else { // DSA + byte decodedSig[DSS_SIG_SZ]; + TaoCrypt::DecodeDSA_Signature(decodedSig, signature_, get_length()); + + DSS dss(cert.get_peerKey(), cert.get_peerKeyLength()); + if (!dss.verify(hashVerify.sha_, SHA_LEN, decodedSig, get_length())) + ssl.SetError(verify_error); + } +} + + +HandShakeType CertificateVerify::get_type() const +{ + return certificate_verify; +} + + +// output operator for ClientKeyExchange +output_buffer& operator<<(output_buffer& output, const ClientKeyExchange& ck) +{ + output.write(ck.getKey(), ck.getKeyLength()); + return output; +} + + +// Client Key Exchange processing handler +void ClientKeyExchange::Process(input_buffer& input, SSL& ssl) +{ + createKey(ssl); + if (ssl.GetError()) return; + client_key_->read(ssl, input); + + if (ssl.getCrypto().get_certManager().verifyPeer()) + build_certHashes(ssl, ssl.useHashes().use_certVerify()); + + ssl.useStates().useServer() = clientKeyExchangeComplete; +} + + +ClientKeyExchange::ClientKeyExchange(SSL& ssl) +{ + createKey(ssl); +} + + +ClientKeyExchange::ClientKeyExchange() + : client_key_(0) +{} + + +ClientKeyExchange::~ClientKeyExchange() +{ + ysDelete(client_key_); +} + + +void ClientKeyExchange::build(SSL& ssl) +{ + client_key_->build(ssl); + set_length(client_key_->get_length()); +} + +const opaque* ClientKeyExchange::getKey() const +{ + return client_key_->get_clientKey(); +} + + +int ClientKeyExchange::getKeyLength() const +{ + return client_key_->get_length(); +} + + +input_buffer& ClientKeyExchange::set(input_buffer& in) +{ + return in; +} + + +output_buffer& ClientKeyExchange::get(output_buffer& out) const +{ + return out << *this; +} + + +HandShakeType ClientKeyExchange::get_type() const +{ + return client_key_exchange; +} + + +// input operator for Finished +input_buffer& operator>>(input_buffer& input, Finished&) +{ + /* do in process */ + + return input; +} + +// output operator for Finished +output_buffer& operator<<(output_buffer& output, const Finished& fin) +{ + if (fin.get_length() == FINISHED_SZ) { + output.write(fin.hashes_.md5_, MD5_LEN); + output.write(fin.hashes_.sha_, SHA_LEN); + } + else // TLS_FINISHED_SZ + output.write(fin.hashes_.md5_, TLS_FINISHED_SZ); + + return output; +} + + +// Finished processing handler +void Finished::Process(input_buffer& input, SSL& ssl) +{ + // verify hashes + const Finished& verify = ssl.getHashes().get_verify(); + uint finishedSz = ssl.isTLS() ? TLS_FINISHED_SZ : FINISHED_SZ; + + input.read(hashes_.md5_, finishedSz); + + if (memcmp(&hashes_, &verify.hashes_, finishedSz)) { + ssl.SetError(verify_error); + return; + } + + // read verify mac + opaque verifyMAC[SHA_LEN]; + uint macSz = finishedSz + HANDSHAKE_HEADER; + + if (ssl.isTLS()) + TLS_hmac(ssl, verifyMAC, input.get_buffer() + input.get_current() + - macSz, macSz, handshake, true); + else + hmac(ssl, verifyMAC, input.get_buffer() + input.get_current() - macSz, + macSz, handshake, true); + + // read mac and fill + opaque mac[SHA_LEN]; // max size + int digestSz = ssl.getCrypto().get_digest().get_digestSize(); + input.read(mac, digestSz); + + uint ivExtra = 0; + if (ssl.getSecurity().get_parms().cipher_type_ == block) + if (ssl.isTLSv1_1()) + ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); + + opaque fill; + int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - + HANDSHAKE_HEADER - finishedSz - digestSz; + for (int i = 0; i < padSz; i++) + fill = input[AUTO]; + + // verify mac + if (memcmp(mac, verifyMAC, digestSz)) { + ssl.SetError(verify_error); + return; + } + + // update states + ssl.useStates().useHandShake() = handShakeReady; + if (ssl.getSecurity().get_parms().entity_ == client_end) + ssl.useStates().useClient() = serverFinishedComplete; + else + ssl.useStates().useServer() = clientFinishedComplete; +} + + +Finished::Finished() +{ + set_length(FINISHED_SZ); +} + + +uint8* Finished::set_md5() +{ + return hashes_.md5_; +} + + +uint8* Finished::set_sha() +{ + return hashes_.sha_; +} + + +input_buffer& Finished::set(input_buffer& in) +{ + return in >> *this; +} + + +output_buffer& Finished::get(output_buffer& out) const +{ + return out << *this; +} + + +HandShakeType Finished::get_type() const +{ + return finished; +} + + +void clean(volatile opaque* p, uint sz, RandomPool& ran) +{ + uint i(0); + + for (i = 0; i < sz; ++i) + p[i] = 0; + + ran.Fill(const_cast(p), sz); + + for (i = 0; i < sz; ++i) + p[i] = 0; +} + + + +Connection::Connection(ProtocolVersion v, RandomPool& ran) + : pre_master_secret_(0), sequence_number_(0), peer_sequence_number_(0), + pre_secret_len_(0), send_server_key_(false), master_clean_(false), + TLS_(v.major_ >= 3 && v.minor_ >= 1), + TLSv1_1_(v.major_ >= 3 && v.minor_ >= 2), compression_(false), + version_(v), random_(ran) +{ + memset(sessionID_, 0, sizeof(sessionID_)); +} + + +Connection::~Connection() +{ + CleanMaster(); CleanPreMaster(); ysArrayDelete(pre_master_secret_); +} + + +void Connection::AllocPreSecret(uint sz) +{ + pre_master_secret_ = NEW_YS opaque[pre_secret_len_ = sz]; +} + + +void Connection::TurnOffTLS() +{ + TLS_ = false; + version_.minor_ = 0; +} + + +void Connection::TurnOffTLS1_1() +{ + TLSv1_1_ = false; + version_.minor_ = 1; +} + + +// wipeout master secret +void Connection::CleanMaster() +{ + if (!master_clean_) { + volatile opaque* p = master_secret_; + clean(p, SECRET_LEN, random_); + master_clean_ = true; + } +} + + +// wipeout pre master secret +void Connection::CleanPreMaster() +{ + if (pre_master_secret_) { + volatile opaque* p = pre_master_secret_; + clean(p, pre_secret_len_, random_); + + ysArrayDelete(pre_master_secret_); + pre_master_secret_ = 0; + } +} + + +// Create functions for message factory +Message* CreateCipherSpec() { return NEW_YS ChangeCipherSpec; } +Message* CreateAlert() { return NEW_YS Alert; } +Message* CreateHandShake() { return NEW_YS HandShakeHeader; } +Message* CreateData() { return NEW_YS Data; } + +// Create functions for handshake factory +HandShakeBase* CreateHelloRequest() { return NEW_YS HelloRequest; } +HandShakeBase* CreateClientHello() { return NEW_YS ClientHello; } +HandShakeBase* CreateServerHello() { return NEW_YS ServerHello; } +HandShakeBase* CreateCertificate() { return NEW_YS Certificate; } +HandShakeBase* CreateServerKeyExchange() { return NEW_YS ServerKeyExchange;} +HandShakeBase* CreateCertificateRequest() { return NEW_YS + CertificateRequest; } +HandShakeBase* CreateServerHelloDone() { return NEW_YS ServerHelloDone; } +HandShakeBase* CreateCertificateVerify() { return NEW_YS CertificateVerify;} +HandShakeBase* CreateClientKeyExchange() { return NEW_YS ClientKeyExchange;} +HandShakeBase* CreateFinished() { return NEW_YS Finished; } + +// Create functions for server key exchange factory +ServerKeyBase* CreateRSAServerKEA() { return NEW_YS RSA_Server; } +ServerKeyBase* CreateDHServerKEA() { return NEW_YS DH_Server; } +ServerKeyBase* CreateFortezzaServerKEA() { return NEW_YS Fortezza_Server; } + +// Create functions for client key exchange factory +ClientKeyBase* CreateRSAClient() { return NEW_YS + EncryptedPreMasterSecret; } +ClientKeyBase* CreateDHClient() { return NEW_YS + ClientDiffieHellmanPublic; } +ClientKeyBase* CreateFortezzaClient() { return NEW_YS FortezzaKeys; } + + +// Constructor calls this to Register compile time callbacks +void InitMessageFactory(MessageFactory& mf) +{ + mf.Reserve(4); + mf.Register(alert, CreateAlert); + mf.Register(change_cipher_spec, CreateCipherSpec); + mf.Register(handshake, CreateHandShake); + mf.Register(application_data, CreateData); +} + + +// Constructor calls this to Register compile time callbacks +void InitHandShakeFactory(HandShakeFactory& hsf) +{ + hsf.Reserve(10); + hsf.Register(hello_request, CreateHelloRequest); + hsf.Register(client_hello, CreateClientHello); + hsf.Register(server_hello, CreateServerHello); + hsf.Register(certificate, CreateCertificate); + hsf.Register(server_key_exchange, CreateServerKeyExchange); + hsf.Register(certificate_request, CreateCertificateRequest); + hsf.Register(server_hello_done, CreateServerHelloDone); + hsf.Register(certificate_verify, CreateCertificateVerify); + hsf.Register(client_key_exchange, CreateClientKeyExchange); + hsf.Register(finished, CreateFinished); +} + + +// Constructor calls this to Register compile time callbacks +void InitServerKeyFactory(ServerKeyFactory& skf) +{ + skf.Reserve(3); + skf.Register(rsa_kea, CreateRSAServerKEA); + skf.Register(diffie_hellman_kea, CreateDHServerKEA); + skf.Register(fortezza_kea, CreateFortezzaServerKEA); +} + + +// Constructor calls this to Register compile time callbacks +void InitClientKeyFactory(ClientKeyFactory& ckf) +{ + ckf.Reserve(3); + ckf.Register(rsa_kea, CreateRSAClient); + ckf.Register(diffie_hellman_kea, CreateDHClient); + ckf.Register(fortezza_kea, CreateFortezzaClient); +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/src/yassl_int.cpp b/externals/mysql/extlib/yassl/src/yassl_int.cpp new file mode 100644 index 0000000..b7f91d7 --- /dev/null +++ b/externals/mysql/extlib/yassl/src/yassl_int.cpp @@ -0,0 +1,2580 @@ +/* + Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* yaSSL internal source implements SSL supporting types not specified in the + * draft along with type conversion functions. + */ + +#include "runtime.hpp" +#include "yassl_int.hpp" +#include "handshake.hpp" +#include "timer.hpp" + +#ifdef _POSIX_THREADS + #include "pthread.h" +#endif + + +#ifdef HAVE_LIBZ + #include "zlib.h" +#endif + + +#ifdef YASSL_PURE_C + + void* operator new(size_t sz, yaSSL::new_t) + { + void* ptr = malloc(sz ? sz : 1); + if (!ptr) abort(); + + return ptr; + } + + + void operator delete(void* ptr, yaSSL::new_t) + { + if (ptr) free(ptr); + } + + + void* operator new[](size_t sz, yaSSL::new_t nt) + { + return ::operator new(sz, nt); + } + + + void operator delete[](void* ptr, yaSSL::new_t nt) + { + ::operator delete(ptr, nt); + } + + namespace yaSSL { + + new_t ys; // for yaSSL library new + + } + +#endif // YASSL_PURE_C + + +namespace yaSSL { + + + + + + +// convert a 32 bit integer into a 24 bit one +void c32to24(uint32 u32, uint24& u24) +{ + u24[0] = (u32 >> 16) & 0xff; + u24[1] = (u32 >> 8) & 0xff; + u24[2] = u32 & 0xff; +} + + +// convert a 24 bit integer into a 32 bit one +void c24to32(const uint24 u24, uint32& u32) +{ + u32 = 0; + u32 = (u24[0] << 16) | (u24[1] << 8) | u24[2]; +} + + +// convert with return for ease of use +uint32 c24to32(const uint24 u24) +{ + uint32 ret; + c24to32(u24, ret); + + return ret; +} + + +// using a for opaque since underlying type is unsgined char and o is not a +// good leading identifier + +// convert opaque to 16 bit integer +void ato16(const opaque* c, uint16& u16) +{ + u16 = 0; + u16 = (c[0] << 8) | (c[1]); +} + + +// convert (copy) opaque to 24 bit integer +void ato24(const opaque* c, uint24& u24) +{ + u24[0] = c[0]; + u24[1] = c[1]; + u24[2] = c[2]; +} + + +// convert 16 bit integer to opaque +void c16toa(uint16 u16, opaque* c) +{ + c[0] = (u16 >> 8) & 0xff; + c[1] = u16 & 0xff; +} + + +// convert 24 bit integer to opaque +void c24toa(const uint24 u24, opaque* c) +{ + c[0] = u24[0]; + c[1] = u24[1]; + c[2] = u24[2]; +} + + +// convert 32 bit integer to opaque +void c32toa(uint32 u32, opaque* c) +{ + c[0] = (u32 >> 24) & 0xff; + c[1] = (u32 >> 16) & 0xff; + c[2] = (u32 >> 8) & 0xff; + c[3] = u32 & 0xff; +} + + +States::States() : recordLayer_(recordReady), handshakeLayer_(preHandshake), + clientState_(serverNull), serverState_(clientNull), + connectState_(CONNECT_BEGIN), acceptState_(ACCEPT_BEGIN), + what_(no_error) {} + +const RecordLayerState& States::getRecord() const +{ + return recordLayer_; +} + + +const HandShakeState& States::getHandShake() const +{ + return handshakeLayer_; +} + + +const ClientState& States::getClient() const +{ + return clientState_; +} + + +const ServerState& States::getServer() const +{ + return serverState_; +} + + +const ConnectState& States::GetConnect() const +{ + return connectState_; +} + + +const AcceptState& States::GetAccept() const +{ + return acceptState_; +} + + +const char* States::getString() const +{ + return errorString_; +} + + +YasslError States::What() const +{ + return what_; +} + + +RecordLayerState& States::useRecord() +{ + return recordLayer_; +} + + +HandShakeState& States::useHandShake() +{ + return handshakeLayer_; +} + + +ClientState& States::useClient() +{ + return clientState_; +} + + +ServerState& States::useServer() +{ + return serverState_; +} + + +ConnectState& States::UseConnect() +{ + return connectState_; +} + + +AcceptState& States::UseAccept() +{ + return acceptState_; +} + + +char* States::useString() +{ + return errorString_; +} + + +void States::SetError(YasslError ye) +{ + what_ = ye; +} + + +sslFactory::sslFactory() : + messageFactory_(InitMessageFactory), + handShakeFactory_(InitHandShakeFactory), + serverKeyFactory_(InitServerKeyFactory), + clientKeyFactory_(InitClientKeyFactory) +{} + + +const MessageFactory& sslFactory::getMessage() const +{ + return messageFactory_; +} + + +const HandShakeFactory& sslFactory::getHandShake() const +{ + return handShakeFactory_; +} + + +const ServerKeyFactory& sslFactory::getServerKey() const +{ + return serverKeyFactory_; +} + + +const ClientKeyFactory& sslFactory::getClientKey() const +{ + return clientKeyFactory_; +} + + +// extract context parameters and store +SSL::SSL(SSL_CTX* ctx) + : secure_(ctx->getMethod()->getVersion(), crypto_.use_random(), + ctx->getMethod()->getSide(), ctx->GetCiphers(), ctx, + ctx->GetDH_Parms().set_), quietShutdown_(false), has_data_(false) +{ + if (int err = crypto_.get_random().GetError()) { + SetError(YasslError(err)); + return; + } + + CertManager& cm = crypto_.use_certManager(); + cm.CopySelfCert(ctx->getCert()); + + bool serverSide = secure_.use_parms().entity_ == server_end; + + if (ctx->getKey()) { + if (int err = cm.SetPrivateKey(*ctx->getKey())) { + SetError(YasslError(err)); + return; + } + else if (serverSide) { + // remove RSA or DSA suites depending on cert key type + ProtocolVersion pv = secure_.get_connection().version_; + + bool removeDH = secure_.use_parms().removeDH_; + bool removeRSA = false; + bool removeDSA = false; + + if (cm.get_keyType() == rsa_sa_algo) + removeDSA = true; + else + removeRSA = true; + secure_.use_parms().SetSuites(pv, removeDH, removeRSA, removeDSA); + } + } + else if (serverSide) { + SetError(no_key_file); + return; + } + + if (ctx->getMethod()->verifyPeer()) + cm.setVerifyPeer(); + if (ctx->getMethod()->verifyNone()) + cm.setVerifyNone(); + if (ctx->getMethod()->failNoCert()) + cm.setFailNoCert(); + cm.setVerifyCallback(ctx->getVerifyCallback()); + + if (serverSide) + crypto_.SetDH(ctx->GetDH_Parms()); + + const SSL_CTX::CertList& ca = ctx->GetCA_List(); + SSL_CTX::CertList::const_iterator first(ca.begin()); + SSL_CTX::CertList::const_iterator last(ca.end()); + + while (first != last) { + if (int err = cm.CopyCaCert(*first)) { + SetError(YasslError(err)); + return; + } + ++first; + } +} + + +// store pending security parameters from Server Hello +void SSL::set_pending(Cipher suite) +{ + Parameters& parms = secure_.use_parms(); + + switch (suite) { + + case TLS_RSA_WITH_AES_256_CBC_SHA: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = sha; + parms.kea_ = rsa_kea; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = AES_256_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); + strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_256_CBC_SHA], + MAX_SUITE_NAME); + break; + + case TLS_RSA_WITH_AES_128_CBC_SHA: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = sha; + parms.kea_ = rsa_kea; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = AES_128_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS AES); + strncpy(parms.cipher_name_, cipher_names[TLS_RSA_WITH_AES_128_CBC_SHA], + MAX_SUITE_NAME); + break; + + case SSL_RSA_WITH_3DES_EDE_CBC_SHA: + parms.bulk_cipher_algorithm_ = triple_des; + parms.mac_algorithm_ = sha; + parms.kea_ = rsa_kea; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = DES_EDE_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS DES_EDE); + strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_3DES_EDE_CBC_SHA] + , MAX_SUITE_NAME); + break; + + case SSL_RSA_WITH_DES_CBC_SHA: + parms.bulk_cipher_algorithm_ = des; + parms.mac_algorithm_ = sha; + parms.kea_ = rsa_kea; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = DES_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS DES); + strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_DES_CBC_SHA], + MAX_SUITE_NAME); + break; + + case SSL_RSA_WITH_RC4_128_SHA: + parms.bulk_cipher_algorithm_ = rc4; + parms.mac_algorithm_ = sha; + parms.kea_ = rsa_kea; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = RC4_KEY_SZ; + parms.iv_size_ = 0; + parms.cipher_type_ = stream; + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS RC4); + strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_SHA], + MAX_SUITE_NAME); + break; + + case SSL_RSA_WITH_RC4_128_MD5: + parms.bulk_cipher_algorithm_ = rc4; + parms.mac_algorithm_ = md5; + parms.kea_ = rsa_kea; + parms.hash_size_ = MD5_LEN; + parms.key_size_ = RC4_KEY_SZ; + parms.iv_size_ = 0; + parms.cipher_type_ = stream; + crypto_.setDigest(NEW_YS MD5); + crypto_.setCipher(NEW_YS RC4); + strncpy(parms.cipher_name_, cipher_names[SSL_RSA_WITH_RC4_128_MD5], + MAX_SUITE_NAME); + break; + + case SSL_DHE_RSA_WITH_DES_CBC_SHA: + parms.bulk_cipher_algorithm_ = des; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = rsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = DES_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS DES); + strncpy(parms.cipher_name_, cipher_names[SSL_DHE_RSA_WITH_DES_CBC_SHA], + MAX_SUITE_NAME); + break; + + case SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA: + parms.bulk_cipher_algorithm_ = triple_des; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = rsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = DES_EDE_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS DES_EDE); + strncpy(parms.cipher_name_, + cipher_names[SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); + break; + + case TLS_DHE_RSA_WITH_AES_256_CBC_SHA: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = rsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = AES_256_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); + break; + + case TLS_DHE_RSA_WITH_AES_128_CBC_SHA: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = rsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = AES_128_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS AES); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); + break; + + case SSL_DHE_DSS_WITH_DES_CBC_SHA: + parms.bulk_cipher_algorithm_ = des; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = dsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = DES_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS DES); + strncpy(parms.cipher_name_, cipher_names[SSL_DHE_DSS_WITH_DES_CBC_SHA], + MAX_SUITE_NAME); + break; + + case SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA: + parms.bulk_cipher_algorithm_ = triple_des; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = dsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = DES_EDE_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS DES_EDE); + strncpy(parms.cipher_name_, + cipher_names[SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA], MAX_SUITE_NAME); + break; + + case TLS_DHE_DSS_WITH_AES_256_CBC_SHA: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = dsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = AES_256_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_SHA], MAX_SUITE_NAME); + break; + + case TLS_DHE_DSS_WITH_AES_128_CBC_SHA: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = sha; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = dsa_sa_algo; + parms.hash_size_ = SHA_LEN; + parms.key_size_ = AES_128_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS SHA); + crypto_.setCipher(NEW_YS AES); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_SHA], MAX_SUITE_NAME); + break; + + case TLS_RSA_WITH_AES_256_CBC_RMD160: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = rmd; + parms.kea_ = rsa_kea; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = AES_256_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); + strncpy(parms.cipher_name_, + cipher_names[TLS_RSA_WITH_AES_256_CBC_RMD160], MAX_SUITE_NAME); + break; + + case TLS_RSA_WITH_AES_128_CBC_RMD160: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = rmd; + parms.kea_ = rsa_kea; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = AES_128_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS AES); + strncpy(parms.cipher_name_, + cipher_names[TLS_RSA_WITH_AES_128_CBC_RMD160], MAX_SUITE_NAME); + break; + + case TLS_RSA_WITH_3DES_EDE_CBC_RMD160: + parms.bulk_cipher_algorithm_ = triple_des; + parms.mac_algorithm_ = rmd; + parms.kea_ = rsa_kea; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = DES_EDE_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS DES_EDE); + strncpy(parms.cipher_name_, + cipher_names[TLS_RSA_WITH_3DES_EDE_CBC_RMD160], MAX_SUITE_NAME); + break; + + case TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160: + parms.bulk_cipher_algorithm_ = triple_des; + parms.mac_algorithm_ = rmd; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = rsa_sa_algo; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = DES_EDE_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS DES_EDE); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160], + MAX_SUITE_NAME); + break; + + case TLS_DHE_RSA_WITH_AES_256_CBC_RMD160: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = rmd; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = rsa_sa_algo; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = AES_256_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_RSA_WITH_AES_256_CBC_RMD160], + MAX_SUITE_NAME); + break; + + case TLS_DHE_RSA_WITH_AES_128_CBC_RMD160: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = rmd; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = rsa_sa_algo; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = AES_128_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS AES); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_RSA_WITH_AES_128_CBC_RMD160], + MAX_SUITE_NAME); + break; + + case TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160: + parms.bulk_cipher_algorithm_ = triple_des; + parms.mac_algorithm_ = rmd; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = dsa_sa_algo; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = DES_EDE_KEY_SZ; + parms.iv_size_ = DES_IV_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS DES_EDE); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160], + MAX_SUITE_NAME); + break; + + case TLS_DHE_DSS_WITH_AES_256_CBC_RMD160: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = rmd; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = dsa_sa_algo; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = AES_256_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS AES(AES_256_KEY_SZ)); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_DSS_WITH_AES_256_CBC_RMD160], + MAX_SUITE_NAME); + break; + + case TLS_DHE_DSS_WITH_AES_128_CBC_RMD160: + parms.bulk_cipher_algorithm_ = aes; + parms.mac_algorithm_ = rmd; + parms.kea_ = diffie_hellman_kea; + parms.sig_algo_ = dsa_sa_algo; + parms.hash_size_ = RMD_LEN; + parms.key_size_ = AES_128_KEY_SZ; + parms.iv_size_ = AES_BLOCK_SZ; + parms.cipher_type_ = block; + secure_.use_connection().send_server_key_ = true; // eph + crypto_.setDigest(NEW_YS RMD); + crypto_.setCipher(NEW_YS AES); + strncpy(parms.cipher_name_, + cipher_names[TLS_DHE_DSS_WITH_AES_128_CBC_RMD160], + MAX_SUITE_NAME); + break; + + default: + SetError(unknown_cipher); + } +} + + +// store peer's random +void SSL::set_random(const opaque* random, ConnectionEnd sender) +{ + if (sender == client_end) + memcpy(secure_.use_connection().client_random_, random, RAN_LEN); + else + memcpy(secure_.use_connection().server_random_, random, RAN_LEN); +} + + +// store client pre master secret +void SSL::set_preMaster(const opaque* pre, uint sz) +{ + secure_.use_connection().AllocPreSecret(sz); + memcpy(secure_.use_connection().pre_master_secret_, pre, sz); +} + + +// set yaSSL zlib type compression +int SSL::SetCompression() +{ +#ifdef HAVE_LIBZ + secure_.use_connection().compression_ = true; + return 0; +#else + return -1; // not built in +#endif +} + + +// unset yaSSL zlib type compression +void SSL::UnSetCompression() +{ + secure_.use_connection().compression_ = false; +} + + +// is yaSSL zlib compression on +bool SSL::CompressionOn() const +{ + return secure_.get_connection().compression_; +} + + +// store master secret +void SSL::set_masterSecret(const opaque* sec) +{ + memcpy(secure_.use_connection().master_secret_, sec, SECRET_LEN); +} + +// store server issued id +void SSL::set_sessionID(const opaque* sessionID) +{ + memcpy(secure_.use_connection().sessionID_, sessionID, ID_LEN); + secure_.use_connection().sessionID_Set_ = true; +} + + +// store error +void SSL::SetError(YasslError ye) +{ + states_.SetError(ye); + //strncpy(states_.useString(), e.what(), mySTL::named_exception::NAME_SIZE); + // TODO: add string here +} + + +// set the quiet shutdown mode (close_nofiy not sent or received on shutdown) +void SSL::SetQuietShutdown(bool mode) +{ + quietShutdown_ = mode; +} + + +Buffers& SSL::useBuffers() +{ + return buffers_; +} + + +// locals +namespace { + +// DeriveKeys and MasterSecret helper sets prefix letters +static bool setPrefix(opaque* sha_input, int i) +{ + switch (i) { + case 0: + memcpy(sha_input, "A", 1); + break; + case 1: + memcpy(sha_input, "BB", 2); + break; + case 2: + memcpy(sha_input, "CCC", 3); + break; + case 3: + memcpy(sha_input, "DDDD", 4); + break; + case 4: + memcpy(sha_input, "EEEEE", 5); + break; + case 5: + memcpy(sha_input, "FFFFFF", 6); + break; + case 6: + memcpy(sha_input, "GGGGGGG", 7); + break; + default: + return false; // prefix_error + } + return true; +} + + +const char handshake_order[] = "Out of order HandShake Message!"; + + +} // namespcae for locals + + +void SSL::order_error() +{ + SetError(out_of_order); +} + + +// Create and store the master secret see page 32, 6.1 +void SSL::makeMasterSecret() +{ + if (isTLS()) + makeTLSMasterSecret(); + else { + opaque sha_output[SHA_LEN]; + + const uint& preSz = secure_.get_connection().pre_secret_len_; + output_buffer md5_input(preSz + SHA_LEN); + output_buffer sha_input(PREFIX + preSz + 2 * RAN_LEN); + + MD5 md5; + SHA sha; + + md5_input.write(secure_.get_connection().pre_master_secret_, preSz); + + for (int i = 0; i < MASTER_ROUNDS; ++i) { + opaque prefix[PREFIX]; + if (!setPrefix(prefix, i)) { + SetError(prefix_error); + return; + } + + sha_input.set_current(0); + sha_input.write(prefix, i + 1); + + sha_input.write(secure_.get_connection().pre_master_secret_,preSz); + sha_input.write(secure_.get_connection().client_random_, RAN_LEN); + sha_input.write(secure_.get_connection().server_random_, RAN_LEN); + sha.get_digest(sha_output, sha_input.get_buffer(), + sha_input.get_size()); + + md5_input.set_current(preSz); + md5_input.write(sha_output, SHA_LEN); + md5.get_digest(&secure_.use_connection().master_secret_[i*MD5_LEN], + md5_input.get_buffer(), md5_input.get_size()); + } + deriveKeys(); + } + secure_.use_connection().CleanPreMaster(); +} + + +// create TLSv1 master secret +void SSL::makeTLSMasterSecret() +{ + opaque seed[SEED_LEN]; + + memcpy(seed, secure_.get_connection().client_random_, RAN_LEN); + memcpy(&seed[RAN_LEN], secure_.get_connection().server_random_, RAN_LEN); + + PRF(secure_.use_connection().master_secret_, SECRET_LEN, + secure_.get_connection().pre_master_secret_, + secure_.get_connection().pre_secret_len_, + master_label, MASTER_LABEL_SZ, + seed, SEED_LEN); + + deriveTLSKeys(); +} + + +// derive mac, write, and iv keys for server and client, see page 34, 6.2.2 +void SSL::deriveKeys() +{ + int length = 2 * secure_.get_parms().hash_size_ + + 2 * secure_.get_parms().key_size_ + + 2 * secure_.get_parms().iv_size_; + int rounds = (length + MD5_LEN - 1 ) / MD5_LEN; + input_buffer key_data(rounds * MD5_LEN); + + opaque sha_output[SHA_LEN]; + opaque md5_input[SECRET_LEN + SHA_LEN]; + opaque sha_input[KEY_PREFIX + SECRET_LEN + 2 * RAN_LEN]; + + MD5 md5; + SHA sha; + + memcpy(md5_input, secure_.get_connection().master_secret_, SECRET_LEN); + + for (int i = 0; i < rounds; ++i) { + int j = i + 1; + if (!setPrefix(sha_input, i)) { + SetError(prefix_error); + return; + } + + memcpy(&sha_input[j], secure_.get_connection().master_secret_, + SECRET_LEN); + memcpy(&sha_input[j+SECRET_LEN], + secure_.get_connection().server_random_, RAN_LEN); + memcpy(&sha_input[j + SECRET_LEN + RAN_LEN], + secure_.get_connection().client_random_, RAN_LEN); + sha.get_digest(sha_output, sha_input, + sizeof(sha_input) - KEY_PREFIX + j); + + memcpy(&md5_input[SECRET_LEN], sha_output, SHA_LEN); + md5.get_digest(key_data.get_buffer() + i * MD5_LEN, + md5_input, sizeof(md5_input)); + } + storeKeys(key_data.get_buffer()); +} + + +// derive mac, write, and iv keys for server and client +void SSL::deriveTLSKeys() +{ + int length = 2 * secure_.get_parms().hash_size_ + + 2 * secure_.get_parms().key_size_ + + 2 * secure_.get_parms().iv_size_; + opaque seed[SEED_LEN]; + input_buffer key_data(length); + + memcpy(seed, secure_.get_connection().server_random_, RAN_LEN); + memcpy(&seed[RAN_LEN], secure_.get_connection().client_random_, RAN_LEN); + + PRF(key_data.get_buffer(), length, secure_.get_connection().master_secret_, + SECRET_LEN, key_label, KEY_LABEL_SZ, seed, SEED_LEN); + + storeKeys(key_data.get_buffer()); +} + + +// store mac, write, and iv keys for client and server +void SSL::storeKeys(const opaque* key_data) +{ + int sz = secure_.get_parms().hash_size_; + memcpy(secure_.use_connection().client_write_MAC_secret_, key_data, sz); + int i = sz; + memcpy(secure_.use_connection().server_write_MAC_secret_,&key_data[i], sz); + i += sz; + + sz = secure_.get_parms().key_size_; + memcpy(secure_.use_connection().client_write_key_, &key_data[i], sz); + i += sz; + memcpy(secure_.use_connection().server_write_key_, &key_data[i], sz); + i += sz; + + sz = secure_.get_parms().iv_size_; + memcpy(secure_.use_connection().client_write_IV_, &key_data[i], sz); + i += sz; + memcpy(secure_.use_connection().server_write_IV_, &key_data[i], sz); + + setKeys(); +} + + +// set encrypt/decrypt keys and ivs +void SSL::setKeys() +{ + Connection& conn = secure_.use_connection(); + + if (secure_.get_parms().entity_ == client_end) { + crypto_.use_cipher().set_encryptKey(conn.client_write_key_, + conn.client_write_IV_); + crypto_.use_cipher().set_decryptKey(conn.server_write_key_, + conn.server_write_IV_); + } + else { + crypto_.use_cipher().set_encryptKey(conn.server_write_key_, + conn.server_write_IV_); + crypto_.use_cipher().set_decryptKey(conn.client_write_key_, + conn.client_write_IV_); + } +} + + + +// local functors +namespace yassl_int_cpp_local1 { // for explicit templates + +struct SumData { + uint total_; + SumData() : total_(0) {} + void operator()(input_buffer* data) { total_ += data->get_remaining(); } +}; + + +struct SumBuffer { + uint total_; + SumBuffer() : total_(0) {} + void operator()(output_buffer* buffer) { total_ += buffer->get_size(); } +}; + +} // namespace for locals +using namespace yassl_int_cpp_local1; + + +uint SSL::bufferedData() +{ + return STL::for_each(buffers_.getData().begin(),buffers_.getData().end(), + SumData()).total_; +} + + +// use input buffer to fill data +void SSL::fillData(Data& data) +{ + if (GetError()) return; + uint dataSz = data.get_length(); // input, data size to fill + size_t elements = buffers_.getData().size(); + + data.set_length(0); // output, actual data filled + dataSz = min(dataSz, bufferedData()); + + for (size_t i = 0; i < elements; i++) { + input_buffer* front = buffers_.getData().front(); + uint frontSz = front->get_remaining(); + uint readSz = min(dataSz - data.get_length(), frontSz); + + front->read(data.set_buffer() + data.get_length(), readSz); + data.set_length(data.get_length() + readSz); + + if (readSz == frontSz) { + buffers_.useData().pop_front(); + ysDelete(front); + } + if (data.get_length() == dataSz) + break; + } + + if (buffers_.getData().size() == 0) has_data_ = false; // none left +} + + +// like Fill but keep data in buffer +void SSL::PeekData(Data& data) +{ + if (GetError()) return; + uint dataSz = data.get_length(); // input, data size to fill + size_t elements = buffers_.getData().size(); + + data.set_length(0); // output, actual data filled + dataSz = min(dataSz, bufferedData()); + + Buffers::inputList::iterator front = buffers_.useData().begin(); + + while (elements) { + uint frontSz = (*front)->get_remaining(); + uint readSz = min(dataSz - data.get_length(), frontSz); + uint before = (*front)->get_current(); + + (*front)->read(data.set_buffer() + data.get_length(), readSz); + data.set_length(data.get_length() + readSz); + (*front)->set_current(before); + + if (data.get_length() == dataSz) + break; + + elements--; + front++; + } +} + + +// flush output buffer +void SSL::flushBuffer() +{ + if (GetError()) return; + + uint sz = STL::for_each(buffers_.getHandShake().begin(), + buffers_.getHandShake().end(), + SumBuffer()).total_; + output_buffer out(sz); + size_t elements = buffers_.getHandShake().size(); + + for (size_t i = 0; i < elements; i++) { + output_buffer* front = buffers_.getHandShake().front(); + out.write(front->get_buffer(), front->get_size()); + + buffers_.useHandShake().pop_front(); + ysDelete(front); + } + Send(out.get_buffer(), out.get_size()); +} + + +void SSL::Send(const byte* buffer, uint sz) +{ + if (socket_.send(buffer, sz) != sz) + SetError(send_error); +} + + +// get sequence number, if verify get peer's +uint SSL::get_SEQIncrement(bool verify) +{ + if (verify) + return secure_.use_connection().peer_sequence_number_++; + else + return secure_.use_connection().sequence_number_++; +} + + +const byte* SSL::get_macSecret(bool verify) +{ + if ( (secure_.get_parms().entity_ == client_end && !verify) || + (secure_.get_parms().entity_ == server_end && verify) ) + return secure_.get_connection().client_write_MAC_secret_; + else + return secure_.get_connection().server_write_MAC_secret_; +} + + +void SSL::verifyState(const RecordLayerHeader& rlHeader) +{ + if (GetError()) return; + + if (rlHeader.version_.major_ != 3 || rlHeader.version_.minor_ > 2) { + SetError(badVersion_error); + return; + } + + if (states_.getRecord() == recordNotReady || + (rlHeader.type_ == application_data && // data and handshake + states_.getHandShake() != handShakeReady) ) // isn't complete yet + SetError(record_layer); +} + + +void SSL::verifyState(const HandShakeHeader& hsHeader) +{ + if (GetError()) return; + + if (states_.getHandShake() == handShakeNotReady) { + SetError(handshake_layer); + return; + } + + if (secure_.get_parms().entity_ == client_end) + verifyClientState(hsHeader.get_handshakeType()); + else + verifyServerState(hsHeader.get_handshakeType()); +} + + +void SSL::verifyState(ClientState cs) +{ + if (GetError()) return; + if (states_.getClient() != cs) order_error(); +} + + +void SSL::verifyState(ServerState ss) +{ + if (GetError()) return; + if (states_.getServer() != ss) order_error(); +} + + +void SSL::verfiyHandShakeComplete() +{ + if (GetError()) return; + if (states_.getHandShake() != handShakeReady) order_error(); +} + + +void SSL::verifyClientState(HandShakeType hsType) +{ + if (GetError()) return; + + switch(hsType) { + case server_hello : + if (states_.getClient() != serverNull) + order_error(); + break; + case certificate : + if (states_.getClient() != serverHelloComplete) + order_error(); + break; + case server_key_exchange : + if (states_.getClient() != serverCertComplete) + order_error(); + break; + case certificate_request : + if (states_.getClient() != serverCertComplete && + states_.getClient() != serverKeyExchangeComplete) + order_error(); + break; + case server_hello_done : + if (states_.getClient() != serverCertComplete && + states_.getClient() != serverKeyExchangeComplete) + order_error(); + break; + case finished : + if (states_.getClient() != serverHelloDoneComplete || + secure_.get_parms().pending_) // no change + order_error(); // cipher yet + break; + default : + order_error(); + }; +} + + +void SSL::verifyServerState(HandShakeType hsType) +{ + if (GetError()) return; + + switch(hsType) { + case client_hello : + if (states_.getServer() != clientNull) + order_error(); + break; + case certificate : + if (states_.getServer() != clientHelloComplete) + order_error(); + break; + case client_key_exchange : + if (states_.getServer() != clientHelloComplete) + order_error(); + break; + case certificate_verify : + if (states_.getServer() != clientKeyExchangeComplete) + order_error(); + break; + case finished : + if (states_.getServer() != clientKeyExchangeComplete || + secure_.get_parms().pending_) // no change + order_error(); // cipher yet + break; + default : + order_error(); + }; +} + + +// try to find a suite match +void SSL::matchSuite(const opaque* peer, uint length) +{ + if (length == 0 || (length % 2) != 0) { + SetError(bad_input); + return; + } + + // start with best, if a match we are good, Ciphers are at odd index + // since all SSL and TLS ciphers have 0x00 first byte + for (uint i = 1; i < secure_.get_parms().suites_size_; i += 2) + for (uint j = 1; j < length; j+= 2) + if (secure_.use_parms().suites_[i] == peer[j]) { + secure_.use_parms().suite_[0] = 0x00; + secure_.use_parms().suite_[1] = peer[j]; + + return; + } + + SetError(match_error); +} + + +void SSL::set_session(SSL_SESSION* s) +{ + if (getSecurity().GetContext()->GetSessionCacheOff()) + return; + + if (s && GetSessions().lookup(s->GetID(), &secure_.use_resume())) { + secure_.set_resuming(true); + crypto_.use_certManager().setPeerX509(s->GetPeerX509()); + } +} + + +const Crypto& SSL::getCrypto() const +{ + return crypto_; +} + + +const Security& SSL::getSecurity() const +{ + return secure_; +} + + +const States& SSL::getStates() const +{ + return states_; +} + + +const sslHashes& SSL::getHashes() const +{ + return hashes_; +} + + +const sslFactory& SSL::getFactory() const +{ + return GetSSL_Factory(); +} + + +const Socket& SSL::getSocket() const +{ + return socket_; +} + + +YasslError SSL::GetError() const +{ + return states_.What(); +} + + +bool SSL::GetQuietShutdown() const +{ + return quietShutdown_; +} + + +bool SSL::GetMultiProtocol() const +{ + return secure_.GetContext()->getMethod()->multipleProtocol(); +} + + +Crypto& SSL::useCrypto() +{ + return crypto_; +} + + +Security& SSL::useSecurity() +{ + return secure_; +} + + +States& SSL::useStates() +{ + return states_; +} + + +sslHashes& SSL::useHashes() +{ + return hashes_; +} + + +Socket& SSL::useSocket() +{ + return socket_; +} + + +Log& SSL::useLog() +{ + return log_; +} + + +bool SSL::isTLS() const +{ + return secure_.get_connection().TLS_; +} + + +bool SSL::isTLSv1_1() const +{ + return secure_.get_connection().TLSv1_1_; +} + + +// is there buffered data available, optimization to remove iteration on buffer +bool SSL::HasData() const +{ + return has_data_; +} + + +void SSL::addData(input_buffer* data) +{ + buffers_.useData().push_back(data); + if (!has_data_) has_data_ = true; +} + + +void SSL::addBuffer(output_buffer* b) +{ + buffers_.useHandShake().push_back(b); +} + + +void SSL_SESSION::CopyX509(X509* x) +{ + assert(peerX509_ == 0); + if (x == 0) return; + + X509_NAME* issuer = x->GetIssuer(); + X509_NAME* subject = x->GetSubject(); + ASN1_STRING* before = x->GetBefore(); + ASN1_STRING* after = x->GetAfter(); + + peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), + subject->GetName(), subject->GetLength(), (const char*) before->data, + before->length, (const char*) after->data, after->length); +} + + +// store connection parameters +SSL_SESSION::SSL_SESSION(const SSL& ssl, RandomPool& ran) + : timeout_(DEFAULT_TIMEOUT), random_(ran), peerX509_(0) +{ + const Connection& conn = ssl.getSecurity().get_connection(); + + memcpy(sessionID_, conn.sessionID_, ID_LEN); + memcpy(master_secret_, conn.master_secret_, SECRET_LEN); + memcpy(suite_, ssl.getSecurity().get_parms().suite_, SUITE_LEN); + + bornOn_ = lowResTimer(); + + CopyX509(ssl.getCrypto().get_certManager().get_peerX509()); +} + + +// for resumption copy in ssl::parameters +SSL_SESSION::SSL_SESSION(RandomPool& ran) + : bornOn_(0), timeout_(0), random_(ran), peerX509_(0) +{ + memset(sessionID_, 0, ID_LEN); + memset(master_secret_, 0, SECRET_LEN); + memset(suite_, 0, SUITE_LEN); +} + + +SSL_SESSION& SSL_SESSION::operator=(const SSL_SESSION& that) +{ + memcpy(sessionID_, that.sessionID_, ID_LEN); + memcpy(master_secret_, that.master_secret_, SECRET_LEN); + memcpy(suite_, that.suite_, SUITE_LEN); + + bornOn_ = that.bornOn_; + timeout_ = that.timeout_; + + if (peerX509_) { + ysDelete(peerX509_); + peerX509_ = 0; + } + CopyX509(that.peerX509_); + + return *this; +} + + +const opaque* SSL_SESSION::GetID() const +{ + return sessionID_; +} + + +const opaque* SSL_SESSION::GetSecret() const +{ + return master_secret_; +} + + +const Cipher* SSL_SESSION::GetSuite() const +{ + return suite_; +} + + +X509* SSL_SESSION::GetPeerX509() const +{ + return peerX509_; +} + + +uint SSL_SESSION::GetBornOn() const +{ + return bornOn_; +} + + +uint SSL_SESSION::GetTimeOut() const +{ + return timeout_; +} + + +void SSL_SESSION::SetTimeOut(uint t) +{ + timeout_ = t; +} + + +extern void clean(volatile opaque*, uint, RandomPool&); + + +// clean up secret data +SSL_SESSION::~SSL_SESSION() +{ + volatile opaque* p = master_secret_; + clean(p, SECRET_LEN, random_); + + ysDelete(peerX509_); +} + + +static Sessions* sessionsInstance = 0; + +Sessions& GetSessions() +{ + if (!sessionsInstance) + sessionsInstance = NEW_YS Sessions; + return *sessionsInstance; +} + + +static sslFactory* sslFactoryInstance = 0; + +sslFactory& GetSSL_Factory() +{ + if (!sslFactoryInstance) + sslFactoryInstance = NEW_YS sslFactory; + return *sslFactoryInstance; +} + + +static Errors* errorsInstance = 0; + +Errors& GetErrors() +{ + if (!errorsInstance) + errorsInstance = NEW_YS Errors; + return *errorsInstance; +} + + +typedef Mutex::Lock Lock; + + + +void Sessions::add(const SSL& ssl) +{ + if (ssl.getSecurity().get_connection().sessionID_Set_) { + Lock guard(mutex_); + list_.push_back(NEW_YS SSL_SESSION(ssl, random_)); + count_++; + } + + if (count_ > SESSION_FLUSH_COUNT) + if (!ssl.getSecurity().GetContext()->GetSessionCacheFlushOff()) + Flush(); +} + + +Sessions::~Sessions() +{ + STL::for_each(list_.begin(), list_.end(), del_ptr_zero()); +} + + +// locals +namespace yassl_int_cpp_local2 { // for explicit templates + +typedef STL::list::iterator sess_iterator; +typedef STL::list::iterator thr_iterator; + +struct sess_match { + const opaque* id_; + explicit sess_match(const opaque* p) : id_(p) {} + + bool operator()(SSL_SESSION* sess) + { + if ( memcmp(sess->GetID(), id_, ID_LEN) == 0) + return true; + return false; + } +}; + + +THREAD_ID_T GetSelf() +{ +#ifndef _POSIX_THREADS + return GetCurrentThreadId(); +#else + return pthread_self(); +#endif +} + +struct thr_match { + THREAD_ID_T id_; + explicit thr_match() : id_(GetSelf()) {} + + bool operator()(ThreadError thr) + { + if (thr.threadID_ == id_) + return true; + return false; + } +}; + + +} // local namespace +using namespace yassl_int_cpp_local2; + + +// lookup session by id, return a copy if space provided +SSL_SESSION* Sessions::lookup(const opaque* id, SSL_SESSION* copy) +{ + Lock guard(mutex_); + sess_iterator find = STL::find_if(list_.begin(), list_.end(), + sess_match(id)); + if (find != list_.end()) { + uint current = lowResTimer(); + if ( ((*find)->GetBornOn() + (*find)->GetTimeOut()) < current) { + del_ptr_zero()(*find); + list_.erase(find); + return 0; + } + if (copy) + *copy = *(*find); + return *find; + } + return 0; +} + + +// remove a session by id +void Sessions::remove(const opaque* id) +{ + Lock guard(mutex_); + sess_iterator find = STL::find_if(list_.begin(), list_.end(), + sess_match(id)); + if (find != list_.end()) { + del_ptr_zero()(*find); + list_.erase(find); + } +} + + +// flush expired sessions from cache +void Sessions::Flush() +{ + Lock guard(mutex_); + sess_iterator next = list_.begin(); + uint current = lowResTimer(); + + while (next != list_.end()) { + sess_iterator si = next; + ++next; + if ( ((*si)->GetBornOn() + (*si)->GetTimeOut()) < current) { + del_ptr_zero()(*si); + list_.erase(si); + } + } + count_ = 0; // reset flush counter +} + + +// remove a self thread error +void Errors::Remove() +{ + Lock guard(mutex_); + thr_iterator find = STL::find_if(list_.begin(), list_.end(), + thr_match()); + if (find != list_.end()) + list_.erase(find); +} + + +// lookup self error code +int Errors::Lookup(bool peek) +{ + Lock guard(mutex_); + thr_iterator find = STL::find_if(list_.begin(), list_.end(), + thr_match()); + if (find != list_.end()) { + int ret = find->errorID_; + if (!peek) + list_.erase(find); + return ret; + } + else + return 0; +} + + +// add a new error code for self +void Errors::Add(int error) +{ + ThreadError add; + add.errorID_ = error; + add.threadID_ = GetSelf(); + + Remove(); // may have old error + + Lock guard(mutex_); + list_.push_back(add); +} + + +SSL_METHOD::SSL_METHOD(ConnectionEnd ce, ProtocolVersion pv, bool multiProto) + : version_(pv), side_(ce), verifyPeer_(false), verifyNone_(false), + failNoCert_(false), multipleProtocol_(multiProto) +{} + + +ProtocolVersion SSL_METHOD::getVersion() const +{ + return version_; +} + + +ConnectionEnd SSL_METHOD::getSide() const +{ + return side_; +} + + +void SSL_METHOD::setVerifyPeer() +{ + verifyPeer_ = true; +} + + +void SSL_METHOD::setVerifyNone() +{ + verifyNone_ = true; +} + + +void SSL_METHOD::setFailNoCert() +{ + failNoCert_ = true; +} + + +bool SSL_METHOD::verifyPeer() const +{ + return verifyPeer_; +} + + +bool SSL_METHOD::verifyNone() const +{ + return verifyNone_; +} + + +bool SSL_METHOD::failNoCert() const +{ + return failNoCert_; +} + + +bool SSL_METHOD::multipleProtocol() const +{ + return multipleProtocol_; +} + + +SSL_CTX::SSL_CTX(SSL_METHOD* meth) + : method_(meth), certificate_(0), privateKey_(0), passwordCb_(0), + userData_(0), sessionCacheOff_(false), sessionCacheFlushOff_(false), + verifyCallback_(0) +{} + + +SSL_CTX::~SSL_CTX() +{ + ysDelete(method_); + ysDelete(certificate_); + ysDelete(privateKey_); + + STL::for_each(caList_.begin(), caList_.end(), del_ptr_zero()); +} + + +void SSL_CTX::AddCA(x509* ca) +{ + caList_.push_back(ca); +} + + +const SSL_CTX::CertList& +SSL_CTX::GetCA_List() const +{ + return caList_; +} + + +const VerifyCallback SSL_CTX::getVerifyCallback() const +{ + return verifyCallback_; +} + + +const x509* SSL_CTX::getCert() const +{ + return certificate_; +} + + +const x509* SSL_CTX::getKey() const +{ + return privateKey_; +} + + +const SSL_METHOD* SSL_CTX::getMethod() const +{ + return method_; +} + + +const Ciphers& SSL_CTX::GetCiphers() const +{ + return ciphers_; +} + + +const DH_Parms& SSL_CTX::GetDH_Parms() const +{ + return dhParms_; +} + + +const Stats& SSL_CTX::GetStats() const +{ + return stats_; +} + + +pem_password_cb SSL_CTX::GetPasswordCb() const +{ + return passwordCb_; +} + + +void SSL_CTX::SetPasswordCb(pem_password_cb cb) +{ + passwordCb_ = cb; +} + + +void* SSL_CTX::GetUserData() const +{ + return userData_; +} + + +bool SSL_CTX::GetSessionCacheOff() const +{ + return sessionCacheOff_; +} + + +bool SSL_CTX::GetSessionCacheFlushOff() const +{ + return sessionCacheFlushOff_; +} + + +void SSL_CTX::SetUserData(void* data) +{ + userData_ = data; +} + + +void SSL_CTX::SetSessionCacheOff() +{ + sessionCacheOff_ = true; +} + + +void SSL_CTX::SetSessionCacheFlushOff() +{ + sessionCacheFlushOff_ = true; +} + + +void SSL_CTX::setVerifyPeer() +{ + method_->setVerifyPeer(); +} + + +void SSL_CTX::setVerifyNone() +{ + method_->setVerifyNone(); +} + + +void SSL_CTX::setFailNoCert() +{ + method_->setFailNoCert(); +} + + +void SSL_CTX::setVerifyCallback(VerifyCallback vc) +{ + verifyCallback_ = vc; +} + + +bool SSL_CTX::SetDH(const DH& dh) +{ + dhParms_.p_ = dh.p->int_; + dhParms_.g_ = dh.g->int_; + + return dhParms_.set_ = true; +} + + +bool SSL_CTX::SetCipherList(const char* list) +{ + if (!list) + return false; + + bool ret = false; + char name[MAX_SUITE_NAME]; + + char needle[] = ":"; + char* haystack = const_cast(list); + char* prev; + + const int suiteSz = sizeof(cipher_names) / sizeof(cipher_names[0]); + int idx = 0; + + for(;;) { + size_t len; + prev = haystack; + haystack = strstr(haystack, needle); + + if (!haystack) // last cipher + len = min(sizeof(name), strlen(prev)); + else + len = min(sizeof(name), (size_t)(haystack - prev)); + + strncpy(name, prev, len); + name[(len == sizeof(name)) ? len - 1 : len] = 0; + + for (int i = 0; i < suiteSz; i++) + if (strncmp(name, cipher_names[i], sizeof(name)) == 0) { + + ciphers_.suites_[idx++] = 0x00; // first byte always zero + ciphers_.suites_[idx++] = i; + + if (!ret) ret = true; // found at least one + break; + } + if (!haystack) break; + haystack++; + } + + if (ret) { + ciphers_.setSuites_ = true; + ciphers_.suiteSz_ = idx; + } + + return ret; +} + + +void SSL_CTX::IncrementStats(StatsField fd) +{ + + Lock guard(mutex_); + + switch (fd) { + + case Accept: + ++stats_.accept_; + break; + + case Connect: + ++stats_.connect_; + break; + + case AcceptGood: + ++stats_.acceptGood_; + break; + + case ConnectGood: + ++stats_.connectGood_; + break; + + case AcceptRenegotiate: + ++stats_.acceptRenegotiate_; + break; + + case ConnectRenegotiate: + ++stats_.connectRenegotiate_; + break; + + case Hits: + ++stats_.hits_; + break; + + case CbHits: + ++stats_.cbHits_; + break; + + case CacheFull: + ++stats_.cacheFull_; + break; + + case Misses: + ++stats_.misses_; + break; + + case Timeouts: + ++stats_.timeouts_; + break; + + case Number: + ++stats_.number_; + break; + + case GetCacheSize: + ++stats_.getCacheSize_; + break; + + case VerifyMode: + ++stats_.verifyMode_; + break; + + case VerifyDepth: + ++stats_.verifyDepth_; + break; + + default: + break; + } +} + + +Crypto::Crypto() + : digest_(0), cipher_(0), dh_(0) +{} + + +Crypto::~Crypto() +{ + ysDelete(dh_); + ysDelete(cipher_); + ysDelete(digest_); +} + + +const Digest& Crypto::get_digest() const +{ + return *digest_; +} + + +const BulkCipher& Crypto::get_cipher() const +{ + return *cipher_; +} + + +const DiffieHellman& Crypto::get_dh() const +{ + return *dh_; +} + + +const RandomPool& Crypto::get_random() const +{ + return random_; +} + + +const CertManager& Crypto::get_certManager() const +{ + return cert_; +} + + + +Digest& Crypto::use_digest() +{ + return *digest_; +} + + +BulkCipher& Crypto::use_cipher() +{ + return *cipher_; +} + + +DiffieHellman& Crypto::use_dh() +{ + return *dh_; +} + + +RandomPool& Crypto::use_random() +{ + return random_; +} + + +CertManager& Crypto::use_certManager() +{ + return cert_; +} + + + +void Crypto::SetDH(DiffieHellman* dh) +{ + dh_ = dh; +} + + +void Crypto::SetDH(const DH_Parms& dh) +{ + if (dh.set_) + dh_ = NEW_YS DiffieHellman(dh.p_, dh.g_, random_); +} + + +bool Crypto::DhSet() +{ + return dh_ != 0; +} + + +void Crypto::setDigest(Digest* digest) +{ + digest_ = digest; +} + + +void Crypto::setCipher(BulkCipher* c) +{ + cipher_ = c; +} + + +const MD5& sslHashes::get_MD5() const +{ + return md5HandShake_; +} + + +const SHA& sslHashes::get_SHA() const +{ + return shaHandShake_; +} + + +const Finished& sslHashes::get_verify() const +{ + return verify_; +} + + +const Hashes& sslHashes::get_certVerify() const +{ + return certVerify_; +} + + +MD5& sslHashes::use_MD5(){ + return md5HandShake_; +} + + +SHA& sslHashes::use_SHA() +{ + return shaHandShake_; +} + + +Finished& sslHashes::use_verify() +{ + return verify_; +} + + +Hashes& sslHashes::use_certVerify() +{ + return certVerify_; +} + + +Buffers::Buffers() : rawInput_(0) +{} + + +Buffers::~Buffers() +{ + STL::for_each(handShakeList_.begin(), handShakeList_.end(), + del_ptr_zero()) ; + STL::for_each(dataList_.begin(), dataList_.end(), + del_ptr_zero()) ; + ysDelete(rawInput_); +} + + +void Buffers::SetRawInput(input_buffer* ib) +{ + assert(rawInput_ == 0); + rawInput_ = ib; +} + + +input_buffer* Buffers::TakeRawInput() +{ + input_buffer* ret = rawInput_; + rawInput_ = 0; + + return ret; +} + + +const Buffers::inputList& Buffers::getData() const +{ + return dataList_; +} + + +const Buffers::outputList& Buffers::getHandShake() const +{ + return handShakeList_; +} + + +Buffers::inputList& Buffers::useData() +{ + return dataList_; +} + + +Buffers::outputList& Buffers::useHandShake() +{ + return handShakeList_; +} + + +Security::Security(ProtocolVersion pv, RandomPool& ran, ConnectionEnd ce, + const Ciphers& ciphers, SSL_CTX* ctx, bool haveDH) + : conn_(pv, ran), parms_(ce, ciphers, pv, haveDH), resumeSession_(ran), + ctx_(ctx), resuming_(false) +{} + + +const Connection& Security::get_connection() const +{ + return conn_; +} + + +const SSL_CTX* Security::GetContext() const +{ + return ctx_; +} + + +const Parameters& Security::get_parms() const +{ + return parms_; +} + + +const SSL_SESSION& Security::get_resume() const +{ + return resumeSession_; +} + + +bool Security::get_resuming() const +{ + return resuming_; +} + + +Connection& Security::use_connection() +{ + return conn_; +} + + +Parameters& Security::use_parms() +{ + return parms_; +} + + +SSL_SESSION& Security::use_resume() +{ + return resumeSession_; +} + + +void Security::set_resuming(bool b) +{ + resuming_ = b; +} + + +X509_NAME::X509_NAME(const char* n, size_t sz) + : name_(0), sz_(sz) +{ + if (sz) { + name_ = NEW_YS char[sz]; + memcpy(name_, n, sz); + } + entry_.data = 0; +} + + +X509_NAME::~X509_NAME() +{ + ysArrayDelete(name_); + ysArrayDelete(entry_.data); +} + + +const char* X509_NAME::GetName() const +{ + return name_; +} + + +size_t X509_NAME::GetLength() const +{ + return sz_; +} + + +X509::X509(const char* i, size_t iSz, const char* s, size_t sSz, + const char* b, int bSz, const char* a, int aSz) + : issuer_(i, iSz), subject_(s, sSz), + beforeDate_(b, bSz), afterDate_(a, aSz) +{} + + +X509_NAME* X509::GetIssuer() +{ + return &issuer_; +} + + +X509_NAME* X509::GetSubject() +{ + return &subject_; +} + + +ASN1_STRING* X509::GetBefore() +{ + return beforeDate_.GetString(); +} + + +ASN1_STRING* X509::GetAfter() +{ + return afterDate_.GetString(); +} + + +ASN1_STRING* X509_NAME::GetEntry(int i) +{ + if (i < 0 || i >= int(sz_)) + return 0; + + if (entry_.data) + ysArrayDelete(entry_.data); + entry_.data = NEW_YS byte[sz_]; // max size; + + memcpy(entry_.data, &name_[i], sz_ - i); + if (entry_.data[sz_ -i - 1]) { + entry_.data[sz_ - i] = 0; + entry_.length = int(sz_) - i; + } + else + entry_.length = int(sz_) - i - 1; + entry_.type = 0; + + return &entry_; +} + + +StringHolder::StringHolder(const char* str, int sz) +{ + asnString_.length = sz; + asnString_.data = NEW_YS byte[sz + 1]; + memcpy(asnString_.data, str, sz); + asnString_.type = 0; // not used for now +} + + +StringHolder::~StringHolder() +{ + ysArrayDelete(asnString_.data); +} + + +ASN1_STRING* StringHolder::GetString() +{ + return &asnString_; +} + + +#ifdef HAVE_LIBZ + + void* myAlloc(void* /* opaque */, unsigned int item, unsigned int size) + { + return NEW_YS unsigned char[item * size]; + } + + + void myFree(void* /* opaque */, void* memory) + { + unsigned char* ptr = static_cast(memory); + yaSSL::ysArrayDelete(ptr); + } + + + // put size in front of compressed data + int Compress(const byte* in, int sz, input_buffer& buffer) + { + byte tmp[LENGTH_SZ]; + z_stream c_stream; /* compression stream */ + + buffer.allocate(sz + sizeof(uint16) + COMPRESS_EXTRA); + + c_stream.zalloc = myAlloc; + c_stream.zfree = myFree; + c_stream.opaque = (voidpf)0; + + c_stream.next_in = const_cast(in); + c_stream.avail_in = sz; + c_stream.next_out = buffer.get_buffer() + sizeof(tmp); + c_stream.avail_out = buffer.get_capacity() - sizeof(tmp); + + if (deflateInit(&c_stream, 8) != Z_OK) return -1; + int err = deflate(&c_stream, Z_FINISH); + deflateEnd(&c_stream); + if (err != Z_OK && err != Z_STREAM_END) return -1; + + c16toa(sz, tmp); + memcpy(buffer.get_buffer(), tmp, sizeof(tmp)); + buffer.add_size(c_stream.total_out + sizeof(tmp)); + + return 0; + } + + + // get uncompressed size in front + int DeCompress(input_buffer& in, int sz, input_buffer& out) + { + byte tmp[LENGTH_SZ]; + + in.read(tmp, sizeof(tmp)); + + uint16 len; + ato16(tmp, len); + + out.allocate(len); + + z_stream d_stream; /* decompression stream */ + + d_stream.zalloc = myAlloc; + d_stream.zfree = myFree; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = in.get_buffer() + in.get_current(); + d_stream.avail_in = sz - sizeof(tmp); + d_stream.next_out = out.get_buffer(); + d_stream.avail_out = out.get_capacity(); + + if (inflateInit(&d_stream) != Z_OK) return -1; + int err = inflate(&d_stream, Z_FINISH); + inflateEnd(&d_stream); + if (err != Z_OK && err != Z_STREAM_END) return -1; + + out.add_size(d_stream.total_out); + in.set_current(in.get_current() + sz - sizeof(tmp)); + + return 0; + } + + +#else // LIBZ + + // these versions should never get called + int Compress(const byte* in, int sz, input_buffer& buffer) + { + assert(0); + return -1; + } + + + int DeCompress(input_buffer& in, int sz, input_buffer& out) + { + assert(0); + return -1; + } + + +#endif // LIBZ + + +} // namespace + + + +extern "C" void yaSSL_CleanUp() +{ + TaoCrypt::CleanUp(); + yaSSL::ysDelete(yaSSL::sslFactoryInstance); + yaSSL::ysDelete(yaSSL::sessionsInstance); + yaSSL::ysDelete(yaSSL::errorsInstance); + + // In case user calls more than once, prevent seg fault + yaSSL::sslFactoryInstance = 0; + yaSSL::sessionsInstance = 0; + yaSSL::errorsInstance = 0; +} + + +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION +namespace mySTL { +template yaSSL::yassl_int_cpp_local1::SumData for_each::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local1::SumData); +template yaSSL::yassl_int_cpp_local1::SumBuffer for_each::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer); +template mySTL::list::iterator find_if::iterator, yaSSL::yassl_int_cpp_local2::sess_match>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local2::sess_match); +template mySTL::list::iterator find_if::iterator, yaSSL::yassl_int_cpp_local2::thr_match>(mySTL::list::iterator, mySTL::list::iterator, yaSSL::yassl_int_cpp_local2::thr_match); +} +#endif + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/aes.hpp b/externals/mysql/extlib/yassl/taocrypt/include/aes.hpp new file mode 100644 index 0000000..dc19c98 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/aes.hpp @@ -0,0 +1,98 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* aes.hpp defines AES +*/ + + +#ifndef TAO_CRYPT_AES_HPP +#define TAO_CRYPT_AES_HPP + +#include "misc.hpp" +#include "modes.hpp" + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_AES_ASM +#endif + + + +namespace TaoCrypt { + + +enum { AES_BLOCK_SIZE = 16 }; + + +// AES encryption and decryption, see FIPS-197 +class AES : public Mode_BASE { +public: + enum { BLOCK_SIZE = AES_BLOCK_SIZE }; + + AES(CipherDir DIR, Mode MODE) + : Mode_BASE(BLOCK_SIZE, DIR, MODE) {} + +#ifdef DO_AES_ASM + void Process(byte*, const byte*, word32); +#endif + void SetKey(const byte* key, word32 sz, CipherDir fake = ENCRYPTION); + void SetIV(const byte* iv) { memcpy(r_, iv, BLOCK_SIZE); } +private: + static const word32 rcon_[]; + + word32 rounds_; + word32 key_[60]; // max size + + static const word32 Te[5][256]; + static const word32 Td[5][256]; + + static const word32* Te0; + static const word32* Te1; + static const word32* Te2; + static const word32* Te3; + static const word32* Te4; + + static const word32* Td0; + static const word32* Td1; + static const word32* Td2; + static const word32* Td3; + static const word32* Td4; + + void encrypt(const byte*, const byte*, byte*) const; + void AsmEncrypt(const byte*, byte*, void*) const; + void decrypt(const byte*, const byte*, byte*) const; + void AsmDecrypt(const byte*, byte*, void*) const; + + void ProcessAndXorBlock(const byte*, const byte*, byte*) const; + + AES(const AES&); // hide copy + AES& operator=(const AES&); // and assign +}; + + +typedef BlockCipher AES_ECB_Encryption; +typedef BlockCipher AES_ECB_Decryption; + +typedef BlockCipher AES_CBC_Encryption; +typedef BlockCipher AES_CBC_Decryption; + + + +} // naemspace + +#endif // TAO_CRYPT_AES_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/algebra.hpp b/externals/mysql/extlib/yassl/taocrypt/include/algebra.hpp new file mode 100644 index 0000000..298ef11 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/algebra.hpp @@ -0,0 +1,226 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's algebra.h from CryptoPP */ + +#ifndef TAO_CRYPT_ALGEBRA_HPP +#define TAO_CRYPT_ALGEBRA_HPP + +#include "integer.hpp" + +namespace TaoCrypt { + + +// "const Element&" returned by member functions are references +// to internal data members. Since each object may have only +// one such data member for holding results, the following code +// will produce incorrect results: +// abcd = group.Add(group.Add(a,b), group.Add(c,d)); +// But this should be fine: +// abcd = group.Add(a, group.Add(b, group.Add(c,d)); + +// Abstract Group +class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base +{ +public: + typedef Integer Element; + + virtual ~AbstractGroup() {} + + virtual bool Equal(const Element &a, const Element &b) const =0; + virtual const Element& Identity() const =0; + virtual const Element& Add(const Element &a, const Element &b) const =0; + virtual const Element& Inverse(const Element &a) const =0; + virtual bool InversionIsFast() const {return false;} + + virtual const Element& Double(const Element &a) const; + virtual const Element& Subtract(const Element &a, const Element &b) const; + virtual Element& Accumulate(Element &a, const Element &b) const; + virtual Element& Reduce(Element &a, const Element &b) const; + + virtual Element ScalarMultiply(const Element &a, const Integer &e) const; + virtual Element CascadeScalarMultiply(const Element &x, const Integer &e1, + const Element &y, const Integer &e2) const; + + virtual void SimultaneousMultiply(Element *results, const Element &base, + const Integer *exponents, unsigned int exponentsCount) const; +}; + +// Abstract Ring +class TAOCRYPT_NO_VTABLE AbstractRing : public AbstractGroup +{ +public: + typedef Integer Element; + + AbstractRing() : AbstractGroup() {m_mg.m_pRing = this;} + AbstractRing(const AbstractRing &source) : AbstractGroup() + {m_mg.m_pRing = this;} + AbstractRing& operator=(const AbstractRing &source) {return *this;} + + virtual bool IsUnit(const Element &a) const =0; + virtual const Element& MultiplicativeIdentity() const =0; + virtual const Element& Multiply(const Element&, const Element&) const =0; + virtual const Element& MultiplicativeInverse(const Element &a) const =0; + + virtual const Element& Square(const Element &a) const; + virtual const Element& Divide(const Element &a, const Element &b) const; + + virtual Element Exponentiate(const Element &a, const Integer &e) const; + virtual Element CascadeExponentiate(const Element &x, const Integer &e1, + const Element &y, const Integer &e2) const; + + virtual void SimultaneousExponentiate(Element *results, const Element&, + const Integer *exponents, unsigned int exponentsCount) const; + + virtual const AbstractGroup& MultiplicativeGroup() const + {return m_mg;} + +private: + class MultiplicativeGroupT : public AbstractGroup + { + public: + const AbstractRing& GetRing() const + {return *m_pRing;} + + bool Equal(const Element &a, const Element &b) const + {return GetRing().Equal(a, b);} + + const Element& Identity() const + {return GetRing().MultiplicativeIdentity();} + + const Element& Add(const Element &a, const Element &b) const + {return GetRing().Multiply(a, b);} + + Element& Accumulate(Element &a, const Element &b) const + {return a = GetRing().Multiply(a, b);} + + const Element& Inverse(const Element &a) const + {return GetRing().MultiplicativeInverse(a);} + + const Element& Subtract(const Element &a, const Element &b) const + {return GetRing().Divide(a, b);} + + Element& Reduce(Element &a, const Element &b) const + {return a = GetRing().Divide(a, b);} + + const Element& Double(const Element &a) const + {return GetRing().Square(a);} + + Element ScalarMultiply(const Element &a, const Integer &e) const + {return GetRing().Exponentiate(a, e);} + + Element CascadeScalarMultiply(const Element &x, const Integer &e1, + const Element &y, const Integer &e2) const + {return GetRing().CascadeExponentiate(x, e1, y, e2);} + + void SimultaneousMultiply(Element *results, const Element &base, + const Integer *exponents, unsigned int exponentsCount) const + {GetRing().SimultaneousExponentiate(results, base, exponents, + exponentsCount);} + + const AbstractRing* m_pRing; + }; + + MultiplicativeGroupT m_mg; +}; + + +// Abstract Euclidean Domain +class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain + : public AbstractRing +{ +public: + typedef Integer Element; + + virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a, + const Element &d) const =0; + + virtual const Element& Mod(const Element &a, const Element &b) const =0; + virtual const Element& Gcd(const Element &a, const Element &b) const; + +protected: + mutable Element result; +}; + + +// EuclideanDomainOf +class EuclideanDomainOf : public AbstractEuclideanDomain +{ +public: + typedef Integer Element; + + EuclideanDomainOf() {} + + bool Equal(const Element &a, const Element &b) const + {return a==b;} + + const Element& Identity() const + {return Element::Zero();} + + const Element& Add(const Element &a, const Element &b) const + {return result = a+b;} + + Element& Accumulate(Element &a, const Element &b) const + {return a+=b;} + + const Element& Inverse(const Element &a) const + {return result = -a;} + + const Element& Subtract(const Element &a, const Element &b) const + {return result = a-b;} + + Element& Reduce(Element &a, const Element &b) const + {return a-=b;} + + const Element& Double(const Element &a) const + {return result = a.Doubled();} + + const Element& MultiplicativeIdentity() const + {return Element::One();} + + const Element& Multiply(const Element &a, const Element &b) const + {return result = a*b;} + + const Element& Square(const Element &a) const + {return result = a.Squared();} + + bool IsUnit(const Element &a) const + {return a.IsUnit();} + + const Element& MultiplicativeInverse(const Element &a) const + {return result = a.MultiplicativeInverse();} + + const Element& Divide(const Element &a, const Element &b) const + {return result = a/b;} + + const Element& Mod(const Element &a, const Element &b) const + {return result = a%b;} + + void DivisionAlgorithm(Element &r, Element &q, const Element &a, + const Element &d) const + {Element::Divide(r, q, a, d);} + +private: + mutable Element result; +}; + + + +} // namespace + +#endif // TAO_CRYPT_ALGEBRA_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/arc4.hpp b/externals/mysql/extlib/yassl/taocrypt/include/arc4.hpp new file mode 100644 index 0000000..757e1a5 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/arc4.hpp @@ -0,0 +1,58 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* arc4.hpp defines ARC4 +*/ + + +#ifndef TAO_CRYPT_ARC4_HPP +#define TAO_CRYPT_ARC4_HPP + +#include "misc.hpp" + +namespace TaoCrypt { + + +// ARC4 encryption and decryption +class ARC4 { +public: + enum { STATE_SIZE = 256 }; + + typedef ARC4 Encryption; + typedef ARC4 Decryption; + + ARC4() {} + + void Process(byte*, const byte*, word32); + void SetKey(const byte*, word32); +private: + byte x_; + byte y_; + byte state_[STATE_SIZE]; + + ARC4(const ARC4&); // hide copy + const ARC4 operator=(const ARC4&); // and assign + + void AsmProcess(byte*, const byte*, word32); +}; + +} // namespace + + +#endif // TAO_CRYPT_ARC4_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/asn.hpp b/externals/mysql/extlib/yassl/taocrypt/include/asn.hpp new file mode 100644 index 0000000..1c1850c --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/asn.hpp @@ -0,0 +1,372 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* asn.hpp provides ASN1 BER, PublicKey, and x509v3 decoding +*/ + + +#ifndef TAO_CRYPT_ASN_HPP +#define TAO_CRYPT_ASN_HPP + + +#include "misc.hpp" +#include "block.hpp" +#include "error.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "list.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + +namespace TaoCrypt { + +// these tags and flags are not complete +enum ASNTag +{ + BOOLEAN = 0x01, + INTEGER = 0x02, + BIT_STRING = 0x03, + OCTET_STRING = 0x04, + TAG_NULL = 0x05, + OBJECT_IDENTIFIER = 0x06, + OBJECT_DESCRIPTOR = 0x07, + EXTERNAL = 0x08, + REAL = 0x09, + ENUMERATED = 0x0a, + UTF8_STRING = 0x0c, + SEQUENCE = 0x10, + SET = 0x11, + NUMERIC_STRING = 0x12, + PRINTABLE_STRING = 0x13, + T61_STRING = 0x14, + VIDEOTEXT_STRING = 0x15, + IA5_STRING = 0x16, + UTC_TIME = 0x17, + GENERALIZED_TIME = 0x18, + GRAPHIC_STRING = 0x19, + VISIBLE_STRING = 0x1a, + GENERAL_STRING = 0x1b, + LONG_LENGTH = 0x80 +}; + +enum ASNIdFlag +{ + UNIVERSAL = 0x00, + DATA = 0x01, + HEADER = 0x02, + CONSTRUCTED = 0x20, + APPLICATION = 0x40, + CONTEXT_SPECIFIC = 0x80, + PRIVATE = 0xc0 +}; + + +enum DNTags +{ + COMMON_NAME = 0x03, // CN + SUR_NAME = 0x04, // SN + COUNTRY_NAME = 0x06, // C + LOCALITY_NAME = 0x07, // L + STATE_NAME = 0x08, // ST + ORG_NAME = 0x0a, // O + ORGUNIT_NAME = 0x0b // OU +}; + + +enum PCKS12_Tags +{ + /* DATA = 1, */ // from ASN1 + SIGNED_DATA = 2, + ENVELOPED_DATA = 3, + SIGNED_AND_ENVELOPED_DATA = 4, + DIGESTED_DATA = 5, + ENCRYPTED_DATA = 6 +}; + + +enum Constants +{ + MIN_DATE_SZ = 13, + MAX_DATE_SZ = 16, + MAX_ALGO_SZ = 16, + MAX_LENGTH_SZ = 5, + MAX_SEQ_SZ = 5, // enum(seq|con) + length(4) + MAX_ALGO_SIZE = 9, + MAX_DIGEST_SZ = 25, // SHA + enum(Bit or Octet) + length(4) + DSA_SIG_SZ = 40, + ASN_NAME_MAX = 512 // max total of all included names +}; + + +class Source; +class RSA_PublicKey; +class RSA_PrivateKey; +class DSA_PublicKey; +class DSA_PrivateKey; +class Integer; +class DH; + + +// General BER decoding +class BER_Decoder : public virtual_base { +protected: + Source& source_; +public: + explicit BER_Decoder(Source& s) : source_(s) {} + virtual ~BER_Decoder() {} + + Integer& GetInteger(Integer&); + word32 GetSequence(); + word32 GetSet(); + word32 GetVersion(); + word32 GetExplicitVersion(); + + Error GetError(); +private: + virtual void ReadHeader() = 0; + + BER_Decoder(const BER_Decoder&); // hide copy + BER_Decoder& operator=(const BER_Decoder&); // and assign +}; + + +// RSA Private Key BER Decoder +class RSA_Private_Decoder : public BER_Decoder { +public: + explicit RSA_Private_Decoder(Source& s) : BER_Decoder(s) {} + void Decode(RSA_PrivateKey&); +private: + void ReadHeader(); +}; + + +// RSA Public Key BER Decoder +class RSA_Public_Decoder : public BER_Decoder { +public: + explicit RSA_Public_Decoder(Source& s) : BER_Decoder(s) {} + void Decode(RSA_PublicKey&); +private: + void ReadHeader(); +}; + + +// DSA Private Key BER Decoder +class DSA_Private_Decoder : public BER_Decoder { +public: + explicit DSA_Private_Decoder(Source& s) : BER_Decoder(s) {} + void Decode(DSA_PrivateKey&); +private: + void ReadHeader(); +}; + + +// DSA Public Key BER Decoder +class DSA_Public_Decoder : public BER_Decoder { +public: + explicit DSA_Public_Decoder(Source& s) : BER_Decoder(s) {} + void Decode(DSA_PublicKey&); +private: + void ReadHeader(); +}; + + +// DH Key BER Decoder +class DH_Decoder : public BER_Decoder { +public: + explicit DH_Decoder(Source& s) : BER_Decoder(s) {} + void Decode(DH&); +private: + void ReadHeader(); +}; + + +// PKCS12 BER Decoder +class PKCS12_Decoder : public BER_Decoder { +public: + explicit PKCS12_Decoder(Source& s) : BER_Decoder(s) {} + void Decode(); +private: + void ReadHeader(); +}; + + +// General PublicKey +class PublicKey { + byte* key_; + word32 sz_; +public: + explicit PublicKey(const byte* k = 0, word32 s = 0); + ~PublicKey() { tcArrayDelete(key_); } + + const byte* GetKey() const { return key_; } + word32 size() const { return sz_; } + + void SetKey(const byte*); + void SetSize(word32 s); + + void AddToEnd(const byte*, word32); +private: + PublicKey(const PublicKey&); // hide copy + PublicKey& operator=(const PublicKey&); // and assign +}; + + +enum { SHA_SIZE = 20 }; + + +// A Signing Authority +class Signer { + PublicKey key_; + char name_[ASN_NAME_MAX]; + byte hash_[SHA_SIZE]; +public: + Signer(const byte* k, word32 kSz, const char* n, const byte* h); + ~Signer(); + + const PublicKey& GetPublicKey() const { return key_; } + const char* GetName() const { return name_; } + const byte* GetHash() const { return hash_; } + +private: + Signer(const Signer&); // hide copy + Signer& operator=(const Signer&); // and assign +}; + + +typedef STL::list SignerList; + + +enum ContentType { HUH = 651 }; +enum SigType { SHAwDSA = 517, MD2wRSA = 646, MD5wRSA = 648, SHAwRSA =649}; +enum HashType { MD2h = 646, MD5h = 649, SHAh = 88 }; +enum KeyType { DSAk = 515, RSAk = 645 }; // sums of algo OID + + +// an x509v Certificate BER Decoder +class CertDecoder : public BER_Decoder { +public: + enum DateType { BEFORE, AFTER }; + enum NameType { ISSUER, SUBJECT }; + enum CertType { CA, USER }; + + explicit CertDecoder(Source&, bool decode = true, SignerList* sl = 0, + bool noVerify = false, CertType ct = USER); + ~CertDecoder(); + + const PublicKey& GetPublicKey() const { return key_; } + KeyType GetKeyType() const { return KeyType(keyOID_); } + const char* GetIssuer() const { return issuer_; } + const char* GetCommonName() const { return subject_; } + const byte* GetHash() const { return subjectHash_; } + const char* GetBeforeDate() const { return beforeDate_; } + const char* GetAfterDate() const { return afterDate_; } + + void DecodeToKey(); +private: + PublicKey key_; + word32 certBegin_; // offset to start of cert + word32 sigIndex_; // offset to start of signature + word32 sigLength_; // length of signature + word32 signatureOID_; // sum of algorithm object id + word32 keyOID_; // sum of key algo object id + byte subjectHash_[SHA_SIZE]; // hash of all Names + byte issuerHash_[SHA_SIZE]; // hash of all Names + byte* signature_; + char issuer_[ASN_NAME_MAX]; // Names + char subject_[ASN_NAME_MAX]; // Names + char beforeDate_[MAX_DATE_SZ]; // valid before date + char afterDate_[MAX_DATE_SZ]; // valid after date + bool verify_; // Default to yes, but could be off + + void ReadHeader(); + void Decode(SignerList*, CertType); + void StoreKey(); + void AddDSA(); + bool ValidateSelfSignature(); + bool ValidateSignature(SignerList*); + bool ConfirmSignature(Source&); + void GetKey(); + void GetName(NameType); + void GetValidity(); + void GetDate(DateType); + void GetCompareHash(const byte*, word32, byte*, word32); + word32 GetAlgoId(); + word32 GetSignature(); + word32 GetDigest(); +}; + + +word32 GetLength(Source&); + +word32 SetLength(word32, byte*); +word32 SetSequence(word32, byte*); + +word32 EncodeDSA_Signature(const byte* signature, byte* output); +word32 EncodeDSA_Signature(const Integer& r, const Integer& s, byte* output); +word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz); + + +// General DER encoding +class DER_Encoder : public virtual_base { +public: + DER_Encoder() {} + virtual ~DER_Encoder() {} + + word32 SetAlgoID(HashType, byte*); + + Error GetError() const { return error_; } +private: + //virtual void WriteHeader() = 0; + Error error_; + + DER_Encoder(const DER_Encoder&); // hide copy + DER_Encoder& operator=(const DER_Encoder&); // and assign +}; + + + +class Signature_Encoder : public DER_Encoder { + const byte* digest_; + word32 digestSz_; + SigType digestOID_; +public: + explicit Signature_Encoder(const byte*, word32, HashType, Source&); + +private: + void WriteHeader(); + word32 SetDigest(const byte*, word32, byte*); + + Signature_Encoder(const Signature_Encoder&); // hide copy + Signature_Encoder& operator=(const Signature_Encoder&); // and assign +}; + + +// Get Cert in PEM format from BEGIN to END +int GetCert(Source&); + +// Get Cert in PEM format from pkcs12 file +int GetPKCS_Cert(const char* password, Source&); + +} // namespace + + +#endif // TAO_CRYPT_ASN_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/block.hpp b/externals/mysql/extlib/yassl/taocrypt/include/block.hpp new file mode 100644 index 0000000..529a91e --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/block.hpp @@ -0,0 +1,206 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* block.hpp provides word and byte blocks with configurable allocators +*/ + + +#ifndef TAO_CRYPT_BLOCK_HPP +#define TAO_CRYPT_BLOCK_HPP + +#include "misc.hpp" +#include // memcpy +#include // ptrdiff_t + +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + +namespace TaoCrypt { + + +// a Base class for Allocators +template +class AllocatorBase +{ +public: + typedef T value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + + pointer address(reference r) const {return (&r);} + const_pointer address(const_reference r) const {return (&r); } + void construct(pointer p, const T& val) {new (p) T(val);} + void destroy(pointer p) {p->~T();} + size_type max_size() const {return ~size_type(0)/sizeof(T);} +protected: + static void CheckSize(size_t n) + { + assert(n <= ~size_t(0) / sizeof(T)); + } +}; + + +// General purpose realloc +template +typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize, + typename A::size_type newSize, bool preserve) +{ + if (oldSize == newSize) + return p; + + if (preserve) { + A b = A(); + typename A::pointer newPointer = b.allocate(newSize, 0); + memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize)); + a.deallocate(p, oldSize); + STL::swap(a, b); + return newPointer; + } + else { + a.deallocate(p, oldSize); + return a.allocate(newSize, 0); + } +} + + +// Allocator that zeros out memory on deletion +template +class AllocatorWithCleanup : public AllocatorBase +{ +public: + typedef typename AllocatorBase::pointer pointer; + typedef typename AllocatorBase::size_type size_type; + + pointer allocate(size_type n, const void* = 0) + { + this->CheckSize(n); + if (n == 0) + return 0; + return NEW_TC T[n]; + } + + void deallocate(void* p, size_type n) + { + memset(p, 0, n * sizeof(T)); + tcArrayDelete((T*)p); + } + + pointer reallocate(T* p, size_type oldSize, size_type newSize, + bool preserve) + { + return StdReallocate(*this, p, oldSize, newSize, preserve); + } + + // VS.NET STL enforces the policy of "All STL-compliant allocators have to + // provide a template class member called rebind". + template struct rebind { typedef AllocatorWithCleanup other;}; +}; + + +// Block class template +template > +class Block { +public: + explicit Block(word32 s = 0) : sz_(s), buffer_(allocator_.allocate(sz_)) + { CleanNew(sz_); } + + Block(const T* buff, word32 s) : sz_(s), buffer_(allocator_.allocate(sz_)) + { memcpy(buffer_, buff, sz_ * sizeof(T)); } + + Block(const Block& that) : sz_(that.sz_), buffer_(allocator_.allocate(sz_)) + { memcpy(buffer_, that.buffer_, sz_ * sizeof(T)); } + + Block& operator=(const Block& that) { + Block tmp(that); + Swap(tmp); + return *this; + } + + T& operator[] (word32 i) { assert(i < sz_); return buffer_[i]; } + const T& operator[] (word32 i) const + { assert(i < sz_); return buffer_[i]; } + + T* operator+ (word32 i) { return buffer_ + i; } + const T* operator+ (word32 i) const { return buffer_ + i; } + + word32 size() const { return sz_; } + + T* get_buffer() const { return buffer_; } + T* begin() const { return get_buffer(); } + + void CleanGrow(word32 newSize) + { + if (newSize > sz_) { + buffer_ = allocator_.reallocate(buffer_, sz_, newSize, true); + memset(buffer_ + sz_, 0, (newSize - sz_) * sizeof(T)); + sz_ = newSize; + } + } + + void CleanNew(word32 newSize) + { + New(newSize); + memset(buffer_, 0, sz_ * sizeof(T)); + } + + void New(word32 newSize) + { + buffer_ = allocator_.reallocate(buffer_, sz_, newSize, false); + sz_ = newSize; + } + + void resize(word32 newSize) + { + buffer_ = allocator_.reallocate(buffer_, sz_, newSize, true); + sz_ = newSize; + } + + void Swap(Block& other) { + STL::swap(sz_, other.sz_); + STL::swap(buffer_, other.buffer_); + STL::swap(allocator_, other.allocator_); + } + + ~Block() { allocator_.deallocate(buffer_, sz_); } +private: + word32 sz_; // size in Ts + T* buffer_; + A allocator_; +}; + + +typedef Block ByteBlock; +typedef Block WordBlock; +typedef Block Word32Block; + + +} // namespace + +#endif // TAO_CRYPT_BLOCK_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/blowfish.hpp b/externals/mysql/extlib/yassl/taocrypt/include/blowfish.hpp new file mode 100644 index 0000000..90d2c01 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/blowfish.hpp @@ -0,0 +1,88 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* blowfish.hpp defines Blowfish +*/ + + +#ifndef TAO_CRYPT_BLOWFISH_HPP +#define TAO_CRYPT_BLOWFISH_HPP + +#include "misc.hpp" +#include "modes.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_BLOWFISH_ASM +#endif + + +namespace TaoCrypt { + +enum { BLOWFISH_BLOCK_SIZE = 8 }; + + +// Blowfish encryption and decryption, see +class Blowfish : public Mode_BASE { +public: + enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 }; + + Blowfish(CipherDir DIR, Mode MODE) + : Mode_BASE(BLOCK_SIZE, DIR, MODE) {} + +#ifdef DO_BLOWFISH_ASM + void Process(byte*, const byte*, word32); +#endif + void SetKey(const byte* key, word32 sz, CipherDir fake = ENCRYPTION); + void SetIV(const byte* iv) { memcpy(r_, iv, BLOCK_SIZE); } +private: + static const word32 p_init_[ROUNDS + 2]; + static const word32 s_init_[4 * 256]; + + word32 pbox_[ROUNDS + 2]; + word32 sbox_[4 * 256]; + + void crypt_block(const word32 in[2], word32 out[2]) const; + void AsmProcess(const byte* in, byte* out) const; + void ProcessAndXorBlock(const byte*, const byte*, byte*) const; + + Blowfish(const Blowfish&); // hide copy + Blowfish& operator=(const Blowfish&); // and assign +}; + + +typedef BlockCipher Blowfish_ECB_Encryption; +typedef BlockCipher Blowfish_ECB_Decryption; + +typedef BlockCipher Blowfish_CBC_Encryption; +typedef BlockCipher Blowfish_CBC_Decryption; + + + +} // namespace + +#endif // TAO_CRYPT_BLOWFISH_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/coding.hpp b/externals/mysql/extlib/yassl/taocrypt/include/coding.hpp new file mode 100644 index 0000000..3b1c068 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/coding.hpp @@ -0,0 +1,91 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* coding.hpp defines hex and base64 encoding/decoing +*/ + +#ifndef TAO_CRYPT_CODING_HPP +#define TAO_CRYPT_CODING_HPP + +#include "misc.hpp" +#include "block.hpp" + +namespace TaoCrypt { + +class Source; + + +// Hex Encoding, see RFC 3548 +class HexEncoder { + ByteBlock encoded_; + Source& plain_; +public: + explicit HexEncoder(Source& s) : plain_(s) { Encode(); } +private: + void Encode(); + + HexEncoder(const HexEncoder&); // hide copy + HexEncoder& operator=(const HexEncoder&); // and assign +}; + + +// Hex Decoding, see RFC 3548 +class HexDecoder { + ByteBlock decoded_; + Source& coded_; +public: + explicit HexDecoder(Source& s) : coded_(s) { Decode(); } +private: + void Decode(); + + HexDecoder(const HexDecoder&); // hide copy + HexDecoder& operator=(const HexDecoder&); // and assign +}; + + +// Base 64 encoding, see RFC 3548 +class Base64Encoder { + ByteBlock encoded_; + Source& plain_; +public: + explicit Base64Encoder(Source& s) : plain_(s) { Encode(); } +private: + void Encode(); + + Base64Encoder(const Base64Encoder&); // hide copy + Base64Encoder& operator=(const Base64Encoder&); // and assign +}; + + +// Base 64 decoding, see RFC 3548 +class Base64Decoder { + ByteBlock decoded_; + Source& coded_; +public: + explicit Base64Decoder(Source& s) : coded_(s) { Decode(); } +private: + void Decode(); + + Base64Decoder(const Base64Decoder&); // hide copy + Base64Decoder& operator=(const Base64Decoder&); // and assign +}; + + +} // namespace + +#endif // TAO_CRYPT_CODING_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/des.hpp b/externals/mysql/extlib/yassl/taocrypt/include/des.hpp new file mode 100644 index 0000000..f99a289 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/des.hpp @@ -0,0 +1,130 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* des.hpp defines DES, DES_EDE2, and DES_EDE3 + see FIPS 46-2 and FIPS 81 +*/ + + +#ifndef TAO_CRYPT_DES_HPP +#define TAO_CRYPT_DES_HPP + +#include "misc.hpp" +#include "modes.hpp" + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_DES_ASM +#endif + + +namespace TaoCrypt { + + +enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 }; + + +class BasicDES { +public: + void SetKey(const byte*, word32, CipherDir dir); + void RawProcessBlock(word32&, word32&) const; +protected: + word32 k_[DES_KEY_SIZE]; +}; + + +// DES +class DES : public Mode_BASE, public BasicDES { +public: + DES(CipherDir DIR, Mode MODE) + : Mode_BASE(DES_BLOCK_SIZE, DIR, MODE) {} + +private: + void ProcessAndXorBlock(const byte*, const byte*, byte*) const; + + DES(const DES&); // hide copy + DES& operator=(const DES&); // and assign +}; + + +// DES_EDE2 +class DES_EDE2 : public Mode_BASE { +public: + DES_EDE2(CipherDir DIR, Mode MODE) + : Mode_BASE(DES_BLOCK_SIZE, DIR, MODE) {} + + void SetKey(const byte*, word32, CipherDir dir); +private: + BasicDES des1_; + BasicDES des2_; + + void ProcessAndXorBlock(const byte*, const byte*, byte*) const; + + DES_EDE2(const DES_EDE2&); // hide copy + DES_EDE2& operator=(const DES_EDE2&); // and assign +}; + + + +// DES_EDE3 +class DES_EDE3 : public Mode_BASE { +public: + DES_EDE3(CipherDir DIR, Mode MODE) + : Mode_BASE(DES_BLOCK_SIZE, DIR, MODE) {} + + void SetKey(const byte*, word32, CipherDir dir); + void SetIV(const byte* iv) { memcpy(r_, iv, DES_BLOCK_SIZE); } +#ifdef DO_DES_ASM + void Process(byte*, const byte*, word32); +#endif +private: + BasicDES des1_; + BasicDES des2_; + BasicDES des3_; + + void AsmProcess(const byte* in, byte* out, void* box) const; + void ProcessAndXorBlock(const byte*, const byte*, byte*) const; + + DES_EDE3(const DES_EDE3&); // hide copy + DES_EDE3& operator=(const DES_EDE3&); // and assign +}; + + +typedef BlockCipher DES_ECB_Encryption; +typedef BlockCipher DES_ECB_Decryption; + +typedef BlockCipher DES_CBC_Encryption; +typedef BlockCipher DES_CBC_Decryption; + +typedef BlockCipher DES_EDE2_ECB_Encryption; +typedef BlockCipher DES_EDE2_ECB_Decryption; + +typedef BlockCipher DES_EDE2_CBC_Encryption; +typedef BlockCipher DES_EDE2_CBC_Decryption; + +typedef BlockCipher DES_EDE3_ECB_Encryption; +typedef BlockCipher DES_EDE3_ECB_Decryption; + +typedef BlockCipher DES_EDE3_CBC_Encryption; +typedef BlockCipher DES_EDE3_CBC_Decryption; + + +} // namespace + + +#endif // TAO_CRYPT_DES_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/dh.hpp b/externals/mysql/extlib/yassl/taocrypt/include/dh.hpp new file mode 100644 index 0000000..b7724cb --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/dh.hpp @@ -0,0 +1,86 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* dh.hpp provides Diffie-Hellman support +*/ + + +#ifndef TAO_CRYPT_DH_HPP +#define TAO_CRYPT_DH_HPP + +#include "misc.hpp" +#include "integer.hpp" + +namespace TaoCrypt { + + +class Source; + + +// Diffie-Hellman +class DH { +public: + DH() {} + DH(Integer& p, Integer& g) : p_(p), g_(g) {} + explicit DH(Source&); + + DH(const DH& that) : p_(that.p_), g_(that.g_) {} + DH& operator=(const DH& that) + { + DH tmp(that); + Swap(tmp); + return *this; + } + + void Swap(DH& other) + { + p_.Swap(other.p_); + g_.Swap(other.g_); + } + + void Initialize(Source&); + void Initialize(Integer& p, Integer& g) + { + SetP(p); + SetG(g); + } + + void GenerateKeyPair(RandomNumberGenerator&, byte*, byte*); + void Agree(byte*, const byte*, const byte*, word32 otherSz = 0); + + void SetP(const Integer& p) { p_ = p; } + void SetG(const Integer& g) { g_ = g; } + + Integer& GetP() { return p_; } + Integer& GetG() { return g_; } + + // for p and agree + word32 GetByteLength() const { return p_.ByteCount(); } +private: + // group parms + Integer p_; + Integer g_; + + void GeneratePrivate(RandomNumberGenerator&, byte*); + void GeneratePublic(const byte*, byte*); +}; + + +} // namespace + +#endif // TAO_CRYPT_DH_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/dsa.hpp b/externals/mysql/extlib/yassl/taocrypt/include/dsa.hpp new file mode 100644 index 0000000..f185b85 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/dsa.hpp @@ -0,0 +1,126 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* dsa.hpp provides Digitial Signautre Algorithm see FIPS 186-2 +*/ + +#ifndef TAO_CRYPT_DSA_HPP +#define TAO_CRYPT_DSA_HPP + +#include "integer.hpp" + + +namespace TaoCrypt { + +class Source; + + +class DSA_PublicKey { +protected: + Integer p_; + Integer q_; + Integer g_; + Integer y_; +public: + DSA_PublicKey() {} + explicit DSA_PublicKey(Source&); + + void Initialize(Source&); + void Initialize(const Integer& p, const Integer& q, const Integer& g, + const Integer& y); + + const Integer& GetModulus() const; + const Integer& GetSubGroupOrder() const; + const Integer& GetSubGroupGenerator() const; + const Integer& GetPublicPart() const; + + void SetModulus(const Integer&); + void SetSubGroupOrder(const Integer&); + void SetSubGroupGenerator(const Integer&); + void SetPublicPart(const Integer&); + + word32 SignatureLength() const; + + DSA_PublicKey(const DSA_PublicKey&); + DSA_PublicKey& operator=(const DSA_PublicKey&); + + void Swap(DSA_PublicKey& other); +}; + + + +class DSA_PrivateKey : public DSA_PublicKey { + Integer x_; +public: + DSA_PrivateKey() {} + explicit DSA_PrivateKey(Source&); + + void Initialize(Source&); + void Initialize(const Integer& p, const Integer& q, const Integer& g, + const Integer& y, const Integer& x); + + const Integer& GetPrivatePart() const; + + void SetPrivatePart(const Integer&); +private: + DSA_PrivateKey(const DSA_PrivateKey&); // hide copy + DSA_PrivateKey& operator=(const DSA_PrivateKey&); // and assign +}; + + + +class DSA_Signer { + const DSA_PrivateKey& key_; + Integer r_; + Integer s_; +public: + explicit DSA_Signer(const DSA_PrivateKey&); + + word32 Sign(const byte* sha_digest, byte* sig, RandomNumberGenerator&); + + const Integer& GetR() const; + const Integer& GetS() const; +private: + DSA_Signer(const DSA_Signer&); // hide copy + DSA_Signer& operator=(DSA_Signer&); // and assign +}; + + +class DSA_Verifier { + const DSA_PublicKey& key_; + Integer r_; + Integer s_; +public: + explicit DSA_Verifier(const DSA_PublicKey&); + + bool Verify(const byte* sha_digest, const byte* sig); + + const Integer& GetR() const; + const Integer& GetS() const; +private: + DSA_Verifier(const DSA_Verifier&); // hide copy + DSA_Verifier& operator=(const DSA_Verifier&); // and assign +}; + + + + + +} // namespace + +#endif // TAO_CRYPT_DSA_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/error.hpp b/externals/mysql/extlib/yassl/taocrypt/include/error.hpp new file mode 100644 index 0000000..ef8b065 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/error.hpp @@ -0,0 +1,88 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* error.hpp provides a taocrypt error numbers + * + */ + + +#ifndef TAO_CRYPT_ERROR_HPP +#define TAO_CRYPT_ERROR_HPP + + +namespace TaoCrypt { + + +enum ErrorNumber { + +NO_ERROR_E = 0, // "not in error state" + +// RandomNumberGenerator +WINCRYPT_E = 1001, // "bad wincrypt acquire" +CRYPTGEN_E = 1002, // "CryptGenRandom error" +OPEN_RAN_E = 1003, // "open /dev/urandom error" +READ_RAN_E = 1004, // "read /dev/urandom error" + +// Integer +INTEGER_E = 1010, // "bad DER Integer Header" + + +// ASN.1 +SEQUENCE_E = 1020, // "bad Sequence Header" +SET_E = 1021, // "bad Set Header" +VERSION_E = 1022, // "version length not 1" +SIG_OID_E = 1023, // "signature OID mismatch" +BIT_STR_E = 1024, // "bad BitString Header" +UNKNOWN_OID_E = 1025, // "unknown key OID type" +OBJECT_ID_E = 1026, // "bad Ojbect ID Header" +TAG_NULL_E = 1027, // "expected TAG NULL" +EXPECT_0_E = 1028, // "expected 0" +OCTET_STR_E = 1029, // "bad Octet String Header" +TIME_E = 1030, // "bad TIME" + +DATE_SZ_E = 1031, // "bad Date Size" +SIG_LEN_E = 1032, // "bad Signature Length" +UNKOWN_SIG_E = 1033, // "unknown signature OID" +UNKOWN_HASH_E = 1034, // "unknown hash OID" +DSA_SZ_E = 1035, // "bad DSA r or s size" +BEFORE_DATE_E = 1036, // "before date in the future" +AFTER_DATE_E = 1037, // "after date in the past" +SIG_CONFIRM_E = 1038, // "bad self signature confirmation" +SIG_OTHER_E = 1039, // "bad other signature confirmation" + +CONTENT_E = 1040, // "bad content processing" +PEM_E = 1041 // "bad pem format error" + + // add error string to yassl/src/yassl_error.cpp !!! +}; + + +struct Error { + ErrorNumber what_; // description number, 0 for no error + + explicit Error(ErrorNumber w = NO_ERROR_E) : what_(w) {} + + ErrorNumber What() const { return what_; } + void SetError(ErrorNumber w) { what_ = w; } +}; + + + +} // namespace TaoCrypt + +#endif // TAO_CRYPT_ERROR_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/file.hpp b/externals/mysql/extlib/yassl/taocrypt/include/file.hpp new file mode 100644 index 0000000..0f85b46 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/file.hpp @@ -0,0 +1,123 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* file.hpp provies File Sources and Sinks +*/ + + +#ifndef TAO_CRYPT_FILE_HPP +#define TAO_CRYPT_FILE_HPP + +#include "misc.hpp" +#include "block.hpp" +#include "error.hpp" +#include + +namespace TaoCrypt { + + +class Source { + ByteBlock buffer_; + word32 current_; + Error error_; +public: + explicit Source(word32 sz = 0) : buffer_(sz), current_(0) {} + Source(const byte* b, word32 sz) : buffer_(b, sz), current_(0) {} + + word32 size() const { return buffer_.size(); } + void grow(word32 sz) { buffer_.CleanGrow(sz); } + + const byte* get_buffer() const { return buffer_.get_buffer(); } + const byte* get_current() const { return &buffer_[current_]; } + word32 get_index() const { return current_; } + void set_index(word32 i) { current_ = i; } + + byte operator[] (word32 i) { current_ = i; return next(); } + byte next() { return buffer_[current_++]; } + byte prev() { return buffer_[--current_]; } + + void add(const byte* data, word32 len) + { + memcpy(buffer_.get_buffer() + current_, data, len); + current_ += len; + } + + void advance(word32 i) { current_ += i; } + void reset(ByteBlock&); + + Error GetError() { return error_; } + void SetError(ErrorNumber w) { error_.SetError(w); } + + friend class FileSource; // for get() + + Source(const Source& that) + : buffer_(that.buffer_), current_(that.current_) {} + + Source& operator=(const Source& that) + { + Source tmp(that); + Swap(tmp); + return *this; + } + + void Swap(Source& other) + { + buffer_.Swap(other.buffer_); + STL::swap(current_, other.current_); + } + +}; + + +// File Source +class FileSource { + FILE* file_; +public: + FileSource(const char* fname, Source& source); + ~FileSource(); + + word32 size(bool use_current = false); +private: + word32 get(Source&); + word32 size_left(); + + FileSource(const FileSource&); // hide + FileSource& operator=(const FileSource&); // hide +}; + + +// File Sink +class FileSink { + FILE* file_; +public: + FileSink(const char* fname, Source& source); + ~FileSink(); + + word32 size(bool use_current = false); +private: + void put(Source&); + + FileSink(const FileSink&); // hide + FileSink& operator=(const FileSink&); // hide +}; + + + +} // namespace + +#endif // TAO_CRYPT_FILE_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/hash.hpp b/externals/mysql/extlib/yassl/taocrypt/include/hash.hpp new file mode 100644 index 0000000..fa5f6c0 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/hash.hpp @@ -0,0 +1,110 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* hash.hpp provides a base for digest types +*/ + + +#ifndef TAO_CRYPT_HASH_HPP +#define TAO_CRYPT_HASH_HPP + +#include "misc.hpp" + +namespace TaoCrypt { + + +// HASH +class HASH : public virtual_base { +public: + virtual ~HASH() {} + + virtual void Update(const byte*, word32) = 0; + virtual void Final(byte*) = 0; + + virtual void Init() = 0; + + virtual word32 getBlockSize() const = 0; + virtual word32 getDigestSize() const = 0; +}; + + +// HASH with Transform +class HASHwithTransform : public HASH { +public: + HASHwithTransform(word32 digSz, word32 buffSz); + virtual ~HASHwithTransform() {} + virtual ByteOrder getByteOrder() const = 0; + virtual word32 getPadSize() const = 0; + + virtual void Update(const byte*, word32); + virtual void Final(byte*); + + word32 GetBitCountLo() const { return loLen_ << 3; } + word32 GetBitCountHi() const { return (loLen_ >> (8*sizeof(loLen_) - 3)) + + (hiLen_ << 3); } + enum { MaxDigestSz = 8, MaxBufferSz = 64 }; +protected: + typedef word32 HashLengthType; + word32 buffLen_; // in bytes + HashLengthType loLen_; // length in bytes + HashLengthType hiLen_; // length in bytes + word32 digest_[MaxDigestSz]; + word32 buffer_[MaxBufferSz / sizeof(word32)]; + + virtual void Transform() = 0; + + void AddLength(word32); +}; + + +#ifdef WORD64_AVAILABLE + +// 64-bit HASH with Transform +class HASH64withTransform : public HASH { +public: + HASH64withTransform(word32 digSz, word32 buffSz); + virtual ~HASH64withTransform() {} + virtual ByteOrder getByteOrder() const = 0; + virtual word32 getPadSize() const = 0; + + virtual void Update(const byte*, word32); + virtual void Final(byte*); + + word32 GetBitCountLo() const { return loLen_ << 3; } + word32 GetBitCountHi() const { return (loLen_ >> (8*sizeof(loLen_) - 3)) + + (hiLen_ << 3); } + enum { MaxDigestSz = 8, MaxBufferSz = 128 }; +protected: + typedef word32 HashLengthType; + word32 buffLen_; // in bytes + HashLengthType loLen_; // length in bytes + HashLengthType hiLen_; // length in bytes + word64 digest_[MaxDigestSz]; + word64 buffer_[MaxBufferSz / sizeof(word64)]; + + virtual void Transform() = 0; + + void AddLength(word32); +}; + +#endif // WORD64_AVAILABLE + + +} // namespace + +#endif // TAO_CRYPT_HASH_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/hmac.hpp b/externals/mysql/extlib/yassl/taocrypt/include/hmac.hpp new file mode 100644 index 0000000..1d48651 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/hmac.hpp @@ -0,0 +1,138 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* hamc.hpp implements HMAC, see RFC 2104 +*/ + + +#ifndef TAO_CRYPT_HMAC_HPP +#define TAO_CRYPT_HMAC_HPP + +#include "hash.hpp" + +namespace TaoCrypt { + + +// HMAC class template +template +class HMAC { +public: + enum { IPAD = 0x36, OPAD = 0x5C }; + + HMAC() : ipad_(reinterpret_cast(&ip_)), + opad_(reinterpret_cast(&op_)), + innerHash_(reinterpret_cast(&innerH_)) + { + Init(); + } + void Update(const byte*, word32); + void Final(byte*); + void Init(); + + void SetKey(const byte*, word32); +private: + byte* ipad_; + byte* opad_; + byte* innerHash_; + bool innerHashKeyed_; + T mac_; + + // MSVC 6 HACK, gives compiler error if calculated in array + enum { HMAC_BSIZE = T::BLOCK_SIZE / sizeof(word32), + HMAC_DSIZE = T::DIGEST_SIZE / sizeof(word32) }; + + word32 ip_[HMAC_BSIZE]; // align ipad_ on word32 + word32 op_[HMAC_BSIZE]; // align opad_ on word32 + word32 innerH_[HMAC_DSIZE]; // align innerHash_ on word32 + + void KeyInnerHash(); + + HMAC(const HMAC&); + HMAC& operator= (const HMAC&); +}; + + +// Setup +template +void HMAC::Init() +{ + mac_.Init(); + innerHashKeyed_ = false; +} + + +// Key generation +template +void HMAC::SetKey(const byte* key, word32 length) +{ + Init(); + + if (length <= T::BLOCK_SIZE) + memcpy(ipad_, key, length); + else { + mac_.Update(key, length); + mac_.Final(ipad_); + length = T::DIGEST_SIZE; + } + memset(ipad_ + length, 0, T::BLOCK_SIZE - length); + + for (word32 i = 0; i < T::BLOCK_SIZE; i++) { + opad_[i] = ipad_[i] ^ OPAD; + ipad_[i] ^= IPAD; + } +} + + +// Inner Key Hash +template +void HMAC::KeyInnerHash() +{ + mac_.Update(ipad_, T::BLOCK_SIZE); + innerHashKeyed_ = true; +} + + +// Update +template +void HMAC::Update(const byte* msg, word32 length) +{ + if (!innerHashKeyed_) + KeyInnerHash(); + mac_.Update(msg, length); +} + + +// Final +template +void HMAC::Final(byte* hash) +{ + if (!innerHashKeyed_) + KeyInnerHash(); + mac_.Final(innerHash_); + + mac_.Update(opad_, T::BLOCK_SIZE); + mac_.Update(innerHash_, T::DIGEST_SIZE); + mac_.Final(hash); + + innerHashKeyed_ = false; +} + + +} // namespace + +#endif // TAO_CRYPT_HMAC_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/integer.hpp b/externals/mysql/extlib/yassl/taocrypt/include/integer.hpp new file mode 100644 index 0000000..186d62b --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/integer.hpp @@ -0,0 +1,328 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's integer.h from CryptoPP */ + + +#ifndef TAO_CRYPT_INTEGER_HPP +#define TAO_CRYPT_INTEGER_HPP + + +#ifdef _MSC_VER + // 4250: dominance + // 4660: explicitly instantiating a class already implicitly instantiated + // 4661: no suitable definition provided for explicit template request + // 4786: identifer was truncated in debug information + // 4355: 'this' : used in base member initializer list +# pragma warning(disable: 4250 4660 4661 4786 4355) +#endif + + +#include "misc.hpp" +#include "block.hpp" +#include "random.hpp" +#include "file.hpp" +#include +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +#ifdef TAOCRYPT_X86ASM_AVAILABLE + +#ifdef _M_IX86 + #if (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 500)) || \ + (defined(__ICL) && (__ICL >= 500)) + #define SSE2_INTRINSICS_AVAILABLE + #define TAOCRYPT_MM_MALLOC_AVAILABLE + #elif defined(_MSC_VER) + // _mm_free seems to be the only way to tell if the Processor Pack is + //installed or not + #include + #if defined(_mm_free) + #define SSE2_INTRINSICS_AVAILABLE + #define TAOCRYPT_MM_MALLOC_AVAILABLE + #endif + #endif +#endif + +// SSE2 intrinsics work in GCC 3.3 or later +#if defined(__SSE2__) && (__GNUC__ == 4 || __GNUC_MAJOR__ > 3 || \ + __GNUC_MINOR__ > 2) + #define SSE2_INTRINSICS_AVAILABLE +#endif + +#endif // X86ASM + + + + +namespace TaoCrypt { + +#if defined(SSE2_INTRINSICS_AVAILABLE) + + // Allocator handling proper alignment + template + class AlignedAllocator : public AllocatorBase + { + public: + typedef typename AllocatorBase::pointer pointer; + typedef typename AllocatorBase::size_type size_type; + + pointer allocate(size_type n, const void* = 0); + void deallocate(void* p, size_type n); + pointer reallocate(T* p, size_type oldSize, size_type newSize, + bool preserve) + { + return StdReallocate(*this, p, oldSize, newSize, preserve); + } + + #if !(defined(TAOCRYPT_MALLOC_ALIGNMENT_IS_16) || \ + defined(TAOCRYPT_MEMALIGN_AVAILABLE) || \ + defined(TAOCRYPT_MM_MALLOC_AVAILABLE)) + #define TAOCRYPT_NO_ALIGNED_ALLOC + AlignedAllocator() : m_pBlock(0) {} + protected: + void *m_pBlock; + #endif + }; + + typedef Block > AlignedWordBlock; +#else + typedef WordBlock AlignedWordBlock; +#endif + + +// general MIN +template inline +const T& min(const T& a, const T& b) +{ + return a < b ? a : b; +} + + +// general MAX +template inline +const T& max(const T& a, const T& b) +{ + return a > b ? a : b; +} + + +// Large Integer class +class Integer { +public: + enum Sign {POSITIVE = 0, NEGATIVE = 1 }; + enum Signedness { UNSIGNED, SIGNED }; + enum RandomNumberType { ANY, PRIME }; + + class DivideByZero {}; + + Integer(); + Integer(const Integer& t); + Integer(signed long value); + Integer(Sign s, word highWord, word lowWord); + + // BER Decode Source + explicit Integer(Source&); + + Integer(const byte* encodedInteger, unsigned int byteCount, + Signedness s = UNSIGNED); + + ~Integer() {} + + static const Integer& Zero(); + static const Integer& One(); + + Integer& Ref() { return *this; } + + Integer(RandomNumberGenerator& rng, const Integer& min, + const Integer& max); + + static Integer Power2(unsigned int e); + + unsigned int MinEncodedSize(Signedness = UNSIGNED) const; + unsigned int Encode(byte* output, unsigned int outputLen, + Signedness = UNSIGNED) const; + + void Decode(const byte* input, unsigned int inputLen, + Signedness = UNSIGNED); + void Decode(Source&); + + bool IsConvertableToLong() const; + signed long ConvertToLong() const; + + unsigned int BitCount() const; + unsigned int ByteCount() const; + unsigned int WordCount() const; + + bool GetBit(unsigned int i) const; + byte GetByte(unsigned int i) const; + unsigned long GetBits(unsigned int i, unsigned int n) const; + + bool IsZero() const { return !*this; } + bool NotZero() const { return !IsZero(); } + bool IsNegative() const { return sign_ == NEGATIVE; } + bool NotNegative() const { return !IsNegative(); } + bool IsPositive() const { return NotNegative() && NotZero(); } + bool NotPositive() const { return !IsPositive(); } + bool IsEven() const { return GetBit(0) == 0; } + bool IsOdd() const { return GetBit(0) == 1; } + + Integer& operator=(const Integer& t); + Integer& operator+=(const Integer& t); + Integer& operator-=(const Integer& t); + Integer& operator*=(const Integer& t) { return *this = Times(t); } + Integer& operator/=(const Integer& t) + { return *this = DividedBy(t);} + Integer& operator%=(const Integer& t) { return *this = Modulo(t); } + Integer& operator/=(word t) { return *this = DividedBy(t); } + Integer& operator%=(word t) { return *this = Modulo(t); } + Integer& operator<<=(unsigned int); + Integer& operator>>=(unsigned int); + + + void Randomize(RandomNumberGenerator &rng, unsigned int bitcount); + void Randomize(RandomNumberGenerator &rng, const Integer &min, + const Integer &max); + + void SetBit(unsigned int n, bool value = 1); + void SetByte(unsigned int n, byte value); + + void Negate(); + void SetPositive() { sign_ = POSITIVE; } + void SetNegative() { if (!!(*this)) sign_ = NEGATIVE; } + void Swap(Integer& a); + + bool operator!() const; + Integer operator+() const {return *this;} + Integer operator-() const; + Integer& operator++(); + Integer& operator--(); + Integer operator++(int) + { Integer temp = *this; ++*this; return temp; } + Integer operator--(int) + { Integer temp = *this; --*this; return temp; } + + int Compare(const Integer& a) const; + + Integer Plus(const Integer &b) const; + Integer Minus(const Integer &b) const; + Integer Times(const Integer &b) const; + Integer DividedBy(const Integer &b) const; + Integer Modulo(const Integer &b) const; + Integer DividedBy(word b) const; + word Modulo(word b) const; + + Integer operator>>(unsigned int n) const { return Integer(*this)>>=n; } + Integer operator<<(unsigned int n) const { return Integer(*this)<<=n; } + + Integer AbsoluteValue() const; + Integer Doubled() const { return Plus(*this); } + Integer Squared() const { return Times(*this); } + Integer SquareRoot() const; + + bool IsSquare() const; + bool IsUnit() const; + + Integer MultiplicativeInverse() const; + + friend Integer a_times_b_mod_c(const Integer& x, const Integer& y, + const Integer& m); + friend Integer a_exp_b_mod_c(const Integer& x, const Integer& e, + const Integer& m); + + static void Divide(Integer& r, Integer& q, const Integer& a, + const Integer& d); + static void Divide(word& r, Integer& q, const Integer& a, word d); + static void DivideByPowerOf2(Integer& r, Integer& q, const Integer& a, + unsigned int n); + static Integer Gcd(const Integer& a, const Integer& n); + + Integer InverseMod(const Integer& n) const; + word InverseMod(word n) const; + +private: + friend class ModularArithmetic; + friend class MontgomeryRepresentation; + + Integer(word value, unsigned int length); + int PositiveCompare(const Integer& t) const; + + friend void PositiveAdd(Integer& sum, const Integer& a, const Integer& b); + friend void PositiveSubtract(Integer& diff, const Integer& a, + const Integer& b); + friend void PositiveMultiply(Integer& product, const Integer& a, + const Integer& b); + friend void PositiveDivide(Integer& remainder, Integer& quotient, const + Integer& dividend, const Integer& divisor); + AlignedWordBlock reg_; + Sign sign_; +}; + +inline bool operator==(const Integer& a, const Integer& b) + {return a.Compare(b)==0;} +inline bool operator!=(const Integer& a, const Integer& b) + {return a.Compare(b)!=0;} +inline bool operator> (const Integer& a, const Integer& b) + {return a.Compare(b)> 0;} +inline bool operator>=(const Integer& a, const Integer& b) + {return a.Compare(b)>=0;} +inline bool operator< (const Integer& a, const Integer& b) + {return a.Compare(b)< 0;} +inline bool operator<=(const Integer& a, const Integer& b) + {return a.Compare(b)<=0;} + +inline Integer operator+(const Integer &a, const Integer &b) + {return a.Plus(b);} +inline Integer operator-(const Integer &a, const Integer &b) + {return a.Minus(b);} +inline Integer operator*(const Integer &a, const Integer &b) + {return a.Times(b);} +inline Integer operator/(const Integer &a, const Integer &b) + {return a.DividedBy(b);} +inline Integer operator%(const Integer &a, const Integer &b) + {return a.Modulo(b);} +inline Integer operator/(const Integer &a, word b) {return a.DividedBy(b);} +inline word operator%(const Integer &a, word b) {return a.Modulo(b);} + +inline void swap(Integer &a, Integer &b) +{ + a.Swap(b); +} + + +Integer CRT(const Integer& xp, const Integer& p, const Integer& xq, + const Integer& q, const Integer& u); + +inline Integer ModularExponentiation(const Integer& a, const Integer& e, + const Integer& m) +{ + return a_exp_b_mod_c(a, e, m); +} + +Integer ModularRoot(const Integer& a, const Integer& dp, const Integer& dq, + const Integer& p, const Integer& q, const Integer& u); + + + +} // namespace + +#endif // TAO_CRYPT_INTEGER_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/kernelc.hpp b/externals/mysql/extlib/yassl/taocrypt/include/kernelc.hpp new file mode 100644 index 0000000..daa3762 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/kernelc.hpp @@ -0,0 +1,46 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* kernelc.hpp provides support for C std lib when compiled in kernel mode +*/ + +#ifndef TAOCRYPT_KERNELC_HPP +#define TAOCRYPT_KERNELC_HPP + +#include // get right size_t + +// system functions that c++ doesn't like headers for + +extern "C" void* memcpy(void*, const void*, size_t); +extern "C" void* memset(void*, int, size_t); +extern "C" void printk(char *fmt, ...); + +#define KERN_ERR "<3>" /* error conditions */ + +#if defined(NDEBUG) + #define assert(p) ((void)0) +#else + #define assert(expr) \ + if (!(expr)) { \ + printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ + #expr,__FILE__,__FUNCTION__,__LINE__); } +#endif + + + +#endif // TAOCRYPT_KERNELC_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/md2.hpp b/externals/mysql/extlib/yassl/taocrypt/include/md2.hpp new file mode 100644 index 0000000..cb13d86 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/md2.hpp @@ -0,0 +1,64 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* md2.hpp provides MD2 digest support, see RFC 1319 +*/ + +#ifndef TAO_CRYPT_MD2_HPP +#define TAO_CRYPT_MD2_HPP + + +#include "hash.hpp" +#include "block.hpp" + + +namespace TaoCrypt { + + +// MD2 digest +class MD2 : public HASH { +public: + enum { BLOCK_SIZE = 16, DIGEST_SIZE = 16, PAD_SIZE = 16, X_SIZE = 48 }; + MD2(); + + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + + void Update(const byte*, word32); + void Final(byte*); + + void Init(); + void Swap(MD2&); +private: + ByteBlock X_, C_, buffer_; + word32 count_; // bytes % PAD_SIZE + + MD2(const MD2&); + MD2& operator=(const MD2&); +}; + +inline void swap(MD2& a, MD2& b) +{ + a.Swap(b); +} + + +} // namespace + +#endif // TAO_CRYPT_MD2_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/md4.hpp b/externals/mysql/extlib/yassl/taocrypt/include/md4.hpp new file mode 100644 index 0000000..28c2bc7 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/md4.hpp @@ -0,0 +1,62 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* md4.hpp provides MD4 digest support + * WANRING: MD4 is considered insecure, only use if you have to, e.g., yaSSL + * libcurl supports needs this for NTLM authentication +*/ + +#ifndef TAO_CRYPT_MD4_HPP +#define TAO_CRYPT_MD4_HPP + +#include "hash.hpp" + +namespace TaoCrypt { + + +// MD4 digest +class MD4 : public HASHwithTransform { +public: + enum { BLOCK_SIZE = 64, DIGEST_SIZE = 16, PAD_SIZE = 56, + TAO_BYTE_ORDER = LittleEndianOrder }; // in Bytes + MD4() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + + MD4(const MD4&); + MD4& operator= (const MD4&); + + void Init(); + void Swap(MD4&); +private: + void Transform(); +}; + +inline void swap(MD4& a, MD4& b) +{ + a.Swap(b); +} + + +} // namespace + +#endif // TAO_CRYPT_MD4_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/md5.hpp b/externals/mysql/extlib/yassl/taocrypt/include/md5.hpp new file mode 100644 index 0000000..9b46154 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/md5.hpp @@ -0,0 +1,70 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* md5.hpp provides MD5 digest support, see RFC 1321 +*/ + +#ifndef TAO_CRYPT_MD5_HPP +#define TAO_CRYPT_MD5_HPP + +#include "hash.hpp" + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_MD5_ASM +#endif + +namespace TaoCrypt { + + +// MD5 digest +class MD5 : public HASHwithTransform { +public: + enum { BLOCK_SIZE = 64, DIGEST_SIZE = 16, PAD_SIZE = 56, + TAO_BYTE_ORDER = LittleEndianOrder }; // in Bytes + MD5() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + + MD5(const MD5&); + MD5& operator= (const MD5&); + +#ifdef DO_MD5_ASM + void Update(const byte*, word32); +#endif + + void Init(); + void Swap(MD5&); +private: + void Transform(); + void AsmTransform(const byte* data, word32 times); +}; + +inline void swap(MD5& a, MD5& b) +{ + a.Swap(b); +} + + +} // namespace + +#endif // TAO_CRYPT_MD5_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/misc.hpp b/externals/mysql/extlib/yassl/taocrypt/include/misc.hpp new file mode 100644 index 0000000..a101a14 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/misc.hpp @@ -0,0 +1,886 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's misc.h from CryptoPP */ + +#ifndef TAO_CRYPT_MISC_HPP +#define TAO_CRYPT_MISC_HPP + + +#if !defined(DO_TAOCRYPT_KERNEL_MODE) + #include + #include + #include +#else + #include "kernelc.hpp" +#endif + +#include "types.hpp" +#include "type_traits.hpp" + + + +namespace TaoCrypt { + + +// Delete static singleton holders +void CleanUp(); + + +#ifdef YASSL_PURE_C + + // library allocation + struct new_t {}; // TaoCrypt New type + extern new_t tc; // pass in parameter + + } // namespace TaoCrypt + + void* operator new (size_t, TaoCrypt::new_t); + void* operator new[](size_t, TaoCrypt::new_t); + + void operator delete (void*, TaoCrypt::new_t); + void operator delete[](void*, TaoCrypt::new_t); + + + namespace TaoCrypt { + + template + void tcDelete(T* ptr) + { + if (ptr) ptr->~T(); + ::operator delete(ptr, TaoCrypt::tc); + } + + template + void tcArrayDelete(T* ptr) + { + // can't do array placement destruction since not tracking size in + // allocation, only allow builtins to use array placement since they + // don't need destructors called + typedef char builtin[IsFundamentalType::Yes ? 1 : -1]; + (void)sizeof(builtin); + + ::operator delete[](ptr, TaoCrypt::tc); + } + + #define NEW_TC new (TaoCrypt::tc) + + + // to resolve compiler generated operator delete on base classes with + // virtual destructors (when on stack), make sure doesn't get called + class virtual_base { + public: + static void operator delete(void*) { assert(0); } + }; + +#else // YASSL_PURE_C + + + template + void tcDelete(T* ptr) + { + delete ptr; + } + + template + void tcArrayDelete(T* ptr) + { + delete[] ptr; + } + + #define NEW_TC new + + class virtual_base {}; + + +#endif // YASSL_PURE_C + + +#if defined(_MSC_VER) || defined(__BCPLUSPLUS__) + #define INTEL_INTRINSICS + #define FAST_ROTATE +#elif defined(__MWERKS__) && TARGET_CPU_PPC + #define PPC_INTRINSICS + #define FAST_ROTATE +#elif defined(__GNUC__) && defined(__i386__) + // GCC does peephole optimizations which should result in using rotate + // instructions + #define FAST_ROTATE +#endif + + +// no gas on these systems ?, disable for now +#if defined(__sun__) || defined (__QNX__) || defined (__APPLE__) + #define TAOCRYPT_DISABLE_X86ASM +#endif + +// icc problem with -03 and integer, disable for now +#if defined(__INTEL_COMPILER) + #define TAOCRYPT_DISABLE_X86ASM +#endif + + +// Turn on ia32 ASM for Big Integer +// CodeWarrior defines _MSC_VER +#if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \ + !defined(__MWERKS__) && defined(_M_IX86)) || \ + (defined(__GNUC__) && defined(__i386__))) + #define TAOCRYPT_X86ASM_AVAILABLE +#endif + + +#ifdef TAOCRYPT_X86ASM_AVAILABLE + bool HaveCpuId(); + bool IsPentium(); + void CpuId(word32 input, word32 *output); + + extern bool isMMX; +#endif + + + + +// Turn on ia32 ASM for Ciphers and Message Digests +// Seperate define since these are more complex, use member offsets +// and user may want to turn off while leaving Big Integer optos on +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && !defined(DISABLE_TAO_ASM) + #define TAO_ASM +#endif + + +// Extra word in older vtable implementations, for ASM member offset +#if defined(__GNUC__) && __GNUC__ < 3 + #define OLD_GCC_OFFSET +#endif + + +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +# define TAOCRYPT_MALLOC_ALIGNMENT_IS_16 +#endif + +#if defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) +# define TAOCRYPT_MEMALIGN_AVAILABLE +#endif + + +#if defined(_WIN32) || defined(__CYGWIN__) + #define TAOCRYPT_WIN32_AVAILABLE +#endif + +#if defined(__unix__) || defined(__MACH__) + #define TAOCRYPT_UNIX_AVAILABLE +#endif + + +// VC60 workaround: it doesn't allow typename in some places +#if defined(_MSC_VER) && (_MSC_VER < 1300) + #define CPP_TYPENAME +#else + #define CPP_TYPENAME typename +#endif + + +#ifdef _MSC_VER + #define TAOCRYPT_NO_VTABLE __declspec(novtable) +#else + #define TAOCRYPT_NO_VTABLE +#endif + + +#ifdef USE_SYS_STL + // use system STL + #define STL_NAMESPACE std +#else + // use mySTL + #define STL_NAMESPACE mySTL +#endif + + +// ***************** DLL related ******************** + +#ifdef TAOCRYPT_WIN32_AVAILABLE + +#ifdef TAOCRYPT_EXPORTS + #define TAOCRYPT_IS_DLL + #define TAOCRYPT_DLL __declspec(dllexport) +#elif defined(TAOCRYPT_IMPORTS) + #define TAOCRYPT_IS_DLL + #define TAOCRYPT_DLL __declspec(dllimport) +#else + #define TAOCRYPT_DLL +#endif // EXPORTS + +#define TAOCRYPT_API __stdcall +#define TAOCRYPT_CDECL __cdecl + +#else // TAOCRYPT_WIN32_AVAILABLE + +#define TAOCRYPT_DLL +#define TAOCRYPT_API +#define TAOCRYPT_CDECL + +#endif // TAOCRYPT_WIN32_AVAILABLE + + +// ****************** tempalte stuff ******************* + + +#if defined(TAOCRYPT_MANUALLY_INSTANTIATE_TEMPLATES) && \ + !defined(TAOCRYPT_IMPORTS) + #define TAOCRYPT_DLL_TEMPLATE_CLASS template class TAOCRYPT_DLL +#elif defined(__MWERKS__) + #define TAOCRYPT_DLL_TEMPLATE_CLASS extern class TAOCRYPT_DLL +#else + #define TAOCRYPT_DLL_TEMPLATE_CLASS extern template class TAOCRYPT_DLL +#endif + + +#if defined(TAOCRYPT_MANUALLY_INSTANTIATE_TEMPLATES) && \ + !defined(TAOCRYPT_EXPORTS) + #define TAOCRYPT_STATIC_TEMPLATE_CLASS template class +#elif defined(__MWERKS__) + #define TAOCRYPT_STATIC_TEMPLATE_CLASS extern class +#else + #define TAOCRYPT_STATIC_TEMPLATE_CLASS extern template class +#endif + + +// ************** compile-time assertion *************** + +template +struct CompileAssert +{ + static char dummy[2*b-1]; +}; + +#define TAOCRYPT_COMPILE_ASSERT(assertion) \ + TAOCRYPT_COMPILE_ASSERT_INSTANCE(assertion, __LINE__) + +#if defined(TAOCRYPT_EXPORTS) || defined(TAOCRYPT_IMPORTS) + #define TAOCRYPT_COMPILE_ASSERT_INSTANCE(assertion, instance) +#else + #define TAOCRYPT_COMPILE_ASSERT_INSTANCE(assertion, instance) \ + (void)sizeof(CompileAssert<(assertion)>) +#endif + +#define TAOCRYPT_ASSERT_JOIN(X, Y) TAOCRYPT_DO_ASSERT_JOIN(X, Y) + +#define TAOCRYPT_DO_ASSERT_JOIN(X, Y) X##Y + + +/*************** helpers *****************************/ + +inline unsigned int BitsToBytes(unsigned int bitCount) +{ + return ((bitCount+7)/(8)); +} + +inline unsigned int BytesToWords(unsigned int byteCount) +{ + return ((byteCount+WORD_SIZE-1)/WORD_SIZE); +} + +inline unsigned int BitsToWords(unsigned int bitCount) +{ + return ((bitCount+WORD_BITS-1)/(WORD_BITS)); +} + +inline void CopyWords(word* r, const word* a, word32 n) +{ + for (word32 i = 0; i < n; i++) + r[i] = a[i]; +} + +inline unsigned int CountWords(const word* X, unsigned int N) +{ + while (N && X[N-1]==0) + N--; + return N; +} + +inline void SetWords(word* r, word a, unsigned int n) +{ + for (unsigned int i=0; i +struct EnumToType +{ + static ENUM_TYPE ToEnum() { return (ENUM_TYPE)VALUE; } +}; + +typedef EnumToType LittleEndian; +typedef EnumToType BigEndian; + + +#ifndef BIG_ENDIAN_ORDER + typedef LittleEndian HostByteOrder; +#else + typedef BigEndian HostByteOrder; +#endif + +inline ByteOrder GetHostByteOrder() +{ + return HostByteOrder::ToEnum(); +} + +inline bool HostByteOrderIs(ByteOrder order) +{ + return order == GetHostByteOrder(); +} + + +void xorbuf(byte*, const byte*, unsigned int); + + +template +inline bool IsPowerOf2(T n) +{ + return n > 0 && (n & (n-1)) == 0; +} + +template +inline T2 ModPowerOf2(T1 a, T2 b) +{ + assert(IsPowerOf2(b)); + return T2(a) & (b-1); +} + +template +inline T RoundDownToMultipleOf(T n, T m) +{ + return n - (IsPowerOf2(m) ? ModPowerOf2(n, m) : (n%m)); +} + +template +inline T RoundUpToMultipleOf(T n, T m) +{ + return RoundDownToMultipleOf(n+m-1, m); +} + +template +inline unsigned int GetAlignment(T* dummy = 0) // VC60 workaround +{ +#if (_MSC_VER >= 1300) + return __alignof(T); +#elif defined(__GNUC__) + return __alignof__(T); +#else + return sizeof(T); +#endif +} + +inline bool IsAlignedOn(const void* p, unsigned int alignment) +{ + return IsPowerOf2(alignment) ? ModPowerOf2((size_t)p, alignment) == 0 + : (size_t)p % alignment == 0; +} + +template +inline bool IsAligned(const void* p, T* dummy = 0) // VC60 workaround +{ + return IsAlignedOn(p, GetAlignment()); +} + + +template inline T rotlFixed(T x, unsigned int y) +{ + assert(y < sizeof(T)*8); + return (x<>(sizeof(T)*8-y)); +} + +template inline T rotrFixed(T x, unsigned int y) +{ + assert(y < sizeof(T)*8); + return (x>>y) | (x<<(sizeof(T)*8-y)); +} + +#ifdef INTEL_INTRINSICS + +#pragma intrinsic(_lrotl, _lrotr) + +template<> inline word32 rotlFixed(word32 x, word32 y) +{ + assert(y < 32); + return y ? _lrotl(x, y) : x; +} + +template<> inline word32 rotrFixed(word32 x, word32 y) +{ + assert(y < 32); + return y ? _lrotr(x, y) : x; +} + +#endif // INTEL_INTRINSICS + +#ifndef min +inline word32 min(word32 a, word32 b) +{ + return a < b ? a : b; +} +#endif + + +inline word32 ByteReverse(word32 value) +{ +#ifdef PPC_INTRINSICS + // PPC: load reverse indexed instruction + return (word32)__lwbrx(&value,0); +#elif defined(FAST_ROTATE) + // 5 instructions with rotate instruction, 9 without + return (rotrFixed(value, 8U) & 0xff00ff00) | + (rotlFixed(value, 8U) & 0x00ff00ff); +#else + // 6 instructions with rotate instruction, 8 without + value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8); + return rotlFixed(value, 16U); +#endif +} + + +#ifdef WORD64_AVAILABLE + +inline word64 ByteReverse(word64 value) +{ +#ifdef TAOCRYPT_SLOW_WORD64 + return (word64(ByteReverse(word32(value))) << 32) | + ByteReverse(word32(value>>32)); +#else + value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) | + ((value & W64LIT(0x00FF00FF00FF00FF)) << 8); + value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) | + ((value & W64LIT(0x0000FFFF0000FFFF)) << 16); + return rotlFixed(value, 32U); +#endif +} + +#endif // WORD64_AVAILABLE + + +template +inline void ByteReverse(T* out, const T* in, word32 byteCount) +{ + assert(byteCount % sizeof(T) == 0); + word32 count = byteCount/sizeof(T); + for (word32 i=0; i(out); + const word32* i = reinterpret_cast(in); + ByteReverse(o, i, byteCount); +} + + +template +inline T ByteReverseIf(T value, ByteOrder order) +{ + return HostByteOrderIs(order) ? value : ByteReverse(value); +} + + +template +inline void ByteReverseIf(T* out, const T* in, word32 bc, ByteOrder order) +{ + if (!HostByteOrderIs(order)) + ByteReverse(out, in, bc); + else if (out != in) + memcpy(out, in, bc); +} + + + +// do Asm Reverse is host is Little and x86asm +#ifdef LITTLE_ENDIAN_ORDER + #ifdef TAOCRYPT_X86ASM_AVAILABLE + #define LittleReverse AsmReverse + #else + #define LittleReverse ByteReverse + #endif +#else + #define LittleReverse +#endif + + +// do Asm Reverse is host is Big and x86asm +#ifdef BIG_ENDIAN_ORDER + #ifdef TAOCRYPT_X86ASM_AVAILABLE + #define BigReverse AsmReverse + #else + #define BigReverse ByteReverse + #endif +#else + #define BigReverse +#endif + + +#ifdef TAOCRYPT_X86ASM_AVAILABLE + + // faster than rotate, use bswap + + inline word32 AsmReverse(word32 wd) + { + #ifdef __GNUC__ + __asm__ + ( + "bswap %1" + : "=r"(wd) + : "0"(wd) + ); + #else + __asm + { + mov eax, wd + bswap eax + mov wd, eax + } + #endif + return wd; + } + +#endif + + +template +inline void GetUserKey(ByteOrder order, T* out, word32 outlen, const byte* in, + word32 inlen) +{ + const unsigned int U = sizeof(T); + assert(inlen <= outlen*U); + memcpy(out, in, inlen); + memset((byte *)out+inlen, 0, outlen*U-inlen); + ByteReverseIf(out, out, RoundUpToMultipleOf(inlen, U), order); +} + + +#ifdef _MSC_VER + // disable conversion warning + #pragma warning(disable:4244) +#endif + + +inline byte UnalignedGetWordNonTemplate(ByteOrder order, const byte *block, + byte*) +{ + return block[0]; +} + +inline word16 UnalignedGetWordNonTemplate(ByteOrder order, const byte* block, + word16*) +{ + return (order == BigEndianOrder) + ? block[1] | (block[0] << 8) + : block[0] | (block[1] << 8); +} + +inline word32 UnalignedGetWordNonTemplate(ByteOrder order, const byte* block, + word32*) +{ + return (order == BigEndianOrder) + ? word32(block[3]) | (word32(block[2]) << 8) | (word32(block[1]) << 16) + | (word32(block[0]) << 24) + : word32(block[0]) | (word32(block[1]) << 8) | (word32(block[2]) << 16) + | (word32(block[3]) << 24); +} + +template +inline T UnalignedGetWord(ByteOrder order, const byte *block, T* dummy = 0) +{ + return UnalignedGetWordNonTemplate(order, block, dummy); +} + +inline void UnalignedPutWord(ByteOrder order, byte *block, byte value, + const byte *xorBlock = 0) +{ + block[0] = xorBlock ? (value ^ xorBlock[0]) : value; +} + +#define GETBYTE(x, y) (unsigned int)byte((x)>>(8*(y))) + +inline void UnalignedPutWord(ByteOrder order, byte *block, word16 value, + const byte *xorBlock = 0) +{ + if (order == BigEndianOrder) + { + block[0] = GETBYTE(value, 1); + block[1] = GETBYTE(value, 0); + } + else + { + block[0] = GETBYTE(value, 0); + block[1] = GETBYTE(value, 1); + } + + if (xorBlock) + { + block[0] ^= xorBlock[0]; + block[1] ^= xorBlock[1]; + } +} + +inline void UnalignedPutWord(ByteOrder order, byte* block, word32 value, + const byte* xorBlock = 0) +{ + if (order == BigEndianOrder) + { + block[0] = GETBYTE(value, 3); + block[1] = GETBYTE(value, 2); + block[2] = GETBYTE(value, 1); + block[3] = GETBYTE(value, 0); + } + else + { + block[0] = GETBYTE(value, 0); + block[1] = GETBYTE(value, 1); + block[2] = GETBYTE(value, 2); + block[3] = GETBYTE(value, 3); + } + + if (xorBlock) + { + block[0] ^= xorBlock[0]; + block[1] ^= xorBlock[1]; + block[2] ^= xorBlock[2]; + block[3] ^= xorBlock[3]; + } +} + + +template +inline T GetWord(bool assumeAligned, ByteOrder order, const byte *block) +{ + if (assumeAligned) + { + assert(IsAligned(block)); + return ByteReverseIf(*reinterpret_cast(block), order); + } + else + return UnalignedGetWord(order, block); +} + +template +inline void GetWord(bool assumeAligned, ByteOrder order, T &result, + const byte *block) +{ + result = GetWord(assumeAligned, order, block); +} + +template +inline void PutWord(bool assumeAligned, ByteOrder order, byte* block, T value, + const byte *xorBlock = 0) +{ + if (assumeAligned) + { + assert(IsAligned(block)); + if (xorBlock) + *reinterpret_cast(block) = ByteReverseIf(value, order) + ^ *reinterpret_cast(xorBlock); + else + *reinterpret_cast(block) = ByteReverseIf(value, order); + } + else + UnalignedPutWord(order, block, value, xorBlock); +} + +template +class GetBlock +{ +public: + GetBlock(const void *block) + : m_block((const byte *)block) {} + + template + inline GetBlock & operator()(U &x) + { + TAOCRYPT_COMPILE_ASSERT(sizeof(U) >= sizeof(T)); + x = GetWord(A, B::ToEnum(), m_block); + m_block += sizeof(T); + return *this; + } + +private: + const byte *m_block; +}; + +template +class PutBlock +{ +public: + PutBlock(const void *xorBlock, void *block) + : m_xorBlock((const byte *)xorBlock), m_block((byte *)block) {} + + template + inline PutBlock & operator()(U x) + { + PutWord(A, B::ToEnum(), m_block, (T)x, m_xorBlock); + m_block += sizeof(T); + if (m_xorBlock) + m_xorBlock += sizeof(T); + return *this; + } + +private: + const byte *m_xorBlock; + byte *m_block; +}; + +template +struct BlockGetAndPut +{ + // function needed because of C++ grammatical ambiguity between + // expression-statements and declarations + static inline GetBlock Get(const void *block) + {return GetBlock(block);} + typedef PutBlock Put; +}; + + + +template struct SafeShifter; + +template<> struct SafeShifter +{ + template + static inline T RightShift(T value, unsigned int bits) + { + return 0; + } + + template + static inline T LeftShift(T value, unsigned int bits) + { + return 0; + } +}; + +template<> struct SafeShifter +{ + template + static inline T RightShift(T value, unsigned int bits) + { + return value >> bits; + } + + template + static inline T LeftShift(T value, unsigned int bits) + { + return value << bits; + } +}; + +template +inline T SafeRightShift(T value) +{ + return SafeShifter<(bits>=(8*sizeof(T)))>::RightShift(value, bits); +} + +template +inline T SafeLeftShift(T value) +{ + return SafeShifter<(bits>=(8*sizeof(T)))>::LeftShift(value, bits); +} + + +inline +word ShiftWordsLeftByBits(word* r, unsigned int n, unsigned int shiftBits) +{ + assert (shiftBits> (WORD_BITS-shiftBits); + } + return carry; +} + + +inline +word ShiftWordsRightByBits(word* r, unsigned int n, unsigned int shiftBits) +{ + assert (shiftBits=0; i--) + { + u = r[i]; + r[i] = (u >> shiftBits) | carry; + carry = u << (WORD_BITS-shiftBits); + } + return carry; +} + + +inline +void ShiftWordsLeftByWords(word* r, unsigned int n, unsigned int shiftWords) +{ + shiftWords = min(shiftWords, n); + if (shiftWords) + { + for (unsigned int i=n-1; i>=shiftWords; i--) + r[i] = r[i-shiftWords]; + SetWords(r, 0, shiftWords); + } +} + + +inline +void ShiftWordsRightByWords(word* r, unsigned int n, unsigned int shiftWords) +{ + shiftWords = min(shiftWords, n); + if (shiftWords) + { + for (unsigned int i=0; i+shiftWords +inline T1 SaturatingSubtract(T1 a, T2 b) +{ + TAOCRYPT_COMPILE_ASSERT_INSTANCE(T1(-1)>0, 0); // T1 is unsigned type + TAOCRYPT_COMPILE_ASSERT_INSTANCE(T2(-1)>0, 1); // T2 is unsigned type + return T1((a > b) ? (a - b) : 0); +} + + +// declares +unsigned int BytePrecision(word value); +unsigned int BitPrecision(word); +word Crop(word value, unsigned int size); + + + +} // namespace + +#endif // TAO_CRYPT_MISC_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/modarith.hpp b/externals/mysql/extlib/yassl/taocrypt/include/modarith.hpp new file mode 100644 index 0000000..501a812 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/modarith.hpp @@ -0,0 +1,165 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* based on Wei Dai's modarith.h from CryptoPP */ + + +#ifndef TAO_CRYPT_MODARITH_HPP +#define TAO_CRYPT_MODARITH_HPP + +#include "misc.hpp" +#include "algebra.hpp" + +namespace TaoCrypt { + + +// ModularArithmetic +class ModularArithmetic : public AbstractRing +{ +public: + + typedef int RandomizationParameter; + typedef Integer Element; + + ModularArithmetic(const Integer &modulus = Integer::One()) + : modulus(modulus), result((word)0, modulus.reg_.size()) {} + + ModularArithmetic(const ModularArithmetic &ma) + : AbstractRing(), + modulus(ma.modulus), result((word)0, modulus.reg_.size()) {} + + const Integer& GetModulus() const {return modulus;} + void SetModulus(const Integer &newModulus) + { + modulus = newModulus; + result.reg_.resize(modulus.reg_.size()); + } + + virtual bool IsMontgomeryRepresentation() const {return false;} + + virtual Integer ConvertIn(const Integer &a) const + {return a%modulus;} + + virtual Integer ConvertOut(const Integer &a) const + {return a;} + + const Integer& Half(const Integer &a) const; + + bool Equal(const Integer &a, const Integer &b) const + {return a==b;} + + const Integer& Identity() const + {return Integer::Zero();} + + const Integer& Add(const Integer &a, const Integer &b) const; + + Integer& Accumulate(Integer &a, const Integer &b) const; + + const Integer& Inverse(const Integer &a) const; + + const Integer& Subtract(const Integer &a, const Integer &b) const; + + Integer& Reduce(Integer &a, const Integer &b) const; + + const Integer& Double(const Integer &a) const + {return Add(a, a);} + + const Integer& MultiplicativeIdentity() const + {return Integer::One();} + + const Integer& Multiply(const Integer &a, const Integer &b) const + {return result1 = a*b%modulus;} + + const Integer& Square(const Integer &a) const + {return result1 = a.Squared()%modulus;} + + bool IsUnit(const Integer &a) const + {return Integer::Gcd(a, modulus).IsUnit();} + + const Integer& MultiplicativeInverse(const Integer &a) const + {return result1 = a.InverseMod(modulus);} + + const Integer& Divide(const Integer &a, const Integer &b) const + {return Multiply(a, MultiplicativeInverse(b));} + + Integer CascadeExponentiate(const Integer &x, const Integer &e1, + const Integer &y, const Integer &e2) const; + + void SimultaneousExponentiate(Element *results, const Element &base, + const Integer *exponents, unsigned int exponentsCount) const; + + unsigned int MaxElementBitLength() const + {return (modulus-1).BitCount();} + + unsigned int MaxElementByteLength() const + {return (modulus-1).ByteCount();} + + + static const RandomizationParameter DefaultRandomizationParameter; + +protected: + Integer modulus; + mutable Integer result, result1; + +}; + + + +//! do modular arithmetics in Montgomery representation for increased speed +class MontgomeryRepresentation : public ModularArithmetic +{ +public: + MontgomeryRepresentation(const Integer &modulus); // modulus must be odd + + bool IsMontgomeryRepresentation() const {return true;} + + Integer ConvertIn(const Integer &a) const + {return (a<<(WORD_BITS*modulus.reg_.size()))%modulus;} + + Integer ConvertOut(const Integer &a) const; + + const Integer& MultiplicativeIdentity() const + {return result1 = Integer::Power2(WORD_BITS*modulus.reg_.size())%modulus;} + + const Integer& Multiply(const Integer &a, const Integer &b) const; + + const Integer& Square(const Integer &a) const; + + const Integer& MultiplicativeInverse(const Integer &a) const; + + Integer CascadeExponentiate(const Integer &x, const Integer &e1, + const Integer &y, const Integer &e2) const + {return AbstractRing::CascadeExponentiate(x, e1, y, e2);} + + void SimultaneousExponentiate(Element *results, const Element &base, + const Integer *exponents, unsigned int exponentsCount) const + {AbstractRing::SimultaneousExponentiate(results, base, + exponents, exponentsCount);} + +private: + Integer u; + mutable AlignedWordBlock workspace; +}; + + + + +} // namespace + +#endif // TAO_CRYPT_MODARITH_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/modes.hpp b/externals/mysql/extlib/yassl/taocrypt/include/modes.hpp new file mode 100644 index 0000000..d1ebce7 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/modes.hpp @@ -0,0 +1,155 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* modes.hpp provides ECB and CBC modes for block cipher encryption/decryption +*/ + + +#ifndef TAO_CRYPT_MODES_HPP +#define TAO_CRYPT_MODES_HPP + +#include "misc.hpp" + +namespace TaoCrypt { + + +enum Mode { ECB, CBC }; + + + +// BlockCipher abstraction +template +class BlockCipher { +public: + BlockCipher() : cipher_(DIR, MODE) {} + + void Process(byte* c, const byte* p, word32 sz) + { cipher_.Process(c, p, sz); } + void SetKey(const byte* k, word32 sz) + { cipher_.SetKey(k, sz, DIR); } + void SetKey(const byte* k, word32 sz, const byte* iv) + { cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); } +private: + T cipher_; + + BlockCipher(const BlockCipher&); // hide copy + BlockCipher& operator=(const BlockCipher&); // and assign +}; + + +// Mode Base for block ciphers, static size +class Mode_BASE : public virtual_base { +public: + enum { MaxBlockSz = 16 }; + + explicit Mode_BASE(int sz, CipherDir dir, Mode mode) + : blockSz_(sz), reg_(reinterpret_cast(r_)), + tmp_(reinterpret_cast(t_)), dir_(dir), mode_(mode) + { + assert(sz <= MaxBlockSz); + } + virtual ~Mode_BASE() {} + + virtual void Process(byte*, const byte*, word32); + + void SetIV(const byte* iv) { memcpy(reg_, iv, blockSz_); } +protected: + int blockSz_; + byte* reg_; + byte* tmp_; + + word32 r_[MaxBlockSz / sizeof(word32)]; // align reg_ on word32 + word32 t_[MaxBlockSz / sizeof(word32)]; // align tmp_ on word32 + + CipherDir dir_; + Mode mode_; + + void ECB_Process(byte*, const byte*, word32); + void CBC_Encrypt(byte*, const byte*, word32); + void CBC_Decrypt(byte*, const byte*, word32); + + Mode_BASE(const Mode_BASE&); // hide copy + Mode_BASE& operator=(const Mode_BASE&); // and assign + +private: + virtual void ProcessAndXorBlock(const byte*, const byte*, byte*) const = 0; +}; + + +inline void Mode_BASE::Process(byte* out, const byte* in, word32 sz) +{ + if (mode_ == ECB) + ECB_Process(out, in, sz); + else if (mode_ == CBC) + if (dir_ == ENCRYPTION) + CBC_Encrypt(out, in, sz); + else + CBC_Decrypt(out, in, sz); +} + + +// ECB Process blocks +inline void Mode_BASE::ECB_Process(byte* out, const byte* in, word32 sz) +{ + word32 blocks = sz / blockSz_; + + while (blocks--) { + ProcessAndXorBlock(in, 0, out); + out += blockSz_; + in += blockSz_; + } +} + + +// CBC Encrypt +inline void Mode_BASE::CBC_Encrypt(byte* out, const byte* in, word32 sz) +{ + word32 blocks = sz / blockSz_; + + while (blocks--) { + xorbuf(reg_, in, blockSz_); + ProcessAndXorBlock(reg_, 0, reg_); + memcpy(out, reg_, blockSz_); + out += blockSz_; + in += blockSz_; + } +} + + +// CBC Decrypt +inline void Mode_BASE::CBC_Decrypt(byte* out, const byte* in, word32 sz) +{ + word32 blocks = sz / blockSz_; + byte hold[MaxBlockSz]; + + while (blocks--) { + memcpy(tmp_, in, blockSz_); + ProcessAndXorBlock(tmp_, 0, out); + xorbuf(out, reg_, blockSz_); + memcpy(hold, reg_, blockSz_); // swap reg_ and tmp_ + memcpy(reg_, tmp_, blockSz_); + memcpy(tmp_, hold, blockSz_); + out += blockSz_; + in += blockSz_; + } +} + + +} // namespace + +#endif // TAO_CRYPT_MODES_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/pwdbased.hpp b/externals/mysql/extlib/yassl/taocrypt/include/pwdbased.hpp new file mode 100644 index 0000000..5ece1a8 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/pwdbased.hpp @@ -0,0 +1,90 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* pwdbased.hpp defines PBKDF2 from PKCS #5 +*/ + + +#ifndef TAO_CRYPT_PWDBASED_HPP +#define TAO_CRYPT_PWDBASED_HPP + +#include +#include "misc.hpp" +#include "block.hpp" +#include "hmac.hpp" + +namespace TaoCrypt { + + +// From PKCS #5, T must be type suitable for HMAC +template +class PBKDF2_HMAC { +public: + word32 MaxDerivedKeyLength() const { return 0xFFFFFFFFU;} // avoid overflow + + word32 DeriveKey(byte* derived, word32 dLen, const byte* pwd, word32 pLen, + const byte* salt, word32 sLen, word32 iterations) const; +}; + + + +template +word32 PBKDF2_HMAC::DeriveKey(byte* derived, word32 dLen, const byte* pwd, + word32 pLen, const byte* salt, word32 sLen, + word32 iterations) const +{ + assert(dLen <= MaxDerivedKeyLength()); + assert(iterations > 0); + + ByteBlock buffer(T::DIGEST_SIZE); + HMAC hmac; + + hmac.SetKey(pwd, pLen); + + word32 i = 1; + + while (dLen > 0) { + hmac.Update(salt, sLen); + word32 j; + for (j = 0; j < 4; j++) { + byte b = i >> ((3-j)*8); + hmac.Update(&b, 1); + } + hmac.Final(buffer.get_buffer()); + + word32 segmentLen = min(dLen, buffer.size()); + memcpy(derived, buffer.get_buffer(), segmentLen); + + for (j = 1; j < iterations; j++) { + hmac.Update(buffer.get_buffer(), buffer.size()); + hmac.Final(buffer.get_buffer()); + xorbuf(derived, buffer.get_buffer(), segmentLen); + } + derived += segmentLen; + dLen -= segmentLen; + i++; + } + return iterations; +} + + + + +} // naemspace + +#endif // TAO_CRYPT_PWDBASED_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/random.hpp b/externals/mysql/extlib/yassl/taocrypt/include/random.hpp new file mode 100644 index 0000000..91058e8 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/random.hpp @@ -0,0 +1,84 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* random.hpp provides a crypto secure Random Number Generator using an OS + specific seed +*/ + + +#ifndef TAO_CRYPT_RANDOM_HPP +#define TAO_CRYPT_RANDOM_HPP + +#include "arc4.hpp" +#include "error.hpp" + +namespace TaoCrypt { + + +// OS specific seeder +class OS_Seed { +public: + OS_Seed(); + ~OS_Seed(); + + void GenerateSeed(byte*, word32 sz); + Error GetError() const { return error_; } +private: +#if defined(_WIN32) + #if defined(_WIN64) + typedef unsigned __int64 ProviderHandle; + // type HCRYPTPROV, avoid #include + #else + typedef unsigned long ProviderHandle; + #endif + ProviderHandle handle_; +#else + int fd_; +#endif + Error error_; + + OS_Seed(const OS_Seed&); // hide copy + OS_Seed& operator=(const OS_Seed&); // hide assign +}; + + +// secure Random Nnumber Generator +class RandomNumberGenerator { +public: + RandomNumberGenerator(); + ~RandomNumberGenerator() {} + + void GenerateBlock(byte*, word32 sz); + byte GenerateByte(); + + ErrorNumber GetError() const { return seed_.GetError().What(); } +private: + OS_Seed seed_; + ARC4 cipher_; + + RandomNumberGenerator(const RandomNumberGenerator&); // hide copy + RandomNumberGenerator operator=(const RandomNumberGenerator&); // && assign +}; + + + + +} // namespace + +#endif // TAO_CRYPT_RANDOM_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/ripemd.hpp b/externals/mysql/extlib/yassl/taocrypt/include/ripemd.hpp new file mode 100644 index 0000000..a63f92c --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/ripemd.hpp @@ -0,0 +1,69 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* ripemd.hpp provides RIPEMD digest support +*/ + +#ifndef TAO_CRYPT_RIPEMD_HPP +#define TAO_CRYPT_RIPEMD_HPP + +#include "hash.hpp" + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_RIPEMD_ASM +#endif + +namespace TaoCrypt { + + +// RIPEMD160 digest +class RIPEMD160 : public HASHwithTransform { +public: + enum { BLOCK_SIZE = 64, DIGEST_SIZE = 20, PAD_SIZE = 56, + TAO_BYTE_ORDER = LittleEndianOrder }; // in Bytes + RIPEMD160() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + + RIPEMD160(const RIPEMD160&); + RIPEMD160& operator= (const RIPEMD160&); + +#ifdef DO_RIPEMD_ASM + void Update(const byte*, word32); +#endif + void Init(); + void Swap(RIPEMD160&); +private: + void Transform(); + void AsmTransform(const byte* data, word32 times); +}; + +inline void swap(RIPEMD160& a, RIPEMD160& b) +{ + a.Swap(b); +} + + +} // namespace + +#endif // TAO_CRYPT_RIPEMD_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/rsa.hpp b/externals/mysql/extlib/yassl/taocrypt/include/rsa.hpp new file mode 100644 index 0000000..c895ab6 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/rsa.hpp @@ -0,0 +1,250 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* rsa.hpp provides RSA ES encrypt/decrypt, SSL (block type 1) sign and verify +*/ + +#ifndef TAO_CRYPT_RSA_HPP +#define TAO_CRYPT_RSA_HPP + +#include "integer.hpp" +#include "random.hpp" + + +namespace TaoCrypt { + +class Source; + + +// Public Key Length helper +class PK_Lengths { + const Integer& image_; +public: + explicit PK_Lengths(const Integer& i) : image_(i) {} + + word32 PaddedBlockBitLength() const {return image_.BitCount() - 1;} + word32 PaddedBlockByteLength() const + {return BitsToBytes(PaddedBlockBitLength());} + + word32 FixedCiphertextLength() const {return image_.ByteCount();} + word32 FixedMaxPlaintextLength() const + {return SaturatingSubtract(PaddedBlockBitLength() / 8, 10U); } +}; + + +// RSA Public Key +class RSA_PublicKey { +protected: + Integer n_; + Integer e_; +public: + RSA_PublicKey() {} + explicit RSA_PublicKey(Source&); + + void Initialize(const Integer& n, const Integer& e) {n_ = n; e_ = e;} + void Initialize(Source&); + + Integer ApplyFunction(const Integer& x) const; + + const Integer& GetModulus() const {return n_;} + const Integer& GetPublicExponent() const {return e_;} + + void SetModulus(const Integer& n) {n_ = n;} + void SetPublicExponent(const Integer& e) {e_ = e;} + + word32 FixedCiphertextLength() + { + return PK_Lengths(n_).FixedCiphertextLength(); + } + + RSA_PublicKey(const RSA_PublicKey& other) : n_(other.n_), e_(other.e_) {} + RSA_PublicKey& operator=(const RSA_PublicKey& that) + { + RSA_PublicKey tmp(that); + Swap(tmp); + return *this; + } + + void Swap(RSA_PublicKey& other) + { + n_.Swap(other.n_); + e_.Swap(other.e_); + } +}; + + +// RSA Private Key +class RSA_PrivateKey : public RSA_PublicKey { + Integer d_; + Integer p_; + Integer q_; + Integer dp_; + Integer dq_; + Integer u_; +public: + RSA_PrivateKey() {} + explicit RSA_PrivateKey(Source&); + + void Initialize(const Integer& n, const Integer& e, const Integer& d, + const Integer& p, const Integer& q, const Integer& dp, + const Integer& dq, const Integer& u) + {n_ = n; e_ = e; d_ = d; p_ = p; q_ = q; dp_ = dp; dq_ = dq; u_ = u;} + void Initialize(Source&); + + Integer CalculateInverse(RandomNumberGenerator&, const Integer&) const; + + const Integer& GetPrime1() const {return p_;} + const Integer& GetPrime2() const {return q_;} + const Integer& GetPrivateExponent() const {return d_;} + const Integer& GetModPrime1PrivateExponent() const {return dp_;} + const Integer& GetModPrime2PrivateExponent() const {return dq_;} + const Integer& GetMultiplicativeInverseOfPrime2ModPrime1() const + {return u_;} + + void SetPrime1(const Integer& p) {p_ = p;} + void SetPrime2(const Integer& q) {q_ = q;} + void SetPrivateExponent(const Integer& d) {d_ = d;} + void SetModPrime1PrivateExponent(const Integer& dp) {dp_ = dp;} + void SetModPrime2PrivateExponent(const Integer& dq) {dq_ = dq;} + void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer& u) {u_ = u;} +private: + RSA_PrivateKey(const RSA_PrivateKey&); // hide copy + RSA_PrivateKey& operator=(const RSA_PrivateKey&); // and assign +}; + + +// block type 2 padding +class RSA_BlockType2 { +public: + void Pad(const byte*, word32, byte*, word32, + RandomNumberGenerator&) const; + word32 UnPad(const byte*, word32, byte*) const; +}; + + +// block type 1 padding +class RSA_BlockType1 { +public: + void Pad(const byte*, word32, byte*, word32, + RandomNumberGenerator&) const; + word32 UnPad(const byte*, word32, byte*) const; +}; + + +// RSA Encryptor, can use any padding +template +class RSA_Encryptor { + const RSA_PublicKey& key_; + Pad padding_; +public: + explicit RSA_Encryptor(const RSA_PublicKey& k) : key_(k) {} + + void Encrypt(const byte*, word32, byte*, RandomNumberGenerator&); + bool SSL_Verify(const byte* msg, word32 sz, const byte* sig); +}; + + +// RSA Decryptor, can use any padding +template +class RSA_Decryptor { + const RSA_PrivateKey& key_; + Pad padding_; +public: + explicit RSA_Decryptor(const RSA_PrivateKey& k) : key_(k) {} + + word32 Decrypt(const byte*, word32, byte*, RandomNumberGenerator&); + void SSL_Sign(const byte*, word32, byte*, RandomNumberGenerator&); +}; + + +// Public Encrypt +template +void RSA_Encryptor::Encrypt(const byte* plain, word32 sz, byte* cipher, + RandomNumberGenerator& rng) +{ + PK_Lengths lengths(key_.GetModulus()); + assert(sz <= lengths.FixedMaxPlaintextLength()); + + ByteBlock paddedBlock(lengths.PaddedBlockByteLength()); + padding_.Pad(plain, sz, paddedBlock.get_buffer(), + lengths.PaddedBlockBitLength(), rng); + + key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())). + Encode(cipher, lengths.FixedCiphertextLength()); +} + + +// Private Decrypt +template +word32 RSA_Decryptor::Decrypt(const byte* cipher, word32 sz, byte* plain, + RandomNumberGenerator& rng) +{ + PK_Lengths lengths(key_.GetModulus()); + assert(sz == lengths.FixedCiphertextLength()); + + if (sz != lengths.FixedCiphertextLength()) + return 0; + + ByteBlock paddedBlock(lengths.PaddedBlockByteLength()); + Integer x = key_.CalculateInverse(rng, Integer(cipher, + lengths.FixedCiphertextLength()).Ref()); + if (x.ByteCount() > paddedBlock.size()) + x = Integer::Zero(); // don't return false, prevents timing attack + x.Encode(paddedBlock.get_buffer(), paddedBlock.size()); + return padding_.UnPad(paddedBlock.get_buffer(), + lengths.PaddedBlockBitLength(), plain); +} + + +// Private SSL type (block 1) Encrypt +template +void RSA_Decryptor::SSL_Sign(const byte* message, word32 sz, byte* sig, + RandomNumberGenerator& rng) +{ + RSA_PublicKey inverse; + inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent()); + RSA_Encryptor enc(inverse); // SSL Type + enc.Encrypt(message, sz, sig, rng); +} + + +word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain); + + +// Public SSL type (block 1) Decrypt +template +bool RSA_Encryptor::SSL_Verify(const byte* message, word32 sz, + const byte* sig) +{ + ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength()); + if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz) + return false; // not right justified or bad padding + + if ( (memcmp(plain.get_buffer(), message, sz)) == 0) + return true; + return false; +} + + +typedef RSA_Encryptor<> RSAES_Encryptor; +typedef RSA_Decryptor<> RSAES_Decryptor; + + +} // namespace + +#endif // TAO_CRYPT_RSA_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/runtime.hpp b/externals/mysql/extlib/yassl/taocrypt/include/runtime.hpp new file mode 100644 index 0000000..6ece50d --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/runtime.hpp @@ -0,0 +1,72 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* runtime.hpp provides C++ runtime support functions when building a pure C + * version of yaSSL, user must define YASSL_PURE_C +*/ + + + +#ifndef yaSSL_NEW_HPP +#define yaSSL_NEW_HPP + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#ifdef __sun + +#include + +// Handler for pure virtual functions +namespace __Crun { + static void pure_error(void) + { + assert("Pure virtual method called." == "Aborted"); + } +} // namespace __Crun + +#endif // __sun + + +#if defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + +#if __GNUC__ > 2 + +extern "C" { +#if !defined(DO_TAOCRYPT_KERNEL_MODE) + #include +#else + #include "kernelc.hpp" +#endif + +/* Disallow inline __cxa_pure_virtual() */ +static int __cxa_pure_virtual() __attribute__((noinline, used)); +static int __cxa_pure_virtual() +{ + // oops, pure virtual called! + assert("Pure virtual method called." == "Aborted"); + return 0; +} + +} // extern "C" + +#endif // __GNUC__ > 2 +#endif // compiler check +#endif // yaSSL_NEW_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/sha.hpp b/externals/mysql/extlib/yassl/taocrypt/include/sha.hpp new file mode 100644 index 0000000..c0b4368 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/sha.hpp @@ -0,0 +1,168 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* sha.hpp provides SHA-1 digests, see RFC 3174 +*/ + +#ifndef TAO_CRYPT_SHA_HPP +#define TAO_CRYPT_SHA_HPP + +#include "hash.hpp" + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_SHA_ASM +#endif + +namespace TaoCrypt { + + +// SHA-1 digest +class SHA : public HASHwithTransform { +public: + enum { BLOCK_SIZE = 64, DIGEST_SIZE = 20, PAD_SIZE = 56, + TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes + SHA() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + +#ifdef DO_SHA_ASM + void Update(const byte* data, word32 len); +#endif + void Init(); + + SHA(const SHA&); + SHA& operator= (const SHA&); + + void Swap(SHA&); +private: + void Transform(); + void AsmTransform(const byte* data, word32 times); +}; + + +inline void swap(SHA& a, SHA& b) +{ + a.Swap(b); +} + +// SHA-256 digest +class SHA256 : public HASHwithTransform { +public: + enum { BLOCK_SIZE = 64, DIGEST_SIZE = 32, PAD_SIZE = 56, + TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes + SHA256() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + + void Init(); + + SHA256(const SHA256&); + SHA256& operator= (const SHA256&); + + void Swap(SHA256&); +private: + void Transform(); +}; + + +// SHA-224 digest +class SHA224 : public HASHwithTransform { +public: + enum { BLOCK_SIZE = 64, DIGEST_SIZE = 28, PAD_SIZE = 56, + TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes + SHA224() : HASHwithTransform(SHA256::DIGEST_SIZE /sizeof(word32),BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + + void Init(); + + SHA224(const SHA224&); + SHA224& operator= (const SHA224&); + + void Swap(SHA224&); +private: + void Transform(); +}; + + +#ifdef WORD64_AVAILABLE + +// SHA-512 digest +class SHA512 : public HASH64withTransform { +public: + enum { BLOCK_SIZE = 128, DIGEST_SIZE = 64, PAD_SIZE = 112, + TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes + SHA512() : HASH64withTransform(DIGEST_SIZE / sizeof(word64), BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + + void Init(); + + SHA512(const SHA512&); + SHA512& operator= (const SHA512&); + + void Swap(SHA512&); +private: + void Transform(); +}; + + +// SHA-384 digest +class SHA384 : public HASH64withTransform { +public: + enum { BLOCK_SIZE = 128, DIGEST_SIZE = 48, PAD_SIZE = 112, + TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes + SHA384() : HASH64withTransform(SHA512::DIGEST_SIZE/ sizeof(word64), + BLOCK_SIZE) + { Init(); } + ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); } + word32 getBlockSize() const { return BLOCK_SIZE; } + word32 getDigestSize() const { return DIGEST_SIZE; } + word32 getPadSize() const { return PAD_SIZE; } + + void Init(); + + SHA384(const SHA384&); + SHA384& operator= (const SHA384&); + + void Swap(SHA384&); +private: + void Transform(); +}; + +#endif // WORD64_AVAILABLE + + +} // namespace + + +#endif // TAO_CRYPT_SHA_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/twofish.hpp b/externals/mysql/extlib/yassl/taocrypt/include/twofish.hpp new file mode 100644 index 0000000..bc6f89a --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/twofish.hpp @@ -0,0 +1,94 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* twofish.hpp defines Twofish +*/ + + +#ifndef TAO_CRYPT_TWOFISH_HPP +#define TAO_CRYPT_TWOFISH_HPP + +#include "misc.hpp" +#include "modes.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_TWOFISH_ASM +#endif + +namespace TaoCrypt { + +enum { TWOFISH_BLOCK_SIZE = 16 }; + + +// Twofish encryption and decryption, see +class Twofish : public Mode_BASE { +public: + enum { BLOCK_SIZE = TWOFISH_BLOCK_SIZE }; + + Twofish(CipherDir DIR, Mode MODE) + : Mode_BASE(BLOCK_SIZE, DIR, MODE) {} + +#ifdef DO_TWOFISH_ASM + void Process(byte*, const byte*, word32); +#endif + void SetKey(const byte* key, word32 sz, CipherDir fake = ENCRYPTION); + void SetIV(const byte* iv) { memcpy(r_, iv, BLOCK_SIZE); } +private: + static const byte q_[2][256]; + static const word32 mds_[4][256]; + + word32 k_[40]; + word32 s_[4][256]; + + static word32 h0(word32 x, const word32 *key, unsigned int kLen); + static word32 h(word32 x, const word32 *key, unsigned int kLen); + + void ProcessAndXorBlock(const byte*, const byte*, byte*) const; + + void encrypt(const byte*, const byte*, byte*) const; + void decrypt(const byte*, const byte*, byte*) const; + + void AsmEncrypt(const byte* inBlock, byte* outBlock) const; + void AsmDecrypt(const byte* inBlock, byte* outBlock) const; + + Twofish(const Twofish&); // hide copy + Twofish& operator=(const Twofish&); // and assign +}; + + +typedef BlockCipher Twofish_ECB_Encryption; +typedef BlockCipher Twofish_ECB_Decryption; + +typedef BlockCipher Twofish_CBC_Encryption; +typedef BlockCipher Twofish_CBC_Decryption; + + + +} // naemspace + +#endif // TAO_CRYPT_TWOFISH_HPP + diff --git a/externals/mysql/extlib/yassl/taocrypt/include/type_traits.hpp b/externals/mysql/extlib/yassl/taocrypt/include/type_traits.hpp new file mode 100644 index 0000000..7a664c8 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/type_traits.hpp @@ -0,0 +1,80 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* type_traits defines fundamental types + * see discussion in C++ Templates, $19.1 +*/ + + +#ifndef TAO_CRYPT_TYPE_TRAITS_HPP +#define TAO_CRYPT_TYPE_TRAITS_HPP + +#include "types.hpp" + +namespace TaoCrypt { + + +// primary template: in general T is not a fundamental type + +template +class IsFundamentalType { + public: + enum { Yes = 0, No = 1 }; +}; + + +// macro to specialize for fundamental types +#define MK_FUNDAMENTAL_TYPE(T) \ + template<> class IsFundamentalType { \ + public: \ + enum { Yes = 1, No = 0 }; \ + }; + + +MK_FUNDAMENTAL_TYPE(void) + +#ifndef bool_defined +MK_FUNDAMENTAL_TYPE(bool) +#endif + +MK_FUNDAMENTAL_TYPE( char) +MK_FUNDAMENTAL_TYPE(signed char) +MK_FUNDAMENTAL_TYPE(unsigned char) + +MK_FUNDAMENTAL_TYPE(signed short) +MK_FUNDAMENTAL_TYPE(unsigned short) +MK_FUNDAMENTAL_TYPE(signed int) +MK_FUNDAMENTAL_TYPE(unsigned int) +MK_FUNDAMENTAL_TYPE(signed long) +MK_FUNDAMENTAL_TYPE(unsigned long) + +MK_FUNDAMENTAL_TYPE(float) +MK_FUNDAMENTAL_TYPE( double) +MK_FUNDAMENTAL_TYPE(long double) + +#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE) + MK_FUNDAMENTAL_TYPE(word64) +#endif + + +#undef MK_FUNDAMENTAL_TYPE + + +} // namespace + +#endif // TAO_CRYPT_TYPE_TRAITS_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/include/types.hpp b/externals/mysql/extlib/yassl/taocrypt/include/types.hpp new file mode 100644 index 0000000..3efdcdf --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/include/types.hpp @@ -0,0 +1,99 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's misc.h from CryptoPP, basic crypt types */ + + +#ifndef TAO_CRYPT_TYPES_HPP +#define TAO_CRYPT_TYPES_HPP + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +namespace TaoCrypt { + + +#if defined(WORDS_BIGENDIAN) || (defined(__MWERKS__) && !defined(__INTEL__)) + #define BIG_ENDIAN_ORDER +#endif + +#ifndef BIG_ENDIAN_ORDER + #define LITTLE_ENDIAN_ORDER +#endif + + +typedef unsigned char byte; +typedef unsigned short word16; +typedef unsigned int word32; + +#if defined(_MSC_VER) || defined(__BCPLUSPLUS__) + #define WORD64_AVAILABLE + #define WORD64_IS_DISTINCT_TYPE + typedef unsigned __int64 word64; + #define W64LIT(x) x##ui64 +#elif SIZEOF_LONG == 8 + #define WORD64_AVAILABLE + typedef unsigned long word64; + #define W64LIT(x) x##LL +#elif SIZEOF_LONG_LONG == 8 + #define WORD64_AVAILABLE + #define WORD64_IS_DISTINCT_TYPE + typedef unsigned long long word64; + #define W64LIT(x) x##LL +#endif + + +// compilers we've found 64-bit multiply insructions for +#if defined(__GNUC__) || defined(_MSC_VER) || defined(__DECCXX) + #if !(defined(__ICC) || defined(__INTEL_COMPILER)) + #define HAVE_64_MULTIPLY + #endif +#endif + + +#if defined(HAVE_64_MULTIPLY) && (defined(__alpha__) || defined(__ia64__) \ + || defined(_ARCH_PPC64) || defined(__mips64) || defined(__x86_64__) \ + || defined(_M_X64) || defined(_M_IA64)) +// These platforms have 64-bit CPU registers. Unfortunately most C++ compilers +// don't allow any way to access the 64-bit by 64-bit multiply instruction +// without using assembly, so in order to use word64 as word, the assembly +// instruction must be defined in Dword::Multiply(). + typedef word32 hword; + typedef word64 word; +#else + #define TAOCRYPT_NATIVE_DWORD_AVAILABLE + #ifdef WORD64_AVAILABLE + #define TAOCRYPT_SLOW_WORD64 + typedef word16 hword; + typedef word32 word; + typedef word64 dword; + #else + typedef byte hword; + typedef word16 word; + typedef word32 dword; + #endif +#endif + +const word32 WORD_SIZE = sizeof(word); +const word32 WORD_BITS = WORD_SIZE * 8; + + +} // namespace + +#endif // TAO_CRYPT_TYPES_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/algorithm.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/algorithm.hpp new file mode 100644 index 0000000..d8bc29a --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/algorithm.hpp @@ -0,0 +1,108 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL algorithm implements max, min, for_each, swap, find_if, copy, + * copy_backward, fill + */ + +#ifndef mySTL_ALGORITHM_HPP +#define mySTL_ALGORITHM_HPP + + +namespace mySTL { + + +template +inline const T& max(const T& a, const T&b) +{ + return a < b ? b : a; +} + + +template +inline const T& min(const T& a, const T&b) +{ + return b < a ? b : a; +} + + +template +Func for_each(InIter first, InIter last, Func op) +{ + while (first != last) { + op(*first); + ++first; + } + return op; +} + + +template +inline void swap(T& a, T& b) +{ + T tmp = a; + a = b; + b = tmp; +} + + +template +InIter find_if(InIter first, InIter last, Pred pred) +{ + while (first != last && !pred(*first)) + ++first; + return first; +} + + +template +inline OutputIter copy(InputIter first, InputIter last, OutputIter place) +{ + while (first != last) { + *place = *first; + ++first; + ++place; + } + return place; +} + + +template +inline OutputIter +copy_backward(InputIter first, InputIter last, OutputIter place) +{ + while (first != last) + *--place = *--last; + return place; +} + + +template +void fill(InputIter first, InputIter last, const T& v) +{ + while (first != last) { + *first = v; + ++first; + } +} + + +} // namespace mySTL + +#endif // mySTL_ALGORITHM_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/helpers.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/helpers.hpp new file mode 100644 index 0000000..c0495a7 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/helpers.hpp @@ -0,0 +1,153 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL helpers implements misc constructs for vector and list + * + */ + +#ifndef mySTL_HELPERS_HPP +#define mySTL_HELPERS_HPP + +#include +#ifdef _MSC_VER + #include +#endif + +/* + Workaround for the lack of operator new(size_t, void*) + in IBM VA C++ 6.0 + Also used as a workaround to avoid including +*/ + struct Dummy {}; + + inline void* operator new(size_t size, Dummy* d) + { + return static_cast(d); + } + + // for compilers that want matching delete + inline void operator delete(void* ptr, Dummy* d) + { + } + + typedef Dummy* yassl_pointer; + +namespace mySTL { + + +template +inline void construct(T* p, const T2& value) +{ + new (reinterpret_cast(p)) T(value); +} + + +template +inline void construct(T* p) +{ + new (reinterpret_cast(p)) T(); +} + + +template +inline void destroy(T* p) +{ + p->~T(); +} + + +template +void destroy(Iter first, Iter last) +{ + while (first != last) { + destroy(&*first); + ++first; + } +} + + +template +PlaceIter uninit_copy(Iter first, Iter last, PlaceIter place) +{ + while (first != last) { + construct(&*place, *first); + ++first; + ++place; + } + return place; +} + + +template +PlaceIter uninit_fill_n(PlaceIter place, Size n, const T& value) +{ + while (n) { + construct(&*place, value); + --n; + ++place; + } + return place; +} + + +template +T* GetArrayMemory(size_t items) +{ + unsigned char* ret; + + #ifdef YASSL_LIB + ret = NEW_YS unsigned char[sizeof(T) * items]; + #else + ret = NEW_TC unsigned char[sizeof(T) * items]; + #endif + + return reinterpret_cast(ret); +} + + +template +void FreeArrayMemory(T* ptr) +{ + unsigned char* p = reinterpret_cast(ptr); + + #ifdef YASSL_LIB + yaSSL::ysArrayDelete(p); + #else + TaoCrypt::tcArrayDelete(p); + #endif +} + + + +inline void* GetMemory(size_t bytes) +{ + return GetArrayMemory(bytes); +} + + +inline void FreeMemory(void* ptr) +{ + FreeArrayMemory(ptr); +} + + + +} // namespace mySTL + +#endif // mySTL_HELPERS_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/list.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/list.hpp new file mode 100644 index 0000000..6a081cb --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/list.hpp @@ -0,0 +1,367 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL list implements a simple list + * + */ + +#ifndef mySTL_LIST_HPP +#define mySTL_LIST_HPP + + +#include "helpers.hpp" + + +namespace mySTL { + + + +template +class list { + +#ifdef __SUNPRO_CC +/* + Sun Forte 7 C++ v. 5.4 needs class 'node' public to be visible to + the nested class 'iterator' (a non-standard behaviour). +*/ +public: +#endif + + struct node { + node(T t) : prev_(0), next_(0), value_(t) {} + + node* prev_; + node* next_; + T value_; + }; +public: + list() : head_(0), tail_(0), sz_(0) {} + ~list(); + + void push_front(T); + void pop_front(); + T front() const; + void push_back(T); + void pop_back(); + T back() const; + bool remove(T); + size_t size() const { return sz_; } + bool empty() const { return sz_ == 0; } + + class iterator { + node* current_; + public: + explicit iterator(node* p = 0) : current_(p) {} + + T& operator*() const + { + return current_->value_; + } + + T* operator->() const + { + return &(operator*()); + } + + iterator& operator++() + { + current_ = current_->next_; + return *this; + } + + iterator& operator--() + { + current_ = current_->prev_; + return *this; + } + + iterator operator++(int) + { + iterator tmp = *this; + current_ = current_->next_; + return tmp; + } + + iterator operator--(int) + { + iterator tmp = *this; + current_ = current_->prev_; + return tmp; + } + + bool operator==(const iterator& other) const + { + return current_ == other.current_; + } + + bool operator!=(const iterator& other) const + { + return current_ != other.current_; + } + + friend class list; + }; + + + class reverse_iterator { + node* current_; + public: + explicit reverse_iterator(node* p = 0) : current_(p) {} + + T& operator*() const + { + return current_->value_; + } + + T* operator->() const + { + return &(operator*()); + } + + reverse_iterator& operator++() + { + current_ = current_->prev_; + return *this; + } + + reverse_iterator& operator--() + { + current_ = current_->next_; + return *this; + } + + reverse_iterator operator++(int) + { + reverse_iterator tmp = *this; + current_ = current_->prev_; + return tmp; + } + + reverse_iterator operator--(int) + { + reverse_iterator tmp = *this; + current_ = current_->next_; + return tmp; + } + + bool operator==(const reverse_iterator& other) const + { + return current_ == other.current_; + } + + bool operator!=(const reverse_iterator& other) const + { + return current_ != other.current_; + } + + friend class list; + }; + + bool erase(iterator); + + iterator begin() const { return iterator(head_); } + reverse_iterator rbegin() const { return reverse_iterator(tail_); } + iterator end() const { return iterator(); } + reverse_iterator rend() const { return reverse_iterator(); } + + typedef iterator const_iterator; // for now + + class underflow {}; + class overflow {}; +private: + node* head_; + node* tail_; + size_t sz_; + + node* look_up(T); + + list(const list&); // hide copy + list& operator=(const list&); // and assign +}; + + +template +list::~list() +{ + node* start = head_; + node* next_; + + for (; start; start = next_) { + next_ = start->next_; + destroy(start); + FreeMemory(start); + } +} + + +template +void list::push_front(T t) +{ + void* mem = GetMemory(sizeof(node)); + node* add = new (reinterpret_cast(mem)) node(t); + + if (head_) { + add->next_ = head_; + head_->prev_ = add; + } + else + tail_ = add; + + head_ = add; + ++sz_; +} + + +template +void list::pop_front() +{ + node* front = head_; + + if (head_ == 0) + return; + else if (head_ == tail_) + head_ = tail_ = 0; + else { + head_ = head_->next_; + head_->prev_ = 0; + } + destroy(front); + FreeMemory(front); + --sz_; +} + + +template +T list::front() const +{ + if (head_ == 0) return T(); + return head_->value_; +} + + +template +void list::push_back(T t) +{ + void* mem = GetMemory(sizeof(node)); + node* add = new (reinterpret_cast(mem)) node(t); + + if (tail_) { + tail_->next_ = add; + add->prev_ = tail_; + } + else + head_ = add; + + tail_ = add; + ++sz_; +} + + +template +void list::pop_back() +{ + node* rear = tail_; + + if (tail_ == 0) + return; + else if (tail_ == head_) + tail_ = head_ = 0; + else { + tail_ = tail_->prev_; + tail_->next_ = 0; + } + destroy(rear); + FreeMemory(rear); + --sz_; +} + + +template +T list::back() const +{ + if (tail_ == 0) return T(); + return tail_->value_; +} + + +template +typename list::node* list::look_up(T t) +{ + node* list = head_; + + if (list == 0) return 0; + + for (; list; list = list->next_) + if (list->value_ == t) + return list; + + return 0; +} + + +template +bool list::remove(T t) +{ + node* del = look_up(t); + + if (del == 0) + return false; + else if (del == head_) + pop_front(); + else if (del == tail_) + pop_back(); + else { + del->prev_->next_ = del->next_; + del->next_->prev_ = del->prev_; + + destroy(del); + FreeMemory(del); + --sz_; + } + return true; +} + + +template +bool list::erase(iterator iter) +{ + node* del = iter.current_; + + if (del == 0) + return false; + else if (del == head_) + pop_front(); + else if (del == tail_) + pop_back(); + else { + del->prev_->next_ = del->next_; + del->next_->prev_ = del->prev_; + + destroy(del); + FreeMemory(del); + --sz_; + } + return true; +} + + + +} // namespace mySTL + +#endif // mySTL_LIST_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/memory.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/memory.hpp new file mode 100644 index 0000000..b239aa6 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/memory.hpp @@ -0,0 +1,136 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL memory implements auto_ptr + * + */ + +#ifndef mySTL_MEMORY_HPP +#define mySTL_MEMORY_HPP + +#include "memory_array.hpp" // for auto_array + +#ifdef _MSC_VER + // disable operator-> warning for builtins + #pragma warning(disable:4284) +#endif + + +namespace mySTL { + + +template +struct auto_ptr_ref { + T* ptr_; + explicit auto_ptr_ref(T* p) : ptr_(p) {} +}; + + +template +class auto_ptr { + T* ptr_; + + void Destroy() + { + #ifdef YASSL_LIB + yaSSL::ysDelete(ptr_); + #else + TaoCrypt::tcDelete(ptr_); + #endif + } +public: + explicit auto_ptr(T* p = 0) : ptr_(p) {} + + ~auto_ptr() + { + Destroy(); + } + + + auto_ptr(auto_ptr& other) : ptr_(other.release()) {} + + auto_ptr& operator=(auto_ptr& that) + { + if (this != &that) { + Destroy(); + ptr_ = that.release(); + } + return *this; + } + + + T* operator->() const + { + return ptr_; + } + + T& operator*() const + { + return *ptr_; + } + + T* get() const + { + return ptr_; + } + + T* release() + { + T* tmp = ptr_; + ptr_ = 0; + return tmp; + } + + void reset(T* p = 0) + { + if (ptr_ != p) { + Destroy(); + ptr_ = p; + } + } + + // auto_ptr_ref conversions + auto_ptr(auto_ptr_ref ref) : ptr_(ref.ptr_) {} + + auto_ptr& operator=(auto_ptr_ref ref) + { + if (this->ptr_ != ref.ptr_) { + Destroy(); + ptr_ = ref.ptr_; + } + return *this; + } + + template + operator auto_ptr() + { + return auto_ptr(this->release()); + } + + template + operator auto_ptr_ref() + { + return auto_ptr_ref(this->release()); + } +}; + + +} // namespace mySTL + +#endif // mySTL_MEMORY_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/memory_array.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/memory_array.hpp new file mode 100644 index 0000000..a044498 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/memory_array.hpp @@ -0,0 +1,135 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL memory_arry implements auto_array + * + */ + +#ifndef mySTL_MEMORY_ARRAY_HPP +#define mySTL_MEMORY_ARRAY_HPP + + +#ifdef _MSC_VER + // disable operator-> warning for builtins + #pragma warning(disable:4284) +#endif + + +namespace mySTL { + + +template +struct auto_array_ref { + T* ptr_; + explicit auto_array_ref(T* p) : ptr_(p) {} +}; + + +template +class auto_array { + T* ptr_; + + void Destroy() + { + #ifdef YASSL_LIB + yaSSL::ysArrayDelete(ptr_); + #else + TaoCrypt::tcArrayDelete(ptr_); + #endif + } +public: + explicit auto_array(T* p = 0) : ptr_(p) {} + + ~auto_array() + { + Destroy(); + } + + + auto_array(auto_array& other) : ptr_(other.release()) {} + + auto_array& operator=(auto_array& that) + { + if (this != &that) { + Destroy(); + ptr_ = that.release(); + } + return *this; + } + + + T* operator->() const + { + return ptr_; + } + + T& operator*() const + { + return *ptr_; + } + + T* get() const + { + return ptr_; + } + + T* release() + { + T* tmp = ptr_; + ptr_ = 0; + return tmp; + } + + void reset(T* p = 0) + { + if (ptr_ != p) { + Destroy(); + ptr_ = p; + } + } + + // auto_array_ref conversions + auto_array(auto_array_ref ref) : ptr_(ref.ptr_) {} + + auto_array& operator=(auto_array_ref ref) + { + if (this->ptr_ != ref.ptr_) { + Destroy(); + ptr_ = ref.ptr_; + } + return *this; + } + + template + operator auto_array() + { + return auto_array(this->release()); + } + + template + operator auto_array_ref() + { + return auto_array_ref(this->release()); + } +}; + + +} // namespace mySTL + +#endif // mySTL_MEMORY_ARRAY_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/pair.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/pair.hpp new file mode 100644 index 0000000..be2dbb1 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/pair.hpp @@ -0,0 +1,58 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL pair implements pair + * + */ + +#ifndef mySTL_PAIR_HPP +#define mySTL_PAIR_HPP + + + +namespace mySTL { + + +template +struct pair { + typedef T1 first_type; + typedef T2 second_type; + + first_type first; + second_type second; + + pair() {} + pair(const T1& t1, const T2& t2) : first(t1), second(t2) {} + + template + pair(const pair& p) : first(p.first), second(p.second) {} +}; + + +template +inline pair make_pair(const T1& a, const T2& b) +{ + return pair(a, b); +} + + + +} // namespace mySTL + +#endif // mySTL_PAIR_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/stdexcept.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/stdexcept.hpp new file mode 100644 index 0000000..9696995 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/stdexcept.hpp @@ -0,0 +1,77 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL memory implements exception, runtime_error + * + */ + +#ifndef mySTL_STDEXCEPT_HPP +#define mySTL_STDEXCEPT_HPP + + +#include // strncpy +#include // assert +#include // size_t + + +namespace mySTL { + + +class exception { +public: + exception() {} + virtual ~exception() {} // to shut up compiler warnings + + virtual const char* what() const { return ""; } + + // for compiler generated call, never used + static void operator delete(void*) { assert(0); } +private: + // don't allow dynamic creation of exceptions + static void* operator new(size_t); +}; + + +class named_exception : public exception { +public: + enum { NAME_SIZE = 80 }; + + explicit named_exception(const char* str) + { + strncpy(name_, str, NAME_SIZE); + name_[NAME_SIZE - 1] = 0; + } + + virtual const char* what() const { return name_; } +private: + char name_[NAME_SIZE]; +}; + + +class runtime_error : public named_exception { +public: + explicit runtime_error(const char* str) : named_exception(str) {} +}; + + + + +} // namespace mySTL + +#endif // mySTL_STDEXCEPT_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/mySTL/vector.hpp b/externals/mysql/extlib/yassl/taocrypt/mySTL/vector.hpp new file mode 100644 index 0000000..8ba8813 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/mySTL/vector.hpp @@ -0,0 +1,154 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* mySTL vector implements simple vector, w/ swap + * + */ + +#ifndef mySTL_VECTOR_HPP +#define mySTL_VECTOR_HPP + +#include "helpers.hpp" // construct, destory, fill, etc. +#include "algorithm.hpp" // swap +#include // assert + + +namespace mySTL { + + +template +struct vector_base { + T* start_; + T* finish_; + T* end_of_storage_; + + vector_base() : start_(0), finish_(0), end_of_storage_(0) {} + vector_base(size_t n) + { + start_ = GetArrayMemory(n); + finish_ = start_; + end_of_storage_ = start_ + n; + } + + ~vector_base() + { + FreeArrayMemory(start_); + } + + void Swap(vector_base& that) + { + swap(start_, that.start_); + swap(finish_, that.finish_); + swap(end_of_storage_, that.end_of_storage_); + } +}; + + + +template +class vector { +public: + typedef T* iterator; + typedef const T* const_iterator; + + vector() {} + explicit vector(size_t n) : vec_(n) + { + vec_.finish_ = uninit_fill_n(vec_.start_, n, T()); + } + + ~vector() { destroy(vec_.start_, vec_.finish_); } + + vector(const vector& other) : vec_(other.size()) + { + vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_, + vec_.start_); + } + + size_t capacity() const { return vec_.end_of_storage_ - vec_.start_; } + + size_t size() const { return vec_.finish_ - vec_.start_; } + + T& operator[](size_t idx) { return *(vec_.start_ + idx); } + const T& operator[](size_t idx) const { return *(vec_.start_ + idx); } + + const T* begin() const { return vec_.start_; } + const T* end() const { return vec_.finish_; } + + void push_back(const T& v) + { + if (vec_.finish_ != vec_.end_of_storage_) { + construct(vec_.finish_, v); + ++vec_.finish_; + } + else { + vector tmp(size() * 2 + 1, *this); + construct(tmp.vec_.finish_, v); + ++tmp.vec_.finish_; + Swap(tmp); + } + } + + void resize(size_t n, const T& v) + { + if (n == size()) return; + + if (n < size()) { + T* first = vec_.start_ + n; + destroy(first, vec_.finish_); + vec_.finish_ -= vec_.finish_ - first; + } + else { + vector tmp(n, *this); + tmp.vec_.finish_ = uninit_fill_n(tmp.vec_.finish_, n - size(), v); + Swap(tmp); + } + } + + void reserve(size_t n) + { + if (capacity() < n) { + vector tmp(n, *this); + Swap(tmp); + } + } + + void Swap(vector& that) + { + vec_.Swap(that.vec_); + } +private: + vector_base vec_; + + vector& operator=(const vector&); // hide assign + + // for growing, n must be bigger than other size + vector(size_t n, const vector& other) : vec_(n) + { + assert(n > other.size()); + vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_, + vec_.start_); + } +}; + + + +} // namespace mySTL + +#endif // mySTL_VECTOR_HPP diff --git a/externals/mysql/extlib/yassl/taocrypt/src/aes.cpp b/externals/mysql/extlib/yassl/taocrypt/src/aes.cpp new file mode 100644 index 0000000..b2b42d3 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/aes.cpp @@ -0,0 +1,1814 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* C++ based on Wei Dai's aes.cpp from CryptoPP */ +/* x86 asm original */ + +#if defined(TAOCRYPT_KERNEL_MODE) + #define DO_TAOCRYPT_KERNEL_MODE +#endif // only some modules now support this + +#include "runtime.hpp" +#include "aes.hpp" + + +namespace TaoCrypt { + + +#if defined(DO_AES_ASM) + +// ia32 optimized version +void AES::Process(byte* out, const byte* in, word32 sz) +{ + if (!isMMX) { + Mode_BASE::Process(out, in, sz); + return; + } + + word32 blocks = sz / BLOCK_SIZE; + + if (mode_ == ECB) + while (blocks--) { + if (dir_ == ENCRYPTION) + AsmEncrypt(in, out, (void*)Te0); + else + AsmDecrypt(in, out, (void*)Td0); + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } + else if (mode_ == CBC) + if (dir_ == ENCRYPTION) + while (blocks--) { + r_[0] ^= *(word32*)in; + r_[1] ^= *(word32*)(in + 4); + r_[2] ^= *(word32*)(in + 8); + r_[3] ^= *(word32*)(in + 12); + + AsmEncrypt((byte*)r_, (byte*)r_, (void*)Te0); + + memcpy(out, r_, BLOCK_SIZE); + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } + else + while (blocks--) { + AsmDecrypt(in, out, (void*)Td0); + + *(word32*)out ^= r_[0]; + *(word32*)(out + 4) ^= r_[1]; + *(word32*)(out + 8) ^= r_[2]; + *(word32*)(out + 12) ^= r_[3]; + + memcpy(r_, in, BLOCK_SIZE); + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } +} + +#endif // DO_AES_ASM + + +void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) +{ + assert( (keylen == 16) || (keylen == 24) || (keylen == 32) ); + + rounds_ = keylen/4 + 6; + + word32 temp, *rk = key_; + unsigned int i=0; + + GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen); + + switch(keylen) + { + case 16: + while (true) + { + temp = rk[3]; + rk[4] = rk[0] ^ + (Te4[GETBYTE(temp, 2)] & 0xff000000) ^ + (Te4[GETBYTE(temp, 1)] & 0x00ff0000) ^ + (Te4[GETBYTE(temp, 0)] & 0x0000ff00) ^ + (Te4[GETBYTE(temp, 3)] & 0x000000ff) ^ + rcon_[i]; + rk[5] = rk[1] ^ rk[4]; + rk[6] = rk[2] ^ rk[5]; + rk[7] = rk[3] ^ rk[6]; + if (++i == 10) + break; + rk += 4; + } + break; + + case 24: + while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack + { + temp = rk[ 5]; + rk[ 6] = rk[ 0] ^ + (Te4[GETBYTE(temp, 2)] & 0xff000000) ^ + (Te4[GETBYTE(temp, 1)] & 0x00ff0000) ^ + (Te4[GETBYTE(temp, 0)] & 0x0000ff00) ^ + (Te4[GETBYTE(temp, 3)] & 0x000000ff) ^ + rcon_[i]; + rk[ 7] = rk[ 1] ^ rk[ 6]; + rk[ 8] = rk[ 2] ^ rk[ 7]; + rk[ 9] = rk[ 3] ^ rk[ 8]; + if (++i == 8) + break; + rk[10] = rk[ 4] ^ rk[ 9]; + rk[11] = rk[ 5] ^ rk[10]; + rk += 6; + } + break; + + case 32: + while (true) + { + temp = rk[ 7]; + rk[ 8] = rk[ 0] ^ + (Te4[GETBYTE(temp, 2)] & 0xff000000) ^ + (Te4[GETBYTE(temp, 1)] & 0x00ff0000) ^ + (Te4[GETBYTE(temp, 0)] & 0x0000ff00) ^ + (Te4[GETBYTE(temp, 3)] & 0x000000ff) ^ + rcon_[i]; + rk[ 9] = rk[ 1] ^ rk[ 8]; + rk[10] = rk[ 2] ^ rk[ 9]; + rk[11] = rk[ 3] ^ rk[10]; + if (++i == 7) + break; + temp = rk[11]; + rk[12] = rk[ 4] ^ + (Te4[GETBYTE(temp, 3)] & 0xff000000) ^ + (Te4[GETBYTE(temp, 2)] & 0x00ff0000) ^ + (Te4[GETBYTE(temp, 1)] & 0x0000ff00) ^ + (Te4[GETBYTE(temp, 0)] & 0x000000ff); + rk[13] = rk[ 5] ^ rk[12]; + rk[14] = rk[ 6] ^ rk[13]; + rk[15] = rk[ 7] ^ rk[14]; + + rk += 8; + } + break; + } + + if (dir_ == DECRYPTION) + { + unsigned int i, j; + rk = key_; + + /* invert the order of the round keys: */ + for (i = 0, j = 4*rounds_; i < j; i += 4, j -= 4) { + temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; + temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; + temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; + temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; + } + // apply the inverse MixColumn transform to all round keys but the + // first and the last: + for (i = 1; i < rounds_; i++) { + rk += 4; + rk[0] = + Td0[Te4[GETBYTE(rk[0], 3)] & 0xff] ^ + Td1[Te4[GETBYTE(rk[0], 2)] & 0xff] ^ + Td2[Te4[GETBYTE(rk[0], 1)] & 0xff] ^ + Td3[Te4[GETBYTE(rk[0], 0)] & 0xff]; + rk[1] = + Td0[Te4[GETBYTE(rk[1], 3)] & 0xff] ^ + Td1[Te4[GETBYTE(rk[1], 2)] & 0xff] ^ + Td2[Te4[GETBYTE(rk[1], 1)] & 0xff] ^ + Td3[Te4[GETBYTE(rk[1], 0)] & 0xff]; + rk[2] = + Td0[Te4[GETBYTE(rk[2], 3)] & 0xff] ^ + Td1[Te4[GETBYTE(rk[2], 2)] & 0xff] ^ + Td2[Te4[GETBYTE(rk[2], 1)] & 0xff] ^ + Td3[Te4[GETBYTE(rk[2], 0)] & 0xff]; + rk[3] = + Td0[Te4[GETBYTE(rk[3], 3)] & 0xff] ^ + Td1[Te4[GETBYTE(rk[3], 2)] & 0xff] ^ + Td2[Te4[GETBYTE(rk[3], 1)] & 0xff] ^ + Td3[Te4[GETBYTE(rk[3], 0)] & 0xff]; + } + } +} + + +void AES::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) const +{ + if (dir_ == ENCRYPTION) + encrypt(in, xOr, out); + else + decrypt(in, xOr, out); +} + + +typedef BlockGetAndPut gpBlock; + + +void AES::encrypt(const byte* inBlock, const byte* xorBlock, + byte* outBlock) const +{ + word32 s0, s1, s2, s3; + word32 t0, t1, t2, t3; + + const word32 *rk = key_; + /* + * map byte array block to cipher state + * and add initial round key: + */ + gpBlock::Get(inBlock)(s0)(s1)(s2)(s3); + s0 ^= rk[0]; + s1 ^= rk[1]; + s2 ^= rk[2]; + s3 ^= rk[3]; + + /* + * Nr - 1 full rounds: + */ + + unsigned int r = rounds_ >> 1; + for (;;) { + t0 = + Te0[GETBYTE(s0, 3)] ^ + Te1[GETBYTE(s1, 2)] ^ + Te2[GETBYTE(s2, 1)] ^ + Te3[GETBYTE(s3, 0)] ^ + rk[4]; + t1 = + Te0[GETBYTE(s1, 3)] ^ + Te1[GETBYTE(s2, 2)] ^ + Te2[GETBYTE(s3, 1)] ^ + Te3[GETBYTE(s0, 0)] ^ + rk[5]; + t2 = + Te0[GETBYTE(s2, 3)] ^ + Te1[GETBYTE(s3, 2)] ^ + Te2[GETBYTE(s0, 1)] ^ + Te3[GETBYTE(s1, 0)] ^ + rk[6]; + t3 = + Te0[GETBYTE(s3, 3)] ^ + Te1[GETBYTE(s0, 2)] ^ + Te2[GETBYTE(s1, 1)] ^ + Te3[GETBYTE(s2, 0)] ^ + rk[7]; + + rk += 8; + if (--r == 0) { + break; + } + + s0 = + Te0[GETBYTE(t0, 3)] ^ + Te1[GETBYTE(t1, 2)] ^ + Te2[GETBYTE(t2, 1)] ^ + Te3[GETBYTE(t3, 0)] ^ + rk[0]; + s1 = + Te0[GETBYTE(t1, 3)] ^ + Te1[GETBYTE(t2, 2)] ^ + Te2[GETBYTE(t3, 1)] ^ + Te3[GETBYTE(t0, 0)] ^ + rk[1]; + s2 = + Te0[GETBYTE(t2, 3)] ^ + Te1[GETBYTE(t3, 2)] ^ + Te2[GETBYTE(t0, 1)] ^ + Te3[GETBYTE(t1, 0)] ^ + rk[2]; + s3 = + Te0[GETBYTE(t3, 3)] ^ + Te1[GETBYTE(t0, 2)] ^ + Te2[GETBYTE(t1, 1)] ^ + Te3[GETBYTE(t2, 0)] ^ + rk[3]; + } + + /* + * apply last round and + * map cipher state to byte array block: + */ + + s0 = + (Te4[GETBYTE(t0, 3)] & 0xff000000) ^ + (Te4[GETBYTE(t1, 2)] & 0x00ff0000) ^ + (Te4[GETBYTE(t2, 1)] & 0x0000ff00) ^ + (Te4[GETBYTE(t3, 0)] & 0x000000ff) ^ + rk[0]; + s1 = + (Te4[GETBYTE(t1, 3)] & 0xff000000) ^ + (Te4[GETBYTE(t2, 2)] & 0x00ff0000) ^ + (Te4[GETBYTE(t3, 1)] & 0x0000ff00) ^ + (Te4[GETBYTE(t0, 0)] & 0x000000ff) ^ + rk[1]; + s2 = + (Te4[GETBYTE(t2, 3)] & 0xff000000) ^ + (Te4[GETBYTE(t3, 2)] & 0x00ff0000) ^ + (Te4[GETBYTE(t0, 1)] & 0x0000ff00) ^ + (Te4[GETBYTE(t1, 0)] & 0x000000ff) ^ + rk[2]; + s3 = + (Te4[GETBYTE(t3, 3)] & 0xff000000) ^ + (Te4[GETBYTE(t0, 2)] & 0x00ff0000) ^ + (Te4[GETBYTE(t1, 1)] & 0x0000ff00) ^ + (Te4[GETBYTE(t2, 0)] & 0x000000ff) ^ + rk[3]; + + + gpBlock::Put(xorBlock, outBlock)(s0)(s1)(s2)(s3); +} + + +void AES::decrypt(const byte* inBlock, const byte* xorBlock, + byte* outBlock) const +{ + word32 s0, s1, s2, s3; + word32 t0, t1, t2, t3; + const word32* rk = key_; + + /* + * map byte array block to cipher state + * and add initial round key: + */ + gpBlock::Get(inBlock)(s0)(s1)(s2)(s3); + s0 ^= rk[0]; + s1 ^= rk[1]; + s2 ^= rk[2]; + s3 ^= rk[3]; + + /* + * Nr - 1 full rounds: + */ + + unsigned int r = rounds_ >> 1; + for (;;) { + t0 = + Td0[GETBYTE(s0, 3)] ^ + Td1[GETBYTE(s3, 2)] ^ + Td2[GETBYTE(s2, 1)] ^ + Td3[GETBYTE(s1, 0)] ^ + rk[4]; + t1 = + Td0[GETBYTE(s1, 3)] ^ + Td1[GETBYTE(s0, 2)] ^ + Td2[GETBYTE(s3, 1)] ^ + Td3[GETBYTE(s2, 0)] ^ + rk[5]; + t2 = + Td0[GETBYTE(s2, 3)] ^ + Td1[GETBYTE(s1, 2)] ^ + Td2[GETBYTE(s0, 1)] ^ + Td3[GETBYTE(s3, 0)] ^ + rk[6]; + t3 = + Td0[GETBYTE(s3, 3)] ^ + Td1[GETBYTE(s2, 2)] ^ + Td2[GETBYTE(s1, 1)] ^ + Td3[GETBYTE(s0, 0)] ^ + rk[7]; + + rk += 8; + if (--r == 0) { + break; + } + + s0 = + Td0[GETBYTE(t0, 3)] ^ + Td1[GETBYTE(t3, 2)] ^ + Td2[GETBYTE(t2, 1)] ^ + Td3[GETBYTE(t1, 0)] ^ + rk[0]; + s1 = + Td0[GETBYTE(t1, 3)] ^ + Td1[GETBYTE(t0, 2)] ^ + Td2[GETBYTE(t3, 1)] ^ + Td3[GETBYTE(t2, 0)] ^ + rk[1]; + s2 = + Td0[GETBYTE(t2, 3)] ^ + Td1[GETBYTE(t1, 2)] ^ + Td2[GETBYTE(t0, 1)] ^ + Td3[GETBYTE(t3, 0)] ^ + rk[2]; + s3 = + Td0[GETBYTE(t3, 3)] ^ + Td1[GETBYTE(t2, 2)] ^ + Td2[GETBYTE(t1, 1)] ^ + Td3[GETBYTE(t0, 0)] ^ + rk[3]; + } + /* + * apply last round and + * map cipher state to byte array block: + */ + s0 = + (Td4[GETBYTE(t0, 3)] & 0xff000000) ^ + (Td4[GETBYTE(t3, 2)] & 0x00ff0000) ^ + (Td4[GETBYTE(t2, 1)] & 0x0000ff00) ^ + (Td4[GETBYTE(t1, 0)] & 0x000000ff) ^ + rk[0]; + s1 = + (Td4[GETBYTE(t1, 3)] & 0xff000000) ^ + (Td4[GETBYTE(t0, 2)] & 0x00ff0000) ^ + (Td4[GETBYTE(t3, 1)] & 0x0000ff00) ^ + (Td4[GETBYTE(t2, 0)] & 0x000000ff) ^ + rk[1]; + s2 = + (Td4[GETBYTE(t2, 3)] & 0xff000000) ^ + (Td4[GETBYTE(t1, 2)] & 0x00ff0000) ^ + (Td4[GETBYTE(t0, 1)] & 0x0000ff00) ^ + (Td4[GETBYTE(t3, 0)] & 0x000000ff) ^ + rk[2]; + s3 = + (Td4[GETBYTE(t3, 3)] & 0xff000000) ^ + (Td4[GETBYTE(t2, 2)] & 0x00ff0000) ^ + (Td4[GETBYTE(t1, 1)] & 0x0000ff00) ^ + (Td4[GETBYTE(t0, 0)] & 0x000000ff) ^ + rk[3]; + + gpBlock::Put(xorBlock, outBlock)(s0)(s1)(s2)(s3); +} + + +#if defined(DO_AES_ASM) + #ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + #define PROLOG() \ + asm(".intel_syntax noprefix"); \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( sub esp, 4 ) \ + AS2( movd mm7, ebp ) \ + AS2( mov [ebp - 4], esi ) \ + AS2( mov ecx, DWORD PTR [ebp + 8] ) \ + AS2( mov esi, DWORD PTR [ebp + 12] ) \ + AS2( mov ebp, DWORD PTR [ebp + 20] ) + + #define EPILOG() \ + AS2( mov esi, [ebp - 4] ) \ + AS2( mov esp, ebp ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS1( emms ) \ + asm(".att_syntax"); + #else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( sub esp, 4 ) \ + AS2( movd mm7, ebp ) \ + AS2( mov [ebp - 4], esi ) \ + AS2( mov esi, DWORD PTR [ebp + 8] ) \ + AS2( mov ebp, DWORD PTR [ebp + 16] ) + + // ebp is restored at end + #define EPILOG() \ + AS2( mov esi, [ebp - 4] ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 12 ) + + + #endif + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void AES::AsmEncrypt(const byte* inBlock, byte* outBlock, void* boxes) const +{ + + PROLOG() + + #ifdef OLD_GCC_OFFSET + AS2( mov edx, DWORD PTR [ecx + 60] ) // rounds + AS2( lea edi, [ecx + 64] ) // rk + #else + AS2( mov edx, DWORD PTR [ecx + 56] ) // rounds + AS2( lea edi, [ecx + 60] ) // rk + #endif + + AS1( dec edx ) + AS2( movd mm6, edi ) // save rk + AS2( movd mm5, edx ) // save rounds + + AS2( mov eax, DWORD PTR [esi] ) + AS2( mov ebx, DWORD PTR [esi + 4] ) + AS2( mov ecx, DWORD PTR [esi + 8] ) + AS2( mov edx, DWORD PTR [esi + 12] ) + + AS1( bswap eax ) + AS1( bswap ebx ) + AS1( bswap ecx ) + AS1( bswap edx ) + + AS2( xor eax, DWORD PTR [edi] ) // s0 + AS2( xor ebx, DWORD PTR [edi + 4] ) // s1 + AS2( xor ecx, DWORD PTR [edi + 8] ) // s2 + AS2( xor edx, DWORD PTR [edi + 12] ) // s3 + + AS1(loop1: ) + /* Put0 (mm0) = + Te0[get0,rs 24] ^ + Te1[get1,rs 16] ^ + Te2[get2,rs 8] ^ + Te3[get3,rs 0] + */ + + AS2( mov esi, eax ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, ebx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor esi, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx edi, ch ) + AS2( xor esi, DWORD PTR [ebp + 2048 + edi*4] ) + + AS2( movzx edi, dl ) + AS2( xor esi, DWORD PTR [ebp + 3072 + edi*4] ) + + AS2( movd mm0, esi ) + + /* Put1 (mm1) = + Te0[get1,rs 24] ^ + Te1[get2,rs 16] ^ + Te2[get3,rs 8] ^ + Te3[get0,rs 0] + */ + + AS2( mov esi, ebx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, ecx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor esi, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx edi, dh ) + AS2( xor esi, DWORD PTR [ebp + 2048 + edi*4] ) + + AS2( movzx edi, al ) + AS2( xor esi, DWORD PTR [ebp + 3072 + edi*4] ) + + AS2( movd mm1, esi ) + + + /* Put2 (mm2) = + Te0[get2,rs 24] ^ + Te1[get3,rs 16] ^ + Te2[get0,rs 8] ^ + Te3[get1,rs 0] + */ + + AS2( mov esi, ecx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, edx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor esi, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx edi, ah ) + AS2( xor esi, DWORD PTR [ebp + 2048 + edi*4] ) + + AS2( movzx edi, bl ) + AS2( xor esi, DWORD PTR [ebp + 3072 + edi*4] ) + + AS2( movd mm2, esi ) + + /* Put3 (edx) = + Te0[get3,rs 24] ^ + Te1[get0,rs 16] ^ + Te2[get1,rs 8] ^ + Te3[get2,rs 0] + */ + + AS2( mov esi, edx ) + AS2( shr esi, 24 ) + AS2( mov edx, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, eax ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor edx, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx esi, bh ) + AS2( xor edx, DWORD PTR [ebp + 2048 + esi*4] ) + + AS2( movzx edi, cl ) + AS2( xor edx, DWORD PTR [ebp + 3072 + edi*4] ) + + // xOr + + AS2( movd esi, mm6 ) // rk + + AS2( movd eax, mm0 ) + AS2( add esi, 16 ) + AS2( movd ebx, mm1 ) + AS2( movd mm6, esi ) // save back + AS2( movd ecx, mm2 ) + + AS2( xor eax, DWORD PTR [esi] ) + AS2( xor ebx, DWORD PTR [esi + 4] ) + AS2( movd edi, mm5 ) + AS2( xor ecx, DWORD PTR [esi + 8] ) + AS2( xor edx, DWORD PTR [esi + 12] ) + + AS1( dec edi ) + AS2( movd mm5, edi ) + + AS1( jnz loop1 ) + + // last round + /* + Put0 (mm0) = + (Te4[get0, rs24] & 0xff000000) ^ h = 4278190080 + (Te4[get1, rs16] & 0x00ff0000) ^ h = 16711680 + (Te4[get2, rs 8] & 0x0000ff00) ^ h = 65280 + (Te4[get3, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, eax ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and esi, 4278190080 ) + + AS2( mov edi, ebx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 16711680 ) + AS2( xor esi, edi ) + + AS2( movzx edi, ch ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 65280 ) + AS2( xor esi, edi ) + + AS2( movzx edi, dl ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 255 ) + AS2( xor esi, edi ) + + AS2( movd mm0, esi ) + + /* + Put1 (mm1) = + (Te4[get1, rs24] & 0xff000000) ^ h = 4278190080 + (Te4[get2, rs16] & 0x00ff0000) ^ h = 16711680 + (Te4[get3, rs 8] & 0x0000ff00) ^ h = 65280 + (Te4[get0, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, ebx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and esi, 4278190080 ) + + AS2( mov edi, ecx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 16711680 ) + AS2( xor esi, edi ) + + AS2( movzx edi, dh ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 65280 ) + AS2( xor esi, edi ) + + AS2( movzx edi, al ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 255 ) + AS2( xor esi, edi ) + + AS2( movd mm1, esi ) + + /* + Put2 (mm2) = + (Te4[get2, rs24] & 0xff000000) ^ h = 4278190080 + (Te4[get3, rs16] & 0x00ff0000) ^ h = 16711680 + (Te4[get0, rs 8] & 0x0000ff00) ^ h = 65280 + (Te4[get1, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, ecx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and esi, 4278190080 ) + + AS2( mov edi, edx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 16711680 ) + AS2( xor esi, edi ) + + AS2( movzx edi, ah ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 65280 ) + AS2( xor esi, edi ) + + AS2( movzx edi, bl ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 255 ) + AS2( xor esi, edi ) + + AS2( movd mm2, esi ) + + /* + Put3 (edx) = + (Te4[get3, rs24] & 0xff000000) ^ h = 4278190080 + (Te4[get0, rs16] & 0x00ff0000) ^ h = 16711680 + (Te4[get1, rs 8] & 0x0000ff00) ^ h = 65280 + (Te4[get2, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, edx ) + AS2( shr esi, 24 ) + AS2( mov edx, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and edx, 4278190080 ) + + AS2( mov edi, eax ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and esi, 16711680 ) + AS2( xor edx, esi ) + + AS2( movzx esi, bh ) + AS2( mov edi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and edi, 65280 ) + AS2( xor edx, edi ) + + AS2( movzx edi, cl ) + AS2( mov esi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and esi, 255 ) + AS2( xor edx, esi ) + + + // xOr + AS2( movd eax, mm0 ) + AS2( movd esi, mm6 ) // rk + AS2( movd ebx, mm1 ) + AS2( add esi, 16 ) + AS2( movd ecx, mm2 ) + + AS2( xor eax, DWORD PTR [esi] ) + AS2( xor ebx, DWORD PTR [esi + 4] ) + AS2( xor ecx, DWORD PTR [esi + 8] ) + AS2( xor edx, DWORD PTR [esi + 12] ) + + // end + AS2( movd ebp, mm7 ) + + // swap + AS1( bswap eax ) + AS1( bswap ebx ) + + // store + #ifdef __GNUC__ + AS2( mov esi, DWORD PTR [ebp + 16] ) // outBlock + #else + AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock + #endif + + AS1( bswap ecx ) + AS1( bswap edx ) + + AS2( mov DWORD PTR [esi], eax ) + AS2( mov DWORD PTR [esi + 4], ebx ) + AS2( mov DWORD PTR [esi + 8], ecx ) + AS2( mov DWORD PTR [esi + 12], edx ) + + + EPILOG() +} + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void AES::AsmDecrypt(const byte* inBlock, byte* outBlock, void* boxes) const +{ + + PROLOG() + + #ifdef OLD_GCC_OFFSET + AS2( mov edx, DWORD PTR [ecx + 60] ) // rounds + AS2( lea edi, [ecx + 64] ) // rk + #else + AS2( mov edx, DWORD PTR [ecx + 56] ) // rounds + AS2( lea edi, [ecx + 60] ) // rk + #endif + + AS1( dec edx ) + AS2( movd mm6, edi ) // save rk + AS2( movd mm5, edx ) // save rounds + + AS2( mov eax, DWORD PTR [esi] ) + AS2( mov ebx, DWORD PTR [esi + 4] ) + AS2( mov ecx, DWORD PTR [esi + 8] ) + AS2( mov edx, DWORD PTR [esi + 12] ) + + AS1( bswap eax ) + AS1( bswap ebx ) + AS1( bswap ecx ) + AS1( bswap edx ) + + AS2( xor eax, DWORD PTR [edi] ) // s0 + AS2( xor ebx, DWORD PTR [edi + 4] ) // s1 + AS2( xor ecx, DWORD PTR [edi + 8] ) // s2 + AS2( xor edx, DWORD PTR [edi + 12] ) // s3 + + + AS1(loop2: ) + /* Put0 (mm0) = + Td0[GETBYTE(get0, rs24)] ^ + Td1[GETBYTE(get3, rs16)] ^ + Td2[GETBYTE(get2, rs 8)] ^ + Td3[GETBYTE(tet1, )] + */ + AS2( mov esi, eax ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, edx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor esi, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx edi, ch ) + AS2( xor esi, DWORD PTR [ebp + 2048 + edi*4] ) + + AS2( movzx edi, bl ) + AS2( xor esi, DWORD PTR [ebp + 3072 + edi*4] ) + + AS2( movd mm0, esi ) + + /* Put1 (mm1) = + Td0[GETBYTE(get1, rs24)] ^ + Td1[GETBYTE(get0, rs16)] ^ + Td2[GETBYTE(get3, rs 8)] ^ + Td3[GETBYTE(tet2, )] + */ + AS2( mov esi, ebx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, eax ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor esi, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx edi, dh ) + AS2( xor esi, DWORD PTR [ebp + 2048 + edi*4] ) + + AS2( movzx edi, cl ) + AS2( xor esi, DWORD PTR [ebp + 3072 + edi*4] ) + + AS2( movd mm1, esi ) + + /* Put2 (mm2) = + Td0[GETBYTE(get2, rs24)] ^ + Td1[GETBYTE(get1, rs16)] ^ + Td2[GETBYTE(get0, rs 8)] ^ + Td3[GETBYTE(tet3, )] + */ + AS2( mov esi, ecx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, ebx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor esi, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx edi, ah ) + AS2( xor esi, DWORD PTR [ebp + 2048 + edi*4] ) + + AS2( movzx edi, dl ) + AS2( xor esi, DWORD PTR [ebp + 3072 + edi*4] ) + + AS2( movd mm2, esi ) + + /* Put3 (edx) = + Td0[GETBYTE(get3, rs24)] ^ + Td1[GETBYTE(get2, rs16)] ^ + Td2[GETBYTE(get1, rs 8)] ^ + Td3[GETBYTE(tet0, )] + */ + AS2( mov esi, edx ) + AS2( shr esi, 24 ) + AS2( mov edx, DWORD PTR [ebp + esi*4] ) + + AS2( mov edi, ecx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( xor edx, DWORD PTR [ebp + 1024 + edi*4] ) + + AS2( movzx esi, bh ) + AS2( xor edx, DWORD PTR [ebp + 2048 + esi*4] ) + + AS2( movzx edi, al ) + AS2( xor edx, DWORD PTR [ebp + 3072 + edi*4] ) + + + // xOr + + AS2( movd esi, mm6 ) // rk + AS2( add esi, 16 ) + AS2( movd mm6, esi ) // save back + + AS2( movd eax, mm0 ) + AS2( movd ebx, mm1 ) + AS2( movd ecx, mm2 ) + + AS2( xor eax, DWORD PTR [esi] ) + AS2( xor ebx, DWORD PTR [esi + 4] ) + AS2( xor ecx, DWORD PTR [esi + 8] ) + AS2( xor edx, DWORD PTR [esi + 12] ) + + AS2( movd edi, mm5 ) + AS1( dec edi ) + AS2( movd mm5, edi ) + + AS1( jnz loop2 ) + + // last round + /* + Put0 (mm0) = + (Td4[get0, rs24] & 0xff000000) ^ h = 4278190080 + (Td4[get3, rs16] & 0x00ff0000) ^ h = 16711680 + (Td4[get2, rs 8] & 0x0000ff00) ^ h = 65280 + (Td4[get1, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, eax ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and esi, 4278190080 ) + + AS2( mov edi, edx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 16711680 ) + AS2( xor esi, edi ) + + AS2( movzx edi, ch ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 65280 ) + AS2( xor esi, edi ) + + AS2( movzx edi, bl ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 255 ) + AS2( xor esi, edi ) + + AS2( movd mm0, esi ) + + /* + Put1 (mm1) = + (Td4[get1, rs24] & 0xff000000) ^ h = 4278190080 + (Td4[get0, rs16] & 0x00ff0000) ^ h = 16711680 + (Td4[get3, rs 8] & 0x0000ff00) ^ h = 65280 + (Td4[get2, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, ebx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and esi, 4278190080 ) + + AS2( mov edi, eax ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 16711680 ) + AS2( xor esi, edi ) + + AS2( movzx edi, dh ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 65280 ) + AS2( xor esi, edi ) + + AS2( movzx edi, cl ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 255 ) + AS2( xor esi, edi ) + + AS2( movd mm1, esi ) + + /* + Put2 (mm2) = + (Td4[get2, rs24] & 0xff000000) ^ h = 4278190080 + (Td4[get1, rs16] & 0x00ff0000) ^ h = 16711680 + (Td4[get0, rs 8] & 0x0000ff00) ^ h = 65280 + (Td4[get3, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, ecx ) + AS2( shr esi, 24 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and esi, 4278190080 ) + + AS2( mov edi, ebx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 16711680 ) + AS2( xor esi, edi ) + + AS2( movzx edi, ah ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 65280 ) + AS2( xor esi, edi ) + + AS2( movzx edi, dl ) + AS2( mov edi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and edi, 255 ) + AS2( xor esi, edi ) + + AS2( movd mm2, esi ) + + /* + Put3 (edx) = + (Td4[get3, rs24] & 0xff000000) ^ h = 4278190080 + (Td4[get2, rs16] & 0x00ff0000) ^ h = 16711680 + (Td4[get1, rs 8] & 0x0000ff00) ^ h = 65280 + (Td4[get0, rs 0] & 0x000000ff) h = 255 + */ + AS2( mov esi, edx ) + AS2( shr esi, 24 ) + AS2( mov edx, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and edx, 4278190080 ) + + AS2( mov edi, ecx ) + AS2( shr edi, 16 ) + AS2( and edi, 255 ) + AS2( mov esi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and esi, 16711680 ) + AS2( xor edx, esi ) + + AS2( movzx esi, bh ) + AS2( mov edi, DWORD PTR [ebp + 4096 + esi*4] ) + AS2( and edi, 65280 ) + AS2( xor edx, edi ) + + AS2( movzx edi, al ) + AS2( mov esi, DWORD PTR [ebp + 4096 + edi*4] ) + AS2( and esi, 255 ) + AS2( xor edx, esi ) + + + // xOr + AS2( movd esi, mm6 ) // rk + AS2( add esi, 16 ) + + AS2( movd eax, mm0 ) + AS2( movd ebx, mm1 ) + AS2( movd ecx, mm2 ) + + AS2( xor eax, DWORD PTR [esi] ) + AS2( xor ebx, DWORD PTR [esi + 4] ) + AS2( xor ecx, DWORD PTR [esi + 8] ) + AS2( xor edx, DWORD PTR [esi + 12] ) + + // end + AS2( movd ebp, mm7 ) + + // swap + AS1( bswap eax ) + AS1( bswap ebx ) + AS1( bswap ecx ) + AS1( bswap edx ) + + // store + #ifdef __GNUC__ + AS2( mov esi, DWORD PTR [ebp + 16] ) // outBlock + #else + AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock + #endif + AS2( mov DWORD PTR [esi], eax ) + AS2( mov DWORD PTR [esi + 4], ebx ) + AS2( mov DWORD PTR [esi + 8], ecx ) + AS2( mov DWORD PTR [esi + 12], edx ) + + + EPILOG() +} + + + +#endif // defined(DO_AES_ASM) + + + +const word32 AES::Te[5][256] = { +{ + 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, + 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, + 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, + 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, + 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, + 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, + 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, + 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, + 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, + 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, + 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, + 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, + 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, + 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, + 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, + 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, + 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, + 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, + 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, + 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, + 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, + 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, + 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, + 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, + 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, + 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, + 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, + 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, + 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, + 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, + 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, + 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, + 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, + 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, + 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, + 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, + 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, + 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, + 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, + 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, + 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, + 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, + 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, + 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, + 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, + 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, + 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, + 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, + 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, + 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, + 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, + 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, + 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, + 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, + 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, + 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, + 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, + 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, + 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, + 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, + 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, + 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, + 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, + 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, +}, +{ + 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, + 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, + 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, + 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, + 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, + 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, + 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, + 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, + 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, + 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, + 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, + 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, + 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, + 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, + 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, + 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, + 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, + 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, + 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, + 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, + 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, + 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, + 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, + 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, + 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, + 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, + 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, + 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, + 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, + 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, + 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, + 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, + 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, + 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, + 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, + 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, + 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, + 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, + 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, + 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, + 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, + 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, + 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, + 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, + 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, + 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, + 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, + 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, + 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, + 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, + 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, + 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, + 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, + 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, + 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, + 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, + 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, + 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, + 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, + 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, + 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, + 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, + 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, + 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, +}, +{ + 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, + 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, + 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, + 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, + 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, + 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, + 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, + 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, + 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, + 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, + 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, + 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, + 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, + 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, + 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, + 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, + 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, + 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, + 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, + 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, + 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, + 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, + 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, + 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, + 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, + 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, + 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, + 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, + 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, + 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, + 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, + 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, + 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, + 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, + 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, + 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, + 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, + 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, + 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, + 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, + 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, + 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, + 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, + 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, + 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, + 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, + 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, + 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, + 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, + 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, + 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, + 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, + 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, + 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, + 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, + 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, + 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, + 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, + 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, + 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, + 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, + 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, + 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, + 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, +}, +{ + 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, + 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, + 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, + 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, + 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, + 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, + 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, + 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, + 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, + 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, + 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, + 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, + 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, + 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, + 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, + 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, + 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, + 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, + 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, + 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, + 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, + 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, + 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, + 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, + 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, + 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, + 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, + 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, + 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, + 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, + 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, + 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, + 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, + 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, + 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, + 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, + 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, + 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, + 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, + 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, + 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, + 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, + 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, + 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, + 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, + 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, + 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, + 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, + 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, + 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, + 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, + 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, + 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, + 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, + 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, + 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, + 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, + 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, + 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, + 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, + 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, + 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, + 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, + 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, +}, +{ + 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, + 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, + 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, + 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, + 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, + 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, + 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, + 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, + 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, + 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, + 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, + 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, + 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, + 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, + 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, + 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, + 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, + 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, + 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, + 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, + 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, + 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, + 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, + 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, + 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, + 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, + 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, + 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, + 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, + 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, + 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, + 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, + 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, + 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, + 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, + 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, + 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, + 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, + 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, + 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, + 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, + 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, + 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, + 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, + 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, + 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, + 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, + 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, + 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, + 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, + 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, + 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, + 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, + 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, + 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, + 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, + 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, + 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, + 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, + 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, + 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, + 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, + 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, + 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, +} +}; + + +const word32 AES::Td[5][256] = { +{ + 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, + 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, + 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, + 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, + 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, + 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, + 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, + 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, + 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, + 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, + 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, + 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, + 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, + 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, + 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, + 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, + 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, + 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, + 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, + 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, + 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, + 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, + 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, + 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, + 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, + 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, + 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, + 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, + 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, + 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, + 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, + 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, + 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, + 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, + 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, + 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, + 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, + 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, + 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, + 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, + 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, + 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, + 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, + 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, + 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, + 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, + 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, + 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, + 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, + 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, + 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, + 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, + 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, + 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, + 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, + 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, + 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, + 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, + 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, + 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, + 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, + 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, + 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, + 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, +}, +{ + 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, + 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, + 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, + 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, + 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, + 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, + 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, + 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, + 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, + 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, + 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, + 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, + 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, + 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, + 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, + 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, + 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, + 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, + 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, + 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, + 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, + 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, + 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, + 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, + 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, + 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, + 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, + 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, + 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, + 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, + 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, + 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, + 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, + 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, + 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, + 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, + 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, + 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, + 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, + 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, + 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, + 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, + 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, + 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, + 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, + 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, + 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, + 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, + 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, + 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, + 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, + 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, + 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, + 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, + 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, + 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, + 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, + 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, + 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, + 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, + 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, + 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, + 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, + 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, +}, +{ + 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, + 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, + 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, + 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, + 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, + 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, + 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, + 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, + 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, + 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, + 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, + 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, + 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, + 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, + 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, + 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, + 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, + 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, + 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, + 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, + + 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, + 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, + 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, + 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, + 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, + 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, + 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, + 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, + 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, + 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, + 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, + 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, + 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, + 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, + 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, + 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, + 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, + 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, + 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, + 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, + 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, + 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, + 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, + 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, + 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, + 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, + 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, + 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, + 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, + 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, + 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, + 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, + 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, + 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, + 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, + 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, + 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, + 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, + 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, + 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, + 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, + 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, + 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, + 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, +}, +{ + 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, + 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, + 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, + 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, + 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, + 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, + 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, + 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, + 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, + 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, + 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, + 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, + 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, + 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, + 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, + 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, + 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, + 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, + 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, + 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, + 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, + 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, + 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, + 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, + 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, + 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, + 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, + 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, + 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, + 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, + 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, + 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, + 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, + 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, + 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, + 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, + 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, + 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, + 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, + 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, + 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, + 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, + 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, + 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, + 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, + 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, + 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, + 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, + 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, + 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, + 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, + 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, + 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, + 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, + 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, + 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, + 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, + 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, + 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, + 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, + 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, + 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, + 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, + 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, +}, +{ + 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, + 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, + 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, + 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, + 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, + 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, + 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, + 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, + 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, + 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, + 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, + 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, + 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, + 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, + 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, + 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, + 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, + 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, + 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, + 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, + 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, + 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, + 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, + 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, + 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, + 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, + 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, + 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, + 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, + 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, + 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, + 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, + 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, + 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, + 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, + 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, + 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, + 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, + 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, + 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, + 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, + 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, + 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, + 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, + 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, + 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, + 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, + 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, + 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, + 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, + 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, + 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, + 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, + 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, + 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, + 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, + 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, + 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, + 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, + 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, + 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, + 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, + 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, + 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, +} +}; + + +const word32* AES::Te0 = AES::Te[0]; +const word32* AES::Te1 = AES::Te[1]; +const word32* AES::Te2 = AES::Te[2]; +const word32* AES::Te3 = AES::Te[3]; +const word32* AES::Te4 = AES::Te[4]; + +const word32* AES::Td0 = AES::Td[0]; +const word32* AES::Td1 = AES::Td[1]; +const word32* AES::Td2 = AES::Td[2]; +const word32* AES::Td3 = AES::Td[3]; +const word32* AES::Td4 = AES::Td[4]; + + + +} // namespace + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/aestables.cpp b/externals/mysql/extlib/yassl/taocrypt/src/aestables.cpp new file mode 100644 index 0000000..e9d6b7a --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/aestables.cpp @@ -0,0 +1,38 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's aestables.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "aes.hpp" + + +namespace TaoCrypt { + + +const word32 AES::rcon_[] = { + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000, + 0x1B000000, 0x36000000, + /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ +}; + + + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/algebra.cpp b/externals/mysql/extlib/yassl/taocrypt/src/algebra.cpp new file mode 100644 index 0000000..cb597c4 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/algebra.cpp @@ -0,0 +1,339 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's algebra.cpp from CryptoPP */ +#undef NDEBUG +#define DEBUG // GCC 4.0 bug if NDEBUG and Optimize > 1 + +#include "runtime.hpp" +#include "algebra.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "vector.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + +namespace TaoCrypt { + + +const Integer& AbstractGroup::Double(const Element &a) const +{ + return Add(a, a); +} + +const Integer& AbstractGroup::Subtract(const Element &a, const Element &b) const +{ + // make copy of a in case Inverse() overwrites it + Element a1(a); + return Add(a1, Inverse(b)); +} + +Integer& AbstractGroup::Accumulate(Element &a, const Element &b) const +{ + return a = Add(a, b); +} + +Integer& AbstractGroup::Reduce(Element &a, const Element &b) const +{ + return a = Subtract(a, b); +} + +const Integer& AbstractRing::Square(const Element &a) const +{ + return Multiply(a, a); +} + + +const Integer& AbstractRing::Divide(const Element &a, const Element &b) const +{ + // make copy of a in case MultiplicativeInverse() overwrites it + Element a1(a); + return Multiply(a1, MultiplicativeInverse(b)); +} + + +const Integer& AbstractEuclideanDomain::Mod(const Element &a, + const Element &b) const +{ + Element q; + DivisionAlgorithm(result, q, a, b); + return result; +} + +const Integer& AbstractEuclideanDomain::Gcd(const Element &a, + const Element &b) const +{ + STL::vector g(3); + g[0]= b; + g[1]= a; + unsigned int i0=0, i1=1, i2=2; + + while (!Equal(g[i1], this->Identity())) + { + g[i2] = Mod(g[i0], g[i1]); + unsigned int t = i0; i0 = i1; i1 = i2; i2 = t; + } + + return result = g[i0]; +} + + +Integer AbstractGroup::ScalarMultiply(const Element &base, + const Integer &exponent) const +{ + Element result; + SimultaneousMultiply(&result, base, &exponent, 1); + return result; +} + + +Integer AbstractGroup::CascadeScalarMultiply(const Element &x, + const Integer &e1, const Element &y, const Integer &e2) const +{ + const unsigned expLen = max(e1.BitCount(), e2.BitCount()); + if (expLen==0) + return Identity(); + + const unsigned w = (expLen <= 46 ? 1 : (expLen <= 260 ? 2 : 3)); + const unsigned tableSize = 1< powerTable(tableSize << w); + + powerTable[1] = x; + powerTable[tableSize] = y; + if (w==1) + powerTable[3] = Add(x,y); + else + { + powerTable[2] = Double(x); + powerTable[2*tableSize] = Double(y); + + unsigned i, j; + + for (i=3; i=0; i--) + { + power1 = 2*power1 + e1.GetBit(i); + power2 = 2*power2 + e2.GetBit(i); + + if (i==0 || 2*power1 >= tableSize || 2*power2 >= tableSize) + { + unsigned squaresBefore = prevPosition-i; + unsigned squaresAfter = 0; + prevPosition = i; + while ((power1 || power2) && power1%2 == 0 && power2%2==0) + { + power1 /= 2; + power2 /= 2; + squaresBefore--; + squaresAfter++; + } + if (firstTime) + { + result = powerTable[(power2<= expLen) + { + finished = true; + return; + } + skipCount++; + } + + exp >>= skipCount; + windowBegin += skipCount; + expWindow = exp % (1 << windowSize); + + if (fastNegate && exp.GetBit(windowSize)) + { + negateNext = true; + expWindow = (1 << windowSize) - expWindow; + exp += windowModulus; + } + else + negateNext = false; + } + + Integer exp, windowModulus; + unsigned int windowSize, windowBegin, expWindow; + bool fastNegate, negateNext, firstTime, finished; +}; + + +void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base, + const Integer *expBegin, unsigned int expCount) const +{ + STL::vector > buckets(expCount); + STL::vector exponents; + exponents.reserve(expCount); + unsigned int i; + + for (i=0; iNotNegative()); + exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 0)); + exponents[i].FindNextWindow(); + buckets[i].resize(1<<(exponents[i].windowSize-1), Identity()); + } + + unsigned int expBitPosition = 0; + Element g = base; + bool notDone = true; + + while (notDone) + { + notDone = false; + for (i=0; i 1) + { + for (int j = buckets[i].size()-2; j >= 1; j--) + { + Accumulate(buckets[i][j], buckets[i][j+1]); + Accumulate(r, buckets[i][j]); + } + Accumulate(buckets[i][0], buckets[i][1]); + r = Add(Double(r), buckets[i][0]); + } + } +} + +Integer AbstractRing::Exponentiate(const Element &base, + const Integer &exponent) const +{ + Element result; + SimultaneousExponentiate(&result, base, &exponent, 1); + return result; +} + + +Integer AbstractRing::CascadeExponentiate(const Element &x, + const Integer &e1, const Element &y, const Integer &e2) const +{ + return MultiplicativeGroup().AbstractGroup::CascadeScalarMultiply( + x, e1, y, e2); +} + + +void AbstractRing::SimultaneousExponentiate(Integer *results, + const Integer &base, + const Integer *exponents, unsigned int expCount) const +{ + MultiplicativeGroup().AbstractGroup::SimultaneousMultiply(results, base, + exponents, expCount); +} + + +} // namespace + + +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION +namespace mySTL { +template TaoCrypt::WindowSlider* uninit_copy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); +template void destroy(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); +template TaoCrypt::WindowSlider* GetArrayMemory(size_t); +template void FreeArrayMemory(TaoCrypt::WindowSlider*); +} +#endif + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/arc4.cpp b/externals/mysql/extlib/yassl/taocrypt/src/arc4.cpp new file mode 100644 index 0000000..0944cc3 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/arc4.cpp @@ -0,0 +1,235 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's arc4.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "arc4.hpp" + + +#if defined(TAOCRYPT_X86ASM_AVAILABLE) && defined(TAO_ASM) + #define DO_ARC4_ASM +#endif + + +namespace TaoCrypt { + +void ARC4::SetKey(const byte* key, word32 length) +{ + x_ = 1; + y_ = 0; + + word32 i; + + for (i = 0; i < STATE_SIZE; i++) + state_[i] = i; + + word32 keyIndex = 0, stateIndex = 0; + + for (i = 0; i < STATE_SIZE; i++) { + word32 a = state_[i]; + stateIndex += key[keyIndex] + a; + stateIndex &= 0xFF; + state_[i] = state_[stateIndex]; + state_[stateIndex] = a; + + if (++keyIndex >= length) + keyIndex = 0; + } +} + + +// local +namespace { + +inline unsigned int MakeByte(word32& x, word32& y, byte* s) +{ + word32 a = s[x]; + y = (y+a) & 0xff; + + word32 b = s[y]; + s[x] = b; + s[y] = a; + x = (x+1) & 0xff; + + return s[(a+b) & 0xff]; +} + +} // namespace + + + +void ARC4::Process(byte* out, const byte* in, word32 length) +{ + if (length == 0) return; + +#ifdef DO_ARC4_ASM + if (isMMX) { + AsmProcess(out, in, length); + return; + } +#endif + + byte *const s = state_; + word32 x = x_; + word32 y = y_; + + if (in == out) + while (length--) + *out++ ^= MakeByte(x, y, s); + else + while(length--) + *out++ = *in++ ^ MakeByte(x, y, s); + x_ = x; + y_ = y; +} + + + +#ifdef DO_ARC4_ASM + +#ifdef _MSC_VER + __declspec(naked) +#else + __attribute__ ((noinline)) +#endif +void ARC4::AsmProcess(byte* out, const byte* in, word32 length) +{ +#ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + #define PROLOG() \ + asm(".intel_syntax noprefix"); \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov ecx, DWORD PTR [ebp + 8] ) \ + AS2( mov edi, DWORD PTR [ebp + 12] ) \ + AS2( mov esi, DWORD PTR [ebp + 16] ) \ + AS2( mov ebp, DWORD PTR [ebp + 20] ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( mov esp, ebp ) \ + AS2( movd edi, mm3 ) \ + AS1( emms ) \ + asm(".att_syntax"); +#else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov edi, DWORD PTR [ebp + 8] ) \ + AS2( mov esi, DWORD PTR [ebp + 12] ) \ + AS2( mov ebp, DWORD PTR [ebp + 16] ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 12 ) + +#endif + + PROLOG() + + AS2( sub esp, 4 ) // make room + + AS2( cmp ebp, 0 ) + AS1( jz nothing ) + + AS2( mov [esp], ebp ) // length + + AS2( movzx edx, BYTE PTR [ecx + 1] ) // y + AS2( lea ebp, [ecx + 2] ) // state_ + AS2( movzx ecx, BYTE PTR [ecx] ) // x + + // setup loop + // a = s[x]; + AS2( movzx eax, BYTE PTR [ebp + ecx] ) + + +AS1( begin: ) + + // y = (y+a) & 0xff; + AS2( add edx, eax ) + AS2( and edx, 255 ) + + // b = s[y]; + AS2( movzx ebx, BYTE PTR [ebp + edx] ) + + // s[x] = b; + AS2( mov [ebp + ecx], bl ) + + // s[y] = a; + AS2( mov [ebp + edx], al ) + + // x = (x+1) & 0xff; + AS1( inc ecx ) + AS2( and ecx, 255 ) + + //return s[(a+b) & 0xff]; + AS2( add eax, ebx ) + AS2( and eax, 255 ) + + AS2( movzx ebx, BYTE PTR [ebp + eax] ) + + // a = s[x]; for next round + AS2( movzx eax, BYTE PTR [ebp + ecx] ) + + // xOr w/ inByte + AS2( xor bl, BYTE PTR [esi] ) + AS1( inc esi ) + + // write to outByte + AS2( mov [edi], bl ) + AS1( inc edi ) + + AS1( dec DWORD PTR [esp] ) + AS1( jnz begin ) + + + // write back to x_ and y_ + AS2( mov [ebp - 2], cl ) + AS2( mov [ebp - 1], dl ) + + +AS1( nothing: ) + + + EPILOG() +} + +#endif // DO_ARC4_ASM + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/asn.cpp b/externals/mysql/extlib/yassl/taocrypt/src/asn.cpp new file mode 100644 index 0000000..a06ab65 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/asn.cpp @@ -0,0 +1,1185 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* asn.cpp implements ASN1 BER, PublicKey, and x509v3 decoding +*/ + +#include "runtime.hpp" +#include "asn.hpp" +#include "file.hpp" +#include "integer.hpp" +#include "rsa.hpp" +#include "dsa.hpp" +#include "dh.hpp" +#include "md5.hpp" +#include "md2.hpp" +#include "sha.hpp" +#include "coding.hpp" +#include // gmtime(); +#include "memory.hpp" // some auto_ptr don't have reset, also need auto_array + + +namespace TaoCrypt { + +namespace { // locals + + +// to the minute +bool operator>(tm& a, tm& b) +{ + if (a.tm_year > b.tm_year) + return true; + + if (a.tm_year == b.tm_year && a.tm_mon > b.tm_mon) + return true; + + if (a.tm_year == b.tm_year && a.tm_mon == b.tm_mon && a.tm_mday >b.tm_mday) + return true; + + if (a.tm_year == b.tm_year && a.tm_mon == b.tm_mon && + a.tm_mday == b.tm_mday && a.tm_hour > b.tm_hour) + return true; + + if (a.tm_year == b.tm_year && a.tm_mon == b.tm_mon && + a.tm_mday == b.tm_mday && a.tm_hour == b.tm_hour && + a.tm_min > b.tm_min) + return true; + + return false; +} + + +bool operator<(tm& a, tm&b) +{ + return !(a>b); +} + + +// like atoi but only use first byte +word32 btoi(byte b) +{ + return b - 0x30; +} + + +// two byte date/time, add to value +void GetTime(int& value, const byte* date, int& i) +{ + value += btoi(date[i++]) * 10; + value += btoi(date[i++]); +} + + +// Make sure before and after dates are valid +bool ValidateDate(const byte* date, byte format, CertDecoder::DateType dt) +{ + tm certTime; + memset(&certTime, 0, sizeof(certTime)); + int i = 0; + + if (format == UTC_TIME) { + if (btoi(date[0]) >= 5) + certTime.tm_year = 1900; + else + certTime.tm_year = 2000; + } + else { // format == GENERALIZED_TIME + certTime.tm_year += btoi(date[i++]) * 1000; + certTime.tm_year += btoi(date[i++]) * 100; + } + + GetTime(certTime.tm_year, date, i); certTime.tm_year -= 1900; // adjust + GetTime(certTime.tm_mon, date, i); certTime.tm_mon -= 1; // adjust + GetTime(certTime.tm_mday, date, i); + GetTime(certTime.tm_hour, date, i); + GetTime(certTime.tm_min, date, i); + GetTime(certTime.tm_sec, date, i); + + assert(date[i] == 'Z'); // only Zulu supported for this profile + + time_t ltime = time(0); + tm* localTime = gmtime(<ime); + + if (dt == CertDecoder::BEFORE) { + if (*localTime < certTime) + return false; + } + else + if (*localTime > certTime) + return false; + + return true; +} + + +class BadCertificate {}; + +} // local namespace + + + +// used by Integer as well +word32 GetLength(Source& source) +{ + word32 length = 0; + + byte b = source.next(); + if (b >= LONG_LENGTH) { + word32 bytes = b & 0x7F; + + while (bytes--) { + b = source.next(); + length = (length << 8) | b; + } + } + else + length = b; + + return length; +} + + +word32 SetLength(word32 length, byte* output) +{ + word32 i = 0; + + if (length < LONG_LENGTH) + output[i++] = length; + else { + output[i++] = BytePrecision(length) | 0x80; + + for (int j = BytePrecision(length); j; --j) { + output[i] = length >> (j - 1) * 8; + i++; + } + } + return i; +} + + +PublicKey::PublicKey(const byte* k, word32 s) : key_(0), sz_(0) +{ + if (s) { + SetSize(s); + SetKey(k); + } +} + + +void PublicKey::SetSize(word32 s) +{ + sz_ = s; + key_ = NEW_TC byte[sz_]; +} + + +void PublicKey::SetKey(const byte* k) +{ + memcpy(key_, k, sz_); +} + + +void PublicKey::AddToEnd(const byte* data, word32 len) +{ + mySTL::auto_array tmp(NEW_TC byte[sz_ + len]); + + memcpy(tmp.get(), key_, sz_); + memcpy(tmp.get() + sz_, data, len); + + byte* del = 0; + STL::swap(del, key_); + tcArrayDelete(del); + + key_ = tmp.release(); + sz_ += len; +} + + +Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h) + : key_(k, kSz) +{ + int sz = strlen(n); + memcpy(name_, n, sz); + name_[sz] = 0; + + memcpy(hash_, h, SHA::DIGEST_SIZE); +} + +Signer::~Signer() +{ +} + + +Error BER_Decoder::GetError() +{ + return source_.GetError(); +} + + +Integer& BER_Decoder::GetInteger(Integer& integer) +{ + if (!source_.GetError().What()) + integer.Decode(source_); + return integer; +} + + +// Read a Sequence, return length +word32 BER_Decoder::GetSequence() +{ + if (source_.GetError().What()) return 0; + + byte b = source_.next(); + if (b != (SEQUENCE | CONSTRUCTED)) { + source_.SetError(SEQUENCE_E); + return 0; + } + + return GetLength(source_); +} + + +// Read a Sequence, return length +word32 BER_Decoder::GetSet() +{ + if (source_.GetError().What()) return 0; + + byte b = source_.next(); + if (b != (SET | CONSTRUCTED)) { + source_.SetError(SET_E); + return 0; + } + + return GetLength(source_); +} + + +// Read Version, return it +word32 BER_Decoder::GetVersion() +{ + if (source_.GetError().What()) return 0; + + byte b = source_.next(); + if (b != INTEGER) { + source_.SetError(INTEGER_E); + return 0; + } + + b = source_.next(); + if (b != 0x01) { + source_.SetError(VERSION_E); + return 0; + } + + return source_.next(); +} + + +// Read ExplicitVersion, return it or 0 if not there (not an error) +word32 BER_Decoder::GetExplicitVersion() +{ + if (source_.GetError().What()) return 0; + + byte b = source_.next(); + + if (b == (CONTEXT_SPECIFIC | CONSTRUCTED)) { // not an error if not here + source_.next(); + return GetVersion(); + } + else + source_.prev(); // put back + + return 0; +} + + +// Decode a BER encoded RSA Private Key +void RSA_Private_Decoder::Decode(RSA_PrivateKey& key) +{ + ReadHeader(); + if (source_.GetError().What()) return; + // public + key.SetModulus(GetInteger(Integer().Ref())); + key.SetPublicExponent(GetInteger(Integer().Ref())); + + // private + key.SetPrivateExponent(GetInteger(Integer().Ref())); + key.SetPrime1(GetInteger(Integer().Ref())); + key.SetPrime2(GetInteger(Integer().Ref())); + key.SetModPrime1PrivateExponent(GetInteger(Integer().Ref())); + key.SetModPrime2PrivateExponent(GetInteger(Integer().Ref())); + key.SetMultiplicativeInverseOfPrime2ModPrime1(GetInteger(Integer().Ref())); +} + + +void RSA_Private_Decoder::ReadHeader() +{ + GetSequence(); + GetVersion(); +} + + +// Decode a BER encoded DSA Private Key +void DSA_Private_Decoder::Decode(DSA_PrivateKey& key) +{ + ReadHeader(); + if (source_.GetError().What()) return; + // group parameters + key.SetModulus(GetInteger(Integer().Ref())); + key.SetSubGroupOrder(GetInteger(Integer().Ref())); + key.SetSubGroupGenerator(GetInteger(Integer().Ref())); + + // key + key.SetPublicPart(GetInteger(Integer().Ref())); + key.SetPrivatePart(GetInteger(Integer().Ref())); +} + + +void DSA_Private_Decoder::ReadHeader() +{ + GetSequence(); + GetVersion(); +} + + +// Decode a BER encoded RSA Public Key +void RSA_Public_Decoder::Decode(RSA_PublicKey& key) +{ + ReadHeader(); + if (source_.GetError().What()) return; + + // public key + key.SetModulus(GetInteger(Integer().Ref())); + key.SetPublicExponent(GetInteger(Integer().Ref())); +} + + +void RSA_Public_Decoder::ReadHeader() +{ + GetSequence(); +} + + +// Decode a BER encoded DSA Public Key +void DSA_Public_Decoder::Decode(DSA_PublicKey& key) +{ + ReadHeader(); + if (source_.GetError().What()) return; + + // group parameters + key.SetModulus(GetInteger(Integer().Ref())); + key.SetSubGroupOrder(GetInteger(Integer().Ref())); + key.SetSubGroupGenerator(GetInteger(Integer().Ref())); + + // key + key.SetPublicPart(GetInteger(Integer().Ref())); +} + + +void DSA_Public_Decoder::ReadHeader() +{ + GetSequence(); +} + + +void DH_Decoder::ReadHeader() +{ + GetSequence(); +} + + +// Decode a BER encoded Diffie-Hellman Key +void DH_Decoder::Decode(DH& key) +{ + ReadHeader(); + if (source_.GetError().What()) return; + + // group parms + key.SetP(GetInteger(Integer().Ref())); + key.SetG(GetInteger(Integer().Ref())); +} + + +CertDecoder::CertDecoder(Source& s, bool decode, SignerList* signers, + bool noVerify, CertType ct) + : BER_Decoder(s), certBegin_(0), sigIndex_(0), sigLength_(0), + signature_(0), verify_(!noVerify) +{ + issuer_[0] = 0; + subject_[0] = 0; + + if (decode) + Decode(signers, ct); + +} + + +CertDecoder::~CertDecoder() +{ + tcArrayDelete(signature_); +} + + +// process certificate header, set signature offset +void CertDecoder::ReadHeader() +{ + if (source_.GetError().What()) return; + + GetSequence(); // total + certBegin_ = source_.get_index(); + + sigIndex_ = GetSequence(); // this cert + sigIndex_ += source_.get_index(); + + GetExplicitVersion(); // version + GetInteger(Integer().Ref()); // serial number +} + + +// Decode a x509v3 Certificate +void CertDecoder::Decode(SignerList* signers, CertType ct) +{ + if (source_.GetError().What()) return; + DecodeToKey(); + if (source_.GetError().What()) return; + + if (source_.get_index() != sigIndex_) + source_.set_index(sigIndex_); + + word32 confirmOID = GetAlgoId(); + GetSignature(); + if (source_.GetError().What()) return; + + if ( confirmOID != signatureOID_ ) { + source_.SetError(SIG_OID_E); + return; + } + + if (ct != CA && verify_ && !ValidateSignature(signers)) + source_.SetError(SIG_OTHER_E); +} + + +void CertDecoder::DecodeToKey() +{ + ReadHeader(); + signatureOID_ = GetAlgoId(); + GetName(ISSUER); + GetValidity(); + GetName(SUBJECT); + GetKey(); +} + + +// Read public key +void CertDecoder::GetKey() +{ + if (source_.GetError().What()) return; + + GetSequence(); + keyOID_ = GetAlgoId(); + + if (keyOID_ == RSAk) { + byte b = source_.next(); + if (b != BIT_STRING) { + source_.SetError(BIT_STR_E); + return; + } + b = source_.next(); // length, future + b = source_.next(); + while(b != 0) + b = source_.next(); + } + else if (keyOID_ == DSAk) + ; // do nothing + else { + source_.SetError(UNKNOWN_OID_E); + return; + } + + StoreKey(); + if (keyOID_ == DSAk) + AddDSA(); +} + + +// Save public key +void CertDecoder::StoreKey() +{ + if (source_.GetError().What()) return; + + word32 read = source_.get_index(); + word32 length = GetSequence(); + + read = source_.get_index() - read; + length += read; + + while (read--) source_.prev(); + + key_.SetSize(length); + key_.SetKey(source_.get_current()); + source_.advance(length); +} + + +// DSA has public key after group +void CertDecoder::AddDSA() +{ + if (source_.GetError().What()) return; + + byte b = source_.next(); + if (b != BIT_STRING) { + source_.SetError(BIT_STR_E); + return; + } + b = source_.next(); // length, future + b = source_.next(); + while(b != 0) + b = source_.next(); + + word32 idx = source_.get_index(); + b = source_.next(); + if (b != INTEGER) { + source_.SetError(INTEGER_E); + return; + } + + word32 length = GetLength(source_); + length += source_.get_index() - idx; + + key_.AddToEnd(source_.get_buffer() + idx, length); +} + + +// process algo OID by summing, return it +word32 CertDecoder::GetAlgoId() +{ + if (source_.GetError().What()) return 0; + word32 length = GetSequence(); + + byte b = source_.next(); + if (b != OBJECT_IDENTIFIER) { + source_.SetError(OBJECT_ID_E); + return 0; + } + + length = GetLength(source_); + word32 oid = 0; + + while(length--) + oid += source_.next(); // just sum it up for now + + if (oid != SHAwDSA && oid != DSAk) { + b = source_.next(); // should have NULL tag and 0 + + if (b != TAG_NULL) { + source_.SetError(TAG_NULL_E); + return 0; + } + + b = source_.next(); + if (b != 0) { + source_.SetError(EXPECT_0_E); + return 0; + } + } + + return oid; +} + + +// read cert signature, store in signature_ +word32 CertDecoder::GetSignature() +{ + if (source_.GetError().What()) return 0; + byte b = source_.next(); + + if (b != BIT_STRING) { + source_.SetError(BIT_STR_E); + return 0; + } + + sigLength_ = GetLength(source_); + + b = source_.next(); + if (b != 0) { + source_.SetError(EXPECT_0_E); + return 0; + } + sigLength_--; + + signature_ = NEW_TC byte[sigLength_]; + memcpy(signature_, source_.get_current(), sigLength_); + source_.advance(sigLength_); + + return sigLength_; +} + + +// read cert digest, store in signature_ +word32 CertDecoder::GetDigest() +{ + if (source_.GetError().What()) return 0; + byte b = source_.next(); + + if (b != OCTET_STRING) { + source_.SetError(OCTET_STR_E); + return 0; + } + + sigLength_ = GetLength(source_); + + signature_ = NEW_TC byte[sigLength_]; + memcpy(signature_, source_.get_current(), sigLength_); + source_.advance(sigLength_); + + return sigLength_; +} + + +// process NAME, either issuer or subject +void CertDecoder::GetName(NameType nt) +{ + if (source_.GetError().What()) return; + + SHA sha; + word32 length = GetSequence(); // length of all distinguished names + assert (length < ASN_NAME_MAX); + length += source_.get_index(); + + char* ptr = (nt == ISSUER) ? issuer_ : subject_; + word32 idx = 0; + + while (source_.get_index() < length) { + GetSet(); + GetSequence(); + + byte b = source_.next(); + if (b != OBJECT_IDENTIFIER) { + source_.SetError(OBJECT_ID_E); + return; + } + + word32 oidSz = GetLength(source_); + byte joint[2]; + memcpy(joint, source_.get_current(), sizeof(joint)); + + // v1 name types + if (joint[0] == 0x55 && joint[1] == 0x04) { + source_.advance(2); + byte id = source_.next(); + b = source_.next(); // strType + word32 strLen = GetLength(source_); + bool copy = false; + + if (id == COMMON_NAME) { + memcpy(&ptr[idx], "/CN=", 4); + idx += 4; + copy = true; + } + else if (id == SUR_NAME) { + memcpy(&ptr[idx], "/SN=", 4); + idx += 4; + copy = true; + } + else if (id == COUNTRY_NAME) { + memcpy(&ptr[idx], "/C=", 3); + idx += 3; + copy = true; + } + else if (id == LOCALITY_NAME) { + memcpy(&ptr[idx], "/L=", 3); + idx += 3; + copy = true; + } + else if (id == STATE_NAME) { + memcpy(&ptr[idx], "/ST=", 4); + idx += 4; + copy = true; + } + else if (id == ORG_NAME) { + memcpy(&ptr[idx], "/O=", 3); + idx += 3; + copy = true; + } + else if (id == ORGUNIT_NAME) { + memcpy(&ptr[idx], "/OU=", 4); + idx += 4; + copy = true; + } + + if (copy) { + memcpy(&ptr[idx], source_.get_current(), strLen); + idx += strLen; + } + + sha.Update(source_.get_current(), strLen); + source_.advance(strLen); + } + else { + bool email = false; + if (joint[0] == 0x2a && joint[1] == 0x86) // email id hdr + email = true; + + source_.advance(oidSz + 1); + word32 length = GetLength(source_); + + if (email) { + memcpy(&ptr[idx], "/emailAddress=", 14); + idx += 14; + + memcpy(&ptr[idx], source_.get_current(), length); + idx += length; + } + + source_.advance(length); + } + } + ptr[idx++] = 0; + + if (nt == ISSUER) + sha.Final(issuerHash_); + else + sha.Final(subjectHash_); +} + + +// process a Date, either BEFORE or AFTER +void CertDecoder::GetDate(DateType dt) +{ + if (source_.GetError().What()) return; + + byte b = source_.next(); + if (b != UTC_TIME && b != GENERALIZED_TIME) { + source_.SetError(TIME_E); + return; + } + + word32 length = GetLength(source_); + byte date[MAX_DATE_SZ]; + if (length > MAX_DATE_SZ || length < MIN_DATE_SZ) { + source_.SetError(DATE_SZ_E); + return; + } + + memcpy(date, source_.get_current(), length); + source_.advance(length); + + if (!ValidateDate(date, b, dt) && verify_) + if (dt == BEFORE) + source_.SetError(BEFORE_DATE_E); + else + source_.SetError(AFTER_DATE_E); + + // save for later use + if (dt == BEFORE) { + memcpy(beforeDate_, date, length); + beforeDate_[length] = 0; + } + else { // after + memcpy(afterDate_, date, length); + afterDate_[length] = 0; + } +} + + +void CertDecoder::GetValidity() +{ + if (source_.GetError().What()) return; + + GetSequence(); + GetDate(BEFORE); + GetDate(AFTER); +} + + +bool CertDecoder::ValidateSelfSignature() +{ + Source pub(key_.GetKey(), key_.size()); + return ConfirmSignature(pub); +} + + +// extract compare signature hash from plain and place into digest +void CertDecoder::GetCompareHash(const byte* plain, word32 sz, byte* digest, + word32 digSz) +{ + if (source_.GetError().What()) return; + + Source s(plain, sz); + CertDecoder dec(s, false); + + dec.GetSequence(); + dec.GetAlgoId(); + dec.GetDigest(); + + if (dec.sigLength_ > digSz) { + source_.SetError(SIG_LEN_E); + return; + } + + memcpy(digest, dec.signature_, dec.sigLength_); +} + + +// validate signature signed by someone else +bool CertDecoder::ValidateSignature(SignerList* signers) +{ + assert(signers); + + SignerList::iterator first = signers->begin(); + SignerList::iterator last = signers->end(); + + while (first != last) { + if ( memcmp(issuerHash_, (*first)->GetHash(), SHA::DIGEST_SIZE) == 0) { + + const PublicKey& iKey = (*first)->GetPublicKey(); + Source pub(iKey.GetKey(), iKey.size()); + return ConfirmSignature(pub); + } + ++first; + } + return false; +} + + +// confirm certificate signature +bool CertDecoder::ConfirmSignature(Source& pub) +{ + HashType ht; + mySTL::auto_ptr hasher; + + if (signatureOID_ == MD5wRSA) { + hasher.reset(NEW_TC MD5); + ht = MD5h; + } + else if (signatureOID_ == MD2wRSA) { + hasher.reset(NEW_TC MD2); + ht = MD2h; + } + else if (signatureOID_ == SHAwRSA || signatureOID_ == SHAwDSA) { + hasher.reset(NEW_TC SHA); + ht = SHAh; + } + else { + source_.SetError(UNKOWN_SIG_E); + return false; + } + + byte digest[SHA::DIGEST_SIZE]; // largest size + + hasher->Update(source_.get_buffer() + certBegin_, sigIndex_ - certBegin_); + hasher->Final(digest); + + if (keyOID_ == RSAk) { + // put in ASN.1 signature format + Source build; + Signature_Encoder(digest, hasher->getDigestSize(), ht, build); + + RSA_PublicKey pubKey(pub); + RSAES_Encryptor enc(pubKey); + + return enc.SSL_Verify(build.get_buffer(), build.size(), signature_); + } + else { // DSA + // extract r and s from sequence + byte seqDecoded[DSA_SIG_SZ]; + DecodeDSA_Signature(seqDecoded, signature_, sigLength_); + + DSA_PublicKey pubKey(pub); + DSA_Verifier ver(pubKey); + + return ver.Verify(digest, seqDecoded); + } +} + + +Signature_Encoder::Signature_Encoder(const byte* dig, word32 digSz, + HashType digOID, Source& source) +{ + // build bottom up + + // Digest + byte digArray[MAX_DIGEST_SZ]; + word32 digestSz = SetDigest(dig, digSz, digArray); + + // AlgoID + byte algoArray[MAX_ALGO_SZ]; + word32 algoSz = SetAlgoID(digOID, algoArray); + + // Sequence + byte seqArray[MAX_SEQ_SZ]; + word32 seqSz = SetSequence(digestSz + algoSz, seqArray); + + source.grow(seqSz + algoSz + digestSz); // make sure enough room + source.add(seqArray, seqSz); + source.add(algoArray, algoSz); + source.add(digArray, digestSz); +} + + + +word32 Signature_Encoder::SetDigest(const byte* d, word32 dSz, byte* output) +{ + output[0] = OCTET_STRING; + output[1] = dSz; + memcpy(&output[2], d, dSz); + + return dSz + 2; +} + + + +word32 DER_Encoder::SetAlgoID(HashType aOID, byte* output) +{ + // adding TAG_NULL and 0 to end + static const byte shaAlgoID[] = { 0x2b, 0x0e, 0x03, 0x02, 0x1a, + 0x05, 0x00 }; + static const byte md5AlgoID[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, + 0x02, 0x05, 0x05, 0x00 }; + static const byte md2AlgoID[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, + 0x02, 0x02, 0x05, 0x00}; + + int algoSz = 0; + const byte* algoName = 0; + + switch (aOID) { + case SHAh: + algoSz = sizeof(shaAlgoID); + algoName = shaAlgoID; + break; + + case MD2h: + algoSz = sizeof(md2AlgoID); + algoName = md2AlgoID; + break; + + case MD5h: + algoSz = sizeof(md5AlgoID); + algoName = md5AlgoID; + break; + + default: + error_.SetError(UNKOWN_HASH_E); + return 0; + } + + + byte ID_Length[MAX_LENGTH_SZ]; + word32 idSz = SetLength(algoSz - 2, ID_Length); // don't include TAG_NULL/0 + + byte seqArray[MAX_SEQ_SZ + 1]; // add object_id to end + word32 seqSz = SetSequence(idSz + algoSz + 1, seqArray); + seqArray[seqSz++] = OBJECT_IDENTIFIER; + + memcpy(output, seqArray, seqSz); + memcpy(output + seqSz, ID_Length, idSz); + memcpy(output + seqSz + idSz, algoName, algoSz); + + return seqSz + idSz + algoSz; +} + + +word32 SetSequence(word32 len, byte* output) +{ + + output[0] = SEQUENCE | CONSTRUCTED; + return SetLength(len, output + 1) + 1; +} + + +word32 EncodeDSA_Signature(const byte* signature, byte* output) +{ + Integer r(signature, 20); + Integer s(signature + 20, 20); + + return EncodeDSA_Signature(r, s, output); +} + + +word32 EncodeDSA_Signature(const Integer& r, const Integer& s, byte* output) +{ + word32 rSz = r.ByteCount(); + word32 sSz = s.ByteCount(); + + byte rLen[MAX_LENGTH_SZ + 1]; + byte sLen[MAX_LENGTH_SZ + 1]; + + rLen[0] = INTEGER; + sLen[0] = INTEGER; + + word32 rLenSz = SetLength(rSz, &rLen[1]) + 1; + word32 sLenSz = SetLength(sSz, &sLen[1]) + 1; + + byte seqArray[MAX_SEQ_SZ]; + + word32 seqSz = SetSequence(rLenSz + rSz + sLenSz + sSz, seqArray); + + // seq + memcpy(output, seqArray, seqSz); + // r + memcpy(output + seqSz, rLen, rLenSz); + r.Encode(output + seqSz + rLenSz, rSz); + // s + memcpy(output + seqSz + rLenSz + rSz, sLen, sLenSz); + s.Encode(output + seqSz + rLenSz + rSz + sLenSz, sSz); + + return seqSz + rLenSz + rSz + sLenSz + sSz; +} + + +// put sequence encoded dsa signature into decoded in 2 20 byte integers +word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) +{ + Source source(encoded, sz); + + if (source.next() != (SEQUENCE | CONSTRUCTED)) { + source.SetError(SEQUENCE_E); + return 0; + } + + GetLength(source); // total + + // r + if (source.next() != INTEGER) { + source.SetError(INTEGER_E); + return 0; + } + word32 rLen = GetLength(source); + if (rLen != 20) + if (rLen == 21) { // zero at front, eat + source.next(); + --rLen; + } + else if (rLen == 19) { // add zero to front so 20 bytes + decoded[0] = 0; + decoded++; + } + else { + source.SetError(DSA_SZ_E); + return 0; + } + memcpy(decoded, source.get_buffer() + source.get_index(), rLen); + source.advance(rLen); + + // s + if (source.next() != INTEGER) { + source.SetError(INTEGER_E); + return 0; + } + word32 sLen = GetLength(source); + if (sLen != 20) + if (sLen == 21) { + source.next(); // zero at front, eat + --sLen; + } + else if (sLen == 19) { + decoded[rLen] = 0; // add zero to front so 20 bytes + decoded++; + } + else { + source.SetError(DSA_SZ_E); + return 0; + } + memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen); + source.advance(sLen); + + return 40; +} + + +// Get Cert in PEM format from BEGIN to END +int GetCert(Source& source) +{ + char header[] = "-----BEGIN CERTIFICATE-----"; + char footer[] = "-----END CERTIFICATE-----"; + + char* begin = strstr((char*)source.get_buffer(), header); + char* end = strstr((char*)source.get_buffer(), footer); + + if (!begin || !end || begin >= end) return -1; + + end += strlen(footer); + if (*end == '\r') end++; + + Source tmp((byte*)begin, end - begin + 1); + source.Swap(tmp); + + return 0; +} + + + +// Decode a BER encoded PKCS12 structure +void PKCS12_Decoder::Decode() +{ + ReadHeader(); + if (source_.GetError().What()) return; + + // Get AuthSafe + + GetSequence(); + + // get object id + byte obj_id = source_.next(); + if (obj_id != OBJECT_IDENTIFIER) { + source_.SetError(OBJECT_ID_E); + return; + } + + word32 length = GetLength(source_); + + word32 algo_sum = 0; + while (length--) + algo_sum += source_.next(); + + + + + + + // Get MacData optional + /* + mac digestInfo like certdecoder::getdigest? + macsalt octet string + iter integer + + */ +} + + +void PKCS12_Decoder::ReadHeader() +{ + // Gets Version + GetSequence(); + GetVersion(); +} + + +// Get Cert in PEM format from pkcs12 file +int GetPKCS_Cert(const char* password, Source& source) +{ + PKCS12_Decoder pkcs12(source); + pkcs12.Decode(); + + return 0; +} + + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/bftables.cpp b/externals/mysql/extlib/yassl/taocrypt/src/bftables.cpp new file mode 100644 index 0000000..4646947 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/bftables.cpp @@ -0,0 +1,303 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's bfinit.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "blowfish.hpp" + + +namespace TaoCrypt { + +const word32 Blowfish::p_init_[Blowfish::ROUNDS+2] = +{ + 608135816U, 2242054355U, 320440878U, 57701188U, + 2752067618U, 698298832U, 137296536U, 3964562569U, + 1160258022U, 953160567U, 3193202383U, 887688300U, + 3232508343U, 3380367581U, 1065670069U, 3041331479U, + 2450970073U, 2306472731U +} ; + + +const word32 Blowfish::s_init_[4*256] = { + 3509652390U, 2564797868U, 805139163U, 3491422135U, + 3101798381U, 1780907670U, 3128725573U, 4046225305U, + 614570311U, 3012652279U, 134345442U, 2240740374U, + 1667834072U, 1901547113U, 2757295779U, 4103290238U, + 227898511U, 1921955416U, 1904987480U, 2182433518U, + 2069144605U, 3260701109U, 2620446009U, 720527379U, + 3318853667U, 677414384U, 3393288472U, 3101374703U, + 2390351024U, 1614419982U, 1822297739U, 2954791486U, + 3608508353U, 3174124327U, 2024746970U, 1432378464U, + 3864339955U, 2857741204U, 1464375394U, 1676153920U, + 1439316330U, 715854006U, 3033291828U, 289532110U, + 2706671279U, 2087905683U, 3018724369U, 1668267050U, + 732546397U, 1947742710U, 3462151702U, 2609353502U, + 2950085171U, 1814351708U, 2050118529U, 680887927U, + 999245976U, 1800124847U, 3300911131U, 1713906067U, + 1641548236U, 4213287313U, 1216130144U, 1575780402U, + 4018429277U, 3917837745U, 3693486850U, 3949271944U, + 596196993U, 3549867205U, 258830323U, 2213823033U, + 772490370U, 2760122372U, 1774776394U, 2652871518U, + 566650946U, 4142492826U, 1728879713U, 2882767088U, + 1783734482U, 3629395816U, 2517608232U, 2874225571U, + 1861159788U, 326777828U, 3124490320U, 2130389656U, + 2716951837U, 967770486U, 1724537150U, 2185432712U, + 2364442137U, 1164943284U, 2105845187U, 998989502U, + 3765401048U, 2244026483U, 1075463327U, 1455516326U, + 1322494562U, 910128902U, 469688178U, 1117454909U, + 936433444U, 3490320968U, 3675253459U, 1240580251U, + 122909385U, 2157517691U, 634681816U, 4142456567U, + 3825094682U, 3061402683U, 2540495037U, 79693498U, + 3249098678U, 1084186820U, 1583128258U, 426386531U, + 1761308591U, 1047286709U, 322548459U, 995290223U, + 1845252383U, 2603652396U, 3431023940U, 2942221577U, + 3202600964U, 3727903485U, 1712269319U, 422464435U, + 3234572375U, 1170764815U, 3523960633U, 3117677531U, + 1434042557U, 442511882U, 3600875718U, 1076654713U, + 1738483198U, 4213154764U, 2393238008U, 3677496056U, + 1014306527U, 4251020053U, 793779912U, 2902807211U, + 842905082U, 4246964064U, 1395751752U, 1040244610U, + 2656851899U, 3396308128U, 445077038U, 3742853595U, + 3577915638U, 679411651U, 2892444358U, 2354009459U, + 1767581616U, 3150600392U, 3791627101U, 3102740896U, + 284835224U, 4246832056U, 1258075500U, 768725851U, + 2589189241U, 3069724005U, 3532540348U, 1274779536U, + 3789419226U, 2764799539U, 1660621633U, 3471099624U, + 4011903706U, 913787905U, 3497959166U, 737222580U, + 2514213453U, 2928710040U, 3937242737U, 1804850592U, + 3499020752U, 2949064160U, 2386320175U, 2390070455U, + 2415321851U, 4061277028U, 2290661394U, 2416832540U, + 1336762016U, 1754252060U, 3520065937U, 3014181293U, + 791618072U, 3188594551U, 3933548030U, 2332172193U, + 3852520463U, 3043980520U, 413987798U, 3465142937U, + 3030929376U, 4245938359U, 2093235073U, 3534596313U, + 375366246U, 2157278981U, 2479649556U, 555357303U, + 3870105701U, 2008414854U, 3344188149U, 4221384143U, + 3956125452U, 2067696032U, 3594591187U, 2921233993U, + 2428461U, 544322398U, 577241275U, 1471733935U, + 610547355U, 4027169054U, 1432588573U, 1507829418U, + 2025931657U, 3646575487U, 545086370U, 48609733U, + 2200306550U, 1653985193U, 298326376U, 1316178497U, + 3007786442U, 2064951626U, 458293330U, 2589141269U, + 3591329599U, 3164325604U, 727753846U, 2179363840U, + 146436021U, 1461446943U, 4069977195U, 705550613U, + 3059967265U, 3887724982U, 4281599278U, 3313849956U, + 1404054877U, 2845806497U, 146425753U, 1854211946U, + + 1266315497U, 3048417604U, 3681880366U, 3289982499U, + 2909710000U, 1235738493U, 2632868024U, 2414719590U, + 3970600049U, 1771706367U, 1449415276U, 3266420449U, + 422970021U, 1963543593U, 2690192192U, 3826793022U, + 1062508698U, 1531092325U, 1804592342U, 2583117782U, + 2714934279U, 4024971509U, 1294809318U, 4028980673U, + 1289560198U, 2221992742U, 1669523910U, 35572830U, + 157838143U, 1052438473U, 1016535060U, 1802137761U, + 1753167236U, 1386275462U, 3080475397U, 2857371447U, + 1040679964U, 2145300060U, 2390574316U, 1461121720U, + 2956646967U, 4031777805U, 4028374788U, 33600511U, + 2920084762U, 1018524850U, 629373528U, 3691585981U, + 3515945977U, 2091462646U, 2486323059U, 586499841U, + 988145025U, 935516892U, 3367335476U, 2599673255U, + 2839830854U, 265290510U, 3972581182U, 2759138881U, + 3795373465U, 1005194799U, 847297441U, 406762289U, + 1314163512U, 1332590856U, 1866599683U, 4127851711U, + 750260880U, 613907577U, 1450815602U, 3165620655U, + 3734664991U, 3650291728U, 3012275730U, 3704569646U, + 1427272223U, 778793252U, 1343938022U, 2676280711U, + 2052605720U, 1946737175U, 3164576444U, 3914038668U, + 3967478842U, 3682934266U, 1661551462U, 3294938066U, + 4011595847U, 840292616U, 3712170807U, 616741398U, + 312560963U, 711312465U, 1351876610U, 322626781U, + 1910503582U, 271666773U, 2175563734U, 1594956187U, + 70604529U, 3617834859U, 1007753275U, 1495573769U, + 4069517037U, 2549218298U, 2663038764U, 504708206U, + 2263041392U, 3941167025U, 2249088522U, 1514023603U, + 1998579484U, 1312622330U, 694541497U, 2582060303U, + 2151582166U, 1382467621U, 776784248U, 2618340202U, + 3323268794U, 2497899128U, 2784771155U, 503983604U, + 4076293799U, 907881277U, 423175695U, 432175456U, + 1378068232U, 4145222326U, 3954048622U, 3938656102U, + 3820766613U, 2793130115U, 2977904593U, 26017576U, + 3274890735U, 3194772133U, 1700274565U, 1756076034U, + 4006520079U, 3677328699U, 720338349U, 1533947780U, + 354530856U, 688349552U, 3973924725U, 1637815568U, + 332179504U, 3949051286U, 53804574U, 2852348879U, + 3044236432U, 1282449977U, 3583942155U, 3416972820U, + 4006381244U, 1617046695U, 2628476075U, 3002303598U, + 1686838959U, 431878346U, 2686675385U, 1700445008U, + 1080580658U, 1009431731U, 832498133U, 3223435511U, + 2605976345U, 2271191193U, 2516031870U, 1648197032U, + 4164389018U, 2548247927U, 300782431U, 375919233U, + 238389289U, 3353747414U, 2531188641U, 2019080857U, + 1475708069U, 455242339U, 2609103871U, 448939670U, + 3451063019U, 1395535956U, 2413381860U, 1841049896U, + 1491858159U, 885456874U, 4264095073U, 4001119347U, + 1565136089U, 3898914787U, 1108368660U, 540939232U, + 1173283510U, 2745871338U, 3681308437U, 4207628240U, + 3343053890U, 4016749493U, 1699691293U, 1103962373U, + 3625875870U, 2256883143U, 3830138730U, 1031889488U, + 3479347698U, 1535977030U, 4236805024U, 3251091107U, + 2132092099U, 1774941330U, 1199868427U, 1452454533U, + 157007616U, 2904115357U, 342012276U, 595725824U, + 1480756522U, 206960106U, 497939518U, 591360097U, + 863170706U, 2375253569U, 3596610801U, 1814182875U, + 2094937945U, 3421402208U, 1082520231U, 3463918190U, + 2785509508U, 435703966U, 3908032597U, 1641649973U, + 2842273706U, 3305899714U, 1510255612U, 2148256476U, + 2655287854U, 3276092548U, 4258621189U, 236887753U, + 3681803219U, 274041037U, 1734335097U, 3815195456U, + 3317970021U, 1899903192U, 1026095262U, 4050517792U, + 356393447U, 2410691914U, 3873677099U, 3682840055U, + + 3913112168U, 2491498743U, 4132185628U, 2489919796U, + 1091903735U, 1979897079U, 3170134830U, 3567386728U, + 3557303409U, 857797738U, 1136121015U, 1342202287U, + 507115054U, 2535736646U, 337727348U, 3213592640U, + 1301675037U, 2528481711U, 1895095763U, 1721773893U, + 3216771564U, 62756741U, 2142006736U, 835421444U, + 2531993523U, 1442658625U, 3659876326U, 2882144922U, + 676362277U, 1392781812U, 170690266U, 3921047035U, + 1759253602U, 3611846912U, 1745797284U, 664899054U, + 1329594018U, 3901205900U, 3045908486U, 2062866102U, + 2865634940U, 3543621612U, 3464012697U, 1080764994U, + 553557557U, 3656615353U, 3996768171U, 991055499U, + 499776247U, 1265440854U, 648242737U, 3940784050U, + 980351604U, 3713745714U, 1749149687U, 3396870395U, + 4211799374U, 3640570775U, 1161844396U, 3125318951U, + 1431517754U, 545492359U, 4268468663U, 3499529547U, + 1437099964U, 2702547544U, 3433638243U, 2581715763U, + 2787789398U, 1060185593U, 1593081372U, 2418618748U, + 4260947970U, 69676912U, 2159744348U, 86519011U, + 2512459080U, 3838209314U, 1220612927U, 3339683548U, + 133810670U, 1090789135U, 1078426020U, 1569222167U, + 845107691U, 3583754449U, 4072456591U, 1091646820U, + 628848692U, 1613405280U, 3757631651U, 526609435U, + 236106946U, 48312990U, 2942717905U, 3402727701U, + 1797494240U, 859738849U, 992217954U, 4005476642U, + 2243076622U, 3870952857U, 3732016268U, 765654824U, + 3490871365U, 2511836413U, 1685915746U, 3888969200U, + 1414112111U, 2273134842U, 3281911079U, 4080962846U, + 172450625U, 2569994100U, 980381355U, 4109958455U, + 2819808352U, 2716589560U, 2568741196U, 3681446669U, + 3329971472U, 1835478071U, 660984891U, 3704678404U, + 4045999559U, 3422617507U, 3040415634U, 1762651403U, + 1719377915U, 3470491036U, 2693910283U, 3642056355U, + 3138596744U, 1364962596U, 2073328063U, 1983633131U, + 926494387U, 3423689081U, 2150032023U, 4096667949U, + 1749200295U, 3328846651U, 309677260U, 2016342300U, + 1779581495U, 3079819751U, 111262694U, 1274766160U, + 443224088U, 298511866U, 1025883608U, 3806446537U, + 1145181785U, 168956806U, 3641502830U, 3584813610U, + 1689216846U, 3666258015U, 3200248200U, 1692713982U, + 2646376535U, 4042768518U, 1618508792U, 1610833997U, + 3523052358U, 4130873264U, 2001055236U, 3610705100U, + 2202168115U, 4028541809U, 2961195399U, 1006657119U, + 2006996926U, 3186142756U, 1430667929U, 3210227297U, + 1314452623U, 4074634658U, 4101304120U, 2273951170U, + 1399257539U, 3367210612U, 3027628629U, 1190975929U, + 2062231137U, 2333990788U, 2221543033U, 2438960610U, + 1181637006U, 548689776U, 2362791313U, 3372408396U, + 3104550113U, 3145860560U, 296247880U, 1970579870U, + 3078560182U, 3769228297U, 1714227617U, 3291629107U, + 3898220290U, 166772364U, 1251581989U, 493813264U, + 448347421U, 195405023U, 2709975567U, 677966185U, + 3703036547U, 1463355134U, 2715995803U, 1338867538U, + 1343315457U, 2802222074U, 2684532164U, 233230375U, + 2599980071U, 2000651841U, 3277868038U, 1638401717U, + 4028070440U, 3237316320U, 6314154U, 819756386U, + 300326615U, 590932579U, 1405279636U, 3267499572U, + 3150704214U, 2428286686U, 3959192993U, 3461946742U, + 1862657033U, 1266418056U, 963775037U, 2089974820U, + 2263052895U, 1917689273U, 448879540U, 3550394620U, + 3981727096U, 150775221U, 3627908307U, 1303187396U, + 508620638U, 2975983352U, 2726630617U, 1817252668U, + 1876281319U, 1457606340U, 908771278U, 3720792119U, + 3617206836U, 2455994898U, 1729034894U, 1080033504U, + + 976866871U, 3556439503U, 2881648439U, 1522871579U, + 1555064734U, 1336096578U, 3548522304U, 2579274686U, + 3574697629U, 3205460757U, 3593280638U, 3338716283U, + 3079412587U, 564236357U, 2993598910U, 1781952180U, + 1464380207U, 3163844217U, 3332601554U, 1699332808U, + 1393555694U, 1183702653U, 3581086237U, 1288719814U, + 691649499U, 2847557200U, 2895455976U, 3193889540U, + 2717570544U, 1781354906U, 1676643554U, 2592534050U, + 3230253752U, 1126444790U, 2770207658U, 2633158820U, + 2210423226U, 2615765581U, 2414155088U, 3127139286U, + 673620729U, 2805611233U, 1269405062U, 4015350505U, + 3341807571U, 4149409754U, 1057255273U, 2012875353U, + 2162469141U, 2276492801U, 2601117357U, 993977747U, + 3918593370U, 2654263191U, 753973209U, 36408145U, + 2530585658U, 25011837U, 3520020182U, 2088578344U, + 530523599U, 2918365339U, 1524020338U, 1518925132U, + 3760827505U, 3759777254U, 1202760957U, 3985898139U, + 3906192525U, 674977740U, 4174734889U, 2031300136U, + 2019492241U, 3983892565U, 4153806404U, 3822280332U, + 352677332U, 2297720250U, 60907813U, 90501309U, + 3286998549U, 1016092578U, 2535922412U, 2839152426U, + 457141659U, 509813237U, 4120667899U, 652014361U, + 1966332200U, 2975202805U, 55981186U, 2327461051U, + 676427537U, 3255491064U, 2882294119U, 3433927263U, + 1307055953U, 942726286U, 933058658U, 2468411793U, + 3933900994U, 4215176142U, 1361170020U, 2001714738U, + 2830558078U, 3274259782U, 1222529897U, 1679025792U, + 2729314320U, 3714953764U, 1770335741U, 151462246U, + 3013232138U, 1682292957U, 1483529935U, 471910574U, + 1539241949U, 458788160U, 3436315007U, 1807016891U, + 3718408830U, 978976581U, 1043663428U, 3165965781U, + 1927990952U, 4200891579U, 2372276910U, 3208408903U, + 3533431907U, 1412390302U, 2931980059U, 4132332400U, + 1947078029U, 3881505623U, 4168226417U, 2941484381U, + 1077988104U, 1320477388U, 886195818U, 18198404U, + 3786409000U, 2509781533U, 112762804U, 3463356488U, + 1866414978U, 891333506U, 18488651U, 661792760U, + 1628790961U, 3885187036U, 3141171499U, 876946877U, + 2693282273U, 1372485963U, 791857591U, 2686433993U, + 3759982718U, 3167212022U, 3472953795U, 2716379847U, + 445679433U, 3561995674U, 3504004811U, 3574258232U, + 54117162U, 3331405415U, 2381918588U, 3769707343U, + 4154350007U, 1140177722U, 4074052095U, 668550556U, + 3214352940U, 367459370U, 261225585U, 2610173221U, + 4209349473U, 3468074219U, 3265815641U, 314222801U, + 3066103646U, 3808782860U, 282218597U, 3406013506U, + 3773591054U, 379116347U, 1285071038U, 846784868U, + 2669647154U, 3771962079U, 3550491691U, 2305946142U, + 453669953U, 1268987020U, 3317592352U, 3279303384U, + 3744833421U, 2610507566U, 3859509063U, 266596637U, + 3847019092U, 517658769U, 3462560207U, 3443424879U, + 370717030U, 4247526661U, 2224018117U, 4143653529U, + 4112773975U, 2788324899U, 2477274417U, 1456262402U, + 2901442914U, 1517677493U, 1846949527U, 2295493580U, + 3734397586U, 2176403920U, 1280348187U, 1908823572U, + 3871786941U, 846861322U, 1172426758U, 3287448474U, + 3383383037U, 1655181056U, 3139813346U, 901632758U, + 1897031941U, 2986607138U, 3066810236U, 3447102507U, + 1393639104U, 373351379U, 950779232U, 625454576U, + 3124240540U, 4148612726U, 2007998917U, 544563296U, + 2244738638U, 2330496472U, 2058025392U, 1291430526U, + 424198748U, 50039436U, 29584100U, 3605783033U, + 2429876329U, 2791104160U, 1057563949U, 3255363231U, + 3075367218U, 3463963227U, 1469046755U, 985887462U +}; + + + + +} // namespace + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/blowfish.cpp b/externals/mysql/extlib/yassl/taocrypt/src/blowfish.cpp new file mode 100644 index 0000000..66ff4d8 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/blowfish.cpp @@ -0,0 +1,342 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* C++ code based on Wei Dai's blowfish.cpp from CryptoPP */ +/* x86 asm is original */ + + +#if defined(TAOCRYPT_KERNEL_MODE) + #define DO_TAOCRYPT_KERNEL_MODE +#endif // only some modules now support this + + +#include "runtime.hpp" +#include "blowfish.hpp" + + + + + +namespace TaoCrypt { + + +#if defined(DO_BLOWFISH_ASM) + +// ia32 optimized version +void Blowfish::Process(byte* out, const byte* in, word32 sz) +{ + if (!isMMX) { + Mode_BASE::Process(out, in, sz); + return; + } + + word32 blocks = sz / BLOCK_SIZE; + + if (mode_ == ECB) + while (blocks--) { + AsmProcess(in, out); + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } + else if (mode_ == CBC) + if (dir_ == ENCRYPTION) + while (blocks--) { + r_[0] ^= *(word32*)in; + r_[1] ^= *(word32*)(in + 4); + + AsmProcess((byte*)r_, (byte*)r_); + + memcpy(out, r_, BLOCK_SIZE); + + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } + else + while (blocks--) { + AsmProcess(in, out); + + *(word32*)out ^= r_[0]; + *(word32*)(out + 4) ^= r_[1]; + + memcpy(r_, in, BLOCK_SIZE); + + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } +} + +#endif // DO_BLOWFISH_ASM + + +void Blowfish::SetKey(const byte* key_string, word32 keylength, CipherDir dir) +{ + assert(keylength >= 4 && keylength <= 56); + + unsigned i, j=0, k; + word32 data, dspace[2] = {0, 0}; + + memcpy(pbox_, p_init_, sizeof(p_init_)); + memcpy(sbox_, s_init_, sizeof(s_init_)); + + // Xor key string into encryption key vector + for (i=0 ; i> 8)&0xFF) +#define BFBYTE_2(x) ((x>>16)&0xFF) +#define BFBYTE_3(x) ( x>>24) + + +#define BF_S(Put, Get, I) (\ + Put ^= p[I], \ + tmp = p[18 + BFBYTE_3(Get)], \ + tmp += p[274+ BFBYTE_2(Get)], \ + tmp ^= p[530+ BFBYTE_1(Get)], \ + tmp += p[786+ BFBYTE_0(Get)], \ + Put ^= tmp \ + ) + + +#define BF_ROUNDS \ + BF_S(right, left, 1); \ + BF_S(left, right, 2); \ + BF_S(right, left, 3); \ + BF_S(left, right, 4); \ + BF_S(right, left, 5); \ + BF_S(left, right, 6); \ + BF_S(right, left, 7); \ + BF_S(left, right, 8); \ + BF_S(right, left, 9); \ + BF_S(left, right, 10); \ + BF_S(right, left, 11); \ + BF_S(left, right, 12); \ + BF_S(right, left, 13); \ + BF_S(left, right, 14); \ + BF_S(right, left, 15); \ + BF_S(left, right, 16); + +#define BF_EXTRA_ROUNDS \ + BF_S(right, left, 17); \ + BF_S(left, right, 18); \ + BF_S(right, left, 19); \ + BF_S(left, right, 20); + + +// Used by key setup, no byte swapping +void Blowfish::crypt_block(const word32 in[2], word32 out[2]) const +{ + word32 left = in[0]; + word32 right = in[1]; + + const word32* p = pbox_; + word32 tmp; + + left ^= p[0]; + + BF_ROUNDS + +#if ROUNDS == 20 + BF_EXTRA_ROUNDS +#endif + + right ^= p[ROUNDS + 1]; + + out[0] = right; + out[1] = left; +} + + +typedef BlockGetAndPut gpBlock; + +void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) + const +{ + word32 tmp, left, right; + const word32* p = pbox_; + + gpBlock::Get(in)(left)(right); + left ^= p[0]; + + BF_ROUNDS + +#if ROUNDS == 20 + BF_EXTRA_ROUNDS +#endif + + right ^= p[ROUNDS + 1]; + + gpBlock::Put(xOr, out)(right)(left); +} + + +#if defined(DO_BLOWFISH_ASM) + #ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + #define PROLOG() \ + asm(".intel_syntax noprefix"); \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( mov ecx, DWORD PTR [ebp + 8] ) \ + AS2( mov esi, DWORD PTR [ebp + 12] ) + + #define EPILOG() \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS1( emms ) \ + asm(".att_syntax"); + #else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( mov esi, DWORD PTR [ebp + 8] ) + + #define EPILOG() \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 8 ) + + #endif + + +#define BF_ROUND(P, G, I) \ + /* Put ^= p[I] */ \ + AS2( xor P, [edi + I*4] ) \ + /* tmp = p[18 + BFBYTE_3(Get)] */ \ + AS2( mov ecx, G ) \ + AS2( shr ecx, 16 ) \ + AS2( movzx edx, ch ) \ + AS2( mov esi, [edi + edx*4 + 72] ) \ + /* tmp += p[274+ BFBYTE_2(Get)] */ \ + AS2( movzx ecx, cl ) \ + AS2( add esi, [edi + ecx*4 + 1096] ) \ + /* tmp ^= p[530+ BFBYTE_1(Get)] */ \ + AS2( mov ecx, G ) \ + AS2( movzx edx, ch ) \ + AS2( xor esi, [edi + edx*4 + 2120] ) \ + /* tmp += p[786+ BFBYTE_0(Get)] */ \ + AS2( movzx ecx, cl ) \ + AS2( add esi, [edi + ecx*4 + 3144] ) \ + /* Put ^= tmp */ \ + AS2( xor P, esi ) + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void Blowfish::AsmProcess(const byte* inBlock, byte* outBlock) const +{ + PROLOG() + + #ifdef OLD_GCC_OFFSET + AS2( lea edi, [ecx + 60] ) // pbox + #else + AS2( lea edi, [ecx + 56] ) // pbox + #endif + + AS2( mov eax, DWORD PTR [esi] ) + AS2( mov edx, DWORD PTR [edi] ) + AS1( bswap eax ) + + AS2( mov ebx, DWORD PTR [esi + 4] ) + AS2( xor eax, edx ) // left + AS1( bswap ebx ) // right + + + BF_ROUND(ebx, eax, 1) + BF_ROUND(eax, ebx, 2) + BF_ROUND(ebx, eax, 3) + BF_ROUND(eax, ebx, 4) + BF_ROUND(ebx, eax, 5) + BF_ROUND(eax, ebx, 6) + BF_ROUND(ebx, eax, 7) + BF_ROUND(eax, ebx, 8) + BF_ROUND(ebx, eax, 9) + BF_ROUND(eax, ebx, 10) + BF_ROUND(ebx, eax, 11) + BF_ROUND(eax, ebx, 12) + BF_ROUND(ebx, eax, 13) + BF_ROUND(eax, ebx, 14) + BF_ROUND(ebx, eax, 15) + BF_ROUND(eax, ebx, 16) + #if ROUNDS == 20 + BF_ROUND(ebx, eax, 17) + BF_ROUND(eax, ebx, 18) + BF_ROUND(ebx, eax, 19) + BF_ROUND(eax, ebx, 20) + + AS2( xor ebx, [edi + 84] ) // 20 + 1 (x4) + #else + AS2( xor ebx, [edi + 68] ) // 16 + 1 (x4) + #endif + + #ifdef __GNUC__ + AS2( mov edi, [ebp + 16] ) // outBlock + #else + AS2( mov edi, [ebp + 12] ) // outBlock + #endif + + AS1( bswap ebx ) + AS1( bswap eax ) + + AS2( mov [edi] , ebx ) + AS2( mov [edi + 4], eax ) + + EPILOG() +} + + +#endif // DO_BLOWFISH_ASM + + +} // namespace + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/coding.cpp b/externals/mysql/extlib/yassl/taocrypt/src/coding.cpp new file mode 100644 index 0000000..7a9d50a --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/coding.cpp @@ -0,0 +1,253 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* coding.cpp implements hex and base64 encoding/decoing +*/ + +#include "runtime.hpp" +#include "coding.hpp" +#include "file.hpp" + + +namespace TaoCrypt { + + +namespace { // locals + +const byte bad = 0xFF; // invalid encoding + +const byte hexEncode[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + }; + +const byte hexDecode[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + bad, bad, bad, bad, bad, bad, bad, + 10, 11, 12, 13, 14, 15 + }; // A starts at 0x41 not 0x3A + + +const byte base64Encode[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + '+', '/' + }; + +const byte base64Decode[] = { 62, bad, bad, bad, 63, // + starts at 0x2B + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + bad, bad, bad, bad, bad, bad, bad, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, + bad, bad, bad, bad, bad, bad, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51 + }; + +const byte pad = '='; +const int pemLineSz = 64; + +} // local namespace + + +// Hex Encode +void HexEncoder::Encode() +{ + word32 bytes = plain_.size(); + encoded_.New(bytes * 2); + + word32 i = 0; + + while (bytes--) { + byte p = plain_.next(); + + byte b = p >> 4; + byte b2 = p & 0xF; + + encoded_[i++] = hexEncode[b]; + encoded_[i++] = hexEncode[b2]; + } + + plain_.reset(encoded_); +} + + +// Hex Decode +void HexDecoder::Decode() +{ + word32 bytes = coded_.size(); + assert((bytes % 2) == 0); + decoded_.New(bytes / 2); + + word32 i(0); + + while (bytes) { + byte b = coded_.next() - 0x30; // 0 starts at 0x30 + byte b2 = coded_.next() - 0x30; + + // sanity checks + assert( b < sizeof(hexDecode)/sizeof(hexDecode[0]) ); + assert( b2 < sizeof(hexDecode)/sizeof(hexDecode[0]) ); + + b = hexDecode[b]; + b2 = hexDecode[b2]; + + assert( b != bad && b2 != bad ); + + decoded_[i++] = (b << 4) | b2; + bytes -= 2; + } + + coded_.reset(decoded_); +} + + +// Base 64 Encode +void Base64Encoder::Encode() +{ + word32 bytes = plain_.size(); + word32 outSz = (bytes + 3 - 1) / 3 * 4; + + outSz += (outSz + pemLineSz - 1) / pemLineSz; // new lines + encoded_.New(outSz); + + word32 i = 0; + word32 j = 0; + + while (bytes > 2) { + byte b1 = plain_.next(); + byte b2 = plain_.next(); + byte b3 = plain_.next(); + + // encoded idx + byte e1 = b1 >> 2; + byte e2 = ((b1 & 0x3) << 4) | (b2 >> 4); + byte e3 = ((b2 & 0xF) << 2) | (b3 >> 6); + byte e4 = b3 & 0x3F; + + // store + encoded_[i++] = base64Encode[e1]; + encoded_[i++] = base64Encode[e2]; + encoded_[i++] = base64Encode[e3]; + encoded_[i++] = base64Encode[e4]; + + bytes -= 3; + + if ((++j % 16) == 0 && bytes) + encoded_[i++] = '\n'; + } + + // last integral + if (bytes) { + bool twoBytes = (bytes == 2); + + byte b1 = plain_.next(); + byte b2 = (twoBytes) ? plain_.next() : 0; + + byte e1 = b1 >> 2; + byte e2 = ((b1 & 0x3) << 4) | (b2 >> 4); + byte e3 = (b2 & 0xF) << 2; + + encoded_[i++] = base64Encode[e1]; + encoded_[i++] = base64Encode[e2]; + encoded_[i++] = (twoBytes) ? base64Encode[e3] : pad; + encoded_[i++] = pad; + } + + encoded_[i++] = '\n'; + assert(i == outSz); + + plain_.reset(encoded_); +} + + +// Base 64 Decode +void Base64Decoder::Decode() +{ + word32 bytes = coded_.size(); + word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); + plainSz = (plainSz * 3 + 3) / 4; + decoded_.New(plainSz); + + word32 i = 0; + word32 j = 0; + + while (bytes > 3) { + byte e1 = coded_.next(); + byte e2 = coded_.next(); + byte e3 = coded_.next(); + byte e4 = coded_.next(); + + // do asserts first + if (e1 == 0) // end file 0's + break; + + bool pad3 = false; + bool pad4 = false; + if (e3 == pad) + pad3 = true; + if (e4 == pad) + pad4 = true; + + e1 = base64Decode[e1 - 0x2B]; + e2 = base64Decode[e2 - 0x2B]; + e3 = (e3 == pad) ? 0 : base64Decode[e3 - 0x2B]; + e4 = (e4 == pad) ? 0 : base64Decode[e4 - 0x2B]; + + byte b1 = (e1 << 2) | (e2 >> 4); + byte b2 = ((e2 & 0xF) << 4) | (e3 >> 2); + byte b3 = ((e3 & 0x3) << 6) | e4; + + decoded_[i++] = b1; + if (!pad3) + decoded_[i++] = b2; + if (!pad4) + decoded_[i++] = b3; + else + break; + + bytes -= 4; + if ((++j % 16) == 0) { + byte endLine = coded_.next(); + bytes--; + while (endLine == ' ') { // remove possible whitespace + endLine = coded_.next(); + bytes--; + } + if (endLine == '\r') { + endLine = coded_.next(); + bytes--; + } + if (endLine != '\n') { + coded_.SetError(PEM_E); + return; + } + } + } + + if (i != decoded_.size()) + decoded_.resize(i); + coded_.reset(decoded_); +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/crypto.cpp b/externals/mysql/extlib/yassl/taocrypt/src/crypto.cpp new file mode 100644 index 0000000..90d406b --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/crypto.cpp @@ -0,0 +1,37 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* put features that other apps expect from OpenSSL type crypto */ + + + +extern "C" { + + // for libcurl configure test, these are the signatures they use + // locking handled internally by library + char CRYPTO_lock() { return 0;} + char CRYPTO_add_lock() { return 0;} + + + // for openvpn, test are the signatures they use + char EVP_CIPHER_CTX_init() { return 0; } + char CRYPTO_mem_ctrl() { return 0; } +} // extern "C" + + + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/des.cpp b/externals/mysql/extlib/yassl/taocrypt/src/des.cpp new file mode 100644 index 0000000..5cffeae --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/des.cpp @@ -0,0 +1,776 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* C++ part based on Wei Dai's des.cpp from CryptoPP */ +/* x86 asm is original */ + + +#if defined(TAOCRYPT_KERNEL_MODE) + #define DO_TAOCRYPT_KERNEL_MODE +#endif // only some modules now support this + + +#include "runtime.hpp" +#include "des.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + + +namespace TaoCrypt { + + +/* permuted choice table (key) */ +static const byte pc1[] = { + 57, 49, 41, 33, 25, 17, 9, + 1, 58, 50, 42, 34, 26, 18, + 10, 2, 59, 51, 43, 35, 27, + 19, 11, 3, 60, 52, 44, 36, + + 63, 55, 47, 39, 31, 23, 15, + 7, 62, 54, 46, 38, 30, 22, + 14, 6, 61, 53, 45, 37, 29, + 21, 13, 5, 28, 20, 12, 4 +}; + +/* number left rotations of pc1 */ +static const byte totrot[] = { + 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 +}; + +/* permuted choice key (table) */ +static const byte pc2[] = { + 14, 17, 11, 24, 1, 5, + 3, 28, 15, 6, 21, 10, + 23, 19, 12, 4, 26, 8, + 16, 7, 27, 20, 13, 2, + 41, 52, 31, 37, 47, 55, + 30, 40, 51, 45, 33, 48, + 44, 49, 39, 56, 34, 53, + 46, 42, 50, 36, 29, 32 +}; + +/* End of DES-defined tables */ + +/* bit 0 is left-most in byte */ +static const int bytebit[] = { + 0200,0100,040,020,010,04,02,01 +}; + +const word32 Spbox[8][64] = { +{ +0x01010400,0x00000000,0x00010000,0x01010404, +0x01010004,0x00010404,0x00000004,0x00010000, +0x00000400,0x01010400,0x01010404,0x00000400, +0x01000404,0x01010004,0x01000000,0x00000004, +0x00000404,0x01000400,0x01000400,0x00010400, +0x00010400,0x01010000,0x01010000,0x01000404, +0x00010004,0x01000004,0x01000004,0x00010004, +0x00000000,0x00000404,0x00010404,0x01000000, +0x00010000,0x01010404,0x00000004,0x01010000, +0x01010400,0x01000000,0x01000000,0x00000400, +0x01010004,0x00010000,0x00010400,0x01000004, +0x00000400,0x00000004,0x01000404,0x00010404, +0x01010404,0x00010004,0x01010000,0x01000404, +0x01000004,0x00000404,0x00010404,0x01010400, +0x00000404,0x01000400,0x01000400,0x00000000, +0x00010004,0x00010400,0x00000000,0x01010004}, +{ +0x80108020,0x80008000,0x00008000,0x00108020, +0x00100000,0x00000020,0x80100020,0x80008020, +0x80000020,0x80108020,0x80108000,0x80000000, +0x80008000,0x00100000,0x00000020,0x80100020, +0x00108000,0x00100020,0x80008020,0x00000000, +0x80000000,0x00008000,0x00108020,0x80100000, +0x00100020,0x80000020,0x00000000,0x00108000, +0x00008020,0x80108000,0x80100000,0x00008020, +0x00000000,0x00108020,0x80100020,0x00100000, +0x80008020,0x80100000,0x80108000,0x00008000, +0x80100000,0x80008000,0x00000020,0x80108020, +0x00108020,0x00000020,0x00008000,0x80000000, +0x00008020,0x80108000,0x00100000,0x80000020, +0x00100020,0x80008020,0x80000020,0x00100020, +0x00108000,0x00000000,0x80008000,0x00008020, +0x80000000,0x80100020,0x80108020,0x00108000}, +{ +0x00000208,0x08020200,0x00000000,0x08020008, +0x08000200,0x00000000,0x00020208,0x08000200, +0x00020008,0x08000008,0x08000008,0x00020000, +0x08020208,0x00020008,0x08020000,0x00000208, +0x08000000,0x00000008,0x08020200,0x00000200, +0x00020200,0x08020000,0x08020008,0x00020208, +0x08000208,0x00020200,0x00020000,0x08000208, +0x00000008,0x08020208,0x00000200,0x08000000, +0x08020200,0x08000000,0x00020008,0x00000208, +0x00020000,0x08020200,0x08000200,0x00000000, +0x00000200,0x00020008,0x08020208,0x08000200, +0x08000008,0x00000200,0x00000000,0x08020008, +0x08000208,0x00020000,0x08000000,0x08020208, +0x00000008,0x00020208,0x00020200,0x08000008, +0x08020000,0x08000208,0x00000208,0x08020000, +0x00020208,0x00000008,0x08020008,0x00020200}, +{ +0x00802001,0x00002081,0x00002081,0x00000080, +0x00802080,0x00800081,0x00800001,0x00002001, +0x00000000,0x00802000,0x00802000,0x00802081, +0x00000081,0x00000000,0x00800080,0x00800001, +0x00000001,0x00002000,0x00800000,0x00802001, +0x00000080,0x00800000,0x00002001,0x00002080, +0x00800081,0x00000001,0x00002080,0x00800080, +0x00002000,0x00802080,0x00802081,0x00000081, +0x00800080,0x00800001,0x00802000,0x00802081, +0x00000081,0x00000000,0x00000000,0x00802000, +0x00002080,0x00800080,0x00800081,0x00000001, +0x00802001,0x00002081,0x00002081,0x00000080, +0x00802081,0x00000081,0x00000001,0x00002000, +0x00800001,0x00002001,0x00802080,0x00800081, +0x00002001,0x00002080,0x00800000,0x00802001, +0x00000080,0x00800000,0x00002000,0x00802080}, +{ +0x00000100,0x02080100,0x02080000,0x42000100, +0x00080000,0x00000100,0x40000000,0x02080000, +0x40080100,0x00080000,0x02000100,0x40080100, +0x42000100,0x42080000,0x00080100,0x40000000, +0x02000000,0x40080000,0x40080000,0x00000000, +0x40000100,0x42080100,0x42080100,0x02000100, +0x42080000,0x40000100,0x00000000,0x42000000, +0x02080100,0x02000000,0x42000000,0x00080100, +0x00080000,0x42000100,0x00000100,0x02000000, +0x40000000,0x02080000,0x42000100,0x40080100, +0x02000100,0x40000000,0x42080000,0x02080100, +0x40080100,0x00000100,0x02000000,0x42080000, +0x42080100,0x00080100,0x42000000,0x42080100, +0x02080000,0x00000000,0x40080000,0x42000000, +0x00080100,0x02000100,0x40000100,0x00080000, +0x00000000,0x40080000,0x02080100,0x40000100}, +{ +0x20000010,0x20400000,0x00004000,0x20404010, +0x20400000,0x00000010,0x20404010,0x00400000, +0x20004000,0x00404010,0x00400000,0x20000010, +0x00400010,0x20004000,0x20000000,0x00004010, +0x00000000,0x00400010,0x20004010,0x00004000, +0x00404000,0x20004010,0x00000010,0x20400010, +0x20400010,0x00000000,0x00404010,0x20404000, +0x00004010,0x00404000,0x20404000,0x20000000, +0x20004000,0x00000010,0x20400010,0x00404000, +0x20404010,0x00400000,0x00004010,0x20000010, +0x00400000,0x20004000,0x20000000,0x00004010, +0x20000010,0x20404010,0x00404000,0x20400000, +0x00404010,0x20404000,0x00000000,0x20400010, +0x00000010,0x00004000,0x20400000,0x00404010, +0x00004000,0x00400010,0x20004010,0x00000000, +0x20404000,0x20000000,0x00400010,0x20004010}, +{ +0x00200000,0x04200002,0x04000802,0x00000000, +0x00000800,0x04000802,0x00200802,0x04200800, +0x04200802,0x00200000,0x00000000,0x04000002, +0x00000002,0x04000000,0x04200002,0x00000802, +0x04000800,0x00200802,0x00200002,0x04000800, +0x04000002,0x04200000,0x04200800,0x00200002, +0x04200000,0x00000800,0x00000802,0x04200802, +0x00200800,0x00000002,0x04000000,0x00200800, +0x04000000,0x00200800,0x00200000,0x04000802, +0x04000802,0x04200002,0x04200002,0x00000002, +0x00200002,0x04000000,0x04000800,0x00200000, +0x04200800,0x00000802,0x00200802,0x04200800, +0x00000802,0x04000002,0x04200802,0x04200000, +0x00200800,0x00000000,0x00000002,0x04200802, +0x00000000,0x00200802,0x04200000,0x00000800, +0x04000002,0x04000800,0x00000800,0x00200002}, +{ +0x10001040,0x00001000,0x00040000,0x10041040, +0x10000000,0x10001040,0x00000040,0x10000000, +0x00040040,0x10040000,0x10041040,0x00041000, +0x10041000,0x00041040,0x00001000,0x00000040, +0x10040000,0x10000040,0x10001000,0x00001040, +0x00041000,0x00040040,0x10040040,0x10041000, +0x00001040,0x00000000,0x00000000,0x10040040, +0x10000040,0x10001000,0x00041040,0x00040000, +0x00041040,0x00040000,0x10041000,0x00001000, +0x00000040,0x10040040,0x00001000,0x00041040, +0x10001000,0x00000040,0x10000040,0x10040000, +0x10040040,0x10000000,0x00040000,0x10001040, +0x00000000,0x10041040,0x00040040,0x10000040, +0x10040000,0x10001000,0x10001040,0x00000000, +0x10041040,0x00041000,0x00041000,0x00001040, +0x00001040,0x00040040,0x10000000,0x10041000} +}; + + +void BasicDES::SetKey(const byte* key, word32 /*length*/, CipherDir dir) +{ + byte buffer[56+56+8]; + byte *const pc1m = buffer; /* place to modify pc1 into */ + byte *const pcr = pc1m + 56; /* place to rotate pc1 into */ + byte *const ks = pcr + 56; + register int i,j,l; + int m; + + for (j = 0; j < 56; j++) { /* convert pc1 to bits of key */ + l = pc1[j] - 1; /* integer bit location */ + m = l & 07; /* find bit */ + pc1m[j] = (key[l >> 3] & /* find which key byte l is in */ + bytebit[m]) /* and which bit of that byte */ + ? 1 : 0; /* and store 1-bit result */ + } + for (i = 0; i < 16; i++) { /* key chunk for each iteration */ + memset(ks, 0, 8); /* Clear key schedule */ + for (j = 0; j < 56; j++) /* rotate pc1 the right amount */ + pcr[j] = pc1m[(l = j + totrot[i]) < (j < 28 ? 28 : 56) ? l: l-28]; + /* rotate left and right halves independently */ + for (j = 0; j < 48; j++){ /* select bits individually */ + /* check bit that goes to ks[j] */ + if (pcr[pc2[j] - 1]){ + /* mask it in if it's there */ + l= j % 6; + ks[j/6] |= bytebit[l] >> 2; + } + } + /* Now convert to odd/even interleaved form for use in F */ + k_[2*i] = ((word32)ks[0] << 24) + | ((word32)ks[2] << 16) + | ((word32)ks[4] << 8) + | ((word32)ks[6]); + k_[2*i + 1] = ((word32)ks[1] << 24) + | ((word32)ks[3] << 16) + | ((word32)ks[5] << 8) + | ((word32)ks[7]); + } + + // reverse key schedule order + if (dir == DECRYPTION) + for (i = 0; i < 16; i += 2) { + STL::swap(k_[i], k_[32 - 2 - i]); + STL::swap(k_[i+1], k_[32 - 1 - i]); + } + +} + +static inline void IPERM(word32& left, word32& right) +{ + word32 work; + + right = rotlFixed(right, 4U); + work = (left ^ right) & 0xf0f0f0f0; + left ^= work; + + right = rotrFixed(right^work, 20U); + work = (left ^ right) & 0xffff0000; + left ^= work; + + right = rotrFixed(right^work, 18U); + work = (left ^ right) & 0x33333333; + left ^= work; + + right = rotrFixed(right^work, 6U); + work = (left ^ right) & 0x00ff00ff; + left ^= work; + + right = rotlFixed(right^work, 9U); + work = (left ^ right) & 0xaaaaaaaa; + left = rotlFixed(left^work, 1U); + right ^= work; +} + +static inline void FPERM(word32& left, word32& right) +{ + word32 work; + + right = rotrFixed(right, 1U); + work = (left ^ right) & 0xaaaaaaaa; + right ^= work; + left = rotrFixed(left^work, 9U); + work = (left ^ right) & 0x00ff00ff; + right ^= work; + left = rotlFixed(left^work, 6U); + work = (left ^ right) & 0x33333333; + right ^= work; + left = rotlFixed(left^work, 18U); + work = (left ^ right) & 0xffff0000; + right ^= work; + left = rotlFixed(left^work, 20U); + work = (left ^ right) & 0xf0f0f0f0; + right ^= work; + left = rotrFixed(left^work, 4U); +} + + +void BasicDES::RawProcessBlock(word32& lIn, word32& rIn) const +{ + word32 l = lIn, r = rIn; + const word32* kptr = k_; + + for (unsigned i=0; i<8; i++) + { + word32 work = rotrFixed(r, 4U) ^ kptr[4*i+0]; + l ^= Spbox[6][(work) & 0x3f] + ^ Spbox[4][(work >> 8) & 0x3f] + ^ Spbox[2][(work >> 16) & 0x3f] + ^ Spbox[0][(work >> 24) & 0x3f]; + work = r ^ kptr[4*i+1]; + l ^= Spbox[7][(work) & 0x3f] + ^ Spbox[5][(work >> 8) & 0x3f] + ^ Spbox[3][(work >> 16) & 0x3f] + ^ Spbox[1][(work >> 24) & 0x3f]; + + work = rotrFixed(l, 4U) ^ kptr[4*i+2]; + r ^= Spbox[6][(work) & 0x3f] + ^ Spbox[4][(work >> 8) & 0x3f] + ^ Spbox[2][(work >> 16) & 0x3f] + ^ Spbox[0][(work >> 24) & 0x3f]; + work = l ^ kptr[4*i+3]; + r ^= Spbox[7][(work) & 0x3f] + ^ Spbox[5][(work >> 8) & 0x3f] + ^ Spbox[3][(work >> 16) & 0x3f] + ^ Spbox[1][(work >> 24) & 0x3f]; + } + + lIn = l; rIn = r; +} + + + +typedef BlockGetAndPut Block; + + +void DES::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) const +{ + word32 l,r; + Block::Get(in)(l)(r); + IPERM(l,r); + + RawProcessBlock(l, r); + + FPERM(l,r); + Block::Put(xOr, out)(r)(l); +} + + +void DES_EDE2::SetKey(const byte* key, word32 sz, CipherDir dir) +{ + des1_.SetKey(key, sz, dir); + des2_.SetKey(key + 8, sz, ReverseDir(dir)); +} + + +void DES_EDE2::ProcessAndXorBlock(const byte* in, const byte* xOr, + byte* out) const +{ + word32 l,r; + Block::Get(in)(l)(r); + IPERM(l,r); + + des1_.RawProcessBlock(l, r); + des2_.RawProcessBlock(r, l); + des1_.RawProcessBlock(l, r); + + FPERM(l,r); + Block::Put(xOr, out)(r)(l); +} + + +void DES_EDE3::SetKey(const byte* key, word32 sz, CipherDir dir) +{ + des1_.SetKey(key+(dir==ENCRYPTION?0:2*8), sz, dir); + des2_.SetKey(key+8, sz, ReverseDir(dir)); + des3_.SetKey(key+(dir==DECRYPTION?0:2*8), sz, dir); +} + + + +#if defined(DO_DES_ASM) + +// ia32 optimized version +void DES_EDE3::Process(byte* out, const byte* in, word32 sz) +{ + if (!isMMX) { + Mode_BASE::Process(out, in, sz); + return; + } + + word32 blocks = sz / DES_BLOCK_SIZE; + + if (mode_ == CBC) + if (dir_ == ENCRYPTION) + while (blocks--) { + r_[0] ^= *(word32*)in; + r_[1] ^= *(word32*)(in + 4); + + AsmProcess((byte*)r_, (byte*)r_, (void*)Spbox); + + memcpy(out, r_, DES_BLOCK_SIZE); + + in += DES_BLOCK_SIZE; + out += DES_BLOCK_SIZE; + } + else + while (blocks--) { + AsmProcess(in, out, (void*)Spbox); + + *(word32*)out ^= r_[0]; + *(word32*)(out + 4) ^= r_[1]; + + memcpy(r_, in, DES_BLOCK_SIZE); + + out += DES_BLOCK_SIZE; + in += DES_BLOCK_SIZE; + } + else + while (blocks--) { + AsmProcess(in, out, (void*)Spbox); + + out += DES_BLOCK_SIZE; + in += DES_BLOCK_SIZE; + } +} + +#endif // DO_DES_ASM + + +void DES_EDE3::ProcessAndXorBlock(const byte* in, const byte* xOr, + byte* out) const +{ + word32 l,r; + Block::Get(in)(l)(r); + IPERM(l,r); + + des1_.RawProcessBlock(l, r); + des2_.RawProcessBlock(r, l); + des3_.RawProcessBlock(l, r); + + FPERM(l,r); + Block::Put(xOr, out)(r)(l); +} + + +#if defined(DO_DES_ASM) + +/* Uses IPERM algorithm from above + + left is in eax + right is in ebx + + uses ecx +*/ +#define AsmIPERM() {\ + AS2( rol ebx, 4 ) \ + AS2( mov ecx, eax ) \ + AS2( xor ecx, ebx ) \ + AS2( and ecx, 0xf0f0f0f0 ) \ + AS2( xor ebx, ecx ) \ + AS2( xor eax, ecx ) \ + AS2( ror ebx, 20 ) \ + AS2( mov ecx, eax ) \ + AS2( xor ecx, ebx ) \ + AS2( and ecx, 0xffff0000 ) \ + AS2( xor ebx, ecx ) \ + AS2( xor eax, ecx ) \ + AS2( ror ebx, 18 ) \ + AS2( mov ecx, eax ) \ + AS2( xor ecx, ebx ) \ + AS2( and ecx, 0x33333333 ) \ + AS2( xor ebx, ecx ) \ + AS2( xor eax, ecx ) \ + AS2( ror ebx, 6 ) \ + AS2( mov ecx, eax ) \ + AS2( xor ecx, ebx ) \ + AS2( and ecx, 0x00ff00ff ) \ + AS2( xor ebx, ecx ) \ + AS2( xor eax, ecx ) \ + AS2( rol ebx, 9 ) \ + AS2( mov ecx, eax ) \ + AS2( xor ecx, ebx ) \ + AS2( and ecx, 0xaaaaaaaa ) \ + AS2( xor eax, ecx ) \ + AS2( rol eax, 1 ) \ + AS2( xor ebx, ecx ) } + + +/* Uses FPERM algorithm from above + + left is in eax + right is in ebx + + uses ecx +*/ +#define AsmFPERM() {\ + AS2( ror ebx, 1 ) \ + AS2( mov ecx, eax ) \ + AS2( xor ecx, ebx ) \ + AS2( and ecx, 0xaaaaaaaa ) \ + AS2( xor eax, ecx ) \ + AS2( xor ebx, ecx ) \ + AS2( ror eax, 9 ) \ + AS2( mov ecx, ebx ) \ + AS2( xor ecx, eax ) \ + AS2( and ecx, 0x00ff00ff ) \ + AS2( xor eax, ecx ) \ + AS2( xor ebx, ecx ) \ + AS2( rol eax, 6 ) \ + AS2( mov ecx, ebx ) \ + AS2( xor ecx, eax ) \ + AS2( and ecx, 0x33333333 ) \ + AS2( xor eax, ecx ) \ + AS2( xor ebx, ecx ) \ + AS2( rol eax, 18 ) \ + AS2( mov ecx, ebx ) \ + AS2( xor ecx, eax ) \ + AS2( and ecx, 0xffff0000 ) \ + AS2( xor eax, ecx ) \ + AS2( xor ebx, ecx ) \ + AS2( rol eax, 20 ) \ + AS2( mov ecx, ebx ) \ + AS2( xor ecx, eax ) \ + AS2( and ecx, 0xf0f0f0f0 ) \ + AS2( xor eax, ecx ) \ + AS2( xor ebx, ecx ) \ + AS2( ror eax, 4 ) } + + + + +/* DesRound implements this algorithm: + + word32 work = rotrFixed(r, 4U) ^ key[0]; + l ^= Spbox[6][(work) & 0x3f] + ^ Spbox[4][(work >> 8) & 0x3f] + ^ Spbox[2][(work >> 16) & 0x3f] + ^ Spbox[0][(work >> 24) & 0x3f]; + work = r ^ key[1]; + l ^= Spbox[7][(work) & 0x3f] + ^ Spbox[5][(work >> 8) & 0x3f] + ^ Spbox[3][(work >> 16) & 0x3f] + ^ Spbox[1][(work >> 24) & 0x3f]; + + work = rotrFixed(l, 4U) ^ key[2]; + r ^= Spbox[6][(work) & 0x3f] + ^ Spbox[4][(work >> 8) & 0x3f] + ^ Spbox[2][(work >> 16) & 0x3f] + ^ Spbox[0][(work >> 24) & 0x3f]; + work = l ^ key[3]; + r ^= Spbox[7][(work) & 0x3f] + ^ Spbox[5][(work >> 8) & 0x3f] + ^ Spbox[3][(work >> 16) & 0x3f] + ^ Spbox[1][(work >> 24) & 0x3f]; + + left is in aex + right is in ebx + key is in edx + + edvances key for next round + + uses ecx, esi, and edi +*/ +#define DesRound() \ + AS2( mov ecx, ebx )\ + AS2( mov esi, DWORD PTR [edx] )\ + AS2( ror ecx, 4 )\ + AS2( xor ecx, esi )\ + AS2( and ecx, 0x3f3f3f3f )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor eax, [ebp + esi*4 + 6*256] )\ + AS2( shr ecx, 16 )\ + AS2( xor eax, [ebp + edi*4 + 4*256] )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor eax, [ebp + esi*4 + 2*256] )\ + AS2( mov esi, DWORD PTR [edx + 4] )\ + AS2( xor eax, [ebp + edi*4] )\ + AS2( mov ecx, ebx )\ + AS2( xor ecx, esi )\ + AS2( and ecx, 0x3f3f3f3f )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor eax, [ebp + esi*4 + 7*256] )\ + AS2( shr ecx, 16 )\ + AS2( xor eax, [ebp + edi*4 + 5*256] )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor eax, [ebp + esi*4 + 3*256] )\ + AS2( mov esi, DWORD PTR [edx + 8] )\ + AS2( xor eax, [ebp + edi*4 + 1*256] )\ + AS2( mov ecx, eax )\ + AS2( ror ecx, 4 )\ + AS2( xor ecx, esi )\ + AS2( and ecx, 0x3f3f3f3f )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor ebx, [ebp + esi*4 + 6*256] )\ + AS2( shr ecx, 16 )\ + AS2( xor ebx, [ebp + edi*4 + 4*256] )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor ebx, [ebp + esi*4 + 2*256] )\ + AS2( mov esi, DWORD PTR [edx + 12] )\ + AS2( xor ebx, [ebp + edi*4] )\ + AS2( mov ecx, eax )\ + AS2( xor ecx, esi )\ + AS2( and ecx, 0x3f3f3f3f )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor ebx, [ebp + esi*4 + 7*256] )\ + AS2( shr ecx, 16 )\ + AS2( xor ebx, [ebp + edi*4 + 5*256] )\ + AS2( movzx esi, cl )\ + AS2( movzx edi, ch )\ + AS2( xor ebx, [ebp + esi*4 + 3*256] )\ + AS2( add edx, 16 )\ + AS2( xor ebx, [ebp + edi*4 + 1*256] ) + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void DES_EDE3::AsmProcess(const byte* in, byte* out, void* box) const +{ +#ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + asm(".intel_syntax noprefix"); + + #define PROLOG() \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov edx, DWORD PTR [ebp + 8] ) \ + AS2( mov esi, DWORD PTR [ebp + 12] ) \ + AS2( mov ebp, DWORD PTR [ebp + 20] ) + + // ebp restored at end + #define EPILOG() \ + AS2( movd edi, mm3 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd esi, mm5 ) \ + AS1( emms ) \ + asm(".att_syntax"); + +#else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov esi, DWORD PTR [ebp + 8] ) \ + AS2( mov edx, ecx ) \ + AS2( mov ebp, DWORD PTR [ebp + 16] ) + + // ebp restored at end + #define EPILOG() \ + AS2( movd edi, mm3 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd esi, mm5 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 12 ) + +#endif + + + PROLOG() + + AS2( movd mm2, edx ) + + #ifdef OLD_GCC_OFFSET + AS2( add edx, 60 ) // des1 = des1 key + #else + AS2( add edx, 56 ) // des1 = des1 key + #endif + + AS2( mov eax, DWORD PTR [esi] ) + AS2( mov ebx, DWORD PTR [esi + 4] ) + AS1( bswap eax ) // left + AS1( bswap ebx ) // right + + AsmIPERM() + + DesRound() // 1 + DesRound() // 2 + DesRound() // 3 + DesRound() // 4 + DesRound() // 5 + DesRound() // 6 + DesRound() // 7 + DesRound() // 8 + + // swap left and right + AS2( xchg eax, ebx ) + + DesRound() // 1 + DesRound() // 2 + DesRound() // 3 + DesRound() // 4 + DesRound() // 5 + DesRound() // 6 + DesRound() // 7 + DesRound() // 8 + + // swap left and right + AS2( xchg eax, ebx ) + + DesRound() // 1 + DesRound() // 2 + DesRound() // 3 + DesRound() // 4 + DesRound() // 5 + DesRound() // 6 + DesRound() // 7 + DesRound() // 8 + + AsmFPERM() + + //end + AS2( movd ebp, mm6 ) + + // swap and write out + AS1( bswap ebx ) + AS1( bswap eax ) + +#ifdef __GNUC__ + AS2( mov esi, DWORD PTR [ebp + 16] ) // outBlock +#else + AS2( mov esi, DWORD PTR [ebp + 12] ) // outBlock +#endif + + AS2( mov DWORD PTR [esi], ebx ) // right first + AS2( mov DWORD PTR [esi + 4], eax ) + + + EPILOG() +} + + + +#endif // defined(DO_DES_ASM) + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/dh.cpp b/externals/mysql/extlib/yassl/taocrypt/src/dh.cpp new file mode 100644 index 0000000..d6a61cf --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/dh.cpp @@ -0,0 +1,103 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* dh.cpp implements Diffie-Hellman support +*/ + +#include "runtime.hpp" +#include "dh.hpp" +#include "asn.hpp" +#include + +namespace TaoCrypt { + + +namespace { // locals + +unsigned int DiscreteLogWorkFactor(unsigned int n) +{ + // assuming discrete log takes about the same time as factoring + if (n<5) + return 0; + else + return (unsigned int)(2.4 * pow((double)n, 1.0/3.0) * + pow(log(double(n)), 2.0/3.0) - 5); +} + +} // namespace locals + + +// Generate a DH Key Pair +void DH::GenerateKeyPair(RandomNumberGenerator& rng, byte* priv, byte* pub) +{ + GeneratePrivate(rng, priv); + GeneratePublic(priv, pub); +} + + +// Generate private value +void DH::GeneratePrivate(RandomNumberGenerator& rng, byte* priv) +{ + Integer x(rng, Integer::One(), min(p_ - 1, + Integer::Power2(2*DiscreteLogWorkFactor(p_.BitCount())) ) ); + x.Encode(priv, p_.ByteCount()); +} + + +// Generate public value +void DH::GeneratePublic(const byte* priv, byte* pub) +{ + const word32 bc(p_.ByteCount()); + Integer x(priv, bc); + Integer y(a_exp_b_mod_c(g_, x, p_)); + y.Encode(pub, bc); +} + + +// Generate Agreement +void DH::Agree(byte* agree, const byte* priv, const byte* otherPub, word32 + otherSz) +{ + const word32 bc(p_.ByteCount()); + Integer x(priv, bc); + Integer y; + if (otherSz) + y.Decode(otherPub, otherSz); + else + y.Decode(otherPub, bc); + + Integer z(a_exp_b_mod_c(y, x, p_)); + z.Encode(agree, bc); +} + + +DH::DH(Source& source) +{ + Initialize(source); +} + + +void DH::Initialize(Source& source) +{ + DH_Decoder decoder(source); + decoder.Decode(*this); +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/dsa.cpp b/externals/mysql/extlib/yassl/taocrypt/src/dsa.cpp new file mode 100644 index 0000000..79ee91e --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/dsa.cpp @@ -0,0 +1,271 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +#include "runtime.hpp" +#include "dsa.hpp" +#include "sha.hpp" +#include "asn.hpp" +#include "modarith.hpp" + + +namespace TaoCrypt { + + +void DSA_PublicKey::Swap(DSA_PublicKey& other) +{ + p_.Swap(other.p_); + q_.Swap(other.q_); + g_.Swap(other.g_); + y_.Swap(other.y_); +} + + +DSA_PublicKey::DSA_PublicKey(const DSA_PublicKey& other) + : p_(other.p_), q_(other.q_), g_(other.g_), y_(other.y_) +{} + + +DSA_PublicKey& DSA_PublicKey::operator=(const DSA_PublicKey& that) +{ + DSA_PublicKey tmp(that); + Swap(tmp); + return *this; +} + + +DSA_PublicKey::DSA_PublicKey(Source& source) +{ + Initialize(source); +} + + +void DSA_PublicKey::Initialize(Source& source) +{ + DSA_Public_Decoder decoder(source); + decoder.Decode(*this); +} + + +void DSA_PublicKey::Initialize(const Integer& p, const Integer& q, + const Integer& g, const Integer& y) +{ + p_ = p; + q_ = q; + g_ = g; + y_ = y; +} + + +const Integer& DSA_PublicKey::GetModulus() const +{ + return p_; +} + +const Integer& DSA_PublicKey::GetSubGroupOrder() const +{ + return q_; +} + + +const Integer& DSA_PublicKey::GetSubGroupGenerator() const +{ + return g_; +} + + +const Integer& DSA_PublicKey::GetPublicPart() const +{ + return y_; +} + + +void DSA_PublicKey::SetModulus(const Integer& p) +{ + p_ = p; +} + + +void DSA_PublicKey::SetSubGroupOrder(const Integer& q) +{ + q_ = q; +} + + +void DSA_PublicKey::SetSubGroupGenerator(const Integer& g) +{ + g_ = g; +} + + +void DSA_PublicKey::SetPublicPart(const Integer& y) +{ + y_ = y; +} + + +word32 DSA_PublicKey::SignatureLength() const +{ + return GetSubGroupOrder().ByteCount() * 2; // r and s +} + + + +DSA_PrivateKey::DSA_PrivateKey(Source& source) +{ + Initialize(source); +} + + +void DSA_PrivateKey::Initialize(Source& source) +{ + DSA_Private_Decoder decoder(source); + decoder.Decode(*this); +} + + +void DSA_PrivateKey::Initialize(const Integer& p, const Integer& q, + const Integer& g, const Integer& y, + const Integer& x) +{ + DSA_PublicKey::Initialize(p, q, g, y); + x_ = x; +} + + +const Integer& DSA_PrivateKey::GetPrivatePart() const +{ + return x_; +} + + +void DSA_PrivateKey::SetPrivatePart(const Integer& x) +{ + x_ = x; +} + + +DSA_Signer::DSA_Signer(const DSA_PrivateKey& key) + : key_(key) +{} + + +word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig, + RandomNumberGenerator& rng) +{ + const Integer& p = key_.GetModulus(); + const Integer& q = key_.GetSubGroupOrder(); + const Integer& g = key_.GetSubGroupGenerator(); + const Integer& x = key_.GetPrivatePart(); + + Integer k(rng, 1, q - 1); + + r_ = a_exp_b_mod_c(g, k, p); + r_ %= q; + + Integer H(sha_digest, SHA::DIGEST_SIZE); // sha Hash(m) + + Integer kInv = k.InverseMod(q); + s_ = (kInv * (H + x*r_)) % q; + + assert(!!r_ && !!s_); + + int rSz = r_.ByteCount(); + + if (rSz == 19) { + sig[0] = 0; + sig++; + } + + r_.Encode(sig, rSz); + + int sSz = s_.ByteCount(); + + if (sSz == 19) { + sig[rSz] = 0; + sig++; + } + + s_.Encode(sig + rSz, sSz); + + return 40; +} + + +DSA_Verifier::DSA_Verifier(const DSA_PublicKey& key) + : key_(key) +{} + + +bool DSA_Verifier::Verify(const byte* sha_digest, const byte* sig) +{ + const Integer& p = key_.GetModulus(); + const Integer& q = key_.GetSubGroupOrder(); + const Integer& g = key_.GetSubGroupGenerator(); + const Integer& y = key_.GetPublicPart(); + + int sz = q.ByteCount(); + + r_.Decode(sig, sz); + s_.Decode(sig + sz, sz); + + if (r_ >= q || r_ < 1 || s_ >= q || s_ < 1) + return false; + + Integer H(sha_digest, SHA::DIGEST_SIZE); // sha Hash(m) + + Integer w = s_.InverseMod(q); + Integer u1 = (H * w) % q; + Integer u2 = (r_ * w) % q; + + // verify r == ((g^u1 * y^u2) mod p) mod q + ModularArithmetic ma(p); + Integer v = ma.CascadeExponentiate(g, u1, y, u2); + v %= q; + + return r_ == v; +} + + + + +const Integer& DSA_Signer::GetR() const +{ + return r_; +} + + +const Integer& DSA_Signer::GetS() const +{ + return s_; +} + + +const Integer& DSA_Verifier::GetR() const +{ + return r_; +} + + +const Integer& DSA_Verifier::GetS() const +{ + return s_; +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/file.cpp b/externals/mysql/extlib/yassl/taocrypt/src/file.cpp new file mode 100644 index 0000000..0498038 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/file.cpp @@ -0,0 +1,115 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* file.cpp implements File Sources and Sinks +*/ + +#include "runtime.hpp" +#include "file.hpp" + + +namespace TaoCrypt { + + +FileSource::FileSource(const char* fname, Source& source) +{ + file_ = fopen(fname, "rb"); + if (file_) get(source); +} + + +FileSource::~FileSource() +{ + if (file_) + fclose(file_); +} + + + +// return size of source from beginning or current position +word32 FileSource::size(bool use_current) +{ + long current = ftell(file_); + long begin = current; + + if (!use_current) { + fseek(file_, 0, SEEK_SET); + begin = ftell(file_); + } + + fseek(file_, 0, SEEK_END); + long end = ftell(file_); + + fseek(file_, current, SEEK_SET); + + return end - begin; +} + + +word32 FileSource::size_left() +{ + return size(true); +} + + +// fill file source from source +word32 FileSource::get(Source& source) +{ + word32 sz(size()); + if (source.size() < sz) + source.grow(sz); + + size_t bytes = fread(source.buffer_.get_buffer(), 1, sz, file_); + + if (bytes == 1) + return sz; + else + return 0; +} + + +FileSink::FileSink(const char* fname, Source& source) +{ + file_ = fopen(fname, "wb"); + if (file_) put(source); +} + + +FileSink::~FileSink() +{ + if (file_) + fclose(file_); +} + + +// fill source from file sink +void FileSink::put(Source& source) +{ + fwrite(source.get_buffer(), 1, source.size(), file_); +} + + +// swap with other and reset to beginning +void Source::reset(ByteBlock& otherBlock) +{ + buffer_.Swap(otherBlock); + current_ = 0; +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/hash.cpp b/externals/mysql/extlib/yassl/taocrypt/src/hash.cpp new file mode 100644 index 0000000..c51dc42 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/hash.cpp @@ -0,0 +1,196 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* hash.cpp implements a base for digest types +*/ + +#include "runtime.hpp" +#include +#include + +#include "hash.hpp" + + +namespace TaoCrypt { + + +HASHwithTransform::HASHwithTransform(word32 digSz, word32 buffSz) +{ + assert(digSz <= MaxDigestSz); + assert(buffSz <= MaxBufferSz); +} + + +void HASHwithTransform::AddLength(word32 len) +{ + HashLengthType tmp = loLen_; + if ( (loLen_ += len) < tmp) + hiLen_++; // carry low to high + hiLen_ += SafeRightShift<8*sizeof(HashLengthType)>(len); +} + + +// Update digest with data of size len, do in blocks +void HASHwithTransform::Update(const byte* data, word32 len) +{ + // do block size increments + word32 blockSz = getBlockSize(); + byte* local = reinterpret_cast(buffer_); + + while (len) { + word32 add = min(len, blockSz - buffLen_); + memcpy(&local[buffLen_], data, add); + + buffLen_ += add; + data += add; + len -= add; + + if (buffLen_ == blockSz) { + ByteReverseIf(local, local, blockSz, getByteOrder()); + Transform(); + AddLength(blockSz); + buffLen_ = 0; + } + } +} + + +// Final process, place digest in hash +void HASHwithTransform::Final(byte* hash) +{ + word32 blockSz = getBlockSize(); + word32 digestSz = getDigestSize(); + word32 padSz = getPadSize(); + ByteOrder order = getByteOrder(); + + AddLength(buffLen_); // before adding pads + HashLengthType preLoLen = GetBitCountLo(); + HashLengthType preHiLen = GetBitCountHi(); + byte* local = reinterpret_cast(buffer_); + + local[buffLen_++] = 0x80; // add 1 + + // pad with zeros + if (buffLen_ > padSz) { + memset(&local[buffLen_], 0, blockSz - buffLen_); + buffLen_ += blockSz - buffLen_; + + ByteReverseIf(local, local, blockSz, order); + Transform(); + buffLen_ = 0; + } + memset(&local[buffLen_], 0, padSz - buffLen_); + + ByteReverseIf(local, local, blockSz, order); + + memcpy(&local[padSz], order ? &preHiLen : &preLoLen, sizeof(preLoLen)); + memcpy(&local[padSz+4], order ? &preLoLen : &preHiLen, sizeof(preLoLen)); + + Transform(); + ByteReverseIf(digest_, digest_, digestSz, order); + memcpy(hash, digest_, digestSz); + + Init(); // reset state +} + + +#ifdef WORD64_AVAILABLE + +HASH64withTransform::HASH64withTransform(word32 digSz, word32 buffSz) +{ + assert(digSz <= MaxDigestSz); + assert(buffSz <= MaxBufferSz); +} + + +void HASH64withTransform::AddLength(word32 len) +{ + HashLengthType tmp = loLen_; + if ( (loLen_ += len) < tmp) + hiLen_++; // carry low to high + hiLen_ += SafeRightShift<8*sizeof(HashLengthType)>(len); +} + + +// Update digest with data of size len, do in blocks +void HASH64withTransform::Update(const byte* data, word32 len) +{ + // do block size increments + word32 blockSz = getBlockSize(); + byte* local = reinterpret_cast(buffer_); + + while (len) { + word32 add = min(len, blockSz - buffLen_); + memcpy(&local[buffLen_], data, add); + + buffLen_ += add; + data += add; + len -= add; + + if (buffLen_ == blockSz) { + ByteReverseIf(buffer_, buffer_, blockSz, getByteOrder()); + Transform(); + AddLength(blockSz); + buffLen_ = 0; + } + } +} + + +// Final process, place digest in hash +void HASH64withTransform::Final(byte* hash) +{ + word32 blockSz = getBlockSize(); + word32 digestSz = getDigestSize(); + word32 padSz = getPadSize(); + ByteOrder order = getByteOrder(); + + AddLength(buffLen_); // before adding pads + HashLengthType preLoLen = GetBitCountLo(); + HashLengthType preHiLen = GetBitCountHi(); + byte* local = reinterpret_cast(buffer_); + + local[buffLen_++] = 0x80; // add 1 + + // pad with zeros + if (buffLen_ > padSz) { + memset(&local[buffLen_], 0, blockSz - buffLen_); + buffLen_ += blockSz - buffLen_; + + ByteReverseIf(buffer_, buffer_, blockSz, order); + Transform(); + buffLen_ = 0; + } + memset(&local[buffLen_], 0, padSz - buffLen_); + + ByteReverseIf(buffer_, buffer_, padSz, order); + + buffer_[blockSz / sizeof(word64) - 2] = order ? preHiLen : preLoLen; + buffer_[blockSz / sizeof(word64) - 1] = order ? preLoLen : preHiLen; + + Transform(); + ByteReverseIf(digest_, digest_, digestSz, order); + memcpy(hash, digest_, digestSz); + + Init(); // reset state +} + +#endif // WORD64_AVAILABLE + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/integer.cpp b/externals/mysql/extlib/yassl/taocrypt/src/integer.cpp new file mode 100644 index 0000000..85733b8 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/integer.cpp @@ -0,0 +1,3964 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + + +/* based on Wei Dai's integer.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "integer.hpp" +#include "modarith.hpp" +#include "asn.hpp" + + + +#ifdef __DECCXX + #include // for asm overflow assembly +#endif + +#if defined(_M_X64) || defined(_M_IA64) + #include +#pragma intrinsic(_umul128) +#endif + + +#ifdef __GNUC__ + #include + #include +#endif + + +#ifdef SSE2_INTRINSICS_AVAILABLE + #ifdef __GNUC__ + #include + #ifdef TAOCRYPT_MEMALIGN_AVAILABLE + #include + #else + #include + #endif + #else + #include + #endif +#elif defined(_MSC_VER) && defined(_M_IX86) + #pragma message("You do not seem to have the Visual C++ Processor Pack ") + #pragma message("installed, so use of SSE2 intrinsics will be disabled.") +#elif defined(__GNUC__) && defined(__i386__) +/* #warning You do not have GCC 3.3 or later, or did not specify the -msse2 \ + compiler option. Use of SSE2 intrinsics will be disabled. +*/ +#endif + + +namespace TaoCrypt { + + +#ifdef SSE2_INTRINSICS_AVAILABLE + +template +CPP_TYPENAME AlignedAllocator::pointer AlignedAllocator::allocate( + size_type n, const void *) +{ + CheckSize(n); + if (n == 0) + return 0; + if (n >= 4) + { + void* p; + #ifdef TAOCRYPT_MM_MALLOC_AVAILABLE + p = _mm_malloc(sizeof(T)*n, 16); + #elif defined(TAOCRYPT_MEMALIGN_AVAILABLE) + p = memalign(16, sizeof(T)*n); + #elif defined(TAOCRYPT_MALLOC_ALIGNMENT_IS_16) + p = malloc(sizeof(T)*n); + #else + p = (byte *)malloc(sizeof(T)*n + 8); + // assume malloc alignment is at least 8 + #endif + + #ifdef TAOCRYPT_NO_ALIGNED_ALLOC + assert(m_pBlock == 0); + m_pBlock = p; + if (!IsAlignedOn(p, 16)) + { + assert(IsAlignedOn(p, 8)); + p = (byte *)p + 8; + } + #endif + + assert(IsAlignedOn(p, 16)); + return (T*)p; + } + return NEW_TC T[n]; +} + + +template +void AlignedAllocator::deallocate(void* p, size_type n) +{ + memset(p, 0, n*sizeof(T)); + if (n >= 4) + { + #ifdef TAOCRYPT_MM_MALLOC_AVAILABLE + _mm_free(p); + #elif defined(TAOCRYPT_NO_ALIGNED_ALLOC) + assert(m_pBlock == p || (byte*)m_pBlock+8 == p); + free(m_pBlock); + m_pBlock = 0; + #else + free(p); + #endif + } + else + tcArrayDelete((T *)p); +} + +#endif // SSE2 + + +// ******** start of integer needs + +// start 5.2.1 adds DWord and Word ******** + +// ******************************************************** + +class DWord { +public: +DWord() {} + +#ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + explicit DWord(word low) + { + whole_ = low; + } +#else + explicit DWord(word low) + { + halfs_.low = low; + halfs_.high = 0; + } +#endif + + DWord(word low, word high) + { + halfs_.low = low; + halfs_.high = high; + } + + static DWord Multiply(word a, word b) + { + DWord r; + + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + r.whole_ = (dword)a * b; + + #elif defined(_M_X64) || defined(_M_IA64) + r.halfs_.low = _umul128(a, b, &r.halfs_.high); + + #elif defined(__alpha__) + r.halfs_.low = a*b; + #ifdef __GNUC__ + __asm__("umulh %1,%2,%0" : "=r" (r.halfs_.high) + : "r" (a), "r" (b)); + #elif defined(__DECCXX) + r.halfs_.high = asm("umulh %a0, %a1, %v0", a, b); + #else + #error unknown alpha compiler + #endif + + #elif defined(__ia64__) + r.halfs_.low = a*b; + __asm__("xmpy.hu %0=%1,%2" : "=f" (r.halfs_.high) + : "f" (a), "f" (b)); + + #elif defined(_ARCH_PPC64) + r.halfs_.low = a*b; + __asm__("mulhdu %0,%1,%2" : "=r" (r.halfs_.high) + : "r" (a), "r" (b) : "cc"); + + #elif defined(__x86_64__) + __asm__("mulq %3" : "=d" (r.halfs_.high), "=a" (r.halfs_.low) : + "a" (a), "rm" (b) : "cc"); + + #elif defined(__mips64) + __asm__("dmultu %2,%3" : "=h" (r.halfs_.high), "=l" (r.halfs_.low) + : "r" (a), "r" (b)); + + #elif defined(_M_IX86) + // for testing + word64 t = (word64)a * b; + r.halfs_.high = ((word32 *)(&t))[1]; + r.halfs_.low = (word32)t; + #else + #error can not implement DWord + #endif + + return r; + } + + static DWord MultiplyAndAdd(word a, word b, word c) + { + DWord r = Multiply(a, b); + return r += c; + } + + DWord & operator+=(word a) + { + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + whole_ = whole_ + a; + #else + halfs_.low += a; + halfs_.high += (halfs_.low < a); + #endif + return *this; + } + + DWord operator+(word a) + { + DWord r; + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + r.whole_ = whole_ + a; + #else + r.halfs_.low = halfs_.low + a; + r.halfs_.high = halfs_.high + (r.halfs_.low < a); + #endif + return r; + } + + DWord operator-(DWord a) + { + DWord r; + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + r.whole_ = whole_ - a.whole_; + #else + r.halfs_.low = halfs_.low - a.halfs_.low; + r.halfs_.high = halfs_.high - a.halfs_.high - + (r.halfs_.low > halfs_.low); + #endif + return r; + } + + DWord operator-(word a) + { + DWord r; + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + r.whole_ = whole_ - a; + #else + r.halfs_.low = halfs_.low - a; + r.halfs_.high = halfs_.high - (r.halfs_.low > halfs_.low); + #endif + return r; + } + + // returns quotient, which must fit in a word + word operator/(word divisor); + + word operator%(word a); + + bool operator!() const + { + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + return !whole_; + #else + return !halfs_.high && !halfs_.low; + #endif + } + + word GetLowHalf() const {return halfs_.low;} + word GetHighHalf() const {return halfs_.high;} + word GetHighHalfAsBorrow() const {return 0-halfs_.high;} + +private: + union + { + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + dword whole_; + #endif + struct + { + #ifdef LITTLE_ENDIAN_ORDER + word low; + word high; + #else + word high; + word low; + #endif + } halfs_; + }; +}; + + +class Word { +public: + Word() {} + + Word(word value) + { + whole_ = value; + } + + Word(hword low, hword high) + { + whole_ = low | (word(high) << (WORD_BITS/2)); + } + + static Word Multiply(hword a, hword b) + { + Word r; + r.whole_ = (word)a * b; + return r; + } + + Word operator-(Word a) + { + Word r; + r.whole_ = whole_ - a.whole_; + return r; + } + + Word operator-(hword a) + { + Word r; + r.whole_ = whole_ - a; + return r; + } + + // returns quotient, which must fit in a word + hword operator/(hword divisor) + { + return hword(whole_ / divisor); + } + + bool operator!() const + { + return !whole_; + } + + word GetWhole() const {return whole_;} + hword GetLowHalf() const {return hword(whole_);} + hword GetHighHalf() const {return hword(whole_>>(WORD_BITS/2));} + hword GetHighHalfAsBorrow() const {return 0-hword(whole_>>(WORD_BITS/2));} + +private: + word whole_; +}; + + +// dummy is VC60 compiler bug workaround +// do a 3 word by 2 word divide, returns quotient and leaves remainder in A +template +S DivideThreeWordsByTwo(S* A, S B0, S B1, D* dummy_VC6_WorkAround = 0) +{ + // assert {A[2],A[1]} < {B1,B0}, so quotient can fit in a S + assert(A[2] < B1 || (A[2]==B1 && A[1] < B0)); + + // estimate the quotient: do a 2 S by 1 S divide + S Q; + if (S(B1+1) == 0) + Q = A[2]; + else + Q = D(A[1], A[2]) / S(B1+1); + + // now subtract Q*B from A + D p = D::Multiply(B0, Q); + D u = (D) A[0] - p.GetLowHalf(); + A[0] = u.GetLowHalf(); + u = (D) A[1] - p.GetHighHalf() - u.GetHighHalfAsBorrow() - + D::Multiply(B1, Q); + A[1] = u.GetLowHalf(); + A[2] += u.GetHighHalf(); + + // Q <= actual quotient, so fix it + while (A[2] || A[1] > B1 || (A[1]==B1 && A[0]>=B0)) + { + u = (D) A[0] - B0; + A[0] = u.GetLowHalf(); + u = (D) A[1] - B1 - u.GetHighHalfAsBorrow(); + A[1] = u.GetLowHalf(); + A[2] += u.GetHighHalf(); + Q++; + assert(Q); // shouldn't overflow + } + + return Q; +} + + +// do a 4 word by 2 word divide, returns 2 word quotient in Q0 and Q1 +template +inline D DivideFourWordsByTwo(S *T, const D &Al, const D &Ah, const D &B) +{ + if (!B) // if divisor is 0, we assume divisor==2**(2*WORD_BITS) + return D(Ah.GetLowHalf(), Ah.GetHighHalf()); + else + { + S Q[2]; + T[0] = Al.GetLowHalf(); + T[1] = Al.GetHighHalf(); + T[2] = Ah.GetLowHalf(); + T[3] = Ah.GetHighHalf(); + Q[1] = DivideThreeWordsByTwo(T+1, B.GetLowHalf(), + B.GetHighHalf()); + Q[0] = DivideThreeWordsByTwo(T, B.GetLowHalf(), B.GetHighHalf()); + return D(Q[0], Q[1]); + } +} + + +// returns quotient, which must fit in a word +inline word DWord::operator/(word a) +{ + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + return word(whole_ / a); + #else + hword r[4]; + return DivideFourWordsByTwo(r, halfs_.low, + halfs_.high, a).GetWhole(); + #endif +} + +inline word DWord::operator%(word a) +{ + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + return word(whole_ % a); + #else + if (a < (word(1) << (WORD_BITS/2))) + { + hword h = hword(a); + word r = halfs_.high % h; + r = ((halfs_.low >> (WORD_BITS/2)) + (r << (WORD_BITS/2))) % h; + return hword((hword(halfs_.low) + (r << (WORD_BITS/2))) % h); + } + else + { + hword r[4]; + DivideFourWordsByTwo(r, halfs_.low, halfs_.high, a); + return Word(r[0], r[1]).GetWhole(); + } + #endif +} + + + +// end 5.2.1 DWord and Word adds + + + + + +static const unsigned int RoundupSizeTable[] = {2, 2, 2, 4, 4, 8, 8, 8, 8}; + +static inline unsigned int RoundupSize(unsigned int n) +{ + if (n<=8) + return RoundupSizeTable[n]; + else if (n<=16) + return 16; + else if (n<=32) + return 32; + else if (n<=64) + return 64; + else return 1U << BitPrecision(n-1); +} + + +static int Compare(const word *A, const word *B, unsigned int N) +{ + while (N--) + if (A[N] > B[N]) + return 1; + else if (A[N] < B[N]) + return -1; + + return 0; +} + +static word Increment(word *A, unsigned int N, word B=1) +{ + assert(N); + word t = A[0]; + A[0] = t+B; + if (A[0] >= t) + return 0; + for (unsigned i=1; i= A0) + if (B0 >= B1) + { + s = 0; + d = (dword)(A1-A0)*(B0-B1); + } + else + { + s = (A1-A0); + d = (dword)s*(word)(B0-B1); + } + else + if (B0 > B1) + { + s = (B0-B1); + d = (word)(A1-A0)*(dword)s; + } + else + { + s = 0; + d = (dword)(A0-A1)*(B1-B0); + } +*/ + // this segment is the branchless equivalent of above + word D[4] = {A[1]-A[0], A[0]-A[1], B[0]-B[1], B[1]-B[0]}; + unsigned int ai = A[1] < A[0]; + unsigned int bi = B[0] < B[1]; + unsigned int di = ai & bi; + DWord d = DWord::Multiply(D[di], D[di+2]); + D[1] = D[3] = 0; + unsigned int si = ai + !bi; + word s = D[si]; + + DWord A0B0 = DWord::Multiply(A[0], B[0]); + C[0] = A0B0.GetLowHalf(); + + DWord A1B1 = DWord::Multiply(A[1], B[1]); + DWord t = (DWord) A0B0.GetHighHalf() + A0B0.GetLowHalf() + d.GetLowHalf() + + A1B1.GetLowHalf(); + C[1] = t.GetLowHalf(); + + t = A1B1 + t.GetHighHalf() + A0B0.GetHighHalf() + d.GetHighHalf() + + A1B1.GetHighHalf() - s; + C[2] = t.GetLowHalf(); + C[3] = t.GetHighHalf(); +} + +void Portable::Multiply2Bottom(word *C, const word *A, const word *B) +{ + DWord t = DWord::Multiply(A[0], B[0]); + C[0] = t.GetLowHalf(); + C[1] = t.GetHighHalf() + A[0]*B[1] + A[1]*B[0]; +} + +word Portable::Multiply2Add(word *C, const word *A, const word *B) +{ + word D[4] = {A[1]-A[0], A[0]-A[1], B[0]-B[1], B[1]-B[0]}; + unsigned int ai = A[1] < A[0]; + unsigned int bi = B[0] < B[1]; + unsigned int di = ai & bi; + DWord d = DWord::Multiply(D[di], D[di+2]); + D[1] = D[3] = 0; + unsigned int si = ai + !bi; + word s = D[si]; + + DWord A0B0 = DWord::Multiply(A[0], B[0]); + DWord t = A0B0 + C[0]; + C[0] = t.GetLowHalf(); + + DWord A1B1 = DWord::Multiply(A[1], B[1]); + t = (DWord) t.GetHighHalf() + A0B0.GetLowHalf() + d.GetLowHalf() + + A1B1.GetLowHalf() + C[1]; + C[1] = t.GetLowHalf(); + + t = (DWord) t.GetHighHalf() + A1B1.GetLowHalf() + A0B0.GetHighHalf() + + d.GetHighHalf() + A1B1.GetHighHalf() - s + C[2]; + C[2] = t.GetLowHalf(); + + t = (DWord) t.GetHighHalf() + A1B1.GetHighHalf() + C[3]; + C[3] = t.GetLowHalf(); + return t.GetHighHalf(); +} + + +#define MulAcc(x, y) \ + p = DWord::MultiplyAndAdd(A[x], B[y], c); \ + c = p.GetLowHalf(); \ + p = (DWord) d + p.GetHighHalf(); \ + d = p.GetLowHalf(); \ + e += p.GetHighHalf(); + +#define SaveMulAcc(s, x, y) \ + R[s] = c; \ + p = DWord::MultiplyAndAdd(A[x], B[y], d); \ + c = p.GetLowHalf(); \ + p = (DWord) e + p.GetHighHalf(); \ + d = p.GetLowHalf(); \ + e = p.GetHighHalf(); + +#define SquAcc(x, y) \ + q = DWord::Multiply(A[x], A[y]); \ + p = q + c; \ + c = p.GetLowHalf(); \ + p = (DWord) d + p.GetHighHalf(); \ + d = p.GetLowHalf(); \ + e += p.GetHighHalf(); \ + p = q + c; \ + c = p.GetLowHalf(); \ + p = (DWord) d + p.GetHighHalf(); \ + d = p.GetLowHalf(); \ + e += p.GetHighHalf(); + +#define SaveSquAcc(s, x, y) \ + R[s] = c; \ + q = DWord::Multiply(A[x], A[y]); \ + p = q + d; \ + c = p.GetLowHalf(); \ + p = (DWord) e + p.GetHighHalf(); \ + d = p.GetLowHalf(); \ + e = p.GetHighHalf(); \ + p = q + c; \ + c = p.GetLowHalf(); \ + p = (DWord) d + p.GetHighHalf(); \ + d = p.GetLowHalf(); \ + e += p.GetHighHalf(); + + +void Portable::Multiply4(word *R, const word *A, const word *B) +{ + DWord p; + word c, d, e; + + p = DWord::Multiply(A[0], B[0]); + R[0] = p.GetLowHalf(); + c = p.GetHighHalf(); + d = e = 0; + + MulAcc(0, 1); + MulAcc(1, 0); + + SaveMulAcc(1, 2, 0); + MulAcc(1, 1); + MulAcc(0, 2); + + SaveMulAcc(2, 0, 3); + MulAcc(1, 2); + MulAcc(2, 1); + MulAcc(3, 0); + + SaveMulAcc(3, 3, 1); + MulAcc(2, 2); + MulAcc(1, 3); + + SaveMulAcc(4, 2, 3); + MulAcc(3, 2); + + R[5] = c; + p = DWord::MultiplyAndAdd(A[3], B[3], d); + R[6] = p.GetLowHalf(); + R[7] = e + p.GetHighHalf(); +} + +void Portable::Square2(word *R, const word *A) +{ + DWord p, q; + word c, d, e; + + p = DWord::Multiply(A[0], A[0]); + R[0] = p.GetLowHalf(); + c = p.GetHighHalf(); + d = e = 0; + + SquAcc(0, 1); + + R[1] = c; + p = DWord::MultiplyAndAdd(A[1], A[1], d); + R[2] = p.GetLowHalf(); + R[3] = e + p.GetHighHalf(); +} + +void Portable::Square4(word *R, const word *A) +{ +#ifdef _MSC_VER + // VC60 workaround: MSVC 6.0 has an optimization bug that makes + // (dword)A*B where either A or B has been cast to a dword before + // very expensive. Revisit this function when this + // bug is fixed. + Multiply4(R, A, A); +#else + const word *B = A; + DWord p, q; + word c, d, e; + + p = DWord::Multiply(A[0], A[0]); + R[0] = p.GetLowHalf(); + c = p.GetHighHalf(); + d = e = 0; + + SquAcc(0, 1); + + SaveSquAcc(1, 2, 0); + MulAcc(1, 1); + + SaveSquAcc(2, 0, 3); + SquAcc(1, 2); + + SaveSquAcc(3, 3, 1); + MulAcc(2, 2); + + SaveSquAcc(4, 2, 3); + + R[5] = c; + p = DWord::MultiplyAndAdd(A[3], A[3], d); + R[6] = p.GetLowHalf(); + R[7] = e + p.GetHighHalf(); +#endif +} + +void Portable::Multiply8(word *R, const word *A, const word *B) +{ + DWord p; + word c, d, e; + + p = DWord::Multiply(A[0], B[0]); + R[0] = p.GetLowHalf(); + c = p.GetHighHalf(); + d = e = 0; + + MulAcc(0, 1); + MulAcc(1, 0); + + SaveMulAcc(1, 2, 0); + MulAcc(1, 1); + MulAcc(0, 2); + + SaveMulAcc(2, 0, 3); + MulAcc(1, 2); + MulAcc(2, 1); + MulAcc(3, 0); + + SaveMulAcc(3, 0, 4); + MulAcc(1, 3); + MulAcc(2, 2); + MulAcc(3, 1); + MulAcc(4, 0); + + SaveMulAcc(4, 0, 5); + MulAcc(1, 4); + MulAcc(2, 3); + MulAcc(3, 2); + MulAcc(4, 1); + MulAcc(5, 0); + + SaveMulAcc(5, 0, 6); + MulAcc(1, 5); + MulAcc(2, 4); + MulAcc(3, 3); + MulAcc(4, 2); + MulAcc(5, 1); + MulAcc(6, 0); + + SaveMulAcc(6, 0, 7); + MulAcc(1, 6); + MulAcc(2, 5); + MulAcc(3, 4); + MulAcc(4, 3); + MulAcc(5, 2); + MulAcc(6, 1); + MulAcc(7, 0); + + SaveMulAcc(7, 1, 7); + MulAcc(2, 6); + MulAcc(3, 5); + MulAcc(4, 4); + MulAcc(5, 3); + MulAcc(6, 2); + MulAcc(7, 1); + + SaveMulAcc(8, 2, 7); + MulAcc(3, 6); + MulAcc(4, 5); + MulAcc(5, 4); + MulAcc(6, 3); + MulAcc(7, 2); + + SaveMulAcc(9, 3, 7); + MulAcc(4, 6); + MulAcc(5, 5); + MulAcc(6, 4); + MulAcc(7, 3); + + SaveMulAcc(10, 4, 7); + MulAcc(5, 6); + MulAcc(6, 5); + MulAcc(7, 4); + + SaveMulAcc(11, 5, 7); + MulAcc(6, 6); + MulAcc(7, 5); + + SaveMulAcc(12, 6, 7); + MulAcc(7, 6); + + R[13] = c; + p = DWord::MultiplyAndAdd(A[7], B[7], d); + R[14] = p.GetLowHalf(); + R[15] = e + p.GetHighHalf(); +} + +void Portable::Multiply4Bottom(word *R, const word *A, const word *B) +{ + DWord p; + word c, d, e; + + p = DWord::Multiply(A[0], B[0]); + R[0] = p.GetLowHalf(); + c = p.GetHighHalf(); + d = e = 0; + + MulAcc(0, 1); + MulAcc(1, 0); + + SaveMulAcc(1, 2, 0); + MulAcc(1, 1); + MulAcc(0, 2); + + R[2] = c; + R[3] = d + A[0] * B[3] + A[1] * B[2] + A[2] * B[1] + A[3] * B[0]; +} + +void Portable::Multiply8Bottom(word *R, const word *A, const word *B) +{ + DWord p; + word c, d, e; + + p = DWord::Multiply(A[0], B[0]); + R[0] = p.GetLowHalf(); + c = p.GetHighHalf(); + d = e = 0; + + MulAcc(0, 1); + MulAcc(1, 0); + + SaveMulAcc(1, 2, 0); + MulAcc(1, 1); + MulAcc(0, 2); + + SaveMulAcc(2, 0, 3); + MulAcc(1, 2); + MulAcc(2, 1); + MulAcc(3, 0); + + SaveMulAcc(3, 0, 4); + MulAcc(1, 3); + MulAcc(2, 2); + MulAcc(3, 1); + MulAcc(4, 0); + + SaveMulAcc(4, 0, 5); + MulAcc(1, 4); + MulAcc(2, 3); + MulAcc(3, 2); + MulAcc(4, 1); + MulAcc(5, 0); + + SaveMulAcc(5, 0, 6); + MulAcc(1, 5); + MulAcc(2, 4); + MulAcc(3, 3); + MulAcc(4, 2); + MulAcc(5, 1); + MulAcc(6, 0); + + R[6] = c; + R[7] = d + A[0] * B[7] + A[1] * B[6] + A[2] * B[5] + A[3] * B[4] + + A[4] * B[3] + A[5] * B[2] + A[6] * B[1] + A[7] * B[0]; +} + + +#undef MulAcc +#undef SaveMulAcc +#undef SquAcc +#undef SaveSquAcc + +// optimized + +#ifdef TAOCRYPT_X86ASM_AVAILABLE + +// ************** x86 feature detection *************** + + +#ifdef SSE2_INTRINSICS_AVAILABLE + +#ifndef _MSC_VER + static jmp_buf s_env; + static void SigIllHandler(int) + { + longjmp(s_env, 1); + } +#endif + +static bool HasSSE2() +{ + if (!IsPentium()) + return false; + + word32 cpuid[4]; + CpuId(1, cpuid); + if ((cpuid[3] & (1 << 26)) == 0) + return false; + +#ifdef _MSC_VER + __try + { + __asm xorpd xmm0, xmm0 // executing SSE2 instruction + } + __except (1) + { + return false; + } + return true; +#else + typedef void (*SigHandler)(int); + + SigHandler oldHandler = signal(SIGILL, SigIllHandler); + if (oldHandler == SIG_ERR) + return false; + + bool result = true; + if (setjmp(s_env)) + result = false; + else + __asm __volatile ("xorpd %xmm0, %xmm0"); + + signal(SIGILL, oldHandler); + return result; +#endif +} +#endif // SSE2_INTRINSICS_AVAILABLE + + +static bool IsP4() +{ + if (!IsPentium()) + return false; + + word32 cpuid[4]; + + CpuId(1, cpuid); + return ((cpuid[0] >> 8) & 0xf) == 0xf; +} + +// ************** Pentium/P4 optimizations *************** + +class PentiumOptimized : public Portable +{ +public: + static word TAOCRYPT_CDECL Add(word *C, const word *A, const word *B, + unsigned int N); + static word TAOCRYPT_CDECL Subtract(word *C, const word *A, const word *B, + unsigned int N); + static void TAOCRYPT_CDECL Multiply4(word *C, const word *A, + const word *B); + static void TAOCRYPT_CDECL Multiply8(word *C, const word *A, + const word *B); + static void TAOCRYPT_CDECL Multiply8Bottom(word *C, const word *A, + const word *B); +}; + +class P4Optimized +{ +public: + static word TAOCRYPT_CDECL Add(word *C, const word *A, const word *B, + unsigned int N); + static word TAOCRYPT_CDECL Subtract(word *C, const word *A, const word *B, + unsigned int N); +#ifdef SSE2_INTRINSICS_AVAILABLE + static void TAOCRYPT_CDECL Multiply4(word *C, const word *A, + const word *B); + static void TAOCRYPT_CDECL Multiply8(word *C, const word *A, + const word *B); + static void TAOCRYPT_CDECL Multiply8Bottom(word *C, const word *A, + const word *B); +#endif +}; + +typedef word (TAOCRYPT_CDECL * PAddSub)(word *C, const word *A, const word *B, + unsigned int N); +typedef void (TAOCRYPT_CDECL * PMul)(word *C, const word *A, const word *B); + +static PAddSub s_pAdd, s_pSub; +#ifdef SSE2_INTRINSICS_AVAILABLE +static PMul s_pMul4, s_pMul8, s_pMul8B; +#endif + +static void SetPentiumFunctionPointers() +{ + if (!IsPentium()) + { + s_pAdd = &Portable::Add; + s_pSub = &Portable::Subtract; + } + else if (IsP4()) + { + s_pAdd = &P4Optimized::Add; + s_pSub = &P4Optimized::Subtract; + } + else + { + s_pAdd = &PentiumOptimized::Add; + s_pSub = &PentiumOptimized::Subtract; + } + +#ifdef SSE2_INTRINSICS_AVAILABLE + if (!IsPentium()) + { + s_pMul4 = &Portable::Multiply4; + s_pMul8 = &Portable::Multiply8; + s_pMul8B = &Portable::Multiply8Bottom; + } + else if (HasSSE2()) + { + s_pMul4 = &P4Optimized::Multiply4; + s_pMul8 = &P4Optimized::Multiply8; + s_pMul8B = &P4Optimized::Multiply8Bottom; + } + else + { + s_pMul4 = &PentiumOptimized::Multiply4; + s_pMul8 = &PentiumOptimized::Multiply8; + s_pMul8B = &PentiumOptimized::Multiply8Bottom; + } +#endif +} + +static const char s_RunAtStartupSetPentiumFunctionPointers = + (SetPentiumFunctionPointers(), 0); + + +class LowLevel : public PentiumOptimized +{ +public: + inline static word Add(word *C, const word *A, const word *B, + unsigned int N) + {return s_pAdd(C, A, B, N);} + inline static word Subtract(word *C, const word *A, const word *B, + unsigned int N) + {return s_pSub(C, A, B, N);} + inline static void Square4(word *R, const word *A) + {Multiply4(R, A, A);} +#ifdef SSE2_INTRINSICS_AVAILABLE + inline static void Multiply4(word *C, const word *A, const word *B) + {s_pMul4(C, A, B);} + inline static void Multiply8(word *C, const word *A, const word *B) + {s_pMul8(C, A, B);} + inline static void Multiply8Bottom(word *C, const word *A, const word *B) + {s_pMul8B(C, A, B);} +#endif +}; + +// use some tricks to share assembly code between MSVC and GCC +#ifdef _MSC_VER + #define TAOCRYPT_NAKED __declspec(naked) + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + #define AddPrologue \ + __asm push ebp \ + __asm push ebx \ + __asm push esi \ + __asm push edi \ + __asm mov ecx, [esp+20] \ + __asm mov edx, [esp+24] \ + __asm mov ebx, [esp+28] \ + __asm mov esi, [esp+32] + #define AddEpilogue \ + __asm pop edi \ + __asm pop esi \ + __asm pop ebx \ + __asm pop ebp \ + __asm ret + #define MulPrologue \ + __asm push ebp \ + __asm push ebx \ + __asm push esi \ + __asm push edi \ + __asm mov ecx, [esp+28] \ + __asm mov esi, [esp+24] \ + __asm push [esp+20] + #define MulEpilogue \ + __asm add esp, 4 \ + __asm pop edi \ + __asm pop esi \ + __asm pop ebx \ + __asm pop ebp \ + __asm ret +#else + #define TAOCRYPT_NAKED + #define AS1(x) #x ";" + #define AS2(x, y) #x ", " #y ";" + #define AddPrologue \ + __asm__ __volatile__ \ + ( \ + "push %%ebx;" /* save this manually, in case of -fPIC */ \ + "mov %2, %%ebx;" \ + ".intel_syntax noprefix;" \ + "push ebp;" + #define AddEpilogue \ + "pop ebp;" \ + ".att_syntax prefix;" \ + "pop %%ebx;" \ + : \ + : "c" (C), "d" (A), "m" (B), "S" (N) \ + : "%edi", "memory", "cc" \ + ); + #define MulPrologue \ + __asm__ __volatile__ \ + ( \ + "push %%ebx;" /* save this manually, in case of -fPIC */ \ + "push %%ebp;" \ + "push %0;" \ + ".intel_syntax noprefix;" + #define MulEpilogue \ + "add esp, 4;" \ + "pop ebp;" \ + "pop ebx;" \ + ".att_syntax prefix;" \ + : \ + : "rm" (Z), "S" (X), "c" (Y) \ + : "%eax", "%edx", "%edi", "memory", "cc" \ + ); +#endif + +TAOCRYPT_NAKED word PentiumOptimized::Add(word *C, const word *A, + const word *B, unsigned int N) +{ + AddPrologue + + // now: ebx = B, ecx = C, edx = A, esi = N + AS2( sub ecx, edx) // hold the distance between C & A so we + // can add this to A to get C + AS2( xor eax, eax) // clear eax + + AS2( sub eax, esi) // eax is a negative index from end of B + AS2( lea ebx, [ebx+4*esi]) // ebx is end of B + + AS2( sar eax, 1) // unit of eax is now dwords; this also + // clears the carry flag + AS1( jz loopendAdd) // if no dwords then nothing to do + + AS1(loopstartAdd:) + AS2( mov esi,[edx]) // load lower word of A + AS2( mov ebp,[edx+4]) // load higher word of A + + AS2( mov edi,[ebx+8*eax]) // load lower word of B + AS2( lea edx,[edx+8]) // advance A and C + + AS2( adc esi,edi) // add lower words + AS2( mov edi,[ebx+8*eax+4]) // load higher word of B + + AS2( adc ebp,edi) // add higher words + AS1( inc eax) // advance B + + AS2( mov [edx+ecx-8],esi) // store lower word result + AS2( mov [edx+ecx-4],ebp) // store higher word result + + AS1( jnz loopstartAdd) // loop until eax overflows and becomes zero + + AS1(loopendAdd:) + AS2( adc eax, 0) // store carry into eax (return result register) + + AddEpilogue +} + +TAOCRYPT_NAKED word PentiumOptimized::Subtract(word *C, const word *A, + const word *B, unsigned int N) +{ + AddPrologue + + // now: ebx = B, ecx = C, edx = A, esi = N + AS2( sub ecx, edx) // hold the distance between C & A so we + // can add this to A to get C + AS2( xor eax, eax) // clear eax + + AS2( sub eax, esi) // eax is a negative index from end of B + AS2( lea ebx, [ebx+4*esi]) // ebx is end of B + + AS2( sar eax, 1) // unit of eax is now dwords; this also + // clears the carry flag + AS1( jz loopendSub) // if no dwords then nothing to do + + AS1(loopstartSub:) + AS2( mov esi,[edx]) // load lower word of A + AS2( mov ebp,[edx+4]) // load higher word of A + + AS2( mov edi,[ebx+8*eax]) // load lower word of B + AS2( lea edx,[edx+8]) // advance A and C + + AS2( sbb esi,edi) // subtract lower words + AS2( mov edi,[ebx+8*eax+4]) // load higher word of B + + AS2( sbb ebp,edi) // subtract higher words + AS1( inc eax) // advance B + + AS2( mov [edx+ecx-8],esi) // store lower word result + AS2( mov [edx+ecx-4],ebp) // store higher word result + + AS1( jnz loopstartSub) // loop until eax overflows and becomes zero + + AS1(loopendSub:) + AS2( adc eax, 0) // store carry into eax (return result register) + + AddEpilogue +} + +// On Pentium 4, the adc and sbb instructions are very expensive, so avoid them. + +TAOCRYPT_NAKED word P4Optimized::Add(word *C, const word *A, const word *B, + unsigned int N) +{ + AddPrologue + + // now: ebx = B, ecx = C, edx = A, esi = N + AS2( xor eax, eax) + AS1( neg esi) + AS1( jz loopendAddP4) // if no dwords then nothing to do + + AS2( mov edi, [edx]) + AS2( mov ebp, [ebx]) + AS1( jmp carry1AddP4) + + AS1(loopstartAddP4:) + AS2( mov edi, [edx+8]) + AS2( add ecx, 8) + AS2( add edx, 8) + AS2( mov ebp, [ebx]) + AS2( add edi, eax) + AS1( jc carry1AddP4) + AS2( xor eax, eax) + + AS1(carry1AddP4:) + AS2( add edi, ebp) + AS2( mov ebp, 1) + AS2( mov [ecx], edi) + AS2( mov edi, [edx+4]) + AS2( cmovc eax, ebp) + AS2( mov ebp, [ebx+4]) + AS2( add ebx, 8) + AS2( add edi, eax) + AS1( jc carry2AddP4) + AS2( xor eax, eax) + + AS1(carry2AddP4:) + AS2( add edi, ebp) + AS2( mov ebp, 1) + AS2( cmovc eax, ebp) + AS2( mov [ecx+4], edi) + AS2( add esi, 2) + AS1( jnz loopstartAddP4) + + AS1(loopendAddP4:) + + AddEpilogue +} + +TAOCRYPT_NAKED word P4Optimized::Subtract(word *C, const word *A, + const word *B, unsigned int N) +{ + AddPrologue + + // now: ebx = B, ecx = C, edx = A, esi = N + AS2( xor eax, eax) + AS1( neg esi) + AS1( jz loopendSubP4) // if no dwords then nothing to do + + AS2( mov edi, [edx]) + AS2( mov ebp, [ebx]) + AS1( jmp carry1SubP4) + + AS1(loopstartSubP4:) + AS2( mov edi, [edx+8]) + AS2( add edx, 8) + AS2( add ecx, 8) + AS2( mov ebp, [ebx]) + AS2( sub edi, eax) + AS1( jc carry1SubP4) + AS2( xor eax, eax) + + AS1(carry1SubP4:) + AS2( sub edi, ebp) + AS2( mov ebp, 1) + AS2( mov [ecx], edi) + AS2( mov edi, [edx+4]) + AS2( cmovc eax, ebp) + AS2( mov ebp, [ebx+4]) + AS2( add ebx, 8) + AS2( sub edi, eax) + AS1( jc carry2SubP4) + AS2( xor eax, eax) + + AS1(carry2SubP4:) + AS2( sub edi, ebp) + AS2( mov ebp, 1) + AS2( cmovc eax, ebp) + AS2( mov [ecx+4], edi) + AS2( add esi, 2) + AS1( jnz loopstartSubP4) + + AS1(loopendSubP4:) + + AddEpilogue +} + +// multiply assembly code originally contributed by Leonard Janke + +#define MulStartup \ + AS2(xor ebp, ebp) \ + AS2(xor edi, edi) \ + AS2(xor ebx, ebx) + +#define MulShiftCarry \ + AS2(mov ebp, edx) \ + AS2(mov edi, ebx) \ + AS2(xor ebx, ebx) + +#define MulAccumulateBottom(i,j) \ + AS2(mov eax, [ecx+4*j]) \ + AS2(imul eax, dword ptr [esi+4*i]) \ + AS2(add ebp, eax) + +#define MulAccumulate(i,j) \ + AS2(mov eax, [ecx+4*j]) \ + AS1(mul dword ptr [esi+4*i]) \ + AS2(add ebp, eax) \ + AS2(adc edi, edx) \ + AS2(adc bl, bh) + +#define MulStoreDigit(i) \ + AS2(mov edx, edi) \ + AS2(mov edi, [esp]) \ + AS2(mov [edi+4*i], ebp) + +#define MulLastDiagonal(digits) \ + AS2(mov eax, [ecx+4*(digits-1)]) \ + AS1(mul dword ptr [esi+4*(digits-1)]) \ + AS2(add ebp, eax) \ + AS2(adc edx, edi) \ + AS2(mov edi, [esp]) \ + AS2(mov [edi+4*(2*digits-2)], ebp) \ + AS2(mov [edi+4*(2*digits-1)], edx) + +TAOCRYPT_NAKED void PentiumOptimized::Multiply4(word* Z, const word* X, + const word* Y) +{ + MulPrologue + // now: [esp] = Z, esi = X, ecx = Y + MulStartup + MulAccumulate(0,0) + MulStoreDigit(0) + MulShiftCarry + + MulAccumulate(1,0) + MulAccumulate(0,1) + MulStoreDigit(1) + MulShiftCarry + + MulAccumulate(2,0) + MulAccumulate(1,1) + MulAccumulate(0,2) + MulStoreDigit(2) + MulShiftCarry + + MulAccumulate(3,0) + MulAccumulate(2,1) + MulAccumulate(1,2) + MulAccumulate(0,3) + MulStoreDigit(3) + MulShiftCarry + + MulAccumulate(3,1) + MulAccumulate(2,2) + MulAccumulate(1,3) + MulStoreDigit(4) + MulShiftCarry + + MulAccumulate(3,2) + MulAccumulate(2,3) + MulStoreDigit(5) + MulShiftCarry + + MulLastDiagonal(4) + MulEpilogue +} + +TAOCRYPT_NAKED void PentiumOptimized::Multiply8(word* Z, const word* X, + const word* Y) +{ + MulPrologue + // now: [esp] = Z, esi = X, ecx = Y + MulStartup + MulAccumulate(0,0) + MulStoreDigit(0) + MulShiftCarry + + MulAccumulate(1,0) + MulAccumulate(0,1) + MulStoreDigit(1) + MulShiftCarry + + MulAccumulate(2,0) + MulAccumulate(1,1) + MulAccumulate(0,2) + MulStoreDigit(2) + MulShiftCarry + + MulAccumulate(3,0) + MulAccumulate(2,1) + MulAccumulate(1,2) + MulAccumulate(0,3) + MulStoreDigit(3) + MulShiftCarry + + MulAccumulate(4,0) + MulAccumulate(3,1) + MulAccumulate(2,2) + MulAccumulate(1,3) + MulAccumulate(0,4) + MulStoreDigit(4) + MulShiftCarry + + MulAccumulate(5,0) + MulAccumulate(4,1) + MulAccumulate(3,2) + MulAccumulate(2,3) + MulAccumulate(1,4) + MulAccumulate(0,5) + MulStoreDigit(5) + MulShiftCarry + + MulAccumulate(6,0) + MulAccumulate(5,1) + MulAccumulate(4,2) + MulAccumulate(3,3) + MulAccumulate(2,4) + MulAccumulate(1,5) + MulAccumulate(0,6) + MulStoreDigit(6) + MulShiftCarry + + MulAccumulate(7,0) + MulAccumulate(6,1) + MulAccumulate(5,2) + MulAccumulate(4,3) + MulAccumulate(3,4) + MulAccumulate(2,5) + MulAccumulate(1,6) + MulAccumulate(0,7) + MulStoreDigit(7) + MulShiftCarry + + MulAccumulate(7,1) + MulAccumulate(6,2) + MulAccumulate(5,3) + MulAccumulate(4,4) + MulAccumulate(3,5) + MulAccumulate(2,6) + MulAccumulate(1,7) + MulStoreDigit(8) + MulShiftCarry + + MulAccumulate(7,2) + MulAccumulate(6,3) + MulAccumulate(5,4) + MulAccumulate(4,5) + MulAccumulate(3,6) + MulAccumulate(2,7) + MulStoreDigit(9) + MulShiftCarry + + MulAccumulate(7,3) + MulAccumulate(6,4) + MulAccumulate(5,5) + MulAccumulate(4,6) + MulAccumulate(3,7) + MulStoreDigit(10) + MulShiftCarry + + MulAccumulate(7,4) + MulAccumulate(6,5) + MulAccumulate(5,6) + MulAccumulate(4,7) + MulStoreDigit(11) + MulShiftCarry + + MulAccumulate(7,5) + MulAccumulate(6,6) + MulAccumulate(5,7) + MulStoreDigit(12) + MulShiftCarry + + MulAccumulate(7,6) + MulAccumulate(6,7) + MulStoreDigit(13) + MulShiftCarry + + MulLastDiagonal(8) + MulEpilogue +} + +TAOCRYPT_NAKED void PentiumOptimized::Multiply8Bottom(word* Z, const word* X, + const word* Y) +{ + MulPrologue + // now: [esp] = Z, esi = X, ecx = Y + MulStartup + MulAccumulate(0,0) + MulStoreDigit(0) + MulShiftCarry + + MulAccumulate(1,0) + MulAccumulate(0,1) + MulStoreDigit(1) + MulShiftCarry + + MulAccumulate(2,0) + MulAccumulate(1,1) + MulAccumulate(0,2) + MulStoreDigit(2) + MulShiftCarry + + MulAccumulate(3,0) + MulAccumulate(2,1) + MulAccumulate(1,2) + MulAccumulate(0,3) + MulStoreDigit(3) + MulShiftCarry + + MulAccumulate(4,0) + MulAccumulate(3,1) + MulAccumulate(2,2) + MulAccumulate(1,3) + MulAccumulate(0,4) + MulStoreDigit(4) + MulShiftCarry + + MulAccumulate(5,0) + MulAccumulate(4,1) + MulAccumulate(3,2) + MulAccumulate(2,3) + MulAccumulate(1,4) + MulAccumulate(0,5) + MulStoreDigit(5) + MulShiftCarry + + MulAccumulate(6,0) + MulAccumulate(5,1) + MulAccumulate(4,2) + MulAccumulate(3,3) + MulAccumulate(2,4) + MulAccumulate(1,5) + MulAccumulate(0,6) + MulStoreDigit(6) + MulShiftCarry + + MulAccumulateBottom(7,0) + MulAccumulateBottom(6,1) + MulAccumulateBottom(5,2) + MulAccumulateBottom(4,3) + MulAccumulateBottom(3,4) + MulAccumulateBottom(2,5) + MulAccumulateBottom(1,6) + MulAccumulateBottom(0,7) + MulStoreDigit(7) + MulEpilogue +} + +#undef AS1 +#undef AS2 + +#else // not x86 - no processor specific code at this layer + +typedef Portable LowLevel; + +#endif + +#ifdef SSE2_INTRINSICS_AVAILABLE + +#ifdef __GNUC__ +#define TAOCRYPT_FASTCALL +#else +#define TAOCRYPT_FASTCALL __fastcall +#endif + +static void TAOCRYPT_FASTCALL P4_Mul(__m128i *C, const __m128i *A, + const __m128i *B) +{ + __m128i a3210 = _mm_load_si128(A); + __m128i b3210 = _mm_load_si128(B); + + __m128i sum; + + __m128i z = _mm_setzero_si128(); + __m128i a2b2_a0b0 = _mm_mul_epu32(a3210, b3210); + C[0] = a2b2_a0b0; + + __m128i a3120 = _mm_shuffle_epi32(a3210, _MM_SHUFFLE(3, 1, 2, 0)); + __m128i b3021 = _mm_shuffle_epi32(b3210, _MM_SHUFFLE(3, 0, 2, 1)); + __m128i a1b0_a0b1 = _mm_mul_epu32(a3120, b3021); + __m128i a1b0 = _mm_unpackhi_epi32(a1b0_a0b1, z); + __m128i a0b1 = _mm_unpacklo_epi32(a1b0_a0b1, z); + C[1] = _mm_add_epi64(a1b0, a0b1); + + __m128i a31 = _mm_srli_epi64(a3210, 32); + __m128i b31 = _mm_srli_epi64(b3210, 32); + __m128i a3b3_a1b1 = _mm_mul_epu32(a31, b31); + C[6] = a3b3_a1b1; + + __m128i a1b1 = _mm_unpacklo_epi32(a3b3_a1b1, z); + __m128i b3012 = _mm_shuffle_epi32(b3210, _MM_SHUFFLE(3, 0, 1, 2)); + __m128i a2b0_a0b2 = _mm_mul_epu32(a3210, b3012); + __m128i a0b2 = _mm_unpacklo_epi32(a2b0_a0b2, z); + __m128i a2b0 = _mm_unpackhi_epi32(a2b0_a0b2, z); + sum = _mm_add_epi64(a1b1, a0b2); + C[2] = _mm_add_epi64(sum, a2b0); + + __m128i a2301 = _mm_shuffle_epi32(a3210, _MM_SHUFFLE(2, 3, 0, 1)); + __m128i b2103 = _mm_shuffle_epi32(b3210, _MM_SHUFFLE(2, 1, 0, 3)); + __m128i a3b0_a1b2 = _mm_mul_epu32(a2301, b3012); + __m128i a2b1_a0b3 = _mm_mul_epu32(a3210, b2103); + __m128i a3b0 = _mm_unpackhi_epi32(a3b0_a1b2, z); + __m128i a1b2 = _mm_unpacklo_epi32(a3b0_a1b2, z); + __m128i a2b1 = _mm_unpackhi_epi32(a2b1_a0b3, z); + __m128i a0b3 = _mm_unpacklo_epi32(a2b1_a0b3, z); + __m128i sum1 = _mm_add_epi64(a3b0, a1b2); + sum = _mm_add_epi64(a2b1, a0b3); + C[3] = _mm_add_epi64(sum, sum1); + + __m128i a3b1_a1b3 = _mm_mul_epu32(a2301, b2103); + __m128i a2b2 = _mm_unpackhi_epi32(a2b2_a0b0, z); + __m128i a3b1 = _mm_unpackhi_epi32(a3b1_a1b3, z); + __m128i a1b3 = _mm_unpacklo_epi32(a3b1_a1b3, z); + sum = _mm_add_epi64(a2b2, a3b1); + C[4] = _mm_add_epi64(sum, a1b3); + + __m128i a1302 = _mm_shuffle_epi32(a3210, _MM_SHUFFLE(1, 3, 0, 2)); + __m128i b1203 = _mm_shuffle_epi32(b3210, _MM_SHUFFLE(1, 2, 0, 3)); + __m128i a3b2_a2b3 = _mm_mul_epu32(a1302, b1203); + __m128i a3b2 = _mm_unpackhi_epi32(a3b2_a2b3, z); + __m128i a2b3 = _mm_unpacklo_epi32(a3b2_a2b3, z); + C[5] = _mm_add_epi64(a3b2, a2b3); +} + +void P4Optimized::Multiply4(word *C, const word *A, const word *B) +{ + __m128i temp[7]; + const word *w = (word *)temp; + const __m64 *mw = (__m64 *)w; + + P4_Mul(temp, (__m128i *)A, (__m128i *)B); + + C[0] = w[0]; + + __m64 s1, s2; + + __m64 w1 = _mm_cvtsi32_si64(w[1]); + __m64 w4 = mw[2]; + __m64 w6 = mw[3]; + __m64 w8 = mw[4]; + __m64 w10 = mw[5]; + __m64 w12 = mw[6]; + __m64 w14 = mw[7]; + __m64 w16 = mw[8]; + __m64 w18 = mw[9]; + __m64 w20 = mw[10]; + __m64 w22 = mw[11]; + __m64 w26 = _mm_cvtsi32_si64(w[26]); + + s1 = _mm_add_si64(w1, w4); + C[1] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w6, w8); + s1 = _mm_add_si64(s1, s2); + C[2] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w10, w12); + s1 = _mm_add_si64(s1, s2); + C[3] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w14, w16); + s1 = _mm_add_si64(s1, s2); + C[4] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w18, w20); + s1 = _mm_add_si64(s1, s2); + C[5] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w22, w26); + s1 = _mm_add_si64(s1, s2); + C[6] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + C[7] = _mm_cvtsi64_si32(s1) + w[27]; + _mm_empty(); +} + +void P4Optimized::Multiply8(word *C, const word *A, const word *B) +{ + __m128i temp[28]; + const word *w = (word *)temp; + const __m64 *mw = (__m64 *)w; + const word *x = (word *)temp+7*4; + const __m64 *mx = (__m64 *)x; + const word *y = (word *)temp+7*4*2; + const __m64 *my = (__m64 *)y; + const word *z = (word *)temp+7*4*3; + const __m64 *mz = (__m64 *)z; + + P4_Mul(temp, (__m128i *)A, (__m128i *)B); + + P4_Mul(temp+7, (__m128i *)A+1, (__m128i *)B); + + P4_Mul(temp+14, (__m128i *)A, (__m128i *)B+1); + + P4_Mul(temp+21, (__m128i *)A+1, (__m128i *)B+1); + + C[0] = w[0]; + + __m64 s1, s2, s3, s4; + + __m64 w1 = _mm_cvtsi32_si64(w[1]); + __m64 w4 = mw[2]; + __m64 w6 = mw[3]; + __m64 w8 = mw[4]; + __m64 w10 = mw[5]; + __m64 w12 = mw[6]; + __m64 w14 = mw[7]; + __m64 w16 = mw[8]; + __m64 w18 = mw[9]; + __m64 w20 = mw[10]; + __m64 w22 = mw[11]; + __m64 w26 = _mm_cvtsi32_si64(w[26]); + __m64 w27 = _mm_cvtsi32_si64(w[27]); + + __m64 x0 = _mm_cvtsi32_si64(x[0]); + __m64 x1 = _mm_cvtsi32_si64(x[1]); + __m64 x4 = mx[2]; + __m64 x6 = mx[3]; + __m64 x8 = mx[4]; + __m64 x10 = mx[5]; + __m64 x12 = mx[6]; + __m64 x14 = mx[7]; + __m64 x16 = mx[8]; + __m64 x18 = mx[9]; + __m64 x20 = mx[10]; + __m64 x22 = mx[11]; + __m64 x26 = _mm_cvtsi32_si64(x[26]); + __m64 x27 = _mm_cvtsi32_si64(x[27]); + + __m64 y0 = _mm_cvtsi32_si64(y[0]); + __m64 y1 = _mm_cvtsi32_si64(y[1]); + __m64 y4 = my[2]; + __m64 y6 = my[3]; + __m64 y8 = my[4]; + __m64 y10 = my[5]; + __m64 y12 = my[6]; + __m64 y14 = my[7]; + __m64 y16 = my[8]; + __m64 y18 = my[9]; + __m64 y20 = my[10]; + __m64 y22 = my[11]; + __m64 y26 = _mm_cvtsi32_si64(y[26]); + __m64 y27 = _mm_cvtsi32_si64(y[27]); + + __m64 z0 = _mm_cvtsi32_si64(z[0]); + __m64 z1 = _mm_cvtsi32_si64(z[1]); + __m64 z4 = mz[2]; + __m64 z6 = mz[3]; + __m64 z8 = mz[4]; + __m64 z10 = mz[5]; + __m64 z12 = mz[6]; + __m64 z14 = mz[7]; + __m64 z16 = mz[8]; + __m64 z18 = mz[9]; + __m64 z20 = mz[10]; + __m64 z22 = mz[11]; + __m64 z26 = _mm_cvtsi32_si64(z[26]); + + s1 = _mm_add_si64(w1, w4); + C[1] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w6, w8); + s1 = _mm_add_si64(s1, s2); + C[2] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w10, w12); + s1 = _mm_add_si64(s1, s2); + C[3] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x0, y0); + s2 = _mm_add_si64(w14, w16); + s1 = _mm_add_si64(s1, s3); + s1 = _mm_add_si64(s1, s2); + C[4] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x1, y1); + s4 = _mm_add_si64(x4, y4); + s1 = _mm_add_si64(s1, w18); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, w20); + s1 = _mm_add_si64(s1, s3); + C[5] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x6, y6); + s4 = _mm_add_si64(x8, y8); + s1 = _mm_add_si64(s1, w22); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, w26); + s1 = _mm_add_si64(s1, s3); + C[6] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x10, y10); + s4 = _mm_add_si64(x12, y12); + s1 = _mm_add_si64(s1, w27); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, s3); + C[7] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x14, y14); + s4 = _mm_add_si64(x16, y16); + s1 = _mm_add_si64(s1, z0); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, s3); + C[8] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x18, y18); + s4 = _mm_add_si64(x20, y20); + s1 = _mm_add_si64(s1, z1); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, z4); + s1 = _mm_add_si64(s1, s3); + C[9] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x22, y22); + s4 = _mm_add_si64(x26, y26); + s1 = _mm_add_si64(s1, z6); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, z8); + s1 = _mm_add_si64(s1, s3); + C[10] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x27, y27); + s1 = _mm_add_si64(s1, z10); + s1 = _mm_add_si64(s1, z12); + s1 = _mm_add_si64(s1, s3); + C[11] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(z14, z16); + s1 = _mm_add_si64(s1, s3); + C[12] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(z18, z20); + s1 = _mm_add_si64(s1, s3); + C[13] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(z22, z26); + s1 = _mm_add_si64(s1, s3); + C[14] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + C[15] = z[27] + _mm_cvtsi64_si32(s1); + _mm_empty(); +} + +void P4Optimized::Multiply8Bottom(word *C, const word *A, const word *B) +{ + __m128i temp[21]; + const word *w = (word *)temp; + const __m64 *mw = (__m64 *)w; + const word *x = (word *)temp+7*4; + const __m64 *mx = (__m64 *)x; + const word *y = (word *)temp+7*4*2; + const __m64 *my = (__m64 *)y; + + P4_Mul(temp, (__m128i *)A, (__m128i *)B); + + P4_Mul(temp+7, (__m128i *)A+1, (__m128i *)B); + + P4_Mul(temp+14, (__m128i *)A, (__m128i *)B+1); + + C[0] = w[0]; + + __m64 s1, s2, s3, s4; + + __m64 w1 = _mm_cvtsi32_si64(w[1]); + __m64 w4 = mw[2]; + __m64 w6 = mw[3]; + __m64 w8 = mw[4]; + __m64 w10 = mw[5]; + __m64 w12 = mw[6]; + __m64 w14 = mw[7]; + __m64 w16 = mw[8]; + __m64 w18 = mw[9]; + __m64 w20 = mw[10]; + __m64 w22 = mw[11]; + __m64 w26 = _mm_cvtsi32_si64(w[26]); + + __m64 x0 = _mm_cvtsi32_si64(x[0]); + __m64 x1 = _mm_cvtsi32_si64(x[1]); + __m64 x4 = mx[2]; + __m64 x6 = mx[3]; + __m64 x8 = mx[4]; + + __m64 y0 = _mm_cvtsi32_si64(y[0]); + __m64 y1 = _mm_cvtsi32_si64(y[1]); + __m64 y4 = my[2]; + __m64 y6 = my[3]; + __m64 y8 = my[4]; + + s1 = _mm_add_si64(w1, w4); + C[1] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w6, w8); + s1 = _mm_add_si64(s1, s2); + C[2] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s2 = _mm_add_si64(w10, w12); + s1 = _mm_add_si64(s1, s2); + C[3] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x0, y0); + s2 = _mm_add_si64(w14, w16); + s1 = _mm_add_si64(s1, s3); + s1 = _mm_add_si64(s1, s2); + C[4] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x1, y1); + s4 = _mm_add_si64(x4, y4); + s1 = _mm_add_si64(s1, w18); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, w20); + s1 = _mm_add_si64(s1, s3); + C[5] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + s3 = _mm_add_si64(x6, y6); + s4 = _mm_add_si64(x8, y8); + s1 = _mm_add_si64(s1, w22); + s3 = _mm_add_si64(s3, s4); + s1 = _mm_add_si64(s1, w26); + s1 = _mm_add_si64(s1, s3); + C[6] = _mm_cvtsi64_si32(s1); + s1 = _mm_srli_si64(s1, 32); + + C[7] = _mm_cvtsi64_si32(s1) + w[27] + x[10] + y[10] + x[12] + y[12]; + _mm_empty(); +} + +#endif // #ifdef SSE2_INTRINSICS_AVAILABLE + +// end optimized + +// ******************************************************** + +#define A0 A +#define A1 (A+N2) +#define B0 B +#define B1 (B+N2) + +#define T0 T +#define T1 (T+N2) +#define T2 (T+N) +#define T3 (T+N+N2) + +#define R0 R +#define R1 (R+N2) +#define R2 (R+N) +#define R3 (R+N+N2) + +//VC60 workaround: compiler bug triggered without the extra dummy parameters + +// R[2*N] - result = A*B +// T[2*N] - temporary work space +// A[N] --- multiplier +// B[N] --- multiplicant + + +void RecursiveMultiply(word *R, word *T, const word *A, const word *B, + unsigned int N) +{ + assert(N>=2 && N%2==0); + + if (LowLevel::MultiplyRecursionLimit() >= 8 && N==8) + LowLevel::Multiply8(R, A, B); + else if (LowLevel::MultiplyRecursionLimit() >= 4 && N==4) + LowLevel::Multiply4(R, A, B); + else if (N==2) + LowLevel::Multiply2(R, A, B); + else + { + const unsigned int N2 = N/2; + int carry; + + int aComp = Compare(A0, A1, N2); + int bComp = Compare(B0, B1, N2); + + switch (2*aComp + aComp + bComp) + { + case -4: + LowLevel::Subtract(R0, A1, A0, N2); + LowLevel::Subtract(R1, B0, B1, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + LowLevel::Subtract(T1, T1, R0, N2); + carry = -1; + break; + case -2: + LowLevel::Subtract(R0, A1, A0, N2); + LowLevel::Subtract(R1, B0, B1, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + carry = 0; + break; + case 2: + LowLevel::Subtract(R0, A0, A1, N2); + LowLevel::Subtract(R1, B1, B0, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + carry = 0; + break; + case 4: + LowLevel::Subtract(R0, A1, A0, N2); + LowLevel::Subtract(R1, B0, B1, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + LowLevel::Subtract(T1, T1, R1, N2); + carry = -1; + break; + default: + SetWords(T0, 0, N); + carry = 0; + } + + RecursiveMultiply(R0, T2, A0, B0, N2); + RecursiveMultiply(R2, T2, A1, B1, N2); + + // now T[01] holds (A1-A0)*(B0-B1),R[01] holds A0*B0, R[23] holds A1*B1 + + carry += LowLevel::Add(T0, T0, R0, N); + carry += LowLevel::Add(T0, T0, R2, N); + carry += LowLevel::Add(R1, R1, T0, N); + + assert (carry >= 0 && carry <= 2); + Increment(R3, N2, carry); + } +} + + +void RecursiveSquare(word *R, word *T, const word *A, unsigned int N) +{ + assert(N && N%2==0); + if (LowLevel::SquareRecursionLimit() >= 8 && N==8) + LowLevel::Square8(R, A); + if (LowLevel::SquareRecursionLimit() >= 4 && N==4) + LowLevel::Square4(R, A); + else if (N==2) + LowLevel::Square2(R, A); + else + { + const unsigned int N2 = N/2; + + RecursiveSquare(R0, T2, A0, N2); + RecursiveSquare(R2, T2, A1, N2); + RecursiveMultiply(T0, T2, A0, A1, N2); + + word carry = LowLevel::Add(R1, R1, T0, N); + carry += LowLevel::Add(R1, R1, T0, N); + Increment(R3, N2, carry); + } +} + + +// R[N] - bottom half of A*B +// T[N] - temporary work space +// A[N] - multiplier +// B[N] - multiplicant + + +void RecursiveMultiplyBottom(word *R, word *T, const word *A, const word *B, + unsigned int N) +{ + assert(N>=2 && N%2==0); + if (LowLevel::MultiplyBottomRecursionLimit() >= 8 && N==8) + LowLevel::Multiply8Bottom(R, A, B); + else if (LowLevel::MultiplyBottomRecursionLimit() >= 4 && N==4) + LowLevel::Multiply4Bottom(R, A, B); + else if (N==2) + LowLevel::Multiply2Bottom(R, A, B); + else + { + const unsigned int N2 = N/2; + + RecursiveMultiply(R, T, A0, B0, N2); + RecursiveMultiplyBottom(T0, T1, A1, B0, N2); + LowLevel::Add(R1, R1, T0, N2); + RecursiveMultiplyBottom(T0, T1, A0, B1, N2); + LowLevel::Add(R1, R1, T0, N2); + } +} + + +void RecursiveMultiplyTop(word *R, word *T, const word *L, const word *A, + const word *B, unsigned int N) +{ + assert(N>=2 && N%2==0); + + if (N==4) + { + LowLevel::Multiply4(T, A, B); + memcpy(R, T+4, 4*WORD_SIZE); + } + else if (N==2) + { + LowLevel::Multiply2(T, A, B); + memcpy(R, T+2, 2*WORD_SIZE); + } + else + { + const unsigned int N2 = N/2; + int carry; + + int aComp = Compare(A0, A1, N2); + int bComp = Compare(B0, B1, N2); + + switch (2*aComp + aComp + bComp) + { + case -4: + LowLevel::Subtract(R0, A1, A0, N2); + LowLevel::Subtract(R1, B0, B1, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + LowLevel::Subtract(T1, T1, R0, N2); + carry = -1; + break; + case -2: + LowLevel::Subtract(R0, A1, A0, N2); + LowLevel::Subtract(R1, B0, B1, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + carry = 0; + break; + case 2: + LowLevel::Subtract(R0, A0, A1, N2); + LowLevel::Subtract(R1, B1, B0, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + carry = 0; + break; + case 4: + LowLevel::Subtract(R0, A1, A0, N2); + LowLevel::Subtract(R1, B0, B1, N2); + RecursiveMultiply(T0, T2, R0, R1, N2); + LowLevel::Subtract(T1, T1, R1, N2); + carry = -1; + break; + default: + SetWords(T0, 0, N); + carry = 0; + } + + RecursiveMultiply(T2, R0, A1, B1, N2); + + // now T[01] holds (A1-A0)*(B0-B1), T[23] holds A1*B1 + + word c2 = LowLevel::Subtract(R0, L+N2, L, N2); + c2 += LowLevel::Subtract(R0, R0, T0, N2); + word t = (Compare(R0, T2, N2) == -1); + + carry += t; + carry += Increment(R0, N2, c2+t); + carry += LowLevel::Add(R0, R0, T1, N2); + carry += LowLevel::Add(R0, R0, T3, N2); + assert (carry >= 0 && carry <= 2); + + CopyWords(R1, T3, N2); + Increment(R1, N2, carry); + } +} + + +inline word Add(word *C, const word *A, const word *B, unsigned int N) +{ + return LowLevel::Add(C, A, B, N); +} + +inline word Subtract(word *C, const word *A, const word *B, unsigned int N) +{ + return LowLevel::Subtract(C, A, B, N); +} + +inline void Multiply(word *R, word *T, const word *A, const word *B, + unsigned int N) +{ + RecursiveMultiply(R, T, A, B, N); +} + +inline void Square(word *R, word *T, const word *A, unsigned int N) +{ + RecursiveSquare(R, T, A, N); +} + + +void AsymmetricMultiply(word *R, word *T, const word *A, unsigned int NA, + const word *B, unsigned int NB) +{ + if (NA == NB) + { + if (A == B) + Square(R, T, A, NA); + else + Multiply(R, T, A, B, NA); + + return; + } + + if (NA > NB) + { + STL::swap(A, B); + STL::swap(NA, NB); + } + + assert(NB % NA == 0); + assert((NB/NA)%2 == 0); // NB is an even multiple of NA + + if (NA==2 && !A[1]) + { + switch (A[0]) + { + case 0: + SetWords(R, 0, NB+2); + return; + case 1: + CopyWords(R, B, NB); + R[NB] = R[NB+1] = 0; + return; + default: + R[NB] = LinearMultiply(R, B, A[0], NB); + R[NB+1] = 0; + return; + } + } + + Multiply(R, T, A, B, NA); + CopyWords(T+2*NA, R+NA, NA); + + unsigned i; + + for (i=2*NA; i>=1; + i++; + } + k+=i; + + if (t==1 && f[1]==0 && EvenWordCount(f, fgLen)==2) + { + if (s%2==0) + CopyWords(R, b, N); + else + Subtract(R, M, b, N); + return k; + } + + ShiftWordsRightByBits(f, fgLen, i); + t=ShiftWordsLeftByBits(c, bcLen, i); + if (t) + { + c[bcLen] = t; + bcLen+=2; + assert(bcLen <= N); + } + + if (f[fgLen-2]==0 && g[fgLen-2]==0 && f[fgLen-1]==0 && g[fgLen-1]==0) + fgLen-=2; + + if (Compare(f, g, fgLen)==-1) + { + STL::swap(f, g); + STL::swap(b, c); + s++; + } + + Subtract(f, f, g, fgLen); + + if (Add(b, b, c, bcLen)) + { + b[bcLen] = 1; + bcLen+=2; + assert(bcLen <= N); + } + } +} + +// R[N] - result = A/(2^k) mod M +// A[N] - input +// M[N] - modulus + +void DivideByPower2Mod(word *R, const word *A, unsigned int k, const word *M, + unsigned int N) +{ + CopyWords(R, A, N); + + while (k--) + { + if (R[0]%2==0) + ShiftWordsRightByBits(R, N, 1); + else + { + word carry = Add(R, R, M, N); + ShiftWordsRightByBits(R, N, 1); + R[N-1] += carry<<(WORD_BITS-1); + } + } +} + +// R[N] - result = A*(2^k) mod M +// A[N] - input +// M[N] - modulus + +void MultiplyByPower2Mod(word *R, const word *A, unsigned int k, const word *M, + unsigned int N) +{ + CopyWords(R, A, N); + + while (k--) + if (ShiftWordsLeftByBits(R, N, 1) || Compare(R, M, N)>=0) + Subtract(R, R, M, N); +} + + +// ********** end of integer needs + + +Integer::Integer() + : reg_(2), sign_(POSITIVE) +{ + reg_[0] = reg_[1] = 0; +} + + +Integer::Integer(const Integer& t) + : reg_(RoundupSize(t.WordCount())), sign_(t.sign_) +{ + CopyWords(reg_.get_buffer(), t.reg_.get_buffer(), reg_.size()); +} + + +Integer::Integer(signed long value) + : reg_(2) +{ + if (value >= 0) + sign_ = POSITIVE; + else + { + sign_ = NEGATIVE; + value = -value; + } + reg_[0] = word(value); + reg_[1] = word(SafeRightShift(value)); +} + + +Integer::Integer(Sign s, word high, word low) + : reg_(2), sign_(s) +{ + reg_[0] = low; + reg_[1] = high; +} + + +Integer::Integer(word value, unsigned int length) + : reg_(RoundupSize(length)), sign_(POSITIVE) +{ + reg_[0] = value; + SetWords(reg_ + 1, 0, reg_.size() - 1); +} + + +Integer::Integer(const byte *encodedInteger, unsigned int byteCount, + Signedness s) +{ + Decode(encodedInteger, byteCount, s); +} + +class BadBER {}; + +// BER Decode Source +Integer::Integer(Source& source) + : reg_(2), sign_(POSITIVE) +{ + Decode(source); +} + +void Integer::Decode(Source& source) +{ + byte b = source.next(); + if (b != INTEGER) { + source.SetError(INTEGER_E); + return; + } + + word32 length = GetLength(source); + + if ( (b = source.next()) == 0x00) + length--; + else + source.prev(); + + unsigned int words = (length + WORD_SIZE - 1) / WORD_SIZE; + words = RoundupSize(words); + if (words > reg_.size()) reg_.CleanNew(words); + + for (int j = length; j > 0; j--) { + b = source.next(); + reg_ [(j-1) / WORD_SIZE] |= (word)b << ((j-1) % WORD_SIZE) * 8; + } +} + + +void Integer::Decode(const byte* input, unsigned int inputLen, Signedness s) +{ + unsigned int idx(0); + byte b = input[idx++]; + sign_ = ((s==SIGNED) && (b & 0x80)) ? NEGATIVE : POSITIVE; + + while (inputLen>0 && (sign_==POSITIVE ? b==0 : b==0xff)) + { + inputLen--; + b = input[idx++]; + } + + reg_.CleanNew(RoundupSize(BytesToWords(inputLen))); + + --idx; + for (unsigned int i=inputLen; i > 0; i--) + { + b = input[idx++]; + reg_[(i-1)/WORD_SIZE] |= (word)b << ((i-1)%WORD_SIZE)*8; + } + + if (sign_ == NEGATIVE) + { + for (unsigned i=inputLen; i 0; i--) + output[idx++] = GetByte(i-1); + } + else + { + // take two's complement of *this + Integer temp = Integer::Power2(8*max(ByteCount(), outputLen)) + *this; + for (unsigned i=0; i range); + + *this += min; +} + + +Integer Integer::Power2(unsigned int e) +{ + Integer r((word)0, BitsToWords(e + 1)); + r.SetBit(e); + return r; +} + + +void Integer::SetBit(unsigned int n, bool value) +{ + if (value) + { + reg_.CleanGrow(RoundupSize(BitsToWords(n + 1))); + reg_[n / WORD_BITS] |= (word(1) << (n % WORD_BITS)); + } + else + { + if (n / WORD_BITS < reg_.size()) + reg_[n / WORD_BITS] &= ~(word(1) << (n % WORD_BITS)); + } +} + + +void Integer::SetByte(unsigned int n, byte value) +{ + reg_.CleanGrow(RoundupSize(BytesToWords(n+1))); + reg_[n/WORD_SIZE] &= ~(word(0xff) << 8*(n%WORD_SIZE)); + reg_[n/WORD_SIZE] |= (word(value) << 8*(n%WORD_SIZE)); +} + + +void Integer::Negate() +{ + if (!!(*this)) // don't flip sign if *this==0 + sign_ = Sign(1 - sign_); +} + + +bool Integer::operator!() const +{ + return IsNegative() ? false : (reg_[0]==0 && WordCount()==0); +} + + +Integer& Integer::operator=(const Integer& t) +{ + if (this != &t) + { + reg_.New(RoundupSize(t.WordCount())); + CopyWords(reg_.get_buffer(), t.reg_.get_buffer(), reg_.size()); + sign_ = t.sign_; + } + return *this; +} + + +Integer& Integer::operator+=(const Integer& t) +{ + reg_.CleanGrow(t.reg_.size()); + if (NotNegative()) + { + if (t.NotNegative()) + PositiveAdd(*this, *this, t); + else + PositiveSubtract(*this, *this, t); + } + else + { + if (t.NotNegative()) + PositiveSubtract(*this, t, *this); + else + { + PositiveAdd(*this, *this, t); + sign_ = Integer::NEGATIVE; + } + } + return *this; +} + + +Integer Integer::operator-() const +{ + Integer result(*this); + result.Negate(); + return result; +} + + +Integer& Integer::operator-=(const Integer& t) +{ + reg_.CleanGrow(t.reg_.size()); + if (NotNegative()) + { + if (t.NotNegative()) + PositiveSubtract(*this, *this, t); + else + PositiveAdd(*this, *this, t); + } + else + { + if (t.NotNegative()) + { + PositiveAdd(*this, *this, t); + sign_ = Integer::NEGATIVE; + } + else + PositiveSubtract(*this, t, *this); + } + return *this; +} + + +Integer& Integer::operator++() +{ + if (NotNegative()) + { + if (Increment(reg_.get_buffer(), reg_.size())) + { + reg_.CleanGrow(2*reg_.size()); + reg_[reg_.size()/2]=1; + } + } + else + { + word borrow = Decrement(reg_.get_buffer(), reg_.size()); + assert(!borrow); + if (WordCount()==0) + *this = Zero(); + } + return *this; +} + +Integer& Integer::operator--() +{ + if (IsNegative()) + { + if (Increment(reg_.get_buffer(), reg_.size())) + { + reg_.CleanGrow(2*reg_.size()); + reg_[reg_.size()/2]=1; + } + } + else + { + if (Decrement(reg_.get_buffer(), reg_.size())) + *this = -One(); + } + return *this; +} + + +Integer& Integer::operator<<=(unsigned int n) +{ + const unsigned int wordCount = WordCount(); + const unsigned int shiftWords = n / WORD_BITS; + const unsigned int shiftBits = n % WORD_BITS; + + reg_.CleanGrow(RoundupSize(wordCount+BitsToWords(n))); + ShiftWordsLeftByWords(reg_.get_buffer(), wordCount + shiftWords, + shiftWords); + ShiftWordsLeftByBits(reg_+shiftWords, wordCount+BitsToWords(shiftBits), + shiftBits); + return *this; +} + +Integer& Integer::operator>>=(unsigned int n) +{ + const unsigned int wordCount = WordCount(); + const unsigned int shiftWords = n / WORD_BITS; + const unsigned int shiftBits = n % WORD_BITS; + + ShiftWordsRightByWords(reg_.get_buffer(), wordCount, shiftWords); + if (wordCount > shiftWords) + ShiftWordsRightByBits(reg_.get_buffer(), wordCount-shiftWords, + shiftBits); + if (IsNegative() && WordCount()==0) // avoid -0 + *this = Zero(); + return *this; +} + + +void PositiveAdd(Integer& sum, const Integer& a, const Integer& b) +{ + word carry; + if (a.reg_.size() == b.reg_.size()) + carry = Add(sum.reg_.get_buffer(), a.reg_.get_buffer(), + b.reg_.get_buffer(), a.reg_.size()); + else if (a.reg_.size() > b.reg_.size()) + { + carry = Add(sum.reg_.get_buffer(), a.reg_.get_buffer(), + b.reg_.get_buffer(), b.reg_.size()); + CopyWords(sum.reg_+b.reg_.size(), a.reg_+b.reg_.size(), + a.reg_.size()-b.reg_.size()); + carry = Increment(sum.reg_+b.reg_.size(), a.reg_.size()-b.reg_.size(), + carry); + } + else + { + carry = Add(sum.reg_.get_buffer(), a.reg_.get_buffer(), + b.reg_.get_buffer(), a.reg_.size()); + CopyWords(sum.reg_+a.reg_.size(), b.reg_+a.reg_.size(), + b.reg_.size()-a.reg_.size()); + carry = Increment(sum.reg_+a.reg_.size(), b.reg_.size()-a.reg_.size(), + carry); + } + + if (carry) + { + sum.reg_.CleanGrow(2*sum.reg_.size()); + sum.reg_[sum.reg_.size()/2] = 1; + } + sum.sign_ = Integer::POSITIVE; +} + +void PositiveSubtract(Integer &diff, const Integer &a, const Integer& b) +{ + unsigned aSize = a.WordCount(); + aSize += aSize%2; + unsigned bSize = b.WordCount(); + bSize += bSize%2; + + if (aSize == bSize) + { + if (Compare(a.reg_.get_buffer(), b.reg_.get_buffer(), aSize) >= 0) + { + Subtract(diff.reg_.get_buffer(), a.reg_.get_buffer(), + b.reg_.get_buffer(), aSize); + diff.sign_ = Integer::POSITIVE; + } + else + { + Subtract(diff.reg_.get_buffer(), b.reg_.get_buffer(), + a.reg_.get_buffer(), aSize); + diff.sign_ = Integer::NEGATIVE; + } + } + else if (aSize > bSize) + { + word borrow = Subtract(diff.reg_.get_buffer(), a.reg_.get_buffer(), + b.reg_.get_buffer(), bSize); + CopyWords(diff.reg_+bSize, a.reg_+bSize, aSize-bSize); + borrow = Decrement(diff.reg_+bSize, aSize-bSize, borrow); + assert(!borrow); + diff.sign_ = Integer::POSITIVE; + } + else + { + word borrow = Subtract(diff.reg_.get_buffer(), b.reg_.get_buffer(), + a.reg_.get_buffer(), aSize); + CopyWords(diff.reg_+aSize, b.reg_+aSize, bSize-aSize); + borrow = Decrement(diff.reg_+aSize, bSize-aSize, borrow); + assert(!borrow); + diff.sign_ = Integer::NEGATIVE; + } +} + + +unsigned int Integer::MinEncodedSize(Signedness signedness) const +{ + unsigned int outputLen = max(1U, ByteCount()); + if (signedness == UNSIGNED) + return outputLen; + if (NotNegative() && (GetByte(outputLen-1) & 0x80)) + outputLen++; + if (IsNegative() && *this < -Power2(outputLen*8-1)) + outputLen++; + return outputLen; +} + + +int Integer::Compare(const Integer& t) const +{ + if (NotNegative()) + { + if (t.NotNegative()) + return PositiveCompare(t); + else + return 1; + } + else + { + if (t.NotNegative()) + return -1; + else + return -PositiveCompare(t); + } +} + + +int Integer::PositiveCompare(const Integer& t) const +{ + unsigned size = WordCount(), tSize = t.WordCount(); + + if (size == tSize) + return TaoCrypt::Compare(reg_.get_buffer(), t.reg_.get_buffer(), size); + else + return size > tSize ? 1 : -1; +} + + +bool Integer::GetBit(unsigned int n) const +{ + if (n/WORD_BITS >= reg_.size()) + return 0; + else + return bool((reg_[n/WORD_BITS] >> (n % WORD_BITS)) & 1); +} + + +unsigned long Integer::GetBits(unsigned int i, unsigned int n) const +{ + assert(n <= sizeof(unsigned long)*8); + unsigned long v = 0; + for (unsigned int j=0; j= reg_.size()) + return 0; + else + return byte(reg_[n/WORD_SIZE] >> ((n%WORD_SIZE)*8)); +} + + +unsigned int Integer::BitCount() const +{ + unsigned wordCount = WordCount(); + if (wordCount) + return (wordCount-1)*WORD_BITS + BitPrecision(reg_[wordCount-1]); + else + return 0; +} + + +unsigned int Integer::ByteCount() const +{ + unsigned wordCount = WordCount(); + if (wordCount) + return (wordCount-1)*WORD_SIZE + BytePrecision(reg_[wordCount-1]); + else + return 0; +} + + +unsigned int Integer::WordCount() const +{ + return CountWords(reg_.get_buffer(), reg_.size()); +} + + +bool Integer::IsConvertableToLong() const +{ + if (ByteCount() > sizeof(long)) + return false; + + unsigned long value = reg_[0]; + value += SafeLeftShift(reg_[1]); + + if (sign_ == POSITIVE) + return (signed long)value >= 0; + else + return -(signed long)value < 0; +} + + +signed long Integer::ConvertToLong() const +{ + assert(IsConvertableToLong()); + + unsigned long value = reg_[0]; + value += SafeLeftShift(reg_[1]); + return sign_ == POSITIVE ? value : -(signed long)value; +} + + +void Integer::Swap(Integer& a) +{ + reg_.Swap(a.reg_); + STL::swap(sign_, a.sign_); +} + + +Integer Integer::Plus(const Integer& b) const +{ + Integer sum((word)0, max(reg_.size(), b.reg_.size())); + if (NotNegative()) + { + if (b.NotNegative()) + PositiveAdd(sum, *this, b); + else + PositiveSubtract(sum, *this, b); + } + else + { + if (b.NotNegative()) + PositiveSubtract(sum, b, *this); + else + { + PositiveAdd(sum, *this, b); + sum.sign_ = Integer::NEGATIVE; + } + } + return sum; +} + + +Integer Integer::Minus(const Integer& b) const +{ + Integer diff((word)0, max(reg_.size(), b.reg_.size())); + if (NotNegative()) + { + if (b.NotNegative()) + PositiveSubtract(diff, *this, b); + else + PositiveAdd(diff, *this, b); + } + else + { + if (b.NotNegative()) + { + PositiveAdd(diff, *this, b); + diff.sign_ = Integer::NEGATIVE; + } + else + PositiveSubtract(diff, b, *this); + } + return diff; +} + + +Integer Integer::Times(const Integer &b) const +{ + Integer product; + Multiply(product, *this, b); + return product; +} + + +#undef A0 +#undef A1 +#undef B0 +#undef B1 + +#undef T0 +#undef T1 +#undef T2 +#undef T3 + +#undef R0 +#undef R1 +#undef R2 +#undef R3 + + +static inline void AtomicDivide(word *Q, const word *A, const word *B) +{ + word T[4]; + DWord q = DivideFourWordsByTwo(T, DWord(A[0], A[1]), + DWord(A[2], A[3]), DWord(B[0], B[1])); + Q[0] = q.GetLowHalf(); + Q[1] = q.GetHighHalf(); + +#ifndef NDEBUG + if (B[0] || B[1]) + { + // multiply quotient and divisor and add remainder, make sure it + // equals dividend + assert(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]= 0) + { + R[N] -= Subtract(R, R, B, N); + Q[1] += (++Q[0]==0); + assert(Q[0] || Q[1]); // no overflow + } +} + +// R[NB] -------- remainder = A%B +// Q[NA-NB+2] --- quotient = A/B +// T[NA+2*NB+4] - temp work space +// A[NA] -------- dividend +// B[NB] -------- divisor + + +void Divide(word* R, word* Q, word* T, const word* A, unsigned int NA, + const word* B, unsigned int NB) +{ + assert(NA && NB && NA%2==0 && NB%2==0); + assert(B[NB-1] || B[NB-2]); + assert(NB <= NA); + + // set up temporary work space + word *const TA=T; + word *const TB=T+NA+2; + word *const TP=T+NA+2+NB; + + // copy B into TB and normalize it so that TB has highest bit set to 1 + unsigned shiftWords = (B[NB-1]==0); + TB[0] = TB[NB-1] = 0; + CopyWords(TB+shiftWords, B, NB-shiftWords); + unsigned shiftBits = WORD_BITS - BitPrecision(TB[NB-1]); + assert(shiftBits < WORD_BITS); + ShiftWordsLeftByBits(TB, NB, shiftBits); + + // copy A into TA and normalize it + TA[0] = TA[NA] = TA[NA+1] = 0; + CopyWords(TA+shiftWords, A, NA); + ShiftWordsLeftByBits(TA, NA+2, shiftBits); + + if (TA[NA+1]==0 && TA[NA] <= 1) + { + Q[NA-NB+1] = Q[NA-NB] = 0; + while (TA[NA] || Compare(TA+NA-NB, TB, NB) >= 0) + { + TA[NA] -= Subtract(TA+NA-NB, TA+NA-NB, TB, NB); + ++Q[NA-NB]; + } + } + else + { + NA+=2; + assert(Compare(TA+NA-NB, TB, NB) < 0); + } + + word BT[2]; + BT[0] = TB[NB-2] + 1; + BT[1] = TB[NB-1] + (BT[0]==0); + + // start reducing TA mod TB, 2 words at a time + for (unsigned i=NA-2; i>=NB; i-=2) + { + AtomicDivide(Q+i-NB, TA+i-2, BT); + CorrectQuotientEstimate(TA+i-NB, TP, Q+i-NB, TB, NB); + } + + // copy TA into R, and denormalize it + CopyWords(R, TA+shiftWords, NB); + ShiftWordsRightByBits(R, NB, shiftBits); +} + + +void PositiveDivide(Integer& remainder, Integer& quotient, + const Integer& a, const Integer& b) +{ + unsigned aSize = a.WordCount(); + unsigned bSize = b.WordCount(); + + assert(bSize); + + if (a.PositiveCompare(b) == -1) + { + remainder = a; + remainder.sign_ = Integer::POSITIVE; + quotient = Integer::Zero(); + return; + } + + aSize += aSize%2; // round up to next even number + bSize += bSize%2; + + remainder.reg_.CleanNew(RoundupSize(bSize)); + remainder.sign_ = Integer::POSITIVE; + quotient.reg_.CleanNew(RoundupSize(aSize-bSize+2)); + quotient.sign_ = Integer::POSITIVE; + + AlignedWordBlock T(aSize+2*bSize+4); + Divide(remainder.reg_.get_buffer(), quotient.reg_.get_buffer(), + T.get_buffer(), a.reg_.get_buffer(), aSize, b.reg_.get_buffer(), + bSize); +} + +void Integer::Divide(Integer &remainder, Integer "ient, + const Integer ÷nd, const Integer &divisor) +{ + PositiveDivide(remainder, quotient, dividend, divisor); + + if (dividend.IsNegative()) + { + quotient.Negate(); + if (remainder.NotZero()) + { + --quotient; + remainder = divisor.AbsoluteValue() - remainder; + } + } + + if (divisor.IsNegative()) + quotient.Negate(); +} + +void Integer::DivideByPowerOf2(Integer &r, Integer &q, const Integer &a, + unsigned int n) +{ + q = a; + q >>= n; + + const unsigned int wordCount = BitsToWords(n); + if (wordCount <= a.WordCount()) + { + r.reg_.resize(RoundupSize(wordCount)); + CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), wordCount); + SetWords(r.reg_+wordCount, 0, r.reg_.size()-wordCount); + if (n % WORD_BITS != 0) + r.reg_[wordCount-1] %= (word(1) << (n % WORD_BITS)); + } + else + { + r.reg_.resize(RoundupSize(a.WordCount())); + CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), r.reg_.size()); + } + r.sign_ = POSITIVE; + + if (a.IsNegative() && r.NotZero()) + { + --q; + r = Power2(n) - r; + } +} + +Integer Integer::DividedBy(const Integer &b) const +{ + Integer remainder, quotient; + Integer::Divide(remainder, quotient, *this, b); + return quotient; +} + +Integer Integer::Modulo(const Integer &b) const +{ + Integer remainder, quotient; + Integer::Divide(remainder, quotient, *this, b); + return remainder; +} + +void Integer::Divide(word &remainder, Integer "ient, + const Integer ÷nd, word divisor) +{ + assert(divisor); + + if ((divisor & (divisor-1)) == 0) // divisor is a power of 2 + { + quotient = dividend >> (BitPrecision(divisor)-1); + remainder = dividend.reg_[0] & (divisor-1); + return; + } + + unsigned int i = dividend.WordCount(); + quotient.reg_.CleanNew(RoundupSize(i)); + remainder = 0; + while (i--) + { + quotient.reg_[i] = DWord(dividend.reg_[i], remainder) / divisor; + remainder = DWord(dividend.reg_[i], remainder) % divisor; + } + + if (dividend.NotNegative()) + quotient.sign_ = POSITIVE; + else + { + quotient.sign_ = NEGATIVE; + if (remainder) + { + --quotient; + remainder = divisor - remainder; + } + } +} + +Integer Integer::DividedBy(word b) const +{ + word remainder; + Integer quotient; + Integer::Divide(remainder, quotient, *this, b); + return quotient; +} + +word Integer::Modulo(word divisor) const +{ + assert(divisor); + + word remainder; + + if ((divisor & (divisor-1)) == 0) // divisor is a power of 2 + remainder = reg_[0] & (divisor-1); + else + { + unsigned int i = WordCount(); + + if (divisor <= 5) + { + DWord sum(0, 0); + while (i--) + sum += reg_[i]; + remainder = sum % divisor; + } + else + { + remainder = 0; + while (i--) + remainder = DWord(reg_[i], remainder) % divisor; + } + } + + if (IsNegative() && remainder) + remainder = divisor - remainder; + + return remainder; +} + + +Integer Integer::AbsoluteValue() const +{ + Integer result(*this); + result.sign_ = POSITIVE; + return result; +} + + +Integer Integer::SquareRoot() const +{ + if (!IsPositive()) + return Zero(); + + // overestimate square root + Integer x, y = Power2((BitCount()+1)/2); + assert(y*y >= *this); + + do + { + x = y; + y = (x + *this/x) >> 1; + } while (y=m) + return (*this%m).InverseMod(m); + + if (m.IsEven()) + { + if (!m || IsEven()) + return Zero(); // no inverse + if (*this == One()) + return One(); + + Integer u = m.InverseMod(*this); + return !u ? Zero() : (m*(*this-u)+1)/(*this); + } + + AlignedWordBlock T(m.reg_.size() * 4); + Integer r((word)0, m.reg_.size()); + unsigned k = AlmostInverse(r.reg_.get_buffer(), T.get_buffer(), + reg_.get_buffer(), reg_.size(), + m.reg_.get_buffer(), m.reg_.size()); + DivideByPower2Mod(r.reg_.get_buffer(), r.reg_.get_buffer(), k, + m.reg_.get_buffer(), m.reg_.size()); + return r; +} + +word Integer::InverseMod(const word mod) const +{ + word g0 = mod, g1 = *this % mod; + word v0 = 0, v1 = 1; + word y; + + while (g1) + { + if (g1 == 1) + return v1; + y = g0 / g1; + g0 = g0 % g1; + v0 += y * v1; + + if (!g0) + break; + if (g0 == 1) + return mod-v0; + y = g1 / g0; + g1 = g1 % g0; + v1 += y * v0; + } + return 0; +} + +// ********* ModArith stuff + +const Integer& ModularArithmetic::Half(const Integer &a) const +{ + if (a.reg_.size()==modulus.reg_.size()) + { + TaoCrypt::DivideByPower2Mod(result.reg_.begin(), a.reg_.begin(), 1, + modulus.reg_.begin(), a.reg_.size()); + return result; + } + else + return result1 = (a.IsEven() ? (a >> 1) : ((a+modulus) >> 1)); +} + +const Integer& ModularArithmetic::Add(const Integer &a, const Integer &b) const +{ + if (a.reg_.size()==modulus.reg_.size() && + b.reg_.size()==modulus.reg_.size()) + { + if (TaoCrypt::Add(result.reg_.begin(), a.reg_.begin(), b.reg_.begin(), + a.reg_.size()) + || Compare(result.reg_.get_buffer(), modulus.reg_.get_buffer(), + a.reg_.size()) >= 0) + { + TaoCrypt::Subtract(result.reg_.begin(), result.reg_.begin(), + modulus.reg_.begin(), a.reg_.size()); + } + return result; + } + else + { + result1 = a+b; + if (result1 >= modulus) + result1 -= modulus; + return result1; + } +} + +Integer& ModularArithmetic::Accumulate(Integer &a, const Integer &b) const +{ + if (a.reg_.size()==modulus.reg_.size() && + b.reg_.size()==modulus.reg_.size()) + { + if (TaoCrypt::Add(a.reg_.get_buffer(), a.reg_.get_buffer(), + b.reg_.get_buffer(), a.reg_.size()) + || Compare(a.reg_.get_buffer(), modulus.reg_.get_buffer(), + a.reg_.size()) >= 0) + { + TaoCrypt::Subtract(a.reg_.get_buffer(), a.reg_.get_buffer(), + modulus.reg_.get_buffer(), a.reg_.size()); + } + } + else + { + a+=b; + if (a>=modulus) + a-=modulus; + } + + return a; +} + +const Integer& ModularArithmetic::Subtract(const Integer &a, + const Integer &b) const +{ + if (a.reg_.size()==modulus.reg_.size() && + b.reg_.size()==modulus.reg_.size()) + { + if (TaoCrypt::Subtract(result.reg_.begin(), a.reg_.begin(), + b.reg_.begin(), a.reg_.size())) + TaoCrypt::Add(result.reg_.begin(), result.reg_.begin(), + modulus.reg_.begin(), a.reg_.size()); + return result; + } + else + { + result1 = a-b; + if (result1.IsNegative()) + result1 += modulus; + return result1; + } +} + +Integer& ModularArithmetic::Reduce(Integer &a, const Integer &b) const +{ + if (a.reg_.size()==modulus.reg_.size() && + b.reg_.size()==modulus.reg_.size()) + { + if (TaoCrypt::Subtract(a.reg_.get_buffer(), a.reg_.get_buffer(), + b.reg_.get_buffer(), a.reg_.size())) + TaoCrypt::Add(a.reg_.get_buffer(), a.reg_.get_buffer(), + modulus.reg_.get_buffer(), a.reg_.size()); + } + else + { + a-=b; + if (a.IsNegative()) + a+=modulus; + } + + return a; +} + +const Integer& ModularArithmetic::Inverse(const Integer &a) const +{ + if (!a) + return a; + + CopyWords(result.reg_.begin(), modulus.reg_.begin(), modulus.reg_.size()); + if (TaoCrypt::Subtract(result.reg_.begin(), result.reg_.begin(), + a.reg_.begin(), a.reg_.size())) + Decrement(result.reg_.begin()+a.reg_.size(), 1, + modulus.reg_.size()-a.reg_.size()); + + return result; +} + +Integer ModularArithmetic::CascadeExponentiate(const Integer &x, + const Integer &e1, const Integer &y, const Integer &e2) const +{ + if (modulus.IsOdd()) + { + MontgomeryRepresentation dr(modulus); + return dr.ConvertOut(dr.CascadeExponentiate(dr.ConvertIn(x), e1, + dr.ConvertIn(y), e2)); + } + else + return AbstractRing::CascadeExponentiate(x, e1, y, e2); +} + +void ModularArithmetic::SimultaneousExponentiate(Integer *results, + const Integer &base, const Integer *exponents, + unsigned int exponentsCount) const +{ + if (modulus.IsOdd()) + { + MontgomeryRepresentation dr(modulus); + dr.SimultaneousExponentiate(results, dr.ConvertIn(base), exponents, + exponentsCount); + for (unsigned int i=0; i + +namespace TaoCrypt { + + +MD2::MD2() + : X_(X_SIZE), C_(BLOCK_SIZE), buffer_(BLOCK_SIZE) +{ + Init(); +} + +void MD2::Init() +{ + memset(X_.get_buffer(), 0, X_SIZE); + memset(C_.get_buffer(), 0, BLOCK_SIZE); + memset(buffer_.get_buffer(), 0, BLOCK_SIZE); + count_ = 0; +} + + +void MD2::Update(const byte* data, word32 len) +{ + + static const byte S[256] = + { + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, + 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, + 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, + 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, + 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, + 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, + 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, + 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, + 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, + 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, + 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, + 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, + 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, + 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, + 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, + 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, + 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 + }; + + while (len) { + word32 L = (PAD_SIZE - count_) < len ? (PAD_SIZE - count_) : len; + memcpy(buffer_.get_buffer() + count_, data, L); + count_ += L; + data += L; + len -= L; + + if (count_==PAD_SIZE) { + count_ = 0; + memcpy(X_.get_buffer() + PAD_SIZE, buffer_.get_buffer(), PAD_SIZE); + byte t = C_[15]; + + int i; + for(i = 0; i < PAD_SIZE; i++) { + X_[32 + i] = X_[PAD_SIZE + i] ^ X_[i]; + t = C_[i] ^= S[buffer_[i] ^ t]; + } + + t=0; + for(i = 0; i < 18; i++) { + for(int j = 0; j < X_SIZE; j += 8) { + t = X_[j+0] ^= S[t]; + t = X_[j+1] ^= S[t]; + t = X_[j+2] ^= S[t]; + t = X_[j+3] ^= S[t]; + t = X_[j+4] ^= S[t]; + t = X_[j+5] ^= S[t]; + t = X_[j+6] ^= S[t]; + t = X_[j+7] ^= S[t]; + } + t = (t + i) & 0xFF; + } + } + } +} + + +void MD2::Final(byte *hash) +{ + byte padding[BLOCK_SIZE]; + word32 padLen = PAD_SIZE - count_; + + for (word32 i = 0; i < padLen; i++) + padding[i] = static_cast(padLen); + + Update(padding, padLen); + Update(C_.get_buffer(), BLOCK_SIZE); + + memcpy(hash, X_.get_buffer(), DIGEST_SIZE); + + Init(); +} + + + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/md4.cpp b/externals/mysql/extlib/yassl/taocrypt/src/md4.cpp new file mode 100644 index 0000000..cf17c21 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/md4.cpp @@ -0,0 +1,157 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* based on Wei Dai's md4.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "md4.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + +namespace TaoCrypt { + +void MD4::Init() +{ + digest_[0] = 0x67452301L; + digest_[1] = 0xefcdab89L; + digest_[2] = 0x98badcfeL; + digest_[3] = 0x10325476L; + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + + +MD4::MD4(const MD4& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32), + BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + +MD4& MD4::operator= (const MD4& that) +{ + MD4 tmp(that); + Swap(tmp); + + return *this; +} + + +void MD4::Swap(MD4& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + + +void MD4::Transform() +{ +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) + + word32 A, B, C, D; + + A = digest_[0]; + B = digest_[1]; + C = digest_[2]; + D = digest_[3]; + +#define function(a,b,c,d,k,s) a=rotlFixed(a+F(b,c,d)+buffer_[k],s); + function(A,B,C,D, 0, 3); + function(D,A,B,C, 1, 7); + function(C,D,A,B, 2,11); + function(B,C,D,A, 3,19); + function(A,B,C,D, 4, 3); + function(D,A,B,C, 5, 7); + function(C,D,A,B, 6,11); + function(B,C,D,A, 7,19); + function(A,B,C,D, 8, 3); + function(D,A,B,C, 9, 7); + function(C,D,A,B,10,11); + function(B,C,D,A,11,19); + function(A,B,C,D,12, 3); + function(D,A,B,C,13, 7); + function(C,D,A,B,14,11); + function(B,C,D,A,15,19); + +#undef function +#define function(a,b,c,d,k,s) a=rotlFixed(a+G(b,c,d)+buffer_[k]+0x5a827999,s); + function(A,B,C,D, 0, 3); + function(D,A,B,C, 4, 5); + function(C,D,A,B, 8, 9); + function(B,C,D,A,12,13); + function(A,B,C,D, 1, 3); + function(D,A,B,C, 5, 5); + function(C,D,A,B, 9, 9); + function(B,C,D,A,13,13); + function(A,B,C,D, 2, 3); + function(D,A,B,C, 6, 5); + function(C,D,A,B,10, 9); + function(B,C,D,A,14,13); + function(A,B,C,D, 3, 3); + function(D,A,B,C, 7, 5); + function(C,D,A,B,11, 9); + function(B,C,D,A,15,13); + +#undef function +#define function(a,b,c,d,k,s) a=rotlFixed(a+H(b,c,d)+buffer_[k]+0x6ed9eba1,s); + function(A,B,C,D, 0, 3); + function(D,A,B,C, 8, 9); + function(C,D,A,B, 4,11); + function(B,C,D,A,12,15); + function(A,B,C,D, 2, 3); + function(D,A,B,C,10, 9); + function(C,D,A,B, 6,11); + function(B,C,D,A,14,15); + function(A,B,C,D, 1, 3); + function(D,A,B,C, 9, 9); + function(C,D,A,B, 5,11); + function(B,C,D,A,13,15); + function(A,B,C,D, 3, 3); + function(D,A,B,C,11, 9); + function(C,D,A,B, 7,11); + function(B,C,D,A,15,15); + + digest_[0] += A; + digest_[1] += B; + digest_[2] += C; + digest_[3] += D; +} + + +} // namespace + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/md5.cpp b/externals/mysql/extlib/yassl/taocrypt/src/md5.cpp new file mode 100644 index 0000000..f18e029 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/md5.cpp @@ -0,0 +1,498 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* based on Wei Dai's md5.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "md5.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + + +namespace TaoCrypt { + +void MD5::Init() +{ + digest_[0] = 0x67452301L; + digest_[1] = 0xefcdab89L; + digest_[2] = 0x98badcfeL; + digest_[3] = 0x10325476L; + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + + +MD5::MD5(const MD5& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32), + BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + +MD5& MD5::operator= (const MD5& that) +{ + MD5 tmp(that); + Swap(tmp); + + return *this; +} + + +void MD5::Swap(MD5& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + + +#ifdef DO_MD5_ASM + +// Update digest with data of size len +void MD5::Update(const byte* data, word32 len) +{ + if (!isMMX) { + HASHwithTransform::Update(data, len); + return; + } + + byte* local = reinterpret_cast(buffer_); + + // remove buffered data if possible + if (buffLen_) { + word32 add = min(len, BLOCK_SIZE - buffLen_); + memcpy(&local[buffLen_], data, add); + + buffLen_ += add; + data += add; + len -= add; + + if (buffLen_ == BLOCK_SIZE) { + Transform(); + AddLength(BLOCK_SIZE); + buffLen_ = 0; + } + } + + // at once for asm + if (buffLen_ == 0) { + word32 times = len / BLOCK_SIZE; + if (times) { + AsmTransform(data, times); + const word32 add = BLOCK_SIZE * times; + AddLength(add); + len -= add; + data += add; + } + } + + // cache any data left + if (len) { + memcpy(&local[buffLen_], data, len); + buffLen_ += len; + } +} + + + + +/* + // w = rotlFixed(w + f(x, y, z) + index[edi] + data, s) + x +#define ASMMD5STEP(f, w, x, y, z, index, data, s) \ + f(x, y, z) \ + AS2( mov ebp, [edi + index * 4] ) \ + AS2( lea w, [esi + w + data] ) \ + AS2( add w, ebp ) \ + AS2( rol w, s ) \ + AS2( add w, x ) + + + // F1(x, y, z) (z ^ (x & (y ^ z))) + // place in esi +#define ASMF1(x, y, z) \ + AS2( mov esi, y ) \ + AS2( xor esi, z ) \ + AS2( and esi, x ) \ + AS2( xor esi, z ) + + +#define ASMF2(x, y, z) ASMF1(z, x, y) + + + // F3(x ^ y ^ z) + // place in esi +#define ASMF3(x, y, z) \ + AS2( mov esi, x ) \ + AS2( xor esi, y ) \ + AS2( xor esi, z ) + + + + // F4(x, y, z) (y ^ (x | ~z)) + // place in esi +#define ASMF4(x, y, z) \ + AS2( mov esi, z ) \ + AS1( not esi ) \ + AS2( or esi, x ) \ + AS2( xor esi, y ) +*/ + + + // combine above ASMMD5STEP(f w/ each f ASMF1 - F4 + + // esi already set up, after using set for next round + // ebp already set up, set up using next round index + +#define MD5STEP1(w, x, y, z, index, data, s) \ + AS2( xor esi, z ) \ + AS2( and esi, x ) \ + AS2( lea w, [ebp + w + data] ) \ + AS2( xor esi, z ) \ + AS2( add w, esi ) \ + AS2( mov esi, x ) \ + AS2( rol w, s ) \ + AS2( mov ebp, [edi + index * 4] ) \ + AS2( add w, x ) + +#define MD5STEP2(w, x, y, z, index, data, s) \ + AS2( xor esi, x ) \ + AS2( and esi, z ) \ + AS2( lea w, [ebp + w + data] ) \ + AS2( xor esi, y ) \ + AS2( add w, esi ) \ + AS2( mov esi, x ) \ + AS2( rol w, s ) \ + AS2( mov ebp, [edi + index * 4] ) \ + AS2( add w, x ) + + +#define MD5STEP3(w, x, y, z, index, data, s) \ + AS2( xor esi, z ) \ + AS2( lea w, [ebp + w + data] ) \ + AS2( xor esi, x ) \ + AS2( add w, esi ) \ + AS2( mov esi, x ) \ + AS2( rol w, s ) \ + AS2( mov ebp, [edi + index * 4] ) \ + AS2( add w, x ) + + +#define MD5STEP4(w, x, y, z, index, data, s) \ + AS2( or esi, x ) \ + AS2( lea w, [ebp + w + data] ) \ + AS2( xor esi, y ) \ + AS2( add w, esi ) \ + AS2( mov esi, y ) \ + AS2( rol w, s ) \ + AS1( not esi ) \ + AS2( mov ebp, [edi + index * 4] ) \ + AS2( add w, x ) + + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void MD5::AsmTransform(const byte* data, word32 times) +{ +#ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + #define PROLOG() \ + asm(".intel_syntax noprefix"); \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov ecx, DWORD PTR [ebp + 8] ) \ + AS2( mov edi, DWORD PTR [ebp + 12] ) \ + AS2( mov eax, DWORD PTR [ebp + 16] ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( mov esp, ebp ) \ + AS2( movd edi, mm3 ) \ + AS1( emms ) \ + asm(".att_syntax"); +#else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov edi, DWORD PTR [ebp + 8] ) \ + AS2( mov eax, DWORD PTR [ebp + 12] ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 8 ) + +#endif + + + PROLOG() + + AS2( mov esi, ecx ) + + #ifdef OLD_GCC_OFFSET + AS2( add esi, 20 ) // digest_[0] + #else + AS2( add esi, 16 ) // digest_[0] + #endif + + AS2( movd mm2, eax ) // store times_ + AS2( movd mm1, esi ) // store digest_ + + AS2( mov eax, [esi] ) // a + AS2( mov ebx, [esi + 4] ) // b + AS2( mov ecx, [esi + 8] ) // c + AS2( mov edx, [esi + 12] ) // d + +AS1(loopStart:) + + // set up + AS2( mov esi, ecx ) + AS2( mov ebp, [edi] ) + + MD5STEP1( eax, ebx, ecx, edx, 1, 0xd76aa478, 7) + MD5STEP1( edx, eax, ebx, ecx, 2, 0xe8c7b756, 12) + MD5STEP1( ecx, edx, eax, ebx, 3, 0x242070db, 17) + MD5STEP1( ebx, ecx, edx, eax, 4, 0xc1bdceee, 22) + MD5STEP1( eax, ebx, ecx, edx, 5, 0xf57c0faf, 7) + MD5STEP1( edx, eax, ebx, ecx, 6, 0x4787c62a, 12) + MD5STEP1( ecx, edx, eax, ebx, 7, 0xa8304613, 17) + MD5STEP1( ebx, ecx, edx, eax, 8, 0xfd469501, 22) + MD5STEP1( eax, ebx, ecx, edx, 9, 0x698098d8, 7) + MD5STEP1( edx, eax, ebx, ecx, 10, 0x8b44f7af, 12) + MD5STEP1( ecx, edx, eax, ebx, 11, 0xffff5bb1, 17) + MD5STEP1( ebx, ecx, edx, eax, 12, 0x895cd7be, 22) + MD5STEP1( eax, ebx, ecx, edx, 13, 0x6b901122, 7) + MD5STEP1( edx, eax, ebx, ecx, 14, 0xfd987193, 12) + MD5STEP1( ecx, edx, eax, ebx, 15, 0xa679438e, 17) + MD5STEP1( ebx, ecx, edx, eax, 1, 0x49b40821, 22) + + MD5STEP2( eax, ebx, ecx, edx, 6, 0xf61e2562, 5) + MD5STEP2( edx, eax, ebx, ecx, 11, 0xc040b340, 9) + MD5STEP2( ecx, edx, eax, ebx, 0, 0x265e5a51, 14) + MD5STEP2( ebx, ecx, edx, eax, 5, 0xe9b6c7aa, 20) + MD5STEP2( eax, ebx, ecx, edx, 10, 0xd62f105d, 5) + MD5STEP2( edx, eax, ebx, ecx, 15, 0x02441453, 9) + MD5STEP2( ecx, edx, eax, ebx, 4, 0xd8a1e681, 14) + MD5STEP2( ebx, ecx, edx, eax, 9, 0xe7d3fbc8, 20) + MD5STEP2( eax, ebx, ecx, edx, 14, 0x21e1cde6, 5) + MD5STEP2( edx, eax, ebx, ecx, 3, 0xc33707d6, 9) + MD5STEP2( ecx, edx, eax, ebx, 8, 0xf4d50d87, 14) + MD5STEP2( ebx, ecx, edx, eax, 13, 0x455a14ed, 20) + MD5STEP2( eax, ebx, ecx, edx, 2, 0xa9e3e905, 5) + MD5STEP2( edx, eax, ebx, ecx, 7, 0xfcefa3f8, 9) + MD5STEP2( ecx, edx, eax, ebx, 12, 0x676f02d9, 14) + MD5STEP2( ebx, ecx, edx, eax, 5, 0x8d2a4c8a, 20) + + MD5STEP3( eax, ebx, ecx, edx, 8, 0xfffa3942, 4) + MD5STEP3( edx, eax, ebx, ecx, 11, 0x8771f681, 11) + MD5STEP3( ecx, edx, eax, ebx, 14, 0x6d9d6122, 16) + MD5STEP3( ebx, ecx, edx, eax, 1, 0xfde5380c, 23) + MD5STEP3( eax, ebx, ecx, edx, 4, 0xa4beea44, 4) + MD5STEP3( edx, eax, ebx, ecx, 7, 0x4bdecfa9, 11) + MD5STEP3( ecx, edx, eax, ebx, 10, 0xf6bb4b60, 16) + MD5STEP3( ebx, ecx, edx, eax, 13, 0xbebfbc70, 23) + MD5STEP3( eax, ebx, ecx, edx, 0, 0x289b7ec6, 4) + MD5STEP3( edx, eax, ebx, ecx, 3, 0xeaa127fa, 11) + MD5STEP3( ecx, edx, eax, ebx, 6, 0xd4ef3085, 16) + MD5STEP3( ebx, ecx, edx, eax, 9, 0x04881d05, 23) + MD5STEP3( eax, ebx, ecx, edx, 12, 0xd9d4d039, 4) + MD5STEP3( edx, eax, ebx, ecx, 15, 0xe6db99e5, 11) + MD5STEP3( ecx, edx, eax, ebx, 2, 0x1fa27cf8, 16) + MD5STEP3( ebx, ecx, edx, eax, 0, 0xc4ac5665, 23) + + // setup + AS2( mov esi, edx ) + AS1( not esi ) + + MD5STEP4( eax, ebx, ecx, edx, 7, 0xf4292244, 6) + MD5STEP4( edx, eax, ebx, ecx, 14, 0x432aff97, 10) + MD5STEP4( ecx, edx, eax, ebx, 5, 0xab9423a7, 15) + MD5STEP4( ebx, ecx, edx, eax, 12, 0xfc93a039, 21) + MD5STEP4( eax, ebx, ecx, edx, 3, 0x655b59c3, 6) + MD5STEP4( edx, eax, ebx, ecx, 10, 0x8f0ccc92, 10) + MD5STEP4( ecx, edx, eax, ebx, 1, 0xffeff47d, 15) + MD5STEP4( ebx, ecx, edx, eax, 8, 0x85845dd1, 21) + MD5STEP4( eax, ebx, ecx, edx, 15, 0x6fa87e4f, 6) + MD5STEP4( edx, eax, ebx, ecx, 6, 0xfe2ce6e0, 10) + MD5STEP4( ecx, edx, eax, ebx, 13, 0xa3014314, 15) + MD5STEP4( ebx, ecx, edx, eax, 4, 0x4e0811a1, 21) + MD5STEP4( eax, ebx, ecx, edx, 11, 0xf7537e82, 6) + MD5STEP4( edx, eax, ebx, ecx, 2, 0xbd3af235, 10) + MD5STEP4( ecx, edx, eax, ebx, 9, 0x2ad7d2bb, 15) + MD5STEP4( ebx, ecx, edx, eax, 9, 0xeb86d391, 21) + + AS2( movd esi, mm1 ) // digest_ + + AS2( add [esi], eax ) // write out + AS2( add [esi + 4], ebx ) + AS2( add [esi + 8], ecx ) + AS2( add [esi + 12], edx ) + + AS2( add edi, 64 ) + + AS2( mov eax, [esi] ) + AS2( mov ebx, [esi + 4] ) + AS2( mov ecx, [esi + 8] ) + AS2( mov edx, [esi + 12] ) + + AS2( movd ebp, mm2 ) // times + AS1( dec ebp ) + AS2( movd mm2, ebp ) + AS1( jnz loopStart ) + + + EPILOG() +} + + +#endif // DO_MD5_ASM + + +void MD5::Transform() +{ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +#define MD5STEP(f, w, x, y, z, data, s) \ + w = rotlFixed(w + f(x, y, z) + data, s) + x + + // Copy context->state[] to working vars + word32 a = digest_[0]; + word32 b = digest_[1]; + word32 c = digest_[2]; + word32 d = digest_[3]; + + MD5STEP(F1, a, b, c, d, buffer_[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, buffer_[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, buffer_[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, buffer_[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, buffer_[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, buffer_[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, buffer_[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, buffer_[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, buffer_[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, buffer_[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, buffer_[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, buffer_[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, buffer_[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, buffer_[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, buffer_[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, buffer_[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, buffer_[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, buffer_[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, buffer_[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, buffer_[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, buffer_[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, buffer_[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, buffer_[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, buffer_[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, buffer_[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, buffer_[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, buffer_[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, buffer_[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, buffer_[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, buffer_[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, buffer_[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, buffer_[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, buffer_[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, buffer_[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, buffer_[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, buffer_[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, buffer_[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, buffer_[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, buffer_[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, buffer_[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, buffer_[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, buffer_[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, buffer_[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, buffer_[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, buffer_[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, buffer_[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, buffer_[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, buffer_[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, buffer_[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, buffer_[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, buffer_[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, buffer_[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, buffer_[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, buffer_[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, buffer_[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, buffer_[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, buffer_[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, buffer_[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, buffer_[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, buffer_[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, buffer_[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, buffer_[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, buffer_[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, buffer_[9] + 0xeb86d391, 21); + + // Add the working vars back into digest state[] + digest_[0] += a; + digest_[1] += b; + digest_[2] += c; + digest_[3] += d; + + // Wipe variables + a = b = c = d = 0; +} + + +} // namespace + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/misc.cpp b/externals/mysql/extlib/yassl/taocrypt/src/misc.cpp new file mode 100644 index 0000000..402645c --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/misc.cpp @@ -0,0 +1,296 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's misc.cpp from CryptoPP */ + + +#include "runtime.hpp" +#include "misc.hpp" + + +#ifdef __GNUC__ + #include + #include +#endif + +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + +namespace STL = STL_NAMESPACE; + + +#ifdef YASSL_PURE_C + + void* operator new(size_t sz, TaoCrypt::new_t) + { + void* ptr = malloc(sz ? sz : 1); + if (!ptr) abort(); + + return ptr; + } + + + void operator delete(void* ptr, TaoCrypt::new_t) + { + if (ptr) free(ptr); + } + + + void* operator new[](size_t sz, TaoCrypt::new_t nt) + { + return ::operator new(sz, nt); + } + + + void operator delete[](void* ptr, TaoCrypt::new_t nt) + { + ::operator delete(ptr, nt); + } + + + /* uncomment to test + // make sure not using globals anywhere by forgetting to use overloaded + void* operator new(size_t sz); + + void operator delete(void* ptr); + + void* operator new[](size_t sz); + + void operator delete[](void* ptr); + */ + + + namespace TaoCrypt { + + new_t tc; // for library new + + } + +#if defined(__ICC) || defined(__INTEL_COMPILER) + +extern "C" { + + int __cxa_pure_virtual() { + assert("Pure virtual method called." == "Aborted"); + return 0; + } + +} // extern "C" + +#endif + +#endif // YASSL_PURE_C + + +namespace TaoCrypt { + + +inline void XorWords(word* r, const word* a, unsigned int n) +{ + for (unsigned int i=0; i> (i-1)*8) + break; + + return i; +} + + +unsigned int BitPrecision(word value) +{ + if (!value) + return 0; + + unsigned int l = 0, + h = 8 * sizeof(value); + + while (h-l > 1) + { + unsigned int t = (l+h)/2; + if (value >> t) + l = t; + else + h = t; + } + + return h; +} + + +word Crop(word value, unsigned int size) +{ + if (size < 8*sizeof(value)) + return (value & ((1L << size) - 1)); + else + return value; +} + + + +#ifdef TAOCRYPT_X86ASM_AVAILABLE + +#ifndef _MSC_VER + static jmp_buf s_env; + static void SigIllHandler(int) + { + longjmp(s_env, 1); + } +#endif + + +bool HaveCpuId() +{ +#ifdef _MSC_VER + __try + { + __asm + { + mov eax, 0 + cpuid + } + } + __except (1) + { + return false; + } + return true; +#else + word32 eax, ebx; + __asm__ __volatile + ( + /* Put EFLAGS in eax and ebx */ + "pushf;" + "pushf;" + "pop %0;" + "movl %0,%1;" + + /* Flip the cpuid bit and store back in EFLAGS */ + "xorl $0x200000,%0;" + "push %0;" + "popf;" + + /* Read EFLAGS again */ + "pushf;" + "pop %0;" + "popf" + : "=r" (eax), "=r" (ebx) + : + : "cc" + ); + + if (eax == ebx) + return false; + return true; +#endif +} + + +void CpuId(word32 input, word32 *output) +{ +#ifdef __GNUC__ + __asm__ + ( + // save ebx in case -fPIC is being used + "push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx" + : "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d"(output[3]) + : "a" (input) + ); +#else + __asm + { + mov eax, input + cpuid + mov edi, output + mov [edi], eax + mov [edi+4], ebx + mov [edi+8], ecx + mov [edi+12], edx + } +#endif +} + + +bool IsPentium() +{ + if (!HaveCpuId()) + return false; + + word32 cpuid[4]; + + CpuId(0, cpuid); + STL::swap(cpuid[2], cpuid[3]); + if (memcmp(cpuid+1, "GenuineIntel", 12) != 0) + return false; + + CpuId(1, cpuid); + byte family = ((cpuid[0] >> 8) & 0xf); + if (family < 5) + return false; + + return true; +} + + + +static bool IsMmx() +{ + if (!IsPentium()) + return false; + + word32 cpuid[4]; + + CpuId(1, cpuid); + if ((cpuid[3] & (1 << 23)) == 0) + return false; + + return true; +} + + +bool isMMX = IsMmx(); + + +#endif // TAOCRYPT_X86ASM_AVAILABLE + + + + +} // namespace + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/random.cpp b/externals/mysql/extlib/yassl/taocrypt/src/random.cpp new file mode 100644 index 0000000..89fd5f7 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/random.cpp @@ -0,0 +1,200 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* random.cpp implements a crypto secure Random Number Generator using an OS + specific seed, switch to /dev/random for more security but may block +*/ + +#include "runtime.hpp" +#include "random.hpp" +#include +#include + +#if defined(_WIN32) + #define _WIN32_WINNT 0x0400 + #include + #include +#else + #include + #include + #include +#endif // _WIN32 + +namespace TaoCrypt { + + +// Get seed and key cipher +RandomNumberGenerator::RandomNumberGenerator() +{ + byte key[32]; + byte junk[256]; + + seed_.GenerateSeed(key, sizeof(key)); + cipher_.SetKey(key, sizeof(key)); + GenerateBlock(junk, sizeof(junk)); // rid initial state +} + + +// place a generated block in output +void RandomNumberGenerator::GenerateBlock(byte* output, word32 sz) +{ + memset(output, 0, sz); + cipher_.Process(output, output, sz); +} + + +byte RandomNumberGenerator::GenerateByte() +{ + byte b; + GenerateBlock(&b, 1); + + return b; +} + + +#if defined(_WIN32) + +/* The OS_Seed implementation for windows */ + +OS_Seed::OS_Seed() +{ + if(!CryptAcquireContext(&handle_, 0, 0, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT)) + error_.SetError(WINCRYPT_E); +} + + +OS_Seed::~OS_Seed() +{ + CryptReleaseContext(handle_, 0); +} + + +void OS_Seed::GenerateSeed(byte* output, word32 sz) +{ + if (!CryptGenRandom(handle_, sz, output)) + error_.SetError(CRYPTGEN_E); +} + + +#elif defined(__NETWARE__) + +/* The OS_Seed implementation for Netware */ + +#include +#include + +// Loop on high resulution Read Time Stamp Counter +static void NetwareSeed(byte* output, word32 sz) +{ + word32 tscResult; + + for (word32 i = 0; i < sz; i += sizeof(tscResult)) { + #if defined(__GNUC__) + asm volatile("rdtsc" : "=A" (tscResult)); + #else + #ifdef __MWERKS__ + asm { + #else + __asm { + #endif + rdtsc + mov tscResult, eax + } + #endif + + memcpy(output, &tscResult, sizeof(tscResult)); + output += sizeof(tscResult); + + NXThreadYield(); // induce more variance + } +} + + +OS_Seed::OS_Seed() +{ +} + + +OS_Seed::~OS_Seed() +{ +} + + +void OS_Seed::GenerateSeed(byte* output, word32 sz) +{ + /* + Try to use NXSeedRandom as it will generate a strong + seed using the onboard 82802 chip + + As it's not always supported, fallback to default + implementation if an error is returned + */ + + if (NXSeedRandom(sz, output) != 0) + { + NetwareSeed(output, sz); + } +} + + +#else + +/* The default OS_Seed implementation */ + +OS_Seed::OS_Seed() +{ + fd_ = open("/dev/urandom",O_RDONLY); + if (fd_ == -1) { + fd_ = open("/dev/random",O_RDONLY); + if (fd_ == -1) + error_.SetError(OPEN_RAN_E); + } +} + + +OS_Seed::~OS_Seed() +{ + close(fd_); +} + + +// may block +void OS_Seed::GenerateSeed(byte* output, word32 sz) +{ + while (sz) { + int len = read(fd_, output, sz); + if (len == -1) { + error_.SetError(READ_RAN_E); + return; + } + + sz -= len; + output += len; + + if (sz) + sleep(1); + } +} + +#endif // _WIN32 + + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/ripemd.cpp b/externals/mysql/extlib/yassl/taocrypt/src/ripemd.cpp new file mode 100644 index 0000000..a738c19 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/ripemd.cpp @@ -0,0 +1,834 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* based on Wei Dai's ripemd.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "ripemd.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + + +namespace TaoCrypt { + +void RIPEMD160::Init() +{ + digest_[0] = 0x67452301L; + digest_[1] = 0xefcdab89L; + digest_[2] = 0x98badcfeL; + digest_[3] = 0x10325476L; + digest_[4] = 0xc3d2e1f0L; + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + + +RIPEMD160::RIPEMD160(const RIPEMD160& that) + : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + + +RIPEMD160& RIPEMD160::operator= (const RIPEMD160& that) +{ + RIPEMD160 tmp(that); + Swap(tmp); + + return *this; +} + + +void RIPEMD160::Swap(RIPEMD160& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + + +#ifdef DO_RIPEMD_ASM + +// Update digest with data of size len +void RIPEMD160::Update(const byte* data, word32 len) +{ + if (!isMMX) { + HASHwithTransform::Update(data, len); + return; + } + + byte* local = reinterpret_cast(buffer_); + + // remove buffered data if possible + if (buffLen_) { + word32 add = min(len, BLOCK_SIZE - buffLen_); + memcpy(&local[buffLen_], data, add); + + buffLen_ += add; + data += add; + len -= add; + + if (buffLen_ == BLOCK_SIZE) { + Transform(); + AddLength(BLOCK_SIZE); + buffLen_ = 0; + } + } + + // all at once for asm + if (buffLen_ == 0) { + word32 times = len / BLOCK_SIZE; + if (times) { + AsmTransform(data, times); + const word32 add = BLOCK_SIZE * times; + AddLength(add); + len -= add; + data += add; + } + } + + // cache any data left + if (len) { + memcpy(&local[buffLen_], data, len); + buffLen_ += len; + } +} + +#endif // DO_RIPEMD_ASM + + +// for all +#define F(x, y, z) (x ^ y ^ z) +#define G(x, y, z) (z ^ (x & (y^z))) +#define H(x, y, z) (z ^ (x | ~y)) +#define I(x, y, z) (y ^ (z & (x^y))) +#define J(x, y, z) (x ^ (y | ~z)) + +#define k0 0 +#define k1 0x5a827999 +#define k2 0x6ed9eba1 +#define k3 0x8f1bbcdc +#define k4 0xa953fd4e +#define k5 0x50a28be6 +#define k6 0x5c4dd124 +#define k7 0x6d703ef3 +#define k8 0x7a6d76e9 +#define k9 0 + +// for 160 and 320 +#define Subround(f, a, b, c, d, e, x, s, k) \ + a += f(b, c, d) + x + k;\ + a = rotlFixed((word32)a, s) + e;\ + c = rotlFixed((word32)c, 10U) + + +void RIPEMD160::Transform() +{ + unsigned long a1, b1, c1, d1, e1, a2, b2, c2, d2, e2; + a1 = a2 = digest_[0]; + b1 = b2 = digest_[1]; + c1 = c2 = digest_[2]; + d1 = d2 = digest_[3]; + e1 = e2 = digest_[4]; + + Subround(F, a1, b1, c1, d1, e1, buffer_[ 0], 11, k0); + Subround(F, e1, a1, b1, c1, d1, buffer_[ 1], 14, k0); + Subround(F, d1, e1, a1, b1, c1, buffer_[ 2], 15, k0); + Subround(F, c1, d1, e1, a1, b1, buffer_[ 3], 12, k0); + Subround(F, b1, c1, d1, e1, a1, buffer_[ 4], 5, k0); + Subround(F, a1, b1, c1, d1, e1, buffer_[ 5], 8, k0); + Subround(F, e1, a1, b1, c1, d1, buffer_[ 6], 7, k0); + Subround(F, d1, e1, a1, b1, c1, buffer_[ 7], 9, k0); + Subround(F, c1, d1, e1, a1, b1, buffer_[ 8], 11, k0); + Subround(F, b1, c1, d1, e1, a1, buffer_[ 9], 13, k0); + Subround(F, a1, b1, c1, d1, e1, buffer_[10], 14, k0); + Subround(F, e1, a1, b1, c1, d1, buffer_[11], 15, k0); + Subround(F, d1, e1, a1, b1, c1, buffer_[12], 6, k0); + Subround(F, c1, d1, e1, a1, b1, buffer_[13], 7, k0); + Subround(F, b1, c1, d1, e1, a1, buffer_[14], 9, k0); + Subround(F, a1, b1, c1, d1, e1, buffer_[15], 8, k0); + + Subround(G, e1, a1, b1, c1, d1, buffer_[ 7], 7, k1); + Subround(G, d1, e1, a1, b1, c1, buffer_[ 4], 6, k1); + Subround(G, c1, d1, e1, a1, b1, buffer_[13], 8, k1); + Subround(G, b1, c1, d1, e1, a1, buffer_[ 1], 13, k1); + Subround(G, a1, b1, c1, d1, e1, buffer_[10], 11, k1); + Subround(G, e1, a1, b1, c1, d1, buffer_[ 6], 9, k1); + Subround(G, d1, e1, a1, b1, c1, buffer_[15], 7, k1); + Subround(G, c1, d1, e1, a1, b1, buffer_[ 3], 15, k1); + Subround(G, b1, c1, d1, e1, a1, buffer_[12], 7, k1); + Subround(G, a1, b1, c1, d1, e1, buffer_[ 0], 12, k1); + Subround(G, e1, a1, b1, c1, d1, buffer_[ 9], 15, k1); + Subround(G, d1, e1, a1, b1, c1, buffer_[ 5], 9, k1); + Subround(G, c1, d1, e1, a1, b1, buffer_[ 2], 11, k1); + Subround(G, b1, c1, d1, e1, a1, buffer_[14], 7, k1); + Subround(G, a1, b1, c1, d1, e1, buffer_[11], 13, k1); + Subround(G, e1, a1, b1, c1, d1, buffer_[ 8], 12, k1); + + Subround(H, d1, e1, a1, b1, c1, buffer_[ 3], 11, k2); + Subround(H, c1, d1, e1, a1, b1, buffer_[10], 13, k2); + Subround(H, b1, c1, d1, e1, a1, buffer_[14], 6, k2); + Subround(H, a1, b1, c1, d1, e1, buffer_[ 4], 7, k2); + Subround(H, e1, a1, b1, c1, d1, buffer_[ 9], 14, k2); + Subround(H, d1, e1, a1, b1, c1, buffer_[15], 9, k2); + Subround(H, c1, d1, e1, a1, b1, buffer_[ 8], 13, k2); + Subround(H, b1, c1, d1, e1, a1, buffer_[ 1], 15, k2); + Subround(H, a1, b1, c1, d1, e1, buffer_[ 2], 14, k2); + Subround(H, e1, a1, b1, c1, d1, buffer_[ 7], 8, k2); + Subround(H, d1, e1, a1, b1, c1, buffer_[ 0], 13, k2); + Subround(H, c1, d1, e1, a1, b1, buffer_[ 6], 6, k2); + Subround(H, b1, c1, d1, e1, a1, buffer_[13], 5, k2); + Subround(H, a1, b1, c1, d1, e1, buffer_[11], 12, k2); + Subround(H, e1, a1, b1, c1, d1, buffer_[ 5], 7, k2); + Subround(H, d1, e1, a1, b1, c1, buffer_[12], 5, k2); + + Subround(I, c1, d1, e1, a1, b1, buffer_[ 1], 11, k3); + Subround(I, b1, c1, d1, e1, a1, buffer_[ 9], 12, k3); + Subround(I, a1, b1, c1, d1, e1, buffer_[11], 14, k3); + Subround(I, e1, a1, b1, c1, d1, buffer_[10], 15, k3); + Subround(I, d1, e1, a1, b1, c1, buffer_[ 0], 14, k3); + Subround(I, c1, d1, e1, a1, b1, buffer_[ 8], 15, k3); + Subround(I, b1, c1, d1, e1, a1, buffer_[12], 9, k3); + Subround(I, a1, b1, c1, d1, e1, buffer_[ 4], 8, k3); + Subround(I, e1, a1, b1, c1, d1, buffer_[13], 9, k3); + Subround(I, d1, e1, a1, b1, c1, buffer_[ 3], 14, k3); + Subround(I, c1, d1, e1, a1, b1, buffer_[ 7], 5, k3); + Subround(I, b1, c1, d1, e1, a1, buffer_[15], 6, k3); + Subround(I, a1, b1, c1, d1, e1, buffer_[14], 8, k3); + Subround(I, e1, a1, b1, c1, d1, buffer_[ 5], 6, k3); + Subround(I, d1, e1, a1, b1, c1, buffer_[ 6], 5, k3); + Subround(I, c1, d1, e1, a1, b1, buffer_[ 2], 12, k3); + + Subround(J, b1, c1, d1, e1, a1, buffer_[ 4], 9, k4); + Subround(J, a1, b1, c1, d1, e1, buffer_[ 0], 15, k4); + Subround(J, e1, a1, b1, c1, d1, buffer_[ 5], 5, k4); + Subround(J, d1, e1, a1, b1, c1, buffer_[ 9], 11, k4); + Subround(J, c1, d1, e1, a1, b1, buffer_[ 7], 6, k4); + Subround(J, b1, c1, d1, e1, a1, buffer_[12], 8, k4); + Subround(J, a1, b1, c1, d1, e1, buffer_[ 2], 13, k4); + Subround(J, e1, a1, b1, c1, d1, buffer_[10], 12, k4); + Subround(J, d1, e1, a1, b1, c1, buffer_[14], 5, k4); + Subround(J, c1, d1, e1, a1, b1, buffer_[ 1], 12, k4); + Subround(J, b1, c1, d1, e1, a1, buffer_[ 3], 13, k4); + Subround(J, a1, b1, c1, d1, e1, buffer_[ 8], 14, k4); + Subround(J, e1, a1, b1, c1, d1, buffer_[11], 11, k4); + Subround(J, d1, e1, a1, b1, c1, buffer_[ 6], 8, k4); + Subround(J, c1, d1, e1, a1, b1, buffer_[15], 5, k4); + Subround(J, b1, c1, d1, e1, a1, buffer_[13], 6, k4); + + Subround(J, a2, b2, c2, d2, e2, buffer_[ 5], 8, k5); + Subround(J, e2, a2, b2, c2, d2, buffer_[14], 9, k5); + Subround(J, d2, e2, a2, b2, c2, buffer_[ 7], 9, k5); + Subround(J, c2, d2, e2, a2, b2, buffer_[ 0], 11, k5); + Subround(J, b2, c2, d2, e2, a2, buffer_[ 9], 13, k5); + Subround(J, a2, b2, c2, d2, e2, buffer_[ 2], 15, k5); + Subround(J, e2, a2, b2, c2, d2, buffer_[11], 15, k5); + Subround(J, d2, e2, a2, b2, c2, buffer_[ 4], 5, k5); + Subround(J, c2, d2, e2, a2, b2, buffer_[13], 7, k5); + Subround(J, b2, c2, d2, e2, a2, buffer_[ 6], 7, k5); + Subround(J, a2, b2, c2, d2, e2, buffer_[15], 8, k5); + Subround(J, e2, a2, b2, c2, d2, buffer_[ 8], 11, k5); + Subround(J, d2, e2, a2, b2, c2, buffer_[ 1], 14, k5); + Subround(J, c2, d2, e2, a2, b2, buffer_[10], 14, k5); + Subround(J, b2, c2, d2, e2, a2, buffer_[ 3], 12, k5); + Subround(J, a2, b2, c2, d2, e2, buffer_[12], 6, k5); + + Subround(I, e2, a2, b2, c2, d2, buffer_[ 6], 9, k6); + Subround(I, d2, e2, a2, b2, c2, buffer_[11], 13, k6); + Subround(I, c2, d2, e2, a2, b2, buffer_[ 3], 15, k6); + Subround(I, b2, c2, d2, e2, a2, buffer_[ 7], 7, k6); + Subround(I, a2, b2, c2, d2, e2, buffer_[ 0], 12, k6); + Subround(I, e2, a2, b2, c2, d2, buffer_[13], 8, k6); + Subround(I, d2, e2, a2, b2, c2, buffer_[ 5], 9, k6); + Subround(I, c2, d2, e2, a2, b2, buffer_[10], 11, k6); + Subround(I, b2, c2, d2, e2, a2, buffer_[14], 7, k6); + Subround(I, a2, b2, c2, d2, e2, buffer_[15], 7, k6); + Subround(I, e2, a2, b2, c2, d2, buffer_[ 8], 12, k6); + Subround(I, d2, e2, a2, b2, c2, buffer_[12], 7, k6); + Subround(I, c2, d2, e2, a2, b2, buffer_[ 4], 6, k6); + Subround(I, b2, c2, d2, e2, a2, buffer_[ 9], 15, k6); + Subround(I, a2, b2, c2, d2, e2, buffer_[ 1], 13, k6); + Subround(I, e2, a2, b2, c2, d2, buffer_[ 2], 11, k6); + + Subround(H, d2, e2, a2, b2, c2, buffer_[15], 9, k7); + Subround(H, c2, d2, e2, a2, b2, buffer_[ 5], 7, k7); + Subround(H, b2, c2, d2, e2, a2, buffer_[ 1], 15, k7); + Subround(H, a2, b2, c2, d2, e2, buffer_[ 3], 11, k7); + Subround(H, e2, a2, b2, c2, d2, buffer_[ 7], 8, k7); + Subround(H, d2, e2, a2, b2, c2, buffer_[14], 6, k7); + Subround(H, c2, d2, e2, a2, b2, buffer_[ 6], 6, k7); + Subround(H, b2, c2, d2, e2, a2, buffer_[ 9], 14, k7); + Subround(H, a2, b2, c2, d2, e2, buffer_[11], 12, k7); + Subround(H, e2, a2, b2, c2, d2, buffer_[ 8], 13, k7); + Subround(H, d2, e2, a2, b2, c2, buffer_[12], 5, k7); + Subround(H, c2, d2, e2, a2, b2, buffer_[ 2], 14, k7); + Subround(H, b2, c2, d2, e2, a2, buffer_[10], 13, k7); + Subround(H, a2, b2, c2, d2, e2, buffer_[ 0], 13, k7); + Subround(H, e2, a2, b2, c2, d2, buffer_[ 4], 7, k7); + Subround(H, d2, e2, a2, b2, c2, buffer_[13], 5, k7); + + Subround(G, c2, d2, e2, a2, b2, buffer_[ 8], 15, k8); + Subround(G, b2, c2, d2, e2, a2, buffer_[ 6], 5, k8); + Subround(G, a2, b2, c2, d2, e2, buffer_[ 4], 8, k8); + Subround(G, e2, a2, b2, c2, d2, buffer_[ 1], 11, k8); + Subround(G, d2, e2, a2, b2, c2, buffer_[ 3], 14, k8); + Subround(G, c2, d2, e2, a2, b2, buffer_[11], 14, k8); + Subround(G, b2, c2, d2, e2, a2, buffer_[15], 6, k8); + Subround(G, a2, b2, c2, d2, e2, buffer_[ 0], 14, k8); + Subround(G, e2, a2, b2, c2, d2, buffer_[ 5], 6, k8); + Subround(G, d2, e2, a2, b2, c2, buffer_[12], 9, k8); + Subround(G, c2, d2, e2, a2, b2, buffer_[ 2], 12, k8); + Subround(G, b2, c2, d2, e2, a2, buffer_[13], 9, k8); + Subround(G, a2, b2, c2, d2, e2, buffer_[ 9], 12, k8); + Subround(G, e2, a2, b2, c2, d2, buffer_[ 7], 5, k8); + Subround(G, d2, e2, a2, b2, c2, buffer_[10], 15, k8); + Subround(G, c2, d2, e2, a2, b2, buffer_[14], 8, k8); + + Subround(F, b2, c2, d2, e2, a2, buffer_[12], 8, k9); + Subround(F, a2, b2, c2, d2, e2, buffer_[15], 5, k9); + Subround(F, e2, a2, b2, c2, d2, buffer_[10], 12, k9); + Subround(F, d2, e2, a2, b2, c2, buffer_[ 4], 9, k9); + Subround(F, c2, d2, e2, a2, b2, buffer_[ 1], 12, k9); + Subround(F, b2, c2, d2, e2, a2, buffer_[ 5], 5, k9); + Subround(F, a2, b2, c2, d2, e2, buffer_[ 8], 14, k9); + Subround(F, e2, a2, b2, c2, d2, buffer_[ 7], 6, k9); + Subround(F, d2, e2, a2, b2, c2, buffer_[ 6], 8, k9); + Subround(F, c2, d2, e2, a2, b2, buffer_[ 2], 13, k9); + Subround(F, b2, c2, d2, e2, a2, buffer_[13], 6, k9); + Subround(F, a2, b2, c2, d2, e2, buffer_[14], 5, k9); + Subround(F, e2, a2, b2, c2, d2, buffer_[ 0], 15, k9); + Subround(F, d2, e2, a2, b2, c2, buffer_[ 3], 13, k9); + Subround(F, c2, d2, e2, a2, b2, buffer_[ 9], 11, k9); + Subround(F, b2, c2, d2, e2, a2, buffer_[11], 11, k9); + + c1 = digest_[1] + c1 + d2; + digest_[1] = digest_[2] + d1 + e2; + digest_[2] = digest_[3] + e1 + a2; + digest_[3] = digest_[4] + a1 + b2; + digest_[4] = digest_[0] + b1 + c2; + digest_[0] = c1; +} + + +#ifdef DO_RIPEMD_ASM + +/* + // F(x ^ y ^ z) + // place in esi +#define ASMF(x, y, z) \ + AS2( mov esi, x ) \ + AS2( xor esi, y ) \ + AS2( xor esi, z ) + + + // G(z ^ (x & (y^z))) + // place in esi +#define ASMG(x, y, z) \ + AS2( mov esi, z ) \ + AS2( xor esi, y ) \ + AS2( and esi, x ) \ + AS2( xor esi, z ) + + + // H(z ^ (x | ~y)) + // place in esi +#define ASMH(x, y, z) \ + AS2( mov esi, y ) \ + AS1( not esi ) \ + AS2( or esi, x ) \ + AS2( xor esi, z ) + + + // I(y ^ (z & (x^y))) + // place in esi +#define ASMI(x, y, z) \ + AS2( mov esi, y ) \ + AS2( xor esi, x ) \ + AS2( and esi, z ) \ + AS2( xor esi, y ) + + + // J(x ^ (y | ~z))) + // place in esi +#define ASMJ(x, y, z) \ + AS2( mov esi, z ) \ + AS1( not esi ) \ + AS2( or esi, y ) \ + AS2( xor esi, x ) + + +// for 160 and 320 +// #define ASMSubround(f, a, b, c, d, e, i, s, k) +// a += f(b, c, d) + data[i] + k; +// a = rotlFixed((word32)a, s) + e; +// c = rotlFixed((word32)c, 10U) + +#define ASMSubround(f, a, b, c, d, e, index, s, k) \ + // a += f(b, c, d) + data[i] + k \ + AS2( mov esp, [edi + index * 4] ) \ + f(b, c, d) \ + AS2( add esi, k ) \ + AS2( add esi, esp ) \ + AS2( add a, esi ) \ + // a = rotlFixed((word32)a, s) + e \ + AS2( rol a, s ) \ + AS2( rol c, 10 ) \ + // c = rotlFixed((word32)c, 10U) \ + AS2( add a, e ) +*/ + + +// combine F into subround w/ setup +// esi already has c, setup for next round when done +// esp already has edi[index], setup for next round when done + +#define ASMSubroundF(a, b, c, d, e, index, s) \ + /* a += (b ^ c ^ d) + data[i] + k */ \ + AS2( xor esi, b ) \ + AS2( add a, [edi + index * 4] ) \ + AS2( xor esi, d ) \ + AS2( add a, esi ) \ + /* a = rotlFixed((word32)a, s) + e */ \ + AS2( mov esi, b ) \ + AS2( rol a, s ) \ + /* c = rotlFixed((word32)c, 10U) */ \ + AS2( rol c, 10 ) \ + AS2( add a, e ) + + +// combine G into subround w/ setup +// esi already has c, setup for next round when done +// esp already has edi[index], setup for next round when done + +#define ASMSubroundG(a, b, c, d, e, index, s, k) \ + /* a += (d ^ (b & (c^d))) + data[i] + k */ \ + AS2( xor esi, d ) \ + AS2( and esi, b ) \ + AS2( add a, [edi + index * 4] ) \ + AS2( xor esi, d ) \ + AS2( lea a, [esi + a + k] ) \ + /* a = rotlFixed((word32)a, s) + e */ \ + AS2( mov esi, b ) \ + AS2( rol a, s ) \ + /* c = rotlFixed((word32)c, 10U) */ \ + AS2( rol c, 10 ) \ + AS2( add a, e ) + + +// combine H into subround w/ setup +// esi already has c, setup for next round when done +// esp already has edi[index], setup for next round when done + +#define ASMSubroundH(a, b, c, d, e, index, s, k) \ + /* a += (d ^ (b | ~c)) + data[i] + k */ \ + AS1( not esi ) \ + AS2( or esi, b ) \ + AS2( add a, [edi + index * 4] ) \ + AS2( xor esi, d ) \ + AS2( lea a, [esi + a + k] ) \ + /* a = rotlFixed((word32)a, s) + e */ \ + AS2( mov esi, b ) \ + AS2( rol a, s ) \ + /* c = rotlFixed((word32)c, 10U) */ \ + AS2( rol c, 10 ) \ + AS2( add a, e ) + + +// combine I into subround w/ setup +// esi already has c, setup for next round when done +// esp already has edi[index], setup for next round when done + +#define ASMSubroundI(a, b, c, d, e, index, s, k) \ + /* a += (c ^ (d & (b^c))) + data[i] + k */ \ + AS2( xor esi, b ) \ + AS2( and esi, d ) \ + AS2( add a, [edi + index * 4] ) \ + AS2( xor esi, c ) \ + AS2( lea a, [esi + a + k] ) \ + /* a = rotlFixed((word32)a, s) + e */ \ + AS2( mov esi, b ) \ + AS2( rol a, s ) \ + /* c = rotlFixed((word32)c, 10U) */ \ + AS2( rol c, 10 ) \ + AS2( add a, e ) + + +// combine J into subround w/ setup +// esi already has d, setup for next round when done +// esp already has edi[index], setup for next round when done + +#define ASMSubroundJ(a, b, c, d, e, index, s, k) \ + /* a += (b ^ (c | ~d))) + data[i] + k */ \ + AS1( not esi ) \ + AS2( or esi, c ) \ + /* c = rotlFixed((word32)c, 10U) */ \ + AS2( add a, [edi + index * 4] ) \ + AS2( xor esi, b ) \ + AS2( rol c, 10 ) \ + AS2( lea a, [esi + a + k] ) \ + /* a = rotlFixed((word32)a, s) + e */ \ + AS2( rol a, s ) \ + AS2( mov esi, c ) \ + AS2( add a, e ) + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void RIPEMD160::AsmTransform(const byte* data, word32 times) +{ +#ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + #define PROLOG() \ + asm(".intel_syntax noprefix"); \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov ecx, DWORD PTR [ebp + 8] ) \ + AS2( mov edi, DWORD PTR [ebp + 12] ) \ + AS2( mov edx, DWORD PTR [ebp + 16] ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( mov esp, ebp ) \ + AS2( movd edi, mm3 ) \ + AS1( emms ) \ + asm(".att_syntax"); +#else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov edi, DWORD PTR [ebp + 8] ) \ + AS2( mov edx, DWORD PTR [ebp + 12] ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 8 ) + +#endif + + PROLOG() + + #ifdef OLD_GCC_OFFSET + AS2( lea esi, [ecx + 20] ) // digest_[0] + #else + AS2( lea esi, [ecx + 16] ) // digest_[0] + #endif + + AS2( sub esp, 24 ) // make room for tmp a1 - e1 + AS2( movd mm1, esi ) // store digest_ + +AS1( loopStart: ) + + AS2( movd mm2, edx ) // store times_ + + AS2( mov eax, [esi] ) // a1 + AS2( mov ebx, [esi + 4] ) // b1 + AS2( mov ecx, [esi + 8] ) // c1 + AS2( mov edx, [esi + 12] ) // d1 + AS2( mov ebp, [esi + 16] ) // e1 + + // setup + AS2( mov esi, ecx ) + + ASMSubroundF( eax, ebx, ecx, edx, ebp, 0, 11) + ASMSubroundF( ebp, eax, ebx, ecx, edx, 1, 14) + ASMSubroundF( edx, ebp, eax, ebx, ecx, 2, 15) + ASMSubroundF( ecx, edx, ebp, eax, ebx, 3, 12) + ASMSubroundF( ebx, ecx, edx, ebp, eax, 4, 5) + ASMSubroundF( eax, ebx, ecx, edx, ebp, 5, 8) + ASMSubroundF( ebp, eax, ebx, ecx, edx, 6, 7) + ASMSubroundF( edx, ebp, eax, ebx, ecx, 7, 9) + ASMSubroundF( ecx, edx, ebp, eax, ebx, 8, 11) + ASMSubroundF( ebx, ecx, edx, ebp, eax, 9, 13) + ASMSubroundF( eax, ebx, ecx, edx, ebp, 10, 14) + ASMSubroundF( ebp, eax, ebx, ecx, edx, 11, 15) + ASMSubroundF( edx, ebp, eax, ebx, ecx, 12, 6) + ASMSubroundF( ecx, edx, ebp, eax, ebx, 13, 7) + ASMSubroundF( ebx, ecx, edx, ebp, eax, 14, 9) + ASMSubroundF( eax, ebx, ecx, edx, ebp, 15, 8) + + ASMSubroundG( ebp, eax, ebx, ecx, edx, 7, 7, k1) + ASMSubroundG( edx, ebp, eax, ebx, ecx, 4, 6, k1) + ASMSubroundG( ecx, edx, ebp, eax, ebx, 13, 8, k1) + ASMSubroundG( ebx, ecx, edx, ebp, eax, 1, 13, k1) + ASMSubroundG( eax, ebx, ecx, edx, ebp, 10, 11, k1) + ASMSubroundG( ebp, eax, ebx, ecx, edx, 6, 9, k1) + ASMSubroundG( edx, ebp, eax, ebx, ecx, 15, 7, k1) + ASMSubroundG( ecx, edx, ebp, eax, ebx, 3, 15, k1) + ASMSubroundG( ebx, ecx, edx, ebp, eax, 12, 7, k1) + ASMSubroundG( eax, ebx, ecx, edx, ebp, 0, 12, k1) + ASMSubroundG( ebp, eax, ebx, ecx, edx, 9, 15, k1) + ASMSubroundG( edx, ebp, eax, ebx, ecx, 5, 9, k1) + ASMSubroundG( ecx, edx, ebp, eax, ebx, 2, 11, k1) + ASMSubroundG( ebx, ecx, edx, ebp, eax, 14, 7, k1) + ASMSubroundG( eax, ebx, ecx, edx, ebp, 11, 13, k1) + ASMSubroundG( ebp, eax, ebx, ecx, edx, 8, 12, k1) + + ASMSubroundH( edx, ebp, eax, ebx, ecx, 3, 11, k2) + ASMSubroundH( ecx, edx, ebp, eax, ebx, 10, 13, k2) + ASMSubroundH( ebx, ecx, edx, ebp, eax, 14, 6, k2) + ASMSubroundH( eax, ebx, ecx, edx, ebp, 4, 7, k2) + ASMSubroundH( ebp, eax, ebx, ecx, edx, 9, 14, k2) + ASMSubroundH( edx, ebp, eax, ebx, ecx, 15, 9, k2) + ASMSubroundH( ecx, edx, ebp, eax, ebx, 8, 13, k2) + ASMSubroundH( ebx, ecx, edx, ebp, eax, 1, 15, k2) + ASMSubroundH( eax, ebx, ecx, edx, ebp, 2, 14, k2) + ASMSubroundH( ebp, eax, ebx, ecx, edx, 7, 8, k2) + ASMSubroundH( edx, ebp, eax, ebx, ecx, 0, 13, k2) + ASMSubroundH( ecx, edx, ebp, eax, ebx, 6, 6, k2) + ASMSubroundH( ebx, ecx, edx, ebp, eax, 13, 5, k2) + ASMSubroundH( eax, ebx, ecx, edx, ebp, 11, 12, k2) + ASMSubroundH( ebp, eax, ebx, ecx, edx, 5, 7, k2) + ASMSubroundH( edx, ebp, eax, ebx, ecx, 12, 5, k2) + + ASMSubroundI( ecx, edx, ebp, eax, ebx, 1, 11, k3) + ASMSubroundI( ebx, ecx, edx, ebp, eax, 9, 12, k3) + ASMSubroundI( eax, ebx, ecx, edx, ebp, 11, 14, k3) + ASMSubroundI( ebp, eax, ebx, ecx, edx, 10, 15, k3) + ASMSubroundI( edx, ebp, eax, ebx, ecx, 0, 14, k3) + ASMSubroundI( ecx, edx, ebp, eax, ebx, 8, 15, k3) + ASMSubroundI( ebx, ecx, edx, ebp, eax, 12, 9, k3) + ASMSubroundI( eax, ebx, ecx, edx, ebp, 4, 8, k3) + ASMSubroundI( ebp, eax, ebx, ecx, edx, 13, 9, k3) + ASMSubroundI( edx, ebp, eax, ebx, ecx, 3, 14, k3) + ASMSubroundI( ecx, edx, ebp, eax, ebx, 7, 5, k3) + ASMSubroundI( ebx, ecx, edx, ebp, eax, 15, 6, k3) + ASMSubroundI( eax, ebx, ecx, edx, ebp, 14, 8, k3) + ASMSubroundI( ebp, eax, ebx, ecx, edx, 5, 6, k3) + ASMSubroundI( edx, ebp, eax, ebx, ecx, 6, 5, k3) + ASMSubroundI( ecx, edx, ebp, eax, ebx, 2, 12, k3) + + // setup + AS2( mov esi, ebp ) + + ASMSubroundJ( ebx, ecx, edx, ebp, eax, 4, 9, k4) + ASMSubroundJ( eax, ebx, ecx, edx, ebp, 0, 15, k4) + ASMSubroundJ( ebp, eax, ebx, ecx, edx, 5, 5, k4) + ASMSubroundJ( edx, ebp, eax, ebx, ecx, 9, 11, k4) + ASMSubroundJ( ecx, edx, ebp, eax, ebx, 7, 6, k4) + ASMSubroundJ( ebx, ecx, edx, ebp, eax, 12, 8, k4) + ASMSubroundJ( eax, ebx, ecx, edx, ebp, 2, 13, k4) + ASMSubroundJ( ebp, eax, ebx, ecx, edx, 10, 12, k4) + ASMSubroundJ( edx, ebp, eax, ebx, ecx, 14, 5, k4) + ASMSubroundJ( ecx, edx, ebp, eax, ebx, 1, 12, k4) + ASMSubroundJ( ebx, ecx, edx, ebp, eax, 3, 13, k4) + ASMSubroundJ( eax, ebx, ecx, edx, ebp, 8, 14, k4) + ASMSubroundJ( ebp, eax, ebx, ecx, edx, 11, 11, k4) + ASMSubroundJ( edx, ebp, eax, ebx, ecx, 6, 8, k4) + ASMSubroundJ( ecx, edx, ebp, eax, ebx, 15, 5, k4) + ASMSubroundJ( ebx, ecx, edx, ebp, eax, 13, 6, k4) + + // store a1 - e1 on stack + AS2( movd esi, mm1 ) // digest_ + + AS2( mov [esp], eax ) + AS2( mov [esp + 4], ebx ) + AS2( mov [esp + 8], ecx ) + AS2( mov [esp + 12], edx ) + AS2( mov [esp + 16], ebp ) + + AS2( mov eax, [esi] ) // a2 + AS2( mov ebx, [esi + 4] ) // b2 + AS2( mov ecx, [esi + 8] ) // c2 + AS2( mov edx, [esi + 12] ) // d2 + AS2( mov ebp, [esi + 16] ) // e2 + + + // setup + AS2( mov esi, edx ) + + ASMSubroundJ( eax, ebx, ecx, edx, ebp, 5, 8, k5) + ASMSubroundJ( ebp, eax, ebx, ecx, edx, 14, 9, k5) + ASMSubroundJ( edx, ebp, eax, ebx, ecx, 7, 9, k5) + ASMSubroundJ( ecx, edx, ebp, eax, ebx, 0, 11, k5) + ASMSubroundJ( ebx, ecx, edx, ebp, eax, 9, 13, k5) + ASMSubroundJ( eax, ebx, ecx, edx, ebp, 2, 15, k5) + ASMSubroundJ( ebp, eax, ebx, ecx, edx, 11, 15, k5) + ASMSubroundJ( edx, ebp, eax, ebx, ecx, 4, 5, k5) + ASMSubroundJ( ecx, edx, ebp, eax, ebx, 13, 7, k5) + ASMSubroundJ( ebx, ecx, edx, ebp, eax, 6, 7, k5) + ASMSubroundJ( eax, ebx, ecx, edx, ebp, 15, 8, k5) + ASMSubroundJ( ebp, eax, ebx, ecx, edx, 8, 11, k5) + ASMSubroundJ( edx, ebp, eax, ebx, ecx, 1, 14, k5) + ASMSubroundJ( ecx, edx, ebp, eax, ebx, 10, 14, k5) + ASMSubroundJ( ebx, ecx, edx, ebp, eax, 3, 12, k5) + ASMSubroundJ( eax, ebx, ecx, edx, ebp, 12, 6, k5) + + // setup + AS2( mov esi, ebx ) + + ASMSubroundI( ebp, eax, ebx, ecx, edx, 6, 9, k6) + ASMSubroundI( edx, ebp, eax, ebx, ecx, 11, 13, k6) + ASMSubroundI( ecx, edx, ebp, eax, ebx, 3, 15, k6) + ASMSubroundI( ebx, ecx, edx, ebp, eax, 7, 7, k6) + ASMSubroundI( eax, ebx, ecx, edx, ebp, 0, 12, k6) + ASMSubroundI( ebp, eax, ebx, ecx, edx, 13, 8, k6) + ASMSubroundI( edx, ebp, eax, ebx, ecx, 5, 9, k6) + ASMSubroundI( ecx, edx, ebp, eax, ebx, 10, 11, k6) + ASMSubroundI( ebx, ecx, edx, ebp, eax, 14, 7, k6) + ASMSubroundI( eax, ebx, ecx, edx, ebp, 15, 7, k6) + ASMSubroundI( ebp, eax, ebx, ecx, edx, 8, 12, k6) + ASMSubroundI( edx, ebp, eax, ebx, ecx, 12, 7, k6) + ASMSubroundI( ecx, edx, ebp, eax, ebx, 4, 6, k6) + ASMSubroundI( ebx, ecx, edx, ebp, eax, 9, 15, k6) + ASMSubroundI( eax, ebx, ecx, edx, ebp, 1, 13, k6) + ASMSubroundI( ebp, eax, ebx, ecx, edx, 2, 11, k6) + + ASMSubroundH( edx, ebp, eax, ebx, ecx, 15, 9, k7) + ASMSubroundH( ecx, edx, ebp, eax, ebx, 5, 7, k7) + ASMSubroundH( ebx, ecx, edx, ebp, eax, 1, 15, k7) + ASMSubroundH( eax, ebx, ecx, edx, ebp, 3, 11, k7) + ASMSubroundH( ebp, eax, ebx, ecx, edx, 7, 8, k7) + ASMSubroundH( edx, ebp, eax, ebx, ecx, 14, 6, k7) + ASMSubroundH( ecx, edx, ebp, eax, ebx, 6, 6, k7) + ASMSubroundH( ebx, ecx, edx, ebp, eax, 9, 14, k7) + ASMSubroundH( eax, ebx, ecx, edx, ebp, 11, 12, k7) + ASMSubroundH( ebp, eax, ebx, ecx, edx, 8, 13, k7) + ASMSubroundH( edx, ebp, eax, ebx, ecx, 12, 5, k7) + ASMSubroundH( ecx, edx, ebp, eax, ebx, 2, 14, k7) + ASMSubroundH( ebx, ecx, edx, ebp, eax, 10, 13, k7) + ASMSubroundH( eax, ebx, ecx, edx, ebp, 0, 13, k7) + ASMSubroundH( ebp, eax, ebx, ecx, edx, 4, 7, k7) + ASMSubroundH( edx, ebp, eax, ebx, ecx, 13, 5, k7) + + ASMSubroundG( ecx, edx, ebp, eax, ebx, 8, 15, k8) + ASMSubroundG( ebx, ecx, edx, ebp, eax, 6, 5, k8) + ASMSubroundG( eax, ebx, ecx, edx, ebp, 4, 8, k8) + ASMSubroundG( ebp, eax, ebx, ecx, edx, 1, 11, k8) + ASMSubroundG( edx, ebp, eax, ebx, ecx, 3, 14, k8) + ASMSubroundG( ecx, edx, ebp, eax, ebx, 11, 14, k8) + ASMSubroundG( ebx, ecx, edx, ebp, eax, 15, 6, k8) + ASMSubroundG( eax, ebx, ecx, edx, ebp, 0, 14, k8) + ASMSubroundG( ebp, eax, ebx, ecx, edx, 5, 6, k8) + ASMSubroundG( edx, ebp, eax, ebx, ecx, 12, 9, k8) + ASMSubroundG( ecx, edx, ebp, eax, ebx, 2, 12, k8) + ASMSubroundG( ebx, ecx, edx, ebp, eax, 13, 9, k8) + ASMSubroundG( eax, ebx, ecx, edx, ebp, 9, 12, k8) + ASMSubroundG( ebp, eax, ebx, ecx, edx, 7, 5, k8) + ASMSubroundG( edx, ebp, eax, ebx, ecx, 10, 15, k8) + ASMSubroundG( ecx, edx, ebp, eax, ebx, 14, 8, k8) + + ASMSubroundF( ebx, ecx, edx, ebp, eax, 12, 8) + ASMSubroundF( eax, ebx, ecx, edx, ebp, 15, 5) + ASMSubroundF( ebp, eax, ebx, ecx, edx, 10, 12) + ASMSubroundF( edx, ebp, eax, ebx, ecx, 4, 9) + ASMSubroundF( ecx, edx, ebp, eax, ebx, 1, 12) + ASMSubroundF( ebx, ecx, edx, ebp, eax, 5, 5) + ASMSubroundF( eax, ebx, ecx, edx, ebp, 8, 14) + ASMSubroundF( ebp, eax, ebx, ecx, edx, 7, 6) + ASMSubroundF( edx, ebp, eax, ebx, ecx, 6, 8) + ASMSubroundF( ecx, edx, ebp, eax, ebx, 2, 13) + ASMSubroundF( ebx, ecx, edx, ebp, eax, 13, 6) + ASMSubroundF( eax, ebx, ecx, edx, ebp, 14, 5) + ASMSubroundF( ebp, eax, ebx, ecx, edx, 0, 15) + ASMSubroundF( edx, ebp, eax, ebx, ecx, 3, 13) + ASMSubroundF( ecx, edx, ebp, eax, ebx, 9, 11) + ASMSubroundF( ebx, ecx, edx, ebp, eax, 11, 11) + + // advance data and store for next round + AS2( add edi, 64 ) + AS2( movd esi, mm1 ) // digest_ + AS2( movd mm0, edi ) // store + + // now edi as tmp + + // c1 = digest_[1] + c1 + d2; + AS2( add [esp + 8], edx ) // + d2 + AS2( mov edi, [esi + 4] ) // digest_[1] + AS2( add [esp + 8], edi ) + + // digest_[1] = digest_[2] + d1 + e2; + AS2( mov [esi + 4], ebp ) // e2 + AS2( mov edi, [esp + 12] ) // d1 + AS2( add edi, [esi + 8] ) // digest_[2] + AS2( add [esi + 4], edi ) + + // digest_[2] = digest_[3] + e1 + a2; + AS2( mov [esi + 8], eax ) // a2 + AS2( mov edi, [esp + 16] ) // e1 + AS2( add edi, [esi + 12] ) // digest_[3] + AS2( add [esi + 8], edi ) + + // digest_[3] = digest_[4] + a1 + b2; + AS2( mov [esi + 12], ebx ) // b2 + AS2( mov edi, [esp] ) // a1 + AS2( add edi, [esi + 16] ) // digest_[4] + AS2( add [esi + 12], edi ) + + // digest_[4] = digest_[0] + b1 + c2; + AS2( mov [esi + 16], ecx ) // c2 + AS2( mov edi, [esp + 4] ) // b1 + AS2( add edi, [esi] ) // digest_[0] + AS2( add [esi + 16], edi ) + + // digest_[0] = c1; + AS2( mov edi, [esp + 8] ) // c1 + AS2( mov [esi], edi ) + + // setup for loop back + AS2( movd edx, mm2 ) // times + AS2( movd edi, mm0 ) // data, already advanced + AS1( dec edx ) + AS1( jnz loopStart ) + + + EPILOG() +} + + +#endif // DO_RIPEMD_ASM + + +} // namespace TaoCrypt diff --git a/externals/mysql/extlib/yassl/taocrypt/src/rsa.cpp b/externals/mysql/extlib/yassl/taocrypt/src/rsa.cpp new file mode 100644 index 0000000..57d19a5 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/rsa.cpp @@ -0,0 +1,210 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's rsa.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "rsa.hpp" +#include "asn.hpp" +#include "modarith.hpp" + + + +namespace TaoCrypt { + + +Integer RSA_PublicKey::ApplyFunction(const Integer& x) const +{ + return a_exp_b_mod_c(x, e_, n_); +} + + +RSA_PublicKey::RSA_PublicKey(Source& source) +{ + Initialize(source); +} + + +void RSA_PublicKey::Initialize(Source& source) +{ + RSA_Public_Decoder decoder(source); + decoder.Decode(*this); +} + + +Integer RSA_PrivateKey::CalculateInverse(RandomNumberGenerator& rng, + const Integer& x) const +{ + ModularArithmetic modn(n_); + + Integer r(rng, Integer::One(), n_ - Integer::One()); + Integer re = modn.Exponentiate(r, e_); + re = modn.Multiply(re, x); // blind + + // here we follow the notation of PKCS #1 and let u=q inverse mod p + // but in ModRoot, u=p inverse mod q, so we reverse the order of p and q + + Integer y = ModularRoot(re, dq_, dp_, q_, p_, u_); + y = modn.Divide(y, r); // unblind + assert(modn.Exponentiate(y, e_) == x); // check + + return y; +} + + +RSA_PrivateKey::RSA_PrivateKey(Source& source) +{ + Initialize(source); +} + + +void RSA_PrivateKey::Initialize(Source& source) +{ + RSA_Private_Decoder decoder(source); + decoder.Decode(*this); +} + + +void RSA_BlockType2::Pad(const byte *input, word32 inputLen, byte *pkcsBlock, + word32 pkcsBlockLen, RandomNumberGenerator& rng) const +{ + // convert from bit length to byte length + if (pkcsBlockLen % 8 != 0) + { + pkcsBlock[0] = 0; + pkcsBlock++; + } + pkcsBlockLen /= 8; + + pkcsBlock[0] = 2; // block type 2 + + // pad with non-zero random bytes + word32 padLen = pkcsBlockLen - inputLen - 1; + rng.GenerateBlock(&pkcsBlock[1], padLen); + for (word32 i = 1; i < padLen; i++) + if (pkcsBlock[i] == 0) pkcsBlock[i] = 0x01; + + pkcsBlock[pkcsBlockLen-inputLen-1] = 0; // separator + memcpy(pkcsBlock+pkcsBlockLen-inputLen, input, inputLen); +} + +word32 RSA_BlockType2::UnPad(const byte *pkcsBlock, unsigned int pkcsBlockLen, + byte *output) const +{ + bool invalid = false; + unsigned int maxOutputLen = SaturatingSubtract(pkcsBlockLen / 8, 10U); + + // convert from bit length to byte length + if (pkcsBlockLen % 8 != 0) + { + invalid = (pkcsBlock[0] != 0) || invalid; + pkcsBlock++; + } + pkcsBlockLen /= 8; + + // Require block type 2. + invalid = (pkcsBlock[0] != 2) || invalid; + + // skip past the padding until we find the separator + unsigned i=1; + while (i maxOutputLen) || invalid; + + if (invalid) + return 0; + + memcpy (output, pkcsBlock+i, outputLen); + return outputLen; +} + + +void RSA_BlockType1::Pad(const byte* input, word32 inputLen, byte* pkcsBlock, + word32 pkcsBlockLen, RandomNumberGenerator&) const +{ + // convert from bit length to byte length + if (pkcsBlockLen % 8 != 0) + { + pkcsBlock[0] = 0; + pkcsBlock++; + } + pkcsBlockLen /= 8; + + pkcsBlock[0] = 1; // block type 1 for SSL + + // pad with 0xff bytes + memset(&pkcsBlock[1], 0xFF, pkcsBlockLen - inputLen - 2); + + pkcsBlock[pkcsBlockLen-inputLen-1] = 0; // separator + memcpy(pkcsBlock+pkcsBlockLen-inputLen, input, inputLen); +} + + +word32 RSA_BlockType1::UnPad(const byte* pkcsBlock, word32 pkcsBlockLen, + byte* output) const +{ + bool invalid = false; + unsigned int maxOutputLen = SaturatingSubtract(pkcsBlockLen / 8, 10U); + + // convert from bit length to byte length + if (pkcsBlockLen % 8 != 0) + { + invalid = (pkcsBlock[0] != 0) || invalid; + pkcsBlock++; + } + pkcsBlockLen /= 8; + + // Require block type 1 for SSL. + invalid = (pkcsBlock[0] != 1) || invalid; + + // skip past the padding until we find the separator + unsigned i=1; + while (i maxOutputLen) || invalid; + + if (invalid) + return 0; + + memcpy(output, pkcsBlock+i, outputLen); + return outputLen; +} + + +word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain) +{ + PK_Lengths lengths(key.GetModulus()); + + ByteBlock paddedBlock(BitsToBytes(lengths.PaddedBlockBitLength())); + Integer x = key.ApplyFunction(Integer(sig, + lengths.FixedCiphertextLength())); + if (x.ByteCount() > paddedBlock.size()) + x = Integer::Zero(); + x.Encode(paddedBlock.get_buffer(), paddedBlock.size()); + return RSA_BlockType1().UnPad(paddedBlock.get_buffer(), + lengths.PaddedBlockBitLength(), plain); +} + + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/sha.cpp b/externals/mysql/extlib/yassl/taocrypt/src/sha.cpp new file mode 100644 index 0000000..ef165a3 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/sha.cpp @@ -0,0 +1,1023 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's sha.cpp from CryptoPP */ + +#include "runtime.hpp" +#include +#include "sha.hpp" +#ifdef USE_SYS_STL + #include +#else + #include "algorithm.hpp" +#endif + + +namespace STL = STL_NAMESPACE; + + + +namespace TaoCrypt { + +#define blk0(i) (W[i] = buffer_[i]) +#define blk1(i) (W[i&15] = \ + rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1)) + +#define f1(x,y,z) (z^(x &(y^z))) +#define f2(x,y,z) (x^y^z) +#define f3(x,y,z) ((x&y)|(z&(x|y))) +#define f4(x,y,z) (x^y^z) + +// (R0+R1), R2, R3, R4 are the different operations used in SHA1 +#define R0(v,w,x,y,z,i) z+= f1(w,x,y) + blk0(i) + 0x5A827999+ \ + rotlFixed(v,5); w = rotlFixed(w,30); +#define R1(v,w,x,y,z,i) z+= f1(w,x,y) + blk1(i) + 0x5A827999+ \ + rotlFixed(v,5); w = rotlFixed(w,30); +#define R2(v,w,x,y,z,i) z+= f2(w,x,y) + blk1(i) + 0x6ED9EBA1+ \ + rotlFixed(v,5); w = rotlFixed(w,30); +#define R3(v,w,x,y,z,i) z+= f3(w,x,y) + blk1(i) + 0x8F1BBCDC+ \ + rotlFixed(v,5); w = rotlFixed(w,30); +#define R4(v,w,x,y,z,i) z+= f4(w,x,y) + blk1(i) + 0xCA62C1D6+ \ + rotlFixed(v,5); w = rotlFixed(w,30); + + +void SHA::Init() +{ + digest_[0] = 0x67452301L; + digest_[1] = 0xEFCDAB89L; + digest_[2] = 0x98BADCFEL; + digest_[3] = 0x10325476L; + digest_[4] = 0xC3D2E1F0L; + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + +void SHA256::Init() +{ + digest_[0] = 0x6A09E667L; + digest_[1] = 0xBB67AE85L; + digest_[2] = 0x3C6EF372L; + digest_[3] = 0xA54FF53AL; + digest_[4] = 0x510E527FL; + digest_[5] = 0x9B05688CL; + digest_[6] = 0x1F83D9ABL; + digest_[7] = 0x5BE0CD19L; + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + + +void SHA224::Init() +{ + digest_[0] = 0xc1059ed8; + digest_[1] = 0x367cd507; + digest_[2] = 0x3070dd17; + digest_[3] = 0xf70e5939; + digest_[4] = 0xffc00b31; + digest_[5] = 0x68581511; + digest_[6] = 0x64f98fa7; + digest_[7] = 0xbefa4fa4; + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + + +#ifdef WORD64_AVAILABLE + +void SHA512::Init() +{ + digest_[0] = W64LIT(0x6a09e667f3bcc908); + digest_[1] = W64LIT(0xbb67ae8584caa73b); + digest_[2] = W64LIT(0x3c6ef372fe94f82b); + digest_[3] = W64LIT(0xa54ff53a5f1d36f1); + digest_[4] = W64LIT(0x510e527fade682d1); + digest_[5] = W64LIT(0x9b05688c2b3e6c1f); + digest_[6] = W64LIT(0x1f83d9abfb41bd6b); + digest_[7] = W64LIT(0x5be0cd19137e2179); + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + + +void SHA384::Init() +{ + digest_[0] = W64LIT(0xcbbb9d5dc1059ed8); + digest_[1] = W64LIT(0x629a292a367cd507); + digest_[2] = W64LIT(0x9159015a3070dd17); + digest_[3] = W64LIT(0x152fecd8f70e5939); + digest_[4] = W64LIT(0x67332667ffc00b31); + digest_[5] = W64LIT(0x8eb44a8768581511); + digest_[6] = W64LIT(0xdb0c2e0d64f98fa7); + digest_[7] = W64LIT(0x47b5481dbefa4fa4); + + buffLen_ = 0; + loLen_ = 0; + hiLen_ = 0; +} + +#endif // WORD64_AVAILABLE + + +SHA::SHA(const SHA& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32), + BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + + +SHA256::SHA256(const SHA256& that) : HASHwithTransform(DIGEST_SIZE / + sizeof(word32), BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + + +SHA224::SHA224(const SHA224& that) : HASHwithTransform(SHA256::DIGEST_SIZE / + sizeof(word32), BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + + +#ifdef WORD64_AVAILABLE + +SHA512::SHA512(const SHA512& that) : HASH64withTransform(DIGEST_SIZE / + sizeof(word64), BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + + +SHA384::SHA384(const SHA384& that) : HASH64withTransform(SHA512::DIGEST_SIZE / + sizeof(word64), BLOCK_SIZE) +{ + buffLen_ = that.buffLen_; + loLen_ = that.loLen_; + hiLen_ = that.hiLen_; + + memcpy(digest_, that.digest_, DIGEST_SIZE); + memcpy(buffer_, that.buffer_, BLOCK_SIZE); +} + +#endif // WORD64_AVAILABLE + + +SHA& SHA::operator= (const SHA& that) +{ + SHA tmp(that); + Swap(tmp); + + return *this; +} + + +SHA256& SHA256::operator= (const SHA256& that) +{ + SHA256 tmp(that); + Swap(tmp); + + return *this; +} + + +SHA224& SHA224::operator= (const SHA224& that) +{ + SHA224 tmp(that); + Swap(tmp); + + return *this; +} + + +#ifdef WORD64_AVAILABLE + +SHA512& SHA512::operator= (const SHA512& that) +{ + SHA512 tmp(that); + Swap(tmp); + + return *this; +} + + +SHA384& SHA384::operator= (const SHA384& that) +{ + SHA384 tmp(that); + Swap(tmp); + + return *this; +} + +#endif // WORD64_AVAILABLE + + +void SHA::Swap(SHA& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + + +void SHA256::Swap(SHA256& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + + +void SHA224::Swap(SHA224& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + + +#ifdef WORD64_AVAILABLE + +void SHA512::Swap(SHA512& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + + +void SHA384::Swap(SHA384& other) +{ + STL::swap(loLen_, other.loLen_); + STL::swap(hiLen_, other.hiLen_); + STL::swap(buffLen_, other.buffLen_); + + memcpy(digest_, other.digest_, DIGEST_SIZE); + memcpy(buffer_, other.buffer_, BLOCK_SIZE); +} + +#endif // WORD64_AVIALABLE + + +#ifdef DO_SHA_ASM + +// Update digest with data of size len +void SHA::Update(const byte* data, word32 len) +{ + if (!isMMX) { + HASHwithTransform::Update(data, len); + return; + } + + byte* local = reinterpret_cast(buffer_); + + // remove buffered data if possible + if (buffLen_) { + word32 add = min(len, BLOCK_SIZE - buffLen_); + memcpy(&local[buffLen_], data, add); + + buffLen_ += add; + data += add; + len -= add; + + if (buffLen_ == BLOCK_SIZE) { + ByteReverse(local, local, BLOCK_SIZE); + Transform(); + AddLength(BLOCK_SIZE); + buffLen_ = 0; + } + } + + // all at once for asm + if (buffLen_ == 0) { + word32 times = len / BLOCK_SIZE; + if (times) { + AsmTransform(data, times); + const word32 add = BLOCK_SIZE * times; + AddLength(add); + len -= add; + data += add; + } + } + + // cache any data left + if (len) { + memcpy(&local[buffLen_], data, len); + buffLen_ += len; + } +} + +#endif // DO_SHA_ASM + + +void SHA::Transform() +{ + word32 W[BLOCK_SIZE / sizeof(word32)]; + + // Copy context->state[] to working vars + word32 a = digest_[0]; + word32 b = digest_[1]; + word32 c = digest_[2]; + word32 d = digest_[3]; + word32 e = digest_[4]; + + // 4 rounds of 20 operations each. Loop unrolled. + R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); + R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); + R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); + R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); + + R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + + R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); + R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); + R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); + R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); + R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); + + R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); + R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); + R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); + R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); + R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); + + R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); + R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); + R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); + R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); + R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); + + // Add the working vars back into digest state[] + digest_[0] += a; + digest_[1] += b; + digest_[2] += c; + digest_[3] += d; + digest_[4] += e; + + // Wipe variables + a = b = c = d = e = 0; + memset(W, 0, sizeof(W)); +} + + +#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15])) + +#define Ch(x,y,z) (z^(x&(y^z))) +#define Maj(x,y,z) ((x&y)|(z&(x|y))) + +#define a(i) T[(0-i)&7] +#define b(i) T[(1-i)&7] +#define c(i) T[(2-i)&7] +#define d(i) T[(3-i)&7] +#define e(i) T[(4-i)&7] +#define f(i) T[(5-i)&7] +#define g(i) T[(6-i)&7] +#define h(i) T[(7-i)&7] + +#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+K[i+j]+(j?blk2(i):blk0(i));\ + d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i)) + +// for SHA256 +#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22)) +#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25)) +#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3)) +#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10)) + + +static const word32 K256[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + + +static void Transform256(word32* digest_, word32* buffer_) +{ + const word32* K = K256; + + word32 W[16]; + word32 T[8]; + + // Copy digest to working vars + memcpy(T, digest_, sizeof(T)); + + // 64 operations, partially loop unrolled + for (unsigned int j = 0; j < 64; j += 16) { + R( 0); R( 1); R( 2); R( 3); + R( 4); R( 5); R( 6); R( 7); + R( 8); R( 9); R(10); R(11); + R(12); R(13); R(14); R(15); + } + + // Add the working vars back into digest + digest_[0] += a(0); + digest_[1] += b(0); + digest_[2] += c(0); + digest_[3] += d(0); + digest_[4] += e(0); + digest_[5] += f(0); + digest_[6] += g(0); + digest_[7] += h(0); + + // Wipe variables + memset(W, 0, sizeof(W)); + memset(T, 0, sizeof(T)); +} + + +// undef for 256 +#undef S0 +#undef S1 +#undef s0 +#undef s1 + + +void SHA256::Transform() +{ + Transform256(digest_, buffer_); +} + + +void SHA224::Transform() +{ + Transform256(digest_, buffer_); +} + + +#ifdef WORD64_AVAILABLE + +static const word64 K512[80] = { + W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd), + W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc), + W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019), + W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118), + W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe), + W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2), + W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1), + W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694), + W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3), + W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65), + W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483), + W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5), + W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210), + W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4), + W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725), + W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70), + W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926), + W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df), + W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8), + W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b), + W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001), + W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30), + W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910), + W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8), + W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53), + W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8), + W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb), + W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3), + W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60), + W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec), + W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9), + W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b), + W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207), + W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178), + W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6), + W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b), + W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493), + W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c), + W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a), + W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817) +}; + + +// for SHA512 +#define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39)) +#define S1(x) (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41)) +#define s0(x) (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7)) +#define s1(x) (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6)) + + +static void Transform512(word64* digest_, word64* buffer_) +{ + const word64* K = K512; + + word64 W[16]; + word64 T[8]; + + // Copy digest to working vars + memcpy(T, digest_, sizeof(T)); + + // 64 operations, partially loop unrolled + for (unsigned int j = 0; j < 80; j += 16) { + R( 0); R( 1); R( 2); R( 3); + R( 4); R( 5); R( 6); R( 7); + R( 8); R( 9); R(10); R(11); + R(12); R(13); R(14); R(15); + } + + // Add the working vars back into digest + + digest_[0] += a(0); + digest_[1] += b(0); + digest_[2] += c(0); + digest_[3] += d(0); + digest_[4] += e(0); + digest_[5] += f(0); + digest_[6] += g(0); + digest_[7] += h(0); + + // Wipe variables + memset(W, 0, sizeof(W)); + memset(T, 0, sizeof(T)); +} + + +void SHA512::Transform() +{ + Transform512(digest_, buffer_); +} + + +void SHA384::Transform() +{ + Transform512(digest_, buffer_); +} + +#endif // WORD64_AVIALABLE + + +#ifdef DO_SHA_ASM + +// f1(x,y,z) (z^(x &(y^z))) +// place in esi +#define ASMf1(x,y,z) \ + AS2( mov esi, y ) \ + AS2( xor esi, z ) \ + AS2( and esi, x ) \ + AS2( xor esi, z ) + + +// R0(v,w,x,y,z,i) = +// z+= f1(w,x,y) + W[i] + 0x5A827999 + rotlFixed(v,5); +// w = rotlFixed(w,30); + +// use esi for f +// use edi as tmp + + +#define ASMR0(v,w,x,y,z,i) \ + AS2( mov esi, x ) \ + AS2( mov edi, [esp + i * 4] ) \ + AS2( xor esi, y ) \ + AS2( and esi, w ) \ + AS2( lea z, [edi + z + 0x5A827999] ) \ + AS2( mov edi, v ) \ + AS2( xor esi, y ) \ + AS2( rol edi, 5 ) \ + AS2( add z, esi ) \ + AS2( rol w, 30 ) \ + AS2( add z, edi ) + + +/* Some macro stuff, but older gas ( < 2,16 ) can't process &, so do by hand + % won't work on gas at all + +#define xstr(s) str(s) +#define str(s) #s + +#define WOFF1(a) ( a & 15) +#define WOFF2(a) ((a + 2) & 15) +#define WOFF3(a) ((a + 8) & 15) +#define WOFF4(a) ((a + 13) & 15) + +#ifdef __GNUC__ + #define WGET1(i) asm("mov esp, [edi - "xstr(WOFF1(i))" * 4] "); + #define WGET2(i) asm("xor esp, [edi - "xstr(WOFF2(i))" * 4] "); + #define WGET3(i) asm("xor esp, [edi - "xstr(WOFF3(i))" * 4] "); + #define WGET4(i) asm("xor esp, [edi - "xstr(WOFF4(i))" * 4] "); + #define WPUT1(i) asm("mov [edi - "xstr(WOFF1(i))" * 4], esp "); +#else + #define WGET1(i) AS2( mov esp, [edi - WOFF1(i) * 4] ) + #define WGET2(i) AS2( xor esp, [edi - WOFF2(i) * 4] ) + #define WGET3(i) AS2( xor esp, [edi - WOFF3(i) * 4] ) + #define WGET4(i) AS2( xor esp, [edi - WOFF4(i) * 4] ) + #define WPUT1(i) AS2( mov [edi - WOFF1(i) * 4], esp ) +#endif +*/ + +// ASMR1 = ASMR0 but use esp for W calcs + +#define ASMR1(v,w,x,y,z,i,W1,W2,W3,W4) \ + AS2( mov edi, [esp + W1 * 4] ) \ + AS2( mov esi, x ) \ + AS2( xor edi, [esp + W2 * 4] ) \ + AS2( xor esi, y ) \ + AS2( xor edi, [esp + W3 * 4] ) \ + AS2( and esi, w ) \ + AS2( xor edi, [esp + W4 * 4] ) \ + AS2( rol edi, 1 ) \ + AS2( xor esi, y ) \ + AS2( mov [esp + W1 * 4], edi ) \ + AS2( lea z, [edi + z + 0x5A827999] ) \ + AS2( mov edi, v ) \ + AS2( rol edi, 5 ) \ + AS2( add z, esi ) \ + AS2( rol w, 30 ) \ + AS2( add z, edi ) + + +// ASMR2 = ASMR1 but f is xor, xor instead + +#define ASMR2(v,w,x,y,z,i,W1,W2,W3,W4) \ + AS2( mov edi, [esp + W1 * 4] ) \ + AS2( mov esi, x ) \ + AS2( xor edi, [esp + W2 * 4] ) \ + AS2( xor esi, y ) \ + AS2( xor edi, [esp + W3 * 4] ) \ + AS2( xor esi, w ) \ + AS2( xor edi, [esp + W4 * 4] ) \ + AS2( rol edi, 1 ) \ + AS2( add z, esi ) \ + AS2( mov [esp + W1 * 4], edi ) \ + AS2( lea z, [edi + z + 0x6ED9EBA1] ) \ + AS2( mov edi, v ) \ + AS2( rol edi, 5 ) \ + AS2( rol w, 30 ) \ + AS2( add z, edi ) + + +// ASMR3 = ASMR2 but f is (x&y)|(z&(x|y)) +// which is (w&x)|(y&(w|x)) + +#define ASMR3(v,w,x,y,z,i,W1,W2,W3,W4) \ + AS2( mov edi, [esp + W1 * 4] ) \ + AS2( mov esi, x ) \ + AS2( xor edi, [esp + W2 * 4] ) \ + AS2( or esi, w ) \ + AS2( xor edi, [esp + W3 * 4] ) \ + AS2( and esi, y ) \ + AS2( xor edi, [esp + W4 * 4] ) \ + AS2( movd mm0, esi ) \ + AS2( rol edi, 1 ) \ + AS2( mov esi, x ) \ + AS2( mov [esp + W1 * 4], edi ) \ + AS2( and esi, w ) \ + AS2( lea z, [edi + z + 0x8F1BBCDC] ) \ + AS2( movd edi, mm0 ) \ + AS2( or esi, edi ) \ + AS2( mov edi, v ) \ + AS2( rol edi, 5 ) \ + AS2( add z, esi ) \ + AS2( rol w, 30 ) \ + AS2( add z, edi ) + + +// ASMR4 = ASMR2 but different constant + +#define ASMR4(v,w,x,y,z,i,W1,W2,W3,W4) \ + AS2( mov edi, [esp + W1 * 4] ) \ + AS2( mov esi, x ) \ + AS2( xor edi, [esp + W2 * 4] ) \ + AS2( xor esi, y ) \ + AS2( xor edi, [esp + W3 * 4] ) \ + AS2( xor esi, w ) \ + AS2( xor edi, [esp + W4 * 4] ) \ + AS2( rol edi, 1 ) \ + AS2( add z, esi ) \ + AS2( mov [esp + W1 * 4], edi ) \ + AS2( lea z, [edi + z + 0xCA62C1D6] ) \ + AS2( mov edi, v ) \ + AS2( rol edi, 5 ) \ + AS2( rol w, 30 ) \ + AS2( add z, edi ) + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void SHA::AsmTransform(const byte* data, word32 times) +{ +#ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + #define PROLOG() \ + asm(".intel_syntax noprefix"); \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov ecx, DWORD PTR [ebp + 8] ) \ + AS2( mov edi, DWORD PTR [ebp + 12] ) \ + AS2( mov eax, DWORD PTR [ebp + 16] ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( mov esp, ebp ) \ + AS2( movd edi, mm3 ) \ + AS1( emms ) \ + asm(".att_syntax"); +#else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov edi, data ) \ + AS2( mov eax, times ) + + #define EPILOG() \ + AS2( movd ebp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 8 ) +#endif + + PROLOG() + + AS2( mov esi, ecx ) + + #ifdef OLD_GCC_OFFSET + AS2( add esi, 20 ) // digest_[0] + #else + AS2( add esi, 16 ) // digest_[0] + #endif + + AS2( movd mm2, eax ) // store times_ + AS2( movd mm1, esi ) // store digest_ + + AS2( sub esp, 68 ) // make room on stack + +AS1( loopStart: ) + + // byte reverse 16 words of input, 4 at a time, put on stack for W[] + + // part 1 + AS2( mov eax, [edi] ) + AS2( mov ebx, [edi + 4] ) + AS2( mov ecx, [edi + 8] ) + AS2( mov edx, [edi + 12] ) + + AS1( bswap eax ) + AS1( bswap ebx ) + AS1( bswap ecx ) + AS1( bswap edx ) + + AS2( mov [esp], eax ) + AS2( mov [esp + 4], ebx ) + AS2( mov [esp + 8], ecx ) + AS2( mov [esp + 12], edx ) + + // part 2 + AS2( mov eax, [edi + 16] ) + AS2( mov ebx, [edi + 20] ) + AS2( mov ecx, [edi + 24] ) + AS2( mov edx, [edi + 28] ) + + AS1( bswap eax ) + AS1( bswap ebx ) + AS1( bswap ecx ) + AS1( bswap edx ) + + AS2( mov [esp + 16], eax ) + AS2( mov [esp + 20], ebx ) + AS2( mov [esp + 24], ecx ) + AS2( mov [esp + 28], edx ) + + + // part 3 + AS2( mov eax, [edi + 32] ) + AS2( mov ebx, [edi + 36] ) + AS2( mov ecx, [edi + 40] ) + AS2( mov edx, [edi + 44] ) + + AS1( bswap eax ) + AS1( bswap ebx ) + AS1( bswap ecx ) + AS1( bswap edx ) + + AS2( mov [esp + 32], eax ) + AS2( mov [esp + 36], ebx ) + AS2( mov [esp + 40], ecx ) + AS2( mov [esp + 44], edx ) + + + // part 4 + AS2( mov eax, [edi + 48] ) + AS2( mov ebx, [edi + 52] ) + AS2( mov ecx, [edi + 56] ) + AS2( mov edx, [edi + 60] ) + + AS1( bswap eax ) + AS1( bswap ebx ) + AS1( bswap ecx ) + AS1( bswap edx ) + + AS2( mov [esp + 48], eax ) + AS2( mov [esp + 52], ebx ) + AS2( mov [esp + 56], ecx ) + AS2( mov [esp + 60], edx ) + + AS2( mov [esp + 64], edi ) // store edi for end + + // read from digest_ + AS2( mov eax, [esi] ) // a1 + AS2( mov ebx, [esi + 4] ) // b1 + AS2( mov ecx, [esi + 8] ) // c1 + AS2( mov edx, [esi + 12] ) // d1 + AS2( mov ebp, [esi + 16] ) // e1 + + + ASMR0(eax, ebx, ecx, edx, ebp, 0) + ASMR0(ebp, eax, ebx, ecx, edx, 1) + ASMR0(edx, ebp, eax, ebx, ecx, 2) + ASMR0(ecx, edx, ebp, eax, ebx, 3) + ASMR0(ebx, ecx, edx, ebp, eax, 4) + ASMR0(eax, ebx, ecx, edx, ebp, 5) + ASMR0(ebp, eax, ebx, ecx, edx, 6) + ASMR0(edx, ebp, eax, ebx, ecx, 7) + ASMR0(ecx, edx, ebp, eax, ebx, 8) + ASMR0(ebx, ecx, edx, ebp, eax, 9) + ASMR0(eax, ebx, ecx, edx, ebp, 10) + ASMR0(ebp, eax, ebx, ecx, edx, 11) + ASMR0(edx, ebp, eax, ebx, ecx, 12) + ASMR0(ecx, edx, ebp, eax, ebx, 13) + ASMR0(ebx, ecx, edx, ebp, eax, 14) + ASMR0(eax, ebx, ecx, edx, ebp, 15) + + ASMR1(ebp, eax, ebx, ecx, edx, 16, 0, 2, 8, 13) + ASMR1(edx, ebp, eax, ebx, ecx, 17, 1, 3, 9, 14) + ASMR1(ecx, edx, ebp, eax, ebx, 18, 2, 4, 10, 15) + ASMR1(ebx, ecx, edx, ebp, eax, 19, 3, 5, 11, 0) + + ASMR2(eax, ebx, ecx, edx, ebp, 20, 4, 6, 12, 1) + ASMR2(ebp, eax, ebx, ecx, edx, 21, 5, 7, 13, 2) + ASMR2(edx, ebp, eax, ebx, ecx, 22, 6, 8, 14, 3) + ASMR2(ecx, edx, ebp, eax, ebx, 23, 7, 9, 15, 4) + ASMR2(ebx, ecx, edx, ebp, eax, 24, 8, 10, 0, 5) + ASMR2(eax, ebx, ecx, edx, ebp, 25, 9, 11, 1, 6) + ASMR2(ebp, eax, ebx, ecx, edx, 26, 10, 12, 2, 7) + ASMR2(edx, ebp, eax, ebx, ecx, 27, 11, 13, 3, 8) + ASMR2(ecx, edx, ebp, eax, ebx, 28, 12, 14, 4, 9) + ASMR2(ebx, ecx, edx, ebp, eax, 29, 13, 15, 5, 10) + ASMR2(eax, ebx, ecx, edx, ebp, 30, 14, 0, 6, 11) + ASMR2(ebp, eax, ebx, ecx, edx, 31, 15, 1, 7, 12) + ASMR2(edx, ebp, eax, ebx, ecx, 32, 0, 2, 8, 13) + ASMR2(ecx, edx, ebp, eax, ebx, 33, 1, 3, 9, 14) + ASMR2(ebx, ecx, edx, ebp, eax, 34, 2, 4, 10, 15) + ASMR2(eax, ebx, ecx, edx, ebp, 35, 3, 5, 11, 0) + ASMR2(ebp, eax, ebx, ecx, edx, 36, 4, 6, 12, 1) + ASMR2(edx, ebp, eax, ebx, ecx, 37, 5, 7, 13, 2) + ASMR2(ecx, edx, ebp, eax, ebx, 38, 6, 8, 14, 3) + ASMR2(ebx, ecx, edx, ebp, eax, 39, 7, 9, 15, 4) + + + ASMR3(eax, ebx, ecx, edx, ebp, 40, 8, 10, 0, 5) + ASMR3(ebp, eax, ebx, ecx, edx, 41, 9, 11, 1, 6) + ASMR3(edx, ebp, eax, ebx, ecx, 42, 10, 12, 2, 7) + ASMR3(ecx, edx, ebp, eax, ebx, 43, 11, 13, 3, 8) + ASMR3(ebx, ecx, edx, ebp, eax, 44, 12, 14, 4, 9) + ASMR3(eax, ebx, ecx, edx, ebp, 45, 13, 15, 5, 10) + ASMR3(ebp, eax, ebx, ecx, edx, 46, 14, 0, 6, 11) + ASMR3(edx, ebp, eax, ebx, ecx, 47, 15, 1, 7, 12) + ASMR3(ecx, edx, ebp, eax, ebx, 48, 0, 2, 8, 13) + ASMR3(ebx, ecx, edx, ebp, eax, 49, 1, 3, 9, 14) + ASMR3(eax, ebx, ecx, edx, ebp, 50, 2, 4, 10, 15) + ASMR3(ebp, eax, ebx, ecx, edx, 51, 3, 5, 11, 0) + ASMR3(edx, ebp, eax, ebx, ecx, 52, 4, 6, 12, 1) + ASMR3(ecx, edx, ebp, eax, ebx, 53, 5, 7, 13, 2) + ASMR3(ebx, ecx, edx, ebp, eax, 54, 6, 8, 14, 3) + ASMR3(eax, ebx, ecx, edx, ebp, 55, 7, 9, 15, 4) + ASMR3(ebp, eax, ebx, ecx, edx, 56, 8, 10, 0, 5) + ASMR3(edx, ebp, eax, ebx, ecx, 57, 9, 11, 1, 6) + ASMR3(ecx, edx, ebp, eax, ebx, 58, 10, 12, 2, 7) + ASMR3(ebx, ecx, edx, ebp, eax, 59, 11, 13, 3, 8) + + ASMR4(eax, ebx, ecx, edx, ebp, 60, 12, 14, 4, 9) + ASMR4(ebp, eax, ebx, ecx, edx, 61, 13, 15, 5, 10) + ASMR4(edx, ebp, eax, ebx, ecx, 62, 14, 0, 6, 11) + ASMR4(ecx, edx, ebp, eax, ebx, 63, 15, 1, 7, 12) + ASMR4(ebx, ecx, edx, ebp, eax, 64, 0, 2, 8, 13) + ASMR4(eax, ebx, ecx, edx, ebp, 65, 1, 3, 9, 14) + ASMR4(ebp, eax, ebx, ecx, edx, 66, 2, 4, 10, 15) + ASMR4(edx, ebp, eax, ebx, ecx, 67, 3, 5, 11, 0) + ASMR4(ecx, edx, ebp, eax, ebx, 68, 4, 6, 12, 1) + ASMR4(ebx, ecx, edx, ebp, eax, 69, 5, 7, 13, 2) + ASMR4(eax, ebx, ecx, edx, ebp, 70, 6, 8, 14, 3) + ASMR4(ebp, eax, ebx, ecx, edx, 71, 7, 9, 15, 4) + ASMR4(edx, ebp, eax, ebx, ecx, 72, 8, 10, 0, 5) + ASMR4(ecx, edx, ebp, eax, ebx, 73, 9, 11, 1, 6) + ASMR4(ebx, ecx, edx, ebp, eax, 74, 10, 12, 2, 7) + ASMR4(eax, ebx, ecx, edx, ebp, 75, 11, 13, 3, 8) + ASMR4(ebp, eax, ebx, ecx, edx, 76, 12, 14, 4, 9) + ASMR4(edx, ebp, eax, ebx, ecx, 77, 13, 15, 5, 10) + ASMR4(ecx, edx, ebp, eax, ebx, 78, 14, 0, 6, 11) + ASMR4(ebx, ecx, edx, ebp, eax, 79, 15, 1, 7, 12) + + + AS2( movd esi, mm1 ) // digest_ + + AS2( add [esi], eax ) // write out + AS2( add [esi + 4], ebx ) + AS2( add [esi + 8], ecx ) + AS2( add [esi + 12], edx ) + AS2( add [esi + 16], ebp ) + + // setup next round + AS2( movd ebp, mm2 ) // times + + AS2( mov edi, DWORD PTR [esp + 64] ) // data + + AS2( add edi, 64 ) // next round of data + AS2( mov [esp + 64], edi ) // restore + + AS1( dec ebp ) + AS2( movd mm2, ebp ) + AS1( jnz loopStart ) + + + EPILOG() +} + + +#endif // DO_SHA_ASM + +} // namespace diff --git a/externals/mysql/extlib/yassl/taocrypt/src/template_instnt.cpp b/externals/mysql/extlib/yassl/taocrypt/src/template_instnt.cpp new file mode 100644 index 0000000..390da58 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/template_instnt.cpp @@ -0,0 +1,82 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + + +/* Explicit template instantiation requests + */ + + +#include "runtime.hpp" +#include "integer.hpp" +#include "rsa.hpp" +#include "sha.hpp" +#include "md5.hpp" +#include "hmac.hpp" +#include "ripemd.hpp" +#include "pwdbased.hpp" +#include "algebra.hpp" +#include "vector.hpp" +#include "hash.hpp" + +#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION +namespace TaoCrypt { + +#if defined(SSE2_INTRINSICS_AVAILABLE) +template AlignedAllocator::pointer StdReallocate >(AlignedAllocator&, unsigned int*, AlignedAllocator::size_type, AlignedAllocator::size_type, bool); +#endif + +template class RSA_Decryptor; +template class RSA_Encryptor; +template class RSA_Encryptor; +template void tcDelete(HASH*); +template void tcDelete(Integer*); +template void tcArrayDelete(byte*); +template AllocatorWithCleanup::pointer StdReallocate >(AllocatorWithCleanup&, byte*, AllocatorWithCleanup::size_type, AllocatorWithCleanup::size_type, bool); +template void tcArrayDelete(word*); +template AllocatorWithCleanup::pointer StdReallocate >(AllocatorWithCleanup&, word*, AllocatorWithCleanup::size_type, AllocatorWithCleanup::size_type, bool); + +#ifndef TAOCRYPT_SLOW_WORD64 // defined when word != word32 +template void tcArrayDelete(word32*); +template AllocatorWithCleanup::pointer StdReallocate >(AllocatorWithCleanup&, word32*, AllocatorWithCleanup::size_type, AllocatorWithCleanup::size_type, bool); +#endif + +template void tcArrayDelete(char*); + +template class PBKDF2_HMAC; +template class HMAC; +template class HMAC; +template class HMAC; + +} + +namespace mySTL { +template vector* uninit_fill_n*, size_t, vector >(vector*, size_t, vector const&); +template void destroy*>(vector*, vector*); +template TaoCrypt::Integer* uninit_copy(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*); +template TaoCrypt::Integer* uninit_fill_n(TaoCrypt::Integer*, size_t, TaoCrypt::Integer const&); +template void destroy(TaoCrypt::Integer*, TaoCrypt::Integer*); +template TaoCrypt::byte* GetArrayMemory(size_t); +template void FreeArrayMemory(TaoCrypt::byte*); +template TaoCrypt::Integer* GetArrayMemory(size_t); +template void FreeArrayMemory(TaoCrypt::Integer*); +template vector* GetArrayMemory >(size_t); +template void FreeArrayMemory >(vector*); +template void FreeArrayMemory(void*); +} + +#endif diff --git a/externals/mysql/extlib/yassl/taocrypt/src/tftables.cpp b/externals/mysql/extlib/yassl/taocrypt/src/tftables.cpp new file mode 100644 index 0000000..6917507 --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/tftables.cpp @@ -0,0 +1,349 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* based on Wei Dai's tftables.cpp from CryptoPP */ + +#include "runtime.hpp" +#include "twofish.hpp" + + +namespace TaoCrypt { + + +const byte Twofish::q_[2][256] = { +{ + 0xA9, 0x67, 0xB3, 0xE8, 0x04, 0xFD, 0xA3, 0x76, 0x9A, 0x92, 0x80, 0x78, + 0xE4, 0xDD, 0xD1, 0x38, 0x0D, 0xC6, 0x35, 0x98, 0x18, 0xF7, 0xEC, 0x6C, + 0x43, 0x75, 0x37, 0x26, 0xFA, 0x13, 0x94, 0x48, 0xF2, 0xD0, 0x8B, 0x30, + 0x84, 0x54, 0xDF, 0x23, 0x19, 0x5B, 0x3D, 0x59, 0xF3, 0xAE, 0xA2, 0x82, + 0x63, 0x01, 0x83, 0x2E, 0xD9, 0x51, 0x9B, 0x7C, 0xA6, 0xEB, 0xA5, 0xBE, + 0x16, 0x0C, 0xE3, 0x61, 0xC0, 0x8C, 0x3A, 0xF5, 0x73, 0x2C, 0x25, 0x0B, + 0xBB, 0x4E, 0x89, 0x6B, 0x53, 0x6A, 0xB4, 0xF1, 0xE1, 0xE6, 0xBD, 0x45, + 0xE2, 0xF4, 0xB6, 0x66, 0xCC, 0x95, 0x03, 0x56, 0xD4, 0x1C, 0x1E, 0xD7, + 0xFB, 0xC3, 0x8E, 0xB5, 0xE9, 0xCF, 0xBF, 0xBA, 0xEA, 0x77, 0x39, 0xAF, + 0x33, 0xC9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xAD, 0x24, 0xCD, 0xF9, 0xD8, + 0xE5, 0xC5, 0xB9, 0x4D, 0x44, 0x08, 0x86, 0xE7, 0xA1, 0x1D, 0xAA, 0xED, + 0x06, 0x70, 0xB2, 0xD2, 0x41, 0x7B, 0xA0, 0x11, 0x31, 0xC2, 0x27, 0x90, + 0x20, 0xF6, 0x60, 0xFF, 0x96, 0x5C, 0xB1, 0xAB, 0x9E, 0x9C, 0x52, 0x1B, + 0x5F, 0x93, 0x0A, 0xEF, 0x91, 0x85, 0x49, 0xEE, 0x2D, 0x4F, 0x8F, 0x3B, + 0x47, 0x87, 0x6D, 0x46, 0xD6, 0x3E, 0x69, 0x64, 0x2A, 0xCE, 0xCB, 0x2F, + 0xFC, 0x97, 0x05, 0x7A, 0xAC, 0x7F, 0xD5, 0x1A, 0x4B, 0x0E, 0xA7, 0x5A, + 0x28, 0x14, 0x3F, 0x29, 0x88, 0x3C, 0x4C, 0x02, 0xB8, 0xDA, 0xB0, 0x17, + 0x55, 0x1F, 0x8A, 0x7D, 0x57, 0xC7, 0x8D, 0x74, 0xB7, 0xC4, 0x9F, 0x72, + 0x7E, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6E, 0x50, 0xDE, 0x68, + 0x65, 0xBC, 0xDB, 0xF8, 0xC8, 0xA8, 0x2B, 0x40, 0xDC, 0xFE, 0x32, 0xA4, + 0xCA, 0x10, 0x21, 0xF0, 0xD3, 0x5D, 0x0F, 0x00, 0x6F, 0x9D, 0x36, 0x42, + 0x4A, 0x5E, 0xC1, 0xE0 +}, +{ + 0x75, 0xF3, 0xC6, 0xF4, 0xDB, 0x7B, 0xFB, 0xC8, 0x4A, 0xD3, 0xE6, 0x6B, + 0x45, 0x7D, 0xE8, 0x4B, 0xD6, 0x32, 0xD8, 0xFD, 0x37, 0x71, 0xF1, 0xE1, + 0x30, 0x0F, 0xF8, 0x1B, 0x87, 0xFA, 0x06, 0x3F, 0x5E, 0xBA, 0xAE, 0x5B, + 0x8A, 0x00, 0xBC, 0x9D, 0x6D, 0xC1, 0xB1, 0x0E, 0x80, 0x5D, 0xD2, 0xD5, + 0xA0, 0x84, 0x07, 0x14, 0xB5, 0x90, 0x2C, 0xA3, 0xB2, 0x73, 0x4C, 0x54, + 0x92, 0x74, 0x36, 0x51, 0x38, 0xB0, 0xBD, 0x5A, 0xFC, 0x60, 0x62, 0x96, + 0x6C, 0x42, 0xF7, 0x10, 0x7C, 0x28, 0x27, 0x8C, 0x13, 0x95, 0x9C, 0xC7, + 0x24, 0x46, 0x3B, 0x70, 0xCA, 0xE3, 0x85, 0xCB, 0x11, 0xD0, 0x93, 0xB8, + 0xA6, 0x83, 0x20, 0xFF, 0x9F, 0x77, 0xC3, 0xCC, 0x03, 0x6F, 0x08, 0xBF, + 0x40, 0xE7, 0x2B, 0xE2, 0x79, 0x0C, 0xAA, 0x82, 0x41, 0x3A, 0xEA, 0xB9, + 0xE4, 0x9A, 0xA4, 0x97, 0x7E, 0xDA, 0x7A, 0x17, 0x66, 0x94, 0xA1, 0x1D, + 0x3D, 0xF0, 0xDE, 0xB3, 0x0B, 0x72, 0xA7, 0x1C, 0xEF, 0xD1, 0x53, 0x3E, + 0x8F, 0x33, 0x26, 0x5F, 0xEC, 0x76, 0x2A, 0x49, 0x81, 0x88, 0xEE, 0x21, + 0xC4, 0x1A, 0xEB, 0xD9, 0xC5, 0x39, 0x99, 0xCD, 0xAD, 0x31, 0x8B, 0x01, + 0x18, 0x23, 0xDD, 0x1F, 0x4E, 0x2D, 0xF9, 0x48, 0x4F, 0xF2, 0x65, 0x8E, + 0x78, 0x5C, 0x58, 0x19, 0x8D, 0xE5, 0x98, 0x57, 0x67, 0x7F, 0x05, 0x64, + 0xAF, 0x63, 0xB6, 0xFE, 0xF5, 0xB7, 0x3C, 0xA5, 0xCE, 0xE9, 0x68, 0x44, + 0xE0, 0x4D, 0x43, 0x69, 0x29, 0x2E, 0xAC, 0x15, 0x59, 0xA8, 0x0A, 0x9E, + 0x6E, 0x47, 0xDF, 0x34, 0x35, 0x6A, 0xCF, 0xDC, 0x22, 0xC9, 0xC0, 0x9B, + 0x89, 0xD4, 0xED, 0xAB, 0x12, 0xA2, 0x0D, 0x52, 0xBB, 0x02, 0x2F, 0xA9, + 0xD7, 0x61, 0x1E, 0xB4, 0x50, 0x04, 0xF6, 0xC2, 0x16, 0x25, 0x86, 0x56, + 0x55, 0x09, 0xBE, 0x91 +} +}; + + +const word32 Twofish::mds_[4][256] = { + { + 0xbcbc3275, 0xecec21f3, 0x202043c6, 0xb3b3c9f4, + 0xdada03db, 0x02028b7b, 0xe2e22bfb, 0x9e9efac8, + 0xc9c9ec4a, 0xd4d409d3, 0x18186be6, 0x1e1e9f6b, + 0x98980e45, 0xb2b2387d, 0xa6a6d2e8, 0x2626b74b, + 0x3c3c57d6, 0x93938a32, 0x8282eed8, 0x525298fd, + 0x7b7bd437, 0xbbbb3771, 0x5b5b97f1, 0x474783e1, + 0x24243c30, 0x5151e20f, 0xbabac6f8, 0x4a4af31b, + 0xbfbf4887, 0x0d0d70fa, 0xb0b0b306, 0x7575de3f, + 0xd2d2fd5e, 0x7d7d20ba, 0x666631ae, 0x3a3aa35b, + 0x59591c8a, 0x00000000, 0xcdcd93bc, 0x1a1ae09d, + 0xaeae2c6d, 0x7f7fabc1, 0x2b2bc7b1, 0xbebeb90e, + 0xe0e0a080, 0x8a8a105d, 0x3b3b52d2, 0x6464bad5, + 0xd8d888a0, 0xe7e7a584, 0x5f5fe807, 0x1b1b1114, + 0x2c2cc2b5, 0xfcfcb490, 0x3131272c, 0x808065a3, + 0x73732ab2, 0x0c0c8173, 0x79795f4c, 0x6b6b4154, + 0x4b4b0292, 0x53536974, 0x94948f36, 0x83831f51, + 0x2a2a3638, 0xc4c49cb0, 0x2222c8bd, 0xd5d5f85a, + 0xbdbdc3fc, 0x48487860, 0xffffce62, 0x4c4c0796, + 0x4141776c, 0xc7c7e642, 0xebeb24f7, 0x1c1c1410, + 0x5d5d637c, 0x36362228, 0x6767c027, 0xe9e9af8c, + 0x4444f913, 0x1414ea95, 0xf5f5bb9c, 0xcfcf18c7, + 0x3f3f2d24, 0xc0c0e346, 0x7272db3b, 0x54546c70, + 0x29294cca, 0xf0f035e3, 0x0808fe85, 0xc6c617cb, + 0xf3f34f11, 0x8c8ce4d0, 0xa4a45993, 0xcaca96b8, + 0x68683ba6, 0xb8b84d83, 0x38382820, 0xe5e52eff, + 0xadad569f, 0x0b0b8477, 0xc8c81dc3, 0x9999ffcc, + 0x5858ed03, 0x19199a6f, 0x0e0e0a08, 0x95957ebf, + 0x70705040, 0xf7f730e7, 0x6e6ecf2b, 0x1f1f6ee2, + 0xb5b53d79, 0x09090f0c, 0x616134aa, 0x57571682, + 0x9f9f0b41, 0x9d9d803a, 0x111164ea, 0x2525cdb9, + 0xafafdde4, 0x4545089a, 0xdfdf8da4, 0xa3a35c97, + 0xeaead57e, 0x353558da, 0xededd07a, 0x4343fc17, + 0xf8f8cb66, 0xfbfbb194, 0x3737d3a1, 0xfafa401d, + 0xc2c2683d, 0xb4b4ccf0, 0x32325dde, 0x9c9c71b3, + 0x5656e70b, 0xe3e3da72, 0x878760a7, 0x15151b1c, + 0xf9f93aef, 0x6363bfd1, 0x3434a953, 0x9a9a853e, + 0xb1b1428f, 0x7c7cd133, 0x88889b26, 0x3d3da65f, + 0xa1a1d7ec, 0xe4e4df76, 0x8181942a, 0x91910149, + 0x0f0ffb81, 0xeeeeaa88, 0x161661ee, 0xd7d77321, + 0x9797f5c4, 0xa5a5a81a, 0xfefe3feb, 0x6d6db5d9, + 0x7878aec5, 0xc5c56d39, 0x1d1de599, 0x7676a4cd, + 0x3e3edcad, 0xcbcb6731, 0xb6b6478b, 0xefef5b01, + 0x12121e18, 0x6060c523, 0x6a6ab0dd, 0x4d4df61f, + 0xcecee94e, 0xdede7c2d, 0x55559df9, 0x7e7e5a48, + 0x2121b24f, 0x03037af2, 0xa0a02665, 0x5e5e198e, + 0x5a5a6678, 0x65654b5c, 0x62624e58, 0xfdfd4519, + 0x0606f48d, 0x404086e5, 0xf2f2be98, 0x3333ac57, + 0x17179067, 0x05058e7f, 0xe8e85e05, 0x4f4f7d64, + 0x89896aaf, 0x10109563, 0x74742fb6, 0x0a0a75fe, + 0x5c5c92f5, 0x9b9b74b7, 0x2d2d333c, 0x3030d6a5, + 0x2e2e49ce, 0x494989e9, 0x46467268, 0x77775544, + 0xa8a8d8e0, 0x9696044d, 0x2828bd43, 0xa9a92969, + 0xd9d97929, 0x8686912e, 0xd1d187ac, 0xf4f44a15, + 0x8d8d1559, 0xd6d682a8, 0xb9b9bc0a, 0x42420d9e, + 0xf6f6c16e, 0x2f2fb847, 0xdddd06df, 0x23233934, + 0xcccc6235, 0xf1f1c46a, 0xc1c112cf, 0x8585ebdc, + 0x8f8f9e22, 0x7171a1c9, 0x9090f0c0, 0xaaaa539b, + 0x0101f189, 0x8b8be1d4, 0x4e4e8ced, 0x8e8e6fab, + 0xababa212, 0x6f6f3ea2, 0xe6e6540d, 0xdbdbf252, + 0x92927bbb, 0xb7b7b602, 0x6969ca2f, 0x3939d9a9, + 0xd3d30cd7, 0xa7a72361, 0xa2a2ad1e, 0xc3c399b4, + 0x6c6c4450, 0x07070504, 0x04047ff6, 0x272746c2, + 0xacaca716, 0xd0d07625, 0x50501386, 0xdcdcf756, + 0x84841a55, 0xe1e15109, 0x7a7a25be, 0x1313ef91 + }, + { + 0xa9d93939, 0x67901717, 0xb3719c9c, 0xe8d2a6a6, + 0x04050707, 0xfd985252, 0xa3658080, 0x76dfe4e4, + 0x9a084545, 0x92024b4b, 0x80a0e0e0, 0x78665a5a, + 0xe4ddafaf, 0xddb06a6a, 0xd1bf6363, 0x38362a2a, + 0x0d54e6e6, 0xc6432020, 0x3562cccc, 0x98bef2f2, + 0x181e1212, 0xf724ebeb, 0xecd7a1a1, 0x6c774141, + 0x43bd2828, 0x7532bcbc, 0x37d47b7b, 0x269b8888, + 0xfa700d0d, 0x13f94444, 0x94b1fbfb, 0x485a7e7e, + 0xf27a0303, 0xd0e48c8c, 0x8b47b6b6, 0x303c2424, + 0x84a5e7e7, 0x54416b6b, 0xdf06dddd, 0x23c56060, + 0x1945fdfd, 0x5ba33a3a, 0x3d68c2c2, 0x59158d8d, + 0xf321ecec, 0xae316666, 0xa23e6f6f, 0x82165757, + 0x63951010, 0x015befef, 0x834db8b8, 0x2e918686, + 0xd9b56d6d, 0x511f8383, 0x9b53aaaa, 0x7c635d5d, + 0xa63b6868, 0xeb3ffefe, 0xa5d63030, 0xbe257a7a, + 0x16a7acac, 0x0c0f0909, 0xe335f0f0, 0x6123a7a7, + 0xc0f09090, 0x8cafe9e9, 0x3a809d9d, 0xf5925c5c, + 0x73810c0c, 0x2c273131, 0x2576d0d0, 0x0be75656, + 0xbb7b9292, 0x4ee9cece, 0x89f10101, 0x6b9f1e1e, + 0x53a93434, 0x6ac4f1f1, 0xb499c3c3, 0xf1975b5b, + 0xe1834747, 0xe66b1818, 0xbdc82222, 0x450e9898, + 0xe26e1f1f, 0xf4c9b3b3, 0xb62f7474, 0x66cbf8f8, + 0xccff9999, 0x95ea1414, 0x03ed5858, 0x56f7dcdc, + 0xd4e18b8b, 0x1c1b1515, 0x1eada2a2, 0xd70cd3d3, + 0xfb2be2e2, 0xc31dc8c8, 0x8e195e5e, 0xb5c22c2c, + 0xe9894949, 0xcf12c1c1, 0xbf7e9595, 0xba207d7d, + 0xea641111, 0x77840b0b, 0x396dc5c5, 0xaf6a8989, + 0x33d17c7c, 0xc9a17171, 0x62ceffff, 0x7137bbbb, + 0x81fb0f0f, 0x793db5b5, 0x0951e1e1, 0xaddc3e3e, + 0x242d3f3f, 0xcda47676, 0xf99d5555, 0xd8ee8282, + 0xe5864040, 0xc5ae7878, 0xb9cd2525, 0x4d049696, + 0x44557777, 0x080a0e0e, 0x86135050, 0xe730f7f7, + 0xa1d33737, 0x1d40fafa, 0xaa346161, 0xed8c4e4e, + 0x06b3b0b0, 0x706c5454, 0xb22a7373, 0xd2523b3b, + 0x410b9f9f, 0x7b8b0202, 0xa088d8d8, 0x114ff3f3, + 0x3167cbcb, 0xc2462727, 0x27c06767, 0x90b4fcfc, + 0x20283838, 0xf67f0404, 0x60784848, 0xff2ee5e5, + 0x96074c4c, 0x5c4b6565, 0xb1c72b2b, 0xab6f8e8e, + 0x9e0d4242, 0x9cbbf5f5, 0x52f2dbdb, 0x1bf34a4a, + 0x5fa63d3d, 0x9359a4a4, 0x0abcb9b9, 0xef3af9f9, + 0x91ef1313, 0x85fe0808, 0x49019191, 0xee611616, + 0x2d7cdede, 0x4fb22121, 0x8f42b1b1, 0x3bdb7272, + 0x47b82f2f, 0x8748bfbf, 0x6d2caeae, 0x46e3c0c0, + 0xd6573c3c, 0x3e859a9a, 0x6929a9a9, 0x647d4f4f, + 0x2a948181, 0xce492e2e, 0xcb17c6c6, 0x2fca6969, + 0xfcc3bdbd, 0x975ca3a3, 0x055ee8e8, 0x7ad0eded, + 0xac87d1d1, 0x7f8e0505, 0xd5ba6464, 0x1aa8a5a5, + 0x4bb72626, 0x0eb9bebe, 0xa7608787, 0x5af8d5d5, + 0x28223636, 0x14111b1b, 0x3fde7575, 0x2979d9d9, + 0x88aaeeee, 0x3c332d2d, 0x4c5f7979, 0x02b6b7b7, + 0xb896caca, 0xda583535, 0xb09cc4c4, 0x17fc4343, + 0x551a8484, 0x1ff64d4d, 0x8a1c5959, 0x7d38b2b2, + 0x57ac3333, 0xc718cfcf, 0x8df40606, 0x74695353, + 0xb7749b9b, 0xc4f59797, 0x9f56adad, 0x72dae3e3, + 0x7ed5eaea, 0x154af4f4, 0x229e8f8f, 0x12a2abab, + 0x584e6262, 0x07e85f5f, 0x99e51d1d, 0x34392323, + 0x6ec1f6f6, 0x50446c6c, 0xde5d3232, 0x68724646, + 0x6526a0a0, 0xbc93cdcd, 0xdb03dada, 0xf8c6baba, + 0xc8fa9e9e, 0xa882d6d6, 0x2bcf6e6e, 0x40507070, + 0xdceb8585, 0xfe750a0a, 0x328a9393, 0xa48ddfdf, + 0xca4c2929, 0x10141c1c, 0x2173d7d7, 0xf0ccb4b4, + 0xd309d4d4, 0x5d108a8a, 0x0fe25151, 0x00000000, + 0x6f9a1919, 0x9de01a1a, 0x368f9494, 0x42e6c7c7, + 0x4aecc9c9, 0x5efdd2d2, 0xc1ab7f7f, 0xe0d8a8a8 + }, + { + 0xbc75bc32, 0xecf3ec21, 0x20c62043, 0xb3f4b3c9, + 0xdadbda03, 0x027b028b, 0xe2fbe22b, 0x9ec89efa, + 0xc94ac9ec, 0xd4d3d409, 0x18e6186b, 0x1e6b1e9f, + 0x9845980e, 0xb27db238, 0xa6e8a6d2, 0x264b26b7, + 0x3cd63c57, 0x9332938a, 0x82d882ee, 0x52fd5298, + 0x7b377bd4, 0xbb71bb37, 0x5bf15b97, 0x47e14783, + 0x2430243c, 0x510f51e2, 0xbaf8bac6, 0x4a1b4af3, + 0xbf87bf48, 0x0dfa0d70, 0xb006b0b3, 0x753f75de, + 0xd25ed2fd, 0x7dba7d20, 0x66ae6631, 0x3a5b3aa3, + 0x598a591c, 0x00000000, 0xcdbccd93, 0x1a9d1ae0, + 0xae6dae2c, 0x7fc17fab, 0x2bb12bc7, 0xbe0ebeb9, + 0xe080e0a0, 0x8a5d8a10, 0x3bd23b52, 0x64d564ba, + 0xd8a0d888, 0xe784e7a5, 0x5f075fe8, 0x1b141b11, + 0x2cb52cc2, 0xfc90fcb4, 0x312c3127, 0x80a38065, + 0x73b2732a, 0x0c730c81, 0x794c795f, 0x6b546b41, + 0x4b924b02, 0x53745369, 0x9436948f, 0x8351831f, + 0x2a382a36, 0xc4b0c49c, 0x22bd22c8, 0xd55ad5f8, + 0xbdfcbdc3, 0x48604878, 0xff62ffce, 0x4c964c07, + 0x416c4177, 0xc742c7e6, 0xebf7eb24, 0x1c101c14, + 0x5d7c5d63, 0x36283622, 0x672767c0, 0xe98ce9af, + 0x441344f9, 0x149514ea, 0xf59cf5bb, 0xcfc7cf18, + 0x3f243f2d, 0xc046c0e3, 0x723b72db, 0x5470546c, + 0x29ca294c, 0xf0e3f035, 0x088508fe, 0xc6cbc617, + 0xf311f34f, 0x8cd08ce4, 0xa493a459, 0xcab8ca96, + 0x68a6683b, 0xb883b84d, 0x38203828, 0xe5ffe52e, + 0xad9fad56, 0x0b770b84, 0xc8c3c81d, 0x99cc99ff, + 0x580358ed, 0x196f199a, 0x0e080e0a, 0x95bf957e, + 0x70407050, 0xf7e7f730, 0x6e2b6ecf, 0x1fe21f6e, + 0xb579b53d, 0x090c090f, 0x61aa6134, 0x57825716, + 0x9f419f0b, 0x9d3a9d80, 0x11ea1164, 0x25b925cd, + 0xafe4afdd, 0x459a4508, 0xdfa4df8d, 0xa397a35c, + 0xea7eead5, 0x35da3558, 0xed7aedd0, 0x431743fc, + 0xf866f8cb, 0xfb94fbb1, 0x37a137d3, 0xfa1dfa40, + 0xc23dc268, 0xb4f0b4cc, 0x32de325d, 0x9cb39c71, + 0x560b56e7, 0xe372e3da, 0x87a78760, 0x151c151b, + 0xf9eff93a, 0x63d163bf, 0x345334a9, 0x9a3e9a85, + 0xb18fb142, 0x7c337cd1, 0x8826889b, 0x3d5f3da6, + 0xa1eca1d7, 0xe476e4df, 0x812a8194, 0x91499101, + 0x0f810ffb, 0xee88eeaa, 0x16ee1661, 0xd721d773, + 0x97c497f5, 0xa51aa5a8, 0xfeebfe3f, 0x6dd96db5, + 0x78c578ae, 0xc539c56d, 0x1d991de5, 0x76cd76a4, + 0x3ead3edc, 0xcb31cb67, 0xb68bb647, 0xef01ef5b, + 0x1218121e, 0x602360c5, 0x6add6ab0, 0x4d1f4df6, + 0xce4ecee9, 0xde2dde7c, 0x55f9559d, 0x7e487e5a, + 0x214f21b2, 0x03f2037a, 0xa065a026, 0x5e8e5e19, + 0x5a785a66, 0x655c654b, 0x6258624e, 0xfd19fd45, + 0x068d06f4, 0x40e54086, 0xf298f2be, 0x335733ac, + 0x17671790, 0x057f058e, 0xe805e85e, 0x4f644f7d, + 0x89af896a, 0x10631095, 0x74b6742f, 0x0afe0a75, + 0x5cf55c92, 0x9bb79b74, 0x2d3c2d33, 0x30a530d6, + 0x2ece2e49, 0x49e94989, 0x46684672, 0x77447755, + 0xa8e0a8d8, 0x964d9604, 0x284328bd, 0xa969a929, + 0xd929d979, 0x862e8691, 0xd1acd187, 0xf415f44a, + 0x8d598d15, 0xd6a8d682, 0xb90ab9bc, 0x429e420d, + 0xf66ef6c1, 0x2f472fb8, 0xdddfdd06, 0x23342339, + 0xcc35cc62, 0xf16af1c4, 0xc1cfc112, 0x85dc85eb, + 0x8f228f9e, 0x71c971a1, 0x90c090f0, 0xaa9baa53, + 0x018901f1, 0x8bd48be1, 0x4eed4e8c, 0x8eab8e6f, + 0xab12aba2, 0x6fa26f3e, 0xe60de654, 0xdb52dbf2, + 0x92bb927b, 0xb702b7b6, 0x692f69ca, 0x39a939d9, + 0xd3d7d30c, 0xa761a723, 0xa21ea2ad, 0xc3b4c399, + 0x6c506c44, 0x07040705, 0x04f6047f, 0x27c22746, + 0xac16aca7, 0xd025d076, 0x50865013, 0xdc56dcf7, + 0x8455841a, 0xe109e151, 0x7abe7a25, 0x139113ef + }, + { + 0xd939a9d9, 0x90176790, 0x719cb371, 0xd2a6e8d2, + 0x05070405, 0x9852fd98, 0x6580a365, 0xdfe476df, + 0x08459a08, 0x024b9202, 0xa0e080a0, 0x665a7866, + 0xddafe4dd, 0xb06addb0, 0xbf63d1bf, 0x362a3836, + 0x54e60d54, 0x4320c643, 0x62cc3562, 0xbef298be, + 0x1e12181e, 0x24ebf724, 0xd7a1ecd7, 0x77416c77, + 0xbd2843bd, 0x32bc7532, 0xd47b37d4, 0x9b88269b, + 0x700dfa70, 0xf94413f9, 0xb1fb94b1, 0x5a7e485a, + 0x7a03f27a, 0xe48cd0e4, 0x47b68b47, 0x3c24303c, + 0xa5e784a5, 0x416b5441, 0x06dddf06, 0xc56023c5, + 0x45fd1945, 0xa33a5ba3, 0x68c23d68, 0x158d5915, + 0x21ecf321, 0x3166ae31, 0x3e6fa23e, 0x16578216, + 0x95106395, 0x5bef015b, 0x4db8834d, 0x91862e91, + 0xb56dd9b5, 0x1f83511f, 0x53aa9b53, 0x635d7c63, + 0x3b68a63b, 0x3ffeeb3f, 0xd630a5d6, 0x257abe25, + 0xa7ac16a7, 0x0f090c0f, 0x35f0e335, 0x23a76123, + 0xf090c0f0, 0xafe98caf, 0x809d3a80, 0x925cf592, + 0x810c7381, 0x27312c27, 0x76d02576, 0xe7560be7, + 0x7b92bb7b, 0xe9ce4ee9, 0xf10189f1, 0x9f1e6b9f, + 0xa93453a9, 0xc4f16ac4, 0x99c3b499, 0x975bf197, + 0x8347e183, 0x6b18e66b, 0xc822bdc8, 0x0e98450e, + 0x6e1fe26e, 0xc9b3f4c9, 0x2f74b62f, 0xcbf866cb, + 0xff99ccff, 0xea1495ea, 0xed5803ed, 0xf7dc56f7, + 0xe18bd4e1, 0x1b151c1b, 0xada21ead, 0x0cd3d70c, + 0x2be2fb2b, 0x1dc8c31d, 0x195e8e19, 0xc22cb5c2, + 0x8949e989, 0x12c1cf12, 0x7e95bf7e, 0x207dba20, + 0x6411ea64, 0x840b7784, 0x6dc5396d, 0x6a89af6a, + 0xd17c33d1, 0xa171c9a1, 0xceff62ce, 0x37bb7137, + 0xfb0f81fb, 0x3db5793d, 0x51e10951, 0xdc3eaddc, + 0x2d3f242d, 0xa476cda4, 0x9d55f99d, 0xee82d8ee, + 0x8640e586, 0xae78c5ae, 0xcd25b9cd, 0x04964d04, + 0x55774455, 0x0a0e080a, 0x13508613, 0x30f7e730, + 0xd337a1d3, 0x40fa1d40, 0x3461aa34, 0x8c4eed8c, + 0xb3b006b3, 0x6c54706c, 0x2a73b22a, 0x523bd252, + 0x0b9f410b, 0x8b027b8b, 0x88d8a088, 0x4ff3114f, + 0x67cb3167, 0x4627c246, 0xc06727c0, 0xb4fc90b4, + 0x28382028, 0x7f04f67f, 0x78486078, 0x2ee5ff2e, + 0x074c9607, 0x4b655c4b, 0xc72bb1c7, 0x6f8eab6f, + 0x0d429e0d, 0xbbf59cbb, 0xf2db52f2, 0xf34a1bf3, + 0xa63d5fa6, 0x59a49359, 0xbcb90abc, 0x3af9ef3a, + 0xef1391ef, 0xfe0885fe, 0x01914901, 0x6116ee61, + 0x7cde2d7c, 0xb2214fb2, 0x42b18f42, 0xdb723bdb, + 0xb82f47b8, 0x48bf8748, 0x2cae6d2c, 0xe3c046e3, + 0x573cd657, 0x859a3e85, 0x29a96929, 0x7d4f647d, + 0x94812a94, 0x492ece49, 0x17c6cb17, 0xca692fca, + 0xc3bdfcc3, 0x5ca3975c, 0x5ee8055e, 0xd0ed7ad0, + 0x87d1ac87, 0x8e057f8e, 0xba64d5ba, 0xa8a51aa8, + 0xb7264bb7, 0xb9be0eb9, 0x6087a760, 0xf8d55af8, + 0x22362822, 0x111b1411, 0xde753fde, 0x79d92979, + 0xaaee88aa, 0x332d3c33, 0x5f794c5f, 0xb6b702b6, + 0x96cab896, 0x5835da58, 0x9cc4b09c, 0xfc4317fc, + 0x1a84551a, 0xf64d1ff6, 0x1c598a1c, 0x38b27d38, + 0xac3357ac, 0x18cfc718, 0xf4068df4, 0x69537469, + 0x749bb774, 0xf597c4f5, 0x56ad9f56, 0xdae372da, + 0xd5ea7ed5, 0x4af4154a, 0x9e8f229e, 0xa2ab12a2, + 0x4e62584e, 0xe85f07e8, 0xe51d99e5, 0x39233439, + 0xc1f66ec1, 0x446c5044, 0x5d32de5d, 0x72466872, + 0x26a06526, 0x93cdbc93, 0x03dadb03, 0xc6baf8c6, + 0xfa9ec8fa, 0x82d6a882, 0xcf6e2bcf, 0x50704050, + 0xeb85dceb, 0x750afe75, 0x8a93328a, 0x8ddfa48d, + 0x4c29ca4c, 0x141c1014, 0x73d72173, 0xccb4f0cc, + 0x09d4d309, 0x108a5d10, 0xe2510fe2, 0x00000000, + 0x9a196f9a, 0xe01a9de0, 0x8f94368f, 0xe6c742e6, + 0xecc94aec, 0xfdd25efd, 0xab7fc1ab, 0xd8a8e0d8 + } +}; + + +} // namespace + diff --git a/externals/mysql/extlib/yassl/taocrypt/src/twofish.cpp b/externals/mysql/extlib/yassl/taocrypt/src/twofish.cpp new file mode 100644 index 0000000..84dd35f --- /dev/null +++ b/externals/mysql/extlib/yassl/taocrypt/src/twofish.cpp @@ -0,0 +1,575 @@ +/* + Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. +*/ + +/* C++ based on Wei Dai's twofish.cpp from CryptoPP */ +/* x86 asm original */ + + +#if defined(TAOCRYPT_KERNEL_MODE) + #define DO_TAOCRYPT_KERNEL_MODE +#endif // only some modules now support this + +#include "runtime.hpp" +#include "twofish.hpp" + + + +namespace TaoCrypt { + + +#if defined(DO_TWOFISH_ASM) + +// ia32 optimized version +void Twofish::Process(byte* out, const byte* in, word32 sz) +{ + if (!isMMX) { + Mode_BASE::Process(out, in, sz); + return; + } + + word32 blocks = sz / BLOCK_SIZE; + + if (mode_ == ECB) + while (blocks--) { + if (dir_ == ENCRYPTION) + AsmEncrypt(in, out); + else + AsmDecrypt(in, out); + + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } + else if (mode_ == CBC) + if (dir_ == ENCRYPTION) + while (blocks--) { + r_[0] ^= *(word32*)in; + r_[1] ^= *(word32*)(in + 4); + r_[2] ^= *(word32*)(in + 8); + r_[3] ^= *(word32*)(in + 12); + + AsmEncrypt((byte*)r_, (byte*)r_); + memcpy(out, r_, BLOCK_SIZE); + + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } + else + while (blocks--) { + AsmDecrypt(in, out); + + *(word32*)out ^= r_[0]; + *(word32*)(out + 4) ^= r_[1]; + *(word32*)(out + 8) ^= r_[2]; + *(word32*)(out + 12) ^= r_[3]; + + memcpy(r_, in, BLOCK_SIZE); + + out += BLOCK_SIZE; + in += BLOCK_SIZE; + } +} + +#endif // DO_TWOFISH_ASM + + +namespace { // locals + +// compute (c * x^4) mod (x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1) +// over GF(256) +static inline unsigned int Mod(unsigned int c) +{ + static const unsigned int modulus = 0x14d; + unsigned int c2 = (c<<1) ^ ((c & 0x80) ? modulus : 0); + unsigned int c1 = c2 ^ (c>>1) ^ ((c & 1) ? (modulus>>1) : 0); + return c | (c1 << 8) | (c2 << 16) | (c1 << 24); +} + +// compute RS(12,8) code with the above polynomial as generator +// this is equivalent to multiplying by the RS matrix +static word32 ReedSolomon(word32 high, word32 low) +{ + for (unsigned int i=0; i<8; i++) { + high = Mod(high>>24) ^ (high<<8) ^ (low>>24); + low <<= 8; + } + return high; +} + +} // local namespace + + + +inline word32 Twofish::h0(word32 x, const word32* key, unsigned int kLen) +{ + x = x | (x<<8) | (x<<16) | (x<<24); + switch(kLen) + { +#define Q(a, b, c, d, t) q_[a][GETBYTE(t,0)] ^ (q_[b][GETBYTE(t,1)] << 8) ^ \ + (q_[c][GETBYTE(t,2)] << 16) ^ (q_[d][GETBYTE(t,3)] << 24) + case 4: x = Q(1, 0, 0, 1, x) ^ key[6]; + case 3: x = Q(1, 1, 0, 0, x) ^ key[4]; + case 2: x = Q(0, 1, 0, 1, x) ^ key[2]; + x = Q(0, 0, 1, 1, x) ^ key[0]; + } + return x; +} + +inline word32 Twofish::h(word32 x, const word32* key, unsigned int kLen) +{ + x = h0(x, key, kLen); + return mds_[0][GETBYTE(x,0)] ^ mds_[1][GETBYTE(x,1)] ^ + mds_[2][GETBYTE(x,2)] ^ mds_[3][GETBYTE(x,3)]; +} + + +void Twofish::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) +{ + assert(keylen >= 16 && keylen <= 32); + + unsigned int len = (keylen <= 16 ? 2 : (keylen <= 24 ? 3 : 4)); + word32 key[8]; + GetUserKey(LittleEndianOrder, key, len*2, userKey, keylen); + + unsigned int i; + for (i=0; i<40; i+=2) { + word32 a = h(i, key, len); + word32 b = rotlFixed(h(i+1, key+1, len), 8); + k_[i] = a+b; + k_[i+1] = rotlFixed(a+2*b, 9); + } + + word32 svec[8]; + for (i=0; i gpBlock; + +void Twofish::encrypt(const byte* inBlock, const byte* xorBlock, + byte* outBlock) const +{ + word32 x, y, a, b, c, d; + + gpBlock::Get(inBlock)(a)(b)(c)(d); + + a ^= k_[0]; + b ^= k_[1]; + c ^= k_[2]; + d ^= k_[3]; + + const word32 *k = k_+8; + + ENCCYCLE (0); + ENCCYCLE (1); + ENCCYCLE (2); + ENCCYCLE (3); + ENCCYCLE (4); + ENCCYCLE (5); + ENCCYCLE (6); + ENCCYCLE (7); + + c ^= k_[4]; + d ^= k_[5]; + a ^= k_[6]; + b ^= k_[7]; + + gpBlock::Put(xorBlock, outBlock)(c)(d)(a)(b); +} + + +void Twofish::decrypt(const byte* inBlock, const byte* xorBlock, + byte* outBlock) const +{ + word32 x, y, a, b, c, d; + + gpBlock::Get(inBlock)(c)(d)(a)(b); + + c ^= k_[4]; + d ^= k_[5]; + a ^= k_[6]; + b ^= k_[7]; + + const word32 *k = k_+8; + DECCYCLE (7); + DECCYCLE (6); + DECCYCLE (5); + DECCYCLE (4); + DECCYCLE (3); + DECCYCLE (2); + DECCYCLE (1); + DECCYCLE (0); + + a ^= k_[0]; + b ^= k_[1]; + c ^= k_[2]; + d ^= k_[3]; + + gpBlock::Put(xorBlock, outBlock)(a)(b)(c)(d); +} + + + +#if defined(DO_TWOFISH_ASM) + #ifdef __GNUC__ + #define AS1(x) asm(#x); + #define AS2(x, y) asm(#x ", " #y); + + #define PROLOG() \ + asm(".intel_syntax noprefix"); \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov edi, DWORD PTR [ebp + 8] ) \ + AS2( mov esi, DWORD PTR [ebp + 12] ) + + #define EPILOG() \ + AS2( movd esp, mm6 ) \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS1( emms ) \ + asm(".att_syntax"); + #else + #define AS1(x) __asm x + #define AS2(x, y) __asm x, y + + #define PROLOG() \ + AS1( push ebp ) \ + AS2( mov ebp, esp ) \ + AS2( movd mm3, edi ) \ + AS2( movd mm4, ebx ) \ + AS2( movd mm5, esi ) \ + AS2( movd mm6, ebp ) \ + AS2( mov edi, ecx ) \ + AS2( mov esi, DWORD PTR [ebp + 8] ) + + /* ebp already set */ + #define EPILOG() \ + AS2( movd esi, mm5 ) \ + AS2( movd ebx, mm4 ) \ + AS2( movd edi, mm3 ) \ + AS2( mov esp, ebp ) \ + AS1( pop ebp ) \ + AS1( emms ) \ + AS1( ret 8 ) + + #endif + + + + + // x = esi, y = [esp], s_ = ebp + // edi always open for G1 and G2 + // G1 also uses edx after save and restore + // G2 also uses eax after save and restore + // and ecx for tmp [esp] which Rounds also use + // and restore from mm7 + + // x = G1(a) bytes(0,1,2,3) +#define ASMG1(z, zl, zh) \ + AS2( movd mm2, edx ) \ + AS2( movzx edi, zl ) \ + AS2( mov esi, DWORD PTR [ebp + edi*4] ) \ + AS2( movzx edx, zh ) \ + AS2( xor esi, DWORD PTR 1024[ebp + edx*4] ) \ + \ + AS2( mov edx, z ) \ + AS2( shr edx, 16 ) \ + AS2( movzx edi, dl ) \ + AS2( xor esi, DWORD PTR 2048[ebp + edi*4] ) \ + AS2( movzx edx, dh ) \ + AS2( xor esi, DWORD PTR 3072[ebp + edx*4] ) \ + AS2( movd edx, mm2 ) + + + // y = G2(b) bytes(3,0,1,2) [ put y into ecx for Rounds ] +#define ASMG2(z, zl, zh) \ + AS2( movd mm7, ecx ) \ + AS2( movd mm2, eax ) \ + AS2( mov edi, z ) \ + AS2( shr edi, 24 ) \ + AS2( mov ecx, DWORD PTR [ebp + edi*4] ) \ + AS2( movzx eax, zl ) \ + AS2( xor ecx, DWORD PTR 1024[ebp + eax*4] ) \ + \ + AS2( mov eax, z ) \ + AS2( shr eax, 16 ) \ + AS2( movzx edi, zh ) \ + AS2( xor ecx, DWORD PTR 2048[ebp + edi*4] ) \ + AS2( movzx eax, al ) \ + AS2( xor ecx, DWORD PTR 3072[ebp + eax*4] ) \ + AS2( movd eax, mm2 ) + + + // encrypt Round (n), + // x = esi, k = ebp, edi open + // y is in ecx from G2, restore when done from mm7 + // before C (which be same register!) +#define ASMENCROUND(N, A, A2, A3, B, B2, B3, C, D) \ + /* setup s_ */ \ + AS2( movd ebp, mm1 ) \ + ASMG1(A, A2, A3) \ + ASMG2(B, B2, B3) \ + /* setup k */ \ + AS2( movd ebp, mm0 ) \ + /* x += y */ \ + AS2( add esi, ecx ) \ + AS2( add ebp, 32 ) \ + /* y += x + k[2 * (n) + 1] */ \ + AS2( add ecx, esi ) \ + AS2( rol D, 1 ) \ + AS2( add ecx, DWORD PTR [ebp + 8 * N + 4] ) \ + /* (d) = rotlFixed(d, 1) ^ y */ \ + AS2( xor D, ecx ) \ + AS2( movd ecx, mm7 ) \ + /* (c) ^= x + k[2 * (n)] */ \ + AS2( mov edi, esi ) \ + AS2( add edi, DWORD PTR [ebp + 8 * N] ) \ + AS2( xor C, edi ) \ + /* (c) = rotrFixed(c, 1) */ \ + AS2( ror C, 1 ) + + + // decrypt Round (n), + // x = esi, k = ebp, edi open + // y is in ecx from G2, restore ecx from mm7 when done +#define ASMDECROUND(N, A, A2, A3, B, B2, B3, C, D) \ + /* setup s_ */ \ + AS2( movd ebp, mm1 ) \ + ASMG1(A, A2, A3) \ + ASMG2(B, B2, B3) \ + /* setup k */ \ + AS2( movd ebp, mm0 ) \ + /* x += y */ \ + AS2( add esi, ecx ) \ + AS2( add ebp, 32 ) \ + /* y += x */ \ + AS2( add ecx, esi ) \ + /* (d) ^= y + k[2 * (n) + 1] */ \ + AS2( mov edi, DWORD PTR [ebp + 8 * N + 4] ) \ + AS2( add edi, ecx ) \ + AS2( movd ecx, mm7 ) \ + AS2( xor D, edi ) \ + /* (d) = rotrFixed(d, 1) */ \ + AS2( ror D, 1 ) \ + /* (c) = rotlFixed(c, 1) */ \ + AS2( rol C, 1 ) \ + /* (c) ^= (x + k[2 * (n)]) */ \ + AS2( mov edi, esi ) \ + AS2( add edi, DWORD PTR [ebp + 8 * N] ) \ + AS2( xor C, edi ) + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void Twofish::AsmEncrypt(const byte* inBlock, byte* outBlock) const +{ + PROLOG() + + #ifdef OLD_GCC_OFFSET + AS2( add edi, 60 ) // k_ + #else + AS2( add edi, 56 ) // k_ + #endif + + AS2( mov ebp, edi ) + + AS2( mov eax, DWORD PTR [esi] ) // a + AS2( movd mm0, edi ) // store k_ + AS2( mov ebx, DWORD PTR [esi + 4] ) // b + AS2( add ebp, 160 ) // s_[0] + AS2( mov ecx, DWORD PTR [esi + 8] ) // c + AS2( movd mm1, ebp ) // store s_ + AS2( mov edx, DWORD PTR [esi + 12] ) // d + + AS2( xor eax, DWORD PTR [edi] ) // k_[0] + AS2( xor ebx, DWORD PTR [edi + 4] ) // [1] + AS2( xor ecx, DWORD PTR [edi + 8] ) // [2] + AS2( xor edx, DWORD PTR [edi + 12] ) // [3] + + + ASMENCROUND( 0, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND( 1, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMENCROUND( 2, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND( 3, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMENCROUND( 4, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND( 5, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMENCROUND( 6, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND( 7, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMENCROUND( 8, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND( 9, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMENCROUND(10, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND(11, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMENCROUND(12, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND(13, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMENCROUND(14, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMENCROUND(15, ecx, cl, ch, edx, dl, dh, eax, ebx) + + + AS2( movd ebp, mm6 ) + AS2( movd esi, mm0 ) // k_ + #ifdef __GNUC__ + AS2( mov edi, [ebp + 16] ) // outBlock + #else + AS2( mov edi, [ebp + 12] ) // outBlock + #endif + + AS2( xor ecx, DWORD PTR [esi + 16] ) // k_[4] + AS2( xor edx, DWORD PTR [esi + 20] ) // k_[5] + AS2( xor eax, DWORD PTR [esi + 24] ) // k_[6] + AS2( xor ebx, DWORD PTR [esi + 28] ) // k_[7] + + AS2( mov [edi], ecx ) // write out + AS2( mov [edi + 4], edx ) // write out + AS2( mov [edi + 8], eax ) // write out + AS2( mov [edi + 12], ebx ) // write out + + + EPILOG() +} + + +#ifdef _MSC_VER + __declspec(naked) +#endif +void Twofish::AsmDecrypt(const byte* inBlock, byte* outBlock) const +{ + PROLOG() + + #ifdef OLD_GCC_OFFSET + AS2( add edi, 60 ) // k_ + #else + AS2( add edi, 56 ) // k_ + #endif + + AS2( mov ebp, edi ) + + AS2( mov ecx, DWORD PTR [esi] ) // c + AS2( movd mm0, edi ) // store k_ + AS2( mov edx, DWORD PTR [esi + 4] ) // d + AS2( add ebp, 160 ) // s_[0] + AS2( mov eax, DWORD PTR [esi + 8] ) // a + AS2( movd mm1, ebp ) // store s_ + AS2( mov ebx, DWORD PTR [esi + 12] ) // b + + AS2( xor ecx, DWORD PTR [edi + 16] ) // k_[4] + AS2( xor edx, DWORD PTR [edi + 20] ) // [5] + AS2( xor eax, DWORD PTR [edi + 24] ) // [6] + AS2( xor ebx, DWORD PTR [edi + 28] ) // [7] + + + ASMDECROUND(15, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND(14, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMDECROUND(13, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND(12, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMDECROUND(11, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND(10, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMDECROUND( 9, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND( 8, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMDECROUND( 7, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND( 6, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMDECROUND( 5, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND( 4, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMDECROUND( 3, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND( 2, eax, al, ah, ebx, bl, bh, ecx, edx) + ASMDECROUND( 1, ecx, cl, ch, edx, dl, dh, eax, ebx) + ASMDECROUND( 0, eax, al, ah, ebx, bl, bh, ecx, edx) + + + AS2( movd ebp, mm6 ) + AS2( movd esi, mm0 ) // k_ + #ifdef __GNUC__ + AS2( mov edi, [ebp + 16] ) // outBlock + #else + AS2( mov edi, [ebp + 12] ) // outBlock + #endif + + AS2( xor eax, DWORD PTR [esi ] ) // k_[0] + AS2( xor ebx, DWORD PTR [esi + 4] ) // k_[1] + AS2( xor ecx, DWORD PTR [esi + 8] ) // k_[2] + AS2( xor edx, DWORD PTR [esi + 12] ) // k_[3] + + AS2( mov [edi], eax ) // write out + AS2( mov [edi + 4], ebx ) // write out + AS2( mov [edi + 8], ecx ) // write out + AS2( mov [edi + 12], edx ) // write out + + + EPILOG() +} + + + +#endif // defined(DO_TWOFISH_ASM) + + + + + +} // namespace + + diff --git a/externals/mysql/hash.h b/externals/mysql/hash.h new file mode 100644 index 0000000..c1797c8 --- /dev/null +++ b/externals/mysql/hash.h @@ -0,0 +1,84 @@ +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Dynamic hashing of record with different key-length */ + +#ifndef _hash_h +#define _hash_h +#ifdef __cplusplus +extern "C" { +#endif + +/* + Overhead to store an element in hash + Can be used to approximate memory consumption for a hash + */ +#define HASH_OVERHEAD (sizeof(char*)*2) + +/* flags for hash_init */ +#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */ + +typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool); +typedef void (*my_hash_free_key)(void *); +typedef my_bool (*my_hash_walk_action)(void *,void *); + +typedef struct st_hash { + size_t key_offset,key_length; /* Length of key if const length */ + size_t blength; + ulong records; + uint flags; + DYNAMIC_ARRAY array; /* Place for hash_keys */ + my_hash_get_key get_key; + void (*free)(void *); + CHARSET_INFO *charset; +} HASH; + +/* A search iterator state */ +typedef uint HASH_SEARCH_STATE; + +#define my_hash_init(A,B,C,D,E,F,G,H) \ + _my_hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO) +#define my_hash_init2(A,B,C,D,E,F,G,H,I) \ + _my_hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO) +my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset, + ulong default_array_elements, size_t key_offset, + size_t key_length, my_hash_get_key get_key, + void (*free_element)(void*), + uint flags CALLER_INFO_PROTO); +void my_hash_free(HASH *tree); +void my_hash_reset(HASH *hash); +uchar *my_hash_element(HASH *hash, ulong idx); +uchar *my_hash_search(const HASH *info, const uchar *key, size_t length); +uchar *my_hash_first(const HASH *info, const uchar *key, size_t length, + HASH_SEARCH_STATE *state); +uchar *my_hash_next(const HASH *info, const uchar *key, size_t length, + HASH_SEARCH_STATE *state); +my_bool my_hash_insert(HASH *info, const uchar *data); +my_bool my_hash_delete(HASH *hash, uchar *record); +my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key, + size_t old_key_length); +void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row); +my_bool my_hash_check(HASH *hash); /* Only in debug library */ +my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument); + +#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H))) +#define my_hash_inited(H) ((H)->array.buffer != 0) +#define my_hash_init_opt(A,B,C,D,E,F,G,H) \ + (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO)) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/keycache.h b/externals/mysql/keycache.h new file mode 100644 index 0000000..0375d10 --- /dev/null +++ b/externals/mysql/keycache.h @@ -0,0 +1,153 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file + Key cache API +*/ + +#ifndef _keycache_h +#define _keycache_h +C_MODE_START + +/* declare structures that is used by st_key_cache */ + +struct st_block_link; +typedef struct st_block_link BLOCK_LINK; +struct st_keycache_page; +typedef struct st_keycache_page KEYCACHE_PAGE; +struct st_hash_link; +typedef struct st_hash_link HASH_LINK; + +/* info about requests in a waiting queue */ +typedef struct st_keycache_wqueue +{ + struct st_my_thread_var *last_thread; /* circular list of waiting threads */ +} KEYCACHE_WQUEUE; + +/** Callback called when any block is flushed */ +typedef int (*KEYCACHE_POST_WRITE_CALLBACK)(void *arg, const uchar *buffert, + uint length, my_off_t filepos); + +#define CHANGED_BLOCKS_HASH 128 /* must be power of 2 */ + +/* + The key cache structure + It also contains read-only statistics parameters. +*/ + +typedef struct st_key_cache +{ + my_bool key_cache_inited; + my_bool in_resize; /* true during resize operation */ + my_bool resize_in_flush; /* true during flush of resize operation */ + my_bool can_be_used; /* usage of cache for read/write is allowed */ + size_t key_cache_mem_size; /* specified size of the cache memory */ + uint key_cache_block_size; /* size of the page buffer of a cache block */ + ulong min_warm_blocks; /* min number of warm blocks; */ + ulong age_threshold; /* age threshold for hot blocks */ + ulonglong keycache_time; /* total number of block link operations */ + uint hash_entries; /* max number of entries in the hash table */ + int hash_links; /* max number of hash links */ + int hash_links_used; /* number of hash links currently used */ + int disk_blocks; /* max number of blocks in the cache */ + ulong blocks_used; /* maximum number of concurrently used blocks */ + ulong blocks_unused; /* number of currently unused blocks */ + ulong blocks_changed; /* number of currently dirty blocks */ + ulong warm_blocks; /* number of blocks in warm sub-chain */ + ulong cnt_for_resize_op; /* counter to block resize operation */ + long blocks_available; /* number of blocks available in the LRU chain */ + HASH_LINK **hash_root; /* arr. of entries into hash table buckets */ + HASH_LINK *hash_link_root; /* memory for hash table links */ + HASH_LINK *free_hash_list; /* list of free hash links */ + BLOCK_LINK *free_block_list; /* list of free blocks */ + BLOCK_LINK *block_root; /* memory for block links */ + uchar HUGE_PTR *block_mem; /* memory for block buffers */ + BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */ + BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */ + pthread_mutex_t cache_lock; /* to lock access to the cache structure */ + KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */ + /* + Waiting for a zero resize count. Using a queue for symmetry though + only one thread can wait here. + */ + KEYCACHE_WQUEUE waiting_for_resize_cnt; + KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */ + KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */ + BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/ + BLOCK_LINK *file_blocks[CHANGED_BLOCKS_HASH]; /* hash for other file bl.*/ + KEYCACHE_POST_WRITE_CALLBACK post_write;/**< Called when flushing any block*/ + + /* + The following variables are and variables used to hold parameters for + initializing the key cache. + */ + + ulonglong param_buff_size; /* size the memory allocated for the cache */ + ulong param_block_size; /* size of the blocks in the key cache */ + ulong param_division_limit; /* min. percentage of warm blocks */ + ulong param_age_threshold; /* determines when hot block is downgraded */ + + /* Statistics variables. These are reset in reset_key_cache_counters(). */ + ulong global_blocks_changed; /* number of currently dirty blocks */ + ulonglong global_cache_w_requests;/* number of write requests (write hits) */ + ulonglong global_cache_write; /* number of writes from cache to files */ + ulonglong global_cache_r_requests;/* number of read requests (read hits) */ + ulonglong global_cache_read; /* number of reads from files to cache */ + + int blocks; /* max number of blocks in the cache */ + my_bool in_init; /* Set to 1 in MySQL during init/resize */ +} KEY_CACHE; + +/* The default key cache */ +extern KEY_CACHE dflt_key_cache_var, *dflt_key_cache; + +extern int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, + size_t use_mem, uint division_limit, + uint age_threshold); +extern int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, + size_t use_mem, uint division_limit, + uint age_threshold); +extern void change_key_cache_param(KEY_CACHE *keycache, uint division_limit, + uint age_threshold); +extern uchar *key_cache_read(KEY_CACHE *keycache, + File file, my_off_t filepos, int level, + uchar *buff, uint length, + uint block_length,int return_buffer); +extern int key_cache_insert(KEY_CACHE *keycache, + File file, my_off_t filepos, int level, + uchar *buff, uint length); +extern int key_cache_write(KEY_CACHE *keycache, + File file, my_off_t filepos, int level, + uchar *buff, uint length, + uint block_length, int force_write, + void *post_write_arg); +extern int flush_key_blocks(KEY_CACHE *keycache, + int file, enum flush_type type); +extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup); + +/* Functions to handle multiple key caches */ +extern my_bool multi_keycache_init(void); +extern void multi_keycache_free(void); +extern KEY_CACHE *multi_key_cache_search(uchar *key, uint length, + KEY_CACHE *def); +extern my_bool multi_key_cache_set(const uchar *key, uint length, + KEY_CACHE *key_cache); +extern void multi_key_cache_change(KEY_CACHE *old_data, + KEY_CACHE *new_data); +extern int reset_key_cache_counters(const char *name, + KEY_CACHE *key_cache); +C_MODE_END +#endif /* _keycache_h */ diff --git a/externals/mysql/lf.h b/externals/mysql/lf.h new file mode 100644 index 0000000..83358aa --- /dev/null +++ b/externals/mysql/lf.h @@ -0,0 +1,260 @@ +/* Copyright (C) 2007-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _lf_h +#define _lf_h + +#include + +/* + Helpers to define both func() and _func(), where + func() is a _func() protected by my_atomic_rwlock_wrlock() +*/ + +#define lock_wrap(f, t, proto_args, args, lock) \ +t _ ## f proto_args; \ +static inline t f proto_args \ +{ \ + t ret; \ + my_atomic_rwlock_wrlock(lock); \ + ret= _ ## f args; \ + my_atomic_rwlock_wrunlock(lock); \ + return ret; \ +} + +#define lock_wrap_void(f, proto_args, args, lock) \ +void _ ## f proto_args; \ +static inline void f proto_args \ +{ \ + my_atomic_rwlock_wrlock(lock); \ + _ ## f args; \ + my_atomic_rwlock_wrunlock(lock); \ +} + +#define nolock_wrap(f, t, proto_args, args) \ +t _ ## f proto_args; \ +static inline t f proto_args \ +{ \ + return _ ## f args; \ +} + +#define nolock_wrap_void(f, proto_args, args) \ +void _ ## f proto_args; \ +static inline void f proto_args \ +{ \ + _ ## f args; \ +} + +/* + wait-free dynamic array, see lf_dynarray.c + + 4 levels of 256 elements each mean 4311810304 elements in an array - it + should be enough for a while +*/ +#define LF_DYNARRAY_LEVEL_LENGTH 256 +#define LF_DYNARRAY_LEVELS 4 + +typedef struct { + void * volatile level[LF_DYNARRAY_LEVELS]; + uint size_of_element; + my_atomic_rwlock_t lock; +} LF_DYNARRAY; + +typedef int (*lf_dynarray_func)(void *, void *); + +void lf_dynarray_init(LF_DYNARRAY *array, uint element_size); +void lf_dynarray_destroy(LF_DYNARRAY *array); + +nolock_wrap(lf_dynarray_value, void *, + (LF_DYNARRAY *array, uint idx), + (array, idx)) +lock_wrap(lf_dynarray_lvalue, void *, + (LF_DYNARRAY *array, uint idx), + (array, idx), + &array->lock) +nolock_wrap(lf_dynarray_iterate, int, + (LF_DYNARRAY *array, lf_dynarray_func func, void *arg), + (array, func, arg)) + +/* + pin manager for memory allocator, lf_alloc-pin.c +*/ + +#define LF_PINBOX_PINS 4 +#define LF_PURGATORY_SIZE 10 + +typedef void lf_pinbox_free_func(void *, void *, void*); + +typedef struct { + LF_DYNARRAY pinarray; + lf_pinbox_free_func *free_func; + void *free_func_arg; + uint free_ptr_offset; + uint32 volatile pinstack_top_ver; /* this is a versioned pointer */ + uint32 volatile pins_in_array; /* number of elements in array */ +} LF_PINBOX; + +typedef struct { + void * volatile pin[LF_PINBOX_PINS]; + LF_PINBOX *pinbox; + void **stack_ends_here; + void *purgatory; + uint32 purgatory_count; + uint32 volatile link; +/* we want sizeof(LF_PINS) to be 64 to avoid false sharing */ +#if SIZEOF_INT*2+SIZEOF_CHARP*(LF_PINBOX_PINS+3) != 64 + char pad[64-sizeof(uint32)*2-sizeof(void*)*(LF_PINBOX_PINS+3)]; +#endif +} LF_PINS; + +/* + shortcut macros to do an atomic_wrlock on a structure that uses pins + (e.g. lf_hash). +*/ +#define lf_rwlock_by_pins(PINS) \ + my_atomic_rwlock_wrlock(&(PINS)->pinbox->pinarray.lock) +#define lf_rwunlock_by_pins(PINS) \ + my_atomic_rwlock_wrunlock(&(PINS)->pinbox->pinarray.lock) + +/* + compile-time assert, to require "no less than N" pins + it's enough if it'll fail on at least one compiler, so + we'll enable it on GCC only, which supports zero-length arrays. +*/ +#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG) +#define LF_REQUIRE_PINS(N) \ + static const char require_pins[LF_PINBOX_PINS-N] \ + __attribute__ ((unused)); \ + static const int LF_NUM_PINS_IN_THIS_FILE= N; +#define _lf_pin(PINS, PIN, ADDR) \ + ( \ + assert(PIN < LF_NUM_PINS_IN_THIS_FILE), \ + my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)) \ + ) +#else +#define LF_REQUIRE_PINS(N) +#define _lf_pin(PINS, PIN, ADDR) my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)) +#endif + +#define _lf_unpin(PINS, PIN) _lf_pin(PINS, PIN, NULL) +#define lf_pin(PINS, PIN, ADDR) \ + do { \ + lf_rwlock_by_pins(PINS); \ + _lf_pin(PINS, PIN, ADDR); \ + lf_rwunlock_by_pins(PINS); \ + } while (0) +#define lf_unpin(PINS, PIN) lf_pin(PINS, PIN, NULL) +#define _lf_assert_pin(PINS, PIN) assert((PINS)->pin[PIN] != 0) +#define _lf_assert_unpin(PINS, PIN) assert((PINS)->pin[PIN] == 0) + +void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset, + lf_pinbox_free_func *free_func, void * free_func_arg); +void lf_pinbox_destroy(LF_PINBOX *pinbox); + +lock_wrap(lf_pinbox_get_pins, LF_PINS *, + (LF_PINBOX *pinbox), + (pinbox), + &pinbox->pinarray.lock) +lock_wrap_void(lf_pinbox_put_pins, + (LF_PINS *pins), + (pins), + &pins->pinbox->pinarray.lock) +lock_wrap_void(lf_pinbox_free, + (LF_PINS *pins, void *addr), + (pins, addr), + &pins->pinbox->pinarray.lock) + +/* + memory allocator, lf_alloc-pin.c +*/ + +typedef struct st_lf_allocator { + LF_PINBOX pinbox; + uchar * volatile top; + uint element_size; + uint32 volatile mallocs; + void (*constructor)(uchar *); /* called, when an object is malloc()'ed */ + void (*destructor)(uchar *); /* called, when an object is free()'d */ +} LF_ALLOCATOR; + +void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset); +void lf_alloc_destroy(LF_ALLOCATOR *allocator); +uint lf_alloc_pool_count(LF_ALLOCATOR *allocator); +/* + shortcut macros to access underlying pinbox functions from an LF_ALLOCATOR + see _lf_pinbox_get_pins() and _lf_pinbox_put_pins() +*/ +#define _lf_alloc_free(PINS, PTR) _lf_pinbox_free((PINS), (PTR)) +#define lf_alloc_free(PINS, PTR) lf_pinbox_free((PINS), (PTR)) +#define _lf_alloc_get_pins(A) _lf_pinbox_get_pins(&(A)->pinbox) +#define lf_alloc_get_pins(A) lf_pinbox_get_pins(&(A)->pinbox) +#define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS) +#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS) +#define lf_alloc_direct_free(ALLOC, ADDR) my_free((uchar*)(ADDR), MYF(0)) + +lock_wrap(lf_alloc_new, void *, + (LF_PINS *pins), + (pins), + &pins->pinbox->pinarray.lock) + +/* + extendible hash, lf_hash.c +*/ +#include + +#define LF_HASH_UNIQUE 1 + +/* lf_hash overhead per element (that is, sizeof(LF_SLIST) */ +extern const int LF_HASH_OVERHEAD; + +typedef struct { + LF_DYNARRAY array; /* hash itself */ + LF_ALLOCATOR alloc; /* allocator for elements */ + my_hash_get_key get_key; /* see HASH */ + CHARSET_INFO *charset; /* see HASH */ + uint key_offset, key_length; /* see HASH */ + uint element_size; /* size of memcpy'ed area on insert */ + uint flags; /* LF_HASH_UNIQUE, etc */ + int32 volatile size; /* size of array */ + int32 volatile count; /* number of elements in the hash */ +} LF_HASH; + +void lf_hash_init(LF_HASH *hash, uint element_size, uint flags, + uint key_offset, uint key_length, my_hash_get_key get_key, + CHARSET_INFO *charset); +void lf_hash_destroy(LF_HASH *hash); +int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data); +void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen); +int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen); +/* + shortcut macros to access underlying pinbox functions from an LF_HASH + see _lf_pinbox_get_pins() and _lf_pinbox_put_pins() +*/ +#define _lf_hash_get_pins(HASH) _lf_alloc_get_pins(&(HASH)->alloc) +#define lf_hash_get_pins(HASH) lf_alloc_get_pins(&(HASH)->alloc) +#define _lf_hash_put_pins(PINS) _lf_pinbox_put_pins(PINS) +#define lf_hash_put_pins(PINS) lf_pinbox_put_pins(PINS) +#define lf_hash_search_unpin(PINS) lf_unpin((PINS), 2) +/* + cleanup +*/ + +#undef lock_wrap_void +#undef lock_wrap +#undef nolock_wrap_void +#undef nolock_wrap + +#endif + diff --git a/externals/mysql/libmysql/client.c b/externals/mysql/libmysql/client.c new file mode 100644 index 0000000..bf4cf36 --- /dev/null +++ b/externals/mysql/libmysql/client.c @@ -0,0 +1,3268 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This file is included by both libmysql.c (the MySQL client C API) + and the mysqld server to connect to another MYSQL server. + + The differences for the two cases are: + + - Things that only works for the client: + - Trying to automaticly determinate user name if not supplied to + mysql_real_connect() + - Support for reading local file with LOAD DATA LOCAL + - SHARED memory handling + - Protection against sigpipe + - Prepared statements + + - Things that only works for the server + - Alarm handling on connect + + In all other cases, the code should be idential for the client and + server. +*/ + +#include + +#include "mysql.h" + +#ifndef __WIN__ +#include +#endif + +/* Remove client convenience wrappers */ +#undef max_allowed_packet +#undef net_buffer_length + +#ifdef EMBEDDED_LIBRARY + +#undef MYSQL_SERVER + +#ifndef MYSQL_CLIENT +#define MYSQL_CLIENT +#endif + +#define CLI_MYSQL_REAL_CONNECT STDCALL cli_mysql_real_connect + +#undef net_flush +my_bool net_flush(NET *net); + +#else /*EMBEDDED_LIBRARY*/ +#define CLI_MYSQL_REAL_CONNECT STDCALL mysql_real_connect +#endif /*EMBEDDED_LIBRARY*/ +#include +#include +#include +#include +#include "mysql_version.h" +#include "mysqld_error.h" +#include "errmsg.h" +#include +#if defined(THREAD) && !defined(__WIN__) +#include /* because of signal() */ +#endif /* defined(THREAD) && !defined(__WIN__) */ + +#include +#include +#include +#ifdef HAVE_PWD_H +#include +#endif +#if !defined(MSDOS) && !defined(__WIN__) +#include +#include +#include +#include +#ifdef HAVE_SELECT_H +# include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#endif /*!defined(MSDOS) && !defined(__WIN__) */ +#ifdef HAVE_SYS_UN_H +# include +#endif + +#if defined(MSDOS) || defined(__WIN__) +#define perror(A) +#else +#include +#define SOCKET_ERROR -1 +#endif + +#ifdef __WIN__ +#define CONNECT_TIMEOUT 20 +#else +#define CONNECT_TIMEOUT 0 +#endif + +#include "client_settings.h" +#include + +uint mysql_port=0; +char *mysql_unix_port= 0; +const char *unknown_sqlstate= "HY000"; +const char *not_error_sqlstate= "00000"; +const char *cant_connect_sqlstate= "08001"; +#ifdef HAVE_SMEM +char *shared_memory_base_name= 0; +const char *def_shared_memory_base_name= default_shared_memory_base_name; +#endif + +static void mysql_close_free_options(MYSQL *mysql); +static void mysql_close_free(MYSQL *mysql); + +#if !(defined(__WIN__) || defined(__NETWARE__)) +static int wait_for_data(my_socket fd, uint timeout); +#endif + +CHARSET_INFO *default_client_charset_info = &my_charset_latin1; + +/* Server error code and message */ +unsigned int mysql_server_last_errno; +char mysql_server_last_error[MYSQL_ERRMSG_SIZE]; + +/**************************************************************************** + A modified version of connect(). my_connect() allows you to specify + a timeout value, in seconds, that we should wait until we + derermine we can't connect to a particular host. If timeout is 0, + my_connect() will behave exactly like connect(). + + Base version coded by Steve Bernacki, Jr. +*****************************************************************************/ + +int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, + uint timeout) +{ +#if defined(__WIN__) || defined(__NETWARE__) + return connect(fd, (struct sockaddr*) name, namelen); +#else + int flags, res, s_err; + + /* + If they passed us a timeout of zero, we should behave + exactly like the normal connect() call does. + */ + + if (timeout == 0) + return connect(fd, (struct sockaddr*) name, namelen); + + flags = fcntl(fd, F_GETFL, 0); /* Set socket to not block */ +#ifdef O_NONBLOCK + fcntl(fd, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */ +#endif + + res= connect(fd, (struct sockaddr*) name, namelen); + s_err= errno; /* Save the error... */ + fcntl(fd, F_SETFL, flags); + if ((res != 0) && (s_err != EINPROGRESS)) + { + errno= s_err; /* Restore it */ + return(-1); + } + if (res == 0) /* Connected quickly! */ + return(0); + return wait_for_data(fd, timeout); +#endif +} + + +/* + Wait up to timeout seconds for a connection to be established. + + We prefer to do this with poll() as there is no limitations with this. + If not, we will use select() +*/ + +#if !(defined(__WIN__) || defined(__NETWARE__)) + +static int wait_for_data(my_socket fd, uint timeout) +{ +#ifdef HAVE_POLL + struct pollfd ufds; + int res; + + ufds.fd= fd; + ufds.events= POLLIN | POLLPRI; + if (!(res= poll(&ufds, 1, (int) timeout*1000))) + { + errno= EINTR; + return -1; + } + if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI))) + return -1; + return 0; +#else + socklen_t s_err_size = sizeof(uint); + fd_set sfds; + struct timeval tv; + time_t start_time, now_time; + int res, s_err; + + if (fd >= FD_SETSIZE) /* Check if wrong error */ + return 0; /* Can't use timeout */ + + /* + Our connection is "in progress." We can use the select() call to wait + up to a specified period of time for the connection to suceed. + If select() returns 0 (after waiting howevermany seconds), our socket + never became writable (host is probably unreachable.) Otherwise, if + select() returns 1, then one of two conditions exist: + + 1. An error occured. We use getsockopt() to check for this. + 2. The connection was set up sucessfully: getsockopt() will + return 0 as an error. + + Thanks goes to Andrew Gierth + who posted this method of timing out a connect() in + comp.unix.programmer on August 15th, 1997. + */ + + FD_ZERO(&sfds); + FD_SET(fd, &sfds); + /* + select could be interrupted by a signal, and if it is, + the timeout should be adjusted and the select restarted + to work around OSes that don't restart select and + implementations of select that don't adjust tv upon + failure to reflect the time remaining + */ + start_time= my_time(0); + for (;;) + { + tv.tv_sec = (long) timeout; + tv.tv_usec = 0; +#if defined(HPUX10) && defined(THREAD) + if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0) + break; +#else + if ((res = select(fd+1, NULL, &sfds, NULL, &tv)) > 0) + break; +#endif + if (res == 0) /* timeout */ + return -1; + now_time= my_time(0); + timeout-= (uint) (now_time - start_time); + if (errno != EINTR || (int) timeout <= 0) + return -1; + } + + /* + select() returned something more interesting than zero, let's + see if we have any errors. If the next two statements pass, + we've got an open socket! + */ + + s_err=0; + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0) + return(-1); + + if (s_err) + { /* getsockopt could succeed */ + errno = s_err; + return(-1); /* but return an error... */ + } + return (0); /* ok */ +#endif /* HAVE_POLL */ +} +#endif /* defined(__WIN__) || defined(__NETWARE__) */ + +/** + Set the internal error message to mysql handler + + @param mysql connection handle (client side) + @param errcode CR_ error code, passed to ER macro to get + error text + @parma sqlstate SQL standard sqlstate +*/ + +void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate) +{ + NET *net; + DBUG_ENTER("set_mysql_error"); + DBUG_PRINT("enter", ("error :%d '%s'", errcode, ER(errcode))); + DBUG_ASSERT(mysql != 0); + + if (mysql) + { + net= &mysql->net; + net->last_errno= errcode; + strmov(net->last_error, ER(errcode)); + strmov(net->sqlstate, sqlstate); + } + else + { + mysql_server_last_errno= errcode; + strmov(mysql_server_last_error, ER(errcode)); + } + DBUG_VOID_RETURN; +} + +/** + Clear possible error state of struct NET + + @param net clear the state of the argument +*/ + +void net_clear_error(NET *net) +{ + net->last_errno= 0; + net->last_error[0]= '\0'; + strmov(net->sqlstate, not_error_sqlstate); +} + +/** + Set an error message on the client. + + @param mysql connection handle + @param errcode CR_* errcode, for client errors + @param sqlstate SQL standard sql state, unknown_sqlstate for the + majority of client errors. + @param format error message template, in sprintf format + @param ... variable number of arguments +*/ + +static void set_mysql_extended_error(MYSQL *mysql, int errcode, + const char *sqlstate, + const char *format, ...) +{ + NET *net; + va_list args; + DBUG_ENTER("set_mysql_extended_error"); + DBUG_PRINT("enter", ("error :%d '%s'", errcode, format)); + DBUG_ASSERT(mysql != 0); + + net= &mysql->net; + net->last_errno= errcode; + va_start(args, format); + my_vsnprintf(net->last_error, sizeof(net->last_error)-1, + format, args); + va_end(args); + strmov(net->sqlstate, sqlstate); + + DBUG_VOID_RETURN; +} + + + +/* + Create a named pipe connection +*/ + +#ifdef __WIN__ + +HANDLE create_named_pipe(MYSQL *mysql, uint connect_timeout, char **arg_host, + char **arg_unix_socket) +{ + HANDLE hPipe=INVALID_HANDLE_VALUE; + char pipe_name[1024]; + DWORD dwMode; + int i; + my_bool testing_named_pipes=0; + char *host= *arg_host, *unix_socket= *arg_unix_socket; + + if ( ! unix_socket || (unix_socket)[0] == 0x00) + unix_socket = mysql_unix_port; + if (!host || !strcmp(host,LOCAL_HOST)) + host=LOCAL_HOST_NAMEDPIPE; + + + pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */ + strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\", host, "\\pipe\\", + unix_socket, NullS); + DBUG_PRINT("info",("Server name: '%s'. Named Pipe: %s", host, unix_socket)); + + for (i=0 ; i < 100 ; i++) /* Don't retry forever */ + { + if ((hPipe = CreateFile(pipe_name, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + 0, + NULL )) != INVALID_HANDLE_VALUE) + break; + if (GetLastError() != ERROR_PIPE_BUSY) + { + set_mysql_extended_error(mysql, CR_NAMEDPIPEOPEN_ERROR, + unknown_sqlstate, ER(CR_NAMEDPIPEOPEN_ERROR), + host, unix_socket, (ulong) GetLastError()); + return INVALID_HANDLE_VALUE; + } + /* wait for for an other instance */ + if (! WaitNamedPipe(pipe_name, connect_timeout*1000) ) + { + set_mysql_extended_error(mysql, CR_NAMEDPIPEWAIT_ERROR, unknown_sqlstate, + ER(CR_NAMEDPIPEWAIT_ERROR), + host, unix_socket, (ulong) GetLastError()); + return INVALID_HANDLE_VALUE; + } + } + if (hPipe == INVALID_HANDLE_VALUE) + { + set_mysql_extended_error(mysql, CR_NAMEDPIPEOPEN_ERROR, unknown_sqlstate, + ER(CR_NAMEDPIPEOPEN_ERROR), host, unix_socket, + (ulong) GetLastError()); + return INVALID_HANDLE_VALUE; + } + dwMode = PIPE_READMODE_BYTE | PIPE_WAIT; + if ( !SetNamedPipeHandleState(hPipe, &dwMode, NULL, NULL) ) + { + CloseHandle( hPipe ); + set_mysql_extended_error(mysql, CR_NAMEDPIPESETSTATE_ERROR, + unknown_sqlstate, ER(CR_NAMEDPIPESETSTATE_ERROR), + host, unix_socket, (ulong) GetLastError()); + return INVALID_HANDLE_VALUE; + } + *arg_host=host ; *arg_unix_socket=unix_socket; /* connect arg */ + return (hPipe); +} +#endif + + +/* + Create new shared memory connection, return handler of connection + + SYNOPSIS + create_shared_memory() + mysql Pointer of mysql structure + net Pointer of net structure + connect_timeout Timeout of connection +*/ + +#ifdef HAVE_SMEM +HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout) +{ + ulong smem_buffer_length = shared_memory_buffer_length + 4; + /* + event_connect_request is event object for start connection actions + event_connect_answer is event object for confirm, that server put data + handle_connect_file_map is file-mapping object, use for create shared + memory + handle_connect_map is pointer on shared memory + handle_map is pointer on shared memory for client + event_server_wrote, + event_server_read, + event_client_wrote, + event_client_read are events for transfer data between server and client + handle_file_map is file-mapping object, use for create shared memory + */ + HANDLE event_connect_request = NULL; + HANDLE event_connect_answer = NULL; + HANDLE handle_connect_file_map = NULL; + char *handle_connect_map = NULL; + + char *handle_map = NULL; + HANDLE event_server_wrote = NULL; + HANDLE event_server_read = NULL; + HANDLE event_client_wrote = NULL; + HANDLE event_client_read = NULL; + HANDLE event_conn_closed = NULL; + HANDLE handle_file_map = NULL; + ulong connect_number; + char connect_number_char[22], *p; + char *tmp= NULL; + char *suffix_pos; + DWORD error_allow = 0; + DWORD error_code = 0; + DWORD event_access_rights= SYNCHRONIZE | EVENT_MODIFY_STATE; + char *shared_memory_base_name = mysql->options.shared_memory_base_name; + + /* + get enough space base-name + '_' + longest suffix we might ever send + */ + if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L, MYF(MY_FAE)))) + goto err; + + /* + The name of event and file-mapping events create agree next rule: + shared_memory_base_name+unique_part + Where: + shared_memory_base_name is unique value for each server + unique_part is uniquel value for each object (events and file-mapping) + */ + suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", NullS); + strmov(suffix_pos, "CONNECT_REQUEST"); + if (!(event_connect_request= OpenEvent(event_access_rights, FALSE, tmp))) + { + error_allow = CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR; + goto err; + } + strmov(suffix_pos, "CONNECT_ANSWER"); + if (!(event_connect_answer= OpenEvent(event_access_rights,FALSE,tmp))) + { + error_allow = CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR; + goto err; + } + strmov(suffix_pos, "CONNECT_DATA"); + if (!(handle_connect_file_map= OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp))) + { + error_allow = CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR; + goto err; + } + if (!(handle_connect_map= MapViewOfFile(handle_connect_file_map, + FILE_MAP_WRITE,0,0,sizeof(DWORD)))) + { + error_allow = CR_SHARED_MEMORY_CONNECT_MAP_ERROR; + goto err; + } + + /* Send to server request of connection */ + if (!SetEvent(event_connect_request)) + { + error_allow = CR_SHARED_MEMORY_CONNECT_SET_ERROR; + goto err; + } + + /* Wait of answer from server */ + if (WaitForSingleObject(event_connect_answer,connect_timeout*1000) != + WAIT_OBJECT_0) + { + error_allow = CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR; + goto err; + } + + /* Get number of connection */ + connect_number = uint4korr(handle_connect_map);/*WAX2*/ + p= int10_to_str(connect_number, connect_number_char, 10); + + /* + The name of event and file-mapping events create agree next rule: + shared_memory_base_name+unique_part+number_of_connection + + Where: + shared_memory_base_name is uniquel value for each server + unique_part is uniquel value for each object (events and file-mapping) + number_of_connection is number of connection between server and client + */ + suffix_pos = strxmov(tmp, "Global\\", shared_memory_base_name, "_", connect_number_char, + "_", NullS); + strmov(suffix_pos, "DATA"); + if ((handle_file_map = OpenFileMapping(FILE_MAP_WRITE,FALSE,tmp)) == NULL) + { + error_allow = CR_SHARED_MEMORY_FILE_MAP_ERROR; + goto err2; + } + if ((handle_map = MapViewOfFile(handle_file_map,FILE_MAP_WRITE,0,0, + smem_buffer_length)) == NULL) + { + error_allow = CR_SHARED_MEMORY_MAP_ERROR; + goto err2; + } + + strmov(suffix_pos, "SERVER_WROTE"); + if ((event_server_wrote = OpenEvent(event_access_rights,FALSE,tmp)) == NULL) + { + error_allow = CR_SHARED_MEMORY_EVENT_ERROR; + goto err2; + } + + strmov(suffix_pos, "SERVER_READ"); + if ((event_server_read = OpenEvent(event_access_rights,FALSE,tmp)) == NULL) + { + error_allow = CR_SHARED_MEMORY_EVENT_ERROR; + goto err2; + } + + strmov(suffix_pos, "CLIENT_WROTE"); + if ((event_client_wrote = OpenEvent(event_access_rights,FALSE,tmp)) == NULL) + { + error_allow = CR_SHARED_MEMORY_EVENT_ERROR; + goto err2; + } + + strmov(suffix_pos, "CLIENT_READ"); + if ((event_client_read = OpenEvent(event_access_rights,FALSE,tmp)) == NULL) + { + error_allow = CR_SHARED_MEMORY_EVENT_ERROR; + goto err2; + } + + strmov(suffix_pos, "CONNECTION_CLOSED"); + if ((event_conn_closed = OpenEvent(event_access_rights,FALSE,tmp)) == NULL) + { + error_allow = CR_SHARED_MEMORY_EVENT_ERROR; + goto err2; + } + /* + Set event that server should send data + */ + SetEvent(event_server_read); + +err2: + if (error_allow == 0) + { + net->vio= vio_new_win32shared_memory(net,handle_file_map,handle_map, + event_server_wrote, + event_server_read,event_client_wrote, + event_client_read,event_conn_closed); + } + else + { + error_code = GetLastError(); + if (event_server_read) + CloseHandle(event_server_read); + if (event_server_wrote) + CloseHandle(event_server_wrote); + if (event_client_read) + CloseHandle(event_client_read); + if (event_client_wrote) + CloseHandle(event_client_wrote); + if (event_conn_closed) + CloseHandle(event_conn_closed); + if (handle_map) + UnmapViewOfFile(handle_map); + if (handle_file_map) + CloseHandle(handle_file_map); + } +err: + if (tmp) + my_free(tmp, MYF(0)); + if (error_allow) + error_code = GetLastError(); + if (event_connect_request) + CloseHandle(event_connect_request); + if (event_connect_answer) + CloseHandle(event_connect_answer); + if (handle_connect_map) + UnmapViewOfFile(handle_connect_map); + if (handle_connect_file_map) + CloseHandle(handle_connect_file_map); + if (error_allow) + { + if (error_allow == CR_SHARED_MEMORY_EVENT_ERROR) + set_mysql_extended_error(mysql, error_allow, unknown_sqlstate, + ER(error_allow), suffix_pos, error_code); + else + set_mysql_extended_error(mysql, error_allow, unknown_sqlstate, + ER(error_allow), error_code); + return(INVALID_HANDLE_VALUE); + } + return(handle_map); +} +#endif + +/** + Read a packet from server. Give error message if socket was down + or packet is an error message + + @retval packet_error An error occurred during reading. + Error message is set. + @retval +*/ + +ulong +cli_safe_read(MYSQL *mysql) +{ + NET *net= &mysql->net; + ulong len=0; + init_sigpipe_variables + + /* Don't give sigpipe errors if the client doesn't want them */ + set_sigpipe(mysql); + if (net->vio != 0) + len=my_net_read(net); + reset_sigpipe(mysql); + + if (len == packet_error || len == 0) + { + DBUG_PRINT("error",("Wrong connection or packet. fd: %s len: %lu", + vio_description(net->vio),len)); +#ifdef MYSQL_SERVER + if (net->vio && vio_was_interrupted(net->vio)) + return (packet_error); +#endif /*MYSQL_SERVER*/ + end_server(mysql); + set_mysql_error(mysql, net->last_errno == ER_NET_PACKET_TOO_LARGE ? + CR_NET_PACKET_TOO_LARGE: CR_SERVER_LOST, unknown_sqlstate); + return (packet_error); + } + if (net->read_pos[0] == 255) + { + if (len > 3) + { + char *pos=(char*) net->read_pos+1; + net->last_errno=uint2korr(pos); + pos+=2; + len-=2; + if (protocol_41(mysql) && pos[0] == '#') + { + strmake(net->sqlstate, pos+1, SQLSTATE_LENGTH); + pos+= SQLSTATE_LENGTH+1; + } + else + { + /* + The SQL state hasn't been received -- it should be reset to HY000 + (unknown error sql state). + */ + + strmov(net->sqlstate, unknown_sqlstate); + } + + (void) strmake(net->last_error,(char*) pos, + min((uint) len,(uint) sizeof(net->last_error)-1)); + } + else + set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate); + /* + Cover a protocol design error: error packet does not + contain the server status. Therefore, the client has no way + to find out whether there are more result sets of + a multiple-result-set statement pending. Luckily, in 5.0 an + error always aborts execution of a statement, wherever it is + a multi-statement or a stored procedure, so it should be + safe to unconditionally turn off the flag here. + */ + mysql->server_status&= ~SERVER_MORE_RESULTS_EXISTS; + + DBUG_PRINT("error",("Got error: %d/%s (%s)", + net->last_errno, + net->sqlstate, + net->last_error)); + return(packet_error); + } + return len; +} + +void free_rows(MYSQL_DATA *cur) +{ + if (cur) + { + free_root(&cur->alloc,MYF(0)); + my_free((uchar*) cur,MYF(0)); + } +} + +my_bool +cli_advanced_command(MYSQL *mysql, enum enum_server_command command, + const uchar *header, ulong header_length, + const uchar *arg, ulong arg_length, my_bool skip_check, + MYSQL_STMT *stmt) +{ + NET *net= &mysql->net; + my_bool result= 1; + init_sigpipe_variables + my_bool stmt_skip= stmt ? stmt->state != MYSQL_STMT_INIT_DONE : FALSE; + DBUG_ENTER("cli_advanced_command"); + + /* Don't give sigpipe errors if the client doesn't want them */ + set_sigpipe(mysql); + + if (mysql->net.vio == 0) + { /* Do reconnect if possible */ + if (mysql_reconnect(mysql) || stmt_skip) + DBUG_RETURN(1); + } + if (mysql->status != MYSQL_STATUS_READY || + mysql->server_status & SERVER_MORE_RESULTS_EXISTS) + { + DBUG_PRINT("error",("state: %d", mysql->status)); + set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); + DBUG_RETURN(1); + } + + net_clear_error(net); + mysql->info=0; + mysql->affected_rows= ~(my_ulonglong) 0; + /* + We don't want to clear the protocol buffer on COM_QUIT, because if + the previous command was a shutdown command, we may have the + response for the COM_QUIT already in the communication buffer + */ + net_clear(&mysql->net, (command != COM_QUIT)); + + if (net_write_command(net,(uchar) command, header, header_length, + arg, arg_length)) + { + DBUG_PRINT("error",("Can't send command to server. Error: %d", + socket_errno)); + if (net->last_errno == ER_NET_PACKET_TOO_LARGE) + { + set_mysql_error(mysql, CR_NET_PACKET_TOO_LARGE, unknown_sqlstate); + goto end; + } + end_server(mysql); + if (mysql_reconnect(mysql) || stmt_skip) + goto end; + if (net_write_command(net,(uchar) command, header, header_length, + arg, arg_length)) + { + set_mysql_error(mysql, CR_SERVER_GONE_ERROR, unknown_sqlstate); + goto end; + } + } + result=0; + if (!skip_check) + result= ((mysql->packet_length=cli_safe_read(mysql)) == packet_error ? + 1 : 0); +end: + reset_sigpipe(mysql); + DBUG_PRINT("exit",("result: %d", result)); + DBUG_RETURN(result); +} + +void free_old_query(MYSQL *mysql) +{ + DBUG_ENTER("free_old_query"); + if (mysql->fields) + free_root(&mysql->field_alloc,MYF(0)); + init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */ + mysql->fields= 0; + mysql->field_count= 0; /* For API */ + mysql->warning_count= 0; + mysql->info= 0; + DBUG_VOID_RETURN; +} + + +/** + Finish reading of a partial result set from the server. + Get the EOF packet, and update mysql->status + and mysql->warning_count. + + @return TRUE if a communication or protocol error, an error + is set in this case, FALSE otherwise. +*/ + +my_bool flush_one_result(MYSQL *mysql) +{ + ulong packet_length; + + DBUG_ASSERT(mysql->status != MYSQL_STATUS_READY); + + do + { + packet_length= cli_safe_read(mysql); + /* + There is an error reading from the connection, + or (sic!) there were no error and no + data in the stream, i.e. no more data from the server. + Since we know our position in the stream (somewhere in + the middle of a result set), this latter case is an error too + -- each result set must end with a EOF packet. + cli_safe_read() has set an error for us, just return. + */ + if (packet_length == packet_error) + return TRUE; + } + while (packet_length > 8 || mysql->net.read_pos[0] != 254); + + /* Analyze EOF packet of the result set. */ + + if (protocol_41(mysql)) + { + char *pos= (char*) mysql->net.read_pos + 1; + mysql->warning_count=uint2korr(pos); + pos+=2; + mysql->server_status=uint2korr(pos); + pos+=2; + } + return FALSE; +} + + +/** + Read a packet from network. If it's an OK packet, flush it. + + @return TRUE if error, FALSE otherwise. In case of + success, is_ok_packet is set to TRUE or FALSE, + based on what we got from network. +*/ + +my_bool opt_flush_ok_packet(MYSQL *mysql, my_bool *is_ok_packet) +{ + ulong packet_length= cli_safe_read(mysql); + + if (packet_length == packet_error) + return TRUE; + + /* cli_safe_read always reads a non-empty packet. */ + DBUG_ASSERT(packet_length); + + *is_ok_packet= mysql->net.read_pos[0] == 0; + if (*is_ok_packet) + { + uchar *pos= mysql->net.read_pos + 1; + + net_field_length_ll(&pos); /* affected rows */ + net_field_length_ll(&pos); /* insert id */ + + mysql->server_status=uint2korr(pos); + pos+=2; + + if (protocol_41(mysql)) + { + mysql->warning_count=uint2korr(pos); + pos+=2; + } + } + return FALSE; +} + + +/* + Flush result set sent from server +*/ + +static void cli_flush_use_result(MYSQL *mysql, my_bool flush_all_results) +{ + /* Clear the current execution status */ + DBUG_ENTER("cli_flush_use_result"); + DBUG_PRINT("warning",("Not all packets read, clearing them")); + + if (flush_one_result(mysql)) + DBUG_VOID_RETURN; /* An error occurred */ + + if (! flush_all_results) + DBUG_VOID_RETURN; + + while (mysql->server_status & SERVER_MORE_RESULTS_EXISTS) + { + my_bool is_ok_packet; + if (opt_flush_ok_packet(mysql, &is_ok_packet)) + DBUG_VOID_RETURN; /* An error occurred. */ + if (is_ok_packet) + { + /* + Indeed what we got from network was an OK packet, and we + know that OK is the last one in a multi-result-set, so + just return. + */ + DBUG_VOID_RETURN; + } + /* + It's a result set, not an OK packet. A result set contains + of two result set subsequences: field metadata, terminated + with EOF packet, and result set data, again terminated with + EOF packet. Read and flush them. + */ + if (flush_one_result(mysql) || flush_one_result(mysql)) + DBUG_VOID_RETURN; /* An error occurred. */ + } + + DBUG_VOID_RETURN; +} + + +#ifdef __WIN__ +static my_bool is_NT(void) +{ + char *os=getenv("OS"); + return (os && !strcmp(os, "Windows_NT")) ? 1 : 0; +} +#endif + + +#ifdef CHECK_LICENSE +/** + Check server side variable 'license'. + + If the variable does not exist or does not contain 'Commercial', + we're talking to non-commercial server from commercial client. + + @retval 0 success + @retval !0 network error or the server is not commercial. + Error code is saved in mysql->net.last_errno. +*/ + +static int check_license(MYSQL *mysql) +{ + MYSQL_ROW row; + MYSQL_RES *res; + NET *net= &mysql->net; + static const char query[]= "SELECT @@license"; + static const char required_license[]= STRINGIFY_ARG(LICENSE); + + if (mysql_real_query(mysql, query, sizeof(query)-1)) + { + if (net->last_errno == ER_UNKNOWN_SYSTEM_VARIABLE) + { + set_mysql_extended_error(mysql, CR_WRONG_LICENSE, unknown_sqlstate, + ER(CR_WRONG_LICENSE), required_license); + } + return 1; + } + if (!(res= mysql_use_result(mysql))) + return 1; + row= mysql_fetch_row(res); + /* + If no rows in result set, or column value is NULL (none of these + two is ever true for server variables now), or column value + mismatch, set wrong license error. + */ + if (!net->last_errno && + (!row || !row[0] || + strncmp(row[0], required_license, sizeof(required_license)))) + { + set_mysql_extended_error(mysql, CR_WRONG_LICENSE, unknown_sqlstate, + ER(CR_WRONG_LICENSE), required_license); + } + mysql_free_result(res); + return net->last_errno; +} +#endif /* CHECK_LICENSE */ + + +/************************************************************************** + Shut down connection +**************************************************************************/ + +void end_server(MYSQL *mysql) +{ + int save_errno= errno; + DBUG_ENTER("end_server"); + if (mysql->net.vio != 0) + { + init_sigpipe_variables + DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio))); + set_sigpipe(mysql); + vio_delete(mysql->net.vio); + reset_sigpipe(mysql); + mysql->net.vio= 0; /* Marker */ + } + net_end(&mysql->net); + free_old_query(mysql); + errno= save_errno; + DBUG_VOID_RETURN; +} + + +void STDCALL +mysql_free_result(MYSQL_RES *result) +{ + DBUG_ENTER("mysql_free_result"); + DBUG_PRINT("enter",("mysql_res: %p", result)); + if (result) + { + MYSQL *mysql= result->handle; + if (mysql) + { + if (mysql->unbuffered_fetch_owner == &result->unbuffered_fetch_cancelled) + mysql->unbuffered_fetch_owner= 0; + if (mysql->status == MYSQL_STATUS_USE_RESULT) + { + (*mysql->methods->flush_use_result)(mysql, FALSE); + mysql->status=MYSQL_STATUS_READY; + if (mysql->unbuffered_fetch_owner) + *mysql->unbuffered_fetch_owner= TRUE; + } + } + free_rows(result->data); + if (result->fields) + free_root(&result->field_alloc,MYF(0)); + if (result->row) + my_free((uchar*) result->row,MYF(0)); + my_free((uchar*) result,MYF(0)); + } + DBUG_VOID_RETURN; +} + +/**************************************************************************** + Get options from my.cnf +****************************************************************************/ + +static const char *default_options[]= +{ + "port","socket","compress","password","pipe", "timeout", "user", + "init-command", "host", "database", "debug", "return-found-rows", + "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", + "character-sets-dir", "default-character-set", "interactive-timeout", + "connect-timeout", "local-infile", "disable-local-infile", + "ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name", + "multi-results", "multi-statements", "multi-queries", "secure-auth", + "report-data-truncation", + NullS +}; + +static TYPELIB option_types={array_elements(default_options)-1, + "options",default_options, NULL}; + +const char *sql_protocol_names_lib[] = +{ "TCP", "SOCKET", "PIPE", "MEMORY", NullS }; +TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"", + sql_protocol_names_lib, NULL}; + +static int add_init_command(struct st_mysql_options *options, const char *cmd) +{ + char *tmp; + + if (!options->init_commands) + { + options->init_commands= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY), + MYF(MY_WME)); + init_dynamic_array(options->init_commands,sizeof(char*),5,5 CALLER_INFO); + } + + if (!(tmp= my_strdup(cmd,MYF(MY_WME))) || + insert_dynamic(options->init_commands, (uchar*)&tmp)) + { + my_free(tmp, MYF(MY_ALLOW_ZERO_PTR)); + return 1; + } + + return 0; +} + +void mysql_read_default_options(struct st_mysql_options *options, + const char *filename,const char *group) +{ + int argc; + char *argv_buff[1],**argv; + const char *groups[3]; + DBUG_ENTER("mysql_read_default_options"); + DBUG_PRINT("enter",("file: %s group: %s",filename,group ? group :"NULL")); + + argc=1; argv=argv_buff; argv_buff[0]= (char*) "client"; + groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0; + + my_load_defaults(filename, groups, &argc, &argv, NULL); + if (argc != 1) /* If some default option */ + { + char **option=argv; + while (*++option) + { + if (option[0] == args_separator) /* skip arguments separator */ + continue; + /* DBUG_PRINT("info",("option: %s",option[0])); */ + if (option[0][0] == '-' && option[0][1] == '-') + { + char *end=strcend(*option,'='); + char *opt_arg=0; + if (*end) + { + opt_arg=end+1; + *end=0; /* Remove '=' */ + } + /* Change all '_' in variable name to '-' */ + for (end= *option ; *(end= strcend(end,'_')) ; ) + *end= '-'; + switch (find_type(*option+2,&option_types,2)) { + case 1: /* port */ + if (opt_arg) + options->port=atoi(opt_arg); + break; + case 2: /* socket */ + if (opt_arg) + { + my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR)); + options->unix_socket=my_strdup(opt_arg,MYF(MY_WME)); + } + break; + case 3: /* compress */ + options->compress=1; + options->client_flag|= CLIENT_COMPRESS; + break; + case 4: /* password */ + if (opt_arg) + { + my_free(options->password,MYF(MY_ALLOW_ZERO_PTR)); + options->password=my_strdup(opt_arg,MYF(MY_WME)); + } + break; + case 5: + options->protocol = MYSQL_PROTOCOL_PIPE; + case 20: /* connect_timeout */ + case 6: /* timeout */ + if (opt_arg) + options->connect_timeout=atoi(opt_arg); + break; + case 7: /* user */ + if (opt_arg) + { + my_free(options->user,MYF(MY_ALLOW_ZERO_PTR)); + options->user=my_strdup(opt_arg,MYF(MY_WME)); + } + break; + case 8: /* init-command */ + add_init_command(options,opt_arg); + break; + case 9: /* host */ + if (opt_arg) + { + my_free(options->host,MYF(MY_ALLOW_ZERO_PTR)); + options->host=my_strdup(opt_arg,MYF(MY_WME)); + } + break; + case 10: /* database */ + if (opt_arg) + { + my_free(options->db,MYF(MY_ALLOW_ZERO_PTR)); + options->db=my_strdup(opt_arg,MYF(MY_WME)); + } + break; + case 11: /* debug */ +#ifdef MYSQL_CLIENT + mysql_debug(opt_arg ? opt_arg : "d:t:o,/tmp/client.trace"); + break; +#endif + case 12: /* return-found-rows */ + options->client_flag|=CLIENT_FOUND_ROWS; + break; +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + case 13: /* ssl_key */ + my_free(options->ssl_key, MYF(MY_ALLOW_ZERO_PTR)); + options->ssl_key = my_strdup(opt_arg, MYF(MY_WME)); + break; + case 14: /* ssl_cert */ + my_free(options->ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); + options->ssl_cert = my_strdup(opt_arg, MYF(MY_WME)); + break; + case 15: /* ssl_ca */ + my_free(options->ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); + options->ssl_ca = my_strdup(opt_arg, MYF(MY_WME)); + break; + case 16: /* ssl_capath */ + my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); + options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME)); + break; + case 23: /* ssl_cipher */ + my_free(options->ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); + options->ssl_cipher= my_strdup(opt_arg, MYF(MY_WME)); + break; +#else + case 13: /* Ignore SSL options */ + case 14: + case 15: + case 16: + case 23: + break; +#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ + case 17: /* charset-lib */ + my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR)); + options->charset_dir = my_strdup(opt_arg, MYF(MY_WME)); + break; + case 18: + my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR)); + options->charset_name = my_strdup(opt_arg, MYF(MY_WME)); + break; + case 19: /* Interactive-timeout */ + options->client_flag|= CLIENT_INTERACTIVE; + break; + case 21: + if (!opt_arg || atoi(opt_arg) != 0) + options->client_flag|= CLIENT_LOCAL_FILES; + else + options->client_flag&= ~CLIENT_LOCAL_FILES; + break; + case 22: + options->client_flag&= ~CLIENT_LOCAL_FILES; + break; + case 24: /* max-allowed-packet */ + if (opt_arg) + options->max_allowed_packet= atoi(opt_arg); + break; + case 25: /* protocol */ + if ((options->protocol= find_type(opt_arg, + &sql_protocol_typelib,0)) <= 0) + { + fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg); + exit(1); + } + break; + case 26: /* shared_memory_base_name */ +#ifdef HAVE_SMEM + if (options->shared_memory_base_name != def_shared_memory_base_name) + my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME)); +#endif + break; + case 27: /* multi-results */ + options->client_flag|= CLIENT_MULTI_RESULTS; + break; + case 28: /* multi-statements */ + case 29: /* multi-queries */ + options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS; + break; + case 30: /* secure-auth */ + options->secure_auth= TRUE; + break; + case 31: /* report-data-truncation */ + options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1; + break; + default: + DBUG_PRINT("warning",("unknown option: %s",option[0])); + } + } + } + } + free_defaults(argv); + DBUG_VOID_RETURN; +} + + +/************************************************************************** + Get column lengths of the current row + If one uses mysql_use_result, res->lengths contains the length information, + else the lengths are calculated from the offset between pointers. +**************************************************************************/ + +static void cli_fetch_lengths(ulong *to, MYSQL_ROW column, + unsigned int field_count) +{ + ulong *prev_length; + char *start=0; + MYSQL_ROW end; + + prev_length=0; /* Keep gcc happy */ + for (end=column + field_count + 1 ; column != end ; column++, to++) + { + if (!*column) + { + *to= 0; /* Null */ + continue; + } + if (start) /* Found end of prev string */ + *prev_length= (ulong) (*column-start-1); + start= *column; + prev_length= to; + } +} + +/*************************************************************************** + Change field rows to field structs +***************************************************************************/ + +MYSQL_FIELD * +unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, + my_bool default_value, uint server_capabilities) +{ + MYSQL_ROWS *row; + MYSQL_FIELD *field,*result; + ulong lengths[9]; /* Max of fields */ + DBUG_ENTER("unpack_fields"); + + field= result= (MYSQL_FIELD*) alloc_root(alloc, + (uint) sizeof(*field)*fields); + if (!result) + { + free_rows(data); /* Free old data */ + DBUG_RETURN(0); + } + bzero((char*) field, (uint) sizeof(MYSQL_FIELD)*fields); + if (server_capabilities & CLIENT_PROTOCOL_41) + { + /* server is 4.1, and returns the new field result format */ + for (row=data->data; row ; row = row->next,field++) + { + uchar *pos; + /* fields count may be wrong */ + DBUG_ASSERT((uint) (field - result) < fields); + cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7); + field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]); + field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]); + field->table= strmake_root(alloc,(char*) row->data[2], lengths[2]); + field->org_table= strmake_root(alloc,(char*) row->data[3], lengths[3]); + field->name= strmake_root(alloc,(char*) row->data[4], lengths[4]); + field->org_name= strmake_root(alloc,(char*) row->data[5], lengths[5]); + + field->catalog_length= lengths[0]; + field->db_length= lengths[1]; + field->table_length= lengths[2]; + field->org_table_length= lengths[3]; + field->name_length= lengths[4]; + field->org_name_length= lengths[5]; + + /* Unpack fixed length parts */ + pos= (uchar*) row->data[6]; + field->charsetnr= uint2korr(pos); + field->length= (uint) uint4korr(pos+2); + field->type= (enum enum_field_types) pos[6]; + field->flags= uint2korr(pos+7); + field->decimals= (uint) pos[9]; + + if (INTERNAL_NUM_FIELD(field)) + field->flags|= NUM_FLAG; + if (default_value && row->data[7]) + { + field->def=strmake_root(alloc,(char*) row->data[7], lengths[7]); + field->def_length= lengths[7]; + } + else + field->def=0; + field->max_length= 0; + } + } +#ifndef DELETE_SUPPORT_OF_4_0_PROTOCOL + else + { + /* old protocol, for backward compatibility */ + for (row=data->data; row ; row = row->next,field++) + { + cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5); + field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]); + field->name= strdup_root(alloc,(char*) row->data[1]); + field->length= (uint) uint3korr(row->data[2]); + field->type= (enum enum_field_types) (uchar) row->data[3][0]; + + field->catalog=(char*) ""; + field->db= (char*) ""; + field->catalog_length= 0; + field->db_length= 0; + field->org_table_length= field->table_length= lengths[0]; + field->name_length= lengths[1]; + + if (server_capabilities & CLIENT_LONG_FLAG) + { + field->flags= uint2korr(row->data[4]); + field->decimals=(uint) (uchar) row->data[4][2]; + } + else + { + field->flags= (uint) (uchar) row->data[4][0]; + field->decimals=(uint) (uchar) row->data[4][1]; + } + if (INTERNAL_NUM_FIELD(field)) + field->flags|= NUM_FLAG; + if (default_value && row->data[5]) + { + field->def=strdup_root(alloc,(char*) row->data[5]); + field->def_length= lengths[5]; + } + else + field->def=0; + field->max_length= 0; + } + } +#endif /* DELETE_SUPPORT_OF_4_0_PROTOCOL */ + free_rows(data); /* Free old data */ + DBUG_RETURN(result); +} + +/* Read all rows (fields or data) from server */ + +MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, + unsigned int fields) +{ + uint field; + ulong pkt_len; + ulong len; + uchar *cp; + char *to, *end_to; + MYSQL_DATA *result; + MYSQL_ROWS **prev_ptr,*cur; + NET *net = &mysql->net; + DBUG_ENTER("cli_read_rows"); + + if ((pkt_len= cli_safe_read(mysql)) == packet_error) + DBUG_RETURN(0); + if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA), + MYF(MY_WME | MY_ZEROFILL)))) + { + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); + DBUG_RETURN(0); + } + init_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */ + result->alloc.min_malloc=sizeof(MYSQL_ROWS); + prev_ptr= &result->data; + result->rows=0; + result->fields=fields; + + /* + The last EOF packet is either a single 254 character or (in MySQL 4.1) + 254 followed by 1-7 status bytes. + + This doesn't conflict with normal usage of 254 which stands for a + string where the length of the string is 8 bytes. (see net_field_length()) + */ + + while (*(cp=net->read_pos) != 254 || pkt_len >= 8) + { + result->rows++; + if (!(cur= (MYSQL_ROWS*) alloc_root(&result->alloc, + sizeof(MYSQL_ROWS))) || + !(cur->data= ((MYSQL_ROW) + alloc_root(&result->alloc, + (fields+1)*sizeof(char *)+pkt_len)))) + { + free_rows(result); + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); + DBUG_RETURN(0); + } + *prev_ptr=cur; + prev_ptr= &cur->next; + to= (char*) (cur->data+fields+1); + end_to=to+pkt_len-1; + for (field=0 ; field < fields ; field++) + { + if ((len=(ulong) net_field_length(&cp)) == NULL_LENGTH) + { /* null field */ + cur->data[field] = 0; + } + else + { + cur->data[field] = to; + if (len > (ulong) (end_to - to)) + { + free_rows(result); + set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); + DBUG_RETURN(0); + } + memcpy(to,(char*) cp,len); to[len]=0; + to+=len+1; + cp+=len; + if (mysql_fields) + { + if (mysql_fields[field].max_length < len) + mysql_fields[field].max_length=len; + } + } + } + cur->data[field]=to; /* End of last field */ + if ((pkt_len=cli_safe_read(mysql)) == packet_error) + { + free_rows(result); + DBUG_RETURN(0); + } + } + *prev_ptr=0; /* last pointer is null */ + if (pkt_len > 1) /* MySQL 4.1 protocol */ + { + mysql->warning_count= uint2korr(cp+1); + mysql->server_status= uint2korr(cp+3); + DBUG_PRINT("info",("status: %u warning_count: %u", + mysql->server_status, mysql->warning_count)); + } + DBUG_PRINT("exit", ("Got %lu rows", (ulong) result->rows)); + DBUG_RETURN(result); +} + +/* + Read one row. Uses packet buffer as storage for fields. + When next packet is read, the previous field values are destroyed +*/ + + +static int +read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) +{ + uint field; + ulong pkt_len,len; + uchar *pos, *prev_pos, *end_pos; + NET *net= &mysql->net; + + if ((pkt_len=cli_safe_read(mysql)) == packet_error) + return -1; + if (pkt_len <= 8 && net->read_pos[0] == 254) + { + if (pkt_len > 1) /* MySQL 4.1 protocol */ + { + mysql->warning_count= uint2korr(net->read_pos+1); + mysql->server_status= uint2korr(net->read_pos+3); + } + return 1; /* End of data */ + } + prev_pos= 0; /* allowed to write at packet[-1] */ + pos=net->read_pos; + end_pos=pos+pkt_len; + for (field=0 ; field < fields ; field++) + { + if ((len=(ulong) net_field_length(&pos)) == NULL_LENGTH) + { /* null field */ + row[field] = 0; + *lengths++=0; + } + else + { + if (len > (ulong) (end_pos - pos)) + { + set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate); + return -1; + } + row[field] = (char*) pos; + pos+=len; + *lengths++=len; + } + if (prev_pos) + *prev_pos=0; /* Terminate prev field */ + prev_pos=pos; + } + row[field]=(char*) prev_pos+1; /* End of last field */ + *prev_pos=0; /* Terminate last field */ + return 0; +} + + +/**************************************************************************** + Init MySQL structure or allocate one +****************************************************************************/ + +MYSQL * STDCALL +mysql_init(MYSQL *mysql) +{ + if (mysql_server_init(0, NULL, NULL)) + return 0; + if (!mysql) + { + if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL)))) + { + set_mysql_error(NULL, CR_OUT_OF_MEMORY, unknown_sqlstate); + return 0; + } + mysql->free_me=1; + } + else + bzero((char*) (mysql), sizeof(*(mysql))); + mysql->options.connect_timeout= CONNECT_TIMEOUT; + mysql->charset=default_client_charset_info; + strmov(mysql->net.sqlstate, not_error_sqlstate); + + /* + Only enable LOAD DATA INFILE by default if configured with + --enable-local-infile + */ + +#if defined(ENABLED_LOCAL_INFILE) && !defined(MYSQL_SERVER) + mysql->options.client_flag|= CLIENT_LOCAL_FILES; +#endif + +#ifdef HAVE_SMEM + mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name; +#endif + + mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION; + mysql->options.report_data_truncation= TRUE; /* default */ + + /* + By default we don't reconnect because it could silently corrupt data (after + reconnection you potentially lose table locks, user variables, session + variables (transactions but they are specifically dealt with in + mysql_reconnect()). + This is a change: < 5.0.3 mysql->reconnect was set to 1 by default. + How this change impacts existing apps: + - existing apps which relyed on the default will see a behaviour change; + they will have to set reconnect=1 after mysql_real_connect(). + - existing apps which explicitely asked for reconnection (the only way they + could do it was by setting mysql.reconnect to 1 after mysql_real_connect()) + will not see a behaviour change. + - existing apps which explicitely asked for no reconnection + (mysql.reconnect=0) will not see a behaviour change. + */ + mysql->reconnect= 0; + + return mysql; +} + + +/* + Fill in SSL part of MYSQL structure and set 'use_ssl' flag. + NB! Errors are not reported until you do mysql_real_connect. +*/ + +#define strdup_if_not_null(A) (A) == 0 ? 0 : my_strdup((A),MYF(MY_WME)) + +my_bool STDCALL +mysql_ssl_set(MYSQL *mysql __attribute__((unused)) , + const char *key __attribute__((unused)), + const char *cert __attribute__((unused)), + const char *ca __attribute__((unused)), + const char *capath __attribute__((unused)), + const char *cipher __attribute__((unused))) +{ + DBUG_ENTER("mysql_ssl_set"); +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + mysql->options.ssl_key= strdup_if_not_null(key); + mysql->options.ssl_cert= strdup_if_not_null(cert); + mysql->options.ssl_ca= strdup_if_not_null(ca); + mysql->options.ssl_capath= strdup_if_not_null(capath); + mysql->options.ssl_cipher= strdup_if_not_null(cipher); +#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ + DBUG_RETURN(0); +} + + +/* + Free strings in the SSL structure and clear 'use_ssl' flag. + NB! Errors are not reported until you do mysql_real_connect. +*/ + +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + +static void +mysql_ssl_free(MYSQL *mysql __attribute__((unused))) +{ + struct st_VioSSLFd *ssl_fd= (struct st_VioSSLFd*) mysql->connector_fd; + DBUG_ENTER("mysql_ssl_free"); + + my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); + if (ssl_fd) + SSL_CTX_free(ssl_fd->ssl_context); + my_free(mysql->connector_fd,MYF(MY_ALLOW_ZERO_PTR)); + mysql->options.ssl_key = 0; + mysql->options.ssl_cert = 0; + mysql->options.ssl_ca = 0; + mysql->options.ssl_capath = 0; + mysql->options.ssl_cipher= 0; + mysql->options.use_ssl = FALSE; + mysql->connector_fd = 0; + DBUG_VOID_RETURN; +} + +#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ + +/* + Return the SSL cipher (if any) used for current + connection to the server. + + SYNOPSYS + mysql_get_ssl_cipher() + mysql pointer to the mysql connection + +*/ + +const char * STDCALL +mysql_get_ssl_cipher(MYSQL *mysql __attribute__((unused))) +{ + DBUG_ENTER("mysql_get_ssl_cipher"); +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + if (mysql->net.vio && mysql->net.vio->ssl_arg) + DBUG_RETURN(SSL_get_cipher_name((SSL*)mysql->net.vio->ssl_arg)); +#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ + DBUG_RETURN(NULL); +} + + +/* + Check the server's (subject) Common Name against the + hostname we connected to + + SYNOPSIS + ssl_verify_server_cert() + vio pointer to a SSL connected vio + server_hostname name of the server that we connected to + + RETURN VALUES + 0 Success + 1 Failed to validate server + + */ + +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + +static int ssl_verify_server_cert(Vio *vio, const char* server_hostname) +{ + SSL *ssl; + X509 *server_cert; + char *cp1, *cp2; + char buf[256]; + DBUG_ENTER("ssl_verify_server_cert"); + DBUG_PRINT("enter", ("server_hostname: %s", server_hostname)); + + if (!(ssl= (SSL*)vio->ssl_arg)) + { + DBUG_PRINT("error", ("No SSL pointer found")); + DBUG_RETURN(1); + } + + if (!server_hostname) + { + DBUG_PRINT("error", ("No server hostname supplied")); + DBUG_RETURN(1); + } + + if (!(server_cert= SSL_get_peer_certificate(ssl))) + { + DBUG_PRINT("error", ("Could not get server certificate")); + DBUG_RETURN(1); + } + + /* + We already know that the certificate exchanged was valid; the SSL library + handled that. Now we need to verify that the contents of the certificate + are what we expect. + */ + + X509_NAME_oneline(X509_get_subject_name(server_cert), buf, sizeof(buf)); + X509_free (server_cert); + + DBUG_PRINT("info", ("hostname in cert: %s", buf)); + cp1= strstr(buf, "/CN="); + if (cp1) + { + cp1+= 4; /* Skip the "/CN=" that we found */ + /* Search for next / which might be the delimiter for email */ + cp2= strchr(cp1, '/'); + if (cp2) + *cp2= '\0'; + DBUG_PRINT("info", ("Server hostname in cert: %s", cp1)); + if (!strcmp(cp1, server_hostname)) + { + /* Success */ + DBUG_RETURN(0); + } + } + DBUG_PRINT("error", ("SSL certificate validation failure")); + DBUG_RETURN(1); +} + +#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ + + +/* + Note that the mysql argument must be initialized with mysql_init() + before calling mysql_real_connect ! +*/ + +static my_bool cli_read_query_result(MYSQL *mysql); +static MYSQL_RES *cli_use_result(MYSQL *mysql); + +static MYSQL_METHODS client_methods= +{ + cli_read_query_result, /* read_query_result */ + cli_advanced_command, /* advanced_command */ + cli_read_rows, /* read_rows */ + cli_use_result, /* use_result */ + cli_fetch_lengths, /* fetch_lengths */ + cli_flush_use_result /* flush_use_result */ +#ifndef MYSQL_SERVER + ,cli_list_fields, /* list_fields */ + cli_read_prepare_result, /* read_prepare_result */ + cli_stmt_execute, /* stmt_execute */ + cli_read_binary_rows, /* read_binary_rows */ + cli_unbuffered_fetch, /* unbuffered_fetch */ + NULL, /* free_embedded_thd */ + cli_read_statistics, /* read_statistics */ + cli_read_query_result, /* next_result */ + cli_read_change_user_result, /* read_change_user_result */ + cli_read_binary_rows /* read_rows_from_cursor */ +#endif +}; + +C_MODE_START +int mysql_init_character_set(MYSQL *mysql) +{ + const char *default_collation_name; + + /* Set character set */ + if (!mysql->options.charset_name) + { + default_collation_name= MYSQL_DEFAULT_COLLATION_NAME; + if (!(mysql->options.charset_name= + my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME)))) + return 1; + } + else + default_collation_name= NULL; + + { + const char *save= charsets_dir; + if (mysql->options.charset_dir) + charsets_dir=mysql->options.charset_dir; + mysql->charset=get_charset_by_csname(mysql->options.charset_name, + MY_CS_PRIMARY, MYF(MY_WME)); + if (mysql->charset && default_collation_name) + { + CHARSET_INFO *collation; + if ((collation= + get_charset_by_name(default_collation_name, MYF(MY_WME)))) + { + if (!my_charset_same(mysql->charset, collation)) + { + my_printf_error(ER_UNKNOWN_ERROR, + "COLLATION %s is not valid for CHARACTER SET %s", + MYF(0), + default_collation_name, mysql->options.charset_name); + mysql->charset= NULL; + } + else + { + mysql->charset= collation; + } + } + else + mysql->charset= NULL; + } + charsets_dir= save; + } + + if (!mysql->charset) + { + if (mysql->options.charset_dir) + set_mysql_extended_error(mysql, CR_CANT_READ_CHARSET, unknown_sqlstate, + ER(CR_CANT_READ_CHARSET), + mysql->options.charset_name, + mysql->options.charset_dir); + else + { + char cs_dir_name[FN_REFLEN]; + get_charsets_dir(cs_dir_name); + set_mysql_extended_error(mysql, CR_CANT_READ_CHARSET, unknown_sqlstate, + ER(CR_CANT_READ_CHARSET), + mysql->options.charset_name, + cs_dir_name); + } + return 1; + } + return 0; +} +C_MODE_END + + +MYSQL * STDCALL +CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, + const char *passwd, const char *db, + uint port, const char *unix_socket,ulong client_flag) +{ + char buff[NAME_LEN+USERNAME_LENGTH+100]; + char *end,*host_info; + ulong pkt_length; + NET *net= &mysql->net; +#ifdef MYSQL_SERVER + thr_alarm_t alarmed; + ALARM alarm_buff; +#endif +#ifdef __WIN__ + HANDLE hPipe=INVALID_HANDLE_VALUE; +#endif +#ifdef HAVE_SYS_UN_H + struct sockaddr_un UNIXaddr; +#endif + init_sigpipe_variables + DBUG_ENTER("mysql_real_connect"); + LINT_INIT(host_info); + + DBUG_PRINT("enter",("host: %s db: %s user: %s", + host ? host : "(Null)", + db ? db : "(Null)", + user ? user : "(Null)")); + + /* Test whether we're already connected */ + if (net->vio) + { + set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate); + DBUG_RETURN(0); + } + + /* Don't give sigpipe errors if the client doesn't want them */ + set_sigpipe(mysql); + mysql->methods= &client_methods; + net->vio = 0; /* If something goes wrong */ + mysql->client_flag=0; /* For handshake */ + + /* use default options */ + if (mysql->options.my_cnf_file || mysql->options.my_cnf_group) + { + mysql_read_default_options(&mysql->options, + (mysql->options.my_cnf_file ? + mysql->options.my_cnf_file : "my"), + mysql->options.my_cnf_group); + my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); + mysql->options.my_cnf_file=mysql->options.my_cnf_group=0; + } + + /* Some empty-string-tests are done because of ODBC */ + if (!host || !host[0]) + host=mysql->options.host; + if (!user || !user[0]) + { + user=mysql->options.user; + if (!user) + user= ""; + } + if (!passwd) + { + passwd=mysql->options.password; +#if !defined(DONT_USE_MYSQL_PWD) && !defined(MYSQL_SERVER) + if (!passwd) + passwd=getenv("MYSQL_PWD"); /* get it from environment */ +#endif + if (!passwd) + passwd= ""; + } + if (!db || !db[0]) + db=mysql->options.db; + if (!port) + port=mysql->options.port; + if (!unix_socket) + unix_socket=mysql->options.unix_socket; + + mysql->server_status=SERVER_STATUS_AUTOCOMMIT; + + /* + Part 0: Grab a socket and connect it to the server + */ +#if defined(HAVE_SMEM) + if ((!mysql->options.protocol || + mysql->options.protocol == MYSQL_PROTOCOL_MEMORY) && + (!host || !strcmp(host,LOCAL_HOST))) + { + if ((create_shared_memory(mysql,net, mysql->options.connect_timeout)) == + INVALID_HANDLE_VALUE) + { + DBUG_PRINT("error", + ("host: '%s' socket: '%s' shared memory: %s have_tcpip: %d", + host ? host : "", + unix_socket ? unix_socket : "", + (int) mysql->options.shared_memory_base_name, + (int) have_tcpip)); + if (mysql->options.protocol == MYSQL_PROTOCOL_MEMORY) + goto error; + + /* + Try also with PIPE or TCP/IP. Clear the error from + create_shared_memory(). + */ + + net_clear_error(net); + } + else + { + mysql->options.protocol=MYSQL_PROTOCOL_MEMORY; + unix_socket = 0; + host=mysql->options.shared_memory_base_name; + my_snprintf(host_info=buff, sizeof(buff)-1, + ER(CR_SHARED_MEMORY_CONNECTION), host); + } + } +#endif /* HAVE_SMEM */ +#if defined(HAVE_SYS_UN_H) + if (!net->vio && + (!mysql->options.protocol || + mysql->options.protocol == MYSQL_PROTOCOL_SOCKET) && + (unix_socket || mysql_unix_port) && + (!host || !strcmp(host,LOCAL_HOST))) + { + my_socket sock= socket(AF_UNIX, SOCK_STREAM, 0); + if (sock == SOCKET_ERROR) + { + set_mysql_extended_error(mysql, CR_SOCKET_CREATE_ERROR, + unknown_sqlstate, + ER(CR_SOCKET_CREATE_ERROR), + socket_errno); + goto error; + } + + net->vio= vio_new(sock, VIO_TYPE_SOCKET, + VIO_LOCALHOST | VIO_BUFFERED_READ); + if (!net->vio) + { + DBUG_PRINT("error",("Unknow protocol %d ", mysql->options.protocol)); + set_mysql_error(mysql, CR_CONN_UNKNOW_PROTOCOL, unknown_sqlstate); + closesocket(sock); + goto error; + } + + host= LOCAL_HOST; + if (!unix_socket) + unix_socket= mysql_unix_port; + host_info= (char*) ER(CR_LOCALHOST_CONNECTION); + DBUG_PRINT("info", ("Using UNIX sock '%s'", unix_socket)); + + bzero((char*) &UNIXaddr, sizeof(UNIXaddr)); + UNIXaddr.sun_family= AF_UNIX; + strmake(UNIXaddr.sun_path, unix_socket, sizeof(UNIXaddr.sun_path)-1); + + if (my_connect(sock, (struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr), + mysql->options.connect_timeout)) + { + DBUG_PRINT("error",("Got error %d on connect to local server", + socket_errno)); + set_mysql_extended_error(mysql, CR_CONNECTION_ERROR, + unknown_sqlstate, + ER(CR_CONNECTION_ERROR), + unix_socket, socket_errno); + vio_delete(net->vio); + net->vio= 0; + goto error; + } + mysql->options.protocol=MYSQL_PROTOCOL_SOCKET; + } +#elif defined(__WIN__) + if (!net->vio && + (mysql->options.protocol == MYSQL_PROTOCOL_PIPE || + (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) || + (! have_tcpip && (unix_socket || !host && is_NT())))) + { + if ((hPipe= create_named_pipe(mysql, mysql->options.connect_timeout, + (char**) &host, (char**) &unix_socket)) == + INVALID_HANDLE_VALUE) + { + DBUG_PRINT("error", + ("host: '%s' socket: '%s' have_tcpip: %d", + host ? host : "", + unix_socket ? unix_socket : "", + (int) have_tcpip)); + if (mysql->options.protocol == MYSQL_PROTOCOL_PIPE || + (host && !strcmp(host,LOCAL_HOST_NAMEDPIPE)) || + (unix_socket && !strcmp(unix_socket,MYSQL_NAMEDPIPE))) + goto error; + /* Try also with TCP/IP */ + } + else + { + net->vio=vio_new_win32pipe(hPipe); + my_snprintf(host_info=buff, sizeof(buff)-1, + ER(CR_NAMEDPIPE_CONNECTION), unix_socket); + } + } +#endif + if (!net->vio && + (!mysql->options.protocol || + mysql->options.protocol == MYSQL_PROTOCOL_TCP)) + { + struct addrinfo *res_lst, hints, *t_res; + int gai_errno; + char port_buf[NI_MAXSERV]; + + unix_socket=0; /* This is not used */ + + if (!port) + port= mysql_port; + + if (!host) + host= LOCAL_HOST; + + my_snprintf(host_info=buff, sizeof(buff)-1, ER(CR_TCP_CONNECTION), host); + DBUG_PRINT("info",("Server name: '%s'. TCP sock: %d", host, port)); +#ifdef MYSQL_SERVER + thr_alarm_init(&alarmed); + thr_alarm(&alarmed, mysql->options.connect_timeout, &alarm_buff); +#endif + + DBUG_PRINT("info",("IP '%s'", "client")); + +#ifdef MYSQL_SERVER + thr_end_alarm(&alarmed); +#endif + + memset(&hints, 0, sizeof(hints)); + hints.ai_socktype= SOCK_STREAM; + hints.ai_protocol= IPPROTO_TCP; + hints.ai_family= AF_UNSPEC; + + DBUG_PRINT("info",("IPV6 getaddrinfo %s", host)); + my_snprintf(port_buf, NI_MAXSERV, "%d", port); + gai_errno= getaddrinfo(host, port_buf, &hints, &res_lst); + + if (gai_errno != 0) + { + /* + For DBUG we are keeping the right message but for client we default to + historical error message. + */ + DBUG_PRINT("info",("IPV6 getaddrinfo error %d", gai_errno)); + set_mysql_extended_error(mysql, CR_UNKNOWN_HOST, unknown_sqlstate, + ER(CR_UNKNOWN_HOST), host, errno); + + goto error; + } + + /* We only look at the first item (something to think about changing in the future) */ + t_res= res_lst; + { + my_socket sock= socket(t_res->ai_family, t_res->ai_socktype, + t_res->ai_protocol); + if (sock == SOCKET_ERROR) + { + set_mysql_extended_error(mysql, CR_IPSOCK_ERROR, unknown_sqlstate, + ER(CR_IPSOCK_ERROR), socket_errno); + freeaddrinfo(res_lst); + goto error; + } + + net->vio= vio_new(sock, VIO_TYPE_TCPIP, VIO_BUFFERED_READ); + if (! net->vio ) + { + DBUG_PRINT("error",("Unknow protocol %d ", mysql->options.protocol)); + set_mysql_error(mysql, CR_CONN_UNKNOW_PROTOCOL, unknown_sqlstate); + closesocket(sock); + freeaddrinfo(res_lst); + goto error; + } + + if (my_connect(sock, t_res->ai_addr, t_res->ai_addrlen, + mysql->options.connect_timeout)) + { + DBUG_PRINT("error",("Got error %d on connect to '%s'",socket_errno, + host)); + set_mysql_extended_error(mysql, CR_CONN_HOST_ERROR, unknown_sqlstate, + ER(CR_CONN_HOST_ERROR), host, socket_errno); + vio_delete(net->vio); + net->vio= 0; + freeaddrinfo(res_lst); + goto error; + } + } + + freeaddrinfo(res_lst); + } + + if (!net->vio) + { + DBUG_PRINT("error",("Unknow protocol %d ",mysql->options.protocol)); + set_mysql_error(mysql, CR_CONN_UNKNOW_PROTOCOL, unknown_sqlstate); + goto error; + } + + if (my_net_init(net, net->vio)) + { + vio_delete(net->vio); + net->vio = 0; + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); + goto error; + } + vio_keepalive(net->vio,TRUE); + + /* If user set read_timeout, let it override the default */ + if (mysql->options.read_timeout) + my_net_set_read_timeout(net, mysql->options.read_timeout); + + /* If user set write_timeout, let it override the default */ + if (mysql->options.write_timeout) + my_net_set_write_timeout(net, mysql->options.write_timeout); + + if (mysql->options.max_allowed_packet) + net->max_packet_size= mysql->options.max_allowed_packet; + + /* Get version info */ + mysql->protocol_version= PROTOCOL_VERSION; /* Assume this */ + if (mysql->options.connect_timeout && + vio_poll_read(net->vio, mysql->options.connect_timeout)) + { + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "waiting for initial communication packet", + errno); + goto error; + } + + /* + Part 1: Connection established, read and parse first packet + */ + + if ((pkt_length=cli_safe_read(mysql)) == packet_error) + { + if (mysql->net.last_errno == CR_SERVER_LOST) + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "reading initial communication packet", + errno); + goto error; + } + /* Check if version of protocol matches current one */ + + mysql->protocol_version= net->read_pos[0]; + DBUG_DUMP("packet",(uchar*) net->read_pos,10); + DBUG_PRINT("info",("mysql protocol version %d, server=%d", + PROTOCOL_VERSION, mysql->protocol_version)); + if (mysql->protocol_version != PROTOCOL_VERSION) + { + set_mysql_extended_error(mysql, CR_VERSION_ERROR, unknown_sqlstate, + ER(CR_VERSION_ERROR), mysql->protocol_version, + PROTOCOL_VERSION); + goto error; + } + end=strend((char*) net->read_pos+1); + mysql->thread_id=uint4korr(end+1); + end+=5; + /* + Scramble is split into two parts because old clients does not understand + long scrambles; here goes the first part. + */ + strmake(mysql->scramble, end, SCRAMBLE_LENGTH_323); + end+= SCRAMBLE_LENGTH_323+1; + + if (pkt_length >= (uint) (end+1 - (char*) net->read_pos)) + mysql->server_capabilities=uint2korr(end); + if (pkt_length >= (uint) (end+18 - (char*) net->read_pos)) + { + /* New protocol with 16 bytes to describe server characteristics */ + mysql->server_language=end[2]; + mysql->server_status=uint2korr(end+3); + } + end+= 18; + if (pkt_length >= (uint) (end + SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323 + 1 - + (char *) net->read_pos)) + strmake(mysql->scramble+SCRAMBLE_LENGTH_323, end, + SCRAMBLE_LENGTH-SCRAMBLE_LENGTH_323); + else + mysql->server_capabilities&= ~CLIENT_SECURE_CONNECTION; + + if (mysql->options.secure_auth && passwd[0] && + !(mysql->server_capabilities & CLIENT_SECURE_CONNECTION)) + { + set_mysql_error(mysql, CR_SECURE_AUTH, unknown_sqlstate); + goto error; + } + + if (mysql_init_character_set(mysql)) + goto error; + + /* Save connection information */ + if (!my_multi_malloc(MYF(0), + &mysql->host_info, (uint) strlen(host_info)+1, + &mysql->host, (uint) strlen(host)+1, + &mysql->unix_socket,unix_socket ? + (uint) strlen(unix_socket)+1 : (uint) 1, + &mysql->server_version, + (uint) (end - (char*) net->read_pos), + NullS) || + !(mysql->user=my_strdup(user,MYF(0))) || + !(mysql->passwd=my_strdup(passwd,MYF(0)))) + { + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); + goto error; + } + strmov(mysql->host_info,host_info); + strmov(mysql->host,host); + if (unix_socket) + strmov(mysql->unix_socket,unix_socket); + else + mysql->unix_socket=0; + strmov(mysql->server_version,(char*) net->read_pos+1); + mysql->port=port; + + /* + Part 2: format and send client info to the server for access check + */ + + client_flag|=mysql->options.client_flag; + client_flag|=CLIENT_CAPABILITIES; + if (client_flag & CLIENT_MULTI_STATEMENTS) + client_flag|= CLIENT_MULTI_RESULTS; + +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + if (mysql->options.ssl_key || mysql->options.ssl_cert || + mysql->options.ssl_ca || mysql->options.ssl_capath || + mysql->options.ssl_cipher) + mysql->options.use_ssl= 1; + if (mysql->options.use_ssl) + client_flag|=CLIENT_SSL; +#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/ + if (db) + client_flag|=CLIENT_CONNECT_WITH_DB; + + /* Remove options that server doesn't support */ + client_flag= ((client_flag & + ~(CLIENT_COMPRESS | CLIENT_SSL | CLIENT_PROTOCOL_41)) | + (client_flag & mysql->server_capabilities)); +#ifndef HAVE_COMPRESS + client_flag&= ~CLIENT_COMPRESS; +#endif + + if (client_flag & CLIENT_PROTOCOL_41) + { + /* 4.1 server and 4.1 client has a 32 byte option flag */ + int4store(buff,client_flag); + int4store(buff+4, net->max_packet_size); + buff[8]= (char) mysql->charset->number; + /* + Character set 45 (4-byte UTF-8) is not available on servers + before version 6.0, so we need to go ahead and switch to utf8_mb3. + */ + if (mysql->charset->number == 45 && mysql->server_version[0] < '6') + buff[8]= 33; + else + buff[8]= (char)mysql->charset->number; + + bzero(buff+9, 32-9); + end= buff+32; + } + else + { + int2store(buff,client_flag); + int3store(buff+2,net->max_packet_size); + end= buff+5; + } + mysql->client_flag=client_flag; + +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + if (client_flag & CLIENT_SSL) + { + /* Do the SSL layering. */ + struct st_mysql_options *options= &mysql->options; + struct st_VioSSLFd *ssl_fd; + + /* + Send client_flag, max_packet_size - unencrypted otherwise + the server does not know we want to do SSL + */ + if (my_net_write(net, (uchar*) buff, (uint) (end-buff)) || net_flush(net)) + { + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "sending connection information to server", + errno); + goto error; + } + + /* Create the VioSSLConnectorFd - init SSL and load certs */ + if (!(ssl_fd= new_VioSSLConnectorFd(options->ssl_key, + options->ssl_cert, + options->ssl_ca, + options->ssl_capath, + options->ssl_cipher))) + { + set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate); + goto error; + } + mysql->connector_fd= (void*)ssl_fd; + + /* Connect to the server */ + DBUG_PRINT("info", ("IO layer change in progress...")); + if (sslconnect(ssl_fd, mysql->net.vio, + (long) (mysql->options.connect_timeout))) + { + set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate); + goto error; + } + DBUG_PRINT("info", ("IO layer change done!")); + + /* Verify server cert */ + if ((client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) && + ssl_verify_server_cert(mysql->net.vio, mysql->host)) + { + set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate); + goto error; + } + + } +#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ + + DBUG_PRINT("info",("Server version = '%s' capabilites: %lu status: %u client_flag: %lu", + mysql->server_version,mysql->server_capabilities, + mysql->server_status, client_flag)); + /* This needs to be changed as it's not useful with big packets */ + if (user && user[0]) + strmake(end,user,USERNAME_LENGTH); /* Max user name */ + else + read_user_name((char*) end); + + /* We have to handle different version of handshake here */ +#ifdef _CUSTOMCONFIG_ +#include "_cust_libmysql.h" +#endif + DBUG_PRINT("info",("user: %s",end)); + end= strend(end) + 1; + if (passwd[0]) + { + if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + { + *end++= SCRAMBLE_LENGTH; + scramble(end, mysql->scramble, passwd); + end+= SCRAMBLE_LENGTH; + } + else + { + scramble_323(end, mysql->scramble, passwd); + end+= SCRAMBLE_LENGTH_323 + 1; + } + } + else + *end++= '\0'; /* empty password */ + + /* Add database if needed */ + if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB)) + { + end= strmake(end, db, NAME_LEN) + 1; + mysql->db= my_strdup(db,MYF(MY_WME)); + db= 0; + } + /* Write authentication package */ + if (my_net_write(net, (uchar*) buff, (size_t) (end-buff)) || net_flush(net)) + { + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "sending authentication information", + errno); + goto error; + } + + /* + Part 3: Authorization data's been sent. Now server can reply with + OK-packet, or re-request scrambled password. + */ + + if ((pkt_length=cli_safe_read(mysql)) == packet_error) + { + if (mysql->net.last_errno == CR_SERVER_LOST) + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "reading authorization packet", + errno); + goto error; + } + + if (pkt_length == 1 && net->read_pos[0] == 254 && + mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + { + /* + By sending this very specific reply server asks us to send scrambled + password in old format. + */ + scramble_323(buff, mysql->scramble, passwd); + if (my_net_write(net, (uchar*) buff, SCRAMBLE_LENGTH_323 + 1) || + net_flush(net)) + { + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "sending password information", + errno); + goto error; + } + /* Read what server thinks about out new auth message report */ + if (cli_safe_read(mysql) == packet_error) + { + if (mysql->net.last_errno == CR_SERVER_LOST) + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "reading final connect information", + errno); + goto error; + } + } + + if (client_flag & CLIENT_COMPRESS) /* We will use compression */ + net->compress=1; + +#ifdef CHECK_LICENSE + if (check_license(mysql)) + goto error; +#endif + + if (db && mysql_select_db(mysql, db)) + { + if (mysql->net.last_errno == CR_SERVER_LOST) + set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, + ER(CR_SERVER_LOST_EXTENDED), + "Setting intital database", + errno); + goto error; + } + + if (mysql->options.init_commands) + { + DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; + char **ptr= (char**)init_commands->buffer; + char **end_command= ptr + init_commands->elements; + + my_bool reconnect=mysql->reconnect; + mysql->reconnect=0; + + for (; ptr < end_command; ptr++) + { + MYSQL_RES *res; + if (mysql_real_query(mysql,*ptr, (ulong) strlen(*ptr))) + goto error; + if (mysql->fields) + { + if (!(res= cli_use_result(mysql))) + goto error; + mysql_free_result(res); + } + } + mysql->reconnect=reconnect; + } + + DBUG_PRINT("exit", ("Mysql handler: %p", mysql)); + reset_sigpipe(mysql); + DBUG_RETURN(mysql); + +error: + reset_sigpipe(mysql); + DBUG_PRINT("error",("message: %u/%s (%s)", + net->last_errno, + net->sqlstate, + net->last_error)); + { + /* Free alloced memory */ + end_server(mysql); + mysql_close_free(mysql); + if (!(((ulong) client_flag) & CLIENT_REMEMBER_OPTIONS)) + mysql_close_free_options(mysql); + } + DBUG_RETURN(0); +} + + +my_bool mysql_reconnect(MYSQL *mysql) +{ + MYSQL tmp_mysql; + DBUG_ENTER("mysql_reconnect"); + DBUG_ASSERT(mysql); + DBUG_PRINT("enter", ("mysql->reconnect: %d", mysql->reconnect)); + + if (!mysql->reconnect || + (mysql->server_status & SERVER_STATUS_IN_TRANS) || !mysql->host_info) + { + /* Allow reconnect next time */ + mysql->server_status&= ~SERVER_STATUS_IN_TRANS; + set_mysql_error(mysql, CR_SERVER_GONE_ERROR, unknown_sqlstate); + DBUG_RETURN(1); + } + mysql_init(&tmp_mysql); + tmp_mysql.options= mysql->options; + tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0; + + if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, + mysql->db, mysql->port, mysql->unix_socket, + mysql->client_flag | CLIENT_REMEMBER_OPTIONS)) + { + mysql->net.last_errno= tmp_mysql.net.last_errno; + strmov(mysql->net.last_error, tmp_mysql.net.last_error); + strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate); + DBUG_RETURN(1); + } + if (mysql_set_character_set(&tmp_mysql, mysql->charset->csname)) + { + DBUG_PRINT("error", ("mysql_set_character_set() failed")); + bzero((char*) &tmp_mysql.options,sizeof(tmp_mysql.options)); + mysql_close(&tmp_mysql); + mysql->net.last_errno= tmp_mysql.net.last_errno; + strmov(mysql->net.last_error, tmp_mysql.net.last_error); + strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate); + DBUG_RETURN(1); + } + + DBUG_PRINT("info", ("reconnect succeded")); + tmp_mysql.reconnect= 1; + tmp_mysql.free_me= mysql->free_me; + + /* + For each stmt in mysql->stmts, move it to tmp_mysql if it is + in state MYSQL_STMT_INIT_DONE, otherwise close it. + */ + { + LIST *element= mysql->stmts; + for (; element; element= element->next) + { + MYSQL_STMT *stmt= (MYSQL_STMT *) element->data; + if (stmt->state != MYSQL_STMT_INIT_DONE) + { + stmt->mysql= 0; + stmt->last_errno= CR_SERVER_LOST; + strmov(stmt->last_error, ER(CR_SERVER_LOST)); + strmov(stmt->sqlstate, unknown_sqlstate); + } + else + { + tmp_mysql.stmts= list_add(tmp_mysql.stmts, &stmt->list); + } + /* No need to call list_delete for statement here */ + } + mysql->stmts= NULL; + } + + /* Don't free options as these are now used in tmp_mysql */ + bzero((char*) &mysql->options,sizeof(mysql->options)); + mysql->free_me=0; + mysql_close(mysql); + *mysql=tmp_mysql; + net_clear(&mysql->net, 1); + mysql->affected_rows= ~(my_ulonglong) 0; + DBUG_RETURN(0); +} + + +/************************************************************************** + Set current database +**************************************************************************/ + +int STDCALL +mysql_select_db(MYSQL *mysql, const char *db) +{ + int error; + DBUG_ENTER("mysql_select_db"); + DBUG_PRINT("enter",("db: '%s'",db)); + + if ((error=simple_command(mysql,COM_INIT_DB, (const uchar*) db, + (ulong) strlen(db),0))) + DBUG_RETURN(error); + my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); + mysql->db=my_strdup(db,MYF(MY_WME)); + DBUG_RETURN(0); +} + + +/************************************************************************* + Send a QUIT to the server and close the connection + If handle is alloced by mysql connect free it. +*************************************************************************/ + +static void mysql_close_free_options(MYSQL *mysql) +{ + DBUG_ENTER("mysql_close_free_options"); + + my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->options.client_ip,MYF(MY_ALLOW_ZERO_PTR)); + if (mysql->options.init_commands) + { + DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; + char **ptr= (char**)init_commands->buffer; + char **end= ptr + init_commands->elements; + for (; ptroptions.shared_memory_base_name != def_shared_memory_base_name) + my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); +#endif /* HAVE_SMEM */ + bzero((char*) &mysql->options,sizeof(mysql->options)); + DBUG_VOID_RETURN; +} + + +static void mysql_close_free(MYSQL *mysql) +{ + my_free((uchar*) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); +#if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100 + my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR)); + mysql->info_buffer= 0; +#endif + /* Clear pointers for better safety */ + mysql->host_info= mysql->user= mysql->passwd= mysql->db= 0; +} + + +/* + Clear connection pointer of every statement: this is necessary + to give error on attempt to use a prepared statement of closed + connection. + + SYNOPSYS + mysql_detach_stmt_list() + stmt_list pointer to mysql->stmts + func_name name of calling function + + NOTE + There is similar code in mysql_reconnect(), so changes here + should also be reflected there. +*/ + +void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)), + const char *func_name __attribute__((unused))) +{ +#ifdef MYSQL_CLIENT + /* Reset connection handle in all prepared statements. */ + LIST *element= *stmt_list; + char buff[MYSQL_ERRMSG_SIZE]; + DBUG_ENTER("mysql_detach_stmt_list"); + + my_snprintf(buff, sizeof(buff)-1, ER(CR_STMT_CLOSED), func_name); + for (; element; element= element->next) + { + MYSQL_STMT *stmt= (MYSQL_STMT *) element->data; + set_stmt_error(stmt, CR_STMT_CLOSED, unknown_sqlstate, buff); + stmt->mysql= 0; + /* No need to call list_delete for statement here */ + } + *stmt_list= 0; + DBUG_VOID_RETURN; +#endif /* MYSQL_CLIENT */ +} + + +void STDCALL mysql_close(MYSQL *mysql) +{ + DBUG_ENTER("mysql_close"); + if (mysql) /* Some simple safety */ + { + /* If connection is still up, send a QUIT message */ + if (mysql->net.vio != 0) + { + free_old_query(mysql); + mysql->status=MYSQL_STATUS_READY; /* Force command */ + mysql->reconnect=0; + simple_command(mysql,COM_QUIT,(uchar*) 0,0,1); + end_server(mysql); /* Sets mysql->net.vio= 0 */ + } + mysql_close_free_options(mysql); + mysql_close_free(mysql); + mysql_detach_stmt_list(&mysql->stmts, "mysql_close"); +#ifndef MYSQL_SERVER + if (mysql->thd) + (*mysql->methods->free_embedded_thd)(mysql); +#endif + if (mysql->free_me) + my_free((uchar*) mysql,MYF(0)); + } + DBUG_VOID_RETURN; +} + + +static my_bool cli_read_query_result(MYSQL *mysql) +{ + uchar *pos; + ulong field_count; + MYSQL_DATA *fields; + ulong length; + DBUG_ENTER("cli_read_query_result"); + + if ((length = cli_safe_read(mysql)) == packet_error) + DBUG_RETURN(1); + free_old_query(mysql); /* Free old result */ +#ifdef MYSQL_CLIENT /* Avoid warn of unused labels*/ +get_info: +#endif + pos=(uchar*) mysql->net.read_pos; + if ((field_count= net_field_length(&pos)) == 0) + { + mysql->affected_rows= net_field_length_ll(&pos); + mysql->insert_id= net_field_length_ll(&pos); + DBUG_PRINT("info",("affected_rows: %lu insert_id: %lu", + (ulong) mysql->affected_rows, + (ulong) mysql->insert_id)); + if (protocol_41(mysql)) + { + mysql->server_status=uint2korr(pos); pos+=2; + mysql->warning_count=uint2korr(pos); pos+=2; + } + else if (mysql->server_capabilities & CLIENT_TRANSACTIONS) + { + /* MySQL 4.0 protocol */ + mysql->server_status=uint2korr(pos); pos+=2; + mysql->warning_count= 0; + } + DBUG_PRINT("info",("status: %u warning_count: %u", + mysql->server_status, mysql->warning_count)); + if (pos < mysql->net.read_pos+length && net_field_length(&pos)) + mysql->info=(char*) pos; + DBUG_RETURN(0); + } +#ifdef MYSQL_CLIENT + if (field_count == NULL_LENGTH) /* LOAD DATA LOCAL INFILE */ + { + int error; + + if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES)) + { + set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); + DBUG_RETURN(1); + } + + error= handle_local_infile(mysql,(char*) pos); + if ((length= cli_safe_read(mysql)) == packet_error || error) + DBUG_RETURN(1); + goto get_info; /* Get info packet */ + } +#endif + if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT)) + mysql->server_status|= SERVER_STATUS_IN_TRANS; + + if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5))) + DBUG_RETURN(1); + if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc, + (uint) field_count,0, + mysql->server_capabilities))) + DBUG_RETURN(1); + mysql->status= MYSQL_STATUS_GET_RESULT; + mysql->field_count= (uint) field_count; + DBUG_PRINT("exit",("ok")); + DBUG_RETURN(0); +} + + +/* + Send the query and return so we can do something else. + Needs to be followed by mysql_read_query_result() when we want to + finish processing it. +*/ + +int STDCALL +mysql_send_query(MYSQL* mysql, const char* query, ulong length) +{ + DBUG_ENTER("mysql_send_query"); + DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1)); +} + + +int STDCALL +mysql_real_query(MYSQL *mysql, const char *query, ulong length) +{ + DBUG_ENTER("mysql_real_query"); + DBUG_PRINT("enter",("handle: %p", mysql)); + DBUG_PRINT("query",("Query = '%-.4096s'",query)); + + if (mysql_send_query(mysql,query,length)) + DBUG_RETURN(1); + DBUG_RETURN((int) (*mysql->methods->read_query_result)(mysql)); +} + + +/************************************************************************** + Alloc result struct for buffered results. All rows are read to buffer. + mysql_data_seek may be used. +**************************************************************************/ + +MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql) +{ + MYSQL_RES *result; + DBUG_ENTER("mysql_store_result"); + + if (!mysql->fields) + DBUG_RETURN(0); + if (mysql->status != MYSQL_STATUS_GET_RESULT) + { + set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); + DBUG_RETURN(0); + } + mysql->status=MYSQL_STATUS_READY; /* server is ready */ + if (!(result=(MYSQL_RES*) my_malloc((uint) (sizeof(MYSQL_RES)+ + sizeof(ulong) * + mysql->field_count), + MYF(MY_WME | MY_ZEROFILL)))) + { + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); + DBUG_RETURN(0); + } + result->methods= mysql->methods; + result->eof=1; /* Marker for buffered */ + result->lengths=(ulong*) (result+1); + if (!(result->data= + (*mysql->methods->read_rows)(mysql,mysql->fields,mysql->field_count))) + { + my_free((uchar*) result,MYF(0)); + DBUG_RETURN(0); + } + mysql->affected_rows= result->row_count= result->data->rows; + result->data_cursor= result->data->data; + result->fields= mysql->fields; + result->field_alloc= mysql->field_alloc; + result->field_count= mysql->field_count; + /* The rest of result members is bzeroed in malloc */ + mysql->fields=0; /* fields is now in result */ + clear_alloc_root(&mysql->field_alloc); + /* just in case this was mistakenly called after mysql_stmt_execute() */ + mysql->unbuffered_fetch_owner= 0; + DBUG_RETURN(result); /* Data fetched */ +} + + +/************************************************************************** + Alloc struct for use with unbuffered reads. Data is fetched by domand + when calling to mysql_fetch_row. + mysql_data_seek is a noop. + + No other queries may be specified with the same MYSQL handle. + There shouldn't be much processing per row because mysql server shouldn't + have to wait for the client (and will not wait more than 30 sec/packet). +**************************************************************************/ + +static MYSQL_RES * cli_use_result(MYSQL *mysql) +{ + MYSQL_RES *result; + DBUG_ENTER("cli_use_result"); + + if (!mysql->fields) + DBUG_RETURN(0); + if (mysql->status != MYSQL_STATUS_GET_RESULT) + { + set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); + DBUG_RETURN(0); + } + if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+ + sizeof(ulong)*mysql->field_count, + MYF(MY_WME | MY_ZEROFILL)))) + DBUG_RETURN(0); + result->lengths=(ulong*) (result+1); + result->methods= mysql->methods; + if (!(result->row=(MYSQL_ROW) + my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME)))) + { /* Ptrs: to one row */ + my_free((uchar*) result,MYF(0)); + DBUG_RETURN(0); + } + result->fields= mysql->fields; + result->field_alloc= mysql->field_alloc; + result->field_count= mysql->field_count; + result->current_field=0; + result->handle= mysql; + result->current_row= 0; + mysql->fields=0; /* fields is now in result */ + clear_alloc_root(&mysql->field_alloc); + mysql->status=MYSQL_STATUS_USE_RESULT; + mysql->unbuffered_fetch_owner= &result->unbuffered_fetch_cancelled; + DBUG_RETURN(result); /* Data is read to be fetched */ +} + + +/************************************************************************** + Return next row of the query results +**************************************************************************/ + +MYSQL_ROW STDCALL +mysql_fetch_row(MYSQL_RES *res) +{ + DBUG_ENTER("mysql_fetch_row"); + if (!res->data) + { /* Unbufferred fetch */ + if (!res->eof) + { + MYSQL *mysql= res->handle; + if (mysql->status != MYSQL_STATUS_USE_RESULT) + { + set_mysql_error(mysql, + res->unbuffered_fetch_cancelled ? + CR_FETCH_CANCELED : CR_COMMANDS_OUT_OF_SYNC, + unknown_sqlstate); + } + else if (!(read_one_row(mysql, res->field_count, res->row, res->lengths))) + { + res->row_count++; + DBUG_RETURN(res->current_row=res->row); + } + DBUG_PRINT("info",("end of data")); + res->eof=1; + mysql->status=MYSQL_STATUS_READY; + /* + Reset only if owner points to us: there is a chance that somebody + started new query after mysql_stmt_close(): + */ + if (mysql->unbuffered_fetch_owner == &res->unbuffered_fetch_cancelled) + mysql->unbuffered_fetch_owner= 0; + /* Don't clear handle in mysql_free_result */ + res->handle=0; + } + DBUG_RETURN((MYSQL_ROW) NULL); + } + { + MYSQL_ROW tmp; + if (!res->data_cursor) + { + DBUG_PRINT("info",("end of data")); + DBUG_RETURN(res->current_row=(MYSQL_ROW) NULL); + } + tmp = res->data_cursor->data; + res->data_cursor = res->data_cursor->next; + DBUG_RETURN(res->current_row=tmp); + } +} + + +/************************************************************************** + Get column lengths of the current row + If one uses mysql_use_result, res->lengths contains the length information, + else the lengths are calculated from the offset between pointers. +**************************************************************************/ + +ulong * STDCALL +mysql_fetch_lengths(MYSQL_RES *res) +{ + MYSQL_ROW column; + + if (!(column=res->current_row)) + return 0; /* Something is wrong */ + if (res->data) + (*res->methods->fetch_lengths)(res->lengths, column, res->field_count); + return res->lengths; +} + + +int STDCALL +mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) +{ + DBUG_ENTER("mysql_option"); + DBUG_PRINT("enter",("option: %d",(int) option)); + switch (option) { + case MYSQL_OPT_CONNECT_TIMEOUT: + mysql->options.connect_timeout= *(uint*) arg; + break; + case MYSQL_OPT_READ_TIMEOUT: + mysql->options.read_timeout= *(uint*) arg; + break; + case MYSQL_OPT_WRITE_TIMEOUT: + mysql->options.write_timeout= *(uint*) arg; + break; + case MYSQL_OPT_COMPRESS: + mysql->options.compress= 1; /* Remember for connect */ + mysql->options.client_flag|= CLIENT_COMPRESS; + break; + case MYSQL_OPT_NAMED_PIPE: /* This option is depricated */ + mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */ + break; + case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ + if (!arg || test(*(uint*) arg)) + mysql->options.client_flag|= CLIENT_LOCAL_FILES; + else + mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; + break; + case MYSQL_INIT_COMMAND: + add_init_command(&mysql->options,arg); + break; + case MYSQL_READ_DEFAULT_FILE: + my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); + mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME)); + break; + case MYSQL_READ_DEFAULT_GROUP: + my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); + mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME)); + break; + case MYSQL_SET_CHARSET_DIR: + my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR)); + mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME)); + break; + case MYSQL_SET_CHARSET_NAME: + my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR)); + mysql->options.charset_name=my_strdup(arg,MYF(MY_WME)); + break; + case MYSQL_OPT_PROTOCOL: + mysql->options.protocol= *(uint*) arg; + break; + case MYSQL_SHARED_MEMORY_BASE_NAME: +#ifdef HAVE_SMEM + if (mysql->options.shared_memory_base_name != def_shared_memory_base_name) + my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); + mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME)); +#endif + break; + case MYSQL_OPT_USE_REMOTE_CONNECTION: + case MYSQL_OPT_USE_EMBEDDED_CONNECTION: + case MYSQL_OPT_GUESS_CONNECTION: + mysql->options.methods_to_use= option; + break; + case MYSQL_SET_CLIENT_IP: + mysql->options.client_ip= my_strdup(arg, MYF(MY_WME)); + break; + case MYSQL_SECURE_AUTH: + mysql->options.secure_auth= *(my_bool *) arg; + break; + case MYSQL_REPORT_DATA_TRUNCATION: + mysql->options.report_data_truncation= test(*(my_bool *) arg); + break; + case MYSQL_OPT_RECONNECT: + mysql->reconnect= *(my_bool *) arg; + break; + case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: + if (*(my_bool*) arg) + mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT; + else + mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT; + break; + default: + DBUG_RETURN(1); + } + DBUG_RETURN(0); +} + + +/**************************************************************************** + Functions to get information from the MySQL structure + These are functions to make shared libraries more usable. +****************************************************************************/ + +/* MYSQL_RES */ +my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res) +{ + return res->row_count; +} + +unsigned int STDCALL mysql_num_fields(MYSQL_RES *res) +{ + return res->field_count; +} + +uint STDCALL mysql_errno(MYSQL *mysql) +{ + return mysql ? mysql->net.last_errno : mysql_server_last_errno; +} + + +const char * STDCALL mysql_error(MYSQL *mysql) +{ + return mysql ? mysql->net.last_error : mysql_server_last_error; +} + + +/* + Get version number for server in a form easy to test on + + SYNOPSIS + mysql_get_server_version() + mysql Connection + + EXAMPLE + 4.1.0-alfa -> 40100 + + NOTES + We will ensure that a newer server always has a bigger number. + + RETURN + Signed number > 323000 +*/ + +ulong STDCALL +mysql_get_server_version(MYSQL *mysql) +{ + uint major, minor, version; + char *pos= mysql->server_version, *end_pos; + major= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1; + minor= (uint) strtoul(pos, &end_pos, 10); pos=end_pos+1; + version= (uint) strtoul(pos, &end_pos, 10); + return (ulong) major*10000L+(ulong) (minor*100+version); +} + + +/* + mysql_set_character_set function sends SET NAMES cs_name to + the server (which changes character_set_client, character_set_result + and character_set_connection) and updates mysql->charset so other + functions like mysql_real_escape will work correctly. +*/ +int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name) +{ + struct charset_info_st *cs; + const char *save_csdir= charsets_dir; + + if (mysql->options.charset_dir) + charsets_dir= mysql->options.charset_dir; + + if (strlen(cs_name) < MY_CS_NAME_SIZE && + (cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0)))) + { + char buff[MY_CS_NAME_SIZE + 10]; + charsets_dir= save_csdir; + /* Skip execution of "SET NAMES" for pre-4.1 servers */ + if (mysql_get_server_version(mysql) < 40100) + return 0; + sprintf(buff, "SET NAMES %s", cs_name); + if (!mysql_real_query(mysql, buff, strlen(buff))) + { + mysql->charset= cs; + } + } + else + { + char cs_dir_name[FN_REFLEN]; + get_charsets_dir(cs_dir_name); + set_mysql_extended_error(mysql, CR_CANT_READ_CHARSET, unknown_sqlstate, + ER(CR_CANT_READ_CHARSET), cs_name, cs_dir_name); + } + charsets_dir= save_csdir; + return mysql->net.last_errno; +} + + diff --git a/externals/mysql/libmysql/client_settings.h b/externals/mysql/libmysql/client_settings.h new file mode 100644 index 0000000..ec63f49 --- /dev/null +++ b/externals/mysql/libmysql/client_settings.h @@ -0,0 +1,73 @@ +/* Copyright (C) 2003-2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +extern uint mysql_port; +extern char * mysql_unix_port; + +#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | \ + CLIENT_LONG_FLAG | \ + CLIENT_TRANSACTIONS | \ + CLIENT_PROTOCOL_41 | \ + CLIENT_SECURE_CONNECTION | \ + CLIENT_MULTI_RESULTS | \ + CLIENT_PS_MULTI_RESULTS) + +sig_handler my_pipe_sig_handler(int sig); +void read_user_name(char *name); +my_bool handle_local_infile(MYSQL *mysql, const char *net_filename); + +/* + Let the user specify that we don't want SIGPIPE; This doesn't however work + with threaded applications as we can have multiple read in progress. +*/ + +#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD) +#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0; +#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE, my_pipe_sig_handler) +#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler); +#else +#define init_sigpipe_variables +#define set_sigpipe(mysql) +#define reset_sigpipe(mysql) +#endif + +void mysql_read_default_options(struct st_mysql_options *options, + const char *filename,const char *group); +void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name); +MYSQL * STDCALL +cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user, + const char *passwd, const char *db, + uint port, const char *unix_socket,ulong client_flag); + +void cli_mysql_close(MYSQL *mysql); + +MYSQL_FIELD * cli_list_fields(MYSQL *mysql); +my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt); +MYSQL_DATA * cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, + uint fields); +int cli_stmt_execute(MYSQL_STMT *stmt); +int cli_read_binary_rows(MYSQL_STMT *stmt); +int cli_unbuffered_fetch(MYSQL *mysql, char **row); +const char * cli_read_statistics(MYSQL *mysql); +int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd); + +#ifdef EMBEDDED_LIBRARY +int init_embedded_server(int argc, char **argv, char **groups); +void end_embedded_server(); +#endif /*EMBEDDED_LIBRARY*/ + +C_MODE_START +extern int mysql_init_character_set(MYSQL *mysql); +C_MODE_END diff --git a/externals/mysql/libmysql/conf_to_src.c b/externals/mysql/libmysql/conf_to_src.c new file mode 100644 index 0000000..785e3ca --- /dev/null +++ b/externals/mysql/libmysql/conf_to_src.c @@ -0,0 +1,145 @@ +/* Copyright (C) 2000-2004 MySQL AB + + 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. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* can't use -lmysys because this prog is used to create -lstrings */ + + +#include +#include +#include +#include + +#define CHARSETS_SUBDIR "sql/share/charsets" +#define CTYPE_TABLE_SIZE 257 +#define TO_LOWER_TABLE_SIZE 256 +#define TO_UPPER_TABLE_SIZE 256 +#define SORT_ORDER_TABLE_SIZE 256 +#define ROW_LEN 16 + +void print_arrays_for(char *set); + +char *prog; +char buf[1024], *p, *endptr; + +int +main(int argc, char **argv) +{ + prog = *argv; + + if (argc < 2) { + fprintf(stderr, "usage: %s source-dir [charset [, charset]]\n", prog); + exit(EXIT_FAILURE); + } + + --argc; ++argv; /* skip program name */ + + if (chdir(*argv) != 0) { + fprintf(stderr, "%s: can't cd to %s\n", prog, *argv); + exit(EXIT_FAILURE); + } + --argc; ++argv; + + if (chdir(CHARSETS_SUBDIR) != 0) { + fprintf(stderr, "%s: can't cd to %s\n", prog, CHARSETS_SUBDIR); + exit(EXIT_FAILURE); + } + + while (argc--) + print_arrays_for(*argv++); + + exit(EXIT_SUCCESS); +} + +void +print_array(FILE *f, const char *set, const char *name, int n) +{ + int i; + char val[100]; + + printf("uchar %s_%s[] = {\n", name, set); + + p = buf; + *buf = '\0'; + for (i = 0; i < n; ++i) + { + /* get a word from f */ + endptr = p; + for (;;) + { + while (isspace(*endptr)) + ++endptr; + if (*endptr && *endptr != '#') /* not comment */ + break; + if ((fgets(buf, sizeof(buf), f)) == NULL) + return; /* XXX: break silently */ + endptr = buf; + } + + p = val; + while (!isspace(*endptr)) + *p++ = *endptr++; + *p = '\0'; + p = endptr; + + /* write the value out */ + + if (i == 0 || i % ROW_LEN == n % ROW_LEN) + printf(" "); + + printf("%3d", (unsigned char) strtol(val, (char **) NULL, 16)); + + if (i < n - 1) + printf(","); + + if ((i+1) % ROW_LEN == n % ROW_LEN) + printf("\n"); + } + + printf("};\n\n"); +} + +void +print_arrays_for(char *set) +{ + FILE *f; + + sprintf(buf, "%s.conf", set); + + if ((f = fopen(buf, "r")) == NULL) { + fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set); + exit(EXIT_FAILURE); + } + + printf("\ +/* The %s character set. Generated automatically by configure and\n\ + * the %s program\n\ + */\n\n", + set, prog); + + /* it would be nice if this used the code in mysys/charset.c, but... */ + print_array(f, set, "ctype", CTYPE_TABLE_SIZE); + print_array(f, set, "to_lower", TO_LOWER_TABLE_SIZE); + print_array(f, set, "to_upper", TO_UPPER_TABLE_SIZE); + print_array(f, set, "sort_order", SORT_ORDER_TABLE_SIZE); + printf("\n"); + + fclose(f); + + return; +} diff --git a/externals/mysql/libmysql/errmsg.c b/externals/mysql/libmysql/errmsg.c new file mode 100644 index 0000000..abdf653 --- /dev/null +++ b/externals/mysql/libmysql/errmsg.c @@ -0,0 +1,255 @@ +/* Copyright (C) 2000-2004 MySQL AB + + 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. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Error messages for MySQL clients */ +/* (Error messages for the daemon are in share/language/errmsg.sys) */ + +#include +#include +#include "errmsg.h" + +#ifdef GERMAN +const char *client_errors[]= +{ + "Unbekannter MySQL Fehler", + "Kann UNIX-Socket nicht anlegen (%d)", + "Keine Verbindung zu lokalem MySQL Server, socket: '%-.100s' (%d)", + "Keine Verbindung zu MySQL Server auf %-.100s (%d)", + "Kann TCP/IP-Socket nicht anlegen (%d)", + "Unbekannter MySQL Server Host (%-.100s) (%d)", + "MySQL Server nicht vorhanden", + "Protokolle ungleich; Server Version = %d, Client Version = %d", + "MySQL client ran out of memory", + "Wrong host info", + "Localhost via UNIX socket", + "%-.100s via TCP/IP", + "Error in server handshake", + "Lost connection to MySQL server during query", + "Commands out of sync; you can't run this command now", + "Verbindung ueber Named Pipe: %-.32s", + "Kann nicht auf Named Pipe warten. Host: %-.64s pipe: %-.32s (%lu)", + "Kann Named Pipe nicht oeffnen. Host: %-.64s pipe: %-.32s (%lu)", + "Kann den Status der Named Pipe nicht setzen. Host: %-.64s pipe: %-.32s (%lu)", + "Can't initialize character set %-.32s (path: %-.100s)", + "Got packet bigger than 'max_allowed_packet' bytes", + "Embedded server", + "Error on SHOW SLAVE STATUS:", + "Error on SHOW SLAVE HOSTS:", + "Error connecting to slave:", + "Error connecting to master:", + "SSL connection error", + "Malformed packet", + "This client library is licensed only for use with MySQL servers having '%s' license", + "Invalid use of null pointer", + "Statement not prepared", + "No data supplied for parameters in prepared statement", + "Data truncated", + "No parameters exist in the statement", + "Invalid parameter number", + "Can't send long data for non-string/non-binary data types (parameter: %d)", + "Using unsupported buffer type: %d (parameter: %d)", + "Shared memory: %-.100s", + "Can't open shared memory; client could not create request event (%lu)", + "Can't open shared memory; no answer event received from server (%lu)", + "Can't open shared memory; server could not allocate file mapping (%lu)", + "Can't open shared memory; server could not get pointer to file mapping (%lu)", + "Can't open shared memory; client could not allocate file mapping (%lu)", + "Can't open shared memory; client could not get pointer to file mapping (%lu)", + "Can't open shared memory; client could not create %s event (%lu)", + "Can't open shared memory; no answer from server (%lu)", + "Can't open shared memory; cannot send request event to server (%lu)", + "Wrong or unknown protocol", + "Invalid connection handle", + "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)", + "Row retrieval was canceled by mysql_stmt_close() call", + "Attempt to read column without prior row fetch", + "Prepared statement contains no metadata", + "Attempt to read a row while there is no result set associated with the statement", + "This feature is not implemented yet", + "Lost connection to MySQL server at '%s', system error: %d", + "Statement closed indirectly because of a preceeding %s() call", + "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", + "This handle is already connected. Use a separate handle for each connection." + "" +}; + +/* Start of code added by Roberto M. Serqueira - martinsc@uol.com.br - 05.24.2001 */ + +#elif defined PORTUGUESE +const char *client_errors[]= +{ + "Erro desconhecido do MySQL", + "Năo pode criar 'UNIX socket' (%d)", + "Năo pode se conectar ao servidor MySQL local através do 'socket' '%-.100s' (%d)", + "Năo pode se conectar ao servidor MySQL em '%-.100s' (%d)", + "Năo pode criar 'socket TCP/IP' (%d)", + "'Host' servidor MySQL '%-.100s' (%d) desconhecido", + "Servidor MySQL desapareceu", + "Incompatibilidade de protocolos; versăo do servidor = %d, versăo do cliente = %d", + "Cliente do MySQL com falta de memória", + "Informaçăo inválida de 'host'", + "Localhost via 'UNIX socket'", + "%-.100s via 'TCP/IP'", + "Erro na negociaçăo de acesso ao servidor", + "Conexăo perdida com servidor MySQL durante 'query'", + "Comandos fora de sincronismo; vocę năo pode executar este comando agora", + "Named pipe: %-.32s", + "Năo pode esperar pelo 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", + "Năo pode abrir 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", + "Năo pode estabelecer o estado do 'named pipe' para o 'host' %-.64s - 'pipe' %-.32s (%lu)", + "Năo pode inicializar conjunto de caracteres %-.32s (caminho %-.100s)", + "Obteve pacote maior do que 'max_allowed_packet' bytes", + "Embedded server" + "Error on SHOW SLAVE STATUS:", + "Error on SHOW SLAVE HOSTS:", + "Error connecting to slave:", + "Error connecting to master:", + "SSL connection error", + "Malformed packet", + "This client library is licensed only for use with MySQL servers having '%s' license", + "Invalid use of null pointer", + "Statement not prepared", + "No data supplied for parameters in prepared statement", + "Data truncated", + "No parameters exist in the statement", + "Invalid parameter number", + "Can't send long data for non-string/non-binary data types (parameter: %d)", + "Using unsupported buffer type: %d (parameter: %d)", + "Shared memory: %-.100s", + "Can't open shared memory; client could not create request event (%lu)", + "Can't open shared memory; no answer event received from server (%lu)", + "Can't open shared memory; server could not allocate file mapping (%lu)", + "Can't open shared memory; server could not get pointer to file mapping (%lu)", + "Can't open shared memory; client could not allocate file mapping (%lu)", + "Can't open shared memory; client could not get pointer to file mapping (%lu)", + "Can't open shared memory; client could not create %s event (%lu)", + "Can't open shared memory; no answer from server (%lu)", + "Can't open shared memory; cannot send request event to server (%lu)", + "Wrong or unknown protocol", + "Invalid connection handle", + "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)", + "Row retrieval was canceled by mysql_stmt_close() call", + "Attempt to read column without prior row fetch", + "Prepared statement contains no metadata", + "Attempt to read a row while there is no result set associated with the statement", + "This feature is not implemented yet", + "Lost connection to MySQL server at '%s', system error: %d", + "Statement closed indirectly because of a preceeding %s() call", + "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", + "This handle is already connected. Use a separate handle for each connection." + "" +}; + +#else /* ENGLISH */ +const char *client_errors[]= +{ + "Unknown MySQL error", + "Can't create UNIX socket (%d)", + "Can't connect to local MySQL server through socket '%-.100s' (%d)", + "Can't connect to MySQL server on '%-.100s' (%d)", + "Can't create TCP/IP socket (%d)", + "Unknown MySQL server host '%-.100s' (%d)", + "MySQL server has gone away", + "Protocol mismatch; server version = %d, client version = %d", + "MySQL client ran out of memory", + "Wrong host info", + "Localhost via UNIX socket", + "%-.100s via TCP/IP", + "Error in server handshake", + "Lost connection to MySQL server during query", + "Commands out of sync; you can't run this command now", + "Named pipe: %-.32s", + "Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)", + "Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)", + "Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)", + "Can't initialize character set %-.32s (path: %-.100s)", + "Got packet bigger than 'max_allowed_packet' bytes", + "Embedded server", + "Error on SHOW SLAVE STATUS:", + "Error on SHOW SLAVE HOSTS:", + "Error connecting to slave:", + "Error connecting to master:", + "SSL connection error", + "Malformed packet", + "This client library is licensed only for use with MySQL servers having '%s' license", + "Invalid use of null pointer", + "Statement not prepared", + "No data supplied for parameters in prepared statement", + "Data truncated", + "No parameters exist in the statement", + "Invalid parameter number", + "Can't send long data for non-string/non-binary data types (parameter: %d)", + "Using unsupported buffer type: %d (parameter: %d)", + "Shared memory: %-.100s", + "Can't open shared memory; client could not create request event (%lu)", + "Can't open shared memory; no answer event received from server (%lu)", + "Can't open shared memory; server could not allocate file mapping (%lu)", + "Can't open shared memory; server could not get pointer to file mapping (%lu)", + "Can't open shared memory; client could not allocate file mapping (%lu)", + "Can't open shared memory; client could not get pointer to file mapping (%lu)", + "Can't open shared memory; client could not create %s event (%lu)", + "Can't open shared memory; no answer from server (%lu)", + "Can't open shared memory; cannot send request event to server (%lu)", + "Wrong or unknown protocol", + "Invalid connection handle", + "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)", + "Row retrieval was canceled by mysql_stmt_close() call", + "Attempt to read column without prior row fetch", + "Prepared statement contains no metadata", + "Attempt to read a row while there is no result set associated with the statement", + "This feature is not implemented yet", + "Lost connection to MySQL server at '%s', system error: %d", + "Statement closed indirectly because of a preceeding %s() call", + "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", + "This handle is already connected. Use a separate handle for each connection." + "" +}; +#endif + + +/* + Register client error messages for use with my_error(). + + SYNOPSIS + init_client_errs() + + RETURN + void +*/ + +void init_client_errs(void) +{ + (void) my_error_register(client_errors, CR_ERROR_FIRST, CR_ERROR_LAST); +} + + +/* + Unregister client error messages. + + SYNOPSIS + finish_client_errs() + + RETURN + void +*/ + +void finish_client_errs(void) +{ + (void) my_error_unregister(CR_ERROR_FIRST, CR_ERROR_LAST); +} diff --git a/externals/mysql/libmysql/get_password.c b/externals/mysql/libmysql/get_password.c new file mode 100644 index 0000000..cbe5fce --- /dev/null +++ b/externals/mysql/libmysql/get_password.c @@ -0,0 +1,220 @@ +/* Copyright (C) 2000-2004 MySQL AB + + 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. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* +** Ask for a password from tty +** This is an own file to avoid conflicts with curses +*/ +#include +#include +#include "mysql.h" +#include +#include + +#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE) +#undef HAVE_GETPASS +#endif + +#ifdef HAVE_GETPASS +#ifdef HAVE_PWD_H +#include +#endif /* HAVE_PWD_H */ +#else /* ! HAVE_GETPASS */ +#if !defined(__WIN__) && !defined(__NETWARE__) +#include +#ifdef HAVE_TERMIOS_H /* For tty-password */ +#include +#define TERMIO struct termios +#else +#ifdef HAVE_TERMIO_H /* For tty-password */ +#include +#define TERMIO struct termio +#else +#include +#define TERMIO struct sgttyb +#endif +#endif +#ifdef alpha_linux_port +#include /* QQ; Fix this in configure */ +#include +#endif +#else +#ifndef __NETWARE__ +#include +#endif /* __NETWARE__ */ +#endif /* __WIN__ */ +#endif /* HAVE_GETPASS */ + +#ifdef HAVE_GETPASSPHRASE /* For Solaris */ +#define getpass(A) getpassphrase(A) +#endif + +#if defined( __WIN__) || defined(__NETWARE__) +/* were just going to fake it here and get input from the keyboard */ + +#ifdef __NETWARE__ +#undef _getch +#undef _cputs +#define _getch getcharacter +#define _cputs(A) putstring(A) +#endif + +char *get_tty_password(const char *opt_message) +{ + char to[80]; + char *pos=to,*end=to+sizeof(to)-1; + int i=0; + DBUG_ENTER("get_tty_password"); + _cputs(opt_message ? opt_message : "Enter password: "); + for (;;) + { + char tmp; + tmp=_getch(); + if (tmp == '\b' || (int) tmp == 127) + { + if (pos != to) + { + _cputs("\b \b"); + pos--; + continue; + } + } + if (tmp == '\n' || tmp == '\r' || tmp == 3) + break; + if (iscntrl(tmp) || pos == end) + continue; + _cputs("*"); + *(pos++) = tmp; + } + while (pos != to && isspace(pos[-1]) == ' ') + pos--; /* Allow dummy space at end */ + *pos=0; + _cputs("\n"); + DBUG_RETURN(my_strdup(to,MYF(MY_FAE))); +} + +#else + +#ifndef HAVE_GETPASS +/* + Can't use fgets, because readline will get confused + length is max number of chars in to, not counting \0 + to will not include the eol characters. +*/ + +static void get_password(char *to,uint length,int fd, my_bool echo) +{ + char *pos=to,*end=to+length; + + for (;;) + { + char tmp; + if (my_read(fd,&tmp,1,MYF(0)) != 1) + break; + if (tmp == '\b' || (int) tmp == 127) + { + if (pos != to) + { + if (echo) + { + fputs("\b \b",stdout); + fflush(stdout); + } + pos--; + continue; + } + } + if (tmp == '\n' || tmp == '\r' || tmp == 3) + break; + if (iscntrl(tmp) || pos == end) + continue; + if (echo) + { + fputc('*',stdout); + fflush(stdout); + } + *(pos++) = tmp; + } + while (pos != to && isspace(pos[-1]) == ' ') + pos--; /* Allow dummy space at end */ + *pos=0; + return; +} +#endif /* ! HAVE_GETPASS */ + + +char *get_tty_password(const char *opt_message) +{ +#ifdef HAVE_GETPASS + char *passbuff; +#else /* ! HAVE_GETPASS */ + TERMIO org,tmp; +#endif /* HAVE_GETPASS */ + char buff[80]; + + DBUG_ENTER("get_tty_password"); + +#ifdef HAVE_GETPASS + passbuff = getpass(opt_message ? opt_message : "Enter password: "); + + /* copy the password to buff and clear original (static) buffer */ + strnmov(buff, passbuff, sizeof(buff) - 1); +#ifdef _PASSWORD_LEN + memset(passbuff, 0, _PASSWORD_LEN); +#endif +#else + if (isatty(fileno(stdout))) + { + fputs(opt_message ? opt_message : "Enter password: ",stdout); + fflush(stdout); + } +#if defined(HAVE_TERMIOS_H) + tcgetattr(fileno(stdin), &org); + tmp = org; + tmp.c_lflag &= ~(ECHO | ISIG | ICANON); + tmp.c_cc[VMIN] = 1; + tmp.c_cc[VTIME] = 0; + tcsetattr(fileno(stdin), TCSADRAIN, &tmp); + get_password(buff, sizeof(buff)-1, fileno(stdin), isatty(fileno(stdout))); + tcsetattr(fileno(stdin), TCSADRAIN, &org); +#elif defined(HAVE_TERMIO_H) + ioctl(fileno(stdin), (int) TCGETA, &org); + tmp=org; + tmp.c_lflag &= ~(ECHO | ISIG | ICANON); + tmp.c_cc[VMIN] = 1; + tmp.c_cc[VTIME]= 0; + ioctl(fileno(stdin),(int) TCSETA, &tmp); + get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout))); + ioctl(fileno(stdin),(int) TCSETA, &org); +#else + gtty(fileno(stdin), &org); + tmp=org; + tmp.sg_flags &= ~ECHO; + tmp.sg_flags |= RAW; + stty(fileno(stdin), &tmp); + get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout))); + stty(fileno(stdin), &org); +#endif + if (isatty(fileno(stdout))) + fputc('\n',stdout); +#endif /* HAVE_GETPASS */ + + DBUG_RETURN(my_strdup(buff,MYF(MY_FAE))); +} +#endif /*__WIN__*/ diff --git a/externals/mysql/libmysql/libmysql.c b/externals/mysql/libmysql/libmysql.c new file mode 100644 index 0000000..299a567 --- /dev/null +++ b/externals/mysql/libmysql/libmysql.c @@ -0,0 +1,4902 @@ +/* Copyright (C) 2000-2004 MySQL AB + + 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. + + There are special exceptions to the terms and conditions of the GPL as it + is applied to this software. View the full text of the exception in file + EXCEPTIONS-CLIENT in the directory of this software distribution. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include +#include +#include +#include "mysql.h" +#include "mysql_version.h" +#include "mysqld_error.h" +#include "errmsg.h" +#include +#include +#include +#include +#ifdef HAVE_PWD_H +#include +#endif +#if !defined(MSDOS) && !defined(__WIN__) +#include +#include +#include +#include +#ifdef HAVE_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#endif /* !defined(MSDOS) && !defined(__WIN__) */ +#ifdef HAVE_POLL +#include +#endif +#ifdef HAVE_SYS_UN_H +#include +#endif +#if defined(THREAD) && !defined(__WIN__) +#include /* because of signal() */ +#endif +#ifndef INADDR_NONE +#define INADDR_NONE -1 +#endif + +#include +#include "client_settings.h" + +#undef net_buffer_length +#undef max_allowed_packet + +ulong net_buffer_length=8192; +ulong max_allowed_packet= 1024L*1024L*1024L; + + +#ifdef EMBEDDED_LIBRARY +#undef net_flush +my_bool net_flush(NET *net); +#endif + +#if defined(MSDOS) || defined(__WIN__) +/* socket_errno is defined in my_global.h for all platforms */ +#define perror(A) +#else +#include +#define SOCKET_ERROR -1 +#endif /* __WIN__ */ + +/* + If allowed through some configuration, then this needs to + be changed +*/ +#define MAX_LONG_DATA_LENGTH 8192 +#define unsigned_field(A) ((A)->flags & UNSIGNED_FLAG) + +static void append_wild(char *to,char *end,const char *wild); +sig_handler my_pipe_sig_handler(int sig); + +static my_bool mysql_client_init= 0; +static my_bool org_my_init_done= 0; + + +/* + Initialize the MySQL client library + + SYNOPSIS + mysql_server_init() + + NOTES + Should be called before doing any other calls to the MySQL + client library to initialize thread specific variables etc. + It's called by mysql_init() to ensure that things will work for + old not threaded applications that doesn't call mysql_server_init() + directly. + + RETURN + 0 ok + 1 could not initialize environment (out of memory or thread keys) +*/ + +int STDCALL mysql_server_init(int argc __attribute__((unused)), + char **argv __attribute__((unused)), + char **groups __attribute__((unused))) +{ + int result= 0; + if (!mysql_client_init) + { + mysql_client_init=1; + org_my_init_done=my_init_done; + if (my_init()) /* Will init threads */ + return 1; + init_client_errs(); + if (!mysql_port) + { + mysql_port = MYSQL_PORT; +#ifndef MSDOS + { + struct servent *serv_ptr; + char *env; + + /* + if builder specifically requested a default port, use that + (even if it coincides with our factory default). + only if they didn't do we check /etc/services (and, failing + on that, fall back to the factory default of 3306). + either default can be overridden by the environment variable + MYSQL_TCP_PORT, which in turn can be overridden with command + line options. + */ + +#if MYSQL_PORT_DEFAULT == 0 + if ((serv_ptr = getservbyname("mysql", "tcp"))) + mysql_port = (uint) ntohs((ushort) serv_ptr->s_port); +#endif + if ((env = getenv("MYSQL_TCP_PORT"))) + mysql_port =(uint) atoi(env); + } +#endif + } + if (!mysql_unix_port) + { + char *env; +#ifdef __WIN__ + mysql_unix_port = (char*) MYSQL_NAMEDPIPE; +#else + mysql_unix_port = (char*) MYSQL_UNIX_ADDR; +#endif + if ((env = getenv("MYSQL_UNIX_PORT"))) + mysql_unix_port = env; + } + mysql_debug(NullS); +#if defined(SIGPIPE) && !defined(__WIN__) && !defined(__NETWARE__) + (void) signal(SIGPIPE, SIG_IGN); +#endif +#ifdef EMBEDDED_LIBRARY + if (argc > -1) + result= init_embedded_server(argc, argv, groups); +#endif + } +#ifdef THREAD + else + result= (int)my_thread_init(); /* Init if new thread */ +#endif + return result; +} + + +/* + Free all memory and resources used by the client library + + NOTES + When calling this there should not be any other threads using + the library. + + To make things simpler when used with windows dll's (which calls this + function automaticly), it's safe to call this function multiple times. +*/ + + +void STDCALL mysql_server_end() +{ + if (!mysql_client_init) + return; + +#ifdef EMBEDDED_LIBRARY + end_embedded_server(); +#endif + finish_client_errs(); + vio_end(); + + /* If library called my_init(), free memory allocated by it */ + if (!org_my_init_done) + { + my_end(0); + } + else + { + free_charsets(); + mysql_thread_end(); + } + + mysql_client_init= org_my_init_done= 0; +#ifdef EMBEDDED_SERVER + if (stderror_file) + { + fclose(stderror_file); + stderror_file= 0; + } +#endif +} + +static MYSQL_PARAMETERS mysql_internal_parameters= +{&max_allowed_packet, &net_buffer_length, 0}; + +MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void) +{ + return &mysql_internal_parameters; +} + +my_bool STDCALL mysql_thread_init() +{ +#ifdef THREAD + return my_thread_init(); +#else + return 0; +#endif +} + +void STDCALL mysql_thread_end() +{ +#ifdef THREAD + my_thread_end(); +#endif +} + + +/* + Expand wildcard to a sql string +*/ + +static void +append_wild(char *to, char *end, const char *wild) +{ + end-=5; /* Some extra */ + if (wild && wild[0]) + { + to=strmov(to," like '"); + while (*wild && to < end) + { + if (*wild == '\\' || *wild == '\'') + *to++='\\'; + *to++= *wild++; + } + if (*wild) /* Too small buffer */ + *to++='%'; /* Nicer this way */ + to[0]='\''; + to[1]=0; + } +} + + +/************************************************************************** + Init debugging if MYSQL_DEBUG environment variable is found +**************************************************************************/ + +void STDCALL +mysql_debug(const char *debug __attribute__((unused))) +{ +#ifndef DBUG_OFF + char *env; + if (debug) + { + DBUG_PUSH(debug); + } + else if ((env = getenv("MYSQL_DEBUG"))) + { + DBUG_PUSH(env); +#if !defined(_WINVER) && !defined(WINVER) + puts("\n-------------------------------------------------------"); + puts("MYSQL_DEBUG found. libmysql started with the following:"); + puts(env); + puts("-------------------------------------------------------\n"); +#else + { + char buff[80]; + buff[sizeof(buff)-1]= 0; + strxnmov(buff,sizeof(buff)-1,"libmysql: ", env, NullS); + MessageBox((HWND) 0,"Debugging variable MYSQL_DEBUG used",buff,MB_OK); + } +#endif + } +#endif +} + + +/************************************************************************** + Ignore SIGPIPE handler + ARGSUSED +**************************************************************************/ + +sig_handler +my_pipe_sig_handler(int sig __attribute__((unused))) +{ + DBUG_PRINT("info",("Hit by signal %d",sig)); +#ifdef DONT_REMEMBER_SIGNAL + (void) signal(SIGPIPE, my_pipe_sig_handler); +#endif +} + + +/************************************************************************** + Connect to sql server + If host == 0 then use localhost +**************************************************************************/ + +#ifdef USE_OLD_FUNCTIONS +MYSQL * STDCALL +mysql_connect(MYSQL *mysql,const char *host, + const char *user, const char *passwd) +{ + MYSQL *res; + mysql=mysql_init(mysql); /* Make it thread safe */ + { + DBUG_ENTER("mysql_connect"); + if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0))) + { + if (mysql->free_me) + my_free((uchar*) mysql,MYF(0)); + } + mysql->reconnect= 1; + DBUG_RETURN(res); + } +} +#endif + + +/************************************************************************** + Change user and database +**************************************************************************/ + +int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd) +{ + NET *net= &mysql->net; + ulong pkt_length; + + pkt_length= cli_safe_read(mysql); + + if (pkt_length == packet_error) + return 1; + + if (pkt_length == 1 && net->read_pos[0] == 254 && + mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + { + /* + By sending this very specific reply server asks us to send scrambled + password in old format. The reply contains scramble_323. + */ + scramble_323(buff, mysql->scramble, passwd); + if (my_net_write(net, (uchar*) buff, SCRAMBLE_LENGTH_323 + 1) || + net_flush(net)) + { + set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate); + return 1; + } + /* Read what server thinks about out new auth message report */ + if (cli_safe_read(mysql) == packet_error) + return 1; + } + return 0; +} + +my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, + const char *passwd, const char *db) +{ + char buff[USERNAME_LENGTH+SCRAMBLED_PASSWORD_CHAR_LENGTH+NAME_LEN+2]; + char *end= buff; + int rc; + CHARSET_INFO *saved_cs= mysql->charset; + + DBUG_ENTER("mysql_change_user"); + + /* Get the connection-default character set. */ + + if (mysql_init_character_set(mysql)) + { + mysql->charset= saved_cs; + DBUG_RETURN(TRUE); + } + + /* Use an empty string instead of NULL. */ + + if (!user) + user=""; + if (!passwd) + passwd=""; + + /* Store user into the buffer */ + end= strmake(end, user, USERNAME_LENGTH) + 1; + + /* write scrambled password according to server capabilities */ + if (passwd[0]) + { + if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + { + *end++= SCRAMBLE_LENGTH; + scramble(end, mysql->scramble, passwd); + end+= SCRAMBLE_LENGTH; + } + else + { + scramble_323(end, mysql->scramble, passwd); + end+= SCRAMBLE_LENGTH_323 + 1; + } + } + else + *end++= '\0'; /* empty password */ + /* Add database if needed */ + end= strmake(end, db ? db : "", NAME_LEN) + 1; + + /* Add character set number. */ + + if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) + { + /* + Character set 45 (4-byte UTF-8) is not available on servers + before version 6.0, so we need to go ahead and switch to utf8_mb3. + */ + if (mysql->charset->number == 45 && mysql->server_version[0] < '6') + int2store(end, 33); + else + int2store(end, (ushort) mysql->charset->number); + end+= 2; + } + + /* Write authentication package */ + simple_command(mysql,COM_CHANGE_USER, (uchar*) buff, (ulong) (end-buff), 1); + + rc= (*mysql->methods->read_change_user_result)(mysql, buff, passwd); + + /* + The server will close all statements no matter was the attempt + to change user successful or not. + */ + mysql_detach_stmt_list(&mysql->stmts, "mysql_change_user"); + if (rc == 0) + { + /* Free old connect information */ + my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR)); + my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR)); + + /* alloc new connect information */ + mysql->user= my_strdup(user,MYF(MY_WME)); + mysql->passwd=my_strdup(passwd,MYF(MY_WME)); + mysql->db= db ? my_strdup(db,MYF(MY_WME)) : 0; + } + else + { + mysql->charset= saved_cs; + } + + DBUG_RETURN(rc); +} + +#if defined(HAVE_GETPWUID) && defined(NO_GETPWUID_DECL) +struct passwd *getpwuid(uid_t); +char* getlogin(void); +#endif + +#if defined(__NETWARE__) +/* Default to value of USER on NetWare, if unset use "UNKNOWN_USER" */ +void read_user_name(char *name) +{ + char *str=getenv("USER"); + strmake(name, str ? str : "UNKNOWN_USER", USERNAME_LENGTH); +} + +#elif !defined(MSDOS) && ! defined(VMS) && !defined(__WIN__) + +void read_user_name(char *name) +{ + DBUG_ENTER("read_user_name"); + if (geteuid() == 0) + (void) strmov(name,"root"); /* allow use of surun */ + else + { +#ifdef HAVE_GETPWUID + struct passwd *skr; + const char *str; + if ((str=getlogin()) == NULL) + { + if ((skr=getpwuid(geteuid())) != NULL) + str=skr->pw_name; + else if (!(str=getenv("USER")) && !(str=getenv("LOGNAME")) && + !(str=getenv("LOGIN"))) + str="UNKNOWN_USER"; + } + (void) strmake(name,str,USERNAME_LENGTH); +#elif HAVE_CUSERID + (void) cuserid(name); +#else + strmov(name,"UNKNOWN_USER"); +#endif + } + DBUG_VOID_RETURN; +} + +#else /* If MSDOS || VMS */ + +void read_user_name(char *name) +{ + char *str=getenv("USER"); /* ODBC will send user variable */ + strmake(name,str ? str : "ODBC", USERNAME_LENGTH); +} + +#endif + +my_bool handle_local_infile(MYSQL *mysql, const char *net_filename) +{ + my_bool result= 1; + uint packet_length=MY_ALIGN(mysql->net.max_packet-16,IO_SIZE); + NET *net= &mysql->net; + int readcount; + void *li_ptr; /* pass state to local_infile functions */ + char *buf; /* buffer to be filled by local_infile_read */ + struct st_mysql_options *options= &mysql->options; + DBUG_ENTER("handle_local_infile"); + + /* check that we've got valid callback functions */ + if (!(options->local_infile_init && + options->local_infile_read && + options->local_infile_end && + options->local_infile_error)) + { + /* if any of the functions is invalid, set the default */ + mysql_set_local_infile_default(mysql); + } + + /* copy filename into local memory and allocate read buffer */ + if (!(buf=my_malloc(packet_length, MYF(0)))) + { + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); + DBUG_RETURN(1); + } + + /* initialize local infile (open file, usually) */ + if ((*options->local_infile_init)(&li_ptr, net_filename, + options->local_infile_userdata)) + { + (void) my_net_write(net,(const uchar*) "",0); /* Server needs one packet */ + net_flush(net); + strmov(net->sqlstate, unknown_sqlstate); + net->last_errno= + (*options->local_infile_error)(li_ptr, + net->last_error, + sizeof(net->last_error)-1); + goto err; + } + + /* read blocks of data from local infile callback */ + while ((readcount = + (*options->local_infile_read)(li_ptr, buf, + packet_length)) > 0) + { + if (my_net_write(net, (uchar*) buf, readcount)) + { + DBUG_PRINT("error", + ("Lost connection to MySQL server during LOAD DATA of local file")); + set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate); + goto err; + } + } + + /* Send empty packet to mark end of file */ + if (my_net_write(net, (const uchar*) "", 0) || net_flush(net)) + { + set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate); + goto err; + } + + if (readcount < 0) + { + net->last_errno= + (*options->local_infile_error)(li_ptr, + net->last_error, + sizeof(net->last_error)-1); + goto err; + } + + result=0; /* Ok */ + +err: + /* free up memory allocated with _init, usually */ + (*options->local_infile_end)(li_ptr); + my_free(buf, MYF(0)); + DBUG_RETURN(result); +} + + +/**************************************************************************** + Default handlers for LOAD LOCAL INFILE +****************************************************************************/ + +typedef struct st_default_local_infile +{ + int fd; + int error_num; + const char *filename; + char error_msg[LOCAL_INFILE_ERROR_LEN]; +} default_local_infile_data; + + +/* + Open file for LOAD LOCAL INFILE + + SYNOPSIS + default_local_infile_init() + ptr Store pointer to internal data here + filename File name to open. This may be in unix format ! + + + NOTES + Even if this function returns an error, the load data interface + guarantees that default_local_infile_end() is called. + + RETURN + 0 ok + 1 error +*/ + +static int default_local_infile_init(void **ptr, const char *filename, + void *userdata __attribute__ ((unused))) +{ + default_local_infile_data *data; + char tmp_name[FN_REFLEN]; + + if (!(*ptr= data= ((default_local_infile_data *) + my_malloc(sizeof(default_local_infile_data), MYF(0))))) + return 1; /* out of memory */ + + data->error_msg[0]= 0; + data->error_num= 0; + data->filename= filename; + + fn_format(tmp_name, filename, "", "", MY_UNPACK_FILENAME); + if ((data->fd = my_open(tmp_name, O_RDONLY, MYF(0))) < 0) + { + data->error_num= my_errno; + my_snprintf(data->error_msg, sizeof(data->error_msg)-1, + EE(EE_FILENOTFOUND), tmp_name, data->error_num); + return 1; + } + return 0; /* ok */ +} + + +/* + Read data for LOAD LOCAL INFILE + + SYNOPSIS + default_local_infile_read() + ptr Points to handle allocated by _init + buf Read data here + buf_len Ammount of data to read + + RETURN + > 0 number of bytes read + == 0 End of data + < 0 Error +*/ + +static int default_local_infile_read(void *ptr, char *buf, uint buf_len) +{ + int count; + default_local_infile_data*data = (default_local_infile_data *) ptr; + + if ((count= (int) my_read(data->fd, (uchar *) buf, buf_len, MYF(0))) < 0) + { + data->error_num= EE_READ; /* the errmsg for not entire file read */ + my_snprintf(data->error_msg, sizeof(data->error_msg)-1, + EE(EE_READ), + data->filename, my_errno); + } + return count; +} + + +/* + Read data for LOAD LOCAL INFILE + + SYNOPSIS + default_local_infile_end() + ptr Points to handle allocated by _init + May be NULL if _init failed! + + RETURN +*/ + +static void default_local_infile_end(void *ptr) +{ + default_local_infile_data *data= (default_local_infile_data *) ptr; + if (data) /* If not error on open */ + { + if (data->fd >= 0) + my_close(data->fd, MYF(MY_WME)); + my_free(ptr, MYF(MY_WME)); + } +} + + +/* + Return error from LOAD LOCAL INFILE + + SYNOPSIS + default_local_infile_end() + ptr Points to handle allocated by _init + May be NULL if _init failed! + error_msg Store error text here + error_msg_len Max lenght of error_msg + + RETURN + error message number +*/ + +static int +default_local_infile_error(void *ptr, char *error_msg, uint error_msg_len) +{ + default_local_infile_data *data = (default_local_infile_data *) ptr; + if (data) /* If not error on open */ + { + strmake(error_msg, data->error_msg, error_msg_len); + return data->error_num; + } + /* This can only happen if we got error on malloc of handle */ + strmov(error_msg, ER(CR_OUT_OF_MEMORY)); + return CR_OUT_OF_MEMORY; +} + + +void +mysql_set_local_infile_handler(MYSQL *mysql, + int (*local_infile_init)(void **, const char *, + void *), + int (*local_infile_read)(void *, char *, uint), + void (*local_infile_end)(void *), + int (*local_infile_error)(void *, char *, uint), + void *userdata) +{ + mysql->options.local_infile_init= local_infile_init; + mysql->options.local_infile_read= local_infile_read; + mysql->options.local_infile_end= local_infile_end; + mysql->options.local_infile_error= local_infile_error; + mysql->options.local_infile_userdata = userdata; +} + + +void mysql_set_local_infile_default(MYSQL *mysql) +{ + mysql->options.local_infile_init= default_local_infile_init; + mysql->options.local_infile_read= default_local_infile_read; + mysql->options.local_infile_end= default_local_infile_end; + mysql->options.local_infile_error= default_local_infile_error; +} + + +/************************************************************************** + Do a query. If query returned rows, free old rows. + Read data by mysql_store_result or by repeat call of mysql_fetch_row +**************************************************************************/ + +int STDCALL +mysql_query(MYSQL *mysql, const char *query) +{ + return mysql_real_query(mysql,query, (uint) strlen(query)); +} + + +/************************************************************************** + Return next field of the query results +**************************************************************************/ + +MYSQL_FIELD * STDCALL +mysql_fetch_field(MYSQL_RES *result) +{ + if (result->current_field >= result->field_count) + return(NULL); + return &result->fields[result->current_field++]; +} + + +/************************************************************************** + Move to a specific row and column +**************************************************************************/ + +void STDCALL +mysql_data_seek(MYSQL_RES *result, my_ulonglong row) +{ + MYSQL_ROWS *tmp=0; + DBUG_PRINT("info",("mysql_data_seek(%ld)",(long) row)); + if (result->data) + for (tmp=result->data->data; row-- && tmp ; tmp = tmp->next) ; + result->current_row=0; + result->data_cursor = tmp; +} + + +/************************************************************************* + put the row or field cursor one a position one got from mysql_row_tell() + This doesn't restore any data. The next mysql_fetch_row or + mysql_fetch_field will return the next row or field after the last used +*************************************************************************/ + +MYSQL_ROW_OFFSET STDCALL +mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET row) +{ + MYSQL_ROW_OFFSET return_value=result->data_cursor; + result->current_row= 0; + result->data_cursor= row; + return return_value; +} + + +MYSQL_FIELD_OFFSET STDCALL +mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET field_offset) +{ + MYSQL_FIELD_OFFSET return_value=result->current_field; + result->current_field=field_offset; + return return_value; +} + + +/***************************************************************************** + List all databases +*****************************************************************************/ + +MYSQL_RES * STDCALL +mysql_list_dbs(MYSQL *mysql, const char *wild) +{ + char buff[255]; + DBUG_ENTER("mysql_list_dbs"); + + append_wild(strmov(buff,"show databases"),buff+sizeof(buff),wild); + if (mysql_query(mysql,buff)) + DBUG_RETURN(0); + DBUG_RETURN (mysql_store_result(mysql)); +} + + +/***************************************************************************** + List all tables in a database + If wild is given then only the tables matching wild is returned +*****************************************************************************/ + +MYSQL_RES * STDCALL +mysql_list_tables(MYSQL *mysql, const char *wild) +{ + char buff[255]; + DBUG_ENTER("mysql_list_tables"); + + append_wild(strmov(buff,"show tables"),buff+sizeof(buff),wild); + if (mysql_query(mysql,buff)) + DBUG_RETURN(0); + DBUG_RETURN (mysql_store_result(mysql)); +} + + +MYSQL_FIELD *cli_list_fields(MYSQL *mysql) +{ + MYSQL_DATA *query; + if (!(query= cli_read_rows(mysql,(MYSQL_FIELD*) 0, + protocol_41(mysql) ? 8 : 6))) + return NULL; + + mysql->field_count= (uint) query->rows; + return unpack_fields(query,&mysql->field_alloc, + mysql->field_count, 1, mysql->server_capabilities); +} + + +/************************************************************************** + List all fields in a table + If wild is given then only the fields matching wild is returned + Instead of this use query: + show fields in 'table' like "wild" +**************************************************************************/ + +MYSQL_RES * STDCALL +mysql_list_fields(MYSQL *mysql, const char *table, const char *wild) +{ + MYSQL_RES *result; + MYSQL_FIELD *fields; + char buff[257],*end; + DBUG_ENTER("mysql_list_fields"); + DBUG_PRINT("enter",("table: '%s' wild: '%s'",table,wild ? wild : "")); + + end=strmake(strmake(buff, table,128)+1,wild ? wild : "",128); + free_old_query(mysql); + if (simple_command(mysql, COM_FIELD_LIST, (uchar*) buff, + (ulong) (end-buff), 1) || + !(fields= (*mysql->methods->list_fields)(mysql))) + DBUG_RETURN(NULL); + + if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES), + MYF(MY_WME | MY_ZEROFILL)))) + DBUG_RETURN(NULL); + + result->methods= mysql->methods; + result->field_alloc=mysql->field_alloc; + mysql->fields=0; + result->field_count = mysql->field_count; + result->fields= fields; + result->eof=1; + DBUG_RETURN(result); +} + +/* List all running processes (threads) in server */ + +MYSQL_RES * STDCALL +mysql_list_processes(MYSQL *mysql) +{ + MYSQL_DATA *fields; + uint field_count; + uchar *pos; + DBUG_ENTER("mysql_list_processes"); + + LINT_INIT(fields); + if (simple_command(mysql,COM_PROCESS_INFO,0,0,0)) + DBUG_RETURN(0); + free_old_query(mysql); + pos=(uchar*) mysql->net.read_pos; + field_count=(uint) net_field_length(&pos); + if (!(fields = (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*) 0, + protocol_41(mysql) ? 7 : 5))) + DBUG_RETURN(NULL); + if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0, + mysql->server_capabilities))) + DBUG_RETURN(0); + mysql->status=MYSQL_STATUS_GET_RESULT; + mysql->field_count=field_count; + DBUG_RETURN(mysql_store_result(mysql)); +} + + +#ifdef USE_OLD_FUNCTIONS +int STDCALL +mysql_create_db(MYSQL *mysql, const char *db) +{ + DBUG_ENTER("mysql_createdb"); + DBUG_PRINT("enter",("db: %s",db)); + DBUG_RETURN(simple_command(mysql,COM_CREATE_DB,db, (ulong) strlen(db),0)); +} + + +int STDCALL +mysql_drop_db(MYSQL *mysql, const char *db) +{ + DBUG_ENTER("mysql_drop_db"); + DBUG_PRINT("enter",("db: %s",db)); + DBUG_RETURN(simple_command(mysql,COM_DROP_DB,db,(ulong) strlen(db),0)); +} +#endif + + +int STDCALL +mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level) +{ + uchar level[1]; + DBUG_ENTER("mysql_shutdown"); + level[0]= (uchar) shutdown_level; + DBUG_RETURN(simple_command(mysql, COM_SHUTDOWN, level, 1, 0)); +} + + +int STDCALL +mysql_refresh(MYSQL *mysql,uint options) +{ + uchar bits[1]; + DBUG_ENTER("mysql_refresh"); + bits[0]= (uchar) options; + DBUG_RETURN(simple_command(mysql, COM_REFRESH, bits, 1, 0)); +} + + +int STDCALL +mysql_kill(MYSQL *mysql,ulong pid) +{ + uchar buff[4]; + DBUG_ENTER("mysql_kill"); + int4store(buff,pid); + DBUG_RETURN(simple_command(mysql,COM_PROCESS_KILL,buff,sizeof(buff),0)); +} + + +int STDCALL +mysql_set_server_option(MYSQL *mysql, enum enum_mysql_set_option option) +{ + uchar buff[2]; + DBUG_ENTER("mysql_set_server_option"); + int2store(buff, (uint) option); + DBUG_RETURN(simple_command(mysql, COM_SET_OPTION, buff, sizeof(buff), 0)); +} + + +int STDCALL +mysql_dump_debug_info(MYSQL *mysql) +{ + DBUG_ENTER("mysql_dump_debug_info"); + DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0)); +} + + +const char *cli_read_statistics(MYSQL *mysql) +{ + mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */ + if (!mysql->net.read_pos[0]) + { + set_mysql_error(mysql, CR_WRONG_HOST_INFO, unknown_sqlstate); + return mysql->net.last_error; + } + return (char*) mysql->net.read_pos; +} + + +const char * STDCALL +mysql_stat(MYSQL *mysql) +{ + DBUG_ENTER("mysql_stat"); + if (simple_command(mysql,COM_STATISTICS,0,0,0)) + DBUG_RETURN(mysql->net.last_error); + DBUG_RETURN((*mysql->methods->read_statistics)(mysql)); +} + + +int STDCALL +mysql_ping(MYSQL *mysql) +{ + int res; + DBUG_ENTER("mysql_ping"); + res= simple_command(mysql,COM_PING,0,0,0); + if (res == CR_SERVER_LOST && mysql->reconnect) + res= simple_command(mysql,COM_PING,0,0,0); + DBUG_RETURN(res); +} + + +const char * STDCALL +mysql_get_server_info(MYSQL *mysql) +{ + return((char*) mysql->server_version); +} + + +const char * STDCALL +mysql_get_host_info(MYSQL *mysql) +{ + return(mysql->host_info); +} + + +uint STDCALL +mysql_get_proto_info(MYSQL *mysql) +{ + return (mysql->protocol_version); +} + +const char * STDCALL +mysql_get_client_info(void) +{ + return (char*) MYSQL_SERVER_VERSION; +} + +ulong STDCALL mysql_get_client_version(void) +{ + return MYSQL_VERSION_ID; +} + +my_bool STDCALL mysql_eof(MYSQL_RES *res) +{ + return res->eof; +} + +MYSQL_FIELD * STDCALL mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr) +{ + return &(res)->fields[fieldnr]; +} + +MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res) +{ + return (res)->fields; +} + +MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res) +{ + return res->data_cursor; +} + +MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res) +{ + return (res)->current_field; +} + +/* MYSQL */ + +unsigned int STDCALL mysql_field_count(MYSQL *mysql) +{ + return mysql->field_count; +} + +my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql) +{ + return mysql->affected_rows; +} + +my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql) +{ + return mysql->insert_id; +} + +const char *STDCALL mysql_sqlstate(MYSQL *mysql) +{ + return mysql ? mysql->net.sqlstate : cant_connect_sqlstate; +} + +uint STDCALL mysql_warning_count(MYSQL *mysql) +{ + return mysql->warning_count; +} + +const char *STDCALL mysql_info(MYSQL *mysql) +{ + return mysql->info; +} + +ulong STDCALL mysql_thread_id(MYSQL *mysql) +{ + return (mysql)->thread_id; +} + +const char * STDCALL mysql_character_set_name(MYSQL *mysql) +{ + return mysql->charset->csname; +} + +void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *csinfo) +{ + csinfo->number = mysql->charset->number; + csinfo->state = mysql->charset->state; + csinfo->csname = mysql->charset->csname; + csinfo->name = mysql->charset->name; + csinfo->comment = mysql->charset->comment; + csinfo->mbminlen = mysql->charset->mbminlen; + csinfo->mbmaxlen = mysql->charset->mbmaxlen; + + if (mysql->options.charset_dir) + csinfo->dir = mysql->options.charset_dir; + else + csinfo->dir = charsets_dir; +} + +uint STDCALL mysql_thread_safe(void) +{ +#ifdef THREAD + return 1; +#else + return 0; +#endif +} + + +my_bool STDCALL mysql_embedded(void) +{ +#ifdef EMBEDDED_LIBRARY + return 1; +#else + return 0; +#endif +} + +/**************************************************************************** + Some support functions +****************************************************************************/ + +/* + Functions called my my_net_init() to set some application specific variables +*/ + +void my_net_local_init(NET *net) +{ + net->max_packet= (uint) net_buffer_length; + my_net_set_read_timeout(net, CLIENT_NET_READ_TIMEOUT); + my_net_set_write_timeout(net, CLIENT_NET_WRITE_TIMEOUT); + net->retry_count= 1; + net->max_packet_size= max(net_buffer_length, max_allowed_packet); +} + +/* + This function is used to create HEX string that you + can use in a SQL statement in of the either ways: + INSERT INTO blob_column VALUES (0xAABBCC); (any MySQL version) + INSERT INTO blob_column VALUES (X'AABBCC'); (4.1 and higher) + + The string in "from" is encoded to a HEX string. + The result is placed in "to" and a terminating null byte is appended. + + The string pointed to by "from" must be "length" bytes long. + You must allocate the "to" buffer to be at least length*2+1 bytes long. + Each character needs two bytes, and you need room for the terminating + null byte. When mysql_hex_string() returns, the contents of "to" will + be a null-terminated string. The return value is the length of the + encoded string, not including the terminating null character. + + The return value does not contain any leading 0x or a leading X' and + trailing '. The caller must supply whichever of those is desired. +*/ + +ulong STDCALL +mysql_hex_string(char *to, const char *from, ulong length) +{ + char *to0= to; + const char *end; + + for (end= from + length; from < end; from++) + { + *to++= _dig_vec_upper[((unsigned char) *from) >> 4]; + *to++= _dig_vec_upper[((unsigned char) *from) & 0x0F]; + } + *to= '\0'; + return (ulong) (to-to0); +} + +/* + Add escape characters to a string (blob?) to make it suitable for a insert + to should at least have place for length*2+1 chars + Returns the length of the to string +*/ + +ulong STDCALL +mysql_escape_string(char *to,const char *from,ulong length) +{ + return escape_string_for_mysql(default_charset_info, to, 0, from, length); +} + +ulong STDCALL +mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, + ulong length) +{ + if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) + return escape_quotes_for_mysql(mysql->charset, to, 0, from, length); + return escape_string_for_mysql(mysql->charset, to, 0, from, length); +} + +void STDCALL +myodbc_remove_escape(MYSQL *mysql,char *name) +{ + char *to; +#ifdef USE_MB + my_bool use_mb_flag=use_mb(mysql->charset); + char *end; + LINT_INIT(end); + if (use_mb_flag) + for (end=name; *end ; end++) ; +#endif + + for (to=name ; *name ; name++) + { +#ifdef USE_MB + int l; + if (use_mb_flag && (l = my_ismbchar( mysql->charset, name , end ) ) ) + { + while (l--) + *to++ = *name++; + name--; + continue; + } +#endif + if (*name == '\\' && name[1]) + name++; + *to++= *name; + } + *to=0; +} + +/******************************************************************** + Implementation of new client API for 4.1 version. + + mysql_stmt_* are real prototypes used by applications. + + To make API work in embedded library all functions performing + real I/O are prefixed with 'cli_' (abbreviated from 'Call Level + Interface'). This functions are invoked via pointers set in + MYSQL::methods structure. Embedded counterparts, prefixed with + 'emb_' reside in libmysqld/lib_sql.cc. +*********************************************************************/ + +/******************* Declarations ***********************************/ + +/* Default number of rows fetched per one COM_STMT_FETCH command. */ + +#define DEFAULT_PREFETCH_ROWS (ulong) 1 + +/* + These functions are called by function pointer MYSQL_STMT::read_row_func. + Each function corresponds to one of the read methods: + - mysql_stmt_fetch without prior mysql_stmt_store_result, + - mysql_stmt_fetch when result is stored, + - mysql_stmt_fetch when there are no rows (always returns MYSQL_NO_DATA) +*/ + +static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row); +static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row); +static int stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row); +static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row); +static int stmt_read_row_no_result_set(MYSQL_STMT *stmt, unsigned char **row); + +/* + This function is used in mysql_stmt_store_result if + STMT_ATTR_UPDATE_MAX_LENGTH attribute is set. +*/ +static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data); +static my_bool setup_one_fetch_function(MYSQL_BIND *, MYSQL_FIELD *field); + +/* Auxilary function used to reset statement handle. */ + +#define RESET_SERVER_SIDE 1 +#define RESET_LONG_DATA 2 +#define RESET_STORE_RESULT 4 +#define RESET_CLEAR_ERROR 8 + +static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags); + +/* + Maximum sizes of MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME + values stored in network buffer. +*/ + +/* 1 (length) + 2 (year) + 1 (month) + 1 (day) */ +#define MAX_DATE_REP_LENGTH 5 + +/* + 1 (length) + 1 (is negative) + 4 (day count) + 1 (hour) + + 1 (minute) + 1 (seconds) + 4 (microseconds) +*/ +#define MAX_TIME_REP_LENGTH 13 + +/* + 1 (length) + 2 (year) + 1 (month) + 1 (day) + + 1 (hour) + 1 (minute) + 1 (second) + 4 (microseconds) +*/ +#define MAX_DATETIME_REP_LENGTH 12 + +#define MAX_DOUBLE_STRING_REP_LENGTH 331 + +/* A macro to check truncation errors */ + +#define IS_TRUNCATED(value, is_unsigned, min, max, umax) \ + ((is_unsigned) ? (((value) > (umax) || (value) < 0) ? 1 : 0) : \ + (((value) > (max) || (value) < (min)) ? 1 : 0)) + +#define BIND_RESULT_DONE 1 +/* + We report truncations only if at least one of MYSQL_BIND::error + pointers is set. In this case stmt->bind_result_done |-ed with + this flag. +*/ +#define REPORT_DATA_TRUNCATION 2 + +/**************** Misc utility functions ****************************/ + +/* + Reallocate the NET package to have at least length bytes available. + + SYNPOSIS + my_realloc_str() + net The NET structure to modify. + length Ensure that net->buff has space for at least + this number of bytes. + + RETURN VALUES + 0 Success. + 1 Error, i.e. out of memory or requested packet size is bigger + than max_allowed_packet. The error code is stored in net->last_errno. +*/ + +static my_bool my_realloc_str(NET *net, ulong length) +{ + ulong buf_length= (ulong) (net->write_pos - net->buff); + my_bool res=0; + DBUG_ENTER("my_realloc_str"); + if (buf_length + length > net->max_packet) + { + res= net_realloc(net, buf_length + length); + if (res) + { + strmov(net->sqlstate, unknown_sqlstate); + strmov(net->last_error, ER(net->last_errno)); + } + net->write_pos= net->buff+ buf_length; + } + DBUG_RETURN(res); +} + + +static void stmt_clear_error(MYSQL_STMT *stmt) +{ + if (stmt->last_errno) + { + stmt->last_errno= 0; + stmt->last_error[0]= '\0'; + strmov(stmt->sqlstate, not_error_sqlstate); + } +} + +/** + Set statement error code, sqlstate, and error message + from given errcode and sqlstate. +*/ + +void set_stmt_error(MYSQL_STMT * stmt, int errcode, + const char *sqlstate, const char *err) +{ + DBUG_ENTER("set_stmt_error"); + DBUG_PRINT("enter", ("error: %d '%s'", errcode, ER(errcode))); + DBUG_ASSERT(stmt != 0); + + if (err == 0) + err= ER(errcode); + + stmt->last_errno= errcode; + strmov(stmt->last_error, ER(errcode)); + strmov(stmt->sqlstate, sqlstate); + + DBUG_VOID_RETURN; +} + + +/** + Set statement error code, sqlstate, and error message from NET. + + @param stmt a statement handle. Copy the error here. + @param net mysql->net. Source of the error. +*/ + +void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net) +{ + DBUG_ENTER("set_stmt_errmsg"); + DBUG_PRINT("enter", ("error: %d/%s '%s'", + net->last_errno, + net->sqlstate, + net->last_error)); + DBUG_ASSERT(stmt != 0); + + stmt->last_errno= net->last_errno; + if (net->last_error && net->last_error[0]) + strmov(stmt->last_error, net->last_error); + strmov(stmt->sqlstate, net->sqlstate); + + DBUG_VOID_RETURN; +} + +/* + Read and unpack server reply to COM_STMT_PREPARE command (sent from + mysql_stmt_prepare). + + SYNOPSIS + cli_read_prepare_result() + mysql connection handle + stmt statement handle + + RETURN VALUES + 0 ok + 1 error +*/ + +my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) +{ + uchar *pos; + uint field_count, param_count; + ulong packet_length; + MYSQL_DATA *fields_data; + DBUG_ENTER("cli_read_prepare_result"); + + if ((packet_length= cli_safe_read(mysql)) == packet_error) + DBUG_RETURN(1); + mysql->warning_count= 0; + + pos= (uchar*) mysql->net.read_pos; + stmt->stmt_id= uint4korr(pos+1); pos+= 5; + /* Number of columns in result set */ + field_count= uint2korr(pos); pos+= 2; + /* Number of placeholders in the statement */ + param_count= uint2korr(pos); pos+= 2; + if (packet_length >= 12) + mysql->warning_count= uint2korr(pos+1); + + if (param_count != 0) + { + MYSQL_DATA *param_data; + + /* skip parameters data: we don't support it yet */ + if (!(param_data= (*mysql->methods->read_rows)(mysql, (MYSQL_FIELD*)0, 7))) + DBUG_RETURN(1); + free_rows(param_data); + } + + if (field_count != 0) + { + if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT)) + mysql->server_status|= SERVER_STATUS_IN_TRANS; + + if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7))) + DBUG_RETURN(1); + if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root, + field_count,0, + mysql->server_capabilities))) + DBUG_RETURN(1); + } + stmt->field_count= field_count; + stmt->param_count= (ulong) param_count; + DBUG_PRINT("exit",("field_count: %u param_count: %u warning_count: %u", + field_count, param_count, (uint) mysql->warning_count)); + + DBUG_RETURN(0); +} + + +/* + Allocate memory and init prepared statement structure. + + SYNOPSIS + mysql_stmt_init() + mysql connection handle + + DESCRIPTION + This is an entry point of the new API. Returned handle stands for + a server-side prepared statement. Memory for this structure (~700 + bytes) is allocated using 'malloc'. Once created, the handle can be + reused many times. Created statement handle is bound to connection + handle provided to this call: its lifetime is limited by lifetime + of connection. + 'mysql_stmt_init()' is a pure local call, server side structure is + created only in mysql_stmt_prepare. + Next steps you may want to make: + - set a statement attribute (mysql_stmt_attr_set()), + - prepare statement handle with a query (mysql_stmt_prepare()), + - close statement handle and free its memory (mysql_stmt_close()), + - reset statement with mysql_stmt_reset() (a no-op which will + just return). + Behaviour of the rest of API calls on this statement is not defined yet + (though we're working on making each wrong call sequence return + error). + + RETURN VALUE + statement structure upon success and NULL if out of + memory +*/ + +MYSQL_STMT * STDCALL +mysql_stmt_init(MYSQL *mysql) +{ + MYSQL_STMT *stmt; + DBUG_ENTER("mysql_stmt_init"); + + if (!(stmt= (MYSQL_STMT *) my_malloc(sizeof(MYSQL_STMT), + MYF(MY_WME | MY_ZEROFILL)))) + { + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); + DBUG_RETURN(0); + } + + init_alloc_root(&stmt->mem_root, 2048, 2048); + init_alloc_root(&stmt->result.alloc, 4096, 4096); + stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS); + mysql->stmts= list_add(mysql->stmts, &stmt->list); + stmt->list.data= stmt; + stmt->state= MYSQL_STMT_INIT_DONE; + stmt->mysql= mysql; + stmt->read_row_func= stmt_read_row_no_result_set; + stmt->prefetch_rows= DEFAULT_PREFETCH_ROWS; + strmov(stmt->sqlstate, not_error_sqlstate); + /* The rest of statement members was bzeroed inside malloc */ + + DBUG_RETURN(stmt); +} + + +/* + Prepare server side statement with query. + + SYNOPSIS + mysql_stmt_prepare() + stmt statement handle + query statement to prepare + length statement length + + DESCRIPTION + Associate statement with statement handle. This is done both on + client and server sides. At this point the server parses given query + and creates an internal structure to represent it. + Next steps you may want to make: + - find out if this statement returns a result set by + calling mysql_stmt_field_count(), and get result set metadata + with mysql_stmt_result_metadata(), + - if query contains placeholders, bind input parameters to placeholders + using mysql_stmt_bind_param(), + - otherwise proceed directly to mysql_stmt_execute(). + + IMPLEMENTATION NOTES + - if this is a re-prepare of the statement, first close previous data + structure on the server and free old statement data + - then send the query to server and get back number of placeholders, + number of columns in result set (if any), and result set metadata. + At the same time allocate memory for input and output parameters + to have less checks in mysql_stmt_bind_{param, result}. + + RETURN VALUES + 0 success + !0 error +*/ + +int STDCALL +mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length) +{ + MYSQL *mysql= stmt->mysql; + DBUG_ENTER("mysql_stmt_prepare"); + + if (!mysql) + { + /* mysql can be reset in mysql_close called from mysql_reconnect */ + set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + /* + Reset the last error in any case: that would clear the statement + if the previous prepare failed. + */ + stmt->last_errno= 0; + stmt->last_error[0]= '\0'; + + if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE) + { + /* This is second prepare with another statement */ + uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */ + + if (reset_stmt_handle(stmt, RESET_LONG_DATA | RESET_STORE_RESULT)) + DBUG_RETURN(1); + /* + These members must be reset for API to + function in case of error or misuse. + */ + stmt->bind_param_done= stmt->bind_result_done= FALSE; + stmt->param_count= stmt->field_count= 0; + free_root(&stmt->mem_root, MYF(MY_KEEP_PREALLOC)); + + int4store(buff, stmt->stmt_id); + + /* + Close statement in server + + If there was a 'use' result from another statement, or from + mysql_use_result it won't be freed in mysql_stmt_free_result and + we should get 'Commands out of sync' here. + */ + stmt->state= MYSQL_STMT_INIT_DONE; + if (stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt)) + { + set_stmt_errmsg(stmt, &mysql->net); + DBUG_RETURN(1); + } + } + + if (stmt_command(mysql, COM_STMT_PREPARE, (const uchar*) query, length, stmt)) + { + set_stmt_errmsg(stmt, &mysql->net); + DBUG_RETURN(1); + } + + if ((*mysql->methods->read_prepare_result)(mysql, stmt)) + { + set_stmt_errmsg(stmt, &mysql->net); + DBUG_RETURN(1); + } + + /* + alloc_root will return valid address even in case when param_count + and field_count are zero. Thus we should never rely on stmt->bind + or stmt->params when checking for existence of placeholders or + result set. + */ + if (!(stmt->params= (MYSQL_BIND *) alloc_root(&stmt->mem_root, + sizeof(MYSQL_BIND)* + (stmt->param_count + + stmt->field_count)))) + { + set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + stmt->bind= stmt->params + stmt->param_count; + stmt->state= MYSQL_STMT_PREPARE_DONE; + DBUG_PRINT("info", ("Parameter count: %u", stmt->param_count)); + DBUG_RETURN(0); +} + +/* + Get result set metadata from reply to mysql_stmt_execute. + This is used mainly for SHOW commands, as metadata for these + commands is sent only with result set. + To be removed when all commands will fully support prepared mode. +*/ + +static void alloc_stmt_fields(MYSQL_STMT *stmt) +{ + MYSQL_FIELD *fields, *field, *end; + MEM_ROOT *alloc= &stmt->mem_root; + MYSQL *mysql= stmt->mysql; + + DBUG_ASSERT(mysql->field_count); + + stmt->field_count= mysql->field_count; + + /* + Get the field information for non-select statements + like SHOW and DESCRIBE commands + */ + if (!(stmt->fields= (MYSQL_FIELD *) alloc_root(alloc, + sizeof(MYSQL_FIELD) * + stmt->field_count)) || + !(stmt->bind= (MYSQL_BIND *) alloc_root(alloc, + sizeof(MYSQL_BIND) * + stmt->field_count))) + { + set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL); + return; + } + + for (fields= mysql->fields, end= fields+stmt->field_count, + field= stmt->fields; + field && fields < end; fields++, field++) + { + *field= *fields; /* To copy all numeric parts. */ + field->catalog= strmake_root(alloc, fields->catalog, + fields->catalog_length); + field->db= strmake_root(alloc, fields->db, fields->db_length); + field->table= strmake_root(alloc, fields->table, fields->table_length); + field->org_table= strmake_root(alloc, fields->org_table, + fields->org_table_length); + field->name= strmake_root(alloc, fields->name, fields->name_length); + field->org_name= strmake_root(alloc, fields->org_name, + fields->org_name_length); + field->def = fields->def ? strmake_root(alloc, fields->def, + fields->def_length) : 0; + field->def_length= field->def ? fields->def_length : 0; + field->extension= 0; /* Avoid dangling links. */ + field->max_length= 0; /* max_length is set in mysql_stmt_store_result() */ + } +} + + +/** + Update result set columns metadata if it was sent again in + reply to COM_STMT_EXECUTE. + + @note If the new field count is different from the original one, + an error is set and no update is performed. +*/ + +static void update_stmt_fields(MYSQL_STMT *stmt) +{ + MYSQL_FIELD *field= stmt->mysql->fields; + MYSQL_FIELD *field_end= field + stmt->field_count; + MYSQL_FIELD *stmt_field= stmt->fields; + MYSQL_BIND *my_bind= stmt->bind_result_done ? stmt->bind : 0; + + if (stmt->field_count != stmt->mysql->field_count) + { + /* + The tables used in the statement were altered, + and the query now returns a different number of columns. + There is no way to continue without reallocating the bind + array: + - if the number of columns increased, mysql_stmt_fetch() + will write beyond allocated memory + - if the number of columns decreased, some user-bound + buffers will be left unassigned without user knowing + that. + */ + set_stmt_error(stmt, CR_NEW_STMT_METADATA, unknown_sqlstate, NULL); + return; + } + + for (; field < field_end; ++field, ++stmt_field) + { + stmt_field->charsetnr= field->charsetnr; + stmt_field->length = field->length; + stmt_field->type = field->type; + stmt_field->flags = field->flags; + stmt_field->decimals = field->decimals; + if (my_bind) + { + /* Ignore return value: it should be 0 if bind_result succeeded. */ + (void) setup_one_fetch_function(my_bind++, stmt_field); + } + } +} + +/* + Returns prepared statement metadata in the form of a result set. + + SYNOPSIS + mysql_stmt_result_metadata() + stmt statement handle + + DESCRIPTION + This function should be used after mysql_stmt_execute(). + You can safely check that prepared statement has a result set by calling + mysql_stmt_field_count(): if number of fields is not zero, you can call + this function to get fields metadata. + Next steps you may want to make: + - find out number of columns in result set by calling + mysql_num_fields(res) (the same value is returned by + mysql_stmt_field_count()) + - fetch metadata for any column with mysql_fetch_field, + mysql_fetch_field_direct, mysql_fetch_fields, mysql_field_seek. + - free returned MYSQL_RES structure with mysql_free_result. + - proceed to binding of output parameters. + + RETURN + NULL statement contains no result set or out of memory. + In the latter case you can retreive error message + with mysql_stmt_error. + MYSQL_RES a result set with no rows +*/ + +MYSQL_RES * STDCALL +mysql_stmt_result_metadata(MYSQL_STMT *stmt) +{ + MYSQL_RES *result; + DBUG_ENTER("mysql_stmt_result_metadata"); + + /* + stmt->fields is only defined if stmt->field_count is not null; + stmt->field_count is initialized in prepare. + */ + if (!stmt->field_count) + DBUG_RETURN(0); + + if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result), + MYF(MY_WME | MY_ZEROFILL)))) + { + set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL); + DBUG_RETURN(0); + } + + result->methods= stmt->mysql->methods; + result->eof= 1; /* Marker for buffered */ + result->fields= stmt->fields; + result->field_count= stmt->field_count; + /* The rest of members of 'result' was bzeroed inside malloc */ + DBUG_RETURN(result); +} + + +/* + Returns parameter columns meta information in the form of + result set. + + SYNOPSYS + mysql_stmt_param_metadata() + stmt statement handle + + DESCRIPTION + This function can be called after you prepared the statement handle + with mysql_stmt_prepare(). + XXX: not implemented yet. + + RETURN + MYSQL_RES on success, 0 if there is no metadata. + Currently this function always returns 0. +*/ + +MYSQL_RES * STDCALL +mysql_stmt_param_metadata(MYSQL_STMT *stmt) +{ + DBUG_ENTER("mysql_stmt_param_metadata"); + + if (!stmt->param_count) + DBUG_RETURN(0); + + /* + TODO: Fix this when server sends the information. + Till then keep a dummy prototype. + */ + DBUG_RETURN(0); +} + + +/* Store type of parameter in network buffer. */ + +static void store_param_type(char **pos, MYSQL_BIND *param) +{ + uint typecode= param->buffer_type | (param->is_unsigned ? 32768 : 0); + int2store(*pos, typecode); + *pos+= 2; +} + + +/* + Functions to store parameter data in network packet. + + SYNOPSIS + store_param_xxx() + net MySQL NET connection + param MySQL bind param + + DESCRIPTION + These funtions are invoked from mysql_stmt_execute() by + MYSQL_BIND::store_param_func pointer. This pointer is set once per + many executions in mysql_stmt_bind_param(). The caller must ensure + that network buffer have enough capacity to store parameter + (MYSQL_BIND::buffer_length contains needed number of bytes). +*/ + +static void store_param_tinyint(NET *net, MYSQL_BIND *param) +{ + *(net->write_pos++)= *(uchar *) param->buffer; +} + +static void store_param_short(NET *net, MYSQL_BIND *param) +{ + short value= *(short*) param->buffer; + int2store(net->write_pos,value); + net->write_pos+=2; +} + +static void store_param_int32(NET *net, MYSQL_BIND *param) +{ + int32 value= *(int32*) param->buffer; + int4store(net->write_pos,value); + net->write_pos+=4; +} + +static void store_param_int64(NET *net, MYSQL_BIND *param) +{ + longlong value= *(longlong*) param->buffer; + int8store(net->write_pos,value); + net->write_pos+= 8; +} + +static void store_param_float(NET *net, MYSQL_BIND *param) +{ + float value= *(float*) param->buffer; + float4store(net->write_pos, value); + net->write_pos+= 4; +} + +static void store_param_double(NET *net, MYSQL_BIND *param) +{ + double value= *(double*) param->buffer; + float8store(net->write_pos, value); + net->write_pos+= 8; +} + +static void store_param_time(NET *net, MYSQL_BIND *param) +{ + MYSQL_TIME *tm= (MYSQL_TIME *) param->buffer; + char buff[MAX_TIME_REP_LENGTH], *pos; + uint length; + + pos= buff+1; + pos[0]= tm->neg ? 1: 0; + int4store(pos+1, tm->day); + pos[5]= (uchar) tm->hour; + pos[6]= (uchar) tm->minute; + pos[7]= (uchar) tm->second; + int4store(pos+8, tm->second_part); + if (tm->second_part) + length= 12; + else if (tm->hour || tm->minute || tm->second || tm->day) + length= 8; + else + length= 0; + buff[0]= (char) length++; + memcpy((char *)net->write_pos, buff, length); + net->write_pos+= length; +} + +static void net_store_datetime(NET *net, MYSQL_TIME *tm) +{ + char buff[MAX_DATETIME_REP_LENGTH], *pos; + uint length; + + pos= buff+1; + + int2store(pos, tm->year); + pos[2]= (uchar) tm->month; + pos[3]= (uchar) tm->day; + pos[4]= (uchar) tm->hour; + pos[5]= (uchar) tm->minute; + pos[6]= (uchar) tm->second; + int4store(pos+7, tm->second_part); + if (tm->second_part) + length= 11; + else if (tm->hour || tm->minute || tm->second) + length= 7; + else if (tm->year || tm->month || tm->day) + length= 4; + else + length= 0; + buff[0]= (char) length++; + memcpy((char *)net->write_pos, buff, length); + net->write_pos+= length; +} + +static void store_param_date(NET *net, MYSQL_BIND *param) +{ + MYSQL_TIME tm= *((MYSQL_TIME *) param->buffer); + tm.hour= tm.minute= tm.second= tm.second_part= 0; + net_store_datetime(net, &tm); +} + +static void store_param_datetime(NET *net, MYSQL_BIND *param) +{ + MYSQL_TIME *tm= (MYSQL_TIME *) param->buffer; + net_store_datetime(net, tm); +} + +static void store_param_str(NET *net, MYSQL_BIND *param) +{ + /* param->length is always set in mysql_stmt_bind_param */ + ulong length= *param->length; + uchar *to= net_store_length(net->write_pos, length); + memcpy(to, param->buffer, length); + net->write_pos= to+length; +} + + +/* + Mark if the parameter is NULL. + + SYNOPSIS + store_param_null() + net MySQL NET connection + param MySQL bind param + + DESCRIPTION + A data package starts with a string of bits where we set a bit + if a parameter is NULL. Unlike bit string in result set row, here + we don't have reserved bits for OK/error packet. +*/ + +static void store_param_null(NET *net, MYSQL_BIND *param) +{ + uint pos= param->param_number; + net->buff[pos/8]|= (uchar) (1 << (pos & 7)); +} + + +/* + Store one parameter in network packet: data is read from + client buffer and saved in network packet by means of one + of store_param_xxxx functions. +*/ + +static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param) +{ + NET *net= &stmt->mysql->net; + DBUG_ENTER("store_param"); + DBUG_PRINT("enter",("type: %d buffer: %p length: %lu is_null: %d", + param->buffer_type, + (param->buffer ? param->buffer : NullS), + *param->length, *param->is_null)); + + if (*param->is_null) + store_param_null(net, param); + else + { + /* + Param->length should ALWAYS point to the correct length for the type + Either to the length pointer given by the user or param->buffer_length + */ + if ((my_realloc_str(net, *param->length))) + { + set_stmt_errmsg(stmt, net); + DBUG_RETURN(1); + } + (*param->store_param_func)(net, param); + } + DBUG_RETURN(0); +} + + +/* + Auxilary function to send COM_STMT_EXECUTE packet to server and read reply. + Used from cli_stmt_execute, which is in turn used by mysql_stmt_execute. +*/ + +static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) +{ + MYSQL *mysql= stmt->mysql; + NET *net= &mysql->net; + uchar buff[4 /* size of stmt id */ + + 5 /* execution flags */]; + my_bool res; + DBUG_ENTER("execute"); + DBUG_DUMP("packet", (uchar *) packet, length); + + int4store(buff, stmt->stmt_id); /* Send stmt id to server */ + buff[4]= (char) stmt->flags; + int4store(buff+5, 1); /* iteration count */ + + res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), + (uchar*) packet, length, 1, stmt) || + (*mysql->methods->read_query_result)(mysql)); + stmt->affected_rows= mysql->affected_rows; + stmt->server_status= mysql->server_status; + stmt->insert_id= mysql->insert_id; + if (res) + { + set_stmt_errmsg(stmt, net); + DBUG_RETURN(1); + } + DBUG_RETURN(0); +} + + +int cli_stmt_execute(MYSQL_STMT *stmt) +{ + DBUG_ENTER("cli_stmt_execute"); + + if (stmt->param_count) + { + MYSQL *mysql= stmt->mysql; + NET *net= &mysql->net; + MYSQL_BIND *param, *param_end; + char *param_data; + ulong length; + uint null_count; + my_bool result; + + if (!stmt->bind_param_done) + { + set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + if (mysql->status != MYSQL_STATUS_READY || + mysql->server_status & SERVER_MORE_RESULTS_EXISTS) + { + set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + net_clear(net, 1); /* Sets net->write_pos */ + /* Reserve place for null-marker bytes */ + null_count= (stmt->param_count+7) /8; + if (my_realloc_str(net, null_count + 1)) + { + set_stmt_errmsg(stmt, net); + DBUG_RETURN(1); + } + bzero((char*) net->write_pos, null_count); + net->write_pos+= null_count; + param_end= stmt->params + stmt->param_count; + + /* In case if buffers (type) altered, indicate to server */ + *(net->write_pos)++= (uchar) stmt->send_types_to_server; + if (stmt->send_types_to_server) + { + if (my_realloc_str(net, 2 * stmt->param_count)) + { + set_stmt_errmsg(stmt, net); + DBUG_RETURN(1); + } + /* + Store types of parameters in first in first package + that is sent to the server. + */ + for (param= stmt->params; param < param_end ; param++) + store_param_type((char**) &net->write_pos, param); + } + + for (param= stmt->params; param < param_end; param++) + { + /* check if mysql_stmt_send_long_data() was used */ + if (param->long_data_used) + param->long_data_used= 0; /* Clear for next execute call */ + else if (store_param(stmt, param)) + DBUG_RETURN(1); + } + length= (ulong) (net->write_pos - net->buff); + /* TODO: Look into avoding the following memdup */ + if (!(param_data= my_memdup(net->buff, length, MYF(0)))) + { + set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + result= execute(stmt, param_data, length); + stmt->send_types_to_server=0; + my_free(param_data, MYF(MY_WME)); + DBUG_RETURN(result); + } + DBUG_RETURN((int) execute(stmt,0,0)); +} + +/* + Read one row from buffered result set. Result set is created by prior + call to mysql_stmt_store_result(). + SYNOPSIS + stmt_read_row_buffered() + + RETURN VALUE + 0 - success; *row is set to valid row pointer (row data + is stored in result set buffer) + MYSQL_NO_DATA - end of result set. *row is set to NULL +*/ + +static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row) +{ + if (stmt->data_cursor) + { + *row= (uchar *) stmt->data_cursor->data; + stmt->data_cursor= stmt->data_cursor->next; + return 0; + } + *row= 0; + return MYSQL_NO_DATA; +} + +/* + Read one row from network: unbuffered non-cursor fetch. + If last row was read, or error occured, erase this statement + from record pointing to object unbuffered fetch is performed from. + + SYNOPSIS + stmt_read_row_unbuffered() + stmt statement handle + row pointer to write pointer to row data; + + RETURN VALUE + 0 - success; *row contains valid address of a row; + row data is stored in network buffer + 1 - error; error code is written to + stmt->last_{errno,error}; *row is not changed + MYSQL_NO_DATA - end of file was read from network; + *row is set to NULL +*/ + +static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row) +{ + int rc= 1; + MYSQL *mysql= stmt->mysql; + /* + This function won't be called if stmt->field_count is zero + or execution wasn't done: this is ensured by mysql_stmt_execute. + */ + if (!mysql) + { + set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); + return 1; + } + if (mysql->status != MYSQL_STATUS_GET_RESULT) + { + set_stmt_error(stmt, stmt->unbuffered_fetch_cancelled ? + CR_FETCH_CANCELED : CR_COMMANDS_OUT_OF_SYNC, + unknown_sqlstate, NULL); + goto error; + } + if ((*mysql->methods->unbuffered_fetch)(mysql, (char**) row)) + { + set_stmt_errmsg(stmt, &mysql->net); + /* + If there was an error, there are no more pending rows: + reset statement status to not hang up in following + mysql_stmt_close (it will try to flush result set before + closing the statement). + */ + mysql->status= MYSQL_STATUS_READY; + goto error; + } + if (!*row) + { + mysql->status= MYSQL_STATUS_READY; + rc= MYSQL_NO_DATA; + goto error; + } + return 0; +error: + if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled) + mysql->unbuffered_fetch_owner= 0; + return rc; +} + + +/* + Fetch statement row using server side cursor. + + SYNOPSIS + stmt_read_row_from_cursor() + + RETURN VALUE + 0 success + 1 error + MYSQL_NO_DATA end of data +*/ + +static int +stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row) +{ + if (stmt->data_cursor) + return stmt_read_row_buffered(stmt, row); + if (stmt->server_status & SERVER_STATUS_LAST_ROW_SENT) + stmt->server_status &= ~SERVER_STATUS_LAST_ROW_SENT; + else + { + MYSQL *mysql= stmt->mysql; + NET *net= &mysql->net; + MYSQL_DATA *result= &stmt->result; + uchar buff[4 /* statement id */ + + 4 /* number of rows to fetch */]; + + free_root(&result->alloc, MYF(MY_KEEP_PREALLOC)); + result->data= NULL; + result->rows= 0; + /* Send row request to the server */ + int4store(buff, stmt->stmt_id); + int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */ + if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH, + buff, sizeof(buff), (uchar*) 0, 0, + 1, stmt)) + { + set_stmt_errmsg(stmt, net); + return 1; + } + if ((*mysql->methods->read_rows_from_cursor)(stmt)) + return 1; + stmt->server_status= mysql->server_status; + + stmt->data_cursor= result->data; + return stmt_read_row_buffered(stmt, row); + } + *row= 0; + return MYSQL_NO_DATA; +} + + +/* + Default read row function to not SIGSEGV in client in + case of wrong sequence of API calls. +*/ + +static int +stmt_read_row_no_data(MYSQL_STMT *stmt __attribute__((unused)), + unsigned char **row __attribute__((unused))) +{ + return MYSQL_NO_DATA; +} + +static int +stmt_read_row_no_result_set(MYSQL_STMT *stmt __attribute__((unused)), + unsigned char **row __attribute__((unused))) +{ + set_stmt_error(stmt, CR_NO_RESULT_SET, unknown_sqlstate, NULL); + return 1; +} + + +/* + Get/set statement attributes + + SYNOPSIS + mysql_stmt_attr_get() + mysql_stmt_attr_set() + + attr_type statement attribute + value casted to const void * pointer to value. + + RETURN VALUE + 0 success + !0 wrong attribute type +*/ + +my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt, + enum enum_stmt_attr_type attr_type, + const void *value) +{ + switch (attr_type) { + case STMT_ATTR_UPDATE_MAX_LENGTH: + stmt->update_max_length= value ? *(const my_bool*) value : 0; + break; + case STMT_ATTR_CURSOR_TYPE: + { + ulong cursor_type; + cursor_type= value ? *(ulong*) value : 0UL; + if (cursor_type > (ulong) CURSOR_TYPE_READ_ONLY) + goto err_not_implemented; + stmt->flags= cursor_type; + break; + } + case STMT_ATTR_PREFETCH_ROWS: + { + ulong prefetch_rows= value ? *(ulong*) value : DEFAULT_PREFETCH_ROWS; + if (value == 0) + return TRUE; + stmt->prefetch_rows= prefetch_rows; + break; + } + default: + goto err_not_implemented; + } + return FALSE; +err_not_implemented: + set_stmt_error(stmt, CR_NOT_IMPLEMENTED, unknown_sqlstate, NULL); + return TRUE; +} + + +my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt, + enum enum_stmt_attr_type attr_type, + void *value) +{ + switch (attr_type) { + case STMT_ATTR_UPDATE_MAX_LENGTH: + *(my_bool*) value= stmt->update_max_length; + break; + case STMT_ATTR_CURSOR_TYPE: + *(ulong*) value= stmt->flags; + break; + case STMT_ATTR_PREFETCH_ROWS: + *(ulong*) value= stmt->prefetch_rows; + break; + default: + return TRUE; + } + return FALSE; +} + + +/** + Update statement result set metadata from with the new field + information sent during statement execute. + + @pre mysql->field_count is not zero + + @retval TRUE if error: out of memory or the new + result set has a different number of columns + @retval FALSE success +*/ + +static void reinit_result_set_metadata(MYSQL_STMT *stmt) +{ + /* Server has sent result set metadata */ + if (stmt->field_count == 0) + { + /* + This is 'SHOW'/'EXPLAIN'-like query. Current implementation of + prepared statements can't send result set metadata for these queries + on prepare stage. Read it now. + */ + alloc_stmt_fields(stmt); + } + else + { + /* + Update result set metadata if it for some reason changed between + prepare and execute, i.e.: + - in case of 'SELECT ?' we don't know column type unless data was + supplied to mysql_stmt_execute, so updated column type is sent + now. + - if data dictionary changed between prepare and execute, for + example a table used in the query was altered. + Note, that now (4.1.3) we always send metadata in reply to + COM_STMT_EXECUTE (even if it is not necessary), so either this or + previous branch always works. + TODO: send metadata only when it's really necessary and add a warning + 'Metadata changed' when it's sent twice. + */ + update_stmt_fields(stmt); + } +} + + +static void prepare_to_fetch_result(MYSQL_STMT *stmt) +{ + if (stmt->server_status & SERVER_STATUS_CURSOR_EXISTS) + { + stmt->mysql->status= MYSQL_STATUS_READY; + stmt->read_row_func= stmt_read_row_from_cursor; + } + else if (stmt->flags & CURSOR_TYPE_READ_ONLY) + { + /* + This is a single-row result set, a result set with no rows, EXPLAIN, + SHOW VARIABLES, or some other command which either a) bypasses the + cursors framework in the server and writes rows directly to the + network or b) is more efficient if all (few) result set rows are + precached on client and server's resources are freed. + */ + mysql_stmt_store_result(stmt); + } + else + { + stmt->mysql->unbuffered_fetch_owner= &stmt->unbuffered_fetch_cancelled; + stmt->unbuffered_fetch_cancelled= FALSE; + stmt->read_row_func= stmt_read_row_unbuffered; + } +} + + +/* + Send placeholders data to server (if there are placeholders) + and execute prepared statement. + + SYNOPSIS + mysql_stmt_execute() + stmt statement handle. The handle must be created + with mysql_stmt_init() and prepared with + mysql_stmt_prepare(). If there are placeholders + in the statement they must be bound to local + variables with mysql_stmt_bind_param(). + + DESCRIPTION + This function will automatically flush pending result + set (if there is one), send parameters data to the server + and read result of statement execution. + If previous result set was cached with mysql_stmt_store_result() + it will also be freed in the beginning of this call. + The server can return 3 types of responses to this command: + - error, can be retrieved with mysql_stmt_error() + - ok, no result set pending. In this case we just update + stmt->insert_id and stmt->affected_rows. + - the query returns a result set: there could be 0 .. N + rows in it. In this case the server can also send updated + result set metadata. + + Next steps you may want to make: + - find out if there is result set with mysql_stmt_field_count(). + If there is one: + - optionally, cache entire result set on client to unblock + connection with mysql_stmt_store_result() + - bind client variables to result set columns and start read rows + with mysql_stmt_fetch(). + - reset statement with mysql_stmt_reset() or close it with + mysql_stmt_close() + Otherwise: + - find out last insert id and number of affected rows with + mysql_stmt_insert_id(), mysql_stmt_affected_rows() + + RETURN + 0 success + 1 error, message can be retrieved with mysql_stmt_error(). +*/ + +int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) +{ + MYSQL *mysql= stmt->mysql; + DBUG_ENTER("mysql_stmt_execute"); + + if (!mysql) + { + /* Error is already set in mysql_detatch_stmt_list */ + DBUG_RETURN(1); + } + + if (reset_stmt_handle(stmt, RESET_STORE_RESULT | RESET_CLEAR_ERROR)) + DBUG_RETURN(1); + /* + No need to check for stmt->state: if the statement wasn't + prepared we'll get 'unknown statement handler' error from server. + */ + if (mysql->methods->stmt_execute(stmt)) + DBUG_RETURN(1); + stmt->state= MYSQL_STMT_EXECUTE_DONE; + if (mysql->field_count) + { + reinit_result_set_metadata(stmt); + prepare_to_fetch_result(stmt); + } + DBUG_RETURN(test(stmt->last_errno)); +} + + +/* + Return total parameters count in the statement +*/ + +ulong STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt) +{ + DBUG_ENTER("mysql_stmt_param_count"); + DBUG_RETURN(stmt->param_count); +} + +/* + Return total affected rows from the last statement +*/ + +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt) +{ + return stmt->affected_rows; +} + + +/* + Returns the number of result columns for the most recent query + run on this statement. +*/ + +unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt) +{ + return stmt->field_count; +} + +/* + Return last inserted id for auto_increment columns. + + SYNOPSIS + mysql_stmt_insert_id() + stmt statement handle + + DESCRIPTION + Current implementation of this call has a caveat: stmt->insert_id is + unconditionally updated from mysql->insert_id in the end of each + mysql_stmt_execute(). This works OK if mysql->insert_id contains new + value (sent in reply to mysql_stmt_execute()), otherwise stmt->insert_id + value gets undefined, as it's updated from some arbitrary value saved in + connection structure during some other call. +*/ + +my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt) +{ + return stmt->insert_id; +} + + +static my_bool int_is_null_true= 1; /* Used for MYSQL_TYPE_NULL */ +static my_bool int_is_null_false= 0; + + +/* + Set up input data buffers for a statement. + + SYNOPSIS + mysql_stmt_bind_param() + stmt statement handle + The statement must be prepared with mysql_stmt_prepare(). + my_bind Array of mysql_stmt_param_count() bind parameters. + This function doesn't check that size of this argument + is >= mysql_stmt_field_count(): it's user's responsibility. + + DESCRIPTION + Use this call after mysql_stmt_prepare() to bind user variables to + placeholders. + Each element of bind array stands for a placeholder. Placeholders + are counted from 0. For example statement + 'INSERT INTO t (a, b) VALUES (?, ?)' + contains two placeholders, and for such statement you should supply + bind array of two elements (MYSQL_BIND bind[2]). + + By properly initializing bind array you can bind virtually any + C language type to statement's placeholders: + First, it's strongly recommended to always zero-initialize entire + bind structure before setting its members. This will both shorten + your application code and make it robust to future extensions of + MYSQL_BIND structure. + Then you need to assign typecode of your application buffer to + MYSQL_BIND::buffer_type. The following typecodes with their + correspondence to C language types are supported: + MYSQL_TYPE_TINY for 8-bit integer variables. Normally it's + 'signed char' and 'unsigned char'; + MYSQL_TYPE_SHORT for 16-bit signed and unsigned variables. This + is usually 'short' and 'unsigned short'; + MYSQL_TYPE_LONG for 32-bit signed and unsigned variables. It + corresponds to 'int' and 'unsigned int' on + vast majority of platforms. On IA-32 and some + other 32-bit systems you can also use 'long' + here; + MYSQL_TYPE_LONGLONG 64-bit signed or unsigned integer. Stands for + '[unsigned] long long' on most platforms; + MYSQL_TYPE_FLOAT 32-bit floating point type, 'float' on most + systems; + MYSQL_TYPE_DOUBLE 64-bit floating point type, 'double' on most + systems; + MYSQL_TYPE_TIME broken-down time stored in MYSQL_TIME + structure + MYSQL_TYPE_DATE date stored in MYSQL_TIME structure + MYSQL_TYPE_DATETIME datetime stored in MYSQL_TIME structure See + more on how to use these types for sending + dates and times below; + MYSQL_TYPE_STRING character string, assumed to be in + character-set-client. If character set of + client is not equal to character set of + column, value for this placeholder will be + converted to destination character set before + insert. + MYSQL_TYPE_BLOB sequence of bytes. This sequence is assumed to + be in binary character set (which is the same + as no particular character set), and is never + converted to any other character set. See also + notes about supplying string/blob length + below. + MYSQL_TYPE_NULL special typecode for binding nulls. + These C/C++ types are not supported yet by the API: long double, + bool. + + As you can see from the list above, it's responsibility of + application programmer to ensure that chosen typecode properly + corresponds to host language type. For example on all platforms + where we build MySQL packages (as of MySQL 4.1.4) int is a 32-bit + type. So for int you can always assume that proper typecode is + MYSQL_TYPE_LONG (however queer it sounds, the name is legacy of the + old MySQL API). In contrary sizeof(long) can be 4 or 8 8-bit bytes, + depending on platform. + + TODO: provide client typedefs for each integer and floating point + typecode, i. e. int8, uint8, float32, etc. + + Once typecode was set, it's necessary to assign MYSQL_BIND::buffer + to point to the buffer of given type. Finally, additional actions + may be taken for some types or use cases: + + Binding integer types. + For integer types you might also need to set MYSQL_BIND::is_unsigned + member. Set it to TRUE when binding unsigned char, unsigned short, + unsigned int, unsigned long, unsigned long long. + + Binding floating point types. + For floating point types you just need to set + MYSQL_BIND::buffer_type and MYSQL_BIND::buffer. The rest of the + members should be zero-initialized. + + Binding NULLs. + You might have a column always NULL, never NULL, or sometimes + NULL. For an always NULL column set MYSQL_BIND::buffer_type to + MYSQL_TYPE_NULL. The rest of the members just need to be + zero-initialized. For never NULL columns set + MYSQL_BIND::is_null to 0, or this has already been done if you + zero-initialized the entire structure. If you set + MYSQL_TYPE::is_null to point to an application buffer of type + 'my_bool', then this buffer will be checked on each execution: + this way you can set the buffer to TRUE, or any non-0 value for + NULLs, and to FALSE or 0 for not NULL data. + + Binding text strings and sequences of bytes. + For strings, in addition to MYSQL_BIND::buffer_type and + MYSQL_BIND::buffer you need to set MYSQL_BIND::length or + MYSQL_BIND::buffer_length. If 'length' is set, 'buffer_length' + is ignored. 'buffer_length' member should be used when size of + string doesn't change between executions. If you want to vary + buffer length for each value, set 'length' to point to an + application buffer of type 'unsigned long' and set this long to + length of the string before each mysql_stmt_execute(). + + Binding dates and times. + For binding dates and times prepared statements API provides + clients with MYSQL_TIME structure. A pointer to instance of this + structure should be assigned to MYSQL_BIND::buffer whenever + MYSQL_TYPE_TIME, MYSQL_TYPE_DATE, MYSQL_TYPE_DATETIME typecodes + are used. When typecode is MYSQL_TYPE_TIME, only members + 'hour', 'minute', 'second' and 'neg' (is time offset negative) + are used. These members only will be sent to the server. + MYSQL_TYPE_DATE implies use of 'year', 'month', 'day', 'neg'. + MYSQL_TYPE_DATETIME utilizes both parts of MYSQL_TIME structure. + You don't have to set MYSQL_TIME::time_type member: it's not + used when sending data to the server, typecode information is + enough. 'second_part' member can hold microsecond precision of + time value, but now it's only supported on protocol level: you + can't store microsecond in a column, or use in temporal + calculations. However, if you send a time value with microsecond + part for 'SELECT ?', statement, you'll get it back unchanged + from the server. + + Data conversion. + If conversion from host language type to data representation, + corresponding to SQL type, is required it's done on the server. + Data truncation is possible when conversion is lossy. For + example, if you supply MYSQL_TYPE_DATETIME value out of valid + SQL type TIMESTAMP range, the same conversion will be applied as + if this value would have been sent as string in the old + protocol. TODO: document how the server will behave in case of + truncation/data loss. + + After variables were bound, you can repeatedly set/change their + values and mysql_stmt_execute() the statement. + + See also: mysql_stmt_send_long_data() for sending long text/blob + data in pieces, examples in tests/mysql_client_test.c. + Next steps you might want to make: + - execute statement with mysql_stmt_execute(), + - reset statement using mysql_stmt_reset() or reprepare it with + another query using mysql_stmt_prepare() + - close statement with mysql_stmt_close(). + + IMPLEMENTATION + The function copies given bind array to internal storage of the + statement, and sets up typecode-specific handlers to perform + serialization of bound data. This means that although you don't need + to call this routine after each assignment to bind buffers, you + need to call it each time you change parameter typecodes, or other + members of MYSQL_BIND array. + This is a pure local call. Data types of client buffers are sent + along with buffers' data at first execution of the statement. + + RETURN + 0 success + 1 error, can be retrieved with mysql_stmt_error. +*/ + +my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *my_bind) +{ + uint count=0; + MYSQL_BIND *param, *end; + DBUG_ENTER("mysql_stmt_bind_param"); + + if (!stmt->param_count) + { + if ((int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE) + { + set_stmt_error(stmt, CR_NO_PREPARE_STMT, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + DBUG_RETURN(0); + } + + /* Allocated on prepare */ + memcpy((char*) stmt->params, (char*) my_bind, + sizeof(MYSQL_BIND) * stmt->param_count); + + for (param= stmt->params, end= param+stmt->param_count; + param < end ; + param++) + { + param->param_number= count++; + param->long_data_used= 0; + + /* If param->is_null is not set, then the value can never be NULL */ + if (!param->is_null) + param->is_null= &int_is_null_false; + + /* Setup data copy functions for the different supported types */ + switch (param->buffer_type) { + case MYSQL_TYPE_NULL: + param->is_null= &int_is_null_true; + break; + case MYSQL_TYPE_TINY: + /* Force param->length as this is fixed for this type */ + param->length= ¶m->buffer_length; + param->buffer_length= 1; + param->store_param_func= store_param_tinyint; + break; + case MYSQL_TYPE_SHORT: + param->length= ¶m->buffer_length; + param->buffer_length= 2; + param->store_param_func= store_param_short; + break; + case MYSQL_TYPE_LONG: + param->length= ¶m->buffer_length; + param->buffer_length= 4; + param->store_param_func= store_param_int32; + break; + case MYSQL_TYPE_LONGLONG: + param->length= ¶m->buffer_length; + param->buffer_length= 8; + param->store_param_func= store_param_int64; + break; + case MYSQL_TYPE_FLOAT: + param->length= ¶m->buffer_length; + param->buffer_length= 4; + param->store_param_func= store_param_float; + break; + case MYSQL_TYPE_DOUBLE: + param->length= ¶m->buffer_length; + param->buffer_length= 8; + param->store_param_func= store_param_double; + break; + case MYSQL_TYPE_TIME: + param->store_param_func= store_param_time; + param->buffer_length= MAX_TIME_REP_LENGTH; + break; + case MYSQL_TYPE_DATE: + param->store_param_func= store_param_date; + param->buffer_length= MAX_DATE_REP_LENGTH; + break; + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + param->store_param_func= store_param_datetime; + param->buffer_length= MAX_DATETIME_REP_LENGTH; + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VARCHAR: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_NEWDECIMAL: + param->store_param_func= store_param_str; + /* + For variable length types user must set either length or + buffer_length. + */ + break; + default: + strmov(stmt->sqlstate, unknown_sqlstate); + sprintf(stmt->last_error, + ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), + param->buffer_type, count); + DBUG_RETURN(1); + } + /* + If param->length is not given, change it to point to buffer_length. + This way we can always use *param->length to get the length of data + */ + if (!param->length) + param->length= ¶m->buffer_length; + } + /* We have to send/resend type information to MySQL */ + stmt->send_types_to_server= TRUE; + stmt->bind_param_done= TRUE; + DBUG_RETURN(0); +} + + +/******************************************************************** + Long data implementation +*********************************************************************/ + +/* + Send long data in pieces to the server + + SYNOPSIS + mysql_stmt_send_long_data() + stmt Statement handler + param_number Parameter number (0 - N-1) + data Data to send to server + length Length of data to send (may be 0) + + DESCRIPTION + This call can be used repeatedly to send long data in pieces + for any string/binary placeholder. Data supplied for + a placeholder is saved at server side till execute, and then + used instead of value from MYSQL_BIND object. More precisely, + if long data for a parameter was supplied, MYSQL_BIND object + corresponding to this parameter is not sent to server. In the + end of execution long data states of placeholders are reset, + so next time values of such placeholders will be taken again + from MYSQL_BIND array. + The server does not reply to this call: if there was an error + in data handling (which now only can happen if server run out + of memory) it would be returned in reply to + mysql_stmt_execute(). + You should choose type of long data carefully if you care + about character set conversions performed by server when the + statement is executed. No conversion is performed at all for + MYSQL_TYPE_BLOB and other binary typecodes. For + MYSQL_TYPE_STRING and the rest of text placeholders data is + converted from client character set to character set of + connection. If these character sets are different, this + conversion may require additional memory at server, equal to + total size of supplied pieces. + + RETURN VALUES + 0 ok + 1 error +*/ + +my_bool STDCALL +mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number, + const char *data, ulong length) +{ + MYSQL_BIND *param; + DBUG_ENTER("mysql_stmt_send_long_data"); + DBUG_ASSERT(stmt != 0); + DBUG_PRINT("enter",("param no: %d data: %p, length : %ld", + param_number, data, length)); + + /* + We only need to check for stmt->param_count, if it's not null + prepare was done. + */ + if (param_number >= stmt->param_count) + { + set_stmt_error(stmt, CR_INVALID_PARAMETER_NO, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + param= stmt->params+param_number; + if (!IS_LONGDATA(param->buffer_type)) + { + /* Long data handling should be used only for string/binary types */ + strmov(stmt->sqlstate, unknown_sqlstate); + sprintf(stmt->last_error, ER(stmt->last_errno= CR_INVALID_BUFFER_USE), + param->param_number); + DBUG_RETURN(1); + } + + /* + Send long data packet if there is data or we're sending long data + for the first time. + */ + if (length || param->long_data_used == 0) + { + MYSQL *mysql= stmt->mysql; + /* Packet header: stmt id (4 bytes), param no (2 bytes) */ + uchar buff[MYSQL_LONG_DATA_HEADER]; + + int4store(buff, stmt->stmt_id); + int2store(buff + 4, param_number); + param->long_data_used= 1; + + /* + Note that we don't get any ok packet from the server in this case + This is intentional to save bandwidth. + */ + if ((*mysql->methods->advanced_command)(mysql, COM_STMT_SEND_LONG_DATA, + buff, sizeof(buff), (uchar*) data, + length, 1, stmt)) + { + set_stmt_errmsg(stmt, &mysql->net); + DBUG_RETURN(1); + } + } + DBUG_RETURN(0); +} + + +/******************************************************************** + Fetch and conversion of result set rows (binary protocol). +*********************************************************************/ + +/* + Read date, (time, datetime) value from network buffer and store it + in MYSQL_TIME structure. + + SYNOPSIS + read_binary_{date,time,datetime}() + tm MYSQL_TIME structure to fill + pos pointer to current position in network buffer. + These functions increase pos to point to the beginning of the + next column. + + Auxiliary functions to read time (date, datetime) values from network + buffer and store in MYSQL_TIME structure. Jointly used by conversion + and no-conversion fetching. +*/ + +static void read_binary_time(MYSQL_TIME *tm, uchar **pos) +{ + /* net_field_length will set pos to the first byte of data */ + uint length= net_field_length(pos); + + if (length) + { + uchar *to= *pos; + tm->neg= to[0]; + + tm->day= (ulong) sint4korr(to+1); + tm->hour= (uint) to[5]; + tm->minute= (uint) to[6]; + tm->second= (uint) to[7]; + tm->second_part= (length > 8) ? (ulong) sint4korr(to+8) : 0; + tm->year= tm->month= 0; + if (tm->day) + { + /* Convert days to hours at once */ + tm->hour+= tm->day*24; + tm->day= 0; + } + tm->time_type= MYSQL_TIMESTAMP_TIME; + + *pos+= length; + } + else + set_zero_time(tm, MYSQL_TIMESTAMP_TIME); +} + +static void read_binary_datetime(MYSQL_TIME *tm, uchar **pos) +{ + uint length= net_field_length(pos); + + if (length) + { + uchar *to= *pos; + + tm->neg= 0; + tm->year= (uint) sint2korr(to); + tm->month= (uint) to[2]; + tm->day= (uint) to[3]; + + if (length > 4) + { + tm->hour= (uint) to[4]; + tm->minute= (uint) to[5]; + tm->second= (uint) to[6]; + } + else + tm->hour= tm->minute= tm->second= 0; + tm->second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0; + tm->time_type= MYSQL_TIMESTAMP_DATETIME; + + *pos+= length; + } + else + set_zero_time(tm, MYSQL_TIMESTAMP_DATETIME); +} + +static void read_binary_date(MYSQL_TIME *tm, uchar **pos) +{ + uint length= net_field_length(pos); + + if (length) + { + uchar *to= *pos; + tm->year = (uint) sint2korr(to); + tm->month= (uint) to[2]; + tm->day= (uint) to[3]; + + tm->hour= tm->minute= tm->second= 0; + tm->second_part= 0; + tm->neg= 0; + tm->time_type= MYSQL_TIMESTAMP_DATE; + + *pos+= length; + } + else + set_zero_time(tm, MYSQL_TIMESTAMP_DATE); +} + + +/* + Convert string to supplied buffer of any type. + + SYNOPSIS + fetch_string_with_conversion() + param output buffer descriptor + value column data + length data length +*/ + +static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, + uint length) +{ + char *buffer= (char *)param->buffer; + int err= 0; + char *endptr= value + length; + + /* + This function should support all target buffer types: the rest + of conversion functions can delegate conversion to it. + */ + switch (param->buffer_type) { + case MYSQL_TYPE_NULL: /* do nothing */ + break; + case MYSQL_TYPE_TINY: + { + longlong data= my_strtoll10(value, &endptr, &err); + *param->error= (IS_TRUNCATED(data, param->is_unsigned, + INT_MIN8, INT_MAX8, UINT_MAX8) || err > 0); + *buffer= (uchar) data; + break; + } + case MYSQL_TYPE_SHORT: + { + longlong data= my_strtoll10(value, &endptr, &err); + *param->error= (IS_TRUNCATED(data, param->is_unsigned, + INT_MIN16, INT_MAX16, UINT_MAX16) || err > 0); + shortstore(buffer, (short) data); + break; + } + case MYSQL_TYPE_LONG: + { + longlong data= my_strtoll10(value, &endptr, &err); + *param->error= (IS_TRUNCATED(data, param->is_unsigned, + INT_MIN32, INT_MAX32, UINT_MAX32) || err > 0); + longstore(buffer, (int32) data); + break; + } + case MYSQL_TYPE_LONGLONG: + { + longlong data= my_strtoll10(value, &endptr, &err); + *param->error= param->is_unsigned ? err != 0 : + (err > 0 || (err == 0 && data < 0)); + longlongstore(buffer, data); + break; + } + case MYSQL_TYPE_FLOAT: + { + double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err); + float fdata= (float) data; + *param->error= (fdata != data) | test(err); + floatstore(buffer, fdata); + break; + } + case MYSQL_TYPE_DOUBLE: + { + double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err); + *param->error= test(err); + doublestore(buffer, data); + break; + } + case MYSQL_TYPE_TIME: + { + MYSQL_TIME *tm= (MYSQL_TIME *)buffer; + str_to_time(value, length, tm, &err); + *param->error= test(err); + break; + } + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + { + MYSQL_TIME *tm= (MYSQL_TIME *)buffer; + (void) str_to_datetime(value, length, tm, TIME_FUZZY_DATE, &err); + *param->error= test(err) && (param->buffer_type == MYSQL_TYPE_DATE && + tm->time_type != MYSQL_TIMESTAMP_DATE); + break; + } + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_NEWDECIMAL: + default: + { + /* + Copy column data to the buffer taking into account offset, + data length and buffer length. + */ + char *start= value + param->offset; + char *end= value + length; + ulong copy_length; + if (start < end) + { + copy_length= end - start; + /* We've got some data beyond offset: copy up to buffer_length bytes */ + if (param->buffer_length) + memcpy(buffer, start, min(copy_length, param->buffer_length)); + } + else + copy_length= 0; + if (copy_length < param->buffer_length) + buffer[copy_length]= '\0'; + *param->error= copy_length > param->buffer_length; + /* + param->length will always contain length of entire column; + number of copied bytes may be way different: + */ + *param->length= length; + break; + } + } +} + + +/* + Convert integer value to client buffer of any type. + + SYNOPSIS + fetch_long_with_conversion() + param output buffer descriptor + field column metadata + value column data +*/ + +static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, + longlong value, my_bool is_unsigned) +{ + char *buffer= (char *)param->buffer; + + switch (param->buffer_type) { + case MYSQL_TYPE_NULL: /* do nothing */ + break; + case MYSQL_TYPE_TINY: + *param->error= IS_TRUNCATED(value, param->is_unsigned, + INT_MIN8, INT_MAX8, UINT_MAX8); + *(uchar *)param->buffer= (uchar) value; + break; + case MYSQL_TYPE_SHORT: + *param->error= IS_TRUNCATED(value, param->is_unsigned, + INT_MIN16, INT_MAX16, UINT_MAX16); + shortstore(buffer, (short) value); + break; + case MYSQL_TYPE_LONG: + *param->error= IS_TRUNCATED(value, param->is_unsigned, + INT_MIN32, INT_MAX32, UINT_MAX32); + longstore(buffer, (int32) value); + break; + case MYSQL_TYPE_LONGLONG: + longlongstore(buffer, value); + *param->error= param->is_unsigned != is_unsigned && value < 0; + break; + case MYSQL_TYPE_FLOAT: + { + /* + We need to mark the local variable volatile to + workaround Intel FPU executive precision feature. + (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details) + */ + volatile float data; + if (is_unsigned) + { + data= (float) ulonglong2double(value); + *param->error= ((ulonglong) value) != ((ulonglong) data); + } + else + { + data= (float)value; + *param->error= value != ((longlong) data); + } + floatstore(buffer, data); + break; + } + case MYSQL_TYPE_DOUBLE: + { + volatile double data; + if (is_unsigned) + { + data= ulonglong2double(value); + *param->error= ((ulonglong) value) != ((ulonglong) data); + } + else + { + data= (double)value; + *param->error= value != ((longlong) data); + } + doublestore(buffer, data); + break; + } + case MYSQL_TYPE_TIME: + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_TIMESTAMP: + case MYSQL_TYPE_DATETIME: + { + int error; + value= number_to_datetime(value, (MYSQL_TIME *) buffer, TIME_FUZZY_DATE, + &error); + *param->error= test(error); + break; + } + default: + { + uchar buff[22]; /* Enough for longlong */ + uchar *end= (uchar*) longlong10_to_str(value, (char*) buff, + is_unsigned ? 10: -10); + /* Resort to string conversion which supports all typecodes */ + uint length= (uint) (end-buff); + + if (field->flags & ZEROFILL_FLAG && length < field->length && + field->length < 21) + { + bmove_upp(buff+field->length,buff+length, length); + bfill(buff, field->length - length,'0'); + length= field->length; + } + fetch_string_with_conversion(param, (char*) buff, length); + break; + } + } +} + +/* + Convert double/float column to supplied buffer of any type. + + SYNOPSIS + fetch_float_with_conversion() + param output buffer descriptor + field column metadata + value column data + type either MY_GCVT_ARG_FLOAT or MY_GCVT_ARG_DOUBLE. + Affects the maximum number of significant digits + returned by my_gcvt(). +*/ + +static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, + double value, my_gcvt_arg_type type) +{ + char *buffer= (char *)param->buffer; + double val64 = (value < 0 ? -floor(-value) : floor(value)); + + switch (param->buffer_type) { + case MYSQL_TYPE_NULL: /* do nothing */ + break; + case MYSQL_TYPE_TINY: + /* + We need to _store_ data in the buffer before the truncation check to + workaround Intel FPU executive precision feature. + (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details) + Sic: AFAIU it does not guarantee to work. + */ + if (param->is_unsigned) + *buffer= (uint8) value; + else + *buffer= (int8) value; + *param->error= val64 != (param->is_unsigned ? (double)((uint8) *buffer) : + (double)((int8) *buffer)); + break; + case MYSQL_TYPE_SHORT: + if (param->is_unsigned) + { + ushort data= (ushort) value; + shortstore(buffer, data); + } + else + { + short data= (short) value; + shortstore(buffer, data); + } + *param->error= val64 != (param->is_unsigned ? (double) (*(ushort*) buffer): + (double) (*(short*) buffer)); + break; + case MYSQL_TYPE_LONG: + if (param->is_unsigned) + { + uint32 data= (uint32) value; + longstore(buffer, data); + } + else + { + int32 data= (int32) value; + longstore(buffer, data); + } + *param->error= val64 != (param->is_unsigned ? (double) (*(uint32*) buffer): + (double) (*(int32*) buffer)); + break; + case MYSQL_TYPE_LONGLONG: + if (param->is_unsigned) + { + ulonglong data= (ulonglong) value; + longlongstore(buffer, data); + } + else + { + longlong data= (longlong) value; + longlongstore(buffer, data); + } + *param->error= val64 != (param->is_unsigned ? + ulonglong2double(*(ulonglong*) buffer) : + (double) (*(longlong*) buffer)); + break; + case MYSQL_TYPE_FLOAT: + { + float data= (float) value; + floatstore(buffer, data); + *param->error= (*(float*) buffer) != value; + break; + } + case MYSQL_TYPE_DOUBLE: + { + doublestore(buffer, value); + break; + } + default: + { + /* + Resort to fetch_string_with_conversion: this should handle + floating point -> string conversion nicely, honor all typecodes + and param->offset possibly set in mysql_stmt_fetch_column + */ + char buff[FLOATING_POINT_BUFFER]; + size_t len; + if (field->decimals >= NOT_FIXED_DEC) + len= my_gcvt(value, type, + (int) min(sizeof(buff)-1, param->buffer_length), + buff, NULL); + else + len= my_fcvt(value, (int) field->decimals, buff, NULL); + + if (field->flags & ZEROFILL_FLAG && len < field->length && + field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1) + { + bmove_upp((uchar*) buff + field->length, (uchar*) buff + len, + len); + bfill((char*) buff, field->length - len, '0'); + len= field->length; + } + fetch_string_with_conversion(param, buff, len); + + break; + } + } +} + + +/* + Fetch time/date/datetime to supplied buffer of any type + + SYNOPSIS + param output buffer descriptor + time column data +*/ + +static void fetch_datetime_with_conversion(MYSQL_BIND *param, + MYSQL_FIELD *field, + MYSQL_TIME *my_time) +{ + switch (param->buffer_type) { + case MYSQL_TYPE_NULL: /* do nothing */ + break; + case MYSQL_TYPE_DATE: + *(MYSQL_TIME *)(param->buffer)= *my_time; + *param->error= my_time->time_type != MYSQL_TIMESTAMP_DATE; + break; + case MYSQL_TYPE_TIME: + *(MYSQL_TIME *)(param->buffer)= *my_time; + *param->error= my_time->time_type != MYSQL_TIMESTAMP_TIME; + break; + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + *(MYSQL_TIME *)(param->buffer)= *my_time; + /* No error: time and date are compatible with datetime */ + break; + case MYSQL_TYPE_YEAR: + shortstore(param->buffer, my_time->year); + *param->error= 1; + break; + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + { + ulonglong value= TIME_to_ulonglong(my_time); + fetch_float_with_conversion(param, field, + ulonglong2double(value), MY_GCVT_ARG_DOUBLE); + break; + } + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_INT24: + case MYSQL_TYPE_LONG: + case MYSQL_TYPE_LONGLONG: + { + longlong value= (longlong) TIME_to_ulonglong(my_time); + fetch_long_with_conversion(param, field, value, TRUE); + break; + } + default: + { + /* + Convert time value to string and delegate the rest to + fetch_string_with_conversion: + */ + char buff[MAX_DATE_STRING_REP_LENGTH]; + uint length= my_TIME_to_str(my_time, buff); + /* Resort to string conversion */ + fetch_string_with_conversion(param, (char *)buff, length); + break; + } + } +} + + +/* + Fetch and convert result set column to output buffer. + + SYNOPSIS + fetch_result_with_conversion() + param output buffer descriptor + field column metadata + row points to a column of result set tuple in binary format + + DESCRIPTION + This is a fallback implementation of column fetch used + if column and output buffer types do not match. + Increases tuple pointer to point at the next column within the + tuple. +*/ + +static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, + uchar **row) +{ + enum enum_field_types field_type= field->type; + uint field_is_unsigned= field->flags & UNSIGNED_FLAG; + + switch (field_type) { + case MYSQL_TYPE_TINY: + { + uchar value= **row; + /* sic: we need to cast to 'signed char' as 'char' may be unsigned */ + longlong data= field_is_unsigned ? (longlong) value : + (longlong) (signed char) value; + fetch_long_with_conversion(param, field, data, 0); + *row+= 1; + break; + } + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: + { + short value= sint2korr(*row); + longlong data= field_is_unsigned ? (longlong) (unsigned short) value : + (longlong) value; + fetch_long_with_conversion(param, field, data, 0); + *row+= 2; + break; + } + case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */ + case MYSQL_TYPE_LONG: + { + int32 value= sint4korr(*row); + longlong data= field_is_unsigned ? (longlong) (uint32) value : + (longlong) value; + fetch_long_with_conversion(param, field, data, 0); + *row+= 4; + break; + } + case MYSQL_TYPE_LONGLONG: + { + longlong value= (longlong)sint8korr(*row); + fetch_long_with_conversion(param, field, value, + field->flags & UNSIGNED_FLAG); + *row+= 8; + break; + } + case MYSQL_TYPE_FLOAT: + { + float value; + float4get(value,*row); + fetch_float_with_conversion(param, field, value, MY_GCVT_ARG_FLOAT); + *row+= 4; + break; + } + case MYSQL_TYPE_DOUBLE: + { + double value; + float8get(value,*row); + fetch_float_with_conversion(param, field, value, MY_GCVT_ARG_DOUBLE); + *row+= 8; + break; + } + case MYSQL_TYPE_DATE: + { + MYSQL_TIME tm; + + read_binary_date(&tm, row); + fetch_datetime_with_conversion(param, field, &tm); + break; + } + case MYSQL_TYPE_TIME: + { + MYSQL_TIME tm; + + read_binary_time(&tm, row); + fetch_datetime_with_conversion(param, field, &tm); + break; + } + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + { + MYSQL_TIME tm; + + read_binary_datetime(&tm, row); + fetch_datetime_with_conversion(param, field, &tm); + break; + } + default: + { + ulong length= net_field_length(row); + fetch_string_with_conversion(param, (char*) *row, length); + *row+= length; + break; + } + } +} + + +/* + Functions to fetch data to application buffers without conversion. + + All functions have the following characteristics: + + SYNOPSIS + fetch_result_xxx() + param MySQL bind param + pos Row value + + DESCRIPTION + These are no-conversion functions, used in binary protocol to store + rows in application buffers. A function used only if type of binary data + is compatible with type of application buffer. + + RETURN + none +*/ + +static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field, + uchar **row) +{ + my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + uchar data= **row; + *(uchar *)param->buffer= data; + *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX8; + (*row)++; +} + +static void fetch_result_short(MYSQL_BIND *param, MYSQL_FIELD *field, + uchar **row) +{ + my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + ushort data= (ushort) sint2korr(*row); + shortstore(param->buffer, data); + *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX16; + *row+= 2; +} + +static void fetch_result_int32(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + uint32 data= (uint32) sint4korr(*row); + longstore(param->buffer, data); + *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX32; + *row+= 4; +} + +static void fetch_result_int64(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + ulonglong data= (ulonglong) sint8korr(*row); + *param->error= param->is_unsigned != field_is_unsigned && data > LONGLONG_MAX; + longlongstore(param->buffer, data); + *row+= 8; +} + +static void fetch_result_float(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + float value; + float4get(value,*row); + floatstore(param->buffer, value); + *row+= 4; +} + +static void fetch_result_double(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + double value; + float8get(value,*row); + doublestore(param->buffer, value); + *row+= 8; +} + +static void fetch_result_time(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer; + read_binary_time(tm, row); +} + +static void fetch_result_date(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer; + read_binary_date(tm, row); +} + +static void fetch_result_datetime(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer; + read_binary_datetime(tm, row); +} + +static void fetch_result_bin(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + ulong length= net_field_length(row); + ulong copy_length= min(length, param->buffer_length); + memcpy(param->buffer, (char *)*row, copy_length); + *param->length= length; + *param->error= copy_length < length; + *row+= length; +} + +static void fetch_result_str(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) +{ + ulong length= net_field_length(row); + ulong copy_length= min(length, param->buffer_length); + memcpy(param->buffer, (char *)*row, copy_length); + /* Add an end null if there is room in the buffer */ + if (copy_length != param->buffer_length) + ((uchar *)param->buffer)[copy_length]= '\0'; + *param->length= length; /* return total length */ + *param->error= copy_length < length; + *row+= length; +} + + +/* + functions to calculate max lengths for strings during + mysql_stmt_store_result() +*/ + +static void skip_result_fixed(MYSQL_BIND *param, + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) + +{ + (*row)+= param->pack_length; +} + + +static void skip_result_with_length(MYSQL_BIND *param __attribute__((unused)), + MYSQL_FIELD *field __attribute__((unused)), + uchar **row) + +{ + ulong length= net_field_length(row); + (*row)+= length; +} + + +static void skip_result_string(MYSQL_BIND *param __attribute__((unused)), + MYSQL_FIELD *field, + uchar **row) + +{ + ulong length= net_field_length(row); + (*row)+= length; + if (field->max_length < length) + field->max_length= length; +} + + +/* + Check that two field types are binary compatible i. e. + have equal representation in the binary protocol and + require client-side buffers of the same type. + + SYNOPSIS + is_binary_compatible() + type1 parameter type supplied by user + type2 field type, obtained from result set metadata + + RETURN + TRUE or FALSE +*/ + +static my_bool is_binary_compatible(enum enum_field_types type1, + enum enum_field_types type2) +{ + static const enum enum_field_types + range1[]= { MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR, MYSQL_TYPE_NULL }, + range2[]= { MYSQL_TYPE_INT24, MYSQL_TYPE_LONG, MYSQL_TYPE_NULL }, + range3[]= { MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP, MYSQL_TYPE_NULL }, + range4[]= { MYSQL_TYPE_ENUM, MYSQL_TYPE_SET, MYSQL_TYPE_TINY_BLOB, + MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_BLOB, + MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_STRING, MYSQL_TYPE_GEOMETRY, + MYSQL_TYPE_DECIMAL, MYSQL_TYPE_NULL }; + static const enum enum_field_types + *range_list[]= { range1, range2, range3, range4 }, + **range_list_end= range_list + sizeof(range_list)/sizeof(*range_list); + const enum enum_field_types **range, *type; + + if (type1 == type2) + return TRUE; + for (range= range_list; range != range_list_end; ++range) + { + /* check that both type1 and type2 are in the same range */ + my_bool type1_found= FALSE, type2_found= FALSE; + for (type= *range; *type != MYSQL_TYPE_NULL; type++) + { + type1_found|= type1 == *type; + type2_found|= type2 == *type; + } + if (type1_found || type2_found) + return type1_found && type2_found; + } + return FALSE; +} + + +/* + Setup a fetch function for one column of a result set. + + SYNOPSIS + setup_one_fetch_function() + param output buffer descriptor + field column descriptor + + DESCRIPTION + When user binds result set buffers or when result set + metadata is changed, we need to setup fetch (and possibly + conversion) functions for all columns of the result set. + In addition to that here we set up skip_result function, used + to update result set metadata in case when + STMT_ATTR_UPDATE_MAX_LENGTH attribute is set. + Notice that while fetch_result is chosen depending on both + field->type and param->type, skip_result depends on field->type + only. + + RETURN + TRUE fetch function for this typecode was not found (typecode + is not supported by the client library) + FALSE success +*/ + +static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field) +{ + DBUG_ENTER("setup_one_fetch_function"); + + /* Setup data copy functions for the different supported types */ + switch (param->buffer_type) { + case MYSQL_TYPE_NULL: /* for dummy binds */ + /* + It's not binary compatible with anything the server can return: + no need to setup fetch_result, as it'll be reset anyway + */ + *param->length= 0; + break; + case MYSQL_TYPE_TINY: + param->fetch_result= fetch_result_tinyint; + *param->length= 1; + break; + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_YEAR: + param->fetch_result= fetch_result_short; + *param->length= 2; + break; + case MYSQL_TYPE_INT24: + case MYSQL_TYPE_LONG: + param->fetch_result= fetch_result_int32; + *param->length= 4; + break; + case MYSQL_TYPE_LONGLONG: + param->fetch_result= fetch_result_int64; + *param->length= 8; + break; + case MYSQL_TYPE_FLOAT: + param->fetch_result= fetch_result_float; + *param->length= 4; + break; + case MYSQL_TYPE_DOUBLE: + param->fetch_result= fetch_result_double; + *param->length= 8; + break; + case MYSQL_TYPE_TIME: + param->fetch_result= fetch_result_time; + *param->length= sizeof(MYSQL_TIME); + break; + case MYSQL_TYPE_DATE: + param->fetch_result= fetch_result_date; + *param->length= sizeof(MYSQL_TIME); + break; + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + param->fetch_result= fetch_result_datetime; + *param->length= sizeof(MYSQL_TIME); + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_BIT: + DBUG_ASSERT(param->buffer_length != 0); + param->fetch_result= fetch_result_bin; + break; + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_NEWDECIMAL: + case MYSQL_TYPE_NEWDATE: + DBUG_ASSERT(param->buffer_length != 0); + param->fetch_result= fetch_result_str; + break; + default: + DBUG_PRINT("error", ("Unknown param->buffer_type: %u", + (uint) param->buffer_type)); + DBUG_RETURN(TRUE); + } + if (! is_binary_compatible(param->buffer_type, field->type)) + param->fetch_result= fetch_result_with_conversion; + + /* Setup skip_result functions (to calculate max_length) */ + param->skip_result= skip_result_fixed; + switch (field->type) { + case MYSQL_TYPE_NULL: /* for dummy binds */ + param->pack_length= 0; + field->max_length= 0; + break; + case MYSQL_TYPE_TINY: + param->pack_length= 1; + field->max_length= 4; /* as in '-127' */ + break; + case MYSQL_TYPE_YEAR: + case MYSQL_TYPE_SHORT: + param->pack_length= 2; + field->max_length= 6; /* as in '-32767' */ + break; + case MYSQL_TYPE_INT24: + field->max_length= 9; /* as in '16777216' or in '-8388607' */ + param->pack_length= 4; + break; + case MYSQL_TYPE_LONG: + field->max_length= 11; /* '-2147483647' */ + param->pack_length= 4; + break; + case MYSQL_TYPE_LONGLONG: + field->max_length= 21; /* '18446744073709551616' */ + param->pack_length= 8; + break; + case MYSQL_TYPE_FLOAT: + param->pack_length= 4; + field->max_length= MAX_DOUBLE_STRING_REP_LENGTH; + break; + case MYSQL_TYPE_DOUBLE: + param->pack_length= 8; + field->max_length= MAX_DOUBLE_STRING_REP_LENGTH; + break; + case MYSQL_TYPE_TIME: + field->max_length= 15; /* 19:23:48.123456 */ + param->skip_result= skip_result_with_length; + case MYSQL_TYPE_DATE: + field->max_length= 10; /* 2003-11-11 */ + param->skip_result= skip_result_with_length; + break; + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: + param->skip_result= skip_result_with_length; + field->max_length= MAX_DATE_STRING_REP_LENGTH; + break; + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_NEWDECIMAL: + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: + case MYSQL_TYPE_GEOMETRY: + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + case MYSQL_TYPE_BIT: + case MYSQL_TYPE_NEWDATE: + param->skip_result= skip_result_string; + break; + default: + DBUG_PRINT("error", ("Unknown field->type: %u", (uint) field->type)); + DBUG_RETURN(TRUE); + } + DBUG_RETURN(FALSE); +} + + +/* + Setup the bind buffers for resultset processing +*/ + +my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *my_bind) +{ + MYSQL_BIND *param, *end; + MYSQL_FIELD *field; + ulong bind_count= stmt->field_count; + uint param_count= 0; + DBUG_ENTER("mysql_stmt_bind_result"); + DBUG_PRINT("enter",("field_count: %lu", bind_count)); + + if (!bind_count) + { + int errorcode= (int) stmt->state < (int) MYSQL_STMT_PREPARE_DONE ? + CR_NO_PREPARE_STMT : CR_NO_STMT_METADATA; + set_stmt_error(stmt, errorcode, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + /* + We only need to check that stmt->field_count - if it is not null + stmt->bind was initialized in mysql_stmt_prepare + stmt->bind overlaps with bind if mysql_stmt_bind_param + is called from mysql_stmt_store_result. + */ + + if (stmt->bind != my_bind) + memcpy((char*) stmt->bind, (char*) my_bind, + sizeof(MYSQL_BIND) * bind_count); + + for (param= stmt->bind, end= param + bind_count, field= stmt->fields ; + param < end ; + param++, field++) + { + DBUG_PRINT("info",("buffer_type: %u field_type: %u", + (uint) param->buffer_type, (uint) field->type)); + /* + Set param->is_null to point to a dummy variable if it's not set. + This is to make the execute code easier + */ + if (!param->is_null) + param->is_null= ¶m->is_null_value; + + if (!param->length) + param->length= ¶m->length_value; + + if (!param->error) + param->error= ¶m->error_value; + + param->param_number= param_count++; + param->offset= 0; + + if (setup_one_fetch_function(param, field)) + { + strmov(stmt->sqlstate, unknown_sqlstate); + sprintf(stmt->last_error, + ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE), + field->type, param_count); + DBUG_RETURN(1); + } + } + stmt->bind_result_done= BIND_RESULT_DONE; + if (stmt->mysql->options.report_data_truncation) + stmt->bind_result_done|= REPORT_DATA_TRUNCATION; + + DBUG_RETURN(0); +} + + +/* + Fetch row data to bind buffers +*/ + +static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row) +{ + MYSQL_BIND *my_bind, *end; + MYSQL_FIELD *field; + uchar *null_ptr, bit; + int truncation_count= 0; + /* + Precondition: if stmt->field_count is zero or row is NULL, read_row_* + function must return no data. + */ + DBUG_ASSERT(stmt->field_count); + DBUG_ASSERT(row); + + if (!stmt->bind_result_done) + { + /* If output parameters were not bound we should just return success */ + return 0; + } + + null_ptr= row; + row+= (stmt->field_count+9)/8; /* skip null bits */ + bit= 4; /* first 2 bits are reserved */ + + /* Copy complete row to application buffers */ + for (my_bind= stmt->bind, end= my_bind + stmt->field_count, + field= stmt->fields ; + my_bind < end ; + my_bind++, field++) + { + *my_bind->error= 0; + if (*null_ptr & bit) + { + /* + We should set both row_ptr and is_null to be able to see + nulls in mysql_stmt_fetch_column. This is because is_null may point + to user data which can be overwritten between mysql_stmt_fetch and + mysql_stmt_fetch_column, and in this case nullness of column will be + lost. See mysql_stmt_fetch_column for details. + */ + my_bind->row_ptr= NULL; + *my_bind->is_null= 1; + } + else + { + *my_bind->is_null= 0; + my_bind->row_ptr= row; + (*my_bind->fetch_result)(my_bind, field, &row); + truncation_count+= *my_bind->error; + } + if (!((bit<<=1) & 255)) + { + bit= 1; /* To next uchar */ + null_ptr++; + } + } + if (truncation_count && (stmt->bind_result_done & REPORT_DATA_TRUNCATION)) + return MYSQL_DATA_TRUNCATED; + return 0; +} + + +int cli_unbuffered_fetch(MYSQL *mysql, char **row) +{ + if (packet_error == cli_safe_read(mysql)) + return 1; + + *row= ((mysql->net.read_pos[0] == 254) ? NULL : + (char*) (mysql->net.read_pos+1)); + return 0; +} + + +/* + Fetch and return row data to bound buffers, if any +*/ + +int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt) +{ + int rc; + uchar *row; + DBUG_ENTER("mysql_stmt_fetch"); + + if ((rc= (*stmt->read_row_func)(stmt, &row)) || + ((rc= stmt_fetch_row(stmt, row)) && rc != MYSQL_DATA_TRUNCATED)) + { + stmt->state= MYSQL_STMT_PREPARE_DONE; /* XXX: this is buggy */ + stmt->read_row_func= (rc == MYSQL_NO_DATA) ? + stmt_read_row_no_data : stmt_read_row_no_result_set; + } + else + { + /* This is to know in mysql_stmt_fetch_column that data was fetched */ + stmt->state= MYSQL_STMT_FETCH_DONE; + } + DBUG_RETURN(rc); +} + + +/* + Fetch data for one specified column data + + SYNOPSIS + mysql_stmt_fetch_column() + stmt Prepared statement handler + my_bind Where data should be placed. Should be filled in as + when calling mysql_stmt_bind_result() + column Column to fetch (first column is 0) + ulong offset Offset in result data (to fetch blob in pieces) + This is normally 0 + RETURN + 0 ok + 1 error +*/ + +int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *my_bind, + uint column, ulong offset) +{ + MYSQL_BIND *param= stmt->bind+column; + DBUG_ENTER("mysql_stmt_fetch_column"); + + if ((int) stmt->state < (int) MYSQL_STMT_FETCH_DONE) + { + set_stmt_error(stmt, CR_NO_DATA, unknown_sqlstate, NULL); + return 1; + } + if (column >= stmt->field_count) + { + set_stmt_error(stmt, CR_INVALID_PARAMETER_NO, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + if (!my_bind->error) + my_bind->error= &my_bind->error_value; + *my_bind->error= 0; + if (param->row_ptr) + { + MYSQL_FIELD *field= stmt->fields+column; + uchar *row= param->row_ptr; + my_bind->offset= offset; + if (my_bind->is_null) + *my_bind->is_null= 0; + if (my_bind->length) /* Set the length if non char/binary types */ + *my_bind->length= *param->length; + else + my_bind->length= ¶m->length_value; /* Needed for fetch_result() */ + fetch_result_with_conversion(my_bind, field, &row); + } + else + { + if (my_bind->is_null) + *my_bind->is_null= 1; + } + DBUG_RETURN(0); +} + + +/* + Read all rows of data from server (binary format) +*/ + +int cli_read_binary_rows(MYSQL_STMT *stmt) +{ + ulong pkt_len; + uchar *cp; + MYSQL *mysql= stmt->mysql; + MYSQL_DATA *result= &stmt->result; + MYSQL_ROWS *cur, **prev_ptr= &result->data; + NET *net; + + DBUG_ENTER("cli_read_binary_rows"); + + if (!mysql) + { + set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + net = &mysql->net; + + while ((pkt_len= cli_safe_read(mysql)) != packet_error) + { + cp= net->read_pos; + if (cp[0] != 254 || pkt_len >= 8) + { + if (!(cur= (MYSQL_ROWS*) alloc_root(&result->alloc, + sizeof(MYSQL_ROWS) + pkt_len - 1))) + { + set_stmt_error(stmt, CR_OUT_OF_MEMORY, unknown_sqlstate, NULL); + goto err; + } + cur->data= (MYSQL_ROW) (cur+1); + *prev_ptr= cur; + prev_ptr= &cur->next; + memcpy((char *) cur->data, (char *) cp+1, pkt_len-1); + cur->length= pkt_len; /* To allow us to do sanity checks */ + result->rows++; + } + else + { + /* end of data */ + *prev_ptr= 0; + mysql->warning_count= uint2korr(cp+1); + mysql->server_status= uint2korr(cp+3); + DBUG_PRINT("info",("status: %u warning_count: %u", + mysql->server_status, mysql->warning_count)); + DBUG_RETURN(0); + } + } + set_stmt_errmsg(stmt, net); + +err: + DBUG_RETURN(1); +} + + +/* + Update meta data for statement + + SYNOPSIS + stmt_update_metadata() + stmt Statement handler + row Binary data + + NOTES + Only updates MYSQL_FIELD->max_length for strings +*/ + +static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data) +{ + MYSQL_BIND *my_bind, *end; + MYSQL_FIELD *field; + uchar *null_ptr, bit; + uchar *row= (uchar*) data->data; +#ifndef DBUG_OFF + uchar *row_end= row + data->length; +#endif + + null_ptr= row; + row+= (stmt->field_count+9)/8; /* skip null bits */ + bit= 4; /* first 2 bits are reserved */ + + /* Go through all fields and calculate metadata */ + for (my_bind= stmt->bind, end= my_bind + stmt->field_count, field= stmt->fields ; + my_bind < end ; + my_bind++, field++) + { + if (!(*null_ptr & bit)) + (*my_bind->skip_result)(my_bind, field, &row); + DBUG_ASSERT(row <= row_end); + if (!((bit<<=1) & 255)) + { + bit= 1; /* To next uchar */ + null_ptr++; + } + } +} + + +/* + Store or buffer the binary results to stmt +*/ + +int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) +{ + MYSQL *mysql= stmt->mysql; + MYSQL_DATA *result= &stmt->result; + DBUG_ENTER("mysql_stmt_store_result"); + + if (!mysql) + { + /* mysql can be reset in mysql_close called from mysql_reconnect */ + set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + if (!stmt->field_count) + DBUG_RETURN(0); + + if ((int) stmt->state < (int) MYSQL_STMT_EXECUTE_DONE) + { + set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + if (stmt->last_errno) + { + /* An attempt to use an invalid statement handle. */ + DBUG_RETURN(1); + } + + if (mysql->status == MYSQL_STATUS_READY && + stmt->server_status & SERVER_STATUS_CURSOR_EXISTS) + { + /* + Server side cursor exist, tell server to start sending the rows + */ + NET *net= &mysql->net; + uchar buff[4 /* statement id */ + + 4 /* number of rows to fetch */]; + + /* Send row request to the server */ + int4store(buff, stmt->stmt_id); + int4store(buff + 4, (int)~0); /* number of rows to fetch */ + if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff), + (uchar*) 0, 0, 1, stmt)) + { + set_stmt_errmsg(stmt, net); + DBUG_RETURN(1); + } + } + else if (mysql->status != MYSQL_STATUS_GET_RESULT) + { + set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + + if (stmt->update_max_length && !stmt->bind_result_done) + { + /* + We must initalize the bind structure to be able to calculate + max_length + */ + MYSQL_BIND *my_bind, *end; + MYSQL_FIELD *field; + bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count); + + for (my_bind= stmt->bind, end= my_bind + stmt->field_count, + field= stmt->fields; + my_bind < end ; + my_bind++, field++) + { + my_bind->buffer_type= MYSQL_TYPE_NULL; + my_bind->buffer_length=1; + } + + if (mysql_stmt_bind_result(stmt, stmt->bind)) + DBUG_RETURN(1); + stmt->bind_result_done= 0; /* No normal bind done */ + } + + if ((*mysql->methods->read_binary_rows)(stmt)) + { + free_root(&result->alloc, MYF(MY_KEEP_PREALLOC)); + result->data= NULL; + result->rows= 0; + mysql->status= MYSQL_STATUS_READY; + DBUG_RETURN(1); + } + + /* Assert that if there was a cursor, all rows have been fetched */ + DBUG_ASSERT(mysql->status != MYSQL_STATUS_READY || + (mysql->server_status & SERVER_STATUS_LAST_ROW_SENT)); + + if (stmt->update_max_length) + { + MYSQL_ROWS *cur= result->data; + for(; cur; cur=cur->next) + stmt_update_metadata(stmt, cur); + } + + stmt->data_cursor= result->data; + mysql->affected_rows= stmt->affected_rows= result->rows; + stmt->read_row_func= stmt_read_row_buffered; + mysql->unbuffered_fetch_owner= 0; /* set in stmt_execute */ + mysql->status= MYSQL_STATUS_READY; /* server is ready */ + DBUG_RETURN(0); /* Data buffered, must be fetched with mysql_stmt_fetch() */ +} + + +/* + Seek to desired row in the statement result set +*/ + +MYSQL_ROW_OFFSET STDCALL +mysql_stmt_row_seek(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET row) +{ + MYSQL_ROW_OFFSET offset= stmt->data_cursor; + DBUG_ENTER("mysql_stmt_row_seek"); + + stmt->data_cursor= row; + DBUG_RETURN(offset); +} + + +/* + Return the current statement row cursor position +*/ + +MYSQL_ROW_OFFSET STDCALL +mysql_stmt_row_tell(MYSQL_STMT *stmt) +{ + DBUG_ENTER("mysql_stmt_row_tell"); + + DBUG_RETURN(stmt->data_cursor); +} + + +/* + Move the stmt result set data cursor to specified row +*/ + +void STDCALL +mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong row) +{ + MYSQL_ROWS *tmp= stmt->result.data; + DBUG_ENTER("mysql_stmt_data_seek"); + DBUG_PRINT("enter",("row id to seek: %ld",(long) row)); + + for (; tmp && row; --row, tmp= tmp->next) + ; + stmt->data_cursor= tmp; + if (!row && tmp) + { + /* Rewind the counter */ + stmt->read_row_func= stmt_read_row_buffered; + stmt->state= MYSQL_STMT_EXECUTE_DONE; + } + DBUG_VOID_RETURN; +} + + +/* + Return total rows the current statement result set +*/ + +my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt) +{ + DBUG_ENTER("mysql_stmt_num_rows"); + + DBUG_RETURN(stmt->result.rows); +} + + +/* + Free the client side memory buffers, reset long data state + on client if necessary, and reset the server side statement if + this has been requested. +*/ + +static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags) +{ + /* If statement hasn't been prepared there is nothing to reset */ + if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE) + { + MYSQL *mysql= stmt->mysql; + MYSQL_DATA *result= &stmt->result; + + /* + Reset stored result set if so was requested or it's a part + of cursor fetch. + */ + if (flags & RESET_STORE_RESULT) + { + /* Result buffered */ + free_root(&result->alloc, MYF(MY_KEEP_PREALLOC)); + result->data= NULL; + result->rows= 0; + stmt->data_cursor= NULL; + } + if (flags & RESET_LONG_DATA) + { + MYSQL_BIND *param= stmt->params, *param_end= param + stmt->param_count; + /* Clear long_data_used flags */ + for (; param < param_end; param++) + param->long_data_used= 0; + } + stmt->read_row_func= stmt_read_row_no_result_set; + if (mysql) + { + if ((int) stmt->state > (int) MYSQL_STMT_PREPARE_DONE) + { + if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled) + mysql->unbuffered_fetch_owner= 0; + if (stmt->field_count && mysql->status != MYSQL_STATUS_READY) + { + /* There is a result set and it belongs to this statement */ + (*mysql->methods->flush_use_result)(mysql, FALSE); + if (mysql->unbuffered_fetch_owner) + *mysql->unbuffered_fetch_owner= TRUE; + mysql->status= MYSQL_STATUS_READY; + } + } + if (flags & RESET_SERVER_SIDE) + { + /* + Reset the server side statement and close the server side + cursor if it exists. + */ + uchar buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */ + int4store(buff, stmt->stmt_id); + if ((*mysql->methods->advanced_command)(mysql, COM_STMT_RESET, buff, + sizeof(buff), 0, 0, 0, stmt)) + { + set_stmt_errmsg(stmt, &mysql->net); + stmt->state= MYSQL_STMT_INIT_DONE; + return 1; + } + } + } + if (flags & RESET_CLEAR_ERROR) + stmt_clear_error(stmt); + stmt->state= MYSQL_STMT_PREPARE_DONE; + } + return 0; +} + +my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt) +{ + DBUG_ENTER("mysql_stmt_free_result"); + + /* Free the client side and close the server side cursor if there is one */ + DBUG_RETURN(reset_stmt_handle(stmt, RESET_LONG_DATA | RESET_STORE_RESULT | + RESET_CLEAR_ERROR)); +} + +/******************************************************************** + statement error handling and close +*********************************************************************/ + +/* + Close the statement handle by freeing all alloced resources + + SYNOPSIS + mysql_stmt_close() + stmt Statement handle + + RETURN VALUES + 0 ok + 1 error +*/ + +my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) +{ + MYSQL *mysql= stmt->mysql; + int rc= 0; + DBUG_ENTER("mysql_stmt_close"); + + free_root(&stmt->result.alloc, MYF(0)); + free_root(&stmt->mem_root, MYF(0)); + + if (mysql) + { + mysql->stmts= list_delete(mysql->stmts, &stmt->list); + /* + Clear NET error state: if the following commands come through + successfully, connection will still be usable for other commands. + */ + net_clear_error(&mysql->net); + if ((int) stmt->state > (int) MYSQL_STMT_INIT_DONE) + { + uchar buff[MYSQL_STMT_HEADER]; /* 4 bytes - stmt id */ + + if (mysql->unbuffered_fetch_owner == &stmt->unbuffered_fetch_cancelled) + mysql->unbuffered_fetch_owner= 0; + if (mysql->status != MYSQL_STATUS_READY) + { + /* + Flush result set of the connection. If it does not belong + to this statement, set a warning. + */ + (*mysql->methods->flush_use_result)(mysql, TRUE); + if (mysql->unbuffered_fetch_owner) + *mysql->unbuffered_fetch_owner= TRUE; + mysql->status= MYSQL_STATUS_READY; + } + int4store(buff, stmt->stmt_id); + if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt))) + { + set_stmt_errmsg(stmt, &mysql->net); + } + } + } + + my_free((uchar*) stmt, MYF(MY_WME)); + + DBUG_RETURN(test(rc)); +} + +/* + Reset the statement buffers in server +*/ + +my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt) +{ + DBUG_ENTER("mysql_stmt_reset"); + DBUG_ASSERT(stmt != 0); + if (!stmt->mysql) + { + /* mysql can be reset in mysql_close called from mysql_reconnect */ + set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + /* Reset the client and server sides of the prepared statement */ + DBUG_RETURN(reset_stmt_handle(stmt, + RESET_SERVER_SIDE | RESET_LONG_DATA | + RESET_CLEAR_ERROR)); +} + +/* + Return statement error code +*/ + +uint STDCALL mysql_stmt_errno(MYSQL_STMT * stmt) +{ + DBUG_ENTER("mysql_stmt_errno"); + DBUG_RETURN(stmt->last_errno); +} + +const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt) +{ + DBUG_ENTER("mysql_stmt_sqlstate"); + DBUG_RETURN(stmt->sqlstate); +} + +/* + Return statement error message +*/ + +const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt) +{ + DBUG_ENTER("mysql_stmt_error"); + DBUG_RETURN(stmt->last_error); +} + + +/******************************************************************** + Transactional APIs +*********************************************************************/ + +/* + Commit the current transaction +*/ + +my_bool STDCALL mysql_commit(MYSQL * mysql) +{ + DBUG_ENTER("mysql_commit"); + DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6)); +} + +/* + Rollback the current transaction +*/ + +my_bool STDCALL mysql_rollback(MYSQL * mysql) +{ + DBUG_ENTER("mysql_rollback"); + DBUG_RETURN((my_bool) mysql_real_query(mysql, "rollback", 8)); +} + + +/* + Set autocommit to either true or false +*/ + +my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode) +{ + DBUG_ENTER("mysql_autocommit"); + DBUG_PRINT("enter", ("mode : %d", auto_mode)); + + DBUG_RETURN((my_bool) mysql_real_query(mysql, auto_mode ? + "set autocommit=1":"set autocommit=0", + 16)); +} + + +/******************************************************************** + Multi query execution + SPs APIs +*********************************************************************/ + +/* + Returns true/false to indicate whether any more query results exist + to be read using mysql_next_result() +*/ + +my_bool STDCALL mysql_more_results(MYSQL *mysql) +{ + my_bool res; + DBUG_ENTER("mysql_more_results"); + + res= ((mysql->server_status & SERVER_MORE_RESULTS_EXISTS) ? 1: 0); + DBUG_PRINT("exit",("More results exists ? %d", res)); + DBUG_RETURN(res); +} + + +/* + Reads and returns the next query results +*/ +int STDCALL mysql_next_result(MYSQL *mysql) +{ + DBUG_ENTER("mysql_next_result"); + + if (mysql->status != MYSQL_STATUS_READY) + { + set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate); + DBUG_RETURN(1); + } + + net_clear_error(&mysql->net); + mysql->affected_rows= ~(my_ulonglong) 0; + + if (mysql->server_status & SERVER_MORE_RESULTS_EXISTS) + DBUG_RETURN((*mysql->methods->next_result)(mysql)); + + DBUG_RETURN(-1); /* No more results */ +} + + +int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt) +{ + MYSQL *mysql= stmt->mysql; + int rc; + DBUG_ENTER("mysql_stmt_next_result"); + + if (!mysql) + DBUG_RETURN(1); + + if (stmt->last_errno) + DBUG_RETURN(stmt->last_errno); + + if (mysql->server_status & SERVER_MORE_RESULTS_EXISTS) + { + if (reset_stmt_handle(stmt, RESET_STORE_RESULT)) + DBUG_RETURN(1); + } + + rc= mysql_next_result(mysql); + + if (rc) + { + set_stmt_errmsg(stmt, &mysql->net); + DBUG_RETURN(rc); + } + + stmt->state= MYSQL_STMT_EXECUTE_DONE; + stmt->bind_result_done= FALSE; + + if (mysql->field_count) + { + alloc_stmt_fields(stmt); + prepare_to_fetch_result(stmt); + } + else + { + stmt->field_count= mysql->field_count; + } + + DBUG_RETURN(0); +} + + +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql) +{ + return (*mysql->methods->use_result)(mysql); +} + +my_bool STDCALL mysql_read_query_result(MYSQL *mysql) +{ + return (*mysql->methods->read_query_result)(mysql); +} + diff --git a/externals/mysql/libmysql/libmysql.def b/externals/mysql/libmysql/libmysql.def new file mode 100644 index 0000000..8692984 --- /dev/null +++ b/externals/mysql/libmysql/libmysql.def @@ -0,0 +1,107 @@ +LIBRARY LIBMYSQL +VERSION 6.0 +EXPORTS + mysql_get_parameters + mysql_thread_end + mysql_thread_init + myodbc_remove_escape + mysql_affected_rows + mysql_autocommit + mysql_stmt_bind_param + mysql_stmt_bind_result + mysql_change_user + mysql_character_set_name + mysql_close + mysql_commit + mysql_data_seek + mysql_debug + mysql_dump_debug_info + mysql_eof + mysql_errno + mysql_error + mysql_escape_string + mysql_hex_string + mysql_stmt_execute + mysql_stmt_fetch + mysql_stmt_fetch_column + mysql_fetch_field + mysql_fetch_field_direct + mysql_fetch_fields + mysql_fetch_lengths + mysql_fetch_row + mysql_field_count + mysql_field_seek + mysql_field_tell + mysql_free_result + mysql_get_client_info + mysql_get_host_info + mysql_get_proto_info + mysql_get_server_info + mysql_get_client_version + mysql_get_ssl_cipher + mysql_info + mysql_init + mysql_insert_id + mysql_kill + mysql_set_server_option + mysql_list_dbs + mysql_list_fields + mysql_list_processes + mysql_list_tables + mysql_more_results + mysql_next_result + mysql_num_fields + mysql_num_rows + mysql_options + mysql_stmt_param_count + mysql_stmt_param_metadata + mysql_ping + mysql_stmt_result_metadata + mysql_query + mysql_read_query_result + mysql_real_connect + mysql_real_escape_string + mysql_real_query + mysql_refresh + mysql_rollback + mysql_row_seek + mysql_row_tell + mysql_select_db + mysql_stmt_send_long_data + mysql_send_query + mysql_shutdown + mysql_ssl_set + mysql_stat + mysql_stmt_affected_rows + mysql_stmt_close + mysql_stmt_reset + mysql_stmt_data_seek + mysql_stmt_errno + mysql_stmt_error + mysql_stmt_free_result + mysql_stmt_num_rows + mysql_stmt_row_seek + mysql_stmt_row_tell + mysql_stmt_store_result + mysql_store_result + mysql_thread_id + mysql_thread_safe + mysql_use_result + mysql_warning_count + mysql_stmt_sqlstate + mysql_sqlstate + mysql_get_server_version + mysql_stmt_prepare + mysql_stmt_init + mysql_stmt_insert_id + mysql_stmt_attr_get + mysql_stmt_attr_set + mysql_stmt_field_count + mysql_set_local_infile_default + mysql_set_local_infile_handler + mysql_embedded + mysql_server_init + mysql_server_end + mysql_set_character_set + mysql_get_character_set_info + mysql_stmt_next_result diff --git a/externals/mysql/libmysql/my_time.c b/externals/mysql/libmysql/my_time.c new file mode 100644 index 0000000..9dd0502 --- /dev/null +++ b/externals/mysql/libmysql/my_time.c @@ -0,0 +1,1263 @@ +/* Copyright (C) 2004-2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +/* Windows version of localtime_r() is declared in my_ptrhead.h */ +#include + +ulonglong log_10_int[20]= +{ + 1, 10, 100, 1000, 10000UL, 100000UL, 1000000UL, 10000000UL, + 100000000ULL, 1000000000ULL, 10000000000ULL, 100000000000ULL, + 1000000000000ULL, 10000000000000ULL, 100000000000000ULL, + 1000000000000000ULL, 10000000000000000ULL, 100000000000000000ULL, + 1000000000000000000ULL, 10000000000000000000ULL +}; + + +/* Position for YYYY-DD-MM HH-MM-DD.FFFFFF AM in default format */ + +static uchar internal_format_positions[]= +{0, 1, 2, 3, 4, 5, 6, (uchar) 255}; + +static char time_separator=':'; + +static ulong const days_at_timestart=719528; /* daynr at 1970.01.01 */ +uchar days_in_month[]= {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0}; + +/* + Offset of system time zone from UTC in seconds used to speed up + work of my_system_gmt_sec() function. +*/ +static long my_time_zone=0; + + +/* Calc days in one year. works with 0 <= year <= 99 */ + +uint calc_days_in_year(uint year) +{ + return ((year & 3) == 0 && (year%100 || (year%400 == 0 && year)) ? + 366 : 365); +} + +/** + @brief Check datetime value for validity according to flags. + + @param[in] ltime Date to check. + @param[in] not_zero_date ltime is not the zero date + @param[in] flags flags to check + (see str_to_datetime() flags in my_time.h) + @param[out] was_cut set to 2 if value was invalid according to flags. + (Feb 29 in non-leap etc.) This remains unchanged + if value is not invalid. + + @details Here we assume that year and month is ok! + If month is 0 we allow any date. (This only happens if we allow zero + date parts in str_to_datetime()) + Disallow dates with zero year and non-zero month and/or day. + + @return + 0 OK + 1 error +*/ + +my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date, + ulong flags, int *was_cut) +{ + if (not_zero_date) + { + if ((((flags & TIME_NO_ZERO_IN_DATE) || !(flags & TIME_FUZZY_DATE)) && + (ltime->month == 0 || ltime->day == 0)) || + (!(flags & TIME_INVALID_DATES) && + ltime->month && ltime->day > days_in_month[ltime->month-1] && + (ltime->month != 2 || calc_days_in_year(ltime->year) != 366 || + ltime->day != 29))) + { + *was_cut= 2; + return TRUE; + } + } + else if (flags & TIME_NO_ZERO_DATE) + { + /* + We don't set *was_cut here to signal that the problem was a zero date + and not an invalid date + */ + return TRUE; + } + return FALSE; +} + + +/* + Convert a timestamp string to a MYSQL_TIME value. + + SYNOPSIS + str_to_datetime() + str String to parse + length Length of string + l_time Date is stored here + flags Bitmap of following items + TIME_FUZZY_DATE Set if we should allow partial dates + TIME_DATETIME_ONLY Set if we only allow full datetimes. + TIME_NO_ZERO_IN_DATE Don't allow partial dates + TIME_NO_ZERO_DATE Don't allow 0000-00-00 date + TIME_INVALID_DATES Allow 2000-02-31 + was_cut 0 Value OK + 1 If value was cut during conversion + 2 check_date(date,flags) considers date invalid + + DESCRIPTION + At least the following formats are recogniced (based on number of digits) + YYMMDD, YYYYMMDD, YYMMDDHHMMSS, YYYYMMDDHHMMSS + YY-MM-DD, YYYY-MM-DD, YY-MM-DD HH.MM.SS + YYYYMMDDTHHMMSS where T is a the character T (ISO8601) + Also dates where all parts are zero are allowed + + The second part may have an optional .###### fraction part. + + NOTES + This function should work with a format position vector as long as the + following things holds: + - All date are kept together and all time parts are kept together + - Date and time parts must be separated by blank + - Second fractions must come after second part and be separated + by a '.'. (The second fractions are optional) + - AM/PM must come after second fractions (or after seconds if no fractions) + - Year must always been specified. + - If time is before date, then we will use datetime format only if + the argument consist of two parts, separated by space. + Otherwise we will assume the argument is a date. + - The hour part must be specified in hour-minute-second order. + + RETURN VALUES + MYSQL_TIMESTAMP_NONE String wasn't a timestamp, like + [DD [HH:[MM:[SS]]]].fraction. + l_time is not changed. + MYSQL_TIMESTAMP_DATE DATE string (YY MM and DD parts ok) + MYSQL_TIMESTAMP_DATETIME Full timestamp + MYSQL_TIMESTAMP_ERROR Timestamp with wrong values. + All elements in l_time is set to 0 +*/ + +#define MAX_DATE_PARTS 8 + +enum enum_mysql_timestamp_type +str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, + uint flags, int *was_cut) +{ + uint field_length, year_length, digits, i, number_of_fields; + uint date[MAX_DATE_PARTS], date_len[MAX_DATE_PARTS]; + uint add_hours= 0, start_loop; + ulong not_zero_date, allow_space; + my_bool is_internal_format; + const char *pos, *last_field_pos; + const char *end=str+length; + const uchar *format_position; + my_bool found_delimitier= 0, found_space= 0; + uint frac_pos, frac_len; + DBUG_ENTER("str_to_datetime"); + DBUG_PRINT("ENTER",("str: %.*s",length,str)); + + LINT_INIT(field_length); + LINT_INIT(year_length); + LINT_INIT(last_field_pos); + + *was_cut= 0; + + /* Skip space at start */ + for (; str != end && my_isspace(&my_charset_latin1, *str) ; str++) + ; + if (str == end || ! my_isdigit(&my_charset_latin1, *str)) + { + *was_cut= 1; + DBUG_RETURN(MYSQL_TIMESTAMP_NONE); + } + + is_internal_format= 0; + /* This has to be changed if want to activate different timestamp formats */ + format_position= internal_format_positions; + + /* + Calculate number of digits in first part. + If length= 8 or >= 14 then year is of format YYYY. + (YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS) + */ + for (pos=str; + pos != end && (my_isdigit(&my_charset_latin1,*pos) || *pos == 'T'); + pos++) + ; + + digits= (uint) (pos-str); + start_loop= 0; /* Start of scan loop */ + date_len[format_position[0]]= 0; /* Length of year field */ + if (pos == end || *pos == '.') + { + /* Found date in internal format (only numbers like YYYYMMDD) */ + year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2; + field_length= year_length; + is_internal_format= 1; + format_position= internal_format_positions; + } + else + { + if (format_position[0] >= 3) /* If year is after HHMMDD */ + { + /* + If year is not in first part then we have to determinate if we got + a date field or a datetime field. + We do this by checking if there is two numbers separated by + space in the input. + */ + while (pos < end && !my_isspace(&my_charset_latin1, *pos)) + pos++; + while (pos < end && !my_isdigit(&my_charset_latin1, *pos)) + pos++; + if (pos == end) + { + if (flags & TIME_DATETIME_ONLY) + { + *was_cut= 1; + DBUG_RETURN(MYSQL_TIMESTAMP_NONE); /* Can't be a full datetime */ + } + /* Date field. Set hour, minutes and seconds to 0 */ + date[0]= date[1]= date[2]= date[3]= date[4]= 0; + start_loop= 5; /* Start with first date part */ + } + } + + field_length= format_position[0] == 0 ? 4 : 2; + } + + /* + Only allow space in the first "part" of the datetime field and: + - after days, part seconds + - before and after AM/PM (handled by code later) + + 2003-03-03 20:00:20 AM + 20:00:20.000000 AM 03-03-2000 + */ + i= max((uint) format_position[0], (uint) format_position[1]); + set_if_bigger(i, (uint) format_position[2]); + allow_space= ((1 << i) | (1 << format_position[6])); + allow_space&= (1 | 2 | 4 | 8); + + not_zero_date= 0; + for (i = start_loop; + i < MAX_DATE_PARTS-1 && str != end && + my_isdigit(&my_charset_latin1,*str); + i++) + { + const char *start= str; + ulong tmp_value= (uint) (uchar) (*str++ - '0'); + + /* + Internal format means no delimiters; every field has a fixed + width. Otherwise, we scan until we find a delimiter and discard + leading zeroes -- except for the microsecond part, where leading + zeroes are significant, and where we never process more than six + digits. + */ + my_bool scan_until_delim= !is_internal_format && + ((i != format_position[6])); + + while (str != end && my_isdigit(&my_charset_latin1,str[0]) && + (scan_until_delim || --field_length)) + { + tmp_value=tmp_value*10 + (ulong) (uchar) (*str - '0'); + str++; + } + date_len[i]= (uint) (str - start); + if (tmp_value > 999999) /* Impossible date part */ + { + *was_cut= 1; + DBUG_RETURN(MYSQL_TIMESTAMP_NONE); + } + date[i]=tmp_value; + not_zero_date|= tmp_value; + + /* Length of next field */ + field_length= format_position[i+1] == 0 ? 4 : 2; + + if ((last_field_pos= str) == end) + { + i++; /* Register last found part */ + break; + } + /* Allow a 'T' after day to allow CCYYMMDDT type of fields */ + if (i == format_position[2] && *str == 'T') + { + str++; /* ISO8601: CCYYMMDDThhmmss */ + continue; + } + if (i == format_position[5]) /* Seconds */ + { + if (*str == '.') /* Followed by part seconds */ + { + str++; + field_length= 6; /* 6 digits */ + } + continue; + } + while (str != end && + (my_ispunct(&my_charset_latin1,*str) || + my_isspace(&my_charset_latin1,*str))) + { + if (my_isspace(&my_charset_latin1,*str)) + { + if (!(allow_space & (1 << i))) + { + *was_cut= 1; + DBUG_RETURN(MYSQL_TIMESTAMP_NONE); + } + found_space= 1; + } + str++; + found_delimitier= 1; /* Should be a 'normal' date */ + } + /* Check if next position is AM/PM */ + if (i == format_position[6]) /* Seconds, time for AM/PM */ + { + i++; /* Skip AM/PM part */ + if (format_position[7] != 255) /* If using AM/PM */ + { + if (str+2 <= end && (str[1] == 'M' || str[1] == 'm')) + { + if (str[0] == 'p' || str[0] == 'P') + add_hours= 12; + else if (str[0] != 'a' || str[0] != 'A') + continue; /* Not AM/PM */ + str+= 2; /* Skip AM/PM */ + /* Skip space after AM/PM */ + while (str != end && my_isspace(&my_charset_latin1,*str)) + str++; + } + } + } + last_field_pos= str; + } + if (found_delimitier && !found_space && (flags & TIME_DATETIME_ONLY)) + { + *was_cut= 1; + DBUG_RETURN(MYSQL_TIMESTAMP_NONE); /* Can't be a datetime */ + } + + str= last_field_pos; + + number_of_fields= i - start_loop; + while (i < MAX_DATE_PARTS) + { + date_len[i]= 0; + date[i++]= 0; + } + + if (!is_internal_format) + { + year_length= date_len[(uint) format_position[0]]; + if (!year_length) /* Year must be specified */ + { + *was_cut= 1; + DBUG_RETURN(MYSQL_TIMESTAMP_NONE); + } + + l_time->year= date[(uint) format_position[0]]; + l_time->month= date[(uint) format_position[1]]; + l_time->day= date[(uint) format_position[2]]; + l_time->hour= date[(uint) format_position[3]]; + l_time->minute= date[(uint) format_position[4]]; + l_time->second= date[(uint) format_position[5]]; + + frac_pos= (uint) format_position[6]; + frac_len= date_len[frac_pos]; + if (frac_len < 6) + date[frac_pos]*= (uint) log_10_int[6 - frac_len]; + l_time->second_part= date[frac_pos]; + + if (format_position[7] != (uchar) 255) + { + if (l_time->hour > 12) + { + *was_cut= 1; + goto err; + } + l_time->hour= l_time->hour%12 + add_hours; + } + } + else + { + l_time->year= date[0]; + l_time->month= date[1]; + l_time->day= date[2]; + l_time->hour= date[3]; + l_time->minute= date[4]; + l_time->second= date[5]; + if (date_len[6] < 6) + date[6]*= (uint) log_10_int[6 - date_len[6]]; + l_time->second_part=date[6]; + } + l_time->neg= 0; + + if (year_length == 2 && not_zero_date) + l_time->year+= (l_time->year < YY_PART_YEAR ? 2000 : 1900); + + if (number_of_fields < 3 || + l_time->year > 9999 || l_time->month > 12 || + l_time->day > 31 || l_time->hour > 23 || + l_time->minute > 59 || l_time->second > 59) + { + /* Only give warning for a zero date if there is some garbage after */ + if (!not_zero_date) /* If zero date */ + { + for (; str != end ; str++) + { + if (!my_isspace(&my_charset_latin1, *str)) + { + not_zero_date= 1; /* Give warning */ + break; + } + } + } + *was_cut= test(not_zero_date); + goto err; + } + + if (check_date(l_time, not_zero_date != 0, flags, was_cut)) + goto err; + + l_time->time_type= (number_of_fields <= 3 ? + MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME); + + for (; str != end ; str++) + { + if (!my_isspace(&my_charset_latin1,*str)) + { + *was_cut= 1; + break; + } + } + + DBUG_RETURN(l_time->time_type= + (number_of_fields <= 3 ? MYSQL_TIMESTAMP_DATE : + MYSQL_TIMESTAMP_DATETIME)); + +err: + bzero((char*) l_time, sizeof(*l_time)); + DBUG_RETURN(MYSQL_TIMESTAMP_ERROR); +} + + +/* + Convert a time string to a MYSQL_TIME struct. + + SYNOPSIS + str_to_time() + str A string in full TIMESTAMP format or + [-] DAYS [H]H:MM:SS, [H]H:MM:SS, [M]M:SS, [H]HMMSS, + [M]MSS or [S]S + There may be an optional [.second_part] after seconds + length Length of str + l_time Store result here + warning Set MYSQL_TIME_WARN_TRUNCATED flag if the input string + was cut during conversion, and/or + MYSQL_TIME_WARN_OUT_OF_RANGE flag, if the value is + out of range. + + NOTES + Because of the extra days argument, this function can only + work with times where the time arguments are in the above order. + + RETURN + 0 ok + 1 error +*/ + +my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time, + int *warning) +{ + ulong date[5]; + ulonglong value; + const char *end=str+length, *end_of_days; + my_bool found_days,found_hours; + uint state; + + l_time->neg=0; + *warning= 0; + for (; str != end && my_isspace(&my_charset_latin1,*str) ; str++) + length--; + if (str != end && *str == '-') + { + l_time->neg=1; + str++; + length--; + } + if (str == end) + return 1; + + /* Check first if this is a full TIMESTAMP */ + if (length >= 12) + { /* Probably full timestamp */ + int was_cut; + enum enum_mysql_timestamp_type + res= str_to_datetime(str, length, l_time, + (TIME_FUZZY_DATE | TIME_DATETIME_ONLY), &was_cut); + if ((int) res >= (int) MYSQL_TIMESTAMP_ERROR) + { + if (was_cut) + *warning|= MYSQL_TIME_WARN_TRUNCATED; + return res == MYSQL_TIMESTAMP_ERROR; + } + } + + /* Not a timestamp. Try to get this as a DAYS_TO_SECOND string */ + for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++) + value=value*10L + (long) (*str - '0'); + + /* Skip all space after 'days' */ + end_of_days= str; + for (; str != end && my_isspace(&my_charset_latin1, str[0]) ; str++) + ; + + LINT_INIT(state); + found_days=found_hours=0; + if ((uint) (end-str) > 1 && str != end_of_days && + my_isdigit(&my_charset_latin1, *str)) + { /* Found days part */ + date[0]= (ulong) value; + state= 1; /* Assume next is hours */ + found_days= 1; + } + else if ((end-str) > 1 && *str == time_separator && + my_isdigit(&my_charset_latin1, str[1])) + { + date[0]= 0; /* Assume we found hours */ + date[1]= (ulong) value; + state=2; + found_hours=1; + str++; /* skip ':' */ + } + else + { + /* String given as one number; assume HHMMSS format */ + date[0]= 0; + date[1]= (ulong) (value/10000); + date[2]= (ulong) (value/100 % 100); + date[3]= (ulong) (value % 100); + state=4; + goto fractional; + } + + /* Read hours, minutes and seconds */ + for (;;) + { + for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++) + value=value*10L + (long) (*str - '0'); + date[state++]= (ulong) value; + if (state == 4 || (end-str) < 2 || *str != time_separator || + !my_isdigit(&my_charset_latin1,str[1])) + break; + str++; /* Skip time_separator (':') */ + } + + if (state != 4) + { /* Not HH:MM:SS */ + /* Fix the date to assume that seconds was given */ + if (!found_hours && !found_days) + { + bmove_upp((uchar*) (date+4), (uchar*) (date+state), + sizeof(long)*(state-1)); + bzero((uchar*) date, sizeof(long)*(4-state)); + } + else + bzero((uchar*) (date+state), sizeof(long)*(4-state)); + } + +fractional: + /* Get fractional second part */ + if ((end-str) >= 2 && *str == '.' && my_isdigit(&my_charset_latin1,str[1])) + { + int field_length= 5; + str++; value=(uint) (uchar) (*str - '0'); + while (++str != end && my_isdigit(&my_charset_latin1, *str)) + { + if (field_length-- > 0) + value= value*10 + (uint) (uchar) (*str - '0'); + } + if (field_length > 0) + value*= (long) log_10_int[field_length]; + else if (field_length < 0) + *warning|= MYSQL_TIME_WARN_TRUNCATED; + date[4]= (ulong) value; + } + else + date[4]=0; + + /* Check for exponent part: E | E */ + /* (may occur as result of %g formatting of time value) */ + if ((end - str) > 1 && + (*str == 'e' || *str == 'E') && + (my_isdigit(&my_charset_latin1, str[1]) || + ((str[1] == '-' || str[1] == '+') && + (end - str) > 2 && + my_isdigit(&my_charset_latin1, str[2])))) + return 1; + + if (internal_format_positions[7] != 255) + { + /* Read a possible AM/PM */ + while (str != end && my_isspace(&my_charset_latin1, *str)) + str++; + if (str+2 <= end && (str[1] == 'M' || str[1] == 'm')) + { + if (str[0] == 'p' || str[0] == 'P') + { + str+= 2; + date[1]= date[1]%12 + 12; + } + else if (str[0] == 'a' || str[0] == 'A') + str+=2; + } + } + + /* Integer overflow checks */ + if (date[0] > UINT_MAX || date[1] > UINT_MAX || + date[2] > UINT_MAX || date[3] > UINT_MAX || + date[4] > UINT_MAX) + return 1; + + l_time->year= 0; /* For protocol::store_time */ + l_time->month= 0; + l_time->day= date[0]; + l_time->hour= date[1]; + l_time->minute= date[2]; + l_time->second= date[3]; + l_time->second_part= date[4]; + l_time->time_type= MYSQL_TIMESTAMP_TIME; + + /* Check if the value is valid and fits into MYSQL_TIME range */ + if (check_time_range(l_time, warning)) + return 1; + + /* Check if there is garbage at end of the MYSQL_TIME specification */ + if (str != end) + { + do + { + if (!my_isspace(&my_charset_latin1,*str)) + { + *warning|= MYSQL_TIME_WARN_TRUNCATED; + break; + } + } while (++str != end); + } + return 0; +} + + +/* + Check 'time' value to lie in the MYSQL_TIME range + + SYNOPSIS: + check_time_range() + time pointer to MYSQL_TIME value + warning set MYSQL_TIME_WARN_OUT_OF_RANGE flag if the value is out of range + + DESCRIPTION + If the time value lies outside of the range [-838:59:59, 838:59:59], + set it to the closest endpoint of the range and set + MYSQL_TIME_WARN_OUT_OF_RANGE flag in the 'warning' variable. + + RETURN + 0 time value is valid, but was possibly truncated + 1 time value is invalid +*/ + +int check_time_range(struct st_mysql_time *my_time, int *warning) +{ + longlong hour; + + if (my_time->minute >= 60 || my_time->second >= 60) + return 1; + + hour= my_time->hour + (24*my_time->day); + if (hour <= TIME_MAX_HOUR && + (hour != TIME_MAX_HOUR || my_time->minute != TIME_MAX_MINUTE || + my_time->second != TIME_MAX_SECOND || !my_time->second_part)) + return 0; + + my_time->day= 0; + my_time->hour= TIME_MAX_HOUR; + my_time->minute= TIME_MAX_MINUTE; + my_time->second= TIME_MAX_SECOND; + my_time->second_part= 0; + *warning|= MYSQL_TIME_WARN_OUT_OF_RANGE; + return 0; +} + + +/* + Prepare offset of system time zone from UTC for my_system_gmt_sec() func. + + SYNOPSIS + my_init_time() +*/ +void my_init_time(void) +{ + time_t seconds; + struct tm *l_time,tm_tmp; + MYSQL_TIME my_time; + my_bool not_used; + + seconds= (time_t) time((time_t*) 0); + localtime_r(&seconds,&tm_tmp); + l_time= &tm_tmp; + my_time_zone= 3600; /* Comp. for -3600 in my_gmt_sec */ + my_time.year= (uint) l_time->tm_year+1900; + my_time.month= (uint) l_time->tm_mon+1; + my_time.day= (uint) l_time->tm_mday; + my_time.hour= (uint) l_time->tm_hour; + my_time.minute= (uint) l_time->tm_min; + my_time.second= (uint) l_time->tm_sec; + my_system_gmt_sec(&my_time, &my_time_zone, ¬_used); /* Init my_time_zone */ +} + + +/* + Handle 2 digit year conversions + + SYNOPSIS + year_2000_handling() + year 2 digit year + + RETURN + Year between 1970-2069 +*/ + +uint year_2000_handling(uint year) +{ + if ((year=year+1900) < 1900+YY_PART_YEAR) + year+=100; + return year; +} + + +/* + Calculate nr of day since year 0 in new date-system (from 1615) + + SYNOPSIS + calc_daynr() + year Year (exact 4 digit year, no year conversions) + month Month + day Day + + NOTES: 0000-00-00 is a valid date, and will return 0 + + RETURN + Days since 0000-00-00 +*/ + +long calc_daynr(uint year,uint month,uint day) +{ + long delsum; + int temp; + int y= year; /* may be < 0 temporarily */ + DBUG_ENTER("calc_daynr"); + + if (y == 0 && month == 0 && day == 0) + DBUG_RETURN(0); /* Skip errors */ + delsum= (long) (365L * y+ 31*(month-1) +day); + if (month <= 2) + y--; + else + delsum-= (long) (month*4+23)/10; + temp=(int) ((y/100+1)*3)/4; + DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld", + y+(month <= 2),month,day,delsum+y/4-temp)); + DBUG_RETURN(delsum+(int) y/4-temp); +} /* calc_daynr */ + + +/* + Convert time in MYSQL_TIME representation in system time zone to its + my_time_t form (number of seconds in UTC since begginning of Unix Epoch). + + SYNOPSIS + my_system_gmt_sec() + t - time value to be converted + my_timezone - pointer to long where offset of system time zone + from UTC will be stored for caching + in_dst_time_gap - set to true if time falls into spring time-gap + + NOTES + The idea is to cache the time zone offset from UTC (including daylight + saving time) for the next call to make things faster. But currently we + just calculate this offset during startup (by calling my_init_time() + function) and use it all the time. + Time value provided should be legal time value (e.g. '2003-01-01 25:00:00' + is not allowed). + + RETURN VALUE + Time in UTC seconds since Unix Epoch representation. +*/ +my_time_t +my_system_gmt_sec(const MYSQL_TIME *t_src, long *my_timezone, + my_bool *in_dst_time_gap) +{ + uint loop; + time_t tmp= 0; + int shift= 0; + MYSQL_TIME tmp_time; + MYSQL_TIME *t= &tmp_time; + struct tm *l_time,tm_tmp; + long diff, current_timezone; + + /* + Use temp variable to avoid trashing input data, which could happen in + case of shift required for boundary dates processing. + */ + memcpy(&tmp_time, t_src, sizeof(MYSQL_TIME)); + + if (!validate_timestamp_range(t)) + return 0; + + /* + Calculate the gmt time based on current time and timezone + The -1 on the end is to ensure that if have a date that exists twice + (like 2002-10-27 02:00:0 MET), we will find the initial date. + + By doing -3600 we will have to call localtime_r() several times, but + I couldn't come up with a better way to get a repeatable result :( + + We can't use mktime() as it's buggy on many platforms and not thread safe. + + Note: this code assumes that our time_t estimation is not too far away + from real value (we assume that localtime_r(tmp) will return something + within 24 hrs from t) which is probably true for all current time zones. + + Note2: For the dates, which have time_t representation close to + MAX_INT32 (efficient time_t limit for supported platforms), we should + do a small trick to avoid overflow. That is, convert the date, which is + two days earlier, and then add these days to the final value. + + The same trick is done for the values close to 0 in time_t + representation for platfroms with unsigned time_t (QNX). + + To be more verbose, here is a sample (extracted from the code below): + (calc_daynr(2038, 1, 19) - (long) days_at_timestart)*86400L + 4*3600L + would return -2147480896 because of the long type overflow. In result + we would get 1901 year in localtime_r(), which is an obvious error. + + Alike problem raises with the dates close to Epoch. E.g. + (calc_daynr(1969, 12, 31) - (long) days_at_timestart)*86400L + 23*3600L + will give -3600. + + On some platforms, (E.g. on QNX) time_t is unsigned and localtime(-3600) + wil give us a date around 2106 year. Which is no good. + + Theoreticaly, there could be problems with the latter conversion: + there are at least two timezones, which had time switches near 1 Jan + of 1970 (because of political reasons). These are America/Hermosillo and + America/Mazatlan time zones. They changed their offset on + 1970-01-01 08:00:00 UTC from UTC-8 to UTC-7. For these zones + the code below will give incorrect results for dates close to + 1970-01-01, in the case OS takes into account these historical switches. + Luckily, it seems that we support only one platform with unsigned + time_t. It's QNX. And QNX does not support historical timezone data at all. + E.g. there are no /usr/share/zoneinfo/ files or any other mean to supply + historical information for localtime_r() etc. That is, the problem is not + relevant to QNX. + + We are safe with shifts close to MAX_INT32, as there are no known + time switches on Jan 2038 yet :) + */ + if ((t->year == TIMESTAMP_MAX_YEAR) && (t->month == 1) && (t->day > 4)) + { + /* + Below we will pass (uint) (t->day - shift) to calc_daynr. + As we don't want to get an overflow here, we will shift + only safe dates. That's why we have (t->day > 4) above. + */ + t->day-= 2; + shift= 2; + } +#ifdef TIME_T_UNSIGNED + else + { + /* + We can get 0 in time_t representaion only on 1969, 31 of Dec or on + 1970, 1 of Jan. For both dates we use shift, which is added + to t->day in order to step out a bit from the border. + This is required for platforms, where time_t is unsigned. + As far as I know, among the platforms we support it's only QNX. + Note: the order of below if-statements is significant. + */ + + if ((t->year == TIMESTAMP_MIN_YEAR + 1) && (t->month == 1) + && (t->day <= 10)) + { + t->day+= 2; + shift= -2; + } + + if ((t->year == TIMESTAMP_MIN_YEAR) && (t->month == 12) + && (t->day == 31)) + { + t->year++; + t->month= 1; + t->day= 2; + shift= -2; + } + } +#endif + + tmp= (time_t) (((calc_daynr((uint) t->year, (uint) t->month, (uint) t->day) - + (long) days_at_timestart)*86400L + (long) t->hour*3600L + + (long) (t->minute*60 + t->second)) + (time_t) my_time_zone - + 3600); + + current_timezone= my_time_zone; + localtime_r(&tmp,&tm_tmp); + l_time=&tm_tmp; + for (loop=0; + loop < 2 && + (t->hour != (uint) l_time->tm_hour || + t->minute != (uint) l_time->tm_min || + t->second != (uint) l_time->tm_sec); + loop++) + { /* One check should be enough ? */ + /* Get difference in days */ + int days= t->day - l_time->tm_mday; + if (days < -1) + days= 1; /* Month has wrapped */ + else if (days > 1) + days= -1; + diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour)) + + (long) (60*((int) t->minute - (int) l_time->tm_min)) + + (long) ((int) t->second - (int) l_time->tm_sec)); + current_timezone+= diff+3600; /* Compensate for -3600 above */ + tmp+= (time_t) diff; + localtime_r(&tmp,&tm_tmp); + l_time=&tm_tmp; + } + /* + Fix that if we are in the non existing daylight saving time hour + we move the start of the next real hour. + + This code doesn't handle such exotical thing as time-gaps whose length + is more than one hour or non-integer (latter can theoretically happen + if one of seconds will be removed due leap correction, or because of + general time correction like it happened for Africa/Monrovia time zone + in year 1972). + */ + if (loop == 2 && t->hour != (uint) l_time->tm_hour) + { + int days= t->day - l_time->tm_mday; + if (days < -1) + days=1; /* Month has wrapped */ + else if (days > 1) + days= -1; + diff=(3600L*(long) (days*24+((int) t->hour - (int) l_time->tm_hour))+ + (long) (60*((int) t->minute - (int) l_time->tm_min)) + + (long) ((int) t->second - (int) l_time->tm_sec)); + if (diff == 3600) + tmp+=3600 - t->minute*60 - t->second; /* Move to next hour */ + else if (diff == -3600) + tmp-=t->minute*60 + t->second; /* Move to previous hour */ + + *in_dst_time_gap= 1; + } + *my_timezone= current_timezone; + + + /* shift back, if we were dealing with boundary dates */ + tmp+= shift*86400L; + + /* + This is possible for dates, which slightly exceed boundaries. + Conversion will pass ok for them, but we don't allow them. + First check will pass for platforms with signed time_t. + instruction above (tmp+= shift*86400L) could exceed + MAX_INT32 (== TIMESTAMP_MAX_VALUE) and overflow will happen. + So, tmp < TIMESTAMP_MIN_VALUE will be triggered. On platfroms + with unsigned time_t tmp+= shift*86400L might result in a number, + larger then TIMESTAMP_MAX_VALUE, so another check will work. + */ + if ((tmp < TIMESTAMP_MIN_VALUE) || (tmp > TIMESTAMP_MAX_VALUE)) + tmp= 0; + + return (my_time_t) tmp; +} /* my_system_gmt_sec */ + + +/* Set MYSQL_TIME structure to 0000-00-00 00:00:00.000000 */ + +void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type) +{ + bzero((void*) tm, sizeof(*tm)); + tm->time_type= time_type; +} + + +/* + Functions to convert time/date/datetime value to a string, + using default format. + This functions don't check that given MYSQL_TIME structure members are + in valid range. If they are not, return value won't reflect any + valid date either. Additionally, make_time doesn't take into + account time->day member: it's assumed that days have been converted + to hours already. + + RETURN + number of characters written to 'to' +*/ + +int my_time_to_str(const MYSQL_TIME *l_time, char *to) +{ + uint extra_hours= 0; + return my_sprintf(to, (to, "%s%02u:%02u:%02u", + (l_time->neg ? "-" : ""), + extra_hours+ l_time->hour, + l_time->minute, + l_time->second)); +} + +int my_date_to_str(const MYSQL_TIME *l_time, char *to) +{ + return my_sprintf(to, (to, "%04u-%02u-%02u", + l_time->year, + l_time->month, + l_time->day)); +} + +int my_datetime_to_str(const MYSQL_TIME *l_time, char *to) +{ + return my_sprintf(to, (to, "%04u-%02u-%02u %02u:%02u:%02u", + l_time->year, + l_time->month, + l_time->day, + l_time->hour, + l_time->minute, + l_time->second)); +} + + +/* + Convert struct DATE/TIME/DATETIME value to string using built-in + MySQL time conversion formats. + + SYNOPSIS + my_TIME_to_string() + + NOTE + The string must have at least MAX_DATE_STRING_REP_LENGTH bytes reserved. +*/ + +int my_TIME_to_str(const MYSQL_TIME *l_time, char *to) +{ + switch (l_time->time_type) { + case MYSQL_TIMESTAMP_DATETIME: + return my_datetime_to_str(l_time, to); + case MYSQL_TIMESTAMP_DATE: + return my_date_to_str(l_time, to); + case MYSQL_TIMESTAMP_TIME: + return my_time_to_str(l_time, to); + case MYSQL_TIMESTAMP_NONE: + case MYSQL_TIMESTAMP_ERROR: + to[0]='\0'; + return 0; + default: + DBUG_ASSERT(0); + return 0; + } +} + + +/* + Convert datetime value specified as number to broken-down TIME + representation and form value of DATETIME type as side-effect. + + SYNOPSIS + number_to_datetime() + nr - datetime value as number + time_res - pointer for structure for broken-down representation + flags - flags to use in validating date, as in str_to_datetime() + was_cut 0 Value ok + 1 If value was cut during conversion + 2 check_date(date,flags) considers date invalid + + DESCRIPTION + Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS, + YYYYMMDDHHMMSS to broken-down MYSQL_TIME representation. Return value in + YYYYMMDDHHMMSS format as side-effect. + + This function also checks if datetime value fits in DATETIME range. + + RETURN VALUE + -1 Timestamp with wrong values + anything else DATETIME as integer in YYYYMMDDHHMMSS format + Datetime value in YYYYMMDDHHMMSS format. +*/ + +longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res, + uint flags, int *was_cut) +{ + long part1,part2; + + *was_cut= 0; + bzero((char*) time_res, sizeof(*time_res)); + time_res->time_type=MYSQL_TIMESTAMP_DATE; + + if (nr == 0LL || nr >= 10000101000000LL) + { + time_res->time_type=MYSQL_TIMESTAMP_DATETIME; + goto ok; + } + if (nr < 101) + goto err; + if (nr <= (YY_PART_YEAR-1)*10000L+1231L) + { + nr= (nr+20000000L)*1000000L; /* YYMMDD, year: 2000-2069 */ + goto ok; + } + if (nr < (YY_PART_YEAR)*10000L+101L) + goto err; + if (nr <= 991231L) + { + nr= (nr+19000000L)*1000000L; /* YYMMDD, year: 1970-1999 */ + goto ok; + } + if (nr < 10000101L) + goto err; + if (nr <= 99991231L) + { + nr= nr*1000000L; + goto ok; + } + if (nr < 101000000L) + goto err; + + time_res->time_type=MYSQL_TIMESTAMP_DATETIME; + + if (nr <= (YY_PART_YEAR-1)*10000000000LL+1231235959LL) + { + nr= nr+20000000000000LL; /* YYMMDDHHMMSS, 2000-2069 */ + goto ok; + } + if (nr < YY_PART_YEAR*10000000000LL+ 101000000LL) + goto err; + if (nr <= 991231235959LL) + nr= nr+19000000000000LL; /* YYMMDDHHMMSS, 1970-1999 */ + + ok: + part1=(long) (nr/1000000LL); + part2=(long) (nr - (longlong) part1*1000000LL); + time_res->year= (int) (part1/10000L); part1%=10000L; + time_res->month= (int) part1 / 100; + time_res->day= (int) part1 % 100; + time_res->hour= (int) (part2/10000L); part2%=10000L; + time_res->minute=(int) part2 / 100; + time_res->second=(int) part2 % 100; + + if (time_res->year <= 9999 && time_res->month <= 12 && + time_res->day <= 31 && time_res->hour <= 23 && + time_res->minute <= 59 && time_res->second <= 59 && + !check_date(time_res, (nr != 0), flags, was_cut)) + return nr; + + /* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */ + if (!nr && (flags & TIME_NO_ZERO_DATE)) + return -1LL; + + err: + *was_cut= 1; + return -1LL; +} + + +/* Convert time value to integer in YYYYMMDDHHMMSS format */ + +ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time) +{ + return ((ulonglong) (my_time->year * 10000UL + + my_time->month * 100UL + + my_time->day) * 1000000ULL + + (ulonglong) (my_time->hour * 10000UL + + my_time->minute * 100UL + + my_time->second)); +} + + +/* Convert MYSQL_TIME value to integer in YYYYMMDD format */ + +ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time) +{ + return (ulonglong) (my_time->year * 10000UL + my_time->month * 100UL + + my_time->day); +} + + +/* + Convert MYSQL_TIME value to integer in HHMMSS format. + This function doesn't take into account time->day member: + it's assumed that days have been converted to hours already. +*/ + +ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time) +{ + return (ulonglong) (my_time->hour * 10000UL + + my_time->minute * 100UL + + my_time->second); +} + + +/* + Convert struct MYSQL_TIME (date and time split into year/month/day/hour/... + to a number in format YYYYMMDDHHMMSS (DATETIME), + YYYYMMDD (DATE) or HHMMSS (TIME). + + SYNOPSIS + TIME_to_ulonglong() + + DESCRIPTION + The function is used when we need to convert value of time item + to a number if it's used in numeric context, i. e.: + SELECT NOW()+1, CURDATE()+0, CURTIMIE()+0; + SELECT ?+1; + + NOTE + This function doesn't check that given MYSQL_TIME structure members are + in valid range. If they are not, return value won't reflect any + valid date either. +*/ + +ulonglong TIME_to_ulonglong(const MYSQL_TIME *my_time) +{ + switch (my_time->time_type) { + case MYSQL_TIMESTAMP_DATETIME: + return TIME_to_ulonglong_datetime(my_time); + case MYSQL_TIMESTAMP_DATE: + return TIME_to_ulonglong_date(my_time); + case MYSQL_TIMESTAMP_TIME: + return TIME_to_ulonglong_time(my_time); + case MYSQL_TIMESTAMP_NONE: + case MYSQL_TIMESTAMP_ERROR: + return 0ULL; + default: + DBUG_ASSERT(0); + } + return 0; +} + diff --git a/externals/mysql/libmysql/net_serv.c b/externals/mysql/libmysql/net_serv.c new file mode 100644 index 0000000..7dd224b --- /dev/null +++ b/externals/mysql/libmysql/net_serv.c @@ -0,0 +1,1177 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file + + This file is the net layer API for the MySQL client/server protocol, + which is a tightly coupled, proprietary protocol owned by MySQL AB. + @note + Any re-implementations of this protocol must also be under GPL + unless one has got an license from MySQL AB stating otherwise. + + Write and read of logical packets to/from socket. + + Writes are cached into net_buffer_length big packets. + Read packets are reallocated dynamicly when reading big packets. + Each logical packet has the following pre-info: + 3 byte length & 1 byte package-number. + + This file needs to be written in C as it's used by the libmysql client as a + C file. +*/ + +/* + HFTODO this must be hidden if we don't want client capabilities in + embedded library + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef __NETWARE__ +#include +#endif + +#ifdef EMBEDDED_LIBRARY +#undef MYSQL_SERVER +#undef MYSQL_CLIENT +#define MYSQL_CLIENT +#endif /*EMBEDDED_LIBRARY */ + +#ifdef HAVE_DTRACE +/* Limit DTrace probes to server code for now */ +#ifndef MYSQL_SERVER +#undef _DTRACE_VERSION +#endif +#endif +#include "probes.h" + +/* + The following handles the differences when this is linked between the + client and the server. + + This gives an error if a too big packet is found + The server can change this with the -O switch, but because the client + can't normally do this the client should have a bigger max_allowed_packet. +*/ + +#if defined(__WIN__) || !defined(MYSQL_SERVER) + /* The following is because alarms doesn't work on windows. */ +#define NO_ALARM +#endif + +#ifndef NO_ALARM +#include "my_pthread.h" +void sql_print_error(const char *format,...); +#else +#define DONT_USE_THR_ALARM +#endif /* NO_ALARM */ + +#include "thr_alarm.h" + +#ifdef MYSQL_SERVER +/* + The following variables/functions should really not be declared + extern, but as it's hard to include mysql_priv.h here, we have to + live with this for a while. +*/ +extern uint test_flags; +extern ulong bytes_sent, bytes_received, net_big_packet_count; +#ifndef MYSQL_INSTANCE_MANAGER +#ifdef HAVE_QUERY_CACHE +#define USE_QUERY_CACHE +extern void query_cache_insert(const char *packet, ulong length, + unsigned pkt_nr); +#endif // HAVE_QUERY_CACHE +#define update_statistics(A) A +#endif /* MYSQL_INSTANCE_MANGER */ +#endif /* defined(MYSQL_SERVER) && !defined(MYSQL_INSTANCE_MANAGER) */ + +#if !defined(MYSQL_SERVER) || defined(MYSQL_INSTANCE_MANAGER) +#define update_statistics(A) +#define thd_increment_bytes_sent(N) +#endif + +#define TEST_BLOCKING 8 +#define MAX_PACKET_LENGTH (256L*256L*256L-1) + +static my_bool net_write_buff(NET *net,const uchar *packet,ulong len); + + +/** Init with packet info. */ + +my_bool my_net_init(NET *net, Vio* vio) +{ + DBUG_ENTER("my_net_init"); + net->vio = vio; + my_net_local_init(net); /* Set some limits */ + if (!(net->buff=(uchar*) my_malloc((size_t) net->max_packet+ + NET_HEADER_SIZE + COMP_HEADER_SIZE, + MYF(MY_WME)))) + DBUG_RETURN(1); + net->buff_end=net->buff+net->max_packet; + net->error=0; net->return_status=0; + net->pkt_nr=net->compress_pkt_nr=0; + net->write_pos=net->read_pos = net->buff; + net->last_error[0]=0; + net->compress=0; net->reading_or_writing=0; + net->where_b = net->remain_in_buf=0; + net->last_errno=0; + net->unused= 0; + + if (vio != 0) /* If real connection */ + { + net->fd = vio_fd(vio); /* For perl DBI/DBD */ +#if defined(MYSQL_SERVER) && !defined(__WIN__) + if (!(test_flags & TEST_BLOCKING)) + { + my_bool old_mode; + vio_blocking(vio, FALSE, &old_mode); + } +#endif + vio_fastsend(vio); + } + DBUG_RETURN(0); +} + + +void net_end(NET *net) +{ + DBUG_ENTER("net_end"); + my_free(net->buff,MYF(MY_ALLOW_ZERO_PTR)); + net->buff=0; + DBUG_VOID_RETURN; +} + + +/** Realloc the packet buffer. */ + +my_bool net_realloc(NET *net, size_t length) +{ + uchar *buff; + size_t pkt_length; + DBUG_ENTER("net_realloc"); + DBUG_PRINT("enter",("length: %lu", (ulong) length)); + + if (length >= net->max_packet_size) + { + DBUG_PRINT("error", ("Packet too large. Max size: %lu", + net->max_packet_size)); + /* @todo: 1 and 2 codes are identical. */ + net->error= 1; + net->last_errno= ER_NET_PACKET_TOO_LARGE; +#ifdef MYSQL_SERVER + my_error(ER_NET_PACKET_TOO_LARGE, MYF(0)); +#endif + DBUG_RETURN(1); + } + pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1); + /* + We must allocate some extra bytes for the end 0 and to be able to + read big compressed blocks + */ + if (!(buff= (uchar*) my_realloc((char*) net->buff, pkt_length + + NET_HEADER_SIZE + COMP_HEADER_SIZE, + MYF(MY_WME)))) + { + /* @todo: 1 and 2 codes are identical. */ + net->error= 1; + net->last_errno= ER_OUT_OF_RESOURCES; + /* In the server the error is reported by MY_WME flag. */ + DBUG_RETURN(1); + } + net->buff=net->write_pos=buff; + net->buff_end=buff+(net->max_packet= (ulong) pkt_length); + DBUG_RETURN(0); +} + + +/** + Check if there is any data to be read from the socket. + + @param sd socket descriptor + + @retval + 0 No data to read + @retval + 1 Data or EOF to read + @retval + -1 Don't know if data is ready or not +*/ + +#if !defined(EMBEDDED_LIBRARY) + +static int net_data_is_ready(my_socket sd) +{ +#ifdef HAVE_POLL + struct pollfd ufds; + int res; + + ufds.fd= sd; + ufds.events= POLLIN | POLLPRI; + if (!(res= poll(&ufds, 1, 0))) + return 0; + if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI))) + return 0; + return 1; +#else + fd_set sfds; + struct timeval tv; + int res; + +#ifndef __WIN__ + /* Windows uses an _array_ of 64 fd's as default, so it's safe */ + if (sd >= FD_SETSIZE) + return -1; +#define NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE +#endif + + FD_ZERO(&sfds); + FD_SET(sd, &sfds); + + tv.tv_sec= tv.tv_usec= 0; + + if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0) + return 0; + else + return test(res ? FD_ISSET(sd, &sfds) : 0); +#endif /* HAVE_POLL */ +} + +#endif /* EMBEDDED_LIBRARY */ + +/** + Remove unwanted characters from connection + and check if disconnected. + + Read from socket until there is nothing more to read. Discard + what is read. + + If there is anything when to read 'net_clear' is called this + normally indicates an error in the protocol. + + When connection is properly closed (for TCP it means with + a FIN packet), then select() considers a socket "ready to read", + in the sense that there's EOF to read, but read() returns 0. + + @param net NET handler + @param clear_buffer if <> 0, then clear all data from comm buff +*/ + +void net_clear(NET *net, my_bool clear_buffer) +{ +#if !defined(EMBEDDED_LIBRARY) + size_t count; + int ready; +#endif + DBUG_ENTER("net_clear"); + +#if !defined(EMBEDDED_LIBRARY) + if (clear_buffer) + { + while ((ready= net_data_is_ready(net->vio->sd)) > 0) + { + /* The socket is ready */ + if ((long) (count= vio_read(net->vio, net->buff, + (size_t) net->max_packet)) > 0) + { + DBUG_PRINT("info",("skipped %ld bytes from file: %s", + (long) count, vio_description(net->vio))); +#if defined(EXTRA_DEBUG) + fprintf(stderr,"Note: net_clear() skipped %ld bytes from file: %s\n", + (long) count, vio_description(net->vio)); +#endif + } + else + { + DBUG_PRINT("info",("socket ready but only EOF to read - disconnected")); + net->error= 2; + break; + } + } +#ifdef NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE + /* 'net_data_is_ready' returned "don't know" */ + if (ready == -1) + { + /* Read unblocking to clear net */ + my_bool old_mode; + if (!vio_blocking(net->vio, FALSE, &old_mode)) + { + while ((long) (count= vio_read(net->vio, net->buff, + (size_t) net->max_packet)) > 0) + DBUG_PRINT("info",("skipped %ld bytes from file: %s", + (long) count, vio_description(net->vio))); + vio_blocking(net->vio, TRUE, &old_mode); + } + } +#endif /* NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE */ + } +#endif /* EMBEDDED_LIBRARY */ + net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */ + net->write_pos=net->buff; + DBUG_VOID_RETURN; +} + + +/** Flush write_buffer if not empty. */ + +my_bool net_flush(NET *net) +{ + my_bool error= 0; + DBUG_ENTER("net_flush"); + if (net->buff != net->write_pos) + { + error=test(net_real_write(net, net->buff, + (size_t) (net->write_pos - net->buff))); + net->write_pos=net->buff; + } + /* Sync packet number if using compression */ + if (net->compress) + net->pkt_nr=net->compress_pkt_nr; + DBUG_RETURN(error); +} + + +/***************************************************************************** +** Write something to server/client buffer +*****************************************************************************/ + +/** + Write a logical packet with packet header. + + Format: Packet length (3 bytes), packet number(1 byte) + When compression is used a 3 byte compression length is added + + @note + If compression is used the original package is modified! +*/ + +my_bool +my_net_write(NET *net,const uchar *packet,size_t len) +{ + uchar buff[NET_HEADER_SIZE]; + my_bool rc; + if (unlikely(!net->vio)) /* nowhere to write */ + return 0; + + MYSQL_NET_WRITE_START(len); + + /* + Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH + length. The last packet is always a packet that is < MAX_PACKET_LENGTH. + (The last packet may even have a length of 0) + */ + while (len >= MAX_PACKET_LENGTH) + { + const ulong z_size = MAX_PACKET_LENGTH; + int3store(buff, z_size); + buff[3]= (uchar) net->pkt_nr++; + if (net_write_buff(net, buff, NET_HEADER_SIZE) || + net_write_buff(net, packet, z_size)) + { + MYSQL_NET_WRITE_DONE(1); + return 1; + } + packet += z_size; + len-= z_size; + } + /* Write last packet */ + int3store(buff,len); + buff[3]= (uchar) net->pkt_nr++; + if (net_write_buff(net, buff, NET_HEADER_SIZE)) + { + MYSQL_NET_WRITE_DONE(1); + return 1; + } +#ifndef DEBUG_DATA_PACKETS + DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE); +#endif + rc= test(net_write_buff(net,packet,len)); + MYSQL_NET_WRITE_DONE(rc); + return rc; +} + +/** + Send a command to the server. + + The reason for having both header and packet is so that libmysql + can easy add a header to a special command (like prepared statements) + without having to re-alloc the string. + + As the command is part of the first data packet, we have to do some data + juggling to put the command in there, without having to create a new + packet. + + This function will split big packets into sub-packets if needed. + (Each sub packet can only be 2^24 bytes) + + @param net NET handler + @param command Command in MySQL server (enum enum_server_command) + @param header Header to write after command + @param head_len Length of header + @param packet Query or parameter to query + @param len Length of packet + + @retval + 0 ok + @retval + 1 error +*/ + +my_bool +net_write_command(NET *net,uchar command, + const uchar *header, size_t head_len, + const uchar *packet, size_t len) +{ + ulong length=len+1+head_len; /* 1 extra byte for command */ + uchar buff[NET_HEADER_SIZE+1]; + uint header_size=NET_HEADER_SIZE+1; + my_bool rc; + DBUG_ENTER("net_write_command"); + DBUG_PRINT("enter",("length: %lu", (ulong) len)); + + MYSQL_NET_WRITE_START(length); + + buff[4]=command; /* For first packet */ + + if (length >= MAX_PACKET_LENGTH) + { + /* Take into account that we have the command in the first header */ + len= MAX_PACKET_LENGTH - 1 - head_len; + do + { + int3store(buff, MAX_PACKET_LENGTH); + buff[3]= (uchar) net->pkt_nr++; + if (net_write_buff(net, buff, header_size) || + net_write_buff(net, header, head_len) || + net_write_buff(net, packet, len)) + { + MYSQL_NET_WRITE_DONE(1); + DBUG_RETURN(1); + } + packet+= len; + length-= MAX_PACKET_LENGTH; + len= MAX_PACKET_LENGTH; + head_len= 0; + header_size= NET_HEADER_SIZE; + } while (length >= MAX_PACKET_LENGTH); + len=length; /* Data left to be written */ + } + int3store(buff,length); + buff[3]= (uchar) net->pkt_nr++; + rc= test(net_write_buff(net, buff, header_size) || + (head_len && net_write_buff(net, header, head_len)) || + net_write_buff(net, packet, len) || net_flush(net)); + MYSQL_NET_WRITE_DONE(rc); + DBUG_RETURN(rc); +} + +/** + Caching the data in a local buffer before sending it. + + Fill up net->buffer and send it to the client when full. + + If the rest of the to-be-sent-packet is bigger than buffer, + send it in one big block (to avoid copying to internal buffer). + If not, copy the rest of the data to the buffer and return without + sending data. + + @param net Network handler + @param packet Packet to send + @param len Length of packet + + @note + The cached buffer can be sent as it is with 'net_flush()'. + In this code we have to be careful to not send a packet longer than + MAX_PACKET_LENGTH to net_real_write() if we are using the compressed + protocol as we store the length of the compressed packet in 3 bytes. + + @retval + 0 ok + @retval + 1 +*/ + +static my_bool +net_write_buff(NET *net, const uchar *packet, ulong len) +{ + ulong left_length; + if (net->compress && net->max_packet > MAX_PACKET_LENGTH) + left_length= MAX_PACKET_LENGTH - (net->write_pos - net->buff); + else + left_length= (ulong) (net->buff_end - net->write_pos); + +#ifdef DEBUG_DATA_PACKETS + DBUG_DUMP("data", packet, len); +#endif + if (len > left_length) + { + if (net->write_pos != net->buff) + { + /* Fill up already used packet and write it */ + memcpy((char*) net->write_pos,packet,left_length); + if (net_real_write(net, net->buff, + (size_t) (net->write_pos - net->buff) + left_length)) + return 1; + net->write_pos= net->buff; + packet+= left_length; + len-= left_length; + } + if (net->compress) + { + /* + We can't have bigger packets than 16M with compression + Because the uncompressed length is stored in 3 bytes + */ + left_length= MAX_PACKET_LENGTH; + while (len > left_length) + { + if (net_real_write(net, packet, left_length)) + return 1; + packet+= left_length; + len-= left_length; + } + } + if (len > net->max_packet) + return net_real_write(net, packet, len) ? 1 : 0; + /* Send out rest of the blocks as full sized blocks */ + } + memcpy((char*) net->write_pos,packet,len); + net->write_pos+= len; + return 0; +} + + +/** + Read and write one packet using timeouts. + If needed, the packet is compressed before sending. + + @todo + - TODO is it needed to set this variable if we have no socket +*/ + +int +net_real_write(NET *net,const uchar *packet, size_t len) +{ + size_t length; + const uchar *pos,*end; + thr_alarm_t alarmed; +#ifndef NO_ALARM + ALARM alarm_buff; +#endif + uint retry_count=0; + my_bool net_blocking = vio_is_blocking(net->vio); + DBUG_ENTER("net_real_write"); + +#if defined(MYSQL_SERVER) && defined(USE_QUERY_CACHE) + query_cache_insert((char*) packet, len, net->pkt_nr); +#endif + + if (net->error == 2) + DBUG_RETURN(-1); /* socket can't be used */ + + net->reading_or_writing=2; +#ifdef HAVE_COMPRESS + if (net->compress) + { + size_t complen; + uchar *b; + uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE; + if (!(b= (uchar*) my_malloc(len + NET_HEADER_SIZE + + COMP_HEADER_SIZE, MYF(MY_WME)))) + { + net->error= 2; + net->last_errno= ER_OUT_OF_RESOURCES; + /* In the server, the error is reported by MY_WME flag. */ + net->reading_or_writing= 0; + DBUG_RETURN(1); + } + memcpy(b+header_length,packet,len); + + if (my_compress(b+header_length, &len, &complen)) + complen=0; + int3store(&b[NET_HEADER_SIZE],complen); + int3store(b,len); + b[3]=(uchar) (net->compress_pkt_nr++); + len+= header_length; + packet= b; + } +#endif /* HAVE_COMPRESS */ + +#ifdef DEBUG_DATA_PACKETS + DBUG_DUMP("data", packet, len); +#endif + +#ifndef NO_ALARM + thr_alarm_init(&alarmed); + if (net_blocking) + thr_alarm(&alarmed, net->write_timeout, &alarm_buff); +#else + alarmed=0; + /* Write timeout is set in my_net_set_write_timeout */ +#endif /* NO_ALARM */ + + pos= packet; + end=pos+len; + while (pos != end) + { + if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) + { + my_bool interrupted = vio_should_retry(net->vio); +#if !defined(__WIN__) + if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed)) + { + if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff)) + { /* Always true for client */ + my_bool old_mode; + while (vio_blocking(net->vio, TRUE, &old_mode) < 0) + { + if (vio_should_retry(net->vio) && retry_count++ < net->retry_count) + continue; +#ifdef EXTRA_DEBUG + fprintf(stderr, + "%s: my_net_write: fcntl returned error %d, aborting thread\n", + my_progname,vio_errno(net->vio)); +#endif /* EXTRA_DEBUG */ + net->error= 2; /* Close socket */ + net->last_errno= ER_NET_PACKET_TOO_LARGE; +#ifdef MYSQL_SERVER + my_error(ER_NET_PACKET_TOO_LARGE, MYF(0)); +#endif + goto end; + } + retry_count=0; + continue; + } + } + else +#endif /* !defined(__WIN__) */ + if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) && + interrupted) + { + if (retry_count++ < net->retry_count) + continue; +#ifdef EXTRA_DEBUG + fprintf(stderr, "%s: write looped, aborting thread\n", + my_progname); +#endif /* EXTRA_DEBUG */ + } +#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) + if (vio_errno(net->vio) == SOCKET_EINTR) + { + DBUG_PRINT("warning",("Interrupted write. Retrying...")); + continue; + } +#endif /* defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) */ + net->error= 2; /* Close socket */ + net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED : + ER_NET_ERROR_ON_WRITE); +#ifdef MYSQL_SERVER + my_error(net->last_errno, MYF(0)); +#endif /* MYSQL_SERVER */ + break; + } + pos+=length; + update_statistics(thd_increment_bytes_sent(length)); + } +#ifndef __WIN__ + end: +#endif +#ifdef HAVE_COMPRESS + if (net->compress) + my_free((char*) packet,MYF(0)); +#endif + if (thr_alarm_in_use(&alarmed)) + { + my_bool old_mode; + thr_end_alarm(&alarmed); + vio_blocking(net->vio, net_blocking, &old_mode); + } + net->reading_or_writing=0; + DBUG_RETURN(((int) (pos != end))); +} + + +/***************************************************************************** +** Read something from server/clinet +*****************************************************************************/ + +#ifndef NO_ALARM + +static my_bool net_safe_read(NET *net, uchar *buff, size_t length, + thr_alarm_t *alarmed) +{ + uint retry_count=0; + while (length > 0) + { + size_t tmp; + if ((long) (tmp= vio_read(net->vio, buff, length)) <= 0) + { + my_bool interrupted = vio_should_retry(net->vio); + if (!thr_got_alarm(alarmed) && interrupted) + { /* Probably in MIT threads */ + if (retry_count++ < net->retry_count) + continue; + } + return 1; + } + length-= tmp; + buff+= tmp; + } + return 0; +} + +/** + Help function to clear the commuication buffer when we get a too big packet. + + @param net Communication handle + @param remain Bytes to read + @param alarmed Parameter for thr_alarm() + @param alarm_buff Parameter for thr_alarm() + + @retval + 0 Was able to read the whole packet + @retval + 1 Got mailformed packet from client +*/ + +static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed, + ALARM *alarm_buff) +{ + uint32 old=remain; + DBUG_ENTER("my_net_skip_rest"); + DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain)); + + /* The following is good for debugging */ + update_statistics(thd_increment_net_big_packet_count(1)); + + if (!thr_alarm_in_use(alarmed)) + { + my_bool old_mode; + if (thr_alarm(alarmed,net->read_timeout, alarm_buff) || + vio_blocking(net->vio, TRUE, &old_mode) < 0) + DBUG_RETURN(1); /* Can't setup, abort */ + } + for (;;) + { + while (remain > 0) + { + size_t length= min(remain, net->max_packet); + if (net_safe_read(net, net->buff, length, alarmed)) + DBUG_RETURN(1); + update_statistics(thd_increment_bytes_received(length)); + remain -= (uint32) length; + } + if (old != MAX_PACKET_LENGTH) + break; + if (net_safe_read(net, net->buff, NET_HEADER_SIZE, alarmed)) + DBUG_RETURN(1); + old=remain= uint3korr(net->buff); + net->pkt_nr++; + } + DBUG_RETURN(0); +} +#endif /* NO_ALARM */ + + +/** + Reads one packet to net->buff + net->where_b. + Long packets are handled by my_net_read(). + This function reallocates the net->buff buffer if necessary. + + @return + Returns length of packet. +*/ + +static ulong +my_real_read(NET *net, size_t *complen) +{ + uchar *pos; + size_t length; + uint i,retry_count=0; + ulong len=packet_error; + thr_alarm_t alarmed; +#ifndef NO_ALARM + ALARM alarm_buff; +#endif + my_bool net_blocking=vio_is_blocking(net->vio); + uint32 remain= (net->compress ? NET_HEADER_SIZE+COMP_HEADER_SIZE : + NET_HEADER_SIZE); + *complen = 0; + + net->reading_or_writing=1; + thr_alarm_init(&alarmed); +#ifndef NO_ALARM + if (net_blocking) + thr_alarm(&alarmed,net->read_timeout,&alarm_buff); +#else + /* Read timeout is set in my_net_set_read_timeout */ +#endif /* NO_ALARM */ + + pos = net->buff + net->where_b; /* net->packet -4 */ + for (i=0 ; i < 2 ; i++) + { + while (remain > 0) + { + /* First read is done with non blocking mode */ + if ((long) (length= vio_read(net->vio, pos, remain)) <= 0L) + { + my_bool interrupted = vio_should_retry(net->vio); + + DBUG_PRINT("info",("vio_read returned %ld errno: %d", + (long) length, vio_errno(net->vio))); +#if !defined(__WIN__) || defined(MYSQL_SERVER) + /* + We got an error that there was no data on the socket. We now set up + an alarm to not 'read forever', change the socket to non blocking + mode and try again + */ + if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed)) + { + if (!thr_alarm(&alarmed,net->read_timeout,&alarm_buff)) /* Don't wait too long */ + { + my_bool old_mode; + while (vio_blocking(net->vio, TRUE, &old_mode) < 0) + { + if (vio_should_retry(net->vio) && + retry_count++ < net->retry_count) + continue; + DBUG_PRINT("error", + ("fcntl returned error %d, aborting thread", + vio_errno(net->vio))); +#ifdef EXTRA_DEBUG + fprintf(stderr, + "%s: read: fcntl returned error %d, aborting thread\n", + my_progname,vio_errno(net->vio)); +#endif /* EXTRA_DEBUG */ + len= packet_error; + net->error= 2; /* Close socket */ + net->last_errno= ER_NET_FCNTL_ERROR; +#ifdef MYSQL_SERVER + my_error(ER_NET_FCNTL_ERROR, MYF(0)); +#endif + goto end; + } + retry_count=0; + continue; + } + } +#endif /* (!defined(__WIN__) || defined(MYSQL_SERVER) */ + if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) && + interrupted) + { /* Probably in MIT threads */ + if (retry_count++ < net->retry_count) + continue; +#ifdef EXTRA_DEBUG + fprintf(stderr, "%s: read looped with error %d, aborting thread\n", + my_progname,vio_errno(net->vio)); +#endif /* EXTRA_DEBUG */ + } +#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER) + if (vio_errno(net->vio) == SOCKET_EINTR) + { + DBUG_PRINT("warning",("Interrupted read. Retrying...")); + continue; + } +#endif + DBUG_PRINT("error",("Couldn't read packet: remain: %u errno: %d length: %ld", + remain, vio_errno(net->vio), (long) length)); + len= packet_error; + net->error= 2; /* Close socket */ + net->last_errno= (vio_was_interrupted(net->vio) ? + ER_NET_READ_INTERRUPTED : + ER_NET_READ_ERROR); +#ifdef MYSQL_SERVER + my_error(net->last_errno, MYF(0)); +#endif + goto end; + } + remain -= (uint32) length; + pos+= length; + update_statistics(thd_increment_bytes_received(length)); + } + if (i == 0) + { /* First parts is packet length */ + ulong helping; + DBUG_DUMP("packet_header", net->buff+net->where_b, + NET_HEADER_SIZE); + if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr) + { + if (net->buff[net->where_b] != (uchar) 255) + { + DBUG_PRINT("error", + ("Packets out of order (Found: %d, expected %u)", + (int) net->buff[net->where_b + 3], + net->pkt_nr)); +#ifdef EXTRA_DEBUG + fflush(stdout); + fprintf(stderr,"Error: Packets out of order (Found: %d, expected %d)\n", + (int) net->buff[net->where_b + 3], + (uint) (uchar) net->pkt_nr); + fflush(stderr); + DBUG_ASSERT(0); +#endif + } + len= packet_error; + /* Not a NET error on the client. XXX: why? */ +#ifdef MYSQL_SERVER + my_error(ER_NET_PACKETS_OUT_OF_ORDER, MYF(0)); +#endif + goto end; + } + net->compress_pkt_nr= ++net->pkt_nr; +#ifdef HAVE_COMPRESS + if (net->compress) + { + /* + If the packet is compressed then complen > 0 and contains the + number of bytes in the uncompressed packet + */ + *complen=uint3korr(&(net->buff[net->where_b + NET_HEADER_SIZE])); + } +#endif + + len=uint3korr(net->buff+net->where_b); + if (!len) /* End of big multi-packet */ + goto end; + helping = max(len,*complen) + net->where_b; + /* The necessary size of net->buff */ + if (helping >= net->max_packet) + { + if (net_realloc(net,helping)) + { +#if defined(MYSQL_SERVER) && !defined(NO_ALARM) + if (!net->compress && + !my_net_skip_rest(net, (uint32) len, &alarmed, &alarm_buff)) + net->error= 3; /* Successfully skiped packet */ +#endif + len= packet_error; /* Return error and close connection */ + goto end; + } + } + pos=net->buff + net->where_b; + remain = (uint32) len; + } + } + +end: + if (thr_alarm_in_use(&alarmed)) + { + my_bool old_mode; + thr_end_alarm(&alarmed); + vio_blocking(net->vio, net_blocking, &old_mode); + } + net->reading_or_writing=0; +#ifdef DEBUG_DATA_PACKETS + if (len != packet_error) + DBUG_DUMP("data", net->buff+net->where_b, len); +#endif + return(len); +} + + +/** + Read a packet from the client/server and return it without the internal + package header. + + If the packet is the first packet of a multi-packet packet + (which is indicated by the length of the packet = 0xffffff) then + all sub packets are read and concatenated. + + If the packet was compressed, its uncompressed and the length of the + uncompressed packet is returned. + + @return + The function returns the length of the found packet or packet_error. + net->read_pos points to the read data. +*/ + +ulong +my_net_read(NET *net) +{ + size_t len, complen; + + MYSQL_NET_READ_START(); + +#ifdef HAVE_COMPRESS + if (!net->compress) + { +#endif + len = my_real_read(net,&complen); + if (len == MAX_PACKET_LENGTH) + { + /* First packet of a multi-packet. Concatenate the packets */ + ulong save_pos = net->where_b; + size_t total_length= 0; + do + { + net->where_b += len; + total_length += len; + len = my_real_read(net,&complen); + } while (len == MAX_PACKET_LENGTH); + if (len != packet_error) + len+= total_length; + net->where_b = save_pos; + } + net->read_pos = net->buff + net->where_b; + if (len != packet_error) + net->read_pos[len]=0; /* Safeguard for mysql_use_result */ + MYSQL_NET_READ_DONE(0, len); + return len; +#ifdef HAVE_COMPRESS + } + else + { + /* We are using the compressed protocol */ + + ulong buf_length; + ulong start_of_packet; + ulong first_packet_offset; + uint read_length, multi_byte_packet=0; + + if (net->remain_in_buf) + { + buf_length= net->buf_length; /* Data left in old packet */ + first_packet_offset= start_of_packet= (net->buf_length - + net->remain_in_buf); + /* Restore the character that was overwritten by the end 0 */ + net->buff[start_of_packet]= net->save_char; + } + else + { + /* reuse buffer, as there is nothing in it that we need */ + buf_length= start_of_packet= first_packet_offset= 0; + } + for (;;) + { + ulong packet_len; + + if (buf_length - start_of_packet >= NET_HEADER_SIZE) + { + read_length = uint3korr(net->buff+start_of_packet); + if (!read_length) + { + /* End of multi-byte packet */ + start_of_packet += NET_HEADER_SIZE; + break; + } + if (read_length + NET_HEADER_SIZE <= buf_length - start_of_packet) + { + if (multi_byte_packet) + { + /* Remove packet header for second packet */ + memmove(net->buff + first_packet_offset + start_of_packet, + net->buff + first_packet_offset + start_of_packet + + NET_HEADER_SIZE, + buf_length - start_of_packet); + start_of_packet += read_length; + buf_length -= NET_HEADER_SIZE; + } + else + start_of_packet+= read_length + NET_HEADER_SIZE; + + if (read_length != MAX_PACKET_LENGTH) /* last package */ + { + multi_byte_packet= 0; /* No last zero len packet */ + break; + } + multi_byte_packet= NET_HEADER_SIZE; + /* Move data down to read next data packet after current one */ + if (first_packet_offset) + { + memmove(net->buff,net->buff+first_packet_offset, + buf_length-first_packet_offset); + buf_length-=first_packet_offset; + start_of_packet -= first_packet_offset; + first_packet_offset=0; + } + continue; + } + } + /* Move data down to read next data packet after current one */ + if (first_packet_offset) + { + memmove(net->buff,net->buff+first_packet_offset, + buf_length-first_packet_offset); + buf_length-=first_packet_offset; + start_of_packet -= first_packet_offset; + first_packet_offset=0; + } + + net->where_b=buf_length; + if ((packet_len = my_real_read(net,&complen)) == packet_error) + { + MYSQL_NET_READ_DONE(1, 0); + return packet_error; + } + if (my_uncompress(net->buff + net->where_b, packet_len, + &complen)) + { + net->error= 2; /* caller will close socket */ + net->last_errno= ER_NET_UNCOMPRESS_ERROR; +#ifdef MYSQL_SERVER + my_error(ER_NET_UNCOMPRESS_ERROR, MYF(0)); +#endif + MYSQL_NET_READ_DONE(1, 0); + return packet_error; + } + buf_length+= complen; + } + + net->read_pos= net->buff+ first_packet_offset + NET_HEADER_SIZE; + net->buf_length= buf_length; + net->remain_in_buf= (ulong) (buf_length - start_of_packet); + len = ((ulong) (start_of_packet - first_packet_offset) - NET_HEADER_SIZE - + multi_byte_packet); + net->save_char= net->read_pos[len]; /* Must be saved */ + net->read_pos[len]=0; /* Safeguard for mysql_use_result */ + } +#endif /* HAVE_COMPRESS */ + MYSQL_NET_READ_DONE(0, len); + return len; +} + + +void my_net_set_read_timeout(NET *net, uint timeout) +{ + DBUG_ENTER("my_net_set_read_timeout"); + DBUG_PRINT("enter", ("timeout: %d", timeout)); + net->read_timeout= timeout; +#ifdef NO_ALARM + if (net->vio) + vio_timeout(net->vio, 0, timeout); +#endif + DBUG_VOID_RETURN; +} + + +void my_net_set_write_timeout(NET *net, uint timeout) +{ + DBUG_ENTER("my_net_set_write_timeout"); + DBUG_PRINT("enter", ("timeout: %d", timeout)); + net->write_timeout= timeout; +#ifdef NO_ALARM + if (net->vio) + vio_timeout(net->vio, 1, timeout); +#endif + DBUG_VOID_RETURN; +} diff --git a/externals/mysql/libmysql/pack.c b/externals/mysql/libmysql/pack.c new file mode 100644 index 0000000..02b117f --- /dev/null +++ b/externals/mysql/libmysql/pack.c @@ -0,0 +1,119 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include + +/* Get the length of next field. Change parameter to point at fieldstart */ +ulong STDCALL net_field_length(uchar **packet) +{ + reg1 uchar *pos= (uchar *)*packet; + if (*pos < 251) + { + (*packet)++; + return (ulong) *pos; + } + if (*pos == 251) + { + (*packet)++; + return NULL_LENGTH; + } + if (*pos == 252) + { + (*packet)+=3; + return (ulong) uint2korr(pos+1); + } + if (*pos == 253) + { + (*packet)+=4; + return (ulong) uint3korr(pos+1); + } + (*packet)+=9; /* Must be 254 when here */ + return (ulong) uint4korr(pos+1); +} + +/* The same as above but returns longlong */ +my_ulonglong net_field_length_ll(uchar **packet) +{ + reg1 uchar *pos= *packet; + if (*pos < 251) + { + (*packet)++; + return (my_ulonglong) *pos; + } + if (*pos == 251) + { + (*packet)++; + return (my_ulonglong) NULL_LENGTH; + } + if (*pos == 252) + { + (*packet)+=3; + return (my_ulonglong) uint2korr(pos+1); + } + if (*pos == 253) + { + (*packet)+=4; + return (my_ulonglong) uint3korr(pos+1); + } + (*packet)+=9; /* Must be 254 when here */ +#ifdef NO_CLIENT_LONGLONG + return (my_ulonglong) uint4korr(pos+1); +#else + return (my_ulonglong) uint8korr(pos+1); +#endif +} + +/* + Store an integer with simple packing into a output package + + SYNOPSIS + net_store_length() + pkg Store the packed integer here + length integers to store + + NOTES + This is mostly used to store lengths of strings. + + RETURN + Position in 'pkg' after the packed length +*/ + +uchar *net_store_length(uchar *packet, ulonglong length) +{ + if (length < 251ULL) + { + *packet=(uchar) length; + return packet+1; + } + /* 251 is reserved for NULL */ + if (length < 65536ULL) + { + *packet++=252; + int2store(packet,(uint) length); + return packet+2; + } + if (length < 16777216ULL) + { + *packet++=253; + int3store(packet,(ulong) length); + return packet+3; + } + *packet++=254; + int8store(packet,length); + return packet+8; +} + diff --git a/externals/mysql/libmysql/password.c b/externals/mysql/libmysql/password.c new file mode 100644 index 0000000..43430f3 --- /dev/null +++ b/externals/mysql/libmysql/password.c @@ -0,0 +1,496 @@ +/* Copyright (C) 2000-2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* password checking routines */ +/***************************************************************************** + The main idea is that no password are sent between client & server on + connection and that no password are saved in mysql in a decodable form. + + On connection a random string is generated and sent to the client. + The client generates a new string with a random generator inited with + the hash values from the password and the sent string. + This 'check' string is sent to the server where it is compared with + a string generated from the stored hash_value of the password and the + random string. + + The password is saved (in user.password) by using the PASSWORD() function in + mysql. + + This is .c file because it's used in libmysqlclient, which is entirely in C. + (we need it to be portable to a variety of systems). + Example: + update user set password=PASSWORD("hello") where user="test" + This saves a hashed number as a string in the password field. + + The new authentication is performed in following manner: + + SERVER: public_seed=create_random_string() + send(public_seed) + + CLIENT: recv(public_seed) + hash_stage1=sha1("password") + hash_stage2=sha1(hash_stage1) + reply=xor(hash_stage1, sha1(public_seed,hash_stage2) + + // this three steps are done in scramble() + + send(reply) + + + SERVER: recv(reply) + hash_stage1=xor(reply, sha1(public_seed,hash_stage2)) + candidate_hash2=sha1(hash_stage1) + check(candidate_hash2==hash_stage2) + + // this three steps are done in check_scramble() + +*****************************************************************************/ + +#include +#include +#include +#include +#include "mysql.h" + +/************ MySQL 3.23-4.0 authentication routines: untouched ***********/ + +/* + New (MySQL 3.21+) random generation structure initialization + SYNOPSIS + my_rnd_init() + rand_st OUT Structure to initialize + seed1 IN First initialization parameter + seed2 IN Second initialization parameter +*/ + +/* + Generate binary hash from raw text string + Used for Pre-4.1 password handling + SYNOPSIS + hash_password() + result OUT store hash in this location + password IN plain text password to build hash + password_len IN password length (password may be not null-terminated) +*/ + +void hash_password(ulong *result, const char *password, uint password_len) +{ + register ulong nr=1345345333L, add=7, nr2=0x12345671L; + ulong tmp; + const char *password_end= password + password_len; + for (; password < password_end; password++) + { + if (*password == ' ' || *password == '\t') + continue; /* skip space in password */ + tmp= (ulong) (uchar) *password; + nr^= (((nr & 63)+add)*tmp)+ (nr << 8); + nr2+=(nr2 << 8) ^ nr; + add+=tmp; + } + result[0]=nr & (((ulong) 1L << 31) -1L); /* Don't use sign bit (str2int) */; + result[1]=nr2 & (((ulong) 1L << 31) -1L); +} + + +/* + Create password to be stored in user database from raw string + Used for pre-4.1 password handling + SYNOPSIS + make_scrambled_password_323() + to OUT store scrambled password here + password IN user-supplied password +*/ + +void make_scrambled_password_323(char *to, const char *password) +{ + ulong hash_res[2]; + hash_password(hash_res, password, (uint) strlen(password)); + sprintf(to, "%08lx%08lx", hash_res[0], hash_res[1]); +} + + +/* + Scramble string with password. + Used in pre 4.1 authentication phase. + SYNOPSIS + scramble_323() + to OUT Store scrambled message here. Buffer must be at least + SCRAMBLE_LENGTH_323+1 bytes long + message IN Message to scramble. Message must be at least + SRAMBLE_LENGTH_323 bytes long. + password IN Password to use while scrambling +*/ + +void scramble_323(char *to, const char *message, const char *password) +{ + struct my_rnd_struct rand_st; + ulong hash_pass[2], hash_message[2]; + + if (password && password[0]) + { + char extra, *to_start=to; + const char *message_end= message + SCRAMBLE_LENGTH_323; + hash_password(hash_pass,password, (uint) strlen(password)); + hash_password(hash_message, message, SCRAMBLE_LENGTH_323); + my_rnd_init(&rand_st,hash_pass[0] ^ hash_message[0], + hash_pass[1] ^ hash_message[1]); + for (; message < message_end; message++) + *to++= (char) (floor(my_rnd(&rand_st)*31)+64); + extra=(char) (floor(my_rnd(&rand_st)*31)); + while (to_start != to) + *(to_start++)^=extra; + } + *to= 0; +} + + +/* + Check scrambled message + Used in pre 4.1 password handling + SYNOPSIS + check_scramble_323() + scrambled scrambled message to check. + message original random message which was used for scrambling; must + be exactly SCRAMBLED_LENGTH_323 bytes long and + NULL-terminated. + hash_pass password which should be used for scrambling + All params are IN. + + RETURN VALUE + 0 - password correct + !0 - password invalid +*/ + +my_bool +check_scramble_323(const char *scrambled, const char *message, + ulong *hash_pass) +{ + struct my_rnd_struct rand_st; + ulong hash_message[2]; + char buff[16],*to,extra; /* Big enough for check */ + const char *pos; + + hash_password(hash_message, message, SCRAMBLE_LENGTH_323); + my_rnd_init(&rand_st,hash_pass[0] ^ hash_message[0], + hash_pass[1] ^ hash_message[1]); + to=buff; + DBUG_ASSERT(sizeof(buff) > SCRAMBLE_LENGTH_323); + for (pos=scrambled ; *pos && to < buff+sizeof(buff) ; pos++) + *to++=(char) (floor(my_rnd(&rand_st)*31)+64); + if (pos-scrambled != SCRAMBLE_LENGTH_323) + return 1; + extra=(char) (floor(my_rnd(&rand_st)*31)); + to=buff; + while (*scrambled) + { + if (*scrambled++ != (char) (*to++ ^ extra)) + return 1; /* Wrong password */ + } + return 0; +} + +static inline uint8 char_val(uint8 X) +{ + return (uint) (X >= '0' && X <= '9' ? X-'0' : + X >= 'A' && X <= 'Z' ? X-'A'+10 : X-'a'+10); +} + + +/* + Convert password from hex string (as stored in mysql.user) to binary form. + SYNOPSIS + get_salt_from_password_323() + res OUT store salt here + password IN password string as stored in mysql.user + NOTE + This function does not have length check for passwords. It will just crash + Password hashes in old format must have length divisible by 8 +*/ + +void get_salt_from_password_323(ulong *res, const char *password) +{ + res[0]= res[1]= 0; + if (password) + { + while (*password) + { + ulong val=0; + uint i; + for (i=0 ; i < 8 ; i++) + val=(val << 4)+char_val(*password++); + *res++=val; + } + } +} + + +/* + Convert scrambled password from binary form to asciiz hex string. + SYNOPSIS + make_password_from_salt_323() + to OUT store resulting string password here, at least 17 bytes + salt IN password in salt format, 2 ulongs +*/ + +void make_password_from_salt_323(char *to, const ulong *salt) +{ + sprintf(to,"%08lx%08lx", salt[0], salt[1]); +} + + +/* + **************** MySQL 4.1.1 authentication routines ************* +*/ + +/* + Generate string of printable random characters of requested length + SYNOPSIS + create_random_string() + to OUT buffer for generation; must be at least length+1 bytes + long; result string is always null-terminated + length IN how many random characters to put in buffer + rand_st INOUT structure used for number generation +*/ + +void create_random_string(char *to, uint length, + struct my_rnd_struct *rand_st) +{ + char *end= to + length; + /* Use pointer arithmetics as it is faster way to do so. */ + for (; to < end; to++) + *to= (char) (my_rnd(rand_st)*94+33); + *to= '\0'; +} + + +/* Character to use as version identifier for version 4.1 */ + +#define PVERSION41_CHAR '*' + + +/* + Convert given octet sequence to asciiz string of hex characters; + str..str+len and 'to' may not overlap. + SYNOPSIS + octet2hex() + buf OUT output buffer. Must be at least 2*len+1 bytes + str, len IN the beginning and the length of the input string + + RETURN + buf+len*2 +*/ + +char *octet2hex(char *to, const char *str, uint len) +{ + const char *str_end= str + len; + for (; str != str_end; ++str) + { + *to++= _dig_vec_upper[((uchar) *str) >> 4]; + *to++= _dig_vec_upper[((uchar) *str) & 0x0F]; + } + *to= '\0'; + return to; +} + + +/* + Convert given asciiz string of hex (0..9 a..f) characters to octet + sequence. + SYNOPSIS + hex2octet() + to OUT buffer to place result; must be at least len/2 bytes + str, len IN begin, length for character string; str and to may not + overlap; len % 2 == 0 +*/ + +static void +hex2octet(uint8 *to, const char *str, uint len) +{ + const char *str_end= str + len; + while (str < str_end) + { + register char tmp= char_val(*str++); + *to++= (tmp << 4) | char_val(*str++); + } +} + + +/* + Encrypt/Decrypt function used for password encryption in authentication. + Simple XOR is used here but it is OK as we crypt random strings. Note, + that XOR(s1, XOR(s1, s2)) == s2, XOR(s1, s2) == XOR(s2, s1) + SYNOPSIS + my_crypt() + to OUT buffer to hold crypted string; must be at least len bytes + long; to and s1 (or s2) may be the same. + s1, s2 IN input strings (of equal length) + len IN length of s1 and s2 +*/ + +static void +my_crypt(char *to, const uchar *s1, const uchar *s2, uint len) +{ + const uint8 *s1_end= s1 + len; + while (s1 < s1_end) + *to++= *s1++ ^ *s2++; +} + + +/* + MySQL 4.1.1 password hashing: SHA conversion (see RFC 2289, 3174) twice + applied to the password string, and then produced octet sequence is + converted to hex string. + The result of this function is used as return value from PASSWORD() and + is stored in the database. + SYNOPSIS + make_scrambled_password() + buf OUT buffer of size 2*SHA1_HASH_SIZE + 2 to store hex string + password IN NULL-terminated password string +*/ + +void +make_scrambled_password(char *to, const char *password) +{ + SHA1_CONTEXT sha1_context; + uint8 hash_stage2[SHA1_HASH_SIZE]; + + mysql_sha1_reset(&sha1_context); + /* stage 1: hash password */ + mysql_sha1_input(&sha1_context, (uint8 *) password, (uint) strlen(password)); + mysql_sha1_result(&sha1_context, (uint8 *) to); + /* stage 2: hash stage1 output */ + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, (uint8 *) to, SHA1_HASH_SIZE); + /* separate buffer is used to pass 'to' in octet2hex */ + mysql_sha1_result(&sha1_context, hash_stage2); + /* convert hash_stage2 to hex string */ + *to++= PVERSION41_CHAR; + octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE); +} + + +/* + Produce an obscure octet sequence from password and random + string, recieved from the server. This sequence corresponds to the + password, but password can not be easily restored from it. The sequence + is then sent to the server for validation. Trailing zero is not stored + in the buf as it is not needed. + This function is used by client to create authenticated reply to the + server's greeting. + SYNOPSIS + scramble() + buf OUT store scrambled string here. The buf must be at least + SHA1_HASH_SIZE bytes long. + message IN random message, must be exactly SCRAMBLE_LENGTH long and + NULL-terminated. + password IN users' password +*/ + +void +scramble(char *to, const char *message, const char *password) +{ + SHA1_CONTEXT sha1_context; + uint8 hash_stage1[SHA1_HASH_SIZE]; + uint8 hash_stage2[SHA1_HASH_SIZE]; + + mysql_sha1_reset(&sha1_context); + /* stage 1: hash password */ + mysql_sha1_input(&sha1_context, (uint8 *) password, (uint) strlen(password)); + mysql_sha1_result(&sha1_context, hash_stage1); + /* stage 2: hash stage 1; note that hash_stage2 is stored in the database */ + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, hash_stage1, SHA1_HASH_SIZE); + mysql_sha1_result(&sha1_context, hash_stage2); + /* create crypt string as sha1(message, hash_stage2) */; + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH); + mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE); + /* xor allows 'from' and 'to' overlap: lets take advantage of it */ + mysql_sha1_result(&sha1_context, (uint8 *) to); + my_crypt(to, (const uchar *) to, hash_stage1, SCRAMBLE_LENGTH); +} + + +/* + Check that scrambled message corresponds to the password; the function + is used by server to check that recieved reply is authentic. + This function does not check lengths of given strings: message must be + null-terminated, reply and hash_stage2 must be at least SHA1_HASH_SIZE + long (if not, something fishy is going on). + SYNOPSIS + check_scramble() + scramble clients' reply, presumably produced by scramble() + message original random string, previously sent to client + (presumably second argument of scramble()), must be + exactly SCRAMBLE_LENGTH long and NULL-terminated. + hash_stage2 hex2octet-decoded database entry + All params are IN. + + RETURN VALUE + 0 password is correct + !0 password is invalid +*/ + +my_bool +check_scramble(const char *scramble_arg, const char *message, + const uint8 *hash_stage2) +{ + SHA1_CONTEXT sha1_context; + uint8 buf[SHA1_HASH_SIZE]; + uint8 hash_stage2_reassured[SHA1_HASH_SIZE]; + + mysql_sha1_reset(&sha1_context); + /* create key to encrypt scramble */ + mysql_sha1_input(&sha1_context, (const uint8 *) message, SCRAMBLE_LENGTH); + mysql_sha1_input(&sha1_context, hash_stage2, SHA1_HASH_SIZE); + mysql_sha1_result(&sha1_context, buf); + /* encrypt scramble */ + my_crypt((char *) buf, buf, (const uchar *) scramble_arg, SCRAMBLE_LENGTH); + /* now buf supposedly contains hash_stage1: so we can get hash_stage2 */ + mysql_sha1_reset(&sha1_context); + mysql_sha1_input(&sha1_context, buf, SHA1_HASH_SIZE); + mysql_sha1_result(&sha1_context, hash_stage2_reassured); + return memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE); +} + + +/* + Convert scrambled password from asciiz hex string to binary form. + + SYNOPSIS + get_salt_from_password() + res OUT buf to hold password. Must be at least SHA1_HASH_SIZE + bytes long. + password IN 4.1.1 version value of user.password +*/ + +void get_salt_from_password(uint8 *hash_stage2, const char *password) +{ + hex2octet(hash_stage2, password+1 /* skip '*' */, SHA1_HASH_SIZE * 2); +} + +/* + Convert scrambled password from binary form to asciiz hex string. + SYNOPSIS + make_password_from_salt() + to OUT store resulting string here, 2*SHA1_HASH_SIZE+2 bytes + salt IN password in salt format +*/ + +void make_password_from_salt(char *to, const uint8 *hash_stage2) +{ + *to++= PVERSION41_CHAR; + octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE); +} diff --git a/externals/mysql/libmysql/probes.h b/externals/mysql/libmysql/probes.h new file mode 100644 index 0000000..2bcf627 --- /dev/null +++ b/externals/mysql/libmysql/probes.h @@ -0,0 +1,381 @@ +/* + * Generated by dtrace(1M). + */ + +#ifndef _PROBES_H +#define _PROBES_H + + + +#ifdef __cplusplus +extern "C" { +#endif + +#if _DTRACE_VERSION && defined(HAVE_DTRACE) + +#define MYSQL_COMMAND_DONE(arg0) \ + __dtrace_mysql___command__done(arg0) +#define MYSQL_COMMAND_DONE_ENABLED() \ + __dtraceenabled_mysql___command__done() +#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3) \ + __dtrace_mysql___command__start(arg0, arg1, arg2, arg3) +#define MYSQL_COMMAND_START_ENABLED() \ + __dtraceenabled_mysql___command__start() +#define MYSQL_CONNECTION_DONE(arg0, arg1) \ + __dtrace_mysql___connection__done(arg0, arg1) +#define MYSQL_CONNECTION_DONE_ENABLED() \ + __dtraceenabled_mysql___connection__done() +#define MYSQL_CONNECTION_START(arg0, arg1, arg2) \ + __dtrace_mysql___connection__start(arg0, arg1, arg2) +#define MYSQL_CONNECTION_START_ENABLED() \ + __dtraceenabled_mysql___connection__start() +#define MYSQL_DELETE_DONE(arg0, arg1) \ + __dtrace_mysql___delete__done(arg0, arg1) +#define MYSQL_DELETE_DONE_ENABLED() \ + __dtraceenabled_mysql___delete__done() +#define MYSQL_DELETE_ROW_DONE(arg0) \ + __dtrace_mysql___delete__row__done(arg0) +#define MYSQL_DELETE_ROW_DONE_ENABLED() \ + __dtraceenabled_mysql___delete__row__done() +#define MYSQL_DELETE_ROW_START(arg0, arg1) \ + __dtrace_mysql___delete__row__start(arg0, arg1) +#define MYSQL_DELETE_ROW_START_ENABLED() \ + __dtraceenabled_mysql___delete__row__start() +#define MYSQL_DELETE_START(arg0) \ + __dtrace_mysql___delete__start(arg0) +#define MYSQL_DELETE_START_ENABLED() \ + __dtraceenabled_mysql___delete__start() +#define MYSQL_FILESORT_DONE(arg0, arg1) \ + __dtrace_mysql___filesort__done(arg0, arg1) +#define MYSQL_FILESORT_DONE_ENABLED() \ + __dtraceenabled_mysql___filesort__done() +#define MYSQL_FILESORT_START(arg0, arg1) \ + __dtrace_mysql___filesort__start(arg0, arg1) +#define MYSQL_FILESORT_START_ENABLED() \ + __dtraceenabled_mysql___filesort__start() +#define MYSQL_HANDLER_RDLOCK_DONE(arg0) \ + __dtrace_mysql___handler__rdlock__done(arg0) +#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() \ + __dtraceenabled_mysql___handler__rdlock__done() +#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1) \ + __dtrace_mysql___handler__rdlock__start(arg0, arg1) +#define MYSQL_HANDLER_RDLOCK_START_ENABLED() \ + __dtraceenabled_mysql___handler__rdlock__start() +#define MYSQL_HANDLER_UNLOCK_DONE(arg0) \ + __dtrace_mysql___handler__unlock__done(arg0) +#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() \ + __dtraceenabled_mysql___handler__unlock__done() +#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1) \ + __dtrace_mysql___handler__unlock__start(arg0, arg1) +#define MYSQL_HANDLER_UNLOCK_START_ENABLED() \ + __dtraceenabled_mysql___handler__unlock__start() +#define MYSQL_HANDLER_WRLOCK_DONE(arg0) \ + __dtrace_mysql___handler__wrlock__done(arg0) +#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() \ + __dtraceenabled_mysql___handler__wrlock__done() +#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1) \ + __dtrace_mysql___handler__wrlock__start(arg0, arg1) +#define MYSQL_HANDLER_WRLOCK_START_ENABLED() \ + __dtraceenabled_mysql___handler__wrlock__start() +#define MYSQL_INSERT_DONE(arg0, arg1) \ + __dtrace_mysql___insert__done(arg0, arg1) +#define MYSQL_INSERT_DONE_ENABLED() \ + __dtraceenabled_mysql___insert__done() +#define MYSQL_INSERT_ROW_DONE(arg0) \ + __dtrace_mysql___insert__row__done(arg0) +#define MYSQL_INSERT_ROW_DONE_ENABLED() \ + __dtraceenabled_mysql___insert__row__done() +#define MYSQL_INSERT_ROW_START(arg0, arg1) \ + __dtrace_mysql___insert__row__start(arg0, arg1) +#define MYSQL_INSERT_ROW_START_ENABLED() \ + __dtraceenabled_mysql___insert__row__start() +#define MYSQL_INSERT_SELECT_DONE(arg0, arg1) \ + __dtrace_mysql___insert__select__done(arg0, arg1) +#define MYSQL_INSERT_SELECT_DONE_ENABLED() \ + __dtraceenabled_mysql___insert__select__done() +#define MYSQL_INSERT_SELECT_START(arg0) \ + __dtrace_mysql___insert__select__start(arg0) +#define MYSQL_INSERT_SELECT_START_ENABLED() \ + __dtraceenabled_mysql___insert__select__start() +#define MYSQL_INSERT_START(arg0) \ + __dtrace_mysql___insert__start(arg0) +#define MYSQL_INSERT_START_ENABLED() \ + __dtraceenabled_mysql___insert__start() +#define MYSQL_MULTI_DELETE_DONE(arg0, arg1) \ + __dtrace_mysql___multi__delete__done(arg0, arg1) +#define MYSQL_MULTI_DELETE_DONE_ENABLED() \ + __dtraceenabled_mysql___multi__delete__done() +#define MYSQL_MULTI_DELETE_START(arg0) \ + __dtrace_mysql___multi__delete__start(arg0) +#define MYSQL_MULTI_DELETE_START_ENABLED() \ + __dtraceenabled_mysql___multi__delete__start() +#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2) \ + __dtrace_mysql___multi__update__done(arg0, arg1, arg2) +#define MYSQL_MULTI_UPDATE_DONE_ENABLED() \ + __dtraceenabled_mysql___multi__update__done() +#define MYSQL_MULTI_UPDATE_START(arg0) \ + __dtrace_mysql___multi__update__start(arg0) +#define MYSQL_MULTI_UPDATE_START_ENABLED() \ + __dtraceenabled_mysql___multi__update__start() +#define MYSQL_NET_READ_DONE(arg0, arg1) \ + __dtrace_mysql___net__read__done(arg0, arg1) +#define MYSQL_NET_READ_DONE_ENABLED() \ + __dtraceenabled_mysql___net__read__done() +#define MYSQL_NET_READ_START() \ + __dtrace_mysql___net__read__start() +#define MYSQL_NET_READ_START_ENABLED() \ + __dtraceenabled_mysql___net__read__start() +#define MYSQL_NET_WRITE_DONE(arg0) \ + __dtrace_mysql___net__write__done(arg0) +#define MYSQL_NET_WRITE_DONE_ENABLED() \ + __dtraceenabled_mysql___net__write__done() +#define MYSQL_NET_WRITE_START(arg0) \ + __dtrace_mysql___net__write__start(arg0) +#define MYSQL_NET_WRITE_START_ENABLED() \ + __dtraceenabled_mysql___net__write__start() +#define MYSQL_QUERY_CACHE_HIT(arg0, arg1) \ + __dtrace_mysql___query__cache__hit(arg0, arg1) +#define MYSQL_QUERY_CACHE_HIT_ENABLED() \ + __dtraceenabled_mysql___query__cache__hit() +#define MYSQL_QUERY_CACHE_MISS(arg0) \ + __dtrace_mysql___query__cache__miss(arg0) +#define MYSQL_QUERY_CACHE_MISS_ENABLED() \ + __dtraceenabled_mysql___query__cache__miss() +#define MYSQL_QUERY_DONE(arg0) \ + __dtrace_mysql___query__done(arg0) +#define MYSQL_QUERY_DONE_ENABLED() \ + __dtraceenabled_mysql___query__done() +#define MYSQL_QUERY_EXEC_DONE(arg0) \ + __dtrace_mysql___query__exec__done(arg0) +#define MYSQL_QUERY_EXEC_DONE_ENABLED() \ + __dtraceenabled_mysql___query__exec__done() +#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5) \ + __dtrace_mysql___query__exec__start(arg0, arg1, arg2, arg3, arg4, arg5) +#define MYSQL_QUERY_EXEC_START_ENABLED() \ + __dtraceenabled_mysql___query__exec__start() +#define MYSQL_QUERY_PARSE_DONE(arg0) \ + __dtrace_mysql___query__parse__done(arg0) +#define MYSQL_QUERY_PARSE_DONE_ENABLED() \ + __dtraceenabled_mysql___query__parse__done() +#define MYSQL_QUERY_PARSE_START(arg0) \ + __dtrace_mysql___query__parse__start(arg0) +#define MYSQL_QUERY_PARSE_START_ENABLED() \ + __dtraceenabled_mysql___query__parse__start() +#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4) \ + __dtrace_mysql___query__start(arg0, arg1, arg2, arg3, arg4) +#define MYSQL_QUERY_START_ENABLED() \ + __dtraceenabled_mysql___query__start() +#define MYSQL_SELECT_DONE(arg0, arg1) \ + __dtrace_mysql___select__done(arg0, arg1) +#define MYSQL_SELECT_DONE_ENABLED() \ + __dtraceenabled_mysql___select__done() +#define MYSQL_SELECT_START(arg0) \ + __dtrace_mysql___select__start(arg0) +#define MYSQL_SELECT_START_ENABLED() \ + __dtraceenabled_mysql___select__start() +#define MYSQL_UPDATE_DONE(arg0, arg1, arg2) \ + __dtrace_mysql___update__done(arg0, arg1, arg2) +#define MYSQL_UPDATE_DONE_ENABLED() \ + __dtraceenabled_mysql___update__done() +#define MYSQL_UPDATE_ROW_DONE(arg0) \ + __dtrace_mysql___update__row__done(arg0) +#define MYSQL_UPDATE_ROW_DONE_ENABLED() \ + __dtraceenabled_mysql___update__row__done() +#define MYSQL_UPDATE_ROW_START(arg0, arg1) \ + __dtrace_mysql___update__row__start(arg0, arg1) +#define MYSQL_UPDATE_ROW_START_ENABLED() \ + __dtraceenabled_mysql___update__row__start() +#define MYSQL_UPDATE_START(arg0) \ + __dtrace_mysql___update__start(arg0) +#define MYSQL_UPDATE_START_ENABLED() \ + __dtraceenabled_mysql___update__start() + + +extern void __dtrace_mysql___command__done(int); +extern int __dtraceenabled_mysql___command__done(void); +extern void __dtrace_mysql___command__start(unsigned long, int, char *, char *); +extern int __dtraceenabled_mysql___command__start(void); +extern void __dtrace_mysql___connection__done(int, unsigned long); +extern int __dtraceenabled_mysql___connection__done(void); +extern void __dtrace_mysql___connection__start(unsigned long, char *, char *); +extern int __dtraceenabled_mysql___connection__start(void); +extern void __dtrace_mysql___delete__done(int, unsigned long); +extern int __dtraceenabled_mysql___delete__done(void); +extern void __dtrace_mysql___delete__row__done(int); +extern int __dtraceenabled_mysql___delete__row__done(void); +extern void __dtrace_mysql___delete__row__start(char *, char *); +extern int __dtraceenabled_mysql___delete__row__start(void); +extern void __dtrace_mysql___delete__start(char *); +extern int __dtraceenabled_mysql___delete__start(void); +extern void __dtrace_mysql___filesort__done(int, unsigned long); +extern int __dtraceenabled_mysql___filesort__done(void); +extern void __dtrace_mysql___filesort__start(char *, char *); +extern int __dtraceenabled_mysql___filesort__start(void); +extern void __dtrace_mysql___handler__rdlock__done(int); +extern int __dtraceenabled_mysql___handler__rdlock__done(void); +extern void __dtrace_mysql___handler__rdlock__start(char *, char *); +extern int __dtraceenabled_mysql___handler__rdlock__start(void); +extern void __dtrace_mysql___handler__unlock__done(int); +extern int __dtraceenabled_mysql___handler__unlock__done(void); +extern void __dtrace_mysql___handler__unlock__start(char *, char *); +extern int __dtraceenabled_mysql___handler__unlock__start(void); +extern void __dtrace_mysql___handler__wrlock__done(int); +extern int __dtraceenabled_mysql___handler__wrlock__done(void); +extern void __dtrace_mysql___handler__wrlock__start(char *, char *); +extern int __dtraceenabled_mysql___handler__wrlock__start(void); +extern void __dtrace_mysql___insert__done(int, unsigned long); +extern int __dtraceenabled_mysql___insert__done(void); +extern void __dtrace_mysql___insert__row__done(int); +extern int __dtraceenabled_mysql___insert__row__done(void); +extern void __dtrace_mysql___insert__row__start(char *, char *); +extern int __dtraceenabled_mysql___insert__row__start(void); +extern void __dtrace_mysql___insert__select__done(int, unsigned long); +extern int __dtraceenabled_mysql___insert__select__done(void); +extern void __dtrace_mysql___insert__select__start(char *); +extern int __dtraceenabled_mysql___insert__select__start(void); +extern void __dtrace_mysql___insert__start(char *); +extern int __dtraceenabled_mysql___insert__start(void); +extern void __dtrace_mysql___multi__delete__done(int, unsigned long); +extern int __dtraceenabled_mysql___multi__delete__done(void); +extern void __dtrace_mysql___multi__delete__start(char *); +extern int __dtraceenabled_mysql___multi__delete__start(void); +extern void __dtrace_mysql___multi__update__done(int, unsigned long, unsigned long); +extern int __dtraceenabled_mysql___multi__update__done(void); +extern void __dtrace_mysql___multi__update__start(char *); +extern int __dtraceenabled_mysql___multi__update__start(void); +extern void __dtrace_mysql___net__read__done(int, unsigned long); +extern int __dtraceenabled_mysql___net__read__done(void); +extern void __dtrace_mysql___net__read__start(void); +extern int __dtraceenabled_mysql___net__read__start(void); +extern void __dtrace_mysql___net__write__done(int); +extern int __dtraceenabled_mysql___net__write__done(void); +extern void __dtrace_mysql___net__write__start(unsigned long); +extern int __dtraceenabled_mysql___net__write__start(void); +extern void __dtrace_mysql___query__cache__hit(char *, unsigned long); +extern int __dtraceenabled_mysql___query__cache__hit(void); +extern void __dtrace_mysql___query__cache__miss(char *); +extern int __dtraceenabled_mysql___query__cache__miss(void); +extern void __dtrace_mysql___query__done(int); +extern int __dtraceenabled_mysql___query__done(void); +extern void __dtrace_mysql___query__exec__done(int); +extern int __dtraceenabled_mysql___query__exec__done(void); +extern void __dtrace_mysql___query__exec__start(char *, unsigned long, char *, char *, char *, int); +extern int __dtraceenabled_mysql___query__exec__start(void); +extern void __dtrace_mysql___query__parse__done(int); +extern int __dtraceenabled_mysql___query__parse__done(void); +extern void __dtrace_mysql___query__parse__start(char *); +extern int __dtraceenabled_mysql___query__parse__start(void); +extern void __dtrace_mysql___query__start(char *, unsigned long, char *, char *, char *); +extern int __dtraceenabled_mysql___query__start(void); +extern void __dtrace_mysql___select__done(int, unsigned long); +extern int __dtraceenabled_mysql___select__done(void); +extern void __dtrace_mysql___select__start(char *); +extern int __dtraceenabled_mysql___select__start(void); +extern void __dtrace_mysql___update__done(int, unsigned long, unsigned long); +extern int __dtraceenabled_mysql___update__done(void); +extern void __dtrace_mysql___update__row__done(int); +extern int __dtraceenabled_mysql___update__row__done(void); +extern void __dtrace_mysql___update__row__start(char *, char *); +extern int __dtraceenabled_mysql___update__row__start(void); +extern void __dtrace_mysql___update__start(char *); +extern int __dtraceenabled_mysql___update__start(void); + +#else + +#define MYSQL_COMMAND_DONE(arg0) +#define MYSQL_COMMAND_DONE_ENABLED() (0) +#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3) +#define MYSQL_COMMAND_START_ENABLED() (0) +#define MYSQL_CONNECTION_DONE(arg0, arg1) +#define MYSQL_CONNECTION_DONE_ENABLED() (0) +#define MYSQL_CONNECTION_START(arg0, arg1, arg2) +#define MYSQL_CONNECTION_START_ENABLED() (0) +#define MYSQL_DELETE_DONE(arg0, arg1) +#define MYSQL_DELETE_DONE_ENABLED() (0) +#define MYSQL_DELETE_ROW_DONE(arg0) +#define MYSQL_DELETE_ROW_DONE_ENABLED() (0) +#define MYSQL_DELETE_ROW_START(arg0, arg1) +#define MYSQL_DELETE_ROW_START_ENABLED() (0) +#define MYSQL_DELETE_START(arg0) +#define MYSQL_DELETE_START_ENABLED() (0) +#define MYSQL_FILESORT_DONE(arg0, arg1) +#define MYSQL_FILESORT_DONE_ENABLED() (0) +#define MYSQL_FILESORT_START(arg0, arg1) +#define MYSQL_FILESORT_START_ENABLED() (0) +#define MYSQL_HANDLER_RDLOCK_DONE(arg0) +#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (0) +#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1) +#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (0) +#define MYSQL_HANDLER_UNLOCK_DONE(arg0) +#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (0) +#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1) +#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (0) +#define MYSQL_HANDLER_WRLOCK_DONE(arg0) +#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (0) +#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1) +#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (0) +#define MYSQL_INSERT_DONE(arg0, arg1) +#define MYSQL_INSERT_DONE_ENABLED() (0) +#define MYSQL_INSERT_ROW_DONE(arg0) +#define MYSQL_INSERT_ROW_DONE_ENABLED() (0) +#define MYSQL_INSERT_ROW_START(arg0, arg1) +#define MYSQL_INSERT_ROW_START_ENABLED() (0) +#define MYSQL_INSERT_SELECT_DONE(arg0, arg1) +#define MYSQL_INSERT_SELECT_DONE_ENABLED() (0) +#define MYSQL_INSERT_SELECT_START(arg0) +#define MYSQL_INSERT_SELECT_START_ENABLED() (0) +#define MYSQL_INSERT_START(arg0) +#define MYSQL_INSERT_START_ENABLED() (0) +#define MYSQL_MULTI_DELETE_DONE(arg0, arg1) +#define MYSQL_MULTI_DELETE_DONE_ENABLED() (0) +#define MYSQL_MULTI_DELETE_START(arg0) +#define MYSQL_MULTI_DELETE_START_ENABLED() (0) +#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2) +#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (0) +#define MYSQL_MULTI_UPDATE_START(arg0) +#define MYSQL_MULTI_UPDATE_START_ENABLED() (0) +#define MYSQL_NET_READ_DONE(arg0, arg1) +#define MYSQL_NET_READ_DONE_ENABLED() (0) +#define MYSQL_NET_READ_START() +#define MYSQL_NET_READ_START_ENABLED() (0) +#define MYSQL_NET_WRITE_DONE(arg0) +#define MYSQL_NET_WRITE_DONE_ENABLED() (0) +#define MYSQL_NET_WRITE_START(arg0) +#define MYSQL_NET_WRITE_START_ENABLED() (0) +#define MYSQL_QUERY_CACHE_HIT(arg0, arg1) +#define MYSQL_QUERY_CACHE_HIT_ENABLED() (0) +#define MYSQL_QUERY_CACHE_MISS(arg0) +#define MYSQL_QUERY_CACHE_MISS_ENABLED() (0) +#define MYSQL_QUERY_DONE(arg0) +#define MYSQL_QUERY_DONE_ENABLED() (0) +#define MYSQL_QUERY_EXEC_DONE(arg0) +#define MYSQL_QUERY_EXEC_DONE_ENABLED() (0) +#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5) +#define MYSQL_QUERY_EXEC_START_ENABLED() (0) +#define MYSQL_QUERY_PARSE_DONE(arg0) +#define MYSQL_QUERY_PARSE_DONE_ENABLED() (0) +#define MYSQL_QUERY_PARSE_START(arg0) +#define MYSQL_QUERY_PARSE_START_ENABLED() (0) +#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4) +#define MYSQL_QUERY_START_ENABLED() (0) +#define MYSQL_SELECT_DONE(arg0, arg1) +#define MYSQL_SELECT_DONE_ENABLED() (0) +#define MYSQL_SELECT_START(arg0) +#define MYSQL_SELECT_START_ENABLED() (0) +#define MYSQL_UPDATE_DONE(arg0, arg1, arg2) +#define MYSQL_UPDATE_DONE_ENABLED() (0) +#define MYSQL_UPDATE_ROW_DONE(arg0) +#define MYSQL_UPDATE_ROW_DONE_ENABLED() (0) +#define MYSQL_UPDATE_ROW_START(arg0, arg1) +#define MYSQL_UPDATE_ROW_START_ENABLED() (0) +#define MYSQL_UPDATE_START(arg0) +#define MYSQL_UPDATE_START_ENABLED() (0) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _PROBES_H */ diff --git a/externals/mysql/m_ctype.h b/externals/mysql/m_ctype.h new file mode 100644 index 0000000..33229a3 --- /dev/null +++ b/externals/mysql/m_ctype.h @@ -0,0 +1,654 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + A better inplementation of the UNIX ctype(3) library. + Notes: my_global.h should be included before ctype.h +*/ + +#ifndef _m_ctype_h +#define _m_ctype_h + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define MY_CS_NAME_SIZE 32 +#define MY_CS_CTYPE_TABLE_SIZE 257 +#define MY_CS_TO_LOWER_TABLE_SIZE 256 +#define MY_CS_TO_UPPER_TABLE_SIZE 256 +#define MY_CS_SORT_ORDER_TABLE_SIZE 256 +#define MY_CS_TO_UNI_TABLE_SIZE 256 + +#define CHARSET_DIR "charsets/" + +#define my_wc_t ulong + +typedef struct unicase_info_st +{ + uint16 toupper; + uint16 tolower; + uint16 sort; +} MY_UNICASE_INFO; + + +extern MY_UNICASE_INFO *my_unicase_default[256]; +extern MY_UNICASE_INFO *my_unicase_turkish[256]; + +typedef struct uni_ctype_st +{ + uchar pctype; + uchar *ctype; +} MY_UNI_CTYPE; + +extern MY_UNI_CTYPE my_uni_ctype[256]; + +/* wm_wc and wc_mb return codes */ +#define MY_CS_ILSEQ 0 /* Wrong by sequence: wb_wc */ +#define MY_CS_ILUNI 0 /* Cannot encode Unicode to charset: wc_mb */ +#define MY_CS_TOOSMALL -101 /* Need at least one byte: wc_mb and mb_wc */ +#define MY_CS_TOOSMALL2 -102 /* Need at least two bytes: wc_mb and mb_wc */ +#define MY_CS_TOOSMALL3 -103 /* Need at least three bytes: wc_mb and mb_wc */ +/* These following three are currently not really used */ +#define MY_CS_TOOSMALL4 -104 /* Need at least 4 bytes: wc_mb and mb_wc */ +#define MY_CS_TOOSMALL5 -105 /* Need at least 5 bytes: wc_mb and mb_wc */ +#define MY_CS_TOOSMALL6 -106 /* Need at least 6 bytes: wc_mb and mb_wc */ +/* A helper macros for "need at least n bytes" */ +#define MY_CS_TOOSMALLN(n) (-100-(n)) + +#define MY_SEQ_INTTAIL 1 +#define MY_SEQ_SPACES 2 + + /* My charsets_list flags */ +#define MY_CS_COMPILED 1 /* compiled-in sets */ +#define MY_CS_CONFIG 2 /* sets that have a *.conf file */ +#define MY_CS_INDEX 4 /* sets listed in the Index file */ +#define MY_CS_LOADED 8 /* sets that are currently loaded */ +#define MY_CS_BINSORT 16 /* if binary sort order */ +#define MY_CS_PRIMARY 32 /* if primary collation */ +#define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */ +#define MY_CS_UNICODE 128 /* is a charset is full unicode */ +#define MY_CS_READY 256 /* if a charset is initialized */ +#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/ +#define MY_CS_CSSORT 1024 /* if case sensitive sort order */ +#define MY_CS_HIDDEN 2048 /* don't display in SHOW */ +#define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */ +#define MY_CS_NONASCII 8192 /* if not ASCII-compatible */ +#define MY_CHARSET_UNDEFINED 0 + +/* Character repertoire flags */ +#define MY_REPERTOIRE_ASCII 1 /* Pure ASCII U+0000..U+007F */ +#define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */ +#define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */ + +/* Flags for strxfrm */ +#define MY_STRXFRM_LEVEL1 0x00000001 /* for primary weights */ +#define MY_STRXFRM_LEVEL2 0x00000002 /* for secondary weights */ +#define MY_STRXFRM_LEVEL3 0x00000004 /* for tertiary weights */ +#define MY_STRXFRM_LEVEL4 0x00000008 /* fourth level weights */ +#define MY_STRXFRM_LEVEL5 0x00000010 /* fifth level weights */ +#define MY_STRXFRM_LEVEL6 0x00000020 /* sixth level weights */ +#define MY_STRXFRM_LEVEL_ALL 0x0000003F /* Bit OR for the above six */ +#define MY_STRXFRM_NLEVELS 6 /* Number of possible levels*/ + +#define MY_STRXFRM_PAD_WITH_SPACE 0x00000040 /* if pad result with spaces */ +#define MY_STRXFRM_PAD_TO_MAXLEN 0x00000080 /* if pad tail(for filesort) */ + +#define MY_STRXFRM_DESC_LEVEL1 0x00000100 /* if desc order for level1 */ +#define MY_STRXFRM_DESC_LEVEL2 0x00000200 /* if desc order for level2 */ +#define MY_STRXFRM_DESC_LEVEL3 0x00000300 /* if desc order for level3 */ +#define MY_STRXFRM_DESC_LEVEL4 0x00000800 /* if desc order for level4 */ +#define MY_STRXFRM_DESC_LEVEL5 0x00001000 /* if desc order for level5 */ +#define MY_STRXFRM_DESC_LEVEL6 0x00002000 /* if desc order for level6 */ +#define MY_STRXFRM_DESC_SHIFT 8 + +#define MY_STRXFRM_UNUSED_00004000 0x00004000 /* for future extensions */ +#define MY_STRXFRM_UNUSED_00008000 0x00008000 /* for future extensions */ + +#define MY_STRXFRM_REVERSE_LEVEL1 0x00010000 /* if reverse order for level1 */ +#define MY_STRXFRM_REVERSE_LEVEL2 0x00020000 /* if reverse order for level2 */ +#define MY_STRXFRM_REVERSE_LEVEL3 0x00040000 /* if reverse order for level3 */ +#define MY_STRXFRM_REVERSE_LEVEL4 0x00080000 /* if reverse order for level4 */ +#define MY_STRXFRM_REVERSE_LEVEL5 0x00100000 /* if reverse order for level5 */ +#define MY_STRXFRM_REVERSE_LEVEL6 0x00200000 /* if reverse order for level6 */ +#define MY_STRXFRM_REVERSE_SHIFT 16 + + +typedef struct my_uni_idx_st +{ + uint16 from; + uint16 to; + uchar *tab; +} MY_UNI_IDX; + +typedef struct +{ + uint beg; + uint end; + uint mb_len; +} my_match_t; + +enum my_lex_states +{ + MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT, + MY_LEX_IDENT_SEP, MY_LEX_IDENT_START, + MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_BIN_NUMBER, + MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END, + MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL, + MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE, + MY_LEX_LONG_COMMENT, MY_LEX_END_LONG_COMMENT, MY_LEX_SEMICOLON, + MY_LEX_SET_VAR, MY_LEX_USER_END, MY_LEX_HOSTNAME, MY_LEX_SKIP, + MY_LEX_USER_VARIABLE_DELIMITER, MY_LEX_SYSTEM_VAR, + MY_LEX_IDENT_OR_KEYWORD, + MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN, MY_LEX_IDENT_OR_NCHAR, + MY_LEX_STRING_OR_DELIMITER +}; + +struct charset_info_st; + + +/* See strings/CHARSET_INFO.txt for information about this structure */ +typedef struct my_collation_handler_st +{ + my_bool (*init)(struct charset_info_st *, void *(*alloc)(size_t)); + /* Collation routines */ + int (*strnncoll)(struct charset_info_st *, + const uchar *, size_t, const uchar *, size_t, my_bool); + int (*strnncollsp)(struct charset_info_st *, + const uchar *, size_t, const uchar *, size_t, + my_bool diff_if_only_endspace_difference); + size_t (*strnxfrm)(struct charset_info_st *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); + size_t (*strnxfrmlen)(struct charset_info_st *, size_t); + my_bool (*like_range)(struct charset_info_st *, + const char *s, size_t s_length, + pchar w_prefix, pchar w_one, pchar w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_len, size_t *max_len); + int (*wildcmp)(struct charset_info_st *, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape,int w_one, int w_many); + + int (*strcasecmp)(struct charset_info_st *, const char *, const char *); + + uint (*instr)(struct charset_info_st *, + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch); + + /* Hash calculation */ + void (*hash_sort)(struct charset_info_st *cs, const uchar *key, size_t len, + ulong *nr1, ulong *nr2); + my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, size_t len); +} MY_COLLATION_HANDLER; + +extern MY_COLLATION_HANDLER my_collation_mb_bin_handler; +extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; +extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; +extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; + +/* Some typedef to make it easy for C++ to make function pointers */ +typedef int (*my_charset_conv_mb_wc)(struct charset_info_st *, my_wc_t *, + const uchar *, const uchar *); +typedef int (*my_charset_conv_wc_mb)(struct charset_info_st *, my_wc_t, + uchar *, uchar *); +typedef size_t (*my_charset_conv_case)(struct charset_info_st *, + char *, size_t, char *, size_t); + + +/* See strings/CHARSET_INFO.txt about information on this structure */ +typedef struct my_charset_handler_st +{ + my_bool (*init)(struct charset_info_st *, void *(*alloc)(size_t)); + /* Multibyte routines */ + uint (*ismbchar)(struct charset_info_st *, const char *, const char *); + uint (*mbcharlen)(struct charset_info_st *, uint c); + size_t (*numchars)(struct charset_info_st *, const char *b, const char *e); + size_t (*charpos)(struct charset_info_st *, const char *b, const char *e, + size_t pos); + size_t (*well_formed_len)(struct charset_info_st *, + const char *b,const char *e, + size_t nchars, int *error); + size_t (*lengthsp)(struct charset_info_st *, const char *ptr, size_t length); + size_t (*numcells)(struct charset_info_st *, const char *b, const char *e); + + /* Unicode conversion */ + my_charset_conv_mb_wc mb_wc; + my_charset_conv_wc_mb wc_mb; + + /* CTYPE scanner */ + int (*ctype)(struct charset_info_st *cs, int *ctype, + const uchar *s, const uchar *e); + + /* Functions for case and sort conversion */ + size_t (*caseup_str)(struct charset_info_st *, char *); + size_t (*casedn_str)(struct charset_info_st *, char *); + + my_charset_conv_case caseup; + my_charset_conv_case casedn; + + /* Charset dependant snprintf() */ + size_t (*snprintf)(struct charset_info_st *, char *to, size_t n, + const char *fmt, + ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5); + size_t (*long10_to_str)(struct charset_info_st *, char *to, size_t n, + int radix, long int val); + size_t (*longlong10_to_str)(struct charset_info_st *, char *to, size_t n, + int radix, longlong val); + + void (*fill)(struct charset_info_st *, char *to, size_t len, int fill); + + /* String-to-number conversion routines */ + long (*strntol)(struct charset_info_st *, const char *s, size_t l, + int base, char **e, int *err); + ulong (*strntoul)(struct charset_info_st *, const char *s, size_t l, + int base, char **e, int *err); + longlong (*strntoll)(struct charset_info_st *, const char *s, size_t l, + int base, char **e, int *err); + ulonglong (*strntoull)(struct charset_info_st *, const char *s, size_t l, + int base, char **e, int *err); + double (*strntod)(struct charset_info_st *, char *s, size_t l, char **e, + int *err); + longlong (*strtoll10)(struct charset_info_st *cs, + const char *nptr, char **endptr, int *error); + ulonglong (*strntoull10rnd)(struct charset_info_st *cs, + const char *str, size_t length, + int unsigned_fl, + char **endptr, int *error); + size_t (*scan)(struct charset_info_st *, const char *b, const char *e, + int sq); +} MY_CHARSET_HANDLER; + +extern MY_CHARSET_HANDLER my_charset_8bit_handler; +extern MY_CHARSET_HANDLER my_charset_ucs2_handler; + + +/* See strings/CHARSET_INFO.txt about information on this structure */ +typedef struct charset_info_st +{ + uint number; + uint primary_number; + uint binary_number; + uint state; + const char *csname; + const char *name; + const char *comment; + const char *tailoring; + uchar *ctype; + uchar *to_lower; + uchar *to_upper; + uchar *sort_order; + uint16 *contractions; + uint16 **sort_order_big; + uint16 *tab_to_uni; + MY_UNI_IDX *tab_from_uni; + MY_UNICASE_INFO **caseinfo; + uchar *state_map; + uchar *ident_map; + uint strxfrm_multiply; + uchar caseup_multiply; + uchar casedn_multiply; + uint mbminlen; + uint mbmaxlen; + uint16 min_sort_char; + uint16 max_sort_char; /* For LIKE optimization */ + uchar pad_char; + my_bool escape_with_backslash_is_dangerous; + uchar levels_for_compare; + uchar levels_for_order; + + MY_CHARSET_HANDLER *cset; + MY_COLLATION_HANDLER *coll; + +} CHARSET_INFO; +#define ILLEGAL_CHARSET_INFO_NUMBER (~0U) + + +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin; +extern CHARSET_INFO my_charset_big5_chinese_ci; +extern CHARSET_INFO my_charset_big5_bin; +extern CHARSET_INFO my_charset_cp932_japanese_ci; +extern CHARSET_INFO my_charset_cp932_bin; +extern CHARSET_INFO my_charset_cp1250_czech_ci; +extern CHARSET_INFO my_charset_eucjpms_japanese_ci; +extern CHARSET_INFO my_charset_eucjpms_bin; +extern CHARSET_INFO my_charset_euckr_korean_ci; +extern CHARSET_INFO my_charset_euckr_bin; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename; +extern CHARSET_INFO my_charset_gb2312_chinese_ci; +extern CHARSET_INFO my_charset_gb2312_bin; +extern CHARSET_INFO my_charset_gbk_chinese_ci; +extern CHARSET_INFO my_charset_gbk_bin; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1; +extern CHARSET_INFO my_charset_latin1_german2_ci; +extern CHARSET_INFO my_charset_latin1_bin; +extern CHARSET_INFO my_charset_latin2_czech_ci; +extern CHARSET_INFO my_charset_sjis_japanese_ci; +extern CHARSET_INFO my_charset_sjis_bin; +extern CHARSET_INFO my_charset_tis620_thai_ci; +extern CHARSET_INFO my_charset_tis620_bin; +extern CHARSET_INFO my_charset_ucs2_general_ci; +extern CHARSET_INFO my_charset_ucs2_bin; +extern CHARSET_INFO my_charset_ucs2_unicode_ci; +extern CHARSET_INFO my_charset_ujis_japanese_ci; +extern CHARSET_INFO my_charset_ujis_bin; +extern CHARSET_INFO my_charset_utf16_bin; +extern CHARSET_INFO my_charset_utf16_general_ci; +extern CHARSET_INFO my_charset_utf16_unicode_ci; +extern CHARSET_INFO my_charset_utf32_bin; +extern CHARSET_INFO my_charset_utf32_general_ci; +extern CHARSET_INFO my_charset_utf32_unicode_ci; +extern CHARSET_INFO my_charset_utf8mb3_bin; +extern CHARSET_INFO my_charset_utf8mb3_general_ci; +extern CHARSET_INFO my_charset_utf8mb3_unicode_ci; +extern CHARSET_INFO my_charset_utf8mb4_bin; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_general_ci; +extern CHARSET_INFO my_charset_utf8mb4_unicode_ci; + +#define MY_UTF8MB3 "utf8mb3" +#define MY_UTF8MB4 "utf8" +#define my_charset_utf8_general_ci my_charset_utf8mb4_general_ci +#define my_charset_utf8_bin my_charset_utf8mb4_bin + + +/* declarations for simple charsets */ +extern size_t my_strnxfrm_simple(CHARSET_INFO *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); +size_t my_strnxfrmlen_simple(CHARSET_INFO *, size_t); +extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t, + const uchar *, size_t, my_bool); + +extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t, + const uchar *, size_t, + my_bool diff_if_only_endspace_difference); + +extern void my_hash_sort_simple(CHARSET_INFO *cs, + const uchar *key, size_t len, + ulong *nr1, ulong *nr2); + +extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length); + +extern uint my_instr_simple(struct charset_info_st *, + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch); + + +/* Functions for 8bit */ +extern size_t my_caseup_str_8bit(CHARSET_INFO *, char *); +extern size_t my_casedn_str_8bit(CHARSET_INFO *, char *); +extern size_t my_caseup_8bit(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); +extern size_t my_casedn_8bit(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); + +extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *); + +int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e); +int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); + +int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *); +int my_mb_ctype_mb(CHARSET_INFO *,int *, const uchar *,const uchar *); + +size_t my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq); + +size_t my_snprintf_8bit(struct charset_info_st *, char *to, size_t n, + const char *fmt, ...) + ATTRIBUTE_FORMAT(printf, 4, 5); + +long my_strntol_8bit(CHARSET_INFO *, const char *s, size_t l, int base, + char **e, int *err); +ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, size_t l, int base, + char **e, int *err); +longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, size_t l, int base, + char **e, int *err); +ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, size_t l, int base, + char **e, int *err); +double my_strntod_8bit(CHARSET_INFO *, char *s, size_t l,char **e, + int *err); +size_t my_long10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix, + long int val); +size_t my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix, + longlong val); + +longlong my_strtoll10_8bit(CHARSET_INFO *cs, + const char *nptr, char **endptr, int *error); +longlong my_strtoll10_ucs2(CHARSET_INFO *cs, + const char *nptr, char **endptr, int *error); + +ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs, + const char *str, size_t length, int + unsigned_fl, char **endptr, int *error); +ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs, + const char *str, size_t length, + int unsigned_fl, char **endptr, int *error); + +void my_fill_8bit(CHARSET_INFO *cs, char* to, size_t l, int fill); + +my_bool my_like_range_simple(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length); + +my_bool my_like_range_mb(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length); + +my_bool my_like_range_ucs2(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length); + +my_bool my_like_range_utf16(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length); + +my_bool my_like_range_utf32(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length); + + +int my_wildcmp_8bit(CHARSET_INFO *, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many); + +int my_wildcmp_bin(CHARSET_INFO *, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many); + +size_t my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e); +size_t my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e); +size_t my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, size_t pos); +size_t my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e, + size_t pos, int *error); +uint my_mbcharlen_8bit(CHARSET_INFO *, uint c); + + +/* Functions for multibyte charsets */ +extern size_t my_caseup_str_mb(CHARSET_INFO *, char *); +extern size_t my_casedn_str_mb(CHARSET_INFO *, char *); +extern size_t my_caseup_mb(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); +extern size_t my_casedn_mb(CHARSET_INFO *, char *src, size_t srclen, + char *dst, size_t dstlen); +extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *); + +int my_wildcmp_mb(CHARSET_INFO *, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many); +size_t my_numchars_mb(CHARSET_INFO *, const char *b, const char *e); +size_t my_numcells_mb(CHARSET_INFO *, const char *b, const char *e); +size_t my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, size_t pos); +size_t my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e, + size_t pos, int *error); +uint my_instr_mb(struct charset_info_st *, + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch); + +int my_strnncoll_mb_bin(CHARSET_INFO * cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix); + +int my_strnncollsp_mb_bin(CHARSET_INFO *cs, + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference); + +int my_wildcmp_mb_bin(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many); + +int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), + const char *s, const char *t); + +void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2); + +size_t my_strnxfrm_mb(CHARSET_INFO *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); + +size_t my_strnxfrm_unicode(CHARSET_INFO *, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags); + +int my_wildcmp_unicode(CHARSET_INFO *cs, + const char *str, const char *str_end, + const char *wildstr, const char *wildend, + int escape, int w_one, int w_many, + MY_UNICASE_INFO **weights); + +extern my_bool my_parse_charset_xml(const char *bug, size_t len, + int (*add)(CHARSET_INFO *cs)); +extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end, + pchar c); + +my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, size_t len); +my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len); + + +uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len); +my_bool my_charset_is_ascii_based(CHARSET_INFO *cs); +my_bool my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs); +uint my_charset_repertoire(CHARSET_INFO *cs); + + +uint my_strxfrm_flag_normalize(uint flags, uint nlevels); +void my_strxfrm_desc_and_reverse(uchar *str, uchar *strend, + uint flags, uint level); +size_t my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs, + uchar *str, uchar *frmend, uchar *strend, + uint nweights, uint flags, uint level); + +my_bool my_charset_is_ascii_compatible(CHARSET_INFO *cs); + +#define _MY_U 01 /* Upper case */ +#define _MY_L 02 /* Lower case */ +#define _MY_NMR 04 /* Numeral (digit) */ +#define _MY_SPC 010 /* Spacing character */ +#define _MY_PNT 020 /* Punctuation */ +#define _MY_CTR 040 /* Control character */ +#define _MY_B 0100 /* Blank */ +#define _MY_X 0200 /* heXadecimal digit */ + + +#define my_isascii(c) (!((c) & ~0177)) +#define my_toascii(c) ((c) & 0177) +#define my_tocntrl(c) ((c) & 31) +#define my_toprint(c) ((c) | 64) +#define my_toupper(s,c) (char) ((s)->to_upper[(uchar) (c)]) +#define my_tolower(s,c) (char) ((s)->to_lower[(uchar) (c)]) +#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L)) +#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_U) +#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_L) +#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_NMR) +#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_X) +#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_U | _MY_L | _MY_NMR)) +#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_SPC) +#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_PNT) +#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR | _MY_B)) +#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR)) +#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _MY_CTR) + +/* Some macros that should be cleaned up a little */ +#define my_isvar(s,c) (my_isalnum(s,c) || (c) == '_') +#define my_isvar_start(s,c) (my_isalpha(s,c) || (c) == '_') + +#define my_binary_compare(s) ((s)->state & MY_CS_BINSORT) +#define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM) +#define my_strnxfrm(cs, d, dl, s, sl) \ + ((cs)->coll->strnxfrm((cs), (d), (dl), (dl), (s), (sl), MY_STRXFRM_PAD_WITH_SPACE)) +#define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0)) +#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \ + ((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j))) +#define my_wildcmp(cs,s,se,w,we,e,o,m) ((cs)->coll->wildcmp((cs),(s),(se),(w),(we),(e),(o),(m))) +#define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b))) +#define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num)) + + +#define use_mb(s) ((s)->cset->ismbchar != NULL) +#define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b))) +#ifdef USE_MB +#define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a))) +#else +#define my_mbcharlen(s, a) 1 +#endif + +#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a))) +#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a))) +#define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e))) +#define my_strntoul(s, a, b, c, d, e) ((s)->cset->strntoul((s),(a),(b),(c),(d),(e))) +#define my_strntoll(s, a, b, c, d, e) ((s)->cset->strntoll((s),(a),(b),(c),(d),(e))) +#define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e))) +#define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s),(a),(b),(c),(d))) + + +/* XXX: still need to take care of this one */ +#ifdef MY_CHARSET_TIS620 +#error The TIS620 charset is broken at the moment. Tell tim to fix it. +#define USE_TIS620 +#include "t_ctype.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _m_ctype_h */ diff --git a/externals/mysql/m_string.h b/externals/mysql/m_string.h new file mode 100644 index 0000000..bb8bad4 --- /dev/null +++ b/externals/mysql/m_string.h @@ -0,0 +1,393 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* There may be prolems include all of theese. Try to test in + configure with ones are needed? */ + +/* This is needed for the definitions of strchr... on solaris */ + +#ifndef _m_string_h +#define _m_string_h +#ifndef __USE_GNU +#define __USE_GNU /* We want to use stpcpy */ +#endif +#if defined(HAVE_STRINGS_H) +#include +#endif +#if defined(HAVE_STRING_H) +#include +#endif + +/* need by my_vsnprintf */ +#include + +#ifdef _AIX +#undef HAVE_BCMP +#endif + +/* This is needed for the definitions of bzero... on solaris */ +#if defined(HAVE_STRINGS_H) +#include +#endif + +/* This is needed for the definitions of memcpy... on solaris */ +#if defined(HAVE_MEMORY_H) && !defined(__cplusplus) +#include +#endif + +#if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE) +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memset(A,C,B) bfill((A),(B),(C)) +# define memmove(d, s, n) bmove ((d), (s), (n)) +#elif defined(HAVE_MEMMOVE) +# define bmove(d, s, n) memmove((d), (s), (n)) +#else +# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */ +#endif + +/* Unixware 7 */ +#if !defined(HAVE_BFILL) +# define bfill(A,B,C) memset((A),(C),(B)) +# define bmove_align(A,B,C) memcpy((A),(B),(C)) +#endif + +#if !defined(HAVE_BCMP) +# define bcopy(s, d, n) memcpy((d), (s), (n)) +# define bcmp(A,B,C) memcmp((A),(B),(C)) +# define bzero(A,B) memset((A),0,(B)) +# define bmove_align(A,B,C) memcpy((A),(B),(C)) +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +/* + my_str_malloc() and my_str_free() are assigned to implementations in + strings/alloc.c, but can be overridden in the calling program. + */ +extern void *(*my_str_malloc)(size_t); +extern void (*my_str_free)(void *); + +#if defined(HAVE_STPCPY) +#define strmov(A,B) stpcpy((A),(B)) +#ifndef stpcpy +extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ +#endif +#endif + +/* Declared in int2str() */ +extern char NEAR _dig_vec_upper[]; +extern char NEAR _dig_vec_lower[]; + +#ifdef BAD_STRING_COMPILER +#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1) +#else +#define strmov_overlapp(A,B) strmov(A,B) +#define strmake_overlapp(A,B,C) strmake(A,B,C) +#endif + +#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */ +#define memcpy_fixed(A,B,C) bmove((A),(B),(C)) +#else +#define memcpy_fixed(A,B,C) memcpy((A),(B),(C)) +#endif + +#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512) +#define bmove512(A,B,C) memcpy(A,B,C) +#endif + + /* Prototypes for string functions */ + +#if !defined(bfill) && !defined(HAVE_BFILL) +extern void bfill(uchar *dst,size_t len,pchar fill); +#endif + +#if !defined(bzero) && !defined(HAVE_BZERO) +extern void bzero(uchar * dst,size_t len); +#endif + +#if !defined(bcmp) && !defined(HAVE_BCMP) +extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len); +#endif +#ifdef HAVE_purify +extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len); +#undef bcmp +#define bcmp(A,B,C) my_bcmp((A),(B),(C)) +#define bzero_if_purify(A,B) bzero(A,B) +#else +#define bzero_if_purify(A,B) +#endif /* HAVE_purify */ + +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) +#define LINT_INIT_STRUCT(var) bzero(&var, sizeof(var)) /* No uninitialize-warning */ +#else +#define LINT_INIT_STRUCT(var) +#endif + +#ifndef bmove512 +extern void bmove512(uchar *dst,const uchar *src,size_t len); +#endif + +#if !defined(HAVE_BMOVE) && !defined(bmove) +extern void bmove(uuchar *dst, const uchar *src,size_t len); +#endif + +extern void bmove_upp(uchar *dst,const uchar *src,size_t len); +extern void bchange(uchar *dst,size_t old_len,const uchar *src, + size_t new_len,size_t tot_len); +extern void strappend(char *s,size_t len,pchar fill); +extern char *strend(const char *s); +extern char *strcend(const char *, pchar); +extern char *strfield(char *src,int fields,int chars,int blanks, + int tabch); +extern char *strfill(char * s,size_t len,pchar fill); +extern size_t strinstr(const char *str,const char *search); +extern size_t r_strinstr(const char *str, size_t from, const char *search); +extern char *strkey(char *dst,char *head,char *tail,char *flags); +extern char *strmake(char *dst,const char *src,size_t length); +#ifndef strmake_overlapp +extern char *strmake_overlapp(char *dst,const char *src, size_t length); +#endif + +#ifndef strmov +extern char *strmov(char *dst,const char *src); +#endif +extern char *strnmov(char *dst,const char *src,size_t n); +extern char *strsuff(const char *src,const char *suffix); +extern char *strcont(const char *src,const char *set); +extern char *strxcat _VARARGS((char *dst,const char *src, ...)); +extern char *strxmov _VARARGS((char *dst,const char *src, ...)); +extern char *strxcpy _VARARGS((char *dst,const char *src, ...)); +extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...)); +extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...)); +extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...)); + +/* Prototypes of normal stringfunctions (with may ours) */ + +#ifdef WANT_STRING_PROTOTYPES +extern char *strcat(char *, const char *); +extern char *strchr(const char *, pchar); +extern char *strrchr(const char *, pchar); +extern char *strcpy(char *, const char *); +extern int strcmp(const char *, const char *); +#ifndef __GNUC__ +extern size_t strlen(const char *); +#endif +#endif +#ifndef HAVE_STRNLEN +extern size_t strnlen(const char *s, size_t n); +#endif + +#if !defined(__cplusplus) +#ifndef HAVE_STRPBRK +extern char *strpbrk(const char *, const char *); +#endif +#ifndef HAVE_STRSTR +extern char *strstr(const char *, const char *); +#endif +#endif +extern int is_prefix(const char *, const char *); + +/* Conversion routines */ +typedef enum { + MY_GCVT_ARG_FLOAT, + MY_GCVT_ARG_DOUBLE +} my_gcvt_arg_type; + +double my_strtod(const char *str, char **end, int *error); +double my_atof(const char *nptr); +size_t my_fcvt(double x, int precision, char *to, my_bool *error); +size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to, + my_bool *error); + +#define NOT_FIXED_DEC 31 + +/* + The longest string my_fcvt can return is 311 + "precision" bytes. + Here we assume that we never cal my_fcvt() with precision >= NOT_FIXED_DEC + (+ 1 byte for the terminating '\0'). +*/ +#define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC) + +/* + We want to use the 'e' format in some cases even if we have enough space + for the 'f' one just to mimic sprintf("%.15g") behavior for large integers, + and to improve it for numbers < 10^(-4). + That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require + it to be integer and be <= 10^DBL_DIG for the 'f' format to be used. + We don't lose precision, but make cases like "1e200" or "0.00001" look nicer. +*/ +#define MAX_DECPT_FOR_F_FORMAT DBL_DIG + +/* + The maximum possible field width for my_gcvt() conversion. + (DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or + MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used). +*/ +#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + max(5, MAX_DECPT_FOR_F_FORMAT)) + + +extern char *llstr(longlong value,char *buff); +extern char *ullstr(longlong value,char *buff); +#ifndef HAVE_STRTOUL +extern long strtol(const char *str, char **ptr, int base); +extern ulong strtoul(const char *str, char **ptr, int base); +#endif + +extern char *int2str(long val, char *dst, int radix, int upcase); +extern char *int10_to_str(long val,char *dst,int radix); +extern char *str2int(const char *src,int radix,long lower,long upper, + long *val); +longlong my_strtoll10(const char *nptr, char **endptr, int *error); +#if SIZEOF_LONG == SIZEOF_LONG_LONG +#define ll2str(A,B,C,D) int2str((A),(B),(C),(D)) +#define longlong2str(A,B,C) int2str((A),(B),(C),1) +#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) +#undef strtoll +#define strtoll(A,B,C) strtol((A),(B),(C)) +#define strtoull(A,B,C) strtoul((A),(B),(C)) +#ifndef HAVE_STRTOULL +#define HAVE_STRTOULL +#endif +#ifndef HAVE_STRTOLL +#define HAVE_STRTOLL +#endif +#else +#ifdef HAVE_LONG_LONG +extern char *ll2str(longlong val,char *dst,int radix, int upcase); +#define longlong2str(A,B,C) ll2str((A),(B),(C),1) +extern char *longlong10_to_str(longlong val,char *dst,int radix); +#if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO)) +extern longlong strtoll(const char *str, char **ptr, int base); +extern ulonglong strtoull(const char *str, char **ptr, int base); +#endif +#endif +#endif + +/* my_vsnprintf.c */ + +extern size_t my_vsnprintf(char *str, size_t n, + const char *format, va_list ap); +extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...) + ATTRIBUTE_FORMAT(printf, 3, 4); + +#if defined(__cplusplus) +} +#endif + +/* + LEX_STRING -- a pair of a C-string and its length. + (it's part of the plugin API as a MYSQL_LEX_STRING) +*/ + +typedef struct st_mysql_lex_string LEX_STRING; + +#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1)) +#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1)) +#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1)) + +/* A variant with const */ +struct st_mysql_const_lex_string +{ + const char *str; + size_t length; +}; +typedef struct st_mysql_const_lex_string LEX_CSTRING; + +/* A variant with const and unsigned */ +struct st_mysql_const_unsigned_lex_string +{ + const uchar *str; + size_t length; +}; +typedef struct st_mysql_const_unsigned_lex_string LEX_CUSTRING; + +/* SPACE_INT is a word that contains only spaces */ +#if SIZEOF_INT == 4 +#define SPACE_INT 0x20202020 +#elif SIZEOF_INT == 8 +#define SPACE_INT 0x2020202020202020 +#else +#error define the appropriate constant for a word full of spaces +#endif + +/** + Skip trailing space. + + On most systems reading memory in larger chunks (ideally equal to the size of + the chinks that the machine physically reads from memory) causes fewer memory + access loops and hence increased performance. + This is why the 'int' type is used : it's closest to that (according to how + it's defined in C). + So when we determine the amount of whitespace at the end of a string we do + the following : + 1. We divide the string into 3 zones : + a) from the start of the string (__start) to the first multiple + of sizeof(int) (__start_words) + b) from the end of the string (__end) to the last multiple of sizeof(int) + (__end_words) + c) a zone that is aligned to sizeof(int) and can be safely accessed + through an int * + 2. We start comparing backwards from (c) char-by-char. If all we find is + space then we continue + 3. If there are elements in zone (b) we compare them as unsigned ints to a + int mask (SPACE_INT) consisting of all spaces + 4. Finally we compare the remaining part (a) of the string char by char. + This covers for the last non-space unsigned int from 3. (if any) + + This algorithm works well for relatively larger strings, but it will slow + the things down for smaller strings (because of the additional calculations + and checks compared to the naive method). Thus the barrier of length 20 + is added. + + @param ptr pointer to the input string + @param len the length of the string + @return the last non-space character +*/ + +static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len) +{ + const uchar *end= ptr + len; + + if (len > 20) + { + const uchar *end_words= (const uchar *)(intptr) + (((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT); + const uchar *start_words= (const uchar *)(intptr) + ((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT); + + DBUG_ASSERT(((ulonglong)(intptr)ptr) >= SIZEOF_INT); + if (end_words > ptr) + { + while (end > end_words && end[-1] == 0x20) + end--; + if (end[-1] == 0x20 && start_words < end_words) + while (end > start_words && ((unsigned *)end)[-1] == SPACE_INT) + end -= SIZEOF_INT; + } + } + while (end > ptr && end[-1] == 0x20) + end--; + return (end); +} + +#ifdef SAFEMALLOC +#define TRASH(A,B) bfill(A, B, 0x8F) +#else +#define TRASH(A,B) /* nothing */ +#endif /* SAFEMALLOC */ + +#endif /* _m_string_h */ diff --git a/externals/mysql/my_aes.h b/externals/mysql/my_aes.h new file mode 100644 index 0000000..8ea128c --- /dev/null +++ b/externals/mysql/my_aes.h @@ -0,0 +1,65 @@ +/* Copyright (C) 2002 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* Header file for my_aes.c */ +/* Wrapper to give simple interface for MySQL to AES standard encryption */ + +#include "mysys/rijndael.h" + +C_MODE_START + +#define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */ + +/* + my_aes_encrypt - Crypt buffer with AES encryption algorithm. + source - Pointer to data for encryption + source_length - size of encryption data + dest - buffer to place encrypted data (must be large enough) + key - Key to be used for encryption + kel_length - Length of the key. Will handle keys of any length + + returns - size of encrypted data, or negative in case of error. +*/ + +int my_aes_encrypt(const char *source, int source_length, char *dest, + const char *key, int key_length); + +/* + my_aes_decrypt - DeCrypt buffer with AES encryption algorithm. + source - Pointer to data for decryption + source_length - size of encrypted data + dest - buffer to place decrypted data (must be large enough) + key - Key to be used for decryption + kel_length - Length of the key. Will handle keys of any length + + returns - size of original data, or negative in case of error. +*/ + + +int my_aes_decrypt(const char *source, int source_length, char *dest, + const char *key, int key_length); + +/* + my_aes_get_size - get size of buffer which will be large enough for encrypted + data + source_length - length of data to be encrypted + + returns - size of buffer required to store encrypted data +*/ + +int my_aes_get_size(int source_length); + +C_MODE_END diff --git a/externals/mysql/my_alarm.h b/externals/mysql/my_alarm.h new file mode 100644 index 0000000..dd2d564 --- /dev/null +++ b/externals/mysql/my_alarm.h @@ -0,0 +1,58 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + File to include when we want to use alarm or a loop_counter to display + some information when a program is running +*/ +#ifndef _my_alarm_h +#define _my_alarm_h +#ifdef __cplusplus +extern "C" { +#endif + +extern int volatile my_have_got_alarm; +extern ulong my_time_to_wait_for_lock; + +#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP) +#include +#define ALARM_VARIABLES uint alarm_old=0; \ + sig_return alarm_signal=0 +#define ALARM_INIT my_have_got_alarm=0 ; \ + alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \ + alarm_signal=signal(SIGALRM,my_set_alarm_variable); +#define ALARM_END (void) signal(SIGALRM,alarm_signal); \ + (void) alarm(alarm_old); +#define ALARM_TEST my_have_got_alarm +#ifdef DONT_REMEMBER_SIGNAL +#define ALARM_REINIT (void) alarm(MY_HOW_OFTEN_TO_ALARM); \ + (void) signal(SIGALRM,my_set_alarm_variable);\ + my_have_got_alarm=0; +#else +#define ALARM_REINIT (void) alarm((uint) MY_HOW_OFTEN_TO_ALARM); \ + my_have_got_alarm=0; +#endif /* DONT_REMEMBER_SIGNAL */ +#else +#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1 +#define ALARM_INIT +#define ALARM_END +#define ALARM_TEST (alarm_pos++ >= alarm_end_pos) +#define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE +#endif /* HAVE_ALARM */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/my_alloc.h b/externals/mysql/my_alloc.h new file mode 100644 index 0000000..6ade4d0 --- /dev/null +++ b/externals/mysql/my_alloc.h @@ -0,0 +1,51 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Data structures for mysys/my_alloc.c (root memory allocator) +*/ + +#ifndef _my_alloc_h +#define _my_alloc_h + +#define ALLOC_MAX_BLOCK_TO_DROP 4096 +#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10 + +typedef struct st_used_mem +{ /* struct for once_alloc (block) */ + struct st_used_mem *next; /* Next block in use */ + size_t left; /* memory left in block */ + size_t size; /* size of block */ +} USED_MEM; + + +typedef struct st_mem_root +{ + USED_MEM *free; /* blocks with free memory in it */ + USED_MEM *used; /* blocks almost without free memory */ + USED_MEM *pre_alloc; /* preallocated block */ + /* if block have less memory it will be put in 'used' list */ + size_t min_malloc; + size_t block_size; /* initial block size */ + unsigned int block_num; /* allocated blocks counter */ + /* + first free block in queue test counter (if it exceed + MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list) + */ + unsigned int first_block_usage; + + void (*error_handler)(void); +} MEM_ROOT; +#endif diff --git a/externals/mysql/my_atomic.h b/externals/mysql/my_atomic.h new file mode 100644 index 0000000..40b8895 --- /dev/null +++ b/externals/mysql/my_atomic.h @@ -0,0 +1,254 @@ +/* Copyright (C) 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This header defines five atomic operations: + + my_atomic_add#(&var, what) + add 'what' to *var, and return the old value of *var + + my_atomic_fas#(&var, what) + 'Fetch And Store' + store 'what' in *var, and return the old value of *var + + my_atomic_cas#(&var, &old, new) + 'Compare And Swap' + if *var is equal to *old, then store 'new' in *var, and return TRUE + otherwise store *var in *old, and return FALSE + + my_atomic_load#(&var) + return *var + + my_atomic_store#(&var, what) + store 'what' in *var + + '#' is substituted by a size suffix - 8, 16, 32, or ptr + (e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr). + + NOTE This operations are not always atomic, so they always must be + enclosed in my_atomic_rwlock_rdlock(lock)/my_atomic_rwlock_rdunlock(lock) + or my_atomic_rwlock_wrlock(lock)/my_atomic_rwlock_wrunlock(lock). + Hint: if a code block makes intensive use of atomic ops, it make sense + to take/release rwlock once for the whole block, not for every statement. + + On architectures where these operations are really atomic, rwlocks will + be optimized away. + 8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h), + but can be added, if necessary. +*/ + +#ifndef my_atomic_rwlock_init + +#define intptr void * + +#ifndef MY_ATOMIC_MODE_RWLOCKS +#include "atomic/nolock.h" +#endif + +#ifndef make_atomic_cas_body +/* nolock.h was not able to generate even a CAS function, fall back */ +#include "atomic/rwlock.h" +#else +/* define missing functions by using the already generated ones */ +#ifndef make_atomic_add_body +#define make_atomic_add_body(S) \ + int ## S tmp=*a; \ + while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \ + v=tmp; +#endif +#ifndef make_atomic_fas_body +#define make_atomic_fas_body(S) \ + int ## S tmp=*a; \ + while (!my_atomic_cas ## S(a, &tmp, v)); \ + v=tmp; +#endif +#ifndef make_atomic_load_body +#define make_atomic_load_body(S) \ + ret= 0; /* avoid compiler warning */ \ + (void)(my_atomic_cas ## S(a, &ret, ret)); +#endif +#ifndef make_atomic_store_body +#define make_atomic_store_body(S) \ + (void)(my_atomic_fas ## S (a, v)); +#endif +#endif + +/* + transparent_union doesn't work in g++ + Bug ? + + Darwin's gcc doesn't want to put pointers in a transparent_union + when built with -arch ppc64. Complains: + warning: 'transparent_union' attribute ignored +*/ +#if defined(__GNUC__) && !defined(__cplusplus) && \ + ! (defined(__APPLE__) && defined(_ARCH_PPC64)) +/* + we want to be able to use my_atomic_xxx functions with + both signed and unsigned integers. But gcc will issue a warning + "passing arg N of `my_atomic_XXX' as [un]signed due to prototype" + if the signedness of the argument doesn't match the prototype, or + "pointer targets in passing argument N of my_atomic_XXX differ in signedness" + if int* is used where uint* is expected (or vice versa). + Let's shut these warnings up +*/ +#define make_transparent_unions(S) \ + typedef union { \ + int ## S i; \ + uint ## S u; \ + } U_ ## S __attribute__ ((transparent_union)); \ + typedef union { \ + int ## S volatile *i; \ + uint ## S volatile *u; \ + } Uv_ ## S __attribute__ ((transparent_union)); +#define uintptr intptr +make_transparent_unions(8) +make_transparent_unions(16) +make_transparent_unions(32) +make_transparent_unions(ptr) +#undef uintptr +#undef make_transparent_unions +#define a U_a.i +#define cmp U_cmp.i +#define v U_v.i +#define set U_set.i +#else +#define U_32 int32 +#define U_ptr intptr +#define Uv_32 int32 +#define Uv_ptr intptr +#define U_a volatile *a +#define U_cmp *cmp +#define U_v v +#define U_set set +#endif /* __GCC__ transparent_union magic */ + +#ifdef HAVE_INLINE + +#define make_atomic_cas(S) \ +STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \ + Uv_ ## S U_cmp, U_ ## S U_set) \ +{ \ + int8 ret; \ + make_atomic_cas_body(S); \ + return ret; \ +} + +#define make_atomic_add(S) \ +STATIC_INLINE int ## S my_atomic_add ## S( \ + Uv_ ## S U_a, U_ ## S U_v) \ +{ \ + make_atomic_add_body(S); \ + return v; \ +} + +#define make_atomic_fas(S) \ +STATIC_INLINE int ## S my_atomic_fas ## S( \ + Uv_ ## S U_a, U_ ## S U_v) \ +{ \ + make_atomic_fas_body(S); \ + return v; \ +} + +#define make_atomic_load(S) \ +STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \ +{ \ + int ## S ret; \ + make_atomic_load_body(S); \ + return ret; \ +} + +#define make_atomic_store(S) \ +STATIC_INLINE void my_atomic_store ## S( \ + Uv_ ## S U_a, U_ ## S U_v) \ +{ \ + make_atomic_store_body(S); \ +} + +#else /* no inline functions */ + +#define make_atomic_add(S) \ +extern int ## S my_atomic_add ## S(Uv_ ## S U_a, U_ ## S U_v); + +#define make_atomic_fas(S) \ +extern int ## S my_atomic_fas ## S(Uv_ ## S U_a, U_ ## S U_v); + +#define make_atomic_cas(S) \ +extern int my_atomic_cas ## S(Uv_ ## S U_a, Uv_ ## S U_cmp, U_ ## S U_set); + +#define make_atomic_load(S) \ +extern int ## S my_atomic_load ## S(Uv_ ## S U_a); + +#define make_atomic_store(S) \ +extern void my_atomic_store ## S(Uv_ ## S U_a, U_ ## S U_v); + +#endif + +make_atomic_cas(32) +make_atomic_cas(ptr) + +make_atomic_add(32) + +make_atomic_load(32) +make_atomic_load(ptr) + +make_atomic_fas(32) +make_atomic_fas(ptr) + +make_atomic_store(32) +make_atomic_store(ptr) + +#ifdef _atomic_h_cleanup_ +#include _atomic_h_cleanup_ +#undef _atomic_h_cleanup_ +#endif + +#undef U_32 +#undef U_ptr +#undef a +#undef cmp +#undef v +#undef set +#undef U_a +#undef U_cmp +#undef U_v +#undef U_set +#undef make_atomic_add +#undef make_atomic_cas +#undef make_atomic_load +#undef make_atomic_store +#undef make_atomic_fas +#undef make_atomic_add_body +#undef make_atomic_cas_body +#undef make_atomic_load_body +#undef make_atomic_store_body +#undef make_atomic_fas_body +#undef intptr + +/* + the macro below defines (as an expression) the code that + will be run in spin-loops. Intel manuals recummend to have PAUSE there. + It is expected to be defined in include/atomic/ *.h files +*/ +#ifndef LF_BACKOFF +#define LF_BACKOFF (1) +#endif + +#define MY_ATOMIC_OK 0 +#define MY_ATOMIC_NOT_1CPU 1 +extern int my_atomic_initialize(); + +#endif + diff --git a/externals/mysql/my_attribute.h b/externals/mysql/my_attribute.h new file mode 100644 index 0000000..8309d85 --- /dev/null +++ b/externals/mysql/my_attribute.h @@ -0,0 +1,63 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Helper macros used for setting different __attributes__ + on functions in a portable fashion +*/ + +#ifndef _my_attribute_h +#define _my_attribute_h + +/* + Disable __attribute__() on gcc < 2.7, g++ < 3.4, and non-gcc compilers. + Some forms of __attribute__ are actually supported in earlier versions of + g++, but we just disable them all because we only use them to generate + compilation warnings. +*/ +#ifndef __attribute__ +# if !defined(__GNUC__) +# define __attribute__(A) +# elif GCC_VERSION < 2008 +# define __attribute__(A) +# elif defined(__cplusplus) && GCC_VERSION < 3004 +# define __attribute__(A) +# endif +#endif + +/* + __attribute__((format(...))) is only supported in gcc >= 2.8 and g++ >= 3.4 + But that's already covered by the __attribute__ tests above, so this is + just a convenience macro. +*/ +#ifndef ATTRIBUTE_FORMAT +# define ATTRIBUTE_FORMAT(style, m, n) __attribute__((format(style, m, n))) +#endif + +/* + + __attribute__((format(...))) on a function pointer is not supported + until gcc 3.1 +*/ +#ifndef ATTRIBUTE_FORMAT_FPTR +# if (GCC_VERSION >= 3001) +# define ATTRIBUTE_FORMAT_FPTR(style, m, n) ATTRIBUTE_FORMAT(style, m, n) +# else +# define ATTRIBUTE_FORMAT_FPTR(style, m, n) +# endif /* GNUC >= 3.1 */ +#endif + + +#endif diff --git a/externals/mysql/my_base.h b/externals/mysql/my_base.h new file mode 100644 index 0000000..e228b39 --- /dev/null +++ b/externals/mysql/my_base.h @@ -0,0 +1,626 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file includes constants used with all databases */ + +#ifndef _my_base_h +#define _my_base_h + +#ifndef stdin /* Included first in handler */ +#define CHSIZE_USED +#include +#include /* This includes types */ +#include +#include +#include + +#ifndef EOVERFLOW +#define EOVERFLOW 84 +#endif + +#if !defined(USE_MY_FUNC) && !defined(THREAD) +#include /* For faster code, after test */ +#endif /* USE_MY_FUNC */ +#endif /* stdin */ +#include + +/* The following is bits in the flag parameter to ha_open() */ + +#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */ +#define HA_OPEN_WAIT_IF_LOCKED 1 +#define HA_OPEN_IGNORE_IF_LOCKED 2 +#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */ +#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */ +#define HA_OPEN_ABORT_IF_CRASHED 16 +#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */ +#define HA_OPEN_FROM_SQL_LAYER 64 +#define HA_OPEN_MMAP 128 /* open memory mapped */ +#define HA_OPEN_COPY 256 /* Open copy (for repair) */ +/* Internal temp table, used for temporary results */ +#define HA_OPEN_INTERNAL_TABLE 512 + +/* The following is parameter to ha_rkey() how to use key */ + +/* + We define a complete-field prefix of a key value as a prefix where + the last included field in the prefix contains the full field, not + just some bytes from the start of the field. A partial-field prefix + is allowed to contain only a few first bytes from the last included + field. + + Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a + complete-field prefix of a key value as the search + key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a + partial-field prefix, but currently (4.0.10) they are only used with + complete-field prefixes. MySQL uses a padding trick to implement + LIKE 'abc%' queries. + + NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a + partial-field prefix because InnoDB currently strips spaces from the + end of varchar fields! +*/ + +enum ha_rkey_function { + HA_READ_KEY_EXACT, /* Find first record else error */ + HA_READ_KEY_OR_NEXT, /* Record or next record */ + HA_READ_KEY_OR_PREV, /* Record or previous */ + HA_READ_AFTER_KEY, /* Find next rec. after key-record */ + HA_READ_BEFORE_KEY, /* Find next rec. before key-record */ + HA_READ_PREFIX, /* Key which as same prefix */ + HA_READ_PREFIX_LAST, /* Last key with the same prefix */ + HA_READ_PREFIX_LAST_OR_PREV, /* Last or prev key with the same prefix */ + HA_READ_MBR_CONTAIN, + HA_READ_MBR_INTERSECT, + HA_READ_MBR_WITHIN, + HA_READ_MBR_DISJOINT, + HA_READ_MBR_EQUAL +}; + + /* Key algorithm types */ + +enum ha_key_alg { + HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */ + HA_KEY_ALG_BTREE= 1, /* B-tree, default one */ + HA_KEY_ALG_RTREE= 2, /* R-tree, for spatial searches */ + HA_KEY_ALG_HASH= 3, /* HASH keys (HEAP tables) */ + HA_KEY_ALG_FULLTEXT= 4 /* FULLTEXT (MyISAM tables) */ +}; + + /* Index and table build methods */ + +enum ha_build_method { + HA_BUILD_DEFAULT, + HA_BUILD_ONLINE, + HA_BUILD_OFFLINE +}; + + /* Storage media types */ + +enum ha_storage_media { + HA_SM_DEFAULT= 0, /* Not specified (engine default) */ + HA_SM_DISK= 1, /* DISK storage */ + HA_SM_MEMORY= 2 /* MAIN MEMORY storage */ +}; + + /* The following is parameter to ha_extra() */ + +enum ha_extra_function { + HA_EXTRA_NORMAL=0, /* Optimize for space (def) */ + HA_EXTRA_QUICK=1, /* Optimize for speed */ + HA_EXTRA_NOT_USED=2, + HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */ + HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */ + HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */ + HA_EXTRA_READCHECK=6, /* Use readcheck (def) */ + HA_EXTRA_KEYREAD=7, /* Read only key to database */ + HA_EXTRA_NO_KEYREAD=8, /* Normal read of records (def) */ + HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */ + HA_EXTRA_KEY_CACHE=10, + HA_EXTRA_NO_KEY_CACHE=11, + HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */ + HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */ + HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */ + HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */ + HA_EXTRA_NO_KEYS=16, /* Remove all update of keys */ + HA_EXTRA_KEYREAD_CHANGE_POS=17, /* Keyread, but change pos */ + /* xxxxchk -r must be used */ + HA_EXTRA_REMEMBER_POS=18, /* Remember pos for next/prev */ + HA_EXTRA_RESTORE_POS=19, + HA_EXTRA_REINIT_CACHE=20, /* init cache from current record */ + HA_EXTRA_FORCE_REOPEN=21, /* Datafile have changed on disk */ + HA_EXTRA_FLUSH, /* Flush tables to disk */ + HA_EXTRA_NO_ROWS, /* Don't write rows */ + HA_EXTRA_RESET_STATE, /* Reset positions */ + HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ + HA_EXTRA_NO_IGNORE_DUP_KEY, + HA_EXTRA_PREPARE_FOR_DROP, + HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */ + HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */ + /* + On-the-fly switching between unique and non-unique key inserting. + */ + HA_EXTRA_CHANGE_KEY_TO_UNIQUE, + HA_EXTRA_CHANGE_KEY_TO_DUP, + /* + When using HA_EXTRA_KEYREAD, overwrite only key member fields and keep + other fields intact. When this is off (by default) InnoDB will use memcpy + to overwrite entire row. + */ + HA_EXTRA_KEYREAD_PRESERVE_FIELDS, + HA_EXTRA_MMAP, + /* + Ignore if the a tuple is not found, continue processing the + transaction and ignore that 'row'. Needed for idempotency + handling on the slave + + Currently only used by NDB storage engine. Partition handler ignores flag. + */ + HA_EXTRA_IGNORE_NO_KEY, + HA_EXTRA_NO_IGNORE_NO_KEY, + /* + Mark the table as a log table. For some handlers (e.g. CSV) this results + in a special locking for the table. + */ + HA_EXTRA_MARK_AS_LOG_TABLE, + /* + Informs handler that write_row() which tries to insert new row into the + table and encounters some already existing row with same primary/unique + key can replace old row with new row instead of reporting error (basically + it informs handler that we do REPLACE instead of simple INSERT). + Off by default. + */ + HA_EXTRA_WRITE_CAN_REPLACE, + HA_EXTRA_WRITE_CANNOT_REPLACE, + /* + Inform handler that delete_row()/update_row() cannot batch deletes/updates + and should perform them immediately. This may be needed when table has + AFTER DELETE/UPDATE triggers which access to subject table. + These flags are reset by the handler::extra(HA_EXTRA_RESET) call. + */ + HA_EXTRA_DELETE_CANNOT_BATCH, + HA_EXTRA_UPDATE_CANNOT_BATCH, + /* + Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be + executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY. + */ + HA_EXTRA_INSERT_WITH_UPDATE, + /* Inform handler that we will do a rename */ + HA_EXTRA_PREPARE_FOR_RENAME, + /* + Special actions for MERGE tables. + */ + HA_EXTRA_ADD_CHILDREN_LIST, + HA_EXTRA_ATTACH_CHILDREN, + HA_EXTRA_IS_ATTACHED_CHILDREN, + HA_EXTRA_DETACH_CHILDREN, + HA_EXTRA_ORDERBY_LIMIT, + HA_EXTRA_NO_ORDERBY_LIMIT, + /* Inform handler we will force a close as part of flush */ + HA_EXTRA_PREPARE_FOR_FORCED_CLOSE, + HA_EXTRA_ALLOW_LOG_DELETE +}; + +/* Compatible option, to be deleted in 6.0 */ +#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP + + /* The following is parameter to ha_panic() */ + +enum ha_panic_function { + HA_PANIC_CLOSE, /* Close all databases */ + HA_PANIC_WRITE, /* Unlock and write status */ + HA_PANIC_READ /* Lock and read keyinfo */ +}; + + /* The following is parameter to ha_create(); keytypes */ + +enum ha_base_keytype { + HA_KEYTYPE_END=0, + HA_KEYTYPE_TEXT=1, /* Key is sorted as letters */ + HA_KEYTYPE_BINARY=2, /* Key is sorted as unsigned chars */ + HA_KEYTYPE_SHORT_INT=3, + HA_KEYTYPE_LONG_INT=4, + HA_KEYTYPE_FLOAT=5, + HA_KEYTYPE_DOUBLE=6, + HA_KEYTYPE_NUM=7, /* Not packed num with pre-space */ + HA_KEYTYPE_USHORT_INT=8, + HA_KEYTYPE_ULONG_INT=9, + HA_KEYTYPE_LONGLONG=10, + HA_KEYTYPE_ULONGLONG=11, + HA_KEYTYPE_INT24=12, + HA_KEYTYPE_UINT24=13, + HA_KEYTYPE_INT8=14, + /* Varchar (0-255 bytes) with length packed with 1 byte */ + HA_KEYTYPE_VARTEXT1=15, /* Key is sorted as letters */ + HA_KEYTYPE_VARBINARY1=16, /* Key is sorted as unsigned chars */ + /* Varchar (0-65535 bytes) with length packed with 2 bytes */ + HA_KEYTYPE_VARTEXT2=17, /* Key is sorted as letters */ + HA_KEYTYPE_VARBINARY2=18, /* Key is sorted as unsigned chars */ + HA_KEYTYPE_BIT=19 +}; + +#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */ + +/* + These flags kan be OR:ed to key-flag + Note that these can only be up to 16 bits! +*/ + +#define HA_NOSAME 1 /* Set if not dupplicated records */ +#define HA_PACK_KEY 2 /* Pack string key to previous key */ +#define HA_AUTO_KEY 16 +#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */ +#define HA_FULLTEXT 128 /* For full-text search */ +#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */ +#define HA_SPATIAL 1024 /* For spatial search */ +#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ +#define HA_GENERATED_KEY 8192 /* Automaticly generated key */ +#define HA_RTREE_INDEX 16384 /* For RTREE search */ + + /* The combination of the above can be used for key type comparison. */ +#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ + HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ + HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY | \ + HA_RTREE_INDEX) + +#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */ + + /* Automatic bits in key-flag */ + +#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ +#define HA_VAR_LENGTH_KEY 8 +#define HA_NULL_PART_KEY 64 +#define HA_USES_COMMENT 4096 +#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */ +#define HA_USES_BLOCK_SIZE ((uint) 32768) +#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */ +#if MYSQL_VERSION_ID < 0x50200 +/* + Key has a part that can have end space. If this is an unique key + we have to handle it differently from other unique keys as we can find + many matching rows for one key (because end space are not compared) +*/ +#define HA_END_SPACE_KEY 0 /* was: 4096 */ +#else +#error HA_END_SPACE_KEY is obsolete, please remove it +#endif + + + /* These flags can be added to key-seg-flag */ + +#define HA_SPACE_PACK 1 /* Pack space in key-seg */ +#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */ +#define HA_VAR_LENGTH_PART 8 +#define HA_NULL_PART 16 +#define HA_BLOB_PART 32 +#define HA_SWAP_KEY 64 +#define HA_REVERSE_SORT 128 /* Sort key in reverse order */ +#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */ +/* + End space in unique/varchar are considered equal. (Like 'a' and 'a ') + Only needed for internal temporary tables. +*/ +#define HA_END_SPACE_ARE_EQUAL 512 +#define HA_BIT_PART 1024 + + /* optionbits for database */ +#define HA_OPTION_PACK_RECORD 1 +#define HA_OPTION_PACK_KEYS 2 +#define HA_OPTION_COMPRESS_RECORD 4 +#define HA_OPTION_LONG_BLOB_PTR 8 /* new ISAM format */ +#define HA_OPTION_TMP_TABLE 16 +#define HA_OPTION_CHECKSUM 32 +#define HA_OPTION_DELAY_KEY_WRITE 64 +#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */ +#define HA_OPTION_CREATE_FROM_ENGINE 256 +#define HA_OPTION_RELIES_ON_SQL_LAYER 512 +#define HA_OPTION_NULL_FIELDS 1024 +#define HA_OPTION_PAGE_CHECKSUM 2048 +#define HA_OPTION_TEMP_COMPRESS_RECORD (1L << 15) /* set by isamchk */ +#define HA_OPTION_READ_ONLY_DATA (1L << 16) /* Set by isamchk */ +#define HA_OPTION_NO_CHECKSUM (1L << 17) +#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18) + + /* Bits in flag to create() */ + +#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */ +#define HA_PACK_RECORD 2 /* Request packed record format */ +#define HA_CREATE_TMP_TABLE 4 +#define HA_CREATE_CHECKSUM 8 +#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */ +#define HA_CREATE_PAGE_CHECKSUM 32 +#define HA_CREATE_DELAY_KEY_WRITE 64 +#define HA_CREATE_RELIES_ON_SQL_LAYER 128 + +/* + The following flags (OR-ed) are passed to handler::info() method. + The method copies misc handler information out of the storage engine + to data structures accessible from MySQL + + Same flags are also passed down to mi_status, myrg_status, etc. +*/ + +/* this one is not used */ +#define HA_STATUS_POS 1 +/* + assuming the table keeps shared actual copy of the 'info' and + local, possibly outdated copy, the following flag means that + it should not try to get the actual data (locking the shared structure) + slightly outdated version will suffice +*/ +#define HA_STATUS_NO_LOCK 2 +/* update the time of the last modification (in handler::update_time) */ +#define HA_STATUS_TIME 4 +/* + update the 'constant' part of the info: + handler::max_data_file_length, max_index_file_length, create_time + sortkey, ref_length, block_size, data_file_name, index_file_name. + handler::table->s->keys_in_use, keys_for_keyread, rec_per_key +*/ +#define HA_STATUS_CONST 8 +/* + update the 'variable' part of the info: + handler::records, deleted, data_file_length, index_file_length, + delete_length, check_time, mean_rec_length +*/ +#define HA_STATUS_VARIABLE 16 +/* + get the information about the key that caused last duplicate value error + update handler::errkey and handler::dupp_ref + see handler::get_dup_key() +*/ +#define HA_STATUS_ERRKEY 32 +/* + update handler::auto_increment_value +*/ +#define HA_STATUS_AUTO 64 + +/* + Errorcodes given by handler functions + + opt_sum_query() assumes these codes are > 1 + Do not add error numbers before HA_ERR_FIRST. + If necessary to add lower numbers, change HA_ERR_FIRST accordingly. +*/ +#define HA_ERR_FIRST 120 /* Copy of first error nr.*/ + +#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */ +#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */ +#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */ +#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */ +#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */ +#define HA_ERR_CRASHED 126 /* Indexfile is crashed */ +#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */ +#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */ +#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */ +#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ +#define HA_ERR_OLD_FILE 132 /* old databasfile */ +#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ +#define HA_ERR_RECORD_DELETED 134 /* A record is not there */ +#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */ +#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */ +#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */ +#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */ +#define HA_ERR_TO_BIG_ROW 139 /* Too big row */ +#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */ +#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */ +#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */ +#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */ +#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ +#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ +#define HA_ERR_LOCK_WAIT_TIMEOUT 146 +#define HA_ERR_LOCK_TABLE_FULL 147 +#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */ +#define HA_ERR_LOCK_DEADLOCK 149 +#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* Cannot add a foreign key constr. */ +#define HA_ERR_NO_REFERENCED_ROW 151 /* Cannot add a child row */ +#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */ +#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */ +#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */ +#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */ +#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ +#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ +/* NULLs are not supported in spatial index */ +#define HA_ERR_NULL_IN_SPATIAL 158 +#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ +/* There's no partition in table for given value */ +#define HA_ERR_NO_PARTITION_FOUND 160 +#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */ +#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */ +/* + Upholding foreign key constraints would lead to a duplicate key error + in some other table. +*/ +#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 +/* The table changed in storage engine */ +#define HA_ERR_TABLE_NEEDS_UPGRADE 164 +#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */ + +#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */ +#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */ +#define HA_ERR_GENERIC 168 /* Generic error */ +/* row not actually updated: new values same as the old values */ +#define HA_ERR_RECORD_IS_THE_SAME 169 +/* It is not possible to log this statement */ +#define HA_ERR_LOGGING_IMPOSSIBLE 170 +#define HA_ERR_TABLESPACE_EXIST 171 +/* The event was corrupt, leading to illegal data being read */ +#define HA_ERR_CORRUPT_EVENT 172 +#define HA_ERR_NEW_FILE 173 /* New file format */ +/* The event could not be processed no other handler error happened */ +#define HA_ERR_ROWS_EVENT_APPLY 174 +#define HA_ERR_INITIALIZATION 175 /* Error during initialization */ +#define HA_ERR_FILE_TOO_SHORT 176 /* File too short */ +#define HA_ERR_WRONG_CRC 177 /* Wrong CRC on page */ +#define HA_ERR_LOCK_OR_ACTIVE_TRANSACTION 178 +#define HA_ERR_NO_SUCH_TABLESPACE 179 +#define HA_ERR_TABLESPACE_NOT_EMPTY 180 +#define HA_ERR_TABLESPACE_DATAFILE_EXIST 181 +#define HA_ERR_ROW_NOT_VISIBLE 182 +#define HA_ERR_LAST 182 /* Copy of last error nr */ + +/* Number of different errors */ +#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) + + /* Other constants */ + +#define HA_NAMELEN 64 /* Max length of saved filename */ +#define NO_SUCH_KEY (~(uint)0) /* used as a key no. */ + +typedef ulong key_part_map; +#define HA_WHOLE_KEY (~(key_part_map)0) + + /* Intern constants in databases */ + + /* bits in _search */ +#define SEARCH_FIND 1 +#define SEARCH_NO_FIND 2 +#define SEARCH_SAME 4 +#define SEARCH_BIGGER 8 +#define SEARCH_SMALLER 16 +#define SEARCH_SAVE_BUFF 32 +#define SEARCH_UPDATE 64 +#define SEARCH_PREFIX 128 +#define SEARCH_LAST 256 +#define MBR_CONTAIN 512 +#define MBR_INTERSECT 1024 +#define MBR_WITHIN 2048 +#define MBR_DISJOINT 4096 +#define MBR_EQUAL 8192 +#define MBR_DATA 16384 +#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */ +#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */ +/* Use this when inserting a key in position order */ +#define SEARCH_INSERT SEARCH_NULL_ARE_NOT_EQUAL*2 +/* Only part of the key is specified while reading */ +#define SEARCH_PART_KEY SEARCH_INSERT*2 +/* Used when user key (key 2) contains transaction id's */ +#define SEARCH_USER_KEY_HAS_TRANSID SEARCH_PART_KEY*2 +/* Used when page key (key 1) contains transaction id's */ +#define SEARCH_PAGE_KEY_HAS_TRANSID SEARCH_USER_KEY_HAS_TRANSID*2 + + /* bits in opt_flag */ +#define QUICK_USED 1 +#define READ_CACHE_USED 2 +#define READ_CHECK_USED 4 +#define KEY_READ_USED 8 +#define WRITE_CACHE_USED 16 +#define OPT_NO_ROWS 32 + + /* bits in update */ +#define HA_STATE_CHANGED 1 /* Database has changed */ +#define HA_STATE_AKTIV 2 /* Has a current record */ +#define HA_STATE_WRITTEN 4 /* Record is written */ +#define HA_STATE_DELETED 8 +#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */ +#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */ +#define HA_STATE_NO_KEY 64 /* Last read didn't find record */ +#define HA_STATE_KEY_CHANGED 128 +#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */ +#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ +#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ +#define HA_STATE_EXTEND_BLOCK 2048 +#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */ + +/* myisampack expects no more than 32 field types. */ +enum en_fieldtype { + FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE, + FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO, + FIELD_VARCHAR,FIELD_CHECK, + FIELD_enum_val_count +}; + +enum data_file_type { + STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD +}; + +/* For key ranges */ + +/* from -inf */ +#define NO_MIN_RANGE 1 + +/* to +inf */ +#define NO_MAX_RANGE 2 + +/* X < key, i.e. not including the left endpoint */ +#define NEAR_MIN 4 + +/* X > key, i.e. not including the right endpoint */ +#define NEAR_MAX 8 + +/* + This flag means that index is a unique index, and the interval is + equivalent to "AND(keypart_i = const_i)", where all of const_i are not NULLs. +*/ +#define UNIQUE_RANGE 16 + +/* + This flag means that the interval is equivalent to + "AND(keypart_i = const_i)", where not all key parts may be used but all of + const_i are not NULLs. +*/ +#define EQ_RANGE 32 + +/* + This flag has the same meaning as UNIQUE_RANGE, except that for at least + one keypart the condition is "keypart IS NULL". +*/ +#define NULL_RANGE 64 + +#define GEOM_FLAG 128 + +#define SKIP_RANGE 256 +#define EMPTY_RANGE 512 + +typedef struct st_key_range +{ + const uchar *key; + uint length; + key_part_map keypart_map; + enum ha_rkey_function flag; +} key_range; + +typedef struct st_key_multi_range +{ + key_range start_key; + key_range end_key; + char *ptr; /* Free to use by caller (ptr to row etc) */ + uint range_flag; /* key range flags see above */ +} KEY_MULTI_RANGE; + + +/* For number of records */ +#ifdef BIG_TABLES +#define rows2double(A) ulonglong2double(A) +typedef my_off_t ha_rows; +#else +#define rows2double(A) (double) (A) +typedef ulong ha_rows; +#endif + +#define HA_POS_ERROR (~ (ha_rows) 0) +#define HA_OFFSET_ERROR (~ (my_off_t) 0) + +#if SYSTEM_SIZEOF_OFF_T == 4 +#define MAX_FILE_SIZE INT_MAX32 +#else +#define MAX_FILE_SIZE LONGLONG_MAX +#endif + +#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2) + +/* invalidator function reference for Query Cache */ +typedef void (* invalidator_by_filename)(const char * filename); + +#endif /* _my_base_h */ diff --git a/externals/mysql/my_bit.h b/externals/mysql/my_bit.h new file mode 100644 index 0000000..2e464e8 --- /dev/null +++ b/externals/mysql/my_bit.h @@ -0,0 +1,109 @@ +/* + Some useful bit functions +*/ + +C_MODE_START +#ifdef HAVE_INLINE + +extern const char _my_bits_nbits[256]; +extern const uchar _my_bits_reverse_table[256]; + +/* + Find smallest X in 2^X >= value + This can be used to divide a number with value by doing a shift instead +*/ + +STATIC_INLINE uint my_bit_log2(ulong value) +{ + uint bit; + for (bit=0 ; value > 1 ; value>>=1, bit++) ; + return bit; +} + +STATIC_INLINE uint my_count_bits(ulonglong v) +{ +#if SIZEOF_LONG_LONG > 4 + /* The following code is a bit faster on 16 bit machines than if we would + only shift v */ + ulong v2=(ulong) (v >> 32); + return (uint) (uchar) (_my_bits_nbits[(uchar) v] + + _my_bits_nbits[(uchar) (v >> 8)] + + _my_bits_nbits[(uchar) (v >> 16)] + + _my_bits_nbits[(uchar) (v >> 24)] + + _my_bits_nbits[(uchar) (v2)] + + _my_bits_nbits[(uchar) (v2 >> 8)] + + _my_bits_nbits[(uchar) (v2 >> 16)] + + _my_bits_nbits[(uchar) (v2 >> 24)]); +#else + return (uint) (uchar) (_my_bits_nbits[(uchar) v] + + _my_bits_nbits[(uchar) (v >> 8)] + + _my_bits_nbits[(uchar) (v >> 16)] + + _my_bits_nbits[(uchar) (v >> 24)]); +#endif +} + +STATIC_INLINE uint my_count_bits_ushort(ushort v) +{ + return _my_bits_nbits[v]; +} + + +/* + Next highest power of two + + SYNOPSIS + my_round_up_to_next_power() + v Value to check + + RETURN + Next or equal power of 2 + Note: 0 will return 0 + + NOTES + Algorithm by Sean Anderson, according to: + http://graphics.stanford.edu/~seander/bithacks.html + (Orignal code public domain) + + Comments shows how this works with 01100000000000000000000000001011 +*/ + +STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v) +{ + v--; /* 01100000000000000000000000001010 */ + v|= v >> 1; /* 01110000000000000000000000001111 */ + v|= v >> 2; /* 01111100000000000000000000001111 */ + v|= v >> 4; /* 01111111110000000000000000001111 */ + v|= v >> 8; /* 01111111111111111100000000001111 */ + v|= v >> 16; /* 01111111111111111111111111111111 */ + return v+1; /* 10000000000000000000000000000000 */ +} + +STATIC_INLINE uint32 my_clear_highest_bit(uint32 v) +{ + uint32 w=v >> 1; + w|= w >> 1; + w|= w >> 2; + w|= w >> 4; + w|= w >> 8; + w|= w >> 16; + return v & w; +} + +STATIC_INLINE uint32 my_reverse_bits(uint32 key) +{ + return + (_my_bits_reverse_table[ key & 255] << 24) | + (_my_bits_reverse_table[(key>> 8) & 255] << 16) | + (_my_bits_reverse_table[(key>>16) & 255] << 8) | + _my_bits_reverse_table[(key>>24) ]; +} + +#else /* HAVE_INLINE */ +extern uint my_bit_log2(ulong value); +extern uint32 my_round_up_to_next_power(uint32 v); +uint32 my_clear_highest_bit(uint32 v); +uint32 my_reverse_bits(uint32 key); +extern uint my_count_bits(ulonglong v); +extern uint my_count_bits_ushort(ushort v); +#endif /* HAVE_INLINE */ +C_MODE_END diff --git a/externals/mysql/my_bitmap.h b/externals/mysql/my_bitmap.h new file mode 100644 index 0000000..d8c9a0c --- /dev/null +++ b/externals/mysql/my_bitmap.h @@ -0,0 +1,182 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _my_bitmap_h_ +#define _my_bitmap_h_ + +#define MY_BIT_NONE (~(uint) 0) + +#include + +typedef uint32 my_bitmap_map; + +typedef struct st_bitmap +{ + my_bitmap_map *bitmap; + uint n_bits; /* number of bits occupied by the above */ + my_bitmap_map last_word_mask; + my_bitmap_map *last_word_ptr; + /* + mutex will be acquired for the duration of each bitmap operation if + thread_safe flag in bitmap_init was set. Otherwise, we optimize by not + acquiring the mutex + */ +#ifdef THREAD + pthread_mutex_t *mutex; +#endif +} MY_BITMAP; + +#ifdef __cplusplus +extern "C" { +#endif +extern void create_last_word_mask(MY_BITMAP *map); +extern my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, + my_bool thread_safe); +extern my_bool bitmap_is_clear_all(const MY_BITMAP *map); +extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size); +extern my_bool bitmap_is_set_all(const MY_BITMAP *map); +extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2); +extern my_bool bitmap_is_overlapping(const MY_BITMAP *map1, + const MY_BITMAP *map2); +extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit); +extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit); +extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit); +extern uint bitmap_set_next(MY_BITMAP *map); +extern uint bitmap_get_first(const MY_BITMAP *map); +extern uint bitmap_get_first_set(const MY_BITMAP *map); +extern uint bitmap_bits_set(const MY_BITMAP *map); +extern void bitmap_free(MY_BITMAP *map); +extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit); +extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size); +extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_invert(MY_BITMAP *map); +extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2); + +extern uint bitmap_lock_set_next(MY_BITMAP *map); +extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit); +#ifdef NOT_USED +extern uint bitmap_lock_bits_set(const MY_BITMAP *map); +extern my_bool bitmap_lock_is_set_all(const MY_BITMAP *map); +extern uint bitmap_lock_get_first(const MY_BITMAP *map); +extern uint bitmap_lock_get_first_set(const MY_BITMAP *map); +extern my_bool bitmap_lock_is_subset(const MY_BITMAP *map1, + const MY_BITMAP *map2); +extern my_bool bitmap_lock_is_prefix(const MY_BITMAP *map, uint prefix_size); +extern my_bool bitmap_lock_is_set(const MY_BITMAP *map, uint bitmap_bit); +extern my_bool bitmap_lock_is_clear_all(const MY_BITMAP *map); +extern my_bool bitmap_lock_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2); +extern void bitmap_lock_set_all(MY_BITMAP *map); +extern void bitmap_lock_clear_all(MY_BITMAP *map); +extern void bitmap_lock_set_bit(MY_BITMAP *map, uint bitmap_bit); +extern void bitmap_lock_flip_bit(MY_BITMAP *map, uint bitmap_bit); +extern void bitmap_lock_set_prefix(MY_BITMAP *map, uint prefix_size); +extern void bitmap_lock_intersect(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_subtract(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_union(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_xor(MY_BITMAP *map, const MY_BITMAP *map2); +extern void bitmap_lock_invert(MY_BITMAP *map); +#endif +/* Fast, not thread safe, bitmap functions */ +#define bitmap_buffer_size(bits) (((bits)+31)/32)*4 +#define no_bytes_in_map(map) (((map)->n_bits + 7)/8) +#define no_words_in_map(map) (((map)->n_bits + 31)/32) +#define bytes_word_aligned(bytes) (4*((bytes + 3)/4)) +#define _bitmap_set_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + |= (1 << ((BIT) & 7))) +#define _bitmap_flip_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + ^= (1 << ((BIT) & 7))) +#define _bitmap_clear_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + &= ~ (1 << ((BIT) & 7))) +#define _bitmap_is_set(MAP, BIT) (uint) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \ + & (1 << ((BIT) & 7))) +/* + WARNING! + + The below symbols are inline functions in DEBUG builds and macros in + non-DEBUG builds. The latter evaluate their 'bit' argument twice. + + NEVER use an increment/decrement operator with the 'bit' argument. + It would work with DEBUG builds, but fails later in production builds! + + FORBIDDEN: bitmap_set_bit($my_bitmap, (field++)->field_index); +*/ +#ifndef DBUG_OFF +static inline void +bitmap_set_bit(MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + _bitmap_set_bit(map,bit); +} +static inline void +bitmap_flip_bit(MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + _bitmap_flip_bit(map,bit); +} +static inline void +bitmap_clear_bit(MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + _bitmap_clear_bit(map,bit); +} +static inline uint +bitmap_is_set(const MY_BITMAP *map,uint bit) +{ + DBUG_ASSERT(bit < (map)->n_bits); + return _bitmap_is_set(map,bit); +} +#else +#define bitmap_set_bit(MAP, BIT) _bitmap_set_bit(MAP, BIT) +#define bitmap_flip_bit(MAP, BIT) _bitmap_flip_bit(MAP, BIT) +#define bitmap_clear_bit(MAP, BIT) _bitmap_clear_bit(MAP, BIT) +#define bitmap_is_set(MAP, BIT) _bitmap_is_set(MAP, BIT) +#endif + +static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) +{ + *(map1)->last_word_ptr|= (map1)->last_word_mask; + *(map2)->last_word_ptr|= (map2)->last_word_mask; + return memcmp((map1)->bitmap, (map2)->bitmap, 4*no_words_in_map((map1)))==0; +} + +#define bitmap_clear_all(MAP) \ + { memset((MAP)->bitmap, 0, 4*no_words_in_map((MAP))); } +#define bitmap_set_all(MAP) \ + (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) + +/** + check, set and clear a bit of interest of an integer. + + If the bit is out of range @retval -1. Otherwise + bit_is_set @return 0 or 1 reflecting the bit is set or not; + bit_do_set @return 1 (bit is set 1) + bit_do_clear @return 0 (bit is cleared to 0) +*/ + +#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ + (((I) & (1ULL << (B))) == 0 ? 0 : 1) : -1) +#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ + ((I) |= (1ULL << (B)), 1) : -1) +#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ + ((I) &= ~(1ULL << (B)), 0) : -1) + +#ifdef __cplusplus +} +#endif + +#endif /* _my_bitmap_h_ */ diff --git a/externals/mysql/my_charsets.h b/externals/mysql/my_charsets.h new file mode 100644 index 0000000..ecb0de9 --- /dev/null +++ b/externals/mysql/my_charsets.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Character set configuration (hard-coded) */ +#define HAVE_CHARSET_armscii8 1 +#define HAVE_CHARSET_ascii 1 +#define HAVE_CHARSET_big5 1 +#define HAVE_CHARSET_cp1250 1 +#define HAVE_CHARSET_cp1251 1 +#define HAVE_CHARSET_cp1256 1 +#define HAVE_CHARSET_cp1257 1 +#define HAVE_CHARSET_cp850 1 +#define HAVE_CHARSET_cp852 1 +#define HAVE_CHARSET_cp866 1 +#define HAVE_CHARSET_cp932 1 +#define HAVE_CHARSET_dec8 1 +#define HAVE_CHARSET_eucjpms 1 +#define HAVE_CHARSET_euckr 1 +#define HAVE_CHARSET_gb2312 1 +#define HAVE_CHARSET_gbk 1 +#define HAVE_CHARSET_greek 1 +#define HAVE_CHARSET_hebrew 1 +#define HAVE_CHARSET_hp8 1 +#define HAVE_CHARSET_keybcs2 1 +#define HAVE_CHARSET_koi8r 1 +#define HAVE_CHARSET_koi8u 1 +#define HAVE_CHARSET_latin1 1 +#define HAVE_CHARSET_latin2 1 +#define HAVE_CHARSET_latin5 1 +#define HAVE_CHARSET_latin7 1 +#define HAVE_CHARSET_macce 1 +#define HAVE_CHARSET_macroman 1 +#define HAVE_CHARSET_sjis 1 +#define HAVE_CHARSET_swe7 1 +#define HAVE_CHARSET_tis620 1 +#define HAVE_CHARSET_ucs2 1 +#define HAVE_CHARSET_ujis 1 +#define HAVE_CHARSET_utf16 1 +#define HAVE_CHARSET_utf32 1 +#define HAVE_CHARSET_utf8mb3 1 +#define HAVE_CHARSET_utf8mb4 1 +#define HAVE_UCA_COLLATIONS 1 +#define MYSQL_DEFAULT_CHARSET_NAME "latin1" +#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" +#define USE_MB 1 diff --git a/externals/mysql/my_config.h b/externals/mysql/my_config.h new file mode 100644 index 0000000..adea8db --- /dev/null +++ b/externals/mysql/my_config.h @@ -0,0 +1,295 @@ + +/* Headers we may want to use. */ +/* #undef HAVE_ALLOCA_H */ +/* #undef HAVE_ARPA_INET_H */ +/* #undef HAVE_CRYPT_H */ +/* #undef HAVE_DIRENT_H */ +/* #undef HAVE_EXECINFO_H */ +#define HAVE_FCNTL_H 1 +/* #undef HAVE_FENV_H */ +#define HAVE_FLOAT_H 1 +/* #undef HAVE_FPU_CONTROL_H */ +/* #undef HAVE_GRP_H */ +/* #undef HAVE_IEEEFP_H */ +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +/* #undef HAVE_NETINET_IN_H */ +/* #undef HAVE_PATHS_H */ +/* #undef HAVE_PWD_H */ +/* #undef HAVE_SCHED_H */ +/* #undef HAVE_SELECT_H */ +#define HAVE_STDDEF_H 1 +#define HAVE_STDLIB_H 1 +/* #undef HAVE_STRINGS_H */ +#define HAVE_STRING_H 1 +/* #undef HAVE_SYNCH_H */ +/* #undef HAVE_SYSENT_H */ +/* #undef HAVE_SYS_FPU_H */ +/* #undef HAVE_SYS_IOCTL_H */ +/* #undef HAVE_SYS_IPC_H */ +/* #undef HAVE_SYS_MMAN_H */ +/* #undef HAVE_SYS_PRCTL_H */ +/* #undef HAVE_SYS_SELECT_H */ +/* #undef HAVE_SYS_SHM_H */ +/* #undef HAVE_SYS_SOCKET_H */ +#define HAVE_SYS_STAT_H 1 +/* #undef HAVE_SYS_STREAM_H */ +#define HAVE_SYS_TIMEB_H 1 +#define HAVE_SYS_TYPES_H 1 +/* #undef HAVE_SYS_UN_H */ +/* #undef HAVE_TERMIOS_H */ +/* #undef HAVE_TERMIO_H */ +/* #undef HAVE_UNISTD_H */ +/* #undef HAVE_UTIME_H */ + +/* Functions we may want to use. */ +#define HAVE_ACCESS 1 +/* #undef HAVE_AIOWAIT */ +/* #undef HAVE_ALARM */ +/* #undef HAVE_ALLOCA */ +/* #undef HAVE_BCMP */ +/* #undef HAVE_BFILL */ +/* #undef HAVE_BMOVE */ +/* #undef HAVE_BZERO */ +/* #undef HAVE_CLOCK_GETTIME */ +/* #undef HAVE_COMPRESS */ +/* #undef HAVE_CRYPT */ +/* #undef HAVE_DLERROR */ +/* #undef HAVE_DLOPEN */ +/* #undef HAVE_FCHMOD */ +/* #undef HAVE_FCNTL */ +/* #undef HAVE_FCONVERT */ +/* #undef HAVE_FDATASYNC */ +/* #undef HAVE_FESETROUND */ +/* #undef HAVE_FINITE */ +/* #undef HAVE_FP_EXCEPT */ +/* #undef HAVE_FSEEKO */ +/* #undef HAVE_FSYNC */ +/* #undef HAVE_GETADDRINFO */ +#define HAVE_GETCWD 1 +/* #undef HAVE_GETHOSTBYADDR_R */ +/* #undef HAVE_GETHOSTBYNAME_R */ +/* #undef HAVE_GETHRTIME */ +/* #undef HAVE_GETNAMEINFO */ +/* #undef HAVE_GETPAGESIZE */ +/* #undef HAVE_GETPASS */ +/* #undef HAVE_GETPASSPHRASE */ +/* #undef HAVE_GETPWNAM */ +/* #undef HAVE_GETPWUID */ +/* #undef HAVE_GETRLIMIT */ +/* #undef HAVE_GETRUSAGE */ +/* #undef HAVE_GETWD */ +/* #undef HAVE_GMTIME_R */ +/* #undef HAVE_INITGROUPS */ +/* #undef HAVE_ISNAN */ +#define HAVE_LDIV 1 +/* #undef HAVE_LOCALTIME_R */ +/* #undef HAVE_LOG2 */ +#define HAVE_LONGJMP 1 +/* #undef HAVE_LSTAT */ +/* #undef HAVE_MADVISE */ +/* #undef HAVE_DECL_MADVISE */ +/* #undef HAVE_MALLINFO */ +#define HAVE_MEMCPY 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMMOVE 1 +/* #undef HAVE_MKSTEMP */ +/* #undef HAVE_MLOCK */ +/* #undef HAVE_MLOCKALL */ +/* #undef HAVE_MMAP */ +/* #undef HAVE_MMAP64 */ +#define HAVE_PERROR 1 +/* #undef HAVE_POLL */ +/* #undef HAVE_PREAD */ +/* #undef HAVE_PTHREAD_ATTR_CREATE */ +/* #undef HAVE_PTHREAD_ATTR_GETSTACKSIZE */ +/* #undef HAVE_PTHREAD_ATTR_SETPRIO */ +/* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */ +/* #undef HAVE_PTHREAD_ATTR_SETSCOPE */ +/* #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE */ +/* #undef HAVE_PTHREAD_CONDATTR_CREATE */ +/* #undef HAVE_PTHREAD_INIT */ +/* #undef HAVE_PTHREAD_KEY_DELETE */ +/* #undef HAVE_PTHREAD_KEY_DELETE */ +/* #undef HAVE_PTHREAD_KILL */ +/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */ +/* #undef HAVE_PTHREAD_SETPRIO_NP */ +/* #undef HAVE_PTHREAD_SETSCHEDPARAM */ +/* #undef HAVE_PTHREAD_SIGMASK */ +/* #undef HAVE_PTHREAD_THREADMASK */ +/* #undef HAVE_PTHREAD_YIELD_NP */ +/* #undef HAVE_READDIR_R */ +/* #undef HAVE_READLINK */ +/* #undef HAVE_REALPATH */ +#define HAVE_RENAME 1 +/* #undef HAVE_RINT */ +/* #undef HAVE_SCHED_YIELD */ +/* #undef HAVE_SELECT */ +/* #undef HAVE_SETFD */ +/* #undef HAVE_SETFILEPOINTER */ +/* #undef HAVE_SIGACTION */ +/* #undef HAVE_SIGTHREADMASK */ +/* #undef HAVE_SIGWAIT */ +/* #undef HAVE_SLEEP */ +/* #undef HAVE_SNPRINTF */ +/* #undef HAVE_STPCPY */ +#define HAVE_STRERROR 1 +/* #undef HAVE_STRLCPY */ +#define HAVE_STRNLEN 1 +#define HAVE_STRPBRK 1 +/* #undef HAVE_STRSEP */ +#define HAVE_STRSTR 1 +/* #undef HAVE_STRTOK_R */ +/* #undef HAVE_STRTOK_R */ +#define HAVE_STRTOL 1 +/* #undef HAVE_STRTOLL */ +#define HAVE_STRTOUL 1 +/* #undef HAVE_STRTOULL */ +#define HAVE_TELL 1 +/* #undef HAVE_THR_SETCONCURRENCY */ +/* #undef HAVE_THR_YIELD */ +/* #undef HAVE_VASPRINTF */ +#define HAVE_VSNPRINTF 1 + +/* Symbols we may use */ +/* #undef HAVE_SYS_ERRLIST */ +/* used by stacktrace functions */ +/* #undef HAVE_BSS_START */ + +/* Does "struct timespec" have a "sec" and "nsec" field? */ +/* #undef HAVE_TIMESPEC_TS_SEC */ + +/* Types we may use */ +#define SIZEOF_CHAR 1 +#if SIZEOF_CHAR +# define HAVE_CHAR 1 +#endif + +#define SIZEOF_CHARP 4 +#if SIZEOF_CHARP +# define HAVE_CHARP 1 +#endif + +#define SIZEOF_SHORT 2 +#if SIZEOF_SHORT +# define HAVE_SHORT 1 +#endif + +#define SIZEOF_INT 4 +#if SIZEOF_INT +# define HAVE_INT 1 +#endif + +#define SIZEOF_LONG 4 +#if SIZEOF_LONG +# define HAVE_LONG 1 +#endif + +#define SIZEOF_LONG_LONG 8 +#if SIZEOF_LONG_LONG +# define HAVE_LONG_LONG 1 +#endif + +#define SIZEOF_OFF_T 4 +#if SIZEOF_OFF_T +# define HAVE_OFF_T 1 +#endif + +/* #undef SIZEOF_SIGSET_T */ +#if SIZEOF_SIGSET_T +# define HAVE_SIGSET_T 1 +#endif + +#define SIZEOF_SIZE_T 4 +#if SIZEOF_SIZE_T +# define HAVE_SIZE_T 1 +#endif + +/* #undef SIZEOF_UCHAR */ +#if SIZEOF_UCHAR +# define HAVE_UCHAR 1 +#endif + +/* #undef SIZEOF_UINT */ +#if SIZEOF_UINT +# define HAVE_UINT 1 +#endif + +/* #undef SIZEOF_ULONG */ +#if SIZEOF_ULONG +# define HAVE_ULONG 1 +#endif + +/* #undef SIZEOF_INT8 */ +#if SIZEOF_INT8 +# define HAVE_INT8 1 +#endif +/* #undef SIZEOF_UINT8 */ +#if SIZEOF_UINT8 +# define HAVE_UINT8 1 +#endif + +/* #undef SIZEOF_INT16 */ +#if SIZEOF_INT16 +# define HAVE_INT16 1 +#endif +/* #undef SIZEOF_UINT16 */ +#if SIZEOF_UINT16 +# define HAVE_UINT16 1 +#endif + +/* #undef SIZEOF_INT32 */ +#if SIZEOF_INT32 +# define HAVE_INT32 1 +#endif +/* #undef SIZEOF_UINT32 */ +#if SIZEOF_UINT32 +# define HAVE_UINT32 1 +#endif +/* #undef SIZEOF_U_INT32_T */ +#if SIZEOF_U_INT32_T +# define HAVE_U_INT32_T 1 +#endif + +/* #undef SIZEOF_INT64 */ +#if SIZEOF_INT64 +# define HAVE_INT64 1 +#endif +/* #undef SIZEOF_UINT64 */ +#if SIZEOF_UINT64 +# define HAVE_UINT64 1 +#endif + +/* #undef SIZEOF_SOCKLEN_T */ +#if SIZEOF_SOCKLEN_T +# define HAVE_SOCKLEN_T 1 +#endif + +/* XXX mysql_client_test uses this -- rip it out, please! */ +#define MAX_INDEXES 64 + +#define QSORT_TYPE_IS_VOID 1 +#define RETQSORTTYPE void + +#define SIGNAL_RETURN_TYPE_IS_VOID 1 +#define RETSIGTYPE void + +/* #undef WORDS_BIGENDIAN */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler calls + it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +# define inline +#endif + +#define TIME_WITH_SYS_TIME 1 + +#define STACK_DIRECTION -1 + +#define SHAREDIR "share" +#define THREAD 1 +#define THREAD_SAFE_CLIENT 1 + +#define DEFAULT_CHARSET_HOME "C:/mysql/" diff --git a/externals/mysql/my_dbug.h b/externals/mysql/my_dbug.h new file mode 100644 index 0000000..c4a2f88 --- /dev/null +++ b/externals/mysql/my_dbug.h @@ -0,0 +1,140 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _dbug_h +#define _dbug_h + +#ifdef __cplusplus +extern "C" { +#endif +#if !defined(DBUG_OFF) && !defined(_lint) + +struct _db_stack_frame_ { + const char *func; /* function name of the previous stack frame */ + const char *file; /* filename of the function of previous frame */ + uint level; /* this nesting level, highest bit enables tracing */ + struct _db_stack_frame_ *prev; /* pointer to the previous frame */ +}; + +struct _db_code_state_; +extern my_bool _dbug_on_; +extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int); +extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len); +extern int _db_explain_init_(char *buf, size_t len); +extern int _db_is_pushed_(void); +extern void _db_setjmp_(void); +extern void _db_longjmp_(void); +extern void _db_process_(const char *name); +extern void _db_push_(const char *control); +extern void _db_pop_(void); +extern void _db_set_(const char *control); +extern void _db_set_init_(const char *control); +extern void _db_enter_(const char *_func_, const char *_file_, uint _line_, + struct _db_stack_frame_ *_stack_frame_); +extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_); +extern void _db_pargs_(uint _line_,const char *keyword); +extern void _db_doprnt_ _VARARGS((const char *format,...)) + ATTRIBUTE_FORMAT(printf, 1, 2); +extern void _db_dump_(uint _line_,const char *keyword, + const unsigned char *memory, size_t length); +extern void _db_end_(void); +extern void _db_lock_file_(void); +extern void _db_unlock_file_(void); +extern FILE *_db_fp_(void); +extern void _db_flush_(); + +#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \ + _db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_) +#define DBUG_LEAVE _db_return_ (__LINE__, &_db_stack_frame_) +#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0) +#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) +#define DBUG_EXECUTE(keyword,a1) \ + do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0) +#define DBUG_EXECUTE_IF(keyword,a1) \ + do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0) +#define DBUG_EVALUATE(keyword,a1,a2) \ + (_db_keyword_(0,(keyword), 0) ? (a1) : (a2)) +#define DBUG_EVALUATE_IF(keyword,a1,a2) \ + (_db_keyword_(0,(keyword), 1) ? (a1) : (a2)) +#define DBUG_PRINT(keyword,arglist) \ + do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0) +#define DBUG_PUSH(a1) _db_push_ (a1) +#define DBUG_POP() _db_pop_ () +#define DBUG_SET(a1) _db_set_ (a1) +#define DBUG_SET_INITIAL(a1) _db_set_init_ (a1) +#define DBUG_PROCESS(a1) _db_process_(a1) +#define DBUG_FILE _db_fp_() +#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) +#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) +#define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) +#define DBUG_END() _db_end_ () +#define DBUG_LOCK_FILE _db_lock_file_() +#define DBUG_UNLOCK_FILE _db_unlock_file_() +#define DBUG_ASSERT(A) assert(A) +#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) +#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) +#define DEBUGGER_OFF do { _dbug_on_= 0; } while(0) +#define DEBUGGER_ON do { _dbug_on_= 1; } while(0) +#define IF_DBUG(A) A +#ifndef __WIN__ +#define DBUG_ABORT() (_db_flush_(), abort()) +#else +/* + Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can + call abort() instead of _exit(3) (now it would cause a "test signal" popup). +*/ +#include +#define DBUG_ABORT() (_db_flush_(),\ + (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\ + (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\ + _exit(3)) +#endif + +#else /* No debugger */ + +#define DBUG_ENTER(a1) +#define DBUG_LEAVE +#define DBUG_RETURN(a1) do { return(a1); } while(0) +#define DBUG_VOID_RETURN do { return; } while(0) +#define DBUG_EXECUTE(keyword,a1) do { } while(0) +#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0) +#define DBUG_EVALUATE(keyword,a1,a2) (a2) +#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2) +#define DBUG_PRINT(keyword,arglist) do { } while(0) +#define DBUG_PUSH(a1) do { } while(0) +#define DBUG_SET(a1) do { } while(0) +#define DBUG_SET_INITIAL(a1) do { } while(0) +#define DBUG_POP() do { } while(0) +#define DBUG_PROCESS(a1) do { } while(0) +#define DBUG_SETJMP(a1) setjmp(a1) +#define DBUG_LONGJMP(a1) longjmp(a1) +#define DBUG_DUMP(keyword,a1,a2) do { } while(0) +#define DBUG_END() do { } while(0) +#define DBUG_ASSERT(A) do { } while(0) +#define DBUG_LOCK_FILE do { } while(0) +#define DBUG_FILE (stderr) +#define DBUG_UNLOCK_FILE do { } while(0) +#define DBUG_EXPLAIN(buf,len) +#define DBUG_EXPLAIN_INITIAL(buf,len) +#define DEBUGGER_OFF do { } while(0) +#define DEBUGGER_ON do { } while(0) +#define IF_DBUG(A) +#define DBUG_ABORT() abort() + +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/my_dir.h b/externals/mysql/my_dir.h new file mode 100644 index 0000000..90d708a --- /dev/null +++ b/externals/mysql/my_dir.h @@ -0,0 +1,109 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _my_dir_h +#define _my_dir_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MY_DIR_H +#define MY_DIR_H + +#include + + /* Defines for my_dir and my_stat */ + +#define MY_S_IFMT S_IFMT /* type of file */ +#define MY_S_IFDIR S_IFDIR /* directory */ +#define MY_S_IFCHR S_IFCHR /* character special */ +#define MY_S_IFBLK S_IFBLK /* block special */ +#define MY_S_IFREG S_IFREG /* regular */ +#define MY_S_IFIFO S_IFIFO /* fifo */ +#define MY_S_ISUID S_ISUID /* set user id on execution */ +#define MY_S_ISGID S_ISGID /* set group id on execution */ +#define MY_S_ISVTX S_ISVTX /* save swapped text even after use */ +#define MY_S_IREAD S_IREAD /* read permission, owner */ +#define MY_S_IWRITE S_IWRITE /* write permission, owner */ +#define MY_S_IEXEC S_IEXEC /* execute/search permission, owner */ + +#define MY_S_ISDIR(m) (((m) & MY_S_IFMT) == MY_S_IFDIR) +#define MY_S_ISCHR(m) (((m) & MY_S_IFMT) == MY_S_IFCHR) +#define MY_S_ISBLK(m) (((m) & MY_S_IFMT) == MY_S_IFBLK) +#define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG) +#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO) + +#define MY_DONT_SORT 512 /* my_lib; Don't sort files */ +#define MY_WANT_STAT 1024 /* my_lib; stat files */ + + /* typedefs for my_dir & my_stat */ + +#ifdef USE_MY_STAT_STRUCT + +typedef struct my_stat +{ + dev_t st_dev; /* major & minor device numbers */ + ino_t st_ino; /* inode number */ + ushort st_mode; /* file permissons (& suid sgid .. bits) */ + short st_nlink; /* number of links to file */ + ushort st_uid; /* user id */ + ushort st_gid; /* group id */ + dev_t st_rdev; /* more major & minor device numbers (???) */ + off_t st_size; /* size of file */ + time_t st_atime; /* time for last read */ + time_t st_mtime; /* time for last contens modify */ + time_t st_ctime; /* time for last inode or contents modify */ +} MY_STAT; + +#else + +#if(_MSC_VER) +#define MY_STAT struct _stati64 /* 64 bit file size */ +#else +#define MY_STAT struct stat /* Orginal struct have what we need */ +#endif + +#endif /* USE_MY_STAT_STRUCT */ + +/* Struct describing one file returned from my_dir */ +typedef struct fileinfo +{ + char *name; + MY_STAT *mystat; +} FILEINFO; + +typedef struct st_my_dir /* Struct returned from my_dir */ +{ + /* + These members are just copies of parts of DYNAMIC_ARRAY structure, + which is allocated right after the end of MY_DIR structure (MEM_ROOT + for storing names is also resides there). We've left them here because + we don't want to change code that uses my_dir. + */ + struct fileinfo *dir_entry; + uint number_off_files; +} MY_DIR; + +extern MY_DIR *my_dir(const char *path,myf MyFlags); +extern void my_dirend(MY_DIR *buffer); +extern MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags); +extern int my_fstat(int filenr, MY_STAT *stat_area, myf MyFlags); + +#endif /* MY_DIR_H */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/my_getopt.h b/externals/mysql/my_getopt.h new file mode 100644 index 0000000..7cbad60 --- /dev/null +++ b/externals/mysql/my_getopt.h @@ -0,0 +1,86 @@ +/* Copyright (C) 2002-2004 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _my_getopt_h +#define _my_getopt_h + +C_MODE_START + +#define GET_NO_ARG 1 +#define GET_BOOL 2 +#define GET_INT 3 +#define GET_UINT 4 +#define GET_LONG 5 +#define GET_ULONG 6 +#define GET_LL 7 +#define GET_ULL 8 +#define GET_STR 9 +#define GET_STR_ALLOC 10 +#define GET_DISABLED 11 +#define GET_ENUM 12 +#define GET_SET 13 +#define GET_DOUBLE 14 + +#define GET_ASK_ADDR 128 +#define GET_TYPE_MASK 127 + +enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; + +struct st_typelib; + +struct my_option +{ + const char *name; /* Name of the option */ + int id; /* unique id or short option */ + const char *comment; /* option comment, for autom. --help */ + uchar **value; /* The variable value */ + uchar **u_max_value; /* The user def. max variable value */ + struct st_typelib *typelib; /* Pointer to possible values */ + ulong var_type; + enum get_opt_arg_type arg_type; + longlong def_value; /* Default value */ + longlong min_value; /* Min allowed value */ + longlong max_value; /* Max allowed value */ + longlong sub_size; /* Subtract this from given value */ + long block_size; /* Value should be a mult. of this */ + void *app_type; /* To be used by an application */ +}; + +typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * ); +typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... ); + +extern char *disabled_my_option; +extern my_bool my_getopt_print_errors; +extern my_bool my_getopt_skip_unknown; +extern my_error_reporter my_getopt_error_reporter; + +extern int handle_options (int *argc, char ***argv, + const struct my_option *longopts, my_get_one_option); +extern void my_cleanup_options(const struct my_option *options); +extern void my_print_help(const struct my_option *options); +extern void my_print_variables(const struct my_option *options); +extern void my_getopt_register_get_addr(uchar ** (*func_addr)(const char *, uint, + const struct my_option *, int *)); + +ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, + my_bool *fix); +longlong getopt_ll_limit_value(longlong, const struct my_option *, + my_bool *fix); +my_bool getopt_compare_strings(const char *s, const char *t, uint length); + +C_MODE_END + +#endif /* _my_getopt_h */ + diff --git a/externals/mysql/my_global.h b/externals/mysql/my_global.h new file mode 100644 index 0000000..131507c --- /dev/null +++ b/externals/mysql/my_global.h @@ -0,0 +1,1616 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This is the include file that should be included 'first' in every C file. */ + +#ifndef _global_h +#define _global_h + +/* + InnoDB depends on some MySQL internals which other plugins should not + need. This is because of InnoDB's foreign key support, "safe" binlog + truncation, and other similar legacy features. + + We define accessors for these internals unconditionally, but do not + expose them in mysql/plugin.h. They are declared in ha_innodb.h for + InnoDB's use. +*/ +#define INNODB_COMPATIBILITY_HOOKS + +#ifdef __CYGWIN__ +/* We use a Unix API, so pretend it's not Windows */ +#undef WIN +#undef WIN32 +#undef _WIN +#undef _WIN32 +#undef _WIN64 +#undef __WIN__ +#undef __WIN32__ +#define HAVE_ERRNO_AS_DEFINE +#endif /* __CYGWIN__ */ + +#if defined(__QNXNTO__) && !defined(FD_SETSIZE) +#define FD_SETSIZE 1024 /* Max number of file descriptor bits in + fd_set, used when calling 'select' + Must be defined before including + "sys/select.h" and "sys/time.h" + */ +#endif + + +/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */ +#ifdef USE_PRAGMA_IMPLEMENTATION +#define USE_PRAGMA_INTERFACE +#endif + +#if defined(i386) && !defined(__i386__) +#define __i386__ +#endif + +/* Macros to make switching between C and C++ mode easier */ +#ifdef __cplusplus +#define C_MODE_START extern "C" { +#define C_MODE_END } +#define STATIC_CAST(TYPE) static_cast +#else +#define C_MODE_START +#define C_MODE_END +#define STATIC_CAST(TYPE) (TYPE) +#endif + +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) +#include +#else +#include +#if defined(__cplusplus) && defined(inline) +#undef inline /* fix configure problem */ +#endif +#endif /* _WIN32... */ + +#include + +/* Make it easier to add conditional code for windows */ +#ifdef __WIN__ +#define IF_WIN(A,B) (A) +#else +#define IF_WIN(A,B) (B) +#endif + +#ifndef EMBEDDED_LIBRARY +#ifdef WITH_NDB_BINLOG +#define HAVE_NDB_BINLOG 1 +#endif +#endif /* !EMBEDDED_LIBRARY */ + +#ifndef EMBEDDED_LIBRARY +#define HAVE_REPLICATION +#define HAVE_EXTERNAL_CLIENT +#endif + +/* Some defines to avoid ifdefs in the code */ +#ifndef NETWARE_YIELD +#define NETWARE_YIELD +#define NETWARE_SET_SCREEN_MODE(A) +#endif + +/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */ +#if defined(_AIX) && defined(_LARGE_FILE_API) +#undef _LARGE_FILE_API +#endif + +/* + The macros below are used to allow build of Universal/fat binaries of + MySQL and MySQL applications under darwin. +*/ +#if defined(__APPLE__) && defined(__MACH__) +# undef SIZEOF_CHARP +# undef SIZEOF_SHORT +# undef SIZEOF_INT +# undef SIZEOF_LONG +# undef SIZEOF_LONG_LONG +# undef SIZEOF_OFF_T +# undef WORDS_BIGENDIAN +# define SIZEOF_SHORT 2 +# define SIZEOF_INT 4 +# define SIZEOF_LONG_LONG 8 +# define SIZEOF_OFF_T 8 +# if defined(__i386__) || defined(__ppc__) +# define SIZEOF_CHARP 4 +# define SIZEOF_LONG 4 +# elif defined(__x86_64__) || defined(__ppc64__) +# define SIZEOF_CHARP 8 +# define SIZEOF_LONG 8 +# else +# error Building FAT binary for an unknown architecture. +# endif +# if defined(__ppc__) || defined(__ppc64__) +# define WORDS_BIGENDIAN +# endif +#endif /* defined(__APPLE__) && defined(__MACH__) */ + + +/* + The macros below are borrowed from include/linux/compiler.h in the + Linux kernel. Use them to indicate the likelyhood of the truthfulness + of a condition. This serves two purposes - newer versions of gcc will be + able to optimize for branch predication, which could yield siginficant + performance gains in frequently executed sections of the code, and the + other reason to use them is for documentation +*/ + +#if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) +#define __builtin_expect(x, expected_value) (x) +#endif + +/** + The semantics of builtin_expect() are that + 1) its two arguments are long + 2) it's likely that they are == + Those of our likely(x) are that x can be bool/int/longlong/pointer. +*/ +#define likely(x) __builtin_expect(((x) != 0),1) +#define unlikely(x) __builtin_expect(((x) != 0),0) + +/* + The macros below are useful in optimising places where it has been + discovered that cache misses stall the process and where a prefetch + of the cache line can improve matters. This is available in GCC 3.1.1 + and later versions. + PREFETCH_READ says that addr is going to be used for reading and that + it is to be kept in caches if possible for a while + PREFETCH_WRITE also says that the item to be cached is likely to be + updated. + The *LOCALITY scripts are also available for experimentation purposes + mostly and should only be used if they are verified to improve matters. + For more input see GCC manual (available in GCC 3.1.1 and later) +*/ + +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) +#define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3) +#define PREFETCH_WRITE(addr) \ + __builtin_prefetch(addr, 1, 3) +#define PREFETCH_READ_LOCALITY(addr, locality) \ + __builtin_prefetch(addr, 0, locality) +#define PREFETCH_WRITE_LOCALITY(addr, locality) \ + __builtin_prefetch(addr, 1, locality) +#else +#define PREFETCH_READ(addr) +#define PREFETCH_READ_LOCALITY(addr, locality) +#define PREFETCH_WRITE(addr) +#define PREFETCH_WRITE_LOCALITY(addr, locality) +#endif + +/* + The following macro is used to ensure that code often used in most + SQL statements and definitely for parts of the SQL processing are + kept in a code segment by itself. This has the advantage that the + risk of common code being overlapping in caches of the CPU is less. + This can be a cause of big performance problems. + Routines should be put in this category with care and when they are + put there one should also strive to make as much of the error handling + as possible (or uncommon code of the routine) to execute in a + separate method to avoid moving to much code to this code segment. + + It is very easy to use, simply add HOT_METHOD at the end of the + function declaration. + For more input see GCC manual (available in GCC 2.95 and later) +*/ + +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) +#define HOT_METHOD \ + __attribute__ ((section ("hot_code_section"))) +#else +#define HOT_METHOD +#endif + +/* + The following macro is used to ensure that popular global variables + are located next to each other to avoid that they contend for the + same cache lines. + + It is very easy to use, simply add HOT_DATA at the end of the declaration + of the variable, the variable must be initialised because of the way + that linker works so a declaration using HOT_DATA should look like: + uint global_hot_data HOT_DATA = 0; + For more input see GCC manual (available in GCC 2.95 and later) +*/ + +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94) +#define HOT_DATA \ + __attribute__ ((section ("hot_data_section"))) +#else +#define HOT_DATA +#endif + +/* + now let's figure out if inline functions are supported + autoconf defines 'inline' to be empty, if not +*/ +#define inline_test_1(X) X ## 1 +#define inline_test_2(X) inline_test_1(X) +#if inline_test_2(inline) != 1 +#define HAVE_INLINE +#endif +#undef inline_test_2 +#undef inline_test_1 +/* helper macro for "instantiating" inline functions */ +#define STATIC_INLINE static inline + +/* + The following macros are used to control inlining a bit more than + usual. These macros are used to ensure that inlining always or + never occurs (independent of compilation mode). + For more input see GCC manual (available in GCC 3.1.1 and later) +*/ + +#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10) +#define ALWAYS_INLINE __attribute__ ((always_inline)) +#define NEVER_INLINE __attribute__ ((noinline)) +#else +#define ALWAYS_INLINE +#define NEVER_INLINE +#endif + + +/* Fix problem with S_ISLNK() on Linux */ +#if defined(TARGET_OS_LINUX) || defined(__GLIBC__) +#undef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +/* + Temporary solution to solve bug#7156. Include "sys/types.h" before + the thread headers, else the function madvise() will not be defined +*/ +#if defined(HAVE_SYS_TYPES_H) && ( defined(sun) || defined(__sun) ) +#include +#endif + +/* The client defines this to avoid all thread code */ +#if defined(UNDEF_THREADS_HACK) +#undef THREAD +#undef HAVE_LINUXTHREADS +#undef HAVE_NPTL +#endif + +#ifdef HAVE_THREADS_WITHOUT_SOCKETS +/* MIT pthreads does not work with unix sockets */ +#undef HAVE_SYS_UN_H +#endif + +#define __EXTENSIONS__ 1 /* We want some extension */ +#ifndef __STDC_EXT__ +#define __STDC_EXT__ 1 /* To get large file support on hpux */ +#endif + +/* + Solaris 9 include file refers to X/Open document + + System Interfaces and Headers, Issue 5 + + saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes, + but apparently other systems (namely FreeBSD) don't agree. + + On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600. + Furthermore, it tests that if a program requires older standard + (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be + run on a new compiler (that defines _STDC_C99) and issues an #error. + It's also an #error if a program requires new standard (_XOPEN_SOURCE=600 + or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99. + + To add more to this mess, Sun Studio C compiler defines _STDC_C99 while + C++ compiler does not! + + So, in a desperate attempt to get correct prototypes for both + C and C++ code, we define either _XOPEN_SOURCE=600 or _XOPEN_SOURCE=500 + depending on the compiler's announced C standard support. + + Cleaner solutions are welcome. +*/ +#ifdef __sun +#if __STDC_VERSION__ - 0 >= 199901L +#define _XOPEN_SOURCE 600 +#else +#define _XOPEN_SOURCE 500 +#endif +#endif + +#if defined(THREAD) && !defined(__WIN__) +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ +#endif + +#if !defined(SCO) +#define _REENTRANT 1 /* Some thread libraries require this */ +#endif +#if !defined(_THREAD_SAFE) && !defined(_AIX) +#define _THREAD_SAFE /* Required for OSF1 */ +#endif +#if defined(HPUX10) || defined(HPUX11) +C_MODE_START /* HPUX needs this, signal.h bug */ +#include +C_MODE_END +#else +#include /* AIX must have this included first */ +#endif +#if !defined(SCO) && !defined(_REENTRANT) +#define _REENTRANT 1 /* Threads requires reentrant code */ +#endif +#endif /* THREAD */ + +/* Go around some bugs in different OS and compilers */ +#ifdef _AIX /* By soren@t.dk */ +#define _H_STRINGS +#define _SYS_STREAM_H +/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */ +#define ulonglong2double(A) my_ulonglong2double(A) +#define my_off_t2double(A) my_ulonglong2double(A) +C_MODE_START +double my_ulonglong2double(unsigned long long A); +C_MODE_END +#endif /* _AIX */ + +#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */ +#undef HAVE_SNPRINTF +#endif +#ifdef HAVE_BROKEN_PREAD +/* + pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without + installing the kernel patch PHKL_20349 or greater +*/ +#undef HAVE_PREAD +#undef HAVE_PWRITE +#endif +#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus) +#undef inline +#define inline +#endif + +#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ +#undef HAVE_GETHOSTBYNAME_R +#endif +#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */ +#undef HAVE_INITGROUPS +#endif + +/* gcc/egcs issues */ + +#if defined(__GNUC) && defined(__EXCEPTIONS) +#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" +#endif + + +/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */ +#if SIZEOF_LONG == 4 && defined(__LONG_MAX__) && (__GNUC__ == 2 && __GNUC_MINOR__ == 8) +#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */ +#define __LONG_MAX__ 2147483647 +#endif + +/* egcs 1.1.2 has a problem with memcpy on Alpha */ +#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) +#define BAD_MEMCPY +#endif + +#if defined(_lint) && !defined(lint) +#define lint +#endif +#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) +#define _LONG_LONG 1 /* For AIX string library */ +#endif + +#ifndef stdin +#include +#endif +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STDDEF_H +#include +#endif + +#include +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_FENV_H +#include /* For fesetround() */ +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_SYS_TIMEB_H +#include /* Avoid warnings on SCO */ +#endif +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif /* TIME_WITH_SYS_TIME */ +#ifdef HAVE_UNISTD_H +#include +#endif +#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA) +#undef HAVE_ALLOCA +#undef HAVE_ALLOCA_H +#endif +#ifdef HAVE_ALLOCA_H +#include +#endif + +#include /* Recommended by debian */ +/* We need the following to go around a problem with openssl on solaris */ +#if defined(HAVE_CRYPT_H) +#include +#endif + +/* + A lot of our programs uses asserts, so better to always include it + This also fixes a problem when people uses DBUG_ASSERT without including + assert.h +*/ +#include + +/* an assert that works at compile-time. only for constant expression */ +#ifdef _some_old_compiler_that_does_not_understand_the_construct_below_ +#define compile_time_assert(X) do { } while(0) +#else +#define compile_time_assert(X) \ + do \ + { \ + typedef char compile_time_assert[(X) ? 1 : -1]; \ + } while(0) +#endif + +/* Go around some bugs in different OS and compilers */ +#if defined (HPUX11) && defined(_LARGEFILE_SOURCE) +#define _LARGEFILE64_SOURCE +#endif +#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H) +#include /* HPUX 10.20 defines ulong here. UGLY !!! */ +#define HAVE_ULONG +#endif +#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) +/* Fix bug in setrlimit */ +#undef setrlimit +#define setrlimit cma_setrlimit64 +#endif +/* Declare madvise where it is not declared for C++, like Solaris */ +#if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) +extern "C" int madvise(void *addr, size_t len, int behav); +#endif + +#ifdef __QNXNTO__ +/* This has to be after include limits.h */ +#define HAVE_ERRNO_AS_DEFINE +#define HAVE_FCNTL_LOCK +#undef HAVE_FINITE +#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */ +#undef LONGLONG_MAX /* standard system library 'limits.h' */ +#endif + +/* We can not live without the following defines */ + +#define USE_MYFUNC 1 /* Must use syscall indirection */ +#define MASTER 1 /* Compile without unireg */ +#define ENGLISH 1 /* Messages in English */ +#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */ +#define USE_REGEX 1 /* We want the use the regex library */ +/* Do not define for ultra sparcs */ +#define USE_BMOVE512 1 /* Use this unless system bmove is faster */ + +#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ +#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ + +/* Paranoid settings. Define I_AM_PARANOID if you are paranoid */ +#ifdef I_AM_PARANOID +#define DONT_ALLOW_USER_CHANGE 1 +#define DONT_USE_MYSQL_PWD 1 +#endif + +/* Does the system remember a signal handler after a signal ? */ +#ifndef HAVE_BSD_SIGNALS +#define DONT_REMEMBER_SIGNAL +#endif + +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) +#define LINT_INIT(var) var=0 /* No uninitialize-warning */ +#else +#define LINT_INIT(var) +#endif + +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify) +#define PURIFY_OR_LINT_INIT(var) var=0 +#else +#define PURIFY_OR_LINT_INIT(var) +#endif + +#if !defined(HAVE_UINT) +#undef HAVE_UINT +#define HAVE_UINT +typedef unsigned int uint; +typedef unsigned short ushort; +#endif + +#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) +#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) +#define swap_variables(t, a, b) { t swap_dummy; swap_dummy= a; a= b; b= swap_dummy; } +#define test(a) ((a) ? 1 : 0) +#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) +#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) +#define test_all_bits(a,b) (((a) & (b)) == (b)) +#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) +#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) + +/* Define some general constants */ +#ifndef TRUE +#define TRUE (1) /* Logical true */ +#define FALSE (0) /* Logical false */ +#endif + +#if defined(__GNUC__) +#define function_volatile volatile +#define my_reinterpret_cast(A) reinterpret_cast +#define my_const_cast(A) const_cast +# ifndef GCC_VERSION +# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +# endif +#elif !defined(my_reinterpret_cast) +#define my_reinterpret_cast(A) (A) +#define my_const_cast(A) (A) +#endif + +#include + +/* + Wen using the embedded library, users might run into link problems, + duplicate declaration of __cxa_pure_virtual, solved by declaring it a + weak symbol. +*/ +#if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL) +C_MODE_START +int __cxa_pure_virtual () __attribute__ ((weak)); +C_MODE_END +#endif + +/* From old s-system.h */ + +/* + Support macros for non ansi & other old compilers. Since such + things are no longer supported we do nothing. We keep then since + some of our code may still be needed to upgrade old customers. +*/ +#define _VARARGS(X) X +#define _STATIC_VARARGS(X) X + +/* The DBUG_ON flag always takes precedence over default DBUG_OFF */ +#if defined(DBUG_ON) && defined(DBUG_OFF) +#undef DBUG_OFF +#endif + +/* We might be forced to turn debug off, if not turned off already */ +#if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF) +# define DBUG_OFF +# ifdef DBUG_ON +# undef DBUG_ON +# endif +#endif + +typedef char my_bool; /* Small bool */ +#include + +#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ +#define ASCII_BITS_USED 8 /* Bit char used */ +#define NEAR_F /* No near function handling */ + +/* Some types that is different between systems */ + +typedef int File; /* File descriptor */ +#ifndef Socket_defined +typedef int my_socket; /* File descriptor for sockets */ +#define INVALID_SOCKET -1 +#endif +/* Type for fuctions that handles signals */ +#define sig_handler void +C_MODE_START +typedef void (*sig_return)();/* Returns type from signal */ +C_MODE_END +#if defined(__GNUC__) && !defined(_lint) +typedef char pchar; /* Mixed prototypes can take char */ +typedef char puchar; /* Mixed prototypes can take char */ +typedef char pbool; /* Mixed prototypes can take char */ +typedef short pshort; /* Mixed prototypes can take short int */ +typedef float pfloat; /* Mixed prototypes can take float */ +#else +typedef int pchar; /* Mixed prototypes can't take char */ +typedef uint puchar; /* Mixed prototypes can't take char */ +typedef int pbool; /* Mixed prototypes can't take char */ +typedef int pshort; /* Mixed prototypes can't take short int */ +typedef double pfloat; /* Mixed prototypes can't take float */ +#endif +C_MODE_START +typedef int (*qsort_cmp)(const void *,const void *); +typedef int (*qsort_cmp2)(void*, const void *,const void *); +C_MODE_END +#define qsort_t RETQSORTTYPE /* Broken GCC cant handle typedef !!!! */ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +/* file create flags */ + +#ifndef O_SHARE /* Probably not windows */ +#define O_SHARE 0 /* Flag to my_open for shared files */ +#ifndef O_BINARY +#define O_BINARY 0 /* Flag to my_open for binary files */ +#endif +#ifndef FILE_BINARY +#define FILE_BINARY O_BINARY /* Flag to my_fopen for binary streams */ +#endif +#ifdef HAVE_FCNTL +#define HAVE_FCNTL_LOCK +#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */ +#endif +#endif /* O_SHARE */ + +#ifndef O_TEMPORARY +#define O_TEMPORARY 0 +#endif +#ifndef O_SHORT_LIVED +#define O_SHORT_LIVED 0 +#endif +#ifndef O_NOFOLLOW +#define O_NOFOLLOW 0 +#endif + +/* additional file share flags for win32 */ +#ifdef __WIN__ +#define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ +#define _SH_DENYWRD 0x120 /* deny write mode & delete */ +#define _SH_DENYRDD 0x130 /* deny read mode & delete */ +#define _SH_DENYDEL 0x140 /* deny delete only */ +#endif /* __WIN__ */ + + +/* #define USE_RECORD_LOCK */ + + /* Unsigned types supported by the compiler */ +#define UNSINT8 /* unsigned int8 (char) */ +#define UNSINT16 /* unsigned int16 */ +#define UNSINT32 /* unsigned int32 */ + + /* General constants */ +#define FN_LEN 256 /* Max file name len */ +#define FN_HEADLEN 253 /* Max length of filepart of file name */ +#define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */ +#define FN_REFLEN 512 /* Max length of full path-name */ +#define FN_EXTCHAR '.' +#define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ +#define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ +#define FN_PARENTDIR ".." /* Parent directory; Must be a string */ + +#ifndef FN_LIBCHAR +#define FN_LIBCHAR '/' +#define FN_ROOTDIR "/" +#endif + +/* + MY_FILE_MIN is Windows speciality and is used to quickly detect + the mismatch of CRT and mysys file IO usage on Windows at runtime. + CRT file descriptors can be in the range 0-2047, whereas descriptors returned + by my_open() will start with 2048. If a file descriptor with value less then + MY_FILE_MIN is passed to mysys IO function, chances are it stemms from + open()/fileno() and not my_open()/my_fileno. + + For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN + is logically 0. +*/ + +#ifdef _WIN32 +#define MY_FILE_MIN 2048 +#else +#define MY_FILE_MIN 0 +#endif + +/* + MY_NFILE is the default size of my_file_info array. + + It is larger on Windows, because it all file handles are stored in my_file_info + Default size is 16384 and this should be enough for most cases.If it is not + enough, --max-open-files with larger value can be used. + + For Posix , my_file_info array is only used to store filenames for + error reporting and its size is not a limitation for number of open files. +*/ +#ifdef _WIN32 +#define MY_NFILE (16384 + MY_FILE_MIN) +#else +#define MY_NFILE 64 +#endif + +#ifndef OS_FILE_LIMIT +#define OS_FILE_LIMIT 65535 +#endif + +/* #define EXT_IN_LIBNAME */ +/* #define FN_NO_CASE_SENCE */ +/* #define FN_UPPER_CASE TRUE */ + +/* + Io buffer size; Must be a power of 2 and a multiple of 512. May be + smaller what the disk page size. This influences the speed of the + isam btree library. eg to big to slow. +*/ +#define IO_SIZE 4096 +/* + How much overhead does malloc have. The code often allocates + something like 1024-MALLOC_OVERHEAD bytes +*/ +#ifdef SAFEMALLOC +#define MALLOC_OVERHEAD (8+24+4) +#else +#define MALLOC_OVERHEAD 8 +#endif + /* get memory in huncs */ +#define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) + /* Typical record cash */ +#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD) + /* Typical key cash */ +#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD) + /* Default size of a key cache block */ +#define KEY_CACHE_BLOCK_SIZE (uint) 1024 + + + /* Some things that this system doesn't have */ + +#define NO_HASH /* Not needed anymore */ +#ifdef _WIN32 +#define NO_DIR_LIBRARY /* Not standard dir-library */ +#endif + +/* Some defines of functions for portability */ + +#undef remove /* Crashes MySQL on SCO 5.0.0 */ +#ifndef __WIN__ +#define closesocket(A) close(A) +#ifndef ulonglong2double +#define ulonglong2double(A) ((double) (ulonglong) (A)) +#define my_off_t2double(A) ((double) (my_off_t) (A)) +#endif +#ifndef double2ulonglong +#define double2ulonglong(A) ((ulonglong) (double) (A)) +#endif +#endif + +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif +#define ulong_to_double(X) ((double) (ulong) (X)) +#define SET_STACK_SIZE(X) /* Not needed on real machines */ + +#ifndef STACK_DIRECTION +#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS" +#endif + +#if !defined(HAVE_STRTOK_R) +inline char *strtok_r(char *str, const char *delim, char **saveptr) +{ + return strtok(str,delim); +} +#endif + +/* This is from the old m-machine.h file */ + +#if SIZEOF_LONG_LONG > 4 +#define HAVE_LONG_LONG 1 +#endif + +/* + Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define + ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined. + Also on Windows we define these constants by hand in config-win.h. +*/ + +#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN) +#define LONGLONG_MIN ((long long) 0x8000000000000000LL) +#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL) +#endif + +#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX) +/* First check for ANSI C99 definition: */ +#ifdef ULLONG_MAX +#define ULONGLONG_MAX ULLONG_MAX +#else +#define ULONGLONG_MAX ((unsigned long long)(~0ULL)) +#endif +#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/ + +#define INT_MIN32 (~0x7FFFFFFFL) +#define INT_MAX32 0x7FFFFFFFL +#define UINT_MAX32 0xFFFFFFFFL +#define INT_MIN24 (~0x007FFFFF) +#define INT_MAX24 0x007FFFFF +#define UINT_MAX24 0x00FFFFFF +#define INT_MIN16 (~0x7FFF) +#define INT_MAX16 0x7FFF +#define UINT_MAX16 0xFFFF +#define INT_MIN8 (~0x7F) +#define INT_MAX8 0x7F +#define UINT_MAX8 0xFF + +/* From limits.h instead */ +#ifndef DBL_MIN +#define DBL_MIN 4.94065645841246544e-324 +#define FLT_MIN ((float)1.40129846432481707e-45) +#endif +#ifndef DBL_MAX +#define DBL_MAX 1.79769313486231470e+308 +#define FLT_MAX ((float)3.40282346638528860e+38) +#endif +#ifndef SIZE_T_MAX +#define SIZE_T_MAX ~((size_t) 0) +#endif + +#ifndef isfinite +#ifdef HAVE_FINITE +#define isfinite(x) finite(x) +#else +#define finite(x) (1.0 / fabs(x) > 0.0) +#endif /* HAVE_FINITE */ +#endif /* isfinite */ + +#ifndef HAVE_ISNAN +#define isnan(x) ((x) != (x)) +#endif + +#ifdef HAVE_ISINF +/* Check if C compiler is affected by GCC bug #39228 */ +#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF) +/* Force store/reload of the argument to/from a 64-bit double */ +static inline double my_isinf(double x) +{ + volatile double t= x; + return isinf(t); +} +#else +/* System-provided isinf() is available and safe to use */ +#define my_isinf(X) isinf(X) +#endif +#else /* !HAVE_ISINF */ +#define my_isinf(X) (!finite(X) && !isnan(X)) +#endif + +/* Define missing math constants. */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +#ifndef M_E +#define M_E 2.7182818284590452354 +#endif +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 +#endif + +/* + Max size that must be added to a so that we know Size to make + adressable obj. +*/ +#if SIZEOF_CHARP == 4 +typedef long my_ptrdiff_t; +#else +typedef long long my_ptrdiff_t; +#endif + +#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) +#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) +/* Size to make adressable obj. */ +#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t))) + /* Offset of field f in structure t */ +#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f) +#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) +#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) + +#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B)) +#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))] + +/* + Custom version of standard offsetof() macro which can be used to get + offsets of members in class for non-POD types (according to the current + version of C++ standard offsetof() macro can't be used in such cases and + attempt to do so causes warnings to be emitted, OTOH in many cases it is + still OK to assume that all instances of the class has the same offsets + for the same members). + + This is temporary solution which should be removed once File_parser class + and related routines are refactored. +*/ + +#define my_offsetof(TYPE, MEMBER) \ + ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) + +#define NullS STATIC_CAST(char *)(0) +/* Nowdays we do not support MessyDos */ +#ifndef NEAR +#define NEAR /* Who needs segments ? */ +#define FAR /* On a good machine */ +#ifndef HUGE_PTR +#define HUGE_PTR +#endif +#endif +#if defined(__IBMC__) || defined(__IBMCPP__) +/* This was _System _Export but caused a lot of warnings on _AIX43 */ +#define STDCALL +#elif !defined( STDCALL) +#define STDCALL +#endif + +/* Typdefs for easyier portability */ + +#ifndef HAVE_UCHAR +typedef unsigned char uchar; /* Short for unsigned char */ +#endif + +#ifndef HAVE_INT8 +typedef signed char int8; /* Signed integer >= 8 bits */ +#endif +#ifndef HAVE_UINT8 +typedef unsigned char uint8; /* Unsigned integer >= 8 bits */ +#endif +#ifndef HAVE_INT16 +typedef short int16; +#endif +#ifndef HAVE_UINT16 +typedef unsigned short uint16; +#endif +#if SIZEOF_INT == 4 +#ifndef HAVE_INT32 +typedef int int32; +#endif +#ifndef HAVE_UINT32 +typedef unsigned int uint32; +#endif +#elif SIZEOF_LONG == 4 +#ifndef HAVE_INT32 +typedef long int32; +#endif +#ifndef HAVE_UINT32 +typedef unsigned long uint32; +#endif +#else +#error Neither int or long is of 4 bytes width +#endif + +#if !defined(HAVE_ULONG) && !defined(__USE_MISC) +typedef unsigned long ulong; /* Short for unsigned long */ +#endif +#ifndef longlong_defined +/* + Using [unsigned] long long is preferable as [u]longlong because we use + [unsigned] long long unconditionally in many places, + for example in constants with [U]LL suffix. +*/ +#if defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8 +typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ +typedef long long int longlong; +#else +typedef unsigned long ulonglong; /* ulong or unsigned long long */ +typedef long longlong; +#endif +#endif +#ifndef HAVE_INT64 +typedef longlong int64; +#endif +#ifndef HAVE_UINT64 +typedef ulonglong uint64; +#endif + +#if defined(NO_CLIENT_LONG_LONG) +typedef unsigned long my_ulonglong; +#elif defined (__WIN__) +typedef unsigned __int64 my_ulonglong; +#else +typedef unsigned long long my_ulonglong; +#endif + +#if SIZEOF_CHARP == SIZEOF_INT +typedef int intptr; +#elif SIZEOF_CHARP == SIZEOF_LONG +typedef long intptr; +#elif SIZEOF_CHARP == SIZEOF_LONG_LONG +typedef long long intptr; +#else +#error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long) +#endif + +#define MY_ERRPTR ((void*)(intptr)1) + +#ifdef USE_RAID +/* + The following is done with a if to not get problems with pre-processors + with late define evaluation +*/ +#if SIZEOF_OFF_T == 4 +#define SYSTEM_SIZEOF_OFF_T 4 +#else +#define SYSTEM_SIZEOF_OFF_T 8 +#endif +#undef SIZEOF_OFF_T +#define SIZEOF_OFF_T 8 +#else +#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T +#endif /* USE_RAID */ + +#if SIZEOF_OFF_T > 4 +typedef ulonglong my_off_t; +#else +typedef unsigned long my_off_t; +#endif +#define MY_FILEPOS_ERROR (~STATIC_CAST(my_off_t)(0)) +#if !defined(__WIN__) +typedef off_t os_off_t; +#endif + +#if defined(__WIN__) +#define socket_errno WSAGetLastError() +#define SOCKET_EINTR WSAEINTR +#define SOCKET_EAGAIN WSAEINPROGRESS +#define SOCKET_ETIMEDOUT WSAETIMEDOUT +#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK +#define SOCKET_EADDRINUSE WSAEADDRINUSE +#define SOCKET_ENFILE ENFILE +#define SOCKET_EMFILE EMFILE +#else /* Unix */ +#define socket_errno errno +#define closesocket(A) close(A) +#define SOCKET_EINTR EINTR +#define SOCKET_EAGAIN EAGAIN +#define SOCKET_ETIMEDOUT SOCKET_EINTR +#define SOCKET_EWOULDBLOCK EWOULDBLOCK +#define SOCKET_EADDRINUSE EADDRINUSE +#define SOCKET_ENFILE ENFILE +#define SOCKET_EMFILE EMFILE +#endif + +typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ +typedef short int15; /* Most effective integer 0 <= x <= 32767 */ +typedef int myf; /* Type of MyFlags in my_funcs */ + /* Macros for converting *constants* to the right type */ +#define INT8(v) (int8) (v) +#define INT16(v) (int16) (v) +#define INT32(v) (int32) (v) +#define MYF(v) STATIC_CAST(myf)(v) + +/* + Defines to make it possible to prioritize register assignments. No + longer that important with modern compilers. +*/ +#ifndef USING_X +#define reg1 register +#define reg2 register +#define reg3 register +#define reg4 register +#define reg5 register +#define reg6 register +#define reg7 register +#define reg8 register +#define reg9 register +#define reg10 register +#define reg11 register +#define reg12 register +#define reg13 register +#define reg14 register +#define reg15 register +#define reg16 register +#endif + +/* + Sometimes we want to make sure that the variable is not put into + a register in debugging mode so we can see its value in the core +*/ + +#ifndef DBUG_OFF +#define dbug_volatile volatile +#else +#define dbug_volatile +#endif + +/* Some helper macros */ +#define YESNO(X) ((X) ? "yes" : "no") + +/* Defines for time function */ +#define SCALE_SEC 100 +#define SCALE_USEC 10000 +#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ +#define MY_HOW_OFTEN_TO_WRITE 10000 /* How often we want info on screen */ + +/* + Define-funktions for reading and storing in machine independent format + (low byte first) +*/ + +/* Optimized store functions for Intel x86 */ +#if defined(__i386__) || defined(_WIN32) +#define sint2korr(A) (*((const int16 *) (A))) +#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ + (((uint32) 255L << 24) | \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0])) : \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0]))) +#define sint4korr(A) (*((const long *) (A))) +#define uint2korr(A) (*((const uint16 *) (A))) +#if defined(HAVE_purify) && !defined(_WIN32) +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16)) +#else +/* + ATTENTION ! + + Please, note, uint3korr reads 4 bytes (not 3) ! + It means, that you have to provide enough allocated space ! +*/ +#define uint3korr(A) (long) (*((const unsigned int *) (A)) & 0xFFFFFF) +#endif /* HAVE_purify && !_WIN32 */ +#define uint4korr(A) (*((const uint32 *) (A))) +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ + (((uint32) ((uchar) (A)[1])) << 8) + \ + (((uint32) ((uchar) (A)[2])) << 16) + \ + (((uint32) ((uchar) (A)[3])) << 24)) + \ + (((ulonglong) ((uchar) (A)[4])) << 32) + \ + (((ulonglong) ((uchar) (A)[5])) << 40)) +#define uint8korr(A) (*((const ulonglong *) (A))) +#define sint8korr(A) (*((const longlong *) (A))) +#define int2store(T,A) *((uint16*) (T))= (uint16) (A) +#define int3store(T,A) do { *(T)= (uchar) ((A));\ + *(T+1)=(uchar) (((uint) (A) >> 8));\ + *(T+2)=(uchar) (((A) >> 16)); } while (0) +#define int4store(T,A) *((long *) (T))= (long) (A) +#define int5store(T,A) do { *(T)= (uchar)((A));\ + *((T)+1)=(uchar) (((A) >> 8));\ + *((T)+2)=(uchar) (((A) >> 16));\ + *((T)+3)=(uchar) (((A) >> 24)); \ + *((T)+4)=(uchar) (((A) >> 32)); } while(0) +#define int6store(T,A) do { *(T)= (uchar)((A)); \ + *((T)+1)=(uchar) (((A) >> 8)); \ + *((T)+2)=(uchar) (((A) >> 16)); \ + *((T)+3)=(uchar) (((A) >> 24)); \ + *((T)+4)=(uchar) (((A) >> 32)); \ + *((T)+5)=(uchar) (((A) >> 40)); } while(0) +#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) + +typedef union { + double v; + long m[2]; +} doubleget_union; +#define doubleget(V,M) \ +do { doubleget_union _tmp; \ + _tmp.m[0] = *((const long*)(M)); \ + _tmp.m[1] = *(((const long*) (M))+1); \ + (V) = _tmp.v; } while(0) +#define doublestore(T,V) do { *((long *) T) = ((const doubleget_union *)&V)->m[0]; \ + *(((long *) T)+1) = ((const doubleget_union *)&V)->m[1]; \ + } while (0) +#define float4get(V,M) do { *((float *) &(V)) = *((const float*) (M)); } while(0) +#define float8get(V,M) doubleget((V),(M)) +#define float4store(V,M) memcpy((uchar*) V,(const uchar*) (&M),sizeof(float)) +#define floatstore(T,V) memcpy((uchar*)(T), (const uchar*)(&V),sizeof(float)) +#define floatget(V,M) memcpy((uchar*) &V,(const uchar*) (M),sizeof(float)) +#define float8store(V,M) doublestore((V),(M)) +#else + +/* + We're here if it's not a IA-32 architecture (Win32 and UNIX IA-32 defines + were done before) +*/ +#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\ + ((int16) ((int16) (A)[1]) << 8)) +#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ + (((uint32) 255L << 24) | \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0])) : \ + (((uint32) (uchar) (A)[2]) << 16) |\ + (((uint32) (uchar) (A)[1]) << 8) | \ + ((uint32) (uchar) (A)[0]))) +#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\ + (((int32) ((uchar) (A)[1]) << 8)) +\ + (((int32) ((uchar) (A)[2]) << 16)) +\ + (((int32) ((int16) (A)[3]) << 24))) +#define sint8korr(A) (longlong) uint8korr(A) +#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\ + ((uint16) ((uchar) (A)[1]) << 8)) +#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16)) +#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) ((uchar) (A)[4])) << 32)) +#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ + (((uint32) ((uchar) (A)[1])) << 8) + \ + (((uint32) ((uchar) (A)[2])) << 16) + \ + (((uint32) ((uchar) (A)[3])) << 24)) + \ + (((ulonglong) ((uchar) (A)[4])) << 32) + \ + (((ulonglong) ((uchar) (A)[5])) << 40)) +#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ + (((uint32) ((uchar) (A)[1])) << 8) +\ + (((uint32) ((uchar) (A)[2])) << 16) +\ + (((uint32) ((uchar) (A)[3])) << 24)) +\ + (((ulonglong) (((uint32) ((uchar) (A)[4])) +\ + (((uint32) ((uchar) (A)[5])) << 8) +\ + (((uint32) ((uchar) (A)[6])) << 16) +\ + (((uint32) ((uchar) (A)[7])) << 24))) <<\ + 32)) +#define int2store(T,A) do { uint def_temp= (uint) (A) ;\ + *((uchar*) (T))= (uchar)(def_temp); \ + *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \ + } while(0) +#define int3store(T,A) do { /*lint -save -e734 */\ + *((uchar*)(T))=(uchar) ((A));\ + *((uchar*) (T)+1)=(uchar) (((A) >> 8));\ + *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \ + /*lint -restore */} while(0) +#define int4store(T,A) do { *((char *)(T))=(char) ((A));\ + *(((char *)(T))+1)=(char) (((A) >> 8));\ + *(((char *)(T))+2)=(char) (((A) >> 16));\ + *(((char *)(T))+3)=(char) (((A) >> 24)); } while(0) +#define int5store(T,A) do { *((char *)(T))= (char)((A)); \ + *(((char *)(T))+1)= (char)(((A) >> 8)); \ + *(((char *)(T))+2)= (char)(((A) >> 16)); \ + *(((char *)(T))+3)= (char)(((A) >> 24)); \ + *(((char *)(T))+4)= (char)(((A) >> 32)); \ + } while(0) +#define int6store(T,A) do { *((char *)(T))= (char)((A)); \ + *(((char *)(T))+1)= (char)(((A) >> 8)); \ + *(((char *)(T))+2)= (char)(((A) >> 16)); \ + *(((char *)(T))+3)= (char)(((A) >> 24)); \ + *(((char *)(T))+4)= (char)(((A) >> 32)); \ + *(((char *)(T))+5)= (char)(((A) >> 40)); \ + } while(0) +#define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \ + int4store((T),def_temp); \ + int4store((T+4),def_temp2); } while(0) +#ifdef WORDS_BIGENDIAN +#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\ + *((T)+1)=(char) ((uchar *) &A)[2];\ + *((T)+2)=(char) ((uchar *) &A)[1];\ + *((T)+3)=(char) ((uchar *) &A)[0]; } while(0) + +#define float4get(V,M) do { float def_temp;\ + ((uchar*) &def_temp)[0]=(M)[3];\ + ((uchar*) &def_temp)[1]=(M)[2];\ + ((uchar*) &def_temp)[2]=(M)[1];\ + ((uchar*) &def_temp)[3]=(M)[0];\ + (V)=def_temp; } while(0) +#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\ + *((T)+1)=(char) ((uchar *) &V)[6];\ + *((T)+2)=(char) ((uchar *) &V)[5];\ + *((T)+3)=(char) ((uchar *) &V)[4];\ + *((T)+4)=(char) ((uchar *) &V)[3];\ + *((T)+5)=(char) ((uchar *) &V)[2];\ + *((T)+6)=(char) ((uchar *) &V)[1];\ + *((T)+7)=(char) ((uchar *) &V)[0]; } while(0) + +#define float8get(V,M) do { double def_temp;\ + ((uchar*) &def_temp)[0]=(M)[7];\ + ((uchar*) &def_temp)[1]=(M)[6];\ + ((uchar*) &def_temp)[2]=(M)[5];\ + ((uchar*) &def_temp)[3]=(M)[4];\ + ((uchar*) &def_temp)[4]=(M)[3];\ + ((uchar*) &def_temp)[5]=(M)[2];\ + ((uchar*) &def_temp)[6]=(M)[1];\ + ((uchar*) &def_temp)[7]=(M)[0];\ + (V) = def_temp; } while(0) +#else +#define float4get(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float)) +#define float4store(V,M) memcpy_fixed((uchar*) V,(uchar*) (&M),sizeof(float)) + +#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) +#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\ + *(((char*)T)+1)=(char) ((uchar *) &V)[5];\ + *(((char*)T)+2)=(char) ((uchar *) &V)[6];\ + *(((char*)T)+3)=(char) ((uchar *) &V)[7];\ + *(((char*)T)+4)=(char) ((uchar *) &V)[0];\ + *(((char*)T)+5)=(char) ((uchar *) &V)[1];\ + *(((char*)T)+6)=(char) ((uchar *) &V)[2];\ + *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\ + while(0) +#define doubleget(V,M) do { double def_temp;\ + ((uchar*) &def_temp)[0]=(M)[4];\ + ((uchar*) &def_temp)[1]=(M)[5];\ + ((uchar*) &def_temp)[2]=(M)[6];\ + ((uchar*) &def_temp)[3]=(M)[7];\ + ((uchar*) &def_temp)[4]=(M)[0];\ + ((uchar*) &def_temp)[5]=(M)[1];\ + ((uchar*) &def_temp)[6]=(M)[2];\ + ((uchar*) &def_temp)[7]=(M)[3];\ + (V) = def_temp; } while(0) +#endif /* __FLOAT_WORD_ORDER */ + +#define float8get(V,M) doubleget((V),(M)) +#define float8store(V,M) doublestore((V),(M)) +#endif /* WORDS_BIGENDIAN */ + +#endif /* __i386__ OR _WIN32 */ + +/* + Macro for reading 32-bit integer from network byte order (big-endian) + from unaligned memory location. +*/ +#define int4net(A) (int32) (((uint32) ((uchar) (A)[3])) |\ + (((uint32) ((uchar) (A)[2])) << 8) |\ + (((uint32) ((uchar) (A)[1])) << 16) |\ + (((uint32) ((uchar) (A)[0])) << 24)) +/* + Define-funktions for reading and storing in machine format from/to + short/long to/from some place in memory V should be a (not + register) variable, M is a pointer to byte +*/ + +#ifdef WORDS_BIGENDIAN + +#define ushortget(V,M) do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\ + ((uint16) ((uint16) (M)[0]) << 8)); } while(0) +#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\ + ((short) ((short) (M)[0]) << 8)); } while(0) +#define longget(V,M) do { int32 def_temp;\ + ((uchar*) &def_temp)[0]=(M)[0];\ + ((uchar*) &def_temp)[1]=(M)[1];\ + ((uchar*) &def_temp)[2]=(M)[2];\ + ((uchar*) &def_temp)[3]=(M)[3];\ + (V)=def_temp; } while(0) +#define ulongget(V,M) do { uint32 def_temp;\ + ((uchar*) &def_temp)[0]=(M)[0];\ + ((uchar*) &def_temp)[1]=(M)[1];\ + ((uchar*) &def_temp)[2]=(M)[2];\ + ((uchar*) &def_temp)[3]=(M)[3];\ + (V)=def_temp; } while(0) +#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\ + *(((char*)T)+1)=(char)(def_temp); \ + *(((char*)T)+0)=(char)(def_temp >> 8); } while(0) +#define longstore(T,A) do { *(((char*)T)+3)=((A));\ + *(((char*)T)+2)=(((A) >> 8));\ + *(((char*)T)+1)=(((A) >> 16));\ + *(((char*)T)+0)=(((A) >> 24)); } while(0) + +#define floatget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float)) +#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*)(&V),sizeof(float)) +#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double)) +#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double)) +#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong)) +#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong)) + +#else + +#define ushortget(V,M) do { V = uint2korr(M); } while(0) +#define shortget(V,M) do { V = sint2korr(M); } while(0) +#define longget(V,M) do { V = sint4korr(M); } while(0) +#define ulongget(V,M) do { V = uint4korr(M); } while(0) +#define shortstore(T,V) int2store(T,V) +#define longstore(T,V) int4store(T,V) +#ifndef floatstore +#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) (&V),sizeof(float)) +#define floatget(V,M) memcpy_fixed((uchar*) &V, (uchar*) (M), sizeof(float)) +#endif +#ifndef doubleget +#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double)) +#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double)) +#endif /* doubleget */ +#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong)) +#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong)) + +#endif /* WORDS_BIGENDIAN */ + +/* sprintf does not always return the number of bytes :- */ +#ifdef SPRINTF_RETURNS_INT +#define my_sprintf(buff,args) sprintf args +#else +#ifdef SPRINTF_RETURNS_PTR +#define my_sprintf(buff,args) ((int)(sprintf args - buff)) +#else +#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff)) +#endif +#endif + +#ifndef THREAD +#define thread_safe_increment(V,L) (V)++ +#define thread_safe_decrement(V,L) (V)-- +#define thread_safe_add(V,C,L) (V)+=(C) +#define thread_safe_sub(V,C,L) (V)-=(C) +#define statistic_increment(V,L) (V)++ +#define statistic_decrement(V,L) (V)-- +#define statistic_add(V,C,L) (V)+=(C) +#define statistic_sub(V,C,L) (V)-=(C) +#endif + +#if defined(HAVE_CHARSET_utf8mb3) || defined(HAVE_CHARSET_utf8mb4) +#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8" +#else +#define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME +#endif + +#if defined(EMBEDDED_LIBRARY) && !defined(HAVE_EMBEDDED_PRIVILEGE_CONTROL) +#define NO_EMBEDDED_ACCESS_CHECKS +#endif + +#ifdef HAVE_DLOPEN +#if defined(__WIN__) +#define dlsym(lib, name) GetProcAddress((HMODULE)lib, name) +#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) +#define dlclose(lib) FreeLibrary((HMODULE)lib) +#elif defined(HAVE_DLFCN_H) +#include +#endif +#endif + +/* FreeBSD 2.2.2 does not define RTLD_NOW) */ +#ifndef RTLD_NOW +#define RTLD_NOW 1 +#endif + +#ifndef HAVE_DLERROR +#define dlerror() "" +#endif + + +#ifndef __NETWARE__ +/* + * Include standard definitions of operator new and delete. + */ +#ifdef __cplusplus +#include +#endif +#else +/* + * Define placement versions of operator new and operator delete since + * we don't have when building for Netware. + */ +#ifdef __cplusplus +inline void *operator new(size_t, void *ptr) { return ptr; } +inline void *operator new[](size_t, void *ptr) { return ptr; } +inline void operator delete(void*, void*) { /* Do nothing */ } +inline void operator delete[](void*, void*) { /* Do nothing */ } +#endif +#endif + +/* Length of decimal number represented by INT32. */ +#define MY_INT32_NUM_DECIMAL_DIGITS 11 + +/* Length of decimal number represented by INT64. */ +#define MY_INT64_NUM_DECIMAL_DIGITS 21 + +/* Define some useful general macros (should be done after all headers). */ +#if !defined(max) +#define max(a, b) ((a) > (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif +/* + Only Linux is known to need an explicit sync of the directory to make sure a + file creation/deletion/renaming in(from,to) this directory durable. +*/ +#ifdef TARGET_OS_LINUX +#define NEED_EXPLICIT_SYNC_DIR 1 +#else +/* + On linux default rwlock scheduling policy is good enough for + waiting_threads.c, on other systems use our special implementation + (which is slower). + + QQ perhaps this should be tested in configure ? how ? +*/ +#define WT_RWLOCKS_USE_MUTEXES 1 +#endif + +#if !defined(__cplusplus) && !defined(bool) +#define bool In_C_you_should_use_my_bool_instead() +#endif + +/* Provide __func__ macro definition for platforms that miss it. */ +#if __STDC_VERSION__ < 199901L +# if __GNUC__ >= 2 +# define __func__ __FUNCTION__ +# else +# define __func__ "" +# endif +#elif defined(_MSC_VER) +# if _MSC_VER < 1300 +# define __func__ "" +# else +# define __func__ __FUNCTION__ +# endif +#elif defined(__BORLANDC__) +# define __func__ __FUNC__ +#else +# define __func__ "" +#endif + +#ifndef HAVE_RINT +/** + All integers up to this number can be represented exactly as double precision + values (DBL_MANT_DIG == 53 for IEEE 754 hardware). +*/ +#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1) + +/** + rint(3) implementation for platforms that do not have it. + Always rounds to the nearest integer with ties being rounded to the nearest + even integer to mimic glibc's rint() behavior in the "round-to-nearest" + FPU mode. Hardware-specific optimizations are possible (frndint on x86). + Unlike this implementation, hardware will also honor the FPU rounding mode. +*/ + +static inline double rint(double x) +{ + double f, i; + f = modf(x, &i); + + /* + All doubles with absolute values > MAX_EXACT_INTEGER are even anyway, + no need to check it. + */ + if (x > 0.0) + i += (double) ((f > 0.5) || (f == 0.5 && + i <= (double) MAX_EXACT_INTEGER && + (longlong) i % 2)); + else + i -= (double) ((f < -0.5) || (f == -0.5 && + i >= (double) -MAX_EXACT_INTEGER && + (longlong) i % 2)); + return i; +} +#endif /* HAVE_RINT */ + +/* + MYSQL_PLUGIN_IMPORT macro is used to export mysqld data + (i.e variables) for usage in storage engine loadable plugins. + Outside of Windows, it is dummy. +*/ +#ifndef MYSQL_PLUGIN_IMPORT +#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN)) +#define MYSQL_PLUGIN_IMPORT __declspec(dllimport) +#else +#define MYSQL_PLUGIN_IMPORT +#endif +#endif + +#endif /* my_global_h */ diff --git a/externals/mysql/my_libwrap.h b/externals/mysql/my_libwrap.h new file mode 100644 index 0000000..9a85794 --- /dev/null +++ b/externals/mysql/my_libwrap.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef HAVE_LIBWRAP +#include +#include +#ifdef NEED_SYS_SYSLOG_H +#include +#endif /* NEED_SYS_SYSLOG_H */ + +extern void my_fromhost(struct request_info *req); +extern int my_hosts_access(struct request_info *req); +extern char *my_eval_client(struct request_info *req); + +#endif /* HAVE_LIBWRAP */ diff --git a/externals/mysql/my_list.h b/externals/mysql/my_list.h new file mode 100644 index 0000000..775b565 --- /dev/null +++ b/externals/mysql/my_list.h @@ -0,0 +1,45 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _list_h_ +#define _list_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_list { + struct st_list *prev,*next; + void *data; +} LIST; + +typedef int (*list_walk_action)(void *,void *); + +extern LIST *list_add(LIST *root,LIST *element); +extern LIST *list_delete(LIST *root,LIST *element); +extern LIST *list_cons(void *data,LIST *root); +extern LIST *list_reverse(LIST *root); +extern void list_free(LIST *root,unsigned int free_data); +extern unsigned int list_length(LIST *); +extern int list_walk(LIST *,list_walk_action action,unsigned char * argument); + +#define list_rest(a) ((a)->next) +#define list_push(a,b) (a)=list_cons((b),(a)) +#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); } + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/my_md5.h b/externals/mysql/my_md5.h new file mode 100644 index 0000000..6458f27 --- /dev/null +++ b/externals/mysql/my_md5.h @@ -0,0 +1,54 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* See md5.c for explanation and copyright information. */ + +/* + * $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $ + */ + +/* Unlike previous versions of this code, uint32 need not be exactly + 32 bits, merely 32 bits or more. Choosing a data type which is 32 + bits instead of 64 is not important; speed is considerably more + important. ANSI guarantees that "unsigned long" will be big enough, + and always using it seems to have few disadvantages. */ +typedef uint32 cvs_uint32; + +typedef struct { + cvs_uint32 buf[4]; + cvs_uint32 bits[2]; + unsigned char in[64]; +} my_MD5Context; + +#ifdef __cplusplus +extern "C" { +#endif +void my_MD5Init (my_MD5Context *context); +void my_MD5Update (my_MD5Context *context, + unsigned char const *buf, unsigned len); +void my_MD5Final (unsigned char digest[16], + my_MD5Context *context); + +#ifdef __cplusplus +} +#endif + +#define MY_MD5_HASH(digest,buf,len) \ +do { \ + my_MD5Context ctx; \ + my_MD5Init (&ctx); \ + my_MD5Update (&ctx, buf, len); \ + my_MD5Final (digest, &ctx); \ +} while (0) diff --git a/externals/mysql/my_net.h b/externals/mysql/my_net.h new file mode 100644 index 0000000..18fb3db --- /dev/null +++ b/externals/mysql/my_net.h @@ -0,0 +1,114 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + thread safe version of some common functions: + my_inet_ntoa + + This file is also used to make handling of sockets and ioctl() + portable accross systems. + +*/ + +#ifndef _my_net_h +#define _my_net_h +C_MODE_START + +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_POLL +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__NETWARE__) +#include +#include +#include +#if !defined(alpha_linux_port) +#include +#endif +#endif + +#if defined(__WIN__) +#define O_NONBLOCK 1 /* For emulation of fcntl() */ + +/* + SHUT_RDWR is called SD_BOTH in windows and + is defined to 2 in winsock2.h + #define SD_BOTH 0x02 +*/ +#define SHUT_RDWR 0x02 + +#endif + +/* + On OSes which don't have the in_addr_t, we guess that using uint32 is the best + possible choice. We guess this from the fact that on HP-UX64bit & FreeBSD64bit + & Solaris64bit, in_addr_t is equivalent to uint32. And on Linux32bit too. +*/ +#ifndef HAVE_IN_ADDR_T +#define in_addr_t uint32 +#endif + +/* Thread safe or portable version of some functions */ + +void my_inet_ntoa(struct in_addr in, char *buf); + +/* + Handling of gethostbyname_r() +*/ + +#if !defined(HAVE_GETHOSTBYNAME_R) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +void my_gethostbyname_r_free(); +#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +#define my_gethostbyname_r_free() +#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX10) +#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) +#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */ + +#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT) +#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data) +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop); +#define my_gethostbyname_r_free() +#else +#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E)) +#define my_gethostbyname_r_free() +#endif /* !defined(HAVE_GETHOSTBYNAME_R) */ + +#ifndef GETHOSTBYNAME_BUFF_SIZE +#define GETHOSTBYNAME_BUFF_SIZE 2048 +#endif + +C_MODE_END +#endif diff --git a/externals/mysql/my_no_pthread.h b/externals/mysql/my_no_pthread.h new file mode 100644 index 0000000..b11dbff --- /dev/null +++ b/externals/mysql/my_no_pthread.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#if !defined(_my_no_pthread_h) && !defined(THREAD) +#define _my_no_pthread_h + + +/* + This block is to access some thread-related type definitions + even in builds which do not need thread functions, + as some variables (based on these types) are declared + even in non-threaded builds. + Case in point: 'mf_keycache.c' +*/ +#if defined(__WIN__) +#else /* Normal threads */ +#include + +#endif /* defined(__WIN__) */ + + +/* + This undefs some pthread mutex locks when one isn't using threads + to make thread safe code, that should also work in single thread + environment, easier to use. +*/ +#define pthread_mutex_init(A,B) +#define pthread_mutex_lock(A) +#define pthread_mutex_unlock(A) +#define pthread_mutex_destroy(A) +#define my_rwlock_init(A,B) +#define rw_rdlock(A) +#define rw_wrlock(A) +#define rw_unlock(A) +#define rwlock_destroy(A) + +#endif diff --git a/externals/mysql/my_nosys.h b/externals/mysql/my_nosys.h new file mode 100644 index 0000000..df5639b --- /dev/null +++ b/externals/mysql/my_nosys.h @@ -0,0 +1,52 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Header to remove use of my_functions in functions where we need speed and + where calls to posix functions should work +*/ +#ifndef _my_nosys_h +#define _my_nosys_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __MY_NOSYS__ +#define __MY_NOSYS__ + +#ifndef HAVE_STDLIB_H +#include +#endif + +#undef my_read /* Can be predefined in raid.h */ +#undef my_write +#undef my_seek +#define my_read(a,b,c,d) my_quick_read(a,b,c,d) +#define my_write(a,b,c,d) my_quick_write(a,b,c) +extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count, + myf myFlags); +extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count); + +#if !defined(SAFEMALLOC) && defined(USE_HALLOC) +#define my_malloc(a,b) halloc(a,1) +#define my_no_flags_free(a) hfree(a) +#endif + +#endif /* __MY_NOSYS__ */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/my_pthread.h b/externals/mysql/my_pthread.h new file mode 100644 index 0000000..ab26860 --- /dev/null +++ b/externals/mysql/my_pthread.h @@ -0,0 +1,734 @@ +/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Defines to make different thread packages compatible */ + +#ifndef _my_pthread_h +#define _my_pthread_h + +#ifndef ETIME +#define ETIME ETIMEDOUT /* For FreeBSD */ +#endif + +#ifdef __cplusplus +#define EXTERNC extern "C" +extern "C" { +#else +#define EXTERNC +#endif /* __cplusplus */ + +#if defined(__WIN__) +typedef CRITICAL_SECTION pthread_mutex_t; +typedef DWORD pthread_t; +typedef struct thread_attr { + DWORD dwStackSize ; + DWORD dwCreatingFlag ; +} pthread_attr_t ; + +typedef struct { int dummy; } pthread_condattr_t; + +/* Implementation of posix conditions */ + +typedef struct st_pthread_link { + DWORD thread_id; + struct st_pthread_link *next; +} pthread_link; + +typedef struct { + uint32 waiting; + CRITICAL_SECTION lock_waiting; + + enum { + SIGNAL= 0, + BROADCAST= 1, + MAX_EVENTS= 2 + } EVENTS; + + HANDLE events[MAX_EVENTS]; + HANDLE broadcast_block_event; + +} pthread_cond_t; + + +typedef int pthread_mutexattr_t; +#define pthread_self() GetCurrentThreadId() +#define pthread_handler_t EXTERNC void * __cdecl +typedef void * (__cdecl *pthread_handler)(void *); + +/* + Struct and macros to be used in combination with the + windows implementation of pthread_cond_timedwait +*/ + +/* + Declare a union to make sure FILETIME is properly aligned + so it can be used directly as a 64 bit value. The value + stored is in 100ns units. + */ +union ft64 { + FILETIME ft; + __int64 i64; +}; + +struct timespec { + union ft64 tv; + /* The max timeout value in millisecond for pthread_cond_timedwait */ + long max_timeout_msec; +}; + +#define set_timespec_time_nsec(ABSTIME,TIME,NSEC) do { \ + (ABSTIME).tv.i64= (TIME)+(__int64)(NSEC)/100; \ + (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \ +} while(0) + +#define set_timespec_nsec(ABSTIME,NSEC) do { \ + union ft64 tv; \ + GetSystemTimeAsFileTime(&tv.ft); \ + set_timespec_time_nsec((ABSTIME), tv.i64, (NSEC)); \ +} while(0) + +int win_pthread_mutex_trylock(pthread_mutex_t *mutex); +int pthread_create(pthread_t *,pthread_attr_t *,pthread_handler,void *); +int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr); +int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); +int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + struct timespec *abstime); +int pthread_cond_signal(pthread_cond_t *cond); +int pthread_cond_broadcast(pthread_cond_t *cond); +int pthread_cond_destroy(pthread_cond_t *cond); +int pthread_attr_init(pthread_attr_t *connect_att); +int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack); +int pthread_attr_destroy(pthread_attr_t *connect_att); +struct tm *localtime_r(const time_t *timep,struct tm *tmp); +struct tm *gmtime_r(const time_t *timep,struct tm *tmp); + +void pthread_exit(void *a); +int pthread_join(pthread_t thread, void **value_ptr); + + +#define ETIMEDOUT 145 /* Win32 doesn't have this */ +#define HAVE_LOCALTIME_R 1 +#define _REENTRANT 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 + + +#undef SAFE_MUTEX /* This will cause conflicts */ +#define pthread_key(T,V) DWORD V +#define pthread_key_create(A,B) ((*A=TlsAlloc())==0xFFFFFFFF) +#define pthread_key_delete(A) TlsFree(A) +#define my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V))) +#define pthread_setspecific(A,B) (!TlsSetValue((A),(B))) +#define pthread_getspecific(A) (TlsGetValue(A)) +#define my_pthread_getspecific(T,A) ((T) TlsGetValue(A)) +#define my_pthread_getspecific_ptr(T,V) ((T) TlsGetValue(V)) + +#define pthread_equal(A,B) ((A) == (B)) +#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0) +#define pthread_mutex_lock(A) (EnterCriticalSection(A),0) +#define pthread_mutex_trylock(A) win_pthread_mutex_trylock((A)) +#define pthread_mutex_unlock(A) (LeaveCriticalSection(A),0) +#define pthread_mutex_destroy(A) DeleteCriticalSection(A) +#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) + + +/* Dummy defines for easier code */ +#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) +#define pthread_attr_setscope(A,B) +#define pthread_detach_this_thread() +#define pthread_condattr_init(A) +#define pthread_condattr_destroy(A) +#define pthread_yield() SwitchToThread() + + +#else /* Normal threads */ + +#ifdef HAVE_rts_threads +#define sigwait org_sigwait +#include +#undef sigwait +#endif +#include +#ifndef _REENTRANT +#define _REENTRANT +#endif +#ifdef HAVE_THR_SETCONCURRENCY +#include /* Probably solaris */ +#endif +#ifdef HAVE_SCHED_H +#include +#endif +#ifdef HAVE_SYNCH_H +#include +#endif + +#ifdef __NETWARE__ +void my_pthread_exit(void *status); +#define pthread_exit(A) my_pthread_exit(A) +#endif + +#define pthread_key(T,V) pthread_key_t V +#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) +#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) +#define pthread_detach_this_thread() +#define pthread_handler_t EXTERNC void * +typedef void *(* pthread_handler)(void *); + +/* Test first for RTS or FSU threads */ + +#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) +#define HAVE_rts_threads +extern int my_pthread_create_detached; +#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) +#define PTHREAD_CREATE_DETACHED &my_pthread_create_detached +#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_GLOBAL +#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_LOCAL +#define USE_ALARM_THREAD +#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */ + +#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199910 +int sigwait(sigset_t *set, int *sig); +#endif + +#ifndef HAVE_NONPOSIX_SIGWAIT +#define my_sigwait(A,B) sigwait((A),(B)) +#else +int my_sigwait(const sigset_t *set,int *sig); +#endif + +#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT +#ifndef SAFE_MUTEX +#define pthread_mutex_init(a,b) my_pthread_mutex_noposix_init((a),(b)) +extern int my_pthread_mutex_noposix_init(pthread_mutex_t *mp, + const pthread_mutexattr_t *attr); +#endif /* SAFE_MUTEX */ +#define pthread_cond_init(a,b) my_pthread_cond_noposix_init((a),(b)) +extern int my_pthread_cond_noposix_init(pthread_cond_t *mp, + const pthread_condattr_t *attr); +#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */ + +#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK) +#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C)) +#endif + +#if !defined(HAVE_SIGWAIT) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX) +int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ +#endif + + +/* + We define my_sigset() and use that instead of the system sigset() so that + we can favor an implementation based on sigaction(). On some systems, such + as Mac OS X, sigset() results in flags such as SA_RESTART being set, and + we want to make sure that no such flags are set. +*/ +#if defined(HAVE_SIGACTION) && !defined(my_sigset) +#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \ + DBUG_ASSERT((A) != 0); \ + sigemptyset(&l_set); \ + l_s.sa_handler = (B); \ + l_s.sa_mask = l_set; \ + l_s.sa_flags = 0; \ + l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\ + DBUG_ASSERT(l_rc == 0); \ + } while (0) +#elif defined(HAVE_SIGSET) && !defined(my_sigset) +#define my_sigset(A,B) sigset((A),(B)) +#elif !defined(my_sigset) +#define my_sigset(A,B) signal((A),(B)) +#endif + +#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS) +#define pthread_attr_setscope(A,B) +#undef HAVE_GETHOSTBYADDR_R /* No definition */ +#endif + +#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX) +extern int my_pthread_cond_timedwait(pthread_cond_t *cond, + pthread_mutex_t *mutex, + struct timespec *abstime); +#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) +#endif + +#if !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC) +#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B)) +#else +#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B)) +void *my_pthread_getspecific_imp(pthread_key_t key); +#endif + +#ifndef HAVE_LOCALTIME_R +struct tm *localtime_r(const time_t *clock, struct tm *res); +#endif + +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *clock, struct tm *res); +#endif + +#ifdef HAVE_PTHREAD_CONDATTR_CREATE +/* DCE threads on HPUX 10.20 */ +#define pthread_condattr_init pthread_condattr_create +#define pthread_condattr_destroy pthread_condattr_delete +#endif + +/* FSU THREADS */ +#if !defined(HAVE_PTHREAD_KEY_DELETE) && !defined(pthread_key_delete) +#define pthread_key_delete(A) pthread_dummy(0) +#endif + +#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) +/* This is set on AIX_3_2 and Siemens unix (and DEC OSF/1 3.2 too) */ +#define pthread_key_create(A,B) \ + pthread_keycreate(A,(B) ?\ + (pthread_destructor_t) (B) :\ + (pthread_destructor_t) pthread_dummy) +#define pthread_attr_init(A) pthread_attr_create(A) +#define pthread_attr_destroy(A) pthread_attr_delete(A) +#define pthread_attr_setdetachstate(A,B) pthread_dummy(0) +#define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) +#ifndef pthread_sigmask +#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) +#endif +#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) +#undef pthread_detach_this_thread +#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } +#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ +#ifndef HAVE_PTHREAD_KILL +# define HAVE_PTHREAD_KILL +#endif +#endif + +#endif /* defined(__WIN__) */ + +#if defined(HPUX10) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) +#undef pthread_cond_timedwait +#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c)) +int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + struct timespec *abstime); +#endif + +#if defined(HPUX10) +#define pthread_attr_getstacksize(A,B) my_pthread_attr_getstacksize(A,B) +void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size); +#endif + +#if defined(HAVE_POSIX1003_4a_MUTEX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) +#undef pthread_mutex_trylock +#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a)) +int my_pthread_mutex_trylock(pthread_mutex_t *mutex); +#endif + +#if !defined(HAVE_PTHREAD_YIELD_ONE_ARG) && !defined(HAVE_PTHREAD_YIELD_ZERO_ARG) +/* no pthread_yield() available */ +#ifdef HAVE_SCHED_YIELD +#define pthread_yield() sched_yield() +#elif defined(HAVE_PTHREAD_YIELD_NP) /* can be Mac OS X */ +#define pthread_yield() pthread_yield_np() +#elif defined(HAVE_THR_YIELD) +#define pthread_yield() thr_yield() +#endif +#endif + +/* + The defines set_timespec and set_timespec_nsec should be used + for calculating an absolute time at which + pthread_cond_timedwait should timeout +*/ + +#define set_timespec(ABSTIME,SEC) set_timespec_nsec((ABSTIME),(SEC)*1000000000ULL) + +#ifndef set_timespec_nsec +#define set_timespec_nsec(ABSTIME,NSEC) \ + set_timespec_time_nsec((ABSTIME),my_getsystime(),(NSEC)) +#endif /* !set_timespec_nsec */ + +/* adapt for two different flavors of struct timespec */ +#ifdef HAVE_TIMESPEC_TS_SEC +#define MY_tv_sec ts_sec +#define MY_tv_nsec ts_nsec +#else +#define MY_tv_sec tv_sec +#define MY_tv_nsec tv_nsec +#endif /* HAVE_TIMESPEC_TS_SEC */ + +#ifndef set_timespec_time_nsec +#define set_timespec_time_nsec(ABSTIME,TIME,NSEC) do { \ + ulonglong nsec= (NSEC); \ + ulonglong now= (TIME) + (nsec/100); \ + (ABSTIME).MY_tv_sec= (now / 10000000ULL); \ + (ABSTIME).MY_tv_nsec= (now % 10000000ULL * 100 + (nsec % 100)); \ +} while(0) +#endif /* !set_timespec_time_nsec */ + +/* safe_mutex adds checking to mutex for easier debugging */ + +#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY) +#define SAFE_MUTEX_DETECT_DESTROY +#endif +struct st_hash; + +typedef struct st_safe_mutex_t +{ + pthread_mutex_t global,mutex; + const char *file, *name; + uint line,count; + myf create_flags, active_flags; + ulong id; + pthread_t thread; + struct st_hash *locked_mutex, *used_mutex; + struct st_safe_mutex_t *prev, *next; +#ifdef SAFE_MUTEX_DETECT_DESTROY + struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */ +#endif +} safe_mutex_t; + +typedef struct st_safe_mutex_deadlock_t +{ + const char *file, *name; + safe_mutex_t *mutex; + uint line; + ulong count; + ulong id; + my_bool warning_only; +} safe_mutex_deadlock_t; + +#ifdef SAFE_MUTEX_DETECT_DESTROY +/* + Used to track the destroying of mutexes. This needs to be a seperate + structure because the safe_mutex_t structure could be freed before + the mutexes are destroyed. +*/ + +typedef struct st_safe_mutex_info_t +{ + struct st_safe_mutex_info_t *next; + struct st_safe_mutex_info_t *prev; + const char *init_file; + uint32 init_line; +} safe_mutex_info_t; +#endif /* SAFE_MUTEX_DETECT_DESTROY */ + +int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr, + const char *name, myf my_flags, + const char *file, uint line); +int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file, + uint line); +int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line); +int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line); +int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file, + uint line); +int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, + struct timespec *abstime, const char *file, uint line); +void safe_mutex_global_init(void); +void safe_mutex_end(FILE *file); +void safe_mutex_free_deadlock_data(safe_mutex_t *mp); + + /* Wrappers if safe mutex is actually used */ +#define MYF_TRY_LOCK 1 +#define MYF_NO_DEADLOCK_DETECTION 2 + +#ifdef SAFE_MUTEX +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_unlock +#undef pthread_mutex_destroy +#undef pthread_mutex_wait +#undef pthread_mutex_timedwait +#undef pthread_mutex_t +#undef pthread_cond_wait +#undef pthread_cond_timedwait +#undef pthread_mutex_trylock +#define my_pthread_mutex_init(A,B,C,D) safe_mutex_init((A),(B),(C),(D),__FILE__,__LINE__) +#define pthread_mutex_init(A,B) safe_mutex_init((A),(B),#A,0,__FILE__,__LINE__) +#define pthread_mutex_lock(A) safe_mutex_lock((A), 0, __FILE__, __LINE__) +#define my_pthread_mutex_lock(A,B) safe_mutex_lock((A), (B), __FILE__, __LINE__) +#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__) +#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__) +#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__) +#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__) +#define pthread_mutex_trylock(A) safe_mutex_lock((A), MYF_TRY_LOCK, __FILE__, __LINE__) +#define pthread_mutex_t safe_mutex_t +#define safe_mutex_assert_owner(mp) \ + DBUG_ASSERT((mp)->count > 0 && \ + pthread_equal(pthread_self(), (mp)->thread)) +#define safe_mutex_assert_not_owner(mp) \ + DBUG_ASSERT(! (mp)->count || \ + ! pthread_equal(pthread_self(), (mp)->thread)) +#else +#define my_pthread_mutex_init(A,B,C,D) pthread_mutex_init((A),(B)) +#define my_pthread_mutex_lock(A,B) pthread_mutex_lock(A) +#define safe_mutex_assert_owner(mp) +#define safe_mutex_assert_not_owner(mp) +#endif /* SAFE_MUTEX */ + +#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) +typedef struct st_my_pthread_fastmutex_t +{ + pthread_mutex_t mutex; + uint spins; + uint rng_state; +} my_pthread_fastmutex_t; +void fastmutex_global_init(void); + +int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp, + const pthread_mutexattr_t *attr); +int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp); + +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_unlock +#undef pthread_mutex_destroy +#undef pthread_mutex_wait +#undef pthread_mutex_timedwait +#undef pthread_mutex_t +#undef pthread_cond_wait +#undef pthread_cond_timedwait +#undef pthread_mutex_trylock +#define pthread_mutex_init(A,B) my_pthread_fastmutex_init((A),(B)) +#define pthread_mutex_lock(A) my_pthread_fastmutex_lock(A) +#define pthread_mutex_unlock(A) pthread_mutex_unlock(&(A)->mutex) +#define pthread_mutex_destroy(A) pthread_mutex_destroy(&(A)->mutex) +#define pthread_cond_wait(A,B) pthread_cond_wait((A),&(B)->mutex) +#define pthread_cond_timedwait(A,B,C) pthread_cond_timedwait((A),&(B)->mutex,(C)) +#define pthread_mutex_trylock(A) pthread_mutex_trylock(&(A)->mutex) +#define pthread_mutex_t my_pthread_fastmutex_t +#endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ + + /* READ-WRITE thread locking */ + +#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */ +#undef HAVE_PTHREAD_RWLOCK_RDLOCK +#undef HAVE_RWLOCK_INIT +#undef HAVE_RWLOCK_T +#endif + +#if defined(USE_MUTEX_INSTEAD_OF_RW_LOCKS) +/* use these defs for simple mutex locking */ +#define rw_lock_t pthread_mutex_t +#define my_rwlock_init(A,B) pthread_mutex_init((A),(B)) +#define rw_rdlock(A) pthread_mutex_lock((A)) +#define rw_wrlock(A) pthread_mutex_lock((A)) +#define rw_tryrdlock(A) pthread_mutex_trylock((A)) +#define rw_trywrlock(A) pthread_mutex_trylock((A)) +#define rw_unlock(A) pthread_mutex_unlock((A)) +#define rwlock_destroy(A) pthread_mutex_destroy((A)) +#elif defined(HAVE_PTHREAD_RWLOCK_RDLOCK) +#define rw_lock_t pthread_rwlock_t +#define my_rwlock_init(A,B) pthread_rwlock_init((A),(B)) +#define rw_rdlock(A) pthread_rwlock_rdlock(A) +#define rw_wrlock(A) pthread_rwlock_wrlock(A) +#define rw_tryrdlock(A) pthread_rwlock_tryrdlock((A)) +#define rw_trywrlock(A) pthread_rwlock_trywrlock((A)) +#define rw_unlock(A) pthread_rwlock_unlock(A) +#define rwlock_destroy(A) pthread_rwlock_destroy(A) +#elif defined(HAVE_RWLOCK_INIT) +#ifdef HAVE_RWLOCK_T /* For example Solaris 2.6-> */ +#define rw_lock_t rwlock_t +#endif +#define my_rwlock_init(A,B) rwlock_init((A),USYNC_THREAD,0) +#else +/* Use our own version of read/write locks */ +typedef struct _my_rw_lock_t { + pthread_mutex_t lock; /* lock for structure */ + pthread_cond_t readers; /* waiting readers */ + pthread_cond_t writers; /* waiting writers */ + int state; /* -1:writer,0:free,>0:readers */ + int waiters; /* number of waiting writers */ +} my_rw_lock_t; + +#define rw_lock_t my_rw_lock_t +#define rw_rdlock(A) my_rw_rdlock((A)) +#define rw_wrlock(A) my_rw_wrlock((A)) +#define rw_tryrdlock(A) my_rw_tryrdlock((A)) +#define rw_trywrlock(A) my_rw_trywrlock((A)) +#define rw_unlock(A) my_rw_unlock((A)) +#define rwlock_destroy(A) my_rwlock_destroy((A)) + +extern int my_rwlock_init(my_rw_lock_t *, void *); +extern int my_rwlock_destroy(my_rw_lock_t *); +extern int my_rw_rdlock(my_rw_lock_t *); +extern int my_rw_wrlock(my_rw_lock_t *); +extern int my_rw_unlock(my_rw_lock_t *); +extern int my_rw_tryrdlock(my_rw_lock_t *); +extern int my_rw_trywrlock(my_rw_lock_t *); +#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ + +#define GETHOSTBYADDR_BUFF_SIZE 2048 + +#ifndef HAVE_THR_SETCONCURRENCY +#define thr_setconcurrency(A) pthread_dummy(0) +#endif +#if !defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && ! defined(pthread_attr_setstacksize) +#define pthread_attr_setstacksize(A,B) pthread_dummy(0) +#endif + +/* Define mutex types, see my_thr_init.c */ +#define MY_MUTEX_INIT_SLOW NULL +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +extern pthread_mutexattr_t my_fast_mutexattr; +#define MY_MUTEX_INIT_FAST &my_fast_mutexattr +#else +#define MY_MUTEX_INIT_FAST NULL +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +extern pthread_mutexattr_t my_errorcheck_mutexattr; +#define MY_MUTEX_INIT_ERRCHK &my_errorcheck_mutexattr +#else +#define MY_MUTEX_INIT_ERRCHK NULL +#endif + +#ifndef ESRCH +/* Define it to something */ +#define ESRCH 1 +#endif + +typedef ulong my_thread_id; + +extern void my_threadattr_global_init(void); +extern my_bool my_thread_global_init(void); +extern void my_thread_global_end(void); +extern my_bool my_thread_init(void); +extern void my_thread_end(void); +extern const char *my_thread_name(void); +extern my_thread_id my_thread_dbug_id(void); +extern int pthread_dummy(int); + +/* All thread specific variables are in the following struct */ + +#define THREAD_NAME_SIZE 10 +#ifndef DEFAULT_THREAD_STACK +#if SIZEOF_CHARP > 4 +/* + MySQL can survive with 32K, but some glibc libraries require > 128K stack + To resolve hostnames. Also recursive stored procedures needs stack. +*/ +#define DEFAULT_THREAD_STACK (256*1024L) +#else +#define DEFAULT_THREAD_STACK (195*1024) +#endif +#endif + +#define MY_PTHREAD_LOCK_READ 0 +#define MY_PTHREAD_LOCK_WRITE 1 + +struct st_my_thread_var +{ + int thr_errno; + pthread_cond_t suspend; + pthread_mutex_t mutex; + pthread_mutex_t * volatile current_mutex; + pthread_cond_t * volatile current_cond; + pthread_t pthread_self; + my_thread_id id; + int cmp_length; + int volatile abort; + my_bool init; + struct st_my_thread_var *next,**prev; + void *opt_info; + uint lock_type; /* used by conditional release the queue */ + void *stack_ends_here; + safe_mutex_t *mutex_in_use; +#ifndef DBUG_OFF + void *dbug; + char name[THREAD_NAME_SIZE+1]; +#endif +}; + +extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); +extern void **my_thread_var_dbug(); +extern safe_mutex_t **my_thread_var_mutex_in_use(); +extern uint my_thread_end_wait_time; +extern my_bool safe_mutex_deadlock_detector; +#define my_thread_var (_my_thread_var()) +#define my_errno my_thread_var->thr_errno +/* + Keep track of shutdown,signal, and main threads so that my_end() will not + report errors with them +*/ + +/* Which kind of thread library is in use */ + +#define THD_LIB_OTHER 1 +#define THD_LIB_NPTL 2 +#define THD_LIB_LT 4 + +extern uint thd_lib_detected; + +/* + thread_safe_xxx functions are for critical statistic or counters. + The implementation is guaranteed to be thread safe, on all platforms. + Note that the calling code should *not* assume the counter is protected + by the mutex given, as the implementation of these helpers may change + to use my_atomic operations instead. +*/ + +/* + Warning: + When compiling without threads, this file is not included. + See the *other* declarations of thread_safe_xxx in include/my_global.h + + Second warning: + See include/config-win.h, for yet another implementation. +*/ +#ifdef THREAD +#ifndef thread_safe_increment +#define thread_safe_increment(V,L) \ + (pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L))) +#define thread_safe_decrement(V,L) \ + (pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L))) +#endif + +#ifndef thread_safe_add +#define thread_safe_add(V,C,L) \ + (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L))) +#define thread_safe_sub(V,C,L) \ + (pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L))) +#endif +#endif + +/* + statistics_xxx functions are for non critical statistic, + maintained in global variables. + When compiling with SAFE_STATISTICS: + - race conditions can not occur. + - some locking occurs, which may cause performance degradation. + + When compiling without SAFE_STATISTICS: + - race conditions can occur, making the result slightly inaccurate. + - the lock given is not honored. +*/ +#ifdef SAFE_STATISTICS +#define statistic_increment(V,L) thread_safe_increment((V),(L)) +#define statistic_decrement(V,L) thread_safe_decrement((V),(L)) +#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) +#define statistic_sub(V,C,L) thread_safe_sub((V),(C),(L)) +#else +#define statistic_decrement(V,L) (V)-- +#define statistic_increment(V,L) (V)++ +#define statistic_add(V,C,L) (V)+=(C) +#define statistic_sub(V,C,L) (V)-=(C) +#endif /* SAFE_STATISTICS */ + +/* + No locking needed, the counter is owned by the thread +*/ +#define status_var_increment(V) (V)++ +#define status_var_decrement(V) (V)-- +#define status_var_add(V,C) (V)+=(C) +#define status_var_sub(V,C) (V)-=(C) + +#ifdef __cplusplus +} +#endif +#endif /* _my_ptread_h */ diff --git a/externals/mysql/my_stacktrace.h b/externals/mysql/my_stacktrace.h new file mode 100644 index 0000000..e7ce42c --- /dev/null +++ b/externals/mysql/my_stacktrace.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _my_stacktrace_h_ +#define _my_stacktrace_h_ + +#include + +#ifdef TARGET_OS_LINUX +#if defined (__x86_64__) || defined (__i386__) || \ + (defined(__alpha__) && defined(__GNUC__)) +#define HAVE_STACKTRACE 1 +#endif +#elif defined(__WIN__) +#define HAVE_STACKTRACE 1 +#endif + +#if HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD) +#undef HAVE_STACKTRACE +#define HAVE_STACKTRACE 1 +#endif + +#if !defined(__NETWARE__) +#define HAVE_WRITE_CORE +#endif + +#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \ + HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \ + HAVE_WEAK_SYMBOL +#define BACKTRACE_DEMANGLE 1 +#endif + +C_MODE_START + +#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) +void my_init_stacktrace(); +void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack); +void my_safe_print_str(const char* name, const char* val, int max_len); +void my_write_core(int sig); +#if BACKTRACE_DEMANGLE +char *my_demangle(const char *mangled_name, int *status); +#endif +#ifdef __WIN__ +void my_set_exception_pointers(EXCEPTION_POINTERS *ep); +#endif +#endif + +#ifdef HAVE_WRITE_CORE +void my_write_core(int sig); +#endif + +C_MODE_END + +#endif /* _my_stacktrace_h_ */ diff --git a/externals/mysql/my_sys.h b/externals/mysql/my_sys.h new file mode 100644 index 0000000..c8ec791 --- /dev/null +++ b/externals/mysql/my_sys.h @@ -0,0 +1,1082 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file + mysys library API +*/ + +#ifndef _my_sys_h +#define _my_sys_h +C_MODE_START + +#ifdef HAVE_AIOWAIT +#include /* Used by record-cache */ +typedef struct my_aio_result { + aio_result_t result; + int pending; +} my_aio_result; +#endif + +#ifndef THREAD +extern int NEAR my_errno; /* Last error in mysys */ +#else +#include +#endif + +#include /* for CHARSET_INFO */ +#include +#include + +#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} +#define MY_INIT(name); { my_progname= name; my_init(); } + +/** + Max length of an error message generated by mysys utilities. + Some mysys functions produce error messages. These mostly go + to stderr. + This constant defines the size of the buffer used to format + the message. It should be kept in sync with MYSQL_ERRMSG_SIZE, + since sometimes mysys errors are stored in the server diagnostics + area, and we would like to avoid unexpected truncation. +*/ +#define MYSYS_ERRMSG_SIZE (512) + +#define MY_FILE_ERROR ((size_t) -1) + + /* General bitmaps for my_func's */ +#define MY_FFNF 1 /* Fatal if file not found */ +#define MY_FNABP 2 /* Fatal if not all bytes read/writen */ +#define MY_NABP 4 /* Error if not all bytes read/writen */ +#define MY_FAE 8 /* Fatal if any error */ +#define MY_WME 16 /* Write message on error */ +#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ +#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ +#define MY_SYNC_DIR 1024 /* my_create/delete/rename: sync directory */ +#define MY_RAID 64 /* Support for RAID */ +#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ +#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ +#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ +#define MY_COPYTIME 64 /* my_redel() copys time */ +#define MY_DELETE_OLD 256 /* my_create_with_symlink() */ +#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ +#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ +#define MY_REDEL_MAKE_BACKUP 256 +#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ +#define MY_SHORT_WAIT 64 /* my_lock() don't wait if can't lock */ +#define MY_FORCE_LOCK 128 /* use my_lock() even if disable_locking */ +#define MY_NO_WAIT 256 /* my_lock() don't wait at all */ +#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */ +#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ +#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ +#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ +#define MY_DONT_OVERWRITE_FILE 2048 /* my_copy: Don't overwrite file */ +#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ + +#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ +#define MY_GIVE_INFO 2 /* Give time info about process*/ +#define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ + +#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */ +#define MY_REMOVE_OPTION 1 +#define MY_REMOVE_SECTION 2 + +#define ME_HIGHBYTE 8 /* Shift for colours */ +#define ME_NOCUR 1 /* Don't use curses message */ +#define ME_OLDWIN 2 /* Use old window */ +#define ME_BELL 4 /* Ring bell then printing message */ +#define ME_HOLDTANG 8 /* Don't delete last keys */ +#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ +#define ME_WAITTANG 32 /* Wait for a user action */ +#define ME_NOREFRESH 64 /* Dont refresh screen */ +#define ME_NOINPUT 128 /* Dont use the input libary */ +#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ +#define ME_COLOUR2 ((2 << ME_HIGHBYTE)) +#define ME_COLOUR3 ((3 << ME_HIGHBYTE)) +#define ME_FATALERROR 1024 /* Fatal statement error */ +#define ME_JUST_INFO 8192 /**< not error but just info */ +#define ME_JUST_WARNING 16384 /**< not error but just warning */ + + /* Bits in last argument to fn_format */ +#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ +#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */ +#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */ +#define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */ +#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */ +#define MY_RETURN_REAL_PATH 32 /* return full path for file */ +#define MY_SAFE_PATH 64 /* Return NULL if too long path */ +#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ +#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ + + + /* My seek flags */ +#define MY_SEEK_SET 0 +#define MY_SEEK_CUR 1 +#define MY_SEEK_END 2 + + /* Some constants */ +#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ +#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ +#define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */ +#define DFLT_INIT_HITS 3 + + /* root_alloc flags */ +#define MY_KEEP_PREALLOC 1 +#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */ + + /* Internal error numbers (for assembler functions) */ +#define MY_ERRNO_EDOM 33 +#define MY_ERRNO_ERANGE 34 + + /* Bits for get_date timeflag */ +#define GETDATE_DATE_TIME 1 +#define GETDATE_SHORT_DATE 2 +#define GETDATE_HHMMSSTIME 4 +#define GETDATE_GMT 8 +#define GETDATE_FIXEDLENGTH 16 + + /* defines when allocating data */ +#ifdef SAFEMALLOC +#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG ) +#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG ) +#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG ) +#define my_checkmalloc() _sanity( __FILE__, __LINE__ ) +#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG) +#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C) +#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C) +#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C) +#define QUICK_SAFEMALLOC sf_malloc_quick=1 +#define NORMAL_SAFEMALLOC sf_malloc_quick=0 +extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick; +extern ulonglong sf_malloc_mem_limit; + +#define CALLER_INFO_PROTO , const char *sFile, uint uLine +#define CALLER_INFO , __FILE__, __LINE__ +#define ORIG_CALLER_INFO , sFile, uLine +#else +#define my_checkmalloc() +#undef TERMINATE +#define TERMINATE(A,B) {} +#define QUICK_SAFEMALLOC +#define NORMAL_SAFEMALLOC +extern void *my_malloc(size_t Size,myf MyFlags); +#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG ) +extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags); +extern void my_no_flags_free(void *ptr); +extern void *my_memdup(const void *from,size_t length,myf MyFlags); +extern char *my_strdup(const char *from,myf MyFlags); +extern char *my_strndup(const char *from, size_t length, + myf MyFlags); +/* we do use FG (as a no-op) in below so that a typo on FG is caught */ +#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR)) +#define CALLER_INFO_PROTO /* nothing */ +#define CALLER_INFO /* nothing */ +#define ORIG_CALLER_INFO /* nothing */ +#endif + +/* + ERROR INJECTION: Non-thread-safe global variable to request error inject. + Set this variable to non-zero to request the next my_malloc() to fail. + This works with my_malloc.c:my_malloc() and safemalloc.c:_mymalloc(). + If using this in tests, note that the error messages produced by + my_malloc and safemalloc are different. You may need to modify the + results with --replace_regex. You may find examples in + client/backup_stream.c and backup_client_coverage.test. + The global variable is defined in my_static.c. +*/ +IF_DBUG(extern int my_malloc_error_inject); + +#ifdef HAVE_LARGE_PAGES +extern uint my_get_large_page_size(void); +extern uchar * my_large_malloc(size_t size, myf my_flags); +extern void my_large_free(uchar * ptr, myf my_flags); +#else +#define my_get_large_page_size() (0) +#define my_large_malloc(A,B) my_malloc_lock((A),(B)) +#define my_large_free(A,B) my_free_lock((A),(B)) +#endif /* HAVE_LARGE_PAGES */ + +#ifdef HAVE_ALLOCA +#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) +#pragma alloca +#endif /* _AIX */ +#if defined(__MWERKS__) +#undef alloca +#define alloca _alloca +#endif /* __MWERKS__ */ +#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca) +#define alloca __builtin_alloca +#endif /* GNUC */ +#define my_alloca(SZ) alloca((size_t) (SZ)) +#define my_afree(PTR) {} +#else +#define my_alloca(SZ) my_malloc(SZ,MYF(0)) +#define my_afree(PTR) my_free(PTR,MYF(MY_WME)) +#endif /* HAVE_ALLOCA */ + +#ifndef errno /* did we already get it? */ +#ifdef HAVE_ERRNO_AS_DEFINE +#include /* errno is a define */ +#else +extern int errno; /* declare errno */ +#endif +#endif /* #ifndef errno */ +extern char *home_dir; /* Home directory for user */ +extern const char *my_progname; /* program-name (printed in errors) */ +extern const char *my_progname_short; /* like above but without directory */ +extern char NEAR curr_dir[]; /* Current directory for user */ +extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); +extern void (*fatal_error_handler_hook)(uint my_err, const char *str, + myf MyFlags); +extern uint my_file_limit; +extern ulong my_thread_stack_size; + +extern const char *(*proc_info_hook)(void *, const char *, const char *, + const char *, const unsigned int); + +#if defined(ENABLED_DEBUG_SYNC) +extern void (*debug_sync_C_callback_ptr)(const char *, size_t); +#define DEBUG_SYNC_C(_sync_point_name_) do { \ + if (debug_sync_C_callback_ptr != NULL) \ + (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \ + while(0) +#else +#define DEBUG_SYNC_C(_sync_point_name_) +#endif /* defined(ENABLED_DEBUG_SYNC) */ + +#ifdef HAVE_LARGE_PAGES +extern my_bool my_use_large_pages; +extern uint my_large_page_size; +#endif + +/* charsets */ +#define MY_ALL_CHARSETS_SIZE 2048 +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]; +extern CHARSET_INFO compiled_charsets[]; + +/* statistics */ +extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; +extern ulong my_file_total_opened; +extern uint mysys_usage_id; +extern my_bool my_init_done; + + /* Point to current my_message() */ +extern void (*my_sigtstp_cleanup)(void), + /* Executed before jump to shell */ + (*my_sigtstp_restart)(void), + (*my_abort_hook)(int); + /* Executed when comming from shell */ +extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */ +extern int NEAR my_umask_dir, + NEAR my_recived_signals, /* Signals we have got */ + NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ + NEAR my_dont_interrupt; /* call remember_intr when set */ +extern my_bool NEAR mysys_uses_curses, my_use_symdir; +extern size_t sf_malloc_cur_memory, sf_malloc_max_memory; + +extern ulong my_default_record_cache_size; +extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, + NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; +extern char wild_many,wild_one,wild_prefix; +extern const char *charsets_dir; +/* from default.c */ +extern char *my_defaults_extra_file; +extern const char *my_defaults_group_suffix; +extern const char *my_defaults_file; + +extern my_bool timed_mutexes; + +typedef struct wild_file_pack /* Struct to hold info when selecting files */ +{ + uint wilds; /* How many wildcards */ + uint not_pos; /* Start of not-theese-files */ + char * *wild; /* Pointer to wildcards */ +} WF_PACK; + +enum loglevel { + ERROR_LEVEL, + WARNING_LEVEL, + INFORMATION_LEVEL +}; + +enum cache_type +{ + TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE, + SEQ_READ_APPEND /* sequential read or append */, + READ_FIFO, READ_NET,WRITE_NET}; + +enum flush_type +{ + FLUSH_KEEP, /* flush block and keep it in the cache */ + FLUSH_RELEASE, /* flush block and remove it from the cache */ + FLUSH_IGNORE_CHANGED, /* remove block from the cache */ + /* + As my_disable_flush_pagecache_blocks is always 0, the following option + is strictly equivalent to FLUSH_KEEP + */ + FLUSH_FORCE_WRITE, + /** + @brief like FLUSH_KEEP but return immediately if file is already being + flushed (even partially) by another thread; only for page cache, + forbidden for key cache. + */ + FLUSH_KEEP_LAZY +}; + +typedef struct st_record_cache /* Used when cacheing records */ +{ + File file; + int rc_seek,error,inited; + uint rc_length,read_length,reclength; + my_off_t rc_record_pos,end_of_file; + uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos; +#ifdef HAVE_AIOWAIT + int use_async_io; + my_aio_result aio_result; +#endif + enum cache_type type; +} RECORD_CACHE; + +enum file_type +{ + UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN, + FILE_BY_MKSTEMP, FILE_BY_DUP +}; + +struct st_my_file_info +{ + char *name; +#ifdef _WIN32 + HANDLE fhandle; /* win32 file handle */ + int oflag; /* open flags, e.g O_APPEND */ +#endif + enum file_type type; +#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) + pthread_mutex_t mutex; +#endif +}; + +extern struct st_my_file_info *my_file_info; + +typedef struct st_dynamic_array +{ + uchar *buffer; + uint elements,max_element; + uint alloc_increment; + uint size_of_element; +} DYNAMIC_ARRAY; + +typedef struct st_my_tmpdir +{ + DYNAMIC_ARRAY full_list; + char **list; + uint cur, max; +#ifdef THREAD + pthread_mutex_t mutex; +#endif +} MY_TMPDIR; + +typedef struct st_dynamic_string +{ + char *str; + size_t length,max_length,alloc_increment; +} DYNAMIC_STRING; + +struct st_io_cache; +/** Function called when certain events happen to an IO_CACHE */ +typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache *cache, + const uchar *buffert, uint length, + my_off_t filepos); + +#ifdef THREAD +typedef struct st_io_cache_share +{ + pthread_mutex_t mutex; /* To sync on reads into buffer. */ + pthread_cond_t cond; /* To wait for signals. */ + pthread_cond_t cond_writer; /* For a synchronized writer. */ + /* Offset in file corresponding to the first byte of buffer. */ + my_off_t pos_in_file; + /* If a synchronized write cache is the source of the data. */ + struct st_io_cache *source_cache; + uchar *buffer; /* The read buffer. */ + uchar *read_end; /* Behind last valid byte of buffer. */ + int running_threads; /* threads not in lock. */ + int total_threads; /* threads sharing the cache. */ + int error; /* Last error. */ +#ifdef NOT_YET_IMPLEMENTED + /* whether the structure should be free'd */ + my_bool alloced; +#endif +} IO_CACHE_SHARE; +#endif + +typedef struct st_io_cache /* Used when cacheing files */ +{ + /* Offset in file corresponding to the first byte of uchar* buffer. */ + my_off_t pos_in_file; + /* + The offset of end of file for READ_CACHE and WRITE_CACHE. + For SEQ_READ_APPEND it the maximum of the actual end of file and + the position represented by read_end. + */ + my_off_t end_of_file; + /* Points to current read position in the buffer */ + uchar *read_pos; + /* the non-inclusive boundary in the buffer for the currently valid read */ + uchar *read_end; + uchar *buffer; /* The read buffer */ + /* Used in ASYNC_IO */ + uchar *request_pos; + + /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */ + uchar *write_buffer; + /* + Only used in SEQ_READ_APPEND, and points to the current read position + in the write buffer. Note that reads in SEQ_READ_APPEND caches can + happen from both read buffer (uchar* buffer) and write buffer + (uchar* write_buffer). + */ + uchar *append_read_pos; + /* Points to current write position in the write buffer */ + uchar *write_pos; + /* The non-inclusive boundary of the valid write area */ + uchar *write_end; + + /* + Current_pos and current_end are convenience variables used by + my_b_tell() and other routines that need to know the current offset + current_pos points to &write_pos, and current_end to &write_end in a + WRITE_CACHE, and &read_pos and &read_end respectively otherwise + */ + uchar **current_pos, **current_end; +#ifdef THREAD + /* + The lock is for append buffer used in SEQ_READ_APPEND cache + need mutex copying from append buffer to read buffer. + */ + pthread_mutex_t append_buffer_lock; + /* + The following is used when several threads are reading the + same file in parallel. They are synchronized on disk + accesses reading the cached part of the file asynchronously. + It should be set to NULL to disable the feature. Only + READ_CACHE mode is supported. + */ + IO_CACHE_SHARE *share; +#endif + /* + A caller will use my_b_read() macro to read from the cache + if the data is already in cache, it will be simply copied with + memcpy() and internal variables will be accordinging updated with + no functions invoked. However, if the data is not fully in the cache, + my_b_read() will call read_function to fetch the data. read_function + must never be invoked directly. + */ + int (*read_function)(struct st_io_cache *,uchar *,size_t); + /* + Same idea as in the case of read_function, except my_b_write() needs to + be replaced with my_b_append() for a SEQ_READ_APPEND cache + */ + int (*write_function)(struct st_io_cache *,const uchar *,size_t); + /* + Specifies the type of the cache. Depending on the type of the cache + certain operations might not be available and yield unpredicatable + results. Details to be documented later + */ + enum cache_type type; + /* + Callbacks were added and are currently used for binary logging of LOAD + DATA INFILE - when a block is read from the file, we create a block + create/append event, and when IO_CACHE is closed, we create an end event; + also used to write the MyISAM WRITE_CACHE blocks to the MyISAM physical + log. These functions could, of course be used for other things. Note: some + callbacks share the same argument ("arg"). + */ + IO_CACHE_CALLBACK pre_read; /**< called before reading from disk */ + IO_CACHE_CALLBACK post_read; /**< called after reading from disk */ + IO_CACHE_CALLBACK pre_close; /**< called before ending the cache */ + /** Called _after_ writing to disk; not honoured by SEQ_READ_APPEND */ + IO_CACHE_CALLBACK post_write; + /* + Counts the number of times, when we were forced to use disk. We use it to + increase the binlog_cache_disk_use status variable. + */ + ulong disk_writes; + void *arg; /**< used by pre/post_read,post_write */ + char *file_name; /* if used with 'open_cached_file' */ + char *dir,*prefix; + File file; /* file descriptor */ + /* + seek_not_done is set by my_b_seek() to inform the upcoming read/write + operation that a seek needs to be preformed prior to the actual I/O + error is 0 if the cache operation was successful, -1 if there was a + "hard" error, and the actual number of I/O-ed bytes if the read/write was + partial. + */ + int seek_not_done,error; + /** + Cumulative 'error' since last [re]init_io_cache(). Useful if cache's user + polls for errors only once in a while. + */ + int hard_write_error_in_the_past; + /* buffer_length is memory size allocated for buffer or write_buffer */ + size_t buffer_length; + /* read_length is the same as buffer_length except when we use async io */ + size_t read_length; + myf myflags; /* Flags used to my_read/my_write */ + /* + alloced_buffer is 1 if the buffer was allocated by init_io_cache() and + 0 if it was supplied by the user. + Currently READ_NET is the only one that will use a buffer allocated + somewhere else + */ + my_bool alloced_buffer; +#ifdef HAVE_AIOWAIT + /* + As inidicated by ifdef, this is for async I/O, which is not currently + used (because it's not reliable on all systems) + */ + uint inited; + my_off_t aio_read_pos; + my_aio_result aio_result; +#endif +} IO_CACHE; + +typedef int (*qsort2_cmp)(const void *, const void *, const void *); + + /* defines for mf_iocache */ + + /* Test if buffer is inited */ +#define my_b_clear(info) (info)->buffer=0 +#define my_b_inited(info) (info)->buffer +#define my_b_EOF INT_MIN + +#define my_b_read(info,Buffer,Count) \ + ((info)->read_pos + (Count) <= (info)->read_end ?\ + (memcpy(Buffer,(info)->read_pos,(size_t) (Count)), \ + ((info)->read_pos+=(Count)),0) :\ + (*(info)->read_function)((info),Buffer,Count)) + +#define my_b_write(info,Buffer,Count) \ + ((info)->write_pos + (Count) <=(info)->write_end ?\ + (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\ + ((info)->write_pos+=(Count)),0) : \ + (*(info)->write_function)((info),(Buffer),(Count))) + +#define my_b_get(info) \ + ((info)->read_pos != (info)->read_end ?\ + ((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\ + _my_b_get(info)) + + /* my_b_write_byte dosn't have any err-check */ +#define my_b_write_byte(info,chr) \ + (((info)->write_pos < (info)->write_end) ?\ + ((*(info)->write_pos++)=(chr)) :\ + (_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr)))) + +#define my_b_fill_cache(info) \ + (((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0)) + +#define my_b_tell(info) ((info)->pos_in_file + \ + (size_t) (*(info)->current_pos - (info)->request_pos)) + +#define my_b_get_buffer_start(info) (info)->request_pos +#define my_b_get_bytes_in_buffer(info) (char*) (info)->read_end - \ + (char*) my_b_get_buffer_start(info) +#define my_b_get_pos_in_file(info) (info)->pos_in_file + +/* tell write offset in the SEQ_APPEND cache */ +int my_b_copy_to_file(IO_CACHE *cache, FILE *file); +my_off_t my_b_append_tell(IO_CACHE* info); +my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */ + +#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \ + *(info)->current_pos) + +typedef uint32 ha_checksum; +extern ha_checksum my_crc_dbug_check; + +/* Define the type of function to be passed to process_default_option_files */ +typedef int (*Process_option_func)(void *ctx, const char *group_name, + const char *option); + +#include + + + /* Prototypes for mysys and my_func functions */ + +extern int my_copy(const char *from,const char *to,myf MyFlags); +extern int my_append(const char *from,const char *to,myf MyFlags); +extern int my_delete(const char *name,myf MyFlags); +extern int my_getwd(char * buf,size_t size,myf MyFlags); +extern int my_setwd(const char *dir,myf MyFlags); +extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags); +extern void *my_once_alloc(size_t Size,myf MyFlags); +extern void my_once_free(void); +extern char *my_once_strdup(const char *src,myf myflags); +extern void *my_once_memdup(const void *src, size_t len, myf myflags); +extern File my_open(const char *FileName,int Flags,myf MyFlags); +extern File my_register_filename(File fd, const char *FileName, + enum file_type type_of_file, + uint error_message_number, myf MyFlags); +extern File my_create(const char *FileName,int CreateFlags, + int AccessFlags, myf MyFlags); +extern int my_close(File Filedes,myf MyFlags); +extern File my_dup(File file, myf MyFlags); +extern int my_mkdir(const char *dir, int Flags, myf MyFlags); +extern int my_readlink(char *to, const char *filename, myf MyFlags); +extern int my_is_symlink(const char *filename); +extern int my_realpath(char *to, const char *filename, myf MyFlags); +extern File my_create_with_symlink(const char *linkname, const char *filename, + int createflags, int access_flags, + myf MyFlags); +extern int my_delete_with_symlink(const char *name, myf MyFlags); +extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); +extern int my_symlink(const char *content, const char *linkname, myf MyFlags); +extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags); +extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset, + myf MyFlags); +extern int my_rename(const char *from,const char *to,myf MyFlags); +extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags); +extern my_off_t my_tell(File fd,myf MyFlags); +extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count, + myf MyFlags); +extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count, + my_off_t offset,myf MyFlags); +extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags); +extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, + myf MyFlags); +extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); +extern my_off_t my_ftell(FILE *stream,myf MyFlags); +extern void *_mymalloc(size_t uSize,const char *sFile, + uint uLine, myf MyFlag); +extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile, + uint uLine, myf MyFlag); +extern void * my_multi_malloc _VARARGS((myf MyFlags, ...)); +extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag); +extern int _sanity(const char *sFile, uint uLine); +extern void *_my_memdup(const void *from, size_t length, + const char *sFile, uint uLine,myf MyFlag); +extern char * _my_strdup(const char *from, const char *sFile, uint uLine, + myf MyFlag); +extern char *_my_strndup(const char *from, size_t length, + const char *sFile, uint uLine, + myf MyFlag); + +/* implemented in my_memmem.c */ +extern void *my_memmem(const void *haystack, size_t haystacklen, + const void *needle, size_t needlelen); + + +#ifdef _WIN32 +extern int my_access(const char *path, int amode); +#else +#define my_access access +#endif + +extern int check_if_legal_filename(const char *path); +extern int check_if_legal_tablename(const char *path); + +#ifdef _WIN32 +extern int nt_share_delete(const char *name,myf MyFlags); +#define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags)) +#else +#define my_delete_allow_opened(fname,flags) my_delete((fname),(flags)) +#endif + +#ifdef _WIN32 +/* Windows-only functions (CRT equivalents)*/ +extern File my_sopen(const char *path, int oflag, int shflag, int pmode); +extern HANDLE my_get_osfhandle(File fd); +extern void my_osmaperr(unsigned long last_error); +#endif + +#ifndef TERMINATE +extern void TERMINATE(FILE *file, uint flag); +#endif +extern void init_glob_errs(void); +extern void wait_for_free_space(const char *filename, int errors); +extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); +extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); +extern int my_fclose(FILE *fd,myf MyFlags); +extern File my_fileno(FILE *fd); +extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); +extern int my_chmod(const char *name, mode_t mode, myf my_flags); +extern int my_sync(File fd, myf my_flags); +extern int my_sync_dir(const char *dir_name, myf my_flags); +extern int my_sync_dir_by_file(const char *file_name, myf my_flags); +extern void my_error _VARARGS((int nr,myf MyFlags, ...)); +extern void my_printf_error _VARARGS((uint my_err, const char *format, + myf MyFlags, ...)) + ATTRIBUTE_FORMAT(printf, 2, 4); +extern void my_printv_error(uint error, const char *format, myf MyFlags, + va_list ap); +extern int my_error_register(const char **errmsgs, int first, int last); +extern const char **my_error_unregister(int first, int last); +extern void my_message(uint my_err, const char *str,myf MyFlags); +extern void my_message_no_curses(uint my_err, const char *str,myf MyFlags); +extern my_bool my_init(void); +extern void my_end(int infoflag); +extern int my_redel(const char *from, const char *to, int MyFlags); +extern int my_copystat(const char *from, const char *to, int MyFlags); +extern char * my_filename(File fd); + +#ifndef THREAD +extern void dont_break(void); +extern void allow_break(void); +#else +#define dont_break() +#define allow_break() +#endif + +#ifdef EXTRA_DEBUG +void my_print_open_files(void); +#else +#define my_print_open_files() +#endif + +extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); +extern char *my_tmpdir(MY_TMPDIR *tmpdir); +extern void free_tmpdir(MY_TMPDIR *tmpdir); + +extern void my_remember_signal(int signal_number,sig_handler (*func)(int)); +extern size_t dirname_part(char * to,const char *name, size_t *to_res_length); +extern size_t dirname_length(const char *name); +#define base_name(A) (A+dirname_length(A)) +extern int test_if_hard_path(const char *dir_name); +extern my_bool has_path(const char *name); +extern char *convert_dirname(char *to, const char *from, const char *from_end); +extern void to_unix_path(char * name); +extern char * fn_ext(const char *name); +extern char * fn_same(char * toname,const char *name,int flag); +extern char * fn_format(char * to,const char *name,const char *dir, + const char *form, uint flag); +extern size_t strlength(const char *str); +extern void pack_dirname(char * to,const char *from); +extern size_t normalize_dirname(char * to, const char *from); +extern size_t unpack_dirname(char * to,const char *from); +extern size_t cleanup_dirname(char * to,const char *from); +extern size_t system_filename(char * to,const char *from); +extern size_t unpack_filename(char * to,const char *from); +extern char * intern_filename(char * to,const char *from); +extern char * directory_file_name(char * dst, const char *src); +extern int pack_filename(char * to, const char *name, size_t max_length); +extern char * my_path(char * to,const char *progname, + const char *own_pathname_part); +extern char * my_load_path(char * to, const char *path, + const char *own_path_prefix); +extern int wild_compare(const char *str,const char *wildstr, + pbool str_is_pattern); +extern WF_PACK *wf_comp(char * str); +extern int wf_test(struct wild_file_pack *wf_pack,const char *name); +extern void wf_end(struct wild_file_pack *buffer); +extern size_t strip_sp(char * str); +extern my_bool array_append_string_unique(const char *str, + const char **array, size_t size); +extern void get_date(char * to,int timeflag,time_t use_time); +extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr, + pbool remove_garbage); +extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file, + size_t reclength,enum cache_type type, + pbool use_async_io); +extern int read_cache_record(RECORD_CACHE *info,uchar *to); +extern int end_record_cache(RECORD_CACHE *info); +extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, + const uchar *record,size_t length); +extern int flush_write_cache(RECORD_CACHE *info); +extern long my_clock(void); +extern sig_handler sigtstp_handler(int signal_number); +extern void handle_recived_signals(void); + +extern sig_handler my_set_alarm_variable(int signo); +extern void my_string_ptr_sort(uchar *base,uint items,size_t size); +extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, + size_t size_of_element,uchar *buffer[]); +extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size, + qsort_cmp cmp); +extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size, + qsort2_cmp cmp, void *cmp_argument); +extern qsort2_cmp get_ptr_compare(size_t); +void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos); +my_off_t my_get_ptr(uchar *ptr, size_t pack_length); +extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize, + enum cache_type type,my_off_t seek_offset, + pbool use_async_io, myf cache_myflags); +extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, + my_off_t seek_offset,pbool use_async_io, + pbool clear_cache); +extern void setup_io_cache(IO_CACHE* info); +extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count); +#ifdef THREAD +extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count); +extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, + IO_CACHE *write_cache, uint num_threads); +extern void remove_io_thread(IO_CACHE *info); +#endif +extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count); +extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count); +extern int _my_b_get(IO_CACHE *info); +extern int _my_b_async_read(IO_CACHE *info,uchar *Buffer,size_t Count); +extern int _my_b_write(IO_CACHE *info,const uchar *Buffer,size_t Count); +extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count); +extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count); + +extern int my_block_write(IO_CACHE *info, const uchar *Buffer, + size_t Count, my_off_t pos); +extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock); + +#define flush_io_cache(info) my_b_flush_io_cache((info),1) + +extern int end_io_cache(IO_CACHE *info); +extern size_t my_b_fill(IO_CACHE *info); +extern void my_b_seek(IO_CACHE *info,my_off_t pos); +extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length); +extern my_off_t my_b_filelength(IO_CACHE *info); +extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...); +extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); +extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, + const char *prefix, size_t cache_size, + myf cache_myflags); +extern my_bool real_open_cached_file(IO_CACHE *cache); +extern void close_cached_file(IO_CACHE *cache); +File create_temp_file(char *to, const char *dir, const char *pfx, + int mode, myf MyFlags); +#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CALLER_INFO) +#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D ORIG_CALLER_INFO) +#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO) +#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO) +extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size, + void *init_buffer, uint init_alloc, + uint alloc_increment + CALLER_INFO_PROTO); +/* init_dynamic_array() function is deprecated */ +extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, + uint init_alloc,uint alloc_increment + CALLER_INFO_PROTO); +extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const uchar * element); +extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array); +extern uchar *pop_dynamic(DYNAMIC_ARRAY*); +extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index); +extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements); +extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index); +extern void delete_dynamic(DYNAMIC_ARRAY *array); +extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index); +extern void freeze_size(DYNAMIC_ARRAY *array); +extern int get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element); +#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element) +#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index)) +#define push_dynamic(A,B) insert_dynamic((A),(B)) +#define reset_dynamic(array) ((array)->elements= 0) +#define sort_dynamic(A,cmp) my_qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp)) + +extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, + size_t init_alloc,size_t alloc_increment); +extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); +my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, + size_t length); +extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, + ...); +extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); +extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); +extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); +extern void dynstr_free(DYNAMIC_STRING *str); +#ifdef HAVE_MLOCK +extern void *my_malloc_lock(size_t length,myf flags); +extern void my_free_lock(void *ptr,myf flags); +#else +#define my_malloc_lock(A,B) my_malloc((A),(B)) +#define my_free_lock(A,B) my_free((A),(B)) +#endif +#define alloc_root_inited(A) ((A)->min_malloc != 0) +#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) +#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) +extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, + size_t pre_alloc_size); +extern void *alloc_root(MEM_ROOT *mem_root, size_t Size); +extern void *multi_alloc_root(MEM_ROOT *mem_root, ...); +extern void free_root(MEM_ROOT *root, myf MyFLAGS); +extern void set_prealloc_root(MEM_ROOT *root, char *ptr); +extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, + size_t prealloc_size); +extern char *strdup_root(MEM_ROOT *root,const char *str); +extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); +extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); +extern int get_defaults_options(int argc, char **argv, + char **defaults, char **extra_defaults, + char **group_suffix); +extern const char *args_separator; +extern int my_load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv, const char ***); +extern int load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv); +extern int modify_defaults_file(const char *file_location, const char *option, + const char *option_value, + const char *section_name, int remove_option); +extern int my_search_option_files(const char *conf_file, int *argc, + char ***argv, uint *args_used, + Process_option_func func, void *func_ctx, + const char **default_directories); +extern void free_defaults(char **argv); +extern void my_print_default_files(const char *conf_file); +extern void print_defaults(const char *conf_file, const char **groups); +extern my_bool my_compress(uchar *, size_t *, size_t *); +extern my_bool my_uncompress(uchar *, size_t , size_t *); +extern uchar *my_compress_alloc(const uchar *packet, size_t *len, + size_t *complen); +extern int packfrm(uchar *, size_t, uchar **, size_t *); +extern int unpackfrm(uchar **, size_t *, const uchar *); + +extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem, + size_t count); +#ifndef DBUG_OFF +extern void my_debug_put_break_here(void); +#else +#define my_debug_put_break_here() do {} while(0) +#endif + +extern void my_sleep(ulong m_seconds); +extern ulong crc32(ulong crc, const uchar *buf, uint len); +extern uint my_set_max_open_files(uint files); +void my_free_open_file_info(void); + +extern time_t my_time(myf flags); +extern ulonglong my_getsystime(void); +extern ulonglong my_micro_time(); +extern ulonglong my_micro_time_and_time(time_t *time_arg); +time_t my_time_possible_from_micro(ulonglong microtime); +extern my_bool my_gethwaddr(uchar *to); +extern int my_getncpus(); + +#ifdef HAVE_SYS_MMAN_H +#include + +#ifndef MAP_NOSYNC +#define MAP_NOSYNC 0 +#endif +#ifndef MAP_NORESERVE +#define MAP_NORESERVE 0 /* For irix and AIX */ +#endif + +#ifdef HAVE_MMAP64 +#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f) +#else +#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) +#endif +#define my_munmap(a,b) munmap((a),(b)) + +#else +/* not a complete set of mmap() flags, but only those that nesessary */ +#define PROT_READ 1 +#define PROT_WRITE 2 +#define MAP_NORESERVE 0 +#define MAP_SHARED 0x0001 +#define MAP_PRIVATE 0x0002 +#define MAP_NOSYNC 0x0800 +#define MAP_FAILED ((void *)-1) +#define MS_SYNC 0x0000 + +#ifndef __NETWARE__ +#define HAVE_MMAP +#endif + +void *my_mmap(void *, size_t, int, int, int, my_off_t); +int my_munmap(void *, size_t); +#endif + +/* my_getpagesize */ +#ifdef HAVE_GETPAGESIZE +#define my_getpagesize() getpagesize() +#else +int my_getpagesize(void); +#endif + +int my_msync(int, void *, size_t, int); + +#define MY_UUID_SIZE 16 +#define MY_UUID_STRING_LENGTH (8+1+4+1+4+1+4+1+12) + +void my_uuid_init(ulong seed1, ulong seed2); +void my_uuid(uchar *guid); +void my_uuid2str(const uchar *guid, char *s); +void my_uuid_end(); + +struct my_rnd_struct { + unsigned long seed1,seed2,max_value; + double max_value_dbl; +}; + +void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2); +double my_rnd(struct my_rnd_struct *rand_st); + +/* character sets */ +extern uint get_charset_number(const char *cs_name, uint cs_flags); +extern uint get_collation_number(const char *name); +extern const char *get_charset_name(uint cs_number); + +extern CHARSET_INFO *get_charset(uint cs_number, myf flags); +extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); +extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, + uint cs_flags, myf my_flags); + +extern my_bool resolve_charset(const char *cs_name, + CHARSET_INFO *default_cs, + CHARSET_INFO **cs); +extern my_bool resolve_collation(const char *cl_name, + CHARSET_INFO *default_cl, + CHARSET_INFO **cl); + +extern void free_charsets(void); +extern char *get_charsets_dir(char *buf); +extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2); +extern my_bool init_compiled_charsets(myf flags); +extern void add_compiled_collation(CHARSET_INFO *cs); +extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info, + char *to, size_t to_length, + const char *from, size_t length); +#ifdef __WIN__ +#define BACKSLASH_MBTAIL +/* File system character set */ +extern CHARSET_INFO *fs_character_set(void); +#endif +extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, + char *to, size_t to_length, + const char *from, size_t length); + +extern void thd_increment_bytes_sent(ulong length); +extern void thd_increment_bytes_received(ulong length); +extern void thd_increment_net_big_packet_count(ulong length); + +#ifdef __WIN__ +extern my_bool have_tcpip; /* Is set if tcpip is used */ + +/* implemented in my_windac.c */ + +int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror, + DWORD owner_rights, DWORD everybody_rights); + +void my_security_attr_free(SECURITY_ATTRIBUTES *sa); + +/* implemented in my_conio.c */ +char* my_cgets(char *string, size_t clen, size_t* plen); + +#endif +#ifdef __NETWARE__ +void netware_reg_user(const char *ip, const char *user, + const char *application); +#endif + +C_MODE_END +#endif /* _my_sys_h */ diff --git a/externals/mysql/my_time.h b/externals/mysql/my_time.h new file mode 100644 index 0000000..58995f1 --- /dev/null +++ b/externals/mysql/my_time.h @@ -0,0 +1,172 @@ +/* Copyright (C) 2004-2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This is a private header of sql-common library, containing + declarations for my_time.c +*/ + +#ifndef _my_time_h_ +#define _my_time_h_ +#include "my_global.h" +#include "mysql_time.h" + +C_MODE_START + +extern ulonglong log_10_int[20]; +extern uchar days_in_month[]; + +/* + Portable time_t replacement. + Should be signed and hold seconds for 1902 -- 2038-01-19 range + i.e at least a 32bit variable + + Using the system built in time_t is not an option as + we rely on the above requirements in the time functions + + For example QNX has an unsigned time_t type +*/ +typedef long my_time_t; + +#define MY_TIME_T_MAX LONG_MAX +#define MY_TIME_T_MIN LONG_MIN + +/* Time handling defaults */ +#define TIMESTAMP_MAX_YEAR 2038 +#define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1) +#define TIMESTAMP_MAX_VALUE INT_MAX32 +#define TIMESTAMP_MIN_VALUE 1 + +/* two-digit years < this are 20..; >= this are 19.. */ +#define YY_PART_YEAR 70 + +/* Flags to str_to_datetime */ +#define TIME_FUZZY_DATE 1 +#define TIME_DATETIME_ONLY 2 +/* Must be same as MODE_NO_ZERO_IN_DATE */ +#define TIME_NO_ZERO_IN_DATE (65536L*2*2*2*2*2*2*2) +/* Must be same as MODE_NO_ZERO_DATE */ +#define TIME_NO_ZERO_DATE (TIME_NO_ZERO_IN_DATE*2) +#define TIME_INVALID_DATES (TIME_NO_ZERO_DATE*2) + +#define MYSQL_TIME_WARN_TRUNCATED 1 +#define MYSQL_TIME_WARN_OUT_OF_RANGE 2 + +/* Limits for the TIME data type */ +#define TIME_MAX_HOUR 838 +#define TIME_MAX_MINUTE 59 +#define TIME_MAX_SECOND 59 +#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \ + TIME_MAX_SECOND) +#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \ + TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND) + +my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date, + ulong flags, int *was_cut); +enum enum_mysql_timestamp_type +str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, + uint flags, int *was_cut); +longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res, + uint flags, int *was_cut); +ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *); +ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *); +ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *); +ulonglong TIME_to_ulonglong(const MYSQL_TIME *); + + +my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time, + int *warning); + +int check_time_range(struct st_mysql_time *, int *warning); + +long calc_daynr(uint year,uint month,uint day); +uint calc_days_in_year(uint year); +uint year_2000_handling(uint year); + +void my_init_time(void); + + +/* + Function to check sanity of a TIMESTAMP value + + DESCRIPTION + Check if a given MYSQL_TIME value fits in TIMESTAMP range. + This function doesn't make precise check, but rather a rough + estimate. + + RETURN VALUES + FALSE The value seems sane + TRUE The MYSQL_TIME value is definitely out of range +*/ + +static inline my_bool validate_timestamp_range(const MYSQL_TIME *t) +{ + if ((t->year > TIMESTAMP_MAX_YEAR || t->year < TIMESTAMP_MIN_YEAR) || + (t->year == TIMESTAMP_MAX_YEAR && (t->month > 1 || t->day > 19)) || + (t->year == TIMESTAMP_MIN_YEAR && (t->month < 12 || t->day < 31))) + return FALSE; + + return TRUE; +} + +my_time_t +my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, + my_bool *in_dst_time_gap); + +void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type); + +/* + Required buffer length for my_time_to_str, my_date_to_str, + my_datetime_to_str and TIME_to_string functions. Note, that the + caller is still responsible to check that given TIME structure + has values in valid ranges, otherwise size of the buffer could + be not enough. We also rely on the fact that even wrong values + sent using binary protocol fit in this buffer. +*/ +#define MAX_DATE_STRING_REP_LENGTH 30 + +int my_time_to_str(const MYSQL_TIME *l_time, char *to); +int my_date_to_str(const MYSQL_TIME *l_time, char *to); +int my_datetime_to_str(const MYSQL_TIME *l_time, char *to); +int my_TIME_to_str(const MYSQL_TIME *l_time, char *to); + +/* + Available interval types used in any statement. + + 'interval_type' must be sorted so that simple intervals comes first, + ie year, quarter, month, week, day, hour, etc. The order based on + interval size is also important and the intervals should be kept in a + large to smaller order. (get_interval_value() depends on this) + + Note: If you change the order of elements in this enum you should fix + order of elements in 'interval_type_to_name' and 'interval_names' + arrays + + See also interval_type_to_name, get_interval_value, interval_names +*/ + +enum interval_type +{ + INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_WEEK, INTERVAL_DAY, + INTERVAL_HOUR, INTERVAL_MINUTE, INTERVAL_SECOND, INTERVAL_MICROSECOND, + INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE, + INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND, + INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND, + INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND, INTERVAL_LAST +}; + +C_MODE_END + +#endif /* _my_time_h_ */ diff --git a/externals/mysql/my_tree.h b/externals/mysql/my_tree.h new file mode 100644 index 0000000..e387b25 --- /dev/null +++ b/externals/mysql/my_tree.h @@ -0,0 +1,96 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _tree_h +#define _tree_h +#ifdef __cplusplus +extern "C" { +#endif + +#include "my_base.h" /* get 'enum ha_rkey_function' */ + +/* Worst case tree is half full. This gives use 2^(MAX_TREE_HEIGHT/2) leafs */ +#define MAX_TREE_HEIGHT 64 + +#define ELEMENT_KEY(tree,element)\ +(tree->offset_to_key ? (void*)((uchar*) element+tree->offset_to_key) :\ + *((void**) (element+1))) + +#define tree_set_pointer(element,ptr) *((uchar **) (element+1))=((uchar*) (ptr)) + +#define TREE_NO_DUPS 1 + +typedef enum { left_root_right, right_root_left } TREE_WALK; +typedef uint32 element_count; +typedef int (*tree_walk_action)(void *,element_count,void *); + +typedef enum { free_init, free_free, free_end } TREE_FREE; +typedef void (*tree_element_free)(void*, TREE_FREE, void *); + +typedef struct st_tree_element { + struct st_tree_element *left,*right; + uint32 count:31, + colour:1; /* black is marked as 1 */ +} TREE_ELEMENT; + +#define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs)) + +typedef struct st_tree { + TREE_ELEMENT *root,null_element; + TREE_ELEMENT **parents[MAX_TREE_HEIGHT]; + uint offset_to_key,elements_in_tree,size_of_element; + ulong memory_limit, allocated; + qsort_cmp2 compare; + void *custom_arg; + MEM_ROOT mem_root; + my_bool with_delete; + tree_element_free free; + uint flag; +} TREE; + + /* Functions on whole tree */ +void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit, + int size, qsort_cmp2 compare, my_bool with_delete, + tree_element_free free_element, void *custom_arg); +void delete_tree(TREE*); +void reset_tree(TREE*); + + /* similar to delete tree, except we do not my_free() blocks in mem_root */ +#define is_tree_inited(tree) ((tree)->root != 0) + + /* Functions on leafs */ +TREE_ELEMENT *tree_insert(TREE *tree,void *key, uint key_size, + void *custom_arg); +void *tree_search(TREE *tree, void *key, void *custom_arg); +int tree_walk(TREE *tree,tree_walk_action action, + void *argument, TREE_WALK visit); +int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg); +void *tree_search_key(TREE *tree, const void *key, + TREE_ELEMENT **parents, TREE_ELEMENT ***last_pos, + enum ha_rkey_function flag, void *custom_arg); +void *tree_search_edge(TREE *tree, TREE_ELEMENT **parents, + TREE_ELEMENT ***last_pos, int child_offs); +void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs, + int r_offs); +ha_rows tree_record_pos(TREE *tree, const void *key, + enum ha_rkey_function search_flag, void *custom_arg); +#define reset_free_element(tree) (tree)->free= 0 + +#define TREE_ELEMENT_EXTRA_SIZE (sizeof(TREE_ELEMENT) + sizeof(void*)) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/my_trie.h b/externals/mysql/my_trie.h new file mode 100644 index 0000000..72dd485 --- /dev/null +++ b/externals/mysql/my_trie.h @@ -0,0 +1,141 @@ +/* Copyright (C) 2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _trie_h +#define _trie_h +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_trie_node +{ + uint16 leaf; /* Depth from root node if match, 0 else */ + uchar c; /* Label on this edge */ + struct st_trie_node *next; /* Next label */ + struct st_trie_node *links; /* Array of edges leaving this node */ + struct st_trie_node *fail; /* AC failure function */ +} TRIE_NODE; + +typedef struct st_trie +{ + TRIE_NODE root; + MEM_ROOT mem_root; + CHARSET_INFO *charset; + uint32 nnodes; + uint32 nwords; +} TRIE; + +typedef struct st_ac_trie_state +{ + TRIE *trie; + TRIE_NODE *node; +} AC_TRIE_STATE; + +extern TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset); +extern void trie_free (TRIE *trie); +extern my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen); +extern my_bool ac_trie_prepare (TRIE *trie); +extern void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state); + + +/* `trie_goto' is internal function and shouldn't be used. */ + +static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, uchar c) +{ + TRIE_NODE *next; + DBUG_ENTER("trie_goto"); + for (next= node->links; next; next= next->next) + if (next->c == c) + DBUG_RETURN(next); + if (root == node) + DBUG_RETURN(root); + DBUG_RETURN(NULL); +} + + +/* + SYNOPSIS + int ac_trie_next (AC_TRIE_STATE *state, uchar *c); + state - valid pointer to `AC_TRIE_STATE' + c - character to lookup + + DESCRIPTION + Implementation of search using Aho-Corasick automaton. + Performs char-by-char search. + + RETURN VALUE + `ac_trie_next' returns length of matched word or 0. +*/ + +static inline int ac_trie_next (AC_TRIE_STATE *state, uchar *c) +{ + TRIE_NODE *root, *node; + DBUG_ENTER("ac_trie_next"); + DBUG_ASSERT(state && c); + root= &state->trie->root; + node= state->node; + while (! (state->node= trie_goto(root, node, *c))) + node= node->fail; + DBUG_RETURN(state->node->leaf); +} + + +/* + SYNOPSIS + my_bool trie_search (TRIE *trie, const uchar *key, uint keylen); + trie - valid pointer to `TRIE' + key - valid pointer to key to insert + keylen - non-0 key length + + DESCRIPTION + Performs key lookup in trie. + + RETURN VALUE + `trie_search' returns `true' if key is in `trie'. Otherwise, + `false' is returned. + + NOTES + Consecutive search here is "best by test". arrays are very short, so + binary search or hashing would add too much complexity that would + overweight speed gain. Especially because compiler can optimize simple + consecutive loop better (tested) +*/ + +static inline my_bool trie_search (TRIE *trie, const uchar *key, uint keylen) +{ + TRIE_NODE *node; + uint k; + DBUG_ENTER("trie_search"); + DBUG_ASSERT(trie && key && keylen); + node= &trie->root; + + for (k= 0; k < keylen; k++) + { + uchar p; + if (! (node= node->links)) + DBUG_RETURN(FALSE); + p= key[k]; + while (p != node->c) + if (! (node= node->next)) + DBUG_RETURN(FALSE); + } + + DBUG_RETURN(node->leaf > 0); +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/my_uctype.h b/externals/mysql/my_uctype.h new file mode 100644 index 0000000..9aaf478 --- /dev/null +++ b/externals/mysql/my_uctype.h @@ -0,0 +1,1479 @@ +/* Copyright (C) 2006 MySQL AB + + 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; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* + Unicode ctype data + Generated from UnicodeData-5.0.0d9.txt +*/ +static unsigned char uctype_page00[256]= +{ + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, + 16, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 16, 16, 16, 16, 16, + 16, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 16, 16, 16, 16, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, 16, 32, 16, 16, + 16, 16, 20, 20, 16, 2, 16, 16, 16, 20, 2, 16, 20, 20, 20, 16, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_page01[256]= +{ + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, + 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, + 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 2, 2, 1, 1, 2, 1, + 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, + 2, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, + 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2 +}; + +static unsigned char uctype_page02[256]= +{ + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 2, + 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 2, 2, 2, 2, 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page03[256]= +{ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 0, 16, 16, 0, 0, 0, 0, 2, 2, 2, 2, 16, 0, + 0, 0, 0, 0, 16, 16, 1, 16, 1, 1, 1, 0, 1, 0, 1, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, + 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 2, 2, 2, 2, 1, 2, 16, 1, 2, 1, 1, 2, 2, 1, 1, 1 +}; + +static unsigned char uctype_page04[256]= +{ + 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, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 16, 18, 18, 18, 18, 0, 18, 18, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 +}; + +static unsigned char uctype_page05[256]= +{ + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 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, 0, 0, 2, 16, 16, 16, 16, 16, 16, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 16, 16, 0, 0, 0, 0, 0, + 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 16, 18, + 16, 18, 18, 16, 18, 18, 16, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 2, 2, 2, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page06[256]= +{ + 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, + 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 16, 0, 0, 16, 16, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 2, 2, + 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 16, 2, 18, 18, 18, 18, 18, 18, 18, 32, 18, 18, + 18, 18, 18, 18, 18, 2, 2, 18, 18, 16, 18, 18, 18, 18, 2, 2, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 16, 16, 2 +}; + +static unsigned char uctype_page07[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 32, + 2, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 2, 2, 16, 16, 16, 16, 2, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page09[256]= +{ + 0, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, + 2, 18, 18, 18, 18, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 18, 18, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, + 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, + 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, + 18, 18, 18, 18, 18, 0, 0, 18, 18, 0, 0, 18, 18, 18, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 2, 2, 0, 2, + 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 2, 2, 16, 16, 20, 20, 20, 20, 20, 20, 16, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0A[256]= +{ + 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, + 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 0, 18, 0, 18, 18, + 18, 18, 18, 0, 0, 0, 0, 18, 18, 0, 0, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 0, + 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 18, 18, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, + 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, + 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0B[256]= +{ + 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, + 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, + 18, 18, 18, 18, 0, 0, 0, 18, 18, 0, 0, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 2, 2, 0, 2, + 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 16, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 18, 2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, + 2, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 0, 2, 0, 2, 2, + 0, 0, 0, 2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, 18, + 18, 18, 18, 0, 0, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0C[256]= +{ + 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, + 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, 18, + 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, + 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18, + 18, 18, 18, 18, 18, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 2, 0, + 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 0, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0D[256]= +{ + 0, 0, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, + 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, 18, + 18, 18, 18, 18, 0, 0, 18, 18, 18, 0, 18, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 18, 0, 0, 0, 0, 18, + 18, 18, 18, 18, 18, 0, 18, 0, 18, 18, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 18, 18, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0E[256]= +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 18, 2, 2, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 16, + 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 16, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 0, 2, 0, 0, 2, 2, 0, 2, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, + 0, 2, 2, 2, 0, 2, 0, 2, 0, 0, 2, 2, 0, 2, 2, 2, + 2, 18, 2, 2, 18, 18, 18, 18, 18, 18, 0, 18, 18, 2, 0, 0, + 2, 2, 2, 2, 2, 0, 2, 0, 18, 18, 18, 18, 18, 18, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page0F[256]= +{ + 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 16, 16, 16, 16, 16, 16, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 16, 18, 16, 18, 16, 18, 16, 16, 16, 16, 18, 18, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 16, 18, 18, 2, 2, 2, 2, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 16, 16, + 16, 16, 16, 16, 16, 16, 18, 16, 16, 16, 16, 16, 16, 0, 0, 16, + 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page10[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 2, 0, 18, 18, 18, 18, + 18, 18, 18, 0, 0, 0, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, + 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 0, 0, 0 +}; + +static unsigned char uctype_page11[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page12[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, + 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_page13[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 0, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 18, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page14[256]= +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_page16[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 7, 7, + 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page17[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, + 2, 2, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 18, 18, 18, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, + 2, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 32, 32, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 16, 16, 16, 2, 16, 16, 16, 16, 2, 18, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page18[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 8, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page19[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, + 16, 0, 0, 0, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 2, 2, 2, 2, 2, 2, 2, 18, 18, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page1A[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18, 0, 0, 16, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page1B[256]= +{ + 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page1D[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18 +}; + +static unsigned char uctype_page1E[256]= +{ + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page1F[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 1, 0, 1, 0, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 2, 16, + 16, 16, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16, + 2, 2, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1, 0, 16, 16, 16, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16, + 0, 0, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 0 +}; + +static unsigned char uctype_page20[256]= +{ + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 32, 32, 32, 32, 32, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 32, 32, 32, 32, 32, 8, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, + 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, + 20, 2, 0, 0, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 2, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 0, + 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page21[256]= +{ + 16, 16, 1, 16, 16, 16, 16, 1, 16, 16, 2, 1, 1, 1, 2, 2, + 1, 1, 1, 2, 16, 1, 16, 16, 16, 1, 1, 1, 1, 1, 16, 16, + 16, 16, 16, 16, 1, 16, 1, 16, 1, 16, 1, 1, 1, 1, 16, 2, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 16, 16, 2, 2, 1, 1, + 16, 16, 16, 16, 16, 1, 2, 2, 2, 2, 16, 16, 16, 16, 2, 0, + 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page23[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page24[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 +}; + +static unsigned char uctype_page26[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page27[256]= +{ + 0, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 0, 16, + 16, 16, 16, 0, 0, 0, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0, + 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 16, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page2B[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page2C[256]= +{ + 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, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, + 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 0, 0, 0, + 0, 0, 0, 0, 2, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 2, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 20, 16, 16 +}; + +static unsigned char uctype_page2D[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page2E[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 16, 16, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_page2F[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0 +}; + +static unsigned char uctype_page30[256]= +{ + 8, 16, 16, 16, 16, 2, 2, 7, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 7, 7, 7, 7, 7, 7, 7, 7, 7, 18, 18, 18, 18, 18, 18, + 16, 2, 2, 2, 2, 2, 16, 16, 7, 7, 7, 2, 2, 16, 16, 16, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 18, 16, 16, 2, 2, 2, + 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2 +}; + +static unsigned char uctype_page31[256]= +{ + 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, + 16, 16, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_page32[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0 +}; + +static unsigned char uctype_page4D[256]= +{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 +}; + +static unsigned char uctype_page9F[256]= +{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageA4[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageA7[256]= +{ + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageA8[256]= +{ + 2, 2, 18, 2, 2, 2, 18, 2, 2, 2, 2, 18, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 18, 18, 18, 18, 18, 16, 16, 16, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageD7[256]= +{ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageD8[256]= +{ + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageDB[256]= +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 +}; + +static unsigned char uctype_pageDC[256]= +{ + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageDF[256]= +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 +}; + +static unsigned char uctype_pageE0[256]= +{ + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageF8[256]= +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32 +}; + +static unsigned char uctype_pageFA[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static unsigned char uctype_pageFB[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 18, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 2, 0, + 2, 2, 0, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static unsigned char uctype_pageFD[256]= +{ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 0, 0 +}; + +static unsigned char uctype_pageFE[256]= +{ + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, + 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 32 +}; + +static unsigned char uctype_pageFF[256]= +{ + 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, + 16, 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, 16, 16, 16, 16, 16, + 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, + 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, + 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 16, 16, 0, 0 +}; + +MY_UNI_CTYPE my_uni_ctype[256]={ + {0,uctype_page00}, + {0,uctype_page01}, + {0,uctype_page02}, + {0,uctype_page03}, + {0,uctype_page04}, + {0,uctype_page05}, + {0,uctype_page06}, + {0,uctype_page07}, + {0,NULL}, + {0,uctype_page09}, + {0,uctype_page0A}, + {0,uctype_page0B}, + {0,uctype_page0C}, + {0,uctype_page0D}, + {0,uctype_page0E}, + {0,uctype_page0F}, + {0,uctype_page10}, + {0,uctype_page11}, + {0,uctype_page12}, + {0,uctype_page13}, + {0,uctype_page14}, + {2,NULL}, + {0,uctype_page16}, + {0,uctype_page17}, + {0,uctype_page18}, + {0,uctype_page19}, + {0,uctype_page1A}, + {0,uctype_page1B}, + {0,NULL}, + {0,uctype_page1D}, + {0,uctype_page1E}, + {0,uctype_page1F}, + {0,uctype_page20}, + {0,uctype_page21}, + {16,NULL}, + {0,uctype_page23}, + {0,uctype_page24}, + {16,NULL}, + {0,uctype_page26}, + {0,uctype_page27}, + {16,NULL}, + {16,NULL}, + {16,NULL}, + {0,uctype_page2B}, + {0,uctype_page2C}, + {0,uctype_page2D}, + {0,uctype_page2E}, + {0,uctype_page2F}, + {0,uctype_page30}, + {0,uctype_page31}, + {0,uctype_page32}, + {16,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {0,uctype_page4D}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {0,uctype_page9F}, + {2,NULL}, + {2,NULL}, + {2,NULL}, + {2,NULL}, + {0,uctype_pageA4}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageA7}, + {0,uctype_pageA8}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {3,NULL}, + {0,uctype_pageD7}, + {0,uctype_pageD8}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageDB}, + {0,uctype_pageDC}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageDF}, + {0,uctype_pageE0}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,NULL}, + {0,uctype_pageF8}, + {2,NULL}, + {0,uctype_pageFA}, + {0,uctype_pageFB}, + {2,NULL}, + {0,uctype_pageFD}, + {0,uctype_pageFE}, + {0,uctype_pageFF} +}; + + diff --git a/externals/mysql/my_vle.h b/externals/mysql/my_vle.h new file mode 100644 index 0000000..c09f822 --- /dev/null +++ b/externals/mysql/my_vle.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef VLE_H +#define VLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "my_global.h" + +/* + The size (in bytes) required to store the object ITEM, which can be + either an expression or a type (since sizeof() is used on the item). +*/ +#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7) + +uchar *my_vle_encode(uchar *vle, size_t max, ulong value); +uchar const *my_vle_decode(ulong *value_ptr, uchar const *vle); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/mysql/my_xml.h b/externals/mysql/my_xml.h new file mode 100644 index 0000000..6a453ee --- /dev/null +++ b/externals/mysql/my_xml.h @@ -0,0 +1,89 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#ifndef _my_xml_h +#define _my_xml_h + +#ifdef __cplusplus +extern "C" { +#endif + + +#define MY_XML_OK 0 +#define MY_XML_ERROR 1 + +/* + A flag whether to use absolute tag names in call-back functions, + like "a", "a.b" and "a.b.c" (used in character set file parser), + or relative names like "a", "b" and "c". +*/ +#define MY_XML_FLAG_RELATIVE_NAMES 1 + +/* + A flag whether to skip normilization of text values before calling + call-back functions: i.e. skip leading/trailing spaces, + \r, \n, \t characters. +*/ +#define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2 + +enum my_xml_node_type +{ + MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */ + MY_XML_NODE_ATTR, /* can have TEXT children */ + MY_XML_NODE_TEXT /* cannot have children */ +}; + +typedef struct xml_stack_st +{ + int flags; + enum my_xml_node_type current_node_type; + char errstr[128]; + char attr[128]; + char *attrend; + const char *beg; + const char *cur; + const char *end; + void *user_data; + int (*enter)(struct xml_stack_st *st,const char *val, size_t len); + int (*value)(struct xml_stack_st *st,const char *val, size_t len); + int (*leave_xml)(struct xml_stack_st *st,const char *val, size_t len); +} MY_XML_PARSER; + +void my_xml_parser_create(MY_XML_PARSER *st); +void my_xml_parser_free(MY_XML_PARSER *st); +int my_xml_parse(MY_XML_PARSER *st,const char *str, size_t len); + +void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, + const char *, + size_t len)); +void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, + const char *, + size_t len)); +void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *, + const char *, + size_t len)); +void my_xml_set_user_data(MY_XML_PARSER *st, void *); + +size_t my_xml_error_pos(MY_XML_PARSER *st); +uint my_xml_error_lineno(MY_XML_PARSER *st); + +const char *my_xml_error_string(MY_XML_PARSER *st); + +#ifdef __cplusplus +} +#endif + +#endif /* _my_xml_h */ diff --git a/externals/mysql/myisampack.h b/externals/mysql/myisampack.h new file mode 100644 index 0000000..34a085e --- /dev/null +++ b/externals/mysql/myisampack.h @@ -0,0 +1,238 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Storing of values in high byte first order. + + integer keys and file pointers are stored with high byte first to get + better compression +*/ + +/* these two are for uniformity */ +#define mi_sint1korr(A) ((int8)(*A)) +#define mi_uint1korr(A) ((uint8)(*A)) + +#define mi_sint2korr(A) ((int16) (((int16) (((const uchar*) (A))[1])) +\ + ((int16) ((int16) ((const char*) (A))[0]) << 8))) +#define mi_sint3korr(A) ((int32) (((((const uchar*) (A))[0]) & 128) ? \ + (((uint32) 255L << 24) | \ + (((uint32) ((const uchar*) (A))[0]) << 16) |\ + (((uint32) ((const uchar*) (A))[1]) << 8) | \ + ((uint32) ((const uchar*) (A))[2])) : \ + (((uint32) ((const uchar*) (A))[0]) << 16) |\ + (((uint32) ((const uchar*) (A))[1]) << 8) | \ + ((uint32) ((const uchar*) (A))[2]))) +#define mi_sint4korr(A) ((int32) (((int32) (((const uchar*) (A))[3])) +\ + ((int32) (((const uchar*) (A))[2]) << 8) +\ + ((int32) (((const uchar*) (A))[1]) << 16) +\ + ((int32) ((int16) ((const char*) (A))[0]) << 24))) +#define mi_sint8korr(A) ((longlong) mi_uint8korr(A)) +#define mi_uint2korr(A) ((uint16) (((uint16) (((const uchar*) (A))[1])) +\ + ((uint16) (((const uchar*) (A))[0]) << 8))) +#define mi_uint3korr(A) ((uint32) (((uint32) (((const uchar*) (A))[2])) +\ + (((uint32) (((const uchar*) (A))[1])) << 8) +\ + (((uint32) (((const uchar*) (A))[0])) << 16))) +#define mi_uint4korr(A) ((uint32) (((uint32) (((const uchar*) (A))[3])) +\ + (((uint32) (((const uchar*) (A))[2])) << 8) +\ + (((uint32) (((const uchar*) (A))[1])) << 16) +\ + (((uint32) (((const uchar*) (A))[0])) << 24))) +#define mi_uint5korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[4])) +\ + (((uint32) (((const uchar*) (A))[3])) << 8) +\ + (((uint32) (((const uchar*) (A))[2])) << 16) +\ + (((uint32) (((const uchar*) (A))[1])) << 24)) +\ + (((ulonglong) (((const uchar*) (A))[0])) << 32)) +#define mi_uint6korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[5])) +\ + (((uint32) (((const uchar*) (A))[4])) << 8) +\ + (((uint32) (((const uchar*) (A))[3])) << 16) +\ + (((uint32) (((const uchar*) (A))[2])) << 24)) +\ + (((ulonglong) (((uint32) (((const uchar*) (A))[1])) +\ + (((uint32) (((const uchar*) (A))[0]) << 8)))) <<\ + 32)) +#define mi_uint7korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[6])) +\ + (((uint32) (((const uchar*) (A))[5])) << 8) +\ + (((uint32) (((const uchar*) (A))[4])) << 16) +\ + (((uint32) (((const uchar*) (A))[3])) << 24)) +\ + (((ulonglong) (((uint32) (((const uchar*) (A))[2])) +\ + (((uint32) (((const uchar*) (A))[1])) << 8) +\ + (((uint32) (((const uchar*) (A))[0])) << 16))) <<\ + 32)) +#define mi_uint8korr(A) ((ulonglong)(((uint32) (((const uchar*) (A))[7])) +\ + (((uint32) (((const uchar*) (A))[6])) << 8) +\ + (((uint32) (((const uchar*) (A))[5])) << 16) +\ + (((uint32) (((const uchar*) (A))[4])) << 24)) +\ + (((ulonglong) (((uint32) (((const uchar*) (A))[3])) +\ + (((uint32) (((const uchar*) (A))[2])) << 8) +\ + (((uint32) (((const uchar*) (A))[1])) << 16) +\ + (((uint32) (((const uchar*) (A))[0])) << 24))) <<\ + 32)) + +/* This one is for uniformity */ +#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A) + +#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\ + ((uchar*) (T))[1]= (uchar) (def_temp);\ + ((uchar*) (T))[0]= (uchar) (def_temp >> 8); } +#define mi_int3store(T,A) { /*lint -save -e734 */\ + ulong def_temp= (ulong) (A);\ + ((uchar*) (T))[2]= (uchar) (def_temp);\ + ((uchar*) (T))[1]= (uchar) (def_temp >> 8);\ + ((uchar*) (T))[0]= (uchar) (def_temp >> 16);\ + /*lint -restore */} +#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\ + ((uchar*) (T))[3]= (uchar) (def_temp);\ + ((uchar*) (T))[2]= (uchar) (def_temp >> 8);\ + ((uchar*) (T))[1]= (uchar) (def_temp >> 16);\ + ((uchar*) (T))[0]= (uchar) (def_temp >> 24); } +#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\ + def_temp2= (ulong) ((A) >> 32);\ + ((uchar*) (T))[4]= (uchar) (def_temp);\ + ((uchar*) (T))[3]= (uchar) (def_temp >> 8);\ + ((uchar*) (T))[2]= (uchar) (def_temp >> 16);\ + ((uchar*) (T))[1]= (uchar) (def_temp >> 24);\ + ((uchar*) (T))[0]= (uchar) (def_temp2); } +#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\ + def_temp2= (ulong) ((A) >> 32);\ + ((uchar*) (T))[5]= (uchar) (def_temp);\ + ((uchar*) (T))[4]= (uchar) (def_temp >> 8);\ + ((uchar*) (T))[3]= (uchar) (def_temp >> 16);\ + ((uchar*) (T))[2]= (uchar) (def_temp >> 24);\ + ((uchar*) (T))[1]= (uchar) (def_temp2);\ + ((uchar*) (T))[0]= (uchar) (def_temp2 >> 8); } +#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\ + def_temp2= (ulong) ((A) >> 32);\ + ((uchar*) (T))[6]= (uchar) (def_temp);\ + ((uchar*) (T))[5]= (uchar) (def_temp >> 8);\ + ((uchar*) (T))[4]= (uchar) (def_temp >> 16);\ + ((uchar*) (T))[3]= (uchar) (def_temp >> 24);\ + ((uchar*) (T))[2]= (uchar) (def_temp2);\ + ((uchar*) (T))[1]= (uchar) (def_temp2 >> 8);\ + ((uchar*) (T))[0]= (uchar) (def_temp2 >> 16); } +#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A),\ + def_temp4= (ulong) ((A) >> 32);\ + mi_int4store((uchar*) (T) + 0, def_temp4);\ + mi_int4store((uchar*) (T) + 4, def_temp3); } + +#ifdef WORDS_BIGENDIAN + +#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[0];\ + ((uchar*) (T))[1]= ((uchar*) &A)[1];\ + ((uchar*) (T))[2]= ((uchar*) &A)[2];\ + ((uchar*) (T))[3]= ((uchar*) &A)[3]; } + +#define mi_float4get(V,M) { float def_temp;\ + ((uchar*) &def_temp)[0]= ((const uchar*) (M))[0];\ + ((uchar*) &def_temp)[1]= ((const uchar*) (M))[1]; \ + ((uchar*) &def_temp)[2]= ((const uchar*) (M))[2];\ + ((uchar*) &def_temp)[3]= ((const uchar*) (M))[3];\ + (V)= def_temp; } + +#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((const uchar*) &V)[0];\ + ((uchar*) (T))[1]= ((const uchar*) &V)[1];\ + ((uchar*) (T))[2]= ((const uchar*) &V)[2];\ + ((uchar*) (T))[3]= ((const uchar*) &V)[3];\ + ((uchar*) (T))[4]= ((const uchar*) &V)[4];\ + ((uchar*) (T))[5]= ((const uchar*) &V)[5];\ + ((uchar*) (T))[6]= ((const uchar*) &V)[6];\ + ((uchar*) (T))[7]= ((const uchar*) &V)[7]; } + +#define mi_float8get(V,M) { double def_temp;\ + ((uchar*) &def_temp)[0]= ((const uchar*) (M))[0];\ + ((uchar*) &def_temp)[1]= ((const uchar*) (M))[1];\ + ((uchar*) &def_temp)[2]= ((const uchar*) (M))[2];\ + ((uchar*) &def_temp)[3]= ((const uchar*) (M))[3];\ + ((uchar*) &def_temp)[4]= ((const uchar*) (M))[4];\ + ((uchar*) &def_temp)[5]= ((const uchar*) (M))[5];\ + ((uchar*) &def_temp)[6]= ((const uchar*) (M))[6];\ + ((uchar*) &def_temp)[7]= ((const uchar*) (M))[7]; \ + (V)= def_temp; } +#else + +#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((const uchar*) &A)[3];\ + ((uchar*) (T))[1]= ((const uchar*) &A)[2];\ + ((uchar*) (T))[2]= ((const uchar*) &A)[1];\ + ((uchar*) (T))[3]= ((const uchar*) &A)[0]; } + +#define mi_float4get(V,M) { float def_temp;\ + ((uchar*) &def_temp)[0]= ((const uchar*) (M))[3];\ + ((uchar*) &def_temp)[1]= ((const uchar*) (M))[2];\ + ((uchar*) &def_temp)[2]= ((const uchar*) (M))[1];\ + ((uchar*) &def_temp)[3]= ((const uchar*) (M))[0];\ + (V)= def_temp; } + +#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) +#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((const uchar*) &V)[3];\ + ((uchar*) (T))[1]= ((const uchar*) &V)[2];\ + ((uchar*) (T))[2]= ((const uchar*) &V)[1];\ + ((uchar*) (T))[3]= ((const uchar*) &V)[0];\ + ((uchar*) (T))[4]= ((const uchar*) &V)[7];\ + ((uchar*) (T))[5]= ((const uchar*) &V)[6];\ + ((uchar*) (T))[6]= ((const uchar*) &V)[5];\ + ((uchar*) (T))[7]= ((const uchar*) &V)[4];} + +#define mi_float8get(V,M) { double def_temp;\ + ((uchar*) &def_temp)[0]= ((const uchar*) (M))[3];\ + ((uchar*) &def_temp)[1]= ((const uchar*) (M))[2];\ + ((uchar*) &def_temp)[2]= ((const uchar*) (M))[1];\ + ((uchar*) &def_temp)[3]= ((const uchar*) (M))[0];\ + ((uchar*) &def_temp)[4]= ((const uchar*) (M))[7];\ + ((uchar*) &def_temp)[5]= ((const uchar*) (M))[6];\ + ((uchar*) &def_temp)[6]= ((const uchar*) (M))[5];\ + ((uchar*) &def_temp)[7]= ((const uchar*) (M))[4];\ + (V)= def_temp; } + +#else +#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((const uchar*) &V)[7];\ + ((uchar*) (T))[1]= ((const uchar*) &V)[6];\ + ((uchar*) (T))[2]= ((const uchar*) &V)[5];\ + ((uchar*) (T))[3]= ((const uchar*) &V)[4];\ + ((uchar*) (T))[4]= ((const uchar*) &V)[3];\ + ((uchar*) (T))[5]= ((const uchar*) &V)[2];\ + ((uchar*) (T))[6]= ((const uchar*) &V)[1];\ + ((uchar*) (T))[7]= ((const uchar*) &V)[0];} + +#define mi_float8get(V,M) { double def_temp;\ + ((uchar*) &def_temp)[0]= ((const uchar*) (M))[7];\ + ((uchar*) &def_temp)[1]= ((const uchar*) (M))[6];\ + ((uchar*) &def_temp)[2]= ((const uchar*) (M))[5];\ + ((uchar*) &def_temp)[3]= ((const uchar*) (M))[4];\ + ((uchar*) &def_temp)[4]= ((const uchar*) (M))[3];\ + ((uchar*) &def_temp)[5]= ((const uchar*) (M))[2];\ + ((uchar*) &def_temp)[6]= ((const uchar*) (M))[1];\ + ((uchar*) &def_temp)[7]= ((const uchar*) (M))[0];\ + (V)= def_temp; } +#endif /* __FLOAT_WORD_ORDER */ +#endif /* WORDS_BIGENDIAN */ + +/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */ + +#ifdef BIG_TABLES +#define mi_rowstore(T,A) mi_int8store(T, A) +#define mi_rowkorr(T) mi_uint8korr(T) +#else +#define mi_rowstore(T,A) { mi_int4store(T, 0);\ + mi_int4store(((uchar*) (T) + 4), A); } +#define mi_rowkorr(T) mi_uint4korr((const uchar*) (T) + 4) +#endif + +#if SIZEOF_OFF_T > 4 +#define mi_sizestore(T,A) mi_int8store(T, A) +#define mi_sizekorr(T) mi_uint8korr(T) +#else +#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR)\ + bfill((char*) (T), 8, 255);\ + else { mi_int4store((T), 0);\ + mi_int4store(((T) + 4), A); }} +#define mi_sizekorr(T) mi_uint4korr((const uchar*) (T) + 4) +#endif diff --git a/externals/mysql/mysql.h b/externals/mysql/mysql.h new file mode 100644 index 0000000..88333c4 --- /dev/null +++ b/externals/mysql/mysql.h @@ -0,0 +1,755 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This file defines the client API to MySQL and also the ABI of the + dynamically linked libmysqlclient. + + The ABI should never be changed in a released product of MySQL + thus you need to take great care when changing the file. In case + the file is changed so the ABI is broken, you must also + update the SHAREDLIB_MAJOR_VERSION in configure.in . + +*/ + +#ifndef _mysql_h +#define _mysql_h + +#ifdef _AIX /* large-file support will break without this */ +#include +#endif + +#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ +#undef WIN +#undef _WIN +#undef _WIN32 +#undef _WIN64 +#undef __WIN__ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _global_h /* If not standard header */ +#include +#ifdef __LCC__ +#include /* For windows */ +#endif +typedef char my_bool; +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) +#define __WIN__ +#endif +#if !defined(__WIN__) +#define STDCALL +#else +#define STDCALL __stdcall +#endif + +#ifndef my_socket_defined +#ifdef __WIN__ +#define my_socket SOCKET +#else +typedef int my_socket; +#endif /* __WIN__ */ +#endif /* my_socket_defined */ +#endif /* _global_h */ + +#include "mysql_version.h" +#include "mysql_com.h" +#include "mysql_time.h" + +#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ + +extern unsigned int mysql_port; +extern char *mysql_unix_port; + +#define CLIENT_NET_READ_TIMEOUT 365*24*3600 /* Timeout on read */ +#define CLIENT_NET_WRITE_TIMEOUT 365*24*3600 /* Timeout on write */ + +#ifdef __NETWARE__ +#pragma pack(push, 8) /* 8 byte alignment */ +#endif + +#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) +#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) +#define IS_BLOB(n) ((n) & BLOB_FLAG) +#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) +#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) +#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR) +#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING) + + +typedef struct st_mysql_field { + char *name; /* Name of column */ + char *org_name; /* Original column name, if an alias */ + char *table; /* Table of column if column was a field */ + char *org_table; /* Org table name, if table was an alias */ + char *db; /* Database for table */ + char *catalog; /* Catalog for table */ + char *def; /* Default value (set by mysql_list_fields) */ + unsigned long length; /* Width of column (create length) */ + unsigned long max_length; /* Max width for selected set */ + unsigned int name_length; + unsigned int org_name_length; + unsigned int table_length; + unsigned int org_table_length; + unsigned int db_length; + unsigned int catalog_length; + unsigned int def_length; + unsigned int flags; /* Div flags */ + unsigned int decimals; /* Number of decimals in field */ + unsigned int charsetnr; /* Character set */ + enum enum_field_types type; /* Type of field. See mysql_com.h for types */ + void *extension; +} MYSQL_FIELD; + +typedef char **MYSQL_ROW; /* return data as array of strings */ +typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ + +#ifndef _global_h +#if defined(NO_CLIENT_LONG_LONG) +typedef unsigned long my_ulonglong; +#elif defined (__WIN__) +typedef unsigned __int64 my_ulonglong; +#else +typedef unsigned long long my_ulonglong; +#endif +#endif + +#include "typelib.h" + +#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) + +/* backward compatibility define - to be removed eventually */ +#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED + +typedef struct st_mysql_rows { + struct st_mysql_rows *next; /* list of rows */ + MYSQL_ROW data; + unsigned long length; +} MYSQL_ROWS; + +typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ + +#include "my_alloc.h" + +typedef struct embedded_query_result EMBEDDED_QUERY_RESULT; +typedef struct st_mysql_data { + MYSQL_ROWS *data; + struct embedded_query_result *embedded_info; + MEM_ROOT alloc; + my_ulonglong rows; + unsigned int fields; + /* extra info for embedded library */ + void *extension; +} MYSQL_DATA; + +enum mysql_option +{ + MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, + MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, + MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE, + MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT, + MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT, + MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION, + MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH, + MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, + MYSQL_OPT_SSL_VERIFY_SERVER_CERT +}; + +struct st_mysql_options { + unsigned int connect_timeout, read_timeout, write_timeout; + unsigned int port, protocol; + unsigned long client_flag; + char *host,*user,*password,*unix_socket,*db; + struct st_dynamic_array *init_commands; + char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; + char *ssl_key; /* PEM key file */ + char *ssl_cert; /* PEM cert file */ + char *ssl_ca; /* PEM CA file */ + char *ssl_capath; /* PEM directory of CA-s? */ + char *ssl_cipher; /* cipher to use */ + char *shared_memory_base_name; + unsigned long max_allowed_packet; + my_bool use_ssl; /* if to use SSL or not */ + my_bool compress,named_pipe; + my_bool unused1; + my_bool unused2; + my_bool unused3; + my_bool unused4; + enum mysql_option methods_to_use; + char *client_ip; + /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */ + my_bool secure_auth; + /* 0 - never report, 1 - always report (default) */ + my_bool report_data_truncation; + + /* function pointers for local infile support */ + int (*local_infile_init)(void **, const char *, void *); + int (*local_infile_read)(void *, char *, unsigned int); + void (*local_infile_end)(void *); + int (*local_infile_error)(void *, char *, unsigned int); + void *local_infile_userdata; + void *extension; +}; + +enum mysql_status +{ + MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT +}; + +enum mysql_protocol_type +{ + MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, + MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY +}; + +typedef struct character_set +{ + unsigned int number; /* character set number */ + unsigned int state; /* character set state */ + const char *csname; /* collation name */ + const char *name; /* character set name */ + const char *comment; /* comment */ + const char *dir; /* character set directory */ + unsigned int mbminlen; /* min. length for multibyte strings */ + unsigned int mbmaxlen; /* max. length for multibyte strings */ +} MY_CHARSET_INFO; + +struct st_mysql_methods; +struct st_mysql_stmt; + +typedef struct st_mysql +{ + NET net; /* Communication parameters */ + unsigned char *connector_fd; /* ConnectorFd for SSL */ + char *host,*user,*passwd,*unix_socket,*server_version,*host_info; + char *info, *db; + struct charset_info_st *charset; + MYSQL_FIELD *fields; + MEM_ROOT field_alloc; + my_ulonglong affected_rows; + my_ulonglong insert_id; /* id if insert on table with NEXTNR */ + my_ulonglong extra_info; /* Not used */ + unsigned long thread_id; /* Id for connection in server */ + unsigned long packet_length; + unsigned int port; + unsigned long client_flag,server_capabilities; + unsigned int protocol_version; + unsigned int field_count; + unsigned int server_status; + unsigned int server_language; + unsigned int warning_count; + struct st_mysql_options options; + enum mysql_status status; + my_bool free_me; /* If free in mysql_close */ + my_bool reconnect; /* set to 1 if automatic reconnect */ + + /* session-wide random string */ + char scramble[SCRAMBLE_LENGTH+1]; + my_bool unused1; + void *unused2, *unused3, *unused4, *unused5; + + LIST *stmts; /* list of all statements */ + const struct st_mysql_methods *methods; + void *thd; + /* + Points to boolean flag in MYSQL_RES or MYSQL_STMT. We set this flag + from mysql_stmt_close if close had to cancel result set of this object. + */ + my_bool *unbuffered_fetch_owner; + /* needed for embedded server - no net buffer to store the 'info' */ + char *info_buffer; + void *extension; +} MYSQL; + + +typedef struct st_mysql_res { + my_ulonglong row_count; + MYSQL_FIELD *fields; + MYSQL_DATA *data; + MYSQL_ROWS *data_cursor; + unsigned long *lengths; /* column lengths of current row */ + MYSQL *handle; /* for unbuffered reads */ + const struct st_mysql_methods *methods; + MYSQL_ROW row; /* If unbuffered read */ + MYSQL_ROW current_row; /* buffer to current row */ + MEM_ROOT field_alloc; + unsigned int field_count, current_field; + my_bool eof; /* Used by mysql_fetch_row */ + /* mysql_stmt_close() had to cancel this result */ + my_bool unbuffered_fetch_cancelled; + void *extension; +} MYSQL_RES; + + +#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) +#define MYSQL_CLIENT +#endif + + +typedef struct st_mysql_parameters +{ + unsigned long *p_max_allowed_packet; + unsigned long *p_net_buffer_length; + void *extension; +} MYSQL_PARAMETERS; + +#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY) +#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet) +#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length) +#endif + +/* + Set up and bring down the server; to ensure that applications will + work when linked against either the standard client library or the + embedded server library, these functions should be called. +*/ +int STDCALL mysql_server_init(int argc, char **argv, char **groups); +void STDCALL mysql_server_end(void); + +/* + mysql_server_init/end need to be called when using libmysqld or + libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so + you don't need to call it explicitely; but you need to call + mysql_server_end() to free memory). The names are a bit misleading + (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general + names which suit well whether you're using libmysqld or libmysqlclient. We + intend to promote these aliases over the mysql_server* ones. +*/ +#define mysql_library_init mysql_server_init +#define mysql_library_end mysql_server_end + +MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void); + +/* + Set up and bring down a thread; these function should be called + for each thread in an application which opens at least one MySQL + connection. All uses of the connection(s) should be between these + function calls. +*/ +my_bool STDCALL mysql_thread_init(void); +void STDCALL mysql_thread_end(void); + +/* + Functions to get information from the MYSQL and MYSQL_RES structures + Should definitely be used if one uses shared libraries. +*/ + +my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); +unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); +my_bool STDCALL mysql_eof(MYSQL_RES *res); +MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, + unsigned int fieldnr); +MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); +MYSQL_ROW_OFFSET STDCALL mysql_row_tell(MYSQL_RES *res); +MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res); + +unsigned int STDCALL mysql_field_count(MYSQL *mysql); +my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); +my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); +unsigned int STDCALL mysql_errno(MYSQL *mysql); +const char * STDCALL mysql_error(MYSQL *mysql); +const char *STDCALL mysql_sqlstate(MYSQL *mysql); +unsigned int STDCALL mysql_warning_count(MYSQL *mysql); +const char * STDCALL mysql_info(MYSQL *mysql); +unsigned long STDCALL mysql_thread_id(MYSQL *mysql); +const char * STDCALL mysql_character_set_name(MYSQL *mysql); +int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname); + +MYSQL * STDCALL mysql_init(MYSQL *mysql); +my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, + const char *cert, const char *ca, + const char *capath, const char *cipher); +const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql); +my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, + const char *passwd, const char *db); +MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, + const char *user, + const char *passwd, + const char *db, + unsigned int port, + const char *unix_socket, + unsigned long clientflag); +int STDCALL mysql_select_db(MYSQL *mysql, const char *db); +int STDCALL mysql_query(MYSQL *mysql, const char *q); +int STDCALL mysql_send_query(MYSQL *mysql, const char *q, + unsigned long length); +int STDCALL mysql_real_query(MYSQL *mysql, const char *q, + unsigned long length); +MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); + +void STDCALL mysql_get_character_set_info(MYSQL *mysql, + MY_CHARSET_INFO *charset); + +/* local infile support */ + +#define LOCAL_INFILE_ERROR_LEN 512 + +void +mysql_set_local_infile_handler(MYSQL *mysql, + int (*local_infile_init)(void **, const char *, + void *), + int (*local_infile_read)(void *, char *, + unsigned int), + void (*local_infile_end)(void *), + int (*local_infile_error)(void *, char*, + unsigned int), + void *); + +void +mysql_set_local_infile_default(MYSQL *mysql); + +int STDCALL mysql_shutdown(MYSQL *mysql, + enum mysql_enum_shutdown_level + shutdown_level); +int STDCALL mysql_dump_debug_info(MYSQL *mysql); +int STDCALL mysql_refresh(MYSQL *mysql, + unsigned int refresh_options); +int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); +int STDCALL mysql_set_server_option(MYSQL *mysql, + enum enum_mysql_set_option + option); +int STDCALL mysql_ping(MYSQL *mysql); +const char * STDCALL mysql_stat(MYSQL *mysql); +const char * STDCALL mysql_get_server_info(MYSQL *mysql); +const char * STDCALL mysql_get_client_info(void); +unsigned long STDCALL mysql_get_client_version(void); +const char * STDCALL mysql_get_host_info(MYSQL *mysql); +unsigned long STDCALL mysql_get_server_version(MYSQL *mysql); +unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); +MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); +MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); +int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, + const void *arg); +void STDCALL mysql_free_result(MYSQL_RES *result); +void STDCALL mysql_data_seek(MYSQL_RES *result, + my_ulonglong offset); +MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, + MYSQL_ROW_OFFSET offset); +MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, + MYSQL_FIELD_OFFSET offset); +MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); +unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); +MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); +MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, + const char *wild); +unsigned long STDCALL mysql_escape_string(char *to,const char *from, + unsigned long from_length); +unsigned long STDCALL mysql_hex_string(char *to,const char *from, + unsigned long from_length); +unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, + char *to,const char *from, + unsigned long length); +void STDCALL mysql_debug(const char *debug); +void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); +unsigned int STDCALL mysql_thread_safe(void); +my_bool STDCALL mysql_embedded(void); +my_bool STDCALL mysql_read_query_result(MYSQL *mysql); + + +/* + The following definitions are added for the enhanced + client-server protocol +*/ + +/* statement state */ +enum enum_mysql_stmt_state +{ + MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE, + MYSQL_STMT_FETCH_DONE +}; + + +/* + This structure is used to define bind information, and + internally by the client library. + Public members with their descriptions are listed below + (conventionally `On input' refers to the binds given to + mysql_stmt_bind_param, `On output' refers to the binds given + to mysql_stmt_bind_result): + + buffer_type - One of the MYSQL_* types, used to describe + the host language type of buffer. + On output: if column type is different from + buffer_type, column value is automatically converted + to buffer_type before it is stored in the buffer. + buffer - On input: points to the buffer with input data. + On output: points to the buffer capable to store + output data. + The type of memory pointed by buffer must correspond + to buffer_type. See the correspondence table in + the comment to mysql_stmt_bind_param. + + The two above members are mandatory for any kind of bind. + + buffer_length - the length of the buffer. You don't have to set + it for any fixed length buffer: float, double, + int, etc. It must be set however for variable-length + types, such as BLOBs or STRINGs. + + length - On input: in case when lengths of input values + are different for each execute, you can set this to + point at a variable containining value length. This + way the value length can be different in each execute. + If length is not NULL, buffer_length is not used. + Note, length can even point at buffer_length if + you keep bind structures around while fetching: + this way you can change buffer_length before + each execution, everything will work ok. + On output: if length is set, mysql_stmt_fetch will + write column length into it. + + is_null - On input: points to a boolean variable that should + be set to TRUE for NULL values. + This member is useful only if your data may be + NULL in some but not all cases. + If your data is never NULL, is_null should be set to 0. + If your data is always NULL, set buffer_type + to MYSQL_TYPE_NULL, and is_null will not be used. + + is_unsigned - On input: used to signify that values provided for one + of numeric types are unsigned. + On output describes signedness of the output buffer. + If, taking into account is_unsigned flag, column data + is out of range of the output buffer, data for this column + is regarded truncated. Note that this has no correspondence + to the sign of result set column, if you need to find it out + use mysql_stmt_result_metadata. + error - where to write a truncation error if it is present. + possible error value is: + 0 no truncation + 1 value is out of range or buffer is too small + + Please note that MYSQL_BIND also has internals members. +*/ + +typedef struct st_mysql_bind +{ + unsigned long *length; /* output length pointer */ + my_bool *is_null; /* Pointer to null indicator */ + void *buffer; /* buffer to get/put data */ + /* set this if you want to track data truncations happened during fetch */ + my_bool *error; + unsigned char *row_ptr; /* for the current data position */ + void (*store_param_func)(NET *net, struct st_mysql_bind *param); + void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *, + unsigned char **row); + void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, + unsigned char **row); + /* output buffer length, must be set when fetching str/binary */ + unsigned long buffer_length; + unsigned long offset; /* offset position for char/binary fetch */ + unsigned long length_value; /* Used if length is 0 */ + unsigned int param_number; /* For null count and error messages */ + unsigned int pack_length; /* Internal length for packed data */ + enum enum_field_types buffer_type; /* buffer type */ + my_bool error_value; /* used if error is 0 */ + my_bool is_unsigned; /* set if integer type is unsigned */ + my_bool long_data_used; /* If used with mysql_send_long_data */ + my_bool is_null_value; /* Used if is_null is 0 */ + void *extension; +} MYSQL_BIND; + + +/* statement handler */ +typedef struct st_mysql_stmt +{ + MEM_ROOT mem_root; /* root allocations */ + LIST list; /* list to keep track of all stmts */ + MYSQL *mysql; /* connection handle */ + MYSQL_BIND *params; /* input parameters */ + MYSQL_BIND *bind; /* output parameters */ + MYSQL_FIELD *fields; /* result set metadata */ + MYSQL_DATA result; /* cached result set */ + MYSQL_ROWS *data_cursor; /* current row in cached result */ + /* + mysql_stmt_fetch() calls this function to fetch one row (it's different + for buffered, unbuffered and cursor fetch). + */ + int (*read_row_func)(struct st_mysql_stmt *stmt, + unsigned char **row); + /* copy of mysql->affected_rows after statement execution */ + my_ulonglong affected_rows; + my_ulonglong insert_id; /* copy of mysql->insert_id */ + unsigned long stmt_id; /* Id for prepared statement */ + unsigned long flags; /* i.e. type of cursor to open */ + unsigned long prefetch_rows; /* number of rows per one COM_FETCH */ + /* + Copied from mysql->server_status after execute/fetch to know + server-side cursor status for this statement. + */ + unsigned int server_status; + unsigned int last_errno; /* error code */ + unsigned int param_count; /* input parameter count */ + unsigned int field_count; /* number of columns in result set */ + enum enum_mysql_stmt_state state; /* statement state */ + char last_error[MYSQL_ERRMSG_SIZE]; /* error message */ + char sqlstate[SQLSTATE_LENGTH+1]; + /* Types of input parameters should be sent to server */ + my_bool send_types_to_server; + my_bool bind_param_done; /* input buffers were supplied */ + unsigned char bind_result_done; /* output buffers were supplied */ + /* mysql_stmt_close() had to cancel this result */ + my_bool unbuffered_fetch_cancelled; + /* + Is set to true if we need to calculate field->max_length for + metadata fields when doing mysql_stmt_store_result. + */ + my_bool update_max_length; + void *extension; +} MYSQL_STMT; + +enum enum_stmt_attr_type +{ + /* + When doing mysql_stmt_store_result calculate max_length attribute + of statement metadata. This is to be consistent with the old API, + where this was done automatically. + In the new API we do that only by request because it slows down + mysql_stmt_store_result sufficiently. + */ + STMT_ATTR_UPDATE_MAX_LENGTH, + /* + unsigned long with combination of cursor flags (read only, for update, + etc) + */ + STMT_ATTR_CURSOR_TYPE, + /* + Amount of rows to retrieve from server per one fetch if using cursors. + Accepts unsigned long attribute in the range 1 - ulong_max + */ + STMT_ATTR_PREFETCH_ROWS +}; + + +typedef struct st_mysql_methods +{ + my_bool (*read_query_result)(MYSQL *mysql); + my_bool (*advanced_command)(MYSQL *mysql, + enum enum_server_command command, + const unsigned char *header, + unsigned long header_length, + const unsigned char *arg, + unsigned long arg_length, + my_bool skip_check, + MYSQL_STMT *stmt); + MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields, + unsigned int fields); + MYSQL_RES * (*use_result)(MYSQL *mysql); + void (*fetch_lengths)(unsigned long *to, + MYSQL_ROW column, unsigned int field_count); + void (*flush_use_result)(MYSQL *mysql, my_bool flush_all_results); +#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY) + MYSQL_FIELD * (*list_fields)(MYSQL *mysql); + my_bool (*read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt); + int (*stmt_execute)(MYSQL_STMT *stmt); + int (*read_binary_rows)(MYSQL_STMT *stmt); + int (*unbuffered_fetch)(MYSQL *mysql, char **row); + void (*free_embedded_thd)(MYSQL *mysql); + const char *(*read_statistics)(MYSQL *mysql); + my_bool (*next_result)(MYSQL *mysql); + int (*read_change_user_result)(MYSQL *mysql, char *buff, const char *passwd); + int (*read_rows_from_cursor)(MYSQL_STMT *stmt); +#endif +} MYSQL_METHODS; + + +MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql); +int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, + unsigned long length); +int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt); +int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt); +int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, + unsigned int column, + unsigned long offset); +int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt); +unsigned long STDCALL mysql_stmt_param_count(MYSQL_STMT * stmt); +my_bool STDCALL mysql_stmt_attr_set(MYSQL_STMT *stmt, + enum enum_stmt_attr_type attr_type, + const void *attr); +my_bool STDCALL mysql_stmt_attr_get(MYSQL_STMT *stmt, + enum enum_stmt_attr_type attr_type, + void *attr); +my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd); +my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd); +my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt); +my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt); +my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt); +my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, + unsigned int param_number, + const char *data, + unsigned long length); +MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt); +MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt); +unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt); +const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt); +const char *STDCALL mysql_stmt_sqlstate(MYSQL_STMT * stmt); +MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek(MYSQL_STMT *stmt, + MYSQL_ROW_OFFSET offset); +MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell(MYSQL_STMT *stmt); +void STDCALL mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset); +my_ulonglong STDCALL mysql_stmt_num_rows(MYSQL_STMT *stmt); +my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt); +my_ulonglong STDCALL mysql_stmt_insert_id(MYSQL_STMT *stmt); +unsigned int STDCALL mysql_stmt_field_count(MYSQL_STMT *stmt); + +my_bool STDCALL mysql_commit(MYSQL * mysql); +my_bool STDCALL mysql_rollback(MYSQL * mysql); +my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode); +my_bool STDCALL mysql_more_results(MYSQL *mysql); +int STDCALL mysql_next_result(MYSQL *mysql); +int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt); +void STDCALL mysql_close(MYSQL *sock); + + +/* status return codes */ +#define MYSQL_NO_DATA 100 +#define MYSQL_DATA_TRUNCATED 101 + +#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) + +#ifdef USE_OLD_FUNCTIONS +MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, + const char *user, const char *passwd); +int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); +int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); +#endif +#define HAVE_MYSQL_REAL_CONNECT + +/* + The following functions are mainly exported because of mysqlbinlog; + They are not for general usage +*/ + +#define simple_command(mysql, command, arg, length, skip_check) \ + (*(mysql)->methods->advanced_command)(mysql, command, 0, \ + 0, arg, length, skip_check, NULL) +#define stmt_command(mysql, command, arg, length, stmt) \ + (*(mysql)->methods->advanced_command)(mysql, command, 0, \ + 0, arg, length, 1, stmt) + +#ifdef __NETWARE__ +#pragma pack(pop) /* restore alignment */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _mysql_h */ diff --git a/externals/mysql/mysql_com.h b/externals/mysql/mysql_com.h new file mode 100644 index 0000000..8b16fd2 --- /dev/null +++ b/externals/mysql/mysql_com.h @@ -0,0 +1,543 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* +** Common definition between mysql server & client +*/ + +#ifndef _mysql_com_h +#define _mysql_com_h + +#define HOSTNAME_LENGTH 60 +#define SYSTEM_CHARSET_MBMAXLEN 4 +#define NAME_CHAR_LEN 64 /* Field/table name length */ +#define USERNAME_CHAR_LENGTH 16 +#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN) +#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN) + +#define SERVER_VERSION_LENGTH 60 +#define SQLSTATE_LENGTH 5 + +/* + Maximum length of comments +*/ +#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 (3-byte) characters */ +#define TABLE_COMMENT_MAXLEN 2048 +#define COLUMN_COMMENT_MAXLEN 1024 +#define INDEX_COMMENT_MAXLEN 1024 + + +/* + USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain + username and hostname parts of the user identifier with trailing zero in + MySQL standard format: + user_name_part@host_name_part\0 +*/ +#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2 + +#define LOCAL_HOST "localhost" +#define LOCAL_HOST_NAMEDPIPE "." + + +#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) +#define MYSQL_NAMEDPIPE "MySQL" +#define MYSQL_SERVICENAME "MySQL" +#endif /* __WIN__ */ + +/* + You should add new commands to the end of this list, otherwise old + servers won't be able to handle them as 'unsupported'. +*/ + +enum enum_server_command +{ + COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, + COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, + COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, + COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, + COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, + COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, + COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON, + /* don't forget to update const char *command_name[] in sql_parse.cc */ + + /* Must be last */ + COM_END +}; + + +/* + Length of random string sent by server on handshake; this is also length of + obfuscated password, recieved from client +*/ +#define SCRAMBLE_LENGTH 20 +#define SCRAMBLE_LENGTH_323 8 +/* length of password stored in the db: new passwords are preceeded with '*' */ +#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1) +#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2) + + +#define NOT_NULL_FLAG 1 /* Field can't be NULL */ +#define PRI_KEY_FLAG 2 /* Field is part of a primary key */ +#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ +#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ +#define BLOB_FLAG 16 /* Field is a blob */ +#define UNSIGNED_FLAG 32 /* Field is unsigned */ +#define ZEROFILL_FLAG 64 /* Field is zerofill */ +#define BINARY_FLAG 128 /* Field is binary */ + +/* The following are only sent to new clients */ +#define ENUM_FLAG 256 /* field is an enum */ +#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ +#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ +#define SET_FLAG 2048 /* field is a set */ +#define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */ +#define ON_UPDATE_NOW_FLAG 8192 /* Field is set to NOW on UPDATE */ +#define NUM_FLAG 32768 /* Field is num (for clients) */ +#define PART_KEY_FLAG 16384 /* Intern; Part of some key */ +#define GROUP_FLAG 32768 /* Intern: Group field */ +#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ +#define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */ +#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */ +#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */ +#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */ +#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */ +#define FIELD_STORAGE_FLAGS 22 /* Storage type: bit 22, 23 and 24 */ +#define COLUMN_FORMAT_FLAGS 25 /* Column format: bit 25, 26 and 27 */ + +#define REFRESH_GRANT 1 /* Refresh grant tables */ +#define REFRESH_LOG 2 /* Start on new log file */ +#define REFRESH_TABLES 4 /* close all tables */ +#define REFRESH_HOSTS 8 /* Flush host cache */ +#define REFRESH_STATUS 16 /* Flush status variables */ +#define REFRESH_THREADS 32 /* Flush thread cache */ +#define REFRESH_SLAVE 64 /* Reset master info and restart slave + thread */ +#define REFRESH_MASTER 128 /* Remove all bin logs in the index + and truncate the index */ + +/* The following can't be set with mysql_refresh() */ +#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ +#define REFRESH_FAST 32768 /* Intern flag */ + +/* RESET (remove all queries) from query cache */ +#define REFRESH_QUERY_CACHE 65536 +#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ +#define REFRESH_DES_KEY_FILE 0x40000L +#define REFRESH_USER_RESOURCES 0x80000L +#define REFRESH_BACKUP_LOG 0x200000L + +#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ +#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ +#define CLIENT_LONG_FLAG 4 /* Get all column flags */ +#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ +#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ +#define CLIENT_COMPRESS 32 /* Can use compression protocol */ +#define CLIENT_ODBC 64 /* Odbc client */ +#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ +#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ +#define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */ +#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ +#define CLIENT_SSL 2048 /* Switch to SSL after handshake */ +#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ +#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ +#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ +#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ +#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */ +#define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */ +#define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */ + +#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) +#define CLIENT_REMEMBER_OPTIONS (1UL << 31) + +/* Gather all possible capabilites (flags) supported by the server */ +#define CLIENT_ALL_FLAGS (CLIENT_LONG_PASSWORD | \ + CLIENT_FOUND_ROWS | \ + CLIENT_LONG_FLAG | \ + CLIENT_CONNECT_WITH_DB | \ + CLIENT_NO_SCHEMA | \ + CLIENT_COMPRESS | \ + CLIENT_ODBC | \ + CLIENT_LOCAL_FILES | \ + CLIENT_IGNORE_SPACE | \ + CLIENT_PROTOCOL_41 | \ + CLIENT_INTERACTIVE | \ + CLIENT_SSL | \ + CLIENT_IGNORE_SIGPIPE | \ + CLIENT_TRANSACTIONS | \ + CLIENT_RESERVED | \ + CLIENT_SECURE_CONNECTION | \ + CLIENT_MULTI_STATEMENTS | \ + CLIENT_MULTI_RESULTS | \ + CLIENT_PS_MULTI_RESULTS | \ + CLIENT_SSL_VERIFY_SERVER_CERT | \ + CLIENT_REMEMBER_OPTIONS) + +/* + Switch off the flags that are optional and depending on build flags + If any of the optional flags is supported by the build it will be switched + on before sending to the client during the connection handshake. +*/ +#define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \ + & ~CLIENT_COMPRESS) \ + & ~CLIENT_SSL_VERIFY_SERVER_CERT) + +#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ +#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ +#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ +#define SERVER_QUERY_NO_GOOD_INDEX_USED 16 +#define SERVER_QUERY_NO_INDEX_USED 32 +/** + The server was able to fulfill the clients request and opened a + read-only non-scrollable cursor for a query. This flag comes + in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands. +*/ +#define SERVER_STATUS_CURSOR_EXISTS 64 +/** + This flag is sent when a read-only cursor is exhausted, in reply to + COM_STMT_FETCH command. +*/ +#define SERVER_STATUS_LAST_ROW_SENT 128 +#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ +#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512 +/** + Sent to the client if after a prepared statement reprepare + we discovered that the new statement returns a different + number of result set columns. +*/ +#define SERVER_STATUS_METADATA_CHANGED 1024 +/* + Tell clients that this query was logged to the slow query log. + Not yet set in the server, but interface is defined for applications + to use. See WorkLog 4098. +*/ +#define SERVER_QUERY_WAS_SLOW 2048 + +/** + To mark ResultSet containing output parameter values. +*/ +#define SERVER_PS_OUT_PARAMS 4096 + +/** + Server status flags that must be cleared when starting + execution of a new SQL statement. + Flags from this set are only added to the + current server status by the execution engine, but + never removed -- the execution engine expects them + to disappear automagically by the next command. +*/ +#define SERVER_STATUS_CLEAR_SET (SERVER_QUERY_NO_GOOD_INDEX_USED| \ + SERVER_QUERY_NO_INDEX_USED|\ + SERVER_MORE_RESULTS_EXISTS|\ + SERVER_STATUS_METADATA_CHANGED) + +#define MYSQL_ERRMSG_SIZE 512 +#define NET_READ_TIMEOUT 30 /* Timeout on read */ +#define NET_WRITE_TIMEOUT 60 /* Timeout on write */ +#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ + +#define ONLY_KILL_QUERY 1 + + +struct st_vio; /* Only C */ +typedef struct st_vio Vio; + +#define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */ +#define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */ +#define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */ +#define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ +#define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ +#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */ +#define MAX_BLOB_WIDTH 16777216 /* Default width for blob */ + +typedef struct st_net { +#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) + Vio *vio; + unsigned char *buff,*buff_end,*write_pos,*read_pos; + my_socket fd; /* For Perl DBI/dbd */ + /* + The following variable is set if we are doing several queries in one + command ( as in LOAD TABLE ... FROM MASTER ), + and do not want to confuse the client with OK at the wrong time + */ + unsigned long remain_in_buf,length, buf_length, where_b; + unsigned long max_packet,max_packet_size; + unsigned int pkt_nr,compress_pkt_nr; + unsigned int write_timeout, read_timeout, retry_count; + int fcntl; + unsigned int *return_status; + unsigned char reading_or_writing; + char save_char; + my_bool unused1; /* Please remove with the next incompatible ABI change. */ + my_bool unused2; /* Please remove with the next incompatible ABI change */ + my_bool compress; + my_bool unused3; /* Please remove with the next incompatible ABI change. */ + /* + Pointer to query object in query cache, do not equal NULL (0) for + queries in cache that have not stored its results yet + */ +#endif + /* + Unused, please remove with the next incompatible ABI change. + */ + unsigned char *unused; + unsigned int last_errno; + unsigned char error; + my_bool unused4; /* Please remove with the next incompatible ABI change. */ + my_bool unused5; /* Please remove with the next incompatible ABI change. */ + /** Client library error message buffer. Actually belongs to struct MYSQL. */ + char last_error[MYSQL_ERRMSG_SIZE]; + /** Client library sqlstate buffer. Set along with the error message. */ + char sqlstate[SQLSTATE_LENGTH+1]; + void *extension; +} NET; + + +#define packet_error (~(unsigned long) 0) + +enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, + MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, + MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, + MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, + MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, + MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, + MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, + MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, + MYSQL_TYPE_BIT, + MYSQL_TYPE_NEWDECIMAL=246, + MYSQL_TYPE_ENUM=247, + MYSQL_TYPE_SET=248, + MYSQL_TYPE_TINY_BLOB=249, + MYSQL_TYPE_MEDIUM_BLOB=250, + MYSQL_TYPE_LONG_BLOB=251, + MYSQL_TYPE_BLOB=252, + MYSQL_TYPE_VAR_STRING=253, + MYSQL_TYPE_STRING=254, + MYSQL_TYPE_GEOMETRY=255, + MAX_NO_FIELD_TYPES /* Should always be last */ +}; + +/* For backward compatibility */ +#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS +#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL +#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL +#define FIELD_TYPE_TINY MYSQL_TYPE_TINY +#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT +#define FIELD_TYPE_LONG MYSQL_TYPE_LONG +#define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT +#define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE +#define FIELD_TYPE_NULL MYSQL_TYPE_NULL +#define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP +#define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG +#define FIELD_TYPE_INT24 MYSQL_TYPE_INT24 +#define FIELD_TYPE_DATE MYSQL_TYPE_DATE +#define FIELD_TYPE_TIME MYSQL_TYPE_TIME +#define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME +#define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR +#define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE +#define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM +#define FIELD_TYPE_SET MYSQL_TYPE_SET +#define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB +#define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB +#define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB +#define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB +#define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING +#define FIELD_TYPE_STRING MYSQL_TYPE_STRING +#define FIELD_TYPE_CHAR MYSQL_TYPE_TINY +#define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM +#define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY +#define FIELD_TYPE_BIT MYSQL_TYPE_BIT + + +/* Shutdown/kill enums and constants */ + +/* Bits for THD::killable. */ +#define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) +#define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) +#define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) +#define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) + +enum mysql_enum_shutdown_level { + /* + We want levels to be in growing order of hardness (because we use number + comparisons). Note that DEFAULT does not respect the growing property, but + it's ok. + */ + SHUTDOWN_DEFAULT = 0, + /* wait for existing connections to finish */ + SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, + /* wait for existing trans to finish */ + SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, + /* wait for existing updates to finish (=> no partial MyISAM update) */ + SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, + /* flush InnoDB buffers and other storage engines' buffers*/ + SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), + /* don't flush InnoDB buffers, flush other storage engines' buffers*/ + SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1, + /* Now the 2 levels of the KILL command */ +#if MYSQL_VERSION_ID >= 50000 + KILL_QUERY= 254, +#endif + KILL_CONNECTION= 255 +}; + + +enum enum_cursor_type +{ + CURSOR_TYPE_NO_CURSOR= 0, + CURSOR_TYPE_READ_ONLY= 1, + CURSOR_TYPE_FOR_UPDATE= 2, + CURSOR_TYPE_SCROLLABLE= 4 +}; + + +/* options for mysql_set_option */ +enum enum_mysql_set_option +{ + MYSQL_OPTION_MULTI_STATEMENTS_ON, + MYSQL_OPTION_MULTI_STATEMENTS_OFF +}; + +#define net_new_transaction(net) ((net)->pkt_nr=0) + +#ifdef __cplusplus +extern "C" { +#endif + +my_bool my_net_init(NET *net, Vio* vio); +void my_net_local_init(NET *net); +void net_end(NET *net); + void net_clear(NET *net, my_bool clear_buffer); +my_bool net_realloc(NET *net, size_t length); +my_bool net_flush(NET *net); +my_bool my_net_write(NET *net,const unsigned char *packet, size_t len); +my_bool net_write_command(NET *net,unsigned char command, + const unsigned char *header, size_t head_len, + const unsigned char *packet, size_t len); +int net_real_write(NET *net,const unsigned char *packet, size_t len); +unsigned long my_net_read(NET *net); + +#ifdef _global_h +void my_net_set_write_timeout(NET *net, uint timeout); +void my_net_set_read_timeout(NET *net, uint timeout); +#endif + +struct sockaddr; +int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, + unsigned int timeout); +struct my_rnd_struct; + +#ifdef __cplusplus +} +#endif + + /* The following is for user defined functions */ + +enum Item_result +{ + STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT +#ifdef MYSQL_SERVER + ,IMPOSSIBLE_RESULT /* Yes, we know this is ugly, don't tell us */ + ,MAX_NO_ITEM_RESULTS = IMPOSSIBLE_RESULT /* Should always be last */ +#endif +}; + +typedef struct st_udf_args +{ + unsigned int arg_count; /* Number of arguments */ + enum Item_result *arg_type; /* Pointer to item_results */ + char **args; /* Pointer to argument */ + unsigned long *lengths; /* Length of string arguments */ + char *maybe_null; /* Set to 1 for all maybe_null args */ + char **attributes; /* Pointer to attribute name */ + unsigned long *attribute_lengths; /* Length of attribute arguments */ + void *extension; +} UDF_ARGS; + + /* This holds information about the result */ + +typedef struct st_udf_init +{ + my_bool maybe_null; /* 1 if function can return NULL */ + unsigned int decimals; /* for real functions */ + unsigned long max_length; /* For string functions */ + char *ptr; /* free pointer for function data */ + my_bool const_item; /* 1 if function always returns the same value */ + void *extension; +} UDF_INIT; +/* + TODO: add a notion for determinism of the UDF. + See Item_udf_func::update_used_tables () +*/ + + /* Constants when using compression */ +#define NET_HEADER_SIZE 4 /* standard header size */ +#define COMP_HEADER_SIZE 3 /* compression header extra size */ + + /* Prototypes to password functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + These functions are used for authentication by client and server and + implemented in sql/password.c +*/ + +void create_random_string(char *to, unsigned int length, + struct my_rnd_struct *rand_st); + +void hash_password(unsigned long *to, const char *password, unsigned int password_len); +void make_scrambled_password_323(char *to, const char *password); +void scramble_323(char *to, const char *message, const char *password); +my_bool check_scramble_323(const char *, const char *message, + unsigned long *salt); +void get_salt_from_password_323(unsigned long *res, const char *password); +void make_password_from_salt_323(char *to, const unsigned long *salt); + +void make_scrambled_password(char *to, const char *password); +void scramble(char *to, const char *message, const char *password); +my_bool check_scramble(const char *reply, const char *message, + const unsigned char *hash_stage2); +void get_salt_from_password(unsigned char *res, const char *password); +void make_password_from_salt(char *to, const unsigned char *hash_stage2); +char *octet2hex(char *to, const char *str, unsigned int len); + +/* end of password.c */ + +char *get_tty_password(const char *opt_message); +const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); + +/* Some other useful functions */ + +my_bool my_thread_init(void); +void my_thread_end(void); + +#ifdef _global_h +ulong STDCALL net_field_length(uchar **packet); +my_ulonglong net_field_length_ll(uchar **packet); +uchar *net_store_length(uchar *pkg, ulonglong length); +#endif + +#ifdef __cplusplus +} +#endif + +#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ +#define MYSQL_STMT_HEADER 4 +#define MYSQL_LONG_DATA_HEADER 6 + +#define NOT_FIXED_DEC 31 +#endif diff --git a/externals/mysql/mysql_config/mysql_config.c b/externals/mysql/mysql_config/mysql_config.c new file mode 100644 index 0000000..d930868 --- /dev/null +++ b/externals/mysql/mysql_config/mysql_config.c @@ -0,0 +1,103 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include + +#define INCLUDE "-IC:/Program Files/libmysql/include" +#define LIBS "-LC:/Program Files/libmysql/lib -lmysql" \ + "" +#define CFLAGS INCLUDE +#define VERSION "6.0.2" + +enum options_client +{ + OPT_CFLAGS= 256, + OPT_INCLUDE, + OPT_LIBS, + OPT_LIBS_R, + OPT_VERSION, +}; + +static struct my_option my_long_options[]= +{ + {"cflags", OPT_CFLAGS, "[" CFLAGS "]", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"include", OPT_INCLUDE, "[" INCLUDE "]", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"libs", OPT_LIBS, "[" LIBS "]", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"libs_r", OPT_LIBS_R, "[" LIBS "]", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", OPT_VERSION, "[" VERSION "]", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; + + +void usage(void) +{ + puts("Copyright 2009 Sun Microsystems, Inc."); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n"); + puts("Get compiler flags for using the MySQL client library."); + printf("Usage: %s [OPTIONS]\n", my_progname); + my_print_help(my_long_options); +} + + +my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument) +{ + switch (optid) { + case OPT_CFLAGS: + puts(CFLAGS); + break; + case OPT_INCLUDE: + puts(INCLUDE); + break; + case OPT_LIBS: + case OPT_LIBS_R: + puts(LIBS); + break; + case OPT_VERSION: + puts(VERSION); + break; + } + + return 0; +} + + +int main(int ac, char **av) +{ + int error; + my_progname= av[0]; + + if (ac <= 1) + { + usage(); + exit(1); + } + + if ((error= handle_options(&ac, &av, my_long_options, get_one_option))) + exit(error); + + exit(0); +} diff --git a/externals/mysql/mysql_time.h b/externals/mysql/mysql_time.h new file mode 100644 index 0000000..0a3f17a --- /dev/null +++ b/externals/mysql/mysql_time.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2004 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _mysql_time_h_ +#define _mysql_time_h_ + +/* + Time declarations shared between the server and client API: + you should not add anything to this header unless it's used + (and hence should be visible) in mysql.h. + If you're looking for a place to add new time-related declaration, + it's most likely my_time.h. See also "C API Handling of Date + and Time Values" chapter in documentation. +*/ + +enum enum_mysql_timestamp_type +{ + MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, + MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 +}; + + +/* + Structure which is used to represent datetime values inside MySQL. + + We assume that values in this structure are normalized, i.e. year <= 9999, + month <= 12, day <= 31, hour <= 23, hour <= 59, hour <= 59. Many functions + in server such as my_system_gmt_sec() or make_time() family of functions + rely on this (actually now usage of make_*() family relies on a bit weaker + restriction). Also functions that produce MYSQL_TIME as result ensure this. + There is one exception to this rule though if this structure holds time + value (time_type == MYSQL_TIMESTAMP_TIME) days and hour member can hold + bigger values. +*/ +typedef struct st_mysql_time +{ + unsigned int year, month, day, hour, minute, second; + unsigned long second_part; + my_bool neg; + enum enum_mysql_timestamp_type time_type; +} MYSQL_TIME; + +#endif /* _mysql_time_h_ */ diff --git a/externals/mysql/mysql_version.h b/externals/mysql/mysql_version.h new file mode 100644 index 0000000..3f052b8 --- /dev/null +++ b/externals/mysql/mysql_version.h @@ -0,0 +1,26 @@ +/* Copyright Abandoned 1996, 1999, 2001 MySQL AB + This file is public domain and comes with NO WARRANTY of any kind */ + +/* Version numbers for protocol & mysqld */ + +#ifndef _mysql_version_h +#define _mysql_version_h + +#ifdef _CUSTOMCONFIG_ +# include +#else +# define PROTOCOL_VERSION 10 +# define MYSQL_SERVER_VERSION "6.0.0" +# define MYSQL_VERSION_ID 60000 +# define MYSQL_PORT 3306 +# define MYSQL_PORT_DEFAULT 0 +# define MYSQL_UNIX_ADDR "/tmp/mysql.sock" +# define MYSQL_CONFIG_NAME "my" +# define MYSQL_COMPILATION_COMMENT "Source distribution" +#endif /* _CUSTOMCONFIG_ */ + +#ifndef LICENSE +# define LICENSE GPL +#endif /* LICENSE */ + +#endif /* _mysql_version_h */ diff --git a/externals/mysql/mysqld_error.h b/externals/mysql/mysqld_error.h new file mode 100644 index 0000000..653e583 --- /dev/null +++ b/externals/mysql/mysqld_error.h @@ -0,0 +1,730 @@ +/* Autogenerated file, please don't edit */ + +#define ER_ERROR_FIRST 1000 +#define ER_HASHCHK 1000 +#define ER_NISAMCHK 1001 +#define ER_NO 1002 +#define ER_YES 1003 +#define ER_CANT_CREATE_FILE 1004 +#define ER_CANT_CREATE_TABLE 1005 +#define ER_CANT_CREATE_DB 1006 +#define ER_DB_CREATE_EXISTS 1007 +#define ER_DB_DROP_EXISTS 1008 +#define ER_DB_DROP_DELETE 1009 +#define ER_DB_DROP_RMDIR 1010 +#define ER_CANT_DELETE_FILE 1011 +#define ER_CANT_FIND_SYSTEM_REC 1012 +#define ER_CANT_GET_STAT 1013 +#define ER_CANT_GET_WD 1014 +#define ER_CANT_LOCK 1015 +#define ER_CANT_OPEN_FILE 1016 +#define ER_FILE_NOT_FOUND 1017 +#define ER_CANT_READ_DIR 1018 +#define ER_CANT_SET_WD 1019 +#define ER_CHECKREAD 1020 +#define ER_DISK_FULL 1021 +#define ER_DUP_KEY 1022 +#define ER_ERROR_ON_CLOSE 1023 +#define ER_ERROR_ON_READ 1024 +#define ER_ERROR_ON_RENAME 1025 +#define ER_ERROR_ON_WRITE 1026 +#define ER_FILE_USED 1027 +#define ER_FILSORT_ABORT 1028 +#define ER_FORM_NOT_FOUND 1029 +#define ER_GET_ERRNO 1030 +#define ER_ILLEGAL_HA 1031 +#define ER_KEY_NOT_FOUND 1032 +#define ER_NOT_FORM_FILE 1033 +#define ER_NOT_KEYFILE 1034 +#define ER_OLD_KEYFILE 1035 +#define ER_OPEN_AS_READONLY 1036 +#define ER_OUTOFMEMORY 1037 +#define ER_OUT_OF_SORTMEMORY 1038 +#define ER_UNEXPECTED_EOF 1039 +#define ER_CON_COUNT_ERROR 1040 +#define ER_OUT_OF_RESOURCES 1041 +#define ER_BAD_HOST_ERROR 1042 +#define ER_HANDSHAKE_ERROR 1043 +#define ER_DBACCESS_DENIED_ERROR 1044 +#define ER_ACCESS_DENIED_ERROR 1045 +#define ER_NO_DB_ERROR 1046 +#define ER_UNKNOWN_COM_ERROR 1047 +#define ER_BAD_NULL_ERROR 1048 +#define ER_BAD_DB_ERROR 1049 +#define ER_TABLE_EXISTS_ERROR 1050 +#define ER_BAD_TABLE_ERROR 1051 +#define ER_NON_UNIQ_ERROR 1052 +#define ER_SERVER_SHUTDOWN 1053 +#define ER_BAD_FIELD_ERROR 1054 +#define ER_WRONG_FIELD_WITH_GROUP 1055 +#define ER_WRONG_GROUP_FIELD 1056 +#define ER_WRONG_SUM_SELECT 1057 +#define ER_WRONG_VALUE_COUNT 1058 +#define ER_TOO_LONG_IDENT 1059 +#define ER_DUP_FIELDNAME 1060 +#define ER_DUP_KEYNAME 1061 +#define ER_DUP_ENTRY 1062 +#define ER_WRONG_FIELD_SPEC 1063 +#define ER_PARSE_ERROR 1064 +#define ER_EMPTY_QUERY 1065 +#define ER_NONUNIQ_TABLE 1066 +#define ER_INVALID_DEFAULT 1067 +#define ER_MULTIPLE_PRI_KEY 1068 +#define ER_TOO_MANY_KEYS 1069 +#define ER_TOO_MANY_KEY_PARTS 1070 +#define ER_TOO_LONG_KEY 1071 +#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072 +#define ER_BLOB_USED_AS_KEY 1073 +#define ER_TOO_BIG_FIELDLENGTH 1074 +#define ER_WRONG_AUTO_KEY 1075 +#define ER_READY 1076 +#define ER_NORMAL_SHUTDOWN 1077 +#define ER_GOT_SIGNAL 1078 +#define ER_SHUTDOWN_COMPLETE 1079 +#define ER_FORCING_CLOSE 1080 +#define ER_IPSOCK_ERROR 1081 +#define ER_NO_SUCH_INDEX 1082 +#define ER_WRONG_FIELD_TERMINATORS 1083 +#define ER_BLOBS_AND_NO_TERMINATED 1084 +#define ER_TEXTFILE_NOT_READABLE 1085 +#define ER_FILE_EXISTS_ERROR 1086 +#define ER_LOAD_INFO 1087 +#define ER_ALTER_INFO 1088 +#define ER_WRONG_SUB_KEY 1089 +#define ER_CANT_REMOVE_ALL_FIELDS 1090 +#define ER_CANT_DROP_FIELD_OR_KEY 1091 +#define ER_INSERT_INFO 1092 +#define ER_UPDATE_TABLE_USED 1093 +#define ER_NO_SUCH_THREAD 1094 +#define ER_KILL_DENIED_ERROR 1095 +#define ER_NO_TABLES_USED 1096 +#define ER_TOO_BIG_SET 1097 +#define ER_NO_UNIQUE_LOGFILE 1098 +#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099 +#define ER_TABLE_NOT_LOCKED 1100 +#define ER_BLOB_CANT_HAVE_DEFAULT 1101 +#define ER_WRONG_DB_NAME 1102 +#define ER_WRONG_TABLE_NAME 1103 +#define ER_TOO_BIG_SELECT 1104 +#define ER_UNKNOWN_ERROR 1105 +#define ER_UNKNOWN_PROCEDURE 1106 +#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107 +#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108 +#define ER_UNKNOWN_TABLE 1109 +#define ER_FIELD_SPECIFIED_TWICE 1110 +#define ER_INVALID_GROUP_FUNC_USE 1111 +#define ER_UNSUPPORTED_EXTENSION 1112 +#define ER_TABLE_MUST_HAVE_COLUMNS 1113 +#define ER_RECORD_FILE_FULL 1114 +#define ER_UNKNOWN_CHARACTER_SET 1115 +#define ER_TOO_MANY_TABLES 1116 +#define ER_TOO_MANY_FIELDS 1117 +#define ER_TOO_BIG_ROWSIZE 1118 +#define ER_STACK_OVERRUN 1119 +#define ER_WRONG_OUTER_JOIN 1120 +#define ER_NULL_COLUMN_IN_INDEX 1121 +#define ER_CANT_FIND_UDF 1122 +#define ER_CANT_INITIALIZE_UDF 1123 +#define ER_UDF_NO_PATHS 1124 +#define ER_UDF_EXISTS 1125 +#define ER_CANT_OPEN_LIBRARY 1126 +#define ER_CANT_FIND_DL_ENTRY 1127 +#define ER_FUNCTION_NOT_DEFINED 1128 +#define ER_HOST_IS_BLOCKED 1129 +#define ER_HOST_NOT_PRIVILEGED 1130 +#define ER_PASSWORD_ANONYMOUS_USER 1131 +#define ER_PASSWORD_NOT_ALLOWED 1132 +#define ER_PASSWORD_NO_MATCH 1133 +#define ER_UPDATE_INFO 1134 +#define ER_CANT_CREATE_THREAD 1135 +#define ER_WRONG_VALUE_COUNT_ON_ROW 1136 +#define ER_CANT_REOPEN_TABLE 1137 +#define ER_INVALID_USE_OF_NULL 1138 +#define ER_REGEXP_ERROR 1139 +#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140 +#define ER_NONEXISTING_GRANT 1141 +#define ER_TABLEACCESS_DENIED_ERROR 1142 +#define ER_COLUMNACCESS_DENIED_ERROR 1143 +#define ER_ILLEGAL_GRANT_FOR_TABLE 1144 +#define ER_GRANT_WRONG_HOST_OR_USER 1145 +#define ER_NO_SUCH_TABLE 1146 +#define ER_NONEXISTING_TABLE_GRANT 1147 +#define ER_NOT_ALLOWED_COMMAND 1148 +#define ER_SYNTAX_ERROR 1149 +#define ER_DELAYED_CANT_CHANGE_LOCK 1150 +#define ER_TOO_MANY_DELAYED_THREADS 1151 +#define ER_ABORTING_CONNECTION 1152 +#define ER_NET_PACKET_TOO_LARGE 1153 +#define ER_NET_READ_ERROR_FROM_PIPE 1154 +#define ER_NET_FCNTL_ERROR 1155 +#define ER_NET_PACKETS_OUT_OF_ORDER 1156 +#define ER_NET_UNCOMPRESS_ERROR 1157 +#define ER_NET_READ_ERROR 1158 +#define ER_NET_READ_INTERRUPTED 1159 +#define ER_NET_ERROR_ON_WRITE 1160 +#define ER_NET_WRITE_INTERRUPTED 1161 +#define ER_TOO_LONG_STRING 1162 +#define ER_TABLE_CANT_HANDLE_BLOB 1163 +#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 +#define ER_DELAYED_INSERT_TABLE_LOCKED 1165 +#define ER_WRONG_COLUMN_NAME 1166 +#define ER_WRONG_KEY_COLUMN 1167 +#define ER_WRONG_MRG_TABLE 1168 +#define ER_DUP_UNIQUE 1169 +#define ER_BLOB_KEY_WITHOUT_LENGTH 1170 +#define ER_PRIMARY_CANT_HAVE_NULL 1171 +#define ER_TOO_MANY_ROWS 1172 +#define ER_REQUIRES_PRIMARY_KEY 1173 +#define ER_NO_RAID_COMPILED 1174 +#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 +#define ER_KEY_DOES_NOT_EXITS 1176 +#define ER_CHECK_NO_SUCH_TABLE 1177 +#define ER_CHECK_NOT_IMPLEMENTED 1178 +#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 +#define ER_ERROR_DURING_COMMIT 1180 +#define ER_ERROR_DURING_ROLLBACK 1181 +#define ER_ERROR_DURING_FLUSH_LOGS 1182 +#define ER_ERROR_DURING_CHECKPOINT 1183 +#define ER_NEW_ABORTING_CONNECTION 1184 +#define ER_DUMP_NOT_IMPLEMENTED 1185 +#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 +#define ER_INDEX_REBUILD 1187 +#define ER_MASTER 1188 +#define ER_MASTER_NET_READ 1189 +#define ER_MASTER_NET_WRITE 1190 +#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 +#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 +#define ER_UNKNOWN_SYSTEM_VARIABLE 1193 +#define ER_CRASHED_ON_USAGE 1194 +#define ER_CRASHED_ON_REPAIR 1195 +#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 +#define ER_TRANS_CACHE_FULL 1197 +#define ER_SLAVE_MUST_STOP 1198 +#define ER_SLAVE_NOT_RUNNING 1199 +#define ER_BAD_SLAVE 1200 +#define ER_MASTER_INFO 1201 +#define ER_SLAVE_THREAD 1202 +#define ER_TOO_MANY_USER_CONNECTIONS 1203 +#define ER_SET_CONSTANTS_ONLY 1204 +#define ER_LOCK_WAIT_TIMEOUT 1205 +#define ER_LOCK_TABLE_FULL 1206 +#define ER_READ_ONLY_TRANSACTION 1207 +#define ER_DROP_DB_WITH_READ_LOCK 1208 +#define ER_CREATE_DB_WITH_READ_LOCK 1209 +#define ER_WRONG_ARGUMENTS 1210 +#define ER_NO_PERMISSION_TO_CREATE_USER 1211 +#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 +#define ER_LOCK_DEADLOCK 1213 +#define ER_TABLE_CANT_HANDLE_FT 1214 +#define ER_CANNOT_ADD_FOREIGN 1215 +#define ER_NO_REFERENCED_ROW 1216 +#define ER_ROW_IS_REFERENCED 1217 +#define ER_CONNECT_TO_MASTER 1218 +#define ER_QUERY_ON_MASTER 1219 +#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220 +#define ER_WRONG_USAGE 1221 +#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222 +#define ER_CANT_UPDATE_WITH_READLOCK 1223 +#define ER_MIXING_NOT_ALLOWED 1224 +#define ER_DUP_ARGUMENT 1225 +#define ER_USER_LIMIT_REACHED 1226 +#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 +#define ER_LOCAL_VARIABLE 1228 +#define ER_GLOBAL_VARIABLE 1229 +#define ER_NO_DEFAULT 1230 +#define ER_WRONG_VALUE_FOR_VAR 1231 +#define ER_WRONG_TYPE_FOR_VAR 1232 +#define ER_VAR_CANT_BE_READ 1233 +#define ER_CANT_USE_OPTION_HERE 1234 +#define ER_NOT_SUPPORTED_YET 1235 +#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +#define ER_SLAVE_IGNORED_TABLE 1237 +#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238 +#define ER_WRONG_FK_DEF 1239 +#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240 +#define ER_OPERAND_COLUMNS 1241 +#define ER_SUBQUERY_NO_1_ROW 1242 +#define ER_UNKNOWN_STMT_HANDLER 1243 +#define ER_CORRUPT_HELP_DB 1244 +#define ER_CYCLIC_REFERENCE 1245 +#define ER_AUTO_CONVERT 1246 +#define ER_ILLEGAL_REFERENCE 1247 +#define ER_DERIVED_MUST_HAVE_ALIAS 1248 +#define ER_SELECT_REDUCED 1249 +#define ER_TABLENAME_NOT_ALLOWED_HERE 1250 +#define ER_NOT_SUPPORTED_AUTH_MODE 1251 +#define ER_SPATIAL_CANT_HAVE_NULL 1252 +#define ER_COLLATION_CHARSET_MISMATCH 1253 +#define ER_SLAVE_WAS_RUNNING 1254 +#define ER_SLAVE_WAS_NOT_RUNNING 1255 +#define ER_TOO_BIG_FOR_UNCOMPRESS 1256 +#define ER_ZLIB_Z_MEM_ERROR 1257 +#define ER_ZLIB_Z_BUF_ERROR 1258 +#define ER_ZLIB_Z_DATA_ERROR 1259 +#define ER_CUT_VALUE_GROUP_CONCAT 1260 +#define ER_WARN_TOO_FEW_RECORDS 1261 +#define ER_WARN_TOO_MANY_RECORDS 1262 +#define ER_WARN_NULL_TO_NOTNULL 1263 +#define ER_WARN_DATA_OUT_OF_RANGE 1264 +#define WARN_DATA_TRUNCATED 1265 +#define ER_WARN_USING_OTHER_HANDLER 1266 +#define ER_CANT_AGGREGATE_2COLLATIONS 1267 +#define ER_DROP_USER 1268 +#define ER_REVOKE_GRANTS 1269 +#define ER_CANT_AGGREGATE_3COLLATIONS 1270 +#define ER_CANT_AGGREGATE_NCOLLATIONS 1271 +#define ER_VARIABLE_IS_NOT_STRUCT 1272 +#define ER_UNKNOWN_COLLATION 1273 +#define ER_SLAVE_IGNORED_SSL_PARAMS 1274 +#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275 +#define ER_WARN_FIELD_RESOLVED 1276 +#define ER_BAD_SLAVE_UNTIL_COND 1277 +#define ER_MISSING_SKIP_SLAVE 1278 +#define ER_UNTIL_COND_IGNORED 1279 +#define ER_WRONG_NAME_FOR_INDEX 1280 +#define ER_WRONG_NAME_FOR_CATALOG 1281 +#define ER_WARN_QC_RESIZE 1282 +#define ER_BAD_FT_COLUMN 1283 +#define ER_UNKNOWN_KEY_CACHE 1284 +#define ER_WARN_HOSTNAME_WONT_WORK 1285 +#define ER_UNKNOWN_STORAGE_ENGINE 1286 +#define ER_WARN_DEPRECATED_SYNTAX 1287 +#define ER_NON_UPDATABLE_TABLE 1288 +#define ER_FEATURE_DISABLED 1289 +#define ER_OPTION_PREVENTS_STATEMENT 1290 +#define ER_DUPLICATED_VALUE_IN_TYPE 1291 +#define ER_TRUNCATED_WRONG_VALUE 1292 +#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293 +#define ER_INVALID_ON_UPDATE 1294 +#define ER_UNSUPPORTED_PS 1295 +#define ER_GET_ERRMSG 1296 +#define ER_GET_TEMPORARY_ERRMSG 1297 +#define ER_UNKNOWN_TIME_ZONE 1298 +#define ER_WARN_INVALID_TIMESTAMP 1299 +#define ER_INVALID_CHARACTER_STRING 1300 +#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 +#define ER_CONFLICTING_DECLARATIONS 1302 +#define ER_SP_NO_RECURSIVE_CREATE 1303 +#define ER_SP_ALREADY_EXISTS 1304 +#define ER_SP_DOES_NOT_EXIST 1305 +#define ER_SP_DROP_FAILED 1306 +#define ER_SP_STORE_FAILED 1307 +#define ER_SP_LILABEL_MISMATCH 1308 +#define ER_SP_LABEL_REDEFINE 1309 +#define ER_SP_LABEL_MISMATCH 1310 +#define ER_SP_UNINIT_VAR 1311 +#define ER_SP_BADSELECT 1312 +#define ER_SP_BADRETURN 1313 +#define ER_SP_BADSTATEMENT 1314 +#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315 +#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316 +#define ER_QUERY_INTERRUPTED 1317 +#define ER_SP_WRONG_NO_OF_ARGS 1318 +#define ER_SP_COND_MISMATCH 1319 +#define ER_SP_NORETURN 1320 +#define ER_SP_NORETURNEND 1321 +#define ER_SP_BAD_CURSOR_QUERY 1322 +#define ER_SP_BAD_CURSOR_SELECT 1323 +#define ER_SP_CURSOR_MISMATCH 1324 +#define ER_SP_CURSOR_ALREADY_OPEN 1325 +#define ER_SP_CURSOR_NOT_OPEN 1326 +#define ER_SP_UNDECLARED_VAR 1327 +#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328 +#define ER_SP_FETCH_NO_DATA 1329 +#define ER_SP_DUP_PARAM 1330 +#define ER_SP_DUP_VAR 1331 +#define ER_SP_DUP_COND 1332 +#define ER_SP_DUP_CURS 1333 +#define ER_SP_CANT_ALTER 1334 +#define ER_SP_SUBSELECT_NYI 1335 +#define ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 1336 +#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337 +#define ER_SP_CURSOR_AFTER_HANDLER 1338 +#define ER_SP_CASE_NOT_FOUND 1339 +#define ER_FPARSER_TOO_BIG_FILE 1340 +#define ER_FPARSER_BAD_HEADER 1341 +#define ER_FPARSER_EOF_IN_COMMENT 1342 +#define ER_FPARSER_ERROR_IN_PARAMETER 1343 +#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344 +#define ER_VIEW_NO_EXPLAIN 1345 +#define ER_FRM_UNKNOWN_TYPE 1346 +#define ER_WRONG_OBJECT 1347 +#define ER_NONUPDATEABLE_COLUMN 1348 +#define ER_VIEW_SELECT_DERIVED 1349 +#define ER_VIEW_SELECT_CLAUSE 1350 +#define ER_VIEW_SELECT_VARIABLE 1351 +#define ER_VIEW_SELECT_TMPTABLE 1352 +#define ER_VIEW_WRONG_LIST 1353 +#define ER_WARN_VIEW_MERGE 1354 +#define ER_WARN_VIEW_WITHOUT_KEY 1355 +#define ER_VIEW_INVALID 1356 +#define ER_SP_NO_DROP_SP 1357 +#define ER_SP_GOTO_IN_HNDLR 1358 +#define ER_TRG_ALREADY_EXISTS 1359 +#define ER_TRG_DOES_NOT_EXIST 1360 +#define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361 +#define ER_TRG_CANT_CHANGE_ROW 1362 +#define ER_TRG_NO_SUCH_ROW_IN_TRG 1363 +#define ER_NO_DEFAULT_FOR_FIELD 1364 +#define ER_DIVISION_BY_ZERO 1365 +#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366 +#define ER_ILLEGAL_VALUE_FOR_TYPE 1367 +#define ER_VIEW_NONUPD_CHECK 1368 +#define ER_VIEW_CHECK_FAILED 1369 +#define ER_PROCACCESS_DENIED_ERROR 1370 +#define ER_RELAY_LOG_FAIL 1371 +#define ER_PASSWD_LENGTH 1372 +#define ER_UNKNOWN_TARGET_BINLOG 1373 +#define ER_IO_ERR_LOG_INDEX_READ 1374 +#define ER_BINLOG_PURGE_PROHIBITED 1375 +#define ER_FSEEK_FAIL 1376 +#define ER_BINLOG_PURGE_FATAL_ERR 1377 +#define ER_LOG_IN_USE 1378 +#define ER_LOG_PURGE_UNKNOWN_ERR 1379 +#define ER_RELAY_LOG_INIT 1380 +#define ER_NO_BINARY_LOGGING 1381 +#define ER_RESERVED_SYNTAX 1382 +#define ER_WSAS_FAILED 1383 +#define ER_DIFF_GROUPS_PROC 1384 +#define ER_NO_GROUP_FOR_PROC 1385 +#define ER_ORDER_WITH_PROC 1386 +#define ER_LOGGING_PROHIBIT_CHANGING_OF 1387 +#define ER_NO_FILE_MAPPING 1388 +#define ER_WRONG_MAGIC 1389 +#define ER_PS_MANY_PARAM 1390 +#define ER_KEY_PART_0 1391 +#define ER_VIEW_CHECKSUM 1392 +#define ER_VIEW_MULTIUPDATE 1393 +#define ER_VIEW_NO_INSERT_FIELD_LIST 1394 +#define ER_VIEW_DELETE_MERGE_VIEW 1395 +#define ER_CANNOT_USER 1396 +#define ER_XAER_NOTA 1397 +#define ER_XAER_INVAL 1398 +#define ER_XAER_RMFAIL 1399 +#define ER_XAER_OUTSIDE 1400 +#define ER_XAER_RMERR 1401 +#define ER_XA_RBROLLBACK 1402 +#define ER_NONEXISTING_PROC_GRANT 1403 +#define ER_PROC_AUTO_GRANT_FAIL 1404 +#define ER_PROC_AUTO_REVOKE_FAIL 1405 +#define ER_DATA_TOO_LONG 1406 +#define ER_SP_BAD_SQLSTATE 1407 +#define ER_STARTUP 1408 +#define ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR 1409 +#define ER_CANT_CREATE_USER_WITH_GRANT 1410 +#define ER_WRONG_VALUE_FOR_TYPE 1411 +#define ER_TABLE_DEF_CHANGED 1412 +#define ER_SP_DUP_HANDLER 1413 +#define ER_SP_NOT_VAR_ARG 1414 +#define ER_SP_NO_RETSET 1415 +#define ER_CANT_CREATE_GEOMETRY_OBJECT 1416 +#define ER_FAILED_ROUTINE_BREAK_BINLOG 1417 +#define ER_BINLOG_UNSAFE_ROUTINE 1418 +#define ER_BINLOG_CREATE_ROUTINE_NEED_SUPER 1419 +#define ER_EXEC_STMT_WITH_OPEN_CURSOR 1420 +#define ER_STMT_HAS_NO_OPEN_CURSOR 1421 +#define ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG 1422 +#define ER_NO_DEFAULT_FOR_VIEW_FIELD 1423 +#define ER_SP_NO_RECURSION 1424 +#define ER_TOO_BIG_SCALE 1425 +#define ER_TOO_BIG_PRECISION 1426 +#define ER_M_BIGGER_THAN_D 1427 +#define ER_WRONG_LOCK_OF_SYSTEM_TABLE 1428 +#define ER_CONNECT_TO_FOREIGN_DATA_SOURCE 1429 +#define ER_QUERY_ON_FOREIGN_DATA_SOURCE 1430 +#define ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST 1431 +#define ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 1432 +#define ER_FOREIGN_DATA_STRING_INVALID 1433 +#define ER_CANT_CREATE_FEDERATED_TABLE 1434 +#define ER_TRG_IN_WRONG_SCHEMA 1435 +#define ER_STACK_OVERRUN_NEED_MORE 1436 +#define ER_TOO_LONG_BODY 1437 +#define ER_WARN_CANT_DROP_DEFAULT_KEYCACHE 1438 +#define ER_TOO_BIG_DISPLAYWIDTH 1439 +#define ER_XAER_DUPID 1440 +#define ER_DATETIME_FUNCTION_OVERFLOW 1441 +#define ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG 1442 +#define ER_VIEW_PREVENT_UPDATE 1443 +#define ER_PS_NO_RECURSION 1444 +#define ER_SP_CANT_SET_AUTOCOMMIT 1445 +#define ER_MALFORMED_DEFINER 1446 +#define ER_VIEW_FRM_NO_USER 1447 +#define ER_VIEW_OTHER_USER 1448 +#define ER_NO_SUCH_USER 1449 +#define ER_FORBID_SCHEMA_CHANGE 1450 +#define ER_ROW_IS_REFERENCED_2 1451 +#define ER_NO_REFERENCED_ROW_2 1452 +#define ER_SP_BAD_VAR_SHADOW 1453 +#define ER_TRG_NO_DEFINER 1454 +#define ER_OLD_FILE_FORMAT 1455 +#define ER_SP_RECURSION_LIMIT 1456 +#define ER_SP_PROC_TABLE_CORRUPT 1457 +#define ER_SP_WRONG_NAME 1458 +#define ER_TABLE_NEEDS_UPGRADE 1459 +#define ER_SP_NO_AGGREGATE 1460 +#define ER_MAX_PREPARED_STMT_COUNT_REACHED 1461 +#define ER_VIEW_RECURSIVE 1462 +#define ER_NON_GROUPING_FIELD_USED 1463 +#define ER_TABLE_CANT_HANDLE_SPKEYS 1464 +#define ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA 1465 +#define ER_REMOVED_SPACES 1466 +#define ER_AUTOINC_READ_FAILED 1467 +#define ER_USERNAME 1468 +#define ER_HOSTNAME 1469 +#define ER_WRONG_STRING_LENGTH 1470 +#define ER_NON_INSERTABLE_TABLE 1471 +#define ER_ADMIN_WRONG_MRG_TABLE 1472 +#define ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT 1473 +#define ER_NAME_BECOMES_EMPTY 1474 +#define ER_AMBIGUOUS_FIELD_TERM 1475 +#define ER_FOREIGN_SERVER_EXISTS 1476 +#define ER_FOREIGN_SERVER_DOESNT_EXIST 1477 +#define ER_ILLEGAL_HA_CREATE_OPTION 1478 +#define ER_PARTITION_REQUIRES_VALUES_ERROR 1479 +#define ER_PARTITION_WRONG_VALUES_ERROR 1480 +#define ER_PARTITION_MAXVALUE_ERROR 1481 +#define ER_PARTITION_SUBPARTITION_ERROR 1482 +#define ER_PARTITION_SUBPART_MIX_ERROR 1483 +#define ER_PARTITION_WRONG_NO_PART_ERROR 1484 +#define ER_PARTITION_WRONG_NO_SUBPART_ERROR 1485 +#define ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR 1486 +#define ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR 1487 +#define ER_FIELD_NOT_FOUND_PART_ERROR 1488 +#define ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR 1489 +#define ER_INCONSISTENT_PARTITION_INFO_ERROR 1490 +#define ER_PARTITION_FUNC_NOT_ALLOWED_ERROR 1491 +#define ER_PARTITIONS_MUST_BE_DEFINED_ERROR 1492 +#define ER_RANGE_NOT_INCREASING_ERROR 1493 +#define ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR 1494 +#define ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR 1495 +#define ER_PARTITION_ENTRY_ERROR 1496 +#define ER_MIX_HANDLER_ERROR 1497 +#define ER_PARTITION_NOT_DEFINED_ERROR 1498 +#define ER_TOO_MANY_PARTITIONS_ERROR 1499 +#define ER_SUBPARTITION_ERROR 1500 +#define ER_CANT_CREATE_HANDLER_FILE 1501 +#define ER_BLOB_FIELD_IN_PART_FUNC_ERROR 1502 +#define ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF 1503 +#define ER_NO_PARTS_ERROR 1504 +#define ER_PARTITION_MGMT_ON_NONPARTITIONED 1505 +#define ER_FOREIGN_KEY_ON_PARTITIONED 1506 +#define ER_DROP_PARTITION_NON_EXISTENT 1507 +#define ER_DROP_LAST_PARTITION 1508 +#define ER_COALESCE_ONLY_ON_HASH_PARTITION 1509 +#define ER_REORG_HASH_ONLY_ON_SAME_NO 1510 +#define ER_REORG_NO_PARAM_ERROR 1511 +#define ER_ONLY_ON_RANGE_LIST_PARTITION 1512 +#define ER_ADD_PARTITION_SUBPART_ERROR 1513 +#define ER_ADD_PARTITION_NO_NEW_PARTITION 1514 +#define ER_COALESCE_PARTITION_NO_PARTITION 1515 +#define ER_REORG_PARTITION_NOT_EXIST 1516 +#define ER_SAME_NAME_PARTITION 1517 +#define ER_NO_BINLOG_ERROR 1518 +#define ER_CONSECUTIVE_REORG_PARTITIONS 1519 +#define ER_REORG_OUTSIDE_RANGE 1520 +#define ER_PARTITION_FUNCTION_FAILURE 1521 +#define ER_PART_STATE_ERROR 1522 +#define ER_LIMITED_PART_RANGE 1523 +#define ER_PLUGIN_IS_NOT_LOADED 1524 +#define ER_WRONG_VALUE 1525 +#define ER_NO_PARTITION_FOR_GIVEN_VALUE 1526 +#define ER_FILEGROUP_OPTION_ONLY_ONCE 1527 +#define ER_CREATE_FILEGROUP_FAILED 1528 +#define ER_DROP_FILEGROUP_FAILED 1529 +#define ER_TABLESPACE_AUTO_EXTEND_ERROR 1530 +#define ER_WRONG_SIZE_NUMBER 1531 +#define ER_SIZE_OVERFLOW_ERROR 1532 +#define ER_ALTER_FILEGROUP_FAILED 1533 +#define ER_BINLOG_ROW_LOGGING_FAILED 1534 +#define ER_BINLOG_ROW_WRONG_TABLE_DEF 1535 +#define ER_BINLOG_ROW_RBR_TO_SBR 1536 +#define ER_EVENT_ALREADY_EXISTS 1537 +#define ER_EVENT_STORE_FAILED 1538 +#define ER_EVENT_DOES_NOT_EXIST 1539 +#define ER_EVENT_CANT_ALTER 1540 +#define ER_EVENT_DROP_FAILED 1541 +#define ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG 1542 +#define ER_EVENT_ENDS_BEFORE_STARTS 1543 +#define ER_EVENT_EXEC_TIME_IN_THE_PAST 1544 +#define ER_EVENT_OPEN_TABLE_FAILED 1545 +#define ER_EVENT_NEITHER_M_EXPR_NOR_M_AT 1546 +#define ER_COL_COUNT_DOESNT_MATCH_CORRUPTED 1547 +#define ER_CANNOT_LOAD_FROM_TABLE 1548 +#define ER_EVENT_CANNOT_DELETE 1549 +#define ER_EVENT_COMPILE_ERROR 1550 +#define ER_EVENT_SAME_NAME 1551 +#define ER_EVENT_DATA_TOO_LONG 1552 +#define ER_DROP_INDEX_FK 1553 +#define ER_WARN_DEPRECATED_SYNTAX_WITH_VER 1554 +#define ER_CANT_WRITE_LOCK_LOG_TABLE 1555 +#define ER_CANT_LOCK_LOG_TABLE 1556 +#define ER_FOREIGN_DUPLICATE_KEY 1557 +#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE 1558 +#define ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR 1559 +#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT 1560 +#define ER_NDB_CANT_SWITCH_BINLOG_FORMAT 1561 +#define ER_PARTITION_NO_TEMPORARY 1562 +#define ER_PARTITION_CONST_DOMAIN_ERROR 1563 +#define ER_PARTITION_FUNCTION_IS_NOT_ALLOWED 1564 +#define ER_DDL_LOG_ERROR 1565 +#define ER_NULL_IN_VALUES_LESS_THAN 1566 +#define ER_WRONG_PARTITION_NAME 1567 +#define ER_CANT_CHANGE_TX_ISOLATION 1568 +#define ER_DUP_ENTRY_AUTOINCREMENT_CASE 1569 +#define ER_EVENT_MODIFY_QUEUE_ERROR 1570 +#define ER_EVENT_SET_VAR_ERROR 1571 +#define ER_PARTITION_MERGE_ERROR 1572 +#define ER_CANT_ACTIVATE_LOG 1573 +#define ER_RBR_NOT_AVAILABLE 1574 +#define ER_BASE64_DECODE_ERROR 1575 +#define ER_EVENT_RECURSION_FORBIDDEN 1576 +#define ER_EVENTS_DB_ERROR 1577 +#define ER_ONLY_INTEGERS_ALLOWED 1578 +#define ER_UNSUPORTED_LOG_ENGINE 1579 +#define ER_BAD_LOG_STATEMENT 1580 +#define ER_CANT_RENAME_LOG_TABLE 1581 +#define ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 1582 +#define ER_WRONG_PARAMETERS_TO_NATIVE_FCT 1583 +#define ER_WRONG_PARAMETERS_TO_STORED_FCT 1584 +#define ER_NATIVE_FCT_NAME_COLLISION 1585 +#define ER_DUP_ENTRY_WITH_KEY_NAME 1586 +#define ER_BINLOG_PURGE_EMFILE 1587 +#define ER_EVENT_CANNOT_CREATE_IN_THE_PAST 1588 +#define ER_EVENT_CANNOT_ALTER_IN_THE_PAST 1589 +#define ER_SLAVE_INCIDENT 1590 +#define ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT 1591 +#define ER_BINLOG_UNSAFE_STATEMENT 1592 +#define ER_SLAVE_FATAL_ERROR 1593 +#define ER_SLAVE_RELAY_LOG_READ_FAILURE 1594 +#define ER_SLAVE_RELAY_LOG_WRITE_FAILURE 1595 +#define ER_SLAVE_CREATE_EVENT_FAILURE 1596 +#define ER_SLAVE_MASTER_COM_FAILURE 1597 +#define ER_BINLOG_LOGGING_IMPOSSIBLE 1598 +#define ER_VIEW_NO_CREATION_CTX 1599 +#define ER_VIEW_INVALID_CREATION_CTX 1600 +#define ER_SR_INVALID_CREATION_CTX 1601 +#define ER_TRG_CORRUPTED_FILE 1602 +#define ER_TRG_NO_CREATION_CTX 1603 +#define ER_TRG_INVALID_CREATION_CTX 1604 +#define ER_EVENT_INVALID_CREATION_CTX 1605 +#define ER_TRG_CANT_OPEN_TABLE 1606 +#define ER_CANT_CREATE_SROUTINE 1607 +#define ER_SLAVE_AMBIGOUS_EXEC_MODE 1608 +#define ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT 1609 +#define ER_SLAVE_CORRUPT_EVENT 1610 +#define ER_LOAD_DATA_INVALID_COLUMN 1611 +#define ER_LOG_PURGE_NO_FILE 1612 +#define ER_NEED_REPREPARE 1613 +#define ER_DELAYED_NOT_SUPPORTED 1614 +#define ER_WARN_AUTO_CONVERT_LOCK 1615 +#define ER_NO_AUTO_CONVERT_LOCK_STRICT 1616 +#define ER_NO_AUTO_CONVERT_LOCK_TRANSACTION 1617 +#define ER_NO_STORAGE_ENGINE 1618 +#define ER_BACKUP_BACKUP_START 1619 +#define ER_BACKUP_BACKUP_DONE 1620 +#define ER_BACKUP_RESTORE_START 1621 +#define ER_BACKUP_RESTORE_DONE 1622 +#define ER_BACKUP_NOTHING_TO_BACKUP 1623 +#define ER_BACKUP_CANNOT_INCLUDE_DB 1624 +#define ER_BACKUP_BACKUP 1625 +#define ER_BACKUP_RESTORE 1626 +#define ER_BACKUP_RUNNING 1627 +#define ER_BACKUP_BACKUP_PREPARE 1628 +#define ER_BACKUP_RESTORE_PREPARE 1629 +#define ER_BACKUP_INVALID_LOC 1630 +#define ER_BACKUP_READ_LOC 1631 +#define ER_BACKUP_WRITE_LOC 1632 +#define ER_BACKUP_LIST_DBS 1633 +#define ER_BACKUP_LIST_TABLES 1634 +#define ER_BACKUP_LIST_DB_TABLES 1635 +#define ER_BACKUP_SKIP_VIEW 1636 +#define ER_BACKUP_NO_ENGINE 1637 +#define ER_BACKUP_TABLE_OPEN 1638 +#define ER_BACKUP_READ_HEADER 1639 +#define ER_BACKUP_WRITE_HEADER 1640 +#define ER_BACKUP_NO_BACKUP_DRIVER 1641 +#define ER_BACKUP_NOT_ACCEPTED 1642 +#define ER_BACKUP_CREATE_BACKUP_DRIVER 1643 +#define ER_BACKUP_CREATE_RESTORE_DRIVER 1644 +#define ER_BACKUP_TOO_MANY_IMAGES 1645 +#define ER_BACKUP_WRITE_META 1646 +#define ER_BACKUP_READ_META 1647 +#define ER_BACKUP_CREATE_META 1648 +#define ER_BACKUP_GET_BUF 1649 +#define ER_BACKUP_WRITE_DATA 1650 +#define ER_BACKUP_READ_DATA 1651 +#define ER_BACKUP_NEXT_CHUNK 1652 +#define ER_BACKUP_INIT_BACKUP_DRIVER 1653 +#define ER_BACKUP_INIT_RESTORE_DRIVER 1654 +#define ER_BACKUP_STOP_BACKUP_DRIVER 1655 +#define ER_BACKUP_STOP_RESTORE_DRIVERS 1656 +#define ER_BACKUP_PREPARE_DRIVER 1657 +#define ER_BACKUP_CREATE_VP 1658 +#define ER_BACKUP_UNLOCK_DRIVER 1659 +#define ER_BACKUP_CANCEL_BACKUP 1660 +#define ER_BACKUP_CANCEL_RESTORE 1661 +#define ER_BACKUP_GET_DATA 1662 +#define ER_BACKUP_SEND_DATA 1663 +#define ER_BACKUP_SEND_DATA_RETRY 1664 +#define ER_BACKUP_OPEN_TABLES 1665 +#define ER_BACKUP_THREAD_INIT 1666 +#define ER_BACKUP_PROGRESS_TABLES 1667 +#define ER_TABLESPACE_EXIST 1668 +#define ER_NO_SUCH_TABLESPACE 1669 +#define ER_SLAVE_HEARTBEAT_FAILURE 1670 +#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 1671 +#define ER_BACKUP_CANT_FIND_SE 1672 +#define ER_BACKUP_NO_NATIVE_BE 1673 +#define ER_BACKUP_UNKNOWN_BE 1674 +#define ER_BACKUP_WRONG_TABLE_BE 1675 +#define ER_BACKUP_CANT_RESTORE_DB 1676 +#define ER_BACKUP_CANT_RESTORE_TABLE 1677 +#define ER_BACKUP_CANT_RESTORE_VIEW 1678 +#define ER_BACKUP_CANT_RESTORE_SROUT 1679 +#define ER_BACKUP_CANT_RESTORE_EVENT 1680 +#define ER_BACKUP_CANT_RESTORE_TRIGGER 1681 +#define ER_BACKUP_CATALOG_ADD_DB 1682 +#define ER_BACKUP_CATALOG_ADD_TABLE 1683 +#define ER_BACKUP_CATALOG_ADD_VIEW 1684 +#define ER_BACKUP_CATALOG_ADD_SROUT 1685 +#define ER_BACKUP_CATALOG_ADD_EVENT 1686 +#define ER_BACKUP_CATALOG_ADD_TRIGGER 1687 +#define ER_BACKUP_UNKNOWN_OBJECT 1688 +#define ER_BACKUP_UNKNOWN_OBJECT_TYPE 1689 +#define ER_BACKUP_OPEN_WR 1690 +#define ER_BACKUP_OPEN_RD 1691 +#define ER_BACKUP_BAD_MAGIC 1692 +#define ER_BACKUP_CONTEXT_CREATE 1693 +#define ER_BACKUP_CONTEXT_REMOVE 1694 +#define ER_BAD_PATH 1695 +#define ER_DDL_BLOCK 1696 +#define ER_BACKUP_LOGGER_INIT 1697 +#define ER_BACKUP_WRITE_SUMMARY 1698 +#define ER_BACKUP_READ_SUMMARY 1699 +#define ER_BACKUP_GET_META_DB 1700 +#define ER_BACKUP_GET_META_TABLE 1701 +#define ER_BACKUP_GET_META_VIEW 1702 +#define ER_BACKUP_GET_META_SROUT 1703 +#define ER_BACKUP_GET_META_EVENT 1704 +#define ER_BACKUP_GET_META_TRIGGER 1705 +#define ER_BACKUP_CREATE_BE 1706 +#define ER_BACKUP_LIST_PERDB 1707 +#define ER_BACKUP_LIST_DB_VIEWS 1708 +#define ER_BACKUP_LIST_DB_SROUT 1709 +#define ER_BACKUP_LIST_DB_EVENTS 1710 +#define ER_BACKUP_LIST_DB_TRIGGERS 1711 +#define ER_BACKUP_LOG_WRITE_ERROR 1712 +#define ER_TABLESPACE_NOT_EMPTY 1713 +#define ER_BACKUP_CAT_ENUM 1714 +#define ER_BACKUP_CANT_RESTORE_TS 1715 +#define ER_BACKUP_TS_CHANGE 1716 +#define ER_BACKUP_GET_META_TS 1717 +#define ER_TABLESPACE_DATAFILE_EXIST 1718 +#define ER_BACKUP_CATALOG_ADD_TS 1719 +#define ER_DEBUG_SYNC_TIMEOUT 1720 +#define ER_DEBUG_SYNC_HIT_LIMIT 1721 +#define ER_BACKUP_FAILED_TO_INIT_COMPRESSION 1722 +#define ER_BACKUP_OBTAIN_NAME_LOCK_FAILED 1723 +#define ER_BACKUP_RELEASE_NAME_LOCK_FAILED 1724 +#define ER_BACKUP_BACKUPDIR 1725 +#define ER_ERROR_LAST 1725 diff --git a/externals/mysql/mysys/array.c b/externals/mysql/mysys/array.c new file mode 100644 index 0000000..b312603 --- /dev/null +++ b/externals/mysql/mysys/array.c @@ -0,0 +1,379 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Handling of arrays that can grow dynamicly. */ + +#include "mysys_priv.h" +#include "m_string.h" + +/* + Initiate dynamic array + + SYNOPSIS + init_dynamic_array2() + array Pointer to an array + element_size Size of element + init_buffer Initial buffer pointer + init_alloc Number of initial elements + alloc_increment Increment for adding new elements + + DESCRIPTION + init_dynamic_array() initiates array and allocate space for + init_alloc eilements. + Array is usable even if space allocation failed. + Static buffers must begin immediately after the array structure. + + RETURN VALUE + TRUE my_malloc_ci() failed + FALSE Ok +*/ + +my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, + void *init_buffer, uint init_alloc, + uint alloc_increment CALLER_INFO_PROTO) +{ + DBUG_ENTER("init_dynamic_array"); + if (!alloc_increment) + { + alloc_increment=max((8192-MALLOC_OVERHEAD)/element_size,16); + if (init_alloc > 8 && alloc_increment > init_alloc * 2) + alloc_increment=init_alloc*2; + } + array->elements=0; + array->max_element=init_alloc; + array->alloc_increment=alloc_increment; + array->size_of_element=element_size; + if ((array->buffer= init_buffer)) + DBUG_RETURN(FALSE); + if (init_alloc && + !(array->buffer=(uchar*) my_malloc_ci(element_size*init_alloc, + MYF(MY_WME)))) + { + array->max_element=0; + DBUG_RETURN(TRUE); + } + DBUG_RETURN(FALSE); +} + +my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, + uint init_alloc, + uint alloc_increment CALLER_INFO_PROTO) +{ + /* placeholder to preserve ABI */ + return my_init_dynamic_array_ci(array, element_size, init_alloc, + alloc_increment); +} +/* + Insert element at the end of array. Allocate memory if needed. + + SYNOPSIS + insert_dynamic() + array + element + + RETURN VALUE + TRUE Insert failed + FALSE Ok +*/ + +my_bool insert_dynamic(DYNAMIC_ARRAY *array, const uchar* element) +{ + uchar* buffer; + if (array->elements == array->max_element) + { /* Call only when nessesary */ + if (!(buffer=alloc_dynamic(array))) + return TRUE; + } + else + { + buffer=array->buffer+(array->elements * array->size_of_element); + array->elements++; + } + memcpy(buffer,element,(size_t) array->size_of_element); + return FALSE; +} + + +/* + Alloc space for next element(s) + + SYNOPSIS + alloc_dynamic() + array + + DESCRIPTION + alloc_dynamic() checks if there is empty space for at least + one element if not tries to allocate space for alloc_increment + elements at the end of array. + + RETURN VALUE + pointer Pointer to empty space for element + 0 Error +*/ + +uchar *alloc_dynamic(DYNAMIC_ARRAY *array) +{ + DBUG_ENTER("alloc_dynamic"); + if (array->elements == array->max_element) + { + char *new_ptr; + if (array->buffer == (uchar *)(array + 1)) + { + /* + In this senerio, the buffer is statically preallocated, + so we have to create an all-new malloc since we overflowed + */ + if (!(new_ptr= (char *) my_malloc((array->max_element+ + array->alloc_increment) * + array->size_of_element, + MYF(MY_WME)))) + DBUG_RETURN(0); + memcpy(new_ptr, array->buffer, + array->elements * array->size_of_element); + } + else if (!(new_ptr=(char*) + my_realloc(array->buffer,(array->max_element+ + array->alloc_increment)* + array->size_of_element, + MYF(MY_WME | MY_ALLOW_ZERO_PTR)))) + DBUG_RETURN(0); + array->buffer= (uchar*) new_ptr; + array->max_element+=array->alloc_increment; + } + DBUG_RETURN(array->buffer+(array->elements++ * array->size_of_element)); +} + + +/* + Pop last element from array. + + SYNOPSIS + pop_dynamic() + array + + RETURN VALUE + pointer Ok + 0 Array is empty +*/ + +uchar *pop_dynamic(DYNAMIC_ARRAY *array) +{ + if (array->elements) + return array->buffer+(--array->elements * array->size_of_element); + return 0; +} + +/* + Replace element in array with given element and index + + SYNOPSIS + set_dynamic() + array + element Element to be inserted + idx Index where element is to be inserted + + DESCRIPTION + set_dynamic() replaces element in array. + If idx > max_element insert new element. Allocate memory if needed. + + RETURN VALUE + TRUE Idx was out of range and allocation of new memory failed + FALSE Ok +*/ + +my_bool set_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx) +{ + if (idx >= array->elements) + { + if (idx >= array->max_element && allocate_dynamic(array, idx)) + return TRUE; + bzero((uchar*) (array->buffer+array->elements*array->size_of_element), + (idx - array->elements)*array->size_of_element); + array->elements=idx+1; + } + memcpy(array->buffer+(idx * array->size_of_element),element, + (size_t) array->size_of_element); + return FALSE; +} + + +/* + Ensure that dynamic array has enough elements + + SYNOPSIS + allocate_dynamic() + array + max_elements Numbers of elements that is needed + + NOTES + Any new allocated element are NOT initialized + + RETURN VALUE + FALSE Ok + TRUE Allocation of new memory failed +*/ + +my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements) +{ + DBUG_ENTER("allocate_dynamic"); + + if (max_elements >= array->max_element) + { + uint size; + uchar *new_ptr; + size= (max_elements + array->alloc_increment)/array->alloc_increment; + size*= array->alloc_increment; + if (array->buffer == (uchar *)(array + 1)) + { + /* + In this senerio, the buffer is statically preallocated, + so we have to create an all-new malloc since we overflowed + */ + if (!(new_ptr= (uchar *) my_malloc(size * + array->size_of_element, + MYF(MY_WME)))) + DBUG_RETURN(0); + memcpy(new_ptr, array->buffer, + array->elements * array->size_of_element); + } + else if (!(new_ptr= (uchar*) my_realloc(array->buffer,size* + array->size_of_element, + MYF(MY_WME | MY_ALLOW_ZERO_PTR)))) + DBUG_RETURN(TRUE); + array->buffer= new_ptr; + array->max_element= size; + } + DBUG_RETURN(FALSE); +} + + +/* + Get an element from array by given index + + SYNOPSIS + get_dynamic() + array + uchar* Element to be returned. If idx > elements contain zeroes. + idx Index of element wanted. +*/ + +void get_dynamic(DYNAMIC_ARRAY *array, uchar* element, uint idx) +{ + if (idx >= array->elements) + { + DBUG_PRINT("warning",("To big array idx: %d, array size is %d", + idx,array->elements)); + bzero(element,array->size_of_element); + return; + } + memcpy(element,array->buffer+idx*array->size_of_element, + (size_t) array->size_of_element); +} + + +/* + Empty array by freeing all memory + + SYNOPSIS + delete_dynamic() + array Array to be deleted +*/ + +void delete_dynamic(DYNAMIC_ARRAY *array) +{ + /* + Just mark as empty if we are using a static buffer + */ + if (array->buffer == (uchar *)(array + 1)) + array->elements= 0; + else + if (array->buffer) + { + my_free(array->buffer,MYF(MY_WME)); + array->buffer=0; + array->elements=array->max_element=0; + } +} + +/* + Delete element by given index + + SYNOPSIS + delete_dynamic_element() + array + idx Index of element to be deleted +*/ + +void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx) +{ + char *ptr= (char*) array->buffer+array->size_of_element*idx; + array->elements--; + memmove(ptr,ptr+array->size_of_element, + (array->elements-idx)*array->size_of_element); +} + + +/* + Free unused memory + + SYNOPSIS + freeze_size() + array Array to be freed + +*/ + +void freeze_size(DYNAMIC_ARRAY *array) +{ + uint elements=max(array->elements,1); + + /* + Do nothing if we are using a static buffer + */ + if (array->buffer == (uchar *)(array + 1)) + return; + + if (array->buffer && array->max_element != elements) + { + array->buffer=(uchar*) my_realloc(array->buffer, + elements*array->size_of_element, + MYF(MY_WME)); + array->max_element=elements; + } +} + + +/* + Get the index of a dynamic element + + SYNOPSIS + get_index_dynamic() + array Array + element Whose element index + +*/ + +int get_index_dynamic(DYNAMIC_ARRAY *array, uchar* element) +{ + uint ret; + if (array->buffer > element) + return -1; + + ret= (element - array->buffer) / array->size_of_element; + if (ret > array->elements) + return -1; + + return ret; + +} diff --git a/externals/mysql/mysys/base64.c b/externals/mysql/mysys/base64.c new file mode 100644 index 0000000..7e69ab5 --- /dev/null +++ b/externals/mysql/mysys/base64.c @@ -0,0 +1,311 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include /* strchr() */ +#include /* my_isspace() */ +#include + +#ifndef MAIN + +static char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + + +int +my_base64_needed_encoded_length(int length_of_data) +{ + int nb_base64_chars; + nb_base64_chars= (length_of_data + 2) / 3 * 4; + + return + nb_base64_chars + /* base64 char incl padding */ + (nb_base64_chars - 1)/ 76 + /* newlines */ + 1; /* NUL termination of string */ +} + + +int +my_base64_needed_decoded_length(int length_of_encoded_data) +{ + return (int) ceil(length_of_encoded_data * 3 / 4); +} + + +/* + Encode a data as base64. + + Note: We require that dst is pre-allocated to correct size. + See my_base64_needed_encoded_length(). +*/ + +int +my_base64_encode(const void *src, size_t src_len, char *dst) +{ + const unsigned char *s= (const unsigned char*)src; + size_t i= 0; + size_t len= 0; + + for (; i < src_len; len += 4) + { + unsigned c; + + if (len == 76) + { + len= 0; + *dst++= '\n'; + } + + c= s[i++]; + c <<= 8; + + if (i < src_len) + c += s[i]; + c <<= 8; + i++; + + if (i < src_len) + c += s[i]; + i++; + + *dst++= base64_table[(c >> 18) & 0x3f]; + *dst++= base64_table[(c >> 12) & 0x3f]; + + if (i > (src_len + 1)) + *dst++= '='; + else + *dst++= base64_table[(c >> 6) & 0x3f]; + + if (i > src_len) + *dst++= '='; + else + *dst++= base64_table[(c >> 0) & 0x3f]; + } + *dst= '\0'; + + return 0; +} + + +static inline uint +pos(unsigned char c) +{ + return (uint) (strchr(base64_table, c) - base64_table); +} + + +#define SKIP_SPACE(src, i, size) \ +{ \ + while (i < size && my_isspace(&my_charset_latin1, * src)) \ + { \ + i++; \ + src++; \ + } \ + if (i == size) \ + { \ + break; \ + } \ +} + + +/* + Decode a base64 string + + SYNOPSIS + base64_decode() + src Pointer to base64-encoded string + len Length of string at 'src' + dst Pointer to location where decoded data will be stored + end_ptr Pointer to variable that will refer to the character + after the end of the encoded data that were decoded. Can + be NULL. + + DESCRIPTION + + The base64-encoded data in the range ['src','*end_ptr') will be + decoded and stored starting at 'dst'. The decoding will stop + after 'len' characters have been read from 'src', or when padding + occurs in the base64-encoded data. In either case: if 'end_ptr' is + non-null, '*end_ptr' will be set to point to the character after + the last read character, even in the presence of error. + + NOTE + We require that 'dst' is pre-allocated to correct size. + + SEE ALSO + my_base64_needed_decoded_length(). + + RETURN VALUE + Number of bytes written at 'dst' or -1 in case of failure +*/ +int +my_base64_decode(const char *src_base, size_t len, + void *dst, const char **end_ptr) +{ + char b[3]; + size_t i= 0; + char *dst_base= (char *)dst; + char const *src= src_base; + char *d= dst_base; + size_t j; + + while (i < len) + { + unsigned c= 0; + size_t mark= 0; + + SKIP_SPACE(src, i, len); + + c += pos(*src++); + c <<= 6; + i++; + + SKIP_SPACE(src, i, len); + + c += pos(*src++); + c <<= 6; + i++; + + SKIP_SPACE(src, i, len); + + if (*src != '=') + c += pos(*src++); + else + { + src += 2; /* There should be two bytes padding */ + i= len; + mark= 2; + c <<= 6; + goto end; + } + c <<= 6; + i++; + + SKIP_SPACE(src, i, len); + + if (*src != '=') + c += pos(*src++); + else + { + src += 1; /* There should be one byte padding */ + i= len; + mark= 1; + goto end; + } + i++; + + end: + b[0]= (c >> 16) & 0xff; + b[1]= (c >> 8) & 0xff; + b[2]= (c >> 0) & 0xff; + + for (j=0; j<3-mark; j++) + *d++= b[j]; + } + + if (end_ptr != NULL) + *end_ptr= src; + + /* + The variable 'i' is set to 'len' when padding has been read, so it + does not actually reflect the number of bytes read from 'src'. + */ + return i != len ? -1 : (int) (d - dst_base); +} + + +#else /* MAIN */ + +#define require(b) { \ + if (!(b)) { \ + printf("Require failed at %s:%d\n", __FILE__, __LINE__); \ + abort(); \ + } \ +} + + +int +main(void) +{ + int i; + size_t j; + size_t k, l; + size_t dst_len; + size_t needed_length; + + for (i= 0; i < 500; i++) + { + /* Create source data */ + const size_t src_len= rand() % 1000 + 1; + + char * src= (char *) malloc(src_len); + char * s= src; + char * str; + char * dst; + + require(src); + for (j= 0; jname; cs++) + add_compiled_collation(cs); + + return FALSE; +} diff --git a/externals/mysql/mysys/charset.c b/externals/mysql/mysys/charset.c new file mode 100644 index 0000000..a327b24 --- /dev/null +++ b/externals/mysql/mysys/charset.c @@ -0,0 +1,915 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include +#include +#include + + +/* + The code below implements this functionality: + + - Initializing charset related structures + - Loading dynamic charsets + - Searching for a proper CHARSET_INFO + using charset name, collation name or collation ID + - Setting server default character set +*/ + +my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2) +{ + return ((cs1 == cs2) || !strcmp(cs1->csname,cs2->csname)); +} + + +static uint +get_collation_number_internal(const char *name) +{ + CHARSET_INFO **cs; + for (cs= all_charsets; + cs < all_charsets + array_elements(all_charsets); + cs++) + { + if ( cs[0] && cs[0]->name && + !my_strcasecmp(&my_charset_latin1, cs[0]->name, name)) + return cs[0]->number; + } + return 0; +} + + +static my_bool init_state_maps(CHARSET_INFO *cs) +{ + uint i; + uchar *state_map; + uchar *ident_map; + + if (!(cs->state_map= (uchar*) my_once_alloc(256, MYF(MY_WME)))) + return 1; + + if (!(cs->ident_map= (uchar*) my_once_alloc(256, MYF(MY_WME)))) + return 1; + + state_map= cs->state_map; + ident_map= cs->ident_map; + + /* Fill state_map with states to get a faster parser */ + for (i=0; i < 256 ; i++) + { + if (my_isalpha(cs,i)) + state_map[i]=(uchar) MY_LEX_IDENT; + else if (my_isdigit(cs,i)) + state_map[i]=(uchar) MY_LEX_NUMBER_IDENT; +#if defined(USE_MB) && defined(USE_MB_IDENT) + else if (my_mbcharlen(cs, i)>1) + state_map[i]=(uchar) MY_LEX_IDENT; +#endif + else if (my_isspace(cs,i)) + state_map[i]=(uchar) MY_LEX_SKIP; + else + state_map[i]=(uchar) MY_LEX_CHAR; + } + state_map[(uchar)'_']=state_map[(uchar)'$']=(uchar) MY_LEX_IDENT; + state_map[(uchar)'\'']=(uchar) MY_LEX_STRING; + state_map[(uchar)'.']=(uchar) MY_LEX_REAL_OR_POINT; + state_map[(uchar)'>']=state_map[(uchar)'=']=state_map[(uchar)'!']= (uchar) MY_LEX_CMP_OP; + state_map[(uchar)'<']= (uchar) MY_LEX_LONG_CMP_OP; + state_map[(uchar)'&']=state_map[(uchar)'|']=(uchar) MY_LEX_BOOL; + state_map[(uchar)'#']=(uchar) MY_LEX_COMMENT; + state_map[(uchar)';']=(uchar) MY_LEX_SEMICOLON; + state_map[(uchar)':']=(uchar) MY_LEX_SET_VAR; + state_map[0]=(uchar) MY_LEX_EOL; + state_map[(uchar)'\\']= (uchar) MY_LEX_ESCAPE; + state_map[(uchar)'/']= (uchar) MY_LEX_LONG_COMMENT; + state_map[(uchar)'*']= (uchar) MY_LEX_END_LONG_COMMENT; + state_map[(uchar)'@']= (uchar) MY_LEX_USER_END; + state_map[(uchar) '`']= (uchar) MY_LEX_USER_VARIABLE_DELIMITER; + state_map[(uchar)'"']= (uchar) MY_LEX_STRING_OR_DELIMITER; + + /* + Create a second map to make it faster to find identifiers + */ + for (i=0; i < 256 ; i++) + { + ident_map[i]= (uchar) (state_map[i] == MY_LEX_IDENT || + state_map[i] == MY_LEX_NUMBER_IDENT); + } + + /* Special handling of hex and binary strings */ + state_map[(uchar)'x']= state_map[(uchar)'X']= (uchar) MY_LEX_IDENT_OR_HEX; + state_map[(uchar)'b']= state_map[(uchar)'B']= (uchar) MY_LEX_IDENT_OR_BIN; + state_map[(uchar)'n']= state_map[(uchar)'N']= (uchar) MY_LEX_IDENT_OR_NCHAR; + return 0; +} + + +static void simple_cs_init_functions(CHARSET_INFO *cs) +{ + if (cs->state & MY_CS_BINSORT) + cs->coll= &my_collation_8bit_bin_handler; + else + cs->coll= &my_collation_8bit_simple_ci_handler; + + cs->cset= &my_charset_8bit_handler; +} + + + +static int cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) +{ + to->number= from->number ? from->number : to->number; + + if (from->csname) + if (!(to->csname= my_once_strdup(from->csname,MYF(MY_WME)))) + goto err; + + if (from->name) + if (!(to->name= my_once_strdup(from->name,MYF(MY_WME)))) + goto err; + + if (from->comment) + if (!(to->comment= my_once_strdup(from->comment,MYF(MY_WME)))) + goto err; + + if (from->ctype) + { + if (!(to->ctype= (uchar*) my_once_memdup((char*) from->ctype, + MY_CS_CTYPE_TABLE_SIZE, + MYF(MY_WME)))) + goto err; + if (init_state_maps(to)) + goto err; + } + if (from->to_lower) + if (!(to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower, + MY_CS_TO_LOWER_TABLE_SIZE, + MYF(MY_WME)))) + goto err; + + if (from->to_upper) + if (!(to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper, + MY_CS_TO_UPPER_TABLE_SIZE, + MYF(MY_WME)))) + goto err; + if (from->sort_order) + { + if (!(to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order, + MY_CS_SORT_ORDER_TABLE_SIZE, + MYF(MY_WME)))) + goto err; + + } + if (from->tab_to_uni) + { + uint sz= MY_CS_TO_UNI_TABLE_SIZE*sizeof(uint16); + if (!(to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni, + sz, MYF(MY_WME)))) + goto err; + } + if (from->tailoring) + if (!(to->tailoring= my_once_strdup(from->tailoring,MYF(MY_WME)))) + goto err; + + return 0; + +err: + return 1; +} + + + +static my_bool simple_cs_is_full(CHARSET_INFO *cs) +{ + return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && + cs->to_lower) && + (cs->number && cs->name && + (cs->sort_order || (cs->state & MY_CS_BINSORT) ))); +} + + +static void +copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from) +{ + to->cset= from->cset; + to->coll= from->coll; + to->strxfrm_multiply= from->strxfrm_multiply; + to->min_sort_char= from->min_sort_char; + to->max_sort_char= from->max_sort_char; + to->mbminlen= from->mbminlen; + to->mbmaxlen= from->mbmaxlen; + to->state|= MY_CS_AVAILABLE | MY_CS_LOADED | + MY_CS_STRNXFRM | MY_CS_UNICODE; +} + + +static int add_collation(CHARSET_INFO *cs) +{ + if (cs->name && (cs->number || + (cs->number=get_collation_number_internal(cs->name)))) + { + if (!all_charsets[cs->number]) + { + if (!(all_charsets[cs->number]= + (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),MYF(0)))) + return MY_XML_ERROR; + bzero((void*)all_charsets[cs->number],sizeof(CHARSET_INFO)); + } + + if (cs->primary_number == cs->number) + cs->state |= MY_CS_PRIMARY; + + if (cs->binary_number == cs->number) + cs->state |= MY_CS_BINSORT; + + all_charsets[cs->number]->state|= cs->state; + + if (!(all_charsets[cs->number]->state & MY_CS_COMPILED)) + { + CHARSET_INFO *newcs= all_charsets[cs->number]; + if (cs_copy_data(all_charsets[cs->number],cs)) + return MY_XML_ERROR; + + newcs->levels_for_compare= 1; + newcs->levels_for_order= 1; + + if (!strcmp(cs->csname,"ucs2") ) + { +#if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS) + copy_uca_collation(newcs, &my_charset_ucs2_unicode_ci); + newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII; +#endif + } + else if (!strcmp(cs->csname, "utf8")) + { +#if defined (HAVE_CHARSET_utf8mb3) && defined(HAVE_UCA_COLLATIONS) + copy_uca_collation(newcs, &my_charset_utf8mb4_unicode_ci); + newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; +#endif + } + else if (!strcmp(cs->csname, "utf8mb3")) + { +#if defined (HAVE_CHARSET_utf8mb3) && defined(HAVE_UCA_COLLATIONS) + copy_uca_collation(newcs, &my_charset_utf8mb3_unicode_ci); + newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; +#endif + } + else if (!strcmp(cs->csname, "utf16")) + { +#if defined (HAVE_CHARSET_utf16) && defined(HAVE_UCA_COLLATIONS) + copy_uca_collation(newcs, &my_charset_utf16_unicode_ci); + newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII; +#endif + } + else if (!strcmp(cs->csname, "utf32")) + { +#if defined (HAVE_CHARSET_utf32) && defined(HAVE_UCA_COLLATIONS) + copy_uca_collation(newcs, &my_charset_utf32_unicode_ci); + newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII; +#endif + } + else + { + uchar *sort_order= all_charsets[cs->number]->sort_order; + simple_cs_init_functions(all_charsets[cs->number]); + newcs->mbminlen= 1; + newcs->mbmaxlen= 1; + if (simple_cs_is_full(all_charsets[cs->number])) + { + all_charsets[cs->number]->state |= MY_CS_LOADED; + } + all_charsets[cs->number]->state|= MY_CS_AVAILABLE; + + /* + Check if case sensitive sort order: A < a < B. + We need MY_CS_FLAG for regex library, and for + case sensitivity flag for 5.0 client protocol, + to support isCaseSensitive() method in JDBC driver + */ + if (sort_order && sort_order['A'] < sort_order['a'] && + sort_order['a'] < sort_order['B']) + all_charsets[cs->number]->state|= MY_CS_CSSORT; + + if (my_charset_is_8bit_pure_ascii(all_charsets[cs->number])) + all_charsets[cs->number]->state|= MY_CS_PUREASCII; + if (!my_charset_is_ascii_compatible(cs)) + all_charsets[cs->number]->state|= MY_CS_NONASCII; + } + } + else + { + /* + We need the below to make get_charset_name() + and get_charset_number() working even if a + character set has not been really incompiled. + The above functions are used for example + in error message compiler extra/comp_err.c. + If a character set was compiled, this information + will get lost and overwritten in add_compiled_collation(). + */ + CHARSET_INFO *dst= all_charsets[cs->number]; + dst->number= cs->number; + if (cs->comment) + if (!(dst->comment= my_once_strdup(cs->comment,MYF(MY_WME)))) + return MY_XML_ERROR; + if (cs->csname && !dst->csname) + if (!(dst->csname= my_once_strdup(cs->csname,MYF(MY_WME)))) + return MY_XML_ERROR; + if (cs->name && !dst->name) + if (!(dst->name= my_once_strdup(cs->name,MYF(MY_WME)))) + return MY_XML_ERROR; + } + cs->number= 0; + cs->primary_number= 0; + cs->binary_number= 0; + cs->name= NULL; + cs->state= 0; + cs->sort_order= NULL; + cs->state= 0; + } + return MY_XML_OK; +} + + +#define MY_MAX_ALLOWED_BUF 1024*1024 +#define MY_CHARSET_INDEX "Index.xml" + +const char *charsets_dir= NULL; +static int charset_initialized=0; + + +static my_bool my_read_charset_file(const char *filename, myf myflags) +{ + uchar *buf; + int fd; + uint len, tmp_len; + MY_STAT stat_info; + + if (!my_stat(filename, &stat_info, MYF(myflags)) || + ((len= (uint)stat_info.st_size) > MY_MAX_ALLOWED_BUF) || + !(buf= (uchar*) my_malloc(len,myflags))) + return TRUE; + + if ((fd=my_open(filename,O_RDONLY,myflags)) < 0) + goto error; + tmp_len=my_read(fd, buf, len, myflags); + my_close(fd,myflags); + if (tmp_len != len) + goto error; + + if (my_parse_charset_xml((char*) buf,len,add_collation)) + { +#ifdef NOT_YET + printf("ERROR at line %d pos %d '%s'\n", + my_xml_error_lineno(&p)+1, + my_xml_error_pos(&p), + my_xml_error_string(&p)); +#endif + } + + my_free(buf, myflags); + return FALSE; + +error: + my_free(buf, myflags); + return TRUE; +} + + +char *get_charsets_dir(char *buf) +{ + const char *sharedir= SHAREDIR; + char *res; + DBUG_ENTER("get_charsets_dir"); + + if (charsets_dir != NULL) + strmake(buf, charsets_dir, FN_REFLEN-1); + else + { + if (test_if_hard_path(sharedir) || + is_prefix(sharedir, DEFAULT_CHARSET_HOME)) + strxmov(buf, sharedir, "/", CHARSET_DIR, NullS); + else + strxmov(buf, DEFAULT_CHARSET_HOME, "/", sharedir, "/", CHARSET_DIR, + NullS); + } + res= convert_dirname(buf,buf,NullS); + DBUG_PRINT("info",("charsets dir: '%s'", buf)); + DBUG_RETURN(res); +} + +CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]; +CHARSET_INFO *default_charset_info = &my_charset_latin1; + +void add_compiled_collation(CHARSET_INFO *cs) +{ + all_charsets[cs->number]= cs; + cs->state|= MY_CS_AVAILABLE; +} + +static void *cs_alloc(size_t size) +{ + return my_once_alloc(size, MYF(MY_WME)); +} + + +#ifdef __NETWARE__ +my_bool STDCALL init_available_charsets(myf myflags) +#else +static my_bool init_available_charsets(myf myflags) +#endif +{ + char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; + my_bool error=FALSE; + /* + We have to use charset_initialized to not lock on THR_LOCK_charset + inside get_internal_charset... + */ + if (!charset_initialized) + { + CHARSET_INFO **cs; + /* + To make things thread safe we are not allowing other threads to interfere + while we may changing the cs_info_table + */ + pthread_mutex_lock(&THR_LOCK_charset); + if (!charset_initialized) + { + bzero(&all_charsets,sizeof(all_charsets)); + init_compiled_charsets(myflags); + + /* Copy compiled charsets */ + for (cs=all_charsets; + cs < all_charsets + array_elements(all_charsets); + cs++) + { + if (*cs) + { + if (cs[0]->ctype) + if (init_state_maps(*cs)) + *cs= NULL; + } + } + + strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); + error= my_read_charset_file(fname,myflags); + charset_initialized=1; + } + pthread_mutex_unlock(&THR_LOCK_charset); + } + return error; +} + + +void free_charsets(void) +{ + charset_initialized=0; +} + + +uint get_collation_number(const char *name) +{ + init_available_charsets(MYF(0)); + return get_collation_number_internal(name); +} + + +uint get_charset_number(const char *charset_name, uint cs_flags) +{ + CHARSET_INFO **cs; + init_available_charsets(MYF(0)); + + for (cs= all_charsets; + cs < all_charsets + array_elements(all_charsets); + cs++) + { + if ( cs[0] && cs[0]->csname && (cs[0]->state & cs_flags) && + !my_strcasecmp(&my_charset_latin1, cs[0]->csname, charset_name)) + return cs[0]->number; + } + return 0; +} + + +const char *get_charset_name(uint charset_number) +{ + CHARSET_INFO *cs; + init_available_charsets(MYF(0)); + + cs=all_charsets[charset_number]; + if (cs && (cs->number == charset_number) && cs->name ) + return (char*) cs->name; + + return (char*) "?"; /* this mimics find_type() */ +} + + +static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) +{ + char buf[FN_REFLEN]; + CHARSET_INFO *cs; + + if ((cs= all_charsets[cs_number])) + { + if (cs->state & MY_CS_READY) /* if CS is already initialized */ + return cs; + + /* + To make things thread safe we are not allowing other threads to interfere + while we may changing the cs_info_table + */ + pthread_mutex_lock(&THR_LOCK_charset); + + if (!(cs->state & (MY_CS_COMPILED|MY_CS_LOADED))) /* if CS is not in memory */ + { + strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS); + my_read_charset_file(buf,flags); + } + + if (cs->state & MY_CS_AVAILABLE) + { + if (!(cs->state & MY_CS_READY)) + { + if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) || + (cs->coll->init && cs->coll->init(cs, cs_alloc))) + cs= NULL; + else + cs->state|= MY_CS_READY; + } + } + else + cs= NULL; + + pthread_mutex_unlock(&THR_LOCK_charset); + } + return cs; +} + + +CHARSET_INFO *get_charset(uint cs_number, myf flags) +{ + CHARSET_INFO *cs; + if (cs_number == default_charset_info->number) + return default_charset_info; + + (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ + + if (!cs_number || cs_number > array_elements(all_charsets)) + return NULL; + + cs=get_internal_charset(cs_number, flags); + + if (!cs && (flags & MY_WME)) + { + char index_file[FN_REFLEN + sizeof(MY_CHARSET_INDEX)], cs_string[23]; + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); + cs_string[0]='#'; + int10_to_str(cs_number, cs_string+1, 10); + my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_string, index_file); + } + return cs; +} + +CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) +{ + uint cs_number; + CHARSET_INFO *cs; + (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ + + cs_number=get_collation_number(cs_name); + cs= cs_number ? get_internal_charset(cs_number,flags) : NULL; + + if (!cs && (flags & MY_WME)) + { + char index_file[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); + my_error(EE_UNKNOWN_COLLATION, MYF(ME_BELL), cs_name, index_file); + } + + return cs; +} + + +CHARSET_INFO *get_charset_by_csname(const char *cs_name, + uint cs_flags, + myf flags) +{ + uint cs_number; + CHARSET_INFO *cs; + DBUG_ENTER("get_charset_by_csname"); + DBUG_PRINT("enter",("name: '%s'", cs_name)); + + (void) init_available_charsets(MYF(0)); /* If it isn't initialized */ + + cs_number= get_charset_number(cs_name, cs_flags); + cs= cs_number ? get_internal_charset(cs_number, flags) : NULL; + + if (!cs && (flags & MY_WME)) + { + char index_file[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; + strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); + my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); + } + + DBUG_RETURN(cs); +} + + +/** + Resolve character set by the character set name (utf8, latin1, ...). + + The function tries to resolve character set by the specified name. If + there is character set with the given name, it is assigned to the "cs" + parameter and FALSE is returned. If there is no such character set, + "default_cs" is assigned to the "cs" and TRUE is returned. + + @param[in] cs_name Character set name. + @param[in] default_cs Default character set. + @param[out] cs Variable to store character set. + + @return FALSE if character set was resolved successfully; TRUE if there + is no character set with given name. +*/ + +my_bool resolve_charset(const char *cs_name, + CHARSET_INFO *default_cs, + CHARSET_INFO **cs) +{ + *cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0)); + + if (*cs == NULL) + { + *cs= default_cs; + return TRUE; + } + + return FALSE; +} + + +/** + Resolve collation by the collation name (utf8_general_ci, ...). + + The function tries to resolve collation by the specified name. If there + is collation with the given name, it is assigned to the "cl" parameter + and FALSE is returned. If there is no such collation, "default_cl" is + assigned to the "cl" and TRUE is returned. + + @param[out] cl Variable to store collation. + @param[in] cl_name Collation name. + @param[in] default_cl Default collation. + + @return FALSE if collation was resolved successfully; TRUE if there is no + collation with given name. +*/ + +my_bool resolve_collation(const char *cl_name, + CHARSET_INFO *default_cl, + CHARSET_INFO **cl) +{ + *cl= get_charset_by_name(cl_name, MYF(0)); + + if (*cl == NULL) + { + *cl= default_cl; + return TRUE; + } + + return FALSE; +} + + +/* + Escape string with backslashes (\) + + SYNOPSIS + escape_string_for_mysql() + charset_info Charset of the strings + to Buffer for escaped string + to_length Length of destination buffer, or 0 + from The string to escape + length The length of the string to escape + + DESCRIPTION + This escapes the contents of a string by adding backslashes before special + characters, and turning others into specific escape sequences, such as + turning newlines into \n and null bytes into \0. + + NOTE + To maintain compatibility with the old C API, to_length may be 0 to mean + "big enough" + + RETURN VALUES + (size_t) -1 The escaped string did not fit in the to buffer + # The length of the escaped string +*/ + +size_t escape_string_for_mysql(CHARSET_INFO *charset_info, + char *to, size_t to_length, + const char *from, size_t length) +{ + const char *to_start= to; + const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length); + my_bool overflow= FALSE; +#ifdef USE_MB + my_bool use_mb_flag= use_mb(charset_info); +#endif + for (end= from + length; from < end; from++) + { + char escape= 0; +#ifdef USE_MB + int tmp_length; + if (use_mb_flag && (tmp_length= my_ismbchar(charset_info, from, end))) + { + if (to + tmp_length > to_end) + { + overflow= TRUE; + break; + } + while (tmp_length--) + *to++= *from++; + from--; + continue; + } + /* + If the next character appears to begin a multi-byte character, we + escape that first byte of that apparent multi-byte character. (The + character just looks like a multi-byte character -- if it were actually + a multi-byte character, it would have been passed through in the test + above.) + + Without this check, we can create a problem by converting an invalid + multi-byte character into a valid one. For example, 0xbf27 is not + a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \) + */ + if (use_mb_flag && (tmp_length= my_mbcharlen(charset_info, *from)) > 1) + escape= *from; + else +#endif + switch (*from) { + case 0: /* Must be escaped for 'mysql' */ + escape= '0'; + break; + case '\n': /* Must be escaped for logs */ + escape= 'n'; + break; + case '\r': + escape= 'r'; + break; + case '\\': + escape= '\\'; + break; + case '\'': + escape= '\''; + break; + case '"': /* Better safe than sorry */ + escape= '"'; + break; + case '\032': /* This gives problems on Win32 */ + escape= 'Z'; + break; + } + if (escape) + { + if (to + 2 > to_end) + { + overflow= TRUE; + break; + } + *to++= '\\'; + *to++= escape; + } + else + { + if (to + 1 > to_end) + { + overflow= TRUE; + break; + } + *to++= *from; + } + } + *to= 0; + return overflow ? (size_t) -1 : (size_t) (to - to_start); +} + + +#ifdef BACKSLASH_MBTAIL +static CHARSET_INFO *fs_cset_cache= NULL; + +CHARSET_INFO *fs_character_set() +{ + if (!fs_cset_cache) + { + char buf[10]= "cp"; + GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, + buf+2, sizeof(buf)-3); + /* + We cannot call get_charset_by_name here + because fs_character_set() is executed before + LOCK_THD_charset mutex initialization, which + is used inside get_charset_by_name. + As we're now interested in cp932 only, + let's just detect it using strcmp(). + */ + fs_cset_cache= !strcmp(buf, "cp932") ? + &my_charset_cp932_japanese_ci : &my_charset_bin; + } + return fs_cset_cache; +} +#endif + +/* + Escape apostrophes by doubling them up + + SYNOPSIS + escape_quotes_for_mysql() + charset_info Charset of the strings + to Buffer for escaped string + to_length Length of destination buffer, or 0 + from The string to escape + length The length of the string to escape + + DESCRIPTION + This escapes the contents of a string by doubling up any apostrophes that + it contains. This is used when the NO_BACKSLASH_ESCAPES SQL_MODE is in + effect on the server. + + NOTE + To be consistent with escape_string_for_mysql(), to_length may be 0 to + mean "big enough" + + RETURN VALUES + ~0 The escaped string did not fit in the to buffer + >=0 The length of the escaped string +*/ + +size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, + char *to, size_t to_length, + const char *from, size_t length) +{ + const char *to_start= to; + const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length); + my_bool overflow= FALSE; +#ifdef USE_MB + my_bool use_mb_flag= use_mb(charset_info); +#endif + for (end= from + length; from < end; from++) + { +#ifdef USE_MB + int tmp_length; + if (use_mb_flag && (tmp_length= my_ismbchar(charset_info, from, end))) + { + if (to + tmp_length > to_end) + { + overflow= TRUE; + break; + } + while (tmp_length--) + *to++= *from++; + from--; + continue; + } + /* + We don't have the same issue here with a non-multi-byte character being + turned into a multi-byte character by the addition of an escaping + character, because we are only escaping the ' character with itself. + */ +#endif + if (*from == '\'') + { + if (to + 2 > to_end) + { + overflow= TRUE; + break; + } + *to++= '\''; + *to++= '\''; + } + else + { + if (to + 1 > to_end) + { + overflow= TRUE; + break; + } + *to++= *from; + } + } + *to= 0; + return overflow ? (ulong)~0 : (ulong) (to - to_start); +} diff --git a/externals/mysql/mysys/checksum.c b/externals/mysql/mysys/checksum.c new file mode 100644 index 0000000..1d264b5 --- /dev/null +++ b/externals/mysql/mysys/checksum.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include +#include +#include + +ha_checksum my_crc_dbug_check= 1; /* Unlikely number */ + +/* + Calculate a long checksum for a memoryblock. + + SYNOPSIS + my_checksum() + crc start value for crc + pos pointer to memory block + length length of the block +*/ + +ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length) +{ + crc= (ha_checksum) crc32((uint)crc, pos, length); + DBUG_PRINT("info", ("crc: %lu", (ulong) crc)); + if (crc == my_crc_dbug_check) + my_debug_put_break_here(); + return crc; +} diff --git a/externals/mysql/mysys/default.c b/externals/mysql/mysys/default.c new file mode 100644 index 0000000..5e440b4 --- /dev/null +++ b/externals/mysql/mysys/default.c @@ -0,0 +1,1172 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/**************************************************************************** + Add all options from files named "group".cnf from the default_directories + before the command line arguments. + On Windows defaults will also search in the Windows directory for a file + called 'group'.ini + As long as the program uses the last argument for conflicting + options one only have to add a call to "load_defaults" to enable + use of default values. + pre- and end 'blank space' are removed from options and values. The + following escape sequences are recognized in values: \b \t \n \r \\ + + The following arguments are handled automaticly; If used, they must be + first argument on the command line! + --no-defaults ; no options are read. + --defaults-file=full-path-to-default-file ; Only this file will be read. + --defaults-extra-file=full-path-to-default-file ; Read this file before ~/ + --defaults-group-suffix ; Also read groups with concat(group, suffix) + --print-defaults ; Print the modified command line and exit +****************************************************************************/ + +#include "mysys_priv.h" +#include "m_string.h" +#include "m_ctype.h" +#include +#ifdef __WIN__ +#include +#endif + +/** + arguments separator + + load_defaults() loads arguments from config file and put them + before the arguments from command line, this separator is used to + separate the arguments loaded from config file and arguments user + provided on command line. + + Options with value loaded from config file are always in the form + '--option=value', while for command line options, the value can be + given as the next argument. Thus we used a separator so that + handle_options() can distinguish them. + + Note: any other places that does not need to distinguish them + should skip the separator. + + The content of arguments separator does not matter, one should only + check the pointer, use "----args-separator----" here to ease debug + if someone misused it. + + See BUG#25192 +*/ +const char *args_separator= "----args-separator----"; +const char *my_defaults_file=0; +const char *my_defaults_group_suffix=0; +char *my_defaults_extra_file=0; + +/* Which directories are searched for options (and in which order) */ + +#define MAX_DEFAULT_DIRS 6 +#define DEFAULT_DIRS_SIZE (MAX_DEFAULT_DIRS + 1) /* Terminate with NULL */ +static const char **default_directories = NULL; + +#ifdef __WIN__ +static const char *f_extensions[]= { ".ini", ".cnf", 0 }; +#define NEWLINE "\r\n" +#else +static const char *f_extensions[]= { ".cnf", 0 }; +#define NEWLINE "\n" +#endif + +static int handle_default_option(void *in_ctx, const char *group_name, + const char *option); + +/* + This structure defines the context that we pass to callback + function 'handle_default_option' used in search_default_file + to process each option. This context is used if search_default_file + was called from load_defaults. +*/ + +struct handle_option_ctx +{ + MEM_ROOT *alloc; + DYNAMIC_ARRAY *args; + TYPELIB *group; +}; + +static int search_default_file(Process_option_func func, void *func_ctx, + const char *dir, const char *config_file); +static int search_default_file_with_ext(Process_option_func func, + void *func_ctx, + const char *dir, const char *ext, + const char *config_file, int recursion_level); + + +/** + Create the list of default directories. + + @param alloc MEM_ROOT where the list of directories is stored + + @details + The directories searched, in order, are: + - Windows: GetSystemWindowsDirectory() + - Windows: GetWindowsDirectory() + - Windows: C:/ + - Windows: Directory above where the executable is located + - Netware: sys:/etc/ + - Unix: /etc/ + - Unix: /etc/mysql/ + - Unix: --sysconfdir= (compile-time option) + - ALL: getenv(DEFAULT_HOME_ENV) + - ALL: --defaults-extra-file= (run-time option) + - Unix: ~/ + + On all systems, if a directory is already in the list, it will be moved + to the end of the list. This avoids reading defaults files multiple times, + while ensuring the correct precedence. + + @retval NULL Failure (out of memory, probably) + @retval other Pointer to NULL-terminated array of default directories +*/ + +static const char **init_default_directories(MEM_ROOT *alloc); + + +static char *remove_end_comment(char *ptr); + + +/* + Process config files in default directories. + + SYNOPSIS + my_search_option_files() + conf_file Basename for configuration file to search for. + If this is a path, then only this file is read. + argc Pointer to argc of original program + argv Pointer to argv of original program + args_used Pointer to variable for storing the number of + arguments used. + func Pointer to the function to process options + func_ctx It's context. Usually it is the structure to + store additional options. + DESCRIPTION + Process the default options from argc & argv + Read through each found config file looks and calls 'func' to process + each option. + + NOTES + --defaults-group-suffix is only processed if we are called from + load_defaults(). + + + RETURN + 0 ok + 1 given cinf_file doesn't exist + 2 out of memory + + The global variable 'my_defaults_group_suffix' is updated with value for + --defaults_group_suffix +*/ + +int my_search_option_files(const char *conf_file, int *argc, char ***argv, + uint *args_used, Process_option_func func, + void *func_ctx, const char **default_directories) +{ + const char **dirs, *forced_default_file, *forced_extra_defaults; + int error= 0; + DBUG_ENTER("my_search_option_files"); + + /* Check if we want to force the use a specific default file */ + *args_used+= get_defaults_options(*argc - *args_used, *argv + *args_used, + (char **) &forced_default_file, + (char **) &forced_extra_defaults, + (char **) &my_defaults_group_suffix); + + if (! my_defaults_group_suffix) + my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV)); + + if (forced_extra_defaults) + my_defaults_extra_file= (char *) forced_extra_defaults; + + if (forced_default_file) + my_defaults_file= forced_default_file; + + /* + We can only handle 'defaults-group-suffix' if we are called from + load_defaults() as otherwise we can't know the type of 'func_ctx' + */ + + if (my_defaults_group_suffix && func == handle_default_option) + { + /* Handle --defaults-group-suffix= */ + uint i; + const char **extra_groups; + const size_t instance_len= strlen(my_defaults_group_suffix); + struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx; + char *ptr; + TYPELIB *group= ctx->group; + + if (!(extra_groups= + (const char**)alloc_root(ctx->alloc, + (2*group->count+1)*sizeof(char*)))) + DBUG_RETURN(2); + + for (i= 0; i < group->count; i++) + { + size_t len; + extra_groups[i]= group->type_names[i]; /** copy group */ + + len= strlen(extra_groups[i]); + if (!(ptr= alloc_root(ctx->alloc, (uint) (len+instance_len+1)))) + DBUG_RETURN(2); + + extra_groups[i+group->count]= ptr; + + /** Construct new group */ + memcpy(ptr, extra_groups[i], len); + memcpy(ptr+len, my_defaults_group_suffix, instance_len+1); + } + + group->count*= 2; + group->type_names= extra_groups; + group->type_names[group->count]= 0; + } + + if (forced_default_file) + { + if ((error= search_default_file_with_ext(func, func_ctx, "", "", + forced_default_file, 0)) < 0) + goto err; + if (error > 0) + { + fprintf(stderr, "Could not open required defaults file: %s\n", + forced_default_file); + goto err; + } + } + else if (dirname_length(conf_file)) + { + if ((error= search_default_file(func, func_ctx, NullS, conf_file)) < 0) + goto err; + } + else + { + for (dirs= default_directories ; *dirs; dirs++) + { + if (**dirs) + { + if (search_default_file(func, func_ctx, *dirs, conf_file) < 0) + goto err; + } + else if (my_defaults_extra_file) + { + if ((error= search_default_file_with_ext(func, func_ctx, "", "", + my_defaults_extra_file, 0)) < 0) + goto err; /* Fatal error */ + if (error > 0) + { + fprintf(stderr, "Could not open required defaults file: %s\n", + my_defaults_extra_file); + goto err; + } + } + } + } + + DBUG_RETURN(0); + +err: + fprintf(stderr,"Fatal error in defaults handling. Program aborted\n"); + DBUG_RETURN(1); +} + + +/* + The option handler for load_defaults. + + SYNOPSIS + handle_deault_option() + in_ctx Handler context. In this case it is a + handle_option_ctx structure. + group_name The name of the group the option belongs to. + option The very option to be processed. It is already + prepared to be used in argv (has -- prefix). If it + is NULL, we are handling a new group (section). + + DESCRIPTION + This handler checks whether a group is one of the listed and adds an option + to the array if yes. Some other handler can record, for instance, all + groups and their options, not knowing in advance the names and amount of + groups. + + RETURN + 0 - ok + 1 - error occured +*/ + +static int handle_default_option(void *in_ctx, const char *group_name, + const char *option) +{ + char *tmp; + struct handle_option_ctx *ctx= (struct handle_option_ctx *) in_ctx; + + if (!option) + return 0; + + if (find_type((char *)group_name, ctx->group, 3)) + { + if (!(tmp= alloc_root(ctx->alloc, strlen(option) + 1))) + return 1; + if (insert_dynamic(ctx->args, (uchar*) &tmp)) + return 1; + strmov(tmp, option); + } + + return 0; +} + + +/* + Gets options from the command line + + SYNOPSIS + get_defaults_options() + argc Pointer to argc of original program + argv Pointer to argv of original program + defaults --defaults-file option + extra_defaults --defaults-extra-file option + + RETURN + # Number of arguments used from *argv + defaults and extra_defaults will be set to option of the appropriate + items of argv array, or to NULL if there are no such options +*/ + +int get_defaults_options(int argc, char **argv, + char **defaults, + char **extra_defaults, + char **group_suffix) +{ + int org_argc= argc, prev_argc= 0; + *defaults= *extra_defaults= *group_suffix= 0; + + while (argc >= 2 && argc != prev_argc) + { + /* Skip program name or previously handled argument */ + argv++; + prev_argc= argc; /* To check if we found */ + if (!*defaults && is_prefix(*argv,"--defaults-file=")) + { + *defaults= *argv + sizeof("--defaults-file=")-1; + argc--; + continue; + } + if (!*extra_defaults && is_prefix(*argv,"--defaults-extra-file=")) + { + *extra_defaults= *argv + sizeof("--defaults-extra-file=")-1; + argc--; + continue; + } + if (!*group_suffix && is_prefix(*argv, "--defaults-group-suffix=")) + { + *group_suffix= *argv + sizeof("--defaults-group-suffix=")-1; + argc--; + continue; + } + } + return org_argc - argc; +} + +/* + Wrapper around my_load_defaults() for interface compatibility. + + SYNOPSIS + load_defaults() + conf_file Basename for configuration file to search for. + If this is a path, then only this file is read. + groups Which [group] entrys to read. + Points to an null terminated array of pointers + argc Pointer to argc of original program + argv Pointer to argv of original program + + NOTES + + This function is NOT thread-safe as it uses a global pointer internally. + See also notes for my_load_defaults(). + + RETURN + 0 ok + 1 The given conf_file didn't exists +*/ +int load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv) +{ + return my_load_defaults(conf_file, groups, argc, argv, &default_directories); +} + +/* + Read options from configurations files + + SYNOPSIS + my_load_defaults() + conf_file Basename for configuration file to search for. + If this is a path, then only this file is read. + groups Which [group] entrys to read. + Points to an null terminated array of pointers + argc Pointer to argc of original program + argv Pointer to argv of original program + default_directories Pointer to a location where a pointer to the list + of default directories will be stored + + IMPLEMENTATION + + Read options from configuration files and put them BEFORE the arguments + that are already in argc and argv. This way the calling program can + easily command line options override options in configuration files + + NOTES + In case of fatal error, the function will print a warning and do + exit(1) + + To free used memory one should call free_defaults() with the argument + that was put in *argv + + RETURN + - If successful, 0 is returned. If 'default_directories' is not NULL, + a pointer to the array of default directory paths is stored to a location + it points to. That stored value must be passed to my_search_option_files() + later. + + - 1 is returned if the given conf_file didn't exist. In this case, the + value pointed to by default_directories is undefined. +*/ + + +int my_load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv, const char ***default_directories) +{ + DYNAMIC_ARRAY args; + TYPELIB group; + my_bool found_print_defaults= 0; + uint args_used= 0; + int error= 0; + MEM_ROOT alloc; + char *ptr,**res; + struct handle_option_ctx ctx; + const char **dirs; + DBUG_ENTER("load_defaults"); + + init_alloc_root(&alloc,512,0); + if ((dirs= init_default_directories(&alloc)) == NULL) + goto err; + /* + Check if the user doesn't want any default option processing + --no-defaults is always the first option + */ + if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults")) + { + /* remove the --no-defaults argument and return only the other arguments */ + uint i; + if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+ + (*argc + 1)*sizeof(char*)))) + goto err; + res= (char**) (ptr+sizeof(alloc)); + res[0]= **argv; /* Copy program name */ + /* set arguments separator */ + res[1]= (char *)args_separator; + for (i=2 ; i < (uint) *argc ; i++) + res[i]=argv[0][i]; + res[i]=0; /* End pointer */ + *argv=res; + *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ + if (default_directories) + *default_directories= dirs; + DBUG_RETURN(0); + } + + group.count=0; + group.name= "defaults"; + group.type_names= groups; + + for (; *groups ; groups++) + group.count++; + + if (my_init_dynamic_array(&args, sizeof(char*),*argc, 32)) + goto err; + + ctx.alloc= &alloc; + ctx.args= &args; + ctx.group= &group; + + error= my_search_option_files(conf_file, argc, argv, &args_used, + handle_default_option, (void *) &ctx, + dirs); + /* + Here error contains <> 0 only if we have a fully specified conf_file + or a forced default file + */ + if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+ + (args.elements + *argc + 1 + 1) *sizeof(char*)))) + goto err; + res= (char**) (ptr+sizeof(alloc)); + + /* copy name + found arguments + command line arguments to new array */ + res[0]= argv[0][0]; /* Name MUST be set, even by embedded library */ + memcpy((uchar*) (res+1), args.buffer, args.elements*sizeof(char*)); + /* Skip --defaults-xxx options */ + (*argc)-= args_used; + (*argv)+= args_used; + + /* + Check if we wan't to see the new argument list + This options must always be the last of the default options + */ + if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults")) + { + found_print_defaults=1; + --*argc; ++*argv; /* skip argument */ + } + + /* set arguments separator for arguments from config file and + command line */ + res[args.elements+1]= (char *)args_separator; + + if (*argc) + memcpy((uchar*) (res+1+args.elements+1), (char*) ((*argv)+1), + (*argc-1)*sizeof(char*)); + res[args.elements+ *argc+1]=0; /* last null */ + + (*argc)+=args.elements+1; + *argv= (char**) res; + *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ + delete_dynamic(&args); + if (found_print_defaults) + { + int i; + printf("%s would have been started with the following arguments:\n", + **argv); + for (i=1 ; i < *argc ; i++) + if ((*argv)[i] != args_separator) /* skip arguments separator */ + printf("%s ", (*argv)[i]); + puts(""); + exit(0); + } + + if (error == 0 && default_directories) + *default_directories= dirs; + + DBUG_RETURN(error); + + err: + fprintf(stderr,"Fatal error in defaults handling. Program aborted\n"); + exit(1); + return 0; /* Keep compiler happy */ +} + + +void free_defaults(char **argv) +{ + MEM_ROOT ptr; + memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr)); + free_root(&ptr,MYF(0)); +} + + +static int search_default_file(Process_option_func opt_handler, + void *handler_ctx, + const char *dir, + const char *config_file) +{ + char **ext; + const char *empty_list[]= { "", 0 }; + my_bool have_ext= fn_ext(config_file)[0] != 0; + const char **exts_to_use= have_ext ? empty_list : f_extensions; + + for (ext= (char**) exts_to_use; *ext; ext++) + { + int error; + if ((error= search_default_file_with_ext(opt_handler, handler_ctx, + dir, *ext, + config_file, 0)) < 0) + return error; + } + return 0; +} + + +/* + Skip over keyword and get argument after keyword + + SYNOPSIS + get_argument() + keyword Include directive keyword + kwlen Length of keyword + ptr Pointer to the keword in the line under process + line line number + + RETURN + 0 error + # Returns pointer to the argument after the keyword. +*/ + +static char *get_argument(const char *keyword, size_t kwlen, + char *ptr, char *name, uint line) +{ + char *end; + + /* Skip over "include / includedir keyword" and following whitespace */ + + for (ptr+= kwlen - 1; + my_isspace(&my_charset_latin1, ptr[0]); + ptr++) + {} + + /* + Trim trailing whitespace from directory name + The -1 below is for the newline added by fgets() + Note that my_isspace() is true for \r and \n + */ + for (end= ptr + strlen(ptr) - 1; + my_isspace(&my_charset_latin1, *(end - 1)); + end--) + {} + end[0]= 0; /* Cut off end space */ + + /* Print error msg if there is nothing after !include* directive */ + if (end <= ptr) + { + fprintf(stderr, + "error: Wrong '!%s' directive in config file: %s at line %d\n", + keyword, name, line); + return 0; + } + return ptr; +} + + +/* + Open a configuration file (if exists) and read given options from it + + SYNOPSIS + search_default_file_with_ext() + opt_handler Option handler function. It is used to process + every separate option. + handler_ctx Pointer to the structure to store actual + parameters of the function. + dir directory to read + ext Extension for configuration file + config_file Name of configuration file + group groups to read + recursion_level the level of recursion, got while processing + "!include" or "!includedir" + + RETURN + 0 Success + -1 Fatal error, abort + 1 File not found (Warning) +*/ + +static int search_default_file_with_ext(Process_option_func opt_handler, + void *handler_ctx, + const char *dir, + const char *ext, + const char *config_file, + int recursion_level) +{ + char name[FN_REFLEN + 10], buff[4096], curr_gr[4096], *ptr, *end, **tmp_ext; + char *value, option[4096], tmp[FN_REFLEN]; + static const char includedir_keyword[]= "includedir"; + static const char include_keyword[]= "include"; + const int max_recursion_level= 10; + FILE *fp; + uint line=0; + my_bool found_group=0; + uint i; + MY_DIR *search_dir; + FILEINFO *search_file; + + if ((dir ? strlen(dir) : 0 )+strlen(config_file) >= FN_REFLEN-3) + return 0; /* Ignore wrong paths */ + if (dir) + { + end=convert_dirname(name, dir, NullS); + if (dir[0] == FN_HOMELIB) /* Add . to filenames in home */ + *end++='.'; + strxmov(end,config_file,ext,NullS); + } + else + { + strmov(name,config_file); + } + fn_format(name,name,"","",4); +#if !defined(__WIN__) && !defined(__NETWARE__) + { + MY_STAT stat_info; + if (!my_stat(name,&stat_info,MYF(0))) + return 1; + /* + Ignore world-writable regular files. + This is mainly done to protect us to not read a file created by + the mysqld server, but the check is still valid in most context. + */ + if ((stat_info.st_mode & S_IWOTH) && + (stat_info.st_mode & S_IFMT) == S_IFREG) + { + fprintf(stderr, "Warning: World-writable config file '%s' is ignored\n", + name); + return 0; + } + } +#endif + if (!(fp= my_fopen(name, O_RDONLY, MYF(0)))) + return 1; /* Ignore wrong files */ + + while (fgets(buff, sizeof(buff) - 1, fp)) + { + line++; + /* Ignore comment and empty lines */ + for (ptr= buff; my_isspace(&my_charset_latin1, *ptr); ptr++) + {} + + if (*ptr == '#' || *ptr == ';' || !*ptr) + continue; + + /* Configuration File Directives */ + if ((*ptr == '!')) + { + if (recursion_level >= max_recursion_level) + { + for (end= ptr + strlen(ptr) - 1; + my_isspace(&my_charset_latin1, *(end - 1)); + end--) + {} + end[0]= 0; + fprintf(stderr, + "Warning: skipping '%s' directive as maximum include" + "recursion level was reached in file %s at line %d\n", + ptr, name, line); + continue; + } + + /* skip over `!' and following whitespace */ + for (++ptr; my_isspace(&my_charset_latin1, ptr[0]); ptr++) + {} + + if ((!strncmp(ptr, includedir_keyword, + sizeof(includedir_keyword) - 1)) && + my_isspace(&my_charset_latin1, ptr[sizeof(includedir_keyword) - 1])) + { + if (!(ptr= get_argument(includedir_keyword, + sizeof(includedir_keyword), + ptr, name, line))) + goto err; + + if (!(search_dir= my_dir(ptr, MYF(MY_WME)))) + goto err; + + for (i= 0; i < (uint) search_dir->number_off_files; i++) + { + search_file= search_dir->dir_entry + i; + ext= fn_ext(search_file->name); + + /* check extension */ + for (tmp_ext= (char**) f_extensions; *tmp_ext; tmp_ext++) + { + if (!strcmp(ext, *tmp_ext)) + break; + } + + if (*tmp_ext) + { + fn_format(tmp, search_file->name, ptr, "", + MY_UNPACK_FILENAME | MY_SAFE_PATH); + + search_default_file_with_ext(opt_handler, handler_ctx, "", "", tmp, + recursion_level + 1); + } + } + + my_dirend(search_dir); + } + else if ((!strncmp(ptr, include_keyword, sizeof(include_keyword) - 1)) && + my_isspace(&my_charset_latin1, ptr[sizeof(include_keyword)-1])) + { + if (!(ptr= get_argument(include_keyword, + sizeof(include_keyword), ptr, + name, line))) + goto err; + + search_default_file_with_ext(opt_handler, handler_ctx, "", "", ptr, + recursion_level + 1); + } + + continue; + } + + if (*ptr == '[') /* Group name */ + { + found_group=1; + if (!(end=(char *) strchr(++ptr,']'))) + { + fprintf(stderr, + "error: Wrong group definition in config file: %s at line %d\n", + name,line); + goto err; + } + /* Remove end space */ + for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ; + end[0]=0; + + strmake(curr_gr, ptr, min((size_t) (end-ptr)+1, sizeof(curr_gr)-1)); + + /* signal that a new group is found */ + opt_handler(handler_ctx, curr_gr, NULL); + + continue; + } + if (!found_group) + { + fprintf(stderr, + "error: Found option without preceding group in config file: %s at line: %d\n", + name,line); + goto err; + } + + + end= remove_end_comment(ptr); + if ((value= strchr(ptr, '='))) + end= value; /* Option without argument */ + for ( ; my_isspace(&my_charset_latin1,end[-1]) ; end--) ; + if (!value) + { + strmake(strmov(option,"--"),ptr, (size_t) (end-ptr)); + if (opt_handler(handler_ctx, curr_gr, option)) + goto err; + } + else + { + /* Remove pre- and end space */ + char *value_end; + for (value++ ; my_isspace(&my_charset_latin1,*value); value++) ; + value_end=strend(value); + /* + We don't have to test for value_end >= value as we know there is + an '=' before + */ + for ( ; my_isspace(&my_charset_latin1,value_end[-1]) ; value_end--) ; + if (value_end < value) /* Empty string */ + value_end=value; + + /* remove quotes around argument */ + if ((*value == '\"' || *value == '\'') && /* First char is quote */ + (value + 1 < value_end ) && /* String is longer than 1 */ + *value == value_end[-1] ) /* First char is equal to last char */ + { + value++; + value_end--; + } + ptr=strnmov(strmov(option,"--"),ptr,(size_t) (end-ptr)); + *ptr++= '='; + + for ( ; value != value_end; value++) + { + if (*value == '\\' && value != value_end-1) + { + switch(*++value) { + case 'n': + *ptr++='\n'; + break; + case 't': + *ptr++= '\t'; + break; + case 'r': + *ptr++ = '\r'; + break; + case 'b': + *ptr++ = '\b'; + break; + case 's': + *ptr++= ' '; /* space */ + break; + case '\"': + *ptr++= '\"'; + break; + case '\'': + *ptr++= '\''; + break; + case '\\': + *ptr++= '\\'; + break; + default: /* Unknown; Keep '\' */ + *ptr++= '\\'; + *ptr++= *value; + break; + } + } + else + *ptr++= *value; + } + *ptr=0; + if (opt_handler(handler_ctx, curr_gr, option)) + goto err; + } + } + my_fclose(fp,MYF(0)); + return(0); + + err: + my_fclose(fp,MYF(0)); + return -1; /* Fatal error */ +} + + +static char *remove_end_comment(char *ptr) +{ + char quote= 0; /* we are inside quote marks */ + char escape= 0; /* symbol is protected by escape chagacter */ + + for (; *ptr; ptr++) + { + if ((*ptr == '\'' || *ptr == '\"') && !escape) + { + if (!quote) + quote= *ptr; + else if (quote == *ptr) + quote= 0; + } + /* We are not inside a string */ + if (!quote && *ptr == '#') + { + *ptr= 0; + return ptr; + } + escape= (quote && *ptr == '\\' && !escape); + } + return ptr; +} + +void my_print_default_files(const char *conf_file) +{ + const char *empty_list[]= { "", 0 }; + my_bool have_ext= fn_ext(conf_file)[0] != 0; + const char **exts_to_use= have_ext ? empty_list : f_extensions; + char name[FN_REFLEN], **ext; + + puts("\nDefault options are read from the following files in the given order:"); + + if (dirname_length(conf_file)) + fputs(conf_file,stdout); + else + { + const char **dirs; + MEM_ROOT alloc; + init_alloc_root(&alloc,512,0); + + if ((dirs= init_default_directories(&alloc)) == NULL) + { + fputs("Internal error initializing default directories list", stdout); + } + else + { + for ( ; *dirs; dirs++) + { + for (ext= (char**) exts_to_use; *ext; ext++) + { + const char *pos; + char *end; + if (**dirs) + pos= *dirs; + else if (my_defaults_extra_file) + pos= my_defaults_extra_file; + else + continue; + end= convert_dirname(name, pos, NullS); + if (name[0] == FN_HOMELIB) /* Add . to filenames in home */ + *end++= '.'; + strxmov(end, conf_file, *ext, " ", NullS); + fputs(name, stdout); + } + } + } + + free_root(&alloc, MYF(0)); + } + puts(""); +} + +void print_defaults(const char *conf_file, const char **groups) +{ + const char **groups_save= groups; + my_print_default_files(conf_file); + + fputs("The following groups are read:",stdout); + for ( ; *groups ; groups++) + { + fputc(' ',stdout); + fputs(*groups,stdout); + } + + if (my_defaults_group_suffix) + { + groups= groups_save; + for ( ; *groups ; groups++) + { + fputc(' ',stdout); + fputs(*groups,stdout); + fputs(my_defaults_group_suffix,stdout); + } + } + puts("\nThe following options may be given as the first argument:\n\ +--print-defaults Print the program argument list and exit\n\ +--no-defaults Don't read default options from any options file\n\ +--defaults-file=# Only read default options from the given file #\n\ +--defaults-extra-file=# Read this file after the global files are read"); +} + + +static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs) +{ + char buf[FN_REFLEN]; + size_t len; + char *p; + my_bool err __attribute__((unused)); + + len= normalize_dirname(buf, dir); + if (!(p= strmake_root(alloc, buf, len))) + return 1; /* Failure */ + /* Should never fail if DEFAULT_DIRS_SIZE is correct size */ + err= array_append_string_unique(p, dirs, DEFAULT_DIRS_SIZE); + DBUG_ASSERT(err == FALSE); + + return 0; +} + + +#ifdef __WIN__ +/* + This wrapper for GetSystemWindowsDirectory() will dynamically bind to the + function if it is available, emulate it on NT4 Terminal Server by stripping + the \SYSTEM32 from the end of the results of GetSystemDirectory(), or just + return GetSystemDirectory(). + */ + +typedef UINT (WINAPI *GET_SYSTEM_WINDOWS_DIRECTORY)(LPSTR, UINT); + +static size_t my_get_system_windows_directory(char *buffer, size_t size) +{ + size_t count; + GET_SYSTEM_WINDOWS_DIRECTORY + func_ptr= (GET_SYSTEM_WINDOWS_DIRECTORY) + GetProcAddress(GetModuleHandle("kernel32.dll"), + "GetSystemWindowsDirectoryA"); + + if (func_ptr) + return func_ptr(buffer, (uint) size); + + /* + Windows NT 4.0 Terminal Server Edition: + To retrieve the shared Windows directory, call GetSystemDirectory and + trim the "System32" element from the end of the returned path. + */ + count= GetSystemDirectory(buffer, (uint) size); + if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0) + { + count-= 8; + buffer[count] = '\0'; + } + return count; +} + + +static const char *my_get_module_parent(char *buf, size_t size) +{ + char *last= NULL; + char *end; + if (!GetModuleFileName(NULL, buf, (DWORD) size)) + return NULL; + end= strend(buf); + + /* + Look for the second-to-last \ in the filename, but hang on + to a pointer after the last \ in case we're in the root of + a drive. + */ + for ( ; end > buf; end--) + { + if (*end == FN_LIBCHAR) + { + if (last) + { + /* Keep the last '\' as this works both with D:\ and a directory */ + end[1]= 0; + break; + } + last= end; + } + } + + return buf; +} +#endif /* __WIN__ */ + + +static const char **init_default_directories(MEM_ROOT *alloc) +{ + const char **dirs; + char *env; + int errors= 0; + + dirs= (const char **)alloc_root(alloc, DEFAULT_DIRS_SIZE * sizeof(char *)); + if (dirs == NULL) + return NULL; + bzero((char *) dirs, DEFAULT_DIRS_SIZE * sizeof(char *)); + +#ifdef __WIN__ + + { + char fname_buffer[FN_REFLEN]; + if (my_get_system_windows_directory(fname_buffer, sizeof(fname_buffer))) + errors += add_directory(alloc, fname_buffer, dirs); + + if (GetWindowsDirectory(fname_buffer, sizeof(fname_buffer))) + errors += add_directory(alloc, fname_buffer, dirs); + + errors += add_directory(alloc, "C:/", dirs); + + if (my_get_module_parent(fname_buffer, sizeof(fname_buffer)) != NULL) + errors += add_directory(alloc, fname_buffer, dirs); + } + +#elif defined(__NETWARE__) + + errors += add_directory(alloc, "sys:/etc/", dirs); + +#else + + errors += add_directory(alloc, "/etc/", dirs); + errors += add_directory(alloc, "/etc/mysql/", dirs); + +#if defined(DEFAULT_SYSCONFDIR) + if (DEFAULT_SYSCONFDIR[0]) + errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs); +#endif /* DEFAULT_SYSCONFDIR */ + +#endif + + if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV)))) + errors += add_directory(alloc, env, dirs); + + /* Placeholder for --defaults-extra-file= */ + errors += add_directory(alloc, "", dirs); + +#if !defined(__WIN__) && !defined(__NETWARE__) + errors += add_directory(alloc, "~/", dirs); +#endif + + return (errors > 0 ? NULL : dirs); +} diff --git a/externals/mysql/mysys/default_modify.c b/externals/mysql/mysys/default_modify.c new file mode 100644 index 0000000..35555f5 --- /dev/null +++ b/externals/mysql/mysys/default_modify.c @@ -0,0 +1,254 @@ +/* Copyright (C) 2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "my_global.h" +#include "mysys_priv.h" +#include "m_string.h" +#include + +#define BUFF_SIZE 1024 +#define RESERVE 1024 /* Extend buffer with this extent */ + +#ifdef _WIN32 +#define NEWLINE "\r\n" +#define NEWLINE_LEN 2 +#else +#define NEWLINE "\n" +#define NEWLINE_LEN 1 +#endif + +static char *add_option(char *dst, const char *option_value, + const char *option, int remove_option); + + +/* + Add/remove option to the option file section. + + SYNOPSYS + modify_defaults_file() + file_location The location of configuration file to edit + option The name of the option to look for (can be NULL) + option value The value of the option we would like to set (can be NULL) + section_name The name of the section (must be NOT NULL) + remove_option This defines what we want to remove: + - MY_REMOVE_NONE -- nothing to remove; + - MY_REMOVE_OPTION -- remove the specified option; + - MY_REMOVE_SECTION -- remove the specified section; + IMPLEMENTATION + We open the option file first, then read the file line-by-line, + looking for the section we need. At the same time we put these lines + into a buffer. Then we look for the option within this section and + change/remove it. In the end we get a buffer with modified version of the + file. Then we write it to the file, truncate it if needed and close it. + Note that there is a small time gap, when the file is incomplete, + and this theoretically might introduce a problem. + + RETURN + 0 - ok + 1 - some error has occured. Probably due to the lack of resourses + 2 - cannot open the file +*/ + +int modify_defaults_file(const char *file_location, const char *option, + const char *option_value, + const char *section_name, int remove_option) +{ + FILE *cnf_file; + MY_STAT file_stat; + char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer; + size_t opt_len= 0, optval_len= 0, sect_len; + uint nr_newlines= 0, buffer_size; + my_bool in_section= FALSE, opt_applied= 0; + uint reserve_extended; + uint new_opt_len; + int reserve_occupied= 0; + DBUG_ENTER("modify_defaults_file"); + + if (!(cnf_file= my_fopen(file_location, O_RDWR | O_BINARY, MYF(0)))) + DBUG_RETURN(2); + + /* my_fstat doesn't use the flag parameter */ + if (my_fstat(my_fileno(cnf_file), &file_stat, MYF(0))) + goto malloc_err; + + if (option && option_value) + { + opt_len= strlen(option); + optval_len= strlen(option_value); + } + + new_opt_len= opt_len + 1 + optval_len + NEWLINE_LEN; + + /* calculate the size of the buffer we need */ + reserve_extended= (opt_len + + 1 + /* For '=' char */ + optval_len + /* Option value len */ + NEWLINE_LEN + /* Space for newline */ + RESERVE); /* Some additional space */ + + buffer_size= (uint)(file_stat.st_size + + 1); /* The ending zero */ + + /* + Reserve space to read the contents of the file and some more + for the option we want to add. + */ + if (!(file_buffer= (char*) my_malloc(buffer_size + reserve_extended, + MYF(MY_WME)))) + goto malloc_err; + + sect_len= strlen(section_name); + + for (dst_ptr= file_buffer; fgets(linebuff, BUFF_SIZE, cnf_file); ) + { + /* Skip over whitespaces */ + for (src_ptr= linebuff; my_isspace(&my_charset_latin1, *src_ptr); + src_ptr++) + {} + + if (!*src_ptr) /* Empty line */ + { + nr_newlines++; + continue; + } + + /* correct the option (if requested) */ + if (option && in_section && !strncmp(src_ptr, option, opt_len) && + (*(src_ptr + opt_len) == '=' || + my_isspace(&my_charset_latin1, *(src_ptr + opt_len)) || + *(src_ptr + opt_len) == '\0')) + { + char *old_src_ptr= src_ptr; + src_ptr= strend(src_ptr+ opt_len); /* Find the end of the line */ + + /* could be negative */ + reserve_occupied+= (int) new_opt_len - (int) (src_ptr - old_src_ptr); + if (reserve_occupied >= (int) reserve_extended) + { + reserve_extended= (uint) reserve_occupied + RESERVE; + if (!(file_buffer= (char*) my_realloc(file_buffer, buffer_size + + reserve_extended, + MYF(MY_WME|MY_FREE_ON_ERROR)))) + goto malloc_err; + } + opt_applied= 1; + dst_ptr= add_option(dst_ptr, option_value, option, remove_option); + } + else + { + /* + If we are going to the new group and have an option to apply, do + it now. If we are removing a single option or the whole section + this will only trigger opt_applied flag. + */ + + if (in_section && !opt_applied && *src_ptr == '[') + { + dst_ptr= add_option(dst_ptr, option_value, option, remove_option); + opt_applied= 1; /* set the flag to do write() later */ + reserve_occupied= new_opt_len+ opt_len + 1 + NEWLINE_LEN; + } + + for (; nr_newlines; nr_newlines--) + dst_ptr= strmov(dst_ptr, NEWLINE); + + /* Skip the section if MY_REMOVE_SECTION was given */ + if (!in_section || remove_option != MY_REMOVE_SECTION) + dst_ptr= strmov(dst_ptr, linebuff); + } + /* Look for a section */ + if (*src_ptr == '[') + { + /* Copy the line to the buffer */ + if (!strncmp(++src_ptr, section_name, sect_len)) + { + src_ptr+= sect_len; + /* Skip over whitespaces. They are allowed after section name */ + for (; my_isspace(&my_charset_latin1, *src_ptr); src_ptr++) + {} + + if (*src_ptr != ']') + { + in_section= FALSE; + continue; /* Missing closing parenthesis. Assume this was no group */ + } + + if (remove_option == MY_REMOVE_SECTION) + dst_ptr= dst_ptr - strlen(linebuff); + + in_section= TRUE; + } + else + in_section= FALSE; /* mark that this section is of no interest to us */ + } + } + + /* + File ended. Apply an option or set opt_applied flag (in case of + MY_REMOVE_SECTION) so that the changes are saved. Do not do anything + if we are removing non-existent option. + */ + + if (!opt_applied && in_section && (remove_option != MY_REMOVE_OPTION)) + { + /* New option still remains to apply at the end */ + if (!remove_option && *(dst_ptr - 1) != '\n') + dst_ptr= strmov(dst_ptr, NEWLINE); + dst_ptr= add_option(dst_ptr, option_value, option, remove_option); + opt_applied= 1; + } + for (; nr_newlines; nr_newlines--) + dst_ptr= strmov(dst_ptr, NEWLINE); + + if (opt_applied) + { + /* Don't write the file if there are no changes to be made */ + if (my_chsize(my_fileno(cnf_file), (my_off_t) (dst_ptr - file_buffer), 0, + MYF(MY_WME)) || + my_fseek(cnf_file, 0, MY_SEEK_SET, MYF(0)) || + my_fwrite(cnf_file, (uchar*) file_buffer, (size_t) (dst_ptr - file_buffer), + MYF(MY_NABP))) + goto err; + } + if (my_fclose(cnf_file, MYF(MY_WME))) + DBUG_RETURN(1); + + my_free(file_buffer, MYF(0)); + DBUG_RETURN(0); + +err: + my_free(file_buffer, MYF(0)); +malloc_err: + my_fclose(cnf_file, MYF(0)); + DBUG_RETURN(1); /* out of resources */ +} + + +static char *add_option(char *dst, const char *option_value, + const char *option, int remove_option) +{ + if (!remove_option) + { + dst= strmov(dst, option); + if (*option_value) + { + *dst++= '='; + dst= strmov(dst, option_value); + } + /* add a newline */ + dst= strmov(dst, NEWLINE); + } + return dst; +} diff --git a/externals/mysql/mysys/errors.c b/externals/mysql/mysys/errors.c new file mode 100644 index 0000000..0c1d8c1 --- /dev/null +++ b/externals/mysql/mysys/errors.c @@ -0,0 +1,110 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" + +#ifndef SHARED_LIBRARY + +const char * NEAR globerrs[GLOBERRS]= +{ + "Can't create/write to file '%s' (Errcode: %d)", + "Error reading file '%s' (Errcode: %d)", + "Error writing file '%s' (Errcode: %d)", + "Error on close of '%s' (Errcode: %d)", + "Out of memory (Needed %u bytes)", + "Error on delete of '%s' (Errcode: %d)", + "Error on rename of '%s' to '%s' (Errcode: %d)", + "", + "Unexpected eof found when reading file '%s' (Errcode: %d)", + "Can't lock file (Errcode: %d)", + "Can't unlock file (Errcode: %d)", + "Can't read dir of '%s' (Errcode: %d)", + "Can't get stat of '%s' (Errcode: %d)", + "Can't change size of file (Errcode: %d)", + "Can't open stream from handle (Errcode: %d)", + "Can't get working dirctory (Errcode: %d)", + "Can't change dir to '%s' (Errcode: %d)", + "Warning: '%s' had %d links", + "Warning: %d files and %d streams is left open\n", + "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... (Expect up to %d secs delay for server to continue after freeing disk space)", + "Can't create directory '%s' (Errcode: %d)", + "Character set '%s' is not a compiled character set and is not specified in the '%s' file", + "Out of resources when opening file '%s' (Errcode: %d)", + "Can't read value for symlink '%s' (Error %d)", + "Can't create symlink '%s' pointing at '%s' (Error %d)", + "Error on realpath() on '%s' (Error %d)", + "Can't sync file '%s' to disk (Errcode: %d)", + "Collation '%s' is not a compiled collation and is not specified in the '%s' file", + "File '%s' not found (Errcode: %d)", + "File '%s' (fileno: %d) was not closed", + "Can't change mode for file '%s' to 0x%lx (Error: %d)" +}; + +void init_glob_errs(void) +{ + /* This is now done statically. */ +} + +#else + +void init_glob_errs() +{ + EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (Errcode: %d)"; + EE(EE_READ) = "Error reading file '%s' (Errcode: %d)"; + EE(EE_WRITE) = "Error writing file '%s' (Errcode: %d)"; + EE(EE_BADCLOSE) = "Error on close of '%'s (Errcode: %d)"; + EE(EE_OUTOFMEMORY) = "Out of memory (Needed %u bytes)"; + EE(EE_DELETE) = "Error on delete of '%s' (Errcode: %d)"; + EE(EE_LINK) = "Error on rename of '%s' to '%s' (Errcode: %d)"; + EE(EE_EOFERR) = "Unexpected eof found when reading file '%s' (Errcode: %d)"; + EE(EE_CANTLOCK) = "Can't lock file (Errcode: %d)"; + EE(EE_CANTUNLOCK) = "Can't unlock file (Errcode: %d)"; + EE(EE_DIR) = "Can't read dir of '%s' (Errcode: %d)"; + EE(EE_STAT) = "Can't get stat of '%s' (Errcode: %d)"; + EE(EE_CANT_CHSIZE) = "Can't change size of file (Errcode: %d)"; + EE(EE_CANT_OPEN_STREAM)= "Can't open stream from handle (Errcode: %d)"; + EE(EE_GETWD) = "Can't get working directory (Errcode: %d)"; + EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %d)"; + EE(EE_LINK_WARNING) = "Warning: '%s' had %d links"; + EE(EE_OPEN_WARNING) = "Warning: %d files and %d streams is left open\n"; + EE(EE_DISK_FULL) = "Disk is full writing '%s'. Waiting for someone to free space..."; + EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %d)"; + EE(EE_UNKNOWN_CHARSET)= "Character set '%s' is not a compiled character set and is not specified in the %s file"; + EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %d)"; + EE(EE_CANT_READLINK)= "Can't read value for symlink '%s' (Error %d)"; + EE(EE_CANT_SYMLINK)= "Can't create symlink '%s' pointing at '%s' (Error %d)"; + EE(EE_REALPATH)= "Error on realpath() on '%s' (Error %d)"; + EE(EE_SYNC)= "Can't sync file '%s' to disk (Errcode: %d)"; + EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file"; + EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)"; + EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed"; + EE(EE_CANT_CHMOD) = "Can't change mode for file '%s' to 0x%lx (Error: %d)"; +} +#endif + +void wait_for_free_space(const char *filename, int errors) +{ + if (errors == 0) + my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH), + filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); + if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE)) + my_printf_error(EE_DISK_FULL, + "Retry in %d secs. Message reprinted in %d secs", + MYF(ME_BELL | ME_NOREFRESH), + MY_WAIT_FOR_USER_TO_FIX_PANIC, + MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC ); + (void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC); +} diff --git a/externals/mysql/mysys/hash.c b/externals/mysql/mysys/hash.c new file mode 100644 index 0000000..a521cd8 --- /dev/null +++ b/externals/mysql/mysys/hash.c @@ -0,0 +1,763 @@ +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* The hash functions used for saveing keys */ +/* One of key_length or key_length_offset must be given */ +/* Key length of 0 isn't allowed */ + +#include "mysys_priv.h" +#include +#include +#include "hash.h" + +#define NO_RECORD ((uint) -1) +#define LOWFIND 1 +#define LOWUSED 2 +#define HIGHFIND 4 +#define HIGHUSED 8 + +typedef struct st_hash_info { + uint next; /* index to next key */ + uchar *data; /* data for current entry */ +} HASH_LINK; + +static uint my_hash_mask(size_t hashnr, size_t buffmax, size_t maxlength); +static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink); +static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, + size_t length); + +static uint calc_hash(const HASH *hash, const uchar *key, size_t length) +{ + ulong nr1=1, nr2=4; + hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2); + return nr1; +} + +my_bool +_my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset, + ulong size, size_t key_offset, size_t key_length, + my_hash_get_key get_key, + void (*free_element)(void*), uint flags CALLER_INFO_PROTO) +{ + DBUG_ENTER("my_hash_init"); + DBUG_PRINT("enter",("hash: %p size: %u", hash, (uint) size)); + + hash->records=0; + if (my_init_dynamic_array_ci(&hash->array, sizeof(HASH_LINK), size, + growth_size)) + { + hash->free=0; /* Allow call to my_hash_free */ + DBUG_RETURN(1); + } + hash->key_offset=key_offset; + hash->key_length=key_length; + hash->blength=1; + hash->get_key=get_key; + hash->free=free_element; + hash->flags=flags; + hash->charset=charset; + DBUG_RETURN(0); +} + + +/* + Call hash->free on all elements in hash. + + SYNOPSIS + my_hash_free_elements() + hash hash table + + NOTES: + Sets records to 0 +*/ + +static inline void my_hash_free_elements(HASH *hash) +{ + if (hash->free) + { + HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*); + HASH_LINK *end= data + hash->records; + while (data < end) + (*hash->free)((data++)->data); + } + hash->records=0; +} + + +/* + Free memory used by hash. + + SYNOPSIS + my_hash_free() + hash the hash to delete elements of + + NOTES: Hash can't be reused without calling my_hash_init again. +*/ + +void my_hash_free(HASH *hash) +{ + DBUG_ENTER("my_hash_free"); + DBUG_PRINT("enter",("hash: %p", hash)); + + my_hash_free_elements(hash); + hash->free= 0; + delete_dynamic(&hash->array); + DBUG_VOID_RETURN; +} + + +/* + Delete all elements from the hash (the hash itself is to be reused). + + SYNOPSIS + my_hash_reset() + hash the hash to delete elements of +*/ + +void my_hash_reset(HASH *hash) +{ + DBUG_ENTER("my_hash_reset"); + DBUG_PRINT("enter",("hash: %pd", hash)); + + my_hash_free_elements(hash); + reset_dynamic(&hash->array); + /* Set row pointers so that the hash can be reused at once */ + hash->blength= 1; + DBUG_VOID_RETURN; +} + +/* some helper functions */ + +/* + This function is char* instead of uchar* as HPUX11 compiler can't + handle inline functions that are not defined as native types +*/ + +static inline char* +my_hash_key(const HASH *hash, const uchar *record, size_t *length, + my_bool first) +{ + if (hash->get_key) + return (char*) (*hash->get_key)(record,length,first); + *length=hash->key_length; + return (char*) record+hash->key_offset; +} + + /* Calculate pos according to keys */ + +static uint my_hash_mask(size_t hashnr, size_t buffmax, size_t maxlength) +{ + if ((hashnr & (buffmax-1)) < maxlength) return (hashnr & (buffmax-1)); + return (hashnr & ((buffmax >> 1) -1)); +} + +static uint my_hash_rec_mask(const HASH *hash, HASH_LINK *pos, + size_t buffmax, size_t maxlength) +{ + size_t length; + uchar *key= (uchar*) my_hash_key(hash, pos->data, &length, 0); + return my_hash_mask(calc_hash(hash, key, length), buffmax, maxlength); +} + + + +/* for compilers which can not handle inline */ +static +#if !defined(__USLC__) && !defined(__sgi) +inline +#endif +unsigned int rec_hashnr(HASH *hash,const uchar *record) +{ + size_t length; + uchar *key= (uchar*) my_hash_key(hash, record, &length, 0); + return calc_hash(hash,key,length); +} + + +uchar* my_hash_search(const HASH *hash, const uchar *key, size_t length) +{ + HASH_SEARCH_STATE state; + return my_hash_first(hash, key, length, &state); +} + +/* + Search after a record based on a key + + NOTE + Assigns the number of the found record to HASH_SEARCH_STATE state +*/ + +uchar* my_hash_first(const HASH *hash, const uchar *key, size_t length, + HASH_SEARCH_STATE *current_record) +{ + HASH_LINK *pos; + uint flag,idx; + DBUG_ENTER("my_hash_first"); + + flag=1; + if (hash->records) + { + idx= my_hash_mask(calc_hash(hash, key, length ? length : hash->key_length), + hash->blength, hash->records); + do + { + pos= dynamic_element(&hash->array,idx,HASH_LINK*); + if (!hashcmp(hash,pos,key,length)) + { + DBUG_PRINT("exit",("found key at %d",idx)); + *current_record= idx; + DBUG_RETURN (pos->data); + } + if (flag) + { + flag=0; /* Reset flag */ + if (my_hash_rec_mask(hash, pos, hash->blength, hash->records) != idx) + break; /* Wrong link */ + } + } + while ((idx=pos->next) != NO_RECORD); + } + *current_record= NO_RECORD; + DBUG_RETURN(0); +} + + /* Get next record with identical key */ + /* Can only be called if previous calls was my_hash_search */ + +uchar* my_hash_next(const HASH *hash, const uchar *key, size_t length, + HASH_SEARCH_STATE *current_record) +{ + HASH_LINK *pos; + uint idx; + + if (*current_record != NO_RECORD) + { + HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*); + for (idx=data[*current_record].next; idx != NO_RECORD ; idx=pos->next) + { + pos=data+idx; + if (!hashcmp(hash,pos,key,length)) + { + *current_record= idx; + return pos->data; + } + } + *current_record= NO_RECORD; + } + return 0; +} + + + /* Change link from pos to new_link */ + +static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink) +{ + HASH_LINK *old_link; + do + { + old_link=array+next_link; + } + while ((next_link=old_link->next) != find); + old_link->next= newlink; + return; +} + +/* + Compare a key in a record to a whole key. Return 0 if identical + + SYNOPSIS + hashcmp() + hash hash table + pos position of hash record to use in comparison + key key for comparison + length length of key + + NOTES: + If length is 0, comparison is done using the length of the + record being compared against. + + RETURN + = 0 key of record == key + != 0 key of record != key + */ + +static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, + size_t length) +{ + size_t rec_keylength; + uchar *rec_key= (uchar*) my_hash_key(hash, pos->data, &rec_keylength, 1); + return ((length && length != rec_keylength) || + my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength, + (uchar*) key, rec_keylength)); +} + + +/** + Write a hash-key to the hash-index + + @return + @retval 0 ok + @retval 1 Duplicate key or out of memory +*/ + +my_bool my_hash_insert(HASH *info, const uchar *record) +{ + int flag; + size_t idx,halfbuff,hash_nr,first_index; + uchar *ptr_to_rec,*ptr_to_rec2; + HASH_LINK *data,*empty,*gpos,*gpos2,*pos; + + LINT_INIT(gpos); + LINT_INIT(gpos2); + LINT_INIT(ptr_to_rec); + LINT_INIT(ptr_to_rec2); + + if (info->flags & HASH_UNIQUE) + { + uchar *key= (uchar*) my_hash_key(info, record, &idx, 1); + if (my_hash_search(info, key, idx)) + return(TRUE); /* Duplicate entry */ + } + + flag=0; + if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array))) + return(TRUE); /* No more memory */ + + data=dynamic_element(&info->array,0,HASH_LINK*); + halfbuff= info->blength >> 1; + + idx=first_index=info->records-halfbuff; + if (idx != info->records) /* If some records */ + { + do + { + pos=data+idx; + hash_nr=rec_hashnr(info,pos->data); + if (flag == 0) /* First loop; Check if ok */ + if (my_hash_mask(hash_nr, info->blength, info->records) != first_index) + break; + if (!(hash_nr & halfbuff)) + { /* Key will not move */ + if (!(flag & LOWFIND)) + { + if (flag & HIGHFIND) + { + flag=LOWFIND | HIGHFIND; + /* key shall be moved to the current empty position */ + gpos=empty; + ptr_to_rec=pos->data; + empty=pos; /* This place is now free */ + } + else + { + flag=LOWFIND | LOWUSED; /* key isn't changed */ + gpos=pos; + ptr_to_rec=pos->data; + } + } + else + { + if (!(flag & LOWUSED)) + { + /* Change link of previous LOW-key */ + gpos->data=ptr_to_rec; + gpos->next= (uint) (pos-data); + flag= (flag & HIGHFIND) | (LOWFIND | LOWUSED); + } + gpos=pos; + ptr_to_rec=pos->data; + } + } + else + { /* key will be moved */ + if (!(flag & HIGHFIND)) + { + flag= (flag & LOWFIND) | HIGHFIND; + /* key shall be moved to the last (empty) position */ + gpos2 = empty; empty=pos; + ptr_to_rec2=pos->data; + } + else + { + if (!(flag & HIGHUSED)) + { + /* Change link of previous hash-key and save */ + gpos2->data=ptr_to_rec2; + gpos2->next=(uint) (pos-data); + flag= (flag & LOWFIND) | (HIGHFIND | HIGHUSED); + } + gpos2=pos; + ptr_to_rec2=pos->data; + } + } + } + while ((idx=pos->next) != NO_RECORD); + + if ((flag & (LOWFIND | LOWUSED)) == LOWFIND) + { + gpos->data=ptr_to_rec; + gpos->next=NO_RECORD; + } + if ((flag & (HIGHFIND | HIGHUSED)) == HIGHFIND) + { + gpos2->data=ptr_to_rec2; + gpos2->next=NO_RECORD; + } + } + /* Check if we are at the empty position */ + + idx= my_hash_mask(rec_hashnr(info, record), info->blength, info->records + 1); + pos=data+idx; + if (pos == empty) + { + pos->data=(uchar*) record; + pos->next=NO_RECORD; + } + else + { + /* Check if more records in same hash-nr family */ + empty[0]=pos[0]; + gpos= data + my_hash_rec_mask(info, pos, info->blength, info->records + 1); + if (pos == gpos) + { + pos->data=(uchar*) record; + pos->next=(uint) (empty - data); + } + else + { + pos->data=(uchar*) record; + pos->next=NO_RECORD; + movelink(data,(uint) (pos-data),(uint) (gpos-data),(uint) (empty-data)); + } + } + if (++info->records == info->blength) + info->blength+= info->blength; + return(0); +} + + +/** + Remove one record from hash-table. + + @fn hash_delete() + @param hash Hash tree + @param record Row to be deleted + + @notes + The record with the same record ptr is removed. + If there is a free-function it's called if record was found. + + @return + @retval 0 ok + @retval 1 Record not found +*/ + +my_bool my_hash_delete(HASH *hash, uchar *record) +{ + uint blength,pos2,pos_hashnr,lastpos_hashnr,idx,empty_index; + HASH_LINK *data,*lastpos,*gpos,*pos,*pos3,*empty; + DBUG_ENTER("my_hash_delete"); + if (!hash->records) + DBUG_RETURN(1); + + blength=hash->blength; + data=dynamic_element(&hash->array,0,HASH_LINK*); + /* Search after record with key */ + pos= data + my_hash_mask(rec_hashnr(hash, record), blength, hash->records); + gpos = 0; + + while (pos->data != record) + { + gpos=pos; + if (pos->next == NO_RECORD) + DBUG_RETURN(1); /* Key not found */ + pos=data+pos->next; + } + + if ( --(hash->records) < hash->blength >> 1) hash->blength>>=1; + lastpos=data+hash->records; + + /* Remove link to record */ + empty=pos; empty_index=(uint) (empty-data); + if (gpos) + gpos->next=pos->next; /* unlink current ptr */ + else if (pos->next != NO_RECORD) + { + empty=data+(empty_index=pos->next); + pos->data=empty->data; + pos->next=empty->next; + } + + if (empty == lastpos) /* last key at wrong pos or no next link */ + goto exit; + + /* Move the last key (lastpos) */ + lastpos_hashnr=rec_hashnr(hash,lastpos->data); + /* pos is where lastpos should be */ + pos= data + my_hash_mask(lastpos_hashnr, hash->blength, hash->records); + if (pos == empty) /* Move to empty position. */ + { + empty[0]=lastpos[0]; + goto exit; + } + pos_hashnr=rec_hashnr(hash,pos->data); + /* pos3 is where the pos should be */ + pos3= data + my_hash_mask(pos_hashnr, hash->blength, hash->records); + if (pos != pos3) + { /* pos is on wrong posit */ + empty[0]=pos[0]; /* Save it here */ + pos[0]=lastpos[0]; /* This should be here */ + movelink(data,(uint) (pos-data),(uint) (pos3-data),empty_index); + goto exit; + } + pos2= my_hash_mask(lastpos_hashnr, blength, hash->records + 1); + if (pos2 == my_hash_mask(pos_hashnr, blength, hash->records + 1)) + { /* Identical key-positions */ + if (pos2 != hash->records) + { + empty[0]=lastpos[0]; + movelink(data,(uint) (lastpos-data),(uint) (pos-data),empty_index); + goto exit; + } + idx= (uint) (pos-data); /* Link pos->next after lastpos */ + } + else idx= NO_RECORD; /* Different positions merge */ + + empty[0]=lastpos[0]; + movelink(data,idx,empty_index,pos->next); + pos->next=empty_index; + +exit: + (void) pop_dynamic(&hash->array); + if (hash->free) + (*hash->free)((uchar*) record); + DBUG_RETURN(0); +} + + +/** + Update keys when record has changed. + This is much more efficent than using a delete & insert. +*/ + +my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key, + size_t old_key_length) +{ + uint new_index,new_pos_index,blength,records; + size_t idx,empty; + HASH_LINK org_link,*data,*previous,*pos; + DBUG_ENTER("my_hash_update"); + + if (HASH_UNIQUE & hash->flags) + { + HASH_SEARCH_STATE state; + uchar *found, *new_key= (uchar*) my_hash_key(hash, record, &idx, 1); + if ((found= my_hash_first(hash, new_key, idx, &state))) + { + do + { + if (found != record) + DBUG_RETURN(1); /* Duplicate entry */ + } + while ((found= my_hash_next(hash, new_key, idx, &state))); + } + } + + data=dynamic_element(&hash->array,0,HASH_LINK*); + blength=hash->blength; records=hash->records; + + /* Search after record with key */ + + idx= my_hash_mask(calc_hash(hash, old_key, (old_key_length ? + old_key_length : + hash->key_length)), + blength, records); + new_index= my_hash_mask(rec_hashnr(hash, record), blength, records); + if (idx == new_index) + DBUG_RETURN(0); /* Nothing to do (No record check) */ + previous=0; + for (;;) + { + + if ((pos= data+idx)->data == record) + break; + previous=pos; + if ((idx=pos->next) == NO_RECORD) + DBUG_RETURN(1); /* Not found in links */ + } + org_link= *pos; + empty=idx; + + /* Relink record from current chain */ + + if (!previous) + { + if (pos->next != NO_RECORD) + { + empty=pos->next; + *pos= data[pos->next]; + } + } + else + previous->next=pos->next; /* unlink pos */ + + /* Move data to correct position */ + if (new_index == empty) + { + /* + At this point record is unlinked from the old chain, thus it holds + random position. By the chance this position is equal to position + for the first element in the new chain. That means updated record + is the only record in the new chain. + */ + if (empty != idx) + { + /* + Record was moved while unlinking it from the old chain. + Copy data to a new position. + */ + data[empty]= org_link; + } + data[empty].next= NO_RECORD; + DBUG_RETURN(0); + } + pos=data+new_index; + new_pos_index= my_hash_rec_mask(hash, pos, blength, records); + if (new_index != new_pos_index) + { /* Other record in wrong position */ + data[empty] = *pos; + movelink(data,new_index,new_pos_index,empty); + org_link.next=NO_RECORD; + data[new_index]= org_link; + } + else + { /* Link in chain at right position */ + org_link.next=data[new_index].next; + data[empty]=org_link; + data[new_index].next=empty; + } + DBUG_RETURN(0); +} + + +uchar *my_hash_element(HASH *hash, ulong idx) +{ + if (idx < hash->records) + return dynamic_element(&hash->array,idx,HASH_LINK*)->data; + return 0; +} + + +/* + Replace old row with new row. This should only be used when key + isn't changed +*/ + +void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record, + uchar *new_row) +{ + if (*current_record != NO_RECORD) /* Safety */ + dynamic_element(&hash->array, *current_record, HASH_LINK*)->data= new_row; +} + + +/** + Iterate over all elements in hash and call function with the element + + @param hash hash array + @param action function to call for each argument + @param argument second argument for call to action + + @notes + If one of functions calls returns 1 then the iteration aborts + + @retval 0 ok + @retval 1 iteration aborted becasue action returned 1 +*/ + +my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument) +{ + uint records, i; + HASH_LINK *data; + + records= hash->records; + data= dynamic_element(&hash->array,0,HASH_LINK*); + + for (i= 0 ; i < records ; i++) + { + if ((*action)(data[i].data, argument)) + return 1; + } + return 0; +} + + +#ifndef DBUG_OFF + +my_bool my_hash_check(HASH *hash) +{ + int error; + uint i,rec_link,found,max_links,seek,links,idx; + uint records,blength; + HASH_LINK *data,*hash_info; + + records=hash->records; blength=hash->blength; + data=dynamic_element(&hash->array,0,HASH_LINK*); + error=0; + + for (i=found=max_links=seek=0 ; i < records ; i++) + { + if (my_hash_rec_mask(hash, data + i, blength, records) == i) + { + found++; seek++; links=1; + for (idx=data[i].next ; + idx != NO_RECORD && found < records + 1; + idx=hash_info->next) + { + if (idx >= records) + { + DBUG_PRINT("error", + ("Found pointer outside array to %d from link starting at %d", + idx,i)); + error=1; + } + hash_info=data+idx; + seek+= ++links; + if ((rec_link= my_hash_rec_mask(hash, hash_info, + blength, records)) != i) + { + DBUG_PRINT("error", ("Record in wrong link at %d: Start %d " + "Record: 0x%lx Record-link %d", + idx, i, (long) hash_info->data, rec_link)); + error=1; + } + else + found++; + } + if (links > max_links) max_links=links; + } + } + if (found != records) + { + DBUG_PRINT("error",("Found %u of %u records", found, records)); + error=1; + } + if (records) + DBUG_PRINT("info", + ("records: %u seeks: %d max links: %d hitrate: %.2f", + records,seek,max_links,(float) seek / (float) records)); + return error; +} +#endif diff --git a/externals/mysql/mysys/lf_alloc-pin.c b/externals/mysql/mysys/lf_alloc-pin.c new file mode 100644 index 0000000..fda9b97 --- /dev/null +++ b/externals/mysql/mysys/lf_alloc-pin.c @@ -0,0 +1,534 @@ +/* QQ: TODO multi-pinbox */ +/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + wait-free concurrent allocator based on pinning addresses + + It works as follows: every thread (strictly speaking - every CPU, but + it's too difficult to do) has a small array of pointers. They're called + "pins". Before using an object its address must be stored in this array + (pinned). When an object is no longer necessary its address must be + removed from this array (unpinned). When a thread wants to free() an + object it scans all pins of all threads to see if somebody has this + object pinned. If yes - the object is not freed (but stored in a + "purgatory"). To reduce the cost of a single free() pins are not scanned + on every free() but only added to (thread-local) purgatory. On every + LF_PURGATORY_SIZE free() purgatory is scanned and all unpinned objects + are freed. + + Pins are used to solve ABA problem. To use pins one must obey + a pinning protocol: + + 1. Let's assume that PTR is a shared pointer to an object. Shared means + that any thread may modify it anytime to point to a different object + and free the old object. Later the freed object may be potentially + allocated by another thread. If we're unlucky that other thread may + set PTR to point to this object again. This is ABA problem. + 2. Create a local pointer LOCAL_PTR. + 3. Pin the PTR in a loop: + do + { + LOCAL_PTR= PTR; + pin(PTR, PIN_NUMBER); + } while (LOCAL_PTR != PTR) + 4. It is guaranteed that after the loop has ended, LOCAL_PTR + points to an object (or NULL, if PTR may be NULL), that + will never be freed. It is not guaranteed though + that LOCAL_PTR == PTR (as PTR can change any time) + 5. When done working with the object, remove the pin: + unpin(PIN_NUMBER) + 6. When copying pins (as in the list traversing loop: + pin(CUR, 1); + while () + { + do // standard + { // pinning + NEXT=CUR->next; // loop + pin(NEXT, 0); // see #3 + } while (NEXT != CUR->next); // above + ... + ... + CUR=NEXT; + pin(CUR, 1); // copy pin[0] to pin[1] + } + which keeps CUR address constantly pinned), note than pins may be + copied only upwards (!!!), that is pin[N] to pin[M], M > N. + 7. Don't keep the object pinned longer than necessary - the number of + pins you have is limited (and small), keeping an object pinned + prevents its reuse and cause unnecessary mallocs. + + Explanations: + + 3. The loop is important. The following can occur: + thread1> LOCAL_PTR= PTR + thread2> free(PTR); PTR=0; + thread1> pin(PTR, PIN_NUMBER); + now thread1 cannot access LOCAL_PTR, even if it's pinned, + because it points to a freed memory. That is, it *must* + verify that it has indeed pinned PTR, the shared pointer. + + 6. When a thread wants to free some LOCAL_PTR, and it scans + all lists of pins to see whether it's pinned, it does it + upwards, from low pin numbers to high. Thus another thread + must copy an address from one pin to another in the same + direction - upwards, otherwise the scanning thread may + miss it. + + Implementation details: + + Pins are given away from a "pinbox". Pinbox is stack-based allocator. + It used dynarray for storing pins, new elements are allocated by dynarray + as necessary, old are pushed in the stack for reuse. ABA is solved by + versioning a pointer - because we use an array, a pointer to pins is 16 bit, + upper 16 bits are used for a version. + + It is assumed that pins belong to a THD and are not transferable + between THD's (LF_PINS::stack_ends_here being a primary reason + for this limitation). +*/ +#include +#include +#include + +#define LF_PINBOX_MAX_PINS 65536 + +static void _lf_pinbox_real_free(LF_PINS *pins); + +/* + Initialize a pinbox. Normally called from lf_alloc_init. + See the latter for details. +*/ +void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset, + lf_pinbox_free_func *free_func, void *free_func_arg) +{ + DBUG_ASSERT(free_ptr_offset % sizeof(void *) == 0); + compile_time_assert(sizeof(LF_PINS) == 64); + lf_dynarray_init(&pinbox->pinarray, sizeof(LF_PINS)); + pinbox->pinstack_top_ver= 0; + pinbox->pins_in_array= 0; + pinbox->free_ptr_offset= free_ptr_offset; + pinbox->free_func= free_func; + pinbox->free_func_arg= free_func_arg; +} + +void lf_pinbox_destroy(LF_PINBOX *pinbox) +{ + lf_dynarray_destroy(&pinbox->pinarray); +} + +/* + Get pins from a pinbox. Usually called via lf_alloc_get_pins() or + lf_hash_get_pins(). + + SYNOPSYS + pinbox - + + DESCRIPTION + get a new LF_PINS structure from a stack of unused pins, + or allocate a new one out of dynarray. + + NOTE + It is assumed that pins belong to a thread and are not transferable + between threads. +*/ +LF_PINS *_lf_pinbox_get_pins(LF_PINBOX *pinbox) +{ + uint32 pins, next, top_ver; + LF_PINS *el; + /* + We have an array of max. 64k elements. + The highest index currently allocated is pinbox->pins_in_array. + Freed elements are in a lifo stack, pinstack_top_ver. + pinstack_top_ver is 32 bits; 16 low bits are the index in the + array, to the first element of the list. 16 high bits are a version + (every time the 16 low bits are updated, the 16 high bits are + incremented). Versioniong prevents the ABA problem. + */ + top_ver= pinbox->pinstack_top_ver; + do + { + if (!(pins= top_ver % LF_PINBOX_MAX_PINS)) + { + /* the stack of free elements is empty */ + pins= my_atomic_add32((int32 volatile*) &pinbox->pins_in_array, 1)+1; + if (unlikely(pins >= LF_PINBOX_MAX_PINS)) + return 0; + /* + note that the first allocated element has index 1 (pins==1). + index 0 is reserved to mean "NULL pointer" + */ + el= (LF_PINS *)_lf_dynarray_lvalue(&pinbox->pinarray, pins); + if (unlikely(!el)) + return 0; + break; + } + el= (LF_PINS *)_lf_dynarray_value(&pinbox->pinarray, pins); + next= el->link; + } while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver, + (int32*) &top_ver, + top_ver-pins+next+LF_PINBOX_MAX_PINS)); + /* + set el->link to the index of el in the dynarray (el->link has two usages: + - if element is allocated, it's its own index + - if element is free, it's its next element in the free stack + */ + el->link= pins; + el->purgatory_count= 0; + el->pinbox= pinbox; + el->stack_ends_here= & my_thread_var->stack_ends_here; + return el; +} + +/* + Put pins back to a pinbox. Usually called via lf_alloc_put_pins() or + lf_hash_put_pins(). + + DESCRIPTION + empty the purgatory (XXX deadlock warning below!), + push LF_PINS structure to a stack +*/ +void _lf_pinbox_put_pins(LF_PINS *pins) +{ + LF_PINBOX *pinbox= pins->pinbox; + uint32 top_ver, nr; + nr= pins->link; +#ifdef MY_LF_EXTRA_DEBUG + { + int i; + for (i= 0; i < LF_PINBOX_PINS; i++) + DBUG_ASSERT(pins->pin[i] == 0); + } +#endif + /* + XXX this will deadlock if other threads will wait for + the caller to do something after _lf_pinbox_put_pins(), + and they would have pinned addresses that the caller wants to free. + Thus: only free pins when all work is done and nobody can wait for you!!! + */ + while (pins->purgatory_count) + { + _lf_pinbox_real_free(pins); + if (pins->purgatory_count) + { + my_atomic_rwlock_wrunlock(&pins->pinbox->pinarray.lock); + pthread_yield(); + my_atomic_rwlock_wrlock(&pins->pinbox->pinarray.lock); + } + } + top_ver= pinbox->pinstack_top_ver; + do + { + pins->link= top_ver % LF_PINBOX_MAX_PINS; + } while (!my_atomic_cas32((int32 volatile*) &pinbox->pinstack_top_ver, + (int32*) &top_ver, + top_ver-pins->link+nr+LF_PINBOX_MAX_PINS)); + return; +} + +static int ptr_cmp(void **a, void **b) +{ + return *a < *b ? -1 : *a == *b ? 0 : 1; +} + +#define add_to_purgatory(PINS, ADDR) \ + do \ + { \ + *(void **)((char *)(ADDR)+(PINS)->pinbox->free_ptr_offset)= \ + (PINS)->purgatory; \ + (PINS)->purgatory= (ADDR); \ + (PINS)->purgatory_count++; \ + } while (0) + +/* + Free an object allocated via pinbox allocator + + DESCRIPTION + add an object to purgatory. if necessary, call _lf_pinbox_real_free() + to actually free something. +*/ +void _lf_pinbox_free(LF_PINS *pins, void *addr) +{ + add_to_purgatory(pins, addr); + if (pins->purgatory_count % LF_PURGATORY_SIZE) + _lf_pinbox_real_free(pins); +} + +struct st_harvester { + void **granary; + int npins; +}; + +/* + callback for _lf_dynarray_iterate: + scan all pins of all threads and accumulate all pins +*/ +static int harvest_pins(LF_PINS *el, struct st_harvester *hv) +{ + int i; + LF_PINS *el_end= el+min(hv->npins, LF_DYNARRAY_LEVEL_LENGTH); + for (; el < el_end; el++) + { + for (i= 0; i < LF_PINBOX_PINS; i++) + { + void *p= el->pin[i]; + if (p) + *hv->granary++= p; + } + } + /* + hv->npins may become negative below, but it means that + we're on the last dynarray page and harvest_pins() won't be + called again. We don't bother to make hv->npins() correct + (that is 0) in this case. + */ + hv->npins-= LF_DYNARRAY_LEVEL_LENGTH; + return 0; +} + +/* + callback for _lf_dynarray_iterate: + scan all pins of all threads and see if addr is present there +*/ +static int match_pins(LF_PINS *el, void *addr) +{ + int i; + LF_PINS *el_end= el+LF_DYNARRAY_LEVEL_LENGTH; + for (; el < el_end; el++) + for (i= 0; i < LF_PINBOX_PINS; i++) + if (el->pin[i] == addr) + return 1; + return 0; +} + +#if STACK_DIRECTION < 0 +#define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END)) +#else +#define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR)) +#endif + +#define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset))) +#define anext_node(X) next_node(&allocator->pinbox, (X)) + +/* + Scan the purgatory and free everything that can be freed +*/ +static void _lf_pinbox_real_free(LF_PINS *pins) +{ + int npins, alloca_size; + void *list, **addr; + void *first, *last= NULL; + LF_PINBOX *pinbox= pins->pinbox; + + LINT_INIT(first); + npins= pinbox->pins_in_array+1; + +#ifdef HAVE_ALLOCA + alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins; + /* create a sorted list of pinned addresses, to speed up searches */ + if (available_stack_size(&pinbox, *pins->stack_ends_here) > alloca_size) + { + struct st_harvester hv; + addr= (void **) alloca(alloca_size); + hv.granary= addr; + hv.npins= npins; + /* scan the dynarray and accumulate all pinned addresses */ + _lf_dynarray_iterate(&pinbox->pinarray, + (lf_dynarray_func)harvest_pins, &hv); + + npins= hv.granary-addr; + /* and sort them */ + if (npins) + qsort(addr, npins, sizeof(void *), (qsort_cmp)ptr_cmp); + } + else +#endif + addr= 0; + + list= pins->purgatory; + pins->purgatory= 0; + pins->purgatory_count= 0; + while (list) + { + void *cur= list; + list= *(void **)((char *)cur+pinbox->free_ptr_offset); + if (npins) + { + if (addr) /* use binary search */ + { + void **a, **b, **c; + for (a= addr, b= addr+npins-1, c= a+(b-a)/2; (b-a) > 1; c= a+(b-a)/2) + if (cur == *c) + a= b= c; + else if (cur > *c) + a= c; + else + b= c; + if (cur == *a || cur == *b) + goto found; + } + else /* no alloca - no cookie. linear search here */ + { + if (_lf_dynarray_iterate(&pinbox->pinarray, + (lf_dynarray_func)match_pins, cur)) + goto found; + } + } + /* not pinned - freeing */ + if (last) + last= next_node(pinbox, last)= (uchar *)cur; + else + first= last= (uchar *)cur; + continue; +found: + /* pinned - keeping */ + add_to_purgatory(pins, cur); + } + if (last) + pinbox->free_func(first, last, pinbox->free_func_arg); +} + +/* lock-free memory allocator for fixed-size objects */ + +LF_REQUIRE_PINS(1) + +/* + callback for _lf_pinbox_real_free to free a list of unpinned objects - + add it back to the allocator stack + + DESCRIPTION + 'first' and 'last' are the ends of the linked list of nodes: + first->el->el->....->el->last. Use first==last to free only one element. +*/ +static void alloc_free(uchar *first, + uchar volatile *last, + LF_ALLOCATOR *allocator) +{ + /* + we need a union here to access type-punned pointer reliably. + otherwise gcc -fstrict-aliasing will not see 'tmp' changed in the loop + */ + union { uchar * node; void *ptr; } tmp; + tmp.node= allocator->top; + do + { + anext_node(last)= tmp.node; + } while (!my_atomic_casptr((void **)(char *)&allocator->top, + (void **)&tmp.ptr, first) && LF_BACKOFF); +} + +/* + initialize lock-free allocator + + SYNOPSYS + allocator - + size a size of an object to allocate + free_ptr_offset an offset inside the object to a sizeof(void *) + memory that is guaranteed to be unused after + the object is put in the purgatory. Unused by ANY + thread, not only the purgatory owner. + This memory will be used to link waiting-to-be-freed + objects in a purgatory list. +*/ +void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset) +{ + lf_pinbox_init(&allocator->pinbox, free_ptr_offset, + (lf_pinbox_free_func *)alloc_free, allocator); + allocator->top= 0; + allocator->mallocs= 0; + allocator->element_size= size; + allocator->constructor= 0; + allocator->destructor= 0; + DBUG_ASSERT(size >= sizeof(void*) + free_ptr_offset); +} + +/* + destroy the allocator, free everything that's in it + + NOTE + As every other init/destroy function here and elsewhere it + is not thread safe. No, this function is no different, ensure + that no thread needs the allocator before destroying it. + We are not responsible for any damage that may be caused by + accessing the allocator when it is being or has been destroyed. + Oh yes, and don't put your cat in a microwave. +*/ +void lf_alloc_destroy(LF_ALLOCATOR *allocator) +{ + uchar *node= allocator->top; + while (node) + { + uchar *tmp= anext_node(node); + if (allocator->destructor) + allocator->destructor(node); + my_free((void *)node, MYF(0)); + node= tmp; + } + lf_pinbox_destroy(&allocator->pinbox); + allocator->top= 0; +} + +/* + Allocate and return an new object. + + DESCRIPTION + Pop an unused object from the stack or malloc it is the stack is empty. + pin[0] is used, it's removed on return. +*/ +void *_lf_alloc_new(LF_PINS *pins) +{ + LF_ALLOCATOR *allocator= (LF_ALLOCATOR *)(pins->pinbox->free_func_arg); + uchar *node; + for (;;) + { + do + { + node= allocator->top; + _lf_pin(pins, 0, node); + } while (node != allocator->top && LF_BACKOFF); + if (!node) + { + node= (void *)my_malloc(allocator->element_size, MYF(MY_WME)); + if (allocator->constructor) + allocator->constructor(node); +#ifdef MY_LF_EXTRA_DEBUG + if (likely(node != 0)) + my_atomic_add32(&allocator->mallocs, 1); +#endif + break; + } + if (my_atomic_casptr((void **)(char *)&allocator->top, + (void *)&node, anext_node(node))) + break; + } + _lf_unpin(pins, 0); + return node; +} + +/* + count the number of objects in a pool. + + NOTE + This is NOT thread-safe !!! +*/ +uint lf_alloc_pool_count(LF_ALLOCATOR *allocator) +{ + uint i; + uchar *node; + for (node= allocator->top, i= 0; node; node= anext_node(node), i++) + /* no op */; + return i; +} + diff --git a/externals/mysql/mysys/lf_dynarray.c b/externals/mysql/mysys/lf_dynarray.c new file mode 100644 index 0000000..b1cdce6 --- /dev/null +++ b/externals/mysql/mysys/lf_dynarray.c @@ -0,0 +1,207 @@ +/* Copyright (C) 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Analog of DYNAMIC_ARRAY that never reallocs + (so no pointer into the array may ever become invalid). + + Memory is allocated in non-contiguous chunks. + This data structure is not space efficient for sparse arrays. + + Every element is aligned to sizeof(element) boundary + (to avoid false sharing if element is big enough). + + LF_DYNARRAY is a recursive structure. On the zero level + LF_DYNARRAY::level[0] it's an array of LF_DYNARRAY_LEVEL_LENGTH elements, + on the first level it's an array of LF_DYNARRAY_LEVEL_LENGTH pointers + to arrays of elements, on the second level it's an array of pointers + to arrays of pointers to arrays of elements. And so on. + + With four levels the number of elements is limited to 4311810304 + (but as in all functions index is uint, the real limit is 2^32-1) + + Actually, it's wait-free, not lock-free ;-) +*/ + +#include +#include +#include +#include + +void lf_dynarray_init(LF_DYNARRAY *array, uint element_size) +{ + bzero(array, sizeof(*array)); + array->size_of_element= element_size; + my_atomic_rwlock_init(&array->lock); +} + +static void recursive_free(void **alloc, int level) +{ + if (!alloc) + return; + + if (level) + { + int i; + for (i= 0; i < LF_DYNARRAY_LEVEL_LENGTH; i++) + recursive_free(alloc[i], level-1); + my_free((void *)alloc, MYF(0)); + } + else + my_free(alloc[-1], MYF(0)); +} + +void lf_dynarray_destroy(LF_DYNARRAY *array) +{ + int i; + for (i= 0; i < LF_DYNARRAY_LEVELS; i++) + recursive_free(array->level[i], i); + my_atomic_rwlock_destroy(&array->lock); +} + +static const ulong dynarray_idxes_in_prev_levels[LF_DYNARRAY_LEVELS]= +{ + 0, /* +1 here to to avoid -1's below */ + LF_DYNARRAY_LEVEL_LENGTH, + LF_DYNARRAY_LEVEL_LENGTH * LF_DYNARRAY_LEVEL_LENGTH + + LF_DYNARRAY_LEVEL_LENGTH, + LF_DYNARRAY_LEVEL_LENGTH * LF_DYNARRAY_LEVEL_LENGTH * + LF_DYNARRAY_LEVEL_LENGTH + LF_DYNARRAY_LEVEL_LENGTH * + LF_DYNARRAY_LEVEL_LENGTH + LF_DYNARRAY_LEVEL_LENGTH +}; + +static const ulong dynarray_idxes_in_prev_level[LF_DYNARRAY_LEVELS]= +{ + 0, /* +1 here to to avoid -1's below */ + LF_DYNARRAY_LEVEL_LENGTH, + LF_DYNARRAY_LEVEL_LENGTH * LF_DYNARRAY_LEVEL_LENGTH, + LF_DYNARRAY_LEVEL_LENGTH * LF_DYNARRAY_LEVEL_LENGTH * + LF_DYNARRAY_LEVEL_LENGTH, +}; + +/* + Returns a valid lvalue pointer to the element number 'idx'. + Allocates memory if necessary. +*/ +void *_lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx) +{ + void * ptr, * volatile * ptr_ptr= 0; + int i; + + for (i= LF_DYNARRAY_LEVELS-1; idx < dynarray_idxes_in_prev_levels[i]; i--) + /* no-op */; + ptr_ptr= &array->level[i]; + idx-= dynarray_idxes_in_prev_levels[i]; + for (; i > 0; i--) + { + if (!(ptr= *ptr_ptr)) + { + void *alloc= my_malloc(LF_DYNARRAY_LEVEL_LENGTH * sizeof(void *), + MYF(MY_WME|MY_ZEROFILL)); + if (unlikely(!alloc)) + return(NULL); + if (my_atomic_casptr(ptr_ptr, &ptr, alloc)) + ptr= alloc; + else + my_free(alloc, MYF(0)); + } + ptr_ptr= ((void **)ptr) + idx / dynarray_idxes_in_prev_level[i]; + idx%= dynarray_idxes_in_prev_level[i]; + } + if (!(ptr= *ptr_ptr)) + { + uchar *alloc, *data; + alloc= my_malloc(LF_DYNARRAY_LEVEL_LENGTH * array->size_of_element + + max(array->size_of_element, sizeof(void *)), + MYF(MY_WME|MY_ZEROFILL)); + if (unlikely(!alloc)) + return(NULL); + /* reserve the space for free() address */ + data= alloc + sizeof(void *); + { /* alignment */ + intptr mod= ((intptr)data) % array->size_of_element; + if (mod) + data+= array->size_of_element - mod; + } + ((void **)data)[-1]= alloc; /* free() will need the original pointer */ + if (my_atomic_casptr(ptr_ptr, &ptr, data)) + ptr= data; + else + my_free(alloc, MYF(0)); + } + return ((uchar*)ptr) + array->size_of_element * idx; +} + +/* + Returns a pointer to the element number 'idx' + or NULL if an element does not exists +*/ +void *_lf_dynarray_value(LF_DYNARRAY *array, uint idx) +{ + void * ptr, * volatile * ptr_ptr= 0; + int i; + + for (i= LF_DYNARRAY_LEVELS-1; idx < dynarray_idxes_in_prev_levels[i]; i--) + /* no-op */; + ptr_ptr= &array->level[i]; + idx-= dynarray_idxes_in_prev_levels[i]; + for (; i > 0; i--) + { + if (!(ptr= *ptr_ptr)) + return(NULL); + ptr_ptr= ((void **)ptr) + idx / dynarray_idxes_in_prev_level[i]; + idx %= dynarray_idxes_in_prev_level[i]; + } + if (!(ptr= *ptr_ptr)) + return(NULL); + return ((uchar*)ptr) + array->size_of_element * idx; +} + +static int recursive_iterate(LF_DYNARRAY *array, void *ptr, int level, + lf_dynarray_func func, void *arg) +{ + int res, i; + if (!ptr) + return 0; + if (!level) + return func(ptr, arg); + for (i= 0; i < LF_DYNARRAY_LEVEL_LENGTH; i++) + if ((res= recursive_iterate(array, ((void **)ptr)[i], level-1, func, arg))) + return res; + return 0; +} + +/* + Calls func(array, arg) on every array of LF_DYNARRAY_LEVEL_LENGTH elements + in lf_dynarray. + + DESCRIPTION + lf_dynarray consists of a set of arrays, LF_DYNARRAY_LEVEL_LENGTH elements + each. _lf_dynarray_iterate() calls user-supplied function on every array + from the set. It is the fastest way to scan the array, faster than + for (i=0; i < N; i++) { func(_lf_dynarray_value(dynarray, i)); } + + NOTE + if func() returns non-zero, the scan is aborted +*/ +int _lf_dynarray_iterate(LF_DYNARRAY *array, lf_dynarray_func func, void *arg) +{ + int i, res; + for (i= 0; i < LF_DYNARRAY_LEVELS; i++) + if ((res= recursive_iterate(array, array->level[i], i, func, arg))) + return res; + return 0; +} + diff --git a/externals/mysql/mysys/lf_hash.c b/externals/mysql/mysys/lf_hash.c new file mode 100644 index 0000000..f478196 --- /dev/null +++ b/externals/mysql/mysys/lf_hash.c @@ -0,0 +1,505 @@ +/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + extensible hash + + TODO + try to get rid of dummy nodes ? + for non-unique hash, count only _distinct_ values + (but how to do it in lf_hash_delete ?) +*/ +#include +#include +#include +#include +#include + +LF_REQUIRE_PINS(3) + +/* An element of the list */ +typedef struct { + intptr volatile link; /* a pointer to the next element in a listand a flag */ + uint32 hashnr; /* reversed hash number, for sorting */ + const uchar *key; + size_t keylen; + /* + data is stored here, directly after the keylen. + thus the pointer to data is (void*)(slist_element_ptr+1) + */ +} LF_SLIST; + +const int LF_HASH_OVERHEAD= sizeof(LF_SLIST); + +/* + a structure to pass the context (pointers two the three successive elements + in a list) from lfind to linsert/ldelete +*/ +typedef struct { + intptr volatile *prev; + LF_SLIST *curr, *next; +} CURSOR; + +/* + the last bit in LF_SLIST::link is a "deleted" flag. + the helper macros below convert it to a pure pointer or a pure flag +*/ +#define PTR(V) (LF_SLIST *)((V) & (~(intptr)1)) +#define DELETED(V) ((V) & 1) + +/* + DESCRIPTION + Search for hashnr/key/keylen in the list starting from 'head' and + position the cursor. The list is ORDER BY hashnr, key + + RETURN + 0 - not found + 1 - found + + NOTE + cursor is positioned in either case + pins[0..2] are used, they are NOT removed on return +*/ +static int lfind(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, + const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins) +{ + uint32 cur_hashnr; + const uchar *cur_key; + uint cur_keylen; + intptr link; + +retry: + cursor->prev= (intptr *)head; + do { /* PTR() isn't necessary below, head is a dummy node */ + cursor->curr= (LF_SLIST *)(*cursor->prev); + _lf_pin(pins, 1, cursor->curr); + } while (*cursor->prev != (intptr)cursor->curr && LF_BACKOFF); + for (;;) + { + if (unlikely(!cursor->curr)) + return 0; /* end of the list */ + do { + /* QQ: XXX or goto retry ? */ + link= cursor->curr->link; + cursor->next= PTR(link); + _lf_pin(pins, 0, cursor->next); + } while (link != cursor->curr->link && LF_BACKOFF); + cur_hashnr= cursor->curr->hashnr; + cur_key= cursor->curr->key; + cur_keylen= cursor->curr->keylen; + if (*cursor->prev != (intptr)cursor->curr) + { + (void)LF_BACKOFF; + goto retry; + } + if (!DELETED(link)) + { + if (cur_hashnr >= hashnr) + { + int r= 1; + if (cur_hashnr > hashnr || + (r= my_strnncoll(cs, (uchar*) cur_key, cur_keylen, (uchar*) key, + keylen)) >= 0) + return !r; + } + cursor->prev= &(cursor->curr->link); + _lf_pin(pins, 2, cursor->curr); + } + else + { + /* + we found a deleted node - be nice, help the other thread + and remove this deleted node + */ + if (my_atomic_casptr((void **)cursor->prev, + (void **)&cursor->curr, cursor->next)) + _lf_alloc_free(pins, cursor->curr); + else + { + (void)LF_BACKOFF; + goto retry; + } + } + cursor->curr= cursor->next; + _lf_pin(pins, 1, cursor->curr); + } +} + +/* + DESCRIPTION + insert a 'node' in the list that starts from 'head' in the correct + position (as found by lfind) + + RETURN + 0 - inserted + not 0 - a pointer to a duplicate (not pinned and thus unusable) + + NOTE + it uses pins[0..2], on return all pins are removed. + if there're nodes with the same key value, a new node is added before them. +*/ +static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs, + LF_SLIST *node, LF_PINS *pins, uint flags) +{ + CURSOR cursor; + int res; + + for (;;) + { + if (lfind(head, cs, node->hashnr, node->key, node->keylen, + &cursor, pins) && + (flags & LF_HASH_UNIQUE)) + { + res= 0; /* duplicate found */ + break; + } + else + { + node->link= (intptr)cursor.curr; + DBUG_ASSERT(node->link != (intptr)node); /* no circular references */ + DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */ + if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node)) + { + res= 1; /* inserted ok */ + break; + } + } + } + _lf_unpin(pins, 0); + _lf_unpin(pins, 1); + _lf_unpin(pins, 2); + /* + Note that cursor.curr is not pinned here and the pointer is unreliable, + the object may dissapear anytime. But if it points to a dummy node, the + pointer is safe, because dummy nodes are never freed - initialize_bucket() + uses this fact. + */ + return res ? 0 : cursor.curr; +} + +/* + DESCRIPTION + deletes a node as identified by hashnr/keey/keylen from the list + that starts from 'head' + + RETURN + 0 - ok + 1 - not found + + NOTE + it uses pins[0..2], on return all pins are removed. +*/ +static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr, + const uchar *key, uint keylen, LF_PINS *pins) +{ + CURSOR cursor; + int res; + + for (;;) + { + if (!lfind(head, cs, hashnr, key, keylen, &cursor, pins)) + { + res= 1; /* not found */ + break; + } + else + { + /* mark the node deleted */ + if (my_atomic_casptr((void **)&(cursor.curr->link), + (void **)&cursor.next, + (void *)(((intptr)cursor.next) | 1))) + { + /* and remove it from the list */ + if (my_atomic_casptr((void **)cursor.prev, + (void **)&cursor.curr, cursor.next)) + _lf_alloc_free(pins, cursor.curr); + else + { + /* + somebody already "helped" us and removed the node ? + Let's check if we need to help that someone too! + (to ensure the number of "set DELETED flag" actions + is equal to the number of "remove from the list" actions) + */ + lfind(head, cs, hashnr, key, keylen, &cursor, pins); + } + res= 0; + break; + } + } + } + _lf_unpin(pins, 0); + _lf_unpin(pins, 1); + _lf_unpin(pins, 2); + return res; +} + +/* + DESCRIPTION + searches for a node as identified by hashnr/keey/keylen in the list + that starts from 'head' + + RETURN + 0 - not found + node - found + + NOTE + it uses pins[0..2], on return the pin[2] keeps the node found + all other pins are removed. +*/ +static LF_SLIST *lsearch(LF_SLIST * volatile *head, CHARSET_INFO *cs, + uint32 hashnr, const uchar *key, uint keylen, + LF_PINS *pins) +{ + CURSOR cursor; + int res= lfind(head, cs, hashnr, key, keylen, &cursor, pins); + if (res) + _lf_pin(pins, 2, cursor.curr); + _lf_unpin(pins, 0); + _lf_unpin(pins, 1); + return res ? cursor.curr : 0; +} + +static inline const uchar* hash_key(const LF_HASH *hash, + const uchar *record, size_t *length) +{ + if (hash->get_key) + return (*hash->get_key)(record, length, 0); + *length= hash->key_length; + return record + hash->key_offset; +} + +/* + Compute the hash key value from the raw key. + + @note, that the hash value is limited to 2^31, because we need one + bit to distinguish between normal and dummy nodes. +*/ +static inline uint calc_hash(LF_HASH *hash, const uchar *key, uint keylen) +{ + ulong nr1= 1, nr2= 4; + hash->charset->coll->hash_sort(hash->charset, (uchar*) key, keylen, + &nr1, &nr2); + return nr1 & INT_MAX32; +} + +#define MAX_LOAD 1.0 /* average number of elements in a bucket */ + +static int initialize_bucket(LF_HASH *, LF_SLIST * volatile*, uint, LF_PINS *); + +/* + Initializes lf_hash, the arguments are compatible with hash_init + + @note element_size sets both the size of allocated memory block for + lf_alloc and a size of memcpy'ed block size in lf_hash_insert. Typically + they are the same, indeed. But LF_HASH::element_size can be decreased + after lf_hash_init, and then lf_alloc will allocate larger block that + lf_hash_insert will copy over. It is desireable if part of the element + is expensive to initialize - for example if there is a mutex or + DYNAMIC_ARRAY. In this case they should be initialize in the + LF_ALLOCATOR::constructor, and lf_hash_insert should not overwrite them. + See wt_init() for example. +*/ +void lf_hash_init(LF_HASH *hash, uint element_size, uint flags, + uint key_offset, uint key_length, my_hash_get_key get_key, + CHARSET_INFO *charset) +{ + lf_alloc_init(&hash->alloc, sizeof(LF_SLIST)+element_size, + offsetof(LF_SLIST, key)); + lf_dynarray_init(&hash->array, sizeof(LF_SLIST *)); + hash->size= 1; + hash->count= 0; + hash->element_size= element_size; + hash->flags= flags; + hash->charset= charset ? charset : &my_charset_bin; + hash->key_offset= key_offset; + hash->key_length= key_length; + hash->get_key= get_key; + DBUG_ASSERT(get_key ? !key_offset && !key_length : key_length); +} + +void lf_hash_destroy(LF_HASH *hash) +{ + LF_SLIST *el, **head= (LF_SLIST **)_lf_dynarray_value(&hash->array, 0); + + if (unlikely(!head)) + return; + el= *head; + + while (el) + { + intptr next= el->link; + if (el->hashnr & 1) + lf_alloc_direct_free(&hash->alloc, el); /* normal node */ + else + my_free((void *)el, MYF(0)); /* dummy node */ + el= (LF_SLIST *)next; + } + lf_alloc_destroy(&hash->alloc); + lf_dynarray_destroy(&hash->array); +} + +/* + DESCRIPTION + inserts a new element to a hash. it will have a _copy_ of + data, not a pointer to it. + + RETURN + 0 - inserted + 1 - didn't (unique key conflict) + -1 - out of memory + + NOTE + see linsert() for pin usage notes +*/ +int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data) +{ + int csize, bucket, hashnr; + LF_SLIST *node, * volatile *el; + + lf_rwlock_by_pins(pins); + node= (LF_SLIST *)_lf_alloc_new(pins); + if (unlikely(!node)) + return -1; + memcpy(node+1, data, hash->element_size); + node->key= hash_key(hash, (uchar *)(node+1), &node->keylen); + hashnr= calc_hash(hash, node->key, node->keylen); + bucket= hashnr % hash->size; + el= _lf_dynarray_lvalue(&hash->array, bucket); + if (unlikely(!el)) + return -1; + if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) + return -1; + node->hashnr= my_reverse_bits(hashnr) | 1; /* normal node */ + if (linsert(el, hash->charset, node, pins, hash->flags)) + { + _lf_alloc_free(pins, node); + lf_rwunlock_by_pins(pins); + return 1; + } + csize= hash->size; + if ((my_atomic_add32(&hash->count, 1)+1.0) / csize > MAX_LOAD) + my_atomic_cas32(&hash->size, &csize, csize*2); + lf_rwunlock_by_pins(pins); + return 0; +} + +/* + DESCRIPTION + deletes an element with the given key from the hash (if a hash is + not unique and there're many elements with this key - the "first" + matching element is deleted) + RETURN + 0 - deleted + 1 - didn't (not found) + -1 - out of memory + NOTE + see ldelete() for pin usage notes +*/ +int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) +{ + LF_SLIST * volatile *el; + uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen); + + bucket= hashnr % hash->size; + lf_rwlock_by_pins(pins); + el= _lf_dynarray_lvalue(&hash->array, bucket); + if (unlikely(!el)) + return -1; + /* + note that we still need to initialize_bucket here, + we cannot return "node not found", because an old bucket of that + node may've been split and the node was assigned to a new bucket + that was never accessed before and thus is not initialized. + */ + if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) + return -1; + if (ldelete(el, hash->charset, my_reverse_bits(hashnr) | 1, + (uchar *)key, keylen, pins)) + { + lf_rwunlock_by_pins(pins); + return 1; + } + my_atomic_add32(&hash->count, -1); + lf_rwunlock_by_pins(pins); + return 0; +} + +/* + RETURN + a pointer to an element with the given key (if a hash is not unique and + there're many elements with this key - the "first" matching element) + NULL if nothing is found + MY_ERRPTR if OOM + + NOTE + see lsearch() for pin usage notes +*/ +void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen) +{ + LF_SLIST * volatile *el, *found; + uint bucket, hashnr= calc_hash(hash, (uchar *)key, keylen); + + bucket= hashnr % hash->size; + lf_rwlock_by_pins(pins); + el= _lf_dynarray_lvalue(&hash->array, bucket); + if (unlikely(!el)) + return MY_ERRPTR; + if (*el == NULL && unlikely(initialize_bucket(hash, el, bucket, pins))) + return MY_ERRPTR; + found= lsearch(el, hash->charset, my_reverse_bits(hashnr) | 1, + (uchar *)key, keylen, pins); + lf_rwunlock_by_pins(pins); + return found ? found+1 : 0; +} + +static const uchar *dummy_key= (uchar*)""; + +/* + RETURN + 0 - ok + -1 - out of memory +*/ +static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node, + uint bucket, LF_PINS *pins) +{ + uint parent= my_clear_highest_bit(bucket); + LF_SLIST *dummy= (LF_SLIST *)my_malloc(sizeof(LF_SLIST), MYF(MY_WME)); + LF_SLIST **tmp= 0, *cur; + LF_SLIST * volatile *el= _lf_dynarray_lvalue(&hash->array, parent); + if (unlikely(!el || !dummy)) + return -1; + if (*el == NULL && bucket && + unlikely(initialize_bucket(hash, el, parent, pins))) + return -1; + dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */ + dummy->key= dummy_key; + dummy->keylen= 0; + if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE))) + { + my_free((void *)dummy, MYF(0)); + dummy= cur; + } + my_atomic_casptr((void **)node, (void **)&tmp, dummy); + /* + note that if the CAS above failed (after linsert() succeeded), + it would mean that some other thread has executed linsert() for + the same dummy node, its linsert() failed, it picked up our + dummy node (in "dummy= cur") and executed the same CAS as above. + Which means that even if CAS above failed we don't need to retry, + and we should not free(dummy) - there's no memory leak here + */ + return 0; +} diff --git a/externals/mysql/mysys/list.c b/externals/mysql/mysys/list.c new file mode 100644 index 0000000..75678af --- /dev/null +++ b/externals/mysql/mysys/list.c @@ -0,0 +1,114 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Code for handling dubble-linked lists in C +*/ + +#include "mysys_priv.h" +#include + + + + /* Add a element to start of list */ + +LIST *list_add(LIST *root, LIST *element) +{ + DBUG_ENTER("list_add"); + DBUG_PRINT("enter",("root: %p element: %p", root, element)); + if (root) + { + if (root->prev) /* If add in mid of list */ + root->prev->next= element; + element->prev=root->prev; + root->prev=element; + } + else + element->prev=0; + element->next=root; + DBUG_RETURN(element); /* New root */ +} + + +LIST *list_delete(LIST *root, LIST *element) +{ + if (element->prev) + element->prev->next=element->next; + else + root=element->next; + if (element->next) + element->next->prev=element->prev; + return root; +} + + +void list_free(LIST *root, uint free_data) +{ + LIST *next; + while (root) + { + next=root->next; + if (free_data) + my_free((uchar*) root->data,MYF(0)); + my_free((uchar*) root,MYF(0)); + root=next; + } +} + + +LIST *list_cons(void *data, LIST *list) +{ + LIST *new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE)); + if (!new_charset) + return 0; + new_charset->data=data; + return list_add(list,new_charset); +} + + +LIST *list_reverse(LIST *root) +{ + LIST *last; + + last=root; + while (root) + { + last=root; + root=root->next; + last->next=last->prev; + last->prev=root; + } + return last; +} + +uint list_length(LIST *list) +{ + uint count; + for (count=0 ; list ; list=list->next, count++) ; + return count; +} + + +int list_walk(LIST *list, list_walk_action action, uchar* argument) +{ + int error=0; + while (list) + { + if ((error = (*action)(list->data,argument))) + return error; + list=list_rest(list); + } + return 0; +} diff --git a/externals/mysql/mysys/make-conf.c b/externals/mysql/mysys/make-conf.c new file mode 100644 index 0000000..0dacde4 --- /dev/null +++ b/externals/mysql/mysys/make-conf.c @@ -0,0 +1,71 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* make-conf.c + * make a charset .conf file out of a ctype-charset.c file. + */ + +#ifndef CHARSET +#error You must define the charset, e.g.: -DCHARSET=latin1 +#endif + +/* some pre-processor tricks to get us going */ +#define _STRINGIZE_HELPER(x) #x +#define STRINGIZE(x) _STRINGIZE_HELPER(x) + +#define _JOIN_WORDS_HELPER(a, b) a ## b +#define JOIN_WORDS(a, b) _JOIN_WORDS_HELPER(a, b) + +#define CH_SRC ctype- ## CHARSET ## .c +#define CH_INCLUDE STRINGIZE(CH_SRC) + +/* aaaah, that's better */ +#include +#include CH_INCLUDE + +#include +#include + +#define ROW_LEN 16 + +void print_array(const char *name, const uchar *array, uint size); + +int main(void) +{ + printf("# Configuration file for the " + STRINGIZE(CHARSET) + " character set.\n"); + + print_array("ctype", JOIN_WORDS(ctype_, CHARSET), 257); + print_array("to_lower", JOIN_WORDS(to_lower_, CHARSET), 256); + print_array("to_upper", JOIN_WORDS(to_upper_, CHARSET), 256); + print_array("sort_order", JOIN_WORDS(sort_order_, CHARSET), 256); + + exit(EXIT_SUCCESS); +} + +void print_array(const char *name, const uchar *array, uint size) +{ + uint i; + + printf("\n# The %s array must have %d elements.\n", name, size); + + for (i = 0; i < size; ++i) { + printf(" %02X", array[i]); + + if ((i+1) % ROW_LEN == size % ROW_LEN) + printf("\n"); + } +} diff --git a/externals/mysql/mysys/md5.c b/externals/mysql/mysys/md5.c new file mode 100644 index 0000000..2388ceb --- /dev/null +++ b/externals/mysql/mysys/md5.c @@ -0,0 +1,325 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + +/* This code was modified in 1997 by Jim Kingdon of Cyclic Software to + not require an integer type which is exactly 32 bits. This work + draws on the changes for the same purpose by Tatu Ylonen + as part of SSH, but since I didn't actually use + that code, there is no copyright issue. I hereby disclaim + copyright in any changes I have made; this code remains in the + public domain. */ + +#include +#include +#include "my_md5.h" + +#include /* for memcpy() and memset() */ + + +static void +my_MD5Transform (cvs_uint32 buf[4], const unsigned char in[64]); + +/* Little-endian byte-swapping routines. Note that these do not + depend on the size of datatypes such as uint32, nor do they require + us to detect the endianness of the machine we are running on. It + is possible they should be macros for speed, but I would be + surprised if they were a performance bottleneck for MD5. */ + +static uint32 getu32 (const unsigned char *addr) +{ + return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) + | addr[1]) << 8 | addr[0]; +} + +static void +putu32 (uint32 data, unsigned char *addr) +{ + addr[0] = (unsigned char)data; + addr[1] = (unsigned char)(data >> 8); + addr[2] = (unsigned char)(data >> 16); + addr[3] = (unsigned char)(data >> 24); +} + +/* + Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + initialization constants. +*/ +void +my_MD5Init (my_MD5Context *ctx) +{ + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bits[0] = 0; + ctx->bits[1] = 0; +} + +/* + Update context to reflect the concatenation of another buffer full + of bytes. +*/ +void +my_MD5Update (my_MD5Context *ctx, unsigned char const *buf, unsigned len) +{ + uint32 t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = (t + ((uint32)len << 3)) & 0xffffffff) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + + /* Handle any leading odd-sized chunks */ + + if ( t ) { + unsigned char *p = ctx->in + t; + + t = 64-t; + if (len < t) { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + my_MD5Transform (ctx->buf, ctx->in); + buf += t; + len -= t; + } + + /* Process data in 64-byte chunks */ + + while (len >= 64) { + memcpy(ctx->in, buf, 64); + my_MD5Transform (ctx->buf, ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + + memcpy(ctx->in, buf, len); +} + +/* + Final wrapup - pad to 64-byte boundary with the bit pattern + 1 0* (64-bit count of bits processed, MSB-first) +*/ +void +my_MD5Final (unsigned char digest[16], my_MD5Context *ctx) +{ + unsigned count; + unsigned char *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + my_MD5Transform (ctx->buf, ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } else { + /* Pad block to 56 bytes */ + memset(p, 0, count-8); + } + + /* Append length in bits and transform */ + putu32(ctx->bits[0], ctx->in + 56); + putu32(ctx->bits[1], ctx->in + 60); + + my_MD5Transform (ctx->buf, ctx->in); + putu32(ctx->buf[0], digest); + putu32(ctx->buf[1], digest + 4); + putu32(ctx->buf[2], digest + 8); + putu32(ctx->buf[3], digest + 12); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ +} + +#ifndef ASM_MD5 + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +static void +my_MD5Transform (uint32 buf[4], const unsigned char inraw[64]) +{ + register uint32 a, b, c, d; + uint32 in[16]; + int i; + + for (i = 0; i < 16; ++i) + in[i] = getu32 (inraw + 4 * i); + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} +#endif + +#ifdef TEST +/* + Simple test program. Can use it to manually run the tests from + RFC1321 for example. +*/ +#include + +int +main (int argc, char **argv) +{ + my_MD5Context context; + unsigned char checksum[16]; + int i; + int j; + + if (argc < 2) + { + fprintf (stderr, "usage: %s string-to-hash\n", argv[0]); + exit (1); + } + for (j = 1; j < argc; ++j) + { + printf ("MD5 (\"%s\") = ", argv[j]); + my_MD5Init (&context); + my_MD5Update (&context, argv[j], strlen (argv[j])); + my_MD5Final (checksum, &context); + for (i = 0; i < 16; i++) + { + printf ("%02x", (unsigned int) checksum[i]); + } + printf ("\n"); + } + return 0; +} +#endif /* TEST */ diff --git a/externals/mysql/mysys/mf_arr_appstr.c b/externals/mysql/mysys/mf_arr_appstr.c new file mode 100644 index 0000000..1edbea9 --- /dev/null +++ b/externals/mysql/mysys/mf_arr_appstr.c @@ -0,0 +1,61 @@ +/* Copyright (C) 2007 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include /* strcmp() */ + + +/** + Append str to array, or move to the end if it already exists + + @param str String to be appended + @param array The array, terminated by a NULL element, all unused elements + pre-initialized to NULL + @param size Size of the array; array must be terminated by a NULL + pointer, so can hold size - 1 elements + + @retval FALSE Success + @retval TRUE Failure, array is full +*/ + +my_bool array_append_string_unique(const char *str, + const char **array, size_t size) +{ + const char **p; + /* end points at the terminating NULL element */ + const char **end= array + size - 1; + DBUG_ASSERT(*end == NULL); + + for (p= array; *p; ++p) + { + if (strcmp(*p, str) == 0) + break; + } + if (p >= end) + return TRUE; /* Array is full */ + + DBUG_ASSERT(*p == NULL || strcmp(*p, str) == 0); + + while (*(p + 1)) + { + *p= *(p + 1); + ++p; + } + + DBUG_ASSERT(p < end); + *p= str; + + return FALSE; /* Success */ +} diff --git a/externals/mysql/mysys/mf_brkhant.c b/externals/mysql/mysys/mf_brkhant.c new file mode 100644 index 0000000..3573b99 --- /dev/null +++ b/externals/mysql/mysys/mf_brkhant.c @@ -0,0 +1,72 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Dont let the user break when you are doing something important */ +/* Remembers if it got 'SIGINT' and executes it on allow_break */ +/* A static buffer is used; don't call dont_break() twice in a row */ + +#include "mysys_priv.h" +#include "my_static.h" + + /* Set variable that we can't break */ + +#if !defined(THREAD) +void dont_break(void) +{ + my_dont_interrupt=1; + return; +} /* dont_break */ + +void allow_break(void) +{ + { + reg1 int index; + + my_dont_interrupt=0; + if (_my_signals) + { + if (_my_signals > MAX_SIGNALS) + _my_signals=MAX_SIGNALS; + for (index=0 ; index < _my_signals ; index++) + { + if (_my_sig_remember[index].func) /* Safequard */ + { + (*_my_sig_remember[index].func)(_my_sig_remember[index].number); + _my_sig_remember[index].func=0; + } + } + _my_signals=0; + } + } +} /* dont_break */ +#endif + + /* Set old status */ + +#if !defined(THREAD) +void my_remember_signal(int signal_number, sig_handler (*func) (int)) +{ +#ifndef __WIN__ + reg1 int index; + + index=_my_signals++; /* Nobody can break a ++ ? */ + if (index < MAX_SIGNALS) + { + _my_sig_remember[index].number=signal_number; + _my_sig_remember[index].func=func; + } +#endif /* __WIN__ */ +} /* my_remember_signal */ +#endif /* THREAD */ diff --git a/externals/mysql/mysys/mf_cache.c b/externals/mysql/mysys/mf_cache.c new file mode 100644 index 0000000..f0df0f3 --- /dev/null +++ b/externals/mysql/mysys/mf_cache.c @@ -0,0 +1,121 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Open a temporary file and cache it with io_cache. Delete it on close */ + +#include "mysys_priv.h" +#include +#include "my_static.h" +#include "mysys_err.h" + + /* + Remove an open tempfile so that it doesn't survive + if we crash; If the operating system doesn't support + this, just remember the file name for later removal + */ + +static my_bool cache_remove_open_tmp(IO_CACHE *cache __attribute__((unused)), + const char *name) +{ +#if O_TEMPORARY == 0 +#if !defined(CANT_DELETE_OPEN_FILES) + /* The following should always succeed */ + (void) my_delete(name,MYF(MY_WME | ME_NOINPUT)); +#else + int length; + if (!(cache->file_name= + (char*) my_malloc((length=strlen(name)+1),MYF(MY_WME)))) + { + my_close(cache->file,MYF(0)); + cache->file = -1; + errno=my_errno=ENOMEM; + return 1; + } + memcpy(cache->file_name,name,length); +#endif +#endif /* O_TEMPORARY == 0 */ + return 0; +} + + /* + ** Open tempfile cached by IO_CACHE + ** Should be used when no seeks are done (only reinit_io_buff) + ** Return 0 if cache is inited ok + ** The actual file is created when the IO_CACHE buffer gets filled + ** If dir is not given, use TMPDIR. + */ + +my_bool open_cached_file(IO_CACHE *cache, const char* dir, const char *prefix, + size_t cache_size, myf cache_myflags) +{ + DBUG_ENTER("open_cached_file"); + cache->dir= dir ? my_strdup(dir,MYF(cache_myflags & MY_WME)) : (char*) 0; + cache->prefix= (prefix ? my_strdup(prefix,MYF(cache_myflags & MY_WME)) : + (char*) 0); + cache->file_name=0; + cache->buffer=0; /* Mark that not open */ + if (!init_io_cache(cache,-1,cache_size,WRITE_CACHE,0L,0, + MYF(cache_myflags | MY_NABP))) + { + DBUG_RETURN(0); + } + my_free(cache->dir, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR)); + DBUG_RETURN(1); +} + + /* Create the temporary file */ + +my_bool real_open_cached_file(IO_CACHE *cache) +{ + char name_buff[FN_REFLEN]; + int error=1; + DBUG_ENTER("real_open_cached_file"); + if ((cache->file=create_temp_file(name_buff, cache->dir, cache->prefix, + (O_RDWR | O_BINARY | O_TRUNC | + O_TEMPORARY | O_SHORT_LIVED), + MYF(MY_WME))) >= 0) + { + error=0; + cache_remove_open_tmp(cache, name_buff); + } + DBUG_RETURN(error); +} + + +void close_cached_file(IO_CACHE *cache) +{ + DBUG_ENTER("close_cached_file"); + if (my_b_inited(cache)) + { + File file=cache->file; + cache->file= -1; /* Don't flush data */ + (void) end_io_cache(cache); + if (file >= 0) + { + (void) my_close(file,MYF(0)); +#ifdef CANT_DELETE_OPEN_FILES + if (cache->file_name) + { + (void) my_delete(cache->file_name,MYF(MY_WME | ME_NOINPUT)); + my_free(cache->file_name,MYF(0)); + } +#endif + } + my_free(cache->dir,MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR)); + } + DBUG_VOID_RETURN; +} diff --git a/externals/mysql/mysys/mf_dirname.c b/externals/mysql/mysys/mf_dirname.c new file mode 100644 index 0000000..1b428de --- /dev/null +++ b/externals/mysql/mysys/mf_dirname.c @@ -0,0 +1,165 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + + /* Functions definied in this file */ + +size_t dirname_length(const char *name) +{ + register char *pos, *gpos; +#ifdef BASKSLASH_MBTAIL + CHARSET_INFO *fs= fs_character_set(); +#endif +#ifdef FN_DEVCHAR + if ((pos=(char*)strrchr(name,FN_DEVCHAR)) == 0) +#endif + pos=(char*) name-1; + + gpos= pos++; + for ( ; *pos ; pos++) /* Find last FN_LIBCHAR */ + { +#ifdef BASKSLASH_MBTAIL + uint l; + if (use_mb(fs) && (l= my_ismbchar(fs, pos, pos + 3))) + { + pos+= l - 1; + continue; + } +#endif + if (*pos == FN_LIBCHAR || *pos == '/' +#ifdef FN_C_AFTER_DIR + || *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2 +#endif + ) + gpos=pos; + } + return (size_t) (gpos+1-(char*) name); +} + + +/* + Gives directory part of filename. Directory ends with '/' + + SYNOPSIS + dirname_part() + to Store directory name here + name Original name + to_length Store length of 'to' here + + RETURN + # Length of directory part in 'name' +*/ + +size_t dirname_part(char *to, const char *name, size_t *to_res_length) +{ + size_t length; + DBUG_ENTER("dirname_part"); + DBUG_PRINT("enter",("'%s'",name)); + + length=dirname_length(name); + *to_res_length= (size_t) (convert_dirname(to, name, name+length) - to); + DBUG_RETURN(length); +} /* dirname */ + + +/* + Convert directory name to use under this system + + SYNPOSIS + convert_dirname() + to Store result here. Must be at least of size + min(FN_REFLEN, strlen(from) + 1) to make room + for adding FN_LIBCHAR at the end. + from Original filename. May be == to + from_end Pointer at end of filename (normally end \0) + + IMPLEMENTATION + If MSDOS converts '/' to '\' + If VMS converts '<' to '[' and '>' to ']' + Adds a FN_LIBCHAR to end if the result string if there isn't one + and the last isn't dev_char. + Copies data from 'from' until ASCII(0) for until from == from_end + If you want to use the whole 'from' string, just send NullS as the + last argument. + + If the result string is larger than FN_REFLEN -1, then it's cut. + + RETURN + Returns pointer to end \0 in to +*/ + +#ifndef FN_DEVCHAR +#define FN_DEVCHAR '\0' /* For easier code */ +#endif + +char *convert_dirname(char *to, const char *from, const char *from_end) +{ + char *to_org=to; +#ifdef BACKSLASH_MBTAIL + CHARSET_INFO *fs= fs_character_set(); +#endif + DBUG_ENTER("convert_dirname"); + + /* We use -2 here, becasue we need place for the last FN_LIBCHAR */ + if (!from_end || (from_end - from) > FN_REFLEN-2) + from_end=from+FN_REFLEN -2; + +#if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2) + { + for (; from != from_end && *from ; from++) + { + if (*from == '/') + *to++= FN_LIBCHAR; +#ifdef FN_C_BEFORE_DIR_2 + else if (*from == FN_C_BEFORE_DIR_2) + *to++= FN_C_BEFORE_DIR; + else if (*from == FN_C_AFTER_DIR_2) + *to++= FN_C_AFTER_DIR; +#endif + else + { +#ifdef BACKSLASH_MBTAIL + uint l; + if (use_mb(fs) && (l= my_ismbchar(fs, from, from + 3))) + { + memmove(to, from, l); + to+= l; + from+= l - 1; + to_org= to; /* Don't look inside mbchar */ + } + else +#endif + { + *to++= *from; + } + } + } + *to=0; + } +#else + /* This is ok even if to == from, becasue we need to cut the string */ + to= strmake(to, from, (size_t) (from_end-from)); +#endif + + /* Add FN_LIBCHAR to the end of directory path */ + if (to != to_org && (to[-1] != FN_LIBCHAR && to[-1] != FN_DEVCHAR)) + { + *to++=FN_LIBCHAR; + *to=0; + } + DBUG_RETURN(to); /* Pointer to end of dir */ +} /* convert_dirname */ diff --git a/externals/mysql/mysys/mf_fn_ext.c b/externals/mysql/mysys/mf_fn_ext.c new file mode 100644 index 0000000..da7fac3 --- /dev/null +++ b/externals/mysql/mysys/mf_fn_ext.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "mysys_priv.h" +#include + +/* + Return a pointer to the extension of the filename. + + SYNOPSIS + fn_ext() + name Name of file + + DESCRIPTION + The extension is defined as everything after the first extension character + (normally '.') after the directory name. + + RETURN VALUES + Pointer to to the extension character. If there isn't any extension, + points at the end ASCII(0) of the filename. +*/ + +char *fn_ext(const char *name) +{ + register const char *pos, *gpos; + DBUG_ENTER("fn_ext"); + DBUG_PRINT("mfunkt",("name: '%s'",name)); + +#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL) + { + char buff[FN_REFLEN]; + size_t res_length; + gpos= name+ dirname_part(buff,(char*) name, &res_length); + } +#else + if (!(gpos= strrchr(name, FN_LIBCHAR))) + gpos= name; +#endif + pos=strchr(gpos,FN_EXTCHAR); + DBUG_RETURN((char*) (pos ? pos : strend(gpos))); +} /* fn_ext */ diff --git a/externals/mysql/mysys/mf_format.c b/externals/mysql/mysys/mf_format.c new file mode 100644 index 0000000..f199132 --- /dev/null +++ b/externals/mysql/mysys/mf_format.c @@ -0,0 +1,142 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + +/* + Formats a filename with possible replace of directory of extension + Function can handle the case where 'to' == 'name' + For a description of the flag values, consult my_sys.h + The arguments should be in unix format. +*/ + +char * fn_format(char * to, const char *name, const char *dir, + const char *extension, uint flag) +{ + char dev[FN_REFLEN], buff[FN_REFLEN], *pos, *startpos; + const char *ext; + reg1 size_t length; + size_t dev_length; + DBUG_ENTER("fn_format"); + DBUG_PRINT("enter",("name: %s dir: %s extension: %s flag: %d", + name,dir,extension,flag)); + + /* Copy and skip directory */ + name+=(length=dirname_part(dev, (startpos=(char *) name), &dev_length)); + if (length == 0 || (flag & MY_REPLACE_DIR)) + { + /* Use given directory */ + convert_dirname(dev,dir,NullS); /* Fix to this OS */ + } + else if ((flag & MY_RELATIVE_PATH) && !test_if_hard_path(dev)) + { + /* Put 'dir' before the given path */ + strmake(buff,dev,sizeof(buff)-1); + pos=convert_dirname(dev,dir,NullS); + strmake(pos,buff,sizeof(buff)-1- (int) (pos-dev)); + } + + if (flag & MY_PACK_FILENAME) + pack_dirname(dev,dev); /* Put in ./.. and ~/.. */ + if (flag & MY_UNPACK_FILENAME) + (void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */ + + if (!(flag & MY_APPEND_EXT) && + (pos= (char*) strchr(name,FN_EXTCHAR)) != NullS) + { + if ((flag & MY_REPLACE_EXT) == 0) /* If we should keep old ext */ + { + length=strlength(name); /* Use old extension */ + ext = ""; + } + else + { + length= (size_t) (pos-(char*) name); /* Change extension */ + ext= extension; + } + } + else + { + length=strlength(name); /* No ext, use the now one */ + ext=extension; + } + + if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN ) + { + /* To long path, return original or NULL */ + size_t tmp_length; + if (flag & MY_SAFE_PATH) + return NullS; + tmp_length= strlength(startpos); + DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %u",dev,ext, + (uint) length)); + (void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1)); + } + else + { + if (to == startpos) + { + bmove(buff,(uchar*) name,length); /* Save name for last copy */ + name=buff; + } + pos=strmake(strmov(to,dev),name,length); + (void) strmov(pos,ext); /* Don't convert extension */ + } + /* + If MY_RETURN_REAL_PATH and MY_RESOLVE_SYMLINK is given, only do + realpath if the file is a symbolic link + */ + if (flag & MY_RETURN_REAL_PATH) + (void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ? + MY_RESOLVE_LINK: 0)); + else if (flag & MY_RESOLVE_SYMLINKS) + { + strmov(buff,to); + (void) my_readlink(to, buff, MYF(0)); + } + DBUG_RETURN(to); +} /* fn_format */ + + +/* + strlength(const string str) + Return length of string with end-space:s not counted. +*/ + +size_t strlength(const char *str) +{ + reg1 const char * pos; + reg2 const char * found; + DBUG_ENTER("strlength"); + + pos= found= str; + + while (*pos) + { + if (*pos != ' ') + { + while (*++pos && *pos != ' ') {}; + if (!*pos) + { + found=pos; /* String ends here */ + break; + } + } + found=pos; + while (*++pos == ' ') {}; + } + DBUG_RETURN((size_t) (found - str)); +} /* strlength */ diff --git a/externals/mysql/mysys/mf_getdate.c b/externals/mysql/mysys/mf_getdate.c new file mode 100644 index 0000000..3a8e1be --- /dev/null +++ b/externals/mysql/mysys/mf_getdate.c @@ -0,0 +1,81 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Get date in a printable form: yyyy-mm-dd hh:mm:ss */ + +#include "mysys_priv.h" +#include + +/* + get date as string + + SYNOPSIS + get_date() + to - string where date will be written + flag - format of date: + If flag & GETDATE_TIME Return date and time + If flag & GETDATE_SHORT_DATE Return short date format YYMMDD + If flag & GETDATE_HHMMSSTIME Return time in HHMMDD format. + If flag & GETDATE_GMT Date/time in GMT + If flag & GETDATE_FIXEDLENGTH Return fixed length date/time + date - for conversion +*/ + + +void get_date(register char * to, int flag, time_t date) +{ + reg2 struct tm *start_time; + time_t skr; +#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT) + struct tm tm_tmp; +#endif + + skr=date ? (time_t) date : my_time(0); +#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT) + if (flag & GETDATE_GMT) + localtime_r(&skr,&tm_tmp); + else + gmtime_r(&skr,&tm_tmp); + start_time= &tm_tmp; +#else + if (flag & GETDATE_GMT) + start_time= localtime(&skr); + else + start_time= gmtime(&skr); +#endif + if (flag & GETDATE_SHORT_DATE) + sprintf(to,"%02d%02d%02d", + start_time->tm_year % 100, + start_time->tm_mon+1, + start_time->tm_mday); + else + sprintf(to, ((flag & GETDATE_FIXEDLENGTH) ? + "%4d-%02d-%02d" : "%d-%02d-%02d"), + start_time->tm_year+1900, + start_time->tm_mon+1, + start_time->tm_mday); + if (flag & GETDATE_DATE_TIME) + sprintf(strend(to), + ((flag & GETDATE_FIXEDLENGTH) ? + " %02d:%02d:%02d" : " %2d:%02d:%02d"), + start_time->tm_hour, + start_time->tm_min, + start_time->tm_sec); + else if (flag & GETDATE_HHMMSSTIME) + sprintf(strend(to),"%02d%02d%02d", + start_time->tm_hour, + start_time->tm_min, + start_time->tm_sec); +} /* get_date */ diff --git a/externals/mysql/mysys/mf_iocache.c b/externals/mysql/mysys/mf_iocache.c new file mode 100644 index 0000000..120d886 --- /dev/null +++ b/externals/mysql/mysys/mf_iocache.c @@ -0,0 +1,1967 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Cashing of files with only does (sequential) read or writes of fixed- + length records. A read isn't allowed to go over file-length. A read is ok + if it ends at file-length and next read can try to read after file-length + (and get a EOF-error). + Possibly use of asyncronic io. + macros for read and writes for faster io. + Used instead of FILE when reading or writing whole files. + This code makes mf_rec_cache obsolete (currently only used by ISAM) + One can change info->pos_in_file to a higher value to skip bytes in file if + also info->read_pos is set to info->read_end. + If called through open_cached_file(), then the temporary file will + only be created if a write exeeds the file buffer or if one calls + my_b_flush_io_cache(). + + If one uses SEQ_READ_APPEND, then two buffers are allocated, one for + reading and another for writing. Reads are first done from disk and + then done from the write buffer. This is an efficient way to read + from a log file when one is writing to it at the same time. + For this to work, the file has to be opened in append mode! + Note that when one uses SEQ_READ_APPEND, one MUST write using + my_b_append ! This is needed because we need to lock the mutex + every time we access the write buffer. + +TODO: + When one SEQ_READ_APPEND and we are reading and writing at the same time, + each time the write buffer gets full and it's written to disk, we will + always do a disk read to read a part of the buffer from disk to the + read buffer. + This should be fixed so that when we do a my_b_flush_io_cache() and + we have been reading the write buffer, we should transfer the rest of the + write buffer to the read buffer before we start to reuse it. +*/ + +#define MAP_TO_USE_RAID +#include "mysys_priv.h" +#include +#ifdef HAVE_AIOWAIT +#include "mysys_err.h" +static void my_aiowait(my_aio_result *result); +#endif +#include + +#ifdef THREAD +#define lock_append_buffer(info) \ + pthread_mutex_lock(&(info)->append_buffer_lock) +#define unlock_append_buffer(info) \ + pthread_mutex_unlock(&(info)->append_buffer_lock) +#else +#define lock_append_buffer(info) +#define unlock_append_buffer(info) +#endif + +#define IO_ROUND_UP(X) (((X)+IO_SIZE-1) & ~(IO_SIZE-1)) +#define IO_ROUND_DN(X) ( (X) & ~(IO_SIZE-1)) + +/* + Setup internal pointers inside IO_CACHE + + SYNOPSIS + setup_io_cache() + info IO_CACHE handler + + NOTES + This is called on automaticly on init or reinit of IO_CACHE + It must be called externally if one moves or copies an IO_CACHE + object. +*/ + +void setup_io_cache(IO_CACHE* info) +{ + /* Ensure that my_b_tell() and my_b_bytes_in_cache works */ + if (info->type == WRITE_CACHE) + { + info->current_pos= &info->write_pos; + info->current_end= &info->write_end; + } + else + { + info->current_pos= &info->read_pos; + info->current_end= &info->read_end; + } +} + + +static void +init_functions(IO_CACHE* info) +{ + enum cache_type type= info->type; + switch (type) { + case READ_NET: + /* + Must be initialized by the caller. The problem is that + _my_b_net_read has to be defined in sql directory because of + the dependency on THD, and therefore cannot be visible to + programs that link against mysys but know nothing about THD, such + as myisamchk + */ + break; + case SEQ_READ_APPEND: + info->read_function = _my_b_seq_read; + info->write_function = 0; /* Force a core if used */ + break; + default: + info->read_function = +#ifdef THREAD + info->share ? _my_b_read_r : +#endif + _my_b_read; + info->write_function = _my_b_write; + } + + setup_io_cache(info); +} + + +/* FUNCTIONS TO SET UP OR RESET A CACHE */ + + +/* + Initialize an IO_CACHE object + + SYNOPSOS + init_io_cache() + info cache handler to initialize + file File that should be associated to to the handler + If == -1 then real_open_cached_file() + will be called when it's time to open file. + cachesize Size of buffer to allocate for read/write + If == 0 then use my_default_record_cache_size + type Type of cache + seek_offset Where cache should start reading/writing + use_async_io Set to 1 of we should use async_io (if avaiable) + cache_myflags Bitmap of differnt flags + MY_WME | MY_FAE | MY_NABP | MY_FNABP | + MY_DONT_CHECK_FILESIZE + + RETURN + 0 ok + # error +*/ + +int init_io_cache(IO_CACHE *info, File file, size_t cachesize, + enum cache_type type, my_off_t seek_offset, + pbool use_async_io, myf cache_myflags) +{ + size_t min_cache; + my_off_t pos; + my_off_t end_of_file= ~(my_off_t) 0; + DBUG_ENTER("init_io_cache"); + DBUG_PRINT("enter",("cache: %p type: %d pos: %ld", + info, (int) type, (ulong) seek_offset)); + + info->file= file; + info->type= TYPE_NOT_SET; /* Don't set it until mutex are created */ + info->pos_in_file= seek_offset; + info->pre_close= info->pre_read= info->post_read= info->post_write= NULL; + info->arg = 0; + info->alloced_buffer = 0; + info->buffer=0; + info->seek_not_done= 0; + + if (file >= 0) + { + pos= my_tell(file, MYF(0)); + if ((pos == (my_off_t) -1) && (my_errno == ESPIPE)) + { + /* + This kind of object doesn't support seek() or tell(). Don't set a + flag that will make us again try to seek() later and fail. + */ + info->seek_not_done= 0; + /* + Additionally, if we're supposed to start somewhere other than the + the beginning of whatever this file is, then somebody made a bad + assumption. + */ + DBUG_ASSERT(seek_offset == 0); + } + else + info->seek_not_done= test(seek_offset != pos); + } + + info->disk_writes= 0; +#ifdef THREAD + info->share=0; +#endif + + if (!cachesize && !(cachesize= my_default_record_cache_size)) + DBUG_RETURN(1); /* No cache requested */ + min_cache=use_async_io ? IO_SIZE*4 : IO_SIZE*2; + if (type == READ_CACHE || type == SEQ_READ_APPEND) + { /* Assume file isn't growing */ + if (!(cache_myflags & MY_DONT_CHECK_FILESIZE)) + { + /* Calculate end of file to avoid allocating oversized buffers */ + end_of_file=my_seek(file,0L,MY_SEEK_END,MYF(0)); + /* Need to reset seek_not_done now that we just did a seek. */ + info->seek_not_done= end_of_file == seek_offset ? 0 : 1; + if (end_of_file < seek_offset) + end_of_file=seek_offset; + /* Trim cache size if the file is very small */ + if ((my_off_t) cachesize > end_of_file-seek_offset+IO_SIZE*2-1) + { + cachesize= (size_t) (end_of_file-seek_offset)+IO_SIZE*2-1; + use_async_io=0; /* No need to use async */ + } + } + } + cache_myflags &= ~MY_DONT_CHECK_FILESIZE; + if (type != READ_NET && type != WRITE_NET) + { + /* Retry allocating memory in smaller blocks until we get one */ + cachesize= ((cachesize + min_cache-1) & ~(min_cache-1)); + for (;;) + { + size_t buffer_block; + if (cachesize < min_cache) + cachesize = min_cache; + buffer_block= cachesize; + if (type == SEQ_READ_APPEND) + buffer_block *= 2; + if ((info->buffer= + (uchar*) my_malloc(buffer_block, + MYF((cache_myflags & ~ MY_WME) | + (cachesize == min_cache ? MY_WME : 0)))) != 0) + { + info->write_buffer=info->buffer; + if (type == SEQ_READ_APPEND) + info->write_buffer = info->buffer + cachesize; + info->alloced_buffer=1; + break; /* Enough memory found */ + } + if (cachesize == min_cache) + DBUG_RETURN(2); /* Can't alloc cache */ + /* Try with less memory */ + cachesize= (cachesize*3/4 & ~(min_cache-1)); + } + } + + DBUG_PRINT("info",("init_io_cache: cachesize = %lu", (ulong) cachesize)); + info->read_length=info->buffer_length=cachesize; + info->myflags=cache_myflags & ~(MY_NABP | MY_FNABP); + info->request_pos= info->read_pos= info->write_pos = info->buffer; + if (type == SEQ_READ_APPEND) + { + info->append_read_pos = info->write_pos = info->write_buffer; + info->write_end = info->write_buffer + info->buffer_length; +#ifdef THREAD + pthread_mutex_init(&info->append_buffer_lock,MY_MUTEX_INIT_FAST); +#endif + } +#if defined(SAFE_MUTEX) && defined(THREAD) + else + { + /* Clear mutex so that safe_mutex will notice that it's not initialized */ + bzero((char*) &info->append_buffer_lock, sizeof(info)); + } +#endif + + if (type == WRITE_CACHE) + info->write_end= + info->buffer+info->buffer_length- (seek_offset & (IO_SIZE-1)); + else + info->read_end=info->buffer; /* Nothing in cache */ + + /* End_of_file may be changed by user later */ + info->end_of_file= end_of_file; + info->error= info->hard_write_error_in_the_past= 0; + info->type= type; + init_functions(info); +#ifdef HAVE_AIOWAIT + if (use_async_io && ! my_disable_async_io) + { + DBUG_PRINT("info",("Using async io")); + info->read_length/=2; + info->read_function=_my_b_async_read; + } + info->inited=info->aio_result.pending=0; +#endif + DBUG_RETURN(0); +} /* init_io_cache */ + + /* Wait until current request is ready */ + +#ifdef HAVE_AIOWAIT +static void my_aiowait(my_aio_result *result) +{ + if (result->pending) + { + struct aio_result_t *tmp; + for (;;) + { + if ((int) (tmp=aiowait((struct timeval *) 0)) == -1) + { + if (errno == EINTR) + continue; + DBUG_PRINT("error",("No aio request, error: %d",errno)); + result->pending=0; /* Assume everythings is ok */ + break; + } + ((my_aio_result*) tmp)->pending=0; + if ((my_aio_result*) tmp == result) + break; + } + } + return; +} +#endif + + +/* + Use this to reset cache to re-start reading or to change the type + between READ_CACHE <-> WRITE_CACHE + If we are doing a reinit of a cache where we have the start of the file + in the cache, we are reusing this memory without flushing it to disk. +*/ + +my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, + my_off_t seek_offset, + pbool use_async_io __attribute__((unused)), + pbool clear_cache) +{ + DBUG_ENTER("reinit_io_cache"); + DBUG_PRINT("enter",("cache: %p type: %d seek_offset: %lu clear_cache: %d", + info, type, (ulong) seek_offset, + (int) clear_cache)); + + /* One can't do reinit with the following types */ + DBUG_ASSERT(type != READ_NET && info->type != READ_NET && + type != WRITE_NET && info->type != WRITE_NET && + type != SEQ_READ_APPEND && info->type != SEQ_READ_APPEND); + + /* If the whole file is in memory, avoid flushing to disk */ + if (! clear_cache && + seek_offset >= info->pos_in_file && + seek_offset <= my_b_tell(info)) + { + /* Reuse current buffer without flushing it to disk */ + uchar *pos; + if (info->type == WRITE_CACHE && type == READ_CACHE) + { + info->read_end=info->write_pos; + info->end_of_file=my_b_tell(info); + /* + Trigger a new seek only if we have a valid + file handle. + */ + info->seek_not_done= (info->file != -1); + } + else if (type == WRITE_CACHE) + { + if (info->type == READ_CACHE) + { + info->write_end=info->write_buffer+info->buffer_length; + info->seek_not_done=1; + } + info->end_of_file = ~(my_off_t) 0; + } + pos=info->request_pos+(seek_offset-info->pos_in_file); + if (type == WRITE_CACHE) + info->write_pos=pos; + else + info->read_pos= pos; +#ifdef HAVE_AIOWAIT + my_aiowait(&info->aio_result); /* Wait for outstanding req */ +#endif + } + else + { + /* + If we change from WRITE_CACHE to READ_CACHE, assume that everything + after the current positions should be ignored + */ + if (info->type == WRITE_CACHE && type == READ_CACHE) + info->end_of_file=my_b_tell(info); + /* flush cache if we want to reuse it */ + if (!clear_cache && my_b_flush_io_cache(info,1)) + DBUG_RETURN(1); + info->pos_in_file=seek_offset; + /* Better to do always do a seek */ + info->seek_not_done=1; + info->request_pos=info->read_pos=info->write_pos=info->buffer; + if (type == READ_CACHE) + { + info->read_end=info->buffer; /* Nothing in cache */ + } + else + { + info->write_end=(info->buffer + info->buffer_length - + (seek_offset & (IO_SIZE-1))); + info->end_of_file= ~(my_off_t) 0; + } + } + info->type=type; + info->error= info->hard_write_error_in_the_past= 0; + init_functions(info); + +#ifdef HAVE_AIOWAIT + if (use_async_io && ! my_disable_async_io && + ((ulong) info->buffer_length < + (ulong) (info->end_of_file - seek_offset))) + { + info->read_length=info->buffer_length/2; + info->read_function=_my_b_async_read; + } + info->inited=0; +#endif + DBUG_RETURN(0); +} /* reinit_io_cache */ + + +/* FUNCTIONS TO DO READS FROM THE CACHE */ + + +/* + Read buffered. + + SYNOPSIS + _my_b_read() + info IO_CACHE pointer + Buffer Buffer to retrieve count bytes from file + Count Number of bytes to read into Buffer + + NOTE + This function is only called from the my_b_read() macro when there + isn't enough characters in the buffer to satisfy the request. + + WARNING + + When changing this function, be careful with handling file offsets + (end-of_file, pos_in_file). Do not cast them to possibly smaller + types than my_off_t unless you can be sure that their value fits. + Same applies to differences of file offsets. + + When changing this function, check _my_b_read_r(). It might need the + same change. + + RETURN + 0 we succeeded in reading all data + 1 Error: can't read requested characters +*/ + +int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count) +{ + size_t length,diff_length,left_length, max_length; + my_off_t pos_in_file; + DBUG_ENTER("_my_b_read"); + + if ((left_length= (size_t) (info->read_end-info->read_pos))) + { + DBUG_ASSERT(Count >= left_length); /* User is not using my_b_read() */ + memcpy(Buffer,info->read_pos, left_length); + Buffer+=left_length; + Count-=left_length; + } + + /* pos_in_file always point on where info->buffer was read */ + pos_in_file=info->pos_in_file+ (size_t) (info->read_end - info->buffer); + + /* + Whenever a function which operates on IO_CACHE flushes/writes + some part of the IO_CACHE to disk it will set the property + "seek_not_done" to indicate this to other functions operating + on the IO_CACHE. + */ + if (info->seek_not_done) + { + if ((my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) + != MY_FILEPOS_ERROR)) + { + /* No error, reset seek_not_done flag. */ + info->seek_not_done= 0; + } + else + { + /* + If the seek failed and the error number is ESPIPE, it is because + info->file is a pipe or socket or FIFO. We never should have tried + to seek on that. See Bugs#25807 and #22828 for more info. + */ + DBUG_ASSERT(my_errno != ESPIPE); + info->error= -1; + DBUG_RETURN(1); + } + } + + diff_length= (size_t) (pos_in_file & (IO_SIZE-1)); + if (Count >= (size_t) (IO_SIZE+(IO_SIZE-diff_length))) + { /* Fill first intern buffer */ + size_t read_length; + if (info->end_of_file <= pos_in_file) + { /* End of file */ + info->error= (int) left_length; + DBUG_RETURN(1); + } + length=(Count & (size_t) ~(IO_SIZE-1))-diff_length; + if ((read_length= my_read(info->file,Buffer, length, info->myflags)) + != length) + { + info->error= (read_length == (size_t) -1 ? -1 : + (int) (read_length+left_length)); + DBUG_RETURN(1); + } + Count-=length; + Buffer+=length; + pos_in_file+=length; + left_length+=length; + diff_length=0; + } + + max_length= info->read_length-diff_length; + if (info->type != READ_FIFO && + max_length > (info->end_of_file - pos_in_file)) + max_length= (size_t) (info->end_of_file - pos_in_file); + if (!max_length) + { + if (Count) + { + info->error= (int) left_length; /* We only got this many char */ + DBUG_RETURN(1); + } + length=0; /* Didn't read any chars */ + } + else if ((length= my_read(info->file,info->buffer, max_length, + info->myflags)) < Count || + length == (size_t) -1) + { + if (length != (size_t) -1) + memcpy(Buffer, info->buffer, length); + info->pos_in_file= pos_in_file; + info->error= length == (size_t) -1 ? -1 : (int) (length+left_length); + info->read_pos=info->read_end=info->buffer; + DBUG_RETURN(1); + } + info->read_pos=info->buffer+Count; + info->read_end=info->buffer+length; + info->pos_in_file=pos_in_file; + memcpy(Buffer, info->buffer, Count); + DBUG_RETURN(0); +} + + +#ifdef THREAD +/* + Prepare IO_CACHE for shared use. + + SYNOPSIS + init_io_cache_share() + read_cache A read cache. This will be copied for + every thread after setup. + cshare The share. + write_cache If non-NULL a write cache that is to be + synchronized with the read caches. + num_threads Number of threads sharing the cache + including the write thread if any. + + DESCRIPTION + + The shared cache is used so: One IO_CACHE is initialized with + init_io_cache(). This includes the allocation of a buffer. Then a + share is allocated and init_io_cache_share() is called with the io + cache and the share. Then the io cache is copied for each thread. So + every thread has its own copy of IO_CACHE. But the allocated buffer + is shared because cache->buffer is the same for all caches. + + One thread reads data from the file into the buffer. All threads + read from the buffer, but every thread maintains its own set of + pointers into the buffer. When all threads have used up the buffer + contents, one of the threads reads the next block of data into the + buffer. To accomplish this, each thread enters the cache lock before + accessing the buffer. They wait in lock_io_cache() until all threads + joined the lock. The last thread entering the lock is in charge of + reading from file to buffer. It wakes all threads when done. + + Synchronizing a write cache to the read caches works so: Whenever + the write buffer needs a flush, the write thread enters the lock and + waits for all other threads to enter the lock too. They do this when + they have used up the read buffer. When all threads are in the lock, + the write thread copies the write buffer to the read buffer and + wakes all threads. + + share->running_threads is the number of threads not being in the + cache lock. When entering lock_io_cache() the number is decreased. + When the thread that fills the buffer enters unlock_io_cache() the + number is reset to the number of threads. The condition + running_threads == 0 means that all threads are in the lock. Bumping + up the number to the full count is non-intuitive. But increasing the + number by one for each thread that leaves the lock could lead to a + solo run of one thread. The last thread to join a lock reads from + file to buffer, wakes the other threads, processes the data in the + cache and enters the lock again. If no other thread left the lock + meanwhile, it would think it's the last one again and read the next + block... + + The share has copies of 'error', 'buffer', 'read_end', and + 'pos_in_file' from the thread that filled the buffer. We may not be + able to access this information directly from its cache because the + thread may be removed from the share before the variables could be + copied by all other threads. Or, if a write buffer is synchronized, + it would change its 'pos_in_file' after waking the other threads, + possibly before they could copy its value. + + However, the 'buffer' variable in the share is for a synchronized + write cache. It needs to know where to put the data. Otherwise it + would need access to the read cache of one of the threads that is + not yet removed from the share. + + RETURN + void +*/ + +void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, + IO_CACHE *write_cache, uint num_threads) +{ + DBUG_ENTER("init_io_cache_share"); + DBUG_PRINT("io_cache_share", ("read_cache: %p share: %p " + "write_cache: %p threads: %u", + read_cache, cshare, + write_cache, num_threads)); + + DBUG_ASSERT(num_threads > 1); + DBUG_ASSERT(read_cache->type == READ_CACHE); + DBUG_ASSERT(!write_cache || (write_cache->type == WRITE_CACHE)); + + pthread_mutex_init(&cshare->mutex, MY_MUTEX_INIT_FAST); + pthread_cond_init(&cshare->cond, 0); + pthread_cond_init(&cshare->cond_writer, 0); + + cshare->running_threads= num_threads; + cshare->total_threads= num_threads; + cshare->error= 0; /* Initialize. */ + cshare->buffer= read_cache->buffer; + cshare->read_end= NULL; /* See function comment of lock_io_cache(). */ + cshare->pos_in_file= 0; /* See function comment of lock_io_cache(). */ + cshare->source_cache= write_cache; /* Can be NULL. */ + + read_cache->share= cshare; + read_cache->read_function= _my_b_read_r; + read_cache->current_pos= NULL; + read_cache->current_end= NULL; + + if (write_cache) + write_cache->share= cshare; + + DBUG_VOID_RETURN; +} + + +/* + Remove a thread from shared access to IO_CACHE. + + SYNOPSIS + remove_io_thread() + cache The IO_CACHE to be removed from the share. + + NOTE + + Every thread must do that on exit for not to deadlock other threads. + + The last thread destroys the pthread resources. + + A writer flushes its cache first. + + RETURN + void +*/ + +void remove_io_thread(IO_CACHE *cache) +{ + IO_CACHE_SHARE *cshare= cache->share; + uint total; + DBUG_ENTER("remove_io_thread"); + + /* If the writer goes, it needs to flush the write cache. */ + if (cache == cshare->source_cache) + flush_io_cache(cache); + + pthread_mutex_lock(&cshare->mutex); + DBUG_PRINT("io_cache_share", ("%s: %p", + (cache == cshare->source_cache) ? + "writer" : "reader", cache)); + + /* Remove from share. */ + total= --cshare->total_threads; + DBUG_PRINT("io_cache_share", ("remaining threads: %u", total)); + + /* Detach from share. */ + cache->share= NULL; + + /* If the writer goes, let the readers know. */ + if (cache == cshare->source_cache) + { + DBUG_PRINT("io_cache_share", ("writer leaves")); + cshare->source_cache= NULL; + } + + /* If all threads are waiting for me to join the lock, wake them. */ + if (!--cshare->running_threads) + { + DBUG_PRINT("io_cache_share", ("the last running thread leaves, wake all")); + pthread_cond_signal(&cshare->cond_writer); + pthread_cond_broadcast(&cshare->cond); + } + + pthread_mutex_unlock(&cshare->mutex); + + if (!total) + { + DBUG_PRINT("io_cache_share", ("last thread removed, destroy share")); + pthread_cond_destroy (&cshare->cond_writer); + pthread_cond_destroy (&cshare->cond); + pthread_mutex_destroy(&cshare->mutex); + } + + DBUG_VOID_RETURN; +} + + +/* + Lock IO cache and wait for all other threads to join. + + SYNOPSIS + lock_io_cache() + cache The cache of the thread entering the lock. + pos File position of the block to read. + Unused for the write thread. + + DESCRIPTION + + Wait for all threads to finish with the current buffer. We want + all threads to proceed in concert. The last thread to join + lock_io_cache() will read the block from file and all threads start + to use it. Then they will join again for reading the next block. + + The waiting threads detect a fresh buffer by comparing + cshare->pos_in_file with the position they want to process next. + Since the first block may start at position 0, we take + cshare->read_end as an additional condition. This variable is + initialized to NULL and will be set after a block of data is written + to the buffer. + + RETURN + 1 OK, lock in place, go ahead and read. + 0 OK, unlocked, another thread did the read. +*/ + +static int lock_io_cache(IO_CACHE *cache, my_off_t pos) +{ + IO_CACHE_SHARE *cshare= cache->share; + DBUG_ENTER("lock_io_cache"); + + /* Enter the lock. */ + pthread_mutex_lock(&cshare->mutex); + cshare->running_threads--; + DBUG_PRINT("io_cache_share", ("%s: %p pos: %lu running: %u", + (cache == cshare->source_cache) ? + "writer" : "reader", cache, (ulong) pos, + cshare->running_threads)); + + if (cshare->source_cache) + { + /* A write cache is synchronized to the read caches. */ + + if (cache == cshare->source_cache) + { + /* The writer waits until all readers are here. */ + while (cshare->running_threads) + { + DBUG_PRINT("io_cache_share", ("writer waits in lock")); + pthread_cond_wait(&cshare->cond_writer, &cshare->mutex); + } + DBUG_PRINT("io_cache_share", ("writer awoke, going to copy")); + + /* Stay locked. Leave the lock later by unlock_io_cache(). */ + DBUG_RETURN(1); + } + + /* The last thread wakes the writer. */ + if (!cshare->running_threads) + { + DBUG_PRINT("io_cache_share", ("waking writer")); + pthread_cond_signal(&cshare->cond_writer); + } + + /* + Readers wait until the data is copied from the writer. Another + reason to stop waiting is the removal of the write thread. If this + happens, we leave the lock with old data in the buffer. + */ + while ((!cshare->read_end || (cshare->pos_in_file < pos)) && + cshare->source_cache) + { + DBUG_PRINT("io_cache_share", ("reader waits in lock")); + pthread_cond_wait(&cshare->cond, &cshare->mutex); + } + + /* + If the writer was removed from the share while this thread was + asleep, we need to simulate an EOF condition. The writer cannot + reset the share variables as they might still be in use by readers + of the last block. When we awake here then because the last + joining thread signalled us. If the writer is not the last, it + will not signal. So it is safe to clear the buffer here. + */ + if (!cshare->read_end || (cshare->pos_in_file < pos)) + { + DBUG_PRINT("io_cache_share", ("reader found writer removed. EOF")); + cshare->read_end= cshare->buffer; /* Empty buffer. */ + cshare->error= 0; /* EOF is not an error. */ + } + } + else + { + /* + There are read caches only. The last thread arriving in + lock_io_cache() continues with a locked cache and reads the block. + */ + if (!cshare->running_threads) + { + DBUG_PRINT("io_cache_share", ("last thread joined, going to read")); + /* Stay locked. Leave the lock later by unlock_io_cache(). */ + DBUG_RETURN(1); + } + + /* + All other threads wait until the requested block is read by the + last thread arriving. Another reason to stop waiting is the + removal of a thread. If this leads to all threads being in the + lock, we have to continue also. The first of the awaken threads + will then do the read. + */ + while ((!cshare->read_end || (cshare->pos_in_file < pos)) && + cshare->running_threads) + { + DBUG_PRINT("io_cache_share", ("reader waits in lock")); + pthread_cond_wait(&cshare->cond, &cshare->mutex); + } + + /* If the block is not yet read, continue with a locked cache and read. */ + if (!cshare->read_end || (cshare->pos_in_file < pos)) + { + DBUG_PRINT("io_cache_share", ("reader awoke, going to read")); + /* Stay locked. Leave the lock later by unlock_io_cache(). */ + DBUG_RETURN(1); + } + + /* Another thread did read the block already. */ + } + DBUG_PRINT("io_cache_share", ("reader awoke, going to process %u bytes", + (uint) (cshare->read_end ? (size_t) + (cshare->read_end - cshare->buffer) : + 0))); + + /* + Leave the lock. Do not call unlock_io_cache() later. The thread that + filled the buffer did this and marked all threads as running. + */ + pthread_mutex_unlock(&cshare->mutex); + DBUG_RETURN(0); +} + + +/* + Unlock IO cache. + + SYNOPSIS + unlock_io_cache() + cache The cache of the thread leaving the lock. + + NOTE + This is called by the thread that filled the buffer. It marks all + threads as running and awakes them. This must not be done by any + other thread. + + Do not signal cond_writer. Either there is no writer or the writer + is the only one who can call this function. + + The reason for resetting running_threads to total_threads before + waking all other threads is that it could be possible that this + thread is so fast with processing the buffer that it enters the lock + before even one other thread has left it. If every awoken thread + would increase running_threads by one, this thread could think that + he is again the last to join and would not wait for the other + threads to process the data. + + RETURN + void +*/ + +static void unlock_io_cache(IO_CACHE *cache) +{ + IO_CACHE_SHARE *cshare= cache->share; + DBUG_ENTER("unlock_io_cache"); + DBUG_PRINT("io_cache_share", ("%s: %p pos: %lu running: %u", + (cache == cshare->source_cache) ? + "writer" : "reader", + cache, (ulong) cshare->pos_in_file, + cshare->total_threads)); + + cshare->running_threads= cshare->total_threads; + pthread_cond_broadcast(&cshare->cond); + pthread_mutex_unlock(&cshare->mutex); + DBUG_VOID_RETURN; +} + + +/* + Read from IO_CACHE when it is shared between several threads. + + SYNOPSIS + _my_b_read_r() + cache IO_CACHE pointer + Buffer Buffer to retrieve count bytes from file + Count Number of bytes to read into Buffer + + NOTE + This function is only called from the my_b_read() macro when there + isn't enough characters in the buffer to satisfy the request. + + IMPLEMENTATION + + It works as follows: when a thread tries to read from a file (that + is, after using all the data from the (shared) buffer), it just + hangs on lock_io_cache(), waiting for other threads. When the very + last thread attempts a read, lock_io_cache() returns 1, the thread + does actual IO and unlock_io_cache(), which signals all the waiting + threads that data is in the buffer. + + WARNING + + When changing this function, be careful with handling file offsets + (end-of_file, pos_in_file). Do not cast them to possibly smaller + types than my_off_t unless you can be sure that their value fits. + Same applies to differences of file offsets. (Bug #11527) + + When changing this function, check _my_b_read(). It might need the + same change. + + RETURN + 0 we succeeded in reading all data + 1 Error: can't read requested characters +*/ + +int _my_b_read_r(register IO_CACHE *cache, uchar *Buffer, size_t Count) +{ + my_off_t pos_in_file; + size_t length, diff_length, left_length; + IO_CACHE_SHARE *cshare= cache->share; + DBUG_ENTER("_my_b_read_r"); + + if ((left_length= (size_t) (cache->read_end - cache->read_pos))) + { + DBUG_ASSERT(Count >= left_length); /* User is not using my_b_read() */ + memcpy(Buffer, cache->read_pos, left_length); + Buffer+= left_length; + Count-= left_length; + } + while (Count) + { + size_t cnt, len; + + pos_in_file= cache->pos_in_file + (cache->read_end - cache->buffer); + diff_length= (size_t) (pos_in_file & (IO_SIZE-1)); + length=IO_ROUND_UP(Count+diff_length)-diff_length; + length= ((length <= cache->read_length) ? + length + IO_ROUND_DN(cache->read_length - length) : + length - IO_ROUND_UP(length - cache->read_length)); + if (cache->type != READ_FIFO && + (length > (cache->end_of_file - pos_in_file))) + length= (size_t) (cache->end_of_file - pos_in_file); + if (length == 0) + { + cache->error= (int) left_length; + DBUG_RETURN(1); + } + if (lock_io_cache(cache, pos_in_file)) + { + /* With a synchronized write/read cache we won't come here... */ + DBUG_ASSERT(!cshare->source_cache); + /* + ... unless the writer has gone before this thread entered the + lock. Simulate EOF in this case. It can be distinguished by + cache->file. + */ + if (cache->file < 0) + len= 0; + else + { + /* + Whenever a function which operates on IO_CACHE flushes/writes + some part of the IO_CACHE to disk it will set the property + "seek_not_done" to indicate this to other functions operating + on the IO_CACHE. + */ + if (cache->seek_not_done) + { + if (my_seek(cache->file, pos_in_file, MY_SEEK_SET, MYF(0)) + == MY_FILEPOS_ERROR) + { + cache->error= -1; + unlock_io_cache(cache); + DBUG_RETURN(1); + } + } + len= my_read(cache->file, cache->buffer, length, cache->myflags); + } + DBUG_PRINT("io_cache_share", ("read %lu bytes", (ulong) len)); + + cache->read_end= cache->buffer + (len == (size_t) -1 ? 0 : len); + cache->error= (len == length ? 0 : (int) len); + cache->pos_in_file= pos_in_file; + + /* Copy important values to the share. */ + cshare->error= cache->error; + cshare->read_end= cache->read_end; + cshare->pos_in_file= pos_in_file; + + /* Mark all threads as running and wake them. */ + unlock_io_cache(cache); + } + else + { + /* + With a synchronized write/read cache readers always come here. + Copy important values from the share. + */ + cache->error= cshare->error; + cache->read_end= cshare->read_end; + cache->pos_in_file= cshare->pos_in_file; + + len= ((cache->error == -1) ? (size_t) -1 : + (size_t) (cache->read_end - cache->buffer)); + } + cache->read_pos= cache->buffer; + cache->seek_not_done= 0; + if (len == 0 || len == (size_t) -1) + { + DBUG_PRINT("io_cache_share", ("reader error. len %lu left %lu", + (ulong) len, (ulong) left_length)); + cache->error= (int) left_length; + DBUG_RETURN(1); + } + cnt= (len > Count) ? Count : len; + memcpy(Buffer, cache->read_pos, cnt); + Count -= cnt; + Buffer+= cnt; + left_length+= cnt; + cache->read_pos+= cnt; + } + DBUG_RETURN(0); +} + + +/* + Copy data from write cache to read cache. + + SYNOPSIS + copy_to_read_buffer() + write_cache The write cache. + write_buffer The source of data, mostly the cache buffer. + write_length The number of bytes to copy. + + NOTE + The write thread will wait for all read threads to join the cache + lock. Then it copies the data over and wakes the read threads. + + RETURN + void +*/ + +static void copy_to_read_buffer(IO_CACHE *write_cache, + const uchar *write_buffer, size_t write_length) +{ + IO_CACHE_SHARE *cshare= write_cache->share; + + DBUG_ASSERT(cshare->source_cache == write_cache); + /* + write_length is usually less or equal to buffer_length. + It can be bigger if _my_b_write() is called with a big length. + */ + while (write_length) + { + size_t copy_length= min(write_length, write_cache->buffer_length); + int __attribute__((unused)) rc; + + rc= lock_io_cache(write_cache, write_cache->pos_in_file); + /* The writing thread does always have the lock when it awakes. */ + DBUG_ASSERT(rc); + + memcpy(cshare->buffer, write_buffer, copy_length); + + cshare->error= 0; + cshare->read_end= cshare->buffer + copy_length; + cshare->pos_in_file= write_cache->pos_in_file; + + /* Mark all threads as running and wake them. */ + unlock_io_cache(write_cache); + + write_buffer+= copy_length; + write_length-= copy_length; + } +} +#endif /*THREAD*/ + + +/* + Do sequential read from the SEQ_READ_APPEND cache. + + We do this in three stages: + - first read from info->buffer + - then if there are still data to read, try the file descriptor + - afterwards, if there are still data to read, try append buffer + + RETURNS + 0 Success + 1 Failed to read +*/ + +int _my_b_seq_read(register IO_CACHE *info, uchar *Buffer, size_t Count) +{ + size_t length, diff_length, left_length, save_count, max_length; + my_off_t pos_in_file; + save_count=Count; + + /* first, read the regular buffer */ + if ((left_length=(size_t) (info->read_end-info->read_pos))) + { + DBUG_ASSERT(Count > left_length); /* User is not using my_b_read() */ + memcpy(Buffer,info->read_pos, left_length); + Buffer+=left_length; + Count-=left_length; + } + lock_append_buffer(info); + + /* pos_in_file always point on where info->buffer was read */ + if ((pos_in_file=info->pos_in_file + + (size_t) (info->read_end - info->buffer)) >= info->end_of_file) + goto read_append_buffer; + + /* + With read-append cache we must always do a seek before we read, + because the write could have moved the file pointer astray + */ + if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == MY_FILEPOS_ERROR) + { + info->error= -1; + unlock_append_buffer(info); + return (1); + } + info->seek_not_done=0; + + diff_length= (size_t) (pos_in_file & (IO_SIZE-1)); + + /* now the second stage begins - read from file descriptor */ + if (Count >= (size_t) (IO_SIZE+(IO_SIZE-diff_length))) + { + /* Fill first intern buffer */ + size_t read_length; + + length=(Count & (size_t) ~(IO_SIZE-1))-diff_length; + if ((read_length= my_read(info->file,Buffer, length, + info->myflags)) == (size_t) -1) + { + info->error= -1; + unlock_append_buffer(info); + return 1; + } + Count-=read_length; + Buffer+=read_length; + pos_in_file+=read_length; + + if (read_length != length) + { + /* + We only got part of data; Read the rest of the data from the + write buffer + */ + goto read_append_buffer; + } + left_length+=length; + diff_length=0; + } + + max_length= info->read_length-diff_length; + if (max_length > (info->end_of_file - pos_in_file)) + max_length= (size_t) (info->end_of_file - pos_in_file); + if (!max_length) + { + if (Count) + goto read_append_buffer; + length=0; /* Didn't read any more chars */ + } + else + { + length= my_read(info->file,info->buffer, max_length, info->myflags); + if (length == (size_t) -1) + { + info->error= -1; + unlock_append_buffer(info); + return 1; + } + if (length < Count) + { + memcpy(Buffer, info->buffer, length); + Count -= length; + Buffer += length; + + /* + added the line below to make + DBUG_ASSERT(pos_in_file==info->end_of_file) pass. + otherwise this does not appear to be needed + */ + pos_in_file += length; + goto read_append_buffer; + } + } + unlock_append_buffer(info); + info->read_pos=info->buffer+Count; + info->read_end=info->buffer+length; + info->pos_in_file=pos_in_file; + memcpy(Buffer,info->buffer,(size_t) Count); + return 0; + +read_append_buffer: + + /* + Read data from the current write buffer. + Count should never be == 0 here (The code will work even if count is 0) + */ + + { + /* First copy the data to Count */ + size_t len_in_buff = (size_t) (info->write_pos - info->append_read_pos); + size_t copy_len; + size_t transfer_len; + + DBUG_ASSERT(info->append_read_pos <= info->write_pos); + /* + TODO: figure out if the assert below is needed or correct. + */ + DBUG_ASSERT(pos_in_file == info->end_of_file); + copy_len=min(Count, len_in_buff); + memcpy(Buffer, info->append_read_pos, copy_len); + info->append_read_pos += copy_len; + Count -= copy_len; + if (Count) + info->error= (int) (save_count - Count); + + /* Fill read buffer with data from write buffer */ + memcpy(info->buffer, info->append_read_pos, + (size_t) (transfer_len=len_in_buff - copy_len)); + info->read_pos= info->buffer; + info->read_end= info->buffer+transfer_len; + info->append_read_pos=info->write_pos; + info->pos_in_file=pos_in_file+copy_len; + info->end_of_file+=len_in_buff; + } + unlock_append_buffer(info); + return Count ? 1 : 0; +} + + +#ifdef HAVE_AIOWAIT + +/* + Read from the IO_CACHE into a buffer and feed asynchronously + from disk when needed. + + SYNOPSIS + _my_b_async_read() + info IO_CACHE pointer + Buffer Buffer to retrieve count bytes from file + Count Number of bytes to read into Buffer + + RETURN VALUE + -1 An error has occurred; my_errno is set. + 0 Success + 1 An error has occurred; IO_CACHE to error state. +*/ + +int _my_b_async_read(register IO_CACHE *info, uchar *Buffer, size_t Count) +{ + size_t length,read_length,diff_length,left_length,use_length,org_Count; + size_t max_length; + my_off_t next_pos_in_file; + uchar *read_buffer; + + memcpy(Buffer,info->read_pos, + (left_length= (size_t) (info->read_end-info->read_pos))); + Buffer+=left_length; + org_Count=Count; + Count-=left_length; + + if (info->inited) + { /* wait for read block */ + info->inited=0; /* No more block to read */ + my_aiowait(&info->aio_result); /* Wait for outstanding req */ + if (info->aio_result.result.aio_errno) + { + if (info->myflags & MY_WME) + my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG), + my_filename(info->file), + info->aio_result.result.aio_errno); + my_errno=info->aio_result.result.aio_errno; + info->error= -1; + return(1); + } + if (! (read_length= (size_t) info->aio_result.result.aio_return) || + read_length == (size_t) -1) + { + my_errno=0; /* For testing */ + info->error= (read_length == (size_t) -1 ? -1 : + (int) (read_length+left_length)); + return(1); + } + info->pos_in_file+= (size_t) (info->read_end - info->request_pos); + + if (info->request_pos != info->buffer) + info->request_pos=info->buffer; + else + info->request_pos=info->buffer+info->read_length; + info->read_pos=info->request_pos; + next_pos_in_file=info->aio_read_pos+read_length; + + /* Check if pos_in_file is changed + (_ni_read_cache may have skipped some bytes) */ + + if (info->aio_read_pos < info->pos_in_file) + { /* Fix if skipped bytes */ + if (info->aio_read_pos + read_length < info->pos_in_file) + { + read_length=0; /* Skip block */ + next_pos_in_file=info->pos_in_file; + } + else + { + my_off_t offset= (info->pos_in_file - info->aio_read_pos); + info->pos_in_file=info->aio_read_pos; /* Whe are here */ + info->read_pos=info->request_pos+offset; + read_length-=offset; /* Bytes left from read_pos */ + } + } +#ifndef DBUG_OFF + if (info->aio_read_pos > info->pos_in_file) + { + my_errno=EINVAL; + return(info->read_length= (size_t) -1); + } +#endif + /* Copy found bytes to buffer */ + length=min(Count,read_length); + memcpy(Buffer,info->read_pos,(size_t) length); + Buffer+=length; + Count-=length; + left_length+=length; + info->read_end=info->rc_pos+read_length; + info->read_pos+=length; + } + else + next_pos_in_file=(info->pos_in_file+ (size_t) + (info->read_end - info->request_pos)); + + /* If reading large blocks, or first read or read with skip */ + if (Count) + { + if (next_pos_in_file == info->end_of_file) + { + info->error=(int) (read_length+left_length); + return 1; + } + + if (my_seek(info->file,next_pos_in_file,MY_SEEK_SET,MYF(0)) + == MY_FILEPOS_ERROR) + { + info->error= -1; + return (1); + } + + read_length=IO_SIZE*2- (size_t) (next_pos_in_file & (IO_SIZE-1)); + if (Count < read_length) + { /* Small block, read to cache */ + if ((read_length=my_read(info->file,info->request_pos, + read_length, info->myflags)) == (size_t) -1) + return info->error= -1; + use_length=min(Count,read_length); + memcpy(Buffer,info->request_pos,(size_t) use_length); + info->read_pos=info->request_pos+Count; + info->read_end=info->request_pos+read_length; + info->pos_in_file=next_pos_in_file; /* Start of block in cache */ + next_pos_in_file+=read_length; + + if (Count != use_length) + { /* Didn't find hole block */ + if (info->myflags & (MY_WME | MY_FAE | MY_FNABP) && Count != org_Count) + my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG), + my_filename(info->file),my_errno); + info->error=(int) (read_length+left_length); + return 1; + } + } + else + { /* Big block, don't cache it */ + if ((read_length= my_read(info->file,Buffer, Count,info->myflags)) + != Count) + { + info->error= read_length == (size_t) -1 ? -1 : read_length+left_length; + return 1; + } + info->read_pos=info->read_end=info->request_pos; + info->pos_in_file=(next_pos_in_file+=Count); + } + } + + /* Read next block with asyncronic io */ + diff_length=(next_pos_in_file & (IO_SIZE-1)); + max_length= info->read_length - diff_length; + if (max_length > info->end_of_file - next_pos_in_file) + max_length= (size_t) (info->end_of_file - next_pos_in_file); + + if (info->request_pos != info->buffer) + read_buffer=info->buffer; + else + read_buffer=info->buffer+info->read_length; + info->aio_read_pos=next_pos_in_file; + if (max_length) + { + info->aio_result.result.aio_errno=AIO_INPROGRESS; /* Marker for test */ + DBUG_PRINT("aioread",("filepos: %ld length: %lu", + (ulong) next_pos_in_file, (ulong) max_length)); + if (aioread(info->file,read_buffer, max_length, + (my_off_t) next_pos_in_file,MY_SEEK_SET, + &info->aio_result.result)) + { /* Skip async io */ + my_errno=errno; + DBUG_PRINT("error",("got error: %d, aio_result: %d from aioread, async skipped", + errno, info->aio_result.result.aio_errno)); + if (info->request_pos != info->buffer) + { + bmove(info->buffer,info->request_pos, + (size_t) (info->read_end - info->read_pos)); + info->request_pos=info->buffer; + info->read_pos-=info->read_length; + info->read_end-=info->read_length; + } + info->read_length=info->buffer_length; /* Use hole buffer */ + info->read_function=_my_b_read; /* Use normal IO_READ next */ + } + else + info->inited=info->aio_result.pending=1; + } + return 0; /* Block read, async in use */ +} /* _my_b_async_read */ +#endif + + +/* Read one byte when buffer is empty */ + +int _my_b_get(IO_CACHE *info) +{ + uchar buff; + IO_CACHE_CALLBACK pre_read,post_read; + if ((pre_read = info->pre_read)) + (*pre_read)(info, NULL, 0, 0); + if ((*(info)->read_function)(info,&buff,1)) + return my_b_EOF; + if ((post_read = info->post_read)) + (*post_read)(info, NULL, 0, 0); + return (int) (uchar) buff; +} + +/* FUNCTIONS TO DO WRITES TO THE CACHE */ + +#define set_hard_write_error(CACHE) \ + ((CACHE)->error= (CACHE)->hard_write_error_in_the_past= -1) + +/* + Write a byte buffer to IO_CACHE and flush to disk + if IO_CACHE is full. + + RETURN VALUE + 1 On error on write + 0 On success + -1 On error; my_errno contains error code. +*/ + +int _my_b_write(register IO_CACHE *info, const uchar *Buffer, size_t Count) +{ + size_t rest_length,length; + + if (info->pos_in_file+info->buffer_length > info->end_of_file) + { + my_errno=errno=EFBIG; + return set_hard_write_error(info); + } + + rest_length= (size_t) (info->write_end - info->write_pos); + memcpy(info->write_pos,Buffer,(size_t) rest_length); + Buffer+=rest_length; + Count-=rest_length; + info->write_pos+=rest_length; + + if (my_b_flush_io_cache(info,1)) + return 1; + if (Count >= IO_SIZE) + { /* Fill first intern buffer */ + length=Count & (size_t) ~(IO_SIZE-1); + if (info->seek_not_done) + { + /* + Whenever a function which operates on IO_CACHE flushes/writes + some part of the IO_CACHE to disk it will set the property + "seek_not_done" to indicate this to other functions operating + on the IO_CACHE. + */ + if (my_seek(info->file,info->pos_in_file,MY_SEEK_SET,MYF(0))) + { + set_hard_write_error(info); + return (1); + } + info->seek_not_done=0; + } + if (my_write(info->file, Buffer, length, info->myflags | MY_NABP)) + return set_hard_write_error(info); + if (info->post_write) + (*(info->post_write))(info, Buffer, length, info->pos_in_file); + +#ifdef THREAD + /* + In case of a shared I/O cache with a writer we normally do direct + write cache to read cache copy. Simulate this here by direct + caller buffer to read cache copy. Do it after the write so that + the cache readers actions on the flushed part can go in parallel + with the write of the extra stuff. copy_to_read_buffer() + synchronizes writer and readers so that after this call the + readers can act on the extra stuff while the writer can go ahead + and prepare the next output. copy_to_read_buffer() relies on + info->pos_in_file. + */ + if (info->share) + copy_to_read_buffer(info, Buffer, length); +#endif + + Count-=length; + Buffer+=length; + info->pos_in_file+=length; + } + memcpy(info->write_pos,Buffer,(size_t) Count); + info->write_pos+=Count; + return 0; +} + + +/* + Append a block to the write buffer. + This is done with the buffer locked to ensure that we don't read from + the write buffer before we are ready with it. +*/ + +int my_b_append(register IO_CACHE *info, const uchar *Buffer, size_t Count) +{ + size_t rest_length,length; + +#ifdef THREAD + /* + Assert that we cannot come here with a shared cache. If we do one + day, we might need to add a call to copy_to_read_buffer(). + */ + DBUG_ASSERT(!info->share); +#endif + DBUG_ASSERT(info->post_write == NULL); /* unsupported */ + lock_append_buffer(info); + rest_length= (size_t) (info->write_end - info->write_pos); + if (Count <= rest_length) + goto end; + memcpy(info->write_pos, Buffer, rest_length); + Buffer+=rest_length; + Count-=rest_length; + info->write_pos+=rest_length; + if (my_b_flush_io_cache(info,0)) + { + unlock_append_buffer(info); + return 1; + } + if (Count >= IO_SIZE) + { /* Fill first intern buffer */ + length=Count & (size_t) ~(IO_SIZE-1); + if (my_write(info->file,Buffer, length, info->myflags | MY_NABP)) + { + unlock_append_buffer(info); + return set_hard_write_error(info); + } + Count-=length; + Buffer+=length; + info->end_of_file+=length; + } + +end: + memcpy(info->write_pos,Buffer,(size_t) Count); + info->write_pos+=Count; + unlock_append_buffer(info); + return 0; +} + + +int my_b_safe_write(IO_CACHE *info, const uchar *Buffer, size_t Count) +{ + /* + Sasha: We are not writing this with the ? operator to avoid hitting + a possible compiler bug. At least gcc 2.95 cannot deal with + several layers of ternary operators that evaluated comma(,) operator + expressions inside - I do have a test case if somebody wants it + */ + if (info->type == SEQ_READ_APPEND) + return my_b_append(info, Buffer, Count); + return my_b_write(info, Buffer, Count); +} + + +/* + Write a block to disk where part of the data may be inside the record + buffer. As all write calls to the data goes through the cache, + we will never get a seek over the end of the buffer +*/ + +int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count, + my_off_t pos) +{ + size_t length; + int error=0; + +#ifdef THREAD + /* + Assert that we cannot come here with a shared cache. If we do one + day, we might need to add a call to copy_to_read_buffer(). + */ + DBUG_ASSERT(!info->share); +#endif + + if (pos < info->pos_in_file) + { + /* Of no overlap, write everything without buffering */ + if (pos + Count <= info->pos_in_file) + { + int ret= my_pwrite(info->file, Buffer, Count, pos, + info->myflags | MY_NABP); + if (unlikely(ret)) + set_hard_write_error(info); + if (info->post_write) + (*(info->post_write))(info, Buffer, Count, pos); + return ret; + } + /* Write the part of the block that is before buffer */ + length= (uint) (info->pos_in_file - pos); + if (my_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP)) + error= set_hard_write_error(info); + if (info->post_write) + (*(info->post_write))(info, Buffer, length, pos); + Buffer+=length; + pos+= length; + Count-= length; +#ifndef HAVE_PREAD + info->seek_not_done=1; +#endif + } + + /* Check if we want to write inside the used part of the buffer.*/ + length= (size_t) (info->write_end - info->buffer); + if (pos < info->pos_in_file + length) + { + size_t offset= (size_t) (pos - info->pos_in_file); + length-=offset; + if (length > Count) + length=Count; + memcpy(info->buffer+offset, Buffer, length); + Buffer+=length; + Count-= length; + /* Fix length of buffer if the new data was larger */ + if (info->buffer+length > info->write_pos) + info->write_pos=info->buffer+length; + if (!Count) + return (error); + } + /* Write at the end of the current buffer; This is the normal case */ + if (_my_b_write(info, Buffer, Count)) + error= -1; + return error; +} + + + /* Flush write cache */ + +#ifdef THREAD +#define LOCK_APPEND_BUFFER if (need_append_buffer_lock) \ + lock_append_buffer(info); +#define UNLOCK_APPEND_BUFFER if (need_append_buffer_lock) \ + unlock_append_buffer(info); +#else +#define LOCK_APPEND_BUFFER +#define UNLOCK_APPEND_BUFFER +#endif + + +int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) +{ + size_t length; + my_bool append_cache; + my_off_t pos_in_file; + DBUG_ENTER("my_b_flush_io_cache"); + DBUG_PRINT("enter", ("cache: 0x%lx", (long) info)); + + if (!(append_cache = (info->type == SEQ_READ_APPEND))) + need_append_buffer_lock=0; + + if (info->type == WRITE_CACHE || append_cache) + { + if (info->file == -1) + { + if (real_open_cached_file(info)) + DBUG_RETURN(set_hard_write_error(info)); + } + LOCK_APPEND_BUFFER; + + if ((length=(size_t) (info->write_pos - info->write_buffer))) + { +#ifdef THREAD + /* + In case of a shared I/O cache with a writer we do direct write + cache to read cache copy. Do it before the write here so that + the readers can work in parallel with the write. + copy_to_read_buffer() relies on info->pos_in_file. + */ + if (info->share) + copy_to_read_buffer(info, info->write_buffer, length); +#endif + + pos_in_file=info->pos_in_file; + /* + If we have append cache, we always open the file with + O_APPEND which moves the pos to EOF automatically on every write + */ + if (!append_cache && info->seek_not_done) + { /* File touched, do seek */ + if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == + MY_FILEPOS_ERROR) + { + UNLOCK_APPEND_BUFFER; + DBUG_RETURN(set_hard_write_error(info)); + } + if (!append_cache) + info->seek_not_done=0; + } + info->write_end= (info->write_buffer+info->buffer_length- + ((pos_in_file+length) & (IO_SIZE-1))); + + if (my_write(info->file,info->write_buffer,length, + info->myflags | MY_NABP)) + set_hard_write_error(info); + else + info->error= 0; + if (!append_cache) + { + /* + This post_write is really POST-write; callers depend on this! So + always call it after writing to the file, not before. + */ + if (info->post_write) + (*(info->post_write))(info, info->write_buffer, + length, info->pos_in_file); + /* + The addition below will make the info->pos_in_file be the end of + written block; whereas the value we needed in post_write is the + value before the addition. That's why we called post_write before + this. + */ + info->pos_in_file+=length; + set_if_bigger(info->end_of_file,(pos_in_file+length)); + } + else + { + info->end_of_file+=(info->write_pos-info->append_read_pos); + DBUG_ASSERT(info->end_of_file == my_tell(info->file,MYF(0))); + DBUG_ASSERT(info->post_write == NULL); /* unsupported */ + } + + info->append_read_pos=info->write_pos=info->write_buffer; + ++info->disk_writes; + UNLOCK_APPEND_BUFFER; + DBUG_RETURN(info->error); + } + } +#ifdef HAVE_AIOWAIT + else if (info->type != READ_NET) + { + my_aiowait(&info->aio_result); /* Wait for outstanding req */ + info->inited=0; + } +#endif + UNLOCK_APPEND_BUFFER; + DBUG_RETURN(0); +} + +/* + Free an IO_CACHE object + + SYNOPSOS + end_io_cache() + info IO_CACHE Handle to free + + NOTES + It's currently safe to call this if one has called init_io_cache() + on the 'info' object, even if init_io_cache() failed. + This function is also safe to call twice with the same handle. + + RETURN + 0 ok + # Error +*/ + +int end_io_cache(IO_CACHE *info) +{ + int error=0; + IO_CACHE_CALLBACK pre_close; + DBUG_ENTER("end_io_cache"); + DBUG_PRINT("enter",("cache: %p", info)); + +#ifdef THREAD + /* + Every thread must call remove_io_thread(). The last one destroys + the share elements. + */ + DBUG_ASSERT(!info->share || !info->share->total_threads); +#endif + + if ((pre_close=info->pre_close)) + { + (*pre_close)(info, NULL, 0, 0); + info->pre_close= 0; + } + if (info->alloced_buffer) + { + info->alloced_buffer=0; + if (info->file != -1) /* File doesn't exist */ + error= my_b_flush_io_cache(info,1); + my_free((uchar*) info->buffer,MYF(MY_WME)); + info->buffer=info->read_pos=(uchar*) 0; + } + if (info->type == SEQ_READ_APPEND) + { + /* Destroy allocated mutex */ + info->type= TYPE_NOT_SET; +#ifdef THREAD + pthread_mutex_destroy(&info->append_buffer_lock); +#endif + } +#ifdef THREAD + info->share= 0; +#endif + DBUG_RETURN(error); +} /* end_io_cache */ + + +/********************************************************************** + Testing of MF_IOCACHE +**********************************************************************/ + +#ifdef MAIN + +#include + +void die(const char* fmt, ...) +{ + va_list va_args; + va_start(va_args,fmt); + fprintf(stderr,"Error:"); + vfprintf(stderr, fmt,va_args); + fprintf(stderr,", errno=%d\n", errno); + exit(1); +} + +int open_file(const char* fname, IO_CACHE* info, int cache_size) +{ + int fd; + if ((fd=my_open(fname,O_CREAT | O_RDWR,MYF(MY_WME))) < 0) + die("Could not open %s", fname); + if (init_io_cache(info, fd, cache_size, SEQ_READ_APPEND, 0,0,MYF(MY_WME))) + die("failed in init_io_cache()"); + return fd; +} + +void close_file(IO_CACHE* info) +{ + end_io_cache(info); + my_close(info->file, MYF(MY_WME)); +} + +int main(int argc, char** argv) +{ + IO_CACHE sra_cache; /* SEQ_READ_APPEND */ + MY_STAT status; + const char* fname="/tmp/iocache.test"; + int cache_size=16384; + char llstr_buf[22]; + int max_block,total_bytes=0; + int i,num_loops=100,error=0; + char *p; + char* block, *block_end; + MY_INIT(argv[0]); + max_block = cache_size*3; + if (!(block=(char*)my_malloc(max_block,MYF(MY_WME)))) + die("Not enough memory to allocate test block"); + block_end = block + max_block; + for (p = block,i=0; p < block_end;i++) + { + *p++ = (char)i; + } + if (my_stat(fname,&status, MYF(0)) && + my_delete(fname,MYF(MY_WME))) + { + die("Delete of %s failed, aborting", fname); + } + open_file(fname,&sra_cache, cache_size); + for (i = 0; i < num_loops; i++) + { + char buf[4]; + int block_size = abs(rand() % max_block); + int4store(buf, block_size); + if (my_b_append(&sra_cache,buf,4) || + my_b_append(&sra_cache, block, block_size)) + die("write failed"); + total_bytes += 4+block_size; + } + close_file(&sra_cache); + my_free(block,MYF(MY_WME)); + if (!my_stat(fname,&status,MYF(MY_WME))) + die("%s failed to stat, but I had just closed it,\ + wonder how that happened"); + printf("Final size of %s is %s, wrote %d bytes\n",fname, + llstr(status.st_size,llstr_buf), + total_bytes); + my_delete(fname, MYF(MY_WME)); + /* check correctness of tests */ + if (total_bytes != status.st_size) + { + fprintf(stderr,"Not the same number of bytes acutally in file as bytes \ +supposedly written\n"); + error=1; + } + exit(error); + return 0; +} +#endif diff --git a/externals/mysql/mysys/mf_iocache2.c b/externals/mysql/mysys/mf_iocache2.c new file mode 100644 index 0000000..38415f3 --- /dev/null +++ b/externals/mysql/mysys/mf_iocache2.c @@ -0,0 +1,466 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + More functions to be used with IO_CACHE files +*/ + +#define MAP_TO_USE_RAID +#include "mysys_priv.h" +#include +#include +#include + +/* + Copy contents of an IO_CACHE to a file. + + SYNOPSIS + my_b_copy_to_file() + cache IO_CACHE to copy from + file File to copy to + + DESCRIPTION + Copy the contents of the cache to the file. The cache will be + re-inited to a read cache and will read from the beginning of the + cache. + + If a failure to write fully occurs, the cache is only copied + partially. + + TODO + Make this function solid by handling partial reads from the cache + in a correct manner: it should be atomic. + + RETURN VALUE + 0 All OK + 1 An error occured +*/ +int +my_b_copy_to_file(IO_CACHE *cache, FILE *file) +{ + size_t bytes_in_cache; + DBUG_ENTER("my_b_copy_to_file"); + + /* Reinit the cache to read from the beginning of the cache */ + if (reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE)) + DBUG_RETURN(1); + bytes_in_cache= my_b_bytes_in_cache(cache); + do + { + if (my_fwrite(file, cache->read_pos, bytes_in_cache, + MYF(MY_WME | MY_NABP)) == (size_t) -1) + DBUG_RETURN(1); + cache->read_pos= cache->read_end; + } while ((bytes_in_cache= my_b_fill(cache))); + DBUG_RETURN(0); +} + + +my_off_t my_b_append_tell(IO_CACHE* info) +{ + /* + Prevent optimizer from putting res in a register when debugging + we need this to be able to see the value of res when the assert fails + */ + dbug_volatile my_off_t res; + + /* + We need to lock the append buffer mutex to keep flush_io_cache() + from messing with the variables that we need in order to provide the + answer to the question. + */ +#ifdef THREAD + pthread_mutex_lock(&info->append_buffer_lock); +#endif +#ifndef DBUG_OFF + /* + Make sure EOF is where we think it is. Note that we cannot just use + my_tell() because we have a reader thread that could have left the + file offset in a non-EOF location + */ + { + volatile my_off_t save_pos; + save_pos = my_tell(info->file,MYF(0)); + my_seek(info->file,(my_off_t)0,MY_SEEK_END,MYF(0)); + /* + Save the value of my_tell in res so we can see it when studying coredump + */ + DBUG_ASSERT(info->end_of_file - (info->append_read_pos-info->write_buffer) + == (res=my_tell(info->file,MYF(0)))); + my_seek(info->file,save_pos,MY_SEEK_SET,MYF(0)); + } +#endif + res = info->end_of_file + (info->write_pos-info->append_read_pos); +#ifdef THREAD + pthread_mutex_unlock(&info->append_buffer_lock); +#endif + return res; +} + +my_off_t my_b_safe_tell(IO_CACHE *info) +{ + if (unlikely(info->type == SEQ_READ_APPEND)) + return my_b_append_tell(info); + return my_b_tell(info); +} + +/* + Make next read happen at the given position + For write cache, make next write happen at the given position +*/ + +void my_b_seek(IO_CACHE *info,my_off_t pos) +{ + my_off_t offset; + DBUG_ENTER("my_b_seek"); + DBUG_PRINT("enter",("pos: %lu", (ulong) pos)); + + /* + TODO: + Verify that it is OK to do seek in the non-append + area in SEQ_READ_APPEND cache + a) see if this always works + b) see if there is a better way to make it work + */ + if (info->type == SEQ_READ_APPEND) + (void) flush_io_cache(info); + + offset=(pos - info->pos_in_file); + + if (info->type == READ_CACHE || info->type == SEQ_READ_APPEND) + { + /* TODO: explain why this works if pos < info->pos_in_file */ + if ((ulonglong) offset < (ulonglong) (info->read_end - info->buffer)) + { + /* The read is in the current buffer; Reuse it */ + info->read_pos = info->buffer + offset; + DBUG_VOID_RETURN; + } + else + { + /* Force a new read on next my_b_read */ + info->read_pos=info->read_end=info->buffer; + } + } + else if (info->type == WRITE_CACHE) + { + /* If write is in current buffer, reuse it */ + if ((ulonglong) offset < + (ulonglong) (info->write_end - info->write_buffer)) + { + info->write_pos = info->write_buffer + offset; + DBUG_VOID_RETURN; + } + (void) flush_io_cache(info); + /* Correct buffer end so that we write in increments of IO_SIZE */ + info->write_end=(info->write_buffer+info->buffer_length- + (pos & (IO_SIZE-1))); + } + info->pos_in_file=pos; + info->seek_not_done=1; + DBUG_VOID_RETURN; +} + + +/* + Fill buffer of the cache. + + NOTES + This assumes that you have already used all characters in the CACHE, + independent of the read_pos value! + + RETURN + 0 On error or EOF (info->error = -1 on error) + # Number of characters +*/ + + +size_t my_b_fill(IO_CACHE *info) +{ + my_off_t pos_in_file=(info->pos_in_file+ + (size_t) (info->read_end - info->buffer)); + size_t diff_length, length, max_length; + + if (info->seek_not_done) + { /* File touched, do seek */ + if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == + MY_FILEPOS_ERROR) + { + info->error= 0; + return 0; + } + info->seek_not_done=0; + } + diff_length=(size_t) (pos_in_file & (IO_SIZE-1)); + max_length=(info->read_length-diff_length); + if (max_length >= (info->end_of_file - pos_in_file)) + max_length= (size_t) (info->end_of_file - pos_in_file); + + if (!max_length) + { + info->error= 0; + return 0; /* EOF */ + } + if ((length= my_read(info->file,info->buffer,max_length, + info->myflags)) == (size_t) -1) + { + info->error= -1; + return 0; + } + info->read_pos=info->buffer; + info->read_end=info->buffer+length; + info->pos_in_file=pos_in_file; + return length; +} + + +/* + Read a string ended by '\n' into a buffer of 'max_length' size. + Returns number of characters read, 0 on error. + last byte is set to '\0' + If buffer is full then to[max_length-1] will be set to \0. +*/ + +size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length) +{ + char *start = to; + size_t length; + max_length--; /* Save place for end \0 */ + + /* Calculate number of characters in buffer */ + if (!(length= my_b_bytes_in_cache(info)) && + !(length= my_b_fill(info))) + return 0; + + for (;;) + { + uchar *pos, *end; + if (length > max_length) + length=max_length; + for (pos=info->read_pos,end=pos+length ; pos < end ;) + { + if ((*to++ = *pos++) == '\n') + { + info->read_pos=pos; + *to='\0'; + return (size_t) (to-start); + } + } + if (!(max_length-=length)) + { + /* Found enough charcters; Return found string */ + info->read_pos=pos; + *to='\0'; + return (size_t) (to-start); + } + if (!(length=my_b_fill(info))) + return 0; + } +} + + +my_off_t my_b_filelength(IO_CACHE *info) +{ + if (info->type == WRITE_CACHE) + return my_b_tell(info); + + info->seek_not_done= 1; + return my_seek(info->file, 0L, MY_SEEK_END, MYF(0)); +} + + +/* + Simple printf version. Supports '%s', '%d', '%u', "%ld" and "%lu" + Used for logging in MySQL + returns number of written character, or (size_t) -1 on error +*/ + +size_t my_b_printf(IO_CACHE *info, const char* fmt, ...) +{ + size_t result; + va_list args; + va_start(args,fmt); + result=my_b_vprintf(info, fmt, args); + va_end(args); + return result; +} + + +size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args) +{ + size_t out_length= 0; + uint minimum_width; /* as yet unimplemented */ + uint minimum_width_sign; + uint precision; /* as yet unimplemented for anything but %b */ + my_bool is_zero_padded; + + /* + Store the location of the beginning of a format directive, for the + case where we learn we shouldn't have been parsing a format string + at all, and we don't want to lose the flag/precision/width/size + information. + */ + const char* backtrack; + + for (; *fmt != '\0'; fmt++) + { + /* Copy everything until '%' or end of string */ + const char *start=fmt; + size_t length; + + for (; (*fmt != '\0') && (*fmt != '%'); fmt++) ; + + length= (size_t) (fmt - start); + out_length+=length; + if (my_b_write(info, (const uchar*) start, length)) + goto err; + + if (*fmt == '\0') /* End of format */ + return out_length; + + /* + By this point, *fmt must be a percent; Keep track of this location and + skip over the percent character. + */ + DBUG_ASSERT(*fmt == '%'); + backtrack= fmt; + fmt++; + + is_zero_padded= FALSE; + minimum_width_sign= 1; + minimum_width= 0; + precision= 0; + /* Skip if max size is used (to be compatible with printf) */ + +process_flags: + switch (*fmt) + { + case '-': + minimum_width_sign= -1; fmt++; goto process_flags; + case '0': + is_zero_padded= TRUE; fmt++; goto process_flags; + case '#': + /** @todo Implement "#" conversion flag. */ fmt++; goto process_flags; + case ' ': + /** @todo Implement " " conversion flag. */ fmt++; goto process_flags; + case '+': + /** @todo Implement "+" conversion flag. */ fmt++; goto process_flags; + } + + if (*fmt == '*') + { + precision= (int) va_arg(args, int); + fmt++; + } + else + { + while (my_isdigit(&my_charset_latin1, *fmt)) { + minimum_width=(minimum_width * 10) + (*fmt - '0'); + fmt++; + } + } + minimum_width*= minimum_width_sign; + + if (*fmt == '.') + { + fmt++; + if (*fmt == '*') { + precision= (int) va_arg(args, int); + fmt++; + } + else + { + while (my_isdigit(&my_charset_latin1, *fmt)) { + precision=(precision * 10) + (*fmt - '0'); + fmt++; + } + } + } + + if (*fmt == 's') /* String parameter */ + { + reg2 char *par = va_arg(args, char *); + size_t length2 = strlen(par); + /* TODO: implement precision */ + out_length+= length2; + if (my_b_write(info, (uchar*) par, length2)) + goto err; + } + else if (*fmt == 'b') /* Sized buffer parameter, only precision makes sense */ + { + char *par = va_arg(args, char *); + out_length+= precision; + if (my_b_write(info, (uchar*) par, precision)) + goto err; + } + else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ + { + register int iarg; + size_t length2; + char buff[17]; + + iarg = va_arg(args, int); + if (*fmt == 'd') + length2= (size_t) (int10_to_str((long) iarg,buff, -10) - buff); + else + length2= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff); + + /* minimum width padding */ + if (minimum_width > length2) + { + uchar *buffz; + + buffz= (uchar*) my_alloca(minimum_width - length2); + if (is_zero_padded) + memset(buffz, '0', minimum_width - length2); + else + memset(buffz, ' ', minimum_width - length2); + my_b_write(info, buffz, minimum_width - length2); + my_afree(buffz); + } + + out_length+= length2; + if (my_b_write(info, (uchar*) buff, length2)) + goto err; + } + else if ((*fmt == 'l' && fmt[1] == 'd') || fmt[1] == 'u') + /* long parameter */ + { + register long iarg; + size_t length2; + char buff[17]; + + iarg = va_arg(args, long); + if (*++fmt == 'd') + length2= (size_t) (int10_to_str(iarg,buff, -10) - buff); + else + length2= (size_t) (int10_to_str(iarg,buff,10)- buff); + out_length+= length2; + if (my_b_write(info, (uchar*) buff, length2)) + goto err; + } + else + { + /* %% or unknown code */ + if (my_b_write(info, (uchar*) backtrack, (size_t) (fmt-backtrack))) + goto err; + out_length+= fmt-backtrack; + } + } + return out_length; + +err: + return (size_t) -1; +} diff --git a/externals/mysql/mysys/mf_keycache.c b/externals/mysql/mysys/mf_keycache.c new file mode 100644 index 0000000..aca47f5 --- /dev/null +++ b/externals/mysql/mysys/mf_keycache.c @@ -0,0 +1,4580 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file + These functions handle keyblock cacheing for ISAM and MyISAM tables. + + One cache can handle many files. + It must contain buffers of the same blocksize. + init_key_cache() should be used to init cache handler. + + The free list (free_block_list) is a stack like structure. + When a block is freed by free_block(), it is pushed onto the stack. + When a new block is required it is first tried to pop one from the stack. + If the stack is empty, it is tried to get a never-used block from the pool. + If this is empty too, then a block is taken from the LRU ring, flushing it + to disk, if neccessary. This is handled in find_key_block(). + With the new free list, the blocks can have three temperatures: + hot, warm and cold (which is free). This is remembered in the block header + by the enum BLOCK_TEMPERATURE temperature variable. Remembering the + temperature is neccessary to correctly count the number of warm blocks, + which is required to decide when blocks are allowed to become hot. Whenever + a block is inserted to another (sub-)chain, we take the old and new + temperature into account to decide if we got one more or less warm block. + blocks_unused is the sum of never used blocks in the pool and of currently + free blocks. blocks_used is the number of blocks fetched from the pool and + as such gives the maximum number of in-use blocks at any time. +*/ + +/* + Key Cache Locking + ================= + + All key cache locking is done with a single mutex per key cache: + keycache->cache_lock. This mutex is locked almost all the time + when executing code in this file (mf_keycache.c). + However it is released for I/O and some copy operations. + + The cache_lock is also released when waiting for some event. Waiting + and signalling is done via condition variables. In most cases the + thread waits on its thread->suspend condition variable. Every thread + has a my_thread_var structure, which contains this variable and a + '*next' and '**prev' pointer. These pointers are used to insert the + thread into a wait queue. + + A thread can wait for one block and thus be in one wait queue at a + time only. + + Before starting to wait on its condition variable with + pthread_cond_wait(), the thread enters itself to a specific wait queue + with link_into_queue() (double linked with '*next' + '**prev') or + wait_on_queue() (single linked with '*next'). + + Another thread, when releasing a resource, looks up the waiting thread + in the related wait queue. It sends a signal with + pthread_cond_signal() to the waiting thread. + + NOTE: Depending on the particular wait situation, either the sending + thread removes the waiting thread from the wait queue with + unlink_from_queue() or release_whole_queue() respectively, or the waiting + thread removes itself. + + There is one exception from this locking scheme when one thread wants + to reuse a block for some other address. This works by first marking + the block reserved (status= BLOCK_IN_SWITCH) and then waiting for all + threads that are reading the block to finish. Each block has a + reference to a condition variable (condvar). It holds a reference to + the thread->suspend condition variable for the waiting thread (if such + a thread exists). When that thread is signaled, the reference is + cleared. The number of readers of a block is registered in + block->hash_link->requests. See wait_for_readers() / remove_reader() + for details. This is similar to the above, but it clearly means that + only one thread can wait for a particular block. There is no queue in + this case. Strangely enough block->convar is used for waiting for the + assigned hash_link only. More precisely it is used to wait for all + requests to be unregistered from the assigned hash_link. + + The resize_queue serves two purposes: + 1. Threads that want to do a resize wait there if in_resize is set. + This is not used in the server. The server refuses a second resize + request if one is already active. keycache->in_init is used for the + synchronization. See set_var.cc. + 2. Threads that want to access blocks during resize wait here during + the re-initialization phase. + When the resize is done, all threads on the queue are signalled. + Hypothetical resizers can compete for resizing, and read/write + requests will restart to request blocks from the freshly resized + cache. If the cache has been resized too small, it is disabled and + 'can_be_used' is false. In this case read/write requests bypass the + cache. Since they increment and decrement 'cnt_for_resize_op', the + next resizer can wait on the queue 'waiting_for_resize_cnt' until all + I/O finished. +*/ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include "my_static.h" +#include +#include +#include +#include + +/* + Some compilation flags have been added specifically for this module + to control the following: + - not to let a thread to yield the control when reading directly + from key cache, which might improve performance in many cases; + to enable this add: + #define SERIALIZED_READ_FROM_CACHE + - to set an upper bound for number of threads simultaneously + using the key cache; this setting helps to determine an optimal + size for hash table and improve performance when the number of + blocks in the key cache much less than the number of threads + accessing it; + to set this number equal to add + #define MAX_THREADS + - to substitute calls of pthread_cond_wait for calls of + pthread_cond_timedwait (wait with timeout set up); + this setting should be used only when you want to trap a deadlock + situation, which theoretically should not happen; + to set timeout equal to seconds add + #define KEYCACHE_TIMEOUT + - to enable the module traps and to send debug information from + key cache module to a special debug log add: + #define KEYCACHE_DEBUG + the name of this debug log file can be set through: + #define KEYCACHE_DEBUG_LOG + if the name is not defined, it's set by default; + if the KEYCACHE_DEBUG flag is not set up and we are in a debug + mode, i.e. when ! defined(DBUG_OFF), the debug information from the + module is sent to the regular debug log. + + Example of the settings: + #define SERIALIZED_READ_FROM_CACHE + #define MAX_THREADS 100 + #define KEYCACHE_TIMEOUT 1 + #define KEYCACHE_DEBUG + #define KEYCACHE_DEBUG_LOG "my_key_cache_debug.log" +*/ + +#define STRUCT_PTR(TYPE, MEMBER, a) \ + (TYPE *) ((char *) (a) - offsetof(TYPE, MEMBER)) + +/* types of condition variables */ +#define COND_FOR_REQUESTED 0 +#define COND_FOR_SAVED 1 +#define COND_FOR_READERS 2 + +typedef pthread_cond_t KEYCACHE_CONDVAR; + +/* descriptor of the page in the key cache block buffer */ +struct st_keycache_page +{ + int file; /* file to which the page belongs to */ + my_off_t filepos; /* position of the page in the file */ +}; + +/* element in the chain of a hash table bucket */ +struct st_hash_link +{ + struct st_hash_link *next, **prev; /* to connect links in the same bucket */ + struct st_block_link *block; /* reference to the block for the page: */ + File file; /* from such a file */ + my_off_t diskpos; /* with such an offset */ + uint requests; /* number of requests for the page */ +}; + +/* simple states of a block */ +#define BLOCK_ERROR 1 /* an error occured when performing file i/o */ +#define BLOCK_READ 2 /* file block is in the block buffer */ +#define BLOCK_IN_SWITCH 4 /* block is preparing to read new page */ +#define BLOCK_REASSIGNED 8 /* blk does not accept requests for old page */ +#define BLOCK_IN_FLUSH 16 /* block is selected for flush */ +#define BLOCK_CHANGED 32 /* block buffer contains a dirty page */ +#define BLOCK_IN_USE 64 /* block is not free */ +#define BLOCK_IN_EVICTION 128 /* block is selected for eviction */ +#define BLOCK_IN_FLUSHWRITE 256 /* block is in write to file */ +#define BLOCK_FOR_UPDATE 512 /* block is selected for buffer modification */ + +/* page status, returned by find_key_block */ +#define PAGE_READ 0 +#define PAGE_TO_BE_READ 1 +#define PAGE_WAIT_TO_BE_READ 2 + +/* block temperature determines in which (sub-)chain the block currently is */ +enum BLOCK_TEMPERATURE { BLOCK_COLD /*free*/ , BLOCK_WARM , BLOCK_HOT }; + +/* key cache block */ +struct st_block_link +{ + struct st_block_link + *next_used, **prev_used; /* to connect links in the LRU chain (ring) */ + struct st_block_link + *next_changed, **prev_changed; /* for lists of file dirty/clean blocks */ + struct st_hash_link *hash_link; /* backward ptr to referring hash_link */ + KEYCACHE_WQUEUE wqueue[2]; /* queues on waiting requests for new/old pages */ + uint requests; /* number of requests for the block */ + uchar *buffer; /* buffer for the block page */ + uint offset; /* beginning of modified data in the buffer */ + uint length; /* end of data in the buffer */ + uint status; /* state of the block */ + enum BLOCK_TEMPERATURE temperature; /* block temperature: cold, warm, hot */ + uint hits_left; /* number of hits left until promotion */ + ulonglong last_hit_time; /* timestamp of the last hit */ + KEYCACHE_CONDVAR *condvar; /* condition variable for 'no readers' event */ + void *post_write_arg; /**< post_write's argument*/ +}; + +KEY_CACHE dflt_key_cache_var; +KEY_CACHE *dflt_key_cache= &dflt_key_cache_var; + +#define FLUSH_CACHE 2000 /* sort this many blocks at once */ + +static int flush_all_key_blocks(KEY_CACHE *keycache); +#ifdef THREAD +static void wait_on_queue(KEYCACHE_WQUEUE *wqueue, + pthread_mutex_t *mutex); +static void release_whole_queue(KEYCACHE_WQUEUE *wqueue); +#else +#define wait_on_queue(wqueue, mutex) do {} while (0) +#define release_whole_queue(wqueue) do {} while (0) +#endif +static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block); +#if !defined(DBUG_OFF) +static void test_key_cache(KEY_CACHE *keycache, + const char *where, my_bool lock); +#endif + +#define KEYCACHE_HASH(f, pos) \ +(((ulong) ((pos) / keycache->key_cache_block_size) + \ + (ulong) (f)) & (keycache->hash_entries-1)) +#define FILE_HASH(f) ((uint) (f) & (CHANGED_BLOCKS_HASH-1)) + +#define DEFAULT_KEYCACHE_DEBUG_LOG "keycache_debug.log" + +#if defined(KEYCACHE_DEBUG) && ! defined(KEYCACHE_DEBUG_LOG) +#define KEYCACHE_DEBUG_LOG DEFAULT_KEYCACHE_DEBUG_LOG +#endif + +#if defined(KEYCACHE_DEBUG_LOG) +static FILE *keycache_debug_log=NULL; +static void keycache_debug_print _VARARGS((const char *fmt,...)); +#define KEYCACHE_DEBUG_OPEN \ + if (!keycache_debug_log) \ + { \ + keycache_debug_log= fopen(KEYCACHE_DEBUG_LOG, "w"); \ + (void) setvbuf(keycache_debug_log, NULL, _IOLBF, BUFSIZ); \ + } + +#define KEYCACHE_DEBUG_CLOSE \ + if (keycache_debug_log) \ + { \ + fclose(keycache_debug_log); \ + keycache_debug_log= 0; \ + } +#else +#define KEYCACHE_DEBUG_OPEN +#define KEYCACHE_DEBUG_CLOSE +#endif /* defined(KEYCACHE_DEBUG_LOG) */ + +#if defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) +#define KEYCACHE_DBUG_PRINT(l, m) \ + { if (keycache_debug_log) fprintf(keycache_debug_log, "%s: ", l); \ + keycache_debug_print m; } + +#define KEYCACHE_DBUG_ASSERT(a) \ + { if (! (a) && keycache_debug_log) fclose(keycache_debug_log); \ + assert(a); } +#else +#define KEYCACHE_DBUG_PRINT(l, m) DBUG_PRINT(l, m) +#define KEYCACHE_DBUG_ASSERT(a) DBUG_ASSERT(a) +#endif /* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */ + +#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) +#ifdef THREAD +static long keycache_thread_id; +#define KEYCACHE_THREAD_TRACE(l) \ + KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id)) + +#define KEYCACHE_THREAD_TRACE_BEGIN(l) \ + { struct st_my_thread_var *thread_var= my_thread_var; \ + keycache_thread_id= thread_var->id; \ + KEYCACHE_DBUG_PRINT(l,("[thread %ld",keycache_thread_id)) } + +#define KEYCACHE_THREAD_TRACE_END(l) \ + KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id)) +#else /* THREAD */ +#define KEYCACHE_THREAD_TRACE(l) KEYCACHE_DBUG_PRINT(l,("")) +#define KEYCACHE_THREAD_TRACE_BEGIN(l) KEYCACHE_DBUG_PRINT(l,("")) +#define KEYCACHE_THREAD_TRACE_END(l) KEYCACHE_DBUG_PRINT(l,("")) +#endif /* THREAD */ +#else +#define KEYCACHE_THREAD_TRACE_BEGIN(l) +#define KEYCACHE_THREAD_TRACE_END(l) +#define KEYCACHE_THREAD_TRACE(l) +#endif /* defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF) */ + +#define BLOCK_NUMBER(b) \ + ((uint) (((char*)(b)-(char *) keycache->block_root)/sizeof(BLOCK_LINK))) +#define HASH_LINK_NUMBER(h) \ + ((uint) (((char*)(h)-(char *) keycache->hash_link_root)/sizeof(HASH_LINK))) + +#if (defined(KEYCACHE_TIMEOUT) && !defined(__WIN__)) || defined(KEYCACHE_DEBUG) +static int keycache_pthread_cond_wait(pthread_cond_t *cond, + pthread_mutex_t *mutex); +#else +#define keycache_pthread_cond_wait pthread_cond_wait +#endif + +#if defined(KEYCACHE_DEBUG) +static int keycache_pthread_mutex_lock(pthread_mutex_t *mutex); +static void keycache_pthread_mutex_unlock(pthread_mutex_t *mutex); +static int keycache_pthread_cond_signal(pthread_cond_t *cond); +#else +#define keycache_pthread_mutex_lock pthread_mutex_lock +#define keycache_pthread_mutex_unlock pthread_mutex_unlock +#define keycache_pthread_cond_signal pthread_cond_signal +#endif /* defined(KEYCACHE_DEBUG) */ + +#if !defined(DBUG_OFF) +#if defined(inline) +#undef inline +#endif +#define inline /* disabled inline for easier debugging */ +static int fail_block(BLOCK_LINK *block); +static int fail_hlink(HASH_LINK *hlink); +static int cache_empty(KEY_CACHE *keycache); +#endif + +static inline uint next_power(uint value) +{ + return (uint) my_round_up_to_next_power((uint32) value) << 1; +} + + +/* + Initialize a key cache + + SYNOPSIS + init_key_cache() + keycache pointer to a key cache data structure + key_cache_block_size size of blocks to keep cached data + use_mem total memory to use for the key cache + division_limit division limit (may be zero) + age_threshold age threshold (may be zero) + + RETURN VALUE + number of blocks in the key cache, if successful, + 0 - otherwise. + + NOTES. + if keycache->key_cache_inited != 0 we assume that the key cache + is already initialized. This is for now used by myisamchk, but shouldn't + be something that a program should rely on! + + It's assumed that no two threads call this function simultaneously + referring to the same key cache handle. + +*/ + +int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, + size_t use_mem, uint division_limit, + uint age_threshold) +{ + ulong blocks, hash_links; + size_t length; + int error; + DBUG_ENTER("init_key_cache"); + DBUG_ASSERT(key_cache_block_size >= 512); + + KEYCACHE_DEBUG_OPEN; + if (keycache->key_cache_inited && keycache->disk_blocks > 0) + { + DBUG_PRINT("warning",("key cache already in use")); + DBUG_RETURN(0); + } + + keycache->global_cache_w_requests= keycache->global_cache_r_requests= 0; + keycache->global_cache_read= keycache->global_cache_write= 0; + keycache->disk_blocks= -1; + if (! keycache->key_cache_inited) + { + keycache->key_cache_inited= 1; + /* + Initialize these variables once only. + Their value must survive re-initialization during resizing. + */ + keycache->in_resize= 0; + keycache->resize_in_flush= 0; + keycache->cnt_for_resize_op= 0; + keycache->waiting_for_resize_cnt.last_thread= NULL; + keycache->in_init= 0; + pthread_mutex_init(&keycache->cache_lock, MY_MUTEX_INIT_FAST); + keycache->resize_queue.last_thread= NULL; + keycache->post_write= NULL; + } + + keycache->key_cache_mem_size= use_mem; + keycache->key_cache_block_size= key_cache_block_size; + DBUG_PRINT("info", ("key_cache_block_size: %u", + key_cache_block_size)); + + blocks= (ulong) (use_mem / (sizeof(BLOCK_LINK) + 2 * sizeof(HASH_LINK) + + sizeof(HASH_LINK*) * 5/4 + key_cache_block_size)); + /* It doesn't make sense to have too few blocks (less than 8) */ + if (blocks >= 8) + { + for ( ; ; ) + { + /* Set my_hash_entries to the next bigger 2 power */ + if ((keycache->hash_entries= next_power(blocks)) < blocks * 5/4) + keycache->hash_entries<<= 1; + hash_links= 2 * blocks; +#if defined(MAX_THREADS) + if (hash_links < MAX_THREADS + blocks - 1) + hash_links= MAX_THREADS + blocks - 1; +#endif + while ((length= (ALIGN_SIZE(blocks * sizeof(BLOCK_LINK)) + + ALIGN_SIZE(hash_links * sizeof(HASH_LINK)) + + ALIGN_SIZE(sizeof(HASH_LINK*) * + keycache->hash_entries))) + + ((size_t) blocks * keycache->key_cache_block_size) > use_mem) + blocks--; + /* Allocate memory for cache page buffers */ + if ((keycache->block_mem= + my_large_malloc((size_t) blocks * keycache->key_cache_block_size, + MYF(0)))) + { + /* + Allocate memory for blocks, hash_links and hash entries; + For each block 2 hash links are allocated + */ + if ((keycache->block_root= (BLOCK_LINK*) my_malloc(length, + MYF(0)))) + break; + my_large_free(keycache->block_mem, MYF(0)); + keycache->block_mem= 0; + } + if (blocks < 8) + { + my_errno= ENOMEM; + my_error(EE_OUTOFMEMORY, MYF(0), blocks * keycache->key_cache_block_size); + goto err; + } + blocks= blocks / 4*3; + } + keycache->blocks_unused= blocks; + keycache->disk_blocks= (int) blocks; + keycache->hash_links= hash_links; + keycache->hash_root= (HASH_LINK**) ((char*) keycache->block_root + + ALIGN_SIZE(blocks*sizeof(BLOCK_LINK))); + keycache->hash_link_root= (HASH_LINK*) ((char*) keycache->hash_root + + ALIGN_SIZE((sizeof(HASH_LINK*) * + keycache->hash_entries))); + bzero((uchar*) keycache->block_root, + keycache->disk_blocks * sizeof(BLOCK_LINK)); + bzero((uchar*) keycache->hash_root, + keycache->hash_entries * sizeof(HASH_LINK*)); + bzero((uchar*) keycache->hash_link_root, + keycache->hash_links * sizeof(HASH_LINK)); + keycache->hash_links_used= 0; + keycache->free_hash_list= NULL; + keycache->blocks_used= keycache->blocks_changed= 0; + + keycache->global_blocks_changed= 0; + keycache->blocks_available=0; /* For debugging */ + + /* The LRU chain is empty after initialization */ + keycache->used_last= NULL; + keycache->used_ins= NULL; + keycache->free_block_list= NULL; + keycache->keycache_time= 0; + keycache->warm_blocks= 0; + keycache->min_warm_blocks= (division_limit ? + blocks * division_limit / 100 + 1 : + blocks); + keycache->age_threshold= (age_threshold ? + blocks * age_threshold / 100 : + blocks); + + keycache->can_be_used= 1; + + keycache->waiting_for_hash_link.last_thread= NULL; + keycache->waiting_for_block.last_thread= NULL; + DBUG_PRINT("exit", + ("disk_blocks: %d block_root: %p hash_entries: %d\ + hash_root: %p hash_links: %d hash_link_root: %p", + keycache->disk_blocks, keycache->block_root, + keycache->hash_entries, keycache->hash_root, + keycache->hash_links, keycache->hash_link_root)); + bzero((uchar*) keycache->changed_blocks, + sizeof(keycache->changed_blocks[0]) * CHANGED_BLOCKS_HASH); + bzero((uchar*) keycache->file_blocks, + sizeof(keycache->file_blocks[0]) * CHANGED_BLOCKS_HASH); + } + else + { + /* key_buffer_size is specified too small. Disable the cache. */ + keycache->can_be_used= 0; + } + + keycache->blocks= keycache->disk_blocks > 0 ? keycache->disk_blocks : 0; + DBUG_RETURN((int) keycache->disk_blocks); + +err: + error= my_errno; + keycache->disk_blocks= 0; + keycache->blocks= 0; + if (keycache->block_mem) + { + my_large_free((uchar*) keycache->block_mem, MYF(0)); + keycache->block_mem= NULL; + } + if (keycache->block_root) + { + my_free((uchar*) keycache->block_root, MYF(0)); + keycache->block_root= NULL; + } + my_errno= error; + keycache->can_be_used= 0; + DBUG_RETURN(0); +} + + +/* + Resize a key cache + + SYNOPSIS + resize_key_cache() + keycache pointer to a key cache data structure + key_cache_block_size size of blocks to keep cached data + use_mem total memory to use for the new key cache + division_limit new division limit (if not zero) + age_threshold new age threshold (if not zero) + + RETURN VALUE + number of blocks in the key cache, if successful, + 0 - otherwise. + + NOTES. + The function first compares the memory size and the block size parameters + with the key cache values. + + If they differ the function free the the memory allocated for the + old key cache blocks by calling the end_key_cache function and + then rebuilds the key cache with new blocks by calling + init_key_cache. + + The function starts the operation only when all other threads + performing operations with the key cache let her to proceed + (when cnt_for_resize=0). +*/ + +int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, + size_t use_mem, uint division_limit, + uint age_threshold) +{ + int blocks; + DBUG_ENTER("resize_key_cache"); + + if (!keycache->key_cache_inited) + DBUG_RETURN(keycache->disk_blocks); + + if(key_cache_block_size == keycache->key_cache_block_size && + use_mem == keycache->key_cache_mem_size) + { + change_key_cache_param(keycache, division_limit, age_threshold); + DBUG_RETURN(keycache->disk_blocks); + } + + keycache_pthread_mutex_lock(&keycache->cache_lock); + +#ifdef THREAD + /* + We may need to wait for another thread which is doing a resize + already. This cannot happen in the MySQL server though. It allows + one resizer only. In set_var.cc keycache->in_init is used to block + multiple attempts. + */ + while (keycache->in_resize) + { + /* purecov: begin inspected */ + wait_on_queue(&keycache->resize_queue, &keycache->cache_lock); + /* purecov: end */ + } +#endif + + /* + Mark the operation in progress. This blocks other threads from doing + a resize in parallel. It prohibits new blocks to enter the cache. + Read/write requests can bypass the cache during the flush phase. + */ + keycache->in_resize= 1; + + /* Need to flush only if keycache is enabled. */ + if (keycache->can_be_used) + { + /* Start the flush phase. */ + keycache->resize_in_flush= 1; + + if (flush_all_key_blocks(keycache)) + { + /* TODO: if this happens, we should write a warning in the log file ! */ + keycache->resize_in_flush= 0; + blocks= 0; + keycache->can_be_used= 0; + goto finish; + } + DBUG_ASSERT(cache_empty(keycache)); + + /* End the flush phase. */ + keycache->resize_in_flush= 0; + } + +#ifdef THREAD + /* + Some direct read/write operations (bypassing the cache) may still be + unfinished. Wait until they are done. If the key cache can be used, + direct I/O is done in increments of key_cache_block_size. That is, + every block is checked if it is in the cache. We need to wait for + pending I/O before re-initializing the cache, because we may change + the block size. Otherwise they could check for blocks at file + positions where the new block division has none. We do also want to + wait for I/O done when (if) the cache was disabled. It must not + run in parallel with normal cache operation. + */ + while (keycache->cnt_for_resize_op) + wait_on_queue(&keycache->waiting_for_resize_cnt, &keycache->cache_lock); +#else + KEYCACHE_DBUG_ASSERT(keycache->cnt_for_resize_op == 0); +#endif + + /* + Free old cache structures, allocate new structures, and initialize + them. Note that the cache_lock mutex and the resize_queue are left + untouched. We do not lose the cache_lock and will release it only at + the end of this function. + */ + end_key_cache(keycache, 0); /* Don't free mutex */ + /* The following will work even if use_mem is 0 */ + blocks= init_key_cache(keycache, key_cache_block_size, use_mem, + division_limit, age_threshold); + +finish: + /* + Mark the resize finished. This allows other threads to start a + resize or to request new cache blocks. + */ + keycache->in_resize= 0; + + /* Signal waiting threads. */ + release_whole_queue(&keycache->resize_queue); + + keycache_pthread_mutex_unlock(&keycache->cache_lock); + DBUG_RETURN(blocks); +} + + +/* + Increment counter blocking resize key cache operation +*/ +static inline void inc_counter_for_resize_op(KEY_CACHE *keycache) +{ + keycache->cnt_for_resize_op++; +} + + +/* + Decrement counter blocking resize key cache operation; + Signal the operation to proceed when counter becomes equal zero +*/ +static inline void dec_counter_for_resize_op(KEY_CACHE *keycache) +{ + if (!--keycache->cnt_for_resize_op) + release_whole_queue(&keycache->waiting_for_resize_cnt); +} + +/* + Change the key cache parameters + + SYNOPSIS + change_key_cache_param() + keycache pointer to a key cache data structure + division_limit new division limit (if not zero) + age_threshold new age threshold (if not zero) + + RETURN VALUE + none + + NOTES. + Presently the function resets the key cache parameters + concerning midpoint insertion strategy - division_limit and + age_threshold. +*/ + +void change_key_cache_param(KEY_CACHE *keycache, uint division_limit, + uint age_threshold) +{ + DBUG_ENTER("change_key_cache_param"); + + keycache_pthread_mutex_lock(&keycache->cache_lock); + if (division_limit) + keycache->min_warm_blocks= (keycache->disk_blocks * + division_limit / 100 + 1); + if (age_threshold) + keycache->age_threshold= (keycache->disk_blocks * + age_threshold / 100); + keycache_pthread_mutex_unlock(&keycache->cache_lock); + DBUG_VOID_RETURN; +} + + +/* + Remove key_cache from memory + + SYNOPSIS + end_key_cache() + keycache key cache handle + cleanup Complete free (Free also mutex for key cache) + + RETURN VALUE + none +*/ + +void end_key_cache(KEY_CACHE *keycache, my_bool cleanup) +{ + DBUG_ENTER("end_key_cache"); + DBUG_PRINT("enter", ("key_cache: %p", keycache)); + + if (!keycache->key_cache_inited) + DBUG_VOID_RETURN; + + if (keycache->disk_blocks > 0) + { + if (keycache->block_mem) + { + my_large_free((uchar*) keycache->block_mem, MYF(0)); + keycache->block_mem= NULL; + my_free((uchar*) keycache->block_root, MYF(0)); + keycache->block_root= NULL; + } + keycache->disk_blocks= -1; + /* Reset blocks_changed to be safe if flush_all_key_blocks is called */ + keycache->blocks_changed= 0; + } + + DBUG_PRINT("status", ("used: %lu changed: %lu w_requests: %lu " + "writes: %lu r_requests: %lu reads: %lu", + keycache->blocks_used, keycache->global_blocks_changed, + (ulong) keycache->global_cache_w_requests, + (ulong) keycache->global_cache_write, + (ulong) keycache->global_cache_r_requests, + (ulong) keycache->global_cache_read)); + + /* + Reset these values to be able to detect a disabled key cache. + See Bug#44068 (RESTORE can disable the MyISAM Key Cache). + */ + keycache->blocks_used= 0; + keycache->blocks_unused= 0; + + if (cleanup) + { + pthread_mutex_destroy(&keycache->cache_lock); + keycache->key_cache_inited= keycache->can_be_used= 0; + keycache->post_write= NULL; + KEYCACHE_DEBUG_CLOSE; + } + DBUG_VOID_RETURN; +} /* end_key_cache */ + + +/** + Does a my_pwrite() to the file and then calls callback. Arguments are those + of my_pwrite() plus the callback and its argument. + + @note The callback is really POST-write; callers depend on this! So always + call it after writing to the file, not before. + + @return Operation status + @retval 0 ok + @retval !=0 write or callback failed +*/ + +static inline int key_cache_pwrite(int Filedes, const uchar *Buffer, + uint Count, my_off_t offset, myf MyFlags, + KEYCACHE_POST_WRITE_CALLBACK callback, + void *callback_arg) +{ + int ret= my_pwrite(Filedes, Buffer, Count, offset, MyFlags); + if (callback) + ret|= (*callback)(callback_arg, Buffer, Count, offset); + return ret; +} + + +#ifdef THREAD + +/* + Link a thread into double-linked queue of waiting threads. + + SYNOPSIS + link_into_queue() + wqueue pointer to the queue structure + thread pointer to the thread to be added to the queue + + RETURN VALUE + none + + NOTES. + Queue is represented by a circular list of the thread structures + The list is double-linked of the type (**prev,*next), accessed by + a pointer to the last element. +*/ + +static void link_into_queue(KEYCACHE_WQUEUE *wqueue, + struct st_my_thread_var *thread) +{ + struct st_my_thread_var *last; + + DBUG_ASSERT(!thread->next && !thread->prev); + if (! (last= wqueue->last_thread)) + { + /* Queue is empty */ + thread->next= thread; + thread->prev= &thread->next; + } + else + { + thread->prev= last->next->prev; + last->next->prev= &thread->next; + thread->next= last->next; + last->next= thread; + } + wqueue->last_thread= thread; +} + +/* + Unlink a thread from double-linked queue of waiting threads + + SYNOPSIS + unlink_from_queue() + wqueue pointer to the queue structure + thread pointer to the thread to be removed from the queue + + RETURN VALUE + none + + NOTES. + See NOTES for link_into_queue +*/ + +static void unlink_from_queue(KEYCACHE_WQUEUE *wqueue, + struct st_my_thread_var *thread) +{ + KEYCACHE_DBUG_PRINT("unlink_from_queue", ("thread %ld", thread->id)); + DBUG_ASSERT(thread->next && thread->prev); + if (thread->next == thread) + /* The queue contains only one member */ + wqueue->last_thread= NULL; + else + { + thread->next->prev= thread->prev; + *thread->prev=thread->next; + if (wqueue->last_thread == thread) + wqueue->last_thread= STRUCT_PTR(struct st_my_thread_var, next, + thread->prev); + } + thread->next= NULL; +#if !defined(DBUG_OFF) + /* + This makes it easier to see it's not in a chain during debugging. + And some DBUG_ASSERT() rely on it. + */ + thread->prev= NULL; +#endif +} + + +/* + Add a thread to single-linked queue of waiting threads + + SYNOPSIS + wait_on_queue() + wqueue Pointer to the queue structure. + mutex Cache_lock to acquire after awake. + + RETURN VALUE + none + + NOTES. + Queue is represented by a circular list of the thread structures + The list is single-linked of the type (*next), accessed by a pointer + to the last element. + + The function protects against stray signals by verifying that the + current thread is unlinked from the queue when awaking. However, + since several threads can wait for the same event, it might be + necessary for the caller of the function to check again if the + condition for awake is indeed matched. +*/ + +static void wait_on_queue(KEYCACHE_WQUEUE *wqueue, + pthread_mutex_t *mutex) +{ + struct st_my_thread_var *last; + struct st_my_thread_var *thread= my_thread_var; + + /* Add to queue. */ + DBUG_ASSERT(!thread->next); + DBUG_ASSERT(!thread->prev); /* Not required, but must be true anyway. */ + if (! (last= wqueue->last_thread)) + thread->next= thread; + else + { + thread->next= last->next; + last->next= thread; + } + wqueue->last_thread= thread; + + /* + Wait until thread is removed from queue by the signalling thread. + The loop protects against stray signals. + */ + do + { + KEYCACHE_DBUG_PRINT("wait", ("suspend thread %ld", thread->id)); + keycache_pthread_cond_wait(&thread->suspend, mutex); + } + while (thread->next); +} + + +/* + Remove all threads from queue signaling them to proceed + + SYNOPSIS + release_whole_queue() + wqueue pointer to the queue structure + + RETURN VALUE + none + + NOTES. + See notes for wait_on_queue(). + When removed from the queue each thread is signaled via condition + variable thread->suspend. +*/ + +static void release_whole_queue(KEYCACHE_WQUEUE *wqueue) +{ + struct st_my_thread_var *last; + struct st_my_thread_var *next; + struct st_my_thread_var *thread; + + /* Queue may be empty. */ + if (!(last= wqueue->last_thread)) + return; + + next= last->next; + do + { + thread=next; + KEYCACHE_DBUG_PRINT("release_whole_queue: signal", + ("thread %ld", thread->id)); + /* Signal the thread. */ + keycache_pthread_cond_signal(&thread->suspend); + /* Take thread from queue. */ + next=thread->next; + thread->next= NULL; + } + while (thread != last); + + /* Now queue is definitely empty. */ + wqueue->last_thread= NULL; +} + +#endif /* THREAD */ + + +/* + Unlink a block from the chain of dirty/clean blocks +*/ + +static inline void unlink_changed(BLOCK_LINK *block) +{ + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + if (block->next_changed) + block->next_changed->prev_changed= block->prev_changed; + *block->prev_changed= block->next_changed; + +#if !defined(DBUG_OFF) + /* + This makes it easier to see it's not in a chain during debugging. + And some DBUG_ASSERT() rely on it. + */ + block->next_changed= NULL; + block->prev_changed= NULL; +#endif +} + + +/* + Link a block into the chain of dirty/clean blocks +*/ + +static inline void link_changed(BLOCK_LINK *block, BLOCK_LINK **phead) +{ + DBUG_ASSERT(!block->next_changed); + DBUG_ASSERT(!block->prev_changed); + block->prev_changed= phead; + if ((block->next_changed= *phead)) + (*phead)->prev_changed= &block->next_changed; + *phead= block; +} + + +/* + Link a block in a chain of clean blocks of a file. + + SYNOPSIS + link_to_file_list() + keycache Key cache handle + block Block to relink + file File to be linked to + unlink If to unlink first + + DESCRIPTION + Unlink a block from whichever chain it is linked in, if it's + asked for, and link it to the chain of clean blocks of the + specified file. + + NOTE + Please do never set/clear BLOCK_CHANGED outside of + link_to_file_list() or link_to_changed_list(). + You would risk to damage correct counting of changed blocks + and to find blocks in the wrong hash. + + RETURN + void +*/ + +static void link_to_file_list(KEY_CACHE *keycache, + BLOCK_LINK *block, int file, + my_bool unlink_block) +{ + DBUG_ASSERT(block->status & BLOCK_IN_USE); + DBUG_ASSERT(block->hash_link && block->hash_link->block == block); + DBUG_ASSERT(block->hash_link->file == file); + if (unlink_block) + unlink_changed(block); + link_changed(block, &keycache->file_blocks[FILE_HASH(file)]); + if (block->status & BLOCK_CHANGED) + { + block->status&= ~BLOCK_CHANGED; + keycache->blocks_changed--; + keycache->global_blocks_changed--; + } +} + + +/* + Re-link a block from the clean chain to the dirty chain of a file. + + SYNOPSIS + link_to_changed_list() + keycache key cache handle + block block to relink + + DESCRIPTION + Unlink a block from the chain of clean blocks of a file + and link it to the chain of dirty blocks of the same file. + + NOTE + Please do never set/clear BLOCK_CHANGED outside of + link_to_file_list() or link_to_changed_list(). + You would risk to damage correct counting of changed blocks + and to find blocks in the wrong hash. + + RETURN + void +*/ + +static void link_to_changed_list(KEY_CACHE *keycache, + BLOCK_LINK *block) +{ + DBUG_ASSERT(block->status & BLOCK_IN_USE); + DBUG_ASSERT(!(block->status & BLOCK_CHANGED)); + DBUG_ASSERT(block->hash_link && block->hash_link->block == block); + + unlink_changed(block); + link_changed(block, + &keycache->changed_blocks[FILE_HASH(block->hash_link->file)]); + block->status|=BLOCK_CHANGED; + keycache->blocks_changed++; + keycache->global_blocks_changed++; +} + + +/* + Link a block to the LRU chain at the beginning or at the end of + one of two parts. + + SYNOPSIS + link_block() + keycache pointer to a key cache data structure + block pointer to the block to link to the LRU chain + hot <-> to link the block into the hot subchain + at_end <-> to link the block at the end of the subchain + + RETURN VALUE + none + + NOTES. + The LRU ring is represented by a circular list of block structures. + The list is double-linked of the type (**prev,*next) type. + The LRU ring is divided into two parts - hot and warm. + There are two pointers to access the last blocks of these two + parts. The beginning of the warm part follows right after the + end of the hot part. + Only blocks of the warm part can be used for eviction. + The first block from the beginning of this subchain is always + taken for eviction (keycache->last_used->next) + + LRU chain: +------+ H O T +------+ + +----| end |----...<----| beg |----+ + | +------+last +------+ | + v<-link in latest hot (new end) | + | link in latest warm (new end)->^ + | +------+ W A R M +------+ | + +----| beg |---->...----| end |----+ + +------+ +------+ins + first for eviction + + It is also possible that the block is selected for eviction and thus + not linked in the LRU ring. +*/ + +static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot, + my_bool at_end) +{ + BLOCK_LINK *ins; + BLOCK_LINK **pins; + + DBUG_ASSERT((block->status & ~BLOCK_CHANGED) == (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(block->hash_link); /*backptr to block NULL from free_block()*/ + DBUG_ASSERT(!block->requests); + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + DBUG_ASSERT(!block->next_used); + DBUG_ASSERT(!block->prev_used); +#ifdef THREAD + if (!hot && keycache->waiting_for_block.last_thread) + { + /* Signal that in the LRU warm sub-chain an available block has appeared */ + struct st_my_thread_var *last_thread= + keycache->waiting_for_block.last_thread; + struct st_my_thread_var *first_thread= last_thread->next; + struct st_my_thread_var *next_thread= first_thread; + HASH_LINK *hash_link= (HASH_LINK *) first_thread->opt_info; + struct st_my_thread_var *thread; + do + { + thread= next_thread; + next_thread= thread->next; + /* + We notify about the event all threads that ask + for the same page as the first thread in the queue + */ + if ((HASH_LINK *) thread->opt_info == hash_link) + { + KEYCACHE_DBUG_PRINT("link_block: signal", ("thread %ld", thread->id)); + keycache_pthread_cond_signal(&thread->suspend); + unlink_from_queue(&keycache->waiting_for_block, thread); + block->requests++; + } + } + while (thread != last_thread); + hash_link->block= block; + /* + NOTE: We assigned the block to the hash_link and signalled the + requesting thread(s). But it is possible that other threads runs + first. These threads see the hash_link assigned to a block which + is assigned to another hash_link and not marked BLOCK_IN_SWITCH. + This can be a problem for functions that do not select the block + via its hash_link: flush and free. They do only see a block which + is in a "normal" state and don't know that it will be evicted soon. + + We cannot set BLOCK_IN_SWITCH here because only one of the + requesting threads must handle the eviction. All others must wait + for it to complete. If we set the flag here, the threads would not + know who is in charge of the eviction. Without the flag, the first + thread takes the stick and sets the flag. + + But we need to note in the block that is has been selected for + eviction. It must not be freed. The evicting thread will not + expect the block in the free list. Before freeing we could also + check if block->requests > 1. But I think including another flag + in the check of block->status is slightly more efficient and + probably easier to read. + */ + block->status|= BLOCK_IN_EVICTION; + KEYCACHE_THREAD_TRACE("link_block: after signaling"); +#if defined(KEYCACHE_DEBUG) + KEYCACHE_DBUG_PRINT("link_block", + ("linked,unlinked block %u status=%x #requests=%u #available=%u", + BLOCK_NUMBER(block), block->status, + block->requests, keycache->blocks_available)); +#endif + return; + } +#else /* THREAD */ + KEYCACHE_DBUG_ASSERT(! (!hot && keycache->waiting_for_block.last_thread)); + /* Condition not transformed using DeMorgan, to keep the text identical */ +#endif /* THREAD */ + pins= hot ? &keycache->used_ins : &keycache->used_last; + ins= *pins; + if (ins) + { + ins->next_used->prev_used= &block->next_used; + block->next_used= ins->next_used; + block->prev_used= &ins->next_used; + ins->next_used= block; + if (at_end) + *pins= block; + } + else + { + /* The LRU ring is empty. Let the block point to itself. */ + keycache->used_last= keycache->used_ins= block->next_used= block; + block->prev_used= &block->next_used; + } + KEYCACHE_THREAD_TRACE("link_block"); +#if defined(KEYCACHE_DEBUG) + keycache->blocks_available++; + KEYCACHE_DBUG_PRINT("link_block", + ("linked block %u:%1u status=%x #requests=%u #available=%u", + BLOCK_NUMBER(block), at_end, block->status, + block->requests, keycache->blocks_available)); + KEYCACHE_DBUG_ASSERT((ulong) keycache->blocks_available <= + keycache->blocks_used); +#endif +} + + +/* + Unlink a block from the LRU chain + + SYNOPSIS + unlink_block() + keycache pointer to a key cache data structure + block pointer to the block to unlink from the LRU chain + + RETURN VALUE + none + + NOTES. + See NOTES for link_block +*/ + +static void unlink_block(KEY_CACHE *keycache, BLOCK_LINK *block) +{ + DBUG_ASSERT((block->status & ~BLOCK_CHANGED) == (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(block->hash_link); /*backptr to block NULL from free_block()*/ + DBUG_ASSERT(!block->requests); + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + DBUG_ASSERT(block->next_used && block->prev_used && + (block->next_used->prev_used == &block->next_used) && + (*block->prev_used == block)); + if (block->next_used == block) + /* The list contains only one member */ + keycache->used_last= keycache->used_ins= NULL; + else + { + block->next_used->prev_used= block->prev_used; + *block->prev_used= block->next_used; + if (keycache->used_last == block) + keycache->used_last= STRUCT_PTR(BLOCK_LINK, next_used, block->prev_used); + if (keycache->used_ins == block) + keycache->used_ins=STRUCT_PTR(BLOCK_LINK, next_used, block->prev_used); + } + block->next_used= NULL; +#if !defined(DBUG_OFF) + /* + This makes it easier to see it's not in a chain during debugging. + And some DBUG_ASSERT() rely on it. + */ + block->prev_used= NULL; +#endif + + KEYCACHE_THREAD_TRACE("unlink_block"); +#if defined(KEYCACHE_DEBUG) + KEYCACHE_DBUG_ASSERT(keycache->blocks_available != 0); + keycache->blocks_available--; + KEYCACHE_DBUG_PRINT("unlink_block", + ("unlinked block %u status=%x #requests=%u #available=%u", + BLOCK_NUMBER(block), block->status, + block->requests, keycache->blocks_available)); +#endif +} + + +/* + Register requests for a block. + + SYNOPSIS + reg_requests() + keycache Pointer to a key cache data structure. + block Pointer to the block to register a request on. + count Number of requests. Always 1. + + NOTE + The first request unlinks the block from the LRU ring. This means + that it is protected against eveiction. + + RETURN + void +*/ +static void reg_requests(KEY_CACHE *keycache, BLOCK_LINK *block, int count) +{ + DBUG_ASSERT(block->status & BLOCK_IN_USE); + DBUG_ASSERT(block->hash_link); + + if (!block->requests) + unlink_block(keycache, block); + block->requests+=count; +} + + +/* + Unregister request for a block + linking it to the LRU chain if it's the last request + + SYNOPSIS + unreg_request() + keycache pointer to a key cache data structure + block pointer to the block to link to the LRU chain + at_end <-> to link the block at the end of the LRU chain + + RETURN VALUE + none + + NOTES. + Every linking to the LRU ring decrements by one a special block + counter (if it's positive). If the at_end parameter is TRUE the block is + added either at the end of warm sub-chain or at the end of hot sub-chain. + It is added to the hot subchain if its counter is zero and number of + blocks in warm sub-chain is not less than some low limit (determined by + the division_limit parameter). Otherwise the block is added to the warm + sub-chain. If the at_end parameter is FALSE the block is always added + at beginning of the warm sub-chain. + Thus a warm block can be promoted to the hot sub-chain when its counter + becomes zero for the first time. + At the same time the block at the very beginning of the hot subchain + might be moved to the beginning of the warm subchain if it stays untouched + for a too long time (this time is determined by parameter age_threshold). + + It is also possible that the block is selected for eviction and thus + not linked in the LRU ring. +*/ + +static void unreg_request(KEY_CACHE *keycache, + BLOCK_LINK *block, int at_end) +{ + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(block->hash_link); /*backptr to block NULL from free_block()*/ + DBUG_ASSERT(block->requests); + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + DBUG_ASSERT(!block->next_used); + DBUG_ASSERT(!block->prev_used); + /* + Unregister the request, but do not link erroneous blocks into the + LRU ring. + */ + if (!--block->requests && !(block->status & BLOCK_ERROR)) + { + my_bool hot; + if (block->hits_left) + block->hits_left--; + hot= !block->hits_left && at_end && + keycache->warm_blocks > keycache->min_warm_blocks; + if (hot) + { + if (block->temperature == BLOCK_WARM) + keycache->warm_blocks--; + block->temperature= BLOCK_HOT; + KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu", + keycache->warm_blocks)); + } + link_block(keycache, block, hot, (my_bool)at_end); + block->last_hit_time= keycache->keycache_time; + keycache->keycache_time++; + /* + At this place, the block might be in the LRU ring or not. If an + evicter was waiting for a block, it was selected for eviction and + not linked in the LRU ring. + */ + + /* + Check if we should link a hot block to the warm block sub-chain. + It is possible that we select the same block as above. But it can + also be another block. In any case a block from the LRU ring is + selected. In other words it works even if the above block was + selected for eviction and not linked in the LRU ring. Since this + happens only if the LRU ring is empty, the block selected below + would be NULL and the rest of the function skipped. + */ + block= keycache->used_ins; + if (block && keycache->keycache_time - block->last_hit_time > + keycache->age_threshold) + { + unlink_block(keycache, block); + link_block(keycache, block, 0, 0); + if (block->temperature != BLOCK_WARM) + { + keycache->warm_blocks++; + block->temperature= BLOCK_WARM; + } + KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu", + keycache->warm_blocks)); + } + } +} + +/* + Remove a reader of the page in block +*/ + +static void remove_reader(BLOCK_LINK *block) +{ + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(block->hash_link && block->hash_link->block == block); + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + DBUG_ASSERT(!block->next_used); + DBUG_ASSERT(!block->prev_used); + DBUG_ASSERT(block->hash_link->requests); +#ifdef THREAD + if (! --block->hash_link->requests && block->condvar) + keycache_pthread_cond_signal(block->condvar); +#else + --block->hash_link->requests; +#endif +} + + +/* + Wait until the last reader of the page in block + signals on its termination +*/ + +static void wait_for_readers(KEY_CACHE *keycache, + BLOCK_LINK *block) +{ +#ifdef THREAD + struct st_my_thread_var *thread= my_thread_var; + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(!(block->status & (BLOCK_IN_FLUSH | BLOCK_CHANGED))); + DBUG_ASSERT(block->hash_link); + DBUG_ASSERT(block->hash_link->block == block); + /* Linked in file_blocks or changed_blocks hash. */ + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + /* Not linked in LRU ring. */ + DBUG_ASSERT(!block->next_used); + DBUG_ASSERT(!block->prev_used); + while (block->hash_link->requests) + { + KEYCACHE_DBUG_PRINT("wait_for_readers: wait", + ("suspend thread %ld block %u", + thread->id, BLOCK_NUMBER(block))); + /* There must be no other waiter. We have no queue here. */ + DBUG_ASSERT(!block->condvar); + block->condvar= &thread->suspend; + keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock); + block->condvar= NULL; + } +#else + KEYCACHE_DBUG_ASSERT(block->hash_link->requests == 0); +#endif +} + + +/* + Add a hash link to a bucket in the hash_table +*/ + +static inline void link_hash(HASH_LINK **start, HASH_LINK *hash_link) +{ + if (*start) + (*start)->prev= &hash_link->next; + hash_link->next= *start; + hash_link->prev= start; + *start= hash_link; +} + + +/* + Remove a hash link from the hash table +*/ + +static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link) +{ + KEYCACHE_DBUG_PRINT("unlink_hash", ("fd: %u pos_ %lu #requests=%u", + (uint) hash_link->file,(ulong) hash_link->diskpos, hash_link->requests)); + KEYCACHE_DBUG_ASSERT(hash_link->requests == 0); + if ((*hash_link->prev= hash_link->next)) + hash_link->next->prev= hash_link->prev; + hash_link->block= NULL; +#ifdef THREAD + if (keycache->waiting_for_hash_link.last_thread) + { + /* Signal that a free hash link has appeared */ + struct st_my_thread_var *last_thread= + keycache->waiting_for_hash_link.last_thread; + struct st_my_thread_var *first_thread= last_thread->next; + struct st_my_thread_var *next_thread= first_thread; + KEYCACHE_PAGE *first_page= (KEYCACHE_PAGE *) (first_thread->opt_info); + struct st_my_thread_var *thread; + + hash_link->file= first_page->file; + hash_link->diskpos= first_page->filepos; + do + { + KEYCACHE_PAGE *page; + thread= next_thread; + page= (KEYCACHE_PAGE *) thread->opt_info; + next_thread= thread->next; + /* + We notify about the event all threads that ask + for the same page as the first thread in the queue + */ + if (page->file == hash_link->file && page->filepos == hash_link->diskpos) + { + KEYCACHE_DBUG_PRINT("unlink_hash: signal", ("thread %ld", thread->id)); + keycache_pthread_cond_signal(&thread->suspend); + unlink_from_queue(&keycache->waiting_for_hash_link, thread); + } + } + while (thread != last_thread); + link_hash(&keycache->hash_root[KEYCACHE_HASH(hash_link->file, + hash_link->diskpos)], + hash_link); + return; + } +#else /* THREAD */ + KEYCACHE_DBUG_ASSERT(! (keycache->waiting_for_hash_link.last_thread)); +#endif /* THREAD */ + hash_link->next= keycache->free_hash_list; + keycache->free_hash_list= hash_link; +} + + +/* + Get the hash link for a page +*/ + +static HASH_LINK *get_hash_link(KEY_CACHE *keycache, + int file, my_off_t filepos) +{ + reg1 HASH_LINK *hash_link, **start; +#if defined(KEYCACHE_DEBUG) + int cnt; +#endif + + KEYCACHE_DBUG_PRINT("get_hash_link", ("fd: %u pos: %lu", + (uint) file,(ulong) filepos)); + +restart: + /* + Find the bucket in the hash table for the pair (file, filepos); + start contains the head of the bucket list, + hash_link points to the first member of the list + */ + hash_link= *(start= &keycache->hash_root[KEYCACHE_HASH(file, filepos)]); +#if defined(KEYCACHE_DEBUG) + cnt= 0; +#endif + /* Look for an element for the pair (file, filepos) in the bucket chain */ + while (hash_link && + (hash_link->diskpos != filepos || hash_link->file != file)) + { + hash_link= hash_link->next; +#if defined(KEYCACHE_DEBUG) + cnt++; + if (! (cnt <= keycache->hash_links_used)) + { + int i; + for (i=0, hash_link= *start ; + i < cnt ; i++, hash_link= hash_link->next) + { + KEYCACHE_DBUG_PRINT("get_hash_link", ("fd: %u pos: %lu", + (uint) hash_link->file,(ulong) hash_link->diskpos)); + } + } + KEYCACHE_DBUG_ASSERT(cnt <= keycache->hash_links_used); +#endif + } + if (! hash_link) + { + /* There is no hash link in the hash table for the pair (file, filepos) */ + if (keycache->free_hash_list) + { + hash_link= keycache->free_hash_list; + keycache->free_hash_list= hash_link->next; + } + else if (keycache->hash_links_used < keycache->hash_links) + { + hash_link= &keycache->hash_link_root[keycache->hash_links_used++]; + } + else + { +#ifdef THREAD + /* Wait for a free hash link */ + struct st_my_thread_var *thread= my_thread_var; + KEYCACHE_PAGE page; + KEYCACHE_DBUG_PRINT("get_hash_link", ("waiting")); + page.file= file; + page.filepos= filepos; + thread->opt_info= (void *) &page; + link_into_queue(&keycache->waiting_for_hash_link, thread); + KEYCACHE_DBUG_PRINT("get_hash_link: wait", + ("suspend thread %ld", thread->id)); + keycache_pthread_cond_wait(&thread->suspend, + &keycache->cache_lock); + thread->opt_info= NULL; +#else + KEYCACHE_DBUG_ASSERT(0); +#endif + goto restart; + } + hash_link->file= file; + hash_link->diskpos= filepos; + link_hash(start, hash_link); + } + /* Register the request for the page */ + hash_link->requests++; + + return hash_link; +} + + +/* + Get a block for the file page requested by a keycache read/write operation; + If the page is not in the cache return a free block, if there is none + return the lru block after saving its buffer if the page is dirty. + + SYNOPSIS + + find_key_block() + keycache pointer to a key cache data structure + file handler for the file to read page from + filepos position of the page in the file + init_hits_left how initialize the block counter for the page + wrmode <-> get for writing + page_st out {PAGE_READ,PAGE_TO_BE_READ,PAGE_WAIT_TO_BE_READ} + + RETURN VALUE + Pointer to the found block if successful, 0 - otherwise + + NOTES. + For the page from file positioned at filepos the function checks whether + the page is in the key cache specified by the first parameter. + If this is the case it immediately returns the block. + If not, the function first chooses a block for this page. If there is + no not used blocks in the key cache yet, the function takes the block + at the very beginning of the warm sub-chain. It saves the page in that + block if it's dirty before returning the pointer to it. + The function returns in the page_st parameter the following values: + PAGE_READ - if page already in the block, + PAGE_TO_BE_READ - if it is to be read yet by the current thread + WAIT_TO_BE_READ - if it is to be read by another thread + If an error occurs THE BLOCK_ERROR bit is set in the block status. + It might happen that there are no blocks in LRU chain (in warm part) - + all blocks are unlinked for some read/write operations. Then the function + waits until first of this operations links any block back. +*/ + +static BLOCK_LINK *find_key_block(KEY_CACHE *keycache, + File file, my_off_t filepos, + int init_hits_left, + int wrmode, int *page_st) +{ + HASH_LINK *hash_link; + BLOCK_LINK *block; + int error= 0; + int page_status; + + DBUG_ENTER("find_key_block"); + KEYCACHE_THREAD_TRACE("find_key_block:begin"); + DBUG_PRINT("enter", ("fd: %d pos: %lu wrmode: %d", + file, (ulong) filepos, wrmode)); + KEYCACHE_DBUG_PRINT("find_key_block", ("fd: %d pos: %lu wrmode: %d", + file, (ulong) filepos, + wrmode)); +#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) + DBUG_EXECUTE("check_keycache2", + test_key_cache(keycache, "start of find_key_block", 0);); +#endif + +restart: + /* + If the flush phase of a resize operation fails, the cache is left + unusable. This will be detected only after "goto restart". + */ + if (!keycache->can_be_used) + DBUG_RETURN(0); + + /* + Find the hash_link for the requested file block (file, filepos). We + do always get a hash_link here. It has registered our request so + that no other thread can use it for another file block until we + release the request (which is done by remove_reader() usually). The + hash_link can have a block assigned to it or not. If there is a + block, it may be assigned to this hash_link or not. In cases where a + block is evicted from the cache, it is taken from the LRU ring and + referenced by the new hash_link. But the block can still be assigned + to its old hash_link for some time if it needs to be flushed first, + or if there are other threads still reading it. + + Summary: + hash_link is always returned. + hash_link->block can be: + - NULL or + - not assigned to this hash_link or + - assigned to this hash_link. If assigned, the block can have + - invalid data (when freshly assigned) or + - valid data. Valid data can be + - changed over the file contents (dirty) or + - not changed (clean). + */ + hash_link= get_hash_link(keycache, file, filepos); + DBUG_ASSERT((hash_link->file == file) && (hash_link->diskpos == filepos)); + + page_status= -1; + if ((block= hash_link->block) && + block->hash_link == hash_link && (block->status & BLOCK_READ)) + { + /* Assigned block with valid (changed or unchanged) contents. */ + page_status= PAGE_READ; + } + /* + else (page_status == -1) + - block == NULL or + - block not assigned to this hash_link or + - block assigned but not yet read from file (invalid data). + */ + + if (keycache->in_resize) + { + /* This is a request during a resize operation */ + + if (!block) + { + struct st_my_thread_var *thread; + + /* + The file block is not in the cache. We don't need it in the + cache: we are going to read or write directly to file. Cancel + the request. We can simply decrement hash_link->requests because + we did not release cache_lock since increasing it. So no other + thread can wait for our request to become released. + */ + if (hash_link->requests == 1) + { + /* + We are the only one to request this hash_link (this file/pos). + Free the hash_link. + */ + hash_link->requests--; + unlink_hash(keycache, hash_link); + DBUG_RETURN(0); + } + + /* + More requests on the hash_link. Someone tries to evict a block + for this hash_link (could have started before resizing started). + This means that the LRU ring is empty. Otherwise a block could + be assigned immediately. Behave like a thread that wants to + evict a block for this file/pos. Add to the queue of threads + waiting for a block. Wait until there is one assigned. + + Refresh the request on the hash-link so that it cannot be reused + for another file/pos. + */ + thread= my_thread_var; + thread->opt_info= (void *) hash_link; + link_into_queue(&keycache->waiting_for_block, thread); + do + { + KEYCACHE_DBUG_PRINT("find_key_block: wait", + ("suspend thread %ld", thread->id)); + keycache_pthread_cond_wait(&thread->suspend, + &keycache->cache_lock); + } while (thread->next); + thread->opt_info= NULL; + /* + A block should now be assigned to the hash_link. But it may + still need to be evicted. Anyway, we should re-check the + situation. page_status must be set correctly. + */ + hash_link->requests--; + goto restart; + } /* end of if (!block) */ + + /* + There is a block for this file/pos in the cache. Register a + request on it. This unlinks it from the LRU ring (if it is there) + and hence protects it against eviction (if not already in + eviction). We need this for returning the block to the caller, for + calling remove_reader() (for debugging purposes), and for calling + free_block(). The only case where we don't need the request is if + the block is in eviction. In that case we have to unregister the + request later. + */ + reg_requests(keycache, block, 1); + + if (page_status != PAGE_READ) + { + /* + - block not assigned to this hash_link or + - block assigned but not yet read from file (invalid data). + + This must be a block in eviction. It will be read soon. We need + to wait here until this happened. Otherwise the caller could + access a wrong block or a block which is in read. While waiting + we cannot lose hash_link nor block. We have registered a request + on the hash_link. Everything can happen to the block but changes + in the hash_link -> block relationship. In other words: + everything can happen to the block but free or another completed + eviction. + + Note that we bahave like a secondary requestor here. We just + cannot return with PAGE_WAIT_TO_BE_READ. This would work for + read requests and writes on dirty blocks that are not in flush + only. Waiting here on COND_FOR_REQUESTED works in all + situations. + */ + DBUG_ASSERT(((block->hash_link != hash_link) && + (block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH))) || + ((block->hash_link == hash_link) && + !(block->status & BLOCK_READ))); + wait_on_queue(&block->wqueue[COND_FOR_REQUESTED], &keycache->cache_lock); + /* + Here we can trust that the block has been assigned to this + hash_link (block->hash_link == hash_link) and read into the + buffer (BLOCK_READ). The worst things possible here are that the + block is in free (BLOCK_REASSIGNED). But the block is still + assigned to the hash_link. The freeing thread waits until we + release our request on the hash_link. The block must not be + again in eviction because we registered an request on it before + starting to wait. + */ + DBUG_ASSERT(block->hash_link == hash_link); + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH))); + } + /* + The block is in the cache. Assigned to the hash_link. Valid data. + Note that in case of page_st == PAGE_READ, the block can be marked + for eviction. In any case it can be marked for freeing. + */ + + if (!wrmode) + { + /* A reader can just read the block. */ + *page_st= PAGE_READ; + DBUG_ASSERT((hash_link->file == file) && + (hash_link->diskpos == filepos) && + (block->hash_link == hash_link)); + DBUG_RETURN(block); + } + + /* + This is a writer. No two writers for the same block can exist. + This must be assured by locks outside of the key cache. + */ + DBUG_ASSERT(!(block->status & BLOCK_FOR_UPDATE) || fail_block(block)); + + while (block->status & BLOCK_IN_FLUSH) + { + /* + Wait until the block is flushed to file. Do not release the + request on the hash_link yet to prevent that the block is freed + or reassigned while we wait. While we wait, several things can + happen to the block, including another flush. But the block + cannot be reassigned to another hash_link until we release our + request on it. But it can be marked BLOCK_REASSIGNED from free + or eviction, while they wait for us to release the hash_link. + */ + wait_on_queue(&block->wqueue[COND_FOR_SAVED], &keycache->cache_lock); + /* + If the flush phase failed, the resize could have finished while + we waited here. + */ + if (!keycache->in_resize) + { + remove_reader(block); + unreg_request(keycache, block, 1); + goto restart; + } + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(!(block->status & BLOCK_FOR_UPDATE) || fail_block(block)); + DBUG_ASSERT(block->hash_link == hash_link); + } + + if (block->status & BLOCK_CHANGED) + { + /* + We want to write a block with changed contents. If the cache + block size is bigger than the callers block size (e.g. MyISAM), + the caller may replace part of the block only. Changes of the + other part of the block must be preserved. Since the block has + not yet been selected for flush, we can still add our changes. + */ + *page_st= PAGE_READ; + DBUG_ASSERT((hash_link->file == file) && + (hash_link->diskpos == filepos) && + (block->hash_link == hash_link)); + DBUG_RETURN(block); + } + + /* + This is a write request for a clean block. We do not want to have + new dirty blocks in the cache while resizing. We will free the + block and write directly to file. If the block is in eviction or + in free, we just let it go. + + Unregister from the hash_link. This must be done before freeing + the block. And it must be done if not freeing the block. Because + we could have waited above, we need to call remove_reader(). Other + threads could wait for us to release our request on the hash_link. + */ + remove_reader(block); + + /* If the block is not in eviction and not in free, we can free it. */ + if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | + BLOCK_REASSIGNED))) + { + /* + Free block as we are going to write directly to file. + Although we have an exlusive lock for the updated key part, + the control can be yielded by the current thread as we might + have unfinished readers of other key parts in the block + buffer. Still we are guaranteed not to have any readers + of the key part we are writing into until the block is + removed from the cache as we set the BLOCK_REASSIGNED + flag (see the code below that handles reading requests). + */ + free_block(keycache, block); + } + else + { + /* + The block will be evicted/freed soon. Don't touch it in any way. + Unregister the request that we registered above. + */ + unreg_request(keycache, block, 1); + + /* + The block is still assigned to the hash_link (the file/pos that + we are going to write to). Wait until the eviction/free is + complete. Otherwise the direct write could complete before all + readers are done with the block. So they could read outdated + data. + + Since we released our request on the hash_link, it can be reused + for another file/pos. Hence we cannot just check for + block->hash_link == hash_link. As long as the resize is + proceeding the block cannot be reassigned to the same file/pos + again. So we can terminate the loop when the block is no longer + assigned to this file/pos. + */ + do + { + wait_on_queue(&block->wqueue[COND_FOR_SAVED], + &keycache->cache_lock); + /* + If the flush phase failed, the resize could have finished + while we waited here. + */ + if (!keycache->in_resize) + goto restart; + } while (block->hash_link && + (block->hash_link->file == file) && + (block->hash_link->diskpos == filepos)); + } + DBUG_RETURN(0); + } + + if (page_status == PAGE_READ && + (block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | + BLOCK_REASSIGNED))) + { + /* + This is a request for a block to be removed from cache. The block + is assigned to this hash_link and contains valid data, but is + marked for eviction or to be freed. Possible reasons why it has + not yet been evicted/freed can be a flush before reassignment + (BLOCK_IN_SWITCH), readers of the block have not finished yet + (BLOCK_REASSIGNED), or the evicting thread did not yet awake after + the block has been selected for it (BLOCK_IN_EVICTION). + */ + + KEYCACHE_DBUG_PRINT("find_key_block", + ("request for old page in block %u " + "wrmode: %d block->status: %d", + BLOCK_NUMBER(block), wrmode, block->status)); + /* + Only reading requests can proceed until the old dirty page is flushed, + all others are to be suspended, then resubmitted + */ + if (!wrmode && !(block->status & BLOCK_REASSIGNED)) + { + /* + This is a read request and the block not yet reassigned. We can + register our request and proceed. This unlinks the block from + the LRU ring and protects it against eviction. + */ + reg_requests(keycache, block, 1); + } + else + { + /* + Either this is a write request for a block that is in eviction + or in free. We must not use it any more. Instead we must evict + another block. But we cannot do this before the eviction/free is + done. Otherwise we would find the same hash_link + block again + and again. + + Or this is a read request for a block in eviction/free that does + not require a flush, but waits for readers to finish with the + block. We do not read this block to let the eviction/free happen + as soon as possible. Again we must wait so that we don't find + the same hash_link + block again and again. + */ + DBUG_ASSERT(hash_link->requests); + hash_link->requests--; + KEYCACHE_DBUG_PRINT("find_key_block", + ("request waiting for old page to be saved")); + wait_on_queue(&block->wqueue[COND_FOR_SAVED], &keycache->cache_lock); + KEYCACHE_DBUG_PRINT("find_key_block", + ("request for old page resubmitted")); + /* + The block is no longer assigned to this hash_link. + Get another one. + */ + goto restart; + } + } + else + { + /* + This is a request for a new block or for a block not to be removed. + Either + - block == NULL or + - block not assigned to this hash_link or + - block assigned but not yet read from file, + or + - block assigned with valid (changed or unchanged) data and + - it will not be reassigned/freed. + */ + if (! block) + { + /* No block is assigned to the hash_link yet. */ + if (keycache->blocks_unused) + { + if (keycache->free_block_list) + { + /* There is a block in the free list. */ + block= keycache->free_block_list; + keycache->free_block_list= block->next_used; + block->next_used= NULL; + } + else + { + size_t block_mem_offset; + /* There are some never used blocks, take first of them */ + DBUG_ASSERT(keycache->blocks_used < + (ulong) keycache->disk_blocks); + block= &keycache->block_root[keycache->blocks_used]; + block_mem_offset= + ((size_t) keycache->blocks_used) * keycache->key_cache_block_size; + block->buffer= ADD_TO_PTR(keycache->block_mem, + block_mem_offset, + uchar*); + keycache->blocks_used++; + DBUG_ASSERT(!block->next_used); + } + DBUG_ASSERT(!block->prev_used); + DBUG_ASSERT(!block->next_changed); + DBUG_ASSERT(!block->prev_changed); + DBUG_ASSERT(!block->hash_link); + DBUG_ASSERT(!block->status); + DBUG_ASSERT(!block->requests); + keycache->blocks_unused--; + block->status= BLOCK_IN_USE; + block->length= 0; + block->offset= keycache->key_cache_block_size; + block->requests= 1; + block->temperature= BLOCK_COLD; + block->hits_left= init_hits_left; + block->last_hit_time= 0; + block->hash_link= hash_link; + hash_link->block= block; + link_to_file_list(keycache, block, file, 0); + page_status= PAGE_TO_BE_READ; + KEYCACHE_DBUG_PRINT("find_key_block", + ("got free or never used block %u", + BLOCK_NUMBER(block))); + } + else + { + /* + There are no free blocks and no never used blocks, use a block + from the LRU ring. + */ + +#ifdef THREAD + if (! keycache->used_last) + { + /* + The LRU ring is empty. Wait until a new block is added to + it. Several threads might wait here for the same hash_link, + all of them must get the same block. While waiting for a + block, after a block is selected for this hash_link, other + threads can run first before this one awakes. During this + time interval other threads find this hash_link pointing to + the block, which is still assigned to another hash_link. In + this case the block is not marked BLOCK_IN_SWITCH yet, but + it is marked BLOCK_IN_EVICTION. + */ + + struct st_my_thread_var *thread= my_thread_var; + thread->opt_info= (void *) hash_link; + link_into_queue(&keycache->waiting_for_block, thread); + do + { + KEYCACHE_DBUG_PRINT("find_key_block: wait", + ("suspend thread %ld", thread->id)); + keycache_pthread_cond_wait(&thread->suspend, + &keycache->cache_lock); + } + while (thread->next); + thread->opt_info= NULL; + /* Assert that block has a request registered. */ + DBUG_ASSERT(hash_link->block->requests); + /* Assert that block is not in LRU ring. */ + DBUG_ASSERT(!hash_link->block->next_used); + DBUG_ASSERT(!hash_link->block->prev_used); + } +#else + KEYCACHE_DBUG_ASSERT(keycache->used_last); +#endif + /* + If we waited above, hash_link->block has been assigned by + link_block(). Otherwise it is still NULL. In the latter case + we need to grab a block from the LRU ring ourselves. + */ + block= hash_link->block; + if (! block) + { + /* Select the last block from the LRU ring. */ + block= keycache->used_last->next_used; + block->hits_left= init_hits_left; + block->last_hit_time= 0; + hash_link->block= block; + /* + Register a request on the block. This unlinks it from the + LRU ring and protects it against eviction. + */ + DBUG_ASSERT(!block->requests); + reg_requests(keycache, block,1); + /* + We do not need to set block->status|= BLOCK_IN_EVICTION here + because we will set block->status|= BLOCK_IN_SWITCH + immediately without releasing the lock in between. This does + also support debugging. When looking at the block, one can + see if the block has been selected by link_block() after the + LRU ring was empty, or if it was grabbed directly from the + LRU ring in this branch. + */ + } + + /* + If we had to wait above, there is a small chance that another + thread grabbed this block for the same file block already. But + in most cases the first condition is true. + */ + if (block->hash_link != hash_link && + ! (block->status & BLOCK_IN_SWITCH) ) + { + /* this is a primary request for a new page */ + block->status|= BLOCK_IN_SWITCH; + + KEYCACHE_DBUG_PRINT("find_key_block", + ("got block %u for new page", BLOCK_NUMBER(block))); + + if (block->status & BLOCK_CHANGED) + { + /* The block contains a dirty page - push it out of the cache */ + + KEYCACHE_DBUG_PRINT("find_key_block", ("block is dirty")); + if (block->status & BLOCK_IN_FLUSH) + { + /* + The block is marked for flush. If we do not wait here, + it could happen that we write the block, reassign it to + another file block, then, before the new owner can read + the new file block, the flusher writes the cache block + (which still has the old contents) to the new file block! + */ + wait_on_queue(&block->wqueue[COND_FOR_SAVED], + &keycache->cache_lock); + /* + The block is marked BLOCK_IN_SWITCH. It should be left + alone except for reading. No free, no write. + */ + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + DBUG_ASSERT(!(block->status & (BLOCK_REASSIGNED | + BLOCK_CHANGED | + BLOCK_FOR_UPDATE))); + } + else + { + block->status|= BLOCK_IN_FLUSH | BLOCK_IN_FLUSHWRITE; + /* + BLOCK_IN_EVICTION may be true or not. Other flags must + have a fixed value. + */ + DBUG_ASSERT((block->status & ~BLOCK_IN_EVICTION) == + (BLOCK_READ | BLOCK_IN_SWITCH | + BLOCK_IN_FLUSH | BLOCK_IN_FLUSHWRITE | + BLOCK_CHANGED | BLOCK_IN_USE)); + DBUG_ASSERT(block->hash_link); + + keycache_pthread_mutex_unlock(&keycache->cache_lock); + /* + The call is thread safe because only the current + thread might change the block->hash_link value + */ + error= key_cache_pwrite(block->hash_link->file, + block->buffer + block->offset, + block->length - block->offset, + block->hash_link->diskpos + + block->offset, + MYF(MY_NABP | MY_WAIT_IF_FULL), + keycache->post_write, + block->post_write_arg); + keycache_pthread_mutex_lock(&keycache->cache_lock); + + /* Block status must not have changed. */ + DBUG_ASSERT((block->status & ~BLOCK_IN_EVICTION) == + (BLOCK_READ | BLOCK_IN_SWITCH | + BLOCK_IN_FLUSH | BLOCK_IN_FLUSHWRITE | + BLOCK_CHANGED | BLOCK_IN_USE) || fail_block(block)); + keycache->global_cache_write++; + } + } + + block->status|= BLOCK_REASSIGNED; + /* + The block comes from the LRU ring. It must have a hash_link + assigned. + */ + DBUG_ASSERT(block->hash_link); + if (block->hash_link) + { + /* + All pending requests for this page must be resubmitted. + This must be done before waiting for readers. They could + wait for the flush to complete. And we must also do it + after the wait. Flushers might try to free the block while + we wait. They would wait until the reassignment is + complete. Also the block status must reflect the correct + situation: The block is not changed nor in flush any more. + Note that we must not change the BLOCK_CHANGED flag + outside of link_to_file_list() so that it is always in the + correct queue and the *blocks_changed counters are + correct. + */ + block->status&= ~(BLOCK_IN_FLUSH | BLOCK_IN_FLUSHWRITE); + link_to_file_list(keycache, block, block->hash_link->file, 1); + release_whole_queue(&block->wqueue[COND_FOR_SAVED]); + /* + The block is still assigned to its old hash_link. + Wait until all pending read requests + for this page are executed + (we could have avoided this waiting, if we had read + a page in the cache in a sweep, without yielding control) + */ + wait_for_readers(keycache, block); + DBUG_ASSERT(block->hash_link && block->hash_link->block == block && + block->prev_changed); + /* The reader must not have been a writer. */ + DBUG_ASSERT(!(block->status & BLOCK_CHANGED)); + + /* Wake flushers that might have found the block in between. */ + release_whole_queue(&block->wqueue[COND_FOR_SAVED]); + + /* Remove the hash link for the old file block from the hash. */ + unlink_hash(keycache, block->hash_link); + + /* + For sanity checks link_to_file_list() asserts that block + and hash_link refer to each other. Hence we need to assign + the hash_link first, but then we would not know if it was + linked before. Hence we would not know if to unlink it. So + unlink it here and call link_to_file_list(..., FALSE). + */ + unlink_changed(block); + } + block->status= error ? BLOCK_ERROR : BLOCK_IN_USE ; + block->length= 0; + block->offset= keycache->key_cache_block_size; + block->hash_link= hash_link; + link_to_file_list(keycache, block, file, 0); + page_status= PAGE_TO_BE_READ; + + KEYCACHE_DBUG_ASSERT(block->hash_link->block == block); + KEYCACHE_DBUG_ASSERT(hash_link->block->hash_link == hash_link); + } + else + { + /* + Either (block->hash_link == hash_link), + or (block->status & BLOCK_IN_SWITCH). + + This is for secondary requests for a new file block only. + Either it is already assigned to the new hash_link meanwhile + (if we had to wait due to empty LRU), or it is already in + eviction by another thread. Since this block has been + grabbed from the LRU ring and attached to this hash_link, + another thread cannot grab the same block from the LRU ring + anymore. If the block is in eviction already, it must become + attached to the same hash_link and as such destined for the + same file block. + */ + KEYCACHE_DBUG_PRINT("find_key_block", + ("block->hash_link: %p hash_link: %p " + "block->status: %u", block->hash_link, + hash_link, block->status )); + page_status= (((block->hash_link == hash_link) && + (block->status & BLOCK_READ)) ? + PAGE_READ : PAGE_WAIT_TO_BE_READ); + } + } + } + else + { + /* + Block is not NULL. This hash_link points to a block. + Either + - block not assigned to this hash_link (yet) or + - block assigned but not yet read from file, + or + - block assigned with valid (changed or unchanged) data and + - it will not be reassigned/freed. + + The first condition means hash_link points to a block in + eviction. This is not necessarily marked by BLOCK_IN_SWITCH yet. + But then it is marked BLOCK_IN_EVICTION. See the NOTE in + link_block(). In both cases it is destined for this hash_link + and its file block address. When this hash_link got its block + address, the block was removed from the LRU ring and cannot be + selected for eviction (for another hash_link) again. + + Register a request on the block. This is another protection + against eviction. + */ + DBUG_ASSERT(((block->hash_link != hash_link) && + (block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH))) || + ((block->hash_link == hash_link) && + !(block->status & BLOCK_READ)) || + ((block->status & BLOCK_READ) && + !(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH)))); + reg_requests(keycache, block, 1); + KEYCACHE_DBUG_PRINT("find_key_block", + ("block->hash_link: %p hash_link: %p " + "block->status: %u", block->hash_link, + hash_link, block->status )); + page_status= (((block->hash_link == hash_link) && + (block->status & BLOCK_READ)) ? + PAGE_READ : PAGE_WAIT_TO_BE_READ); + } + } + + KEYCACHE_DBUG_ASSERT(page_status != -1); + /* Same assert basically, but be very sure. */ + KEYCACHE_DBUG_ASSERT(block); + /* Assert that block has a request and is not in LRU ring. */ + DBUG_ASSERT(block->requests); + DBUG_ASSERT(!block->next_used); + DBUG_ASSERT(!block->prev_used); + /* Assert that we return the correct block. */ + DBUG_ASSERT((page_status == PAGE_WAIT_TO_BE_READ) || + ((block->hash_link->file == file) && + (block->hash_link->diskpos == filepos))); + *page_st=page_status; + KEYCACHE_DBUG_PRINT("find_key_block", + ("fd: %d pos: %lu block->status: %u page_status: %d", + file, (ulong) filepos, block->status, + page_status)); + +#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) + DBUG_EXECUTE("check_keycache2", + test_key_cache(keycache, "end of find_key_block",0);); +#endif + KEYCACHE_THREAD_TRACE("find_key_block:end"); + DBUG_RETURN(block); +} + + +/* + Read into a key cache block buffer from disk. + + SYNOPSIS + + read_block() + keycache pointer to a key cache data structure + block block to which buffer the data is to be read + read_length size of data to be read + min_length at least so much data must be read + primary <-> the current thread will read the data + + RETURN VALUE + None + + NOTES. + The function either reads a page data from file to the block buffer, + or waits until another thread reads it. What page to read is determined + by a block parameter - reference to a hash link for this page. + If an error occurs THE BLOCK_ERROR bit is set in the block status. + We do not report error when the size of successfully read + portion is less than read_length, but not less than min_length. +*/ + +static void read_block(KEY_CACHE *keycache, + BLOCK_LINK *block, uint read_length, + uint min_length, my_bool primary) +{ + uint got_length; + + /* On entry cache_lock is locked */ + + KEYCACHE_THREAD_TRACE("read_block"); + if (primary) + { + /* + This code is executed only by threads that submitted primary + requests. Until block->status contains BLOCK_READ, all other + request for the block become secondary requests. For a primary + request the block must be properly initialized. + */ + DBUG_ASSERT(((block->status & ~BLOCK_FOR_UPDATE) == BLOCK_IN_USE) || + fail_block(block)); + DBUG_ASSERT((block->length == 0) || fail_block(block)); + DBUG_ASSERT((block->offset == keycache->key_cache_block_size) || + fail_block(block)); + DBUG_ASSERT((block->requests > 0) || fail_block(block)); + + KEYCACHE_DBUG_PRINT("read_block", + ("page to be read by primary request")); + + keycache->global_cache_read++; + /* Page is not in buffer yet, is to be read from disk */ + keycache_pthread_mutex_unlock(&keycache->cache_lock); + /* + Here other threads may step in and register as secondary readers. + They will register in block->wqueue[COND_FOR_REQUESTED]. + */ + got_length= my_pread(block->hash_link->file, block->buffer, + read_length, block->hash_link->diskpos, MYF(0)); + keycache_pthread_mutex_lock(&keycache->cache_lock); + /* + The block can now have been marked for free (in case of + FLUSH_RELEASE). Otherwise the state must be unchanged. + */ + DBUG_ASSERT(((block->status & ~(BLOCK_REASSIGNED | + BLOCK_FOR_UPDATE)) == BLOCK_IN_USE) || + fail_block(block)); + DBUG_ASSERT((block->length == 0) || fail_block(block)); + DBUG_ASSERT((block->offset == keycache->key_cache_block_size) || + fail_block(block)); + DBUG_ASSERT((block->requests > 0) || fail_block(block)); + + if (got_length < min_length) + block->status|= BLOCK_ERROR; + else + { + block->status|= BLOCK_READ; + block->length= got_length; + /* + Do not set block->offset here. If this block is marked + BLOCK_CHANGED later, we want to flush only the modified part. So + only a writer may set block->offset down from + keycache->key_cache_block_size. + */ + } + KEYCACHE_DBUG_PRINT("read_block", + ("primary request: new page in cache")); + /* Signal that all pending requests for this page now can be processed */ + release_whole_queue(&block->wqueue[COND_FOR_REQUESTED]); + } + else + { + /* + This code is executed only by threads that submitted secondary + requests. At this point it could happen that the cache block is + not yet assigned to the hash_link for the requested file block. + But at awake from the wait this should be the case. Unfortunately + we cannot assert this here because we do not know the hash_link + for the requested file block nor the file and position. So we have + to assert this in the caller. + */ + KEYCACHE_DBUG_PRINT("read_block", + ("secondary request waiting for new page to be read")); + wait_on_queue(&block->wqueue[COND_FOR_REQUESTED], &keycache->cache_lock); + KEYCACHE_DBUG_PRINT("read_block", + ("secondary request: new page in cache")); + } +} + + +/* + Read a block of data from a cached file into a buffer; + + SYNOPSIS + + key_cache_read() + keycache pointer to a key cache data structure + file handler for the file for the block of data to be read + filepos position of the block of data in the file + level determines the weight of the data + buff buffer to where the data must be placed + length length of the buffer + block_length length of the block in the key cache buffer + return_buffer return pointer to the key cache buffer with the data + + RETURN VALUE + Returns address from where the data is placed if sucessful, 0 - otherwise. + + NOTES. + The function ensures that a block of data of size length from file + positioned at filepos is in the buffers for some key cache blocks. + Then the function either copies the data into the buffer buff, or, + if return_buffer is TRUE, it just returns the pointer to the key cache + buffer with the data. + Filepos must be a multiple of 'block_length', but it doesn't + have to be a multiple of key_cache_block_size; +*/ + +uchar *key_cache_read(KEY_CACHE *keycache, + File file, my_off_t filepos, int level, + uchar *buff, uint length, + uint block_length __attribute__((unused)), + int return_buffer __attribute__((unused))) +{ + my_bool locked_and_incremented= FALSE; + int error=0; + uchar *start= buff; + DBUG_ENTER("key_cache_read"); + DBUG_PRINT("enter", ("fd: %u pos: %lu length: %u", + (uint) file, (ulong) filepos, length)); + + if (keycache->key_cache_inited) + { + /* Key cache is used */ + reg1 BLOCK_LINK *block; + uint read_length; + uint offset; + int page_st; + + /* + When the key cache is once initialized, we use the cache_lock to + reliably distinguish the cases of normal operation, resizing, and + disabled cache. We always increment and decrement + 'cnt_for_resize_op' so that a resizer can wait for pending I/O. + */ + keycache_pthread_mutex_lock(&keycache->cache_lock); + /* + Cache resizing has two phases: Flushing and re-initializing. In + the flush phase read requests are allowed to bypass the cache for + blocks not in the cache. find_key_block() returns NULL in this + case. + + After the flush phase new I/O requests must wait until the + re-initialization is done. The re-initialization can be done only + if no I/O request is in progress. The reason is that + key_cache_block_size can change. With enabled cache, I/O is done + in chunks of key_cache_block_size. Every chunk tries to use a + cache block first. If the block size changes in the middle, a + block could be missed and old data could be read. + */ + while (keycache->in_resize && !keycache->resize_in_flush) + wait_on_queue(&keycache->resize_queue, &keycache->cache_lock); + /* Register the I/O for the next resize. */ + inc_counter_for_resize_op(keycache); + locked_and_incremented= TRUE; + /* Requested data may not always be aligned to cache blocks. */ + offset= (uint) (filepos % keycache->key_cache_block_size); + /* Read data in key_cache_block_size increments */ + do + { + /* Cache could be disabled in a later iteration. */ + + if (!keycache->can_be_used) + { + KEYCACHE_DBUG_PRINT("key_cache_read", ("keycache cannot be used")); + goto no_key_cache; + } + /* Start reading at the beginning of the cache block. */ + filepos-= offset; + /* Do not read beyond the end of the cache block. */ + read_length= length; + set_if_smaller(read_length, keycache->key_cache_block_size-offset); + KEYCACHE_DBUG_ASSERT(read_length > 0); + +#ifndef THREAD + if (block_length > keycache->key_cache_block_size || offset) + return_buffer=0; +#endif + + /* Request the cache block that matches file/pos. */ + keycache->global_cache_r_requests++; + block=find_key_block(keycache, file, filepos, level, 0, &page_st); + if (!block) + { + /* + This happens only for requests submitted during key cache + resize. The block is not in the cache and shall not go in. + Read directly from file. + */ + keycache->global_cache_read++; + keycache_pthread_mutex_unlock(&keycache->cache_lock); + error= (my_pread(file, (uchar*) buff, read_length, + filepos + offset, MYF(MY_NABP)) != 0); + keycache_pthread_mutex_lock(&keycache->cache_lock); + goto next_block; + } + if (!(block->status & BLOCK_ERROR)) + { + if (page_st != PAGE_READ) + { + /* The requested page is to be read into the block buffer */ + read_block(keycache, block, + keycache->key_cache_block_size, read_length+offset, + (my_bool)(page_st == PAGE_TO_BE_READ)); + /* + A secondary request must now have the block assigned to the + requested file block. It does not hurt to check it for + primary requests too. + */ + DBUG_ASSERT(keycache->can_be_used); + DBUG_ASSERT(block->hash_link->file == file); + DBUG_ASSERT(block->hash_link->diskpos == filepos); + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + } + else if (block->length < read_length + offset) + { + /* + Impossible if nothing goes wrong: + this could only happen if we are using a file with + small key blocks and are trying to read outside the file + */ + my_errno= -1; + block->status|= BLOCK_ERROR; + } + } + + /* block status may have added BLOCK_ERROR in the above 'if'. */ + if (!(block->status & BLOCK_ERROR)) + { +#ifndef THREAD + if (! return_buffer) +#endif + { + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); +#if !defined(SERIALIZED_READ_FROM_CACHE) + keycache_pthread_mutex_unlock(&keycache->cache_lock); +#endif + + /* Copy data from the cache buffer */ + if (!(read_length & 511)) + bmove512(buff, block->buffer+offset, read_length); + else + memcpy(buff, block->buffer+offset, (size_t) read_length); + +#if !defined(SERIALIZED_READ_FROM_CACHE) + keycache_pthread_mutex_lock(&keycache->cache_lock); + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); +#endif + } + } + + remove_reader(block); + + /* Error injection for coverage testing. */ + DBUG_EXECUTE_IF("key_cache_read_block_error", + block->status|= BLOCK_ERROR;); + + /* Do not link erroneous blocks into the LRU ring, but free them. */ + if (!(block->status & BLOCK_ERROR)) + { + /* + Link the block into the LRU ring if it's the last submitted + request for the block. This enables eviction for the block. + */ + unreg_request(keycache, block, 1); + } + else + { + free_block(keycache, block); + error= 1; + break; + } + +#ifndef THREAD + /* This is only true if we where able to read everything in one block */ + if (return_buffer) + DBUG_RETURN(block->buffer); +#endif + next_block: + buff+= read_length; + filepos+= read_length+offset; + offset= 0; + + } while ((length-= read_length)); + goto end; + } + KEYCACHE_DBUG_PRINT("key_cache_read", ("keycache not initialized")); + +no_key_cache: + /* Key cache is not used */ + + keycache->global_cache_r_requests++; + keycache->global_cache_read++; + + if (locked_and_incremented) + keycache_pthread_mutex_unlock(&keycache->cache_lock); + if (my_pread(file, (uchar*) buff, length, filepos, MYF(MY_NABP))) + error= 1; + if (locked_and_incremented) + keycache_pthread_mutex_lock(&keycache->cache_lock); + +end: + if (locked_and_incremented) + { + dec_counter_for_resize_op(keycache); + keycache_pthread_mutex_unlock(&keycache->cache_lock); + } + DBUG_PRINT("exit", ("error: %d", error )); + DBUG_RETURN(error ? (uchar*) 0 : start); +} + + +/* + Insert a block of file data from a buffer into key cache + + SYNOPSIS + key_cache_insert() + keycache pointer to a key cache data structure + file handler for the file to insert data from + filepos position of the block of data in the file to insert + level determines the weight of the data + buff buffer to read data from + length length of the data in the buffer + + NOTES + This is used by MyISAM to move all blocks from a index file to the key + cache + + RETURN VALUE + 0 if a success, 1 - otherwise. +*/ + +int key_cache_insert(KEY_CACHE *keycache, + File file, my_off_t filepos, int level, + uchar *buff, uint length) +{ + int error= 0; + DBUG_ENTER("key_cache_insert"); + DBUG_PRINT("enter", ("fd: %u pos: %lu length: %u", + (uint) file,(ulong) filepos, length)); + + if (keycache->key_cache_inited) + { + /* Key cache is used */ + reg1 BLOCK_LINK *block; + uint read_length; + uint offset; + int page_st; + my_bool locked_and_incremented= FALSE; + + /* + When the keycache is once initialized, we use the cache_lock to + reliably distinguish the cases of normal operation, resizing, and + disabled cache. We always increment and decrement + 'cnt_for_resize_op' so that a resizer can wait for pending I/O. + */ + keycache_pthread_mutex_lock(&keycache->cache_lock); + /* + We do not load index data into a disabled cache nor into an + ongoing resize. + */ + if (!keycache->can_be_used || keycache->in_resize) + goto no_key_cache; + /* Register the pseudo I/O for the next resize. */ + inc_counter_for_resize_op(keycache); + locked_and_incremented= TRUE; + /* Loaded data may not always be aligned to cache blocks. */ + offset= (uint) (filepos % keycache->key_cache_block_size); + /* Load data in key_cache_block_size increments. */ + do + { + /* Cache could be disabled or resizing in a later iteration. */ + if (!keycache->can_be_used || keycache->in_resize) + goto no_key_cache; + /* Start loading at the beginning of the cache block. */ + filepos-= offset; + /* Do not load beyond the end of the cache block. */ + read_length= length; + set_if_smaller(read_length, keycache->key_cache_block_size-offset); + KEYCACHE_DBUG_ASSERT(read_length > 0); + + /* The block has been read by the caller already. */ + keycache->global_cache_read++; + /* Request the cache block that matches file/pos. */ + keycache->global_cache_r_requests++; + block= find_key_block(keycache, file, filepos, level, 0, &page_st); + if (!block) + { + /* + This happens only for requests submitted during key cache + resize. The block is not in the cache and shall not go in. + Stop loading index data. + */ + goto no_key_cache; + } + if (!(block->status & BLOCK_ERROR)) + { + if ((page_st == PAGE_WAIT_TO_BE_READ) || + ((page_st == PAGE_TO_BE_READ) && + (offset || (read_length < keycache->key_cache_block_size)))) + { + /* + Either + + this is a secondary request for a block to be read into the + cache. The block is in eviction. It is not yet assigned to + the requested file block (It does not point to the right + hash_link). So we cannot call remove_reader() on the block. + And we cannot access the hash_link directly here. We need to + wait until the assignment is complete. read_block() executes + the correct wait when called with primary == FALSE. + + Or + + this is a primary request for a block to be read into the + cache and the supplied data does not fill the whole block. + + This function is called on behalf of a LOAD INDEX INTO CACHE + statement, which is a read-only task and allows other + readers. It is possible that a parallel running reader tries + to access this block. If it needs more data than has been + supplied here, it would report an error. To be sure that we + have all data in the block that is available in the file, we + read the block ourselves. + + Though reading again what the caller did read already is an + expensive operation, we need to do this for correctness. + */ + read_block(keycache, block, keycache->key_cache_block_size, + read_length + offset, (page_st == PAGE_TO_BE_READ)); + /* + A secondary request must now have the block assigned to the + requested file block. It does not hurt to check it for + primary requests too. + */ + DBUG_ASSERT(keycache->can_be_used); + DBUG_ASSERT(block->hash_link->file == file); + DBUG_ASSERT(block->hash_link->diskpos == filepos); + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + } + else if (page_st == PAGE_TO_BE_READ) + { + /* + This is a new block in the cache. If we come here, we have + data for the whole block. + */ + DBUG_ASSERT(block->hash_link->requests); + DBUG_ASSERT(block->status & BLOCK_IN_USE); + DBUG_ASSERT((page_st == PAGE_TO_BE_READ) || + (block->status & BLOCK_READ)); + +#if !defined(SERIALIZED_READ_FROM_CACHE) + keycache_pthread_mutex_unlock(&keycache->cache_lock); + /* + Here other threads may step in and register as secondary readers. + They will register in block->wqueue[COND_FOR_REQUESTED]. + */ +#endif + + /* Copy data from buff */ + if (!(read_length & 511)) + bmove512(block->buffer+offset, buff, read_length); + else + memcpy(block->buffer+offset, buff, (size_t) read_length); + +#if !defined(SERIALIZED_READ_FROM_CACHE) + keycache_pthread_mutex_lock(&keycache->cache_lock); + DBUG_ASSERT(block->status & BLOCK_IN_USE); + DBUG_ASSERT((page_st == PAGE_TO_BE_READ) || + (block->status & BLOCK_READ)); +#endif + /* + After the data is in the buffer, we can declare the block + valid. Now other threads do not need to register as + secondary readers any more. They can immediately access the + block. + */ + block->status|= BLOCK_READ; + block->length= read_length+offset; + /* + Do not set block->offset here. If this block is marked + BLOCK_CHANGED later, we want to flush only the modified part. So + only a writer may set block->offset down from + keycache->key_cache_block_size. + */ + KEYCACHE_DBUG_PRINT("key_cache_insert", + ("primary request: new page in cache")); + /* Signal all pending requests. */ + release_whole_queue(&block->wqueue[COND_FOR_REQUESTED]); + } + else + { + /* + page_st == PAGE_READ. The block is in the buffer. All data + must already be present. Blocks are always read with all + data available on file. Assert that the block does not have + less contents than the preloader supplies. If the caller has + data beyond block->length, it means that a file write has + been done while this block was in cache and not extended + with the new data. If the condition is met, we can simply + ignore the block. + */ + DBUG_ASSERT((page_st == PAGE_READ) && + (read_length + offset <= block->length)); + } + + /* + A secondary request must now have the block assigned to the + requested file block. It does not hurt to check it for primary + requests too. + */ + DBUG_ASSERT(block->hash_link->file == file); + DBUG_ASSERT(block->hash_link->diskpos == filepos); + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + } /* end of if (!(block->status & BLOCK_ERROR)) */ + + + remove_reader(block); + + /* Error injection for coverage testing. */ + DBUG_EXECUTE_IF("key_cache_insert_block_error", + block->status|= BLOCK_ERROR; errno=EIO;); + + /* Do not link erroneous blocks into the LRU ring, but free them. */ + if (!(block->status & BLOCK_ERROR)) + { + /* + Link the block into the LRU ring if it's the last submitted + request for the block. This enables eviction for the block. + */ + unreg_request(keycache, block, 1); + } + else + { + free_block(keycache, block); + error= 1; + break; + } + + buff+= read_length; + filepos+= read_length+offset; + offset= 0; + + } while ((length-= read_length)); + + no_key_cache: + if (locked_and_incremented) + dec_counter_for_resize_op(keycache); + keycache_pthread_mutex_unlock(&keycache->cache_lock); + } + DBUG_RETURN(error); +} + + +/* + Write a buffer into a cached file. + + SYNOPSIS + + key_cache_write() + keycache pointer to a key cache data structure + file handler for the file to write data to + filepos position in the file to write data to + level determines the weight of the data + buff buffer with the data + length length of the buffer + dont_write if is 0 then all dirty pages involved in writing + should have been flushed from key cache + post_write_arg argument which will be passed to key cache's + post_write callback + + RETURN VALUE + 0 if a success, 1 - otherwise. + + NOTES. + The function copies the data of size length from buff into buffers + for key cache blocks that are assigned to contain the portion of + the file starting with position filepos. + It ensures that this data is flushed to the file if dont_write is FALSE. + Filepos must be a multiple of 'block_length', but it doesn't + have to be a multiple of key_cache_block_size; + + dont_write is always TRUE in the server (info->lock_type is never F_UNLCK). +*/ + +int key_cache_write(KEY_CACHE *keycache, + File file, my_off_t filepos, int level, + uchar *buff, uint length, + uint block_length __attribute__((unused)), + int dont_write, + void *post_write_arg) +{ + my_bool locked_and_incremented= FALSE; + int error=0; + DBUG_ENTER("key_cache_write"); + DBUG_PRINT("enter", + ("fd: %u pos: %lu length: %u block_length: %u" + " key_block_length: %u", + (uint) file, (ulong) filepos, length, block_length, + keycache ? keycache->key_cache_block_size : 0)); + + if (!dont_write) + { + /* purecov: begin inspected */ + /* Not used in the server. */ + /* Force writing from buff into disk. */ + keycache->global_cache_w_requests++; + keycache->global_cache_write++; + if (key_cache_pwrite(file, buff, length, filepos, + MYF(MY_NABP | MY_WAIT_IF_FULL), + keycache->post_write, post_write_arg)) + DBUG_RETURN(1); + /* purecov: end */ + } + +#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) + DBUG_EXECUTE("check_keycache", + test_key_cache(keycache, "start of key_cache_write", 1);); +#endif + + if (keycache->key_cache_inited) + { + /* Key cache is used */ + reg1 BLOCK_LINK *block; + uint read_length; + uint offset; + int page_st; + + /* + When the key cache is once initialized, we use the cache_lock to + reliably distinguish the cases of normal operation, resizing, and + disabled cache. We always increment and decrement + 'cnt_for_resize_op' so that a resizer can wait for pending I/O. + */ + keycache_pthread_mutex_lock(&keycache->cache_lock); + /* + Cache resizing has two phases: Flushing and re-initializing. In + the flush phase write requests can modify dirty blocks that are + not yet in flush. Otherwise they are allowed to bypass the cache. + find_key_block() returns NULL in both cases (clean blocks and + non-cached blocks). + + After the flush phase new I/O requests must wait until the + re-initialization is done. The re-initialization can be done only + if no I/O request is in progress. The reason is that + key_cache_block_size can change. With enabled cache I/O is done in + chunks of key_cache_block_size. Every chunk tries to use a cache + block first. If the block size changes in the middle, a block + could be missed and data could be written below a cached block. + */ + while (keycache->in_resize && !keycache->resize_in_flush) + wait_on_queue(&keycache->resize_queue, &keycache->cache_lock); + /* Register the I/O for the next resize. */ + inc_counter_for_resize_op(keycache); + locked_and_incremented= TRUE; + /* Requested data may not always be aligned to cache blocks. */ + offset= (uint) (filepos % keycache->key_cache_block_size); + /* Write data in key_cache_block_size increments. */ + do + { + /* Cache could be disabled in a later iteration. */ + if (!keycache->can_be_used) + goto no_key_cache; + /* Start writing at the beginning of the cache block. */ + filepos-= offset; + /* Do not write beyond the end of the cache block. */ + read_length= length; + set_if_smaller(read_length, keycache->key_cache_block_size-offset); + KEYCACHE_DBUG_ASSERT(read_length > 0); + + /* Request the cache block that matches file/pos. */ + keycache->global_cache_w_requests++; + block= find_key_block(keycache, file, filepos, level, 1, &page_st); + if (!block) + { + /* + This happens only for requests submitted during key cache + resize. The block is not in the cache and shall not go in. + Write directly to file. + */ + if (dont_write) + { + /* Used in the server. */ + keycache->global_cache_write++; + keycache_pthread_mutex_unlock(&keycache->cache_lock); + if (key_cache_pwrite(file, (uchar*) buff, read_length, + filepos + offset, + MYF(MY_NABP | MY_WAIT_IF_FULL), + keycache->post_write, post_write_arg)) + error=1; + keycache_pthread_mutex_lock(&keycache->cache_lock); + } + goto next_block; + } + /* + Prevent block from flushing and from being selected for to be + freed. This must be set when we release the cache_lock. + However, we must not set the status of the block before it is + assigned to this file/pos. + */ + if (page_st != PAGE_WAIT_TO_BE_READ) + block->status|= BLOCK_FOR_UPDATE; + /* + We must read the file block first if it is not yet in the cache + and we do not replace all of its contents. + + In cases where the cache block is big enough to contain (parts + of) index blocks of different indexes, our request can be + secondary (PAGE_WAIT_TO_BE_READ). In this case another thread is + reading the file block. If the read completes after us, it + overwrites our new contents with the old contents. So we have to + wait for the other thread to complete the read of this block. + read_block() takes care for the wait. + */ + if (!(block->status & BLOCK_ERROR) && + ((page_st == PAGE_TO_BE_READ && + (offset || read_length < keycache->key_cache_block_size)) || + (page_st == PAGE_WAIT_TO_BE_READ))) + { + read_block(keycache, block, + offset + read_length >= keycache->key_cache_block_size? + offset : keycache->key_cache_block_size, + offset, (page_st == PAGE_TO_BE_READ)); + DBUG_ASSERT(keycache->can_be_used); + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + /* + Prevent block from flushing and from being selected for to be + freed. This must be set when we release the cache_lock. + Here we set it in case we could not set it above. + */ + block->status|= BLOCK_FOR_UPDATE; + } + /* + The block should always be assigned to the requested file block + here. It need not be BLOCK_READ when overwriting the whole block. + */ + DBUG_ASSERT(block->hash_link->file == file); + DBUG_ASSERT(block->hash_link->diskpos == filepos); + DBUG_ASSERT(block->status & BLOCK_IN_USE); + DBUG_ASSERT((page_st == PAGE_TO_BE_READ) || (block->status & BLOCK_READ)); + /* + The block to be written must not be marked BLOCK_REASSIGNED. + Otherwise it could be freed in dirty state or reused without + another flush during eviction. It must also not be in flush. + Otherwise the old contens may have been flushed already and + the flusher could clear BLOCK_CHANGED without flushing the + new changes again. + */ + DBUG_ASSERT(!(block->status & BLOCK_REASSIGNED)); + + while (block->status & BLOCK_IN_FLUSHWRITE) + { + /* + Another thread is flushing the block. It was dirty already. + Wait until the block is flushed to file. Otherwise we could + modify the buffer contents just while it is written to file. + An unpredictable file block contents would be the result. + While we wait, several things can happen to the block, + including another flush. But the block cannot be reassigned to + another hash_link until we release our request on it. + */ + wait_on_queue(&block->wqueue[COND_FOR_SAVED], &keycache->cache_lock); + DBUG_ASSERT(keycache->can_be_used); + DBUG_ASSERT(block->status & (BLOCK_READ | BLOCK_IN_USE)); + /* Still must not be marked for free. */ + DBUG_ASSERT(!(block->status & BLOCK_REASSIGNED)); + DBUG_ASSERT(block->hash_link && (block->hash_link->block == block)); + } + + /* + We could perhaps release the cache_lock during access of the + data like in the other functions. Locks outside of the key cache + assure that readers and a writer do not access the same range of + data. Parallel accesses should happen only if the cache block + contains multiple index block(fragment)s. So different parts of + the buffer would be read/written. An attempt to flush during + memcpy() is prevented with BLOCK_FOR_UPDATE. + */ + if (!(block->status & BLOCK_ERROR)) + { + block->post_write_arg= post_write_arg; +#if !defined(SERIALIZED_READ_FROM_CACHE) + keycache_pthread_mutex_unlock(&keycache->cache_lock); +#endif + if (!(read_length & 511)) + bmove512(block->buffer+offset, buff, read_length); + else + memcpy(block->buffer+offset, buff, (size_t) read_length); + +#if !defined(SERIALIZED_READ_FROM_CACHE) + keycache_pthread_mutex_lock(&keycache->cache_lock); +#endif + } + + if (!dont_write) + { + /* Not used in the server. buff has been written to disk at start. */ + if ((block->status & BLOCK_CHANGED) && + (!offset && read_length >= keycache->key_cache_block_size)) + link_to_file_list(keycache, block, block->hash_link->file, 1); + } + else if (! (block->status & BLOCK_CHANGED)) + link_to_changed_list(keycache, block); + block->status|=BLOCK_READ; + /* + Allow block to be selected for to be freed. Since it is marked + BLOCK_CHANGED too, it won't be selected for to be freed without + a flush. + */ + block->status&= ~BLOCK_FOR_UPDATE; + set_if_smaller(block->offset, offset); + set_if_bigger(block->length, read_length+offset); + + /* Threads may be waiting for the changes to be complete. */ + release_whole_queue(&block->wqueue[COND_FOR_REQUESTED]); + + /* + If only a part of the cache block is to be replaced, and the + rest has been read from file, then the cache lock has been + released for I/O and it could be possible that another thread + wants to evict or free the block and waits for it to be + released. So we must not just decrement hash_link->requests, but + also wake a waiting thread. + */ + remove_reader(block); + + /* Error injection for coverage testing. */ + DBUG_EXECUTE_IF("key_cache_write_block_error", + block->status|= BLOCK_ERROR;); + + /* Do not link erroneous blocks into the LRU ring, but free them. */ + if (!(block->status & BLOCK_ERROR)) + { + /* + Link the block into the LRU ring if it's the last submitted + request for the block. This enables eviction for the block. + */ + unreg_request(keycache, block, 1); + } + else + { + /* Pretend a "clean" block to avoid complications. */ + block->status&= ~(BLOCK_CHANGED); + free_block(keycache, block); + error= 1; + break; + } + + next_block: + buff+= read_length; + filepos+= read_length+offset; + offset= 0; + + } while ((length-= read_length)); + goto end; + } + +no_key_cache: + /* Key cache is not used */ + if (dont_write) + { + /* Used in the server. */ + keycache->global_cache_w_requests++; + keycache->global_cache_write++; + if (locked_and_incremented) + keycache_pthread_mutex_unlock(&keycache->cache_lock); + if (key_cache_pwrite(file, (uchar*) buff, length, filepos, + MYF(MY_NABP | MY_WAIT_IF_FULL), + keycache->post_write, post_write_arg)) + error=1; + if (locked_and_incremented) + keycache_pthread_mutex_lock(&keycache->cache_lock); + } + +end: + if (locked_and_incremented) + { + dec_counter_for_resize_op(keycache); + keycache_pthread_mutex_unlock(&keycache->cache_lock); + } +#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) + DBUG_EXECUTE("exec", + test_key_cache(keycache, "end of key_cache_write", 1);); +#endif + DBUG_RETURN(error); +} + + +/* + Free block. + + SYNOPSIS + free_block() + keycache Pointer to a key cache data structure + block Pointer to the block to free + + DESCRIPTION + Remove reference to block from hash table. + Remove block from the chain of clean blocks. + Add block to the free list. + + NOTE + Block must not be free (status == 0). + Block must not be in free_block_list. + Block must not be in the LRU ring. + Block must not be in eviction (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH). + Block must not be in free (BLOCK_REASSIGNED). + Block must not be in flush (BLOCK_IN_FLUSH). + Block must not be dirty (BLOCK_CHANGED). + Block must not be in changed_blocks (dirty) hash. + Block must be in file_blocks (clean) hash. + Block must refer to a hash_link. + Block must have a request registered on it. +*/ + +static void free_block(KEY_CACHE *keycache, BLOCK_LINK *block) +{ + KEYCACHE_THREAD_TRACE("free block"); + KEYCACHE_DBUG_PRINT("free_block", + ("block %u to be freed, hash_link %p status: %u", + BLOCK_NUMBER(block), block->hash_link, + block->status)); + /* + Assert that the block is not free already. And that it is in a clean + state. Note that the block might just be assigned to a hash_link and + not yet read (BLOCK_READ may not be set here). In this case a reader + is registered in the hash_link and free_block() will wait for it + below. + */ + DBUG_ASSERT((block->status & BLOCK_IN_USE) && + !(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | + BLOCK_REASSIGNED | BLOCK_IN_FLUSH | + BLOCK_CHANGED | BLOCK_FOR_UPDATE))); + /* Assert that the block is in a file_blocks chain. */ + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + /* Assert that the block is not in the LRU ring. */ + DBUG_ASSERT(!block->next_used && !block->prev_used); + /* + IMHO the below condition (if()) makes no sense. I can't see how it + could be possible that free_block() is entered with a NULL hash_link + pointer. The only place where it can become NULL is in free_block() + (or before its first use ever, but for those blocks free_block() is + not called). I don't remove the conditional as it cannot harm, but + place an DBUG_ASSERT to confirm my hypothesis. Eventually the + condition (if()) can be removed. + */ + DBUG_ASSERT(block->hash_link && block->hash_link->block == block); + if (block->hash_link) + { + /* + While waiting for readers to finish, new readers might request the + block. But since we set block->status|= BLOCK_REASSIGNED, they + will wait on block->wqueue[COND_FOR_SAVED]. They must be signalled + later. + */ + block->status|= BLOCK_REASSIGNED; + wait_for_readers(keycache, block); + /* + The block must not have been freed by another thread. Repeat some + checks. An additional requirement is that it must be read now + (BLOCK_READ). + */ + DBUG_ASSERT(block->hash_link && block->hash_link->block == block); + DBUG_ASSERT((block->status & (BLOCK_READ | BLOCK_IN_USE | + BLOCK_REASSIGNED)) && + !(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | + BLOCK_IN_FLUSH | BLOCK_CHANGED | + BLOCK_FOR_UPDATE))); + DBUG_ASSERT(block->prev_changed && *block->prev_changed == block); + DBUG_ASSERT(!block->prev_used); + /* + Unset BLOCK_REASSIGNED again. If we hand the block to an evicting + thread (through unreg_request() below), other threads must not see + this flag. They could become confused. + */ + block->status&= ~BLOCK_REASSIGNED; + /* + Do not release the hash_link until the block is off all lists. + At least not if we hand it over for eviction in unreg_request(). + */ + } + + /* + Unregister the block request and link the block into the LRU ring. + This enables eviction for the block. If the LRU ring was empty and + threads are waiting for a block, then the block wil be handed over + for eviction immediately. Otherwise we will unlink it from the LRU + ring again, without releasing the lock in between. So decrementing + the request counter and updating statistics are the only relevant + operation in this case. Assert that there are no other requests + registered. + */ + DBUG_ASSERT(block->requests == 1); + unreg_request(keycache, block, 0); + /* + Note that even without releasing the cache lock it is possible that + the block is immediately selected for eviction by link_block() and + thus not added to the LRU ring. In this case we must not touch the + block any more. + */ + if (block->status & BLOCK_IN_EVICTION) + return; + + /* Error blocks are not put into the LRU ring. */ + if (!(block->status & BLOCK_ERROR)) + { + /* Here the block must be in the LRU ring. Unlink it again. */ + DBUG_ASSERT(block->next_used && block->prev_used && + *block->prev_used == block); + unlink_block(keycache, block); + } + if (block->temperature == BLOCK_WARM) + keycache->warm_blocks--; + block->temperature= BLOCK_COLD; + + /* Remove from file_blocks hash. */ + unlink_changed(block); + + /* Remove reference to block from hash table. */ + unlink_hash(keycache, block->hash_link); + block->hash_link= NULL; + + block->status= 0; + block->length= 0; + block->offset= keycache->key_cache_block_size; + KEYCACHE_THREAD_TRACE("free block"); + KEYCACHE_DBUG_PRINT("free_block", ("block is freed")); + + /* Enforced by unlink_changed(), but just to be sure. */ + DBUG_ASSERT(!block->next_changed && !block->prev_changed); + /* Enforced by unlink_block(): not in LRU ring nor in free_block_list. */ + DBUG_ASSERT(!block->next_used && !block->prev_used); + /* Insert the free block in the free list. */ + block->next_used= keycache->free_block_list; + keycache->free_block_list= block; + /* Keep track of the number of currently unused blocks. */ + keycache->blocks_unused++; + + /* All pending requests for this page must be resubmitted. */ + release_whole_queue(&block->wqueue[COND_FOR_SAVED]); +} + + +static int cmp_sec_link(BLOCK_LINK **a, BLOCK_LINK **b) +{ + return (((*a)->hash_link->diskpos < (*b)->hash_link->diskpos) ? -1 : + ((*a)->hash_link->diskpos > (*b)->hash_link->diskpos) ? 1 : 0); +} + + +/* + Flush a portion of changed blocks to disk, + free used blocks if requested +*/ + +static int flush_cached_blocks(KEY_CACHE *keycache, + File file, BLOCK_LINK **cache, + BLOCK_LINK **end, + enum flush_type type) +{ + int error; + int last_errno= 0; + uint count= (uint) (end-cache); + + /* Don't lock the cache during the flush */ + keycache_pthread_mutex_unlock(&keycache->cache_lock); + /* + As all blocks referred in 'cache' are marked by BLOCK_IN_FLUSH + we are guarunteed no thread will change them + */ + my_qsort((uchar*) cache, count, sizeof(*cache), (qsort_cmp) cmp_sec_link); + + keycache_pthread_mutex_lock(&keycache->cache_lock); + /* + Note: Do not break the loop. We have registered a request on every + block in 'cache'. These must be unregistered by free_block() or + unreg_request(). + */ + for ( ; cache != end ; cache++) + { + BLOCK_LINK *block= *cache; + + KEYCACHE_DBUG_PRINT("flush_cached_blocks", + ("block %u to be flushed", BLOCK_NUMBER(block))); + /* + If the block contents is going to be changed, we abandon the flush + for this block. flush_key_blocks_int() will restart its search and + handle the block properly. + */ + if (!(block->status & BLOCK_FOR_UPDATE)) + { + /* Blocks coming here must have a certain status. */ + DBUG_ASSERT(block->hash_link); + DBUG_ASSERT(block->hash_link->block == block); + DBUG_ASSERT(block->hash_link->file == file); + DBUG_ASSERT((block->status & ~BLOCK_IN_EVICTION) == + (BLOCK_READ | BLOCK_IN_FLUSH | BLOCK_CHANGED | BLOCK_IN_USE)); + block->status|= BLOCK_IN_FLUSHWRITE; + keycache_pthread_mutex_unlock(&keycache->cache_lock); + error= key_cache_pwrite(file, + block->buffer+block->offset, + block->length - block->offset, + block->hash_link->diskpos+ block->offset, + MYF(MY_NABP | MY_WAIT_IF_FULL), + keycache->post_write, block->post_write_arg); + keycache_pthread_mutex_lock(&keycache->cache_lock); + keycache->global_cache_write++; + if (error) + { + block->status|= BLOCK_ERROR; + if (!last_errno) + last_errno= errno ? errno : -1; + } + block->status&= ~BLOCK_IN_FLUSHWRITE; + /* Block must not have changed status except BLOCK_FOR_UPDATE. */ + DBUG_ASSERT(block->hash_link); + DBUG_ASSERT(block->hash_link->block == block); + DBUG_ASSERT(block->hash_link->file == file); + DBUG_ASSERT((block->status & ~(BLOCK_FOR_UPDATE | BLOCK_IN_EVICTION)) == + (BLOCK_READ | BLOCK_IN_FLUSH | BLOCK_CHANGED | BLOCK_IN_USE)); + /* + Set correct status and link in right queue for free or later use. + free_block() must not see BLOCK_CHANGED and it may need to wait + for readers of the block. These should not see the block in the + wrong hash. If not freeing the block, we need to have it in the + right queue anyway. + */ + link_to_file_list(keycache, block, file, 1); + + } + block->status&= ~BLOCK_IN_FLUSH; + /* + Let to proceed for possible waiting requests to write to the block page. + It might happen only during an operation to resize the key cache. + */ + release_whole_queue(&block->wqueue[COND_FOR_SAVED]); + /* type will never be FLUSH_IGNORE_CHANGED here */ + if (!(type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE) && + !(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | + BLOCK_FOR_UPDATE))) + { + /* + Note that a request has been registered against the block in + flush_key_blocks_int(). + */ + free_block(keycache, block); + } + else + { + /* + Link the block into the LRU ring if it's the last submitted + request for the block. This enables eviction for the block. + Note that a request has been registered against the block in + flush_key_blocks_int(). + */ + unreg_request(keycache, block, 1); + } + + } /* end of for ( ; cache != end ; cache++) */ + return last_errno; +} + + +/* + flush all key blocks for a file to disk, but don't do any mutex locks. + + SYNOPSIS + flush_key_blocks_int() + keycache pointer to a key cache data structure + file handler for the file to flush to + flush_type type of the flush + + NOTES + This function doesn't do any mutex locks because it needs to be called both + from flush_key_blocks and flush_all_key_blocks (the later one does the + mutex lock in the resize_key_cache() function). + + We do only care about changed blocks that exist when the function is + entered. We do not guarantee that all changed blocks of the file are + flushed if more blocks change while this function is running. + + RETURN + 0 ok + 1 error +*/ + +static int flush_key_blocks_int(KEY_CACHE *keycache, + File file, enum flush_type type) +{ + BLOCK_LINK *cache_buff[FLUSH_CACHE],**cache; + int last_errno= 0; + int last_errcnt= 0; + DBUG_ENTER("flush_key_blocks_int"); + DBUG_PRINT("enter",("file: %d blocks_used: %lu blocks_changed: %lu", + file, keycache->blocks_used, keycache->blocks_changed)); + +#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG) + DBUG_EXECUTE("check_keycache", + test_key_cache(keycache, "start of flush_key_blocks", 0);); +#endif + + DBUG_ASSERT(type != FLUSH_KEEP_LAZY); + cache= cache_buff; + if (keycache->disk_blocks > 0 && + (!my_disable_flush_key_blocks || type != FLUSH_KEEP)) + { + /* Key cache exists and flush is not disabled */ + int error= 0; + uint count= FLUSH_CACHE; + BLOCK_LINK **pos,**end; + BLOCK_LINK *first_in_switch= NULL; + BLOCK_LINK *last_in_flush; + BLOCK_LINK *last_for_update; + BLOCK_LINK *block, *next; +#if defined(KEYCACHE_DEBUG) + uint cnt=0; +#endif + + if (type != FLUSH_IGNORE_CHANGED) + { + /* + Count how many key blocks we have to cache to be able + to flush all dirty pages with minimum seek moves + */ + count= 0; + for (block= keycache->changed_blocks[FILE_HASH(file)] ; + block ; + block= block->next_changed) + { + if ((block->hash_link->file == file) && + !(block->status & BLOCK_IN_FLUSH)) + { + count++; + KEYCACHE_DBUG_ASSERT(count<= keycache->blocks_used); + } + } + /* + Allocate a new buffer only if its bigger than the one we have. + Assure that we always have some entries for the case that new + changed blocks appear while we need to wait for something. + */ + if ((count > FLUSH_CACHE) && + !(cache= (BLOCK_LINK**) my_malloc(sizeof(BLOCK_LINK*)*count, + MYF(0)))) + cache= cache_buff; + /* + After a restart there could be more changed blocks than now. + So we should not let count become smaller than the fixed buffer. + */ + if (cache == cache_buff) + count= FLUSH_CACHE; + } + + /* Retrieve the blocks and write them to a buffer to be flushed */ +restart: + last_in_flush= NULL; + last_for_update= NULL; + end= (pos= cache)+count; + for (block= keycache->changed_blocks[FILE_HASH(file)] ; + block ; + block= next) + { +#if defined(KEYCACHE_DEBUG) + cnt++; + KEYCACHE_DBUG_ASSERT(cnt <= keycache->blocks_used); +#endif + next= block->next_changed; + if (block->hash_link->file == file) + { + if (!(block->status & (BLOCK_IN_FLUSH | BLOCK_FOR_UPDATE))) + { + /* + Note: The special handling of BLOCK_IN_SWITCH is obsolete + since we set BLOCK_IN_FLUSH if the eviction includes a + flush. It can be removed in a later version. + */ + if (!(block->status & BLOCK_IN_SWITCH)) + { + /* + We care only for the blocks for which flushing was not + initiated by another thread and which are not in eviction. + Registering a request on the block unlinks it from the LRU + ring and protects against eviction. + */ + reg_requests(keycache, block, 1); + if (type != FLUSH_IGNORE_CHANGED) + { + /* It's not a temporary file */ + if (pos == end) + { + /* + This should happen relatively seldom. Remove the + request because we won't do anything with the block + but restart and pick it again in the next iteration. + */ + unreg_request(keycache, block, 0); + /* + This happens only if there is not enough + memory for the big block + */ + if ((error= flush_cached_blocks(keycache, file, cache, + end,type))) + { + /* Do not loop infinitely trying to flush in vain. */ + if ((last_errno == error) && (++last_errcnt > 5)) + goto err; + last_errno= error; + } + /* + Restart the scan as some other thread might have changed + the changed blocks chain: the blocks that were in switch + state before the flush started have to be excluded + */ + goto restart; + } + /* + Mark the block with BLOCK_IN_FLUSH in order not to let + other threads to use it for new pages and interfere with + our sequence of flushing dirty file pages. We must not + set this flag before actually putting the block on the + write burst array called 'cache'. + */ + block->status|= BLOCK_IN_FLUSH; + /* Add block to the array for a write burst. */ + *pos++= block; + } + else + { + /* It's a temporary file */ + DBUG_ASSERT(!(block->status & BLOCK_REASSIGNED)); + + /* + free_block() must not be called with BLOCK_CHANGED. Note + that we must not change the BLOCK_CHANGED flag outside of + link_to_file_list() so that it is always in the correct + queue and the *blocks_changed counters are correct. + */ + link_to_file_list(keycache, block, file, 1); + if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH))) + { + /* A request has been registered against the block above. */ + free_block(keycache, block); + } + else + { + /* + Link the block into the LRU ring if it's the last + submitted request for the block. This enables eviction + for the block. A request has been registered against + the block above. + */ + unreg_request(keycache, block, 1); + } + } + } + else + { + /* + Link the block into a list of blocks 'in switch'. + + WARNING: Here we introduce a place where a changed block + is not in the changed_blocks hash! This is acceptable for + a BLOCK_IN_SWITCH. Never try this for another situation. + Other parts of the key cache code rely on changed blocks + being in the changed_blocks hash. + */ + unlink_changed(block); + link_changed(block, &first_in_switch); + } + } + else if (type != FLUSH_KEEP) + { + /* + During the normal flush at end of statement (FLUSH_KEEP) we + do not need to ensure that blocks in flush or update by + other threads are flushed. They will be flushed by them + later. In all other cases we must assure that we do not have + any changed block of this file in the cache when this + function returns. + */ + if (block->status & BLOCK_IN_FLUSH) + { + /* Remember the last block found to be in flush. */ + last_in_flush= block; + } + else + { + /* Remember the last block found to be selected for update. */ + last_for_update= block; + } + } + } + } + if (pos != cache) + { + if ((error= flush_cached_blocks(keycache, file, cache, pos, type))) + { + /* Do not loop inifnitely trying to flush in vain. */ + if ((last_errno == error) && (++last_errcnt > 5)) + goto err; + last_errno= error; + } + /* + Do not restart here during the normal flush at end of statement + (FLUSH_KEEP). We have now flushed at least all blocks that were + changed when entering this function. In all other cases we must + assure that we do not have any changed block of this file in the + cache when this function returns. + */ + if (type != FLUSH_KEEP) + goto restart; + } + if (last_in_flush) + { + /* + There are no blocks to be flushed by this thread, but blocks in + flush by other threads. Wait until one of the blocks is flushed. + Re-check the condition for last_in_flush. We may have unlocked + the cache_lock in flush_cached_blocks(). The state of the block + could have changed. + */ + if (last_in_flush->status & BLOCK_IN_FLUSH) + wait_on_queue(&last_in_flush->wqueue[COND_FOR_SAVED], + &keycache->cache_lock); + /* Be sure not to lose a block. They may be flushed in random order. */ + goto restart; + } + if (last_for_update) + { + /* + There are no blocks to be flushed by this thread, but blocks for + update by other threads. Wait until one of the blocks is updated. + Re-check the condition for last_for_update. We may have unlocked + the cache_lock in flush_cached_blocks(). The state of the block + could have changed. + */ + if (last_for_update->status & BLOCK_FOR_UPDATE) + wait_on_queue(&last_for_update->wqueue[COND_FOR_REQUESTED], + &keycache->cache_lock); + /* The block is now changed. Flush it. */ + goto restart; + } + + /* + Wait until the list of blocks in switch is empty. The threads that + are switching these blocks will relink them to clean file chains + while we wait and thus empty the 'first_in_switch' chain. + */ + while (first_in_switch) + { +#if defined(KEYCACHE_DEBUG) + cnt= 0; +#endif + wait_on_queue(&first_in_switch->wqueue[COND_FOR_SAVED], + &keycache->cache_lock); +#if defined(KEYCACHE_DEBUG) + cnt++; + KEYCACHE_DBUG_ASSERT(cnt <= keycache->blocks_used); +#endif + /* + Do not restart here. We have flushed all blocks that were + changed when entering this function and were not marked for + eviction. Other threads have now flushed all remaining blocks in + the course of their eviction. + */ + } + + if (! (type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE)) + { + BLOCK_LINK *last_for_update= NULL; + BLOCK_LINK *last_in_switch= NULL; + uint total_found= 0; + uint found; + + /* + Finally free all clean blocks for this file. + During resize this may be run by two threads in parallel. + */ + do + { + found= 0; + for (block= keycache->file_blocks[FILE_HASH(file)] ; + block ; + block= next) + { + /* Remember the next block. After freeing we cannot get at it. */ + next= block->next_changed; + + /* Changed blocks cannot appear in the file_blocks hash. */ + DBUG_ASSERT(!(block->status & BLOCK_CHANGED)); + if (block->hash_link->file == file) + { + /* We must skip blocks that will be changed. */ + if (block->status & BLOCK_FOR_UPDATE) + { + last_for_update= block; + continue; + } + + /* + We must not free blocks in eviction (BLOCK_IN_EVICTION | + BLOCK_IN_SWITCH) or blocks intended to be freed + (BLOCK_REASSIGNED). + */ + if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH | + BLOCK_REASSIGNED))) + { + struct st_hash_link *next_hash_link; + my_off_t next_diskpos; + File next_file; + uint next_status; + uint hash_requests; + + total_found++; + found++; + KEYCACHE_DBUG_ASSERT(found <= keycache->blocks_used); + + /* + Register a request. This unlinks the block from the LRU + ring and protects it against eviction. This is required + by free_block(). + */ + reg_requests(keycache, block, 1); + + /* + free_block() may need to wait for readers of the block. + This is the moment where the other thread can move the + 'next' block from the chain. free_block() needs to wait + if there are requests for the block pending. + */ + if (next && (hash_requests= block->hash_link->requests)) + { + /* Copy values from the 'next' block and its hash_link. */ + next_status= next->status; + next_hash_link= next->hash_link; + next_diskpos= next_hash_link->diskpos; + next_file= next_hash_link->file; + DBUG_ASSERT(next == next_hash_link->block); + } + + free_block(keycache, block); + /* + If we had to wait and the state of the 'next' block + changed, break the inner loop. 'next' may no longer be + part of the current chain. + + We do not want to break the loop after every free_block(), + not even only after waits. The chain might be quite long + and contain blocks for many files. Traversing it again and + again to find more blocks for this file could become quite + inefficient. + */ + if (next && hash_requests && + ((next_status != next->status) || + (next_hash_link != next->hash_link) || + (next_file != next_hash_link->file) || + (next_diskpos != next_hash_link->diskpos) || + (next != next_hash_link->block))) + break; + } + else + { + last_in_switch= block; + } + } + } /* end for block in file_blocks */ + } while (found); + + /* + If any clean block has been found, we may have waited for it to + become free. In this case it could be possible that another clean + block became dirty. This is possible if the write request existed + before the flush started (BLOCK_FOR_UPDATE). Re-check the hashes. + */ + if (total_found) + goto restart; + + /* + To avoid an infinite loop, wait until one of the blocks marked + for update is updated. + */ + if (last_for_update) + { + /* We did not wait. Block must not have changed status. */ + DBUG_ASSERT(last_for_update->status & BLOCK_FOR_UPDATE); + wait_on_queue(&last_for_update->wqueue[COND_FOR_REQUESTED], + &keycache->cache_lock); + goto restart; + } + + /* + To avoid an infinite loop wait until one of the blocks marked + for eviction is switched. + */ + if (last_in_switch) + { + /* We did not wait. Block must not have changed status. */ + DBUG_ASSERT(last_in_switch->status & (BLOCK_IN_EVICTION | + BLOCK_IN_SWITCH | + BLOCK_REASSIGNED)); + wait_on_queue(&last_in_switch->wqueue[COND_FOR_SAVED], + &keycache->cache_lock); + goto restart; + } + + } /* if (! (type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE)) */ + + } /* if (keycache->disk_blocks > 0 */ + +#ifndef DBUG_OFF + DBUG_EXECUTE("check_keycache", + test_key_cache(keycache, "end of flush_key_blocks", 0);); +#endif +err: + if (cache != cache_buff) + my_free((uchar*) cache, MYF(0)); + if (last_errno) + errno=last_errno; /* Return first error */ + DBUG_RETURN(last_errno != 0); +} + + +/* + Flush all blocks for a file to disk + + SYNOPSIS + + flush_key_blocks() + keycache pointer to a key cache data structure + file handler for the file to flush to + flush_type type of the flush + + RETURN + 0 ok + 1 error +*/ + +int flush_key_blocks(KEY_CACHE *keycache, + File file, enum flush_type type) +{ + int res= 0; + DBUG_ENTER("flush_key_blocks"); + DBUG_PRINT("enter", ("keycache: %p", keycache)); + + if (!keycache->key_cache_inited) + DBUG_RETURN(0); + + keycache_pthread_mutex_lock(&keycache->cache_lock); + /* While waiting for lock, keycache could have been ended. */ + if (keycache->disk_blocks > 0) + { + inc_counter_for_resize_op(keycache); + res= flush_key_blocks_int(keycache, file, type); + dec_counter_for_resize_op(keycache); + } + keycache_pthread_mutex_unlock(&keycache->cache_lock); + DBUG_RETURN(res); +} + + +/* + Flush all blocks in the key cache to disk. + + SYNOPSIS + flush_all_key_blocks() + keycache pointer to key cache root structure + + DESCRIPTION + + Flushing of the whole key cache is done in two phases. + + 1. Flush all changed blocks, waiting for them if necessary. Loop + until there is no changed block left in the cache. + + 2. Free all clean blocks. Normally this means free all blocks. The + changed blocks were flushed in phase 1 and became clean. However we + may need to wait for blocks that are read by other threads. While we + wait, a clean block could become changed if that operation started + before the resize operation started. To be safe we must restart at + phase 1. + + When we can run through the changed_blocks and file_blocks hashes + without finding a block any more, then we are done. + + Note that we hold keycache->cache_lock all the time unless we need + to wait for something. + + RETURN + 0 OK + != 0 Error +*/ + +static int flush_all_key_blocks(KEY_CACHE *keycache) +{ + BLOCK_LINK *block; + uint total_found; + uint found; + uint idx; + DBUG_ENTER("flush_all_key_blocks"); + + do + { + safe_mutex_assert_owner(&keycache->cache_lock); + total_found= 0; + + /* + Phase1: Flush all changed blocks, waiting for them if necessary. + Loop until there is no changed block left in the cache. + */ + do + { + found= 0; + /* Step over the whole changed_blocks hash array. */ + for (idx= 0; idx < CHANGED_BLOCKS_HASH; idx++) + { + /* + If an array element is non-empty, use the first block from its + chain to find a file for flush. All changed blocks for this + file are flushed. So the same block will not appear at this + place again with the next iteration. New writes for blocks are + not accepted during the flush. If multiple files share the + same hash bucket, one of them will be flushed per iteration + of the outer loop of phase 1. + */ + if ((block= keycache->changed_blocks[idx])) + { + found++; + /* + Flush dirty blocks but do not free them yet. They can be used + for reading until all other blocks are flushed too. + */ + if (flush_key_blocks_int(keycache, block->hash_link->file, + FLUSH_FORCE_WRITE)) + DBUG_RETURN(1); + } + } + + } while (found); + + /* + Phase 2: Free all clean blocks. Normally this means free all + blocks. The changed blocks were flushed in phase 1 and became + clean. However we may need to wait for blocks that are read by + other threads. While we wait, a clean block could become changed + if that operation started before the resize operation started. To + be safe we must restart at phase 1. + */ + do + { + found= 0; + /* Step over the whole file_blocks hash array. */ + for (idx= 0; idx < CHANGED_BLOCKS_HASH; idx++) + { + /* + If an array element is non-empty, use the first block from its + chain to find a file for flush. All blocks for this file are + freed. So the same block will not appear at this place again + with the next iteration. If multiple files share the + same hash bucket, one of them will be flushed per iteration + of the outer loop of phase 2. + */ + if ((block= keycache->file_blocks[idx])) + { + total_found++; + found++; + if (flush_key_blocks_int(keycache, block->hash_link->file, + FLUSH_RELEASE)) + DBUG_RETURN(1); + } + } + + } while (found); + + /* + If any clean block has been found, we may have waited for it to + become free. In this case it could be possible that another clean + block became dirty. This is possible if the write request existed + before the resize started (BLOCK_FOR_UPDATE). Re-check the hashes. + */ + } while (total_found); + +#ifndef DBUG_OFF + /* Now there should not exist any block any more. */ + for (idx= 0; idx < CHANGED_BLOCKS_HASH; idx++) + { + DBUG_ASSERT(!keycache->changed_blocks[idx]); + DBUG_ASSERT(!keycache->file_blocks[idx]); + } +#endif + + DBUG_RETURN(0); +} + + +/* + Reset the counters of a key cache. + + SYNOPSIS + reset_key_cache_counters() + name the name of a key cache + key_cache pointer to the key kache to be reset + + DESCRIPTION + This procedure is used by process_key_caches() to reset the counters of all + currently used key caches, both the default one and the named ones. + + RETURN + 0 on success (always because it can't fail) +*/ + +int reset_key_cache_counters(const char *name __attribute__((unused)), + KEY_CACHE *key_cache) +{ + DBUG_ENTER("reset_key_cache_counters"); + if (!key_cache->key_cache_inited) + { + DBUG_PRINT("info", ("Key cache %s not initialized.", name)); + DBUG_RETURN(0); + } + DBUG_PRINT("info", ("Resetting counters for key cache %s.", name)); + + key_cache->global_blocks_changed= 0; /* Key_blocks_not_flushed */ + key_cache->global_cache_r_requests= 0; /* Key_read_requests */ + key_cache->global_cache_read= 0; /* Key_reads */ + key_cache->global_cache_w_requests= 0; /* Key_write_requests */ + key_cache->global_cache_write= 0; /* Key_writes */ + DBUG_RETURN(0); +} + + +#ifndef DBUG_OFF +/* + Test if disk-cache is ok +*/ +static void test_key_cache(KEY_CACHE *keycache __attribute__((unused)), + const char *where __attribute__((unused)), + my_bool lock __attribute__((unused))) +{ + /* TODO */ +} +#endif + +#if defined(KEYCACHE_TIMEOUT) + +#define KEYCACHE_DUMP_FILE "keycache_dump.txt" +#define MAX_QUEUE_LEN 100 + + +static void keycache_dump(KEY_CACHE *keycache) +{ + FILE *keycache_dump_file=fopen(KEYCACHE_DUMP_FILE, "w"); + struct st_my_thread_var *last; + struct st_my_thread_var *thread; + BLOCK_LINK *block; + HASH_LINK *hash_link; + KEYCACHE_PAGE *page; + uint i; + + fprintf(keycache_dump_file, "thread:%u\n", thread->id); + + i=0; + thread=last=waiting_for_hash_link.last_thread; + fprintf(keycache_dump_file, "queue of threads waiting for hash link\n"); + if (thread) + do + { + thread=thread->next; + page= (KEYCACHE_PAGE *) thread->opt_info; + fprintf(keycache_dump_file, + "thread:%u, (file,filepos)=(%u,%lu)\n", + thread->id,(uint) page->file,(ulong) page->filepos); + if (++i == MAX_QUEUE_LEN) + break; + } + while (thread != last); + + i=0; + thread=last=waiting_for_block.last_thread; + fprintf(keycache_dump_file, "queue of threads waiting for block\n"); + if (thread) + do + { + thread=thread->next; + hash_link= (HASH_LINK *) thread->opt_info; + fprintf(keycache_dump_file, + "thread:%u hash_link:%u (file,filepos)=(%u,%lu)\n", + thread->id, (uint) HASH_LINK_NUMBER(hash_link), + (uint) hash_link->file,(ulong) hash_link->diskpos); + if (++i == MAX_QUEUE_LEN) + break; + } + while (thread != last); + + for (i=0 ; i< keycache->blocks_used ; i++) + { + int j; + block= &keycache->block_root[i]; + hash_link= block->hash_link; + fprintf(keycache_dump_file, + "block:%u hash_link:%d status:%x #requests=%u waiting_for_readers:%d\n", + i, (int) (hash_link ? HASH_LINK_NUMBER(hash_link) : -1), + block->status, block->requests, block->condvar ? 1 : 0); + for (j=0 ; j < 2; j++) + { + KEYCACHE_WQUEUE *wqueue=&block->wqueue[j]; + thread= last= wqueue->last_thread; + fprintf(keycache_dump_file, "queue #%d\n", j); + if (thread) + { + do + { + thread=thread->next; + fprintf(keycache_dump_file, + "thread:%u\n", thread->id); + if (++i == MAX_QUEUE_LEN) + break; + } + while (thread != last); + } + } + } + fprintf(keycache_dump_file, "LRU chain:"); + block= keycache= used_last; + if (block) + { + do + { + block= block->next_used; + fprintf(keycache_dump_file, + "block:%u, ", BLOCK_NUMBER(block)); + } + while (block != keycache->used_last); + } + fprintf(keycache_dump_file, "\n"); + + fclose(keycache_dump_file); +} + +#endif /* defined(KEYCACHE_TIMEOUT) */ + +#if defined(KEYCACHE_TIMEOUT) && !defined(__WIN__) + + +static int keycache_pthread_cond_wait(pthread_cond_t *cond, + pthread_mutex_t *mutex) +{ + int rc; + struct timeval now; /* time when we started waiting */ + struct timespec timeout; /* timeout value for the wait function */ + struct timezone tz; +#if defined(KEYCACHE_DEBUG) + int cnt=0; +#endif + + /* Get current time */ + gettimeofday(&now, &tz); + /* Prepare timeout value */ + timeout.tv_sec= now.tv_sec + KEYCACHE_TIMEOUT; + /* + timeval uses microseconds. + timespec uses nanoseconds. + 1 nanosecond = 1000 micro seconds + */ + timeout.tv_nsec= now.tv_usec * 1000; + KEYCACHE_THREAD_TRACE_END("started waiting"); +#if defined(KEYCACHE_DEBUG) + cnt++; + if (cnt % 100 == 0) + fprintf(keycache_debug_log, "waiting...\n"); + fflush(keycache_debug_log); +#endif + rc= pthread_cond_timedwait(cond, mutex, &timeout); + KEYCACHE_THREAD_TRACE_BEGIN("finished waiting"); + if (rc == ETIMEDOUT || rc == ETIME) + { +#if defined(KEYCACHE_DEBUG) + fprintf(keycache_debug_log,"aborted by keycache timeout\n"); + fclose(keycache_debug_log); + abort(); +#endif + keycache_dump(); + } + +#if defined(KEYCACHE_DEBUG) + KEYCACHE_DBUG_ASSERT(rc != ETIMEDOUT); +#else + assert(rc != ETIMEDOUT); +#endif + return rc; +} +#else +#if defined(KEYCACHE_DEBUG) +static int keycache_pthread_cond_wait(pthread_cond_t *cond, + pthread_mutex_t *mutex) +{ + int rc; + KEYCACHE_THREAD_TRACE_END("started waiting"); + rc= pthread_cond_wait(cond, mutex); + KEYCACHE_THREAD_TRACE_BEGIN("finished waiting"); + return rc; +} +#endif +#endif /* defined(KEYCACHE_TIMEOUT) && !defined(__WIN__) */ + +#if defined(KEYCACHE_DEBUG) + + +static int keycache_pthread_mutex_lock(pthread_mutex_t *mutex) +{ + int rc; + rc= pthread_mutex_lock(mutex); + KEYCACHE_THREAD_TRACE_BEGIN(""); + return rc; +} + + +static void keycache_pthread_mutex_unlock(pthread_mutex_t *mutex) +{ + KEYCACHE_THREAD_TRACE_END(""); + pthread_mutex_unlock(mutex); +} + + +static int keycache_pthread_cond_signal(pthread_cond_t *cond) +{ + int rc; + KEYCACHE_THREAD_TRACE("signal"); + rc= pthread_cond_signal(cond); + return rc; +} + + +#if defined(KEYCACHE_DEBUG_LOG) + + +static void keycache_debug_print(const char * fmt,...) +{ + va_list args; + va_start(args,fmt); + if (keycache_debug_log) + { + (void) vfprintf(keycache_debug_log, fmt, args); + (void) fputc('\n',keycache_debug_log); + } + va_end(args); +} +#endif /* defined(KEYCACHE_DEBUG_LOG) */ + +#if defined(KEYCACHE_DEBUG_LOG) + + +void keycache_debug_log_close(void) +{ + if (keycache_debug_log) + fclose(keycache_debug_log); +} +#endif /* defined(KEYCACHE_DEBUG_LOG) */ + +#endif /* defined(KEYCACHE_DEBUG) */ + +#if !defined(DBUG_OFF) +#define F_B_PRT(_f_, _v_) DBUG_PRINT("assert_fail", (_f_, _v_)) + +static int fail_block(BLOCK_LINK *block) +{ + F_B_PRT("block->next_used: %lx\n", (ulong) block->next_used); + F_B_PRT("block->prev_used: %lx\n", (ulong) block->prev_used); + F_B_PRT("block->next_changed: %lx\n", (ulong) block->next_changed); + F_B_PRT("block->prev_changed: %lx\n", (ulong) block->prev_changed); + F_B_PRT("block->hash_link: %lx\n", (ulong) block->hash_link); + F_B_PRT("block->status: %u\n", block->status); + F_B_PRT("block->length: %u\n", block->length); + F_B_PRT("block->offset: %u\n", block->offset); + F_B_PRT("block->requests: %u\n", block->requests); + F_B_PRT("block->temperature: %u\n", block->temperature); + return 0; /* Let the assert fail. */ +} + +static int fail_hlink(HASH_LINK *hlink) +{ + F_B_PRT("hlink->next: %lx\n", (ulong) hlink->next); + F_B_PRT("hlink->prev: %lx\n", (ulong) hlink->prev); + F_B_PRT("hlink->block: %lx\n", (ulong) hlink->block); + F_B_PRT("hlink->diskpos: %lu\n", (ulong) hlink->diskpos); + F_B_PRT("hlink->file: %d\n", hlink->file); + return 0; /* Let the assert fail. */ +} + +static int cache_empty(KEY_CACHE *keycache) +{ + int errcnt= 0; + int idx; + if (keycache->disk_blocks <= 0) + return 1; + for (idx= 0; idx < keycache->disk_blocks; idx++) + { + BLOCK_LINK *block= keycache->block_root + idx; + if (block->status || block->requests || block->hash_link) + { + fprintf(stderr, "block index: %u\n", idx); + fail_block(block); + errcnt++; + } + } + for (idx= 0; idx < keycache->hash_links; idx++) + { + HASH_LINK *hash_link= keycache->hash_link_root + idx; + if (hash_link->requests || hash_link->block) + { + fprintf(stderr, "hash_link index: %u\n", idx); + fail_hlink(hash_link); + errcnt++; + } + } + if (errcnt) + { + fprintf(stderr, "blocks: %d used: %lu\n", + keycache->disk_blocks, keycache->blocks_used); + fprintf(stderr, "hash_links: %d used: %d\n", + keycache->hash_links, keycache->hash_links_used); + fprintf(stderr, "\n"); + } + return !errcnt; +} +#endif + diff --git a/externals/mysql/mysys/mf_keycaches.c b/externals/mysql/mysys/mf_keycaches.c new file mode 100644 index 0000000..9ea5678 --- /dev/null +++ b/externals/mysql/mysys/mf_keycaches.c @@ -0,0 +1,106 @@ +/* Copyright (C) 2003-2007 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Handling of multiple key caches + + The idea is to have a thread safe hash on the table name, + with a default key cache value that is returned if the table name is not in + the cache. +*/ + +#include "mysys_priv.h" +#include +#include +#include +#include "my_safehash.h" + +/***************************************************************************** + Functions to handle the key cache objects +*****************************************************************************/ + +/* Variable to store all key cache objects */ +static SAFE_HASH key_cache_hash; + + +my_bool multi_keycache_init(void) +{ + return safe_hash_init(&key_cache_hash, 16, (uchar*) dflt_key_cache); +} + + +void multi_keycache_free(void) +{ + safe_hash_free(&key_cache_hash); +} + +/* + Get a key cache to be used for a specific table. + + SYNOPSIS + multi_key_cache_search() + key key to find (usually table path) + uint length Length of key. + def Default value if no key cache + + NOTES + This function is coded in such a way that we will return the + default key cache even if one never called multi_keycache_init. + This will ensure that it works with old MyISAM clients. + + RETURN + key cache to use +*/ + +KEY_CACHE *multi_key_cache_search(uchar *key, uint length, + KEY_CACHE *def) +{ + if (!key_cache_hash.hash.records) + return def; + return (KEY_CACHE*) safe_hash_search(&key_cache_hash, key, length, + (void*) def); +} + + +/* + Assosiate a key cache with a key + + + SYONOPSIS + multi_key_cache_set() + key key (path to table etc..) + length Length of key + key_cache cache to assococite with the table + + NOTES + This can be used both to insert a new entry and change an existing + entry +*/ + + +my_bool multi_key_cache_set(const uchar *key, uint length, + KEY_CACHE *key_cache) +{ + return safe_hash_set(&key_cache_hash, key, length, (uchar*) key_cache); +} + + +void multi_key_cache_change(KEY_CACHE *old_data, + KEY_CACHE *new_data) +{ + safe_hash_change(&key_cache_hash, (uchar*) old_data, (uchar*) new_data); +} + + diff --git a/externals/mysql/mysys/mf_loadpath.c b/externals/mysql/mysys/mf_loadpath.c new file mode 100644 index 0000000..fbf6f7f --- /dev/null +++ b/externals/mysql/mysys/mf_loadpath.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + + /* Returns full load-path for a file. to may be = path */ + /* if path is a hard-path return path */ + /* if path starts with home-dir return path */ + /* if path starts with current dir or parent-dir unpack path */ + /* if there is no path, prepend with own_path_prefix if given */ + /* else unpack path according to current dir */ + +char * my_load_path(char * to, const char *path, + const char *own_path_prefix) +{ + char buff[FN_REFLEN]; + int is_cur; + DBUG_ENTER("my_load_path"); + DBUG_PRINT("enter",("path: %s prefix: %s",path, + own_path_prefix ? own_path_prefix : "")); + + if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) || + test_if_hard_path(path)) + (void) strmov(buff,path); + else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) || + (is_prefix(path,FN_PARENTDIR)) || + ! own_path_prefix) + { + if (is_cur) + is_cur=2; /* Remove current dir */ + if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0))) + (void) strcat(buff,path+is_cur); + else + (void) strmov(buff,path); /* Return org file name */ + } + else + (void) strxmov(buff,own_path_prefix,path,NullS); + strmov(to,buff); + DBUG_PRINT("exit",("to: %s",to)); + DBUG_RETURN(to); +} /* my_load_path */ diff --git a/externals/mysql/mysys/mf_pack.c b/externals/mysql/mysys/mf_pack.c new file mode 100644 index 0000000..ab4cd35 --- /dev/null +++ b/externals/mysql/mysys/mf_pack.c @@ -0,0 +1,526 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include +#ifdef HAVE_PWD_H +#include +#endif +#ifdef VMS +#include +#include +#include +#endif /* VMS */ + +static char * NEAR_F expand_tilde(char * *path); + + /* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */ + /* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */ + /* to may be == from */ + +void pack_dirname(char * to, const char *from) +{ + int cwd_err; + size_t d_length,length,buff_length; + char * start; + char buff[FN_REFLEN]; + DBUG_ENTER("pack_dirname"); + + LINT_INIT(buff_length); + (void) intern_filename(to,from); /* Change to intern name */ + +#ifdef FN_DEVCHAR + if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skip device part */ + start++; + else +#endif + start=to; + + if (!(cwd_err= my_getwd(buff,FN_REFLEN,MYF(0)))) + { + buff_length= strlen(buff); + d_length= (size_t) (start-to); + if ((start == to || + (buff_length == d_length && !bcmp(buff,start,d_length))) && + *start != FN_LIBCHAR && *start) + { /* Put current dir before */ + bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1); + } + } + + if ((d_length= cleanup_dirname(to,to)) != 0) + { + length=0; + if (home_dir) + { + length= strlen(home_dir); + if (home_dir[length-1] == FN_LIBCHAR) + length--; /* Don't test last '/' */ + } + if (length > 1 && length < d_length) + { /* test if /xx/yy -> ~/yy */ + if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR) + { + to[0]=FN_HOMELIB; /* Filename begins with ~ */ + (void) strmov_overlapp(to+1,to+length); + } + } + if (! cwd_err) + { /* Test if cwd is ~/... */ + if (length > 1 && length < buff_length) + { + if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR) + { + buff[0]=FN_HOMELIB; + (void) strmov_overlapp(buff+1,buff+length); + } + } + if (is_prefix(to,buff)) + { + length= strlen(buff); + if (to[length]) + (void) strmov_overlapp(to,to+length); /* Remove everything before */ + else + { + to[0]= FN_CURLIB; /* Put ./ instead of cwd */ + to[1]= FN_LIBCHAR; + to[2]= '\0'; + } + } + } + } + DBUG_PRINT("exit",("to: '%s'",to)); + DBUG_VOID_RETURN; +} /* pack_dirname */ + + +/* + remove unwanted chars from dirname + + SYNOPSIS + cleanup_dirname() + to Store result here + from Dirname to fix. May be same as to + + IMPLEMENTATION + "/../" removes prev dir + "/~/" removes all before ~ + //" is same as "/", except on Win32 at start of a file + "/./" is removed + Unpacks home_dir if "~/.." used + Unpacks current dir if if "./.." used + + RETURN + # length of new name +*/ + +size_t cleanup_dirname(register char *to, const char *from) +{ + reg5 size_t length; + reg2 char * pos; + reg3 char * from_ptr; + reg4 char * start; + char parent[5], /* for "FN_PARENTDIR" */ + buff[FN_REFLEN+1],*end_parentdir; +#ifdef BACKSLASH_MBTAIL + CHARSET_INFO *fs= fs_character_set(); +#endif + DBUG_ENTER("cleanup_dirname"); + DBUG_PRINT("enter",("from: '%s'",from)); + + start=buff; + from_ptr=(char *) from; +#ifdef FN_DEVCHAR + if ((pos=strrchr(from_ptr,FN_DEVCHAR)) != 0) + { /* Skip device part */ + length=(size_t) (pos-from_ptr)+1; + start=strnmov(buff,from_ptr,length); from_ptr+=length; + } +#endif + + parent[0]=FN_LIBCHAR; + length=(size_t) (strmov(parent+1,FN_PARENTDIR)-parent); + for (pos=start ; (*pos= *from_ptr++) != 0 ; pos++) + { +#ifdef BACKSLASH_MBTAIL + uint l; + if (use_mb(fs) && (l= my_ismbchar(fs, from_ptr - 1, from_ptr + 2))) + { + for (l-- ; l ; *++pos= *from_ptr++, l--); + start= pos + 1; /* Don't look inside multi-byte char */ + continue; + } +#endif + if (*pos == '/') + *pos = FN_LIBCHAR; + if (*pos == FN_LIBCHAR) + { + if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0) + { /* If .../../; skip prev */ + pos-=length; + if (pos != start) + { /* not /../ */ + pos--; + if (*pos == FN_HOMELIB && (pos == start || pos[-1] == FN_LIBCHAR)) + { + if (!home_dir) + { + pos+=length+1; /* Don't unpack ~/.. */ + continue; + } + pos=strmov(buff,home_dir)-1; /* Unpacks ~/.. */ + if (*pos == FN_LIBCHAR) + pos--; /* home ended with '/' */ + } + if (*pos == FN_CURLIB && (pos == start || pos[-1] == FN_LIBCHAR)) + { + if (my_getwd(curr_dir,FN_REFLEN,MYF(0))) + { + pos+=length+1; /* Don't unpack ./.. */ + continue; + } + pos=strmov(buff,curr_dir)-1; /* Unpacks ./.. */ + if (*pos == FN_LIBCHAR) + pos--; /* home ended with '/' */ + } + end_parentdir=pos; + while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */ + pos--; + if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0) + { /* Don't remove ~user/ */ + pos=strmov(end_parentdir+1,parent); + *pos=FN_LIBCHAR; + continue; + } + } + } + else if ((size_t) (pos-start) == length-1 && + !bcmp(start,parent+1,length-1)) + start=pos; /* Starts with "../" */ + else if (pos-start > 0 && pos[-1] == FN_LIBCHAR) + { +#ifdef FN_NETWORK_DRIVES + if (pos-start != 1) +#endif + pos--; /* Remove dupplicate '/' */ + } + else if (pos-start > 1 && pos[-1] == FN_CURLIB && pos[-2] == FN_LIBCHAR) + pos-=2; /* Skip /./ */ + else if (pos > buff+1 && pos[-1] == FN_HOMELIB && pos[-2] == FN_LIBCHAR) + { /* Found ..../~/ */ + buff[0]=FN_HOMELIB; + buff[1]=FN_LIBCHAR; + start=buff; pos=buff+1; + } + } + } + (void) strmov(to,buff); + DBUG_PRINT("exit",("to: '%s'",to)); + DBUG_RETURN((size_t) (pos-buff)); +} /* cleanup_dirname */ + + +/* + On system where you don't have symbolic links, the following + code will allow you to create a file: + directory-name.sym that should contain the real path + to the directory. This will be used if the directory name + doesn't exists +*/ + + +my_bool my_use_symdir=0; /* Set this if you want to use symdirs */ + +#ifdef USE_SYMDIR +void symdirget(char *dir) +{ + char buff[FN_REFLEN]; + char *pos=strend(dir); + if (dir[0] && pos[-1] != FN_DEVCHAR && my_access(dir, F_OK)) + { + File file; + size_t length; + char temp= *(--pos); /* May be "/" or "\" */ + strmov(pos,".sym"); + file= my_open(dir, O_RDONLY, MYF(0)); + *pos++=temp; *pos=0; /* Restore old filename */ + if (file >= 0) + { + if ((length= my_read(file, buff, sizeof(buff), MYF(0))) > 0) + { + for (pos= buff + length ; + pos > buff && (iscntrl(pos[-1]) || isspace(pos[-1])) ; + pos --); + + /* Ensure that the symlink ends with the directory symbol */ + if (pos == buff || pos[-1] != FN_LIBCHAR) + *pos++=FN_LIBCHAR; + + strmake(dir,buff, (size_t) (pos-buff)); + } + my_close(file, MYF(0)); + } + } +} +#endif /* USE_SYMDIR */ + + +/** + Convert a directory name to a format which can be compared as strings + + @param to result buffer, FN_REFLEN chars in length; may be == from + @param from 'packed' directory name, in whatever format + @returns size of the normalized name + + @details + - Ensures that last char is FN_LIBCHAR, unless it is FN_DEVCHAR + - Uses cleanup_dirname + + It does *not* expand ~/ (although, see cleanup_dirname). Nor does it do + any case folding. All case-insensitive normalization should be done by + the caller. +*/ + +size_t normalize_dirname(char *to, const char *from) +{ + size_t length; + char buff[FN_REFLEN]; + DBUG_ENTER("normalize_dirname"); + + /* + Despite the name, this actually converts the name to the system's + format (TODO: rip out the non-working VMS stuff and name this + properly). + */ + (void) intern_filename(buff, from); + length= strlen(buff); /* Fix that '/' is last */ + if (length && +#ifdef FN_DEVCHAR + buff[length - 1] != FN_DEVCHAR && +#endif + buff[length - 1] != FN_LIBCHAR && buff[length - 1] != '/') + { + buff[length]= FN_LIBCHAR; + buff[length + 1]= '\0'; + } + + length=cleanup_dirname(to, buff); + + DBUG_RETURN(length); +} + + +/** + Fixes a directory name so that can be used by open() + + @param to Result buffer, FN_REFLEN characters. May be == from + @param from 'Packed' directory name (may contain ~) + + @details + - Uses normalize_dirname() + - Expands ~/... to home_dir/... + - Resolves MySQL's fake "foo.sym" symbolic directory names (if USE_SYMDIR) + - Changes a UNIX filename to system filename (replaces / with \ on windows) + + @returns + Length of new directory name (= length of to) +*/ + +size_t unpack_dirname(char *to, const char *from) +{ + size_t length, h_length; + char buff[FN_REFLEN+1+4],*suffix,*tilde_expansion; + DBUG_ENTER("unpack_dirname"); + + length= normalize_dirname(buff, from); + + if (buff[0] == FN_HOMELIB) + { + suffix=buff+1; tilde_expansion=expand_tilde(&suffix); + if (tilde_expansion) + { + length-= (size_t) (suffix-buff)-1; + if (length+(h_length= strlen(tilde_expansion)) <= FN_REFLEN) + { + if ((h_length > 0) && (tilde_expansion[h_length-1] == FN_LIBCHAR)) + h_length--; + if (buff+h_length < suffix) + bmove(buff+h_length,suffix,length); + else + bmove_upp((uchar*) buff+h_length+length, (uchar*) suffix+length, length); + bmove(buff,tilde_expansion,h_length); + } + } + } +#ifdef USE_SYMDIR + if (my_use_symdir) + symdirget(buff); +#endif + DBUG_RETURN(system_filename(to,buff)); /* Fix for open */ +} /* unpack_dirname */ + + + /* Expand tilde to home or user-directory */ + /* Path is reset to point at FN_LIBCHAR after ~xxx */ + +static char * NEAR_F expand_tilde(char * *path) +{ + if (path[0][0] == FN_LIBCHAR) + return home_dir; /* ~/ expanded to home */ +#ifdef HAVE_GETPWNAM + { + char *str,save; + struct passwd *user_entry; + + if (!(str=strchr(*path,FN_LIBCHAR))) + str=strend(*path); + save= *str; *str= '\0'; + user_entry=getpwnam(*path); + *str=save; + endpwent(); + if (user_entry) + { + *path=str; + return user_entry->pw_dir; + } + } +#endif + return (char *) 0; +} + + +/* + Fix filename so it can be used by open, create + + SYNOPSIS + unpack_filename() + to Store result here. Must be at least of size FN_REFLEN. + from Filename in unix format (with ~) + + RETURN + # length of to + + NOTES + to may be == from + ~ will only be expanded if total length < FN_REFLEN +*/ + + +size_t unpack_filename(char * to, const char *from) +{ + size_t length, n_length, buff_length; + char buff[FN_REFLEN]; + DBUG_ENTER("unpack_filename"); + + length=dirname_part(buff, from, &buff_length);/* copy & convert dirname */ + n_length=unpack_dirname(buff,buff); + if (n_length+strlen(from+length) < FN_REFLEN) + { + (void) strmov(buff+n_length,from+length); + length= system_filename(to,buff); /* Fix to usably filename */ + } + else + length= system_filename(to,from); /* Fix to usably filename */ + DBUG_RETURN(length); +} /* unpack_filename */ + + + /* Convert filename (unix standard) to system standard */ + /* Used before system command's like open(), create() .. */ + /* Returns used length of to; total length should be FN_REFLEN */ + +size_t system_filename(char * to, const char *from) +{ +#ifndef FN_C_BEFORE_DIR + return (size_t) (strmake(to,from,FN_REFLEN-1)-to); +#else /* VMS */ + + /* change 'dev:lib/xxx' to 'dev:[lib]xxx' */ + /* change 'dev:xxx' to 'dev:xxx' */ + /* change './xxx' to 'xxx' */ + /* change './lib/' or lib/ to '[.lib]' */ + /* change '/x/y/z to '[x.y]x' */ + /* change 'dev:/x' to 'dev:[000000]x' */ + + int libchar_found; + size_t length; + char * to_pos,from_pos,pos; + char buff[FN_REFLEN]; + DBUG_ENTER("system_filename"); + + libchar_found=0; + (void) strmov(buff,from); /* If to == from */ + from_pos= buff; + if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */ + { + pos++; + to_pos=strnmov(to,from_pos,(size_t) (pos-from_pos)); + from_pos=pos; + } + else + to_pos=to; + + if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR) + from_pos+=2; /* Skip './' */ + if (strchr(from_pos,FN_LIBCHAR)) + { + *(to_pos++) = FN_C_BEFORE_DIR; + if (strinstr(from_pos,FN_ROOTDIR) == 1) + { + from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */ + if (! strchr(from_pos,FN_LIBCHAR)) + { /* No dir, use [000000] */ + to_pos=strmov(to_pos,FN_C_ROOT_DIR); + libchar_found++; + } + } + else + *(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */ + + while ((pos=strchr(from_pos,FN_LIBCHAR))) + { + if (libchar_found++) + *(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */ + if (strinstr(from_pos,FN_PARENTDIR) == 1 && + from_pos+strlen(FN_PARENTDIR) == pos) + to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */ + else + to_pos=strnmov(to_pos,from_pos,(size_t) (pos-from_pos)); + from_pos=pos+1; + } + *(to_pos++)=FN_C_AFTER_DIR; + } + length= (size_t) (strmov(to_pos,from_pos)-to); + DBUG_PRINT("exit",("name: '%s'",to)); + DBUG_RETURN(length); +#endif +} /* system_filename */ + + + /* Fix a filename to intern (UNIX format) */ + +char *intern_filename(char *to, const char *from) +{ + size_t length, to_length; + char buff[FN_REFLEN]; + if (from == to) + { /* Dirname may destroy from */ + strmov(buff,from); + from=buff; + } + length= dirname_part(to, from, &to_length); /* Copy dirname & fix chars */ + (void) strmov(to + to_length,from+length); + return (to); +} /* intern_filename */ diff --git a/externals/mysql/mysys/mf_path.c b/externals/mysql/mysys/mf_path.c new file mode 100644 index 0000000..d51cac7 --- /dev/null +++ b/externals/mysql/mysys/mf_path.c @@ -0,0 +1,123 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + +static char *find_file_in_path(char *to,const char *name); + + /* Finds where program can find it's files. + pre_pathname is found by first locking at progname (argv[0]). + if progname contains path the path is returned. + else if progname is found in path, return it + else if progname is given and POSIX environment variable "_" is set + then path is taken from "_". + If filename doesn't contain a path append MY_BASEDIR_VERSION or + MY_BASEDIR if defined, else append "/my/running". + own_path_name_part is concatinated to result. + my_path puts result in to and returns to */ + +char * my_path(char * to, const char *progname, + const char *own_pathname_part) +{ + char *start, *end, *prog; + size_t to_length; + DBUG_ENTER("my_path"); + + start=to; /* Return this */ + if (progname && (dirname_part(to, progname, &to_length) || + find_file_in_path(to,progname) || + ((prog=getenv("_")) != 0 && + dirname_part(to, prog, &to_length)))) + { + (void) intern_filename(to,to); + if (!test_if_hard_path(to)) + { + if (!my_getwd(curr_dir,FN_REFLEN,MYF(0))) + bchange((uchar*) to, 0, (uchar*) curr_dir, strlen(curr_dir), strlen(to)+1); + } + } + else + { + if ((end = getenv("MY_BASEDIR_VERSION")) == 0 && + (end = getenv("MY_BASEDIR")) == 0) + { +#ifdef DEFAULT_BASEDIR + end= (char*) DEFAULT_BASEDIR; +#else + end= (char*) "/my/"; +#endif + } + (void) intern_filename(to,end); + to=strend(to); + if (to != start && to[-1] != FN_LIBCHAR) + *to++ = FN_LIBCHAR; + (void) strmov(to,own_pathname_part); + } + DBUG_PRINT("exit",("to: '%s'",start)); + DBUG_RETURN(start); +} /* my_path */ + + + /* test if file without filename is found in path */ + /* Returns to if found and to has dirpart if found, else NullS */ + +#if defined(__WIN__) +#define F_OK 0 +#define PATH_SEP ';' +#define PROGRAM_EXTENSION ".exe" +#elif defined(__NETWARE__) +#define PATH_SEP ';' +#define PROGRAM_EXTENSION ".nlm" +#else +#define PATH_SEP ':' +#endif + +static char *find_file_in_path(char *to, const char *name) +{ + char *path,*pos,dir[2]; + const char *ext=""; + + if (!(path=getenv("PATH"))) + return NullS; + dir[0]=FN_LIBCHAR; dir[1]=0; +#ifdef PROGRAM_EXTENSION + if (!fn_ext(name)[0]) + ext=PROGRAM_EXTENSION; +#endif + + for (pos=path ; (pos=strchr(pos,PATH_SEP)) ; path= ++pos) + { + if (path != pos) + { + strxmov(strnmov(to,path,(uint) (pos-path)),dir,name,ext,NullS); + if (!access(to,F_OK)) + { + to[(uint) (pos-path)+1]=0; /* Return path only */ + return to; + } + } + } +#ifdef __WIN__ + to[0]=FN_CURLIB; + strxmov(to+1,dir,name,ext,NullS); + if (!access(to,F_OK)) /* Test in current dir */ + { + to[2]=0; /* Leave ".\" */ + return to; + } +#endif + return NullS; /* File not found */ +} diff --git a/externals/mysql/mysys/mf_qsort.c b/externals/mysql/mysys/mf_qsort.c new file mode 100644 index 0000000..4b3ecb6 --- /dev/null +++ b/externals/mysql/mysys/mf_qsort.c @@ -0,0 +1,216 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + qsort implementation optimized for comparison of pointers + Inspired by the qsort implementations by Douglas C. Schmidt, + and Bentley & McIlroy's "Engineering a Sort Function". +*/ + + +#include "mysys_priv.h" +#ifndef SCO +#include +#endif + +/* We need to use qsort with 2 different compare functions */ +#ifdef QSORT_EXTRA_CMP_ARGUMENT +#define CMP(A,B) ((*cmp)(cmp_argument,(A),(B))) +#else +#define CMP(A,B) ((*cmp)((A),(B))) +#endif + +#define SWAP(A, B, size,swap_ptrs) \ +do { \ + if (swap_ptrs) \ + { \ + reg1 char **a = (char**) (A), **b = (char**) (B); \ + char *tmp = *a; *a++ = *b; *b++ = tmp; \ + } \ + else \ + { \ + reg1 char *a = (A), *b = (B); \ + reg3 char *end= a+size; \ + do \ + { \ + char tmp = *a; *a++ = *b; *b++ = tmp; \ + } while (a < end); \ + } \ +} while (0) + +/* Put the median in the middle argument */ +#define MEDIAN(low, mid, high) \ +{ \ + if (CMP(high,low) < 0) \ + SWAP(high, low, size, ptr_cmp); \ + if (CMP(mid, low) < 0) \ + SWAP(mid, low, size, ptr_cmp); \ + else if (CMP(high, mid) < 0) \ + SWAP(mid, high, size, ptr_cmp); \ +} + +/* The following node is used to store ranges to avoid recursive calls */ + +typedef struct st_stack +{ + char *low,*high; +} stack_node; + +#define PUSH(LOW,HIGH) {stack_ptr->low = LOW; stack_ptr++->high = HIGH;} +#define POP(LOW,HIGH) {LOW = (--stack_ptr)->low; HIGH = stack_ptr->high;} + +/* The following stack size is enough for ulong ~0 elements */ +#define STACK_SIZE (8 * sizeof(unsigned long int)) +#define THRESHOLD_FOR_INSERT_SORT 10 +#if defined(QSORT_TYPE_IS_VOID) +#define SORT_RETURN return +#else +#define SORT_RETURN return 0 +#endif + +/**************************************************************************** +** 'standard' quicksort with the following extensions: +** +** Can be compiled with the qsort2_cmp compare function +** Store ranges on stack to avoid recursion +** Use insert sort on small ranges +** Optimize for sorting of pointers (used often by MySQL) +** Use median comparison to find partition element +*****************************************************************************/ + +#ifdef QSORT_EXTRA_CMP_ARGUMENT +qsort_t my_qsort2(void *base_ptr, size_t count, size_t size, qsort2_cmp cmp, + void *cmp_argument) +#else +qsort_t my_qsort(void *base_ptr, size_t count, size_t size, qsort_cmp cmp) +#endif +{ + char *low, *high, *pivot; + stack_node stack[STACK_SIZE], *stack_ptr; + my_bool ptr_cmp; + /* Handle the simple case first */ + /* This will also make the rest of the code simpler */ + if (count <= 1) + SORT_RETURN; + + low = (char*) base_ptr; + high = low+ size * (count - 1); + stack_ptr = stack + 1; +#ifdef HAVE_purify + /* The first element in the stack will be accessed for the last POP */ + stack[0].low=stack[0].high=0; +#endif + pivot = (char *) my_alloca((int) size); + ptr_cmp= size == sizeof(char*) && !((low - (char*) 0)& (sizeof(char*)-1)); + + /* The following loop sorts elements between high and low */ + do + { + char *low_ptr, *high_ptr, *mid; + + count=((size_t) (high - low) / size)+1; + /* If count is small, then an insert sort is faster than qsort */ + if (count < THRESHOLD_FOR_INSERT_SORT) + { + for (low_ptr = low + size; low_ptr <= high; low_ptr += size) + { + char *ptr; + for (ptr = low_ptr; ptr > low && CMP(ptr - size, ptr) > 0; + ptr -= size) + SWAP(ptr, ptr - size, size, ptr_cmp); + } + POP(low, high); + continue; + } + + /* Try to find a good middle element */ + mid= low + size * (count >> 1); + if (count > 40) /* Must be bigger than 24 */ + { + size_t step = size* (count / 8); + MEDIAN(low, low + step, low+step*2); + MEDIAN(mid - step, mid, mid+step); + MEDIAN(high - 2 * step, high-step, high); + /* Put best median in 'mid' */ + MEDIAN(low+step, mid, high-step); + low_ptr = low; + high_ptr = high; + } + else + { + MEDIAN(low, mid, high); + /* The low and high argument are already in sorted against 'pivot' */ + low_ptr = low + size; + high_ptr = high - size; + } + memcpy(pivot, mid, size); + + do + { + while (CMP(low_ptr, pivot) < 0) + low_ptr += size; + while (CMP(pivot, high_ptr) < 0) + high_ptr -= size; + + if (low_ptr < high_ptr) + { + SWAP(low_ptr, high_ptr, size, ptr_cmp); + low_ptr += size; + high_ptr -= size; + } + else + { + if (low_ptr == high_ptr) + { + low_ptr += size; + high_ptr -= size; + } + break; + } + } + while (low_ptr <= high_ptr); + + /* + Prepare for next iteration. + Skip partitions of size 1 as these doesn't have to be sorted + Push the larger partition and sort the smaller one first. + This ensures that the stack is keept small. + */ + + if ((int) (high_ptr - low) <= 0) + { + if ((int) (high - low_ptr) <= 0) + { + POP(low, high); /* Nothing more to sort */ + } + else + low = low_ptr; /* Ignore small left part. */ + } + else if ((int) (high - low_ptr) <= 0) + high = high_ptr; /* Ignore small right part. */ + else if ((high_ptr - low) > (high - low_ptr)) + { + PUSH(low, high_ptr); /* Push larger left part */ + low = low_ptr; + } + else + { + PUSH(low_ptr, high); /* Push larger right part */ + high = high_ptr; + } + } while (stack_ptr > stack); + my_afree(pivot); + SORT_RETURN; +} diff --git a/externals/mysql/mysys/mf_qsort2.c b/externals/mysql/mysys/mf_qsort2.c new file mode 100644 index 0000000..ca2bd1a --- /dev/null +++ b/externals/mysql/mysys/mf_qsort2.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* qsort that sends one extra argument to the compare subrutine */ + +#define QSORT_EXTRA_CMP_ARGUMENT +#include "mf_qsort.c" diff --git a/externals/mysql/mysys/mf_radix.c b/externals/mysql/mysys/mf_radix.c new file mode 100644 index 0000000..582ca76 --- /dev/null +++ b/externals/mysql/mysys/mf_radix.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Radixsort for pointers to fixed length strings. + A very quick sort for not to long (< 20 char) strings. + Neads a extra buffers of number_of_elements pointers but is + 2-3 times faster than quicksort +*/ + +#include "mysys_priv.h" +#include + + /* Radixsort */ + +void radixsort_for_str_ptr(uchar **base, uint number_of_elements, size_t size_of_element, uchar **buffer) +{ + uchar **end,**ptr,**buffer_ptr; + uint32 *count_ptr,*count_end,count[256]; + int pass; + + end=base+number_of_elements; count_end=count+256; + for (pass=(int) size_of_element-1 ; pass >= 0 ; pass--) + { + bzero((uchar*) count,sizeof(uint32)*256); + for (ptr= base ; ptr < end ; ptr++) + count[ptr[0][pass]]++; + if (count[0] == number_of_elements) + goto next; + for (count_ptr=count+1 ; count_ptr < count_end ; count_ptr++) + { + if (*count_ptr == number_of_elements) + goto next; + (*count_ptr)+= *(count_ptr-1); + } + for (ptr= end ; ptr-- != base ;) + buffer[--count[ptr[0][pass]]]= *ptr; + for (ptr=base, buffer_ptr=buffer ; ptr < end ;) + (*ptr++) = *buffer_ptr++; + next:; + } +} diff --git a/externals/mysql/mysys/mf_same.c b/externals/mysql/mysys/mf_same.c new file mode 100644 index 0000000..6738dc8 --- /dev/null +++ b/externals/mysql/mysys/mf_same.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Kopierar biblioteksstrukturen och extensionen fr}n ett filnamn */ + +#include "mysys_priv.h" +#include + + /* + Copy directory and/or extension between filenames. + (For the meaning of 'flag', check mf_format.c) + 'to' may be equal to 'name'. + Returns 'to'. + */ + +char * fn_same(char *to, const char *name, int flag) +{ + char dev[FN_REFLEN]; + const char *ext; + size_t dev_length; + DBUG_ENTER("fn_same"); + DBUG_PRINT("enter",("to: %s name: %s flag: %d",to,name,flag)); + + if ((ext=strrchr(name+dirname_part(dev, name, &dev_length),FN_EXTCHAR)) == 0) + ext=""; + + DBUG_RETURN(fn_format(to,to,dev,ext,flag)); +} /* fn_same */ diff --git a/externals/mysql/mysys/mf_sort.c b/externals/mysql/mysys/mf_sort.c new file mode 100644 index 0000000..686ebbc --- /dev/null +++ b/externals/mysql/mysys/mf_sort.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Sort of string pointers in string-order with radix or qsort */ + +#include "mysys_priv.h" +#include + +void my_string_ptr_sort(uchar *base, uint items, size_t size) +{ +#if INT_MAX > 65536L + uchar **ptr=0; + + if (size <= 20 && items >= 1000 && items < 100000 && + (ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0)))) + { + radixsort_for_str_ptr((uchar**) base,items,size,ptr); + my_free((uchar*) ptr,MYF(0)); + } + else +#endif + { + if (size && items) + { + my_qsort2(base,items, sizeof(uchar*), get_ptr_compare(size), + (void*) &size); + } + } +} diff --git a/externals/mysql/mysys/mf_soundex.c b/externals/mysql/mysys/mf_soundex.c new file mode 100644 index 0000000..fe30d8c --- /dev/null +++ b/externals/mysql/mysys/mf_soundex.c @@ -0,0 +1,105 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/**************************************************************** +* SOUNDEX ALGORITHM in C * +* * +* The basic Algorithm source is taken from EDN Nov. * +* 14, 1985 pg. 36. * +* * +* As a test Those in Illinois will find that the * +* first group of numbers in their drivers license * +* number is the soundex number for their last name. * +* * +* RHW PC-IBBS ID. #1230 * +* * +* As an extension if remove_garbage is set then all non- * +* alpha characters are skipped * +* * +* Note, that this implementation corresponds to the * +* original version of the algorithm, not to the more * +* popular "enhanced" version, described by Knuth. * +****************************************************************/ + +#include "mysys_priv.h" +#include +#include "my_static.h" + +static char get_scode(CHARSET_INFO * cs, char **ptr,pbool remove_garbage); + + /* outputed string is 4 byte long */ + /* out_pntr can be == in_pntr */ + +void soundex(CHARSET_INFO * cs,register char * out_pntr, char * in_pntr, + pbool remove_garbage) +{ + char ch,last_ch; + reg3 char * end; + register uchar *map=cs->to_upper; + + if (remove_garbage) + { + while (*in_pntr && !my_isalpha(cs,*in_pntr)) /* Skip pre-space */ + in_pntr++; + } + *out_pntr++ = map[(uchar)*in_pntr]; /* Copy first letter */ + last_ch = get_scode(cs,&in_pntr,0); /* code of the first letter */ + /* for the first 'double-letter */ + /* check. */ + end=out_pntr+3; /* Loop on input letters until */ + /* end of input (null) or output */ + /* letter code count = 3 */ + + in_pntr++; + while (out_pntr < end && (ch = get_scode(cs,&in_pntr,remove_garbage)) != 0) + { + in_pntr++; + if ((ch != '0') && (ch != last_ch)) /* if not skipped or double */ + { + *out_pntr++ = ch; /* letter, copy to output */ + } /* for next double-letter check */ + last_ch = ch; /* save code of last input letter */ + } + while (out_pntr < end) + *out_pntr++ = '0'; + *out_pntr=0; /* end string */ + return; +} /* soundex */ + + + /* + If alpha, map input letter to soundex code. + If not alpha and remove_garbage is set then skip to next char + else return 0 + */ + +static char get_scode(CHARSET_INFO * cs,char **ptr, pbool remove_garbage) +{ + uchar ch; + + if (remove_garbage) + { + while (**ptr && !my_isalpha(cs,**ptr)) + (*ptr)++; + } + ch=my_toupper(cs,**ptr); + if (ch < 'A' || ch > 'Z') + { + if (my_isalpha(cs,ch)) /* If extended alfa (country spec) */ + return '0'; /* threat as vokal */ + return 0; /* Can't map */ + } + return(soundex_map[ch-'A']); +} /* get_scode */ diff --git a/externals/mysql/mysys/mf_strip.c b/externals/mysql/mysys/mf_strip.c new file mode 100644 index 0000000..b33620b --- /dev/null +++ b/externals/mysql/mysys/mf_strip.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* T|mmer en str{ng p{ slut_space */ + +#include "mysys_priv.h" + +/* + strip_sp(char * str) + Strips end-space from string and returns new length. +*/ + +size_t strip_sp(register char * str) +{ + reg2 char * found; + reg3 char * start; + + start=found=str; + + while (*str) + { + if (*str != ' ') + { + while (*++str && *str != ' ') {}; + if (!*str) + return (size_t) (str-start); /* Return stringlength */ + } + found=str; + while (*++str == ' ') {}; + } + *found= '\0'; /* Stripp at first space */ + return (size_t) (found-start); +} /* strip_sp */ diff --git a/externals/mysql/mysys/mf_tempdir.c b/externals/mysql/mysys/mf_tempdir.c new file mode 100644 index 0000000..d6492c9 --- /dev/null +++ b/externals/mysql/mysys/mf_tempdir.c @@ -0,0 +1,95 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + +#if defined( __WIN__) || defined(__NETWARE__) +#define DELIM ';' +#else +#define DELIM ':' +#endif + +my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) +{ + char *end, *copy; + char buff[FN_REFLEN]; + DBUG_ENTER("init_tmpdir"); + DBUG_PRINT("enter", ("pathlist: %s", pathlist ? pathlist : "NULL")); + + pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST); + if (my_init_dynamic_array(&tmpdir->full_list, sizeof(char*), 1, 5)) + goto err; + if (!pathlist || !pathlist[0]) + { + /* Get default temporary directory */ + pathlist=getenv("TMPDIR"); /* Use this if possible */ +#if defined( __WIN__) || defined(__NETWARE__) + if (!pathlist) + pathlist=getenv("TEMP"); + if (!pathlist) + pathlist=getenv("TMP"); +#endif + if (!pathlist || !pathlist[0]) + pathlist=(char*) P_tmpdir; + } + do + { + uint length; + end=strcend(pathlist, DELIM); + strmake(buff, pathlist, (uint) (end-pathlist)); + length= cleanup_dirname(buff, buff); + if (!(copy= my_strndup(buff, length, MYF(MY_WME))) || + insert_dynamic(&tmpdir->full_list, (uchar*) ©)) + DBUG_RETURN(TRUE); + pathlist=end+1; + } + while (*end); + freeze_size(&tmpdir->full_list); + tmpdir->list=(char **)tmpdir->full_list.buffer; + tmpdir->max=tmpdir->full_list.elements-1; + tmpdir->cur=0; + DBUG_RETURN(FALSE); + +err: + delete_dynamic(&tmpdir->full_list); /* Safe to free */ + pthread_mutex_destroy(&tmpdir->mutex); + DBUG_RETURN(TRUE); +} + + +char *my_tmpdir(MY_TMPDIR *tmpdir) +{ + char *dir; + if (!tmpdir->max) + return tmpdir->list[0]; + pthread_mutex_lock(&tmpdir->mutex); + dir=tmpdir->list[tmpdir->cur]; + tmpdir->cur= (tmpdir->cur == tmpdir->max) ? 0 : tmpdir->cur+1; + pthread_mutex_unlock(&tmpdir->mutex); + return dir; +} + +void free_tmpdir(MY_TMPDIR *tmpdir) +{ + uint i; + if (!tmpdir->full_list.elements) + return; + for (i=0; i<=tmpdir->max; i++) + my_free(tmpdir->list[i], MYF(0)); + delete_dynamic(&tmpdir->full_list); + pthread_mutex_destroy(&tmpdir->mutex); +} + diff --git a/externals/mysql/mysys/mf_tempfile.c b/externals/mysql/mysys/mf_tempfile.c new file mode 100644 index 0000000..4001621 --- /dev/null +++ b/externals/mysql/mysys/mf_tempfile.c @@ -0,0 +1,189 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include +#include "my_static.h" +#include "mysys_err.h" +#include +#ifdef HAVE_PATHS_H +#include +#endif + + + +/* + @brief + Create a temporary file with unique name in a given directory + + @details + create_temp_file + to pointer to buffer where temporary filename will be stored + dir directory where to create the file + prefix prefix the filename with this + mode Flags to use for my_create/my_open + MyFlags Magic flags + + @return + File descriptor of opened file if success + -1 and sets errno if fails. + + @note + The behaviour of this function differs a lot between + implementation, it's main use is to generate a file with + a name that does not already exist. + + When passing O_TEMPORARY flag in "mode" the file should + be automatically deleted + + The implementation using mkstemp should be considered the + reference implementation when adding a new or modifying an + existing one + +*/ + +File create_temp_file(char *to, const char *dir, const char *prefix, + int mode __attribute__((unused)), + myf MyFlags __attribute__((unused))) +{ + File file= -1; +#ifdef __WIN__ + TCHAR path_buf[MAX_PATH-14]; +#endif + + DBUG_ENTER("create_temp_file"); + DBUG_PRINT("enter", ("dir: %s, prefix: %s", dir, prefix)); +#if defined (__WIN__) + + /* + Use GetTempPath to determine path for temporary files. + This is because the documentation for GetTempFileName + has the following to say about this parameter: + "If this parameter is NULL, the function fails." + */ + if (!dir) + { + if(GetTempPath(sizeof(path_buf), path_buf) > 0) + dir = path_buf; + } + /* + Use GetTempFileName to generate a unique filename, create + the file and release it's handle + - uses up to the first three letters from prefix + */ + if (GetTempFileName(dir, prefix, 0, to) == 0) + DBUG_RETURN(-1); + + DBUG_PRINT("info", ("name: %s", to)); + + /* + Open the file without the "open only if file doesn't already exist" + since the file has already been created by GetTempFileName + */ + if ((file= my_open(to, (mode & ~O_EXCL), MyFlags)) < 0) + { + /* Open failed, remove the file created by GetTempFileName */ + int tmp= my_errno; + (void) my_delete(to, MYF(0)); + my_errno= tmp; + } + +#elif defined(_ZTC__) + if (!dir) + dir=getenv("TMPDIR"); + if ((res=tempnam((char*) dir,(char *) prefix))) + { + strmake(to,res,FN_REFLEN-1); + (*free)(res); + file=my_create(to, 0, mode | O_EXCL | O_NOFOLLOW, MyFlags); + } +#elif defined(HAVE_MKSTEMP) && !defined(__NETWARE__) + { + char prefix_buff[30]; + uint pfx_len; + File org_file; + + pfx_len= (uint) (strmov(strnmov(prefix_buff, + prefix ? prefix : "tmp.", + sizeof(prefix_buff)-7),"XXXXXX") - + prefix_buff); + if (!dir && ! (dir =getenv("TMPDIR"))) + dir=P_tmpdir; + if (strlen(dir)+ pfx_len > FN_REFLEN-2) + { + errno=my_errno= ENAMETOOLONG; + DBUG_RETURN(file); + } + strmov(convert_dirname(to,dir,NullS),prefix_buff); + org_file=mkstemp(to); + if (mode & O_TEMPORARY) + (void) my_delete(to, MYF(MY_WME | ME_NOINPUT)); + file=my_register_filename(org_file, to, FILE_BY_MKSTEMP, + EE_CANTCREATEFILE, MyFlags); + /* If we didn't manage to register the name, remove the temp file */ + if (org_file >= 0 && file < 0) + { + int tmp=my_errno; + close(org_file); + (void) my_delete(to, MYF(MY_WME | ME_NOINPUT)); + my_errno=tmp; + } + } +#elif defined(HAVE_TEMPNAM) + { +#if !defined(__NETWARE__) + extern char **environ; +#endif + + char *res,**old_env,*temp_env[1]; + if (dir && !dir[0]) + { /* Change empty string to current dir */ + to[0]= FN_CURLIB; + to[1]= 0; + dir=to; + } +#if !defined(__NETWARE__) + old_env= (char**) environ; + if (dir) + { /* Don't use TMPDIR if dir is given */ + environ=(const char**) temp_env; + temp_env[0]=0; + } +#endif + if ((res=tempnam((char*) dir, (char*) prefix))) + { + strmake(to,res,FN_REFLEN-1); + (*free)(res); + file=my_create(to,0, + (int) (O_RDWR | O_BINARY | O_TRUNC | O_EXCL | O_NOFOLLOW | + O_TEMPORARY | O_SHORT_LIVED), + MYF(MY_WME)); + + } + else + { + DBUG_PRINT("error",("Got error: %d from tempnam",errno)); + } +#if !defined(__NETWARE__) + environ=(const char**) old_env; +#endif + } +#else +#error No implementation found for create_temp_file +#endif + if (file >= 0) + thread_safe_increment(my_tmp_file_created,&THR_LOCK_open); + DBUG_RETURN(file); +} diff --git a/externals/mysql/mysys/mf_unixpath.c b/externals/mysql/mysys/mf_unixpath.c new file mode 100644 index 0000000..75f8de1 --- /dev/null +++ b/externals/mysql/mysys/mf_unixpath.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + + /* convert filename to unix style filename */ + /* If MSDOS converts '\' to '/' */ + +void to_unix_path(char * to __attribute__((unused))) +{ +#if FN_LIBCHAR != '/' + { + to--; + while ((to=strchr(to+1,FN_LIBCHAR)) != 0) + *to='/'; + } +#endif +} diff --git a/externals/mysql/mysys/mf_util.c b/externals/mysql/mysys/mf_util.c new file mode 100644 index 0000000..248b72b --- /dev/null +++ b/externals/mysql/mysys/mf_util.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Utilities with are missing on some systems */ + +#include "mysys_priv.h" +#ifdef __ZTC__ +#include +#endif + +#ifdef __ZTC__ + + /* On ZORTECH C we don't have a getpid() call */ + +int getpid(void) +{ + return (int) _psp; +} + +#ifndef M_IC80386 + + /* Define halloc and hfree in as in MSC */ + +void * __CDECL halloc(long count,size_t length) +{ + return (void*) MK_FP(dos_alloc((uint) ((count*length+15) >> 4)),0); +} + +void __CDECL hfree(void *ptr) +{ + dos_free(FP_SEG(ptr)); +} + +#endif /* M_IC80386 */ +#endif /* __ZTC__ */ diff --git a/externals/mysql/mysys/mf_wcomp.c b/externals/mysql/mysys/mf_wcomp.c new file mode 100644 index 0000000..4786537 --- /dev/null +++ b/externals/mysql/mysys/mf_wcomp.c @@ -0,0 +1,89 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Funktions for comparing with wild-cards */ + +#include "mysys_priv.h" + + /* Test if a string is "comparable" to a wild-card string */ + /* returns 0 if the strings are "comparable" */ + +char wild_many='*'; +char wild_one='?'; +char wild_prefix=0; /* QQ this can potentially cause a SIGSEGV */ + +int wild_compare(register const char *str, register const char *wildstr, + pbool str_is_pattern) +{ + char cmp; + DBUG_ENTER("wild_compare"); + + while (*wildstr) + { + while (*wildstr && *wildstr != wild_many && *wildstr != wild_one) + { + if (*wildstr == wild_prefix && wildstr[1]) + { + wildstr++; + if (str_is_pattern && *str++ != wild_prefix) + DBUG_RETURN(1); + } + if (*wildstr++ != *str++) + DBUG_RETURN(1); + } + if (! *wildstr ) + DBUG_RETURN(*str != 0); + if (*wildstr++ == wild_one) + { + if (! *str || (str_is_pattern && *str == wild_many)) + DBUG_RETURN(1); /* One char; skip */ + if (*str++ == wild_prefix && str_is_pattern && *str) + str++; + } + else + { /* Found '*' */ + while (str_is_pattern && *str == wild_many) + str++; + for (; *wildstr == wild_many || *wildstr == wild_one; wildstr++) + if (*wildstr == wild_many) + { + while (str_is_pattern && *str == wild_many) + str++; + } + else + { + if (str_is_pattern && *str == wild_prefix && str[1]) + str+=2; + else if (! *str++) + DBUG_RETURN (1); + } + if (!*wildstr) + DBUG_RETURN(0); /* '*' as last char: OK */ + if ((cmp= *wildstr) == wild_prefix && wildstr[1] && !str_is_pattern) + cmp=wildstr[1]; + for (;;str++) + { + while (*str && *str != cmp) + str++; + if (!*str) + DBUG_RETURN (1); + if (wild_compare(str,wildstr,str_is_pattern) == 0) + DBUG_RETURN (0); + } + /* We will never come here */ + } + } + DBUG_RETURN (*str != 0); +} /* wild_compare */ diff --git a/externals/mysql/mysys/mf_wfile.c b/externals/mysql/mysys/mf_wfile.c new file mode 100644 index 0000000..f98d348 --- /dev/null +++ b/externals/mysql/mysys/mf_wfile.c @@ -0,0 +1,124 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Functions for finding files with wildcards */ + +/* + The following file-name-test is supported: + - "name [[,] name...] ; Matches any of used filenames. + Each name can have "*" and/or "?" + wild-cards. + - [wildspec [,]] !wildspec2 ; File that matches wildspec and not + wildspec2. +*/ + +#include "mysys_priv.h" +#include + + /* Store wildcard-string in a easyer format */ + +WF_PACK *wf_comp(char * str) +{ + uint ant; + int not_pos; + register char * pos; + char * buffer; + WF_PACK *ret; + DBUG_ENTER("wf_comp"); + + not_pos= -1; /* Skip space and '!' in front */ + while (*str == ' ') + str++; + if (*str == '!') + { + not_pos=0; + while (*++str == ' ') {}; + } + if (*str == 0) /* Empty == everything */ + DBUG_RETURN((WF_PACK *) NULL); + + ant=1; /* Count filespecs */ + for (pos=str ; *pos ; pos++) + ant+= test(*pos == ' ' || *pos == ','); + + if ((ret= (WF_PACK*) my_malloc((uint) ant*(sizeof(char **)+2)+ + sizeof(WF_PACK)+ (uint) strlen(str)+1, + MYF(MY_WME))) + == 0) + DBUG_RETURN((WF_PACK *) NULL); + ret->wild= (char **) (ret+1); + buffer= (char *) (ret->wild+ant); + + ant=0; + for (pos=str ; *pos ; str= pos) + { + ret->wild[ant++]=buffer; + while (*pos != ' ' && *pos != ',' && *pos != '!' && *pos) + *buffer++ = *pos++; + + *buffer++ = '\0'; + while (*pos == ' ' || *pos == ',' || *pos == '!' ) + if (*pos++ == '!' && not_pos <0) + not_pos=(int) ant; + } + + ret->wilds=ant; + if (not_pos <0) + ret->not_pos=ant; + else + ret->not_pos=(uint) not_pos; + + DBUG_PRINT("exit",("antal: %d not_pos: %d",ret->wilds,ret->not_pos)); + DBUG_RETURN(ret); +} /* wf_comp */ + + + /* Test if a given filename is matched */ + +int wf_test(register WF_PACK *wf_pack, register const char *name) +{ + reg2 uint i; + reg3 uint not_pos; + DBUG_ENTER("wf_test"); + + if (! wf_pack || wf_pack->wilds == 0) + DBUG_RETURN(0); /* Everything goes */ + + not_pos=wf_pack->not_pos; + for (i=0 ; i < not_pos; i++) + if (wild_compare(name,wf_pack->wild[i],0) == 0) + goto found; + if (i) + DBUG_RETURN(1); /* No-match */ + +found: +/* Test that it isn't in not-list */ + + for (i=not_pos ; i < wf_pack->wilds; i++) + if (wild_compare(name,wf_pack->wild[i],0) == 0) + DBUG_RETURN(1); + DBUG_RETURN(0); +} /* wf_test */ + + + /* We need this because program don't know with malloc we used */ + +void wf_end(WF_PACK *buffer) +{ + DBUG_ENTER("wf_end"); + if (buffer) + my_free((uchar*) buffer,MYF(0)); + DBUG_VOID_RETURN; +} /* wf_end */ diff --git a/externals/mysql/mysys/mulalloc.c b/externals/mysql/mysys/mulalloc.c new file mode 100644 index 0000000..f4ca3d9 --- /dev/null +++ b/externals/mysql/mysys/mulalloc.c @@ -0,0 +1,63 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + +/* + Malloc many pointers at the same time + Only ptr1 can be free'd, and doing this will free all + the memory allocated. ptr2, etc all point inside big allocated + memory area. + + SYNOPSIS + my_multi_malloc() + myFlags Flags + ptr1, length1 Multiple arguments terminated by null ptr + ptr2, length2 ... + ... + NULL +*/ + +void* my_multi_malloc(myf myFlags, ...) +{ + va_list args; + char **ptr,*start,*res; + size_t tot_length,length; + DBUG_ENTER("my_multi_malloc"); + + va_start(args,myFlags); + tot_length=0; + while ((ptr=va_arg(args, char **))) + { + length=va_arg(args,uint); + tot_length+=ALIGN_SIZE(length); + } + va_end(args); + + if (!(start=(char *) my_malloc(tot_length,myFlags))) + DBUG_RETURN(0); /* purecov: inspected */ + + va_start(args,myFlags); + res=start; + while ((ptr=va_arg(args, char **))) + { + *ptr=res; + length=va_arg(args,uint); + res+=ALIGN_SIZE(length); + } + va_end(args); + DBUG_RETURN((void*) start); +} diff --git a/externals/mysql/mysys/my_access.c b/externals/mysql/mysys/my_access.c new file mode 100644 index 0000000..210946d --- /dev/null +++ b/externals/mysql/mysys/my_access.c @@ -0,0 +1,201 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + +#ifdef __WIN__ + +/* + Check a file or path for accessability. + + SYNOPSIS + file_access() + path Path to file + amode Access method + + DESCRIPTION + This function wraps the normal access method because the access + available in MSVCRT> +reports that filenames such as LPT1 and + COM1 are valid (they are but should not be so for us). + + RETURN VALUES + 0 ok + -1 error (We use -1 as my_access is mapped to access on other platforms) +*/ + +int my_access(const char *path, int amode) +{ + WIN32_FILE_ATTRIBUTE_DATA fileinfo; + BOOL result; + + result= GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo); + if (! result || + (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) && (amode & W_OK)) + { + my_errno= errno= EACCES; + return -1; + } + return 0; +} + +#endif /* __WIN__ */ + + +/* + List of file names that causes problem on windows + + NOTE that one can also not have file names of type CON.TXT + + NOTE: it is important to keep "CLOCK$" on the first place, + we skip it in check_if_legal_tablename. +*/ +static const char *reserved_names[]= +{ + "CLOCK$", + "CON", "PRN", "AUX", "NUL", + "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", + "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", + NullS +}; + +#define MAX_RESERVED_NAME_LENGTH 6 + + +/* + Looks up a null-terminated string in a list, + case insensitively. + + SYNOPSIS + str_list_find() + list list of items + str item to find + + RETURN + 0 ok + 1 reserved file name +*/ +static int str_list_find(const char **list, const char *str) +{ + const char **name; + for (name= list; *name; name++) + { + if (!my_strcasecmp(&my_charset_latin1, *name, str)) + return 1; + } + return 0; +} + + +/* + A map for faster reserved_names lookup, + helps to avoid loops in many cases. + 1 - can be the first letter + 2 - can be the second letter + 4 - can be the third letter +*/ +static char reserved_map[256]= +{ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* !"#$%&'()*+,-./ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0123456789:;<=>? */ + 0,1,0,1,0,0,0,0,0,0,0,0,7,4,5,2, /* @ABCDEFGHIJKLMNO */ + 3,0,2,0,4,2,0,0,4,0,0,0,0,0,0,0, /* PQRSTUVWXYZ[\]^_ */ + 0,1,0,1,0,0,0,0,0,0,0,0,7,4,5,2, /* bcdefghijklmno */ + 3,0,2,0,4,2,0,0,4,0,0,0,0,0,0,0, /* pqrstuvwxyz{|}~. */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* ................ */ +}; + + +/* + Check if a table name may cause problems + + SYNOPSIS + check_if_legal_tablename + name Table name (without any extensions) + + DESCRIPTION + We don't check 'CLOCK$' because dollar sign is encoded as @0024, + making table file name 'CLOCK@0024', which is safe. + This is why we start lookup from the second element + (i.e. &reserver_name[1]) + + RETURN + 0 ok + 1 reserved file name +*/ + +int check_if_legal_tablename(const char *name) +{ + DBUG_ENTER("check_if_legal_tablename"); + DBUG_RETURN((reserved_map[(uchar) name[0]] & 1) && + (reserved_map[(uchar) name[1]] & 2) && + (reserved_map[(uchar) name[2]] & 4) && + str_list_find(&reserved_names[1], name)); +} + + +#if defined(__WIN__) || defined(__EMX__) + + +/* + Check if a path will access a reserverd file name that may cause problems + + SYNOPSIS + check_if_legal_filename + path Path to file + + RETURN + 0 ok + 1 reserved file name +*/ + +int check_if_legal_filename(const char *path) +{ + const char *end; + const char **reserved_name; + DBUG_ENTER("check_if_legal_filename"); + + path+= dirname_length(path); /* To start of filename */ + if (!(end= strchr(path, FN_EXTCHAR))) + end= strend(path); + if (path == end || (uint) (end - path) > MAX_RESERVED_NAME_LENGTH) + DBUG_RETURN(0); /* Simplify inner loop */ + + for (reserved_name= reserved_names; *reserved_name; reserved_name++) + { + const char *reserved= *reserved_name; /* never empty */ + const char *name= path; + + do + { + if (*reserved != my_toupper(&my_charset_latin1, *name)) + break; + if (++name == end && !reserved[1]) + DBUG_RETURN(1); /* Found wrong path */ + } while (*++reserved); + } + DBUG_RETURN(0); +} + +#endif /* defined(__WIN__) || defined(__EMX__) */ diff --git a/externals/mysql/mysys/my_aes.c b/externals/mysql/mysys/my_aes.c new file mode 100644 index 0000000..575d470 --- /dev/null +++ b/externals/mysql/mysys/my_aes.c @@ -0,0 +1,227 @@ +/* Copyright (C) 2002 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* + Implementation of AES Encryption for MySQL + Initial version by Peter Zaitsev June 2002 +*/ + + +#include +#include +#include "my_aes.h" + +enum encrypt_dir { AES_ENCRYPT, AES_DECRYPT }; + +#define AES_BLOCK_SIZE 16 /* Block size in bytes */ + +#define AES_BAD_DATA -1 /* If bad data discovered during decoding */ + + +/* The structure for key information */ +typedef struct { + int nr; /* Number of rounds */ + uint32 rk[4*(AES_MAXNR + 1)]; /* key schedule */ +} KEYINSTANCE; + + +/* + This is internal function just keeps joint code of Key generation + + SYNOPSIS + my_aes_create_key() + aes_key Address of Key Instance to be created + direction Direction (are we encoding or decoding) + key Key to use for real key creation + key_length Length of the key + + DESCRIPTION + + RESULT + 0 ok + -1 Error Note: The current impementation never returns this +*/ + +static int my_aes_create_key(KEYINSTANCE *aes_key, + enum encrypt_dir direction, const char *key, + int key_length) +{ + uint8 rkey[AES_KEY_LENGTH/8]; /* The real key to be used for encryption */ + uint8 *rkey_end=rkey+AES_KEY_LENGTH/8; /* Real key boundary */ + uint8 *ptr; /* Start of the real key*/ + const char *sptr; /* Start of the working key */ + const char *key_end=key+key_length; /* Working key boundary*/ + + bzero((char*) rkey,AES_KEY_LENGTH/8); /* Set initial key */ + + for (ptr= rkey, sptr= key; sptr < key_end; ptr++,sptr++) + { + if (ptr == rkey_end) + ptr= rkey; /* Just loop over tmp_key until we used all key */ + *ptr^= (uint8) *sptr; + } +#ifdef AES_USE_KEY_BITS + /* + This block is intended to allow more weak encryption if application + build with libmysqld needs to correspond to export regulations + It should be never used in normal distribution as does not give + any speed improvement. + To get worse security define AES_USE_KEY_BITS to number of bits + you want key to be. It should be divisible by 8 + + WARNING: Changing this value results in changing of enryption for + all key lengths so altering this value will result in impossibility + to decrypt data encrypted with previous value + */ +#define AES_USE_KEY_BYTES (AES_USE_KEY_BITS/8) + /* + To get weaker key we use first AES_USE_KEY_BYTES bytes of created key + and cyclically copy them until we created all required key length + */ + for (ptr= rkey+AES_USE_KEY_BYTES, sptr=rkey ; ptr < rkey_end; + ptr++,sptr++) + { + if (sptr == rkey+AES_USE_KEY_BYTES) + sptr=rkey; + *ptr=*sptr; + } +#endif + if (direction == AES_DECRYPT) + aes_key->nr = rijndaelKeySetupDec(aes_key->rk, rkey, AES_KEY_LENGTH); + else + aes_key->nr = rijndaelKeySetupEnc(aes_key->rk, rkey, AES_KEY_LENGTH); + return 0; +} + + +/* + Crypt buffer with AES encryption algorithm. + + SYNOPSIS + my_aes_encrypt() + source Pointer to data for encryption + source_length Size of encryption data + dest Buffer to place encrypted data (must be large enough) + key Key to be used for encryption + key_length Length of the key. Will handle keys of any length + + RETURN + >= 0 Size of encrypted data + < 0 Error +*/ + +int my_aes_encrypt(const char* source, int source_length, char* dest, + const char* key, int key_length) +{ + KEYINSTANCE aes_key; + uint8 block[AES_BLOCK_SIZE]; /* 128 bit block used for padding */ + int rc; /* result codes */ + int num_blocks; /* number of complete blocks */ + char pad_len; /* pad size for the last block */ + int i; + + if ((rc= my_aes_create_key(&aes_key,AES_ENCRYPT,key,key_length))) + return rc; + + num_blocks = source_length/AES_BLOCK_SIZE; + + for (i = num_blocks; i > 0; i--) /* Encode complete blocks */ + { + rijndaelEncrypt(aes_key.rk, aes_key.nr, (const uint8*) source, + (uint8*) dest); + source+= AES_BLOCK_SIZE; + dest+= AES_BLOCK_SIZE; + } + + /* Encode the rest. We always have incomplete block */ + pad_len = AES_BLOCK_SIZE - (source_length - AES_BLOCK_SIZE*num_blocks); + memcpy(block, source, 16 - pad_len); + bfill(block + AES_BLOCK_SIZE - pad_len, pad_len, pad_len); + rijndaelEncrypt(aes_key.rk, aes_key.nr, block, (uint8*) dest); + return AES_BLOCK_SIZE*(num_blocks + 1); +} + + +/* + DeCrypt buffer with AES encryption algorithm. + + SYNOPSIS + my_aes_decrypt() + source Pointer to data for decryption + source_length Size of encrypted data + dest Buffer to place decrypted data (must be large enough) + key Key to be used for decryption + key_length Length of the key. Will handle keys of any length + + RETURN + >= 0 Size of encrypted data + < 0 Error +*/ + +int my_aes_decrypt(const char *source, int source_length, char *dest, + const char *key, int key_length) +{ + KEYINSTANCE aes_key; + uint8 block[AES_BLOCK_SIZE]; /* 128 bit block used for padding */ + int rc; /* Result codes */ + int num_blocks; /* Number of complete blocks */ + uint pad_len; /* Pad size for the last block */ + int i; + + if ((rc=my_aes_create_key(&aes_key,AES_DECRYPT,key,key_length))) + return rc; + + num_blocks = source_length/AES_BLOCK_SIZE; + + if ((source_length != num_blocks*AES_BLOCK_SIZE) || num_blocks ==0 ) + return AES_BAD_DATA; /* Input size has to be even and at least one block */ + + for (i = num_blocks-1; i > 0; i--) /* Decode all but last blocks */ + { + rijndaelDecrypt(aes_key.rk, aes_key.nr, (const uint8*) source, + (uint8*) dest); + source+= AES_BLOCK_SIZE; + dest+= AES_BLOCK_SIZE; + } + + rijndaelDecrypt(aes_key.rk, aes_key.nr, (const uint8*) source, block); + /* Use last char in the block as size */ + pad_len = (uint) (uchar) block[AES_BLOCK_SIZE-1]; + + if (pad_len > AES_BLOCK_SIZE) + return AES_BAD_DATA; + /* We could also check whole padding but we do not really need this */ + + memcpy(dest, block, AES_BLOCK_SIZE - pad_len); + return AES_BLOCK_SIZE*num_blocks - pad_len; +} + + +/* + Get size of buffer which will be large enough for encrypted data + + SYNOPSIS + my_aes_get_size() + source_length Length of data to be encrypted + + RETURN + Size of buffer required to store encrypted data +*/ + +int my_aes_get_size(int source_length) +{ + return AES_BLOCK_SIZE*(source_length/AES_BLOCK_SIZE)+AES_BLOCK_SIZE; +} diff --git a/externals/mysql/mysys/my_alarm.c b/externals/mysql/mysys/my_alarm.c new file mode 100644 index 0000000..d6a0da1 --- /dev/null +++ b/externals/mysql/mysys/my_alarm.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Function to set a varible when we got a alarm */ +/* Used by my_lock samt functions in m_alarm.h */ + + +#include "mysys_priv.h" +#include "my_alarm.h" + +#ifdef HAVE_ALARM + + /* ARGSUSED */ +sig_handler my_set_alarm_variable(int signo __attribute__((unused))) +{ + my_have_got_alarm=1; /* Tell program that time expired */ + return; +} + +#endif /* HAVE_ALARM */ diff --git a/externals/mysql/mysys/my_alloc.c b/externals/mysql/mysys/my_alloc.c new file mode 100644 index 0000000..80add2f --- /dev/null +++ b/externals/mysql/mysys/my_alloc.c @@ -0,0 +1,420 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Routines to handle mallocing of results which will be freed the same time */ + +#include +#include +#include +#undef EXTRA_DEBUG +#define EXTRA_DEBUG + + +/* + Initialize memory root + + SYNOPSIS + init_alloc_root() + mem_root - memory root to initialize + block_size - size of chunks (blocks) used for memory allocation + (It is external size of chunk i.e. it should include + memory required for internal structures, thus it + should be no less than ALLOC_ROOT_MIN_BLOCK_SIZE) + pre_alloc_size - if non-0, then size of block that should be + pre-allocated during memory root initialization. + + DESCRIPTION + This function prepares memory root for further use, sets initial size of + chunk for memory allocation and pre-allocates first block if specified. + Altough error can happen during execution of this function if + pre_alloc_size is non-0 it won't be reported. Instead it will be + reported as error in first alloc_root() on this memory root. +*/ + +void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, + size_t pre_alloc_size __attribute__((unused))) +{ + DBUG_ENTER("init_alloc_root"); + DBUG_PRINT("enter",("root: %p", mem_root)); + + mem_root->free= mem_root->used= mem_root->pre_alloc= 0; + mem_root->min_malloc= 32; + mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; + mem_root->error_handler= 0; + mem_root->block_num= 4; /* We shift this with >>2 */ + mem_root->first_block_usage= 0; + +#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) + if (pre_alloc_size) + { + if ((mem_root->free= mem_root->pre_alloc= + (USED_MEM*) my_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)), + MYF(0)))) + { + mem_root->free->size= pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM)); + mem_root->free->left= pre_alloc_size; + mem_root->free->next= 0; + } + } +#endif + DBUG_VOID_RETURN; +} + + +/* + SYNOPSIS + reset_root_defaults() + mem_root memory root to change defaults of + block_size new value of block size. Must be greater or equal + than ALLOC_ROOT_MIN_BLOCK_SIZE (this value is about + 68 bytes and depends on platform and compilation flags) + pre_alloc_size new size of preallocated block. If not zero, + must be equal to or greater than block size, + otherwise means 'no prealloc'. + DESCRIPTION + Function aligns and assigns new value to block size; then it tries to + reuse one of existing blocks as prealloc block, or malloc new one of + requested size. If no blocks can be reused, all unused blocks are freed + before allocation. +*/ + +void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, + size_t pre_alloc_size __attribute__((unused))) +{ + DBUG_ASSERT(alloc_root_inited(mem_root)); + + mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; +#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG)) + if (pre_alloc_size) + { + size_t size= pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM)); + if (!mem_root->pre_alloc || mem_root->pre_alloc->size != size) + { + USED_MEM *mem, **prev= &mem_root->free; + /* + Free unused blocks, so that consequent calls + to reset_root_defaults won't eat away memory. + */ + while (*prev) + { + mem= *prev; + if (mem->size == size) + { + /* We found a suitable block, no need to do anything else */ + mem_root->pre_alloc= mem; + return; + } + if (mem->left + ALIGN_SIZE(sizeof(USED_MEM)) == mem->size) + { + /* remove block from the list and free it */ + *prev= mem->next; + my_free(mem, MYF(0)); + } + else + prev= &mem->next; + } + /* Allocate new prealloc block and add it to the end of free list */ + if ((mem= (USED_MEM *) my_malloc(size, MYF(0)))) + { + mem->size= size; + mem->left= pre_alloc_size; + mem->next= *prev; + *prev= mem_root->pre_alloc= mem; + } + else + { + mem_root->pre_alloc= 0; + } + } + } + else +#endif + mem_root->pre_alloc= 0; +} + + +void *alloc_root(MEM_ROOT *mem_root, size_t length) +{ +#if defined(HAVE_purify) && defined(EXTRA_DEBUG) + reg1 USED_MEM *next; + DBUG_ENTER("alloc_root"); + DBUG_PRINT("enter",("root: %p", mem_root)); + + DBUG_ASSERT(alloc_root_inited(mem_root)); + + length+=ALIGN_SIZE(sizeof(USED_MEM)); + if (!(next = (USED_MEM*) my_malloc(length,MYF(MY_WME | ME_FATALERROR)))) + { + if (mem_root->error_handler) + (*mem_root->error_handler)(); + DBUG_RETURN((uchar*) 0); /* purecov: inspected */ + } + next->next= mem_root->used; + next->size= length; + mem_root->used= next; + DBUG_PRINT("exit",("ptr: %p", (((char*) next)+ + ALIGN_SIZE(sizeof(USED_MEM))))); + DBUG_RETURN((uchar*) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM)))); +#else + size_t get_size, block_size; + uchar* point; + reg1 USED_MEM *next= 0; + reg2 USED_MEM **prev; + DBUG_ENTER("alloc_root"); + DBUG_PRINT("enter",("root: %p", mem_root)); + DBUG_ASSERT(alloc_root_inited(mem_root)); + + length= ALIGN_SIZE(length); + if ((*(prev= &mem_root->free)) != NULL) + { + if ((*prev)->left < length && + mem_root->first_block_usage++ >= ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP && + (*prev)->left < ALLOC_MAX_BLOCK_TO_DROP) + { + next= *prev; + *prev= next->next; /* Remove block from list */ + next->next= mem_root->used; + mem_root->used= next; + mem_root->first_block_usage= 0; + } + for (next= *prev ; next && next->left < length ; next= next->next) + prev= &next->next; + } + if (! next) + { /* Time to alloc new block */ + block_size= mem_root->block_size * (mem_root->block_num >> 2); + get_size= length+ALIGN_SIZE(sizeof(USED_MEM)); + get_size= max(get_size, block_size); + + if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME | ME_FATALERROR)))) + { + if (mem_root->error_handler) + (*mem_root->error_handler)(); + DBUG_RETURN((void*) 0); /* purecov: inspected */ + } + mem_root->block_num++; + next->next= *prev; + next->size= get_size; + next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM)); + *prev=next; + } + + point= (uchar*) ((char*) next+ (next->size-next->left)); + /*TODO: next part may be unneded due to mem_root->first_block_usage counter*/ + if ((next->left-= length) < mem_root->min_malloc) + { /* Full block */ + *prev= next->next; /* Remove block from list */ + next->next= mem_root->used; + mem_root->used= next; + mem_root->first_block_usage= 0; + } + DBUG_PRINT("exit",("ptr: %p", point)); + DBUG_RETURN((void*) point); +#endif +} + + +/* + Allocate many pointers at the same time. + + DESCRIPTION + ptr1, ptr2, etc all point into big allocated memory area. + + SYNOPSIS + multi_alloc_root() + root Memory root + ptr1, length1 Multiple arguments terminated by a NULL pointer + ptr2, length2 ... + ... + NULL + + RETURN VALUE + A pointer to the beginning of the allocated memory block + in case of success or NULL if out of memory. +*/ + +void *multi_alloc_root(MEM_ROOT *root, ...) +{ + va_list args; + char **ptr, *start, *res; + size_t tot_length, length; + DBUG_ENTER("multi_alloc_root"); + + va_start(args, root); + tot_length= 0; + while ((ptr= va_arg(args, char **))) + { + length= va_arg(args, uint); + tot_length+= ALIGN_SIZE(length); + } + va_end(args); + + if (!(start= (char*) alloc_root(root, tot_length))) + DBUG_RETURN(0); /* purecov: inspected */ + + va_start(args, root); + res= start; + while ((ptr= va_arg(args, char **))) + { + *ptr= res; + length= va_arg(args, uint); + res+= ALIGN_SIZE(length); + } + va_end(args); + DBUG_RETURN((void*) start); +} + +#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left) + +/* Mark all data in blocks free for reusage */ + +static inline void mark_blocks_free(MEM_ROOT* root) +{ + reg1 USED_MEM *next; + reg2 USED_MEM **last; + + /* iterate through (partially) free blocks, mark them free */ + last= &root->free; + for (next= root->free; next; next= *(last= &next->next)) + { + next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM)); + TRASH_MEM(next); + } + + /* Combine the free and the used list */ + *last= next=root->used; + + /* now go through the used blocks and mark them free */ + for (; next; next= next->next) + { + next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM)); + TRASH_MEM(next); + } + + /* Now everything is set; Indicate that nothing is used anymore */ + root->used= 0; + root->first_block_usage= 0; +} + + +/* + Deallocate everything used by alloc_root or just move + used blocks to free list if called with MY_USED_TO_FREE + + SYNOPSIS + free_root() + root Memory root + MyFlags Flags for what should be freed: + + MY_MARK_BLOCKS_FREED Don't free blocks, just mark them free + MY_KEEP_PREALLOC If this is not set, then free also the + preallocated block + + NOTES + One can call this function either with root block initialised with + init_alloc_root() or with a bzero()-ed block. + It's also safe to call this multiple times with the same mem_root. +*/ + +void free_root(MEM_ROOT *root, myf MyFlags) +{ + reg1 USED_MEM *next,*old; + DBUG_ENTER("free_root"); + DBUG_PRINT("enter",("root: %p flags: %u", root, (uint) MyFlags)); + + if (MyFlags & MY_MARK_BLOCKS_FREE) + { + mark_blocks_free(root); + DBUG_VOID_RETURN; + } + if (!(MyFlags & MY_KEEP_PREALLOC)) + root->pre_alloc=0; + + for (next=root->used; next ;) + { + old=next; next= next->next ; + if (old != root->pre_alloc) + my_free(old,MYF(0)); + } + for (next=root->free ; next ;) + { + old=next; next= next->next; + if (old != root->pre_alloc) + my_free(old,MYF(0)); + } + root->used=root->free=0; + if (root->pre_alloc) + { + root->free=root->pre_alloc; + root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM)); + TRASH_MEM(root->pre_alloc); + root->free->next=0; + } + root->block_num= 4; + root->first_block_usage= 0; + DBUG_VOID_RETURN; +} + +/* + Find block that contains an object and set the pre_alloc to it +*/ + +void set_prealloc_root(MEM_ROOT *root, char *ptr) +{ + USED_MEM *next; + for (next=root->used; next ; next=next->next) + { + if ((char*) next <= ptr && (char*) next + next->size > ptr) + { + root->pre_alloc=next; + return; + } + } + for (next=root->free ; next ; next=next->next) + { + if ((char*) next <= ptr && (char*) next + next->size > ptr) + { + root->pre_alloc=next; + return; + } + } +} + + +char *strdup_root(MEM_ROOT *root, const char *str) +{ + return strmake_root(root, str, strlen(str)); +} + + +char *strmake_root(MEM_ROOT *root, const char *str, size_t len) +{ + char *pos; + if ((pos=alloc_root(root,len+1))) + { + memcpy(pos,str,len); + pos[len]=0; + } + return pos; +} + + +void *memdup_root(MEM_ROOT *root, const void *str, size_t len) +{ + char *pos; + if ((pos=alloc_root(root,len))) + memcpy(pos,str,len); + return pos; +} diff --git a/externals/mysql/mysys/my_append.c b/externals/mysql/mysys/my_append.c new file mode 100644 index 0000000..d410df1 --- /dev/null +++ b/externals/mysql/mysys/my_append.c @@ -0,0 +1,64 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include +#include +#if defined(HAVE_UTIME_H) +#include +#elif defined(HAVE_SYS_UTIME_H) +#include +#elif !defined(HPUX10) +struct utimbuf { + time_t actime; + time_t modtime; +}; +#endif + +/* + Append a file to another + + NOTES + Don't set MY_FNABP or MY_NABP bits on when calling this function +*/ + +int my_append(const char *from, const char *to, myf MyFlags) +{ + uint Count; + File from_file,to_file; + uchar buff[IO_SIZE]; + DBUG_ENTER("my_append"); + DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); + + from_file= to_file= -1; + + if ((from_file=my_open(from,O_RDONLY,MyFlags)) >= 0) + { + if ((to_file=my_open(to,O_APPEND | O_WRONLY,MyFlags)) >= 0) + { + while ((Count=my_read(from_file,buff,IO_SIZE,MyFlags)) != 0) + if (Count == (uint) -1 || + my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP))) + goto err; + if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags)) + DBUG_RETURN(-1); /* Error on close */ + DBUG_RETURN(0); + } + } +err: + if (from_file >= 0) (void) my_close(from_file,MyFlags); + if (to_file >= 0) (void) my_close(to_file,MyFlags); + DBUG_RETURN(-1); +} diff --git a/externals/mysql/mysys/my_atomic.c b/externals/mysql/mysys/my_atomic.c new file mode 100644 index 0000000..df6490b --- /dev/null +++ b/externals/mysql/mysys/my_atomic.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include + +#ifndef HAVE_INLINE +/* the following will cause all inline functions to be instantiated */ +#define HAVE_INLINE +#undef STATIC_INLINE +#define STATIC_INLINE extern +#endif + +#include + +/* + checks that the current build of atomic ops + can run on this machine + + RETURN + ATOMIC_xxx values, see my_atomic.h +*/ +int my_atomic_initialize() +{ + compile_time_assert(sizeof(intptr) == sizeof(void *)); + /* currently the only thing worth checking is SMP/UP issue */ +#ifdef MY_ATOMIC_MODE_DUMMY + return my_getncpus() == 1 ? MY_ATOMIC_OK : MY_ATOMIC_NOT_1CPU; +#else + return MY_ATOMIC_OK; +#endif +} + diff --git a/externals/mysql/mysys/my_bit.c b/externals/mysql/mysys/my_bit.c new file mode 100644 index 0000000..620d1b8 --- /dev/null +++ b/externals/mysql/mysys/my_bit.c @@ -0,0 +1,70 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include + +#ifndef HAVE_INLINE +/* the following will cause all inline functions to be instantiated */ +#define HAVE_INLINE +#undef STATIC_INLINE +#define STATIC_INLINE extern +#endif + +#include + +const char _my_bits_nbits[256] = { + 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, + 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, +}; + +/* + perl -e 'print map{", 0x".unpack H2,pack B8,unpack b8,chr$_}(0..255)' +*/ +const uchar _my_bits_reverse_table[256]={ +0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, +0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, +0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, +0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, 0x0C, 0x8C, 0x4C, 0xCC, +0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, 0x02, +0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, +0x72, 0xF2, 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, +0xDA, 0x3A, 0xBA, 0x7A, 0xFA, 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, +0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, +0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, 0x01, 0x81, +0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, +0xF1, 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, +0x39, 0xB9, 0x79, 0xF9, 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, +0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, +0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD, 0x03, 0x83, 0x43, +0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, +0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, +0xBB, 0x7B, 0xFB, 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, +0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, +0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF +}; diff --git a/externals/mysql/mysys/my_bitmap.c b/externals/mysql/mysys/my_bitmap.c new file mode 100644 index 0000000..d6cf5d4 --- /dev/null +++ b/externals/mysql/mysys/my_bitmap.c @@ -0,0 +1,1126 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Handling of uchar arrays as large bitmaps. + + API limitations (or, rather asserted safety assumptions, + to encourage correct programming) + + * the internal size is a set of 32 bit words + * the number of bits specified in creation can be any number > 0 + * there are THREAD safe versions of most calls called bitmap_lock_* + many of those are not used and not compiled normally but the code + already exist for them in an #ifdef:ed part. These can only be used + if THREAD was specified in bitmap_init + + TODO: + Make assembler THREAD safe versions of these using test-and-set instructions + + Original version created by Sergei Golubchik 2001 - 2004. + New version written and test program added and some changes to the interface + was made by Mikael Ronström 2005, with assistance of Tomas Ulin and Mats + Kindahl. +*/ + +#include "mysys_priv.h" +#include +#include +#include + +void create_last_word_mask(MY_BITMAP *map) +{ + /* Get the number of used bits (1..8) in the last byte */ + unsigned int const used= 1U + ((map->n_bits-1U) & 0x7U); + + /* + Create a mask with the upper 'unused' bits set and the lower 'used' + bits clear. The bits within each byte is stored in big-endian order. + */ + unsigned char const mask= (~((1 << used) - 1)) & 255; + + /* + The first bytes are to be set to zero since they represent real bits + in the bitvector. The last bytes are set to 0xFF since they represent + bytes not used by the bitvector. Finally the last byte contains bits + as set by the mask above. + */ + unsigned char *ptr= (unsigned char*)&map->last_word_mask; + + map->last_word_ptr= map->bitmap + no_words_in_map(map)-1; + switch (no_bytes_in_map(map) & 3) { + case 1: + map->last_word_mask= ~0U; + ptr[0]= mask; + return; + case 2: + map->last_word_mask= ~0U; + ptr[0]= 0; + ptr[1]= mask; + return; + case 3: + map->last_word_mask= 0U; + ptr[2]= mask; + ptr[3]= 0xFFU; + return; + case 0: + map->last_word_mask= 0U; + ptr[3]= mask; + return; + } +} + + +static inline void bitmap_lock(MY_BITMAP *map __attribute__((unused))) +{ +#ifdef THREAD + if (map->mutex) + pthread_mutex_lock(map->mutex); +#endif +} + +static inline void bitmap_unlock(MY_BITMAP *map __attribute__((unused))) +{ +#ifdef THREAD + if (map->mutex) + pthread_mutex_unlock(map->mutex); +#endif +} + + +my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, + my_bool thread_safe __attribute__((unused))) +{ + DBUG_ENTER("bitmap_init"); + if (!buf) + { + uint size_in_bytes= bitmap_buffer_size(n_bits); + uint extra= 0; +#ifdef THREAD + if (thread_safe) + { + size_in_bytes= ALIGN_SIZE(size_in_bytes); + extra= sizeof(pthread_mutex_t); + } + map->mutex= 0; +#endif + if (!(buf= (my_bitmap_map*) my_malloc(size_in_bytes+extra, MYF(MY_WME)))) + DBUG_RETURN(1); +#ifdef THREAD + if (thread_safe) + { + map->mutex= (pthread_mutex_t *) ((char*) buf + size_in_bytes); + pthread_mutex_init(map->mutex, MY_MUTEX_INIT_FAST); + } +#endif + } +#ifdef THREAD + else + { + DBUG_ASSERT(thread_safe == 0); + } +#endif + + map->bitmap= buf; + map->n_bits= n_bits; + create_last_word_mask(map); + bitmap_clear_all(map); + DBUG_RETURN(0); +} + + +void bitmap_free(MY_BITMAP *map) +{ + DBUG_ENTER("bitmap_free"); + if (map->bitmap) + { +#ifdef THREAD + if (map->mutex) + pthread_mutex_destroy(map->mutex); +#endif + my_free((char*) map->bitmap, MYF(0)); + map->bitmap=0; + } + DBUG_VOID_RETURN; +} + + +/* + test if bit already set and set it if it was not (thread unsafe method) + + SYNOPSIS + bitmap_fast_test_and_set() + MAP bit map struct + BIT bit number + + RETURN + 0 bit was not set + !=0 bit was set +*/ + +my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit) +{ + uchar *value= ((uchar*) map->bitmap) + (bitmap_bit / 8); + uchar bit= 1 << ((bitmap_bit) & 7); + uchar res= (*value) & bit; + *value|= bit; + return res; +} + + +/* + test if bit already set and set it if it was not (thread safe method) + + SYNOPSIS + bitmap_fast_test_and_set() + map bit map struct + bitmap_bit bit number + + RETURN + 0 bit was not set + !=0 bit was set +*/ + +my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit) +{ + my_bool res; + DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); + bitmap_lock(map); + res= bitmap_fast_test_and_set(map, bitmap_bit); + bitmap_unlock(map); + return res; +} + +/* + test if bit already set and clear it if it was set(thread unsafe method) + + SYNOPSIS + bitmap_fast_test_and_set() + MAP bit map struct + BIT bit number + + RETURN + 0 bit was not set + !=0 bit was set +*/ + +my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit) +{ + uchar *byte= (uchar*) map->bitmap + (bitmap_bit / 8); + uchar bit= 1 << ((bitmap_bit) & 7); + uchar res= (*byte) & bit; + *byte&= ~bit; + return res; +} + + +my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit) +{ + my_bool res; + DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); + bitmap_lock(map); + res= bitmap_fast_test_and_clear(map, bitmap_bit); + bitmap_unlock(map); + return res; +} + + +uint bitmap_set_next(MY_BITMAP *map) +{ + uint bit_found; + DBUG_ASSERT(map->bitmap); + if ((bit_found= bitmap_get_first(map)) != MY_BIT_NONE) + bitmap_set_bit(map, bit_found); + return bit_found; +} + + +void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size) +{ + uint prefix_bytes, prefix_bits, d; + uchar *m= (uchar *)map->bitmap; + + DBUG_ASSERT(map->bitmap && + (prefix_size <= map->n_bits || prefix_size == (uint) ~0)); + set_if_smaller(prefix_size, map->n_bits); + if ((prefix_bytes= prefix_size / 8)) + memset(m, 0xff, prefix_bytes); + m+= prefix_bytes; + if ((prefix_bits= prefix_size & 7)) + *m++= (1 << prefix_bits)-1; + if ((d= no_bytes_in_map(map)-prefix_bytes)) + bzero(m, d); +} + + +my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size) +{ + uint prefix_bits= prefix_size & 0x7, res; + uchar *m= (uchar*)map->bitmap; + uchar *end_prefix= m+prefix_size/8; + uchar *end; + DBUG_ASSERT(m && prefix_size <= map->n_bits); + end= m+no_bytes_in_map(map); + + while (m < end_prefix) + if (*m++ != 0xff) + return 0; + + *map->last_word_ptr&= ~map->last_word_mask; /*Clear bits*/ + res= 0; + if (prefix_bits && *m++ != (1 << prefix_bits)-1) + goto ret; + + while (m < end) + if (*m++ != 0) + goto ret; + res= 1; +ret: + return res; +} + + +my_bool bitmap_is_set_all(const MY_BITMAP *map) +{ + my_bitmap_map *data_ptr= map->bitmap; + my_bitmap_map *end= map->last_word_ptr; + *map->last_word_ptr |= map->last_word_mask; + for (; data_ptr <= end; data_ptr++) + if (*data_ptr != 0xFFFFFFFF) + return FALSE; + return TRUE; +} + + +my_bool bitmap_is_clear_all(const MY_BITMAP *map) +{ + my_bitmap_map *data_ptr= map->bitmap; + my_bitmap_map *end; + if (*map->last_word_ptr & ~map->last_word_mask) + return FALSE; + end= map->last_word_ptr; + for (; data_ptr < end; data_ptr++) + if (*data_ptr) + return FALSE; + return TRUE; +} + +/* Return TRUE if map1 is a subset of map2 */ + +my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2) +{ + my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end; + + DBUG_ASSERT(map1->bitmap && map2->bitmap && + map1->n_bits==map2->n_bits); + + end= map1->last_word_ptr; + *map1->last_word_ptr &= ~map1->last_word_mask; + *map2->last_word_ptr &= ~map2->last_word_mask; + while (m1 <= end) + { + if ((*m1++) & ~(*m2++)) + return 0; + } + return 1; +} + +/* True if bitmaps has any common bits */ + +my_bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2) +{ + my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end; + + DBUG_ASSERT(map1->bitmap && map2->bitmap && + map1->n_bits==map2->n_bits); + + end= map1->last_word_ptr; + *map1->last_word_ptr &= ~map1->last_word_mask; + *map2->last_word_ptr &= ~map2->last_word_mask; + while (m1 <= end) + { + if ((*m1++) & (*m2++)) + return 1; + } + return 0; +} + + +void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2) +{ + my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; + uint len= no_words_in_map(map), len2 = no_words_in_map(map2); + + DBUG_ASSERT(map->bitmap && map2->bitmap); + + end= to+min(len,len2); + *map2->last_word_ptr&= ~map2->last_word_mask; /*Clear last bits in map2*/ + while (to < end) + *to++ &= *from++; + + if (len2 < len) + { + end+=len-len2; + while (to < end) + *to++=0; + } +} + + +/* + Set/clear all bits above a bit. + + SYNOPSIS + bitmap_set_above() + map RETURN The bitmap to change. + from_byte The bitmap buffer byte offset to start with. + use_bit The bit value (1/0) to use for all upper bits. + + NOTE + You can only set/clear full bytes. + The function is meant for the situation that you copy a smaller bitmap + to a bigger bitmap. Bitmap lengths are always multiple of eigth (the + size of a byte). Using 'from_byte' saves multiplication and division + by eight during parameter passing. + + RETURN + void +*/ + +void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit) +{ + uchar use_byte= use_bit ? 0xff : 0; + uchar *to= (uchar *)map->bitmap + from_byte; + uchar *end= (uchar *)map->bitmap + (map->n_bits+7)/8; + + while (to < end) + *to++= use_byte; +} + + +void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2) +{ + my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; + DBUG_ASSERT(map->bitmap && map2->bitmap && + map->n_bits==map2->n_bits); + + end= map->last_word_ptr; + + while (to <= end) + *to++ &= ~(*from++); +} + + +void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2) +{ + my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; + + DBUG_ASSERT(map->bitmap && map2->bitmap && + map->n_bits==map2->n_bits); + end= map->last_word_ptr; + + while (to <= end) + *to++ |= *from++; +} + + +void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2) +{ + my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr; + DBUG_ASSERT(map->bitmap && map2->bitmap && + map->n_bits==map2->n_bits); + while (to <= end) + *to++ ^= *from++; +} + + +void bitmap_invert(MY_BITMAP *map) +{ + my_bitmap_map *to= map->bitmap, *end; + + DBUG_ASSERT(map->bitmap); + end= map->last_word_ptr; + + while (to <= end) + *to++ ^= 0xFFFFFFFF; +} + + +uint bitmap_bits_set(const MY_BITMAP *map) +{ + uchar *m= (uchar*)map->bitmap; + uchar *end= m + no_bytes_in_map(map); + uint res= 0; + + DBUG_ASSERT(map->bitmap); + *map->last_word_ptr&= ~map->last_word_mask; /*Reset last bits to zero*/ + while (m < end) + res+= my_count_bits_ushort(*m++); + return res; +} + + +void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2) +{ + my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; + + DBUG_ASSERT(map->bitmap && map2->bitmap && + map->n_bits==map2->n_bits); + end= map->last_word_ptr; + while (to <= end) + *to++ = *from++; +} + + +uint bitmap_get_first_set(const MY_BITMAP *map) +{ + uchar *byte_ptr; + uint i,j,k; + my_bitmap_map *data_ptr, *end= map->last_word_ptr; + + DBUG_ASSERT(map->bitmap); + data_ptr= map->bitmap; + *map->last_word_ptr &= ~map->last_word_mask; + + for (i=0; data_ptr <= end; data_ptr++, i++) + { + if (*data_ptr) + { + byte_ptr= (uchar*)data_ptr; + for (j=0; ; j++, byte_ptr++) + { + if (*byte_ptr) + { + for (k=0; ; k++) + { + if (*byte_ptr & (1 << k)) + return (i*32) + (j*8) + k; + } + } + } + } + } + return MY_BIT_NONE; +} + + +uint bitmap_get_first(const MY_BITMAP *map) +{ + uchar *byte_ptr; + uint i,j,k; + my_bitmap_map *data_ptr, *end= map->last_word_ptr; + + DBUG_ASSERT(map->bitmap); + data_ptr= map->bitmap; + *map->last_word_ptr|= map->last_word_mask; + + for (i=0; data_ptr <= end; data_ptr++, i++) + { + if (*data_ptr != 0xFFFFFFFF) + { + byte_ptr= (uchar*)data_ptr; + for (j=0; ; j++, byte_ptr++) + { + if (*byte_ptr != 0xFF) + { + for (k=0; ; k++) + { + if (!(*byte_ptr & (1 << k))) + return (i*32) + (j*8) + k; + } + } + } + } + } + return MY_BIT_NONE; +} + + +uint bitmap_lock_set_next(MY_BITMAP *map) +{ + uint bit_found; + bitmap_lock(map); + bit_found= bitmap_set_next(map); + bitmap_unlock(map); + return bit_found; +} + + +void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit) +{ + bitmap_lock(map); + DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); + bitmap_clear_bit(map, bitmap_bit); + bitmap_unlock(map); +} + + +#ifdef NOT_USED +my_bool bitmap_lock_is_prefix(const MY_BITMAP *map, uint prefix_size) +{ + my_bool res; + bitmap_lock((MY_BITMAP *)map); + res= bitmap_is_prefix(map, prefix_size); + bitmap_unlock((MY_BITMAP *)map); + return res; +} + + +void bitmap_lock_set_all(MY_BITMAP *map) +{ + bitmap_lock(map); + bitmap_set_all(map); + bitmap_unlock(map); +} + + +void bitmap_lock_clear_all(MY_BITMAP *map) +{ + bitmap_lock(map); + bitmap_clear_all(map); + bitmap_unlock(map); +} + + +void bitmap_lock_set_prefix(MY_BITMAP *map, uint prefix_size) +{ + bitmap_lock(map); + bitmap_set_prefix(map, prefix_size); + bitmap_unlock(map); +} + + +my_bool bitmap_lock_is_clear_all(const MY_BITMAP *map) +{ + uint res; + bitmap_lock((MY_BITMAP *)map); + res= bitmap_is_clear_all(map); + bitmap_unlock((MY_BITMAP *)map); + return res; +} + + +my_bool bitmap_lock_is_set_all(const MY_BITMAP *map) +{ + uint res; + bitmap_lock((MY_BITMAP *)map); + res= bitmap_is_set_all(map); + bitmap_unlock((MY_BITMAP *)map); + return res; +} + + +my_bool bitmap_lock_is_set(const MY_BITMAP *map, uint bitmap_bit) +{ + my_bool res; + DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); + bitmap_lock((MY_BITMAP *)map); + res= bitmap_is_set(map, bitmap_bit); + bitmap_unlock((MY_BITMAP *)map); + return res; +} + + +my_bool bitmap_lock_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2) +{ + uint res; + bitmap_lock((MY_BITMAP *)map1); + bitmap_lock((MY_BITMAP *)map2); + res= bitmap_is_subset(map1, map2); + bitmap_unlock((MY_BITMAP *)map2); + bitmap_unlock((MY_BITMAP *)map1); + return res; +} + + +my_bool bitmap_lock_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) +{ + uint res; + + DBUG_ASSERT(map1->bitmap && map2->bitmap && + map1->n_bits==map2->n_bits); + bitmap_lock((MY_BITMAP *)map1); + bitmap_lock((MY_BITMAP *)map2); + res= bitmap_cmp(map1, map2); + bitmap_unlock((MY_BITMAP *)map2); + bitmap_unlock((MY_BITMAP *)map1); + return res; +} + + +void bitmap_lock_intersect(MY_BITMAP *map, const MY_BITMAP *map2) +{ + bitmap_lock(map); + bitmap_lock((MY_BITMAP *)map2); + bitmap_intersect(map, map2); + bitmap_unlock((MY_BITMAP *)map2); + bitmap_unlock(map); +} + + +void bitmap_lock_subtract(MY_BITMAP *map, const MY_BITMAP *map2) +{ + bitmap_lock(map); + bitmap_lock((MY_BITMAP *)map2); + bitmap_subtract(map, map2); + bitmap_unlock((MY_BITMAP *)map2); + bitmap_unlock(map); +} + + +void bitmap_lock_union(MY_BITMAP *map, const MY_BITMAP *map2) +{ + bitmap_lock(map); + bitmap_lock((MY_BITMAP *)map2); + bitmap_union(map, map2); + bitmap_unlock((MY_BITMAP *)map2); + bitmap_unlock(map); +} + + +/* + SYNOPSIS + bitmap_bits_set() + map + RETURN + Number of set bits in the bitmap. +*/ +uint bitmap_lock_bits_set(const MY_BITMAP *map) +{ + uint res; + bitmap_lock((MY_BITMAP *)map); + DBUG_ASSERT(map->bitmap); + res= bitmap_bits_set(map); + bitmap_unlock((MY_BITMAP *)map); + return res; +} + + +/* + SYNOPSIS + bitmap_get_first() + map + RETURN + Number of first unset bit in the bitmap or MY_BIT_NONE if all bits are set. +*/ +uint bitmap_lock_get_first(const MY_BITMAP *map) +{ + uint res; + bitmap_lock((MY_BITMAP*)map); + res= bitmap_get_first(map); + bitmap_unlock((MY_BITMAP*)map); + return res; +} + + +uint bitmap_lock_get_first_set(const MY_BITMAP *map) +{ + uint res; + bitmap_lock((MY_BITMAP*)map); + res= bitmap_get_first_set(map); + bitmap_unlock((MY_BITMAP*)map); + return res; +} + + +void bitmap_lock_set_bit(MY_BITMAP *map, uint bitmap_bit) +{ + DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); + bitmap_lock(map); + bitmap_set_bit(map, bitmap_bit); + bitmap_unlock(map); +} + + +void bitmap_lock_flip_bit(MY_BITMAP *map, uint bitmap_bit) +{ + DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); + bitmap_lock(map); + bitmap_flip_bit(map, bitmap_bit); + bitmap_unlock(map); +} +#endif +#ifdef MAIN + +uint get_rand_bit(uint bitsize) +{ + return (rand() % bitsize); +} + +my_bool test_set_get_clear_bit(MY_BITMAP *map, uint bitsize) +{ + uint i, test_bit; + uint no_loops= bitsize > 128 ? 128 : bitsize; + for (i=0; i < no_loops; i++) + { + test_bit= get_rand_bit(bitsize); + bitmap_set_bit(map, test_bit); + if (!bitmap_is_set(map, test_bit)) + goto error1; + bitmap_clear_bit(map, test_bit); + if (bitmap_is_set(map, test_bit)) + goto error2; + } + return FALSE; +error1: + printf("Error in set bit, bit %u, bitsize = %u", test_bit, bitsize); + return TRUE; +error2: + printf("Error in clear bit, bit %u, bitsize = %u", test_bit, bitsize); + return TRUE; +} + +my_bool test_flip_bit(MY_BITMAP *map, uint bitsize) +{ + uint i, test_bit; + uint no_loops= bitsize > 128 ? 128 : bitsize; + for (i=0; i < no_loops; i++) + { + test_bit= get_rand_bit(bitsize); + bitmap_flip_bit(map, test_bit); + if (!bitmap_is_set(map, test_bit)) + goto error1; + bitmap_flip_bit(map, test_bit); + if (bitmap_is_set(map, test_bit)) + goto error2; + } + return FALSE; +error1: + printf("Error in flip bit 1, bit %u, bitsize = %u", test_bit, bitsize); + return TRUE; +error2: + printf("Error in flip bit 2, bit %u, bitsize = %u", test_bit, bitsize); + return TRUE; +} + +my_bool test_operators(MY_BITMAP *map __attribute__((unused)), + uint bitsize __attribute__((unused))) +{ + return FALSE; +} + +my_bool test_get_all_bits(MY_BITMAP *map, uint bitsize) +{ + uint i; + bitmap_set_all(map); + if (!bitmap_is_set_all(map)) + goto error1; + if (!bitmap_is_prefix(map, bitsize)) + goto error5; + bitmap_clear_all(map); + if (!bitmap_is_clear_all(map)) + goto error2; + if (!bitmap_is_prefix(map, 0)) + goto error6; + for (i=0; i 128 ? 128 : bitsize; + MY_BITMAP map2_obj, map3_obj; + MY_BITMAP *map2= &map2_obj, *map3= &map3_obj; + my_bitmap_map map2buf[1024]; + my_bitmap_map map3buf[1024]; + bitmap_init(&map2_obj, map2buf, bitsize, FALSE); + bitmap_init(&map3_obj, map3buf, bitsize, FALSE); + bitmap_clear_all(map2); + bitmap_clear_all(map3); + for (i=0; i < no_loops; i++) + { + test_bit1=get_rand_bit(bitsize); + bitmap_set_prefix(map, test_bit1); + test_bit2=get_rand_bit(bitsize); + bitmap_set_prefix(map2, test_bit2); + bitmap_intersect(map, map2); + test_bit3= test_bit2 < test_bit1 ? test_bit2 : test_bit1; + bitmap_set_prefix(map3, test_bit3); + if (!bitmap_cmp(map, map3)) + goto error1; + bitmap_clear_all(map); + bitmap_clear_all(map2); + bitmap_clear_all(map3); + test_bit1=get_rand_bit(bitsize); + test_bit2=get_rand_bit(bitsize); + test_bit3=get_rand_bit(bitsize); + bitmap_set_prefix(map, test_bit1); + bitmap_set_prefix(map2, test_bit2); + test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1; + bitmap_set_prefix(map3, test_bit3); + bitmap_union(map, map2); + if (!bitmap_cmp(map, map3)) + goto error2; + bitmap_clear_all(map); + bitmap_clear_all(map2); + bitmap_clear_all(map3); + test_bit1=get_rand_bit(bitsize); + test_bit2=get_rand_bit(bitsize); + test_bit3=get_rand_bit(bitsize); + bitmap_set_prefix(map, test_bit1); + bitmap_set_prefix(map2, test_bit2); + bitmap_xor(map, map2); + test_bit3= test_bit2 > test_bit1 ? test_bit2 : test_bit1; + test_bit4= test_bit2 < test_bit1 ? test_bit2 : test_bit1; + bitmap_set_prefix(map3, test_bit3); + for (j=0; j < test_bit4; j++) + bitmap_clear_bit(map3, j); + if (!bitmap_cmp(map, map3)) + goto error3; + bitmap_clear_all(map); + bitmap_clear_all(map2); + bitmap_clear_all(map3); + test_bit1=get_rand_bit(bitsize); + test_bit2=get_rand_bit(bitsize); + test_bit3=get_rand_bit(bitsize); + bitmap_set_prefix(map, test_bit1); + bitmap_set_prefix(map2, test_bit2); + bitmap_subtract(map, map2); + if (test_bit2 < test_bit1) + { + bitmap_set_prefix(map3, test_bit1); + for (j=0; j < test_bit2; j++) + bitmap_clear_bit(map3, j); + } + if (!bitmap_cmp(map, map3)) + goto error4; + bitmap_clear_all(map); + bitmap_clear_all(map2); + bitmap_clear_all(map3); + test_bit1=get_rand_bit(bitsize); + bitmap_set_prefix(map, test_bit1); + bitmap_invert(map); + bitmap_set_all(map3); + for (j=0; j < test_bit1; j++) + bitmap_clear_bit(map3, j); + if (!bitmap_cmp(map, map3)) + goto error5; + bitmap_clear_all(map); + bitmap_clear_all(map3); + } + return FALSE; +error1: + printf("intersect error bitsize=%u,size1=%u,size2=%u", bitsize, + test_bit1,test_bit2); + return TRUE; +error2: + printf("union error bitsize=%u,size1=%u,size2=%u", bitsize, + test_bit1,test_bit2); + return TRUE; +error3: + printf("xor error bitsize=%u,size1=%u,size2=%u", bitsize, + test_bit1,test_bit2); + return TRUE; +error4: + printf("subtract error bitsize=%u,size1=%u,size2=%u", bitsize, + test_bit1,test_bit2); + return TRUE; +error5: + printf("invert error bitsize=%u,size=%u", bitsize, + test_bit1); + return TRUE; +} + +my_bool test_count_bits_set(MY_BITMAP *map, uint bitsize) +{ + uint i, bit_count=0, test_bit; + uint no_loops= bitsize > 128 ? 128 : bitsize; + for (i=0; i < no_loops; i++) + { + test_bit=get_rand_bit(bitsize); + if (!bitmap_is_set(map, test_bit)) + { + bitmap_set_bit(map, test_bit); + bit_count++; + } + } + if (bit_count==0 && bitsize > 0) + goto error1; + if (bitmap_bits_set(map) != bit_count) + goto error2; + return FALSE; +error1: + printf("No bits set bitsize = %u", bitsize); + return TRUE; +error2: + printf("Wrong count of bits set, bitsize = %u", bitsize); + return TRUE; +} + +my_bool test_get_first_bit(MY_BITMAP *map, uint bitsize) +{ + uint i, test_bit; + uint no_loops= bitsize > 128 ? 128 : bitsize; + for (i=0; i < no_loops; i++) + { + test_bit=get_rand_bit(bitsize); + bitmap_set_bit(map, test_bit); + if (bitmap_get_first_set(map) != test_bit) + goto error1; + bitmap_set_all(map); + bitmap_clear_bit(map, test_bit); + if (bitmap_get_first(map) != test_bit) + goto error2; + bitmap_clear_all(map); + } + return FALSE; +error1: + printf("get_first_set error bitsize=%u,prefix_size=%u",bitsize,test_bit); + return TRUE; +error2: + printf("get_first error bitsize= %u, prefix_size= %u",bitsize,test_bit); + return TRUE; +} + +my_bool test_get_next_bit(MY_BITMAP *map, uint bitsize) +{ + uint i, j, test_bit; + uint no_loops= bitsize > 128 ? 128 : bitsize; + for (i=0; i < no_loops; i++) + { + test_bit=get_rand_bit(bitsize); + for (j=0; j < test_bit; j++) + bitmap_set_next(map); + if (!bitmap_is_prefix(map, test_bit)) + goto error1; + bitmap_clear_all(map); + } + return FALSE; +error1: + printf("get_next error bitsize= %u, prefix_size= %u", bitsize,test_bit); + return TRUE; +} + +my_bool test_prefix(MY_BITMAP *map, uint bitsize) +{ + uint i, j, test_bit; + uint no_loops= bitsize > 128 ? 128 : bitsize; + for (i=0; i < no_loops; i++) + { + test_bit=get_rand_bit(bitsize); + bitmap_set_prefix(map, test_bit); + if (!bitmap_is_prefix(map, test_bit)) + goto error1; + bitmap_clear_all(map); + for (j=0; j < test_bit; j++) + bitmap_set_bit(map, j); + if (!bitmap_is_prefix(map, test_bit)) + goto error2; + bitmap_set_all(map); + for (j=bitsize - 1; ~(j-test_bit); j--) + bitmap_clear_bit(map, j); + if (!bitmap_is_prefix(map, test_bit)) + goto error3; + bitmap_clear_all(map); + } + return FALSE; +error1: + printf("prefix1 error bitsize = %u, prefix_size = %u", bitsize,test_bit); + return TRUE; +error2: + printf("prefix2 error bitsize = %u, prefix_size = %u", bitsize,test_bit); + return TRUE; +error3: + printf("prefix3 error bitsize = %u, prefix_size = %u", bitsize,test_bit); + return TRUE; +} + + +my_bool do_test(uint bitsize) +{ + MY_BITMAP map; + my_bitmap_map buf[1024]; + if (bitmap_init(&map, buf, bitsize, FALSE)) + { + printf("init error for bitsize %d", bitsize); + goto error; + } + if (test_set_get_clear_bit(&map,bitsize)) + goto error; + bitmap_clear_all(&map); + if (test_flip_bit(&map,bitsize)) + goto error; + bitmap_clear_all(&map); + if (test_operators(&map,bitsize)) + goto error; + bitmap_clear_all(&map); + if (test_get_all_bits(&map, bitsize)) + goto error; + bitmap_clear_all(&map); + if (test_compare_operators(&map,bitsize)) + goto error; + bitmap_clear_all(&map); + if (test_count_bits_set(&map,bitsize)) + goto error; + bitmap_clear_all(&map); + if (test_get_first_bit(&map,bitsize)) + goto error; + bitmap_clear_all(&map); + if (test_get_next_bit(&map,bitsize)) + goto error; + if (test_prefix(&map,bitsize)) + goto error; + return FALSE; +error: + printf("\n"); + return TRUE; +} + +int main() +{ + int i; + for (i= 1; i < 4096; i++) + { + printf("Start test for bitsize=%u\n",i); + if (do_test(i)) + return -1; + } + printf("OK\n"); + return 0; +} + +/* + In directory mysys: + make test_bitmap + will build the bitmap tests and ./test_bitmap will execute it +*/ + +#endif diff --git a/externals/mysql/mysys/my_chmod.c b/externals/mysql/mysys/my_chmod.c new file mode 100644 index 0000000..afdea75 --- /dev/null +++ b/externals/mysql/mysys/my_chmod.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" + +/** + @brief Change mode of file. + + @fn my_chmod() + @param name Filename + @param mode_t Mode + @param my_flags Flags + + @notes + The mode of the file given by path or referenced by fildes is changed + + @retval 0 Ok + @retval # Error +*/ + +int my_chmod(const char *name, mode_t mode, myf my_flags) +{ + DBUG_ENTER("my_chmod"); + DBUG_PRINT("my",("name: %s mode: %lu flags: %d", name, (ulong) mode, + my_flags)); + + if (chmod(name, mode)) + { + my_errno= errno; + if (my_flags & MY_WME) + my_error(EE_CANT_CHMOD, MYF(0), name, (ulong) mode, my_errno); + DBUG_RETURN(1); + } + DBUG_RETURN(0); +} diff --git a/externals/mysql/mysys/my_chsize.c b/externals/mysql/mysys/my_chsize.c new file mode 100644 index 0000000..b901381 --- /dev/null +++ b/externals/mysql/mysys/my_chsize.c @@ -0,0 +1,107 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include "m_string.h" + +/* + Change size of file. + + SYNOPSIS + my_chsize() + fd File descriptor + new_length New file size + filler If we don't have truncate, fill up all bytes after + new_length with this character + MyFlags Flags + + DESCRIPTION + my_chsize() truncates file if shorter else fill with the filler character. + The function also changes the file pointer. Usually it points to the end + of the file after execution. + + RETURN VALUE + 0 Ok + 1 Error +*/ +int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) +{ + my_off_t oldsize; + uchar buff[IO_SIZE]; + DBUG_ENTER("my_chsize"); + DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength, + MyFlags)); + + if ((oldsize= my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE))) == newlength) + DBUG_RETURN(0); + + DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize)); + + if (oldsize > newlength) + { +#ifdef _WIN32 + if (my_win_chsize(fd, newlength)) + { + my_errno= errno; + goto err; + } + DBUG_RETURN(0); +#elif defined(HAVE_FTRUNCATE) + if (ftruncate(fd, (off_t) newlength)) + { + my_errno= errno; + goto err; + } + DBUG_RETURN(0); +#elif defined(HAVE_CHSIZE) + if (chsize(fd, (off_t) newlength)) + { + my_errno=errno; + goto err; + } + DBUG_RETURN(0); +#else + /* + Fill space between requested length and true length with 'filler' + We should never come here on any modern machine + */ + if (my_seek(fd, newlength, MY_SEEK_SET, MYF(MY_WME+MY_FAE)) + == MY_FILEPOS_ERROR) + { + goto err; + } + swap_variables(my_off_t, newlength, oldsize); +#endif + } + + /* Full file with 'filler' until it's as big as requested */ + bfill(buff, IO_SIZE, filler); + while (newlength-oldsize > IO_SIZE) + { + if (my_write(fd, buff, IO_SIZE, MYF(MY_NABP))) + goto err; + oldsize+= IO_SIZE; + } + if (my_write(fd,buff,(size_t) (newlength-oldsize), MYF(MY_NABP))) + goto err; + DBUG_RETURN(0); + +err: + DBUG_PRINT("error", ("errno: %d", errno)); + if (MyFlags & MY_WME) + my_error(EE_CANT_CHSIZE, MYF(ME_BELL+ME_WAITTANG), my_errno); + DBUG_RETURN(1); +} /* my_chsize */ diff --git a/externals/mysql/mysys/my_clock.c b/externals/mysql/mysys/my_clock.c new file mode 100644 index 0000000..d17f26e --- /dev/null +++ b/externals/mysql/mysys/my_clock.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "my_global.h" + +#if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__NETWARE__) +#include "mysys_priv.h" +#include +#endif + +long my_clock(void) +{ +#if !defined(__WIN__) && !defined(__NETWARE__) + struct tms tmsbuf; + (void) times(&tmsbuf); + return (tmsbuf.tms_utime + tmsbuf.tms_stime); +#else + return clock(); +#endif +} diff --git a/externals/mysql/mysys/my_compress.c b/externals/mysql/mysys/my_compress.c new file mode 100644 index 0000000..7edd07b --- /dev/null +++ b/externals/mysql/mysys/my_compress.c @@ -0,0 +1,264 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Written by Sinisa Milivojevic */ + +#include +#ifdef HAVE_COMPRESS +#include +#ifndef SCO +#include +#endif +#include + +/* + This replaces the packet with a compressed packet + + SYNOPSIS + my_compress() + packet Data to compress. This is is replaced with the compressed data. + len Length of data to compress at 'packet' + complen out: 0 if packet was not compressed + + RETURN + 1 error. 'len' is not changed' + 0 ok. In this case 'len' contains the size of the compressed packet +*/ + +my_bool my_compress(uchar *packet, size_t *len, size_t *complen) +{ + DBUG_ENTER("my_compress"); + if (*len < MIN_COMPRESS_LENGTH) + { + *complen=0; + DBUG_PRINT("note",("Packet too short: Not compressed")); + } + else + { + uchar *compbuf=my_compress_alloc(packet,len,complen); + if (!compbuf) + DBUG_RETURN(*complen ? 0 : 1); + memcpy(packet,compbuf,*len); + my_free(compbuf,MYF(MY_WME)); + } + DBUG_RETURN(0); +} + + +uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen) +{ + uchar *compbuf; + uLongf tmp_complen; + int res; + *complen= *len * 120 / 100 + 12; + + if (!(compbuf= (uchar *) my_malloc(*complen, MYF(MY_WME)))) + return 0; /* Not enough memory */ + + tmp_complen= (uLongf) *complen; + res= compress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet, (uLong) *len); + *complen= tmp_complen; + + if (res != Z_OK) + { + my_free(compbuf, MYF(MY_WME)); + return 0; + } + + if (*complen >= *len) + { + *complen= 0; + my_free(compbuf, MYF(MY_WME)); + DBUG_PRINT("note",("Packet got longer on compression; Not compressed")); + return 0; + } + /* Store length of compressed packet in *len */ + swap_variables(size_t, *len, *complen); + return compbuf; +} + + +/* + Uncompress packet + + SYNOPSIS + my_uncompress() + packet Compressed data. This is is replaced with the orignal data. + len Length of compressed data + complen Length of the packet buffer (must be enough for the original + data) + + RETURN + 1 error + 0 ok. In this case 'complen' contains the updated size of the + real data. +*/ + +my_bool my_uncompress(uchar *packet, size_t len, size_t *complen) +{ + uLongf tmp_complen; + DBUG_ENTER("my_uncompress"); + + if (*complen) /* If compressed */ + { + uchar *compbuf= (uchar *) my_malloc(*complen,MYF(MY_WME)); + int error; + if (!compbuf) + DBUG_RETURN(1); /* Not enough memory */ + + tmp_complen= (uLongf) *complen; + error= uncompress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet, + (uLong) len); + *complen= tmp_complen; + if (error != Z_OK) + { /* Probably wrong packet */ + DBUG_PRINT("error",("Can't uncompress packet, error: %d",error)); + my_free(compbuf, MYF(MY_WME)); + DBUG_RETURN(1); + } + memcpy(packet, compbuf, *complen); + my_free(compbuf, MYF(MY_WME)); + } + else + *complen= len; + DBUG_RETURN(0); +} + +/* + Internal representation of the frm blob is: + + ver 4 bytes + orglen 4 bytes + complen 4 bytes +*/ + +#define BLOB_HEADER 12 + + +/* + packfrm is a method used to compress the frm file for storage in a + handler. This method was developed for the NDB handler and has been moved + here to serve also other uses. + + SYNOPSIS + packfrm() + data Data reference to frm file data. + len Length of frm file data + out:pack_data Reference to the pointer to the packed frm data + out:pack_len Length of packed frm file data + + NOTES + data is replaced with compressed content + + RETURN VALUES + 0 Success + >0 Failure +*/ + +int packfrm(uchar *data, size_t len, + uchar **pack_data, size_t *pack_len) +{ + int error; + size_t org_len, comp_len, blob_len; + uchar *blob; + DBUG_ENTER("packfrm"); + DBUG_PRINT("enter", ("data: %p len: %lu", data, (ulong) len)); + + error= 1; + org_len= len; + if (my_compress((uchar*)data, &org_len, &comp_len)) + goto err; + + DBUG_PRINT("info", ("org_len: %lu comp_len: %lu", (ulong) org_len, + (ulong) comp_len)); + DBUG_DUMP("compressed", data, org_len); + + error= 2; + blob_len= BLOB_HEADER + org_len; + if (!(blob= (uchar*) my_malloc(blob_len,MYF(MY_WME)))) + goto err; + + /* Store compressed blob in machine independent format */ + int4store(blob, 1); + int4store(blob+4, (uint32) len); + int4store(blob+8, (uint32) org_len); /* compressed length */ + + /* Copy frm data into blob, already in machine independent format */ + memcpy(blob+BLOB_HEADER, data, org_len); + + *pack_data= blob; + *pack_len= blob_len; + error= 0; + + DBUG_PRINT("exit", ("pack_data: %p pack_len: %lu", + *pack_data, (ulong) *pack_len)); +err: + DBUG_RETURN(error); + +} + +/* + unpackfrm is a method used to decompress the frm file received from a + handler. This method was developed for the NDB handler and has been moved + here to serve also other uses for other clustered storage engines. + + SYNOPSIS + unpackfrm() + pack_data Data reference to packed frm file data + out:unpack_data Reference to the pointer to the unpacked frm data + out:unpack_len Length of unpacked frm file data + + RETURN VALUES? + 0 Success + >0 Failure +*/ + +int unpackfrm(uchar **unpack_data, size_t *unpack_len, + const uchar *pack_data) +{ + uchar *data; + size_t complen, orglen; + ulong ver; + DBUG_ENTER("unpackfrm"); + DBUG_PRINT("enter", ("pack_data: %p", pack_data)); + + ver= uint4korr(pack_data); + orglen= uint4korr(pack_data+4); + complen= uint4korr(pack_data+8); + + DBUG_PRINT("blob",("ver: %lu complen: %lu orglen: %lu", + ver, (ulong) complen, (ulong) orglen)); + DBUG_DUMP("blob->data", pack_data + BLOB_HEADER, complen); + + if (ver != 1) + DBUG_RETURN(1); + if (!(data= my_malloc(max(orglen, complen), MYF(MY_WME)))) + DBUG_RETURN(2); + memcpy(data, pack_data + BLOB_HEADER, complen); + + if (my_uncompress(data, complen, &orglen)) + { + my_free(data, MYF(0)); + DBUG_RETURN(3); + } + + *unpack_data= data; + *unpack_len= orglen; + + DBUG_PRINT("exit", ("frmdata: %p len: %lu", *unpack_data, + (ulong) *unpack_len)); + DBUG_RETURN(0); +} +#endif /* HAVE_COMPRESS */ diff --git a/externals/mysql/mysys/my_conio.c b/externals/mysql/mysys/my_conio.c new file mode 100644 index 0000000..b789664 --- /dev/null +++ b/externals/mysql/mysys/my_conio.c @@ -0,0 +1,222 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#include "mysys_priv.h" + +#ifdef __WIN__ + +static HANDLE my_coninpfh= 0; /* console input */ + +/* + functions my_pthread_auto_mutex_lock & my_pthread_auto_mutex_free + are experimental at this moment, they are intended to bring + ability of protecting code sections without necessity to explicitly + initialize synchronization object in one of threads + + if found useful they are to be exported in mysys +*/ + + +/* + int my_pthread_auto_mutex_lock(HANDLE* ph, const char* name, + int id, int time) + NOTES + creates a mutex with given name and tries to lock it time msec. + mutex name is appended with id to allow system wide or process wide + locks. Handle to created mutex returned in ph argument. + + RETURN + 0 thread owns mutex + <>0 error +*/ + +static +int my_pthread_auto_mutex_lock(HANDLE* ph, const char* name, int id, int time) +{ + int res; + char tname[FN_REFLEN]; + + sprintf(tname, "%s-%08X", name, id); + + *ph= CreateMutex(NULL, FALSE, tname); + if (*ph == NULL) + return GetLastError(); + + res= WaitForSingleObject(*ph, time); + + if (res == WAIT_TIMEOUT) + return ERROR_SEM_TIMEOUT; + + if (res == WAIT_FAILED) + return GetLastError(); + + return 0; +} + +/* + int my_pthread_auto_mutex_free(HANDLE* ph) + + NOTES + releases a mutex. + + RETURN + 0 thread released mutex + <>0 error + +*/ +static +int my_pthread_auto_mutex_free(HANDLE* ph) +{ + if (*ph) + { + ReleaseMutex(*ph); + CloseHandle(*ph); + *ph= NULL; + } + + return 0; +} + + +#define pthread_auto_mutex_decl(name) \ + HANDLE __h##name= NULL; + +#define pthread_auto_mutex_lock(name, proc, time) \ + my_pthread_auto_mutex_lock(&__h##name, #name, (proc), (time)) + +#define pthread_auto_mutex_free(name) \ + my_pthread_auto_mutex_free(&__h##name) + + +/* + char* my_cgets() + + NOTES + Replaces _cgets from libc to support input of more than 255 chars. + Reads from the console via ReadConsole into buffer which + should be at least clen characters. + Actual length of string returned in plen. + + WARNING + my_cgets() does NOT check the pushback character buffer (i.e., _chbuf). + Thus, my_cgets() will not return any character that is pushed back by + the _ungetch() call. + + RETURN + string pointer ok + NULL Error + +*/ + +char* my_cgets(char *buffer, size_t clen, size_t* plen) +{ + ULONG state; + char *result; + DWORD plen_res; + CONSOLE_SCREEN_BUFFER_INFO csbi; + + pthread_auto_mutex_decl(my_conio_cs); + + /* lock the console for the current process*/ + if (pthread_auto_mutex_lock(my_conio_cs, GetCurrentProcessId(), INFINITE)) + { + /* can not lock console */ + pthread_auto_mutex_free(my_conio_cs); + return NULL; + } + + /* init console input */ + if (my_coninpfh == 0) + { + /* same handle will be used until process termination */ + my_coninpfh= CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, NULL); + } + + if (my_coninpfh == INVALID_HANDLE_VALUE) + { + /* unlock the console */ + pthread_auto_mutex_free(my_conio_cs); + return(NULL); + } + + GetConsoleMode((HANDLE)my_coninpfh, &state); + SetConsoleMode((HANDLE)my_coninpfh, ENABLE_LINE_INPUT | + ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT); + + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); + + /* + there is no known way to determine allowed buffer size for input + though it is known it should not be more than 64K + so we cut 64K and try first size of screen buffer + if it is still to large we cut half of it and try again + later we may want to cycle from min(clen, 65535) to allowed size + with small decrement to determine exact allowed buffer + */ + clen= min(clen, 65535); + do + { + clen= min(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y); + if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, clen - 1, &plen_res, + NULL)) + { + result= NULL; + clen>>= 1; + } + else + { + result= buffer; + break; + } + } + while (GetLastError() == ERROR_NOT_ENOUGH_MEMORY); + *plen= plen_res; + + /* We go here on error reading the string (Ctrl-C for example) */ + if (!*plen) + result= NULL; /* purecov: inspected */ + + if (result != NULL) + { + if (*plen > 1 && buffer[*plen - 2] == '\r') + { + *plen= *plen - 2; + } + else + { + if (*plen > 0 && buffer[*plen - 1] == '\r') + { + char tmp[3]; + int tmplen= sizeof(tmp); + + *plen= *plen - 1; + /* read /n left in the buffer */ + ReadConsole((HANDLE)my_coninpfh, (LPVOID)tmp, tmplen, &tmplen, NULL); + } + } + buffer[*plen]= '\0'; + } + + SetConsoleMode((HANDLE)my_coninpfh, state); + /* unlock the console */ + pthread_auto_mutex_free(my_conio_cs); + + return result; +} + +#endif /* __WIN__ */ diff --git a/externals/mysql/mysys/my_copy.c b/externals/mysql/mysys/my_copy.c new file mode 100644 index 0000000..60096e9 --- /dev/null +++ b/externals/mysql/mysys/my_copy.c @@ -0,0 +1,122 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include /* for stat */ +#include +#if defined(HAVE_UTIME_H) +#include +#elif defined(HAVE_SYS_UTIME_H) +#include +#elif !defined(HPUX10) +#include +struct utimbuf { + time_t actime; + time_t modtime; +}; +#endif + + +/* + int my_copy(const char *from, const char *to, myf MyFlags) + + NOTES + Ordinary ownership and accesstimes are copied from 'from-file' + If MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then + the modes of to-file isn't changed + If MyFlags & MY_DONT_OVERWRITE_FILE is set, we will give an error + if the file existed. + + WARNING + Don't set MY_FNABP or MY_NABP bits on when calling this function ! + + RETURN + 0 ok + # Error + +*/ + +int my_copy(const char *from, const char *to, myf MyFlags) +{ + uint Count; + my_bool new_file_stat= 0; /* 1 if we could stat "to" */ + int create_flag; + File from_file,to_file; + uchar buff[IO_SIZE]; + MY_STAT stat_buff,new_stat_buff; + DBUG_ENTER("my_copy"); + DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); + + from_file=to_file= -1; + DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */ + if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */ + new_file_stat= test(my_stat((char*) to, &new_stat_buff, MYF(0))); + + if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0) + { + if (!my_stat(from, &stat_buff, MyFlags)) + { + my_errno=errno; + goto err; + } + if (MyFlags & MY_HOLD_ORIGINAL_MODES && new_file_stat) + stat_buff=new_stat_buff; + create_flag= (MyFlags & MY_DONT_OVERWRITE_FILE) ? O_EXCL : O_TRUNC; + + if ((to_file= my_create(to,(int) stat_buff.st_mode, + O_WRONLY | create_flag | O_BINARY | O_SHARE, + MyFlags)) < 0) + goto err; + + while ((Count=my_read(from_file, buff, sizeof(buff), MyFlags)) != 0) + { + if (Count == (uint) -1 || + my_write(to_file,buff,Count,MYF(MyFlags | MY_NABP))) + goto err; + } + + if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags)) + DBUG_RETURN(-1); /* Error on close */ + + /* Copy modes if possible */ + + if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) + DBUG_RETURN(0); /* File copyed but not stat */ + (void) chmod(to, stat_buff.st_mode & 07777); /* Copy modes */ +#if !defined(__WIN__) && !defined(__NETWARE__) + (void) chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */ +#endif +#if !defined(VMS) && !defined(__ZTC__) + if (MyFlags & MY_COPYTIME) + { + struct utimbuf timep; + timep.actime = stat_buff.st_atime; + timep.modtime = stat_buff.st_mtime; + (void) utime((char*) to, &timep); /* last accessed and modified times */ + } +#endif + DBUG_RETURN(0); + } + +err: + if (from_file >= 0) (void) my_close(from_file,MyFlags); + if (to_file >= 0) + { + (void) my_close(to_file, MyFlags); + /* attempt to delete the to-file we've partially written */ + (void) my_delete(to, MyFlags); + } + DBUG_RETURN(-1); +} /* my_copy */ diff --git a/externals/mysql/mysys/my_create.c b/externals/mysql/mysys/my_create.c new file mode 100644 index 0000000..d043627 --- /dev/null +++ b/externals/mysql/mysys/my_create.c @@ -0,0 +1,76 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include +#include "mysys_err.h" +#include +#include +#if defined(_WIN32) +#include +#endif + + /* + ** Create a new file + ** Arguments: + ** Path-name of file + ** Read | write on file (umask value) + ** Read & Write on open file + ** Special flags + */ + + +File my_create(const char *FileName, int CreateFlags, int access_flags, + myf MyFlags) +{ + int fd, rc; + DBUG_ENTER("my_create"); + DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d", + FileName, CreateFlags, access_flags, MyFlags)); + +#if !defined(NO_OPEN_3) + fd= open((char *) FileName, access_flags | O_CREAT, + CreateFlags ? CreateFlags : my_umask); +#elif defined(_WIN32) + fd= my_win_open(FileName, access_flags | O_CREAT); +#else + fd= open(FileName, access_flags); +#endif + + if ((MyFlags & MY_SYNC_DIR) && (fd >=0) && + my_sync_dir_by_file(FileName, MyFlags)) + { + my_close(fd, MyFlags); + fd= -1; + } + + rc= my_register_filename(fd, FileName, FILE_BY_CREATE, + EE_CANTCREATEFILE, MyFlags); + /* + my_register_filename() may fail on some platforms even if the call to + *open() above succeeds. In this case, don't leave the stale file because + callers assume the file to not exist if my_create() fails, so they don't + do any cleanups. + */ + if (unlikely(fd >= 0 && rc < 0)) + { + int tmp= my_errno; + my_close(fd, MyFlags); + my_delete(FileName, MyFlags); + my_errno= tmp; + } + + DBUG_RETURN(rc); +} /* my_create */ diff --git a/externals/mysql/mysys/my_delete.c b/externals/mysql/mysys/my_delete.c new file mode 100644 index 0000000..edee1c4 --- /dev/null +++ b/externals/mysql/mysys/my_delete.c @@ -0,0 +1,115 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include + +int my_delete(const char *name, myf MyFlags) +{ + int err; + DBUG_ENTER("my_delete"); + DBUG_PRINT("my",("name %s MyFlags %d", name, MyFlags)); + + if ((err = unlink(name)) == -1) + { + my_errno=errno; + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_DELETE,MYF(ME_BELL+ME_WAITTANG+(MyFlags & ME_NOINPUT)), + name,errno); + } + else if ((MyFlags & MY_SYNC_DIR) && + my_sync_dir_by_file(name, MyFlags)) + err= -1; + DBUG_RETURN(err); +} /* my_delete */ + +#if defined(__WIN__) +/** + Delete file which is possibly not closed. + + This function is intended to be used exclusively as a temporal solution + for Win NT in case when it is needed to delete a not closed file (note + that the file must be opened everywhere with FILE_SHARE_DELETE mode). + Deleting not-closed files can not be supported on Win 98|ME (and because + of that is considered harmful). + + The function deletes the file with its preliminary renaming. This is + because when not-closed share-delete file is deleted it still lives on + a disk until it will not be closed everwhere. This may conflict with an + attempt to create a new file with the same name. The deleted file is + renamed to ..deleted where - the initial name of the + file, - a hexadecimal number chosen to make the temporal name to + be unique. + + @param the name of the being deleted file + @param the flags instructing how to react on an error internally in + the function + + @note The per-thread @c my_errno holds additional info for a caller to + decide how critical the error can be. + + @retval + 0 ok + @retval + 1 error + + +*/ +int nt_share_delete(const char *name, myf MyFlags) +{ + char buf[MAX_PATH + 20]; + ulong cnt; + DBUG_ENTER("nt_share_delete"); + DBUG_PRINT("my",("name %s MyFlags %d", name, MyFlags)); + + for (cnt= GetTickCount(); cnt; cnt--) + { + errno= 0; + sprintf(buf, "%s.%08X.deleted", name, cnt); + if (MoveFile(name, buf)) + break; + + if ((errno= GetLastError()) == ERROR_ALREADY_EXISTS) + continue; + + /* This happened during tests with MERGE tables. */ + if (errno == ERROR_ACCESS_DENIED) + continue; + + DBUG_PRINT("warning", ("Failed to rename %s to %s, errno: %d", + name, buf, errno)); + break; + } + + if (errno == ERROR_FILE_NOT_FOUND) + { + my_errno= ENOENT; // marking, that `name' doesn't exist + } + else if (errno == 0) + { + if (DeleteFile(buf)) + DBUG_RETURN(0); + else if ((my_errno= GetLastError()) == 0) + my_errno= ENOENT; // marking, that `buf' doesn't exist + } else + my_errno= errno; + + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_DELETE, MYF(ME_BELL + ME_WAITTANG + (MyFlags & ME_NOINPUT)), + name, my_errno); + DBUG_RETURN(-1); +} +#endif diff --git a/externals/mysql/mysys/my_div.c b/externals/mysql/mysys/my_div.c new file mode 100644 index 0000000..d29d366 --- /dev/null +++ b/externals/mysql/mysys/my_div.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" + +/* + Get filename of file + + SYNOPSIS + my_filename() + fd File descriptor +*/ + +char * my_filename(File fd) +{ + DBUG_ENTER("my_filename"); + if ((uint) fd >= (uint) my_file_limit) + DBUG_RETURN((char*) "UNKNOWN"); + if (fd >= 0 && my_file_info[fd].type != UNOPEN) + { + DBUG_RETURN(my_file_info[fd].name); + } + else + DBUG_RETURN((char*) "UNOPENED"); /* Debug message */ +} diff --git a/externals/mysql/mysys/my_dup.c b/externals/mysql/mysys/my_dup.c new file mode 100644 index 0000000..5fdd6e9 --- /dev/null +++ b/externals/mysql/mysys/my_dup.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include +#if defined(__WIN__) +#include +#endif + + /* Open a file */ + +File my_dup(File file, myf MyFlags) +{ + File fd; + const char *filename; + DBUG_ENTER("my_dup"); + DBUG_PRINT("my",("file: %d MyFlags: %d", file, MyFlags)); +#ifdef _WIN32 + fd= my_win_dup(file); +#else + fd= dup(file); +#endif + filename= (((uint) file < my_file_limit) ? + my_file_info[(int) file].name : "Unknown"); + DBUG_RETURN(my_register_filename(fd, filename, FILE_BY_DUP, + EE_FILENOTFOUND, MyFlags)); +} /* my_open */ diff --git a/externals/mysql/mysys/my_error.c b/externals/mysql/mysys/my_error.c new file mode 100644 index 0000000..dea5748 --- /dev/null +++ b/externals/mysql/mysys/my_error.c @@ -0,0 +1,289 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include +#include + +/* Max length of a error message. Should be kept in sync with MYSQL_ERRMSG_SIZE. */ +#define ERRMSGSIZE (512) + +/* Define some external variables for error handling */ + +/* + WARNING! + my_error family functions have to be used according following rules: + - if message have not parameters use my_message(ER_CODE, ER(ER_CODE), MYF(N)) + - if message registered use my_error(ER_CODE, MYF(N), ...). + - With some special text of errror message use: + my_printf_error(ER_CODE, format, MYF(N), ...) +*/ + +/* + Message texts are registered into a linked list of 'my_err_head' structs. + Each struct contains (1.) an array of pointers to C character strings with + '\0' termination, (2.) the error number for the first message in the array + (array index 0) and (3.) the error number for the last message in the array + (array index (last - first)). + The array may contain gaps with NULL pointers and pointers to empty strings. + Both kinds of gaps will be translated to "Unknown error %d.", if my_error() + is called with a respective error number. + The list of header structs is sorted in increasing order of error numbers. + Negative error numbers are allowed. Overlap of error numbers is not allowed. + Not registered error numbers will be translated to "Unknown error %d.". +*/ +static struct my_err_head +{ + struct my_err_head *meh_next; /* chain link */ + const char **meh_errmsgs; /* error messages array */ + int meh_first; /* error number matching array slot 0 */ + int meh_last; /* error number matching last slot */ +} my_errmsgs_globerrs = {NULL, globerrs, EE_ERROR_FIRST, EE_ERROR_LAST}; + +static struct my_err_head *my_errmsgs_list= &my_errmsgs_globerrs; + + +/* + Error message to user + + SYNOPSIS + my_error() + nr Errno + MyFlags Flags + ... variable list +*/ + +void my_error(int nr, myf MyFlags, ...) +{ + const char *format; + struct my_err_head *meh_p; + va_list args; + char ebuff[ERRMSGSIZE]; + DBUG_ENTER("my_error"); + DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno)); + + /* Search for the error messages array, which could contain the message. */ + for (meh_p= my_errmsgs_list; meh_p; meh_p= meh_p->meh_next) + if (nr <= meh_p->meh_last) + break; + + /* get the error message string. Default, if NULL or empty string (""). */ + if (! (format= (meh_p && (nr >= meh_p->meh_first)) ? + meh_p->meh_errmsgs[nr - meh_p->meh_first] : NULL) || ! *format) + (void) my_snprintf(ebuff, sizeof(ebuff), "Unknown error %d", nr); + else + { + va_start(args,MyFlags); + (void) my_vsnprintf(ebuff, sizeof(ebuff), format, args); + va_end(args); + } + (*error_handler_hook)(nr, ebuff, MyFlags); + DBUG_VOID_RETURN; +} + + +/* + Error as printf + + SYNOPSIS + my_printf_error() + error Errno + format Format string + MyFlags Flags + ... variable list +*/ + +void my_printf_error(uint error, const char *format, myf MyFlags, ...) +{ + va_list args; + char ebuff[ERRMSGSIZE]; + DBUG_ENTER("my_printf_error"); + DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d format: %s", + error, MyFlags, errno, format)); + + va_start(args,MyFlags); + (void) my_vsnprintf(ebuff, sizeof(ebuff), format, args); + va_end(args); + (*error_handler_hook)(error, ebuff, MyFlags); + DBUG_VOID_RETURN; +} + + +/* + Error with va_list + + SYNOPSIS + my_printv_error() + error Errno + format Format string + MyFlags Flags + ... variable list +*/ + +void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap) +{ + char ebuff[ERRMSGSIZE]; + DBUG_ENTER("my_printv_error"); + DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d format: %s", + error, MyFlags, errno, format)); + + (void) my_vsnprintf(ebuff, sizeof(ebuff), format, ap); + (*error_handler_hook)(error, ebuff, MyFlags); + DBUG_VOID_RETURN; +} + + +/* + Give message using error_handler_hook + + SYNOPSIS + my_message() + error Errno + str Error message + MyFlags Flags +*/ + +void my_message(uint error, const char *str, register myf MyFlags) +{ + (*error_handler_hook)(error, str, MyFlags); +} + + +/* + Register error messages for use with my_error(). + + SYNOPSIS + my_error_register() + errmsgs array of pointers to error messages + first error number of first message in the array + last error number of last message in the array + + DESCRIPTION + The pointer array is expected to contain addresses to NUL-terminated + C character strings. The array contains (last - first + 1) pointers. + NULL pointers and empty strings ("") are allowed. These will be mapped to + "Unknown error" when my_error() is called with a matching error number. + This function registers the error numbers 'first' to 'last'. + No overlapping with previously registered error numbers is allowed. + + RETURN + 0 OK + != 0 Error +*/ + +int my_error_register(const char **errmsgs, int first, int last) +{ + struct my_err_head *meh_p; + struct my_err_head **search_meh_pp; + + /* Allocate a new header structure. */ + if (! (meh_p= (struct my_err_head*) my_malloc(sizeof(struct my_err_head), + MYF(MY_WME)))) + return 1; + meh_p->meh_errmsgs= errmsgs; + meh_p->meh_first= first; + meh_p->meh_last= last; + + /* Search for the right position in the list. */ + for (search_meh_pp= &my_errmsgs_list; + *search_meh_pp; + search_meh_pp= &(*search_meh_pp)->meh_next) + { + if ((*search_meh_pp)->meh_last > first) + break; + } + + /* Error numbers must be unique. No overlapping is allowed. */ + if (*search_meh_pp && ((*search_meh_pp)->meh_first <= last)) + { + my_free((uchar*)meh_p, MYF(0)); + return 1; + } + + /* Insert header into the chain. */ + meh_p->meh_next= *search_meh_pp; + *search_meh_pp= meh_p; + return 0; +} + + +/* + Unregister formerly registered error messages. + + SYNOPSIS + my_error_unregister() + first error number of first message + last error number of last message + + DESCRIPTION + This function unregisters the error numbers 'first' to 'last'. + These must have been previously registered by my_error_register(). + 'first' and 'last' must exactly match the registration. + If a matching registration is present, the header is removed from the + list and the pointer to the error messages pointers array is returned. + Otherwise, NULL is returned. + + RETURN + non-NULL OK, returns address of error messages pointers array. + NULL Error, no such number range registered. +*/ + +const char **my_error_unregister(int first, int last) +{ + struct my_err_head *meh_p; + struct my_err_head **search_meh_pp; + const char **errmsgs; + + /* Search for the registration in the list. */ + for (search_meh_pp= &my_errmsgs_list; + *search_meh_pp; + search_meh_pp= &(*search_meh_pp)->meh_next) + { + if (((*search_meh_pp)->meh_first == first) && + ((*search_meh_pp)->meh_last == last)) + break; + } + if (! *search_meh_pp) + return NULL; + + /* Remove header from the chain. */ + meh_p= *search_meh_pp; + *search_meh_pp= meh_p->meh_next; + + /* Save the return value and free the header. */ + errmsgs= meh_p->meh_errmsgs; + my_free((uchar*) meh_p, MYF(0)); + + return errmsgs; +} + + +void my_error_unregister_all(void) +{ + struct my_err_head *cursor, *saved_next; + + for (cursor= my_errmsgs_globerrs.meh_next; cursor != NULL; cursor= saved_next) + { + /* We need this ptr, but we're about to free its container, so save it. */ + saved_next= cursor->meh_next; + + my_free((uchar*) cursor, MYF(0)); + } + my_errmsgs_globerrs.meh_next= NULL; /* Freed in first iteration above. */ + + my_errmsgs_list= &my_errmsgs_globerrs; +} diff --git a/externals/mysql/mysys/my_file.c b/externals/mysql/mysys/my_file.c new file mode 100644 index 0000000..ec0c9c4 --- /dev/null +++ b/externals/mysql/mysys/my_file.c @@ -0,0 +1,135 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "my_static.h" +#include + +/* + set how many open files we want to be able to handle + + SYNOPSIS + set_maximum_open_files() + max_file_limit Files to open + + NOTES + The request may not fulfilled becasue of system limitations + + RETURN + Files available to open. + May be more or less than max_file_limit! +*/ + +#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) + +#ifndef RLIM_INFINITY +#define RLIM_INFINITY ((uint) 0xffffffff) +#endif + +static uint set_max_open_files(uint max_file_limit) +{ + struct rlimit rlimit; + uint old_cur; + DBUG_ENTER("set_max_open_files"); + DBUG_PRINT("enter",("files: %u", max_file_limit)); + + if (!getrlimit(RLIMIT_NOFILE,&rlimit)) + { + old_cur= (uint) rlimit.rlim_cur; + DBUG_PRINT("info", ("rlim_cur: %u rlim_max: %u", + (uint) rlimit.rlim_cur, + (uint) rlimit.rlim_max)); + if (rlimit.rlim_cur == RLIM_INFINITY) + rlimit.rlim_cur = max_file_limit; + if (rlimit.rlim_cur >= max_file_limit) + DBUG_RETURN(rlimit.rlim_cur); /* purecov: inspected */ + rlimit.rlim_cur= rlimit.rlim_max= max_file_limit; + if (setrlimit(RLIMIT_NOFILE, &rlimit)) + max_file_limit= old_cur; /* Use original value */ + else + { + rlimit.rlim_cur= 0; /* Safety if next call fails */ + (void) getrlimit(RLIMIT_NOFILE,&rlimit); + DBUG_PRINT("info", ("rlim_cur: %u", (uint) rlimit.rlim_cur)); + if (rlimit.rlim_cur) /* If call didn't fail */ + max_file_limit= (uint) rlimit.rlim_cur; + } + } + DBUG_PRINT("exit",("max_file_limit: %u", max_file_limit)); + DBUG_RETURN(max_file_limit); +} + +#else +static int set_max_open_files(uint max_file_limit) +{ + /* We don't know the limit. Return best guess */ + return min(max_file_limit, OS_FILE_LIMIT); +} +#endif + + +/* + Change number of open files + + SYNOPSIS: + my_set_max_open_files() + files Number of requested files + + RETURN + number of files available for open +*/ + +uint my_set_max_open_files(uint files) +{ + struct st_my_file_info *tmp; + DBUG_ENTER("my_set_max_open_files"); + DBUG_PRINT("enter",("files: %u my_file_limit: %u", files, my_file_limit)); + + files+= MY_FILE_MIN; + files= set_max_open_files(min(files, OS_FILE_LIMIT)); + if (files <= MY_NFILE) + DBUG_RETURN(files); + + if (!(tmp= (struct st_my_file_info*) my_malloc(sizeof(*tmp) * files, + MYF(MY_WME)))) + DBUG_RETURN(MY_NFILE); + + /* Copy any initialized files */ + memcpy((char*) tmp, (char*) my_file_info, + sizeof(*tmp) * min(my_file_limit, files)); + bzero((char*) (tmp + my_file_limit), + max((int) (files- my_file_limit), 0)*sizeof(*tmp)); + my_free_open_file_info(); /* Free if already allocated */ + my_file_info= tmp; + my_file_limit= files; + DBUG_PRINT("exit",("files: %u", files)); + DBUG_RETURN(files); +} + + +void my_free_open_file_info() +{ + DBUG_ENTER("my_free_file_info"); + if (my_file_info != my_file_info_default) + { + /* Copy data back for my_print_open_files */ + memcpy((char*) my_file_info_default, my_file_info, + sizeof(*my_file_info_default)* MY_NFILE); + my_free((char*) my_file_info, MYF(0)); + my_file_info= my_file_info_default; + my_file_limit= MY_NFILE; + } + DBUG_VOID_RETURN; +} diff --git a/externals/mysql/mysys/my_fopen.c b/externals/mysql/mysys/my_fopen.c new file mode 100644 index 0000000..ef8a385 --- /dev/null +++ b/externals/mysql/mysys/my_fopen.c @@ -0,0 +1,226 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "my_static.h" +#include +#include "mysys_err.h" + +static void make_ftype(char * to,int flag); + +/* + Open a file as stream + + SYNOPSIS + my_fopen() + FileName Path-name of file + Flags Read | write | append | trunc (like for open()) + MyFlags Flags for handling errors + + RETURN + 0 Error + # File handler +*/ + +FILE *my_fopen(const char *filename, int flags, myf MyFlags) +{ + FILE *fd; + char type[5]; + DBUG_ENTER("my_fopen"); + DBUG_PRINT("my",("Name: '%s' flags: %d MyFlags: %d", + filename, flags, MyFlags)); + + make_ftype(type,flags); + +#ifdef _WIN32 + fd= my_win_fopen(filename, type); +#else + fd= fopen(filename, type); +#endif + if (fd != 0) + { + /* + The test works if MY_NFILE < 128. The problem is that fileno() is char + on some OS (SUNOS). Actually the filename save isn't that important + so we can ignore if this doesn't work. + */ + + int filedesc= my_fileno(fd); + if ((uint)filedesc >= my_file_limit) + { + thread_safe_increment(my_stream_opened,&THR_LOCK_open); + DBUG_RETURN(fd); /* safeguard */ + } + pthread_mutex_lock(&THR_LOCK_open); + if ((my_file_info[filedesc].name= (char*) + my_strdup(filename,MyFlags))) + { + my_stream_opened++; + my_file_total_opened++; + my_file_info[filedesc].type= STREAM_BY_FOPEN; + pthread_mutex_unlock(&THR_LOCK_open); + DBUG_PRINT("exit",("stream: %p", fd)); + DBUG_RETURN(fd); + } + pthread_mutex_unlock(&THR_LOCK_open); + (void) my_fclose(fd,MyFlags); + my_errno=ENOMEM; + } + else + my_errno=errno; + DBUG_PRINT("error",("Got error %d on open",my_errno)); + if (MyFlags & (MY_FFNF | MY_FAE | MY_WME)) + my_error((flags & O_RDONLY) || (flags == O_RDONLY ) ? EE_FILENOTFOUND : + EE_CANTCREATEFILE, + MYF(ME_BELL+ME_WAITTANG), filename, my_errno); + DBUG_RETURN((FILE*) 0); +} /* my_fopen */ + + + /* Close a stream */ + +/* Close a stream */ +int my_fclose(FILE *fd, myf MyFlags) +{ + int err,file; + DBUG_ENTER("my_fclose"); + DBUG_PRINT("my",("stream: %p MyFlags: %d", fd, MyFlags)); + + pthread_mutex_lock(&THR_LOCK_open); + file= my_fileno(fd); +#ifndef _WIN32 + err= fclose(fd); +#else + err= my_win_fclose(fd); +#endif + if(err < 0) + { + my_errno=errno; + if (MyFlags & (MY_FAE | MY_WME)) + my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG), + my_filename(file),errno); + } + else + my_stream_opened--; + if ((uint) file < my_file_limit && my_file_info[file].type != UNOPEN) + { + my_file_info[file].type = UNOPEN; + my_free(my_file_info[file].name, MYF(MY_ALLOW_ZERO_PTR)); + } + pthread_mutex_unlock(&THR_LOCK_open); + DBUG_RETURN(err); +} /* my_fclose */ + + + /* Make a stream out of a file handle */ + /* Name may be 0 */ + +FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags) +{ + FILE *fd; + char type[5]; + DBUG_ENTER("my_fdopen"); + DBUG_PRINT("my",("fd: %d Flags: %d MyFlags: %d", + Filedes, Flags, MyFlags)); + + make_ftype(type,Flags); +#ifdef _WIN32 + fd= my_win_fdopen(Filedes, type); +#else + fd= fdopen(Filedes, type); +#endif + if (!fd) + { + my_errno=errno; + if (MyFlags & (MY_FAE | MY_WME)) + my_error(EE_CANT_OPEN_STREAM, MYF(ME_BELL+ME_WAITTANG),errno); + } + else + { + pthread_mutex_lock(&THR_LOCK_open); + my_stream_opened++; + if ((uint) Filedes < (uint) my_file_limit) + { + if (my_file_info[Filedes].type != UNOPEN) + { + my_file_opened--; /* File is opened with my_open ! */ + } + else + { + my_file_info[Filedes].name= my_strdup(name,MyFlags); + } + my_file_info[Filedes].type = STREAM_BY_FDOPEN; + } + pthread_mutex_unlock(&THR_LOCK_open); + } + + DBUG_PRINT("exit",("stream: %p", fd)); + DBUG_RETURN(fd); +} /* my_fdopen */ + + +/* + Make a fopen() typestring from a open() type bitmap + + SYNOPSIS + make_ftype() + to String for fopen() is stored here + flag Flag used by open() + + IMPLEMENTATION + This routine attempts to find the best possible match + between a numeric option and a string option that could be + fed to fopen. There is not a 1 to 1 mapping between the two. + + NOTE + On Unix, O_RDONLY is usually 0 + + MAPPING + r == O_RDONLY + w == O_WRONLY|O_TRUNC|O_CREAT + a == O_WRONLY|O_APPEND|O_CREAT + r+ == O_RDWR + w+ == O_RDWR|O_TRUNC|O_CREAT + a+ == O_RDWR|O_APPEND|O_CREAT +*/ + +static void make_ftype(register char * to, register int flag) +{ + /* check some possible invalid combinations */ + DBUG_ASSERT((flag & (O_TRUNC | O_APPEND)) != (O_TRUNC | O_APPEND)); + DBUG_ASSERT((flag & (O_WRONLY | O_RDWR)) != (O_WRONLY | O_RDWR)); + + if ((flag & (O_RDONLY|O_WRONLY)) == O_WRONLY) + *to++= (flag & O_APPEND) ? 'a' : 'w'; + else if (flag & O_RDWR) + { + /* Add '+' after theese */ + if (flag & (O_TRUNC | O_CREAT)) + *to++= 'w'; + else if (flag & O_APPEND) + *to++= 'a'; + else + *to++= 'r'; + *to++= '+'; + } + else + *to++= 'r'; + +#if FILE_BINARY /* If we have binary-files */ + if (flag & FILE_BINARY) + *to++='b'; +#endif + *to='\0'; +} /* make_ftype */ diff --git a/externals/mysql/mysys/my_fstream.c b/externals/mysql/mysys/my_fstream.c new file mode 100644 index 0000000..c7006e0 --- /dev/null +++ b/externals/mysql/mysys/my_fstream.c @@ -0,0 +1,195 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* USE_MY_STREAM isn't set because we can't thrust my_fclose! */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include + +#ifdef HAVE_FSEEKO +#undef ftell +#undef fseek +#define ftell(A) ftello(A) +#define fseek(A,B,C) fseeko((A),(B),(C)) +#endif + +/* + Read a chunk of bytes from a FILE + + SYNOPSIS + my_fread() + stream File descriptor + Buffer Buffer to read to + Count Number of bytes to read + MyFlags Flags on what to do on error + + RETURN + (size_t) -1 Error + # Number of bytes read + */ + +size_t my_fread(FILE *stream, uchar *Buffer, size_t Count, myf MyFlags) +{ + size_t readbytes; + DBUG_ENTER("my_fread"); + DBUG_PRINT("my",("stream: %p Buffer: %p Count: %u MyFlags: %d", + stream, Buffer, (uint) Count, MyFlags)); + + if ((readbytes= fread(Buffer, sizeof(char), Count, stream)) != Count) + { + DBUG_PRINT("error",("Read only %d bytes", (int) readbytes)); + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) + { + if (ferror(stream)) + my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG), + my_filename(my_fileno(stream)),errno); + else + if (MyFlags & (MY_NABP | MY_FNABP)) + my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG), + my_filename(my_fileno(stream)),errno); + } + my_errno=errno ? errno : -1; + if (ferror(stream) || MyFlags & (MY_NABP | MY_FNABP)) + DBUG_RETURN((size_t) -1); /* Return with error */ + } + if (MyFlags & (MY_NABP | MY_FNABP)) + DBUG_RETURN(0); /* Read ok */ + DBUG_RETURN(readbytes); +} /* my_fread */ + + +/* + Write a chunk of bytes to a stream + + my_fwrite() + stream File descriptor + Buffer Buffer to write from + Count Number of bytes to write + MyFlags Flags on what to do on error + + RETURN + (size_t) -1 Error + # Number of bytes written +*/ + +size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags) +{ + size_t writtenbytes =0; + my_off_t seekptr; +#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM) + uint errors; +#endif + DBUG_ENTER("my_fwrite"); + DBUG_PRINT("my",("stream: %p Buffer: %p Count: %u MyFlags: %d", + stream, Buffer, (uint) Count, MyFlags)); + +#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM) + errors=0; +#endif + seekptr= ftell(stream); + for (;;) + { + size_t written; + if ((written = (size_t) fwrite((char*) Buffer,sizeof(char), + Count, stream)) != Count) + { + DBUG_PRINT("error",("Write only %d bytes", (int) writtenbytes)); + my_errno=errno; + if (written != (size_t) -1) + { + seekptr+=written; + Buffer+=written; + writtenbytes+=written; + Count-=written; + } +#ifdef EINTR + if (errno == EINTR) + { + (void) my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)); + continue; + } +#endif +#if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM) +#ifdef THREAD + if (my_thread_var->abort) + MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ +#endif + if ((errno == ENOSPC || errno == EDQUOT) && + (MyFlags & MY_WAIT_IF_FULL)) + { + wait_for_free_space("[stream]", errors); + errors++; + (void) my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)); + continue; + } +#endif + if (ferror(stream) || (MyFlags & (MY_NABP | MY_FNABP))) + { + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) + { + my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG), + my_filename(my_fileno(stream)),errno); + } + writtenbytes= (size_t) -1; /* Return that we got error */ + break; + } + } + if (MyFlags & (MY_NABP | MY_FNABP)) + writtenbytes= 0; /* Everything OK */ + else + writtenbytes+= written; + break; + } + DBUG_RETURN(writtenbytes); +} /* my_fwrite */ + + +/* Seek to position in file */ + +my_off_t my_fseek(FILE *stream, my_off_t pos, int whence, + myf MyFlags __attribute__((unused))) +{ + DBUG_ENTER("my_fseek"); + DBUG_PRINT("my",("stream: %p pos: %lu whence: %d MyFlags: %d", + stream, (long) pos, whence, MyFlags)); + DBUG_RETURN(fseek(stream, (off_t) pos, whence) ? + MY_FILEPOS_ERROR : (my_off_t) ftell(stream)); +} /* my_seek */ + + +/* Tell current position of file */ + +my_off_t my_ftell(FILE *stream, myf MyFlags __attribute__((unused))) +{ + off_t pos; + DBUG_ENTER("my_ftell"); + DBUG_PRINT("my",("stream: %p MyFlags: %d", stream, MyFlags)); + pos=ftell(stream); + DBUG_PRINT("exit",("ftell: %lu",(ulong) pos)); + DBUG_RETURN((my_off_t) pos); +} /* my_ftell */ + + +/* Get a File corresponding to the stream*/ +int my_fileno(FILE *f) +{ +#ifdef _WIN32 + return my_win_fileno(f); +#else + return fileno(f); +#endif +} diff --git a/externals/mysql/mysys/my_gethostbyname.c b/externals/mysql/mysys/my_gethostbyname.c new file mode 100644 index 0000000..067fdfe --- /dev/null +++ b/externals/mysql/mysys/my_gethostbyname.c @@ -0,0 +1,111 @@ +/* Copyright (C) 2002, 2004 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* Thread safe version of gethostbyname_r() */ + +#include "mysys_priv.h" +#if !defined(__WIN__) +#include +#endif +#include + +/* This file is not needed if my_gethostbyname_r is a macro */ +#if !defined(my_gethostbyname_r) + +/* + Emulate SOLARIS style calls, not because it's better, but just to make the + usage of getbostbyname_r simpler. +*/ + +#if defined(HAVE_GETHOSTBYNAME_R) + +#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) + +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop) +{ + struct hostent *hp; + DBUG_ASSERT((size_t) buflen >= sizeof(*result)); + if (gethostbyname_r(name,result, buffer, (size_t) buflen, &hp, h_errnop)) + return 0; + return hp; +} + +#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT) + +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop) +{ + if (gethostbyname_r(name,result,(struct hostent_data *) buffer) == -1) + { + *h_errnop= errno; + return 0; + } + return result; +} + +#else + +/* gethostbyname_r with similar interface as gethostbyname() */ + +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop) +{ + struct hostent *hp; + DBUG_ASSERT(buflen >= sizeof(struct hostent_data)); + hp= gethostbyname_r(name,result,(struct hostent_data *) buffer); + *h_errnop= errno; + return hp; +} +#endif /* GLIBC2_STYLE_GETHOSTBYNAME_R */ + +#else /* !HAVE_GETHOSTBYNAME_R */ + +#ifdef THREAD +extern pthread_mutex_t LOCK_gethostbyname_r; +#endif + +/* + No gethostbyname_r() function exists. + In this case we have to keep a mutex over the call to ensure that no + other thread is going to reuse the internal memory. + + The user is responsible to call my_gethostbyname_r_free() when he + is finished with the structure. +*/ + +struct hostent *my_gethostbyname_r(const char *name, + struct hostent *result, char *buffer, + int buflen, int *h_errnop) +{ + struct hostent *hp; + pthread_mutex_lock(&LOCK_gethostbyname_r); + hp= gethostbyname(name); + *h_errnop= h_errno; + return hp; +} + +void my_gethostbyname_r_free() +{ + pthread_mutex_unlock(&LOCK_gethostbyname_r); +} + +#endif /* !HAVE_GETHOSTBYNAME_R */ +#endif /* !my_gethostbyname_r */ diff --git a/externals/mysql/mysys/my_gethwaddr.c b/externals/mysql/mysys/my_gethwaddr.c new file mode 100644 index 0000000..7fae1a5 --- /dev/null +++ b/externals/mysql/mysys/my_gethwaddr.c @@ -0,0 +1,222 @@ +/* Copyright (C) 2004 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* get hardware address for an interface */ +/* if there are many available, any non-zero one can be used */ + +#include "mysys_priv.h" +#include + +#ifndef MAIN + +#if defined(__FreeBSD__) || defined(__linux__) +static my_bool memcpy_and_test(uchar *to, uchar *from, uint len) +{ + uint i, res=1; + + for (i=0; i < len; i++) + if ((*to++= *from++)) + res=0; + return res; +} +#endif /* FreeBSD || linux */ + +#ifdef __FreeBSD__ + +#include +#include +#include +#include +#include + +my_bool my_gethwaddr(uchar *to) +{ + size_t len; + uchar *buf, *next, *end, *addr; + struct if_msghdr *ifm; + struct sockaddr_dl *sdl; + int i, res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; + + if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1) + goto err; + if (!(buf = alloca(len))) + goto err; + if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) + goto err; + + end = buf + len; + + for (next = buf ; res && next < end ; next += ifm->ifm_msglen) + { + ifm = (struct if_msghdr *)next; + if (ifm->ifm_type == RTM_IFINFO) + { + sdl = (struct sockaddr_dl *)(ifm + 1); + addr=LLADDR(sdl); + res=memcpy_and_test(to, addr, ETHER_ADDR_LEN); + } + } + +err: + return res; +} + +#elif __linux__ + +#include +#include +#include + +my_bool my_gethwaddr(uchar *to) +{ + int fd, res=1; + struct ifreq ifr; + + fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd < 0) + goto err; + + bzero(&ifr, sizeof(ifr)); + strnmov(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name) - 1); + + do { + if (ioctl(fd, SIOCGIFHWADDR, &ifr) >= 0) + res=memcpy_and_test(to, (uchar *)&ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN); + } while (res && (errno == 0 || errno == ENODEV) && ifr.ifr_name[3]++ < '6'); + + close(fd); +err: + return res; +} + +#elif defined(__WIN__) +#include + +/* + The following typedef is for dynamically loading + iphlpapi.dll / GetAdaptersAddresses. Dynamic loading is + used because GetAdaptersAddresses is not available on Windows 2000 + which MySQL still supports. Static linking would cause an unresolved export. +*/ +typedef DWORD (WINAPI *pfnGetAdaptersAddresses)(IN ULONG Family, + IN DWORD Flags,IN PVOID Reserved, + OUT PIP_ADAPTER_ADDRESSES pAdapterAddresses, + IN OUT PULONG pOutBufLen); + +/* + my_gethwaddr - Windows version + + @brief Retrieve MAC address from network hardware + + @param[out] to MAC address exactly six bytes + + @return Operation status + @retval 0 OK + @retval <>0 FAILED +*/ +my_bool my_gethwaddr(uchar *to) +{ + PIP_ADAPTER_ADDRESSES pAdapterAddresses; + PIP_ADAPTER_ADDRESSES pCurrAddresses; + IP_ADAPTER_ADDRESSES adapterAddresses; + ULONG address_len; + my_bool return_val= 1; + static pfnGetAdaptersAddresses fnGetAdaptersAddresses= + (pfnGetAdaptersAddresses)-1; + + if(fnGetAdaptersAddresses == (pfnGetAdaptersAddresses)-1) + { + /* Get the function from the DLL */ + fnGetAdaptersAddresses= (pfnGetAdaptersAddresses) + GetProcAddress(LoadLibrary("iphlpapi.dll"), + "GetAdaptersAddresses"); + } + if (!fnGetAdaptersAddresses) + return 1; /* failed to get function */ + address_len= sizeof (IP_ADAPTER_ADDRESSES); + + /* Get the required size for the address data. */ + if (fnGetAdaptersAddresses(AF_UNSPEC, 0, 0, &adapterAddresses, &address_len) + == ERROR_BUFFER_OVERFLOW) + { + pAdapterAddresses= my_malloc(address_len, 0); + if (!pAdapterAddresses) + return 1; /* error, alloc failed */ + } + else + pAdapterAddresses= &adapterAddresses; /* one is enough don't alloc */ + + /* Get the hardware info. */ + if (fnGetAdaptersAddresses(AF_UNSPEC, 0, 0, pAdapterAddresses, &address_len) + == NO_ERROR) + { + pCurrAddresses= pAdapterAddresses; + + while (pCurrAddresses) + { + /* Look for ethernet cards. */ + if (pCurrAddresses->IfType == IF_TYPE_ETHERNET_CSMACD) + { + /* check for a good address */ + if (pCurrAddresses->PhysicalAddressLength < 6) + continue; /* bad address */ + + /* save 6 bytes of the address in the 'to' parameter */ + memcpy(to, pCurrAddresses->PhysicalAddress, 6); + + /* Network card found, we're done. */ + return_val= 0; + break; + } + pCurrAddresses= pCurrAddresses->Next; + } + } + + /* Clean up memory allocation. */ + if (pAdapterAddresses != &adapterAddresses) + my_free(pAdapterAddresses, 0); + + return return_val; +} + +#else /* __FreeBSD__ || __linux__ || __WIN__ */ +/* just fail */ +my_bool my_gethwaddr(uchar *to __attribute__((unused))) +{ + return 1; +} +#endif + +#else /* MAIN */ +int main(int argc __attribute__((unused)),char **argv) +{ + uchar mac[6]; + uint i; + MY_INIT(argv[0]); + if (my_gethwaddr(mac)) + { + printf("my_gethwaddr failed with errno %d\n", errno); + exit(1); + } + for (i=0; i < sizeof(mac); i++) + { + if (i) printf(":"); + printf("%02x", mac[i]); + } + printf("\n"); + return 0; +} +#endif + diff --git a/externals/mysql/mysys/my_getncpus.c b/externals/mysql/mysys/my_getncpus.c new file mode 100644 index 0000000..c09684a --- /dev/null +++ b/externals/mysql/mysys/my_getncpus.c @@ -0,0 +1,49 @@ +/* Copyright (C) 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* get the number of (online) CPUs */ + +#include "mysys_priv.h" +#ifdef HAVE_UNISTD_H +#include +#endif + +static int ncpus=0; + +int my_getncpus() +{ + if (!ncpus) + { +#ifdef _SC_NPROCESSORS_ONLN + ncpus= sysconf(_SC_NPROCESSORS_ONLN); +#elif defined(__WIN__) + SYSTEM_INFO sysinfo; + + /* + * We are not calling GetNativeSystemInfo here because (1) we + * don't believe that they return different values for number + * of processors and (2) if WOW64 limits processors for Win32 + * then we don't want to try to override that. + */ + GetSystemInfo(&sysinfo); + + ncpus= sysinfo.dwNumberOfProcessors; +#else +/* unknown so play safe: assume SMP and forbid uniprocessor build */ + ncpus= 2; +#endif + } + return ncpus; +} diff --git a/externals/mysql/mysys/my_getopt.c b/externals/mysql/mysys/my_getopt.c new file mode 100644 index 0000000..a16cc08 --- /dev/null +++ b/externals/mysql/mysys/my_getopt.c @@ -0,0 +1,1301 @@ +/* Copyright (C) 2002-2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include +#include +#include +#include + +typedef void (*init_func_p)(const struct my_option *option, uchar* *variable, + longlong value); + +static void default_reporter(enum loglevel level, const char *format, ...); +my_error_reporter my_getopt_error_reporter= &default_reporter; + +static int findopt(char *, uint, const struct my_option **, char **); +my_bool getopt_compare_strings(const char *, const char *, uint); +static longlong getopt_ll(char *, const struct my_option *, int *); +static ulonglong getopt_ull(char *, const struct my_option *, int *); +static double getopt_double(char *, const struct my_option *, int *); +static void init_variables(const struct my_option *, init_func_p); +static void init_one_value(const struct my_option *opt, uchar **, longlong); +static void fini_one_value(const struct my_option *, uchar **, longlong); +static int setval(const struct my_option *, uchar **, char *, my_bool); +static char *check_struct_option(char *cur_arg, char *key_name); + +/* + The following three variables belong to same group and the number and + order of their arguments must correspond to each other. +*/ +static const char *special_opt_prefix[]= +{"skip", "disable", "enable", "maximum", "loose", 0}; +static const uint special_opt_prefix_lengths[]= +{ 4, 7, 6, 7, 5, 0}; +enum enum_special_opt +{ OPT_SKIP, OPT_DISABLE, OPT_ENABLE, OPT_MAXIMUM, OPT_LOOSE}; + +char *disabled_my_option= (char*) "0"; + +/* + This is a flag that can be set in client programs. 0 means that + my_getopt will not print error messages, but the client should do + it by itself +*/ + +my_bool my_getopt_print_errors= 1; + +/* + This is a flag that can be set in client programs. 1 means that + my_getopt will skip over options it does not know how to handle. +*/ + +my_bool my_getopt_skip_unknown= 0; + +static void default_reporter(enum loglevel level, + const char *format, ...) +{ + va_list args; + va_start(args, format); + if (level == WARNING_LEVEL) + fprintf(stderr, "%s", "Warning: "); + else if (level == INFORMATION_LEVEL) + fprintf(stderr, "%s", "Info: "); + vfprintf(stderr, format, args); + va_end(args); + fputc('\n', stderr); + fflush(stderr); +} + +/* + function: handle_options + + Sort options; put options first, until special end of options (--), or + until end of argv. Parse options; check that the given option matches with + one of the options in struct 'my_option', return error in case of ambiguous + or unknown option. Check that option was given an argument if it requires + one. Call function 'get_one_option()' once for each option. +*/ + +static uchar** (*getopt_get_addr)(const char *, uint, const struct my_option *, int *); + +void my_getopt_register_get_addr(uchar** (*func_addr)(const char *, uint, + const struct my_option *, int *)) +{ + getopt_get_addr= func_addr; +} + +int handle_options(int *argc, char ***argv, + const struct my_option *longopts, + my_get_one_option get_one_option) +{ + uint opt_found, argvpos= 0, length; + my_bool end_of_options= 0, must_be_var, set_maximum_value, + option_is_loose; + char **pos, **pos_end, *optend, *prev_found, + *opt_str, key_name[FN_REFLEN]; + const struct my_option *optp; + uchar* *value; + int error, i; + my_bool is_cmdline_arg= 1; + + LINT_INIT(opt_found); + /* handle_options() assumes arg0 (program name) always exists */ + DBUG_ASSERT(argc && *argc >= 1); + DBUG_ASSERT(argv && *argv); + (*argc)--; /* Skip the program name */ + (*argv)++; /* --- || ---- */ + init_variables(longopts, init_one_value); + + /* + Search for args_separator, if found, then the first part of the + arguments are loaded from configs + */ + for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) + { + if (*pos == args_separator) + { + is_cmdline_arg= 0; + break; + } + } + + for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) + { + char **first= pos; + char *cur_arg= *pos; + if (!is_cmdline_arg && (cur_arg == args_separator)) + { + is_cmdline_arg= 1; + + /* save the separator too if skip unkown options */ + if (my_getopt_skip_unknown) + (*argv)[argvpos++]= cur_arg; + else + (*argc)--; + continue; + } + if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */ + { + char *argument= 0; + must_be_var= 0; + set_maximum_value= 0; + option_is_loose= 0; + + cur_arg++; /* skip '-' */ + if (*cur_arg == '-' || *cur_arg == 'O') /* check for long option, */ + { /* --set-variable, or -O */ + if (*cur_arg == 'O') + { + must_be_var= 1; + + if (!(*++cur_arg)) /* If not -Ovar=# */ + { + /* the argument must be in next argv */ + if (!*++pos) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Option '-O' requires an argument", + my_progname); + return EXIT_ARGUMENT_REQUIRED; + } + cur_arg= *pos; + (*argc)--; + } + } + else if (!getopt_compare_strings(cur_arg, "-set-variable", 13)) + { + must_be_var= 1; + if (cur_arg[13] == '=') + { + cur_arg+= 14; + if (!*cur_arg) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Option '--set-variable' requires an argument", + my_progname); + return EXIT_ARGUMENT_REQUIRED; + } + } + else if (cur_arg[14]) /* garbage, or another option. break out */ + must_be_var= 0; + else + { + /* the argument must be in next argv */ + if (!*++pos) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Option '--set-variable' requires an argument", + my_progname); + return EXIT_ARGUMENT_REQUIRED; + } + cur_arg= *pos; + (*argc)--; + } + } + else if (!must_be_var) + { + if (!*++cur_arg) /* skip the double dash */ + { + /* '--' means end of options, look no further */ + end_of_options= 1; + (*argc)--; + continue; + } + } + opt_str= check_struct_option(cur_arg, key_name); + optend= strcend(opt_str, '='); + length= (uint) (optend - opt_str); + if (*optend == '=') + optend++; + else + optend= 0; + + /* + Find first the right option. Return error in case of an ambiguous, + or unknown option + */ + LINT_INIT(prev_found); + optp= longopts; + if (!(opt_found= findopt(opt_str, length, &optp, &prev_found))) + { + /* + Didn't find any matching option. Let's see if someone called + option with a special option prefix + */ + if (!must_be_var) + { + if (optend) + must_be_var= 1; /* option is followed by an argument */ + for (i= 0; special_opt_prefix[i]; i++) + { + if (!getopt_compare_strings(special_opt_prefix[i], opt_str, + special_opt_prefix_lengths[i]) && + (opt_str[special_opt_prefix_lengths[i]] == '-' || + opt_str[special_opt_prefix_lengths[i]] == '_')) + { + /* + We were called with a special prefix, we can reuse opt_found + */ + opt_str+= special_opt_prefix_lengths[i] + 1; + length-= special_opt_prefix_lengths[i] + 1; + if (i == OPT_LOOSE) + option_is_loose= 1; + if ((opt_found= findopt(opt_str, length, &optp, &prev_found))) + { + if (opt_found > 1) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: ambiguous option '--%s-%s' (--%s-%s)", + my_progname, special_opt_prefix[i], + cur_arg, special_opt_prefix[i], + prev_found); + return EXIT_AMBIGUOUS_OPTION; + } + switch (i) { + case OPT_SKIP: + case OPT_DISABLE: /* fall through */ + /* + double negation is actually enable again, + for example: --skip-option=0 -> option = TRUE + */ + optend= (optend && *optend == '0' && !(*(optend + 1))) ? + (char*) "1" : disabled_my_option; + break; + case OPT_ENABLE: + optend= (optend && *optend == '0' && !(*(optend + 1))) ? + disabled_my_option : (char*) "1"; + break; + case OPT_MAXIMUM: + set_maximum_value= 1; + must_be_var= 1; + break; + } + break; /* break from the inner loop, main loop continues */ + } + i= -1; /* restart the loop */ + } + } + } + if (!opt_found) + { + if (my_getopt_skip_unknown) + { + /* + preserve all the components of this unknown option, this may + occurr when the user provides options like: "-O foo" or + "--set-variable foo" (note that theres a space in there) + Generally, these kind of options are to be avoided + */ + do { + (*argv)[argvpos++]= *first++; + } while (first <= pos); + continue; + } + if (must_be_var) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(option_is_loose ? + WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown variable '%s'", + my_progname, cur_arg); + if (!option_is_loose) + return EXIT_UNKNOWN_VARIABLE; + } + else + { + if (my_getopt_print_errors) + my_getopt_error_reporter(option_is_loose ? + WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown option '--%s'", + my_progname, cur_arg); + if (!option_is_loose) + return EXIT_UNKNOWN_OPTION; + } + if (option_is_loose) + { + (*argc)--; + continue; + } + } + } + if (opt_found > 1) + { + if (must_be_var) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: variable prefix '%s' is not unique", + my_progname, opt_str); + return EXIT_VAR_PREFIX_NOT_UNIQUE; + } + else + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: ambiguous option '--%s' (%s, %s)", + my_progname, opt_str, prev_found, + optp->name); + return EXIT_AMBIGUOUS_OPTION; + } + } + if ((optp->var_type & GET_TYPE_MASK) == GET_DISABLED) + { + if (my_getopt_print_errors) + fprintf(stderr, + "%s: %s: Option '%s' used, but is disabled\n", my_progname, + option_is_loose ? "WARNING" : "ERROR", opt_str); + if (option_is_loose) + { + (*argc)--; + continue; + } + return EXIT_OPTION_DISABLED; + } + if (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '%s' cannot take an argument", + my_progname, optp->name); + return EXIT_NO_ARGUMENT_ALLOWED; + } + error= 0; + value= optp->var_type & GET_ASK_ADDR ? + (*getopt_get_addr)(key_name, (uint) strlen(key_name), optp, &error) : + optp->value; + if (error) + return error; + + if (optp->arg_type == NO_ARG) + { + if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '--%s' cannot take an argument", + my_progname, optp->name); + return EXIT_NO_ARGUMENT_ALLOWED; + } + if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL) + { + /* + Set bool to 1 if no argument or if the user has used + --enable-'option-name'. + *optend was set to '0' if one used --disable-option + */ + (*argc)--; + if (!optend || *optend == '1' || + !my_strcasecmp(&my_charset_latin1, optend, "true")) + *((my_bool*) value)= (my_bool) 1; + else if (*optend == '0' || + !my_strcasecmp(&my_charset_latin1, optend, "false")) + *((my_bool*) value)= (my_bool) 0; + else + { + my_getopt_error_reporter(WARNING_LEVEL, + "%s: ignoring option '--%s' due to \ +invalid value '%s'", + my_progname, optp->name, optend); + continue; + } + if (get_one_option(optp->id, optp, + *((my_bool*) value) ? + (char*) "1" : disabled_my_option)) + return EXIT_ARGUMENT_INVALID; + continue; + } + argument= optend; + } + else if (optp->arg_type == OPT_ARG && + (optp->var_type & GET_TYPE_MASK) == GET_BOOL) + { + if (optend == disabled_my_option) + *((my_bool*) value)= (my_bool) 0; + else + { + if (!optend) /* No argument -> enable option */ + *((my_bool*) value)= (my_bool) 1; + else + argument= optend; + } + } + else if (optp->arg_type == REQUIRED_ARG && !optend) + { + /* Check if there are more arguments after this one, + + Note: options loaded from config file that requires value + should always be in the form '--option=value'. + */ + if (!is_cmdline_arg || !*++pos) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '--%s' requires an argument", + my_progname, optp->name); + return EXIT_ARGUMENT_REQUIRED; + } + argument= *pos; + (*argc)--; + } + else + argument= optend; + } + else /* must be short option */ + { + for (optend= cur_arg; *optend; optend++) + { + opt_found= 0; + for (optp= longopts; optp->id; optp++) + { + if (optp->id == (int) (uchar) *optend) + { + /* Option recognized. Find next what to do with it */ + opt_found= 1; + if ((optp->var_type & GET_TYPE_MASK) == GET_DISABLED) + { + if (my_getopt_print_errors) + fprintf(stderr, + "%s: ERROR: Option '-%c' used, but is disabled\n", + my_progname, optp->id); + return EXIT_OPTION_DISABLED; + } + if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL && + optp->arg_type == NO_ARG) + { + *((my_bool*) optp->value)= (my_bool) 1; + if (get_one_option(optp->id, optp, argument)) + return EXIT_UNSPECIFIED_ERROR; + continue; + } + else if (optp->arg_type == REQUIRED_ARG || + optp->arg_type == OPT_ARG) + { + if (*(optend + 1)) + { + /* The rest of the option is option argument */ + argument= optend + 1; + /* This is in effect a jump out of the outer loop */ + optend= (char*) " "; + } + else + { + if (optp->arg_type == OPT_ARG) + { + if (optp->var_type == GET_BOOL) + *((my_bool*) optp->value)= (my_bool) 1; + if (get_one_option(optp->id, optp, argument)) + return EXIT_UNSPECIFIED_ERROR; + continue; + } + /* Check if there are more arguments after this one */ + if (!pos[1]) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: option '-%c' requires an argument", + my_progname, optp->id); + return EXIT_ARGUMENT_REQUIRED; + } + argument= *++pos; + (*argc)--; + /* the other loop will break, because *optend + 1 == 0 */ + } + } + if ((error= setval(optp, optp->value, argument, + set_maximum_value))) + { + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Error while setting value '%s' to '%s'", + my_progname, argument, optp->name); + return error; + } + if (get_one_option(optp->id, optp, argument)) + return EXIT_UNSPECIFIED_ERROR; + break; + } + } + if (!opt_found) + { + if (my_getopt_print_errors) + my_getopt_error_reporter(ERROR_LEVEL, + "%s: unknown option '-%c'", + my_progname, *optend); + return EXIT_UNKNOWN_OPTION; + } + } + (*argc)--; /* option handled (short), decrease argument count */ + continue; + } + if ((error= setval(optp, value, argument, set_maximum_value))) + { + my_getopt_error_reporter(ERROR_LEVEL, + "%s: Error while setting value '%s' to '%s'", + my_progname, argument, optp->name); + return error; + } + if (get_one_option(optp->id, optp, argument)) + return EXIT_UNSPECIFIED_ERROR; + + (*argc)--; /* option handled (short or long), decrease argument count */ + } + else /* non-option found */ + (*argv)[argvpos++]= cur_arg; + } + /* + Destroy the first, already handled option, so that programs that look + for arguments in 'argv', without checking 'argc', know when to stop. + Items in argv, before the destroyed one, are all non-option -arguments + to the program, yet to be (possibly) handled. + */ + (*argv)[argvpos]= 0; + return 0; +} + + +/* + function: check_struct_option + + Arguments: Current argument under processing from argv and a variable + where to store the possible key name. + + Return value: In case option is a struct option, returns a pointer to + the current argument at the position where the struct option (key_name) + ends, the next character after the dot. In case argument is not a struct + option, returns a pointer to the argument. + + key_name will hold the name of the key, or 0 if not found. +*/ + +static char *check_struct_option(char *cur_arg, char *key_name) +{ + char *ptr, *end; + + ptr= strcend(cur_arg + 1, '.'); /* Skip the first character */ + end= strcend(cur_arg, '='); + + /* + If the first dot is after an equal sign, then it is part + of a variable value and the option is not a struct option. + Also, if the last character in the string before the ending + NULL, or the character right before equal sign is the first + dot found, the option is not a struct option. + */ + if (end - ptr > 1) + { + uint len= (uint) (ptr - cur_arg); + set_if_smaller(len, FN_REFLEN-1); + strmake(key_name, cur_arg, len); + return ++ptr; + } + else + { + key_name[0]= 0; + return cur_arg; + } +} + +/* + function: setval + + Arguments: opts, argument + Will set the option value to given value +*/ + +static int setval(const struct my_option *opts, uchar* *value, char *argument, + my_bool set_maximum_value) +{ + int err= 0; + + if (value && argument) + { + uchar* *result_pos= ((set_maximum_value) ? + opts->u_max_value : value); + + if (!result_pos) + return EXIT_NO_PTR_TO_VARIABLE; + + switch ((opts->var_type & GET_TYPE_MASK)) { + case GET_BOOL: /* If argument differs from 0, enable option, else disable */ + *((my_bool*) result_pos)= (my_bool) atoi(argument) != 0; + break; + case GET_INT: + *((int*) result_pos)= (int) getopt_ll(argument, opts, &err); + break; + case GET_UINT: + *((uint*) result_pos)= (uint) getopt_ull(argument, opts, &err); + break; + case GET_LONG: + *((long*) result_pos)= (long) getopt_ll(argument, opts, &err); + break; + case GET_ULONG: + *((long*) result_pos)= (long) getopt_ull(argument, opts, &err); + break; + case GET_LL: + *((longlong*) result_pos)= getopt_ll(argument, opts, &err); + break; + case GET_ULL: + *((ulonglong*) result_pos)= getopt_ull(argument, opts, &err); + break; + case GET_DOUBLE: + *((double*) result_pos)= getopt_double(argument, opts, &err); + break; + case GET_STR: + *((char**) result_pos)= argument; + break; + case GET_STR_ALLOC: + if ((*((char**) result_pos))) + my_free((*(char**) result_pos), MYF(MY_WME | MY_FAE)); + if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME)))) + return EXIT_OUT_OF_MEMORY; + break; + case GET_ENUM: + if (((*(int*)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0) + return EXIT_ARGUMENT_INVALID; + break; + case GET_SET: + *((ulonglong*)result_pos)= find_typeset(argument, opts->typelib, &err); + if (err) + return EXIT_ARGUMENT_INVALID; + break; + default: /* dummy default to avoid compiler warnings */ + break; + } + if (err) + return EXIT_UNKNOWN_SUFFIX; + } + return 0; +} + + +/* + Find option + + SYNOPSIS + findopt() + optpat Prefix of option to find (with - or _) + length Length of optpat + opt_res Options + ffname Place for pointer to first found name + + IMPLEMENTATION + Go through all options in the my_option struct. Return number + of options found that match the pattern and in the argument + list the option found, if any. In case of ambiguous option, store + the name in ffname argument + + RETURN + 0 No matching options + # Number of matching options + ffname points to first matching option +*/ + +static int findopt(char *optpat, uint length, + const struct my_option **opt_res, + char **ffname) +{ + uint count; + struct my_option *opt= (struct my_option *) *opt_res; + + for (count= 0; opt->name; opt++) + { + if (!getopt_compare_strings(opt->name, optpat, length)) /* match found */ + { + (*opt_res)= opt; + if (!opt->name[length]) /* Exact match */ + return 1; + if (!count) + { + count= 1; + *ffname= (char *) opt->name; /* We only need to know one prev */ + } + else if (strcmp(*ffname, opt->name)) + { + /* + The above test is to not count same option twice + (see mysql.cc, option "help") + */ + count++; + } + } + } + return count; +} + + +/* + function: compare_strings + + Works like strncmp, other than 1.) considers '-' and '_' the same. + 2.) Returns -1 if strings differ, 0 if they are equal +*/ + +my_bool getopt_compare_strings(register const char *s, register const char *t, + uint length) +{ + char const *end= s + length; + for (;s != end ; s++, t++) + { + if ((*s != '-' ? *s : '_') != (*t != '-' ? *t : '_')) + return 1; + } + return 0; +} + +/* + function: eval_num_suffix + + Transforms a number with a suffix to real number. Suffix can + be k|K for kilo, m|M for mega or g|G for giga. +*/ + +static longlong eval_num_suffix(char *argument, int *error, char *option_name) +{ + char *endchar; + longlong num; + + *error= 0; + errno= 0; + num= strtoll(argument, &endchar, 10); + if (errno == ERANGE) + { + my_getopt_error_reporter(ERROR_LEVEL, + "Incorrect integer value: '%s'", argument); + *error= 1; + return 0; + } + if (*endchar == 'k' || *endchar == 'K') + num*= 1024L; + else if (*endchar == 'm' || *endchar == 'M') + num*= 1024L * 1024L; + else if (*endchar == 'g' || *endchar == 'G') + num*= 1024L * 1024L * 1024L; + else if (*endchar) + { + fprintf(stderr, + "Unknown suffix '%c' used for variable '%s' (value '%s')\n", + *endchar, option_name, argument); + *error= 1; + return 0; + } + return num; +} + +/* + function: getopt_ll + + Evaluates and returns the value that user gave as an argument + to a variable. Recognizes (case insensitive) K as KILO, M as MEGA + and G as GIGA bytes. Some values must be in certain blocks, as + defined in the given my_option struct, this function will check + that those values are honored. + In case of an error, set error value in *err. +*/ + +static longlong getopt_ll(char *arg, const struct my_option *optp, int *err) +{ + longlong num=eval_num_suffix(arg, err, (char*) optp->name); + return getopt_ll_limit_value(num, optp, NULL); +} + +/* + function: getopt_ll_limit_value + + Applies min/max/block_size to a numeric value of an option. + Returns "fixed" value. +*/ + +longlong getopt_ll_limit_value(longlong num, const struct my_option *optp, + my_bool *fix) +{ + longlong old= num; + my_bool adjusted= FALSE; + char buf1[255], buf2[255]; + ulonglong block_size= (optp->block_size ? (ulonglong) optp->block_size : 1L); + + if (num > 0 && ((ulonglong) num > (ulonglong) optp->max_value) && + optp->max_value) /* if max value is not set -> no upper limit */ + { + num= (ulonglong) optp->max_value; + adjusted= TRUE; + } + + switch ((optp->var_type & GET_TYPE_MASK)) { + case GET_INT: + if (num > (longlong) INT_MAX) + { + num= ((longlong) INT_MAX); + adjusted= TRUE; + } + break; + case GET_LONG: +#if SIZEOF_LONG < SIZEOF_LONG_LONG + if (num > (longlong) LONG_MAX) + { + num= ((longlong) LONG_MAX); + adjusted= TRUE; + } +#endif + break; + default: + DBUG_ASSERT((optp->var_type & GET_TYPE_MASK) == GET_LL); + break; + } + + num= ((num - optp->sub_size) / block_size); + num= (longlong) (num * block_size); + + if (num < optp->min_value) + { + num= optp->min_value; + if (old < optp->min_value) + adjusted= TRUE; + } + + if (fix) + *fix= adjusted; + else if (adjusted) + my_getopt_error_reporter(WARNING_LEVEL, + "option '%s': signed value %s adjusted to %s", + optp->name, llstr(old, buf1), llstr(num, buf2)); + return num; +} + +/* + function: getopt_ull + + This is the same as getopt_ll, but is meant for unsigned long long + values. +*/ + +static ulonglong getopt_ull(char *arg, const struct my_option *optp, int *err) +{ + ulonglong num= eval_num_suffix(arg, err, (char*) optp->name); + return getopt_ull_limit_value(num, optp, NULL); +} + + +ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, + my_bool *fix) +{ + my_bool adjusted= FALSE; + ulonglong old= num; + char buf1[255], buf2[255]; + + if ((ulonglong) num > (ulonglong) optp->max_value && + optp->max_value) /* if max value is not set -> no upper limit */ + { + num= (ulonglong) optp->max_value; + adjusted= TRUE; + } + + switch ((optp->var_type & GET_TYPE_MASK)) { + case GET_UINT: + if (num > (ulonglong) UINT_MAX) + { + num= ((ulonglong) UINT_MAX); + adjusted= TRUE; + } + break; + case GET_ULONG: +#if SIZEOF_LONG < SIZEOF_LONG_LONG + if (num > (ulonglong) ULONG_MAX) + { + num= ((ulonglong) ULONG_MAX); + adjusted= TRUE; + } +#endif + break; + default: + DBUG_ASSERT((optp->var_type & GET_TYPE_MASK) == GET_ULL); + break; + } + + if (optp->block_size > 1) + { + num/= (ulonglong) optp->block_size; + num*= (ulonglong) optp->block_size; + } + + if (num < (ulonglong) optp->min_value) + { + num= (ulonglong) optp->min_value; + if (old < (ulonglong) optp->min_value) + adjusted= TRUE; + } + + if (fix) + *fix= adjusted; + else if (adjusted) + my_getopt_error_reporter(WARNING_LEVEL, + "option '%s': unsigned value %s adjusted to %s", + optp->name, ullstr(old, buf1), ullstr(num, buf2)); + return num; +} + + +/* + Get double value withing ranges + + Evaluates and returns the value that user gave as an argument to a variable. + + RETURN + decimal value of arg + + In case of an error, prints an error message and sets *err to + EXIT_ARGUMENT_INVALID. Otherwise err is not touched +*/ + +static double getopt_double(char *arg, const struct my_option *optp, int *err) +{ + double num; + int error; + char *end= arg + 1000; /* Big enough as *arg is \0 terminated */ + num= my_strtod(arg, &end, &error); + if (end[0] != 0 || error) + { + fprintf(stderr, + "%s: ERROR: Invalid decimal value for option '%s'\n", + my_progname, optp->name); + *err= EXIT_ARGUMENT_INVALID; + return 0.0; + } + if (optp->max_value && num > (double) optp->max_value) + num= (double) optp->max_value; + return max(num, (double) optp->min_value); +} + +/* + Init one value to it's default values + + SYNOPSIS + init_one_value() + option Option to initialize + value Pointer to variable +*/ + +static void init_one_value(const struct my_option *option, uchar* *variable, + longlong value) +{ + DBUG_ENTER("init_one_value"); + switch ((option->var_type & GET_TYPE_MASK)) { + case GET_BOOL: + *((my_bool*) variable)= (my_bool) value; + break; + case GET_INT: + *((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL); + break; + case GET_ENUM: + *((uint*) variable)= (uint) value; + break; + case GET_UINT: + *((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL); + break; + case GET_LONG: + *((long*) variable)= (long) getopt_ll_limit_value((long) value, option, NULL); + break; + case GET_ULONG: + *((ulong*) variable)= (ulong) getopt_ull_limit_value((ulong) value, option, NULL); + break; + case GET_LL: + *((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL); + break; + case GET_ULL: /* Fall through */ + case GET_SET: + *((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL); + break; + case GET_DOUBLE: + *((double*) variable)= (double) value; + break; + case GET_STR: + /* + Do not clear variable value if it has no default value. + The default value may already be set. + NOTE: To avoid compiler warnings, we first cast longlong to intptr, + so that the value has the same size as a pointer. + */ + if ((char*) (intptr) value) + *((char**) variable)= (char*) (intptr) value; + break; + case GET_STR_ALLOC: + /* + Do not clear variable value if it has no default value. + The default value may already be set. + NOTE: To avoid compiler warnings, we first cast longlong to intptr, + so that the value has the same size as a pointer. + */ + if ((char*) (intptr) value) + { + my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR)); + *((char**) variable)= my_strdup((char*) (intptr) value, MYF(MY_WME)); + } + break; + default: /* dummy default to avoid compiler warnings */ + break; + } + DBUG_VOID_RETURN; +} + + +/* + Init one value to it's default values + + SYNOPSIS + init_one_value() + option Option to initialize + value Pointer to variable +*/ + +static void fini_one_value(const struct my_option *option, uchar* *variable, + longlong value __attribute__ ((unused))) +{ + DBUG_ENTER("fini_one_value"); + switch ((option->var_type & GET_TYPE_MASK)) { + case GET_STR_ALLOC: + my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR)); + *((char**) variable)= NULL; + break; + default: /* dummy default to avoid compiler warnings */ + break; + } + DBUG_VOID_RETURN; +} + + +void my_cleanup_options(const struct my_option *options) +{ + init_variables(options, fini_one_value); +} + + +/* + initialize all variables to their default values + + SYNOPSIS + init_variables() + options Array of options + + NOTES + We will initialize the value that is pointed to by options->value. + If the value is of type GET_ASK_ADDR, we will also ask for the address + for a value and initialize. +*/ + +static void init_variables(const struct my_option *options, + init_func_p init_one_value) +{ + DBUG_ENTER("init_variables"); + for (; options->name; options++) + { + uchar* *variable; + DBUG_PRINT("options", ("name: '%s'", options->name)); + /* + We must set u_max_value first as for some variables + options->u_max_value == options->value and in this case we want to + set the value to default value. + */ + if (options->u_max_value) + init_one_value(options, options->u_max_value, options->max_value); + if (options->value) + init_one_value(options, options->value, options->def_value); + if (options->var_type & GET_ASK_ADDR && + (variable= (*getopt_get_addr)("", 0, options, 0))) + init_one_value(options, variable, options->def_value); + } + DBUG_VOID_RETURN; +} + + +/* + function: my_print_options + + Print help for all options and variables. +*/ + +void my_print_help(const struct my_option *options) +{ + uint col, name_space= 22, comment_space= 57; + const char *line_end; + const struct my_option *optp; + + for (optp= options; optp->id; optp++) + { + if (optp->id < 256) + { + printf(" -%c%s", optp->id, strlen(optp->name) ? ", " : " "); + col= 6; + } + else + { + printf(" "); + col= 2; + } + if (strlen(optp->name)) + { + printf("--%s", optp->name); + col+= 2 + (uint) strlen(optp->name); + if ((optp->var_type & GET_TYPE_MASK) == GET_STR || + (optp->var_type & GET_TYPE_MASK) == GET_STR_ALLOC) + { + printf("%s=name%s ", optp->arg_type == OPT_ARG ? "[" : "", + optp->arg_type == OPT_ARG ? "]" : ""); + col+= (optp->arg_type == OPT_ARG) ? 8 : 6; + } + else if ((optp->var_type & GET_TYPE_MASK) == GET_NO_ARG || + (optp->var_type & GET_TYPE_MASK) == GET_BOOL) + { + putchar(' '); + col++; + } + else + { + printf("%s=#%s ", optp->arg_type == OPT_ARG ? "[" : "", + optp->arg_type == OPT_ARG ? "]" : ""); + col+= (optp->arg_type == OPT_ARG) ? 5 : 3; + } + if (col > name_space && optp->comment && *optp->comment) + { + putchar('\n'); + col= 0; + } + } + for (; col < name_space; col++) + putchar(' '); + if (optp->comment && *optp->comment) + { + const char *comment= optp->comment, *end= strend(comment); + + while ((uint) (end - comment) > comment_space) + { + for (line_end= comment + comment_space; + *line_end != ' ' && line_end > comment; + line_end--); + if (line_end == comment) + { + /* There was no space, try to find one going forward */ + for (line_end= comment + comment_space; + *line_end != ' ' && line_end < end; + line_end++); + } + for (; comment != line_end; comment++) + putchar(*comment); + if (comment < end) + { + comment++; /* skip the space, as a newline will take it's place now */ + putchar('\n'); + for (col= 0; col < name_space; col++) + putchar(' '); + } + } + printf("%s", comment); + } + putchar('\n'); + if ((optp->var_type & GET_TYPE_MASK) == GET_NO_ARG || + (optp->var_type & GET_TYPE_MASK) == GET_BOOL) + { + if (optp->def_value != 0) + { + printf("%*s(Defaults to on; use --skip-%s to disable.)\n", name_space, "", optp->name); + } + } + } +} + + +/* + function: my_print_options + + Print variables. +*/ + +void my_print_variables(const struct my_option *options) +{ + uint name_space= 34, length, nr; + ulonglong bit, llvalue; + char buff[255]; + const struct my_option *optp; + + printf("\nVariables (--variable-name=value)\n"); + printf("and boolean options {FALSE|TRUE} Value (after reading options)\n"); + printf("--------------------------------- -----------------------------\n"); + for (optp= options; optp->id; optp++) + { + uchar* *value= (optp->var_type & GET_ASK_ADDR ? + (*getopt_get_addr)("", 0, optp, 0) : optp->value); + if (value) + { + printf("%s ", optp->name); + length= (uint) strlen(optp->name)+1; + for (; length < name_space; length++) + putchar(' '); + switch ((optp->var_type & GET_TYPE_MASK)) { + case GET_SET: + if (!(llvalue= *(ulonglong*) value)) + printf("%s\n", "(No default value)"); + else + for (nr= 0, bit= 1; llvalue && nr < optp->typelib->count; nr++, bit<<=1) + { + if (!(bit & llvalue)) + continue; + llvalue&= ~bit; + printf( llvalue ? "%s," : "%s\n", get_type(optp->typelib, nr)); + } + break; + case GET_ENUM: + printf("%s\n", get_type(optp->typelib, *(uint*) value)); + break; + case GET_STR: + case GET_STR_ALLOC: /* fall through */ + printf("%s\n", *((char**) value) ? *((char**) value) : + "(No default value)"); + break; + case GET_BOOL: + printf("%s\n", *((my_bool*) value) ? "TRUE" : "FALSE"); + break; + case GET_INT: + printf("%d\n", *((int*) value)); + break; + case GET_UINT: + printf("%d\n", *((uint*) value)); + break; + case GET_LONG: + printf("%ld\n", *((long*) value)); + break; + case GET_ULONG: + printf("%lu\n", *((ulong*) value)); + break; + case GET_LL: + printf("%s\n", llstr(*((longlong*) value), buff)); + break; + case GET_ULL: + longlong2str(*((ulonglong*) value), buff, 10); + printf("%s\n", buff); + break; + case GET_DOUBLE: + printf("%g\n", *(double*) value); + break; + default: + printf("(Disabled)\n"); + break; + } + } + } +} diff --git a/externals/mysql/mysys/my_getpagesize.c b/externals/mysql/mysys/my_getpagesize.c new file mode 100644 index 0000000..b0560ce --- /dev/null +++ b/externals/mysql/mysys/my_getpagesize.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" + +#ifndef HAVE_GETPAGESIZE + +#if defined __WIN__ + +int my_getpagesize(void) +{ + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; +} + +#else + +/* Default implementation */ +int my_getpagesize(void) +{ + return (int)8192; +} + +#endif + +#endif + diff --git a/externals/mysql/mysys/my_getsystime.c b/externals/mysql/mysys/my_getsystime.c new file mode 100644 index 0000000..46e0c54 --- /dev/null +++ b/externals/mysql/mysys/my_getsystime.c @@ -0,0 +1,225 @@ +/* Copyright (C) 2004 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* get time since epoc in 100 nanosec units */ +/* thus to get the current time we should use the system function + with the highest possible resolution */ + +/* + TODO: in functions my_micro_time() and my_micro_time_and_time() there + exists some common code that should be merged into a function. +*/ + +#include "mysys_priv.h" +#include "my_static.h" + +#ifdef __NETWARE__ +#include +#endif + +ulonglong my_getsystime() +{ +#ifdef HAVE_CLOCK_GETTIME + struct timespec tp; + clock_gettime(CLOCK_REALTIME, &tp); + return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100; +#elif defined(__WIN__) + LARGE_INTEGER t_cnt; + if (query_performance_frequency) + { + QueryPerformanceCounter(&t_cnt); + return ((t_cnt.QuadPart / query_performance_frequency * 10000000) + + ((t_cnt.QuadPart % query_performance_frequency) * 10000000 / + query_performance_frequency) + query_performance_offset); + } + return 0; +#elif defined(__NETWARE__) + NXTime_t tm; + NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm); + return (ulonglong)tm/100; +#else + /* TODO: check for other possibilities for hi-res timestamping */ + struct timeval tv; + gettimeofday(&tv,NULL); + return (ulonglong)tv.tv_sec*10000000+(ulonglong)tv.tv_usec*10; +#endif +} + + +/* + Return current time + + SYNOPSIS + my_time() + flags If MY_WME is set, write error if time call fails + +*/ + +time_t my_time(myf flags __attribute__((unused))) +{ + time_t t; +#ifdef HAVE_GETHRTIME + (void) my_micro_time_and_time(&t); + return t; +#else + /* The following loop is here beacuse time() may fail on some systems */ + while ((t= time(0)) == (time_t) -1) + { + if (flags & MY_WME) + fprintf(stderr, "%s: Warning: time() call failed\n", my_progname); + } + return t; +#endif +} + + +/* + Return time in micro seconds + + SYNOPSIS + my_micro_time() + + NOTES + This function is to be used to measure performance in micro seconds. + As it's not defined whats the start time for the clock, this function + us only useful to measure time between two moments. + + For windows platforms we need the frequency value of the CUP. This is + initalized in my_init.c through QueryPerformanceFrequency(). + + If Windows platform doesn't support QueryPerformanceFrequency() we will + obtain the time via GetClockCount, which only supports milliseconds. + + RETURN + Value in microseconds from some undefined point in time +*/ + +ulonglong my_micro_time() +{ +#if defined(__WIN__) + ulonglong newtime; + GetSystemTimeAsFileTime((FILETIME*)&newtime); + return (newtime/10); +#elif defined(HAVE_GETHRTIME) + return gethrtime()/1000; +#else + ulonglong newtime; + struct timeval t; + /* + The following loop is here because gettimeofday may fail on some systems + */ + while (gettimeofday(&t, NULL) != 0) + {} + newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec; + return newtime; +#endif /* defined(__WIN__) */ +} + + +/* + Return time in seconds and timer in microseconds (not different start!) + + SYNOPSIS + my_micro_time_and_time() + time_arg Will be set to seconds since epoch (00:00:00 UTC, + January 1, 1970) + + NOTES + This function is to be useful when we need both the time and microtime. + For example in MySQL this is used to get the query time start of a query + and to measure the time of a query (for the slow query log) + + IMPLEMENTATION + Value of time is as in time() call. + Value of microtime is same as my_micro_time(), which may be totally + unrealated to time() + + RETURN + Value in microseconds from some undefined point in time +*/ + +#define DELTA_FOR_SECONDS 500000000LL /* Half a second */ + +ulonglong my_micro_time_and_time(time_t *time_arg) +{ +#if defined(__WIN__) + ulonglong newtime; + GetSystemTimeAsFileTime((FILETIME*)&newtime); + *time_arg= (time_t) ((newtime - OFFSET_TO_EPOCH) / 10000000); + return (newtime/10); +#elif defined(HAVE_GETHRTIME) + /* + Solaris has a very slow time() call. We optimize this by using the very + fast gethrtime() call and only calling time() every 1/2 second + */ + static hrtime_t prev_gethrtime= 0; + static time_t cur_time= 0; + hrtime_t cur_gethrtime; + + pthread_mutex_lock(&THR_LOCK_time); + cur_gethrtime= gethrtime(); + if ((cur_gethrtime - prev_gethrtime) > DELTA_FOR_SECONDS) + { + cur_time= time(0); + prev_gethrtime= cur_gethrtime; + } + *time_arg= cur_time; + pthread_mutex_unlock(&THR_LOCK_time); + return cur_gethrtime/1000; +#else + ulonglong newtime; + struct timeval t; + /* + The following loop is here because gettimeofday may fail on some systems + */ + while (gettimeofday(&t, NULL) != 0) + {} + *time_arg= t.tv_sec; + newtime= (ulonglong)t.tv_sec * 1000000 + t.tv_usec; + return newtime; +#endif /* defined(__WIN__) */ +} + + +/* + Returns current time + + SYNOPSIS + my_time_possible_from_micro() + microtime Value from very recent my_micro_time() + + NOTES + This function returns the current time. The microtime argument is only used + if my_micro_time() uses a function that can safely be converted to the + current time. + + RETURN + current time +*/ + +time_t my_time_possible_from_micro(ulonglong microtime __attribute__((unused))) +{ +#if defined(__WIN__) + time_t t; + while ((t= time(0)) == (time_t) -1) + {} + return t; +#elif defined(HAVE_GETHRTIME) + return my_time(0); /* Cached time */ +#else + return (time_t) (microtime / 1000000); +#endif /* defined(__WIN__) */ +} + diff --git a/externals/mysql/mysys/my_getwd.c b/externals/mysql/mysys/my_getwd.c new file mode 100644 index 0000000..0b46735 --- /dev/null +++ b/externals/mysql/mysys/my_getwd.c @@ -0,0 +1,185 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* my_setwd() and my_getwd() works with intern_filenames !! */ + +#include "mysys_priv.h" +#include +#include "mysys_err.h" +#ifdef HAVE_GETWD +#include +#endif +#if defined(__WIN__) +#include +#include +#include +#endif + +/* Gets current working directory in buff. + + SYNPOSIS + my_getwd() + buf Buffer to store result. Can be curr_dir[]. + size Size of buffer + MyFlags Flags + + NOTES + Directory is allways ended with FN_LIBCHAR + + RESULT + 0 ok + # error +*/ + +int my_getwd(char * buf, size_t size, myf MyFlags) +{ + char * pos; + DBUG_ENTER("my_getwd"); + DBUG_PRINT("my",("buf: %p size: %u MyFlags %d", + buf, (uint) size, MyFlags)); + + if (curr_dir[0]) /* Current pos is saved here */ + (void) strmake(buf,&curr_dir[0],size-1); + else + { +#if defined(HAVE_GETCWD) + if (!getcwd(buf,size-2) && MyFlags & MY_WME) + { + my_errno=errno; + my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); + return(-1); + } +#elif defined(HAVE_GETWD) + { + char pathname[MAXPATHLEN]; + getwd(pathname); + strmake(buf,pathname,size-1); + } +#elif defined(VMS) + if (!getcwd(buf,size-2,1) && MyFlags & MY_WME) + { + my_errno=errno; + my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); + return(-1); + } + intern_filename(buf,buf); +#else +#error "No way to get current directory" +#endif + if (*((pos=strend(buf))-1) != FN_LIBCHAR) /* End with FN_LIBCHAR */ + { + pos[0]= FN_LIBCHAR; + pos[1]=0; + } + (void) strmake(&curr_dir[0],buf, (size_t) (FN_REFLEN-1)); + } + DBUG_RETURN(0); +} /* my_getwd */ + + +/* Set new working directory */ + +int my_setwd(const char *dir, myf MyFlags) +{ + int res; + size_t length; + char *start, *pos; +#if defined(VMS) + char buff[FN_REFLEN]; +#endif + DBUG_ENTER("my_setwd"); + DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags)); + + start=(char *) dir; + if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0)) + dir=FN_ROOTDIR; +#ifdef VMS + { + pos=strmov(buff,dir); + if (pos[-1] != FN_LIBCHAR) + { + pos[0]=FN_LIBCHAR; /* Mark as directory */ + pos[1]=0; + } + system_filename(buff,buff); /* Change to VMS format */ + dir=buff; + } +#endif /* VMS */ + if ((res=chdir((char*) dir)) != 0) + { + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),start,errno); + } + else + { + if (test_if_hard_path(start)) + { /* Hard pathname */ + pos= strmake(&curr_dir[0],start,(size_t) FN_REFLEN-1); + if (pos[-1] != FN_LIBCHAR) + { + length=(uint) (pos-(char*) curr_dir); + curr_dir[length]=FN_LIBCHAR; /* must end with '/' */ + curr_dir[length+1]='\0'; + } + } + else + curr_dir[0]='\0'; /* Don't save name */ + } + DBUG_RETURN(res); +} /* my_setwd */ + + + + /* Test if hard pathname */ + /* Returns 1 if dirname is a hard path */ + +int test_if_hard_path(register const char *dir_name) +{ + if (dir_name[0] == FN_HOMELIB && dir_name[1] == FN_LIBCHAR) + return (home_dir != NullS && test_if_hard_path(home_dir)); + if (dir_name[0] == FN_LIBCHAR) + return (TRUE); +#ifdef FN_DEVCHAR + return (strchr(dir_name,FN_DEVCHAR) != 0); +#else + return FALSE; +#endif +} /* test_if_hard_path */ + + +/* + Test if a name contains an (absolute or relative) path. + + SYNOPSIS + has_path() + name The name to test. + + RETURN + TRUE name contains a path. + FALSE name does not contain a path. +*/ + +my_bool has_path(const char *name) +{ + return test(strchr(name, FN_LIBCHAR)) +#if FN_LIBCHAR != '/' + || test(strchr(name,'/')) +#endif +#ifdef FN_DEVCHAR + || test(strchr(name, FN_DEVCHAR)) +#endif + ; +} diff --git a/externals/mysql/mysys/my_handler_errors.h b/externals/mysql/mysys/my_handler_errors.h new file mode 100644 index 0000000..47cce9d --- /dev/null +++ b/externals/mysql/mysys/my_handler_errors.h @@ -0,0 +1,137 @@ + +/* + Errors a handler can give you +*/ + +static const char *handler_error_messages[]= +{ + /* HA_ERR_KEY_NOT_FOUND */ + "Didn't find key on read or update", + /* HA_ERR_FOUND_DUPP_KEY */ + "Duplicate key on write or update", + /* HA_ERR_INTERNAL_ERROR */ + "Internal (unspecified) error in handler", + /* HA_ERR_RECORD_CHANGED */ + "Someone has changed the row since it was read (while the table was locked to prevent it)", + /* HA_ERR_WRONG_INDEX */ + "Wrong index given to function", + /* empty */ + "Undefined handler error 125", + /* HA_ERR_CRASHED */ + "Index file is crashed", + /* HA_ERR_WRONG_IN_RECORD */ + "Record file is crashed", + /* HA_ERR_OUT_OF_MEM */ + "Out of memory in engine", + /* empty */ + "Undefined handler error 129", + /* HA_ERR_NOT_A_TABLE */ + "Incorrect file format", + /* HA_ERR_WRONG_COMMAND */ + "Command not supported by database", + /* HA_ERR_OLD_FILE */ + "Old database file", + /* HA_ERR_NO_ACTIVE_RECORD */ + "No record read before update", + /* HA_ERR_RECORD_DELETED */ + "Record was already deleted (or record file crashed)", + /* HA_ERR_RECORD_FILE_FULL */ + "No more room in record file", + /* HA_ERR_INDEX_FILE_FULL */ + "No more room in index file", + /* HA_ERR_END_OF_FILE */ + "No more records (read after end of file)", + /* HA_ERR_UNSUPPORTED */ + "Unsupported extension used for table", + /* HA_ERR_TO_BIG_ROW */ + "Too big row", + /* HA_WRONG_CREATE_OPTION */ + "Wrong create options", + /* HA_ERR_FOUND_DUPP_UNIQUE */ + "Duplicate unique key or constraint on write or update", + /* HA_ERR_UNKNOWN_CHARSET */ + "Unknown character set used in table", + /* HA_ERR_WRONG_MRG_TABLE_DEF */ + "Conflicting table definitions in sub-tables of MERGE table", + /* HA_ERR_CRASHED_ON_REPAIR */ + "Table is crashed and last repair failed", + /* HA_ERR_CRASHED_ON_USAGE */ + "Table was marked as crashed and should be repaired", + /* HA_ERR_LOCK_WAIT_TIMEOUT */ + "Lock timed out; Retry transaction", + /* HA_ERR_LOCK_TABLE_FULL */ + "Lock table is full; Restart program with a larger lock table", + /* HA_ERR_READ_ONLY_TRANSACTION */ + "Updates are not allowed under a read only transactions", + /* HA_ERR_LOCK_DEADLOCK */ + "Lock deadlock; Retry transaction", + /* HA_ERR_CANNOT_ADD_FOREIGN */ + "Foreign key constraint is incorrectly formed", + /* HA_ERR_NO_REFERENCED_ROW */ + "Cannot add a child row", + /* HA_ERR_ROW_IS_REFERENCED */ + "Cannot delete a parent row", + /* HA_ERR_NO_SAVEPOINT */ + "No savepoint with that name", + /* HA_ERR_NON_UNIQUE_BLOCK_SIZE */ + "Non unique key block size", + /* HA_ERR_NO_SUCH_TABLE */ + "The table does not exist in engine", + /* HA_ERR_TABLE_EXIST */ + "The table already existed in storage engine", + /* HA_ERR_NO_CONNECTION */ + "Could not connect to storage engine", + /* HA_ERR_NULL_IN_SPATIAL */ + "Unexpected null pointer found when using spatial index", + /* HA_ERR_TABLE_DEF_CHANGED */ + "The table changed in storage engine", + /* HA_ERR_NO_PARTITION_FOUND */ + "There's no partition in table for the given value", + /* HA_ERR_RBR_LOGGING_FAILED */ + "Row-based binary logging of row failed", + /* HA_ERR_DROP_INDEX_FK */ + "Index needed in foreign key constraint", + /* HA_ERR_FOREIGN_DUPLICATE_KEY */ + "Upholding foreign key constraints would lead to a duplicate key error in " + "some other table", + /* HA_ERR_TABLE_NEEDS_UPGRADE */ + "Table needs to be upgraded before it can be used", + /* HA_ERR_TABLE_READONLY */ + "Table is read only", + /* HA_ERR_AUTOINC_READ_FAILED */ + "Failed to get next auto increment value", + /* HA_ERR_AUTOINC_ERANGE */ + "Failed to set row auto increment value", + /* HA_ERR_GENERIC */ + "Unknown (generic) error from engine", + /* HA_ERR_RECORD_IS_THE_SAME */ + "Record was not update. Original values was same as new values", + /* HA_ERR_LOGGING_IMPOSSIBLE */ + "It is not possible to log this statement", + /* HA_ERR_TABLESPACE_EXIST */ + "Tablespace exists", + /* HA_ERR_CORRUPT_EVENT */ + "The event was corrupt, leading to illegal data being read", + /* HA_ERR_NEW_FILE */ + "The table is of a new format not supported by this version", + /* HA_ERR_ROWS_EVENT_APPLY */ + "The event could not be processed. No other handler error happened", + /* HA_ERR_INITIALIZATION */ + "Got a fatal error during initialization of handler", + /* HA_ERR_FILE_TOO_SHORT */ + "File too short; Expected more data in file", + + /* HA_ERR_WRONG_CRC */ + "Read page with wrong checksum", + /* HA_ERR_LOCK_OR_ACTIVE_TRANSACTION */ + "Lock or active transaction", /* TODO: get a better message */ + /* HA_ERR_NO_SUCH_TABLESPACE */ + "No such table space", /* TODO: get a better message */ + /* HA_ERR_TABLESPACE_NOT_EMPTY */ + "Tablespace not empty", /* TODO: get a better message */ + /* HA_ERR_TABLESPACE_DATAFILE_EXIST */ + "Tablespace data file already exists", /* TODO: get a better message */ + /* HA_ERR_ROW_NOT_VISIBLE */ + "Row is not visible by the current transaction" +}; + diff --git a/externals/mysql/mysys/my_init.c b/externals/mysql/mysys/my_init.c new file mode 100644 index 0000000..45545fb --- /dev/null +++ b/externals/mysql/mysys/my_init.c @@ -0,0 +1,558 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "my_static.h" +#include "mysys_err.h" +#include +#include +#include +#ifdef VMS +#include +#include +#endif +#ifdef __WIN__ +#ifdef _MSC_VER +#include +#include +/* WSAStartup needs winsock library*/ +#pragma comment(lib, "ws2_32") +#endif +my_bool have_tcpip=0; +static void my_win_init(void); +static my_bool win32_init_tcp_ip(); +#else +#define my_win_init() +#endif +#ifdef __NETWARE__ +static void netware_init(); +#else +#define netware_init() +#endif + +my_bool my_init_done= 0; +uint mysys_usage_id= 0; /* Incremented for each my_init() */ +ulong my_thread_stack_size= 65536; + +static ulong atoi_octal(const char *str) +{ + long int tmp; + while (*str && my_isspace(&my_charset_latin1, *str)) + str++; + str2int(str, + (*str == '0' ? 8 : 10), /* Octalt or decimalt */ + 0, INT_MAX, &tmp); + return (ulong) tmp; +} + + +/* + Init my_sys functions and my_sys variabels + + SYNOPSIS + my_init() + + RETURN + 0 ok + 1 Couldn't initialize environment +*/ + +my_bool my_init(void) +{ + char * str; + if (my_init_done) + return 0; + my_init_done=1; + mysys_usage_id++; + my_umask= 0660; /* Default umask for new files */ + my_umask_dir= 0700; /* Default umask for new directories */ + init_glob_errs(); + my_progname_short= "unknown"; + if (my_progname) + my_progname_short= my_progname + dirname_length(my_progname); + +#if defined(THREAD) + (void) my_threadattr_global_init(); +# if defined(SAFE_MUTEX) + safe_mutex_global_init(); /* Must be called early */ +# elif defined(MY_PTHREAD_FASTMUTEX) + fastmutex_global_init(); /* Must be called early */ +# endif +#endif + netware_init(); +#ifdef THREAD +#if defined(HAVE_PTHREAD_INIT) + pthread_init(); /* Must be called before DBUG_ENTER */ +#endif + if (my_thread_global_init()) + return 1; +#if !defined( __WIN__) && !defined(__NETWARE__) + sigfillset(&my_signals); /* signals blocked by mf_brkhant */ +#endif +#endif /* THREAD */ + { + DBUG_ENTER("my_init"); + DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); + if (!home_dir) + { /* Don't initialize twice */ + my_win_init(); + if ((home_dir=getenv("HOME")) != 0) + home_dir=intern_filename(home_dir_buff,home_dir); +#ifndef VMS + /* Default creation of new files */ + if ((str=getenv("UMASK")) != 0) + my_umask=(int) (atoi_octal(str) | 0600); + /* Default creation of new dir's */ + if ((str=getenv("UMASK_DIR")) != 0) + my_umask_dir=(int) (atoi_octal(str) | 0700); +#endif +#ifdef VMS + init_ctype(); /* Stupid linker don't link _ctype.c */ +#endif + DBUG_PRINT("exit",("home: '%s'",home_dir)); + } +#ifdef __WIN__ + win32_init_tcp_ip(); +#endif + DBUG_RETURN(0); + } +} /* my_init */ + + + /* End my_sys */ + +void my_end(int infoflag) +{ + /* + this code is suboptimal to workaround a bug in + Sun CC: Sun C++ 5.6 2004/06/02 for x86, and should not be + optimized until this compiler is not in use anymore + */ + FILE *info_file= DBUG_FILE; + my_bool print_info= (info_file != stderr); + + if (!my_init_done) + return; + + /* + We do not use DBUG_ENTER here, as after cleanup DBUG is no longer + operational, so we cannot use DBUG_RETURN. + */ + DBUG_PRINT("info",("Shutting down: infoflag: %d print_info: %d", + infoflag, print_info)); + if (!info_file) + { + info_file= stderr; + print_info= 0; + } + + if ((infoflag & MY_CHECK_ERROR) || print_info) + + { /* Test if some file is left open */ + if (my_file_opened | my_stream_opened) + { + char ebuff[MYSYS_ERRMSG_SIZE]; + my_snprintf(ebuff, sizeof(ebuff), EE(EE_OPEN_WARNING), + my_file_opened, my_stream_opened); + my_message_no_curses(EE_OPEN_WARNING, ebuff, ME_BELL); + DBUG_PRINT("error", ("%s", ebuff)); + my_print_open_files(); + } + } + free_charsets(); + my_error_unregister_all(); + my_once_free(); +#ifdef THREAD + my_thread_destroy_mutex(); +#endif + + if ((infoflag & MY_GIVE_INFO) || print_info) + { +#ifdef HAVE_GETRUSAGE + struct rusage rus; +#ifdef HAVE_purify + /* Purify assumes that rus is uninitialized after getrusage call */ + bzero((char*) &rus, sizeof(rus)); +#endif + if (!getrusage(RUSAGE_SELF, &rus)) + fprintf(info_file,"\n\ +User time %.2f, System time %.2f\n\ +Maximum resident set size %ld, Integral resident set size %ld\n\ +Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\ +Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\ +Voluntary context switches %ld, Involuntary context switches %ld\n", + (rus.ru_utime.tv_sec * SCALE_SEC + + rus.ru_utime.tv_usec / SCALE_USEC) / 100.0, + (rus.ru_stime.tv_sec * SCALE_SEC + + rus.ru_stime.tv_usec / SCALE_USEC) / 100.0, + rus.ru_maxrss, rus.ru_idrss, + rus.ru_minflt, rus.ru_majflt, + rus.ru_nswap, rus.ru_inblock, rus.ru_oublock, + rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, + rus.ru_nvcsw, rus.ru_nivcsw); +#endif +#if defined(__NETWARE__) && !defined(__WIN__) + fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); +#endif +#if defined(SAFEMALLOC) + /* Wait for other threads to free mysys_var */ +#ifdef THREAD + (void) my_wait_for_other_threads_to_die(1); +#endif + TERMINATE(stderr, (infoflag & MY_GIVE_INFO) != 0); +#elif defined(__WIN__) && defined(_MSC_VER) + _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); + _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR ); + _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); + _CrtCheckMemory(); + _CrtDumpMemoryLeaks(); +#endif + } + else if (infoflag & MY_CHECK_ERROR) + { + TERMINATE(stderr, 0); /* Print memory leaks on screen */ + } + + if (!(infoflag & MY_DONT_FREE_DBUG)) + { + DBUG_END(); /* Must be done before my_thread_end */ + } +#ifdef THREAD + my_thread_end(); + my_thread_global_end(); +#if defined(SAFE_MUTEX) + /* + Check on destroying of mutexes. A few may be left that will get cleaned + up by C++ destructors + */ + safe_mutex_end((infoflag & (MY_GIVE_INFO | MY_CHECK_ERROR)) ? stderr : + (FILE *) 0); +#endif /* defined(SAFE_MUTEX) */ +#endif /* THREAD */ + +#ifdef __WIN__ + if (have_tcpip) + WSACleanup(); +#endif /* __WIN__ */ + my_init_done=0; +} /* my_end */ + +#ifndef DBUG_OFF +/* Dummy tag function for debugging */ + +void my_debug_put_break_here(void) +{ +} +#endif + +#ifdef __WIN__ + + +/* + my_parameter_handler + + Invalid parameter handler we will use instead of the one "baked" + into the CRT for MSC v8. This one just prints out what invalid + parameter was encountered. By providing this routine, routines like + lseek will return -1 when we expect them to instead of crash. +*/ + +void my_parameter_handler(const wchar_t * expression, const wchar_t * function, + const wchar_t * file, unsigned int line, + uintptr_t pReserved) +{ + DBUG_PRINT("my",("Expression: %s function: %s file: %s, line: %d", + expression, function, file, line)); +} + + +#ifdef __MSVC_RUNTIME_CHECKS +#include + +/* Turn off runtime checks for 'handle_rtc_failure' */ +#pragma runtime_checks("", off) + +/* + handle_rtc_failure + Catch the RTC error and dump it to stderr +*/ + +int handle_rtc_failure(int err_type, const char *file, int line, + const char* module, const char *format, ...) +{ + va_list args; + va_start(args, format); + fprintf(stderr, "Error:"); + vfprintf(stderr, format, args); + fprintf(stderr, " At %s:%d\n", file, line); + va_end(args); + (void) fflush(stderr); + + return 0; /* Error is handled */ +} +#pragma runtime_checks("", restore) +#endif + + +static void my_win_init(void) +{ + DBUG_ENTER("my_win_init"); + +#if defined(_MSC_VER) +#if _MSC_VER < 1300 + /* + Clear the OS system variable TZ and avoid the 100% CPU usage + Only for old versions of Visual C++ + */ + _putenv( "TZ=" ); +#endif +#if _MSC_VER >= 1400 + /* this is required to make crt functions return -1 appropriately */ + _set_invalid_parameter_handler(my_parameter_handler); +#endif +#endif +#ifdef __MSVC_RUNTIME_CHECKS + /* + Install handler to send RTC (Runtime Error Check) warnings + to log file + */ + _RTC_SetErrorFunc(handle_rtc_failure); +#endif + + _tzset(); + + + + + + + + + + + + + + + + + + + + + + + + + + /* The following is used by time functions */ +#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10) +#define MS 10000000 + { + FILETIME ft; + LARGE_INTEGER li, t_cnt; + DBUG_ASSERT(sizeof(LARGE_INTEGER) == sizeof(query_performance_frequency)); + if (QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency) == 0) + query_performance_frequency= 0; + else + { + GetSystemTimeAsFileTime(&ft); + li.LowPart= ft.dwLowDateTime; + li.HighPart= ft.dwHighDateTime; + query_performance_offset= li.QuadPart-OFFSET_TO_EPOC; + QueryPerformanceCounter(&t_cnt); + query_performance_offset-= (t_cnt.QuadPart / + query_performance_frequency * MS + + t_cnt.QuadPart % + query_performance_frequency * MS / + query_performance_frequency); + } + } + + { + /* + Open HKEY_LOCAL_MACHINE\SOFTWARE\MySQL and set any strings found + there as environment variables + */ + HKEY key_handle; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)"SOFTWARE\\MySQL", + 0, KEY_READ, &key_handle) == ERROR_SUCCESS) + { + LONG ret; + DWORD index= 0; + DWORD type; + char key_name[256], key_data[1024]; + DWORD key_name_len= sizeof(key_name) - 1; + DWORD key_data_len= sizeof(key_data) - 1; + + while ((ret= RegEnumValue(key_handle, index++, + key_name, &key_name_len, + NULL, &type, (LPBYTE)&key_data, + &key_data_len)) != ERROR_NO_MORE_ITEMS) + { + char env_string[sizeof(key_name) + sizeof(key_data) + 2]; + + if (ret == ERROR_MORE_DATA) + { + /* Registry value larger than 'key_data', skip it */ + DBUG_PRINT("error", ("Skipped registry value that was too large")); + } + else if (ret == ERROR_SUCCESS) + { + if (type == REG_SZ) + { + strxmov(env_string, key_name, "=", key_data, NullS); + + /* variable for putenv must be allocated ! */ + putenv(strdup(env_string)) ; + } + } + else + { + /* Unhandled error, break out of loop */ + break; + } + + key_name_len= sizeof(key_name) - 1; + key_data_len= sizeof(key_data) - 1; + } + + RegCloseKey(key_handle) ; + } + } + DBUG_VOID_RETURN ; +} + + +/*------------------------------------------------------------------ + Name: CheckForTcpip| Desc: checks if tcpip has been installed on system + According to Microsoft Developers documentation the first registry + entry should be enough to check if TCP/IP is installed, but as expected + this doesn't work on all Win32 machines :( +------------------------------------------------------------------*/ + +#define TCPIPKEY "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define WINSOCK2KEY "SYSTEM\\CurrentControlSet\\Services\\Winsock2\\Parameters" +#define WINSOCKKEY "SYSTEM\\CurrentControlSet\\Services\\Winsock\\Parameters" + +static my_bool win32_have_tcpip(void) +{ + HKEY hTcpipRegKey; + if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, TCPIPKEY, 0, KEY_READ, + &hTcpipRegKey) != ERROR_SUCCESS) + { + if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCK2KEY, 0, KEY_READ, + &hTcpipRegKey) != ERROR_SUCCESS) + { + if (RegOpenKeyEx ( HKEY_LOCAL_MACHINE, WINSOCKKEY, 0, KEY_READ, + &hTcpipRegKey) != ERROR_SUCCESS) + if (!getenv("HAVE_TCPIP") || have_tcpip) /* Provide a workaround */ + return (FALSE); + } + } + RegCloseKey ( hTcpipRegKey); + return (TRUE); +} + + +static my_bool win32_init_tcp_ip() +{ + if (win32_have_tcpip()) + { + WORD wVersionRequested = MAKEWORD( 2, 0 ); + WSADATA wsaData; + /* Be a good citizen: maybe another lib has already initialised + sockets, so dont clobber them unless necessary */ + if (WSAStartup( wVersionRequested, &wsaData )) + { + /* Load failed, maybe because of previously loaded + incompatible version; try again */ + WSACleanup( ); + if (!WSAStartup( wVersionRequested, &wsaData )) + have_tcpip=1; + } + else + { + if (wsaData.wVersion != wVersionRequested) + { + /* Version is no good, try again */ + WSACleanup( ); + if (!WSAStartup( wVersionRequested, &wsaData )) + have_tcpip=1; + } + else + have_tcpip=1; + } + } + return(0); +} +#endif /* __WIN__ */ + + +#ifdef __NETWARE__ +/* + Basic initialisation for netware +*/ + +static void netware_init() +{ + char cwd[PATH_MAX], *name; + + DBUG_ENTER("netware_init"); + + /* init only if we are not a client library */ + if (my_progname) + { +#if SUPPORTED_BY_LIBC /* Removed until supported in Libc */ + struct termios tp; + /* Disable control characters */ + tcgetattr(STDIN_FILENO, &tp); + tp.c_cc[VINTR] = _POSIX_VDISABLE; + tp.c_cc[VEOF] = _POSIX_VDISABLE; + tp.c_cc[VSUSP] = _POSIX_VDISABLE; + tcsetattr(STDIN_FILENO, TCSANOW, &tp); +#endif /* SUPPORTED_BY_LIBC */ + + /* With stdout redirection */ + if (!isatty(STDOUT_FILENO)) + { + setscreenmode(SCR_AUTOCLOSE_ON_EXIT); /* auto close the screen */ + } + else + { + setscreenmode(SCR_NO_MODE); /* keep the screen up */ + } + + /* Parse program name and change to base format */ + name= (char*) my_progname; + for (; *name; name++) + { + if (*name == '\\') + { + *name = '/'; + } + else + { + *name = tolower(*name); + } + } + } + + DBUG_VOID_RETURN; +} +#endif /* __NETWARE__ */ diff --git a/externals/mysql/mysys/my_largepage.c b/externals/mysql/mysys/my_largepage.c new file mode 100644 index 0000000..9fa5b73 --- /dev/null +++ b/externals/mysql/mysys/my_largepage.c @@ -0,0 +1,166 @@ +/* Copyright (C) 2004 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" + +#ifdef HAVE_LARGE_PAGES + +#ifdef HAVE_SYS_IPC_H +#include +#endif + +#ifdef HAVE_SYS_SHM_H +#include +#endif + +static uint my_get_large_page_size_int(void); +static uchar* my_large_malloc_int(size_t size, myf my_flags); +static my_bool my_large_free_int(uchar* ptr, myf my_flags); + +/* Gets the size of large pages from the OS */ + +uint my_get_large_page_size(void) +{ + uint size; + DBUG_ENTER("my_get_large_page_size"); + + if (!(size = my_get_large_page_size_int())) + fprintf(stderr, "Warning: Failed to determine large page size\n"); + + DBUG_RETURN(size); +} + +/* + General large pages allocator. + Tries to allocate memory from large pages pool and falls back to + my_malloc_lock() in case of failure +*/ + +uchar* my_large_malloc(size_t size, myf my_flags) +{ + uchar* ptr; + DBUG_ENTER("my_large_malloc"); + + if (my_use_large_pages && my_large_page_size) + { + if ((ptr = my_large_malloc_int(size, my_flags)) != NULL) + DBUG_RETURN(ptr); + if (my_flags & MY_WME) + fprintf(stderr, "Warning: Using conventional memory pool\n"); + } + + DBUG_RETURN(my_malloc_lock(size, my_flags)); +} + +/* + General large pages deallocator. + Tries to deallocate memory as if it was from large pages pool and falls back + to my_free_lock() in case of failure + */ + +void my_large_free(uchar* ptr, myf my_flags __attribute__((unused))) +{ + DBUG_ENTER("my_large_free"); + + /* + my_large_free_int() can only fail if ptr was not allocated with + my_large_malloc_int(), i.e. my_malloc_lock() was used so we should free it + with my_free_lock() + */ + if (!my_use_large_pages || !my_large_page_size || + !my_large_free_int(ptr, my_flags)) + my_free_lock(ptr, my_flags); + + DBUG_VOID_RETURN; +} + +#ifdef HUGETLB_USE_PROC_MEMINFO +/* Linux-specific function to determine the size of large pages */ + +uint my_get_large_page_size_int(void) +{ + FILE *f; + uint size = 0; + char buf[256]; + DBUG_ENTER("my_get_large_page_size_int"); + + if (!(f = my_fopen("/proc/meminfo", O_RDONLY, MYF(MY_WME)))) + goto finish; + + while (fgets(buf, sizeof(buf), f)) + if (sscanf(buf, "Hugepagesize: %u kB", &size)) + break; + + my_fclose(f, MYF(MY_WME)); + +finish: + DBUG_RETURN(size * 1024); +} +#endif /* HUGETLB_USE_PROC_MEMINFO */ + +#if HAVE_DECL_SHM_HUGETLB +/* Linux-specific large pages allocator */ + +uchar* my_large_malloc_int(size_t size, myf my_flags) +{ + int shmid; + uchar* ptr; + struct shmid_ds buf; + DBUG_ENTER("my_large_malloc_int"); + + /* Align block size to my_large_page_size */ + size = ((size - 1) & ~(my_large_page_size - 1)) + my_large_page_size; + + shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | SHM_R | SHM_W); + if (shmid < 0) + { + if (my_flags & MY_WME) + fprintf(stderr, + "Warning: Failed to allocate %lu bytes from HugeTLB memory." + " errno %d\n", (ulong) size, errno); + + DBUG_RETURN(NULL); + } + + ptr = (uchar*) shmat(shmid, NULL, 0); + if (ptr == (uchar *) -1) + { + if (my_flags& MY_WME) + fprintf(stderr, "Warning: Failed to attach shared memory segment," + " errno %d\n", errno); + shmctl(shmid, IPC_RMID, &buf); + + DBUG_RETURN(NULL); + } + + /* + Remove the shared memory segment so that it will be automatically freed + after memory is detached or process exits + */ + shmctl(shmid, IPC_RMID, &buf); + + DBUG_RETURN(ptr); +} + +/* Linux-specific large pages deallocator */ + +my_bool my_large_free_int(uchar *ptr, myf my_flags __attribute__((unused))) +{ + DBUG_ENTER("my_large_free_int"); + DBUG_RETURN(shmdt(ptr) == 0); +} +#endif /* HAVE_DECL_SHM_HUGETLB */ + +#endif /* HAVE_LARGE_PAGES */ diff --git a/externals/mysql/mysys/my_lib.c b/externals/mysql/mysys/my_lib.c new file mode 100644 index 0000000..30d0f89 --- /dev/null +++ b/externals/mysql/mysys/my_lib.c @@ -0,0 +1,559 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* TODO: check for overun of memory for names. */ +/* Convert MSDOS-TIME to standar time_t (still needed?) */ + +#include "mysys_priv.h" +#include +#include /* Structs used by my_dir,includes sys/types */ +#include "mysys_err.h" +#if defined(HAVE_DIRENT_H) +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if defined(HAVE_SYS_NDIR_H) +# include +# endif +# if defined(HAVE_SYS_DIR_H) +# include +# endif +# if defined(HAVE_NDIR_H) +# include +# endif +# if defined(_WIN32) +# ifdef __BORLANDC__ +# include +# endif +# endif +#endif +#ifdef VMS +#include +#include +#include +#endif + +#if defined(THREAD) && defined(HAVE_READDIR_R) +#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C) +#else +#define READDIR(A,B,C) (!(C=readdir(A))) +#endif + +/* + We are assuming that directory we are reading is either has less than + 100 files and so can be read in one initial chunk or has more than 1000 + files and so big increment are suitable. +*/ +#define ENTRIES_START_SIZE (8192/sizeof(FILEINFO)) +#define ENTRIES_INCREMENT (65536/sizeof(FILEINFO)) +#define NAMES_START_SIZE 32768 + + +static int comp_names(struct fileinfo *a,struct fileinfo *b); + + + /* We need this because program don't know with malloc we used */ + +void my_dirend(MY_DIR *buffer) +{ + DBUG_ENTER("my_dirend"); + if (buffer) + { + delete_dynamic((DYNAMIC_ARRAY*)((char*)buffer + + ALIGN_SIZE(sizeof(MY_DIR)))); + free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) + + ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0)); + my_free((uchar*) buffer,MYF(0)); + } + DBUG_VOID_RETURN; +} /* my_dirend */ + + + /* Compare in sort of filenames */ + +static int comp_names(struct fileinfo *a, struct fileinfo *b) +{ + return (strcmp(a->name,b->name)); +} /* comp_names */ + + +#if !defined(_WIN32) + +MY_DIR *my_dir(const char *path, myf MyFlags) +{ + char *buffer; + MY_DIR *result= 0; + FILEINFO finfo; + DYNAMIC_ARRAY *dir_entries_storage; + MEM_ROOT *names_storage; + DIR *dirp; + struct dirent *dp; + char tmp_path[FN_REFLEN+1],*tmp_file; +#ifdef THREAD + char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1]; +#endif + DBUG_ENTER("my_dir"); + DBUG_PRINT("my",("path: '%s' MyFlags: %d",path,MyFlags)); + +#if defined(THREAD) && !defined(HAVE_READDIR_R) + pthread_mutex_lock(&THR_LOCK_open); +#endif + + dirp = opendir(directory_file_name(tmp_path,(char *) path)); +#if defined(__amiga__) + if ((dirp->dd_fd) < 0) /* Directory doesn't exists */ + goto error; +#endif + if (dirp == NULL || + ! (buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) + + ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) + + sizeof(MEM_ROOT), MyFlags))) + goto error; + + dir_entries_storage= (DYNAMIC_ARRAY*)(buffer + ALIGN_SIZE(sizeof(MY_DIR))); + names_storage= (MEM_ROOT*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)) + + ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))); + + if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO), + ENTRIES_START_SIZE, ENTRIES_INCREMENT)) + { + my_free((uchar*) buffer,MYF(0)); + goto error; + } + init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE); + + /* MY_DIR structure is allocated and completly initialized at this point */ + result= (MY_DIR*)buffer; + + tmp_file=strend(tmp_path); + +#ifdef THREAD + dp= (struct dirent*) dirent_tmp; +#else + dp=0; +#endif + + while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp))) + { + if (!(finfo.name= strdup_root(names_storage, dp->d_name))) + goto error; + + if (MyFlags & MY_WANT_STAT) + { + if (!(finfo.mystat= (MY_STAT*)alloc_root(names_storage, + sizeof(MY_STAT)))) + goto error; + + bzero(finfo.mystat, sizeof(MY_STAT)); + (void) strmov(tmp_file,dp->d_name); + (void) my_stat(tmp_path, finfo.mystat, MyFlags); + if (!(finfo.mystat->st_mode & MY_S_IREAD)) + continue; + } + else + finfo.mystat= NULL; + + if (push_dynamic(dir_entries_storage, (uchar*)&finfo)) + goto error; + } + + (void) closedir(dirp); +#if defined(THREAD) && !defined(HAVE_READDIR_R) + pthread_mutex_unlock(&THR_LOCK_open); +#endif + result->dir_entry= (FILEINFO *)dir_entries_storage->buffer; + result->number_off_files= dir_entries_storage->elements; + + if (!(MyFlags & MY_DONT_SORT)) + my_qsort((void *) result->dir_entry, result->number_off_files, + sizeof(FILEINFO), (qsort_cmp) comp_names); + DBUG_RETURN(result); + + error: +#if defined(THREAD) && !defined(HAVE_READDIR_R) + pthread_mutex_unlock(&THR_LOCK_open); +#endif + my_errno=errno; + if (dirp) + (void) closedir(dirp); + my_dirend(result); + if (MyFlags & (MY_FAE | MY_WME)) + my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,my_errno); + DBUG_RETURN((MY_DIR *) NULL); +} /* my_dir */ + + +/* + * Convert from directory name to filename. + * On VMS: + * xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1 + * xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1 + * On UNIX, it's simple: just make sure there is a terminating / + + * Returns pointer to dst; + */ + +char * directory_file_name (char * dst, const char *src) +{ +#ifndef VMS + + /* Process as Unix format: just remove test the final slash. */ + + char * end; + + if (src[0] == 0) + src= (char*) "."; /* Use empty as current */ + end=strmov(dst, src); + if (end[-1] != FN_LIBCHAR) + { + end[0]=FN_LIBCHAR; /* Add last '/' */ + end[1]='\0'; + } + return dst; + +#else /* VMS */ + + long slen; + long rlen; + char * ptr, rptr; + char bracket; + struct FAB fab = cc$rms_fab; + struct NAM nam = cc$rms_nam; + char esa[NAM$C_MAXRSS]; + + if (! src[0]) + src="[.]"; /* Empty is == current dir */ + + slen = strlen (src) - 1; + if (src[slen] == FN_C_AFTER_DIR || src[slen] == FN_C_AFTER_DIR_2 || + src[slen] == FN_DEVCHAR) + { + /* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */ + fab.fab$l_fna = src; + fab.fab$b_fns = slen + 1; + fab.fab$l_nam = &nam; + fab.fab$l_fop = FAB$M_NAM; + + nam.nam$l_esa = esa; + nam.nam$b_ess = sizeof esa; + nam.nam$b_nop |= NAM$M_SYNCHK; + + /* We call SYS$PARSE to handle such things as [--] for us. */ + if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL) + { + slen = nam.nam$b_esl - 1; + if (esa[slen] == ';' && esa[slen - 1] == '.') + slen -= 2; + esa[slen + 1] = '\0'; + src = esa; + } + if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2) + { + /* what about when we have logical_name:???? */ + if (src[slen] == FN_DEVCHAR) + { /* Xlate logical name and see what we get */ + (void) strmov(dst,src); + dst[slen] = 0; /* remove colon */ + if (!(src = getenv (dst))) + return dst; /* Can't translate */ + + /* should we jump to the beginning of this procedure? + Good points: allows us to use logical names that xlate + to Unix names, + Bad points: can be a problem if we just translated to a device + name... + For now, I'll punt and always expect VMS names, and hope for + the best! */ + + slen = strlen (src) - 1; + if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2) + { /* no recursion here! */ + (void) strmov(dst, src); + return(dst); + } + } + else + { /* not a directory spec */ + (void) strmov(dst, src); + return(dst); + } + } + + bracket = src[slen]; /* End char */ + if (!(ptr = strchr (src, bracket - 2))) + { /* no opening bracket */ + (void) strmov (dst, src); + return dst; + } + if (!(rptr = strrchr (src, '.'))) + rptr = ptr; + slen = rptr - src; + (void) strmake (dst, src, slen); + + if (*rptr == '.') + { /* Put bracket and add */ + dst[slen++] = bracket; /* (rptr+1) after this */ + } + else + { + /* If we have the top-level of a rooted directory (i.e. xx:[000000]), + then translate the device and recurse. */ + + if (dst[slen - 1] == ':' + && dst[slen - 2] != ':' /* skip decnet nodes */ + && strcmp(src + slen, "[000000]") == 0) + { + dst[slen - 1] = '\0'; + if ((ptr = getenv (dst)) + && (rlen = strlen (ptr) - 1) > 0 + && (ptr[rlen] == FN_C_AFTER_DIR || ptr[rlen] == FN_C_AFTER_DIR_2) + && ptr[rlen - 1] == '.') + { + (void) strmov(esa,ptr); + esa[rlen - 1] = FN_C_AFTER_DIR; + esa[rlen] = '\0'; + return (directory_file_name (dst, esa)); + } + else + dst[slen - 1] = ':'; + } + (void) strmov(dst+slen,"[000000]"); + slen += 8; + } + (void) strmov(strmov(dst+slen,rptr+1)-1,".DIR.1"); + return dst; + } + (void) strmov(dst, src); + if (dst[slen] == '/' && slen > 1) + dst[slen] = 0; + return dst; +#endif /* VMS */ +} /* directory_file_name */ + +#else + +/* +***************************************************************************** +** Read long filename using windows rutines +***************************************************************************** +*/ + +MY_DIR *my_dir(const char *path, myf MyFlags) +{ + char *buffer; + MY_DIR *result= 0; + FILEINFO finfo; + DYNAMIC_ARRAY *dir_entries_storage; + MEM_ROOT *names_storage; +#ifdef __BORLANDC__ + struct ffblk find; +#else + struct _finddata_t find; +#endif + ushort mode; + char tmp_path[FN_REFLEN],*tmp_file,attrib; +#ifdef _WIN64 + __int64 handle; +#else + long handle; +#endif + DBUG_ENTER("my_dir"); + DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags)); + + /* Put LIB-CHAR as last path-character if not there */ + tmp_file=tmp_path; + if (!*path) + *tmp_file++ ='.'; /* From current dir */ + tmp_file= strnmov(tmp_file, path, FN_REFLEN-5); + if (tmp_file[-1] == FN_DEVCHAR) + *tmp_file++= '.'; /* From current dev-dir */ + if (tmp_file[-1] != FN_LIBCHAR) + *tmp_file++ =FN_LIBCHAR; + tmp_file[0]='*'; /* Windows needs this !??? */ + tmp_file[1]='.'; + tmp_file[2]='*'; + tmp_file[3]='\0'; + + if (!(buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) + + ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) + + sizeof(MEM_ROOT), MyFlags))) + goto error; + + dir_entries_storage= (DYNAMIC_ARRAY*)(buffer + ALIGN_SIZE(sizeof(MY_DIR))); + names_storage= (MEM_ROOT*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)) + + ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))); + + if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO), + ENTRIES_START_SIZE, ENTRIES_INCREMENT)) + { + my_free((uchar*) buffer,MYF(0)); + goto error; + } + init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE); + + /* MY_DIR structure is allocated and completly initialized at this point */ + result= (MY_DIR*)buffer; + +#ifdef __BORLANDC__ + if ((handle= findfirst(tmp_path,&find,0)) == -1L) +#else + if ((handle=_findfirst(tmp_path,&find)) == -1L) +#endif + { + DBUG_PRINT("info", ("findfirst returned error, errno: %d", errno)); + if (errno != EINVAL) + goto error; + /* + Could not read the directory, no read access. + Probably because by "chmod -r". + continue and return zero files in dir + */ + } + else + { + + do + { +#ifdef __BORLANDC__ + attrib= find.ff_attrib; +#else + attrib= find.attrib; + /* + Do not show hidden and system files which Windows sometimes create. + Note. Because Borland's findfirst() is called with the third + argument = 0 hidden/system files are excluded from the search. + */ + if (attrib & (_A_HIDDEN | _A_SYSTEM)) + continue; +#endif +#ifdef __BORLANDC__ + if (!(finfo.name= strdup_root(names_storage, find.ff_name))) + goto error; +#else + if (!(finfo.name= strdup_root(names_storage, find.name))) + goto error; +#endif + if (MyFlags & MY_WANT_STAT) + { + if (!(finfo.mystat= (MY_STAT*)alloc_root(names_storage, + sizeof(MY_STAT)))) + goto error; + + bzero(finfo.mystat, sizeof(MY_STAT)); +#ifdef __BORLANDC__ + finfo.mystat->st_size=find.ff_fsize; +#else + finfo.mystat->st_size=find.size; +#endif + mode= MY_S_IREAD; + if (!(attrib & _A_RDONLY)) + mode|= MY_S_IWRITE; + if (attrib & _A_SUBDIR) + mode|= MY_S_IFDIR; + finfo.mystat->st_mode= mode; +#ifdef __BORLANDC__ + finfo.mystat->st_mtime= ((uint32) find.ff_ftime); +#else + finfo.mystat->st_mtime= ((uint32) find.time_write); +#endif + } + else + finfo.mystat= NULL; + + if (push_dynamic(dir_entries_storage, (uchar*)&finfo)) + goto error; + } +#ifdef __BORLANDC__ + while (findnext(&find) == 0); +#else + while (_findnext(handle,&find) == 0); + + _findclose(handle); +#endif + } + + result->dir_entry= (FILEINFO *)dir_entries_storage->buffer; + result->number_off_files= dir_entries_storage->elements; + + if (!(MyFlags & MY_DONT_SORT)) + my_qsort((void *) result->dir_entry, result->number_off_files, + sizeof(FILEINFO), (qsort_cmp) comp_names); + DBUG_PRINT("exit", ("found %d files", result->number_off_files)); + DBUG_RETURN(result); +error: + my_errno=errno; +#ifndef __BORLANDC__ + if (handle != -1) + _findclose(handle); +#endif + my_dirend(result); + if (MyFlags & MY_FAE+MY_WME) + my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno); + DBUG_RETURN((MY_DIR *) NULL); +} /* my_dir */ + +#endif /* _WIN32 */ + +/**************************************************************************** +** File status +** Note that MY_STAT is assumed to be same as struct stat +****************************************************************************/ + + +int my_fstat(File Filedes, MY_STAT *stat_area, + myf MyFlags __attribute__((unused))) +{ + DBUG_ENTER("my_fstat"); + DBUG_PRINT("my",("fd: %d MyFlags: %d", Filedes, MyFlags)); +#ifdef _WIN32 + DBUG_RETURN(my_win_fstat(Filedes, stat_area)); +#else + DBUG_RETURN(fstat(Filedes, (struct stat *) stat_area)); +#endif +} + + +MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags) +{ + int m_used; + DBUG_ENTER("my_stat"); + DBUG_PRINT("my", ("path: '%s' stat_area: %p MyFlags: %d", path, + stat_area, my_flags)); + + if ((m_used= (stat_area == NULL))) + if (!(stat_area= (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags))) + goto error; +#ifndef _WIN32 + if (! stat((char *) path, (struct stat *) stat_area) ) + DBUG_RETURN(stat_area); +#else + if (! my_win_stat(path, stat_area) ) + DBUG_RETURN(stat_area); +#endif + DBUG_PRINT("error",("Got errno: %d from stat", errno)); + my_errno= errno; + if (m_used) /* Free if new area */ + my_free((uchar*) stat_area,MYF(0)); + +error: + if (my_flags & (MY_FAE+MY_WME)) + { + my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),path,my_errno); + DBUG_RETURN((MY_STAT *) NULL); + } + DBUG_RETURN((MY_STAT *) NULL); +} /* my_stat */ diff --git a/externals/mysql/mysys/my_libwrap.c b/externals/mysql/mysys/my_libwrap.c new file mode 100644 index 0000000..e72334b --- /dev/null +++ b/externals/mysql/mysys/my_libwrap.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This is needed to be able to compile with original libwrap header + files that don't have the prototypes +*/ + +#include +#include + +#ifdef HAVE_LIBWRAP + +void my_fromhost(struct request_info *req) +{ + fromhost(req); +} + +int my_hosts_access(struct request_info *req) +{ + return hosts_access(req); +} + +char *my_eval_client(struct request_info *req) +{ + return eval_client(req); +} + +#endif /* HAVE_LIBWRAP */ diff --git a/externals/mysql/mysys/my_lock.c b/externals/mysql/mysys/my_lock.c new file mode 100644 index 0000000..408089d --- /dev/null +++ b/externals/mysql/mysys/my_lock.c @@ -0,0 +1,290 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#undef MY_HOW_OFTEN_TO_ALARM +#define MY_HOW_OFTEN_TO_ALARM ((int) my_time_to_wait_for_lock) +#ifdef NO_ALARM_LOOP +#undef NO_ALARM_LOOP +#endif +#include +#ifdef __NETWARE__ +#include +#endif + +#ifdef _WIN32 +#define WIN_LOCK_INFINITE -1 +#define WIN_LOCK_SLEEP_MILLIS 100 + +static int win_lock(File fd, int locktype, my_off_t start, my_off_t length, + int timeout_sec) +{ + LARGE_INTEGER liOffset,liLength; + DWORD dwFlags; + OVERLAPPED ov= {0}; + HANDLE hFile= (HANDLE)my_get_osfhandle(fd); + DWORD lastError= 0; + int i; + int timeout_millis= timeout_sec * 1000; + + DBUG_ENTER("win_lock"); + + liOffset.QuadPart= start; + liLength.QuadPart= length; + + ov.Offset= liOffset.LowPart; + ov.OffsetHigh= liOffset.HighPart; + + if (locktype == F_UNLCK) + { + if (UnlockFileEx(hFile, 0, liLength.LowPart, liLength.HighPart, &ov)) + DBUG_RETURN(0); + /* + For compatibility with fcntl implementation, ignore error, + if region was not locked + */ + if (GetLastError() == ERROR_NOT_LOCKED) + { + SetLastError(0); + DBUG_RETURN(0); + } + goto error; + } + else if (locktype == F_RDLCK) + /* read lock is mapped to a shared lock. */ + dwFlags= 0; + else + /* write lock is mapped to an exclusive lock. */ + dwFlags= LOCKFILE_EXCLUSIVE_LOCK; + + /* + Drop old lock first to avoid double locking. + During analyze of Bug#38133 (Myisamlog test fails on Windows) + I met the situation that the program myisamlog locked the file + exclusively, then additionally shared, then did one unlock, and + then blocked on an attempt to lock it exclusively again. + Unlocking before every lock fixed the problem. + Note that this introduces a race condition. When the application + wants to convert an exclusive lock into a shared one, it will now + first unlock the file and then lock it shared. A waiting exclusive + lock could step in here. For reasons described in Bug#38133 and + Bug#41124 (Server hangs on Windows with --external-locking after + INSERT...SELECT) and in the review thread at + http://lists.mysql.com/commits/60721 it seems to be the better + option than not to unlock here. + If one day someone notices a way how to do file lock type changes + on Windows without unlocking before taking the new lock, please + change this code accordingly to fix the race condition. + */ + if (!UnlockFileEx(hFile, 0, liLength.LowPart, liLength.HighPart, &ov) && + (GetLastError() != ERROR_NOT_LOCKED)) + goto error; + + if (timeout_sec == WIN_LOCK_INFINITE) + { + if (LockFileEx(hFile, dwFlags, 0, liLength.LowPart, liLength.HighPart, &ov)) + DBUG_RETURN(0); + goto error; + } + + dwFlags|= LOCKFILE_FAIL_IMMEDIATELY; + timeout_millis= timeout_sec * 1000; + /* Try lock in a loop, until the lock is acquired or timeout happens */ + for(i= 0; ;i+= WIN_LOCK_SLEEP_MILLIS) + { + if (LockFileEx(hFile, dwFlags, 0, liLength.LowPart, liLength.HighPart, &ov)) + DBUG_RETURN(0); + + if (GetLastError() != ERROR_LOCK_VIOLATION) + goto error; + + if (i >= timeout_millis) + break; + Sleep(WIN_LOCK_SLEEP_MILLIS); + } + + /* timeout */ + errno= EAGAIN; + DBUG_RETURN(-1); + +error: + my_osmaperr(GetLastError()); + DBUG_RETURN(-1); +} +#endif + + + +/* + Lock a part of a file + + RETURN VALUE + 0 Success + -1 An error has occured and 'my_errno' is set + to indicate the actual error code. +*/ + +int my_lock(File fd, int locktype, my_off_t start, my_off_t length, + myf MyFlags) +{ +#ifdef HAVE_FCNTL + int value; + ALARM_VARIABLES; +#endif +#ifdef __NETWARE__ + int nxErrno; +#endif + + DBUG_ENTER("my_lock"); + DBUG_PRINT("my",("fd: %d Op: %d start: %ld Length: %ld MyFlags: %d", + fd,locktype,(long) start,(long) length,MyFlags)); +#ifdef VMS + DBUG_RETURN(0); +#else + if (my_disable_locking && ! (MyFlags & MY_FORCE_LOCK)) + DBUG_RETURN(0); + +#if defined(__NETWARE__) + { + NXSOffset_t nxLength = length; + unsigned long nxLockFlags = 0; + + if ((MyFlags & MY_SHORT_WAIT)) + { + /* not yet implemented */ + MyFlags|= MY_NO_WAIT; + } + + if (length == F_TO_EOF) + { + /* EOF is interpreted as a very large length. */ + nxLength = 0x7FFFFFFFFFFFFFFF; + } + + if (locktype == F_UNLCK) + { + /* The lock flags are currently ignored by NKS. */ + if (!(nxErrno= NXFileRangeUnlock(fd, 0L, start, nxLength))) + DBUG_RETURN(0); + } + else + { + if (locktype == F_RDLCK) + { + /* A read lock is mapped to a shared lock. */ + nxLockFlags = NX_RANGE_LOCK_SHARED; + } + else + { + /* A write lock is mapped to an exclusive lock. */ + nxLockFlags = NX_RANGE_LOCK_EXCL; + } + + if (MyFlags & MY_NO_WAIT) + { + /* Don't block on the lock. */ + nxLockFlags |= NX_RANGE_LOCK_TRYLOCK; + } + + if (!(nxErrno= NXFileRangeLock(fd, nxLockFlags, start, nxLength))) + DBUG_RETURN(0); + } + } +#elif defined(_WIN32) + { + int timeout_sec; + if (MyFlags & MY_NO_WAIT) + timeout_sec= 0; + else if(MyFlags & MY_SHORT_WAIT) + timeout_sec= my_time_to_wait_for_lock; + else + timeout_sec= WIN_LOCK_INFINITE; + + if(win_lock(fd, locktype, start, length, timeout_sec) == 0) + DBUG_RETURN(0); + } +#else +#if defined(HAVE_FCNTL) + { + struct flock lock; + + lock.l_type= (short) locktype; + lock.l_whence= SEEK_SET; + lock.l_start= (off_t) start; + lock.l_len= (off_t) length; + + if (MyFlags & (MY_NO_WAIT | MY_SHORT_WAIT)) + { + if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */ + DBUG_RETURN(0); /* Ok, file locked */ + if (MyFlags & MY_NO_WAIT) + { + my_errno= (errno == EACCES) ? EAGAIN : errno ? errno : -1; + DBUG_RETURN(-1); + } + + DBUG_PRINT("info",("Was locked, trying with alarm")); + ALARM_INIT; + while ((value=fcntl(fd,F_SETLKW,&lock)) && ! ALARM_TEST && + errno == EINTR) + { /* Setup again so we don`t miss it */ + ALARM_REINIT; + } + ALARM_END; + if (value != -1) + DBUG_RETURN(0); + if (errno == EINTR) + errno=EAGAIN; + } + else if (fcntl(fd,F_SETLKW,&lock) != -1) /* Wait until a lock */ + DBUG_RETURN(0); + } +#else + if (MyFlags & MY_SEEK_NOT_DONE) + { + if (my_seek(fd,start,MY_SEEK_SET,MYF(MyFlags & ~MY_SEEK_NOT_DONE)) + == MY_FILEPOS_ERROR) + { + /* + If an error has occured in my_seek then we will already + have an error code in my_errno; Just return error code. + */ + DBUG_RETURN(-1); + } + } + if (lockf(fd,locktype,length) != -1) + DBUG_RETURN(0); +#endif /* HAVE_FCNTL */ +#endif /* HAVE_LOCKING */ + +#ifdef __NETWARE__ + my_errno = nxErrno; +#else + /* We got an error. We don't want EACCES errors */ + my_errno=(errno == EACCES) ? EAGAIN : errno ? errno : -1; +#endif + if (MyFlags & MY_WME) + { + if (locktype == F_UNLCK) + my_error(EE_CANTUNLOCK,MYF(ME_BELL+ME_WAITTANG),my_errno); + else + my_error(EE_CANTLOCK,MYF(ME_BELL+ME_WAITTANG),my_errno); + } + DBUG_PRINT("error",("my_errno: %d (%d)",my_errno,errno)); + DBUG_RETURN(-1); +#endif /* ! VMS */ +} /* my_lock */ diff --git a/externals/mysql/mysys/my_lockmem.c b/externals/mysql/mysys/my_lockmem.c new file mode 100644 index 0000000..7d226b1 --- /dev/null +++ b/externals/mysql/mysys/my_lockmem.c @@ -0,0 +1,103 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Alloc a block of locked memory */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include + +#ifdef HAVE_MLOCK +#include + +struct st_mem_list +{ + LIST list; + uchar *page; + uint size; +}; + +LIST *mem_list; + +void *my_malloc_lock(size_t size,myf MyFlags) +{ + int success; + uint pagesize=sysconf(_SC_PAGESIZE); + uchar *ptr; + struct st_mem_list *element; + DBUG_ENTER("my_malloc_lock"); + + size=((size-1) & ~(pagesize-1))+pagesize; +#if HAVE_MEMALIGN + if (!(ptr=memalign(pagesize,size))) +#else + if (!(ptr=valloc(size))) +#endif + { + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size); + DBUG_RETURN(0); + } + success = mlock((uchar*) ptr,size); + if (success != 0 && geteuid() == 0) + { + DBUG_PRINT("warning",("Failed to lock memory. errno %d\n", + errno)); + fprintf(stderr, "Warning: Failed to lock memory. errno %d\n", + errno); + } + else + { + /* Add block in a list for munlock */ + if (!(element=(struct st_mem_list*) my_malloc(sizeof(*element),MyFlags))) + { + (void) munlock((uchar*) ptr,size); + free(ptr); + DBUG_RETURN(0); + } + element->list.data=(uchar*) element; + element->page=ptr; + element->size=size; + pthread_mutex_lock(&THR_LOCK_malloc); + mem_list=list_add(mem_list,&element->list); + pthread_mutex_unlock(&THR_LOCK_malloc); + } + DBUG_RETURN(ptr); +} + + +void my_free_lock(void *ptr,myf Myflags __attribute__((unused))) +{ + LIST *list; + struct st_mem_list *element=0; + + pthread_mutex_lock(&THR_LOCK_malloc); + for (list=mem_list ; list ; list=list->next) + { + element=(struct st_mem_list*) list->data; + if (ptr == element->page) + { /* Found locked mem */ + (void) munlock((uchar*) ptr,element->size); + mem_list=list_delete(mem_list,list); + break; + } + } + pthread_mutex_unlock(&THR_LOCK_malloc); + if (element) + my_free((uchar*) element,MYF(0)); + free(ptr); /* Free even if not locked */ +} + +#endif /* HAVE_MLOCK */ diff --git a/externals/mysql/mysys/my_malloc.c b/externals/mysql/mysys/my_malloc.c new file mode 100644 index 0000000..f1254c0 --- /dev/null +++ b/externals/mysql/mysys/my_malloc.c @@ -0,0 +1,100 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ +#undef SAFEMALLOC +#endif + +#include "mysys_priv.h" +#include "mysys_err.h" +#include + + /* My memory allocator */ + +void *my_malloc(size_t size, myf my_flags) +{ + void* point; + DBUG_ENTER("my_malloc"); + DBUG_PRINT("my",("size: %lu my_flags: %d", (ulong) size, my_flags)); + + if (!size) + size=1; /* Safety */ + + /* If compiled with DBUG, test for error injection. Described in my_sys.h. */ + /* purecov: begin tested */ + if (!(point= IF_DBUG(my_malloc_error_inject ? NULL :) (char*) malloc(size))) + { + IF_DBUG(if (my_malloc_error_inject) errno= ENOMEM; + my_malloc_error_inject= 0); + my_errno=errno; + if (my_flags & MY_FAE) + error_handler_hook=fatal_error_handler_hook; + if (my_flags & (MY_FAE+MY_WME)) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH),size); + if (my_flags & MY_FAE) + exit(1); + } + else if (my_flags & MY_ZEROFILL) + bzero(point,size); + DBUG_PRINT("exit",("ptr: %p", point)); + DBUG_RETURN((void*) point); + /* purecov: end */ +} /* my_malloc */ + + + /* Free memory allocated with my_malloc */ + /*ARGSUSED*/ + +void my_no_flags_free(void* ptr) +{ + DBUG_ENTER("my_free"); + DBUG_PRINT("my",("ptr: %p", ptr)); + if (ptr) + free(ptr); + DBUG_VOID_RETURN; +} /* my_free */ + + + /* malloc and copy */ + +void* my_memdup(const void *from, size_t length, myf my_flags) +{ + void *ptr; + if ((ptr= my_malloc(length,my_flags)) != 0) + memcpy(ptr, from, length); + return(ptr); +} + + +char *my_strdup(const char *from, myf my_flags) +{ + char *ptr; + size_t length= strlen(from)+1; + if ((ptr= (char*) my_malloc(length, my_flags))) + memcpy((uchar*) ptr, (uchar*) from,(size_t) length); + return(ptr); +} + + +char *my_strndup(const char *from, size_t length, myf my_flags) +{ + char *ptr; + if ((ptr= (char*) my_malloc(length+1,my_flags)) != 0) + { + memcpy((uchar*) ptr, (uchar*) from, length); + ptr[length]=0; + } + return((char*) ptr); +} diff --git a/externals/mysql/mysys/my_memmem.c b/externals/mysql/mysys/my_memmem.c new file mode 100644 index 0000000..c000f14 --- /dev/null +++ b/externals/mysql/mysys/my_memmem.c @@ -0,0 +1,83 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include + +/* + my_memmem, port of a GNU extension. + + Returns a pointer to the beginning of the substring, needle, or NULL if the + substring is not found in haystack. +*/ + +void *my_memmem(const void *haystack, size_t haystacklen, + const void *needle, size_t needlelen) +{ + const unsigned char *cursor; + const unsigned char *last_possible_needle_location = + (unsigned char *)haystack + haystacklen - needlelen; + + /* Easy answers */ + if (needlelen > haystacklen) return(NULL); + if (needle == NULL) return(NULL); + if (haystack == NULL) return(NULL); + if (needlelen == 0) return(NULL); + if (haystacklen == 0) return(NULL); + + for (cursor = haystack; cursor <= last_possible_needle_location; cursor++) { + if (memcmp(needle, cursor, needlelen) == 0) { + return((void *) cursor); + } + } + return(NULL); +} + + + +#ifdef MAIN +#include + +int main(int argc, char *argv[]) { + char haystack[10], needle[3]; + + memmove(haystack, "0123456789", 10); + + memmove(needle, "no", 2); + assert(my_memmem(haystack, 10, needle, 2) == NULL); + + memmove(needle, "345", 3); + assert(my_memmem(haystack, 10, needle, 3) != NULL); + + memmove(needle, "789", 3); + assert(my_memmem(haystack, 10, needle, 3) != NULL); + assert(my_memmem(haystack, 9, needle, 3) == NULL); + + memmove(needle, "012", 3); + assert(my_memmem(haystack, 10, needle, 3) != NULL); + assert(my_memmem(NULL, 10, needle, 3) == NULL); + + assert(my_memmem(NULL, 10, needle, 3) == NULL); + assert(my_memmem(haystack, 0, needle, 3) == NULL); + assert(my_memmem(haystack, 10, NULL, 3) == NULL); + assert(my_memmem(haystack, 10, needle, 0) == NULL); + + assert(my_memmem(haystack, 1, needle, 3) == NULL); + + printf("success\n"); + return(0); +} + +#endif diff --git a/externals/mysql/mysys/my_messnc.c b/externals/mysql/mysys/my_messnc.c new file mode 100644 index 0000000..6f86bf3 --- /dev/null +++ b/externals/mysql/mysys/my_messnc.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" + +void my_message_no_curses(uint error __attribute__((unused)), + const char *str, myf MyFlags) +{ + DBUG_ENTER("my_message_no_curses"); + DBUG_PRINT("enter",("message: %s",str)); + (void) fflush(stdout); + if (MyFlags & ME_BELL) +#ifdef __NETWARE__ + ringbell(); /* Bell */ +#else + (void) fputc('\007',stderr); /* Bell */ +#endif /* __NETWARE__ */ + if (my_progname) + { + (void)fputs(my_progname,stderr); (void)fputs(": ",stderr); + } + (void)fputs(str,stderr); + (void)fputc('\n',stderr); + (void)fflush(stderr); + DBUG_VOID_RETURN; +} diff --git a/externals/mysql/mysys/my_mkdir.c b/externals/mysql/mysys/my_mkdir.c new file mode 100644 index 0000000..676c6c1 --- /dev/null +++ b/externals/mysql/mysys/my_mkdir.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include +#ifdef __WIN__ +#include +#endif + +int my_mkdir(const char *dir, int Flags, myf MyFlags) +{ + DBUG_ENTER("my_dir"); + DBUG_PRINT("enter",("dir: %s",dir)); + +#if defined(__WIN__) + if (mkdir((char*) dir)) +#else + if (mkdir((char*) dir, Flags & my_umask_dir)) +#endif + { + my_errno=errno; + DBUG_PRINT("error",("error %d when creating direcory %s",my_errno,dir)); + if (MyFlags & (MY_FFNF | MY_FAE | MY_WME)) + my_error(EE_CANT_MKDIR, MYF(ME_BELL+ME_WAITTANG), dir, my_errno); + DBUG_RETURN(-1); + } + DBUG_RETURN(0); +} diff --git a/externals/mysql/mysys/my_mmap.c b/externals/mysql/mysys/my_mmap.c new file mode 100644 index 0000000..303d8ef --- /dev/null +++ b/externals/mysql/mysys/my_mmap.c @@ -0,0 +1,80 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" + +#ifdef HAVE_SYS_MMAN_H + +/* + system msync() only syncs mmap'ed area to fs cache. + fsync() is required to really sync to disc +*/ +int my_msync(int fd, void *addr, size_t len, int flags) +{ + msync(addr, len, flags); + return my_sync(fd, MYF(0)); +} + +#elif defined(_WIN32) + +static SECURITY_ATTRIBUTES mmap_security_attributes= + {sizeof(SECURITY_ATTRIBUTES), 0, TRUE}; + +void *my_mmap(void *addr, size_t len, int prot, + int flags, File fd, my_off_t offset) +{ + HANDLE hFileMap; + LPVOID ptr; + HANDLE hFile= (HANDLE)my_get_osfhandle(fd); + if (hFile == INVALID_HANDLE_VALUE) + return MAP_FAILED; + + hFileMap=CreateFileMapping(hFile, &mmap_security_attributes, + PAGE_READWRITE, 0, (DWORD) len, NULL); + if (hFileMap == 0) + return MAP_FAILED; + + ptr=MapViewOfFile(hFileMap, + prot & PROT_WRITE ? FILE_MAP_WRITE : FILE_MAP_READ, + (DWORD)(offset >> 32), (DWORD)offset, len); + + /* + MSDN explicitly states that it's possible to close File Mapping Object + even when a view is not unmapped - then the object will be held open + implicitly until unmap, as every view stores internally a handler of + a corresponding File Mapping Object + */ + CloseHandle(hFileMap); + + if (ptr) + return ptr; + + return MAP_FAILED; +} + +int my_munmap(void *addr, size_t len) +{ + return UnmapViewOfFile(addr) ? 0 : -1; +} + +int my_msync(int fd, void *addr, size_t len, int flags) +{ + return FlushViewOfFile(addr, len) ? 0 : -1; +} + +#else +#warning "no mmap!" +#endif + diff --git a/externals/mysql/mysys/my_net.c b/externals/mysql/mysys/my_net.c new file mode 100644 index 0000000..81d9772 --- /dev/null +++ b/externals/mysql/mysys/my_net.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* thread safe version of some common functions */ + +#include "mysys_priv.h" +#include + +/* for thread safe my_inet_ntoa */ +#if !defined(__WIN__) +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#endif /* !defined(__WIN__) */ + +void my_inet_ntoa(struct in_addr in, char *buf) +{ + char *ptr; + pthread_mutex_lock(&THR_LOCK_net); + ptr=inet_ntoa(in); + strmov(buf,ptr); + pthread_mutex_unlock(&THR_LOCK_net); +} diff --git a/externals/mysql/mysys/my_netware.c b/externals/mysql/mysys/my_netware.c new file mode 100644 index 0000000..5b5c39c --- /dev/null +++ b/externals/mysql/mysys/my_netware.c @@ -0,0 +1,150 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Functions specific to netware +*/ + +#include +#ifdef __NETWARE__ + #include + #include + +/* + PMUserLicenseRequest is an API exported by the polimgr.nlm + (loaded by the NetWare OS when it comes up) for use by other + NLM-based NetWare products/services. + PMUserLicenseRequest provides a couple of functions: + 1) it will optionally request a User license or ensure that + one already exists for the specified User in userInfo + 2) it utilizes the NetWare usage metering service to + record usage information about your product/service. +*/ + +long PMMeteredUsageRequest +( + /* + NDS distinguished name or IP address or ??. asciiz string, e.g. + ".CN=Admin.O=this.T=MYTREE." + */ + char *userInfo, + long infoType, /* see defined values */ + /* + string used to identify the calling service, used to index the + metered info e.g. "iPrint" + */ + char *serviceID, + char tranAddrType, /* type of address that follows */ + char *tranAddr, /* ptr to a 10-byte array */ + long flags, /* see defined values */ + /* NLS error code, if any. NULL input is okay */ + long *licRequestErrCode, + /* meter service error code, if any. NULL input is okay */ + long *storeMeterInfoErrCode, + /* + error code from NLSMeter if + storeMeterInfoErrCode == PM_LICREQ_NLSMETERERROR. + NULL input is okay + */ + long *NLSMeterErrCode +); + +typedef long(*PMUR)(const char*, long, const char*, char, + const char*, long, long*, long*, long*); + +/* infoType */ +/* indicates that the info in the userInfo param is an NDS user */ +#define PM_USERINFO_TYPE_NDS 1 +/* indicates that the info in the userInfo param is NOT an NDS user */ +#define PM_USERINFO_TYPE_ADDRESS 2 + +/* Flags */ + +/* + Tells the service that it should not check to see if the NDS user + contained in the userInfo param has a NetWare User License - just + record metering information; this is ignored if infoType != + PM_USERINFO_TYPE_NDS +*/ + +#define PM_FLAGS_METER_ONLY 0x0000001 + +/* + Indicates that the values in the userInfo and serviceID parameters + are unicode strings, so that the metering service bypasses + converting these to unicode (again) +*/ +#define PM_LICREQ_ALREADY_UNICODE 0x0000002 +/* + Useful only if infoType is PM_USERINFO_TYPE_NDS - indicates a "no + stop" policy of the calling service +*/ +#define PM_LICREQ_ALWAYS_METER 0x0000004 + + +/* + net Address Types - system-defined types of net addresses that can + be used in the tranAddrType field +*/ + +#define NLS_TRAN_TYPE_IPX 0x00000001 /* An IPX address */ +#define NLS_TRAN_TYPE_IP 0x00000008 /* An IP address */ +#define NLS_ADDR_TYPE_MAC 0x000000F1 /* a MAC address */ + +/* + Net Address Sizes - lengths that correspond to the tranAddrType + field (just fyi) +*/ +#define NLS_IPX_ADDR_SIZE 10 /* the size of an IPX address */ +#define NLS_IP_ADDR_SIZE 4 /* the size of an IP address */ +#define NLS_MAC_ADDR_SIZE 6 /* the size of a MAC address */ + + +void netware_reg_user(const char *ip, const char *user, + const char *application) +{ + PMUR usage_request; + long licRequestErrCode = 0; + long storeMeterInfoErrCode = 0; + long nlsMeterErrCode = 0; + + /* import the symbol */ + usage_request= ((PMUR)ImportPublicObject(getnlmhandle(), + "PMMeteredUsageRequest")); + if (usage_request != NULL) + { + unsigned long iaddr; + char addr[NLS_IPX_ADDR_SIZE]; + + /* create address */ + iaddr = htonl(inet_addr(ip)); + bzero(addr, NLS_IPX_ADDR_SIZE); + memcpy(addr, &iaddr, NLS_IP_ADDR_SIZE); + + /* call to NLS */ + usage_request(user, + PM_USERINFO_TYPE_ADDRESS, + application, + NLS_TRAN_TYPE_IP, + addr, + PM_FLAGS_METER_ONLY, + &licRequestErrCode, + &storeMeterInfoErrCode, + &nlsMeterErrCode); + /* release symbol */ + UnImportPublicObject(getnlmhandle(), "PMMeteredUsageRequest"); + } +} +#endif /* __NETWARE__ */ diff --git a/externals/mysql/mysys/my_new.cc b/externals/mysql/mysys/my_new.cc new file mode 100644 index 0000000..7da54ff --- /dev/null +++ b/externals/mysql/mysys/my_new.cc @@ -0,0 +1,58 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This is a replacement of new/delete operators to be used when compiling + with gcc 3.0.x to avoid including libstdc++ +*/ + +#include "mysys_priv.h" + +#ifdef USE_MYSYS_NEW + +void *operator new (size_t sz) +{ + return (void *) malloc (sz ? sz : 1); +} + +void *operator new[] (size_t sz) +{ + return (void *) malloc (sz ? sz : 1); +} + +void operator delete (void *ptr) +{ + if (ptr) + free(ptr); +} + +void operator delete[] (void *ptr) throw () +{ + if (ptr) + free(ptr); +} + +C_MODE_START + +int __cxa_pure_virtual() +{ + assert(! "Aborted: pure virtual method called."); + return 0; +} + +C_MODE_END + +#endif /* USE_MYSYS_NEW */ + diff --git a/externals/mysql/mysys/my_once.c b/externals/mysql/mysys/my_once.c new file mode 100644 index 0000000..b6f6656 --- /dev/null +++ b/externals/mysql/mysys/my_once.c @@ -0,0 +1,122 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Not MT-SAFE */ + +#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ +#undef SAFEMALLOC +#endif + +#include "mysys_priv.h" +#include "my_static.h" +#include "mysys_err.h" +#include + +/* + Alloc for things we don't nead to free + + SYNOPSIS + my_once_alloc() + Size + MyFlags + + NOTES + No DBUG_ENTER... here to get smaller dbug-startup +*/ + +void* my_once_alloc(size_t Size, myf MyFlags) +{ + size_t get_size, max_left; + uchar* point; + reg1 USED_MEM *next; + reg2 USED_MEM **prev; + + Size= ALIGN_SIZE(Size); + prev= &my_once_root_block; + max_left=0; + for (next=my_once_root_block ; next && next->left < Size ; next= next->next) + { + if (next->left > max_left) + max_left=next->left; + prev= &next->next; + } + if (! next) + { /* Time to alloc new block */ + get_size= Size+ALIGN_SIZE(sizeof(USED_MEM)); + if (max_left*4 < my_once_extra && get_size < my_once_extra) + get_size=my_once_extra; /* Normal alloc */ + + if ((next = (USED_MEM*) malloc(get_size)) == 0) + { + my_errno=errno; + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size); + return((uchar*) 0); + } + DBUG_PRINT("test",("my_once_malloc %lu byte malloced", (ulong) get_size)); + next->next= 0; + next->size= get_size; + next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM)); + *prev=next; + } + point= (uchar*) ((char*) next+ (next->size-next->left)); + next->left-= Size; + + if (MyFlags & MY_ZEROFILL) + bzero(point, Size); + return((void*) point); +} /* my_once_alloc */ + + +char *my_once_strdup(const char *src,myf myflags) +{ + size_t len= strlen(src)+1; + uchar *dst= my_once_alloc(len, myflags); + if (dst) + memcpy(dst, src, len); + return (char*) dst; +} + + +void *my_once_memdup(const void *src, size_t len, myf myflags) +{ + uchar *dst= my_once_alloc(len, myflags); + if (dst) + memcpy(dst, src, len); + return dst; +} + + +/* + Deallocate everything used by my_once_alloc + + SYNOPSIS + my_once_free() +*/ + +void my_once_free(void) +{ + reg1 USED_MEM *next,*old; + DBUG_ENTER("my_once_free"); + + for (next=my_once_root_block ; next ; ) + { + old=next; next= next->next ; + free((uchar*) old); + } + my_once_root_block=0; + + DBUG_VOID_RETURN; +} /* my_once_free */ diff --git a/externals/mysql/mysys/my_open.c b/externals/mysql/mysys/my_open.c new file mode 100644 index 0000000..ebdf9e3 --- /dev/null +++ b/externals/mysql/mysys/my_open.c @@ -0,0 +1,191 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include + + +/* + Open a file + + SYNOPSIS + my_open() + FileName Fully qualified file name + Flags Read | write + MyFlags Special flags + + RETURN VALUE + File descriptor +*/ + +File my_open(const char *FileName, int Flags, myf MyFlags) + /* Path-name of file */ + /* Read | write .. */ + /* Special flags */ +{ + File fd; + DBUG_ENTER("my_open"); + DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", + FileName, Flags, MyFlags)); +#if defined(_WIN32) + fd= my_win_open(FileName, Flags); +#elif !defined(NO_OPEN_3) + fd = open(FileName, Flags, my_umask); /* Normal unix */ +#else + fd = open((char *) FileName, Flags); +#endif + + DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_OPEN, + EE_FILENOTFOUND, MyFlags)); +} /* my_open */ + + +/* + Close a file + + SYNOPSIS + my_close() + fd File sescriptor + myf Special Flags + +*/ + +int my_close(File fd, myf MyFlags) +{ + int err; + DBUG_ENTER("my_close"); + DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags)); + + pthread_mutex_lock(&THR_LOCK_open); +#ifndef _WIN32 + do + { + err= close(fd); + } while (err == -1 && errno == EINTR); +#else + err= my_win_close(fd); +#endif + if (err) + { + DBUG_PRINT("error",("Got error %d on close",err)); + my_errno=errno; + if (MyFlags & (MY_FAE | MY_WME)) + my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno); + } + if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN) + { + my_free(my_file_info[fd].name, MYF(0)); +#if defined(THREAD) && !defined(HAVE_PREAD) && !defined (_WIN32) + pthread_mutex_destroy(&my_file_info[fd].mutex); +#endif + my_file_info[fd].type = UNOPEN; + } + my_file_opened--; + pthread_mutex_unlock(&THR_LOCK_open); + DBUG_RETURN(err); +} /* my_close */ + + +/* + Register file in my_file_info[] + + SYNOPSIS + my_register_filename() + fd File number opened, -1 if error on open + FileName File name + type_file_type How file was created + error_message_number Error message number if caller got error (fd == -1) + MyFlags Flags for my_close() + + RETURN + -1 error + # Filenumber + +*/ + +File my_register_filename(File fd, const char *FileName, enum file_type + type_of_file, uint error_message_number, myf MyFlags) +{ + DBUG_ENTER("my_register_filename"); + if ((int) fd >= MY_FILE_MIN) + { + if ((uint) fd >= my_file_limit) + { +#if defined(THREAD) && !defined(HAVE_PREAD) + my_errno= EMFILE; +#else + thread_safe_increment(my_file_opened,&THR_LOCK_open); + DBUG_RETURN(fd); /* safeguard */ +#endif + } + else + { + pthread_mutex_lock(&THR_LOCK_open); + if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags))) + { + my_file_opened++; + my_file_total_opened++; + my_file_info[fd].type = type_of_file; +#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) + pthread_mutex_init(&my_file_info[fd].mutex,MY_MUTEX_INIT_FAST); +#endif + pthread_mutex_unlock(&THR_LOCK_open); + DBUG_PRINT("exit",("fd: %d",fd)); + DBUG_RETURN(fd); + } + pthread_mutex_unlock(&THR_LOCK_open); + my_errno= ENOMEM; + } + (void) my_close(fd, MyFlags); + } + else + my_errno= errno; + + DBUG_PRINT("error",("Got error %d on open", my_errno)); + if (MyFlags & (MY_FFNF | MY_FAE | MY_WME)) + { + if (my_errno == EMFILE) + error_message_number= EE_OUT_OF_FILERESOURCES; + DBUG_PRINT("error",("print err: %d",error_message_number)); + my_error(error_message_number, MYF(ME_BELL+ME_WAITTANG), + FileName, my_errno); + } + DBUG_RETURN(-1); +} + + + + +#ifdef EXTRA_DEBUG + +void my_print_open_files(void) +{ + if (my_file_opened | my_stream_opened) + { + uint i; + for (i= 0 ; i < my_file_limit ; i++) + { + if (my_file_info[i].type != UNOPEN) + { + fprintf(stderr, EE(EE_FILE_NOT_CLOSED), my_file_info[i].name, i); + fputc('\n', stderr); + } + } + } +} + +#endif diff --git a/externals/mysql/mysys/my_port.c b/externals/mysql/mysys/my_port.c new file mode 100644 index 0000000..9ad3334 --- /dev/null +++ b/externals/mysql/mysys/my_port.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* + Small functions to make code portable +*/ + +#include "mysys_priv.h" + +#ifdef _AIX + +/* + On AIX, at least with gcc 3.1, the expression + '(double) (ulonglong) var' doesn't always work for big unsigned + integers like '18446744073709551615'. The end result is that the + high bit is simply dropped. (probably bug in gcc optimizations) + Handling the conversion in a sub function seems to work. +*/ + + + +double my_ulonglong2double(unsigned long long nr) +{ + return (double) nr; +} +#endif /* _AIX */ diff --git a/externals/mysql/mysys/my_pread.c b/externals/mysql/mysys/my_pread.c new file mode 100644 index 0000000..eaabcb1 --- /dev/null +++ b/externals/mysql/mysys/my_pread.c @@ -0,0 +1,206 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include "my_base.h" +#include +#include +#if defined (HAVE_PREAD) && !defined(_WIN32) +#include +#endif + + + +/* + Read a chunk of bytes from a file from a given position + + SYNOPSIOS + my_pread() + Filedes File decsriptor + Buffer Buffer to read data into + Count Number of bytes to read + offset Position to read from + MyFlags Flags + + NOTES + This differs from the normal pread() call in that we don't care + to set the position in the file back to the original position + if the system doesn't support pread(). + + RETURN + (size_t) -1 Error + # Number of bytes read +*/ + +size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, + myf MyFlags) +{ + size_t readbytes; + int error= 0; +#if !defined (HAVE_PREAD) && !defined (_WIN32) + int save_errno; +#endif + DBUG_ENTER("my_pread"); + DBUG_PRINT("my",("fd: %d Seek: %llu Buffer: %p Count: %lu MyFlags: %d", + Filedes, (ulonglong)offset, Buffer, (ulong)Count, MyFlags)); + for (;;) + { + errno= 0; /* Linux, Windows don't reset this on EOF/success */ +#if !defined (HAVE_PREAD) && !defined (_WIN32) + pthread_mutex_lock(&my_file_info[Filedes].mutex); + readbytes= (uint) -1; + error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 || + (readbytes= read(Filedes, Buffer, Count)) != Count); + save_errno= errno; + pthread_mutex_unlock(&my_file_info[Filedes].mutex); + if (error) + errno= save_errno; +#else +#if defined(_WIN32) + readbytes= my_win_pread(Filedes, Buffer, Count, offset); +#else + readbytes= pread(Filedes, Buffer, Count, offset); +#endif + error= (readbytes != Count); +#endif + if(error) + { + my_errno= errno ? errno : -1; + if (errno == 0 || (readbytes != (size_t) -1 && + (MyFlags & (MY_NABP | MY_FNABP)))) + my_errno= HA_ERR_FILE_TOO_SHORT; + + DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d", + (int) readbytes, (uint) Count,Filedes,my_errno)); +#ifdef THREAD + if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR) + { + DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d", + (int) readbytes)); + continue; /* Interrupted */ + } +#endif + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) + { + if (readbytes == (size_t) -1) + my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG), + my_filename(Filedes),my_errno); + else if (MyFlags & (MY_NABP | MY_FNABP)) + my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG), + my_filename(Filedes),my_errno); + } + if (readbytes == (size_t) -1 || (MyFlags & (MY_FNABP | MY_NABP))) + DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ + } + if (MyFlags & (MY_NABP | MY_FNABP)) + DBUG_RETURN(0); /* Read went ok; Return 0 */ + DBUG_RETURN(readbytes); /* purecov: inspected */ + } +} /* my_pread */ + + +/* + Write a chunk of bytes to a file at a given position + + SYNOPSIOS + my_pwrite() + Filedes File decsriptor + Buffer Buffer to write data from + Count Number of bytes to write + offset Position to write to + MyFlags Flags + + NOTES + This differs from the normal pwrite() call in that we don't care + to set the position in the file back to the original position + if the system doesn't support pwrite() + + RETURN + (size_t) -1 Error + # Number of bytes read +*/ + +size_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count, + my_off_t offset, myf MyFlags) +{ + size_t writtenbytes, written; + uint errors; + + DBUG_ENTER("my_pwrite"); + DBUG_PRINT("my",("fd: %d Seek: %llu Buffer: %p Count: %lu MyFlags: %d", + Filedes, offset, Buffer, (ulong)Count, MyFlags)); + errors= 0; + written= 0; + + for (;;) + { +#if !defined (HAVE_PREAD) && !defined (_WIN32) + int error; + writtenbytes= (size_t) -1; + pthread_mutex_lock(&my_file_info[Filedes].mutex); + error= (lseek(Filedes, offset, MY_SEEK_SET) != (my_off_t) -1 && + (writtenbytes= write(Filedes, Buffer, Count)) == Count); + pthread_mutex_unlock(&my_file_info[Filedes].mutex); + if (error) + break; +#elif defined (_WIN32) + writtenbytes= my_win_pwrite(Filedes, Buffer, Count, offset); +#else + writtenbytes= pwrite(Filedes, Buffer, Count, offset); +#endif + if(writtenbytes == Count) + break; + my_errno= errno; + if (writtenbytes != (size_t) -1) + { + written+= writtenbytes; + Buffer+= writtenbytes; + Count-= writtenbytes; + offset+= writtenbytes; + } + DBUG_PRINT("error",("Write only %u bytes", (uint) writtenbytes)); +#ifndef NO_BACKGROUND +#ifdef THREAD + if (my_thread_var->abort) + MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ +#endif + if ((my_errno == ENOSPC || my_errno == EDQUOT) && + (MyFlags & MY_WAIT_IF_FULL)) + { + wait_for_free_space(my_filename(Filedes), errors); + errors++; + continue; + } + if ((writtenbytes && writtenbytes != (size_t) -1) || my_errno == EINTR) + continue; /* Retry */ +#endif + if (MyFlags & (MY_NABP | MY_FNABP)) + { + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) + { + my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG), + my_filename(Filedes),my_errno); + } + DBUG_RETURN(MY_FILE_ERROR); /* Error on read */ + } + else + break; /* Return bytes written */ + } + DBUG_EXECUTE_IF("check", my_seek(Filedes, -1, SEEK_SET, MYF(0));); + if (MyFlags & (MY_NABP | MY_FNABP)) + DBUG_RETURN(0); /* Want only errors */ + DBUG_RETURN(writtenbytes+written); /* purecov: inspected */ +} /* my_pwrite */ diff --git a/externals/mysql/mysys/my_pthread.c b/externals/mysql/mysys/my_pthread.c new file mode 100644 index 0000000..848397f --- /dev/null +++ b/externals/mysql/mysys/my_pthread.c @@ -0,0 +1,501 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Functions to get threads more portable */ + +#define DONT_REMAP_PTHREAD_FUNCTIONS + +#include "mysys_priv.h" +#ifdef THREAD +#include +#include +#include + +#if (defined(__BSD__) || defined(_BSDI_VERSION)) +#define SCHED_POLICY SCHED_RR +#else +#define SCHED_POLICY SCHED_OTHER +#endif + +uint thd_lib_detected= 0; + +/* To allow use of pthread_getspecific with two arguments */ + +#ifdef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC +#undef pthread_getspecific + +void *my_pthread_getspecific_imp(pthread_key_t key) +{ + void *value; + if (pthread_getspecific(key,(void *) &value)) + return 0; + return value; +} +#endif + +#ifdef __NETWARE__ +/* + Don't kill the LibC Reaper thread or the main thread +*/ +#include +#undef pthread_exit +void my_pthread_exit(void *status) +{ + NXThreadId_t tid; + NXContext_t ctx; + char name[NX_MAX_OBJECT_NAME_LEN+1] = ""; + + tid= NXThreadGetId(); + if (tid == NX_INVALID_THREAD_ID || !tid) + return; + if (NXThreadGetContext(tid, &ctx) || + NXContextGetName(ctx, name, sizeof(name)-1)) + return; + + /* + "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread" + with a debug build of LibC the reaper can have different names + */ + if (!strindex(name, "\'s")) + pthread_exit(status); +} +#endif + +/* + Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7 + (and DEC OSF/1 3.2 too) +*/ + +int my_pthread_create_detached=1; + +#if defined(HAVE_NONPOSIX_SIGWAIT) || defined(HAVE_DEC_3_2_THREADS) + +int my_sigwait(const sigset_t *set,int *sig) +{ + int signal=sigwait((sigset_t*) set); + if (signal < 0) + return errno; + *sig=signal; + return 0; +} +#endif + +/* localtime_r for SCO 3.2V4.2 */ + +#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) + +extern pthread_mutex_t LOCK_localtime_r; + +#endif + +#if !defined(HAVE_LOCALTIME_R) +struct tm *localtime_r(const time_t *clock, struct tm *res) +{ + struct tm *tmp; + pthread_mutex_lock(&LOCK_localtime_r); + tmp=localtime(clock); + *res= *tmp; + pthread_mutex_unlock(&LOCK_localtime_r); + return res; +} +#endif + +#if !defined(HAVE_GMTIME_R) +/* + Reentrant version of standard gmtime() function. + Needed on some systems which don't implement it. +*/ + +struct tm *gmtime_r(const time_t *clock, struct tm *res) +{ + struct tm *tmp; + pthread_mutex_lock(&LOCK_localtime_r); + tmp= gmtime(clock); + *res= *tmp; + pthread_mutex_unlock(&LOCK_localtime_r); + return res; +} +#endif + +/**************************************************************************** +** Replacement of sigwait if the system doesn't have one (like BSDI 3.0) +** +** Note: +** This version of sigwait() is assumed to called in a loop so the signalmask +** is permanently modified to reflect the signal set. This is done to get +** a much faster implementation. +** +** This implementation isn't thread safe: It assumes that only one +** thread is using sigwait. +** +** If one later supplies a different signal mask, all old signals that +** was used before are unblocked and set to SIGDFL. +** +** Author: Gary Wisniewski , much modified by Monty +****************************************************************************/ + +#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) + +#if !defined(DONT_USE_SIGSUSPEND) + +static sigset_t sigwait_set,rev_sigwait_set,px_recd; + +void px_handle_sig(int sig) +{ + sigaddset(&px_recd, sig); +} + + +void sigwait_setup(sigset_t *set) +{ + int i; + struct sigaction sact,sact1; + sigset_t unblock_mask; + + sact.sa_flags = 0; + sact.sa_handler = px_handle_sig; + memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ + sigemptyset(&unblock_mask); + pthread_sigmask(SIG_UNBLOCK,(sigset_t*) 0,&rev_sigwait_set); + + for (i = 1; i <= sizeof(sigwait_set)*8; i++) + { + if (sigismember(set,i)) + { + sigdelset(&rev_sigwait_set,i); + if (!sigismember(&sigwait_set,i)) + sigaction(i, &sact, (struct sigaction*) 0); + } + else + { + sigdelset(&px_recd,i); /* Don't handle this */ + if (sigismember(&sigwait_set,i)) + { /* Remove the old handler */ + sigaddset(&unblock_mask,i); + sigdelset(&rev_sigwait_set,i); + sact1.sa_flags = 0; + sact1.sa_handler = SIG_DFL; + sigemptyset(&sact1.sa_mask); + sigaction(i, &sact1, 0); + } + } + } + memcpy_fixed(&sigwait_set,set,sizeof(*set)); + pthread_sigmask(SIG_BLOCK,(sigset_t*) set,(sigset_t*) 0); + pthread_sigmask(SIG_UNBLOCK,&unblock_mask,(sigset_t*) 0); +} + + +int sigwait(sigset_t *setp, int *sigp) +{ + if (memcmp(setp,&sigwait_set,sizeof(sigwait_set))) + sigwait_setup(setp); /* Init or change of set */ + + for (;;) + { + /* + This is a fast, not 100% portable implementation to find the signal. + Because the handler is blocked there should be at most 1 bit set, but + the specification on this is somewhat shady so we use a set instead a + single variable. + */ + + ulong *ptr= (ulong*) &px_recd; + ulong *end=ptr+sizeof(px_recd)/sizeof(ulong); + + for ( ; ptr != end ; ptr++) + { + if (*ptr) + { + ulong set= *ptr; + int found= (int) ((char*) ptr - (char*) &px_recd)*8+1; + while (!(set & 1)) + { + found++; + set>>=1; + } + *sigp=found; + sigdelset(&px_recd,found); + return 0; + } + } + sigsuspend(&rev_sigwait_set); + } + return 0; +} +#else /* !DONT_USE_SIGSUSPEND */ + +/**************************************************************************** +** Replacement of sigwait if the system doesn't have one (like BSDI 3.0) +** +** Note: +** This version of sigwait() is assumed to called in a loop so the signalmask +** is permanently modified to reflect the signal set. This is done to get +** a much faster implementation. +** +** This implementation uses a extra thread to handle the signals and one +** must always call sigwait() with the same signal mask! +** +** BSDI 3.0 NOTE: +** +** pthread_kill() doesn't work on a thread in a select() or sleep() loop? +** After adding the sleep to sigwait_thread, all signals are checked and +** delivered every second. This isn't that terrible performance vice, but +** someone should report this to BSDI and ask for a fix! +** Another problem is that when the sleep() ends, every select() in other +** threads are interrupted! +****************************************************************************/ + +static sigset_t pending_set; +static my_bool inited=0; +static pthread_cond_t COND_sigwait; +static pthread_mutex_t LOCK_sigwait; + + +void sigwait_handle_sig(int sig) +{ + pthread_mutex_lock(&LOCK_sigwait); + sigaddset(&pending_set, sig); + pthread_cond_signal(&COND_sigwait); /* inform sigwait() about signal */ + pthread_mutex_unlock(&LOCK_sigwait); +} + +void *sigwait_thread(void *set_arg) +{ + sigset_t *set=(sigset_t*) set_arg; + + int i; + struct sigaction sact; + sact.sa_flags = 0; + sact.sa_handler = sigwait_handle_sig; + memcpy_fixed(&sact.sa_mask,set,sizeof(*set)); /* handler isn't thread_safe */ + sigemptyset(&pending_set); + + for (i = 1; i <= sizeof(pending_set)*8; i++) + { + if (sigismember(set,i)) + { + sigaction(i, &sact, (struct sigaction*) 0); + } + } + /* Ensure that init_thr_alarm() is called */ + DBUG_ASSERT(thr_client_alarm); + sigaddset(set, thr_client_alarm); + pthread_sigmask(SIG_UNBLOCK,(sigset_t*) set,(sigset_t*) 0); + alarm_thread=pthread_self(); /* For thr_alarm */ + + for (;;) + { /* Wait for signals */ +#ifdef HAVE_NOT_BROKEN_SELECT + fd_set fd; + FD_ZERO(&fd); + select(0,&fd,0,0,0); +#else + sleep(1); /* Because of broken BSDI */ +#endif + } +} + + +int sigwait(sigset_t *setp, int *sigp) +{ + if (!inited) + { + pthread_attr_t thr_attr; + pthread_t sigwait_thread_id; + inited=1; + sigemptyset(&pending_set); + pthread_mutex_init(&LOCK_sigwait,MY_MUTEX_INIT_FAST); + pthread_cond_init(&COND_sigwait,NULL); + + pthread_attr_init(&thr_attr); + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); + pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&thr_attr,8196); + pthread_create(&sigwait_thread_id,&thr_attr,sigwait_thread,setp); + pthread_attr_destroy(&thr_attr); + } + + pthread_mutex_lock(&LOCK_sigwait); + for (;;) + { + ulong *ptr= (ulong*) &pending_set; + ulong *end=ptr+sizeof(pending_set)/sizeof(ulong); + + for ( ; ptr != end ; ptr++) + { + if (*ptr) + { + ulong set= *ptr; + int found= (int) ((char*) ptr - (char*) &pending_set)*8+1; + while (!(set & 1)) + { + found++; + set>>=1; + } + *sigp=found; + sigdelset(&pending_set,found); + pthread_mutex_unlock(&LOCK_sigwait); + return 0; + } + } + pthread_cond_wait(&COND_sigwait,&LOCK_sigwait); + } + return 0; +} + +#endif /* DONT_USE_SIGSUSPEND */ +#endif /* HAVE_SIGWAIT */ + + +/**************************************************************************** + The following functions fixes that all pthread functions should work + according to latest posix standard +****************************************************************************/ + +/* Undefined wrappers set my_pthread.h so that we call os functions */ +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_unlock +#undef pthread_mutex_destroy +#undef pthread_mutex_wait +#undef pthread_mutex_timedwait +#undef pthread_mutex_trylock +#undef pthread_mutex_t +#undef pthread_cond_init +#undef pthread_cond_wait +#undef pthread_cond_timedwait +#undef pthread_cond_t +#undef pthread_attr_getstacksize + +/***************************************************************************** +** Patches for AIX and DEC OSF/1 3.2 +*****************************************************************************/ + +#if defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT) + +#include + +int my_pthread_mutex_noposix_init(pthread_mutex_t *mp, + const pthread_mutexattr_t *attr) +{ + int error; + if (!attr) + error=pthread_mutex_init(mp,pthread_mutexattr_default); + else + error=pthread_mutex_init(mp,*attr); + return error; +} + +int my_pthread_cond_noposix_init(pthread_cond_t *mp, + const pthread_condattr_t *attr) +{ + int error; + if (!attr) + error=pthread_cond_init(mp,pthread_condattr_default); + else + error=pthread_cond_init(mp,*attr); + return error; +} + +#endif + + +/***************************************************************************** + Patches for HPUX + We need these because the pthread_mutex.. code returns -1 on error, + instead of the error code. + + Note that currently we only remap pthread_ functions used by MySQL. + If we are depending on the value for some other pthread_xxx functions, + this has to be added here. +****************************************************************************/ + +#if defined(HPUX10) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) + +int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + struct timespec *abstime) +{ + int error=pthread_cond_timedwait(cond, mutex, abstime); + if (error == -1) /* Safety if the lib is fixed */ + { + if (!(error=errno)) + error= ETIMEDOUT; /* Can happen on HPUX */ + } + if (error == EAGAIN) /* Correct errno to Posix */ + error= ETIMEDOUT; + return error; +} +#endif + +#if defined(HPUX10) + +void my_pthread_attr_getstacksize(pthread_attr_t *connection_attrib, + size_t *stack_size) +{ + *stack_size= pthread_attr_getstacksize(*connection_attrib); +} +#endif + + +#ifdef HAVE_POSIX1003_4a_MUTEX +/* + In HP-UX-10.20 and other old Posix 1003.4a Draft 4 implementations + pthread_mutex_trylock returns 1 on success, not 0 like + pthread_mutex_lock + + From the HP-UX-10.20 man page: + RETURN VALUES + If the function fails, errno may be set to one of the following + values: + Return | Error | Description + _______|__________|_________________________________________ + 1 | | Successful completion. + 0 | | The mutex is locked; therefore, it was + | | not acquired. + -1 | [EINVAL] | The value specified by mutex is invalid. + +*/ + +/* + Convert pthread_mutex_trylock to return values according to latest POSIX + + RETURN VALUES + 0 If we are able successfully lock the mutex. + EBUSY Mutex was locked by another thread + # Other error number returned by pthread_mutex_trylock() + (Not likely) +*/ + +int my_pthread_mutex_trylock(pthread_mutex_t *mutex) +{ + int error= pthread_mutex_trylock(mutex); + if (error == 1) + return 0; /* Got lock on mutex */ + if (error == 0) /* Someon else is locking mutex */ + return EBUSY; + if (error == -1) /* Safety if the lib is fixed */ + error= errno; /* Probably invalid parameter */ + return error; +} +#endif /* HAVE_POSIX1003_4a_MUTEX */ + +/* Some help functions */ + +int pthread_dummy(int ret) +{ + return ret; +} +#endif /* THREAD */ diff --git a/externals/mysql/mysys/my_quick.c b/externals/mysql/mysys/my_quick.c new file mode 100644 index 0000000..b93e7e1 --- /dev/null +++ b/externals/mysql/mysys/my_quick.c @@ -0,0 +1,81 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Quicker interface to read & write. Used with my_nosys.h */ + +#include "mysys_priv.h" +#include "my_nosys.h" + + +#ifdef _WIN32 +extern size_t my_win_read(File Filedes,uchar *Buffer,size_t Count); +#endif + +size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags) +{ + size_t readbytes; +#ifdef _WIN32 + readbytes= my_win_read(Filedes, Buffer, Count); +#else + readbytes= read(Filedes, Buffer, Count); +#endif + if(readbytes != Count) + { +#ifndef DBUG_OFF + if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR) + { + DBUG_PRINT("error", ("my_quick_read() was interrupted and returned %d" + ". This function does not retry the read!", + (int) readbytes)); + } +#endif + my_errno=errno; + return readbytes; + } + return (MyFlags & (MY_NABP | MY_FNABP)) ? 0 : readbytes; +} + + + +size_t my_quick_write(File Filedes, const uchar *Buffer, size_t Count) +{ +#ifdef _WIN32 + return my_win_write(Filedes, Buffer, Count); +#else + +#ifndef DBUG_OFF + size_t writtenbytes; +#endif + + if (( +#ifndef DBUG_OFF + writtenbytes = +#endif + (size_t) write(Filedes,Buffer,Count)) != Count) + { +#ifndef DBUG_OFF + if ((writtenbytes == 0 || writtenbytes == (size_t) -1) && errno == EINTR) + { + DBUG_PRINT("error", ("my_quick_write() was interrupted and returned %d" + ". This function does not retry the write!", + (int) writtenbytes)); + } +#endif + my_errno=errno; + return (size_t) -1; + } + return 0; +#endif +} diff --git a/externals/mysql/mysys/my_read.c b/externals/mysql/mysys/my_read.c new file mode 100644 index 0000000..75f9dd6 --- /dev/null +++ b/externals/mysql/mysys/my_read.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include + +/* + Read a chunk of bytes from a file with retry's if needed + + The parameters are: + File descriptor + Buffer to hold at least Count bytes + Bytes to read + Flags on what to do on error + + Return: + -1 on error + 0 if flag has bits MY_NABP or MY_FNABP set + N number of bytes read. +*/ + +size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) +{ + size_t readbytes, save_count; + DBUG_ENTER("my_read"); + DBUG_PRINT("my",("fd: %d Buffer: %p Count: %lu MyFlags: %d", + Filedes, Buffer, (ulong) Count, MyFlags)); + save_count= Count; + + for (;;) + { + errno= 0; /* Linux, Windows don't reset this on EOF/success */ +#ifdef _WIN32 + readbytes= my_win_read(Filedes, Buffer, Count); +#else + readbytes= read(Filedes, Buffer, Count); +#endif + + if (readbytes != Count) + { + my_errno= errno; + if (errno == 0 || (readbytes != (size_t) -1 && + (MyFlags & (MY_NABP | MY_FNABP)))) + my_errno= HA_ERR_FILE_TOO_SHORT; + DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", + (int) readbytes, (ulong) Count, Filedes, + my_errno)); +#ifdef THREAD + if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) + { + DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld", + (long) readbytes)); + continue; /* Interrupted */ + } +#endif + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) + { + if (readbytes == (size_t) -1) + my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG), + my_filename(Filedes),my_errno); + else if (MyFlags & (MY_NABP | MY_FNABP)) + my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG), + my_filename(Filedes),my_errno); + } + if (readbytes == (size_t) -1 || + ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO))) + DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ + if (readbytes != (size_t) -1 && (MyFlags & MY_FULL_IO)) + { + Buffer+= readbytes; + Count-= readbytes; + continue; + } + } + + if (MyFlags & (MY_NABP | MY_FNABP)) + readbytes= 0; /* Ok on read */ + else if (MyFlags & MY_FULL_IO) + readbytes= save_count; + break; + } + DBUG_RETURN(readbytes); +} /* my_read */ diff --git a/externals/mysql/mysys/my_realloc.c b/externals/mysql/mysys/my_realloc.c new file mode 100644 index 0000000..d686f4c --- /dev/null +++ b/externals/mysql/mysys/my_realloc.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef SAFEMALLOC /* We don't need SAFEMALLOC here */ +#undef SAFEMALLOC +#endif + +#include "mysys_priv.h" +#include "mysys_err.h" + + /* My memory re allocator */ + +/** + @brief wrapper around realloc() + + @param oldpoint pointer to currently allocated area + @param size new size requested, must be >0 + @param my_flags flags + + @note if size==0 realloc() may return NULL; my_realloc() treats this as an + error which is not the intention of realloc() +*/ +void* my_realloc(void* oldpoint, size_t size, myf my_flags) +{ + void *point; + DBUG_ENTER("my_realloc"); + DBUG_PRINT("my",("ptr: %p size: %lu my_flags: %d", oldpoint, + (ulong) size, my_flags)); + + DBUG_ASSERT(size > 0); + if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR)) + DBUG_RETURN(my_malloc(size,my_flags)); +#ifdef USE_HALLOC + if (!(point = malloc(size))) + { + if (my_flags & MY_FREE_ON_ERROR) + my_free(oldpoint,my_flags); + if (my_flags & MY_HOLD_ON_ERROR) + DBUG_RETURN(oldpoint); + my_errno=errno; + if (my_flags & MY_FAE+MY_WME) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size); + } + else + { + memcpy(point,oldpoint,size); + free(oldpoint); + } +#else + if ((point= (uchar*) realloc(oldpoint,size)) == NULL) + { + if (my_flags & MY_FREE_ON_ERROR) + my_free(oldpoint, my_flags); + if (my_flags & MY_HOLD_ON_ERROR) + DBUG_RETURN(oldpoint); + my_errno=errno; + if (my_flags & (MY_FAE+MY_WME)) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size); + } +#endif + DBUG_PRINT("exit",("ptr: %p", point)); + DBUG_RETURN(point); +} /* my_realloc */ diff --git a/externals/mysql/mysys/my_redel.c b/externals/mysql/mysys/my_redel.c new file mode 100644 index 0000000..4e482a3 --- /dev/null +++ b/externals/mysql/mysys/my_redel.c @@ -0,0 +1,120 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include +#include +#include "mysys_err.h" +#if defined(HAVE_UTIME_H) +#include +#elif defined(HAVE_SYS_UTIME_H) +#include +#elif !defined(HPUX10) +struct utimbuf { + time_t actime; + time_t modtime; +}; +#endif + + /* + Rename with copy stat form old file + Copy stats from old file to new file, deletes orginal and + changes new file name to old file name + + if MY_REDEL_MAKE_COPY is given, then the orginal file + is renamed to org_name-'current_time'.BAK + */ + +#define REDEL_EXT ".BAK" + +int my_redel(const char *org_name, const char *tmp_name, myf MyFlags) +{ + int error=1; + DBUG_ENTER("my_redel"); + DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s' MyFlags: %d", + org_name,tmp_name,MyFlags)); + + if (my_copystat(org_name,tmp_name,MyFlags) < 0) + goto end; + if (MyFlags & MY_REDEL_MAKE_BACKUP) + { + char name_buff[FN_REFLEN+20]; + char ext[20]; + ext[0]='-'; + get_date(ext+1,2+4,(time_t) 0); + strmov(strend(ext),REDEL_EXT); + if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2), + MyFlags)) + goto end; + } + else if (my_delete_allow_opened(org_name, MyFlags)) + goto end; + if (my_rename(tmp_name,org_name,MyFlags)) + goto end; + + error=0; +end: + DBUG_RETURN(error); +} /* my_redel */ + + + /* Copy stat from one file to another */ + /* Return -1 if can't get stat, 1 if wrong type of file */ + +int my_copystat(const char *from, const char *to, int MyFlags) +{ + struct stat statbuf; + + if (stat((char*) from, &statbuf)) + { + my_errno=errno; + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),from,errno); + return -1; /* Can't get stat on input file */ + } + if ((statbuf.st_mode & S_IFMT) != S_IFREG) + return 1; + (void) chmod(to, statbuf.st_mode & 07777); /* Copy modes */ + +#if !defined(__WIN__) && !defined(__NETWARE__) + if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) + { + if (MyFlags & MY_LINK_WARNING) + my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); + } + (void) chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */ +#endif /* !__WIN__ && !__NETWARE__ */ + +#ifndef VMS +#ifndef __ZTC__ + if (MyFlags & MY_COPYTIME) + { + struct utimbuf timep; + timep.actime = statbuf.st_atime; + timep.modtime = statbuf.st_mtime; + (void) utime((char*) to, &timep);/* Update last accessed and modified times */ + } +#else + if (MyFlags & MY_COPYTIME) + { + time_t time[2]; + time[0]= statbuf.st_atime; + time[1]= statbuf.st_mtime; + (void) utime((char*) to, time);/* Update last accessed and modified times */ + } +#endif +#endif + return 0; +} /* my_copystat */ diff --git a/externals/mysql/mysys/my_rename.c b/externals/mysql/mysys/my_rename.c new file mode 100644 index 0000000..39e6056 --- /dev/null +++ b/externals/mysql/mysys/my_rename.c @@ -0,0 +1,79 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include +#include "mysys_err.h" +#include "m_string.h" +#undef my_rename + + /* On unix rename deletes to file if it exists */ + +int my_rename(const char *from, const char *to, myf MyFlags) +{ + int error = 0; + DBUG_ENTER("my_rename"); + DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); + +#if defined(HAVE_FILE_VERSIONS) + { /* Check that there isn't a old file */ + int save_errno; + MY_STAT my_stat_result; + save_errno=my_errno; + if (my_stat(to,&my_stat_result,MYF(0))) + { + my_errno=EEXIST; + error= -1; + if (MyFlags & MY_FAE+MY_WME) + my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno); + DBUG_RETURN(error); + } + my_errno=save_errno; + } +#endif +#if defined(HAVE_RENAME) +#if defined(__WIN__) || defined(__NETWARE__) + /* + On windows we can't rename over an existing file: + Remove any conflicting files: + */ + (void) my_delete(to, MYF(0)); +#endif + if (rename(from,to)) +#else + if (link(from, to) || unlink(from)) +#endif + { + my_errno=errno; + error = -1; + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_LINK, MYF(ME_BELL+ME_WAITTANG),from,to,my_errno); + } + else if (MyFlags & MY_SYNC_DIR) + { +#ifdef NEED_EXPLICIT_SYNC_DIR + /* do only the needed amount of syncs: */ + char dir_from[FN_REFLEN], dir_to[FN_REFLEN]; + size_t dir_from_length, dir_to_length; + dirname_part(dir_from, from, &dir_from_length); + dirname_part(dir_to, to, &dir_to_length); + if (my_sync_dir(dir_from, MyFlags) || + (strcmp(dir_from, dir_to) && + my_sync_dir(dir_to, MyFlags))) + error= -1; +#endif + } + DBUG_RETURN(error); +} /* my_rename */ diff --git a/externals/mysql/mysys/my_rnd.c b/externals/mysql/mysys/my_rnd.c new file mode 100644 index 0000000..b7dca0f --- /dev/null +++ b/externals/mysql/mysys/my_rnd.c @@ -0,0 +1,55 @@ +/* Copyright (C) 2007 MySQL AB & Michael Widenius + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include + +/* + Initialize random generator + + NOTES + MySQL's password checks depends on this, so don't do any changes + that changes the random numbers that are generated! +*/ + +void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2) +{ +#ifdef HAVE_purify + bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */ +#endif + rand_st->max_value= 0x3FFFFFFFL; + rand_st->max_value_dbl=(double) rand_st->max_value; + rand_st->seed1=seed1%rand_st->max_value ; + rand_st->seed2=seed2%rand_st->max_value; +} + + +/* + Generate random number. + + SYNOPSIS + my_rnd() + rand_st INOUT Structure used for number generation + + RETURN VALUE + generated pseudo random number +*/ + +double my_rnd(struct my_rnd_struct *rand_st) +{ + rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value; + rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value; + return (((double) rand_st->seed1)/rand_st->max_value_dbl); +} diff --git a/externals/mysql/mysys/my_safehash.c b/externals/mysql/mysys/my_safehash.c new file mode 100644 index 0000000..bad7e7c --- /dev/null +++ b/externals/mysql/mysys/my_safehash.c @@ -0,0 +1,296 @@ +/* Copyright (C) 2003-2007 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Handling of multiple key caches + + The idea is to have a thread safe hash on the table name, + with a default key cache value that is returned if the table name is not in + the cache. +*/ + +#include "mysys_priv.h" +#include +#include "my_safehash.h" + +/***************************************************************************** + General functions to handle SAFE_HASH objects. + + A SAFE_HASH object is used to store the hash, the mutex and default value + needed by the rest of the key cache code. + This is a separate struct to make it easy to later reuse the code for other + purposes + + All entries are linked in a list to allow us to traverse all elements + and delete selected ones. (HASH doesn't allow any easy ways to do this). +*****************************************************************************/ + + +/* + Free a SAFE_HASH_ENTRY + + SYNOPSIS + safe_hash_entry_free() + entry The entry which should be freed + + NOTE + This function is called by the hash object on delete +*/ + +static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry) +{ + DBUG_ENTER("safe_hash_entry_free"); + my_free((uchar*) entry, MYF(0)); + DBUG_VOID_RETURN; +} + + +/* + Get key and length for a SAFE_HASH_ENTRY + + SYNOPSIS + safe_hash_entry_get() + entry The entry for which the key should be returned + length Length of the key + + RETURN + # reference on the key +*/ + +static uchar *safe_hash_entry_get(SAFE_HASH_ENTRY *entry, size_t *length, + my_bool not_used __attribute__((unused))) +{ + *length= entry->length; + return (uchar*) entry->key; +} + + +/* + Init a SAFE_HASH object + + SYNOPSIS + safe_hash_init() + hash safe_hash handler + elements Expected max number of elements + default_value default value + + NOTES + In case of error we set hash->default_value to 0 to allow one to call + safe_hash_free on an object that couldn't be initialized. + + RETURN + 0 OK + 1 error +*/ + +my_bool safe_hash_init(SAFE_HASH *hash, uint elements, + uchar *default_value) +{ + DBUG_ENTER("safe_hash_init"); + if (my_hash_init(&hash->hash, &my_charset_bin, elements, + 0, 0, (my_hash_get_key) safe_hash_entry_get, + (void (*)(void*)) safe_hash_entry_free, 0)) + { + hash->default_value= 0; + DBUG_RETURN(1); + } + my_rwlock_init(&hash->mutex, 0); + hash->default_value= default_value; + hash->root= 0; + DBUG_RETURN(0); +} + + +/* + Free a SAFE_HASH object + + SYNOPSIS + safe_hash_free() + hash Hash handle + + NOTES + This is safe to call on any object that has been sent to safe_hash_init() +*/ + +void safe_hash_free(SAFE_HASH *hash) +{ + /* + Test if safe_hash_init succeeded. This will also guard us against multiple + free calls. + */ + if (hash->default_value) + { + my_hash_free(&hash->hash); + rwlock_destroy(&hash->mutex); + hash->default_value=0; + } +} + + +/* + Return the value stored for a key or default value if no key + + SYNOPSIS + safe_hash_search() + hash Hash handle + key key (path to table etc..) + length Length of key + def Default value of data + + RETURN + # data associated with the key of default value if data was not found +*/ + +uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length, + uchar *def) +{ + uchar *result; + DBUG_ENTER("safe_hash_search"); + rw_rdlock(&hash->mutex); + result= my_hash_search(&hash->hash, key, length); + rw_unlock(&hash->mutex); + if (!result) + result= def; + else + result= ((SAFE_HASH_ENTRY*) result)->data; + DBUG_PRINT("exit",("data: %p", result)); + DBUG_RETURN(result); +} + + +/* + Associate a key with some data + + SYNOPSIS + safe_hash_set() + hash Hash handle + key key (path to table etc..) + length Length of key + data data to to associate with the data + + NOTES + This can be used both to insert a new entry and change an existing + entry. + If one associates a key with the default key cache, the key is deleted + + RETURN + 0 OK + 1 error (Can only be EOM). In this case my_message() is called. +*/ + +my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length, + uchar *data) +{ + SAFE_HASH_ENTRY *entry; + my_bool error= 0; + DBUG_ENTER("safe_hash_set"); + DBUG_PRINT("enter",("key: %.*s data: 0x%lx", length, key, (long) data)); + + rw_wrlock(&hash->mutex); + entry= (SAFE_HASH_ENTRY*) my_hash_search(&hash->hash, key, length); + + if (data == hash->default_value) + { + /* + The key is to be associated with the default entry. In this case + we can just delete the entry (if it existed) from the hash as a + search will return the default entry + */ + if (!entry) /* nothing to do */ + goto end; + /* unlink entry from list */ + if ((*entry->prev= entry->next)) + entry->next->prev= entry->prev; + my_hash_delete(&hash->hash, (uchar*) entry); + goto end; + } + if (entry) + { + /* Entry existed; Just change the pointer to point at the new data */ + entry->data= data; + } + else + { + if (!(entry= (SAFE_HASH_ENTRY *) my_malloc(sizeof(*entry) + length, + MYF(MY_WME)))) + { + error= 1; + goto end; + } + entry->key= (uchar*) (entry +1); + memcpy((char*) entry->key, (char*) key, length); + entry->length= length; + entry->data= data; + /* Link entry to list */ + if ((entry->next= hash->root)) + entry->next->prev= &entry->next; + entry->prev= &hash->root; + hash->root= entry; + if (my_hash_insert(&hash->hash, (uchar*) entry)) + { + /* This can only happen if hash got out of memory */ + my_free((char*) entry, MYF(0)); + error= 1; + goto end; + } + } + +end: + rw_unlock(&hash->mutex); + DBUG_RETURN(error); +} + + +/* + Change all entries with one data value to another data value + + SYNOPSIS + safe_hash_change() + hash Hash handle + old_data Old data + new_data Change all 'old_data' to this + + NOTES + We use the linked list to traverse all elements in the hash as + this allows us to delete elements in the case where 'new_data' is the + default value. +*/ + +void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data) +{ + SAFE_HASH_ENTRY *entry, *next; + DBUG_ENTER("safe_hash_change"); + + rw_wrlock(&hash->mutex); + + for (entry= hash->root ; entry ; entry= next) + { + next= entry->next; + if (entry->data == old_data) + { + if (new_data == hash->default_value) + { + if ((*entry->prev= entry->next)) + entry->next->prev= entry->prev; + my_hash_delete(&hash->hash, (uchar*) entry); + } + else + entry->data= new_data; + } + } + + rw_unlock(&hash->mutex); + DBUG_VOID_RETURN; +} diff --git a/externals/mysql/mysys/my_safehash.h b/externals/mysql/mysys/my_safehash.h new file mode 100644 index 0000000..110f4ed --- /dev/null +++ b/externals/mysql/mysys/my_safehash.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Handling of multiple key caches + + The idea is to have a thread safe hash on the table name, + with a default key cache value that is returned if the table name is not in + the cache. +*/ + +#include + +/* + Struct to store a key and pointer to object +*/ + +typedef struct st_safe_hash_entry +{ + uchar *key; + uint length; + uchar *data; + struct st_safe_hash_entry *next, **prev; +} SAFE_HASH_ENTRY; + + +typedef struct st_safe_hash_with_default +{ +#ifdef THREAD + rw_lock_t mutex; +#endif + HASH hash; + uchar *default_value; + SAFE_HASH_ENTRY *root; +} SAFE_HASH; + + +my_bool safe_hash_init(SAFE_HASH *hash, uint elements, + uchar *default_value); +void safe_hash_free(SAFE_HASH *hash); +uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length, + uchar *def); +my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length, + uchar *data); +void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data); diff --git a/externals/mysql/mysys/my_seek.c b/externals/mysql/mysys/my_seek.c new file mode 100644 index 0000000..8502c25 --- /dev/null +++ b/externals/mysql/mysys/my_seek.c @@ -0,0 +1,95 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" + +/* + Seek to a position in a file. + + ARGUMENTS + File fd The file descriptor + my_off_t pos The expected position (absolute or relative) + int whence A direction parameter and one of + {SEEK_SET, SEEK_CUR, SEEK_END} + myf MyFlags MY_THREADSAFE must be set in case my_seek may be mixed + with my_pread/my_pwrite calls and fd is shared among + threads. + + DESCRIPTION + The my_seek function is a wrapper around the system call lseek and + repositions the offset of the file descriptor fd to the argument + offset according to the directive whence as follows: + SEEK_SET The offset is set to offset bytes. + SEEK_CUR The offset is set to its current location plus offset bytes + SEEK_END The offset is set to the size of the file plus offset bytes + + RETURN VALUE + my_off_t newpos The new position in the file. + MY_FILEPOS_ERROR An error was encountered while performing + the seek. my_errno is set to indicate the + actual error. +*/ + +my_off_t my_seek(File fd, my_off_t pos, int whence, + myf MyFlags __attribute__((unused))) +{ + os_off_t newpos= -1; + DBUG_ENTER("my_seek"); + DBUG_PRINT("my",("fd: %d Pos: %llu Whence: %d MyFlags: %d", + fd, (ulonglong) pos, whence, MyFlags)); + DBUG_ASSERT(pos != MY_FILEPOS_ERROR); /* safety check */ + + /* + Make sure we are using a valid file descriptor! + */ + DBUG_ASSERT(fd != -1); +#if defined (_WIN32) + newpos= my_win_lseek(fd, pos, whence); +#else + newpos= lseek(fd, pos, whence); +#endif + if (newpos == (os_off_t) -1) + { + my_errno= errno; + DBUG_PRINT("error",("lseek: %llu errno: %d", (ulonglong) newpos,errno)); + DBUG_RETURN(MY_FILEPOS_ERROR); + } + if ((my_off_t) newpos != pos) + { + DBUG_PRINT("exit",("pos: %llu", (ulonglong) newpos)); + } + DBUG_RETURN((my_off_t) newpos); +} /* my_seek */ + + + /* Tell current position of file */ + /* ARGSUSED */ + +my_off_t my_tell(File fd, myf MyFlags __attribute__((unused))) +{ + os_off_t pos; + DBUG_ENTER("my_tell"); + DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags)); + DBUG_ASSERT(fd >= 0); +#if defined (HAVE_TELL) && !defined (_WIN32) + pos= tell(fd); +#else + pos= my_seek(fd, 0L, MY_SEEK_CUR,0); +#endif + if (pos == (os_off_t) -1) + my_errno= errno; + DBUG_PRINT("exit",("pos: %llu", (ulonglong) pos)); + DBUG_RETURN((my_off_t) pos); +} /* my_tell */ diff --git a/externals/mysql/mysys/my_sleep.c b/externals/mysql/mysys/my_sleep.c new file mode 100644 index 0000000..cb21c15 --- /dev/null +++ b/externals/mysql/mysys/my_sleep.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Wait a given number of microseconds */ + +#include "mysys_priv.h" +#include + +void my_sleep(ulong m_seconds) +{ +#ifdef __NETWARE__ + delay(m_seconds/1000+1); +#elif defined(__WIN__) + Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */ +#elif defined(HAVE_SELECT) + struct timeval t; + t.tv_sec= m_seconds / 1000000L; + t.tv_usec= m_seconds % 1000000L; + select(0,0,0,0,&t); /* sleep */ +#else + uint sec= (uint) ((m_seconds + 999999L) / 1000000L); + ulong start= (ulong) time((time_t*) 0); + while ((ulong) time((time_t*) 0) < start+sec); +#endif +} diff --git a/externals/mysql/mysys/my_static.c b/externals/mysql/mysys/my_static.c new file mode 100644 index 0000000..5715877 --- /dev/null +++ b/externals/mysql/mysys/my_static.c @@ -0,0 +1,129 @@ +/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Static variables for mysys library. All definied here for easy making of + a shared library +*/ + +#include "mysys_priv.h" +#include "my_static.h" +#include "my_alarm.h" + +my_bool timed_mutexes= 0; + + /* from my_init */ +char * home_dir=0; +const char *my_progname= NULL, *my_progname_short= NULL; +char NEAR curr_dir[FN_REFLEN]= {0}, + NEAR home_dir_buff[FN_REFLEN]= {0}; +ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0; +ulong my_file_total_opened= 0; +int NEAR my_umask=0664, NEAR my_umask_dir=0777; +#ifndef THREAD +int NEAR my_errno=0; +#endif +struct st_my_file_info my_file_info_default[MY_NFILE]; +uint my_file_limit= MY_NFILE; +struct st_my_file_info *my_file_info= my_file_info_default; + + /* From mf_brkhant */ +int NEAR my_dont_interrupt=0; +volatile int _my_signals=0; +struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}}; +#ifdef THREAD +sigset_t my_signals; /* signals blocked by mf_brkhant */ +#endif + + /* from mf_reccache.c */ +ulong my_default_record_cache_size=RECORD_CACHE_SIZE; + + /* from soundex.c */ + /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */ + /* :::::::::::::::::::::::::: */ +const char *soundex_map= "01230120022455012623010202"; + + /* from my_malloc */ +USED_MEM* my_once_root_block=0; /* pointer to first block */ +uint my_once_extra=ONCE_ALLOC_INIT; /* Memory to alloc / block */ + + /* from my_largepage.c */ +#ifdef HAVE_LARGE_PAGES +my_bool my_use_large_pages= 0; +uint my_large_page_size= 0; +#endif + +/* ERROR INJECTION: Described in my_sys.h. */ +IF_DBUG(int my_malloc_error_inject= 0); + + /* from safe_malloc */ +uint sf_malloc_prehunc=0, /* If you have problem with core- */ + sf_malloc_endhunc=0, /* dump when malloc-message.... */ + /* set theese to 64 or 128 */ + sf_malloc_quick=0; /* set if no calls to sanity */ +size_t sf_malloc_cur_memory= 0L; /* Current memory usage */ +size_t sf_malloc_max_memory= 0L; /* Maximum memory usage */ +uint sf_malloc_count= 0; /* Number of times NEW() was called */ +uchar *sf_min_adress= (uchar*) ~(unsigned long) 0L, + *sf_max_adress= (uchar*) 0L; +/* Root of the linked list of struct st_irem */ +struct st_irem *sf_malloc_root = NULL; + + /* from my_alarm */ +int volatile my_have_got_alarm=0; /* declare variable to reset */ +ulong my_time_to_wait_for_lock=2; /* In seconds */ + + /* from errors.c */ +#ifdef SHARED_LIBRARY +char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */ +#endif +void (*my_abort_hook)(int) = (void(*)(int)) exit; +void (*error_handler_hook)(uint error,const char *str,myf MyFlags)= + my_message_no_curses; +void (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)= + my_message_no_curses; + +static const char *proc_info_dummy(void *a __attribute__((unused)), + const char *b __attribute__((unused)), + const char *c __attribute__((unused)), + const char *d __attribute__((unused)), + const unsigned int e __attribute__((unused))) +{ + return 0; +} + +/* this is to be able to call set_thd_proc_info from the C code */ +const char *(*proc_info_hook)(void *, const char *, const char *, const char *, + const unsigned int)= proc_info_dummy; + +#if defined(ENABLED_DEBUG_SYNC) +/** + Global pointer to be set if callback function is defined + (e.g. in mysqld). See sql/debug_sync.cc. +*/ +void (*debug_sync_C_callback_ptr)(const char *, size_t); +#endif /* defined(ENABLED_DEBUG_SYNC) */ + +#ifdef __WIN__ +/* from my_getsystime.c */ +ulonglong query_performance_frequency, query_performance_offset; +#endif + + /* How to disable options */ +my_bool NEAR my_disable_locking=0; +my_bool NEAR my_disable_async_io=0; +my_bool NEAR my_disable_flush_key_blocks=0; +my_bool NEAR my_disable_symlinks=0; +my_bool NEAR mysys_uses_curses=0; diff --git a/externals/mysql/mysys/my_static.h b/externals/mysql/mysys/my_static.h new file mode 100644 index 0000000..90168b0 --- /dev/null +++ b/externals/mysql/mysys/my_static.h @@ -0,0 +1,74 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Static variables for mysys library. All definied here for easy making of + a shared library +*/ + +C_MODE_START +#include + +#define MAX_SIGNALS 10 /* Max signals under a dont-allow */ +#define MIN_KEYBLOCK (min(IO_SIZE,1024)) +#define MAX_KEYBLOCK 8192 /* Max keyblocklength == 8*IO_SIZE */ +#define MAX_BLOCK_TYPES MAX_KEYBLOCK/MIN_KEYBLOCK + +struct st_remember { + int number; + sig_handler (*func)(int number); +}; + +/* + Structure that stores information of a allocated memory block + The data is at &struct_adr+sizeof(ALIGN_SIZE(sizeof(struct irem))) + The lspecialvalue is at the previous 4 bytes from this, which may not + necessarily be in the struct if the struct size isn't aligned at a 8 byte + boundary. +*/ + +struct st_irem +{ + struct st_irem *next; /* Linked list of structures */ + struct st_irem *prev; /* Other link */ + char *filename; /* File in which memory was new'ed */ + size_t datasize; /* Size requested */ + uint32 linenum; /* Line number in above file */ + uint32 SpecialValue; /* Underrun marker value */ +}; + + +extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN]; + +extern volatile int _my_signals; +extern struct st_remember _my_sig_remember[MAX_SIGNALS]; + +extern const char *soundex_map; + +extern USED_MEM* my_once_root_block; +extern uint my_once_extra; + +extern uchar *sf_min_adress,*sf_max_adress; +extern uint sf_malloc_count; +extern struct st_irem *sf_malloc_root; + +extern struct st_my_file_info my_file_info_default[MY_NFILE]; + +extern ulonglong query_performance_frequency, query_performance_offset; + +#if defined(THREAD) && !defined(__WIN__) +extern sigset_t my_signals; /* signals blocked by mf_brkhant */ +#endif +C_MODE_END diff --git a/externals/mysql/mysys/my_symlink.c b/externals/mysql/mysys/my_symlink.c new file mode 100644 index 0000000..258e227 --- /dev/null +++ b/externals/mysql/mysys/my_symlink.c @@ -0,0 +1,153 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include +#include +#ifdef HAVE_REALPATH +#include +#include +#endif + +/* + Reads the content of a symbolic link + If the file is not a symbolic link, return the original file name in to. + + RETURN + 0 If filename was a symlink, (to will be set to value of symlink) + 1 If filename was a normal file (to will be set to filename) + -1 on error. +*/ + +int my_readlink(char *to, const char *filename, myf MyFlags) +{ +#ifndef HAVE_READLINK + strmov(to,filename); + return 1; +#else + int result=0; + int length; + DBUG_ENTER("my_readlink"); + + if ((length=readlink(filename, to, FN_REFLEN-1)) < 0) + { + /* Don't give an error if this wasn't a symlink */ + if ((my_errno=errno) == EINVAL) + { + result= 1; + strmov(to,filename); + } + else + { + if (MyFlags & MY_WME) + my_error(EE_CANT_READLINK, MYF(0), filename, errno); + result= -1; + } + } + else + to[length]=0; + DBUG_PRINT("exit" ,("result: %d", result)); + DBUG_RETURN(result); +#endif /* HAVE_READLINK */ +} + + +/* Create a symbolic link */ + +int my_symlink(const char *content, const char *linkname, myf MyFlags) +{ +#ifndef HAVE_READLINK + return 0; +#else + int result; + DBUG_ENTER("my_symlink"); + DBUG_PRINT("enter",("content: %s linkname: %s", content, linkname)); + + result= 0; + if (symlink(content, linkname)) + { + result= -1; + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_CANT_SYMLINK, MYF(0), linkname, content, errno); + } + else if ((MyFlags & MY_SYNC_DIR) && my_sync_dir_by_file(linkname, MyFlags)) + result= -1; + DBUG_RETURN(result); +#endif /* HAVE_READLINK */ +} + +#if defined(SCO) +#define BUFF_LEN 4097 +#elif defined(MAXPATHLEN) +#define BUFF_LEN MAXPATHLEN +#else +#define BUFF_LEN FN_LEN +#endif + + +int my_is_symlink(const char *filename __attribute__((unused))) +{ +#if defined (HAVE_LSTAT) && defined (S_ISLNK) + struct stat stat_buff; + return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode); +#elif defined (_WIN32) + DWORD dwAttr = GetFileAttributes(filename); + return (dwAttr != INVALID_FILE_ATTRIBUTES) && + (dwAttr & FILE_ATTRIBUTE_REPARSE_POINT); +#else /* No symlinks */ + return 0; +#endif +} + + +/* + Resolve all symbolic links in path + 'to' may be equal to 'filename' +*/ + +int my_realpath(char *to, const char *filename, + myf MyFlags __attribute__((unused))) +{ +#if defined(HAVE_REALPATH) && !defined(HAVE_BROKEN_REALPATH) + int result=0; + char buff[BUFF_LEN]; + char *ptr; + DBUG_ENTER("my_realpath"); + + DBUG_PRINT("info",("executing realpath")); + if ((ptr=realpath(filename,buff))) + strmake(to,ptr,FN_REFLEN-1); + else + { + /* + Realpath didn't work; Use my_load_path() which is a poor substitute + original name but will at least be able to resolve paths that starts + with '.'. + */ + DBUG_PRINT("error",("realpath failed with errno: %d", errno)); + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_REALPATH, MYF(0), filename, my_errno); + my_load_path(to, filename, NullS); + result= -1; + } + DBUG_RETURN(result); +#else + my_load_path(to, filename, NullS); + return 0; +#endif +} diff --git a/externals/mysql/mysys/my_symlink2.c b/externals/mysql/mysys/my_symlink2.c new file mode 100644 index 0000000..7c3ddbb --- /dev/null +++ b/externals/mysql/mysys/my_symlink2.c @@ -0,0 +1,183 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Advanced symlink handling. + This is used in MyISAM to let users symlinks tables to different disk. + The main idea with these functions is to automaticly create, delete and + rename files and symlinks like they would be one unit. +*/ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include + +File my_create_with_symlink(const char *linkname, const char *filename, + int createflags, int access_flags, myf MyFlags) +{ + File file; + int tmp_errno; + /* Test if we should create a link */ + int create_link; + char abs_linkname[FN_REFLEN]; + DBUG_ENTER("my_create_with_symlink"); + DBUG_PRINT("enter", ("linkname: %s filename: %s", + linkname ? linkname : "(null)", + filename ? filename : "(null)")); + + if (my_disable_symlinks) + { + DBUG_PRINT("info", ("Symlinks disabled")); + /* Create only the file, not the link and file */ + create_link= 0; + if (linkname) + filename= linkname; + } + else + { + if (linkname) + my_realpath(abs_linkname, linkname, MYF(0)); + create_link= (linkname && strcmp(abs_linkname,filename)); + } + + if (!(MyFlags & MY_DELETE_OLD)) + { + if (!access(filename,F_OK)) + { + my_errno= errno= EEXIST; + my_error(EE_CANTCREATEFILE, MYF(0), filename, EEXIST); + DBUG_RETURN(-1); + } + if (create_link && !access(linkname,F_OK)) + { + my_errno= errno= EEXIST; + my_error(EE_CANTCREATEFILE, MYF(0), linkname, EEXIST); + DBUG_RETURN(-1); + } + } + + if ((file=my_create(filename, createflags, access_flags, MyFlags)) >= 0) + { + if (create_link) + { + /* Delete old link/file */ + if (MyFlags & MY_DELETE_OLD) + my_delete(linkname, MYF(0)); + /* Create link */ + if (my_symlink(filename, linkname, MyFlags)) + { + /* Fail, remove everything we have done */ + tmp_errno=my_errno; + my_close(file,MYF(0)); + my_delete(filename, MYF(0)); + file= -1; + my_errno=tmp_errno; + } + } + } + DBUG_RETURN(file); +} + +/* + If the file was a symlink, delete both symlink and the file which the + symlink pointed to. +*/ + +int my_delete_with_symlink(const char *name, myf MyFlags) +{ + char link_name[FN_REFLEN]; + int was_symlink= (!my_disable_symlinks && + !my_readlink(link_name, name, MYF(0))); + int result; + DBUG_ENTER("my_delete_with_symlink"); + + if (!(result=my_delete(name, MyFlags))) + { + if (was_symlink) + result=my_delete(link_name, MyFlags); + } + DBUG_RETURN(result); +} + +/* + If the file is a normal file, just rename it. + If the file is a symlink: + - Create a new file with the name 'to' that points at + symlink_dir/basename(to) + - Rename the symlinked file to symlink_dir/basename(to) + - Delete 'from' + If something goes wrong, restore everything. +*/ + +int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) +{ +#ifndef HAVE_READLINK + return my_rename(from, to, MyFlags); +#else + char link_name[FN_REFLEN], tmp_name[FN_REFLEN]; + int was_symlink= (!my_disable_symlinks && + !my_readlink(link_name, from, MYF(0))); + int result=0; + int name_is_different; + DBUG_ENTER("my_rename_with_symlink"); + + if (!was_symlink) + DBUG_RETURN(my_rename(from, to, MyFlags)); + + /* Change filename that symlink pointed to */ + strmov(tmp_name, to); + fn_same(tmp_name,link_name,1); /* Copy dir */ + name_is_different= strcmp(link_name, tmp_name); + if (name_is_different && !access(tmp_name, F_OK)) + { + my_errno= EEXIST; + if (MyFlags & MY_WME) + my_error(EE_CANTCREATEFILE, MYF(0), tmp_name, EEXIST); + DBUG_RETURN(1); + } + + /* Create new symlink */ + if (my_symlink(tmp_name, to, MyFlags)) + DBUG_RETURN(1); + + /* + Rename symlinked file if the base name didn't change. + This can happen if you use this function where 'from' and 'to' has + the same basename and different directories. + */ + + if (name_is_different && my_rename(link_name, tmp_name, MyFlags)) + { + int save_errno=my_errno; + my_delete(to, MyFlags); /* Remove created symlink */ + my_errno=save_errno; + DBUG_RETURN(1); + } + + /* Remove original symlink */ + if (my_delete(from, MyFlags)) + { + int save_errno=my_errno; + /* Remove created link */ + my_delete(to, MyFlags); + /* Rename file back */ + if (strcmp(link_name, tmp_name)) + (void) my_rename(tmp_name, link_name, MyFlags); + my_errno=save_errno; + result= 1; + } + DBUG_RETURN(result); +#endif /* HAVE_READLINK */ +} diff --git a/externals/mysql/mysys/my_sync.c b/externals/mysql/mysys/my_sync.c new file mode 100644 index 0000000..4d5b967 --- /dev/null +++ b/externals/mysql/mysys/my_sync.c @@ -0,0 +1,155 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include + +/* + Sync data in file to disk + + SYNOPSIS + my_sync() + fd File descritor to sync + my_flags Flags (now only MY_WME is supported) + + NOTE + If file system supports its, only file data is synced, not inode data. + + MY_IGNORE_BADFD is useful when fd is "volatile" - not protected by a + mutex. In this case by the time of fsync(), fd may be already closed by + another thread, or even reassigned to a different file. With this flag - + MY_IGNORE_BADFD - such a situation will not be considered an error. + (which is correct behaviour, if we know that the other thread synced the + file before closing) + + RETURN + 0 ok + -1 error +*/ + +int my_sync(File fd, myf my_flags) +{ + int res; + DBUG_ENTER("my_sync"); + DBUG_PRINT("my",("fd: %d my_flags: %d", fd, my_flags)); + + do + { +#if defined(F_FULLFSYNC) + /* + In Mac OS X >= 10.3 this call is safer than fsync() (it forces the + disk's cache and guarantees ordered writes). + */ + if (!(res= fcntl(fd, F_FULLFSYNC, 0))) + break; /* ok */ + /* Some file systems don't support F_FULLFSYNC and fail above: */ + DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back")); +#endif +#if defined(HAVE_FDATASYNC) + res= fdatasync(fd); +#elif defined(HAVE_FSYNC) + res= fsync(fd); +#elif defined(_WIN32) + res= my_win_fsync(fd); +#else +#error Cannot find a way to sync a file, durability in danger + res= 0; /* No sync (strange OS) */ +#endif + } while (res == -1 && errno == EINTR); + + if (res) + { + int er= errno; + if (!(my_errno= er)) + my_errno= -1; /* Unknown error */ + if ((my_flags & MY_IGNORE_BADFD) && + (er == EBADF || er == EINVAL || er == EROFS)) + { + DBUG_PRINT("info", ("ignoring errno %d", er)); + res= 0; + } + else if (my_flags & MY_WME) + my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno); + } + DBUG_RETURN(res); +} /* my_sync */ + + +static const char cur_dir_name[]= {FN_CURLIB, 0}; +/* + Force directory information to disk. + + SYNOPSIS + my_sync_dir() + dir_name the name of the directory + my_flags flags (MY_WME etc) + + RETURN + 0 if ok, !=0 if error +*/ +int my_sync_dir(const char *dir_name, myf my_flags) +{ +#ifdef NEED_EXPLICIT_SYNC_DIR + DBUG_ENTER("my_sync_dir"); + DBUG_PRINT("my",("Dir: '%s' my_flags: %d", dir_name, my_flags)); + File dir_fd; + int res= 0; + const char *correct_dir_name; + /* Sometimes the path does not contain an explicit directory */ + correct_dir_name= (dir_name[0] == 0) ? cur_dir_name : dir_name; + /* + Syncing a dir may give EINVAL on tmpfs on Linux, which is ok. + EIO on the other hand is very important. Hence MY_IGNORE_BADFD. + */ + if ((dir_fd= my_open(correct_dir_name, O_RDONLY, MYF(my_flags))) >= 0) + { + if (my_sync(dir_fd, MYF(my_flags | MY_IGNORE_BADFD))) + res= 2; + if (my_close(dir_fd, MYF(my_flags))) + res= 3; + } + else + res= 1; + DBUG_RETURN(res); +#else + return 0; +#endif +} + + +/* + Force directory information to disk. + + SYNOPSIS + my_sync_dir_by_file() + file_name the name of a file in the directory + my_flags flags (MY_WME etc) + + RETURN + 0 if ok, !=0 if error +*/ +int my_sync_dir_by_file(const char *file_name, myf my_flags) +{ +#ifdef NEED_EXPLICIT_SYNC_DIR + char dir_name[FN_REFLEN]; + size_t dir_name_length; + dirname_part(dir_name, file_name, &dir_name_length); + return my_sync_dir(dir_name, my_flags); +#else + return 0; +#endif +} + diff --git a/externals/mysql/mysys/my_thr_init.c b/externals/mysql/mysys/my_thr_init.c new file mode 100644 index 0000000..ec56e20 --- /dev/null +++ b/externals/mysql/mysys/my_thr_init.c @@ -0,0 +1,524 @@ +/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file + Functions for initialization and allocation of all mysys & debug + thread variables. +*/ + +#include "mysys_priv.h" +#include +#include + +#ifdef THREAD +pthread_key(struct st_my_thread_var*, THR_KEY_mysys); +pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open, + THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_heap, THR_LOCK_net, + THR_LOCK_charset, THR_LOCK_threads, THR_LOCK_time; +/** For insert/delete in the list of MyISAM open tables */ +pthread_mutex_t THR_LOCK_myisam; +/** For writing to the MyISAM logs */ +pthread_mutex_t THR_LOCK_myisam_log; +pthread_cond_t THR_COND_threads; +uint THR_thread_count= 0; +uint my_thread_end_wait_time= 5; +#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) +pthread_mutex_t LOCK_localtime_r; +#endif +#ifndef HAVE_GETHOSTBYNAME_R +pthread_mutex_t LOCK_gethostbyname_r; +#endif +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +pthread_mutexattr_t my_fast_mutexattr; +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +pthread_mutexattr_t my_errorcheck_mutexattr; +#endif +#ifdef _MSC_VER +static void install_sigabrt_handler(); +#endif +#ifdef TARGET_OS_LINUX + +/* + Dummy thread spawned in my_thread_global_init() below to avoid + race conditions in NPTL pthread_exit code. +*/ + +static pthread_handler_t +nptl_pthread_exit_hack_handler(void *arg __attribute((unused))) +{ + /* Do nothing! */ + pthread_exit(0); + return 0; +} + +#endif /* TARGET_OS_LINUX */ + + + +/** + Initialize thread attributes. +*/ + +void my_threadattr_global_init(void) +{ +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + /* + Set mutex type to "fast" a.k.a "adaptive" + + In this case the thread may steal the mutex from some other thread + that is waiting for the same mutex. This will save us some + context switches but may cause a thread to 'starve forever' while + waiting for the mutex (not likely if the code within the mutex is + short). + */ + pthread_mutexattr_init(&my_fast_mutexattr); /* ?= MY_MUTEX_INIT_FAST */ + pthread_mutexattr_settype(&my_fast_mutexattr, + PTHREAD_MUTEX_ADAPTIVE_NP); +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + /* + Set mutex type to "errorcheck" + */ + pthread_mutexattr_init(&my_errorcheck_mutexattr); + pthread_mutexattr_settype(&my_errorcheck_mutexattr, + PTHREAD_MUTEX_ERRORCHECK); +#endif +} + + +static uint get_thread_lib(void); + +/* + initialize thread environment + + SYNOPSIS + my_thread_global_init() + + RETURN + 0 ok + 1 error (Couldn't create THR_KEY_mysys) +*/ + +my_bool my_thread_global_init(void) +{ + int pth_ret; + thd_lib_detected= get_thread_lib(); + + if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0) + { + fprintf(stderr,"Can't initialize threads: error %d\n", pth_ret); + return 1; + } + +#ifdef TARGET_OS_LINUX + /* + BUG#24507: Race conditions inside current NPTL pthread_exit() + implementation. + + To avoid a possible segmentation fault during concurrent + executions of pthread_exit(), a dummy thread is spawned which + initializes internal variables of pthread lib. See bug description + for a full explanation. + + TODO: Remove this code when fixed versions of glibc6 are in common + use. + */ + if (thd_lib_detected == THD_LIB_NPTL) + { + pthread_t dummy_thread; + pthread_attr_t dummy_thread_attr; + + pthread_attr_init(&dummy_thread_attr); + pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_DETACHED); + + pthread_create(&dummy_thread,&dummy_thread_attr, + nptl_pthread_exit_hack_handler, NULL); + } +#endif /* TARGET_OS_LINUX */ + + /* Mutex used by my_thread_init() and after my_thread_destroy_mutex() */ + my_pthread_mutex_init(&THR_LOCK_threads, MY_MUTEX_INIT_FAST, + "THR_LOCK_threads", MYF_NO_DEADLOCK_DETECTION); + my_pthread_mutex_init(&THR_LOCK_malloc, MY_MUTEX_INIT_FAST, + "THR_LOCK_malloc", MYF_NO_DEADLOCK_DETECTION); + + if (my_thread_init()) + return 1; + + + /* Mutex uses by mysys */ + pthread_mutex_init(&THR_LOCK_open,MY_MUTEX_INIT_FAST); + pthread_mutex_init(&THR_LOCK_lock,MY_MUTEX_INIT_FAST); + pthread_mutex_init(&THR_LOCK_isam,MY_MUTEX_INIT_SLOW); + pthread_mutex_init(&THR_LOCK_myisam,MY_MUTEX_INIT_SLOW); + pthread_mutex_init(&THR_LOCK_myisam_log,MY_MUTEX_INIT_SLOW); + pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST); + pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST); + pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST); + pthread_mutex_init(&THR_LOCK_time,MY_MUTEX_INIT_FAST); + pthread_cond_init(&THR_COND_threads, NULL); + +#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) + pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW); +#endif +#ifndef HAVE_GETHOSTBYNAME_R + pthread_mutex_init(&LOCK_gethostbyname_r,MY_MUTEX_INIT_SLOW); +#endif + return 0; +} + + +/** + Wait for all threads in system to die + @fn my_wait_for_other_threads_to_die() + @param number_of_threads Wait until this number of threads + + @retval 0 Less or equal to number_of_threads left + @retval 1 Wait failed +*/ + +my_bool my_wait_for_other_threads_to_die(uint number_of_threads) +{ + struct timespec abstime; + my_bool all_threads_killed= 1; + + set_timespec(abstime, my_thread_end_wait_time); + pthread_mutex_lock(&THR_LOCK_threads); + while (THR_thread_count > number_of_threads) + { + int error= pthread_cond_timedwait(&THR_COND_threads, &THR_LOCK_threads, + &abstime); + if (error == ETIMEDOUT || error == ETIME) + { + all_threads_killed= 0; + break; + } + } + pthread_mutex_unlock(&THR_LOCK_threads); + return all_threads_killed; +} + + +/** + End the mysys thread system. Called when ending the last thread +*/ + + +void my_thread_global_end(void) +{ + my_bool all_threads_killed; + + if (!(all_threads_killed= my_wait_for_other_threads_to_die(0))) + { +#ifdef HAVE_PTHREAD_KILL + /* + We shouldn't give an error here, because if we don't have + pthread_kill(), programs like mysqld can't ensure that all threads + are killed when we enter here. + */ + if (THR_thread_count) + fprintf(stderr, + "Error in my_thread_global_end(): %d threads didn't exit\n", + THR_thread_count); +#endif + } + + pthread_key_delete(THR_KEY_mysys); +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + pthread_mutexattr_destroy(&my_fast_mutexattr); +#endif +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + pthread_mutexattr_destroy(&my_errorcheck_mutexattr); +#endif + if (all_threads_killed) + { + pthread_mutex_destroy(&THR_LOCK_threads); + pthread_cond_destroy(&THR_COND_threads); + pthread_mutex_destroy(&THR_LOCK_malloc); + } +} + +/* Free all mutex used by mysys */ + +void my_thread_destroy_mutex(void) +{ + struct st_my_thread_var *tmp; + tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); +#ifdef SAFE_MUTEX + if (tmp) + { + safe_mutex_free_deadlock_data(&tmp->mutex); + } +#endif + + pthread_mutex_destroy(&THR_LOCK_open); + pthread_mutex_destroy(&THR_LOCK_lock); + pthread_mutex_destroy(&THR_LOCK_isam); + pthread_mutex_destroy(&THR_LOCK_myisam); + pthread_mutex_destroy(&THR_LOCK_myisam_log); + pthread_mutex_destroy(&THR_LOCK_heap); + pthread_mutex_destroy(&THR_LOCK_net); + pthread_mutex_destroy(&THR_LOCK_time); + pthread_mutex_destroy(&THR_LOCK_charset); +#if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) + pthread_mutex_destroy(&LOCK_localtime_r); +#endif +#ifndef HAVE_GETHOSTBYNAME_R + pthread_mutex_destroy(&LOCK_gethostbyname_r); +#endif +} + +static my_thread_id thread_id= 0; + +/* + Allocate thread specific memory for the thread, used by mysys and dbug + + SYNOPSIS + my_thread_init() + + NOTES + We can't use mutex_locks here if we are using windows as + we may have compiled the program with SAFE_MUTEX, in which + case the checking of mutex_locks will not work until + the pthread_self thread specific variable is initialized. + + This function may called multiple times for a thread, for example + if one uses my_init() followed by mysql_server_init(). + + RETURN + 0 ok + 1 Fatal error; mysys/dbug functions can't be used +*/ + +my_bool my_thread_init(void) +{ + struct st_my_thread_var *tmp; + my_bool error=0; + +#ifdef EXTRA_DEBUG_THREADS + fprintf(stderr,"my_thread_init(): thread_id: 0x%lx\n", + (ulong) pthread_self()); +#endif + + if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys)) + { +#ifdef EXTRA_DEBUG_THREADS + fprintf(stderr,"my_thread_init() called more than once in thread 0x%lx\n", + (long) pthread_self()); +#endif + goto end; + } + +#ifdef _MSC_VER + install_sigabrt_handler(); +#endif + + if (!(tmp= (struct st_my_thread_var *) calloc(1, sizeof(*tmp)))) + { + error= 1; + goto end; + } + pthread_setspecific(THR_KEY_mysys,tmp); + tmp->pthread_self= pthread_self(); + my_pthread_mutex_init(&tmp->mutex, MY_MUTEX_INIT_FAST, "mysys_var->mutex", + 0); + pthread_cond_init(&tmp->suspend, NULL); + + tmp->stack_ends_here= (char*)&tmp + + STACK_DIRECTION * (long)my_thread_stack_size; + + pthread_mutex_lock(&THR_LOCK_threads); + tmp->id= ++thread_id; + ++THR_thread_count; + pthread_mutex_unlock(&THR_LOCK_threads); + tmp->init= 1; +#ifndef DBUG_OFF + /* Generate unique name for thread */ + (void) my_thread_name(); +#endif + +end: + return error; +} + + +/* + Deallocate memory used by the thread for book-keeping + + SYNOPSIS + my_thread_end() + + NOTE + This may be called multiple times for a thread. + This happens for example when one calls 'mysql_server_init()' + mysql_server_end() and then ends with a mysql_end(). +*/ + +void my_thread_end(void) +{ + struct st_my_thread_var *tmp; + tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); + +#ifdef EXTRA_DEBUG_THREADS + fprintf(stderr,"my_thread_end(): tmp: 0x%lx pthread_self: 0x%lx thread_id: %ld\n", + (long) tmp, (long) pthread_self(), tmp ? (long) tmp->id : 0L); +#endif + if (tmp && tmp->init) + { + +#if !defined(__bsdi__) && !defined(__OpenBSD__) + /* bsdi and openbsd 3.5 dumps core here */ + pthread_cond_destroy(&tmp->suspend); +#endif + pthread_mutex_destroy(&tmp->mutex); + +#if !defined(DBUG_OFF) + /* tmp->dbug is allocated inside DBUG library */ + if (tmp->dbug) + { + /* + Frees memory allocated in SET DEBUG=...; does nothing if there were no + SET DEBUG in a thread. + */ + DBUG_POP(); + free(tmp->dbug); + tmp->dbug=0; + } +#endif +#ifndef DBUG_OFF + /* To find bugs when accessing unallocated data */ + bfill(tmp, sizeof(tmp), 0x8F); +#endif + free(tmp); + pthread_setspecific(THR_KEY_mysys,0); + /* + Decrement counter for number of running threads. We are using this + in my_thread_global_end() to wait until all threads have called + my_thread_end and thus freed all memory they have allocated in + my_thread_init() and DBUG_xxxx + */ + pthread_mutex_lock(&THR_LOCK_threads); + DBUG_ASSERT(THR_thread_count != 0); + if (--THR_thread_count == 0) + pthread_cond_signal(&THR_COND_threads); + pthread_mutex_unlock(&THR_LOCK_threads); + } + else + { + pthread_setspecific(THR_KEY_mysys,0); + } +} + +struct st_my_thread_var *_my_thread_var(void) +{ + return my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); +} + +#ifndef DBUG_OFF +/* Return pointer to DBUG for holding current state */ + +extern void **my_thread_var_dbug() +{ + struct st_my_thread_var *tmp= + my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); + return tmp && tmp->init ? &tmp->dbug : 0; +} +#endif + +/* Return pointer to mutex_in_use */ + +safe_mutex_t **my_thread_var_mutex_in_use() +{ + struct st_my_thread_var *tmp= + my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); + return tmp ? &tmp->mutex_in_use : 0; +} + +/**************************************************************************** + Get name of current thread. +****************************************************************************/ + +my_thread_id my_thread_dbug_id() +{ + return my_thread_var->id; +} + +#ifdef DBUG_OFF +const char *my_thread_name(void) +{ + return "no_name"; +} + +#else + +const char *my_thread_name(void) +{ + char name_buff[100]; + struct st_my_thread_var *tmp=my_thread_var; + if (!tmp->name[0]) + { + my_thread_id id= my_thread_dbug_id(); + sprintf(name_buff,"T@%lu", (ulong) id); + strmake(tmp->name,name_buff,THREAD_NAME_SIZE); + } + return tmp->name; +} +#endif /* DBUG_OFF */ + + +static uint get_thread_lib(void) +{ +#ifdef _CS_GNU_LIBPTHREAD_VERSION + char buff[64]; + + confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); + + if (!strncasecmp(buff, "NPTL", 4)) + return THD_LIB_NPTL; + if (!strncasecmp(buff, "linuxthreads", 12)) + return THD_LIB_LT; +#endif + return THD_LIB_OTHER; +} + +#ifdef _WIN32 +/* + In Visual Studio 2005 and later, default SIGABRT handler will overwrite + any unhandled exception filter set by the application and will try to + call JIT debugger. This is not what we want, this we calling __debugbreak + to stop in debugger, if process is being debugged or to generate + EXCEPTION_BREAKPOINT and then handle_segfault will do its magic. +*/ + +#if (_MSC_VER >= 1400) +static void my_sigabrt_handler(int sig) +{ + __debugbreak(); +} +#endif /*_MSC_VER >=1400 */ + +static void install_sigabrt_handler(void) +{ +#if (_MSC_VER >=1400) + /*abort() should not override our exception filter*/ + _set_abort_behavior(0,_CALL_REPORTFAULT); + signal(SIGABRT,my_sigabrt_handler); +#endif /* _MSC_VER >=1400 */ +} +#endif + +#endif /* THREAD */ diff --git a/externals/mysql/mysys/my_uuid.c b/externals/mysql/mysys/my_uuid.c new file mode 100644 index 0000000..64db822 --- /dev/null +++ b/externals/mysql/mysys/my_uuid.c @@ -0,0 +1,243 @@ +/* Copyright (C) 2007 MySQL AB, Sergei Golubchik & Michael Widenius + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + implements Universal Unique Identifiers (UUIDs), as in + DCE 1.1: Remote Procedure Call, + Open Group Technical Standard Document Number C706, October 1997, + (supersedes C309 DCE: Remote Procedure Call 8/1994, + which was basis for ISO/IEC 11578:1996 specification) + + A UUID has the following structure: + + Field NDR Data Type Octet # Note + time_low unsigned long 0-3 The low field of the + timestamp. + time_mid unsigned short 4-5 The middle field of + the timestamp. + time_hi_and_version unsigned short 6-7 The high field of the + timestamp multiplexed + with the version number. + clock_seq_hi_and_reserved unsigned small 8 The high field of the + clock sequence multi- + plexed with the variant. + clock_seq_low unsigned small 9 The low field of the + clock sequence. + node character 10-15 The spatially unique node + identifier. +*/ + +#include "mysys_priv.h" +#include +#include /* mi_int2store, mi_int4store */ + +static my_bool my_uuid_inited= 0; +static struct my_rnd_struct uuid_rand; +static uint nanoseq; +static ulonglong uuid_time= 0; +static uchar uuid_suffix[2+6]; /* clock_seq and node */ + +#ifdef THREAD +static pthread_mutex_t LOCK_uuid_generator; +#endif + +/* + Number of 100-nanosecond intervals between + 1582-10-15 00:00:00.00 and 1970-01-01 00:00:00.00 +*/ + +#define UUID_TIME_OFFSET ((ulonglong) 141427 * 24 * 60 * 60 * \ + 1000 * 1000 * 10) +#define UUID_VERSION 0x1000 +#define UUID_VARIANT 0x8000 + + +/* Helper function */ + +static void set_clock_seq() +{ + uint16 clock_seq= ((uint)(my_rnd(&uuid_rand)*16383)) | UUID_VARIANT; + mi_int2store(uuid_suffix, clock_seq); +} + + +/** + Init structures needed for my_uuid + + @func my_uuid_init() + @param seed1 Seed for random generator + @param seed2 Seed for random generator + + @note + Seed1 & seed2 should NOT depend on clock. This is to be able to + generate a random mac address according to UUID specs. +*/ + +void my_uuid_init(ulong seed1, ulong seed2) +{ + uchar *mac= uuid_suffix+2; + ulonglong now; + + if (my_uuid_inited) + return; + my_uuid_inited= 1; + now= my_getsystime(); + nanoseq= 0; + + if (my_gethwaddr(mac)) + { + uint i; + /* + Generating random "hardware addr" + + Specs explicitly specify that node identifier should NOT + correlate with a clock_seq value, so we use a separate + randominit() here. + */ + /* purecov: begin inspected */ + my_rnd_init(&uuid_rand, (ulong) (seed2+ now/2), (ulong) (now+rand())); + for (i=0; i < sizeof(mac); i++) + mac[i]= (uchar)(my_rnd(&uuid_rand)*255); + /* purecov: end */ + } + my_rnd_init(&uuid_rand, (ulong) (seed1 + now), (ulong) (now/2+ getpid())); + set_clock_seq(); + pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST); +} + + +/** + Create a global unique identifier (uuid) + + @func my_uuid() + @param to Store uuid here. Must be of size MY_uuid_SIZE (16) +*/ + +void my_uuid(uchar *to) +{ + ulonglong tv; + uint32 time_low; + uint16 time_mid, time_hi_and_version; + + DBUG_ASSERT(my_uuid_inited); + + pthread_mutex_lock(&LOCK_uuid_generator); + tv= my_getsystime() + UUID_TIME_OFFSET + nanoseq; + + if (likely(tv > uuid_time)) + { + /* + Current time is ahead of last timestamp, as it should be. + If we "borrowed time", give it back, just as long as we + stay ahead of the previous timestamp. + */ + if (nanoseq) + { + uint delta; + DBUG_ASSERT((tv > uuid_time) && (nanoseq > 0)); + /* + -1 so we won't make tv= uuid_time for nanoseq >= (tv - uuid_time) + */ + delta= min(nanoseq, (uint)(tv - uuid_time -1)); + tv-= delta; + nanoseq-= delta; + } + } + else + { + if (unlikely(tv == uuid_time)) + { + /* + For low-res system clocks. If several requests for UUIDs + end up on the same tick, we add a nano-second to make them + different. + ( current_timestamp + nanoseq * calls_in_this_period ) + may end up > next_timestamp; this is OK. Nonetheless, we'll + try to unwind nanoseq when we get a chance to. + If nanoseq overflows, we'll start over with a new numberspace + (so the if() below is needed so we can avoid the ++tv and thus + match the follow-up if() if nanoseq overflows!). + */ + if (likely(++nanoseq)) + ++tv; + } + + if (unlikely(tv <= uuid_time)) + { + /* + If the admin changes the system clock (or due to Daylight + Saving Time), the system clock may be turned *back* so we + go through a period once more for which we already gave out + UUIDs. To avoid duplicate UUIDs despite potentially identical + times, we make a new random component. + We also come here if the nanoseq "borrowing" overflows. + In either case, we throw away any nanoseq borrowing since it's + irrelevant in the new numberspace. + */ + set_clock_seq(); + tv= my_getsystime() + UUID_TIME_OFFSET; + nanoseq= 0; + DBUG_PRINT("uuid",("making new numberspace")); + } + } + + uuid_time=tv; + pthread_mutex_unlock(&LOCK_uuid_generator); + + time_low= (uint32) (tv & 0xFFFFFFFF); + time_mid= (uint16) ((tv >> 32) & 0xFFFF); + time_hi_and_version= (uint16) ((tv >> 48) | UUID_VERSION); + + /* + Note, that the standard does NOT specify byte ordering in + multi-byte fields. it's implementation defined (but must be + the same for all fields). + We use big-endian, so we can use memcmp() to compare UUIDs + and for straightforward UUID to string conversion. + */ + mi_int4store(to, time_low); + mi_int2store(to+4, time_mid); + mi_int2store(to+6, time_hi_and_version); + bmove(to+8, uuid_suffix, sizeof(uuid_suffix)); +} + + +/** + Convert uuid to string representation + + @func my_uuid2str() + @param guid uuid + @param s Output buffer.Must be at least MY_UUID_STRING_LENGTH+1 large. +*/ +void my_uuid2str(const uchar *guid, char *s) +{ + int i; + for (i=0; i < MY_UUID_SIZE; i++) + { + *s++= _dig_vec_lower[guid[i] >>4]; + *s++= _dig_vec_lower[guid[i] & 15]; + if(i == 3 || i == 5 || i == 7 || i == 9) + *s++= '-'; + } +} + +void my_uuid_end() +{ + if (my_uuid_inited) + { + my_uuid_inited= 0; + pthread_mutex_destroy(&LOCK_uuid_generator); + } +} diff --git a/externals/mysql/mysys/my_vle.c b/externals/mysql/mysys/my_vle.c new file mode 100644 index 0000000..09f297e --- /dev/null +++ b/externals/mysql/mysys/my_vle.c @@ -0,0 +1,109 @@ +/* Copyright (C) 2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Variable length encoding. + + A method to store an arbitrary-size non-negative integer. We let the + most significant bit of the number indicate that the next byte + should be contatenated to form the real number. +*/ + +#include "my_vle.h" + +/* + Function to encode an unsigned long as VLE. The bytes for the VLE + will be written to the location pointed to by 'out'. The maximum + number of bytes written will be 'max'. + + PARAMETERS + + out Pointer to beginning of where to store VLE bytes. + max Maximum number of bytes to write. + n Number to encode. + + RETURN VALUE + On success, one past the end of the array containing the VLE + bytes. On failure, the 'out' pointer is returned. +*/ + +uchar* +my_vle_encode(uchar* out, size_t max, ulong n) +{ + uchar buf[my_vle_sizeof(n)]; + uchar *ptr= buf; + size_t len; + + do + { + *ptr++= (uchar) (n & 0x7F); + n>>= 7; + } + while (n > 0); + + len= ptr - buf; + + if (len <= max) + { + /* + The bytes are stored in reverse order in 'buf'. Let's write them + in correct order to the output buffer and set the MSB at the + same time. + */ + while (ptr-- > buf) + { + uchar v= *ptr; + if (ptr > buf) + v|= 0x80; + *out++= v; + } + } + + return out; +} + +/* + Function to decode a VLE representation of an integral value. + + + PARAMETERS + + result_ptr Pointer to an unsigned long where the value will be written. + vle Pointer to the VLE bytes. + + RETURN VALUE + + One-past the end of the VLE bytes. The routine will never read + more than sizeof(*result_ptr) + 1 bytes. +*/ + +uchar const* +my_vle_decode(ulong *result_ptr, uchar const *vle) +{ + ulong result= 0; + size_t cnt= 1; + + do + { + result<<= 7; + result|= (*vle & 0x7F); + } + while ((*vle++ & 0x80) && ++cnt <= sizeof(*result_ptr) + 1); + + if (cnt <= sizeof(*result_ptr) + 1) + *result_ptr= result; + + return vle; +} diff --git a/externals/mysql/mysys/my_wincond.c b/externals/mysql/mysys/my_wincond.c new file mode 100644 index 0000000..862eafc --- /dev/null +++ b/externals/mysql/mysys/my_wincond.c @@ -0,0 +1,222 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/***************************************************************************** +** The following is a simple implementation of posix conditions +*****************************************************************************/ +#if defined(_WIN32) + +#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ +#include "mysys_priv.h" +#include +#include +#include + +int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) +{ + cond->waiting= 0; + InitializeCriticalSection(&cond->lock_waiting); + + cond->events[SIGNAL]= CreateEvent(NULL, /* no security */ + FALSE, /* auto-reset event */ + FALSE, /* non-signaled initially */ + NULL); /* unnamed */ + + /* Create a manual-reset event. */ + cond->events[BROADCAST]= CreateEvent(NULL, /* no security */ + TRUE, /* manual-reset */ + FALSE, /* non-signaled initially */ + NULL); /* unnamed */ + + + cond->broadcast_block_event= CreateEvent(NULL, /* no security */ + TRUE, /* manual-reset */ + TRUE, /* signaled initially */ + NULL); /* unnamed */ + + if( cond->events[SIGNAL] == NULL || + cond->events[BROADCAST] == NULL || + cond->broadcast_block_event == NULL ) + return ENOMEM; + return 0; +} + +int pthread_cond_destroy(pthread_cond_t *cond) +{ + DeleteCriticalSection(&cond->lock_waiting); + + if (CloseHandle(cond->events[SIGNAL]) == 0 || + CloseHandle(cond->events[BROADCAST]) == 0 || + CloseHandle(cond->broadcast_block_event) == 0) + return EINVAL; + return 0; +} + + +int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +{ + return pthread_cond_timedwait(cond,mutex,NULL); +} + + +int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, + struct timespec *abstime) +{ + int result; + long timeout; + union ft64 now; + + if( abstime != NULL ) + { + GetSystemTimeAsFileTime(&now.ft); + + /* + Calculate time left to abstime + - subtract start time from current time(values are in 100ns units) + - convert to millisec by dividing with 10000 + */ + timeout= (long)((abstime->tv.i64 - now.i64) / 10000); + + /* Don't allow the timeout to be negative */ + if (timeout < 0) + timeout= 0L; + + /* + Make sure the calucated timeout does not exceed original timeout + value which could cause "wait for ever" if system time changes + */ + if (timeout > abstime->max_timeout_msec) + timeout= abstime->max_timeout_msec; + + } + else + { + /* No time specified; don't expire */ + timeout= INFINITE; + } + + /* + Block access if previous broadcast hasn't finished. + This is just for safety and should normally not + affect the total time spent in this function. + */ + WaitForSingleObject(cond->broadcast_block_event, INFINITE); + + EnterCriticalSection(&cond->lock_waiting); + cond->waiting++; + LeaveCriticalSection(&cond->lock_waiting); + + LeaveCriticalSection(mutex); + + result= WaitForMultipleObjects(2, cond->events, FALSE, timeout); + + EnterCriticalSection(&cond->lock_waiting); + cond->waiting--; + + if (cond->waiting == 0) + { + /* + We're the last waiter to be notified or to stop waiting, so + reset the manual event. + */ + /* Close broadcast gate */ + ResetEvent(cond->events[BROADCAST]); + /* Open block gate */ + SetEvent(cond->broadcast_block_event); + } + LeaveCriticalSection(&cond->lock_waiting); + + EnterCriticalSection(mutex); + + return result == WAIT_TIMEOUT ? ETIMEDOUT : 0; +} + +int pthread_cond_signal(pthread_cond_t *cond) +{ + EnterCriticalSection(&cond->lock_waiting); + + if(cond->waiting > 0) + SetEvent(cond->events[SIGNAL]); + + LeaveCriticalSection(&cond->lock_waiting); + + return 0; +} + + +int pthread_cond_broadcast(pthread_cond_t *cond) +{ + EnterCriticalSection(&cond->lock_waiting); + /* + The mutex protect us from broadcasting if + there isn't any thread waiting to open the + block gate after this call has closed it. + */ + if(cond->waiting > 0) + { + /* Close block gate */ + ResetEvent(cond->broadcast_block_event); + /* Open broadcast gate */ + SetEvent(cond->events[BROADCAST]); + } + + LeaveCriticalSection(&cond->lock_waiting); + + return 0; +} + + +int pthread_attr_init(pthread_attr_t *connect_att) +{ + connect_att->dwStackSize = 0; + connect_att->dwCreatingFlag = 0; + return 0; +} + +int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack) +{ + connect_att->dwStackSize=stack; + return 0; +} + +int pthread_attr_destroy(pthread_attr_t *connect_att) +{ + bzero((uchar*) connect_att,sizeof(*connect_att)); + return 0; +} + +/**************************************************************************** +** Fix localtime_r() to be a bit safer +****************************************************************************/ + +struct tm *localtime_r(const time_t *timep,struct tm *tmp) +{ + if (*timep == (time_t) -1) /* This will crash win32 */ + { + bzero(tmp,sizeof(*tmp)); + } + else + { + struct tm *res=localtime(timep); + if (!res) /* Wrong date */ + { + bzero(tmp,sizeof(*tmp)); /* Keep things safe */ + return 0; + } + *tmp= *res; + } + return tmp; +} +#endif /* __WIN__ */ diff --git a/externals/mysql/mysys/my_windac.c b/externals/mysql/mysys/my_windac.c new file mode 100644 index 0000000..f846853 --- /dev/null +++ b/externals/mysql/mysys/my_windac.c @@ -0,0 +1,223 @@ +/* Copyright (C) 2000-2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "m_string.h" +#ifdef __WIN__ + +/* Windows NT/2000 discretionary access control utility functions. */ + +/* + Check if the operating system is built on NT technology. + + RETURN + 0 Windows 95/98/Me + 1 otherwise +*/ + +static my_bool is_nt() +{ + return GetVersion() < 0x80000000; +} + +/* + Auxilary structure to store pointers to the data which we need to keep + around while SECURITY_ATTRIBUTES is in use. +*/ + +typedef struct st_my_security_attr +{ + PSID everyone_sid; + PACL dacl; +} My_security_attr; + + +/* + Allocate and initialize SECURITY_ATTRIBUTES setting up access + rights for the owner and group `Everybody'. + + SYNOPSIS + my_security_attr_create() + psa [OUT] pointer to store the pointer to SA in + perror [OUT] pointer to store error message if there was an + error + owner_rights [IN] access rights for the owner + everyone_rights [IN] access rights for group Everybody + + DESCRIPTION + Set up the security attributes to provide clients with sufficient + access rights to a kernel object. We need this function + because if we simply grant all access to everybody (by installing + a NULL DACL) a mailicious user can attempt a denial of service + attack by taking ownership over the kernel object. Upon successful + return `psa' contains a pointer to SECUIRITY_ATTRIBUTES that can be used + to create kernel objects with proper access rights. + + RETURN + 0 success, psa is 0 or points to a valid SA structure, + perror is left intact + !0 error, SA is set to 0, error message is stored in perror +*/ + +int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror, + DWORD owner_rights, DWORD everyone_rights) +{ + /* Top-level SID authority */ + SID_IDENTIFIER_AUTHORITY world_auth= SECURITY_WORLD_SID_AUTHORITY; + PSID everyone_sid= 0; + HANDLE htoken= 0; + SECURITY_ATTRIBUTES *sa= 0; + PACL dacl= 0; + DWORD owner_token_length, dacl_length; + SECURITY_DESCRIPTOR *sd; + PTOKEN_USER owner_token; + PSID owner_sid; + My_security_attr *attr; + + if (! is_nt()) + { + *psa= 0; + return 0; + } + + /* + Get SID of Everyone group. Easier to retrieve all SIDs each time + this function is called than worry about thread safety. + */ + if (! AllocateAndInitializeSid(&world_auth, 1, SECURITY_WORLD_RID, + 0, 0, 0, 0, 0, 0, 0, &everyone_sid)) + { + *perror= "Failed to retrieve the SID of Everyone group"; + goto error; + } + + /* + Get SID of the owner. Using GetSecurityInfo this task can be done + in just one call instead of five, but GetSecurityInfo declared in + aclapi.h, so I hesitate to use it. + SIC: OpenThreadToken works only if there is an active impersonation + token, hence OpenProcessToken is used. + */ + if (! OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &htoken)) + { + *perror= "Failed to retrieve thread access token"; + goto error; + } + GetTokenInformation(htoken, TokenUser, 0, 0, &owner_token_length); + + if (! my_multi_malloc(MYF(MY_WME), + &sa, ALIGN_SIZE(sizeof(SECURITY_ATTRIBUTES)) + + sizeof(My_security_attr), + &sd, sizeof(SECURITY_DESCRIPTOR), + &owner_token, owner_token_length, + 0)) + { + *perror= "Failed to allocate memory for SECURITY_ATTRIBUTES"; + goto error; + } + bzero(owner_token, owner_token_length); + if (! GetTokenInformation(htoken, TokenUser, owner_token, + owner_token_length, &owner_token_length)) + { + *perror= "GetTokenInformation failed"; + goto error; + } + owner_sid= owner_token->User.Sid; + + if (! IsValidSid(owner_sid)) + { + *perror= "IsValidSid failed"; + goto error; + } + + /* Calculate the amount of memory that must be allocated for the DACL */ + dacl_length= sizeof(ACL) + (sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD)) * 2 + + GetLengthSid(everyone_sid) + GetLengthSid(owner_sid); + + /* Create an ACL */ + if (! (dacl= (PACL) my_malloc(dacl_length, MYF(MY_ZEROFILL|MY_WME)))) + { + *perror= "Failed to allocate memory for DACL"; + goto error; + } + if (! InitializeAcl(dacl, dacl_length, ACL_REVISION)) + { + *perror= "Failed to initialize DACL"; + goto error; + } + if (! AddAccessAllowedAce(dacl, ACL_REVISION, everyone_rights, everyone_sid)) + { + *perror= "Failed to set up DACL"; + goto error; + } + if (! AddAccessAllowedAce(dacl, ACL_REVISION, owner_rights, owner_sid)) + { + *perror= "Failed to set up DACL"; + goto error; + } + if (! InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION)) + { + *perror= "Could not initialize security descriptor"; + goto error; + } + if (! SetSecurityDescriptorDacl(sd, TRUE, dacl, FALSE)) + { + *perror= "Failed to install DACL"; + goto error; + } + + sa->nLength= sizeof(*sa); + sa->bInheritHandle= TRUE; + sa->lpSecurityDescriptor= sd; + /* Save pointers to everyone_sid and dacl to be able to clean them up */ + attr= (My_security_attr*) (((char*) sa) + ALIGN_SIZE(sizeof(*sa))); + attr->everyone_sid= everyone_sid; + attr->dacl= dacl; + *psa= sa; + + CloseHandle(htoken); + return 0; +error: + if (everyone_sid) + FreeSid(everyone_sid); + if (htoken) + CloseHandle(htoken); + my_free((uchar*) sa, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) dacl, MYF(MY_ALLOW_ZERO_PTR)); + *psa= 0; + return 1; +} + +/* + Cleanup security attributes freeing used memory. + + SYNOPSIS + my_security_attr_free() + sa security attributes +*/ + +void my_security_attr_free(SECURITY_ATTRIBUTES *sa) +{ + if (sa) + { + My_security_attr *attr= (My_security_attr*) + (((char*)sa) + ALIGN_SIZE(sizeof(*sa))); + FreeSid(attr->everyone_sid); + my_free((uchar*) attr->dacl, MYF(0)); + my_free((uchar*) sa, MYF(0)); + } +} + +#endif /* __WIN__ */ diff --git a/externals/mysql/mysys/my_winerr.c b/externals/mysql/mysys/my_winerr.c new file mode 100644 index 0000000..1799099 --- /dev/null +++ b/externals/mysql/mysys/my_winerr.c @@ -0,0 +1,127 @@ +/* Copyright (C) 2008 MySQL AB + +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; version 2 of the License. + +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Convert Windows API error (GetLastError() to Posix equivalent (errno) + The exported function my_osmaperr() is modelled after and borrows + heavily from undocumented _dosmaperr()(found of the static Microsoft C runtime). +*/ + +#ifdef _WIN32 + +#include +#include + + +struct errentry +{ + unsigned long oscode; /* OS return value */ + int sysv_errno; /* System V error code */ +}; + +static struct errentry errtable[]= { + { ERROR_INVALID_FUNCTION, EINVAL }, /* 1 */ + { ERROR_FILE_NOT_FOUND, ENOENT }, /* 2 */ + { ERROR_PATH_NOT_FOUND, ENOENT }, /* 3 */ + { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, /* 4 */ + { ERROR_ACCESS_DENIED, EACCES }, /* 5 */ + { ERROR_INVALID_HANDLE, EBADF }, /* 6 */ + { ERROR_ARENA_TRASHED, ENOMEM }, /* 7 */ + { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, /* 8 */ + { ERROR_INVALID_BLOCK, ENOMEM }, /* 9 */ + { ERROR_BAD_ENVIRONMENT, E2BIG }, /* 10 */ + { ERROR_BAD_FORMAT, ENOEXEC }, /* 11 */ + { ERROR_INVALID_ACCESS, EINVAL }, /* 12 */ + { ERROR_INVALID_DATA, EINVAL }, /* 13 */ + { ERROR_INVALID_DRIVE, ENOENT }, /* 15 */ + { ERROR_CURRENT_DIRECTORY, EACCES }, /* 16 */ + { ERROR_NOT_SAME_DEVICE, EXDEV }, /* 17 */ + { ERROR_NO_MORE_FILES, ENOENT }, /* 18 */ + { ERROR_LOCK_VIOLATION, EACCES }, /* 33 */ + { ERROR_BAD_NETPATH, ENOENT }, /* 53 */ + { ERROR_NETWORK_ACCESS_DENIED, EACCES }, /* 65 */ + { ERROR_BAD_NET_NAME, ENOENT }, /* 67 */ + { ERROR_FILE_EXISTS, EEXIST }, /* 80 */ + { ERROR_CANNOT_MAKE, EACCES }, /* 82 */ + { ERROR_FAIL_I24, EACCES }, /* 83 */ + { ERROR_INVALID_PARAMETER, EINVAL }, /* 87 */ + { ERROR_NO_PROC_SLOTS, EAGAIN }, /* 89 */ + { ERROR_DRIVE_LOCKED, EACCES }, /* 108 */ + { ERROR_BROKEN_PIPE, EPIPE }, /* 109 */ + { ERROR_DISK_FULL, ENOSPC }, /* 112 */ + { ERROR_INVALID_TARGET_HANDLE, EBADF }, /* 114 */ + { ERROR_INVALID_HANDLE, EINVAL }, /* 124 */ + { ERROR_WAIT_NO_CHILDREN, ECHILD }, /* 128 */ + { ERROR_CHILD_NOT_COMPLETE, ECHILD }, /* 129 */ + { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, /* 130 */ + { ERROR_NEGATIVE_SEEK, EINVAL }, /* 131 */ + { ERROR_SEEK_ON_DEVICE, EACCES }, /* 132 */ + { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, /* 145 */ + { ERROR_NOT_LOCKED, EACCES }, /* 158 */ + { ERROR_BAD_PATHNAME, ENOENT }, /* 161 */ + { ERROR_MAX_THRDS_REACHED, EAGAIN }, /* 164 */ + { ERROR_LOCK_FAILED, EACCES }, /* 167 */ + { ERROR_ALREADY_EXISTS, EEXIST }, /* 183 */ + { ERROR_FILENAME_EXCED_RANGE, ENOENT }, /* 206 */ + { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, /* 215 */ + { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } /* 1816 */ +}; + +/* size of the table */ +#define ERRTABLESIZE (sizeof(errtable)/sizeof(errtable[0])) + +/* The following two constants must be the minimum and maximum +values in the (contiguous) range of Exec Failure errors. */ +#define MIN_EXEC_ERROR ERROR_INVALID_STARTING_CODESEG +#define MAX_EXEC_ERROR ERROR_INFLOOP_IN_RELOC_CHAIN + +/* These are the low and high value in the range of errors that are +access violations */ +#define MIN_EACCES_RANGE ERROR_WRITE_PROTECT +#define MAX_EACCES_RANGE ERROR_SHARING_BUFFER_EXCEEDED + + +static int get_errno_from_oserr(unsigned long oserrno) +{ + int i; + + /* check the table for the OS error code */ + for (i= 0; i < ERRTABLESIZE; ++i) + { + if (oserrno == errtable[i].oscode) + { + return errtable[i].sysv_errno; + } + } + + /* The error code wasn't in the table. We check for a range of */ + /* EACCES errors or exec failure errors (ENOEXEC). Otherwise */ + /* EINVAL is returned. */ + + if (oserrno >= MIN_EACCES_RANGE && oserrno <= MAX_EACCES_RANGE) + return EACCES; + else if (oserrno >= MIN_EXEC_ERROR && oserrno <= MAX_EXEC_ERROR) + return ENOEXEC; + else + return EINVAL; +} + +/* Set errno corresponsing to GetLastError() value */ +void my_osmaperr ( unsigned long oserrno) +{ + errno= get_errno_from_oserr(oserrno); +} + +#endif diff --git a/externals/mysql/mysys/my_winfile.c b/externals/mysql/mysys/my_winfile.c new file mode 100644 index 0000000..d5917d4 --- /dev/null +++ b/externals/mysql/mysys/my_winfile.c @@ -0,0 +1,667 @@ +/* Copyright (C) 2008 MySQL AB + +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; version 2 of the License. + +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + The purpose of this file is to provide implementation of file IO routines on + Windows that can be thought as drop-in replacement for corresponding C runtime + functionality. + + Compared to Windows CRT, this one + - does not have the same file descriptor + limitation (default is 16384 and can be increased further, whereas CRT poses + a hard limit of 2048 file descriptors) + - the file operations are not serialized + - positional IO pread/pwrite is ported here. + - no text mode for files, all IO is "binary" + + Naming convention: + All routines are prefixed with my_win_, e.g Posix open() is implemented with + my_win_open() + + Implemented are + - POSIX routines(e.g open, read, lseek ...) + - Some ANSI C stream routines (fopen, fdopen, fileno, fclose) + - Windows CRT equvalients (my_get_osfhandle, open_osfhandle) + + Worth to note: + - File descriptors used here are located in a range that is not compatible + with CRT on purpose. Attempt to use a file descriptor from Windows CRT library + range in my_win_* function will be punished with DBUG_ASSERT() + + - File streams (FILE *) are actually from the C runtime. The routines provided + here are useful only in scernarios that use low-level IO with my_win_fileno() +*/ + +#ifdef _WIN32 + +#include "mysys_priv.h" +#include +#include + +/* Associates a file descriptor with an existing operating-system file handle.*/ +File my_open_osfhandle(HANDLE handle, int oflag) +{ + int offset= -1; + uint i; + DBUG_ENTER("my_open_osfhandle"); + + pthread_mutex_lock(&THR_LOCK_open); + for(i= MY_FILE_MIN; i < my_file_limit;i++) + { + if(my_file_info[i].fhandle == 0) + { + struct st_my_file_info *finfo= &(my_file_info[i]); + finfo->type= FILE_BY_OPEN; + finfo->fhandle= handle; + finfo->oflag= oflag; + offset= i; + break; + } + } + pthread_mutex_unlock(&THR_LOCK_open); + if(offset == -1) + errno= EMFILE; /* to many file handles open */ + DBUG_RETURN(offset); +} + + +static void invalidate_fd(File fd) +{ + DBUG_ENTER("invalidate_fd"); + DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit); + my_file_info[fd].fhandle= 0; + DBUG_VOID_RETURN; +} + + +/* Get Windows handle for a file descriptor */ +HANDLE my_get_osfhandle(File fd) +{ + DBUG_ENTER("my_get_osfhandle"); + DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit); + DBUG_RETURN(my_file_info[fd].fhandle); +} + + +static int my_get_open_flags(File fd) +{ + DBUG_ENTER("my_get_osfhandle"); + DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit); + DBUG_RETURN(my_file_info[fd].oflag); +} + + +/* + Open a file with sharing. Similar to _sopen() from libc, but allows managing + share delete on win32 + + SYNOPSIS + my_win_sopen() + path file name + oflag operation flags + shflag share flag + pmode permission flags + + RETURN VALUE + File descriptor of opened file if success + -1 and sets errno if fails. +*/ + +File my_win_sopen(const char *path, int oflag, int shflag, int pmode) +{ + int fh; /* handle of opened file */ + int mask; + HANDLE osfh; /* OS handle of opened file */ + DWORD fileaccess; /* OS file access (requested) */ + DWORD fileshare; /* OS file sharing mode */ + DWORD filecreate; /* OS method of opening/creating */ + DWORD fileattrib; /* OS file attribute flags */ + SECURITY_ATTRIBUTES SecurityAttributes; + + DBUG_ENTER("my_win_sopen"); + + if (check_if_legal_filename(path)) + { + errno= EACCES; + DBUG_RETURN(-1); + } + SecurityAttributes.nLength= sizeof(SecurityAttributes); + SecurityAttributes.lpSecurityDescriptor= NULL; + SecurityAttributes.bInheritHandle= !(oflag & _O_NOINHERIT); + + /* decode the access flags */ + switch (oflag & (_O_RDONLY | _O_WRONLY | _O_RDWR)) { + case _O_RDONLY: /* read access */ + fileaccess= GENERIC_READ; + break; + case _O_WRONLY: /* write access */ + fileaccess= GENERIC_WRITE; + break; + case _O_RDWR: /* read and write access */ + fileaccess= GENERIC_READ | GENERIC_WRITE; + break; + default: /* error, bad oflag */ + errno= EINVAL; + DBUG_RETURN(-1); + } + + /* decode sharing flags */ + switch (shflag) { + case _SH_DENYRW: /* exclusive access except delete */ + fileshare= FILE_SHARE_DELETE; + break; + case _SH_DENYWR: /* share read and delete access */ + fileshare= FILE_SHARE_READ | FILE_SHARE_DELETE; + break; + case _SH_DENYRD: /* share write and delete access */ + fileshare= FILE_SHARE_WRITE | FILE_SHARE_DELETE; + break; + case _SH_DENYNO: /* share read, write and delete access */ + fileshare= FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; + break; + case _SH_DENYRWD: /* exclusive access */ + fileshare= 0L; + break; + case _SH_DENYWRD: /* share read access */ + fileshare= FILE_SHARE_READ; + break; + case _SH_DENYRDD: /* share write access */ + fileshare= FILE_SHARE_WRITE; + break; + case _SH_DENYDEL: /* share read and write access */ + fileshare= FILE_SHARE_READ | FILE_SHARE_WRITE; + break; + default: /* error, bad shflag */ + errno= EINVAL; + DBUG_RETURN(-1); + } + + /* decode open/create method flags */ + switch (oflag & (_O_CREAT | _O_EXCL | _O_TRUNC)) { + case 0: + case _O_EXCL: /* ignore EXCL w/o CREAT */ + filecreate= OPEN_EXISTING; + break; + + case _O_CREAT: + filecreate= OPEN_ALWAYS; + break; + + case _O_CREAT | _O_EXCL: + case _O_CREAT | _O_TRUNC | _O_EXCL: + filecreate= CREATE_NEW; + break; + + case _O_TRUNC: + case _O_TRUNC | _O_EXCL: /* ignore EXCL w/o CREAT */ + filecreate= TRUNCATE_EXISTING; + break; + + case _O_CREAT | _O_TRUNC: + filecreate= CREATE_ALWAYS; + break; + + default: + /* this can't happen ... all cases are covered */ + errno= EINVAL; + DBUG_RETURN(-1); + } + + /* decode file attribute flags if _O_CREAT was specified */ + fileattrib= FILE_ATTRIBUTE_NORMAL; /* default */ + if (oflag & _O_CREAT) + { + _umask((mask= _umask(0))); + + if (!((pmode & ~mask) & _S_IWRITE)) + fileattrib= FILE_ATTRIBUTE_READONLY; + } + + /* Set temporary file (delete-on-close) attribute if requested. */ + if (oflag & _O_TEMPORARY) + { + fileattrib|= FILE_FLAG_DELETE_ON_CLOSE; + fileaccess|= DELETE; + } + + /* Set temporary file (delay-flush-to-disk) attribute if requested.*/ + if (oflag & _O_SHORT_LIVED) + fileattrib|= FILE_ATTRIBUTE_TEMPORARY; + + /* Set sequential or random access attribute if requested. */ + if (oflag & _O_SEQUENTIAL) + fileattrib|= FILE_FLAG_SEQUENTIAL_SCAN; + else if (oflag & _O_RANDOM) + fileattrib|= FILE_FLAG_RANDOM_ACCESS; + + /* try to open/create the file */ + if ((osfh= CreateFile(path, fileaccess, fileshare, &SecurityAttributes, + filecreate, fileattrib, NULL)) == INVALID_HANDLE_VALUE) + { + /* + OS call to open/create file failed! map the error, release + the lock, and return -1. note that it's not necessary to + call _free_osfhnd (it hasn't been used yet). + */ + my_osmaperr(GetLastError()); /* map error */ + DBUG_RETURN(-1); /* return error to caller */ + } + + if ((fh= my_open_osfhandle(osfh, + oflag & (_O_APPEND | _O_RDONLY | _O_TEXT))) == -1) + { + CloseHandle(osfh); + } + + DBUG_RETURN(fh); /* return handle */ +} + + +File my_win_open(const char *path, int flags) +{ + DBUG_ENTER("my_win_open"); + DBUG_RETURN(my_win_sopen((char *) path, flags | _O_BINARY, _SH_DENYNO, + _S_IREAD | S_IWRITE)); +} + + +int my_win_close(File fd) +{ + DBUG_ENTER("my_win_close"); + if(CloseHandle(my_get_osfhandle(fd))) + { + invalidate_fd(fd); + DBUG_RETURN(0); + } + my_osmaperr(GetLastError()); + DBUG_RETURN(-1); +} + + +size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset) +{ + DWORD nBytesRead; + HANDLE hFile; + OVERLAPPED ov= {0}; + LARGE_INTEGER li; + + DBUG_ENTER("my_win_pread"); + + if(!Count) + DBUG_RETURN(0); +#ifdef _WIN64 + if(Count > UINT_MAX) + Count= UINT_MAX; +#endif + + hFile= (HANDLE)my_get_osfhandle(Filedes); + li.QuadPart= offset; + ov.Offset= li.LowPart; + ov.OffsetHigh= li.HighPart; + + if(!ReadFile(hFile, Buffer, (DWORD)Count, &nBytesRead, &ov)) + { + DWORD lastError= GetLastError(); + if(lastError == ERROR_HANDLE_EOF) + DBUG_RETURN(0); /*return 0 at EOF*/ + my_osmaperr(lastError); + DBUG_RETURN(-1); + } + DBUG_RETURN(nBytesRead); +} + + +size_t my_win_read(File Filedes, uchar *Buffer, size_t Count) +{ + DWORD nBytesRead; + HANDLE hFile; + + DBUG_ENTER("my_win_read"); + if(!Count) + return 0; +#ifdef _WIN64 + if(Count > UINT_MAX) + Count= UINT_MAX; +#endif + + hFile= (HANDLE)my_get_osfhandle(Filedes); + + if(!ReadFile(hFile, Buffer, (DWORD)Count, &nBytesRead, NULL)) + { + DWORD lastError= GetLastError(); + /* + ERROR_BROKEN_PIPE is returned when no more data coming + through e.g. a command pipe in windows : see MSDN on ReadFile. + */ + if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE) + DBUG_RETURN(0); /*return 0 at EOF*/ + my_osmaperr(lastError); + DBUG_RETURN(-1); + } + DBUG_RETURN(nBytesRead); +} + + +size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count, + my_off_t offset) +{ + DWORD nBytesWritten; + HANDLE hFile; + OVERLAPPED ov= {0}; + LARGE_INTEGER li; + + DBUG_ENTER("my_win_pwrite"); + DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count: %zd, offset: %llu", + Filedes, Buffer, Count, (ulonglong)offset)); + + if(!Count) + DBUG_RETURN(0); + +#ifdef _WIN64 + if(Count > UINT_MAX) + Count= UINT_MAX; +#endif + + hFile= (HANDLE)my_get_osfhandle(Filedes); + li.QuadPart= offset; + ov.Offset= li.LowPart; + ov.OffsetHigh= li.HighPart; + + if(!WriteFile(hFile, Buffer, (DWORD)Count, &nBytesWritten, &ov)) + { + my_osmaperr(GetLastError()); + DBUG_RETURN(-1); + } + else + DBUG_RETURN(nBytesWritten); +} + + +my_off_t my_win_lseek(File fd, my_off_t pos, int whence) +{ + LARGE_INTEGER offset; + LARGE_INTEGER newpos; + + DBUG_ENTER("my_win_lseek"); + + /* Check compatibility of Windows and Posix seek constants */ + compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR + && FILE_END == SEEK_END); + + offset.QuadPart= pos; + if(!SetFilePointerEx(my_get_osfhandle(fd), offset, &newpos, whence)) + { + my_osmaperr(GetLastError()); + newpos.QuadPart= -1; + } + DBUG_RETURN(newpos.QuadPart); +} + + +#ifndef FILE_WRITE_TO_END_OF_FILE +#define FILE_WRITE_TO_END_OF_FILE 0xffffffff +#endif +size_t my_win_write(File fd, const uchar *Buffer, size_t Count) +{ + DWORD nWritten; + OVERLAPPED ov; + OVERLAPPED *pov= NULL; + HANDLE hFile; + + DBUG_ENTER("my_win_write"); + DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count %zd", fd, Buffer, Count)); + if(my_get_open_flags(fd) & _O_APPEND) + { + /* + Atomic append to the end of file is is done by special initialization of + the OVERLAPPED structure. See MSDN WriteFile documentation for more info. + */ + memset(&ov, 0, sizeof(ov)); + ov.Offset= FILE_WRITE_TO_END_OF_FILE; + ov.OffsetHigh= -1; + pov= &ov; + } + + hFile= my_get_osfhandle(fd); + if(!WriteFile(hFile, Buffer, (DWORD)Count, &nWritten, pov)) + { + nWritten= (size_t)-1; + my_osmaperr(GetLastError()); + } + DBUG_RETURN((size_t)nWritten); +} + + +int my_win_chsize(File fd, my_off_t newlength) +{ + HANDLE hFile; + LARGE_INTEGER length; + DBUG_ENTER("my_win_chsize"); + + hFile= (HANDLE) my_get_osfhandle(fd); + length.QuadPart= newlength; + if (!SetFilePointerEx(hFile, length , NULL , FILE_BEGIN)) + goto err; + if (!SetEndOfFile(hFile)) + goto err; + DBUG_RETURN(0); +err: + my_osmaperr(GetLastError()); + my_errno= errno; + DBUG_RETURN(-1); +} + + +/* Get the file descriptor for stdin,stdout or stderr */ +static File my_get_stdfile_descriptor(FILE *stream) +{ + HANDLE hFile; + DWORD nStdHandle; + DBUG_ENTER("my_get_stdfile_descriptor"); + + if(stream == stdin) + nStdHandle= STD_INPUT_HANDLE; + else if(stream == stdout) + nStdHandle= STD_OUTPUT_HANDLE; + else if(stream == stderr) + nStdHandle= STD_ERROR_HANDLE; + else + DBUG_RETURN(-1); + + hFile= GetStdHandle(nStdHandle); + if(hFile != INVALID_HANDLE_VALUE) + DBUG_RETURN(my_open_osfhandle(hFile, 0)); + DBUG_RETURN(-1); +} + + +File my_win_fileno(FILE *file) +{ + HANDLE hFile= (HANDLE)_get_osfhandle(fileno(file)); + int retval= -1; + uint i; + + DBUG_ENTER("my_win_fileno"); + + for(i= MY_FILE_MIN; i < my_file_limit; i++) + { + if(my_file_info[i].fhandle == hFile) + { + retval= i; + break; + } + } + if(retval == -1) + /* try std stream */ + DBUG_RETURN(my_get_stdfile_descriptor(file)); + DBUG_RETURN(retval); +} + + +FILE *my_win_fopen(const char *filename, const char *type) +{ + FILE *file; + int flags= 0; + DBUG_ENTER("my_win_open"); + + /* + If we are not creating, then we need to use my_access to make sure + the file exists since Windows doesn't handle files like "com1.sym" + very well + */ + if (check_if_legal_filename(filename)) + { + errno= EACCES; + DBUG_RETURN(NULL); + } + + file= fopen(filename, type); + if(!file) + DBUG_RETURN(NULL); + + if(strchr(type,'a') != NULL) + flags= O_APPEND; + + /* + Register file handle in my_table_info. + Necessary for my_fileno() + */ + if(my_open_osfhandle((HANDLE)_get_osfhandle(fileno(file)), flags) < 0) + { + fclose(file); + DBUG_RETURN(NULL); + } + DBUG_RETURN(file); +} + + +FILE * my_win_fdopen(File fd, const char *type) +{ + FILE *file; + int crt_fd; + int flags= 0; + + DBUG_ENTER("my_win_fdopen"); + + if(strchr(type,'a') != NULL) + flags= O_APPEND; + /* Convert OS file handle to CRT file descriptor and then call fdopen*/ + crt_fd= _open_osfhandle((intptr_t)my_get_osfhandle(fd), flags); + if(crt_fd < 0) + file= NULL; + else + file= fdopen(crt_fd, type); + DBUG_RETURN(file); +} + + +int my_win_fclose(FILE *file) +{ + File fd; + + DBUG_ENTER("my_win_close"); + fd= my_fileno(file); + if(fd < 0) + DBUG_RETURN(-1); + if(fclose(file) < 0) + DBUG_RETURN(-1); + invalidate_fd(fd); + DBUG_RETURN(0); +} + + + +/* + Quick and dirty my_fstat() implementation for Windows. + Use CRT fstat on temporarily allocated file descriptor. + Patch file size, because size that fstat returns is not + reliable (may be outdated) +*/ +int my_win_fstat(File fd, struct _stati64 *buf) +{ + int crt_fd; + int retval; + HANDLE hFile, hDup; + + DBUG_ENTER("my_win_fstat"); + + hFile= my_get_osfhandle(fd); + if(!DuplicateHandle( GetCurrentProcess(), hFile, GetCurrentProcess(), + &hDup ,0,FALSE,DUPLICATE_SAME_ACCESS)) + { + my_osmaperr(GetLastError()); + DBUG_RETURN(-1); + } + if ((crt_fd= _open_osfhandle((intptr_t)hDup,0)) < 0) + DBUG_RETURN(-1); + + retval= _fstati64(crt_fd, buf); + if(retval == 0) + { + /* File size returned by stat is not accurate (may be outdated), fix it*/ + GetFileSizeEx(hDup, (PLARGE_INTEGER) (&(buf->st_size))); + } + _close(crt_fd); + DBUG_RETURN(retval); +} + + + +int my_win_stat( const char *path, struct _stati64 *buf) +{ + DBUG_ENTER("my_win_stat"); + if(_stati64( path, buf) == 0) + { + /* File size returned by stat is not accurate (may be outdated), fix it*/ + WIN32_FILE_ATTRIBUTE_DATA data; + if (GetFileAttributesEx(path, GetFileExInfoStandard, &data)) + { + LARGE_INTEGER li; + li.LowPart= data.nFileSizeLow; + li.HighPart= data.nFileSizeHigh; + buf->st_size= li.QuadPart; + } + DBUG_RETURN(0); + } + DBUG_RETURN(-1); +} + + + +int my_win_fsync(File fd) +{ + DBUG_ENTER("my_win_fsync"); + if(FlushFileBuffers(my_get_osfhandle(fd))) + DBUG_RETURN(0); + my_osmaperr(GetLastError()); + DBUG_RETURN(-1); +} + + + +int my_win_dup(File fd) +{ + HANDLE hDup; + DBUG_ENTER("my_win_dup"); + if (DuplicateHandle(GetCurrentProcess(), my_get_osfhandle(fd), + GetCurrentProcess(), &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS)) + { + DBUG_RETURN(my_open_osfhandle(hDup, my_get_open_flags(fd))); + } + my_osmaperr(GetLastError()); + DBUG_RETURN(-1); +} + +#endif /*_WIN32*/ diff --git a/externals/mysql/mysys/my_winthread.c b/externals/mysql/mysys/my_winthread.c new file mode 100644 index 0000000..9e8458b --- /dev/null +++ b/externals/mysql/mysys/my_winthread.c @@ -0,0 +1,132 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/***************************************************************************** +** Simulation of posix threads calls for Windows +*****************************************************************************/ +#if defined (_WIN32) +/* SAFE_MUTEX will not work until the thread structure is up to date */ +#undef SAFE_MUTEX +#include "mysys_priv.h" +#include +#include + +static void install_sigabrt_handler(void); + +struct thread_start_parameter +{ + pthread_handler func; + void *arg; +}; + +/** + Adapter to @c pthread_mutex_trylock() + + @retval 0 Mutex was acquired + @retval EBUSY Mutex was already locked by a thread + */ +int +win_pthread_mutex_trylock(pthread_mutex_t *mutex) +{ + if (TryEnterCriticalSection(mutex)) + { + /* Don't allow recursive lock */ + if (mutex->RecursionCount > 1){ + LeaveCriticalSection(mutex); + return EBUSY; + } + return 0; + } + return EBUSY; +} + +static unsigned int __stdcall pthread_start(void *p) +{ + struct thread_start_parameter *par= (struct thread_start_parameter *)p; + pthread_handler func= par->func; + void *arg= par->arg; + free(p); + (*func)(arg); + return 0; +} + + +int pthread_create(pthread_t *thread_id, pthread_attr_t *attr, + pthread_handler func, void *param) +{ + uintptr_t handle; + struct thread_start_parameter *par; + unsigned int stack_size; + DBUG_ENTER("pthread_create"); + + par= (struct thread_start_parameter *)malloc(sizeof(*par)); + if (!par) + goto error_return; + + par->func= func; + par->arg= param; + stack_size= attr?attr->dwStackSize:0; + + handle= _beginthreadex(NULL, stack_size , pthread_start, par, 0, thread_id); + if (!handle) + goto error_return; + DBUG_PRINT("info", ("thread id=%u",*thread_id)); + + /* Do not need thread handle, close it */ + CloseHandle((HANDLE)handle); + DBUG_RETURN(0); + +error_return: + DBUG_PRINT("error", + ("Can't create thread to handle request (error %d)",errno)); + DBUG_RETURN(-1); +} + + +void pthread_exit(void *a) +{ + _endthreadex(0); +} + +int pthread_join(pthread_t thread, void **value_ptr) +{ + DWORD ret; + HANDLE handle; + + handle= OpenThread(SYNCHRONIZE, FALSE, thread); + if (!handle) + { + errno= EINVAL; + goto error_return; + } + + ret= WaitForSingleObject(handle, INFINITE); + + if(ret != WAIT_OBJECT_0) + { + errno= EINVAL; + goto error_return; + } + + CloseHandle(handle); + return 0; + +error_return: + if(handle) + CloseHandle(handle); + return -1; +} + +#endif diff --git a/externals/mysql/mysys/my_write.c b/externals/mysql/mysys/my_write.c new file mode 100644 index 0000000..3eac136 --- /dev/null +++ b/externals/mysql/mysys/my_write.c @@ -0,0 +1,101 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include + + + /* Write a chunk of bytes to a file */ + +size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags) +{ + size_t writtenbytes, written; + uint errors; + DBUG_ENTER("my_write"); + DBUG_PRINT("my",("fd: %d Buffer: %p Count: %lu MyFlags: %d", + Filedes, Buffer, (ulong) Count, MyFlags)); + errors= 0; written= 0; + + /* The behavior of write(fd, buf, 0) is not portable */ + if (unlikely(!Count)) + DBUG_RETURN(0); + + for (;;) + { +#ifdef _WIN32 + writtenbytes= my_win_write(Filedes, Buffer, Count); +#else + writtenbytes= write(Filedes, Buffer, Count); +#endif + if (writtenbytes == Count) + break; + if (writtenbytes != (size_t) -1) + { /* Safeguard */ + written+= writtenbytes; + Buffer+= writtenbytes; + Count-= writtenbytes; + } + my_errno= errno; + DBUG_PRINT("error",("Write only %ld bytes, error: %d", + (long) writtenbytes, my_errno)); +#ifndef NO_BACKGROUND +#ifdef THREAD + if (my_thread_var->abort) + MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ +#endif + if ((my_errno == ENOSPC || my_errno == EDQUOT) && + (MyFlags & MY_WAIT_IF_FULL)) + { + wait_for_free_space(my_filename(Filedes), errors); + errors++; + continue; + } + + if ((writtenbytes == 0 || writtenbytes == (size_t) -1)) + { + if (my_errno == EINTR) + { + DBUG_PRINT("debug", ("my_write() was interrupted and returned %ld", + (long) writtenbytes)); + continue; /* Interrupted */ + } + + if (!writtenbytes && !errors++) /* Retry once */ + { + /* We may come here if the file quota is exeeded */ + errno= EFBIG; /* Assume this is the error */ + continue; + } + } + else + continue; /* Retry */ +#endif + if (MyFlags & (MY_NABP | MY_FNABP)) + { + if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) + { + my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG), + my_filename(Filedes),my_errno); + } + DBUG_RETURN(MY_FILE_ERROR); /* Error on read */ + } + else + break; /* Return bytes written */ + } + if (MyFlags & (MY_NABP | MY_FNABP)) + DBUG_RETURN(0); /* Want only errors */ + DBUG_RETURN(writtenbytes+written); +} /* my_write */ diff --git a/externals/mysql/mysys/mysys_priv.h b/externals/mysql/mysys/mysys_priv.h new file mode 100644 index 0000000..73f8f85 --- /dev/null +++ b/externals/mysql/mysys/mysys_priv.h @@ -0,0 +1,72 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include + +#ifdef USE_SYSTEM_WRAPPERS +#include "system_wrappers.h" +#endif + +#ifdef HAVE_GETRUSAGE +#include +#endif + +#ifdef THREAD +#include +extern pthread_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache; +extern pthread_mutex_t THR_LOCK_lock, THR_LOCK_isam, THR_LOCK_net; +extern pthread_mutex_t THR_LOCK_charset, THR_LOCK_time; +#else +#include +#endif + + +/* + EDQUOT is used only in 3 C files only in mysys/. If it does not exist on + system, we set it to some value which can never happen. +*/ +#ifndef EDQUOT +#define EDQUOT (-1) +#endif + +void my_error_unregister_all(void); + +#ifdef _WIN32 +/* my_winfile.c exports, should not be used outside mysys */ +extern File my_win_open(const char *path, int oflag); +extern int my_win_close(File fd); +extern size_t my_win_read(File fd, uchar *buffer, size_t count); +extern size_t my_win_write(File fd, const uchar *buffer, size_t count); +extern size_t my_win_pread(File fd, uchar *buffer, size_t count, + my_off_t offset); +extern size_t my_win_pwrite(File fd, const uchar *buffer, size_t count, + my_off_t offset); +extern my_off_t my_win_lseek(File fd, my_off_t pos, int whence); +extern int my_win_chsize(File fd, my_off_t newlength); +extern FILE* my_win_fopen(const char *filename, const char *type); +extern File my_win_fclose(FILE *file); +extern File my_win_fileno(FILE *file); +extern FILE* my_win_fdopen(File Filedes, const char *type); +extern int my_win_stat(const char *path, struct _stati64 *buf); +extern int my_win_fstat(File fd, struct _stati64 *buf); +extern int my_win_fsync(File fd); +extern File my_win_dup(File fd); +extern File my_win_sopen(const char *path, int oflag, int shflag, int perm); +extern File my_open_osfhandle(HANDLE handle, int oflag); +#endif + +void my_thread_destroy_mutex(void); +my_bool my_wait_for_other_threads_to_die(uint number_of_threads); diff --git a/externals/mysql/mysys/ptr_cmp.c b/externals/mysql/mysys/ptr_cmp.c new file mode 100644 index 0000000..24ab6a1 --- /dev/null +++ b/externals/mysql/mysys/ptr_cmp.c @@ -0,0 +1,192 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + get_ptr_compare(len) returns a pointer to a optimal byte-compare function + for a array of stringpointer where all strings have size len. + The bytes are compare as unsigned chars. + */ + +#include "mysys_priv.h" +#include + +static int ptr_compare(size_t *compare_length, uchar **a, uchar **b); +static int ptr_compare_0(size_t *compare_length, uchar **a, uchar **b); +static int ptr_compare_1(size_t *compare_length, uchar **a, uchar **b); +static int ptr_compare_2(size_t *compare_length, uchar **a, uchar **b); +static int ptr_compare_3(size_t *compare_length, uchar **a, uchar **b); + + /* Get a pointer to a optimal byte-compare function for a given size */ + +qsort2_cmp get_ptr_compare (size_t size) +{ + if (size < 4) + return (qsort2_cmp) ptr_compare; + switch (size & 3) { + case 0: return (qsort2_cmp) ptr_compare_0; + case 1: return (qsort2_cmp) ptr_compare_1; + case 2: return (qsort2_cmp) ptr_compare_2; + case 3: return (qsort2_cmp) ptr_compare_3; + } + return 0; /* Impossible */ +} + + + /* + Compare to keys to see witch is smaller. + Loop unrolled to make it quick !! + */ + +#define cmp(N) if (first[N] != last[N]) return (int) first[N] - (int) last[N] + +static int ptr_compare(size_t *compare_length, uchar **a, uchar **b) +{ + reg3 int length= *compare_length; + reg1 uchar *first,*last; + + first= *a; last= *b; + while (--length) + { + if (*first++ != *last++) + return (int) first[-1] - (int) last[-1]; + } + return (int) first[0] - (int) last[0]; +} + + +static int ptr_compare_0(size_t *compare_length,uchar **a, uchar **b) +{ + reg3 int length= *compare_length; + reg1 uchar *first,*last; + + first= *a; last= *b; + loop: + cmp(0); + cmp(1); + cmp(2); + cmp(3); + if ((length-=4)) + { + first+=4; + last+=4; + goto loop; + } + return (0); +} + + +static int ptr_compare_1(size_t *compare_length,uchar **a, uchar **b) +{ + reg3 int length= *compare_length-1; + reg1 uchar *first,*last; + + first= *a+1; last= *b+1; + cmp(-1); + loop: + cmp(0); + cmp(1); + cmp(2); + cmp(3); + if ((length-=4)) + { + first+=4; + last+=4; + goto loop; + } + return (0); +} + +static int ptr_compare_2(size_t *compare_length,uchar **a, uchar **b) +{ + reg3 int length= *compare_length-2; + reg1 uchar *first,*last; + + first= *a +2 ; last= *b +2; + cmp(-2); + cmp(-1); + loop: + cmp(0); + cmp(1); + cmp(2); + cmp(3); + if ((length-=4)) + { + first+=4; + last+=4; + goto loop; + } + return (0); +} + +static int ptr_compare_3(size_t *compare_length,uchar **a, uchar **b) +{ + reg3 int length= *compare_length-3; + reg1 uchar *first,*last; + + first= *a +3 ; last= *b +3; + cmp(-3); + cmp(-2); + cmp(-1); + loop: + cmp(0); + cmp(1); + cmp(2); + cmp(3); + if ((length-=4)) + { + first+=4; + last+=4; + goto loop; + } + return (0); +} + +void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos) +{ + switch (pack_length) { +#if SIZEOF_OFF_T > 4 + case 8: mi_int8store(buff,pos); break; + case 7: mi_int7store(buff,pos); break; + case 6: mi_int6store(buff,pos); break; + case 5: mi_int5store(buff,pos); break; +#endif + case 4: mi_int4store(buff,pos); break; + case 3: mi_int3store(buff,pos); break; + case 2: mi_int2store(buff,pos); break; + case 1: buff[0]= (uchar) pos; break; + default: DBUG_ASSERT(0); + } + return; +} + +my_off_t my_get_ptr(uchar *ptr, size_t pack_length) +{ + my_off_t pos; + switch (pack_length) { +#if SIZEOF_OFF_T > 4 + case 8: pos= (my_off_t) mi_uint8korr(ptr); break; + case 7: pos= (my_off_t) mi_uint7korr(ptr); break; + case 6: pos= (my_off_t) mi_uint6korr(ptr); break; + case 5: pos= (my_off_t) mi_uint5korr(ptr); break; +#endif + case 4: pos= (my_off_t) mi_uint4korr(ptr); break; + case 3: pos= (my_off_t) mi_uint3korr(ptr); break; + case 2: pos= (my_off_t) mi_uint2korr(ptr); break; + case 1: pos= (my_off_t) *(uchar*) ptr; break; + default: DBUG_ASSERT(0); return 0; + } + return pos; +} + diff --git a/externals/mysql/mysys/queues.c b/externals/mysql/mysys/queues.c new file mode 100644 index 0000000..7ca978f --- /dev/null +++ b/externals/mysql/mysys/queues.c @@ -0,0 +1,690 @@ +/* Copyright (C) 2000, 2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Code for generell handling of priority Queues. + Implemention of queues from "Algoritms in C" by Robert Sedgewick. + An optimisation of _downheap suggested in Exercise 7.51 in "Data + Structures & Algorithms in C++" by Mark Allen Weiss, Second Edition + was implemented by Mikael Ronstrom 2005. Also the O(N) algorithm + of queue_fix was implemented. +*/ + +#include "mysys_priv.h" +#include "mysys_err.h" +#include + + +/* + Init queue + + SYNOPSIS + init_queue() + queue Queue to initialise + max_elements Max elements that will be put in queue + offset_to_key Offset to key in element stored in queue + Used when sending pointers to compare function + max_at_top Set to 1 if you want biggest element on top. + compare Compare function for elements, takes 3 arguments. + first_cmp_arg First argument to compare function + + NOTES + Will allocate max_element pointers for queue array + + RETURN + 0 ok + 1 Could not allocate memory +*/ + +int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key, + pbool max_at_top, int (*compare) (void *, uchar *, uchar *), + void *first_cmp_arg) +{ + DBUG_ENTER("init_queue"); + if ((queue->root= (uchar **) my_malloc((max_elements+1)*sizeof(void*), + MYF(MY_WME))) == 0) + DBUG_RETURN(1); + queue->elements=0; + queue->compare=compare; + queue->first_cmp_arg=first_cmp_arg; + queue->max_elements=max_elements; + queue->offset_to_key=offset_to_key; + queue_set_max_at_top(queue, max_at_top); + DBUG_RETURN(0); +} + + + +/* + Init queue, uses init_queue internally for init work but also accepts + auto_extent as parameter + + SYNOPSIS + init_queue_ex() + queue Queue to initialise + max_elements Max elements that will be put in queue + offset_to_key Offset to key in element stored in queue + Used when sending pointers to compare function + max_at_top Set to 1 if you want biggest element on top. + compare Compare function for elements, takes 3 arguments. + first_cmp_arg First argument to compare function + auto_extent When the queue is full and there is insert operation + extend the queue. + + NOTES + Will allocate max_element pointers for queue array + + RETURN + 0 ok + 1 Could not allocate memory +*/ + +int init_queue_ex(QUEUE *queue, uint max_elements, uint offset_to_key, + pbool max_at_top, int (*compare) (void *, uchar *, uchar *), + void *first_cmp_arg, uint auto_extent) +{ + int ret; + DBUG_ENTER("init_queue_ex"); + + if ((ret= init_queue(queue, max_elements, offset_to_key, max_at_top, compare, + first_cmp_arg))) + DBUG_RETURN(ret); + + queue->auto_extent= auto_extent; + DBUG_RETURN(0); +} + +/* + Reinitialize queue for other usage + + SYNOPSIS + reinit_queue() + queue Queue to initialise + max_elements Max elements that will be put in queue + offset_to_key Offset to key in element stored in queue + Used when sending pointers to compare function + max_at_top Set to 1 if you want biggest element on top. + compare Compare function for elements, takes 3 arguments. + first_cmp_arg First argument to compare function + + NOTES + This will delete all elements from the queue. If you don't want this, + use resize_queue() instead. + + RETURN + 0 ok + EE_OUTOFMEMORY Wrong max_elements +*/ + +int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key, + pbool max_at_top, int (*compare) (void *, uchar *, uchar *), + void *first_cmp_arg) +{ + DBUG_ENTER("reinit_queue"); + queue->elements=0; + queue->compare=compare; + queue->first_cmp_arg=first_cmp_arg; + queue->offset_to_key=offset_to_key; + queue_set_max_at_top(queue, max_at_top); + resize_queue(queue, max_elements); + DBUG_RETURN(0); +} + + +/* + Resize queue + + SYNOPSIS + resize_queue() + queue Queue + max_elements New max size for queue + + NOTES + If you resize queue to be less than the elements you have in it, + the extra elements will be deleted + + RETURN + 0 ok + 1 Error. In this case the queue is unchanged +*/ + +int resize_queue(QUEUE *queue, uint max_elements) +{ + uchar **new_root; + DBUG_ENTER("resize_queue"); + if (queue->max_elements == max_elements) + DBUG_RETURN(0); + if ((new_root= (uchar **) my_realloc((void *)queue->root, + (max_elements+1)*sizeof(void*), + MYF(MY_WME))) == 0) + DBUG_RETURN(1); + set_if_smaller(queue->elements, max_elements); + queue->max_elements= max_elements; + queue->root= new_root; + DBUG_RETURN(0); +} + + +/* + Delete queue + + SYNOPSIS + delete_queue() + queue Queue to delete + + IMPLEMENTATION + Just free allocated memory. + + NOTES + Can be called safely multiple times +*/ + +void delete_queue(QUEUE *queue) +{ + DBUG_ENTER("delete_queue"); + if (queue->root) + { + my_free((uchar*) queue->root,MYF(0)); + queue->root=0; + } + DBUG_VOID_RETURN; +} + + + /* Code for insert, search and delete of elements */ + +void queue_insert(register QUEUE *queue, uchar *element) +{ + reg2 uint idx, next; + DBUG_ASSERT(queue->elements < queue->max_elements); + queue->root[0]= element; + idx= ++queue->elements; + /* max_at_top swaps the comparison if we want to order by desc */ + while ((queue->compare(queue->first_cmp_arg, + element + queue->offset_to_key, + queue->root[(next= idx >> 1)] + + queue->offset_to_key) * queue->max_at_top) < 0) + { + queue->root[idx]= queue->root[next]; + idx= next; + } + queue->root[idx]= element; +} + +/* + Does safe insert. If no more space left on the queue resize it. + Return codes: + 0 - OK + 1 - Cannot allocate more memory + 2 - auto_extend is 0, the operation would + +*/ + +int queue_insert_safe(register QUEUE *queue, uchar *element) +{ + + if (queue->elements == queue->max_elements) + { + if (!queue->auto_extent) + return 2; + else if (resize_queue(queue, queue->max_elements + queue->auto_extent)) + return 1; + } + + queue_insert(queue, element); + return 0; +} + + + /* Remove item from queue */ + /* Returns pointer to removed element */ + +uchar *queue_remove(register QUEUE *queue, uint idx) +{ + uchar *element; + DBUG_ASSERT(idx < queue->max_elements); + element= queue->root[++idx]; /* Intern index starts from 1 */ + queue->root[idx]= queue->root[queue->elements--]; + _downheap(queue, idx); + return element; +} + + /* Fix when element on top has been replaced */ + +#ifndef queue_replaced +void queue_replaced(QUEUE *queue) +{ + _downheap(queue,1); +} +#endif + +#ifndef OLD_VERSION + +void _downheap(register QUEUE *queue, uint idx) +{ + uchar *element; + uint elements,half_queue,offset_to_key, next_index; + my_bool first= TRUE; + uint start_idx= idx; + + offset_to_key=queue->offset_to_key; + element=queue->root[idx]; + half_queue=(elements=queue->elements) >> 1; + + while (idx <= half_queue) + { + next_index=idx+idx; + if (next_index < elements && + (queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + queue->root[next_index+1]+offset_to_key) * + queue->max_at_top) > 0) + next_index++; + if (first && + (((queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + element+offset_to_key) * queue->max_at_top) >= 0))) + { + queue->root[idx]= element; + return; + } + queue->root[idx]=queue->root[next_index]; + idx=next_index; + first= FALSE; + } + + next_index= idx >> 1; + while (next_index > start_idx) + { + if ((queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + element+offset_to_key) * + queue->max_at_top) < 0) + break; + queue->root[idx]=queue->root[next_index]; + idx=next_index; + next_index= idx >> 1; + } + queue->root[idx]=element; +} + +#else + /* + The old _downheap version is kept for comparisons with the benchmark + suit or new benchmarks anyone wants to run for comparisons. + */ + /* Fix heap when index have changed */ +void _downheap(register QUEUE *queue, uint idx) +{ + uchar *element; + uint elements,half_queue,next_index,offset_to_key; + + offset_to_key=queue->offset_to_key; + element=queue->root[idx]; + half_queue=(elements=queue->elements) >> 1; + + while (idx <= half_queue) + { + next_index=idx+idx; + if (next_index < elements && + (queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + queue->root[next_index+1]+offset_to_key) * + queue->max_at_top) > 0) + next_index++; + if ((queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + element+offset_to_key) * queue->max_at_top) >= 0) + break; + queue->root[idx]=queue->root[next_index]; + idx=next_index; + } + queue->root[idx]=element; +} + + +#endif + +/* + Fix heap when every element was changed. +*/ + +void queue_fix(QUEUE *queue) +{ + uint i; + for (i= queue->elements >> 1; i > 0; i--) + _downheap(queue, i); +} + +#ifdef MAIN + /* + A test program for the priority queue implementation. + It can also be used to benchmark changes of the implementation + Build by doing the following in the directory mysys + make test_priority_queue + ./test_priority_queue + + Written by Mikael Ronström, 2005 + */ + +static uint num_array[1025]; +static uint tot_no_parts= 0; +static uint tot_no_loops= 0; +static uint expected_part= 0; +static uint expected_num= 0; +static my_bool max_ind= 0; +static my_bool fix_used= 0; +static ulonglong start_time= 0; + +static my_bool is_divisible_by(uint num, uint divisor) +{ + uint quotient= num / divisor; + if (quotient * divisor == num) + return TRUE; + return FALSE; +} + +void calculate_next() +{ + uint part= expected_part, num= expected_num; + uint no_parts= tot_no_parts; + if (max_ind) + { + do + { + while (++part <= no_parts) + { + if (is_divisible_by(num, part) && + (num <= ((1 << 21) + part))) + { + expected_part= part; + expected_num= num; + return; + } + } + part= 0; + } while (--num); + } + else + { + do + { + while (--part > 0) + { + if (is_divisible_by(num, part)) + { + expected_part= part; + expected_num= num; + return; + } + } + part= no_parts + 1; + } while (++num); + } +} + +void calculate_end_next(uint part) +{ + uint no_parts= tot_no_parts, num; + num_array[part]= 0; + if (max_ind) + { + expected_num= 0; + for (part= no_parts; part > 0 ; part--) + { + if (num_array[part]) + { + num= num_array[part] & 0x3FFFFF; + if (num >= expected_num) + { + expected_num= num; + expected_part= part; + } + } + } + if (expected_num == 0) + expected_part= 0; + } + else + { + expected_num= 0xFFFFFFFF; + for (part= 1; part <= no_parts; part++) + { + if (num_array[part]) + { + num= num_array[part] & 0x3FFFFF; + if (num <= expected_num) + { + expected_num= num; + expected_part= part; + } + } + } + if (expected_num == 0xFFFFFFFF) + expected_part= 0; + } + return; +} +static int test_compare(void *null_arg, uchar *a, uchar *b) +{ + uint a_num= (*(uint*)a) & 0x3FFFFF; + uint b_num= (*(uint*)b) & 0x3FFFFF; + uint a_part, b_part; + if (a_num > b_num) + return +1; + if (a_num < b_num) + return -1; + a_part= (*(uint*)a) >> 22; + b_part= (*(uint*)b) >> 22; + if (a_part < b_part) + return +1; + if (a_part > b_part) + return -1; + return 0; +} + +my_bool check_num(uint num_part) +{ + uint part= num_part >> 22; + uint num= num_part & 0x3FFFFF; + if (part == expected_part) + if (num == expected_num) + return FALSE; + printf("Expect part %u Expect num 0x%x got part %u num 0x%x max_ind %u fix_used %u \n", + expected_part, expected_num, part, num, max_ind, fix_used); + return TRUE; +} + + +void perform_insert(QUEUE *queue) +{ + uint i= 1, no_parts= tot_no_parts; + uint backward_start= 0; + + expected_part= 1; + expected_num= 1; + + if (max_ind) + backward_start= 1 << 21; + + do + { + uint num= (i + backward_start); + if (max_ind) + { + while (!is_divisible_by(num, i)) + num--; + if (max_ind && (num > expected_num || + (num == expected_num && i < expected_part))) + { + expected_num= num; + expected_part= i; + } + } + num_array[i]= num + (i << 22); + if (fix_used) + queue_element(queue, i-1)= (uchar*)&num_array[i]; + else + queue_insert(queue, (uchar*)&num_array[i]); + } while (++i <= no_parts); + if (fix_used) + { + queue->elements= no_parts; + queue_fix(queue); + } +} + +my_bool perform_ins_del(QUEUE *queue, my_bool max_ind) +{ + uint i= 0, no_loops= tot_no_loops, j= tot_no_parts; + do + { + uint num_part= *(uint*)queue_top(queue); + uint part= num_part >> 22; + if (check_num(num_part)) + return TRUE; + if (j++ >= no_loops) + { + calculate_end_next(part); + queue_remove(queue, (uint) 0); + } + else + { + calculate_next(); + if (max_ind) + num_array[part]-= part; + else + num_array[part]+= part; + queue_top(queue)= (uchar*)&num_array[part]; + queue_replaced(queue); + } + } while (++i < no_loops); + return FALSE; +} + +my_bool do_test(uint no_parts, uint l_max_ind, my_bool l_fix_used) +{ + QUEUE queue; + my_bool result; + max_ind= l_max_ind; + fix_used= l_fix_used; + init_queue(&queue, no_parts, 0, max_ind, test_compare, NULL); + tot_no_parts= no_parts; + tot_no_loops= 1024; + perform_insert(&queue); + if ((result= perform_ins_del(&queue, max_ind))) + delete_queue(&queue); + if (result) + { + printf("Error\n"); + return TRUE; + } + return FALSE; +} + +static void start_measurement() +{ + start_time= my_getsystime(); +} + +static void stop_measurement() +{ + ulonglong stop_time= my_getsystime(); + uint time_in_micros; + stop_time-= start_time; + stop_time/= 10; /* Convert to microseconds */ + time_in_micros= (uint)stop_time; + printf("Time expired is %u microseconds \n", time_in_micros); +} + +static void benchmark_test() +{ + QUEUE queue_real; + QUEUE *queue= &queue_real; + uint i, add; + fix_used= TRUE; + max_ind= FALSE; + tot_no_parts= 1024; + init_queue(queue, tot_no_parts, 0, max_ind, test_compare, NULL); + /* + First benchmark whether queue_fix is faster than using queue_insert + for sizes of 16 partitions. + */ + for (tot_no_parts= 2, add=2; tot_no_parts < 128; + tot_no_parts+= add, add++) + { + printf("Start benchmark queue_fix, tot_no_parts= %u \n", tot_no_parts); + start_measurement(); + for (i= 0; i < 128; i++) + { + perform_insert(queue); + queue_remove_all(queue); + } + stop_measurement(); + + fix_used= FALSE; + printf("Start benchmark queue_insert\n"); + start_measurement(); + for (i= 0; i < 128; i++) + { + perform_insert(queue); + queue_remove_all(queue); + } + stop_measurement(); + } + /* + Now benchmark insertion and deletion of 16400 elements. + Used in consecutive runs this shows whether the optimised _downheap + is faster than the standard implementation. + */ + printf("Start benchmarking _downheap \n"); + start_measurement(); + perform_insert(queue); + for (i= 0; i < 65536; i++) + { + uint num, part; + num= *(uint*)queue_top(queue); + num+= 16; + part= num >> 22; + num_array[part]= num; + queue_top(queue)= (uchar*)&num_array[part]; + queue_replaced(queue); + } + for (i= 0; i < 16; i++) + queue_remove(queue, (uint) 0); + queue_remove_all(queue); + stop_measurement(); +} + +int main() +{ + int i, add= 1; + for (i= 1; i < 1024; i+=add, add++) + { + printf("Start test for priority queue of size %u\n", i); + if (do_test(i, 0, 1)) + return -1; + if (do_test(i, 1, 1)) + return -1; + if (do_test(i, 0, 0)) + return -1; + if (do_test(i, 1, 0)) + return -1; + } + benchmark_test(); + printf("OK\n"); + return 0; +} +#endif diff --git a/externals/mysql/mysys/rijndael.c b/externals/mysql/mysys/rijndael.c new file mode 100644 index 0000000..539d94d --- /dev/null +++ b/externals/mysql/mysys/rijndael.c @@ -0,0 +1,1395 @@ +/* Copyright (C) 2002, 2004 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* + Based on version 3.0 (December 2000) + + Optimised ANSI C code for the Rijndael cipher (now AES) + + author Vincent Rijmen + author Antoon Bosselaers + author Paulo Barreto +*/ + +#include +#include "mysys/rijndael.h" + +/* + Define the following to use fastest and much larger code (~10K extra code) + #define FULL_UNROLL +*/ + + +#ifdef NOT_USED +Te0[x] = S [x].[02, 01, 01, 03]; +Te1[x] = S [x].[03, 02, 01, 01]; +Te2[x] = S [x].[01, 03, 02, 01]; +Te3[x] = S [x].[01, 01, 03, 02]; +Te4[x] = S [x].[01, 01, 01, 01]; + +Td0[x] = Si[x].[0e, 09, 0d, 0b]; +Td1[x] = Si[x].[0b, 0e, 09, 0d]; +Td2[x] = Si[x].[0d, 0b, 0e, 09]; +Td3[x] = Si[x].[09, 0d, 0b, 0e]; +Td4[x] = Si[x].[01, 01, 01, 01]; +#endif + + +static const uint32 Te0[256]= +{ + 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, + 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, + 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, + 0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU, + 0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U, + 0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU, + 0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU, + 0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU, + 0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU, + 0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU, + 0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U, + 0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU, + 0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU, + 0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U, + 0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU, + 0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU, + 0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU, + 0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU, + 0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU, + 0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U, + 0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU, + 0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU, + 0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU, + 0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU, + 0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U, + 0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U, + 0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U, + 0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U, + 0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU, + 0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U, + 0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U, + 0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU, + 0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU, + 0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U, + 0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U, + 0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U, + 0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU, + 0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U, + 0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU, + 0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U, + 0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU, + 0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U, + 0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U, + 0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU, + 0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U, + 0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U, + 0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U, + 0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U, + 0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U, + 0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U, + 0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U, + 0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U, + 0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU, + 0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U, + 0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U, + 0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U, + 0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U, + 0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U, + 0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U, + 0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU, + 0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U, + 0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U, + 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, + 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, +}; + +static const uint32 Te1[256]= +{ + 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, + 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, + 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, + 0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U, + 0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU, + 0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U, + 0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU, + 0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U, + 0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U, + 0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU, + 0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U, + 0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U, + 0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U, + 0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU, + 0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U, + 0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U, + 0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU, + 0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U, + 0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U, + 0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U, + 0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU, + 0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU, + 0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U, + 0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU, + 0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU, + 0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U, + 0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU, + 0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U, + 0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU, + 0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U, + 0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U, + 0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U, + 0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU, + 0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U, + 0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU, + 0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U, + 0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU, + 0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U, + 0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U, + 0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU, + 0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU, + 0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU, + 0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U, + 0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U, + 0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU, + 0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U, + 0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU, + 0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U, + 0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU, + 0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U, + 0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU, + 0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU, + 0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U, + 0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU, + 0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U, + 0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU, + 0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U, + 0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U, + 0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U, + 0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU, + 0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU, + 0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U, + 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, + 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, +}; + +static const uint32 Te2[256]= +{ + 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, + 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, + 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, + 0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U, + 0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU, + 0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U, + 0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU, + 0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U, + 0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U, + 0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU, + 0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U, + 0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U, + 0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U, + 0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU, + 0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U, + 0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U, + 0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU, + 0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U, + 0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U, + 0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U, + 0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU, + 0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU, + 0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U, + 0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU, + 0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU, + 0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U, + 0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU, + 0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U, + 0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU, + 0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U, + 0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U, + 0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U, + 0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU, + 0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U, + 0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU, + 0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U, + 0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU, + 0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U, + 0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U, + 0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU, + 0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU, + 0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU, + 0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U, + 0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U, + 0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU, + 0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U, + 0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU, + 0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U, + 0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU, + 0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U, + 0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU, + 0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU, + 0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U, + 0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU, + 0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U, + 0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU, + 0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U, + 0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U, + 0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U, + 0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU, + 0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU, + 0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U, + 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, + 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, +}; + +static const uint32 Te3[256]= +{ + 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, + 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, + 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, + 0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU, + 0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU, + 0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU, + 0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U, + 0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU, + 0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU, + 0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U, + 0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U, + 0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU, + 0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU, + 0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU, + 0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU, + 0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU, + 0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U, + 0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU, + 0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU, + 0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U, + 0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U, + 0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U, + 0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U, + 0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U, + 0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU, + 0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U, + 0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU, + 0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU, + 0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U, + 0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U, + 0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U, + 0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU, + 0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U, + 0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU, + 0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU, + 0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U, + 0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U, + 0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU, + 0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U, + 0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU, + 0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U, + 0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U, + 0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U, + 0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U, + 0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU, + 0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U, + 0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU, + 0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U, + 0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU, + 0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U, + 0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU, + 0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU, + 0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU, + 0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU, + 0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U, + 0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U, + 0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U, + 0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U, + 0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U, + 0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U, + 0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU, + 0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U, + 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, + 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, +}; + +static const uint32 Te4[256]= +{ + 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, + 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, + 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, + 0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U, + 0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU, + 0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U, + 0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU, + 0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U, + 0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U, + 0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU, + 0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U, + 0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U, + 0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U, + 0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU, + 0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U, + 0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U, + 0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU, + 0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U, + 0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U, + 0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U, + 0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU, + 0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU, + 0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U, + 0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU, + 0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU, + 0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U, + 0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU, + 0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U, + 0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU, + 0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U, + 0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U, + 0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U, + 0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU, + 0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U, + 0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU, + 0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U, + 0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU, + 0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U, + 0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U, + 0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU, + 0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU, + 0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU, + 0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U, + 0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U, + 0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU, + 0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U, + 0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU, + 0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U, + 0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU, + 0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U, + 0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU, + 0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU, + 0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U, + 0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU, + 0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U, + 0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU, + 0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U, + 0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U, + 0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U, + 0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU, + 0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU, + 0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U, + 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, + 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, +}; + +static const uint32 Td0[256]= +{ + 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, + 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, + 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, + 0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU, + 0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U, + 0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U, + 0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU, + 0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U, + 0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU, + 0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U, + 0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U, + 0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U, + 0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U, + 0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU, + 0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U, + 0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU, + 0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U, + 0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU, + 0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U, + 0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U, + 0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U, + 0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU, + 0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U, + 0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU, + 0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U, + 0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU, + 0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U, + 0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU, + 0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU, + 0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U, + 0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU, + 0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U, + 0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU, + 0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U, + 0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U, + 0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U, + 0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU, + 0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U, + 0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U, + 0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU, + 0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U, + 0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U, + 0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U, + 0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U, + 0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U, + 0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU, + 0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U, + 0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U, + 0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U, + 0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U, + 0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U, + 0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU, + 0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU, + 0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU, + 0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU, + 0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U, + 0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U, + 0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU, + 0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU, + 0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U, + 0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU, + 0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U, + 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, + 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, +}; + +static const uint32 Td1[256]= +{ + 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, + 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, + 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, + 0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U, + 0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U, + 0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U, + 0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U, + 0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U, + 0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U, + 0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU, + 0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU, + 0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU, + 0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U, + 0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU, + 0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U, + 0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U, + 0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U, + 0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU, + 0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU, + 0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U, + 0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU, + 0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U, + 0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU, + 0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU, + 0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U, + 0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U, + 0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U, + 0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU, + 0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U, + 0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU, + 0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U, + 0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U, + 0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U, + 0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU, + 0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U, + 0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U, + 0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U, + 0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U, + 0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U, + 0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U, + 0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU, + 0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU, + 0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U, + 0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU, + 0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U, + 0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU, + 0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU, + 0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U, + 0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU, + 0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U, + 0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U, + 0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U, + 0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U, + 0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U, + 0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U, + 0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U, + 0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU, + 0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U, + 0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U, + 0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU, + 0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U, + 0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U, + 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, + 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, +}; + +static const uint32 Td2[256]= +{ + 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, + 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, + 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, + 0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U, + 0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU, + 0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U, + 0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U, + 0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U, + 0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U, + 0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU, + 0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U, + 0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U, + 0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU, + 0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U, + 0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U, + 0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U, + 0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U, + 0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U, + 0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U, + 0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU, + + 0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U, + 0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U, + 0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U, + 0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U, + 0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U, + 0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU, + 0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU, + 0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U, + 0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU, + 0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U, + 0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU, + 0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU, + 0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU, + 0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU, + 0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U, + 0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U, + 0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U, + 0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U, + 0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U, + 0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U, + 0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U, + 0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU, + 0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU, + 0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U, + 0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U, + 0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU, + 0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU, + 0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U, + 0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U, + 0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U, + 0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U, + 0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U, + 0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U, + 0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U, + 0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU, + 0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U, + 0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U, + 0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U, + 0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U, + 0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U, + 0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U, + 0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU, + 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, + 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, +}; + +static const uint32 Td3[256]= +{ + 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, + 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, + 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, + 0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U, + 0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU, + 0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU, + 0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U, + 0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU, + 0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U, + 0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU, + 0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U, + 0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U, + 0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U, + 0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U, + 0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U, + 0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU, + 0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU, + 0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U, + 0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U, + 0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU, + 0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU, + 0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U, + 0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U, + 0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U, + 0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U, + 0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU, + 0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U, + 0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U, + 0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU, + 0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU, + 0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U, + 0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U, + 0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U, + 0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU, + 0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U, + 0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U, + 0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U, + 0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U, + 0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U, + 0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U, + 0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U, + 0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU, + 0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U, + 0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U, + 0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU, + 0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU, + 0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U, + 0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU, + 0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U, + 0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U, + 0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U, + 0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U, + 0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U, + 0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U, + 0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU, + 0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU, + 0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU, + 0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU, + 0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U, + 0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U, + 0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U, + 0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU, + 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, + 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, +}; + +static const uint32 Td4[256]= +{ + 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, + 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, + 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, + 0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU, + 0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U, + 0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U, + 0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U, + 0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU, + 0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U, + 0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU, + 0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU, + 0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU, + 0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U, + 0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U, + 0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U, + 0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U, + 0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U, + 0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U, + 0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU, + 0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U, + 0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U, + 0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU, + 0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U, + 0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U, + 0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U, + 0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU, + 0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U, + 0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U, + 0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU, + 0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U, + 0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U, + 0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU, + 0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U, + 0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU, + 0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU, + 0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U, + 0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U, + 0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U, + 0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U, + 0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU, + 0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U, + 0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U, + 0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU, + 0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU, + 0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU, + 0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U, + 0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU, + 0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U, + 0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U, + 0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U, + 0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U, + 0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU, + 0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U, + 0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU, + 0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU, + 0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU, + 0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU, + 0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U, + 0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU, + 0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U, + 0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU, + 0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U, + 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, + 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, +}; + + +/* for 128-bit blocks, Rijndael never uses more than 10 rcon values */ +static const uint32 rcon[]= +{ + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000, + 0x1B000000, 0x36000000, +}; + +#if defined(_MSC_VER) && defined(__i386__) + +#define RJ_SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) +#define GETuint32(p) RJ_SWAP(*((uint32 *)(p))) +#define PUTuint32(ct, st) { *((uint32 *)(ct)) = RJ_SWAP((st)); } + +#else + +#define GETuint32(pt) (((uint32)(pt)[0] << 24) ^ ((uint32)(pt)[1] << 16)\ + ^ ((uint32)(pt)[2] << 8) ^ ((uint32)(pt)[3])) +#define PUTuint32(ct, st) { (ct)[0] = (uint8)((st) >> 24); (ct)[1]\ += (uint8)((st) >> 16); (ct)[2] = (uint8)((st) >> 8); (ct)[3] = (uint8)(st); } + +#endif /* defined(_MSC_VER) && defined(__i386__) */ + + +/* + Expand the cipher key into the encryption key schedule. + + RETURN + The number of rounds for the given cipher key size. +*/ + +int rijndaelKeySetupEnc(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], + int keyBits) +{ + int i = 0; + uint32 temp; + + rk[0] = GETuint32(cipherKey ); + rk[1] = GETuint32(cipherKey + 4); + rk[2] = GETuint32(cipherKey + 8); + rk[3] = GETuint32(cipherKey + 12); + if (keyBits == 128) + { + for (;;) + { + temp = rk[3]; + rk[4] = (rk[0] ^ + (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ + (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ + (Te4[(temp ) & 0xff] & 0x0000ff00) ^ + (Te4[(temp >> 24) ] & 0x000000ff) ^ + rcon[i]); + rk[5] = rk[1] ^ rk[4]; + rk[6] = rk[2] ^ rk[5]; + rk[7] = rk[3] ^ rk[6]; + if (++i == 10) + return 10; + rk += 4; + } + } + rk[4] = GETuint32(cipherKey + 16); + rk[5] = GETuint32(cipherKey + 20); + if (keyBits == 192) + { + for (;;) + { + temp = rk[ 5]; + rk[ 6] = (rk[ 0] ^ + (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ + (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ + (Te4[(temp ) & 0xff] & 0x0000ff00) ^ + (Te4[(temp >> 24) ] & 0x000000ff) ^ + rcon[i]); + rk[ 7] = rk[ 1] ^ rk[ 6]; + rk[ 8] = rk[ 2] ^ rk[ 7]; + rk[ 9] = rk[ 3] ^ rk[ 8]; + if (++i == 8) + { + return 12; + } + rk[10] = rk[ 4] ^ rk[ 9]; + rk[11] = rk[ 5] ^ rk[10]; + rk += 6; + } + } + rk[6] = GETuint32(cipherKey + 24); + rk[7] = GETuint32(cipherKey + 28); + if (keyBits == 256) + { + for (;;) + { + temp = rk[ 7]; + rk[ 8] = (rk[ 0] ^ + (Te4[(temp >> 16) & 0xff] & 0xff000000) ^ + (Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^ + (Te4[(temp ) & 0xff] & 0x0000ff00) ^ + (Te4[(temp >> 24) ] & 0x000000ff) ^ + rcon[i]); + rk[ 9] = rk[ 1] ^ rk[ 8]; + rk[10] = rk[ 2] ^ rk[ 9]; + rk[11] = rk[ 3] ^ rk[10]; + if (++i == 7) + { + return 14; + } + temp = rk[11]; + rk[12] = (rk[ 4] ^ + (Te4[(temp >> 24) ] & 0xff000000) ^ + (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(temp ) & 0xff] & 0x000000ff)); + rk[13] = rk[ 5] ^ rk[12]; + rk[14] = rk[ 6] ^ rk[13]; + rk[15] = rk[ 7] ^ rk[14]; + rk += 8; + } + } + return 0; +} + + +/* + Expand the cipher key into the decryption key schedule. + + RETURN + The number of rounds for the given cipher key size. +*/ + +int rijndaelKeySetupDec(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], + int keyBits) +{ + int nr, i, j; + uint32 temp; + + /* expand the cipher key: */ + nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits); + /* invert the order of the round keys: */ + for (i = 0, j = 4*nr; i < j; i += 4, j -= 4) + { + temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; + temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; + temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; + temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; + } + /* + Apply the inverse MixColumn transform to all round keys but the first + and the last: + */ + for (i = 1; i < nr; i++) + { + rk += 4; + + rk[0]= ( + Td0[Te4[(rk[0] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[0] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[0] ) & 0xff] & 0xff]); + + rk[1]= (Td0[Te4[(rk[1] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[1] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[1] ) & 0xff] & 0xff]); + + rk[2]= (Td0[Te4[(rk[2] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[2] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[2] ) & 0xff] & 0xff]); + + rk[3]= (Td0[Te4[(rk[3] >> 24) ] & 0xff] ^ + Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^ + Td2[Te4[(rk[3] >> 8) & 0xff] & 0xff] ^ + Td3[Te4[(rk[3] ) & 0xff] & 0xff]); + } + return nr; +} + + +void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, + const uint8 pt[16], uint8 ct[16]) +{ + uint32 s0, s1, s2, s3, t0, t1, t2, t3; +#ifndef FULL_UNROLL + int r; +#endif /* FULL_UNROLL */ + + /* map byte array block to cipher state and add initial round key: */ + s0 = GETuint32(pt ) ^ rk[0]; + s1 = GETuint32(pt + 4) ^ rk[1]; + s2 = GETuint32(pt + 8) ^ rk[2]; + s3 = GETuint32(pt + 12) ^ rk[3]; + +#ifdef FULL_UNROLL + /* round 1: */ + t0= (Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] + ^ Te3[s3 & 0xff] ^ rk[ 4]); + t1= (Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] + ^ Te3[s0 & 0xff] ^ rk[ 5]); + t2= (Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] + ^ Te3[s1 & 0xff] ^ rk[ 6]); + t3= (Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] + ^ Te3[s2 & 0xff] ^ rk[ 7]); + + /* round 2: */ + s0= (Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] + ^ Te3[t3 & 0xff] ^ rk[ 8]); + s1= (Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] + ^ Te3[t0 & 0xff] ^ rk[ 9]); + s2= (Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] + ^ Te3[t1 & 0xff] ^ rk[10]); + s3= (Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] + ^ Te3[t2 & 0xff] ^ rk[11]); + + /* round 3: */ + t0= (Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] + ^ Te3[s3 & 0xff] ^ rk[12]); + t1= (Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] + ^ Te3[s0 & 0xff] ^ rk[13]); + t2= (Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] + ^ Te3[s1 & 0xff] ^ rk[14]); + t3= (Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] + ^ Te3[s2 & 0xff] ^ rk[15]); + + /* round 4: */ + s0= (Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] + ^ Te3[t3 & 0xff] ^ rk[16]); + s1= (Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] + ^ Te3[t0 & 0xff] ^ rk[17]); + s2= (Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] + ^ Te3[t1 & 0xff] ^ rk[18]); + s3= (Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] + ^ Te3[t2 & 0xff] ^ rk[19]); + + /* round 5: */ + t0= (Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] + ^ Te3[s3 & 0xff] ^ rk[20]); + t1= (Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] + ^ Te3[s0 & 0xff] ^ rk[21]); + t2= (Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] + ^ Te3[s1 & 0xff] ^ rk[22]); + t3= (Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] + ^ Te3[s2 & 0xff] ^ rk[23]); + + /* round 6: */ + s0= (Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] + ^ Te3[t3 & 0xff] ^ rk[24]); + s1= (Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] + ^ Te3[t0 & 0xff] ^ rk[25]); + s2= (Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] + ^ Te3[t1 & 0xff] ^ rk[26]); + s3= (Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] + ^ Te3[t2 & 0xff] ^ rk[27]); + + /* round 7: */ + t0= (Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] + ^ Te3[s3 & 0xff] ^ rk[28]); + t1= (Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] + ^ Te3[s0 & 0xff] ^ rk[29]); + t2= (Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] + ^ Te3[s1 & 0xff] ^ rk[30]); + t3= (Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] + ^ Te3[s2 & 0xff] ^ rk[31]); + + /* round 8: */ + s0= (Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] + ^ Te3[t3 & 0xff] ^ rk[32]); + s1= (Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] + ^ Te3[t0 & 0xff] ^ rk[33]); + s2= (Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] + ^ Te3[t1 & 0xff] ^ rk[34]); + s3= (Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] + ^ Te3[t2 & 0xff] ^ rk[35]); + + /* round 9: */ + t0= (Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] + ^ Te3[s3 & 0xff] ^ rk[36]); + t1= (Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] + ^ Te3[s0 & 0xff] ^ rk[37]); + t2= (Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] + ^ Te3[s1 & 0xff] ^ rk[38]); + t3= (Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] + ^ Te3[s2 & 0xff] ^ rk[39]); + + if (Nr > 10) + { + /* round 10: */ + s0= (Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] + ^ Te3[t3 & 0xff] ^ rk[40]); + s1= (Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] + ^ Te3[t0 & 0xff] ^ rk[41]); + s2= (Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] + ^ Te3[t1 & 0xff] ^ rk[42]); + s3= (Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] + ^ Te3[t2 & 0xff] ^ rk[43]); + + /* round 11: */ + t0= (Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] + ^ Te3[s3 & 0xff] ^ rk[44]); + t1= (Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] + ^ Te3[s0 & 0xff] ^ rk[45]); + t2= (Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] + ^ Te3[s1 & 0xff] ^ rk[46]); + t3= (Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] + ^ Te3[s2 & 0xff] ^ rk[47]); + + if (Nr > 12) + { + /* round 12: */ + s0= (Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >> 8) & 0xff] + ^ Te3[t3 & 0xff] ^ rk[48]); + s1= (Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >> 8) & 0xff] + ^ Te3[t0 & 0xff] ^ rk[49]); + s2= (Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >> 8) & 0xff] + ^ Te3[t1 & 0xff] ^ rk[50]); + s3= (Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >> 8) & 0xff] + ^ Te3[t2 & 0xff] ^ rk[51]); + + /* round 13: */ + t0= (Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >> 8) & 0xff] + ^ Te3[s3 & 0xff] ^ rk[52]); + t1= (Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >> 8) & 0xff] + ^ Te3[s0 & 0xff] ^ rk[53]); + t2= (Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >> 8) & 0xff] + ^ Te3[s1 & 0xff] ^ rk[54]); + t3= (Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >> 8) & 0xff] + ^ Te3[s2 & 0xff] ^ rk[55]); + } + } + rk += Nr << 2; +#else /* !FULL_UNROLL */ + + /* Nr - 1 full rounds: */ + + r = Nr >> 1; + for (;;) + { + t0= (Te0[(s0 >> 24) ] ^ + Te1[(s1 >> 16) & 0xff] ^ + Te2[(s2 >> 8) & 0xff] ^ + Te3[(s3 ) & 0xff] ^ + rk[4]); + + t1= (Te0[(s1 >> 24) ] ^ + Te1[(s2 >> 16) & 0xff] ^ + Te2[(s3 >> 8) & 0xff] ^ + Te3[(s0 ) & 0xff] ^ + rk[5]); + + t2= (Te0[(s2 >> 24) ] ^ + Te1[(s3 >> 16) & 0xff] ^ + Te2[(s0 >> 8) & 0xff] ^ + Te3[(s1 ) & 0xff] ^ + rk[6]); + + t3= (Te0[(s3 >> 24) ] ^ + Te1[(s0 >> 16) & 0xff] ^ + Te2[(s1 >> 8) & 0xff] ^ + Te3[(s2 ) & 0xff] ^ + rk[7]); + + rk+= 8; + if (--r == 0) + break; + + s0= (Te0[(t0 >> 24) ] ^ + Te1[(t1 >> 16) & 0xff] ^ + Te2[(t2 >> 8) & 0xff] ^ + Te3[(t3 ) & 0xff] ^ + rk[0]); + + s1= (Te0[(t1 >> 24) ] ^ + Te1[(t2 >> 16) & 0xff] ^ + Te2[(t3 >> 8) & 0xff] ^ + Te3[(t0 ) & 0xff] ^ + rk[1]); + + s2= (Te0[(t2 >> 24) ] ^ + Te1[(t3 >> 16) & 0xff] ^ + Te2[(t0 >> 8) & 0xff] ^ + Te3[(t1 ) & 0xff] ^ + rk[2]); + + s3= (Te0[(t3 >> 24) ] ^ + Te1[(t0 >> 16) & 0xff] ^ + Te2[(t1 >> 8) & 0xff] ^ + Te3[(t2 ) & 0xff] ^ + rk[3]); + } +#endif /* FULL_UNROLL */ + + /* Apply last round and map cipher state to byte array block: */ + s0= ((Te4[(t0 >> 24) ] & 0xff000000) ^ + (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t3 ) & 0xff] & 0x000000ff) ^ + rk[0]); + PUTuint32(ct , s0); + + s1= ((Te4[(t1 >> 24) ] & 0xff000000) ^ + (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t0 ) & 0xff] & 0x000000ff) ^ + rk[1]); + PUTuint32(ct + 4, s1); + + s2= ((Te4[(t2 >> 24) ] & 0xff000000) ^ + (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t1 ) & 0xff] & 0x000000ff) ^ + rk[2]); + PUTuint32(ct + 8, s2); + + s3= ((Te4[(t3 >> 24) ] & 0xff000000) ^ + (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ + (Te4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ + (Te4[(t2 ) & 0xff] & 0x000000ff) ^ + rk[3]); + PUTuint32(ct + 12, s3); +} + + +void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, + const uint8 ct[16], uint8 pt[16]) +{ + uint32 s0, s1, s2, s3, t0, t1, t2, t3; +#ifndef FULL_UNROLL + int r; +#endif /* FULL_UNROLL */ + + /* Map byte array block to cipher state and add initial round key: */ + + s0 = GETuint32(ct ) ^ rk[0]; + s1 = GETuint32(ct + 4) ^ rk[1]; + s2 = GETuint32(ct + 8) ^ rk[2]; + s3 = GETuint32(ct + 12) ^ rk[3]; + +#ifdef FULL_UNROLL + /* round 1: */ + t0= (Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] + ^ Td3[s1 & 0xff] ^ rk[ 4]); + t1= (Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] + ^ Td3[s2 & 0xff] ^ rk[ 5]); + t2= (Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] + ^ Td3[s3 & 0xff] ^ rk[ 6]); + t3= (Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] + ^ Td3[s0 & 0xff] ^ rk[ 7]); + + /* round 2: */ + s0= (Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] + ^ Td3[t1 & 0xff] ^ rk[ 8]); + s1= (Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] + ^ Td3[t2 & 0xff] ^ rk[ 9]); + s2= (Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] + ^ Td3[t3 & 0xff] ^ rk[10]); + s3= (Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] + ^ Td3[t0 & 0xff] ^ rk[11]); + + /* round 3: */ + t0= (Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] + ^ Td3[s1 & 0xff] ^ rk[12]); + t1= (Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] + ^ Td3[s2 & 0xff] ^ rk[13]); + t2= (Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] + ^ Td3[s3 & 0xff] ^ rk[14]); + t3= (Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] + ^ Td3[s0 & 0xff] ^ rk[15]); + + /* round 4: */ + s0= (Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] + ^ Td3[t1 & 0xff] ^ rk[16]); + s1= (Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] + ^ Td3[t2 & 0xff] ^ rk[17]); + s2= (Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] + ^ Td3[t3 & 0xff] ^ rk[18]); + s3= (Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] + ^ Td3[t0 & 0xff] ^ rk[19]); + + /* round 5: */ + t0= (Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] + ^ Td3[s1 & 0xff] ^ rk[20]); + t1= (Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] + ^ Td3[s2 & 0xff] ^ rk[21]); + t2= (Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] + ^ Td3[s3 & 0xff] ^ rk[22]); + t3= (Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] + ^ Td3[s0 & 0xff] ^ rk[23]); + + /* round 6: */ + s0= (Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] + ^ Td3[t1 & 0xff] ^ rk[24]); + s1= (Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] + ^ Td3[t2 & 0xff] ^ rk[25]); + s2= (Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] + ^ Td3[t3 & 0xff] ^ rk[26]); + s3= (Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] + ^ Td3[t0 & 0xff] ^ rk[27]); + + /* round 7: */ + t0= (Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] + ^ Td3[s1 & 0xff] ^ rk[28]); + t1= (Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] + ^ Td3[s2 & 0xff] ^ rk[29]); + t2= (Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] + ^ Td3[s3 & 0xff] ^ rk[30]); + t3= (Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] + ^ Td3[s0 & 0xff] ^ rk[31]); + + /* round 8: */ + s0= (Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] + ^ Td3[t1 & 0xff] ^ rk[32]); + s1= (Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] + ^ Td3[t2 & 0xff] ^ rk[33]); + s2= (Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] + ^ Td3[t3 & 0xff] ^ rk[34]); + s3= (Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] + ^ Td3[t0 & 0xff] ^ rk[35]); + + /* round 9: */ + t0= (Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] + ^ Td3[s1 & 0xff] ^ rk[36]); + t1= (Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] + ^ Td3[s2 & 0xff] ^ rk[37]); + t2= (Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] + ^ Td3[s3 & 0xff] ^ rk[38]); + t3= (Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] + ^ Td3[s0 & 0xff] ^ rk[39]); + + if (Nr > 10) + { + /* round 10: */ + s0= (Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] + ^ Td3[t1 & 0xff] ^ rk[40]); + s1= (Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] + ^ Td3[t2 & 0xff] ^ rk[41]); + s2= (Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] + ^ Td3[t3 & 0xff] ^ rk[42]); + s3= (Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] + ^ Td3[t0 & 0xff] ^ rk[43]); + + /* round 11: */ + t0= (Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] + ^ Td3[s1 & 0xff] ^ rk[44]); + t1= (Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] + ^ Td3[s2 & 0xff] ^ rk[45]); + t2= (Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] + ^ Td3[s3 & 0xff] ^ rk[46]); + t3= (Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] + ^ Td3[s0 & 0xff] ^ rk[47]); + + if (Nr > 12) + { + /* round 12: */ + s0= (Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >> 8) & 0xff] + ^ Td3[t1 & 0xff] ^ rk[48]); + s1= (Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >> 8) & 0xff] + ^ Td3[t2 & 0xff] ^ rk[49]); + s2= (Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >> 8) & 0xff] + ^ Td3[t3 & 0xff] ^ rk[50]); + s3= (Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >> 8) & 0xff] + ^ Td3[t0 & 0xff] ^ rk[51]); + + /* round 13: */ + t0= (Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >> 8) & 0xff] + ^ Td3[s1 & 0xff] ^ rk[52]); + t1= (Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >> 8) & 0xff] + ^ Td3[s2 & 0xff] ^ rk[53]); + t2= (Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >> 8) & 0xff] + ^ Td3[s3 & 0xff] ^ rk[54]); + t3= (Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >> 8) & 0xff] + ^ Td3[s0 & 0xff] ^ rk[55]); + } + } + rk += Nr << 2; +#else /* !FULL_UNROLL */ + + /* Nr - 1 full rounds: */ + r= (Nr >> 1); + for (;;) + { + t0= (Td0[(s0 >> 24) ] ^ + Td1[(s3 >> 16) & 0xff] ^ + Td2[(s2 >> 8) & 0xff] ^ + Td3[(s1 ) & 0xff] ^ + rk[4]); + + t1= (Td0[(s1 >> 24) ] ^ + Td1[(s0 >> 16) & 0xff] ^ + Td2[(s3 >> 8) & 0xff] ^ + Td3[(s2 ) & 0xff] ^ + rk[5]); + + t2= (Td0[(s2 >> 24) ] ^ + Td1[(s1 >> 16) & 0xff] ^ + Td2[(s0 >> 8) & 0xff] ^ + Td3[(s3 ) & 0xff] ^ + rk[6]); + + t3= (Td0[(s3 >> 24) ] ^ + Td1[(s2 >> 16) & 0xff] ^ + Td2[(s1 >> 8) & 0xff] ^ + Td3[(s0 ) & 0xff] ^ + rk[7]); + + rk+= 8; + if (--r == 0) + break; + + s0= (Td0[(t0 >> 24) ] ^ + Td1[(t3 >> 16) & 0xff] ^ + Td2[(t2 >> 8) & 0xff] ^ + Td3[(t1 ) & 0xff] ^ + rk[0]); + + s1= (Td0[(t1 >> 24) ] ^ + Td1[(t0 >> 16) & 0xff] ^ + Td2[(t3 >> 8) & 0xff] ^ + Td3[(t2 ) & 0xff] ^ + rk[1]); + + s2= (Td0[(t2 >> 24) ] ^ + Td1[(t1 >> 16) & 0xff] ^ + Td2[(t0 >> 8) & 0xff] ^ + Td3[(t3 ) & 0xff] ^ + rk[2]); + + s3= (Td0[(t3 >> 24) ] ^ + Td1[(t2 >> 16) & 0xff] ^ + Td2[(t1 >> 8) & 0xff] ^ + Td3[(t0 ) & 0xff] ^ + rk[3]); + } + +#endif /* FULL_UNROLL */ + + /* Apply last round and map cipher state to byte array block: */ + + s0= ((Td4[(t0 >> 24) ] & 0xff000000) ^ + (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t1 ) & 0xff] & 0x000000ff) ^ + rk[0]); + PUTuint32(pt , s0); + + s1= ((Td4[(t1 >> 24) ] & 0xff000000) ^ + (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t2 ) & 0xff] & 0x000000ff) ^ + rk[1]); + PUTuint32(pt + 4, s1); + + s2= ((Td4[(t2 >> 24) ] & 0xff000000) ^ + (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t3 ) & 0xff] & 0x000000ff) ^ + rk[2]); + PUTuint32(pt + 8, s2); + + s3= ((Td4[(t3 >> 24) ] & 0xff000000) ^ + (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ + (Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ + (Td4[(t0 ) & 0xff] & 0x000000ff) ^ + rk[3]); + PUTuint32(pt + 12, s3); +} diff --git a/externals/mysql/mysys/rijndael.h b/externals/mysql/mysys/rijndael.h new file mode 100644 index 0000000..89963a8 --- /dev/null +++ b/externals/mysql/mysys/rijndael.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2002 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +/* + rijndael-alg-fst.h + + @version 3.0 (December 2000) + Optimised ANSI C code for the Rijndael cipher (now AES) + @author Vincent Rijmen + @author Antoon Bosselaers + @author Paulo Barreto + + This code is hereby placed in the public domain. + Modified by Peter Zaitsev to fit MySQL coding style. + */ + +#define AES_MAXKC (256/32) +#define AES_MAXKB (256/8) +#define AES_MAXNR 14 + +int rijndaelKeySetupEnc(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], + int keyBits); +int rijndaelKeySetupDec(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[], + int keyBits); +void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, + const uint8 pt[16], uint8 ct[16]); +void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, + const uint8 ct[16], uint8 pt[16]); diff --git a/externals/mysql/mysys/safemalloc.c b/externals/mysql/mysys/safemalloc.c new file mode 100644 index 0000000..fc32df7 --- /dev/null +++ b/externals/mysql/mysys/safemalloc.c @@ -0,0 +1,576 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Memory sub-system, written by Bjorn Benson + Fixed to use my_sys scheme by Michael Widenius + + [This posting refers to an article entitled "oops, corrupted memory + again!" in net.lang.c. I am posting it here because it is source.] + + My tool for approaching this problem is to build another level of data + abstraction on top of malloc() and free() that implements some checking. + This does a number of things for you: + - Checks for overruns and underruns on allocated data + - Keeps track of where in the program the memory was malloc'ed + - Reports on pieces of memory that were not free'ed + - Records some statistics such as maximum memory used + - Marks newly malloc'ed and newly free'ed memory with special values + You can use this scheme to: + - Find bugs such as overrun, underrun, etc because you know where + a piece of data was malloc'ed and where it was free'ed + - Find bugs where memory was not free'ed + - Find bugs where newly malloc'ed memory is used without initializing + - Find bugs where newly free'ed memory is still used + - Determine how much memory your program really uses + - and other things + + To implement my scheme you must have a C compiler that has __LINE__ and + __FILE__ macros. If your compiler doesn't have these then (a) buy another: + compilers that do are available on UNIX 4.2bsd based systems and the PC, + and probably on other machines; or (b) change my scheme somehow. I have + recomendations on both these points if you would like them (e-mail please). + + There are 4 functions in my package: + char *NEW( uSize ) Allocate memory of uSize bytes + (equivalent to malloc()) + char *REA( pPtr, uSize) Allocate memory of uSize bytes, move data and + free pPtr. + (equivalent to realloc()) + FREE( pPtr ) Free memory allocated by NEW + (equivalent to free()) + TERMINATE(file,flag) End system, report errors and stats on file + I personally use two more functions, but have not included them here: + char *STRSAVE( sPtr ) Save a copy of the string in dynamic memory + char *RENEW( pPtr, uSize ) + (equivalent to realloc()) + +*/ + +#ifndef SAFEMALLOC +#define SAFEMALLOC /* Get protos from my_sys */ +#endif + +#include "mysys_priv.h" +#include +#include "my_static.h" +#include "mysys_err.h" + +ulonglong sf_malloc_mem_limit= ~(ulonglong)0; + +#ifndef PEDANTIC_SAFEMALLOC +/* + Set to 1 after TERMINATE() if we had to fiddle with sf_malloc_count and + the linked list of blocks so that _sanity() will not fuss when it + is not supposed to +*/ +static int sf_malloc_tampered= 0; +#endif + + + /* Static functions prototypes */ + +static int check_ptr(const char *where, uchar *ptr, const char *sFile, + uint uLine); +static int _checkchunk(struct st_irem *pRec, const char *sFile, uint uLine); + +/* + Note: We only fill up the allocated block. This do not include + malloc() roundoff or the extra space required by the irem + structures. +*/ + +/* + NEW'ed memory is filled with this value so that references to it will + end up being very strange. +*/ +#define ALLOC_VAL (uchar) 0xA5 +/* + FEEE'ed memory is filled with this value so that references to it will + end up being very strange. +*/ +#define FREE_VAL (uchar) 0x8F +#define MAGICKEY 0x14235296 /* A magic value for underrun key */ + +/* + Warning: do not change the MAGICEND? values to something with the + high bit set. Various C compilers (like the 4.2bsd one) do not do + the sign extension right later on in this code and you will get + erroneous errors. +*/ + +#define MAGICEND0 0x68 /* Magic values for overrun keys */ +#define MAGICEND1 0x34 /* " */ +#define MAGICEND2 0x7A /* " */ +#define MAGICEND3 0x15 /* " */ + + +/* Allocate some memory. */ + +void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags) +{ + struct st_irem *irem; + uchar *data; + DBUG_ENTER("_mymalloc"); + DBUG_PRINT("enter",("Size: %lu", (ulong) size)); + + if (!sf_malloc_quick) + (void) _sanity (filename, lineno); + + /* + Test for memory limit overrun. + If compiled with DBUG, test for error injection. Described in my_sys.h. + */ + if ((size + sf_malloc_cur_memory > sf_malloc_mem_limit) + IF_DBUG(|| my_malloc_error_inject)) + { + IF_DBUG(if (my_malloc_error_inject) + errno= ENOMEM; + my_malloc_error_inject= 0); + irem= 0; + } + else + { + /* Allocate the physical memory */ + irem= (struct st_irem *) malloc (ALIGN_SIZE(sizeof(struct st_irem)) + + sf_malloc_prehunc + + size + /* size requested */ + 4 + /* overrun mark */ + sf_malloc_endhunc); + } + /* Check if there isn't anymore memory avaiable */ + if (!irem) + { + if (MyFlags & MY_FAE) + error_handler_hook=fatal_error_handler_hook; + if (MyFlags & (MY_FAE+MY_WME)) + { + char buff[MYSYS_ERRMSG_SIZE]; + my_errno=errno; + my_snprintf(buff, sizeof(buff), "Out of memory at line %d, '%s'", + lineno, filename); + my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH)); + my_snprintf(buff, sizeof(buff), + "needed %lu byte (%luk), memory in use: %lu bytes (%luk)", + (ulong) size, (ulong) (size + 1023L) / 1024L, + (ulong) sf_malloc_max_memory, + (ulong) (sf_malloc_max_memory + 1023L) / 1024L); + my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH)); + } + DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'", + sf_malloc_max_memory,lineno, filename)); + if (MyFlags & MY_FAE) + exit(1); + DBUG_RETURN ((void*) 0); + } + + /* Fill up the structure */ + data= (((uchar*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + + sf_malloc_prehunc); + *((uint32*) (data-sizeof(uint32)))= MAGICKEY; + data[size + 0]= MAGICEND0; + data[size + 1]= MAGICEND1; + data[size + 2]= MAGICEND2; + data[size + 3]= MAGICEND3; + irem->filename= (char *) filename; + irem->linenum= lineno; + irem->datasize= size; + irem->prev= NULL; + + /* Add this remember structure to the linked list */ + pthread_mutex_lock(&THR_LOCK_malloc); + if ((irem->next= sf_malloc_root)) + sf_malloc_root->prev= irem; + sf_malloc_root= irem; + + /* Keep the statistics */ + sf_malloc_cur_memory+= size; + if (sf_malloc_cur_memory > sf_malloc_max_memory) + sf_malloc_max_memory= sf_malloc_cur_memory; + sf_malloc_count++; + pthread_mutex_unlock(&THR_LOCK_malloc); + + /* Set the memory to the aribtrary wierd value */ + if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick) + bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL)); + /* Return a pointer to the real data */ + DBUG_PRINT("exit",("ptr: %p", data)); + if (sf_min_adress > data) + sf_min_adress= data; + if (sf_max_adress < data) + sf_max_adress= data; + DBUG_RETURN((void*) data); +} + + +/* + Allocate some new memory and move old memoryblock there. + Free then old memoryblock +*/ + +void *_myrealloc(register void *ptr, register size_t size, + const char *filename, uint lineno, myf MyFlags) +{ + struct st_irem *irem; + char *data; + DBUG_ENTER("_myrealloc"); + + if (!ptr && (MyFlags & MY_ALLOW_ZERO_PTR)) + DBUG_RETURN(_mymalloc(size, filename, lineno, MyFlags)); + + if (!sf_malloc_quick) + (void) _sanity (filename, lineno); + + if (check_ptr("Reallocating", (uchar*) ptr, filename, lineno)) + DBUG_RETURN((uchar*) NULL); + + irem= (struct st_irem *) (((char*) ptr) - ALIGN_SIZE(sizeof(struct st_irem))- + sf_malloc_prehunc); + if (*((uint32*) (((char*) ptr)- sizeof(uint32))) != MAGICKEY) + { + fprintf(stderr, "Error: Reallocating unallocated data at line %d, '%s'\n", + lineno, filename); + DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'", + lineno, filename)); + (void) fflush(stderr); + DBUG_RETURN((uchar*) NULL); + } + + if ((data= _mymalloc(size,filename,lineno,MyFlags))) /* Allocate new area */ + { + size=min(size, irem->datasize); /* Move as much as possibly */ + memcpy((uchar*) data, ptr, (size_t) size); /* Copy old data */ + _myfree(ptr, filename, lineno, 0); /* Free not needed area */ + } + else + { + if (MyFlags & MY_HOLD_ON_ERROR) + DBUG_RETURN(ptr); + if (MyFlags & MY_FREE_ON_ERROR) + _myfree(ptr, filename, lineno, 0); + } + DBUG_RETURN(data); +} /* _myrealloc */ + + +/* Deallocate some memory. */ + +void _myfree(void *ptr, const char *filename, uint lineno, myf myflags) +{ + struct st_irem *irem; + DBUG_ENTER("_myfree"); + DBUG_PRINT("enter",("ptr: %p", ptr)); + + if (!sf_malloc_quick) + (void) _sanity (filename, lineno); + + if ((!ptr && (myflags & MY_ALLOW_ZERO_PTR)) || + check_ptr("Freeing",(uchar*) ptr,filename,lineno)) + DBUG_VOID_RETURN; + + /* Calculate the address of the remember structure */ + irem= (struct st_irem *) ((char*) ptr- ALIGN_SIZE(sizeof(struct st_irem))- + sf_malloc_prehunc); + + /* + Check to make sure that we have a real remember structure. + Note: this test could fail for four reasons: + (1) The memory was already free'ed + (2) The memory was never new'ed + (3) There was an underrun + (4) A stray pointer hit this location + */ + + if (*((uint32*) ((char*) ptr- sizeof(uint32))) != MAGICKEY) + { + fprintf(stderr, "Error: Freeing unallocated data at line %d, '%s'\n", + lineno, filename); + DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",lineno,filename)); + (void) fflush(stderr); + DBUG_VOID_RETURN; + } + + /* Remove this structure from the linked list */ + pthread_mutex_lock(&THR_LOCK_malloc); + if (irem->prev) + irem->prev->next= irem->next; + else + sf_malloc_root= irem->next; + + if (irem->next) + irem->next->prev= irem->prev; + /* Handle the statistics */ + sf_malloc_cur_memory-= irem->datasize; + sf_malloc_count--; + pthread_mutex_unlock(&THR_LOCK_malloc); + +#ifndef HAVE_purify + /* Mark this data as free'ed */ + if (!sf_malloc_quick) + bfill(ptr, irem->datasize, (pchar) FREE_VAL); +#endif + *((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY; + /* Actually free the memory */ + free((char*) irem); + DBUG_VOID_RETURN; +} + + /* Check if we have a wrong pointer */ + +static int check_ptr(const char *where, uchar *ptr, const char *filename, + uint lineno) +{ + if (!ptr) + { + fprintf(stderr, "Error: %s NULL pointer at line %d, '%s'\n", + where,lineno, filename); + DBUG_PRINT("safe",("Null pointer at line %d '%s'", lineno, filename)); + (void) fflush(stderr); + return 1; + } +#ifndef _MSC_VER + if ((long) ptr & (ALIGN_SIZE(1)-1)) + { + fprintf(stderr, "Error: %s wrong aligned pointer at line %d, '%s'\n", + where,lineno, filename); + DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'", + lineno,filename)); + (void) fflush(stderr); + return 1; + } +#endif + if (ptr < sf_min_adress || ptr > sf_max_adress) + { + fprintf(stderr, "Error: %s pointer out of range at line %d, '%s'\n", + where,lineno, filename); + DBUG_PRINT("safe",("Pointer out of range at line %d '%s'", + lineno,filename)); + (void) fflush(stderr); + return 1; + } + return 0; +} + + +/* + Report on all the memory pieces that have not been free'ed + + SYNOPSIS + TERMINATE() + file Write output to this file + flag If <> 0, also write statistics + */ + +void TERMINATE(FILE *file, uint flag) +{ + struct st_irem *irem; + DBUG_ENTER("TERMINATE"); + pthread_mutex_lock(&THR_LOCK_malloc); + + /* + Report the difference between number of calls to + NEW and the number of calls to FREE. >0 means more + NEWs than FREEs. <0, etc. + */ + + if (sf_malloc_count) + { + if (file) + { + fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count); + (void) fflush(file); + } + DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count)); + } + + /* + Report on all the memory that was allocated with NEW + but not free'ed with FREE. + */ + + if ((irem= sf_malloc_root)) + { + if (file) + { + fprintf(file, "Warning: Memory that was not free'ed (%lu bytes):\n", + (ulong) sf_malloc_cur_memory); + (void) fflush(file); + } + DBUG_PRINT("safe",("Memory that was not free'ed (%lu bytes):", + (ulong) sf_malloc_cur_memory)); + while (irem) + { + char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + + sf_malloc_prehunc); + if (file) + { + fprintf(file, + "\t%6lu bytes at %p, allocated at line %4u in '%s'", + (ulong) irem->datasize, data, irem->linenum, irem->filename); + fprintf(file, "\n"); + (void) fflush(file); + } + DBUG_PRINT("safe", + ("%6lu bytes at %p, allocated at line %4d in '%s'", + (ulong) irem->datasize, + data, irem->linenum, irem->filename)); + irem= irem->next; + } + } + /* Report the memory usage statistics */ + if (file && flag) + { + fprintf(file, "Maximum memory usage: %lu bytes (%luk)\n", + (ulong) sf_malloc_max_memory, + (ulong) (sf_malloc_max_memory + 1023L) / 1024L); + (void) fflush(file); + } + DBUG_PRINT("safe",("Maximum memory usage: %lu bytes (%luk)", + (ulong) sf_malloc_max_memory, + (ulong) (sf_malloc_max_memory + 1023L) /1024L)); + pthread_mutex_unlock(&THR_LOCK_malloc); + DBUG_VOID_RETURN; +} + + +/* + Report where a piece of memory was allocated + + This is usefull to call from withing a debugger +*/ + + +void sf_malloc_report_allocated(void *memory) +{ + struct st_irem *irem; + for (irem= sf_malloc_root ; irem ; irem=irem->next) + { + char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + + sf_malloc_prehunc); + if (data <= (char*) memory && (char*) memory <= data + irem->datasize) + { + printf("%lu bytes at %p, allocated at line %u in '%s'\n", + (ulong) irem->datasize, data, irem->linenum, irem->filename); + break; + } + } +} + + /* Returns 0 if chunk is ok */ + +static int _checkchunk(register struct st_irem *irem, const char *filename, + uint lineno) +{ + int flag=0; + char *magicp, *data; + + data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) + + sf_malloc_prehunc); + /* Check for a possible underrun */ + if (*((uint32*) (data- sizeof(uint32))) != MAGICKEY) + { + fprintf(stderr, "Error: Memory allocated at %s:%d was underrun,", + irem->filename, irem->linenum); + fprintf(stderr, " discovered at %s:%d\n", filename, lineno); + (void) fflush(stderr); + DBUG_PRINT("safe",("Underrun at %p, allocated at %s:%d", + data, irem->filename, irem->linenum)); + flag=1; + } + + /* Check for a possible overrun */ + magicp= data + irem->datasize; + if (*magicp++ != MAGICEND0 || + *magicp++ != MAGICEND1 || + *magicp++ != MAGICEND2 || + *magicp++ != MAGICEND3) + { + fprintf(stderr, "Error: Memory allocated at %s:%d was overrun,", + irem->filename, irem->linenum); + fprintf(stderr, " discovered at '%s:%d'\n", filename, lineno); + (void) fflush(stderr); + DBUG_PRINT("safe",("Overrun at %p, allocated at %s:%d", + data, irem->filename, irem->linenum)); + flag=1; + } + return(flag); +} + + + /* Returns how many wrong chunks */ + +int _sanity(const char *filename, uint lineno) +{ + reg1 struct st_irem *irem; + reg2 int flag=0; + uint count=0; + + pthread_mutex_lock(&THR_LOCK_malloc); +#ifndef PEDANTIC_SAFEMALLOC + if (sf_malloc_tampered && (int) sf_malloc_count < 0) + sf_malloc_count=0; +#endif + count=sf_malloc_count; + for (irem= sf_malloc_root; irem != NULL && count-- ; irem= irem->next) + flag+= _checkchunk (irem, filename, lineno); + pthread_mutex_unlock(&THR_LOCK_malloc); + if (count || irem) + { + const char *format="Error: Safemalloc link list destroyed, discovered at '%s:%d'"; + fprintf(stderr, format, filename, lineno); fputc('\n',stderr); + fprintf(stderr, "root=%p,count=%d,irem=%p\n", sf_malloc_root,count,irem); + (void) fflush(stderr); + DBUG_PRINT("safe",(format, filename, lineno)); + flag=1; + } + return flag; +} /* _sanity */ + + + /* malloc and copy */ + +void *_my_memdup(const void *from, size_t length, const char *filename, + uint lineno, myf MyFlags) +{ + void *ptr; + if ((ptr= _mymalloc(length,filename,lineno,MyFlags)) != 0) + memcpy(ptr, from, length); + return(ptr); +} /*_my_memdup */ + + +char *_my_strdup(const char *from, const char *filename, uint lineno, + myf MyFlags) +{ + char *ptr; + size_t length= strlen(from)+1; + if ((ptr= (char*) _mymalloc(length,filename,lineno,MyFlags)) != 0) + memcpy((uchar*) ptr, (uchar*) from, (size_t) length); + return(ptr); +} /* _my_strdup */ + + +char *_my_strndup(const char *from, size_t length, + const char *filename, uint lineno, + myf MyFlags) +{ + char *ptr; + if ((ptr= (char*) _mymalloc(length+1,filename,lineno,MyFlags)) != 0) + { + memcpy((uchar*) ptr, (uchar*) from, (size_t) length); + ptr[length]=0; + } + return(ptr); +} diff --git a/externals/mysql/mysys/sha1.c b/externals/mysql/mysys/sha1.c new file mode 100644 index 0000000..3469e48 --- /dev/null +++ b/externals/mysql/mysys/sha1.c @@ -0,0 +1,391 @@ +/* Copyright (C) 2002, 2004, 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Original Source from: http://www.faqs.org/rfcs/rfc3174.html + + DESCRIPTION + This file implements the Secure Hashing Algorithm 1 as + defined in FIPS PUB 180-1 published April 17, 1995. + + The SHA-1, produces a 160-bit message digest for a given data + stream. It should take about 2**n steps to find a message with the + same digest as a given message and 2**(n/2) to find any two + messages with the same digest, when n is the digest size in bits. + Therefore, this algorithm can serve as a means of providing a + "fingerprint" for a message. + + PORTABILITY ISSUES + SHA-1 is defined in terms of 32-bit "words". This code uses + (included via "sha1.h" to define 32 and 8 bit unsigned + integer types. If your C compiler does not support 32 bit unsigned + integers, this code is not appropriate. + + CAVEATS + SHA-1 is designed to work with messages less than 2^64 bits long. + Although SHA-1 allows a message digest to be generated for messages + of any number of bits less than 2^64, this implementation only + works with messages with a length that is a multiple of the size of + an 8-bit character. + + CHANGES + 2002 by Peter Zaitsev to + - fit to new prototypes according to MySQL standard + - Some optimizations + - All checking is now done in debug only mode + - More comments +*/ + +#include "my_global.h" +#include "m_string.h" +#include "sha1.h" + +/* + Define the SHA1 circular left shift macro +*/ + +#define SHA1CircularShift(bits,word) \ + (((word) << (bits)) | ((word) >> (32-(bits)))) + +/* Local Function Prototyptes */ +static void SHA1PadMessage(SHA1_CONTEXT*); +static void SHA1ProcessMessageBlock(SHA1_CONTEXT*); + + +/* + Initialize SHA1Context + + SYNOPSIS + mysql_sha1_reset() + context [in/out] The context to reset. + + DESCRIPTION + This function will initialize the SHA1Context in preparation + for computing a new SHA1 message digest. + + RETURN + SHA_SUCCESS ok + != SHA_SUCCESS sha Error Code. +*/ + + +const uint32 sha_const_key[5]= +{ + 0x67452301, + 0xEFCDAB89, + 0x98BADCFE, + 0x10325476, + 0xC3D2E1F0 +}; + + +int mysql_sha1_reset(SHA1_CONTEXT *context) +{ +#ifndef DBUG_OFF + if (!context) + return SHA_NULL; +#endif + + context->Length = 0; + context->Message_Block_Index = 0; + + context->Intermediate_Hash[0] = sha_const_key[0]; + context->Intermediate_Hash[1] = sha_const_key[1]; + context->Intermediate_Hash[2] = sha_const_key[2]; + context->Intermediate_Hash[3] = sha_const_key[3]; + context->Intermediate_Hash[4] = sha_const_key[4]; + + context->Computed = 0; + context->Corrupted = 0; + + return SHA_SUCCESS; +} + + +/* + Return the 160-bit message digest into the array provided by the caller + + SYNOPSIS + mysql_sha1_result() + context [in/out] The context to use to calculate the SHA-1 hash. + Message_Digest: [out] Where the digest is returned. + + DESCRIPTION + NOTE: The first octet of hash is stored in the 0th element, + the last octet of hash in the 19th element. + + RETURN + SHA_SUCCESS ok + != SHA_SUCCESS sha Error Code. +*/ + +int mysql_sha1_result(SHA1_CONTEXT *context, + uint8 Message_Digest[SHA1_HASH_SIZE]) +{ + int i; + +#ifndef DBUG_OFF + if (!context || !Message_Digest) + return SHA_NULL; + + if (context->Corrupted) + return context->Corrupted; +#endif + + if (!context->Computed) + { + SHA1PadMessage(context); + /* message may be sensitive, clear it out */ + bzero((char*) context->Message_Block,64); + context->Length = 0; /* and clear length */ + context->Computed = 1; + } + + for (i = 0; i < SHA1_HASH_SIZE; i++) + Message_Digest[i] = (int8)((context->Intermediate_Hash[i>>2] >> 8 + * ( 3 - ( i & 0x03 ) ))); + return SHA_SUCCESS; +} + + +/* + Accepts an array of octets as the next portion of the message. + + SYNOPSIS + mysql_sha1_input() + context [in/out] The SHA context to update + message_array An array of characters representing the next portion + of the message. + length The length of the message in message_array + + RETURN + SHA_SUCCESS ok + != SHA_SUCCESS sha Error Code. +*/ + +int mysql_sha1_input(SHA1_CONTEXT *context, const uint8 *message_array, + unsigned length) +{ + if (!length) + return SHA_SUCCESS; + +#ifndef DBUG_OFF + /* We assume client konows what it is doing in non-debug mode */ + if (!context || !message_array) + return SHA_NULL; + if (context->Computed) + return (context->Corrupted= SHA_STATE_ERROR); + if (context->Corrupted) + return context->Corrupted; +#endif + + while (length--) + { + context->Message_Block[context->Message_Block_Index++]= + (*message_array & 0xFF); + context->Length += 8; /* Length is in bits */ + +#ifndef DBUG_OFF + /* + Then we're not debugging we assume we never will get message longer + 2^64 bits. + */ + if (context->Length == 0) + return (context->Corrupted= 1); /* Message is too long */ +#endif + + if (context->Message_Block_Index == 64) + { + SHA1ProcessMessageBlock(context); + } + message_array++; + } + return SHA_SUCCESS; +} + + +/* + Process the next 512 bits of the message stored in the Message_Block array. + + SYNOPSIS + SHA1ProcessMessageBlock() + + DESCRIPTION + Many of the variable names in this code, especially the single + character names, were used because those were the names used in + the publication. +*/ + +/* Constants defined in SHA-1 */ +static const uint32 K[]= +{ + 0x5A827999, + 0x6ED9EBA1, + 0x8F1BBCDC, + 0xCA62C1D6 +}; + + +static void SHA1ProcessMessageBlock(SHA1_CONTEXT *context) +{ + int t; /* Loop counter */ + uint32 temp; /* Temporary word value */ + uint32 W[80]; /* Word sequence */ + uint32 A, B, C, D, E; /* Word buffers */ + int idx; + + /* + Initialize the first 16 words in the array W + */ + + for (t = 0; t < 16; t++) + { + idx=t*4; + W[t] = context->Message_Block[idx] << 24; + W[t] |= context->Message_Block[idx + 1] << 16; + W[t] |= context->Message_Block[idx + 2] << 8; + W[t] |= context->Message_Block[idx + 3]; + } + + + for (t = 16; t < 80; t++) + { + W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); + } + + A = context->Intermediate_Hash[0]; + B = context->Intermediate_Hash[1]; + C = context->Intermediate_Hash[2]; + D = context->Intermediate_Hash[3]; + E = context->Intermediate_Hash[4]; + + for (t = 0; t < 20; t++) + { + temp= SHA1CircularShift(5,A) + ((B & C) | ((~B) & D)) + E + W[t] + K[0]; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for (t = 20; t < 40; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for (t = 40; t < 60; t++) + { + temp= (SHA1CircularShift(5,A) + ((B & C) | (B & D) | (C & D)) + E + W[t] + + K[2]); + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for (t = 60; t < 80; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + context->Intermediate_Hash[0] += A; + context->Intermediate_Hash[1] += B; + context->Intermediate_Hash[2] += C; + context->Intermediate_Hash[3] += D; + context->Intermediate_Hash[4] += E; + + context->Message_Block_Index = 0; +} + + +/* + Pad message + + SYNOPSIS + SHA1PadMessage() + context: [in/out] The context to pad + + DESCRIPTION + According to the standard, the message must be padded to an even + 512 bits. The first padding bit must be a '1'. The last 64 bits + represent the length of the original message. All bits in between + should be 0. This function will pad the message according to + those rules by filling the Message_Block array accordingly. It + will also call the ProcessMessageBlock function provided + appropriately. When it returns, it can be assumed that the message + digest has been computed. + +*/ + +static void SHA1PadMessage(SHA1_CONTEXT *context) +{ + /* + Check to see if the current message block is too small to hold + the initial padding bits and length. If so, we will pad the + block, process it, and then continue padding into a second + block. + */ + + int i=context->Message_Block_Index; + + if (i > 55) + { + context->Message_Block[i++] = 0x80; + bzero((char*) &context->Message_Block[i], + sizeof(context->Message_Block[0])*(64-i)); + context->Message_Block_Index=64; + + /* This function sets context->Message_Block_Index to zero */ + SHA1ProcessMessageBlock(context); + + bzero((char*) &context->Message_Block[0], + sizeof(context->Message_Block[0])*56); + context->Message_Block_Index=56; + } + else + { + context->Message_Block[i++] = 0x80; + bzero((char*) &context->Message_Block[i], + sizeof(context->Message_Block[0])*(56-i)); + context->Message_Block_Index=56; + } + + /* + Store the message length as the last 8 octets + */ + + context->Message_Block[56] = (int8) (context->Length >> 56); + context->Message_Block[57] = (int8) (context->Length >> 48); + context->Message_Block[58] = (int8) (context->Length >> 40); + context->Message_Block[59] = (int8) (context->Length >> 32); + context->Message_Block[60] = (int8) (context->Length >> 24); + context->Message_Block[61] = (int8) (context->Length >> 16); + context->Message_Block[62] = (int8) (context->Length >> 8); + context->Message_Block[63] = (int8) (context->Length); + + SHA1ProcessMessageBlock(context); +} diff --git a/externals/mysql/mysys/stacktrace.c b/externals/mysql/mysys/stacktrace.c new file mode 100644 index 0000000..fc7d6e4 --- /dev/null +++ b/externals/mysql/mysys/stacktrace.c @@ -0,0 +1,651 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include + +#ifndef __WIN__ +#include +#include +#include +#ifdef HAVE_STACKTRACE +#include +#include + +#if HAVE_EXECINFO_H +#include +#endif + +#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) + +static char *heap_start; + +#ifdef HAVE_BSS_START +extern char *__bss_start; +#endif + +void my_init_stacktrace() +{ +#ifdef HAVE_BSS_START + heap_start = (char*) &__bss_start; +#endif +} + +void my_safe_print_str(const char* name, const char* val, int max_len) +{ + char *heap_end= (char*) sbrk(0); + fprintf(stderr, "%s at %p ", name, val); + + if (!PTR_SANE(val)) + { + fprintf(stderr, "is an invalid pointer\n"); + return; + } + + fprintf(stderr, "= "); + for (; max_len && PTR_SANE(val) && *val; --max_len) + fputc(*val++, stderr); + fputc('\n', stderr); +} + +#if HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD) + +#if BACKTRACE_DEMANGLE + +char __attribute__ ((weak)) +*my_demangle(const char *mangled_name __attribute__((unused)), + int *status __attribute__((unused))) +{ + return NULL; +} + +static void my_demangle_symbols(char **addrs, int n) +{ + int status, i; + char *begin, *end, *demangled; + + for (i= 0; i < n; i++) + { + demangled= NULL; + begin= strchr(addrs[i], '('); + end= begin ? strchr(begin, '+') : NULL; + + if (begin && end) + { + *begin++= *end++= '\0'; + demangled= my_demangle(begin, &status); + if (!demangled || status) + { + demangled= NULL; + begin[-1]= '('; + end[-1]= '+'; + } + } + + if (demangled) + fprintf(stderr, "%s(%s+%s\n", addrs[i], demangled, end); + else + fprintf(stderr, "%s\n", addrs[i]); + } +} + +#endif /* BACKTRACE_DEMANGLE */ + +void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack) +{ + void *addrs[128]; + char **strings= NULL; + int n = backtrace(addrs, array_elements(addrs)); + fprintf(stderr, "stack_bottom = %p thread_stack 0x%lx\n", + stack_bottom, thread_stack); +#if BACKTRACE_DEMANGLE + if ((strings= backtrace_symbols(addrs, n))) + { + my_demangle_symbols(strings, n); + free(strings); + } +#endif +#if HAVE_BACKTRACE_SYMBOLS_FD + if (!strings) + { + backtrace_symbols_fd(addrs, n, fileno(stderr)); + } +#endif +} + +#elif defined(TARGET_OS_LINUX) + +#ifdef __i386__ +#define SIGRETURN_FRAME_OFFSET 17 +#endif + +#ifdef __x86_64__ +#define SIGRETURN_FRAME_OFFSET 23 +#endif + +#if defined(__alpha__) && defined(__GNUC__) +/* + The only way to backtrace without a symbol table on alpha + is to find stq fp,N(sp), and the first byte + of the instruction opcode will give us the value of N. From this + we can find where the old value of fp is stored +*/ + +#define MAX_INSTR_IN_FUNC 10000 + +inline uchar** find_prev_fp(uint32* pc, uchar** fp) +{ + int i; + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + { + uchar* p = (uchar*)pc; + if (p[2] == 222 && p[3] == 35) + { + return (uchar**)((uchar*)fp - *(short int*)p); + } + } + return 0; +} + +inline uint32* find_prev_pc(uint32* pc, uchar** fp) +{ + int i; + for (i = 0; i < MAX_INSTR_IN_FUNC; ++i,--pc) + { + char* p = (char*)pc; + if (p[1] == 0 && p[2] == 94 && p[3] == -73) + { + uint32* prev_pc = (uint32*)*((fp+p[0]/sizeof(fp))); + return prev_pc; + } + } + return 0; +} +#endif /* defined(__alpha__) && defined(__GNUC__) */ + +void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack) +{ + uchar** fp; + uint frame_count = 0, sigreturn_frame_count; +#if defined(__alpha__) && defined(__GNUC__) + uint32* pc; +#endif + LINT_INIT(fp); + + +#ifdef __i386__ + __asm __volatile__ ("movl %%ebp,%0" + :"=r"(fp) + :"r"(fp)); +#endif +#ifdef __x86_64__ + __asm __volatile__ ("movq %%rbp,%0" + :"=r"(fp) + :"r"(fp)); +#endif +#if defined(__alpha__) && defined(__GNUC__) + __asm __volatile__ ("mov $30,%0" + :"=r"(fp) + :"r"(fp)); +#endif + if (!fp) + { + fprintf(stderr, "frame pointer is NULL, did you compile with\n\ +-fomit-frame-pointer? Aborting backtrace!\n"); + return; + } + + if (!stack_bottom || (uchar*) stack_bottom > (uchar*) &fp) + { + ulong tmp= min(0x10000,thread_stack); + /* Assume that the stack starts at the previous even 65K */ + stack_bottom= (uchar*) (((ulong) &fp + tmp) & + ~(ulong) 0xFFFF); + fprintf(stderr, "Cannot determine thread, fp=%p, backtrace may not be correct.\n", fp); + } + if (fp > (uchar**) stack_bottom || + fp < (uchar**) stack_bottom - thread_stack) + { + fprintf(stderr, "Bogus stack limit or frame pointer,\ + fp=%p, stack_bottom=%p, thread_stack=%ld, aborting backtrace.\n", + fp, stack_bottom, thread_stack); + return; + } + + fprintf(stderr, "Stack range sanity check OK, backtrace follows:\n"); +#if defined(__alpha__) && defined(__GNUC__) + fprintf(stderr, "Warning: Alpha stacks are difficult -\ + will be taking some wild guesses, stack trace may be incorrect or \ + terminate abruptly\n"); + /* On Alpha, we need to get pc */ + __asm __volatile__ ("bsr %0, do_next; do_next: " + :"=r"(pc) + :"r"(pc)); +#endif /* __alpha__ */ + + /* We are 1 frame above signal frame with NPTL and 2 frames above with LT */ + sigreturn_frame_count = thd_lib_detected == THD_LIB_LT ? 2 : 1; + + while (fp < (uchar**) stack_bottom) + { +#if defined(__i386__) || defined(__x86_64__) + uchar** new_fp = (uchar**)*fp; + fprintf(stderr, "%p\n", frame_count == sigreturn_frame_count ? + *(fp + SIGRETURN_FRAME_OFFSET) : *(fp + 1)); +#endif /* defined(__386__) || defined(__x86_64__) */ + +#if defined(__alpha__) && defined(__GNUC__) + uchar** new_fp = find_prev_fp(pc, fp); + if (frame_count == sigreturn_frame_count - 1) + { + new_fp += 90; + } + + if (fp && pc) + { + pc = find_prev_pc(pc, fp); + if (pc) + fprintf(stderr, "%p\n", pc); + else + { + fprintf(stderr, "Not smart enough to deal with the rest\ + of this stack\n"); + goto end; + } + } + else + { + fprintf(stderr, "Not smart enough to deal with the rest of this stack\n"); + goto end; + } +#endif /* defined(__alpha__) && defined(__GNUC__) */ + if (new_fp <= fp ) + { + fprintf(stderr, "New value of fp=%p failed sanity check,\ + terminating stack trace!\n", new_fp); + goto end; + } + fp = new_fp; + ++frame_count; + } + + fprintf(stderr, "Stack trace seems successful - bottom reached\n"); + +end: + fprintf(stderr, + "Please read http://dev.mysql.com/doc/refman/5.1/en/resolve-stack-dump.html\n" + "and follow instructions on how to resolve the stack trace.\n" + "Resolved stack trace is much more helpful in diagnosing the\n" + "problem, so please do resolve it\n"); +} +#endif /* TARGET_OS_LINUX */ +#endif /* HAVE_STACKTRACE */ + +/* Produce a core for the thread */ +void my_write_core(int sig) +{ + signal(sig, SIG_DFL); +#ifdef HAVE_gcov + /* + For GCOV build, crashing will prevent the writing of code coverage + information from this process, causing gcov output to be incomplete. + So we force the writing of coverage information here before terminating. + */ + extern void __gcov_flush(void); + __gcov_flush(); +#endif + pthread_kill(pthread_self(), sig); +#if defined(P_MYID) && !defined(SCO) + /* On Solaris, the above kill is not enough */ + sigsend(P_PID,P_MYID,sig); +#endif +} + +#else /* __WIN__*/ + +#include +#include + +/* + Stack tracing on Windows is implemented using Debug Helper library(dbghelp.dll) + We do not redistribute dbghelp and the one comes with older OS (up to Windows 2000) + is missing some important functions like functions StackWalk64 or MinidumpWriteDump. + Hence, we have to load functions at runtime using LoadLibrary/GetProcAddress. +*/ + +typedef DWORD (WINAPI *SymSetOptions_FctType)(DWORD dwOptions); +typedef BOOL (WINAPI *SymGetModuleInfo64_FctType) + (HANDLE,DWORD64,PIMAGEHLP_MODULE64) ; +typedef BOOL (WINAPI *SymGetSymFromAddr64_FctType) + (HANDLE,DWORD64,PDWORD64,PIMAGEHLP_SYMBOL64) ; +typedef BOOL (WINAPI *SymGetLineFromAddr64_FctType) + (HANDLE,DWORD64,PDWORD,PIMAGEHLP_LINE64); +typedef BOOL (WINAPI *SymInitialize_FctType) + (HANDLE,PSTR,BOOL); +typedef BOOL (WINAPI *StackWalk64_FctType) + (DWORD,HANDLE,HANDLE,LPSTACKFRAME64,PVOID,PREAD_PROCESS_MEMORY_ROUTINE64, + PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64 , + PTRANSLATE_ADDRESS_ROUTINE64); +typedef BOOL (WINAPI *MiniDumpWriteDump_FctType)( + IN HANDLE hProcess, + IN DWORD ProcessId, + IN HANDLE hFile, + IN MINIDUMP_TYPE DumpType, + IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL + IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL + IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL + ); + +static SymSetOptions_FctType pSymSetOptions; +static SymGetModuleInfo64_FctType pSymGetModuleInfo64; +static SymGetSymFromAddr64_FctType pSymGetSymFromAddr64; +static SymInitialize_FctType pSymInitialize; +static StackWalk64_FctType pStackWalk64; +static SymGetLineFromAddr64_FctType pSymGetLineFromAddr64; +static MiniDumpWriteDump_FctType pMiniDumpWriteDump; + +static EXCEPTION_POINTERS *exception_ptrs; + +#define MODULE64_SIZE_WINXP 576 +#define STACKWALK_MAX_FRAMES 64 + +void my_init_stacktrace() +{ +} + +/* + Dynamically load dbghelp functions +*/ +BOOL init_dbghelp_functions() +{ + static BOOL first_time= TRUE; + static BOOL rc; + HMODULE hDbghlp; + + if(first_time) + { + first_time= FALSE; + hDbghlp= LoadLibrary("dbghelp"); + if(!hDbghlp) + { + rc= FALSE; + return rc; + } + pSymSetOptions= (SymSetOptions_FctType) + GetProcAddress(hDbghlp,"SymSetOptions"); + pSymInitialize= (SymInitialize_FctType) + GetProcAddress(hDbghlp,"SymInitialize"); + pSymGetModuleInfo64= (SymGetModuleInfo64_FctType) + GetProcAddress(hDbghlp,"SymGetModuleInfo64"); + pSymGetLineFromAddr64= (SymGetLineFromAddr64_FctType) + GetProcAddress(hDbghlp,"SymGetLineFromAddr64"); + pSymGetSymFromAddr64=(SymGetSymFromAddr64_FctType) + GetProcAddress(hDbghlp,"SymGetSymFromAddr64"); + pStackWalk64= (StackWalk64_FctType) + GetProcAddress(hDbghlp,"StackWalk64"); + pMiniDumpWriteDump = (MiniDumpWriteDump_FctType) + GetProcAddress(hDbghlp,"MiniDumpWriteDump"); + + rc = (BOOL)(pSymSetOptions && pSymInitialize && pSymGetModuleInfo64 + && pSymGetLineFromAddr64 && pSymGetSymFromAddr64 && pStackWalk64); + } + return rc; +} + +void my_set_exception_pointers(EXCEPTION_POINTERS *ep) +{ + exception_ptrs = ep; +} + + +/* + Get symbol path - semicolon-separated list of directories to search for debug + symbols. We expect PDB in the same directory as corresponding exe or dll, + so the path is build from directories of the loaded modules. If environment + variable _NT_SYMBOL_PATH is set, it's value appended to the symbol search path +*/ +static void get_symbol_path(char *path, size_t size) +{ + HANDLE hSnap; + char *envvar; + + path[0]= '\0'; + /* + Enumerate all modules, and add their directories to the path. + Avoid duplicate entries. + */ + hSnap= CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId()); + if (hSnap != INVALID_HANDLE_VALUE) + { + BOOL ret; + MODULEENTRY32 mod; + mod.dwSize= sizeof(MODULEENTRY32); + for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap, &mod)) + { + char *module_dir= mod.szExePath; + char *p= strrchr(module_dir,'\\'); + if (!p) + { + /* + Path separator was not found. Not known to happen, if ever happens, + will indicate current directory. + */ + module_dir[0]= '.'; + p= module_dir + 1; + } + *p++= ';'; + *p= '\0'; + + if (!strstr(path, module_dir)) + { + size_t dir_len = strlen(module_dir); + if (size > dir_len) + { + strncat(path, module_dir, size-1); + size -= dir_len; + } + } + } + CloseHandle(hSnap); + } + + /* Add _NT_SYMBOL_PATH, if present. */ + envvar= getenv("_NT_SYMBOL_PATH"); + if(envvar && size) + { + strncat(path, envvar, size-1); + } +} + +#define MAX_SYMBOL_PATH 32768 + +/* Platform SDK in VS2003 does not have definition for SYMOPT_NO_PROMPTS*/ +#ifndef SYMOPT_NO_PROMPTS +#define SYMOPT_NO_PROMPTS 0 +#endif + +void my_print_stacktrace(uchar* unused1, ulong unused2) +{ + HANDLE hProcess= GetCurrentProcess(); + HANDLE hThread= GetCurrentThread(); + static IMAGEHLP_MODULE64 module= {sizeof(module)}; + static IMAGEHLP_SYMBOL64_PACKAGE package; + DWORD64 addr; + DWORD machine; + int i; + CONTEXT context; + STACKFRAME64 frame={0}; + static char symbol_path[MAX_SYMBOL_PATH]; + + if(!exception_ptrs || !init_dbghelp_functions()) + return; + + /* Copy context, as stackwalking on original will unwind the stack */ + context = *(exception_ptrs->ContextRecord); + /*Initialize symbols.*/ + pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG); + get_symbol_path(symbol_path, sizeof(symbol_path)); + pSymInitialize(hProcess, symbol_path, TRUE); + + /*Prepare stackframe for the first StackWalk64 call*/ + frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat; +#if (defined _M_IX86) + machine= IMAGE_FILE_MACHINE_I386; + frame.AddrFrame.Offset= context.Ebp; + frame.AddrPC.Offset= context.Eip; + frame.AddrStack.Offset= context.Esp; +#elif (defined _M_X64) + machine = IMAGE_FILE_MACHINE_AMD64; + frame.AddrFrame.Offset= context.Rbp; + frame.AddrPC.Offset= context.Rip; + frame.AddrStack.Offset= context.Rsp; +#else + /*There is currently no need to support IA64*/ +#pragma error ("unsupported architecture") +#endif + + package.sym.SizeOfStruct= sizeof(package.sym); + package.sym.MaxNameLength= sizeof(package.name); + + /*Walk the stack, output useful information*/ + for(i= 0; i< STACKWALK_MAX_FRAMES;i++) + { + DWORD64 function_offset= 0; + DWORD line_offset= 0; + IMAGEHLP_LINE64 line= {sizeof(line)}; + BOOL have_module= FALSE; + BOOL have_symbol= FALSE; + BOOL have_source= FALSE; + + if(!pStackWalk64(machine, hProcess, hThread, &frame, &context, 0, 0, 0 ,0)) + break; + addr= frame.AddrPC.Offset; + + have_module= pSymGetModuleInfo64(hProcess,addr,&module); +#ifdef _M_IX86 + if(!have_module) + { + /* + ModuleInfo structure has been "compatibly" extended in releases after XP, + and its size was increased. To make XP dbghelp.dll function + happy, pretend passing the old structure. + */ + module.SizeOfStruct= MODULE64_SIZE_WINXP; + have_module= pSymGetModuleInfo64(hProcess, addr, &module); + } +#endif + + have_symbol= pSymGetSymFromAddr64(hProcess, addr, &function_offset, + &(package.sym)); + have_source= pSymGetLineFromAddr64(hProcess, addr, &line_offset, &line); + + fprintf(stderr, "%p ", addr); + if(have_module) + { + char *base_image_name= strrchr(module.ImageName, '\\'); + if(base_image_name) + base_image_name++; + else + base_image_name= module.ImageName; + fprintf(stderr, "%s!", base_image_name); + } + if(have_symbol) + fprintf(stderr, "%s()", package.sym.Name); + else if(have_module) + fprintf(stderr, "???"); + + if(have_source) + { + char *base_file_name= strrchr(line.FileName, '\\'); + if(base_file_name) + base_file_name++; + else + base_file_name= line.FileName; + fprintf(stderr,"[%s:%u]", base_file_name, line.LineNumber); + } + fprintf(stderr, "\n"); + } + fflush(stderr); +} + + +/* + Write dump. The dump is created in current directory, + file name is constructed from executable name plus + ".dmp" extension +*/ +void my_write_core(int unused) +{ + char path[MAX_PATH]; + char dump_fname[MAX_PATH]= "core.dmp"; + MINIDUMP_EXCEPTION_INFORMATION info; + HANDLE hFile; + + if(!exception_ptrs || !init_dbghelp_functions() || !pMiniDumpWriteDump) + return; + + info.ExceptionPointers= exception_ptrs; + info.ClientPointers= FALSE; + info.ThreadId= GetCurrentThreadId(); + + if(GetModuleFileName(NULL, path, sizeof(path))) + { + _splitpath(path, NULL, NULL,dump_fname,NULL); + strncat(dump_fname, ".dmp", sizeof(dump_fname)); + } + + hFile= CreateFile(dump_fname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, 0); + if(hFile) + { + /* Create minidump */ + MINIDUMP_TYPE dump_type = (MINIDUMP_TYPE) + (MiniDumpWithDataSegs|MiniDumpWithPrivateReadWriteMemory); + + if(pMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), + hFile, dump_type, &info, 0, 0)) + { + fprintf(stderr, "Minidump written to %s\n", + _fullpath(path, dump_fname, sizeof(path)) ? path : dump_fname); + } + else + { + fprintf(stderr,"MiniDumpWriteDump() failed, last error %u\n", + GetLastError()); + } + CloseHandle(hFile); + } + else + { + fprintf(stderr, "CreateFile(%s) failed, last error %u\n", dump_fname, + GetLastError()); + } + fflush(stderr); +} + + +void my_safe_print_str(const char *name, const char *val, int len) +{ + fprintf(stderr,"%s at %p", name, val); + __try + { + fprintf(stderr,"=%.*s\n", len, val); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + fprintf(stderr,"is an invalid string pointer\n"); + } +} +#endif /*__WIN__*/ diff --git a/externals/mysql/mysys/string.c b/externals/mysql/mysys/string.c new file mode 100644 index 0000000..b234a58 --- /dev/null +++ b/externals/mysql/mysys/string.c @@ -0,0 +1,185 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Code for handling strings with can grow dynamicly. + Copyright Monty Program KB. + By monty. +*/ + +#include "mysys_priv.h" +#include + +my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, + size_t init_alloc, size_t alloc_increment) +{ + uint length; + DBUG_ENTER("init_dynamic_string"); + + if (!alloc_increment) + alloc_increment=128; + length=1; + if (init_str && (length= strlen(init_str)+1) < init_alloc) + init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment; + if (!init_alloc) + init_alloc=alloc_increment; + + if (!(str->str=(char*) my_malloc(init_alloc,MYF(MY_WME)))) + DBUG_RETURN(TRUE); + str->length=length-1; + if (init_str) + memcpy(str->str,init_str,length); + str->max_length=init_alloc; + str->alloc_increment=alloc_increment; + DBUG_RETURN(FALSE); +} + + +my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str) +{ + uint length=0; + DBUG_ENTER("dynstr_set"); + + if (init_str && (length= (uint) strlen(init_str)+1) > str->max_length) + { + str->max_length=((length+str->alloc_increment-1)/str->alloc_increment)* + str->alloc_increment; + if (!str->max_length) + str->max_length=str->alloc_increment; + if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME)))) + DBUG_RETURN(TRUE); + } + if (init_str) + { + str->length=length-1; + memcpy(str->str,init_str,length); + } + else + str->length=0; + DBUG_RETURN(FALSE); +} + + +my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size) +{ + DBUG_ENTER("dynstr_realloc"); + + if (!additional_size) DBUG_RETURN(FALSE); + if (str->length + additional_size > str->max_length) + { + str->max_length=((str->length + additional_size+str->alloc_increment-1)/ + str->alloc_increment)*str->alloc_increment; + if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME)))) + DBUG_RETURN(TRUE); + } + DBUG_RETURN(FALSE); +} + + +my_bool dynstr_append(DYNAMIC_STRING *str, const char *append) +{ + return dynstr_append_mem(str,append,(uint) strlen(append)); +} + + +my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, + size_t length) +{ + char *new_ptr; + if (str->length+length >= str->max_length) + { + uint new_length=(str->length+length+str->alloc_increment)/ + str->alloc_increment; + new_length*=str->alloc_increment; + if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME)))) + return TRUE; + str->str=new_ptr; + str->max_length=new_length; + } + memcpy(str->str + str->length,append,length); + str->length+=length; + str->str[str->length]=0; /* Safety for C programs */ + return FALSE; +} + + +my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n) +{ + str->length-=n; + str->str[str->length]= '\0'; + return FALSE; +} + +/* + Concatenates any number of strings, escapes any OS quote in the result then + surround the whole affair in another set of quotes which is finally appended + to specified DYNAMIC_STRING. This function is especially useful when + building strings to be executed with the system() function. + + @param str Dynamic String which will have addtional strings appended. + @param append String to be appended. + @param ... Optional. Additional string(s) to be appended. + + @note The final argument in the list must be NullS even if no additional + options are passed. + + @return True = Success. +*/ + +my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) +{ +#ifdef __WIN__ + const char *quote_str= "\""; + const uint quote_len= 1; +#else + const char *quote_str= "\'"; + const uint quote_len= 1; +#endif /* __WIN__ */ + my_bool ret= TRUE; + va_list dirty_text; + + ret&= dynstr_append_mem(str, quote_str, quote_len); /* Leading quote */ + va_start(dirty_text, append); + while (append != NullS) + { + const char *cur_pos= append; + const char *next_pos= cur_pos; + + /* Search for quote in each string and replace with escaped quote */ + while(*(next_pos= strcend(cur_pos, quote_str[0])) != '\0') + { + ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); + ret&= dynstr_append_mem(str ,"\\", 1); + ret&= dynstr_append_mem(str, quote_str, quote_len); + cur_pos= next_pos + 1; + } + ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); + append= va_arg(dirty_text, char *); + } + va_end(dirty_text); + ret&= dynstr_append_mem(str, quote_str, quote_len); /* Trailing quote */ + + return ret; +} + + +void dynstr_free(DYNAMIC_STRING *str) +{ + if (str->str) + { + my_free(str->str,MYF(MY_WME)); + str->str=0; + } +} diff --git a/externals/mysql/mysys/test_fn.c b/externals/mysql/mysys/test_fn.c new file mode 100644 index 0000000..249cc87 --- /dev/null +++ b/externals/mysql/mysys/test_fn.c @@ -0,0 +1,69 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" + +const char *test_names[]= +{ + "/usr/my/include/srclib/myfunc/dbug/test", + "test", + "dbug/test", + "/usr/my/srclib/myfunc/dbug/test", + "/usr/monty/oldcopy/jazz/setupp.frm", + "~/monty.tst", + "~/dbug/monty.tst", + "./hejsan", + "./dbug/test", + "../dbug/test", + "../myfunc/test", + "../../monty/rutedit", + "/usr/monty//usr/monty/rutedit", + "/usr/./monty/rutedit", + "/usr/my/../monty/rutedit", + "/usr/my/~/rutedit", + "~/../my", + "~/../my/srclib/myfunc/test", + "~/../my/srclib/myfunc/./dbug/test", + "/../usr/my/srclib/dbug", + "c/../my", + "/c/../my", + NullS, +}; + +int main(int argc __attribute__((unused)), char **argv) +{ + const char **pos; + char buff[FN_REFLEN],buff2[FN_REFLEN]; + DBUG_ENTER ("main"); + DBUG_PROCESS (argv[0]); + MY_INIT(argv[0]); + + if (argv[1] && argv[1][1] == '#') + DBUG_PUSH(argv[1]+2); + + for (pos=test_names; *pos ; pos++) + { + printf("org : '%s'\n",*pos); + printf("pack: '%s'\n",fn_format(buff,*pos,"","",8)); + printf("unpack: '%s'\n",fn_format(buff2,*pos,"","",4)); + unpack_filename(buff,buff); + if (strcmp(buff,buff2) != 0) + { + printf("error on cmp: '%s' != '%s'\n",buff,buff2); + } + puts(""); + } + DBUG_RETURN(0); +} diff --git a/externals/mysql/mysys/test_xml.c b/externals/mysql/mysys/test_xml.c new file mode 100644 index 0000000..0cb10e1 --- /dev/null +++ b/externals/mysql/mysys/test_xml.c @@ -0,0 +1,104 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include +#include "my_xml.h" + +static void mstr(char *str,const char *src,uint l1,uint l2) +{ + l1 = l1 + +#if defined(THREAD) && !defined(DONT_USE_THR_ALARM) +#include +#include +#include +#include +#include +#include +#include "thr_alarm.h" + +#ifdef HAVE_SYS_SELECT_H +#include /* AIX needs this for fd_set */ +#endif + +#ifndef ETIME +#define ETIME ETIMEDOUT +#endif + +uint thr_client_alarm; +static int alarm_aborted=1; /* No alarm thread */ +my_bool thr_alarm_inited= 0; +volatile my_bool alarm_thread_running= 0; +time_t next_alarm_expire_time= ~ (time_t) 0; +static sig_handler process_alarm_part2(int sig); + +#if !defined(__WIN__) + +static pthread_mutex_t LOCK_alarm; +static pthread_cond_t COND_alarm; +static sigset_t full_signal_set; +static QUEUE alarm_queue; +static uint max_used_alarms=0; +pthread_t alarm_thread; + +#ifdef USE_ALARM_THREAD +static void *alarm_handler(void *arg); +#define reschedule_alarms() pthread_cond_signal(&COND_alarm) +#else +#define reschedule_alarms() pthread_kill(alarm_thread,THR_SERVER_ALARM) +#endif + +static sig_handler thread_alarm(int sig __attribute__((unused))); + +static int compare_ulong(void *not_used __attribute__((unused)), + uchar *a_ptr,uchar* b_ptr) +{ + ulong a=*((ulong*) a_ptr),b= *((ulong*) b_ptr); + return (a < b) ? -1 : (a == b) ? 0 : 1; +} + +void init_thr_alarm(uint max_alarms) +{ + sigset_t s; + DBUG_ENTER("init_thr_alarm"); + alarm_aborted=0; + next_alarm_expire_time= ~ (time_t) 0; + init_queue(&alarm_queue,max_alarms+1,offsetof(ALARM,expire_time),0, + compare_ulong,NullS); + sigfillset(&full_signal_set); /* Neaded to block signals */ + pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST); + pthread_cond_init(&COND_alarm,NULL); + if (thd_lib_detected == THD_LIB_LT) + thr_client_alarm= SIGALRM; + else + thr_client_alarm= SIGUSR1; +#ifndef USE_ALARM_THREAD + if (thd_lib_detected != THD_LIB_LT) +#endif + { + my_sigset(thr_client_alarm, thread_alarm); + } + sigemptyset(&s); + sigaddset(&s, THR_SERVER_ALARM); + alarm_thread=pthread_self(); +#if defined(USE_ALARM_THREAD) + { + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); + pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&thr_attr,8196); + pthread_create(&alarm_thread,&thr_attr,alarm_handler,NULL); + pthread_attr_destroy(&thr_attr); + } +#elif defined(USE_ONE_SIGNAL_HAND) + pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ + if (thd_lib_detected == THD_LIB_LT) + { + my_sigset(thr_client_alarm, process_alarm); /* Linuxthreads */ + pthread_sigmask(SIG_UNBLOCK, &s, NULL); + } +#else + my_sigset(THR_SERVER_ALARM, process_alarm); + pthread_sigmask(SIG_UNBLOCK, &s, NULL); +#endif + DBUG_VOID_RETURN; +} + + +void resize_thr_alarm(uint max_alarms) +{ + pthread_mutex_lock(&LOCK_alarm); + /* + It's ok not to shrink the queue as there may be more pending alarms than + than max_alarms + */ + if (alarm_queue.elements < max_alarms) + resize_queue(&alarm_queue,max_alarms+1); + pthread_mutex_unlock(&LOCK_alarm); +} + + +/* + Request alarm after sec seconds. + + SYNOPSIS + thr_alarm() + alrm Pointer to alarm detection + alarm_data Structure to store in alarm queue + + NOTES + This function can't be called from the alarm-handling thread. + + RETURN VALUES + 0 ok + 1 If no more alarms are allowed (aborted by process) + + Stores in first argument a pointer to a non-zero int which is set to 0 + when the alarm has been given +*/ + +my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) +{ + time_t now; +#ifndef USE_ONE_SIGNAL_HAND + sigset_t old_mask; +#endif + my_bool reschedule; + struct st_my_thread_var *current_my_thread_var= my_thread_var; + DBUG_ENTER("thr_alarm"); + DBUG_PRINT("enter",("thread: %s sec: %d",my_thread_name(),sec)); + + now= my_time(0); +#ifndef USE_ONE_SIGNAL_HAND + pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask); +#endif + pthread_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */ + if (alarm_aborted > 0) + { /* No signal thread */ + DBUG_PRINT("info", ("alarm aborted")); + *alrm= 0; /* No alarm */ + pthread_mutex_unlock(&LOCK_alarm); +#ifndef USE_ONE_SIGNAL_HAND + pthread_sigmask(SIG_SETMASK,&old_mask,NULL); +#endif + DBUG_RETURN(1); + } + if (alarm_aborted < 0) + sec= 1; /* Abort mode */ + + if (alarm_queue.elements >= max_used_alarms) + { + if (alarm_queue.elements == alarm_queue.max_elements) + { + DBUG_PRINT("info", ("alarm queue full")); + fprintf(stderr,"Warning: thr_alarm queue is full\n"); + *alrm= 0; /* No alarm */ + pthread_mutex_unlock(&LOCK_alarm); +#ifndef USE_ONE_SIGNAL_HAND + pthread_sigmask(SIG_SETMASK,&old_mask,NULL); +#endif + DBUG_RETURN(1); + } + max_used_alarms=alarm_queue.elements+1; + } + reschedule= (ulong) next_alarm_expire_time > (ulong) now + sec; + if (!alarm_data) + { + if (!(alarm_data=(ALARM*) my_malloc(sizeof(ALARM),MYF(MY_WME)))) + { + DBUG_PRINT("info", ("failed my_malloc()")); + *alrm= 0; /* No alarm */ + pthread_mutex_unlock(&LOCK_alarm); +#ifndef USE_ONE_SIGNAL_HAND + pthread_sigmask(SIG_SETMASK,&old_mask,NULL); +#endif + DBUG_RETURN(1); + } + alarm_data->malloced=1; + } + else + alarm_data->malloced=0; + alarm_data->expire_time=now+sec; + alarm_data->alarmed=0; + alarm_data->thread= current_my_thread_var->pthread_self; + alarm_data->thread_id= current_my_thread_var->id; + queue_insert(&alarm_queue,(uchar*) alarm_data); + + /* Reschedule alarm if the current one has more than sec left */ + if (reschedule) + { + DBUG_PRINT("info", ("reschedule")); + if (pthread_equal(pthread_self(),alarm_thread)) + { + alarm(sec); /* purecov: inspected */ + next_alarm_expire_time= now + sec; + } + else + reschedule_alarms(); /* Reschedule alarms */ + } + pthread_mutex_unlock(&LOCK_alarm); +#ifndef USE_ONE_SIGNAL_HAND + pthread_sigmask(SIG_SETMASK,&old_mask,NULL); +#endif + (*alrm)= &alarm_data->alarmed; + DBUG_RETURN(0); +} + + +/* + Remove alarm from list of alarms +*/ + +void thr_end_alarm(thr_alarm_t *alarmed) +{ + ALARM *alarm_data; +#ifndef USE_ONE_SIGNAL_HAND + sigset_t old_mask; +#endif + uint i, found=0; + DBUG_ENTER("thr_end_alarm"); + +#ifndef USE_ONE_SIGNAL_HAND + pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask); +#endif + pthread_mutex_lock(&LOCK_alarm); + + alarm_data= (ALARM*) ((uchar*) *alarmed - offsetof(ALARM,alarmed)); + for (i=0 ; i < alarm_queue.elements ; i++) + { + if ((ALARM*) queue_element(&alarm_queue,i) == alarm_data) + { + queue_remove(&alarm_queue,i),MYF(0); + if (alarm_data->malloced) + my_free((uchar*) alarm_data,MYF(0)); + found++; +#ifdef DBUG_OFF + break; +#endif + } + } + DBUG_ASSERT(!*alarmed || found == 1); + if (!found) + { + if (*alarmed) + fprintf(stderr,"Warning: Didn't find alarm 0x%lx in queue of %d alarms\n", + (long) *alarmed, alarm_queue.elements); + DBUG_PRINT("warning",("Didn't find alarm %p in queue\n", + *alarmed)); + } + pthread_mutex_unlock(&LOCK_alarm); +#ifndef USE_ONE_SIGNAL_HAND + pthread_sigmask(SIG_SETMASK,&old_mask,NULL); +#endif + DBUG_VOID_RETURN; +} + +/* + Come here when some alarm in queue is due. + Mark all alarms with are finnished in list. + Shedule alarms to be sent again after 1-10 sec (many alarms at once) + If alarm_aborted is set then all alarms are given and resent + every second. +*/ + +sig_handler process_alarm(int sig __attribute__((unused))) +{ + sigset_t old_mask; +/* + This must be first as we can't call DBUG inside an alarm for a normal thread +*/ + + if (thd_lib_detected == THD_LIB_LT && + !pthread_equal(pthread_self(),alarm_thread)) + { +#if defined(MAIN) && !defined(__bsdi__) + printf("thread_alarm in process_alarm\n"); fflush(stdout); +#endif +#ifdef DONT_REMEMBER_SIGNAL + my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */ +#endif + return; + } + + /* + We have to do do the handling of the alarm in a sub function, + because otherwise we would get problems with two threads calling + DBUG_... functions at the same time (as two threads may call + process_alarm() at the same time + */ + +#ifndef USE_ALARM_THREAD + pthread_sigmask(SIG_SETMASK,&full_signal_set,&old_mask); + pthread_mutex_lock(&LOCK_alarm); +#endif + process_alarm_part2(sig); +#ifndef USE_ALARM_THREAD +#if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND) + my_sigset(THR_SERVER_ALARM,process_alarm); +#endif + pthread_mutex_unlock(&LOCK_alarm); + pthread_sigmask(SIG_SETMASK,&old_mask,NULL); +#endif + return; +} + + +static sig_handler process_alarm_part2(int sig __attribute__((unused))) +{ + ALARM *alarm_data; + DBUG_ENTER("process_alarm"); + DBUG_PRINT("info",("sig: %d active alarms: %d",sig,alarm_queue.elements)); + +#if defined(MAIN) && !defined(__bsdi__) + printf("process_alarm\n"); fflush(stdout); +#endif + if (alarm_queue.elements) + { + if (alarm_aborted) + { + uint i; + for (i=0 ; i < alarm_queue.elements ;) + { + alarm_data=(ALARM*) queue_element(&alarm_queue,i); + alarm_data->alarmed=1; /* Info to thread */ + if (pthread_equal(alarm_data->thread,alarm_thread) || + pthread_kill(alarm_data->thread, thr_client_alarm)) + { +#ifdef MAIN + printf("Warning: pthread_kill couldn't find thread!!!\n"); +#endif + queue_remove(&alarm_queue,i); /* No thread. Remove alarm */ + } + else + i++; /* Signal next thread */ + } +#ifndef USE_ALARM_THREAD + if (alarm_queue.elements) + alarm(1); /* Signal soon again */ +#endif + } + else + { + ulong now=(ulong) my_time(0); + ulong next=now+10-(now%10); + while ((alarm_data=(ALARM*) queue_top(&alarm_queue))->expire_time <= now) + { + alarm_data->alarmed=1; /* Info to thread */ + DBUG_PRINT("info",("sending signal to waiting thread")); + if (pthread_equal(alarm_data->thread,alarm_thread) || + pthread_kill(alarm_data->thread, thr_client_alarm)) + { +#ifdef MAIN + printf("Warning: pthread_kill couldn't find thread!!!\n"); +#endif + queue_remove(&alarm_queue,0); /* No thread. Remove alarm */ + if (!alarm_queue.elements) + break; + } + else + { + alarm_data->expire_time=next; + queue_replaced(&alarm_queue); + } + } +#ifndef USE_ALARM_THREAD + if (alarm_queue.elements) + { +#ifdef __bsdi__ + alarm(0); /* Remove old alarm */ +#endif + alarm((uint) (alarm_data->expire_time-now)); + next_alarm_expire_time= alarm_data->expire_time; + } +#endif + } + } + else + { + /* + Ensure that next time we call thr_alarm(), we will schedule a new alarm + */ + next_alarm_expire_time= ~(time_t) 0; + } + DBUG_VOID_RETURN; +} + + +/* + Schedule all alarms now and optionally free all structures + + SYNPOSIS + end_thr_alarm() + free_structures Set to 1 if we should free memory used for + the alarm queue. + When we call this we should KNOW that there + is no active alarms + IMPLEMENTATION + Set alarm_abort to -1 which will change the behavior of alarms as follows: + - All old alarms will be rescheduled at once + - All new alarms will be rescheduled to one second +*/ + +void end_thr_alarm(my_bool free_structures) +{ + DBUG_ENTER("end_thr_alarm"); + if (alarm_aborted != 1) /* If memory not freed */ + { + pthread_mutex_lock(&LOCK_alarm); + DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements)); + alarm_aborted= -1; /* mark aborted */ + if (alarm_queue.elements || (alarm_thread_running && free_structures)) + { + if (pthread_equal(pthread_self(),alarm_thread)) + alarm(1); /* Shut down everything soon */ + else + reschedule_alarms(); + } + if (free_structures) + { + struct timespec abstime; + + DBUG_ASSERT(!alarm_queue.elements); + + /* Wait until alarm thread dies */ + set_timespec(abstime, 10); /* Wait up to 10 seconds */ + while (alarm_thread_running) + { + int error= pthread_cond_timedwait(&COND_alarm, &LOCK_alarm, &abstime); + if (error == ETIME || error == ETIMEDOUT) + break; /* Don't wait forever */ + } + delete_queue(&alarm_queue); + alarm_aborted= 1; + pthread_mutex_unlock(&LOCK_alarm); + if (!alarm_thread_running) /* Safety */ + { + pthread_mutex_destroy(&LOCK_alarm); + pthread_cond_destroy(&COND_alarm); + } + } + else + pthread_mutex_unlock(&LOCK_alarm); + } + DBUG_VOID_RETURN; +} + + +/* + Remove another thread from the alarm +*/ + +void thr_alarm_kill(my_thread_id thread_id) +{ + uint i; + if (alarm_aborted) + return; + pthread_mutex_lock(&LOCK_alarm); + for (i=0 ; i < alarm_queue.elements ; i++) + { + if (((ALARM*) queue_element(&alarm_queue,i))->thread_id == thread_id) + { + ALARM *tmp=(ALARM*) queue_remove(&alarm_queue,i); + tmp->expire_time=0; + queue_insert(&alarm_queue,(uchar*) tmp); + reschedule_alarms(); + break; + } + } + pthread_mutex_unlock(&LOCK_alarm); +} + + +void thr_alarm_info(ALARM_INFO *info) +{ + pthread_mutex_lock(&LOCK_alarm); + info->next_alarm_time= 0; + info->max_used_alarms= max_used_alarms; + if ((info->active_alarms= alarm_queue.elements)) + { + ulong now=(ulong) my_time(0); + long time_diff; + ALARM *alarm_data= (ALARM*) queue_top(&alarm_queue); + time_diff= (long) (alarm_data->expire_time - now); + info->next_alarm_time= (ulong) (time_diff < 0 ? 0 : time_diff); + } + pthread_mutex_unlock(&LOCK_alarm); +} + +/* + This is here for thread to get interruptet from read/write/fcntl + ARGSUSED +*/ + + +static sig_handler thread_alarm(int sig) +{ +#ifdef MAIN + printf("thread_alarm\n"); fflush(stdout); +#endif +#ifdef DONT_REMEMBER_SIGNAL + my_sigset(sig,thread_alarm); /* int. thread system calls */ +#endif +} + + +#ifdef HAVE_TIMESPEC_TS_SEC +#define tv_sec ts_sec +#define tv_nsec ts_nsec +#endif + +/* set up a alarm thread with uses 'sleep' to sleep between alarms */ + +#ifdef USE_ALARM_THREAD +static void *alarm_handler(void *arg __attribute__((unused))) +{ + int error; + struct timespec abstime; +#ifdef MAIN + puts("Starting alarm thread"); +#endif + my_thread_init(); + alarm_thread_running= 1; + pthread_mutex_lock(&LOCK_alarm); + for (;;) + { + if (alarm_queue.elements) + { + ulong sleep_time,now= my_time(0); + if (alarm_aborted) + sleep_time=now+1; + else + sleep_time= ((ALARM*) queue_top(&alarm_queue))->expire_time; + if (sleep_time > now) + { + abstime.tv_sec=sleep_time; + abstime.tv_nsec=0; + next_alarm_expire_time= sleep_time; + if ((error=pthread_cond_timedwait(&COND_alarm,&LOCK_alarm,&abstime)) && + error != ETIME && error != ETIMEDOUT) + { +#ifdef MAIN + printf("Got error: %d from ptread_cond_timedwait (errno: %d)\n", + error,errno); +#endif + } + } + } + else if (alarm_aborted == -1) + break; + else + { + next_alarm_expire_time= ~ (time_t) 0; + if ((error=pthread_cond_wait(&COND_alarm,&LOCK_alarm))) + { +#ifdef MAIN + printf("Got error: %d from ptread_cond_wait (errno: %d)\n", + error,errno); +#endif + } + } + process_alarm(0); + } + bzero((char*) &alarm_thread,sizeof(alarm_thread)); /* For easy debugging */ + alarm_thread_running= 0; + pthread_cond_signal(&COND_alarm); + pthread_mutex_unlock(&LOCK_alarm); + pthread_exit(0); + return 0; /* Impossible */ +} +#endif /* USE_ALARM_THREAD */ + +/***************************************************************************** + thr_alarm for win95 +*****************************************************************************/ + +#else /* __WIN__ */ + +void thr_alarm_kill(my_thread_id thread_id) +{ + /* Can't do this yet */ +} + +sig_handler process_alarm(int sig __attribute__((unused))) +{ + /* Can't do this yet */ +} + + +my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm) +{ + (*alrm)= &alarm->alarmed; + if (alarm_aborted) + { + alarm->alarmed.crono=0; + return 1; + } + if (!(alarm->alarmed.crono=SetTimer((HWND) NULL,0, sec*1000, + (TIMERPROC) NULL))) + return 1; + return 0; +} + + +my_bool thr_got_alarm(thr_alarm_t *alrm_ptr) +{ + thr_alarm_t alrm= *alrm_ptr; + MSG msg; + if (alrm->crono) + { + PeekMessage(&msg,NULL,WM_TIMER,WM_TIMER,PM_REMOVE) ; + if (msg.message == WM_TIMER || alarm_aborted) + { + KillTimer(NULL, alrm->crono); + alrm->crono = 0; + } + } + return !alrm->crono || alarm_aborted; +} + + +void thr_end_alarm(thr_alarm_t *alrm_ptr) +{ + thr_alarm_t alrm= *alrm_ptr; + /* alrm may be zero if thr_alarm aborted with an error */ + if (alrm && alrm->crono) + + { + KillTimer(NULL, alrm->crono); + alrm->crono = 0; + } +} + +void end_thr_alarm(my_bool free_structures) +{ + DBUG_ENTER("end_thr_alarm"); + alarm_aborted=1; /* No more alarms */ + DBUG_VOID_RETURN; +} + +void init_thr_alarm(uint max_alarm) +{ + DBUG_ENTER("init_thr_alarm"); + alarm_aborted=0; /* Yes, Gimmie alarms */ + DBUG_VOID_RETURN; +} + +void thr_alarm_info(ALARM_INFO *info) +{ + bzero((char*) info, sizeof(*info)); +} + +void resize_thr_alarm(uint max_alarms) +{ +} + +#endif /* __WIN__ */ + +#endif /* THREAD */ + + +/**************************************************************************** + Handling of test case (when compiled with -DMAIN) +***************************************************************************/ + +#ifdef MAIN +#if defined(THREAD) && !defined(DONT_USE_THR_ALARM) + +static pthread_cond_t COND_thread_count; +static pthread_mutex_t LOCK_thread_count; +static uint thread_count; + +#ifdef HPUX10 +typedef int * fd_set_ptr; +#else +typedef fd_set * fd_set_ptr; +#endif /* HPUX10 */ + +static void *test_thread(void *arg) +{ + int i,param=*((int*) arg),wait_time,retry; + time_t start_time; + thr_alarm_t got_alarm; + fd_set fd; + FD_ZERO(&fd); + my_thread_init(); + printf("Thread %d (%s) started\n",param,my_thread_name()); fflush(stdout); + for (i=1 ; i <= 10 ; i++) + { + wait_time=param ? 11-i : i; + start_time= my_time(0); + if (thr_alarm(&got_alarm,wait_time,0)) + { + printf("Thread: %s Alarms aborted\n",my_thread_name()); + break; + } + if (wait_time == 3) + { + printf("Thread: %s Simulation of no alarm needed\n",my_thread_name()); + fflush(stdout); + } + else + { + for (retry=0 ; !thr_got_alarm(&got_alarm) && retry < 10 ; retry++) + { + printf("Thread: %s Waiting %d sec\n",my_thread_name(),wait_time); + select(0,(fd_set_ptr) &fd,0,0,0); + } + if (!thr_got_alarm(&got_alarm)) + { + printf("Thread: %s didn't get an alarm. Aborting!\n", + my_thread_name()); + break; + } + if (wait_time == 7) + { /* Simulate alarm-miss */ + fd_set readFDs; + uint max_connection=fileno(stdin); + FD_ZERO(&readFDs); + FD_SET(max_connection,&readFDs); + retry=0; + for (;;) + { + printf("Thread: %s Simulating alarm miss\n",my_thread_name()); + fflush(stdout); + if (select(max_connection+1, (fd_set_ptr) &readFDs,0,0,0) < 0) + { + if (errno == EINTR) + break; /* Got new interrupt */ + printf("Got errno: %d from select. Retrying..\n",errno); + if (retry++ >= 3) + { + printf("Warning: Interrupt of select() doesn't set errno!\n"); + break; + } + } + else /* This shouldn't happen */ + { + if (!FD_ISSET(max_connection,&readFDs)) + { + printf("Select interrupted, but errno not set\n"); + fflush(stdout); + if (retry++ >= 3) + break; + continue; + } + (void) getchar(); /* Somebody was playing */ + } + } + } + } + printf("Thread: %s Slept for %d (%d) sec\n",my_thread_name(), + (int) (my_time(0)-start_time), wait_time); fflush(stdout); + thr_end_alarm(&got_alarm); + fflush(stdout); + } + pthread_mutex_lock(&LOCK_thread_count); + thread_count--; + pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */ + pthread_mutex_unlock(&LOCK_thread_count); + free((uchar*) arg); + return 0; +} + +#ifdef USE_ONE_SIGNAL_HAND +static sig_handler print_signal_warning(int sig) +{ + printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name()); + fflush(stdout); +#ifdef DONT_REMEMBER_SIGNAL + my_sigset(sig,print_signal_warning); /* int. thread system calls */ +#endif + if (sig == SIGALRM) + alarm(2); /* reschedule alarm */ +} +#endif /* USE_ONE_SIGNAL_HAND */ + + +static void *signal_hand(void *arg __attribute__((unused))) +{ + sigset_t set; + int sig,error,err_count=0;; + + my_thread_init(); + pthread_detach_this_thread(); + init_thr_alarm(10); /* Setup alarm handler */ + pthread_mutex_lock(&LOCK_thread_count); /* Required by bsdi */ + pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */ + pthread_mutex_unlock(&LOCK_thread_count); + + sigemptyset(&set); /* Catch all signals */ + sigaddset(&set,SIGINT); + sigaddset(&set,SIGQUIT); + sigaddset(&set,SIGTERM); + sigaddset(&set,SIGHUP); +#ifdef SIGTSTP + sigaddset(&set,SIGTSTP); +#endif +#ifdef USE_ONE_SIGNAL_HAND + sigaddset(&set,THR_SERVER_ALARM); /* For alarms */ + puts("Starting signal and alarm handling thread"); +#else + puts("Starting signal handling thread"); +#endif + printf("server alarm: %d thread alarm: %d\n", + THR_SERVER_ALARM, thr_client_alarm); + DBUG_PRINT("info",("Starting signal and alarm handling thread")); + for(;;) + { + while ((error=my_sigwait(&set,&sig)) == EINTR) + printf("sigwait restarted\n"); + if (error) + { + fprintf(stderr,"Got error %d from sigwait\n",error); + if (err_count++ > 5) + exit(1); /* Too many errors in test */ + continue; + } +#ifdef USE_ONE_SIGNAL_HAND + if (sig != THR_SERVER_ALARM) +#endif + printf("Main thread: Got signal %d\n",sig); + switch (sig) { + case SIGINT: + case SIGQUIT: + case SIGTERM: + case SIGHUP: + printf("Aborting nicely\n"); + end_thr_alarm(0); + break; +#ifdef SIGTSTP + case SIGTSTP: + printf("Aborting\n"); + exit(1); + return 0; /* Keep some compilers happy */ +#endif +#ifdef USE_ONE_SIGNAL_HAND + case THR_SERVER_ALARM: + process_alarm(sig); + break; +#endif + } + } +} + + +int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) +{ + pthread_t tid; + pthread_attr_t thr_attr; + int i,*param,error; + sigset_t set; + ALARM_INFO alarm_info; + MY_INIT(argv[0]); + + if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#') + { + DBUG_PUSH(argv[1]+2); + } + pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST); + pthread_cond_init(&COND_thread_count,NULL); + + /* Start a alarm handling thread */ + sigemptyset(&set); + sigaddset(&set,SIGINT); + sigaddset(&set,SIGQUIT); + sigaddset(&set,SIGTERM); + sigaddset(&set,SIGHUP); + signal(SIGTERM,SIG_DFL); /* If it's blocked by parent */ +#ifdef SIGTSTP + sigaddset(&set,SIGTSTP); +#endif + sigaddset(&set,THR_SERVER_ALARM); + sigdelset(&set, thr_client_alarm); + (void) pthread_sigmask(SIG_SETMASK,&set,NULL); +#ifdef NOT_USED + sigemptyset(&set); + sigaddset(&set, thr_client_alarm); + pthread_sigmask(SIG_UNBLOCK, &set, (sigset_t*) 0); +#endif + + pthread_attr_init(&thr_attr); + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); + pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&thr_attr,65536L); + + /* Start signal thread and wait for it to start */ + pthread_mutex_lock(&LOCK_thread_count); + pthread_create(&tid,&thr_attr,signal_hand,NULL); + pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); + pthread_mutex_unlock(&LOCK_thread_count); + DBUG_PRINT("info",("signal thread created")); + + thr_setconcurrency(3); + pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_PROCESS); + printf("Main thread: %s\n",my_thread_name()); + for (i=0 ; i < 2 ; i++) + { + param=(int*) malloc(sizeof(int)); + *param= i; + pthread_mutex_lock(&LOCK_thread_count); + if ((error=pthread_create(&tid,&thr_attr,test_thread,(void*) param))) + { + printf("Can't create thread %d, error: %d\n",i,error); + exit(1); + } + thread_count++; + pthread_mutex_unlock(&LOCK_thread_count); + } + + pthread_attr_destroy(&thr_attr); + pthread_mutex_lock(&LOCK_thread_count); + thr_alarm_info(&alarm_info); + printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n", + alarm_info.active_alarms, alarm_info.max_used_alarms, + alarm_info.next_alarm_time); + while (thread_count) + { + pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); + if (thread_count == 1) + { + printf("Calling end_thr_alarm. This should cancel the last thread\n"); + end_thr_alarm(0); + } + } + pthread_mutex_unlock(&LOCK_thread_count); + thr_alarm_info(&alarm_info); + end_thr_alarm(1); + printf("Main_thread: Alarms: %u max_alarms: %u next_alarm_time: %lu\n", + alarm_info.active_alarms, alarm_info.max_used_alarms, + alarm_info.next_alarm_time); + printf("Test succeeded\n"); + return 0; +} + +#else /* THREAD */ + +int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) +{ +#ifndef THREAD + printf("thr_alarm disabled because we are not using threads\n"); +#else + printf("thr_alarm disabled with DONT_USE_THR_ALARM\n"); +#endif + exit(1); +} + +#endif /* THREAD */ +#endif /* MAIN */ diff --git a/externals/mysql/mysys/thr_lock.c b/externals/mysql/mysys/thr_lock.c new file mode 100644 index 0000000..f9f3293 --- /dev/null +++ b/externals/mysql/mysys/thr_lock.c @@ -0,0 +1,1687 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* +Read and write locks for Posix threads. All tread must acquire +all locks it needs through thr_multi_lock() to avoid dead-locks. +A lock consists of a master lock (THR_LOCK), and lock instances +(THR_LOCK_DATA). +Any thread can have any number of lock instances (read and write:s) on +any lock. All lock instances must be freed. +Locks are prioritized according to: + +The current lock types are: + +TL_READ # Low priority read +TL_READ_WITH_SHARED_LOCKS +TL_READ_HIGH_PRIORITY # High priority read +TL_READ_NO_INSERT # Read without concurrent inserts +TL_WRITE_ALLOW_WRITE # Write lock that allows other writers +TL_WRITE_ALLOW_READ # Write lock, but allow reading +TL_WRITE_CONCURRENT_INSERT + # Insert that can be mixed when selects +TL_WRITE_DELAYED # Used by delayed insert + # Allows lower locks to take over +TL_WRITE_LOW_PRIORITY # Low priority write +TL_WRITE # High priority write +TL_WRITE_ONLY # High priority write + # Abort all new lock request with an error + +Locks are prioritized according to: + +WRITE_ALLOW_WRITE, WRITE_ALLOW_READ, WRITE_CONCURRENT_INSERT, WRITE_DELAYED, +WRITE_LOW_PRIORITY, READ, WRITE, READ_HIGH_PRIORITY and WRITE_ONLY + +Locks in the same privilege level are scheduled in first-in-first-out order. + +To allow concurrent read/writes locks, with 'WRITE_CONCURRENT_INSERT' one +should put a pointer to the following functions in the lock structure: +(If the pointer is zero (default), the function is not called) + +check_status: + Before giving a lock of type TL_WRITE_CONCURRENT_INSERT, + we check if this function exists and returns 0. + If not, then the lock is upgraded to TL_WRITE_LOCK + In MyISAM this is a simple check if the insert can be done + at the end of the datafile. +update_status: + in thr_reschedule_write_lock(), when an insert delayed thread + downgrades TL_WRITE lock to TL_WRITE_DELAYED, to allow SELECT + threads to proceed. + A storage engine should also call update_status internally + in the ::external_lock(F_UNLCK) method. + In MyISAM and CSV this functions updates the length of the datafile. +get_status: + When one gets a lock this functions is called. + In MyISAM this stores the number of rows and size of the datafile + for concurrent reads. + +The lock algorithm allows one to have one TL_WRITE_ALLOW_READ, +TL_WRITE_CONCURRENT_INSERT or one TL_WRITE_DELAYED lock at the same +time as multiple read locks. + +In addition, if lock->allow_multiple_concurrent_insert is set then there can +be any number of TL_WRITE_CONCURRENT_INSERT locks aktive at the same time. +*/ + +#if !defined(MAIN) && !defined(DBUG_OFF) && !defined(EXTRA_DEBUG) +#define FORCE_DBUG_OFF +#endif + +#include "mysys_priv.h" + +#ifdef THREAD +#include "thr_lock.h" +#include +#include + +my_bool thr_lock_inited=0; +ulong locks_immediate = 0L, locks_waited = 0L; +ulong table_lock_wait_timeout; +enum thr_lock_type thr_upgraded_concurrent_insert_lock = TL_WRITE; + +/* The following constants are only for debug output */ +#define MAX_THREADS 100 +#define MAX_LOCKS 100 + + +LIST *thr_lock_thread_list; /* List of threads in use */ +ulong max_write_lock_count= ~(ulong) 0L; + +static inline pthread_cond_t *get_cond(void) +{ + return &my_thread_var->suspend; +} + +/* +** For the future (now the thread specific cond is alloced by my_pthread.c) +*/ + +my_bool init_thr_lock() +{ + thr_lock_inited=1; + return 0; +} + +static inline my_bool +thr_lock_owner_equal(THR_LOCK_OWNER *rhs, THR_LOCK_OWNER *lhs) +{ + return rhs == lhs; +} + + +#ifdef EXTRA_DEBUG +#define MAX_FOUND_ERRORS 10 /* Report 10 first errors */ +static uint found_errors=0; + +static int check_lock(struct st_lock_list *list, const char* lock_type, + const char *where, my_bool same_owner, my_bool no_cond) +{ + THR_LOCK_DATA *data,**prev; + uint count=0; + THR_LOCK_OWNER *first_owner; + LINT_INIT(first_owner); + + prev= &list->data; + if (list->data) + { + enum thr_lock_type last_lock_type=list->data->type; + + if (same_owner && list->data) + first_owner= list->data->owner; + for (data=list->data; data && count++ < MAX_LOCKS ; data=data->next) + { + if (data->type != last_lock_type) + last_lock_type=TL_IGNORE; + if (data->prev != prev) + { + fprintf(stderr, + "Warning: prev link %d didn't point at previous lock at %s: %s\n", + count, lock_type, where); + return 1; + } + if (same_owner && + !thr_lock_owner_equal(data->owner, first_owner) && + last_lock_type != TL_WRITE_ALLOW_WRITE && + last_lock_type != TL_WRITE_CONCURRENT_INSERT) + { + fprintf(stderr, + "Warning: Found locks from different threads in %s: %s\n", + lock_type,where); + return 1; + } + if (no_cond && data->cond) + { + fprintf(stderr, + "Warning: Found active lock with not reset cond %s: %s\n", + lock_type,where); + return 1; + } + prev= &data->next; + } + if (data) + { + fprintf(stderr,"Warning: found too many locks at %s: %s\n", + lock_type,where); + return 1; + } + } + if (prev != list->last) + { + fprintf(stderr,"Warning: last didn't point at last lock at %s: %s\n", + lock_type, where); + return 1; + } + return 0; +} + + +static void check_locks(THR_LOCK *lock, const char *where, + my_bool allow_no_locks) +{ + uint old_found_errors=found_errors; + DBUG_ENTER("check_locks"); + + if (found_errors < MAX_FOUND_ERRORS) + { + if (check_lock(&lock->write,"write",where,1,1) | + check_lock(&lock->write_wait,"write_wait",where,0,0) | + check_lock(&lock->read,"read",where,0,1) | + check_lock(&lock->read_wait,"read_wait",where,0,0)) + found_errors++; + + if (found_errors < MAX_FOUND_ERRORS) + { + uint count=0; + THR_LOCK_DATA *data; + for (data=lock->read.data ; data ; data=data->next) + { + if (data->type == TL_READ_NO_INSERT) + count++; + /* Protect against infinite loop. */ + DBUG_ASSERT(count <= lock->read_no_write_count); + } + if (count != lock->read_no_write_count) + { + found_errors++; + fprintf(stderr, + "Warning at '%s': Locks read_no_write_count was %u when it should have been %u\n", where, lock->read_no_write_count,count); + } + + if (!lock->write.data) + { + if (!allow_no_locks && !lock->read.data && + (lock->write_wait.data || lock->read_wait.data)) + { + found_errors++; + fprintf(stderr, + "Warning at '%s': No locks in use but locks are in wait queue\n", + where); + } + if (!lock->write_wait.data) + { + if (!allow_no_locks && lock->read_wait.data) + { + found_errors++; + fprintf(stderr, + "Warning at '%s': No write locks and waiting read locks\n", + where); + } + } + else + { + if (!allow_no_locks && + (((lock->write_wait.data->type == TL_WRITE_CONCURRENT_INSERT || + lock->write_wait.data->type == TL_WRITE_ALLOW_WRITE) && + !lock->read_no_write_count) || + lock->write_wait.data->type == TL_WRITE_ALLOW_READ || + (lock->write_wait.data->type == TL_WRITE_DELAYED && + !lock->read.data))) + { + found_errors++; + fprintf(stderr, + "Warning at '%s': Write lock %d waiting while no exclusive read locks\n",where,(int) lock->write_wait.data->type); + } + } + } + else + { + /* We have at least one write lock */ + if (lock->write.data->type == TL_WRITE_CONCURRENT_INSERT) + { + THR_LOCK_DATA *data; + for (data=lock->write.data->next ; data ; data=data->next) + { + if (data->type != TL_WRITE_CONCURRENT_INSERT) + { + fprintf(stderr, + "Warning at '%s': Found TL_WRITE_CONCURRENT_INSERT lock mixed with other write locks\n", + where); + break; + } + } + } + if (lock->write_wait.data) + { + if (!allow_no_locks && + lock->write.data->type == TL_WRITE_ALLOW_WRITE && + lock->write_wait.data->type == TL_WRITE_ALLOW_WRITE) + { + found_errors++; + fprintf(stderr, + "Warning at '%s': Found WRITE_ALLOW_WRITE lock waiting for WRITE_ALLOW_WRITE lock\n", + where); + } + } + if (lock->read.data) + { + if (!thr_lock_owner_equal(lock->write.data->owner, + lock->read.data->owner) && + ((lock->write.data->type > TL_WRITE_DELAYED && + lock->write.data->type != TL_WRITE_ONLY) || + ((lock->write.data->type == TL_WRITE_CONCURRENT_INSERT || + lock->write.data->type == TL_WRITE_ALLOW_WRITE) && + lock->read_no_write_count))) + { + found_errors++; + fprintf(stderr, + "Warning at '%s': Found lock of type %d that is write and read locked\n", + where, lock->write.data->type); + DBUG_PRINT("warning",("At '%s': Found lock of type %d that is write and read locked\n", + where, lock->write.data->type)); + + } + } + if (lock->read_wait.data) + { + if (!allow_no_locks && lock->write.data->type <= TL_WRITE_DELAYED && + lock->read_wait.data->type <= TL_READ_HIGH_PRIORITY) + { + found_errors++; + fprintf(stderr, + "Warning at '%s': Found read lock of type %d waiting for write lock of type %d\n", + where, + (int) lock->read_wait.data->type, + (int) lock->write.data->type); + } + } + } + } + if (found_errors != old_found_errors) + { + fflush(stderr); + DBUG_PRINT("error",("Found wrong lock")); + } + } + DBUG_VOID_RETURN; +} + +#else /* EXTRA_DEBUG */ +#define check_locks(A,B,C) +#endif + + + /* Initialize a lock */ + +void thr_lock_init(THR_LOCK *lock) +{ + DBUG_ENTER("thr_lock_init"); + bzero((char*) lock,sizeof(*lock)); + pthread_mutex_init(&lock->mutex,MY_MUTEX_INIT_FAST); + lock->read.last= &lock->read.data; + lock->read_wait.last= &lock->read_wait.data; + lock->write_wait.last= &lock->write_wait.data; + lock->write.last= &lock->write.data; + + pthread_mutex_lock(&THR_LOCK_lock); /* Add to locks in use */ + lock->list.data=(void*) lock; + thr_lock_thread_list=list_add(thr_lock_thread_list,&lock->list); + pthread_mutex_unlock(&THR_LOCK_lock); + DBUG_VOID_RETURN; +} + + +void thr_lock_delete(THR_LOCK *lock) +{ + DBUG_ENTER("thr_lock_delete"); + pthread_mutex_lock(&THR_LOCK_lock); + thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list); + pthread_mutex_unlock(&THR_LOCK_lock); + pthread_mutex_destroy(&lock->mutex); + DBUG_VOID_RETURN; +} + + +void thr_lock_info_init(THR_LOCK_INFO *info) +{ + struct st_my_thread_var *tmp= my_thread_var; + info->thread= tmp->pthread_self; + info->thread_id= tmp->id; + info->n_cursors= 0; +} + + /* Initialize a lock instance */ + +void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, void *param) +{ + data->lock=lock; + data->type=TL_UNLOCK; + data->owner= 0; /* no owner yet */ + data->status_param=param; + data->cond=0; +} + + +static inline my_bool +have_old_read_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner) +{ + for ( ; data ; data=data->next) + { + if (thr_lock_owner_equal(data->owner, owner)) + return 1; /* Already locked by thread */ + } + return 0; +} + +static inline my_bool have_specific_lock(THR_LOCK_DATA *data, + enum thr_lock_type type) +{ + for ( ; data ; data=data->next) + { + if (data->type == type) + return 1; + } + return 0; +} + + +static void wake_up_waiters(THR_LOCK *lock); + +static enum enum_thr_lock_result +wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, + my_bool in_wait_list) +{ + struct st_my_thread_var *thread_var= my_thread_var; + pthread_cond_t *cond= &thread_var->suspend; + struct timespec wait_timeout; + enum enum_thr_lock_result result= THR_LOCK_ABORTED; + my_bool can_deadlock= test(data->owner->info->n_cursors); + const char *old_proc_info; + DBUG_ENTER("wait_for_lock"); + + /* + One can use this to signal when a thread is going to wait for a lock. + See debug_sync.cc. + + Beware of waiting for a signal here. The lock has aquired its mutex. + While waiting on a signal here, the locking thread could not aquire + the mutex to release the lock. One could lock up the table + completely. + + In detail it works so: When thr_lock() tries to acquire a table + lock, it locks the lock->mutex, checks if it can have the lock, and + if not, it calls wait_for_lock(). Here it unlocks the table lock + while waiting on a condition. The sync point is located before this + wait for condition. If we have a waiting action here, we hold the + the table locks mutex all the time. Any attempt to look at the table + lock by another thread blocks it immediately on lock->mutex. This + can easily become an unexpected and unobvious blockage. So be + warned: Do not request a WAIT_FOR action for the 'wait_for_lock' + sync point unless you really know what you do. + */ + DEBUG_SYNC_C("wait_for_lock"); + + if (!in_wait_list) + { + (*wait->last)=data; /* Wait for lock */ + data->prev= wait->last; + wait->last= &data->next; + } + + statistic_increment(locks_waited, &THR_LOCK_lock); + + /* Set up control struct to allow others to abort locks */ + thread_var->current_mutex= &data->lock->mutex; + thread_var->current_cond= cond; + data->cond= cond; + + old_proc_info= proc_info_hook(NULL, "Table lock", + __func__, __FILE__, __LINE__); + + if (can_deadlock) + set_timespec(wait_timeout, table_lock_wait_timeout); + while (!thread_var->abort || in_wait_list) + { + int rc= (can_deadlock ? + pthread_cond_timedwait(cond, &data->lock->mutex, + &wait_timeout) : + pthread_cond_wait(cond, &data->lock->mutex)); + /* + We must break the wait if one of the following occurs: + - the connection has been aborted (!thread_var->abort), but + this is not a delayed insert thread (in_wait_list). For a delayed + insert thread the proper action at shutdown is, apparently, to + acquire the lock and complete the insert. + - the lock has been granted (data->cond is set to NULL by the granter), + or the waiting has been aborted (additionally data->type is set to + TL_UNLOCK). + - the wait has timed out (rc == ETIMEDOUT) + Order of checks below is important to not report about timeout + if the predicate is true. + */ + if (data->cond == 0) + { + DBUG_PRINT("thr_lock", ("lock granted/aborted")); + break; + } + if (rc == ETIMEDOUT || rc == ETIME) + { + /* purecov: begin inspected */ + DBUG_PRINT("thr_lock", ("lock timed out")); + result= THR_LOCK_WAIT_TIMEOUT; + break; + /* purecov: end */ + } + } + DBUG_PRINT("thr_lock", ("aborted: %d in_wait_list: %d", + thread_var->abort, in_wait_list)); + + if (data->cond || data->type == TL_UNLOCK) + { + if (data->cond) /* aborted or timed out */ + { + if (((*data->prev)=data->next)) /* remove from wait-list */ + data->next->prev= data->prev; + else + wait->last=data->prev; + data->type= TL_UNLOCK; /* No lock */ + check_locks(data->lock, "killed or timed out wait_for_lock", 1); + wake_up_waiters(data->lock); + } + else + { + DBUG_PRINT("thr_lock", ("lock aborted")); + check_locks(data->lock, "aborted wait_for_lock", 0); + } + } + else + { + result= THR_LOCK_SUCCESS; + if (data->lock->get_status) + (*data->lock->get_status)(data->status_param, + data->type == TL_WRITE_CONCURRENT_INSERT); + check_locks(data->lock,"got wait_for_lock",0); + } + pthread_mutex_unlock(&data->lock->mutex); + + /* The following must be done after unlock of lock->mutex */ + pthread_mutex_lock(&thread_var->mutex); + thread_var->current_mutex= 0; + thread_var->current_cond= 0; + pthread_mutex_unlock(&thread_var->mutex); + + proc_info_hook(NULL, old_proc_info, __func__, __FILE__, __LINE__); + + DBUG_RETURN(result); +} + + +enum enum_thr_lock_result +thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner, + enum thr_lock_type lock_type) +{ + THR_LOCK *lock=data->lock; + enum enum_thr_lock_result result= THR_LOCK_SUCCESS; + struct st_lock_list *wait_queue; + THR_LOCK_DATA *lock_owner; + DBUG_ENTER("thr_lock"); + + data->next=0; + data->cond=0; /* safety */ + data->type=lock_type; + data->owner= owner; /* Must be reset ! */ + pthread_mutex_lock(&lock->mutex); + DBUG_PRINT("lock",("data: %p thread: 0x%lx lock: %p type: %d", + data, data->owner->info->thread_id, + lock, (int) lock_type)); + check_locks(lock,(uint) lock_type <= (uint) TL_READ_NO_INSERT ? + "enter read_lock" : "enter write_lock",0); + if ((int) lock_type <= (int) TL_READ_NO_INSERT) + { + /* Request for READ lock */ + if (lock->write.data) + { + /* + We can allow a read lock even if there is already a write lock + on the table in one the following cases: + - This thread alread have a write lock on the table + - The write lock is TL_WRITE_ALLOW_READ or TL_WRITE_DELAYED + and the read lock is TL_READ_HIGH_PRIORITY or TL_READ + - The write lock is TL_WRITE_CONCURRENT_INSERT or TL_WRITE_ALLOW_WRITE + and the read lock is not TL_READ_NO_INSERT + */ + + DBUG_PRINT("lock",("write locked 1 by thread: 0x%lx", + lock->write.data->owner->info->thread_id)); + if (thr_lock_owner_equal(data->owner, lock->write.data->owner) || + (lock->write.data->type <= TL_WRITE_DELAYED && + (((int) lock_type <= (int) TL_READ_HIGH_PRIORITY) || + (lock->write.data->type != TL_WRITE_CONCURRENT_INSERT && + lock->write.data->type != TL_WRITE_ALLOW_READ)))) + { /* Already got a write lock */ + (*lock->read.last)=data; /* Add to running FIFO */ + data->prev=lock->read.last; + lock->read.last= &data->next; + if (lock_type == TL_READ_NO_INSERT) + lock->read_no_write_count++; + check_locks(lock,"read lock with old write lock",0); + if (lock->get_status) + (*lock->get_status)(data->status_param, 0); + statistic_increment(locks_immediate,&THR_LOCK_lock); + goto end; + } + if (lock->write.data->type == TL_WRITE_ONLY) + { + /* We are not allowed to get a READ lock in this case */ + data->type=TL_UNLOCK; + result= THR_LOCK_ABORTED; /* Can't wait for this one */ + goto end; + } + } + else if (!lock->write_wait.data || + lock->write_wait.data->type <= TL_WRITE_LOW_PRIORITY || + lock_type == TL_READ_HIGH_PRIORITY || + have_old_read_lock(lock->read.data, data->owner)) + { /* No important write-locks */ + (*lock->read.last)=data; /* Add to running FIFO */ + data->prev=lock->read.last; + lock->read.last= &data->next; + if (lock_type == TL_READ_NO_INSERT) + lock->read_no_write_count++; + check_locks(lock,"read lock with no write locks",0); + if (lock->get_status) + (*lock->get_status)(data->status_param, 0); + statistic_increment(locks_immediate,&THR_LOCK_lock); + goto end; + } + /* + We're here if there is an active write lock or no write + lock but a high priority write waiting in the write_wait queue. + In the latter case we should yield the lock to the writer. + */ + wait_queue= &lock->read_wait; + } + else /* Request for WRITE lock */ + { + if (lock_type == TL_WRITE_DELAYED) + { + if (lock->write.data && lock->write.data->type == TL_WRITE_ONLY) + { + data->type=TL_UNLOCK; + result= THR_LOCK_ABORTED; /* Can't wait for this one */ + goto end; + } + /* + if there is a TL_WRITE_ALLOW_READ lock, we have to wait for a lock + (TL_WRITE_ALLOW_READ is used for ALTER TABLE in MySQL) + */ + if ((!lock->write.data || + lock->write.data->type != TL_WRITE_ALLOW_READ) && + !have_specific_lock(lock->write_wait.data,TL_WRITE_ALLOW_READ) && + (lock->write.data || lock->read.data)) + { + /* Add delayed write lock to write_wait queue, and return at once */ + (*lock->write_wait.last)=data; + data->prev=lock->write_wait.last; + lock->write_wait.last= &data->next; + data->cond=get_cond(); + /* + We don't have to do get_status here as we will do it when we change + the delayed lock to a real write lock + */ + statistic_increment(locks_immediate,&THR_LOCK_lock); + goto end; + } + } + else if (lock_type == TL_WRITE_CONCURRENT_INSERT && ! lock->check_status) + data->type=lock_type= thr_upgraded_concurrent_insert_lock; + + if (lock->write.data) /* If there is a write lock */ + { + if (lock->write.data->type == TL_WRITE_ONLY) + { + /* purecov: begin tested */ + /* Allow lock owner to bypass TL_WRITE_ONLY. */ + if (!thr_lock_owner_equal(data->owner, lock->write.data->owner)) + { + /* We are not allowed to get a lock in this case */ + data->type=TL_UNLOCK; + result= THR_LOCK_ABORTED; /* Can't wait for this one */ + goto end; + } + /* purecov: end */ + } + + /* + The following test will not work if the old lock was a + TL_WRITE_ALLOW_WRITE, TL_WRITE_ALLOW_READ or TL_WRITE_DELAYED in + the same thread, but this will never happen within MySQL. + + The idea is to allow us to get a lock at once if we already have + a write lock or if there is no pending write locks and if all + write locks are of the same type and are either + TL_WRITE_ALLOW_WRITE or TL_WRITE_CONCURRENT_INSERT + */ + if (thr_lock_owner_equal(data->owner, lock->write.data->owner) || + (!lock->write_wait.data && lock_type == lock->write.data->type && + (lock_type == TL_WRITE_ALLOW_WRITE || + (lock_type == TL_WRITE_CONCURRENT_INSERT && + lock->allow_multiple_concurrent_insert)))) + { + DBUG_PRINT("info", ("write_wait.data: %p old_type: %d", + lock->write_wait.data, + lock->write.data->type)); + + (*lock->write.last)=data; /* Add to running fifo */ + data->prev=lock->write.last; + lock->write.last= &data->next; + check_locks(lock,"second write lock",0); + if (lock->get_status) + (*lock->get_status)(data->status_param, + lock_type == TL_WRITE_CONCURRENT_INSERT); + statistic_increment(locks_immediate,&THR_LOCK_lock); + goto end; + } + DBUG_PRINT("lock",("write locked 2 by thread: 0x%lx", + lock->write.data->owner->info->thread_id)); + } + else + { + DBUG_PRINT("info", ("write_wait.data: %p", + lock->write_wait.data)); + if (!lock->write_wait.data) + { /* no scheduled write locks */ + my_bool concurrent_insert= 0; + if (lock_type == TL_WRITE_CONCURRENT_INSERT) + { + concurrent_insert= 1; + if ((*lock->check_status)(data->status_param)) + { + concurrent_insert= 0; + data->type=lock_type= thr_upgraded_concurrent_insert_lock; + } + } + + if (!lock->read.data || + (lock_type <= TL_WRITE_DELAYED && + ((lock_type != TL_WRITE_CONCURRENT_INSERT && + lock_type != TL_WRITE_ALLOW_WRITE) || + !lock->read_no_write_count))) + { + (*lock->write.last)=data; /* Add as current write lock */ + data->prev=lock->write.last; + lock->write.last= &data->next; + if (lock->get_status) + (*lock->get_status)(data->status_param, concurrent_insert); + check_locks(lock,"only write lock",0); + statistic_increment(locks_immediate,&THR_LOCK_lock); + goto end; + } + } + DBUG_PRINT("lock",("write locked 3 by thread: 0x%lx type: %d", + lock->read.data->owner->info->thread_id, data->type)); + } + wait_queue= &lock->write_wait; + } + /* + Try to detect a trivial deadlock when using cursors: attempt to + lock a table that is already locked by an open cursor within the + same connection. lock_owner can be zero if we succumbed to a high + priority writer in the write_wait queue. + */ + lock_owner= lock->read.data ? lock->read.data : lock->write.data; + if (lock_owner && lock_owner->owner->info == owner->info) + { + DBUG_PRINT("lock",("deadlock")); + result= THR_LOCK_DEADLOCK; + goto end; + } + /* Can't get lock yet; Wait for it */ + DBUG_RETURN(wait_for_lock(wait_queue, data, 0)); +end: + pthread_mutex_unlock(&lock->mutex); + DBUG_RETURN(result); +} + + +static inline void free_all_read_locks(THR_LOCK *lock, + my_bool using_concurrent_insert) +{ + THR_LOCK_DATA *data=lock->read_wait.data; + + check_locks(lock,"before freeing read locks",1); + + /* move all locks from read_wait list to read list */ + (*lock->read.last)=data; + data->prev=lock->read.last; + lock->read.last=lock->read_wait.last; + + /* Clear read_wait list */ + lock->read_wait.last= &lock->read_wait.data; + + do + { + pthread_cond_t *cond=data->cond; + if ((int) data->type == (int) TL_READ_NO_INSERT) + { + if (using_concurrent_insert) + { + /* + We can't free this lock; + Link lock away from read chain back into read_wait chain + */ + if (((*data->prev)=data->next)) + data->next->prev=data->prev; + else + lock->read.last=data->prev; + *lock->read_wait.last= data; + data->prev= lock->read_wait.last; + lock->read_wait.last= &data->next; + continue; + } + lock->read_no_write_count++; + } + /* purecov: begin inspected */ + DBUG_PRINT("lock",("giving read lock to thread: 0x%lx", + data->owner->info->thread_id)); + /* purecov: end */ + data->cond=0; /* Mark thread free */ + pthread_cond_signal(cond); + } while ((data=data->next)); + *lock->read_wait.last=0; + if (!lock->read_wait.data) + lock->write_lock_count=0; + check_locks(lock,"after giving read locks",0); +} + + /* Unlock lock and free next thread on same lock */ + +void thr_unlock(THR_LOCK_DATA *data) +{ + THR_LOCK *lock=data->lock; + enum thr_lock_type lock_type=data->type; + DBUG_ENTER("thr_unlock"); + DBUG_PRINT("lock",("data: %p thread: 0x%lx lock: %p", + data, data->owner->info->thread_id, lock)); + pthread_mutex_lock(&lock->mutex); + check_locks(lock,"start of release lock",0); + + if (((*data->prev)=data->next)) /* remove from lock-list */ + data->next->prev= data->prev; + else if (lock_type <= TL_READ_NO_INSERT) + lock->read.last=data->prev; + else if (lock_type == TL_WRITE_DELAYED && data->cond) + { + /* + This only happens in extreme circumstances when a + write delayed lock that is waiting for a lock + */ + lock->write_wait.last=data->prev; /* Put it on wait queue */ + } + else + lock->write.last=data->prev; + if (lock_type == TL_READ_NO_INSERT) + lock->read_no_write_count--; + data->type=TL_UNLOCK; /* Mark unlocked */ + check_locks(lock,"after releasing lock",1); + wake_up_waiters(lock); + pthread_mutex_unlock(&lock->mutex); + DBUG_VOID_RETURN; +} + + +/** + @brief Wake up all threads which pending requests for the lock + can be satisfied. + + @param lock Lock for which threads should be woken up + +*/ + +static void wake_up_waiters(THR_LOCK *lock) +{ + THR_LOCK_DATA *data; + enum thr_lock_type lock_type; + DBUG_ENTER("wake_up_waiters"); + + if (!lock->write.data) /* If no active write locks */ + { + data=lock->write_wait.data; + if (!lock->read.data) /* If no more locks in use */ + { + /* Release write-locks with TL_WRITE or TL_WRITE_ONLY priority first */ + if (data && + (data->type != TL_WRITE_LOW_PRIORITY || !lock->read_wait.data || + lock->read_wait.data->type < TL_READ_HIGH_PRIORITY)) + { + if (lock->write_lock_count++ > max_write_lock_count) + { + /* Too many write locks in a row; Release all waiting read locks */ + lock->write_lock_count=0; + if (lock->read_wait.data) + { + DBUG_PRINT("info",("Freeing all read_locks because of max_write_lock_count")); + free_all_read_locks(lock,0); + goto end; + } + } + for (;;) + { + if (((*data->prev)=data->next)) /* remove from wait-list */ + data->next->prev= data->prev; + else + lock->write_wait.last=data->prev; + (*lock->write.last)=data; /* Put in execute list */ + data->prev=lock->write.last; + data->next=0; + lock->write.last= &data->next; + if (data->type == TL_WRITE_CONCURRENT_INSERT && + (*lock->check_status)(data->status_param)) + data->type=TL_WRITE; /* Upgrade lock */ + /* purecov: begin inspected */ + DBUG_PRINT("lock",("giving write lock of type %d to thread: 0x%lx", + data->type, data->owner->info->thread_id)); + /* purecov: end */ + { + pthread_cond_t *cond=data->cond; + data->cond=0; /* Mark thread free */ + pthread_cond_signal(cond); /* Start waiting thread */ + } + if (data->type != TL_WRITE_ALLOW_WRITE || + !lock->write_wait.data || + lock->write_wait.data->type != TL_WRITE_ALLOW_WRITE) + break; + data=lock->write_wait.data; /* Free this too */ + } + if (data->type >= TL_WRITE_LOW_PRIORITY) + goto end; + /* Release possible read locks together with the write lock */ + } + if (lock->read_wait.data) + free_all_read_locks(lock, + data && + (data->type == TL_WRITE_CONCURRENT_INSERT || + data->type == TL_WRITE_ALLOW_WRITE)); + else + { + DBUG_PRINT("lock",("No waiting read locks to free")); + } + } + else if (data && + (lock_type=data->type) <= TL_WRITE_DELAYED && + ((lock_type != TL_WRITE_CONCURRENT_INSERT && + lock_type != TL_WRITE_ALLOW_WRITE) || + !lock->read_no_write_count)) + { + /* + For DELAYED, ALLOW_READ, WRITE_ALLOW_WRITE or CONCURRENT_INSERT locks + start WRITE locks together with the READ locks + */ + if (lock_type == TL_WRITE_CONCURRENT_INSERT && + (*lock->check_status)(data->status_param)) + { + data->type=TL_WRITE; /* Upgrade lock */ + if (lock->read_wait.data) + free_all_read_locks(lock,0); + goto end; + } + do { + pthread_cond_t *cond=data->cond; + if (((*data->prev)=data->next)) /* remove from wait-list */ + data->next->prev= data->prev; + else + lock->write_wait.last=data->prev; + (*lock->write.last)=data; /* Put in execute list */ + data->prev=lock->write.last; + lock->write.last= &data->next; + data->next=0; /* Only one write lock */ + data->cond=0; /* Mark thread free */ + pthread_cond_signal(cond); /* Start waiting thread */ + } while (lock_type == TL_WRITE_ALLOW_WRITE && + (data=lock->write_wait.data) && + data->type == TL_WRITE_ALLOW_WRITE); + if (lock->read_wait.data) + free_all_read_locks(lock, + (lock_type == TL_WRITE_CONCURRENT_INSERT || + lock_type == TL_WRITE_ALLOW_WRITE)); + } + else if (!data && lock->read_wait.data) + free_all_read_locks(lock,0); + } +end: + check_locks(lock, "after waking up waiters", 0); + DBUG_VOID_RETURN; +} + + +/* +** Get all locks in a specific order to avoid dead-locks +** Sort acording to lock position and put write_locks before read_locks if +** lock on same lock. +*/ + + +#define LOCK_CMP(A,B) ((uchar*) (A->lock) - (uint) ((A)->type) < (uchar*) (B->lock)- (uint) ((B)->type)) + +static void sort_locks(THR_LOCK_DATA **data,uint count) +{ + THR_LOCK_DATA **pos,**end,**prev,*tmp; + + /* Sort locks with insertion sort (fast because almost always few locks) */ + + for (pos=data+1,end=data+count; pos < end ; pos++) + { + tmp= *pos; + if (LOCK_CMP(tmp,pos[-1])) + { + prev=pos; + do { + prev[0]=prev[-1]; + } while (--prev != data && LOCK_CMP(tmp,prev[-1])); + prev[0]=tmp; + } + } +} + + +enum enum_thr_lock_result +thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_OWNER *owner) +{ + THR_LOCK_DATA **pos,**end; + DBUG_ENTER("thr_multi_lock"); + DBUG_PRINT("lock",("data: %p count: %d", data, count)); + if (count > 1) + sort_locks(data,count); + /* lock everything */ + for (pos=data,end=data+count; pos < end ; pos++) + { + enum enum_thr_lock_result result= thr_lock(*pos, owner, (*pos)->type); + if (result != THR_LOCK_SUCCESS) + { /* Aborted */ + thr_multi_unlock(data,(uint) (pos-data)); + DBUG_RETURN(result); + } +#ifdef MAIN + printf("Thread: %s Got lock: 0x%lx type: %d\n",my_thread_name(), + (long) pos[0]->lock, pos[0]->type); fflush(stdout); +#endif + } + thr_lock_merge_status(data, count); + DBUG_RETURN(THR_LOCK_SUCCESS); +} + + +/** + Ensure that all locks for a given table have the same + status_param. + + This is a MyISAM and possibly Maria specific crutch. MyISAM + engine stores data file length, record count and other table + properties in status_param member of handler. When a table is + locked, connection-local copy is made from a global copy + (myisam_share) by mi_get_status(). When a table is unlocked, + the changed status is transferred back to the global share by + mi_update_status(). + + One thing MyISAM doesn't do is to ensure that when the same + table is opened twice in a connection all instances share the + same status_param. This is necessary, however: for one, to keep + all instances of a connection "on the same page" with regard to + the current state of the table. For other, unless this is done, + myisam_share will always get updated from the last unlocked + instance (in mi_update_status()), and when this instance was not + the one that was used to update data, records may be lost. + + For each table, this function looks up the last lock_data in the + list of acquired locks, and makes sure that all other instances + share status_param with it. +*/ + +void +thr_lock_merge_status(THR_LOCK_DATA **data, uint count) +{ +#if !defined(DONT_USE_RW_LOCKS) + THR_LOCK_DATA **pos= data; + THR_LOCK_DATA **end= data + count; + if (count > 1) + { + THR_LOCK_DATA *last_lock= end[-1]; + pos=end-1; + do + { + pos--; + if (last_lock->lock == (*pos)->lock && + last_lock->lock->copy_status) + { + if (last_lock->type <= TL_READ_NO_INSERT) + { + THR_LOCK_DATA **read_lock; + /* + If we are locking the same table with read locks we must ensure + that all tables share the status of the last write lock or + the same read lock. + */ + for (; + (*pos)->type <= TL_READ_NO_INSERT && + pos != data && + pos[-1]->lock == (*pos)->lock ; + pos--) ; + + read_lock = pos+1; + do + { + (last_lock->lock->copy_status)((*read_lock)->status_param, + (*pos)->status_param); + } while (*(read_lock++) != last_lock); + last_lock= (*pos); /* Point at last write lock */ + } + else + (*last_lock->lock->copy_status)((*pos)->status_param, + last_lock->status_param); + } + else + last_lock=(*pos); + } while (pos != data); + } +#endif +} + + /* free all locks */ + +void thr_multi_unlock(THR_LOCK_DATA **data,uint count) +{ + THR_LOCK_DATA **pos,**end; + DBUG_ENTER("thr_multi_unlock"); + DBUG_PRINT("lock",("data: %p count: %d", data, count)); + + for (pos=data,end=data+count; pos < end ; pos++) + { +#ifdef MAIN + printf("Thread: %s Rel lock: 0x%lx type: %d\n", + my_thread_name(), (long) pos[0]->lock, pos[0]->type); + fflush(stdout); +#endif + if ((*pos)->type != TL_UNLOCK) + thr_unlock(*pos); + else + { + DBUG_PRINT("lock",("Free lock: data: %p thread: 0x%lx lock: %p", + *pos, (*pos)->owner->info->thread_id, + (*pos)->lock)); + } + } + DBUG_VOID_RETURN; +} + +/* + Abort all threads waiting for a lock. The lock will be upgraded to + TL_WRITE_ONLY to abort any new accesses to the lock +*/ + +void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock) +{ + THR_LOCK_DATA *data; + DBUG_ENTER("thr_abort_locks"); + pthread_mutex_lock(&lock->mutex); + + for (data=lock->read_wait.data; data ; data=data->next) + { + data->type=TL_UNLOCK; /* Mark killed */ + /* It's safe to signal the cond first: we're still holding the mutex. */ + pthread_cond_signal(data->cond); + data->cond=0; /* Removed from list */ + } + for (data=lock->write_wait.data; data ; data=data->next) + { + data->type=TL_UNLOCK; + pthread_cond_signal(data->cond); + data->cond=0; + } + lock->read_wait.last= &lock->read_wait.data; + lock->write_wait.last= &lock->write_wait.data; + lock->read_wait.data=lock->write_wait.data=0; + if (upgrade_lock && lock->write.data) + lock->write.data->type=TL_WRITE_ONLY; + pthread_mutex_unlock(&lock->mutex); + DBUG_VOID_RETURN; +} + + +/* + Abort all locks for specific table/thread combination + + This is used to abort all locks for a specific thread +*/ + +my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id) +{ + THR_LOCK_DATA *data; + my_bool found= FALSE; + DBUG_ENTER("thr_abort_locks_for_thread"); + + pthread_mutex_lock(&lock->mutex); + for (data= lock->read_wait.data; data ; data= data->next) + { + if (data->owner->info->thread_id == thread_id) /* purecov: tested */ + { + DBUG_PRINT("info",("Aborting read-wait lock")); + data->type= TL_UNLOCK; /* Mark killed */ + /* It's safe to signal the cond first: we're still holding the mutex. */ + found= TRUE; + pthread_cond_signal(data->cond); + data->cond= 0; /* Removed from list */ + + if (((*data->prev)= data->next)) + data->next->prev= data->prev; + else + lock->read_wait.last= data->prev; + } + } + for (data= lock->write_wait.data; data ; data= data->next) + { + if (data->owner->info->thread_id == thread_id) /* purecov: tested */ + { + DBUG_PRINT("info",("Aborting write-wait lock")); + data->type= TL_UNLOCK; + found= TRUE; + pthread_cond_signal(data->cond); + data->cond= 0; + + if (((*data->prev)= data->next)) + data->next->prev= data->prev; + else + lock->write_wait.last= data->prev; + } + } + wake_up_waiters(lock); + pthread_mutex_unlock(&lock->mutex); + DBUG_RETURN(found); +} + + +/* + Downgrade a WRITE_* to a lower WRITE level + SYNOPSIS + thr_downgrade_write_lock() + in_data Lock data of thread downgrading its lock + new_lock_type New write lock type + RETURN VALUE + NONE + DESCRIPTION + This can be used to downgrade a lock already owned. When the downgrade + occurs also other waiters, both readers and writers can be allowed to + start. + The previous lock is often TL_WRITE_ONLY but can also be + TL_WRITE and TL_WRITE_ALLOW_READ. The normal downgrade variants are + TL_WRITE_ONLY => TL_WRITE_ALLOW_READ After a short exclusive lock + TL_WRITE_ALLOW_READ => TL_WRITE_ALLOW_WRITE After discovering that the + operation didn't need such a high lock. + TL_WRITE_ONLY => TL_WRITE after a short exclusive lock while holding a + write table lock + TL_WRITE_ONLY => TL_WRITE_ALLOW_WRITE After a short exclusive lock after + already earlier having dongraded lock to TL_WRITE_ALLOW_WRITE + The implementation is conservative and rather don't start rather than + go on unknown paths to start, the common cases are handled. + + NOTE: + In its current implementation it is only allowed to downgrade from + TL_WRITE_ONLY. In this case there are no waiters. Thus no wake up + logic is required. +*/ + +void thr_downgrade_write_lock(THR_LOCK_DATA *in_data, + enum thr_lock_type new_lock_type) +{ + THR_LOCK *lock=in_data->lock; +#ifndef DBUG_OFF + enum thr_lock_type old_lock_type= in_data->type; +#endif + DBUG_ENTER("thr_downgrade_write_only_lock"); + + pthread_mutex_lock(&lock->mutex); + DBUG_ASSERT(old_lock_type == TL_WRITE_ONLY); + DBUG_ASSERT(old_lock_type > new_lock_type); + in_data->type= new_lock_type; + check_locks(lock,"after downgrading lock",0); + + pthread_mutex_unlock(&lock->mutex); + DBUG_VOID_RETURN; +} + +/* Upgrade a WRITE_DELAY lock to a WRITE_LOCK */ + +my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data, + enum thr_lock_type new_lock_type) +{ + THR_LOCK *lock=data->lock; + DBUG_ENTER("thr_upgrade_write_delay_lock"); + + pthread_mutex_lock(&lock->mutex); + if (data->type == TL_UNLOCK || data->type >= TL_WRITE_LOW_PRIORITY) + { + pthread_mutex_unlock(&lock->mutex); + DBUG_RETURN(data->type == TL_UNLOCK); /* Test if Aborted */ + } + check_locks(lock,"before upgrading lock",0); + /* TODO: Upgrade to TL_WRITE_CONCURRENT_INSERT in some cases */ + data->type= new_lock_type; /* Upgrade lock */ + + /* Check if someone has given us the lock */ + if (!data->cond) + { + if (!lock->read.data) /* No read locks */ + { /* We have the lock */ + if (lock->get_status) + (*lock->get_status)(data->status_param, 0); + pthread_mutex_unlock(&lock->mutex); + DBUG_RETURN(0); + } + + if (((*data->prev)=data->next)) /* remove from lock-list */ + data->next->prev= data->prev; + else + lock->write.last=data->prev; + + if ((data->next=lock->write_wait.data)) /* Put first in lock_list */ + data->next->prev= &data->next; + else + lock->write_wait.last= &data->next; + data->prev= &lock->write_wait.data; + lock->write_wait.data=data; + check_locks(lock,"upgrading lock",0); + } + else + { + check_locks(lock,"waiting for lock",0); + } + DBUG_RETURN(wait_for_lock(&lock->write_wait,data,1)); +} + + +/* downgrade a WRITE lock to a WRITE_DELAY lock if there is pending locks */ + +my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data) +{ + THR_LOCK *lock=data->lock; + enum thr_lock_type write_lock_type; + DBUG_ENTER("thr_reschedule_write_lock"); + + pthread_mutex_lock(&lock->mutex); + if (!lock->read_wait.data) /* No waiting read locks */ + { + pthread_mutex_unlock(&lock->mutex); + DBUG_RETURN(0); + } + + write_lock_type= data->type; + data->type=TL_WRITE_DELAYED; + if (lock->update_status) + (*lock->update_status)(data->status_param); + if (((*data->prev)=data->next)) /* remove from lock-list */ + data->next->prev= data->prev; + else + lock->write.last=data->prev; + + if ((data->next=lock->write_wait.data)) /* Put first in lock_list */ + data->next->prev= &data->next; + else + lock->write_wait.last= &data->next; + data->prev= &lock->write_wait.data; + data->cond=get_cond(); /* This was zero */ + lock->write_wait.data=data; + free_all_read_locks(lock,0); + + pthread_mutex_unlock(&lock->mutex); + DBUG_RETURN(thr_upgrade_write_delay_lock(data, write_lock_type)); +} + + +#include + +static void thr_print_lock(const char* name,struct st_lock_list *list) +{ + THR_LOCK_DATA *data,**prev; + uint count=0; + + if (list->data) + { + printf("%-10s: ",name); + prev= &list->data; + for (data=list->data; data && count++ < MAX_LOCKS ; data=data->next) + { + printf("0x%lx (%lu:%d); ", (ulong) data, data->owner->info->thread_id, + (int) data->type); + if (data->prev != prev) + printf("\nWarning: prev didn't point at previous lock\n"); + prev= &data->next; + } + puts(""); + if (prev != list->last) + printf("Warning: last didn't point at last lock\n"); + } +} + +void thr_print_locks(void) +{ + LIST *list; + uint count=0; + + pthread_mutex_lock(&THR_LOCK_lock); + puts("Current locks:"); + for (list= thr_lock_thread_list; list && count++ < MAX_THREADS; + list= list_rest(list)) + { + THR_LOCK *lock=(THR_LOCK*) list->data; + pthread_mutex_lock(&lock->mutex); + printf("lock: 0x%lx:",(ulong) lock); + if ((lock->write_wait.data || lock->read_wait.data) && + (! lock->read.data && ! lock->write.data)) + printf(" WARNING: "); + if (lock->write.data) + printf(" write"); + if (lock->write_wait.data) + printf(" write_wait"); + if (lock->read.data) + printf(" read"); + if (lock->read_wait.data) + printf(" read_wait"); + puts(""); + thr_print_lock("write",&lock->write); + thr_print_lock("write_wait",&lock->write_wait); + thr_print_lock("read",&lock->read); + thr_print_lock("read_wait",&lock->read_wait); + pthread_mutex_unlock(&lock->mutex); + puts(""); + } + fflush(stdout); + pthread_mutex_unlock(&THR_LOCK_lock); +} + +#endif /* THREAD */ + +/***************************************************************************** +** Test of thread locks +****************************************************************************/ + +#ifdef MAIN + +#ifdef THREAD + +struct st_test { + uint lock_nr; + enum thr_lock_type lock_type; +}; + +THR_LOCK locks[6]; /* Number of locks +1 */ + +struct st_test test_0[] = {{0,TL_READ}}; /* One lock */ +struct st_test test_1[] = {{0,TL_READ},{0,TL_WRITE}}; /* Read and write lock of lock 0 */ +struct st_test test_2[] = {{1,TL_WRITE},{0,TL_READ},{2,TL_READ}}; +struct st_test test_3[] = {{2,TL_WRITE},{1,TL_READ},{0,TL_READ}}; /* Deadlock with test_2 ? */ +struct st_test test_4[] = {{0,TL_WRITE},{0,TL_READ},{0,TL_WRITE},{0,TL_READ}}; +struct st_test test_5[] = {{0,TL_READ},{1,TL_READ},{2,TL_READ},{3,TL_READ}}; /* Many reads */ +struct st_test test_6[] = {{0,TL_WRITE},{1,TL_WRITE},{2,TL_WRITE},{3,TL_WRITE}}; /* Many writes */ +struct st_test test_7[] = {{3,TL_READ}}; +struct st_test test_8[] = {{1,TL_READ_NO_INSERT},{2,TL_READ_NO_INSERT},{3,TL_READ_NO_INSERT}}; /* Should be quick */ +struct st_test test_9[] = {{4,TL_READ_HIGH_PRIORITY}}; +struct st_test test_10[] ={{4,TL_WRITE}}; +struct st_test test_11[] = {{0,TL_WRITE_LOW_PRIORITY},{1,TL_WRITE_LOW_PRIORITY},{2,TL_WRITE_LOW_PRIORITY},{3,TL_WRITE_LOW_PRIORITY}}; /* Many writes */ +struct st_test test_12[] = {{0,TL_WRITE_ALLOW_READ},{1,TL_WRITE_ALLOW_READ},{2,TL_WRITE_ALLOW_READ},{3,TL_WRITE_ALLOW_READ}}; /* Many writes */ +struct st_test test_13[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_WRITE_CONCURRENT_INSERT},{2,TL_WRITE_CONCURRENT_INSERT},{3,TL_WRITE_CONCURRENT_INSERT}}; +struct st_test test_14[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_READ}}; +struct st_test test_15[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_READ}}; +struct st_test test_16[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_WRITE_ALLOW_WRITE}}; + +struct st_test test_17[] = {{5,TL_WRITE_CONCURRENT_INSERT}}; +struct st_test test_18[] = {{5,TL_WRITE_CONCURRENT_INSERT}}; +struct st_test test_19[] = {{5,TL_READ}}; +struct st_test test_20[] = {{5,TL_READ_NO_INSERT}}; +struct st_test test_21[] = {{5,TL_WRITE}}; + + +struct st_test *tests[]= +{ + test_0, test_1, test_2, test_3, test_4, test_5, test_6, test_7, test_8, + test_9, test_10, test_11, test_12, test_13, test_14, test_15, test_16, + test_17, test_18, test_19, test_20, test_21 +}; + +int lock_counts[]= {sizeof(test_0)/sizeof(struct st_test), + sizeof(test_1)/sizeof(struct st_test), + sizeof(test_2)/sizeof(struct st_test), + sizeof(test_3)/sizeof(struct st_test), + sizeof(test_4)/sizeof(struct st_test), + sizeof(test_5)/sizeof(struct st_test), + sizeof(test_6)/sizeof(struct st_test), + sizeof(test_7)/sizeof(struct st_test), + sizeof(test_8)/sizeof(struct st_test), + sizeof(test_9)/sizeof(struct st_test), + sizeof(test_10)/sizeof(struct st_test), + sizeof(test_11)/sizeof(struct st_test), + sizeof(test_12)/sizeof(struct st_test), + sizeof(test_13)/sizeof(struct st_test), + sizeof(test_14)/sizeof(struct st_test), + sizeof(test_15)/sizeof(struct st_test), + sizeof(test_16)/sizeof(struct st_test), + sizeof(test_17)/sizeof(struct st_test), + sizeof(test_18)/sizeof(struct st_test), + sizeof(test_19)/sizeof(struct st_test), + sizeof(test_20)/sizeof(struct st_test), + sizeof(test_21)/sizeof(struct st_test) +}; + + +static pthread_cond_t COND_thread_count; +static pthread_mutex_t LOCK_thread_count; +static uint thread_count; +static ulong sum=0; + +#define MAX_LOCK_COUNT 8 + +/* The following functions is for WRITE_CONCURRENT_INSERT */ + +static void test_get_status(void* param __attribute__((unused)), + int concurrent_insert __attribute__((unused))) +{ +} + +static void test_update_status(void* param __attribute__((unused))) +{ +} + +static void test_copy_status(void* to __attribute__((unused)) , + void *from __attribute__((unused))) +{ +} + +static my_bool test_check_status(void* param __attribute__((unused))) +{ + return 0; +} + + +static void *test_thread(void *arg) +{ + int i,j,param=*((int*) arg); + THR_LOCK_DATA data[MAX_LOCK_COUNT]; + THR_LOCK_OWNER owner; + THR_LOCK_INFO lock_info; + THR_LOCK_DATA *multi_locks[MAX_LOCK_COUNT]; + my_thread_init(); + + printf("Thread %s (%d) started\n",my_thread_name(),param); fflush(stdout); + + thr_lock_info_init(&lock_info); + thr_lock_owner_init(&owner, &lock_info); + for (i=0; i < lock_counts[param] ; i++) + thr_lock_data_init(locks+tests[param][i].lock_nr,data+i,NULL); + for (j=1 ; j < 10 ; j++) /* try locking 10 times */ + { + for (i=0; i < lock_counts[param] ; i++) + { /* Init multi locks */ + multi_locks[i]= &data[i]; + data[i].type= tests[param][i].lock_type; + } + thr_multi_lock(multi_locks, lock_counts[param], &owner); + pthread_mutex_lock(&LOCK_thread_count); + { + int tmp=rand() & 7; /* Do something from 0-2 sec */ + if (tmp == 0) + sleep(1); + else if (tmp == 1) + sleep(2); + else + { + ulong k; + for (k=0 ; k < (ulong) (tmp-2)*100000L ; k++) + sum+=k; + } + } + pthread_mutex_unlock(&LOCK_thread_count); + thr_multi_unlock(multi_locks,lock_counts[param]); + } + + printf("Thread %s (%d) ended\n",my_thread_name(),param); fflush(stdout); + thr_print_locks(); + pthread_mutex_lock(&LOCK_thread_count); + thread_count--; + pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */ + pthread_mutex_unlock(&LOCK_thread_count); + free((uchar*) arg); + return 0; +} + + +int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) +{ + pthread_t tid; + pthread_attr_t thr_attr; + int *param,error; + uint i; + MY_INIT(argv[0]); + if (argc > 1 && argv[1][0] == '-' && argv[1][1] == '#') + DBUG_PUSH(argv[1]+2); + + printf("Main thread: %s\n",my_thread_name()); + + if ((error=pthread_cond_init(&COND_thread_count,NULL))) + { + fprintf(stderr,"Got error: %d from pthread_cond_init (errno: %d)", + error,errno); + exit(1); + } + if ((error=pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST))) + { + fprintf(stderr,"Got error: %d from pthread_cond_init (errno: %d)", + error,errno); + exit(1); + } + + for (i=0 ; i < array_elements(locks) ; i++) + { + thr_lock_init(locks+i); + locks[i].check_status= test_check_status; + locks[i].update_status=test_update_status; + locks[i].copy_status= test_copy_status; + locks[i].get_status= test_get_status; + locks[i].allow_multiple_concurrent_insert= 1; + } + if ((error=pthread_attr_init(&thr_attr))) + { + fprintf(stderr,"Got error: %d from pthread_attr_init (errno: %d)", + error,errno); + exit(1); + } + if ((error=pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED))) + { + fprintf(stderr, + "Got error: %d from pthread_attr_setdetachstate (errno: %d)", + error,errno); + exit(1); + } +#ifndef pthread_attr_setstacksize /* void return value */ + if ((error=pthread_attr_setstacksize(&thr_attr,65536L))) + { + fprintf(stderr,"Got error: %d from pthread_attr_setstacksize (errno: %d)", + error,errno); + exit(1); + } +#endif +#ifdef HAVE_THR_SETCONCURRENCY + (void) thr_setconcurrency(2); +#endif + for (i=0 ; i < array_elements(lock_counts) ; i++) + { + param=(int*) malloc(sizeof(int)); + *param=i; + + if ((error=pthread_mutex_lock(&LOCK_thread_count))) + { + fprintf(stderr,"Got error: %d from pthread_mutex_lock (errno: %d)", + error,errno); + exit(1); + } + if ((error=pthread_create(&tid,&thr_attr,test_thread,(void*) param))) + { + fprintf(stderr,"Got error: %d from pthread_create (errno: %d)\n", + error,errno); + pthread_mutex_unlock(&LOCK_thread_count); + exit(1); + } + thread_count++; + pthread_mutex_unlock(&LOCK_thread_count); + } + + pthread_attr_destroy(&thr_attr); + if ((error=pthread_mutex_lock(&LOCK_thread_count))) + fprintf(stderr,"Got error: %d from pthread_mutex_lock\n",error); + while (thread_count) + { + if ((error=pthread_cond_wait(&COND_thread_count,&LOCK_thread_count))) + fprintf(stderr,"Got error: %d from pthread_cond_wait\n",error); + } + if ((error=pthread_mutex_unlock(&LOCK_thread_count))) + fprintf(stderr,"Got error: %d from pthread_mutex_unlock\n",error); + for (i=0 ; i < array_elements(locks) ; i++) + thr_lock_delete(locks+i); +#ifdef EXTRA_DEBUG + if (found_errors) + printf("Got %d warnings\n",found_errors); + else +#endif + printf("Test succeeded\n"); + return 0; +} + +#else /* THREAD */ + +int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) +{ + printf("thr_lock disabled because we are not using threads\n"); + exit(1); +} + +#endif /* THREAD */ +#endif /* MAIN */ diff --git a/externals/mysql/mysys/thr_mutex.c b/externals/mysql/mysys/thr_mutex.c new file mode 100644 index 0000000..9c7eb71 --- /dev/null +++ b/externals/mysql/mysys/thr_mutex.c @@ -0,0 +1,875 @@ +/* Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This makes a wrapper for mutex handling to make it easier to debug mutex */ + +#include +#if defined(TARGET_OS_LINUX) && !defined (__USE_UNIX98) +#define __USE_UNIX98 /* To get rw locks under Linux */ +#endif +#if defined(THREAD) && defined(SAFE_MUTEX) +#undef SAFE_MUTEX /* Avoid safe_mutex redefinitions */ +#include "mysys_priv.h" +#include "my_static.h" +#include +#include + +#ifndef DO_NOT_REMOVE_THREAD_WRAPPERS +/* Remove wrappers */ +#undef pthread_mutex_t +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_unlock +#undef pthread_mutex_destroy +#undef pthread_cond_wait +#undef pthread_cond_timedwait +#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT +#define pthread_mutex_init(a,b) my_pthread_noposix_mutex_init((a),(b)) +#endif +#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */ + +static pthread_mutex_t THR_LOCK_mutex; +static ulong safe_mutex_count= 0; /* Number of mutexes created */ +static ulong safe_mutex_id= 0; +my_bool safe_mutex_deadlock_detector= 1; /* On by default */ + +#ifdef SAFE_MUTEX_DETECT_DESTROY +static struct st_safe_mutex_create_info_t *safe_mutex_create_root= NULL; +#endif + +static my_bool add_used_to_locked_mutex(safe_mutex_t *used_mutex, + safe_mutex_deadlock_t *locked_mutex); +static my_bool add_to_locked_mutex(safe_mutex_deadlock_t *locked_mutex, + safe_mutex_t *current_mutex); +static my_bool remove_from_locked_mutex(safe_mutex_t *mp, + safe_mutex_t *delete_mutex); +static my_bool remove_from_used_mutex(safe_mutex_deadlock_t *locked_mutex, + safe_mutex_t *mutex); +static void print_deadlock_warning(safe_mutex_t *new_mutex, + safe_mutex_t *conflicting_mutex); + +void safe_mutex_global_init(void) +{ + pthread_mutex_init(&THR_LOCK_mutex,MY_MUTEX_INIT_FAST); + safe_mutex_id= safe_mutex_count= 0; + safe_mutex_deadlock_detector= 1; + +#ifdef SAFE_MUTEX_DETECT_DESTROY + safe_mutex_create_root= 0; +#endif +} + +static inline void remove_from_active_list(safe_mutex_t *mp) +{ + if (!(mp->active_flags & (MYF_NO_DEADLOCK_DETECTION | MYF_TRY_LOCK))) + { + /* Remove mutex from active mutex linked list */ + if (mp->next) + mp->next->prev= mp->prev; + if (mp->prev) + mp->prev->next= mp->next; + else + *my_thread_var_mutex_in_use()= mp->next; + } + mp->prev= mp->next= 0; +} + + +int safe_mutex_init(safe_mutex_t *mp, + const pthread_mutexattr_t *attr __attribute__((unused)), + const char *name, + myf my_flags, + const char *file, + uint line) +{ + DBUG_ENTER("safe_mutex_init"); + DBUG_PRINT("enter",("mutex: 0x%lx name: %s", (ulong) mp, name)); + bzero((char*) mp,sizeof(*mp)); + pthread_mutex_init(&mp->global,MY_MUTEX_INIT_ERRCHK); + pthread_mutex_init(&mp->mutex,attr); + /* Mark that mutex is initialized */ + mp->file= file; + mp->line= line; + /* Skip the very common '&' prefix from the autogenerated name */ + mp->name= name[0] == '&' ? name + 1 : name; + + if (safe_mutex_deadlock_detector && !( my_flags & MYF_NO_DEADLOCK_DETECTION)) + { + if (!my_multi_malloc(MY_FAE | MY_WME, + &mp->locked_mutex, sizeof(*mp->locked_mutex), + &mp->used_mutex, sizeof(*mp->used_mutex), NullS)) + { + /* Disable deadlock handling for this mutex */ + my_flags|= MYF_NO_DEADLOCK_DETECTION; + } + else + { + pthread_mutex_lock(&THR_LOCK_mutex); + mp->id= ++safe_mutex_id; + pthread_mutex_unlock(&THR_LOCK_mutex); + my_hash_init(mp->locked_mutex, &my_charset_bin, + 1000, + offsetof(safe_mutex_deadlock_t, id), + sizeof(mp->id), + 0, 0, HASH_UNIQUE); + my_hash_init(mp->used_mutex, &my_charset_bin, + 1000, + offsetof(safe_mutex_t, id), + sizeof(mp->id), + 0, 0, HASH_UNIQUE); + } + } + else + my_flags|= MYF_NO_DEADLOCK_DETECTION; + mp->create_flags= my_flags; + +#ifdef SAFE_MUTEX_DETECT_DESTROY + /* + Monitor the freeing of mutexes. This code depends on single thread init + and destroy + */ + if ((mp->info= (safe_mutex_info_t *) malloc(sizeof(safe_mutex_info_t)))) + { + struct st_safe_mutex_info_t *info= mp->info; + + info->init_file= file; + info->init_line= line; + info->prev= NULL; + info->next= NULL; + + pthread_mutex_lock(&THR_LOCK_mutex); + if ((info->next= safe_mutex_create_root)) + safe_mutex_create_root->prev= info; + safe_mutex_create_root= info; + safe_mutex_count++; + pthread_mutex_unlock(&THR_LOCK_mutex); + } +#else + thread_safe_increment(safe_mutex_count, &THR_LOCK_mutex); +#endif /* SAFE_MUTEX_DETECT_DESTROY */ + DBUG_RETURN(0); +} + + +int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file, + uint line) +{ + int error; + DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null", + (ulong) mp)); + if (!mp->file) + { + fprintf(stderr, + "safe_mutex: Trying to lock unitialized mutex at %s, line %d\n", + file, line); + fflush(stderr); + abort(); + } + + pthread_mutex_lock(&mp->global); + if (mp->count > 0) + { + /* + Check that we are not trying to lock mutex twice. This is an error + even if we are using 'try_lock' as it's not portably what happens + if you lock the mutex many times and this is in any case bad + behaviour that should not be encouraged + */ + if (pthread_equal(pthread_self(),mp->thread)) + { + fprintf(stderr, + "safe_mutex: Trying to lock mutex at %s, line %d, when the" + " mutex was already locked at %s, line %d in thread %s\n", + file,line,mp->file, mp->line, my_thread_name()); + fflush(stderr); + abort(); + } + } + pthread_mutex_unlock(&mp->global); + + /* + If we are imitating trylock(), we need to take special + precautions. + + - We cannot use pthread_mutex_lock() only since another thread can + overtake this thread and take the lock before this thread + causing pthread_mutex_trylock() to hang. In this case, we should + just return EBUSY. Hence, we use pthread_mutex_trylock() to be + able to return immediately. + + - We cannot just use trylock() and continue execution below, since + this would generate an error and abort execution if the thread + was overtaken and trylock() returned EBUSY . In this case, we + instead just return EBUSY, since this is the expected behaviour + of trylock(). + */ + if (my_flags & MYF_TRY_LOCK) + { + error= pthread_mutex_trylock(&mp->mutex); + if (error == EBUSY) + return error; + } + else + error= pthread_mutex_lock(&mp->mutex); + + if (error || (error=pthread_mutex_lock(&mp->global))) + { + fprintf(stderr,"Got error %d when trying to lock mutex %s at %s, line %d\n", + error, mp->name, file, line); + fflush(stderr); + abort(); + } + mp->thread= pthread_self(); + if (mp->count++) + { + fprintf(stderr,"safe_mutex: Error in thread libray: Got mutex %s at %s, " + "line %d more than 1 time\n", mp->name, file,line); + fflush(stderr); + abort(); + } + mp->file= file; + mp->line= line; + mp->active_flags= mp->create_flags | my_flags; + pthread_mutex_unlock(&mp->global); + + /* Deadlock detection */ + + mp->prev= mp->next= 0; + if (!(mp->active_flags & (MYF_TRY_LOCK | MYF_NO_DEADLOCK_DETECTION))) + { + safe_mutex_t **mutex_in_use= my_thread_var_mutex_in_use(); + + if (!mutex_in_use) + { + /* thread has not called my_thread_init() */ + mp->active_flags|= MYF_NO_DEADLOCK_DETECTION; + } + else + { + safe_mutex_t *mutex_root; + if ((mutex_root= *mutex_in_use)) /* If not first locked */ + { + /* + Protect locked_mutex against changes if a mutex is deleted + */ + pthread_mutex_lock(&THR_LOCK_mutex); + + if (! my_hash_search(mutex_root->locked_mutex, (uchar*) &mp->id, 0)) + { + safe_mutex_deadlock_t *deadlock; + safe_mutex_t *mutex; + + /* Create object to store mutex info */ + if (!(deadlock= my_malloc(sizeof(*deadlock), + MYF(MY_ZEROFILL | MY_WME | MY_FAE)))) + goto abort_loop; + deadlock->name= mp->name; + deadlock->id= mp->id; + deadlock->mutex= mp; + /* The following is useful for debugging wrong mutex usage */ + deadlock->file= file; + deadlock->line= line; + + /* Check if potential deadlock */ + mutex= mutex_root; + do + { + if (my_hash_search(mp->locked_mutex, (uchar*) &mutex->id, 0)) + { + print_deadlock_warning(mp, mutex); + /* Mark wrong usage to avoid future warnings for same error */ + deadlock->warning_only= 1; + add_to_locked_mutex(deadlock, mutex_root); + DBUG_ASSERT(deadlock->count > 0); + goto abort_loop; + } + } + while ((mutex= mutex->next)); + + /* + Copy current mutex and all mutex that has been locked + after current mutex (mp->locked_mutex) to all mutex that + was locked before previous mutex (mutex_root->used_mutex) + + For example if A->B would have been done before and we + are now locking (C) in B->C, then we would add C into + B->locked_mutex and A->locked_mutex + */ + my_hash_iterate(mutex_root->used_mutex, + (my_hash_walk_action) add_used_to_locked_mutex, + deadlock); + + /* + Copy all current mutex and all mutex locked after current one + into the prev mutex + */ + add_used_to_locked_mutex(mutex_root, deadlock); + DBUG_ASSERT(deadlock->count > 0); + } + abort_loop: + pthread_mutex_unlock(&THR_LOCK_mutex); + } + /* Link mutex into mutex_in_use list */ + if ((mp->next= *mutex_in_use)) + (*mutex_in_use)->prev= mp; + *mutex_in_use= mp; + } + } + + DBUG_PRINT("mutex", ("%s (0x%lx) locked", mp->name, (ulong) mp)); + return error; +} + + +int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line) +{ + int error; + DBUG_PRINT("mutex", ("%s (0x%lx) unlocking", mp->name, (ulong) mp)); + pthread_mutex_lock(&mp->global); + if (mp->count == 0) + { + fprintf(stderr, + "safe_mutex: Trying to unlock mutex %s that wasn't locked at " + "%s, line %d\n" + "Last used at %s, line: %d\n", + mp->name ? mp->name : "Null", file, line, + mp->file ? mp->file : "Null", mp->line); + fflush(stderr); + abort(); + } + if (!pthread_equal(pthread_self(),mp->thread)) + { + fprintf(stderr, + "safe_mutex: Trying to unlock mutex %s at %s, line %d that was " + "locked by " + "another thread at: %s, line: %d\n", + mp->name, file, line, mp->file, mp->line); + fflush(stderr); + abort(); + } + mp->thread= 0; + mp->count--; + + remove_from_active_list(mp); + +#ifdef __WIN__ + pthread_mutex_unlock(&mp->mutex); + error=0; +#else + error=pthread_mutex_unlock(&mp->mutex); + if (error) + { + fprintf(stderr, + "safe_mutex: Got error: %d (%d) when trying to unlock mutex " + "%s at %s, line %d\n", error, errno, mp->name, file, line); + fflush(stderr); + abort(); + } +#endif /* __WIN__ */ + pthread_mutex_unlock(&mp->global); + return error; +} + + +int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file, + uint line) +{ + int error; + safe_mutex_t save_state; + + pthread_mutex_lock(&mp->global); + if (mp->count == 0) + { + fprintf(stderr, + "safe_mutex: Trying to cond_wait on a unlocked mutex %s at %s, " + "line %d\n", + mp->name ? mp->name : "Null", file, line); + fflush(stderr); + abort(); + } + if (!pthread_equal(pthread_self(),mp->thread)) + { + fprintf(stderr, + "safe_mutex: Trying to cond_wait on a mutex %s at %s, line %d " + "that was locked by another thread at: %s, line: %d\n", + mp->name, file, line, mp->file, mp->line); + fflush(stderr); + abort(); + } + + if (mp->count-- != 1) + { + fprintf(stderr, + "safe_mutex: Count was %d on locked mutex %s at %s, line %d\n", + mp->count+1, mp->name, file, line); + fflush(stderr); + abort(); + } + save_state= *mp; + remove_from_active_list(mp); + pthread_mutex_unlock(&mp->global); + error=pthread_cond_wait(cond,&mp->mutex); + pthread_mutex_lock(&mp->global); + + if (error) + { + fprintf(stderr, + "safe_mutex: Got error: %d (%d) when doing a safe_mutex_wait on " + "%s at %s, line %d\n", error, errno, mp->name, file, line); + fflush(stderr); + abort(); + } + /* Restore state as it was before */ + mp->thread= save_state.thread; + mp->active_flags= save_state.active_flags; + mp->next= save_state.next; + mp->prev= save_state.prev; + + if (mp->count++) + { + fprintf(stderr, + "safe_mutex: Count was %d in thread 0x%lx when locking mutex %s " + "at %s, line %d\n", + mp->count-1, my_thread_dbug_id(), mp->name, file, line); + fflush(stderr); + abort(); + } + mp->file= file; + mp->line=line; + pthread_mutex_unlock(&mp->global); + return error; +} + + +int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, + struct timespec *abstime, + const char *file, uint line) +{ + int error; + safe_mutex_t save_state; + + pthread_mutex_lock(&mp->global); + if (mp->count != 1 || !pthread_equal(pthread_self(),mp->thread)) + { + fprintf(stderr, + "safe_mutex: Trying to cond_wait at %s, line %d on a not hold " + "mutex %s\n", + file, line, mp->name ? mp->name : "Null"); + fflush(stderr); + abort(); + } + mp->count--; /* Mutex will be released */ + save_state= *mp; + remove_from_active_list(mp); + pthread_mutex_unlock(&mp->global); + error=pthread_cond_timedwait(cond,&mp->mutex,abstime); +#ifdef EXTRA_DEBUG + if (error && (error != EINTR && error != ETIMEDOUT && error != ETIME)) + { + fprintf(stderr, + "safe_mutex: Got error: %d (%d) when doing a safe_mutex_timedwait " + "on %s at %s, line %d\n", + error, errno, mp->name, file, line); + } +#endif + pthread_mutex_lock(&mp->global); + /* Restore state as it was before */ + mp->thread= save_state.thread; + mp->active_flags= save_state.active_flags; + mp->next= save_state.next; + mp->prev= save_state.prev; + + if (mp->count++) + { + fprintf(stderr, + "safe_mutex: Count was %d in thread 0x%lx when locking mutex " + "%s at %s, line %d (error: %d (%d))\n", + mp->count-1, my_thread_dbug_id(), mp->name, file, line, + error, error); + fflush(stderr); + abort(); + } + mp->file= file; + mp->line=line; + pthread_mutex_unlock(&mp->global); + return error; +} + + +int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) +{ + int error=0; + DBUG_ENTER("safe_mutex_destroy"); + DBUG_PRINT("enter", ("mutex: 0x%lx name: %s", (ulong) mp, mp->name)); + if (!mp->file) + { + fprintf(stderr, + "safe_mutex: Trying to destroy unitialized mutex at %s, line %d\n", + file, line); + fflush(stderr); + abort(); + } + if (mp->count != 0) + { + fprintf(stderr, + "safe_mutex: Trying to destroy a mutex %s that was locked at %s, " + "line %d at %s, line %d\n", + mp->name, mp->file, mp->line, file, line); + fflush(stderr); + abort(); + } + + /* Free all entries that points to this one */ + safe_mutex_free_deadlock_data(mp); + +#ifdef __WIN__ + pthread_mutex_destroy(&mp->global); + pthread_mutex_destroy(&mp->mutex); +#else + if (pthread_mutex_destroy(&mp->global)) + error=1; + if (pthread_mutex_destroy(&mp->mutex)) + error=1; +#endif + mp->file= 0; /* Mark destroyed */ + +#ifdef SAFE_MUTEX_DETECT_DESTROY + if (mp->info) + { + struct st_safe_mutex_info_t *info= mp->info; + pthread_mutex_lock(&THR_LOCK_mutex); + + if (info->prev) + info->prev->next = info->next; + else + safe_mutex_create_root = info->next; + if (info->next) + info->next->prev = info->prev; + safe_mutex_count--; + + pthread_mutex_unlock(&THR_LOCK_mutex); + free(info); + mp->info= NULL; /* Get crash if double free */ + } +#else + thread_safe_sub(safe_mutex_count, 1, &THR_LOCK_mutex); +#endif /* SAFE_MUTEX_DETECT_DESTROY */ + DBUG_RETURN(error); +} + + +/** + Free all data related to deadlock detection + + This is also useful together with safemalloc when you don't want to + have reports of not freed memory for mysys mutexes. +*/ + +void safe_mutex_free_deadlock_data(safe_mutex_t *mp) +{ + /* Free all entries that points to this one */ + if (!(mp->create_flags & MYF_NO_DEADLOCK_DETECTION)) + { + pthread_mutex_lock(&THR_LOCK_mutex); + my_hash_iterate(mp->used_mutex, + (my_hash_walk_action) remove_from_locked_mutex, + mp); + my_hash_iterate(mp->locked_mutex, + (my_hash_walk_action) remove_from_used_mutex, + mp); + pthread_mutex_unlock(&THR_LOCK_mutex); + + my_hash_free(mp->used_mutex); + my_hash_free(mp->locked_mutex); + my_free(mp->locked_mutex, 0); + mp->create_flags|= MYF_NO_DEADLOCK_DETECTION; + } +} + +/* + Free global resources and check that all mutex has been destroyed + + SYNOPSIS + safe_mutex_end() + file Print errors on this file + + NOTES + We can't use DBUG_PRINT() here as we have in my_end() disabled + DBUG handling before calling this function. + + In MySQL one may get one warning for a mutex created in my_thr_init.c + This is ok, as this thread may not yet have been exited. +*/ + +void safe_mutex_end(FILE *file __attribute__((unused))) +{ + if (!safe_mutex_count) /* safetly */ + pthread_mutex_destroy(&THR_LOCK_mutex); +#ifdef SAFE_MUTEX_DETECT_DESTROY + if (!file) + return; + + if (safe_mutex_count) + { + fprintf(file, "Warning: Not destroyed mutex: %lu\n", safe_mutex_count); + (void) fflush(file); + } + { + struct st_safe_mutex_info_t *ptr; + for (ptr= safe_mutex_create_root ; ptr ; ptr= ptr->next) + { + fprintf(file, "\tMutex %s initiated at line %4u in '%s'\n", + ptr->name, ptr->init_line, ptr->init_file); + (void) fflush(file); + } + } +#endif /* SAFE_MUTEX_DETECT_DESTROY */ +} + + +static my_bool add_used_to_locked_mutex(safe_mutex_t *used_mutex, + safe_mutex_deadlock_t *locked_mutex) +{ + /* Add mutex to all parent of the current mutex */ + if (!locked_mutex->warning_only) + { + (void) my_hash_iterate(locked_mutex->mutex->locked_mutex, + (my_hash_walk_action) add_to_locked_mutex, + used_mutex); + /* mark that locked_mutex is locked after used_mutex */ + (void) add_to_locked_mutex(locked_mutex, used_mutex); + } + return 0; +} + + +/** + register that locked_mutex was locked after current_mutex +*/ + +static my_bool add_to_locked_mutex(safe_mutex_deadlock_t *locked_mutex, + safe_mutex_t *current_mutex) +{ + DBUG_ENTER("add_to_locked_mutex"); + DBUG_PRINT("info", ("inserting 0x%lx into 0x%lx (id: %lu -> %lu)", + (ulong) locked_mutex, (long) current_mutex, + locked_mutex->id, current_mutex->id)); + if (my_hash_insert(current_mutex->locked_mutex, (uchar*) locked_mutex)) + { + /* Got mutex through two paths; ignore */ + DBUG_RETURN(0); + } + locked_mutex->count++; + if (my_hash_insert(locked_mutex->mutex->used_mutex, + (uchar*) current_mutex)) + { + DBUG_ASSERT(0); + } + DBUG_RETURN(0); +} + + +/** + Remove mutex from the locked mutex hash + @fn remove_from_used_mutex() + @param mp Mutex that has delete_mutex in it's locked_mutex hash + @param delete_mutex Mutex should be removed from the hash + + @notes + safe_mutex_deadlock_t entries in the locked hash are shared. + When counter goes to 0, we delete the safe_mutex_deadlock_t entry. +*/ + +static my_bool remove_from_locked_mutex(safe_mutex_t *mp, + safe_mutex_t *delete_mutex) +{ + safe_mutex_deadlock_t *found; + DBUG_ENTER("remove_from_locked_mutex"); + DBUG_PRINT("enter", ("delete_mutex: 0x%lx mutex: 0x%lx (id: %lu <- %lu)", + (ulong) delete_mutex, (ulong) mp, + delete_mutex->id, mp->id)); + + found= (safe_mutex_deadlock_t*) my_hash_search(mp->locked_mutex, + (uchar*) &delete_mutex->id, 0); + DBUG_ASSERT(found); + if (found) + { + if (my_hash_delete(mp->locked_mutex, (uchar*) found)) + { + DBUG_ASSERT(0); + } + if (!--found->count) + my_free(found, MYF(0)); + } + DBUG_RETURN(0); +} + +static my_bool remove_from_used_mutex(safe_mutex_deadlock_t *locked_mutex, + safe_mutex_t *mutex) +{ + DBUG_ENTER("remove_from_used_mutex"); + DBUG_PRINT("enter", ("delete_mutex: 0x%lx mutex: 0x%lx (id: %lu <- %lu)", + (ulong) mutex, (ulong) locked_mutex, + mutex->id, locked_mutex->id)); + if (my_hash_delete(locked_mutex->mutex->used_mutex, (uchar*) mutex)) + { + DBUG_ASSERT(0); + } + if (!--locked_mutex->count) + my_free(locked_mutex, MYF(0)); + DBUG_RETURN(0); +} + + +static void print_deadlock_warning(safe_mutex_t *new_mutex, + safe_mutex_t *parent_mutex) +{ + safe_mutex_t *mutex_root; + DBUG_ENTER("print_deadlock_warning"); + DBUG_PRINT("enter", ("mutex: %s parent: %s", + new_mutex->name, parent_mutex->name)); + + fprintf(stderr, "safe_mutex: Found wrong usage of mutex " + "'%s' and '%s'\n", + parent_mutex->name, new_mutex->name); + DBUG_PRINT("info", ("safe_mutex: Found wrong usage of mutex " + "'%s' and '%s'", + parent_mutex->name, new_mutex->name)); + fprintf(stderr, "Mutex currently locked (in reverse order):\n"); + DBUG_PRINT("info", ("Mutex currently locked (in reverse order):")); + fprintf(stderr, "%-32.32s %s line %u\n", new_mutex->name, new_mutex->file, + new_mutex->line); + DBUG_PRINT("info", ("%-32.32s %s line %u\n", new_mutex->name, + new_mutex->file, new_mutex->line)); + for (mutex_root= *my_thread_var_mutex_in_use() ; + mutex_root; + mutex_root= mutex_root->next) + { + fprintf(stderr, "%-32.32s %s line %u\n", mutex_root->name, + mutex_root->file, mutex_root->line); + DBUG_PRINT("info", ("%-32.32s %s line %u", mutex_root->name, + mutex_root->file, mutex_root->line)); + } + fflush(stderr); + DBUG_VOID_RETURN; +} + + +#endif /* THREAD && SAFE_MUTEX */ + +#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) + +#include "mysys_priv.h" +#include "my_static.h" +#include + +#include +#include +#include +#include +#include + +#undef pthread_mutex_t +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_trylock +#undef pthread_mutex_unlock +#undef pthread_mutex_destroy +#undef pthread_cond_wait +#undef pthread_cond_timedwait + +ulong mutex_delay(ulong delayloops) +{ + ulong i; + volatile ulong j; + + j = 0; + + for (i = 0; i < delayloops * 50; i++) + j += i; + + return(j); +} + +#define MY_PTHREAD_FASTMUTEX_SPINS 8 +#define MY_PTHREAD_FASTMUTEX_DELAY 4 + +static int cpu_count= 0; + +int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp, + const pthread_mutexattr_t *attr) +{ + if ((cpu_count > 1) && (attr == MY_MUTEX_INIT_FAST)) + mp->spins= MY_PTHREAD_FASTMUTEX_SPINS; + else + mp->spins= 0; + mp->rng_state= 1; + return pthread_mutex_init(&mp->mutex, attr); +} + +/** + Park-Miller random number generator. A simple linear congruential + generator that operates in multiplicative group of integers modulo n. + + x_{k+1} = (x_k g) mod n + + Popular pair of parameters: n = 2^32 â’ 5 = 4294967291 and g = 279470273. + The period of the generator is about 2^31. + Largest value that can be returned: 2147483646 (RAND_MAX) + + Reference: + + S. K. Park and K. W. Miller + "Random number generators: good ones are hard to find" + Commun. ACM, October 1988, Volume 31, No 10, pages 1192-1201. +*/ + +static double park_rng(my_pthread_fastmutex_t *mp) +{ + mp->rng_state= ((my_ulonglong)mp->rng_state * 279470273U) % 4294967291U; + return (mp->rng_state / 2147483647.0); +} + +int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp) +{ + int res; + uint i; + uint maxdelay= MY_PTHREAD_FASTMUTEX_DELAY; + + for (i= 0; i < mp->spins; i++) + { + res= pthread_mutex_trylock(&mp->mutex); + + if (res == 0) + return 0; + + if (res != EBUSY) + return res; + + mutex_delay(maxdelay); + maxdelay += park_rng(mp) * MY_PTHREAD_FASTMUTEX_DELAY + 1; + } + return pthread_mutex_lock(&mp->mutex); +} + + +void fastmutex_global_init(void) +{ +#ifdef _SC_NPROCESSORS_CONF + cpu_count= sysconf(_SC_NPROCESSORS_CONF); +#endif +} + +#endif /* defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */ diff --git a/externals/mysql/mysys/thr_rwlock.c b/externals/mysql/mysys/thr_rwlock.c new file mode 100644 index 0000000..280a0ec --- /dev/null +++ b/externals/mysql/mysys/thr_rwlock.c @@ -0,0 +1,171 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Synchronization - readers / writer thread locks */ + +#include "mysys_priv.h" +#if defined(THREAD) && !defined(HAVE_PTHREAD_RWLOCK_RDLOCK) && !defined(HAVE_RWLOCK_INIT) +#include + +/* + Source base from Sun Microsystems SPILT, simplified for MySQL use + -- Joshua Chamas + Some cleanup and additional code by Monty +*/ + +/* +* Multithreaded Demo Source +* +* Copyright (C) 1995 by Sun Microsystems, Inc. +* All rights reserved. +* +* This file is a product of SunSoft, Inc. and is provided for +* unrestricted use provided that this legend is included on all +* media and as a part of the software program in whole or part. +* Users may copy, modify or distribute this file at will. +* +* THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING +* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +* +* This file is provided with no support and without any obligation on the +* part of SunSoft, Inc. to assist in its use, correction, modification or +* enhancement. +* +* SUNSOFT AND SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT +* TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS +* FILE OR ANY PART THEREOF. +* +* IN NO EVENT WILL SUNSOFT OR SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY +* LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL +* DAMAGES, EVEN IF THEY HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGES. +* +* SunSoft, Inc. +* 2550 Garcia Avenue +* Mountain View, California 94043 +*/ + +int my_rwlock_init(rw_lock_t *rwp, void *arg __attribute__((unused))) +{ + pthread_condattr_t cond_attr; + + pthread_mutex_init( &rwp->lock, MY_MUTEX_INIT_FAST); + pthread_condattr_init( &cond_attr ); + pthread_cond_init( &rwp->readers, &cond_attr ); + pthread_cond_init( &rwp->writers, &cond_attr ); + pthread_condattr_destroy(&cond_attr); + + rwp->state = 0; + rwp->waiters = 0; + + return(0); +} + + +int my_rwlock_destroy(rw_lock_t *rwp) +{ + pthread_mutex_destroy( &rwp->lock ); + pthread_cond_destroy( &rwp->readers ); + pthread_cond_destroy( &rwp->writers ); + return(0); +} + + +int my_rw_rdlock(rw_lock_t *rwp) +{ + pthread_mutex_lock(&rwp->lock); + + /* active or queued writers */ + while ((rwp->state < 0 ) || rwp->waiters) + pthread_cond_wait( &rwp->readers, &rwp->lock); + + rwp->state++; + pthread_mutex_unlock(&rwp->lock); + return(0); +} + +int my_rw_tryrdlock(rw_lock_t *rwp) +{ + int res; + pthread_mutex_lock(&rwp->lock); + if ((rwp->state < 0 ) || rwp->waiters) + res= EBUSY; /* Can't get lock */ + else + { + res=0; + rwp->state++; + } + pthread_mutex_unlock(&rwp->lock); + return(res); +} + + +int my_rw_wrlock(rw_lock_t *rwp) +{ + pthread_mutex_lock(&rwp->lock); + rwp->waiters++; /* another writer queued */ + + while (rwp->state) + pthread_cond_wait(&rwp->writers, &rwp->lock); + rwp->state = -1; + rwp->waiters--; + pthread_mutex_unlock(&rwp->lock); + return(0); +} + + +int my_rw_trywrlock(rw_lock_t *rwp) +{ + int res; + pthread_mutex_lock(&rwp->lock); + if (rwp->state) + res= EBUSY; /* Can't get lock */ + else + { + res=0; + rwp->state = -1; + } + pthread_mutex_unlock(&rwp->lock); + return(res); +} + + +int my_rw_unlock(rw_lock_t *rwp) +{ + DBUG_PRINT("rw_unlock", + ("state: %d waiters: %d", rwp->state, rwp->waiters)); + pthread_mutex_lock(&rwp->lock); + + if (rwp->state == -1) /* writer releasing */ + { + rwp->state= 0; /* mark as available */ + + if ( rwp->waiters ) /* writers queued */ + pthread_cond_signal( &rwp->writers ); + else + pthread_cond_broadcast( &rwp->readers ); + } + else + { + if ( --rwp->state == 0 ) /* no more readers */ + pthread_cond_signal( &rwp->writers ); + } + + pthread_mutex_unlock( &rwp->lock ); + return(0); +} + +#endif diff --git a/externals/mysql/mysys/tree.c b/externals/mysql/mysys/tree.c new file mode 100644 index 0000000..e721cc0 --- /dev/null +++ b/externals/mysql/mysys/tree.c @@ -0,0 +1,757 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Code for handling red-black (balanced) binary trees. + key in tree is allocated accrding to following: + + 1) If size < 0 then tree will not allocate keys and only a pointer to + each key is saved in tree. + compare and search functions uses and returns key-pointer + + 2) If size == 0 then there are two options: + - key_size != 0 to tree_insert: The key will be stored in the tree. + - key_size == 0 to tree_insert: A pointer to the key is stored. + compare and search functions uses and returns key-pointer. + + 3) if key_size is given to init_tree then each node will continue the + key and calls to insert_key may increase length of key. + if key_size > sizeof(pointer) and key_size is a multiple of 8 (double + allign) then key will be put on a 8 alligned adress. Else + the key will be on adress (element+1). This is transparent for user + compare and search functions uses a pointer to given key-argument. + + - If you use a free function for tree-elements and you are freeing + the element itself, you should use key_size = 0 to init_tree and + tree_search + + The actual key in TREE_ELEMENT is saved as a pointer or after the + TREE_ELEMENT struct. + If one uses only pointers in tree one can use tree_set_pointer() to + change address of data. + + Implemented by monty. +*/ + +/* + NOTE: + tree->compare function should be ALWAYS called as + (*tree->compare)(custom_arg, ELEMENT_KEY(tree,element), key) + and not other way around, as + (*tree->compare)(custom_arg, key, ELEMENT_KEY(tree,element)) + + ft_boolean_search.c (at least) relies on that. +*/ + +#include "mysys_priv.h" +#include +#include +#include "my_base.h" + +#define BLACK 1 +#define RED 0 +#define DEFAULT_ALLOC_SIZE 8192 +#define DEFAULT_ALIGN_SIZE 8192 + +static void delete_tree_element(TREE *,TREE_ELEMENT *); +static int tree_walk_left_root_right(TREE *,TREE_ELEMENT *, + tree_walk_action,void *); +static int tree_walk_right_root_left(TREE *,TREE_ELEMENT *, + tree_walk_action,void *); +static void left_rotate(TREE_ELEMENT **parent,TREE_ELEMENT *leaf); +static void right_rotate(TREE_ELEMENT **parent, TREE_ELEMENT *leaf); +static void rb_insert(TREE *tree,TREE_ELEMENT ***parent, + TREE_ELEMENT *leaf); +static void rb_delete_fixup(TREE *tree,TREE_ELEMENT ***parent); + + + /* The actuall code for handling binary trees */ + +#ifndef DBUG_OFF +static int test_rb_tree(TREE_ELEMENT *element); +#endif + +void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit, + int size, qsort_cmp2 compare, my_bool with_delete, + tree_element_free free_element, void *custom_arg) +{ + DBUG_ENTER("init_tree"); + DBUG_PRINT("enter",("tree: %p size: %d", tree, size)); + + if (default_alloc_size < DEFAULT_ALLOC_SIZE) + default_alloc_size= DEFAULT_ALLOC_SIZE; + default_alloc_size= MY_ALIGN(default_alloc_size, DEFAULT_ALIGN_SIZE); + bzero((uchar*) &tree->null_element,sizeof(tree->null_element)); + tree->root= &tree->null_element; + tree->compare=compare; + tree->size_of_element=size > 0 ? (uint) size : 0; + tree->memory_limit=memory_limit; + tree->free=free_element; + tree->allocated=0; + tree->elements_in_tree=0; + tree->custom_arg = custom_arg; + tree->null_element.colour=BLACK; + tree->null_element.left=tree->null_element.right=0; + tree->flag= 0; + if (!free_element && size >= 0 && + ((uint) size <= sizeof(void*) || ((uint) size & (sizeof(void*)-1)))) + { + /* + We know that the data doesn't have to be aligned (like if the key + contains a double), so we can store the data combined with the + TREE_ELEMENT. + */ + tree->offset_to_key=sizeof(TREE_ELEMENT); /* Put key after element */ + /* Fix allocation size so that we don't lose any memory */ + default_alloc_size/=(sizeof(TREE_ELEMENT)+size); + if (!default_alloc_size) + default_alloc_size=1; + default_alloc_size*=(sizeof(TREE_ELEMENT)+size); + } + else + { + tree->offset_to_key=0; /* use key through pointer */ + tree->size_of_element+=sizeof(void*); + } + if (!(tree->with_delete=with_delete)) + { + init_alloc_root(&tree->mem_root, (uint) default_alloc_size, 0); + tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element); + } + DBUG_VOID_RETURN; +} + +static void free_tree(TREE *tree, myf free_flags) +{ + DBUG_ENTER("free_tree"); + DBUG_PRINT("enter",("tree: %p", tree)); + + if (tree->root) /* If initialized */ + { + if (tree->with_delete) + delete_tree_element(tree,tree->root); + else + { + if (tree->free) + { + if (tree->memory_limit) + (*tree->free)(NULL, free_init, tree->custom_arg); + delete_tree_element(tree,tree->root); + if (tree->memory_limit) + (*tree->free)(NULL, free_end, tree->custom_arg); + } + free_root(&tree->mem_root, free_flags); + } + } + tree->root= &tree->null_element; + tree->elements_in_tree=0; + tree->allocated=0; + + DBUG_VOID_RETURN; +} + +void delete_tree(TREE* tree) +{ + free_tree(tree, MYF(0)); /* my_free() mem_root if applicable */ +} + +void reset_tree(TREE* tree) +{ + /* do not free mem_root, just mark blocks as free */ + free_tree(tree, MYF(MY_MARK_BLOCKS_FREE)); +} + + +static void delete_tree_element(TREE *tree, TREE_ELEMENT *element) +{ + if (element != &tree->null_element) + { + delete_tree_element(tree,element->left); + if (tree->free) + (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); + delete_tree_element(tree,element->right); + if (tree->with_delete) + my_free((char*) element,MYF(0)); + } +} + + +/* + insert, search and delete of elements + + The following should be true: + parent[0] = & parent[-1][0]->left || + parent[0] = & parent[-1][0]->right +*/ + +TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, + void* custom_arg) +{ + int cmp; + TREE_ELEMENT *element,***parent; + + parent= tree->parents; + *parent = &tree->root; element= tree->root; + for (;;) + { + if (element == &tree->null_element || + (cmp = (*tree->compare)(custom_arg, ELEMENT_KEY(tree,element), + key)) == 0) + break; + if (cmp < 0) + { + *++parent= &element->right; element= element->right; + } + else + { + *++parent = &element->left; element= element->left; + } + } + if (element == &tree->null_element) + { + uint alloc_size=sizeof(TREE_ELEMENT)+key_size+tree->size_of_element; + tree->allocated+=alloc_size; + + if (tree->memory_limit && tree->elements_in_tree + && tree->allocated > tree->memory_limit) + { + reset_tree(tree); + return tree_insert(tree, key, key_size, custom_arg); + } + + key_size+=tree->size_of_element; + if (tree->with_delete) + element=(TREE_ELEMENT *) my_malloc(alloc_size, MYF(MY_WME)); + else + element=(TREE_ELEMENT *) alloc_root(&tree->mem_root,alloc_size); + if (!element) + return(NULL); + **parent=element; + element->left=element->right= &tree->null_element; + if (!tree->offset_to_key) + { + if (key_size == sizeof(void*)) /* no length, save pointer */ + *((void**) (element+1))=key; + else + { + *((void**) (element+1))= (void*) ((void **) (element+1)+1); + memcpy((uchar*) *((void **) (element+1)),key, + (size_t) (key_size-sizeof(void*))); + } + } + else + memcpy((uchar*) element+tree->offset_to_key,key,(size_t) key_size); + element->count=1; /* May give warning in purify */ + tree->elements_in_tree++; + rb_insert(tree,parent,element); /* rebalance tree */ + } + else + { + if (tree->flag & TREE_NO_DUPS) + return(NULL); + element->count++; + /* Avoid a wrap over of the count. */ + if (! element->count) + element->count--; + } + DBUG_EXECUTE("check_tree", test_rb_tree(tree->root);); + return element; +} + +int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg) +{ + int cmp,remove_colour; + TREE_ELEMENT *element,***parent, ***org_parent, *nod; + if (!tree->with_delete) + return 1; /* not allowed */ + + parent= tree->parents; + *parent= &tree->root; element= tree->root; + for (;;) + { + if (element == &tree->null_element) + return 1; /* Was not in tree */ + if ((cmp = (*tree->compare)(custom_arg, ELEMENT_KEY(tree,element), + key)) == 0) + break; + if (cmp < 0) + { + *++parent= &element->right; element= element->right; + } + else + { + *++parent = &element->left; element= element->left; + } + } + if (element->left == &tree->null_element) + { + (**parent)=element->right; + remove_colour= element->colour; + } + else if (element->right == &tree->null_element) + { + (**parent)=element->left; + remove_colour= element->colour; + } + else + { + org_parent= parent; + *++parent= &element->right; nod= element->right; + while (nod->left != &tree->null_element) + { + *++parent= &nod->left; nod= nod->left; + } + (**parent)=nod->right; /* unlink nod from tree */ + remove_colour= nod->colour; + org_parent[0][0]=nod; /* put y in place of element */ + org_parent[1]= &nod->right; + nod->left=element->left; + nod->right=element->right; + nod->colour=element->colour; + } + if (remove_colour == BLACK) + rb_delete_fixup(tree,parent); + if (tree->free) + (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); + tree->allocated-= sizeof(TREE_ELEMENT) + tree->size_of_element + key_size; + my_free((uchar*) element,MYF(0)); + tree->elements_in_tree--; + return 0; +} + + +void *tree_search(TREE *tree, void *key, void *custom_arg) +{ + int cmp; + TREE_ELEMENT *element=tree->root; + + for (;;) + { + if (element == &tree->null_element) + return (void*) 0; + if ((cmp = (*tree->compare)(custom_arg, ELEMENT_KEY(tree,element), + key)) == 0) + return ELEMENT_KEY(tree,element); + if (cmp < 0) + element=element->right; + else + element=element->left; + } +} + +void *tree_search_key(TREE *tree, const void *key, + TREE_ELEMENT **parents, TREE_ELEMENT ***last_pos, + enum ha_rkey_function flag, void *custom_arg) +{ + int cmp; + TREE_ELEMENT *element= tree->root; + TREE_ELEMENT **last_left_step_parent= NULL, **last_right_step_parent= NULL; + TREE_ELEMENT **last_equal_element= NULL; + +/* + TODO: support for HA_READ_KEY_OR_PREV, HA_READ_PREFIX flags if needed. +*/ + + *parents = &tree->null_element; + while (element != &tree->null_element) + { + *++parents= element; + if ((cmp= (*tree->compare)(custom_arg, ELEMENT_KEY(tree, element), + key)) == 0) + { + switch (flag) { + case HA_READ_KEY_EXACT: + case HA_READ_KEY_OR_NEXT: + case HA_READ_BEFORE_KEY: + last_equal_element= parents; + cmp= 1; + break; + case HA_READ_AFTER_KEY: + cmp= -1; + break; + case HA_READ_PREFIX_LAST: + case HA_READ_PREFIX_LAST_OR_PREV: + last_equal_element= parents; + cmp= -1; + break; + default: + return NULL; + } + } + if (cmp < 0) /* element < key */ + { + last_right_step_parent= parents; + element= element->right; + } + else + { + last_left_step_parent= parents; + element= element->left; + } + } + switch (flag) { + case HA_READ_KEY_EXACT: + case HA_READ_PREFIX_LAST: + *last_pos= last_equal_element; + break; + case HA_READ_KEY_OR_NEXT: + *last_pos= last_equal_element ? last_equal_element : last_left_step_parent; + break; + case HA_READ_AFTER_KEY: + *last_pos= last_left_step_parent; + break; + case HA_READ_PREFIX_LAST_OR_PREV: + *last_pos= last_equal_element ? last_equal_element : last_right_step_parent; + break; + case HA_READ_BEFORE_KEY: + *last_pos= last_right_step_parent; + break; + default: + return NULL; + } + return *last_pos ? ELEMENT_KEY(tree, **last_pos) : NULL; +} + +/* + Search first (the most left) or last (the most right) tree element +*/ +void *tree_search_edge(TREE *tree, TREE_ELEMENT **parents, + TREE_ELEMENT ***last_pos, int child_offs) +{ + TREE_ELEMENT *element= tree->root; + + *parents= &tree->null_element; + while (element != &tree->null_element) + { + *++parents= element; + element= ELEMENT_CHILD(element, child_offs); + } + *last_pos= parents; + return **last_pos != &tree->null_element ? + ELEMENT_KEY(tree, **last_pos) : NULL; +} + +void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs, + int r_offs) +{ + TREE_ELEMENT *x= **last_pos; + + if (ELEMENT_CHILD(x, r_offs) != &tree->null_element) + { + x= ELEMENT_CHILD(x, r_offs); + *++*last_pos= x; + while (ELEMENT_CHILD(x, l_offs) != &tree->null_element) + { + x= ELEMENT_CHILD(x, l_offs); + *++*last_pos= x; + } + return ELEMENT_KEY(tree, x); + } + else + { + TREE_ELEMENT *y= *--*last_pos; + while (y != &tree->null_element && x == ELEMENT_CHILD(y, r_offs)) + { + x= y; + y= *--*last_pos; + } + return y == &tree->null_element ? NULL : ELEMENT_KEY(tree, y); + } +} + +/* + Expected that tree is fully balanced + (each path from root to leaf has the same length) +*/ +ha_rows tree_record_pos(TREE *tree, const void *key, + enum ha_rkey_function flag, void *custom_arg) +{ + int cmp; + TREE_ELEMENT *element= tree->root; + double left= 1; + double right= tree->elements_in_tree; + + while (element != &tree->null_element) + { + if ((cmp= (*tree->compare)(custom_arg, ELEMENT_KEY(tree, element), + key)) == 0) + { + switch (flag) { + case HA_READ_KEY_EXACT: + case HA_READ_BEFORE_KEY: + cmp= 1; + break; + case HA_READ_AFTER_KEY: + cmp= -1; + break; + default: + return HA_POS_ERROR; + } + } + if (cmp < 0) /* element < key */ + { + element= element->right; + left= (left + right) / 2; + } + else + { + element= element->left; + right= (left + right) / 2; + } + } + switch (flag) { + case HA_READ_KEY_EXACT: + case HA_READ_BEFORE_KEY: + return (ha_rows) right; + case HA_READ_AFTER_KEY: + return (ha_rows) left; + default: + return HA_POS_ERROR; + } +} + +int tree_walk(TREE *tree, tree_walk_action action, void *argument, TREE_WALK visit) +{ + switch (visit) { + case left_root_right: + return tree_walk_left_root_right(tree,tree->root,action,argument); + case right_root_left: + return tree_walk_right_root_left(tree,tree->root,action,argument); + } + return 0; /* Keep gcc happy */ +} + +static int tree_walk_left_root_right(TREE *tree, TREE_ELEMENT *element, tree_walk_action action, void *argument) +{ + int error; + if (element->left) /* Not null_element */ + { + if ((error=tree_walk_left_root_right(tree,element->left,action, + argument)) == 0 && + (error=(*action)(ELEMENT_KEY(tree,element), + (element_count) element->count, + argument)) == 0) + error=tree_walk_left_root_right(tree,element->right,action,argument); + return error; + } + return 0; +} + +static int tree_walk_right_root_left(TREE *tree, TREE_ELEMENT *element, tree_walk_action action, void *argument) +{ + int error; + if (element->right) /* Not null_element */ + { + if ((error=tree_walk_right_root_left(tree,element->right,action, + argument)) == 0 && + (error=(*action)(ELEMENT_KEY(tree,element), + (element_count) element->count, + argument)) == 0) + error=tree_walk_right_root_left(tree,element->left,action,argument); + return error; + } + return 0; +} + + + /* Functions to fix up the tree after insert and delete */ + +static void left_rotate(TREE_ELEMENT **parent, TREE_ELEMENT *leaf) +{ + TREE_ELEMENT *y; + + y=leaf->right; + leaf->right=y->left; + parent[0]=y; + y->left=leaf; +} + +static void right_rotate(TREE_ELEMENT **parent, TREE_ELEMENT *leaf) +{ + TREE_ELEMENT *x; + + x=leaf->left; + leaf->left=x->right; + parent[0]=x; + x->right=leaf; +} + +static void rb_insert(TREE *tree, TREE_ELEMENT ***parent, TREE_ELEMENT *leaf) +{ + TREE_ELEMENT *y,*par,*par2; + + leaf->colour=RED; + while (leaf != tree->root && (par=parent[-1][0])->colour == RED) + { + if (par == (par2=parent[-2][0])->left) + { + y= par2->right; + if (y->colour == RED) + { + par->colour=BLACK; + y->colour=BLACK; + leaf=par2; + parent-=2; + leaf->colour=RED; /* And the loop continues */ + } + else + { + if (leaf == par->right) + { + left_rotate(parent[-1],par); + par=leaf; /* leaf is now parent to old leaf */ + } + par->colour=BLACK; + par2->colour=RED; + right_rotate(parent[-2],par2); + break; + } + } + else + { + y= par2->left; + if (y->colour == RED) + { + par->colour=BLACK; + y->colour=BLACK; + leaf=par2; + parent-=2; + leaf->colour=RED; /* And the loop continues */ + } + else + { + if (leaf == par->left) + { + right_rotate(parent[-1],par); + par=leaf; + } + par->colour=BLACK; + par2->colour=RED; + left_rotate(parent[-2],par2); + break; + } + } + } + tree->root->colour=BLACK; +} + +static void rb_delete_fixup(TREE *tree, TREE_ELEMENT ***parent) +{ + TREE_ELEMENT *x,*w,*par; + + x= **parent; + while (x != tree->root && x->colour == BLACK) + { + if (x == (par=parent[-1][0])->left) + { + w=par->right; + if (w->colour == RED) + { + w->colour=BLACK; + par->colour=RED; + left_rotate(parent[-1],par); + parent[0]= &w->left; + *++parent= &par->left; + w=par->right; + } + if (w->left->colour == BLACK && w->right->colour == BLACK) + { + w->colour=RED; + x=par; + parent--; + } + else + { + if (w->right->colour == BLACK) + { + w->left->colour=BLACK; + w->colour=RED; + right_rotate(&par->right,w); + w=par->right; + } + w->colour=par->colour; + par->colour=BLACK; + w->right->colour=BLACK; + left_rotate(parent[-1],par); + x=tree->root; + break; + } + } + else + { + w=par->left; + if (w->colour == RED) + { + w->colour=BLACK; + par->colour=RED; + right_rotate(parent[-1],par); + parent[0]= &w->right; + *++parent= &par->right; + w=par->left; + } + if (w->right->colour == BLACK && w->left->colour == BLACK) + { + w->colour=RED; + x=par; + parent--; + } + else + { + if (w->left->colour == BLACK) + { + w->right->colour=BLACK; + w->colour=RED; + left_rotate(&par->left,w); + w=par->left; + } + w->colour=par->colour; + par->colour=BLACK; + w->left->colour=BLACK; + right_rotate(parent[-1],par); + x=tree->root; + break; + } + } + } + x->colour=BLACK; +} + +#ifndef DBUG_OFF + + /* Test that the proporties for a red-black tree holds */ + +static int test_rb_tree(TREE_ELEMENT *element) +{ + int count_l,count_r; + + if (!element->left) + return 0; /* Found end of tree */ + if (element->colour == RED && + (element->left->colour == RED || element->right->colour == RED)) + { + printf("Wrong tree: Found two red in a row\n"); + return -1; + } + count_l=test_rb_tree(element->left); + count_r=test_rb_tree(element->right); + if (count_l >= 0 && count_r >= 0) + { + if (count_l == count_r) + return count_l+(element->colour == BLACK); + printf("Wrong tree: Incorrect black-count: %d - %d\n",count_l,count_r); + } + return -1; +} +#endif diff --git a/externals/mysql/mysys/trie.c b/externals/mysql/mysys/trie.c new file mode 100644 index 0000000..5738b9b --- /dev/null +++ b/externals/mysql/mysys/trie.c @@ -0,0 +1,236 @@ +/* Copyright (C) 2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Implementation of trie and Aho-Corasick automaton. + Supports only charsets that can be compared byte-wise. + + TODO: + Add character frequencies. Can increase lookup speed + up to 30%. + Implement character-wise comparision. +*/ + + +#include "mysys_priv.h" +#include +#include +#include + + +/* + SYNOPSIS + TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset); + + DESCRIPTION + Allocates or initializes a `TRIE' object. If `trie' is a `NULL' + pointer, the function allocates, initializes, and returns a new + object. Otherwise, the object is initialized and the address of + the object is returned. If `trie_init()' allocates a new object, + it will be freed when `trie_free()' is called. + + RETURN VALUE + An initialized `TRIE*' object. `NULL' if there was insufficient + memory to allocate a new object. +*/ + +TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset) +{ + MEM_ROOT mem_root; + DBUG_ENTER("trie_init"); + DBUG_ASSERT(charset); + init_alloc_root(&mem_root, + (sizeof(TRIE_NODE) * 128) + ALLOC_ROOT_MIN_BLOCK_SIZE, + sizeof(TRIE_NODE) * 128); + if (! trie) + { + if (! (trie= (TRIE *)alloc_root(&mem_root, sizeof(TRIE)))) + { + free_root(&mem_root, MYF(0)); + DBUG_RETURN(NULL); + } + } + + memcpy(&trie->mem_root, &mem_root, sizeof(MEM_ROOT)); + trie->root.leaf= 0; + trie->root.c= 0; + trie->root.next= NULL; + trie->root.links= NULL; + trie->root.fail= NULL; + trie->charset= charset; + trie->nnodes= 0; + trie->nwords= 0; + DBUG_RETURN(trie); +} + + +/* + SYNOPSIS + void trie_free (TRIE *trie); + trie - valid pointer to `TRIE' + + DESCRIPTION + Frees the memory allocated for a `trie'. + + RETURN VALUE + None. +*/ + +void trie_free (TRIE *trie) +{ + MEM_ROOT mem_root; + DBUG_ENTER("trie_free"); + DBUG_ASSERT(trie); + memcpy(&mem_root, &trie->mem_root, sizeof(MEM_ROOT)); + free_root(&mem_root, MYF(0)); + DBUG_VOID_RETURN; +} + + +/* + SYNOPSIS + my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen); + trie - valid pointer to `TRIE' + key - valid pointer to key to insert + keylen - non-0 key length + + DESCRIPTION + Inserts new key into trie. + + RETURN VALUE + Upon successful completion, `trie_insert' returns `FALSE'. Otherwise + `TRUE' is returned. + + NOTES + If this function fails you must assume `trie' is broken. + However it can be freed with trie_free(). +*/ + +my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen) +{ + TRIE_NODE *node; + TRIE_NODE *next; + uchar p; + uint k; + DBUG_ENTER("trie_insert"); + DBUG_ASSERT(trie && key && keylen); + node= &trie->root; + trie->root.fail= NULL; + for (k= 0; k < keylen; k++) + { + p= key[k]; + for (next= node->links; next; next= next->next) + if (next->c == p) + break; + + if (! next) + { + TRIE_NODE *tmp= (TRIE_NODE *)alloc_root(&trie->mem_root, + sizeof(TRIE_NODE)); + if (! tmp) + DBUG_RETURN(TRUE); + tmp->leaf= 0; + tmp->c= p; + tmp->links= tmp->fail= tmp->next= NULL; + trie->nnodes++; + if (! node->links) + { + node->links= tmp; + } + else + { + for (next= node->links; next->next; next= next->next) /* no-op */; + next->next= tmp; + } + node= tmp; + } + else + { + node= next; + } + } + node->leaf= keylen; + trie->nwords++; + DBUG_RETURN(FALSE); +} + + +/* + SYNOPSIS + my_bool trie_prepare (TRIE *trie); + trie - valid pointer to `TRIE' + + DESCRIPTION + Constructs Aho-Corasick automaton. + + RETURN VALUE + Upon successful completion, `trie_prepare' returns `FALSE'. Otherwise + `TRUE' is returned. +*/ + +my_bool ac_trie_prepare (TRIE *trie) +{ + TRIE_NODE **tmp_nodes; + TRIE_NODE *node; + uint32 fnode= 0; + uint32 lnode= 0; + DBUG_ENTER("trie_prepare"); + DBUG_ASSERT(trie); + + tmp_nodes= (TRIE_NODE **)my_malloc(trie->nnodes * sizeof(TRIE_NODE *), MYF(0)); + if (! tmp_nodes) + DBUG_RETURN(TRUE); + + trie->root.fail= &trie->root; + for (node= trie->root.links; node; node= node->next) + { + node->fail= &trie->root; + tmp_nodes[lnode++]= node; + } + + while (fnode < lnode) + { + TRIE_NODE *current= (TRIE_NODE *)tmp_nodes[fnode++]; + for (node= current->links; node; node= node->next) + { + TRIE_NODE *fail= current->fail; + tmp_nodes[lnode++]= node; + while (! (node->fail= trie_goto(&trie->root, fail, node->c))) + fail= fail->fail; + } + } + my_free((uchar*)tmp_nodes, MYF(0)); + DBUG_RETURN(FALSE); +} + + +/* + SYNOPSIS + void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state); + trie - valid pointer to `TRIE' + state - value pointer to `AC_TRIE_STATE' + + DESCRIPTION + Initializes `AC_TRIE_STATE' object. +*/ + +void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state) +{ + DBUG_ENTER("ac_trie_init"); + DBUG_ASSERT(trie && state); + state->trie= trie; + state->node= &trie->root; + DBUG_VOID_RETURN; +} diff --git a/externals/mysql/mysys/typelib.c b/externals/mysql/mysys/typelib.c new file mode 100644 index 0000000..5c3e304 --- /dev/null +++ b/externals/mysql/mysys/typelib.c @@ -0,0 +1,243 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Functions to handle typelib */ + +#include "mysys_priv.h" +#include +#include + + +static const char field_separator=','; + +int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option) +{ + int res; + const char **ptr; + + if ((res= find_type((char *) x, typelib, 2)) <= 0) + { + ptr= typelib->type_names; + if (!*x) + fprintf(stderr, "No option given to %s\n", option); + else + fprintf(stderr, "Unknown option to %s: %s\n", option, x); + fprintf(stderr, "Alternatives are: '%s'", *ptr); + while (*++ptr) + fprintf(stderr, ",'%s'", *ptr); + fprintf(stderr, "\n"); + exit(1); + } + return res; +} + + +/* + Search after a string in a list of strings. Endspace in x is not compared. + + SYNOPSIS + find_type() + x String to find + lib TYPELIB (struct of pointer to values + count) + full_name bitmap of what to do + If & 1 accept only whole names + If & 2 don't expand if half field + If & 4 allow #number# as type + If & 8 use ',' as string terminator + + NOTES + If part, uniq field is found and full_name == 0 then x is expanded + to full field. + + RETURN + -1 Too many matching values + 0 No matching value + >0 Offset+1 in typelib for matched string +*/ + + +int find_type(char *x, const TYPELIB *typelib, uint full_name) +{ + int find,pos,findpos; + reg1 char * i; + reg2 const char *j; + DBUG_ENTER("find_type"); + DBUG_PRINT("enter",("x: '%s' lib: %p", x, typelib)); + + if (!typelib->count) + { + DBUG_PRINT("exit",("no count")); + DBUG_RETURN(0); + } + LINT_INIT(findpos); + find=0; + for (pos=0 ; (j=typelib->type_names[pos]) ; pos++) + { + for (i=x ; + *i && (!(full_name & 8) || *i != field_separator) && + my_toupper(&my_charset_latin1,*i) == + my_toupper(&my_charset_latin1,*j) ; i++, j++) ; + if (! *j) + { + while (*i == ' ') + i++; /* skip_end_space */ + if (! *i || ((full_name & 8) && *i == field_separator)) + DBUG_RETURN(pos+1); + } + if ((!*i && (!(full_name & 8) || *i != field_separator)) && + (!*j || !(full_name & 1))) + { + find++; + findpos=pos; + } + } + if (find == 0 && (full_name & 4) && x[0] == '#' && strend(x)[-1] == '#' && + (findpos=atoi(x+1)-1) >= 0 && (uint) findpos < typelib->count) + find=1; + else if (find == 0 || ! x[0]) + { + DBUG_PRINT("exit",("Couldn't find type")); + DBUG_RETURN(0); + } + else if (find != 1 || (full_name & 1)) + { + DBUG_PRINT("exit",("Too many possybilities")); + DBUG_RETURN(-1); + } + if (!(full_name & 2)) + (void) strmov(x,typelib->type_names[findpos]); + DBUG_RETURN(findpos+1); +} /* find_type */ + + + /* Get name of type nr 'nr' */ + /* Warning first type is 1, 0 = empty field */ + +void make_type(register char * to, register uint nr, + register TYPELIB *typelib) +{ + DBUG_ENTER("make_type"); + if (!nr) + to[0]=0; + else + (void) strmov(to,get_type(typelib,nr-1)); + DBUG_VOID_RETURN; +} /* make_type */ + + + /* Get type */ + /* Warning first type is 0 */ + +const char *get_type(TYPELIB *typelib, uint nr) +{ + if (nr < (uint) typelib->count && typelib->type_names) + return(typelib->type_names[nr]); + return "?"; +} + + +/* + Create an integer value to represent the supplied comma-seperated + string where each string in the TYPELIB denotes a bit position. + + SYNOPSIS + find_typeset() + x string to decompose + lib TYPELIB (struct of pointer to values + count) + err index (not char position) of string element which was not + found or 0 if there was no error + + RETURN + a integer representation of the supplied string +*/ + +my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err) +{ + my_ulonglong result; + int find; + char *i; + DBUG_ENTER("find_set"); + DBUG_PRINT("enter",("x: '%s' lib: %p", x, lib)); + + if (!lib->count) + { + DBUG_PRINT("exit",("no count")); + DBUG_RETURN(0); + } + result= 0; + *err= 0; + while (*x) + { + (*err)++; + i= x; + while (*x && *x != field_separator) x++; + if ((find= find_type(i, lib, 2 | 8) - 1) < 0) + DBUG_RETURN(0); + result|= (1ULL << find); + } + *err= 0; + DBUG_RETURN(result); +} /* find_set */ + + +/* + Create a copy of a specified TYPELIB structure. + + SYNOPSIS + copy_typelib() + root pointer to a MEM_ROOT object for allocations + from pointer to a source TYPELIB structure + + RETURN + pointer to the new TYPELIB structure on successful copy, or + NULL otherwise +*/ + +TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from) +{ + TYPELIB *to; + uint i; + + if (!from) + return NULL; + + if (!(to= (TYPELIB*) alloc_root(root, sizeof(TYPELIB)))) + return NULL; + + if (!(to->type_names= (const char **) + alloc_root(root, (sizeof(char *) + sizeof(int)) * (from->count + 1)))) + return NULL; + to->type_lengths= (unsigned int *)(to->type_names + from->count + 1); + to->count= from->count; + if (from->name) + { + if (!(to->name= strdup_root(root, from->name))) + return NULL; + } + else + to->name= NULL; + + for (i= 0; i < from->count; i++) + { + if (!(to->type_names[i]= strmake_root(root, from->type_names[i], + from->type_lengths[i]))) + return NULL; + to->type_lengths[i]= from->type_lengths[i]; + } + to->type_names[to->count]= NULL; + to->type_lengths[to->count]= 0; + + return to; +} diff --git a/externals/mysql/mysys/waiting_threads.c b/externals/mysql/mysys/waiting_threads.c new file mode 100644 index 0000000..46b3c1d --- /dev/null +++ b/externals/mysql/mysys/waiting_threads.c @@ -0,0 +1,1153 @@ +/* Copyright (C) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** + @file + + "waiting threads" subsystem - a unified interface for threads to wait + on each other, with built-in deadlock detection. + + Main concepts + ^^^^^^^^^^^^^ + a thread - is represented by a WT_THD structure. One physical thread + can have only one WT_THD descriptor at any given moment. + + a resource - a thread does not wait for other threads directly, + instead it waits for a "resource", which is "owned" by other threads. + It waits, exactly, for all "owners" to "release" a resource. + It does not have to correspond to a physical resource. For example, it + may be convenient in certain cases to force resource == thread. + A resource is represented by a WT_RESOURCE structure. + + a resource identifier - a pair of {resource type, value}. A value is + an ulonglong number. Represented by a WT_RESOURCE_ID structure. + + a resource type - a pointer to a statically defined instance of + WT_RESOURCE_TYPE structure. This structure contains a pointer to + a function that knows how to compare values of this resource type. + In the simple case it could be wt_resource_id_memcmp(). + + a wait-for graph - a graph, that represenst "wait-for" relationships. + It has two types of nodes - threads and resources. There are directed + edges from a thread to a resource it is waiting for (WT_THD::waiting_for), + from a thread to resources that it "owns" (WT_THD::my_resources), + and from a resource to threads that "own" it (WT_RESOURCE::owners) + + Graph completeness + ^^^^^^^^^^^^^^^^^^ + + For flawless deadlock detection wait-for graph must be complete. + It means that when a thread starts waiting it needs to know *all* its + blockers, and call wt_thd_will_wait_for() for every one of them. + Otherwise two phenomena should be expected: + + 1. Fuzzy timeouts: + + thread A needs to get a lock, and is blocked by a thread B. + it waits. + Just before the timeout thread B releases the lock. + thread A is ready to grab the lock but discovers that it is also + blocked by a thread C. + It waits and times out. + + As a result thread A has waited two timeout intervals, instead of one. + + 2. Unreliable cycle detection: + + Thread A waits for threads B and C + Thread C waits for D + Thread D wants to start waiting for A + + one can see immediately that thread D creates a cycle, and thus + a deadlock is detected. + + But if thread A would only wait for B, and start waiting for C + when B would unlock, thread D would be allowed to wait, a deadlock + would be only detected when B unlocks or somebody times out. + + These two phenomena don't affect a correctness, and strictly speaking, + the caller is not required to call wt_thd_will_wait_for() for *all* + blockers - it may optimize wt_thd_will_wait_for() calls. But they + may be perceived as bugs by users, it must be understood that such + an optimization comes with its price. + + Usage + ^^^^^ + + First, the wt* subsystem must be initialized by calling + wt_init(). In the server you don't need to do it, it's done + in mysqld.cc. + + Similarly, wt_end() frees wt* structures, should be called + at the end, but in the server mysqld.cc takes care of that. + + Every WT_THD should be initialized with wt_thd_lazy_init(). + After that they can be used in other wt_thd_* calls. + Before discarding, WT_THD should be free'd with + wt_thd_destroy(). In the server both are handled in sql_class.cc, + it's an error to try to do it manually. + + To use the deadlock detection one needs to use this thread's WT_THD, + call wt_thd_will_wait_for() for every thread it needs to wait on, + then call wt_thd_cond_timedwait(). When thread releases a resource + it should call wt_thd_release() (or wt_thd_release_all()) - it will + notify (send a signal) threads waiting in wt_thd_cond_timedwait(), + if appropriate. + + Just like with pthread's cond_wait, there could be spurious + wake-ups from wt_thd_cond_timedwait(). A caller is expected to + handle that (that is, to re-check the blocking criteria). + + wt_thd_will_wait_for() and wt_thd_cond_timedwait() return either + WT_OK or WT_DEADLOCK. Additionally wt_thd_cond_timedwait() can return + WT_TIMEOUT. Out of memory and other fatal errors are reported as + WT_DEADLOCK - and a transaction must be aborted just the same. + + Configuration + ^^^^^^^^^^^^^ + There are four config variables. Two deadlock search depths - short and + long - and two timeouts. Deadlock search is performed with the short + depth on every wt_thd_will_wait_for() call. wt_thd_cond_timedwait() + waits with a short timeout, performs a deadlock search with the long + depth, and waits with a long timeout. As most deadlock cycles are supposed + to be short, most deadlocks will be detected at once, and waits will + rarely be necessary. + + These config variables are thread-local. Different threads may have + different search depth and timeout values. + + Also, deadlock detector supports different killing strategies, the victim + in a deadlock cycle is selected based on the "weight". See "weight" + description in waiting_threads.h for details. It's up to the caller to + set weights accordingly. + + Status + ^^^^^^ + We calculate the number of successfull waits (WT_OK returned from + wt_thd_cond_timedwait()), a number of timeouts, a deadlock cycle + length distribution - number of deadlocks with every length from + 1 to WT_CYCLE_STATS, and a wait time distribution - number + of waits with a time from 1 us to 1 min in WT_WAIT_STATS + intervals on a log e scale. +*/ + +/* + Note that if your lock system satisfy the following condition: + + there exist four lock levels A, B, C, D, such as + A is compatible with B + A is not compatible with C + D is not compatible with B + + (example A=IX, B=IS, C=S, D=X) + + you need to include lock level in the resource identifier - a + thread waiting for lock of the type A on resource R and another + thread waiting for lock of the type B on resource R should wait on + different WT_RESOURCE structures, on different {lock, resource} + pairs. Otherwise the following is possible: + + thread1> take S-lock on R + thread2> take IS-lock on R + thread3> wants X-lock on R, starts waiting for threads 1 and 2 on R. + thread3 is killed (or timeout or whatever) + WT_RESOURCE structure for R is still in the hash, as it has two owners + thread4> wants an IX-lock on R + WT_RESOURCE for R is found in the hash, thread4 starts waiting on it. + !! now thread4 is waiting for both thread1 and thread2 + !! while, in fact, IX-lock and IS-lock are compatible and + !! thread4 should not wait for thread2. +*/ + +#include +#include + +/* status variables */ + +/** + preset table of wait intervals +*/ +ulonglong wt_wait_table[WT_WAIT_STATS]; +/** + wait time distribution (log e scale) +*/ +uint32 wt_wait_stats[WT_WAIT_STATS+1]; +/** + distribution of cycle lengths + first column tells whether this was during short or long detection +*/ +uint32 wt_cycle_stats[2][WT_CYCLE_STATS+1]; +uint32 wt_success_stats; + +static my_atomic_rwlock_t cycle_stats_lock, wait_stats_lock, success_stats_lock; + +#ifdef SAFE_STATISTICS +#define incr(VAR, LOCK) \ + do { \ + my_atomic_rwlock_wrlock(&(LOCK)); \ + my_atomic_add32(&(VAR), 1); \ + my_atomic_rwlock_wrunlock(&(LOCK)); \ + } while(0) +#else +#define incr(VAR,LOCK) do { (VAR)++; } while(0) +#endif + +static void increment_success_stats() +{ + incr(wt_success_stats, success_stats_lock); +} + +static void increment_cycle_stats(uint depth, uint slot) +{ + if (depth >= WT_CYCLE_STATS) + depth= WT_CYCLE_STATS; + incr(wt_cycle_stats[slot][depth], cycle_stats_lock); +} + +static void increment_wait_stats(ulonglong waited,int ret) +{ + uint i; + if ((ret) == ETIMEDOUT) + i= WT_WAIT_STATS; + else + for (i= 0; i < WT_WAIT_STATS && waited/10 > wt_wait_table[i]; i++) ; + incr(wt_wait_stats[i], wait_stats_lock); +} + +/* + 'lock' protects 'owners', 'state', and 'waiter_count' + 'id' is read-only + + a resource is picked up from a hash in a lock-free manner + it's returned pinned, so it cannot be freed at once + but it may be freed right after the pin is removed + to free a resource it should + 1. have no owners + 2. have no waiters + + two ways to access a resource: + 1. find it in a hash + - it's returned pinned. + a) take a lock in exclusive mode + b) check the state, it should be ACTIVE to be usable + c) unpin + 2. by a direct reference + - could only used if a resource cannot be freed + e.g. accessing a resource by thd->waiting_for is safe, + a resource cannot be freed as there's a thread waiting for it +*/ +struct st_wt_resource { + WT_RESOURCE_ID id; + uint waiter_count; + enum { ACTIVE, FREE } state; +#ifndef DBUG_OFF + pthread_mutex_t *cond_mutex; /* a mutex for the 'cond' below */ +#endif + /* + before the 'lock' all elements are mutable, after (and including) - + immutable in the sense that lf_hash_insert() won't memcpy() over them. + See wt_init(). + */ +#ifdef WT_RWLOCKS_USE_MUTEXES + /* + we need a special rwlock-like 'lock' to allow readers bypass + waiting writers, otherwise readers can deadlock. For example: + + A waits on resource x, owned by B, B waits on resource y, owned + by A, we have a cycle (A->x->B->y->A) + Both A and B start deadlock detection: + + A locks x B locks y + A goes deeper B goes deeper + A locks y B locks x + + with mutexes it would deadlock. With rwlocks it won't, as long + as both A and B are taking read locks (and they do). + But other threads may take write locks. Assume there's + C who wants to start waiting on x, and D who wants to start + waiting on y. + + A read-locks x B read-locks y + A goes deeper B goes deeper + => C write-locks x (to add a new edge) D write-locks y + .. C is blocked D is blocked + A read-locks y B read-locks x + + Now, if a read lock can bypass a pending wrote lock request, we're fine. + If it can not, we have a deadlock. + + writer starvation is technically possible, but unlikely, because + the contention is expected to be low. + */ + struct { + pthread_cond_t cond; + pthread_mutex_t mutex; + uint readers: 16; + uint pending_writers: 15; + uint write_locked: 1; + } lock; +#else + rw_lock_t lock; +#endif + pthread_cond_t cond; /* the corresponding mutex is provided by the caller */ + DYNAMIC_ARRAY owners; +}; + +#ifdef WT_RWLOCKS_USE_MUTEXES +static void rc_rwlock_init(WT_RESOURCE *rc) +{ + pthread_cond_init(&rc->lock.cond, 0); + pthread_mutex_init(&rc->lock.mutex, MY_MUTEX_INIT_FAST); +} +static void rc_rwlock_destroy(WT_RESOURCE *rc) +{ + DBUG_ASSERT(rc->lock.write_locked == 0); + DBUG_ASSERT(rc->lock.readers == 0); + pthread_cond_destroy(&rc->lock.cond); + pthread_mutex_destroy(&rc->lock.mutex); +} +static void rc_rdlock(WT_RESOURCE *rc) +{ + DBUG_PRINT("wt", ("TRYLOCK resid=%ld for READ", (ulong)rc->id.value)); + pthread_mutex_lock(&rc->lock.mutex); + while (rc->lock.write_locked) + pthread_cond_wait(&rc->lock.cond, &rc->lock.mutex); + rc->lock.readers++; + pthread_mutex_unlock(&rc->lock.mutex); + DBUG_PRINT("wt", ("LOCK resid=%ld for READ", (ulong)rc->id.value)); +} +static void rc_wrlock(WT_RESOURCE *rc) +{ + DBUG_PRINT("wt", ("TRYLOCK resid=%ld for WRITE", (ulong)rc->id.value)); + pthread_mutex_lock(&rc->lock.mutex); + while (rc->lock.write_locked || rc->lock.readers) + pthread_cond_wait(&rc->lock.cond, &rc->lock.mutex); + rc->lock.write_locked= 1; + pthread_mutex_unlock(&rc->lock.mutex); + DBUG_PRINT("wt", ("LOCK resid=%ld for WRITE", (ulong)rc->id.value)); +} +static void rc_unlock(WT_RESOURCE *rc) +{ + DBUG_PRINT("wt", ("UNLOCK resid=%ld", (ulong)rc->id.value)); + pthread_mutex_lock(&rc->lock.mutex); + if (rc->lock.write_locked) + { + rc->lock.write_locked= 0; + pthread_cond_broadcast(&rc->lock.cond); + } + else if (--rc->lock.readers == 0) + pthread_cond_broadcast(&rc->lock.cond); + pthread_mutex_unlock(&rc->lock.mutex); +} +#else +static void rc_rwlock_init(WT_RESOURCE *rc) +{ + my_rwlock_init(&rc->lock, 0); +} +static void rc_rwlock_destroy(WT_RESOURCE *rc) +{ + rwlock_destroy(&rc->lock); +} +static void rc_rdlock(WT_RESOURCE *rc) +{ + DBUG_PRINT("wt", ("TRYLOCK resid=%ld for READ", (ulong)rc->id.value)); + rw_rdlock(&rc->lock); + DBUG_PRINT("wt", ("LOCK resid=%ld for READ", (ulong)rc->id.value)); +} +static void rc_wrlock(WT_RESOURCE *rc) +{ + DBUG_PRINT("wt", ("TRYLOCK resid=%ld for WRITE", (ulong)rc->id.value)); + rw_wrlock(&rc->lock); + DBUG_PRINT("wt", ("LOCK resid=%ld for WRITE", (ulong)rc->id.value)); +} +static void rc_unlock(WT_RESOURCE *rc) +{ + DBUG_PRINT("wt", ("UNLOCK resid=%ld", (ulong)rc->id.value)); + rw_unlock(&rc->lock); +} +#endif + +/* + All resources are stored in a lock-free hash. Different threads + may add new resources and perform deadlock detection concurrently. +*/ +static LF_HASH reshash; + +/** + WT_RESOURCE constructor + + It's called from lf_hash and takes a pointer to an LF_SLIST instance. + WT_RESOURCE is located at arg+sizeof(LF_SLIST) +*/ +static void wt_resource_init(uchar *arg) +{ + WT_RESOURCE *rc= (WT_RESOURCE*)(arg+LF_HASH_OVERHEAD); + DBUG_ENTER("wt_resource_init"); + + bzero(rc, sizeof(*rc)); + rc_rwlock_init(rc); + pthread_cond_init(&rc->cond, 0); + my_init_dynamic_array(&rc->owners, sizeof(WT_THD *), 0, 5); + DBUG_VOID_RETURN; +} + +/** + WT_RESOURCE destructor + + It's called from lf_hash and takes a pointer to an LF_SLIST instance. + WT_RESOURCE is located at arg+sizeof(LF_SLIST) +*/ +static void wt_resource_destroy(uchar *arg) +{ + WT_RESOURCE *rc= (WT_RESOURCE*)(arg+LF_HASH_OVERHEAD); + DBUG_ENTER("wt_resource_destroy"); + + DBUG_ASSERT(rc->owners.elements == 0); + rc_rwlock_destroy(rc); + pthread_cond_destroy(&rc->cond); + delete_dynamic(&rc->owners); + DBUG_VOID_RETURN; +} + +void wt_init() +{ + DBUG_ENTER("wt_init"); + DBUG_ASSERT(reshash.alloc.constructor != wt_resource_init); + + lf_hash_init(&reshash, sizeof(WT_RESOURCE), LF_HASH_UNIQUE, 0, + sizeof_WT_RESOURCE_ID, 0, 0); + reshash.alloc.constructor= wt_resource_init; + reshash.alloc.destructor= wt_resource_destroy; + /* + Note a trick: we initialize the hash with the real element size, + but fix it later to a shortened element size. This way + the allocator will allocate elements correctly, but + lf_hash_insert() will only overwrite part of the element with memcpy(). + lock, condition, and dynamic array will be intact. + */ + reshash.element_size= offsetof(WT_RESOURCE, lock); + bzero(wt_wait_stats, sizeof(wt_wait_stats)); + bzero(wt_cycle_stats, sizeof(wt_cycle_stats)); + wt_success_stats= 0; + { /* initialize wt_wait_table[]. from 1 us to 1 min, log e scale */ + int i; + double from= log(1); /* 1 us */ + double to= log(60e6); /* 1 min */ + for (i= 0; i < WT_WAIT_STATS; i++) + { + wt_wait_table[i]= (ulonglong)exp((to-from)/(WT_WAIT_STATS-1)*i+from); + DBUG_ASSERT(i == 0 || wt_wait_table[i-1] != wt_wait_table[i]); + } + } + my_atomic_rwlock_init(&cycle_stats_lock); + my_atomic_rwlock_init(&success_stats_lock); + my_atomic_rwlock_init(&wait_stats_lock); + DBUG_VOID_RETURN; +} + +void wt_end() +{ + DBUG_ENTER("wt_end"); + + DBUG_ASSERT(reshash.count == 0); + lf_hash_destroy(&reshash); + my_atomic_rwlock_destroy(&cycle_stats_lock); + my_atomic_rwlock_destroy(&success_stats_lock); + my_atomic_rwlock_destroy(&wait_stats_lock); + DBUG_VOID_RETURN; +} + +/** + Lazy WT_THD initialization + + Cheap initialization of WT_THD. Only initialize fields that don't require + memory allocations - basically, it only does assignments. The rest of the + WT_THD structure will be initialized on demand, on the first use. + This allows one to initialize lazily all WT_THD structures, even if some + (or even most) of them will never be used for deadlock detection. + + @param ds a pointer to deadlock search depth short value + @param ts a pointer to deadlock timeout short value + @param dl a pointer to deadlock search depth long value + @param tl a pointer to deadlock timeout long value + + @note these are pointers to values, and WT_THD stores them as pointers. + It allows one later to change search depths and timeouts for existing + threads. It also means that the pointers must stay valid for the lifetime + of WT_THD. +*/ +void wt_thd_lazy_init(WT_THD *thd, const ulong *ds, const ulong *ts, + const ulong *dl, const ulong *tl) +{ + DBUG_ENTER("wt_thd_lazy_init"); + thd->waiting_for= 0; + thd->weight= 0; + thd->deadlock_search_depth_short= ds; + thd->timeout_short= ts; + thd->deadlock_search_depth_long= dl; + thd->timeout_long= tl; + /* dynamic array is also initialized lazily - without memory allocations */ + my_init_dynamic_array(&thd->my_resources, sizeof(WT_RESOURCE *), 0, 5); +#ifndef DBUG_OFF + thd->name= my_thread_name(); +#endif + DBUG_VOID_RETURN; +} + +/** + Finalize WT_THD initialization + + After lazy WT_THD initialization, parts of the structure are still + uninitialized. This function completes the initialization, allocating + memory, if necessary. It's called automatically on demand, when WT_THD + is about to be used. +*/ +static int fix_thd_pins(WT_THD *thd) +{ + if (unlikely(thd->pins == 0)) + { + thd->pins= lf_hash_get_pins(&reshash); +#ifndef DBUG_OFF + thd->name= my_thread_name(); +#endif + } + return thd->pins == 0; +} + +void wt_thd_destroy(WT_THD *thd) +{ + DBUG_ENTER("wt_thd_destroy"); + + DBUG_ASSERT(thd->my_resources.elements == 0); + DBUG_ASSERT(thd->waiting_for == 0); + + if (thd->pins != 0) + lf_hash_put_pins(thd->pins); + + delete_dynamic(&thd->my_resources); + DBUG_VOID_RETURN; +} +/** + Trivial resource id comparison function - bytewise memcmp. + + It can be used in WT_RESOURCE_TYPE structures where bytewise + comparison of values is sufficient. +*/ +my_bool wt_resource_id_memcmp(const void *a, const void *b) +{ + /* we use the fact that there's no padding in the middle of WT_RESOURCE_ID */ + compile_time_assert(offsetof(WT_RESOURCE_ID, type) == sizeof(ulonglong)); + return memcmp(a, b, sizeof_WT_RESOURCE_ID); +} + +/** + arguments for the recursive deadlock_search function +*/ +struct deadlock_arg { + WT_THD * const thd; /**< starting point of a search */ + uint const max_depth; /**< search depth limit */ + WT_THD *victim; /**< a thread to be killed to resolve a deadlock */ + WT_RESOURCE *last_locked_rc; /**< see comment at the end of deadlock_search() */ +}; + +/** + helper function to change the victim, according to the weight +*/ +static void change_victim(WT_THD* found, struct deadlock_arg *arg) +{ + if (found->weight < arg->victim->weight) + { + if (arg->victim != arg->thd) + { + rc_unlock(arg->victim->waiting_for); /* release the previous victim */ + DBUG_ASSERT(arg->last_locked_rc == found->waiting_for); + } + arg->victim= found; + arg->last_locked_rc= 0; + } +} + +/** + recursive loop detection in a wait-for graph with a limited search depth +*/ +static int deadlock_search(struct deadlock_arg *arg, WT_THD *blocker, + uint depth) +{ + WT_RESOURCE *rc, *volatile *shared_ptr= &blocker->waiting_for; + WT_THD *cursor; + uint i; + int ret= WT_OK; + DBUG_ENTER("deadlock_search"); + DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, depth=%u", + arg->thd->name, blocker->name, depth)); + + LF_REQUIRE_PINS(1); + + arg->last_locked_rc= 0; + + if (depth > arg->max_depth) + { + DBUG_PRINT("wt", ("exit: WT_DEPTH_EXCEEDED (early)")); + DBUG_RETURN(WT_DEPTH_EXCEEDED); + } + +retry: + /* + safe dereference as explained in lf_alloc-pin.c + (in short: protects against lf_alloc_free() in lf_hash_delete()) + */ + do + { + rc= *shared_ptr; + lf_pin(arg->thd->pins, 0, rc); + } while (rc != *shared_ptr && LF_BACKOFF); + + if (rc == 0) + { + DBUG_PRINT("wt", ("exit: OK (early)")); + DBUG_RETURN(0); + } + + rc_rdlock(rc); + if (rc->state != ACTIVE || *shared_ptr != rc) + { + /* blocker is not waiting on this resource anymore */ + rc_unlock(rc); + lf_unpin(arg->thd->pins, 0); + goto retry; + } + /* as the state is locked, we can unpin now */ + lf_unpin(arg->thd->pins, 0); + + /* + Below is not a pure depth-first search. It's a depth-first with a + slightest hint of breadth-first. Depth-first is: + + check(element, X): + foreach current in element->nodes[] do: + if current == X return error; + check(current, X); + + while we do + + check(element, X): + foreach current in element->nodes[] do: + if current == X return error; + foreach current in element->nodes[] do: + check(current, X); + + preferring shorter deadlocks over longer ones. + */ + for (i= 0; i < rc->owners.elements; i++) + { + cursor= *dynamic_element(&rc->owners, i, WT_THD**); + /* + We're only looking for (and detecting) cycles that include 'arg->thd'. + That is, only deadlocks that *we* have created. For example, + thd->A->B->thd + (thd waits for A, A waits for B, while B is waiting for thd). + While walking the graph we can encounter other cicles, e.g. + thd->A->B->C->A + This will not be detected. Instead we will walk it in circles until + the search depth limit is reached (the latter guarantees that an + infinite loop is impossible). We expect the thread that has created + the cycle (one of A, B, and C) to detect its deadlock. + */ + if (cursor == arg->thd) + { + ret= WT_DEADLOCK; + increment_cycle_stats(depth, arg->max_depth == + *arg->thd->deadlock_search_depth_long); + arg->victim= cursor; + goto end; + } + } + for (i= 0; i < rc->owners.elements; i++) + { + cursor= *dynamic_element(&rc->owners, i, WT_THD**); + switch (deadlock_search(arg, cursor, depth+1)) { + case WT_OK: + break; + case WT_DEPTH_EXCEEDED: + ret= WT_DEPTH_EXCEEDED; + break; + case WT_DEADLOCK: + ret= WT_DEADLOCK; + change_victim(cursor, arg); /* also sets arg->last_locked_rc to 0 */ + i= rc->owners.elements; /* jump out of the loop */ + break; + default: + DBUG_ASSERT(0); + } + if (arg->last_locked_rc) + rc_unlock(arg->last_locked_rc); + } +end: + /* + Note that 'rc' is locked in this function, but it's never unlocked here. + Instead it's saved in arg->last_locked_rc and the *caller* is + expected to unlock it. It's done to support different killing + strategies. This is how it works: + Assuming a graph + + thd->A->B->C->thd + + deadlock_search() function starts from thd, locks it (in fact it locks not + a thd, but a resource it is waiting on, but below, for simplicity, I'll + talk about "locking a thd"). Then it goes down recursively, locks A, and so + on. Goes down recursively, locks B. Goes down recursively, locks C. + Notices that C is waiting on thd. Deadlock detected. Sets arg->victim=thd. + Returns from the last deadlock_search() call. C stays locked! + Now it checks whether C is a more appropriate victim than 'thd'. + If yes - arg->victim=C, otherwise C is unlocked. Returns. B stays locked. + Now it checks whether B is a more appropriate victim than arg->victim. + If yes - old arg->victim is unlocked and arg->victim=B, + otherwise B is unlocked. Return. + And so on. + + In short, a resource is locked in a frame. But it's not unlocked in the + same frame, it's unlocked by the caller, and only after the caller checks + that it doesn't need to use current WT_THD as a victim. If it does - the + lock is kept and the old victim's resource is unlocked. When the recursion + is unrolled and we are back to deadlock() function, there are only two + locks left - on thd and on the victim. + */ + arg->last_locked_rc= rc; + DBUG_PRINT("wt", ("exit: %s", + ret == WT_DEPTH_EXCEEDED ? "WT_DEPTH_EXCEEDED" : + ret ? "WT_DEADLOCK" : "OK")); + DBUG_RETURN(ret); +} + +/** + Deadlock detection in a wait-for graph + + A wrapper for recursive deadlock_search() - prepares deadlock_arg structure, + invokes deadlock_search(), increments statistics, notifies the victim. + + @param thd thread that is going to wait. Deadlock is detected + if, while walking the graph, we reach a thread that + is waiting on thd + @param blocker starting point of a search. In wt_thd_cond_timedwait() + it's thd, in wt_thd_will_wait_for() it's a thread that + thd is going to wait for + @param depth starting search depth. In general it's the number of + edges in the wait-for graph between thd and the + blocker. Practically only two values are used (and + supported) - when thd == blocker it's 0, when thd + waits directly for blocker, it's 1 + @param max_depth search depth limit +*/ +static int deadlock(WT_THD *thd, WT_THD *blocker, uint depth, + uint max_depth) +{ + struct deadlock_arg arg= {thd, max_depth, 0, 0}; + int ret; + DBUG_ENTER("deadlock"); + DBUG_ASSERT(depth < 2); + ret= deadlock_search(&arg, blocker, depth); + if (ret == WT_DEPTH_EXCEEDED) + { + increment_cycle_stats(WT_CYCLE_STATS, max_depth == + *thd->deadlock_search_depth_long); + ret= WT_OK; + } + /* + if we started with depth==1, blocker was never considered for a victim + in deadlock_search(). Do it here. + */ + if (ret == WT_DEADLOCK && depth) + change_victim(blocker, &arg); + if (arg.last_locked_rc) + { + /* + Special return code if there's nobody to wait for. + + depth == 0 means that we start the search from thd (thd == blocker). + ret == WT_OK means that no cycle was found and + arg.last_locked_rc == thd->waiting_for. + and arg.last_locked_rc->owners.elements == 0 means that + (applying the rule above) thd->waiting_for->owners.elements == 0, + and thd doesn't have anybody to wait for. + */ + if (depth == 0 && ret == WT_OK && arg.last_locked_rc->owners.elements == 0) + { + DBUG_ASSERT(thd == blocker); + DBUG_ASSERT(arg.last_locked_rc == thd->waiting_for); + ret= WT_FREE_TO_GO; + } + rc_unlock(arg.last_locked_rc); + } + /* notify the victim, if appropriate */ + if (ret == WT_DEADLOCK && arg.victim != thd) + { + DBUG_PRINT("wt", ("killing %s", arg.victim->name)); + arg.victim->killed= 1; + pthread_cond_broadcast(&arg.victim->waiting_for->cond); + rc_unlock(arg.victim->waiting_for); + ret= WT_OK; + } + DBUG_RETURN(ret); +} + + +/** + Delete an element from reshash if it has no waiters or owners + + rc->lock must be locked by the caller and it's unlocked on return. +*/ +static int unlock_lock_and_free_resource(WT_THD *thd, WT_RESOURCE *rc) +{ + uint keylen; + const void *key; + DBUG_ENTER("unlock_lock_and_free_resource"); + + DBUG_ASSERT(rc->state == ACTIVE); + + if (rc->owners.elements || rc->waiter_count) + { + DBUG_PRINT("wt", ("nothing to do, %u owners, %u waiters", + rc->owners.elements, rc->waiter_count)); + rc_unlock(rc); + DBUG_RETURN(0); + } + + if (fix_thd_pins(thd)) + { + rc_unlock(rc); + DBUG_RETURN(1); + } + + /* XXX if (rc->id.type->make_key) key= rc->id.type->make_key(&rc->id, &keylen); else */ + { + key= &rc->id; + keylen= sizeof_WT_RESOURCE_ID; + } + + /* + To free the element correctly we need to: + 1. take its lock (already done). + 2. set the state to FREE + 3. release the lock + 4. remove from the hash + */ + rc->state= FREE; + rc_unlock(rc); + DBUG_RETURN(lf_hash_delete(&reshash, thd->pins, key, keylen) == -1); +} + + +/** + register the fact that thd is not waiting anymore + + decrease waiter_count, clear waiting_for, free the resource if appropriate. + thd->waiting_for must be locked! +*/ +static int stop_waiting_locked(WT_THD *thd) +{ + int ret; + WT_RESOURCE *rc= thd->waiting_for; + DBUG_ENTER("stop_waiting_locked"); + + DBUG_ASSERT(rc->waiter_count); + DBUG_ASSERT(rc->state == ACTIVE); + rc->waiter_count--; + thd->waiting_for= 0; + ret= unlock_lock_and_free_resource(thd, rc); + DBUG_RETURN((thd->killed || ret) ? WT_DEADLOCK : WT_OK); +} + +/** + register the fact that thd is not waiting anymore + + locks thd->waiting_for and calls stop_waiting_locked(). +*/ +static int stop_waiting(WT_THD *thd) +{ + int ret; + WT_RESOURCE *rc= thd->waiting_for; + DBUG_ENTER("stop_waiting"); + + if (!rc) + DBUG_RETURN(WT_OK); + /* + nobody's trying to free the resource now, + as its waiter_count is guaranteed to be non-zero + */ + rc_wrlock(rc); + ret= stop_waiting_locked(thd); + DBUG_RETURN(ret); +} + +/** + notify the system that a thread needs to wait for another thread + + called by a *waiter* to declare that it (thd) will wait for another + thread (blocker) on a specific resource (resid). + can be called many times, if many blockers own a blocking resource. + but must always be called with the same resource id - a thread cannot + wait for more than one resource at a time. + + @return WT_OK or WT_DEADLOCK + + As a new edge is added to the wait-for graph, a deadlock detection is + performed for this new edge. +*/ +int wt_thd_will_wait_for(WT_THD *thd, WT_THD *blocker, + const WT_RESOURCE_ID *resid) +{ + uint i; + WT_RESOURCE *rc; + DBUG_ENTER("wt_thd_will_wait_for"); + + LF_REQUIRE_PINS(3); + + DBUG_PRINT("wt", ("enter: thd=%s, blocker=%s, resid=%lu", + thd->name, blocker->name, (ulong)resid->value)); + + if (fix_thd_pins(thd)) + DBUG_RETURN(WT_DEADLOCK); + + if (thd->waiting_for == 0) + { + uint keylen; + const void *key; + /* XXX if (restype->make_key) key= restype->make_key(resid, &keylen); else */ + { + key= resid; + keylen= sizeof_WT_RESOURCE_ID; + } + + DBUG_PRINT("wt", ("first blocker")); + +retry: + while ((rc= lf_hash_search(&reshash, thd->pins, key, keylen)) == 0) + { + WT_RESOURCE tmp; + + DBUG_PRINT("wt", ("failed to find rc in hash, inserting")); + bzero(&tmp, sizeof(tmp)); + tmp.id= *resid; + tmp.state= ACTIVE; + + if (lf_hash_insert(&reshash, thd->pins, &tmp) == -1) /* if OOM */ + DBUG_RETURN(WT_DEADLOCK); + /* + Two cases: either lf_hash_insert() failed - because another thread + has just inserted a resource with the same id - and we need to retry. + Or lf_hash_insert() succeeded, and then we need to repeat + lf_hash_search() to find a real address of the newly inserted element. + That is, we don't care what lf_hash_insert() has returned. + And we need to repeat the loop anyway. + */ + } + if (rc == MY_ERRPTR) + DBUG_RETURN(WT_DEADLOCK); + + DBUG_PRINT("wt", ("found in hash rc=%p", rc)); + + rc_wrlock(rc); + if (rc->state != ACTIVE) + { + DBUG_PRINT("wt", ("but it's not active, retrying")); + /* Somebody has freed the element while we weren't looking */ + rc_unlock(rc); + lf_hash_search_unpin(thd->pins); + goto retry; + } + + lf_hash_search_unpin(thd->pins); /* the element cannot go away anymore */ + thd->waiting_for= rc; + rc->waiter_count++; + thd->killed= 0; + } + else + { + DBUG_ASSERT(thd->waiting_for->id.type == resid->type); + DBUG_ASSERT(resid->type->compare(&thd->waiting_for->id, resid) == 0); + DBUG_PRINT("wt", ("adding another blocker")); + + /* + we can safely access the resource here, it's in the hash as it has + non-zero waiter_count + */ + rc= thd->waiting_for; + rc_wrlock(rc); + DBUG_ASSERT(rc->waiter_count); + DBUG_ASSERT(rc->state == ACTIVE); + + if (thd->killed) + { + stop_waiting_locked(thd); + DBUG_RETURN(WT_DEADLOCK); + } + } + /* + Another thread could be waiting on this resource for this very 'blocker'. + In this case we should not add it to the list for the second time. + */ + for (i= 0; i < rc->owners.elements; i++) + if (*dynamic_element(&rc->owners, i, WT_THD**) == blocker) + break; + if (i >= rc->owners.elements) + { + if (push_dynamic(&blocker->my_resources, (void*)&rc)) + { + stop_waiting_locked(thd); + DBUG_RETURN(WT_DEADLOCK); /* deadlock and OOM use the same error code */ + } + if (push_dynamic(&rc->owners, (void*)&blocker)) + { + pop_dynamic(&blocker->my_resources); + stop_waiting_locked(thd); + DBUG_RETURN(WT_DEADLOCK); + } + } + rc_unlock(rc); + + if (deadlock(thd, blocker, 1, *thd->deadlock_search_depth_short) != WT_OK) + { + stop_waiting(thd); + DBUG_RETURN(WT_DEADLOCK); + } + DBUG_RETURN(WT_OK); +} + +/** + called by a *waiter* (thd) to start waiting + + It's supposed to be a drop-in replacement for + pthread_cond_timedwait(), and it takes mutex as an argument. + + @return one of WT_TIMEOUT, WT_DEADLOCK, WT_OK +*/ +int wt_thd_cond_timedwait(WT_THD *thd, pthread_mutex_t *mutex) +{ + int ret= WT_TIMEOUT; + struct timespec timeout; + ulonglong before, after, starttime; + WT_RESOURCE *rc= thd->waiting_for; + DBUG_ENTER("wt_thd_cond_timedwait"); + DBUG_PRINT("wt", ("enter: thd=%s, rc=%p", thd->name, rc)); + +#ifndef DBUG_OFF + if (rc->cond_mutex) + DBUG_ASSERT(rc->cond_mutex == mutex); + else + rc->cond_mutex= mutex; + safe_mutex_assert_owner(mutex); +#endif + + before= starttime= my_getsystime(); + +#ifdef __WIN__ + /* + only for the sake of Windows we distinguish between + 'before' and 'starttime': + + my_getsystime() returns high-resolution value, that cannot be used for + waiting (it doesn't follow system clock changes), but is good for time + intervals. + + GetSystemTimeAsFileTime() follows system clock, but is low-resolution + and will result in lousy intervals. + */ + GetSystemTimeAsFileTime((PFILETIME)&starttime); +#endif + + rc_wrlock(rc); + if (rc->owners.elements == 0) + ret= WT_OK; + rc_unlock(rc); + + set_timespec_time_nsec(timeout, starttime, (*thd->timeout_short)*1000ULL); + if (ret == WT_TIMEOUT && !thd->killed) + ret= pthread_cond_timedwait(&rc->cond, mutex, &timeout); + if (ret == WT_TIMEOUT && !thd->killed) + { + int r= deadlock(thd, thd, 0, *thd->deadlock_search_depth_long); + if (r == WT_FREE_TO_GO) + ret= WT_OK; + else if (r != WT_OK) + ret= WT_DEADLOCK; + else if (*thd->timeout_long > *thd->timeout_short) + { + set_timespec_time_nsec(timeout, starttime, (*thd->timeout_long)*1000ULL); + if (!thd->killed) + ret= pthread_cond_timedwait(&rc->cond, mutex, &timeout); + } + } + after= my_getsystime(); + if (stop_waiting(thd) == WT_DEADLOCK) /* if we're killed */ + ret= WT_DEADLOCK; + increment_wait_stats(after-before, ret); + if (ret == WT_OK) + increment_success_stats(); + DBUG_RETURN(ret); +} + +/** + called by a *blocker* when it releases a resource + + it's conceptually similar to pthread_cond_broadcast, and must be done + under the same mutex as wt_thd_cond_timedwait(). + + @param resid a resource to release. 0 to release all resources +*/ + +void wt_thd_release(WT_THD *thd, const WT_RESOURCE_ID *resid) +{ + uint i; + DBUG_ENTER("wt_thd_release"); + + for (i= 0; i < thd->my_resources.elements; i++) + { + WT_RESOURCE *rc= *dynamic_element(&thd->my_resources, i, WT_RESOURCE**); + if (!resid || (resid->type->compare(&rc->id, resid) == 0)) + { + uint j; + + rc_wrlock(rc); + /* + nobody's trying to free the resource now, + as its owners[] array is not empty (at least thd must be there) + */ + DBUG_ASSERT(rc->state == ACTIVE); + for (j= 0; j < rc->owners.elements; j++) + if (*dynamic_element(&rc->owners, j, WT_THD**) == thd) + break; + DBUG_ASSERT(j < rc->owners.elements); + delete_dynamic_element(&rc->owners, j); + if (rc->owners.elements == 0) + { + pthread_cond_broadcast(&rc->cond); +#ifndef DBUG_OFF + if (rc->cond_mutex) + safe_mutex_assert_owner(rc->cond_mutex); +#endif + } + unlock_lock_and_free_resource(thd, rc); + if (resid) + { + delete_dynamic_element(&thd->my_resources, i); + DBUG_VOID_RETURN; + } + } + } + if (!resid) + reset_dynamic(&thd->my_resources); + DBUG_VOID_RETURN; +} + diff --git a/externals/mysql/mysys/wqueue.c b/externals/mysql/mysys/wqueue.c new file mode 100644 index 0000000..fcc0a39 --- /dev/null +++ b/externals/mysql/mysys/wqueue.c @@ -0,0 +1,225 @@ + +#include + +#define STRUCT_PTR(TYPE, MEMBER, a) \ + (TYPE *) ((char *) (a) - offsetof(TYPE, MEMBER)) +/* + Link a thread into double-linked queue of waiting threads. + + SYNOPSIS + wqueue_link_into_queue() + wqueue pointer to the queue structure + thread pointer to the thread to be added to the queue + + RETURN VALUE + none + + NOTES. + Queue is represented by a circular list of the thread structures + The list is double-linked of the type (**prev,*next), accessed by + a pointer to the last element. +*/ + +void wqueue_link_into_queue(WQUEUE *wqueue, struct st_my_thread_var *thread) +{ + struct st_my_thread_var *last; + if (!(last= wqueue->last_thread)) + { + /* Queue is empty */ + thread->next= thread; + thread->prev= &thread->next; + } + else + { + thread->prev= last->next->prev; + last->next->prev= &thread->next; + thread->next= last->next; + last->next= thread; + } + wqueue->last_thread= thread; +} + + +/* + Add a thread to single-linked queue of waiting threads + + SYNOPSIS + wqueue_add_to_queue() + wqueue pointer to the queue structure + thread pointer to the thread to be added to the queue + + RETURN VALUE + none + + NOTES. + Queue is represented by a circular list of the thread structures + The list is single-linked of the type (*next), accessed by a pointer + to the last element. +*/ + +void wqueue_add_to_queue(WQUEUE *wqueue, struct st_my_thread_var *thread) +{ + struct st_my_thread_var *last; + if (!(last= wqueue->last_thread)) + thread->next= thread; + else + { + thread->next= last->next; + last->next= thread; + } +#ifndef DBUG_OFF + thread->prev= NULL; /* force segfault if used */ +#endif + wqueue->last_thread= thread; +} + +/* + Unlink a thread from double-linked queue of waiting threads + + SYNOPSIS + wqueue_unlink_from_queue() + wqueue pointer to the queue structure + thread pointer to the thread to be removed from the queue + + RETURN VALUE + none + + NOTES. + See NOTES for link_into_queue +*/ + +void wqueue_unlink_from_queue(WQUEUE *wqueue, struct st_my_thread_var *thread) +{ + if (thread->next == thread) + /* The queue contains only one member */ + wqueue->last_thread= NULL; + else + { + thread->next->prev= thread->prev; + *thread->prev= thread->next; + if (wqueue->last_thread == thread) + wqueue->last_thread= STRUCT_PTR(struct st_my_thread_var, next, + thread->prev); + } + thread->next= NULL; +} + + +/* + Remove all threads from queue signaling them to proceed + + SYNOPSIS + wqueue_realease_queue() + wqueue pointer to the queue structure + thread pointer to the thread to be added to the queue + + RETURN VALUE + none + + NOTES. + See notes for add_to_queue + When removed from the queue each thread is signaled via condition + variable thread->suspend. +*/ + +void wqueue_release_queue(WQUEUE *wqueue) +{ + struct st_my_thread_var *last= wqueue->last_thread; + struct st_my_thread_var *next= last->next; + struct st_my_thread_var *thread; + do + { + thread= next; + pthread_cond_signal(&thread->suspend); + next= thread->next; + thread->next= NULL; + } + while (thread != last); + wqueue->last_thread= NULL; +} + + +/** + @brief Removes all threads waiting for read or first one waiting for write. + + @param wqueue pointer to the queue structure + @param thread pointer to the thread to be added to the queue + + @note This function is applicable only to single linked lists. +*/ + +void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue) +{ + struct st_my_thread_var *last= wqueue->last_thread; + struct st_my_thread_var *next= last->next; + struct st_my_thread_var *thread; + struct st_my_thread_var *new_list= NULL; + uint first_type= next->lock_type; + if (first_type == MY_PTHREAD_LOCK_WRITE) + { + /* release first waiting for write lock */ + pthread_cond_signal(&next->suspend); + if (next == last) + wqueue->last_thread= NULL; + else + last->next= next->next; + next->next= NULL; + return; + } + do + { + thread= next; + next= thread->next; + if (thread->lock_type == MY_PTHREAD_LOCK_WRITE) + { + /* skip waiting for write lock */ + if (new_list) + { + thread->next= new_list->next; + new_list= new_list->next= thread; + } + else + new_list= thread->next= thread; + } + else + { + /* release waiting for read lock */ + pthread_cond_signal(&thread->suspend); + thread->next= NULL; + } + } while (thread != last); + wqueue->last_thread= new_list; +} + + +/* + Add thread and wait + + SYNOPSYS + wqueue_add_and_wait() + wqueue queue to add to + thread thread which is waiting + lock mutex need for the operation +*/ + +void wqueue_add_and_wait(WQUEUE *wqueue, + struct st_my_thread_var *thread, + pthread_mutex_t *lock) +{ + DBUG_ENTER("wqueue_add_and_wait"); + DBUG_PRINT("enter", + ("thread: 0x%lx cond: 0x%lx mutex: 0x%lx", + (ulong) thread, (ulong) &thread->suspend, (ulong) lock)); + wqueue_add_to_queue(wqueue, thread); + do + { + DBUG_PRINT("info", ("wait... cond: 0x%lx mutex: 0x%lx", + (ulong) &thread->suspend, (ulong) lock)); + pthread_cond_wait(&thread->suspend, lock); + DBUG_PRINT("info", ("wait done cond: 0x%lx mutex: 0x%lx next: 0x%lx", + (ulong) &thread->suspend, (ulong) lock, + (ulong) thread->next)); + } + while (thread->next); + DBUG_VOID_RETURN; +} diff --git a/externals/mysql/mysys_err.h b/externals/mysql/mysys_err.h new file mode 100644 index 0000000..7167395 --- /dev/null +++ b/externals/mysql/mysys_err.h @@ -0,0 +1,90 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _mysys_err_h +#define _mysys_err_h +#ifdef __cplusplus +extern "C" { +#endif + +#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */ +#define EE(X) (globerrs[(X) - EE_ERROR_FIRST]) + +extern const char * NEAR globerrs[]; /* my_error_messages is here */ + +/* Error message numbers in global map */ +/* + Do not add error numbers before EE_ERROR_FIRST. + If necessary to add lower numbers, change EE_ERROR_FIRST accordingly. + + We start with error 1 to not confuse peoples with 'error 0' +*/ + +#define EE_ERROR_FIRST 1 /*Copy first error nr.*/ +#define EE_CANTCREATEFILE 1 +#define EE_READ 2 +#define EE_WRITE 3 +#define EE_BADCLOSE 4 +#define EE_OUTOFMEMORY 5 +#define EE_DELETE 6 +#define EE_LINK 7 +#define EE_EOFERR 9 +#define EE_CANTLOCK 10 +#define EE_CANTUNLOCK 11 +#define EE_DIR 12 +#define EE_STAT 13 +#define EE_CANT_CHSIZE 14 +#define EE_CANT_OPEN_STREAM 15 +#define EE_GETWD 16 +#define EE_SETWD 17 +#define EE_LINK_WARNING 18 +#define EE_OPEN_WARNING 19 +#define EE_DISK_FULL 20 +#define EE_CANT_MKDIR 21 +#define EE_UNKNOWN_CHARSET 22 +#define EE_OUT_OF_FILERESOURCES 23 +#define EE_CANT_READLINK 24 +#define EE_CANT_SYMLINK 25 +#define EE_REALPATH 26 +#define EE_SYNC 27 +#define EE_UNKNOWN_COLLATION 28 +#define EE_FILENOTFOUND 29 +#define EE_FILE_NOT_CLOSED 30 +#define EE_CANT_CHMOD 31 +#define EE_ERROR_LAST 31 /* Copy last error nr */ +/* Add error numbers before EE_ERROR_LAST and change it accordingly. */ + + /* exit codes for all MySQL programs */ + +#define EXIT_UNSPECIFIED_ERROR 1 +#define EXIT_UNKNOWN_OPTION 2 +#define EXIT_AMBIGUOUS_OPTION 3 +#define EXIT_NO_ARGUMENT_ALLOWED 4 +#define EXIT_ARGUMENT_REQUIRED 5 +#define EXIT_VAR_PREFIX_NOT_UNIQUE 6 +#define EXIT_UNKNOWN_VARIABLE 7 +#define EXIT_OUT_OF_MEMORY 8 +#define EXIT_UNKNOWN_SUFFIX 9 +#define EXIT_NO_PTR_TO_VARIABLE 10 +#define EXIT_CANNOT_CONNECT_TO_SERVICE 11 +#define EXIT_OPTION_DISABLED 12 +#define EXIT_ARGUMENT_INVALID 13 + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/mysql/queues.h b/externals/mysql/queues.h new file mode 100644 index 0000000..d01b73b --- /dev/null +++ b/externals/mysql/queues.h @@ -0,0 +1,72 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Code for generell handling of priority Queues. + Implemention of queues from "Algoritms in C" by Robert Sedgewick. + Copyright Monty Program KB. + By monty. +*/ + +#ifndef _queues_h +#define _queues_h +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_queue { + uchar **root; + void *first_cmp_arg; + uint elements; + uint max_elements; + uint offset_to_key; /* compare is done on element+offset */ + int max_at_top; /* Normally 1, set to -1 if queue_top gives max */ + int (*compare)(void *, uchar *,uchar *); + uint auto_extent; +} QUEUE; + +#define queue_top(queue) ((queue)->root[1]) +#define queue_element(queue,index) ((queue)->root[index+1]) +#define queue_end(queue) ((queue)->root[(queue)->elements]) +#define queue_replaced(queue) _downheap(queue,1) +#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg +#define queue_set_max_at_top(queue, set_arg) \ + (queue)->max_at_top= set_arg ? -1 : 1 +typedef int (*queue_compare)(void *,uchar *, uchar *); + +int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, + pbool max_at_top, queue_compare compare, + void *first_cmp_arg); +int init_queue_ex(QUEUE *queue,uint max_elements,uint offset_to_key, + pbool max_at_top, queue_compare compare, + void *first_cmp_arg, uint auto_extent); +int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, + pbool max_at_top, queue_compare compare, + void *first_cmp_arg); +int resize_queue(QUEUE *queue, uint max_elements); +void delete_queue(QUEUE *queue); +void queue_insert(QUEUE *queue,uchar *element); +int queue_insert_safe(QUEUE *queue, uchar *element); +uchar *queue_remove(QUEUE *queue,uint idx); +#define queue_remove_all(queue) { (queue)->elements= 0; } +#define queue_is_full(queue) (queue->elements == queue->max_elements) +void _downheap(QUEUE *queue,uint idx); +void queue_fix(QUEUE *queue); +#define is_queue_inited(queue) ((queue)->root != 0) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/mysql/service_versions.h b/externals/mysql/service_versions.h new file mode 100644 index 0000000..114957c --- /dev/null +++ b/externals/mysql/service_versions.h @@ -0,0 +1,24 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef _WIN32 +#define SERVICE_VERSION __declspec(dllexport) void * +#else +#define SERVICE_VERSION void * +#endif + +#define VERSION_my_snprintf 0x0100 +#define VERSION_thd_alloc 0x0100 + diff --git a/externals/mysql/sha1.h b/externals/mysql/sha1.h new file mode 100644 index 0000000..e476456 --- /dev/null +++ b/externals/mysql/sha1.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2002, 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This is the header file for code which implements the Secure + Hashing Algorithm 1 as defined in FIPS PUB 180-1 published + April 17, 1995. + + Many of the variable names in this code, especially the + single character names, were used because those were the names + used in the publication. + + Please read the file sha1.c for more information. + + Modified 2002 by Peter Zaitsev to better follow MySQL standards +*/ + + +enum sha_result_codes +{ + SHA_SUCCESS = 0, + SHA_NULL, /* Null pointer parameter */ + SHA_INPUT_TOO_LONG, /* input data too long */ + SHA_STATE_ERROR /* called Input after Result */ +}; + +#define SHA1_HASH_SIZE 20 /* Hash size in bytes */ + +/* + This structure will hold context information for the SHA-1 + hashing operation +*/ + +typedef struct SHA1_CONTEXT +{ + ulonglong Length; /* Message length in bits */ + uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */ + int Computed; /* Is the digest computed? */ + int Corrupted; /* Is the message digest corrupted? */ + int16 Message_Block_Index; /* Index into message block array */ + uint8 Message_Block[64]; /* 512-bit message blocks */ +} SHA1_CONTEXT; + +/* + Function Prototypes +*/ + +C_MODE_START + +int mysql_sha1_reset(SHA1_CONTEXT*); +int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int); +int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]); + +C_MODE_END diff --git a/externals/mysql/sha2.h b/externals/mysql/sha2.h new file mode 100644 index 0000000..49dbac5 --- /dev/null +++ b/externals/mysql/sha2.h @@ -0,0 +1,72 @@ +/* Copyright (C) 2007 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef included_sha2_h +#define included_sha2_h + +#include + +#if defined(HAVE_YASSL) || defined(HAVE_OPENSSL) + +# ifdef HAVE_STDDEF_H +# include +# endif + +# ifndef HAVE_YASSL +# include + +# else + +#include "../extra/yassl/taocrypt/include/sha.hpp" + +# ifdef __cplusplus +extern "C" { +# endif + +#ifndef SHA512_DIGEST_LENGTH +#define SHA512_DIGEST_LENGTH TaoCrypt::SHA512::DIGEST_SIZE +#endif + +#ifndef SHA384_DIGEST_LENGTH +#define SHA384_DIGEST_LENGTH TaoCrypt::SHA384::DIGEST_SIZE +#endif + +#ifndef SHA256_DIGEST_LENGTH +#define SHA256_DIGEST_LENGTH TaoCrypt::SHA256::DIGEST_SIZE +#endif + +#ifndef SHA224_DIGEST_LENGTH +#define SHA224_DIGEST_LENGTH TaoCrypt::SHA224::DIGEST_SIZE +#endif + +#define GEN_YASSL_SHA2_BRIDGE(size) \ +unsigned char* SHA##size(const unsigned char *input_ptr, size_t input_length, \ + char unsigned *output_ptr); + +GEN_YASSL_SHA2_BRIDGE(512); +GEN_YASSL_SHA2_BRIDGE(384); +GEN_YASSL_SHA2_BRIDGE(256); +GEN_YASSL_SHA2_BRIDGE(224); + +#undef GEN_YASSL_SHA2_BRIDGE + +# ifdef __cplusplus +} +# endif + +# endif /* HAVE_YASSL */ + +#endif /* HAVE_OPENSSL || HAVE_YASSL */ +#endif /* included_sha2_h */ diff --git a/externals/mysql/sql_common.h b/externals/mysql/sql_common.h new file mode 100644 index 0000000..9e43d07 --- /dev/null +++ b/externals/mysql/sql_common.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2003-2004, 2006 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +extern const char *unknown_sqlstate; +extern const char *cant_connect_sqlstate; +extern const char *not_error_sqlstate; + +#ifdef __cplusplus +extern "C" { +#endif + +extern CHARSET_INFO *default_client_charset_info; +MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, + my_bool default_value, uint server_capabilities); +void free_rows(MYSQL_DATA *cur); +void free_old_query(MYSQL *mysql); +void end_server(MYSQL *mysql); +my_bool mysql_reconnect(MYSQL *mysql); +void mysql_read_default_options(struct st_mysql_options *options, + const char *filename,const char *group); +my_bool +cli_advanced_command(MYSQL *mysql, enum enum_server_command command, + const unsigned char *header, ulong header_length, + const unsigned char *arg, ulong arg_length, + my_bool skip_check, MYSQL_STMT *stmt); +unsigned long cli_safe_read(MYSQL *mysql); +void net_clear_error(NET *net); +void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net); +void set_stmt_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate, + const char *err); +void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate); +#ifdef __cplusplus +} +#endif + +#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41) + diff --git a/externals/mysql/sslopt-case.h b/externals/mysql/sslopt-case.h new file mode 100644 index 0000000..ee6c83c --- /dev/null +++ b/externals/mysql/sslopt-case.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + case OPT_SSL_KEY: + case OPT_SSL_CERT: + case OPT_SSL_CA: + case OPT_SSL_CAPATH: + case OPT_SSL_CIPHER: + /* + Enable use of SSL if we are using any ssl option + One can disable SSL later by using --skip-ssl or --ssl=0 + */ + opt_use_ssl= 1; + break; +#endif diff --git a/externals/mysql/sslopt-longopts.h b/externals/mysql/sslopt-longopts.h new file mode 100644 index 0000000..06422e5 --- /dev/null +++ b/externals/mysql/sslopt-longopts.h @@ -0,0 +1,45 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) + + {"ssl", OPT_SSL_SSL, + "Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.", + (uchar **) &opt_use_ssl, (uchar **) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, + {"ssl-ca", OPT_SSL_CA, + "CA file in PEM format (check OpenSSL docs, implies --ssl).", + (uchar **) &opt_ssl_ca, (uchar **) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-capath", OPT_SSL_CAPATH, + "CA directory (check OpenSSL docs, implies --ssl).", + (uchar **) &opt_ssl_capath, (uchar **) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).", + (uchar **) &opt_ssl_cert, (uchar **) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).", + (uchar **) &opt_ssl_cipher, (uchar **) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).", + (uchar **) &opt_ssl_key, (uchar **) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, +#ifdef MYSQL_CLIENT + {"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT, + "Verify server's \"Common Name\" in its cert against hostname used when connecting. This option is disabled by default.", + (uchar **) &opt_ssl_verify_server_cert, (uchar **) &opt_ssl_verify_server_cert, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/sslopt-vars.h b/externals/mysql/sslopt-vars.h new file mode 100644 index 0000000..9d25c33 --- /dev/null +++ b/externals/mysql/sslopt-vars.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) +#ifdef SSL_VARS_NOT_STATIC +#define SSL_STATIC +#else +#define SSL_STATIC static +#endif +SSL_STATIC my_bool opt_use_ssl = 0; +SSL_STATIC char *opt_ssl_ca = 0; +SSL_STATIC char *opt_ssl_capath = 0; +SSL_STATIC char *opt_ssl_cert = 0; +SSL_STATIC char *opt_ssl_cipher = 0; +SSL_STATIC char *opt_ssl_key = 0; +#ifdef MYSQL_CLIENT +SSL_STATIC my_bool opt_ssl_verify_server_cert= 0; +#endif +#endif diff --git a/externals/mysql/strings/bchange.c b/externals/mysql/strings/bchange.c new file mode 100644 index 0000000..0b2c620 --- /dev/null +++ b/externals/mysql/strings/bchange.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : bchange.c + Author : Michael widenius + Updated: 1987-03-20 + Defines: bchange() + + bchange(dst, old_length, src, new_length, tot_length) + replaces old_length characters at dst to new_length characters from + src in a buffer with tot_length bytes. +*/ + +#include +#include "m_string.h" + +void bchange(register uchar *dst, size_t old_length, register const uchar *src, + size_t new_length, size_t tot_length) +{ + size_t rest=tot_length-old_length; + if (old_length < new_length) + bmove_upp(dst+rest+new_length,dst+tot_length,rest); + else + bmove(dst+new_length,dst+old_length,rest); + memcpy(dst,src,new_length); +} diff --git a/externals/mysql/strings/bcmp.c b/externals/mysql/strings/bcmp.c new file mode 100644 index 0000000..1b6ed22 --- /dev/null +++ b/externals/mysql/strings/bcmp.c @@ -0,0 +1,66 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are + identical to the "len" bytes starting at "s2", non-zero if they are + different. + Now only used with purify because purify gives wrong warnings when + comparing a shorter string with bcmp. +*/ + +#include +#include "m_string.h" + +#ifdef HAVE_purify +#undef bcmp +#undef HAVE_BCMP +#endif + +#if !defined(bcmp) && !defined(HAVE_BCMP) + +#if defined(MC68000) && defined(DS90) + +int bcmp(s1,s2, len) +const char *s1; +const char *s2; +uint len; /* 0 <= len <= 65535 */ +{ + asm(" movl 12(a7),d0 "); + asm(" subqw #1,d0 "); + asm(" blt .L5 "); + asm(" movl 4(a7),a1 "); + asm(" movl 8(a7),a0 "); + asm(".L4: cmpmb (a0)+,(a1)+ "); + asm(" dbne d0,.L4 "); + asm(".L5: addqw #1,d0 "); +} + +#else + +#ifndef HAVE_purify +size_t bcmp(register const uchar *s1,register const uchar *s2, + register size_t len) +#else +size_t my_bcmp(register const uchar *s1,register const uchar *s2, + register size_t len) +#endif +{ + while (len-- != 0 && *s1++ == *s2++) ; + return len+1; +} + +#endif +#endif /* BSD_FUNCS */ diff --git a/externals/mysql/strings/bfill.c b/externals/mysql/strings/bfill.c new file mode 100644 index 0000000..2750553 --- /dev/null +++ b/externals/mysql/strings/bfill.c @@ -0,0 +1,98 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* File : bfill.c + Author : Richard A. O'Keefe. + Michael Widenius; ifdef MC68000 + Updated: 23 April 1984 + Defines: bfill() + + bfill(dst, len, fill) moves "len" fill characters to "dst". + Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' '). + + Note: the "b" routines are there to exploit certain VAX order codes, + but the MOVC5 instruction will only move 65535 characters. The asm + code is presented for your interest and amusement. +*/ + +#include +#include "m_string.h" + +#if !defined(bfill) && !defined(HAVE_BFILL) + +#if VaxAsm + +void bfill(dst, len, fill) +char *dst; +uint len; +int fill; /* actually char */ +{ + asm("movc5 $0,*4(ap),12(ap),8(ap),*4(ap)"); +} + +#elif defined(MC68000) && defined(DS90) + +void bfill(dst, len,fill) /* Optimized with long-fill */ +char *dst; +uint len; +pchar fill; +{ +asm(" movl 8.(a7),d1 "); +asm(" jeq .L9 "); +asm(" movl 4.(a7),a0 "); +asm(" moveq #0,d0 "); +asm(" movb 15.(a7),d0 "); +asm(" movl d2,a1 "); +asm(" movw d0,d2 "); +asm(" aslw #8,d0 "); +asm(" orw d2,d0 "); +asm(" movl d0,d2 "); +asm(" swap d0 "); +asm(" orl d2,d0 "); +asm(" movl a0,d2 "); +asm(" btst #0,d2 "); +asm(" jeq .L1 "); +asm(" movb d0,(a0)+ "); +asm(" subql #1,d1 "); +asm(".L1: movl d1,d2 "); +asm(" lsrl #2,d2 "); +asm(" jcc .L2 "); +asm(" movw d0,(a0)+ "); +asm(" jra .L2 "); +asm(".L3: movl d0,(a0)+ "); +asm(".L2: dbra d2,.L3 "); +asm(" addqw #1,d2 "); +asm(" subql #1,d2 "); +asm(" jcc .L3 "); +asm(" andl #1,d1 "); +asm(" jeq .L8 "); +asm(" movb d0,(a0) "); +asm(".L8: movl a1,d2 "); +asm(".L9: rts "); +} +#else + +void bfill(dst, len, fill) +register byte *dst; +register uint len; +register pchar fill; +{ + while (len-- != 0) *dst++ = fill; +} + +#endif +#endif diff --git a/externals/mysql/strings/bmove.c b/externals/mysql/strings/bmove.c new file mode 100644 index 0000000..ae9641a --- /dev/null +++ b/externals/mysql/strings/bmove.c @@ -0,0 +1,80 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* File : bmove.c + Author : Richard A. O'Keefe. + Michael Widenius; ifdef MC68000 + Updated: 23 April 1984 + Defines: bmove() + + bmove(dst, src, len) moves exactly "len" bytes from the source "src" + to the destination "dst". It does not check for NUL characters as + strncpy() and strnmov() do. Thus if your C compiler doesn't support + structure assignment, you can simulate it with + bmove(&to, &from, sizeof from); + The standard 4.2bsd routine for this purpose is bcopy. But as bcopy + has its first two arguments the other way around you may find this a + bit easier to get right. + No value is returned. + + Note: the "b" routines are there to exploit certain VAX order codes, + but the MOVC3 instruction will only move 65535 characters. The asm + code is presented for your interest and amusement. +*/ + +#include +#include "m_string.h" + +#if !defined(HAVE_BMOVE) && !defined(bmove) + +#if VaxAsm + +void bmove(dst, src, len) + char *dst, *src; + uint len; + { + asm("movc3 12(ap),*8(ap),*4(ap)"); + } + +#else +#if defined(MC68000) && defined(DS90) + +void bmove(dst, src, len) +char *dst,*src; +uint len; /* 0 <= len <= 65535 */ +{ +asm(" movl 12(a7),d0 "); +asm(" subql #1,d0 "); +asm(" blt .L5 "); +asm(" movl 4(a7),a1 "); +asm(" movl 8(a7),a0 "); +asm(".L4: movb (a0)+,(a1)+ "); +asm(" dbf d0,.L4 "); +asm(".L5: "); +} +#else + +void bmove(dst, src, len) +register char *dst; +register const char *src; +register uint len; +{ + while (len-- != 0) *dst++ = *src++; +} +#endif +#endif +#endif diff --git a/externals/mysql/strings/bmove512.c b/externals/mysql/strings/bmove512.c new file mode 100644 index 0000000..0ae23d1 --- /dev/null +++ b/externals/mysql/strings/bmove512.c @@ -0,0 +1,125 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : bmove512.c + Author : Michael Widenius; + Defines: bmove512() + + bmove512(dst, src, len) moves exactly "len" bytes from the source "src" + to the destination "dst". "src" and "dst" must be alligned on long + boundory and len must be a mutliple of 512 byte. If len is not a + multiple of 512 byte len/512*512+1 bytes is copyed. + bmove512 is moustly used to copy IO_BLOCKS. bmove512 should be the + fastest way to move a mutiple of 512 byte. +*/ + +#include +#include "m_string.h" + +#ifndef bmove512 + +#ifdef HAVE_LONG_LONG +#define LONG ulonglong +#else +#define LONG ulong +#endif + +void bmove512(uchar *to, const uchar *from, register size_t length) +{ + reg1 LONG *f,*t,*end= (LONG*) ((char*) from+length); + + f= (LONG*) from; + t= (LONG*) to; + +#if defined(m88k) || defined(sparc) || defined(HAVE_LONG_LONG) + do { + t[0]=f[0]; t[1]=f[1]; t[2]=f[2]; t[3]=f[3]; + t[4]=f[4]; t[5]=f[5]; t[6]=f[6]; t[7]=f[7]; + t[8]=f[8]; t[9]=f[9]; t[10]=f[10]; t[11]=f[11]; + t[12]=f[12]; t[13]=f[13]; t[14]=f[14]; t[15]=f[15]; + t[16]=f[16]; t[17]=f[17]; t[18]=f[18]; t[19]=f[19]; + t[20]=f[20]; t[21]=f[21]; t[22]=f[22]; t[23]=f[23]; + t[24]=f[24]; t[25]=f[25]; t[26]=f[26]; t[27]=f[27]; + t[28]=f[28]; t[29]=f[29]; t[30]=f[30]; t[31]=f[31]; + t[32]=f[32]; t[33]=f[33]; t[34]=f[34]; t[35]=f[35]; + t[36]=f[36]; t[37]=f[37]; t[38]=f[38]; t[39]=f[39]; + t[40]=f[40]; t[41]=f[41]; t[42]=f[42]; t[43]=f[43]; + t[44]=f[44]; t[45]=f[45]; t[46]=f[46]; t[47]=f[47]; + t[48]=f[48]; t[49]=f[49]; t[50]=f[50]; t[51]=f[51]; + t[52]=f[52]; t[53]=f[53]; t[54]=f[54]; t[55]=f[55]; + t[56]=f[56]; t[57]=f[57]; t[58]=f[58]; t[59]=f[59]; + t[60]=f[60]; t[61]=f[61]; t[62]=f[62]; t[63]=f[63]; +#ifdef HAVE_LONG_LONG + t+=64; f+=64; +#else + t[64]=f[64]; t[65]=f[65]; t[66]=f[66]; t[67]=f[67]; + t[68]=f[68]; t[69]=f[69]; t[70]=f[70]; t[71]=f[71]; + t[72]=f[72]; t[73]=f[73]; t[74]=f[74]; t[75]=f[75]; + t[76]=f[76]; t[77]=f[77]; t[78]=f[78]; t[79]=f[79]; + t[80]=f[80]; t[81]=f[81]; t[82]=f[82]; t[83]=f[83]; + t[84]=f[84]; t[85]=f[85]; t[86]=f[86]; t[87]=f[87]; + t[88]=f[88]; t[89]=f[89]; t[90]=f[90]; t[91]=f[91]; + t[92]=f[92]; t[93]=f[93]; t[94]=f[94]; t[95]=f[95]; + t[96]=f[96]; t[97]=f[97]; t[98]=f[98]; t[99]=f[99]; + t[100]=f[100]; t[101]=f[101]; t[102]=f[102]; t[103]=f[103]; + t[104]=f[104]; t[105]=f[105]; t[106]=f[106]; t[107]=f[107]; + t[108]=f[108]; t[109]=f[109]; t[110]=f[110]; t[111]=f[111]; + t[112]=f[112]; t[113]=f[113]; t[114]=f[114]; t[115]=f[115]; + t[116]=f[116]; t[117]=f[117]; t[118]=f[118]; t[119]=f[119]; + t[120]=f[120]; t[121]=f[121]; t[122]=f[122]; t[123]=f[123]; + t[124]=f[124]; t[125]=f[125]; t[126]=f[126]; t[127]=f[127]; + t+=128; f+=128; +#endif + } while (f < end); +#else + do { + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + *t++ = *f++; *t++ = *f++; *t++ = *f++; *t++ = *f++; + } while (f < end); +#endif + return; +} /* bmove512 */ + +#endif /* bmove512 */ diff --git a/externals/mysql/strings/bmove_upp.c b/externals/mysql/strings/bmove_upp.c new file mode 100644 index 0000000..fb47bda --- /dev/null +++ b/externals/mysql/strings/bmove_upp.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : bmove.c + Author : Michael widenius + Updated: 1987-03-20 + Defines: bmove_upp() + + bmove_upp(dst, src, len) moves exactly "len" bytes from the source + "src-len" to the destination "dst-len" counting downwards. +*/ + +#include +#include "m_string.h" + +#if defined(MC68000) && defined(DS90) + +/* 0 <= len <= 65535 */ +void bmove_upp(byte *dst, const byte *src,uint len) +{ +asm(" movl 12(a7),d0 "); +asm(" subql #1,d0 "); +asm(" blt .L5 "); +asm(" movl 4(a7),a1 "); +asm(" movl 8(a7),a0 "); +asm(".L4: movb -(a0),-(a1) "); +asm(" dbf d0,.L4 "); +asm(".L5: "); +} +#else + +void bmove_upp(register uchar *dst, register const uchar *src, + register size_t len) +{ + while (len-- != 0) *--dst = *--src; +} + +#endif diff --git a/externals/mysql/strings/conf_to_src.c b/externals/mysql/strings/conf_to_src.c new file mode 100644 index 0000000..fd5d3f4 --- /dev/null +++ b/externals/mysql/strings/conf_to_src.c @@ -0,0 +1,358 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include +#include + +#define ROW_LEN 16 +#define ROW16_LEN 8 +#define MAX_BUF 64*1024 + +static CHARSET_INFO all_charsets[512]; + + +void +print_array(FILE *f, const char *set, const char *name, uchar *a, int n) +{ + int i; + + fprintf(f,"uchar %s_%s[] = {\n", name, set); + + for (i=0 ;iname && !strcmp(cs->name, charset_name)) + return cs->number; + } + return 0; +} + +char *mdup(const char *src, uint len) +{ + char *dst=(char*)malloc(len); + if (!dst) + exit(1); + memcpy(dst,src,len); + return dst; +} + +static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) +{ + to->number= from->number ? from->number : to->number; + to->state|= from->state; + + if (from->csname) + to->csname= strdup(from->csname); + + if (from->name) + to->name= strdup(from->name); + + if (from->ctype) + to->ctype= (uchar*) mdup((char*) from->ctype, MY_CS_CTYPE_TABLE_SIZE); + if (from->to_lower) + to->to_lower= (uchar*) mdup((char*) from->to_lower, MY_CS_TO_LOWER_TABLE_SIZE); + if (from->to_upper) + to->to_upper= (uchar*) mdup((char*) from->to_upper, MY_CS_TO_UPPER_TABLE_SIZE); + if (from->sort_order) + { + to->sort_order= (uchar*) mdup((char*) from->sort_order, MY_CS_SORT_ORDER_TABLE_SIZE); + /* + set_max_sort_char(to); + */ + } + if (from->tab_to_uni) + { + uint sz= MY_CS_TO_UNI_TABLE_SIZE*sizeof(uint16); + to->tab_to_uni= (uint16*) mdup((char*)from->tab_to_uni, sz); + /* + create_fromuni(to); + */ + } +} + +static my_bool simple_cs_is_full(CHARSET_INFO *cs) +{ + return ((cs->csname && cs->tab_to_uni && cs->ctype && cs->to_upper && + cs->to_lower) && + (cs->number && cs->name && + (cs->sort_order || (cs->state & MY_CS_BINSORT)))); +} + +static int add_collation(CHARSET_INFO *cs) +{ + if (cs->name && (cs->number || (cs->number=get_charset_number(cs->name)))) + { + if (!(all_charsets[cs->number].state & MY_CS_COMPILED)) + { + simple_cs_copy_data(&all_charsets[cs->number],cs); + + } + + cs->number= 0; + cs->name= NULL; + cs->state= 0; + cs->sort_order= NULL; + cs->state= 0; + } + return MY_XML_OK; +} + + +static int my_read_charset_file(const char *filename) +{ + char buf[MAX_BUF]; + int fd; + uint len; + + if ((fd=open(filename,O_RDONLY)) < 0) + { + fprintf(stderr,"Can't open '%s'\n",filename); + return 1; + } + + len=read(fd,buf,MAX_BUF); + DBUG_ASSERT(len < MAX_BUF); + close(fd); + + if (my_parse_charset_xml(buf,len,add_collation)) + { +#if 0 + printf("ERROR at line %d pos %d '%s'\n", + my_xml_error_lineno(&p)+1, + my_xml_error_pos(&p), + my_xml_error_string(&p)); +#endif + } + + return FALSE; +} + +static int +is_case_sensitive(CHARSET_INFO *cs) +{ + return (cs->sort_order && + cs->sort_order['A'] < cs->sort_order['a'] && + cs->sort_order['a'] < cs->sort_order['B']) ? 1 : 0; +} + + +void dispcset(FILE *f,CHARSET_INFO *cs) +{ + fprintf(f,"{\n"); + fprintf(f," %d,%d,%d,\n",cs->number,0,0); + fprintf(f," MY_CS_COMPILED%s%s%s%s%s,\n", + cs->state & MY_CS_BINSORT ? "|MY_CS_BINSORT" : "", + cs->state & MY_CS_PRIMARY ? "|MY_CS_PRIMARY" : "", + is_case_sensitive(cs) ? "|MY_CS_CSSORT" : "", + my_charset_is_8bit_pure_ascii(cs) ? "|MY_CS_PUREASCII" : "", + !my_charset_is_ascii_compatible(cs) ? "|MY_CS_NONASCII": ""); + + if (cs->name) + { + fprintf(f," \"%s\", /* cset name */\n",cs->csname); + fprintf(f," \"%s\", /* coll name */\n",cs->name); + fprintf(f," \"\", /* comment */\n"); + fprintf(f," NULL, /* tailoring */\n"); + fprintf(f," ctype_%s, /* ctype */\n",cs->name); + fprintf(f," to_lower_%s, /* lower */\n",cs->name); + fprintf(f," to_upper_%s, /* upper */\n",cs->name); + if (cs->sort_order) + fprintf(f," sort_order_%s, /* sort_order */\n",cs->name); + else + fprintf(f," NULL, /* sort_order */\n"); + fprintf(f," NULL, /* contractions */\n"); + fprintf(f," NULL, /* sort_order_big*/\n"); + fprintf(f," to_uni_%s, /* to_uni */\n",cs->name); + } + else + { + fprintf(f," NULL, /* cset name */\n"); + fprintf(f," NULL, /* coll name */\n"); + fprintf(f," NULL, /* comment */\n"); + fprintf(f," NULL, /* tailoging */\n"); + fprintf(f," NULL, /* ctype */\n"); + fprintf(f," NULL, /* lower */\n"); + fprintf(f," NULL, /* upper */\n"); + fprintf(f," NULL, /* sort order */\n"); + fprintf(f," NULL, /* contractions */\n"); + fprintf(f," NULL, /* sort_order_big*/\n"); + fprintf(f," NULL, /* to_uni */\n"); + } + + fprintf(f," NULL, /* from_uni */\n"); + fprintf(f," my_unicase_default, /* caseinfo */\n"); + fprintf(f," NULL, /* state map */\n"); + fprintf(f," NULL, /* ident map */\n"); + fprintf(f," 1, /* strxfrm_multiply*/\n"); + fprintf(f," 1, /* caseup_multiply*/\n"); + fprintf(f," 1, /* casedn_multiply*/\n"); + fprintf(f," 1, /* mbminlen */\n"); + fprintf(f," 1, /* mbmaxlen */\n"); + fprintf(f," 0, /* min_sort_char */\n"); + fprintf(f," 255, /* max_sort_char */\n"); + fprintf(f," ' ', /* pad_char */\n"); + fprintf(f," 0, /* escape_with_backslash_is_dangerous */\n"); + fprintf(f," 1, /* levels_for_compare */\n"); + fprintf(f," 1, /* levels_for_order */\n"); + + fprintf(f," &my_charset_8bit_handler,\n"); + if (cs->state & MY_CS_BINSORT) + fprintf(f," &my_collation_8bit_bin_handler,\n"); + else + fprintf(f," &my_collation_8bit_simple_ci_handler,\n"); + fprintf(f,"}\n"); +} + + +static void +fprint_copyright(FILE *file) +{ + fprintf(file, +"/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n" +"\n" +" This program is free software; you can redistribute it and/or modify\n" +" it under the terms of the GNU General Public License as published by\n" +" the Free Software Foundation; version 2 of the License.\n" +"\n" +" This program is distributed in the hope that it will be useful,\n" +" but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +" GNU General Public License for more details.\n" +"\n" +" You should have received a copy of the GNU General Public License\n" +" along with this program; if not, write to the Free Software\n" +" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */\n" +"\n"); +} + + +int +main(int argc, char **argv __attribute__((unused))) +{ + CHARSET_INFO ncs; + CHARSET_INFO *cs; + char filename[256]; + FILE *f= stdout; + + if (argc < 2) + { + fprintf(stderr, "usage: %s source-dir\n", argv[0]); + exit(EXIT_FAILURE); + } + + bzero((void*)&ncs,sizeof(ncs)); + bzero((void*)&all_charsets,sizeof(all_charsets)); + + sprintf(filename,"%s/%s",argv[1],"Index.xml"); + my_read_charset_file(filename); + + for (cs= all_charsets; + cs < all_charsets + array_elements(all_charsets); + cs++) + { + if (cs->number && !(cs->state & MY_CS_COMPILED)) + { + if ( (!simple_cs_is_full(cs)) && (cs->csname)) + { + sprintf(filename,"%s/%s.xml",argv[1],cs->csname); + my_read_charset_file(filename); + } + } + } + + fprintf(f, "/*\n"); + fprintf(f, " This file was generated by the conf_to_src utility. " + "Do not edit it directly,\n"); + fprintf(f, " edit the XML definitions in sql/share/charsets/ instead.\n\n"); + fprintf(f, " To re-generate, run the following in the strings/ " + "directory:\n"); + fprintf(f, " ./conf_to_src ../sql/share/charsets/ > FILE\n"); + fprintf(f, "*/\n\n"); + fprint_copyright(f); + fprintf(f,"#include \n"); + fprintf(f,"#include \n\n"); + + + for (cs= all_charsets; + cs < all_charsets + array_elements(all_charsets); + cs++) + { + if (simple_cs_is_full(cs)) + { + fprintf(f,"#ifdef HAVE_CHARSET_%s\n",cs->csname); + print_array(f, cs->name, "ctype", cs->ctype, MY_CS_CTYPE_TABLE_SIZE); + print_array(f, cs->name, "to_lower", cs->to_lower, MY_CS_TO_LOWER_TABLE_SIZE); + print_array(f, cs->name, "to_upper", cs->to_upper, MY_CS_TO_UPPER_TABLE_SIZE); + if (cs->sort_order) + print_array(f, cs->name, "sort_order", cs->sort_order, MY_CS_SORT_ORDER_TABLE_SIZE); + print_array16(f, cs->name, "to_uni", cs->tab_to_uni, MY_CS_TO_UNI_TABLE_SIZE); + fprintf(f,"#endif\n"); + fprintf(f,"\n"); + } + } + + fprintf(f,"CHARSET_INFO compiled_charsets[] = {\n"); + for (cs= all_charsets; + cs < all_charsets + array_elements(all_charsets); + cs++) + { + if (simple_cs_is_full(cs)) + { + fprintf(f,"#ifdef HAVE_CHARSET_%s\n",cs->csname); + dispcset(f,cs); + fprintf(f,",\n"); + fprintf(f,"#endif\n"); + } + } + + dispcset(f,&ncs); + fprintf(f,"};\n"); + + return 0; +} diff --git a/externals/mysql/strings/ctype-big5.c b/externals/mysql/strings/ctype-big5.c new file mode 100644 index 0000000..caf4af5 --- /dev/null +++ b/externals/mysql/strings/ctype-big5.c @@ -0,0 +1,6407 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * This file is basicly usa7 character sets with some extra functions + * for big5 handling +*/ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. strxfrm_multiply_big5=1 + * .configure. mbmaxlen_big5=2 + */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_big5 + +/* + Support for Chinese(BIG5) characters, by jou@nematic.ieo.nctu.edu.tw + modified by Wei He (hewei@mail.ied.ac.cn) + modified by Alex Barkov +*/ + +#define isbig5head(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xf9) +#define isbig5tail(c) ((0x40<=(uchar)(c) && (uchar)(c)<=0x7e) || \ + (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)) + +#define isbig5code(c,d) (isbig5head(c) && isbig5tail(d)) +#define big5code(c,d) (((uchar)(c) <<8) | (uchar)(d)) +#define big5head(e) ((uchar)(e>>8)) +#define big5tail(e) ((uchar)(e&0xff)) + +static uchar NEAR ctype_big5[257] = +{ + 0, /* For standard library */ + 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 72,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 132,132,132,132,132,132,132,132,132,132,16,16,16,16,16,16, + 16,129,129,129,129,129,129,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,16,16,16,16,16, + 16,130,130,130,130,130,130,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,32, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0, +}; + +static uchar NEAR to_lower_big5[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR to_upper_big5[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR sort_order_big5[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '\\', ']', '[', '^', '_', + 0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', 0x7E, '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uint16 big5strokexfrm(uint16 i) +{ + if ((i == 0xA440) || (i == 0xA441)) return 0xA440; + else if (((i >= 0xA442) && (i <= 0xA453)) || ((i >= 0xC940) && (i <= 0xC944))) return 0xA442; + else if (((i >= 0xA454) && (i <= 0xA47E)) || ((i >= 0xC945) && (i <= 0xC94C))) return 0xA454; + else if (((i >= 0xA4A1) && (i <= 0xA4FD)) || ((i >= 0xC94D) && (i <= 0xC962))) return 0xA4A1; + else if (((i >= 0xA4FE) && (i <= 0xA5DF)) || ((i >= 0xC963) && (i <= 0xC9AA))) return 0xA4FE; + else if (((i >= 0xA5E0) && (i <= 0xA6E9)) || ((i >= 0xC9AB) && (i <= 0xCA59))) return 0xA5E0; + else if (((i >= 0xA6EA) && (i <= 0xA8C2)) || ((i >= 0xCA5A) && (i <= 0xCBB0))) return 0xA6EA; + else if ((i == 0xA260) || ((i >= 0xA8C3) && (i <= 0xAB44)) || ((i >= 0xCBB1) && (i <= 0xCDDC))) return 0xA8C3; + else if ((i == 0xA259) || (i == 0xF9DA) || ((i >= 0xAB45) && (i <= 0xADBB)) || ((i >= 0xCDDD) && (i <= 0xD0C7))) return 0xAB45; + else if ((i == 0xA25A) || ((i >= 0xADBC) && (i <= 0xB0AD)) || ((i >= 0xD0C8) && (i <= 0xD44A))) return 0xADBC; + else if ((i == 0xA25B) || (i == 0xA25C) || ((i >= 0xB0AE) && (i <= 0xB3C2)) || ((i >= 0xD44B) && (i <= 0xD850))) return 0xB0AE; + else if ((i == 0xF9DB) || ((i >= 0xB3C3) && (i <= 0xB6C2)) || ((i >= 0xD851) && (i <= 0xDCB0))) return 0xB3C3; + else if ((i == 0xA25D) || (i == 0xA25F) || (i == 0xC6A1) || (i == 0xF9D6) || (i == 0xF9D8) || ((i >= 0xB6C3) && (i <= 0xB9AB)) || ((i >= 0xDCB1) && (i <= 0xE0EF))) return 0xB6C3; + else if ((i == 0xF9DC) || ((i >= 0xB9AC) && (i <= 0xBBF4)) || ((i >= 0xE0F0) && (i <= 0xE4E5))) return 0xB9AC; + else if ((i == 0xA261) || ((i >= 0xBBF5) && (i <= 0xBEA6)) || ((i >= 0xE4E6) && (i <= 0xE8F3))) return 0xBBF5; + else if ((i == 0xA25E) || (i == 0xF9D7) || (i == 0xF9D9) || ((i >= 0xBEA7) && (i <= 0xC074)) || ((i >= 0xE8F4) && (i <= 0xECB8))) return 0xBEA7; + else if (((i >= 0xC075) && (i <= 0xC24E)) || ((i >= 0xECB9) && (i <= 0xEFB6))) return 0xC075; + else if (((i >= 0xC24F) && (i <= 0xC35E)) || ((i >= 0xEFB7) && (i <= 0xF1EA))) return 0xC24F; + else if (((i >= 0xC35F) && (i <= 0xC454)) || ((i >= 0xF1EB) && (i <= 0xF3FC))) return 0xC35F; + else if (((i >= 0xC455) && (i <= 0xC4D6)) || ((i >= 0xF3FD) && (i <= 0xF5BF))) return 0xC455; + else if (((i >= 0xC4D7) && (i <= 0xC56A)) || ((i >= 0xF5C0) && (i <= 0xF6D5))) return 0xC4D7; + else if (((i >= 0xC56B) && (i <= 0xC5C7)) || ((i >= 0xF6D6) && (i <= 0xF7CF))) return 0xC56B; + else if (((i >= 0xC5C8) && (i <= 0xC5F0)) || ((i >= 0xF7D0) && (i <= 0xF8A4))) return 0xC5C8; + else if (((i >= 0xC5F1) && (i <= 0xC654)) || ((i >= 0xF8A5) && (i <= 0xF8ED))) return 0xC5F1; + else if (((i >= 0xC655) && (i <= 0xC664)) || ((i >= 0xF8EE) && (i <= 0xF96A))) return 0xC655; + else if (((i >= 0xC665) && (i <= 0xC66B)) || ((i >= 0xF96B) && (i <= 0xF9A1))) return 0xC665; + else if (((i >= 0xC66C) && (i <= 0xC675)) || ((i >= 0xF9A2) && (i <= 0xF9B9))) return 0xC66C; + else if (((i >= 0xC676) && (i <= 0xC678)) || ((i >= 0xF9BA) && (i <= 0xF9C5))) return 0xC676; + else if (((i >= 0xC679) && (i <= 0xC67C)) || ((i >= 0xF9C7) && (i <= 0xF9CB))) return 0xC679; + else if ((i == 0xC67D) || ((i >= 0xF9CC) && (i <= 0xF9CF))) return 0xC67D; + else if (i == 0xF9D0) return 0xF9D0; + else if ((i == 0xC67E) || (i == 0xF9D1)) return 0xC67E; + else if ((i == 0xF9C6) || (i == 0xF9D2)) return 0xF9C6; + else if (i == 0xF9D3) return 0xF9D3; + else if (i == 0xF9D4) return 0xF9D4; + else if (i == 0xF9D5) return 0xF9D5; + return 0xA140; +} + + + +static int my_strnncoll_big5_internal(const uchar **a_res, + const uchar **b_res, size_t length) +{ + const uchar *a= *a_res, *b= *b_res; + + while (length--) + { + if ((length > 0) && isbig5code(*a,*(a+1)) && isbig5code(*b, *(b+1))) + { + if (*a != *b || *(a+1) != *(b+1)) + return ((int) big5code(*a,*(a+1)) - + (int) big5code(*b,*(b+1))); + a+= 2; + b+= 2; + length--; + } + else if (sort_order_big5[*a++] != + sort_order_big5[*b++]) + return ((int) sort_order_big5[a[-1]] - + (int) sort_order_big5[b[-1]]); + } + *a_res= a; + *b_res= b; + return 0; +} + + +/* Compare strings */ + +static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool b_is_prefix) +{ + size_t length= min(a_length, b_length); + int res= my_strnncoll_big5_internal(&a, &b, length); + return res ? res : (int)((b_is_prefix ? length : a_length) - b_length); +} + + +/* compare strings, ignore end space */ + +static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + size_t length= min(a_length, b_length); + int res= my_strnncoll_big5_internal(&a, &b, length); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + if (!res && a_length != b_length) + { + const uchar *end; + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a_length < b_length) + { + /* put longer key in a */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (end= a + a_length-length; a < end ; a++) + { + if (*a != ' ') + return (*a < ' ') ? -swap : swap; + } + } + return res; +} + + +static size_t +my_strnxfrm_big5(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *d0= dst; + uchar *de= dst + dstlen; + const uchar *se= src + srclen; + const uchar *sort_order= cs->sort_order; + + for (; dst < de && src < se && nweights; nweights--) + { + if (cs->cset->ismbchar(cs, (const char*) src, (const char*) se)) + { + /* + Note, it is safe not to check (src < se) + in the code below, because ismbchar() would + not return TRUE if src was too short + */ + uint16 e= big5strokexfrm((uint16) big5code(*src, *(src + 1))); + *dst++= big5head(e); + if (dst < de) + *dst++= big5tail(e); + src+= 2; + } + else + *dst++= sort_order ? sort_order[*src++] : *src++; + } + return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0); +} + + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +#define max_sort_char ((char) 255) + +static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr,size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length) +{ + const char *end= ptr + ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + size_t charlen= res_length / cs->mbmaxlen; + + for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) + { + if (ptr+1 != end && isbig5code(ptr[0],ptr[1])) + { + *min_str++= *max_str++ = *ptr++; + *min_str++= *max_str++ = *ptr; + continue; + } + if (*ptr == escape && ptr+1 != end) + { + ptr++; /* Skip escape */ + if (isbig5code(ptr[0], ptr[1])) + *min_str++= *max_str++ = *ptr++; + if (min_str < min_end) + *min_str++= *max_str++= *ptr; + continue; + } + if (*ptr == w_one) /* '_' in SQL */ + { + *min_str++='\0'; /* This should be min char */ + *max_str++=max_sort_char; + continue; + } + if (*ptr == w_many) /* '%' in SQL */ + { + /* + Calculate length of keys: + 'a\0\0... is the smallest possible string when we have space expand + a\ff\ff... is the biggest possible string + */ + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + do { + *min_str++ = 0; + *max_str++ = max_sort_char; + } while (min_str != min_end); + return 0; + } + *min_str++= *max_str++ = *ptr; + } + + *min_length= *max_length= (size_t) (min_str-min_org); + while (min_str != min_end) + *min_str++= *max_str++= ' '; + return 0; +} + + +static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0); +} + + +static uint mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c) +{ + return (isbig5head(c)? 2 : 1); +} + + +/* page 0 0xA140-0xC7FC */ +static uint16 tab_big5_uni0[]={ +0x3000,0xFF0C,0x3001,0x3002,0xFF0E,0x2022,0xFF1B,0xFF1A, +0xFF1F,0xFF01,0xFE30,0x2026,0x2025,0xFE50,0xFF64,0xFE52, +0x00B7,0xFE54,0xFE55,0xFE56,0xFE57,0xFF5C,0x2013,0xFE31, +0x2014,0xFE33,0xFFFD,0xFE34,0xFE4F,0xFF08,0xFF09,0xFE35, +0xFE36,0xFF5B,0xFF5D,0xFE37,0xFE38,0x3014,0x3015,0xFE39, +0xFE3A,0x3010,0x3011,0xFE3B,0xFE3C,0x300A,0x300B,0xFE3D, +0xFE3E,0x3008,0x3009,0xFE3F,0xFE40,0x300C,0x300D,0xFE41, +0xFE42,0x300E,0x300F,0xFE43,0xFE44,0xFE59,0xFE5A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFE5B,0xFE5C,0xFE5D,0xFE5E,0x2018,0x2019,0x201C, +0x201D,0x301D,0x301E,0x2035,0x2032,0xFF03,0xFF06,0xFF0A, +0x203B,0x00A7,0x3003,0x25CB,0x25CF,0x25B3,0x25B2,0x25CE, +0x2606,0x2605,0x25C7,0x25C6,0x25A1,0x25A0,0x25BD,0x25BC, +0x32A3,0x2105,0x203E,0xFFFD,0xFF3F,0xFFFD,0xFE49,0xFE4A, +0xFE4D,0xFE4E,0xFE4B,0xFE4C,0xFE5F,0xFE60,0xFE61,0xFF0B, +0xFF0D,0x00D7,0x00F7,0x00B1,0x221A,0xFF1C,0xFF1E,0xFF1D, +0x2266,0x2267,0x2260,0x221E,0x2252,0x2261,0xFE62,0xFE63, +0xFE64,0xFE65,0xFE66,0x223C,0x2229,0x222A,0x22A5,0x2220, +0x221F,0x22BF,0x33D2,0x33D1,0x222B,0x222E,0x2235,0x2234, +0x2640,0x2642,0x2641,0x2609,0x2191,0x2193,0x2190,0x2192, +0x2196,0x2197,0x2199,0x2198,0x2225,0x2223,0xFFFD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFFFD,0xFF0F,0xFF3C,0xFF04,0x00A5,0x3012,0x00A2,0x00A3, +0xFF05,0xFF20,0x2103,0x2109,0xFE69,0xFE6A,0xFE6B,0x33D5, +0x339C,0x339D,0x339E,0x33CE,0x33A1,0x338E,0x338F,0x33C4, +0x00B0,0x5159,0x515B,0x515E,0x515D,0x5161,0x5163,0x55E7, +0x74E9,0x7CCE,0x2581,0x2582,0x2583,0x2584,0x2585,0x2586, +0x2587,0x2588,0x258F,0x258E,0x258D,0x258C,0x258B,0x258A, +0x2589,0x253C,0x2534,0x252C,0x2524,0x251C,0x2594,0x2500, +0x2502,0x2595,0x250C,0x2510,0x2514,0x2518,0x256D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x256E,0x2570,0x256F,0x2550,0x255E,0x256A,0x2561, +0x25E2,0x25E3,0x25E5,0x25E4,0x2571,0x2572,0x2573,0xFF10, +0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17,0xFF18, +0xFF19,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166, +0x2167,0x2168,0x2169,0x3021,0x3022,0x3023,0x3024,0x3025, +0x3026,0x3027,0x3028,0x3029,0xFFFD,0x5344,0xFFFD,0xFF21, +0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28,0xFF29, +0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,0xFF30,0xFF31, +0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38,0xFF39, +0xFF3A,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47, +0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F, +0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFF57,0xFF58,0xFF59,0xFF5A,0x0391,0x0392,0x0393,0x0394, +0x0395,0x0396,0x0397,0x0398,0x0399,0x039A,0x039B,0x039C, +0x039D,0x039E,0x039F,0x03A0,0x03A1,0x03A3,0x03A4,0x03A5, +0x03A6,0x03A7,0x03A8,0x03A9,0x03B1,0x03B2,0x03B3,0x03B4, +0x03B5,0x03B6,0x03B7,0x03B8,0x03B9,0x03BA,0x03BB,0x03BC, +0x03BD,0x03BE,0x03BF,0x03C0,0x03C1,0x03C3,0x03C4,0x03C5, +0x03C6,0x03C7,0x03C8,0x03C9,0x3105,0x3106,0x3107,0x3108, +0x3109,0x310A,0x310B,0x310C,0x310D,0x310E,0x310F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3110,0x3111,0x3112,0x3113,0x3114,0x3115,0x3116, +0x3117,0x3118,0x3119,0x311A,0x311B,0x311C,0x311D,0x311E, +0x311F,0x3120,0x3121,0x3122,0x3123,0x3124,0x3125,0x3126, +0x3127,0x3128,0x3129,0x02D9,0x02C9,0x02CA,0x02C7,0x02CB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4E00,0x4E59,0x4E01,0x4E03,0x4E43,0x4E5D,0x4E86,0x4E8C, +0x4EBA,0x513F,0x5165,0x516B,0x51E0,0x5200,0x5201,0x529B, +0x5315,0x5341,0x535C,0x53C8,0x4E09,0x4E0B,0x4E08,0x4E0A, +0x4E2B,0x4E38,0x51E1,0x4E45,0x4E48,0x4E5F,0x4E5E,0x4E8E, +0x4EA1,0x5140,0x5203,0x52FA,0x5343,0x53C9,0x53E3,0x571F, +0x58EB,0x5915,0x5927,0x5973,0x5B50,0x5B51,0x5B53,0x5BF8, +0x5C0F,0x5C22,0x5C38,0x5C71,0x5DDD,0x5DE5,0x5DF1,0x5DF2, +0x5DF3,0x5DFE,0x5E72,0x5EFE,0x5F0B,0x5F13,0x624D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4E11,0x4E10,0x4E0D,0x4E2D,0x4E30,0x4E39,0x4E4B, +0x5C39,0x4E88,0x4E91,0x4E95,0x4E92,0x4E94,0x4EA2,0x4EC1, +0x4EC0,0x4EC3,0x4EC6,0x4EC7,0x4ECD,0x4ECA,0x4ECB,0x4EC4, +0x5143,0x5141,0x5167,0x516D,0x516E,0x516C,0x5197,0x51F6, +0x5206,0x5207,0x5208,0x52FB,0x52FE,0x52FF,0x5316,0x5339, +0x5348,0x5347,0x5345,0x535E,0x5384,0x53CB,0x53CA,0x53CD, +0x58EC,0x5929,0x592B,0x592A,0x592D,0x5B54,0x5C11,0x5C24, +0x5C3A,0x5C6F,0x5DF4,0x5E7B,0x5EFF,0x5F14,0x5F15,0x5FC3, +0x6208,0x6236,0x624B,0x624E,0x652F,0x6587,0x6597,0x65A4, +0x65B9,0x65E5,0x66F0,0x6708,0x6728,0x6B20,0x6B62,0x6B79, +0x6BCB,0x6BD4,0x6BDB,0x6C0F,0x6C34,0x706B,0x722A,0x7236, +0x723B,0x7247,0x7259,0x725B,0x72AC,0x738B,0x4E19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4E16,0x4E15,0x4E14,0x4E18,0x4E3B,0x4E4D,0x4E4F,0x4E4E, +0x4EE5,0x4ED8,0x4ED4,0x4ED5,0x4ED6,0x4ED7,0x4EE3,0x4EE4, +0x4ED9,0x4EDE,0x5145,0x5144,0x5189,0x518A,0x51AC,0x51F9, +0x51FA,0x51F8,0x520A,0x52A0,0x529F,0x5305,0x5306,0x5317, +0x531D,0x4EDF,0x534A,0x5349,0x5361,0x5360,0x536F,0x536E, +0x53BB,0x53EF,0x53E4,0x53F3,0x53EC,0x53EE,0x53E9,0x53E8, +0x53FC,0x53F8,0x53F5,0x53EB,0x53E6,0x53EA,0x53F2,0x53F1, +0x53F0,0x53E5,0x53ED,0x53FB,0x56DB,0x56DA,0x5916, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x592E,0x5931,0x5974,0x5976,0x5B55,0x5B83,0x5C3C, +0x5DE8,0x5DE7,0x5DE6,0x5E02,0x5E03,0x5E73,0x5E7C,0x5F01, +0x5F18,0x5F17,0x5FC5,0x620A,0x6253,0x6254,0x6252,0x6251, +0x65A5,0x65E6,0x672E,0x672C,0x672A,0x672B,0x672D,0x6B63, +0x6BCD,0x6C11,0x6C10,0x6C38,0x6C41,0x6C40,0x6C3E,0x72AF, +0x7384,0x7389,0x74DC,0x74E6,0x7518,0x751F,0x7528,0x7529, +0x7530,0x7531,0x7532,0x7533,0x758B,0x767D,0x76AE,0x76BF, +0x76EE,0x77DB,0x77E2,0x77F3,0x793A,0x79BE,0x7A74,0x7ACB, +0x4E1E,0x4E1F,0x4E52,0x4E53,0x4E69,0x4E99,0x4EA4,0x4EA6, +0x4EA5,0x4EFF,0x4F09,0x4F19,0x4F0A,0x4F15,0x4F0D,0x4F10, +0x4F11,0x4F0F,0x4EF2,0x4EF6,0x4EFB,0x4EF0,0x4EF3,0x4EFD, +0x4F01,0x4F0B,0x5149,0x5147,0x5146,0x5148,0x5168, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5171,0x518D,0x51B0,0x5217,0x5211,0x5212,0x520E,0x5216, +0x52A3,0x5308,0x5321,0x5320,0x5370,0x5371,0x5409,0x540F, +0x540C,0x540A,0x5410,0x5401,0x540B,0x5404,0x5411,0x540D, +0x5408,0x5403,0x540E,0x5406,0x5412,0x56E0,0x56DE,0x56DD, +0x5733,0x5730,0x5728,0x572D,0x572C,0x572F,0x5729,0x5919, +0x591A,0x5937,0x5938,0x5984,0x5978,0x5983,0x597D,0x5979, +0x5982,0x5981,0x5B57,0x5B58,0x5B87,0x5B88,0x5B85,0x5B89, +0x5BFA,0x5C16,0x5C79,0x5DDE,0x5E06,0x5E76,0x5E74, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F0F,0x5F1B,0x5FD9,0x5FD6,0x620E,0x620C,0x620D, +0x6210,0x6263,0x625B,0x6258,0x6536,0x65E9,0x65E8,0x65EC, +0x65ED,0x66F2,0x66F3,0x6709,0x673D,0x6734,0x6731,0x6735, +0x6B21,0x6B64,0x6B7B,0x6C16,0x6C5D,0x6C57,0x6C59,0x6C5F, +0x6C60,0x6C50,0x6C55,0x6C61,0x6C5B,0x6C4D,0x6C4E,0x7070, +0x725F,0x725D,0x767E,0x7AF9,0x7C73,0x7CF8,0x7F36,0x7F8A, +0x7FBD,0x8001,0x8003,0x800C,0x8012,0x8033,0x807F,0x8089, +0x808B,0x808C,0x81E3,0x81EA,0x81F3,0x81FC,0x820C,0x821B, +0x821F,0x826E,0x8272,0x827E,0x866B,0x8840,0x884C,0x8863, +0x897F,0x9621,0x4E32,0x4EA8,0x4F4D,0x4F4F,0x4F47,0x4F57, +0x4F5E,0x4F34,0x4F5B,0x4F55,0x4F30,0x4F50,0x4F51,0x4F3D, +0x4F3A,0x4F38,0x4F43,0x4F54,0x4F3C,0x4F46,0x4F63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4F5C,0x4F60,0x4F2F,0x4F4E,0x4F36,0x4F59,0x4F5D,0x4F48, +0x4F5A,0x514C,0x514B,0x514D,0x5175,0x51B6,0x51B7,0x5225, +0x5224,0x5229,0x522A,0x5228,0x52AB,0x52A9,0x52AA,0x52AC, +0x5323,0x5373,0x5375,0x541D,0x542D,0x541E,0x543E,0x5426, +0x544E,0x5427,0x5446,0x5443,0x5433,0x5448,0x5442,0x541B, +0x5429,0x544A,0x5439,0x543B,0x5438,0x542E,0x5435,0x5436, +0x5420,0x543C,0x5440,0x5431,0x542B,0x541F,0x542C,0x56EA, +0x56F0,0x56E4,0x56EB,0x574A,0x5751,0x5740,0x574D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5747,0x574E,0x573E,0x5750,0x574F,0x573B,0x58EF, +0x593E,0x599D,0x5992,0x59A8,0x599E,0x59A3,0x5999,0x5996, +0x598D,0x59A4,0x5993,0x598A,0x59A5,0x5B5D,0x5B5C,0x5B5A, +0x5B5B,0x5B8C,0x5B8B,0x5B8F,0x5C2C,0x5C40,0x5C41,0x5C3F, +0x5C3E,0x5C90,0x5C91,0x5C94,0x5C8C,0x5DEB,0x5E0C,0x5E8F, +0x5E87,0x5E8A,0x5EF7,0x5F04,0x5F1F,0x5F64,0x5F62,0x5F77, +0x5F79,0x5FD8,0x5FCC,0x5FD7,0x5FCD,0x5FF1,0x5FEB,0x5FF8, +0x5FEA,0x6212,0x6211,0x6284,0x6297,0x6296,0x6280,0x6276, +0x6289,0x626D,0x628A,0x627C,0x627E,0x6279,0x6273,0x6292, +0x626F,0x6298,0x626E,0x6295,0x6293,0x6291,0x6286,0x6539, +0x653B,0x6538,0x65F1,0x66F4,0x675F,0x674E,0x674F,0x6750, +0x6751,0x675C,0x6756,0x675E,0x6749,0x6746,0x6760, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6753,0x6757,0x6B65,0x6BCF,0x6C42,0x6C5E,0x6C99,0x6C81, +0x6C88,0x6C89,0x6C85,0x6C9B,0x6C6A,0x6C7A,0x6C90,0x6C70, +0x6C8C,0x6C68,0x6C96,0x6C92,0x6C7D,0x6C83,0x6C72,0x6C7E, +0x6C74,0x6C86,0x6C76,0x6C8D,0x6C94,0x6C98,0x6C82,0x7076, +0x707C,0x707D,0x7078,0x7262,0x7261,0x7260,0x72C4,0x72C2, +0x7396,0x752C,0x752B,0x7537,0x7538,0x7682,0x76EF,0x77E3, +0x79C1,0x79C0,0x79BF,0x7A76,0x7CFB,0x7F55,0x8096,0x8093, +0x809D,0x8098,0x809B,0x809A,0x80B2,0x826F,0x8292, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x828B,0x828D,0x898B,0x89D2,0x8A00,0x8C37,0x8C46, +0x8C55,0x8C9D,0x8D64,0x8D70,0x8DB3,0x8EAB,0x8ECA,0x8F9B, +0x8FB0,0x8FC2,0x8FC6,0x8FC5,0x8FC4,0x5DE1,0x9091,0x90A2, +0x90AA,0x90A6,0x90A3,0x9149,0x91C6,0x91CC,0x9632,0x962E, +0x9631,0x962A,0x962C,0x4E26,0x4E56,0x4E73,0x4E8B,0x4E9B, +0x4E9E,0x4EAB,0x4EAC,0x4F6F,0x4F9D,0x4F8D,0x4F73,0x4F7F, +0x4F6C,0x4F9B,0x4F8B,0x4F86,0x4F83,0x4F70,0x4F75,0x4F88, +0x4F69,0x4F7B,0x4F96,0x4F7E,0x4F8F,0x4F91,0x4F7A,0x5154, +0x5152,0x5155,0x5169,0x5177,0x5176,0x5178,0x51BD,0x51FD, +0x523B,0x5238,0x5237,0x523A,0x5230,0x522E,0x5236,0x5241, +0x52BE,0x52BB,0x5352,0x5354,0x5353,0x5351,0x5366,0x5377, +0x5378,0x5379,0x53D6,0x53D4,0x53D7,0x5473,0x5475, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5496,0x5478,0x5495,0x5480,0x547B,0x5477,0x5484,0x5492, +0x5486,0x547C,0x5490,0x5471,0x5476,0x548C,0x549A,0x5462, +0x5468,0x548B,0x547D,0x548E,0x56FA,0x5783,0x5777,0x576A, +0x5769,0x5761,0x5766,0x5764,0x577C,0x591C,0x5949,0x5947, +0x5948,0x5944,0x5954,0x59BE,0x59BB,0x59D4,0x59B9,0x59AE, +0x59D1,0x59C6,0x59D0,0x59CD,0x59CB,0x59D3,0x59CA,0x59AF, +0x59B3,0x59D2,0x59C5,0x5B5F,0x5B64,0x5B63,0x5B97,0x5B9A, +0x5B98,0x5B9C,0x5B99,0x5B9B,0x5C1A,0x5C48,0x5C45, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5C46,0x5CB7,0x5CA1,0x5CB8,0x5CA9,0x5CAB,0x5CB1, +0x5CB3,0x5E18,0x5E1A,0x5E16,0x5E15,0x5E1B,0x5E11,0x5E78, +0x5E9A,0x5E97,0x5E9C,0x5E95,0x5E96,0x5EF6,0x5F26,0x5F27, +0x5F29,0x5F80,0x5F81,0x5F7F,0x5F7C,0x5FDD,0x5FE0,0x5FFD, +0x5FF5,0x5FFF,0x600F,0x6014,0x602F,0x6035,0x6016,0x602A, +0x6015,0x6021,0x6027,0x6029,0x602B,0x601B,0x6216,0x6215, +0x623F,0x623E,0x6240,0x627F,0x62C9,0x62CC,0x62C4,0x62BF, +0x62C2,0x62B9,0x62D2,0x62DB,0x62AB,0x62D3,0x62D4,0x62CB, +0x62C8,0x62A8,0x62BD,0x62BC,0x62D0,0x62D9,0x62C7,0x62CD, +0x62B5,0x62DA,0x62B1,0x62D8,0x62D6,0x62D7,0x62C6,0x62AC, +0x62CE,0x653E,0x65A7,0x65BC,0x65FA,0x6614,0x6613,0x660C, +0x6606,0x6602,0x660E,0x6600,0x660F,0x6615,0x660A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6607,0x670D,0x670B,0x676D,0x678B,0x6795,0x6771,0x679C, +0x6773,0x6777,0x6787,0x679D,0x6797,0x676F,0x6770,0x677F, +0x6789,0x677E,0x6790,0x6775,0x679A,0x6793,0x677C,0x676A, +0x6772,0x6B23,0x6B66,0x6B67,0x6B7F,0x6C13,0x6C1B,0x6CE3, +0x6CE8,0x6CF3,0x6CB1,0x6CCC,0x6CE5,0x6CB3,0x6CBD,0x6CBE, +0x6CBC,0x6CE2,0x6CAB,0x6CD5,0x6CD3,0x6CB8,0x6CC4,0x6CB9, +0x6CC1,0x6CAE,0x6CD7,0x6CC5,0x6CF1,0x6CBF,0x6CBB,0x6CE1, +0x6CDB,0x6CCA,0x6CAC,0x6CEF,0x6CDC,0x6CD6,0x6CE0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7095,0x708E,0x7092,0x708A,0x7099,0x722C,0x722D, +0x7238,0x7248,0x7267,0x7269,0x72C0,0x72CE,0x72D9,0x72D7, +0x72D0,0x73A9,0x73A8,0x739F,0x73AB,0x73A5,0x753D,0x759D, +0x7599,0x759A,0x7684,0x76C2,0x76F2,0x76F4,0x77E5,0x77FD, +0x793E,0x7940,0x7941,0x79C9,0x79C8,0x7A7A,0x7A79,0x7AFA, +0x7CFE,0x7F54,0x7F8C,0x7F8B,0x8005,0x80BA,0x80A5,0x80A2, +0x80B1,0x80A1,0x80AB,0x80A9,0x80B4,0x80AA,0x80AF,0x81E5, +0x81FE,0x820D,0x82B3,0x829D,0x8299,0x82AD,0x82BD,0x829F, +0x82B9,0x82B1,0x82AC,0x82A5,0x82AF,0x82B8,0x82A3,0x82B0, +0x82BE,0x82B7,0x864E,0x8671,0x521D,0x8868,0x8ECB,0x8FCE, +0x8FD4,0x8FD1,0x90B5,0x90B8,0x90B1,0x90B6,0x91C7,0x91D1, +0x9577,0x9580,0x961C,0x9640,0x963F,0x963B,0x9644, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9642,0x96B9,0x96E8,0x9752,0x975E,0x4E9F,0x4EAD,0x4EAE, +0x4FE1,0x4FB5,0x4FAF,0x4FBF,0x4FE0,0x4FD1,0x4FCF,0x4FDD, +0x4FC3,0x4FB6,0x4FD8,0x4FDF,0x4FCA,0x4FD7,0x4FAE,0x4FD0, +0x4FC4,0x4FC2,0x4FDA,0x4FCE,0x4FDE,0x4FB7,0x5157,0x5192, +0x5191,0x51A0,0x524E,0x5243,0x524A,0x524D,0x524C,0x524B, +0x5247,0x52C7,0x52C9,0x52C3,0x52C1,0x530D,0x5357,0x537B, +0x539A,0x53DB,0x54AC,0x54C0,0x54A8,0x54CE,0x54C9,0x54B8, +0x54A6,0x54B3,0x54C7,0x54C2,0x54BD,0x54AA,0x54C1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x54C4,0x54C8,0x54AF,0x54AB,0x54B1,0x54BB,0x54A9, +0x54A7,0x54BF,0x56FF,0x5782,0x578B,0x57A0,0x57A3,0x57A2, +0x57CE,0x57AE,0x5793,0x5955,0x5951,0x594F,0x594E,0x5950, +0x59DC,0x59D8,0x59FF,0x59E3,0x59E8,0x5A03,0x59E5,0x59EA, +0x59DA,0x59E6,0x5A01,0x59FB,0x5B69,0x5BA3,0x5BA6,0x5BA4, +0x5BA2,0x5BA5,0x5C01,0x5C4E,0x5C4F,0x5C4D,0x5C4B,0x5CD9, +0x5CD2,0x5DF7,0x5E1D,0x5E25,0x5E1F,0x5E7D,0x5EA0,0x5EA6, +0x5EFA,0x5F08,0x5F2D,0x5F65,0x5F88,0x5F85,0x5F8A,0x5F8B, +0x5F87,0x5F8C,0x5F89,0x6012,0x601D,0x6020,0x6025,0x600E, +0x6028,0x604D,0x6070,0x6068,0x6062,0x6046,0x6043,0x606C, +0x606B,0x606A,0x6064,0x6241,0x62DC,0x6316,0x6309,0x62FC, +0x62ED,0x6301,0x62EE,0x62FD,0x6307,0x62F1,0x62F7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x62EF,0x62EC,0x62FE,0x62F4,0x6311,0x6302,0x653F,0x6545, +0x65AB,0x65BD,0x65E2,0x6625,0x662D,0x6620,0x6627,0x662F, +0x661F,0x6628,0x6631,0x6624,0x66F7,0x67FF,0x67D3,0x67F1, +0x67D4,0x67D0,0x67EC,0x67B6,0x67AF,0x67F5,0x67E9,0x67EF, +0x67C4,0x67D1,0x67B4,0x67DA,0x67E5,0x67B8,0x67CF,0x67DE, +0x67F3,0x67B0,0x67D9,0x67E2,0x67DD,0x67D2,0x6B6A,0x6B83, +0x6B86,0x6BB5,0x6BD2,0x6BD7,0x6C1F,0x6CC9,0x6D0B,0x6D32, +0x6D2A,0x6D41,0x6D25,0x6D0C,0x6D31,0x6D1E,0x6D17, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6D3B,0x6D3D,0x6D3E,0x6D36,0x6D1B,0x6CF5,0x6D39, +0x6D27,0x6D38,0x6D29,0x6D2E,0x6D35,0x6D0E,0x6D2B,0x70AB, +0x70BA,0x70B3,0x70AC,0x70AF,0x70AD,0x70B8,0x70AE,0x70A4, +0x7230,0x7272,0x726F,0x7274,0x72E9,0x72E0,0x72E1,0x73B7, +0x73CA,0x73BB,0x73B2,0x73CD,0x73C0,0x73B3,0x751A,0x752D, +0x754F,0x754C,0x754E,0x754B,0x75AB,0x75A4,0x75A5,0x75A2, +0x75A3,0x7678,0x7686,0x7687,0x7688,0x76C8,0x76C6,0x76C3, +0x76C5,0x7701,0x76F9,0x76F8,0x7709,0x770B,0x76FE,0x76FC, +0x7707,0x77DC,0x7802,0x7814,0x780C,0x780D,0x7946,0x7949, +0x7948,0x7947,0x79B9,0x79BA,0x79D1,0x79D2,0x79CB,0x7A7F, +0x7A81,0x7AFF,0x7AFD,0x7C7D,0x7D02,0x7D05,0x7D00,0x7D09, +0x7D07,0x7D04,0x7D06,0x7F38,0x7F8E,0x7FBF,0x8004, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8010,0x800D,0x8011,0x8036,0x80D6,0x80E5,0x80DA,0x80C3, +0x80C4,0x80CC,0x80E1,0x80DB,0x80CE,0x80DE,0x80E4,0x80DD, +0x81F4,0x8222,0x82E7,0x8303,0x8305,0x82E3,0x82DB,0x82E6, +0x8304,0x82E5,0x8302,0x8309,0x82D2,0x82D7,0x82F1,0x8301, +0x82DC,0x82D4,0x82D1,0x82DE,0x82D3,0x82DF,0x82EF,0x8306, +0x8650,0x8679,0x867B,0x867A,0x884D,0x886B,0x8981,0x89D4, +0x8A08,0x8A02,0x8A03,0x8C9E,0x8CA0,0x8D74,0x8D73,0x8DB4, +0x8ECD,0x8ECC,0x8FF0,0x8FE6,0x8FE2,0x8FEA,0x8FE5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8FED,0x8FEB,0x8FE4,0x8FE8,0x90CA,0x90CE,0x90C1, +0x90C3,0x914B,0x914A,0x91CD,0x9582,0x9650,0x964B,0x964C, +0x964D,0x9762,0x9769,0x97CB,0x97ED,0x97F3,0x9801,0x98A8, +0x98DB,0x98DF,0x9996,0x9999,0x4E58,0x4EB3,0x500C,0x500D, +0x5023,0x4FEF,0x5026,0x5025,0x4FF8,0x5029,0x5016,0x5006, +0x503C,0x501F,0x501A,0x5012,0x5011,0x4FFA,0x5000,0x5014, +0x5028,0x4FF1,0x5021,0x500B,0x5019,0x5018,0x4FF3,0x4FEE, +0x502D,0x502A,0x4FFE,0x502B,0x5009,0x517C,0x51A4,0x51A5, +0x51A2,0x51CD,0x51CC,0x51C6,0x51CB,0x5256,0x525C,0x5254, +0x525B,0x525D,0x532A,0x537F,0x539F,0x539D,0x53DF,0x54E8, +0x5510,0x5501,0x5537,0x54FC,0x54E5,0x54F2,0x5506,0x54FA, +0x5514,0x54E9,0x54ED,0x54E1,0x5509,0x54EE,0x54EA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x54E6,0x5527,0x5507,0x54FD,0x550F,0x5703,0x5704,0x57C2, +0x57D4,0x57CB,0x57C3,0x5809,0x590F,0x5957,0x5958,0x595A, +0x5A11,0x5A18,0x5A1C,0x5A1F,0x5A1B,0x5A13,0x59EC,0x5A20, +0x5A23,0x5A29,0x5A25,0x5A0C,0x5A09,0x5B6B,0x5C58,0x5BB0, +0x5BB3,0x5BB6,0x5BB4,0x5BAE,0x5BB5,0x5BB9,0x5BB8,0x5C04, +0x5C51,0x5C55,0x5C50,0x5CED,0x5CFD,0x5CFB,0x5CEA,0x5CE8, +0x5CF0,0x5CF6,0x5D01,0x5CF4,0x5DEE,0x5E2D,0x5E2B,0x5EAB, +0x5EAD,0x5EA7,0x5F31,0x5F92,0x5F91,0x5F90,0x6059, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6063,0x6065,0x6050,0x6055,0x606D,0x6069,0x606F, +0x6084,0x609F,0x609A,0x608D,0x6094,0x608C,0x6085,0x6096, +0x6247,0x62F3,0x6308,0x62FF,0x634E,0x633E,0x632F,0x6355, +0x6342,0x6346,0x634F,0x6349,0x633A,0x6350,0x633D,0x632A, +0x632B,0x6328,0x634D,0x634C,0x6548,0x6549,0x6599,0x65C1, +0x65C5,0x6642,0x6649,0x664F,0x6643,0x6652,0x664C,0x6645, +0x6641,0x66F8,0x6714,0x6715,0x6717,0x6821,0x6838,0x6848, +0x6846,0x6853,0x6839,0x6842,0x6854,0x6829,0x68B3,0x6817, +0x684C,0x6851,0x683D,0x67F4,0x6850,0x6840,0x683C,0x6843, +0x682A,0x6845,0x6813,0x6818,0x6841,0x6B8A,0x6B89,0x6BB7, +0x6C23,0x6C27,0x6C28,0x6C26,0x6C24,0x6CF0,0x6D6A,0x6D95, +0x6D88,0x6D87,0x6D66,0x6D78,0x6D77,0x6D59,0x6D93, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6D6C,0x6D89,0x6D6E,0x6D5A,0x6D74,0x6D69,0x6D8C,0x6D8A, +0x6D79,0x6D85,0x6D65,0x6D94,0x70CA,0x70D8,0x70E4,0x70D9, +0x70C8,0x70CF,0x7239,0x7279,0x72FC,0x72F9,0x72FD,0x72F8, +0x72F7,0x7386,0x73ED,0x7409,0x73EE,0x73E0,0x73EA,0x73DE, +0x7554,0x755D,0x755C,0x755A,0x7559,0x75BE,0x75C5,0x75C7, +0x75B2,0x75B3,0x75BD,0x75BC,0x75B9,0x75C2,0x75B8,0x768B, +0x76B0,0x76CA,0x76CD,0x76CE,0x7729,0x771F,0x7720,0x7728, +0x77E9,0x7830,0x7827,0x7838,0x781D,0x7834,0x7837, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7825,0x782D,0x7820,0x781F,0x7832,0x7955,0x7950, +0x7960,0x795F,0x7956,0x795E,0x795D,0x7957,0x795A,0x79E4, +0x79E3,0x79E7,0x79DF,0x79E6,0x79E9,0x79D8,0x7A84,0x7A88, +0x7AD9,0x7B06,0x7B11,0x7C89,0x7D21,0x7D17,0x7D0B,0x7D0A, +0x7D20,0x7D22,0x7D14,0x7D10,0x7D15,0x7D1A,0x7D1C,0x7D0D, +0x7D19,0x7D1B,0x7F3A,0x7F5F,0x7F94,0x7FC5,0x7FC1,0x8006, +0x8018,0x8015,0x8019,0x8017,0x803D,0x803F,0x80F1,0x8102, +0x80F0,0x8105,0x80ED,0x80F4,0x8106,0x80F8,0x80F3,0x8108, +0x80FD,0x810A,0x80FC,0x80EF,0x81ED,0x81EC,0x8200,0x8210, +0x822A,0x822B,0x8228,0x822C,0x82BB,0x832B,0x8352,0x8354, +0x834A,0x8338,0x8350,0x8349,0x8335,0x8334,0x834F,0x8332, +0x8339,0x8336,0x8317,0x8340,0x8331,0x8328,0x8343, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8654,0x868A,0x86AA,0x8693,0x86A4,0x86A9,0x868C,0x86A3, +0x869C,0x8870,0x8877,0x8881,0x8882,0x887D,0x8879,0x8A18, +0x8A10,0x8A0E,0x8A0C,0x8A15,0x8A0A,0x8A17,0x8A13,0x8A16, +0x8A0F,0x8A11,0x8C48,0x8C7A,0x8C79,0x8CA1,0x8CA2,0x8D77, +0x8EAC,0x8ED2,0x8ED4,0x8ECF,0x8FB1,0x9001,0x9006,0x8FF7, +0x9000,0x8FFA,0x8FF4,0x9003,0x8FFD,0x9005,0x8FF8,0x9095, +0x90E1,0x90DD,0x90E2,0x9152,0x914D,0x914C,0x91D8,0x91DD, +0x91D7,0x91DC,0x91D9,0x9583,0x9662,0x9663,0x9661, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x965B,0x965D,0x9664,0x9658,0x965E,0x96BB,0x98E2, +0x99AC,0x9AA8,0x9AD8,0x9B25,0x9B32,0x9B3C,0x4E7E,0x507A, +0x507D,0x505C,0x5047,0x5043,0x504C,0x505A,0x5049,0x5065, +0x5076,0x504E,0x5055,0x5075,0x5074,0x5077,0x504F,0x500F, +0x506F,0x506D,0x515C,0x5195,0x51F0,0x526A,0x526F,0x52D2, +0x52D9,0x52D8,0x52D5,0x5310,0x530F,0x5319,0x533F,0x5340, +0x533E,0x53C3,0x66FC,0x5546,0x556A,0x5566,0x5544,0x555E, +0x5561,0x5543,0x554A,0x5531,0x5556,0x554F,0x5555,0x552F, +0x5564,0x5538,0x552E,0x555C,0x552C,0x5563,0x5533,0x5541, +0x5557,0x5708,0x570B,0x5709,0x57DF,0x5805,0x580A,0x5806, +0x57E0,0x57E4,0x57FA,0x5802,0x5835,0x57F7,0x57F9,0x5920, +0x5962,0x5A36,0x5A41,0x5A49,0x5A66,0x5A6A,0x5A40, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5A3C,0x5A62,0x5A5A,0x5A46,0x5A4A,0x5B70,0x5BC7,0x5BC5, +0x5BC4,0x5BC2,0x5BBF,0x5BC6,0x5C09,0x5C08,0x5C07,0x5C60, +0x5C5C,0x5C5D,0x5D07,0x5D06,0x5D0E,0x5D1B,0x5D16,0x5D22, +0x5D11,0x5D29,0x5D14,0x5D19,0x5D24,0x5D27,0x5D17,0x5DE2, +0x5E38,0x5E36,0x5E33,0x5E37,0x5EB7,0x5EB8,0x5EB6,0x5EB5, +0x5EBE,0x5F35,0x5F37,0x5F57,0x5F6C,0x5F69,0x5F6B,0x5F97, +0x5F99,0x5F9E,0x5F98,0x5FA1,0x5FA0,0x5F9C,0x607F,0x60A3, +0x6089,0x60A0,0x60A8,0x60CB,0x60B4,0x60E6,0x60BD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x60C5,0x60BB,0x60B5,0x60DC,0x60BC,0x60D8,0x60D5, +0x60C6,0x60DF,0x60B8,0x60DA,0x60C7,0x621A,0x621B,0x6248, +0x63A0,0x63A7,0x6372,0x6396,0x63A2,0x63A5,0x6377,0x6367, +0x6398,0x63AA,0x6371,0x63A9,0x6389,0x6383,0x639B,0x636B, +0x63A8,0x6384,0x6388,0x6399,0x63A1,0x63AC,0x6392,0x638F, +0x6380,0x637B,0x6369,0x6368,0x637A,0x655D,0x6556,0x6551, +0x6559,0x6557,0x555F,0x654F,0x6558,0x6555,0x6554,0x659C, +0x659B,0x65AC,0x65CF,0x65CB,0x65CC,0x65CE,0x665D,0x665A, +0x6664,0x6668,0x6666,0x665E,0x66F9,0x52D7,0x671B,0x6881, +0x68AF,0x68A2,0x6893,0x68B5,0x687F,0x6876,0x68B1,0x68A7, +0x6897,0x68B0,0x6883,0x68C4,0x68AD,0x6886,0x6885,0x6894, +0x689D,0x68A8,0x689F,0x68A1,0x6882,0x6B32,0x6BBA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6BEB,0x6BEC,0x6C2B,0x6D8E,0x6DBC,0x6DF3,0x6DD9,0x6DB2, +0x6DE1,0x6DCC,0x6DE4,0x6DFB,0x6DFA,0x6E05,0x6DC7,0x6DCB, +0x6DAF,0x6DD1,0x6DAE,0x6DDE,0x6DF9,0x6DB8,0x6DF7,0x6DF5, +0x6DC5,0x6DD2,0x6E1A,0x6DB5,0x6DDA,0x6DEB,0x6DD8,0x6DEA, +0x6DF1,0x6DEE,0x6DE8,0x6DC6,0x6DC4,0x6DAA,0x6DEC,0x6DBF, +0x6DE6,0x70F9,0x7109,0x710A,0x70FD,0x70EF,0x723D,0x727D, +0x7281,0x731C,0x731B,0x7316,0x7313,0x7319,0x7387,0x7405, +0x740A,0x7403,0x7406,0x73FE,0x740D,0x74E0,0x74F6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x74F7,0x751C,0x7522,0x7565,0x7566,0x7562,0x7570, +0x758F,0x75D4,0x75D5,0x75B5,0x75CA,0x75CD,0x768E,0x76D4, +0x76D2,0x76DB,0x7737,0x773E,0x773C,0x7736,0x7738,0x773A, +0x786B,0x7843,0x784E,0x7965,0x7968,0x796D,0x79FB,0x7A92, +0x7A95,0x7B20,0x7B28,0x7B1B,0x7B2C,0x7B26,0x7B19,0x7B1E, +0x7B2E,0x7C92,0x7C97,0x7C95,0x7D46,0x7D43,0x7D71,0x7D2E, +0x7D39,0x7D3C,0x7D40,0x7D30,0x7D33,0x7D44,0x7D2F,0x7D42, +0x7D32,0x7D31,0x7F3D,0x7F9E,0x7F9A,0x7FCC,0x7FCE,0x7FD2, +0x801C,0x804A,0x8046,0x812F,0x8116,0x8123,0x812B,0x8129, +0x8130,0x8124,0x8202,0x8235,0x8237,0x8236,0x8239,0x838E, +0x839E,0x8398,0x8378,0x83A2,0x8396,0x83BD,0x83AB,0x8392, +0x838A,0x8393,0x8389,0x83A0,0x8377,0x837B,0x837C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8386,0x83A7,0x8655,0x5F6A,0x86C7,0x86C0,0x86B6,0x86C4, +0x86B5,0x86C6,0x86CB,0x86B1,0x86AF,0x86C9,0x8853,0x889E, +0x8888,0x88AB,0x8892,0x8896,0x888D,0x888B,0x8993,0x898F, +0x8A2A,0x8A1D,0x8A23,0x8A25,0x8A31,0x8A2D,0x8A1F,0x8A1B, +0x8A22,0x8C49,0x8C5A,0x8CA9,0x8CAC,0x8CAB,0x8CA8,0x8CAA, +0x8CA7,0x8D67,0x8D66,0x8DBE,0x8DBA,0x8EDB,0x8EDF,0x9019, +0x900D,0x901A,0x9017,0x9023,0x901F,0x901D,0x9010,0x9015, +0x901E,0x9020,0x900F,0x9022,0x9016,0x901B,0x9014, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x90E8,0x90ED,0x90FD,0x9157,0x91CE,0x91F5,0x91E6, +0x91E3,0x91E7,0x91ED,0x91E9,0x9589,0x966A,0x9675,0x9673, +0x9678,0x9670,0x9674,0x9676,0x9677,0x966C,0x96C0,0x96EA, +0x96E9,0x7AE0,0x7ADF,0x9802,0x9803,0x9B5A,0x9CE5,0x9E75, +0x9E7F,0x9EA5,0x9EBB,0x50A2,0x508D,0x5085,0x5099,0x5091, +0x5080,0x5096,0x5098,0x509A,0x6700,0x51F1,0x5272,0x5274, +0x5275,0x5269,0x52DE,0x52DD,0x52DB,0x535A,0x53A5,0x557B, +0x5580,0x55A7,0x557C,0x558A,0x559D,0x5598,0x5582,0x559C, +0x55AA,0x5594,0x5587,0x558B,0x5583,0x55B3,0x55AE,0x559F, +0x553E,0x55B2,0x559A,0x55BB,0x55AC,0x55B1,0x557E,0x5589, +0x55AB,0x5599,0x570D,0x582F,0x582A,0x5834,0x5824,0x5830, +0x5831,0x5821,0x581D,0x5820,0x58F9,0x58FA,0x5960, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5A77,0x5A9A,0x5A7F,0x5A92,0x5A9B,0x5AA7,0x5B73,0x5B71, +0x5BD2,0x5BCC,0x5BD3,0x5BD0,0x5C0A,0x5C0B,0x5C31,0x5D4C, +0x5D50,0x5D34,0x5D47,0x5DFD,0x5E45,0x5E3D,0x5E40,0x5E43, +0x5E7E,0x5ECA,0x5EC1,0x5EC2,0x5EC4,0x5F3C,0x5F6D,0x5FA9, +0x5FAA,0x5FA8,0x60D1,0x60E1,0x60B2,0x60B6,0x60E0,0x611C, +0x6123,0x60FA,0x6115,0x60F0,0x60FB,0x60F4,0x6168,0x60F1, +0x610E,0x60F6,0x6109,0x6100,0x6112,0x621F,0x6249,0x63A3, +0x638C,0x63CF,0x63C0,0x63E9,0x63C9,0x63C6,0x63CD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x63D2,0x63E3,0x63D0,0x63E1,0x63D6,0x63ED,0x63EE, +0x6376,0x63F4,0x63EA,0x63DB,0x6452,0x63DA,0x63F9,0x655E, +0x6566,0x6562,0x6563,0x6591,0x6590,0x65AF,0x666E,0x6670, +0x6674,0x6676,0x666F,0x6691,0x667A,0x667E,0x6677,0x66FE, +0x66FF,0x671F,0x671D,0x68FA,0x68D5,0x68E0,0x68D8,0x68D7, +0x6905,0x68DF,0x68F5,0x68EE,0x68E7,0x68F9,0x68D2,0x68F2, +0x68E3,0x68CB,0x68CD,0x690D,0x6912,0x690E,0x68C9,0x68DA, +0x696E,0x68FB,0x6B3E,0x6B3A,0x6B3D,0x6B98,0x6B96,0x6BBC, +0x6BEF,0x6C2E,0x6C2F,0x6C2C,0x6E2F,0x6E38,0x6E54,0x6E21, +0x6E32,0x6E67,0x6E4A,0x6E20,0x6E25,0x6E23,0x6E1B,0x6E5B, +0x6E58,0x6E24,0x6E56,0x6E6E,0x6E2D,0x6E26,0x6E6F,0x6E34, +0x6E4D,0x6E3A,0x6E2C,0x6E43,0x6E1D,0x6E3E,0x6ECB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6E89,0x6E19,0x6E4E,0x6E63,0x6E44,0x6E72,0x6E69,0x6E5F, +0x7119,0x711A,0x7126,0x7130,0x7121,0x7136,0x716E,0x711C, +0x724C,0x7284,0x7280,0x7336,0x7325,0x7334,0x7329,0x743A, +0x742A,0x7433,0x7422,0x7425,0x7435,0x7436,0x7434,0x742F, +0x741B,0x7426,0x7428,0x7525,0x7526,0x756B,0x756A,0x75E2, +0x75DB,0x75E3,0x75D9,0x75D8,0x75DE,0x75E0,0x767B,0x767C, +0x7696,0x7693,0x76B4,0x76DC,0x774F,0x77ED,0x785D,0x786C, +0x786F,0x7A0D,0x7A08,0x7A0B,0x7A05,0x7A00,0x7A98, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7A97,0x7A96,0x7AE5,0x7AE3,0x7B49,0x7B56,0x7B46, +0x7B50,0x7B52,0x7B54,0x7B4D,0x7B4B,0x7B4F,0x7B51,0x7C9F, +0x7CA5,0x7D5E,0x7D50,0x7D68,0x7D55,0x7D2B,0x7D6E,0x7D72, +0x7D61,0x7D66,0x7D62,0x7D70,0x7D73,0x5584,0x7FD4,0x7FD5, +0x800B,0x8052,0x8085,0x8155,0x8154,0x814B,0x8151,0x814E, +0x8139,0x8146,0x813E,0x814C,0x8153,0x8174,0x8212,0x821C, +0x83E9,0x8403,0x83F8,0x840D,0x83E0,0x83C5,0x840B,0x83C1, +0x83EF,0x83F1,0x83F4,0x8457,0x840A,0x83F0,0x840C,0x83CC, +0x83FD,0x83F2,0x83CA,0x8438,0x840E,0x8404,0x83DC,0x8407, +0x83D4,0x83DF,0x865B,0x86DF,0x86D9,0x86ED,0x86D4,0x86DB, +0x86E4,0x86D0,0x86DE,0x8857,0x88C1,0x88C2,0x88B1,0x8983, +0x8996,0x8A3B,0x8A60,0x8A55,0x8A5E,0x8A3C,0x8A41, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8A54,0x8A5B,0x8A50,0x8A46,0x8A34,0x8A3A,0x8A36,0x8A56, +0x8C61,0x8C82,0x8CAF,0x8CBC,0x8CB3,0x8CBD,0x8CC1,0x8CBB, +0x8CC0,0x8CB4,0x8CB7,0x8CB6,0x8CBF,0x8CB8,0x8D8A,0x8D85, +0x8D81,0x8DCE,0x8DDD,0x8DCB,0x8DDA,0x8DD1,0x8DCC,0x8DDB, +0x8DC6,0x8EFB,0x8EF8,0x8EFC,0x8F9C,0x902E,0x9035,0x9031, +0x9038,0x9032,0x9036,0x9102,0x90F5,0x9109,0x90FE,0x9163, +0x9165,0x91CF,0x9214,0x9215,0x9223,0x9209,0x921E,0x920D, +0x9210,0x9207,0x9211,0x9594,0x958F,0x958B,0x9591, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9593,0x9592,0x958E,0x968A,0x968E,0x968B,0x967D, +0x9685,0x9686,0x968D,0x9672,0x9684,0x96C1,0x96C5,0x96C4, +0x96C6,0x96C7,0x96EF,0x96F2,0x97CC,0x9805,0x9806,0x9808, +0x98E7,0x98EA,0x98EF,0x98E9,0x98F2,0x98ED,0x99AE,0x99AD, +0x9EC3,0x9ECD,0x9ED1,0x4E82,0x50AD,0x50B5,0x50B2,0x50B3, +0x50C5,0x50BE,0x50AC,0x50B7,0x50BB,0x50AF,0x50C7,0x527F, +0x5277,0x527D,0x52DF,0x52E6,0x52E4,0x52E2,0x52E3,0x532F, +0x55DF,0x55E8,0x55D3,0x55E6,0x55CE,0x55DC,0x55C7,0x55D1, +0x55E3,0x55E4,0x55EF,0x55DA,0x55E1,0x55C5,0x55C6,0x55E5, +0x55C9,0x5712,0x5713,0x585E,0x5851,0x5858,0x5857,0x585A, +0x5854,0x586B,0x584C,0x586D,0x584A,0x5862,0x5852,0x584B, +0x5967,0x5AC1,0x5AC9,0x5ACC,0x5ABE,0x5ABD,0x5ABC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5AB3,0x5AC2,0x5AB2,0x5D69,0x5D6F,0x5E4C,0x5E79,0x5EC9, +0x5EC8,0x5F12,0x5F59,0x5FAC,0x5FAE,0x611A,0x610F,0x6148, +0x611F,0x60F3,0x611B,0x60F9,0x6101,0x6108,0x614E,0x614C, +0x6144,0x614D,0x613E,0x6134,0x6127,0x610D,0x6106,0x6137, +0x6221,0x6222,0x6413,0x643E,0x641E,0x642A,0x642D,0x643D, +0x642C,0x640F,0x641C,0x6414,0x640D,0x6436,0x6416,0x6417, +0x6406,0x656C,0x659F,0x65B0,0x6697,0x6689,0x6687,0x6688, +0x6696,0x6684,0x6698,0x668D,0x6703,0x6994,0x696D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x695A,0x6977,0x6960,0x6954,0x6975,0x6930,0x6982, +0x694A,0x6968,0x696B,0x695E,0x6953,0x6979,0x6986,0x695D, +0x6963,0x695B,0x6B47,0x6B72,0x6BC0,0x6BBF,0x6BD3,0x6BFD, +0x6EA2,0x6EAF,0x6ED3,0x6EB6,0x6EC2,0x6E90,0x6E9D,0x6EC7, +0x6EC5,0x6EA5,0x6E98,0x6EBC,0x6EBA,0x6EAB,0x6ED1,0x6E96, +0x6E9C,0x6EC4,0x6ED4,0x6EAA,0x6EA7,0x6EB4,0x714E,0x7159, +0x7169,0x7164,0x7149,0x7167,0x715C,0x716C,0x7166,0x714C, +0x7165,0x715E,0x7146,0x7168,0x7156,0x723A,0x7252,0x7337, +0x7345,0x733F,0x733E,0x746F,0x745A,0x7455,0x745F,0x745E, +0x7441,0x743F,0x7459,0x745B,0x745C,0x7576,0x7578,0x7600, +0x75F0,0x7601,0x75F2,0x75F1,0x75FA,0x75FF,0x75F4,0x75F3, +0x76DE,0x76DF,0x775B,0x776B,0x7766,0x775E,0x7763, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7779,0x776A,0x776C,0x775C,0x7765,0x7768,0x7762,0x77EE, +0x788E,0x78B0,0x7897,0x7898,0x788C,0x7889,0x787C,0x7891, +0x7893,0x787F,0x797A,0x797F,0x7981,0x842C,0x79BD,0x7A1C, +0x7A1A,0x7A20,0x7A14,0x7A1F,0x7A1E,0x7A9F,0x7AA0,0x7B77, +0x7BC0,0x7B60,0x7B6E,0x7B67,0x7CB1,0x7CB3,0x7CB5,0x7D93, +0x7D79,0x7D91,0x7D81,0x7D8F,0x7D5B,0x7F6E,0x7F69,0x7F6A, +0x7F72,0x7FA9,0x7FA8,0x7FA4,0x8056,0x8058,0x8086,0x8084, +0x8171,0x8170,0x8178,0x8165,0x816E,0x8173,0x816B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8179,0x817A,0x8166,0x8205,0x8247,0x8482,0x8477, +0x843D,0x8431,0x8475,0x8466,0x846B,0x8449,0x846C,0x845B, +0x843C,0x8435,0x8461,0x8463,0x8469,0x846D,0x8446,0x865E, +0x865C,0x865F,0x86F9,0x8713,0x8708,0x8707,0x8700,0x86FE, +0x86FB,0x8702,0x8703,0x8706,0x870A,0x8859,0x88DF,0x88D4, +0x88D9,0x88DC,0x88D8,0x88DD,0x88E1,0x88CA,0x88D5,0x88D2, +0x899C,0x89E3,0x8A6B,0x8A72,0x8A73,0x8A66,0x8A69,0x8A70, +0x8A87,0x8A7C,0x8A63,0x8AA0,0x8A71,0x8A85,0x8A6D,0x8A62, +0x8A6E,0x8A6C,0x8A79,0x8A7B,0x8A3E,0x8A68,0x8C62,0x8C8A, +0x8C89,0x8CCA,0x8CC7,0x8CC8,0x8CC4,0x8CB2,0x8CC3,0x8CC2, +0x8CC5,0x8DE1,0x8DDF,0x8DE8,0x8DEF,0x8DF3,0x8DFA,0x8DEA, +0x8DE4,0x8DE6,0x8EB2,0x8F03,0x8F09,0x8EFE,0x8F0A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8F9F,0x8FB2,0x904B,0x904A,0x9053,0x9042,0x9054,0x903C, +0x9055,0x9050,0x9047,0x904F,0x904E,0x904D,0x9051,0x903E, +0x9041,0x9112,0x9117,0x916C,0x916A,0x9169,0x91C9,0x9237, +0x9257,0x9238,0x923D,0x9240,0x923E,0x925B,0x924B,0x9264, +0x9251,0x9234,0x9249,0x924D,0x9245,0x9239,0x923F,0x925A, +0x9598,0x9698,0x9694,0x9695,0x96CD,0x96CB,0x96C9,0x96CA, +0x96F7,0x96FB,0x96F9,0x96F6,0x9756,0x9774,0x9776,0x9810, +0x9811,0x9813,0x980A,0x9812,0x980C,0x98FC,0x98F4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x98FD,0x98FE,0x99B3,0x99B1,0x99B4,0x9AE1,0x9CE9, +0x9E82,0x9F0E,0x9F13,0x9F20,0x50E7,0x50EE,0x50E5,0x50D6, +0x50ED,0x50DA,0x50D5,0x50CF,0x50D1,0x50F1,0x50CE,0x50E9, +0x5162,0x51F3,0x5283,0x5282,0x5331,0x53AD,0x55FE,0x5600, +0x561B,0x5617,0x55FD,0x5614,0x5606,0x5609,0x560D,0x560E, +0x55F7,0x5616,0x561F,0x5608,0x5610,0x55F6,0x5718,0x5716, +0x5875,0x587E,0x5883,0x5893,0x588A,0x5879,0x5885,0x587D, +0x58FD,0x5925,0x5922,0x5924,0x596A,0x5969,0x5AE1,0x5AE6, +0x5AE9,0x5AD7,0x5AD6,0x5AD8,0x5AE3,0x5B75,0x5BDE,0x5BE7, +0x5BE1,0x5BE5,0x5BE6,0x5BE8,0x5BE2,0x5BE4,0x5BDF,0x5C0D, +0x5C62,0x5D84,0x5D87,0x5E5B,0x5E63,0x5E55,0x5E57,0x5E54, +0x5ED3,0x5ED6,0x5F0A,0x5F46,0x5F70,0x5FB9,0x6147, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x613F,0x614B,0x6177,0x6162,0x6163,0x615F,0x615A,0x6158, +0x6175,0x622A,0x6487,0x6458,0x6454,0x64A4,0x6478,0x645F, +0x647A,0x6451,0x6467,0x6434,0x646D,0x647B,0x6572,0x65A1, +0x65D7,0x65D6,0x66A2,0x66A8,0x669D,0x699C,0x69A8,0x6995, +0x69C1,0x69AE,0x69D3,0x69CB,0x699B,0x69B7,0x69BB,0x69AB, +0x69B4,0x69D0,0x69CD,0x69AD,0x69CC,0x69A6,0x69C3,0x69A3, +0x6B49,0x6B4C,0x6C33,0x6F33,0x6F14,0x6EFE,0x6F13,0x6EF4, +0x6F29,0x6F3E,0x6F20,0x6F2C,0x6F0F,0x6F02,0x6F22, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6EFF,0x6EEF,0x6F06,0x6F31,0x6F38,0x6F32,0x6F23, +0x6F15,0x6F2B,0x6F2F,0x6F88,0x6F2A,0x6EEC,0x6F01,0x6EF2, +0x6ECC,0x6EF7,0x7194,0x7199,0x717D,0x718A,0x7184,0x7192, +0x723E,0x7292,0x7296,0x7344,0x7350,0x7464,0x7463,0x746A, +0x7470,0x746D,0x7504,0x7591,0x7627,0x760D,0x760B,0x7609, +0x7613,0x76E1,0x76E3,0x7784,0x777D,0x777F,0x7761,0x78C1, +0x789F,0x78A7,0x78B3,0x78A9,0x78A3,0x798E,0x798F,0x798D, +0x7A2E,0x7A31,0x7AAA,0x7AA9,0x7AED,0x7AEF,0x7BA1,0x7B95, +0x7B8B,0x7B75,0x7B97,0x7B9D,0x7B94,0x7B8F,0x7BB8,0x7B87, +0x7B84,0x7CB9,0x7CBD,0x7CBE,0x7DBB,0x7DB0,0x7D9C,0x7DBD, +0x7DBE,0x7DA0,0x7DCA,0x7DB4,0x7DB2,0x7DB1,0x7DBA,0x7DA2, +0x7DBF,0x7DB5,0x7DB8,0x7DAD,0x7DD2,0x7DC7,0x7DAC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7F70,0x7FE0,0x7FE1,0x7FDF,0x805E,0x805A,0x8087,0x8150, +0x8180,0x818F,0x8188,0x818A,0x817F,0x8182,0x81E7,0x81FA, +0x8207,0x8214,0x821E,0x824B,0x84C9,0x84BF,0x84C6,0x84C4, +0x8499,0x849E,0x84B2,0x849C,0x84CB,0x84B8,0x84C0,0x84D3, +0x8490,0x84BC,0x84D1,0x84CA,0x873F,0x871C,0x873B,0x8722, +0x8725,0x8734,0x8718,0x8755,0x8737,0x8729,0x88F3,0x8902, +0x88F4,0x88F9,0x88F8,0x88FD,0x88E8,0x891A,0x88EF,0x8AA6, +0x8A8C,0x8A9E,0x8AA3,0x8A8D,0x8AA1,0x8A93,0x8AA4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AAA,0x8AA5,0x8AA8,0x8A98,0x8A91,0x8A9A,0x8AA7, +0x8C6A,0x8C8D,0x8C8C,0x8CD3,0x8CD1,0x8CD2,0x8D6B,0x8D99, +0x8D95,0x8DFC,0x8F14,0x8F12,0x8F15,0x8F13,0x8FA3,0x9060, +0x9058,0x905C,0x9063,0x9059,0x905E,0x9062,0x905D,0x905B, +0x9119,0x9118,0x911E,0x9175,0x9178,0x9177,0x9174,0x9278, +0x9280,0x9285,0x9298,0x9296,0x927B,0x9293,0x929C,0x92A8, +0x927C,0x9291,0x95A1,0x95A8,0x95A9,0x95A3,0x95A5,0x95A4, +0x9699,0x969C,0x969B,0x96CC,0x96D2,0x9700,0x977C,0x9785, +0x97F6,0x9817,0x9818,0x98AF,0x98B1,0x9903,0x9905,0x990C, +0x9909,0x99C1,0x9AAF,0x9AB0,0x9AE6,0x9B41,0x9B42,0x9CF4, +0x9CF6,0x9CF3,0x9EBC,0x9F3B,0x9F4A,0x5104,0x5100,0x50FB, +0x50F5,0x50F9,0x5102,0x5108,0x5109,0x5105,0x51DC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5287,0x5288,0x5289,0x528D,0x528A,0x52F0,0x53B2,0x562E, +0x563B,0x5639,0x5632,0x563F,0x5634,0x5629,0x5653,0x564E, +0x5657,0x5674,0x5636,0x562F,0x5630,0x5880,0x589F,0x589E, +0x58B3,0x589C,0x58AE,0x58A9,0x58A6,0x596D,0x5B09,0x5AFB, +0x5B0B,0x5AF5,0x5B0C,0x5B08,0x5BEE,0x5BEC,0x5BE9,0x5BEB, +0x5C64,0x5C65,0x5D9D,0x5D94,0x5E62,0x5E5F,0x5E61,0x5EE2, +0x5EDA,0x5EDF,0x5EDD,0x5EE3,0x5EE0,0x5F48,0x5F71,0x5FB7, +0x5FB5,0x6176,0x6167,0x616E,0x615D,0x6155,0x6182, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x617C,0x6170,0x616B,0x617E,0x61A7,0x6190,0x61AB, +0x618E,0x61AC,0x619A,0x61A4,0x6194,0x61AE,0x622E,0x6469, +0x646F,0x6479,0x649E,0x64B2,0x6488,0x6490,0x64B0,0x64A5, +0x6493,0x6495,0x64A9,0x6492,0x64AE,0x64AD,0x64AB,0x649A, +0x64AC,0x6499,0x64A2,0x64B3,0x6575,0x6577,0x6578,0x66AE, +0x66AB,0x66B4,0x66B1,0x6A23,0x6A1F,0x69E8,0x6A01,0x6A1E, +0x6A19,0x69FD,0x6A21,0x6A13,0x6A0A,0x69F3,0x6A02,0x6A05, +0x69ED,0x6A11,0x6B50,0x6B4E,0x6BA4,0x6BC5,0x6BC6,0x6F3F, +0x6F7C,0x6F84,0x6F51,0x6F66,0x6F54,0x6F86,0x6F6D,0x6F5B, +0x6F78,0x6F6E,0x6F8E,0x6F7A,0x6F70,0x6F64,0x6F97,0x6F58, +0x6ED5,0x6F6F,0x6F60,0x6F5F,0x719F,0x71AC,0x71B1,0x71A8, +0x7256,0x729B,0x734E,0x7357,0x7469,0x748B,0x7483, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x747E,0x7480,0x757F,0x7620,0x7629,0x761F,0x7624,0x7626, +0x7621,0x7622,0x769A,0x76BA,0x76E4,0x778E,0x7787,0x778C, +0x7791,0x778B,0x78CB,0x78C5,0x78BA,0x78CA,0x78BE,0x78D5, +0x78BC,0x78D0,0x7A3F,0x7A3C,0x7A40,0x7A3D,0x7A37,0x7A3B, +0x7AAF,0x7AAE,0x7BAD,0x7BB1,0x7BC4,0x7BB4,0x7BC6,0x7BC7, +0x7BC1,0x7BA0,0x7BCC,0x7CCA,0x7DE0,0x7DF4,0x7DEF,0x7DFB, +0x7DD8,0x7DEC,0x7DDD,0x7DE8,0x7DE3,0x7DDA,0x7DDE,0x7DE9, +0x7D9E,0x7DD9,0x7DF2,0x7DF9,0x7F75,0x7F77,0x7FAF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7FE9,0x8026,0x819B,0x819C,0x819D,0x81A0,0x819A, +0x8198,0x8517,0x853D,0x851A,0x84EE,0x852C,0x852D,0x8513, +0x8511,0x8523,0x8521,0x8514,0x84EC,0x8525,0x84FF,0x8506, +0x8782,0x8774,0x8776,0x8760,0x8766,0x8778,0x8768,0x8759, +0x8757,0x874C,0x8753,0x885B,0x885D,0x8910,0x8907,0x8912, +0x8913,0x8915,0x890A,0x8ABC,0x8AD2,0x8AC7,0x8AC4,0x8A95, +0x8ACB,0x8AF8,0x8AB2,0x8AC9,0x8AC2,0x8ABF,0x8AB0,0x8AD6, +0x8ACD,0x8AB6,0x8AB9,0x8ADB,0x8C4C,0x8C4E,0x8C6C,0x8CE0, +0x8CDE,0x8CE6,0x8CE4,0x8CEC,0x8CED,0x8CE2,0x8CE3,0x8CDC, +0x8CEA,0x8CE1,0x8D6D,0x8D9F,0x8DA3,0x8E2B,0x8E10,0x8E1D, +0x8E22,0x8E0F,0x8E29,0x8E1F,0x8E21,0x8E1E,0x8EBA,0x8F1D, +0x8F1B,0x8F1F,0x8F29,0x8F26,0x8F2A,0x8F1C,0x8F1E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8F25,0x9069,0x906E,0x9068,0x906D,0x9077,0x9130,0x912D, +0x9127,0x9131,0x9187,0x9189,0x918B,0x9183,0x92C5,0x92BB, +0x92B7,0x92EA,0x92AC,0x92E4,0x92C1,0x92B3,0x92BC,0x92D2, +0x92C7,0x92F0,0x92B2,0x95AD,0x95B1,0x9704,0x9706,0x9707, +0x9709,0x9760,0x978D,0x978B,0x978F,0x9821,0x982B,0x981C, +0x98B3,0x990A,0x9913,0x9912,0x9918,0x99DD,0x99D0,0x99DF, +0x99DB,0x99D1,0x99D5,0x99D2,0x99D9,0x9AB7,0x9AEE,0x9AEF, +0x9B27,0x9B45,0x9B44,0x9B77,0x9B6F,0x9D06,0x9D09, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9D03,0x9EA9,0x9EBE,0x9ECE,0x58A8,0x9F52,0x5112, +0x5118,0x5114,0x5110,0x5115,0x5180,0x51AA,0x51DD,0x5291, +0x5293,0x52F3,0x5659,0x566B,0x5679,0x5669,0x5664,0x5678, +0x566A,0x5668,0x5665,0x5671,0x566F,0x566C,0x5662,0x5676, +0x58C1,0x58BE,0x58C7,0x58C5,0x596E,0x5B1D,0x5B34,0x5B78, +0x5BF0,0x5C0E,0x5F4A,0x61B2,0x6191,0x61A9,0x618A,0x61CD, +0x61B6,0x61BE,0x61CA,0x61C8,0x6230,0x64C5,0x64C1,0x64CB, +0x64BB,0x64BC,0x64DA,0x64C4,0x64C7,0x64C2,0x64CD,0x64BF, +0x64D2,0x64D4,0x64BE,0x6574,0x66C6,0x66C9,0x66B9,0x66C4, +0x66C7,0x66B8,0x6A3D,0x6A38,0x6A3A,0x6A59,0x6A6B,0x6A58, +0x6A39,0x6A44,0x6A62,0x6A61,0x6A4B,0x6A47,0x6A35,0x6A5F, +0x6A48,0x6B59,0x6B77,0x6C05,0x6FC2,0x6FB1,0x6FA1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6FC3,0x6FA4,0x6FC1,0x6FA7,0x6FB3,0x6FC0,0x6FB9,0x6FB6, +0x6FA6,0x6FA0,0x6FB4,0x71BE,0x71C9,0x71D0,0x71D2,0x71C8, +0x71D5,0x71B9,0x71CE,0x71D9,0x71DC,0x71C3,0x71C4,0x7368, +0x749C,0x74A3,0x7498,0x749F,0x749E,0x74E2,0x750C,0x750D, +0x7634,0x7638,0x763A,0x76E7,0x76E5,0x77A0,0x779E,0x779F, +0x77A5,0x78E8,0x78DA,0x78EC,0x78E7,0x79A6,0x7A4D,0x7A4E, +0x7A46,0x7A4C,0x7A4B,0x7ABA,0x7BD9,0x7C11,0x7BC9,0x7BE4, +0x7BDB,0x7BE1,0x7BE9,0x7BE6,0x7CD5,0x7CD6,0x7E0A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7E11,0x7E08,0x7E1B,0x7E23,0x7E1E,0x7E1D,0x7E09, +0x7E10,0x7F79,0x7FB2,0x7FF0,0x7FF1,0x7FEE,0x8028,0x81B3, +0x81A9,0x81A8,0x81FB,0x8208,0x8258,0x8259,0x854A,0x8559, +0x8548,0x8568,0x8569,0x8543,0x8549,0x856D,0x856A,0x855E, +0x8783,0x879F,0x879E,0x87A2,0x878D,0x8861,0x892A,0x8932, +0x8925,0x892B,0x8921,0x89AA,0x89A6,0x8AE6,0x8AFA,0x8AEB, +0x8AF1,0x8B00,0x8ADC,0x8AE7,0x8AEE,0x8AFE,0x8B01,0x8B02, +0x8AF7,0x8AED,0x8AF3,0x8AF6,0x8AFC,0x8C6B,0x8C6D,0x8C93, +0x8CF4,0x8E44,0x8E31,0x8E34,0x8E42,0x8E39,0x8E35,0x8F3B, +0x8F2F,0x8F38,0x8F33,0x8FA8,0x8FA6,0x9075,0x9074,0x9078, +0x9072,0x907C,0x907A,0x9134,0x9192,0x9320,0x9336,0x92F8, +0x9333,0x932F,0x9322,0x92FC,0x932B,0x9304,0x931A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9310,0x9326,0x9321,0x9315,0x932E,0x9319,0x95BB,0x96A7, +0x96A8,0x96AA,0x96D5,0x970E,0x9711,0x9716,0x970D,0x9713, +0x970F,0x975B,0x975C,0x9766,0x9798,0x9830,0x9838,0x983B, +0x9837,0x982D,0x9839,0x9824,0x9910,0x9928,0x991E,0x991B, +0x9921,0x991A,0x99ED,0x99E2,0x99F1,0x9AB8,0x9ABC,0x9AFB, +0x9AED,0x9B28,0x9B91,0x9D15,0x9D23,0x9D26,0x9D28,0x9D12, +0x9D1B,0x9ED8,0x9ED4,0x9F8D,0x9F9C,0x512A,0x511F,0x5121, +0x5132,0x52F5,0x568E,0x5680,0x5690,0x5685,0x5687, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x568F,0x58D5,0x58D3,0x58D1,0x58CE,0x5B30,0x5B2A, +0x5B24,0x5B7A,0x5C37,0x5C68,0x5DBC,0x5DBA,0x5DBD,0x5DB8, +0x5E6B,0x5F4C,0x5FBD,0x61C9,0x61C2,0x61C7,0x61E6,0x61CB, +0x6232,0x6234,0x64CE,0x64CA,0x64D8,0x64E0,0x64F0,0x64E6, +0x64EC,0x64F1,0x64E2,0x64ED,0x6582,0x6583,0x66D9,0x66D6, +0x6A80,0x6A94,0x6A84,0x6AA2,0x6A9C,0x6ADB,0x6AA3,0x6A7E, +0x6A97,0x6A90,0x6AA0,0x6B5C,0x6BAE,0x6BDA,0x6C08,0x6FD8, +0x6FF1,0x6FDF,0x6FE0,0x6FDB,0x6FE4,0x6FEB,0x6FEF,0x6F80, +0x6FEC,0x6FE1,0x6FE9,0x6FD5,0x6FEE,0x6FF0,0x71E7,0x71DF, +0x71EE,0x71E6,0x71E5,0x71ED,0x71EC,0x71F4,0x71E0,0x7235, +0x7246,0x7370,0x7372,0x74A9,0x74B0,0x74A6,0x74A8,0x7646, +0x7642,0x764C,0x76EA,0x77B3,0x77AA,0x77B0,0x77AC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x77A7,0x77AD,0x77EF,0x78F7,0x78FA,0x78F4,0x78EF,0x7901, +0x79A7,0x79AA,0x7A57,0x7ABF,0x7C07,0x7C0D,0x7BFE,0x7BF7, +0x7C0C,0x7BE0,0x7CE0,0x7CDC,0x7CDE,0x7CE2,0x7CDF,0x7CD9, +0x7CDD,0x7E2E,0x7E3E,0x7E46,0x7E37,0x7E32,0x7E43,0x7E2B, +0x7E3D,0x7E31,0x7E45,0x7E41,0x7E34,0x7E39,0x7E48,0x7E35, +0x7E3F,0x7E2F,0x7F44,0x7FF3,0x7FFC,0x8071,0x8072,0x8070, +0x806F,0x8073,0x81C6,0x81C3,0x81BA,0x81C2,0x81C0,0x81BF, +0x81BD,0x81C9,0x81BE,0x81E8,0x8209,0x8271,0x85AA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8584,0x857E,0x859C,0x8591,0x8594,0x85AF,0x859B, +0x8587,0x85A8,0x858A,0x8667,0x87C0,0x87D1,0x87B3,0x87D2, +0x87C6,0x87AB,0x87BB,0x87BA,0x87C8,0x87CB,0x893B,0x8936, +0x8944,0x8938,0x893D,0x89AC,0x8B0E,0x8B17,0x8B19,0x8B1B, +0x8B0A,0x8B20,0x8B1D,0x8B04,0x8B10,0x8C41,0x8C3F,0x8C73, +0x8CFA,0x8CFD,0x8CFC,0x8CF8,0x8CFB,0x8DA8,0x8E49,0x8E4B, +0x8E48,0x8E4A,0x8F44,0x8F3E,0x8F42,0x8F45,0x8F3F,0x907F, +0x907D,0x9084,0x9081,0x9082,0x9080,0x9139,0x91A3,0x919E, +0x919C,0x934D,0x9382,0x9328,0x9375,0x934A,0x9365,0x934B, +0x9318,0x937E,0x936C,0x935B,0x9370,0x935A,0x9354,0x95CA, +0x95CB,0x95CC,0x95C8,0x95C6,0x96B1,0x96B8,0x96D6,0x971C, +0x971E,0x97A0,0x97D3,0x9846,0x98B6,0x9935,0x9A01, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x99FF,0x9BAE,0x9BAB,0x9BAA,0x9BAD,0x9D3B,0x9D3F,0x9E8B, +0x9ECF,0x9EDE,0x9EDC,0x9EDD,0x9EDB,0x9F3E,0x9F4B,0x53E2, +0x5695,0x56AE,0x58D9,0x58D8,0x5B38,0x5F5D,0x61E3,0x6233, +0x64F4,0x64F2,0x64FE,0x6506,0x64FA,0x64FB,0x64F7,0x65B7, +0x66DC,0x6726,0x6AB3,0x6AAC,0x6AC3,0x6ABB,0x6AB8,0x6AC2, +0x6AAE,0x6AAF,0x6B5F,0x6B78,0x6BAF,0x7009,0x700B,0x6FFE, +0x7006,0x6FFA,0x7011,0x700F,0x71FB,0x71FC,0x71FE,0x71F8, +0x7377,0x7375,0x74A7,0x74BF,0x7515,0x7656,0x7658, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7652,0x77BD,0x77BF,0x77BB,0x77BC,0x790E,0x79AE, +0x7A61,0x7A62,0x7A60,0x7AC4,0x7AC5,0x7C2B,0x7C27,0x7C2A, +0x7C1E,0x7C23,0x7C21,0x7CE7,0x7E54,0x7E55,0x7E5E,0x7E5A, +0x7E61,0x7E52,0x7E59,0x7F48,0x7FF9,0x7FFB,0x8077,0x8076, +0x81CD,0x81CF,0x820A,0x85CF,0x85A9,0x85CD,0x85D0,0x85C9, +0x85B0,0x85BA,0x85B9,0x85A6,0x87EF,0x87EC,0x87F2,0x87E0, +0x8986,0x89B2,0x89F4,0x8B28,0x8B39,0x8B2C,0x8B2B,0x8C50, +0x8D05,0x8E59,0x8E63,0x8E66,0x8E64,0x8E5F,0x8E55,0x8EC0, +0x8F49,0x8F4D,0x9087,0x9083,0x9088,0x91AB,0x91AC,0x91D0, +0x9394,0x938A,0x9396,0x93A2,0x93B3,0x93AE,0x93AC,0x93B0, +0x9398,0x939A,0x9397,0x95D4,0x95D6,0x95D0,0x95D5,0x96E2, +0x96DC,0x96D9,0x96DB,0x96DE,0x9724,0x97A3,0x97A6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x97AD,0x97F9,0x984D,0x984F,0x984C,0x984E,0x9853,0x98BA, +0x993E,0x993F,0x993D,0x992E,0x99A5,0x9A0E,0x9AC1,0x9B03, +0x9B06,0x9B4F,0x9B4E,0x9B4D,0x9BCA,0x9BC9,0x9BFD,0x9BC8, +0x9BC0,0x9D51,0x9D5D,0x9D60,0x9EE0,0x9F15,0x9F2C,0x5133, +0x56A5,0x58DE,0x58DF,0x58E2,0x5BF5,0x9F90,0x5EEC,0x61F2, +0x61F7,0x61F6,0x61F5,0x6500,0x650F,0x66E0,0x66DD,0x6AE5, +0x6ADD,0x6ADA,0x6AD3,0x701B,0x701F,0x7028,0x701A,0x701D, +0x7015,0x7018,0x7206,0x720D,0x7258,0x72A2,0x7378, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x737A,0x74BD,0x74CA,0x74E3,0x7587,0x7586,0x765F, +0x7661,0x77C7,0x7919,0x79B1,0x7A6B,0x7A69,0x7C3E,0x7C3F, +0x7C38,0x7C3D,0x7C37,0x7C40,0x7E6B,0x7E6D,0x7E79,0x7E69, +0x7E6A,0x7F85,0x7E73,0x7FB6,0x7FB9,0x7FB8,0x81D8,0x85E9, +0x85DD,0x85EA,0x85D5,0x85E4,0x85E5,0x85F7,0x87FB,0x8805, +0x880D,0x87F9,0x87FE,0x8960,0x895F,0x8956,0x895E,0x8B41, +0x8B5C,0x8B58,0x8B49,0x8B5A,0x8B4E,0x8B4F,0x8B46,0x8B59, +0x8D08,0x8D0A,0x8E7C,0x8E72,0x8E87,0x8E76,0x8E6C,0x8E7A, +0x8E74,0x8F54,0x8F4E,0x8FAD,0x908A,0x908B,0x91B1,0x91AE, +0x93E1,0x93D1,0x93DF,0x93C3,0x93C8,0x93DC,0x93DD,0x93D6, +0x93E2,0x93CD,0x93D8,0x93E4,0x93D7,0x93E8,0x95DC,0x96B4, +0x96E3,0x972A,0x9727,0x9761,0x97DC,0x97FB,0x985E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9858,0x985B,0x98BC,0x9945,0x9949,0x9A16,0x9A19,0x9B0D, +0x9BE8,0x9BE7,0x9BD6,0x9BDB,0x9D89,0x9D61,0x9D72,0x9D6A, +0x9D6C,0x9E92,0x9E97,0x9E93,0x9EB4,0x52F8,0x56A8,0x56B7, +0x56B6,0x56B4,0x56BC,0x58E4,0x5B40,0x5B43,0x5B7D,0x5BF6, +0x5DC9,0x61F8,0x61FA,0x6518,0x6514,0x6519,0x66E6,0x6727, +0x6AEC,0x703E,0x7030,0x7032,0x7210,0x737B,0x74CF,0x7662, +0x7665,0x7926,0x792A,0x792C,0x792B,0x7AC7,0x7AF6,0x7C4C, +0x7C43,0x7C4D,0x7CEF,0x7CF0,0x8FAE,0x7E7D,0x7E7C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7E82,0x7F4C,0x8000,0x81DA,0x8266,0x85FB,0x85F9, +0x8611,0x85FA,0x8606,0x860B,0x8607,0x860A,0x8814,0x8815, +0x8964,0x89BA,0x89F8,0x8B70,0x8B6C,0x8B66,0x8B6F,0x8B5F, +0x8B6B,0x8D0F,0x8D0D,0x8E89,0x8E81,0x8E85,0x8E82,0x91B4, +0x91CB,0x9418,0x9403,0x93FD,0x95E1,0x9730,0x98C4,0x9952, +0x9951,0x99A8,0x9A2B,0x9A30,0x9A37,0x9A35,0x9C13,0x9C0D, +0x9E79,0x9EB5,0x9EE8,0x9F2F,0x9F5F,0x9F63,0x9F61,0x5137, +0x5138,0x56C1,0x56C0,0x56C2,0x5914,0x5C6C,0x5DCD,0x61FC, +0x61FE,0x651D,0x651C,0x6595,0x66E9,0x6AFB,0x6B04,0x6AFA, +0x6BB2,0x704C,0x721B,0x72A7,0x74D6,0x74D4,0x7669,0x77D3, +0x7C50,0x7E8F,0x7E8C,0x7FBC,0x8617,0x862D,0x861A,0x8823, +0x8822,0x8821,0x881F,0x896A,0x896C,0x89BD,0x8B74, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B77,0x8B7D,0x8D13,0x8E8A,0x8E8D,0x8E8B,0x8F5F,0x8FAF, +0x91BA,0x942E,0x9433,0x9435,0x943A,0x9438,0x9432,0x942B, +0x95E2,0x9738,0x9739,0x9732,0x97FF,0x9867,0x9865,0x9957, +0x9A45,0x9A43,0x9A40,0x9A3E,0x9ACF,0x9B54,0x9B51,0x9C2D, +0x9C25,0x9DAF,0x9DB4,0x9DC2,0x9DB8,0x9E9D,0x9EEF,0x9F19, +0x9F5C,0x9F66,0x9F67,0x513C,0x513B,0x56C8,0x56CA,0x56C9, +0x5B7F,0x5DD4,0x5DD2,0x5F4E,0x61FF,0x6524,0x6B0A,0x6B61, +0x7051,0x7058,0x7380,0x74E4,0x758A,0x766E,0x766C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x79B3,0x7C60,0x7C5F,0x807E,0x807D,0x81DF,0x8972, +0x896F,0x89FC,0x8B80,0x8D16,0x8D17,0x8E91,0x8E93,0x8F61, +0x9148,0x9444,0x9451,0x9452,0x973D,0x973E,0x97C3,0x97C1, +0x986B,0x9955,0x9A55,0x9A4D,0x9AD2,0x9B1A,0x9C49,0x9C31, +0x9C3E,0x9C3B,0x9DD3,0x9DD7,0x9F34,0x9F6C,0x9F6A,0x9F94, +0x56CC,0x5DD6,0x6200,0x6523,0x652B,0x652A,0x66EC,0x6B10, +0x74DA,0x7ACA,0x7C64,0x7C63,0x7C65,0x7E93,0x7E96,0x7E94, +0x81E2,0x8638,0x863F,0x8831,0x8B8A,0x9090,0x908F,0x9463, +0x9460,0x9464,0x9768,0x986F,0x995C,0x9A5A,0x9A5B,0x9A57, +0x9AD3,0x9AD4,0x9AD1,0x9C54,0x9C57,0x9C56,0x9DE5,0x9E9F, +0x9EF4,0x56D1,0x58E9,0x652C,0x705E,0x7671,0x7672,0x77D7, +0x7F50,0x7F88,0x8836,0x8839,0x8862,0x8B93,0x8B92, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B96,0x8277,0x8D1B,0x91C0,0x946A,0x9742,0x9748,0x9744, +0x97C6,0x9870,0x9A5F,0x9B22,0x9B58,0x9C5F,0x9DF9,0x9DFA, +0x9E7C,0x9E7D,0x9F07,0x9F77,0x9F72,0x5EF3,0x6B16,0x7063, +0x7C6C,0x7C6E,0x883B,0x89C0,0x8EA1,0x91C1,0x9472,0x9470, +0x9871,0x995E,0x9AD6,0x9B23,0x9ECC,0x7064,0x77DA,0x8B9A, +0x9477,0x97C9,0x9A62,0x9A65,0x7E9C,0x8B9C,0x8EAA,0x91C5, +0x947D,0x947E,0x947C,0x9C77,0x9C78,0x9EF7,0x8C54,0x947F, +0x9E1A,0x7228,0x9A6A,0x9B31,0x9E1B,0x9E1E,0x7C72, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x30FE,0x309D,0x309E,0x3005,0x3041,0x3042,0x3043, +0x3044,0x3045,0x3046,0x3047,0x3048,0x3049,0x304A,0x304B, +0x304C,0x304D,0x304E,0x304F,0x3050,0x3051,0x3052,0x3053, +0x3054,0x3055,0x3056,0x3057,0x3058,0x3059,0x305A,0x305B, +0x305C,0x305D,0x305E,0x305F,0x3060,0x3061,0x3062,0x3063, +0x3064,0x3065,0x3066,0x3067,0x3068,0x3069,0x306A,0x306B, +0x306C,0x306D,0x306E,0x306F,0x3070,0x3071,0x3072,0x3073, +0x3074,0x3075,0x3076,0x3077,0x3078,0x3079,0x307A,0x307B, +0x307C,0x307D,0x307E,0x307F,0x3080,0x3081,0x3082,0x3083, +0x3084,0x3085,0x3086,0x3087,0x3088,0x3089,0x308A,0x308B, +0x308C,0x308D,0x308E,0x308F,0x3090,0x3091,0x3092,0x3093, +0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x30A8,0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF, +0x30B0,0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7, +0x30B8,0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF, +0x30C0,0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7, +0x30C8,0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF, +0x30D0,0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7, +0x30D8,0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF, +0x30E0,0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x30E7,0x30E8,0x30E9,0x30EA,0x30EB,0x30EC,0x30ED, +0x30EE,0x30EF,0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5, +0x30F6,0x0414,0x0415,0x0401,0x0416,0x0417,0x0418,0x0419, +0x041A,0x041B,0x041C,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, +0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446, +0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E, +0x044F,0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466, +0x2467,0x2468,0x2469,0x2474,0x2475,0x2476,0x2477,0x2478, +0x2479,0x247A,0x247B,0x247C,0x247D}; + +/* page 1 0xC940-0xF9DC */ +static uint16 tab_big5_uni1[]={ +0x4E42,0x4E5C,0x51F5,0x531A,0x5382,0x4E07,0x4E0C,0x4E47, +0x4E8D,0x56D7,0xFA0C,0x5C6E,0x5F73,0x4E0F,0x5187,0x4E0E, +0x4E2E,0x4E93,0x4EC2,0x4EC9,0x4EC8,0x5198,0x52FC,0x536C, +0x53B9,0x5720,0x5903,0x592C,0x5C10,0x5DFF,0x65E1,0x6BB3, +0x6BCC,0x6C14,0x723F,0x4E31,0x4E3C,0x4EE8,0x4EDC,0x4EE9, +0x4EE1,0x4EDD,0x4EDA,0x520C,0x531C,0x534C,0x5722,0x5723, +0x5917,0x592F,0x5B81,0x5B84,0x5C12,0x5C3B,0x5C74,0x5C73, +0x5E04,0x5E80,0x5E82,0x5FC9,0x6209,0x6250,0x6C15, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6C36,0x6C43,0x6C3F,0x6C3B,0x72AE,0x72B0,0x738A, +0x79B8,0x808A,0x961E,0x4F0E,0x4F18,0x4F2C,0x4EF5,0x4F14, +0x4EF1,0x4F00,0x4EF7,0x4F08,0x4F1D,0x4F02,0x4F05,0x4F22, +0x4F13,0x4F04,0x4EF4,0x4F12,0x51B1,0x5213,0x5209,0x5210, +0x52A6,0x5322,0x531F,0x534D,0x538A,0x5407,0x56E1,0x56DF, +0x572E,0x572A,0x5734,0x593C,0x5980,0x597C,0x5985,0x597B, +0x597E,0x5977,0x597F,0x5B56,0x5C15,0x5C25,0x5C7C,0x5C7A, +0x5C7B,0x5C7E,0x5DDF,0x5E75,0x5E84,0x5F02,0x5F1A,0x5F74, +0x5FD5,0x5FD4,0x5FCF,0x625C,0x625E,0x6264,0x6261,0x6266, +0x6262,0x6259,0x6260,0x625A,0x6265,0x65EF,0x65EE,0x673E, +0x6739,0x6738,0x673B,0x673A,0x673F,0x673C,0x6733,0x6C18, +0x6C46,0x6C52,0x6C5C,0x6C4F,0x6C4A,0x6C54,0x6C4B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C4C,0x7071,0x725E,0x72B4,0x72B5,0x738E,0x752A,0x767F, +0x7A75,0x7F51,0x8278,0x827C,0x8280,0x827D,0x827F,0x864D, +0x897E,0x9099,0x9097,0x9098,0x909B,0x9094,0x9622,0x9624, +0x9620,0x9623,0x4F56,0x4F3B,0x4F62,0x4F49,0x4F53,0x4F64, +0x4F3E,0x4F67,0x4F52,0x4F5F,0x4F41,0x4F58,0x4F2D,0x4F33, +0x4F3F,0x4F61,0x518F,0x51B9,0x521C,0x521E,0x5221,0x52AD, +0x52AE,0x5309,0x5363,0x5372,0x538E,0x538F,0x5430,0x5437, +0x542A,0x5454,0x5445,0x5419,0x541C,0x5425,0x5418, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x543D,0x544F,0x5441,0x5428,0x5424,0x5447,0x56EE, +0x56E7,0x56E5,0x5741,0x5745,0x574C,0x5749,0x574B,0x5752, +0x5906,0x5940,0x59A6,0x5998,0x59A0,0x5997,0x598E,0x59A2, +0x5990,0x598F,0x59A7,0x59A1,0x5B8E,0x5B92,0x5C28,0x5C2A, +0x5C8D,0x5C8F,0x5C88,0x5C8B,0x5C89,0x5C92,0x5C8A,0x5C86, +0x5C93,0x5C95,0x5DE0,0x5E0A,0x5E0E,0x5E8B,0x5E89,0x5E8C, +0x5E88,0x5E8D,0x5F05,0x5F1D,0x5F78,0x5F76,0x5FD2,0x5FD1, +0x5FD0,0x5FED,0x5FE8,0x5FEE,0x5FF3,0x5FE1,0x5FE4,0x5FE3, +0x5FFA,0x5FEF,0x5FF7,0x5FFB,0x6000,0x5FF4,0x623A,0x6283, +0x628C,0x628E,0x628F,0x6294,0x6287,0x6271,0x627B,0x627A, +0x6270,0x6281,0x6288,0x6277,0x627D,0x6272,0x6274,0x6537, +0x65F0,0x65F4,0x65F3,0x65F2,0x65F5,0x6745,0x6747, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6759,0x6755,0x674C,0x6748,0x675D,0x674D,0x675A,0x674B, +0x6BD0,0x6C19,0x6C1A,0x6C78,0x6C67,0x6C6B,0x6C84,0x6C8B, +0x6C8F,0x6C71,0x6C6F,0x6C69,0x6C9A,0x6C6D,0x6C87,0x6C95, +0x6C9C,0x6C66,0x6C73,0x6C65,0x6C7B,0x6C8E,0x7074,0x707A, +0x7263,0x72BF,0x72BD,0x72C3,0x72C6,0x72C1,0x72BA,0x72C5, +0x7395,0x7397,0x7393,0x7394,0x7392,0x753A,0x7539,0x7594, +0x7595,0x7681,0x793D,0x8034,0x8095,0x8099,0x8090,0x8092, +0x809C,0x8290,0x828F,0x8285,0x828E,0x8291,0x8293, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x828A,0x8283,0x8284,0x8C78,0x8FC9,0x8FBF,0x909F, +0x90A1,0x90A5,0x909E,0x90A7,0x90A0,0x9630,0x9628,0x962F, +0x962D,0x4E33,0x4F98,0x4F7C,0x4F85,0x4F7D,0x4F80,0x4F87, +0x4F76,0x4F74,0x4F89,0x4F84,0x4F77,0x4F4C,0x4F97,0x4F6A, +0x4F9A,0x4F79,0x4F81,0x4F78,0x4F90,0x4F9C,0x4F94,0x4F9E, +0x4F92,0x4F82,0x4F95,0x4F6B,0x4F6E,0x519E,0x51BC,0x51BE, +0x5235,0x5232,0x5233,0x5246,0x5231,0x52BC,0x530A,0x530B, +0x533C,0x5392,0x5394,0x5487,0x547F,0x5481,0x5491,0x5482, +0x5488,0x546B,0x547A,0x547E,0x5465,0x546C,0x5474,0x5466, +0x548D,0x546F,0x5461,0x5460,0x5498,0x5463,0x5467,0x5464, +0x56F7,0x56F9,0x576F,0x5772,0x576D,0x576B,0x5771,0x5770, +0x5776,0x5780,0x5775,0x577B,0x5773,0x5774,0x5762, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5768,0x577D,0x590C,0x5945,0x59B5,0x59BA,0x59CF,0x59CE, +0x59B2,0x59CC,0x59C1,0x59B6,0x59BC,0x59C3,0x59D6,0x59B1, +0x59BD,0x59C0,0x59C8,0x59B4,0x59C7,0x5B62,0x5B65,0x5B93, +0x5B95,0x5C44,0x5C47,0x5CAE,0x5CA4,0x5CA0,0x5CB5,0x5CAF, +0x5CA8,0x5CAC,0x5C9F,0x5CA3,0x5CAD,0x5CA2,0x5CAA,0x5CA7, +0x5C9D,0x5CA5,0x5CB6,0x5CB0,0x5CA6,0x5E17,0x5E14,0x5E19, +0x5F28,0x5F22,0x5F23,0x5F24,0x5F54,0x5F82,0x5F7E,0x5F7D, +0x5FDE,0x5FE5,0x602D,0x6026,0x6019,0x6032,0x600B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6034,0x600A,0x6017,0x6033,0x601A,0x601E,0x602C, +0x6022,0x600D,0x6010,0x602E,0x6013,0x6011,0x600C,0x6009, +0x601C,0x6214,0x623D,0x62AD,0x62B4,0x62D1,0x62BE,0x62AA, +0x62B6,0x62CA,0x62AE,0x62B3,0x62AF,0x62BB,0x62A9,0x62B0, +0x62B8,0x653D,0x65A8,0x65BB,0x6609,0x65FC,0x6604,0x6612, +0x6608,0x65FB,0x6603,0x660B,0x660D,0x6605,0x65FD,0x6611, +0x6610,0x66F6,0x670A,0x6785,0x676C,0x678E,0x6792,0x6776, +0x677B,0x6798,0x6786,0x6784,0x6774,0x678D,0x678C,0x677A, +0x679F,0x6791,0x6799,0x6783,0x677D,0x6781,0x6778,0x6779, +0x6794,0x6B25,0x6B80,0x6B7E,0x6BDE,0x6C1D,0x6C93,0x6CEC, +0x6CEB,0x6CEE,0x6CD9,0x6CB6,0x6CD4,0x6CAD,0x6CE7,0x6CB7, +0x6CD0,0x6CC2,0x6CBA,0x6CC3,0x6CC6,0x6CED,0x6CF2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6CD2,0x6CDD,0x6CB4,0x6C8A,0x6C9D,0x6C80,0x6CDE,0x6CC0, +0x6D30,0x6CCD,0x6CC7,0x6CB0,0x6CF9,0x6CCF,0x6CE9,0x6CD1, +0x7094,0x7098,0x7085,0x7093,0x7086,0x7084,0x7091,0x7096, +0x7082,0x709A,0x7083,0x726A,0x72D6,0x72CB,0x72D8,0x72C9, +0x72DC,0x72D2,0x72D4,0x72DA,0x72CC,0x72D1,0x73A4,0x73A1, +0x73AD,0x73A6,0x73A2,0x73A0,0x73AC,0x739D,0x74DD,0x74E8, +0x753F,0x7540,0x753E,0x758C,0x7598,0x76AF,0x76F3,0x76F1, +0x76F0,0x76F5,0x77F8,0x77FC,0x77F9,0x77FB,0x77FA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x77F7,0x7942,0x793F,0x79C5,0x7A78,0x7A7B,0x7AFB, +0x7C75,0x7CFD,0x8035,0x808F,0x80AE,0x80A3,0x80B8,0x80B5, +0x80AD,0x8220,0x82A0,0x82C0,0x82AB,0x829A,0x8298,0x829B, +0x82B5,0x82A7,0x82AE,0x82BC,0x829E,0x82BA,0x82B4,0x82A8, +0x82A1,0x82A9,0x82C2,0x82A4,0x82C3,0x82B6,0x82A2,0x8670, +0x866F,0x866D,0x866E,0x8C56,0x8FD2,0x8FCB,0x8FD3,0x8FCD, +0x8FD6,0x8FD5,0x8FD7,0x90B2,0x90B4,0x90AF,0x90B3,0x90B0, +0x9639,0x963D,0x963C,0x963A,0x9643,0x4FCD,0x4FC5,0x4FD3, +0x4FB2,0x4FC9,0x4FCB,0x4FC1,0x4FD4,0x4FDC,0x4FD9,0x4FBB, +0x4FB3,0x4FDB,0x4FC7,0x4FD6,0x4FBA,0x4FC0,0x4FB9,0x4FEC, +0x5244,0x5249,0x52C0,0x52C2,0x533D,0x537C,0x5397,0x5396, +0x5399,0x5398,0x54BA,0x54A1,0x54AD,0x54A5,0x54CF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x54C3,0x830D,0x54B7,0x54AE,0x54D6,0x54B6,0x54C5,0x54C6, +0x54A0,0x5470,0x54BC,0x54A2,0x54BE,0x5472,0x54DE,0x54B0, +0x57B5,0x579E,0x579F,0x57A4,0x578C,0x5797,0x579D,0x579B, +0x5794,0x5798,0x578F,0x5799,0x57A5,0x579A,0x5795,0x58F4, +0x590D,0x5953,0x59E1,0x59DE,0x59EE,0x5A00,0x59F1,0x59DD, +0x59FA,0x59FD,0x59FC,0x59F6,0x59E4,0x59F2,0x59F7,0x59DB, +0x59E9,0x59F3,0x59F5,0x59E0,0x59FE,0x59F4,0x59ED,0x5BA8, +0x5C4C,0x5CD0,0x5CD8,0x5CCC,0x5CD7,0x5CCB,0x5CDB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5CDE,0x5CDA,0x5CC9,0x5CC7,0x5CCA,0x5CD6,0x5CD3, +0x5CD4,0x5CCF,0x5CC8,0x5CC6,0x5CCE,0x5CDF,0x5CF8,0x5DF9, +0x5E21,0x5E22,0x5E23,0x5E20,0x5E24,0x5EB0,0x5EA4,0x5EA2, +0x5E9B,0x5EA3,0x5EA5,0x5F07,0x5F2E,0x5F56,0x5F86,0x6037, +0x6039,0x6054,0x6072,0x605E,0x6045,0x6053,0x6047,0x6049, +0x605B,0x604C,0x6040,0x6042,0x605F,0x6024,0x6044,0x6058, +0x6066,0x606E,0x6242,0x6243,0x62CF,0x630D,0x630B,0x62F5, +0x630E,0x6303,0x62EB,0x62F9,0x630F,0x630C,0x62F8,0x62F6, +0x6300,0x6313,0x6314,0x62FA,0x6315,0x62FB,0x62F0,0x6541, +0x6543,0x65AA,0x65BF,0x6636,0x6621,0x6632,0x6635,0x661C, +0x6626,0x6622,0x6633,0x662B,0x663A,0x661D,0x6634,0x6639, +0x662E,0x670F,0x6710,0x67C1,0x67F2,0x67C8,0x67BA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x67DC,0x67BB,0x67F8,0x67D8,0x67C0,0x67B7,0x67C5,0x67EB, +0x67E4,0x67DF,0x67B5,0x67CD,0x67B3,0x67F7,0x67F6,0x67EE, +0x67E3,0x67C2,0x67B9,0x67CE,0x67E7,0x67F0,0x67B2,0x67FC, +0x67C6,0x67ED,0x67CC,0x67AE,0x67E6,0x67DB,0x67FA,0x67C9, +0x67CA,0x67C3,0x67EA,0x67CB,0x6B28,0x6B82,0x6B84,0x6BB6, +0x6BD6,0x6BD8,0x6BE0,0x6C20,0x6C21,0x6D28,0x6D34,0x6D2D, +0x6D1F,0x6D3C,0x6D3F,0x6D12,0x6D0A,0x6CDA,0x6D33,0x6D04, +0x6D19,0x6D3A,0x6D1A,0x6D11,0x6D00,0x6D1D,0x6D42, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6D01,0x6D18,0x6D37,0x6D03,0x6D0F,0x6D40,0x6D07, +0x6D20,0x6D2C,0x6D08,0x6D22,0x6D09,0x6D10,0x70B7,0x709F, +0x70BE,0x70B1,0x70B0,0x70A1,0x70B4,0x70B5,0x70A9,0x7241, +0x7249,0x724A,0x726C,0x7270,0x7273,0x726E,0x72CA,0x72E4, +0x72E8,0x72EB,0x72DF,0x72EA,0x72E6,0x72E3,0x7385,0x73CC, +0x73C2,0x73C8,0x73C5,0x73B9,0x73B6,0x73B5,0x73B4,0x73EB, +0x73BF,0x73C7,0x73BE,0x73C3,0x73C6,0x73B8,0x73CB,0x74EC, +0x74EE,0x752E,0x7547,0x7548,0x75A7,0x75AA,0x7679,0x76C4, +0x7708,0x7703,0x7704,0x7705,0x770A,0x76F7,0x76FB,0x76FA, +0x77E7,0x77E8,0x7806,0x7811,0x7812,0x7805,0x7810,0x780F, +0x780E,0x7809,0x7803,0x7813,0x794A,0x794C,0x794B,0x7945, +0x7944,0x79D5,0x79CD,0x79CF,0x79D6,0x79CE,0x7A80, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7A7E,0x7AD1,0x7B00,0x7B01,0x7C7A,0x7C78,0x7C79,0x7C7F, +0x7C80,0x7C81,0x7D03,0x7D08,0x7D01,0x7F58,0x7F91,0x7F8D, +0x7FBE,0x8007,0x800E,0x800F,0x8014,0x8037,0x80D8,0x80C7, +0x80E0,0x80D1,0x80C8,0x80C2,0x80D0,0x80C5,0x80E3,0x80D9, +0x80DC,0x80CA,0x80D5,0x80C9,0x80CF,0x80D7,0x80E6,0x80CD, +0x81FF,0x8221,0x8294,0x82D9,0x82FE,0x82F9,0x8307,0x82E8, +0x8300,0x82D5,0x833A,0x82EB,0x82D6,0x82F4,0x82EC,0x82E1, +0x82F2,0x82F5,0x830C,0x82FB,0x82F6,0x82F0,0x82EA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x82E4,0x82E0,0x82FA,0x82F3,0x82ED,0x8677,0x8674, +0x867C,0x8673,0x8841,0x884E,0x8867,0x886A,0x8869,0x89D3, +0x8A04,0x8A07,0x8D72,0x8FE3,0x8FE1,0x8FEE,0x8FE0,0x90F1, +0x90BD,0x90BF,0x90D5,0x90C5,0x90BE,0x90C7,0x90CB,0x90C8, +0x91D4,0x91D3,0x9654,0x964F,0x9651,0x9653,0x964A,0x964E, +0x501E,0x5005,0x5007,0x5013,0x5022,0x5030,0x501B,0x4FF5, +0x4FF4,0x5033,0x5037,0x502C,0x4FF6,0x4FF7,0x5017,0x501C, +0x5020,0x5027,0x5035,0x502F,0x5031,0x500E,0x515A,0x5194, +0x5193,0x51CA,0x51C4,0x51C5,0x51C8,0x51CE,0x5261,0x525A, +0x5252,0x525E,0x525F,0x5255,0x5262,0x52CD,0x530E,0x539E, +0x5526,0x54E2,0x5517,0x5512,0x54E7,0x54F3,0x54E4,0x551A, +0x54FF,0x5504,0x5508,0x54EB,0x5511,0x5505,0x54F1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x550A,0x54FB,0x54F7,0x54F8,0x54E0,0x550E,0x5503,0x550B, +0x5701,0x5702,0x57CC,0x5832,0x57D5,0x57D2,0x57BA,0x57C6, +0x57BD,0x57BC,0x57B8,0x57B6,0x57BF,0x57C7,0x57D0,0x57B9, +0x57C1,0x590E,0x594A,0x5A19,0x5A16,0x5A2D,0x5A2E,0x5A15, +0x5A0F,0x5A17,0x5A0A,0x5A1E,0x5A33,0x5B6C,0x5BA7,0x5BAD, +0x5BAC,0x5C03,0x5C56,0x5C54,0x5CEC,0x5CFF,0x5CEE,0x5CF1, +0x5CF7,0x5D00,0x5CF9,0x5E29,0x5E28,0x5EA8,0x5EAE,0x5EAA, +0x5EAC,0x5F33,0x5F30,0x5F67,0x605D,0x605A,0x6067, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6041,0x60A2,0x6088,0x6080,0x6092,0x6081,0x609D, +0x6083,0x6095,0x609B,0x6097,0x6087,0x609C,0x608E,0x6219, +0x6246,0x62F2,0x6310,0x6356,0x632C,0x6344,0x6345,0x6336, +0x6343,0x63E4,0x6339,0x634B,0x634A,0x633C,0x6329,0x6341, +0x6334,0x6358,0x6354,0x6359,0x632D,0x6347,0x6333,0x635A, +0x6351,0x6338,0x6357,0x6340,0x6348,0x654A,0x6546,0x65C6, +0x65C3,0x65C4,0x65C2,0x664A,0x665F,0x6647,0x6651,0x6712, +0x6713,0x681F,0x681A,0x6849,0x6832,0x6833,0x683B,0x684B, +0x684F,0x6816,0x6831,0x681C,0x6835,0x682B,0x682D,0x682F, +0x684E,0x6844,0x6834,0x681D,0x6812,0x6814,0x6826,0x6828, +0x682E,0x684D,0x683A,0x6825,0x6820,0x6B2C,0x6B2F,0x6B2D, +0x6B31,0x6B34,0x6B6D,0x8082,0x6B88,0x6BE6,0x6BE4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6BE8,0x6BE3,0x6BE2,0x6BE7,0x6C25,0x6D7A,0x6D63,0x6D64, +0x6D76,0x6D0D,0x6D61,0x6D92,0x6D58,0x6D62,0x6D6D,0x6D6F, +0x6D91,0x6D8D,0x6DEF,0x6D7F,0x6D86,0x6D5E,0x6D67,0x6D60, +0x6D97,0x6D70,0x6D7C,0x6D5F,0x6D82,0x6D98,0x6D2F,0x6D68, +0x6D8B,0x6D7E,0x6D80,0x6D84,0x6D16,0x6D83,0x6D7B,0x6D7D, +0x6D75,0x6D90,0x70DC,0x70D3,0x70D1,0x70DD,0x70CB,0x7F39, +0x70E2,0x70D7,0x70D2,0x70DE,0x70E0,0x70D4,0x70CD,0x70C5, +0x70C6,0x70C7,0x70DA,0x70CE,0x70E1,0x7242,0x7278, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7277,0x7276,0x7300,0x72FA,0x72F4,0x72FE,0x72F6, +0x72F3,0x72FB,0x7301,0x73D3,0x73D9,0x73E5,0x73D6,0x73BC, +0x73E7,0x73E3,0x73E9,0x73DC,0x73D2,0x73DB,0x73D4,0x73DD, +0x73DA,0x73D7,0x73D8,0x73E8,0x74DE,0x74DF,0x74F4,0x74F5, +0x7521,0x755B,0x755F,0x75B0,0x75C1,0x75BB,0x75C4,0x75C0, +0x75BF,0x75B6,0x75BA,0x768A,0x76C9,0x771D,0x771B,0x7710, +0x7713,0x7712,0x7723,0x7711,0x7715,0x7719,0x771A,0x7722, +0x7727,0x7823,0x782C,0x7822,0x7835,0x782F,0x7828,0x782E, +0x782B,0x7821,0x7829,0x7833,0x782A,0x7831,0x7954,0x795B, +0x794F,0x795C,0x7953,0x7952,0x7951,0x79EB,0x79EC,0x79E0, +0x79EE,0x79ED,0x79EA,0x79DC,0x79DE,0x79DD,0x7A86,0x7A89, +0x7A85,0x7A8B,0x7A8C,0x7A8A,0x7A87,0x7AD8,0x7B10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7B04,0x7B13,0x7B05,0x7B0F,0x7B08,0x7B0A,0x7B0E,0x7B09, +0x7B12,0x7C84,0x7C91,0x7C8A,0x7C8C,0x7C88,0x7C8D,0x7C85, +0x7D1E,0x7D1D,0x7D11,0x7D0E,0x7D18,0x7D16,0x7D13,0x7D1F, +0x7D12,0x7D0F,0x7D0C,0x7F5C,0x7F61,0x7F5E,0x7F60,0x7F5D, +0x7F5B,0x7F96,0x7F92,0x7FC3,0x7FC2,0x7FC0,0x8016,0x803E, +0x8039,0x80FA,0x80F2,0x80F9,0x80F5,0x8101,0x80FB,0x8100, +0x8201,0x822F,0x8225,0x8333,0x832D,0x8344,0x8319,0x8351, +0x8325,0x8356,0x833F,0x8341,0x8326,0x831C,0x8322, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8342,0x834E,0x831B,0x832A,0x8308,0x833C,0x834D, +0x8316,0x8324,0x8320,0x8337,0x832F,0x8329,0x8347,0x8345, +0x834C,0x8353,0x831E,0x832C,0x834B,0x8327,0x8348,0x8653, +0x8652,0x86A2,0x86A8,0x8696,0x868D,0x8691,0x869E,0x8687, +0x8697,0x8686,0x868B,0x869A,0x8685,0x86A5,0x8699,0x86A1, +0x86A7,0x8695,0x8698,0x868E,0x869D,0x8690,0x8694,0x8843, +0x8844,0x886D,0x8875,0x8876,0x8872,0x8880,0x8871,0x887F, +0x886F,0x8883,0x887E,0x8874,0x887C,0x8A12,0x8C47,0x8C57, +0x8C7B,0x8CA4,0x8CA3,0x8D76,0x8D78,0x8DB5,0x8DB7,0x8DB6, +0x8ED1,0x8ED3,0x8FFE,0x8FF5,0x9002,0x8FFF,0x8FFB,0x9004, +0x8FFC,0x8FF6,0x90D6,0x90E0,0x90D9,0x90DA,0x90E3,0x90DF, +0x90E5,0x90D8,0x90DB,0x90D7,0x90DC,0x90E4,0x9150, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x914E,0x914F,0x91D5,0x91E2,0x91DA,0x965C,0x965F,0x96BC, +0x98E3,0x9ADF,0x9B2F,0x4E7F,0x5070,0x506A,0x5061,0x505E, +0x5060,0x5053,0x504B,0x505D,0x5072,0x5048,0x504D,0x5041, +0x505B,0x504A,0x5062,0x5015,0x5045,0x505F,0x5069,0x506B, +0x5063,0x5064,0x5046,0x5040,0x506E,0x5073,0x5057,0x5051, +0x51D0,0x526B,0x526D,0x526C,0x526E,0x52D6,0x52D3,0x532D, +0x539C,0x5575,0x5576,0x553C,0x554D,0x5550,0x5534,0x552A, +0x5551,0x5562,0x5536,0x5535,0x5530,0x5552,0x5545, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x550C,0x5532,0x5565,0x554E,0x5539,0x5548,0x552D, +0x553B,0x5540,0x554B,0x570A,0x5707,0x57FB,0x5814,0x57E2, +0x57F6,0x57DC,0x57F4,0x5800,0x57ED,0x57FD,0x5808,0x57F8, +0x580B,0x57F3,0x57CF,0x5807,0x57EE,0x57E3,0x57F2,0x57E5, +0x57EC,0x57E1,0x580E,0x57FC,0x5810,0x57E7,0x5801,0x580C, +0x57F1,0x57E9,0x57F0,0x580D,0x5804,0x595C,0x5A60,0x5A58, +0x5A55,0x5A67,0x5A5E,0x5A38,0x5A35,0x5A6D,0x5A50,0x5A5F, +0x5A65,0x5A6C,0x5A53,0x5A64,0x5A57,0x5A43,0x5A5D,0x5A52, +0x5A44,0x5A5B,0x5A48,0x5A8E,0x5A3E,0x5A4D,0x5A39,0x5A4C, +0x5A70,0x5A69,0x5A47,0x5A51,0x5A56,0x5A42,0x5A5C,0x5B72, +0x5B6E,0x5BC1,0x5BC0,0x5C59,0x5D1E,0x5D0B,0x5D1D,0x5D1A, +0x5D20,0x5D0C,0x5D28,0x5D0D,0x5D26,0x5D25,0x5D0F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5D30,0x5D12,0x5D23,0x5D1F,0x5D2E,0x5E3E,0x5E34,0x5EB1, +0x5EB4,0x5EB9,0x5EB2,0x5EB3,0x5F36,0x5F38,0x5F9B,0x5F96, +0x5F9F,0x608A,0x6090,0x6086,0x60BE,0x60B0,0x60BA,0x60D3, +0x60D4,0x60CF,0x60E4,0x60D9,0x60DD,0x60C8,0x60B1,0x60DB, +0x60B7,0x60CA,0x60BF,0x60C3,0x60CD,0x60C0,0x6332,0x6365, +0x638A,0x6382,0x637D,0x63BD,0x639E,0x63AD,0x639D,0x6397, +0x63AB,0x638E,0x636F,0x6387,0x6390,0x636E,0x63AF,0x6375, +0x639C,0x636D,0x63AE,0x637C,0x63A4,0x633B,0x639F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6378,0x6385,0x6381,0x6391,0x638D,0x6370,0x6553, +0x65CD,0x6665,0x6661,0x665B,0x6659,0x665C,0x6662,0x6718, +0x6879,0x6887,0x6890,0x689C,0x686D,0x686E,0x68AE,0x68AB, +0x6956,0x686F,0x68A3,0x68AC,0x68A9,0x6875,0x6874,0x68B2, +0x688F,0x6877,0x6892,0x687C,0x686B,0x6872,0x68AA,0x6880, +0x6871,0x687E,0x689B,0x6896,0x688B,0x68A0,0x6889,0x68A4, +0x6878,0x687B,0x6891,0x688C,0x688A,0x687D,0x6B36,0x6B33, +0x6B37,0x6B38,0x6B91,0x6B8F,0x6B8D,0x6B8E,0x6B8C,0x6C2A, +0x6DC0,0x6DAB,0x6DB4,0x6DB3,0x6E74,0x6DAC,0x6DE9,0x6DE2, +0x6DB7,0x6DF6,0x6DD4,0x6E00,0x6DC8,0x6DE0,0x6DDF,0x6DD6, +0x6DBE,0x6DE5,0x6DDC,0x6DDD,0x6DDB,0x6DF4,0x6DCA,0x6DBD, +0x6DED,0x6DF0,0x6DBA,0x6DD5,0x6DC2,0x6DCF,0x6DC9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6DD0,0x6DF2,0x6DD3,0x6DFD,0x6DD7,0x6DCD,0x6DE3,0x6DBB, +0x70FA,0x710D,0x70F7,0x7117,0x70F4,0x710C,0x70F0,0x7104, +0x70F3,0x7110,0x70FC,0x70FF,0x7106,0x7113,0x7100,0x70F8, +0x70F6,0x710B,0x7102,0x710E,0x727E,0x727B,0x727C,0x727F, +0x731D,0x7317,0x7307,0x7311,0x7318,0x730A,0x7308,0x72FF, +0x730F,0x731E,0x7388,0x73F6,0x73F8,0x73F5,0x7404,0x7401, +0x73FD,0x7407,0x7400,0x73FA,0x73FC,0x73FF,0x740C,0x740B, +0x73F4,0x7408,0x7564,0x7563,0x75CE,0x75D2,0x75CF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x75CB,0x75CC,0x75D1,0x75D0,0x768F,0x7689,0x76D3, +0x7739,0x772F,0x772D,0x7731,0x7732,0x7734,0x7733,0x773D, +0x7725,0x773B,0x7735,0x7848,0x7852,0x7849,0x784D,0x784A, +0x784C,0x7826,0x7845,0x7850,0x7964,0x7967,0x7969,0x796A, +0x7963,0x796B,0x7961,0x79BB,0x79FA,0x79F8,0x79F6,0x79F7, +0x7A8F,0x7A94,0x7A90,0x7B35,0x7B47,0x7B34,0x7B25,0x7B30, +0x7B22,0x7B24,0x7B33,0x7B18,0x7B2A,0x7B1D,0x7B31,0x7B2B, +0x7B2D,0x7B2F,0x7B32,0x7B38,0x7B1A,0x7B23,0x7C94,0x7C98, +0x7C96,0x7CA3,0x7D35,0x7D3D,0x7D38,0x7D36,0x7D3A,0x7D45, +0x7D2C,0x7D29,0x7D41,0x7D47,0x7D3E,0x7D3F,0x7D4A,0x7D3B, +0x7D28,0x7F63,0x7F95,0x7F9C,0x7F9D,0x7F9B,0x7FCA,0x7FCB, +0x7FCD,0x7FD0,0x7FD1,0x7FC7,0x7FCF,0x7FC9,0x801F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x801E,0x801B,0x8047,0x8043,0x8048,0x8118,0x8125,0x8119, +0x811B,0x812D,0x811F,0x812C,0x811E,0x8121,0x8115,0x8127, +0x811D,0x8122,0x8211,0x8238,0x8233,0x823A,0x8234,0x8232, +0x8274,0x8390,0x83A3,0x83A8,0x838D,0x837A,0x8373,0x83A4, +0x8374,0x838F,0x8381,0x8395,0x8399,0x8375,0x8394,0x83A9, +0x837D,0x8383,0x838C,0x839D,0x839B,0x83AA,0x838B,0x837E, +0x83A5,0x83AF,0x8388,0x8397,0x83B0,0x837F,0x83A6,0x8387, +0x83AE,0x8376,0x839A,0x8659,0x8656,0x86BF,0x86B7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x86C2,0x86C1,0x86C5,0x86BA,0x86B0,0x86C8,0x86B9, +0x86B3,0x86B8,0x86CC,0x86B4,0x86BB,0x86BC,0x86C3,0x86BD, +0x86BE,0x8852,0x8889,0x8895,0x88A8,0x88A2,0x88AA,0x889A, +0x8891,0x88A1,0x889F,0x8898,0x88A7,0x8899,0x889B,0x8897, +0x88A4,0x88AC,0x888C,0x8893,0x888E,0x8982,0x89D6,0x89D9, +0x89D5,0x8A30,0x8A27,0x8A2C,0x8A1E,0x8C39,0x8C3B,0x8C5C, +0x8C5D,0x8C7D,0x8CA5,0x8D7D,0x8D7B,0x8D79,0x8DBC,0x8DC2, +0x8DB9,0x8DBF,0x8DC1,0x8ED8,0x8EDE,0x8EDD,0x8EDC,0x8ED7, +0x8EE0,0x8EE1,0x9024,0x900B,0x9011,0x901C,0x900C,0x9021, +0x90EF,0x90EA,0x90F0,0x90F4,0x90F2,0x90F3,0x90D4,0x90EB, +0x90EC,0x90E9,0x9156,0x9158,0x915A,0x9153,0x9155,0x91EC, +0x91F4,0x91F1,0x91F3,0x91F8,0x91E4,0x91F9,0x91EA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x91EB,0x91F7,0x91E8,0x91EE,0x957A,0x9586,0x9588,0x967C, +0x966D,0x966B,0x9671,0x966F,0x96BF,0x976A,0x9804,0x98E5, +0x9997,0x509B,0x5095,0x5094,0x509E,0x508B,0x50A3,0x5083, +0x508C,0x508E,0x509D,0x5068,0x509C,0x5092,0x5082,0x5087, +0x515F,0x51D4,0x5312,0x5311,0x53A4,0x53A7,0x5591,0x55A8, +0x55A5,0x55AD,0x5577,0x5645,0x55A2,0x5593,0x5588,0x558F, +0x55B5,0x5581,0x55A3,0x5592,0x55A4,0x557D,0x558C,0x55A6, +0x557F,0x5595,0x55A1,0x558E,0x570C,0x5829,0x5837, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5819,0x581E,0x5827,0x5823,0x5828,0x57F5,0x5848, +0x5825,0x581C,0x581B,0x5833,0x583F,0x5836,0x582E,0x5839, +0x5838,0x582D,0x582C,0x583B,0x5961,0x5AAF,0x5A94,0x5A9F, +0x5A7A,0x5AA2,0x5A9E,0x5A78,0x5AA6,0x5A7C,0x5AA5,0x5AAC, +0x5A95,0x5AAE,0x5A37,0x5A84,0x5A8A,0x5A97,0x5A83,0x5A8B, +0x5AA9,0x5A7B,0x5A7D,0x5A8C,0x5A9C,0x5A8F,0x5A93,0x5A9D, +0x5BEA,0x5BCD,0x5BCB,0x5BD4,0x5BD1,0x5BCA,0x5BCE,0x5C0C, +0x5C30,0x5D37,0x5D43,0x5D6B,0x5D41,0x5D4B,0x5D3F,0x5D35, +0x5D51,0x5D4E,0x5D55,0x5D33,0x5D3A,0x5D52,0x5D3D,0x5D31, +0x5D59,0x5D42,0x5D39,0x5D49,0x5D38,0x5D3C,0x5D32,0x5D36, +0x5D40,0x5D45,0x5E44,0x5E41,0x5F58,0x5FA6,0x5FA5,0x5FAB, +0x60C9,0x60B9,0x60CC,0x60E2,0x60CE,0x60C4,0x6114, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x60F2,0x610A,0x6116,0x6105,0x60F5,0x6113,0x60F8,0x60FC, +0x60FE,0x60C1,0x6103,0x6118,0x611D,0x6110,0x60FF,0x6104, +0x610B,0x624A,0x6394,0x63B1,0x63B0,0x63CE,0x63E5,0x63E8, +0x63EF,0x63C3,0x649D,0x63F3,0x63CA,0x63E0,0x63F6,0x63D5, +0x63F2,0x63F5,0x6461,0x63DF,0x63BE,0x63DD,0x63DC,0x63C4, +0x63D8,0x63D3,0x63C2,0x63C7,0x63CC,0x63CB,0x63C8,0x63F0, +0x63D7,0x63D9,0x6532,0x6567,0x656A,0x6564,0x655C,0x6568, +0x6565,0x658C,0x659D,0x659E,0x65AE,0x65D0,0x65D2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x667C,0x666C,0x667B,0x6680,0x6671,0x6679,0x666A, +0x6672,0x6701,0x690C,0x68D3,0x6904,0x68DC,0x692A,0x68EC, +0x68EA,0x68F1,0x690F,0x68D6,0x68F7,0x68EB,0x68E4,0x68F6, +0x6913,0x6910,0x68F3,0x68E1,0x6907,0x68CC,0x6908,0x6970, +0x68B4,0x6911,0x68EF,0x68C6,0x6914,0x68F8,0x68D0,0x68FD, +0x68FC,0x68E8,0x690B,0x690A,0x6917,0x68CE,0x68C8,0x68DD, +0x68DE,0x68E6,0x68F4,0x68D1,0x6906,0x68D4,0x68E9,0x6915, +0x6925,0x68C7,0x6B39,0x6B3B,0x6B3F,0x6B3C,0x6B94,0x6B97, +0x6B99,0x6B95,0x6BBD,0x6BF0,0x6BF2,0x6BF3,0x6C30,0x6DFC, +0x6E46,0x6E47,0x6E1F,0x6E49,0x6E88,0x6E3C,0x6E3D,0x6E45, +0x6E62,0x6E2B,0x6E3F,0x6E41,0x6E5D,0x6E73,0x6E1C,0x6E33, +0x6E4B,0x6E40,0x6E51,0x6E3B,0x6E03,0x6E2E,0x6E5E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6E68,0x6E5C,0x6E61,0x6E31,0x6E28,0x6E60,0x6E71,0x6E6B, +0x6E39,0x6E22,0x6E30,0x6E53,0x6E65,0x6E27,0x6E78,0x6E64, +0x6E77,0x6E55,0x6E79,0x6E52,0x6E66,0x6E35,0x6E36,0x6E5A, +0x7120,0x711E,0x712F,0x70FB,0x712E,0x7131,0x7123,0x7125, +0x7122,0x7132,0x711F,0x7128,0x713A,0x711B,0x724B,0x725A, +0x7288,0x7289,0x7286,0x7285,0x728B,0x7312,0x730B,0x7330, +0x7322,0x7331,0x7333,0x7327,0x7332,0x732D,0x7326,0x7323, +0x7335,0x730C,0x742E,0x742C,0x7430,0x742B,0x7416, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x741A,0x7421,0x742D,0x7431,0x7424,0x7423,0x741D, +0x7429,0x7420,0x7432,0x74FB,0x752F,0x756F,0x756C,0x75E7, +0x75DA,0x75E1,0x75E6,0x75DD,0x75DF,0x75E4,0x75D7,0x7695, +0x7692,0x76DA,0x7746,0x7747,0x7744,0x774D,0x7745,0x774A, +0x774E,0x774B,0x774C,0x77DE,0x77EC,0x7860,0x7864,0x7865, +0x785C,0x786D,0x7871,0x786A,0x786E,0x7870,0x7869,0x7868, +0x785E,0x7862,0x7974,0x7973,0x7972,0x7970,0x7A02,0x7A0A, +0x7A03,0x7A0C,0x7A04,0x7A99,0x7AE6,0x7AE4,0x7B4A,0x7B3B, +0x7B44,0x7B48,0x7B4C,0x7B4E,0x7B40,0x7B58,0x7B45,0x7CA2, +0x7C9E,0x7CA8,0x7CA1,0x7D58,0x7D6F,0x7D63,0x7D53,0x7D56, +0x7D67,0x7D6A,0x7D4F,0x7D6D,0x7D5C,0x7D6B,0x7D52,0x7D54, +0x7D69,0x7D51,0x7D5F,0x7D4E,0x7F3E,0x7F3F,0x7F65, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7F66,0x7FA2,0x7FA0,0x7FA1,0x7FD7,0x8051,0x804F,0x8050, +0x80FE,0x80D4,0x8143,0x814A,0x8152,0x814F,0x8147,0x813D, +0x814D,0x813A,0x81E6,0x81EE,0x81F7,0x81F8,0x81F9,0x8204, +0x823C,0x823D,0x823F,0x8275,0x833B,0x83CF,0x83F9,0x8423, +0x83C0,0x83E8,0x8412,0x83E7,0x83E4,0x83FC,0x83F6,0x8410, +0x83C6,0x83C8,0x83EB,0x83E3,0x83BF,0x8401,0x83DD,0x83E5, +0x83D8,0x83FF,0x83E1,0x83CB,0x83CE,0x83D6,0x83F5,0x83C9, +0x8409,0x840F,0x83DE,0x8411,0x8406,0x83C2,0x83F3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x83D5,0x83FA,0x83C7,0x83D1,0x83EA,0x8413,0x83C3, +0x83EC,0x83EE,0x83C4,0x83FB,0x83D7,0x83E2,0x841B,0x83DB, +0x83FE,0x86D8,0x86E2,0x86E6,0x86D3,0x86E3,0x86DA,0x86EA, +0x86DD,0x86EB,0x86DC,0x86EC,0x86E9,0x86D7,0x86E8,0x86D1, +0x8848,0x8856,0x8855,0x88BA,0x88D7,0x88B9,0x88B8,0x88C0, +0x88BE,0x88B6,0x88BC,0x88B7,0x88BD,0x88B2,0x8901,0x88C9, +0x8995,0x8998,0x8997,0x89DD,0x89DA,0x89DB,0x8A4E,0x8A4D, +0x8A39,0x8A59,0x8A40,0x8A57,0x8A58,0x8A44,0x8A45,0x8A52, +0x8A48,0x8A51,0x8A4A,0x8A4C,0x8A4F,0x8C5F,0x8C81,0x8C80, +0x8CBA,0x8CBE,0x8CB0,0x8CB9,0x8CB5,0x8D84,0x8D80,0x8D89, +0x8DD8,0x8DD3,0x8DCD,0x8DC7,0x8DD6,0x8DDC,0x8DCF,0x8DD5, +0x8DD9,0x8DC8,0x8DD7,0x8DC5,0x8EEF,0x8EF7,0x8EFA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8EF9,0x8EE6,0x8EEE,0x8EE5,0x8EF5,0x8EE7,0x8EE8,0x8EF6, +0x8EEB,0x8EF1,0x8EEC,0x8EF4,0x8EE9,0x902D,0x9034,0x902F, +0x9106,0x912C,0x9104,0x90FF,0x90FC,0x9108,0x90F9,0x90FB, +0x9101,0x9100,0x9107,0x9105,0x9103,0x9161,0x9164,0x915F, +0x9162,0x9160,0x9201,0x920A,0x9225,0x9203,0x921A,0x9226, +0x920F,0x920C,0x9200,0x9212,0x91FF,0x91FD,0x9206,0x9204, +0x9227,0x9202,0x921C,0x9224,0x9219,0x9217,0x9205,0x9216, +0x957B,0x958D,0x958C,0x9590,0x9687,0x967E,0x9688, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9689,0x9683,0x9680,0x96C2,0x96C8,0x96C3,0x96F1, +0x96F0,0x976C,0x9770,0x976E,0x9807,0x98A9,0x98EB,0x9CE6, +0x9EF9,0x4E83,0x4E84,0x4EB6,0x50BD,0x50BF,0x50C6,0x50AE, +0x50C4,0x50CA,0x50B4,0x50C8,0x50C2,0x50B0,0x50C1,0x50BA, +0x50B1,0x50CB,0x50C9,0x50B6,0x50B8,0x51D7,0x527A,0x5278, +0x527B,0x527C,0x55C3,0x55DB,0x55CC,0x55D0,0x55CB,0x55CA, +0x55DD,0x55C0,0x55D4,0x55C4,0x55E9,0x55BF,0x55D2,0x558D, +0x55CF,0x55D5,0x55E2,0x55D6,0x55C8,0x55F2,0x55CD,0x55D9, +0x55C2,0x5714,0x5853,0x5868,0x5864,0x584F,0x584D,0x5849, +0x586F,0x5855,0x584E,0x585D,0x5859,0x5865,0x585B,0x583D, +0x5863,0x5871,0x58FC,0x5AC7,0x5AC4,0x5ACB,0x5ABA,0x5AB8, +0x5AB1,0x5AB5,0x5AB0,0x5ABF,0x5AC8,0x5ABB,0x5AC6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5AB7,0x5AC0,0x5ACA,0x5AB4,0x5AB6,0x5ACD,0x5AB9,0x5A90, +0x5BD6,0x5BD8,0x5BD9,0x5C1F,0x5C33,0x5D71,0x5D63,0x5D4A, +0x5D65,0x5D72,0x5D6C,0x5D5E,0x5D68,0x5D67,0x5D62,0x5DF0, +0x5E4F,0x5E4E,0x5E4A,0x5E4D,0x5E4B,0x5EC5,0x5ECC,0x5EC6, +0x5ECB,0x5EC7,0x5F40,0x5FAF,0x5FAD,0x60F7,0x6149,0x614A, +0x612B,0x6145,0x6136,0x6132,0x612E,0x6146,0x612F,0x614F, +0x6129,0x6140,0x6220,0x9168,0x6223,0x6225,0x6224,0x63C5, +0x63F1,0x63EB,0x6410,0x6412,0x6409,0x6420,0x6424, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6433,0x6443,0x641F,0x6415,0x6418,0x6439,0x6437, +0x6422,0x6423,0x640C,0x6426,0x6430,0x6428,0x6441,0x6435, +0x642F,0x640A,0x641A,0x6440,0x6425,0x6427,0x640B,0x63E7, +0x641B,0x642E,0x6421,0x640E,0x656F,0x6592,0x65D3,0x6686, +0x668C,0x6695,0x6690,0x668B,0x668A,0x6699,0x6694,0x6678, +0x6720,0x6966,0x695F,0x6938,0x694E,0x6962,0x6971,0x693F, +0x6945,0x696A,0x6939,0x6942,0x6957,0x6959,0x697A,0x6948, +0x6949,0x6935,0x696C,0x6933,0x693D,0x6965,0x68F0,0x6978, +0x6934,0x6969,0x6940,0x696F,0x6944,0x6976,0x6958,0x6941, +0x6974,0x694C,0x693B,0x694B,0x6937,0x695C,0x694F,0x6951, +0x6932,0x6952,0x692F,0x697B,0x693C,0x6B46,0x6B45,0x6B43, +0x6B42,0x6B48,0x6B41,0x6B9B,0xFA0D,0x6BFB,0x6BFC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6BF9,0x6BF7,0x6BF8,0x6E9B,0x6ED6,0x6EC8,0x6E8F,0x6EC0, +0x6E9F,0x6E93,0x6E94,0x6EA0,0x6EB1,0x6EB9,0x6EC6,0x6ED2, +0x6EBD,0x6EC1,0x6E9E,0x6EC9,0x6EB7,0x6EB0,0x6ECD,0x6EA6, +0x6ECF,0x6EB2,0x6EBE,0x6EC3,0x6EDC,0x6ED8,0x6E99,0x6E92, +0x6E8E,0x6E8D,0x6EA4,0x6EA1,0x6EBF,0x6EB3,0x6ED0,0x6ECA, +0x6E97,0x6EAE,0x6EA3,0x7147,0x7154,0x7152,0x7163,0x7160, +0x7141,0x715D,0x7162,0x7172,0x7178,0x716A,0x7161,0x7142, +0x7158,0x7143,0x714B,0x7170,0x715F,0x7150,0x7153, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7144,0x714D,0x715A,0x724F,0x728D,0x728C,0x7291, +0x7290,0x728E,0x733C,0x7342,0x733B,0x733A,0x7340,0x734A, +0x7349,0x7444,0x744A,0x744B,0x7452,0x7451,0x7457,0x7440, +0x744F,0x7450,0x744E,0x7442,0x7446,0x744D,0x7454,0x74E1, +0x74FF,0x74FE,0x74FD,0x751D,0x7579,0x7577,0x6983,0x75EF, +0x760F,0x7603,0x75F7,0x75FE,0x75FC,0x75F9,0x75F8,0x7610, +0x75FB,0x75F6,0x75ED,0x75F5,0x75FD,0x7699,0x76B5,0x76DD, +0x7755,0x775F,0x7760,0x7752,0x7756,0x775A,0x7769,0x7767, +0x7754,0x7759,0x776D,0x77E0,0x7887,0x789A,0x7894,0x788F, +0x7884,0x7895,0x7885,0x7886,0x78A1,0x7883,0x7879,0x7899, +0x7880,0x7896,0x787B,0x797C,0x7982,0x797D,0x7979,0x7A11, +0x7A18,0x7A19,0x7A12,0x7A17,0x7A15,0x7A22,0x7A13, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7A1B,0x7A10,0x7AA3,0x7AA2,0x7A9E,0x7AEB,0x7B66,0x7B64, +0x7B6D,0x7B74,0x7B69,0x7B72,0x7B65,0x7B73,0x7B71,0x7B70, +0x7B61,0x7B78,0x7B76,0x7B63,0x7CB2,0x7CB4,0x7CAF,0x7D88, +0x7D86,0x7D80,0x7D8D,0x7D7F,0x7D85,0x7D7A,0x7D8E,0x7D7B, +0x7D83,0x7D7C,0x7D8C,0x7D94,0x7D84,0x7D7D,0x7D92,0x7F6D, +0x7F6B,0x7F67,0x7F68,0x7F6C,0x7FA6,0x7FA5,0x7FA7,0x7FDB, +0x7FDC,0x8021,0x8164,0x8160,0x8177,0x815C,0x8169,0x815B, +0x8162,0x8172,0x6721,0x815E,0x8176,0x8167,0x816F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8144,0x8161,0x821D,0x8249,0x8244,0x8240,0x8242, +0x8245,0x84F1,0x843F,0x8456,0x8476,0x8479,0x848F,0x848D, +0x8465,0x8451,0x8440,0x8486,0x8467,0x8430,0x844D,0x847D, +0x845A,0x8459,0x8474,0x8473,0x845D,0x8507,0x845E,0x8437, +0x843A,0x8434,0x847A,0x8443,0x8478,0x8432,0x8445,0x8429, +0x83D9,0x844B,0x842F,0x8442,0x842D,0x845F,0x8470,0x8439, +0x844E,0x844C,0x8452,0x846F,0x84C5,0x848E,0x843B,0x8447, +0x8436,0x8433,0x8468,0x847E,0x8444,0x842B,0x8460,0x8454, +0x846E,0x8450,0x870B,0x8704,0x86F7,0x870C,0x86FA,0x86D6, +0x86F5,0x874D,0x86F8,0x870E,0x8709,0x8701,0x86F6,0x870D, +0x8705,0x88D6,0x88CB,0x88CD,0x88CE,0x88DE,0x88DB,0x88DA, +0x88CC,0x88D0,0x8985,0x899B,0x89DF,0x89E5,0x89E4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x89E1,0x89E0,0x89E2,0x89DC,0x89E6,0x8A76,0x8A86,0x8A7F, +0x8A61,0x8A3F,0x8A77,0x8A82,0x8A84,0x8A75,0x8A83,0x8A81, +0x8A74,0x8A7A,0x8C3C,0x8C4B,0x8C4A,0x8C65,0x8C64,0x8C66, +0x8C86,0x8C84,0x8C85,0x8CCC,0x8D68,0x8D69,0x8D91,0x8D8C, +0x8D8E,0x8D8F,0x8D8D,0x8D93,0x8D94,0x8D90,0x8D92,0x8DF0, +0x8DE0,0x8DEC,0x8DF1,0x8DEE,0x8DD0,0x8DE9,0x8DE3,0x8DE2, +0x8DE7,0x8DF2,0x8DEB,0x8DF4,0x8F06,0x8EFF,0x8F01,0x8F00, +0x8F05,0x8F07,0x8F08,0x8F02,0x8F0B,0x9052,0x903F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9044,0x9049,0x903D,0x9110,0x910D,0x910F,0x9111, +0x9116,0x9114,0x910B,0x910E,0x916E,0x916F,0x9248,0x9252, +0x9230,0x923A,0x9266,0x9233,0x9265,0x925E,0x9283,0x922E, +0x924A,0x9246,0x926D,0x926C,0x924F,0x9260,0x9267,0x926F, +0x9236,0x9261,0x9270,0x9231,0x9254,0x9263,0x9250,0x9272, +0x924E,0x9253,0x924C,0x9256,0x9232,0x959F,0x959C,0x959E, +0x959B,0x9692,0x9693,0x9691,0x9697,0x96CE,0x96FA,0x96FD, +0x96F8,0x96F5,0x9773,0x9777,0x9778,0x9772,0x980F,0x980D, +0x980E,0x98AC,0x98F6,0x98F9,0x99AF,0x99B2,0x99B0,0x99B5, +0x9AAD,0x9AAB,0x9B5B,0x9CEA,0x9CED,0x9CE7,0x9E80,0x9EFD, +0x50E6,0x50D4,0x50D7,0x50E8,0x50F3,0x50DB,0x50EA,0x50DD, +0x50E4,0x50D3,0x50EC,0x50F0,0x50EF,0x50E3,0x50E0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x51D8,0x5280,0x5281,0x52E9,0x52EB,0x5330,0x53AC,0x5627, +0x5615,0x560C,0x5612,0x55FC,0x560F,0x561C,0x5601,0x5613, +0x5602,0x55FA,0x561D,0x5604,0x55FF,0x55F9,0x5889,0x587C, +0x5890,0x5898,0x5886,0x5881,0x587F,0x5874,0x588B,0x587A, +0x5887,0x5891,0x588E,0x5876,0x5882,0x5888,0x587B,0x5894, +0x588F,0x58FE,0x596B,0x5ADC,0x5AEE,0x5AE5,0x5AD5,0x5AEA, +0x5ADA,0x5AED,0x5AEB,0x5AF3,0x5AE2,0x5AE0,0x5ADB,0x5AEC, +0x5ADE,0x5ADD,0x5AD9,0x5AE8,0x5ADF,0x5B77,0x5BE0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5BE3,0x5C63,0x5D82,0x5D80,0x5D7D,0x5D86,0x5D7A, +0x5D81,0x5D77,0x5D8A,0x5D89,0x5D88,0x5D7E,0x5D7C,0x5D8D, +0x5D79,0x5D7F,0x5E58,0x5E59,0x5E53,0x5ED8,0x5ED1,0x5ED7, +0x5ECE,0x5EDC,0x5ED5,0x5ED9,0x5ED2,0x5ED4,0x5F44,0x5F43, +0x5F6F,0x5FB6,0x612C,0x6128,0x6141,0x615E,0x6171,0x6173, +0x6152,0x6153,0x6172,0x616C,0x6180,0x6174,0x6154,0x617A, +0x615B,0x6165,0x613B,0x616A,0x6161,0x6156,0x6229,0x6227, +0x622B,0x642B,0x644D,0x645B,0x645D,0x6474,0x6476,0x6472, +0x6473,0x647D,0x6475,0x6466,0x64A6,0x644E,0x6482,0x645E, +0x645C,0x644B,0x6453,0x6460,0x6450,0x647F,0x643F,0x646C, +0x646B,0x6459,0x6465,0x6477,0x6573,0x65A0,0x66A1,0x66A0, +0x669F,0x6705,0x6704,0x6722,0x69B1,0x69B6,0x69C9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x69A0,0x69CE,0x6996,0x69B0,0x69AC,0x69BC,0x6991,0x6999, +0x698E,0x69A7,0x698D,0x69A9,0x69BE,0x69AF,0x69BF,0x69C4, +0x69BD,0x69A4,0x69D4,0x69B9,0x69CA,0x699A,0x69CF,0x69B3, +0x6993,0x69AA,0x69A1,0x699E,0x69D9,0x6997,0x6990,0x69C2, +0x69B5,0x69A5,0x69C6,0x6B4A,0x6B4D,0x6B4B,0x6B9E,0x6B9F, +0x6BA0,0x6BC3,0x6BC4,0x6BFE,0x6ECE,0x6EF5,0x6EF1,0x6F03, +0x6F25,0x6EF8,0x6F37,0x6EFB,0x6F2E,0x6F09,0x6F4E,0x6F19, +0x6F1A,0x6F27,0x6F18,0x6F3B,0x6F12,0x6EED,0x6F0A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6F36,0x6F73,0x6EF9,0x6EEE,0x6F2D,0x6F40,0x6F30, +0x6F3C,0x6F35,0x6EEB,0x6F07,0x6F0E,0x6F43,0x6F05,0x6EFD, +0x6EF6,0x6F39,0x6F1C,0x6EFC,0x6F3A,0x6F1F,0x6F0D,0x6F1E, +0x6F08,0x6F21,0x7187,0x7190,0x7189,0x7180,0x7185,0x7182, +0x718F,0x717B,0x7186,0x7181,0x7197,0x7244,0x7253,0x7297, +0x7295,0x7293,0x7343,0x734D,0x7351,0x734C,0x7462,0x7473, +0x7471,0x7475,0x7472,0x7467,0x746E,0x7500,0x7502,0x7503, +0x757D,0x7590,0x7616,0x7608,0x760C,0x7615,0x7611,0x760A, +0x7614,0x76B8,0x7781,0x777C,0x7785,0x7782,0x776E,0x7780, +0x776F,0x777E,0x7783,0x78B2,0x78AA,0x78B4,0x78AD,0x78A8, +0x787E,0x78AB,0x789E,0x78A5,0x78A0,0x78AC,0x78A2,0x78A4, +0x7998,0x798A,0x798B,0x7996,0x7995,0x7994,0x7993, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7997,0x7988,0x7992,0x7990,0x7A2B,0x7A4A,0x7A30,0x7A2F, +0x7A28,0x7A26,0x7AA8,0x7AAB,0x7AAC,0x7AEE,0x7B88,0x7B9C, +0x7B8A,0x7B91,0x7B90,0x7B96,0x7B8D,0x7B8C,0x7B9B,0x7B8E, +0x7B85,0x7B98,0x5284,0x7B99,0x7BA4,0x7B82,0x7CBB,0x7CBF, +0x7CBC,0x7CBA,0x7DA7,0x7DB7,0x7DC2,0x7DA3,0x7DAA,0x7DC1, +0x7DC0,0x7DC5,0x7D9D,0x7DCE,0x7DC4,0x7DC6,0x7DCB,0x7DCC, +0x7DAF,0x7DB9,0x7D96,0x7DBC,0x7D9F,0x7DA6,0x7DAE,0x7DA9, +0x7DA1,0x7DC9,0x7F73,0x7FE2,0x7FE3,0x7FE5,0x7FDE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8024,0x805D,0x805C,0x8189,0x8186,0x8183,0x8187, +0x818D,0x818C,0x818B,0x8215,0x8497,0x84A4,0x84A1,0x849F, +0x84BA,0x84CE,0x84C2,0x84AC,0x84AE,0x84AB,0x84B9,0x84B4, +0x84C1,0x84CD,0x84AA,0x849A,0x84B1,0x84D0,0x849D,0x84A7, +0x84BB,0x84A2,0x8494,0x84C7,0x84CC,0x849B,0x84A9,0x84AF, +0x84A8,0x84D6,0x8498,0x84B6,0x84CF,0x84A0,0x84D7,0x84D4, +0x84D2,0x84DB,0x84B0,0x8491,0x8661,0x8733,0x8723,0x8728, +0x876B,0x8740,0x872E,0x871E,0x8721,0x8719,0x871B,0x8743, +0x872C,0x8741,0x873E,0x8746,0x8720,0x8732,0x872A,0x872D, +0x873C,0x8712,0x873A,0x8731,0x8735,0x8742,0x8726,0x8727, +0x8738,0x8724,0x871A,0x8730,0x8711,0x88F7,0x88E7,0x88F1, +0x88F2,0x88FA,0x88FE,0x88EE,0x88FC,0x88F6,0x88FB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x88F0,0x88EC,0x88EB,0x899D,0x89A1,0x899F,0x899E,0x89E9, +0x89EB,0x89E8,0x8AAB,0x8A99,0x8A8B,0x8A92,0x8A8F,0x8A96, +0x8C3D,0x8C68,0x8C69,0x8CD5,0x8CCF,0x8CD7,0x8D96,0x8E09, +0x8E02,0x8DFF,0x8E0D,0x8DFD,0x8E0A,0x8E03,0x8E07,0x8E06, +0x8E05,0x8DFE,0x8E00,0x8E04,0x8F10,0x8F11,0x8F0E,0x8F0D, +0x9123,0x911C,0x9120,0x9122,0x911F,0x911D,0x911A,0x9124, +0x9121,0x911B,0x917A,0x9172,0x9179,0x9173,0x92A5,0x92A4, +0x9276,0x929B,0x927A,0x92A0,0x9294,0x92AA,0x928D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x92A6,0x929A,0x92AB,0x9279,0x9297,0x927F,0x92A3, +0x92EE,0x928E,0x9282,0x9295,0x92A2,0x927D,0x9288,0x92A1, +0x928A,0x9286,0x928C,0x9299,0x92A7,0x927E,0x9287,0x92A9, +0x929D,0x928B,0x922D,0x969E,0x96A1,0x96FF,0x9758,0x977D, +0x977A,0x977E,0x9783,0x9780,0x9782,0x977B,0x9784,0x9781, +0x977F,0x97CE,0x97CD,0x9816,0x98AD,0x98AE,0x9902,0x9900, +0x9907,0x999D,0x999C,0x99C3,0x99B9,0x99BB,0x99BA,0x99C2, +0x99BD,0x99C7,0x9AB1,0x9AE3,0x9AE7,0x9B3E,0x9B3F,0x9B60, +0x9B61,0x9B5F,0x9CF1,0x9CF2,0x9CF5,0x9EA7,0x50FF,0x5103, +0x5130,0x50F8,0x5106,0x5107,0x50F6,0x50FE,0x510B,0x510C, +0x50FD,0x510A,0x528B,0x528C,0x52F1,0x52EF,0x5648,0x5642, +0x564C,0x5635,0x5641,0x564A,0x5649,0x5646,0x5658, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x565A,0x5640,0x5633,0x563D,0x562C,0x563E,0x5638,0x562A, +0x563A,0x571A,0x58AB,0x589D,0x58B1,0x58A0,0x58A3,0x58AF, +0x58AC,0x58A5,0x58A1,0x58FF,0x5AFF,0x5AF4,0x5AFD,0x5AF7, +0x5AF6,0x5B03,0x5AF8,0x5B02,0x5AF9,0x5B01,0x5B07,0x5B05, +0x5B0F,0x5C67,0x5D99,0x5D97,0x5D9F,0x5D92,0x5DA2,0x5D93, +0x5D95,0x5DA0,0x5D9C,0x5DA1,0x5D9A,0x5D9E,0x5E69,0x5E5D, +0x5E60,0x5E5C,0x7DF3,0x5EDB,0x5EDE,0x5EE1,0x5F49,0x5FB2, +0x618B,0x6183,0x6179,0x61B1,0x61B0,0x61A2,0x6189, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x619B,0x6193,0x61AF,0x61AD,0x619F,0x6192,0x61AA, +0x61A1,0x618D,0x6166,0x61B3,0x622D,0x646E,0x6470,0x6496, +0x64A0,0x6485,0x6497,0x649C,0x648F,0x648B,0x648A,0x648C, +0x64A3,0x649F,0x6468,0x64B1,0x6498,0x6576,0x657A,0x6579, +0x657B,0x65B2,0x65B3,0x66B5,0x66B0,0x66A9,0x66B2,0x66B7, +0x66AA,0x66AF,0x6A00,0x6A06,0x6A17,0x69E5,0x69F8,0x6A15, +0x69F1,0x69E4,0x6A20,0x69FF,0x69EC,0x69E2,0x6A1B,0x6A1D, +0x69FE,0x6A27,0x69F2,0x69EE,0x6A14,0x69F7,0x69E7,0x6A40, +0x6A08,0x69E6,0x69FB,0x6A0D,0x69FC,0x69EB,0x6A09,0x6A04, +0x6A18,0x6A25,0x6A0F,0x69F6,0x6A26,0x6A07,0x69F4,0x6A16, +0x6B51,0x6BA5,0x6BA3,0x6BA2,0x6BA6,0x6C01,0x6C00,0x6BFF, +0x6C02,0x6F41,0x6F26,0x6F7E,0x6F87,0x6FC6,0x6F92, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6F8D,0x6F89,0x6F8C,0x6F62,0x6F4F,0x6F85,0x6F5A,0x6F96, +0x6F76,0x6F6C,0x6F82,0x6F55,0x6F72,0x6F52,0x6F50,0x6F57, +0x6F94,0x6F93,0x6F5D,0x6F00,0x6F61,0x6F6B,0x6F7D,0x6F67, +0x6F90,0x6F53,0x6F8B,0x6F69,0x6F7F,0x6F95,0x6F63,0x6F77, +0x6F6A,0x6F7B,0x71B2,0x71AF,0x719B,0x71B0,0x71A0,0x719A, +0x71A9,0x71B5,0x719D,0x71A5,0x719E,0x71A4,0x71A1,0x71AA, +0x719C,0x71A7,0x71B3,0x7298,0x729A,0x7358,0x7352,0x735E, +0x735F,0x7360,0x735D,0x735B,0x7361,0x735A,0x7359, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7362,0x7487,0x7489,0x748A,0x7486,0x7481,0x747D, +0x7485,0x7488,0x747C,0x7479,0x7508,0x7507,0x757E,0x7625, +0x761E,0x7619,0x761D,0x761C,0x7623,0x761A,0x7628,0x761B, +0x769C,0x769D,0x769E,0x769B,0x778D,0x778F,0x7789,0x7788, +0x78CD,0x78BB,0x78CF,0x78CC,0x78D1,0x78CE,0x78D4,0x78C8, +0x78C3,0x78C4,0x78C9,0x799A,0x79A1,0x79A0,0x799C,0x79A2, +0x799B,0x6B76,0x7A39,0x7AB2,0x7AB4,0x7AB3,0x7BB7,0x7BCB, +0x7BBE,0x7BAC,0x7BCE,0x7BAF,0x7BB9,0x7BCA,0x7BB5,0x7CC5, +0x7CC8,0x7CCC,0x7CCB,0x7DF7,0x7DDB,0x7DEA,0x7DE7,0x7DD7, +0x7DE1,0x7E03,0x7DFA,0x7DE6,0x7DF6,0x7DF1,0x7DF0,0x7DEE, +0x7DDF,0x7F76,0x7FAC,0x7FB0,0x7FAD,0x7FED,0x7FEB,0x7FEA, +0x7FEC,0x7FE6,0x7FE8,0x8064,0x8067,0x81A3,0x819F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x819E,0x8195,0x81A2,0x8199,0x8197,0x8216,0x824F,0x8253, +0x8252,0x8250,0x824E,0x8251,0x8524,0x853B,0x850F,0x8500, +0x8529,0x850E,0x8509,0x850D,0x851F,0x850A,0x8527,0x851C, +0x84FB,0x852B,0x84FA,0x8508,0x850C,0x84F4,0x852A,0x84F2, +0x8515,0x84F7,0x84EB,0x84F3,0x84FC,0x8512,0x84EA,0x84E9, +0x8516,0x84FE,0x8528,0x851D,0x852E,0x8502,0x84FD,0x851E, +0x84F6,0x8531,0x8526,0x84E7,0x84E8,0x84F0,0x84EF,0x84F9, +0x8518,0x8520,0x8530,0x850B,0x8519,0x852F,0x8662, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8756,0x8763,0x8764,0x8777,0x87E1,0x8773,0x8758, +0x8754,0x875B,0x8752,0x8761,0x875A,0x8751,0x875E,0x876D, +0x876A,0x8750,0x874E,0x875F,0x875D,0x876F,0x876C,0x877A, +0x876E,0x875C,0x8765,0x874F,0x877B,0x8775,0x8762,0x8767, +0x8769,0x885A,0x8905,0x890C,0x8914,0x890B,0x8917,0x8918, +0x8919,0x8906,0x8916,0x8911,0x890E,0x8909,0x89A2,0x89A4, +0x89A3,0x89ED,0x89F0,0x89EC,0x8ACF,0x8AC6,0x8AB8,0x8AD3, +0x8AD1,0x8AD4,0x8AD5,0x8ABB,0x8AD7,0x8ABE,0x8AC0,0x8AC5, +0x8AD8,0x8AC3,0x8ABA,0x8ABD,0x8AD9,0x8C3E,0x8C4D,0x8C8F, +0x8CE5,0x8CDF,0x8CD9,0x8CE8,0x8CDA,0x8CDD,0x8CE7,0x8DA0, +0x8D9C,0x8DA1,0x8D9B,0x8E20,0x8E23,0x8E25,0x8E24,0x8E2E, +0x8E15,0x8E1B,0x8E16,0x8E11,0x8E19,0x8E26,0x8E27, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E14,0x8E12,0x8E18,0x8E13,0x8E1C,0x8E17,0x8E1A,0x8F2C, +0x8F24,0x8F18,0x8F1A,0x8F20,0x8F23,0x8F16,0x8F17,0x9073, +0x9070,0x906F,0x9067,0x906B,0x912F,0x912B,0x9129,0x912A, +0x9132,0x9126,0x912E,0x9185,0x9186,0x918A,0x9181,0x9182, +0x9184,0x9180,0x92D0,0x92C3,0x92C4,0x92C0,0x92D9,0x92B6, +0x92CF,0x92F1,0x92DF,0x92D8,0x92E9,0x92D7,0x92DD,0x92CC, +0x92EF,0x92C2,0x92E8,0x92CA,0x92C8,0x92CE,0x92E6,0x92CD, +0x92D5,0x92C9,0x92E0,0x92DE,0x92E7,0x92D1,0x92D3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x92B5,0x92E1,0x92C6,0x92B4,0x957C,0x95AC,0x95AB, +0x95AE,0x95B0,0x96A4,0x96A2,0x96D3,0x9705,0x9708,0x9702, +0x975A,0x978A,0x978E,0x9788,0x97D0,0x97CF,0x981E,0x981D, +0x9826,0x9829,0x9828,0x9820,0x981B,0x9827,0x98B2,0x9908, +0x98FA,0x9911,0x9914,0x9916,0x9917,0x9915,0x99DC,0x99CD, +0x99CF,0x99D3,0x99D4,0x99CE,0x99C9,0x99D6,0x99D8,0x99CB, +0x99D7,0x99CC,0x9AB3,0x9AEC,0x9AEB,0x9AF3,0x9AF2,0x9AF1, +0x9B46,0x9B43,0x9B67,0x9B74,0x9B71,0x9B66,0x9B76,0x9B75, +0x9B70,0x9B68,0x9B64,0x9B6C,0x9CFC,0x9CFA,0x9CFD,0x9CFF, +0x9CF7,0x9D07,0x9D00,0x9CF9,0x9CFB,0x9D08,0x9D05,0x9D04, +0x9E83,0x9ED3,0x9F0F,0x9F10,0x511C,0x5113,0x5117,0x511A, +0x5111,0x51DE,0x5334,0x53E1,0x5670,0x5660,0x566E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5673,0x5666,0x5663,0x566D,0x5672,0x565E,0x5677,0x571C, +0x571B,0x58C8,0x58BD,0x58C9,0x58BF,0x58BA,0x58C2,0x58BC, +0x58C6,0x5B17,0x5B19,0x5B1B,0x5B21,0x5B14,0x5B13,0x5B10, +0x5B16,0x5B28,0x5B1A,0x5B20,0x5B1E,0x5BEF,0x5DAC,0x5DB1, +0x5DA9,0x5DA7,0x5DB5,0x5DB0,0x5DAE,0x5DAA,0x5DA8,0x5DB2, +0x5DAD,0x5DAF,0x5DB4,0x5E67,0x5E68,0x5E66,0x5E6F,0x5EE9, +0x5EE7,0x5EE6,0x5EE8,0x5EE5,0x5F4B,0x5FBC,0x619D,0x61A8, +0x6196,0x61C5,0x61B4,0x61C6,0x61C1,0x61CC,0x61BA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x61BF,0x61B8,0x618C,0x64D7,0x64D6,0x64D0,0x64CF, +0x64C9,0x64BD,0x6489,0x64C3,0x64DB,0x64F3,0x64D9,0x6533, +0x657F,0x657C,0x65A2,0x66C8,0x66BE,0x66C0,0x66CA,0x66CB, +0x66CF,0x66BD,0x66BB,0x66BA,0x66CC,0x6723,0x6A34,0x6A66, +0x6A49,0x6A67,0x6A32,0x6A68,0x6A3E,0x6A5D,0x6A6D,0x6A76, +0x6A5B,0x6A51,0x6A28,0x6A5A,0x6A3B,0x6A3F,0x6A41,0x6A6A, +0x6A64,0x6A50,0x6A4F,0x6A54,0x6A6F,0x6A69,0x6A60,0x6A3C, +0x6A5E,0x6A56,0x6A55,0x6A4D,0x6A4E,0x6A46,0x6B55,0x6B54, +0x6B56,0x6BA7,0x6BAA,0x6BAB,0x6BC8,0x6BC7,0x6C04,0x6C03, +0x6C06,0x6FAD,0x6FCB,0x6FA3,0x6FC7,0x6FBC,0x6FCE,0x6FC8, +0x6F5E,0x6FC4,0x6FBD,0x6F9E,0x6FCA,0x6FA8,0x7004,0x6FA5, +0x6FAE,0x6FBA,0x6FAC,0x6FAA,0x6FCF,0x6FBF,0x6FB8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6FA2,0x6FC9,0x6FAB,0x6FCD,0x6FAF,0x6FB2,0x6FB0,0x71C5, +0x71C2,0x71BF,0x71B8,0x71D6,0x71C0,0x71C1,0x71CB,0x71D4, +0x71CA,0x71C7,0x71CF,0x71BD,0x71D8,0x71BC,0x71C6,0x71DA, +0x71DB,0x729D,0x729E,0x7369,0x7366,0x7367,0x736C,0x7365, +0x736B,0x736A,0x747F,0x749A,0x74A0,0x7494,0x7492,0x7495, +0x74A1,0x750B,0x7580,0x762F,0x762D,0x7631,0x763D,0x7633, +0x763C,0x7635,0x7632,0x7630,0x76BB,0x76E6,0x779A,0x779D, +0x77A1,0x779C,0x779B,0x77A2,0x77A3,0x7795,0x7799, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7797,0x78DD,0x78E9,0x78E5,0x78EA,0x78DE,0x78E3, +0x78DB,0x78E1,0x78E2,0x78ED,0x78DF,0x78E0,0x79A4,0x7A44, +0x7A48,0x7A47,0x7AB6,0x7AB8,0x7AB5,0x7AB1,0x7AB7,0x7BDE, +0x7BE3,0x7BE7,0x7BDD,0x7BD5,0x7BE5,0x7BDA,0x7BE8,0x7BF9, +0x7BD4,0x7BEA,0x7BE2,0x7BDC,0x7BEB,0x7BD8,0x7BDF,0x7CD2, +0x7CD4,0x7CD7,0x7CD0,0x7CD1,0x7E12,0x7E21,0x7E17,0x7E0C, +0x7E1F,0x7E20,0x7E13,0x7E0E,0x7E1C,0x7E15,0x7E1A,0x7E22, +0x7E0B,0x7E0F,0x7E16,0x7E0D,0x7E14,0x7E25,0x7E24,0x7F43, +0x7F7B,0x7F7C,0x7F7A,0x7FB1,0x7FEF,0x802A,0x8029,0x806C, +0x81B1,0x81A6,0x81AE,0x81B9,0x81B5,0x81AB,0x81B0,0x81AC, +0x81B4,0x81B2,0x81B7,0x81A7,0x81F2,0x8255,0x8256,0x8257, +0x8556,0x8545,0x856B,0x854D,0x8553,0x8561,0x8558, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8540,0x8546,0x8564,0x8541,0x8562,0x8544,0x8551,0x8547, +0x8563,0x853E,0x855B,0x8571,0x854E,0x856E,0x8575,0x8555, +0x8567,0x8560,0x858C,0x8566,0x855D,0x8554,0x8565,0x856C, +0x8663,0x8665,0x8664,0x879B,0x878F,0x8797,0x8793,0x8792, +0x8788,0x8781,0x8796,0x8798,0x8779,0x8787,0x87A3,0x8785, +0x8790,0x8791,0x879D,0x8784,0x8794,0x879C,0x879A,0x8789, +0x891E,0x8926,0x8930,0x892D,0x892E,0x8927,0x8931,0x8922, +0x8929,0x8923,0x892F,0x892C,0x891F,0x89F1,0x8AE0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AE2,0x8AF2,0x8AF4,0x8AF5,0x8ADD,0x8B14,0x8AE4, +0x8ADF,0x8AF0,0x8AC8,0x8ADE,0x8AE1,0x8AE8,0x8AFF,0x8AEF, +0x8AFB,0x8C91,0x8C92,0x8C90,0x8CF5,0x8CEE,0x8CF1,0x8CF0, +0x8CF3,0x8D6C,0x8D6E,0x8DA5,0x8DA7,0x8E33,0x8E3E,0x8E38, +0x8E40,0x8E45,0x8E36,0x8E3C,0x8E3D,0x8E41,0x8E30,0x8E3F, +0x8EBD,0x8F36,0x8F2E,0x8F35,0x8F32,0x8F39,0x8F37,0x8F34, +0x9076,0x9079,0x907B,0x9086,0x90FA,0x9133,0x9135,0x9136, +0x9193,0x9190,0x9191,0x918D,0x918F,0x9327,0x931E,0x9308, +0x931F,0x9306,0x930F,0x937A,0x9338,0x933C,0x931B,0x9323, +0x9312,0x9301,0x9346,0x932D,0x930E,0x930D,0x92CB,0x931D, +0x92FA,0x9325,0x9313,0x92F9,0x92F7,0x9334,0x9302,0x9324, +0x92FF,0x9329,0x9339,0x9335,0x932A,0x9314,0x930C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x930B,0x92FE,0x9309,0x9300,0x92FB,0x9316,0x95BC,0x95CD, +0x95BE,0x95B9,0x95BA,0x95B6,0x95BF,0x95B5,0x95BD,0x96A9, +0x96D4,0x970B,0x9712,0x9710,0x9799,0x9797,0x9794,0x97F0, +0x97F8,0x9835,0x982F,0x9832,0x9924,0x991F,0x9927,0x9929, +0x999E,0x99EE,0x99EC,0x99E5,0x99E4,0x99F0,0x99E3,0x99EA, +0x99E9,0x99E7,0x9AB9,0x9ABF,0x9AB4,0x9ABB,0x9AF6,0x9AFA, +0x9AF9,0x9AF7,0x9B33,0x9B80,0x9B85,0x9B87,0x9B7C,0x9B7E, +0x9B7B,0x9B82,0x9B93,0x9B92,0x9B90,0x9B7A,0x9B95, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9B7D,0x9B88,0x9D25,0x9D17,0x9D20,0x9D1E,0x9D14, +0x9D29,0x9D1D,0x9D18,0x9D22,0x9D10,0x9D19,0x9D1F,0x9E88, +0x9E86,0x9E87,0x9EAE,0x9EAD,0x9ED5,0x9ED6,0x9EFA,0x9F12, +0x9F3D,0x5126,0x5125,0x5122,0x5124,0x5120,0x5129,0x52F4, +0x5693,0x568C,0x568D,0x5686,0x5684,0x5683,0x567E,0x5682, +0x567F,0x5681,0x58D6,0x58D4,0x58CF,0x58D2,0x5B2D,0x5B25, +0x5B32,0x5B23,0x5B2C,0x5B27,0x5B26,0x5B2F,0x5B2E,0x5B7B, +0x5BF1,0x5BF2,0x5DB7,0x5E6C,0x5E6A,0x5FBE,0x5FBB,0x61C3, +0x61B5,0x61BC,0x61E7,0x61E0,0x61E5,0x61E4,0x61E8,0x61DE, +0x64EF,0x64E9,0x64E3,0x64EB,0x64E4,0x64E8,0x6581,0x6580, +0x65B6,0x65DA,0x66D2,0x6A8D,0x6A96,0x6A81,0x6AA5,0x6A89, +0x6A9F,0x6A9B,0x6AA1,0x6A9E,0x6A87,0x6A93,0x6A8E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6A95,0x6A83,0x6AA8,0x6AA4,0x6A91,0x6A7F,0x6AA6,0x6A9A, +0x6A85,0x6A8C,0x6A92,0x6B5B,0x6BAD,0x6C09,0x6FCC,0x6FA9, +0x6FF4,0x6FD4,0x6FE3,0x6FDC,0x6FED,0x6FE7,0x6FE6,0x6FDE, +0x6FF2,0x6FDD,0x6FE2,0x6FE8,0x71E1,0x71F1,0x71E8,0x71F2, +0x71E4,0x71F0,0x71E2,0x7373,0x736E,0x736F,0x7497,0x74B2, +0x74AB,0x7490,0x74AA,0x74AD,0x74B1,0x74A5,0x74AF,0x7510, +0x7511,0x7512,0x750F,0x7584,0x7643,0x7648,0x7649,0x7647, +0x76A4,0x76E9,0x77B5,0x77AB,0x77B2,0x77B7,0x77B6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x77B4,0x77B1,0x77A8,0x77F0,0x78F3,0x78FD,0x7902, +0x78FB,0x78FC,0x78F2,0x7905,0x78F9,0x78FE,0x7904,0x79AB, +0x79A8,0x7A5C,0x7A5B,0x7A56,0x7A58,0x7A54,0x7A5A,0x7ABE, +0x7AC0,0x7AC1,0x7C05,0x7C0F,0x7BF2,0x7C00,0x7BFF,0x7BFB, +0x7C0E,0x7BF4,0x7C0B,0x7BF3,0x7C02,0x7C09,0x7C03,0x7C01, +0x7BF8,0x7BFD,0x7C06,0x7BF0,0x7BF1,0x7C10,0x7C0A,0x7CE8, +0x7E2D,0x7E3C,0x7E42,0x7E33,0x9848,0x7E38,0x7E2A,0x7E49, +0x7E40,0x7E47,0x7E29,0x7E4C,0x7E30,0x7E3B,0x7E36,0x7E44, +0x7E3A,0x7F45,0x7F7F,0x7F7E,0x7F7D,0x7FF4,0x7FF2,0x802C, +0x81BB,0x81C4,0x81CC,0x81CA,0x81C5,0x81C7,0x81BC,0x81E9, +0x825B,0x825A,0x825C,0x8583,0x8580,0x858F,0x85A7,0x8595, +0x85A0,0x858B,0x85A3,0x857B,0x85A4,0x859A,0x859E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8577,0x857C,0x8589,0x85A1,0x857A,0x8578,0x8557,0x858E, +0x8596,0x8586,0x858D,0x8599,0x859D,0x8581,0x85A2,0x8582, +0x8588,0x8585,0x8579,0x8576,0x8598,0x8590,0x859F,0x8668, +0x87BE,0x87AA,0x87AD,0x87C5,0x87B0,0x87AC,0x87B9,0x87B5, +0x87BC,0x87AE,0x87C9,0x87C3,0x87C2,0x87CC,0x87B7,0x87AF, +0x87C4,0x87CA,0x87B4,0x87B6,0x87BF,0x87B8,0x87BD,0x87DE, +0x87B2,0x8935,0x8933,0x893C,0x893E,0x8941,0x8952,0x8937, +0x8942,0x89AD,0x89AF,0x89AE,0x89F2,0x89F3,0x8B1E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8B18,0x8B16,0x8B11,0x8B05,0x8B0B,0x8B22,0x8B0F, +0x8B12,0x8B15,0x8B07,0x8B0D,0x8B08,0x8B06,0x8B1C,0x8B13, +0x8B1A,0x8C4F,0x8C70,0x8C72,0x8C71,0x8C6F,0x8C95,0x8C94, +0x8CF9,0x8D6F,0x8E4E,0x8E4D,0x8E53,0x8E50,0x8E4C,0x8E47, +0x8F43,0x8F40,0x9085,0x907E,0x9138,0x919A,0x91A2,0x919B, +0x9199,0x919F,0x91A1,0x919D,0x91A0,0x93A1,0x9383,0x93AF, +0x9364,0x9356,0x9347,0x937C,0x9358,0x935C,0x9376,0x9349, +0x9350,0x9351,0x9360,0x936D,0x938F,0x934C,0x936A,0x9379, +0x9357,0x9355,0x9352,0x934F,0x9371,0x9377,0x937B,0x9361, +0x935E,0x9363,0x9367,0x9380,0x934E,0x9359,0x95C7,0x95C0, +0x95C9,0x95C3,0x95C5,0x95B7,0x96AE,0x96B0,0x96AC,0x9720, +0x971F,0x9718,0x971D,0x9719,0x979A,0x97A1,0x979C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x979E,0x979D,0x97D5,0x97D4,0x97F1,0x9841,0x9844,0x984A, +0x9849,0x9845,0x9843,0x9925,0x992B,0x992C,0x992A,0x9933, +0x9932,0x992F,0x992D,0x9931,0x9930,0x9998,0x99A3,0x99A1, +0x9A02,0x99FA,0x99F4,0x99F7,0x99F9,0x99F8,0x99F6,0x99FB, +0x99FD,0x99FE,0x99FC,0x9A03,0x9ABE,0x9AFE,0x9AFD,0x9B01, +0x9AFC,0x9B48,0x9B9A,0x9BA8,0x9B9E,0x9B9B,0x9BA6,0x9BA1, +0x9BA5,0x9BA4,0x9B86,0x9BA2,0x9BA0,0x9BAF,0x9D33,0x9D41, +0x9D67,0x9D36,0x9D2E,0x9D2F,0x9D31,0x9D38,0x9D30, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9D45,0x9D42,0x9D43,0x9D3E,0x9D37,0x9D40,0x9D3D, +0x7FF5,0x9D2D,0x9E8A,0x9E89,0x9E8D,0x9EB0,0x9EC8,0x9EDA, +0x9EFB,0x9EFF,0x9F24,0x9F23,0x9F22,0x9F54,0x9FA0,0x5131, +0x512D,0x512E,0x5698,0x569C,0x5697,0x569A,0x569D,0x5699, +0x5970,0x5B3C,0x5C69,0x5C6A,0x5DC0,0x5E6D,0x5E6E,0x61D8, +0x61DF,0x61ED,0x61EE,0x61F1,0x61EA,0x61F0,0x61EB,0x61D6, +0x61E9,0x64FF,0x6504,0x64FD,0x64F8,0x6501,0x6503,0x64FC, +0x6594,0x65DB,0x66DA,0x66DB,0x66D8,0x6AC5,0x6AB9,0x6ABD, +0x6AE1,0x6AC6,0x6ABA,0x6AB6,0x6AB7,0x6AC7,0x6AB4,0x6AAD, +0x6B5E,0x6BC9,0x6C0B,0x7007,0x700C,0x700D,0x7001,0x7005, +0x7014,0x700E,0x6FFF,0x7000,0x6FFB,0x7026,0x6FFC,0x6FF7, +0x700A,0x7201,0x71FF,0x71F9,0x7203,0x71FD,0x7376, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x74B8,0x74C0,0x74B5,0x74C1,0x74BE,0x74B6,0x74BB,0x74C2, +0x7514,0x7513,0x765C,0x7664,0x7659,0x7650,0x7653,0x7657, +0x765A,0x76A6,0x76BD,0x76EC,0x77C2,0x77BA,0x78FF,0x790C, +0x7913,0x7914,0x7909,0x7910,0x7912,0x7911,0x79AD,0x79AC, +0x7A5F,0x7C1C,0x7C29,0x7C19,0x7C20,0x7C1F,0x7C2D,0x7C1D, +0x7C26,0x7C28,0x7C22,0x7C25,0x7C30,0x7E5C,0x7E50,0x7E56, +0x7E63,0x7E58,0x7E62,0x7E5F,0x7E51,0x7E60,0x7E57,0x7E53, +0x7FB5,0x7FB3,0x7FF7,0x7FF8,0x8075,0x81D1,0x81D2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x81D0,0x825F,0x825E,0x85B4,0x85C6,0x85C0,0x85C3, +0x85C2,0x85B3,0x85B5,0x85BD,0x85C7,0x85C4,0x85BF,0x85CB, +0x85CE,0x85C8,0x85C5,0x85B1,0x85B6,0x85D2,0x8624,0x85B8, +0x85B7,0x85BE,0x8669,0x87E7,0x87E6,0x87E2,0x87DB,0x87EB, +0x87EA,0x87E5,0x87DF,0x87F3,0x87E4,0x87D4,0x87DC,0x87D3, +0x87ED,0x87D8,0x87E3,0x87A4,0x87D7,0x87D9,0x8801,0x87F4, +0x87E8,0x87DD,0x8953,0x894B,0x894F,0x894C,0x8946,0x8950, +0x8951,0x8949,0x8B2A,0x8B27,0x8B23,0x8B33,0x8B30,0x8B35, +0x8B47,0x8B2F,0x8B3C,0x8B3E,0x8B31,0x8B25,0x8B37,0x8B26, +0x8B36,0x8B2E,0x8B24,0x8B3B,0x8B3D,0x8B3A,0x8C42,0x8C75, +0x8C99,0x8C98,0x8C97,0x8CFE,0x8D04,0x8D02,0x8D00,0x8E5C, +0x8E62,0x8E60,0x8E57,0x8E56,0x8E5E,0x8E65,0x8E67, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E5B,0x8E5A,0x8E61,0x8E5D,0x8E69,0x8E54,0x8F46,0x8F47, +0x8F48,0x8F4B,0x9128,0x913A,0x913B,0x913E,0x91A8,0x91A5, +0x91A7,0x91AF,0x91AA,0x93B5,0x938C,0x9392,0x93B7,0x939B, +0x939D,0x9389,0x93A7,0x938E,0x93AA,0x939E,0x93A6,0x9395, +0x9388,0x9399,0x939F,0x938D,0x93B1,0x9391,0x93B2,0x93A4, +0x93A8,0x93B4,0x93A3,0x93A5,0x95D2,0x95D3,0x95D1,0x96B3, +0x96D7,0x96DA,0x5DC2,0x96DF,0x96D8,0x96DD,0x9723,0x9722, +0x9725,0x97AC,0x97AE,0x97A8,0x97AB,0x97A4,0x97AA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x97A2,0x97A5,0x97D7,0x97D9,0x97D6,0x97D8,0x97FA, +0x9850,0x9851,0x9852,0x98B8,0x9941,0x993C,0x993A,0x9A0F, +0x9A0B,0x9A09,0x9A0D,0x9A04,0x9A11,0x9A0A,0x9A05,0x9A07, +0x9A06,0x9AC0,0x9ADC,0x9B08,0x9B04,0x9B05,0x9B29,0x9B35, +0x9B4A,0x9B4C,0x9B4B,0x9BC7,0x9BC6,0x9BC3,0x9BBF,0x9BC1, +0x9BB5,0x9BB8,0x9BD3,0x9BB6,0x9BC4,0x9BB9,0x9BBD,0x9D5C, +0x9D53,0x9D4F,0x9D4A,0x9D5B,0x9D4B,0x9D59,0x9D56,0x9D4C, +0x9D57,0x9D52,0x9D54,0x9D5F,0x9D58,0x9D5A,0x9E8E,0x9E8C, +0x9EDF,0x9F01,0x9F00,0x9F16,0x9F25,0x9F2B,0x9F2A,0x9F29, +0x9F28,0x9F4C,0x9F55,0x5134,0x5135,0x5296,0x52F7,0x53B4, +0x56AB,0x56AD,0x56A6,0x56A7,0x56AA,0x56AC,0x58DA,0x58DD, +0x58DB,0x5912,0x5B3D,0x5B3E,0x5B3F,0x5DC3,0x5E70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5FBF,0x61FB,0x6507,0x6510,0x650D,0x6509,0x650C,0x650E, +0x6584,0x65DE,0x65DD,0x66DE,0x6AE7,0x6AE0,0x6ACC,0x6AD1, +0x6AD9,0x6ACB,0x6ADF,0x6ADC,0x6AD0,0x6AEB,0x6ACF,0x6ACD, +0x6ADE,0x6B60,0x6BB0,0x6C0C,0x7019,0x7027,0x7020,0x7016, +0x702B,0x7021,0x7022,0x7023,0x7029,0x7017,0x7024,0x701C, +0x702A,0x720C,0x720A,0x7207,0x7202,0x7205,0x72A5,0x72A6, +0x72A4,0x72A3,0x72A1,0x74CB,0x74C5,0x74B7,0x74C3,0x7516, +0x7660,0x77C9,0x77CA,0x77C4,0x77F1,0x791D,0x791B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7921,0x791C,0x7917,0x791E,0x79B0,0x7A67,0x7A68, +0x7C33,0x7C3C,0x7C39,0x7C2C,0x7C3B,0x7CEC,0x7CEA,0x7E76, +0x7E75,0x7E78,0x7E70,0x7E77,0x7E6F,0x7E7A,0x7E72,0x7E74, +0x7E68,0x7F4B,0x7F4A,0x7F83,0x7F86,0x7FB7,0x7FFD,0x7FFE, +0x8078,0x81D7,0x81D5,0x8264,0x8261,0x8263,0x85EB,0x85F1, +0x85ED,0x85D9,0x85E1,0x85E8,0x85DA,0x85D7,0x85EC,0x85F2, +0x85F8,0x85D8,0x85DF,0x85E3,0x85DC,0x85D1,0x85F0,0x85E6, +0x85EF,0x85DE,0x85E2,0x8800,0x87FA,0x8803,0x87F6,0x87F7, +0x8809,0x880C,0x880B,0x8806,0x87FC,0x8808,0x87FF,0x880A, +0x8802,0x8962,0x895A,0x895B,0x8957,0x8961,0x895C,0x8958, +0x895D,0x8959,0x8988,0x89B7,0x89B6,0x89F6,0x8B50,0x8B48, +0x8B4A,0x8B40,0x8B53,0x8B56,0x8B54,0x8B4B,0x8B55, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B51,0x8B42,0x8B52,0x8B57,0x8C43,0x8C77,0x8C76,0x8C9A, +0x8D06,0x8D07,0x8D09,0x8DAC,0x8DAA,0x8DAD,0x8DAB,0x8E6D, +0x8E78,0x8E73,0x8E6A,0x8E6F,0x8E7B,0x8EC2,0x8F52,0x8F51, +0x8F4F,0x8F50,0x8F53,0x8FB4,0x9140,0x913F,0x91B0,0x91AD, +0x93DE,0x93C7,0x93CF,0x93C2,0x93DA,0x93D0,0x93F9,0x93EC, +0x93CC,0x93D9,0x93A9,0x93E6,0x93CA,0x93D4,0x93EE,0x93E3, +0x93D5,0x93C4,0x93CE,0x93C0,0x93D2,0x93E7,0x957D,0x95DA, +0x95DB,0x96E1,0x9729,0x972B,0x972C,0x9728,0x9726, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x97B3,0x97B7,0x97B6,0x97DD,0x97DE,0x97DF,0x985C, +0x9859,0x985D,0x9857,0x98BF,0x98BD,0x98BB,0x98BE,0x9948, +0x9947,0x9943,0x99A6,0x99A7,0x9A1A,0x9A15,0x9A25,0x9A1D, +0x9A24,0x9A1B,0x9A22,0x9A20,0x9A27,0x9A23,0x9A1E,0x9A1C, +0x9A14,0x9AC2,0x9B0B,0x9B0A,0x9B0E,0x9B0C,0x9B37,0x9BEA, +0x9BEB,0x9BE0,0x9BDE,0x9BE4,0x9BE6,0x9BE2,0x9BF0,0x9BD4, +0x9BD7,0x9BEC,0x9BDC,0x9BD9,0x9BE5,0x9BD5,0x9BE1,0x9BDA, +0x9D77,0x9D81,0x9D8A,0x9D84,0x9D88,0x9D71,0x9D80,0x9D78, +0x9D86,0x9D8B,0x9D8C,0x9D7D,0x9D6B,0x9D74,0x9D75,0x9D70, +0x9D69,0x9D85,0x9D73,0x9D7B,0x9D82,0x9D6F,0x9D79,0x9D7F, +0x9D87,0x9D68,0x9E94,0x9E91,0x9EC0,0x9EFC,0x9F2D,0x9F40, +0x9F41,0x9F4D,0x9F56,0x9F57,0x9F58,0x5337,0x56B2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x56B5,0x56B3,0x58E3,0x5B45,0x5DC6,0x5DC7,0x5EEE,0x5EEF, +0x5FC0,0x5FC1,0x61F9,0x6517,0x6516,0x6515,0x6513,0x65DF, +0x66E8,0x66E3,0x66E4,0x6AF3,0x6AF0,0x6AEA,0x6AE8,0x6AF9, +0x6AF1,0x6AEE,0x6AEF,0x703C,0x7035,0x702F,0x7037,0x7034, +0x7031,0x7042,0x7038,0x703F,0x703A,0x7039,0x7040,0x703B, +0x7033,0x7041,0x7213,0x7214,0x72A8,0x737D,0x737C,0x74BA, +0x76AB,0x76AA,0x76BE,0x76ED,0x77CC,0x77CE,0x77CF,0x77CD, +0x77F2,0x7925,0x7923,0x7927,0x7928,0x7924,0x7929, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x79B2,0x7A6E,0x7A6C,0x7A6D,0x7AF7,0x7C49,0x7C48, +0x7C4A,0x7C47,0x7C45,0x7CEE,0x7E7B,0x7E7E,0x7E81,0x7E80, +0x7FBA,0x7FFF,0x8079,0x81DB,0x81D9,0x820B,0x8268,0x8269, +0x8622,0x85FF,0x8601,0x85FE,0x861B,0x8600,0x85F6,0x8604, +0x8609,0x8605,0x860C,0x85FD,0x8819,0x8810,0x8811,0x8817, +0x8813,0x8816,0x8963,0x8966,0x89B9,0x89F7,0x8B60,0x8B6A, +0x8B5D,0x8B68,0x8B63,0x8B65,0x8B67,0x8B6D,0x8DAE,0x8E86, +0x8E88,0x8E84,0x8F59,0x8F56,0x8F57,0x8F55,0x8F58,0x8F5A, +0x908D,0x9143,0x9141,0x91B7,0x91B5,0x91B2,0x91B3,0x940B, +0x9413,0x93FB,0x9420,0x940F,0x9414,0x93FE,0x9415,0x9410, +0x9428,0x9419,0x940D,0x93F5,0x9400,0x93F7,0x9407,0x940E, +0x9416,0x9412,0x93FA,0x9409,0x93F8,0x940A,0x93FF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x93FC,0x940C,0x93F6,0x9411,0x9406,0x95DE,0x95E0,0x95DF, +0x972E,0x972F,0x97B9,0x97BB,0x97FD,0x97FE,0x9860,0x9862, +0x9863,0x985F,0x98C1,0x98C2,0x9950,0x994E,0x9959,0x994C, +0x994B,0x9953,0x9A32,0x9A34,0x9A31,0x9A2C,0x9A2A,0x9A36, +0x9A29,0x9A2E,0x9A38,0x9A2D,0x9AC7,0x9ACA,0x9AC6,0x9B10, +0x9B12,0x9B11,0x9C0B,0x9C08,0x9BF7,0x9C05,0x9C12,0x9BF8, +0x9C40,0x9C07,0x9C0E,0x9C06,0x9C17,0x9C14,0x9C09,0x9D9F, +0x9D99,0x9DA4,0x9D9D,0x9D92,0x9D98,0x9D90,0x9D9B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9DA0,0x9D94,0x9D9C,0x9DAA,0x9D97,0x9DA1,0x9D9A, +0x9DA2,0x9DA8,0x9D9E,0x9DA3,0x9DBF,0x9DA9,0x9D96,0x9DA6, +0x9DA7,0x9E99,0x9E9B,0x9E9A,0x9EE5,0x9EE4,0x9EE7,0x9EE6, +0x9F30,0x9F2E,0x9F5B,0x9F60,0x9F5E,0x9F5D,0x9F59,0x9F91, +0x513A,0x5139,0x5298,0x5297,0x56C3,0x56BD,0x56BE,0x5B48, +0x5B47,0x5DCB,0x5DCF,0x5EF1,0x61FD,0x651B,0x6B02,0x6AFC, +0x6B03,0x6AF8,0x6B00,0x7043,0x7044,0x704A,0x7048,0x7049, +0x7045,0x7046,0x721D,0x721A,0x7219,0x737E,0x7517,0x766A, +0x77D0,0x792D,0x7931,0x792F,0x7C54,0x7C53,0x7CF2,0x7E8A, +0x7E87,0x7E88,0x7E8B,0x7E86,0x7E8D,0x7F4D,0x7FBB,0x8030, +0x81DD,0x8618,0x862A,0x8626,0x861F,0x8623,0x861C,0x8619, +0x8627,0x862E,0x8621,0x8620,0x8629,0x861E,0x8625, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8829,0x881D,0x881B,0x8820,0x8824,0x881C,0x882B,0x884A, +0x896D,0x8969,0x896E,0x896B,0x89FA,0x8B79,0x8B78,0x8B45, +0x8B7A,0x8B7B,0x8D10,0x8D14,0x8DAF,0x8E8E,0x8E8C,0x8F5E, +0x8F5B,0x8F5D,0x9146,0x9144,0x9145,0x91B9,0x943F,0x943B, +0x9436,0x9429,0x943D,0x943C,0x9430,0x9439,0x942A,0x9437, +0x942C,0x9440,0x9431,0x95E5,0x95E4,0x95E3,0x9735,0x973A, +0x97BF,0x97E1,0x9864,0x98C9,0x98C6,0x98C0,0x9958,0x9956, +0x9A39,0x9A3D,0x9A46,0x9A44,0x9A42,0x9A41,0x9A3A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9A3F,0x9ACD,0x9B15,0x9B17,0x9B18,0x9B16,0x9B3A, +0x9B52,0x9C2B,0x9C1D,0x9C1C,0x9C2C,0x9C23,0x9C28,0x9C29, +0x9C24,0x9C21,0x9DB7,0x9DB6,0x9DBC,0x9DC1,0x9DC7,0x9DCA, +0x9DCF,0x9DBE,0x9DC5,0x9DC3,0x9DBB,0x9DB5,0x9DCE,0x9DB9, +0x9DBA,0x9DAC,0x9DC8,0x9DB1,0x9DAD,0x9DCC,0x9DB3,0x9DCD, +0x9DB2,0x9E7A,0x9E9C,0x9EEB,0x9EEE,0x9EED,0x9F1B,0x9F18, +0x9F1A,0x9F31,0x9F4E,0x9F65,0x9F64,0x9F92,0x4EB9,0x56C6, +0x56C5,0x56CB,0x5971,0x5B4B,0x5B4C,0x5DD5,0x5DD1,0x5EF2, +0x6521,0x6520,0x6526,0x6522,0x6B0B,0x6B08,0x6B09,0x6C0D, +0x7055,0x7056,0x7057,0x7052,0x721E,0x721F,0x72A9,0x737F, +0x74D8,0x74D5,0x74D9,0x74D7,0x766D,0x76AD,0x7935,0x79B4, +0x7A70,0x7A71,0x7C57,0x7C5C,0x7C59,0x7C5B,0x7C5A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7CF4,0x7CF1,0x7E91,0x7F4F,0x7F87,0x81DE,0x826B,0x8634, +0x8635,0x8633,0x862C,0x8632,0x8636,0x882C,0x8828,0x8826, +0x882A,0x8825,0x8971,0x89BF,0x89BE,0x89FB,0x8B7E,0x8B84, +0x8B82,0x8B86,0x8B85,0x8B7F,0x8D15,0x8E95,0x8E94,0x8E9A, +0x8E92,0x8E90,0x8E96,0x8E97,0x8F60,0x8F62,0x9147,0x944C, +0x9450,0x944A,0x944B,0x944F,0x9447,0x9445,0x9448,0x9449, +0x9446,0x973F,0x97E3,0x986A,0x9869,0x98CB,0x9954,0x995B, +0x9A4E,0x9A53,0x9A54,0x9A4C,0x9A4F,0x9A48,0x9A4A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9A49,0x9A52,0x9A50,0x9AD0,0x9B19,0x9B2B,0x9B3B, +0x9B56,0x9B55,0x9C46,0x9C48,0x9C3F,0x9C44,0x9C39,0x9C33, +0x9C41,0x9C3C,0x9C37,0x9C34,0x9C32,0x9C3D,0x9C36,0x9DDB, +0x9DD2,0x9DDE,0x9DDA,0x9DCB,0x9DD0,0x9DDC,0x9DD1,0x9DDF, +0x9DE9,0x9DD9,0x9DD8,0x9DD6,0x9DF5,0x9DD5,0x9DDD,0x9EB6, +0x9EF0,0x9F35,0x9F33,0x9F32,0x9F42,0x9F6B,0x9F95,0x9FA2, +0x513D,0x5299,0x58E8,0x58E7,0x5972,0x5B4D,0x5DD8,0x882F, +0x5F4F,0x6201,0x6203,0x6204,0x6529,0x6525,0x6596,0x66EB, +0x6B11,0x6B12,0x6B0F,0x6BCA,0x705B,0x705A,0x7222,0x7382, +0x7381,0x7383,0x7670,0x77D4,0x7C67,0x7C66,0x7E95,0x826C, +0x863A,0x8640,0x8639,0x863C,0x8631,0x863B,0x863E,0x8830, +0x8832,0x882E,0x8833,0x8976,0x8974,0x8973,0x89FE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B8C,0x8B8E,0x8B8B,0x8B88,0x8C45,0x8D19,0x8E98,0x8F64, +0x8F63,0x91BC,0x9462,0x9455,0x945D,0x9457,0x945E,0x97C4, +0x97C5,0x9800,0x9A56,0x9A59,0x9B1E,0x9B1F,0x9B20,0x9C52, +0x9C58,0x9C50,0x9C4A,0x9C4D,0x9C4B,0x9C55,0x9C59,0x9C4C, +0x9C4E,0x9DFB,0x9DF7,0x9DEF,0x9DE3,0x9DEB,0x9DF8,0x9DE4, +0x9DF6,0x9DE1,0x9DEE,0x9DE6,0x9DF2,0x9DF0,0x9DE2,0x9DEC, +0x9DF4,0x9DF3,0x9DE8,0x9DED,0x9EC2,0x9ED0,0x9EF2,0x9EF3, +0x9F06,0x9F1C,0x9F38,0x9F37,0x9F36,0x9F43,0x9F4F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9F71,0x9F70,0x9F6E,0x9F6F,0x56D3,0x56CD,0x5B4E, +0x5C6D,0x652D,0x66ED,0x66EE,0x6B13,0x705F,0x7061,0x705D, +0x7060,0x7223,0x74DB,0x74E5,0x77D5,0x7938,0x79B7,0x79B6, +0x7C6A,0x7E97,0x7F89,0x826D,0x8643,0x8838,0x8837,0x8835, +0x884B,0x8B94,0x8B95,0x8E9E,0x8E9F,0x8EA0,0x8E9D,0x91BE, +0x91BD,0x91C2,0x946B,0x9468,0x9469,0x96E5,0x9746,0x9743, +0x9747,0x97C7,0x97E5,0x9A5E,0x9AD5,0x9B59,0x9C63,0x9C67, +0x9C66,0x9C62,0x9C5E,0x9C60,0x9E02,0x9DFE,0x9E07,0x9E03, +0x9E06,0x9E05,0x9E00,0x9E01,0x9E09,0x9DFF,0x9DFD,0x9E04, +0x9EA0,0x9F1E,0x9F46,0x9F74,0x9F75,0x9F76,0x56D4,0x652E, +0x65B8,0x6B18,0x6B19,0x6B17,0x6B1A,0x7062,0x7226,0x72AA, +0x77D8,0x77D9,0x7939,0x7C69,0x7C6B,0x7CF6,0x7E9A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7E98,0x7E9B,0x7E99,0x81E0,0x81E1,0x8646,0x8647,0x8648, +0x8979,0x897A,0x897C,0x897B,0x89FF,0x8B98,0x8B99,0x8EA5, +0x8EA4,0x8EA3,0x946E,0x946D,0x946F,0x9471,0x9473,0x9749, +0x9872,0x995F,0x9C68,0x9C6E,0x9C6D,0x9E0B,0x9E0D,0x9E10, +0x9E0F,0x9E12,0x9E11,0x9EA1,0x9EF5,0x9F09,0x9F47,0x9F78, +0x9F7B,0x9F7A,0x9F79,0x571E,0x7066,0x7C6F,0x883C,0x8DB2, +0x8EA6,0x91C3,0x9474,0x9478,0x9476,0x9475,0x9A60,0x9C74, +0x9C73,0x9C71,0x9C75,0x9E14,0x9E13,0x9EF6,0x9F0A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9FA4,0x7068,0x7065,0x7CF7,0x866A,0x883E,0x883D, +0x883F,0x8B9E,0x8C9C,0x8EA9,0x8EC9,0x974B,0x9873,0x9874, +0x98CC,0x9961,0x99AB,0x9A64,0x9A66,0x9A67,0x9B24,0x9E15, +0x9E17,0x9F48,0x6207,0x6B1E,0x7227,0x864C,0x8EA8,0x9482, +0x9480,0x9481,0x9A69,0x9A68,0x9B2E,0x9E19,0x7229,0x864B, +0x8B9F,0x9483,0x9C79,0x9EB7,0x7675,0x9A6B,0x9C7A,0x9E1D, +0x7069,0x706A,0x9EA4,0x9F7E,0x9F49,0x9F98,0x7881,0x92B9, +0x88CF,0x58BB,0x6052,0x7CA7,0x5AFA}; + +static int func_big5_uni_onechar(int code){ + if ((code>=0xA140)&&(code<=0xC7FC)) + return(tab_big5_uni0[code-0xA140]); + if ((code>=0xC940)&&(code<=0xF9DC)) + return(tab_big5_uni1[code-0xC940]); + return(0); +} + + +/* page 0 0x00A2-0x00F7 */ +static uint16 tab_uni_big50[]={ +0xA246,0xA247, 0,0xA244, 0,0xA1B1, 0, 0, + 0, 0, 0, 0, 0, 0,0xA258,0xA1D3, + 0, 0, 0, 0, 0,0xA150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1D1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1D2}; + +/* page 1 0x02C7-0x0451 */ +static uint16 tab_uni_big51[]={ +0xA3BE, 0,0xA3BC,0xA3BD,0xA3BF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA3BB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA344,0xA345,0xA346,0xA347,0xA348,0xA349, +0xA34A,0xA34B,0xA34C,0xA34D,0xA34E,0xA34F,0xA350,0xA351, +0xA352,0xA353,0xA354, 0,0xA355,0xA356,0xA357,0xA358, +0xA359,0xA35A,0xA35B, 0, 0, 0, 0, 0, + 0, 0,0xA35C,0xA35D,0xA35E,0xA35F,0xA360,0xA361, +0xA362,0xA363,0xA364,0xA365,0xA366,0xA367,0xA368,0xA369, +0xA36A,0xA36B,0xA36C, 0,0xA36D,0xA36E,0xA36F,0xA370, +0xA371,0xA372,0xA373, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xC7B3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xC7B1,0xC7B2,0xC7B4, +0xC7B5,0xC7B6,0xC7B7,0xC7B8,0xC7B9,0xC7BA, 0, 0, + 0, 0, 0, 0,0xC7BB,0xC7BC,0xC7BD,0xC7BE, +0xC7BF,0xC7C0,0xC7C1,0xC7C2,0xC7C3,0xC7C4,0xC7C5,0xC7C6, +0xC7C7,0xC7C8,0xC7C9,0xC7CA,0xC7CB,0xC7CC,0xC7CD,0xC7CF, +0xC7D0,0xC7D1,0xC7D2,0xC7D3,0xC7D4,0xC7D5,0xC7D6,0xC7D7, +0xC7D8,0xC7D9,0xC7DA,0xC7DB,0xC7DC,0xC7DD,0xC7DE,0xC7DF, +0xC7E0,0xC7E1,0xC7E2,0xC7E3,0xC7E4,0xC7E5,0xC7E6,0xC7E7, +0xC7E8, 0,0xC7CE}; + +/* page 2 0x2013-0x22BF */ +static uint16 tab_uni_big52[]={ +0xA156,0xA158, 0, 0, 0,0xA1A5,0xA1A6, 0, + 0,0xA1A7,0xA1A8, 0, 0, 0, 0,0xA145, + 0, 0,0xA14C,0xA14B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA1AC, + 0, 0,0xA1AB, 0, 0, 0, 0, 0, +0xA1B0, 0, 0,0xA1C2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA24A, 0,0xA1C1, 0, 0, 0,0xA24B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA2B9,0xA2BA,0xA2BB, +0xA2BC,0xA2BD,0xA2BE,0xA2BF,0xA2C0,0xA2C1,0xA2C2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1F6,0xA1F4,0xA1F7, +0xA1F5, 0, 0,0xA1F8,0xA1F9,0xA1FB,0xA1FA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA1D4, + 0, 0, 0,0xA1DB,0xA1E8,0xA1E7, 0, 0, +0xA1FD, 0,0xA1FC, 0, 0, 0,0xA1E4,0xA1E5, +0xA1EC, 0, 0,0xA1ED, 0, 0, 0, 0, + 0,0xA1EF,0xA1EE, 0, 0, 0, 0, 0, + 0,0xA1E3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA1DC, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1DA,0xA1DD, 0, + 0, 0, 0,0xA1D8,0xA1D9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA1E6, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA1E9}; + +/* page 3 0x2460-0x2642 */ +static uint16 tab_uni_big53[]={ +0xC7E9,0xC7EA,0xC7EB,0xC7EC,0xC7ED,0xC7EE,0xC7EF,0xC7F0, +0xC7F1,0xC7F2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xC7F3,0xC7F4,0xC7F5,0xC7F6, +0xC7F7,0xC7F8,0xC7F9,0xC7FA,0xC7FB,0xC7FC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA277, 0,0xA278, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA27A, 0, 0, 0, +0xA27B, 0, 0, 0,0xA27C, 0, 0, 0, +0xA27D, 0, 0, 0,0xA275, 0, 0, 0, + 0, 0, 0, 0,0xA274, 0, 0, 0, + 0, 0, 0, 0,0xA273, 0, 0, 0, + 0, 0, 0, 0,0xA272, 0, 0, 0, + 0, 0, 0, 0,0xA271, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA2A4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA2A5, 0, + 0,0xA2A7, 0, 0, 0, 0, 0, 0, + 0, 0,0xA2A6, 0, 0,0xA27E,0xA2A1,0xA2A3, +0xA2A2,0xA2AC,0xA2AD,0xA2AE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA262,0xA263,0xA264,0xA265,0xA266,0xA267,0xA268, +0xA269,0xA270,0xA26F,0xA26E,0xA26D,0xA26C,0xA26B,0xA26A, + 0, 0, 0, 0,0xA276,0xA279, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1BD,0xA1BC, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA1B6,0xA1B5, 0, 0, 0, 0, + 0, 0, 0, 0,0xA1BF,0xA1BE, 0, 0, + 0, 0, 0, 0, 0, 0,0xA1BB,0xA1BA, + 0, 0, 0,0xA1B3, 0, 0,0xA1B7,0xA1B4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA2A8,0xA2A9,0xA2AB,0xA2AA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1B9,0xA1B8, 0, + 0,0xA1F3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1F0,0xA1F2,0xA1F1}; + +/* page 4 0x3000-0x3129 */ +static uint16 tab_uni_big54[]={ +0xA140,0xA142,0xA143,0xA1B2, 0,0xC6A4, 0, 0, +0xA171,0xA172,0xA16D,0xA16E,0xA175,0xA176,0xA179,0xA17A, +0xA169,0xA16A,0xA245, 0,0xA165,0xA166, 0, 0, + 0, 0, 0, 0, 0,0xA1A9,0xA1AA, 0, + 0,0xA2C3,0xA2C4,0xA2C5,0xA2C6,0xA2C7,0xA2C8,0xA2C9, +0xA2CA,0xA2CB, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xC6A5,0xC6A6,0xC6A7,0xC6A8,0xC6A9,0xC6AA,0xC6AB, +0xC6AC,0xC6AD,0xC6AE,0xC6AF,0xC6B0,0xC6B1,0xC6B2,0xC6B3, +0xC6B4,0xC6B5,0xC6B6,0xC6B7,0xC6B8,0xC6B9,0xC6BA,0xC6BB, +0xC6BC,0xC6BD,0xC6BE,0xC6BF,0xC6C0,0xC6C1,0xC6C2,0xC6C3, +0xC6C4,0xC6C5,0xC6C6,0xC6C7,0xC6C8,0xC6C9,0xC6CA,0xC6CB, +0xC6CC,0xC6CD,0xC6CE,0xC6CF,0xC6D0,0xC6D1,0xC6D2,0xC6D3, +0xC6D4,0xC6D5,0xC6D6,0xC6D7,0xC6D8,0xC6D9,0xC6DA,0xC6DB, +0xC6DC,0xC6DD,0xC6DE,0xC6DF,0xC6E0,0xC6E1,0xC6E2,0xC6E3, +0xC6E4,0xC6E5,0xC6E6,0xC6E7,0xC6E8,0xC6E9,0xC6EA,0xC6EB, +0xC6EC,0xC6ED,0xC6EE,0xC6EF,0xC6F0,0xC6F1,0xC6F2,0xC6F3, +0xC6F4,0xC6F5,0xC6F6,0xC6F7, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xC6A2,0xC6A3, 0, + 0,0xC6F8,0xC6F9,0xC6FA,0xC6FB,0xC6FC,0xC6FD,0xC6FE, +0xC740,0xC741,0xC742,0xC743,0xC744,0xC745,0xC746,0xC747, +0xC748,0xC749,0xC74A,0xC74B,0xC74C,0xC74D,0xC74E,0xC74F, +0xC750,0xC751,0xC752,0xC753,0xC754,0xC755,0xC756,0xC757, +0xC758,0xC759,0xC75A,0xC75B,0xC75C,0xC75D,0xC75E,0xC75F, +0xC760,0xC761,0xC762,0xC763,0xC764,0xC765,0xC766,0xC767, +0xC768,0xC769,0xC76A,0xC76B,0xC76C,0xC76D,0xC76E,0xC76F, +0xC770,0xC771,0xC772,0xC773,0xC774,0xC775,0xC776,0xC777, +0xC778,0xC779,0xC77A,0xC77B,0xC77C,0xC77D,0xC77E,0xC7A1, +0xC7A2,0xC7A3,0xC7A4,0xC7A5,0xC7A6,0xC7A7,0xC7A8,0xC7A9, +0xC7AA,0xC7AB,0xC7AC,0xC7AD,0xC7AE,0xC7AF,0xC7B0, 0, + 0, 0, 0, 0, 0, 0,0xC6A1, 0, + 0, 0, 0, 0, 0,0xA374,0xA375,0xA376, +0xA377,0xA378,0xA379,0xA37A,0xA37B,0xA37C,0xA37D,0xA37E, +0xA3A1,0xA3A2,0xA3A3,0xA3A4,0xA3A5,0xA3A6,0xA3A7,0xA3A8, +0xA3A9,0xA3AA,0xA3AB,0xA3AC,0xA3AD,0xA3AE,0xA3AF,0xA3B0, +0xA3B1,0xA3B2,0xA3B3,0xA3B4,0xA3B5,0xA3B6,0xA3B7,0xA3B8, +0xA3B9,0xA3BA}; + +/* page 5 0x32A3-0x32A3 */ +static uint16 tab_uni_big55[]={ +0xA1C0}; + +/* page 6 0x338E-0x33D5 */ +static uint16 tab_uni_big56[]={ +0xA255,0xA256, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA250,0xA251, +0xA252, 0, 0,0xA254, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA257, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA253, 0, 0,0xA1EB,0xA1EA, 0, 0,0xA24F +}; + +/* page 7 0x4E00-0x9483 */ +static uint16 tab_uni_big57[]={ +0xA440,0xA442, 0,0xA443, 0, 0, 0,0xC945, +0xA456,0xA454,0xA457,0xA455,0xC946,0xA4A3,0xC94F,0xC94D, +0xA4A2,0xA4A1, 0, 0,0xA542,0xA541,0xA540, 0, +0xA543,0xA4FE, 0, 0, 0, 0,0xA5E0,0xA5E1, + 0, 0, 0, 0, 0, 0,0xA8C3, 0, + 0, 0, 0,0xA458, 0,0xA4A4,0xC950, 0, +0xA4A5,0xC963,0xA6EA,0xCBB1, 0, 0, 0, 0, +0xA459,0xA4A6, 0,0xA544,0xC964, 0, 0, 0, + 0, 0,0xC940,0xA444, 0,0xA45B, 0,0xC947, +0xA45C, 0, 0,0xA4A7, 0,0xA545,0xA547,0xA546, + 0, 0,0xA5E2,0xA5E3, 0, 0,0xA8C4, 0, +0xADBC,0xA441, 0, 0,0xC941,0xA445,0xA45E,0xA45D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA5E4, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA8C5, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xB0AE,0xD44B, + 0, 0,0xB6C3,0xDCB1,0xDCB2, 0,0xA446, 0, +0xA4A9, 0, 0,0xA8C6,0xA447,0xC948,0xA45F, 0, + 0,0xA4AA,0xA4AC,0xC951,0xA4AD,0xA4AB, 0, 0, + 0,0xA5E5, 0,0xA8C7, 0, 0,0xA8C8,0xAB45, + 0,0xA460,0xA4AE, 0,0xA5E6,0xA5E8,0xA5E7, 0, +0xA6EB, 0, 0,0xA8C9,0xA8CA,0xAB46,0xAB47, 0, + 0, 0, 0,0xADBD, 0, 0,0xDCB3, 0, + 0,0xF6D6,0xA448, 0, 0, 0, 0, 0, +0xA4B0,0xA4AF,0xC952,0xA4B1,0xA4B7, 0,0xA4B2,0xA4B3, +0xC954,0xC953,0xA4B5,0xA4B6, 0,0xA4B4, 0, 0, + 0, 0, 0, 0,0xA54A,0xA54B,0xA54C,0xA54D, +0xA549,0xA550,0xC96A, 0,0xC966,0xC969,0xA551,0xA561, + 0,0xC968, 0,0xA54E,0xA54F,0xA548, 0, 0, +0xC965,0xC967, 0, 0, 0, 0, 0, 0, +0xA5F5,0xC9B0,0xA5F2,0xA5F6,0xC9BA,0xC9AE,0xA5F3,0xC9B2, + 0, 0, 0,0xA5F4, 0,0xA5F7, 0,0xA5E9, +0xC9B1,0xA5F8,0xC9B5, 0,0xC9B9,0xC9B6, 0, 0, +0xC9B3,0xA5EA,0xA5EC,0xA5F9, 0,0xA5EE,0xC9AB,0xA5F1, +0xA5EF,0xA5F0,0xC9BB,0xC9B8,0xC9AF,0xA5ED, 0, 0, +0xC9AC,0xA5EB, 0, 0, 0,0xC9B4, 0, 0, + 0, 0,0xC9B7, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xC9AD,0xCA66, 0,0xA742, +0xA6F4, 0, 0,0xCA67,0xA6F1, 0,0xA744, 0, +0xA6F9, 0,0xA6F8,0xCA5B,0xA6FC,0xA6F7,0xCA60,0xCA68, + 0,0xCA64, 0,0xA6FA, 0, 0,0xA6FD,0xA6EE, +0xA747,0xCA5D, 0, 0,0xCBBD,0xA6EC,0xA743,0xA6ED, +0xA6F5,0xA6F6,0xCA62,0xCA5E,0xA6FB,0xA6F3,0xCA5A,0xA6EF, +0xCA65,0xA745,0xA748,0xA6F2,0xA740,0xA746,0xA6F0,0xCA63, +0xA741,0xCA69,0xCA5C,0xA6FE,0xCA5F, 0, 0,0xCA61, + 0,0xA8D8,0xCBBF,0xCBCB,0xA8D0, 0,0xCBCC,0xA8CB, +0xA8D5, 0, 0,0xA8CE,0xCBB9,0xA8D6,0xCBB8,0xCBBC, +0xCBC3,0xCBC1,0xA8DE,0xA8D9,0xCBB3,0xCBB5,0xA8DB,0xA8CF, +0xCBB6,0xCBC2,0xCBC9,0xA8D4,0xCBBB,0xCBB4,0xA8D3,0xCBB7, +0xA8D7,0xCBBA, 0,0xA8D2, 0,0xA8CD, 0,0xA8DC, +0xCBC4,0xA8DD,0xCBC8, 0,0xCBC6,0xCBCA,0xA8DA,0xCBBE, +0xCBB2, 0,0xCBC0,0xA8D1,0xCBC5,0xA8CC,0xCBC7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xAB56,0xAB4A, + 0, 0,0xCDE0,0xCDE8, 0,0xAB49,0xAB51,0xAB5D, + 0,0xCDEE,0xCDEC,0xCDE7, 0, 0, 0,0xAB4B, +0xCDED,0xCDE3,0xAB59,0xAB50,0xAB58,0xCDDE, 0,0xCDEA, + 0,0xCDE1,0xAB54,0xCDE2, 0,0xCDDD,0xAB5B,0xAB4E, +0xAB57,0xAB4D, 0,0xCDDF,0xCDE4, 0,0xCDEB,0xAB55, +0xAB52,0xCDE6,0xAB5A,0xCDE9,0xCDE5,0xAB4F,0xAB5C,0xAB53, +0xAB4C,0xAB48, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCDEF, 0,0xADD7,0xADC1, + 0,0xADD1, 0,0xADD6,0xD0D0,0xD0CF,0xD0D4,0xD0D5, +0xADC4, 0,0xADCD, 0, 0, 0,0xADDA, 0, +0xADCE, 0, 0, 0, 0,0xD0C9,0xADC7,0xD0CA, + 0,0xADDC, 0,0xADD3,0xADBE,0xADBF,0xD0DD,0xB0BF, + 0,0xADCC,0xADCB,0xD0CB,0xADCF,0xD45B,0xADC6,0xD0D6, +0xADD5,0xADD4,0xADCA,0xD0CE,0xD0D7, 0,0xD0C8,0xADC9, +0xD0D8,0xADD2,0xD0CC,0xADC0, 0,0xADC3,0xADC2,0xD0D9, +0xADD0,0xADC5,0xADD9,0xADDB,0xD0D3,0xADD8, 0,0xD0DB, +0xD0CD,0xD0DC, 0,0xD0D1, 0,0xD0DA, 0,0xD0D2, + 0, 0, 0, 0,0xADC8, 0, 0, 0, +0xD463,0xD457, 0,0xB0B3, 0,0xD45C,0xD462,0xB0B2, +0xD455,0xB0B6,0xD459,0xD452,0xB0B4,0xD456,0xB0B9,0xB0BE, + 0,0xD467, 0,0xD451, 0,0xB0BA, 0,0xD466, + 0, 0,0xB0B5,0xD458,0xB0B1,0xD453,0xD44F,0xD45D, +0xD450,0xD44E,0xD45A,0xD460,0xD461,0xB0B7, 0, 0, +0xD85B,0xD45E,0xD44D,0xD45F, 0,0xB0C1,0xD464,0xB0C0, +0xD44C, 0,0xD454,0xD465,0xB0BC,0xB0BB,0xB0B8,0xB0BD, + 0, 0,0xB0AF, 0, 0,0xB0B0, 0, 0, +0xB3C8, 0,0xD85E,0xD857, 0,0xB3C5, 0,0xD85F, + 0, 0, 0,0xD855,0xD858,0xB3C4,0xD859, 0, + 0,0xB3C7,0xD85D, 0,0xD853,0xD852,0xB3C9, 0, +0xB3CA,0xB3C6,0xB3CB,0xD851,0xD85C,0xD85A,0xD854, 0, + 0, 0,0xB3C3,0xD856, 0, 0, 0, 0, + 0, 0, 0, 0,0xB6CA,0xB6C4,0xDCB7,0xB6CD, +0xDCBD,0xDCC0,0xB6C6,0xB6C7,0xDCBA,0xB6C5,0xDCC3,0xB6CB, +0xDCC4, 0,0xDCBF,0xB6CC, 0,0xDCB4,0xB6C9,0xDCB5, + 0,0xDCBE,0xDCBC, 0,0xDCB8,0xB6C8,0xDCB6,0xB6CE, +0xDCBB,0xDCC2,0xDCB9,0xDCC1, 0, 0,0xB9B6,0xB9B3, + 0,0xB9B4, 0,0xE0F9,0xE0F1,0xB9B2,0xB9AF,0xE0F2, + 0, 0,0xB9B1,0xE0F5, 0,0xE0F7, 0, 0, +0xE0FE, 0, 0,0xE0FD,0xE0F8,0xB9AE,0xE0F0,0xB9AC, +0xE0F3,0xB9B7,0xE0F6, 0,0xE0FA,0xB9B0,0xB9AD,0xE0FC, +0xE0FB,0xB9B5, 0,0xE0F4, 0,0xBBF8,0xE4EC, 0, +0xE4E9,0xBBF9, 0,0xBBF7, 0,0xE4F0,0xE4ED,0xE4E6, +0xBBF6, 0,0xBBFA,0xE4E7,0xBBF5,0xBBFD,0xE4EA,0xE4EB, +0xBBFB,0xBBFC,0xE4F1,0xE4EE,0xE4EF, 0, 0, 0, +0xBEAA,0xE8F8,0xBEA7,0xE8F5,0xBEA9,0xBEAB, 0,0xE8F6, +0xBEA8, 0,0xE8F7, 0,0xE8F4, 0, 0,0xC076, +0xECBD,0xC077,0xECBB, 0,0xECBC,0xECBA,0xECB9, 0, + 0,0xECBE,0xC075, 0, 0,0xEFB8,0xEFB9, 0, +0xE4E8,0xEFB7,0xC078,0xC35F,0xF1EB,0xF1EC, 0,0xC4D7, +0xC4D8,0xF5C1,0xF5C0,0xC56C,0xC56B,0xF7D0, 0,0xA449, +0xA461,0xA4B9, 0,0xA4B8,0xA553,0xA552,0xA5FC,0xA5FB, +0xA5FD,0xA5FA, 0,0xA74A,0xA749,0xA74B, 0, 0, + 0, 0,0xA8E0, 0,0xA8DF,0xA8E1, 0,0xAB5E, + 0,0xA259,0xD0DE,0xA25A,0xB0C2,0xA25C,0xA25B,0xD860, + 0,0xA25D,0xB9B8,0xA25E, 0,0xA44A, 0,0xA4BA, +0xA5FE,0xA8E2, 0,0xA44B,0xA4BD,0xA4BB,0xA4BC, 0, + 0,0xA640, 0, 0, 0,0xA74C,0xA8E4,0xA8E3, +0xA8E5, 0, 0, 0,0xADDD, 0, 0, 0, +0xBEAC, 0, 0, 0, 0, 0, 0,0xC94E, + 0,0xA554,0xA555, 0, 0,0xA641, 0,0xCA6A, + 0,0xAB60,0xAB5F,0xD0E0,0xD0DF,0xB0C3, 0,0xA4BE, +0xC955, 0, 0, 0, 0, 0,0xCBCD, 0, +0xAB61, 0,0xADE0, 0,0xADDE,0xADDF, 0, 0, + 0, 0,0xBEAD, 0,0xA556, 0, 0, 0, +0xA642,0xC9BC, 0, 0, 0, 0,0xA74D,0xA74E, + 0,0xCA6B, 0, 0,0xCBCE,0xA8E6,0xCBCF, 0, + 0, 0, 0, 0,0xD0E2,0xD0E3,0xADE3, 0, +0xD0E4, 0,0xD0E1,0xADE4,0xADE2,0xADE1,0xD0E5, 0, +0xD468, 0, 0, 0,0xD861, 0, 0,0xDCC5, +0xE140, 0, 0, 0,0xBBFE,0xBEAE,0xE8F9, 0, +0xA44C,0xA45A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB0C4,0xB3CD, 0,0xB9B9, 0,0xC942,0xA4BF, 0, +0xA559,0xA557,0xA558, 0, 0,0xA8E7, 0, 0, +0xA44D,0xA44E, 0,0xA462, 0, 0,0xA4C0,0xA4C1, +0xA4C2,0xC9BE,0xA55A, 0,0xC96B, 0,0xA646, 0, +0xC9BF,0xA644,0xA645,0xC9BD, 0, 0,0xA647,0xA643, + 0, 0, 0, 0,0xCA6C,0xAAEC,0xCA6D, 0, + 0,0xCA6E, 0, 0,0xA750,0xA74F, 0, 0, +0xA753,0xA751,0xA752, 0, 0, 0,0xA8ED, 0, +0xA8EC,0xCBD4,0xCBD1,0xCBD2, 0,0xCBD0,0xA8EE,0xA8EA, +0xA8E9, 0,0xA8EB,0xA8E8, 0, 0, 0, 0, + 0,0xA8EF, 0,0xAB63,0xCDF0, 0,0xCBD3,0xAB68, + 0,0xCDF1,0xAB64,0xAB67,0xAB66,0xAB65,0xAB62, 0, + 0, 0,0xD0E8, 0,0xADE7,0xD0EB,0xADE5, 0, + 0, 0,0xD0E7,0xADE8,0xADE6,0xADE9,0xD0E9,0xD0EA, + 0,0xD0E6,0xD0EC, 0, 0, 0, 0, 0, + 0,0xB3D1,0xB0C5,0xD469,0xD46B,0xD46A,0xD46C,0xB0C6, + 0, 0,0xB3CE, 0,0xB3CF,0xB3D0, 0,0xB6D0, +0xDCC7, 0,0xDCC6,0xDCC8,0xDCC9,0xB6D1, 0,0xB6CF, +0xE141,0xE142,0xB9BB,0xB9BA,0xE35A, 0, 0,0xBC40, +0xBC41,0xBC42,0xBC44,0xE4F2,0xE4F3,0xBC43, 0, 0, + 0,0xBEAF, 0,0xBEB0, 0, 0,0xF1ED,0xF5C3, +0xF5C2,0xF7D1, 0,0xA44F, 0, 0, 0,0xA55C, +0xA55B, 0, 0,0xA648, 0, 0,0xC9C0, 0, + 0,0xA755,0xA756,0xA754,0xA757,0xCA6F,0xCA70, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA8F1,0xCBD5, 0,0xA8F0, 0, +0xCDF2,0xAB6C,0xCDF3,0xAB6B, 0, 0, 0,0xAB69, + 0,0xAB6A, 0, 0, 0,0xD0ED, 0, 0, + 0, 0,0xB0C7,0xD46E, 0,0xB0CA,0xD46D,0xB1E5, +0xB0C9,0xB0C8, 0,0xB3D4, 0,0xB3D3,0xB3D2,0xB6D2, + 0, 0,0xB6D5,0xB6D6,0xB6D4, 0,0xB6D3, 0, + 0,0xE143, 0,0xE144, 0, 0, 0,0xE4F5, +0xBC45,0xE4F4, 0,0xBEB1,0xECBF,0xC079, 0,0xF1EE, +0xC455, 0,0xA463,0xA4C3,0xC956, 0,0xA4C4,0xA4C5, + 0, 0, 0, 0, 0,0xA55D,0xA55E, 0, +0xA649,0xCA71,0xCBD6,0xCBD7, 0,0xAB6D,0xD0EE,0xB0CC, +0xB0CB,0xD863,0xD862, 0, 0,0xA450,0xA4C6,0xA55F, + 0,0xB0CD,0xC943, 0,0xC96C,0xA560, 0,0xC9C2, +0xA64B,0xA64A,0xC9C1,0xA758, 0, 0, 0, 0, + 0, 0,0xADEA, 0, 0,0xD46F, 0,0xB6D7, +0xE145,0xB9BC, 0, 0,0xE8FA, 0, 0,0xF3FD, + 0,0xA4C7, 0, 0,0xCBD8,0xCDF4,0xB0D0,0xB0CE, +0xB0CF,0xA451, 0,0xA464,0xA2CD,0xA4CA, 0,0xA4C9, +0xA4C8,0xA563,0xA562, 0,0xC96D,0xC9C3, 0, 0, + 0,0xA8F5,0xA8F2,0xA8F4,0xA8F3, 0, 0,0xAB6E, + 0, 0,0xB3D5, 0,0xA452, 0,0xA4CB, 0, +0xA565,0xA564, 0,0xCA72, 0, 0,0xA8F6, 0, + 0, 0, 0, 0,0xC957, 0,0xA567,0xA566, +0xA64C,0xA64D,0xCA73,0xA759, 0,0xA75A, 0,0xA8F7, +0xA8F8,0xA8F9, 0,0xAB6F,0xCDF5, 0, 0,0xADEB, + 0, 0,0xC944, 0,0xA4CC, 0, 0, 0, + 0, 0,0xC9C4, 0, 0, 0,0xCA74,0xCA75, + 0, 0,0xCBD9, 0,0xCBDA, 0,0xCDF7,0xCDF6, +0xCDF9,0xCDF8,0xAB70, 0,0xD470,0xADED,0xD0EF,0xADEC, + 0, 0, 0, 0,0xD864,0xB3D6, 0,0xD865, + 0, 0, 0, 0,0xE146,0xB9BD, 0, 0, + 0, 0,0xBC46, 0,0xF1EF, 0, 0, 0, + 0,0xC958, 0,0xA568, 0, 0, 0, 0, + 0, 0, 0,0xB0D1, 0, 0, 0, 0, +0xA453,0xA465,0xA4CE,0xA4CD, 0,0xA4CF, 0, 0, + 0, 0, 0, 0,0xA8FB, 0,0xA8FA,0xA8FC, + 0, 0, 0,0xAB71, 0, 0, 0,0xADEE, + 0,0xE8FB,0xC24F,0xA466,0xA56A,0xA579,0xA574, 0, +0xA56F,0xA56E,0xA575,0xA573,0xA56C,0xA57A,0xA56D,0xA569, +0xA578,0xA577,0xA576,0xA56B, 0,0xA572, 0, 0, +0xA571, 0, 0,0xA57B,0xA570, 0, 0, 0, + 0,0xA653, 0,0xA659,0xA655, 0,0xA65B,0xC9C5, +0xA658,0xA64E,0xA651,0xA654,0xA650,0xA657,0xA65A,0xA64F, +0xA652,0xA656,0xA65C, 0, 0, 0, 0, 0, +0xCA7E,0xCA7B, 0,0xA767,0xCA7C,0xA75B,0xA75D,0xA775, +0xA770, 0, 0, 0,0xCAA5,0xCA7D,0xA75F,0xA761, +0xCAA4,0xA768,0xCA78,0xA774,0xA776,0xA75C,0xA76D, 0, +0xCA76,0xA773, 0,0xA764, 0,0xA76E,0xA76F,0xCA77, +0xA76C,0xA76A, 0,0xA76B,0xA771,0xCAA1,0xA75E, 0, +0xA772,0xCAA3,0xA766,0xA763, 0,0xCA7A,0xA762,0xCAA6, +0xA765, 0,0xA769, 0, 0, 0,0xA760,0xCAA2, + 0, 0, 0, 0,0xCA79, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCBEB,0xCBEA,0xA94F,0xCBED,0xCBEF,0xCBE4,0xCBE7,0xCBEE, +0xA950, 0, 0,0xCBE1,0xCBE5, 0, 0,0xCBE9, +0xCE49,0xA94B,0xCE4D,0xA8FD,0xCBE6,0xA8FE,0xA94C,0xA945, +0xA941, 0,0xCBE2,0xA944,0xA949,0xA952,0xCBE3,0xCBDC, +0xA943,0xCBDD,0xCBDF, 0,0xA946, 0,0xA948,0xCBDB, +0xCBE0, 0, 0,0xA951,0xA94D,0xCBE8,0xA953, 0, +0xA94A,0xCBDE,0xA947, 0, 0,0xA942,0xA940, 0, +0xCBEC, 0,0xA94E, 0, 0, 0, 0, 0, +0xCE48,0xCDFB,0xCE4B, 0, 0,0xCDFD,0xAB78,0xABA8, +0xAB74,0xABA7,0xAB7D,0xABA4,0xAB72,0xCDFC,0xCE43,0xABA3, +0xCE4F,0xABA5, 0,0xAB79, 0, 0,0xCE45,0xCE42, +0xAB77, 0,0xCDFA,0xABA6,0xCE4A,0xAB7C,0xCE4C,0xABA9, +0xAB73,0xAB7E,0xAB7B,0xCE40,0xABA1,0xCE46,0xCE47,0xAB7A, +0xABA2,0xAB76, 0, 0, 0, 0,0xAB75,0xCDFE, + 0, 0, 0, 0, 0, 0,0xCE44, 0, + 0, 0, 0, 0, 0, 0,0xCE4E, 0, +0xD144,0xADFB,0xD0F1, 0,0xD0F6,0xADF4,0xAE40,0xD0F4, +0xADEF,0xADF9,0xADFE,0xD0FB, 0,0xADFA,0xADFD, 0, + 0,0xD0FE,0xADF5,0xD0F5, 0, 0, 0,0xD142, +0xD143, 0,0xADF7,0xD141,0xADF3,0xAE43, 0,0xD0F8, + 0,0xADF1, 0,0xD146,0xD0F9,0xD0FD,0xADF6,0xAE42, +0xD0FA,0xADFC,0xD140,0xD147,0xD4A1, 0,0xD145,0xAE44, +0xADF0,0xD0FC,0xD0F3, 0,0xADF8, 0, 0,0xD0F2, + 0, 0,0xD0F7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD0F0,0xAE41, + 0, 0,0xD477, 0,0xB0E4,0xD4A7,0xB0E2,0xB0DF, +0xD47C,0xB0DB,0xD4A2,0xB0E6,0xD476,0xD47B,0xD47A,0xADF2, +0xB0E1,0xD4A5, 0,0xD4A8,0xD473, 0,0xB3E8, 0, +0xD4A9,0xB0E7, 0,0xB0D9,0xB0D6,0xD47E,0xB0D3, 0, +0xD4A6, 0,0xB0DA,0xD4AA, 0,0xD474,0xD4A4,0xB0DD, +0xD475,0xD478,0xD47D, 0, 0,0xB0DE,0xB0DC,0xB0E8, + 0, 0, 0, 0,0xB0E3, 0,0xB0D7,0xB1D2, + 0,0xB0D8,0xD479,0xB0E5,0xB0E0,0xD4A3,0xB0D5, 0, + 0, 0,0xB0D4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD471,0xD472,0xD86A, + 0, 0, 0,0xB3D7,0xB3DA,0xD875,0xB3EE,0xD878, +0xB3D8,0xD871,0xB3DE,0xB3E4,0xB5BD, 0, 0,0xB3E2, +0xD86E,0xB3EF,0xB3DB,0xB3E3,0xD876,0xDCD7,0xD87B,0xD86F, + 0,0xD866,0xD873,0xD86D,0xB3E1,0xD879, 0, 0, +0xB3DD,0xB3F1,0xB3EA, 0,0xB3DF,0xB3DC, 0,0xB3E7, + 0,0xD87A,0xD86C,0xD872,0xD874,0xD868,0xD877,0xB3D9, +0xD867, 0,0xB3E0,0xB3F0,0xB3EC,0xD869,0xB3E6, 0, + 0,0xB3ED,0xB3E9,0xB3E5, 0,0xD870, 0, 0, + 0, 0, 0,0xB3EB, 0, 0, 0,0xDCD5, +0xDCD1, 0,0xDCE0,0xDCCA,0xDCD3,0xB6E5,0xB6E6,0xB6DE, +0xDCDC,0xB6E8,0xDCCF,0xDCCE,0xDCCC,0xDCDE,0xB6DC,0xDCD8, +0xDCCD,0xB6DF,0xDCD6,0xB6DA,0xDCD2,0xDCD9,0xDCDB, 0, + 0,0xDCDF,0xB6E3,0xDCCB,0xB6DD,0xDCD0, 0,0xB6D8, + 0,0xB6E4,0xDCDA,0xB6E0,0xB6E1,0xB6E7,0xB6DB,0xA25F, +0xB6D9,0xDCD4, 0, 0, 0, 0, 0,0xB6E2, + 0, 0,0xDCDD, 0, 0, 0,0xB9CD,0xB9C8, + 0,0xE155,0xE151, 0,0xE14B,0xB9C2,0xB9BE,0xE154, +0xB9BF,0xE14E,0xE150, 0,0xE153, 0,0xB9C4, 0, +0xB9CB,0xB9C5, 0, 0,0xE149,0xB9C6,0xB9C7,0xE14C, +0xB9CC, 0,0xE14A,0xE14F,0xB9C3,0xE148,0xB9C9,0xB9C1, + 0, 0, 0,0xB9C0,0xE14D,0xE152, 0,0xB9CA, + 0, 0, 0, 0, 0, 0, 0,0xE147, + 0,0xBC4D,0xE547, 0,0xE544, 0,0xBC47,0xBC53, +0xBC54, 0,0xBC4A,0xE542,0xBC4C,0xE4F9,0xBC52, 0, +0xE546,0xBC49,0xE548,0xBC48, 0,0xE543,0xE545,0xBC4B, +0xE541,0xE4FA,0xE4F7, 0, 0,0xD86B,0xE4FD, 0, +0xE4F6,0xE4FC,0xE4FB, 0,0xE4F8, 0,0xBC4F, 0, + 0, 0, 0,0xBC4E, 0, 0, 0,0xBC50, +0xE4FE,0xBEB2,0xE540, 0, 0, 0,0xE945, 0, +0xE8FD, 0,0xBEBE,0xE942,0xBEB6,0xBEBA,0xE941, 0, +0xBEB9,0xBEB5,0xBEB8,0xBEB3,0xBEBD,0xE943,0xE8FE,0xBEBC, +0xE8FC,0xBEBB,0xE944,0xE940,0xBC51, 0,0xBEBF,0xE946, +0xBEB7,0xBEB4, 0, 0, 0, 0,0xECC6,0xECC8, +0xC07B,0xECC9,0xECC7,0xECC5,0xECC4,0xC07D,0xECC3,0xC07E, + 0, 0, 0, 0,0xECC1,0xECC2,0xC07A,0xC0A1, +0xC07C, 0, 0,0xECC0, 0,0xC250, 0,0xEFBC, +0xEFBA,0xEFBF,0xEFBD, 0,0xEFBB,0xEFBE, 0, 0, + 0, 0, 0, 0, 0,0xC360,0xF1F2,0xF1F3, +0xC456, 0,0xF1F4,0xF1F0,0xF1F5,0xF1F1,0xC251, 0, + 0, 0,0xF3FE,0xF441,0xC459,0xF440,0xC458,0xC457, + 0, 0, 0, 0,0xC45A,0xF5C5,0xF5C6, 0, +0xC4DA,0xC4D9,0xC4DB,0xF5C4, 0,0xF6D8,0xF6D7, 0, +0xC56D,0xC56F,0xC56E,0xF6D9,0xC5C8,0xF8A6, 0, 0, + 0,0xC5F1, 0,0xF8A5,0xF8EE, 0, 0,0xC949, + 0, 0,0xA57D,0xA57C, 0,0xA65F,0xA65E,0xC9C7, +0xA65D,0xC9C6, 0, 0,0xA779,0xCAA9, 0,0xCAA8, + 0, 0,0xA777,0xA77A, 0, 0,0xCAA7, 0, +0xA778, 0, 0, 0, 0, 0, 0,0xCBF0, + 0,0xCBF1,0xA954, 0, 0, 0, 0,0xABAA, + 0,0xD148,0xD149,0xAE45,0xAE46, 0, 0,0xD4AC, +0xB0E9,0xB0EB,0xD4AB,0xB0EA,0xD87C,0xB3F2, 0, 0, + 0, 0,0xB6E9,0xB6EA,0xDCE1, 0,0xB9CF, 0, +0xB9CE, 0,0xE549,0xE948,0xE947, 0,0xF96B,0xA467, +0xC959, 0,0xC96E,0xC96F, 0, 0, 0, 0, +0xA662,0xA666,0xC9C9, 0,0xA664,0xA663,0xC9C8,0xA665, +0xA661, 0, 0,0xA660,0xC9CA, 0, 0, 0, + 0, 0, 0,0xA7A6, 0, 0,0xA7A3, 0, +0xA77D,0xCAAA, 0, 0, 0,0xCAAB, 0,0xA7A1, + 0,0xCAAD,0xA77B,0xCAAE,0xCAAC,0xA77E,0xA7A2,0xA7A5, +0xA7A4,0xA77C,0xCAAF, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA959,0xCBFE, 0,0xA95B, 0,0xA95A, 0, +0xCC40,0xA958,0xA957,0xCBF5, 0,0xCBF4, 0,0xCBF2, +0xCBF7,0xCBF6,0xCBF3,0xCBFC,0xCBFD,0xCBFA,0xCBF8,0xA956, + 0, 0, 0,0xCBFB,0xA95C,0xCC41, 0, 0, +0xCBF9, 0,0xABAB,0xA955, 0, 0, 0, 0, + 0, 0, 0,0xABAC,0xCE54, 0, 0,0xCE5A, + 0, 0, 0,0xABB2,0xCE58,0xCE5E, 0,0xCE55, +0xCE59,0xCE5B,0xCE5D,0xCE57, 0,0xCE56,0xCE51,0xCE52, +0xABAD, 0,0xABAF,0xABAE,0xCE53,0xCE5C, 0, 0, + 0, 0, 0, 0, 0, 0,0xABB1, 0, + 0, 0, 0, 0, 0,0xCE50,0xD153, 0, +0xD152,0xD157,0xD14E, 0,0xD151,0xD150, 0,0xD154, + 0,0xD158,0xAE47,0xAE4A, 0, 0,0xD14F,0xD155, + 0, 0, 0,0xAE49,0xD14A, 0,0xABB0,0xD4BA, +0xD156, 0,0xD14D, 0,0xAE48,0xD14C, 0, 0, + 0, 0, 0, 0,0xD4B1, 0, 0,0xB0EC, +0xB0F0,0xD4C1,0xD4AF,0xD4BD,0xB0F1,0xD4BF, 0,0xD4C5, + 0,0xD4C9, 0, 0,0xD4C0,0xD4B4,0xD4BC, 0, +0xD4CA,0xD4C8,0xD4BE,0xD4B9,0xD4B2,0xD8A6,0xD4B0,0xB0F5, +0xD4B7,0xB0F6,0xB0F2,0xD4AD,0xD4C3,0xD4B5, 0, 0, +0xD4B3,0xD4C6,0xB0F3, 0,0xD4CC,0xB0ED,0xB0EF,0xD4BB, +0xD4B6,0xAE4B,0xB0EE,0xD4B8,0xD4C7,0xD4CB,0xD4C2, 0, +0xD4C4, 0, 0, 0,0xD4AE, 0, 0, 0, + 0,0xD8A1, 0,0xD8AA,0xD8A9,0xB3FA,0xD8A2, 0, +0xB3FB,0xB3F9, 0,0xD8A4,0xB3F6,0xD8A8, 0,0xD8A3, +0xD8A5,0xD87D,0xB3F4, 0,0xD8B2,0xD8B1,0xD8AE,0xB3F3, +0xB3F7,0xB3F8,0xD14B,0xD8AB,0xB3F5,0xB0F4,0xD8AD,0xD87E, +0xD8B0,0xD8AF, 0,0xD8B3, 0,0xDCEF, 0,0xD8AC, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD8A7,0xDCE7,0xB6F4,0xB6F7,0xB6F2,0xDCE6,0xDCEA,0xDCE5, + 0,0xB6EC,0xB6F6,0xDCE2,0xB6F0,0xDCE9, 0,0xB6EE, +0xB6ED,0xDCEC,0xB6EF,0xDCEE, 0,0xDCEB,0xB6EB, 0, + 0, 0,0xB6F5,0xDCF0,0xDCE4,0xDCED, 0, 0, +0xDCE3, 0, 0,0xB6F1, 0,0xB6F3, 0,0xDCE8, + 0,0xDCF1, 0, 0,0xE15D,0xB9D0,0xE163, 0, + 0,0xB9D5,0xE15F,0xE166,0xE157,0xB9D7,0xB9D1,0xE15C, +0xBC55,0xE15B,0xE164,0xB9D2, 0,0xB9D6,0xE15A,0xE160, +0xE165,0xE156,0xB9D4,0xE15E, 0, 0,0xE162,0xE168, +0xE158,0xE161, 0,0xB9D3,0xE167, 0, 0, 0, +0xE159, 0, 0, 0,0xBC59,0xE54B,0xBC57,0xBC56, +0xE54D,0xE552, 0,0xE54E, 0,0xE551,0xBC5C, 0, +0xBEA5,0xBC5B, 0,0xE54A,0xE550, 0,0xBC5A,0xE54F, + 0,0xE54C, 0,0xBC58, 0, 0, 0, 0, + 0, 0,0xE94D,0xF9D9,0xE94F,0xE94A,0xBEC1,0xE94C, + 0,0xBEC0,0xE94E, 0, 0,0xBEC3,0xE950,0xBEC2, +0xE949,0xE94B, 0, 0, 0, 0,0xC0A5,0xECCC, + 0,0xC0A4,0xECCD,0xC0A3,0xECCB,0xC0A2,0xECCA, 0, +0xC253,0xC252,0xF1F6,0xF1F8, 0,0xF1F7,0xC361,0xC362, + 0, 0,0xC363,0xF442,0xC45B, 0, 0,0xF7D3, +0xF7D2,0xC5F2, 0,0xA468,0xA4D0, 0, 0,0xA7A7, + 0, 0, 0, 0,0xCE5F, 0, 0, 0, + 0,0xB3FC,0xB3FD, 0,0xDCF2,0xB9D8,0xE169,0xE553, + 0, 0, 0,0xC95A, 0, 0,0xCAB0, 0, + 0, 0, 0, 0,0xCC42,0xCE60,0xD159,0xAE4C, + 0, 0,0xF1F9, 0,0xC4DC,0xA469,0xA57E,0xC970, + 0,0xA667,0xA668, 0,0xA95D, 0, 0, 0, +0xB0F7, 0,0xB9DA, 0,0xB9DB,0xB9D9, 0,0xA46A, + 0,0xA4D1,0xA4D3,0xA4D2,0xC95B,0xA4D4,0xA5A1,0xC971, + 0,0xA5A2, 0, 0, 0, 0, 0,0xA669, +0xA66A, 0, 0, 0,0xC9CB, 0,0xA7A8, 0, +0xCAB1, 0, 0, 0,0xA961,0xCC43, 0,0xA95F, +0xA960,0xA95E,0xD15A, 0, 0, 0,0xABB6,0xABB5, +0xABB7,0xABB4, 0,0xCE61,0xA962,0xABB3, 0,0xAE4D, +0xAE4E, 0,0xAE4F, 0,0xD4CD, 0, 0, 0, +0xB3FE,0xD8B4,0xB0F8, 0, 0, 0, 0,0xB6F8, + 0,0xB9DD,0xB9DC,0xE16A, 0,0xBC5D,0xBEC4, 0, +0xEFC0,0xF6DA,0xF7D4,0xA46B,0xA5A3, 0,0xA5A4,0xC9D1, +0xA66C,0xA66F, 0,0xC9CF,0xC9CD,0xA66E,0xC9D0,0xC9D2, +0xC9CC,0xA671,0xA670,0xA66D,0xA66B,0xC9CE, 0, 0, + 0, 0,0xA7B3, 0, 0,0xA7B0,0xCAB6,0xCAB9, +0xCAB8, 0,0xA7AA,0xA7B2, 0, 0,0xA7AF,0xCAB5, +0xCAB3,0xA7AE, 0, 0, 0,0xA7A9,0xA7AC, 0, +0xCAB4,0xCABB,0xCAB7,0xA7AD,0xA7B1,0xA7B4,0xCAB2,0xCABA, +0xA7AB, 0, 0, 0, 0, 0,0xA967,0xA96F, + 0,0xCC4F,0xCC48,0xA970,0xCC53,0xCC44,0xCC4B, 0, + 0,0xA966,0xCC45,0xA964,0xCC4C,0xCC50,0xA963, 0, +0xCC51,0xCC4A, 0,0xCC4D, 0,0xA972,0xA969,0xCC54, +0xCC52, 0,0xA96E,0xA96C,0xCC49,0xA96B,0xCC47,0xCC46, +0xA96A,0xA968,0xA971,0xA96D,0xA965, 0,0xCC4E, 0, +0xABB9, 0,0xABC0,0xCE6F,0xABB8,0xCE67,0xCE63, 0, +0xCE73,0xCE62, 0,0xABBB,0xCE6C,0xABBE,0xABC1, 0, +0xABBC,0xCE70,0xABBF, 0,0xAE56,0xCE76,0xCE64, 0, + 0,0xCE66,0xCE6D,0xCE71,0xCE75,0xCE72,0xCE6B,0xCE6E, + 0, 0,0xCE68,0xABC3,0xCE6A,0xCE69,0xCE74,0xABBA, +0xCE65,0xABC2, 0,0xABBD, 0, 0, 0, 0, + 0,0xAE5C,0xD162, 0,0xAE5B, 0, 0,0xD160, + 0,0xAE50, 0,0xAE55, 0,0xD15F,0xD15C,0xD161, +0xAE51,0xD15B, 0,0xAE54,0xAE52, 0,0xD163,0xAE53, +0xAE57, 0, 0,0xAE58, 0,0xAE5A, 0, 0, + 0,0xAE59, 0, 0, 0,0xD15D,0xD15E, 0, + 0, 0, 0,0xD164, 0,0xD4D4,0xB0F9,0xD8C2, +0xD4D3,0xD4E6, 0, 0,0xB140, 0,0xD4E4, 0, +0xB0FE,0xB0FA,0xD4ED,0xD4DD,0xD4E0, 0,0xB143,0xD4EA, +0xD4E2,0xB0FB,0xB144, 0,0xD4E7,0xD4E5, 0, 0, +0xD4D6,0xD4EB,0xD4DF,0xD4DA, 0,0xD4D0,0xD4EC,0xD4DC, +0xD4CF, 0,0xB142,0xD4E1,0xD4EE,0xD4DE,0xD4D2,0xD4D7, +0xD4CE, 0,0xB141, 0,0xD4DB,0xD4D8,0xB0FC,0xD4D1, + 0,0xD4E9,0xB0FD, 0,0xD4D9,0xD4D5, 0, 0, +0xD4E8, 0, 0, 0, 0, 0, 0,0xB440, +0xD8BB, 0,0xD8B8,0xD8C9,0xD8BD,0xD8CA, 0,0xB442, + 0, 0, 0,0xD8C6,0xD8C3, 0, 0, 0, + 0, 0,0xD8C4,0xD8C7,0xD8CB, 0,0xD4E3,0xD8CD, +0xDD47, 0,0xB443,0xD8CE,0xD8B6,0xD8C0, 0,0xD8C5, + 0, 0,0xB441,0xB444,0xD8CC,0xD8CF,0xD8BA,0xD8B7, + 0, 0,0xD8B9, 0, 0,0xD8BE,0xD8BC,0xB445, + 0,0xD8C8, 0, 0,0xD8BF, 0,0xD8C1,0xD8B5, +0xDCFA,0xDCF8,0xB742,0xB740,0xDD43,0xDCF9,0xDD44,0xDD40, +0xDCF7,0xDD46,0xDCF6,0xDCFD,0xB6FE,0xB6FD,0xB6FC,0xDCFB, +0xDD41,0xB6F9,0xB741, 0,0xDCF4, 0,0xDCFE,0xDCF3, +0xDCFC,0xB6FA,0xDD42,0xDCF5,0xB6FB,0xDD45, 0, 0, + 0, 0, 0, 0, 0,0xE16E,0xB9E2,0xB9E1, +0xB9E3,0xE17A,0xE170,0xE176,0xE16B,0xE179,0xE178,0xE17C, +0xE175,0xB9DE,0xE174,0xB9E4, 0,0xE16D,0xB9DF, 0, +0xE17B,0xB9E0,0xE16F,0xE172,0xE177,0xE171,0xE16C, 0, + 0, 0, 0,0xE173,0xE555,0xBC61,0xE558,0xE557, +0xE55A,0xE55C,0xF9DC,0xBC5F, 0,0xE556, 0,0xE554, + 0,0xE55D,0xE55B,0xE559, 0,0xE55F, 0,0xE55E, +0xBC63,0xBC5E, 0,0xBC60,0xBC62, 0, 0,0xE560, +0xE957, 0, 0,0xE956,0xE955, 0,0xE958,0xE951, + 0,0xE952,0xE95A,0xE953, 0,0xBEC5,0xE95C, 0, +0xE95B,0xE954, 0,0xECD1,0xC0A8,0xECCF,0xECD4,0xECD3, +0xE959, 0,0xC0A7, 0,0xECD2,0xECCE,0xECD6,0xECD5, +0xC0A6, 0,0xECD0, 0,0xBEC6, 0, 0, 0, +0xC254, 0, 0, 0,0xEFC1,0xF1FA,0xF1FB,0xF1FC, +0xC45C, 0, 0,0xC45D, 0,0xF443, 0,0xF5C8, +0xF5C7, 0, 0,0xF6DB,0xF6DC,0xF7D5,0xF8A7, 0, +0xA46C,0xA46D, 0,0xA46E,0xA4D5,0xA5A5,0xC9D3,0xA672, +0xA673, 0,0xA7B7,0xA7B8,0xA7B6,0xA7B5, 0,0xA973, + 0, 0,0xCC55,0xA975,0xA974,0xCC56, 0, 0, + 0,0xABC4, 0,0xAE5D,0xD165, 0,0xD4F0, 0, +0xB145,0xB447,0xD4EF,0xB446, 0,0xB9E5, 0,0xE17D, +0xBEC7, 0,0xC0A9,0xECD7, 0,0xC45E, 0,0xC570, + 0,0xC972, 0,0xA5A6,0xC973,0xA676, 0,0xA674, +0xA675,0xA677, 0,0xA7BA,0xA7B9, 0,0xCABC,0xA7BB, + 0, 0,0xCABD,0xCC57, 0,0xCC58, 0,0xA976, +0xA978,0xA97A,0xA977,0xA97B,0xA979, 0, 0, 0, + 0, 0,0xABC8,0xABC5,0xABC7,0xABC9,0xABC6,0xD166, +0xCE77, 0, 0, 0,0xD168,0xD167,0xAE63, 0, +0xAE5F, 0, 0,0xAE60,0xAE62,0xAE64,0xAE61, 0, +0xAE66,0xAE65, 0, 0, 0, 0, 0,0xB14A, +0xD4F2,0xD4F1,0xB149, 0,0xB148,0xB147,0xB14B,0xB146, + 0, 0,0xD8D5,0xD8D2,0xB449,0xD8D1,0xD8D6, 0, +0xB44B,0xD8D4,0xB448,0xB44A,0xD8D3, 0,0xDD48, 0, +0xDD49,0xDD4A, 0, 0, 0, 0,0xB9E6,0xB9EE, +0xE17E,0xB9E8,0xB9EC,0xE1A1,0xB9ED,0xB9E9,0xB9EA,0xB9E7, +0xB9EB,0xBC66,0xD8D0,0xBC67,0xBC65, 0,0xBC64,0xE95D, +0xBEC8,0xECD8,0xECD9, 0, 0,0xC364,0xC45F, 0, +0xA46F, 0,0xA678, 0, 0, 0, 0, 0, + 0,0xABCA, 0,0xD169,0xAE67, 0, 0,0xB14E, +0xB14D,0xB14C,0xB44C,0xB44D,0xD8D7,0xB9EF,0xBEC9,0xA470, +0xC95C,0xA4D6,0xC974, 0, 0,0xC9D4,0xA679, 0, + 0, 0,0xA97C, 0, 0, 0, 0,0xDD4B, + 0, 0,0xA471, 0,0xA4D7,0xC9D5, 0, 0, +0xCABE, 0,0xCABF, 0,0xA7BC, 0, 0, 0, +0xD8D8,0xB44E, 0,0xDD4C, 0, 0, 0,0xC0AA, +0xA472,0xA4A8,0xA4D8,0xC975,0xA5A7, 0,0xA7C0,0xA7BF, +0xA7BD,0xA7BE, 0, 0,0xCC59,0xA97E,0xA9A1,0xCC5A, +0xA97D, 0, 0,0xABCE,0xCE78,0xABCD,0xABCB,0xABCC, +0xAE6A,0xAE68, 0, 0,0xD16B,0xAE69,0xD16A, 0, +0xAE5E,0xD4F3, 0, 0,0xB150,0xB151, 0, 0, +0xB14F, 0,0xB9F0,0xE1A2,0xBC68,0xBC69, 0,0xE561, +0xC0AB,0xEFC2,0xEFC3, 0,0xC4DD,0xF8A8,0xC94B,0xA4D9, + 0,0xA473, 0,0xC977,0xC976, 0, 0, 0, + 0,0xA67A,0xC9D7,0xC9D8,0xC9D6, 0,0xC9D9, 0, + 0, 0, 0, 0, 0, 0,0xCAC7, 0, +0xCAC2,0xCAC4,0xCAC6,0xCAC3,0xA7C4,0xCAC0, 0,0xCAC1, +0xA7C1,0xA7C2,0xCAC5,0xCAC8,0xA7C3,0xCAC9, 0, 0, + 0, 0, 0, 0, 0,0xCC68, 0,0xCC62, +0xCC5D,0xA9A3,0xCC65,0xCC63,0xCC5C,0xCC69,0xCC6C,0xCC67, +0xCC60,0xA9A5,0xCC66,0xA9A6,0xCC61,0xCC64,0xCC5B,0xCC5F, +0xCC6B,0xA9A7, 0,0xA9A8, 0,0xCC5E,0xCC6A,0xA9A2, +0xA9A4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xCEAB,0xCEA4, +0xCEAA,0xCEA3,0xCEA5,0xCE7D,0xCE7B, 0,0xCEAC,0xCEA9, +0xCE79, 0,0xABD0,0xCEA7,0xCEA8, 0,0xCEA6,0xCE7C, +0xCE7A,0xABCF,0xCEA2,0xCE7E, 0, 0,0xCEA1,0xCEAD, + 0, 0, 0, 0, 0, 0, 0, 0, +0xAE6F, 0,0xAE6E, 0,0xD16C,0xAE6B,0xD16E, 0, +0xAE70,0xD16F, 0, 0,0xAE73, 0,0xAE71,0xD170, +0xCEAE,0xD172, 0,0xAE6D, 0,0xAE6C, 0,0xD16D, +0xD171,0xAE72, 0, 0, 0, 0,0xB153,0xB152, + 0, 0, 0,0xD4F5,0xD4F9,0xD4FB,0xB154,0xD4FE, + 0,0xB158,0xD541, 0,0xB15A, 0,0xB156,0xB15E, + 0,0xB15B,0xD4F7,0xB155, 0,0xD4F6,0xD4F4,0xD543, +0xD4F8, 0,0xB157,0xD542,0xB15C,0xD4FD,0xD4FC,0xB15D, +0xD4FA,0xB159, 0, 0, 0, 0,0xD544, 0, +0xD540,0xD8E7,0xD8EE,0xD8E3,0xB451,0xD8DF,0xD8EF,0xD8D9, +0xD8EC,0xD8EA,0xD8E4, 0,0xD8ED,0xD8E6, 0,0xD8DE, +0xD8F0,0xD8DC,0xD8E9,0xD8DA, 0,0xD8F1, 0,0xB452, + 0,0xD8EB,0xDD4F,0xD8DD,0xB44F, 0,0xD8E1, 0, +0xB450,0xD8E0,0xD8E5, 0, 0,0xD8E2, 0, 0, + 0,0xD8E8, 0, 0, 0, 0,0xDD53, 0, + 0, 0,0xDD56,0xDD4E, 0,0xDD50, 0,0xDD55, +0xDD54,0xB743, 0,0xD8DB,0xDD52, 0, 0,0xB744, + 0,0xDD4D,0xDD51, 0, 0, 0, 0,0xE1A9, + 0,0xE1B0,0xE1A7, 0,0xE1AE,0xE1A5,0xE1AD,0xE1B1, +0xE1A4,0xE1A8,0xE1A3, 0,0xB9F1, 0,0xE1A6,0xB9F2, +0xE1AC,0xE1AB,0xE1AA, 0, 0,0xE1AF, 0, 0, + 0, 0,0xE565,0xE567,0xBC6B,0xE568, 0,0xE563, + 0,0xE562,0xE56C, 0,0xE56A,0xBC6A,0xE56D,0xE564, +0xE569,0xE56B,0xE566, 0, 0, 0, 0,0xE961, +0xE966,0xE960,0xE965, 0,0xE95E,0xE968,0xE964,0xE969, +0xE963,0xE95F,0xE967, 0,0xE96A,0xE962, 0,0xECDA, +0xC0AF, 0,0xC0AD, 0,0xC0AC,0xC0AE, 0, 0, +0xEFC4, 0,0xF172,0xF1FD, 0, 0,0xF444,0xF445, + 0,0xC460, 0,0xF5C9, 0,0xC4DE, 0,0xF5CA, + 0,0xF6DE,0xC572, 0,0xC571,0xF6DD,0xC5C9, 0, +0xF7D6, 0, 0, 0, 0,0xA474,0xA67B,0xC9DA, +0xCACA,0xA8B5,0xB15F, 0, 0,0xA475,0xA5AA,0xA5A9, +0xA5A8, 0, 0,0xA7C5, 0, 0,0xAE74, 0, +0xDD57,0xA476,0xA477,0xA478,0xA4DA, 0, 0,0xABD1, + 0,0xCEAF, 0, 0, 0,0xB453,0xA479,0xC95D, + 0, 0,0xA5AB,0xA5AC,0xC978, 0,0xA67C, 0, + 0, 0,0xCACB, 0,0xA7C6, 0,0xCACC, 0, + 0,0xA9AE, 0, 0,0xCC6E,0xA9AC,0xA9AB,0xCC6D, +0xA9A9,0xCC6F,0xA9AA,0xA9AD, 0,0xABD2, 0,0xABD4, +0xCEB3,0xCEB0,0xCEB1,0xCEB2,0xCEB4,0xABD3, 0, 0, +0xD174,0xD173, 0,0xAE76, 0,0xAE75, 0, 0, + 0, 0, 0,0xB162,0xD546, 0,0xB161,0xB163, +0xB160, 0, 0, 0, 0,0xB455,0xD545, 0, +0xB456,0xD8F3, 0,0xB457,0xD8F2,0xB454, 0, 0, + 0, 0,0xDD5A,0xDD5C,0xB745,0xDD5B,0xDD59,0xDD58, + 0, 0, 0,0xE1B4,0xB9F7,0xB9F5, 0,0xB9F6, +0xE1B2,0xE1B3, 0,0xB9F3,0xE571,0xE56F, 0,0xBC6D, +0xE570,0xBC6E,0xBC6C,0xB9F4, 0, 0,0xE96D,0xE96B, +0xE96C,0xE56E,0xECDC,0xC0B0,0xECDB,0xEFC5,0xEFC6,0xE96E, +0xF1FE, 0,0xA47A,0xA5AD,0xA67E,0xC9DB,0xA67D, 0, +0xA9AF,0xB746, 0,0xA4DB,0xA5AE,0xABD5,0xB458, 0, +0xC979, 0,0xC97A, 0,0xC9DC, 0, 0,0xA7C8, +0xCAD0,0xCACE,0xA7C9,0xCACD,0xCACF,0xCAD1, 0,0xA7C7, + 0, 0, 0, 0, 0,0xA9B3,0xA9B4,0xA9B1, + 0, 0,0xA9B0,0xCEB8,0xA9B2, 0, 0, 0, +0xABD6, 0,0xCEB7,0xCEB9,0xCEB6,0xCEBA,0xABD7,0xAE79, +0xD175, 0,0xD177,0xAE77,0xD178,0xAE78,0xD176, 0, +0xCEB5,0xD547,0xD54A,0xD54B,0xD548,0xB167,0xB166,0xB164, +0xB165,0xD549, 0, 0, 0, 0,0xB168, 0, + 0,0xB45A,0xB45B, 0,0xB45C,0xDD5D,0xDD5F,0xDD61, +0xB748,0xB747,0xB459,0xDD60,0xDD5E, 0,0xE1B8, 0, + 0,0xE1B6,0xE1BC,0xB9F8,0xE1BD,0xE1BA,0xB9F9,0xE1B7, +0xE1B5,0xE1BB,0xBC70,0xE573,0xE1B9,0xBC72,0xE574,0xBC71, +0xBC74,0xE575,0xBC6F,0xBC73, 0,0xE973,0xE971,0xE970, +0xE972,0xE96F, 0, 0,0xC366, 0,0xF446,0xF447, + 0,0xF5CB,0xF6DF,0xC655, 0, 0,0xA9B5,0xA7CA, + 0, 0,0xABD8, 0, 0, 0,0xA47B,0xA4DC, + 0,0xA5AF,0xC9DD, 0,0xA7CB,0xCAD2, 0,0xCEBB, +0xABD9, 0,0xB9FA,0xA47C, 0, 0, 0,0xA6A1, + 0, 0,0xB749,0xA47D,0xA4DD,0xA4DE, 0,0xA5B1, +0xA5B0, 0,0xC9DE,0xA6A2, 0,0xCAD3, 0,0xA7CC, + 0, 0,0xCC71,0xCC72,0xCC73, 0,0xA9B6,0xA9B7, +0xCC70,0xA9B8, 0, 0, 0,0xABDA,0xCEBC, 0, +0xD17A,0xAE7A, 0,0xD179, 0,0xB169,0xD54C,0xB16A, +0xD54D, 0, 0, 0,0xB45D, 0, 0, 0, +0xDD62, 0, 0,0xE1BF,0xE1BE, 0,0xB9FB, 0, +0xBC75,0xE576,0xBECA,0xE974,0xC0B1, 0,0xC573,0xF7D8, + 0, 0, 0, 0,0xCC74, 0,0xCEBD,0xB16B, +0xD8F4,0xB74A, 0, 0, 0,0xC255, 0, 0, + 0, 0,0xA7CE, 0,0xA7CD,0xABDB, 0,0xD17B, + 0,0xB16D,0xB343,0xB16E,0xB16C,0xB45E, 0,0xE1C0, +0xB9FC,0xBC76, 0,0xC94C,0xC9DF, 0,0xCAD5,0xA7CF, +0xCAD4,0xA7D0, 0, 0,0xA9BC,0xCC77,0xCC76,0xA9BB, +0xA9B9,0xA9BA,0xCC75, 0, 0,0xABDD,0xCEBE,0xABE0, +0xABDC,0xABE2,0xABDE,0xABDF,0xABE1, 0, 0, 0, +0xAE7D,0xAE7C,0xAE7B, 0, 0, 0,0xD54F,0xB16F, +0xB172,0xB170, 0,0xD54E,0xB175, 0,0xB171,0xD550, +0xB174,0xB173, 0, 0, 0,0xD8F6,0xD8F5, 0, +0xB461,0xB45F,0xB460,0xD8F7,0xB74B,0xDD64,0xB74C,0xDD63, + 0, 0,0xE577, 0, 0,0xBC78,0xE1C1,0xBC77, + 0,0xB9FD, 0,0xECDE,0xE975,0xC0B2,0xECDD,0xF240, +0xF448,0xF449, 0,0xA4DF, 0,0xA5B2, 0, 0, + 0,0xC97B, 0, 0,0xA7D2,0xA7D4, 0,0xC9E2, +0xCAD8,0xCAD7,0xCAD6, 0,0xC9E1,0xC9E0,0xA6A4,0xA7D3, +0xA7D1,0xA6A3, 0, 0, 0,0xA9BD,0xCC78, 0, +0xA9BE,0xCADD, 0,0xCADF,0xCADE,0xCC79, 0, 0, +0xCADA, 0,0xA7D8,0xA7D6, 0,0xCAD9,0xCADB,0xCAE1, + 0,0xA7D5, 0,0xCADC,0xCAE5,0xA9C0, 0,0xCAE2, +0xA7D7, 0,0xCAE0,0xCAE3, 0,0xA9BF, 0,0xA9C1, +0xCAE4, 0, 0, 0, 0, 0, 0, 0, + 0,0xCCAF,0xCCA2,0xCC7E,0xCCAE,0xCCA9,0xABE7,0xA9C2, +0xCCAA,0xCCAD,0xABE3,0xCCAC,0xA9C3,0xA9C8,0xA9C6,0xCCA3, + 0,0xCC7C,0xCCA5,0xA9CD,0xCCB0,0xABE4,0xCCA6, 0, +0xABE5,0xA9C9,0xCCA8, 0,0xCECD,0xABE6,0xCC7B,0xA9CA, +0xABE8,0xA9CB,0xA9C7,0xA9CC,0xCCA7,0xCC7A,0xCCAB,0xA9C4, + 0, 0,0xCC7D,0xCCA4,0xCCA1,0xA9C5, 0,0xCEBF, + 0,0xCEC0, 0, 0, 0, 0, 0, 0, +0xCECA,0xD1A1,0xCECB,0xABEE,0xCECE,0xCEC4,0xABED,0xCEC6, + 0,0xCEC7, 0, 0,0xCEC9,0xABE9, 0, 0, +0xAEA3, 0,0xF9DA,0xCEC5,0xCEC1,0xAEA4, 0, 0, +0xCECF,0xAE7E,0xD17D,0xCEC8, 0,0xD17C,0xCEC3,0xCECC, + 0, 0,0xABEC,0xAEA1,0xABF2,0xAEA2,0xCED0,0xD17E, +0xABEB,0xAEA6,0xABF1,0xABF0,0xABEF,0xAEA5,0xCED1,0xAEA7, +0xABEA, 0,0xCEC2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xB176, +0xD1A4,0xD1A6, 0,0xD1A8,0xAEA8,0xAEAE,0xD553,0xD1AC, +0xD1A3,0xB178,0xD551, 0,0xAEAD,0xAEAB,0xD1AE, 0, +0xD552, 0,0xD1A5, 0,0xAEAC,0xD1A9,0xAEAF,0xD1AB, + 0, 0,0xAEAA,0xD1AA,0xD1AD,0xD1A7, 0,0xAEA9, +0xB179, 0,0xD1A2,0xB177, 0, 0, 0, 0, +0xB17A, 0, 0, 0, 0, 0, 0, 0, +0xD555,0xD55E,0xB464, 0,0xB17C,0xB1A3,0xB465,0xD560, +0xB1AA,0xD8F9,0xD556,0xB1A2,0xB1A5,0xB17E,0xD554,0xD562, +0xD565,0xD949, 0,0xD563,0xD8FD,0xB1A1,0xB1A8,0xB1AC, +0xD55D,0xD8F8,0xD561,0xB17B,0xD8FA,0xD564,0xD8FC,0xD559, + 0,0xB462, 0,0xD557,0xD558,0xB1A7, 0, 0, +0xB1A6,0xD55B,0xB1AB,0xD55F,0xB1A4,0xD55C, 0,0xB1A9, +0xB466,0xB463,0xD8FB, 0,0xD55A, 0,0xB17D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB46B,0xB46F,0xD940,0xB751,0xB46D,0xD944,0xB471,0xDD65, +0xD946,0xB753,0xB469,0xB46C,0xD947, 0,0xD948,0xD94E, +0xB473,0xB754, 0,0xD94A,0xD94F,0xD943,0xB75E, 0, +0xB755,0xB472,0xD941,0xD950, 0,0xB75D,0xB470,0xB74E, +0xD94D, 0,0xB474,0xD945,0xD8FE,0xB46A,0xD942, 0, +0xD94B, 0,0xB74D,0xB752,0xB467,0xD94C, 0,0xB750, + 0, 0, 0,0xB468, 0, 0, 0,0xB75C, +0xE1C3,0xDD70, 0,0xDD68,0xE1C2, 0,0xDD6C,0xDD6E, + 0, 0,0xDD6B, 0,0xB75B, 0,0xDD6A,0xB75F, + 0, 0, 0,0xE1D2, 0, 0,0xB75A,0xBA40, +0xDD71,0xE1C4, 0, 0,0xB758,0xDD69,0xDD6D,0xB9FE, +0xB74F,0xDD66,0xDD67,0xBA41,0xB757,0xB759,0xB756,0xDD6F, + 0, 0,0xE1C8,0xE1C9,0xE1CE,0xBC7D,0xE1D5, 0, +0xBA47, 0,0xBA46,0xE1D0, 0,0xBC7C,0xE1C5,0xBA45, + 0,0xE1D4,0xBA43,0xBA44, 0,0xE1D1,0xE5AA,0xBC7A, +0xB46E, 0,0xE1D3,0xBCA3,0xE1CB, 0,0xBC7B, 0, +0xBCA2,0xE1C6,0xE1CA,0xE1C7,0xE1CD,0xBA48,0xBC79,0xBA42, + 0,0xE57A,0xE1CF, 0,0xBCA1, 0,0xBCA4, 0, +0xE1CC, 0,0xBC7E,0xE579, 0, 0, 0, 0, + 0,0xE57E,0xBECE,0xE578,0xE9A3,0xE5A9,0xBCA8, 0, +0xBCA6,0xBECC,0xE5A6,0xE5A2,0xBCAC, 0,0xE978, 0, + 0, 0,0xBCAA,0xE5A1, 0,0xE976, 0,0xE5A5, + 0,0xE5A8,0xE57D, 0,0xBCAB, 0, 0,0xBCA5, +0xE977,0xBECD,0xE5A7,0xBCA7,0xBCA9,0xE5A4,0xBCAD,0xE5A3, +0xE57C,0xE57B,0xBECB,0xE5AB,0xE97A,0xECE0,0xBED0, 0, +0xE9A2, 0,0xE97E, 0,0xECE1, 0,0xBED1,0xE9A1, + 0,0xE97C,0xC0B4,0xECDF, 0,0xE979,0xE97B,0xC0B5, +0xBED3,0xC0B3,0xBED2,0xC0B7,0xE97D,0xBECF, 0, 0, + 0, 0, 0, 0, 0, 0,0xEFCF, 0, +0xEFC7, 0, 0, 0, 0, 0,0xECE7,0xEFC8, +0xECE3, 0, 0,0xC256,0xECE5,0xECE4,0xC0B6,0xECE2, +0xECE6,0xEFD0,0xEFCC,0xEFCE, 0,0xEFC9,0xEFCA, 0, +0xEFCD,0xEFCB,0xC367, 0, 0,0xC36A,0xC369,0xC368, +0xC461,0xF44A,0xC462,0xF241,0xC4DF,0xF5CC,0xC4E0,0xC574, +0xC5CA,0xF7D9, 0,0xF7DA,0xF7DB, 0, 0,0xF9BA, +0xA4E0,0xC97C,0xA5B3, 0,0xA6A6,0xA6A7,0xA6A5, 0, +0xA6A8,0xA7DA,0xA7D9, 0,0xCCB1,0xA9CF,0xA9CE, 0, + 0,0xD1AF,0xB1AD,0xB1AE, 0, 0, 0,0xB475, +0xDD72,0xB760,0xB761,0xDD74,0xDD76,0xDD75, 0,0xE1D7, + 0,0xE1D6,0xBA49,0xE1D8, 0,0xE5AC,0xBCAE, 0, +0xBED4, 0,0xC0B8,0xC257,0xC0B9, 0,0xA4E1, 0, + 0, 0,0xCAE6, 0, 0,0xCCB2,0xA9D1,0xA9D0, +0xA9D2,0xABF3,0xCED2,0xCED3, 0, 0,0xD1B0,0xAEB0, +0xB1AF,0xB476,0xD951,0xA4E2, 0,0xA47E,0xA4E3, 0, +0xC97D,0xA5B7,0xA5B6,0xA5B4,0xA5B5, 0, 0, 0, +0xA6AB,0xC9E9,0xC9EB,0xA6AA,0xC9E3, 0,0xC9E4, 0, +0xC9EA,0xC9E6,0xC9E8,0xA6A9,0xC9E5,0xC9EC,0xC9E7, 0, + 0, 0, 0, 0, 0,0xA7E1,0xA7EA,0xA7E8, +0xCAF0,0xCAED,0xCAF5,0xA7E6,0xCAF6, 0,0xA7DF,0xCAF3, + 0,0xA7E5,0xCAEF,0xCAEE,0xA7E3,0xCAF4,0xA7E4,0xA9D3, +0xA7DE,0xCAF1, 0,0xCAE7,0xA7DB, 0,0xA7EE,0xCAEC, +0xCAF2,0xA7E0,0xA7E2, 0,0xCAE8, 0,0xCAE9,0xCAEA, + 0,0xA7ED,0xA7E7,0xA7EC,0xCAEB,0xA7EB,0xA7DD,0xA7DC, +0xA7E9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA9E1,0xCCBE,0xCCB7,0xA9DC,0xA9EF,0xCCB3,0xCCBA,0xCCBC, +0xCCBF,0xA9EA, 0,0xCCBB,0xCCB4,0xA9E8,0xCCB8, 0, +0xCCC0,0xA9D9, 0,0xCCBD,0xA9E3,0xA9E2,0xCCB6,0xA9D7, + 0, 0,0xA9D8, 0,0xA9D6, 0,0xA9EE,0xA9E6, +0xA9E0,0xA9D4,0xCCB9,0xA9DF,0xA9D5,0xA9E7,0xA9F0,0xCED4, +0xA9E4,0xCCB5,0xA9DA,0xA9DD,0xA9DE, 0,0xA9EC,0xA9ED, +0xA9EB,0xA9E5,0xA9E9,0xA9DB,0xABF4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xCEDA,0xAC41,0xABF8,0xABFA,0xAC40, +0xCEE6,0xABFD,0xD1B1,0xAEB1,0xAC43,0xCED7,0xCEDF,0xABFE, +0xCEDE,0xCEDB,0xCEE3,0xCEE5,0xABF7,0xABFB,0xAC42,0xAEB3, +0xCEE0,0xABF9,0xAC45,0xCED9, 0, 0, 0,0xABFC, +0xAEB2,0xABF6, 0,0xCED6,0xCEDD,0xCED5,0xCED8,0xCEDC, +0xD1B2,0xAC44, 0,0xCEE1,0xCEE2,0xCEE4,0xABF5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xAEC1,0xD1BE,0xAEBF,0xAEC0,0xD1B4,0xD1C4, 0,0xAEB6, + 0, 0,0xD566,0xD1C6,0xD1C0, 0,0xD1B7, 0, +0xD1C9,0xD1BA,0xAEBC,0xD57D,0xD1BD,0xAEBE,0xAEB5, 0, +0xD1CB,0xD1BF,0xAEB8,0xD1B8,0xD1B5,0xD1B6,0xAEB9,0xD1C5, +0xD1CC,0xAEBB,0xD1BC,0xD1BB,0xAEC3,0xAEC2,0xAEB4,0xAEBA, +0xAEBD,0xD1C8, 0, 0,0xD1C2,0xAEB7,0xD1B3,0xD1CA, +0xD1C1,0xD1C3,0xD1C7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD567, 0,0xB1B7, +0xB1CB,0xB1CA, 0,0xB1BF, 0,0xD579,0xD575,0xD572, +0xD5A6,0xB1BA,0xB1B2, 0, 0,0xD577,0xB4A8,0xB1B6, +0xD5A1, 0,0xB1CC,0xB1C9,0xD57B,0xD56A, 0, 0, +0xB1C8,0xD5A3,0xD569,0xB1BD,0xB1C1,0xD5A2, 0,0xD573, +0xB1C2,0xB1BC,0xD568, 0,0xB478,0xD5A5,0xD571,0xB1C7, +0xD574,0xD5A4,0xB1C6, 0,0xD952, 0,0xB1B3,0xD56F, +0xB1B8,0xB1C3, 0,0xB1BE,0xD578,0xD56E,0xD56C,0xD57E, +0xB1B0,0xB1C4,0xB1B4,0xB477,0xD57C,0xB1B5, 0,0xB1B1, +0xB1C0,0xB1BB,0xB1B9,0xD570,0xB1C5,0xD56D,0xD57A,0xD576, +0xD954,0xD953, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD56B,0xD964, 0, +0xB47A, 0,0xD96A,0xD959,0xD967,0xDD77,0xB47D,0xD96B, +0xD96E,0xB47C,0xD95C,0xD96D,0xD96C,0xB47E,0xD955,0xB479, +0xB4A3, 0,0xB4A1,0xD969, 0,0xD95F,0xB4A5,0xD970, +0xD968,0xD971,0xB4AD,0xB4AB,0xD966,0xD965, 0,0xD963, +0xD95D,0xB4A4, 0,0xB4A2,0xD1B9,0xD956, 0,0xDDB7, +0xD957,0xB47B,0xB4AA,0xDD79, 0,0xB4A6,0xB4A7,0xD958, +0xD96F,0xDD78,0xD960,0xD95B,0xB4A9,0xD961,0xD95E, 0, + 0,0xB4AE, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xB770, 0, + 0,0xDD7C,0xDDB1,0xDDB6,0xDDAA,0xB76C,0xDDBB,0xB769, +0xDD7A, 0,0xDD7B,0xB762,0xB76B,0xDDA4,0xB76E,0xB76F, +0xDDA5, 0,0xDDB2,0xDDB8,0xB76A, 0,0xB764,0xDDA3, +0xDD7D,0xDDBA,0xDDA8,0xDDA9,0xDD7E,0xDDB4,0xDDAB,0xDDB5, +0xDDAD, 0,0xB765,0xE1D9,0xB768,0xB766,0xDDB9,0xDDB0, +0xDDAC, 0, 0,0xDDA1,0xBA53,0xDDAF,0xB76D,0xDDA7, + 0,0xDDA6, 0, 0, 0,0xB767,0xB763,0xE1EE, +0xDDB3,0xDDAE, 0,0xDDA2, 0, 0, 0, 0, + 0, 0, 0,0xE1E9, 0,0xE1DA,0xE1E5, 0, +0xE1EC,0xBA51,0xB4AC,0xE1EA,0xBA4C, 0, 0, 0, +0xBA4B,0xE1F1, 0,0xE1DB,0xE1E8,0xE1DC,0xE1E7,0xBA4F, +0xE1EB,0xD962, 0, 0, 0,0xE1F2,0xE1E3,0xBA52, +0xE5BA,0xBCAF, 0,0xE1F0,0xE1EF,0xBA54,0xE5AD,0xBCB0, +0xE5AE, 0,0xE1DF,0xE1E0,0xE1DD,0xE1E2,0xE1DE,0xE1F3, +0xBA4E,0xBCB1,0xBA50,0xBA55, 0,0xE1E1, 0,0xE1ED, + 0, 0,0xE1E6, 0, 0,0xE5B1, 0,0xBA4A, +0xBCB4,0xE9AA,0xE5B6,0xE5B5,0xE5B7, 0, 0,0xE5B4, +0xBCB5, 0,0xBCBB,0xBCB8, 0,0xBCB9,0xE5AF,0xE5B2, +0xE5BC,0xBCC1,0xBCBF, 0,0xE5B3,0xD95A,0xBCB2,0xE5B9, +0xE5B0, 0,0xBCC2,0xE5B8,0xBA4D,0xBCB7,0xE1E4, 0, + 0,0xBCBA, 0,0xBCBE,0xBCC0,0xBCBD,0xBCBC, 0, +0xBCB6,0xE5BB,0xBCB3,0xBCC3, 0, 0, 0, 0, + 0, 0, 0,0xBED8,0xBED9,0xE9A9,0xBEE2,0xBEDF, + 0,0xBED6,0xBEDD,0xE9AB,0xBEDB,0xBED5, 0,0xBEDC, + 0,0xE9A8,0xC0BB,0xBED7, 0,0xBEDE,0xC0BA,0xE9A7, +0xE9A6, 0,0xBEE0, 0,0xBEE1, 0,0xE9A5,0xE9A4, +0xC0BC,0xE9AE,0xBEDA,0xE9AC, 0, 0, 0, 0, +0xC0BD, 0,0xC0C2,0xECEA,0xECEC, 0,0xC0BF, 0, +0xECED,0xECE9, 0,0xECEB,0xC0C0,0xC0C3, 0,0xECE8, +0xC0BE,0xC0C1,0xC259,0xE9AD,0xC258, 0, 0,0xC25E, +0xEFD4, 0,0xC25C,0xC25D,0xEFD7,0xEFD3,0xC25A,0xEFD1, +0xC36B,0xEFD5, 0,0xEFD6,0xEFD2, 0,0xC25B,0xF242, + 0,0xF245, 0, 0,0xF246,0xF244,0xF247,0xC36C, +0xF243, 0, 0,0xF44E,0xC464,0xF44D,0xF44C,0xF44B, +0xC463,0xC465, 0,0xF5CD,0xC4E2,0xC4E1, 0, 0, +0xF6E1,0xF6E0,0xF6E3,0xC5CB,0xC575,0xF7DD,0xF6E2, 0, + 0,0xF7DC,0xC5CD,0xC5CC,0xC5F3,0xF8A9,0xF8EF,0xA4E4, + 0, 0,0xD972,0xE9AF, 0, 0,0xA6AC,0xCAF7, +0xA7F1,0xA7EF, 0,0xA7F0, 0,0xCCC1,0xA9F1,0xAC46, + 0,0xCEE7, 0,0xCEE8, 0,0xAC47,0xD1CE, 0, +0xAEC4,0xAEC5,0xD1CD, 0, 0, 0, 0,0xB1D3, + 0,0xB1CF, 0,0xD5A7,0xB1D6,0xB1D5,0xB1CE,0xB1D1, +0xB1D4,0xB1D0, 0, 0,0xD976,0xB1CD,0xB4AF, 0, + 0, 0,0xB4B1,0xB4B2,0xD975,0xD978,0xB4B0,0xD973, +0xD977, 0,0xD974, 0,0xB771, 0, 0,0xDDBC, + 0, 0,0xBA56,0xE1F4,0xBEE3,0xBCC4,0xE5BD,0xBCC5, +0xBCC6,0xE5BF,0xE5BE,0xE5C0,0xE9B1, 0, 0,0xE9B0, +0xECEF,0xECEE,0xC0C4,0xC0C5,0xF248, 0, 0,0xA4E5, + 0, 0, 0, 0,0xD979, 0, 0, 0, +0xB4B4,0xB4B3,0xDDBD, 0,0xEFD8,0xC4E3,0xF7DE,0xA4E6, + 0,0xAEC6, 0,0xB1D8,0xB1D7,0xD97A,0xD97B,0xB772, +0xE1F5,0xBA57,0xE9B2, 0,0xA4E7,0xA5B8, 0,0xA9F2, +0xCCC2, 0,0xCEE9,0xAC48,0xB1D9, 0,0xD97C,0xB4B5, +0xB773, 0,0xE5C1,0xE5C2, 0, 0,0xECF0,0xC25F, +0xF8F0,0xA4E8, 0,0xCCC3,0xA9F3,0xAC49, 0,0xCEEA, + 0,0xAEC7,0xD1D2,0xD1D0,0xD1D1,0xAEC8,0xD1CF, 0, + 0, 0, 0,0xB1DB,0xB1DC,0xD5A8,0xB1DD,0xB1DA, +0xD97D, 0,0xD97E,0xDDBE, 0, 0,0xBA59,0xBA58, + 0, 0,0xECF1,0xEFD9, 0,0xF24A,0xF249,0xF44F, + 0,0xC95E,0xAC4A, 0, 0,0xA4E9,0xA5B9, 0, +0xA6AE,0xA6AD, 0, 0,0xA6AF,0xA6B0,0xC9EE,0xC9ED, +0xCAF8,0xA7F2,0xCAFB,0xCAFA,0xCAF9,0xCAFC, 0, 0, + 0, 0,0xA9F4,0xCCC9,0xCCC5,0xCCCE, 0, 0, +0xA9FB, 0,0xA9F9,0xCCCA,0xCCC6,0xCCCD,0xA9F8,0xAA40, +0xCCC8,0xCCC4,0xA9FE,0xCCCB,0xA9F7,0xCCCC,0xA9FA,0xA9FC, +0xCCD0,0xCCCF,0xCCC7,0xA9F6,0xA9F5,0xA9FD, 0, 0, + 0, 0, 0, 0,0xCEEF,0xCEF5, 0,0xAC50, +0xAC4D,0xCEEC,0xCEF1, 0,0xAC53,0xAC4B,0xCEF0,0xAC4E, +0xAC51, 0, 0,0xCEF3, 0,0xAC4C,0xCEF8,0xAC4F, + 0,0xAC52,0xCEED,0xCEF2,0xCEF6,0xCEEE,0xCEEB, 0, + 0,0xCEF7,0xCEF4, 0, 0, 0, 0, 0, + 0,0xAED0,0xAEC9,0xAECC, 0,0xAECF, 0,0xD1D5, + 0,0xAECA,0xD1D3, 0,0xAECE, 0, 0,0xAECB, + 0,0xD1D6,0xAECD, 0, 0, 0, 0, 0, + 0,0xD5AC,0xB1DF,0xD5AB,0xD5AD,0xB1DE,0xB1E3,0xD1D4, + 0,0xD5AA,0xD5AE, 0,0xB1E0,0xD5A9,0xB1E2, 0, +0xB1E1, 0,0xD9A7, 0,0xD9A2, 0,0xB4B6,0xB4BA, +0xB4B7,0xD9A5,0xD9A8, 0,0xB4B8, 0,0xB4B9,0xB4BE, +0xDDC7,0xD9A6,0xB4BC,0xD9A3,0xD9A1, 0,0xB4BD, 0, +0xD9A4, 0, 0, 0,0xB779, 0,0xDDBF,0xB776, +0xB777,0xB775,0xDDC4,0xDDC3,0xDDC0,0xB77B, 0, 0, +0xDDC2,0xB4BB, 0, 0,0xDDC6,0xDDC1,0xB778,0xB774, +0xB77A,0xDDC5, 0, 0, 0,0xBA5C, 0,0xE1F8, +0xE1F7,0xE1F6,0xBA5A, 0, 0, 0, 0, 0, +0xBA5B,0xE5C5,0xE5C8,0xBCC8, 0, 0,0xBCC7,0xE5C9, +0xE5C4,0xBCCA,0xE5C6, 0,0xBCC9,0xE5C3, 0,0xE5C7, +0xBEE9,0xBEE6,0xE9BB,0xE9BA, 0,0xE9B9,0xE9B4, 0, +0xE9B5, 0, 0, 0,0xBEE7, 0,0xBEE4,0xBEE8, +0xE9B3,0xBEE5,0xE9B6,0xE9B7,0xE9BC, 0, 0,0xE9B8, + 0, 0,0xECF2, 0, 0, 0,0xC0C7, 0, +0xEFDC,0xC0C6,0xEFDA,0xEFDB,0xC260,0xC36E,0xF24B, 0, +0xC36D, 0, 0,0xF451,0xF452, 0,0xC466, 0, +0xF450,0xC4E4, 0,0xF7DF,0xC5CE,0xF8AA,0xF8AB, 0, +0xA4EA, 0,0xA6B1,0xA6B2,0xA7F3, 0,0xCCD1,0xAC54, +0xAED1,0xB1E4, 0, 0,0xB0D2, 0,0xB4BF,0xB4C0, +0xB3CC,0xD9A9, 0,0xB77C,0xE1FA,0xE1F9, 0, 0, +0xA4EB,0xA6B3,0xCCD2,0xAA42, 0,0xAA41, 0,0xCEF9, +0xCEFA, 0,0xD1D7,0xD1D8,0xAED2,0xAED3, 0,0xAED4, +0xD5AF, 0, 0,0xB1E6, 0,0xB4C2, 0,0xB4C1, +0xDDC8,0xDF7A,0xE1FB,0xE9BD, 0, 0,0xC261,0xC467, +0xA4EC, 0,0xA5BC,0xA5BD,0xA5BB,0xA5BE,0xA5BA, 0, + 0,0xA6B6, 0,0xC9F6,0xA6B5,0xA6B7, 0, 0, +0xC9F1,0xC9F0,0xC9F3,0xC9F2,0xC9F5,0xA6B4,0xC9EF,0xC9F4, + 0, 0, 0, 0, 0,0xCAFD,0xA7FD,0xCAFE, +0xCB43,0xA7FC, 0,0xCB47,0xCB42,0xCB45,0xA7F5,0xA7F6, +0xA7F7,0xA7F8, 0,0xA840, 0,0xCB41,0xA7FA,0xA841, + 0,0xCB40,0xCB46, 0,0xA7F9,0xCB44,0xA7FB,0xA7F4, +0xA7FE, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xAA57, 0,0xCCD4,0xAA43, 0,0xAA4D, +0xAA4E,0xAA46,0xAA58,0xAA48,0xCCDC,0xAA53,0xCCD7,0xAA49, +0xCCE6,0xCCE7,0xCCDF,0xCCD8,0xAA56,0xCCE4,0xAA51,0xAA4F, + 0,0xCCE5, 0,0xCCE3,0xCCDB,0xCCD3,0xCCDA,0xAA4A, + 0,0xAA50, 0,0xAA44,0xCCDE,0xCCDD,0xCCD5, 0, +0xAA52,0xCCE1,0xCCD6,0xAA55,0xCCE8,0xAA45, 0,0xAA4C, +0xCCD9,0xCCE2,0xAA54, 0,0xAA47,0xAA4B, 0,0xCCE0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xCF5B,0xAC5C, +0xAC69, 0,0xCF56,0xCF4C,0xAC62,0xCF4A,0xAC5B,0xCF45, +0xAC65,0xCF52,0xCEFE,0xCF41, 0, 0, 0, 0, +0xCF44,0xCEFB,0xCF51,0xCF61,0xAC60,0xCF46,0xCF58, 0, +0xCEFD,0xCF5F,0xCF60,0xCF63,0xCF5A,0xCF4B,0xCF53,0xAC66, +0xAC59,0xAC61,0xAC6D,0xAC56,0xAC58, 0, 0, 0, +0xCF43,0xAC6A,0xAC63,0xCF5D,0xCF40,0xAC6C,0xAC67,0xCF49, + 0, 0,0xAC6B,0xCF50,0xCF48,0xAC64,0xCF5C,0xCF54, + 0,0xAC5E,0xCF62,0xCF47,0xAC5A,0xCF59,0xCF4F,0xAC5F, +0xCF55,0xAC57,0xCEFC,0xAC68,0xAEE3,0xAC5D,0xCF4E,0xCF4D, +0xCF42, 0,0xCF5E, 0,0xCF57, 0, 0,0xAC55, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD1EC,0xAEEA,0xD1ED, 0,0xD1E1,0xAEDF, +0xAEEB, 0,0xD1DA, 0,0xD1E3,0xD1EB, 0,0xD1D9, +0xD1F4,0xAED5, 0, 0, 0,0xD1F3,0xD1EE, 0, +0xD1EF,0xAEDD,0xAEE8,0xD1E5, 0,0xD1E6,0xD1F0,0xD1E7, + 0,0xD1E2,0xD1DC,0xD1DD,0xD1EA,0xD1E4, 0, 0, +0xAED6,0xAEDA,0xD1F2,0xD1DE,0xAEE6,0xAEE2, 0, 0, +0xAEE5,0xAEEC,0xAEDB,0xAEE7,0xD1E9,0xAEE9,0xAED8, 0, +0xAED7,0xD1DB, 0,0xD1DF,0xAEE0,0xD1F1,0xD1E8,0xD1E0, +0xAEE4,0xAEE1, 0,0xAED9,0xAEDC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD5C4, 0,0xD5B4,0xD5B5,0xD5B9, + 0,0xD5C8,0xD5C5, 0,0xD5BE,0xD5BD,0xB1ED,0xD5C1, +0xD5D0,0xD5B0, 0,0xD5D1,0xD5C3,0xD5D5,0xD5C9,0xB1EC, +0xD5C7,0xB1E7,0xB1FC,0xB1F2, 0,0xB1F6,0xB1F5,0xD5B1, + 0,0xD5CE,0xD5D4,0xD5CC,0xD5D3, 0, 0,0xD5C0, +0xD5B2,0xD5D2,0xD5C2,0xB1EA,0xB1F7, 0,0xD5CB,0xB1F0, + 0, 0, 0,0xD5CA,0xD5B3,0xB1F8, 0,0xB1FA, +0xD5CD,0xB1FB,0xB1E9,0xD5BA,0xD5CF, 0, 0,0xB1EF, +0xB1F9,0xD5BC,0xD5C6,0xD5B7,0xD5BB,0xB1F4,0xD5B6,0xB1E8, +0xB1F1,0xB1EE,0xD5BF,0xAEDE,0xD9C0,0xB1EB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xB1F3, 0,0xD9C3,0xD9D9, +0xD9CE,0xB4D6, 0,0xB4D1,0xD9BD,0xB4D2,0xD9CD, 0, +0xD9C6,0xD9D3,0xB4CE,0xD9AB,0xD9D5,0xB4C4,0xD9B3,0xB4C7, +0xB4C6, 0,0xB4D7, 0,0xD9AD,0xD9CF,0xD9D0,0xB4C9, +0xB4C5,0xD9BB, 0,0xB4D0,0xD9B6, 0,0xD9D1,0xB4CC, +0xD9C9,0xD9D6,0xD9B0,0xD9B5,0xD9AF, 0,0xB4CB,0xD9C2, +0xDDDE,0xD9B1,0xB4CF,0xD9BA,0xD9D2,0xB4CA,0xD9B7,0xD9B4, +0xD9C5,0xB4CD,0xB4C3,0xB4D9,0xD9C8,0xD9C7, 0, 0, + 0, 0, 0, 0,0xD9AC,0xB4C8,0xD9D4,0xD9BC, +0xD9BE, 0,0xD9CB,0xD9CA,0xD9AA,0xB4D3,0xB4D5,0xD9B2, +0xD9B9,0xD9C1,0xB4D4,0xD9B8,0xD9C4,0xD9D7, 0,0xD9CC, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD9D8, 0, 0, + 0, 0,0xD9AE, 0, 0, 0, 0,0xDDF2, +0xB7A6, 0,0xDDF0,0xDDDB,0xDDE0,0xDDD9, 0,0xDDEC, +0xDDCB,0xDDD2, 0,0xDDEA,0xDDF4,0xDDDC, 0,0xDDCF, +0xDDE2,0xDDE7,0xDDD3, 0,0xDDE4,0xDDD0, 0, 0, +0xDDD7,0xDDD8,0xB7A8,0xDDEB,0xDDE9, 0,0xDDCC,0xDDEE, + 0,0xDDEF,0xDDF1,0xB7AC,0xB7A4, 0,0xD5B8,0xDDD4, +0xDDE6,0xDDD5,0xB7A1,0xB7B1,0xDDED,0xB7AF,0xB7AB,0xDDCA, +0xB7A3, 0,0xDDCD,0xB7B0, 0,0xDDDD,0xDDC9, 0, +0xB7A9,0xDDE1,0xDDD1,0xB7AA,0xDDDA,0xB77E,0xB4D8,0xDDE3, +0xD9BF,0xDDCE, 0, 0,0xDDE8,0xB7A5,0xDDE5,0xB7A2, +0xDDDF,0xB7AD,0xDDD6,0xDDF3, 0, 0, 0, 0, + 0, 0,0xB7A7,0xDEC6, 0, 0,0xB7AE, 0, + 0, 0, 0, 0, 0,0xE24A,0xE248, 0, +0xE25E,0xE246, 0,0xE258,0xB77D,0xBA5F,0xE242,0xE25D, + 0,0xE247,0xE255,0xBA64,0xBA5D, 0,0xE25B, 0, +0xE240,0xE25A, 0,0xBA6F,0xE251,0xE261,0xBA6D,0xE249, +0xBA5E,0xE24B,0xE259,0xBA67,0xE244,0xBA6B,0xBA61,0xE24D, +0xE243,0xE1FC, 0,0xE257,0xBA68,0xE260,0xE1FD,0xBA65, + 0,0xE253, 0,0xBA66,0xE245,0xE250,0xE24C,0xE24E, + 0,0xBA60,0xE25F,0xBA6E,0xE24F, 0,0xE262, 0, + 0,0xE1FE,0xE254,0xBA63,0xBA6C,0xBA6A,0xE241,0xE256, +0xBA69, 0, 0,0xBA62,0xE252, 0, 0, 0, + 0,0xE25C, 0, 0, 0, 0, 0, 0, + 0, 0,0xE5D5, 0,0xE5D1,0xE5CD,0xE5E1,0xE5DE, +0xBCCD, 0, 0,0xE5E5,0xE5D4,0xBCD8,0xE5DB, 0, + 0,0xE5D0,0xE5DA,0xBCD5,0xE5EE, 0,0xE5EB,0xE5DD, +0xE5CE, 0, 0,0xE5E2,0xE5E4,0xBCD1,0xE5D8,0xE5D3, +0xE5CA,0xBCCE,0xBCD6, 0,0xE5E7,0xBCD7,0xE5CB,0xE5ED, +0xE5E0,0xE5E6,0xBCD4, 0, 0,0xE5E3, 0,0xE5EA, + 0,0xBCD9, 0,0xBCD3,0xE5DC,0xE5CF,0xE5EF,0xE5CC, +0xE5E8,0xBCD0, 0,0xE5D6, 0,0xE5D7,0xBCCF,0xBCCC, +0xE5D2,0xBCD2, 0,0xBCCB, 0,0xE5E9,0xE5EC,0xE5D9, +0xE9CA, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE9C2, 0,0xE9BE,0xBEF6, 0, 0, +0xBEEB,0xBEF0,0xBEEC,0xE9CC,0xE9D7,0xBEEA,0xE9C4,0xE9CD, +0xE5DF,0xE9CE, 0, 0,0xBEF1, 0,0xE9DD,0xBEF5, +0xBEF8,0xE9C0, 0,0xBEF4, 0,0xE9DB,0xE9DC,0xE9D2, +0xE9D1,0xE9C9, 0, 0,0xE9D3,0xE9DA,0xE9D9, 0, +0xBEEF,0xBEED,0xE9CB,0xE9C8, 0,0xE9C5,0xE9D8,0xBEF7, +0xE9D6,0xBEF3,0xBEF2, 0,0xE9D0, 0,0xE9BF,0xE9C1, +0xE9C3,0xE9D5,0xE9CF,0xBEEE, 0,0xE9C6, 0,0xE9D4, + 0, 0, 0, 0, 0, 0,0xE9C7, 0, + 0, 0, 0, 0, 0, 0,0xC0CF,0xED45, +0xC0C8,0xECF5, 0,0xED41,0xC0CA,0xED48, 0,0xECFC, + 0,0xECF7, 0, 0,0xED49,0xECF3,0xECFE, 0, +0xC0D1,0xED44,0xED4A,0xECFD,0xC0C9,0xED40,0xECF4,0xC0D0, + 0, 0,0xED47,0xECF9,0xC0CC, 0,0xECFB,0xECF8, +0xC0D2,0xECFA,0xC0CB,0xC0CE,0xED43,0xECF6,0xED46, 0, +0xED42, 0, 0, 0,0xC263,0xEFE7,0xC268,0xC269, + 0, 0, 0,0xC262,0xEFE6, 0,0xEFE3,0xEFE4, +0xC266,0xEFDE,0xEFE2,0xC265, 0,0xEFDF, 0, 0, + 0, 0,0xC267,0xC264, 0,0xEFDD,0xEFE1,0xEFE5, + 0, 0, 0,0xF251,0xF24E,0xF257, 0,0xF256, +0xF254,0xF24F, 0,0xC372, 0, 0, 0, 0, + 0,0xF250,0xC371,0xC0CD,0xF253,0xC370,0xF258,0xF252, +0xF24D,0xEFE0, 0, 0, 0,0xC36F, 0,0xF24C, +0xF456, 0,0xF455,0xF255,0xC468, 0,0xF459,0xF45A, +0xF454,0xF458, 0,0xF453, 0, 0, 0, 0, +0xF5D1,0xF457,0xC4E7,0xC4E5,0xF5CF, 0, 0, 0, +0xF5D2, 0,0xF5CE,0xF5D0,0xC4E6, 0, 0, 0, +0xF6E5,0xF6E6,0xC576,0xF6E4, 0, 0, 0,0xF7E2, +0xC5CF,0xF7E0,0xF7E1,0xF8AC, 0, 0,0xC656,0xF8F3, +0xF8F1,0xF8F2,0xF8F4, 0, 0, 0,0xF9BB, 0, +0xA4ED,0xA6B8, 0,0xAA59, 0,0xCCE9, 0, 0, +0xCF64, 0, 0, 0,0xD1F5,0xD1F7, 0,0xD1F6, + 0,0xD1F8,0xB1FD,0xD5D7,0xD1F9, 0,0xD5D6,0xD5D8, +0xD5D9,0xD9DA,0xB4DB,0xD9DB,0xD9DD,0xB4DC,0xB4DA,0xD9DC, + 0,0xDDFA,0xDDF8,0xDDF7, 0,0xDDF6,0xDDF5,0xB7B2, +0xDDF9,0xBA70,0xE263,0xE265,0xBA71,0xE264,0xBCDB, 0, +0xBCDA,0xE5F0, 0, 0,0xE9DF,0xE9DE,0xE9E0, 0, + 0,0xBEF9, 0,0xED4B,0xC0D3, 0,0xEFE8,0xC26A, +0xF259,0xC577,0xA4EE,0xA5BF,0xA6B9,0xA842,0xAA5A,0xAA5B, + 0, 0,0xAC6E, 0, 0,0xD1FA, 0, 0, + 0, 0,0xB7B3, 0, 0, 0,0xE6D1,0xBEFA, +0xC26B,0xA4EF, 0,0xA6BA, 0, 0,0xCCEB,0xAA5C, +0xCCEA, 0,0xCF65,0xAC6F,0xCF66, 0,0xAC70, 0, +0xD1FC,0xAEEE,0xAEED, 0,0xD5DE,0xD5DC,0xD5DD,0xD5DB, + 0,0xD5DA, 0, 0,0xD9DE,0xD9E1,0xB4DE,0xD9DF, +0xB4DD,0xD9E0, 0,0xDDFB, 0, 0,0xE266,0xE267, +0xE268, 0,0xE5F3,0xE5F2,0xBCDC,0xE5F1,0xE5F4,0xE9E1, + 0, 0,0xE9E2,0xE9E3, 0,0xED4C,0xC0D4,0xC26C, +0xF25A, 0,0xC4E8,0xC95F, 0,0xAC71,0xCF67,0xAEEF, + 0, 0,0xB1FE, 0,0xB4DF,0xD9E2, 0,0xB7B5, +0xB7B4, 0, 0,0xE269,0xE26A,0xBCDD,0xBCDE,0xE9E5, +0xE9E4,0xEFE9,0xF7E3,0xA4F0,0xC960,0xA5C0, 0,0xA843, +0xCB48, 0,0xAC72,0xB7B6,0xA4F1, 0,0xCF68,0xAC73, +0xCF69, 0,0xC0D5,0xA4F2, 0, 0,0xCCEC, 0, +0xCF6A, 0,0xD242,0xD241,0xD1FE, 0,0xD1FD,0xD243, +0xD240, 0, 0,0xB240,0xB241, 0, 0,0xB4E0, +0xD9E3, 0,0xD9E4,0xD9E5, 0, 0, 0,0xDE41, +0xDE42,0xDE40, 0,0xDDFD,0xDDFE,0xB7B7,0xE26B,0xE5F7, +0xE5F6,0xE5F5,0xE5F8,0xE9E7,0xE9E6,0xBEFB,0xE9E8, 0, +0xC0D6,0xED4D, 0,0xEFEA,0xF25B,0xF6E7, 0,0xA4F3, +0xA5C2,0xA5C1, 0,0xAA5D,0xC961,0xC97E,0xA6BB, 0, +0xC9F7,0xCB49,0xCB4A,0xAA5E, 0,0xCCED, 0,0xAC74, +0xCF6B,0xCF6C, 0,0xAEF0,0xAEF4,0xD244,0xAEF3,0xAEF1, +0xAEF2, 0,0xD5DF,0xB242,0xB4E3, 0,0xB4E1,0xB4E2, +0xD9E6, 0, 0,0xBA72,0xA4F4, 0,0xC9A1, 0, +0xA5C3, 0, 0,0xC9A4, 0, 0,0xA5C6,0xC9A3, +0xA5C5,0xA5C4,0xA844,0xC9A2, 0, 0,0xC9F8, 0, + 0, 0,0xC9FC,0xC9FE,0xCA40,0xA6C5,0xA6C6,0xC9FB, +0xA6C1, 0,0xC9F9, 0,0xC9FD,0xA6C2, 0,0xA6BD, + 0,0xA6BE, 0,0xA6C4,0xC9FA,0xA6BC,0xA845,0xA6BF, +0xA6C0,0xA6C3, 0, 0, 0,0xCB5B,0xCB59,0xCB4C, +0xA851,0xCB53,0xA84C,0xCB4D, 0,0xCB55, 0,0xCB52, +0xA84F,0xCB51,0xA856,0xCB5A,0xA858, 0,0xA85A, 0, +0xCB4B, 0,0xA84D,0xCB5C, 0,0xA854,0xA857, 0, +0xCD45,0xA847,0xA85E,0xA855,0xCB4E,0xA84A,0xA859,0xCB56, +0xA848,0xA849,0xCD43,0xCB4F,0xA850,0xA85B,0xCB5D,0xCB50, +0xA84E, 0,0xA853,0xCCEE,0xA85C,0xCB57,0xA852, 0, +0xA85D,0xA846,0xCB54,0xA84B,0xCB58,0xCD44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xAA6A,0xAA7A,0xCCF5,0xAA71, 0, +0xCD4B,0xAA62, 0,0xAA65,0xCD42, 0,0xCCF3,0xCCF7, +0xAA6D,0xAA6F,0xCCFA,0xAA76,0xAA68,0xAA66,0xAA67,0xAA75, +0xCD47,0xAA70,0xCCF9,0xCCFB,0xAA6E,0xAA73,0xCCFC,0xCD4A, + 0,0xAC75,0xAA79, 0,0xAA63,0xCD49, 0,0xCD4D, +0xCCF8,0xCD4F,0xCD40,0xAA6C,0xCCF4,0xAA6B,0xAA7D,0xAA72, + 0,0xCCF2,0xCF75,0xAA78,0xAA7C,0xCD41,0xCD46, 0, +0xAA7E,0xAA77,0xAA69,0xAA5F, 0,0xAA64, 0,0xCCF6, +0xAA60,0xCD4E, 0,0xCCF0,0xCCEF,0xCCFD,0xCCF1,0xAA7B, +0xAEF5,0xAA74,0xCCFE,0xAA61, 0,0xACA6, 0, 0, + 0,0xCD4C, 0, 0, 0, 0, 0, 0, +0xCF7C,0xCFA1, 0,0xCFA4,0xCF77, 0, 0,0xCFA7, +0xCFAA,0xCFAC,0xCF74,0xAC76,0xAC7B,0xD249,0xACAD,0xCFA5, +0xCFAD,0xCF7B,0xCF73, 0, 0, 0,0xD264,0xAC7E, +0xCFA2,0xCF78,0xCF7A,0xACA5, 0,0xCF7D,0xAC7D,0xCF70, +0xCFA8, 0,0xCFAB, 0, 0,0xAC7A, 0,0xACA8, +0xCF6D,0xACAA,0xAC78,0xACAE,0xCFA9,0xCF6F,0xACAB,0xD25E, +0xCD48,0xAC7C,0xAC77,0xCF76,0xCF6E,0xACAC,0xACA4,0xCFA3, +0xACA9,0xACA7,0xCF79,0xACA1,0xCF71,0xACA2,0xACA3,0xCF72, +0xCFA6,0xAC79,0xCF7E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD24C,0xAEFD,0xAF43, 0, 0, 0,0xD255,0xD25B, +0xD257,0xD24A,0xD24D,0xD246,0xD247,0xAF4A,0xAEFA,0xD256, +0xD25F,0xAF45,0xAEF6, 0,0xAF40,0xD24E,0xAF42,0xD24F, +0xD259, 0, 0, 0,0xAF44,0xD268,0xD248,0xAEFC, +0xAEFB,0xAF48,0xD245,0xD266,0xD25A,0xD267,0xD261,0xD253, +0xD262, 0,0xD25C,0xD265,0xD263,0xAF49,0xD254,0xAEF9, +0xAEF8,0xAF41,0xAF47,0xD260,0xAF46,0xD251,0xB243, 0, +0xD269,0xD250,0xD24B,0xAEFE,0xAF4B,0xAEF7, 0,0xD258, +0xD25D, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xB265,0xD5E1,0xD5E5, 0,0xB252,0xB250, + 0, 0,0xB247,0xD5E3,0xD5E2,0xB25B, 0,0xD5E8, +0xB255, 0,0xD5FA,0xD647,0xB244,0xD5F7,0xD5F0,0xB267, +0xD5E0, 0,0xD5FC, 0,0xB264,0xB258,0xB263,0xB24E, +0xD5EC,0xD5FE,0xD5F6,0xB24F,0xB249,0xD645, 0,0xD5FD, +0xD640,0xB251,0xB259,0xD642,0xD5EA,0xD5FB,0xD5EF,0xD644, +0xB25E,0xB246,0xB25C,0xD5F4,0xD5F2,0xD5F3,0xB253,0xD5EE, +0xD5ED,0xB248,0xD5E7,0xD646,0xB24A,0xD5F1,0xB268, 0, +0xB262,0xD5E6,0xB25F,0xB25D,0xB266,0xD5F8,0xB261,0xD252, +0xD5F9,0xB260,0xD641,0xB245,0xD5F5,0xB257,0xD5E9,0xB256, + 0,0xB254,0xB24C,0xB24B,0xD9E7,0xD643, 0, 0, +0xD5EB, 0, 0,0xD9FC, 0,0xB24D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xB541,0xB25A,0xB4EE,0xD9F6,0xB4FC, 0,0xD9EA, +0xB4EB,0xB4E7,0xDA49,0xB4ED,0xB4F1,0xB4EC,0xB4F5,0xDA4D, +0xDA44, 0, 0,0xD9F1,0xB4FA,0xB4F4,0xD9FD,0xB4E4, +0xDA4A,0xDA43,0xB4E8,0xD9F7,0xB4F7,0xDA55,0xDA56, 0, +0xB4E5,0xDA48,0xB4F9,0xD9FB,0xD9ED,0xD9EE,0xB4FD,0xD9F2, +0xD9F9,0xD9F3, 0,0xB4FB,0xB544,0xD9EF,0xD9E8,0xD9E9, + 0,0xD9EB,0xB4EA,0xD9F8, 0,0xB4F8,0xB542, 0, + 0,0xD9FA,0xDA53,0xDA4B,0xB4E6,0xDA51,0xB4F2, 0, +0xB4F0, 0,0xDA57,0xB4EF,0xDA41,0xD9F4,0xD9FE,0xB547, +0xDA45,0xDA42,0xD9F0,0xB543,0xDA4F,0xDA4C,0xDA54,0xB4E9, +0xDA40,0xB546, 0,0xDA47, 0, 0,0xB4F3,0xB4F6, + 0,0xDA46,0xB545,0xD9F5,0xD5E4, 0, 0,0xDA50, +0xDA4E,0xDA52, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD9EC,0xB540, 0, 0, 0,0xDE61,0xDE60,0xDE46, +0xB7BD, 0,0xDE5F,0xDE49,0xDE4A, 0,0xB7C7,0xDE68, +0xB7C2,0xDE5E, 0,0xDE43,0xB7C8,0xB7BE,0xDE52,0xDE48, +0xDE4B,0xDE63,0xB7B8,0xDE6A,0xDE62,0xB7C1,0xDE57,0xB7CC, + 0, 0,0xB7CB,0xB7C5, 0, 0,0xDE69,0xB7B9, +0xDE55,0xDE4C,0xDE59,0xDE65,0xB7CD, 0,0xB7BB,0xDE54, + 0,0xDE4D,0xB7C4, 0,0xB7C3,0xDE50,0xDE5A,0xDE64, +0xDE47,0xDE51,0xB7BC,0xDE5B,0xB7C9,0xB7C0,0xDE4E,0xB7BF, +0xDE45,0xDE53,0xDE67,0xB4FE,0xBAB0,0xDE56,0xE26C,0xDE58, +0xDE66,0xB7C6,0xDE4F,0xB7BA,0xB7CA,0xBCF0,0xDE44, 0, +0xDE5D, 0, 0, 0,0xDE5C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE2AA,0xBAAD,0xE27D,0xE2A4,0xBAA2, + 0,0xE26E,0xBAAF, 0,0xBA77,0xE26D,0xE2B0,0xBAB1, +0xE271,0xE2A3, 0,0xE273,0xE2B3,0xE2AF,0xBA75,0xBAA1, +0xE653,0xBAAE,0xBA7D,0xE26F, 0,0xE2AE,0xBAA3,0xE2AB, +0xE2B8,0xE275,0xE27E, 0, 0,0xE2B6,0xE2AC,0xBA7C, + 0, 0,0xE27C,0xBA76,0xBA74,0xBAA8, 0, 0, +0xE27A,0xE277,0xE278, 0,0xE2B2, 0,0xE2B7,0xE2B5, +0xBA7A,0xE2B9,0xBA7E,0xBAA7, 0,0xE270,0xE5FA,0xE279, + 0,0xBA78,0xBAAC,0xBAA9,0xBA7B,0xE2A5,0xE274,0xBAAA, +0xE2A7,0xBAA4,0xBAA6,0xBA73, 0,0xE2A9,0xE2A1,0xE272, +0xBAA5,0xE2B1,0xE2B4,0xE27B,0xE2A8, 0,0xBA79,0xBCDF, +0xE2A6,0xE5F9, 0,0xE2AD, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE276,0xE644, +0xE64E,0xBCE2,0xE64D,0xE659,0xBCE4,0xE64B, 0,0xE64F, +0xBCEF, 0,0xE646,0xBCE7, 0,0xE652,0xE9F0,0xBCF3, +0xBCF2,0xE654,0xE643,0xE65E,0xBCED, 0,0xBCE3,0xE657, + 0,0xE65B,0xE660,0xE655,0xE649,0xBCE6,0xBCE9,0xBCF1, +0xBCEC, 0,0xE64C,0xE2A2, 0, 0,0xE648,0xE65F, +0xBCE8, 0,0xBCEB,0xE661,0xBCE0,0xE656,0xE5FB,0xE65C, +0xC0DF, 0,0xE64A, 0,0xBCE1,0xE645,0xBCE5,0xE5FC, +0xBAAB,0xE641, 0,0xE65A,0xE642,0xE640,0xBCEA, 0, +0xE658, 0,0xE5FE,0xE651,0xE650,0xE65D,0xE647,0xBCEE, + 0, 0, 0, 0, 0, 0,0xE9F3, 0, +0xBF49,0xBEFE,0xEA40,0xE9EB,0xBF41,0xE9F7,0xBF48,0xBF43, +0xE9F5,0xED4F,0xE9FB,0xEA42,0xE9FA,0xE9E9,0xE9F8,0xEA44, +0xEA46,0xBEFD,0xEA45,0xBF44,0xBF4A, 0,0xBF47, 0, +0xE9FE,0xBF46,0xE9F9, 0,0xE9ED,0xE9F2, 0,0xE9FD, +0xBF45,0xBF42,0xBEFC,0xBF40,0xE9F1, 0,0xE5FD,0xE9EC, +0xE9EF,0xEA41,0xE9F4,0xE9EA,0xED4E,0xEA43,0xE9EE,0xE9FC, + 0, 0, 0, 0,0xED51,0xC0E3, 0, 0, +0xC0D7, 0, 0,0xC0DB,0xED53,0xED59,0xED57,0xC0D9, +0xC0DA,0xC0E1,0xED5A,0xED52,0xC0DC, 0,0xED56,0xED55, +0xED5B,0xC0E2, 0,0xC0DD,0xC0E0,0xED54,0xC0E4,0xC0DE, +0xC0E5,0xC0D8,0xED58, 0,0xED50, 0, 0,0xEFF7, + 0, 0,0xC271,0xEFF4,0xEFF6, 0,0xC26F,0xEFF2, +0xEFF3,0xEFEE, 0, 0,0xE9F6,0xEFEF,0xC270,0xEFEB, + 0,0xC26D,0xEFF8,0xC26E,0xEFEC,0xEFED,0xEFF1,0xC273, + 0,0xC272, 0, 0,0xEFF0,0xC378,0xF25F,0xF265, +0xC379,0xF25C,0xC376,0xC373,0xF267,0xC377, 0,0xC374, +0xF25E,0xF261,0xF262,0xF263,0xF266, 0,0xEFF5,0xF25D, +0xC375,0xF264,0xF268,0xF260, 0, 0, 0,0xF45D, +0xC46A,0xF460,0xC46B,0xF468,0xF45F,0xF45C, 0,0xF45E, +0xF462,0xF465,0xF464,0xF467,0xF45B, 0,0xC469,0xF463, +0xF466,0xF469,0xF461,0xF5D3,0xF5D4,0xF5D8,0xF5D9, 0, +0xF5D6,0xF5D7,0xF5D5, 0,0xC4E9, 0, 0, 0, + 0,0xC578,0xF6EB, 0, 0,0xF6E8,0xF6E9,0xF6EA, +0xC579, 0,0xF7E5,0xF7E4, 0,0xF8AF,0xC5F4,0xF8AD, +0xF8B0,0xF8AE,0xF8F5,0xC657,0xC665,0xF9A3,0xF96C, 0, +0xF9A2,0xF9D0,0xF9D1,0xA4F5, 0, 0, 0, 0, +0xA6C7,0xCA41, 0, 0,0xCB5E, 0,0xA85F, 0, +0xA862, 0,0xCB5F, 0,0xA860,0xA861, 0, 0, + 0, 0,0xCD58,0xCD5A,0xCD55,0xCD52,0xCD54, 0, + 0, 0,0xAAA4, 0, 0, 0,0xAAA2, 0, + 0,0xCD56,0xAAA3,0xCD53,0xCD50,0xAAA1,0xCD57, 0, +0xCD51,0xAAA5,0xCD59, 0, 0, 0, 0,0xCFAF, + 0,0xCFB3, 0, 0,0xACB7, 0, 0, 0, + 0,0xCFB6, 0,0xACAF,0xACB2,0xACB4,0xACB6,0xACB3, +0xCFB2,0xCFB1, 0,0xACB1,0xCFB4,0xCFB5, 0,0xCFAE, +0xACB5, 0,0xACB0, 0, 0, 0,0xCFB0, 0, + 0, 0, 0, 0, 0,0xD277,0xD278,0xD279, +0xAF50, 0,0xAF4C,0xD26E, 0,0xD276,0xD27B,0xAF51, + 0,0xD26C,0xD272,0xD26B,0xD275, 0, 0,0xD271, +0xAF4D,0xAF4F,0xD27A, 0,0xD26A,0xD26D,0xD273, 0, +0xD274,0xD27C,0xD270, 0,0xAF4E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xB26D, +0xD64E, 0, 0,0xD650,0xD64C, 0,0xD658,0xD64A, +0xD657,0xB269,0xD648,0xDA5B,0xD652,0xB26C, 0,0xD653, +0xD656, 0,0xD65A, 0,0xD64F, 0,0xD654, 0, + 0,0xB26A,0xB26B,0xD659,0xD64D,0xD649,0xD65B, 0, +0xD651, 0, 0,0xD655, 0, 0, 0,0xD64B, + 0,0xB548,0xB549,0xDA65,0xB54F, 0,0xDA59,0xDA62, +0xDA58,0xB54C,0xDA60,0xDA5E, 0,0xDA5F,0xB54A, 0, +0xDA63, 0, 0, 0, 0, 0,0xDA5C,0xDA5A, +0xB54B,0xDA5D,0xDA61, 0, 0, 0,0xB54D, 0, + 0, 0,0xDA64, 0, 0, 0, 0, 0, + 0,0xDE70,0xDE77,0xDE79,0xDEA1, 0,0xB7DA,0xDE6B, + 0,0xB7D2, 0,0xDE7A,0xB7D7,0xDEA2,0xB7CE, 0, +0xDE7D, 0,0xDE6D,0xDE7E,0xDE6C, 0,0xB7DC, 0, +0xDE78,0xB7CF,0xDEA3, 0,0xB7D4,0xDE71,0xB7D9,0xDE7C, +0xDE6F,0xDE76,0xDE72,0xDE6E,0xB7D1,0xB7D8,0xB7D6,0xB7D3, +0xB7DB,0xB7D0,0xDE75, 0,0xB7D5, 0,0xB54E, 0, +0xDE7B, 0,0xDE73, 0, 0, 0, 0, 0, +0xDE74, 0, 0,0xE2C1, 0,0xBAB4, 0, 0, +0xE2BD,0xE2C3,0xE2BF, 0,0xBAB6,0xE2BE,0xE2C2,0xE2BA, + 0,0xE2BC,0xBAB5, 0, 0, 0, 0,0xE2C0, +0xE2BB, 0,0xBAB7, 0,0xBAB2, 0, 0,0xE2C4, + 0,0xBAB3,0xE667,0xE664,0xE670,0xE66A,0xE66C,0xBCF4, +0xE666,0xE66E, 0, 0,0xE66D,0xE66B, 0,0xE671, +0xBCF7,0xE668,0xE66F, 0,0xBCF5, 0, 0,0xE663, +0xE665,0xBCF6,0xE662,0xE672, 0,0xE669, 0, 0, +0xEA4A,0xBF51, 0, 0,0xEA55,0xEA53,0xBF4B,0xEA49, +0xEA4C,0xEA4D,0xEA48,0xBF55,0xBF56,0xEA47,0xEA56,0xEA51, +0xBF4F,0xBF4C,0xEA50,0xEA4E, 0, 0,0xBF52,0xEA52, +0xBF4D, 0,0xBF4E, 0,0xEA4F,0xBF50,0xEA4B, 0, +0xEA54,0xBF53,0xEA57,0xEA58,0xBF54, 0, 0,0xC0E7, +0xC0EE,0xED5C,0xED62, 0,0xED60,0xC0EA,0xC0E9,0xC0E6, +0xED5E, 0, 0, 0,0xC0EC,0xC0EB,0xC0E8, 0, +0xED61,0xED5D,0xED5F, 0,0xC0ED, 0, 0, 0, +0xC277,0xEFFB, 0,0xC274,0xC275,0xEFFD,0xC276,0xEFFA, + 0,0xEFF9,0xF26C,0xEFFC, 0,0xF26D,0xC37A,0xF26B, + 0, 0,0xF26A, 0,0xF269,0xC37B, 0, 0, +0xC46C, 0, 0,0xF46A,0xF46B, 0, 0, 0, + 0,0xF5DC,0xF5DB,0xC4EA, 0,0xF5DA,0xF6EC,0xF6ED, + 0, 0,0xF7E6,0xF8B1, 0, 0,0xF8F6,0xF9BC, +0xC679,0xF9C6,0xA4F6, 0,0xAAA6,0xAAA7, 0, 0, +0xACB8, 0, 0, 0, 0,0xC0EF,0xA4F7, 0, +0xAAA8,0xAF52,0xB7DD,0xA4F8, 0,0xB26E,0xBAB8,0xC962, + 0,0xCFB7,0xD27D, 0,0xE2C5, 0,0xC0F0,0xA4F9, +0xAAA9,0xCFB8,0xCFB9,0xDA66,0xB550, 0, 0,0xDEA4, + 0, 0,0xB7DE,0xE2C6, 0, 0,0xBCF8, 0, +0xC37C,0xA4FA,0xDA67,0xA4FB, 0,0xA6C9,0xCA42,0xA6C8, +0xA865,0xA864,0xA863,0xCB60, 0, 0, 0,0xAAAA, + 0,0xAAAB,0xCD5B, 0,0xCFBA, 0,0xCFBD,0xACBA, +0xCFBB, 0,0xACB9,0xCFBC,0xACBB, 0,0xD2A2,0xD2A1, +0xD27E,0xAF53, 0,0xD65D,0xD65E,0xB26F,0xD65C,0xD65F, +0xB552,0xB270, 0, 0,0xB551,0xDA6B,0xDA6A, 0, +0xDA68,0xDA69, 0,0xDA6C,0xDEA6,0xDEA5,0xDEA9, 0, +0xDEA8,0xDEA7,0xBAB9,0xE2C9, 0,0xE2C8,0xBABA,0xE2C7, +0xE673, 0,0xE674,0xBCF9, 0,0xEA59,0xEA5A, 0, + 0,0xF272,0xC37D,0xF271,0xF270,0xF26E,0xF26F,0xC4EB, +0xF46C,0xF6EE,0xF8F7, 0,0xA4FC, 0,0xC9A5,0xA5C7, +0xC9A6, 0, 0, 0,0xCA43,0xCA44, 0, 0, + 0, 0,0xCB66, 0, 0,0xCB62, 0,0xCB61, +0xAAAC,0xCB65,0xA867,0xCB63,0xA866,0xCB67,0xCB64, 0, + 0,0xCD5F,0xCFBE,0xCD5D,0xCD64, 0,0xAAAD, 0, +0xAAB0,0xCD65,0xCD61, 0,0xCD62, 0,0xCD5C,0xAAAF, +0xCD5E,0xAAAE,0xCD63, 0,0xCD60, 0, 0,0xCFC2, +0xACBD,0xACBE, 0,0xCFC5,0xCFBF, 0,0xCFC4, 0, +0xCFC0,0xACBC,0xCFC3,0xCFC1, 0, 0, 0, 0, + 0, 0, 0,0xD2A8,0xD2A5, 0,0xD2A7,0xAF58, +0xAF57,0xAF55,0xD2A4,0xD2A9,0xAF54,0xAF56,0xD2A6,0xD667, +0xD2A3,0xD2AA, 0, 0, 0, 0, 0,0xD662, +0xD666, 0,0xD665,0xDA6E,0xDA79, 0, 0,0xD668, + 0,0xD663,0xDA6D,0xB274, 0, 0,0xB273,0xD661, +0xD664,0xB275, 0,0xB272,0xB271,0xD660,0xD669, 0, + 0, 0,0xDA70,0xDA77, 0,0xB554,0xDA76,0xDA73, + 0,0xB556, 0, 0, 0,0xDA75, 0, 0, +0xDA6F,0xDA71,0xDA74,0xDA72,0xB555,0xDA78,0xB553,0xB7DF, + 0, 0,0xDEAD,0xDEAC,0xDEAA, 0,0xB7E2,0xB7E1, +0xDEAE, 0,0xDEAB,0xE2CA,0xBABB,0xB7E0, 0, 0, + 0,0xDEB0,0xDEAF, 0,0xE2CD,0xE2CB,0xBCFA, 0, +0xBABC,0xE2CC,0xE676, 0, 0, 0, 0,0xBCFB, +0xE675,0xE67E,0xE67D,0xE67B, 0,0xE67A,0xE677,0xE678, +0xE679,0xE67C,0xE6A1, 0, 0,0xEA5F,0xEA5C,0xEA5D, +0xBF57,0xEA5B,0xEA61,0xEA60,0xEA5E, 0,0xED64,0xED65, +0xC0F1, 0,0xC0F2,0xED63, 0,0xC279,0xEFFE,0xC278, +0xC37E, 0,0xC3A1,0xC46D,0xF46E,0xF46D,0xF5DD,0xF6EF, +0xC57A,0xF7E8,0xF7E7,0xF7E9,0xA5C8,0xCFC6,0xAF59,0xB276, +0xD66A,0xA5C9,0xC9A7,0xA4FD, 0, 0,0xCA45, 0, + 0, 0,0xCB6C,0xCB6A,0xCB6B,0xCB68,0xA868,0xCB69, + 0, 0, 0, 0, 0,0xCD6D, 0,0xAAB3, +0xCD6B,0xCD67,0xCD6A, 0,0xCD66,0xAAB5,0xCD69, 0, +0xAAB2,0xAAB1, 0,0xAAB4,0xCD6C,0xCD68, 0, 0, + 0, 0,0xACC2,0xACC5,0xCFCE,0xCFCD,0xCFCC,0xACBF, +0xCFD5,0xCFCB, 0,0xACC1,0xD2AF, 0,0xCFD2,0xCFD0, +0xACC4, 0,0xCFC8,0xCFD3, 0,0xCFCA,0xCFD4,0xCFD1, +0xCFC9, 0,0xACC0,0xCFD6,0xCFC7,0xACC3, 0, 0, + 0, 0,0xD2B4,0xD2AB,0xD2B6, 0,0xD2AE,0xD2B9, +0xD2BA,0xD2AC,0xD2B8,0xD2B5,0xD2B3,0xD2B7,0xAF5F, 0, +0xAF5D, 0, 0,0xD2B1, 0,0xD2AD, 0,0xD2B0, +0xD2BB,0xD2B2,0xAF5E,0xCFCF, 0,0xAF5A,0xAF5C, 0, + 0, 0, 0, 0,0xD678,0xD66D,0xD66B, 0, +0xD66C, 0,0xD673, 0,0xD674,0xD670,0xB27B,0xD675, +0xD672,0xD66F, 0,0xB279,0xD66E,0xB277,0xB27A,0xD671, +0xD679,0xAF5B,0xB278,0xD677,0xD676,0xB27C, 0, 0, + 0, 0, 0, 0, 0, 0,0xDA7E, 0, + 0, 0,0xDAA1,0xB560, 0,0xDAA7, 0, 0, +0xDAA9,0xDAA2,0xB55A,0xDAA6,0xDAA5,0xB55B,0xB561, 0, +0xB562,0xDAA8,0xB558,0xDA7D,0xDA7B,0xDAA3,0xDA7A,0xB55F, +0xDA7C,0xDAA4,0xDAAA,0xB559,0xB55E,0xB55C,0xB55D, 0, + 0, 0,0xB557, 0, 0, 0, 0,0xB7E9, +0xDEB7,0xB7E8,0xDEBB, 0,0xDEB1, 0,0xDEBC, 0, + 0, 0,0xDEB2,0xDEB3, 0,0xDEBD,0xDEBA,0xDEB8, +0xDEB9,0xDEB5,0xDEB4, 0,0xDEBE,0xB7E5, 0,0xDEB6, + 0,0xB7EA,0xB7E4,0xB7EB,0xB7EC, 0,0xB7E7,0xB7E6, + 0, 0,0xE2CE,0xBABE,0xBABD, 0, 0,0xE2D3, + 0,0xBCFC,0xBABF, 0, 0,0xBAC1,0xE2D4,0xB7E3, +0xBAC0,0xE2D0,0xE2D2,0xE2CF, 0,0xE2D1, 0, 0, + 0,0xE6AB, 0, 0,0xE6AA,0xE6A7,0xBD40,0xEA62, +0xBD41,0xE6A6, 0,0xBCFE, 0,0xE6A8,0xE6A5,0xE6A2, +0xE6A9,0xE6A3,0xE6A4,0xBCFD, 0, 0, 0, 0, +0xED69, 0,0xEA66, 0,0xEA65,0xEA67, 0,0xED66, +0xBF5A, 0,0xEA63, 0,0xBF58, 0,0xBF5C,0xBF5B, +0xEA64,0xEA68, 0,0xBF59, 0,0xED6D,0xC0F5,0xC27A, +0xC0F6,0xC0F3,0xED6A,0xED68, 0,0xED6B, 0,0xED6E, +0xC0F4,0xED6C,0xED67, 0, 0,0xF042,0xF045,0xF275, +0xF040, 0,0xF46F,0xF046, 0,0xC3A2,0xF044,0xC27B, +0xF041,0xF043,0xF047,0xF276, 0,0xF274, 0, 0, + 0, 0,0xC3A3,0xF273, 0, 0, 0,0xC46E, + 0, 0, 0, 0,0xC4ED,0xF6F1,0xC4EC,0xF6F3, +0xF6F0,0xF6F2,0xC5D0,0xF8B2,0xA5CA,0xCD6E,0xD2BC,0xD2BD, +0xB27D,0xDEBF,0xBF5D,0xC3A4,0xC57B,0xF8B3,0xA5CB, 0, +0xCD6F,0xA260, 0, 0,0xCFD7, 0,0xCFD8, 0, + 0, 0, 0, 0,0xD2BE,0xD2BF,0xB27E,0xB2A1, + 0, 0, 0,0xDAAB, 0,0xDEC2,0xDEC1,0xDEC0, +0xE2D5, 0,0xE2D6,0xE2D7,0xBAC2, 0, 0,0xE6AD, +0xE6AC, 0, 0,0xEA69,0xBF5E,0xBF5F, 0,0xED72, +0xED6F,0xED70,0xED71,0xF049,0xF048,0xC27C,0xF277,0xF5DE, +0xA5CC, 0,0xACC6, 0,0xB2A2,0xDEC3, 0,0xA5CD, + 0,0xD2C0,0xB2A3, 0, 0,0xB563,0xB564, 0, +0xA5CE,0xA5CF,0xCA46,0xA86A,0xA869,0xACC7,0xCFD9,0xDAAC, +0xA5D0,0xA5D1,0xA5D2,0xA5D3, 0, 0, 0,0xA86B, +0xA86C,0xCB6E,0xCB6D, 0, 0,0xAAB6,0xCD72,0xCD70, +0xCD71, 0, 0, 0, 0, 0, 0,0xCFDA, +0xCFDB, 0, 0,0xACCB,0xACC9, 0,0xACCA,0xACC8, + 0, 0, 0, 0,0xAF60, 0, 0, 0, + 0,0xAF64,0xAF63,0xD2C1,0xAF62,0xAF61, 0,0xD2C2, + 0, 0,0xB2A6,0xD67B,0xD67A,0xB2A4,0xB2A5, 0, + 0, 0,0xB566,0xB565,0xDAAE, 0, 0,0xDAAD, +0xB2A7, 0, 0, 0, 0, 0,0xB7ED,0xDEC5, +0xB7EE,0xDEC4, 0, 0, 0,0xE2D8,0xE6AE,0xBD42, +0xEA6A, 0, 0, 0,0xED73, 0,0xC3A6,0xC3A5, + 0, 0,0xC57C,0xA5D4,0xCD73, 0, 0,0xB2A8, +0xE2D9,0xBAC3, 0, 0,0xCB6F,0xCB70, 0, 0, +0xCD74,0xAAB8,0xAAB9, 0, 0,0xAAB7, 0, 0, + 0, 0,0xACCF,0xACD0,0xACCD,0xACCE, 0,0xCFDC, + 0, 0,0xCFDD,0xACCC, 0, 0, 0, 0, +0xD2C3, 0,0xAF68,0xAF69, 0,0xB2AB,0xD2C9, 0, +0xAF6E,0xAF6C,0xD2CA,0xD2C5,0xAF6B,0xAF6A,0xAF65,0xD2C8, +0xD2C7,0xD2C4,0xAF6D, 0,0xD2C6,0xAF66, 0,0xAF67, + 0, 0,0xB2AC,0xD6A1,0xD6A2,0xB2AD,0xD67C,0xD67E, +0xD6A4,0xD6A3,0xD67D, 0,0xB2A9,0xB2AA, 0,0xDAB6, +0xB56B,0xB56A,0xDAB0,0xB568, 0,0xDAB3,0xB56C,0xDAB4, +0xB56D,0xDAB1,0xB567,0xB569,0xDAB5, 0,0xDAB2,0xDAAF, + 0, 0, 0, 0, 0,0xDED2, 0,0xDEC7, +0xB7F0,0xB7F3,0xB7F2,0xB7F7,0xB7F6,0xDED3,0xDED1,0xDECA, +0xDECE,0xDECD,0xB7F4,0xDED0,0xDECC,0xDED4,0xDECB,0xB7F5, +0xB7EF,0xB7F1, 0,0xDEC9, 0, 0, 0, 0, +0xE2DB,0xBAC7,0xE2DF,0xBAC6,0xE2DC,0xBAC5, 0,0xDEC8, +0xDECF,0xE2DE, 0,0xBAC8,0xE2E0,0xE2DD,0xE2DA, 0, + 0,0xE6B1,0xE6B5,0xE6B7,0xE6B3,0xE6B2,0xE6B0,0xBD45, +0xBD43,0xBD48,0xBD49,0xE6B4,0xBD46,0xE6AF,0xBD47,0xBAC4, +0xE6B6,0xBD44, 0, 0, 0,0xEA6C, 0,0xEA6B, +0xEA73,0xEA6D,0xEA72,0xEA6F,0xBF60,0xEA71, 0, 0, +0xBF61, 0,0xBF62, 0,0xEA70,0xEA6E, 0, 0, + 0, 0,0xC0F8,0xED74, 0, 0,0xC0F7,0xED77, +0xED75,0xED76, 0, 0,0xC0F9, 0, 0, 0, +0xF04D, 0,0xC2A1,0xF04E, 0, 0,0xC27D,0xF04F, +0xC27E,0xF04C,0xF050, 0,0xF04A, 0, 0,0xC3A7, +0xF278,0xC3A8,0xC46F, 0,0xF04B,0xC470, 0, 0, + 0,0xC4EE,0xF5DF, 0,0xC57E,0xF6F4,0xC57D, 0, +0xF7EA,0xC5F5,0xC5F6, 0, 0,0xF9CC, 0, 0, +0xACD1,0xCFDE, 0,0xB56E,0xB56F,0xA5D5,0xA6CA,0xCA47, + 0,0xCB71,0xA86D, 0,0xAABA, 0,0xACD2,0xACD3, +0xACD4,0xD6A6,0xD2CB,0xAF6F, 0, 0,0xB2AE,0xD6A5, + 0, 0,0xDAB8,0xB571, 0,0xDAB7,0xB570, 0, + 0,0xDED5,0xBD4A,0xE6BB,0xE6B8,0xE6B9,0xE6BA, 0, + 0, 0, 0, 0,0xED78, 0,0xF051, 0, + 0, 0,0xF471,0xF470, 0,0xF6F5,0xA5D6,0xCD75, +0xAF70, 0, 0, 0,0xB572,0xDED6, 0, 0, +0xE2E1, 0,0xBD4B,0xEA74, 0,0xF052,0xF472,0xA5D7, + 0, 0,0xAABB,0xACD7,0xCFDF,0xACD8,0xACD6, 0, +0xACD5,0xD2CC,0xAF71, 0, 0,0xAF72,0xAF73, 0, + 0, 0,0xB2B0,0xD6A7,0xB2AF, 0, 0, 0, + 0, 0,0xDAB9,0xB2B1,0xB573,0xDED7,0xB7F8,0xB7F9, + 0,0xBAC9, 0,0xBACA,0xBD4C,0xBF64,0xEA75,0xBF63, + 0,0xED79,0xC0FA, 0,0xF053,0xF473,0xA5D8,0xA86E, +0xCD78,0xCD77,0xAABC,0xCD76,0xAABD,0xCD79, 0,0xCFE5, +0xACDB,0xACDA,0xCFE7,0xCFE6,0xACDF, 0,0xACDE, 0, + 0,0xACD9, 0,0xCFE1,0xCFE2,0xCFE3, 0,0xACE0, +0xCFE0,0xACDC,0xCFE4,0xACDD, 0, 0, 0, 0, +0xD2CF,0xD2D3,0xD2D1,0xD2D0, 0,0xD2D4, 0, 0, + 0,0xD2D5,0xD2D6,0xD2CE, 0,0xD2CD, 0,0xAF75, +0xAF76, 0,0xD2D7,0xD2D2, 0,0xD6B0, 0,0xD2D8, +0xAF77,0xAF74, 0, 0, 0,0xD6AA, 0,0xD6A9, + 0,0xD6AB,0xD6AC,0xD6AE,0xD6AD,0xD6B2,0xB2B5,0xB2B2, +0xB2B6,0xD6A8,0xB2B7,0xD6B1,0xB2B4,0xD6AF,0xB2B3, 0, + 0, 0, 0, 0,0xDABC,0xDABE,0xDABA,0xDABB, + 0, 0,0xDABF,0xDAC1,0xDAC2,0xDABD,0xDAC0,0xB574, + 0, 0,0xDEDB, 0,0xDEE0,0xDED8,0xDEDC, 0, + 0,0xDEE1,0xDEDD,0xB7FA,0xB843, 0,0xB7FD,0xDED9, +0xDEDA,0xBACE,0xB846,0xB7FE, 0,0xB844,0xB7FC,0xDEDF, +0xB845,0xDEDE,0xB841,0xB7FB,0xB842,0xDEE2,0xE2E6,0xE2E8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xB840, 0, 0,0xE2E3,0xBACC,0xE2E9,0xBACD, +0xE2E7,0xE2E2,0xE2E5,0xE2EA,0xBACB,0xE2E4, 0,0xBD4E, +0xE6BF,0xE6BE, 0,0xBD51,0xBD4F,0xE6BC,0xBD4D,0xE6BD, + 0,0xBD50, 0, 0, 0,0xEA7D, 0,0xEAA1, + 0,0xEA7E,0xEA76,0xEA7A,0xEA79,0xEA77,0xBF66,0xBF67, +0xBF65,0xEA78,0xEA7B,0xEA7C, 0,0xBF68, 0,0xC140, +0xEDA3, 0,0xC0FC,0xED7B,0xC0FE,0xC141, 0, 0, +0xC0FD,0xEDA2,0xED7C,0xC0FB,0xEDA1,0xED7A,0xED7E,0xED7D, + 0, 0,0xF055,0xC2A4,0xC2A5,0xC2A2, 0,0xC2A3, + 0, 0,0xF054, 0,0xF27B, 0, 0,0xC3A9, + 0,0xF279,0xF27A, 0,0xF474,0xF477,0xF475,0xF476, +0xF5E0, 0, 0,0xC4EF,0xF7EB,0xF8B4, 0,0xC5F7, +0xF8F8,0xF8F9,0xC666,0xA5D9,0xACE1, 0,0xDAC3, 0, +0xDEE3, 0,0xA5DA,0xA86F, 0,0xAABE, 0,0xCFE8, +0xCFE9,0xAF78, 0, 0,0xDAC4,0xB575,0xB847,0xC142, +0xEDA4,0xF27C,0xF478,0xA5DB, 0, 0, 0,0xCDA1, +0xCD7A,0xCD7C,0xCD7E,0xCD7D,0xCD7B,0xAABF, 0, 0, + 0, 0,0xACE2,0xCFF2, 0,0xCFED,0xCFEA, 0, + 0,0xCFF1, 0, 0,0xACE4,0xACE5,0xCFF0,0xCFEF, +0xCFEE,0xCFEB,0xCFEC,0xCFF3,0xACE3, 0, 0, 0, + 0, 0, 0, 0, 0,0xAF7C, 0,0xAFA4, +0xAFA3,0xD2E1,0xD2DB,0xD2D9, 0,0xAFA1,0xD6B9,0xAF7A, +0xD2DE,0xD2E2,0xD2E4,0xD2E0,0xD2DA,0xAFA2,0xD2DF,0xD2DD, +0xAF79,0xD2E5,0xAFA5,0xD2E3,0xAF7D,0xD2DC, 0,0xAF7E, +0xAF7B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xB2B9, 0,0xD6BA, 0, 0, +0xD6B3,0xD6B5,0xD6B7, 0,0xD6B8,0xD6B6,0xB2BA, 0, +0xD6BB, 0,0xD6B4, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDAC8,0xB576,0xDAD0, 0, +0xDAC5, 0,0xDAD1, 0,0xDAC6,0xDAC7, 0, 0, +0xDACF,0xDACE,0xDACB,0xB2B8,0xB577,0xDAC9,0xDACC,0xB578, +0xDACD,0xDACA, 0, 0, 0, 0, 0, 0, + 0,0xDEEE, 0,0xDEF2,0xB84E, 0,0xE2F0,0xB851, +0xDEF0,0xF9D6, 0,0xDEED,0xDEE8,0xDEEA,0xDEEB,0xDEE4, + 0,0xB84D, 0, 0,0xB84C, 0,0xB848,0xDEE7, + 0,0xB84F, 0,0xB850,0xDEE6,0xDEE9,0xDEF1,0xB84A, +0xB84B,0xDEEF,0xDEE5, 0, 0, 0,0xE2F2,0xBAD0, +0xE2F4,0xDEEC,0xE2F6,0xBAD4,0xE2F7,0xE2F3, 0,0xBAD1, +0xE2EF,0xBAD3,0xE2EC,0xE2F1,0xE2F5,0xE2EE, 0, 0, +0xB849, 0,0xE2EB,0xBAD2,0xE2ED, 0, 0, 0, + 0, 0,0xBD54,0xE6C1,0xBD58, 0,0xBD56, 0, + 0,0xBACF, 0,0xE6C8,0xE6C9,0xBD53, 0, 0, +0xE6C7,0xE6CA,0xBD55,0xBD52,0xE6C3,0xE6C0,0xE6C5,0xE6C2, +0xBD59,0xE6C4, 0, 0,0xE6C6,0xBD57, 0, 0, + 0, 0,0xBF6A,0xEAA8, 0,0xEAA2,0xEAA6,0xEAAC, +0xEAAD,0xEAA9,0xEAAA,0xEAA7, 0,0xEAA4, 0,0xBF6C, +0xBF69,0xEAA3,0xEAA5, 0,0xBF6B,0xEAAB, 0,0xC146, + 0, 0,0xEDAA,0xEDA5,0xC145, 0, 0,0xC143, + 0,0xEDAC,0xC144,0xEDA8,0xEDA9,0xEDA6,0xEDAD,0xF056, + 0,0xC147,0xEDA7, 0,0xEDAE,0xEDAB, 0, 0, + 0,0xF05A, 0, 0,0xF057, 0,0xC2A6, 0, +0xF05B,0xF05D,0xF05C,0xF058,0xF059, 0, 0,0xF2A3, + 0,0xC3AA, 0,0xF27E,0xF2A2,0xF27D,0xF2A4, 0, + 0,0xF2A1, 0,0xF47A,0xF47D,0xF479,0xC471,0xF47B, +0xF47C,0xF47E,0xC472,0xC474,0xC473,0xF5E1, 0,0xF5E3, + 0,0xF5E2, 0, 0, 0,0xF6F6, 0, 0, +0xF8B5,0xF8FA,0xA5DC, 0, 0,0xCB72,0xAAC0,0xCDA3, +0xAAC1,0xAAC2,0xCDA2, 0,0xCFF8,0xCFF7,0xACE6,0xACE9, +0xACE8,0xACE7,0xCFF4,0xCFF6,0xCFF5, 0, 0,0xD2E8, +0xAFA7,0xD2EC,0xD2EB,0xD2EA,0xD2E6,0xAFA6,0xAFAA,0xAFAD, + 0, 0,0xAFAE,0xD2E7,0xD2E9,0xAFAC,0xAFAB,0xAFA9, +0xAFA8,0xD6C2, 0,0xD6C0,0xD6BC,0xB2BB, 0,0xD6BD, +0xB2BC,0xD6BE,0xD6BF,0xD6C1, 0,0xB2BD, 0, 0, +0xDAD5, 0,0xDAD4,0xDAD3,0xDAD2, 0, 0, 0, + 0,0xDEF6,0xB852, 0,0xDEF3,0xDEF5, 0,0xB853, + 0,0xB854,0xDEF4, 0, 0, 0, 0, 0, +0xE341, 0,0xE2F9,0xE2FA, 0,0xBAD7,0xBAD5,0xBAD6, +0xE343, 0,0xE342,0xE2FE,0xE2FD,0xE2FC,0xE2FB,0xE340, +0xE2F8, 0,0xE6CB,0xE6D0,0xE6CE, 0, 0, 0, +0xE6CD,0xE6CC,0xE6CF, 0,0xEAAE, 0,0xBF6D,0xC148, +0xEDB0, 0,0xC149,0xEDAF,0xF05F,0xF05E,0xC2A7, 0, +0xF2A5,0xC3AB,0xF4A1,0xC5A1,0xF6F7, 0,0xF8B7,0xF8B6, +0xC9A8,0xACEA,0xACEB,0xD6C3, 0,0xB856,0xA5DD,0xA872, +0xA871,0xA870, 0, 0, 0,0xCDA4, 0, 0, +0xAAC4,0xAAC3, 0,0xACEE, 0,0xCFFA,0xCFFD,0xCFFB, + 0,0xACEC,0xACED, 0, 0,0xCFF9,0xCFFC, 0, +0xAFB5, 0, 0, 0,0xD2F3,0xD2F5,0xD2F4,0xAFB2, +0xD2EF, 0, 0,0xAFB0,0xAFAF, 0,0xAFB3,0xAFB1, + 0,0xAFB4,0xD2F2,0xD2ED,0xD2EE,0xD2F1,0xD2F0, 0, + 0, 0, 0, 0, 0, 0,0xD6C6,0xD6C7, +0xD6C5, 0,0xD6C4,0xB2BE, 0, 0, 0, 0, +0xB57D, 0,0xDAD6,0xDAD8,0xDADA,0xB57C, 0, 0, +0xB57A, 0,0xDAD7,0xB57B,0xDAD9,0xB579, 0, 0, +0xDF41,0xDEF7,0xDEFA,0xDEFE,0xB85A,0xDEFC, 0,0xDEFB, +0xDEF8,0xDEF9,0xB858,0xDF40,0xB857, 0,0xB85C,0xB85B, +0xB859, 0,0xDEFD, 0, 0, 0,0xE349, 0, +0xE348, 0, 0,0xE344, 0, 0,0xBAD8,0xE347, +0xE346,0xBAD9, 0, 0, 0, 0, 0,0xBD5E, + 0,0xE6D2, 0,0xBD5F,0xBD5B,0xBD5D, 0,0xBD5A, +0xBD5C, 0, 0, 0,0xEAAF, 0,0xBF70,0xEAB1, +0xEAB0, 0,0xE345,0xBF72,0xBF71,0xBF6E,0xBF6F, 0, + 0, 0, 0, 0,0xEDB5, 0,0xEDB3,0xC14A, +0xEDB4, 0,0xEDB6,0xEDB2,0xEDB1, 0, 0,0xF060, +0xC2AA,0xC2A8,0xC2A9, 0, 0, 0, 0,0xF2A6, +0xF2A7,0xC3AD, 0,0xC3AC,0xF4A3,0xF4A4,0xF4A2, 0, +0xF6F8,0xF6F9, 0, 0,0xA5DE,0xCA48,0xA873, 0, +0xCDA5,0xAAC6,0xAAC5,0xCDA6, 0, 0,0xD040,0xACEF, +0xCFFE,0xACF0, 0, 0,0xAFB6,0xD2F8,0xD2F6,0xD2FC, +0xAFB7,0xD2F7,0xD2FB,0xD2F9,0xD2FA, 0, 0,0xD6C8, +0xD6CA, 0,0xB2BF, 0,0xD6C9,0xB2C0,0xB5A2,0xB5A1, +0xB57E,0xDADB, 0, 0, 0, 0,0xDF44,0xB85D, +0xB85E, 0,0xDF43,0xDF42, 0, 0, 0, 0, +0xE34A,0xBADB,0xBADA,0xE34B,0xE34C, 0,0xBD61,0xBD60, + 0,0xEAB5,0xE6D3,0xE6D5,0xE6D4,0xEAB4,0xEAB2,0xEAB6, +0xEAB3, 0,0xBF73, 0, 0, 0,0xEDB7,0xC14B, +0xEDB8,0xEDB9, 0, 0,0xC2AB,0xC2AC, 0,0xC475, + 0, 0,0xC5D1,0xA5DF, 0, 0, 0, 0, + 0,0xD041, 0, 0, 0, 0, 0, 0, +0xD2FD,0xAFB8, 0, 0, 0, 0, 0,0xB3BA, +0xB3B9, 0, 0,0xB5A4,0xDADD,0xB5A3,0xDADC, 0, + 0, 0, 0,0xDF45, 0,0xBADC,0xE34D,0xBADD, + 0, 0, 0, 0, 0, 0,0xC476,0xF4A5, + 0,0xA6CB,0xAAC7,0xCDA7, 0,0xACF2, 0,0xACF1, +0xD042,0xD043, 0, 0,0xD340,0xD342,0xAFB9, 0, +0xD344,0xD347,0xD345, 0, 0, 0,0xD346,0xD343, +0xD2FE,0xAFBA,0xD348,0xD341, 0, 0, 0, 0, +0xD6D3,0xB2C6,0xD6DC,0xB2C3, 0,0xD6D5,0xB2C7, 0, +0xB2C1, 0,0xD6D0,0xD6DD,0xD6D1,0xD6CE,0xB2C5, 0, +0xB2C2, 0,0xD6D4,0xD6D7,0xB2C4,0xD6D8,0xB2C8,0xD6D9, +0xD6CF,0xD6D6,0xD6DA,0xD6D2,0xD6CD,0xD6CB, 0, 0, +0xD6DB, 0, 0,0xDADF, 0, 0, 0, 0, +0xDAE4, 0, 0, 0,0xDAE0,0xDAE6,0xB5A7,0xD6CC, +0xDAE1,0xB5A5,0xDADE,0xB5AC,0xDAE2,0xB5AB,0xDAE3,0xB5AD, +0xB5A8,0xB5AE,0xB5A9, 0,0xB5AA, 0,0xB5A6, 0, +0xDAE5, 0, 0, 0, 0, 0, 0, 0, +0xB861,0xDF50, 0,0xDF53,0xDF47,0xDF4C,0xDF46,0xB863, + 0,0xDF4A, 0, 0, 0,0xDF48,0xB862, 0, +0xDF4F,0xDF4E,0xDF4B,0xDF4D,0xDF49,0xBAE1,0xDF52,0xB85F, +0xDF51, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE35D, 0,0xBAE8,0xE358, 0,0xBAE7, +0xE34E, 0,0xE350,0xBAE0,0xE355,0xE354,0xE357,0xBAE5, +0xE352,0xE351, 0, 0,0xBAE4,0xBADF,0xE353,0xBAE2, +0xE359,0xE35B, 0,0xE356,0xE34F,0xBAE3, 0, 0, +0xBD69,0xBADE, 0, 0,0xE35C, 0, 0, 0, + 0, 0, 0, 0,0xE6D9,0xBD62, 0,0xE6DB, + 0,0xBD63, 0, 0,0xBD65,0xE6DE, 0,0xE6D6, +0xBAE6,0xE6DC, 0, 0, 0, 0,0xE6D8, 0, +0xB860,0xBD68, 0, 0,0xBD64, 0,0xBD66,0xBD67, + 0,0xBF76,0xE6DD,0xE6D7,0xBD6A, 0,0xE6DA, 0, + 0, 0, 0, 0,0xEAC0,0xEABB, 0, 0, +0xEAC5,0xBF74,0xEABD,0xBF78,0xEAC3,0xEABA,0xEAB7,0xEAC6, +0xC151,0xBF79,0xEAC2,0xEAB8,0xBF77,0xEABC,0xBF7B,0xEAB9, +0xEABE,0xBF7A,0xEAC1,0xEAC4, 0, 0, 0, 0, +0xEDCB,0xEDCC,0xEDBC,0xEDC3,0xEDC1, 0, 0,0xC14F, +0xEDC8,0xEABF, 0,0xEDBF, 0,0xEDC9,0xC14E,0xEDBE, +0xEDBD,0xEDC7,0xEDC4,0xEDC6, 0,0xEDBA,0xEDCA,0xC14C, + 0,0xEDC5,0xEDCE,0xEDC2,0xC150,0xC14D,0xEDC0,0xEDBB, +0xEDCD,0xBF75, 0, 0, 0, 0, 0, 0, + 0,0xF063, 0, 0,0xF061,0xF067,0xC2B0,0xF065, +0xF064,0xC2B2,0xF06A,0xC2B1, 0,0xF06B,0xF068,0xC2AE, +0xF069,0xF062,0xC2AF,0xC2AD,0xF2AB,0xF066, 0, 0, +0xF06C, 0, 0,0xF2A8, 0, 0, 0,0xC3B2, +0xC3B0,0xF2AA, 0,0xF2AC,0xF2A9,0xC3B1,0xC3AE,0xC3AF, +0xC3B3, 0, 0,0xC478, 0,0xF4AA, 0,0xF4A9, +0xF4A7,0xF4A6,0xF4A8, 0,0xC477,0xC479, 0, 0, +0xC4F0, 0, 0,0xF5E5,0xF5E4, 0, 0,0xF6FA, + 0,0xF6FC,0xF6FE,0xF6FD,0xF6FB, 0, 0,0xC5A3, +0xC5A2, 0, 0,0xC5D3,0xC5D2,0xC5D4,0xF7ED,0xF7EC, + 0,0xF8FB,0xF8B8,0xF8FC,0xC658, 0,0xC659,0xF96D, + 0, 0,0xC67E,0xA6CC, 0,0xCDA8, 0, 0, +0xD045,0xD046,0xD044, 0, 0,0xACF3, 0,0xD047, +0xD048,0xD049, 0, 0,0xD349,0xD34F, 0, 0, +0xD34D,0xAFBB,0xD34B, 0,0xD34C,0xD34E, 0, 0, + 0,0xD34A,0xB2C9, 0,0xD6DE,0xB2CB,0xD6E0,0xB2CA, +0xD6DF, 0, 0, 0, 0, 0,0xDAE8,0xB5AF, + 0,0xDAEA,0xDAE7,0xD6E1, 0,0xB5B0, 0,0xF9DB, +0xDAE9, 0, 0, 0, 0, 0, 0,0xDF56, + 0,0xB864,0xDF54,0xB865,0xDF55,0xB866, 0, 0, + 0,0xBAE9,0xE361,0xE35E,0xE360,0xBAEA,0xBAEB,0xE35F, + 0, 0, 0, 0, 0,0xE6DF, 0, 0, +0xE6E0, 0,0xBD6B,0xE6E2,0xE6E1, 0,0xA261, 0, +0xEACA,0xEACB,0xEAC7, 0,0xEAC8,0xBF7C,0xBF7D,0xEAC9, + 0,0xC157, 0, 0,0xC153,0xC158,0xC154,0xC156, +0xC152, 0,0xC155, 0, 0, 0, 0,0xC2B3, +0xEDCF, 0,0xF2AE, 0,0xF2AD, 0,0xF4AB,0xC47A, +0xC47B,0xF741,0xF5E6, 0,0xF740, 0,0xF8FD,0xF9A4, +0xA6CD, 0, 0,0xA874, 0,0xCDA9,0xAAC8, 0, +0xACF6,0xD04C,0xACF4,0xD04A,0xACF9,0xACF5,0xACFA,0xACF8, +0xD04B,0xACF7,0xAFBF,0xAFBE,0xD35A,0xAFC7,0xD353,0xD359, +0xAFC3,0xD352,0xD358,0xD356,0xAFC2,0xAFC4,0xD355,0xAFBD, +0xD354,0xAFC8,0xAFC5,0xAFC9,0xAFC6,0xD351,0xD350,0xD357, +0xAFC0,0xAFBC,0xAFC1, 0, 0, 0, 0, 0, +0xD6F0,0xD6E9, 0,0xB5B5,0xD6E8, 0,0xB2CF,0xB2D6, +0xB2D3,0xB2D9,0xB2D8,0xB2D4, 0,0xD6E2,0xD6E5, 0, +0xD6E4,0xB2D0,0xD6E6,0xD6EF,0xB2D1,0xD6E3,0xD6EC,0xD6ED, +0xB2D2,0xD6EA,0xB2D7,0xB2CD,0xB2D5,0xD6E7,0xB2CC,0xD6EB, + 0, 0,0xD6EE, 0, 0, 0,0xDAFB,0xDAF2, +0xB5B2,0xDAF9,0xDAF6,0xDAEE,0xDAF7,0xB5B4,0xDAEF, 0, +0xDAEB, 0, 0,0xB86C,0xDAF4, 0,0xB5B1,0xDAFA, + 0,0xB5B8,0xB5BA,0xDAED, 0, 0,0xB5B9,0xDAF0, +0xB5B3,0xDAF8,0xDAF1,0xDAF5, 0,0xDAF3,0xB5B6,0xDAEC, +0xB5BB,0xB2CE,0xB5B7,0xB5BC, 0, 0, 0, 0, + 0,0xB868,0xDF5D,0xDF5F,0xDF61,0xDF65, 0,0xDF5B, +0xDF59,0xB86A, 0,0xDF60,0xDF64,0xDF5C,0xDF58, 0, +0xDF57, 0, 0, 0,0xDF62,0xDF5A,0xDF5E,0xB86B, + 0,0xB869,0xDF66,0xB867,0xDF63, 0,0xE372, 0, + 0, 0, 0, 0,0xBAEE,0xE36A,0xBD78,0xE374, +0xBAF1,0xE378,0xBAF7,0xE365, 0, 0,0xE375,0xE362, + 0,0xE377,0xE366, 0,0xBAFE,0xBAFB,0xE376,0xE370, +0xBAED,0xBAF5,0xBAF4, 0,0xBAF3,0xBAF9, 0,0xE363, +0xBAFA,0xE371,0xBAF6,0xBAEC,0xE373,0xBAEF,0xBAF0,0xBAF8, +0xE368,0xE367,0xE364, 0,0xE36C,0xE369,0xE36D,0xBAFD, + 0,0xE379,0xBAF2,0xE36E,0xE36F, 0,0xE36B, 0, + 0, 0,0xBAFC, 0, 0, 0, 0,0xE6E7, +0xBD70,0xBD79,0xBD75,0xE6E4, 0,0xBD72,0xBD76,0xE6F0, +0xBD6C,0xE6E8, 0,0xBD74, 0, 0,0xE6EB,0xE6E6, +0xBD73,0xBD77,0xE6E5, 0,0xBD71, 0,0xE6EF,0xBD6E, +0xE6EE,0xE6ED,0xBD7A,0xE572,0xBD6D, 0,0xE6EC,0xE6E3, + 0,0xBD7B,0xE6EA,0xBD6F, 0, 0, 0, 0, + 0, 0, 0,0xE6E9, 0, 0, 0, 0, +0xBFA2,0xBFA7,0xBF7E,0xEAD8,0xEACF,0xEADB,0xEAD3,0xEAD9, +0xBFA8,0xBFA1,0xEACC,0xEAD2,0xEADC,0xEAD5,0xEADA,0xEACE, + 0, 0,0xEAD6,0xBFA3,0xEAD4,0xBFA6,0xBFA5,0xEAD0, +0xEAD1,0xEACD,0xEAD7,0xBFA4,0xEADE,0xEADD, 0, 0, + 0,0xEDDA,0xEDD6,0xC15F, 0,0xEDD0,0xC159,0xC169, +0xEDDC,0xC161,0xC15D,0xEDD3,0xC164,0xC167,0xEDDE,0xC15C, +0xEDD5,0xC165,0xEDE0,0xEDDD,0xEDD1,0xC160,0xC15A,0xC168, +0xEDD8,0xC163,0xEDD2,0xC15E,0xEDDF,0xC162,0xC15B,0xEDD9, +0xC166,0xEDD7, 0, 0,0xEDDB, 0, 0, 0, +0xF06E,0xF074,0xC2B9,0xF077,0xC2B4,0xC2B5,0xF06F,0xF076, +0xF071,0xC2BA,0xC2B7, 0,0xF06D, 0,0xC2B6,0xF073, +0xF075,0xC2B8,0xF072,0xF070, 0, 0, 0, 0, +0xF2B8,0xC3B7,0xC3B8,0xC3B4, 0,0xC3B5, 0,0xF2B4, +0xF2B2, 0,0xF2B6,0xC3BA,0xF2B7,0xF2B0,0xF2AF,0xF2B3, +0xF2B1,0xC3B6,0xF2B5,0xF4AC,0xC47E,0xC47D,0xF4AD, 0, +0xF4AF,0xF4AE,0xC4A1, 0, 0, 0,0xF5EB,0xF5E8, +0xF5E9, 0,0xF5E7,0xF5EA,0xC4F2,0xF5EC, 0,0xC4F1, + 0,0xF742, 0,0xC5D5,0xC5D7,0xF7EE,0xC5D6,0xF8B9, +0xF940,0xF942,0xF8FE,0xF941,0xC66C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA6CE, 0, +0xACFB,0xD26F,0xAFCA, 0, 0,0xB2DA,0xDAFC,0xDAFD, + 0, 0, 0,0xEADF,0xC16A,0xEDE1, 0, 0, +0xC2BB, 0,0xF2BA,0xF2B9,0xC4A2,0xF5ED, 0,0xF743, +0xC5F8,0xCA49, 0, 0,0xAAC9,0xA875, 0, 0, +0xD04D, 0, 0,0xD360,0xD35B,0xD35F,0xD35D,0xAFCB, +0xD35E,0xD35C, 0,0xD6F1, 0,0xDAFE,0xDB40,0xDF69, +0xDF6A,0xB86E,0xB86F,0xDF68,0xDF6B,0xDF67,0xB86D, 0, +0xBB40, 0,0xB870,0xE37A, 0,0xBD7C,0xE6F1,0xBD7D, + 0,0xBFA9,0xEAE2,0xEAE0,0xEAE1,0xEDE4,0xEDE3,0xEDE2, + 0, 0, 0,0xF2BB, 0,0xC3B9,0xF2BC,0xF744, +0xC5F9,0xF8BA,0xA6CF,0xAACB,0xAACA,0xD04F,0xACFC, 0, + 0,0xD04E,0xD362, 0,0xAFCC,0xD6F2,0xD361, 0, + 0, 0,0xB2DC,0xD6F5,0xD6F3,0xD6F4,0xB2DB, 0, +0xDB42,0xDB43,0xDB41, 0,0xB873,0xDF6D,0xDF6C,0xDF6E, +0xB872,0xB871, 0, 0,0xE6F2,0xE6F4, 0,0xBD7E, +0xE6F3,0xEAE3,0xBFAA,0xF079, 0,0xF078,0xC3BB,0xF2BD, +0xC3BD,0xC3BC,0xF4B0,0xF5EE,0xC4F3,0xA6D0,0xD050,0xACFD, +0xD365,0xAFCE,0xD364,0xD363, 0,0xAFCD, 0,0xD6FB, + 0,0xD6FD,0xD6F6,0xD6F7,0xB2DD,0xD6F8,0xB2DE,0xD6FC, +0xD6F9,0xD6FA,0xB2DF, 0,0xB5BE,0xB5BF, 0,0xDB44, + 0, 0, 0,0xDF6F,0xDF70, 0,0xE37E,0xBB43, +0xBB41,0xBB42,0xE37B,0xE37C, 0,0xE37D,0xE6F9, 0, +0xE6FA,0xBDA1,0xE6F7,0xE6F6,0xE6F8,0xE6F5,0xBFAD,0xEAE4, +0xBFAB,0xBFAC,0xEDE6,0xC16B,0xEDE5,0xEFA8, 0,0xF07A, +0xF07B,0xC2BC, 0,0xC2BD,0xC16C,0xF2BE,0xF2BF,0xF4B1, +0xC4A3,0xA6D1, 0,0xA6D2,0xACFE,0xAACC,0xAFCF,0xD051, + 0, 0, 0,0xB5C0,0xA6D3,0xAD41,0xD052,0xD053, +0xAD40,0xAD42,0xA6D4, 0,0xD054,0xAFD1,0xD366,0xAFD3, +0xAFD0,0xAFD2, 0,0xD741,0xB2E0, 0,0xD740,0xD6FE, + 0,0xDF71, 0, 0,0xE3A1, 0,0xBDA2, 0, +0xBFAE,0xEAE6,0xEAE5, 0,0xEDE7, 0, 0, 0, +0xF5EF, 0, 0,0xA6D5,0xCB73,0xCDAA,0xAD43,0xD055, + 0,0xD368, 0, 0, 0,0xAFD4,0xD367,0xAFD5, + 0, 0, 0,0xD743, 0, 0,0xB2E2,0xD742, +0xD744, 0,0xB2E1, 0, 0, 0, 0,0xDB46, +0xDB47,0xDB45,0xB5C1, 0, 0, 0,0xB874, 0, +0xB875, 0,0xBB45, 0,0xE3A3,0xE3A2,0xBB44, 0, + 0, 0, 0, 0,0xE6FB, 0, 0,0xE6FC, + 0, 0, 0, 0,0xEAE7, 0, 0,0xC170, +0xC16F,0xC16D,0xC16E,0xC171, 0,0xF07C,0xC2BF,0xC2BE, +0xF2C0,0xF4B2, 0, 0, 0,0xC5A5,0xC5A4,0xA6D6, + 0, 0,0xD1FB, 0,0xB877,0xB5C2,0xB876,0xBB46, + 0,0xA6D7,0xC9A9,0xA6D8,0xA6D9, 0, 0,0xCDAB, +0xCB76, 0,0xCB77,0xA877, 0,0xCB74,0xA876, 0, +0xA879,0xCB75,0xA87B,0xA87A,0xCB78,0xA878, 0, 0, + 0,0xAAD1,0xAACF,0xCDAD, 0,0xAACE, 0, 0, + 0,0xAAD3,0xAAD5,0xAAD2, 0,0xCDB0,0xCDAC,0xAAD6, + 0,0xAAD0,0xA87C, 0,0xAAD4,0xCDAF, 0, 0, +0xCDAE, 0,0xAACD, 0, 0, 0, 0, 0, + 0, 0,0xD05B,0xAD47,0xAD48,0xD05D, 0,0xD057, +0xD05A,0xD063,0xD061, 0,0xAD49,0xD067,0xAD4C,0xD064, +0xD05C,0xD059, 0, 0,0xDB49,0xD062,0xAD44,0xD065, +0xD056,0xD05F,0xAD46,0xAD4B,0xD060,0xAD4F,0xAD4D, 0, +0xD058,0xAD4A, 0,0xD05E,0xAD4E,0xAD45,0xD066, 0, + 0, 0, 0, 0, 0,0xAFDA, 0,0xAFE3, +0xAFD8,0xAFD6,0xD36A,0xAFDE,0xAFDB,0xD36C, 0, 0, +0xAFDD,0xD36B,0xD369,0xD36E,0xAFE2,0xAFE0,0xDB48, 0, +0xD36F,0xD36D,0xAFD7, 0, 0,0xAFD9,0xAFDC, 0, +0xAFDF, 0,0xAFE1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD74E,0xB2E4, 0, +0xD745,0xD747, 0,0xD748, 0,0xD750,0xD74C,0xD74A, + 0,0xD74D,0xD751,0xB2E5,0xB2E9,0xD746, 0,0xD74F, + 0,0xB2E7, 0,0xB2E6,0xD74B,0xD749, 0,0xB2E3, +0xB2E8, 0, 0, 0, 0, 0, 0, 0, + 0,0xB5C8,0xDB51, 0, 0,0xDB4F,0xB5CA, 0, + 0, 0, 0,0xDB4A,0xDFA1, 0,0xB5C9,0xDB4E, + 0, 0,0xDB4B,0xB5C5,0xB5CB,0xDB50,0xB5C7,0xDB4D, +0xBB47,0xB5C6,0xDB4C,0xB5CC,0xB5C4,0xB5C3, 0, 0, + 0, 0, 0,0xDF77,0xDF75, 0,0xDF7B, 0, +0xDF73,0xDFA2,0xDF78, 0,0xDF72,0xB87B,0xB8A3,0xDF7D, + 0,0xDF76, 0,0xB87E, 0, 0,0xB87C,0xDF7E, +0xB879,0xB878,0xDF79,0xB87D,0xB5CD, 0,0xDF7C,0xDF74, +0xB87A,0xB8A1,0xB8A2, 0, 0, 0, 0,0xBB4C, +0xBB48, 0,0xBB4D,0xE3A6, 0, 0,0xE3A5,0xE3A7, +0xBB4A,0xE3A4,0xBB4B,0xE3AA,0xE3A9,0xE3A8, 0,0xBB49, + 0, 0, 0, 0, 0,0xE741, 0,0xE744, +0xBDA8,0xE743,0xBDA7,0xBDA3,0xBDA4,0xBDA5,0xE740,0xE6FE, +0xBDA6, 0,0xE742,0xE6FD, 0, 0,0xEAE9,0xEAF3, +0xBFB1,0xBFB0, 0,0xEAED,0xEAEF, 0,0xEAEA, 0, +0xEAEE,0xEAE8,0xEAF1,0xBFAF,0xEAF0,0xEAEC, 0,0xEAF2, + 0,0xEAEB,0xC174,0xEDE8,0xEDEE,0xC178,0xC17A,0xC177, +0xC176, 0,0xC175,0xC173,0xEDE9,0xEDEC,0xC172,0xEDED, + 0,0xC179,0xEDEB, 0,0xEDEA,0xC2C0, 0,0xC2C1, +0xF0A1,0xF07D,0xF07E, 0, 0,0xF2C2, 0,0xF2C1, +0xC3BE,0xF4B4,0xC4A4,0xF4B3, 0,0xF5F0,0xF745,0xC5A6, +0xF943,0xF944,0xC5D8,0xA6DA, 0,0xAAD7,0xDB52,0xBB4E, +0xC17B,0xEDEF,0xA6DB, 0,0xAFE5,0xAFE4,0xDB53, 0, + 0, 0,0xEAF4,0xA6DC,0xAD50, 0, 0,0xDB54, +0xDB55,0xDB56,0xBB4F,0xBFB2,0xA6DD, 0,0xAAD8,0xD068, +0xAFE6,0xD370,0xB2EA, 0,0xDB57,0xB8A4, 0,0xBB50, +0xBFB3,0xC17C,0xC2C2,0xF4B5,0xA6DE,0xAAD9, 0, 0, +0xAFE7,0xD752,0xB5CE, 0,0xBB51,0xE3AB,0xE745, 0, + 0, 0, 0,0xA6DF,0xB5CF,0xDFA3,0xBB52,0xA6E0, +0xCDB1,0xD069,0xAD51, 0, 0,0xD372, 0, 0, +0xAFEA, 0,0xAFE8,0xAFE9,0xAFEB, 0, 0,0xD371, + 0, 0,0xD757,0xD754,0xD756,0xB2EB,0xB2ED,0xB2EC, +0xD753,0xB2EE,0xD755, 0,0xDB58,0xDB59, 0,0xDB5A, +0xDFA6, 0,0xDFA7, 0,0xDFA5,0xDFA8, 0,0xB8A5, + 0,0xDFA4, 0,0xBB53, 0, 0,0xE74A,0xE746, +0xE749,0xE74B,0xE748,0xE747, 0,0xEAF5,0xEAF6,0xEAF7, +0xBFB4,0xBFB5,0xEDF1,0xEDF0,0xEDF2, 0,0xF0A3,0xF0A2, + 0,0xF2C4, 0,0xF2C5,0xF2C3, 0,0xC4A5, 0, +0xF4B6,0xF4B7, 0,0xF746,0xF7EF,0xF8BB,0xA6E1,0xA87D, + 0,0xC17D,0xA6E2, 0,0xD758,0xDB5B, 0,0xC641, +0xCA4A, 0, 0, 0,0xCA4B,0xCA4D,0xA6E3,0xCA4E, +0xCA4C, 0, 0,0xCBA2,0xCBA3,0xCB7B, 0, 0, + 0, 0,0xCBA1,0xA8A1, 0,0xA8A2,0xCB7C,0xCB7A, +0xCB79,0xCB7D,0xA87E,0xCB7E,0xD06A, 0, 0, 0, +0xCDB6,0xAADC,0xCDB5,0xCDB7, 0,0xAADB,0xCDBC,0xAADF, +0xCDB2,0xCDC0,0xCDC6,0xAAE6,0xCDC3,0xAAE3, 0,0xCDB9, +0xCDBF,0xCDC1, 0,0xCDB4,0xAAE2,0xAADD,0xCDBA,0xAAE4, +0xAAE7,0xAAE1, 0,0xAADA,0xCDBE,0xCDB8,0xCDC5,0xAAE9, +0xAAE5,0xAAE0,0xCDBD,0xAFEC,0xCDBB,0xAADE,0xAAE8, 0, +0xCDB3, 0,0xCDC2,0xCDC4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xAD62,0xAD5C,0xAD64,0xAD61,0xD071,0xD074,0xAD5D, + 0,0xD06B, 0,0xAD56,0xAD60, 0,0xAD63,0xAD65, +0xD0A2,0xD077, 0,0xAD55,0xD0A1,0xAD59,0xAD57,0xAD52, +0xD06F, 0,0xD07E,0xD073,0xD076,0xD0A5, 0,0xAD66, +0xD07D,0xAD5E,0xD078,0xD0A4,0xD075,0xD079,0xD07C, 0, + 0,0xD06D,0xD0A3,0xD07B, 0, 0,0xD06C, 0, +0xD070,0xAD5F,0xAD5A,0xAD53,0xAD58,0xAD54,0xAD67,0xD06E, +0xD3A5,0xAD5B, 0, 0,0xD07A,0xCE41, 0, 0, + 0, 0, 0, 0, 0, 0,0xD3A8,0xAFFA, + 0,0xD376, 0,0xD3A3,0xD37D, 0,0xD3B2, 0, +0xD3AA, 0,0xD37E, 0,0xD3A9,0xD378,0xD37C,0xD3B5, +0xAFFD,0xD3AD,0xD3A4,0xAFED,0xD3B3,0xD374, 0,0xD3AC, + 0,0xAFFC,0xAFF7,0xD373,0xAFF5,0xAFF4,0xAFF9,0xD3AB, +0xAFF1,0xAFF8,0xD072,0xDB5C,0xD3A6, 0, 0,0xD37A, +0xAFFB,0xD37B,0xD3A1,0xAFFE,0xD375,0xD3AF, 0,0xD3AE, +0xD3B6,0xAFF3,0xAFF0,0xD3B4,0xD3B0,0xD3A7,0xD3A2,0xAFF6, +0xAFF2,0xD377,0xAFEE,0xD3B1,0xAFEF, 0,0xD379, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD75E,0xD760,0xD765,0xD779,0xB2FC, +0xB2F2, 0,0xD75D,0xB2FD,0xB2FE,0xD768,0xD76F,0xD775, + 0,0xD762, 0,0xD769, 0, 0,0xB340,0xD777, +0xD772,0xB2FA,0xB2F8,0xD76E,0xD76A,0xD75C,0xB2EF,0xD761, +0xD759, 0,0xB2F7,0xB2F9,0xD766,0xD763,0xB2F4,0xD773, +0xB2F1,0xD764,0xD77A,0xD76C, 0,0xD76B,0xB2F0, 0, +0xB2FB, 0,0xB2F3,0xD75A,0xD75F,0xD770,0xD776,0xB341, +0xD75B,0xD767,0xD76D,0xB2F6, 0, 0,0xD778,0xD771, +0xD774, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xB2F5, 0,0xDB6C, +0xDB60,0xB5D7,0xDB7D,0xDBA7,0xDBAA,0xB5D5,0xDB68,0xDBA3, +0xDB69,0xDB77,0xB5E2,0xDB73,0xB5DF, 0,0xDB74,0xDB5D, + 0,0xDBA4, 0, 0,0xB5E8,0xDBA1,0xDB75,0xDBAC, +0xDB70,0xDFC8, 0,0xDBAF,0xB5E6,0xDB6E,0xDB7A,0xB5E9, +0xB5D4,0xDB72,0xDBAD,0xDB6B,0xDB64,0xDB6F, 0,0xDB63, +0xDB61,0xB5D0,0xDBA5,0xDB6A,0xDBA8, 0,0xDBA9,0xB5D8, +0xB5DD,0xB5D9,0xB5E1,0xDB7E,0xB5DA,0xDB76,0xDB66, 0, +0xB5D2,0xDB5E,0xDBA2,0xDBAB,0xDB65,0xB5E0,0xDBB0,0xDB71, + 0,0xDB6D, 0,0xB5D1,0xB5E5, 0,0xDB7C,0xB5E7, + 0,0xDB78,0xB5DC,0xB5D6,0xB5DE,0xB5D3,0xB5E4,0xDB79, +0xDB67,0xDB7B,0xDB62,0xDBA6, 0, 0, 0, 0, + 0, 0, 0,0xDBAE, 0, 0, 0, 0, + 0, 0, 0,0xDB5F, 0, 0, 0, 0, + 0,0xDFC7, 0,0xDFDD,0xB855,0xDFCC, 0,0xDFCA, +0xDFB5,0xB8A9,0xDFC5,0xDFD9,0xDFC1,0xB8B1,0xDFD8,0xDFBF, +0xB5E3,0xDFCF,0xDFC0,0xDFD6,0xB8B0,0xB8A8, 0,0xDFAA, +0xDFB2, 0,0xDFCB,0xDFC3,0xDFDC,0xDFC6,0xB8B6,0xDFD7, + 0,0xB8AD, 0,0xDFC9,0xDFD1,0xDFB6,0xDFD0, 0, +0xDFE1,0xDFB1,0xDFD2, 0,0xDFDF, 0,0xDFAB,0xB5DB, + 0,0xDFB9,0xDFB8,0xB8AF, 0,0xDFBC,0xDFBE,0xDFCD, +0xDFDE,0xB8B2, 0,0xB8B3, 0,0xDFB0,0xB8AB,0xDFB4, +0xDFDA,0xB8B4, 0,0xB8AC,0xB8AE,0xB8B5,0xDFE0,0xDFD3, +0xDFCE, 0, 0,0xDFBB,0xDFBA,0xB8AA,0xDFAC,0xB8A7, +0xDFC4,0xDFAD,0xDFC2, 0, 0,0xDFB7,0xDFDB, 0, + 0, 0,0xB8A6, 0, 0, 0,0xDFB3, 0, + 0, 0, 0, 0, 0,0xDFAF,0xDFD5,0xDFAE, +0xBB60,0xE3D3, 0, 0,0xE3C2, 0, 0,0xE3AC, +0xE3CA,0xBB58,0xE3BB,0xE3C5,0xBB5B,0xE3BE,0xBB59,0xE3AF, +0xE3CD,0xE3AE,0xE3C1, 0,0xE3AD, 0, 0,0xE3BF, +0xE3C8,0xE3C6,0xE3BA,0xE3B5,0xE3B3, 0,0xE3B4,0xE3C7, +0xE3D2,0xE3BC,0xBB5A, 0,0xE3B7, 0,0xE3CB, 0, +0xBB5D,0xE3B6,0xE3B0,0xE3C0,0xBB61, 0, 0,0xBB55, +0xBB5E,0xE3B8,0xE3B2, 0,0xBB57,0xDFD4,0xBB56,0xE3C3, + 0,0xBB54,0xBB63,0xBB5C,0xE3C4,0xE3B9,0xE3B1,0xE3CC, +0xE3BD,0xBB62,0xE3D0,0xBB5F,0xE3CF, 0,0xE3C9,0xE3CE, + 0, 0, 0,0xE3D1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE773, +0xE774,0xE767,0xE766,0xE762,0xBDB4, 0,0xBDAC,0xE776, +0xE775,0xDFA9,0xE75F,0xE763,0xE75D, 0,0xE770,0xE761, + 0,0xE777,0xE75A,0xE758,0xE764,0xE76E,0xE769,0xBDB6, +0xE74F, 0,0xE76D, 0, 0, 0,0xBDB7,0xDFBD, +0xE75B,0xE752,0xE755,0xE77B,0xE75C,0xE753,0xE751,0xE74E, + 0,0xBDB0,0xE765,0xBDAF,0xBDB3,0xE760,0xE768,0xBDA9, +0xE778,0xE77C,0xBDAB, 0,0xE757,0xE76B,0xE76F,0xE754, +0xE779,0xBDB2, 0,0xBDB1,0xE74C,0xBDB5,0xE772,0xE756, +0xE76A,0xE750,0xE75E,0xE759,0xBDAD,0xBDAE,0xE76C,0xE77D, +0xE77A,0xE771, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE74D, 0,0xBDAA,0xEB49, 0, +0xEB40,0xEB43, 0,0xBFBB,0xEB45,0xEAF9,0xEB41,0xEB47, +0xBFB8,0xBFBC,0xBFB6, 0, 0,0xEAFB,0xEB4C, 0, + 0,0xEB46, 0,0xEAFC,0xEB55,0xEB4F,0xEAF8,0xEE46, +0xEAFE,0xBFB7, 0,0xEB4A, 0,0xEB54,0xBFBF, 0, +0xEB51,0xEAFD,0xEB44,0xEB48,0xEB42,0xEB56,0xEB53,0xEB50, +0xBFB9,0xBFBA,0xBFBE,0xEAFA,0xEB57,0xBFBD,0xEB4D, 0, + 0,0xEB4B, 0, 0, 0,0xEB4E,0xEE53,0xEE40, +0xEE45,0xEE52,0xEE44,0xEDFB,0xEE41, 0,0xC1A2, 0, +0xEDF4,0xEE4D,0xEE4F,0xEDF3,0xC1A1,0xEE51,0xEE49,0xC1A8, +0xEE50,0xEE42,0xC1AA,0xEDF9,0xEB52,0xEE4A,0xEE47,0xEDF5, +0xEE55,0xC1A4, 0, 0,0xC1A5,0xEDF7,0xEE48, 0, +0xEE54,0xEE4B,0xEDFD,0xC1A7,0xC1A3,0xEE4C,0xEDFE,0xEE56, +0xEDF8,0xEE43,0xEE4E,0xEDFA,0xEDFC, 0,0xC2CB,0xEDF6, +0xC1A9,0xC2C4,0xC17E, 0, 0, 0, 0,0xC1A6, +0xC2C8,0xF0B3, 0,0xF0A9,0xF0A4,0xF0AA,0xF0B4,0xF0B8, +0xF0B7,0xC2CA,0xC2C9, 0, 0,0xF0AB,0xF0B9,0xF0AE, +0xF0A6, 0,0xF0A8,0xF0A7,0xF0AD,0xF0B2,0xF0A5,0xF0AC, +0xF0B1,0xC2C7, 0,0xF0AF, 0,0xC2C5,0xF0B0,0xC2C3, +0xC2C6,0xF2D5,0xF0B5, 0, 0,0xC3C2, 0,0xF2CD, +0xF2D1,0xF2C9,0xF2CC, 0,0xF2D4,0xC3C0,0xF2D9,0xF2D2, + 0,0xF2CA,0xF2DA,0xF2D3,0xC3C3,0xC3C4,0xF2D7, 0, +0xF2CB,0xC3BF,0xC3C1,0xF2C6,0xF2CE,0xF2C8, 0,0xF2D8, +0xF2D6,0xF2C7,0xF2CF, 0, 0, 0,0xF4BE,0xC3C5, +0xF2D0,0xC4A7,0xC4A9,0xC4A6, 0,0xF4C3,0xF4BB,0xF4B9, +0xF4BD,0xF4BA, 0, 0,0xF4BF,0xF4C1,0xC4AA,0xC4AC, + 0,0xF4C0,0xC4AD,0xC4AB,0xF4C2, 0, 0, 0, + 0,0xC4A8, 0, 0, 0, 0, 0,0xC4F4, +0xF5F1,0xF5F7,0xC4F6,0xF4BC,0xF5F6, 0,0xF5FD,0xF5F4, +0xF5FB,0xF5FA,0xF4B8,0xF5F5,0xF0B6,0xF5FE,0xF5F3,0xF5F8, + 0,0xF5FC,0xF5F2, 0,0xF74A,0xC4F5,0xF5F9, 0, + 0,0xF7F4,0xF74B,0xF749,0xF747,0xF748,0xF74C, 0, +0xC5D9,0xF7F2,0xF7F0,0xF7F5,0xF7F3, 0,0xF7F6,0xC5DA, +0xF7F1, 0, 0,0xF8BC, 0, 0,0xF945,0xF946, +0xF947, 0, 0,0xF9C7,0xF9BD,0xCA4F,0xAAEA, 0, +0xAD68, 0,0xD3B8,0xD3B7,0xB040,0xB342,0xD77C, 0, + 0,0xD77B, 0,0xB5EA,0xB8B8, 0,0xB8B7,0xB8B9, + 0,0xE3D4,0xE77E,0xEB58,0xEB5A,0xEB59, 0,0xC1AB, +0xEE57,0xF0BA,0xF9A5,0xA6E4, 0,0xCDC9,0xCDCA,0xCDC8, +0xCDC7,0xAAEB, 0,0xD0A9,0xD0A7, 0, 0,0xD0A6, + 0,0xAD69,0xAD6B,0xAD6A,0xD0A8, 0, 0, 0, + 0, 0, 0, 0, 0,0xD3C4,0xD3C1,0xD3BF, + 0, 0,0xB041,0xD3C2,0xB046,0xD3BC,0xD3CB, 0, +0xD3CD,0xD3BD, 0,0xB043,0xD3CE,0xD3C9,0xD3BB,0xD3C0, +0xD3CA,0xD3C6,0xD3C3, 0,0xB048,0xD3CC,0xD3BE, 0, + 0,0xD3C7,0xD3B9,0xB047,0xB044,0xD3C5, 0,0xD3C8, +0xD3BA,0xB045,0xB042, 0, 0, 0, 0,0xB34C, +0xD7A5,0xB34B, 0,0xD7A8,0xD7AB,0xB348,0xB346,0xD77E, +0xD7A9,0xD7A7,0xD7A4,0xD7AC,0xD7AD,0xD7AF,0xD7B0,0xD77D, +0xB345,0xD7A2,0xD7A1,0xD7AE,0xB347,0xD7A3,0xB349,0xB344, +0xD7A6,0xB34D, 0,0xB34A,0xD7AA, 0, 0, 0, +0xB5F1,0xDBBF, 0,0xDBB4,0xB5EE, 0,0xDFE7,0xDBBD, +0xDBB1,0xB5EC,0xDBB6,0xB5EF,0xDBBA,0xDBB8,0xB5F2,0xB5EB, + 0, 0,0xDBB2,0xDBB5,0xB5F0, 0,0xDBB3, 0, +0xDBBE,0xDBBC,0xDBB7,0xDBB9,0xDBBB,0xB5ED, 0, 0, + 0, 0, 0, 0, 0,0xDFE8,0xDFEE,0xDFE4, +0xDFEA,0xB8BA,0xDFE6,0xB8C0, 0, 0,0xB8BF, 0, +0xB8BE,0xDFED,0xB8C1,0xB8C2,0xDFE3,0xDFF0,0xB8C3,0xB8BD, +0xB8BC,0xDFEC,0xB8C4,0xDFE2,0xDFE5,0xDFEF,0xDFEB, 0, + 0,0xE3F4,0xE3E9,0xB8BB, 0, 0, 0, 0, +0xBB6A,0xE3DD,0xE3F2,0xE3DE,0xBB65, 0,0xE3DB, 0, +0xE3E4,0xE3DC,0xBB67,0xE3D6,0xE3F1,0xBB68,0xE3EE,0xE3EF, +0xE3D7,0xBB6D,0xE3E6, 0,0xE3E0,0xE3E7,0xE3DA, 0, +0xE3F3,0xE3EB,0xE3E5,0xE3D5,0xBB69,0xE3EC, 0,0xBB6C, +0xE3F0, 0,0xE3EA,0xBB66,0xE3E8, 0,0xE3E2,0xBB64, +0xE3D9,0xE3E1,0xE3ED,0xE3DF, 0, 0,0xE3E3, 0, + 0, 0, 0, 0,0xBDC1,0xDFE9,0xE7B2,0xE7BB, +0xE7B1,0xE7AD,0xE7AA,0xBDC2,0xE7A8,0xBB6B,0xE7A1,0xBDC0, +0xE7A7,0xBDBF,0xE7AC,0xE7A9,0xE7B9,0xE7B4,0xE7AE,0xE7B3, +0xBDBB,0xE7AB,0xE7BE,0xE7A2,0xE7A3,0xE7BA,0xBDBC,0xE7BF, +0xBDBE,0xE7C0,0xE7B0,0xE3D8,0xE7B6,0xE7AF,0xE7B8,0xE7B5, + 0, 0, 0,0xE7A6,0xBDB9,0xE7BD,0xBDBA,0xE7A4, +0xBDBD,0xEB64,0xE7B7,0xE7BC, 0, 0, 0, 0, + 0,0xEB61,0xBDB8,0xBFC0,0xEB6B,0xEB67, 0,0xEB65, +0xEB60,0xEB6F, 0, 0, 0,0xBFC4, 0,0xEB5C, +0xEB68,0xEB69,0xEB5F,0xEB5E,0xEB6C, 0,0xEB62,0xEB5D, +0xEB63, 0,0xEB6E,0xEB5B,0xEB6D,0xEB6A,0xBFC2,0xBFC1, + 0, 0,0xBFC3,0xEB66,0xF0CB, 0, 0, 0, + 0, 0,0xEE59,0xC1B1,0xEE5D,0xEE5A,0xEE61,0xEE67, +0xEE5C, 0,0xEE70,0xC1AE,0xEE6A,0xEE5F,0xEE6B,0xEE66, +0xEE6D,0xEE5E,0xC1B3,0xC1B2,0xEE60,0xEE6E,0xEE58,0xEE6C, +0xC1AC, 0,0xEE64,0xEE63,0xEE68,0xEE5B,0xC1B0, 0, +0xC1B4,0xEE62,0xEE69,0xC1B5,0xEE65, 0, 0, 0, + 0,0xC1AD,0xC1AF,0xF0C7,0xF0C5, 0, 0,0xF0CC, +0xF0C9,0xF0CD, 0,0xF0BE,0xF0C6,0xF0D1,0xEE6F,0xF0C2, +0xC2CF,0xE7A5,0xF0BD,0xF0CA,0xF0C4,0xF0C1,0xF0BC,0xF0BB, +0xF0D0, 0,0xF0C0,0xF0BF,0xC2CD,0xF0C8, 0,0xC2CC, + 0, 0,0xC2CE,0xF0C3,0xF0CF, 0,0xF2DE,0xF2DF, + 0,0xC3C9,0xF2DC,0xC3C6,0xF2E4, 0,0xC3CA,0xF2E6, +0xF2DB,0xF0CE,0xF2E8,0xF2DD, 0,0xC3C7,0xF2E3, 0, +0xF2E5,0xF2E0,0xF2E7,0xF2E2,0xF2E1,0xC3C8, 0, 0, +0xF4C5,0xF4C6, 0,0xF4C8,0xC4AE,0xC4AF,0xF4C9,0xF4C7, + 0,0xF4C4, 0,0xF642,0xF645,0xF641, 0,0xC4FA, +0xF643,0xC4F9,0xC4F8,0xC4F7,0xF644,0xF751,0xF74F, 0, +0xF74E,0xF640,0xF750,0xF646,0xF74D, 0,0xF7F9,0xF7D7, +0xF7F7,0xC5DB,0xF7F8,0xF7FA, 0,0xF8BF,0xC5FA,0xF8BE, +0xF8BD,0xC5FB, 0,0xC65A,0xF96E,0xF9A7,0xF9A6,0xF9A8, +0xA6E5,0xD0AA, 0,0xD3CF,0xD3D0, 0, 0, 0, +0xDBC0, 0,0xF647,0xF8C0,0xA6E6,0xAD6C,0xD0AB, 0, + 0, 0,0xD7B1,0xB34E, 0,0xDBC2,0xDBC1,0xB5F3, + 0,0xB8C5,0xE7C1,0xBDC3, 0,0xBDC4, 0, 0, + 0,0xBFC5,0xC5FC,0xA6E7, 0, 0, 0,0xD0AC, +0xAAED,0xD0AE,0xD0AD,0xAD6D, 0,0xD3D1, 0,0xD3D8, +0xB049,0xD3D6,0xD3D4, 0,0xD3DB,0xD3D2,0xD3D3,0xB04A, + 0,0xB04E, 0, 0,0xD3DC,0xB04D,0xD3DA,0xD3D7, +0xD3D5,0xB04B,0xB04C,0xD3D9, 0, 0, 0, 0, +0xB350,0xD7B2, 0,0xB355,0xD7C2,0xB354,0xD7C4, 0, + 0,0xD7B8,0xB352,0xD7C3, 0,0xD7B3,0xB353,0xD7BF, +0xD7BB,0xD7BD,0xD7B7,0xD7BE, 0, 0,0xB34F,0xD7BA, + 0,0xD7B9,0xD7B5, 0,0xD7C0, 0, 0,0xD7BC, +0xD7B4, 0,0xD7B6,0xB351,0xD7C1, 0, 0, 0, + 0,0xB5F6,0xDBCD, 0, 0, 0,0xDBC9,0xDBCB, +0xDBC6,0xDBC5,0xDBC3, 0,0xDBCA,0xDBCC,0xDBC8, 0, +0xDBC7,0xB5F4,0xB5F5, 0, 0, 0, 0, 0, + 0,0xDBCF,0xB8CD,0xDFF2,0xDFF8,0xDFF3,0xDFF4,0xF9D8, +0xDFF9, 0,0xB8CF, 0,0xB8C7,0xB8CE,0xDFF1,0xDBC4, +0xB8CA,0xB8C8,0xDFF7,0xDFF6,0xB8C9,0xB8CB,0xDFF5,0xB8C6, + 0,0xB8CC, 0, 0, 0, 0, 0,0xE3F6, +0xBB74, 0, 0,0xE442,0xE441, 0,0xE3FB,0xBB76, +0xE440,0xE3F7,0xE3F8,0xBB6E,0xBB70, 0,0xE3FD,0xE3F5, +0xBB72,0xBB71,0xE3F9,0xE3FE,0xE3FC,0xBB73,0xE3FA, 0, + 0,0xDBCE,0xBB6F, 0, 0,0xE7C2,0xE7C9,0xBDC6, + 0,0xE7CD,0xBDCA,0xE7C5,0xE7C3, 0,0xE7CC, 0, +0xBDC5,0xE7CB,0xBDC7,0xBDC8,0xE7C4,0xBDC9,0xE7CA,0xE7C6, +0xE7C7,0xE7C8,0xBB75, 0, 0, 0,0xEB70,0xEB7C, + 0,0xBFCA,0xEB77,0xEB79, 0,0xBFC8,0xEB71,0xEB75, + 0,0xEB78,0xBFC6,0xBFC9,0xEB7B,0xEB73,0xEB74,0xEB7A, +0xEB72,0xEB76,0xBFC7,0xEE72, 0,0xEE71,0xC1B7,0xEE77, +0xC1B9, 0, 0,0xC1B6,0xEE73,0xC1BA,0xEE74, 0, + 0,0xEE75,0xEE78, 0,0xC1B8, 0,0xF0D6, 0, + 0,0xF0D9, 0,0xF0D3,0xF0D5, 0, 0,0xF0D4, +0xF0D7,0xF0D8,0xEE76,0xF0D2, 0, 0,0xC3CD,0xF2EC, +0xF2EF,0xF2F1,0xF2EA,0xF2EB,0xF2EE,0xF2F0,0xC3CE,0xC3CC, +0xC3CB,0xF2ED,0xF2E9,0xF4CA,0xC4B0, 0,0xF4CB, 0, + 0,0xF649,0xC4FB,0xF64B,0xC4FC,0xF648,0xF64A,0xC5A8, + 0,0xF752,0xC5A7,0xF7FD,0xF7FC, 0,0xF7FB, 0, + 0,0xF948,0xF949,0xF94B,0xF94A, 0,0xCA50,0xA6E8, + 0,0xAD6E,0xD7C5,0xB5F7, 0,0xDFFA,0xC2D0, 0, +0xF2F2, 0, 0,0xA8A3, 0, 0, 0,0xB357, + 0, 0, 0,0xB356, 0,0xDBD0,0xB5F8,0xDBD2, +0xDBD1, 0, 0,0xDFFB,0xB8D0,0xE443,0xE446,0xE445, + 0,0xE444,0xE7CE,0xE7D0,0xE7CF, 0,0xBFCC, 0, + 0, 0,0xBFCB, 0,0xC1BB,0xEE79,0xEE7B,0xEE7A, + 0, 0,0xC2D1, 0, 0, 0,0xF2F4,0xF2F3, + 0,0xF4CC,0xC4B1, 0, 0,0xC4FD,0xF754,0xF753, +0xC65B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA8A4,0xD0AF,0xAD6F,0xD7C8,0xD7C6, 0, + 0,0xD7C7,0xDBD4,0xDBD5,0xE043,0xDBD3, 0,0xDFFC, +0xE041,0xE040,0xE042,0xB8D1,0xDFFE,0xDFFD,0xE044, 0, +0xE449,0xE447, 0,0xE448,0xE7D3,0xE7D1, 0, 0, +0xE7D2,0xEB7D,0xEE7C,0xEE7D,0xC2D2, 0,0xF2F5,0xF4CD, +0xC4B2, 0,0xF64C,0xF755,0xC5A9, 0,0xF7FE,0xF94C, +0xA8A5, 0,0xAD71,0xAD72,0xD0B0, 0, 0,0xD0B1, +0xAD70, 0,0xB054, 0,0xB052, 0,0xB051,0xB058, +0xB050,0xB059,0xD3DD,0xB056, 0,0xB053,0xB057,0xB055, +0xB04F, 0, 0,0xB35F, 0,0xB359,0xD7CC,0xB35E, + 0, 0,0xB360,0xB35A, 0,0xB35B, 0,0xD7CA, + 0, 0,0xB358, 0,0xD7CB,0xB35D, 0, 0, +0xD7C9,0xB35C, 0, 0,0xB644, 0,0xB646, 0, + 0,0xDBD8,0xB645,0xB5F9,0xB5FD, 0,0xB8E4,0xE049, +0xDBDA,0xB5FE, 0, 0,0xDBDD,0xDBDE,0xB643, 0, +0xDBE0, 0,0xDBE2, 0,0xDBE3,0xDBD7,0xDBD6,0xDBE4, +0xB642,0xDBE1,0xDBDF, 0,0xB640,0xB5FB,0xB647,0xDBDB, +0xDBDC,0xDBD9, 0,0xB641, 0, 0,0xB5FC, 0, +0xB5FA,0xE048,0xB8DF,0xB8DA, 0, 0,0xB8D5, 0, +0xB8E5,0xB8D6, 0,0xB8D2,0xB8E1,0xB8DE,0xB8E0, 0, +0xB8D7,0xB8DC,0xB8D3,0xB8D4,0xE050,0xE04D,0xE045,0xE04A, + 0,0xB8E2,0xE051,0xB8E3,0xB8D9, 0, 0,0xE047, + 0,0xE04F,0xE04B,0xE04E,0xE04C,0xB8DD,0xE046,0xB8D8, + 0, 0, 0,0xE44C,0xBB78,0xBB7B, 0,0xE44E, + 0,0xBBA5,0xE44D,0xBB7D, 0,0xBDCF,0xE44F, 0, +0xBBA4,0xE44B,0xBBA6, 0, 0, 0,0xBB79, 0, +0xB8DB,0xBB7C, 0,0xBB7A,0xBB7E,0xBBA2,0xBB77,0xBBA7, +0xBBA3, 0,0xBBA1,0xE44A, 0, 0, 0, 0, +0xBDD6, 0,0xBDD2, 0, 0, 0,0xBDD9, 0, +0xE7D6,0xBDDA,0xE7E2,0xE7DB,0xBDCB,0xE7E3,0xE7DD,0xBDD5, +0xE7DE, 0,0xBDD4,0xE7E1,0xBDCE,0xE7DF,0xE7D5,0xBDCD, +0xEBAA,0xBDD3, 0,0xBDD0, 0,0xBDD8, 0,0xE7D4, + 0,0xE7D8,0xBDCC,0xE7D7,0xE7D9,0xE7DA,0xBDD7,0xE7DC, +0xE7E0,0xE7E4, 0,0xBDDB,0xBFD2,0xEBA5,0xEBAB,0xEBA8, +0xEB7E,0xEBAC,0xEBA1, 0,0xEBA7, 0,0xBFCD,0xBFD3, +0xEBAD, 0, 0,0xBFCF, 0,0xBFD9,0xBFD4,0xEBAF, +0xEBA9,0xBFD0,0xEBA2,0xBFDA,0xEBA3,0xEBA4,0xBFDB,0xBFD8, +0xBDD1, 0,0xBFCE,0xEBB0,0xBFDC, 0,0xBFD5,0xEBAE, +0xBFD1,0xBFD6,0xBFD7, 0,0xC1C3,0xEEA4,0xEEAD,0xEEAA, +0xEEAC, 0,0xC1C0,0xEEA5, 0,0xEEAB,0xC1BC,0xEEA7, +0xC1C4,0xEEA3,0xEEA8,0xEEAF,0xEBA6,0xEEA9,0xEEA2,0xC1BD, +0xEEA1,0xC1BE,0xEEB0,0xC1BF,0xEEAE,0xC1C2,0xEE7E, 0, +0xC1C1, 0,0xEEA6,0xF0DC,0xF0EA,0xF0E5,0xF0E7,0xF0DB, +0xC2D3, 0,0xF0DA,0xC2D6,0xC2D5, 0,0xF0E9,0xF0E1, +0xF0DE,0xF0E4, 0,0xF0DD, 0,0xF0DF,0xF0E8,0xF0E6, + 0,0xC2D4,0xF0ED,0xF0EB,0xF0E2,0xF0EC,0xF0E3, 0, +0xF2F9,0xC3CF,0xF341, 0, 0,0xF64F,0xC3D6,0xF0E0, +0xF2F7,0xC3D2,0xF2F8,0xF2FD, 0, 0,0xC3D4,0xC3D5, +0xF2F6,0xF340,0xF342,0xF2FA,0xF2FC,0xF2FE,0xF2FB,0xF343, +0xC3D1,0xC3D7,0xC3D3, 0,0xC3D0,0xF4D0, 0,0xC4B7, +0xF4CE, 0, 0,0xF4D2, 0,0xF4D3,0xC4B5,0xF4D4, +0xF4D1, 0,0xF4CF,0xC4B8,0xC4B4,0xF4D5, 0,0xC4B6, +0xC4B3, 0, 0, 0,0xC4FE, 0, 0,0xC540, +0xF64E,0xF64D,0xF650,0xF651, 0,0xC541,0xF756,0xF75B, +0xC5AA, 0,0xF758, 0,0xF757,0xF75A,0xF759, 0, +0xF843, 0,0xC5DC,0xF842,0xF840, 0,0xF841, 0, + 0, 0,0xC5FE,0xC5FD,0xF8C1,0xF8C2,0xC640, 0, +0xF94D,0xF94E,0xC667, 0,0xC66D, 0,0xF9A9,0xF9C8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA8A6, + 0,0xD7CD, 0,0xD7CE,0xE052,0xE450,0xE7E5,0xC1C6, + 0,0xC1C5,0xF0EE,0xF344, 0,0xF844,0xA8A7,0xD3DE, +0xB05A,0xB361,0xE054,0xE053,0xBDDC,0xE7E6,0xBDDD,0xEEB1, +0xC2D7, 0, 0, 0,0xC676,0xA8A8,0xCDCB,0xD3DF, + 0, 0,0xB362, 0,0xD7CF,0xD7D0, 0,0xDBE5, + 0,0xB648,0xB8E6, 0,0xE056,0xE055,0xE057, 0, +0xE451,0xE452,0xBBA8,0xBFDD,0xBDDE,0xBFDE, 0,0xEEB5, +0xEEB2,0xEEB4,0xEEB3,0xC1C7, 0,0xF0EF,0xF346,0xF345, +0xCBA4,0xB05C,0xB05B,0xD3E0, 0,0xD7D1, 0, 0, +0xDBE7,0xDBE6,0xB649, 0,0xE059,0xE05A,0xE058, 0, + 0,0xB8E8,0xB8E7, 0,0xBBAA,0xBBA9, 0,0xE7E7, +0xEBB3,0xEBB1,0xEBB2,0xBFDF,0xEEB7,0xEEB6, 0,0xF0F2, +0xF0F1,0xF0F0,0xF347, 0,0xF9AA,0xA8A9,0xAD73, 0, +0xAD74,0xB05D,0xB05E,0xD3E2,0xD3E1,0xD7D2, 0,0xB368, +0xB366,0xB363,0xB367,0xB365,0xB364, 0, 0,0xB64A, +0xDBEA, 0,0xB8ED,0xB64C,0xB651,0xDBEC,0xB653,0xB652, +0xB655,0xDBEB,0xDBE8,0xB64F,0xB64B,0xB64D,0xDBE9,0xB654, +0xB650,0xB64E,0xB8EF,0xB8EE,0xB8EC,0xB8F0, 0,0xB8EA, +0xB8EB, 0,0xB8E9, 0,0xE05B, 0, 0,0xE454, + 0,0xBBAC,0xBBAD,0xBBAB, 0,0xE453, 0,0xE455, + 0,0xE7EA,0xE7EC, 0,0xBDE7,0xE7ED,0xBDE0,0xE7E9, +0xBDDF,0xBDE9,0xBDE5,0xBDE6,0xBDE2,0xE7E8,0xBDE1,0xE7EE, +0xE7EB, 0,0xBDE8, 0,0xBDE3,0xBDE4,0xEBB5, 0, +0xEBB7,0xEBB6, 0,0xEBB8,0xBFE0,0xEBB4, 0, 0, +0xC1CB,0xEEB8,0xC1C8,0xC1CC,0xC1CA,0xC1C9,0xF0F3, 0, +0xF0F6, 0,0xF0F5, 0,0xF0F4,0xC2D8,0xF348,0xF349, +0xC3D8,0xF34A,0xC3D9, 0, 0,0xC4BA, 0,0xC4B9, +0xF652, 0, 0,0xC542,0xF653,0xF75C,0xC5AB,0xC5AC, + 0,0xF845, 0,0xC642, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA8AA, 0,0xB36A,0xB369, +0xE05C,0xE05D, 0,0xBBAE,0xEBB9,0xBDEA,0xEBBA,0xEEB9, +0xA8AB, 0,0xD0B2,0xAD76,0xAD75, 0,0xD3E3,0xB05F, +0xD3E4,0xD7D5, 0,0xD7D4, 0,0xD7D3, 0, 0, +0xDBEE,0xB658, 0, 0,0xDBED,0xB657, 0, 0, + 0,0xDBEF,0xB656, 0,0xE05F,0xE062,0xE060,0xE061, +0xE065,0xE05E,0xE066,0xE063,0xE064,0xBBB0,0xE456, 0, + 0,0xBBAF, 0,0xE7F2,0xE7F0, 0, 0,0xBDEB, +0xE7EF,0xE7F1, 0,0xBDEC, 0,0xEBBB, 0,0xEBBC, +0xC1CD, 0,0xF34C,0xF34E,0xF34B,0xF34D,0xF4D6,0xF654, + 0, 0,0xF96F,0xA8AC,0xAD77,0xD3E5,0xD3E7,0xD3E6, + 0,0xD7D8,0xB36C, 0,0xD7D6, 0,0xB36B,0xD7D9, + 0,0xD7DA,0xD7D7, 0, 0,0xDBFB,0xB660,0xDBF3, +0xDBF9, 0, 0,0xB65B,0xB65E,0xDBF2,0xB659,0xDBF6, +0xE06C,0xB65D, 0,0xDBF1, 0,0xDBF7,0xDBF4,0xDBFA, +0xDBF0,0xDBF8,0xB65C,0xB65F,0xDBF5,0xB65A, 0,0xB8F2, +0xE068,0xB8F1,0xE06F,0xE06E,0xB8F8, 0,0xB8F9,0xE070, +0xB8F3,0xE06D,0xB8F7,0xE072,0xE069, 0,0xE06B,0xB8F4, +0xE067,0xE06A,0xE071,0xB8F5,0xE073, 0, 0, 0, + 0, 0,0xB8F6, 0,0xBBB1,0xE45B,0xE461,0xE459, +0xE462, 0,0xE458,0xE45D,0xE463,0xE460,0xE45F,0xE45E, + 0,0xE457,0xE45C, 0, 0,0xE45A, 0,0xBDF1, +0xBDEE,0xE7FB,0xE841,0xE843,0xE840,0xE7F8,0xE7FA,0xE845, +0xE842,0xE7FC,0xE846,0xE7F9,0xE844,0xBDEF,0xBDF5,0xBDF3, +0xE7F3,0xBDF4,0xBDF0,0xE7F4,0xE7F6,0xE7F5,0xE7FD,0xE7FE, + 0,0xBDF2, 0,0xBDED, 0, 0,0xE7F7, 0, +0xEBC6,0xBFE2, 0,0xEBBD,0xBFE3,0xBFE6,0xEBC2, 0, +0xEBBF,0xBFE5, 0, 0,0xEBC3,0xEBC4,0xEBBE,0xEBC7, +0xEBC0,0xEBC5,0xBFE4, 0,0xBFE1,0xEBC1, 0,0xEEBF, +0xC1D0,0xC1CE,0xC1D1,0xC1CF,0xEEBE,0xEEBB,0xEEBA, 0, +0xEEBD, 0, 0,0xEEBC,0xF145,0xC2DE,0xF0FB,0xF0FA, + 0,0xC2D9,0xF141,0xF140,0xF0F7,0xF143,0xF0FC,0xC2DD, +0xF0F9,0xF142,0xF0F8,0xC2DA,0xC2DC,0xF0FD,0xC2DB,0xF0FE, + 0,0xF144,0xF352, 0,0xC3DE,0xF34F, 0,0xF353, + 0, 0,0xC3DB,0xF351,0xC3E0, 0,0xC3DD, 0, +0xF350, 0,0xC3DF,0xF354,0xC3DA, 0, 0, 0, + 0,0xC4BC,0xC4BE, 0,0xF4D9,0xC4BD,0xF4D7,0xC3DC, +0xF4D8,0xC4BB,0xC543,0xC545,0xF656,0xC544,0xF655, 0, +0xF761,0xC5AD,0xF760,0xC5AE,0xF75E,0xF75D,0xF762,0xF763, +0xF846, 0,0xF75F, 0, 0,0xF8C6,0xF8C3,0xF8C4, +0xF8C5,0xC65C, 0,0xF951,0xF950,0xF94F,0xF970, 0, +0xF9BE,0xF9AB,0xC66E,0xA8AD,0xB060, 0, 0, 0, + 0, 0,0xB8FA, 0, 0, 0, 0, 0, + 0, 0,0xBDF6, 0, 0,0xEBC8, 0, 0, +0xC2DF, 0,0xF355, 0, 0, 0, 0, 0, + 0,0xF9AC,0xA8AE,0xAAEE,0xAD79,0xAD78, 0,0xB063, + 0,0xD3E8,0xB061,0xD3E9,0xB062, 0, 0,0xD7DF, +0xD7DB, 0, 0,0xB36D,0xD7DE,0xD7DD,0xD7DC,0xB36E, +0xD7E0,0xD7E1, 0, 0, 0,0xDC43,0xDC41,0xDC45, +0xDC46,0xDC4C, 0,0xDC48,0xDC4A, 0,0xDC42,0xDBFC, + 0,0xDC49, 0, 0,0xDC4B,0xDC44,0xDC47,0xDBFD, +0xB662,0xDC40,0xDBFE,0xB661,0xB663, 0,0xB8FD,0xE075, +0xE077,0xE076,0xE07B,0xB8FB, 0,0xE078,0xE074,0xE079, +0xE07A,0xB8FC,0xB8FE,0xE07C, 0,0xE467,0xE466, 0, +0xE464,0xE465,0xBBB3,0xBBB5,0xBBB2,0xBBB4,0xE84D,0xE84E, +0xE849, 0,0xE84A,0xBDF8,0xBDFD,0xBDF7,0xBDFE,0xBDF9, +0xE84B, 0, 0,0xE84C,0xE848,0xBE40,0xBDFB, 0, + 0,0xBDFA,0xBDFC, 0,0xE847, 0,0xEBCA,0xBFE8, + 0, 0,0xEBCC,0xBFEA,0xEBCF,0xEBCB,0xEBC9,0xEBCE, +0xBFE9,0xEBCD, 0,0xBFE7, 0, 0,0xC1D3,0xC1D6, +0xEEC1, 0,0xC1D4,0xEEC0,0xC1D2,0xC1D5,0xF146,0xF147, +0xF148,0xC2E0, 0,0xF149, 0,0xC2E1,0xC3E2,0xF358, +0xF359,0xF357,0xF356,0xF35A,0xC3E1,0xF4DD,0xF4DB,0xF4DC, +0xF4DE,0xF4DA,0xF4DF,0xF658, 0,0xF659,0xF657,0xC546, +0xF764,0xC5AF,0xF765,0xF848,0xF847, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA8AF,0xB664, 0, 0,0xB940, + 0, 0, 0,0xBBB6, 0, 0,0xBFEC, 0, +0xBFEB, 0, 0, 0, 0,0xC3E3,0xC47C,0xC547, +0xA8B0,0xB064,0xB941, 0,0xF35B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCBA6, + 0, 0,0xA8B1, 0,0xA8B4,0xA8B3,0xA8B2, 0, + 0,0xCBA5, 0,0xCDCD, 0,0xCDCF,0xAAEF, 0, + 0,0xAAF1,0xCDCC,0xCDCE,0xAAF0,0xCDD1,0xCDD0,0xCDD2, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD0B6,0xD0B4,0xAD7C,0xD0B3,0xADA3,0xAD7E,0xAD7B, 0, +0xADA4, 0,0xAD7D,0xADA2, 0,0xADA1,0xD0B5, 0, +0xAD7A, 0, 0, 0,0xB06A,0xD3EB,0xD3F1,0xB067, +0xB06E, 0,0xB069,0xD3EE,0xD3F0,0xB06C,0xD3EA,0xD3ED, +0xB068,0xB065,0xD3EC,0xB06B,0xD3EF,0xB06D,0xB066, 0, + 0, 0, 0,0xD7E3,0xD7E6,0xB370, 0,0xB37A, +0xB376,0xD7E4, 0, 0,0xB37E,0xB377,0xB37C,0xB372, + 0,0xB36F,0xB371,0xB37D,0xD7E5,0xB375,0xB378,0xB374, +0xB379,0xD7E7,0xB37B,0xB373,0xD7E2, 0, 0, 0, + 0, 0, 0, 0, 0,0xDC4D,0xB665,0xDC4F, + 0,0xB667,0xB669, 0,0xDC4E,0xB666,0xB66A, 0, +0xB668, 0, 0, 0,0xB947,0xE0A3,0xB94F,0xE07E, + 0,0xB950,0xB945, 0,0xE0A1, 0, 0,0xB94A, + 0,0xE0A2,0xB943,0xB942, 0,0xB94D,0xB94C,0xB94B, +0xB949,0xB94E,0xE07D,0xB944,0xB946,0xB948, 0, 0, +0xBBB8,0xBBBB, 0,0xBBBF,0xBBB9,0xBBBE,0xBBBC, 0, +0xBBB7, 0,0xBBBD,0xBBBA, 0, 0, 0,0xE852, +0xBE43,0xBE41, 0,0xE853, 0,0xBE44,0xBE42,0xE851, +0xE850, 0,0xBFF0,0xE84F,0xBFEE,0xBFED,0xEBD0,0xBE45, +0xBFEF,0xEBD1,0xBFF2,0xEBD2,0xBFF1,0xC1D8,0xEEC3,0xC1D7, +0xC1DC,0xC1DA,0xC1DB,0xC2E3,0xC1D9,0xEEC2,0xEBD3,0xC2E2, +0xC2E4, 0,0xC3E4,0xC3E5, 0,0xF4E0, 0,0xC5DE, +0xC5DD,0xA8B6, 0, 0,0xCA55,0xB06F, 0,0xCA52, +0xCA53,0xCA51, 0,0xCA54, 0, 0,0xCBAA,0xCBA7, +0xCBAC,0xCBA8,0xA8B7,0xA8BA, 0,0xCBA9,0xA8B9,0xCBAB, + 0, 0,0xA8B8, 0, 0, 0, 0,0xCDD5, +0xCDD7,0xAAF4,0xCDD3,0xCDD6,0xCDD4,0xAAF2,0xAAF5, 0, +0xAAF3, 0, 0, 0, 0,0xD0B8,0xD0BC,0xD0B9, + 0,0xADA7, 0,0xADA8, 0,0xD0BB, 0,0xD0BD, +0xD0BF, 0,0xADA5,0xD0BE, 0, 0,0xADA6, 0, + 0, 0, 0, 0,0xD7EE,0xD0BA,0xD3F2,0xD3FB, +0xD3F9,0xD3F4,0xD3F5,0xD3FA,0xD3FC,0xB071, 0,0xD3F7, +0xD3F3,0xB070,0xB072,0xD3F6,0xD3FD,0xD3F8, 0, 0, +0xB3A1,0xD7F1,0xD7E9,0xD7EF,0xD7F0,0xB3A2, 0,0xD7E8, +0xD7EA,0xD0B7,0xD7EC,0xD7ED,0xD7EB,0xB66C, 0, 0, + 0,0xDC56,0xEBD4,0xDC57,0xDC54,0xB3A3,0xB66E,0xDC53, +0xDC59,0xDC58,0xB66B,0xDC5C,0xDC52,0xDC5B,0xDC50,0xDC5A, +0xDC55,0xB66D, 0,0xE0AA, 0,0xE0A5,0xE0AB,0xE0A6, +0xE0A4,0xE0A7,0xB951, 0,0xE0A9, 0,0xE0A8,0xB952, +0xBBC1,0xBBC0,0xE46E,0xE471,0xE469,0xE46D,0xBBC2,0xE46C, +0xE46A,0xE470,0xE46B,0xE468,0xE46F, 0,0xE859,0xBE48, +0xF14A,0xE856,0xE857,0xE855,0xDC51,0xBE47,0xE85A,0xE854, +0xBE46,0xBE49,0xE858,0xEBD5,0xBFF3,0xEBD6,0xEBD7, 0, +0xEEC4,0xC1DD,0xF14B,0xF14C, 0, 0,0xF14D,0xF35D, +0xF35C,0xF4E2, 0,0xF4E1,0xF65B,0xF65C,0xF65A,0xF766, +0xC5B0,0xA8BB,0xADAA,0xADA9,0xB075,0xB074,0xD440,0xD441, +0xD3FE, 0,0xB073,0xD7F5, 0,0xD7F6,0xD7F2,0xB3A4, +0xD7F3, 0,0xD7F4, 0, 0, 0, 0,0xDC5F, +0xDC61,0xDC5D,0xDC60,0xB66F,0xDC5E,0xB670, 0, 0, +0xDD73,0xB955,0xB954, 0,0xB953, 0,0xE0AC,0xE0AD, + 0, 0,0xE473,0xE475,0xBBC6,0xBBC3, 0,0xBBC5, +0xBBC4,0xE474,0xE472, 0, 0, 0, 0, 0, +0xE861,0xE85E,0xE85F,0xBE4D,0xE860,0xE85B,0xE85C,0xBE4A, + 0,0xBE4B,0xE85D,0xBE4C, 0,0xEBDB, 0,0xEBDC, +0xEBD9,0xEBDA,0xBFF4,0xEBD8, 0, 0, 0, 0, + 0,0xEEC8,0xEEC5,0xEEC7,0xC1E0,0xEECB,0xC1DF,0xEEC9, +0xEECC,0xEECA,0xEEC6,0xC1DE, 0,0xF14F, 0,0xF150, +0xF14E, 0,0xF152,0xC2E5,0xC2E6,0xF35F,0xC3E7,0xF151, +0xF35E,0xC3E6,0xF4E5,0xF4E6,0xC4BF,0xF4E4, 0,0xF4E3, + 0,0xF65D,0xC548, 0,0xF849,0xF8C8,0xF8C7, 0, +0xC643,0xC65D,0xF8C9,0xF971, 0,0xC66F,0xA8BC,0xAAF6, + 0,0xB956, 0,0xC4C0,0xA8BD,0xADAB,0xB3A5,0xB671, +0xC2E7,0xAAF7, 0,0xD0C1,0xD0C0,0xD442, 0,0xB078, +0xB076,0xB07A,0xD444, 0,0xB079,0xB077, 0, 0, + 0, 0,0xD443,0xB3A8,0xD7FC, 0,0xB3A7,0xB3A9, +0xD842,0xB3AB,0xD7FE,0xD840,0xD7F7,0xB3AA,0xD843, 0, + 0,0xD7F9, 0,0xD7FA,0xD7F8,0xB3A6, 0,0xD841, +0xD7FB,0xD7FD, 0, 0, 0,0xDC6D, 0,0xDC6C, +0xDC6A,0xDC62,0xDC71,0xDC65,0xDC6F,0xDC76,0xDC6E,0xB679, + 0,0xB675,0xDC63, 0,0xDC69,0xB677, 0,0xDC68, +0xB678,0xB67A,0xDC6B, 0,0xB672,0xB673,0xDC77,0xDC75, + 0,0xDC74,0xDC66, 0,0xDC72, 0,0xB676, 0, + 0, 0, 0,0xB674,0xDC73,0xDC64,0xDC67,0xDC70, + 0, 0, 0, 0, 0,0xE4BA,0xE0B7, 0, +0xE0B0,0xE0C3,0xE0CC,0xE0B3,0xB961, 0,0xE0C0,0xB957, +0xB959,0xB965,0xE0B1, 0, 0,0xB95A,0xB95C,0xB966, +0xB95B, 0, 0, 0, 0,0xB964,0xE0B9, 0, +0xE0AE,0xB962,0xE0B8,0xB95E,0xE0CA,0xB963,0xE0C8,0xE0BC, +0xE0C6,0xB960,0xE0AF,0xE0C9,0xE0C4, 0,0xE0CB,0xB958, + 0, 0,0xB967,0xB95D, 0, 0,0xE0B5, 0, +0xE0BD,0xE0C1, 0,0xE0C5,0xB95F,0xE0B4,0xE0B2,0xE0BE, + 0, 0, 0, 0,0xE0BB,0xE0BA, 0,0xE0BF, +0xE0C2, 0,0xE0C7, 0, 0, 0,0xE478, 0, +0xBBC7,0xE4A4,0xE47A,0xBBCC,0xBBD0,0xE4AD,0xE4B5,0xE4A6, +0xBBC8, 0,0xE4AA,0xE0B6, 0,0xBBC9,0xE4B1,0xE4B6, +0xE4AE, 0,0xE4B0,0xE4B9,0xE4B2,0xE47E,0xE4A9, 0, + 0,0xBBD1, 0,0xBBCD,0xE47C,0xE4AB,0xBBCB,0xE4A5, +0xBBCA,0xE4B3,0xE4A2,0xE479,0xBBCE,0xE4B8, 0, 0, +0xE47B,0xE4AF,0xE4AC,0xE4A7,0xE477,0xE476,0xE4A1,0xE4B4, +0xBBCF,0xE4B7,0xE47D,0xE4A3,0xBE52, 0, 0, 0, + 0, 0,0xBE5A,0xBE55,0xE8A4,0xE8A1,0xE867,0xBE50, + 0,0xF9D7, 0,0xBE4F,0xBE56, 0, 0, 0, +0xE865,0xBE54,0xE871,0xE863,0xE864,0xBE4E,0xE8A3,0xBE58, +0xE874,0xE879,0xE873,0xEBEE,0xE86F,0xE877,0xE875,0xE868, +0xE862,0xE87D,0xBE57,0xE87E, 0,0xE878, 0,0xE86D, +0xE86B,0xE866, 0, 0, 0,0xE86E,0xE87B,0xE86A, +0xE87A,0xE8A2, 0, 0,0xBE53, 0,0xE876,0xE87C, +0xE872,0xE86C,0xBE51, 0, 0, 0,0xE4A8,0xE870, +0xBE59,0xE869, 0, 0, 0, 0, 0,0xEBF4, +0xBFF7,0xEBF3,0xEBF0,0xEC44,0xBFFB, 0,0xEC41,0xEBF8, +0xEC43,0xEBE9,0xEBF6, 0,0xBFFD, 0,0xEBE1, 0, +0xEBDF,0xEC42, 0,0xEC40,0xEBFE,0xEBED,0xEBEC,0xEBE2, +0xC040, 0,0xEBE8,0xEBF2,0xEBFD,0xC043,0xEC45, 0, +0xC1E8,0xC045,0xBFFE,0xEBE6, 0,0xEBEF,0xEBDE,0xEBE0, +0xBFF5,0xC042,0xBFFA,0xEBE7,0xEBF7,0xEBF1,0xC041,0xEBDD, +0xC1E3,0xEBF9,0xEBFC,0xBFFC, 0,0xEBEB,0xC044,0xBFF9, + 0, 0, 0,0xBFF8,0xEBF5,0xEBFB,0xBFF6, 0, +0xEBE4,0xEBFA, 0, 0,0xEBE5, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xEBEA,0xEED2, + 0,0xEED7,0xC1E5,0xC1E7,0xEEDD,0xC1E1,0xEEEC,0xEEE3, +0xEED8,0xEED9,0xEEE2, 0,0xC1EE,0xEEE1,0xEED1,0xEEE0, +0xEED4,0xEEED,0xC1ED,0xC1EB,0xEED5, 0,0xEEE8, 0, +0xEEDA,0xEEE7, 0,0xEEE9,0xEED0,0xC1E6, 0,0xEEEA, + 0, 0,0xEEDE, 0,0xC1EA,0xEEDB, 0, 0, +0xC1EC,0xEEE4, 0, 0, 0,0xC1E4,0xEED6,0xEEE5, + 0,0xEEDF,0xEBE3,0xEEE6,0xEED3, 0,0xC1E9, 0, +0xEEEB, 0,0xC1E2,0xEECE, 0, 0, 0, 0, +0xF160,0xF159,0xC2E9, 0,0xF154,0xF163,0xF15B,0xEEDC, + 0,0xF165,0xF155, 0,0xC2E8,0xF15F,0xC2EA,0xC2F2, +0xC2F0,0xF161,0xC2F1,0xF157, 0,0xF158,0xF15D,0xF162, + 0,0xEECD,0xC2EB,0xF16A,0xF167,0xF16B,0xF15E,0xF15A, +0xF168,0xF36A,0xF15C, 0,0xC2EE, 0,0xC2ED,0xEECF, +0xC2EF,0xF164,0xF166,0xC2EC,0xF169,0xF153, 0,0xF156, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF373, 0,0xF363,0xC3EB,0xF371, 0, 0,0xF361, +0xC3EC, 0,0xF36C, 0,0xF368,0xC3F1,0xF372,0xF362, +0xF365,0xC3E9,0xF374, 0,0xF36D,0xF370,0xC3EF,0xC3F4, +0xC3F2,0xF369,0xF364, 0,0xC3ED,0xC3EE,0xF360,0xC3EA, + 0,0xC3E8,0xC3F0,0xF36F,0xC3F3, 0,0xF36B,0xF375, +0xC3F5, 0, 0, 0,0xF367, 0,0xF36E, 0, + 0, 0, 0, 0, 0,0xF4F3,0xF542,0xF4F5, +0xF4FC,0xF366,0xF4FA,0xF4E9,0xF540,0xC4C3,0xF4ED,0xF4FE, +0xF4F4, 0, 0,0xC4C2, 0, 0,0xF544,0xF4F6, + 0,0xF4FB,0xF4FD,0xF4E7,0xF541,0xF4F2,0xF4F7,0xF4EB, +0xF4EF,0xF543,0xF4F9,0xF4E8,0xF4EC,0xF4EE,0xF4F8, 0, +0xC4C1,0xF4F1, 0, 0, 0, 0, 0, 0, +0xF4EA, 0, 0, 0, 0, 0, 0, 0, +0xF4F0,0xF661,0xF666,0xC54F,0xF668, 0,0xC549, 0, +0xF664,0xF66A,0xC54E,0xC54A, 0,0xC54B,0xF660,0xF667, +0xC54D,0xF665,0xC54C,0xF65F,0xF663,0xF662, 0,0xF65E, +0xF669, 0, 0, 0,0xC5B1,0xF76D,0xF770,0xF76C, +0xF76E,0xF76F,0xF769,0xF76A,0xF767, 0, 0,0xF76B, +0xF768,0xC5B2,0xC5B3, 0, 0,0xF84B, 0,0xF84D, + 0, 0, 0, 0, 0,0xF84C,0xF84E, 0, +0xC5E0, 0,0xF84A,0xC5DF,0xC5E1, 0, 0, 0, +0xF8CB,0xF8CC,0xC644,0xF8CA, 0,0xF953,0xF952,0xF954, +0xC65F,0xF955,0xC65E,0xF956,0xF972,0xF975,0xF974,0xC668, +0xF973, 0, 0, 0,0xC672,0xC670,0xC671,0xC677, +0xF9C0,0xF9C1,0xF9BF,0xF9C9}; + +/* page 8 0x9577-0x9FA4 */ +static uint16 tab_uni_big58[]={ +0xAAF8, 0, 0,0xD844,0xDC78,0xE8A5,0xF376, 0, + 0,0xAAF9, 0,0xADAC,0xB07B, 0, 0,0xD845, + 0,0xD846,0xB3AC, 0,0xB67D,0xDC7A,0xDC79,0xB6A3, +0xB67C,0xDC7B,0xB67E,0xB6A2,0xB6A1,0xB67B, 0, 0, + 0,0xB968, 0, 0,0xE0D0,0xE0CE, 0,0xE0CF, +0xE0CD, 0,0xBBD2, 0,0xBBD5,0xBBD7,0xBBD6, 0, + 0,0xBBD3,0xBBD4, 0,0xE8A7,0xE8A6,0xBE5B,0xE8A8, + 0,0xE8A9,0xBE5C, 0, 0, 0,0xEC4D,0xEC4B, +0xEEF3, 0,0xEC49,0xEC4A,0xC046,0xEC46,0xEC4E,0xEC48, +0xEC4C,0xEEEF, 0, 0,0xEEF1, 0,0xEEF2,0xC1F3, +0xEEEE,0xC1F2,0xEEF0,0xC1EF,0xC1F0,0xC1F1,0xEC47, 0, + 0,0xC2F5,0xF16E,0xF16C,0xF16D,0xC2F3,0xC2F6,0xC2F4, + 0, 0, 0,0xF377,0xF378,0xC3F6, 0,0xF545, +0xF547,0xF546,0xC4C4,0xC550,0xF66D,0xF66C,0xF66B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xAAFA, 0,0xC9AA, + 0,0xCA58,0xA6E9,0xCA56,0xCA59,0xCA57, 0, 0, + 0,0xCBAE, 0,0xA8C1, 0,0xA8C2,0xCBB0,0xA8BF, +0xCBAF,0xCBAD,0xA8C0,0xA8BE, 0, 0, 0, 0, + 0, 0,0xCDD8,0xCDDB,0xAAFD,0xCDDA,0xCDD9, 0, +0xAAFC,0xAAFB, 0,0xAB40,0xCDDC,0xAAFE, 0, 0, + 0, 0, 0,0xD0C6,0xADAE,0xADAF,0xADB0,0xD0C7, +0xD0C3,0xADAD,0xD0C4, 0,0xD0C5,0xD0C2, 0, 0, + 0,0xB0A4, 0, 0,0xB0A1,0xD445,0xB0A2,0xB0A5, +0xD446, 0,0xB07E,0xB07C,0xB07D,0xB0A3, 0, 0, + 0, 0, 0,0xB3AD,0xD849,0xB3B5,0xD848, 0, +0xD84B,0xB3B1,0xD84A,0xB6AB,0xB3AF,0xB3B2,0xB3AE,0xB3B3, +0xB3B4,0xB3B0, 0, 0, 0,0xD847,0xB6A7,0xDC7D, + 0,0xDCA3, 0, 0,0xDCA2,0xB6AC,0xB6A8,0xB6A9, +0xDC7C,0xDC7E,0xDCA1,0xB6A4,0xB6A6, 0,0xB6AA,0xB6A5, + 0, 0,0xE0D3,0xE0D1,0xE0D2,0xB96A,0xB96B, 0, +0xE0D4,0xB969,0xBBD8, 0,0xBBDA,0xBBD9, 0,0xE4BB, + 0, 0,0xE4BC,0xE8AB, 0,0xE8AA, 0, 0, +0xC047,0xC048,0xEC4F,0xC049, 0,0xEEF6, 0,0xEEF4, + 0,0xEEF5,0xC1F4, 0,0xF16F,0xC3F7, 0, 0, + 0,0xC1F5,0xAB41, 0,0xB0A6,0xD447, 0, 0, +0xD84C,0xB3B6,0xB6AD,0xDCA4,0xDCA6,0xB6AF,0xB6AE,0xB6B0, +0xB6B1,0xDCA5,0xB96E,0xB96F,0xB96D,0xBBDB,0xB96C,0xE0D5, + 0, 0, 0,0xBBDC,0xE8AC,0xEC50,0xC04A,0xC1F6, +0xF170,0xF174,0xC2F9,0xF171,0xC2FA,0xC2F8,0xF175,0xC2FB, +0xF173, 0,0xF379,0xC2F7,0xC3F8, 0,0xF8CD, 0, + 0,0xAB42,0xB3B8,0xB3B7, 0, 0, 0, 0, +0xB6B2,0xDCA8,0xDCA7,0xB6B3, 0, 0,0xE0D9,0xB973, +0xB970,0xE0D8,0xB972,0xE0D6,0xB971, 0,0xE0D7, 0, +0xE4BD,0xBBDD, 0,0xE8AF, 0,0xBE5D,0xE8AD,0xBE5E, +0xBE5F,0xE8AE,0xBE60, 0,0xEC51, 0,0xC04E,0xC04B, +0xC050,0xEC53,0xC04C,0xEC52,0xC04F, 0, 0,0xC04D, + 0,0xEEF9,0xEEFB, 0, 0,0xC1F7,0xEEFA,0xC1F8, +0xEEF8,0xEEF7, 0,0xF177,0xF176,0xC2FC,0xF178,0xF37E, +0xC3FA,0xF37D,0xF37A,0xC3F9,0xF37B,0xF37C, 0,0xF548, +0xF549,0xC4C5, 0,0xC553, 0, 0,0xF66E, 0, + 0,0xC551,0xC552,0xF66F, 0, 0,0xC5B4,0xC5B5, +0xF771, 0, 0,0xC645,0xF8CF,0xC647, 0,0xF8CE, +0xF8D0,0xC646,0xF957, 0,0xF9AD, 0, 0, 0, + 0, 0, 0,0xAB43, 0, 0, 0,0xB974, + 0,0xE4BE, 0,0xE8B0,0xC051,0xC052, 0,0xAB44, + 0,0xBE61,0xC3FB,0xADB1, 0, 0, 0,0xC053, + 0,0xC5E2,0xADB2,0xD84D, 0,0xDCA9, 0,0xDCAB, + 0,0xDCAA, 0,0xE0DD,0xE0DA,0xB975, 0,0xB976, +0xE0DB,0xE0DC, 0,0xE4C0,0xE4C5,0xBBDE,0xE4BF,0xE4C1, +0xE4C8,0xE4C3,0xE4C7,0xE4C4,0xE4C2,0xE4C6,0xBBDF, 0, + 0,0xE8B3, 0,0xE8B1,0xBE63, 0,0xBE62,0xE8B2, +0xBE64, 0, 0, 0, 0,0xEC56, 0, 0, +0xEC55,0xC054,0xEC54,0xEEFC, 0,0xEEFE,0xEF41,0xEF40, + 0,0xC1F9,0xEEFD,0xF1A1,0xC2FD,0xF17D,0xF1A2,0xC2FE, + 0,0xF17B, 0,0xF17E,0xF17C,0xF179,0xC340,0xF17A, + 0, 0, 0, 0,0xF3A1, 0, 0,0xF3A3, +0xF3A2, 0,0xF54A, 0,0xF54B, 0, 0, 0, +0xF670, 0,0xC5B7, 0,0xC5B6,0xF84F,0xF850,0xC648, +0xF8D1, 0,0xC669, 0,0xADB3,0xB6B4,0xE4CA,0xE4C9, +0xE8B5,0xE8B4, 0, 0,0xC1FA,0xEF43,0xEF42,0xF1A5, +0xF1A3,0xF1A6,0xF1A4, 0, 0,0xC3FC,0xF3A4,0xF3A5, +0xF3A6, 0,0xF671, 0,0xF772, 0,0xF8D2, 0, + 0, 0, 0, 0, 0, 0,0xADB4, 0, + 0,0xEC57,0xEF44, 0,0xADB5, 0, 0,0xBBE0, + 0,0xEC58,0xC341,0xF1A7,0xC3FD, 0,0xF54C,0xF54D, +0xC554,0xF851,0xADB6,0xB3BB,0xB3BC,0xD84E,0xB6B5,0xB6B6, +0xDCAC,0xB6B7, 0,0xB97A, 0,0xB97C,0xE0DF,0xE0E0, +0xE0DE,0xB977,0xB978,0xB97B,0xB979, 0, 0,0xE4CB, +0xBBE1,0xBBE2, 0, 0,0xE8BC,0xBE67,0xE8B7,0xE8B6, + 0,0xE8BB,0xBE65, 0, 0,0xC05B, 0,0xE8B8, +0xE8BD,0xE8BA,0xE8B9, 0,0xBE66, 0,0xC059, 0, +0xEC5A,0xC055, 0,0xEC5B, 0, 0,0xEC59, 0, +0xC058,0xC056,0xC05A, 0,0xC057, 0, 0, 0, + 0, 0,0xEF45, 0,0xEF4A,0xEF46,0xEF49,0xC1FB, + 0,0xEDD4,0xEF48,0xEF47, 0,0xC344,0xC342,0xC345, +0xC343,0xF1A8,0xF1A9,0xF1AA,0xC346, 0, 0, 0, +0xF3AA,0xC440,0xF3A8, 0,0xC441,0xF3A7,0xF3A9,0xC3FE, +0xF551,0xF54E, 0,0xF54F,0xF550,0xF672,0xC556, 0, +0xC555, 0,0xF774,0xF773,0xC5B8, 0, 0, 0, +0xC5E3,0xC649,0xC660,0xF958,0xF9AE,0xF9AF, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xADB7,0xDCAD, 0, 0,0xE0E1,0xE4CC,0xE4CD, +0xBBE3, 0,0xBBE4,0xE8BE,0xBE68, 0, 0,0xC1FC, + 0,0xF1AB, 0,0xC347,0xF3AD,0xC442,0xF3AC,0xF3AE, +0xF3AB,0xF675,0xF552,0xF553, 0,0xC4C6, 0,0xF674, + 0, 0,0xF673, 0,0xF775,0xF9B0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xADB8, 0, 0, 0, +0xADB9, 0, 0,0xB0A7,0xD448, 0,0xD84F, 0, +0xB6B8, 0,0xB6BB,0xB6B9,0xDCAE, 0,0xB6BD, 0, +0xB6BA, 0, 0,0xB6BC, 0,0xB97E, 0,0xE0E2, + 0, 0,0xE0E3,0xE8C0, 0,0xB97D,0xB9A1,0xB9A2, + 0,0xE4CF, 0,0xE4CE,0xBBE5, 0,0xBBE6, 0, +0xE4D0,0xE8BF,0xBBE8,0xBE69, 0,0xBBE7, 0, 0, + 0,0xC05C,0xE8C1,0xBE6B,0xBE6A,0xE8C2,0xE8C5,0xE8C3, +0xE8C4,0xBE6C, 0,0xC061,0xC05F, 0, 0,0xC05E, +0xEC5D, 0,0xC060, 0, 0,0xEC5C,0xEF4B, 0, +0xEC5E,0xC05D,0xEC5F,0xEF4E,0xEF4C,0xEF4D,0xEF52,0xC34B, +0xEF51,0xEF54,0xEF53,0xEF50,0xEF4F, 0,0xC1FD, 0, + 0, 0, 0,0xF1AE, 0,0xF1AD,0xC34A,0xC348, +0xC349, 0,0xF1AC, 0,0xF3B1, 0,0xC443, 0, +0xF3B0,0xF3AF,0xC444, 0,0xF558,0xF557, 0,0xF555, + 0,0xF554,0xC4C8,0xC4C7,0xF559,0xF776,0xC5B9,0xF677, +0xC557,0xF676,0xF556, 0,0xF777,0xC5E4, 0,0xC661, +0xF959, 0,0xF9B1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xADBA, +0xD850,0xEF55,0xADBB, 0, 0,0xE4D2,0xE4D1,0xEC60, + 0, 0,0xEF57, 0,0xEF56, 0,0xC34C,0xF3B2, +0xF3B3,0xC4C9, 0, 0,0xF9B2,0xB0A8,0xB6BF,0xB6BE, +0xE0E4,0xE0E6,0xB9A4,0xE0E5,0xB9A3,0xB9A5,0xE0E7, 0, + 0, 0,0xE4D4,0xE4D6,0xE4D5, 0,0xE4D8, 0, + 0, 0,0xBBE9,0xE4D7,0xE4D3, 0, 0, 0, +0xE4D9, 0,0xE8CC, 0,0xE8CF,0xE8D1,0xE8C7,0xE8CB, +0xE8C8,0xBE6E,0xBE71,0xBE73,0xE8C9,0xE8CA,0xBE72,0xE8CD, +0xE8D0,0xE8CE,0xBE74, 0,0xBE70,0xE8C6,0xBE6D, 0, +0xBE6F, 0, 0,0xC063,0xEC66,0xEC64,0xEC63, 0, +0xEC69, 0,0xEC68,0xEC67, 0,0xEC62,0xC062,0xEC61, + 0,0xEC65,0xC064, 0, 0,0xEF5A, 0,0xEF5E, +0xEF5B,0xEF5D,0xEF5C,0xEF59,0xEF5F,0xEF62,0xEF60,0xEF61, +0xC240, 0,0xC1FE,0xEF58,0xEF63,0xF1B3,0xF1B6,0xF1B8, +0xF1B7, 0,0xF1B1,0xF1B5,0xF1B0, 0,0xF1B2,0xC34D, +0xF1AF, 0,0xF1B4, 0, 0,0xF3C0,0xF3B5,0xC445, + 0, 0,0xC446,0xF3B4,0xF3B9,0xF3BF,0xF3B7,0xF3BE, + 0,0xF3BB, 0,0xF3BA,0xF3BD,0xF3B8,0xF3B6, 0, +0xF3BC, 0,0xF560,0xF55E,0xC4CA,0xF55D,0xF563,0xF561, + 0,0xC4CB,0xF55C,0xF55A, 0,0xF55B,0xC4CD,0xF55F, +0xC4CC,0xF562,0xF678,0xF67E, 0, 0,0xF679,0xC55B, +0xF6A1,0xC55A,0xF67D,0xF67C,0xC559,0xF67B,0xC558,0xF67A, + 0,0xF77D,0xF7A1,0xF77E, 0,0xF77B,0xC5BB,0xF778, +0xF77C,0xF7A3, 0,0xF7A2,0xF779,0xF77A,0xC5BA,0xF852, +0xC5E7, 0,0xF853,0xC5E5,0xC5E6, 0, 0,0xF8D3, +0xC64A,0xF976, 0,0xC66A, 0,0xF9B3,0xC66B,0xF9B4, +0xF9B5,0xF9C3,0xF9C2,0xC67A,0xF9CD, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xB0A9, 0, 0,0xE0E9, 0,0xE0E8, 0, +0xBBEA,0xBBEB,0xE4DA, 0,0xE8D2,0xEC6C, 0, 0, +0xBE75,0xC065,0xEC6A, 0,0xEC6D,0xC066, 0,0xEF64, +0xEC6B,0xF1B9,0xC34E,0xF3C1, 0, 0, 0,0xF566, +0xF564, 0, 0,0xF565, 0, 0,0xF6A2, 0, +0xC55C,0xF7A4,0xC5EA,0xC5BC,0xC5E8,0xC5E9,0xF8D4,0xC662, + 0,0xB0AA, 0, 0, 0,0xF1BA, 0, 0, +0xD449, 0,0xB9A6, 0,0xE4DB, 0, 0,0xBBEC, +0xE4DC, 0, 0, 0,0xE8D4,0xE8D3,0xC068,0xBE76, +0xBE77, 0,0xE8D7,0xE8D6,0xE8D5, 0, 0,0xEC6E, +0xEC71, 0,0xEC70,0xEC6F,0xC067,0xEF68,0xEF66,0xEF65, + 0, 0,0xEF67, 0,0xC34F,0xF1BC,0xF1BD,0xC350, + 0,0xF1BB, 0,0xF3C3,0xF3C2,0xF3C5,0xC447,0xF3C4, + 0,0xF567,0xF569,0xF568, 0, 0,0xF6A3,0xF6A6, +0xF6A4,0xF6A5,0xF7A5,0xC5BD, 0, 0, 0,0xF854, +0xF855,0xF856, 0,0xC64B,0xC663,0xF9B6,0xB0AB, 0, +0xBE78,0xC069,0xF1BE, 0,0xF7A6, 0, 0,0xF9C4, +0xD44A, 0,0xC67B,0xB0AC,0xEC72, 0,0xF1BF, 0, +0xF3C6, 0, 0,0xF6A7,0xF7A7,0xB0AD, 0,0xE4DD, +0xE4DE, 0,0xBBED,0xBBEE,0xE8D9,0xBE7A,0xBE79,0xE8D8, + 0,0xEF69, 0,0xF1C0,0xF1C2,0xF1C1,0xC353,0xC352, +0xC351, 0,0xC55E,0xF6A8, 0,0xC55D,0xF7A9,0xF7A8, + 0,0xC64C,0xF8D5,0xB3BD,0xE0EA, 0, 0, 0, +0xE4E1,0xE4DF,0xE4E0, 0, 0,0xE8E2, 0,0xE8DD, +0xE8DA,0xE8E1, 0, 0, 0,0xE8E3, 0, 0, +0xBE7C,0xE8E0,0xE8DC, 0, 0,0xE8DB,0xE8DF,0xE8DE, +0xBE7B, 0, 0,0xEC7D,0xEC78,0xEC76,0xECA1,0xEC77, + 0,0xEC73, 0,0xEC79, 0, 0,0xEC74,0xEF72, +0xEC75,0xECA2, 0, 0, 0, 0, 0, 0, + 0,0xEC7C,0xC06A,0xEC7B,0xEC7A, 0,0xEC7E, 0, + 0, 0, 0,0xEF6A,0xEF6D, 0, 0,0xEF6C, + 0,0xEF74,0xEF6F,0xEF73, 0,0xEF71,0xEF70,0xEF6E, + 0,0xEF6B, 0,0xC243,0xC242, 0,0xC244,0xC241, +0xEF75, 0, 0, 0, 0, 0,0xF1C8,0xF1CB, + 0,0xF1C9,0xF1CD, 0, 0, 0,0xF1CE, 0, +0xF1C6,0xC358,0xF1C7, 0,0xF1C5,0xF1CC, 0,0xF1C4, +0xF1C3,0xC357,0xC355,0xC354, 0, 0, 0, 0, + 0, 0, 0, 0,0xF1CA,0xF3CF,0xF3D5,0xC44A, +0xF3D0, 0,0xF3D3,0xF3D7,0xC44B,0xF3D2, 0,0xF3CA, + 0,0xF3C9,0xF3D6,0xF3CD, 0,0xF3CB,0xF3D4,0xF3CC, +0xC449,0xC448, 0,0xF3C7,0xF3C8,0xF3D1, 0, 0, + 0,0xF3CE, 0, 0, 0, 0, 0, 0, +0xF56C,0xF56F, 0, 0, 0, 0,0xC356, 0, + 0, 0, 0, 0, 0, 0,0xF56D,0xF573, +0xF571,0xF56B,0xF576, 0,0xF56A, 0,0xC4CF,0xF572, + 0, 0, 0,0xF56E,0xC4CE,0xF575, 0, 0, +0xF574, 0, 0, 0, 0,0xF6AB,0xF6AA, 0, + 0, 0,0xF6B1, 0,0xF6AD,0xF6B0,0xC560, 0, + 0,0xF6AE,0xF6AF, 0,0xF6A9,0xF6AC,0xC55F, 0, + 0, 0,0xC5BF,0xF7B4,0xF7AF,0xF7B3, 0,0xF7B6, +0xF7B2, 0,0xF7AE, 0,0xC5C1,0xF7B1,0xF7B5,0xC5C0, +0xF7AC,0xF570,0xF7B0, 0, 0,0xF7AD, 0,0xF7AA, + 0,0xF7AB,0xC5BE,0xF85A,0xF85C,0xF85F,0xF85B,0xF860, + 0,0xF859, 0,0xF857, 0,0xC5EB,0xF85D,0xC5ED, +0xC5EC,0xF858,0xF85E, 0, 0, 0, 0,0xF8DA, +0xC64D,0xF8DB, 0,0xF8D9,0xF8D6, 0, 0,0xF8D8, +0xF8D7,0xF95A, 0, 0, 0, 0,0xF95C,0xF95B, + 0, 0,0xF979, 0,0xF978,0xF977,0xF97A, 0, +0xC673,0xC674,0xF9CA,0xF9CE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xB3BE,0xDCAF, +0xE0ED, 0,0xB9A7,0xE0EB, 0, 0,0xE0EC, 0, + 0, 0,0xE4E2,0xE4E3,0xBBF1,0xBBEF,0xE4E4,0xBBF0, +0xE8E8, 0,0xE8EB,0xE8E5,0xE8EC,0xE8E4,0xE8E6, 0, +0xE8E7,0xE8EA, 0, 0,0xBEA1,0xE8EF,0xE8EE,0xBE7D, +0xE8E9,0xE8ED,0xBE7E, 0, 0, 0, 0, 0, + 0,0xECAC, 0,0xC06F, 0,0xECA7,0xC06B, 0, +0xECA4,0xECAA,0xECAD, 0,0xC070, 0,0xECA9,0xECA6, +0xECAE,0xECA5, 0,0xECAB,0xC06C, 0,0xECA3,0xC06D, + 0,0xC06E,0xECA8, 0, 0, 0,0xEFA9,0xEF7A, +0xEF7B,0xEF7E,0xEF7C, 0,0xEF76, 0, 0,0xEF79, +0xEFA5,0xEF7D, 0, 0,0xC245, 0,0xEFA7,0xEFA4, +0xC246,0xEFA6,0xEF77,0xEFA2,0xEFA3, 0,0xEFA1, 0, + 0, 0, 0,0xF1D2,0xF1D4,0xF1D7, 0, 0, +0xF1D1, 0,0xC359,0xF1D9,0xF1D0,0xF1DA, 0,0xF1D6, +0xF1D8,0xF1DC,0xF1D5,0xF1DD,0xF1D3,0xF1CF,0xC35A, 0, +0xF1DB,0xC35B,0xC44D, 0, 0, 0, 0, 0, +0xEF78,0xF3F1,0xF3E8,0xC44F,0xF3E4,0xC450, 0, 0, +0xF3ED,0xF3E7,0xF3DD,0xC44E,0xF3EA,0xF3E5,0xF3E6, 0, +0xF3D8,0xF3DF,0xF3EE, 0,0xF3EB, 0,0xF3E3, 0, +0xF3EF,0xF3DE,0xF3D9,0xF3EC, 0,0xF3DB,0xF3E9,0xF3E0, +0xF3F0,0xF3DC,0xC44C,0xF3DA,0xF3E1,0xF3E2, 0, 0, + 0,0xF57D, 0,0xF57B, 0,0xF5A2, 0,0xF5AE, +0xF5A5,0xF57C,0xF578,0xF5A7,0xF57E,0xF5A3,0xF57A,0xF5AA, +0xF577,0xF5A1,0xF5A6,0xF5A8,0xF5AB,0xF579, 0,0xF5AF, +0xF5B0,0xF5A9,0xF5AD,0xF5A4, 0,0xF6C1,0xF6C4, 0, +0xC561, 0,0xF6C3,0xF6C8,0xF6C6,0xC562,0xF6BD,0xF6B3, +0xF6B2,0xC564,0xF6BF,0xF6C0,0xF6BC,0xF6B4, 0,0xF6B9, +0xF5AC, 0,0xF6B5,0xC563,0xF6BB, 0,0xF6BA, 0, +0xF6B6,0xF6C2, 0,0xF6B7,0xF7BB,0xF6C5,0xF6C7,0xF6BE, +0xF6B8,0xF7BC,0xF7BE,0xF7B8,0xC5C2, 0,0xF7C5,0xF7C3, +0xC5C3,0xF7C2,0xF7C1,0xF7BA,0xF7B7,0xF7BD,0xF7C6,0xF7B9, +0xF7BF, 0,0xF869,0xF86E,0xF864,0xF867,0xC5EE,0xF86B, + 0,0xF872,0xF7C0, 0,0xF865,0xF86F,0xF873,0xF86A, +0xF863,0xF86D, 0,0xF86C,0xF871,0xF870,0xF7C4,0xF868, +0xF862,0xF866,0xC64E,0xC64F,0xF861, 0,0xF8E6,0xF8DD, +0xF8E5,0xF8E2,0xF8E3,0xF8DC,0xF8DF,0xF8E7,0xF8E1,0xF8E0, +0xF8DE, 0,0xF8E4, 0,0xF95D, 0,0xF95E, 0, +0xF960,0xF95F,0xF962,0xF961,0xF97C,0xF97B,0xF9B7, 0, +0xF9B8, 0,0xF9C5,0xC678,0xC67C, 0,0xF9CF,0xC67D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xB3BF, 0, + 0, 0,0xC4D0,0xF6C9, 0,0xC650,0xC651, 0, +0xB3C0,0xE0EE, 0,0xB9A8,0xE8F0, 0, 0,0xECB0, +0xECB1,0xECAF,0xEFAB,0xEFAA,0xC247,0xF1DF,0xEFAC,0xF1DE, + 0, 0,0xF3F3,0xC451,0xC453,0xF3F2, 0, 0, +0xC452, 0,0xF5B1,0xF5B3,0xF5B2,0xF6CA,0xC565, 0, +0xC5EF,0xF8E8,0xF963, 0, 0,0xF9D2,0xB3C1, 0, +0xE4E5, 0,0xBEA2, 0, 0, 0,0xECB3,0xECB2, + 0,0xEFAD, 0, 0, 0,0xC454,0xC4D1,0xF7C7, +0xF9CB, 0, 0, 0,0xB3C2,0xBBF2, 0,0xBEA3, + 0,0xF3F4, 0,0xF874,0xB6C0, 0, 0, 0, + 0,0xEFAE, 0, 0, 0,0xC664,0xB6C1,0xBEA4, +0xC248,0xF875,0xB6C2, 0,0xE8F1,0xC072,0xECB4,0xECB5, + 0,0xC071, 0,0xEFAF,0xC24C,0xC24A,0xC24B,0xC249, +0xF1E0,0xC35C, 0, 0, 0,0xF5B5,0xF5B4,0xF5B7, +0xF5B6,0xC4D2, 0, 0,0xF6CB, 0,0xF6CD,0xF6CC, +0xC566,0xF7C8, 0,0xF876,0xF877,0xC5F0,0xF964,0xF97D, +0xC675, 0,0xDCB0,0xECB6,0xEFB0,0xF3F5,0xE0EF, 0, +0xEFB1,0xF1E2,0xF1E1, 0, 0, 0, 0,0xF878, +0xC652, 0,0xF965,0xF97E, 0, 0, 0,0xB9A9, +0xE8F2,0xE8F3, 0,0xECB7,0xB9AA, 0,0xC35D,0xF1E3, + 0,0xF6CF,0xC567,0xF6D0,0xF6CE,0xF879, 0,0xF8E9, + 0,0xB9AB, 0,0xEFB4,0xEFB3,0xEFB2,0xF1E4, 0, + 0,0xF1E8,0xF1E7,0xF1E6,0xF1E5,0xC35E,0xF3F6,0xF5B9, +0xC4D3,0xF5B8,0xF6D1,0xF7CB,0xF7CA,0xC5C4,0xF7C9,0xF87C, +0xF87B,0xF87A, 0, 0,0xBBF3, 0,0xECB8,0xC24D, + 0,0xF3F7,0xF3F8,0xF7CC,0xF87D, 0, 0,0xF8EA, +0xF966,0xF9B9,0xF9D4,0xBBF4,0xC24E,0xF1E9,0xF3F9,0xF6D2, +0xF87E, 0, 0,0xBEA6, 0,0xEFB5,0xF1EA,0xF3FA, +0xF3FB,0xF3FC,0xF5BE, 0,0xF5BA,0xC568,0xF5BD,0xF5BC, +0xC4D4,0xF5BB,0xC4D6, 0,0xC4D5,0xF6D4,0xF6D3,0xC569, +0xC56A, 0, 0,0xC5C6,0xF7CD,0xC5C5, 0,0xF8A3, +0xF8A4,0xF8A2,0xF8A1,0xC654, 0,0xF8EB,0xF8EC,0xF8ED, +0xC653,0xF967,0xF96A,0xF969,0xF968, 0, 0,0xF9D3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xC073, 0, + 0,0xC365,0xF5BF,0xF6D5, 0,0xC5C7,0xF7CE, 0, + 0,0xF9D5, 0, 0, 0,0xC074, 0, 0, + 0,0xEFB6, 0,0xF7CF, 0,0xF9A1}; + +/* page 9 0xFA0C-0xFA0D */ +static uint16 tab_uni_big59[]={ +0xC94A,0xDDFC}; + +/* page 10 0xFE30-0xFFFD */ +static uint16 tab_uni_big510[]={ +0xA14A,0xA157, 0,0xA159,0xA15B,0xA15F,0xA160,0xA163, +0xA164,0xA167,0xA168,0xA16B,0xA16C,0xA16F,0xA170,0xA173, +0xA174,0xA177,0xA178,0xA17B,0xA17C, 0, 0, 0, + 0,0xA1C6,0xA1C7,0xA1CA,0xA1CB,0xA1C8,0xA1C9,0xA15C, +0xA14D, 0,0xA14F, 0,0xA151,0xA152,0xA153,0xA154, + 0,0xA17D,0xA17E,0xA1A1,0xA1A2,0xA1A3,0xA1A4,0xA1CC, +0xA1CD,0xA1CE,0xA1DE,0xA1DF,0xA1E0,0xA1E1,0xA1E2, 0, + 0,0xA24C,0xA24D,0xA24E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA149, 0,0xA1AD,0xA243,0xA248,0xA1AE, 0, +0xA15D,0xA15E,0xA1AF,0xA1CF,0xA141,0xA1D0,0xA144,0xA241, +0xA2AF,0xA2B0,0xA2B1,0xA2B2,0xA2B3,0xA2B4,0xA2B5,0xA2B6, +0xA2B7,0xA2B8,0xA147,0xA146,0xA1D5,0xA1D7,0xA1D6,0xA148, +0xA249,0xA2CF,0xA2D0,0xA2D1,0xA2D2,0xA2D3,0xA2D4,0xA2D5, +0xA2D6,0xA2D7,0xA2D8,0xA2D9,0xA2DA,0xA2DB,0xA2DC,0xA2DD, +0xA2DE,0xA2DF,0xA2E0,0xA2E1,0xA2E2,0xA2E3,0xA2E4,0xA2E5, +0xA2E6,0xA2E7,0xA2E8, 0,0xA242, 0, 0,0xA1C4, + 0,0xA2E9,0xA2EA,0xA2EB,0xA2EC,0xA2ED,0xA2EE,0xA2EF, +0xA2F0,0xA2F1,0xA2F2,0xA2F3,0xA2F4,0xA2F5,0xA2F6,0xA2F7, +0xA2F8,0xA2F9,0xA2FA,0xA2FB,0xA2FC,0xA2FD,0xA2FE,0xA340, +0xA341,0xA342,0xA343,0xA161,0xA155,0xA162, 0, 0, + 0, 0, 0, 0,0xA14E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA2CE}; + +static int func_uni_big5_onechar(int code){ + if ((code>=0x00A2)&&(code<=0x00F7)) + return(tab_uni_big50[code-0x00A2]); + if ((code>=0x02C7)&&(code<=0x0451)) + return(tab_uni_big51[code-0x02C7]); + if ((code>=0x2013)&&(code<=0x22BF)) + return(tab_uni_big52[code-0x2013]); + if ((code>=0x2460)&&(code<=0x2642)) + return(tab_uni_big53[code-0x2460]); + if ((code>=0x3000)&&(code<=0x3129)) + return(tab_uni_big54[code-0x3000]); + if ((code>=0x32A3)&&(code<=0x32A3)) + return(tab_uni_big55[code-0x32A3]); + if ((code>=0x338E)&&(code<=0x33D5)) + return(tab_uni_big56[code-0x338E]); + if ((code>=0x4E00)&&(code<=0x9483)) + return(tab_uni_big57[code-0x4E00]); + if ((code>=0x9577)&&(code<=0x9FA4)) + return(tab_uni_big58[code-0x9577]); + if ((code>=0xFA0C)&&(code<=0xFA0D)) + return(tab_uni_big59[code-0xFA0C]); + if ((code>=0xFE30)&&(code<=0xFFFD)) + return(tab_uni_big510[code-0xFE30]); + return(0); +} + + +static int +my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + + int code; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((int) wc < 0x80) + { + s[0]= (uchar) wc; + return 1; + } + + if (!(code=func_uni_big5_onechar(wc))) + return MY_CS_ILUNI; + + if (s+2>e) + return MY_CS_TOOSMALL; + + s[0]=code>>8; + s[1]=code&0xFF; + + return 2; +} + + +static int +my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc,const uchar *s,const uchar *e) +{ + + int hi; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((hi= s[0]) < 0x80) + { + pwc[0]=hi; + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + if (!(pwc[0]=func_big5_uni_onechar((hi<<8)+s[1]))) + return -2; + + return 2; +} + + +/* + Returns a well formed length of a BIG5 string. + CP950 and HKSCS additional characters are also accepted. +*/ +static +size_t my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) +{ + const char *b0= b; + const char *emb= e - 1; /* Last possible end of an MB character */ + + *error= 0; + while (pos-- && b < e) + { + if ((uchar) b[0] < 128) + { + /* Single byte ascii character */ + b++; + } + else if ((b < emb) && isbig5code((uchar)*b, (uchar)b[1])) + { + /* Double byte character */ + b+= 2; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (size_t) (b - b0); +} + + +static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler = +{ + NULL, /* init */ + my_strnncoll_big5, + my_strnncollsp_big5, + my_strnxfrm_big5, + my_strnxfrmlen_simple, + my_like_range_big5, + my_wildcmp_mb, + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_big5_handler= +{ + NULL, /* init */ + ismbchar_big5, + mbcharlen_big5, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_big5, + my_lengthsp_8bit, + my_numcells_8bit, + my_mb_wc_big5, /* mb_wc */ + my_wc_mb_big5, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + +CHARSET_INFO my_charset_big5_chinese_ci= +{ + 1,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ + "big5", /* cs name */ + "big5_chinese_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_big5, + to_lower_big5, + to_upper_big5, + sort_order_big5, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_big5_handler, + &my_collation_big5_chinese_ci_handler +}; + + +CHARSET_INFO my_charset_big5_bin= +{ + 84,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "big5", /* cs name */ + "big5_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_big5, + to_lower_big5, + to_upper_big5, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_big5_handler, + &my_collation_mb_bin_handler +}; + + +#endif diff --git a/externals/mysql/strings/ctype-bin.c b/externals/mysql/strings/ctype-bin.c new file mode 100644 index 0000000..4951023 --- /dev/null +++ b/externals/mysql/strings/ctype-bin.c @@ -0,0 +1,570 @@ +/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* This file is for binary pseudo charset, created by bar@mysql.com */ + + +#include +#include "m_string.h" +#include "m_ctype.h" + +static uchar ctype_bin[]= +{ + 0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16, + 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, + 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + + +/* Dummy array for toupper / tolower / sortorder */ + +static uchar bin_char_array[] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + + +static my_bool +my_coll_init_8bit_bin(CHARSET_INFO *cs, + void *(*alloc)(size_t) __attribute__((unused))) +{ + cs->max_sort_char=255; + return FALSE; +} + +static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + size_t len=min(slen,tlen); + int cmp= memcmp(s,t,len); + return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); +} + + +size_t my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr __attribute__((unused)), + size_t length) +{ + return length; +} + + +/* + Compare two strings. Result is sign(first_argument - second_argument) + + SYNOPSIS + my_strnncollsp_binary() + cs Chararacter set + s String to compare + slen Length of 's' + t String to compare + tlen Length of 't' + + NOTE + This function is used for real binary strings, i.e. for + BLOB, BINARY(N) and VARBINARY(N). + It compares trailing spaces as spaces. + + RETURN + < 0 s < t + 0 s == t + > 0 s > t +*/ + +static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) +{ + return my_strnncoll_binary(cs,s,slen,t,tlen,0); +} + + +static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + size_t len=min(slen,tlen); + int cmp= memcmp(s,t,len); + return cmp ? cmp : (int)((t_is_prefix ? len : slen) - tlen); +} + + +/* + Compare two strings. Result is sign(first_argument - second_argument) + + SYNOPSIS + my_strnncollsp_8bit_bin() + cs Chararacter set + s String to compare + slen Length of 's' + t String to compare + tlen Length of 't' + diff_if_only_endspace_difference + Set to 1 if the strings should be regarded as different + if they only difference in end space + + NOTE + This function is used for character strings with binary collations. + The shorter string is extended with end space to be as long as the longer + one. + + RETURN + < 0 s < t + 0 s == t + > 0 s > t +*/ + +static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + const uchar *end; + size_t length; + int res; + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + end= a + (length= min(a_length, b_length)); + while (a < end) + { + if (*a++ != *b++) + return ((int) a[-1] - (int) b[-1]); + } + res= 0; + if (a_length != b_length) + { + int swap= 1; + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + if (a_length < b_length) + { + /* put shorter key in s */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (end= a + a_length-length; a < end ; a++) + { + if (*a != ' ') + return (*a < ' ') ? -swap : swap; + } + } + return res; +} + + +/* This function is used for all conversion functions */ + +static size_t my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)), + char *str __attribute__((unused))) +{ + return 0; +} + + +static size_t my_case_bin(CHARSET_INFO *cs __attribute__((unused)), + char *src __attribute__((unused)), + size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + return srclen; +} + + +static int my_strcasecmp_bin(CHARSET_INFO * cs __attribute__((unused)), + const char *s, const char *t) +{ + return strcmp(s,t); +} + + +uint my_mbcharlen_8bit(CHARSET_INFO *cs __attribute__((unused)), + uint c __attribute__((unused))) +{ + return 1; +} + + +static int my_mb_wc_bin(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *wc, + const uchar *str, + const uchar *end __attribute__((unused))) +{ + if (str >= end) + return MY_CS_TOOSMALL; + + *wc=str[0]; + return 1; +} + + +static int my_wc_mb_bin(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, + uchar *s, + uchar *e __attribute__((unused))) +{ + if (s >= e) + return MY_CS_TOOSMALL; + + if (wc < 256) + { + s[0]= (char) wc; + return 1; + } + return MY_CS_ILUNI; +} + + +void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) +{ + const uchar *pos = key; + + /* + Remove trailing spaces. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + key= skip_trailing_space(key, len); + + for (; pos < (uchar*) key ; pos++) + { + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * + ((uint)*pos)) + (nr1[0] << 8); + nr2[0]+=3; + } +} + + +void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2) +{ + const uchar *pos = key; + + key+= len; + + for (; pos < (uchar*) key ; pos++) + { + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * + ((uint)*pos)) + (nr1[0] << 8); + nr2[0]+=3; + } +} + + +/* + The following defines is here to keep the following code identical to + the one in ctype-simple.c +*/ + +#define likeconv(s,A) (A) +#define INC_PTR(cs,A,B) (A)++ + + +int my_wildcmp_bin(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + int result= -1; /* Not found, using wildcards */ + + while (wildstr != wildend) + { + while (*wildstr != w_many && *wildstr != w_one) + { + if (*wildstr == escape && wildstr+1 != wildend) + wildstr++; + if (str == str_end || likeconv(cs,*wildstr++) != likeconv(cs,*str++)) + return(1); /* No match */ + if (wildstr == wildend) + return(str != str_end); /* Match if both are at end */ + result=1; /* Found an anchor char */ + } + if (*wildstr == w_one) + { + do + { + if (str == str_end) /* Skip one char if possible */ + return(result); + INC_PTR(cs,str,str_end); + } while (++wildstr < wildend && *wildstr == w_one); + if (wildstr == wildend) + break; + } + if (*wildstr == w_many) + { /* Found w_many */ + uchar cmp; + wildstr++; + /* Remove any '%' and '_' from the wild search string */ + for (; wildstr != wildend ; wildstr++) + { + if (*wildstr == w_many) + continue; + if (*wildstr == w_one) + { + if (str == str_end) + return(-1); + INC_PTR(cs,str,str_end); + continue; + } + break; /* Not a wild character */ + } + if (wildstr == wildend) + return(0); /* match if w_many is last */ + if (str == str_end) + return(-1); + + if ((cmp= *wildstr) == escape && wildstr+1 != wildend) + cmp= *++wildstr; + + INC_PTR(cs,wildstr,wildend); /* This is compared through cmp */ + cmp=likeconv(cs,cmp); + do + { + while (str != str_end && (uchar) likeconv(cs,*str) != cmp) + str++; + if (str++ == str_end) + return(-1); + { + int tmp=my_wildcmp_bin(cs,str,str_end,wildstr,wildend,escape,w_one, + w_many); + if (tmp <= 0) + return(tmp); + } + } while (str != str_end && wildstr[0] != w_many); + return(-1); + } + } + return(str != str_end ? 1 : 0); +} + + +static size_t +my_strnxfrm_8bit_bin(CHARSET_INFO *cs, + uchar * dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + set_if_smaller(srclen, dstlen); + set_if_smaller(srclen, nweights); + if (dst != src) + memcpy(dst, src, srclen); + return my_strxfrm_pad_desc_and_reverse(cs, dst, dst + srclen, dst + dstlen, + nweights - srclen, flags, 0); +} + + +static +uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)), + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch) +{ + register const uchar *str, *search, *end, *search_end; + + if (s_length <= b_length) + { + if (!s_length) + { + if (nmatch) + { + match->beg= 0; + match->end= 0; + match->mb_len= 0; + } + return 1; /* Empty string is always found */ + } + + str= (const uchar*) b; + search= (const uchar*) s; + end= (const uchar*) b+b_length-s_length+1; + search_end= (const uchar*) s + s_length; + +skip: + while (str != end) + { + if ( (*str++) == (*search)) + { + register const uchar *i,*j; + + i= str; + j= search+1; + + while (j != search_end) + if ((*i++) != (*j++)) + goto skip; + + if (nmatch > 0) + { + match[0].beg= 0; + match[0].end= (size_t) (str- (const uchar*)b-1); + match[0].mb_len= match[0].end; + + if (nmatch > 1) + { + match[1].beg= match[0].end; + match[1].end= match[0].end+s_length; + match[1].mb_len= match[1].end-match[1].beg; + } + } + return 2; + } + } + } + return 0; +} + + +MY_COLLATION_HANDLER my_collation_8bit_bin_handler = +{ + my_coll_init_8bit_bin, + my_strnncoll_8bit_bin, + my_strnncollsp_8bit_bin, + my_strnxfrm_8bit_bin, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_8bit_bin, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_binary_handler = +{ + NULL, /* init */ + my_strnncoll_binary, + my_strnncollsp_binary, + my_strnxfrm_8bit_bin, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_bin, + my_strcasecmp_bin, + my_instr_bin, + my_hash_sort_bin, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + NULL, /* ismbchar */ + my_mbcharlen_8bit, /* mbcharlen */ + my_numchars_8bit, + my_charpos_8bit, + my_well_formed_len_8bit, + my_lengthsp_binary, + my_numcells_8bit, + my_mb_wc_bin, + my_wc_mb_bin, + my_mb_ctype_8bit, + my_case_str_bin, + my_case_str_bin, + my_case_bin, + my_case_bin, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + +CHARSET_INFO my_charset_bin = +{ + 63,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */ + "binary", /* cs name */ + "binary", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_bin, /* ctype */ + bin_char_array, /* to_lower */ + bin_char_array, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + 0, /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_binary_handler +}; diff --git a/externals/mysql/strings/ctype-cp932.c b/externals/mysql/strings/ctype-cp932.c new file mode 100644 index 0000000..14532f5 --- /dev/null +++ b/externals/mysql/strings/ctype-cp932.c @@ -0,0 +1,5555 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file is for cp932 charaset (Windows Japanese), + and created based on ctype-sjis.c file */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_cp932 + + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. strxfrm_multiply_cp932=1 + * .configure. mbmaxlen_cp932=2 + */ + +static uchar NEAR ctype_cp932[257] = +{ + 0, /* For standard library */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ + 0040, 0050, 0050, 0050, 0050, 0050, 0040, 0040, /* ^H - ^O */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^P - ^W */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^X - ^Z ^[ ^\ ^] ^^ ^_ */ + 0110, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* SPC ! " # $ % ^ ' */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* ( ) * + , - . / */ + 0204, 0204, 0204, 0204, 0204, 0204, 0204, 0204, /* 0 1 2 3 4 5 6 7 */ + 0204, 0204, 0020, 0020, 0020, 0020, 0020, 0020, /* 8 9 : ; < = > ? */ + 0020, 0201, 0201, 0201, 0201, 0201, 0201, 0001, /* @ A B C D E F G */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* H I J K L M N O */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* P Q R S T U V W */ + 0001, 0001, 0001, 0020, 0020, 0020, 0020, 0020, /* X Y Z [ \ ] ^ _ */ + 0020, 0202, 0202, 0202, 0202, 0202, 0202, 0002, /* ` a b c d e f g */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* h i j k l m n o */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* p q r s t u v w */ + 0002, 0002, 0002, 0020, 0020, 0020, 0020, 0040, /* x y z { | } + DEL */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000 +}; + +static uchar NEAR to_lower_cp932[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR to_upper_cp932[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR sort_order_cp932[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +#define iscp932head(c) ((0x81<=(c) && (c)<=0x9f) || \ + ((0xe0<=(c)) && (c)<=0xfc)) +#define iscp932tail(c) ((0x40<=(c) && (c)<=0x7e) || \ + (0x80<=(c) && (c)<=0xfc)) + + +static uint ismbchar_cp932(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return (iscp932head((uchar) *p) && (e-p)>1 && iscp932tail((uchar)p[1]) ? 2: 0); +} + +static uint mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c) +{ + return (iscp932head((uchar) c) ? 2 : 1); +} + + +#define cp932code(c,d) ((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d)) + + +static int my_strnncoll_cp932_internal(CHARSET_INFO *cs, + const uchar **a_res, size_t a_length, + const uchar **b_res, size_t b_length) +{ + const uchar *a= *a_res, *b= *b_res; + const uchar *a_end= a + a_length; + const uchar *b_end= b + b_length; + while (a < a_end && b < b_end) + { + if (ismbchar_cp932(cs,(char*) a, (char*) a_end) && + ismbchar_cp932(cs,(char*) b, (char*) b_end)) + { + uint a_char= cp932code(*a, *(a+1)); + uint b_char= cp932code(*b, *(b+1)); + if (a_char != b_char) + return a_char - b_char; + a += 2; + b += 2; + } else + { + if (sort_order_cp932[(uchar)*a] != sort_order_cp932[(uchar)*b]) + return sort_order_cp932[(uchar)*a] - sort_order_cp932[(uchar)*b]; + a++; + b++; + } + } + *a_res= a; + *b_res= b; + return 0; +} + + +static int my_strnncoll_cp932(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool b_is_prefix) +{ + int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length); + if (b_is_prefix && a_length > b_length) + a_length= b_length; + return res ? res : (int) (a_length - b_length); +} + + +static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) +{ + const uchar *a_end= a + a_length; + const uchar *b_end= b + b_length; + int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + if (!res && (a != a_end || b != b_end)) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a == a_end) + { + /* put shorter key in a */ + a_end= b_end; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (; a < a_end ; a++) + { + if (*a != (uchar) ' ') + return (*a < (uchar) ' ') ? -swap : swap; + } + } + return res; +} + + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +#define max_sort_char ((char) 255) + +static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr,size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length, size_t *max_length) +{ + const char *end=ptr+ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + + while (ptr < end && min_str < min_end) { + if (ismbchar_cp932(cs, ptr, end)) { + *min_str++ = *max_str++ = *ptr++; + if (min_str < min_end) + *min_str++ = *max_str++ = *ptr++; + continue; + } + if (*ptr == escape && ptr+1 < end) { + ptr++; /* Skip escape */ + if (ismbchar_cp932(cs, ptr, end)) + *min_str++ = *max_str++ = *ptr++; + if (min_str < min_end) + *min_str++ = *max_str++ = *ptr++; + continue; + } + if (*ptr == w_one) { /* '_' in SQL */ + *min_str++ = '\0'; /* This should be min char */ + *max_str++ = max_sort_char; + ptr++; + continue; + } + if (*ptr == w_many) + { /* '%' in SQL */ + *min_length = (size_t)(min_str - min_org); + *max_length = res_length; + do + { + *min_str++= 0; + *max_str++= max_sort_char; + } while (min_str < min_end); + return 0; + } + *min_str++ = *max_str++ = *ptr++; + } + *min_length = *max_length = (size_t) (min_str - min_org); + while (min_str < min_end) + *min_str++ = *max_str++ = ' '; /* Because if key compression */ + return 0; +} + +/* page 0 0x00A1-0x00DF */ +static uint16 tab_cp932_uni0[]={ +0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67,0xFF68, +0xFF69,0xFF6A,0xFF6B,0xFF6C,0xFF6D,0xFF6E,0xFF6F,0xFF70, +0xFF71,0xFF72,0xFF73,0xFF74,0xFF75,0xFF76,0xFF77,0xFF78, +0xFF79,0xFF7A,0xFF7B,0xFF7C,0xFF7D,0xFF7E,0xFF7F,0xFF80, +0xFF81,0xFF82,0xFF83,0xFF84,0xFF85,0xFF86,0xFF87,0xFF88, +0xFF89,0xFF8A,0xFF8B,0xFF8C,0xFF8D,0xFF8E,0xFF8F,0xFF90, +0xFF91,0xFF92,0xFF93,0xFF94,0xFF95,0xFF96,0xFF97,0xFF98, +0xFF99,0xFF9A,0xFF9B,0xFF9C,0xFF9D,0xFF9E,0xFF9F}; + +/* page 1 0x8140-0x84BE */ +static uint16 tab_cp932_uni1[]={ +0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B, +0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E, +0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD, +0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0xFF3C, +0xFF5E,0x2225,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C, +0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B, +0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E, +0x300F,0x3010,0x3011,0xFF0B,0xFF0D,0x00B1,0x00D7, 0, +0x00F7,0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E, +0x2234,0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5, +0xFF04,0xFFE0,0xFFE1,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20, +0x00A7,0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,0x25C6, +0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B,0x3012, +0x2192,0x2190,0x2191,0x2193,0x3013, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,0x2229, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2227,0x2228,0xFFE2,0x21D2,0x21D4,0x2200,0x2203, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2220,0x22A5,0x2312,0x2202,0x2207,0x2261, +0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x2235,0x222B, +0x222C, 0, 0, 0, 0, 0, 0, 0, +0x212B,0x2030,0x266F,0x266D,0x266A,0x2020,0x2021,0x00B6, + 0, 0, 0, 0,0x25EF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xFF10, +0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17,0xFF18, +0xFF19, 0, 0, 0, 0, 0, 0, 0, +0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28, +0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,0xFF30, +0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38, +0xFF39,0xFF3A, 0, 0, 0, 0, 0, 0, + 0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47, +0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F, +0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57, +0xFF58,0xFF59,0xFF5A, 0, 0, 0, 0,0x3041, +0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,0x3049, +0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050,0x3051, +0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,0x3059, +0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060,0x3061, +0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,0x3069, +0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070,0x3071, +0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,0x3079, +0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080,0x3081, +0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,0x3089, +0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090,0x3091, +0x3092,0x3093, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8, +0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0, +0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8, +0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0, +0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8, +0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0, +0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8, +0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF, 0, +0x30E0,0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7, +0x30E8,0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF, +0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6, 0, + 0, 0, 0, 0, 0, 0, 0,0x0391, +0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399, +0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0,0x03A1, +0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9, 0, + 0, 0, 0, 0, 0, 0, 0,0x03B1, +0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,0x03B9, +0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0,0x03C1, +0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416, +0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426, +0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E, +0x042F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, +0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D, 0, +0x043E,0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445, +0x0446,0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D, +0x044E,0x044F, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2500, +0x2502,0x250C,0x2510,0x2518,0x2514,0x251C,0x252C,0x2524, +0x2534,0x253C,0x2501,0x2503,0x250F,0x2513,0x251B,0x2517, +0x2523,0x2533,0x252B,0x253B,0x254B,0x2520,0x252F,0x2528, +0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542}; + +/* page 2 0x8740-0x879C - NEC Row 13 */ +static uint16 tab_cp932_uni2[]={ +0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467, +0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F, +0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163, +0x2164,0x2165,0x2166,0x2167,0x2168,0x2169, 0,0x3349, +0x3314,0x3322,0x334D,0x3318,0x3327,0x3303,0x3336,0x3351, +0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,0x333B,0x339C, +0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1, 0, 0, + 0, 0, 0, 0, 0, 0,0x337B, 0, +0x301D,0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6, +0x32A7,0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C, +0x2252,0x2261,0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220, +0x221F,0x22BF,0x2235,0x2229,0x222A}; + +/* page 3 0x889F-0x9FFC */ +static uint16 tab_cp932_uni3[]={ +0x4E9C,0x5516,0x5A03,0x963F,0x54C0,0x611B,0x6328,0x59F6, +0x9022,0x8475,0x831C,0x7A50,0x60AA,0x63E1,0x6E25,0x65ED, +0x8466,0x82A6,0x9BF5,0x6893,0x5727,0x65A1,0x6271,0x5B9B, +0x59D0,0x867B,0x98F4,0x7D62,0x7DBE,0x9B8E,0x6216,0x7C9F, +0x88B7,0x5B89,0x5EB5,0x6309,0x6697,0x6848,0x95C7,0x978D, +0x674F,0x4EE5,0x4F0A,0x4F4D,0x4F9D,0x5049,0x56F2,0x5937, +0x59D4,0x5A01,0x5C09,0x60DF,0x610F,0x6170,0x6613,0x6905, +0x70BA,0x754F,0x7570,0x79FB,0x7DAD,0x7DEF,0x80C3,0x840E, +0x8863,0x8B02,0x9055,0x907A,0x533B,0x4E95,0x4EA5,0x57DF, +0x80B2,0x90C1,0x78EF,0x4E00,0x58F1,0x6EA2,0x9038,0x7A32, +0x8328,0x828B,0x9C2F,0x5141,0x5370,0x54BD,0x54E1,0x56E0, +0x59FB,0x5F15,0x98F2,0x6DEB,0x80E4,0x852D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9662,0x9670,0x96A0,0x97FB,0x540B,0x53F3,0x5B87, +0x70CF,0x7FBD,0x8FC2,0x96E8,0x536F,0x9D5C,0x7ABA,0x4E11, +0x7893,0x81FC,0x6E26,0x5618,0x5504,0x6B1D,0x851A,0x9C3B, +0x59E5,0x53A9,0x6D66,0x74DC,0x958F,0x5642,0x4E91,0x904B, +0x96F2,0x834F,0x990C,0x53E1,0x55B6,0x5B30,0x5F71,0x6620, +0x66F3,0x6804,0x6C38,0x6CF3,0x6D29,0x745B,0x76C8,0x7A4E, +0x9834,0x82F1,0x885B,0x8A60,0x92ED,0x6DB2,0x75AB,0x76CA, +0x99C5,0x60A6,0x8B01,0x8D8A,0x95B2,0x698E,0x53AD,0x5186, + 0,0x5712,0x5830,0x5944,0x5BB4,0x5EF6,0x6028,0x63A9, +0x63F4,0x6CBF,0x6F14,0x708E,0x7114,0x7159,0x71D5,0x733F, +0x7E01,0x8276,0x82D1,0x8597,0x9060,0x925B,0x9D1B,0x5869, +0x65BC,0x6C5A,0x7525,0x51F9,0x592E,0x5965,0x5F80,0x5FDC, +0x62BC,0x65FA,0x6A2A,0x6B27,0x6BB4,0x738B,0x7FC1,0x8956, +0x9D2C,0x9D0E,0x9EC4,0x5CA1,0x6C96,0x837B,0x5104,0x5C4B, +0x61B6,0x81C6,0x6876,0x7261,0x4E59,0x4FFA,0x5378,0x6069, +0x6E29,0x7A4F,0x97F3,0x4E0B,0x5316,0x4EEE,0x4F55,0x4F3D, +0x4FA1,0x4F73,0x52A0,0x53EF,0x5609,0x590F,0x5AC1,0x5BB6, +0x5BE1,0x79D1,0x6687,0x679C,0x67B6,0x6B4C,0x6CB3,0x706B, +0x73C2,0x798D,0x79BE,0x7A3C,0x7B87,0x82B1,0x82DB,0x8304, +0x8377,0x83EF,0x83D3,0x8766,0x8AB2,0x5629,0x8CA8,0x8FE6, +0x904E,0x971E,0x868A,0x4FC4,0x5CE8,0x6211,0x7259,0x753B, +0x81E5,0x82BD,0x86FE,0x8CC0,0x96C5,0x9913,0x99D5,0x4ECB, +0x4F1A,0x89E3,0x56DE,0x584A,0x58CA,0x5EFB,0x5FEB,0x602A, +0x6094,0x6062,0x61D0,0x6212,0x62D0,0x6539, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9B41,0x6666,0x68B0,0x6D77,0x7070,0x754C,0x7686, +0x7D75,0x82A5,0x87F9,0x958B,0x968E,0x8C9D,0x51F1,0x52BE, +0x5916,0x54B3,0x5BB3,0x5D16,0x6168,0x6982,0x6DAF,0x788D, +0x84CB,0x8857,0x8A72,0x93A7,0x9AB8,0x6D6C,0x99A8,0x86D9, +0x57A3,0x67FF,0x86CE,0x920E,0x5283,0x5687,0x5404,0x5ED3, +0x62E1,0x64B9,0x683C,0x6838,0x6BBB,0x7372,0x78BA,0x7A6B, +0x899A,0x89D2,0x8D6B,0x8F03,0x90ED,0x95A3,0x9694,0x9769, +0x5B66,0x5CB3,0x697D,0x984D,0x984E,0x639B,0x7B20,0x6A2B, + 0,0x6A7F,0x68B6,0x9C0D,0x6F5F,0x5272,0x559D,0x6070, +0x62EC,0x6D3B,0x6E07,0x6ED1,0x845B,0x8910,0x8F44,0x4E14, +0x9C39,0x53F6,0x691B,0x6A3A,0x9784,0x682A,0x515C,0x7AC3, +0x84B2,0x91DC,0x938C,0x565B,0x9D28,0x6822,0x8305,0x8431, +0x7CA5,0x5208,0x82C5,0x74E6,0x4E7E,0x4F83,0x51A0,0x5BD2, +0x520A,0x52D8,0x52E7,0x5DFB,0x559A,0x582A,0x59E6,0x5B8C, +0x5B98,0x5BDB,0x5E72,0x5E79,0x60A3,0x611F,0x6163,0x61BE, +0x63DB,0x6562,0x67D1,0x6853,0x68FA,0x6B3E,0x6B53,0x6C57, +0x6F22,0x6F97,0x6F45,0x74B0,0x7518,0x76E3,0x770B,0x7AFF, +0x7BA1,0x7C21,0x7DE9,0x7F36,0x7FF0,0x809D,0x8266,0x839E, +0x89B3,0x8ACC,0x8CAB,0x9084,0x9451,0x9593,0x9591,0x95A2, +0x9665,0x97D3,0x9928,0x8218,0x4E38,0x542B,0x5CB8,0x5DCC, +0x73A9,0x764C,0x773C,0x5CA9,0x7FEB,0x8D0B,0x96C1,0x9811, +0x9854,0x9858,0x4F01,0x4F0E,0x5371,0x559C,0x5668,0x57FA, +0x5947,0x5B09,0x5BC4,0x5C90,0x5E0C,0x5E7E,0x5FCC,0x63EE, +0x673A,0x65D7,0x65E2,0x671F,0x68CB,0x68C4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6A5F,0x5E30,0x6BC5,0x6C17,0x6C7D,0x757F,0x7948, +0x5B63,0x7A00,0x7D00,0x5FBD,0x898F,0x8A18,0x8CB4,0x8D77, +0x8ECC,0x8F1D,0x98E2,0x9A0E,0x9B3C,0x4E80,0x507D,0x5100, +0x5993,0x5B9C,0x622F,0x6280,0x64EC,0x6B3A,0x72A0,0x7591, +0x7947,0x7FA9,0x87FB,0x8ABC,0x8B70,0x63AC,0x83CA,0x97A0, +0x5409,0x5403,0x55AB,0x6854,0x6A58,0x8A70,0x7827,0x6775, +0x9ECD,0x5374,0x5BA2,0x811A,0x8650,0x9006,0x4E18,0x4E45, +0x4EC7,0x4F11,0x53CA,0x5438,0x5BAE,0x5F13,0x6025,0x6551, + 0,0x673D,0x6C42,0x6C72,0x6CE3,0x7078,0x7403,0x7A76, +0x7AAE,0x7B08,0x7D1A,0x7CFE,0x7D66,0x65E7,0x725B,0x53BB, +0x5C45,0x5DE8,0x62D2,0x62E0,0x6319,0x6E20,0x865A,0x8A31, +0x8DDD,0x92F8,0x6F01,0x79A6,0x9B5A,0x4EA8,0x4EAB,0x4EAC, +0x4F9B,0x4FA0,0x50D1,0x5147,0x7AF6,0x5171,0x51F6,0x5354, +0x5321,0x537F,0x53EB,0x55AC,0x5883,0x5CE1,0x5F37,0x5F4A, +0x602F,0x6050,0x606D,0x631F,0x6559,0x6A4B,0x6CC1,0x72C2, +0x72ED,0x77EF,0x80F8,0x8105,0x8208,0x854E,0x90F7,0x93E1, +0x97FF,0x9957,0x9A5A,0x4EF0,0x51DD,0x5C2D,0x6681,0x696D, +0x5C40,0x66F2,0x6975,0x7389,0x6850,0x7C81,0x50C5,0x52E4, +0x5747,0x5DFE,0x9326,0x65A4,0x6B23,0x6B3D,0x7434,0x7981, +0x79BD,0x7B4B,0x7DCA,0x82B9,0x83CC,0x887F,0x895F,0x8B39, +0x8FD1,0x91D1,0x541F,0x9280,0x4E5D,0x5036,0x53E5,0x533A, +0x72D7,0x7396,0x77E9,0x82E6,0x8EAF,0x99C6,0x99C8,0x99D2, +0x5177,0x611A,0x865E,0x55B0,0x7A7A,0x5076,0x5BD3,0x9047, +0x9685,0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6398,0x7A9F,0x6C93,0x9774,0x8F61,0x7AAA,0x718A, +0x9688,0x7C82,0x6817,0x7E70,0x6851,0x936C,0x52F2,0x541B, +0x85AB,0x8A13,0x7FA4,0x8ECD,0x90E1,0x5366,0x8888,0x7941, +0x4FC2,0x50BE,0x5211,0x5144,0x5553,0x572D,0x73EA,0x578B, +0x5951,0x5F62,0x5F84,0x6075,0x6176,0x6167,0x61A9,0x63B2, +0x643A,0x656C,0x666F,0x6842,0x6E13,0x7566,0x7A3D,0x7CFB, +0x7D4C,0x7D99,0x7E4B,0x7F6B,0x830E,0x834A,0x86CD,0x8A08, +0x8A63,0x8B66,0x8EFD,0x981A,0x9D8F,0x82B8,0x8FCE,0x9BE8, + 0,0x5287,0x621F,0x6483,0x6FC0,0x9699,0x6841,0x5091, +0x6B20,0x6C7A,0x6F54,0x7A74,0x7D50,0x8840,0x8A23,0x6708, +0x4EF6,0x5039,0x5026,0x5065,0x517C,0x5238,0x5263,0x55A7, +0x570F,0x5805,0x5ACC,0x5EFA,0x61B2,0x61F8,0x62F3,0x6372, +0x691C,0x6A29,0x727D,0x72AC,0x732E,0x7814,0x786F,0x7D79, +0x770C,0x80A9,0x898B,0x8B19,0x8CE2,0x8ED2,0x9063,0x9375, +0x967A,0x9855,0x9A13,0x9E78,0x5143,0x539F,0x53B3,0x5E7B, +0x5F26,0x6E1B,0x6E90,0x7384,0x73FE,0x7D43,0x8237,0x8A00, +0x8AFA,0x9650,0x4E4E,0x500B,0x53E4,0x547C,0x56FA,0x59D1, +0x5B64,0x5DF1,0x5EAB,0x5F27,0x6238,0x6545,0x67AF,0x6E56, +0x72D0,0x7CCA,0x88B4,0x80A1,0x80E1,0x83F0,0x864E,0x8A87, +0x8DE8,0x9237,0x96C7,0x9867,0x9F13,0x4E94,0x4E92,0x4F0D, +0x5348,0x5449,0x543E,0x5A2F,0x5F8C,0x5FA1,0x609F,0x68A7, +0x6A8E,0x745A,0x7881,0x8A9E,0x8AA4,0x8B77,0x9190,0x4E5E, +0x9BC9,0x4EA4,0x4F7C,0x4FAF,0x5019,0x5016,0x5149,0x516C, +0x529F,0x52B9,0x52FE,0x539A,0x53E3,0x5411, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x540E,0x5589,0x5751,0x57A2,0x597D,0x5B54,0x5B5D, +0x5B8F,0x5DE5,0x5DE7,0x5DF7,0x5E78,0x5E83,0x5E9A,0x5EB7, +0x5F18,0x6052,0x614C,0x6297,0x62D8,0x63A7,0x653B,0x6602, +0x6643,0x66F4,0x676D,0x6821,0x6897,0x69CB,0x6C5F,0x6D2A, +0x6D69,0x6E2F,0x6E9D,0x7532,0x7687,0x786C,0x7A3F,0x7CE0, +0x7D05,0x7D18,0x7D5E,0x7DB1,0x8015,0x8003,0x80AF,0x80B1, +0x8154,0x818F,0x822A,0x8352,0x884C,0x8861,0x8B1B,0x8CA2, +0x8CFC,0x90CA,0x9175,0x9271,0x783F,0x92FC,0x95A4,0x964D, + 0,0x9805,0x9999,0x9AD8,0x9D3B,0x525B,0x52AB,0x53F7, +0x5408,0x58D5,0x62F7,0x6FE0,0x8C6A,0x8F5F,0x9EB9,0x514B, +0x523B,0x544A,0x56FD,0x7A40,0x9177,0x9D60,0x9ED2,0x7344, +0x6F09,0x8170,0x7511,0x5FFD,0x60DA,0x9AA8,0x72DB,0x8FBC, +0x6B64,0x9803,0x4ECA,0x56F0,0x5764,0x58BE,0x5A5A,0x6068, +0x61C7,0x660F,0x6606,0x6839,0x68B1,0x6DF7,0x75D5,0x7D3A, +0x826E,0x9B42,0x4E9B,0x4F50,0x53C9,0x5506,0x5D6F,0x5DE6, +0x5DEE,0x67FB,0x6C99,0x7473,0x7802,0x8A50,0x9396,0x88DF, +0x5750,0x5EA7,0x632B,0x50B5,0x50AC,0x518D,0x6700,0x54C9, +0x585E,0x59BB,0x5BB0,0x5F69,0x624D,0x63A1,0x683D,0x6B73, +0x6E08,0x707D,0x91C7,0x7280,0x7815,0x7826,0x796D,0x658E, +0x7D30,0x83DC,0x88C1,0x8F09,0x969B,0x5264,0x5728,0x6750, +0x7F6A,0x8CA1,0x51B4,0x5742,0x962A,0x583A,0x698A,0x80B4, +0x54B2,0x5D0E,0x57FC,0x7895,0x9DFA,0x4F5C,0x524A,0x548B, +0x643E,0x6628,0x6714,0x67F5,0x7A84,0x7B56,0x7D22,0x932F, +0x685C,0x9BAD,0x7B39,0x5319,0x518A,0x5237, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5BDF,0x62F6,0x64AE,0x64E6,0x672D,0x6BBA,0x85A9, +0x96D1,0x7690,0x9BD6,0x634C,0x9306,0x9BAB,0x76BF,0x6652, +0x4E09,0x5098,0x53C2,0x5C71,0x60E8,0x6492,0x6563,0x685F, +0x71E6,0x73CA,0x7523,0x7B97,0x7E82,0x8695,0x8B83,0x8CDB, +0x9178,0x9910,0x65AC,0x66AB,0x6B8B,0x4ED5,0x4ED4,0x4F3A, +0x4F7F,0x523A,0x53F8,0x53F2,0x55E3,0x56DB,0x58EB,0x59CB, +0x59C9,0x59FF,0x5B50,0x5C4D,0x5E02,0x5E2B,0x5FD7,0x601D, +0x6307,0x652F,0x5B5C,0x65AF,0x65BD,0x65E8,0x679D,0x6B62, + 0,0x6B7B,0x6C0F,0x7345,0x7949,0x79C1,0x7CF8,0x7D19, +0x7D2B,0x80A2,0x8102,0x81F3,0x8996,0x8A5E,0x8A69,0x8A66, +0x8A8C,0x8AEE,0x8CC7,0x8CDC,0x96CC,0x98FC,0x6B6F,0x4E8B, +0x4F3C,0x4F8D,0x5150,0x5B57,0x5BFA,0x6148,0x6301,0x6642, +0x6B21,0x6ECB,0x6CBB,0x723E,0x74BD,0x75D4,0x78C1,0x793A, +0x800C,0x8033,0x81EA,0x8494,0x8F9E,0x6C50,0x9E7F,0x5F0F, +0x8B58,0x9D2B,0x7AFA,0x8EF8,0x5B8D,0x96EB,0x4E03,0x53F1, +0x57F7,0x5931,0x5AC9,0x5BA4,0x6089,0x6E7F,0x6F06,0x75BE, +0x8CEA,0x5B9F,0x8500,0x7BE0,0x5072,0x67F4,0x829D,0x5C61, +0x854A,0x7E1E,0x820E,0x5199,0x5C04,0x6368,0x8D66,0x659C, +0x716E,0x793E,0x7D17,0x8005,0x8B1D,0x8ECA,0x906E,0x86C7, +0x90AA,0x501F,0x52FA,0x5C3A,0x6753,0x707C,0x7235,0x914C, +0x91C8,0x932B,0x82E5,0x5BC2,0x5F31,0x60F9,0x4E3B,0x53D6, +0x5B88,0x624B,0x6731,0x6B8A,0x72E9,0x73E0,0x7A2E,0x816B, +0x8DA3,0x9152,0x9996,0x5112,0x53D7,0x546A,0x5BFF,0x6388, +0x6A39,0x7DAC,0x9700,0x56DA,0x53CE,0x5468, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B97,0x5C31,0x5DDE,0x4FEE,0x6101,0x62FE,0x6D32, +0x79C0,0x79CB,0x7D42,0x7E4D,0x7FD2,0x81ED,0x821F,0x8490, +0x8846,0x8972,0x8B90,0x8E74,0x8F2F,0x9031,0x914B,0x916C, +0x96C6,0x919C,0x4EC0,0x4F4F,0x5145,0x5341,0x5F93,0x620E, +0x67D4,0x6C41,0x6E0B,0x7363,0x7E26,0x91CD,0x9283,0x53D4, +0x5919,0x5BBF,0x6DD1,0x795D,0x7E2E,0x7C9B,0x587E,0x719F, +0x51FA,0x8853,0x8FF0,0x4FCA,0x5CFB,0x6625,0x77AC,0x7AE3, +0x821C,0x99FF,0x51C6,0x5FAA,0x65EC,0x696F,0x6B89,0x6DF3, + 0,0x6E96,0x6F64,0x76FE,0x7D14,0x5DE1,0x9075,0x9187, +0x9806,0x51E6,0x521D,0x6240,0x6691,0x66D9,0x6E1A,0x5EB6, +0x7DD2,0x7F72,0x66F8,0x85AF,0x85F7,0x8AF8,0x52A9,0x53D9, +0x5973,0x5E8F,0x5F90,0x6055,0x92E4,0x9664,0x50B7,0x511F, +0x52DD,0x5320,0x5347,0x53EC,0x54E8,0x5546,0x5531,0x5617, +0x5968,0x59BE,0x5A3C,0x5BB5,0x5C06,0x5C0F,0x5C11,0x5C1A, +0x5E84,0x5E8A,0x5EE0,0x5F70,0x627F,0x6284,0x62DB,0x638C, +0x6377,0x6607,0x660C,0x662D,0x6676,0x677E,0x68A2,0x6A1F, +0x6A35,0x6CBC,0x6D88,0x6E09,0x6E58,0x713C,0x7126,0x7167, +0x75C7,0x7701,0x785D,0x7901,0x7965,0x79F0,0x7AE0,0x7B11, +0x7CA7,0x7D39,0x8096,0x83D6,0x848B,0x8549,0x885D,0x88F3, +0x8A1F,0x8A3C,0x8A54,0x8A73,0x8C61,0x8CDE,0x91A4,0x9266, +0x937E,0x9418,0x969C,0x9798,0x4E0A,0x4E08,0x4E1E,0x4E57, +0x5197,0x5270,0x57CE,0x5834,0x58CC,0x5B22,0x5E38,0x60C5, +0x64FE,0x6761,0x6756,0x6D44,0x72B6,0x7573,0x7A63,0x84B8, +0x8B72,0x91B8,0x9320,0x5631,0x57F4,0x98FE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x62ED,0x690D,0x6B96,0x71ED,0x7E54,0x8077,0x8272, +0x89E6,0x98DF,0x8755,0x8FB1,0x5C3B,0x4F38,0x4FE1,0x4FB5, +0x5507,0x5A20,0x5BDD,0x5BE9,0x5FC3,0x614E,0x632F,0x65B0, +0x664B,0x68EE,0x699B,0x6D78,0x6DF1,0x7533,0x75B9,0x771F, +0x795E,0x79E6,0x7D33,0x81E3,0x82AF,0x85AA,0x89AA,0x8A3A, +0x8EAB,0x8F9B,0x9032,0x91DD,0x9707,0x4EBA,0x4EC1,0x5203, +0x5875,0x58EC,0x5C0B,0x751A,0x5C3D,0x814E,0x8A0A,0x8FC5, +0x9663,0x976D,0x7B25,0x8ACF,0x9808,0x9162,0x56F3,0x53A8, + 0,0x9017,0x5439,0x5782,0x5E25,0x63A8,0x6C34,0x708A, +0x7761,0x7C8B,0x7FE0,0x8870,0x9042,0x9154,0x9310,0x9318, +0x968F,0x745E,0x9AC4,0x5D07,0x5D69,0x6570,0x67A2,0x8DA8, +0x96DB,0x636E,0x6749,0x6919,0x83C5,0x9817,0x96C0,0x88FE, +0x6F84,0x647A,0x5BF8,0x4E16,0x702C,0x755D,0x662F,0x51C4, +0x5236,0x52E2,0x59D3,0x5F81,0x6027,0x6210,0x653F,0x6574, +0x661F,0x6674,0x68F2,0x6816,0x6B63,0x6E05,0x7272,0x751F, +0x76DB,0x7CBE,0x8056,0x58F0,0x88FD,0x897F,0x8AA0,0x8A93, +0x8ACB,0x901D,0x9192,0x9752,0x9759,0x6589,0x7A0E,0x8106, +0x96BB,0x5E2D,0x60DC,0x621A,0x65A5,0x6614,0x6790,0x77F3, +0x7A4D,0x7C4D,0x7E3E,0x810A,0x8CAC,0x8D64,0x8DE1,0x8E5F, +0x78A9,0x5207,0x62D9,0x63A5,0x6442,0x6298,0x8A2D,0x7A83, +0x7BC0,0x8AAC,0x96EA,0x7D76,0x820C,0x8749,0x4ED9,0x5148, +0x5343,0x5360,0x5BA3,0x5C02,0x5C16,0x5DDD,0x6226,0x6247, +0x64B0,0x6813,0x6834,0x6CC9,0x6D45,0x6D17,0x67D3,0x6F5C, +0x714E,0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7E4A,0x7FA8,0x817A,0x821B,0x8239,0x85A6,0x8A6E, +0x8CCE,0x8DF5,0x9078,0x9077,0x92AD,0x9291,0x9583,0x9BAE, +0x524D,0x5584,0x6F38,0x7136,0x5168,0x7985,0x7E55,0x81B3, +0x7CCE,0x564C,0x5851,0x5CA8,0x63AA,0x66FE,0x66FD,0x695A, +0x72D9,0x758F,0x758E,0x790E,0x7956,0x79DF,0x7C97,0x7D20, +0x7D44,0x8607,0x8A34,0x963B,0x9061,0x9F20,0x50E7,0x5275, +0x53CC,0x53E2,0x5009,0x55AA,0x58EE,0x594F,0x723D,0x5B8B, +0x5C64,0x531D,0x60E3,0x60F3,0x635C,0x6383,0x633F,0x63BB, + 0,0x64CD,0x65E9,0x66F9,0x5DE3,0x69CD,0x69FD,0x6F15, +0x71E5,0x4E89,0x75E9,0x76F8,0x7A93,0x7CDF,0x7DCF,0x7D9C, +0x8061,0x8349,0x8358,0x846C,0x84BC,0x85FB,0x88C5,0x8D70, +0x9001,0x906D,0x9397,0x971C,0x9A12,0x50CF,0x5897,0x618E, +0x81D3,0x8535,0x8D08,0x9020,0x4FC3,0x5074,0x5247,0x5373, +0x606F,0x6349,0x675F,0x6E2C,0x8DB3,0x901F,0x4FD7,0x5C5E, +0x8CCA,0x65CF,0x7D9A,0x5352,0x8896,0x5176,0x63C3,0x5B58, +0x5B6B,0x5C0A,0x640D,0x6751,0x905C,0x4ED6,0x591A,0x592A, +0x6C70,0x8A51,0x553E,0x5815,0x59A5,0x60F0,0x6253,0x67C1, +0x8235,0x6955,0x9640,0x99C4,0x9A28,0x4F53,0x5806,0x5BFE, +0x8010,0x5CB1,0x5E2F,0x5F85,0x6020,0x614B,0x6234,0x66FF, +0x6CF0,0x6EDE,0x80CE,0x817F,0x82D4,0x888B,0x8CB8,0x9000, +0x902E,0x968A,0x9EDB,0x9BDB,0x4EE3,0x53F0,0x5927,0x7B2C, +0x918D,0x984C,0x9DF9,0x6EDD,0x7027,0x5353,0x5544,0x5B85, +0x6258,0x629E,0x62D3,0x6CA2,0x6FEF,0x7422,0x8A17,0x9438, +0x6FC1,0x8AFE,0x8338,0x51E7,0x86F8,0x53EA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x53E9,0x4F46,0x9054,0x8FB0,0x596A,0x8131,0x5DFD, +0x7AEA,0x8FBF,0x68DA,0x8C37,0x72F8,0x9C48,0x6A3D,0x8AB0, +0x4E39,0x5358,0x5606,0x5766,0x62C5,0x63A2,0x65E6,0x6B4E, +0x6DE1,0x6E5B,0x70AD,0x77ED,0x7AEF,0x7BAA,0x7DBB,0x803D, +0x80C6,0x86CB,0x8A95,0x935B,0x56E3,0x58C7,0x5F3E,0x65AD, +0x6696,0x6A80,0x6BB5,0x7537,0x8AC7,0x5024,0x77E5,0x5730, +0x5F1B,0x6065,0x667A,0x6C60,0x75F4,0x7A1A,0x7F6E,0x81F4, +0x8718,0x9045,0x99B3,0x7BC9,0x755C,0x7AF9,0x7B51,0x84C4, + 0,0x9010,0x79E9,0x7A92,0x8336,0x5AE1,0x7740,0x4E2D, +0x4EF2,0x5B99,0x5FE0,0x62BD,0x663C,0x67F1,0x6CE8,0x866B, +0x8877,0x8A3B,0x914E,0x92F3,0x99D0,0x6A17,0x7026,0x732A, +0x82E7,0x8457,0x8CAF,0x4E01,0x5146,0x51CB,0x558B,0x5BF5, +0x5E16,0x5E33,0x5E81,0x5F14,0x5F35,0x5F6B,0x5FB4,0x61F2, +0x6311,0x66A2,0x671D,0x6F6E,0x7252,0x753A,0x773A,0x8074, +0x8139,0x8178,0x8776,0x8ABF,0x8ADC,0x8D85,0x8DF3,0x929A, +0x9577,0x9802,0x9CE5,0x52C5,0x6357,0x76F4,0x6715,0x6C88, +0x73CD,0x8CC3,0x93AE,0x9673,0x6D25,0x589C,0x690E,0x69CC, +0x8FFD,0x939A,0x75DB,0x901A,0x585A,0x6802,0x63B4,0x69FB, +0x4F43,0x6F2C,0x67D8,0x8FBB,0x8526,0x7DB4,0x9354,0x693F, +0x6F70,0x576A,0x58F7,0x5B2C,0x7D2C,0x722A,0x540A,0x91E3, +0x9DB4,0x4EAD,0x4F4E,0x505C,0x5075,0x5243,0x8C9E,0x5448, +0x5824,0x5B9A,0x5E1D,0x5E95,0x5EAD,0x5EF7,0x5F1F,0x608C, +0x62B5,0x633A,0x63D0,0x68AF,0x6C40,0x7887,0x798E,0x7A0B, +0x7DE0,0x8247,0x8A02,0x8AE6,0x8E44,0x9013, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x90B8,0x912D,0x91D8,0x9F0E,0x6CE5,0x6458,0x64E2, +0x6575,0x6EF4,0x7684,0x7B1B,0x9069,0x93D1,0x6EBA,0x54F2, +0x5FB9,0x64A4,0x8F4D,0x8FED,0x9244,0x5178,0x586B,0x5929, +0x5C55,0x5E97,0x6DFB,0x7E8F,0x751C,0x8CBC,0x8EE2,0x985B, +0x70B9,0x4F1D,0x6BBF,0x6FB1,0x7530,0x96FB,0x514E,0x5410, +0x5835,0x5857,0x59AC,0x5C60,0x5F92,0x6597,0x675C,0x6E21, +0x767B,0x83DF,0x8CED,0x9014,0x90FD,0x934D,0x7825,0x783A, +0x52AA,0x5EA6,0x571F,0x5974,0x6012,0x5012,0x515A,0x51AC, + 0,0x51CD,0x5200,0x5510,0x5854,0x5858,0x5957,0x5B95, +0x5CF6,0x5D8B,0x60BC,0x6295,0x642D,0x6771,0x6843,0x68BC, +0x68DF,0x76D7,0x6DD8,0x6E6F,0x6D9B,0x706F,0x71C8,0x5F53, +0x75D8,0x7977,0x7B49,0x7B54,0x7B52,0x7CD6,0x7D71,0x5230, +0x8463,0x8569,0x85E4,0x8A0E,0x8B04,0x8C46,0x8E0F,0x9003, +0x900F,0x9419,0x9676,0x982D,0x9A30,0x95D8,0x50CD,0x52D5, +0x540C,0x5802,0x5C0E,0x61A7,0x649E,0x6D1E,0x77B3,0x7AE5, +0x80F4,0x8404,0x9053,0x9285,0x5CE0,0x9D07,0x533F,0x5F97, +0x5FB3,0x6D9C,0x7279,0x7763,0x79BF,0x7BE4,0x6BD2,0x72EC, +0x8AAD,0x6803,0x6A61,0x51F8,0x7A81,0x6934,0x5C4A,0x9CF6, +0x82EB,0x5BC5,0x9149,0x701E,0x5678,0x5C6F,0x60C7,0x6566, +0x6C8C,0x8C5A,0x9041,0x9813,0x5451,0x66C7,0x920D,0x5948, +0x90A3,0x5185,0x4E4D,0x51EA,0x8599,0x8B0E,0x7058,0x637A, +0x934B,0x6962,0x99B4,0x7E04,0x7577,0x5357,0x6960,0x8EDF, +0x96E3,0x6C5D,0x4E8C,0x5C3C,0x5F10,0x8FE9,0x5302,0x8CD1, +0x8089,0x8679,0x5EFF,0x65E5,0x4E73,0x5165, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5982,0x5C3F,0x97EE,0x4EFB,0x598A,0x5FCD,0x8A8D, +0x6FE1,0x79B0,0x7962,0x5BE7,0x8471,0x732B,0x71B1,0x5E74, +0x5FF5,0x637B,0x649A,0x71C3,0x7C98,0x4E43,0x5EFC,0x4E4B, +0x57DC,0x56A2,0x60A9,0x6FC3,0x7D0D,0x80FD,0x8133,0x81BF, +0x8FB2,0x8997,0x86A4,0x5DF4,0x628A,0x64AD,0x8987,0x6777, +0x6CE2,0x6D3E,0x7436,0x7834,0x5A46,0x7F75,0x82AD,0x99AC, +0x4FF3,0x5EC3,0x62DD,0x6392,0x6557,0x676F,0x76C3,0x724C, +0x80CC,0x80BA,0x8F29,0x914D,0x500D,0x57F9,0x5A92,0x6885, + 0,0x6973,0x7164,0x72FD,0x8CB7,0x58F2,0x8CE0,0x966A, +0x9019,0x877F,0x79E4,0x77E7,0x8429,0x4F2F,0x5265,0x535A, +0x62CD,0x67CF,0x6CCA,0x767D,0x7B94,0x7C95,0x8236,0x8584, +0x8FEB,0x66DD,0x6F20,0x7206,0x7E1B,0x83AB,0x99C1,0x9EA6, +0x51FD,0x7BB1,0x7872,0x7BB8,0x8087,0x7B48,0x6AE8,0x5E61, +0x808C,0x7551,0x7560,0x516B,0x9262,0x6E8C,0x767A,0x9197, +0x9AEA,0x4F10,0x7F70,0x629C,0x7B4F,0x95A5,0x9CE9,0x567A, +0x5859,0x86E4,0x96BC,0x4F34,0x5224,0x534A,0x53CD,0x53DB, +0x5E06,0x642C,0x6591,0x677F,0x6C3E,0x6C4E,0x7248,0x72AF, +0x73ED,0x7554,0x7E41,0x822C,0x85E9,0x8CA9,0x7BC4,0x91C6, +0x7169,0x9812,0x98EF,0x633D,0x6669,0x756A,0x76E4,0x78D0, +0x8543,0x86EE,0x532A,0x5351,0x5426,0x5983,0x5E87,0x5F7C, +0x60B2,0x6249,0x6279,0x62AB,0x6590,0x6BD4,0x6CCC,0x75B2, +0x76AE,0x7891,0x79D8,0x7DCB,0x7F77,0x80A5,0x88AB,0x8AB9, +0x8CBB,0x907F,0x975E,0x98DB,0x6A0B,0x7C38,0x5099,0x5C3E, +0x5FAE,0x6787,0x6BD8,0x7435,0x7709,0x7F8E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9F3B,0x67CA,0x7A17,0x5339,0x758B,0x9AED,0x5F66, +0x819D,0x83F1,0x8098,0x5F3C,0x5FC5,0x7562,0x7B46,0x903C, +0x6867,0x59EB,0x5A9B,0x7D10,0x767E,0x8B2C,0x4FF5,0x5F6A, +0x6A19,0x6C37,0x6F02,0x74E2,0x7968,0x8868,0x8A55,0x8C79, +0x5EDF,0x63CF,0x75C5,0x79D2,0x82D7,0x9328,0x92F2,0x849C, +0x86ED,0x9C2D,0x54C1,0x5F6C,0x658C,0x6D5C,0x7015,0x8CA7, +0x8CD3,0x983B,0x654F,0x74F6,0x4E0D,0x4ED8,0x57E0,0x592B, +0x5A66,0x5BCC,0x51A8,0x5E03,0x5E9C,0x6016,0x6276,0x6577, + 0,0x65A7,0x666E,0x6D6E,0x7236,0x7B26,0x8150,0x819A, +0x8299,0x8B5C,0x8CA0,0x8CE6,0x8D74,0x961C,0x9644,0x4FAE, +0x64AB,0x6B66,0x821E,0x8461,0x856A,0x90E8,0x5C01,0x6953, +0x98A8,0x847A,0x8557,0x4F0F,0x526F,0x5FA9,0x5E45,0x670D, +0x798F,0x8179,0x8907,0x8986,0x6DF5,0x5F17,0x6255,0x6CB8, +0x4ECF,0x7269,0x9B92,0x5206,0x543B,0x5674,0x58B3,0x61A4, +0x626E,0x711A,0x596E,0x7C89,0x7CDE,0x7D1B,0x96F0,0x6587, +0x805E,0x4E19,0x4F75,0x5175,0x5840,0x5E63,0x5E73,0x5F0A, +0x67C4,0x4E26,0x853D,0x9589,0x965B,0x7C73,0x9801,0x50FB, +0x58C1,0x7656,0x78A7,0x5225,0x77A5,0x8511,0x7B86,0x504F, +0x5909,0x7247,0x7BC7,0x7DE8,0x8FBA,0x8FD4,0x904D,0x4FBF, +0x52C9,0x5A29,0x5F01,0x97AD,0x4FDD,0x8217,0x92EA,0x5703, +0x6355,0x6B69,0x752B,0x88DC,0x8F14,0x7A42,0x52DF,0x5893, +0x6155,0x620A,0x66AE,0x6BCD,0x7C3F,0x83E9,0x5023,0x4FF8, +0x5305,0x5446,0x5831,0x5949,0x5B9D,0x5CF0,0x5CEF,0x5D29, +0x5E96,0x62B1,0x6367,0x653E,0x65B9,0x670B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6CD5,0x6CE1,0x70F9,0x7832,0x7E2B,0x80DE,0x82B3, +0x840C,0x84EC,0x8702,0x8912,0x8A2A,0x8C4A,0x90A6,0x92D2, +0x98FD,0x9CF3,0x9D6C,0x4E4F,0x4EA1,0x508D,0x5256,0x574A, +0x59A8,0x5E3D,0x5FD8,0x5FD9,0x623F,0x66B4,0x671B,0x67D0, +0x68D2,0x5192,0x7D21,0x80AA,0x81A8,0x8B00,0x8C8C,0x8CBF, +0x927E,0x9632,0x5420,0x982C,0x5317,0x50D5,0x535C,0x58A8, +0x64B2,0x6734,0x7267,0x7766,0x7A46,0x91E6,0x52C3,0x6CA1, +0x6B86,0x5800,0x5E4C,0x5954,0x672C,0x7FFB,0x51E1,0x76C6, + 0,0x6469,0x78E8,0x9B54,0x9EBB,0x57CB,0x59B9,0x6627, +0x679A,0x6BCE,0x54E9,0x69D9,0x5E55,0x819C,0x6795,0x9BAA, +0x67FE,0x9C52,0x685D,0x4EA6,0x4FE3,0x53C8,0x62B9,0x672B, +0x6CAB,0x8FC4,0x4FAD,0x7E6D,0x9EBF,0x4E07,0x6162,0x6E80, +0x6F2B,0x8513,0x5473,0x672A,0x9B45,0x5DF3,0x7B95,0x5CAC, +0x5BC6,0x871C,0x6E4A,0x84D1,0x7A14,0x8108,0x5999,0x7C8D, +0x6C11,0x7720,0x52D9,0x5922,0x7121,0x725F,0x77DB,0x9727, +0x9D61,0x690B,0x5A7F,0x5A18,0x51A5,0x540D,0x547D,0x660E, +0x76DF,0x8FF7,0x9298,0x9CF4,0x59EA,0x725D,0x6EC5,0x514D, +0x68C9,0x7DBF,0x7DEC,0x9762,0x9EBA,0x6478,0x6A21,0x8302, +0x5984,0x5B5F,0x6BDB,0x731B,0x76F2,0x7DB2,0x8017,0x8499, +0x5132,0x6728,0x9ED9,0x76EE,0x6762,0x52FF,0x9905,0x5C24, +0x623B,0x7C7E,0x8CB0,0x554F,0x60B6,0x7D0B,0x9580,0x5301, +0x4E5F,0x51B6,0x591C,0x723A,0x8036,0x91CE,0x5F25,0x77E2, +0x5384,0x5F79,0x7D04,0x85AC,0x8A33,0x8E8D,0x9756,0x67F3, +0x85AE,0x9453,0x6109,0x6108,0x6CB9,0x7652, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AED,0x8F38,0x552F,0x4F51,0x512A,0x52C7,0x53CB, +0x5BA5,0x5E7D,0x60A0,0x6182,0x63D6,0x6709,0x67DA,0x6E67, +0x6D8C,0x7336,0x7337,0x7531,0x7950,0x88D5,0x8A98,0x904A, +0x9091,0x90F5,0x96C4,0x878D,0x5915,0x4E88,0x4F59,0x4E0E, +0x8A89,0x8F3F,0x9810,0x50AD,0x5E7C,0x5996,0x5BB9,0x5EB8, +0x63DA,0x63FA,0x64C1,0x66DC,0x694A,0x69D8,0x6D0B,0x6EB6, +0x7194,0x7528,0x7AAF,0x7F8A,0x8000,0x8449,0x84C9,0x8981, +0x8B21,0x8E0A,0x9065,0x967D,0x990A,0x617E,0x6291,0x6B32, + 0,0x6C83,0x6D74,0x7FCC,0x7FFC,0x6DC0,0x7F85,0x87BA, +0x88F8,0x6765,0x83B1,0x983C,0x96F7,0x6D1B,0x7D61,0x843D, +0x916A,0x4E71,0x5375,0x5D50,0x6B04,0x6FEB,0x85CD,0x862D, +0x89A7,0x5229,0x540F,0x5C65,0x674E,0x68A8,0x7406,0x7483, +0x75E2,0x88CF,0x88E1,0x91CC,0x96E2,0x9678,0x5F8B,0x7387, +0x7ACB,0x844E,0x63A0,0x7565,0x5289,0x6D41,0x6E9C,0x7409, +0x7559,0x786B,0x7C92,0x9686,0x7ADC,0x9F8D,0x4FB6,0x616E, +0x65C5,0x865C,0x4E86,0x4EAE,0x50DA,0x4E21,0x51CC,0x5BEE, +0x6599,0x6881,0x6DBC,0x731F,0x7642,0x77AD,0x7A1C,0x7CE7, +0x826F,0x8AD2,0x907C,0x91CF,0x9675,0x9818,0x529B,0x7DD1, +0x502B,0x5398,0x6797,0x6DCB,0x71D0,0x7433,0x81E8,0x8F2A, +0x96A3,0x9C57,0x9E9F,0x7460,0x5841,0x6D99,0x7D2F,0x985E, +0x4EE4,0x4F36,0x4F8B,0x51B7,0x52B1,0x5DBA,0x601C,0x73B2, +0x793C,0x82D3,0x9234,0x96B7,0x96F6,0x970A,0x9E97,0x9F62, +0x66A6,0x6B74,0x5217,0x52A3,0x70C8,0x88C2,0x5EC9,0x604B, +0x6190,0x6F23,0x7149,0x7C3E,0x7DF4,0x806F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x84EE,0x9023,0x932C,0x5442,0x9B6F,0x6AD3,0x7089, +0x8CC2,0x8DEF,0x9732,0x52B4,0x5A41,0x5ECA,0x5F04,0x6717, +0x697C,0x6994,0x6D6A,0x6F0F,0x7262,0x72FC,0x7BED,0x8001, +0x807E,0x874B,0x90CE,0x516D,0x9E93,0x7984,0x808B,0x9332, +0x8AD6,0x502D,0x548C,0x8A71,0x6B6A,0x8CC4,0x8107,0x60D1, +0x67A0,0x9DF2,0x4E99,0x4E98,0x9C10,0x8A6B,0x85C1,0x8568, +0x6900,0x6E7E,0x7897,0x8155, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F0C,0x4E10,0x4E15,0x4E2A,0x4E31,0x4E36,0x4E3C,0x4E3F, +0x4E42,0x4E56,0x4E58,0x4E82,0x4E85,0x8C6B,0x4E8A,0x8212, +0x5F0D,0x4E8E,0x4E9E,0x4E9F,0x4EA0,0x4EA2,0x4EB0,0x4EB3, +0x4EB6,0x4ECE,0x4ECD,0x4EC4,0x4EC6,0x4EC2,0x4ED7,0x4EDE, +0x4EED,0x4EDF,0x4EF7,0x4F09,0x4F5A,0x4F30,0x4F5B,0x4F5D, +0x4F57,0x4F47,0x4F76,0x4F88,0x4F8F,0x4F98,0x4F7B,0x4F69, +0x4F70,0x4F91,0x4F6F,0x4F86,0x4F96,0x5118,0x4FD4,0x4FDF, +0x4FCE,0x4FD8,0x4FDB,0x4FD1,0x4FDA,0x4FD0,0x4FE4,0x4FE5, +0x501A,0x5028,0x5014,0x502A,0x5025,0x5005,0x4F1C,0x4FF6, +0x5021,0x5029,0x502C,0x4FFE,0x4FEF,0x5011,0x5006,0x5043, +0x5047,0x6703,0x5055,0x5050,0x5048,0x505A,0x5056,0x506C, +0x5078,0x5080,0x509A,0x5085,0x50B4,0x50B2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x50C9,0x50CA,0x50B3,0x50C2,0x50D6,0x50DE,0x50E5, +0x50ED,0x50E3,0x50EE,0x50F9,0x50F5,0x5109,0x5101,0x5102, +0x5116,0x5115,0x5114,0x511A,0x5121,0x513A,0x5137,0x513C, +0x513B,0x513F,0x5140,0x5152,0x514C,0x5154,0x5162,0x7AF8, +0x5169,0x516A,0x516E,0x5180,0x5182,0x56D8,0x518C,0x5189, +0x518F,0x5191,0x5193,0x5195,0x5196,0x51A4,0x51A6,0x51A2, +0x51A9,0x51AA,0x51AB,0x51B3,0x51B1,0x51B2,0x51B0,0x51B5, +0x51BD,0x51C5,0x51C9,0x51DB,0x51E0,0x8655,0x51E9,0x51ED, + 0,0x51F0,0x51F5,0x51FE,0x5204,0x520B,0x5214,0x520E, +0x5227,0x522A,0x522E,0x5233,0x5239,0x524F,0x5244,0x524B, +0x524C,0x525E,0x5254,0x526A,0x5274,0x5269,0x5273,0x527F, +0x527D,0x528D,0x5294,0x5292,0x5271,0x5288,0x5291,0x8FA8, +0x8FA7,0x52AC,0x52AD,0x52BC,0x52B5,0x52C1,0x52CD,0x52D7, +0x52DE,0x52E3,0x52E6,0x98ED,0x52E0,0x52F3,0x52F5,0x52F8, +0x52F9,0x5306,0x5308,0x7538,0x530D,0x5310,0x530F,0x5315, +0x531A,0x5323,0x532F,0x5331,0x5333,0x5338,0x5340,0x5346, +0x5345,0x4E17,0x5349,0x534D,0x51D6,0x535E,0x5369,0x536E, +0x5918,0x537B,0x5377,0x5382,0x5396,0x53A0,0x53A6,0x53A5, +0x53AE,0x53B0,0x53B6,0x53C3,0x7C12,0x96D9,0x53DF,0x66FC, +0x71EE,0x53EE,0x53E8,0x53ED,0x53FA,0x5401,0x543D,0x5440, +0x542C,0x542D,0x543C,0x542E,0x5436,0x5429,0x541D,0x544E, +0x548F,0x5475,0x548E,0x545F,0x5471,0x5477,0x5470,0x5492, +0x547B,0x5480,0x5476,0x5484,0x5490,0x5486,0x54C7,0x54A2, +0x54B8,0x54A5,0x54AC,0x54C4,0x54C8,0x54A8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x54AB,0x54C2,0x54A4,0x54BE,0x54BC,0x54D8,0x54E5, +0x54E6,0x550F,0x5514,0x54FD,0x54EE,0x54ED,0x54FA,0x54E2, +0x5539,0x5540,0x5563,0x554C,0x552E,0x555C,0x5545,0x5556, +0x5557,0x5538,0x5533,0x555D,0x5599,0x5580,0x54AF,0x558A, +0x559F,0x557B,0x557E,0x5598,0x559E,0x55AE,0x557C,0x5583, +0x55A9,0x5587,0x55A8,0x55DA,0x55C5,0x55DF,0x55C4,0x55DC, +0x55E4,0x55D4,0x5614,0x55F7,0x5616,0x55FE,0x55FD,0x561B, +0x55F9,0x564E,0x5650,0x71DF,0x5634,0x5636,0x5632,0x5638, + 0,0x566B,0x5664,0x562F,0x566C,0x566A,0x5686,0x5680, +0x568A,0x56A0,0x5694,0x568F,0x56A5,0x56AE,0x56B6,0x56B4, +0x56C2,0x56BC,0x56C1,0x56C3,0x56C0,0x56C8,0x56CE,0x56D1, +0x56D3,0x56D7,0x56EE,0x56F9,0x5700,0x56FF,0x5704,0x5709, +0x5708,0x570B,0x570D,0x5713,0x5718,0x5716,0x55C7,0x571C, +0x5726,0x5737,0x5738,0x574E,0x573B,0x5740,0x574F,0x5769, +0x57C0,0x5788,0x5761,0x577F,0x5789,0x5793,0x57A0,0x57B3, +0x57A4,0x57AA,0x57B0,0x57C3,0x57C6,0x57D4,0x57D2,0x57D3, +0x580A,0x57D6,0x57E3,0x580B,0x5819,0x581D,0x5872,0x5821, +0x5862,0x584B,0x5870,0x6BC0,0x5852,0x583D,0x5879,0x5885, +0x58B9,0x589F,0x58AB,0x58BA,0x58DE,0x58BB,0x58B8,0x58AE, +0x58C5,0x58D3,0x58D1,0x58D7,0x58D9,0x58D8,0x58E5,0x58DC, +0x58E4,0x58DF,0x58EF,0x58FA,0x58F9,0x58FB,0x58FC,0x58FD, +0x5902,0x590A,0x5910,0x591B,0x68A6,0x5925,0x592C,0x592D, +0x5932,0x5938,0x593E,0x7AD2,0x5955,0x5950,0x594E,0x595A, +0x5958,0x5962,0x5960,0x5967,0x596C,0x5969, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5978,0x5981,0x599D,0x4F5E,0x4FAB,0x59A3,0x59B2, +0x59C6,0x59E8,0x59DC,0x598D,0x59D9,0x59DA,0x5A25,0x5A1F, +0x5A11,0x5A1C,0x5A09,0x5A1A,0x5A40,0x5A6C,0x5A49,0x5A35, +0x5A36,0x5A62,0x5A6A,0x5A9A,0x5ABC,0x5ABE,0x5ACB,0x5AC2, +0x5ABD,0x5AE3,0x5AD7,0x5AE6,0x5AE9,0x5AD6,0x5AFA,0x5AFB, +0x5B0C,0x5B0B,0x5B16,0x5B32,0x5AD0,0x5B2A,0x5B36,0x5B3E, +0x5B43,0x5B45,0x5B40,0x5B51,0x5B55,0x5B5A,0x5B5B,0x5B65, +0x5B69,0x5B70,0x5B73,0x5B75,0x5B78,0x6588,0x5B7A,0x5B80, + 0,0x5B83,0x5BA6,0x5BB8,0x5BC3,0x5BC7,0x5BC9,0x5BD4, +0x5BD0,0x5BE4,0x5BE6,0x5BE2,0x5BDE,0x5BE5,0x5BEB,0x5BF0, +0x5BF6,0x5BF3,0x5C05,0x5C07,0x5C08,0x5C0D,0x5C13,0x5C20, +0x5C22,0x5C28,0x5C38,0x5C39,0x5C41,0x5C46,0x5C4E,0x5C53, +0x5C50,0x5C4F,0x5B71,0x5C6C,0x5C6E,0x4E62,0x5C76,0x5C79, +0x5C8C,0x5C91,0x5C94,0x599B,0x5CAB,0x5CBB,0x5CB6,0x5CBC, +0x5CB7,0x5CC5,0x5CBE,0x5CC7,0x5CD9,0x5CE9,0x5CFD,0x5CFA, +0x5CED,0x5D8C,0x5CEA,0x5D0B,0x5D15,0x5D17,0x5D5C,0x5D1F, +0x5D1B,0x5D11,0x5D14,0x5D22,0x5D1A,0x5D19,0x5D18,0x5D4C, +0x5D52,0x5D4E,0x5D4B,0x5D6C,0x5D73,0x5D76,0x5D87,0x5D84, +0x5D82,0x5DA2,0x5D9D,0x5DAC,0x5DAE,0x5DBD,0x5D90,0x5DB7, +0x5DBC,0x5DC9,0x5DCD,0x5DD3,0x5DD2,0x5DD6,0x5DDB,0x5DEB, +0x5DF2,0x5DF5,0x5E0B,0x5E1A,0x5E19,0x5E11,0x5E1B,0x5E36, +0x5E37,0x5E44,0x5E43,0x5E40,0x5E4E,0x5E57,0x5E54,0x5E5F, +0x5E62,0x5E64,0x5E47,0x5E75,0x5E76,0x5E7A,0x9EBC,0x5E7F, +0x5EA0,0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5ED6,0x5EE3,0x5EDD,0x5EDA,0x5EDB,0x5EE2,0x5EE1, +0x5EE8,0x5EE9,0x5EEC,0x5EF1,0x5EF3,0x5EF0,0x5EF4,0x5EF8, +0x5EFE,0x5F03,0x5F09,0x5F5D,0x5F5C,0x5F0B,0x5F11,0x5F16, +0x5F29,0x5F2D,0x5F38,0x5F41,0x5F48,0x5F4C,0x5F4E,0x5F2F, +0x5F51,0x5F56,0x5F57,0x5F59,0x5F61,0x5F6D,0x5F73,0x5F77, +0x5F83,0x5F82,0x5F7F,0x5F8A,0x5F88,0x5F91,0x5F87,0x5F9E, +0x5F99,0x5F98,0x5FA0,0x5FA8,0x5FAD,0x5FBC,0x5FD6,0x5FFB, +0x5FE4,0x5FF8,0x5FF1,0x5FDD,0x60B3,0x5FFF,0x6021,0x6060, + 0,0x6019,0x6010,0x6029,0x600E,0x6031,0x601B,0x6015, +0x602B,0x6026,0x600F,0x603A,0x605A,0x6041,0x606A,0x6077, +0x605F,0x604A,0x6046,0x604D,0x6063,0x6043,0x6064,0x6042, +0x606C,0x606B,0x6059,0x6081,0x608D,0x60E7,0x6083,0x609A, +0x6084,0x609B,0x6096,0x6097,0x6092,0x60A7,0x608B,0x60E1, +0x60B8,0x60E0,0x60D3,0x60B4,0x5FF0,0x60BD,0x60C6,0x60B5, +0x60D8,0x614D,0x6115,0x6106,0x60F6,0x60F7,0x6100,0x60F4, +0x60FA,0x6103,0x6121,0x60FB,0x60F1,0x610D,0x610E,0x6147, +0x613E,0x6128,0x6127,0x614A,0x613F,0x613C,0x612C,0x6134, +0x613D,0x6142,0x6144,0x6173,0x6177,0x6158,0x6159,0x615A, +0x616B,0x6174,0x616F,0x6165,0x6171,0x615F,0x615D,0x6153, +0x6175,0x6199,0x6196,0x6187,0x61AC,0x6194,0x619A,0x618A, +0x6191,0x61AB,0x61AE,0x61CC,0x61CA,0x61C9,0x61F7,0x61C8, +0x61C3,0x61C6,0x61BA,0x61CB,0x7F79,0x61CD,0x61E6,0x61E3, +0x61F6,0x61FA,0x61F4,0x61FF,0x61FD,0x61FC,0x61FE,0x6200, +0x6208,0x6209,0x620D,0x620C,0x6214,0x621B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x621E,0x6221,0x622A,0x622E,0x6230,0x6232,0x6233, +0x6241,0x624E,0x625E,0x6263,0x625B,0x6260,0x6268,0x627C, +0x6282,0x6289,0x627E,0x6292,0x6293,0x6296,0x62D4,0x6283, +0x6294,0x62D7,0x62D1,0x62BB,0x62CF,0x62FF,0x62C6,0x64D4, +0x62C8,0x62DC,0x62CC,0x62CA,0x62C2,0x62C7,0x629B,0x62C9, +0x630C,0x62EE,0x62F1,0x6327,0x6302,0x6308,0x62EF,0x62F5, +0x6350,0x633E,0x634D,0x641C,0x634F,0x6396,0x638E,0x6380, +0x63AB,0x6376,0x63A3,0x638F,0x6389,0x639F,0x63B5,0x636B, + 0,0x6369,0x63BE,0x63E9,0x63C0,0x63C6,0x63E3,0x63C9, +0x63D2,0x63F6,0x63C4,0x6416,0x6434,0x6406,0x6413,0x6426, +0x6436,0x651D,0x6417,0x6428,0x640F,0x6467,0x646F,0x6476, +0x644E,0x652A,0x6495,0x6493,0x64A5,0x64A9,0x6488,0x64BC, +0x64DA,0x64D2,0x64C5,0x64C7,0x64BB,0x64D8,0x64C2,0x64F1, +0x64E7,0x8209,0x64E0,0x64E1,0x62AC,0x64E3,0x64EF,0x652C, +0x64F6,0x64F4,0x64F2,0x64FA,0x6500,0x64FD,0x6518,0x651C, +0x6505,0x6524,0x6523,0x652B,0x6534,0x6535,0x6537,0x6536, +0x6538,0x754B,0x6548,0x6556,0x6555,0x654D,0x6558,0x655E, +0x655D,0x6572,0x6578,0x6582,0x6583,0x8B8A,0x659B,0x659F, +0x65AB,0x65B7,0x65C3,0x65C6,0x65C1,0x65C4,0x65CC,0x65D2, +0x65DB,0x65D9,0x65E0,0x65E1,0x65F1,0x6772,0x660A,0x6603, +0x65FB,0x6773,0x6635,0x6636,0x6634,0x661C,0x664F,0x6644, +0x6649,0x6641,0x665E,0x665D,0x6664,0x6667,0x6668,0x665F, +0x6662,0x6670,0x6683,0x6688,0x668E,0x6689,0x6684,0x6698, +0x669D,0x66C1,0x66B9,0x66C9,0x66BE,0x66BC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x66C4,0x66B8,0x66D6,0x66DA,0x66E0,0x663F,0x66E6, +0x66E9,0x66F0,0x66F5,0x66F7,0x670F,0x6716,0x671E,0x6726, +0x6727,0x9738,0x672E,0x673F,0x6736,0x6741,0x6738,0x6737, +0x6746,0x675E,0x6760,0x6759,0x6763,0x6764,0x6789,0x6770, +0x67A9,0x677C,0x676A,0x678C,0x678B,0x67A6,0x67A1,0x6785, +0x67B7,0x67EF,0x67B4,0x67EC,0x67B3,0x67E9,0x67B8,0x67E4, +0x67DE,0x67DD,0x67E2,0x67EE,0x67B9,0x67CE,0x67C6,0x67E7, +0x6A9C,0x681E,0x6846,0x6829,0x6840,0x684D,0x6832,0x684E, + 0,0x68B3,0x682B,0x6859,0x6863,0x6877,0x687F,0x689F, +0x688F,0x68AD,0x6894,0x689D,0x689B,0x6883,0x6AAE,0x68B9, +0x6874,0x68B5,0x68A0,0x68BA,0x690F,0x688D,0x687E,0x6901, +0x68CA,0x6908,0x68D8,0x6922,0x6926,0x68E1,0x690C,0x68CD, +0x68D4,0x68E7,0x68D5,0x6936,0x6912,0x6904,0x68D7,0x68E3, +0x6925,0x68F9,0x68E0,0x68EF,0x6928,0x692A,0x691A,0x6923, +0x6921,0x68C6,0x6979,0x6977,0x695C,0x6978,0x696B,0x6954, +0x697E,0x696E,0x6939,0x6974,0x693D,0x6959,0x6930,0x6961, +0x695E,0x695D,0x6981,0x696A,0x69B2,0x69AE,0x69D0,0x69BF, +0x69C1,0x69D3,0x69BE,0x69CE,0x5BE8,0x69CA,0x69DD,0x69BB, +0x69C3,0x69A7,0x6A2E,0x6991,0x69A0,0x699C,0x6995,0x69B4, +0x69DE,0x69E8,0x6A02,0x6A1B,0x69FF,0x6B0A,0x69F9,0x69F2, +0x69E7,0x6A05,0x69B1,0x6A1E,0x69ED,0x6A14,0x69EB,0x6A0A, +0x6A12,0x6AC1,0x6A23,0x6A13,0x6A44,0x6A0C,0x6A72,0x6A36, +0x6A78,0x6A47,0x6A62,0x6A59,0x6A66,0x6A48,0x6A38,0x6A22, +0x6A90,0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6A97,0x8617,0x6ABB,0x6AC3,0x6AC2,0x6AB8,0x6AB3, +0x6AAC,0x6ADE,0x6AD1,0x6ADF,0x6AAA,0x6ADA,0x6AEA,0x6AFB, +0x6B05,0x8616,0x6AFA,0x6B12,0x6B16,0x9B31,0x6B1F,0x6B38, +0x6B37,0x76DC,0x6B39,0x98EE,0x6B47,0x6B43,0x6B49,0x6B50, +0x6B59,0x6B54,0x6B5B,0x6B5F,0x6B61,0x6B78,0x6B79,0x6B7F, +0x6B80,0x6B84,0x6B83,0x6B8D,0x6B98,0x6B95,0x6B9E,0x6BA4, +0x6BAA,0x6BAB,0x6BAF,0x6BB2,0x6BB1,0x6BB3,0x6BB7,0x6BBC, +0x6BC6,0x6BCB,0x6BD3,0x6BDF,0x6BEC,0x6BEB,0x6BF3,0x6BEF, + 0,0x9EBE,0x6C08,0x6C13,0x6C14,0x6C1B,0x6C24,0x6C23, +0x6C5E,0x6C55,0x6C62,0x6C6A,0x6C82,0x6C8D,0x6C9A,0x6C81, +0x6C9B,0x6C7E,0x6C68,0x6C73,0x6C92,0x6C90,0x6CC4,0x6CF1, +0x6CD3,0x6CBD,0x6CD7,0x6CC5,0x6CDD,0x6CAE,0x6CB1,0x6CBE, +0x6CBA,0x6CDB,0x6CEF,0x6CD9,0x6CEA,0x6D1F,0x884D,0x6D36, +0x6D2B,0x6D3D,0x6D38,0x6D19,0x6D35,0x6D33,0x6D12,0x6D0C, +0x6D63,0x6D93,0x6D64,0x6D5A,0x6D79,0x6D59,0x6D8E,0x6D95, +0x6FE4,0x6D85,0x6DF9,0x6E15,0x6E0A,0x6DB5,0x6DC7,0x6DE6, +0x6DB8,0x6DC6,0x6DEC,0x6DDE,0x6DCC,0x6DE8,0x6DD2,0x6DC5, +0x6DFA,0x6DD9,0x6DE4,0x6DD5,0x6DEA,0x6DEE,0x6E2D,0x6E6E, +0x6E2E,0x6E19,0x6E72,0x6E5F,0x6E3E,0x6E23,0x6E6B,0x6E2B, +0x6E76,0x6E4D,0x6E1F,0x6E43,0x6E3A,0x6E4E,0x6E24,0x6EFF, +0x6E1D,0x6E38,0x6E82,0x6EAA,0x6E98,0x6EC9,0x6EB7,0x6ED3, +0x6EBD,0x6EAF,0x6EC4,0x6EB2,0x6ED4,0x6ED5,0x6E8F,0x6EA5, +0x6EC2,0x6E9F,0x6F41,0x6F11,0x704C,0x6EEC,0x6EF8,0x6EFE, +0x6F3F,0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC}; + +/* page 4 0xE040-0xEAA4 */ +static uint16 tab_cp932_uni4[]={ +0x6F3E,0x6F13,0x6EF7,0x6F86,0x6F7A,0x6F78,0x6F81,0x6F80, +0x6F6F,0x6F5B,0x6FF3,0x6F6D,0x6F82,0x6F7C,0x6F58,0x6F8E, +0x6F91,0x6FC2,0x6F66,0x6FB3,0x6FA3,0x6FA1,0x6FA4,0x6FB9, +0x6FC6,0x6FAA,0x6FDF,0x6FD5,0x6FEC,0x6FD4,0x6FD8,0x6FF1, +0x6FEE,0x6FDB,0x7009,0x700B,0x6FFA,0x7011,0x7001,0x700F, +0x6FFE,0x701B,0x701A,0x6F74,0x701D,0x7018,0x701F,0x7030, +0x703E,0x7032,0x7051,0x7063,0x7099,0x7092,0x70AF,0x70F1, +0x70AC,0x70B8,0x70B3,0x70AE,0x70DF,0x70CB,0x70DD, 0, +0x70D9,0x7109,0x70FD,0x711C,0x7119,0x7165,0x7155,0x7188, +0x7166,0x7162,0x714C,0x7156,0x716C,0x718F,0x71FB,0x7184, +0x7195,0x71A8,0x71AC,0x71D7,0x71B9,0x71BE,0x71D2,0x71C9, +0x71D4,0x71CE,0x71E0,0x71EC,0x71E7,0x71F5,0x71FC,0x71F9, +0x71FF,0x720D,0x7210,0x721B,0x7228,0x722D,0x722C,0x7230, +0x7232,0x723B,0x723C,0x723F,0x7240,0x7246,0x724B,0x7258, +0x7274,0x727E,0x7282,0x7281,0x7287,0x7292,0x7296,0x72A2, +0x72A7,0x72B9,0x72B2,0x72C3,0x72C6,0x72C4,0x72CE,0x72D2, +0x72E2,0x72E0,0x72E1,0x72F9,0x72F7,0x500F,0x7317,0x730A, +0x731C,0x7316,0x731D,0x7334,0x732F,0x7329,0x7325,0x733E, +0x734E,0x734F,0x9ED8,0x7357,0x736A,0x7368,0x7370,0x7378, +0x7375,0x737B,0x737A,0x73C8,0x73B3,0x73CE,0x73BB,0x73C0, +0x73E5,0x73EE,0x73DE,0x74A2,0x7405,0x746F,0x7425,0x73F8, +0x7432,0x743A,0x7455,0x743F,0x745F,0x7459,0x7441,0x745C, +0x7469,0x7470,0x7463,0x746A,0x7476,0x747E,0x748B,0x749E, +0x74A7,0x74CA,0x74CF,0x74D4,0x73F1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x74E0,0x74E3,0x74E7,0x74E9,0x74EE,0x74F2,0x74F0,0x74F1, +0x74F8,0x74F7,0x7504,0x7503,0x7505,0x750C,0x750E,0x750D, +0x7515,0x7513,0x751E,0x7526,0x752C,0x753C,0x7544,0x754D, +0x754A,0x7549,0x755B,0x7546,0x755A,0x7569,0x7564,0x7567, +0x756B,0x756D,0x7578,0x7576,0x7586,0x7587,0x7574,0x758A, +0x7589,0x7582,0x7594,0x759A,0x759D,0x75A5,0x75A3,0x75C2, +0x75B3,0x75C3,0x75B5,0x75BD,0x75B8,0x75BC,0x75B1,0x75CD, +0x75CA,0x75D2,0x75D9,0x75E3,0x75DE,0x75FE,0x75FF, 0, +0x75FC,0x7601,0x75F0,0x75FA,0x75F2,0x75F3,0x760B,0x760D, +0x7609,0x761F,0x7627,0x7620,0x7621,0x7622,0x7624,0x7634, +0x7630,0x763B,0x7647,0x7648,0x7646,0x765C,0x7658,0x7661, +0x7662,0x7668,0x7669,0x766A,0x7667,0x766C,0x7670,0x7672, +0x7676,0x7678,0x767C,0x7680,0x7683,0x7688,0x768B,0x768E, +0x7696,0x7693,0x7699,0x769A,0x76B0,0x76B4,0x76B8,0x76B9, +0x76BA,0x76C2,0x76CD,0x76D6,0x76D2,0x76DE,0x76E1,0x76E5, +0x76E7,0x76EA,0x862F,0x76FB,0x7708,0x7707,0x7704,0x7729, +0x7724,0x771E,0x7725,0x7726,0x771B,0x7737,0x7738,0x7747, +0x775A,0x7768,0x776B,0x775B,0x7765,0x777F,0x777E,0x7779, +0x778E,0x778B,0x7791,0x77A0,0x779E,0x77B0,0x77B6,0x77B9, +0x77BF,0x77BC,0x77BD,0x77BB,0x77C7,0x77CD,0x77D7,0x77DA, +0x77DC,0x77E3,0x77EE,0x77FC,0x780C,0x7812,0x7926,0x7820, +0x792A,0x7845,0x788E,0x7874,0x7886,0x787C,0x789A,0x788C, +0x78A3,0x78B5,0x78AA,0x78AF,0x78D1,0x78C6,0x78CB,0x78D4, +0x78BE,0x78BC,0x78C5,0x78CA,0x78EC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x78E7,0x78DA,0x78FD,0x78F4,0x7907,0x7912,0x7911,0x7919, +0x792C,0x792B,0x7940,0x7960,0x7957,0x795F,0x795A,0x7955, +0x7953,0x797A,0x797F,0x798A,0x799D,0x79A7,0x9F4B,0x79AA, +0x79AE,0x79B3,0x79B9,0x79BA,0x79C9,0x79D5,0x79E7,0x79EC, +0x79E1,0x79E3,0x7A08,0x7A0D,0x7A18,0x7A19,0x7A20,0x7A1F, +0x7980,0x7A31,0x7A3B,0x7A3E,0x7A37,0x7A43,0x7A57,0x7A49, +0x7A61,0x7A62,0x7A69,0x9F9D,0x7A70,0x7A79,0x7A7D,0x7A88, +0x7A97,0x7A95,0x7A98,0x7A96,0x7AA9,0x7AC8,0x7AB0, 0, +0x7AB6,0x7AC5,0x7AC4,0x7ABF,0x9083,0x7AC7,0x7ACA,0x7ACD, +0x7ACF,0x7AD5,0x7AD3,0x7AD9,0x7ADA,0x7ADD,0x7AE1,0x7AE2, +0x7AE6,0x7AED,0x7AF0,0x7B02,0x7B0F,0x7B0A,0x7B06,0x7B33, +0x7B18,0x7B19,0x7B1E,0x7B35,0x7B28,0x7B36,0x7B50,0x7B7A, +0x7B04,0x7B4D,0x7B0B,0x7B4C,0x7B45,0x7B75,0x7B65,0x7B74, +0x7B67,0x7B70,0x7B71,0x7B6C,0x7B6E,0x7B9D,0x7B98,0x7B9F, +0x7B8D,0x7B9C,0x7B9A,0x7B8B,0x7B92,0x7B8F,0x7B5D,0x7B99, +0x7BCB,0x7BC1,0x7BCC,0x7BCF,0x7BB4,0x7BC6,0x7BDD,0x7BE9, +0x7C11,0x7C14,0x7BE6,0x7BE5,0x7C60,0x7C00,0x7C07,0x7C13, +0x7BF3,0x7BF7,0x7C17,0x7C0D,0x7BF6,0x7C23,0x7C27,0x7C2A, +0x7C1F,0x7C37,0x7C2B,0x7C3D,0x7C4C,0x7C43,0x7C54,0x7C4F, +0x7C40,0x7C50,0x7C58,0x7C5F,0x7C64,0x7C56,0x7C65,0x7C6C, +0x7C75,0x7C83,0x7C90,0x7CA4,0x7CAD,0x7CA2,0x7CAB,0x7CA1, +0x7CA8,0x7CB3,0x7CB2,0x7CB1,0x7CAE,0x7CB9,0x7CBD,0x7CC0, +0x7CC5,0x7CC2,0x7CD8,0x7CD2,0x7CDC,0x7CE2,0x9B3B,0x7CEF, +0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7D02,0x7D1C,0x7D15,0x7D0A,0x7D45,0x7D4B,0x7D2E,0x7D32, +0x7D3F,0x7D35,0x7D46,0x7D73,0x7D56,0x7D4E,0x7D72,0x7D68, +0x7D6E,0x7D4F,0x7D63,0x7D93,0x7D89,0x7D5B,0x7D8F,0x7D7D, +0x7D9B,0x7DBA,0x7DAE,0x7DA3,0x7DB5,0x7DC7,0x7DBD,0x7DAB, +0x7E3D,0x7DA2,0x7DAF,0x7DDC,0x7DB8,0x7D9F,0x7DB0,0x7DD8, +0x7DDD,0x7DE4,0x7DDE,0x7DFB,0x7DF2,0x7DE1,0x7E05,0x7E0A, +0x7E23,0x7E21,0x7E12,0x7E31,0x7E1F,0x7E09,0x7E0B,0x7E22, +0x7E46,0x7E66,0x7E3B,0x7E35,0x7E39,0x7E43,0x7E37, 0, +0x7E32,0x7E3A,0x7E67,0x7E5D,0x7E56,0x7E5E,0x7E59,0x7E5A, +0x7E79,0x7E6A,0x7E69,0x7E7C,0x7E7B,0x7E83,0x7DD5,0x7E7D, +0x8FAE,0x7E7F,0x7E88,0x7E89,0x7E8C,0x7E92,0x7E90,0x7E93, +0x7E94,0x7E96,0x7E8E,0x7E9B,0x7E9C,0x7F38,0x7F3A,0x7F45, +0x7F4C,0x7F4D,0x7F4E,0x7F50,0x7F51,0x7F55,0x7F54,0x7F58, +0x7F5F,0x7F60,0x7F68,0x7F69,0x7F67,0x7F78,0x7F82,0x7F86, +0x7F83,0x7F88,0x7F87,0x7F8C,0x7F94,0x7F9E,0x7F9D,0x7F9A, +0x7FA3,0x7FAF,0x7FB2,0x7FB9,0x7FAE,0x7FB6,0x7FB8,0x8B71, +0x7FC5,0x7FC6,0x7FCA,0x7FD5,0x7FD4,0x7FE1,0x7FE6,0x7FE9, +0x7FF3,0x7FF9,0x98DC,0x8006,0x8004,0x800B,0x8012,0x8018, +0x8019,0x801C,0x8021,0x8028,0x803F,0x803B,0x804A,0x8046, +0x8052,0x8058,0x805A,0x805F,0x8062,0x8068,0x8073,0x8072, +0x8070,0x8076,0x8079,0x807D,0x807F,0x8084,0x8086,0x8085, +0x809B,0x8093,0x809A,0x80AD,0x5190,0x80AC,0x80DB,0x80E5, +0x80D9,0x80DD,0x80C4,0x80DA,0x80D6,0x8109,0x80EF,0x80F1, +0x811B,0x8129,0x8123,0x812F,0x814B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x968B,0x8146,0x813E,0x8153,0x8151,0x80FC,0x8171,0x816E, +0x8165,0x8166,0x8174,0x8183,0x8188,0x818A,0x8180,0x8182, +0x81A0,0x8195,0x81A4,0x81A3,0x815F,0x8193,0x81A9,0x81B0, +0x81B5,0x81BE,0x81B8,0x81BD,0x81C0,0x81C2,0x81BA,0x81C9, +0x81CD,0x81D1,0x81D9,0x81D8,0x81C8,0x81DA,0x81DF,0x81E0, +0x81E7,0x81FA,0x81FB,0x81FE,0x8201,0x8202,0x8205,0x8207, +0x820A,0x820D,0x8210,0x8216,0x8229,0x822B,0x8238,0x8233, +0x8240,0x8259,0x8258,0x825D,0x825A,0x825F,0x8264, 0, +0x8262,0x8268,0x826A,0x826B,0x822E,0x8271,0x8277,0x8278, +0x827E,0x828D,0x8292,0x82AB,0x829F,0x82BB,0x82AC,0x82E1, +0x82E3,0x82DF,0x82D2,0x82F4,0x82F3,0x82FA,0x8393,0x8303, +0x82FB,0x82F9,0x82DE,0x8306,0x82DC,0x8309,0x82D9,0x8335, +0x8334,0x8316,0x8332,0x8331,0x8340,0x8339,0x8350,0x8345, +0x832F,0x832B,0x8317,0x8318,0x8385,0x839A,0x83AA,0x839F, +0x83A2,0x8396,0x8323,0x838E,0x8387,0x838A,0x837C,0x83B5, +0x8373,0x8375,0x83A0,0x8389,0x83A8,0x83F4,0x8413,0x83EB, +0x83CE,0x83FD,0x8403,0x83D8,0x840B,0x83C1,0x83F7,0x8407, +0x83E0,0x83F2,0x840D,0x8422,0x8420,0x83BD,0x8438,0x8506, +0x83FB,0x846D,0x842A,0x843C,0x855A,0x8484,0x8477,0x846B, +0x84AD,0x846E,0x8482,0x8469,0x8446,0x842C,0x846F,0x8479, +0x8435,0x84CA,0x8462,0x84B9,0x84BF,0x849F,0x84D9,0x84CD, +0x84BB,0x84DA,0x84D0,0x84C1,0x84C6,0x84D6,0x84A1,0x8521, +0x84FF,0x84F4,0x8517,0x8518,0x852C,0x851F,0x8515,0x8514, +0x84FC,0x8540,0x8563,0x8558,0x8548, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8541,0x8602,0x854B,0x8555,0x8580,0x85A4,0x8588,0x8591, +0x858A,0x85A8,0x856D,0x8594,0x859B,0x85EA,0x8587,0x859C, +0x8577,0x857E,0x8590,0x85C9,0x85BA,0x85CF,0x85B9,0x85D0, +0x85D5,0x85DD,0x85E5,0x85DC,0x85F9,0x860A,0x8613,0x860B, +0x85FE,0x85FA,0x8606,0x8622,0x861A,0x8630,0x863F,0x864D, +0x4E55,0x8654,0x865F,0x8667,0x8671,0x8693,0x86A3,0x86A9, +0x86AA,0x868B,0x868C,0x86B6,0x86AF,0x86C4,0x86C6,0x86B0, +0x86C9,0x8823,0x86AB,0x86D4,0x86DE,0x86E9,0x86EC, 0, +0x86DF,0x86DB,0x86EF,0x8712,0x8706,0x8708,0x8700,0x8703, +0x86FB,0x8711,0x8709,0x870D,0x86F9,0x870A,0x8734,0x873F, +0x8737,0x873B,0x8725,0x8729,0x871A,0x8760,0x875F,0x8778, +0x874C,0x874E,0x8774,0x8757,0x8768,0x876E,0x8759,0x8753, +0x8763,0x876A,0x8805,0x87A2,0x879F,0x8782,0x87AF,0x87CB, +0x87BD,0x87C0,0x87D0,0x96D6,0x87AB,0x87C4,0x87B3,0x87C7, +0x87C6,0x87BB,0x87EF,0x87F2,0x87E0,0x880F,0x880D,0x87FE, +0x87F6,0x87F7,0x880E,0x87D2,0x8811,0x8816,0x8815,0x8822, +0x8821,0x8831,0x8836,0x8839,0x8827,0x883B,0x8844,0x8842, +0x8852,0x8859,0x885E,0x8862,0x886B,0x8881,0x887E,0x889E, +0x8875,0x887D,0x88B5,0x8872,0x8882,0x8897,0x8892,0x88AE, +0x8899,0x88A2,0x888D,0x88A4,0x88B0,0x88BF,0x88B1,0x88C3, +0x88C4,0x88D4,0x88D8,0x88D9,0x88DD,0x88F9,0x8902,0x88FC, +0x88F4,0x88E8,0x88F2,0x8904,0x890C,0x890A,0x8913,0x8943, +0x891E,0x8925,0x892A,0x892B,0x8941,0x8944,0x893B,0x8936, +0x8938,0x894C,0x891D,0x8960,0x895E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8966,0x8964,0x896D,0x896A,0x896F,0x8974,0x8977,0x897E, +0x8983,0x8988,0x898A,0x8993,0x8998,0x89A1,0x89A9,0x89A6, +0x89AC,0x89AF,0x89B2,0x89BA,0x89BD,0x89BF,0x89C0,0x89DA, +0x89DC,0x89DD,0x89E7,0x89F4,0x89F8,0x8A03,0x8A16,0x8A10, +0x8A0C,0x8A1B,0x8A1D,0x8A25,0x8A36,0x8A41,0x8A5B,0x8A52, +0x8A46,0x8A48,0x8A7C,0x8A6D,0x8A6C,0x8A62,0x8A85,0x8A82, +0x8A84,0x8AA8,0x8AA1,0x8A91,0x8AA5,0x8AA6,0x8A9A,0x8AA3, +0x8AC4,0x8ACD,0x8AC2,0x8ADA,0x8AEB,0x8AF3,0x8AE7, 0, +0x8AE4,0x8AF1,0x8B14,0x8AE0,0x8AE2,0x8AF7,0x8ADE,0x8ADB, +0x8B0C,0x8B07,0x8B1A,0x8AE1,0x8B16,0x8B10,0x8B17,0x8B20, +0x8B33,0x97AB,0x8B26,0x8B2B,0x8B3E,0x8B28,0x8B41,0x8B4C, +0x8B4F,0x8B4E,0x8B49,0x8B56,0x8B5B,0x8B5A,0x8B6B,0x8B5F, +0x8B6C,0x8B6F,0x8B74,0x8B7D,0x8B80,0x8B8C,0x8B8E,0x8B92, +0x8B93,0x8B96,0x8B99,0x8B9A,0x8C3A,0x8C41,0x8C3F,0x8C48, +0x8C4C,0x8C4E,0x8C50,0x8C55,0x8C62,0x8C6C,0x8C78,0x8C7A, +0x8C82,0x8C89,0x8C85,0x8C8A,0x8C8D,0x8C8E,0x8C94,0x8C7C, +0x8C98,0x621D,0x8CAD,0x8CAA,0x8CBD,0x8CB2,0x8CB3,0x8CAE, +0x8CB6,0x8CC8,0x8CC1,0x8CE4,0x8CE3,0x8CDA,0x8CFD,0x8CFA, +0x8CFB,0x8D04,0x8D05,0x8D0A,0x8D07,0x8D0F,0x8D0D,0x8D10, +0x9F4E,0x8D13,0x8CCD,0x8D14,0x8D16,0x8D67,0x8D6D,0x8D71, +0x8D73,0x8D81,0x8D99,0x8DC2,0x8DBE,0x8DBA,0x8DCF,0x8DDA, +0x8DD6,0x8DCC,0x8DDB,0x8DCB,0x8DEA,0x8DEB,0x8DDF,0x8DE3, +0x8DFC,0x8E08,0x8E09,0x8DFF,0x8E1D,0x8E1E,0x8E10,0x8E1F, +0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E47,0x8E49,0x8E4C,0x8E50,0x8E48,0x8E59,0x8E64,0x8E60, +0x8E2A,0x8E63,0x8E55,0x8E76,0x8E72,0x8E7C,0x8E81,0x8E87, +0x8E85,0x8E84,0x8E8B,0x8E8A,0x8E93,0x8E91,0x8E94,0x8E99, +0x8EAA,0x8EA1,0x8EAC,0x8EB0,0x8EC6,0x8EB1,0x8EBE,0x8EC5, +0x8EC8,0x8ECB,0x8EDB,0x8EE3,0x8EFC,0x8EFB,0x8EEB,0x8EFE, +0x8F0A,0x8F05,0x8F15,0x8F12,0x8F19,0x8F13,0x8F1C,0x8F1F, +0x8F1B,0x8F0C,0x8F26,0x8F33,0x8F3B,0x8F39,0x8F45,0x8F42, +0x8F3E,0x8F4C,0x8F49,0x8F46,0x8F4E,0x8F57,0x8F5C, 0, +0x8F62,0x8F63,0x8F64,0x8F9C,0x8F9F,0x8FA3,0x8FAD,0x8FAF, +0x8FB7,0x8FDA,0x8FE5,0x8FE2,0x8FEA,0x8FEF,0x9087,0x8FF4, +0x9005,0x8FF9,0x8FFA,0x9011,0x9015,0x9021,0x900D,0x901E, +0x9016,0x900B,0x9027,0x9036,0x9035,0x9039,0x8FF8,0x904F, +0x9050,0x9051,0x9052,0x900E,0x9049,0x903E,0x9056,0x9058, +0x905E,0x9068,0x906F,0x9076,0x96A8,0x9072,0x9082,0x907D, +0x9081,0x9080,0x908A,0x9089,0x908F,0x90A8,0x90AF,0x90B1, +0x90B5,0x90E2,0x90E4,0x6248,0x90DB,0x9102,0x9112,0x9119, +0x9132,0x9130,0x914A,0x9156,0x9158,0x9163,0x9165,0x9169, +0x9173,0x9172,0x918B,0x9189,0x9182,0x91A2,0x91AB,0x91AF, +0x91AA,0x91B5,0x91B4,0x91BA,0x91C0,0x91C1,0x91C9,0x91CB, +0x91D0,0x91D6,0x91DF,0x91E1,0x91DB,0x91FC,0x91F5,0x91F6, +0x921E,0x91FF,0x9214,0x922C,0x9215,0x9211,0x925E,0x9257, +0x9245,0x9249,0x9264,0x9248,0x9295,0x923F,0x924B,0x9250, +0x929C,0x9296,0x9293,0x929B,0x925A,0x92CF,0x92B9,0x92B7, +0x92E9,0x930F,0x92FA,0x9344,0x932E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9319,0x9322,0x931A,0x9323,0x933A,0x9335,0x933B,0x935C, +0x9360,0x937C,0x936E,0x9356,0x93B0,0x93AC,0x93AD,0x9394, +0x93B9,0x93D6,0x93D7,0x93E8,0x93E5,0x93D8,0x93C3,0x93DD, +0x93D0,0x93C8,0x93E4,0x941A,0x9414,0x9413,0x9403,0x9407, +0x9410,0x9436,0x942B,0x9435,0x9421,0x943A,0x9441,0x9452, +0x9444,0x945B,0x9460,0x9462,0x945E,0x946A,0x9229,0x9470, +0x9475,0x9477,0x947D,0x945A,0x947C,0x947E,0x9481,0x947F, +0x9582,0x9587,0x958A,0x9594,0x9596,0x9598,0x9599, 0, +0x95A0,0x95A8,0x95A7,0x95AD,0x95BC,0x95BB,0x95B9,0x95BE, +0x95CA,0x6FF6,0x95C3,0x95CD,0x95CC,0x95D5,0x95D4,0x95D6, +0x95DC,0x95E1,0x95E5,0x95E2,0x9621,0x9628,0x962E,0x962F, +0x9642,0x964C,0x964F,0x964B,0x9677,0x965C,0x965E,0x965D, +0x965F,0x9666,0x9672,0x966C,0x968D,0x9698,0x9695,0x9697, +0x96AA,0x96A7,0x96B1,0x96B2,0x96B0,0x96B4,0x96B6,0x96B8, +0x96B9,0x96CE,0x96CB,0x96C9,0x96CD,0x894D,0x96DC,0x970D, +0x96D5,0x96F9,0x9704,0x9706,0x9708,0x9713,0x970E,0x9711, +0x970F,0x9716,0x9719,0x9724,0x972A,0x9730,0x9739,0x973D, +0x973E,0x9744,0x9746,0x9748,0x9742,0x9749,0x975C,0x9760, +0x9764,0x9766,0x9768,0x52D2,0x976B,0x9771,0x9779,0x9785, +0x977C,0x9781,0x977A,0x9786,0x978B,0x978F,0x9790,0x979C, +0x97A8,0x97A6,0x97A3,0x97B3,0x97B4,0x97C3,0x97C6,0x97C8, +0x97CB,0x97DC,0x97ED,0x9F4F,0x97F2,0x7ADF,0x97F6,0x97F5, +0x980F,0x980C,0x9838,0x9824,0x9821,0x9837,0x983D,0x9846, +0x984F,0x984B,0x986B,0x986F,0x9870, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9871,0x9874,0x9873,0x98AA,0x98AF,0x98B1,0x98B6,0x98C4, +0x98C3,0x98C6,0x98E9,0x98EB,0x9903,0x9909,0x9912,0x9914, +0x9918,0x9921,0x991D,0x991E,0x9924,0x9920,0x992C,0x992E, +0x993D,0x993E,0x9942,0x9949,0x9945,0x9950,0x994B,0x9951, +0x9952,0x994C,0x9955,0x9997,0x9998,0x99A5,0x99AD,0x99AE, +0x99BC,0x99DF,0x99DB,0x99DD,0x99D8,0x99D1,0x99ED,0x99EE, +0x99F1,0x99F2,0x99FB,0x99F8,0x9A01,0x9A0F,0x9A05,0x99E2, +0x9A19,0x9A2B,0x9A37,0x9A45,0x9A42,0x9A40,0x9A43, 0, +0x9A3E,0x9A55,0x9A4D,0x9A5B,0x9A57,0x9A5F,0x9A62,0x9A65, +0x9A64,0x9A69,0x9A6B,0x9A6A,0x9AAD,0x9AB0,0x9ABC,0x9AC0, +0x9ACF,0x9AD1,0x9AD3,0x9AD4,0x9ADE,0x9ADF,0x9AE2,0x9AE3, +0x9AE6,0x9AEF,0x9AEB,0x9AEE,0x9AF4,0x9AF1,0x9AF7,0x9AFB, +0x9B06,0x9B18,0x9B1A,0x9B1F,0x9B22,0x9B23,0x9B25,0x9B27, +0x9B28,0x9B29,0x9B2A,0x9B2E,0x9B2F,0x9B32,0x9B44,0x9B43, +0x9B4F,0x9B4D,0x9B4E,0x9B51,0x9B58,0x9B74,0x9B93,0x9B83, +0x9B91,0x9B96,0x9B97,0x9B9F,0x9BA0,0x9BA8,0x9BB4,0x9BC0, +0x9BCA,0x9BB9,0x9BC6,0x9BCF,0x9BD1,0x9BD2,0x9BE3,0x9BE2, +0x9BE4,0x9BD4,0x9BE1,0x9C3A,0x9BF2,0x9BF1,0x9BF0,0x9C15, +0x9C14,0x9C09,0x9C13,0x9C0C,0x9C06,0x9C08,0x9C12,0x9C0A, +0x9C04,0x9C2E,0x9C1B,0x9C25,0x9C24,0x9C21,0x9C30,0x9C47, +0x9C32,0x9C46,0x9C3E,0x9C5A,0x9C60,0x9C67,0x9C76,0x9C78, +0x9CE7,0x9CEC,0x9CF0,0x9D09,0x9D08,0x9CEB,0x9D03,0x9D06, +0x9D2A,0x9D26,0x9DAF,0x9D23,0x9D1F,0x9D44,0x9D15,0x9D12, +0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9D5D,0x9D5E,0x9D64,0x9D51,0x9D50,0x9D59,0x9D72,0x9D89, +0x9D87,0x9DAB,0x9D6F,0x9D7A,0x9D9A,0x9DA4,0x9DA9,0x9DB2, +0x9DC4,0x9DC1,0x9DBB,0x9DB8,0x9DBA,0x9DC6,0x9DCF,0x9DC2, +0x9DD9,0x9DD3,0x9DF8,0x9DE6,0x9DED,0x9DEF,0x9DFD,0x9E1A, +0x9E1B,0x9E1E,0x9E75,0x9E79,0x9E7D,0x9E81,0x9E88,0x9E8B, +0x9E8C,0x9E92,0x9E95,0x9E91,0x9E9D,0x9EA5,0x9EA9,0x9EB8, +0x9EAA,0x9EAD,0x9761,0x9ECC,0x9ECE,0x9ECF,0x9ED0,0x9ED4, +0x9EDC,0x9EDE,0x9EDD,0x9EE0,0x9EE5,0x9EE8,0x9EEF, 0, +0x9EF4,0x9EF6,0x9EF7,0x9EF9,0x9EFB,0x9EFC,0x9EFD,0x9F07, +0x9F08,0x76B7,0x9F15,0x9F21,0x9F2C,0x9F3E,0x9F4A,0x9F52, +0x9F54,0x9F63,0x9F5F,0x9F60,0x9F61,0x9F66,0x9F67,0x9F6C, +0x9F6A,0x9F77,0x9F72,0x9F76,0x9F95,0x9F9C,0x9FA0,0x582F, +0x69C7,0x9059,0x7464,0x51DC,0x7199}; + +/* page 5 0xED40-0xEEFC - +IBM Selected Kanji and Non-Kanji(NEC implementation) */ +static uint16 tab_cp932_uni5[]={ +0x7E8A,0x891C,0x9348,0x9288,0x84DC,0x4FC9,0x70BB,0x6631, +0x68C8,0x92F9,0x66FB,0x5F45,0x4E28,0x4EE1,0x4EFC,0x4F00, +0x4F03,0x4F39,0x4F56,0x4F92,0x4F8A,0x4F9A,0x4F94,0x4FCD, +0x5040,0x5022,0x4FFF,0x501E,0x5046,0x5070,0x5042,0x5094, +0x50F4,0x50D8,0x514A,0x5164,0x519D,0x51BE,0x51EC,0x5215, +0x529C,0x52A6,0x52C0,0x52DB,0x5300,0x5307,0x5324,0x5372, +0x5393,0x53B2,0x53DD,0xFA0E,0x549C,0x548A,0x54A9,0x54FF, +0x5586,0x5759,0x5765,0x57AC,0x57C8,0x57C7,0xFA0F, 0, +0xFA10,0x589E,0x58B2,0x590B,0x5953,0x595B,0x595D,0x5963, +0x59A4,0x59BA,0x5B56,0x5BC0,0x752F,0x5BD8,0x5BEC,0x5C1E, +0x5CA6,0x5CBA,0x5CF5,0x5D27,0x5D53,0xFA11,0x5D42,0x5D6D, +0x5DB8,0x5DB9,0x5DD0,0x5F21,0x5F34,0x5F67,0x5FB7,0x5FDE, +0x605D,0x6085,0x608A,0x60DE,0x60D5,0x6120,0x60F2,0x6111, +0x6137,0x6130,0x6198,0x6213,0x62A6,0x63F5,0x6460,0x649D, +0x64CE,0x654E,0x6600,0x6615,0x663B,0x6609,0x662E,0x661E, +0x6624,0x6665,0x6657,0x6659,0xFA12,0x6673,0x6699,0x66A0, +0x66B2,0x66BF,0x66FA,0x670E,0xF929,0x6766,0x67BB,0x6852, +0x67C0,0x6801,0x6844,0x68CF,0xFA13,0x6968,0xFA14,0x6998, +0x69E2,0x6A30,0x6A6B,0x6A46,0x6A73,0x6A7E,0x6AE2,0x6AE4, +0x6BD6,0x6C3F,0x6C5C,0x6C86,0x6C6F,0x6CDA,0x6D04,0x6D87, +0x6D6F,0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,0x6E39, +0x6E5C,0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,0x7005, +0x7007,0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,0x7146, +0x7147,0xFA15,0x71C1,0x71FE,0x72B1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x72BE,0x7324,0xFA16,0x7377,0x73BD,0x73C9,0x73D6,0x73E3, +0x73D2,0x7407,0x73F5,0x7426,0x742A,0x7429,0x742E,0x7462, +0x7489,0x749F,0x7501,0x756F,0x7682,0x769C,0x769E,0x769B, +0x76A6,0xFA17,0x7746,0x52AF,0x7821,0x784E,0x7864,0x787A, +0x7930,0xFA18,0xFA19,0xFA1A,0x7994,0xFA1B,0x799B,0x7AD1, +0x7AE7,0xFA1C,0x7AEB,0x7B9E,0xFA1D,0x7D48,0x7D5C,0x7DB7, +0x7DA0,0x7DD6,0x7E52,0x7F47,0x7FA1,0xFA1E,0x8301,0x8362, +0x837F,0x83C7,0x83F6,0x8448,0x84B4,0x8553,0x8559, 0, +0x856B,0xFA1F,0x85B0,0xFA20,0xFA21,0x8807,0x88F5,0x8A12, +0x8A37,0x8A79,0x8AA7,0x8ABE,0x8ADF,0xFA22,0x8AF6,0x8B53, +0x8B7F,0x8CF0,0x8CF4,0x8D12,0x8D76,0xFA23,0x8ECF,0xFA24, +0xFA25,0x9067,0x90DE,0xFA26,0x9115,0x9127,0x91DA,0x91D7, +0x91DE,0x91ED,0x91EE,0x91E4,0x91E5,0x9206,0x9210,0x920A, +0x923A,0x9240,0x923C,0x924E,0x9259,0x9251,0x9239,0x9267, +0x92A7,0x9277,0x9278,0x92E7,0x92D7,0x92D9,0x92D0,0xFA27, +0x92D5,0x92E0,0x92D3,0x9325,0x9321,0x92FB,0xFA28,0x931E, +0x92FF,0x931D,0x9302,0x9370,0x9357,0x93A4,0x93C6,0x93DE, +0x93F8,0x9431,0x9445,0x9448,0x9592,0xF9DC,0xFA29,0x969D, +0x96AF,0x9733,0x973B,0x9743,0x974D,0x974F,0x9751,0x9755, +0x9857,0x9865,0xFA2A,0xFA2B,0x9927,0xFA2C,0x999E,0x9A4E, +0x9AD9,0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,0x9C00, +0x9D70,0x9D6B,0xFA2D,0x9E19,0x9ED1, 0, 0,0x2170, +0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177,0x2178, +0x2179,0xFFE2,0xFFE4,0xFF07,0xFF02}; + +/* page 6 0xF040-0xF9FC - User defined characters */ +static uint16 tab_cp932_uni6[]={ +0xE000,0xE001,0xE002,0xE003,0xE004,0xE005,0xE006,0xE007, +0xE008,0xE009,0xE00A,0xE00B,0xE00C,0xE00D,0xE00E,0xE00F, +0xE010,0xE011,0xE012,0xE013,0xE014,0xE015,0xE016,0xE017, +0xE018,0xE019,0xE01A,0xE01B,0xE01C,0xE01D,0xE01E,0xE01F, +0xE020,0xE021,0xE022,0xE023,0xE024,0xE025,0xE026,0xE027, +0xE028,0xE029,0xE02A,0xE02B,0xE02C,0xE02D,0xE02E,0xE02F, +0xE030,0xE031,0xE032,0xE033,0xE034,0xE035,0xE036,0xE037, +0xE038,0xE039,0xE03A,0xE03B,0xE03C,0xE03D,0xE03E, 0, +0xE03F,0xE040,0xE041,0xE042,0xE043,0xE044,0xE045,0xE046, +0xE047,0xE048,0xE049,0xE04A,0xE04B,0xE04C,0xE04D,0xE04E, +0xE04F,0xE050,0xE051,0xE052,0xE053,0xE054,0xE055,0xE056, +0xE057,0xE058,0xE059,0xE05A,0xE05B,0xE05C,0xE05D,0xE05E, +0xE05F,0xE060,0xE061,0xE062,0xE063,0xE064,0xE065,0xE066, +0xE067,0xE068,0xE069,0xE06A,0xE06B,0xE06C,0xE06D,0xE06E, +0xE06F,0xE070,0xE071,0xE072,0xE073,0xE074,0xE075,0xE076, +0xE077,0xE078,0xE079,0xE07A,0xE07B,0xE07C,0xE07D,0xE07E, +0xE07F,0xE080,0xE081,0xE082,0xE083,0xE084,0xE085,0xE086, +0xE087,0xE088,0xE089,0xE08A,0xE08B,0xE08C,0xE08D,0xE08E, +0xE08F,0xE090,0xE091,0xE092,0xE093,0xE094,0xE095,0xE096, +0xE097,0xE098,0xE099,0xE09A,0xE09B,0xE09C,0xE09D,0xE09E, +0xE09F,0xE0A0,0xE0A1,0xE0A2,0xE0A3,0xE0A4,0xE0A5,0xE0A6, +0xE0A7,0xE0A8,0xE0A9,0xE0AA,0xE0AB,0xE0AC,0xE0AD,0xE0AE, +0xE0AF,0xE0B0,0xE0B1,0xE0B2,0xE0B3,0xE0B4,0xE0B5,0xE0B6, +0xE0B7,0xE0B8,0xE0B9,0xE0BA,0xE0BB, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE0BC,0xE0BD,0xE0BE,0xE0BF,0xE0C0,0xE0C1,0xE0C2,0xE0C3, +0xE0C4,0xE0C5,0xE0C6,0xE0C7,0xE0C8,0xE0C9,0xE0CA,0xE0CB, +0xE0CC,0xE0CD,0xE0CE,0xE0CF,0xE0D0,0xE0D1,0xE0D2,0xE0D3, +0xE0D4,0xE0D5,0xE0D6,0xE0D7,0xE0D8,0xE0D9,0xE0DA,0xE0DB, +0xE0DC,0xE0DD,0xE0DE,0xE0DF,0xE0E0,0xE0E1,0xE0E2,0xE0E3, +0xE0E4,0xE0E5,0xE0E6,0xE0E7,0xE0E8,0xE0E9,0xE0EA,0xE0EB, +0xE0EC,0xE0ED,0xE0EE,0xE0EF,0xE0F0,0xE0F1,0xE0F2,0xE0F3, +0xE0F4,0xE0F5,0xE0F6,0xE0F7,0xE0F8,0xE0F9,0xE0FA, 0, +0xE0FB,0xE0FC,0xE0FD,0xE0FE,0xE0FF,0xE100,0xE101,0xE102, +0xE103,0xE104,0xE105,0xE106,0xE107,0xE108,0xE109,0xE10A, +0xE10B,0xE10C,0xE10D,0xE10E,0xE10F,0xE110,0xE111,0xE112, +0xE113,0xE114,0xE115,0xE116,0xE117,0xE118,0xE119,0xE11A, +0xE11B,0xE11C,0xE11D,0xE11E,0xE11F,0xE120,0xE121,0xE122, +0xE123,0xE124,0xE125,0xE126,0xE127,0xE128,0xE129,0xE12A, +0xE12B,0xE12C,0xE12D,0xE12E,0xE12F,0xE130,0xE131,0xE132, +0xE133,0xE134,0xE135,0xE136,0xE137,0xE138,0xE139,0xE13A, +0xE13B,0xE13C,0xE13D,0xE13E,0xE13F,0xE140,0xE141,0xE142, +0xE143,0xE144,0xE145,0xE146,0xE147,0xE148,0xE149,0xE14A, +0xE14B,0xE14C,0xE14D,0xE14E,0xE14F,0xE150,0xE151,0xE152, +0xE153,0xE154,0xE155,0xE156,0xE157,0xE158,0xE159,0xE15A, +0xE15B,0xE15C,0xE15D,0xE15E,0xE15F,0xE160,0xE161,0xE162, +0xE163,0xE164,0xE165,0xE166,0xE167,0xE168,0xE169,0xE16A, +0xE16B,0xE16C,0xE16D,0xE16E,0xE16F,0xE170,0xE171,0xE172, +0xE173,0xE174,0xE175,0xE176,0xE177, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE178,0xE179,0xE17A,0xE17B,0xE17C,0xE17D,0xE17E,0xE17F, +0xE180,0xE181,0xE182,0xE183,0xE184,0xE185,0xE186,0xE187, +0xE188,0xE189,0xE18A,0xE18B,0xE18C,0xE18D,0xE18E,0xE18F, +0xE190,0xE191,0xE192,0xE193,0xE194,0xE195,0xE196,0xE197, +0xE198,0xE199,0xE19A,0xE19B,0xE19C,0xE19D,0xE19E,0xE19F, +0xE1A0,0xE1A1,0xE1A2,0xE1A3,0xE1A4,0xE1A5,0xE1A6,0xE1A7, +0xE1A8,0xE1A9,0xE1AA,0xE1AB,0xE1AC,0xE1AD,0xE1AE,0xE1AF, +0xE1B0,0xE1B1,0xE1B2,0xE1B3,0xE1B4,0xE1B5,0xE1B6, 0, +0xE1B7,0xE1B8,0xE1B9,0xE1BA,0xE1BB,0xE1BC,0xE1BD,0xE1BE, +0xE1BF,0xE1C0,0xE1C1,0xE1C2,0xE1C3,0xE1C4,0xE1C5,0xE1C6, +0xE1C7,0xE1C8,0xE1C9,0xE1CA,0xE1CB,0xE1CC,0xE1CD,0xE1CE, +0xE1CF,0xE1D0,0xE1D1,0xE1D2,0xE1D3,0xE1D4,0xE1D5,0xE1D6, +0xE1D7,0xE1D8,0xE1D9,0xE1DA,0xE1DB,0xE1DC,0xE1DD,0xE1DE, +0xE1DF,0xE1E0,0xE1E1,0xE1E2,0xE1E3,0xE1E4,0xE1E5,0xE1E6, +0xE1E7,0xE1E8,0xE1E9,0xE1EA,0xE1EB,0xE1EC,0xE1ED,0xE1EE, +0xE1EF,0xE1F0,0xE1F1,0xE1F2,0xE1F3,0xE1F4,0xE1F5,0xE1F6, +0xE1F7,0xE1F8,0xE1F9,0xE1FA,0xE1FB,0xE1FC,0xE1FD,0xE1FE, +0xE1FF,0xE200,0xE201,0xE202,0xE203,0xE204,0xE205,0xE206, +0xE207,0xE208,0xE209,0xE20A,0xE20B,0xE20C,0xE20D,0xE20E, +0xE20F,0xE210,0xE211,0xE212,0xE213,0xE214,0xE215,0xE216, +0xE217,0xE218,0xE219,0xE21A,0xE21B,0xE21C,0xE21D,0xE21E, +0xE21F,0xE220,0xE221,0xE222,0xE223,0xE224,0xE225,0xE226, +0xE227,0xE228,0xE229,0xE22A,0xE22B,0xE22C,0xE22D,0xE22E, +0xE22F,0xE230,0xE231,0xE232,0xE233, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE234,0xE235,0xE236,0xE237,0xE238,0xE239,0xE23A,0xE23B, +0xE23C,0xE23D,0xE23E,0xE23F,0xE240,0xE241,0xE242,0xE243, +0xE244,0xE245,0xE246,0xE247,0xE248,0xE249,0xE24A,0xE24B, +0xE24C,0xE24D,0xE24E,0xE24F,0xE250,0xE251,0xE252,0xE253, +0xE254,0xE255,0xE256,0xE257,0xE258,0xE259,0xE25A,0xE25B, +0xE25C,0xE25D,0xE25E,0xE25F,0xE260,0xE261,0xE262,0xE263, +0xE264,0xE265,0xE266,0xE267,0xE268,0xE269,0xE26A,0xE26B, +0xE26C,0xE26D,0xE26E,0xE26F,0xE270,0xE271,0xE272, 0, +0xE273,0xE274,0xE275,0xE276,0xE277,0xE278,0xE279,0xE27A, +0xE27B,0xE27C,0xE27D,0xE27E,0xE27F,0xE280,0xE281,0xE282, +0xE283,0xE284,0xE285,0xE286,0xE287,0xE288,0xE289,0xE28A, +0xE28B,0xE28C,0xE28D,0xE28E,0xE28F,0xE290,0xE291,0xE292, +0xE293,0xE294,0xE295,0xE296,0xE297,0xE298,0xE299,0xE29A, +0xE29B,0xE29C,0xE29D,0xE29E,0xE29F,0xE2A0,0xE2A1,0xE2A2, +0xE2A3,0xE2A4,0xE2A5,0xE2A6,0xE2A7,0xE2A8,0xE2A9,0xE2AA, +0xE2AB,0xE2AC,0xE2AD,0xE2AE,0xE2AF,0xE2B0,0xE2B1,0xE2B2, +0xE2B3,0xE2B4,0xE2B5,0xE2B6,0xE2B7,0xE2B8,0xE2B9,0xE2BA, +0xE2BB,0xE2BC,0xE2BD,0xE2BE,0xE2BF,0xE2C0,0xE2C1,0xE2C2, +0xE2C3,0xE2C4,0xE2C5,0xE2C6,0xE2C7,0xE2C8,0xE2C9,0xE2CA, +0xE2CB,0xE2CC,0xE2CD,0xE2CE,0xE2CF,0xE2D0,0xE2D1,0xE2D2, +0xE2D3,0xE2D4,0xE2D5,0xE2D6,0xE2D7,0xE2D8,0xE2D9,0xE2DA, +0xE2DB,0xE2DC,0xE2DD,0xE2DE,0xE2DF,0xE2E0,0xE2E1,0xE2E2, +0xE2E3,0xE2E4,0xE2E5,0xE2E6,0xE2E7,0xE2E8,0xE2E9,0xE2EA, +0xE2EB,0xE2EC,0xE2ED,0xE2EE,0xE2EF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE2F0,0xE2F1,0xE2F2,0xE2F3,0xE2F4,0xE2F5,0xE2F6,0xE2F7, +0xE2F8,0xE2F9,0xE2FA,0xE2FB,0xE2FC,0xE2FD,0xE2FE,0xE2FF, +0xE300,0xE301,0xE302,0xE303,0xE304,0xE305,0xE306,0xE307, +0xE308,0xE309,0xE30A,0xE30B,0xE30C,0xE30D,0xE30E,0xE30F, +0xE310,0xE311,0xE312,0xE313,0xE314,0xE315,0xE316,0xE317, +0xE318,0xE319,0xE31A,0xE31B,0xE31C,0xE31D,0xE31E,0xE31F, +0xE320,0xE321,0xE322,0xE323,0xE324,0xE325,0xE326,0xE327, +0xE328,0xE329,0xE32A,0xE32B,0xE32C,0xE32D,0xE32E, 0, +0xE32F,0xE330,0xE331,0xE332,0xE333,0xE334,0xE335,0xE336, +0xE337,0xE338,0xE339,0xE33A,0xE33B,0xE33C,0xE33D,0xE33E, +0xE33F,0xE340,0xE341,0xE342,0xE343,0xE344,0xE345,0xE346, +0xE347,0xE348,0xE349,0xE34A,0xE34B,0xE34C,0xE34D,0xE34E, +0xE34F,0xE350,0xE351,0xE352,0xE353,0xE354,0xE355,0xE356, +0xE357,0xE358,0xE359,0xE35A,0xE35B,0xE35C,0xE35D,0xE35E, +0xE35F,0xE360,0xE361,0xE362,0xE363,0xE364,0xE365,0xE366, +0xE367,0xE368,0xE369,0xE36A,0xE36B,0xE36C,0xE36D,0xE36E, +0xE36F,0xE370,0xE371,0xE372,0xE373,0xE374,0xE375,0xE376, +0xE377,0xE378,0xE379,0xE37A,0xE37B,0xE37C,0xE37D,0xE37E, +0xE37F,0xE380,0xE381,0xE382,0xE383,0xE384,0xE385,0xE386, +0xE387,0xE388,0xE389,0xE38A,0xE38B,0xE38C,0xE38D,0xE38E, +0xE38F,0xE390,0xE391,0xE392,0xE393,0xE394,0xE395,0xE396, +0xE397,0xE398,0xE399,0xE39A,0xE39B,0xE39C,0xE39D,0xE39E, +0xE39F,0xE3A0,0xE3A1,0xE3A2,0xE3A3,0xE3A4,0xE3A5,0xE3A6, +0xE3A7,0xE3A8,0xE3A9,0xE3AA,0xE3AB, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE3AC,0xE3AD,0xE3AE,0xE3AF,0xE3B0,0xE3B1,0xE3B2,0xE3B3, +0xE3B4,0xE3B5,0xE3B6,0xE3B7,0xE3B8,0xE3B9,0xE3BA,0xE3BB, +0xE3BC,0xE3BD,0xE3BE,0xE3BF,0xE3C0,0xE3C1,0xE3C2,0xE3C3, +0xE3C4,0xE3C5,0xE3C6,0xE3C7,0xE3C8,0xE3C9,0xE3CA,0xE3CB, +0xE3CC,0xE3CD,0xE3CE,0xE3CF,0xE3D0,0xE3D1,0xE3D2,0xE3D3, +0xE3D4,0xE3D5,0xE3D6,0xE3D7,0xE3D8,0xE3D9,0xE3DA,0xE3DB, +0xE3DC,0xE3DD,0xE3DE,0xE3DF,0xE3E0,0xE3E1,0xE3E2,0xE3E3, +0xE3E4,0xE3E5,0xE3E6,0xE3E7,0xE3E8,0xE3E9,0xE3EA, 0, +0xE3EB,0xE3EC,0xE3ED,0xE3EE,0xE3EF,0xE3F0,0xE3F1,0xE3F2, +0xE3F3,0xE3F4,0xE3F5,0xE3F6,0xE3F7,0xE3F8,0xE3F9,0xE3FA, +0xE3FB,0xE3FC,0xE3FD,0xE3FE,0xE3FF,0xE400,0xE401,0xE402, +0xE403,0xE404,0xE405,0xE406,0xE407,0xE408,0xE409,0xE40A, +0xE40B,0xE40C,0xE40D,0xE40E,0xE40F,0xE410,0xE411,0xE412, +0xE413,0xE414,0xE415,0xE416,0xE417,0xE418,0xE419,0xE41A, +0xE41B,0xE41C,0xE41D,0xE41E,0xE41F,0xE420,0xE421,0xE422, +0xE423,0xE424,0xE425,0xE426,0xE427,0xE428,0xE429,0xE42A, +0xE42B,0xE42C,0xE42D,0xE42E,0xE42F,0xE430,0xE431,0xE432, +0xE433,0xE434,0xE435,0xE436,0xE437,0xE438,0xE439,0xE43A, +0xE43B,0xE43C,0xE43D,0xE43E,0xE43F,0xE440,0xE441,0xE442, +0xE443,0xE444,0xE445,0xE446,0xE447,0xE448,0xE449,0xE44A, +0xE44B,0xE44C,0xE44D,0xE44E,0xE44F,0xE450,0xE451,0xE452, +0xE453,0xE454,0xE455,0xE456,0xE457,0xE458,0xE459,0xE45A, +0xE45B,0xE45C,0xE45D,0xE45E,0xE45F,0xE460,0xE461,0xE462, +0xE463,0xE464,0xE465,0xE466,0xE467, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE468,0xE469,0xE46A,0xE46B,0xE46C,0xE46D,0xE46E,0xE46F, +0xE470,0xE471,0xE472,0xE473,0xE474,0xE475,0xE476,0xE477, +0xE478,0xE479,0xE47A,0xE47B,0xE47C,0xE47D,0xE47E,0xE47F, +0xE480,0xE481,0xE482,0xE483,0xE484,0xE485,0xE486,0xE487, +0xE488,0xE489,0xE48A,0xE48B,0xE48C,0xE48D,0xE48E,0xE48F, +0xE490,0xE491,0xE492,0xE493,0xE494,0xE495,0xE496,0xE497, +0xE498,0xE499,0xE49A,0xE49B,0xE49C,0xE49D,0xE49E,0xE49F, +0xE4A0,0xE4A1,0xE4A2,0xE4A3,0xE4A4,0xE4A5,0xE4A6, 0, +0xE4A7,0xE4A8,0xE4A9,0xE4AA,0xE4AB,0xE4AC,0xE4AD,0xE4AE, +0xE4AF,0xE4B0,0xE4B1,0xE4B2,0xE4B3,0xE4B4,0xE4B5,0xE4B6, +0xE4B7,0xE4B8,0xE4B9,0xE4BA,0xE4BB,0xE4BC,0xE4BD,0xE4BE, +0xE4BF,0xE4C0,0xE4C1,0xE4C2,0xE4C3,0xE4C4,0xE4C5,0xE4C6, +0xE4C7,0xE4C8,0xE4C9,0xE4CA,0xE4CB,0xE4CC,0xE4CD,0xE4CE, +0xE4CF,0xE4D0,0xE4D1,0xE4D2,0xE4D3,0xE4D4,0xE4D5,0xE4D6, +0xE4D7,0xE4D8,0xE4D9,0xE4DA,0xE4DB,0xE4DC,0xE4DD,0xE4DE, +0xE4DF,0xE4E0,0xE4E1,0xE4E2,0xE4E3,0xE4E4,0xE4E5,0xE4E6, +0xE4E7,0xE4E8,0xE4E9,0xE4EA,0xE4EB,0xE4EC,0xE4ED,0xE4EE, +0xE4EF,0xE4F0,0xE4F1,0xE4F2,0xE4F3,0xE4F4,0xE4F5,0xE4F6, +0xE4F7,0xE4F8,0xE4F9,0xE4FA,0xE4FB,0xE4FC,0xE4FD,0xE4FE, +0xE4FF,0xE500,0xE501,0xE502,0xE503,0xE504,0xE505,0xE506, +0xE507,0xE508,0xE509,0xE50A,0xE50B,0xE50C,0xE50D,0xE50E, +0xE50F,0xE510,0xE511,0xE512,0xE513,0xE514,0xE515,0xE516, +0xE517,0xE518,0xE519,0xE51A,0xE51B,0xE51C,0xE51D,0xE51E, +0xE51F,0xE520,0xE521,0xE522,0xE523, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE524,0xE525,0xE526,0xE527,0xE528,0xE529,0xE52A,0xE52B, +0xE52C,0xE52D,0xE52E,0xE52F,0xE530,0xE531,0xE532,0xE533, +0xE534,0xE535,0xE536,0xE537,0xE538,0xE539,0xE53A,0xE53B, +0xE53C,0xE53D,0xE53E,0xE53F,0xE540,0xE541,0xE542,0xE543, +0xE544,0xE545,0xE546,0xE547,0xE548,0xE549,0xE54A,0xE54B, +0xE54C,0xE54D,0xE54E,0xE54F,0xE550,0xE551,0xE552,0xE553, +0xE554,0xE555,0xE556,0xE557,0xE558,0xE559,0xE55A,0xE55B, +0xE55C,0xE55D,0xE55E,0xE55F,0xE560,0xE561,0xE562, 0, +0xE563,0xE564,0xE565,0xE566,0xE567,0xE568,0xE569,0xE56A, +0xE56B,0xE56C,0xE56D,0xE56E,0xE56F,0xE570,0xE571,0xE572, +0xE573,0xE574,0xE575,0xE576,0xE577,0xE578,0xE579,0xE57A, +0xE57B,0xE57C,0xE57D,0xE57E,0xE57F,0xE580,0xE581,0xE582, +0xE583,0xE584,0xE585,0xE586,0xE587,0xE588,0xE589,0xE58A, +0xE58B,0xE58C,0xE58D,0xE58E,0xE58F,0xE590,0xE591,0xE592, +0xE593,0xE594,0xE595,0xE596,0xE597,0xE598,0xE599,0xE59A, +0xE59B,0xE59C,0xE59D,0xE59E,0xE59F,0xE5A0,0xE5A1,0xE5A2, +0xE5A3,0xE5A4,0xE5A5,0xE5A6,0xE5A7,0xE5A8,0xE5A9,0xE5AA, +0xE5AB,0xE5AC,0xE5AD,0xE5AE,0xE5AF,0xE5B0,0xE5B1,0xE5B2, +0xE5B3,0xE5B4,0xE5B5,0xE5B6,0xE5B7,0xE5B8,0xE5B9,0xE5BA, +0xE5BB,0xE5BC,0xE5BD,0xE5BE,0xE5BF,0xE5C0,0xE5C1,0xE5C2, +0xE5C3,0xE5C4,0xE5C5,0xE5C6,0xE5C7,0xE5C8,0xE5C9,0xE5CA, +0xE5CB,0xE5CC,0xE5CD,0xE5CE,0xE5CF,0xE5D0,0xE5D1,0xE5D2, +0xE5D3,0xE5D4,0xE5D5,0xE5D6,0xE5D7,0xE5D8,0xE5D9,0xE5DA, +0xE5DB,0xE5DC,0xE5DD,0xE5DE,0xE5DF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE5E0,0xE5E1,0xE5E2,0xE5E3,0xE5E4,0xE5E5,0xE5E6,0xE5E7, +0xE5E8,0xE5E9,0xE5EA,0xE5EB,0xE5EC,0xE5ED,0xE5EE,0xE5EF, +0xE5F0,0xE5F1,0xE5F2,0xE5F3,0xE5F4,0xE5F5,0xE5F6,0xE5F7, +0xE5F8,0xE5F9,0xE5FA,0xE5FB,0xE5FC,0xE5FD,0xE5FE,0xE5FF, +0xE600,0xE601,0xE602,0xE603,0xE604,0xE605,0xE606,0xE607, +0xE608,0xE609,0xE60A,0xE60B,0xE60C,0xE60D,0xE60E,0xE60F, +0xE610,0xE611,0xE612,0xE613,0xE614,0xE615,0xE616,0xE617, +0xE618,0xE619,0xE61A,0xE61B,0xE61C,0xE61D,0xE61E, 0, +0xE61F,0xE620,0xE621,0xE622,0xE623,0xE624,0xE625,0xE626, +0xE627,0xE628,0xE629,0xE62A,0xE62B,0xE62C,0xE62D,0xE62E, +0xE62F,0xE630,0xE631,0xE632,0xE633,0xE634,0xE635,0xE636, +0xE637,0xE638,0xE639,0xE63A,0xE63B,0xE63C,0xE63D,0xE63E, +0xE63F,0xE640,0xE641,0xE642,0xE643,0xE644,0xE645,0xE646, +0xE647,0xE648,0xE649,0xE64A,0xE64B,0xE64C,0xE64D,0xE64E, +0xE64F,0xE650,0xE651,0xE652,0xE653,0xE654,0xE655,0xE656, +0xE657,0xE658,0xE659,0xE65A,0xE65B,0xE65C,0xE65D,0xE65E, +0xE65F,0xE660,0xE661,0xE662,0xE663,0xE664,0xE665,0xE666, +0xE667,0xE668,0xE669,0xE66A,0xE66B,0xE66C,0xE66D,0xE66E, +0xE66F,0xE670,0xE671,0xE672,0xE673,0xE674,0xE675,0xE676, +0xE677,0xE678,0xE679,0xE67A,0xE67B,0xE67C,0xE67D,0xE67E, +0xE67F,0xE680,0xE681,0xE682,0xE683,0xE684,0xE685,0xE686, +0xE687,0xE688,0xE689,0xE68A,0xE68B,0xE68C,0xE68D,0xE68E, +0xE68F,0xE690,0xE691,0xE692,0xE693,0xE694,0xE695,0xE696, +0xE697,0xE698,0xE699,0xE69A,0xE69B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE69C,0xE69D,0xE69E,0xE69F,0xE6A0,0xE6A1,0xE6A2,0xE6A3, +0xE6A4,0xE6A5,0xE6A6,0xE6A7,0xE6A8,0xE6A9,0xE6AA,0xE6AB, +0xE6AC,0xE6AD,0xE6AE,0xE6AF,0xE6B0,0xE6B1,0xE6B2,0xE6B3, +0xE6B4,0xE6B5,0xE6B6,0xE6B7,0xE6B8,0xE6B9,0xE6BA,0xE6BB, +0xE6BC,0xE6BD,0xE6BE,0xE6BF,0xE6C0,0xE6C1,0xE6C2,0xE6C3, +0xE6C4,0xE6C5,0xE6C6,0xE6C7,0xE6C8,0xE6C9,0xE6CA,0xE6CB, +0xE6CC,0xE6CD,0xE6CE,0xE6CF,0xE6D0,0xE6D1,0xE6D2,0xE6D3, +0xE6D4,0xE6D5,0xE6D6,0xE6D7,0xE6D8,0xE6D9,0xE6DA, 0, +0xE6DB,0xE6DC,0xE6DD,0xE6DE,0xE6DF,0xE6E0,0xE6E1,0xE6E2, +0xE6E3,0xE6E4,0xE6E5,0xE6E6,0xE6E7,0xE6E8,0xE6E9,0xE6EA, +0xE6EB,0xE6EC,0xE6ED,0xE6EE,0xE6EF,0xE6F0,0xE6F1,0xE6F2, +0xE6F3,0xE6F4,0xE6F5,0xE6F6,0xE6F7,0xE6F8,0xE6F9,0xE6FA, +0xE6FB,0xE6FC,0xE6FD,0xE6FE,0xE6FF,0xE700,0xE701,0xE702, +0xE703,0xE704,0xE705,0xE706,0xE707,0xE708,0xE709,0xE70A, +0xE70B,0xE70C,0xE70D,0xE70E,0xE70F,0xE710,0xE711,0xE712, +0xE713,0xE714,0xE715,0xE716,0xE717,0xE718,0xE719,0xE71A, +0xE71B,0xE71C,0xE71D,0xE71E,0xE71F,0xE720,0xE721,0xE722, +0xE723,0xE724,0xE725,0xE726,0xE727,0xE728,0xE729,0xE72A, +0xE72B,0xE72C,0xE72D,0xE72E,0xE72F,0xE730,0xE731,0xE732, +0xE733,0xE734,0xE735,0xE736,0xE737,0xE738,0xE739,0xE73A, +0xE73B,0xE73C,0xE73D,0xE73E,0xE73F,0xE740,0xE741,0xE742, +0xE743,0xE744,0xE745,0xE746,0xE747,0xE748,0xE749,0xE74A, +0xE74B,0xE74C,0xE74D,0xE74E,0xE74F,0xE750,0xE751,0xE752, +0xE753,0xE754,0xE755,0xE756,0xE757, 0, 0, 0}; + +/* page 7 0xFA40-0xFC4B - +IBM Selected Kanji and Non-Kanji */ +static uint16 tab_cp932_uni7[]={ +0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177, +0x2178,0x2179,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165, +0x2166,0x2167,0x2168,0x2169,0xFFE2,0xFFE4,0xFF07,0xFF02, +0x3231,0x2116,0x2121,0x2235,0x7E8A,0x891C,0x9348,0x9288, +0x84DC,0x4FC9,0x70BB,0x6631,0x68C8,0x92F9,0x66FB,0x5F45, +0x4E28,0x4EE1,0x4EFC,0x4F00,0x4F03,0x4F39,0x4F56,0x4F92, +0x4F8A,0x4F9A,0x4F94,0x4FCD,0x5040,0x5022,0x4FFF,0x501E, +0x5046,0x5070,0x5042,0x5094,0x50F4,0x50D8,0x514A, 0, +0x5164,0x519D,0x51BE,0x51EC,0x5215,0x529C,0x52A6,0x52C0, +0x52DB,0x5300,0x5307,0x5324,0x5372,0x5393,0x53B2,0x53DD, +0xFA0E,0x549C,0x548A,0x54A9,0x54FF,0x5586,0x5759,0x5765, +0x57AC,0x57C8,0x57C7,0xFA0F,0xFA10,0x589E,0x58B2,0x590B, +0x5953,0x595B,0x595D,0x5963,0x59A4,0x59BA,0x5B56,0x5BC0, +0x752F,0x5BD8,0x5BEC,0x5C1E,0x5CA6,0x5CBA,0x5CF5,0x5D27, +0x5D53,0xFA11,0x5D42,0x5D6D,0x5DB8,0x5DB9,0x5DD0,0x5F21, +0x5F34,0x5F67,0x5FB7,0x5FDE,0x605D,0x6085,0x608A,0x60DE, +0x60D5,0x6120,0x60F2,0x6111,0x6137,0x6130,0x6198,0x6213, +0x62A6,0x63F5,0x6460,0x649D,0x64CE,0x654E,0x6600,0x6615, +0x663B,0x6609,0x662E,0x661E,0x6624,0x6665,0x6657,0x6659, +0xFA12,0x6673,0x6699,0x66A0,0x66B2,0x66BF,0x66FA,0x670E, +0xF929,0x6766,0x67BB,0x6852,0x67C0,0x6801,0x6844,0x68CF, +0xFA13,0x6968,0xFA14,0x6998,0x69E2,0x6A30,0x6A6B,0x6A46, +0x6A73,0x6A7E,0x6AE2,0x6AE4,0x6BD6,0x6C3F,0x6C5C,0x6C86, +0x6C6F,0x6CDA,0x6D04,0x6D87,0x6D6F, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6D96,0x6DAC,0x6DCF,0x6DF8,0x6DF2,0x6DFC,0x6E39,0x6E5C, +0x6E27,0x6E3C,0x6EBF,0x6F88,0x6FB5,0x6FF5,0x7005,0x7007, +0x7028,0x7085,0x70AB,0x710F,0x7104,0x715C,0x7146,0x7147, +0xFA15,0x71C1,0x71FE,0x72B1,0x72BE,0x7324,0xFA16,0x7377, +0x73BD,0x73C9,0x73D6,0x73E3,0x73D2,0x7407,0x73F5,0x7426, +0x742A,0x7429,0x742E,0x7462,0x7489,0x749F,0x7501,0x756F, +0x7682,0x769C,0x769E,0x769B,0x76A6,0xFA17,0x7746,0x52AF, +0x7821,0x784E,0x7864,0x787A,0x7930,0xFA18,0xFA19, 0, +0xFA1A,0x7994,0xFA1B,0x799B,0x7AD1,0x7AE7,0xFA1C,0x7AEB, +0x7B9E,0xFA1D,0x7D48,0x7D5C,0x7DB7,0x7DA0,0x7DD6,0x7E52, +0x7F47,0x7FA1,0xFA1E,0x8301,0x8362,0x837F,0x83C7,0x83F6, +0x8448,0x84B4,0x8553,0x8559,0x856B,0xFA1F,0x85B0,0xFA20, +0xFA21,0x8807,0x88F5,0x8A12,0x8A37,0x8A79,0x8AA7,0x8ABE, +0x8ADF,0xFA22,0x8AF6,0x8B53,0x8B7F,0x8CF0,0x8CF4,0x8D12, +0x8D76,0xFA23,0x8ECF,0xFA24,0xFA25,0x9067,0x90DE,0xFA26, +0x9115,0x9127,0x91DA,0x91D7,0x91DE,0x91ED,0x91EE,0x91E4, +0x91E5,0x9206,0x9210,0x920A,0x923A,0x9240,0x923C,0x924E, +0x9259,0x9251,0x9239,0x9267,0x92A7,0x9277,0x9278,0x92E7, +0x92D7,0x92D9,0x92D0,0xFA27,0x92D5,0x92E0,0x92D3,0x9325, +0x9321,0x92FB,0xFA28,0x931E,0x92FF,0x931D,0x9302,0x9370, +0x9357,0x93A4,0x93C6,0x93DE,0x93F8,0x9431,0x9445,0x9448, +0x9592,0xF9DC,0xFA29,0x969D,0x96AF,0x9733,0x973B,0x9743, +0x974D,0x974F,0x9751,0x9755,0x9857,0x9865,0xFA2A,0xFA2B, +0x9927,0xFA2C,0x999E,0x9A4E,0x9AD9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9ADC,0x9B75,0x9B72,0x9B8F,0x9BB1,0x9BBB,0x9C00,0x9D70, +0x9D6B,0xFA2D,0x9E19,0x9ED1}; + +static int func_cp932_uni_onechar(int code){ + if ((code>=0x00A1)&&(code<=0x00DF)) + return(tab_cp932_uni0[code-0x00A1]); + if ((code>=0x8140)&&(code<=0x84BE)) + return(tab_cp932_uni1[code-0x8140]); + if ((code>=0x8740)&&(code<=0x879C)) + return(tab_cp932_uni2[code-0x8740]); + if ((code>=0x889F)&&(code<=0x9FFC)) + return(tab_cp932_uni3[code-0x889F]); + if ((code>=0xE040)&&(code<=0xEAA4)) + return(tab_cp932_uni4[code-0xE040]); + if ((code>=0xED40)&&(code<=0xEEFC)) + return(tab_cp932_uni5[code-0xED40]); + if ((code>=0xF040)&&(code<=0xF9FC)) + return(tab_cp932_uni6[code-0xF040]); + if ((code>=0xFA40)&&(code<=0xFC4B)) + return(tab_cp932_uni7[code-0xFA40]); + return(0); +} + +/* page 0 0x005C-0x00F7 */ +static uint16 tab_uni_cp9320[]={ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8198,0x814E, 0, 0, 0, + 0, 0, 0, 0,0x818B,0x817D, 0, 0, +0x814C, 0,0x81F7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x817E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8180}; + +/* page 1 0x0391-0x0451 */ +static uint16 tab_uni_cp9321[]={ +0x839F,0x83A0,0x83A1,0x83A2,0x83A3,0x83A4,0x83A5,0x83A6, +0x83A7,0x83A8,0x83A9,0x83AA,0x83AB,0x83AC,0x83AD,0x83AE, +0x83AF, 0,0x83B0,0x83B1,0x83B2,0x83B3,0x83B4,0x83B5, +0x83B6, 0, 0, 0, 0, 0, 0, 0, +0x83BF,0x83C0,0x83C1,0x83C2,0x83C3,0x83C4,0x83C5,0x83C6, +0x83C7,0x83C8,0x83C9,0x83CA,0x83CB,0x83CC,0x83CD,0x83CE, +0x83CF, 0,0x83D0,0x83D1,0x83D2,0x83D3,0x83D4,0x83D5, +0x83D6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8446, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8440, +0x8441,0x8442,0x8443,0x8444,0x8445,0x8447,0x8448,0x8449, +0x844A,0x844B,0x844C,0x844D,0x844E,0x844F,0x8450,0x8451, +0x8452,0x8453,0x8454,0x8455,0x8456,0x8457,0x8458,0x8459, +0x845A,0x845B,0x845C,0x845D,0x845E,0x845F,0x8460,0x8470, +0x8471,0x8472,0x8473,0x8474,0x8475,0x8477,0x8478,0x8479, +0x847A,0x847B,0x847C,0x847D,0x847E,0x8480,0x8481,0x8482, +0x8483,0x8484,0x8485,0x8486,0x8487,0x8488,0x8489,0x848A, +0x848B,0x848C,0x848D,0x848E,0x848F,0x8490,0x8491, 0, +0x8476}; + +/* page 2 0x2010-0x2473 */ +static uint16 tab_uni_cp9322[]={ +0x815D, 0, 0, 0, 0,0x815C, 0, 0, +0x8165,0x8166, 0, 0,0x8167,0x8168, 0, 0, +0x81F5,0x81F6, 0, 0, 0,0x8164,0x8163, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81F1, 0,0x818C,0x818D, 0, 0, 0, 0, + 0, 0, 0,0x81A6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x818E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8782, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8784, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x81F0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8754,0x8755,0x8756,0x8757,0x8758,0x8759,0x875A,0x875B, +0x875C,0x875D, 0, 0, 0, 0, 0, 0, +0xFA40,0xFA41,0xFA42,0xFA43,0xFA44,0xFA45,0xFA46,0xFA47, +0xFA48,0xFA49, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81A9,0x81AA,0x81A8,0x81AB, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81CB, 0,0x81CC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81CD, 0,0x81DD,0x81CE, 0, 0, 0,0x81DE, +0x81B8, 0, 0,0x81B9, 0, 0, 0, 0, + 0,0x8794, 0, 0, 0, 0, 0, 0, + 0, 0,0x81E3, 0, 0,0x81E5,0x8187,0x8798, +0x81DA, 0, 0, 0, 0,0x8161, 0,0x81C8, +0x81C9,0x81BF,0x81BE,0x81E7,0x81E8, 0,0x8793, 0, + 0, 0, 0, 0,0x8188,0x81E6, 0, 0, + 0, 0, 0, 0, 0,0x81E4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81E0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8182,0x81DF, 0, 0, 0, 0,0x8185,0x8186, + 0, 0,0x81E1,0x81E2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81BC,0x81BD, 0, 0,0x81BA,0x81BB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x81DB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8799, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81DC, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8740,0x8741,0x8742,0x8743,0x8744,0x8745,0x8746,0x8747, +0x8748,0x8749,0x874A,0x874B,0x874C,0x874D,0x874E,0x874F, +0x8750,0x8751,0x8752,0x8753}; + +/* page 3 0x2500-0x266F */ +static uint16 tab_uni_cp9323[]={ +0x849F,0x84AA,0x84A0,0x84AB, 0, 0, 0, 0, + 0, 0, 0, 0,0x84A1, 0, 0,0x84AC, +0x84A2, 0, 0,0x84AD,0x84A4, 0, 0,0x84AF, +0x84A3, 0, 0,0x84AE,0x84A5,0x84BA, 0, 0, +0x84B5, 0, 0,0x84B0,0x84A7,0x84BC, 0, 0, +0x84B7, 0, 0,0x84B2,0x84A6, 0, 0,0x84B6, +0x84BB, 0, 0,0x84B1,0x84A8, 0, 0,0x84B8, +0x84BD, 0, 0,0x84B3,0x84A9, 0, 0,0x84B9, + 0, 0,0x84BE, 0, 0, 0, 0, 0, + 0, 0, 0,0x84B4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81A1,0x81A0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81A3,0x81A2, 0, 0, 0, 0, + 0, 0, 0, 0,0x81A5,0x81A4, 0, 0, + 0, 0, 0, 0, 0, 0,0x819F,0x819E, + 0, 0, 0,0x819B, 0, 0,0x819D,0x819C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x81FC, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x819A,0x8199, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x818A, 0,0x8189, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81F4, 0, 0,0x81F3, 0,0x81F2 +}; + +/* page 4 0x3000-0x30FE */ +static uint16 tab_uni_cp9324[]={ +0x8140,0x8141,0x8142,0x8156, 0,0x8158,0x8159,0x815A, +0x8171,0x8172,0x8173,0x8174,0x8175,0x8176,0x8177,0x8178, +0x8179,0x817A,0x81A7,0x81AC,0x816B,0x816C, 0, 0, + 0, 0, 0, 0, 0,0x8780, 0,0x8781, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x829F,0x82A0,0x82A1,0x82A2,0x82A3,0x82A4,0x82A5, +0x82A6,0x82A7,0x82A8,0x82A9,0x82AA,0x82AB,0x82AC,0x82AD, +0x82AE,0x82AF,0x82B0,0x82B1,0x82B2,0x82B3,0x82B4,0x82B5, +0x82B6,0x82B7,0x82B8,0x82B9,0x82BA,0x82BB,0x82BC,0x82BD, +0x82BE,0x82BF,0x82C0,0x82C1,0x82C2,0x82C3,0x82C4,0x82C5, +0x82C6,0x82C7,0x82C8,0x82C9,0x82CA,0x82CB,0x82CC,0x82CD, +0x82CE,0x82CF,0x82D0,0x82D1,0x82D2,0x82D3,0x82D4,0x82D5, +0x82D6,0x82D7,0x82D8,0x82D9,0x82DA,0x82DB,0x82DC,0x82DD, +0x82DE,0x82DF,0x82E0,0x82E1,0x82E2,0x82E3,0x82E4,0x82E5, +0x82E6,0x82E7,0x82E8,0x82E9,0x82EA,0x82EB,0x82EC,0x82ED, +0x82EE,0x82EF,0x82F0,0x82F1, 0, 0, 0, 0, + 0, 0, 0,0x814A,0x814B,0x8154,0x8155, 0, + 0,0x8340,0x8341,0x8342,0x8343,0x8344,0x8345,0x8346, +0x8347,0x8348,0x8349,0x834A,0x834B,0x834C,0x834D,0x834E, +0x834F,0x8350,0x8351,0x8352,0x8353,0x8354,0x8355,0x8356, +0x8357,0x8358,0x8359,0x835A,0x835B,0x835C,0x835D,0x835E, +0x835F,0x8360,0x8361,0x8362,0x8363,0x8364,0x8365,0x8366, +0x8367,0x8368,0x8369,0x836A,0x836B,0x836C,0x836D,0x836E, +0x836F,0x8370,0x8371,0x8372,0x8373,0x8374,0x8375,0x8376, +0x8377,0x8378,0x8379,0x837A,0x837B,0x837C,0x837D,0x837E, +0x8380,0x8381,0x8382,0x8383,0x8384,0x8385,0x8386,0x8387, +0x8388,0x8389,0x838A,0x838B,0x838C,0x838D,0x838E,0x838F, +0x8390,0x8391,0x8392,0x8393,0x8394,0x8395,0x8396, 0, + 0, 0, 0,0x8145,0x815B,0x8152,0x8153}; + +/* page 5 0x3230-0x33CD */ +static uint16 tab_uni_cp9325[]={ + 0,0x878A,0x878B, 0, 0, 0, 0, 0, + 0,0x878C, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8785,0x8786,0x8787,0x8788, +0x8789, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8765, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x8769, 0, 0, + 0, 0, 0, 0,0x8760, 0, 0, 0, +0x8763, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8761,0x876B, 0, 0,0x876A,0x8764, + 0, 0, 0,0x876C, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8766, 0, + 0, 0, 0,0x876E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x875F,0x876D, 0, 0,0x8762, 0, 0, + 0,0x8767, 0, 0, 0, 0, 0,0x8768, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x877E,0x878F,0x878E,0x878D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8772,0x8773, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x876F,0x8770,0x8771, 0, + 0,0x8775, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8774, 0, 0, 0, + 0, 0, 0, 0, 0,0x8783}; + +/* page 6 0x4E00-0x9481 */ +static uint16 tab_uni_cp9326[]={ +0x88EA,0x929A, 0,0x8EB5, 0, 0, 0,0x969C, +0x8FE4,0x8E4F,0x8FE3,0x89BA, 0,0x9573,0x975E, 0, +0x98A0,0x894E, 0, 0,0x8A8E,0x98A1,0x90A2,0x99C0, +0x8B75,0x95B8, 0, 0, 0, 0,0x8FE5, 0, + 0,0x97BC, 0, 0, 0, 0,0x95C0, 0, +0xFA68, 0,0x98A2, 0, 0,0x9286, 0, 0, + 0,0x98A3,0x8BF8, 0, 0, 0,0x98A4, 0, +0x8ADB,0x924F, 0,0x8EE5,0x98A5, 0, 0,0x98A6, + 0, 0,0x98A7,0x9454, 0,0x8B76, 0, 0, + 0, 0, 0,0x9456, 0,0x93E1,0x8CC1,0x9652, + 0, 0, 0, 0, 0,0xE568,0x98A8,0x8FE6, +0x98A9,0x89B3, 0, 0, 0,0x8BE3,0x8CEE,0x96E7, + 0, 0,0x9BA4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9790, 0,0x93FB, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8AA3, 0, +0x8B54, 0,0x98AA, 0, 0,0x98AB,0x97B9, 0, +0x975C,0x9188,0x98AD,0x8E96,0x93F1, 0,0x98B0, 0, + 0,0x895D,0x8CDD, 0,0x8CDC,0x88E4, 0, 0, +0x986A,0x9869, 0,0x8DB1,0x889F, 0,0x98B1,0x98B2, +0x98B3,0x9653,0x98B4, 0,0x8CF0,0x88E5,0x9692, 0, +0x8B9C, 0, 0,0x8B9D,0x8B9E,0x92E0,0x97BA, 0, +0x98B5, 0, 0,0x98B6, 0, 0,0x98B7, 0, + 0, 0,0x906C, 0, 0, 0, 0, 0, +0x8F59,0x906D,0x98BC, 0,0x98BA, 0,0x98BB,0x8B77, + 0, 0,0x8DA1,0x89EE, 0,0x98B9,0x98B8,0x95A7, + 0, 0, 0, 0,0x8E65,0x8E64,0x91BC,0x98BD, +0x9574,0x90E5, 0, 0, 0,0x8157,0x98BE,0x98C0, + 0,0xFA69, 0,0x91E3,0x97DF,0x88C8, 0, 0, + 0, 0, 0, 0, 0,0x98BF,0x89BC, 0, +0x8BC2, 0,0x9287, 0, 0, 0,0x8C8F,0x98C1, + 0, 0, 0,0x9443,0xFA6A, 0, 0, 0, +0xFA6B,0x8AE9, 0,0xFA6C, 0, 0, 0, 0, + 0,0x98C2,0x88C9, 0, 0,0x8CDE,0x8AEA,0x959A, +0x94B0,0x8B78, 0, 0, 0, 0, 0, 0, + 0, 0,0x89EF, 0,0x98E5,0x9360, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x948C, +0x98C4, 0, 0, 0,0x94BA, 0,0x97E0, 0, +0x904C,0xFA6D,0x8E66, 0,0x8E97,0x89BE, 0, 0, + 0, 0, 0,0x92CF, 0, 0,0x9241,0x98C8, + 0, 0, 0, 0, 0,0x88CA,0x92E1,0x8F5A, +0x8DB2,0x9743, 0,0x91CC, 0,0x89BD,0xFA6E,0x98C7, + 0,0x975D,0x98C3,0x98C5,0x8DEC,0x98C6,0x9B43, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x98CE, 0, 0, 0, 0, 0,0x98D1, +0x98CF, 0, 0,0x89C0, 0,0x95B9,0x98C9, 0, + 0, 0, 0,0x98CD,0x8CF1, 0, 0,0x8E67, + 0, 0, 0,0x8AA4, 0, 0,0x98D2, 0, +0x98CA, 0,0xFA70,0x97E1, 0,0x8E98, 0,0x98CB, + 0,0x98D0,0xFA6F, 0,0xFA72, 0,0x98D3, 0, +0x98CC, 0,0xFA71,0x8B9F, 0,0x88CB, 0, 0, +0x8BA0,0x89BF, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9B44, 0,0x9699,0x958E,0x8CF2, + 0, 0, 0, 0, 0,0x904E,0x97B5, 0, + 0, 0, 0, 0, 0, 0, 0,0x95D6, + 0, 0,0x8C57,0x91A3,0x89E2, 0, 0, 0, + 0,0xFA61,0x8F72, 0, 0,0xFA73,0x98D7, 0, +0x98DC,0x98DA, 0, 0,0x98D5, 0, 0,0x91AD, +0x98D8, 0,0x98DB,0x98D9, 0,0x95DB, 0,0x98D6, + 0,0x904D, 0,0x9693,0x98DD,0x98DE, 0, 0, + 0, 0, 0, 0, 0, 0,0x8F43,0x98EB, + 0, 0, 0,0x946F, 0,0x9555,0x98E6, 0, +0x95EE, 0,0x89B4, 0, 0, 0,0x98EA,0xFA76, + 0, 0, 0, 0, 0,0x98E4,0x98ED, 0, + 0,0x9171, 0,0x8CC2, 0,0x947B, 0,0xE0C5, + 0,0x98EC,0x937C, 0,0x98E1, 0,0x8CF4, 0, + 0,0x8CF3,0x98DF, 0, 0, 0,0xFA77,0x8ED8, + 0,0x98E7,0xFA75,0x95ED,0x926C,0x98E3,0x8C91, 0, +0x98E0,0x98E8,0x98E2,0x97CF,0x98E9,0x9860, 0, 0, + 0, 0, 0, 0, 0, 0,0x8BE4, 0, + 0,0x8C90, 0, 0, 0, 0, 0, 0, +0xFA74, 0,0xFA7A,0x98EE, 0, 0,0xFA78,0x98EF, +0x98F3,0x88CC, 0, 0, 0, 0, 0,0x95CE, +0x98F2, 0, 0, 0, 0,0x98F1,0x98F5, 0, + 0, 0,0x98F4, 0,0x92E2, 0, 0, 0, + 0, 0, 0, 0, 0,0x8C92, 0, 0, + 0, 0, 0, 0,0x98F6, 0, 0, 0, +0xFA79, 0,0x8EC3, 0,0x91A4,0x92E3,0x8BF4, 0, +0x98F7, 0, 0, 0, 0,0x8B55, 0, 0, +0x98F8, 0, 0, 0, 0,0x98FA, 0, 0, + 0, 0, 0, 0, 0,0x9654, 0, 0, + 0,0x8C86, 0, 0,0xFA7B, 0, 0, 0, +0x8E50,0x94F5,0x98F9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8DC3,0x9762, 0, 0, + 0, 0,0x98FC,0x9942,0x98FB,0x8DC2, 0,0x8F9D, + 0, 0, 0, 0, 0, 0,0x8C58, 0, + 0, 0,0x9943, 0, 0,0x8BCD, 0, 0, + 0,0x9940,0x9941, 0, 0,0x93AD, 0,0x919C, + 0,0x8BA1, 0, 0, 0,0x966C,0x9944, 0, +0xFA7D, 0,0x97BB, 0, 0, 0,0x9945, 0, + 0, 0, 0,0x9948, 0,0x9946, 0,0x916D, + 0, 0, 0, 0, 0,0x9947,0x9949, 0, + 0, 0, 0, 0,0xFA7C,0x994B, 0, 0, + 0,0x994A, 0,0x95C6, 0, 0, 0, 0, +0x8B56,0x994D,0x994E, 0,0x89AD, 0, 0, 0, + 0,0x994C, 0, 0, 0, 0, 0, 0, + 0, 0,0x8EF2, 0,0x9951,0x9950,0x994F, 0, +0x98D4, 0,0x9952, 0, 0, 0, 0,0x8F9E, + 0,0x9953, 0, 0, 0, 0, 0, 0, + 0, 0,0x9744, 0, 0, 0, 0, 0, + 0, 0,0x96D7, 0, 0, 0, 0,0x9955, + 0, 0,0x9954,0x9957,0x9956, 0, 0,0x9958, +0x9959,0x88F2, 0,0x8CB3,0x8C5A,0x8F5B,0x929B,0x8BA2, +0x90E6,0x8CF5,0xFA7E,0x8D8E,0x995B,0x96C6,0x9365, 0, +0x8E99, 0,0x995A, 0,0x995C, 0, 0, 0, + 0, 0,0x937D, 0,0x8A95, 0, 0, 0, + 0, 0,0x995D, 0,0xFA80,0x93FC, 0, 0, +0x9153,0x995F,0x9960,0x94AA,0x8CF6,0x985A,0x9961, 0, + 0,0x8BA4, 0, 0, 0,0x95BA,0x91B4,0x8BEF, +0x9354, 0, 0, 0,0x8C93, 0, 0, 0, +0x9962, 0,0x9963, 0, 0,0x93E0,0x897E, 0, + 0,0x9966,0x8DFB, 0,0x9965,0x8DC4, 0,0x9967, +0xE3EC,0x9968,0x9660,0x9969, 0,0x996A,0x996B,0x8FE7, + 0,0x8ECA, 0, 0, 0,0xFA81, 0, 0, +0x8AA5, 0,0x996E, 0,0x996C,0x96BB,0x996D, 0, +0x9579,0x996F,0x9970,0x9971,0x937E, 0, 0, 0, +0x9975,0x9973,0x9974,0x9972,0x8DE1,0x9976,0x96E8,0x97E2, + 0, 0, 0, 0, 0,0x9977,0xFA82, 0, + 0, 0, 0, 0,0x90A6,0x9978,0x8F79, 0, + 0,0x9979, 0,0x929C,0x97BD,0x9380, 0, 0, + 0, 0, 0, 0, 0, 0,0x99C3, 0, + 0, 0, 0,0x997A,0xEAA3,0x8BC3, 0, 0, +0x997B,0x967D, 0, 0, 0, 0,0x8F88,0x91FA, + 0,0x997D,0x93E2, 0,0xFA83,0x997E, 0, 0, +0x9980,0x8A4D, 0, 0, 0,0x9981,0x8BA5, 0, +0x93CA,0x899A,0x8F6F, 0, 0,0x949F,0x9982, 0, +0x9381, 0, 0,0x906E,0x9983, 0,0x95AA,0x90D8, +0x8AA0, 0,0x8AA7,0x9984, 0, 0,0x9986, 0, + 0,0x8C59, 0, 0,0x9985,0xFA84, 0,0x97F1, + 0, 0, 0, 0, 0,0x8F89, 0, 0, + 0, 0, 0, 0,0x94BB,0x95CA, 0,0x9987, + 0,0x9798,0x9988, 0, 0, 0,0x9989, 0, +0x939E, 0, 0,0x998A, 0, 0,0x90A7,0x8DFC, +0x8C94,0x998B,0x8E68,0x8D8F, 0, 0, 0, 0, + 0, 0, 0,0x92E4,0x998D, 0, 0,0x91A5, + 0, 0,0x8DED,0x998E,0x998F,0x914F, 0,0x998C, + 0, 0, 0, 0,0x9991, 0,0x9655, 0, + 0, 0, 0,0x8D84, 0, 0,0x9990, 0, + 0, 0, 0,0x8C95,0x8DDC,0x948D, 0, 0, + 0,0x9994,0x9992, 0, 0, 0, 0,0x959B, +0x8FE8,0x999B,0x8A84,0x9995,0x9993,0x916E, 0, 0, + 0, 0, 0, 0, 0,0x9997, 0,0x9996, + 0, 0, 0,0x8A63, 0, 0, 0,0x8C80, +0x999C,0x97AB, 0, 0, 0,0x9998, 0, 0, + 0,0x999D,0x999A, 0,0x9999, 0, 0, 0, + 0, 0, 0,0x97CD,0xFA85, 0, 0,0x8CF7, +0x89C1, 0, 0,0x97F2, 0, 0,0xFA86, 0, + 0,0x8F95,0x9377,0x8D85,0x99A0,0x99A1, 0,0xFB77, + 0,0x97E3, 0, 0,0x984A,0x99A3, 0, 0, + 0,0x8CF8, 0, 0,0x99A2, 0,0x8A4E, 0, +0xFA87,0x99A4, 0,0x9675, 0,0x92BA, 0,0x9745, + 0,0x95D7, 0, 0, 0,0x99A5, 0, 0, + 0, 0,0xE8D3, 0, 0,0x93AE, 0,0x99A6, +0x8AA8,0x96B1, 0,0xFA88, 0,0x8F9F,0x99A7,0x95E5, +0x99AB, 0,0x90A8,0x99A8,0x8BCE, 0,0x99A9,0x8AA9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8C4D,0x99AC, 0,0x99AD, 0, 0, +0x99AE,0x99AF,0x8ED9, 0, 0, 0,0x8CF9,0x96DC, +0xFA89,0x96E6,0x93F5, 0, 0,0x95EF,0x99B0,0xFA8A, +0x99B1, 0, 0, 0, 0,0x99B3, 0,0x99B5, +0x99B4, 0, 0, 0, 0,0x99B6,0x89BB,0x966B, + 0,0x8DFA,0x99B7, 0, 0,0x9178, 0, 0, +0x8FA0,0x8BA7, 0,0x99B8,0xFA8B, 0, 0, 0, + 0, 0,0x94D9, 0, 0, 0, 0,0x99B9, + 0,0x99BA, 0,0x99BB, 0, 0, 0, 0, +0x99BC,0x9543,0x8BE6,0x88E3, 0, 0, 0,0x93BD, +0x99BD,0x8F5C, 0,0x90E7, 0,0x99BF,0x99BE,0x8FA1, +0x8CDF,0x99C1,0x94BC, 0, 0,0x99C2, 0, 0, + 0,0x94DA,0x91B2,0x91EC,0x8BA6, 0, 0,0x93EC, +0x9250, 0,0x948E, 0,0x966D, 0,0x99C4, 0, +0x90E8, 0, 0, 0, 0, 0,0x8C54, 0, + 0,0x99C5, 0, 0, 0, 0,0x99C6,0x894B, +0x88F3,0x8AEB,0xFA8C,0x91A6,0x8B70,0x9791, 0,0x99C9, +0x89B5, 0, 0,0x99C8, 0, 0, 0,0x8BA8, + 0, 0,0x99CA, 0,0x96EF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFA8D, 0, 0,0x99CB, 0, +0x97D0, 0,0x8CFA, 0, 0, 0, 0,0x8CB4, +0x99CC, 0, 0, 0, 0,0x99CE,0x99CD, 0, +0x907E,0x8958, 0, 0, 0,0x897D,0x99CF, 0, +0x99D0, 0,0xFA8E,0x8CB5, 0, 0,0x99D1, 0, + 0, 0, 0,0x8B8E, 0, 0, 0, 0, + 0, 0,0x8E51,0x99D2, 0, 0, 0, 0, +0x9694,0x8DB3,0x8B79,0x9746,0x916F,0x94BD,0x8EFB, 0, + 0, 0, 0, 0,0x8F66, 0,0x8EE6,0x8EF3, + 0,0x8F96, 0,0x94BE, 0,0xFA8F, 0,0x99D5, + 0,0x8962,0x9170,0x8CFB,0x8CC3,0x8BE5, 0, 0, +0x99D9,0x9240,0x91FC,0x8BA9,0x8FA2,0x99DA,0x99D8,0x89C2, +0x91E4,0x8EB6,0x8E6A,0x8945, 0, 0,0x8A90,0x8D86, +0x8E69, 0,0x99DB, 0, 0, 0, 0, 0, + 0,0x99DC, 0,0x8B68,0x8A65, 0, 0, 0, +0x8D87,0x8B67,0x92DD,0x8944,0x93AF,0x96BC,0x8D40,0x9799, +0x9366,0x8CFC, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8C4E, 0,0x99E5, 0,0x8BE1, +0x9669, 0, 0, 0, 0, 0,0x94DB, 0, + 0,0x99E4, 0,0x8ADC,0x99DF,0x99E0,0x99E2, 0, + 0, 0, 0, 0, 0, 0,0x99E3, 0, +0x8B7A,0x9081, 0,0x95AB,0x99E1,0x99DD,0x8CE1, 0, +0x99DE, 0,0x9843, 0, 0, 0,0x95F0, 0, +0x92E6,0x8CE0,0x8D90, 0, 0, 0,0x99E6, 0, + 0,0x93DB, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x99EA, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8EFC, 0,0x8EF4, 0, 0, 0, 0, 0, +0x99ED,0x99EB, 0,0x96A1, 0,0x99E8,0x99F1,0x99EC, + 0, 0, 0,0x99EF,0x8CC4,0x96BD, 0, 0, +0x99F0, 0, 0, 0,0x99F2, 0,0x99F4, 0, + 0, 0,0xFA92,0x8DEE,0x9861, 0,0x99E9,0x99E7, +0x99F3, 0,0x99EE, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFA91, 0, 0, 0, + 0, 0,0x99F6, 0,0x9A42,0x99F8, 0, 0, +0x99FC,0xFA93, 0,0x9A40,0x99F9, 0, 0,0x9A5D, + 0, 0,0x8DE7,0x8A50, 0, 0, 0, 0, +0x99F7, 0, 0, 0,0x9A44,0x88F4,0x9A43, 0, +0x88A3,0x9569,0x9A41, 0,0x99FA, 0, 0,0x99F5, +0x99FB,0x8DC6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9A45, 0, 0, 0, 0, 0, 0, 0, + 0,0x88F5,0x9A4E, 0, 0,0x9A46,0x9A47, 0, +0x8FA3,0x9689, 0, 0, 0,0x9A4C,0x9A4B, 0, + 0, 0,0x934E, 0, 0, 0, 0, 0, + 0, 0,0x9A4D, 0, 0,0x9A4A, 0,0xFA94, + 0, 0, 0, 0,0x8953, 0,0x8DB4,0x904F, + 0, 0, 0, 0, 0, 0, 0,0x9A48, +0x9382, 0, 0, 0,0x9A49, 0,0x88A0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9A53,0x9742, + 0,0x8FA5, 0,0x9A59, 0, 0, 0, 0, +0x9A58,0x9A4F, 0, 0, 0, 0,0x91C1, 0, +0x9A50, 0, 0, 0,0x91ED,0x9A55,0x8FA4, 0, + 0, 0, 0, 0,0x9A52, 0, 0,0x96E2, + 0, 0, 0,0x8C5B, 0, 0,0x9A56,0x9A57, + 0, 0, 0, 0,0x9A54,0x9A5A, 0, 0, + 0, 0, 0,0x9A51, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9A60,0x9A65, 0,0x9A61, 0, +0x9A5C, 0, 0,0x9A66,0x9150, 0,0xFA95,0x9A68, + 0,0x8D41,0x9A5E,0x929D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9A62,0x9A5B,0x8AAB, 0,0x8AEC,0x8A85,0x9A63,0x9A5F, + 0, 0, 0, 0, 0, 0, 0,0x8C96, +0x9A69,0x9A67,0x9172,0x8B69,0x8BAA, 0,0x9A64, 0, +0x8BF2, 0, 0, 0, 0, 0,0x8963, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A6D,0x9A6B, 0,0x9AA5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A70, 0, 0, 0, + 0, 0,0x9A6A, 0,0x9A6E, 0, 0,0x9A6C, + 0, 0, 0,0x8E6B,0x9A6F, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9A72, + 0,0x9A77, 0, 0, 0,0x9A75,0x9A74, 0, + 0, 0, 0, 0, 0, 0,0x9251, 0, + 0,0x89C3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A71, 0,0x9A73,0x8FA6, +0x8952, 0, 0,0x9A76, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x89DC, 0, 0, 0, 0, 0,0x9A82, + 0,0x8FFA,0x9A7D, 0,0x9A7B, 0,0x9A7C, 0, +0x9A7E, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x895C, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9158, 0,0x9A78, 0, +0x9A79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8A9A, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A81, 0, 0, 0, +0x8AED, 0,0x9A84,0x9A80,0x9A83, 0, 0, 0, + 0, 0, 0, 0,0x95AC, 0, 0, 0, +0x93D3, 0,0x94B6, 0, 0, 0, 0, 0, +0x9A86, 0, 0, 0, 0, 0,0x9A85,0x8A64, + 0, 0,0x9A87, 0, 0, 0, 0,0x9A8A, + 0, 0, 0, 0,0x9A89, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9A88, 0,0x9458, 0, 0,0x9A8B, 0, 0, + 0, 0, 0, 0, 0, 0,0x9A8C, 0, + 0, 0, 0, 0,0x9A8E, 0,0x9A8D, 0, + 0, 0, 0, 0,0x9A90, 0, 0, 0, +0x9A93,0x9A91,0x9A8F,0x9A92, 0, 0, 0, 0, +0x9A94, 0, 0, 0, 0, 0,0x9A95, 0, + 0,0x9A96, 0,0x9A97, 0, 0, 0,0x9A98, +0x9964, 0,0x8EFA,0x8E6C, 0, 0,0x89F1, 0, +0x88F6, 0, 0,0x9263, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9A99, 0, +0x8DA2, 0,0x88CD,0x907D, 0, 0, 0, 0, + 0,0x9A9A,0x8CC5, 0, 0,0x8D91, 0,0x9A9C, +0x9A9B, 0, 0,0x95DE,0x9A9D, 0, 0, 0, +0x9A9F,0x9A9E, 0,0x9AA0, 0,0x9AA1, 0,0x8C97, + 0, 0,0x8980,0x9AA2, 0, 0,0x9AA4, 0, +0x9AA3, 0, 0, 0,0x9AA6, 0, 0,0x9379, + 0, 0, 0, 0, 0, 0,0x9AA7,0x88B3, +0x8DDD, 0, 0, 0, 0,0x8C5C, 0, 0, +0x926E, 0, 0, 0, 0, 0, 0,0x9AA8, +0x9AA9, 0, 0,0x9AAB, 0, 0, 0, 0, +0x9AAC, 0,0x8DE2, 0, 0, 0, 0,0x8BCF, + 0, 0,0x9656, 0, 0, 0,0x9AAA,0x9AAD, +0x8DBF,0x8D42, 0, 0, 0, 0, 0, 0, + 0,0xFA96, 0, 0, 0, 0, 0, 0, + 0,0x9AB1, 0, 0,0x8DA3,0xFA97,0x9252, 0, + 0,0x9AAE,0x92D8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9AB2, + 0, 0,0x9082, 0, 0, 0, 0, 0, +0x9AB0,0x9AB3, 0,0x8C5E, 0, 0, 0, 0, + 0, 0, 0,0x9AB4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9AB5, 0,0x8D43,0x8A5F,0x9AB7, 0, 0, 0, + 0, 0,0x9AB8, 0,0xFA98, 0, 0, 0, +0x9AB9, 0, 0,0x9AB6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9AAF, 0, 0,0x9ABA, 0, 0,0x9ABB,0xFA9A, +0xFA99, 0, 0,0x9684, 0, 0,0x8FE9, 0, + 0, 0,0x9ABD,0x9ABE,0x9ABC, 0,0x9AC0, 0, + 0, 0, 0, 0,0x9457, 0, 0,0x88E6, +0x9575, 0, 0,0x9AC1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8FFB, 0, 0,0x8EB7, + 0,0x947C,0x8AEE, 0,0x8DE9, 0, 0, 0, +0x9678, 0,0x93B0, 0, 0,0x8C98,0x91CD, 0, + 0, 0,0x9ABF,0x9AC2, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x91C2, 0, 0, + 0,0x9AC3, 0, 0, 0,0x9AC4, 0, 0, + 0,0x9AC6, 0, 0,0x92E7, 0, 0, 0, + 0, 0,0x8AAC, 0, 0, 0, 0,0xEA9F, +0x8981,0x95F1, 0, 0,0x8FEA,0x9367, 0, 0, + 0, 0,0x8DE4, 0, 0,0x9ACC, 0, 0, +0x95BB,0x97DB, 0, 0, 0, 0, 0, 0, + 0, 0,0x89F2,0x9AC8, 0, 0, 0, 0, + 0,0x9159,0x9ACB, 0,0x9383, 0, 0,0x9368, +0x9384,0x94B7,0x92CB, 0, 0, 0,0x8DC7, 0, + 0, 0,0x9AC7, 0, 0, 0, 0, 0, + 0,0x8996, 0,0x9355, 0, 0, 0, 0, +0x9AC9, 0,0x9AC5, 0, 0,0x906F, 0, 0, + 0,0x9ACD, 0, 0, 0, 0,0x8F6D, 0, + 0, 0, 0,0x8BAB, 0,0x9ACE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x95E6, 0, 0, 0,0x919D, + 0, 0, 0, 0,0x92C4, 0,0xFA9D,0x9AD0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x966E, 0, 0,0x9AD1, 0, 0,0x9AD6, 0, + 0, 0,0xFA9E,0x95AD, 0, 0, 0, 0, +0x9AD5,0x9ACF,0x9AD2,0x9AD4, 0, 0,0x8DA4, 0, + 0,0x95C7, 0, 0, 0,0x9AD7, 0,0x9264, + 0, 0,0x89F3, 0,0x8FEB, 0, 0, 0, + 0,0x9AD9, 0,0x9AD8, 0,0x8D88, 0,0x9ADA, +0x9ADC,0x9ADB, 0, 0,0x9ADE, 0,0x9AD3,0x9AE0, + 0, 0, 0, 0,0x9ADF,0x9ADD, 0, 0, + 0, 0, 0,0x8E6D,0x9070, 0,0x9173,0x9AE1, +0x90BA,0x88EB,0x9484, 0, 0, 0, 0,0x92D9, + 0,0x9AE3,0x9AE2,0x9AE4,0x9AE5,0x9AE6, 0, 0, + 0, 0,0x9AE7, 0, 0, 0, 0, 0, + 0,0x95CF,0x9AE8,0xFA9F, 0, 0, 0,0x89C4, +0x9AE9, 0, 0, 0, 0,0x975B,0x8A4F, 0, +0x99C7,0x8F67,0x91BD,0x9AEA,0x96E9, 0, 0, 0, + 0, 0,0x96B2, 0, 0,0x9AEC, 0,0x91E5, + 0,0x9356,0x91BE,0x9576,0x9AED,0x9AEE,0x899B, 0, + 0,0x8EB8,0x9AEF, 0, 0, 0, 0,0x88CE, +0x9AF0, 0, 0, 0, 0, 0,0x9AF1, 0, + 0, 0, 0, 0,0x8982, 0, 0,0x8AEF, +0x93DE,0x95F2, 0, 0, 0, 0,0x9AF5,0x9174, +0x9AF4,0x8C5F, 0,0xFAA0,0x967A,0x9AF3, 0,0x9385, +0x9AF7, 0,0x9AF6,0xFAA1, 0,0xFAA2, 0, 0, +0x9AF9, 0,0x9AF8,0xFAA3, 0,0x899C, 0,0x9AFA, +0x8FA7,0x9AFC,0x9244, 0,0x9AFB, 0,0x95B1, 0, + 0, 0, 0,0x8F97,0x937A, 0, 0, 0, +0x9B40, 0, 0, 0, 0,0x8D44, 0, 0, + 0,0x9B41,0x9440,0x94DC,0x96CF, 0, 0, 0, + 0, 0,0x9444, 0, 0,0x9B4A, 0, 0, + 0, 0, 0,0x8B57, 0, 0,0x9764, 0, + 0,0x96AD, 0,0x9BAA, 0,0x9B42, 0, 0, + 0, 0, 0,0x9B45,0xFAA4,0x91C3, 0, 0, +0x9657, 0, 0, 0,0x9369, 0, 0, 0, + 0, 0,0x9B46, 0, 0, 0, 0, 0, + 0,0x9685,0xFAA5,0x8DC8, 0, 0,0x8FA8, 0, + 0, 0, 0, 0, 0, 0,0x9B47, 0, + 0,0x8E6F, 0,0x8E6E, 0, 0, 0, 0, +0x88B7,0x8CC6, 0,0x90A9,0x88CF, 0, 0, 0, + 0,0x9B4B,0x9B4C, 0,0x9B49, 0, 0, 0, + 0, 0, 0, 0, 0,0x8957,0x8AAD, 0, +0x9B48, 0,0x96C3,0x9550, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x88A6, 0, + 0, 0, 0,0x88F7, 0, 0, 0,0x8E70, + 0,0x88D0, 0,0x88A1, 0, 0, 0, 0, + 0,0x9B51, 0, 0, 0, 0, 0, 0, + 0,0x9B4F, 0, 0, 0, 0, 0, 0, +0x96BA, 0,0x9B52, 0,0x9B50, 0, 0,0x9B4E, +0x9050, 0, 0, 0, 0,0x9B4D, 0, 0, + 0,0x95D8, 0, 0, 0, 0, 0,0x8CE2, + 0, 0, 0, 0, 0,0x9B56,0x9B57, 0, + 0, 0, 0, 0,0x8FA9, 0, 0, 0, +0x9B53,0x984B, 0, 0, 0, 0,0x946B, 0, + 0,0x9B55, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8DA5, 0, 0, 0, 0, 0, + 0, 0,0x9B58, 0, 0, 0,0x9577, 0, + 0, 0,0x9B59, 0,0x9B54, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x96B9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x947D, 0, 0, 0, 0, 0, + 0, 0,0x9B5A,0x9551, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9B5B,0x9B5F,0x9B5C, 0, + 0,0x89C5,0x9B5E, 0, 0, 0, 0, 0, + 0,0x8EB9, 0,0x9B5D,0x8C99, 0, 0, 0, +0x9B6B, 0, 0, 0, 0, 0,0x9B64,0x9B61, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9284, 0,0x9B60, 0, 0,0x9B62, 0, + 0,0x9B63, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9B65,0x9B66, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AF0, 0,0x9B68,0x9B67, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9B69, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8FEC, 0, 0, 0, 0, 0, + 0, 0,0x9B6C, 0,0x92DA, 0, 0, 0, +0x8964, 0,0x9B6A, 0, 0, 0,0x9B6D, 0, + 0, 0, 0, 0, 0, 0,0x9B6E, 0, +0x9B71, 0, 0,0x9B6F, 0,0x9B70, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E71,0x9B72, 0, 0,0x8D45,0x9B73,0xFAA6,0x8E9A, +0x91B6, 0,0x9B74,0x9B75,0x8E79,0x8D46, 0,0x96D0, + 0, 0, 0,0x8B47,0x8CC7,0x9B76,0x8A77, 0, + 0,0x9B77, 0,0x91B7, 0, 0, 0, 0, +0x9B78,0x9BA1, 0,0x9B79, 0,0x9B7A, 0, 0, +0x9B7B, 0,0x9B7D, 0, 0, 0, 0, 0, +0x9B7E, 0, 0,0x9B80, 0,0x91EE, 0,0x8946, +0x8EE7,0x88C0, 0,0x9176,0x8AAE,0x8EB3, 0,0x8D47, + 0, 0, 0, 0, 0,0x9386, 0,0x8F40, +0x8AAF,0x9288,0x92E8,0x88B6,0x8B58,0x95F3, 0,0x8EC0, + 0, 0,0x8B71,0x90E9,0x8EBA,0x9747,0x9B81, 0, + 0, 0, 0, 0, 0, 0,0x8B7B, 0, +0x8DC9, 0, 0,0x8A51,0x8983,0x8FAA,0x89C6, 0, +0x9B82,0x9765, 0, 0, 0, 0, 0,0x8F68, +0xFAA7, 0,0x8EE2,0x9B83,0x8AF1,0x93D0,0x96A7,0x9B84, + 0,0x9B85, 0, 0,0x9578, 0, 0, 0, +0x9B87, 0,0x8AA6,0x8BF5,0x9B86, 0, 0, 0, +0xFAA9, 0, 0,0x8AB0, 0,0x9051,0x9B8B,0x8E40, + 0,0x89C7,0x9B8A, 0,0x9B88,0x9B8C,0x9B89,0x944A, +0x9ECB,0x9052, 0,0x9B8D,0xFAAA, 0,0x97BE, 0, +0x9B8E, 0, 0,0x9B90, 0,0x929E,0x9B8F, 0, +0x90A1, 0,0x8E9B, 0, 0, 0,0x91CE,0x8EF5, + 0,0x9595,0x90EA, 0,0x8ECB,0x9B91,0x8FAB,0x9B92, +0x9B93,0x88D1,0x91B8,0x9071, 0,0x9B94,0x93B1,0x8FAC, + 0,0x8FAD, 0,0x9B95, 0, 0,0x90EB, 0, + 0, 0,0x8FAE, 0, 0, 0,0xFAAB, 0, +0x9B96, 0,0x9B97, 0,0x96DE, 0, 0, 0, +0x9B98, 0, 0, 0, 0,0x8BC4, 0, 0, + 0,0x8F41, 0, 0, 0, 0, 0, 0, +0x9B99,0x9B9A,0x8EDA,0x904B,0x93F2,0x9073,0x94F6,0x9441, +0x8BC7,0x9B9B, 0, 0, 0,0x8B8F,0x9B9C, 0, +0x8BFC, 0,0x93CD,0x89AE, 0,0x8E72,0x9B9D,0x9BA0, +0x9B9F,0x8BFB, 0,0x9B9E, 0,0x9357, 0, 0, + 0, 0, 0, 0, 0, 0,0x91AE, 0, +0x936A,0x8EC6, 0, 0,0x9177,0x979A, 0, 0, + 0, 0, 0, 0,0x9BA2, 0,0x9BA3,0x93D4, + 0,0x8E52, 0, 0, 0, 0,0x9BA5, 0, + 0,0x9BA6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9BA7, 0, 0, 0, +0x8AF2,0x9BA8, 0, 0,0x9BA9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x89AA, 0, 0, 0, 0,0xFAAC, 0, +0x915A,0x8AE2, 0,0x9BAB,0x96A6, 0, 0, 0, + 0,0x91D0, 0,0x8A78, 0, 0,0x9BAD,0x9BAF, +0x8ADD, 0,0xFAAD,0x9BAC,0x9BAE, 0,0x9BB1, 0, + 0, 0, 0, 0, 0,0x9BB0, 0,0x9BB2, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9BB3, 0, 0, 0, 0, 0, 0, +0x93BB,0x8BAC, 0, 0, 0, 0, 0, 0, +0x89E3,0x9BB4,0x9BB9, 0, 0,0x9BB7, 0,0x95F5, +0x95F4, 0, 0, 0, 0,0xFAAE,0x9387, 0, + 0, 0,0x9BB6,0x8F73, 0,0x9BB5, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9092, + 0, 0, 0,0x9BBA, 0, 0,0x8DE8, 0, + 0,0x9BC0, 0, 0,0x9BC1,0x9BBB,0x8A52,0x9BBC, +0x9BC5,0x9BC4,0x9BC3,0x9BBF, 0, 0, 0,0x9BBE, + 0, 0,0x9BC2, 0, 0, 0, 0,0xFAAF, + 0,0x95F6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xFAB2, 0, 0, 0, 0, 0, + 0, 0, 0,0x9BC9,0x9BC6, 0,0x9BC8, 0, +0x9792, 0,0x9BC7,0xFAB0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9BBD, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9093, 0, 0,0x9BCA,0xFAB3, 0,0x8DB5, + 0, 0, 0,0x9BCB, 0, 0,0x9BCC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9BCF, 0,0x9BCE, 0, 0,0x9BCD, + 0, 0, 0,0x9388,0x9BB8, 0, 0, 0, +0x9BD5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9BD1, 0, 0, + 0, 0,0x9BD0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9BD2, 0,0x9BD3, 0, + 0, 0, 0, 0, 0, 0, 0,0x9BD6, +0xFAB4,0xFAB5,0x97E4, 0,0x9BD7,0x9BD4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9BD8, 0, 0,0x8ADE,0x9BD9, 0, 0, +0xFAB6, 0,0x9BDB,0x9BDA, 0, 0,0x9BDC, 0, + 0, 0, 0,0x9BDD, 0,0x90EC,0x8F42, 0, + 0,0x8F84, 0,0x9183, 0,0x8D48,0x8DB6,0x8D49, +0x8B90, 0, 0,0x9BDE, 0, 0,0x8DB7, 0, + 0,0x8CC8,0x9BDF,0x96A4,0x9462,0x9BE0, 0,0x8D4A, + 0, 0, 0,0x8AAA, 0,0x9246,0x8BD0, 0, + 0, 0,0x8E73,0x957A, 0, 0,0x94BF, 0, + 0, 0, 0,0x9BE1,0x8AF3, 0, 0, 0, + 0,0x9BE4, 0, 0, 0, 0,0x929F, 0, + 0,0x9BE3,0x9BE2,0x9BE5, 0,0x92E9, 0, 0, + 0, 0, 0, 0, 0,0x9083, 0, 0, + 0, 0, 0,0x8E74, 0,0x90C8, 0,0x91D1, +0x8B41, 0, 0,0x92A0, 0, 0,0x9BE6,0x9BE7, +0x8FED, 0, 0, 0, 0,0x9658, 0, 0, +0x9BEA, 0, 0,0x9BE9,0x9BE8,0x959D, 0,0x9BF1, + 0, 0, 0, 0,0x9679, 0,0x9BEB, 0, + 0, 0, 0, 0,0x9BED,0x968B, 0,0x9BEC, + 0, 0, 0, 0, 0, 0, 0,0x9BEE, + 0,0x94A6,0x9BEF,0x95BC,0x9BF0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8AB1,0x95BD,0x944E,0x9BF2,0x9BF3, 0, +0x8D4B,0x8AB2,0x9BF4,0x8CB6,0x9763,0x9748,0x8AF4,0x9BF6, + 0,0x92A1, 0,0x8D4C,0x8FAF, 0, 0,0x94DD, + 0, 0,0x8FB0, 0, 0, 0, 0,0x8F98, + 0, 0, 0, 0, 0,0x92EA,0x95F7,0x9358, + 0, 0,0x8D4D, 0,0x957B, 0, 0, 0, +0x9BF7, 0, 0, 0, 0, 0,0x9378,0x8DC0, + 0, 0, 0,0x8CC9, 0,0x92EB, 0, 0, + 0, 0, 0, 0, 0,0x88C1,0x8F8E,0x8D4E, +0x9766, 0, 0, 0, 0, 0, 0, 0, + 0,0x9BF8,0x9BF9,0x9470, 0, 0, 0, 0, +0x9BFA,0x97F5,0x984C, 0, 0, 0, 0,0x9BFC, +0x9BFB, 0, 0,0x8A66, 0, 0,0x9C40, 0, + 0, 0,0x9C43,0x9C44, 0,0x9C42, 0,0x955F, +0x8FB1,0x9C46,0x9C45,0x9C41, 0, 0, 0, 0, +0x9C47,0x9C48, 0, 0,0x9C49, 0, 0, 0, +0x9C4C,0x9C4A, 0,0x9C4B,0x9C4D, 0,0x8984,0x92EC, +0x9C4E, 0,0x8C9A,0x89F4,0x9455, 0,0x9C4F,0x93F9, + 0,0x95D9, 0,0x9C50,0x984D, 0, 0, 0, + 0,0x9C51,0x95BE,0x9C54,0x989F,0x98AF, 0,0x8EAE, +0x93F3,0x9C55, 0,0x8B7C,0x92A2,0x88F8,0x9C56,0x95A4, +0x8D4F, 0, 0,0x926F, 0, 0, 0,0x92ED, + 0,0xFAB7, 0, 0, 0,0x96ED,0x8CB7,0x8CCA, + 0,0x9C57, 0, 0, 0,0x9C58, 0,0x9C5E, + 0,0x8EE3, 0, 0,0xFAB8,0x92A3, 0,0x8BAD, +0x9C59, 0, 0, 0,0x954A, 0,0x9265, 0, + 0,0x9C5A, 0, 0, 0,0xFA67, 0, 0, +0x9C5B, 0,0x8BAE, 0,0x9C5C, 0,0x9C5D, 0, + 0,0x9C5F, 0,0x9396, 0, 0,0x9C60,0x9C61, + 0,0x9C62, 0, 0,0x9C53,0x9C52, 0, 0, + 0,0x9C63,0x8C60, 0, 0, 0,0x9546,0xFAB9, + 0,0x8DCA,0x9556,0x92A4,0x956A,0x9C64, 0, 0, +0x8FB2,0x8965, 0,0x9C65, 0, 0, 0,0x9C66, + 0,0x96F0, 0, 0,0x94DE, 0, 0,0x9C69, +0x899D,0x90AA,0x9C68,0x9C67,0x8C61,0x91D2, 0,0x9C6D, +0x9C6B, 0,0x9C6A,0x97A5,0x8CE3, 0, 0, 0, +0x8F99,0x9C6C,0x936B,0x8F5D, 0, 0, 0,0x93BE, +0x9C70,0x9C6F, 0, 0, 0, 0,0x9C6E, 0, +0x9C71,0x8CE4, 0, 0, 0, 0, 0, 0, +0x9C72,0x959C,0x8F7A, 0, 0,0x9C73,0x94F7, 0, + 0, 0, 0,0x93BF,0x92A5, 0, 0,0xFABA, + 0,0x934F, 0, 0,0x9C74,0x8B4A, 0, 0, + 0, 0, 0,0x9053, 0,0x954B, 0, 0, + 0, 0, 0, 0,0x8AF5,0x9445, 0, 0, + 0, 0, 0, 0, 0, 0,0x9C75,0x8E75, +0x9659,0x965A, 0, 0,0x899E,0x9C7A,0xFABB, 0, +0x9289, 0, 0, 0,0x9C77, 0, 0, 0, + 0, 0, 0,0x89F5, 0, 0, 0, 0, +0x9CAB,0x9C79, 0, 0, 0,0x944F, 0, 0, +0x9C78, 0, 0,0x9C76, 0,0x8D9A, 0,0x9C7C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9C83,0x9C89, +0x9C81, 0,0x937B, 0, 0,0x9C86,0x957C, 0, + 0,0x9C80, 0,0x9C85,0x97E5,0x8E76, 0, 0, +0x91D3,0x9C7D, 0, 0, 0,0x8B7D,0x9C88,0x90AB, +0x8985,0x9C82,0x89F6,0x9C87, 0, 0, 0,0x8BAF, + 0,0x9C84, 0, 0, 0, 0, 0, 0, + 0, 0,0x9C8A, 0, 0, 0, 0, 0, + 0,0x9C8C,0x9C96,0x9C94, 0, 0,0x9C91, 0, + 0, 0,0x9C90,0x97F6, 0,0x9C92, 0, 0, +0x8BB0, 0,0x8D50, 0, 0,0x8F9A, 0, 0, + 0,0x9C99,0x9C8B, 0, 0,0xFABC, 0,0x9C8F, +0x9C7E, 0,0x89F8,0x9C93,0x9C95,0x9270, 0, 0, +0x8DA6,0x89B6,0x9C8D,0x9C98,0x9C97,0x8BB1, 0,0x91A7, +0x8A86, 0, 0, 0, 0,0x8C62, 0,0x9C8E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9C9A, 0,0x9C9D,0x9C9F,0xFABD, 0, 0, + 0,0x8EBB,0xFABE,0x9CA5,0x92EE,0x9C9B, 0, 0, + 0, 0,0x9CA3, 0,0x89F7, 0,0x9CA1,0x9CA2, + 0, 0,0x9C9E,0x9CA0, 0, 0, 0,0x8CE5, +0x9749, 0, 0,0x8AB3, 0, 0,0x8978,0x9CA4, + 0,0x9459,0x88AB, 0, 0, 0, 0, 0, + 0, 0,0x94DF,0x9C7B,0x9CAA,0x9CAE,0x96E3, 0, +0x9CA7, 0, 0, 0,0x9389,0x9CAC, 0, 0, + 0, 0, 0, 0, 0,0x8FEE,0x9CAD,0x93D5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9866, 0,0x9CA9, 0,0xFAC0, 0, 0, +0x9CAF, 0,0x8D9B, 0,0x90C9, 0,0xFABF,0x88D2, +0x9CA8,0x9CA6, 0,0x9179, 0, 0, 0,0x9C9C, +0x8E53, 0, 0, 0, 0, 0, 0, 0, +0x91C4,0x9CBB,0xFAC2,0x917A,0x9CB6, 0,0x9CB3,0x9CB4, + 0,0x8EE4,0x9CB7,0x9CBA, 0, 0, 0, 0, +0x9CB5,0x8F44, 0,0x9CB8, 0, 0,0x9CB2, 0, +0x96FA,0x96F9, 0, 0, 0,0x9CBC,0x9CBD,0x88D3, + 0,0xFAC3, 0, 0, 0,0x9CB1, 0, 0, + 0, 0,0x8BF0,0x88A4, 0, 0, 0,0x8AB4, +0xFAC1,0x9CB9, 0, 0, 0, 0, 0,0x9CC1, +0x9CC0, 0, 0, 0,0x9CC5, 0, 0, 0, +0xFAC5, 0, 0, 0,0x9CC6, 0, 0,0xFAC4, + 0, 0, 0, 0,0x9CC4,0x9CC7,0x9CBF,0x9CC3, + 0, 0,0x9CC8, 0,0x9CC9, 0, 0,0x9CBE, +0x8E9C, 0,0x9CC2,0x91D4,0x8D51,0x9CB0,0x9054, 0, + 0, 0, 0,0x9CD6, 0,0x95E7, 0, 0, +0x9CCC,0x9CCD,0x9CCE, 0, 0,0x9CD5, 0,0x9CD4, + 0, 0,0x969D,0x8AB5, 0,0x9CD2, 0,0x8C64, +0x8A53, 0, 0,0x9CCF, 0, 0,0x97B6,0x9CD1, +0x88D4,0x9CD3, 0,0x9CCA,0x9CD0,0x9CD7,0x8C63,0x9CCB, + 0, 0, 0, 0, 0, 0,0x977C, 0, + 0, 0,0x974A, 0, 0, 0, 0,0x9CDA, + 0, 0,0x9CDE, 0, 0, 0,0x919E, 0, +0x97F7,0x9CDF, 0, 0,0x9CDC, 0,0x9CD9, 0, +0xFAC6,0x9CD8,0x9CDD, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x95AE, 0, 0,0x93B2, + 0,0x8C65, 0,0x9CE0,0x9CDB, 0,0x9CE1, 0, + 0, 0,0x8C9B, 0, 0, 0,0x89AF, 0, + 0, 0,0x9CE9, 0, 0, 0,0x8AB6, 0, + 0, 0, 0,0x9CE7, 0, 0,0x9CE8,0x8DA7, +0x9CE6,0x9CE4,0x9CE3,0x9CEA,0x9CE2,0x9CEC, 0, 0, +0x89F9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9CEE, 0, 0,0x9CED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x92A6, 0,0x9CF1, 0,0x9CEF,0x9CE5, +0x8C9C, 0,0x9CF0, 0,0x9CF4,0x9CF3,0x9CF5,0x9CF2, +0x9CF6, 0, 0, 0, 0, 0, 0, 0, +0x9CF7,0x9CF8,0x95E8, 0,0x9CFA,0x9CF9,0x8F5E, 0, +0x90AC,0x89E4,0x89FA,0xFAC7,0x9CFB, 0,0x88BD, 0, + 0, 0,0x90CA,0x9CFC, 0,0xE6C1,0x9D40,0x8C81, + 0,0x9D41, 0, 0, 0, 0,0x90ED, 0, + 0, 0,0x9D42, 0, 0, 0,0x9D43,0x8B59, +0x9D44, 0,0x9D45,0x9D46,0x91D5, 0, 0, 0, +0x8CCB, 0, 0,0x96DF, 0, 0, 0,0x965B, +0x8F8A,0x9D47, 0, 0, 0, 0, 0,0x90EE, +0xE7BB,0x94E0, 0,0x8EE8, 0,0x8DCB,0x9D48, 0, + 0, 0, 0,0x91C5, 0,0x95A5, 0, 0, +0x91EF, 0, 0,0x9D4B, 0, 0,0x9D49, 0, +0x9D4C, 0, 0,0x9D4A, 0, 0, 0, 0, +0x9D4D, 0, 0, 0, 0, 0,0x95AF, 0, + 0,0x88B5, 0, 0, 0, 0,0x957D, 0, + 0,0x94E1, 0, 0,0x9D4E, 0,0x9D51,0x8FB3, +0x8B5A, 0,0x9D4F,0x9D56,0x8FB4, 0, 0, 0, + 0,0x9D50,0x9463, 0, 0, 0, 0, 0, + 0,0x977D,0x9D52,0x9D53,0x9D57,0x938A,0x9D54,0x8D52, +0x90DC, 0, 0,0x9D65,0x94B2, 0,0x91F0, 0, + 0, 0, 0, 0, 0, 0,0xFAC8, 0, + 0, 0, 0,0x94E2,0x9DAB, 0, 0, 0, + 0,0x95F8, 0, 0, 0,0x92EF, 0, 0, + 0,0x9695, 0,0x9D5A,0x899F,0x928A, 0, 0, + 0, 0,0x9D63, 0, 0,0x9253,0x9D5D,0x9D64, +0x9D5F,0x9D66,0x9D62, 0,0x9D61,0x948F, 0,0x9D5B, +0x89FB,0x9D59,0x8B91,0x91F1,0x9D55, 0, 0,0x9D58, +0x8D53,0x90D9, 0,0x8FB5,0x9D60,0x9471, 0, 0, +0x8B92,0x8A67, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8A87,0x9040,0x9D68,0x9D6D, + 0,0x9D69, 0,0x8C9D, 0,0x9D6E,0x8E41,0x8D89, + 0, 0, 0, 0, 0, 0,0x8F45,0x9D5C, + 0,0x8E9D,0x9D6B, 0, 0, 0, 0,0x8E77, +0x9D6C,0x88C2, 0, 0,0x9D67, 0, 0, 0, + 0,0x92A7, 0, 0, 0, 0, 0, 0, + 0,0x8B93, 0, 0, 0, 0, 0,0x8BB2, + 0, 0, 0, 0, 0, 0, 0,0x9D6A, +0x88A5, 0, 0,0x8DC1, 0, 0, 0,0x9055, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x92F0, 0, 0,0x94D2,0x9D70,0x917D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x91A8, 0, 0,0x8E4A,0x9D71, 0,0x9D73, +0x9D6F, 0, 0, 0, 0,0x95DF, 0,0x92BB, + 0, 0, 0, 0,0x917B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x95F9, +0x8ECC,0x9D80, 0,0x9D7E, 0, 0,0x9098, 0, + 0, 0,0x8C9E, 0, 0, 0,0x9D78,0x8FB7, + 0, 0,0x93E6,0x9450, 0, 0, 0, 0, +0x9D76, 0, 0,0x917C, 0, 0, 0, 0, +0x8EF6,0x9D7B, 0, 0,0x8FB6, 0,0x9D75,0x9D7A, + 0, 0,0x9472, 0, 0, 0,0x9D74, 0, +0x8C40, 0, 0,0x8A7C, 0, 0, 0,0x9D7C, +0x97A9,0x8DCC,0x9254,0x9D79, 0,0x90DA, 0,0x8D54, +0x9084,0x8986,0x915B,0x9D77,0x8B64, 0, 0, 0, + 0, 0,0x8C66, 0,0x92CD,0x9D7D, 0, 0, + 0, 0, 0,0x917E, 0, 0,0x9D81, 0, +0x9D83, 0, 0,0x91B5,0x9D89, 0,0x9D84, 0, + 0,0x9D86, 0, 0, 0, 0, 0,0x9560, +0x92F1, 0,0x9D87, 0, 0, 0,0x974B, 0, + 0, 0,0x9767,0x8AB7, 0, 0, 0, 0, + 0,0x88AC, 0,0x9D85, 0, 0, 0, 0, + 0,0x9D82, 0, 0, 0, 0,0x8AF6, 0, + 0, 0, 0, 0,0x8987,0xFAC9,0x9D88, 0, + 0, 0,0x9768, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9D8C, 0, + 0, 0, 0, 0, 0,0x91B9, 0,0x9D93, + 0, 0, 0,0x9D8D, 0, 0,0x9D8A,0x9D91, + 0, 0, 0, 0,0x9D72, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9D8E, 0, +0x9D92, 0, 0, 0,0x94C0,0x938B, 0, 0, + 0, 0, 0, 0,0x9D8B, 0,0x9D8F, 0, + 0, 0,0x8C67, 0, 0, 0,0x8DEF, 0, + 0, 0,0x90DB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9D97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9345, 0, 0, 0, 0, 0, 0, 0, +0xFACA, 0, 0, 0, 0, 0, 0,0x9D94, + 0,0x9680, 0, 0, 0, 0, 0,0x9D95, + 0, 0, 0, 0, 0, 0,0x9D96, 0, +0x96CC, 0,0x90A0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8C82, 0, 0, 0, 0, +0x9D9D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8E54,0x9D9A, 0,0x9D99, 0, 0, + 0, 0,0x9451, 0, 0,0xFACB,0x93B3, 0, + 0, 0, 0, 0,0x9350,0x9D9B, 0, 0, + 0,0x9D9C, 0,0x958F, 0,0x9464,0x8E42, 0, +0x90EF, 0,0x966F, 0, 0, 0, 0, 0, + 0,0x8A68, 0,0x9DA3,0x9D9E, 0, 0, 0, + 0,0x9769,0x9DA5, 0, 0,0x9DA1, 0,0x9DA2, + 0, 0, 0, 0, 0,0x9180,0xFACC, 0, + 0, 0,0x9DA0, 0,0x9D5E, 0, 0, 0, +0x9DA4, 0,0x9D9F, 0, 0, 0, 0, 0, +0x9DA9,0x9DAA,0x9346,0x9DAC, 0, 0,0x8E43,0x9DA7, + 0, 0, 0, 0,0x8B5B, 0, 0,0x9DAD, + 0,0x9DA6,0x9DB1, 0,0x9DB0, 0,0x9DAF, 0, + 0, 0,0x9DB2, 0, 0,0x9DB4,0x8FEF, 0, +0x9DB3, 0, 0, 0, 0,0x9DB7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9DB5, 0, 0, 0,0x9DB6,0x9D90, 0, 0, + 0, 0, 0,0x9DB9,0x9DB8, 0, 0, 0, + 0, 0,0x9D98,0x9DBA,0x9DAE, 0, 0,0x8E78, + 0, 0, 0, 0,0x9DBB,0x9DBC,0x9DBE,0x9DBD, +0x9DBF,0x89FC, 0,0x8D55, 0, 0,0x95FA,0x90AD, + 0, 0, 0, 0, 0,0x8CCC, 0, 0, +0x9DC1, 0, 0, 0, 0,0x9DC4,0xFACD,0x9571, + 0,0x8B7E, 0, 0, 0,0x9DC3,0x9DC2,0x9473, +0x9DC5,0x8BB3, 0, 0, 0,0x9DC7,0x9DC6, 0, + 0, 0,0x8AB8,0x8E55, 0, 0,0x93D6, 0, + 0, 0, 0, 0,0x8C68, 0, 0, 0, +0x9094, 0,0x9DC8, 0,0x90AE,0x9347, 0,0x957E, +0x9DC9, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9DCA,0x9DCB, 0, 0, 0,0x95B6, +0x9B7C,0x90C4, 0, 0,0x956B, 0,0x8DD6, 0, +0x94E3,0x94C1, 0, 0, 0, 0, 0,0x936C, + 0,0x97BF, 0,0x9DCD,0x8ECE, 0, 0,0x9DCE, + 0,0x88B4, 0, 0,0x8BD2,0x90CB, 0,0x9580, + 0, 0, 0,0x9DCF,0x8E61,0x9266, 0,0x8E7A, +0x9056, 0, 0, 0, 0, 0, 0,0x9DD0, + 0,0x95FB, 0, 0,0x8997,0x8E7B, 0, 0, + 0,0x9DD3, 0,0x9DD1,0x9DD4,0x97B7,0x9DD2, 0, + 0, 0, 0,0x90F9,0x9DD5, 0, 0,0x91B0, + 0, 0,0x9DD6, 0, 0, 0, 0,0x8AF8, + 0,0x9DD8, 0,0x9DD7, 0, 0, 0, 0, +0x9DD9,0x9DDA,0x8AF9, 0, 0,0x93FA,0x9255,0x8B8C, +0x8E7C,0x9181, 0, 0,0x8F7B,0x88AE, 0, 0, + 0,0x9DDB, 0, 0, 0, 0, 0, 0, + 0, 0,0x89A0,0x9DDF, 0, 0, 0, 0, +0xFACE, 0,0x8D56,0x9DDE, 0, 0,0x8DA9,0x8FB8, + 0,0xFAD1,0x9DDD, 0,0x8FB9, 0,0x96BE,0x8DA8, + 0, 0, 0,0x88D5,0x90CC,0xFACF, 0, 0, + 0, 0, 0, 0,0x9DE4, 0,0xFAD3,0x90AF, +0x8966, 0, 0, 0,0xFAD4,0x8F74, 0,0x9686, +0x8DF0, 0, 0, 0, 0,0x8FBA,0xFAD2,0x90A5, + 0,0xFA63, 0, 0,0x9DE3,0x9DE1,0x9DE2, 0, + 0, 0, 0,0xFAD0,0x928B, 0, 0,0x9E45, + 0,0x9DE8,0x8E9E,0x8D57,0x9DE6, 0, 0, 0, + 0,0x9DE7, 0,0x9057, 0, 0, 0,0x9DE5, + 0, 0,0x8E4E, 0, 0, 0, 0,0xFAD6, + 0,0xFAD7, 0, 0, 0,0x9DEA,0x9DE9,0x9DEE, + 0,0xFAD7,0x9DEF, 0,0x9DEB,0xFAD5,0x8A41,0x9DEC, +0x9DED,0x94D3, 0, 0, 0, 0,0x9581,0x8C69, +0x9DF0, 0, 0,0xFAD9,0x90B0, 0,0x8FBB, 0, + 0, 0,0x9271, 0, 0, 0, 0, 0, + 0,0x8BC5, 0,0x9DF1,0x9DF5, 0, 0,0x89C9, +0x9DF2,0x9DF4, 0, 0, 0, 0,0x9DF3, 0, + 0,0x8F8B, 0, 0, 0, 0,0x9267,0x88C3, +0x9DF6,0xFADA, 0, 0, 0,0x9DF7, 0, 0, +0xFADB, 0,0x92A8, 0, 0, 0,0x97EF, 0, + 0, 0, 0,0x8E62, 0, 0,0x95E9, 0, + 0, 0,0xFADC, 0,0x965C, 0, 0, 0, +0x9E41,0x9DF9, 0, 0,0x9DFC, 0,0x9DFB,0xFADD, + 0,0x9DF8, 0, 0,0x9E40, 0, 0,0x93DC, + 0,0x9DFA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9E42, 0, + 0,0x8F8C,0x9E43, 0,0x976A,0x9498, 0, 0, +0x9E44, 0, 0, 0, 0, 0,0x9E46, 0, + 0,0x9E47, 0, 0, 0, 0, 0, 0, +0x9E48, 0,0x8BC8,0x8967,0x8D58,0x9E49, 0,0x9E4A, +0x8F91,0x9182,0xFADE,0xFA66,0x99D6,0x915D,0x915C,0x91D6, +0x8DC5, 0, 0,0x98F0, 0, 0, 0, 0, +0x8C8E,0x974C, 0,0x95FC, 0,0x959E,0xFADF,0x9E4B, + 0, 0, 0, 0,0x8DF1,0x92BD,0x9E4C,0x984E, + 0, 0, 0,0x965D, 0,0x92A9,0x9E4D,0x8AFA, + 0, 0, 0, 0, 0, 0,0x9E4E,0x9E4F, +0x96D8, 0,0x96A2,0x9696,0x967B,0x8E44,0x9E51, 0, + 0,0x8EE9, 0, 0,0x9670, 0,0x9E53,0x9E56, +0x9E55, 0,0x8AF7, 0, 0,0x8B80, 0,0x9E52, + 0,0x9E54, 0, 0, 0, 0,0x9E57, 0, + 0,0x9099, 0, 0, 0, 0,0x979B,0x88C7, +0x8DDE,0x91BA, 0,0x8EDB, 0, 0,0x8FF1, 0, + 0,0x9E5A, 0, 0,0x936D, 0,0x9E58,0x91A9, +0x9E59,0x8FF0,0x96DB,0x9E5B,0x9E5C,0x9788,0xFAE1, 0, + 0, 0,0x9E61, 0, 0,0x8D59, 0,0x9474, +0x9E5E,0x938C,0x9DDC,0x9DE0, 0,0x8B6E, 0,0x9466, + 0, 0, 0, 0,0x9E60, 0,0x8FBC,0x94C2, + 0, 0, 0, 0, 0,0x9E66, 0,0x94F8, + 0,0x9E5D, 0,0x9E63,0x9E62, 0, 0, 0, +0x90CD, 0, 0, 0, 0,0x968D, 0,0x97D1, + 0, 0,0x9687, 0,0x89CA,0x8E7D, 0, 0, +0x9867,0x9E65,0x9095, 0, 0, 0,0x9E64, 0, + 0,0x9E5F, 0, 0, 0, 0, 0,0x8CCD, + 0, 0, 0,0x9E6B,0x9E69, 0,0x89CB,0x9E67, +0x9E6D,0x9E73, 0,0xFAE2, 0, 0, 0, 0, +0xFAE4,0x91C6, 0, 0,0x95BF, 0,0x9E75, 0, + 0, 0,0x9541, 0, 0, 0,0x9E74,0x9490, +0x965E,0x8AB9, 0,0x90F5,0x8F5F, 0, 0, 0, +0x92D1, 0,0x974D, 0, 0,0x9E70,0x9E6F, 0, + 0, 0,0x9E71, 0,0x9E6E, 0, 0,0x9E76, + 0,0x9E6C, 0, 0,0x9E6A, 0,0x9E72,0x9E68, + 0,0x928C, 0,0x96F6,0x8EC4,0x8DF2, 0, 0, + 0, 0, 0,0x8DB8, 0, 0,0x968F,0x8A60, + 0,0xFAE5,0x92CC,0x93C8,0x8968, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x90F0, 0, 0,0x90B2,0x8C49, + 0, 0, 0, 0, 0, 0,0x9E78, 0, + 0,0x8D5A,0x8A9C, 0, 0, 0, 0, 0, + 0,0x9E7A,0x8A94,0x9E81, 0, 0, 0, 0, + 0, 0,0x9E7D, 0,0x90F1, 0, 0, 0, +0x8A6A,0x8DAA, 0, 0,0x8A69,0x8DCD, 0, 0, +0x9E7B,0x8C85,0x8C6A,0x938D,0xFAE6, 0,0x9E79, 0, +0x88C4, 0, 0, 0, 0,0x9E7C,0x9E7E, 0, +0x8BCB,0x8C4B,0xFAE3,0x8ABA,0x8B6A, 0, 0, 0, + 0,0x9E82, 0, 0,0x8DF7,0x9691, 0,0x8E56, + 0, 0, 0,0x9E83, 0, 0, 0,0x954F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9E8F, 0,0x89B1,0x9E84, + 0, 0, 0, 0, 0, 0,0x9E95,0x9E85, + 0,0x97C0, 0,0x9E8C, 0,0x947E, 0, 0, + 0, 0, 0, 0, 0,0x9E94, 0,0x9E87, + 0, 0, 0,0x88B2,0x9E89, 0, 0,0x8D5B, + 0, 0, 0,0x9E8B, 0,0x9E8A, 0,0x9E86, +0x9E91, 0,0x8FBD, 0, 0, 0,0x9AEB,0x8CE6, +0x979C, 0, 0, 0, 0,0x9E88, 0,0x92F2, +0x8A42,0x8DAB, 0,0x9E80, 0,0x9E90,0x8A81, 0, + 0,0x9E8E,0x9E92, 0,0x938E, 0, 0, 0, + 0, 0, 0, 0,0x8AFC, 0,0x9EB0, 0, +0xFA64,0x96C7,0x9E97,0x8AFB, 0,0x9E9E, 0,0xFAE7, + 0, 0,0x965F, 0,0x9E9F,0x9EA1, 0,0x9EA5, +0x9E99, 0,0x9249, 0, 0, 0, 0,0x938F, +0x9EA9,0x9E9C, 0,0x9EA6, 0, 0, 0,0x9EA0, + 0, 0, 0, 0, 0, 0,0x9058,0x9EAA, + 0, 0,0x90B1, 0, 0, 0, 0, 0, + 0,0x9EA8,0x8ABB, 0, 0, 0, 0, 0, +0x986F,0x9E96, 0, 0,0x9EA4,0x88D6, 0, 0, +0x9E98, 0, 0,0x96B8,0x9E9D,0x9041,0x92C5,0x9E93, + 0, 0,0x9EA3, 0, 0, 0, 0, 0, + 0,0x909A,0x9EAD,0x8A91,0x8C9F, 0, 0, 0, + 0,0x9EAF,0x9E9A,0x9EAE, 0,0x9EA7,0x9E9B, 0, +0x9EAB, 0,0x9EAC, 0, 0, 0, 0, 0, +0x9EBD, 0, 0, 0,0x93CC, 0,0x9EA2, 0, + 0,0x9EB9, 0, 0, 0,0x9EBB, 0,0x92D6, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x976B, 0, 0, 0, 0, 0, + 0, 0, 0,0x9596,0x9EB6,0x91C8, 0, 0, + 0,0x9EBC,0x915E, 0,0x9EB3,0x9EC0,0x9EBF, 0, +0x93ED,0x9EBE,0x93E8, 0, 0, 0, 0, 0, +0xFAE9, 0,0x9EC2,0x9EB5, 0,0x8BC6,0x9EB8,0x8F7C, + 0, 0, 0,0x9480,0x9EBA,0x8BC9, 0,0x9EB2, +0x9EB4,0x9EB1, 0, 0,0x984F,0x8A79,0x9EB7, 0, + 0,0x9EC1,0x8A54, 0, 0, 0, 0, 0, + 0, 0,0x8DE5, 0, 0, 0,0x897C, 0, + 0,0x9ED2, 0, 0,0x9850,0x9ED5, 0, 0, +0xFAEB, 0, 0,0x9059,0x9ED4, 0, 0, 0, +0x9ED3, 0, 0, 0, 0, 0, 0,0x9ED0, + 0, 0, 0, 0, 0, 0,0x9EC4, 0, + 0,0x9EE1,0x9EC3, 0,0x9ED6, 0, 0, 0, + 0, 0, 0,0x9ECE, 0, 0,0x9EC9,0x9EC6, + 0,0x9EC7, 0,0x9ECF, 0, 0, 0,0xEAA0, + 0, 0,0x9ECC,0x8D5C,0x92C6,0x9184,0x9ECA, 0, +0x9EC5, 0, 0,0x9EC8, 0, 0, 0, 0, +0x976C,0x968A, 0, 0, 0,0x9ECD,0x9ED7, 0, + 0, 0,0xFAEC, 0, 0, 0, 0,0x9EDF, +0x9ED8, 0, 0,0x9EE5, 0,0x9EE3, 0, 0, + 0, 0,0x9EDE, 0, 0, 0, 0, 0, + 0,0x9EDD, 0,0x92CE, 0,0x9185, 0,0x9EDB, + 0, 0,0x9ED9, 0, 0,0x9EE0, 0, 0, + 0, 0,0x9EE6,0x94F3,0x9EEC, 0, 0, 0, + 0, 0,0x9EE7,0x9EEA,0x9EE4, 0, 0,0x9294, + 0,0x9557, 0,0x9EDA, 0, 0,0x9EE2,0x8FBE, + 0,0x96CD,0x9EF6,0x9EE9, 0, 0, 0, 0, + 0,0x8CA0,0x89A1,0x8A7E, 0, 0,0x9ED1, 0, +0xFAED, 0, 0, 0, 0,0x8FBF,0x9EEE, 0, +0x9EF5,0x8EF7,0x8A92, 0, 0,0x924D, 0, 0, + 0, 0, 0, 0,0x9EEB, 0,0xFAEF,0x9EF0, +0x9EF4, 0, 0,0x8BB4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B6B,0x9EF2, 0, 0, 0, 0, 0,0x8B40, + 0,0x93C9,0x9EF1, 0, 0, 0,0x9EF3, 0, + 0, 0, 0,0xFAEE, 0, 0, 0, 0, + 0, 0,0x9EED,0xFAF0, 0, 0, 0, 0, +0x9EEF, 0, 0, 0, 0, 0,0xFAF1,0x8A80, +0x9268, 0, 0, 0,0x9EFA, 0, 0, 0, + 0, 0, 0, 0, 0,0x9EF8,0x8CE7, 0, +0x9EF7, 0, 0, 0, 0, 0, 0,0x9F40, + 0, 0, 0, 0,0x9E77, 0, 0, 0, +0x9EF9, 0,0x9EFB,0x9EFC, 0, 0, 0, 0, + 0, 0,0x9F4B, 0,0x9F47, 0,0x9E8D, 0, + 0, 0, 0,0x9F46, 0, 0, 0, 0, +0x9F45, 0, 0,0x9F42, 0, 0, 0, 0, + 0,0x9EE8,0x9F44,0x9F43, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9F49, 0,0x9845, 0, 0, 0, 0, + 0, 0,0x9F4C,0x8BF9, 0, 0,0x9F48,0x9F4A, + 0, 0,0xFAF2, 0,0xFAF3, 0, 0, 0, +0x94A5, 0,0x9F4D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9F51,0x9F4E, 0, 0, 0, 0, + 0, 0, 0, 0,0x9793,0x9F4F, 0, 0, + 0, 0,0x9EDC, 0, 0, 0, 0, 0, + 0, 0,0x9F52, 0, 0, 0,0x9F53, 0, + 0, 0, 0, 0, 0,0x8954, 0,0x9F55, +0x8C87,0x8E9F, 0,0x8BD3, 0, 0, 0,0x89A2, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x977E, 0, 0, 0, 0,0x9F57, +0x9F56,0x9F59,0x8B5C, 0, 0,0x8BD4,0x8ABC, 0, + 0, 0, 0,0x9F5C, 0, 0, 0,0x9F5B, + 0,0x9F5D, 0, 0,0x89CC, 0,0x9256, 0, +0x9F5E, 0, 0,0x8ABD,0x9F60, 0, 0, 0, + 0,0x9F5F, 0,0x9F61, 0, 0, 0,0x9F62, + 0,0x9F63,0x8E7E,0x90B3,0x8D9F, 0,0x9590, 0, + 0,0x95E0,0x9863, 0, 0, 0, 0,0x8E95, + 0, 0, 0,0x8DCE,0x97F0, 0, 0, 0, +0x9F64,0x9F65, 0,0x8E80, 0, 0, 0,0x9F66, +0x9F67, 0, 0,0x9F69,0x9F68, 0,0x9677, 0, + 0,0x8F7D,0x8EEA,0x8E63, 0,0x9F6A, 0, 0, + 0, 0, 0, 0, 0,0x9F6C,0x9042, 0, +0x9F6B, 0, 0, 0, 0, 0,0x9F6D, 0, + 0, 0, 0, 0,0x9F6E, 0, 0, 0, + 0, 0,0x9F6F,0x9F70, 0, 0, 0,0x9F71, + 0,0x9F73,0x9F72,0x9F74,0x89A3,0x9269, 0,0x9F75, + 0, 0,0x8E45,0x8A6B,0x9F76, 0, 0,0x9361, +0x9ACA, 0, 0, 0, 0,0x8B42,0x9F77, 0, + 0, 0, 0,0x9F78, 0,0x95EA,0x9688, 0, + 0, 0,0x93C5,0x9F79,0x94E4, 0,0xFAF4, 0, +0x94F9, 0, 0,0x96D1, 0, 0, 0,0x9F7A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9F7C,0x9F7B, 0, 0,0x9F7E, + 0, 0, 0,0x9F7D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9F81, 0, 0, 0, 0, 0, 0,0x8E81, + 0,0x96AF, 0,0x9F82,0x9F83, 0, 0,0x8B43, + 0, 0, 0,0x9F84, 0, 0, 0, 0, + 0, 0, 0,0x9F86,0x9F85, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9085, 0, 0,0x9558, +0x8969, 0, 0, 0, 0, 0,0x94C3,0xFAF5, +0x92F3,0x8F60,0x8B81, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x94C4, 0, +0x8EAC, 0, 0, 0, 0,0x9F88, 0,0x8ABE, + 0, 0,0x8998, 0,0xFAF6,0x93F0,0x9F87,0x8D5D, +0x9272, 0,0x9F89, 0, 0, 0, 0, 0, +0x9F91, 0,0x9F8A, 0, 0, 0, 0,0xFAF8, +0x91BF, 0,0x8B82,0x9F92, 0, 0, 0, 0, + 0, 0,0x8C88, 0, 0,0x8B44,0x9F90, 0, + 0,0x9F8E,0x9F8B,0x9780, 0, 0,0xFAF7, 0, +0x92BE, 0, 0, 0,0x93D7,0x9F8C, 0, 0, +0x9F94, 0,0x9F93,0x8C42, 0, 0,0x89AB, 0, + 0,0x8DB9,0x9F8D,0x9F8F, 0, 0, 0, 0, + 0,0x9676,0x91F2, 0, 0, 0, 0, 0, + 0, 0, 0,0x9697, 0, 0,0x9F9C, 0, + 0,0x9F9D, 0,0x89CD, 0, 0, 0, 0, +0x95A6,0x96FB,0x9F9F,0x8EA1,0x8FC0,0x9F98,0x9F9E,0x8988, + 0,0x8BB5, 0, 0,0x9F95,0x9F9A, 0, 0, + 0,0x90F2,0x9491, 0,0x94E5, 0, 0, 0, + 0, 0, 0,0x9F97, 0,0x9640, 0,0x9F99, + 0,0x9FA2,0xFAF9,0x9FA0, 0,0x9F9B, 0, 0, + 0,0x9641,0x9467,0x8B83, 0,0x9344, 0, 0, +0x928D, 0,0x9FA3, 0, 0, 0, 0,0x9FA1, +0x91D7,0x9F96, 0,0x896A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFAFA, 0, 0, 0, + 0, 0, 0,0x976D,0x9FAE, 0, 0, 0, + 0, 0,0x9FAD, 0, 0, 0, 0,0x90F4, + 0,0x9FAA, 0,0x978C, 0, 0,0x93B4,0x9FA4, + 0, 0, 0, 0, 0,0x92C3, 0, 0, + 0,0x896B,0x8D5E,0x9FA7, 0, 0, 0, 0, + 0, 0,0x8F46,0x9FAC, 0,0x9FAB,0x9FA6, 0, +0x9FA9, 0, 0,0x8A88, 0,0x9FA8,0x9468, 0, + 0,0x97AC, 0, 0,0x8FF2,0x90F3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9FB4,0x9FB2, 0,0x956C, 0, 0, 0, + 0, 0, 0,0x9FAF,0x9FB1, 0,0x8959, 0, + 0,0x8D5F,0x9851, 0,0x8A5C, 0,0x9582,0xFAFC, + 0, 0, 0, 0,0x9781, 0, 0,0x8A43, +0x905A,0x9FB3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9FB8, 0,0xFAFB, +0x8FC1, 0, 0, 0,0x974F, 0,0x9FB5, 0, + 0, 0, 0,0x9FB0, 0,0x9FB6,0xFB40, 0, + 0,0x97DC, 0,0x9393,0x93C0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFB41, 0, 0,0x8A55, + 0, 0,0x8974, 0, 0,0x9FBC, 0, 0, +0x9FBF, 0, 0, 0,0x97C1, 0, 0, 0, +0x9784, 0, 0, 0, 0,0x9FC6,0x9FC0,0x9FBD, + 0, 0, 0,0x97D2,0x9FC3, 0, 0,0xFB42, + 0,0x8F69,0x9FC5, 0, 0,0x9FCA, 0, 0, +0x9391,0x9FC8, 0, 0, 0, 0,0x9FC2, 0, + 0,0x9257, 0, 0,0x9FC9, 0,0x9FBE, 0, +0x9FC4, 0,0x9FCB,0x88FA,0x9FC1, 0,0x9FCC, 0, + 0,0x905B,0xFB44,0x8F7E, 0,0x95A3, 0,0x8DAC, +0xFB43,0x9FB9,0x9FC7,0x9359,0xFB45, 0, 0, 0, + 0, 0, 0, 0, 0,0x90B4, 0,0x8A89, +0x8DCF,0x8FC2,0x9FBB,0x8F61, 0, 0, 0, 0, + 0, 0, 0,0x8C6B, 0,0x9FBA, 0, 0, + 0,0x9FD0,0x8F8D,0x8CB8, 0,0x9FDF, 0,0x9FD9, +0x8B94,0x936E, 0,0x9FD4,0x9FDD,0x88AD,0x8951,0xFB48, + 0,0x89B7, 0,0x9FD6,0x91AA,0x9FCD,0x9FCF,0x8D60, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9FE0,0xFB46,0x9FDB, 0,0xFB49, 0,0x9FD3, 0, + 0, 0, 0,0x9FDA, 0, 0, 0, 0, + 0, 0,0x96A9, 0, 0,0x9FD8,0x9FDC, 0, + 0, 0, 0, 0, 0, 0,0x8CCE, 0, +0x8FC3, 0, 0,0x9258,0xFB47, 0, 0,0x9FD2, + 0, 0, 0, 0, 0, 0, 0,0x974E, + 0, 0, 0,0x9FD5, 0, 0,0x9FCE,0x9392, + 0, 0,0x9FD1, 0, 0, 0,0x9FD7, 0, + 0, 0, 0, 0, 0, 0,0x9870,0x8EBC, +0x969E, 0,0x9FE1, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x94AC, 0, 0,0x9FED, +0x8CB9, 0, 0, 0, 0, 0,0x8F80, 0, +0x9FE3, 0, 0, 0,0x97AD,0x8D61, 0,0x9FF0, + 0, 0,0x88EC, 0, 0,0x9FEE, 0, 0, + 0, 0,0x9FE2, 0, 0, 0, 0,0x9FE8, + 0, 0,0x9FEA, 0, 0, 0,0x976E,0x9FE5, + 0, 0,0x934D, 0, 0,0x9FE7, 0,0xFB4A, + 0, 0,0x9FEF, 0,0x9FE9,0x96C5, 0, 0, + 0,0x9FE4, 0,0x8EA0,0x9FFC, 0, 0, 0, + 0,0x8A8A, 0,0x9FE6,0x9FEB,0x9FEC, 0, 0, + 0, 0, 0, 0, 0,0x91EA,0x91D8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9FF4, 0, 0,0x9FFA, + 0, 0,0x9FF8, 0,0x9348, 0, 0,0xE042, +0x9FF5, 0, 0, 0, 0, 0,0x9FF6,0x9FDE, + 0,0x8B99,0x9559, 0, 0, 0,0x8EBD, 0, + 0,0x8D97, 0, 0, 0, 0, 0,0x9852, + 0,0x9FF2, 0,0xE041,0x8989,0x9186, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9499, 0,0x8ABF,0x97F8, 0, 0, 0, 0, + 0, 0, 0,0x969F,0x92D0, 0, 0, 0, + 0,0x9FF9,0x9FFB, 0, 0, 0, 0, 0, +0x9151, 0, 0, 0, 0, 0,0xE040,0x9FF7, + 0,0x9FF1, 0, 0, 0,0x8AC1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8C89, 0, 0, 0, +0xE04E, 0, 0,0xE049,0x90F6, 0, 0,0x8A83, + 0, 0, 0, 0,0x8F81, 0,0xE052, 0, + 0, 0, 0, 0, 0,0xE04B,0x92AA,0xE048, +0x92D7, 0, 0, 0,0xE06B, 0, 0, 0, +0xE045, 0,0xE044, 0,0xE04D, 0, 0, 0, +0xE047,0xE046,0xE04C, 0,0x909F, 0,0xE043, 0, +0xFB4B, 0, 0, 0, 0, 0,0xE04F, 0, + 0,0xE050, 0, 0, 0, 0, 0,0x8AC0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE055, 0,0xE054,0xE056, 0, 0, 0, + 0, 0,0xE059, 0, 0, 0, 0, 0, + 0,0x9362, 0,0xE053, 0,0xFB4C, 0, 0, + 0,0xE057, 0, 0, 0, 0, 0, 0, +0x8C83,0x91F7,0xE051,0x945A, 0, 0,0xE058, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE05D,0xE05B, 0, 0, +0xE05E, 0, 0,0xE061, 0, 0, 0,0xE05A, +0x8D8A,0x9447, 0, 0,0x9FB7, 0, 0, 0, + 0, 0, 0,0x9794,0xE05C, 0,0xE060,0x91F3, + 0,0xE05F, 0,0xE04A, 0,0xFB4D,0xE889, 0, + 0, 0,0xE064, 0, 0, 0,0xE068, 0, + 0,0xE066, 0, 0, 0,0xFB4E, 0,0xFB4F, + 0,0xE062, 0,0xE063, 0, 0, 0,0xE067, + 0,0xE065, 0, 0, 0,0x956D, 0, 0, +0xE06D, 0,0xE06A,0xE069, 0,0xE06C,0x93D2,0xE06E, + 0, 0, 0, 0, 0, 0,0x9295,0x91EB, +0xFB50, 0, 0, 0,0x90A3, 0, 0, 0, +0xE06F, 0,0xE071, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE070, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9FF3, 0, 0, 0, + 0,0xE072, 0, 0, 0, 0, 0, 0, +0x93E5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE073, 0, 0, 0, 0, + 0, 0, 0,0x89CE, 0, 0, 0,0x9394, +0x8A44, 0, 0, 0, 0, 0, 0, 0, +0x8B84, 0, 0, 0,0x8EDC,0x8DD0, 0, 0, + 0, 0, 0, 0, 0,0xFB51, 0, 0, + 0,0x9846,0x9086, 0, 0, 0,0x898A, 0, + 0, 0,0xE075, 0, 0, 0, 0, 0, + 0,0xE074, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFB52,0xE078,0x9259,0xE07B,0xE076, + 0, 0, 0,0xE07A, 0, 0, 0, 0, +0xE079,0x935F,0x88D7,0xFA62, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x97F3, 0, 0,0xE07D, 0, 0, 0,0x8947, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE080, 0, 0, 0,0xE07E, 0,0xE07C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE077, 0, 0, 0, 0, 0, 0, + 0,0x9642, 0, 0, 0,0xE082, 0, 0, + 0, 0, 0, 0,0xFB54, 0, 0, 0, + 0,0xE081, 0, 0, 0, 0, 0,0xFB53, + 0, 0, 0, 0,0x898B, 0, 0, 0, + 0,0xE084,0x95B0, 0,0xE083, 0, 0, 0, + 0,0x96B3, 0, 0, 0, 0,0x8FC5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9152, 0, + 0, 0, 0, 0,0x8FC4, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFB56,0xFB57, + 0,0x97F9, 0, 0,0xE08A, 0,0x90F7, 0, + 0, 0, 0, 0, 0,0xE086,0xE08B, 0, + 0,0x898C, 0, 0,0xFB55, 0, 0, 0, + 0, 0,0xE089, 0,0x9481,0xE085,0xE088,0x8FC6, + 0,0x94CF, 0, 0,0xE08C, 0,0x8ECF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x90F8, 0, 0, + 0, 0, 0, 0,0xE08F, 0, 0, 0, +0xE087, 0,0x8C46, 0, 0, 0, 0,0xE08D, + 0, 0, 0, 0,0x976F,0xE090, 0, 0, + 0,0xEAA4, 0, 0, 0, 0, 0,0x8F6E, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE091, 0, 0, 0,0xE092, 0, 0, 0, + 0,0x944D, 0, 0, 0, 0, 0, 0, + 0,0xE094, 0, 0, 0, 0,0xE095, 0, + 0,0xFB59, 0,0x9452, 0, 0, 0, 0, +0x9395,0xE097, 0, 0, 0, 0,0xE099, 0, +0x97D3, 0,0xE096, 0,0xE098,0x898D, 0,0xE093, + 0, 0, 0, 0, 0, 0, 0,0x9A7A, +0xE09A, 0, 0, 0, 0,0x9187,0x8E57,0xE09C, + 0, 0, 0, 0,0xE09B,0x9043,0x99D7, 0, + 0, 0, 0, 0, 0,0xE09D, 0, 0, + 0,0xE09F, 0,0xE08E,0xE09E, 0,0xFB5A,0xE0A0, + 0, 0, 0, 0, 0, 0,0x949A, 0, + 0, 0, 0, 0, 0,0xE0A1, 0, 0, +0xE0A2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE0A3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE0A4, 0,0x92DC, 0,0xE0A6,0xE0A5, 0, 0, +0xE0A7, 0,0xE0A8, 0, 0,0x8EDD,0x9583, 0, + 0, 0,0x96EA,0xE0A9,0xE0AA,0x9175,0x8EA2,0xE0AB, +0xE0AC, 0, 0, 0, 0, 0,0xE0AD,0x95D0, +0x94C5, 0, 0,0xE0AE,0x9476, 0, 0, 0, + 0, 0,0x92AB, 0, 0, 0, 0, 0, +0xE0AF,0x89E5, 0,0x8B8D, 0,0x96C4, 0,0x96B4, + 0,0x89B2,0x9853, 0, 0, 0, 0,0x9671, + 0,0x95A8, 0, 0, 0, 0, 0, 0, + 0, 0,0x90B5, 0,0xE0B0, 0, 0, 0, + 0,0x93C1, 0, 0, 0,0x8CA1,0xE0B1, 0, +0x8DD2,0xE0B3,0xE0B2, 0, 0, 0, 0,0xE0B4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE0B5, 0, 0, 0,0xE0B6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B5D, 0,0xE0B7, 0, 0, 0, 0,0xE0B8, + 0, 0, 0, 0,0x8CA2, 0, 0,0x94C6, + 0,0xFB5B,0xE0BA, 0, 0, 0,0x8FF3, 0, + 0,0xE0B9, 0, 0, 0, 0,0xFB5C, 0, + 0, 0,0x8BB6,0xE0BB,0xE0BD, 0,0xE0BC, 0, + 0, 0, 0, 0, 0, 0,0xE0BE, 0, +0x8CCF, 0,0xE0BF, 0, 0, 0, 0,0x8BE7, + 0,0x915F, 0,0x8D9D, 0, 0, 0, 0, +0xE0C1,0xE0C2,0xE0C0, 0, 0, 0, 0, 0, + 0,0x8EEB, 0, 0,0x93C6,0x8BB7, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE0C4, +0x924B,0xE0C3, 0, 0,0x9854,0x9482, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE0C7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0C9,0xE0C6, + 0, 0, 0,0x96D2,0xE0C8,0xE0CA, 0,0x97C2, + 0, 0, 0, 0,0xFB5D,0xE0CE, 0, 0, + 0,0xE0CD,0x9296,0x944C, 0, 0,0x8CA3,0xE0CC, + 0, 0, 0, 0,0xE0CB, 0,0x9750,0x9751, + 0, 0, 0, 0, 0, 0,0xE0CF,0x898E, + 0, 0, 0, 0,0x8D96,0x8E82, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0D0,0xE0D1, + 0, 0, 0, 0, 0, 0, 0,0xE0D3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8F62, 0, 0, 0, 0, +0xE0D5, 0,0xE0D4, 0, 0, 0, 0, 0, +0xE0D6, 0,0x8A6C, 0, 0,0xE0D8, 0,0xFB5F, +0xE0D7, 0,0xE0DA,0xE0D9, 0, 0, 0, 0, + 0, 0, 0, 0,0x8CBA, 0, 0,0x97A6, + 0,0x8BCA, 0,0x89A4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8BE8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8ADF, 0, 0, 0, 0, 0, 0, + 0, 0,0x97E6,0xE0DC, 0, 0, 0, 0, + 0, 0, 0,0xE0DE, 0,0xFB60, 0, 0, +0xE0DF, 0,0x89CF, 0, 0, 0, 0, 0, +0xE0DB,0xFB61,0x8E58, 0, 0,0x92BF,0xE0DD, 0, + 0, 0,0xFB64, 0, 0, 0,0xFB62, 0, + 0, 0, 0, 0, 0, 0,0xE0E2, 0, +0x8EEC, 0, 0,0xFB63, 0,0xE0E0, 0, 0, + 0, 0,0x8C5D, 0, 0,0x94C7,0xE0E1, 0, + 0,0xE0FC, 0, 0, 0,0xFB66, 0, 0, +0xE0E7, 0, 0, 0, 0, 0,0x8CBB, 0, + 0, 0, 0,0x8B85, 0,0xE0E4,0x979D,0xFB65, + 0,0x97AE, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x91F4, 0, 0,0xE0E6,0xFB67, 0, + 0,0xFB69,0xFB68, 0, 0, 0,0xFB6A, 0, + 0, 0,0xE0E8,0x97D4,0x8BD5,0x94FA,0x9469, 0, + 0, 0,0xE0E9, 0, 0, 0, 0,0xE0EB, + 0,0xE0EE, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE0EA, 0, 0, + 0,0xE0ED,0x8CE8,0x896C,0xE0EF, 0,0x9090,0xE0EC, +0x97DA, 0,0xFB6B,0xE0F2,0xEAA2, 0, 0, 0, + 0,0xE0F0,0xE0F3, 0, 0, 0, 0,0xE0E5, +0xE0F1, 0, 0,0x8DBA, 0, 0,0xE0F4, 0, + 0, 0, 0, 0, 0, 0,0xE0F5, 0, + 0, 0, 0,0x979E, 0, 0, 0, 0, + 0,0xFB6C, 0,0xE0F6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0F7,0xFB6D, + 0, 0,0xE0E3, 0, 0, 0, 0,0xE0F8, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8AC2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x8EA3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE0F9, 0, 0, 0, 0,0xE0FA, + 0, 0, 0, 0,0xE0FB, 0, 0, 0, + 0, 0, 0, 0,0x895A, 0, 0, 0, +0xE140, 0,0x955A,0xE141, 0, 0,0x8AA2,0xE142, + 0,0xE143, 0, 0, 0, 0,0xE144, 0, +0xE146,0xE147,0xE145, 0, 0, 0,0x9572,0xE149, +0xE148, 0, 0, 0, 0, 0, 0, 0, + 0,0xFB6E, 0,0xE14B,0xE14A,0xE14C, 0, 0, + 0, 0, 0, 0,0xE14D,0xE14F,0xE14E, 0, + 0,0x8D99, 0,0xE151, 0,0xE150, 0, 0, +0x8AC3, 0,0x9072, 0,0x935B, 0,0xE152,0x90B6, + 0, 0, 0,0x8E59, 0,0x8999,0xE153, 0, +0x9770, 0, 0,0x95E1,0xE154, 0, 0,0xFAA8, +0x9363,0x9752,0x8D62,0x905C, 0, 0, 0,0x926A, +0x99B2, 0,0x92AC,0x89E6,0xE155, 0, 0, 0, + 0, 0, 0, 0,0xE156, 0,0xE15B, 0, + 0,0xE159,0xE158,0x9DC0,0x8A45,0xE157, 0,0x88D8, + 0,0x94A8, 0, 0,0x94C8, 0, 0, 0, + 0,0x97AF,0xE15C,0xE15A,0x927B,0x90A4, 0, 0, +0x94A9, 0,0x954C, 0,0xE15E,0x97AA,0x8C6C,0xE15F, + 0,0xE15D,0x94D4,0xE160, 0,0xE161, 0,0xFB6F, +0x88D9, 0, 0,0x8FF4,0xE166, 0,0xE163,0x93EB, +0xE162, 0, 0, 0, 0, 0, 0,0x8B45, + 0, 0,0xE169, 0, 0, 0,0xE164,0xE165, + 0,0xE168,0xE167,0x9544, 0, 0,0x9161,0x9160, + 0,0x8B5E, 0, 0,0xE16A, 0, 0, 0, + 0, 0,0xE16B, 0, 0,0xE16C, 0, 0, + 0, 0, 0,0xE16E, 0,0xE16D, 0, 0, + 0, 0, 0,0x8975, 0, 0, 0, 0, + 0,0xE176,0x94E6,0xE170, 0,0xE172, 0, 0, +0xE174,0x905D, 0, 0,0xE175,0xE173,0x8EBE, 0, + 0, 0,0xE16F,0xE171, 0,0x9561, 0,0x8FC7, + 0, 0,0xE178, 0, 0,0xE177, 0, 0, + 0, 0,0xE179, 0,0x8EA4,0x8DAD, 0, 0, +0x9397,0xE17A, 0,0x92C9, 0, 0,0xE17C, 0, + 0, 0,0x979F,0xE17B, 0, 0, 0, 0, + 0,0x9189, 0, 0, 0, 0, 0, 0, +0xE182, 0,0xE184,0xE185,0x9273, 0, 0, 0, + 0, 0,0xE183, 0,0xE180, 0,0xE17D,0xE17E, + 0,0xE181, 0, 0, 0, 0, 0, 0, + 0,0xE188, 0,0xE186, 0,0xE187, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE189, +0xE18B,0xE18C,0xE18D, 0,0xE18E, 0, 0,0xE18A, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE190, 0, 0, 0,0xE18F, 0, 0, 0, + 0, 0, 0,0xE191, 0, 0, 0, 0, + 0, 0,0x97C3, 0, 0, 0,0xE194,0xE192, +0xE193, 0, 0, 0,0x8AE0, 0, 0, 0, + 0, 0,0x96FC, 0, 0, 0,0x95C8, 0, +0xE196, 0, 0, 0,0xE195, 0, 0, 0, + 0,0xE197,0xE198, 0, 0, 0, 0,0xE19C, +0xE199,0xE19A,0xE19B, 0,0xE19D, 0, 0, 0, +0xE19E, 0,0xE19F, 0, 0, 0,0xE1A0, 0, +0xE1A1, 0,0x94AD,0x936F,0xE1A2,0x9492,0x9553, 0, +0xE1A3, 0,0xFB70,0xE1A4,0x9349, 0,0x8A46,0x8D63, +0xE1A5, 0, 0,0xE1A6, 0, 0,0xE1A7, 0, +0x8E48, 0, 0,0xE1A9, 0, 0,0xE1A8, 0, + 0,0xE1AA,0xE1AB,0xFB73,0xFB71, 0,0xFB72, 0, + 0, 0, 0, 0, 0, 0,0xFB74, 0, + 0, 0, 0, 0, 0, 0,0x94E7, 0, +0xE1AC, 0, 0, 0,0xE1AD, 0, 0,0xEA89, +0xE1AE,0xE1AF,0xE1B0, 0, 0, 0, 0,0x8E4D, + 0, 0,0xE1B1,0x9475, 0, 0,0x967E, 0, +0x896D, 0,0x8976, 0, 0,0xE1B2, 0, 0, + 0, 0,0xE1B4, 0, 0, 0,0xE1B3,0x9390, + 0, 0, 0,0x90B7,0x9F58, 0,0xE1B5,0x96BF, + 0,0xE1B6, 0,0x8AC4,0x94D5,0xE1B7, 0,0xE1B8, + 0, 0,0xE1B9, 0, 0, 0,0x96DA, 0, + 0, 0,0x96D3, 0,0x92BC, 0, 0, 0, +0x918A, 0, 0,0xE1BB, 0, 0,0x8F82, 0, + 0,0x8FC8, 0, 0,0xE1BE, 0, 0,0xE1BD, +0xE1BC,0x94FB, 0,0x8AC5,0x8CA7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE1C4, 0, 0,0xE1C1,0x905E, +0x96B0, 0, 0, 0,0xE1C0,0xE1C2,0xE1C3, 0, + 0,0xE1BF, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE1C5, +0xE1C6, 0,0x92AD, 0,0x8AE1, 0, 0, 0, +0x9285, 0, 0, 0, 0, 0,0xFB76,0xE1C7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE1C8,0xE1CB, 0, 0, 0, 0, + 0,0x9087, 0,0x93C2, 0,0xE1CC,0x9672, 0, +0xE1C9, 0, 0,0xE1CA, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE1CF, 0, 0, 0, 0,0xE1CE,0xE1CD, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE1D1, 0, 0,0xE1D0, 0, + 0,0xE1D2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE1D4, 0, +0xE1D3, 0, 0, 0, 0,0x95CB, 0, 0, + 0, 0, 0, 0,0x8F75,0x97C4, 0, 0, +0xE1D5, 0, 0,0x93B5, 0, 0,0xE1D6, 0, + 0,0xE1D7, 0,0xE1DB,0xE1D9,0xE1DA, 0,0xE1D8, + 0, 0, 0, 0, 0, 0, 0,0xE1DC, + 0, 0, 0, 0, 0,0xE1DD, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE1DE, + 0, 0,0xE1DF,0x96B5,0xE1E0, 0, 0, 0, + 0, 0,0x96EE,0xE1E1, 0,0x926D, 0,0x948A, + 0,0x8BE9, 0, 0, 0,0x925A,0xE1E2,0x8BB8, + 0, 0, 0,0x90CE, 0, 0, 0, 0, + 0, 0, 0, 0,0xE1E3, 0, 0, 0, + 0, 0,0x8DBB, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE1E4, 0, 0, 0, + 0, 0,0xE1E5, 0,0x8CA4,0x8DD3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE1E7,0xFB78, 0, 0, 0,0x9375,0x8DD4,0x8B6D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9643, 0,0x946A, 0, 0, 0, + 0, 0,0x9376, 0, 0, 0, 0,0x8D7B, + 0, 0, 0, 0, 0,0xE1E9, 0, 0, + 0, 0, 0, 0, 0, 0,0xFB79, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x8FC9, 0, 0, + 0, 0, 0, 0,0xFB7A, 0, 0, 0, + 0, 0, 0,0x97B0,0x8D64, 0, 0,0x8CA5, + 0, 0,0x94A1, 0,0xE1EB, 0, 0, 0, + 0, 0,0xFB7B, 0,0xE1ED, 0, 0, 0, + 0,0x8CE9, 0, 0, 0, 0,0xE1EC,0x92F4, + 0, 0, 0, 0,0xE1EF,0x8A56,0xE1EA, 0, + 0,0x94E8, 0,0x894F, 0,0x8DEA, 0,0x9871, + 0, 0,0xE1EE, 0, 0, 0, 0, 0, + 0, 0, 0,0xE1F0, 0, 0, 0,0x95C9, + 0,0x90D7,0xE1F2, 0, 0, 0, 0,0xE1F3, + 0, 0, 0, 0, 0,0xE1F1, 0, 0, + 0, 0,0x8A6D, 0,0xE1F9, 0,0xE1F8, 0, + 0,0x8EA5, 0, 0, 0,0xE1FA,0xE1F5, 0, + 0, 0,0xE1FB,0xE1F6, 0, 0, 0, 0, +0x94D6,0xE1F4, 0, 0,0xE1F7, 0, 0, 0, + 0, 0,0xE241, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE240, +0x9681, 0, 0, 0,0xE1FC, 0, 0,0x88E9, + 0, 0, 0, 0,0xE243, 0, 0, 0, + 0, 0, 0, 0, 0,0xE242, 0, 0, + 0,0x8FCA, 0, 0, 0, 0, 0,0xE244, + 0, 0, 0, 0, 0, 0,0x9162, 0, + 0,0xE246,0xE245, 0, 0, 0, 0, 0, + 0,0xE247, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE1E6, 0, + 0, 0,0xE1E8,0xE249,0xE248, 0, 0, 0, +0xFB7C, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8EA6, 0,0x97E7, 0,0x8ED0, 0, +0xE24A,0x8C56, 0, 0, 0, 0, 0,0x8B5F, +0x8B46,0x8E83, 0, 0, 0, 0, 0, 0, +0x9753, 0, 0,0xE250, 0,0xE24F,0x9163,0xE24C, + 0, 0,0xE24E, 0, 0,0x8F6A,0x905F,0xE24D, +0xE24B, 0,0x9449, 0, 0,0x8FCB, 0, 0, +0x955B, 0, 0, 0, 0,0x8DD5, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9398, + 0, 0,0xE251, 0, 0, 0, 0,0xE252, +0xE268,0x8BD6, 0, 0,0x985C,0x9154, 0, 0, + 0, 0,0xE253, 0, 0,0x89D0,0x92F5,0x959F, + 0, 0, 0, 0,0xFB81, 0, 0, 0, + 0, 0, 0,0xFB83, 0,0xE254, 0, 0, + 0, 0, 0, 0, 0, 0,0x8B9A,0xE255, + 0, 0,0xE257, 0, 0, 0,0xE258, 0, +0x9448, 0, 0,0xE259, 0, 0, 0, 0, + 0,0xE25A,0xE25B, 0, 0,0x8BD7,0x89D1,0x93C3, +0x8F47,0x8E84, 0, 0, 0, 0, 0, 0, + 0,0xE25C, 0,0x8F48, 0, 0, 0, 0, + 0,0x89C8,0x9562, 0, 0,0xE25D, 0, 0, +0x94E9, 0, 0, 0, 0, 0, 0,0x9164, + 0,0xE260, 0,0xE261,0x9489, 0,0x9060,0xE25E, + 0,0x9281, 0, 0,0xE25F, 0, 0, 0, +0x8FCC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x88DA, 0, 0, 0, 0, +0x8B48, 0, 0, 0, 0, 0, 0, 0, +0xE262, 0, 0,0x92F6, 0,0xE263,0x90C5, 0, + 0, 0, 0, 0,0x96AB, 0, 0,0x9542, +0xE264,0xE265,0x9274, 0,0x97C5, 0, 0,0xE267, +0xE266, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8EED, 0, + 0,0xE269,0x88EE, 0, 0, 0, 0,0xE26C, + 0, 0, 0,0xE26A,0x89D2,0x8C6D,0xE26B,0x8D65, +0x8D92, 0,0x95E4,0xE26D, 0, 0,0x9673, 0, + 0,0xE26F, 0, 0, 0,0x90CF,0x896E,0x89B8, +0x88AA, 0, 0, 0, 0, 0, 0,0xE26E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE270,0xE271,0x8FF5, 0, 0, 0, 0, + 0,0xE272, 0,0x8A6E, 0, 0, 0, 0, +0xE274, 0, 0, 0,0x8C8A, 0,0x8B86, 0, + 0,0xE275,0x8BF3, 0, 0,0xE276, 0,0x90FA, + 0,0x93CB, 0,0x90DE,0x8DF3, 0, 0, 0, +0xE277, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9282,0x918B, 0,0xE279,0xE27B,0xE278, +0xE27A, 0, 0, 0, 0, 0, 0,0x8C41, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE27C,0x8C45, 0, 0, 0,0x8B87,0x9771, +0xE27E, 0, 0, 0, 0, 0,0xE280, 0, + 0, 0,0x894D, 0, 0, 0, 0,0xE283, + 0, 0, 0,0x8A96,0xE282,0xE281, 0,0xE285, +0xE27D, 0,0xE286,0x97A7, 0,0xE287, 0,0xE288, + 0,0xFB84,0x9AF2,0xE28A, 0,0xE289, 0, 0, + 0,0xE28B,0xE28C, 0,0x97B3,0xE28D, 0,0xE8ED, +0x8FCD,0xE28E,0xE28F,0x8F76, 0,0x93B6,0xE290,0xFB85, + 0, 0,0x9247,0xFB87, 0,0xE291, 0,0x925B, +0xE292, 0, 0, 0, 0, 0,0x8BA3, 0, +0x995E,0x927C,0x8EB1, 0, 0, 0, 0,0x8AC6, + 0, 0,0xE293, 0,0xE2A0, 0,0xE296, 0, +0x8B88, 0,0xE295,0xE2A2, 0, 0, 0,0xE294, + 0,0x8FCE, 0, 0, 0, 0, 0, 0, +0xE298,0xE299, 0,0x934A, 0, 0,0xE29A, 0, +0x8A7D, 0, 0, 0, 0,0x9079,0x9584, 0, +0xE29C, 0, 0, 0,0x91E6, 0, 0, 0, + 0, 0, 0,0xE297, 0,0xE29B,0xE29D, 0, + 0,0x8DF9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE2A4,0x954D, 0, +0x94A4,0x9399, 0,0x8BD8,0xE2A3,0xE2A1, 0,0x94B3, +0xE29E,0x927D,0x939B, 0,0x939A, 0,0x8DF4, 0, + 0, 0, 0, 0, 0,0xE2B6, 0, 0, + 0, 0, 0, 0, 0,0xE2A6, 0,0xE2A8, + 0, 0, 0, 0,0xE2AB, 0,0xE2AC, 0, +0xE2A9,0xE2AA, 0, 0,0xE2A7,0xE2A5, 0, 0, + 0, 0,0xE29F, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x95CD,0x89D3, + 0, 0, 0,0xE2B3, 0,0xE2B0, 0,0xE2B5, + 0, 0,0xE2B4, 0,0x9493,0x96A5, 0,0x8E5A, +0xE2AE,0xE2B7,0xE2B2, 0,0xE2B1,0xE2AD,0xFB88,0xE2AF, + 0,0x8AC7, 0, 0, 0, 0, 0, 0, + 0, 0,0x925C, 0, 0,0x90FB, 0, 0, + 0,0x94A0, 0, 0,0xE2BC, 0, 0, 0, +0x94A2, 0, 0, 0, 0, 0, 0, 0, +0x90DF,0xE2B9, 0, 0,0x94CD, 0,0xE2BD,0x95D1, + 0,0x927A, 0,0xE2B8,0xE2BA, 0, 0,0xE2BB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE2BE, 0, 0, +0x8EC2, 0, 0, 0,0x93C4,0xE2C3,0xE2C2, 0, + 0,0xE2BF, 0, 0, 0,0x9855, 0, 0, + 0, 0, 0,0xE2C8, 0, 0,0xE2CC,0xE2C9, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE2C5, 0, 0, 0, 0, 0, 0,0xE2C6, + 0, 0, 0, 0, 0,0xE2CB, 0, 0, + 0,0xE2C0,0x99D3,0xE2C7,0xE2C1, 0, 0,0xE2CA, + 0, 0, 0, 0, 0, 0, 0,0xE2D0, + 0,0x8AC8, 0,0xE2CD, 0, 0, 0,0xE2CE, + 0, 0,0xE2CF,0xE2D2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE2D1, +0x94F4, 0, 0, 0, 0,0xE2D3,0x97FA,0x95EB, +0xE2D8, 0, 0,0xE2D5, 0, 0, 0, 0, + 0, 0, 0, 0,0xE2D4,0x90D0, 0,0xE2D7, +0xE2D9, 0, 0, 0,0xE2D6, 0,0xE2DD, 0, +0xE2DA, 0, 0, 0, 0, 0, 0,0xE2DB, +0xE2C4, 0, 0, 0,0xE2DC,0xE2DE, 0, 0, + 0, 0, 0, 0,0xE2DF, 0, 0, 0, + 0, 0, 0,0x95C4, 0,0xE2E0, 0, 0, + 0, 0, 0, 0, 0, 0,0x96E0, 0, + 0,0x8BCC,0x8C48,0xE2E1, 0, 0, 0, 0, + 0,0x95B2, 0,0x9088, 0,0x96AE, 0, 0, +0xE2E2, 0,0x97B1, 0, 0,0x9494, 0,0x9165, +0x9453, 0, 0,0x8F6C, 0, 0, 0,0x88BE, + 0,0xE2E7,0xE2E5, 0,0xE2E3,0x8A9F, 0,0x8FCF, +0xE2E8, 0, 0,0xE2E6, 0,0xE2E4,0xE2EC, 0, + 0,0xE2EB,0xE2EA,0xE2E9, 0, 0, 0, 0, + 0,0xE2ED, 0, 0, 0,0xE2EE,0x90B8, 0, +0xE2EF, 0,0xE2F1, 0, 0,0xE2F0, 0, 0, + 0, 0,0x8CD0, 0, 0, 0,0x9157, 0, + 0, 0,0xE2F3, 0, 0, 0,0x939C, 0, +0xE2F2, 0, 0, 0,0xE2F4, 0,0x95B3,0x918C, +0x8D66, 0,0xE2F5, 0, 0, 0, 0,0x97C6, + 0, 0, 0, 0, 0, 0, 0,0xE2F7, + 0, 0,0xE2F8, 0,0xE2F9, 0,0xE2FA, 0, +0x8E85, 0,0xE2FB,0x8C6E, 0, 0,0x8B8A, 0, +0x8B49, 0,0xE340, 0,0x96F1,0x8D67,0xE2FC, 0, + 0, 0,0xE343,0x96E4, 0,0x945B, 0, 0, +0x9552, 0, 0, 0,0x8F83,0xE342, 0,0x8ED1, +0x8D68,0x8E86,0x8B89,0x95B4,0xE341, 0, 0, 0, +0x9166,0x9661,0x8DF5, 0, 0, 0, 0, 0, + 0, 0, 0,0x8E87,0x92DB, 0,0xE346,0x97DD, +0x8DD7, 0,0xE347,0x9061, 0,0xE349, 0, 0, + 0,0x8FD0,0x8DAE, 0, 0, 0, 0,0xE348, + 0, 0,0x8F49,0x8CBC,0x9167,0xE344,0xE34A, 0, +0xFB8A, 0, 0,0xE345,0x8C6F, 0,0xE34D,0xE351, +0x8C8B, 0, 0, 0, 0, 0,0xE34C, 0, + 0, 0, 0,0xE355,0xFB8B, 0,0x8D69, 0, + 0,0x978D,0x88BA,0xE352, 0, 0,0x8B8B, 0, +0xE34F, 0, 0, 0, 0, 0,0xE350, 0, + 0,0x939D,0xE34E,0xE34B, 0,0x8A47,0x90E2, 0, + 0,0x8CA6, 0, 0, 0,0xE357, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE354, 0, 0, 0, 0, 0,0xE356, + 0, 0, 0,0xE353, 0, 0, 0, 0, + 0,0x8C70,0x91B1,0xE358,0x918E, 0, 0,0xE365, +0xFB8D, 0,0xE361,0xE35B, 0, 0, 0, 0, + 0, 0, 0,0xE35F,0x8EF8,0x88DB,0xE35A,0xE362, +0xE366,0x8D6A,0x96D4, 0,0x92D4,0xE35C, 0,0xFB8C, +0xE364, 0,0xE359,0x925D, 0,0xE35E,0x88BB,0x96C8, + 0, 0, 0, 0, 0, 0, 0,0xE35D, + 0, 0,0x8BD9,0x94EA, 0, 0, 0,0x918D, + 0,0x97CE,0x8F8F, 0, 0,0xE38E,0xFB8E, 0, +0xE367, 0,0x90FC, 0,0xE363,0xE368,0xE36A, 0, +0x92F7,0xE36D, 0, 0,0xE369, 0, 0, 0, +0x95D2,0x8AC9, 0, 0,0x96C9, 0, 0,0x88DC, + 0, 0,0xE36C, 0,0x97FB, 0, 0, 0, + 0, 0, 0,0xE36B, 0, 0, 0, 0, + 0,0x898F, 0, 0,0x93EA,0xE36E, 0, 0, + 0,0xE375,0xE36F,0xE376, 0, 0, 0, 0, + 0, 0,0xE372, 0, 0, 0, 0, 0, + 0, 0, 0,0x949B, 0, 0,0x8EC8,0xE374, + 0,0xE371,0xE377,0xE370, 0, 0,0x8F63, 0, + 0, 0, 0,0x9644, 0, 0,0x8F6B, 0, + 0,0xE373,0xE380, 0, 0,0xE37B, 0,0xE37E, + 0,0xE37C,0xE381,0xE37A, 0,0xE360,0x90D1, 0, + 0,0x94C9, 0,0xE37D, 0, 0,0xE378, 0, + 0, 0,0x9140,0x8C71, 0,0x8F4A, 0, 0, + 0, 0,0xFB8F, 0,0x9044,0x9155,0xE384, 0, + 0,0xE386,0xE387, 0, 0,0xE383,0xE385, 0, + 0, 0, 0, 0, 0, 0,0xE379,0xE382, + 0,0xE38A,0xE389, 0, 0,0x969A, 0, 0, +0x8C4A, 0, 0, 0, 0, 0, 0, 0, + 0,0xE388, 0,0xE38C,0xE38B,0xE38F, 0,0xE391, + 0, 0,0x8E5B,0xE38D, 0, 0, 0, 0, +0xE392,0xE393,0xFA5C, 0,0xE394, 0,0xE39A,0x935A, +0xE396, 0,0xE395,0xE397,0xE398, 0,0xE399, 0, + 0, 0, 0,0xE39B,0xE39C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8ACA, 0, +0xE39D, 0,0xE39E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE39F, 0,0xFB90, + 0, 0, 0, 0,0xE3A0,0xE3A1,0xE3A2, 0, +0xE3A3,0xE3A4, 0, 0,0xE3A6,0xE3A5, 0, 0, +0xE3A7, 0, 0, 0, 0, 0, 0,0xE3A8, +0xE3A9, 0, 0, 0, 0, 0, 0,0xE3AC, +0xE3AA,0xE3AB,0x8DDF,0x8C72, 0, 0,0x9275, 0, +0x94B1, 0,0x8F90, 0, 0,0x946C, 0,0x94EB, +0xE3AD,0x9CEB, 0, 0, 0, 0, 0, 0, + 0, 0,0xE3AE,0xE3B0, 0,0x9785,0xE3AF,0xE3B2, +0xE3B1, 0,0x9772, 0,0xE3B3, 0,0x94FC, 0, + 0, 0, 0, 0,0xE3B4, 0, 0, 0, + 0, 0,0xE3B7, 0, 0,0xE3B6,0xE3B5, 0, + 0,0xFB91, 0,0xE3B8,0x8C51, 0, 0, 0, +0x9141,0x8B60, 0, 0, 0, 0,0xE3BC,0xE3B9, + 0, 0,0xE3BA, 0, 0, 0,0xE3BD, 0, +0xE3BE,0xE3BB, 0, 0, 0,0x8948, 0, 0, + 0,0x89A5, 0, 0, 0,0xE3C0,0xE3C1, 0, + 0, 0,0xE3C2, 0,0x9782, 0, 0, 0, + 0, 0,0x8F4B, 0,0xE3C4,0xE3C3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9089,0xE3C5, 0, 0, 0, 0,0xE3C6, 0, + 0,0xE3C7, 0,0x8AE3, 0, 0, 0, 0, +0x8ACB, 0, 0,0xE3C8, 0, 0, 0, 0, + 0,0xE3C9, 0,0x967C,0x9783, 0, 0, 0, +0x9773,0x9856, 0,0x8D6C,0xE3CC,0x8ED2,0xE3CB, 0, + 0, 0, 0,0xE3CD,0x8EA7, 0, 0, 0, +0x91CF, 0,0xE3CE, 0, 0,0x8D6B, 0,0x96D5, +0xE3CF,0xE3D0, 0, 0,0xE3D1, 0, 0, 0, + 0,0xE3D2, 0, 0, 0, 0, 0, 0, +0xE3D3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8EA8, 0, 0,0x96EB, 0, + 0, 0, 0,0xE3D5, 0,0x925E, 0,0xE3D4, + 0, 0, 0, 0, 0, 0,0xE3D7, 0, + 0, 0,0xE3D6, 0, 0, 0, 0, 0, + 0, 0,0xE3D8, 0, 0, 0,0x90B9, 0, +0xE3D9, 0,0xE3DA, 0, 0, 0,0x95B7,0xE3DB, + 0,0x918F,0xE3DC, 0, 0, 0, 0, 0, +0xE3DD, 0, 0, 0, 0, 0, 0,0x97FC, +0xE3E0, 0,0xE3DF,0xE3DE,0x92AE, 0,0xE3E1,0x9045, + 0,0xE3E2, 0, 0, 0,0xE3E3,0x9857,0xE3E4, + 0, 0, 0, 0,0xE3E5,0xE3E7,0xE3E6,0x94A3, + 0,0x93F7, 0,0x985D,0x94A7, 0, 0, 0, + 0, 0, 0,0xE3E9, 0, 0,0x8FD1, 0, +0x9549, 0,0xE3EA,0xE3E8, 0,0x8ACC, 0, 0, + 0,0x8CD2,0x8E88, 0, 0,0x94EC, 0, 0, + 0,0x8CA8,0x9662, 0,0xE3ED,0xE3EB, 0,0x8D6D, + 0,0x8D6E,0x88E7, 0,0x8DE6, 0, 0, 0, + 0, 0,0x9478, 0, 0, 0, 0, 0, + 0, 0, 0,0x88DD,0xE3F2, 0,0x925F, 0, + 0, 0, 0, 0,0x9477, 0,0x91D9, 0, + 0, 0, 0, 0, 0, 0,0xE3F4, 0, + 0,0xE3F0,0xE3F3,0xE3EE, 0,0xE3F1,0x9645, 0, + 0,0x8CD3, 0, 0,0x88FB,0xE3EF, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE3F6, + 0,0xE3F7, 0, 0,0x93B7, 0, 0, 0, +0x8BB9, 0, 0, 0,0xE445,0x945C, 0, 0, + 0, 0,0x8E89, 0, 0,0x8BBA,0x90C6,0x9865, +0x96AC,0xE3F5,0x90D2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8B72,0xE3F8, 0, 0, 0, 0, + 0, 0, 0,0xE3FA, 0, 0, 0, 0, + 0,0xE3F9, 0, 0, 0, 0, 0,0xE3FB, + 0,0x9245, 0,0x945D, 0, 0, 0, 0, + 0,0x92AF, 0, 0, 0, 0,0xE442, 0, + 0, 0, 0, 0, 0, 0,0xE441, 0, + 0, 0, 0,0xE3FC, 0, 0,0x9074, 0, +0x9585,0xE444, 0,0xE443,0x8D6F,0x9872, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE454, + 0, 0, 0, 0, 0,0xE448,0xE449, 0, + 0, 0, 0,0x8EEE, 0, 0,0xE447, 0, +0x8D98,0xE446, 0, 0,0xE44A, 0, 0, 0, +0x92B0,0x95A0,0x9142, 0, 0, 0, 0,0x91DA, +0xE44E, 0,0xE44F,0xE44B, 0, 0, 0, 0, +0xE44C, 0,0xE44D, 0, 0, 0, 0,0x8D70, + 0, 0, 0,0xE455, 0,0xE451, 0, 0, + 0, 0,0x9586, 0,0x968C,0x9547, 0, 0, +0xE450, 0, 0,0xE453,0xE452, 0, 0, 0, +0x9663,0xE456, 0, 0, 0, 0, 0, 0, +0xE457, 0, 0,0x9156, 0,0xE458, 0, 0, +0xE45A, 0,0xE45E, 0, 0,0xE45B,0xE459,0x945E, +0xE45C, 0,0xE45D, 0, 0, 0,0x89B0, 0, +0xE464,0xE45F, 0, 0, 0,0xE460, 0, 0, + 0,0xE461, 0,0x919F, 0, 0, 0, 0, +0xE463,0xE462,0xE465, 0, 0, 0, 0,0xE466, +0xE467, 0, 0,0x9062, 0,0x89E7, 0,0xE468, +0x97D5, 0,0x8EA9, 0, 0,0x8F4C, 0, 0, + 0, 0, 0,0x8E8A,0x9276, 0, 0, 0, + 0, 0,0xE469,0xE46A,0x8950, 0,0xE46B, 0, + 0,0xE46C,0xE46D, 0, 0,0xE46E, 0,0xE46F, +0x8BBB,0x9DA8,0xE470, 0,0x90E3,0xE471,0x8EC9, 0, +0xE472, 0,0x98AE, 0, 0, 0,0xE473,0x95DC, +0x8ADA, 0, 0,0x9143,0x8F77, 0,0x9591,0x8F4D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE474,0x8D71,0xE475,0x94CA, 0,0xE484, 0, + 0, 0, 0,0xE477, 0,0x91C7,0x9495,0x8CBD, +0xE476,0x9144, 0, 0, 0, 0, 0, 0, +0xE478, 0, 0, 0, 0, 0, 0,0x92F8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE47A,0xE479,0xE47C, 0, 0,0xE47B, 0,0xE47D, + 0, 0,0xE480, 0,0xE47E, 0,0x8ACD, 0, +0xE481, 0,0xE482,0xE483, 0, 0,0x8DAF,0x97C7, + 0,0xE485,0x9046, 0, 0, 0,0x8990,0xE486, +0xE487, 0, 0, 0, 0, 0,0xE488, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x88F0, 0,0xE489, 0, 0, + 0, 0,0xE48A, 0, 0, 0, 0, 0, + 0,0x9587, 0, 0, 0,0x8EC5, 0,0xE48C, + 0, 0, 0, 0, 0,0x8A48,0x88B0, 0, + 0, 0, 0,0xE48B,0xE48E,0x946D, 0,0x9063, + 0,0x89D4, 0,0x9646, 0, 0, 0, 0, +0x8C7C,0x8BDA, 0,0xE48D, 0,0x89E8, 0, 0, + 0, 0, 0, 0, 0,0x8AA1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8991,0xE492,0x97E8,0x91DB, 0, 0,0x9563, + 0,0xE49E, 0,0x89D5,0xE49C, 0,0xE49A,0xE491, + 0,0xE48F, 0,0xE490, 0,0x8EE1,0x8BEA,0x9297, + 0, 0, 0,0x93CF, 0, 0, 0, 0, + 0,0x8970, 0,0xE494,0xE493, 0, 0, 0, + 0,0xE499,0xE495,0xE498, 0, 0, 0, 0, + 0,0xFB93,0x96CE,0xE497,0x89D6,0x8A9D,0xE49B, 0, + 0,0xE49D, 0, 0, 0, 0,0x8C73, 0, + 0, 0, 0, 0, 0, 0,0xE4A1,0xE4AA, +0xE4AB, 0, 0, 0,0x88A9, 0, 0, 0, + 0, 0, 0,0xE4B2, 0, 0, 0, 0, +0x88EF, 0, 0,0xE4A9, 0, 0, 0,0xE4A8, + 0,0xE4A3,0xE4A2, 0,0xE4A0,0xE49F,0x9283, 0, +0x91F9,0xE4A5, 0, 0, 0, 0, 0, 0, +0xE4A4, 0, 0, 0, 0,0xE4A7, 0, 0, + 0,0x9190,0x8C74, 0, 0, 0, 0,0x8960, +0xE4A6, 0,0x8D72, 0, 0, 0, 0, 0, +0x9191, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xFB94, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE4B8, 0,0xE4B9, 0,0x89D7, + 0, 0, 0,0x89AC,0xE4B6, 0, 0,0xFB95, + 0, 0, 0, 0, 0,0xE4AC, 0,0xE4B4, + 0,0xE4BB,0xE4B5, 0, 0, 0,0xE4B3, 0, + 0, 0, 0,0xE496, 0, 0,0xE4B1, 0, + 0, 0,0xE4AD, 0, 0, 0,0x8ACE,0xE4AF, +0xE4BA, 0,0xE4B0, 0, 0, 0, 0, 0, +0xE4BC, 0,0xE4AE,0x949C, 0, 0, 0, 0, + 0,0x9789, 0, 0, 0,0xE4B7, 0, 0, + 0, 0, 0, 0, 0,0xE4CD, 0, 0, + 0,0xE4C5, 0, 0, 0,0x909B, 0,0xFB96, + 0, 0,0x8B65, 0,0x8BDB, 0,0xE4C0, 0, + 0, 0, 0,0x89D9, 0, 0,0x8FD2, 0, +0xE4C3, 0, 0, 0,0x8DD8, 0, 0,0x9370, +0xE4C8, 0, 0, 0, 0, 0, 0, 0, + 0,0x95EC, 0,0xE4BF, 0, 0, 0,0x89D8, +0x8CD4,0x9548,0xE4C9, 0,0xE4BD, 0,0xFB97,0xE4C6, + 0, 0, 0,0xE4D0, 0,0xE4C1, 0, 0, + 0, 0, 0,0xE4C2,0x93B8, 0, 0,0xE4C7, + 0, 0, 0,0xE4C4,0x9647,0xE4CA,0x88DE, 0, + 0, 0, 0,0xE4BE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE4CC, 0,0xE4CB, 0, 0, 0, 0, 0, + 0,0x948B,0xE4D2, 0,0xE4DD, 0, 0, 0, + 0,0x8A9E, 0, 0, 0,0xE4E0, 0, 0, +0xE4CE, 0, 0, 0,0xE4D3,0x978E, 0, 0, + 0, 0, 0, 0, 0, 0,0xE4DC, 0, +0xFB98,0x9774, 0, 0, 0, 0,0x97A8, 0, + 0, 0, 0, 0, 0, 0, 0,0x9298, + 0, 0, 0,0x8A8B, 0, 0, 0, 0, + 0,0x9592,0xE4E2,0x939F, 0, 0,0x88AF, 0, + 0,0xE4DB, 0,0xE4D7,0x9192,0xE4D1,0xE4D9,0xE4DE, + 0,0x944B, 0, 0, 0,0x88A8, 0,0xE4D6, + 0,0xE4DF,0x9598, 0, 0, 0, 0, 0, + 0, 0,0xE4DA, 0,0xE4D5, 0, 0, 0, + 0, 0, 0,0x8FD3, 0, 0, 0, 0, +0x8F4E, 0, 0, 0,0x8EAA, 0, 0, 0, + 0,0x96D6, 0, 0,0x9566, 0, 0,0xE4E5, + 0,0xE4EE, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE4D8, 0, 0, + 0, 0,0x8A97, 0,0xFB99, 0, 0, 0, +0x8FF6,0xE4E3, 0,0xE4E8,0x9193, 0, 0,0xE4E4, + 0,0xE4EB, 0, 0,0x927E, 0,0xE4EC, 0, + 0,0x9775,0xE4E1,0x8A57, 0,0xE4E7, 0, 0, +0xE4EA,0x96AA, 0, 0, 0, 0,0xE4ED, 0, + 0,0xE4E6,0xE4E9, 0,0xFA60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9648, 0,0x9840, 0, + 0, 0, 0, 0,0xE4F1, 0, 0, 0, + 0, 0, 0, 0,0xE4F8, 0, 0,0xE4F0, +0x8EC1, 0, 0, 0, 0, 0,0xE4CF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x95CC, 0,0x96A0,0xE4F7,0xE4F6, 0,0xE4F2, +0xE4F3, 0,0x8955, 0, 0, 0, 0,0xE4F5, + 0,0xE4EF, 0, 0, 0, 0,0x92D3, 0, + 0, 0, 0, 0,0xE4F4,0x88FC, 0, 0, + 0, 0, 0, 0, 0,0x91A0, 0, 0, + 0, 0, 0, 0, 0,0x95C1, 0, 0, +0xE4F9,0xE540, 0,0x94D7, 0, 0, 0, 0, +0xE4FC,0x8FD4,0x8EC7,0xE542, 0, 0,0x8BBC, 0, + 0, 0, 0,0xFB9A, 0,0xE543, 0,0x9599, +0xE4FB,0xFB9B,0xE4D4, 0, 0, 0, 0, 0, + 0, 0, 0,0xE4FA, 0, 0, 0, 0, +0x986E,0x93A0,0x9593,0xFB9C, 0,0xE54A, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE550, + 0, 0, 0, 0, 0, 0,0xE551, 0, +0xE544, 0, 0, 0,0x9496, 0, 0,0xE54E, +0xE546, 0,0xE548, 0, 0, 0, 0, 0, +0xE552,0xE547, 0, 0,0xE54B, 0, 0,0x8992, + 0,0x93E3, 0,0xE54C,0xE54F, 0, 0, 0, + 0, 0, 0, 0,0xE545, 0,0x9145, 0, +0xE549,0x8E46,0x9064,0x8C4F,0x96F2, 0,0x96F7,0x8F92, +0xFB9E, 0, 0, 0, 0, 0, 0, 0, + 0,0xE556,0xE554, 0, 0, 0, 0, 0, + 0,0x986D, 0, 0, 0, 0, 0, 0, + 0,0xE553, 0, 0, 0,0x9795, 0,0xE555, +0xE557, 0, 0, 0, 0,0xE558, 0, 0, + 0, 0, 0, 0,0xE55B,0xE559, 0, 0, + 0, 0, 0, 0,0x93A1,0xE55A, 0, 0, + 0,0x94CB,0xE54D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8F93, + 0,0xE55C,0xE561,0x9194, 0, 0,0xE560, 0, + 0, 0,0xE541, 0, 0, 0,0xE562,0x9168, + 0, 0,0xE55D,0xE55F, 0, 0, 0, 0, + 0, 0, 0,0xE55E, 0, 0,0x9F50,0x9F41, + 0, 0,0xE564, 0, 0, 0, 0, 0, + 0, 0,0xE563, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9796, 0,0xE1BA, +0xE565, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE566, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE567,0x8CD5, 0, +0x8B73, 0, 0, 0,0xE569,0x997C, 0, 0, + 0, 0,0x8B95, 0,0x97B8, 0,0x8BF1,0xE56A, + 0, 0, 0, 0, 0, 0, 0,0xE56B, + 0, 0, 0,0x928E, 0, 0, 0, 0, + 0,0xE56C, 0, 0, 0, 0, 0, 0, + 0,0x93F8, 0,0x88B8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x89E1,0xE571,0xE572, 0, 0, 0, + 0, 0, 0,0xE56D, 0,0x8E5C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE56E,0x9461, 0, 0, 0, + 0,0xE56F,0xE570,0xE57A, 0, 0, 0,0xE574, +0xE577, 0, 0, 0, 0, 0,0xE573, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE575, 0,0xE576,0x8ED6, + 0,0xE578, 0,0x9260, 0,0x8C75,0x8A61, 0, + 0, 0, 0, 0,0xE57B, 0, 0, 0, + 0,0x8A5E, 0,0xE581, 0, 0,0xE57C,0xE580, + 0, 0, 0, 0,0x94B8, 0, 0, 0, + 0,0xE57D, 0, 0,0xE57E,0x9567,0x94D8,0xE582, + 0, 0, 0, 0, 0, 0, 0, 0, +0x91FB,0xE58C, 0,0xE588, 0, 0,0x89E9, 0, +0xE586, 0,0x9649,0xE587, 0, 0,0xE584, 0, +0xE585,0xE58A,0xE58D, 0, 0,0xE58B, 0, 0, + 0,0xE589,0xE583, 0, 0, 0, 0, 0, +0x9277, 0,0xE594, 0,0x96A8, 0, 0, 0, + 0, 0, 0, 0, 0,0xE592, 0, 0, + 0,0xE593, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE58E, 0, 0,0xE590, + 0, 0, 0,0xE591, 0, 0, 0,0xE58F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x90E4, 0,0x9858,0xE598, 0,0xE599, 0, + 0, 0, 0,0xE59F, 0,0x9049, 0,0xE59B, + 0,0xE59E, 0, 0, 0, 0, 0,0xE596, +0xE595, 0, 0,0xE5A0, 0, 0,0x89DA, 0, +0xE59C, 0,0xE5A1, 0, 0, 0,0xE59D, 0, + 0, 0, 0, 0,0xE59A, 0,0x92B1, 0, +0xE597, 0, 0, 0, 0, 0, 0,0x9488, + 0, 0,0xE5A5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x975A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE5A4, + 0, 0,0xE5A3, 0, 0, 0, 0, 0, + 0, 0, 0,0xE5AC, 0, 0, 0,0xE5A6, + 0, 0, 0,0xE5AE, 0, 0, 0, 0, + 0, 0,0x9786,0xE5B1, 0,0xE5A8, 0, 0, +0xE5A9, 0, 0, 0,0xE5AD, 0,0xE5B0,0xE5AF, + 0, 0, 0,0xE5A7, 0, 0, 0, 0, +0xE5AA, 0,0xE5BB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE5B4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE5B2, + 0, 0,0xE5B3, 0, 0, 0,0xE5B8,0xE5B9, + 0,0x8A49, 0,0x8B61, 0, 0,0xE5B7, 0, + 0, 0, 0, 0, 0,0xE5A2, 0,0xFBA1, + 0, 0, 0, 0, 0,0xE5B6,0xE5BA,0xE5B5, + 0,0xE5BC, 0, 0, 0,0xE5BE,0xE5BD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE5C0,0xE5BF,0xE579, 0, 0, 0,0xE5C4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE5C1, 0, 0, 0, 0,0xE5C2, 0, + 0,0xE5C3, 0,0xE5C5, 0, 0, 0, 0, +0x8C8C, 0,0xE5C7, 0,0xE5C6, 0,0x8F4F, 0, + 0, 0, 0, 0,0x8D73,0x9FA5, 0, 0, + 0, 0,0xE5C8,0x8F70, 0, 0, 0,0x8A58, + 0,0xE5C9, 0,0x8971, 0,0x8FD5,0xE5CA, 0, + 0,0x8D74,0xE5CB,0x88DF, 0, 0, 0, 0, +0x955C, 0, 0,0xE5CC, 0, 0, 0, 0, +0x908A, 0,0xE5D3, 0, 0,0xE5D0, 0,0x928F, + 0, 0, 0, 0, 0,0xE5D1,0xE5CE,0x8BDC, + 0,0xE5CD,0xE5D4, 0, 0, 0, 0, 0, +0x8C55, 0, 0,0x91DC, 0,0xE5DA, 0, 0, + 0, 0,0xE5D6, 0, 0, 0,0x91B3,0xE5D5, + 0,0xE5D8, 0, 0, 0, 0,0xE5CF, 0, + 0, 0,0xE5D9, 0,0xE5DB, 0, 0, 0, + 0, 0, 0,0x94ED, 0, 0,0xE5D7, 0, +0xE5DC,0xE5DE, 0, 0,0x8CD1,0xE5D2, 0,0x88BF, + 0, 0, 0, 0, 0, 0, 0,0xE5DD, + 0,0x8DD9,0x97F4,0xE5DF,0xE5E0,0x9195, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x97A0, + 0, 0, 0, 0,0xE5E1,0x9754, 0, 0, +0xE5E2,0xE5E3, 0, 0,0x95E2,0xE5E4, 0,0x8DBE, + 0,0x97A1, 0, 0, 0, 0, 0, 0, +0xE5E9, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE5EA,0x8FD6,0xE5E8,0xFBA2, 0, 0, +0x9787,0xE5E5, 0, 0,0xE5E7,0x90BB,0x909E, 0, + 0, 0,0xE5E6, 0,0xE5EB, 0, 0,0x95A1, + 0, 0,0xE5ED, 0,0xE5EC, 0, 0, 0, +0x8A8C, 0,0x964A,0xE5EE, 0, 0, 0, 0, + 0, 0, 0, 0,0xFA5D,0xE5FA,0xE5F0, 0, + 0, 0, 0, 0, 0,0xE5F1, 0, 0, + 0, 0,0xE5F2,0xE5F3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE5F7, 0, +0xE5F8, 0, 0,0xE5F6, 0, 0, 0, 0, + 0,0xE5F4, 0,0xE5EF,0xE5F5, 0, 0, 0, + 0, 0, 0, 0,0xE5F9,0xE8B5, 0, 0, + 0, 0, 0, 0, 0, 0,0x89A6, 0, + 0, 0, 0, 0, 0, 0,0xE5FC,0x8BDD, +0xE5FB, 0, 0, 0,0xE641, 0,0xE640, 0, + 0, 0,0xE643, 0, 0,0xE642, 0,0xE644, + 0, 0,0x8F50, 0,0xE645, 0, 0,0xE646, + 0, 0, 0, 0, 0, 0,0xE647,0x90BC, + 0,0x9776, 0,0xE648, 0, 0,0x95A2,0x9465, +0xE649, 0,0xE64A,0x8CA9, 0, 0, 0,0x8B4B, + 0, 0, 0,0xE64B, 0, 0,0x8E8B,0x9460, +0xE64C, 0,0x8A6F, 0, 0, 0, 0, 0, + 0,0xE64D, 0, 0, 0, 0,0xE64F,0x9797, + 0,0xE64E,0x9065, 0,0xE650, 0, 0,0xE651, + 0, 0,0xE652,0x8ACF, 0, 0, 0, 0, + 0, 0,0xE653, 0, 0,0xE654, 0,0xE655, +0xE656, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8A70, 0, 0, 0, 0, 0, + 0, 0,0xE657, 0,0xE658,0xE659, 0, 0, + 0, 0, 0,0x89F0, 0, 0,0x9047,0xE65A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE65B, 0, 0, 0, +0xE65C, 0, 0, 0, 0, 0, 0, 0, +0x8CBE, 0,0x92F9,0xE65D, 0, 0, 0, 0, +0x8C76, 0,0x9075, 0,0xE660, 0,0x93A2, 0, +0xE65F, 0,0xFBA3,0x8C50, 0, 0,0xE65E,0x91F5, +0x8B4C, 0, 0,0xE661, 0,0xE662, 0,0x8FD7, + 0, 0, 0,0x8C8D, 0,0xE663, 0, 0, + 0, 0,0x964B, 0, 0,0x90DD, 0, 0, + 0,0x8B96, 0,0x96F3,0x9169, 0,0xE664,0xFBA4, + 0, 0,0x9066,0x9290,0x8FD8, 0, 0, 0, + 0,0xE665, 0, 0, 0, 0,0xE668, 0, +0xE669, 0, 0, 0, 0, 0, 0, 0, +0x8DBC,0x91C0,0xE667, 0,0x8FD9,0x955D, 0, 0, + 0, 0, 0,0xE666, 0, 0,0x8E8C, 0, +0x8972, 0,0xE66D,0x8C77, 0, 0,0x8E8E, 0, + 0,0x8E8D, 0,0x986C,0xE66C,0xE66B,0x9146, 0, +0x8B6C,0x9862,0x8A59,0x8FDA, 0, 0, 0, 0, + 0,0xFBA5, 0, 0,0xE66A, 0, 0, 0, + 0, 0,0xE66F, 0,0xE670,0xE66E, 0,0x8CD6, + 0,0x975F, 0, 0,0x8E8F,0x9446, 0, 0, + 0,0xE673, 0,0x90BE, 0,0x9261, 0, 0, +0x9755, 0,0xE676, 0, 0, 0,0x8CEA, 0, +0x90BD,0xE672, 0,0xE677,0x8CEB,0xE674,0xE675,0xFBA6, +0xE671, 0, 0, 0,0x90E0,0x93C7, 0, 0, +0x924E, 0,0x89DB, 0, 0, 0, 0, 0, + 0,0x94EE, 0, 0,0x8B62, 0,0xFBA7,0x92B2, + 0, 0,0xE67A, 0,0xE678, 0, 0,0x926B, + 0, 0, 0,0x90BF,0x8AD0,0xE679, 0,0x907A, + 0, 0,0x97C8, 0, 0, 0,0x985F, 0, + 0, 0,0xE67B,0xE687,0x92B3, 0,0xE686,0xFBA8, +0xE683,0xE68B,0xE684, 0,0xE680, 0,0x92FA,0xE67E, + 0, 0, 0,0xE67C, 0,0x9740,0x8E90, 0, + 0,0xE681, 0,0xE67D, 0, 0,0xFBAA,0xE685, +0x8F94, 0,0x8CBF, 0, 0, 0,0x91F8, 0, +0x9664,0x8979,0x88E0, 0,0x93A3, 0, 0,0xE689, + 0, 0, 0, 0,0xE688, 0,0x93E4, 0, +0xE68D, 0, 0, 0,0xE682, 0,0xE68C,0xE68E, + 0,0x8CAA,0xE68A,0x8D75, 0,0x8ED3, 0, 0, +0xE68F,0x9777, 0, 0, 0, 0,0xE692, 0, +0xE695, 0, 0,0xE693,0x9554, 0, 0, 0, + 0, 0, 0,0xE690, 0, 0, 0, 0, + 0,0x8BDE, 0, 0, 0, 0,0xE694, 0, + 0,0xE696, 0, 0, 0, 0, 0, 0, + 0,0xE69A, 0, 0,0xE697, 0,0xE699,0xE698, + 0, 0, 0,0xFBAB, 0, 0,0xE69B, 0, +0x8EAF, 0,0xE69D,0xE69C,0x9588, 0, 0,0xE69F, + 0, 0, 0, 0, 0, 0,0x8C78, 0, + 0, 0, 0,0xE69E,0xE6A0, 0, 0,0xE6A1, +0x8B63,0xE3BF,0x8FF7, 0,0xE6A2, 0, 0,0x8CEC, + 0, 0, 0, 0, 0,0xE6A3, 0,0xFBAC, +0xE6A4, 0, 0,0x8E5D, 0, 0, 0, 0, + 0, 0,0x9DCC, 0,0xE6A5, 0,0xE6A6, 0, +0x8F51, 0,0xE6A7,0xE6A8, 0, 0,0xE6A9, 0, + 0,0xE6AA,0xE6AB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x924A, + 0, 0,0xE6AC, 0, 0, 0, 0,0xE6AE, + 0,0xE6AD, 0, 0, 0, 0,0x93A4, 0, +0xE6AF, 0,0x964C, 0,0xE6B0, 0,0xE6B1, 0, +0xE6B2, 0, 0, 0, 0,0xE6B3, 0, 0, + 0, 0,0x93D8, 0, 0, 0, 0, 0, + 0,0x8FDB,0xE6B4, 0, 0, 0, 0, 0, + 0, 0,0x8D8B,0x98AC,0xE6B5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE6B6,0x955E,0xE6B7, 0,0xE6BF, 0, 0, 0, + 0, 0,0xE6B8, 0, 0,0xE6BA, 0, 0, + 0,0xE6B9,0xE6BB, 0,0x9665,0xE6BC,0xE6BD, 0, + 0, 0, 0, 0,0xE6BE, 0, 0, 0, +0xE6C0, 0, 0, 0, 0,0x8A4C,0x92E5, 0, +0x9589,0x8DE0,0x8D76, 0, 0, 0, 0,0x956E, +0x89DD,0x94CC,0xE6C3,0x8AD1,0x90D3,0xE6C2,0xE6C7,0x9299, +0x96E1, 0,0xE6C5,0xE6C6,0x8B4D, 0,0xE6C8,0x9483, +0x91DD, 0, 0,0x94EF,0x935C,0xE6C4, 0,0x9666, +0x89EA,0xE6CA,0x9847,0x92C0,0x9864, 0, 0,0x8E91, +0xE6C9, 0,0x91AF, 0, 0,0xE6DA,0x9147, 0, + 0,0x93F6, 0,0x956F, 0, 0, 0, 0, + 0, 0,0xE6CD,0x8E5E,0x8E92, 0,0x8FDC, 0, +0x9485, 0,0x8CAB,0xE6CC,0xE6CB, 0,0x958A, 0, + 0, 0,0x8EBF, 0, 0,0x9371, 0, 0, +0xFBAD, 0, 0, 0,0xFBAE, 0, 0, 0, + 0, 0,0xE6CF,0xE6D0,0x8D77,0xE6CE, 0, 0, + 0, 0, 0, 0,0xE6D1,0xE6D2, 0,0xE6D4, +0x91A1, 0,0xE6D3,0x8AE4, 0,0xE6D6, 0,0xE6D5, +0xE6D7, 0,0xFBAF,0xE6D9,0xE6DB, 0,0xE6DC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x90D4, 0,0x8ECD,0xE6DD, + 0, 0, 0,0x8A71, 0,0xE6DE, 0, 0, +0x9196,0xE6DF, 0,0xE6E0,0x958B, 0,0xFBB0,0x8B4E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE6E1, 0, 0, 0,0x92B4, 0, 0, + 0, 0,0x897A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE6E2, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8EEF, 0, 0, 0, 0, +0x9096, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x91AB, 0, 0, 0, 0, + 0, 0,0xE6E5, 0, 0, 0,0xE6E4, 0, + 0, 0,0xE6E3, 0, 0, 0, 0, 0, + 0, 0, 0,0xE6EB,0xE6E9, 0, 0,0xE6E6, + 0, 0, 0, 0, 0, 0,0xE6E8, 0, + 0, 0,0xE6E7,0xE6EA, 0,0x8B97, 0,0xE6EE, + 0,0x90D5, 0,0xE6EF, 0, 0, 0, 0, +0x8CD7, 0,0xE6EC,0xE6ED, 0, 0, 0,0x9848, + 0, 0, 0,0x92B5, 0,0x9148, 0, 0, + 0, 0, 0, 0,0xE6F0, 0, 0,0xE6F3, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE6F1,0xE6F2,0x9778, 0, 0, 0, 0,0x93A5, +0xE6F6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE6F4,0xE6F5,0xE6F7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE748, 0, 0, 0, 0, 0, +0xE6FA, 0, 0, 0,0xE6FB,0xE6F9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE6F8, 0,0x92FB, 0, 0,0xE740, +0xE744,0xE741,0xE6FC, 0,0xE742, 0, 0, 0, +0xE743, 0, 0, 0, 0,0xE74A, 0, 0, + 0,0xE745, 0, 0, 0, 0, 0,0x90D6, +0xE747, 0, 0,0xE749,0xE746, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE74C, 0,0x8F52, 0,0xE74B, 0, + 0, 0, 0, 0,0xE74D, 0, 0, 0, + 0,0xE74E, 0, 0,0xE751,0xE750, 0,0xE74F, + 0, 0,0xE753,0xE752, 0,0x96F4, 0, 0, + 0,0xE755, 0,0xE754,0xE756, 0, 0, 0, + 0,0xE757, 0, 0, 0, 0, 0, 0, + 0,0xE759, 0, 0, 0, 0, 0, 0, + 0, 0,0xE758,0x9067,0xE75A, 0, 0,0x8BEB, +0xE75B,0xE75D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE75E, 0, + 0, 0, 0, 0, 0,0xE75F,0xE75C, 0, +0xE760, 0,0x8ED4,0xE761,0x8B4F,0x8C52, 0,0xFBB2, + 0, 0,0x8CAC, 0, 0, 0, 0, 0, + 0, 0, 0,0xE762, 0, 0, 0,0x93EE, + 0, 0,0x935D,0xE763, 0, 0, 0, 0, + 0, 0, 0,0xE766, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8EB2, 0, 0,0xE765,0xE764,0x8C79,0xE767, 0, + 0, 0, 0,0x8A72, 0,0xE769, 0, 0, + 0,0x8DDA,0xE768, 0,0xE771, 0, 0, 0, + 0, 0,0xE76B,0xE76D,0x95E3,0xE76A, 0, 0, + 0,0xE76C, 0,0xE770,0xE76E,0x8B50, 0,0xE76F, + 0, 0, 0, 0, 0, 0,0xE772, 0, + 0,0x9479,0x97D6, 0, 0, 0, 0,0x8F53, + 0, 0, 0,0xE773, 0, 0, 0, 0, +0x9741,0xE775, 0,0xE774, 0, 0,0xE778,0x9760, + 0, 0,0xE777, 0,0x8A8D,0xE776,0xE77B, 0, + 0,0xE77A, 0, 0,0xE779,0x9351,0xE77C, 0, + 0, 0, 0, 0, 0, 0, 0,0xE77D, + 0, 0, 0, 0,0xE77E, 0, 0,0x8D8C, + 0,0x8C44,0xE780,0xE781,0xE782, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9068,0xE783, 0,0x8EAB,0xE784, + 0, 0, 0,0xE785, 0, 0, 0,0x999F, +0x999E, 0, 0, 0, 0,0xE786,0xE390,0xE787, +0x9243,0x904A,0x945F, 0, 0, 0, 0,0xE788, + 0, 0,0x95D3,0x92D2,0x8D9E, 0, 0,0x9248, + 0, 0,0x8949, 0,0x9698,0x9076, 0, 0, + 0, 0, 0, 0, 0, 0,0x8C7D, 0, + 0,0x8BDF, 0, 0,0x95D4, 0, 0, 0, + 0, 0,0xE789, 0, 0, 0, 0, 0, + 0, 0,0xE78B, 0, 0,0xE78A,0x89DE, 0, + 0,0x93F4,0xE78C,0x9497, 0,0x9352, 0,0xE78D, +0x8F71, 0, 0, 0,0xE78F, 0, 0,0x96C0, +0xE79E,0xE791,0xE792, 0, 0,0x92C7, 0, 0, +0x91DE,0x9197, 0,0x93A6, 0,0xE790,0x8B74, 0, + 0, 0, 0,0xE799, 0,0xE796,0xE7A3,0x93A7, +0x9280,0xE793, 0,0x92FC,0x9372,0xE794,0xE798,0x9080, + 0,0x9487,0x92CA, 0, 0,0x90C0,0xE797,0x91AC, +0x91A2,0xE795,0x88A7,0x9841, 0, 0, 0,0xE79A, + 0, 0, 0, 0, 0, 0,0x91DF, 0, + 0,0x8F54,0x9069, 0, 0,0xE79C,0xE79B, 0, +0x88ED,0xE79D, 0, 0,0x954E, 0,0xE7A5, 0, + 0,0x93D9,0x908B, 0, 0,0x9278, 0,0x8BF6, + 0,0xE7A4,0x9756,0x895E, 0,0x95D5,0x89DF,0xE79F, +0xE7A0,0xE7A1,0xE7A2,0x93B9,0x9242,0x88E1,0xE7A6, 0, +0xE7A7,0xEAA1, 0, 0,0x91BB, 0,0xE7A8, 0, +0x8993,0x916B, 0,0x8CAD, 0,0x9779, 0,0xFBB5, +0xE7A9,0x934B, 0, 0, 0,0x9198,0x8ED5,0xE7AA, + 0, 0,0xE7AD, 0, 0,0x8F85,0xE7AB,0x914A, +0x9149, 0,0x88E2, 0,0x97C9,0xE7AF, 0,0x94F0, +0xE7B1,0xE7B0,0xE7AE,0xE284,0x8AD2, 0, 0,0xE78E, + 0,0xE7B3,0xE7B2, 0, 0, 0, 0,0xE7B4, + 0,0x9757, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x93DF, 0, 0,0x964D, 0, +0xE7B5, 0,0x8ED7, 0, 0, 0, 0,0xE7B6, + 0,0xE7B7, 0, 0, 0,0xE7B8, 0, 0, +0x9340, 0, 0, 0, 0, 0, 0, 0, + 0,0x88E8, 0, 0, 0, 0, 0, 0, + 0, 0,0x8D78, 0, 0, 0,0x9859, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE7BC, 0, 0,0xFBB6, 0, + 0,0x8C53,0xE7B9, 0,0xE7BA, 0, 0, 0, +0x9594, 0, 0, 0, 0,0x8A73, 0, 0, + 0, 0, 0, 0, 0,0x9758, 0,0x8BBD, + 0, 0, 0, 0, 0,0x9373, 0, 0, + 0, 0,0xE7BD, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE7BE, 0, 0,0xFBB8, 0, 0, + 0,0xE7BF, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xFBB9, + 0, 0, 0, 0, 0,0x9341, 0, 0, +0xE7C1, 0,0xE7C0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x93D1,0xE7C2,0x8F55,0x8EDE,0x947A,0x9291, 0, + 0, 0,0x8EF0, 0,0x908C, 0,0xE7C3, 0, +0xE7C4, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x907C,0xE7C5, 0,0xE7C6, 0, 0, + 0,0xE7C7,0x978F, 0,0x8F56, 0, 0, 0, + 0, 0,0xE7C9,0xE7C8, 0,0x8D79, 0,0x8D93, +0x8E5F, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE7CC, 0, 0, 0, 0,0x8F86, + 0,0xE7CB, 0,0xE7CA, 0,0x91E7, 0, 0, +0x8CED, 0,0x90C1, 0, 0, 0, 0,0x94AE, + 0, 0, 0, 0,0x8F58, 0, 0, 0, + 0, 0,0xE7CD, 0,0x8FDD, 0, 0, 0, + 0, 0,0xE7D0,0xE7CE, 0, 0, 0,0xE7CF, + 0, 0, 0, 0,0xE7D2,0xE7D1, 0, 0, +0x8FF8, 0,0xE7D3, 0, 0, 0, 0, 0, +0xE7D4,0xE7D5, 0, 0, 0, 0,0x94CE,0x8DD1, +0x8EDF,0xE7D6, 0,0xE7D7,0x97A2,0x8F64,0x96EC,0x97CA, +0xE7D8,0x8BE0, 0, 0, 0, 0,0xE7D9,0xFBBB, +0x9342, 0,0xFBBA,0xE7DC,0x8A98,0x906A,0xFBBC,0xE7DA, + 0,0xE7DB, 0,0x92DE,0xFBBF,0xFBC0,0x9674,0x8BFA, + 0, 0, 0, 0, 0,0xFBBD,0xFBBE, 0, + 0, 0, 0, 0, 0,0xE7DE,0xE7DF, 0, + 0, 0, 0, 0,0xE7DD, 0, 0,0xE7E1, + 0, 0, 0, 0, 0, 0,0xFBC1, 0, + 0, 0,0xFBC3, 0, 0,0x93DD,0x8A62, 0, +0xFBC2,0xE7E5, 0, 0,0xE7E2,0xE7E4, 0, 0, + 0, 0, 0, 0, 0, 0,0xE7E0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE86E, 0, 0,0xE7E3, 0, 0, 0, + 0, 0, 0, 0,0x97E9, 0, 0,0x8CD8, + 0,0xFBCA,0xFBC4, 0,0xFBC6, 0, 0,0xE7ED, +0xFBC5, 0, 0, 0,0x9353,0xE7E8, 0, 0, +0xE7EB,0xE7E9, 0,0xE7EE, 0, 0,0xFBC7, 0, +0xE7EF,0xFBC9, 0, 0, 0, 0, 0,0xE7E7, + 0,0xFBC8,0xE7F4,0x8994, 0, 0,0xE7E6, 0, + 0, 0,0x94AB, 0,0xE7EA, 0,0x8FDE,0xFBCB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8D7A, 0, 0, 0, 0, 0,0xFBCD, +0xFBCE, 0, 0, 0, 0, 0,0x9667, 0, +0x8BE2, 0, 0,0x8F65, 0,0x93BA, 0, 0, +0xFA5F, 0, 0, 0, 0, 0, 0, 0, + 0,0x914C, 0,0xE7F2, 0,0xE7EC,0xE7F1, 0, +0x96C1, 0,0x92B6,0xE7F3,0xE7F0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xFBCC, + 0, 0, 0, 0, 0,0x914B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE7F7, + 0,0xE7F6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE7F5, +0xFBD2, 0,0x964E,0xFBD6, 0,0xFBD4, 0,0xFBD0, + 0,0xFBD1, 0, 0, 0, 0, 0, 0, +0xFBD5, 0, 0, 0,0x8F9B, 0, 0,0xFBCF, + 0,0xE7F8,0x95DD, 0, 0,0x8973, 0, 0, + 0, 0,0x9565,0x9292, 0, 0, 0, 0, +0x8B98,0xFA65,0xE7FA,0xFBD9,0x8D7C, 0, 0,0xFBDC, + 0, 0,0xFBDE, 0, 0, 0,0x8E4B, 0, + 0, 0, 0, 0, 0, 0, 0,0xE7F9, +0x908D, 0, 0, 0, 0, 0, 0, 0, +0x908E,0xE840,0xE842, 0, 0,0xFBDD,0xFBDB, 0, +0x8FF9,0xFBD8,0xE841,0xE843, 0,0xFBD7,0x8BD1, 0, +0x9564, 0, 0,0x8EE0,0x9842, 0,0xE7FC,0x8DF6, + 0, 0,0x985E, 0, 0,0xE845, 0, 0, + 0, 0,0xE844,0xE846, 0, 0, 0, 0, + 0, 0, 0, 0,0xE7FB, 0, 0, 0, +0xFA5E, 0, 0,0x93E7, 0,0x9374, 0, 0, + 0, 0, 0, 0,0x92D5, 0,0xE84B,0xFBE0, + 0, 0, 0,0x9262,0xE847, 0, 0, 0, +0xE848, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8C4C, 0,0xE84A, 0, +0xFBDF, 0, 0, 0, 0,0x8CAE, 0, 0, + 0, 0, 0, 0,0xE849, 0,0x8FDF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8A99, 0, 0, 0, + 0, 0, 0, 0,0xE84F, 0,0x8DBD,0x9199, + 0, 0,0x92C8, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFBE1, 0, 0,0x8A5A, + 0, 0, 0, 0,0xE84D,0xE84E,0x92C1, 0, +0xE84C, 0, 0, 0, 0, 0, 0, 0, + 0,0xE850, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE856, 0, 0,0xFBE2, 0, +0xE859, 0, 0, 0, 0, 0, 0, 0, +0xE858,0x934C, 0, 0, 0, 0,0xE851,0xE852, +0xE855, 0, 0, 0, 0,0xE857,0xFBE3, 0, + 0,0x8BBE, 0, 0,0xE85A,0xE854, 0, 0, +0xE853, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFBE4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE85E, 0, 0, 0,0xE85F, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE860, 0, 0,0xE85D,0xE85C, 0, 0, 0, +0x8FE0,0x93A8,0xE85B, 0, 0, 0, 0, 0, + 0,0xE864, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE862, 0, 0, 0, 0, + 0,0xFBE5, 0, 0, 0,0xE863,0xE861, 0, +0x91F6, 0,0xE865, 0, 0, 0, 0, 0, + 0,0xE866, 0, 0,0xE868,0xFBE6, 0, 0, +0xFBE7, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AD3,0xE867,0x96F8, 0, 0, 0, 0, + 0, 0,0xE873,0xE869, 0, 0,0xE86C, 0, +0xE86A, 0,0xE86B, 0, 0, 0, 0, 0, + 0, 0,0xE86D, 0, 0, 0, 0, 0, +0xE86F, 0, 0, 0, 0,0xE870, 0,0xE871, + 0, 0, 0, 0,0xE874,0xE872,0xE875,0xE877, + 0,0xE876}; + +/* page 7 0x9577-0x9FA0 */ +static uint16 tab_uni_cp9327[]={ +0x92B7, 0, 0, 0, 0, 0, 0, 0, + 0,0x96E5, 0,0xE878,0x914D, 0, 0, 0, +0xE879, 0,0x95C2,0xE87A,0x8A4A, 0, 0, 0, +0x895B, 0,0x8AD5,0xFBE8,0x8AD4,0xE87B, 0,0xE87C, + 0,0xE87D,0xE87E, 0, 0, 0, 0, 0, + 0,0xE880, 0,0x8AD6,0x8A74,0x8D7D,0x94B4, 0, +0xE882,0xE881, 0, 0, 0, 0,0xE883, 0, + 0, 0, 0,0x897B, 0, 0, 0, 0, + 0, 0,0xE886, 0,0xE885,0xE884, 0,0xE887, + 0, 0, 0, 0,0xE88A, 0, 0, 0, +0x88C5, 0, 0,0xE888, 0,0xE88C,0xE88B, 0, + 0, 0, 0, 0, 0,0xE88E,0xE88D,0xE88F, + 0,0x93AC, 0, 0, 0,0xE890, 0, 0, + 0, 0,0xE891,0xE893, 0, 0,0xE892, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x958C, 0, 0, + 0, 0,0xE894, 0, 0, 0, 0, 0, + 0,0xE895, 0,0x8DE3, 0, 0, 0,0xE896, +0xE897, 0, 0,0x9668, 0, 0, 0, 0, + 0, 0, 0, 0,0x916A, 0, 0, 0, +0x88A2,0x91C9, 0,0xE898, 0,0x958D, 0, 0, + 0, 0, 0, 0,0xE89B,0xE899,0x8D7E, 0, +0xE89A,0x8CC0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x95C3,0xE89D,0xE89F,0xE89E, +0xE8A0, 0, 0,0x8940,0x9077,0x8F9C,0x8AD7,0xE8A1, + 0, 0, 0,0x9486, 0,0xE8A3, 0, 0, + 0,0x8941, 0,0xE8A2,0x92C2, 0,0x97CB,0x93A9, +0xE89C,0x97A4, 0,0x8CAF, 0, 0,0x977A, 0, + 0, 0, 0, 0, 0, 0,0x8BF7,0x97B2, + 0,0x8C47, 0,0x91E0,0xE440, 0,0xE8A4,0x8A4B, +0x908F, 0, 0, 0, 0,0x8A75,0xE8A6, 0, +0xE8A7,0xE8A5,0x8C84, 0,0x8DDB,0x8FE1,0xFBEB, 0, + 0,0x8942, 0, 0,0x97D7, 0, 0, 0, +0xE8A9,0xE7AC, 0,0xE8A8, 0, 0, 0, 0, +0xFBEC,0xE8AC,0xE8AA,0xE8AB, 0,0xE8AD, 0,0xE8AE, +0x97EA,0xE8AF,0xE8B0, 0,0x90C7,0x94B9, 0, 0, + 0,0x909D,0x8AE5, 0, 0,0x9759,0x89EB,0x8F57, +0x8CD9, 0,0xE8B3, 0,0xE8B2,0x8E93,0xE8B4,0xE8B1, + 0, 0,0x8E47, 0, 0, 0,0xE8B8,0xE5AB, + 0, 0,0x99D4, 0,0x9097,0xE8B6, 0, 0, + 0, 0, 0,0x97A3,0x93EF, 0, 0, 0, + 0,0x894A, 0,0x90E1,0x8EB4, 0, 0, 0, + 0,0x95B5, 0,0x895F, 0, 0, 0,0x97EB, +0x978B, 0,0xE8B9, 0,0x9364, 0, 0, 0, + 0,0x8EF9, 0, 0, 0,0xE8BA, 0,0xE8BB, +0x906B,0xE8BC, 0,0x97EC, 0, 0,0xE8B7,0xE8BE, +0xE8C0, 0,0xE8BF, 0,0xE8BD, 0, 0,0xE8C1, + 0, 0,0xE8C2, 0, 0,0x919A, 0,0x89E0, + 0, 0, 0, 0, 0,0xE8C3, 0, 0, +0x96B6, 0, 0,0xE8C4, 0, 0, 0, 0, + 0,0xE8C5, 0,0x9849,0xFBED, 0, 0, 0, + 0,0x9E50,0xE8C6, 0,0xFBEE, 0,0xE8C7,0xE8C8, + 0, 0, 0,0xE8CC,0xFBEF,0xE8C9, 0,0xE8CA, + 0,0xE8CB,0xE8CD, 0, 0, 0,0xFBF0, 0, +0xFBF1, 0,0xFBF2,0x90C2, 0, 0,0xFBF3,0x96F5, + 0, 0,0x90C3, 0, 0,0xE8CE, 0,0x94F1, + 0,0xE8CF,0xEA72,0x96CA, 0,0xE8D0, 0,0xE8D1, + 0,0xE8D2,0x8A76, 0,0xE8D4, 0,0x9078, 0, + 0, 0,0xE8D5, 0, 0,0x8C43, 0, 0, + 0, 0,0xE8D6,0xE8DA, 0,0xE8D8, 0, 0, + 0, 0,0xE8D9, 0, 0,0x8A93,0xE8D7,0xE8DB, + 0, 0, 0, 0,0xE8DC, 0,0x88C6, 0, +0xE8DD,0xE8DE, 0, 0, 0, 0, 0, 0, + 0,0x8FE2, 0, 0, 0,0xE8DF, 0, 0, + 0,0x8B66, 0, 0,0xE8E2, 0, 0,0xE8E1, + 0,0xE8E0, 0, 0,0xE691, 0,0x95DA, 0, + 0, 0, 0, 0,0xE8E3,0xE8E4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE8E5, 0, 0,0xE8E6, + 0,0xE8E7, 0, 0,0xE8E8, 0, 0, 0, + 0, 0, 0, 0,0x8AD8, 0, 0, 0, + 0, 0, 0, 0, 0,0xE8E9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE8EA,0x9442, + 0, 0, 0,0xE8EC,0x89B9, 0,0xE8EF,0xE8EE, + 0, 0, 0, 0,0x8943, 0, 0, 0, +0x8BBF, 0,0x95C5,0x92B8,0x8DA0, 0,0x8D80,0x8F87, + 0,0x907B, 0, 0, 0,0xE8F1, 0, 0, +0xE8F0,0x9761,0x8AE6,0x94D0,0x93DA, 0, 0, 0, +0x909C,0x97CC, 0,0x8C7A, 0, 0, 0, 0, + 0, 0,0xE8F4, 0, 0,0xE8F3, 0, 0, + 0, 0, 0, 0, 0,0x966A,0x93AA, 0, + 0, 0, 0, 0, 0,0x896F, 0, 0, +0xE8F5,0xE8F2, 0, 0,0x9570,0x978A,0xE8F6, 0, + 0, 0, 0, 0, 0, 0, 0,0xE8F7, + 0, 0, 0, 0,0xE8F9,0x91E8,0x8A7A,0x8A7B, +0xE8F8, 0, 0, 0, 0,0x8AE7,0x8CB0, 0, +0xFBF4,0x8AE8, 0, 0,0x935E, 0, 0,0x97DE, + 0, 0, 0, 0, 0, 0,0xFBF5, 0, +0x8CDA, 0, 0, 0,0xE8FA, 0, 0, 0, +0xE8FB,0xE8FC,0xE940, 0,0xE942,0xE941, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9597, 0,0xE943, 0, 0, 0, 0, +0xE944, 0,0xE945, 0, 0, 0, 0,0xE946, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE948,0xE947, 0,0xE949, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x94F2,0xE3CA, 0, 0, +0x9048, 0, 0,0x8B51, 0, 0, 0, 0, + 0, 0,0xE94A, 0,0xE94B, 0,0x99AA,0x9F5A, +0x94D1, 0, 0,0x88F9, 0,0x88B9, 0, 0, + 0, 0, 0, 0, 0,0x8E94,0x964F,0x8FFC, + 0, 0, 0, 0,0xE94C, 0,0x96DD, 0, + 0, 0,0xE94D,0x977B, 0,0x8961, 0, 0, + 0,0x8E60, 0,0xE94E,0x89EC,0xE94F, 0, 0, + 0,0xE950, 0, 0, 0, 0,0xE952,0xE953, + 0,0xE955,0xE951, 0, 0,0xE954, 0, 0, +0xFBF8,0x8AD9, 0, 0, 0,0xE956, 0,0xE957, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE958,0xE959, + 0, 0, 0,0xE95A, 0, 0,0xE95C, 0, + 0, 0,0xE95B, 0,0xE95E,0xE961, 0, 0, + 0,0xE95D,0xE95F,0xE960, 0, 0,0xE962, 0, +0x8BC0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8EF1, +0xE963,0xE964,0x8D81, 0, 0, 0, 0,0xFBFA, + 0, 0, 0, 0, 0, 0,0xE965, 0, + 0,0x8A5D, 0, 0, 0,0x946E,0xE966,0xE967, + 0, 0, 0, 0,0x9279,0x93E9, 0, 0, + 0, 0, 0, 0, 0,0xE968, 0, 0, + 0, 0,0x949D, 0, 0,0x91CA,0x8977,0x8BEC, + 0,0x8BED, 0, 0, 0, 0, 0, 0, + 0,0x9293,0xE96D,0x8BEE, 0, 0,0x89ED, 0, + 0,0xE96C, 0, 0,0xE96A, 0,0xE96B, 0, +0xE969, 0, 0,0xE977, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE96E,0xE96F, + 0, 0,0xE970,0xE971, 0, 0, 0, 0, + 0,0xE973, 0, 0,0xE972, 0, 0, 0, +0x8F78, 0,0xE974, 0, 0, 0,0xE976, 0, + 0, 0, 0, 0, 0, 0, 0,0x8B52, +0xE975, 0, 0,0x919B,0x8CB1, 0, 0, 0, + 0, 0,0xE978, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x91CB, 0, 0,0xE979, 0, 0, 0, + 0,0x93AB, 0, 0, 0, 0, 0, 0, +0xE97A, 0, 0, 0, 0, 0, 0,0xE980, + 0,0xE97D, 0,0xE97C,0xE97E, 0,0xE97B, 0, + 0, 0, 0, 0, 0, 0,0xE982,0xFBFB, + 0, 0, 0, 0, 0, 0,0xE981, 0, +0xE984, 0, 0,0x8BC1,0xE983, 0, 0, 0, +0xE985, 0, 0,0xE986, 0,0xE988,0xE987, 0, + 0, 0,0xE989,0xE98B,0xE98A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8D9C, 0, 0, 0, 0,0xE98C, 0, + 0,0xE98D, 0, 0, 0, 0, 0, 0, + 0,0x8A5B, 0, 0, 0,0xE98E, 0, 0, + 0,0xE98F, 0, 0, 0,0x9091, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE990, 0,0xE991, 0,0xE992,0xE993, 0, 0, + 0,0x8D82,0xFBFC, 0, 0,0xFC40, 0,0xE994, +0xE995, 0, 0,0xE996,0xE997, 0, 0,0xE998, + 0, 0, 0,0x94AF,0xE99A, 0,0x9545,0xE99B, +0xE999, 0,0xE99D, 0, 0,0xE99C, 0, 0, +0xE99E, 0, 0, 0,0xE99F, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE9A0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE9A1, 0,0xE9A2, 0, 0, 0, 0, +0xE9A3, 0, 0,0xE9A4,0xE9A5, 0,0xE9A6, 0, +0xE9A7,0xE9A8,0xE9A9,0xE9AA, 0, 0, 0,0xE9AB, +0xE9AC, 0,0x9F54,0xE9AD, 0, 0, 0, 0, + 0, 0, 0, 0,0xE2F6,0x8B53, 0, 0, + 0, 0,0x8A40,0x8DB0,0xE9AF,0xE9AE,0x96A3, 0, + 0, 0, 0, 0, 0, 0,0xE9B1,0xE9B2, +0xE9B0, 0,0xE9B3, 0, 0,0x9682, 0, 0, + 0,0xE9B4, 0,0x8B9B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9844, 0, 0,0xFC42, 0,0xE9B5,0xFC41, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE9B7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x88BC, +0xFC43, 0,0xE9B8,0x95A9,0xE9B6, 0, 0,0xE9B9, +0xE9BA, 0, 0, 0, 0, 0, 0, 0, +0xE9BB,0xE9BC, 0, 0, 0, 0, 0, 0, + 0,0xE9BD, 0,0x968E,0x8E4C, 0,0x8DF8,0x914E, + 0, 0,0xFC44, 0, 0,0xE9BE, 0, 0, + 0, 0,0xE9C1, 0,0xFC45, 0, 0, 0, + 0,0xE9BF, 0, 0, 0, 0, 0,0xE9C2, + 0, 0,0x8CEF,0xE9C0, 0, 0, 0, 0, +0xE9C3, 0,0xE9C4,0xE9C5, 0,0xE9C9, 0,0x8E49, + 0, 0, 0, 0,0x91E2, 0, 0, 0, + 0, 0,0xE9CA,0xE9C7,0xE9C6,0xE9C8, 0, 0, + 0,0x8C7E, 0, 0, 0, 0, 0, 0, + 0,0xE9CE,0xE9CD,0xE9CC, 0, 0,0x88B1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFC46, 0, 0, 0,0xE9D8, 0,0xE9D4, + 0,0xE9D5,0xE9D1,0xE9D7, 0,0xE9D3,0x8A82, 0, + 0,0x986B, 0,0xE9D6,0xE9D2,0xE9D0,0xE9CF, 0, + 0, 0, 0, 0,0xE9DA, 0, 0, 0, + 0, 0,0xE9DD, 0, 0,0xE9DC,0xE9DB, 0, + 0, 0, 0, 0, 0, 0,0x9568,0xE9D9, +0x88F1,0xE9DE, 0,0xE9E0, 0, 0, 0, 0, + 0, 0,0x8A8F,0xE9CB,0x8956, 0, 0,0xE9E2, + 0, 0, 0, 0, 0, 0, 0,0xE9E1, +0xE9DF,0x924C, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9690, 0, 0, 0, 0, +0x97D8, 0, 0,0xE9E3, 0, 0, 0, 0, + 0,0xE9E4, 0, 0, 0, 0, 0, 0, +0xE9E5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE9E6, + 0,0xE9E7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x92B9, 0, +0xE9E8, 0,0x94B5, 0,0xE9ED,0xE9E9, 0, 0, + 0,0xE9EA, 0, 0,0x9650,0x96C2, 0,0x93CE, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE9EE, 0, 0,0xE9EF, +0x93BC,0xE9EC,0xE9EB, 0, 0, 0, 0,0x89A8, + 0, 0, 0,0xE9F7, 0, 0,0xE9F6, 0, + 0, 0, 0, 0,0x8995, 0, 0, 0, +0xE9F4, 0, 0, 0,0xE9F3, 0, 0,0xE9F1, + 0,0x8A9B, 0,0xE9F0,0x8EB0,0x89A7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8D83, 0, 0,0xE9FA, +0xE9F9, 0,0xE9F8, 0, 0,0xE9F5, 0,0xE9FB, + 0,0xE9FC, 0, 0, 0, 0, 0, 0, + 0,0xEA44,0xEA43, 0, 0, 0, 0, 0, + 0, 0,0xEA45, 0, 0,0x894C,0xEA40,0xEA41, + 0,0x8D94,0x96B7, 0, 0,0xEA42, 0, 0, + 0, 0, 0, 0,0xFC48,0x9651, 0, 0, +0xEA4A,0xFC47, 0,0xEA46, 0, 0, 0, 0, + 0, 0, 0,0xEA4B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA48, 0,0xEA47, 0, 0, 0, 0, 0, +0x8C7B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xEA4C, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xEA4D, 0, 0, + 0, 0,0xEA4E, 0,0xEA49, 0, 0, 0, +0xE9F2, 0, 0,0xEA4F, 0,0x92DF, 0, 0, + 0,0xEA53, 0,0xEA54,0xEA52, 0, 0, 0, + 0, 0,0xEA51,0xEA57, 0,0xEA50, 0,0xEA55, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA56, 0, 0, 0,0xEA59, 0, 0, 0, + 0, 0,0xEA58, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xEA5B, + 0, 0, 0, 0, 0, 0,0xEA5C, 0, +0xEA5D, 0, 0,0x9868, 0, 0, 0, 0, + 0,0xEA5A,0x91E9,0x8DEB, 0, 0,0xEA5E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xFC4A,0xEA5F,0xEA60, 0, 0,0xEA61, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xEA62, 0, + 0,0x8CB2,0xEA63, 0, 0, 0,0xEA64, 0, +0x8EAD, 0,0xEA65, 0, 0, 0, 0, 0, + 0,0xEA66, 0, 0,0xEA67,0xEA68, 0, 0, + 0, 0,0xEA6B,0xEA69,0x985B, 0,0xEA6A, 0, +0x97ED, 0, 0, 0, 0, 0,0xEA6C, 0, +0x97D9, 0, 0, 0, 0, 0,0xEA6D,0x949E, + 0, 0,0xEA6E,0xEA70, 0, 0,0xEA71, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEA6F,0x8D8D,0x96CB,0x9683,0x9BF5, 0,0x9F80, +0x969B, 0, 0, 0, 0,0x89A9, 0, 0, + 0, 0, 0, 0, 0,0xEA73,0x8B6F,0xEA74, +0xEA75,0xEA76,0xFC4B,0x8D95, 0,0xEA77, 0, 0, + 0,0xE0D2,0x96D9, 0,0x91E1,0xEA78,0xEA7A,0xEA79, + 0,0xEA7B, 0, 0, 0, 0,0xEA7C, 0, + 0,0xEA7D, 0, 0, 0, 0, 0, 0, +0xEA7E, 0, 0, 0, 0,0xEA80, 0,0xEA81, +0xEA82, 0,0xEA83, 0,0xEA84,0xEA85,0xEA86, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA87,0xEA88, 0, 0, 0, 0, 0,0x9343, + 0, 0, 0, 0,0x8CDB, 0,0xEA8A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x916C,0xEA8B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xEA8C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9540, 0, 0,0xEA8D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xEA8E,0xE256, 0, 0,0xE6D8, +0xE8EB, 0, 0,0xEA8F, 0,0xEA90, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA92,0xEA93,0xEA94,0x97EE,0xEA91, 0, 0,0xEA95, +0xEA96, 0, 0,0xEA98, 0,0xEA97, 0, 0, + 0, 0, 0,0xEA9A, 0, 0, 0,0xEA9B, +0xEA99, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x97B4, 0, + 0, 0, 0, 0, 0, 0,0xEA9C, 0, + 0, 0, 0, 0, 0,0xEA9D,0xE273, 0, + 0,0xEA9E}; + +/* page 8 0xE000-0xE757 - User defined characters */ +static uint16 tab_uni_cp9328[]={ +0xF040,0xF041,0xF042,0xF043,0xF044,0xF045,0xF046,0xF047, +0xF048,0xF049,0xF04A,0xF04B,0xF04C,0xF04D,0xF04E,0xF04F, +0xF050,0xF051,0xF052,0xF053,0xF054,0xF055,0xF056,0xF057, +0xF058,0xF059,0xF05A,0xF05B,0xF05C,0xF05D,0xF05E,0xF05F, +0xF060,0xF061,0xF062,0xF063,0xF064,0xF065,0xF066,0xF067, +0xF068,0xF069,0xF06A,0xF06B,0xF06C,0xF06D,0xF06E,0xF06F, +0xF070,0xF071,0xF072,0xF073,0xF074,0xF075,0xF076,0xF077, +0xF078,0xF079,0xF07A,0xF07B,0xF07C,0xF07D,0xF07E,0xF080, +0xF081,0xF082,0xF083,0xF084,0xF085,0xF086,0xF087,0xF088, +0xF089,0xF08A,0xF08B,0xF08C,0xF08D,0xF08E,0xF08F,0xF090, +0xF091,0xF092,0xF093,0xF094,0xF095,0xF096,0xF097,0xF098, +0xF099,0xF09A,0xF09B,0xF09C,0xF09D,0xF09E,0xF09F,0xF0A0, +0xF0A1,0xF0A2,0xF0A3,0xF0A4,0xF0A5,0xF0A6,0xF0A7,0xF0A8, +0xF0A9,0xF0AA,0xF0AB,0xF0AC,0xF0AD,0xF0AE,0xF0AF,0xF0B0, +0xF0B1,0xF0B2,0xF0B3,0xF0B4,0xF0B5,0xF0B6,0xF0B7,0xF0B8, +0xF0B9,0xF0BA,0xF0BB,0xF0BC,0xF0BD,0xF0BE,0xF0BF,0xF0C0, +0xF0C1,0xF0C2,0xF0C3,0xF0C4,0xF0C5,0xF0C6,0xF0C7,0xF0C8, +0xF0C9,0xF0CA,0xF0CB,0xF0CC,0xF0CD,0xF0CE,0xF0CF,0xF0D0, +0xF0D1,0xF0D2,0xF0D3,0xF0D4,0xF0D5,0xF0D6,0xF0D7,0xF0D8, +0xF0D9,0xF0DA,0xF0DB,0xF0DC,0xF0DD,0xF0DE,0xF0DF,0xF0E0, +0xF0E1,0xF0E2,0xF0E3,0xF0E4,0xF0E5,0xF0E6,0xF0E7,0xF0E8, +0xF0E9,0xF0EA,0xF0EB,0xF0EC,0xF0ED,0xF0EE,0xF0EF,0xF0F0, +0xF0F1,0xF0F2,0xF0F3,0xF0F4,0xF0F5,0xF0F6,0xF0F7,0xF0F8, +0xF0F9,0xF0FA,0xF0FB,0xF0FC,0xF140,0xF141,0xF142,0xF143, +0xF144,0xF145,0xF146,0xF147,0xF148,0xF149,0xF14A,0xF14B, +0xF14C,0xF14D,0xF14E,0xF14F,0xF150,0xF151,0xF152,0xF153, +0xF154,0xF155,0xF156,0xF157,0xF158,0xF159,0xF15A,0xF15B, +0xF15C,0xF15D,0xF15E,0xF15F,0xF160,0xF161,0xF162,0xF163, +0xF164,0xF165,0xF166,0xF167,0xF168,0xF169,0xF16A,0xF16B, +0xF16C,0xF16D,0xF16E,0xF16F,0xF170,0xF171,0xF172,0xF173, +0xF174,0xF175,0xF176,0xF177,0xF178,0xF179,0xF17A,0xF17B, +0xF17C,0xF17D,0xF17E,0xF180,0xF181,0xF182,0xF183,0xF184, +0xF185,0xF186,0xF187,0xF188,0xF189,0xF18A,0xF18B,0xF18C, +0xF18D,0xF18E,0xF18F,0xF190,0xF191,0xF192,0xF193,0xF194, +0xF195,0xF196,0xF197,0xF198,0xF199,0xF19A,0xF19B,0xF19C, +0xF19D,0xF19E,0xF19F,0xF1A0,0xF1A1,0xF1A2,0xF1A3,0xF1A4, +0xF1A5,0xF1A6,0xF1A7,0xF1A8,0xF1A9,0xF1AA,0xF1AB,0xF1AC, +0xF1AD,0xF1AE,0xF1AF,0xF1B0,0xF1B1,0xF1B2,0xF1B3,0xF1B4, +0xF1B5,0xF1B6,0xF1B7,0xF1B8,0xF1B9,0xF1BA,0xF1BB,0xF1BC, +0xF1BD,0xF1BE,0xF1BF,0xF1C0,0xF1C1,0xF1C2,0xF1C3,0xF1C4, +0xF1C5,0xF1C6,0xF1C7,0xF1C8,0xF1C9,0xF1CA,0xF1CB,0xF1CC, +0xF1CD,0xF1CE,0xF1CF,0xF1D0,0xF1D1,0xF1D2,0xF1D3,0xF1D4, +0xF1D5,0xF1D6,0xF1D7,0xF1D8,0xF1D9,0xF1DA,0xF1DB,0xF1DC, +0xF1DD,0xF1DE,0xF1DF,0xF1E0,0xF1E1,0xF1E2,0xF1E3,0xF1E4, +0xF1E5,0xF1E6,0xF1E7,0xF1E8,0xF1E9,0xF1EA,0xF1EB,0xF1EC, +0xF1ED,0xF1EE,0xF1EF,0xF1F0,0xF1F1,0xF1F2,0xF1F3,0xF1F4, +0xF1F5,0xF1F6,0xF1F7,0xF1F8,0xF1F9,0xF1FA,0xF1FB,0xF1FC, +0xF240,0xF241,0xF242,0xF243,0xF244,0xF245,0xF246,0xF247, +0xF248,0xF249,0xF24A,0xF24B,0xF24C,0xF24D,0xF24E,0xF24F, +0xF250,0xF251,0xF252,0xF253,0xF254,0xF255,0xF256,0xF257, +0xF258,0xF259,0xF25A,0xF25B,0xF25C,0xF25D,0xF25E,0xF25F, +0xF260,0xF261,0xF262,0xF263,0xF264,0xF265,0xF266,0xF267, +0xF268,0xF269,0xF26A,0xF26B,0xF26C,0xF26D,0xF26E,0xF26F, +0xF270,0xF271,0xF272,0xF273,0xF274,0xF275,0xF276,0xF277, +0xF278,0xF279,0xF27A,0xF27B,0xF27C,0xF27D,0xF27E,0xF280, +0xF281,0xF282,0xF283,0xF284,0xF285,0xF286,0xF287,0xF288, +0xF289,0xF28A,0xF28B,0xF28C,0xF28D,0xF28E,0xF28F,0xF290, +0xF291,0xF292,0xF293,0xF294,0xF295,0xF296,0xF297,0xF298, +0xF299,0xF29A,0xF29B,0xF29C,0xF29D,0xF29E,0xF29F,0xF2A0, +0xF2A1,0xF2A2,0xF2A3,0xF2A4,0xF2A5,0xF2A6,0xF2A7,0xF2A8, +0xF2A9,0xF2AA,0xF2AB,0xF2AC,0xF2AD,0xF2AE,0xF2AF,0xF2B0, +0xF2B1,0xF2B2,0xF2B3,0xF2B4,0xF2B5,0xF2B6,0xF2B7,0xF2B8, +0xF2B9,0xF2BA,0xF2BB,0xF2BC,0xF2BD,0xF2BE,0xF2BF,0xF2C0, +0xF2C1,0xF2C2,0xF2C3,0xF2C4,0xF2C5,0xF2C6,0xF2C7,0xF2C8, +0xF2C9,0xF2CA,0xF2CB,0xF2CC,0xF2CD,0xF2CE,0xF2CF,0xF2D0, +0xF2D1,0xF2D2,0xF2D3,0xF2D4,0xF2D5,0xF2D6,0xF2D7,0xF2D8, +0xF2D9,0xF2DA,0xF2DB,0xF2DC,0xF2DD,0xF2DE,0xF2DF,0xF2E0, +0xF2E1,0xF2E2,0xF2E3,0xF2E4,0xF2E5,0xF2E6,0xF2E7,0xF2E8, +0xF2E9,0xF2EA,0xF2EB,0xF2EC,0xF2ED,0xF2EE,0xF2EF,0xF2F0, +0xF2F1,0xF2F2,0xF2F3,0xF2F4,0xF2F5,0xF2F6,0xF2F7,0xF2F8, +0xF2F9,0xF2FA,0xF2FB,0xF2FC,0xF340,0xF341,0xF342,0xF343, +0xF344,0xF345,0xF346,0xF347,0xF348,0xF349,0xF34A,0xF34B, +0xF34C,0xF34D,0xF34E,0xF34F,0xF350,0xF351,0xF352,0xF353, +0xF354,0xF355,0xF356,0xF357,0xF358,0xF359,0xF35A,0xF35B, +0xF35C,0xF35D,0xF35E,0xF35F,0xF360,0xF361,0xF362,0xF363, +0xF364,0xF365,0xF366,0xF367,0xF368,0xF369,0xF36A,0xF36B, +0xF36C,0xF36D,0xF36E,0xF36F,0xF370,0xF371,0xF372,0xF373, +0xF374,0xF375,0xF376,0xF377,0xF378,0xF379,0xF37A,0xF37B, +0xF37C,0xF37D,0xF37E,0xF380,0xF381,0xF382,0xF383,0xF384, +0xF385,0xF386,0xF387,0xF388,0xF389,0xF38A,0xF38B,0xF38C, +0xF38D,0xF38E,0xF38F,0xF390,0xF391,0xF392,0xF393,0xF394, +0xF395,0xF396,0xF397,0xF398,0xF399,0xF39A,0xF39B,0xF39C, +0xF39D,0xF39E,0xF39F,0xF3A0,0xF3A1,0xF3A2,0xF3A3,0xF3A4, +0xF3A5,0xF3A6,0xF3A7,0xF3A8,0xF3A9,0xF3AA,0xF3AB,0xF3AC, +0xF3AD,0xF3AE,0xF3AF,0xF3B0,0xF3B1,0xF3B2,0xF3B3,0xF3B4, +0xF3B5,0xF3B6,0xF3B7,0xF3B8,0xF3B9,0xF3BA,0xF3BB,0xF3BC, +0xF3BD,0xF3BE,0xF3BF,0xF3C0,0xF3C1,0xF3C2,0xF3C3,0xF3C4, +0xF3C5,0xF3C6,0xF3C7,0xF3C8,0xF3C9,0xF3CA,0xF3CB,0xF3CC, +0xF3CD,0xF3CE,0xF3CF,0xF3D0,0xF3D1,0xF3D2,0xF3D3,0xF3D4, +0xF3D5,0xF3D6,0xF3D7,0xF3D8,0xF3D9,0xF3DA,0xF3DB,0xF3DC, +0xF3DD,0xF3DE,0xF3DF,0xF3E0,0xF3E1,0xF3E2,0xF3E3,0xF3E4, +0xF3E5,0xF3E6,0xF3E7,0xF3E8,0xF3E9,0xF3EA,0xF3EB,0xF3EC, +0xF3ED,0xF3EE,0xF3EF,0xF3F0,0xF3F1,0xF3F2,0xF3F3,0xF3F4, +0xF3F5,0xF3F6,0xF3F7,0xF3F8,0xF3F9,0xF3FA,0xF3FB,0xF3FC, +0xF440,0xF441,0xF442,0xF443,0xF444,0xF445,0xF446,0xF447, +0xF448,0xF449,0xF44A,0xF44B,0xF44C,0xF44D,0xF44E,0xF44F, +0xF450,0xF451,0xF452,0xF453,0xF454,0xF455,0xF456,0xF457, +0xF458,0xF459,0xF45A,0xF45B,0xF45C,0xF45D,0xF45E,0xF45F, +0xF460,0xF461,0xF462,0xF463,0xF464,0xF465,0xF466,0xF467, +0xF468,0xF469,0xF46A,0xF46B,0xF46C,0xF46D,0xF46E,0xF46F, +0xF470,0xF471,0xF472,0xF473,0xF474,0xF475,0xF476,0xF477, +0xF478,0xF479,0xF47A,0xF47B,0xF47C,0xF47D,0xF47E,0xF480, +0xF481,0xF482,0xF483,0xF484,0xF485,0xF486,0xF487,0xF488, +0xF489,0xF48A,0xF48B,0xF48C,0xF48D,0xF48E,0xF48F,0xF490, +0xF491,0xF492,0xF493,0xF494,0xF495,0xF496,0xF497,0xF498, +0xF499,0xF49A,0xF49B,0xF49C,0xF49D,0xF49E,0xF49F,0xF4A0, +0xF4A1,0xF4A2,0xF4A3,0xF4A4,0xF4A5,0xF4A6,0xF4A7,0xF4A8, +0xF4A9,0xF4AA,0xF4AB,0xF4AC,0xF4AD,0xF4AE,0xF4AF,0xF4B0, +0xF4B1,0xF4B2,0xF4B3,0xF4B4,0xF4B5,0xF4B6,0xF4B7,0xF4B8, +0xF4B9,0xF4BA,0xF4BB,0xF4BC,0xF4BD,0xF4BE,0xF4BF,0xF4C0, +0xF4C1,0xF4C2,0xF4C3,0xF4C4,0xF4C5,0xF4C6,0xF4C7,0xF4C8, +0xF4C9,0xF4CA,0xF4CB,0xF4CC,0xF4CD,0xF4CE,0xF4CF,0xF4D0, +0xF4D1,0xF4D2,0xF4D3,0xF4D4,0xF4D5,0xF4D6,0xF4D7,0xF4D8, +0xF4D9,0xF4DA,0xF4DB,0xF4DC,0xF4DD,0xF4DE,0xF4DF,0xF4E0, +0xF4E1,0xF4E2,0xF4E3,0xF4E4,0xF4E5,0xF4E6,0xF4E7,0xF4E8, +0xF4E9,0xF4EA,0xF4EB,0xF4EC,0xF4ED,0xF4EE,0xF4EF,0xF4F0, +0xF4F1,0xF4F2,0xF4F3,0xF4F4,0xF4F5,0xF4F6,0xF4F7,0xF4F8, +0xF4F9,0xF4FA,0xF4FB,0xF4FC,0xF540,0xF541,0xF542,0xF543, +0xF544,0xF545,0xF546,0xF547,0xF548,0xF549,0xF54A,0xF54B, +0xF54C,0xF54D,0xF54E,0xF54F,0xF550,0xF551,0xF552,0xF553, +0xF554,0xF555,0xF556,0xF557,0xF558,0xF559,0xF55A,0xF55B, +0xF55C,0xF55D,0xF55E,0xF55F,0xF560,0xF561,0xF562,0xF563, +0xF564,0xF565,0xF566,0xF567,0xF568,0xF569,0xF56A,0xF56B, +0xF56C,0xF56D,0xF56E,0xF56F,0xF570,0xF571,0xF572,0xF573, +0xF574,0xF575,0xF576,0xF577,0xF578,0xF579,0xF57A,0xF57B, +0xF57C,0xF57D,0xF57E,0xF580,0xF581,0xF582,0xF583,0xF584, +0xF585,0xF586,0xF587,0xF588,0xF589,0xF58A,0xF58B,0xF58C, +0xF58D,0xF58E,0xF58F,0xF590,0xF591,0xF592,0xF593,0xF594, +0xF595,0xF596,0xF597,0xF598,0xF599,0xF59A,0xF59B,0xF59C, +0xF59D,0xF59E,0xF59F,0xF5A0,0xF5A1,0xF5A2,0xF5A3,0xF5A4, +0xF5A5,0xF5A6,0xF5A7,0xF5A8,0xF5A9,0xF5AA,0xF5AB,0xF5AC, +0xF5AD,0xF5AE,0xF5AF,0xF5B0,0xF5B1,0xF5B2,0xF5B3,0xF5B4, +0xF5B5,0xF5B6,0xF5B7,0xF5B8,0xF5B9,0xF5BA,0xF5BB,0xF5BC, +0xF5BD,0xF5BE,0xF5BF,0xF5C0,0xF5C1,0xF5C2,0xF5C3,0xF5C4, +0xF5C5,0xF5C6,0xF5C7,0xF5C8,0xF5C9,0xF5CA,0xF5CB,0xF5CC, +0xF5CD,0xF5CE,0xF5CF,0xF5D0,0xF5D1,0xF5D2,0xF5D3,0xF5D4, +0xF5D5,0xF5D6,0xF5D7,0xF5D8,0xF5D9,0xF5DA,0xF5DB,0xF5DC, +0xF5DD,0xF5DE,0xF5DF,0xF5E0,0xF5E1,0xF5E2,0xF5E3,0xF5E4, +0xF5E5,0xF5E6,0xF5E7,0xF5E8,0xF5E9,0xF5EA,0xF5EB,0xF5EC, +0xF5ED,0xF5EE,0xF5EF,0xF5F0,0xF5F1,0xF5F2,0xF5F3,0xF5F4, +0xF5F5,0xF5F6,0xF5F7,0xF5F8,0xF5F9,0xF5FA,0xF5FB,0xF5FC, +0xF640,0xF641,0xF642,0xF643,0xF644,0xF645,0xF646,0xF647, +0xF648,0xF649,0xF64A,0xF64B,0xF64C,0xF64D,0xF64E,0xF64F, +0xF650,0xF651,0xF652,0xF653,0xF654,0xF655,0xF656,0xF657, +0xF658,0xF659,0xF65A,0xF65B,0xF65C,0xF65D,0xF65E,0xF65F, +0xF660,0xF661,0xF662,0xF663,0xF664,0xF665,0xF666,0xF667, +0xF668,0xF669,0xF66A,0xF66B,0xF66C,0xF66D,0xF66E,0xF66F, +0xF670,0xF671,0xF672,0xF673,0xF674,0xF675,0xF676,0xF677, +0xF678,0xF679,0xF67A,0xF67B,0xF67C,0xF67D,0xF67E,0xF680, +0xF681,0xF682,0xF683,0xF684,0xF685,0xF686,0xF687,0xF688, +0xF689,0xF68A,0xF68B,0xF68C,0xF68D,0xF68E,0xF68F,0xF690, +0xF691,0xF692,0xF693,0xF694,0xF695,0xF696,0xF697,0xF698, +0xF699,0xF69A,0xF69B,0xF69C,0xF69D,0xF69E,0xF69F,0xF6A0, +0xF6A1,0xF6A2,0xF6A3,0xF6A4,0xF6A5,0xF6A6,0xF6A7,0xF6A8, +0xF6A9,0xF6AA,0xF6AB,0xF6AC,0xF6AD,0xF6AE,0xF6AF,0xF6B0, +0xF6B1,0xF6B2,0xF6B3,0xF6B4,0xF6B5,0xF6B6,0xF6B7,0xF6B8, +0xF6B9,0xF6BA,0xF6BB,0xF6BC,0xF6BD,0xF6BE,0xF6BF,0xF6C0, +0xF6C1,0xF6C2,0xF6C3,0xF6C4,0xF6C5,0xF6C6,0xF6C7,0xF6C8, +0xF6C9,0xF6CA,0xF6CB,0xF6CC,0xF6CD,0xF6CE,0xF6CF,0xF6D0, +0xF6D1,0xF6D2,0xF6D3,0xF6D4,0xF6D5,0xF6D6,0xF6D7,0xF6D8, +0xF6D9,0xF6DA,0xF6DB,0xF6DC,0xF6DD,0xF6DE,0xF6DF,0xF6E0, +0xF6E1,0xF6E2,0xF6E3,0xF6E4,0xF6E5,0xF6E6,0xF6E7,0xF6E8, +0xF6E9,0xF6EA,0xF6EB,0xF6EC,0xF6ED,0xF6EE,0xF6EF,0xF6F0, +0xF6F1,0xF6F2,0xF6F3,0xF6F4,0xF6F5,0xF6F6,0xF6F7,0xF6F8, +0xF6F9,0xF6FA,0xF6FB,0xF6FC,0xF740,0xF741,0xF742,0xF743, +0xF744,0xF745,0xF746,0xF747,0xF748,0xF749,0xF74A,0xF74B, +0xF74C,0xF74D,0xF74E,0xF74F,0xF750,0xF751,0xF752,0xF753, +0xF754,0xF755,0xF756,0xF757,0xF758,0xF759,0xF75A,0xF75B, +0xF75C,0xF75D,0xF75E,0xF75F,0xF760,0xF761,0xF762,0xF763, +0xF764,0xF765,0xF766,0xF767,0xF768,0xF769,0xF76A,0xF76B, +0xF76C,0xF76D,0xF76E,0xF76F,0xF770,0xF771,0xF772,0xF773, +0xF774,0xF775,0xF776,0xF777,0xF778,0xF779,0xF77A,0xF77B, +0xF77C,0xF77D,0xF77E,0xF780,0xF781,0xF782,0xF783,0xF784, +0xF785,0xF786,0xF787,0xF788,0xF789,0xF78A,0xF78B,0xF78C, +0xF78D,0xF78E,0xF78F,0xF790,0xF791,0xF792,0xF793,0xF794, +0xF795,0xF796,0xF797,0xF798,0xF799,0xF79A,0xF79B,0xF79C, +0xF79D,0xF79E,0xF79F,0xF7A0,0xF7A1,0xF7A2,0xF7A3,0xF7A4, +0xF7A5,0xF7A6,0xF7A7,0xF7A8,0xF7A9,0xF7AA,0xF7AB,0xF7AC, +0xF7AD,0xF7AE,0xF7AF,0xF7B0,0xF7B1,0xF7B2,0xF7B3,0xF7B4, +0xF7B5,0xF7B6,0xF7B7,0xF7B8,0xF7B9,0xF7BA,0xF7BB,0xF7BC, +0xF7BD,0xF7BE,0xF7BF,0xF7C0,0xF7C1,0xF7C2,0xF7C3,0xF7C4, +0xF7C5,0xF7C6,0xF7C7,0xF7C8,0xF7C9,0xF7CA,0xF7CB,0xF7CC, +0xF7CD,0xF7CE,0xF7CF,0xF7D0,0xF7D1,0xF7D2,0xF7D3,0xF7D4, +0xF7D5,0xF7D6,0xF7D7,0xF7D8,0xF7D9,0xF7DA,0xF7DB,0xF7DC, +0xF7DD,0xF7DE,0xF7DF,0xF7E0,0xF7E1,0xF7E2,0xF7E3,0xF7E4, +0xF7E5,0xF7E6,0xF7E7,0xF7E8,0xF7E9,0xF7EA,0xF7EB,0xF7EC, +0xF7ED,0xF7EE,0xF7EF,0xF7F0,0xF7F1,0xF7F2,0xF7F3,0xF7F4, +0xF7F5,0xF7F6,0xF7F7,0xF7F8,0xF7F9,0xF7FA,0xF7FB,0xF7FC, +0xF840,0xF841,0xF842,0xF843,0xF844,0xF845,0xF846,0xF847, +0xF848,0xF849,0xF84A,0xF84B,0xF84C,0xF84D,0xF84E,0xF84F, +0xF850,0xF851,0xF852,0xF853,0xF854,0xF855,0xF856,0xF857, +0xF858,0xF859,0xF85A,0xF85B,0xF85C,0xF85D,0xF85E,0xF85F, +0xF860,0xF861,0xF862,0xF863,0xF864,0xF865,0xF866,0xF867, +0xF868,0xF869,0xF86A,0xF86B,0xF86C,0xF86D,0xF86E,0xF86F, +0xF870,0xF871,0xF872,0xF873,0xF874,0xF875,0xF876,0xF877, +0xF878,0xF879,0xF87A,0xF87B,0xF87C,0xF87D,0xF87E,0xF880, +0xF881,0xF882,0xF883,0xF884,0xF885,0xF886,0xF887,0xF888, +0xF889,0xF88A,0xF88B,0xF88C,0xF88D,0xF88E,0xF88F,0xF890, +0xF891,0xF892,0xF893,0xF894,0xF895,0xF896,0xF897,0xF898, +0xF899,0xF89A,0xF89B,0xF89C,0xF89D,0xF89E,0xF89F,0xF8A0, +0xF8A1,0xF8A2,0xF8A3,0xF8A4,0xF8A5,0xF8A6,0xF8A7,0xF8A8, +0xF8A9,0xF8AA,0xF8AB,0xF8AC,0xF8AD,0xF8AE,0xF8AF,0xF8B0, +0xF8B1,0xF8B2,0xF8B3,0xF8B4,0xF8B5,0xF8B6,0xF8B7,0xF8B8, +0xF8B9,0xF8BA,0xF8BB,0xF8BC,0xF8BD,0xF8BE,0xF8BF,0xF8C0, +0xF8C1,0xF8C2,0xF8C3,0xF8C4,0xF8C5,0xF8C6,0xF8C7,0xF8C8, +0xF8C9,0xF8CA,0xF8CB,0xF8CC,0xF8CD,0xF8CE,0xF8CF,0xF8D0, +0xF8D1,0xF8D2,0xF8D3,0xF8D4,0xF8D5,0xF8D6,0xF8D7,0xF8D8, +0xF8D9,0xF8DA,0xF8DB,0xF8DC,0xF8DD,0xF8DE,0xF8DF,0xF8E0, +0xF8E1,0xF8E2,0xF8E3,0xF8E4,0xF8E5,0xF8E6,0xF8E7,0xF8E8, +0xF8E9,0xF8EA,0xF8EB,0xF8EC,0xF8ED,0xF8EE,0xF8EF,0xF8F0, +0xF8F1,0xF8F2,0xF8F3,0xF8F4,0xF8F5,0xF8F6,0xF8F7,0xF8F8, +0xF8F9,0xF8FA,0xF8FB,0xF8FC,0xF940,0xF941,0xF942,0xF943, +0xF944,0xF945,0xF946,0xF947,0xF948,0xF949,0xF94A,0xF94B, +0xF94C,0xF94D,0xF94E,0xF94F,0xF950,0xF951,0xF952,0xF953, +0xF954,0xF955,0xF956,0xF957,0xF958,0xF959,0xF95A,0xF95B, +0xF95C,0xF95D,0xF95E,0xF95F,0xF960,0xF961,0xF962,0xF963, +0xF964,0xF965,0xF966,0xF967,0xF968,0xF969,0xF96A,0xF96B, +0xF96C,0xF96D,0xF96E,0xF96F,0xF970,0xF971,0xF972,0xF973, +0xF974,0xF975,0xF976,0xF977,0xF978,0xF979,0xF97A,0xF97B, +0xF97C,0xF97D,0xF97E,0xF980,0xF981,0xF982,0xF983,0xF984, +0xF985,0xF986,0xF987,0xF988,0xF989,0xF98A,0xF98B,0xF98C, +0xF98D,0xF98E,0xF98F,0xF990,0xF991,0xF992,0xF993,0xF994, +0xF995,0xF996,0xF997,0xF998,0xF999,0xF99A,0xF99B,0xF99C, +0xF99D,0xF99E,0xF99F,0xF9A0,0xF9A1,0xF9A2,0xF9A3,0xF9A4, +0xF9A5,0xF9A6,0xF9A7,0xF9A8,0xF9A9,0xF9AA,0xF9AB,0xF9AC, +0xF9AD,0xF9AE,0xF9AF,0xF9B0,0xF9B1,0xF9B2,0xF9B3,0xF9B4, +0xF9B5,0xF9B6,0xF9B7,0xF9B8,0xF9B9,0xF9BA,0xF9BB,0xF9BC, +0xF9BD,0xF9BE,0xF9BF,0xF9C0,0xF9C1,0xF9C2,0xF9C3,0xF9C4, +0xF9C5,0xF9C6,0xF9C7,0xF9C8,0xF9C9,0xF9CA,0xF9CB,0xF9CC, +0xF9CD,0xF9CE,0xF9CF,0xF9D0,0xF9D1,0xF9D2,0xF9D3,0xF9D4, +0xF9D5,0xF9D6,0xF9D7,0xF9D8,0xF9D9,0xF9DA,0xF9DB,0xF9DC, +0xF9DD,0xF9DE,0xF9DF,0xF9E0,0xF9E1,0xF9E2,0xF9E3,0xF9E4, +0xF9E5,0xF9E6,0xF9E7,0xF9E8,0xF9E9,0xF9EA,0xF9EB,0xF9EC, +0xF9ED,0xF9EE,0xF9EF,0xF9F0,0xF9F1,0xF9F2,0xF9F3,0xF9F4, +0xF9F5,0xF9F6,0xF9F7,0xF9F8,0xF9F9,0xF9FA,0xF9FB,0xF9FC}; + +/* page 9 0xF920-0xFA2D */ +static uint16 tab_uni_cp9329[]={ + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFAE0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFBE9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFA90,0xFA9B, +0xFA9C,0xFAB1,0xFAD8,0xFAE8,0xFAEA,0xFB58,0xFB5E,0xFB75, +0xFB7D,0xFB7E,0xFB80,0xFB82,0xFB86,0xFB89,0xFB92,0xFB9D, +0xFB9F,0xFBA0,0xFBA9,0xFBB1,0xFBB3,0xFBB4,0xFBB7,0xFBD3, +0xFBDA,0xFBEA,0xFBF6,0xFBF7,0xFBF9,0xFC49}; + +/* page 10 0xFF01-0xFFE5 */ +static uint16 tab_uni_cp93210[]={ +0x8149,0xFA57,0x8194,0x8190,0x8193,0x8195,0xFA56,0x8169, +0x816A,0x8196,0x817B,0x8143,0x817C,0x8144,0x815E,0x824F, +0x8250,0x8251,0x8252,0x8253,0x8254,0x8255,0x8256,0x8257, +0x8258,0x8146,0x8147,0x8183,0x8181,0x8184,0x8148,0x8197, +0x8260,0x8261,0x8262,0x8263,0x8264,0x8265,0x8266,0x8267, +0x8268,0x8269,0x826A,0x826B,0x826C,0x826D,0x826E,0x826F, +0x8270,0x8271,0x8272,0x8273,0x8274,0x8275,0x8276,0x8277, +0x8278,0x8279,0x816D,0x815F,0x816E,0x814F,0x8151,0x814D, +0x8281,0x8282,0x8283,0x8284,0x8285,0x8286,0x8287,0x8288, +0x8289,0x828A,0x828B,0x828C,0x828D,0x828E,0x828F,0x8290, +0x8291,0x8292,0x8293,0x8294,0x8295,0x8296,0x8297,0x8298, +0x8299,0x829A,0x816F,0x8162,0x8170,0x8160, 0, 0, +0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8, +0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0, +0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8, +0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0, +0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8, +0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0, +0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8, +0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8191, +0x8192,0x81CA,0x8150,0xFA55,0x818F}; + +static int func_uni_cp932_onechar(int code){ + if ((code>=0x005C)&&(code<=0x00F7)) + return(tab_uni_cp9320[code-0x005C]); + if ((code>=0x0391)&&(code<=0x0451)) + return(tab_uni_cp9321[code-0x0391]); + if ((code>=0x2010)&&(code<=0x2473)) + return(tab_uni_cp9322[code-0x2010]); + if ((code>=0x2500)&&(code<=0x266F)) + return(tab_uni_cp9323[code-0x2500]); + if ((code>=0x3000)&&(code<=0x30FE)) + return(tab_uni_cp9324[code-0x3000]); + if ((code>=0x3230)&&(code<=0x33CD)) + return(tab_uni_cp9325[code-0x3230]); + if ((code>=0x4E00)&&(code<=0x9481)) + return(tab_uni_cp9326[code-0x4E00]); + if ((code>=0x9577)&&(code<=0x9FA0)) + return(tab_uni_cp9327[code-0x9577]); + if ((code>=0xE000)&&(code<=0xE757)) + return(tab_uni_cp9328[code-0xE000]); + if ((code>=0xF920)&&(code<=0xFA2D)) + return(tab_uni_cp9329[code-0xF920]); + if ((code>=0xFF01)&&(code<=0xFFE5)) + return(tab_uni_cp93210[code-0xFF01]); + return(0); +} + + +static int +my_wc_mb_cp932(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + int code; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((int) wc < 0x80) + { + s[0]= (uchar) wc; + return 1; + } + + if (!(code=func_uni_cp932_onechar(wc))) + return MY_CS_ILUNI; + + if (code>=0xA1 && code <= 0xDF) + { + s[0]= code; + return 1; + } + + s[0]=code>>8; + s[1]=code&0xFF; + return 2; +} + + +static int +my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e){ + int hi; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((hi= s[0]) < 0x80) + { + pwc[0]=hi; + return 1; + } + + if (hi >= 0xA1 && hi <= 0xDF) + { + pwc[0]= func_cp932_uni_onechar(hi); + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + if (!(pwc[0]=func_cp932_uni_onechar((hi<<8)+s[1]))) + return -2; + + return 2; +} + +static +size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *str_end) +{ + size_t clen= 0; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; + + for (clen= 0; b < e; ) + { + if (*b >= 0xA1 && *b <= 0xDF) + { + clen++; + b++; + } + else if (*b > 0x7F) + { + clen+= 2; + b+= 2; + } + else + { + clen++; + b++; + } + } + return clen; +} + +/* + Returns a well formed length of a cp932 string. + cp932 additional characters are also accepted. +*/ + +static +size_t my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) +{ + const char *b0= b; + *error= 0; + while (pos-- && b < e) + { + /* + Cast to int8 for extra safety. + "char" can be unsigned by default + on some platforms. + */ + if (((int8)b[0]) >= 0) + { + /* Single byte ascii character */ + b++; + } + else if (iscp932head((uchar)*b) && (e-b)>1 && iscp932tail((uchar)b[1])) + { + /* Double byte character */ + b+= 2; + } + else if (((uchar)*b) >= 0xA1 && ((uchar)*b) <= 0xDF) + { + /* Half width kana */ + b++; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (size_t) (b - b0); +} + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_cp932, + my_strnncollsp_cp932, + my_strnxfrm_mb, + my_strnxfrmlen_simple, + my_like_range_cp932, + my_wildcmp_mb, /* wildcmp */ + my_strcasecmp_8bit, + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + ismbchar_cp932, + mbcharlen_cp932, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_cp932, + my_lengthsp_8bit, + my_numcells_cp932, + my_mb_wc_cp932, /* mb_wc */ + my_wc_mb_cp932, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_8bit, + my_casedn_str_8bit, + my_caseup_8bit, + my_casedn_8bit, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + +CHARSET_INFO my_charset_cp932_japanese_ci= +{ + 95,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ + "cp932", /* cs name */ + "cp932_japanese_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp932, + to_lower_cp932, + to_upper_cp932, + sort_order_cp932, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + +CHARSET_INFO my_charset_cp932_bin= +{ + 96,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "cp932", /* cs name */ + "cp932_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp932, + to_lower_cp932, + to_upper_cp932, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_mb_bin_handler +}; + +#endif diff --git a/externals/mysql/strings/ctype-czech.c b/externals/mysql/strings/ctype-czech.c new file mode 100644 index 0000000..73d03e9 --- /dev/null +++ b/externals/mysql/strings/ctype-czech.c @@ -0,0 +1,813 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + File strings/ctype-czech.c for MySQL. + + This file implements the Czech sorting for the MySQL database + server (www.mysql.com). Due to some complicated rules the + Czech language has for sorting strings, a more complex + solution was needed than the one-to-one conversion table. To + note a few, here is an example of a Czech sorting sequence: + + co < hlaska < hláska < hlava < chlapec < krtek + + It because some of the rules are: double char 'ch' is sorted + between 'h' and 'i'. Accented character 'á' (a with acute) is + sorted after 'a' and before 'b', but only if the word is + otherwise the same. However, because 's' is sorted before 'v' + in hlava, the accentness of 'á' is overridden. There are many + more rules. + + This file defines functions my_strxfrm and my_strcoll for + C-like zero terminated strings and my_strnxfrm and my_strnncoll + for strings where the length comes as an parameter. Also + defined here you will find function my_like_range that returns + index range strings for LIKE expression and the + MY_STRXFRM_MULTIPLY set to value 4 -- this is the ratio the + strings grows during my_strxfrm. The algorithm has four + passes, that's why we need four times more space for expanded + string. + + This file also contains the ISO-Latin-2 definitions of + characters. + + Author: (c) 1997--1998 Jan Pazdziora, adelton@fi.muni.cz + Jan Pazdziora has a shared copyright for this code + + The original of this file can also be found at + http://www.fi.muni.cz/~adelton/l10n/ + + Bug reports and suggestions are always welcome. +*/ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. strxfrm_multiply_czech=4 + */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_latin2 + +/* + These are four tables for four passes of the algorithm. Please see + below for what are the "special values" +*/ + +static const uchar *CZ_SORT_TABLE[]= +{ + (const uchar*) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x41\x42\x43\x44\x45\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x47\x58\x5C\x6A\x77\x6B\x69\x5B\x5E\x5F\x66\x6E\x55\x54\x5A\x67" + "\x78\x79\x7A\x7B\x7C\x7D\x7E\x7F\x80\x81\x57\x56\x71\x72\x73\x59" + "\x65\x82\x83\xFF\x86\x87\x88\x89\x8A\x8C\x8D\x8E\x8F\x90\x91\x92" + "\x94\x95\x96\x98\x9A\x9B\x9D\x9E\x9F\xA0\xA1\x60\x68\x61\x4B\x52" + "\x49\x82\x83\xFF\x86\x87\x88\x89\x8A\x8C\x8D\x8E\x8F\x90\x91\x92" + "\x94\x95\x96\x98\x9A\x9B\x9D\x9E\x9F\xA0\xA1\x62\x74\x63\x75\x00" + "\x00\x00\x00\x00\x00\x46\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x48\x82\x4C\x8F\x76\x8F\x98\x64\x4E\x99\x98\x9A\xA1\x53\xA2\xA1" + "\x6D\x82\x51\x8F\x4A\x8F\x98\x6C\x50\x99\x98\x9A\xA1\x4F\xA2\xA1" + "\x96\x82\x82\x82\x82\x8F\x84\x84\x85\x87\x87\x87\x87\x8C\x8C\x86" + "\x86\x91\x91\x92\x92\x92\x92\x70\x97\x9B\x9B\x9B\x9B\xA0\x9A\x98" + "\x96\x82\x82\x82\x82\x8F\x84\x84\x85\x87\x87\x87\x87\x8C\x8C\x86" + "\x86\x91\x91\x92\x92\x92\x92\x6F\x97\x9B\x9B\x9B\x9B\xA0\x9A\x4D", + + (const uchar*) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x20\x20\x20\x20\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\xFF\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\xFF\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20" + "\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x00" + "\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x20\x2B\x20\x2C\x20\x25\x22\x20\x20\x25\x2A\x25\x22\x20\x25\x29" + "\x20\x2B\x20\x2C\x20\x25\x22\x20\x20\x25\x2A\x25\x22\x20\x25\x29" + "\x22\x22\x24\x23\x27\x22\x22\x2A\x25\x22\x2B\x47\x25\x22\x24\x25" + "\x2C\x22\x25\x22\x24\x28\x27\x20\x25\x26\x22\x28\x27\x22\x2A\x21" + "\x22\x22\x24\x23\x27\x22\x22\x2A\x25\x22\x2B\x47\x25\x22\x24\x25" + "\x2C\x22\x25\x22\x24\x28\x27\x20\x25\x26\x22\x28\x27\x22\x2A\x20", + + + (const uchar*) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x03\x03\x03\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03" + "\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03" + "\x03\x05\x05\xFF\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05" + "\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x03\x03\x03\x03\x03" + "\x03\x03\x03\xFF\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03" + "\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x00" + "\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x1B\x05\x03\x05\x03\x05\x05\x03\x03\x05\x05\x05\x05\x03\x05\x05" + "\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03" + "\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05" + "\x05\x05\x05\x05\x05\x05\x05\x03\x05\x05\x05\x05\x05\x05\x05\x03" + "\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03" + "\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03", + + (const uchar*) + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" + "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F" + "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F" + "\x40\x41\x42\xFF\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F" + "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x5B\x5C\x5D\x5E\x5F" + "\x60\x61\x62\xFF\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F" + "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7A\x7B\x7C\x7D\x7E\x7F" + "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" + "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F" + "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" + "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF" + "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF" + "\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF" + "\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF" + "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF" +}; + +/* + These define the values for the double chars that need to be + sorted as they were single characters -- in Czech these are + 'ch', 'Ch' and 'CH'. +*/ + +struct wordvalue +{ + const uchar *word; + const uchar *outvalue; +}; + +static struct wordvalue doubles[]= +{ + { "ch", (const uchar*) "\x8B\x20\x03\x63" }, + { "Ch", (const uchar*) "\x8B\x20\x04\x43" }, + { "CH", (const uchar*) "\x8B\x20\x05\x43" }, + { "c", (const uchar*) "\x84\x20\x03\x63" }, + { "C", (const uchar*) "\x84\x20\x05\x43" }, +}; + + +/* + Define "auto" space character, + which is used while processing "PAD SPACE" rule, + when one string is shorter than another string. + "Auto" space character is lower than a real space + character on the third level. +*/ +static const uchar *virtual_space= "\x47\x20\x02\x20"; + +/* + Original comments from the contributor: + + Informal description of the algorithm: + + We walk the string left to right. + + The end of the string is either passed as parameter, or is + *p == 0. This is hidden in the IS_END macro. + + In the first two passes, we compare word by word. So we make + first and second pass on the first word, first and second pass + on the second word, etc. If we come to the end of the string + during the first pass, we need to jump to the last word of the + second pass. + + End of pass is marked with value 1 on the output. + + For each character, we read it's value from the table. + + If the value is ignore (0), we go straight to the next character. + + If the value is space/end of word (2) and we are in the first + or second pass, we skip all characters having value 0 -- 2 and + switch the pass. + + If it's the compose character (255), we check if the double + exists behind it, find its value. + + We append 0 to the end. + + Neformální popis algoritmu: + + procházíme řetězec zleva doprava + konec řetězce poznáme podle *p == 0 + pokud jsme doąli na konec řetězce při průchodu 0, nejdeme na + začátek, ale na uloľenou pozici, protoľe první a druhý + průchod běľí současně + konec vstupu (průchodu) označíme na výstupu hodnotou 1 + + načteme hodnotu z třídící tabulky + jde-li o hodnotu ignorovat (0), skočíme na daląí průchod + jde-li o hodnotu konec slova (2) a je to průchod 0 nebo 1, + přeskočíme vąechny daląí 0 -- 2 a prohodíme + průchody + jde-li o kompozitní znak (255), otestujeme, zda následuje + správný do dvojice, dohledáme správnou hodnotu + + na konci připojíme znak 0 +*/ + +/* + In March 2007 latin2_czech_cs was reworked by Alexander Barkov, + to suite other MySQL collations better, and to be Falcon compatible. + + Changes: + - Discarded word-by-word comparison on the primary and the secondary level. + Comparison is now strictly done level-by-level + (like the Unicode Collation Algorithm (UCA) does). + + - Character weights were derived from Unicode 5.0.0 standard. + This is to make order of punctuation characters and digits + more consistent with all other MySQL collations and UCA. + + The order is now: + + Controls, spaces, punctuations, digits, letters. + + It previously used to be: + + Punctuations, controls, some more punctuations, letters, digits. + + NOTE: + + A minor difference between this implementations and the UCA: + + German "LATIN SMALL LETTER SHARP S" does not expand to "ss". + It is instead considered as secondary greater than "LATIN LETTER S", + and thus sorted between "LATIN LETTER S" and "LATIN LETTER S WITH ACUTE". + This allows to reduce *twice* disk space required for un-indexed + ORDER BY (using the filesort method). + + As neither the original version of latin2_czech_cs + expanded "SHARP S" to "ss", nor "SHARP S" is a part of Czech alphabet, + this behavior should be ok. + + - Collation is now "PAD SPACE" like all other MySQL collations. + It ignores trailing spaces on primary and secondary level. + + - SPACE and TAB characters are not ignorable anymore. + Also, they have different weights on primary level, + like in all other MySQL collations: + + SELECT 'a\t' < 'a ' -- returns true + SELECT 'a\t' < 'a' -- returns true + + - Some other punctuation characters are not ignorable anymore, + for better compatibility with UCA and other MySQL collations. + +*/ + + +#define ADD_TO_RESULT(dest, len, totlen, value) \ +if ((totlen) < (len)) { dest[totlen] = value; } (totlen++); +#define IS_END(p, src, len) (((char *)p - (char *)src) >= (len)) + +/* + src - IN pointer to the beginning of the string + p - IN/OUT pointer to the current character being processed + pass - IN pass number [0..3] + 0 - primary level + 1 - secondary level + 2 - tertiary level + 3 - quarternary level + value - OUT the next weight value. + -1 is returned on end-of-line. + 1 is returned between levels ("level separator"). + Any value greater than 1 is a normal weight. + ml - IN a flag indicating whether to switch automatically + to the secondary level and higher levels, + or stop at the primary level. + ml=0 is used for prefix comparison. +*/ + +#define NEXT_CMP_VALUE(src, p, pass, value, len, ml) \ +while (1) \ +{ \ + if (IS_END(p, src, len)) \ + { \ + /* when we are at the end of string */ \ + /* return either -1 for end of string */ \ + /* or 1 for end of pass */ \ + \ + /* latin2_czech_cs WEIGHT_STRING() returns level */ \ + /* separators even for empty string: 01.01.01.00 */ \ + /* The another Czech collation (cp1250_czech_cs) */ \ + /* returns *empty* WEIGHT_STRING() for empty input.*/\ + /* This is why the below if(){}else{} code block */ \ + /* differs from the similar piece in */ \ + /* ctype-win1250.c */ \ + if (pass != 3 && ml) \ + { \ + p= src; \ + pass++; \ + value= 1; /* Level separator */ \ + } \ + else \ + { \ + value= -1; /* End-of-line marker*/ \ + } \ + break; \ + } \ + /* not at end of string */ \ + value = CZ_SORT_TABLE[pass][*p]; \ + if (value == 0 && pass < 3) \ + { p++; continue; } /* ignore value on levels 0,1,2 */ \ + if (value == 255) \ + { \ + int i; \ + for (i= 0; i < (int) array_elements(doubles); i++) \ + { \ + const char * pattern = doubles[i].word; \ + const char * q = (const char *) p; \ + int j = 0; \ + while (pattern[j]) \ + { \ + if (IS_END(q, src, len) || (*q != pattern[j])) \ + break; \ + j++; q++; \ + } \ + if (!(pattern[j])) \ + { \ + value = (int)(doubles[i].outvalue[pass]); \ + p= (const uchar *) q - 1; \ + break; \ + } \ + } \ + } \ + p++; \ + break; \ +} + +/* + Function strnncoll, actually strcoll, with Czech sorting, which expect + the length of the strings being specified +*/ + +static int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)), + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, + my_bool s2_is_prefix) +{ + int v1, v2; + const uchar * p1, * p2; + int pass1= 0, pass2= 0; + + if (s2_is_prefix && len1 > len2) + len1=len2; + + p1= s1; + p2= s2; + + do + { + int diff; + NEXT_CMP_VALUE(s1, p1, pass1, v1, (int)len1, 1); + NEXT_CMP_VALUE(s2, p2, pass2, v2, (int)len2, 1); + if ((diff = v1 - v2)) + return diff; + } + while (v1 >= 0); + return 0; +} + + + +/* + Compare strings, ignore trailing spaces +*/ + +static int +my_strnncollsp_czech(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) +{ + int level; + + for (level= 0; level <= 3; level++) + { + const uchar *s1= s; + const uchar *t1= t; + + for (;;) + { + int sval, tval, diff; + NEXT_CMP_VALUE(s, s1, level, sval, (int) slen, 0); + NEXT_CMP_VALUE(t, t1, level, tval, (int) tlen, 0); + if (sval < 0) + { + sval= virtual_space[level]; + for (; tval >= 0 ;) + { + if ((diff= sval - tval)) + return diff; + NEXT_CMP_VALUE(t, t1, level, tval, (int) tlen, 0); + } + break; + } + else if (tval < 0) + { + tval= virtual_space[level]; + for (; sval >= 0 ;) + { + if ((diff= sval - tval)) + return diff; + NEXT_CMP_VALUE(s, s1, level, sval, (int) slen, 0); + } + break; + } + + if ((diff= sval - tval)) + return diff; + } + } + return 0; +} + + +/* + Returns the number of bytes required for strnxfrm(). +*/ +static size_t +my_strnxfrmlen_czech(CHARSET_INFO *cs __attribute__((unused)), size_t len) +{ + return len * 4 + 4; +} + + +/* + Function strnxfrm, actually strxfrm, with Czech sorting, which expect + the length of the strings being specified +*/ +static size_t +my_strnxfrm_czech(CHARSET_INFO * cs __attribute__((unused)), + uchar *dst, size_t dstlen, uint nweights_arg, + const uchar *src, size_t srclen, uint flags) +{ + uint level; + uchar *dst0= dst; + uchar *de= dst + dstlen; + + if (!(flags & 0x0F)) /* All levels by default */ + flags|= 0x0F; + + for (level= 0; level <= 3; level++) + { + if (flags & (1 << level)) + { + uint nweights= nweights_arg; + const uchar *p= src; + int value; + uchar *dstl= dst; + + for (; dst < de && nweights; nweights--) + { + NEXT_CMP_VALUE(src, p, level, value, (int) srclen, 0); + if (value < 0) + break; + *dst++= value; + } + + if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + uint pad_length= de - dst; + set_if_smaller(pad_length, nweights); + /* fill with weight for space character */ + bfill(dst, pad_length, virtual_space[level]); + dst+= pad_length; + } + + my_strxfrm_desc_and_reverse(dstl, dst, flags, level); + + /* Add level delimiter */ + if (dst < de) + *dst++= level < 3 ? 1 : 0; + } + } + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de) + { + uint fill_length= de - dst; + cs->cset->fill(cs, (char*) dst, fill_length, 0); + dst= de; + } + return dst - dst0; +} + + +#undef IS_END + + +/* + */ + + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +#define min_sort_char 0x00 +#define max_sort_char 0xAE + + +static my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr,size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, char *min_str, + char *max_str, + size_t *min_length,size_t *max_length) +{ + uchar value; + const char *end=ptr+ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + + for (; ptr != end && min_str != min_end ; ptr++) + { + if (*ptr == w_one) /* '_' in SQL */ + { break; } + if (*ptr == w_many) /* '%' in SQL */ + { break; } + + if (*ptr == escape && ptr+1 != end) + { ptr++; } /* Skip escape */ + + value = CZ_SORT_TABLE[0][(int) (uchar) *ptr]; + + if (value == 0) /* Ignore in the first pass */ + { continue; } + if (value <= 2) /* End of pass or end of string */ + { break; } + if (value == 255) /* Double char too compicated */ + { break; } + + *min_str++= *max_str++ = *ptr; + } + + if (cs->state & MY_CS_BINSORT) + *min_length= (size_t) (min_str - min_org); + else + { + /* 'a\0\0... is the smallest possible string */ + *min_length= res_length; + } + /* a\ff\ff... is the biggest possible string */ + *max_length= res_length; + + while (min_str != min_end) + { + *min_str++ = min_sort_char; /* Because of key compression */ + *max_str++ = max_sort_char; + } + return 0; +} + + +/* + * File generated by cset + * (C) Abandoned 1997 Zarko Mocnik + * + * definition table reworked by Jaromir Dolecek + */ + +static uchar NEAR ctype_czech[257] = { +0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16, + 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, + 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 72, + 1, 16, 1, 16, 1, 1, 16, 0, 0, 1, 1, 1, 1, 16, 1, 1, + 16, 2, 16, 2, 16, 2, 2, 16, 16, 2, 2, 2, 2, 16, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 16, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 16, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 16, +}; + +static uchar NEAR to_lower_czech[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95, + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, +112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, +128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, +144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, +177,161,179,163,181,182,166,167,168,185,186,187,188,173,190,191, +176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, +224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, +208,241,242,243,244,245,246,215,248,249,250,251,252,253,254,223, +224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, +240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, +}; + +static uchar NEAR to_upper_czech[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, +128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, +144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, +160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, +176,160,178,162,180,164,165,183,184,169,170,171,172,189,174,175, +192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, +208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, +192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, +240,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255, +}; + +static uchar NEAR sort_order_czech[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 71, 72, 76, 78, 83, 84, 85, 86, 90, 91, 92, 96, 97,100, +105,106,107,110,114,117,122,123,124,125,127,131,132,133,134,135, +136, 65, 71, 72, 76, 78, 83, 84, 85, 86, 90, 91, 92, 96, 97,100, +105,106,107,110,114,117,122,123,124,125,127,137,138,139,140, 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,255, + 66,255, 93,255, 94,111,255,255,255,112,113,115,128,255,129,130, +255, 66,255, 93,255, 94,111,255,255,112,113,115,128,255,129,130, +108, 67, 68, 69, 70, 95, 73, 75, 74, 79, 81, 82, 80, 89, 87, 77, +255, 98, 99,101,102,103,104,255,109,119,118,120,121,126,116,255, +108, 67, 68, 69, 70, 95, 73, 75, 74, 79, 81, 82, 80, 89, 88, 77, +255, 98, 99,101,102,103,104,255,109,119,118,120,121,126,116,255, +}; + +static uint16 tab_8859_2_uni[256]={ + 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, +0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, +0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, +0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + + +/* 0000-00FD , 254 chars */ +static uchar tab_uni_8859_2_plane00[]={ +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xA0,0x00,0x00,0x00,0xA4,0x00,0x00,0xA7,0xA8,0x00,0x00,0x00,0x00,0xAD,0x00,0x00, +0xB0,0x00,0x00,0x00,0xB4,0x00,0x00,0x00,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0xC1,0xC2,0x00,0xC4,0x00,0x00,0xC7,0x00,0xC9,0x00,0xCB,0x00,0xCD,0xCE,0x00, +0x00,0x00,0x00,0xD3,0xD4,0x00,0xD6,0xD7,0x00,0x00,0xDA,0x00,0xDC,0xDD,0x00,0xDF, +0x00,0xE1,0xE2,0x00,0xE4,0x00,0x00,0xE7,0x00,0xE9,0x00,0xEB,0x00,0xED,0xEE,0x00, +0x00,0x00,0x00,0xF3,0xF4,0x00,0xF6,0xF7,0x00,0x00,0xFA,0x00,0xFC,0xFD}; + +/* 0102-017E , 125 chars */ +static uchar tab_uni_8859_2_plane01[]={ +0xC3,0xE3,0xA1,0xB1,0xC6,0xE6,0x00,0x00,0x00,0x00,0xC8,0xE8,0xCF,0xEF,0xD0,0xF0, +0x00,0x00,0x00,0x00,0x00,0x00,0xCA,0xEA,0xCC,0xEC,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC5,0xE5,0x00,0x00,0xA5,0xB5,0x00,0x00,0xA3, +0xB3,0xD1,0xF1,0x00,0x00,0xD2,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD5,0xF5, +0x00,0x00,0xC0,0xE0,0x00,0x00,0xD8,0xF8,0xA6,0xB6,0x00,0x00,0xAA,0xBA,0xA9,0xB9, +0xDE,0xFE,0xAB,0xBB,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD9,0xF9,0xDB,0xFB, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAC,0xBC,0xAF,0xBF,0xAE,0xBE}; + +/* 02C7-02DD , 23 chars */ +static uchar tab_uni_8859_2_plane02[]={ +0xB7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0xA2,0xFF,0x00,0xB2,0x00,0xBD}; + +static MY_UNI_IDX idx_uni_8859_2[]={ + {0x0000,0x00FD,tab_uni_8859_2_plane00}, + {0x0102,0x017E,tab_uni_8859_2_plane01}, + {0x02C7,0x02DD,tab_uni_8859_2_plane02}, + {0,0,NULL} +}; + + +static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler = +{ + NULL, /* init */ + my_strnncoll_czech, + my_strnncollsp_czech, + my_strnxfrm_czech, + my_strnxfrmlen_czech, + my_like_range_czech, + my_wildcmp_bin, + my_strcasecmp_8bit, + my_instr_simple, + my_hash_sort_simple, + my_propagate_simple +}; + +CHARSET_INFO my_charset_latin2_czech_ci = +{ + 2,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */ + "latin2", /* cs name */ + "latin2_czech_cs", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_czech, + to_lower_czech, + to_upper_czech, + sort_order_czech, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + tab_8859_2_uni, /* tab_to_uni */ + idx_uni_8859_2, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 4, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 0, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 4, /* levels_for_compare */ + 4, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_latin2_czech_ci_handler +}; + +#endif diff --git a/externals/mysql/strings/ctype-euc_kr.c b/externals/mysql/strings/ctype-euc_kr.c new file mode 100644 index 0000000..39a5649 --- /dev/null +++ b/externals/mysql/strings/ctype-euc_kr.c @@ -0,0 +1,8810 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * This file is for Korean EUC charset, and created by powerm90@tinc.co.kr. + * and updated by mrpark@tinc.co.kr. + */ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. mbmaxlen_euc_kr=2 + */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_euckr + + +static uchar NEAR ctype_euc_kr[257] = +{ + 0, /* For standard library */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ + 0040, 0050, 0050, 0050, 0050, 0050, 0040, 0040, /* ^H - ^O */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^P - ^W */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^X - ^Z ^[ ^\ ^] ^^ ^_ */ + 0110, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* SPC ! " # $ % ^ ' */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* ( ) * + , - . / */ + 0204, 0204, 0204, 0204, 0204, 0204, 0204, 0204, /* 0 1 2 3 4 5 6 7 */ + 0204, 0204, 0020, 0020, 0020, 0020, 0020, 0020, /* 8 9 : ; < = > ? */ + 0020, 0201, 0201, 0201, 0201, 0201, 0201, 0001, /* @ A B C D E F G */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* H I J K L M N O */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* P Q R S T U V W */ + 0001, 0001, 0001, 0020, 0020, 0020, 0020, 0020, /* X Y Z [ \ ] ^ _ */ + 0020, 0202, 0202, 0202, 0202, 0202, 0202, 0002, /* ` a b c d e f g */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* h i j k l m n o */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* p q r s t u v w */ + 0002, 0002, 0002, 0020, 0020, 0020, 0020, 0040, /* x y z { | } + DEL */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, +}; + +static uchar NEAR to_lower_euc_kr[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR to_upper_euc_kr[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR sort_order_euc_kr[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +/* Support for Korean(EUC_KR) characters, by powerm90@tinc.co.kr and mrpark@tinc.co.kr */ + +/* + Unicode mapping is done according to: + ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/KSC/KSC5601.TXT + + Valid multi-byte characters: + + [A1..FE][41..5A,61..7A,81..FE] + + Note, 0x5C is not a valid MB tail, + so escape_with_backslash_is_dangerous is not set. +*/ + +#define iseuc_kr_head(c) ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)) + +#define iseuc_kr_tail1(c) ((uchar) (c) >= 0x41 && (uchar) (c) <= 0x5A) +#define iseuc_kr_tail2(c) ((uchar) (c) >= 0x61 && (uchar) (c) <= 0x7A) +#define iseuc_kr_tail3(c) ((uchar) (c) >= 0x81 && (uchar) (c) <= 0xFE) + +#define iseuc_kr_tail(c) (iseuc_kr_tail1(c) || \ + iseuc_kr_tail2(c) || \ + iseuc_kr_tail3(c)) + + +static uint ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return ((*(uchar*)(p)<0x80)? 0:\ + iseuc_kr_head(*(p)) && (e)-(p)>1 && iseuc_kr_tail(*((p)+1))? 2:\ + 0); +} + +static uint mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c) +{ + return (iseuc_kr_head(c) ? 2 : 1); +} + + +/* page 0 0x8141-0xC8FE */ +static uint16 tab_ksc5601_uni0[]={ +0xAC02,0xAC03,0xAC05,0xAC06,0xAC0B,0xAC0C,0xAC0D,0xAC0E, +0xAC0F,0xAC18,0xAC1E,0xAC1F,0xAC21,0xAC22,0xAC23,0xAC25, +0xAC26,0xAC27,0xAC28,0xAC29,0xAC2A,0xAC2B,0xAC2E,0xAC32, +0xAC33,0xAC34, 0, 0, 0, 0, 0, 0, +0xAC35,0xAC36,0xAC37,0xAC3A,0xAC3B,0xAC3D,0xAC3E,0xAC3F, +0xAC41,0xAC42,0xAC43,0xAC44,0xAC45,0xAC46,0xAC47,0xAC48, +0xAC49,0xAC4A,0xAC4C,0xAC4E,0xAC4F,0xAC50,0xAC51,0xAC52, +0xAC53,0xAC55, 0, 0, 0, 0, 0, 0, +0xAC56,0xAC57,0xAC59,0xAC5A,0xAC5B,0xAC5D,0xAC5E,0xAC5F, +0xAC60,0xAC61,0xAC62,0xAC63,0xAC64,0xAC65,0xAC66,0xAC67, +0xAC68,0xAC69,0xAC6A,0xAC6B,0xAC6C,0xAC6D,0xAC6E,0xAC6F, +0xAC72,0xAC73,0xAC75,0xAC76,0xAC79,0xAC7B,0xAC7C,0xAC7D, +0xAC7E,0xAC7F,0xAC82,0xAC87,0xAC88,0xAC8D,0xAC8E,0xAC8F, +0xAC91,0xAC92,0xAC93,0xAC95,0xAC96,0xAC97,0xAC98,0xAC99, +0xAC9A,0xAC9B,0xAC9E,0xACA2,0xACA3,0xACA4,0xACA5,0xACA6, +0xACA7,0xACAB,0xACAD,0xACAE,0xACB1,0xACB2,0xACB3,0xACB4, +0xACB5,0xACB6,0xACB7,0xACBA,0xACBE,0xACBF,0xACC0,0xACC2, +0xACC3,0xACC5,0xACC6,0xACC7,0xACC9,0xACCA,0xACCB,0xACCD, +0xACCE,0xACCF,0xACD0,0xACD1,0xACD2,0xACD3,0xACD4,0xACD6, +0xACD8,0xACD9,0xACDA,0xACDB,0xACDC,0xACDD,0xACDE,0xACDF, +0xACE2,0xACE3,0xACE5,0xACE6,0xACE9,0xACEB,0xACED,0xACEE, +0xACF2,0xACF4,0xACF7,0xACF8,0xACF9,0xACFA,0xACFB,0xACFE, +0xACFF,0xAD01,0xAD02,0xAD03,0xAD05,0xAD07,0xAD08,0xAD09, +0xAD0A,0xAD0B,0xAD0E,0xAD10,0xAD12,0xAD13, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xAD14,0xAD15,0xAD16,0xAD17,0xAD19,0xAD1A,0xAD1B,0xAD1D, +0xAD1E,0xAD1F,0xAD21,0xAD22,0xAD23,0xAD24,0xAD25,0xAD26, +0xAD27,0xAD28,0xAD2A,0xAD2B,0xAD2E,0xAD2F,0xAD30,0xAD31, +0xAD32,0xAD33, 0, 0, 0, 0, 0, 0, +0xAD36,0xAD37,0xAD39,0xAD3A,0xAD3B,0xAD3D,0xAD3E,0xAD3F, +0xAD40,0xAD41,0xAD42,0xAD43,0xAD46,0xAD48,0xAD4A,0xAD4B, +0xAD4C,0xAD4D,0xAD4E,0xAD4F,0xAD51,0xAD52,0xAD53,0xAD55, +0xAD56,0xAD57, 0, 0, 0, 0, 0, 0, +0xAD59,0xAD5A,0xAD5B,0xAD5C,0xAD5D,0xAD5E,0xAD5F,0xAD60, +0xAD62,0xAD64,0xAD65,0xAD66,0xAD67,0xAD68,0xAD69,0xAD6A, +0xAD6B,0xAD6E,0xAD6F,0xAD71,0xAD72,0xAD77,0xAD78,0xAD79, +0xAD7A,0xAD7E,0xAD80,0xAD83,0xAD84,0xAD85,0xAD86,0xAD87, +0xAD8A,0xAD8B,0xAD8D,0xAD8E,0xAD8F,0xAD91,0xAD92,0xAD93, +0xAD94,0xAD95,0xAD96,0xAD97,0xAD98,0xAD99,0xAD9A,0xAD9B, +0xAD9E,0xAD9F,0xADA0,0xADA1,0xADA2,0xADA3,0xADA5,0xADA6, +0xADA7,0xADA8,0xADA9,0xADAA,0xADAB,0xADAC,0xADAD,0xADAE, +0xADAF,0xADB0,0xADB1,0xADB2,0xADB3,0xADB4,0xADB5,0xADB6, +0xADB8,0xADB9,0xADBA,0xADBB,0xADBC,0xADBD,0xADBE,0xADBF, +0xADC2,0xADC3,0xADC5,0xADC6,0xADC7,0xADC9,0xADCA,0xADCB, +0xADCC,0xADCD,0xADCE,0xADCF,0xADD2,0xADD4,0xADD5,0xADD6, +0xADD7,0xADD8,0xADD9,0xADDA,0xADDB,0xADDD,0xADDE,0xADDF, +0xADE1,0xADE2,0xADE3,0xADE5,0xADE6,0xADE7,0xADE8,0xADE9, +0xADEA,0xADEB,0xADEC,0xADED,0xADEE,0xADEF,0xADF0,0xADF1, +0xADF2,0xADF3,0xADF4,0xADF5,0xADF6,0xADF7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xADFA,0xADFB,0xADFD,0xADFE,0xAE02,0xAE03,0xAE04,0xAE05, +0xAE06,0xAE07,0xAE0A,0xAE0C,0xAE0E,0xAE0F,0xAE10,0xAE11, +0xAE12,0xAE13,0xAE15,0xAE16,0xAE17,0xAE18,0xAE19,0xAE1A, +0xAE1B,0xAE1C, 0, 0, 0, 0, 0, 0, +0xAE1D,0xAE1E,0xAE1F,0xAE20,0xAE21,0xAE22,0xAE23,0xAE24, +0xAE25,0xAE26,0xAE27,0xAE28,0xAE29,0xAE2A,0xAE2B,0xAE2C, +0xAE2D,0xAE2E,0xAE2F,0xAE32,0xAE33,0xAE35,0xAE36,0xAE39, +0xAE3B,0xAE3C, 0, 0, 0, 0, 0, 0, +0xAE3D,0xAE3E,0xAE3F,0xAE42,0xAE44,0xAE47,0xAE48,0xAE49, +0xAE4B,0xAE4F,0xAE51,0xAE52,0xAE53,0xAE55,0xAE57,0xAE58, +0xAE59,0xAE5A,0xAE5B,0xAE5E,0xAE62,0xAE63,0xAE64,0xAE66, +0xAE67,0xAE6A,0xAE6B,0xAE6D,0xAE6E,0xAE6F,0xAE71,0xAE72, +0xAE73,0xAE74,0xAE75,0xAE76,0xAE77,0xAE7A,0xAE7E,0xAE7F, +0xAE80,0xAE81,0xAE82,0xAE83,0xAE86,0xAE87,0xAE88,0xAE89, +0xAE8A,0xAE8B,0xAE8D,0xAE8E,0xAE8F,0xAE90,0xAE91,0xAE92, +0xAE93,0xAE94,0xAE95,0xAE96,0xAE97,0xAE98,0xAE99,0xAE9A, +0xAE9B,0xAE9C,0xAE9D,0xAE9E,0xAE9F,0xAEA0,0xAEA1,0xAEA2, +0xAEA3,0xAEA4,0xAEA5,0xAEA6,0xAEA7,0xAEA8,0xAEA9,0xAEAA, +0xAEAB,0xAEAC,0xAEAD,0xAEAE,0xAEAF,0xAEB0,0xAEB1,0xAEB2, +0xAEB3,0xAEB4,0xAEB5,0xAEB6,0xAEB7,0xAEB8,0xAEB9,0xAEBA, +0xAEBB,0xAEBF,0xAEC1,0xAEC2,0xAEC3,0xAEC5,0xAEC6,0xAEC7, +0xAEC8,0xAEC9,0xAECA,0xAECB,0xAECE,0xAED2,0xAED3,0xAED4, +0xAED5,0xAED6,0xAED7,0xAEDA,0xAEDB,0xAEDD,0xAEDE,0xAEDF, +0xAEE0,0xAEE1,0xAEE2,0xAEE3,0xAEE4,0xAEE5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xAEE6,0xAEE7,0xAEE9,0xAEEA,0xAEEC,0xAEEE,0xAEEF,0xAEF0, +0xAEF1,0xAEF2,0xAEF3,0xAEF5,0xAEF6,0xAEF7,0xAEF9,0xAEFA, +0xAEFB,0xAEFD,0xAEFE,0xAEFF,0xAF00,0xAF01,0xAF02,0xAF03, +0xAF04,0xAF05, 0, 0, 0, 0, 0, 0, +0xAF06,0xAF09,0xAF0A,0xAF0B,0xAF0C,0xAF0E,0xAF0F,0xAF11, +0xAF12,0xAF13,0xAF14,0xAF15,0xAF16,0xAF17,0xAF18,0xAF19, +0xAF1A,0xAF1B,0xAF1C,0xAF1D,0xAF1E,0xAF1F,0xAF20,0xAF21, +0xAF22,0xAF23, 0, 0, 0, 0, 0, 0, +0xAF24,0xAF25,0xAF26,0xAF27,0xAF28,0xAF29,0xAF2A,0xAF2B, +0xAF2E,0xAF2F,0xAF31,0xAF33,0xAF35,0xAF36,0xAF37,0xAF38, +0xAF39,0xAF3A,0xAF3B,0xAF3E,0xAF40,0xAF44,0xAF45,0xAF46, +0xAF47,0xAF4A,0xAF4B,0xAF4C,0xAF4D,0xAF4E,0xAF4F,0xAF51, +0xAF52,0xAF53,0xAF54,0xAF55,0xAF56,0xAF57,0xAF58,0xAF59, +0xAF5A,0xAF5B,0xAF5E,0xAF5F,0xAF60,0xAF61,0xAF62,0xAF63, +0xAF66,0xAF67,0xAF68,0xAF69,0xAF6A,0xAF6B,0xAF6C,0xAF6D, +0xAF6E,0xAF6F,0xAF70,0xAF71,0xAF72,0xAF73,0xAF74,0xAF75, +0xAF76,0xAF77,0xAF78,0xAF7A,0xAF7B,0xAF7C,0xAF7D,0xAF7E, +0xAF7F,0xAF81,0xAF82,0xAF83,0xAF85,0xAF86,0xAF87,0xAF89, +0xAF8A,0xAF8B,0xAF8C,0xAF8D,0xAF8E,0xAF8F,0xAF92,0xAF93, +0xAF94,0xAF96,0xAF97,0xAF98,0xAF99,0xAF9A,0xAF9B,0xAF9D, +0xAF9E,0xAF9F,0xAFA0,0xAFA1,0xAFA2,0xAFA3,0xAFA4,0xAFA5, +0xAFA6,0xAFA7,0xAFA8,0xAFA9,0xAFAA,0xAFAB,0xAFAC,0xAFAD, +0xAFAE,0xAFAF,0xAFB0,0xAFB1,0xAFB2,0xAFB3,0xAFB4,0xAFB5, +0xAFB6,0xAFB7,0xAFBA,0xAFBB,0xAFBD,0xAFBE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xAFBF,0xAFC1,0xAFC2,0xAFC3,0xAFC4,0xAFC5,0xAFC6,0xAFCA, +0xAFCC,0xAFCF,0xAFD0,0xAFD1,0xAFD2,0xAFD3,0xAFD5,0xAFD6, +0xAFD7,0xAFD8,0xAFD9,0xAFDA,0xAFDB,0xAFDD,0xAFDE,0xAFDF, +0xAFE0,0xAFE1, 0, 0, 0, 0, 0, 0, +0xAFE2,0xAFE3,0xAFE4,0xAFE5,0xAFE6,0xAFE7,0xAFEA,0xAFEB, +0xAFEC,0xAFED,0xAFEE,0xAFEF,0xAFF2,0xAFF3,0xAFF5,0xAFF6, +0xAFF7,0xAFF9,0xAFFA,0xAFFB,0xAFFC,0xAFFD,0xAFFE,0xAFFF, +0xB002,0xB003, 0, 0, 0, 0, 0, 0, +0xB005,0xB006,0xB007,0xB008,0xB009,0xB00A,0xB00B,0xB00D, +0xB00E,0xB00F,0xB011,0xB012,0xB013,0xB015,0xB016,0xB017, +0xB018,0xB019,0xB01A,0xB01B,0xB01E,0xB01F,0xB020,0xB021, +0xB022,0xB023,0xB024,0xB025,0xB026,0xB027,0xB029,0xB02A, +0xB02B,0xB02C,0xB02D,0xB02E,0xB02F,0xB030,0xB031,0xB032, +0xB033,0xB034,0xB035,0xB036,0xB037,0xB038,0xB039,0xB03A, +0xB03B,0xB03C,0xB03D,0xB03E,0xB03F,0xB040,0xB041,0xB042, +0xB043,0xB046,0xB047,0xB049,0xB04B,0xB04D,0xB04F,0xB050, +0xB051,0xB052,0xB056,0xB058,0xB05A,0xB05B,0xB05C,0xB05E, +0xB05F,0xB060,0xB061,0xB062,0xB063,0xB064,0xB065,0xB066, +0xB067,0xB068,0xB069,0xB06A,0xB06B,0xB06C,0xB06D,0xB06E, +0xB06F,0xB070,0xB071,0xB072,0xB073,0xB074,0xB075,0xB076, +0xB077,0xB078,0xB079,0xB07A,0xB07B,0xB07E,0xB07F,0xB081, +0xB082,0xB083,0xB085,0xB086,0xB087,0xB088,0xB089,0xB08A, +0xB08B,0xB08E,0xB090,0xB092,0xB093,0xB094,0xB095,0xB096, +0xB097,0xB09B,0xB09D,0xB09E,0xB0A3,0xB0A4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB0A5,0xB0A6,0xB0A7,0xB0AA,0xB0B0,0xB0B2,0xB0B6,0xB0B7, +0xB0B9,0xB0BA,0xB0BB,0xB0BD,0xB0BE,0xB0BF,0xB0C0,0xB0C1, +0xB0C2,0xB0C3,0xB0C6,0xB0CA,0xB0CB,0xB0CC,0xB0CD,0xB0CE, +0xB0CF,0xB0D2, 0, 0, 0, 0, 0, 0, +0xB0D3,0xB0D5,0xB0D6,0xB0D7,0xB0D9,0xB0DA,0xB0DB,0xB0DC, +0xB0DD,0xB0DE,0xB0DF,0xB0E1,0xB0E2,0xB0E3,0xB0E4,0xB0E6, +0xB0E7,0xB0E8,0xB0E9,0xB0EA,0xB0EB,0xB0EC,0xB0ED,0xB0EE, +0xB0EF,0xB0F0, 0, 0, 0, 0, 0, 0, +0xB0F1,0xB0F2,0xB0F3,0xB0F4,0xB0F5,0xB0F6,0xB0F7,0xB0F8, +0xB0F9,0xB0FA,0xB0FB,0xB0FC,0xB0FD,0xB0FE,0xB0FF,0xB100, +0xB101,0xB102,0xB103,0xB104,0xB105,0xB106,0xB107,0xB10A, +0xB10D,0xB10E,0xB10F,0xB111,0xB114,0xB115,0xB116,0xB117, +0xB11A,0xB11E,0xB11F,0xB120,0xB121,0xB122,0xB126,0xB127, +0xB129,0xB12A,0xB12B,0xB12D,0xB12E,0xB12F,0xB130,0xB131, +0xB132,0xB133,0xB136,0xB13A,0xB13B,0xB13C,0xB13D,0xB13E, +0xB13F,0xB142,0xB143,0xB145,0xB146,0xB147,0xB149,0xB14A, +0xB14B,0xB14C,0xB14D,0xB14E,0xB14F,0xB152,0xB153,0xB156, +0xB157,0xB159,0xB15A,0xB15B,0xB15D,0xB15E,0xB15F,0xB161, +0xB162,0xB163,0xB164,0xB165,0xB166,0xB167,0xB168,0xB169, +0xB16A,0xB16B,0xB16C,0xB16D,0xB16E,0xB16F,0xB170,0xB171, +0xB172,0xB173,0xB174,0xB175,0xB176,0xB177,0xB17A,0xB17B, +0xB17D,0xB17E,0xB17F,0xB181,0xB183,0xB184,0xB185,0xB186, +0xB187,0xB18A,0xB18C,0xB18E,0xB18F,0xB190,0xB191,0xB195, +0xB196,0xB197,0xB199,0xB19A,0xB19B,0xB19D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB19E,0xB19F,0xB1A0,0xB1A1,0xB1A2,0xB1A3,0xB1A4,0xB1A5, +0xB1A6,0xB1A7,0xB1A9,0xB1AA,0xB1AB,0xB1AC,0xB1AD,0xB1AE, +0xB1AF,0xB1B0,0xB1B1,0xB1B2,0xB1B3,0xB1B4,0xB1B5,0xB1B6, +0xB1B7,0xB1B8, 0, 0, 0, 0, 0, 0, +0xB1B9,0xB1BA,0xB1BB,0xB1BC,0xB1BD,0xB1BE,0xB1BF,0xB1C0, +0xB1C1,0xB1C2,0xB1C3,0xB1C4,0xB1C5,0xB1C6,0xB1C7,0xB1C8, +0xB1C9,0xB1CA,0xB1CB,0xB1CD,0xB1CE,0xB1CF,0xB1D1,0xB1D2, +0xB1D3,0xB1D5, 0, 0, 0, 0, 0, 0, +0xB1D6,0xB1D7,0xB1D8,0xB1D9,0xB1DA,0xB1DB,0xB1DE,0xB1E0, +0xB1E1,0xB1E2,0xB1E3,0xB1E4,0xB1E5,0xB1E6,0xB1E7,0xB1EA, +0xB1EB,0xB1ED,0xB1EE,0xB1EF,0xB1F1,0xB1F2,0xB1F3,0xB1F4, +0xB1F5,0xB1F6,0xB1F7,0xB1F8,0xB1FA,0xB1FC,0xB1FE,0xB1FF, +0xB200,0xB201,0xB202,0xB203,0xB206,0xB207,0xB209,0xB20A, +0xB20D,0xB20E,0xB20F,0xB210,0xB211,0xB212,0xB213,0xB216, +0xB218,0xB21A,0xB21B,0xB21C,0xB21D,0xB21E,0xB21F,0xB221, +0xB222,0xB223,0xB224,0xB225,0xB226,0xB227,0xB228,0xB229, +0xB22A,0xB22B,0xB22C,0xB22D,0xB22E,0xB22F,0xB230,0xB231, +0xB232,0xB233,0xB235,0xB236,0xB237,0xB238,0xB239,0xB23A, +0xB23B,0xB23D,0xB23E,0xB23F,0xB240,0xB241,0xB242,0xB243, +0xB244,0xB245,0xB246,0xB247,0xB248,0xB249,0xB24A,0xB24B, +0xB24C,0xB24D,0xB24E,0xB24F,0xB250,0xB251,0xB252,0xB253, +0xB254,0xB255,0xB256,0xB257,0xB259,0xB25A,0xB25B,0xB25D, +0xB25E,0xB25F,0xB261,0xB262,0xB263,0xB264,0xB265,0xB266, +0xB267,0xB26A,0xB26B,0xB26C,0xB26D,0xB26E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB26F,0xB270,0xB271,0xB272,0xB273,0xB276,0xB277,0xB278, +0xB279,0xB27A,0xB27B,0xB27D,0xB27E,0xB27F,0xB280,0xB281, +0xB282,0xB283,0xB286,0xB287,0xB288,0xB28A,0xB28B,0xB28C, +0xB28D,0xB28E, 0, 0, 0, 0, 0, 0, +0xB28F,0xB292,0xB293,0xB295,0xB296,0xB297,0xB29B,0xB29C, +0xB29D,0xB29E,0xB29F,0xB2A2,0xB2A4,0xB2A7,0xB2A8,0xB2A9, +0xB2AB,0xB2AD,0xB2AE,0xB2AF,0xB2B1,0xB2B2,0xB2B3,0xB2B5, +0xB2B6,0xB2B7, 0, 0, 0, 0, 0, 0, +0xB2B8,0xB2B9,0xB2BA,0xB2BB,0xB2BC,0xB2BD,0xB2BE,0xB2BF, +0xB2C0,0xB2C1,0xB2C2,0xB2C3,0xB2C4,0xB2C5,0xB2C6,0xB2C7, +0xB2CA,0xB2CB,0xB2CD,0xB2CE,0xB2CF,0xB2D1,0xB2D3,0xB2D4, +0xB2D5,0xB2D6,0xB2D7,0xB2DA,0xB2DC,0xB2DE,0xB2DF,0xB2E0, +0xB2E1,0xB2E3,0xB2E7,0xB2E9,0xB2EA,0xB2F0,0xB2F1,0xB2F2, +0xB2F6,0xB2FC,0xB2FD,0xB2FE,0xB302,0xB303,0xB305,0xB306, +0xB307,0xB309,0xB30A,0xB30B,0xB30C,0xB30D,0xB30E,0xB30F, +0xB312,0xB316,0xB317,0xB318,0xB319,0xB31A,0xB31B,0xB31D, +0xB31E,0xB31F,0xB320,0xB321,0xB322,0xB323,0xB324,0xB325, +0xB326,0xB327,0xB328,0xB329,0xB32A,0xB32B,0xB32C,0xB32D, +0xB32E,0xB32F,0xB330,0xB331,0xB332,0xB333,0xB334,0xB335, +0xB336,0xB337,0xB338,0xB339,0xB33A,0xB33B,0xB33C,0xB33D, +0xB33E,0xB33F,0xB340,0xB341,0xB342,0xB343,0xB344,0xB345, +0xB346,0xB347,0xB348,0xB349,0xB34A,0xB34B,0xB34C,0xB34D, +0xB34E,0xB34F,0xB350,0xB351,0xB352,0xB353,0xB357,0xB359, +0xB35A,0xB35D,0xB360,0xB361,0xB362,0xB363, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB366,0xB368,0xB36A,0xB36C,0xB36D,0xB36F,0xB372,0xB373, +0xB375,0xB376,0xB377,0xB379,0xB37A,0xB37B,0xB37C,0xB37D, +0xB37E,0xB37F,0xB382,0xB386,0xB387,0xB388,0xB389,0xB38A, +0xB38B,0xB38D, 0, 0, 0, 0, 0, 0, +0xB38E,0xB38F,0xB391,0xB392,0xB393,0xB395,0xB396,0xB397, +0xB398,0xB399,0xB39A,0xB39B,0xB39C,0xB39D,0xB39E,0xB39F, +0xB3A2,0xB3A3,0xB3A4,0xB3A5,0xB3A6,0xB3A7,0xB3A9,0xB3AA, +0xB3AB,0xB3AD, 0, 0, 0, 0, 0, 0, +0xB3AE,0xB3AF,0xB3B0,0xB3B1,0xB3B2,0xB3B3,0xB3B4,0xB3B5, +0xB3B6,0xB3B7,0xB3B8,0xB3B9,0xB3BA,0xB3BB,0xB3BC,0xB3BD, +0xB3BE,0xB3BF,0xB3C0,0xB3C1,0xB3C2,0xB3C3,0xB3C6,0xB3C7, +0xB3C9,0xB3CA,0xB3CD,0xB3CF,0xB3D1,0xB3D2,0xB3D3,0xB3D6, +0xB3D8,0xB3DA,0xB3DC,0xB3DE,0xB3DF,0xB3E1,0xB3E2,0xB3E3, +0xB3E5,0xB3E6,0xB3E7,0xB3E9,0xB3EA,0xB3EB,0xB3EC,0xB3ED, +0xB3EE,0xB3EF,0xB3F0,0xB3F1,0xB3F2,0xB3F3,0xB3F4,0xB3F5, +0xB3F6,0xB3F7,0xB3F8,0xB3F9,0xB3FA,0xB3FB,0xB3FD,0xB3FE, +0xB3FF,0xB400,0xB401,0xB402,0xB403,0xB404,0xB405,0xB406, +0xB407,0xB408,0xB409,0xB40A,0xB40B,0xB40C,0xB40D,0xB40E, +0xB40F,0xB411,0xB412,0xB413,0xB414,0xB415,0xB416,0xB417, +0xB419,0xB41A,0xB41B,0xB41D,0xB41E,0xB41F,0xB421,0xB422, +0xB423,0xB424,0xB425,0xB426,0xB427,0xB42A,0xB42C,0xB42D, +0xB42E,0xB42F,0xB430,0xB431,0xB432,0xB433,0xB435,0xB436, +0xB437,0xB438,0xB439,0xB43A,0xB43B,0xB43C,0xB43D,0xB43E, +0xB43F,0xB440,0xB441,0xB442,0xB443,0xB444, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB445,0xB446,0xB447,0xB448,0xB449,0xB44A,0xB44B,0xB44C, +0xB44D,0xB44E,0xB44F,0xB452,0xB453,0xB455,0xB456,0xB457, +0xB459,0xB45A,0xB45B,0xB45C,0xB45D,0xB45E,0xB45F,0xB462, +0xB464,0xB466, 0, 0, 0, 0, 0, 0, +0xB467,0xB468,0xB469,0xB46A,0xB46B,0xB46D,0xB46E,0xB46F, +0xB470,0xB471,0xB472,0xB473,0xB474,0xB475,0xB476,0xB477, +0xB478,0xB479,0xB47A,0xB47B,0xB47C,0xB47D,0xB47E,0xB47F, +0xB481,0xB482, 0, 0, 0, 0, 0, 0, +0xB483,0xB484,0xB485,0xB486,0xB487,0xB489,0xB48A,0xB48B, +0xB48C,0xB48D,0xB48E,0xB48F,0xB490,0xB491,0xB492,0xB493, +0xB494,0xB495,0xB496,0xB497,0xB498,0xB499,0xB49A,0xB49B, +0xB49C,0xB49E,0xB49F,0xB4A0,0xB4A1,0xB4A2,0xB4A3,0xB4A5, +0xB4A6,0xB4A7,0xB4A9,0xB4AA,0xB4AB,0xB4AD,0xB4AE,0xB4AF, +0xB4B0,0xB4B1,0xB4B2,0xB4B3,0xB4B4,0xB4B6,0xB4B8,0xB4BA, +0xB4BB,0xB4BC,0xB4BD,0xB4BE,0xB4BF,0xB4C1,0xB4C2,0xB4C3, +0xB4C5,0xB4C6,0xB4C7,0xB4C9,0xB4CA,0xB4CB,0xB4CC,0xB4CD, +0xB4CE,0xB4CF,0xB4D1,0xB4D2,0xB4D3,0xB4D4,0xB4D6,0xB4D7, +0xB4D8,0xB4D9,0xB4DA,0xB4DB,0xB4DE,0xB4DF,0xB4E1,0xB4E2, +0xB4E5,0xB4E7,0xB4E8,0xB4E9,0xB4EA,0xB4EB,0xB4EE,0xB4F0, +0xB4F2,0xB4F3,0xB4F4,0xB4F5,0xB4F6,0xB4F7,0xB4F9,0xB4FA, +0xB4FB,0xB4FC,0xB4FD,0xB4FE,0xB4FF,0xB500,0xB501,0xB502, +0xB503,0xB504,0xB505,0xB506,0xB507,0xB508,0xB509,0xB50A, +0xB50B,0xB50C,0xB50D,0xB50E,0xB50F,0xB510,0xB511,0xB512, +0xB513,0xB516,0xB517,0xB519,0xB51A,0xB51D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB51E,0xB51F,0xB520,0xB521,0xB522,0xB523,0xB526,0xB52B, +0xB52C,0xB52D,0xB52E,0xB52F,0xB532,0xB533,0xB535,0xB536, +0xB537,0xB539,0xB53A,0xB53B,0xB53C,0xB53D,0xB53E,0xB53F, +0xB542,0xB546, 0, 0, 0, 0, 0, 0, +0xB547,0xB548,0xB549,0xB54A,0xB54E,0xB54F,0xB551,0xB552, +0xB553,0xB555,0xB556,0xB557,0xB558,0xB559,0xB55A,0xB55B, +0xB55E,0xB562,0xB563,0xB564,0xB565,0xB566,0xB567,0xB568, +0xB569,0xB56A, 0, 0, 0, 0, 0, 0, +0xB56B,0xB56C,0xB56D,0xB56E,0xB56F,0xB570,0xB571,0xB572, +0xB573,0xB574,0xB575,0xB576,0xB577,0xB578,0xB579,0xB57A, +0xB57B,0xB57C,0xB57D,0xB57E,0xB57F,0xB580,0xB581,0xB582, +0xB583,0xB584,0xB585,0xB586,0xB587,0xB588,0xB589,0xB58A, +0xB58B,0xB58C,0xB58D,0xB58E,0xB58F,0xB590,0xB591,0xB592, +0xB593,0xB594,0xB595,0xB596,0xB597,0xB598,0xB599,0xB59A, +0xB59B,0xB59C,0xB59D,0xB59E,0xB59F,0xB5A2,0xB5A3,0xB5A5, +0xB5A6,0xB5A7,0xB5A9,0xB5AC,0xB5AD,0xB5AE,0xB5AF,0xB5B2, +0xB5B6,0xB5B7,0xB5B8,0xB5B9,0xB5BA,0xB5BE,0xB5BF,0xB5C1, +0xB5C2,0xB5C3,0xB5C5,0xB5C6,0xB5C7,0xB5C8,0xB5C9,0xB5CA, +0xB5CB,0xB5CE,0xB5D2,0xB5D3,0xB5D4,0xB5D5,0xB5D6,0xB5D7, +0xB5D9,0xB5DA,0xB5DB,0xB5DC,0xB5DD,0xB5DE,0xB5DF,0xB5E0, +0xB5E1,0xB5E2,0xB5E3,0xB5E4,0xB5E5,0xB5E6,0xB5E7,0xB5E8, +0xB5E9,0xB5EA,0xB5EB,0xB5ED,0xB5EE,0xB5EF,0xB5F0,0xB5F1, +0xB5F2,0xB5F3,0xB5F4,0xB5F5,0xB5F6,0xB5F7,0xB5F8,0xB5F9, +0xB5FA,0xB5FB,0xB5FC,0xB5FD,0xB5FE,0xB5FF, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB600,0xB601,0xB602,0xB603,0xB604,0xB605,0xB606,0xB607, +0xB608,0xB609,0xB60A,0xB60B,0xB60C,0xB60D,0xB60E,0xB60F, +0xB612,0xB613,0xB615,0xB616,0xB617,0xB619,0xB61A,0xB61B, +0xB61C,0xB61D, 0, 0, 0, 0, 0, 0, +0xB61E,0xB61F,0xB620,0xB621,0xB622,0xB623,0xB624,0xB626, +0xB627,0xB628,0xB629,0xB62A,0xB62B,0xB62D,0xB62E,0xB62F, +0xB630,0xB631,0xB632,0xB633,0xB635,0xB636,0xB637,0xB638, +0xB639,0xB63A, 0, 0, 0, 0, 0, 0, +0xB63B,0xB63C,0xB63D,0xB63E,0xB63F,0xB640,0xB641,0xB642, +0xB643,0xB644,0xB645,0xB646,0xB647,0xB649,0xB64A,0xB64B, +0xB64C,0xB64D,0xB64E,0xB64F,0xB650,0xB651,0xB652,0xB653, +0xB654,0xB655,0xB656,0xB657,0xB658,0xB659,0xB65A,0xB65B, +0xB65C,0xB65D,0xB65E,0xB65F,0xB660,0xB661,0xB662,0xB663, +0xB665,0xB666,0xB667,0xB669,0xB66A,0xB66B,0xB66C,0xB66D, +0xB66E,0xB66F,0xB670,0xB671,0xB672,0xB673,0xB674,0xB675, +0xB676,0xB677,0xB678,0xB679,0xB67A,0xB67B,0xB67C,0xB67D, +0xB67E,0xB67F,0xB680,0xB681,0xB682,0xB683,0xB684,0xB685, +0xB686,0xB687,0xB688,0xB689,0xB68A,0xB68B,0xB68C,0xB68D, +0xB68E,0xB68F,0xB690,0xB691,0xB692,0xB693,0xB694,0xB695, +0xB696,0xB697,0xB698,0xB699,0xB69A,0xB69B,0xB69E,0xB69F, +0xB6A1,0xB6A2,0xB6A3,0xB6A5,0xB6A6,0xB6A7,0xB6A8,0xB6A9, +0xB6AA,0xB6AD,0xB6AE,0xB6AF,0xB6B0,0xB6B2,0xB6B3,0xB6B4, +0xB6B5,0xB6B6,0xB6B7,0xB6B8,0xB6B9,0xB6BA,0xB6BB,0xB6BC, +0xB6BD,0xB6BE,0xB6BF,0xB6C0,0xB6C1,0xB6C2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB6C3,0xB6C4,0xB6C5,0xB6C6,0xB6C7,0xB6C8,0xB6C9,0xB6CA, +0xB6CB,0xB6CC,0xB6CD,0xB6CE,0xB6CF,0xB6D0,0xB6D1,0xB6D2, +0xB6D3,0xB6D5,0xB6D6,0xB6D7,0xB6D8,0xB6D9,0xB6DA,0xB6DB, +0xB6DC,0xB6DD, 0, 0, 0, 0, 0, 0, +0xB6DE,0xB6DF,0xB6E0,0xB6E1,0xB6E2,0xB6E3,0xB6E4,0xB6E5, +0xB6E6,0xB6E7,0xB6E8,0xB6E9,0xB6EA,0xB6EB,0xB6EC,0xB6ED, +0xB6EE,0xB6EF,0xB6F1,0xB6F2,0xB6F3,0xB6F5,0xB6F6,0xB6F7, +0xB6F9,0xB6FA, 0, 0, 0, 0, 0, 0, +0xB6FB,0xB6FC,0xB6FD,0xB6FE,0xB6FF,0xB702,0xB703,0xB704, +0xB706,0xB707,0xB708,0xB709,0xB70A,0xB70B,0xB70C,0xB70D, +0xB70E,0xB70F,0xB710,0xB711,0xB712,0xB713,0xB714,0xB715, +0xB716,0xB717,0xB718,0xB719,0xB71A,0xB71B,0xB71C,0xB71D, +0xB71E,0xB71F,0xB720,0xB721,0xB722,0xB723,0xB724,0xB725, +0xB726,0xB727,0xB72A,0xB72B,0xB72D,0xB72E,0xB731,0xB732, +0xB733,0xB734,0xB735,0xB736,0xB737,0xB73A,0xB73C,0xB73D, +0xB73E,0xB73F,0xB740,0xB741,0xB742,0xB743,0xB745,0xB746, +0xB747,0xB749,0xB74A,0xB74B,0xB74D,0xB74E,0xB74F,0xB750, +0xB751,0xB752,0xB753,0xB756,0xB757,0xB758,0xB759,0xB75A, +0xB75B,0xB75C,0xB75D,0xB75E,0xB75F,0xB761,0xB762,0xB763, +0xB765,0xB766,0xB767,0xB769,0xB76A,0xB76B,0xB76C,0xB76D, +0xB76E,0xB76F,0xB772,0xB774,0xB776,0xB777,0xB778,0xB779, +0xB77A,0xB77B,0xB77E,0xB77F,0xB781,0xB782,0xB783,0xB785, +0xB786,0xB787,0xB788,0xB789,0xB78A,0xB78B,0xB78E,0xB793, +0xB794,0xB795,0xB79A,0xB79B,0xB79D,0xB79E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB79F,0xB7A1,0xB7A2,0xB7A3,0xB7A4,0xB7A5,0xB7A6,0xB7A7, +0xB7AA,0xB7AE,0xB7AF,0xB7B0,0xB7B1,0xB7B2,0xB7B3,0xB7B6, +0xB7B7,0xB7B9,0xB7BA,0xB7BB,0xB7BC,0xB7BD,0xB7BE,0xB7BF, +0xB7C0,0xB7C1, 0, 0, 0, 0, 0, 0, +0xB7C2,0xB7C3,0xB7C4,0xB7C5,0xB7C6,0xB7C8,0xB7CA,0xB7CB, +0xB7CC,0xB7CD,0xB7CE,0xB7CF,0xB7D0,0xB7D1,0xB7D2,0xB7D3, +0xB7D4,0xB7D5,0xB7D6,0xB7D7,0xB7D8,0xB7D9,0xB7DA,0xB7DB, +0xB7DC,0xB7DD, 0, 0, 0, 0, 0, 0, +0xB7DE,0xB7DF,0xB7E0,0xB7E1,0xB7E2,0xB7E3,0xB7E4,0xB7E5, +0xB7E6,0xB7E7,0xB7E8,0xB7E9,0xB7EA,0xB7EB,0xB7EE,0xB7EF, +0xB7F1,0xB7F2,0xB7F3,0xB7F5,0xB7F6,0xB7F7,0xB7F8,0xB7F9, +0xB7FA,0xB7FB,0xB7FE,0xB802,0xB803,0xB804,0xB805,0xB806, +0xB80A,0xB80B,0xB80D,0xB80E,0xB80F,0xB811,0xB812,0xB813, +0xB814,0xB815,0xB816,0xB817,0xB81A,0xB81C,0xB81E,0xB81F, +0xB820,0xB821,0xB822,0xB823,0xB826,0xB827,0xB829,0xB82A, +0xB82B,0xB82D,0xB82E,0xB82F,0xB830,0xB831,0xB832,0xB833, +0xB836,0xB83A,0xB83B,0xB83C,0xB83D,0xB83E,0xB83F,0xB841, +0xB842,0xB843,0xB845,0xB846,0xB847,0xB848,0xB849,0xB84A, +0xB84B,0xB84C,0xB84D,0xB84E,0xB84F,0xB850,0xB852,0xB854, +0xB855,0xB856,0xB857,0xB858,0xB859,0xB85A,0xB85B,0xB85E, +0xB85F,0xB861,0xB862,0xB863,0xB865,0xB866,0xB867,0xB868, +0xB869,0xB86A,0xB86B,0xB86E,0xB870,0xB872,0xB873,0xB874, +0xB875,0xB876,0xB877,0xB879,0xB87A,0xB87B,0xB87D,0xB87E, +0xB87F,0xB880,0xB881,0xB882,0xB883,0xB884, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB885,0xB886,0xB887,0xB888,0xB889,0xB88A,0xB88B,0xB88C, +0xB88E,0xB88F,0xB890,0xB891,0xB892,0xB893,0xB894,0xB895, +0xB896,0xB897,0xB898,0xB899,0xB89A,0xB89B,0xB89C,0xB89D, +0xB89E,0xB89F, 0, 0, 0, 0, 0, 0, +0xB8A0,0xB8A1,0xB8A2,0xB8A3,0xB8A4,0xB8A5,0xB8A6,0xB8A7, +0xB8A9,0xB8AA,0xB8AB,0xB8AC,0xB8AD,0xB8AE,0xB8AF,0xB8B1, +0xB8B2,0xB8B3,0xB8B5,0xB8B6,0xB8B7,0xB8B9,0xB8BA,0xB8BB, +0xB8BC,0xB8BD, 0, 0, 0, 0, 0, 0, +0xB8BE,0xB8BF,0xB8C2,0xB8C4,0xB8C6,0xB8C7,0xB8C8,0xB8C9, +0xB8CA,0xB8CB,0xB8CD,0xB8CE,0xB8CF,0xB8D1,0xB8D2,0xB8D3, +0xB8D5,0xB8D6,0xB8D7,0xB8D8,0xB8D9,0xB8DA,0xB8DB,0xB8DC, +0xB8DE,0xB8E0,0xB8E2,0xB8E3,0xB8E4,0xB8E5,0xB8E6,0xB8E7, +0xB8EA,0xB8EB,0xB8ED,0xB8EE,0xB8EF,0xB8F1,0xB8F2,0xB8F3, +0xB8F4,0xB8F5,0xB8F6,0xB8F7,0xB8FA,0xB8FC,0xB8FE,0xB8FF, +0xB900,0xB901,0xB902,0xB903,0xB905,0xB906,0xB907,0xB908, +0xB909,0xB90A,0xB90B,0xB90C,0xB90D,0xB90E,0xB90F,0xB910, +0xB911,0xB912,0xB913,0xB914,0xB915,0xB916,0xB917,0xB919, +0xB91A,0xB91B,0xB91C,0xB91D,0xB91E,0xB91F,0xB921,0xB922, +0xB923,0xB924,0xB925,0xB926,0xB927,0xB928,0xB929,0xB92A, +0xB92B,0xB92C,0xB92D,0xB92E,0xB92F,0xB930,0xB931,0xB932, +0xB933,0xB934,0xB935,0xB936,0xB937,0xB938,0xB939,0xB93A, +0xB93B,0xB93E,0xB93F,0xB941,0xB942,0xB943,0xB945,0xB946, +0xB947,0xB948,0xB949,0xB94A,0xB94B,0xB94D,0xB94E,0xB950, +0xB952,0xB953,0xB954,0xB955,0xB956,0xB957, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xB95A,0xB95B,0xB95D,0xB95E,0xB95F,0xB961,0xB962,0xB963, +0xB964,0xB965,0xB966,0xB967,0xB96A,0xB96C,0xB96E,0xB96F, +0xB970,0xB971,0xB972,0xB973,0xB976,0xB977,0xB979,0xB97A, +0xB97B,0xB97D, 0, 0, 0, 0, 0, 0, +0xB97E,0xB97F,0xB980,0xB981,0xB982,0xB983,0xB986,0xB988, +0xB98B,0xB98C,0xB98F,0xB990,0xB991,0xB992,0xB993,0xB994, +0xB995,0xB996,0xB997,0xB998,0xB999,0xB99A,0xB99B,0xB99C, +0xB99D,0xB99E, 0, 0, 0, 0, 0, 0, +0xB99F,0xB9A0,0xB9A1,0xB9A2,0xB9A3,0xB9A4,0xB9A5,0xB9A6, +0xB9A7,0xB9A8,0xB9A9,0xB9AA,0xB9AB,0xB9AE,0xB9AF,0xB9B1, +0xB9B2,0xB9B3,0xB9B5,0xB9B6,0xB9B7,0xB9B8,0xB9B9,0xB9BA, +0xB9BB,0xB9BE,0xB9C0,0xB9C2,0xB9C3,0xB9C4,0xB9C5,0xB9C6, +0xB9C7,0xB9CA,0xB9CB,0xB9CD,0xB9D3,0xB9D4,0xB9D5,0xB9D6, +0xB9D7,0xB9DA,0xB9DC,0xB9DF,0xB9E0,0xB9E2,0xB9E6,0xB9E7, +0xB9E9,0xB9EA,0xB9EB,0xB9ED,0xB9EE,0xB9EF,0xB9F0,0xB9F1, +0xB9F2,0xB9F3,0xB9F6,0xB9FB,0xB9FC,0xB9FD,0xB9FE,0xB9FF, +0xBA02,0xBA03,0xBA04,0xBA05,0xBA06,0xBA07,0xBA09,0xBA0A, +0xBA0B,0xBA0C,0xBA0D,0xBA0E,0xBA0F,0xBA10,0xBA11,0xBA12, +0xBA13,0xBA14,0xBA16,0xBA17,0xBA18,0xBA19,0xBA1A,0xBA1B, +0xBA1C,0xBA1D,0xBA1E,0xBA1F,0xBA20,0xBA21,0xBA22,0xBA23, +0xBA24,0xBA25,0xBA26,0xBA27,0xBA28,0xBA29,0xBA2A,0xBA2B, +0xBA2C,0xBA2D,0xBA2E,0xBA2F,0xBA30,0xBA31,0xBA32,0xBA33, +0xBA34,0xBA35,0xBA36,0xBA37,0xBA3A,0xBA3B,0xBA3D,0xBA3E, +0xBA3F,0xBA41,0xBA43,0xBA44,0xBA45,0xBA46, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xBA47,0xBA4A,0xBA4C,0xBA4F,0xBA50,0xBA51,0xBA52,0xBA56, +0xBA57,0xBA59,0xBA5A,0xBA5B,0xBA5D,0xBA5E,0xBA5F,0xBA60, +0xBA61,0xBA62,0xBA63,0xBA66,0xBA6A,0xBA6B,0xBA6C,0xBA6D, +0xBA6E,0xBA6F, 0, 0, 0, 0, 0, 0, +0xBA72,0xBA73,0xBA75,0xBA76,0xBA77,0xBA79,0xBA7A,0xBA7B, +0xBA7C,0xBA7D,0xBA7E,0xBA7F,0xBA80,0xBA81,0xBA82,0xBA86, +0xBA88,0xBA89,0xBA8A,0xBA8B,0xBA8D,0xBA8E,0xBA8F,0xBA90, +0xBA91,0xBA92, 0, 0, 0, 0, 0, 0, +0xBA93,0xBA94,0xBA95,0xBA96,0xBA97,0xBA98,0xBA99,0xBA9A, +0xBA9B,0xBA9C,0xBA9D,0xBA9E,0xBA9F,0xBAA0,0xBAA1,0xBAA2, +0xBAA3,0xBAA4,0xBAA5,0xBAA6,0xBAA7,0xBAAA,0xBAAD,0xBAAE, +0xBAAF,0xBAB1,0xBAB3,0xBAB4,0xBAB5,0xBAB6,0xBAB7,0xBABA, +0xBABC,0xBABE,0xBABF,0xBAC0,0xBAC1,0xBAC2,0xBAC3,0xBAC5, +0xBAC6,0xBAC7,0xBAC9,0xBACA,0xBACB,0xBACC,0xBACD,0xBACE, +0xBACF,0xBAD0,0xBAD1,0xBAD2,0xBAD3,0xBAD4,0xBAD5,0xBAD6, +0xBAD7,0xBADA,0xBADB,0xBADC,0xBADD,0xBADE,0xBADF,0xBAE0, +0xBAE1,0xBAE2,0xBAE3,0xBAE4,0xBAE5,0xBAE6,0xBAE7,0xBAE8, +0xBAE9,0xBAEA,0xBAEB,0xBAEC,0xBAED,0xBAEE,0xBAEF,0xBAF0, +0xBAF1,0xBAF2,0xBAF3,0xBAF4,0xBAF5,0xBAF6,0xBAF7,0xBAF8, +0xBAF9,0xBAFA,0xBAFB,0xBAFD,0xBAFE,0xBAFF,0xBB01,0xBB02, +0xBB03,0xBB05,0xBB06,0xBB07,0xBB08,0xBB09,0xBB0A,0xBB0B, +0xBB0C,0xBB0E,0xBB10,0xBB12,0xBB13,0xBB14,0xBB15,0xBB16, +0xBB17,0xBB19,0xBB1A,0xBB1B,0xBB1D,0xBB1E,0xBB1F,0xBB21, +0xBB22,0xBB23,0xBB24,0xBB25,0xBB26,0xBB27, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xBB28,0xBB2A,0xBB2C,0xBB2D,0xBB2E,0xBB2F,0xBB30,0xBB31, +0xBB32,0xBB33,0xBB37,0xBB39,0xBB3A,0xBB3F,0xBB40,0xBB41, +0xBB42,0xBB43,0xBB46,0xBB48,0xBB4A,0xBB4B,0xBB4C,0xBB4E, +0xBB51,0xBB52, 0, 0, 0, 0, 0, 0, +0xBB53,0xBB55,0xBB56,0xBB57,0xBB59,0xBB5A,0xBB5B,0xBB5C, +0xBB5D,0xBB5E,0xBB5F,0xBB60,0xBB62,0xBB64,0xBB65,0xBB66, +0xBB67,0xBB68,0xBB69,0xBB6A,0xBB6B,0xBB6D,0xBB6E,0xBB6F, +0xBB70,0xBB71, 0, 0, 0, 0, 0, 0, +0xBB72,0xBB73,0xBB74,0xBB75,0xBB76,0xBB77,0xBB78,0xBB79, +0xBB7A,0xBB7B,0xBB7C,0xBB7D,0xBB7E,0xBB7F,0xBB80,0xBB81, +0xBB82,0xBB83,0xBB84,0xBB85,0xBB86,0xBB87,0xBB89,0xBB8A, +0xBB8B,0xBB8D,0xBB8E,0xBB8F,0xBB91,0xBB92,0xBB93,0xBB94, +0xBB95,0xBB96,0xBB97,0xBB98,0xBB99,0xBB9A,0xBB9B,0xBB9C, +0xBB9D,0xBB9E,0xBB9F,0xBBA0,0xBBA1,0xBBA2,0xBBA3,0xBBA5, +0xBBA6,0xBBA7,0xBBA9,0xBBAA,0xBBAB,0xBBAD,0xBBAE,0xBBAF, +0xBBB0,0xBBB1,0xBBB2,0xBBB3,0xBBB5,0xBBB6,0xBBB8,0xBBB9, +0xBBBA,0xBBBB,0xBBBC,0xBBBD,0xBBBE,0xBBBF,0xBBC1,0xBBC2, +0xBBC3,0xBBC5,0xBBC6,0xBBC7,0xBBC9,0xBBCA,0xBBCB,0xBBCC, +0xBBCD,0xBBCE,0xBBCF,0xBBD1,0xBBD2,0xBBD4,0xBBD5,0xBBD6, +0xBBD7,0xBBD8,0xBBD9,0xBBDA,0xBBDB,0xBBDC,0xBBDD,0xBBDE, +0xBBDF,0xBBE0,0xBBE1,0xBBE2,0xBBE3,0xBBE4,0xBBE5,0xBBE6, +0xBBE7,0xBBE8,0xBBE9,0xBBEA,0xBBEB,0xBBEC,0xBBED,0xBBEE, +0xBBEF,0xBBF0,0xBBF1,0xBBF2,0xBBF3,0xBBF4,0xBBF5,0xBBF6, +0xBBF7,0xBBFA,0xBBFB,0xBBFD,0xBBFE,0xBC01, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xBC03,0xBC04,0xBC05,0xBC06,0xBC07,0xBC0A,0xBC0E,0xBC10, +0xBC12,0xBC13,0xBC19,0xBC1A,0xBC20,0xBC21,0xBC22,0xBC23, +0xBC26,0xBC28,0xBC2A,0xBC2B,0xBC2C,0xBC2E,0xBC2F,0xBC32, +0xBC33,0xBC35, 0, 0, 0, 0, 0, 0, +0xBC36,0xBC37,0xBC39,0xBC3A,0xBC3B,0xBC3C,0xBC3D,0xBC3E, +0xBC3F,0xBC42,0xBC46,0xBC47,0xBC48,0xBC4A,0xBC4B,0xBC4E, +0xBC4F,0xBC51,0xBC52,0xBC53,0xBC54,0xBC55,0xBC56,0xBC57, +0xBC58,0xBC59, 0, 0, 0, 0, 0, 0, +0xBC5A,0xBC5B,0xBC5C,0xBC5E,0xBC5F,0xBC60,0xBC61,0xBC62, +0xBC63,0xBC64,0xBC65,0xBC66,0xBC67,0xBC68,0xBC69,0xBC6A, +0xBC6B,0xBC6C,0xBC6D,0xBC6E,0xBC6F,0xBC70,0xBC71,0xBC72, +0xBC73,0xBC74,0xBC75,0xBC76,0xBC77,0xBC78,0xBC79,0xBC7A, +0xBC7B,0xBC7C,0xBC7D,0xBC7E,0xBC7F,0xBC80,0xBC81,0xBC82, +0xBC83,0xBC86,0xBC87,0xBC89,0xBC8A,0xBC8D,0xBC8F,0xBC90, +0xBC91,0xBC92,0xBC93,0xBC96,0xBC98,0xBC9B,0xBC9C,0xBC9D, +0xBC9E,0xBC9F,0xBCA2,0xBCA3,0xBCA5,0xBCA6,0xBCA9,0xBCAA, +0xBCAB,0xBCAC,0xBCAD,0xBCAE,0xBCAF,0xBCB2,0xBCB6,0xBCB7, +0xBCB8,0xBCB9,0xBCBA,0xBCBB,0xBCBE,0xBCBF,0xBCC1,0xBCC2, +0xBCC3,0xBCC5,0xBCC6,0xBCC7,0xBCC8,0xBCC9,0xBCCA,0xBCCB, +0xBCCC,0xBCCE,0xBCD2,0xBCD3,0xBCD4,0xBCD6,0xBCD7,0xBCD9, +0xBCDA,0xBCDB,0xBCDD,0xBCDE,0xBCDF,0xBCE0,0xBCE1,0xBCE2, +0xBCE3,0xBCE4,0xBCE5,0xBCE6,0xBCE7,0xBCE8,0xBCE9,0xBCEA, +0xBCEB,0xBCEC,0xBCED,0xBCEE,0xBCEF,0xBCF0,0xBCF1,0xBCF2, +0xBCF3,0xBCF7,0xBCF9,0xBCFA,0xBCFB,0xBCFD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xBCFE,0xBCFF,0xBD00,0xBD01,0xBD02,0xBD03,0xBD06,0xBD08, +0xBD0A,0xBD0B,0xBD0C,0xBD0D,0xBD0E,0xBD0F,0xBD11,0xBD12, +0xBD13,0xBD15,0xBD16,0xBD17,0xBD18,0xBD19,0xBD1A,0xBD1B, +0xBD1C,0xBD1D, 0, 0, 0, 0, 0, 0, +0xBD1E,0xBD1F,0xBD20,0xBD21,0xBD22,0xBD23,0xBD25,0xBD26, +0xBD27,0xBD28,0xBD29,0xBD2A,0xBD2B,0xBD2D,0xBD2E,0xBD2F, +0xBD30,0xBD31,0xBD32,0xBD33,0xBD34,0xBD35,0xBD36,0xBD37, +0xBD38,0xBD39, 0, 0, 0, 0, 0, 0, +0xBD3A,0xBD3B,0xBD3C,0xBD3D,0xBD3E,0xBD3F,0xBD41,0xBD42, +0xBD43,0xBD44,0xBD45,0xBD46,0xBD47,0xBD4A,0xBD4B,0xBD4D, +0xBD4E,0xBD4F,0xBD51,0xBD52,0xBD53,0xBD54,0xBD55,0xBD56, +0xBD57,0xBD5A,0xBD5B,0xBD5C,0xBD5D,0xBD5E,0xBD5F,0xBD60, +0xBD61,0xBD62,0xBD63,0xBD65,0xBD66,0xBD67,0xBD69,0xBD6A, +0xBD6B,0xBD6C,0xBD6D,0xBD6E,0xBD6F,0xBD70,0xBD71,0xBD72, +0xBD73,0xBD74,0xBD75,0xBD76,0xBD77,0xBD78,0xBD79,0xBD7A, +0xBD7B,0xBD7C,0xBD7D,0xBD7E,0xBD7F,0xBD82,0xBD83,0xBD85, +0xBD86,0xBD8B,0xBD8C,0xBD8D,0xBD8E,0xBD8F,0xBD92,0xBD94, +0xBD96,0xBD97,0xBD98,0xBD9B,0xBD9D,0xBD9E,0xBD9F,0xBDA0, +0xBDA1,0xBDA2,0xBDA3,0xBDA5,0xBDA6,0xBDA7,0xBDA8,0xBDA9, +0xBDAA,0xBDAB,0xBDAC,0xBDAD,0xBDAE,0xBDAF,0xBDB1,0xBDB2, +0xBDB3,0xBDB4,0xBDB5,0xBDB6,0xBDB7,0xBDB9,0xBDBA,0xBDBB, +0xBDBC,0xBDBD,0xBDBE,0xBDBF,0xBDC0,0xBDC1,0xBDC2,0xBDC3, +0xBDC4,0xBDC5,0xBDC6,0xBDC7,0xBDC8,0xBDC9,0xBDCA,0xBDCB, +0xBDCC,0xBDCD,0xBDCE,0xBDCF,0xBDD0,0xBDD1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xBDD2,0xBDD3,0xBDD6,0xBDD7,0xBDD9,0xBDDA,0xBDDB,0xBDDD, +0xBDDE,0xBDDF,0xBDE0,0xBDE1,0xBDE2,0xBDE3,0xBDE4,0xBDE5, +0xBDE6,0xBDE7,0xBDE8,0xBDEA,0xBDEB,0xBDEC,0xBDED,0xBDEE, +0xBDEF,0xBDF1, 0, 0, 0, 0, 0, 0, +0xBDF2,0xBDF3,0xBDF5,0xBDF6,0xBDF7,0xBDF9,0xBDFA,0xBDFB, +0xBDFC,0xBDFD,0xBDFE,0xBDFF,0xBE01,0xBE02,0xBE04,0xBE06, +0xBE07,0xBE08,0xBE09,0xBE0A,0xBE0B,0xBE0E,0xBE0F,0xBE11, +0xBE12,0xBE13, 0, 0, 0, 0, 0, 0, +0xBE15,0xBE16,0xBE17,0xBE18,0xBE19,0xBE1A,0xBE1B,0xBE1E, +0xBE20,0xBE21,0xBE22,0xBE23,0xBE24,0xBE25,0xBE26,0xBE27, +0xBE28,0xBE29,0xBE2A,0xBE2B,0xBE2C,0xBE2D,0xBE2E,0xBE2F, +0xBE30,0xBE31,0xBE32,0xBE33,0xBE34,0xBE35,0xBE36,0xBE37, +0xBE38,0xBE39,0xBE3A,0xBE3B,0xBE3C,0xBE3D,0xBE3E,0xBE3F, +0xBE40,0xBE41,0xBE42,0xBE43,0xBE46,0xBE47,0xBE49,0xBE4A, +0xBE4B,0xBE4D,0xBE4F,0xBE50,0xBE51,0xBE52,0xBE53,0xBE56, +0xBE58,0xBE5C,0xBE5D,0xBE5E,0xBE5F,0xBE62,0xBE63,0xBE65, +0xBE66,0xBE67,0xBE69,0xBE6B,0xBE6C,0xBE6D,0xBE6E,0xBE6F, +0xBE72,0xBE76,0xBE77,0xBE78,0xBE79,0xBE7A,0xBE7E,0xBE7F, +0xBE81,0xBE82,0xBE83,0xBE85,0xBE86,0xBE87,0xBE88,0xBE89, +0xBE8A,0xBE8B,0xBE8E,0xBE92,0xBE93,0xBE94,0xBE95,0xBE96, +0xBE97,0xBE9A,0xBE9B,0xBE9C,0xBE9D,0xBE9E,0xBE9F,0xBEA0, +0xBEA1,0xBEA2,0xBEA3,0xBEA4,0xBEA5,0xBEA6,0xBEA7,0xBEA9, +0xBEAA,0xBEAB,0xBEAC,0xBEAD,0xBEAE,0xBEAF,0xBEB0,0xBEB1, +0xBEB2,0xBEB3,0xBEB4,0xBEB5,0xBEB6,0xBEB7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xBEB8,0xBEB9,0xBEBA,0xBEBB,0xBEBC,0xBEBD,0xBEBE,0xBEBF, +0xBEC0,0xBEC1,0xBEC2,0xBEC3,0xBEC4,0xBEC5,0xBEC6,0xBEC7, +0xBEC8,0xBEC9,0xBECA,0xBECB,0xBECC,0xBECD,0xBECE,0xBECF, +0xBED2,0xBED3, 0, 0, 0, 0, 0, 0, +0xBED5,0xBED6,0xBED9,0xBEDA,0xBEDB,0xBEDC,0xBEDD,0xBEDE, +0xBEDF,0xBEE1,0xBEE2,0xBEE6,0xBEE7,0xBEE8,0xBEE9,0xBEEA, +0xBEEB,0xBEED,0xBEEE,0xBEEF,0xBEF0,0xBEF1,0xBEF2,0xBEF3, +0xBEF4,0xBEF5, 0, 0, 0, 0, 0, 0, +0xBEF6,0xBEF7,0xBEF8,0xBEF9,0xBEFA,0xBEFB,0xBEFC,0xBEFD, +0xBEFE,0xBEFF,0xBF00,0xBF02,0xBF03,0xBF04,0xBF05,0xBF06, +0xBF07,0xBF0A,0xBF0B,0xBF0C,0xBF0D,0xBF0E,0xBF0F,0xBF10, +0xBF11,0xBF12,0xBF13,0xBF14,0xBF15,0xBF16,0xBF17,0xBF1A, +0xBF1E,0xBF1F,0xBF20,0xBF21,0xBF22,0xBF23,0xBF24,0xBF25, +0xBF26,0xBF27,0xBF28,0xBF29,0xBF2A,0xBF2B,0xBF2C,0xBF2D, +0xBF2E,0xBF2F,0xBF30,0xBF31,0xBF32,0xBF33,0xBF34,0xBF35, +0xBF36,0xBF37,0xBF38,0xBF39,0xBF3A,0xBF3B,0xBF3C,0xBF3D, +0xBF3E,0xBF3F,0xBF42,0xBF43,0xBF45,0xBF46,0xBF47,0xBF49, +0xBF4A,0xBF4B,0xBF4C,0xBF4D,0xBF4E,0xBF4F,0xBF52,0xBF53, +0xBF54,0xBF56,0xBF57,0xBF58,0xBF59,0xBF5A,0xBF5B,0xBF5C, +0xBF5D,0xBF5E,0xBF5F,0xBF60,0xBF61,0xBF62,0xBF63,0xBF64, +0xBF65,0xBF66,0xBF67,0xBF68,0xBF69,0xBF6A,0xBF6B,0xBF6C, +0xBF6D,0xBF6E,0xBF6F,0xBF70,0xBF71,0xBF72,0xBF73,0xBF74, +0xBF75,0xBF76,0xBF77,0xBF78,0xBF79,0xBF7A,0xBF7B,0xBF7C, +0xBF7D,0xBF7E,0xBF7F,0xBF80,0xBF81,0xBF82, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xBF83,0xBF84,0xBF85,0xBF86,0xBF87,0xBF88,0xBF89,0xBF8A, +0xBF8B,0xBF8C,0xBF8D,0xBF8E,0xBF8F,0xBF90,0xBF91,0xBF92, +0xBF93,0xBF95,0xBF96,0xBF97,0xBF98,0xBF99,0xBF9A,0xBF9B, +0xBF9C,0xBF9D, 0, 0, 0, 0, 0, 0, +0xBF9E,0xBF9F,0xBFA0,0xBFA1,0xBFA2,0xBFA3,0xBFA4,0xBFA5, +0xBFA6,0xBFA7,0xBFA8,0xBFA9,0xBFAA,0xBFAB,0xBFAC,0xBFAD, +0xBFAE,0xBFAF,0xBFB1,0xBFB2,0xBFB3,0xBFB4,0xBFB5,0xBFB6, +0xBFB7,0xBFB8, 0, 0, 0, 0, 0, 0, +0xBFB9,0xBFBA,0xBFBB,0xBFBC,0xBFBD,0xBFBE,0xBFBF,0xBFC0, +0xBFC1,0xBFC2,0xBFC3,0xBFC4,0xBFC6,0xBFC7,0xBFC8,0xBFC9, +0xBFCA,0xBFCB,0xBFCE,0xBFCF,0xBFD1,0xBFD2,0xBFD3,0xBFD5, +0xBFD6,0xBFD7,0xBFD8,0xBFD9,0xBFDA,0xBFDB,0xBFDD,0xBFDE, +0xBFE0,0xBFE2,0xBFE3,0xBFE4,0xBFE5,0xBFE6,0xBFE7,0xBFE8, +0xBFE9,0xBFEA,0xBFEB,0xBFEC,0xBFED,0xBFEE,0xBFEF,0xBFF0, +0xBFF1,0xBFF2,0xBFF3,0xBFF4,0xBFF5,0xBFF6,0xBFF7,0xBFF8, +0xBFF9,0xBFFA,0xBFFB,0xBFFC,0xBFFD,0xBFFE,0xBFFF,0xC000, +0xC001,0xC002,0xC003,0xC004,0xC005,0xC006,0xC007,0xC008, +0xC009,0xC00A,0xC00B,0xC00C,0xC00D,0xC00E,0xC00F,0xC010, +0xC011,0xC012,0xC013,0xC014,0xC015,0xC016,0xC017,0xC018, +0xC019,0xC01A,0xC01B,0xC01C,0xC01D,0xC01E,0xC01F,0xC020, +0xC021,0xC022,0xC023,0xC024,0xC025,0xC026,0xC027,0xC028, +0xC029,0xC02A,0xC02B,0xC02C,0xC02D,0xC02E,0xC02F,0xC030, +0xC031,0xC032,0xC033,0xC034,0xC035,0xC036,0xC037,0xC038, +0xC039,0xC03A,0xC03B,0xC03D,0xC03E,0xC03F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC040,0xC041,0xC042,0xC043,0xC044,0xC045,0xC046,0xC047, +0xC048,0xC049,0xC04A,0xC04B,0xC04C,0xC04D,0xC04E,0xC04F, +0xC050,0xC052,0xC053,0xC054,0xC055,0xC056,0xC057,0xC059, +0xC05A,0xC05B, 0, 0, 0, 0, 0, 0, +0xC05D,0xC05E,0xC05F,0xC061,0xC062,0xC063,0xC064,0xC065, +0xC066,0xC067,0xC06A,0xC06B,0xC06C,0xC06D,0xC06E,0xC06F, +0xC070,0xC071,0xC072,0xC073,0xC074,0xC075,0xC076,0xC077, +0xC078,0xC079, 0, 0, 0, 0, 0, 0, +0xC07A,0xC07B,0xC07C,0xC07D,0xC07E,0xC07F,0xC080,0xC081, +0xC082,0xC083,0xC084,0xC085,0xC086,0xC087,0xC088,0xC089, +0xC08A,0xC08B,0xC08C,0xC08D,0xC08E,0xC08F,0xC092,0xC093, +0xC095,0xC096,0xC097,0xC099,0xC09A,0xC09B,0xC09C,0xC09D, +0xC09E,0xC09F,0xC0A2,0xC0A4,0xC0A6,0xC0A7,0xC0A8,0xC0A9, +0xC0AA,0xC0AB,0xC0AE,0xC0B1,0xC0B2,0xC0B7,0xC0B8,0xC0B9, +0xC0BA,0xC0BB,0xC0BE,0xC0C2,0xC0C3,0xC0C4,0xC0C6,0xC0C7, +0xC0CA,0xC0CB,0xC0CD,0xC0CE,0xC0CF,0xC0D1,0xC0D2,0xC0D3, +0xC0D4,0xC0D5,0xC0D6,0xC0D7,0xC0DA,0xC0DE,0xC0DF,0xC0E0, +0xC0E1,0xC0E2,0xC0E3,0xC0E6,0xC0E7,0xC0E9,0xC0EA,0xC0EB, +0xC0ED,0xC0EE,0xC0EF,0xC0F0,0xC0F1,0xC0F2,0xC0F3,0xC0F6, +0xC0F8,0xC0FA,0xC0FB,0xC0FC,0xC0FD,0xC0FE,0xC0FF,0xC101, +0xC102,0xC103,0xC105,0xC106,0xC107,0xC109,0xC10A,0xC10B, +0xC10C,0xC10D,0xC10E,0xC10F,0xC111,0xC112,0xC113,0xC114, +0xC116,0xC117,0xC118,0xC119,0xC11A,0xC11B,0xC121,0xC122, +0xC125,0xC128,0xC129,0xC12A,0xC12B,0xC12E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC132,0xC133,0xC134,0xC135,0xC137,0xC13A,0xC13B,0xC13D, +0xC13E,0xC13F,0xC141,0xC142,0xC143,0xC144,0xC145,0xC146, +0xC147,0xC14A,0xC14E,0xC14F,0xC150,0xC151,0xC152,0xC153, +0xC156,0xC157, 0, 0, 0, 0, 0, 0, +0xC159,0xC15A,0xC15B,0xC15D,0xC15E,0xC15F,0xC160,0xC161, +0xC162,0xC163,0xC166,0xC16A,0xC16B,0xC16C,0xC16D,0xC16E, +0xC16F,0xC171,0xC172,0xC173,0xC175,0xC176,0xC177,0xC179, +0xC17A,0xC17B, 0, 0, 0, 0, 0, 0, +0xC17C,0xC17D,0xC17E,0xC17F,0xC180,0xC181,0xC182,0xC183, +0xC184,0xC186,0xC187,0xC188,0xC189,0xC18A,0xC18B,0xC18F, +0xC191,0xC192,0xC193,0xC195,0xC197,0xC198,0xC199,0xC19A, +0xC19B,0xC19E,0xC1A0,0xC1A2,0xC1A3,0xC1A4,0xC1A6,0xC1A7, +0xC1AA,0xC1AB,0xC1AD,0xC1AE,0xC1AF,0xC1B1,0xC1B2,0xC1B3, +0xC1B4,0xC1B5,0xC1B6,0xC1B7,0xC1B8,0xC1B9,0xC1BA,0xC1BB, +0xC1BC,0xC1BE,0xC1BF,0xC1C0,0xC1C1,0xC1C2,0xC1C3,0xC1C5, +0xC1C6,0xC1C7,0xC1C9,0xC1CA,0xC1CB,0xC1CD,0xC1CE,0xC1CF, +0xC1D0,0xC1D1,0xC1D2,0xC1D3,0xC1D5,0xC1D6,0xC1D9,0xC1DA, +0xC1DB,0xC1DC,0xC1DD,0xC1DE,0xC1DF,0xC1E1,0xC1E2,0xC1E3, +0xC1E5,0xC1E6,0xC1E7,0xC1E9,0xC1EA,0xC1EB,0xC1EC,0xC1ED, +0xC1EE,0xC1EF,0xC1F2,0xC1F4,0xC1F5,0xC1F6,0xC1F7,0xC1F8, +0xC1F9,0xC1FA,0xC1FB,0xC1FE,0xC1FF,0xC201,0xC202,0xC203, +0xC205,0xC206,0xC207,0xC208,0xC209,0xC20A,0xC20B,0xC20E, +0xC210,0xC212,0xC213,0xC214,0xC215,0xC216,0xC217,0xC21A, +0xC21B,0xC21D,0xC21E,0xC221,0xC222,0xC223, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC224,0xC225,0xC226,0xC227,0xC22A,0xC22C,0xC22E,0xC230, +0xC233,0xC235,0xC236,0xC237,0xC238,0xC239,0xC23A,0xC23B, +0xC23C,0xC23D,0xC23E,0xC23F,0xC240,0xC241,0xC242,0xC243, +0xC244,0xC245, 0, 0, 0, 0, 0, 0, +0xC246,0xC247,0xC249,0xC24A,0xC24B,0xC24C,0xC24D,0xC24E, +0xC24F,0xC252,0xC253,0xC255,0xC256,0xC257,0xC259,0xC25A, +0xC25B,0xC25C,0xC25D,0xC25E,0xC25F,0xC261,0xC262,0xC263, +0xC264,0xC266, 0, 0, 0, 0, 0, 0, +0xC267,0xC268,0xC269,0xC26A,0xC26B,0xC26E,0xC26F,0xC271, +0xC272,0xC273,0xC275,0xC276,0xC277,0xC278,0xC279,0xC27A, +0xC27B,0xC27E,0xC280,0xC282,0xC283,0xC284,0xC285,0xC286, +0xC287,0xC28A,0xC28B,0xC28C,0xC28D,0xC28E,0xC28F,0xC291, +0xC292,0xC293,0xC294,0xC295,0xC296,0xC297,0xC299,0xC29A, +0xC29C,0xC29E,0xC29F,0xC2A0,0xC2A1,0xC2A2,0xC2A3,0xC2A6, +0xC2A7,0xC2A9,0xC2AA,0xC2AB,0xC2AE,0xC2AF,0xC2B0,0xC2B1, +0xC2B2,0xC2B3,0xC2B6,0xC2B8,0xC2BA,0xC2BB,0xC2BC,0xC2BD, +0xC2BE,0xC2BF,0xC2C0,0xC2C1,0xC2C2,0xC2C3,0xC2C4,0xC2C5, +0xC2C6,0xC2C7,0xC2C8,0xC2C9,0xC2CA,0xC2CB,0xC2CC,0xC2CD, +0xC2CE,0xC2CF,0xC2D0,0xC2D1,0xC2D2,0xC2D3,0xC2D4,0xC2D5, +0xC2D6,0xC2D7,0xC2D8,0xC2D9,0xC2DA,0xC2DB,0xC2DE,0xC2DF, +0xC2E1,0xC2E2,0xC2E5,0xC2E6,0xC2E7,0xC2E8,0xC2E9,0xC2EA, +0xC2EE,0xC2F0,0xC2F2,0xC2F3,0xC2F4,0xC2F5,0xC2F7,0xC2FA, +0xC2FD,0xC2FE,0xC2FF,0xC301,0xC302,0xC303,0xC304,0xC305, +0xC306,0xC307,0xC30A,0xC30B,0xC30E,0xC30F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC310,0xC311,0xC312,0xC316,0xC317,0xC319,0xC31A,0xC31B, +0xC31D,0xC31E,0xC31F,0xC320,0xC321,0xC322,0xC323,0xC326, +0xC327,0xC32A,0xC32B,0xC32C,0xC32D,0xC32E,0xC32F,0xC330, +0xC331,0xC332, 0, 0, 0, 0, 0, 0, +0xC333,0xC334,0xC335,0xC336,0xC337,0xC338,0xC339,0xC33A, +0xC33B,0xC33C,0xC33D,0xC33E,0xC33F,0xC340,0xC341,0xC342, +0xC343,0xC344,0xC346,0xC347,0xC348,0xC349,0xC34A,0xC34B, +0xC34C,0xC34D, 0, 0, 0, 0, 0, 0, +0xC34E,0xC34F,0xC350,0xC351,0xC352,0xC353,0xC354,0xC355, +0xC356,0xC357,0xC358,0xC359,0xC35A,0xC35B,0xC35C,0xC35D, +0xC35E,0xC35F,0xC360,0xC361,0xC362,0xC363,0xC364,0xC365, +0xC366,0xC367,0xC36A,0xC36B,0xC36D,0xC36E,0xC36F,0xC371, +0xC373,0xC374,0xC375,0xC376,0xC377,0xC37A,0xC37B,0xC37E, +0xC37F,0xC380,0xC381,0xC382,0xC383,0xC385,0xC386,0xC387, +0xC389,0xC38A,0xC38B,0xC38D,0xC38E,0xC38F,0xC390,0xC391, +0xC392,0xC393,0xC394,0xC395,0xC396,0xC397,0xC398,0xC399, +0xC39A,0xC39B,0xC39C,0xC39D,0xC39E,0xC39F,0xC3A0,0xC3A1, +0xC3A2,0xC3A3,0xC3A4,0xC3A5,0xC3A6,0xC3A7,0xC3A8,0xC3A9, +0xC3AA,0xC3AB,0xC3AC,0xC3AD,0xC3AE,0xC3AF,0xC3B0,0xC3B1, +0xC3B2,0xC3B3,0xC3B4,0xC3B5,0xC3B6,0xC3B7,0xC3B8,0xC3B9, +0xC3BA,0xC3BB,0xC3BC,0xC3BD,0xC3BE,0xC3BF,0xC3C1,0xC3C2, +0xC3C3,0xC3C4,0xC3C5,0xC3C6,0xC3C7,0xC3C8,0xC3C9,0xC3CA, +0xC3CB,0xC3CC,0xC3CD,0xC3CE,0xC3CF,0xC3D0,0xC3D1,0xC3D2, +0xC3D3,0xC3D4,0xC3D5,0xC3D6,0xC3D7,0xC3DA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC3DB,0xC3DD,0xC3DE,0xC3E1,0xC3E3,0xC3E4,0xC3E5,0xC3E6, +0xC3E7,0xC3EA,0xC3EB,0xC3EC,0xC3EE,0xC3EF,0xC3F0,0xC3F1, +0xC3F2,0xC3F3,0xC3F6,0xC3F7,0xC3F9,0xC3FA,0xC3FB,0xC3FC, +0xC3FD,0xC3FE, 0, 0, 0, 0, 0, 0, +0xC3FF,0xC400,0xC401,0xC402,0xC403,0xC404,0xC405,0xC406, +0xC407,0xC409,0xC40A,0xC40B,0xC40C,0xC40D,0xC40E,0xC40F, +0xC411,0xC412,0xC413,0xC414,0xC415,0xC416,0xC417,0xC418, +0xC419,0xC41A, 0, 0, 0, 0, 0, 0, +0xC41B,0xC41C,0xC41D,0xC41E,0xC41F,0xC420,0xC421,0xC422, +0xC423,0xC425,0xC426,0xC427,0xC428,0xC429,0xC42A,0xC42B, +0xC42D,0xC42E,0xC42F,0xC431,0xC432,0xC433,0xC435,0xC436, +0xC437,0xC438,0xC439,0xC43A,0xC43B,0xC43E,0xC43F,0xC440, +0xC441,0xC442,0xC443,0xC444,0xC445,0xC446,0xC447,0xC449, +0xC44A,0xC44B,0xC44C,0xC44D,0xC44E,0xC44F,0xC450,0xC451, +0xC452,0xC453,0xC454,0xC455,0xC456,0xC457,0xC458,0xC459, +0xC45A,0xC45B,0xC45C,0xC45D,0xC45E,0xC45F,0xC460,0xC461, +0xC462,0xC463,0xC466,0xC467,0xC469,0xC46A,0xC46B,0xC46D, +0xC46E,0xC46F,0xC470,0xC471,0xC472,0xC473,0xC476,0xC477, +0xC478,0xC47A,0xC47B,0xC47C,0xC47D,0xC47E,0xC47F,0xC481, +0xC482,0xC483,0xC484,0xC485,0xC486,0xC487,0xC488,0xC489, +0xC48A,0xC48B,0xC48C,0xC48D,0xC48E,0xC48F,0xC490,0xC491, +0xC492,0xC493,0xC495,0xC496,0xC497,0xC498,0xC499,0xC49A, +0xC49B,0xC49D,0xC49E,0xC49F,0xC4A0,0xC4A1,0xC4A2,0xC4A3, +0xC4A4,0xC4A5,0xC4A6,0xC4A7,0xC4A8,0xC4A9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC4AA,0xC4AB,0xC4AC,0xC4AD,0xC4AE,0xC4AF,0xC4B0,0xC4B1, +0xC4B2,0xC4B3,0xC4B4,0xC4B5,0xC4B6,0xC4B7,0xC4B9,0xC4BA, +0xC4BB,0xC4BD,0xC4BE,0xC4BF,0xC4C0,0xC4C1,0xC4C2,0xC4C3, +0xC4C4,0xC4C5, 0, 0, 0, 0, 0, 0, +0xC4C6,0xC4C7,0xC4C8,0xC4C9,0xC4CA,0xC4CB,0xC4CC,0xC4CD, +0xC4CE,0xC4CF,0xC4D0,0xC4D1,0xC4D2,0xC4D3,0xC4D4,0xC4D5, +0xC4D6,0xC4D7,0xC4D8,0xC4D9,0xC4DA,0xC4DB,0xC4DC,0xC4DD, +0xC4DE,0xC4DF, 0, 0, 0, 0, 0, 0, +0xC4E0,0xC4E1,0xC4E2,0xC4E3,0xC4E4,0xC4E5,0xC4E6,0xC4E7, +0xC4E8,0xC4EA,0xC4EB,0xC4EC,0xC4ED,0xC4EE,0xC4EF,0xC4F2, +0xC4F3,0xC4F5,0xC4F6,0xC4F7,0xC4F9,0xC4FB,0xC4FC,0xC4FD, +0xC4FE,0xC502,0xC503,0xC504,0xC505,0xC506,0xC507,0xC508, +0xC509,0xC50A,0xC50B,0xC50D,0xC50E,0xC50F,0xC511,0xC512, +0xC513,0xC515,0xC516,0xC517,0xC518,0xC519,0xC51A,0xC51B, +0xC51D,0xC51E,0xC51F,0xC520,0xC521,0xC522,0xC523,0xC524, +0xC525,0xC526,0xC527,0xC52A,0xC52B,0xC52D,0xC52E,0xC52F, +0xC531,0xC532,0xC533,0xC534,0xC535,0xC536,0xC537,0xC53A, +0xC53C,0xC53E,0xC53F,0xC540,0xC541,0xC542,0xC543,0xC546, +0xC547,0xC54B,0xC54F,0xC550,0xC551,0xC552,0xC556,0xC55A, +0xC55B,0xC55C,0xC55F,0xC562,0xC563,0xC565,0xC566,0xC567, +0xC569,0xC56A,0xC56B,0xC56C,0xC56D,0xC56E,0xC56F,0xC572, +0xC576,0xC577,0xC578,0xC579,0xC57A,0xC57B,0xC57E,0xC57F, +0xC581,0xC582,0xC583,0xC585,0xC586,0xC588,0xC589,0xC58A, +0xC58B,0xC58E,0xC590,0xC592,0xC593,0xC594, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC596,0xC599,0xC59A,0xC59B,0xC59D,0xC59E,0xC59F,0xC5A1, +0xC5A2,0xC5A3,0xC5A4,0xC5A5,0xC5A6,0xC5A7,0xC5A8,0xC5AA, +0xC5AB,0xC5AC,0xC5AD,0xC5AE,0xC5AF,0xC5B0,0xC5B1,0xC5B2, +0xC5B3,0xC5B6, 0, 0, 0, 0, 0, 0, +0xC5B7,0xC5BA,0xC5BF,0xC5C0,0xC5C1,0xC5C2,0xC5C3,0xC5CB, +0xC5CD,0xC5CF,0xC5D2,0xC5D3,0xC5D5,0xC5D6,0xC5D7,0xC5D9, +0xC5DA,0xC5DB,0xC5DC,0xC5DD,0xC5DE,0xC5DF,0xC5E2,0xC5E4, +0xC5E6,0xC5E7, 0, 0, 0, 0, 0, 0, +0xC5E8,0xC5E9,0xC5EA,0xC5EB,0xC5EF,0xC5F1,0xC5F2,0xC5F3, +0xC5F5,0xC5F8,0xC5F9,0xC5FA,0xC5FB,0xC602,0xC603,0xC604, +0xC609,0xC60A,0xC60B,0xC60D,0xC60E,0xC60F,0xC611,0xC612, +0xC613,0xC614,0xC615,0xC616,0xC617,0xC61A,0xC61D,0xC61E, +0xC61F,0xC620,0xC621,0xC622,0xC623,0xC626,0xC627,0xC629, +0xC62A,0xC62B,0xC62F,0xC631,0xC632,0xC636,0xC638,0xC63A, +0xC63C,0xC63D,0xC63E,0xC63F,0xC642,0xC643,0xC645,0xC646, +0xC647,0xC649,0xC64A,0xC64B,0xC64C,0xC64D,0xC64E,0xC64F, +0xC652,0xC656,0xC657,0xC658,0xC659,0xC65A,0xC65B,0xC65E, +0xC65F,0xC661,0xC662,0xC663,0xC664,0xC665,0xC666,0xC667, +0xC668,0xC669,0xC66A,0xC66B,0xC66D,0xC66E,0xC670,0xC672, +0xC673,0xC674,0xC675,0xC676,0xC677,0xC67A,0xC67B,0xC67D, +0xC67E,0xC67F,0xC681,0xC682,0xC683,0xC684,0xC685,0xC686, +0xC687,0xC68A,0xC68C,0xC68E,0xC68F,0xC690,0xC691,0xC692, +0xC693,0xC696,0xC697,0xC699,0xC69A,0xC69B,0xC69D,0xC69E, +0xC69F,0xC6A0,0xC6A1,0xC6A2,0xC6A3,0xC6A6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC6A8,0xC6AA,0xC6AB,0xC6AC,0xC6AD,0xC6AE,0xC6AF,0xC6B2, +0xC6B3,0xC6B5,0xC6B6,0xC6B7,0xC6BB,0xC6BC,0xC6BD,0xC6BE, +0xC6BF,0xC6C2,0xC6C4,0xC6C6,0xC6C7,0xC6C8,0xC6C9,0xC6CA, +0xC6CB,0xC6CE, 0, 0, 0, 0, 0, 0, +0xC6CF,0xC6D1,0xC6D2,0xC6D3,0xC6D5,0xC6D6,0xC6D7,0xC6D8, +0xC6D9,0xC6DA,0xC6DB,0xC6DE,0xC6DF,0xC6E2,0xC6E3,0xC6E4, +0xC6E5,0xC6E6,0xC6E7,0xC6EA,0xC6EB,0xC6ED,0xC6EE,0xC6EF, +0xC6F1,0xC6F2, 0, 0, 0, 0, 0, 0, +0xC6F3,0xC6F4,0xC6F5,0xC6F6,0xC6F7,0xC6FA,0xC6FB,0xC6FC, +0xC6FE,0xC6FF,0xC700,0xC701,0xC702,0xC703,0xC706,0xC707, +0xC709,0xC70A,0xC70B,0xC70D,0xC70E,0xC70F,0xC710,0xC711, +0xC712,0xC713,0xC716,0xC718,0xC71A,0xC71B,0xC71C,0xC71D, +0xC71E,0xC71F,0xC722,0xC723,0xC725,0xC726,0xC727,0xC729, +0xC72A,0xC72B,0xC72C,0xC72D,0xC72E,0xC72F,0xC732,0xC734, +0xC736,0xC738,0xC739,0xC73A,0xC73B,0xC73E,0xC73F,0xC741, +0xC742,0xC743,0xC745,0xC746,0xC747,0xC748,0xC749,0xC74B, +0xC74E,0xC750,0xC759,0xC75A,0xC75B,0xC75D,0xC75E,0xC75F, +0xC761,0xC762,0xC763,0xC764,0xC765,0xC766,0xC767,0xC769, +0xC76A,0xC76C,0xC76D,0xC76E,0xC76F,0xC770,0xC771,0xC772, +0xC773,0xC776,0xC777,0xC779,0xC77A,0xC77B,0xC77F,0xC780, +0xC781,0xC782,0xC786,0xC78B,0xC78C,0xC78D,0xC78F,0xC792, +0xC793,0xC795,0xC799,0xC79B,0xC79C,0xC79D,0xC79E,0xC79F, +0xC7A2,0xC7A7,0xC7A8,0xC7A9,0xC7AA,0xC7AB,0xC7AE,0xC7AF, +0xC7B1,0xC7B2,0xC7B3,0xC7B5,0xC7B6,0xC7B7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC7B8,0xC7B9,0xC7BA,0xC7BB,0xC7BE,0xC7C2,0xC7C3,0xC7C4, +0xC7C5,0xC7C6,0xC7C7,0xC7CA,0xC7CB,0xC7CD,0xC7CF,0xC7D1, +0xC7D2,0xC7D3,0xC7D4,0xC7D5,0xC7D6,0xC7D7,0xC7D9,0xC7DA, +0xC7DB,0xC7DC, 0, 0, 0, 0, 0, 0, +0xC7DE,0xC7DF,0xC7E0,0xC7E1,0xC7E2,0xC7E3,0xC7E5,0xC7E6, +0xC7E7,0xC7E9,0xC7EA,0xC7EB,0xC7ED,0xC7EE,0xC7EF,0xC7F0, +0xC7F1,0xC7F2,0xC7F3,0xC7F4,0xC7F5,0xC7F6,0xC7F7,0xC7F8, +0xC7F9,0xC7FA, 0, 0, 0, 0, 0, 0, +0xC7FB,0xC7FC,0xC7FD,0xC7FE,0xC7FF,0xC802,0xC803,0xC805, +0xC806,0xC807,0xC809,0xC80B,0xC80C,0xC80D,0xC80E,0xC80F, +0xC812,0xC814,0xC817,0xC818,0xC819,0xC81A,0xC81B,0xC81E, +0xC81F,0xC821,0xC822,0xC823,0xC825,0xC826,0xC827,0xC828, +0xC829,0xC82A,0xC82B,0xC82E,0xC830,0xC832,0xC833,0xC834, +0xC835,0xC836,0xC837,0xC839,0xC83A,0xC83B,0xC83D,0xC83E, +0xC83F,0xC841,0xC842,0xC843,0xC844,0xC845,0xC846,0xC847, +0xC84A,0xC84B,0xC84E,0xC84F,0xC850,0xC851,0xC852,0xC853, +0xC855,0xC856,0xC857,0xC858,0xC859,0xC85A,0xC85B,0xC85C, +0xC85D,0xC85E,0xC85F,0xC860,0xC861,0xC862,0xC863,0xC864, +0xC865,0xC866,0xC867,0xC868,0xC869,0xC86A,0xC86B,0xC86C, +0xC86D,0xC86E,0xC86F,0xC872,0xC873,0xC875,0xC876,0xC877, +0xC879,0xC87B,0xC87C,0xC87D,0xC87E,0xC87F,0xC882,0xC884, +0xC888,0xC889,0xC88A,0xC88E,0xC88F,0xC890,0xC891,0xC892, +0xC893,0xC895,0xC896,0xC897,0xC898,0xC899,0xC89A,0xC89B, +0xC89C,0xC89E,0xC8A0,0xC8A2,0xC8A3,0xC8A4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC8A5,0xC8A6,0xC8A7,0xC8A9,0xC8AA,0xC8AB,0xC8AC,0xC8AD, +0xC8AE,0xC8AF,0xC8B0,0xC8B1,0xC8B2,0xC8B3,0xC8B4,0xC8B5, +0xC8B6,0xC8B7,0xC8B8,0xC8B9,0xC8BA,0xC8BB,0xC8BE,0xC8BF, +0xC8C0,0xC8C1, 0, 0, 0, 0, 0, 0, +0xC8C2,0xC8C3,0xC8C5,0xC8C6,0xC8C7,0xC8C9,0xC8CA,0xC8CB, +0xC8CD,0xC8CE,0xC8CF,0xC8D0,0xC8D1,0xC8D2,0xC8D3,0xC8D6, +0xC8D8,0xC8DA,0xC8DB,0xC8DC,0xC8DD,0xC8DE,0xC8DF,0xC8E2, +0xC8E3,0xC8E5, 0, 0, 0, 0, 0, 0, +0xC8E6,0xC8E7,0xC8E8,0xC8E9,0xC8EA,0xC8EB,0xC8EC,0xC8ED, +0xC8EE,0xC8EF,0xC8F0,0xC8F1,0xC8F2,0xC8F3,0xC8F4,0xC8F6, +0xC8F7,0xC8F8,0xC8F9,0xC8FA,0xC8FB,0xC8FE,0xC8FF,0xC901, +0xC902,0xC903,0xC907,0xC908,0xC909,0xC90A,0xC90B,0xC90E, +0x3000,0x3001,0x3002,0x00B7,0x2025,0x2026,0x00A8,0x3003, +0x00AD,0x2015,0x2225,0xFF3C,0x223C,0x2018,0x2019,0x201C, +0x201D,0x3014,0x3015,0x3008,0x3009,0x300A,0x300B,0x300C, +0x300D,0x300E,0x300F,0x3010,0x3011,0x00B1,0x00D7,0x00F7, +0x2260,0x2264,0x2265,0x221E,0x2234,0x00B0,0x2032,0x2033, +0x2103,0x212B,0xFFE0,0xFFE1,0xFFE5,0x2642,0x2640,0x2220, +0x22A5,0x2312,0x2202,0x2207,0x2261,0x2252,0x00A7,0x203B, +0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,0x25C6,0x25A1, +0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x2192,0x2190,0x2191, +0x2193,0x2194,0x3013,0x226A,0x226B,0x221A,0x223D,0x221D, +0x2235,0x222B,0x222C,0x2208,0x220B,0x2286,0x2287,0x2282, +0x2283,0x222A,0x2229,0x2227,0x2228,0xFFE2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC910,0xC912,0xC913,0xC914,0xC915,0xC916,0xC917,0xC919, +0xC91A,0xC91B,0xC91C,0xC91D,0xC91E,0xC91F,0xC920,0xC921, +0xC922,0xC923,0xC924,0xC925,0xC926,0xC927,0xC928,0xC929, +0xC92A,0xC92B, 0, 0, 0, 0, 0, 0, +0xC92D,0xC92E,0xC92F,0xC930,0xC931,0xC932,0xC933,0xC935, +0xC936,0xC937,0xC938,0xC939,0xC93A,0xC93B,0xC93C,0xC93D, +0xC93E,0xC93F,0xC940,0xC941,0xC942,0xC943,0xC944,0xC945, +0xC946,0xC947, 0, 0, 0, 0, 0, 0, +0xC948,0xC949,0xC94A,0xC94B,0xC94C,0xC94D,0xC94E,0xC94F, +0xC952,0xC953,0xC955,0xC956,0xC957,0xC959,0xC95A,0xC95B, +0xC95C,0xC95D,0xC95E,0xC95F,0xC962,0xC964,0xC965,0xC966, +0xC967,0xC968,0xC969,0xC96A,0xC96B,0xC96D,0xC96E,0xC96F, +0x21D2,0x21D4,0x2200,0x2203,0x00B4,0xFF5E,0x02C7,0x02D8, +0x02DD,0x02DA,0x02D9,0x00B8,0x02DB,0x00A1,0x00BF,0x02D0, +0x222E,0x2211,0x220F,0x00A4,0x2109,0x2030,0x25C1,0x25C0, +0x25B7,0x25B6,0x2664,0x2660,0x2661,0x2665,0x2667,0x2663, +0x2299,0x25C8,0x25A3,0x25D0,0x25D1,0x2592,0x25A4,0x25A5, +0x25A8,0x25A7,0x25A6,0x25A9,0x2668,0x260F,0x260E,0x261C, +0x261E,0x00B6,0x2020,0x2021,0x2195,0x2197,0x2199,0x2196, +0x2198,0x266D,0x2669,0x266A,0x266C,0x327F,0x321C,0x2116, +0x33C7,0x2122,0x33C2,0x33D8,0x2121, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC971,0xC972,0xC973,0xC975,0xC976,0xC977,0xC978,0xC979, +0xC97A,0xC97B,0xC97D,0xC97E,0xC97F,0xC980,0xC981,0xC982, +0xC983,0xC984,0xC985,0xC986,0xC987,0xC98A,0xC98B,0xC98D, +0xC98E,0xC98F, 0, 0, 0, 0, 0, 0, +0xC991,0xC992,0xC993,0xC994,0xC995,0xC996,0xC997,0xC99A, +0xC99C,0xC99E,0xC99F,0xC9A0,0xC9A1,0xC9A2,0xC9A3,0xC9A4, +0xC9A5,0xC9A6,0xC9A7,0xC9A8,0xC9A9,0xC9AA,0xC9AB,0xC9AC, +0xC9AD,0xC9AE, 0, 0, 0, 0, 0, 0, +0xC9AF,0xC9B0,0xC9B1,0xC9B2,0xC9B3,0xC9B4,0xC9B5,0xC9B6, +0xC9B7,0xC9B8,0xC9B9,0xC9BA,0xC9BB,0xC9BC,0xC9BD,0xC9BE, +0xC9BF,0xC9C2,0xC9C3,0xC9C5,0xC9C6,0xC9C9,0xC9CB,0xC9CC, +0xC9CD,0xC9CE,0xC9CF,0xC9D2,0xC9D4,0xC9D7,0xC9D8,0xC9DB, +0xFF01,0xFF02,0xFF03,0xFF04,0xFF05,0xFF06,0xFF07,0xFF08, +0xFF09,0xFF0A,0xFF0B,0xFF0C,0xFF0D,0xFF0E,0xFF0F,0xFF10, +0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17,0xFF18, +0xFF19,0xFF1A,0xFF1B,0xFF1C,0xFF1D,0xFF1E,0xFF1F,0xFF20, +0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28, +0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,0xFF30, +0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38, +0xFF39,0xFF3A,0xFF3B,0xFFE6,0xFF3D,0xFF3E,0xFF3F,0xFF40, +0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48, +0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,0xFF50, +0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58, +0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xC9DE,0xC9DF,0xC9E1,0xC9E3,0xC9E5,0xC9E6,0xC9E8,0xC9E9, +0xC9EA,0xC9EB,0xC9EE,0xC9F2,0xC9F3,0xC9F4,0xC9F5,0xC9F6, +0xC9F7,0xC9FA,0xC9FB,0xC9FD,0xC9FE,0xC9FF,0xCA01,0xCA02, +0xCA03,0xCA04, 0, 0, 0, 0, 0, 0, +0xCA05,0xCA06,0xCA07,0xCA0A,0xCA0E,0xCA0F,0xCA10,0xCA11, +0xCA12,0xCA13,0xCA15,0xCA16,0xCA17,0xCA19,0xCA1A,0xCA1B, +0xCA1C,0xCA1D,0xCA1E,0xCA1F,0xCA20,0xCA21,0xCA22,0xCA23, +0xCA24,0xCA25, 0, 0, 0, 0, 0, 0, +0xCA26,0xCA27,0xCA28,0xCA2A,0xCA2B,0xCA2C,0xCA2D,0xCA2E, +0xCA2F,0xCA30,0xCA31,0xCA32,0xCA33,0xCA34,0xCA35,0xCA36, +0xCA37,0xCA38,0xCA39,0xCA3A,0xCA3B,0xCA3C,0xCA3D,0xCA3E, +0xCA3F,0xCA40,0xCA41,0xCA42,0xCA43,0xCA44,0xCA45,0xCA46, +0x3131,0x3132,0x3133,0x3134,0x3135,0x3136,0x3137,0x3138, +0x3139,0x313A,0x313B,0x313C,0x313D,0x313E,0x313F,0x3140, +0x3141,0x3142,0x3143,0x3144,0x3145,0x3146,0x3147,0x3148, +0x3149,0x314A,0x314B,0x314C,0x314D,0x314E,0x314F,0x3150, +0x3151,0x3152,0x3153,0x3154,0x3155,0x3156,0x3157,0x3158, +0x3159,0x315A,0x315B,0x315C,0x315D,0x315E,0x315F,0x3160, +0x3161,0x3162,0x3163,0x3164,0x3165,0x3166,0x3167,0x3168, +0x3169,0x316A,0x316B,0x316C,0x316D,0x316E,0x316F,0x3170, +0x3171,0x3172,0x3173,0x3174,0x3175,0x3176,0x3177,0x3178, +0x3179,0x317A,0x317B,0x317C,0x317D,0x317E,0x317F,0x3180, +0x3181,0x3182,0x3183,0x3184,0x3185,0x3186,0x3187,0x3188, +0x3189,0x318A,0x318B,0x318C,0x318D,0x318E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCA47,0xCA48,0xCA49,0xCA4A,0xCA4B,0xCA4E,0xCA4F,0xCA51, +0xCA52,0xCA53,0xCA55,0xCA56,0xCA57,0xCA58,0xCA59,0xCA5A, +0xCA5B,0xCA5E,0xCA62,0xCA63,0xCA64,0xCA65,0xCA66,0xCA67, +0xCA69,0xCA6A, 0, 0, 0, 0, 0, 0, +0xCA6B,0xCA6C,0xCA6D,0xCA6E,0xCA6F,0xCA70,0xCA71,0xCA72, +0xCA73,0xCA74,0xCA75,0xCA76,0xCA77,0xCA78,0xCA79,0xCA7A, +0xCA7B,0xCA7C,0xCA7E,0xCA7F,0xCA80,0xCA81,0xCA82,0xCA83, +0xCA85,0xCA86, 0, 0, 0, 0, 0, 0, +0xCA87,0xCA88,0xCA89,0xCA8A,0xCA8B,0xCA8C,0xCA8D,0xCA8E, +0xCA8F,0xCA90,0xCA91,0xCA92,0xCA93,0xCA94,0xCA95,0xCA96, +0xCA97,0xCA99,0xCA9A,0xCA9B,0xCA9C,0xCA9D,0xCA9E,0xCA9F, +0xCAA0,0xCAA1,0xCAA2,0xCAA3,0xCAA4,0xCAA5,0xCAA6,0xCAA7, +0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176,0x2177, +0x2178,0x2179, 0, 0, 0, 0, 0,0x2160, +0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,0x2167,0x2168, +0x2169, 0, 0, 0, 0, 0, 0, 0, +0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398, +0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0, +0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9, + 0, 0, 0, 0, 0, 0, 0, 0, +0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8, +0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0, +0x03C1,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCAA8,0xCAA9,0xCAAA,0xCAAB,0xCAAC,0xCAAD,0xCAAE,0xCAAF, +0xCAB0,0xCAB1,0xCAB2,0xCAB3,0xCAB4,0xCAB5,0xCAB6,0xCAB7, +0xCAB8,0xCAB9,0xCABA,0xCABB,0xCABE,0xCABF,0xCAC1,0xCAC2, +0xCAC3,0xCAC5, 0, 0, 0, 0, 0, 0, +0xCAC6,0xCAC7,0xCAC8,0xCAC9,0xCACA,0xCACB,0xCACE,0xCAD0, +0xCAD2,0xCAD4,0xCAD5,0xCAD6,0xCAD7,0xCADA,0xCADB,0xCADC, +0xCADD,0xCADE,0xCADF,0xCAE1,0xCAE2,0xCAE3,0xCAE4,0xCAE5, +0xCAE6,0xCAE7, 0, 0, 0, 0, 0, 0, +0xCAE8,0xCAE9,0xCAEA,0xCAEB,0xCAED,0xCAEE,0xCAEF,0xCAF0, +0xCAF1,0xCAF2,0xCAF3,0xCAF5,0xCAF6,0xCAF7,0xCAF8,0xCAF9, +0xCAFA,0xCAFB,0xCAFC,0xCAFD,0xCAFE,0xCAFF,0xCB00,0xCB01, +0xCB02,0xCB03,0xCB04,0xCB05,0xCB06,0xCB07,0xCB09,0xCB0A, +0x2500,0x2502,0x250C,0x2510,0x2518,0x2514,0x251C,0x252C, +0x2524,0x2534,0x253C,0x2501,0x2503,0x250F,0x2513,0x251B, +0x2517,0x2523,0x2533,0x252B,0x253B,0x254B,0x2520,0x252F, +0x2528,0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542, +0x2512,0x2511,0x251A,0x2519,0x2516,0x2515,0x250E,0x250D, +0x251E,0x251F,0x2521,0x2522,0x2526,0x2527,0x2529,0x252A, +0x252D,0x252E,0x2531,0x2532,0x2535,0x2536,0x2539,0x253A, +0x253D,0x253E,0x2540,0x2541,0x2543,0x2544,0x2545,0x2546, +0x2547,0x2548,0x2549,0x254A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCB0B,0xCB0C,0xCB0D,0xCB0E,0xCB0F,0xCB11,0xCB12,0xCB13, +0xCB15,0xCB16,0xCB17,0xCB19,0xCB1A,0xCB1B,0xCB1C,0xCB1D, +0xCB1E,0xCB1F,0xCB22,0xCB23,0xCB24,0xCB25,0xCB26,0xCB27, +0xCB28,0xCB29, 0, 0, 0, 0, 0, 0, +0xCB2A,0xCB2B,0xCB2C,0xCB2D,0xCB2E,0xCB2F,0xCB30,0xCB31, +0xCB32,0xCB33,0xCB34,0xCB35,0xCB36,0xCB37,0xCB38,0xCB39, +0xCB3A,0xCB3B,0xCB3C,0xCB3D,0xCB3E,0xCB3F,0xCB40,0xCB42, +0xCB43,0xCB44, 0, 0, 0, 0, 0, 0, +0xCB45,0xCB46,0xCB47,0xCB4A,0xCB4B,0xCB4D,0xCB4E,0xCB4F, +0xCB51,0xCB52,0xCB53,0xCB54,0xCB55,0xCB56,0xCB57,0xCB5A, +0xCB5B,0xCB5C,0xCB5E,0xCB5F,0xCB60,0xCB61,0xCB62,0xCB63, +0xCB65,0xCB66,0xCB67,0xCB68,0xCB69,0xCB6A,0xCB6B,0xCB6C, +0x3395,0x3396,0x3397,0x2113,0x3398,0x33C4,0x33A3,0x33A4, +0x33A5,0x33A6,0x3399,0x339A,0x339B,0x339C,0x339D,0x339E, +0x339F,0x33A0,0x33A1,0x33A2,0x33CA,0x338D,0x338E,0x338F, +0x33CF,0x3388,0x3389,0x33C8,0x33A7,0x33A8,0x33B0,0x33B1, +0x33B2,0x33B3,0x33B4,0x33B5,0x33B6,0x33B7,0x33B8,0x33B9, +0x3380,0x3381,0x3382,0x3383,0x3384,0x33BA,0x33BB,0x33BC, +0x33BD,0x33BE,0x33BF,0x3390,0x3391,0x3392,0x3393,0x3394, +0x2126,0x33C0,0x33C1,0x338A,0x338B,0x338C,0x33D6,0x33C5, +0x33AD,0x33AE,0x33AF,0x33DB,0x33A9,0x33AA,0x33AB,0x33AC, +0x33DD,0x33D0,0x33D3,0x33C3,0x33C9,0x33DC,0x33C6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCB6D,0xCB6E,0xCB6F,0xCB70,0xCB71,0xCB72,0xCB73,0xCB74, +0xCB75,0xCB76,0xCB77,0xCB7A,0xCB7B,0xCB7C,0xCB7D,0xCB7E, +0xCB7F,0xCB80,0xCB81,0xCB82,0xCB83,0xCB84,0xCB85,0xCB86, +0xCB87,0xCB88, 0, 0, 0, 0, 0, 0, +0xCB89,0xCB8A,0xCB8B,0xCB8C,0xCB8D,0xCB8E,0xCB8F,0xCB90, +0xCB91,0xCB92,0xCB93,0xCB94,0xCB95,0xCB96,0xCB97,0xCB98, +0xCB99,0xCB9A,0xCB9B,0xCB9D,0xCB9E,0xCB9F,0xCBA0,0xCBA1, +0xCBA2,0xCBA3, 0, 0, 0, 0, 0, 0, +0xCBA4,0xCBA5,0xCBA6,0xCBA7,0xCBA8,0xCBA9,0xCBAA,0xCBAB, +0xCBAC,0xCBAD,0xCBAE,0xCBAF,0xCBB0,0xCBB1,0xCBB2,0xCBB3, +0xCBB4,0xCBB5,0xCBB6,0xCBB7,0xCBB9,0xCBBA,0xCBBB,0xCBBC, +0xCBBD,0xCBBE,0xCBBF,0xCBC0,0xCBC1,0xCBC2,0xCBC3,0xCBC4, +0x00C6,0x00D0,0x00AA,0x0126, 0,0x0132, 0,0x013F, +0x0141,0x00D8,0x0152,0x00BA,0x00DE,0x0166,0x014A, 0, +0x3260,0x3261,0x3262,0x3263,0x3264,0x3265,0x3266,0x3267, +0x3268,0x3269,0x326A,0x326B,0x326C,0x326D,0x326E,0x326F, +0x3270,0x3271,0x3272,0x3273,0x3274,0x3275,0x3276,0x3277, +0x3278,0x3279,0x327A,0x327B,0x24D0,0x24D1,0x24D2,0x24D3, +0x24D4,0x24D5,0x24D6,0x24D7,0x24D8,0x24D9,0x24DA,0x24DB, +0x24DC,0x24DD,0x24DE,0x24DF,0x24E0,0x24E1,0x24E2,0x24E3, +0x24E4,0x24E5,0x24E6,0x24E7,0x24E8,0x24E9,0x2460,0x2461, +0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,0x2469, +0x246A,0x246B,0x246C,0x246D,0x246E,0x00BD,0x2153,0x2154, +0x00BC,0x00BE,0x215B,0x215C,0x215D,0x215E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCBC5,0xCBC6,0xCBC7,0xCBC8,0xCBC9,0xCBCA,0xCBCB,0xCBCC, +0xCBCD,0xCBCE,0xCBCF,0xCBD0,0xCBD1,0xCBD2,0xCBD3,0xCBD5, +0xCBD6,0xCBD7,0xCBD8,0xCBD9,0xCBDA,0xCBDB,0xCBDC,0xCBDD, +0xCBDE,0xCBDF, 0, 0, 0, 0, 0, 0, +0xCBE0,0xCBE1,0xCBE2,0xCBE3,0xCBE5,0xCBE6,0xCBE8,0xCBEA, +0xCBEB,0xCBEC,0xCBED,0xCBEE,0xCBEF,0xCBF0,0xCBF1,0xCBF2, +0xCBF3,0xCBF4,0xCBF5,0xCBF6,0xCBF7,0xCBF8,0xCBF9,0xCBFA, +0xCBFB,0xCBFC, 0, 0, 0, 0, 0, 0, +0xCBFD,0xCBFE,0xCBFF,0xCC00,0xCC01,0xCC02,0xCC03,0xCC04, +0xCC05,0xCC06,0xCC07,0xCC08,0xCC09,0xCC0A,0xCC0B,0xCC0E, +0xCC0F,0xCC11,0xCC12,0xCC13,0xCC15,0xCC16,0xCC17,0xCC18, +0xCC19,0xCC1A,0xCC1B,0xCC1E,0xCC1F,0xCC20,0xCC23,0xCC24, +0x00E6,0x0111,0x00F0,0x0127,0x0131,0x0133,0x0138,0x0140, +0x0142,0x00F8,0x0153,0x00DF,0x00FE,0x0167,0x014B,0x0149, +0x3200,0x3201,0x3202,0x3203,0x3204,0x3205,0x3206,0x3207, +0x3208,0x3209,0x320A,0x320B,0x320C,0x320D,0x320E,0x320F, +0x3210,0x3211,0x3212,0x3213,0x3214,0x3215,0x3216,0x3217, +0x3218,0x3219,0x321A,0x321B,0x249C,0x249D,0x249E,0x249F, +0x24A0,0x24A1,0x24A2,0x24A3,0x24A4,0x24A5,0x24A6,0x24A7, +0x24A8,0x24A9,0x24AA,0x24AB,0x24AC,0x24AD,0x24AE,0x24AF, +0x24B0,0x24B1,0x24B2,0x24B3,0x24B4,0x24B5,0x2474,0x2475, +0x2476,0x2477,0x2478,0x2479,0x247A,0x247B,0x247C,0x247D, +0x247E,0x247F,0x2480,0x2481,0x2482,0x00B9,0x00B2,0x00B3, +0x2074,0x207F,0x2081,0x2082,0x2083,0x2084, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCC25,0xCC26,0xCC2A,0xCC2B,0xCC2D,0xCC2F,0xCC31,0xCC32, +0xCC33,0xCC34,0xCC35,0xCC36,0xCC37,0xCC3A,0xCC3F,0xCC40, +0xCC41,0xCC42,0xCC43,0xCC46,0xCC47,0xCC49,0xCC4A,0xCC4B, +0xCC4D,0xCC4E, 0, 0, 0, 0, 0, 0, +0xCC4F,0xCC50,0xCC51,0xCC52,0xCC53,0xCC56,0xCC5A,0xCC5B, +0xCC5C,0xCC5D,0xCC5E,0xCC5F,0xCC61,0xCC62,0xCC63,0xCC65, +0xCC67,0xCC69,0xCC6A,0xCC6B,0xCC6C,0xCC6D,0xCC6E,0xCC6F, +0xCC71,0xCC72, 0, 0, 0, 0, 0, 0, +0xCC73,0xCC74,0xCC76,0xCC77,0xCC78,0xCC79,0xCC7A,0xCC7B, +0xCC7C,0xCC7D,0xCC7E,0xCC7F,0xCC80,0xCC81,0xCC82,0xCC83, +0xCC84,0xCC85,0xCC86,0xCC87,0xCC88,0xCC89,0xCC8A,0xCC8B, +0xCC8C,0xCC8D,0xCC8E,0xCC8F,0xCC90,0xCC91,0xCC92,0xCC93, +0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048, +0x3049,0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050, +0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058, +0x3059,0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060, +0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068, +0x3069,0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070, +0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078, +0x3079,0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080, +0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088, +0x3089,0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090, +0x3091,0x3092,0x3093, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCC94,0xCC95,0xCC96,0xCC97,0xCC9A,0xCC9B,0xCC9D,0xCC9E, +0xCC9F,0xCCA1,0xCCA2,0xCCA3,0xCCA4,0xCCA5,0xCCA6,0xCCA7, +0xCCAA,0xCCAE,0xCCAF,0xCCB0,0xCCB1,0xCCB2,0xCCB3,0xCCB6, +0xCCB7,0xCCB9, 0, 0, 0, 0, 0, 0, +0xCCBA,0xCCBB,0xCCBD,0xCCBE,0xCCBF,0xCCC0,0xCCC1,0xCCC2, +0xCCC3,0xCCC6,0xCCC8,0xCCCA,0xCCCB,0xCCCC,0xCCCD,0xCCCE, +0xCCCF,0xCCD1,0xCCD2,0xCCD3,0xCCD5,0xCCD6,0xCCD7,0xCCD8, +0xCCD9,0xCCDA, 0, 0, 0, 0, 0, 0, +0xCCDB,0xCCDC,0xCCDD,0xCCDE,0xCCDF,0xCCE0,0xCCE1,0xCCE2, +0xCCE3,0xCCE5,0xCCE6,0xCCE7,0xCCE8,0xCCE9,0xCCEA,0xCCEB, +0xCCED,0xCCEE,0xCCEF,0xCCF1,0xCCF2,0xCCF3,0xCCF4,0xCCF5, +0xCCF6,0xCCF7,0xCCF8,0xCCF9,0xCCFA,0xCCFB,0xCCFC,0xCCFD, +0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8, +0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0, +0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8, +0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0, +0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8, +0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0, +0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8, +0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF,0x30E0, +0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7,0x30E8, +0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF,0x30F0, +0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCCFE,0xCCFF,0xCD00,0xCD02,0xCD03,0xCD04,0xCD05,0xCD06, +0xCD07,0xCD0A,0xCD0B,0xCD0D,0xCD0E,0xCD0F,0xCD11,0xCD12, +0xCD13,0xCD14,0xCD15,0xCD16,0xCD17,0xCD1A,0xCD1C,0xCD1E, +0xCD1F,0xCD20, 0, 0, 0, 0, 0, 0, +0xCD21,0xCD22,0xCD23,0xCD25,0xCD26,0xCD27,0xCD29,0xCD2A, +0xCD2B,0xCD2D,0xCD2E,0xCD2F,0xCD30,0xCD31,0xCD32,0xCD33, +0xCD34,0xCD35,0xCD36,0xCD37,0xCD38,0xCD3A,0xCD3B,0xCD3C, +0xCD3D,0xCD3E, 0, 0, 0, 0, 0, 0, +0xCD3F,0xCD40,0xCD41,0xCD42,0xCD43,0xCD44,0xCD45,0xCD46, +0xCD47,0xCD48,0xCD49,0xCD4A,0xCD4B,0xCD4C,0xCD4D,0xCD4E, +0xCD4F,0xCD50,0xCD51,0xCD52,0xCD53,0xCD54,0xCD55,0xCD56, +0xCD57,0xCD58,0xCD59,0xCD5A,0xCD5B,0xCD5D,0xCD5E,0xCD5F, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416, +0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426, +0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E, +0x042F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, +0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446, +0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E, +0x044F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCD61,0xCD62,0xCD63,0xCD65,0xCD66,0xCD67,0xCD68,0xCD69, +0xCD6A,0xCD6B,0xCD6E,0xCD70,0xCD72,0xCD73,0xCD74,0xCD75, +0xCD76,0xCD77,0xCD79,0xCD7A,0xCD7B,0xCD7C,0xCD7D,0xCD7E, +0xCD7F,0xCD80, 0, 0, 0, 0, 0, 0, +0xCD81,0xCD82,0xCD83,0xCD84,0xCD85,0xCD86,0xCD87,0xCD89, +0xCD8A,0xCD8B,0xCD8C,0xCD8D,0xCD8E,0xCD8F,0xCD90,0xCD91, +0xCD92,0xCD93,0xCD96,0xCD97,0xCD99,0xCD9A,0xCD9B,0xCD9D, +0xCD9E,0xCD9F, 0, 0, 0, 0, 0, 0, +0xCDA0,0xCDA1,0xCDA2,0xCDA3,0xCDA6,0xCDA8,0xCDAA,0xCDAB, +0xCDAC,0xCDAD,0xCDAE,0xCDAF,0xCDB1,0xCDB2,0xCDB3,0xCDB4, +0xCDB5,0xCDB6,0xCDB7,0xCDB8,0xCDB9,0xCDBA,0xCDBB,0xCDBC, +0xCDBD,0xCDBE,0xCDBF,0xCDC0,0xCDC1,0xCDC2,0xCDC3,0xCDC5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCDC6,0xCDC7,0xCDC8,0xCDC9,0xCDCA,0xCDCB,0xCDCD,0xCDCE, +0xCDCF,0xCDD1,0xCDD2,0xCDD3,0xCDD4,0xCDD5,0xCDD6,0xCDD7, +0xCDD8,0xCDD9,0xCDDA,0xCDDB,0xCDDC,0xCDDD,0xCDDE,0xCDDF, +0xCDE0,0xCDE1, 0, 0, 0, 0, 0, 0, +0xCDE2,0xCDE3,0xCDE4,0xCDE5,0xCDE6,0xCDE7,0xCDE9,0xCDEA, +0xCDEB,0xCDED,0xCDEE,0xCDEF,0xCDF1,0xCDF2,0xCDF3,0xCDF4, +0xCDF5,0xCDF6,0xCDF7,0xCDFA,0xCDFC,0xCDFE,0xCDFF,0xCE00, +0xCE01,0xCE02, 0, 0, 0, 0, 0, 0, +0xCE03,0xCE05,0xCE06,0xCE07,0xCE09,0xCE0A,0xCE0B,0xCE0D, +0xCE0E,0xCE0F,0xCE10,0xCE11,0xCE12,0xCE13,0xCE15,0xCE16, +0xCE17,0xCE18,0xCE1A,0xCE1B,0xCE1C,0xCE1D,0xCE1E,0xCE1F, +0xCE22,0xCE23,0xCE25,0xCE26,0xCE27,0xCE29,0xCE2A,0xCE2B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCE2C,0xCE2D,0xCE2E,0xCE2F,0xCE32,0xCE34,0xCE36,0xCE37, +0xCE38,0xCE39,0xCE3A,0xCE3B,0xCE3C,0xCE3D,0xCE3E,0xCE3F, +0xCE40,0xCE41,0xCE42,0xCE43,0xCE44,0xCE45,0xCE46,0xCE47, +0xCE48,0xCE49, 0, 0, 0, 0, 0, 0, +0xCE4A,0xCE4B,0xCE4C,0xCE4D,0xCE4E,0xCE4F,0xCE50,0xCE51, +0xCE52,0xCE53,0xCE54,0xCE55,0xCE56,0xCE57,0xCE5A,0xCE5B, +0xCE5D,0xCE5E,0xCE62,0xCE63,0xCE64,0xCE65,0xCE66,0xCE67, +0xCE6A,0xCE6C, 0, 0, 0, 0, 0, 0, +0xCE6E,0xCE6F,0xCE70,0xCE71,0xCE72,0xCE73,0xCE76,0xCE77, +0xCE79,0xCE7A,0xCE7B,0xCE7D,0xCE7E,0xCE7F,0xCE80,0xCE81, +0xCE82,0xCE83,0xCE86,0xCE88,0xCE8A,0xCE8B,0xCE8C,0xCE8D, +0xCE8E,0xCE8F,0xCE92,0xCE93,0xCE95,0xCE96,0xCE97,0xCE99, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCE9A,0xCE9B,0xCE9C,0xCE9D,0xCE9E,0xCE9F,0xCEA2,0xCEA6, +0xCEA7,0xCEA8,0xCEA9,0xCEAA,0xCEAB,0xCEAE,0xCEAF,0xCEB0, +0xCEB1,0xCEB2,0xCEB3,0xCEB4,0xCEB5,0xCEB6,0xCEB7,0xCEB8, +0xCEB9,0xCEBA, 0, 0, 0, 0, 0, 0, +0xCEBB,0xCEBC,0xCEBD,0xCEBE,0xCEBF,0xCEC0,0xCEC2,0xCEC3, +0xCEC4,0xCEC5,0xCEC6,0xCEC7,0xCEC8,0xCEC9,0xCECA,0xCECB, +0xCECC,0xCECD,0xCECE,0xCECF,0xCED0,0xCED1,0xCED2,0xCED3, +0xCED4,0xCED5, 0, 0, 0, 0, 0, 0, +0xCED6,0xCED7,0xCED8,0xCED9,0xCEDA,0xCEDB,0xCEDC,0xCEDD, +0xCEDE,0xCEDF,0xCEE0,0xCEE1,0xCEE2,0xCEE3,0xCEE6,0xCEE7, +0xCEE9,0xCEEA,0xCEED,0xCEEE,0xCEEF,0xCEF0,0xCEF1,0xCEF2, +0xCEF3,0xCEF6,0xCEFA,0xCEFB,0xCEFC,0xCEFD,0xCEFE,0xCEFF, +0xAC00,0xAC01,0xAC04,0xAC07,0xAC08,0xAC09,0xAC0A,0xAC10, +0xAC11,0xAC12,0xAC13,0xAC14,0xAC15,0xAC16,0xAC17,0xAC19, +0xAC1A,0xAC1B,0xAC1C,0xAC1D,0xAC20,0xAC24,0xAC2C,0xAC2D, +0xAC2F,0xAC30,0xAC31,0xAC38,0xAC39,0xAC3C,0xAC40,0xAC4B, +0xAC4D,0xAC54,0xAC58,0xAC5C,0xAC70,0xAC71,0xAC74,0xAC77, +0xAC78,0xAC7A,0xAC80,0xAC81,0xAC83,0xAC84,0xAC85,0xAC86, +0xAC89,0xAC8A,0xAC8B,0xAC8C,0xAC90,0xAC94,0xAC9C,0xAC9D, +0xAC9F,0xACA0,0xACA1,0xACA8,0xACA9,0xACAA,0xACAC,0xACAF, +0xACB0,0xACB8,0xACB9,0xACBB,0xACBC,0xACBD,0xACC1,0xACC4, +0xACC8,0xACCC,0xACD5,0xACD7,0xACE0,0xACE1,0xACE4,0xACE7, +0xACE8,0xACEA,0xACEC,0xACEF,0xACF0,0xACF1,0xACF3,0xACF5, +0xACF6,0xACFC,0xACFD,0xAD00,0xAD04,0xAD06, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCF02,0xCF03,0xCF05,0xCF06,0xCF07,0xCF09,0xCF0A,0xCF0B, +0xCF0C,0xCF0D,0xCF0E,0xCF0F,0xCF12,0xCF14,0xCF16,0xCF17, +0xCF18,0xCF19,0xCF1A,0xCF1B,0xCF1D,0xCF1E,0xCF1F,0xCF21, +0xCF22,0xCF23, 0, 0, 0, 0, 0, 0, +0xCF25,0xCF26,0xCF27,0xCF28,0xCF29,0xCF2A,0xCF2B,0xCF2E, +0xCF32,0xCF33,0xCF34,0xCF35,0xCF36,0xCF37,0xCF39,0xCF3A, +0xCF3B,0xCF3C,0xCF3D,0xCF3E,0xCF3F,0xCF40,0xCF41,0xCF42, +0xCF43,0xCF44, 0, 0, 0, 0, 0, 0, +0xCF45,0xCF46,0xCF47,0xCF48,0xCF49,0xCF4A,0xCF4B,0xCF4C, +0xCF4D,0xCF4E,0xCF4F,0xCF50,0xCF51,0xCF52,0xCF53,0xCF56, +0xCF57,0xCF59,0xCF5A,0xCF5B,0xCF5D,0xCF5E,0xCF5F,0xCF60, +0xCF61,0xCF62,0xCF63,0xCF66,0xCF68,0xCF6A,0xCF6B,0xCF6C, +0xAD0C,0xAD0D,0xAD0F,0xAD11,0xAD18,0xAD1C,0xAD20,0xAD29, +0xAD2C,0xAD2D,0xAD34,0xAD35,0xAD38,0xAD3C,0xAD44,0xAD45, +0xAD47,0xAD49,0xAD50,0xAD54,0xAD58,0xAD61,0xAD63,0xAD6C, +0xAD6D,0xAD70,0xAD73,0xAD74,0xAD75,0xAD76,0xAD7B,0xAD7C, +0xAD7D,0xAD7F,0xAD81,0xAD82,0xAD88,0xAD89,0xAD8C,0xAD90, +0xAD9C,0xAD9D,0xADA4,0xADB7,0xADC0,0xADC1,0xADC4,0xADC8, +0xADD0,0xADD1,0xADD3,0xADDC,0xADE0,0xADE4,0xADF8,0xADF9, +0xADFC,0xADFF,0xAE00,0xAE01,0xAE08,0xAE09,0xAE0B,0xAE0D, +0xAE14,0xAE30,0xAE31,0xAE34,0xAE37,0xAE38,0xAE3A,0xAE40, +0xAE41,0xAE43,0xAE45,0xAE46,0xAE4A,0xAE4C,0xAE4D,0xAE4E, +0xAE50,0xAE54,0xAE56,0xAE5C,0xAE5D,0xAE5F,0xAE60,0xAE61, +0xAE65,0xAE68,0xAE69,0xAE6C,0xAE70,0xAE78, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCF6D,0xCF6E,0xCF6F,0xCF72,0xCF73,0xCF75,0xCF76,0xCF77, +0xCF79,0xCF7A,0xCF7B,0xCF7C,0xCF7D,0xCF7E,0xCF7F,0xCF81, +0xCF82,0xCF83,0xCF84,0xCF86,0xCF87,0xCF88,0xCF89,0xCF8A, +0xCF8B,0xCF8D, 0, 0, 0, 0, 0, 0, +0xCF8E,0xCF8F,0xCF90,0xCF91,0xCF92,0xCF93,0xCF94,0xCF95, +0xCF96,0xCF97,0xCF98,0xCF99,0xCF9A,0xCF9B,0xCF9C,0xCF9D, +0xCF9E,0xCF9F,0xCFA0,0xCFA2,0xCFA3,0xCFA4,0xCFA5,0xCFA6, +0xCFA7,0xCFA9, 0, 0, 0, 0, 0, 0, +0xCFAA,0xCFAB,0xCFAC,0xCFAD,0xCFAE,0xCFAF,0xCFB1,0xCFB2, +0xCFB3,0xCFB4,0xCFB5,0xCFB6,0xCFB7,0xCFB8,0xCFB9,0xCFBA, +0xCFBB,0xCFBC,0xCFBD,0xCFBE,0xCFBF,0xCFC0,0xCFC1,0xCFC2, +0xCFC3,0xCFC5,0xCFC6,0xCFC7,0xCFC8,0xCFC9,0xCFCA,0xCFCB, +0xAE79,0xAE7B,0xAE7C,0xAE7D,0xAE84,0xAE85,0xAE8C,0xAEBC, +0xAEBD,0xAEBE,0xAEC0,0xAEC4,0xAECC,0xAECD,0xAECF,0xAED0, +0xAED1,0xAED8,0xAED9,0xAEDC,0xAEE8,0xAEEB,0xAEED,0xAEF4, +0xAEF8,0xAEFC,0xAF07,0xAF08,0xAF0D,0xAF10,0xAF2C,0xAF2D, +0xAF30,0xAF32,0xAF34,0xAF3C,0xAF3D,0xAF3F,0xAF41,0xAF42, +0xAF43,0xAF48,0xAF49,0xAF50,0xAF5C,0xAF5D,0xAF64,0xAF65, +0xAF79,0xAF80,0xAF84,0xAF88,0xAF90,0xAF91,0xAF95,0xAF9C, +0xAFB8,0xAFB9,0xAFBC,0xAFC0,0xAFC7,0xAFC8,0xAFC9,0xAFCB, +0xAFCD,0xAFCE,0xAFD4,0xAFDC,0xAFE8,0xAFE9,0xAFF0,0xAFF1, +0xAFF4,0xAFF8,0xB000,0xB001,0xB004,0xB00C,0xB010,0xB014, +0xB01C,0xB01D,0xB028,0xB044,0xB045,0xB048,0xB04A,0xB04C, +0xB04E,0xB053,0xB054,0xB055,0xB057,0xB059, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCFCC,0xCFCD,0xCFCE,0xCFCF,0xCFD0,0xCFD1,0xCFD2,0xCFD3, +0xCFD4,0xCFD5,0xCFD6,0xCFD7,0xCFD8,0xCFD9,0xCFDA,0xCFDB, +0xCFDC,0xCFDD,0xCFDE,0xCFDF,0xCFE2,0xCFE3,0xCFE5,0xCFE6, +0xCFE7,0xCFE9, 0, 0, 0, 0, 0, 0, +0xCFEA,0xCFEB,0xCFEC,0xCFED,0xCFEE,0xCFEF,0xCFF2,0xCFF4, +0xCFF6,0xCFF7,0xCFF8,0xCFF9,0xCFFA,0xCFFB,0xCFFD,0xCFFE, +0xCFFF,0xD001,0xD002,0xD003,0xD005,0xD006,0xD007,0xD008, +0xD009,0xD00A, 0, 0, 0, 0, 0, 0, +0xD00B,0xD00C,0xD00D,0xD00E,0xD00F,0xD010,0xD012,0xD013, +0xD014,0xD015,0xD016,0xD017,0xD019,0xD01A,0xD01B,0xD01C, +0xD01D,0xD01E,0xD01F,0xD020,0xD021,0xD022,0xD023,0xD024, +0xD025,0xD026,0xD027,0xD028,0xD029,0xD02A,0xD02B,0xD02C, +0xB05D,0xB07C,0xB07D,0xB080,0xB084,0xB08C,0xB08D,0xB08F, +0xB091,0xB098,0xB099,0xB09A,0xB09C,0xB09F,0xB0A0,0xB0A1, +0xB0A2,0xB0A8,0xB0A9,0xB0AB,0xB0AC,0xB0AD,0xB0AE,0xB0AF, +0xB0B1,0xB0B3,0xB0B4,0xB0B5,0xB0B8,0xB0BC,0xB0C4,0xB0C5, +0xB0C7,0xB0C8,0xB0C9,0xB0D0,0xB0D1,0xB0D4,0xB0D8,0xB0E0, +0xB0E5,0xB108,0xB109,0xB10B,0xB10C,0xB110,0xB112,0xB113, +0xB118,0xB119,0xB11B,0xB11C,0xB11D,0xB123,0xB124,0xB125, +0xB128,0xB12C,0xB134,0xB135,0xB137,0xB138,0xB139,0xB140, +0xB141,0xB144,0xB148,0xB150,0xB151,0xB154,0xB155,0xB158, +0xB15C,0xB160,0xB178,0xB179,0xB17C,0xB180,0xB182,0xB188, +0xB189,0xB18B,0xB18D,0xB192,0xB193,0xB194,0xB198,0xB19C, +0xB1A8,0xB1CC,0xB1D0,0xB1D4,0xB1DC,0xB1DD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD02E,0xD02F,0xD030,0xD031,0xD032,0xD033,0xD036,0xD037, +0xD039,0xD03A,0xD03B,0xD03D,0xD03E,0xD03F,0xD040,0xD041, +0xD042,0xD043,0xD046,0xD048,0xD04A,0xD04B,0xD04C,0xD04D, +0xD04E,0xD04F, 0, 0, 0, 0, 0, 0, +0xD051,0xD052,0xD053,0xD055,0xD056,0xD057,0xD059,0xD05A, +0xD05B,0xD05C,0xD05D,0xD05E,0xD05F,0xD061,0xD062,0xD063, +0xD064,0xD065,0xD066,0xD067,0xD068,0xD069,0xD06A,0xD06B, +0xD06E,0xD06F, 0, 0, 0, 0, 0, 0, +0xD071,0xD072,0xD073,0xD075,0xD076,0xD077,0xD078,0xD079, +0xD07A,0xD07B,0xD07E,0xD07F,0xD080,0xD082,0xD083,0xD084, +0xD085,0xD086,0xD087,0xD088,0xD089,0xD08A,0xD08B,0xD08C, +0xD08D,0xD08E,0xD08F,0xD090,0xD091,0xD092,0xD093,0xD094, +0xB1DF,0xB1E8,0xB1E9,0xB1EC,0xB1F0,0xB1F9,0xB1FB,0xB1FD, +0xB204,0xB205,0xB208,0xB20B,0xB20C,0xB214,0xB215,0xB217, +0xB219,0xB220,0xB234,0xB23C,0xB258,0xB25C,0xB260,0xB268, +0xB269,0xB274,0xB275,0xB27C,0xB284,0xB285,0xB289,0xB290, +0xB291,0xB294,0xB298,0xB299,0xB29A,0xB2A0,0xB2A1,0xB2A3, +0xB2A5,0xB2A6,0xB2AA,0xB2AC,0xB2B0,0xB2B4,0xB2C8,0xB2C9, +0xB2CC,0xB2D0,0xB2D2,0xB2D8,0xB2D9,0xB2DB,0xB2DD,0xB2E2, +0xB2E4,0xB2E5,0xB2E6,0xB2E8,0xB2EB,0xB2EC,0xB2ED,0xB2EE, +0xB2EF,0xB2F3,0xB2F4,0xB2F5,0xB2F7,0xB2F8,0xB2F9,0xB2FA, +0xB2FB,0xB2FF,0xB300,0xB301,0xB304,0xB308,0xB310,0xB311, +0xB313,0xB314,0xB315,0xB31C,0xB354,0xB355,0xB356,0xB358, +0xB35B,0xB35C,0xB35E,0xB35F,0xB364,0xB365, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD095,0xD096,0xD097,0xD098,0xD099,0xD09A,0xD09B,0xD09C, +0xD09D,0xD09E,0xD09F,0xD0A0,0xD0A1,0xD0A2,0xD0A3,0xD0A6, +0xD0A7,0xD0A9,0xD0AA,0xD0AB,0xD0AD,0xD0AE,0xD0AF,0xD0B0, +0xD0B1,0xD0B2, 0, 0, 0, 0, 0, 0, +0xD0B3,0xD0B6,0xD0B8,0xD0BA,0xD0BB,0xD0BC,0xD0BD,0xD0BE, +0xD0BF,0xD0C2,0xD0C3,0xD0C5,0xD0C6,0xD0C7,0xD0CA,0xD0CB, +0xD0CC,0xD0CD,0xD0CE,0xD0CF,0xD0D2,0xD0D6,0xD0D7,0xD0D8, +0xD0D9,0xD0DA, 0, 0, 0, 0, 0, 0, +0xD0DB,0xD0DE,0xD0DF,0xD0E1,0xD0E2,0xD0E3,0xD0E5,0xD0E6, +0xD0E7,0xD0E8,0xD0E9,0xD0EA,0xD0EB,0xD0EE,0xD0F2,0xD0F3, +0xD0F4,0xD0F5,0xD0F6,0xD0F7,0xD0F9,0xD0FA,0xD0FB,0xD0FC, +0xD0FD,0xD0FE,0xD0FF,0xD100,0xD101,0xD102,0xD103,0xD104, +0xB367,0xB369,0xB36B,0xB36E,0xB370,0xB371,0xB374,0xB378, +0xB380,0xB381,0xB383,0xB384,0xB385,0xB38C,0xB390,0xB394, +0xB3A0,0xB3A1,0xB3A8,0xB3AC,0xB3C4,0xB3C5,0xB3C8,0xB3CB, +0xB3CC,0xB3CE,0xB3D0,0xB3D4,0xB3D5,0xB3D7,0xB3D9,0xB3DB, +0xB3DD,0xB3E0,0xB3E4,0xB3E8,0xB3FC,0xB410,0xB418,0xB41C, +0xB420,0xB428,0xB429,0xB42B,0xB434,0xB450,0xB451,0xB454, +0xB458,0xB460,0xB461,0xB463,0xB465,0xB46C,0xB480,0xB488, +0xB49D,0xB4A4,0xB4A8,0xB4AC,0xB4B5,0xB4B7,0xB4B9,0xB4C0, +0xB4C4,0xB4C8,0xB4D0,0xB4D5,0xB4DC,0xB4DD,0xB4E0,0xB4E3, +0xB4E4,0xB4E6,0xB4EC,0xB4ED,0xB4EF,0xB4F1,0xB4F8,0xB514, +0xB515,0xB518,0xB51B,0xB51C,0xB524,0xB525,0xB527,0xB528, +0xB529,0xB52A,0xB530,0xB531,0xB534,0xB538, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD105,0xD106,0xD107,0xD108,0xD109,0xD10A,0xD10B,0xD10C, +0xD10E,0xD10F,0xD110,0xD111,0xD112,0xD113,0xD114,0xD115, +0xD116,0xD117,0xD118,0xD119,0xD11A,0xD11B,0xD11C,0xD11D, +0xD11E,0xD11F, 0, 0, 0, 0, 0, 0, +0xD120,0xD121,0xD122,0xD123,0xD124,0xD125,0xD126,0xD127, +0xD128,0xD129,0xD12A,0xD12B,0xD12C,0xD12D,0xD12E,0xD12F, +0xD132,0xD133,0xD135,0xD136,0xD137,0xD139,0xD13B,0xD13C, +0xD13D,0xD13E, 0, 0, 0, 0, 0, 0, +0xD13F,0xD142,0xD146,0xD147,0xD148,0xD149,0xD14A,0xD14B, +0xD14E,0xD14F,0xD151,0xD152,0xD153,0xD155,0xD156,0xD157, +0xD158,0xD159,0xD15A,0xD15B,0xD15E,0xD160,0xD162,0xD163, +0xD164,0xD165,0xD166,0xD167,0xD169,0xD16A,0xD16B,0xD16D, +0xB540,0xB541,0xB543,0xB544,0xB545,0xB54B,0xB54C,0xB54D, +0xB550,0xB554,0xB55C,0xB55D,0xB55F,0xB560,0xB561,0xB5A0, +0xB5A1,0xB5A4,0xB5A8,0xB5AA,0xB5AB,0xB5B0,0xB5B1,0xB5B3, +0xB5B4,0xB5B5,0xB5BB,0xB5BC,0xB5BD,0xB5C0,0xB5C4,0xB5CC, +0xB5CD,0xB5CF,0xB5D0,0xB5D1,0xB5D8,0xB5EC,0xB610,0xB611, +0xB614,0xB618,0xB625,0xB62C,0xB634,0xB648,0xB664,0xB668, +0xB69C,0xB69D,0xB6A0,0xB6A4,0xB6AB,0xB6AC,0xB6B1,0xB6D4, +0xB6F0,0xB6F4,0xB6F8,0xB700,0xB701,0xB705,0xB728,0xB729, +0xB72C,0xB72F,0xB730,0xB738,0xB739,0xB73B,0xB744,0xB748, +0xB74C,0xB754,0xB755,0xB760,0xB764,0xB768,0xB770,0xB771, +0xB773,0xB775,0xB77C,0xB77D,0xB780,0xB784,0xB78C,0xB78D, +0xB78F,0xB790,0xB791,0xB792,0xB796,0xB797, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD16E,0xD16F,0xD170,0xD171,0xD172,0xD173,0xD174,0xD175, +0xD176,0xD177,0xD178,0xD179,0xD17A,0xD17B,0xD17D,0xD17E, +0xD17F,0xD180,0xD181,0xD182,0xD183,0xD185,0xD186,0xD187, +0xD189,0xD18A, 0, 0, 0, 0, 0, 0, +0xD18B,0xD18C,0xD18D,0xD18E,0xD18F,0xD190,0xD191,0xD192, +0xD193,0xD194,0xD195,0xD196,0xD197,0xD198,0xD199,0xD19A, +0xD19B,0xD19C,0xD19D,0xD19E,0xD19F,0xD1A2,0xD1A3,0xD1A5, +0xD1A6,0xD1A7, 0, 0, 0, 0, 0, 0, +0xD1A9,0xD1AA,0xD1AB,0xD1AC,0xD1AD,0xD1AE,0xD1AF,0xD1B2, +0xD1B4,0xD1B6,0xD1B7,0xD1B8,0xD1B9,0xD1BB,0xD1BD,0xD1BE, +0xD1BF,0xD1C1,0xD1C2,0xD1C3,0xD1C4,0xD1C5,0xD1C6,0xD1C7, +0xD1C8,0xD1C9,0xD1CA,0xD1CB,0xD1CC,0xD1CD,0xD1CE,0xD1CF, +0xB798,0xB799,0xB79C,0xB7A0,0xB7A8,0xB7A9,0xB7AB,0xB7AC, +0xB7AD,0xB7B4,0xB7B5,0xB7B8,0xB7C7,0xB7C9,0xB7EC,0xB7ED, +0xB7F0,0xB7F4,0xB7FC,0xB7FD,0xB7FF,0xB800,0xB801,0xB807, +0xB808,0xB809,0xB80C,0xB810,0xB818,0xB819,0xB81B,0xB81D, +0xB824,0xB825,0xB828,0xB82C,0xB834,0xB835,0xB837,0xB838, +0xB839,0xB840,0xB844,0xB851,0xB853,0xB85C,0xB85D,0xB860, +0xB864,0xB86C,0xB86D,0xB86F,0xB871,0xB878,0xB87C,0xB88D, +0xB8A8,0xB8B0,0xB8B4,0xB8B8,0xB8C0,0xB8C1,0xB8C3,0xB8C5, +0xB8CC,0xB8D0,0xB8D4,0xB8DD,0xB8DF,0xB8E1,0xB8E8,0xB8E9, +0xB8EC,0xB8F0,0xB8F8,0xB8F9,0xB8FB,0xB8FD,0xB904,0xB918, +0xB920,0xB93C,0xB93D,0xB940,0xB944,0xB94C,0xB94F,0xB951, +0xB958,0xB959,0xB95C,0xB960,0xB968,0xB969, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD1D0,0xD1D1,0xD1D2,0xD1D3,0xD1D4,0xD1D5,0xD1D6,0xD1D7, +0xD1D9,0xD1DA,0xD1DB,0xD1DC,0xD1DD,0xD1DE,0xD1DF,0xD1E0, +0xD1E1,0xD1E2,0xD1E3,0xD1E4,0xD1E5,0xD1E6,0xD1E7,0xD1E8, +0xD1E9,0xD1EA, 0, 0, 0, 0, 0, 0, +0xD1EB,0xD1EC,0xD1ED,0xD1EE,0xD1EF,0xD1F0,0xD1F1,0xD1F2, +0xD1F3,0xD1F5,0xD1F6,0xD1F7,0xD1F9,0xD1FA,0xD1FB,0xD1FC, +0xD1FD,0xD1FE,0xD1FF,0xD200,0xD201,0xD202,0xD203,0xD204, +0xD205,0xD206, 0, 0, 0, 0, 0, 0, +0xD208,0xD20A,0xD20B,0xD20C,0xD20D,0xD20E,0xD20F,0xD211, +0xD212,0xD213,0xD214,0xD215,0xD216,0xD217,0xD218,0xD219, +0xD21A,0xD21B,0xD21C,0xD21D,0xD21E,0xD21F,0xD220,0xD221, +0xD222,0xD223,0xD224,0xD225,0xD226,0xD227,0xD228,0xD229, +0xB96B,0xB96D,0xB974,0xB975,0xB978,0xB97C,0xB984,0xB985, +0xB987,0xB989,0xB98A,0xB98D,0xB98E,0xB9AC,0xB9AD,0xB9B0, +0xB9B4,0xB9BC,0xB9BD,0xB9BF,0xB9C1,0xB9C8,0xB9C9,0xB9CC, +0xB9CE,0xB9CF,0xB9D0,0xB9D1,0xB9D2,0xB9D8,0xB9D9,0xB9DB, +0xB9DD,0xB9DE,0xB9E1,0xB9E3,0xB9E4,0xB9E5,0xB9E8,0xB9EC, +0xB9F4,0xB9F5,0xB9F7,0xB9F8,0xB9F9,0xB9FA,0xBA00,0xBA01, +0xBA08,0xBA15,0xBA38,0xBA39,0xBA3C,0xBA40,0xBA42,0xBA48, +0xBA49,0xBA4B,0xBA4D,0xBA4E,0xBA53,0xBA54,0xBA55,0xBA58, +0xBA5C,0xBA64,0xBA65,0xBA67,0xBA68,0xBA69,0xBA70,0xBA71, +0xBA74,0xBA78,0xBA83,0xBA84,0xBA85,0xBA87,0xBA8C,0xBAA8, +0xBAA9,0xBAAB,0xBAAC,0xBAB0,0xBAB2,0xBAB8,0xBAB9,0xBABB, +0xBABD,0xBAC4,0xBAC8,0xBAD8,0xBAD9,0xBAFC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD22A,0xD22B,0xD22E,0xD22F,0xD231,0xD232,0xD233,0xD235, +0xD236,0xD237,0xD238,0xD239,0xD23A,0xD23B,0xD23E,0xD240, +0xD242,0xD243,0xD244,0xD245,0xD246,0xD247,0xD249,0xD24A, +0xD24B,0xD24C, 0, 0, 0, 0, 0, 0, +0xD24D,0xD24E,0xD24F,0xD250,0xD251,0xD252,0xD253,0xD254, +0xD255,0xD256,0xD257,0xD258,0xD259,0xD25A,0xD25B,0xD25D, +0xD25E,0xD25F,0xD260,0xD261,0xD262,0xD263,0xD265,0xD266, +0xD267,0xD268, 0, 0, 0, 0, 0, 0, +0xD269,0xD26A,0xD26B,0xD26C,0xD26D,0xD26E,0xD26F,0xD270, +0xD271,0xD272,0xD273,0xD274,0xD275,0xD276,0xD277,0xD278, +0xD279,0xD27A,0xD27B,0xD27C,0xD27D,0xD27E,0xD27F,0xD282, +0xD283,0xD285,0xD286,0xD287,0xD289,0xD28A,0xD28B,0xD28C, +0xBB00,0xBB04,0xBB0D,0xBB0F,0xBB11,0xBB18,0xBB1C,0xBB20, +0xBB29,0xBB2B,0xBB34,0xBB35,0xBB36,0xBB38,0xBB3B,0xBB3C, +0xBB3D,0xBB3E,0xBB44,0xBB45,0xBB47,0xBB49,0xBB4D,0xBB4F, +0xBB50,0xBB54,0xBB58,0xBB61,0xBB63,0xBB6C,0xBB88,0xBB8C, +0xBB90,0xBBA4,0xBBA8,0xBBAC,0xBBB4,0xBBB7,0xBBC0,0xBBC4, +0xBBC8,0xBBD0,0xBBD3,0xBBF8,0xBBF9,0xBBFC,0xBBFF,0xBC00, +0xBC02,0xBC08,0xBC09,0xBC0B,0xBC0C,0xBC0D,0xBC0F,0xBC11, +0xBC14,0xBC15,0xBC16,0xBC17,0xBC18,0xBC1B,0xBC1C,0xBC1D, +0xBC1E,0xBC1F,0xBC24,0xBC25,0xBC27,0xBC29,0xBC2D,0xBC30, +0xBC31,0xBC34,0xBC38,0xBC40,0xBC41,0xBC43,0xBC44,0xBC45, +0xBC49,0xBC4C,0xBC4D,0xBC50,0xBC5D,0xBC84,0xBC85,0xBC88, +0xBC8B,0xBC8C,0xBC8E,0xBC94,0xBC95,0xBC97, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD28D,0xD28E,0xD28F,0xD292,0xD293,0xD294,0xD296,0xD297, +0xD298,0xD299,0xD29A,0xD29B,0xD29D,0xD29E,0xD29F,0xD2A1, +0xD2A2,0xD2A3,0xD2A5,0xD2A6,0xD2A7,0xD2A8,0xD2A9,0xD2AA, +0xD2AB,0xD2AD, 0, 0, 0, 0, 0, 0, +0xD2AE,0xD2AF,0xD2B0,0xD2B2,0xD2B3,0xD2B4,0xD2B5,0xD2B6, +0xD2B7,0xD2BA,0xD2BB,0xD2BD,0xD2BE,0xD2C1,0xD2C3,0xD2C4, +0xD2C5,0xD2C6,0xD2C7,0xD2CA,0xD2CC,0xD2CD,0xD2CE,0xD2CF, +0xD2D0,0xD2D1, 0, 0, 0, 0, 0, 0, +0xD2D2,0xD2D3,0xD2D5,0xD2D6,0xD2D7,0xD2D9,0xD2DA,0xD2DB, +0xD2DD,0xD2DE,0xD2DF,0xD2E0,0xD2E1,0xD2E2,0xD2E3,0xD2E6, +0xD2E7,0xD2E8,0xD2E9,0xD2EA,0xD2EB,0xD2EC,0xD2ED,0xD2EE, +0xD2EF,0xD2F2,0xD2F3,0xD2F5,0xD2F6,0xD2F7,0xD2F9,0xD2FA, +0xBC99,0xBC9A,0xBCA0,0xBCA1,0xBCA4,0xBCA7,0xBCA8,0xBCB0, +0xBCB1,0xBCB3,0xBCB4,0xBCB5,0xBCBC,0xBCBD,0xBCC0,0xBCC4, +0xBCCD,0xBCCF,0xBCD0,0xBCD1,0xBCD5,0xBCD8,0xBCDC,0xBCF4, +0xBCF5,0xBCF6,0xBCF8,0xBCFC,0xBD04,0xBD05,0xBD07,0xBD09, +0xBD10,0xBD14,0xBD24,0xBD2C,0xBD40,0xBD48,0xBD49,0xBD4C, +0xBD50,0xBD58,0xBD59,0xBD64,0xBD68,0xBD80,0xBD81,0xBD84, +0xBD87,0xBD88,0xBD89,0xBD8A,0xBD90,0xBD91,0xBD93,0xBD95, +0xBD99,0xBD9A,0xBD9C,0xBDA4,0xBDB0,0xBDB8,0xBDD4,0xBDD5, +0xBDD8,0xBDDC,0xBDE9,0xBDF0,0xBDF4,0xBDF8,0xBE00,0xBE03, +0xBE05,0xBE0C,0xBE0D,0xBE10,0xBE14,0xBE1C,0xBE1D,0xBE1F, +0xBE44,0xBE45,0xBE48,0xBE4C,0xBE4E,0xBE54,0xBE55,0xBE57, +0xBE59,0xBE5A,0xBE5B,0xBE60,0xBE61,0xBE64, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD2FB,0xD2FC,0xD2FD,0xD2FE,0xD2FF,0xD302,0xD304,0xD306, +0xD307,0xD308,0xD309,0xD30A,0xD30B,0xD30F,0xD311,0xD312, +0xD313,0xD315,0xD317,0xD318,0xD319,0xD31A,0xD31B,0xD31E, +0xD322,0xD323, 0, 0, 0, 0, 0, 0, +0xD324,0xD326,0xD327,0xD32A,0xD32B,0xD32D,0xD32E,0xD32F, +0xD331,0xD332,0xD333,0xD334,0xD335,0xD336,0xD337,0xD33A, +0xD33E,0xD33F,0xD340,0xD341,0xD342,0xD343,0xD346,0xD347, +0xD348,0xD349, 0, 0, 0, 0, 0, 0, +0xD34A,0xD34B,0xD34C,0xD34D,0xD34E,0xD34F,0xD350,0xD351, +0xD352,0xD353,0xD354,0xD355,0xD356,0xD357,0xD358,0xD359, +0xD35A,0xD35B,0xD35C,0xD35D,0xD35E,0xD35F,0xD360,0xD361, +0xD362,0xD363,0xD364,0xD365,0xD366,0xD367,0xD368,0xD369, +0xBE68,0xBE6A,0xBE70,0xBE71,0xBE73,0xBE74,0xBE75,0xBE7B, +0xBE7C,0xBE7D,0xBE80,0xBE84,0xBE8C,0xBE8D,0xBE8F,0xBE90, +0xBE91,0xBE98,0xBE99,0xBEA8,0xBED0,0xBED1,0xBED4,0xBED7, +0xBED8,0xBEE0,0xBEE3,0xBEE4,0xBEE5,0xBEEC,0xBF01,0xBF08, +0xBF09,0xBF18,0xBF19,0xBF1B,0xBF1C,0xBF1D,0xBF40,0xBF41, +0xBF44,0xBF48,0xBF50,0xBF51,0xBF55,0xBF94,0xBFB0,0xBFC5, +0xBFCC,0xBFCD,0xBFD0,0xBFD4,0xBFDC,0xBFDF,0xBFE1,0xC03C, +0xC051,0xC058,0xC05C,0xC060,0xC068,0xC069,0xC090,0xC091, +0xC094,0xC098,0xC0A0,0xC0A1,0xC0A3,0xC0A5,0xC0AC,0xC0AD, +0xC0AF,0xC0B0,0xC0B3,0xC0B4,0xC0B5,0xC0B6,0xC0BC,0xC0BD, +0xC0BF,0xC0C0,0xC0C1,0xC0C5,0xC0C8,0xC0C9,0xC0CC,0xC0D0, +0xC0D8,0xC0D9,0xC0DB,0xC0DC,0xC0DD,0xC0E4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD36A,0xD36B,0xD36C,0xD36D,0xD36E,0xD36F,0xD370,0xD371, +0xD372,0xD373,0xD374,0xD375,0xD376,0xD377,0xD378,0xD379, +0xD37A,0xD37B,0xD37E,0xD37F,0xD381,0xD382,0xD383,0xD385, +0xD386,0xD387, 0, 0, 0, 0, 0, 0, +0xD388,0xD389,0xD38A,0xD38B,0xD38E,0xD392,0xD393,0xD394, +0xD395,0xD396,0xD397,0xD39A,0xD39B,0xD39D,0xD39E,0xD39F, +0xD3A1,0xD3A2,0xD3A3,0xD3A4,0xD3A5,0xD3A6,0xD3A7,0xD3AA, +0xD3AC,0xD3AE, 0, 0, 0, 0, 0, 0, +0xD3AF,0xD3B0,0xD3B1,0xD3B2,0xD3B3,0xD3B5,0xD3B6,0xD3B7, +0xD3B9,0xD3BA,0xD3BB,0xD3BD,0xD3BE,0xD3BF,0xD3C0,0xD3C1, +0xD3C2,0xD3C3,0xD3C6,0xD3C7,0xD3CA,0xD3CB,0xD3CC,0xD3CD, +0xD3CE,0xD3CF,0xD3D1,0xD3D2,0xD3D3,0xD3D4,0xD3D5,0xD3D6, +0xC0E5,0xC0E8,0xC0EC,0xC0F4,0xC0F5,0xC0F7,0xC0F9,0xC100, +0xC104,0xC108,0xC110,0xC115,0xC11C,0xC11D,0xC11E,0xC11F, +0xC120,0xC123,0xC124,0xC126,0xC127,0xC12C,0xC12D,0xC12F, +0xC130,0xC131,0xC136,0xC138,0xC139,0xC13C,0xC140,0xC148, +0xC149,0xC14B,0xC14C,0xC14D,0xC154,0xC155,0xC158,0xC15C, +0xC164,0xC165,0xC167,0xC168,0xC169,0xC170,0xC174,0xC178, +0xC185,0xC18C,0xC18D,0xC18E,0xC190,0xC194,0xC196,0xC19C, +0xC19D,0xC19F,0xC1A1,0xC1A5,0xC1A8,0xC1A9,0xC1AC,0xC1B0, +0xC1BD,0xC1C4,0xC1C8,0xC1CC,0xC1D4,0xC1D7,0xC1D8,0xC1E0, +0xC1E4,0xC1E8,0xC1F0,0xC1F1,0xC1F3,0xC1FC,0xC1FD,0xC200, +0xC204,0xC20C,0xC20D,0xC20F,0xC211,0xC218,0xC219,0xC21C, +0xC21F,0xC220,0xC228,0xC229,0xC22B,0xC22D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD3D7,0xD3D9,0xD3DA,0xD3DB,0xD3DC,0xD3DD,0xD3DE,0xD3DF, +0xD3E0,0xD3E2,0xD3E4,0xD3E5,0xD3E6,0xD3E7,0xD3E8,0xD3E9, +0xD3EA,0xD3EB,0xD3EE,0xD3EF,0xD3F1,0xD3F2,0xD3F3,0xD3F5, +0xD3F6,0xD3F7, 0, 0, 0, 0, 0, 0, +0xD3F8,0xD3F9,0xD3FA,0xD3FB,0xD3FE,0xD400,0xD402,0xD403, +0xD404,0xD405,0xD406,0xD407,0xD409,0xD40A,0xD40B,0xD40C, +0xD40D,0xD40E,0xD40F,0xD410,0xD411,0xD412,0xD413,0xD414, +0xD415,0xD416, 0, 0, 0, 0, 0, 0, +0xD417,0xD418,0xD419,0xD41A,0xD41B,0xD41C,0xD41E,0xD41F, +0xD420,0xD421,0xD422,0xD423,0xD424,0xD425,0xD426,0xD427, +0xD428,0xD429,0xD42A,0xD42B,0xD42C,0xD42D,0xD42E,0xD42F, +0xD430,0xD431,0xD432,0xD433,0xD434,0xD435,0xD436,0xD437, +0xC22F,0xC231,0xC232,0xC234,0xC248,0xC250,0xC251,0xC254, +0xC258,0xC260,0xC265,0xC26C,0xC26D,0xC270,0xC274,0xC27C, +0xC27D,0xC27F,0xC281,0xC288,0xC289,0xC290,0xC298,0xC29B, +0xC29D,0xC2A4,0xC2A5,0xC2A8,0xC2AC,0xC2AD,0xC2B4,0xC2B5, +0xC2B7,0xC2B9,0xC2DC,0xC2DD,0xC2E0,0xC2E3,0xC2E4,0xC2EB, +0xC2EC,0xC2ED,0xC2EF,0xC2F1,0xC2F6,0xC2F8,0xC2F9,0xC2FB, +0xC2FC,0xC300,0xC308,0xC309,0xC30C,0xC30D,0xC313,0xC314, +0xC315,0xC318,0xC31C,0xC324,0xC325,0xC328,0xC329,0xC345, +0xC368,0xC369,0xC36C,0xC370,0xC372,0xC378,0xC379,0xC37C, +0xC37D,0xC384,0xC388,0xC38C,0xC3C0,0xC3D8,0xC3D9,0xC3DC, +0xC3DF,0xC3E0,0xC3E2,0xC3E8,0xC3E9,0xC3ED,0xC3F4,0xC3F5, +0xC3F8,0xC408,0xC410,0xC424,0xC42C,0xC430, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD438,0xD439,0xD43A,0xD43B,0xD43C,0xD43D,0xD43E,0xD43F, +0xD441,0xD442,0xD443,0xD445,0xD446,0xD447,0xD448,0xD449, +0xD44A,0xD44B,0xD44C,0xD44D,0xD44E,0xD44F,0xD450,0xD451, +0xD452,0xD453, 0, 0, 0, 0, 0, 0, +0xD454,0xD455,0xD456,0xD457,0xD458,0xD459,0xD45A,0xD45B, +0xD45D,0xD45E,0xD45F,0xD461,0xD462,0xD463,0xD465,0xD466, +0xD467,0xD468,0xD469,0xD46A,0xD46B,0xD46C,0xD46E,0xD470, +0xD471,0xD472, 0, 0, 0, 0, 0, 0, +0xD473,0xD474,0xD475,0xD476,0xD477,0xD47A,0xD47B,0xD47D, +0xD47E,0xD481,0xD483,0xD484,0xD485,0xD486,0xD487,0xD48A, +0xD48C,0xD48E,0xD48F,0xD490,0xD491,0xD492,0xD493,0xD495, +0xD496,0xD497,0xD498,0xD499,0xD49A,0xD49B,0xD49C,0xD49D, +0xC434,0xC43C,0xC43D,0xC448,0xC464,0xC465,0xC468,0xC46C, +0xC474,0xC475,0xC479,0xC480,0xC494,0xC49C,0xC4B8,0xC4BC, +0xC4E9,0xC4F0,0xC4F1,0xC4F4,0xC4F8,0xC4FA,0xC4FF,0xC500, +0xC501,0xC50C,0xC510,0xC514,0xC51C,0xC528,0xC529,0xC52C, +0xC530,0xC538,0xC539,0xC53B,0xC53D,0xC544,0xC545,0xC548, +0xC549,0xC54A,0xC54C,0xC54D,0xC54E,0xC553,0xC554,0xC555, +0xC557,0xC558,0xC559,0xC55D,0xC55E,0xC560,0xC561,0xC564, +0xC568,0xC570,0xC571,0xC573,0xC574,0xC575,0xC57C,0xC57D, +0xC580,0xC584,0xC587,0xC58C,0xC58D,0xC58F,0xC591,0xC595, +0xC597,0xC598,0xC59C,0xC5A0,0xC5A9,0xC5B4,0xC5B5,0xC5B8, +0xC5B9,0xC5BB,0xC5BC,0xC5BD,0xC5BE,0xC5C4,0xC5C5,0xC5C6, +0xC5C7,0xC5C8,0xC5C9,0xC5CA,0xC5CC,0xC5CE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD49E,0xD49F,0xD4A0,0xD4A1,0xD4A2,0xD4A3,0xD4A4,0xD4A5, +0xD4A6,0xD4A7,0xD4A8,0xD4AA,0xD4AB,0xD4AC,0xD4AD,0xD4AE, +0xD4AF,0xD4B0,0xD4B1,0xD4B2,0xD4B3,0xD4B4,0xD4B5,0xD4B6, +0xD4B7,0xD4B8, 0, 0, 0, 0, 0, 0, +0xD4B9,0xD4BA,0xD4BB,0xD4BC,0xD4BD,0xD4BE,0xD4BF,0xD4C0, +0xD4C1,0xD4C2,0xD4C3,0xD4C4,0xD4C5,0xD4C6,0xD4C7,0xD4C8, +0xD4C9,0xD4CA,0xD4CB,0xD4CD,0xD4CE,0xD4CF,0xD4D1,0xD4D2, +0xD4D3,0xD4D5, 0, 0, 0, 0, 0, 0, +0xD4D6,0xD4D7,0xD4D8,0xD4D9,0xD4DA,0xD4DB,0xD4DD,0xD4DE, +0xD4E0,0xD4E1,0xD4E2,0xD4E3,0xD4E4,0xD4E5,0xD4E6,0xD4E7, +0xD4E9,0xD4EA,0xD4EB,0xD4ED,0xD4EE,0xD4EF,0xD4F1,0xD4F2, +0xD4F3,0xD4F4,0xD4F5,0xD4F6,0xD4F7,0xD4F9,0xD4FA,0xD4FC, +0xC5D0,0xC5D1,0xC5D4,0xC5D8,0xC5E0,0xC5E1,0xC5E3,0xC5E5, +0xC5EC,0xC5ED,0xC5EE,0xC5F0,0xC5F4,0xC5F6,0xC5F7,0xC5FC, +0xC5FD,0xC5FE,0xC5FF,0xC600,0xC601,0xC605,0xC606,0xC607, +0xC608,0xC60C,0xC610,0xC618,0xC619,0xC61B,0xC61C,0xC624, +0xC625,0xC628,0xC62C,0xC62D,0xC62E,0xC630,0xC633,0xC634, +0xC635,0xC637,0xC639,0xC63B,0xC640,0xC641,0xC644,0xC648, +0xC650,0xC651,0xC653,0xC654,0xC655,0xC65C,0xC65D,0xC660, +0xC66C,0xC66F,0xC671,0xC678,0xC679,0xC67C,0xC680,0xC688, +0xC689,0xC68B,0xC68D,0xC694,0xC695,0xC698,0xC69C,0xC6A4, +0xC6A5,0xC6A7,0xC6A9,0xC6B0,0xC6B1,0xC6B4,0xC6B8,0xC6B9, +0xC6BA,0xC6C0,0xC6C1,0xC6C3,0xC6C5,0xC6CC,0xC6CD,0xC6D0, +0xC6D4,0xC6DC,0xC6DD,0xC6E0,0xC6E1,0xC6E8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD4FE,0xD4FF,0xD500,0xD501,0xD502,0xD503,0xD505,0xD506, +0xD507,0xD509,0xD50A,0xD50B,0xD50D,0xD50E,0xD50F,0xD510, +0xD511,0xD512,0xD513,0xD516,0xD518,0xD519,0xD51A,0xD51B, +0xD51C,0xD51D, 0, 0, 0, 0, 0, 0, +0xD51E,0xD51F,0xD520,0xD521,0xD522,0xD523,0xD524,0xD525, +0xD526,0xD527,0xD528,0xD529,0xD52A,0xD52B,0xD52C,0xD52D, +0xD52E,0xD52F,0xD530,0xD531,0xD532,0xD533,0xD534,0xD535, +0xD536,0xD537, 0, 0, 0, 0, 0, 0, +0xD538,0xD539,0xD53A,0xD53B,0xD53E,0xD53F,0xD541,0xD542, +0xD543,0xD545,0xD546,0xD547,0xD548,0xD549,0xD54A,0xD54B, +0xD54E,0xD550,0xD552,0xD553,0xD554,0xD555,0xD556,0xD557, +0xD55A,0xD55B,0xD55D,0xD55E,0xD55F,0xD561,0xD562,0xD563, +0xC6E9,0xC6EC,0xC6F0,0xC6F8,0xC6F9,0xC6FD,0xC704,0xC705, +0xC708,0xC70C,0xC714,0xC715,0xC717,0xC719,0xC720,0xC721, +0xC724,0xC728,0xC730,0xC731,0xC733,0xC735,0xC737,0xC73C, +0xC73D,0xC740,0xC744,0xC74A,0xC74C,0xC74D,0xC74F,0xC751, +0xC752,0xC753,0xC754,0xC755,0xC756,0xC757,0xC758,0xC75C, +0xC760,0xC768,0xC76B,0xC774,0xC775,0xC778,0xC77C,0xC77D, +0xC77E,0xC783,0xC784,0xC785,0xC787,0xC788,0xC789,0xC78A, +0xC78E,0xC790,0xC791,0xC794,0xC796,0xC797,0xC798,0xC79A, +0xC7A0,0xC7A1,0xC7A3,0xC7A4,0xC7A5,0xC7A6,0xC7AC,0xC7AD, +0xC7B0,0xC7B4,0xC7BC,0xC7BD,0xC7BF,0xC7C0,0xC7C1,0xC7C8, +0xC7C9,0xC7CC,0xC7CE,0xC7D0,0xC7D8,0xC7DD,0xC7E4,0xC7E8, +0xC7EC,0xC800,0xC801,0xC804,0xC808,0xC80A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD564,0xD566,0xD567,0xD56A,0xD56C,0xD56E,0xD56F,0xD570, +0xD571,0xD572,0xD573,0xD576,0xD577,0xD579,0xD57A,0xD57B, +0xD57D,0xD57E,0xD57F,0xD580,0xD581,0xD582,0xD583,0xD586, +0xD58A,0xD58B, 0, 0, 0, 0, 0, 0, +0xD58C,0xD58D,0xD58E,0xD58F,0xD591,0xD592,0xD593,0xD594, +0xD595,0xD596,0xD597,0xD598,0xD599,0xD59A,0xD59B,0xD59C, +0xD59D,0xD59E,0xD59F,0xD5A0,0xD5A1,0xD5A2,0xD5A3,0xD5A4, +0xD5A6,0xD5A7, 0, 0, 0, 0, 0, 0, +0xD5A8,0xD5A9,0xD5AA,0xD5AB,0xD5AC,0xD5AD,0xD5AE,0xD5AF, +0xD5B0,0xD5B1,0xD5B2,0xD5B3,0xD5B4,0xD5B5,0xD5B6,0xD5B7, +0xD5B8,0xD5B9,0xD5BA,0xD5BB,0xD5BC,0xD5BD,0xD5BE,0xD5BF, +0xD5C0,0xD5C1,0xD5C2,0xD5C3,0xD5C4,0xD5C5,0xD5C6,0xD5C7, +0xC810,0xC811,0xC813,0xC815,0xC816,0xC81C,0xC81D,0xC820, +0xC824,0xC82C,0xC82D,0xC82F,0xC831,0xC838,0xC83C,0xC840, +0xC848,0xC849,0xC84C,0xC84D,0xC854,0xC870,0xC871,0xC874, +0xC878,0xC87A,0xC880,0xC881,0xC883,0xC885,0xC886,0xC887, +0xC88B,0xC88C,0xC88D,0xC894,0xC89D,0xC89F,0xC8A1,0xC8A8, +0xC8BC,0xC8BD,0xC8C4,0xC8C8,0xC8CC,0xC8D4,0xC8D5,0xC8D7, +0xC8D9,0xC8E0,0xC8E1,0xC8E4,0xC8F5,0xC8FC,0xC8FD,0xC900, +0xC904,0xC905,0xC906,0xC90C,0xC90D,0xC90F,0xC911,0xC918, +0xC92C,0xC934,0xC950,0xC951,0xC954,0xC958,0xC960,0xC961, +0xC963,0xC96C,0xC970,0xC974,0xC97C,0xC988,0xC989,0xC98C, +0xC990,0xC998,0xC999,0xC99B,0xC99D,0xC9C0,0xC9C1,0xC9C4, +0xC9C7,0xC9C8,0xC9CA,0xC9D0,0xC9D1,0xC9D3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD5CA,0xD5CB,0xD5CD,0xD5CE,0xD5CF,0xD5D1,0xD5D3,0xD5D4, +0xD5D5,0xD5D6,0xD5D7,0xD5DA,0xD5DC,0xD5DE,0xD5DF,0xD5E0, +0xD5E1,0xD5E2,0xD5E3,0xD5E6,0xD5E7,0xD5E9,0xD5EA,0xD5EB, +0xD5ED,0xD5EE, 0, 0, 0, 0, 0, 0, +0xD5EF,0xD5F0,0xD5F1,0xD5F2,0xD5F3,0xD5F6,0xD5F8,0xD5FA, +0xD5FB,0xD5FC,0xD5FD,0xD5FE,0xD5FF,0xD602,0xD603,0xD605, +0xD606,0xD607,0xD609,0xD60A,0xD60B,0xD60C,0xD60D,0xD60E, +0xD60F,0xD612, 0, 0, 0, 0, 0, 0, +0xD616,0xD617,0xD618,0xD619,0xD61A,0xD61B,0xD61D,0xD61E, +0xD61F,0xD621,0xD622,0xD623,0xD625,0xD626,0xD627,0xD628, +0xD629,0xD62A,0xD62B,0xD62C,0xD62E,0xD62F,0xD630,0xD631, +0xD632,0xD633,0xD634,0xD635,0xD636,0xD637,0xD63A,0xD63B, +0xC9D5,0xC9D6,0xC9D9,0xC9DA,0xC9DC,0xC9DD,0xC9E0,0xC9E2, +0xC9E4,0xC9E7,0xC9EC,0xC9ED,0xC9EF,0xC9F0,0xC9F1,0xC9F8, +0xC9F9,0xC9FC,0xCA00,0xCA08,0xCA09,0xCA0B,0xCA0C,0xCA0D, +0xCA14,0xCA18,0xCA29,0xCA4C,0xCA4D,0xCA50,0xCA54,0xCA5C, +0xCA5D,0xCA5F,0xCA60,0xCA61,0xCA68,0xCA7D,0xCA84,0xCA98, +0xCABC,0xCABD,0xCAC0,0xCAC4,0xCACC,0xCACD,0xCACF,0xCAD1, +0xCAD3,0xCAD8,0xCAD9,0xCAE0,0xCAEC,0xCAF4,0xCB08,0xCB10, +0xCB14,0xCB18,0xCB20,0xCB21,0xCB41,0xCB48,0xCB49,0xCB4C, +0xCB50,0xCB58,0xCB59,0xCB5D,0xCB64,0xCB78,0xCB79,0xCB9C, +0xCBB8,0xCBD4,0xCBE4,0xCBE7,0xCBE9,0xCC0C,0xCC0D,0xCC10, +0xCC14,0xCC1C,0xCC1D,0xCC21,0xCC22,0xCC27,0xCC28,0xCC29, +0xCC2C,0xCC2E,0xCC30,0xCC38,0xCC39,0xCC3B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD63D,0xD63E,0xD63F,0xD641,0xD642,0xD643,0xD644,0xD646, +0xD647,0xD64A,0xD64C,0xD64E,0xD64F,0xD650,0xD652,0xD653, +0xD656,0xD657,0xD659,0xD65A,0xD65B,0xD65D,0xD65E,0xD65F, +0xD660,0xD661, 0, 0, 0, 0, 0, 0, +0xD662,0xD663,0xD664,0xD665,0xD666,0xD668,0xD66A,0xD66B, +0xD66C,0xD66D,0xD66E,0xD66F,0xD672,0xD673,0xD675,0xD676, +0xD677,0xD678,0xD679,0xD67A,0xD67B,0xD67C,0xD67D,0xD67E, +0xD67F,0xD680, 0, 0, 0, 0, 0, 0, +0xD681,0xD682,0xD684,0xD686,0xD687,0xD688,0xD689,0xD68A, +0xD68B,0xD68E,0xD68F,0xD691,0xD692,0xD693,0xD695,0xD696, +0xD697,0xD698,0xD699,0xD69A,0xD69B,0xD69C,0xD69E,0xD6A0, +0xD6A2,0xD6A3,0xD6A4,0xD6A5,0xD6A6,0xD6A7,0xD6A9,0xD6AA, +0xCC3C,0xCC3D,0xCC3E,0xCC44,0xCC45,0xCC48,0xCC4C,0xCC54, +0xCC55,0xCC57,0xCC58,0xCC59,0xCC60,0xCC64,0xCC66,0xCC68, +0xCC70,0xCC75,0xCC98,0xCC99,0xCC9C,0xCCA0,0xCCA8,0xCCA9, +0xCCAB,0xCCAC,0xCCAD,0xCCB4,0xCCB5,0xCCB8,0xCCBC,0xCCC4, +0xCCC5,0xCCC7,0xCCC9,0xCCD0,0xCCD4,0xCCE4,0xCCEC,0xCCF0, +0xCD01,0xCD08,0xCD09,0xCD0C,0xCD10,0xCD18,0xCD19,0xCD1B, +0xCD1D,0xCD24,0xCD28,0xCD2C,0xCD39,0xCD5C,0xCD60,0xCD64, +0xCD6C,0xCD6D,0xCD6F,0xCD71,0xCD78,0xCD88,0xCD94,0xCD95, +0xCD98,0xCD9C,0xCDA4,0xCDA5,0xCDA7,0xCDA9,0xCDB0,0xCDC4, +0xCDCC,0xCDD0,0xCDE8,0xCDEC,0xCDF0,0xCDF8,0xCDF9,0xCDFB, +0xCDFD,0xCE04,0xCE08,0xCE0C,0xCE14,0xCE19,0xCE20,0xCE21, +0xCE24,0xCE28,0xCE30,0xCE31,0xCE33,0xCE35, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD6AB,0xD6AD,0xD6AE,0xD6AF,0xD6B1,0xD6B2,0xD6B3,0xD6B4, +0xD6B5,0xD6B6,0xD6B7,0xD6B8,0xD6BA,0xD6BC,0xD6BD,0xD6BE, +0xD6BF,0xD6C0,0xD6C1,0xD6C2,0xD6C3,0xD6C6,0xD6C7,0xD6C9, +0xD6CA,0xD6CB, 0, 0, 0, 0, 0, 0, +0xD6CD,0xD6CE,0xD6CF,0xD6D0,0xD6D2,0xD6D3,0xD6D5,0xD6D6, +0xD6D8,0xD6DA,0xD6DB,0xD6DC,0xD6DD,0xD6DE,0xD6DF,0xD6E1, +0xD6E2,0xD6E3,0xD6E5,0xD6E6,0xD6E7,0xD6E9,0xD6EA,0xD6EB, +0xD6EC,0xD6ED, 0, 0, 0, 0, 0, 0, +0xD6EE,0xD6EF,0xD6F1,0xD6F2,0xD6F3,0xD6F4,0xD6F6,0xD6F7, +0xD6F8,0xD6F9,0xD6FA,0xD6FB,0xD6FE,0xD6FF,0xD701,0xD702, +0xD703,0xD705,0xD706,0xD707,0xD708,0xD709,0xD70A,0xD70B, +0xD70C,0xD70D,0xD70E,0xD70F,0xD710,0xD712,0xD713,0xD714, +0xCE58,0xCE59,0xCE5C,0xCE5F,0xCE60,0xCE61,0xCE68,0xCE69, +0xCE6B,0xCE6D,0xCE74,0xCE75,0xCE78,0xCE7C,0xCE84,0xCE85, +0xCE87,0xCE89,0xCE90,0xCE91,0xCE94,0xCE98,0xCEA0,0xCEA1, +0xCEA3,0xCEA4,0xCEA5,0xCEAC,0xCEAD,0xCEC1,0xCEE4,0xCEE5, +0xCEE8,0xCEEB,0xCEEC,0xCEF4,0xCEF5,0xCEF7,0xCEF8,0xCEF9, +0xCF00,0xCF01,0xCF04,0xCF08,0xCF10,0xCF11,0xCF13,0xCF15, +0xCF1C,0xCF20,0xCF24,0xCF2C,0xCF2D,0xCF2F,0xCF30,0xCF31, +0xCF38,0xCF54,0xCF55,0xCF58,0xCF5C,0xCF64,0xCF65,0xCF67, +0xCF69,0xCF70,0xCF71,0xCF74,0xCF78,0xCF80,0xCF85,0xCF8C, +0xCFA1,0xCFA8,0xCFB0,0xCFC4,0xCFE0,0xCFE1,0xCFE4,0xCFE8, +0xCFF0,0xCFF1,0xCFF3,0xCFF5,0xCFFC,0xD000,0xD004,0xD011, +0xD018,0xD02D,0xD034,0xD035,0xD038,0xD03C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD715,0xD716,0xD717,0xD71A,0xD71B,0xD71D,0xD71E,0xD71F, +0xD721,0xD722,0xD723,0xD724,0xD725,0xD726,0xD727,0xD72A, +0xD72C,0xD72E,0xD72F,0xD730,0xD731,0xD732,0xD733,0xD736, +0xD737,0xD739, 0, 0, 0, 0, 0, 0, +0xD73A,0xD73B,0xD73D,0xD73E,0xD73F,0xD740,0xD741,0xD742, +0xD743,0xD745,0xD746,0xD748,0xD74A,0xD74B,0xD74C,0xD74D, +0xD74E,0xD74F,0xD752,0xD753,0xD755,0xD75A,0xD75B,0xD75C, +0xD75D,0xD75E, 0, 0, 0, 0, 0, 0, +0xD75F,0xD762,0xD764,0xD766,0xD767,0xD768,0xD76A,0xD76B, +0xD76D,0xD76E,0xD76F,0xD771,0xD772,0xD773,0xD775,0xD776, +0xD777,0xD778,0xD779,0xD77A,0xD77B,0xD77E,0xD77F,0xD780, +0xD782,0xD783,0xD784,0xD785,0xD786,0xD787,0xD78A,0xD78B, +0xD044,0xD045,0xD047,0xD049,0xD050,0xD054,0xD058,0xD060, +0xD06C,0xD06D,0xD070,0xD074,0xD07C,0xD07D,0xD081,0xD0A4, +0xD0A5,0xD0A8,0xD0AC,0xD0B4,0xD0B5,0xD0B7,0xD0B9,0xD0C0, +0xD0C1,0xD0C4,0xD0C8,0xD0C9,0xD0D0,0xD0D1,0xD0D3,0xD0D4, +0xD0D5,0xD0DC,0xD0DD,0xD0E0,0xD0E4,0xD0EC,0xD0ED,0xD0EF, +0xD0F0,0xD0F1,0xD0F8,0xD10D,0xD130,0xD131,0xD134,0xD138, +0xD13A,0xD140,0xD141,0xD143,0xD144,0xD145,0xD14C,0xD14D, +0xD150,0xD154,0xD15C,0xD15D,0xD15F,0xD161,0xD168,0xD16C, +0xD17C,0xD184,0xD188,0xD1A0,0xD1A1,0xD1A4,0xD1A8,0xD1B0, +0xD1B1,0xD1B3,0xD1B5,0xD1BA,0xD1BC,0xD1C0,0xD1D8,0xD1F4, +0xD1F8,0xD207,0xD209,0xD210,0xD22C,0xD22D,0xD230,0xD234, +0xD23C,0xD23D,0xD23F,0xD241,0xD248,0xD25C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD78D,0xD78E,0xD78F,0xD791,0xD792,0xD793,0xD794,0xD795, +0xD796,0xD797,0xD79A,0xD79C,0xD79E,0xD79F,0xD7A0,0xD7A1, +0xD7A2,0xD7A3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD264,0xD280,0xD281,0xD284,0xD288,0xD290,0xD291,0xD295, +0xD29C,0xD2A0,0xD2A4,0xD2AC,0xD2B1,0xD2B8,0xD2B9,0xD2BC, +0xD2BF,0xD2C0,0xD2C2,0xD2C8,0xD2C9,0xD2CB,0xD2D4,0xD2D8, +0xD2DC,0xD2E4,0xD2E5,0xD2F0,0xD2F1,0xD2F4,0xD2F8,0xD300, +0xD301,0xD303,0xD305,0xD30C,0xD30D,0xD30E,0xD310,0xD314, +0xD316,0xD31C,0xD31D,0xD31F,0xD320,0xD321,0xD325,0xD328, +0xD329,0xD32C,0xD330,0xD338,0xD339,0xD33B,0xD33C,0xD33D, +0xD344,0xD345,0xD37C,0xD37D,0xD380,0xD384,0xD38C,0xD38D, +0xD38F,0xD390,0xD391,0xD398,0xD399,0xD39C,0xD3A0,0xD3A8, +0xD3A9,0xD3AB,0xD3AD,0xD3B4,0xD3B8,0xD3BC,0xD3C4,0xD3C5, +0xD3C8,0xD3C9,0xD3D0,0xD3D8,0xD3E1,0xD3E3,0xD3EC,0xD3ED, +0xD3F0,0xD3F4,0xD3FC,0xD3FD,0xD3FF,0xD401, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD408,0xD41D,0xD440,0xD444,0xD45C,0xD460,0xD464,0xD46D, +0xD46F,0xD478,0xD479,0xD47C,0xD47F,0xD480,0xD482,0xD488, +0xD489,0xD48B,0xD48D,0xD494,0xD4A9,0xD4CC,0xD4D0,0xD4D4, +0xD4DC,0xD4DF,0xD4E8,0xD4EC,0xD4F0,0xD4F8,0xD4FB,0xD4FD, +0xD504,0xD508,0xD50C,0xD514,0xD515,0xD517,0xD53C,0xD53D, +0xD540,0xD544,0xD54C,0xD54D,0xD54F,0xD551,0xD558,0xD559, +0xD55C,0xD560,0xD565,0xD568,0xD569,0xD56B,0xD56D,0xD574, +0xD575,0xD578,0xD57C,0xD584,0xD585,0xD587,0xD588,0xD589, +0xD590,0xD5A5,0xD5C8,0xD5C9,0xD5CC,0xD5D0,0xD5D2,0xD5D8, +0xD5D9,0xD5DB,0xD5DD,0xD5E4,0xD5E5,0xD5E8,0xD5EC,0xD5F4, +0xD5F5,0xD5F7,0xD5F9,0xD600,0xD601,0xD604,0xD608,0xD610, +0xD611,0xD613,0xD614,0xD615,0xD61C,0xD620, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD624,0xD62D,0xD638,0xD639,0xD63C,0xD640,0xD645,0xD648, +0xD649,0xD64B,0xD64D,0xD651,0xD654,0xD655,0xD658,0xD65C, +0xD667,0xD669,0xD670,0xD671,0xD674,0xD683,0xD685,0xD68C, +0xD68D,0xD690,0xD694,0xD69D,0xD69F,0xD6A1,0xD6A8,0xD6AC, +0xD6B0,0xD6B9,0xD6BB,0xD6C4,0xD6C5,0xD6C8,0xD6CC,0xD6D1, +0xD6D4,0xD6D7,0xD6D9,0xD6E0,0xD6E4,0xD6E8,0xD6F0,0xD6F5, +0xD6FC,0xD6FD,0xD700,0xD704,0xD711,0xD718,0xD719,0xD71C, +0xD720,0xD728,0xD729,0xD72B,0xD72D,0xD734,0xD735,0xD738, +0xD73C,0xD744,0xD747,0xD749,0xD750,0xD751,0xD754,0xD756, +0xD757,0xD758,0xD759,0xD760,0xD761,0xD763,0xD765,0xD769, +0xD76C,0xD770,0xD774,0xD77C,0xD77D,0xD781,0xD788,0xD789, +0xD78C,0xD790,0xD798,0xD799,0xD79B,0xD79D}; + +/* page 1 0xCAA1-0xFDFE */ +static uint16 tab_ksc5601_uni1[]={ +0x4F3D,0x4F73,0x5047,0x50F9,0x52A0,0x53EF,0x5475,0x54E5, +0x5609,0x5AC1,0x5BB6,0x6687,0x67B6,0x67B7,0x67EF,0x6B4C, +0x73C2,0x75C2,0x7A3C,0x82DB,0x8304,0x8857,0x8888,0x8A36, +0x8CC8,0x8DCF,0x8EFB,0x8FE6,0x99D5,0x523B,0x5374,0x5404, +0x606A,0x6164,0x6BBC,0x73CF,0x811A,0x89BA,0x89D2,0x95A3, +0x4F83,0x520A,0x58BE,0x5978,0x59E6,0x5E72,0x5E79,0x61C7, +0x63C0,0x6746,0x67EC,0x687F,0x6F97,0x764E,0x770B,0x78F5, +0x7A08,0x7AFF,0x7C21,0x809D,0x826E,0x8271,0x8AEB,0x9593, +0x4E6B,0x559D,0x66F7,0x6E34,0x78A3,0x7AED,0x845B,0x8910, +0x874E,0x97A8,0x52D8,0x574E,0x582A,0x5D4C,0x611F,0x61BE, +0x6221,0x6562,0x67D1,0x6A44,0x6E1B,0x7518,0x75B3,0x76E3, +0x77B0,0x7D3A,0x90AF,0x9451,0x9452,0x9F95, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5323,0x5CAC,0x7532,0x80DB,0x9240,0x9598,0x525B,0x5808, +0x59DC,0x5CA1,0x5D17,0x5EB7,0x5F3A,0x5F4A,0x6177,0x6C5F, +0x757A,0x7586,0x7CE0,0x7D73,0x7DB1,0x7F8C,0x8154,0x8221, +0x8591,0x8941,0x8B1B,0x92FC,0x964D,0x9C47,0x4ECB,0x4EF7, +0x500B,0x51F1,0x584F,0x6137,0x613E,0x6168,0x6539,0x69EA, +0x6F11,0x75A5,0x7686,0x76D6,0x7B87,0x82A5,0x84CB,0xF900, +0x93A7,0x958B,0x5580,0x5BA2,0x5751,0xF901,0x7CB3,0x7FB9, +0x91B5,0x5028,0x53BB,0x5C45,0x5DE8,0x62D2,0x636E,0x64DA, +0x64E7,0x6E20,0x70AC,0x795B,0x8DDD,0x8E1E,0xF902,0x907D, +0x9245,0x92F8,0x4E7E,0x4EF6,0x5065,0x5DFE,0x5EFA,0x6106, +0x6957,0x8171,0x8654,0x8E47,0x9375,0x9A2B,0x4E5E,0x5091, +0x6770,0x6840,0x5109,0x528D,0x5292,0x6AA2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x77BC,0x9210,0x9ED4,0x52AB,0x602F,0x8FF2,0x5048,0x61A9, +0x63ED,0x64CA,0x683C,0x6A84,0x6FC0,0x8188,0x89A1,0x9694, +0x5805,0x727D,0x72AC,0x7504,0x7D79,0x7E6D,0x80A9,0x898B, +0x8B74,0x9063,0x9D51,0x6289,0x6C7A,0x6F54,0x7D50,0x7F3A, +0x8A23,0x517C,0x614A,0x7B9D,0x8B19,0x9257,0x938C,0x4EAC, +0x4FD3,0x501E,0x50BE,0x5106,0x52C1,0x52CD,0x537F,0x5770, +0x5883,0x5E9A,0x5F91,0x6176,0x61AC,0x64CE,0x656C,0x666F, +0x66BB,0x66F4,0x6897,0x6D87,0x7085,0x70F1,0x749F,0x74A5, +0x74CA,0x75D9,0x786C,0x78EC,0x7ADF,0x7AF6,0x7D45,0x7D93, +0x8015,0x803F,0x811B,0x8396,0x8B66,0x8F15,0x9015,0x93E1, +0x9803,0x9838,0x9A5A,0x9BE8,0x4FC2,0x5553,0x583A,0x5951, +0x5B63,0x5C46,0x60B8,0x6212,0x6842,0x68B0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x68E8,0x6EAA,0x754C,0x7678,0x78CE,0x7A3D,0x7CFB,0x7E6B, +0x7E7C,0x8A08,0x8AA1,0x8C3F,0x968E,0x9DC4,0x53E4,0x53E9, +0x544A,0x5471,0x56FA,0x59D1,0x5B64,0x5C3B,0x5EAB,0x62F7, +0x6537,0x6545,0x6572,0x66A0,0x67AF,0x69C1,0x6CBD,0x75FC, +0x7690,0x777E,0x7A3F,0x7F94,0x8003,0x80A1,0x818F,0x82E6, +0x82FD,0x83F0,0x85C1,0x8831,0x88B4,0x8AA5,0xF903,0x8F9C, +0x932E,0x96C7,0x9867,0x9AD8,0x9F13,0x54ED,0x659B,0x66F2, +0x688F,0x7A40,0x8C37,0x9D60,0x56F0,0x5764,0x5D11,0x6606, +0x68B1,0x68CD,0x6EFE,0x7428,0x889E,0x9BE4,0x6C68,0xF904, +0x9AA8,0x4F9B,0x516C,0x5171,0x529F,0x5B54,0x5DE5,0x6050, +0x606D,0x62F1,0x63A7,0x653B,0x73D9,0x7A7A,0x86A3,0x8CA2, +0x978F,0x4E32,0x5BE1,0x6208,0x679C,0x74DC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x79D1,0x83D3,0x8A87,0x8AB2,0x8DE8,0x904E,0x934B,0x9846, +0x5ED3,0x69E8,0x85FF,0x90ED,0xF905,0x51A0,0x5B98,0x5BEC, +0x6163,0x68FA,0x6B3E,0x704C,0x742F,0x74D8,0x7BA1,0x7F50, +0x83C5,0x89C0,0x8CAB,0x95DC,0x9928,0x522E,0x605D,0x62EC, +0x9002,0x4F8A,0x5149,0x5321,0x58D9,0x5EE3,0x66E0,0x6D38, +0x709A,0x72C2,0x73D6,0x7B50,0x80F1,0x945B,0x5366,0x639B, +0x7F6B,0x4E56,0x5080,0x584A,0x58DE,0x602A,0x6127,0x62D0, +0x69D0,0x9B41,0x5B8F,0x7D18,0x80B1,0x8F5F,0x4EA4,0x50D1, +0x54AC,0x55AC,0x5B0C,0x5DA0,0x5DE7,0x652A,0x654E,0x6821, +0x6A4B,0x72E1,0x768E,0x77EF,0x7D5E,0x7FF9,0x81A0,0x854E, +0x86DF,0x8F03,0x8F4E,0x90CA,0x9903,0x9A55,0x9BAB,0x4E18, +0x4E45,0x4E5D,0x4EC7,0x4FF1,0x5177,0x52FE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5340,0x53E3,0x53E5,0x548E,0x5614,0x5775,0x57A2,0x5BC7, +0x5D87,0x5ED0,0x61FC,0x62D8,0x6551,0x67B8,0x67E9,0x69CB, +0x6B50,0x6BC6,0x6BEC,0x6C42,0x6E9D,0x7078,0x72D7,0x7396, +0x7403,0x77BF,0x77E9,0x7A76,0x7D7F,0x8009,0x81FC,0x8205, +0x820A,0x82DF,0x8862,0x8B33,0x8CFC,0x8EC0,0x9011,0x90B1, +0x9264,0x92B6,0x99D2,0x9A45,0x9CE9,0x9DD7,0x9F9C,0x570B, +0x5C40,0x83CA,0x97A0,0x97AB,0x9EB4,0x541B,0x7A98,0x7FA4, +0x88D9,0x8ECD,0x90E1,0x5800,0x5C48,0x6398,0x7A9F,0x5BAE, +0x5F13,0x7A79,0x7AAE,0x828E,0x8EAC,0x5026,0x5238,0x52F8, +0x5377,0x5708,0x62F3,0x6372,0x6B0A,0x6DC3,0x7737,0x53A5, +0x7357,0x8568,0x8E76,0x95D5,0x673A,0x6AC3,0x6F70,0x8A6D, +0x8ECC,0x994B,0xF906,0x6677,0x6B78,0x8CB4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9B3C,0xF907,0x53EB,0x572D,0x594E,0x63C6,0x69FB,0x73EA, +0x7845,0x7ABA,0x7AC5,0x7CFE,0x8475,0x898F,0x8D73,0x9035, +0x95A8,0x52FB,0x5747,0x7547,0x7B60,0x83CC,0x921E,0xF908, +0x6A58,0x514B,0x524B,0x5287,0x621F,0x68D8,0x6975,0x9699, +0x50C5,0x52A4,0x52E4,0x61C3,0x65A4,0x6839,0x69FF,0x747E, +0x7B4B,0x82B9,0x83EB,0x89B2,0x8B39,0x8FD1,0x9949,0xF909, +0x4ECA,0x5997,0x64D2,0x6611,0x6A8E,0x7434,0x7981,0x79BD, +0x82A9,0x887E,0x887F,0x895F,0xF90A,0x9326,0x4F0B,0x53CA, +0x6025,0x6271,0x6C72,0x7D1A,0x7D66,0x4E98,0x5162,0x77DC, +0x80AF,0x4F01,0x4F0E,0x5176,0x5180,0x55DC,0x5668,0x573B, +0x57FA,0x57FC,0x5914,0x5947,0x5993,0x5BC4,0x5C90,0x5D0E, +0x5DF1,0x5E7E,0x5FCC,0x6280,0x65D7,0x65E3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x671E,0x671F,0x675E,0x68CB,0x68C4,0x6A5F,0x6B3A,0x6C23, +0x6C7D,0x6C82,0x6DC7,0x7398,0x7426,0x742A,0x7482,0x74A3, +0x7578,0x757F,0x7881,0x78EF,0x7941,0x7947,0x7948,0x797A, +0x7B95,0x7D00,0x7DBA,0x7F88,0x8006,0x802D,0x808C,0x8A18, +0x8B4F,0x8C48,0x8D77,0x9321,0x9324,0x98E2,0x9951,0x9A0E, +0x9A0F,0x9A65,0x9E92,0x7DCA,0x4F76,0x5409,0x62EE,0x6854, +0x91D1,0x55AB,0x513A,0xF90B,0xF90C,0x5A1C,0x61E6,0xF90D, +0x62CF,0x62FF,0xF90E,0xF90F,0xF910,0xF911,0xF912,0xF913, +0x90A3,0xF914,0xF915,0xF916,0xF917,0xF918,0x8AFE,0xF919, +0xF91A,0xF91B,0xF91C,0x6696,0xF91D,0x7156,0xF91E,0xF91F, +0x96E3,0xF920,0x634F,0x637A,0x5357,0xF921,0x678F,0x6960, +0x6E73,0xF922,0x7537,0xF923,0xF924,0xF925, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7D0D,0xF926,0xF927,0x8872,0x56CA,0x5A18,0xF928,0xF929, +0xF92A,0xF92B,0xF92C,0x4E43,0xF92D,0x5167,0x5948,0x67F0, +0x8010,0xF92E,0x5973,0x5E74,0x649A,0x79CA,0x5FF5,0x606C, +0x62C8,0x637B,0x5BE7,0x5BD7,0x52AA,0xF92F,0x5974,0x5F29, +0x6012,0xF930,0xF931,0xF932,0x7459,0xF933,0xF934,0xF935, +0xF936,0xF937,0xF938,0x99D1,0xF939,0xF93A,0xF93B,0xF93C, +0xF93D,0xF93E,0xF93F,0xF940,0xF941,0xF942,0xF943,0x6FC3, +0xF944,0xF945,0x81BF,0x8FB2,0x60F1,0xF946,0xF947,0x8166, +0xF948,0xF949,0x5C3F,0xF94A,0xF94B,0xF94C,0xF94D,0xF94E, +0xF94F,0xF950,0xF951,0x5AE9,0x8A25,0x677B,0x7D10,0xF952, +0xF953,0xF954,0xF955,0xF956,0xF957,0x80FD,0xF958,0xF959, +0x5C3C,0x6CE5,0x533F,0x6EBA,0x591A,0x8336, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4E39,0x4EB6,0x4F46,0x55AE,0x5718,0x58C7,0x5F56,0x65B7, +0x65E6,0x6A80,0x6BB5,0x6E4D,0x77ED,0x7AEF,0x7C1E,0x7DDE, +0x86CB,0x8892,0x9132,0x935B,0x64BB,0x6FBE,0x737A,0x75B8, +0x9054,0x5556,0x574D,0x61BA,0x64D4,0x66C7,0x6DE1,0x6E5B, +0x6F6D,0x6FB9,0x75F0,0x8043,0x81BD,0x8541,0x8983,0x8AC7, +0x8B5A,0x931F,0x6C93,0x7553,0x7B54,0x8E0F,0x905D,0x5510, +0x5802,0x5858,0x5E62,0x6207,0x649E,0x68E0,0x7576,0x7CD6, +0x87B3,0x9EE8,0x4EE3,0x5788,0x576E,0x5927,0x5C0D,0x5CB1, +0x5E36,0x5F85,0x6234,0x64E1,0x73B3,0x81FA,0x888B,0x8CB8, +0x968A,0x9EDB,0x5B85,0x5FB7,0x60B3,0x5012,0x5200,0x5230, +0x5716,0x5835,0x5857,0x5C0E,0x5C60,0x5CF6,0x5D8B,0x5EA6, +0x5F92,0x60BC,0x6311,0x6389,0x6417,0x6843, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x68F9,0x6AC2,0x6DD8,0x6E21,0x6ED4,0x6FE4,0x71FE,0x76DC, +0x7779,0x79B1,0x7A3B,0x8404,0x89A9,0x8CED,0x8DF3,0x8E48, +0x9003,0x9014,0x9053,0x90FD,0x934D,0x9676,0x97DC,0x6BD2, +0x7006,0x7258,0x72A2,0x7368,0x7763,0x79BF,0x7BE4,0x7E9B, +0x8B80,0x58A9,0x60C7,0x6566,0x65FD,0x66BE,0x6C8C,0x711E, +0x71C9,0x8C5A,0x9813,0x4E6D,0x7A81,0x4EDD,0x51AC,0x51CD, +0x52D5,0x540C,0x61A7,0x6771,0x6850,0x68DF,0x6D1E,0x6F7C, +0x75BC,0x77B3,0x7AE5,0x80F4,0x8463,0x9285,0x515C,0x6597, +0x675C,0x6793,0x75D8,0x7AC7,0x8373,0xF95A,0x8C46,0x9017, +0x982D,0x5C6F,0x81C0,0x829A,0x9041,0x906F,0x920D,0x5F97, +0x5D9D,0x6A59,0x71C8,0x767B,0x7B49,0x85E4,0x8B04,0x9127, +0x9A30,0x5587,0x61F6,0xF95B,0x7669,0x7F85, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x863F,0x87BA,0x88F8,0x908F,0xF95C,0x6D1B,0x70D9,0x73DE, +0x7D61,0x843D,0xF95D,0x916A,0x99F1,0xF95E,0x4E82,0x5375, +0x6B04,0x6B12,0x703E,0x721B,0x862D,0x9E1E,0x524C,0x8FA3, +0x5D50,0x64E5,0x652C,0x6B16,0x6FEB,0x7C43,0x7E9C,0x85CD, +0x8964,0x89BD,0x62C9,0x81D8,0x881F,0x5ECA,0x6717,0x6D6A, +0x72FC,0x7405,0x746F,0x8782,0x90DE,0x4F86,0x5D0D,0x5FA0, +0x840A,0x51B7,0x63A0,0x7565,0x4EAE,0x5006,0x5169,0x51C9, +0x6881,0x6A11,0x7CAE,0x7CB1,0x7CE7,0x826F,0x8AD2,0x8F1B, +0x91CF,0x4FB6,0x5137,0x52F5,0x5442,0x5EEC,0x616E,0x623E, +0x65C5,0x6ADA,0x6FFE,0x792A,0x85DC,0x8823,0x95AD,0x9A62, +0x9A6A,0x9E97,0x9ECE,0x529B,0x66C6,0x6B77,0x701D,0x792B, +0x8F62,0x9742,0x6190,0x6200,0x6523,0x6F23, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7149,0x7489,0x7DF4,0x806F,0x84EE,0x8F26,0x9023,0x934A, +0x51BD,0x5217,0x52A3,0x6D0C,0x70C8,0x88C2,0x5EC9,0x6582, +0x6BAE,0x6FC2,0x7C3E,0x7375,0x4EE4,0x4F36,0x56F9,0xF95F, +0x5CBA,0x5DBA,0x601C,0x73B2,0x7B2D,0x7F9A,0x7FCE,0x8046, +0x901E,0x9234,0x96F6,0x9748,0x9818,0x9F61,0x4F8B,0x6FA7, +0x79AE,0x91B4,0x96B7,0x52DE,0xF960,0x6488,0x64C4,0x6AD3, +0x6F5E,0x7018,0x7210,0x76E7,0x8001,0x8606,0x865C,0x8DEF, +0x8F05,0x9732,0x9B6F,0x9DFA,0x9E75,0x788C,0x797F,0x7DA0, +0x83C9,0x9304,0x9E7F,0x9E93,0x8AD6,0x58DF,0x5F04,0x6727, +0x7027,0x74CF,0x7C60,0x807E,0x5121,0x7028,0x7262,0x78CA, +0x8CC2,0x8CDA,0x8CF4,0x96F7,0x4E86,0x50DA,0x5BEE,0x5ED6, +0x6599,0x71CE,0x7642,0x77AD,0x804A,0x84FC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x907C,0x9B27,0x9F8D,0x58D8,0x5A41,0x5C62,0x6A13,0x6DDA, +0x6F0F,0x763B,0x7D2F,0x7E37,0x851E,0x8938,0x93E4,0x964B, +0x5289,0x65D2,0x67F3,0x69B4,0x6D41,0x6E9C,0x700F,0x7409, +0x7460,0x7559,0x7624,0x786B,0x8B2C,0x985E,0x516D,0x622E, +0x9678,0x4F96,0x502B,0x5D19,0x6DEA,0x7DB8,0x8F2A,0x5F8B, +0x6144,0x6817,0xF961,0x9686,0x52D2,0x808B,0x51DC,0x51CC, +0x695E,0x7A1C,0x7DBE,0x83F1,0x9675,0x4FDA,0x5229,0x5398, +0x540F,0x550E,0x5C65,0x60A7,0x674E,0x68A8,0x6D6C,0x7281, +0x72F8,0x7406,0x7483,0xF962,0x75E2,0x7C6C,0x7F79,0x7FB8, +0x8389,0x88CF,0x88E1,0x91CC,0x91D0,0x96E2,0x9BC9,0x541D, +0x6F7E,0x71D0,0x7498,0x85FA,0x8EAA,0x96A3,0x9C57,0x9E9F, +0x6797,0x6DCB,0x7433,0x81E8,0x9716,0x782C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7ACB,0x7B20,0x7C92,0x6469,0x746A,0x75F2,0x78BC,0x78E8, +0x99AC,0x9B54,0x9EBB,0x5BDE,0x5E55,0x6F20,0x819C,0x83AB, +0x9088,0x4E07,0x534D,0x5A29,0x5DD2,0x5F4E,0x6162,0x633D, +0x6669,0x66FC,0x6EFF,0x6F2B,0x7063,0x779E,0x842C,0x8513, +0x883B,0x8F13,0x9945,0x9C3B,0x551C,0x62B9,0x672B,0x6CAB, +0x8309,0x896A,0x977A,0x4EA1,0x5984,0x5FD8,0x5FD9,0x671B, +0x7DB2,0x7F54,0x8292,0x832B,0x83BD,0x8F1E,0x9099,0x57CB, +0x59B9,0x5A92,0x5BD0,0x6627,0x679A,0x6885,0x6BCF,0x7164, +0x7F75,0x8CB7,0x8CE3,0x9081,0x9B45,0x8108,0x8C8A,0x964C, +0x9A40,0x9EA5,0x5B5F,0x6C13,0x731B,0x76F2,0x76DF,0x840C, +0x51AA,0x8993,0x514D,0x5195,0x52C9,0x68C9,0x6C94,0x7704, +0x7720,0x7DBF,0x7DEC,0x9762,0x9EB5,0x6EC5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8511,0x51A5,0x540D,0x547D,0x660E,0x669D,0x6927,0x6E9F, +0x76BF,0x7791,0x8317,0x84C2,0x879F,0x9169,0x9298,0x9CF4, +0x8882,0x4FAE,0x5192,0x52DF,0x59C6,0x5E3D,0x6155,0x6478, +0x6479,0x66AE,0x67D0,0x6A21,0x6BCD,0x6BDB,0x725F,0x7261, +0x7441,0x7738,0x77DB,0x8017,0x82BC,0x8305,0x8B00,0x8B28, +0x8C8C,0x6728,0x6C90,0x7267,0x76EE,0x7766,0x7A46,0x9DA9, +0x6B7F,0x6C92,0x5922,0x6726,0x8499,0x536F,0x5893,0x5999, +0x5EDF,0x63CF,0x6634,0x6773,0x6E3A,0x732B,0x7AD7,0x82D7, +0x9328,0x52D9,0x5DEB,0x61AE,0x61CB,0x620A,0x62C7,0x64AB, +0x65E0,0x6959,0x6B66,0x6BCB,0x7121,0x73F7,0x755D,0x7E46, +0x821E,0x8302,0x856A,0x8AA3,0x8CBF,0x9727,0x9D61,0x58A8, +0x9ED8,0x5011,0x520E,0x543B,0x554F,0x6587, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C76,0x7D0A,0x7D0B,0x805E,0x868A,0x9580,0x96EF,0x52FF, +0x6C95,0x7269,0x5473,0x5A9A,0x5C3E,0x5D4B,0x5F4C,0x5FAE, +0x672A,0x68B6,0x6963,0x6E3C,0x6E44,0x7709,0x7C73,0x7F8E, +0x8587,0x8B0E,0x8FF7,0x9761,0x9EF4,0x5CB7,0x60B6,0x610D, +0x61AB,0x654F,0x65FB,0x65FC,0x6C11,0x6CEF,0x739F,0x73C9, +0x7DE1,0x9594,0x5BC6,0x871C,0x8B10,0x525D,0x535A,0x62CD, +0x640F,0x64B2,0x6734,0x6A38,0x6CCA,0x73C0,0x749E,0x7B94, +0x7C95,0x7E1B,0x818A,0x8236,0x8584,0x8FEB,0x96F9,0x99C1, +0x4F34,0x534A,0x53CD,0x53DB,0x62CC,0x642C,0x6500,0x6591, +0x69C3,0x6CEE,0x6F58,0x73ED,0x7554,0x7622,0x76E4,0x76FC, +0x78D0,0x78FB,0x792C,0x7D46,0x822C,0x87E0,0x8FD4,0x9812, +0x98EF,0x52C3,0x62D4,0x64A5,0x6E24,0x6F51, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x767C,0x8DCB,0x91B1,0x9262,0x9AEE,0x9B43,0x5023,0x508D, +0x574A,0x59A8,0x5C28,0x5E47,0x5F77,0x623F,0x653E,0x65B9, +0x65C1,0x6609,0x678B,0x699C,0x6EC2,0x78C5,0x7D21,0x80AA, +0x8180,0x822B,0x82B3,0x84A1,0x868C,0x8A2A,0x8B17,0x90A6, +0x9632,0x9F90,0x500D,0x4FF3,0xF963,0x57F9,0x5F98,0x62DC, +0x6392,0x676F,0x6E43,0x7119,0x76C3,0x80CC,0x80DA,0x88F4, +0x88F5,0x8919,0x8CE0,0x8F29,0x914D,0x966A,0x4F2F,0x4F70, +0x5E1B,0x67CF,0x6822,0x767D,0x767E,0x9B44,0x5E61,0x6A0A, +0x7169,0x71D4,0x756A,0xF964,0x7E41,0x8543,0x85E9,0x98DC, +0x4F10,0x7B4F,0x7F70,0x95A5,0x51E1,0x5E06,0x68B5,0x6C3E, +0x6C4E,0x6CDB,0x72AF,0x7BC4,0x8303,0x6CD5,0x743A,0x50FB, +0x5288,0x58C1,0x64D8,0x6A97,0x74A7,0x7656, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x78A7,0x8617,0x95E2,0x9739,0xF965,0x535E,0x5F01,0x8B8A, +0x8FA8,0x8FAF,0x908A,0x5225,0x77A5,0x9C49,0x9F08,0x4E19, +0x5002,0x5175,0x5C5B,0x5E77,0x661E,0x663A,0x67C4,0x68C5, +0x70B3,0x7501,0x75C5,0x79C9,0x7ADD,0x8F27,0x9920,0x9A08, +0x4FDD,0x5821,0x5831,0x5BF6,0x666E,0x6B65,0x6D11,0x6E7A, +0x6F7D,0x73E4,0x752B,0x83E9,0x88DC,0x8913,0x8B5C,0x8F14, +0x4F0F,0x50D5,0x5310,0x535C,0x5B93,0x5FA9,0x670D,0x798F, +0x8179,0x832F,0x8514,0x8907,0x8986,0x8F39,0x8F3B,0x99A5, +0x9C12,0x672C,0x4E76,0x4FF8,0x5949,0x5C01,0x5CEF,0x5CF0, +0x6367,0x68D2,0x70FD,0x71A2,0x742B,0x7E2B,0x84EC,0x8702, +0x9022,0x92D2,0x9CF3,0x4E0D,0x4ED8,0x4FEF,0x5085,0x5256, +0x526F,0x5426,0x5490,0x57E0,0x592B,0x5A66, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5B5A,0x5B75,0x5BCC,0x5E9C,0xF966,0x6276,0x6577,0x65A7, +0x6D6E,0x6EA5,0x7236,0x7B26,0x7C3F,0x7F36,0x8150,0x8151, +0x819A,0x8240,0x8299,0x83A9,0x8A03,0x8CA0,0x8CE6,0x8CFB, +0x8D74,0x8DBA,0x90E8,0x91DC,0x961C,0x9644,0x99D9,0x9CE7, +0x5317,0x5206,0x5429,0x5674,0x58B3,0x5954,0x596E,0x5FFF, +0x61A4,0x626E,0x6610,0x6C7E,0x711A,0x76C6,0x7C89,0x7CDE, +0x7D1B,0x82AC,0x8CC1,0x96F0,0xF967,0x4F5B,0x5F17,0x5F7F, +0x62C2,0x5D29,0x670B,0x68DA,0x787C,0x7E43,0x9D6C,0x4E15, +0x5099,0x5315,0x532A,0x5351,0x5983,0x5A62,0x5E87,0x60B2, +0x618A,0x6249,0x6279,0x6590,0x6787,0x69A7,0x6BD4,0x6BD6, +0x6BD7,0x6BD8,0x6CB8,0xF968,0x7435,0x75FA,0x7812,0x7891, +0x79D5,0x79D8,0x7C83,0x7DCB,0x7FE1,0x80A5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x813E,0x81C2,0x83F2,0x871A,0x88E8,0x8AB9,0x8B6C,0x8CBB, +0x9119,0x975E,0x98DB,0x9F3B,0x56AC,0x5B2A,0x5F6C,0x658C, +0x6AB3,0x6BAF,0x6D5C,0x6FF1,0x7015,0x725D,0x73AD,0x8CA7, +0x8CD3,0x983B,0x6191,0x6C37,0x8058,0x9A01,0x4E4D,0x4E8B, +0x4E9B,0x4ED5,0x4F3A,0x4F3C,0x4F7F,0x4FDF,0x50FF,0x53F2, +0x53F8,0x5506,0x55E3,0x56DB,0x58EB,0x5962,0x5A11,0x5BEB, +0x5BFA,0x5C04,0x5DF3,0x5E2B,0x5F99,0x601D,0x6368,0x659C, +0x65AF,0x67F6,0x67FB,0x68AD,0x6B7B,0x6C99,0x6CD7,0x6E23, +0x7009,0x7345,0x7802,0x793E,0x7940,0x7960,0x79C1,0x7BE9, +0x7D17,0x7D72,0x8086,0x820D,0x838E,0x84D1,0x86C7,0x88DF, +0x8A50,0x8A5E,0x8B1D,0x8CDC,0x8D66,0x8FAD,0x90AA,0x98FC, +0x99DF,0x9E9D,0x524A,0xF969,0x6714,0xF96A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5098,0x522A,0x5C71,0x6563,0x6C55,0x73CA,0x7523,0x759D, +0x7B97,0x849C,0x9178,0x9730,0x4E77,0x6492,0x6BBA,0x715E, +0x85A9,0x4E09,0xF96B,0x6749,0x68EE,0x6E17,0x829F,0x8518, +0x886B,0x63F7,0x6F81,0x9212,0x98AF,0x4E0A,0x50B7,0x50CF, +0x511F,0x5546,0x55AA,0x5617,0x5B40,0x5C19,0x5CE0,0x5E38, +0x5E8A,0x5EA0,0x5EC2,0x60F3,0x6851,0x6A61,0x6E58,0x723D, +0x7240,0x72C0,0x76F8,0x7965,0x7BB1,0x7FD4,0x88F3,0x89F4, +0x8A73,0x8C61,0x8CDE,0x971C,0x585E,0x74BD,0x8CFD,0x55C7, +0xF96C,0x7A61,0x7D22,0x8272,0x7272,0x751F,0x7525,0xF96D, +0x7B19,0x5885,0x58FB,0x5DBC,0x5E8F,0x5EB6,0x5F90,0x6055, +0x6292,0x637F,0x654D,0x6691,0x66D9,0x66F8,0x6816,0x68F2, +0x7280,0x745E,0x7B6E,0x7D6E,0x7DD6,0x7F72, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x80E5,0x8212,0x85AF,0x897F,0x8A93,0x901D,0x92E4,0x9ECD, +0x9F20,0x5915,0x596D,0x5E2D,0x60DC,0x6614,0x6673,0x6790, +0x6C50,0x6DC5,0x6F5F,0x77F3,0x78A9,0x84C6,0x91CB,0x932B, +0x4ED9,0x50CA,0x5148,0x5584,0x5B0B,0x5BA3,0x6247,0x657E, +0x65CB,0x6E32,0x717D,0x7401,0x7444,0x7487,0x74BF,0x766C, +0x79AA,0x7DDA,0x7E55,0x7FA8,0x817A,0x81B3,0x8239,0x861A, +0x87EC,0x8A75,0x8DE3,0x9078,0x9291,0x9425,0x994D,0x9BAE, +0x5368,0x5C51,0x6954,0x6CC4,0x6D29,0x6E2B,0x820C,0x859B, +0x893B,0x8A2D,0x8AAA,0x96EA,0x9F67,0x5261,0x66B9,0x6BB2, +0x7E96,0x87FE,0x8D0D,0x9583,0x965D,0x651D,0x6D89,0x71EE, +0xF96E,0x57CE,0x59D3,0x5BAC,0x6027,0x60FA,0x6210,0x661F, +0x665F,0x7329,0x73F9,0x76DB,0x7701,0x7B6C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8056,0x8072,0x8165,0x8AA0,0x9192,0x4E16,0x52E2,0x6B72, +0x6D17,0x7A05,0x7B39,0x7D30,0xF96F,0x8CB0,0x53EC,0x562F, +0x5851,0x5BB5,0x5C0F,0x5C11,0x5DE2,0x6240,0x6383,0x6414, +0x662D,0x68B3,0x6CBC,0x6D88,0x6EAF,0x701F,0x70A4,0x71D2, +0x7526,0x758F,0x758E,0x7619,0x7B11,0x7BE0,0x7C2B,0x7D20, +0x7D39,0x852C,0x856D,0x8607,0x8A34,0x900D,0x9061,0x90B5, +0x92B7,0x97F6,0x9A37,0x4FD7,0x5C6C,0x675F,0x6D91,0x7C9F, +0x7E8C,0x8B16,0x8D16,0x901F,0x5B6B,0x5DFD,0x640D,0x84C0, +0x905C,0x98E1,0x7387,0x5B8B,0x609A,0x677E,0x6DDE,0x8A1F, +0x8AA6,0x9001,0x980C,0x5237,0xF970,0x7051,0x788E,0x9396, +0x8870,0x91D7,0x4FEE,0x53D7,0x55FD,0x56DA,0x5782,0x58FD, +0x5AC2,0x5B88,0x5CAB,0x5CC0,0x5E25,0x6101, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x620D,0x624B,0x6388,0x641C,0x6536,0x6578,0x6A39,0x6B8A, +0x6C34,0x6D19,0x6F31,0x71E7,0x72E9,0x7378,0x7407,0x74B2, +0x7626,0x7761,0x79C0,0x7A57,0x7AEA,0x7CB9,0x7D8F,0x7DAC, +0x7E61,0x7F9E,0x8129,0x8331,0x8490,0x84DA,0x85EA,0x8896, +0x8AB0,0x8B90,0x8F38,0x9042,0x9083,0x916C,0x9296,0x92B9, +0x968B,0x96A7,0x96A8,0x96D6,0x9700,0x9808,0x9996,0x9AD3, +0x9B1A,0x53D4,0x587E,0x5919,0x5B70,0x5BBF,0x6DD1,0x6F5A, +0x719F,0x7421,0x74B9,0x8085,0x83FD,0x5DE1,0x5F87,0x5FAA, +0x6042,0x65EC,0x6812,0x696F,0x6A53,0x6B89,0x6D35,0x6DF3, +0x73E3,0x76FE,0x77AC,0x7B4D,0x7D14,0x8123,0x821C,0x8340, +0x84F4,0x8563,0x8A62,0x8AC4,0x9187,0x931E,0x9806,0x99B4, +0x620C,0x8853,0x8FF0,0x9265,0x5D07,0x5D27, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5D69,0x745F,0x819D,0x8768,0x6FD5,0x62FE,0x7FD2,0x8936, +0x8972,0x4E1E,0x4E58,0x50E7,0x52DD,0x5347,0x627F,0x6607, +0x7E69,0x8805,0x965E,0x4F8D,0x5319,0x5636,0x59CB,0x5AA4, +0x5C38,0x5C4E,0x5C4D,0x5E02,0x5F11,0x6043,0x65BD,0x662F, +0x6642,0x67BE,0x67F4,0x731C,0x77E2,0x793A,0x7FC5,0x8494, +0x84CD,0x8996,0x8A66,0x8A69,0x8AE1,0x8C55,0x8C7A,0x57F4, +0x5BD4,0x5F0F,0x606F,0x62ED,0x690D,0x6B96,0x6E5C,0x7184, +0x7BD2,0x8755,0x8B58,0x8EFE,0x98DF,0x98FE,0x4F38,0x4F81, +0x4FE1,0x547B,0x5A20,0x5BB8,0x613C,0x65B0,0x6668,0x71FC, +0x7533,0x795E,0x7D33,0x814E,0x81E3,0x8398,0x85AA,0x85CE, +0x8703,0x8A0A,0x8EAB,0x8F9B,0xF971,0x8FC5,0x5931,0x5BA4, +0x5BE6,0x6089,0x5BE9,0x5C0B,0x5FC3,0x6C81, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF972,0x6DF1,0x700B,0x751A,0x82AF,0x8AF6,0x4EC0,0x5341, +0xF973,0x96D9,0x6C0F,0x4E9E,0x4FC4,0x5152,0x555E,0x5A25, +0x5CE8,0x6211,0x7259,0x82BD,0x83AA,0x86FE,0x8859,0x8A1D, +0x963F,0x96C5,0x9913,0x9D09,0x9D5D,0x580A,0x5CB3,0x5DBD, +0x5E44,0x60E1,0x6115,0x63E1,0x6A02,0x6E25,0x9102,0x9354, +0x984E,0x9C10,0x9F77,0x5B89,0x5CB8,0x6309,0x664F,0x6848, +0x773C,0x96C1,0x978D,0x9854,0x9B9F,0x65A1,0x8B01,0x8ECB, +0x95BC,0x5535,0x5CA9,0x5DD6,0x5EB5,0x6697,0x764C,0x83F4, +0x95C7,0x58D3,0x62BC,0x72CE,0x9D28,0x4EF0,0x592E,0x600F, +0x663B,0x6B83,0x79E7,0x9D26,0x5393,0x54C0,0x57C3,0x5D16, +0x611B,0x66D6,0x6DAF,0x788D,0x827E,0x9698,0x9744,0x5384, +0x627C,0x6396,0x6DB2,0x7E0A,0x814B,0x984D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6AFB,0x7F4C,0x9DAF,0x9E1A,0x4E5F,0x503B,0x51B6,0x591C, +0x60F9,0x63F6,0x6930,0x723A,0x8036,0xF974,0x91CE,0x5F31, +0xF975,0xF976,0x7D04,0x82E5,0x846F,0x84BB,0x85E5,0x8E8D, +0xF977,0x4F6F,0xF978,0xF979,0x58E4,0x5B43,0x6059,0x63DA, +0x6518,0x656D,0x6698,0xF97A,0x694A,0x6A23,0x6D0B,0x7001, +0x716C,0x75D2,0x760D,0x79B3,0x7A70,0xF97B,0x7F8A,0xF97C, +0x8944,0xF97D,0x8B93,0x91C0,0x967D,0xF97E,0x990A,0x5704, +0x5FA1,0x65BC,0x6F01,0x7600,0x79A6,0x8A9E,0x99AD,0x9B5A, +0x9F6C,0x5104,0x61B6,0x6291,0x6A8D,0x81C6,0x5043,0x5830, +0x5F66,0x7109,0x8A00,0x8AFA,0x5B7C,0x8616,0x4FFA,0x513C, +0x56B4,0x5944,0x63A9,0x6DF9,0x5DAA,0x696D,0x5186,0x4E88, +0x4F59,0xF97F,0xF980,0xF981,0x5982,0xF982, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF983,0x6B5F,0x6C5D,0xF984,0x74B5,0x7916,0xF985,0x8207, +0x8245,0x8339,0x8F3F,0x8F5D,0xF986,0x9918,0xF987,0xF988, +0xF989,0x4EA6,0xF98A,0x57DF,0x5F79,0x6613,0xF98B,0xF98C, +0x75AB,0x7E79,0x8B6F,0xF98D,0x9006,0x9A5B,0x56A5,0x5827, +0x59F8,0x5A1F,0x5BB4,0xF98E,0x5EF6,0xF98F,0xF990,0x6350, +0x633B,0xF991,0x693D,0x6C87,0x6CBF,0x6D8E,0x6D93,0x6DF5, +0x6F14,0xF992,0x70DF,0x7136,0x7159,0xF993,0x71C3,0x71D5, +0xF994,0x784F,0x786F,0xF995,0x7B75,0x7DE3,0xF996,0x7E2F, +0xF997,0x884D,0x8EDF,0xF998,0xF999,0xF99A,0x925B,0xF99B, +0x9CF6,0xF99C,0xF99D,0xF99E,0x6085,0x6D85,0xF99F,0x71B1, +0xF9A0,0xF9A1,0x95B1,0x53AD,0xF9A2,0xF9A3,0xF9A4,0x67D3, +0xF9A5,0x708E,0x7130,0x7430,0x8276,0x82D2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF9A6,0x95BB,0x9AE5,0x9E7D,0x66C4,0xF9A7,0x71C1,0x8449, +0xF9A8,0xF9A9,0x584B,0xF9AA,0xF9AB,0x5DB8,0x5F71,0xF9AC, +0x6620,0x668E,0x6979,0x69AE,0x6C38,0x6CF3,0x6E36,0x6F41, +0x6FDA,0x701B,0x702F,0x7150,0x71DF,0x7370,0xF9AD,0x745B, +0xF9AE,0x74D4,0x76C8,0x7A4E,0x7E93,0xF9AF,0xF9B0,0x82F1, +0x8A60,0x8FCE,0xF9B1,0x9348,0xF9B2,0x9719,0xF9B3,0xF9B4, +0x4E42,0x502A,0xF9B5,0x5208,0x53E1,0x66F3,0x6C6D,0x6FCA, +0x730A,0x777F,0x7A62,0x82AE,0x85DD,0x8602,0xF9B6,0x88D4, +0x8A63,0x8B7D,0x8C6B,0xF9B7,0x92B3,0xF9B8,0x9713,0x9810, +0x4E94,0x4F0D,0x4FC9,0x50B2,0x5348,0x543E,0x5433,0x55DA, +0x5862,0x58BA,0x5967,0x5A1B,0x5BE4,0x609F,0xF9B9,0x61CA, +0x6556,0x65FF,0x6664,0x68A7,0x6C5A,0x6FB3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x70CF,0x71AC,0x7352,0x7B7D,0x8708,0x8AA4,0x9C32,0x9F07, +0x5C4B,0x6C83,0x7344,0x7389,0x923A,0x6EAB,0x7465,0x761F, +0x7A69,0x7E15,0x860A,0x5140,0x58C5,0x64C1,0x74EE,0x7515, +0x7670,0x7FC1,0x9095,0x96CD,0x9954,0x6E26,0x74E6,0x7AA9, +0x7AAA,0x81E5,0x86D9,0x8778,0x8A1B,0x5A49,0x5B8C,0x5B9B, +0x68A1,0x6900,0x6D63,0x73A9,0x7413,0x742C,0x7897,0x7DE9, +0x7FEB,0x8118,0x8155,0x839E,0x8C4C,0x962E,0x9811,0x66F0, +0x5F80,0x65FA,0x6789,0x6C6A,0x738B,0x502D,0x5A03,0x6B6A, +0x77EE,0x5916,0x5D6C,0x5DCD,0x7325,0x754F,0xF9BA,0xF9BB, +0x50E5,0x51F9,0x582F,0x592D,0x5996,0x59DA,0x5BE5,0xF9BC, +0xF9BD,0x5DA2,0x62D7,0x6416,0x6493,0x64FE,0xF9BE,0x66DC, +0xF9BF,0x6A48,0xF9C0,0x71FF,0x7464,0xF9C1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7A88,0x7AAF,0x7E47,0x7E5E,0x8000,0x8170,0xF9C2,0x87EF, +0x8981,0x8B20,0x9059,0xF9C3,0x9080,0x9952,0x617E,0x6B32, +0x6D74,0x7E1F,0x8925,0x8FB1,0x4FD1,0x50AD,0x5197,0x52C7, +0x57C7,0x5889,0x5BB9,0x5EB8,0x6142,0x6995,0x6D8C,0x6E67, +0x6EB6,0x7194,0x7462,0x7528,0x752C,0x8073,0x8338,0x84C9, +0x8E0A,0x9394,0x93DE,0xF9C4,0x4E8E,0x4F51,0x5076,0x512A, +0x53C8,0x53CB,0x53F3,0x5B87,0x5BD3,0x5C24,0x611A,0x6182, +0x65F4,0x725B,0x7397,0x7440,0x76C2,0x7950,0x7991,0x79B9, +0x7D06,0x7FBD,0x828B,0x85D5,0x865E,0x8FC2,0x9047,0x90F5, +0x91EA,0x9685,0x96E8,0x96E9,0x52D6,0x5F67,0x65ED,0x6631, +0x682F,0x715C,0x7A36,0x90C1,0x980A,0x4E91,0xF9C5,0x6A52, +0x6B9E,0x6F90,0x7189,0x8018,0x82B8,0x8553, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x904B,0x9695,0x96F2,0x97FB,0x851A,0x9B31,0x4E90,0x718A, +0x96C4,0x5143,0x539F,0x54E1,0x5713,0x5712,0x57A3,0x5A9B, +0x5AC4,0x5BC3,0x6028,0x613F,0x63F4,0x6C85,0x6D39,0x6E72, +0x6E90,0x7230,0x733F,0x7457,0x82D1,0x8881,0x8F45,0x9060, +0xF9C6,0x9662,0x9858,0x9D1B,0x6708,0x8D8A,0x925E,0x4F4D, +0x5049,0x50DE,0x5371,0x570D,0x59D4,0x5A01,0x5C09,0x6170, +0x6690,0x6E2D,0x7232,0x744B,0x7DEF,0x80C3,0x840E,0x8466, +0x853F,0x875F,0x885B,0x8918,0x8B02,0x9055,0x97CB,0x9B4F, +0x4E73,0x4F91,0x5112,0x516A,0xF9C7,0x552F,0x55A9,0x5B7A, +0x5BA5,0x5E7C,0x5E7D,0x5EBE,0x60A0,0x60DF,0x6108,0x6109, +0x63C4,0x6538,0x6709,0xF9C8,0x67D4,0x67DA,0xF9C9,0x6961, +0x6962,0x6CB9,0x6D27,0xF9CA,0x6E38,0xF9CB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6FE1,0x7336,0x7337,0xF9CC,0x745C,0x7531,0xF9CD,0x7652, +0xF9CE,0xF9CF,0x7DAD,0x81FE,0x8438,0x88D5,0x8A98,0x8ADB, +0x8AED,0x8E30,0x8E42,0x904A,0x903E,0x907A,0x9149,0x91C9, +0x936E,0xF9D0,0xF9D1,0x5809,0xF9D2,0x6BD3,0x8089,0x80B2, +0xF9D3,0xF9D4,0x5141,0x596B,0x5C39,0xF9D5,0xF9D6,0x6F64, +0x73A7,0x80E4,0x8D07,0xF9D7,0x9217,0x958F,0xF9D8,0xF9D9, +0xF9DA,0xF9DB,0x807F,0x620E,0x701C,0x7D68,0x878D,0xF9DC, +0x57A0,0x6069,0x6147,0x6BB7,0x8ABE,0x9280,0x96B1,0x4E59, +0x541F,0x6DEB,0x852D,0x9670,0x97F3,0x98EE,0x63D6,0x6CE3, +0x9091,0x51DD,0x61C9,0x81BA,0x9DF9,0x4F9D,0x501A,0x5100, +0x5B9C,0x610F,0x61FF,0x64EC,0x6905,0x6BC5,0x7591,0x77E3, +0x7FA9,0x8264,0x858F,0x87FB,0x8863,0x8ABC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B70,0x91AB,0x4E8C,0x4EE5,0x4F0A,0xF9DD,0xF9DE,0x5937, +0x59E8,0xF9DF,0x5DF2,0x5F1B,0x5F5B,0x6021,0xF9E0,0xF9E1, +0xF9E2,0xF9E3,0x723E,0x73E5,0xF9E4,0x7570,0x75CD,0xF9E5, +0x79FB,0xF9E6,0x800C,0x8033,0x8084,0x82E1,0x8351,0xF9E7, +0xF9E8,0x8CBD,0x8CB3,0x9087,0xF9E9,0xF9EA,0x98F4,0x990C, +0xF9EB,0xF9EC,0x7037,0x76CA,0x7FCA,0x7FCC,0x7FFC,0x8B1A, +0x4EBA,0x4EC1,0x5203,0x5370,0xF9ED,0x54BD,0x56E0,0x59FB, +0x5BC5,0x5F15,0x5FCD,0x6E6E,0xF9EE,0xF9EF,0x7D6A,0x8335, +0xF9F0,0x8693,0x8A8D,0xF9F1,0x976D,0x9777,0xF9F2,0xF9F3, +0x4E00,0x4F5A,0x4F7E,0x58F9,0x65E5,0x6EA2,0x9038,0x93B0, +0x99B9,0x4EFB,0x58EC,0x598A,0x59D9,0x6041,0xF9F4,0xF9F5, +0x7A14,0xF9F6,0x834F,0x8CC3,0x5165,0x5344, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF9F7,0xF9F8,0xF9F9,0x4ECD,0x5269,0x5B55,0x82BF,0x4ED4, +0x523A,0x54A8,0x59C9,0x59FF,0x5B50,0x5B57,0x5B5C,0x6063, +0x6148,0x6ECB,0x7099,0x716E,0x7386,0x74F7,0x75B5,0x78C1, +0x7D2B,0x8005,0x81EA,0x8328,0x8517,0x85C9,0x8AEE,0x8CC7, +0x96CC,0x4F5C,0x52FA,0x56BC,0x65AB,0x6628,0x707C,0x70B8, +0x7235,0x7DBD,0x828D,0x914C,0x96C0,0x9D72,0x5B71,0x68E7, +0x6B98,0x6F7A,0x76DE,0x5C91,0x66AB,0x6F5B,0x7BB4,0x7C2A, +0x8836,0x96DC,0x4E08,0x4ED7,0x5320,0x5834,0x58BB,0x58EF, +0x596C,0x5C07,0x5E33,0x5E84,0x5F35,0x638C,0x66B2,0x6756, +0x6A1F,0x6AA3,0x6B0C,0x6F3F,0x7246,0xF9FA,0x7350,0x748B, +0x7AE0,0x7CA7,0x8178,0x81DF,0x81E7,0x838A,0x846C,0x8523, +0x8594,0x85CF,0x88DD,0x8D13,0x91AC,0x9577, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x969C,0x518D,0x54C9,0x5728,0x5BB0,0x624D,0x6750,0x683D, +0x6893,0x6E3D,0x6ED3,0x707D,0x7E21,0x88C1,0x8CA1,0x8F09, +0x9F4B,0x9F4E,0x722D,0x7B8F,0x8ACD,0x931A,0x4F47,0x4F4E, +0x5132,0x5480,0x59D0,0x5E95,0x62B5,0x6775,0x696E,0x6A17, +0x6CAE,0x6E1A,0x72D9,0x732A,0x75BD,0x7BB8,0x7D35,0x82E7, +0x83F9,0x8457,0x85F7,0x8A5B,0x8CAF,0x8E87,0x9019,0x90B8, +0x96CE,0x9F5F,0x52E3,0x540A,0x5AE1,0x5BC2,0x6458,0x6575, +0x6EF4,0x72C4,0xF9FB,0x7684,0x7A4D,0x7B1B,0x7C4D,0x7E3E, +0x7FDF,0x837B,0x8B2B,0x8CCA,0x8D64,0x8DE1,0x8E5F,0x8FEA, +0x8FF9,0x9069,0x93D1,0x4F43,0x4F7A,0x50B3,0x5168,0x5178, +0x524D,0x526A,0x5861,0x587C,0x5960,0x5C08,0x5C55,0x5EDB, +0x609B,0x6230,0x6813,0x6BBF,0x6C08,0x6FB1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x714E,0x7420,0x7530,0x7538,0x7551,0x7672,0x7B4C,0x7B8B, +0x7BAD,0x7BC6,0x7E8F,0x8A6E,0x8F3E,0x8F49,0x923F,0x9293, +0x9322,0x942B,0x96FB,0x985A,0x986B,0x991E,0x5207,0x622A, +0x6298,0x6D59,0x7664,0x7ACA,0x7BC0,0x7D76,0x5360,0x5CBE, +0x5E97,0x6F38,0x70B9,0x7C98,0x9711,0x9B8E,0x9EDE,0x63A5, +0x647A,0x8776,0x4E01,0x4E95,0x4EAD,0x505C,0x5075,0x5448, +0x59C3,0x5B9A,0x5E40,0x5EAD,0x5EF7,0x5F81,0x60C5,0x633A, +0x653F,0x6574,0x65CC,0x6676,0x6678,0x67FE,0x6968,0x6A89, +0x6B63,0x6C40,0x6DC0,0x6DE8,0x6E1F,0x6E5E,0x701E,0x70A1, +0x738E,0x73FD,0x753A,0x775B,0x7887,0x798E,0x7A0B,0x7A7D, +0x7CBE,0x7D8E,0x8247,0x8A02,0x8AEA,0x8C9E,0x912D,0x914A, +0x91D8,0x9266,0x92CC,0x9320,0x9706,0x9756, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x975C,0x9802,0x9F0E,0x5236,0x5291,0x557C,0x5824,0x5E1D, +0x5F1F,0x608C,0x63D0,0x68AF,0x6FDF,0x796D,0x7B2C,0x81CD, +0x85BA,0x88FD,0x8AF8,0x8E44,0x918D,0x9664,0x969B,0x973D, +0x984C,0x9F4A,0x4FCE,0x5146,0x51CB,0x52A9,0x5632,0x5F14, +0x5F6B,0x63AA,0x64CD,0x65E9,0x6641,0x66FA,0x66F9,0x671D, +0x689D,0x68D7,0x69FD,0x6F15,0x6F6E,0x7167,0x71E5,0x722A, +0x74AA,0x773A,0x7956,0x795A,0x79DF,0x7A20,0x7A95,0x7C97, +0x7CDF,0x7D44,0x7E70,0x8087,0x85FB,0x86A4,0x8A54,0x8ABF, +0x8D99,0x8E81,0x9020,0x906D,0x91E3,0x963B,0x96D5,0x9CE5, +0x65CF,0x7C07,0x8DB3,0x93C3,0x5B58,0x5C0A,0x5352,0x62D9, +0x731D,0x5027,0x5B97,0x5F9E,0x60B0,0x616B,0x68D5,0x6DD9, +0x742E,0x7A2E,0x7D42,0x7D9C,0x7E31,0x816B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E2A,0x8E35,0x937E,0x9418,0x4F50,0x5750,0x5DE6,0x5EA7, +0x632B,0x7F6A,0x4E3B,0x4F4F,0x4F8F,0x505A,0x59DD,0x80C4, +0x546A,0x5468,0x55FE,0x594F,0x5B99,0x5DDE,0x5EDA,0x665D, +0x6731,0x67F1,0x682A,0x6CE8,0x6D32,0x6E4A,0x6F8D,0x70B7, +0x73E0,0x7587,0x7C4C,0x7D02,0x7D2C,0x7DA2,0x821F,0x86DB, +0x8A3B,0x8A85,0x8D70,0x8E8A,0x8F33,0x9031,0x914E,0x9152, +0x9444,0x99D0,0x7AF9,0x7CA5,0x4FCA,0x5101,0x51C6,0x57C8, +0x5BEF,0x5CFB,0x6659,0x6A3D,0x6D5A,0x6E96,0x6FEC,0x710C, +0x756F,0x7AE3,0x8822,0x9021,0x9075,0x96CB,0x99FF,0x8301, +0x4E2D,0x4EF2,0x8846,0x91CD,0x537D,0x6ADB,0x696B,0x6C41, +0x847A,0x589E,0x618E,0x66FE,0x62EF,0x70DD,0x7511,0x75C7, +0x7E52,0x84B8,0x8B49,0x8D08,0x4E4B,0x53EA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x54AB,0x5730,0x5740,0x5FD7,0x6301,0x6307,0x646F,0x652F, +0x65E8,0x667A,0x679D,0x67B3,0x6B62,0x6C60,0x6C9A,0x6F2C, +0x77E5,0x7825,0x7949,0x7957,0x7D19,0x80A2,0x8102,0x81F3, +0x829D,0x82B7,0x8718,0x8A8C,0xF9FC,0x8D04,0x8DBE,0x9072, +0x76F4,0x7A19,0x7A37,0x7E54,0x8077,0x5507,0x55D4,0x5875, +0x632F,0x6422,0x6649,0x664B,0x686D,0x699B,0x6B84,0x6D25, +0x6EB1,0x73CD,0x7468,0x74A1,0x755B,0x75B9,0x76E1,0x771E, +0x778B,0x79E6,0x7E09,0x7E1D,0x81FB,0x852F,0x8897,0x8A3A, +0x8CD1,0x8EEB,0x8FB0,0x9032,0x93AD,0x9663,0x9673,0x9707, +0x4F84,0x53F1,0x59EA,0x5AC9,0x5E19,0x684E,0x74C6,0x75BE, +0x79E9,0x7A92,0x81A3,0x86ED,0x8CEA,0x8DCC,0x8FED,0x659F, +0x6715,0xF9FD,0x57F7,0x6F57,0x7DDD,0x8F2F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x93F6,0x96C6,0x5FB5,0x61F2,0x6F84,0x4E14,0x4F98,0x501F, +0x53C9,0x55DF,0x5D6F,0x5DEE,0x6B21,0x6B64,0x78CB,0x7B9A, +0xF9FE,0x8E49,0x8ECA,0x906E,0x6349,0x643E,0x7740,0x7A84, +0x932F,0x947F,0x9F6A,0x64B0,0x6FAF,0x71E6,0x74A8,0x74DA, +0x7AC4,0x7C12,0x7E82,0x7CB2,0x7E98,0x8B9A,0x8D0A,0x947D, +0x9910,0x994C,0x5239,0x5BDF,0x64E6,0x672D,0x7D2E,0x50ED, +0x53C3,0x5879,0x6158,0x6159,0x61FA,0x65AC,0x7AD9,0x8B92, +0x8B96,0x5009,0x5021,0x5275,0x5531,0x5A3C,0x5EE0,0x5F70, +0x6134,0x655E,0x660C,0x6636,0x66A2,0x69CD,0x6EC4,0x6F32, +0x7316,0x7621,0x7A93,0x8139,0x8259,0x83D6,0x84BC,0x50B5, +0x57F0,0x5BC0,0x5BE8,0x5F69,0x63A1,0x7826,0x7DB5,0x83DC, +0x8521,0x91C7,0x91F5,0x518A,0x67F5,0x7B56, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8CAC,0x51C4,0x59BB,0x60BD,0x8655,0x501C,0xF9FF,0x5254, +0x5C3A,0x617D,0x621A,0x62D3,0x64F2,0x65A5,0x6ECC,0x7620, +0x810A,0x8E60,0x965F,0x96BB,0x4EDF,0x5343,0x5598,0x5929, +0x5DDD,0x64C5,0x6CC9,0x6DFA,0x7394,0x7A7F,0x821B,0x85A6, +0x8CE4,0x8E10,0x9077,0x91E7,0x95E1,0x9621,0x97C6,0x51F8, +0x54F2,0x5586,0x5FB9,0x64A4,0x6F88,0x7DB4,0x8F1F,0x8F4D, +0x9435,0x50C9,0x5C16,0x6CBE,0x6DFB,0x751B,0x77BB,0x7C3D, +0x7C64,0x8A79,0x8AC2,0x581E,0x59BE,0x5E16,0x6377,0x7252, +0x758A,0x776B,0x8ADC,0x8CBC,0x8F12,0x5EF3,0x6674,0x6DF8, +0x807D,0x83C1,0x8ACB,0x9751,0x9BD6,0xFA00,0x5243,0x66FF, +0x6D95,0x6EEF,0x7DE0,0x8AE6,0x902E,0x905E,0x9AD4,0x521D, +0x527F,0x54E8,0x6194,0x6284,0x62DB,0x68A2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6912,0x695A,0x6A35,0x7092,0x7126,0x785D,0x7901,0x790E, +0x79D2,0x7A0D,0x8096,0x8278,0x82D5,0x8349,0x8549,0x8C82, +0x8D85,0x9162,0x918B,0x91AE,0x4FC3,0x56D1,0x71ED,0x77D7, +0x8700,0x89F8,0x5BF8,0x5FD6,0x6751,0x90A8,0x53E2,0x585A, +0x5BF5,0x60A4,0x6181,0x6460,0x7E3D,0x8070,0x8525,0x9283, +0x64AE,0x50AC,0x5D14,0x6700,0x589C,0x62BD,0x63A8,0x690E, +0x6978,0x6A1E,0x6E6B,0x76BA,0x79CB,0x82BB,0x8429,0x8ACF, +0x8DA8,0x8FFD,0x9112,0x914B,0x919C,0x9310,0x9318,0x939A, +0x96DB,0x9A36,0x9C0D,0x4E11,0x755C,0x795D,0x7AFA,0x7B51, +0x7BC9,0x7E2E,0x84C4,0x8E59,0x8E74,0x8EF8,0x9010,0x6625, +0x693F,0x7443,0x51FA,0x672E,0x9EDC,0x5145,0x5FE0,0x6C96, +0x87F2,0x885D,0x8877,0x60B4,0x81B5,0x8403, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8D05,0x53D6,0x5439,0x5634,0x5A36,0x5C31,0x708A,0x7FE0, +0x805A,0x8106,0x81ED,0x8DA3,0x9189,0x9A5F,0x9DF2,0x5074, +0x4EC4,0x53A0,0x60FB,0x6E2C,0x5C64,0x4F88,0x5024,0x55E4, +0x5CD9,0x5E5F,0x6065,0x6894,0x6CBB,0x6DC4,0x71BE,0x75D4, +0x75F4,0x7661,0x7A1A,0x7A49,0x7DC7,0x7DFB,0x7F6E,0x81F4, +0x86A9,0x8F1C,0x96C9,0x99B3,0x9F52,0x5247,0x52C5,0x98ED, +0x89AA,0x4E03,0x67D2,0x6F06,0x4FB5,0x5BE2,0x6795,0x6C88, +0x6D78,0x741B,0x7827,0x91DD,0x937C,0x87C4,0x79E4,0x7A31, +0x5FEB,0x4ED6,0x54A4,0x553E,0x58AE,0x59A5,0x60F0,0x6253, +0x62D6,0x6736,0x6955,0x8235,0x9640,0x99B1,0x99DD,0x502C, +0x5353,0x5544,0x577C,0xFA01,0x6258,0xFA02,0x64E2,0x666B, +0x67DD,0x6FC1,0x6FEF,0x7422,0x7438,0x8A17, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9438,0x5451,0x5606,0x5766,0x5F48,0x619A,0x6B4E,0x7058, +0x70AD,0x7DBB,0x8A95,0x596A,0x812B,0x63A2,0x7708,0x803D, +0x8CAA,0x5854,0x642D,0x69BB,0x5B95,0x5E11,0x6E6F,0xFA03, +0x8569,0x514C,0x53F0,0x592A,0x6020,0x614B,0x6B86,0x6C70, +0x6CF0,0x7B1E,0x80CE,0x82D4,0x8DC6,0x90B0,0x98B1,0xFA04, +0x64C7,0x6FA4,0x6491,0x6504,0x514E,0x5410,0x571F,0x8A0E, +0x615F,0x6876,0xFA05,0x75DB,0x7B52,0x7D71,0x901A,0x5806, +0x69CC,0x817F,0x892A,0x9000,0x9839,0x5078,0x5957,0x59AC, +0x6295,0x900F,0x9B2A,0x615D,0x7279,0x95D6,0x5761,0x5A46, +0x5DF4,0x628A,0x64AD,0x64FA,0x6777,0x6CE2,0x6D3E,0x722C, +0x7436,0x7834,0x7F77,0x82AD,0x8DDB,0x9817,0x5224,0x5742, +0x677F,0x7248,0x74E3,0x8CA9,0x8FA6,0x9211, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x962A,0x516B,0x53ED,0x634C,0x4F69,0x5504,0x6096,0x6557, +0x6C9B,0x6D7F,0x724C,0x72FD,0x7A17,0x8987,0x8C9D,0x5F6D, +0x6F8E,0x70F9,0x81A8,0x610E,0x4FBF,0x504F,0x6241,0x7247, +0x7BC7,0x7DE8,0x7FE9,0x904D,0x97AD,0x9A19,0x8CB6,0x576A, +0x5E73,0x67B0,0x840D,0x8A55,0x5420,0x5B16,0x5E63,0x5EE2, +0x5F0A,0x6583,0x80BA,0x853D,0x9589,0x965B,0x4F48,0x5305, +0x530D,0x530F,0x5486,0x54FA,0x5703,0x5E03,0x6016,0x629B, +0x62B1,0x6355,0xFA06,0x6CE1,0x6D66,0x75B1,0x7832,0x80DE, +0x812F,0x82DE,0x8461,0x84B2,0x888D,0x8912,0x900B,0x92EA, +0x98FD,0x9B91,0x5E45,0x66B4,0x66DD,0x7011,0x7206,0xFA07, +0x4FF5,0x527D,0x5F6A,0x6153,0x6753,0x6A19,0x6F02,0x74E2, +0x7968,0x8868,0x8C79,0x98C7,0x98C4,0x9A43, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x54C1,0x7A1F,0x6953,0x8AF7,0x8C4A,0x98A8,0x99AE,0x5F7C, +0x62AB,0x75B2,0x76AE,0x88AB,0x907F,0x9642,0x5339,0x5F3C, +0x5FC5,0x6CCC,0x73CC,0x7562,0x758B,0x7B46,0x82FE,0x999D, +0x4E4F,0x903C,0x4E0B,0x4F55,0x53A6,0x590F,0x5EC8,0x6630, +0x6CB3,0x7455,0x8377,0x8766,0x8CC0,0x9050,0x971E,0x9C15, +0x58D1,0x5B78,0x8650,0x8B14,0x9DB4,0x5BD2,0x6068,0x608D, +0x65F1,0x6C57,0x6F22,0x6FA3,0x701A,0x7F55,0x7FF0,0x9591, +0x9592,0x9650,0x97D3,0x5272,0x8F44,0x51FD,0x542B,0x54B8, +0x5563,0x558A,0x6ABB,0x6DB5,0x7DD8,0x8266,0x929C,0x9677, +0x9E79,0x5408,0x54C8,0x76D2,0x86E4,0x95A4,0x95D4,0x965C, +0x4EA2,0x4F09,0x59EE,0x5AE6,0x5DF7,0x6052,0x6297,0x676D, +0x6841,0x6C86,0x6E2F,0x7F38,0x809B,0x822A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFA08,0xFA09,0x9805,0x4EA5,0x5055,0x54B3,0x5793,0x595A, +0x5B69,0x5BB3,0x61C8,0x6977,0x6D77,0x7023,0x87F9,0x89E3, +0x8A72,0x8AE7,0x9082,0x99ED,0x9AB8,0x52BE,0x6838,0x5016, +0x5E78,0x674F,0x8347,0x884C,0x4EAB,0x5411,0x56AE,0x73E6, +0x9115,0x97FF,0x9909,0x9957,0x9999,0x5653,0x589F,0x865B, +0x8A31,0x61B2,0x6AF6,0x737B,0x8ED2,0x6B47,0x96AA,0x9A57, +0x5955,0x7200,0x8D6B,0x9769,0x4FD4,0x5CF4,0x5F26,0x61F8, +0x665B,0x6CEB,0x70AB,0x7384,0x73B9,0x73FE,0x7729,0x774D, +0x7D43,0x7D62,0x7E23,0x8237,0x8852,0xFA0A,0x8CE2,0x9249, +0x986F,0x5B51,0x7A74,0x8840,0x9801,0x5ACC,0x4FE0,0x5354, +0x593E,0x5CFD,0x633E,0x6D79,0x72F9,0x8105,0x8107,0x83A2, +0x92CF,0x9830,0x4EA8,0x5144,0x5211,0x578B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F62,0x6CC2,0x6ECE,0x7005,0x7050,0x70AF,0x7192,0x73E9, +0x7469,0x834A,0x87A2,0x8861,0x9008,0x90A2,0x93A3,0x99A8, +0x516E,0x5F57,0x60E0,0x6167,0x66B3,0x8559,0x8E4A,0x91AF, +0x978B,0x4E4E,0x4E92,0x547C,0x58D5,0x58FA,0x597D,0x5CB5, +0x5F27,0x6236,0x6248,0x660A,0x6667,0x6BEB,0x6D69,0x6DCF, +0x6E56,0x6EF8,0x6F94,0x6FE0,0x6FE9,0x705D,0x72D0,0x7425, +0x745A,0x74E0,0x7693,0x795C,0x7CCA,0x7E1E,0x80E1,0x82A6, +0x846B,0x84BF,0x864E,0x865F,0x8774,0x8B77,0x8C6A,0x93AC, +0x9800,0x9865,0x60D1,0x6216,0x9177,0x5A5A,0x660F,0x6DF7, +0x6E3E,0x743F,0x9B42,0x5FFD,0x60DA,0x7B0F,0x54C4,0x5F18, +0x6C5E,0x6CD3,0x6D2A,0x70D8,0x7D05,0x8679,0x8A0C,0x9D3B, +0x5316,0x548C,0x5B05,0x6A3A,0x706B,0x7575, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x798D,0x79BE,0x82B1,0x83EF,0x8A71,0x8B41,0x8CA8,0x9774, +0xFA0B,0x64F4,0x652B,0x78BA,0x78BB,0x7A6B,0x4E38,0x559A, +0x5950,0x5BA6,0x5E7B,0x60A3,0x63DB,0x6B61,0x6665,0x6853, +0x6E19,0x7165,0x74B0,0x7D08,0x9084,0x9A69,0x9C25,0x6D3B, +0x6ED1,0x733E,0x8C41,0x95CA,0x51F0,0x5E4C,0x5FA8,0x604D, +0x60F6,0x6130,0x614C,0x6643,0x6644,0x69A5,0x6CC1,0x6E5F, +0x6EC9,0x6F62,0x714C,0x749C,0x7687,0x7BC1,0x7C27,0x8352, +0x8757,0x9051,0x968D,0x9EC3,0x532F,0x56DE,0x5EFB,0x5F8A, +0x6062,0x6094,0x61F7,0x6666,0x6703,0x6A9C,0x6DEE,0x6FAE, +0x7070,0x736A,0x7E6A,0x81BE,0x8334,0x86D4,0x8AA8,0x8CC4, +0x5283,0x7372,0x5B96,0x6A6B,0x9404,0x54EE,0x5686,0x5B5D, +0x6548,0x6585,0x66C9,0x689F,0x6D8D,0x6DC6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x723B,0x80B4,0x9175,0x9A4D,0x4FAF,0x5019,0x539A,0x540E, +0x543C,0x5589,0x55C5,0x5E3F,0x5F8C,0x673D,0x7166,0x73DD, +0x9005,0x52DB,0x52F3,0x5864,0x58CE,0x7104,0x718F,0x71FB, +0x85B0,0x8A13,0x6688,0x85A8,0x55A7,0x6684,0x714A,0x8431, +0x5349,0x5599,0x6BC1,0x5F59,0x5FBD,0x63EE,0x6689,0x7147, +0x8AF1,0x8F1D,0x9EBE,0x4F11,0x643A,0x70CB,0x7566,0x8667, +0x6064,0x8B4E,0x9DF8,0x5147,0x51F6,0x5308,0x6D36,0x80F8, +0x9ED1,0x6615,0x6B23,0x7098,0x75D5,0x5403,0x5C79,0x7D07, +0x8A16,0x6B20,0x6B3D,0x6B46,0x5438,0x6070,0x6D3D,0x7FD5, +0x8208,0x50D6,0x51DE,0x559C,0x566B,0x56CD,0x59EC,0x5B09, +0x5E0C,0x6199,0x6198,0x6231,0x665E,0x66E6,0x7199,0x71B9, +0x71BA,0x72A7,0x79A7,0x7A00,0x7FB2,0x8A70}; + +static int func_ksc5601_uni_onechar(int code){ + if ((code>=0x8141)&&(code<=0xC8FE)) + return(tab_ksc5601_uni0[code-0x8141]); + if ((code>=0xCAA1)&&(code<=0xFDFE)) + return(tab_ksc5601_uni1[code-0xCAA1]); + return(0); +} +/* page 0 0x00A1-0x0167 */ +static uint16 tab_uni_ksc56010[]={ +0xA2AE, 0, 0,0xA2B4, 0, 0,0xA1D7,0xA1A7, + 0,0xA8A3, 0, 0,0xA1A9, 0, 0,0xA1C6, +0xA1BE,0xA9F7,0xA9F8,0xA2A5, 0,0xA2D2,0xA1A4,0xA2AC, +0xA9F6,0xA8AC, 0,0xA8F9,0xA8F6,0xA8FA,0xA2AF, 0, + 0, 0, 0, 0, 0,0xA8A1, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA8A2, + 0, 0, 0, 0, 0, 0,0xA1BF,0xA8AA, + 0, 0, 0, 0, 0,0xA8AD,0xA9AC, 0, + 0, 0, 0, 0, 0,0xA9A1, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA9A3, + 0, 0, 0, 0, 0, 0,0xA1C0,0xA9AA, + 0, 0, 0, 0, 0,0xA9AD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA9A2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA8A4,0xA9A4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA9A5,0xA8A6,0xA9A6, 0, 0, 0, 0,0xA9A7, + 0, 0, 0, 0, 0, 0,0xA8A8,0xA9A8, +0xA8A9,0xA9A9, 0, 0, 0, 0, 0, 0, +0xA9B0,0xA8AF,0xA9AF, 0, 0, 0, 0, 0, + 0,0xA8AB,0xA9AB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA8AE,0xA9AE}; + +/* page 1 0x02C7-0x0451 */ +static uint16 tab_uni_ksc56011[]={ +0xA2A7, 0, 0, 0, 0, 0, 0, 0, + 0,0xA2B0, 0, 0, 0, 0, 0, 0, + 0,0xA2A8,0xA2AB,0xA2AA,0xA2AD, 0,0xA2A9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA5C1,0xA5C2,0xA5C3,0xA5C4,0xA5C5,0xA5C6, +0xA5C7,0xA5C8,0xA5C9,0xA5CA,0xA5CB,0xA5CC,0xA5CD,0xA5CE, +0xA5CF,0xA5D0,0xA5D1, 0,0xA5D2,0xA5D3,0xA5D4,0xA5D5, +0xA5D6,0xA5D7,0xA5D8, 0, 0, 0, 0, 0, + 0, 0,0xA5E1,0xA5E2,0xA5E3,0xA5E4,0xA5E5,0xA5E6, +0xA5E7,0xA5E8,0xA5E9,0xA5EA,0xA5EB,0xA5EC,0xA5ED,0xA5EE, +0xA5EF,0xA5F0,0xA5F1, 0,0xA5F2,0xA5F3,0xA5F4,0xA5F5, +0xA5F6,0xA5F7,0xA5F8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xACA7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xACA1,0xACA2,0xACA3,0xACA4,0xACA5,0xACA6,0xACA8, +0xACA9,0xACAA,0xACAB,0xACAC,0xACAD,0xACAE,0xACAF,0xACB0, +0xACB1,0xACB2,0xACB3,0xACB4,0xACB5,0xACB6,0xACB7,0xACB8, +0xACB9,0xACBA,0xACBB,0xACBC,0xACBD,0xACBE,0xACBF,0xACC0, +0xACC1,0xACD1,0xACD2,0xACD3,0xACD4,0xACD5,0xACD6,0xACD8, +0xACD9,0xACDA,0xACDB,0xACDC,0xACDD,0xACDE,0xACDF,0xACE0, +0xACE1,0xACE2,0xACE3,0xACE4,0xACE5,0xACE6,0xACE7,0xACE8, +0xACE9,0xACEA,0xACEB,0xACEC,0xACED,0xACEE,0xACEF,0xACF0, +0xACF1, 0,0xACD7}; + +/* page 2 0x2015-0x2312 */ +static uint16 tab_uni_ksc56012[]={ +0xA1AA, 0, 0,0xA1AE,0xA1AF, 0, 0,0xA1B0, +0xA1B1, 0, 0,0xA2D3,0xA2D4, 0, 0, 0, +0xA1A5,0xA1A6, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA2B6, 0,0xA1C7,0xA1C8, 0, + 0, 0, 0, 0, 0, 0,0xA1D8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA9F9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA9FA, 0,0xA9FB,0xA9FC,0xA9FD,0xA9FE, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA1C9, 0, + 0, 0, 0, 0,0xA2B5, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA7A4, 0, + 0,0xA2E0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA2E5,0xA2E2, 0, 0, + 0,0xA7D9, 0, 0, 0, 0,0xA1CA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA8F7,0xA8F8, + 0, 0, 0, 0, 0, 0,0xA8FB,0xA8FC, +0xA8FD,0xA8FE, 0,0xA5B0,0xA5B1,0xA5B2,0xA5B3,0xA5B4, +0xA5B5,0xA5B6,0xA5B7,0xA5B8,0xA5B9, 0, 0, 0, + 0, 0, 0,0xA5A1,0xA5A2,0xA5A3,0xA5A4,0xA5A5, +0xA5A6,0xA5A7,0xA5A8,0xA5A9,0xA5AA, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA1E7,0xA1E8,0xA1E6,0xA1E9,0xA1EA, +0xA2D5,0xA2D8,0xA2D6,0xA2D9,0xA2D7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA2A1, 0,0xA2A2, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA2A3, 0,0xA1D3,0xA2A4, 0, + 0, 0,0xA1D4,0xA1F4, 0, 0,0xA1F5, 0, + 0, 0,0xA2B3, 0,0xA2B2, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1EE, 0, 0, +0xA1F0,0xA1C4, 0,0xA1D0, 0, 0, 0, 0, +0xA1AB, 0,0xA1FC,0xA1FD,0xA1FB,0xA1FA,0xA1F2,0xA1F3, + 0,0xA2B1, 0, 0, 0, 0, 0,0xA1C5, +0xA1F1, 0, 0, 0, 0, 0, 0,0xA1AD, +0xA1EF, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1D6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA1C1,0xA1D5, 0, 0,0xA1C2, +0xA1C3, 0, 0, 0, 0,0xA1EC,0xA1ED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1F8,0xA1F9, 0, + 0,0xA1F6,0xA1F7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA2C1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1D1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1D2}; + +/* page 3 0x2460-0x266D */ +static uint16 tab_uni_ksc56013[]={ +0xA8E7,0xA8E8,0xA8E9,0xA8EA,0xA8EB,0xA8EC,0xA8ED,0xA8EE, +0xA8EF,0xA8F0,0xA8F1,0xA8F2,0xA8F3,0xA8F4,0xA8F5, 0, + 0, 0, 0, 0,0xA9E7,0xA9E8,0xA9E9,0xA9EA, +0xA9EB,0xA9EC,0xA9ED,0xA9EE,0xA9EF,0xA9F0,0xA9F1,0xA9F2, +0xA9F3,0xA9F4,0xA9F5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA9CD,0xA9CE,0xA9CF,0xA9D0, +0xA9D1,0xA9D2,0xA9D3,0xA9D4,0xA9D5,0xA9D6,0xA9D7,0xA9D8, +0xA9D9,0xA9DA,0xA9DB,0xA9DC,0xA9DD,0xA9DE,0xA9DF,0xA9E0, +0xA9E1,0xA9E2,0xA9E3,0xA9E4,0xA9E5,0xA9E6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA8CD,0xA8CE,0xA8CF,0xA8D0,0xA8D1,0xA8D2,0xA8D3,0xA8D4, +0xA8D5,0xA8D6,0xA8D7,0xA8D8,0xA8D9,0xA8DA,0xA8DB,0xA8DC, +0xA8DD,0xA8DE,0xA8DF,0xA8E0,0xA8E1,0xA8E2,0xA8E3,0xA8E4, +0xA8E5,0xA8E6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA6A1,0xA6AC,0xA6A2,0xA6AD, 0, 0, 0, 0, + 0, 0, 0, 0,0xA6A3,0xA6C8,0xA6C7,0xA6AE, +0xA6A4,0xA6C2,0xA6C1,0xA6AF,0xA6A6,0xA6C6,0xA6C5,0xA6B1, +0xA6A5,0xA6C4,0xA6C3,0xA6B0,0xA6A7,0xA6BC,0xA6C9,0xA6CA, +0xA6B7,0xA6CB,0xA6CC,0xA6B2,0xA6A9,0xA6BE,0xA6CD,0xA6CE, +0xA6B9,0xA6CF,0xA6D0,0xA6B4,0xA6A8,0xA6D1,0xA6D2,0xA6B8, +0xA6BD,0xA6D3,0xA6D4,0xA6B3,0xA6AA,0xA6D5,0xA6D6,0xA6BA, +0xA6BF,0xA6D7,0xA6D8,0xA6B5,0xA6AB,0xA6D9,0xA6DA,0xA6BB, +0xA6DB,0xA6DC,0xA6C0,0xA6DD,0xA6DE,0xA6DF,0xA6E0,0xA6E1, +0xA6E2,0xA6E3,0xA6E4,0xA6B6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA2C6, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1E1,0xA1E0, 0,0xA2C3,0xA2C7,0xA2C8,0xA2CB,0xA2CA, +0xA2C9,0xA2CC, 0, 0, 0, 0, 0, 0, + 0, 0,0xA1E3,0xA1E2, 0, 0,0xA2BA,0xA2B9, + 0, 0, 0, 0,0xA1E5,0xA1E4, 0, 0, +0xA2B8,0xA2B7, 0, 0, 0, 0,0xA1DF,0xA1DE, +0xA2C2, 0, 0,0xA1DB, 0, 0,0xA1DD,0xA1DC, +0xA2C4,0xA2C5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1DA,0xA1D9, 0, + 0, 0, 0, 0, 0, 0,0xA2CF,0xA2CE, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA2D0, 0,0xA2D1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1CF, 0,0xA1CE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA2BC,0xA2BD, 0,0xA2C0,0xA2BB,0xA2BE, 0,0xA2BF, +0xA2CD,0xA2DB,0xA2DC, 0,0xA2DD,0xA2DA}; + +/* page 4 0x3000-0x327F */ +static uint16 tab_uni_ksc56014[]={ +0xA1A1,0xA1A2,0xA1A3,0xA1A8, 0, 0, 0, 0, +0xA1B4,0xA1B5,0xA1B6,0xA1B7,0xA1B8,0xA1B9,0xA1BA,0xA1BB, +0xA1BC,0xA1BD, 0,0xA1EB,0xA1B2,0xA1B3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xAAA1,0xAAA2,0xAAA3,0xAAA4,0xAAA5,0xAAA6,0xAAA7, +0xAAA8,0xAAA9,0xAAAA,0xAAAB,0xAAAC,0xAAAD,0xAAAE,0xAAAF, +0xAAB0,0xAAB1,0xAAB2,0xAAB3,0xAAB4,0xAAB5,0xAAB6,0xAAB7, +0xAAB8,0xAAB9,0xAABA,0xAABB,0xAABC,0xAABD,0xAABE,0xAABF, +0xAAC0,0xAAC1,0xAAC2,0xAAC3,0xAAC4,0xAAC5,0xAAC6,0xAAC7, +0xAAC8,0xAAC9,0xAACA,0xAACB,0xAACC,0xAACD,0xAACE,0xAACF, +0xAAD0,0xAAD1,0xAAD2,0xAAD3,0xAAD4,0xAAD5,0xAAD6,0xAAD7, +0xAAD8,0xAAD9,0xAADA,0xAADB,0xAADC,0xAADD,0xAADE,0xAADF, +0xAAE0,0xAAE1,0xAAE2,0xAAE3,0xAAE4,0xAAE5,0xAAE6,0xAAE7, +0xAAE8,0xAAE9,0xAAEA,0xAAEB,0xAAEC,0xAAED,0xAAEE,0xAAEF, +0xAAF0,0xAAF1,0xAAF2,0xAAF3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xABA1,0xABA2,0xABA3,0xABA4,0xABA5,0xABA6,0xABA7, +0xABA8,0xABA9,0xABAA,0xABAB,0xABAC,0xABAD,0xABAE,0xABAF, +0xABB0,0xABB1,0xABB2,0xABB3,0xABB4,0xABB5,0xABB6,0xABB7, +0xABB8,0xABB9,0xABBA,0xABBB,0xABBC,0xABBD,0xABBE,0xABBF, +0xABC0,0xABC1,0xABC2,0xABC3,0xABC4,0xABC5,0xABC6,0xABC7, +0xABC8,0xABC9,0xABCA,0xABCB,0xABCC,0xABCD,0xABCE,0xABCF, +0xABD0,0xABD1,0xABD2,0xABD3,0xABD4,0xABD5,0xABD6,0xABD7, +0xABD8,0xABD9,0xABDA,0xABDB,0xABDC,0xABDD,0xABDE,0xABDF, +0xABE0,0xABE1,0xABE2,0xABE3,0xABE4,0xABE5,0xABE6,0xABE7, +0xABE8,0xABE9,0xABEA,0xABEB,0xABEC,0xABED,0xABEE,0xABEF, +0xABF0,0xABF1,0xABF2,0xABF3,0xABF4,0xABF5,0xABF6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA4A1,0xA4A2,0xA4A3,0xA4A4,0xA4A5,0xA4A6,0xA4A7, +0xA4A8,0xA4A9,0xA4AA,0xA4AB,0xA4AC,0xA4AD,0xA4AE,0xA4AF, +0xA4B0,0xA4B1,0xA4B2,0xA4B3,0xA4B4,0xA4B5,0xA4B6,0xA4B7, +0xA4B8,0xA4B9,0xA4BA,0xA4BB,0xA4BC,0xA4BD,0xA4BE,0xA4BF, +0xA4C0,0xA4C1,0xA4C2,0xA4C3,0xA4C4,0xA4C5,0xA4C6,0xA4C7, +0xA4C8,0xA4C9,0xA4CA,0xA4CB,0xA4CC,0xA4CD,0xA4CE,0xA4CF, +0xA4D0,0xA4D1,0xA4D2,0xA4D3,0xA4D4,0xA4D5,0xA4D6,0xA4D7, +0xA4D8,0xA4D9,0xA4DA,0xA4DB,0xA4DC,0xA4DD,0xA4DE,0xA4DF, +0xA4E0,0xA4E1,0xA4E2,0xA4E3,0xA4E4,0xA4E5,0xA4E6,0xA4E7, +0xA4E8,0xA4E9,0xA4EA,0xA4EB,0xA4EC,0xA4ED,0xA4EE,0xA4EF, +0xA4F0,0xA4F1,0xA4F2,0xA4F3,0xA4F4,0xA4F5,0xA4F6,0xA4F7, +0xA4F8,0xA4F9,0xA4FA,0xA4FB,0xA4FC,0xA4FD,0xA4FE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA9B1,0xA9B2,0xA9B3,0xA9B4,0xA9B5,0xA9B6,0xA9B7,0xA9B8, +0xA9B9,0xA9BA,0xA9BB,0xA9BC,0xA9BD,0xA9BE,0xA9BF,0xA9C0, +0xA9C1,0xA9C2,0xA9C3,0xA9C4,0xA9C5,0xA9C6,0xA9C7,0xA9C8, +0xA9C9,0xA9CA,0xA9CB,0xA9CC,0xA2DF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA8B1,0xA8B2,0xA8B3,0xA8B4,0xA8B5,0xA8B6,0xA8B7,0xA8B8, +0xA8B9,0xA8BA,0xA8BB,0xA8BC,0xA8BD,0xA8BE,0xA8BF,0xA8C0, +0xA8C1,0xA8C2,0xA8C3,0xA8C4,0xA8C5,0xA8C6,0xA8C7,0xA8C8, +0xA8C9,0xA8CA,0xA8CB,0xA8CC, 0, 0, 0,0xA2DE +}; + +/* page 5 0x3380-0x33DD */ +static uint16 tab_uni_ksc56015[]={ +0xA7C9,0xA7CA,0xA7CB,0xA7CC,0xA7CD, 0, 0, 0, +0xA7BA,0xA7BB,0xA7DC,0xA7DD,0xA7DE,0xA7B6,0xA7B7,0xA7B8, +0xA7D4,0xA7D5,0xA7D6,0xA7D7,0xA7D8,0xA7A1,0xA7A2,0xA7A3, +0xA7A5,0xA7AB,0xA7AC,0xA7AD,0xA7AE,0xA7AF,0xA7B0,0xA7B1, +0xA7B2,0xA7B3,0xA7B4,0xA7A7,0xA7A8,0xA7A9,0xA7AA,0xA7BD, +0xA7BE,0xA7E5,0xA7E6,0xA7E7,0xA7E8,0xA7E1,0xA7E2,0xA7E3, +0xA7BF,0xA7C0,0xA7C1,0xA7C2,0xA7C3,0xA7C4,0xA7C5,0xA7C6, +0xA7C7,0xA7C8,0xA7CE,0xA7CF,0xA7D0,0xA7D1,0xA7D2,0xA7D3, +0xA7DA,0xA7DB,0xA2E3,0xA7EC,0xA7A6,0xA7E0,0xA7EF,0xA2E1, +0xA7BC,0xA7ED,0xA7B5, 0, 0, 0, 0,0xA7B9, +0xA7EA, 0, 0,0xA7EB, 0, 0,0xA7DF, 0, +0xA2E4, 0, 0,0xA7E4,0xA7EE,0xA7E9}; + +/* page 6 0x4E00-0x947F */ +static uint16 tab_uni_ksc56016[]={ +0xECE9,0xEFCB, 0,0xF6D2, 0, 0, 0,0xD8B2, +0xEDDB,0xDFB2,0xDFBE,0xF9BB, 0,0xDCF4, 0, 0, + 0,0xF5E4, 0, 0,0xF3A6,0xDDE0,0xE1A6, 0, +0xCEF8,0xDCB0, 0, 0, 0, 0,0xE3AA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF1E9, 0, 0, + 0, 0,0xCDFA, 0, 0, 0, 0, 0, +0xFCAF,0xD3A1, 0,0xF1AB, 0, 0, 0, 0, + 0, 0,0xE7D1,0xD2AC, 0,0xCEF9, 0, 0, + 0, 0, 0,0xF1FD, 0,0xDEBF,0xFBBA,0xF9B9, + 0, 0, 0, 0, 0, 0,0xCED2, 0, +0xE3AB,0xEBE0, 0, 0, 0,0xCEFA,0xCBF7,0xE5A5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xCAE1, 0,0xD4CC, 0, 0, + 0, 0, 0,0xEAE1, 0, 0,0xDCE3,0xDFAD, + 0, 0, 0, 0, 0, 0,0xCBEB, 0, + 0, 0,0xD5AF, 0, 0, 0,0xD6F5, 0, +0xE5F8, 0, 0,0xDEC0,0xECA3, 0,0xE9CD, 0, +0xEAA7,0xE9F6,0xFBBB, 0,0xE7E9,0xEFCC, 0, 0, +0xD0E6, 0, 0,0xDEC1, 0, 0,0xE4AC, 0, + 0,0xD8CC,0xF9F1, 0,0xCEDF,0xFAA4,0xE6B2, 0, +0xFAFB, 0, 0,0xFABD,0xCCC8,0xEFCD,0xD5D5, 0, + 0, 0, 0, 0, 0, 0,0xD3A2, 0, + 0, 0,0xECD1, 0, 0, 0, 0, 0, +0xE4A7,0xECD2, 0, 0,0xF6B1, 0, 0,0xCEFB, + 0, 0,0xD0D1,0xCBBF, 0,0xEDA4, 0, 0, + 0, 0, 0, 0,0xEDA8,0xDEC2,0xF6E2,0xEDDC, +0xDCF5,0xE0B9, 0, 0, 0,0xD4CE, 0,0xF4B5, + 0, 0, 0,0xD3DB,0xD6B5,0xECA4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE4E6, 0,0xF1EA, 0, 0, 0,0xCBEC,0xCBC0, + 0, 0, 0,0xECF2, 0, 0, 0, 0, + 0,0xD0EA, 0, 0, 0, 0, 0, 0, + 0,0xF9F2,0xECA5,0xD0DF, 0,0xE7EA,0xD0EB,0xDCD1, +0xDBE9,0xFDCC, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xDBD7, + 0, 0, 0, 0,0xDAE1, 0,0xD6B6, 0, +0xE3DF, 0,0xDEC3, 0,0xDEC4,0xCAA1, 0, 0, + 0, 0, 0,0xEEEC, 0, 0,0xD3A3,0xEEB7, +0xF8CF, 0, 0, 0, 0,0xEAC8,0xEEB8,0xF1AC, +0xF1A5,0xE9CE, 0, 0, 0,0xF9BC, 0, 0, + 0,0xE5F9,0xECEA,0xDDD6,0xEDC2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF8A5, 0, 0, 0, 0, 0,0xE5BA, +0xDBD8, 0, 0,0xCAA2, 0, 0,0xD1CD, 0, + 0, 0,0xEEED, 0, 0, 0,0xECEB,0xDEC5, + 0,0xE3E0, 0,0xCAC9,0xF2E9, 0,0xD5CE, 0, +0xF6B6, 0,0xCEC2,0xD6C7, 0,0xE3B4, 0,0xF1AD, + 0,0xEAE2, 0, 0, 0, 0,0xD7C2, 0, +0xF3A7, 0, 0,0xCDEA, 0,0xEBEE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD9B2,0xFDA5, + 0, 0, 0, 0, 0,0xF6D5,0xD5E2, 0, + 0, 0, 0, 0, 0, 0, 0,0xF8B5, + 0, 0,0xCCF5,0xF5B5,0xE4AD, 0, 0, 0, + 0,0xE7EB,0xF1D5, 0, 0, 0,0xF0BB, 0, + 0,0xE9B5, 0,0xCCC9,0xFAD5, 0, 0,0xE1D4, + 0, 0,0xD7D6, 0, 0,0xDCC1, 0,0xDEC6, +0xFAEF,0xE3E1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE1F3,0xDCF6, + 0,0xCEFC, 0,0xDBC4, 0,0xF8F1, 0, 0, +0xDCE4, 0,0xE5EF, 0, 0, 0, 0, 0, + 0, 0,0xDCB1, 0, 0, 0,0xD5D6, 0, + 0,0xF3DA, 0,0xCBC1, 0,0xDBC3, 0, 0, + 0,0xD9FA,0xD3EE, 0, 0, 0,0xFAB8, 0, + 0,0xFDA6,0xEBEF, 0,0xF4A6, 0,0xCCCA,0xF3A8, + 0,0xF3DB, 0,0xDBA7,0xF6B7, 0,0xCFE6,0xF0F2, +0xCBDA, 0,0xE7D2,0xD7C3,0xF6F0,0xE8DE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE5A6, 0, 0, 0, 0, + 0, 0, 0,0xE5E7, 0, 0, 0,0xCAA3, +0xCCA7,0xEAC9, 0, 0, 0, 0, 0,0xF8B6, + 0, 0, 0, 0, 0,0xFAA5, 0, 0, + 0, 0,0xF1AE, 0,0xEFCE, 0, 0, 0, + 0, 0, 0, 0, 0,0xCBED, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF6B0,0xEFCF,0xE9CF, 0, +0xF7DE, 0, 0, 0, 0, 0, 0, 0, +0xCED3, 0, 0, 0, 0,0xDCF7, 0, 0, + 0, 0, 0, 0, 0,0xDBA8, 0, 0, + 0,0xCBF8, 0, 0, 0, 0, 0, 0, +0xDFA1,0xDDE1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF5CA,0xE9B6, 0, 0, + 0, 0,0xE7EC,0xEEEE, 0,0xF3F0, 0,0xDFBF, + 0, 0, 0, 0, 0, 0,0xCCCB, 0, + 0, 0, 0, 0, 0,0xD0C1, 0, 0, + 0,0xF4D2,0xE0BA, 0, 0, 0, 0,0xDFC0, + 0,0xCEE0, 0, 0, 0,0xDCD2,0xFDEA, 0, + 0, 0,0xD6F6, 0, 0, 0,0xEACA, 0, + 0, 0, 0, 0, 0,0xE8E9, 0,0xE3AC, + 0, 0, 0, 0, 0,0xF3D0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCAA4, 0,0xDBF8, 0, 0, 0,0xDEC7, +0xEBF0,0xF1D6, 0, 0,0xE5E2, 0,0xCCCC, 0, + 0,0xCBFB, 0, 0, 0, 0, 0, 0, + 0, 0,0xEAE3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xDFC1, + 0,0xD6ED, 0, 0, 0, 0, 0, 0, + 0, 0,0xE9D0, 0, 0, 0, 0, 0, + 0, 0,0xEEB9, 0, 0, 0, 0,0xD5E3, + 0, 0,0xD1D3, 0,0xE5F0, 0, 0, 0, +0xE8B4,0xEBC3, 0,0xEAAA,0xFAFC,0xF5F6,0xF0BC,0xFDD4, +0xE0BB,0xCEC3, 0,0xD0BA,0xF7BA,0xD8F3,0xF7CD, 0, + 0, 0,0xE4AE, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xD4DF, 0, 0, 0, + 0, 0,0xD0E7, 0, 0,0xECFD, 0,0xD2AE, +0xEEEF,0xD5D7,0xEAE4,0xF8A2,0xCDEB,0xD7BF,0xFBB1, 0, + 0,0xCDEC, 0, 0, 0,0xDCB2,0xD0EC,0xCEFD, +0xEEF0, 0, 0, 0,0xCCC2, 0, 0, 0, +0xD0ED, 0, 0, 0, 0, 0,0xE5F7, 0, + 0, 0,0xF3FC, 0, 0,0xEEA2, 0, 0, + 0, 0,0xD9B3, 0, 0,0xD8F4, 0,0xE9B7, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCEAE, 0, 0, 0, 0,0xD9A2, 0, 0, + 0, 0,0xD8F1, 0,0xD4CF, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE5A7,0xD5D2, + 0, 0, 0, 0, 0,0xD6A9, 0, 0, + 0, 0, 0, 0,0xF4A2, 0,0xF1D7, 0, + 0,0xD5D8, 0,0xF0BD,0xD7D0,0xD4D0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xD7CF,0xEBEA,0xFDEB, 0, + 0,0xDBED, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFCC5,0xCBC2, 0, 0, 0, 0,0xFDD5, 0, +0xF4C8,0xE8EA,0xF5F3, 0, 0,0xF9DE, 0, 0, +0xD3EF, 0, 0,0xECD3, 0, 0,0xDDC2,0xEFB7, +0xE7D4, 0,0xCACA, 0, 0, 0,0xD9FB, 0, + 0,0xFAFD, 0, 0, 0, 0, 0,0xD6AA, + 0, 0, 0, 0, 0,0xF4F8, 0, 0, + 0, 0, 0, 0,0xF7F7,0xDCAC, 0, 0, + 0,0xD7D7,0xDFA2, 0, 0, 0,0xCEBE, 0, +0xD3F0, 0, 0, 0, 0, 0,0xF0A4,0xE1EC, +0xCFE7,0xF3CB,0xEDA9,0xCABE, 0, 0, 0, 0, + 0, 0, 0,0xF4EF, 0, 0, 0,0xF6CE, + 0, 0,0xDEFB,0xD0BB,0xD5B7,0xEEF1, 0, 0, + 0, 0, 0, 0,0xF4A8, 0,0xDCF8, 0, + 0, 0, 0,0xCBA7, 0,0xDACE, 0, 0, + 0,0xE0E6, 0, 0, 0, 0, 0, 0, + 0,0xEDA5,0xEEF2, 0, 0, 0, 0,0xDCF9, + 0, 0,0xF9DC, 0, 0,0xF3DC, 0, 0, + 0, 0, 0, 0, 0,0xF8F2, 0,0xF4F9, + 0, 0, 0,0xFCF1, 0, 0, 0,0xD0BC, +0xDBF9,0xD7B1, 0, 0, 0,0xCBFC, 0, 0, + 0,0xF0A5,0xCBFD, 0, 0, 0, 0, 0, + 0, 0, 0,0xD5F4, 0, 0, 0,0xCDED, +0xCAA5, 0, 0,0xD6AB,0xD0C2, 0, 0, 0, + 0,0xF0BE,0xD2BD,0xCCA4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFAB6, 0, + 0,0xCCCD, 0,0xDAFA, 0,0xF6CF, 0,0xE9B8, + 0,0xD8F5, 0, 0, 0,0xCCCE, 0, 0, + 0, 0,0xD7CD, 0, 0,0xD4D1,0xE9ED, 0, +0xCAEB,0xD9E2, 0,0xFDB2, 0,0xE3AD,0xD6CC,0xD9B4, + 0, 0,0xE1A7,0xEED3,0xD0C3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFDB3, 0,0xD5E4, 0, 0, +0xCFE8, 0,0xEDC3,0xD0B2, 0, 0,0xCEFE,0xDAA8, + 0, 0, 0, 0, 0,0xF8D0, 0, 0, +0xFDD6, 0, 0, 0, 0,0xF8D1, 0,0xF8D2, +0xDCD3, 0, 0, 0, 0,0xDDE2,0xFBF9,0xDDC1, + 0,0xE3B5, 0, 0, 0, 0, 0, 0, +0xEDDD,0xCEC4, 0,0xCBA1, 0, 0, 0, 0, + 0, 0,0xDDE3, 0, 0, 0, 0,0xFCDD, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF9AF, 0, 0, 0, 0, 0,0xD2FB, +0xCFA1,0xE4A8, 0,0xF4B6,0xECFE, 0, 0,0xE3AE, +0xE7ED,0xFDC1,0xDAE2, 0, 0,0xD8B3, 0, 0, + 0,0xDDE4,0xF0EF,0xF6F1,0xFAF0, 0, 0,0xD1F5, + 0, 0,0xDACF, 0,0xDCD4, 0,0xDCA6, 0, +0xEFBF, 0, 0, 0, 0, 0,0xCECF, 0, +0xE0D9, 0, 0, 0, 0, 0, 0,0xD9D6, +0xECD4,0xEACB, 0, 0,0xCABF,0xD5B0, 0,0xCFE9, + 0, 0, 0, 0, 0,0xF1ED, 0,0xCCCF, + 0, 0, 0, 0,0xE4F8, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE4ED, 0, 0, 0, 0, +0xD7D8, 0,0xFDA7, 0, 0, 0, 0,0xEAAB, +0xF6B2, 0, 0, 0, 0,0xCFF0,0xF9BD, 0, + 0, 0, 0, 0, 0,0xE6F4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xCBDB, 0, 0, 0, 0, + 0, 0, 0,0xF3D1, 0, 0, 0, 0, +0xE9D1,0xF3A9,0xD0E0,0xE9D2, 0,0xDAE3, 0, 0, + 0, 0, 0, 0,0xE2D2, 0,0xF6A2,0xE1F4, + 0, 0, 0,0xDAE4, 0, 0, 0, 0, + 0,0xE7D5,0xF5BF,0xCFA2,0xCDAF,0xCFA3, 0, 0, + 0,0xCDB0,0xF1FE,0xD0A3,0xE1AF,0xF8A3, 0,0xCAA6, +0xF7BB,0xF2EA,0xDEC8,0xE9D3, 0, 0, 0, 0, +0xDEC9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFDDE,0xCAC0, 0, 0, 0, +0xF9EA,0xD1CE,0xEED4, 0,0xD4D2,0xD9A3,0xFDA8,0xD7D9, +0xF7CE,0xFABE, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xCFD6, 0,0xD7F0, 0,0xEBE1, +0xF8C5, 0, 0, 0, 0, 0,0xDCFA, 0, + 0,0xDDC3, 0,0xF9DF, 0, 0, 0, 0, + 0, 0, 0,0xE7EF, 0, 0, 0, 0, +0xFDE5,0xF6A3, 0,0xD9FC,0xFDA9, 0,0xE7EE, 0, + 0, 0,0xD5E5, 0, 0, 0, 0, 0, +0xEFD0, 0,0xCDB1, 0, 0, 0, 0, 0, + 0,0xF7A2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF1B2, 0,0xF1B1, 0, 0, 0, 0, 0, + 0,0xCDB2, 0,0xDAAB, 0,0xCAA7, 0, 0, + 0, 0, 0,0xE3E2,0xFBBC,0xD9A4, 0, 0, +0xEEBA, 0, 0, 0, 0, 0,0xF8D3, 0, + 0, 0, 0, 0,0xFBFA, 0,0xCFA4, 0, +0xDCFB, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF6E3, 0, 0, 0, +0xEDAA, 0, 0,0xF2A1,0xCEE1, 0, 0, 0, + 0, 0, 0,0xFAA6, 0, 0, 0, 0, +0xF9E0, 0, 0, 0, 0,0xECD6, 0, 0, +0xE4EE,0xF9A1, 0, 0,0xFBEF, 0, 0, 0, +0xF9EB,0xEEA3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEAAC, 0, 0, 0,0xCAA8, 0, 0, +0xF4FA, 0, 0, 0, 0,0xCDD6,0xFCF6, 0, + 0, 0,0xF4C9, 0, 0, 0, 0, 0, + 0, 0,0xF8D4, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF8A6, 0,0xDECA,0xF2C6, + 0, 0, 0, 0, 0, 0,0xD7DA, 0, +0xD3D0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xD8C5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xEAE6, + 0,0xF3DD, 0, 0, 0,0xE4DA, 0, 0, + 0, 0, 0, 0, 0, 0,0xF6E4, 0, + 0, 0, 0, 0,0xF6F2, 0,0xDFC2, 0, + 0, 0, 0, 0, 0, 0, 0,0xD9FD, + 0, 0, 0,0xCCF6, 0, 0,0xD3BA, 0, + 0, 0, 0, 0, 0, 0,0xE4AF, 0, + 0, 0, 0,0xF9E1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF0A6, 0, 0, 0, +0xCBD3, 0, 0, 0,0xE0BC, 0,0xF4CA,0xD4FA, + 0,0xFDAA,0xF9E2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF4B7,0xFDC2,0xFCB0, 0,0xFDEC,0xCAE2, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xFDBD, + 0,0xEAE7,0xDFC3,0xD1D2,0xCEE2, 0,0xD3A4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xFDAB, 0,0xDFE0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF2C7, 0, 0, 0, + 0, 0,0xE7F0, 0,0xD0EE, 0, 0,0xF3AA, + 0, 0, 0,0xDECB,0xF6B8, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE1F5,0xF1B3, 0, + 0, 0, 0, 0, 0, 0,0xF7A3, 0, + 0,0xCAA9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCFA5, 0, 0,0xDFC4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE1B0, + 0, 0,0xF0BF, 0,0xF6A4, 0,0xE3B6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFAC6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD0EF, 0, 0,0xFDED, 0, 0, 0, 0, + 0, 0, 0, 0,0xDDC4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFCF7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE6BF, 0, 0, + 0, 0, 0, 0,0xDEAD, 0,0xFABF, 0, + 0, 0, 0, 0,0xE5F1, 0, 0, 0, + 0, 0, 0, 0,0xEDC4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD2A5, 0, 0,0xFDEE, 0, 0, + 0,0xF5B6, 0, 0, 0, 0, 0, 0, + 0, 0,0xE1F6,0xDECC, 0, 0,0xFCDE, 0, +0xECD7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCDDD, 0, 0, 0, 0, 0, 0, 0, + 0,0xD6B7,0xCDB3, 0, 0, 0, 0, 0, + 0, 0, 0,0xF8D5,0xE5D8, 0, 0, 0, +0xCFEA, 0, 0,0xCFD0, 0,0xEACC, 0, 0, + 0, 0,0xEAAE,0xEAAD, 0, 0,0xD3F1, 0, +0xD3A5, 0, 0, 0, 0, 0, 0,0xF7CF, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEEA4, 0, 0, 0, 0,0xD0A4, 0, 0, +0xF2A2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD0F0, 0, 0, 0, 0, +0xF2A3, 0,0xF7F8, 0, 0, 0, 0,0xD0B3, + 0, 0,0xDBA9, 0, 0,0xD3BB,0xCAEC, 0, +0xF1A6,0xCBD5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF7E7, 0, 0,0xCDDE, 0,0xF7A4, 0, + 0, 0,0xF8C0, 0, 0, 0,0xD3DD, 0, +0xCCD0, 0, 0, 0, 0,0xCFA6, 0, 0, + 0, 0, 0, 0,0xF6F3, 0, 0, 0, + 0, 0,0xE1F7, 0, 0, 0, 0, 0, +0xD3DC, 0, 0,0xFAFE, 0, 0, 0, 0, + 0, 0, 0,0xFAA7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEBD9, 0,0xCFA7,0xEAAF, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE4EF, 0, 0, 0,0xE9B9, +0xF1D8, 0, 0,0xD8D8, 0, 0,0xE0F2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE6B4, +0xDCFC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF3F1, 0, 0, 0,0xE3D0, 0, 0,0xF2FB, + 0,0xDBC6,0xD0F1, 0,0xD0F2, 0, 0, 0, +0xCFDC, 0,0xD3D1, 0, 0,0xCCB1,0xF7D8, 0, +0xCBA8,0xEBBC,0xE4BE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF4DC, 0, + 0,0xDCC2, 0, 0,0xF0A7, 0, 0,0xE6C0, + 0, 0,0xCAED, 0, 0, 0, 0,0xE8EB, +0xE5E8,0xDCC3, 0, 0,0xEDDE,0xD3F2, 0, 0, + 0, 0,0xCCF7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xCED4,0xE7AB, 0, 0, 0,0xCBC3, + 0,0xE1B1, 0, 0,0xF7B2, 0, 0,0xD3F3, +0xD3D2, 0,0xF5C0, 0, 0, 0,0xDFDD, 0, + 0,0xEEF3,0xE7F1, 0,0xFDB4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF2C8, 0, 0, + 0,0xF3D2, 0, 0,0xEEF4, 0,0xE2D3, 0, + 0, 0, 0,0xCCD1, 0,0xDFEA, 0, 0, + 0,0xE9BA, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD9D7, 0, 0, 0, 0, + 0, 0, 0, 0,0xF5CD, 0,0xF1F2,0xFAC7, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD9F8,0xD4C2, 0, 0, 0, 0,0xF6E5, 0, + 0, 0, 0,0xDDC5, 0, 0, 0, 0, + 0, 0,0xE7F2,0xEDDF, 0, 0,0xCACB, 0, + 0,0xDBFA, 0, 0, 0,0xE8B5, 0,0xD3A6, + 0, 0, 0, 0, 0, 0,0xFDB5, 0, + 0,0xF9C9, 0,0xE4E2, 0,0xFBBD, 0, 0, +0xD7A4,0xCEC5, 0, 0, 0, 0,0xCED5,0xD6E6, + 0, 0, 0, 0,0xE5BD, 0, 0, 0, + 0, 0, 0,0xDECD,0xECF3, 0, 0,0xEDE0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xECEC,0xFBBE,0xDFEB, 0,0xE1F8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xF9BE, + 0, 0, 0, 0,0xD0F3,0xE0AA,0xE8E2, 0, + 0,0xE2D4,0xD2FD, 0,0xE5A8, 0, 0, 0, + 0, 0,0xD9D3, 0, 0, 0, 0,0xD3DE, + 0,0xF4B8,0xF7BC,0xDCFD, 0,0xE8EC,0xE4E7, 0, + 0,0xE3F7, 0, 0, 0, 0, 0,0xECA8, + 0, 0, 0, 0, 0, 0,0xFAF1, 0, + 0, 0, 0, 0,0xE5F2, 0, 0,0xD0F4, +0xD2AF,0xDCE5, 0, 0, 0, 0,0xD0A5,0xF1B4, +0xFCB1,0xCCF8, 0, 0,0xDDC6,0xFAD1, 0,0xF7DF, + 0, 0,0xFAA8, 0, 0, 0, 0, 0, +0xEEF5, 0,0xDECE, 0, 0, 0, 0,0xE7F3, + 0, 0,0xF7AC,0xEBC4,0xEDE1,0xE0AB,0xDDC7, 0, + 0, 0, 0,0xD2B3,0xD2BF, 0, 0, 0, +0xCACC, 0, 0, 0, 0,0xFBBF, 0, 0, + 0, 0,0xE5FD,0xDDE5,0xD8CD, 0, 0, 0, + 0, 0,0xECF4, 0, 0, 0, 0, 0, + 0, 0, 0,0xD0F5, 0, 0,0xE8ED,0xD0D2, + 0,0xD9D8, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF6E6, 0, 0, +0xDBAA, 0, 0, 0,0xF7E0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xD8D9, 0,0xF4A3, 0, 0,0xF4DD, 0, + 0, 0, 0,0xEFD1, 0, 0,0xD9B5, 0, + 0,0xEDAB, 0,0xE3B7, 0, 0, 0, 0, +0xEEBB,0xCDB4, 0,0xE0F3,0xEACD, 0, 0, 0, + 0,0xECF5,0xE8EE, 0,0xCBA9,0xF1AF, 0, 0, + 0, 0, 0, 0, 0, 0,0xCACD, 0, +0xECA9, 0,0xF2EB, 0,0xFDEF, 0,0xF9F3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE6C1, 0, 0,0xECD8, 0, 0, 0,0xEDAC, + 0,0xEACE, 0,0xE8DF, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xDECF, 0, 0, 0, 0, 0, 0, +0xD2A6, 0, 0,0xE7F4,0xD1D6, 0, 0,0xE6C2, +0xE3E3, 0, 0, 0, 0,0xE4B0, 0, 0, + 0,0xD8B4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF6A5, 0, + 0, 0, 0, 0,0xF3DE, 0, 0, 0, + 0,0xD7A5, 0, 0, 0, 0,0xF7E8, 0, + 0,0xE8C6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xFBE6, 0, 0, 0, 0, 0, + 0, 0,0xDDE6, 0, 0, 0,0xDCFE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD8DA, 0, 0, 0, 0, 0, + 0, 0,0xDAAC,0xEAB0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE3B8, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCAAA,0xE1F9, 0,0xEAB1, 0, 0, 0, + 0,0xF2EC, 0, 0,0xFAEE, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEED5, 0, 0, 0, 0,0xF9F4, 0, + 0,0xD2EC, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xFBFB, 0, 0, + 0,0xFDF0, 0,0xE0BD,0xCEE3, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF8C6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xDEAE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xDFC5, 0, 0,0xE5BE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEDAD,0xFAEA, 0, 0,0xCDEE,0xEDA6, 0,0xEDAE, +0xF0ED, 0,0xDDA1, 0,0xEDAF,0xFCF8, 0,0xD8EB, + 0, 0, 0,0xCCF9,0xCDB5, 0, 0, 0, + 0,0xFAA9, 0,0xE1DD, 0, 0, 0, 0, +0xE2D5,0xEDCF, 0, 0, 0,0xDDA2, 0, 0, +0xF9CA, 0,0xEAE8, 0,0xE5ED, 0, 0, 0, + 0, 0, 0, 0, 0,0xD3EB, 0,0xE9D4, +0xE1FA,0xE4CC, 0,0xE1E4,0xE8C7, 0, 0,0xCEDB, + 0, 0, 0,0xDCD5, 0,0xF7B5,0xFCF3,0xF0F3, +0xCEAF,0xF1B5,0xEFD2,0xE8C8,0xEBF1, 0, 0, 0, + 0, 0,0xCBD4,0xE0BE,0xE3F8,0xEAE9,0xFCB2, 0, + 0, 0, 0, 0,0xE0F4, 0,0xCFE0, 0, +0xEEA5, 0, 0,0xFAAA,0xE6C3,0xE1B2,0xCAAB, 0, +0xE3E4,0xE9BB, 0, 0, 0, 0, 0,0xE2D6, +0xF3F2, 0,0xEED6,0xEAB2,0xD0F6,0xECD9,0xDACB,0xCFA8, + 0, 0, 0, 0,0xDDA3, 0, 0, 0, +0xD8DB, 0,0xF9CE,0xE9D5,0xE3D1, 0, 0,0xD2BC, + 0, 0, 0, 0, 0, 0,0xD8AC,0xF3CC, + 0,0xCDFB,0xF6D6, 0,0xE7F5,0xE8EF,0xE3F9,0xD2BB, +0xF3F3,0xE3FB, 0,0xDED0,0xCEB0, 0,0xD6F7,0xF1D9, + 0, 0, 0, 0, 0,0xF5C1,0xDCC4, 0, +0xF5BB, 0,0xDED1, 0, 0, 0, 0, 0, + 0,0xDCE6, 0, 0,0xDED2, 0, 0,0xEDE2, +0xEEF6,0xEACF,0xF0EE,0xE3FC, 0,0xD3DF,0xD3F4,0xE1B3, + 0,0xE1B4, 0, 0, 0, 0,0xF4D3, 0, + 0,0xDFC6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE9D6, 0, 0, 0, +0xDBAB, 0, 0, 0, 0, 0, 0, 0, + 0,0xF6A6, 0, 0, 0, 0, 0, 0, +0xE3B9,0xEBC5,0xF4A9,0xCDB6,0xD2F9, 0,0xDAAD,0xD2E3, +0xCFD1, 0, 0, 0, 0,0xCBDC,0xCCFA, 0, +0xCFDD, 0, 0,0xE8A9, 0,0xE3BB,0xE3BA, 0, + 0,0xE0DA, 0, 0, 0,0xEEF7, 0, 0, + 0, 0, 0,0xDCB3, 0, 0, 0, 0, +0xD3F5, 0,0xD7A6, 0,0xF6B5,0xD7DB, 0, 0, + 0, 0, 0, 0,0xE1D5, 0, 0,0xD4EA, + 0,0xDFA3, 0, 0, 0, 0, 0, 0, + 0,0xFDDF, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD0F7,0xEDD4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCBAA, 0, 0, 0, 0, 0, 0, + 0,0xE4DB, 0,0xE1FB,0xCBA2, 0, 0, 0, + 0,0xD3E0, 0,0xE4BF, 0,0xFBC0, 0,0xDABE, +0xE4CD, 0,0xD6B9, 0, 0, 0,0xEFC0, 0, +0xE1FC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF6B9, 0, 0, 0, 0, 0, 0, +0xDFC7, 0, 0, 0, 0, 0, 0, 0, +0xE4B1, 0, 0, 0, 0, 0, 0,0xDCE7, +0xDCE8, 0, 0, 0,0xFAD6, 0,0xD3F6, 0, + 0, 0, 0,0xF1DA, 0,0xFAF2, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE2FD, + 0, 0, 0, 0, 0,0xD5CF,0xD0F8, 0, + 0,0xCDDF, 0, 0,0xF5CB, 0,0xE4F0,0xCBAB, + 0,0xD7C4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE2FE, + 0,0xDDDA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xDAAE,0xCAEE, 0, 0, 0, +0xD5B9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE3A1, 0, 0,0xE8E3, 0, 0,0xF3AB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCFA9, + 0, 0, 0,0xD3F7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD4F1, 0, 0, +0xCEE4, 0,0xE8F2, 0, 0, 0, 0, 0, + 0, 0,0xE5F5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE7AE, 0,0xD6BA, 0,0xDFEC,0xE4C0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE8E4, 0, 0, + 0, 0,0xD8B5, 0, 0, 0,0xE4DC, 0, + 0, 0, 0, 0, 0,0xF4B9,0xF1B6, 0, + 0,0xE2DE,0xE1B5, 0, 0,0xCDEF,0xF1A7,0xCEE5, +0xCBDD, 0, 0,0xD9E3, 0, 0,0xF3AC, 0, + 0,0xD0F9,0xECAB,0xDED3,0xF7E9, 0, 0,0xF9F5, + 0, 0, 0, 0, 0,0xE1DE,0xCBEE, 0, + 0, 0,0xE3BC,0xF8D6, 0, 0,0xDBEE, 0, + 0, 0, 0, 0,0xFDF1, 0, 0, 0, + 0,0xF7B6, 0, 0, 0, 0,0xF4DE, 0, + 0,0xF2ED, 0,0xDBD9, 0,0xF0A8, 0, 0, + 0, 0, 0, 0, 0,0xE1FD, 0, 0, + 0, 0, 0,0xDED4, 0,0xE0AC, 0, 0, + 0, 0, 0,0xEDE3, 0, 0,0xD3E1, 0, +0xDFC8, 0, 0, 0, 0,0xD9B6, 0,0xFDAC, +0xEFD3, 0, 0, 0,0xE4C1,0xF8EB, 0,0xDBAC, + 0, 0, 0, 0,0xFCC6, 0, 0, 0, + 0, 0, 0, 0, 0,0xD8AD, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xF6BA, + 0,0xDBDF,0xD3D3,0xF8C7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xCACE,0xF8C1,0xD2B4, 0, 0,0xDCB4, +0xFAB9,0xCACF, 0,0xFCB3,0xEAEA,0xEAEB,0xD0FA, 0, + 0, 0, 0, 0,0xEDE4, 0, 0,0xDDE7, + 0, 0,0xDFC9, 0, 0, 0, 0,0xDFED, + 0, 0, 0, 0, 0,0xEEBC, 0,0xEFC1, + 0, 0,0xCCD2, 0,0xDDA4, 0, 0, 0, +0xDFCA, 0, 0, 0, 0, 0,0xD3F8,0xF1A8, + 0, 0, 0,0xCDB7, 0,0xEFD4, 0, 0, + 0, 0, 0, 0, 0,0xE4DD,0xDFEE,0xCBAC, +0xE9BC, 0, 0, 0, 0, 0,0xEAEC, 0, + 0, 0,0xDFCB, 0, 0, 0, 0, 0, +0xF9BF,0xD6AF,0xD5C6, 0, 0, 0, 0, 0, +0xCFAA, 0, 0,0xCEA9, 0, 0,0xD6F8, 0, + 0, 0,0xF1B7,0xEEF8, 0, 0, 0,0xD9D9, +0xF3DF, 0,0xF8C8,0xCEC6, 0, 0, 0, 0, + 0, 0, 0, 0,0xD5E6, 0, 0, 0, + 0, 0, 0,0xF4E6, 0, 0,0xE6C5,0xEFD5, + 0, 0,0xCBEF,0xFCDF, 0, 0, 0, 0, + 0,0xDCA7, 0, 0,0xD6E7, 0, 0, 0, + 0, 0,0xF8C9, 0, 0, 0, 0,0xE3D2, + 0,0xE3BD, 0,0xCFE1,0xF0C0,0xECDA, 0,0xDDD7, +0xFBF0, 0, 0,0xECAC, 0, 0, 0,0xF0A9, + 0, 0, 0, 0, 0, 0,0xFAD7,0xFBC1, + 0,0xD2C0, 0, 0, 0, 0, 0, 0, + 0,0xE5B0, 0, 0, 0,0xEDE5, 0, 0, + 0, 0,0xCBAD, 0,0xF9B0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF7A5, 0,0xCBAE, 0,0xDAAF, 0,0xD8B6, 0, + 0, 0, 0, 0, 0, 0,0xD3A7,0xFBB2, + 0,0xFDC4, 0,0xECAD, 0, 0, 0, 0, + 0, 0,0xFBA1, 0, 0, 0,0xE5E9,0xE9EE, + 0,0xF3F4,0xF8F3,0xF0C1,0xDEAF,0xF8B0, 0, 0, +0xF3E0,0xE7AF, 0, 0, 0, 0, 0,0xDBAD, + 0,0xE6B5, 0, 0,0xF9A8, 0, 0,0xDDD8, +0xE8D9,0xEFD6, 0, 0, 0,0xD3E2, 0,0xE2DF, + 0, 0,0xFCE0,0xD7C8,0xFDAD, 0, 0, 0, +0xDFEF,0xCCD3,0xD3F9, 0, 0, 0, 0,0xD4F0, +0xDBC7,0xDED5, 0, 0, 0, 0,0xF0F4, 0, +0xD5D0,0xE5D9, 0, 0, 0, 0, 0, 0, +0xFCC7,0xDCD6,0xE2E0, 0, 0, 0,0xDAB0, 0, + 0, 0, 0, 0, 0,0xF3A3, 0,0xD3EC, + 0,0xF4CB, 0, 0, 0,0xFDC5, 0, 0, + 0, 0, 0,0xE3FD, 0,0xF9B1, 0, 0, + 0, 0, 0, 0,0xD0FB,0xECDB, 0, 0, + 0, 0, 0, 0, 0, 0,0xF5BC,0xF2A4, +0xD8CE,0xD8CF, 0, 0, 0, 0, 0, 0, +0xF5F7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF6E1, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD2B7, 0, 0, + 0, 0, 0, 0, 0,0xFBEC, 0,0xDDC8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE4E8, + 0, 0,0xD2C1, 0, 0, 0,0xF8D7, 0, + 0, 0, 0, 0,0xD6BB,0xDED6, 0, 0, +0xF7BD,0xECAE, 0, 0, 0,0xD0E1, 0,0xE0F5, +0xEAB3, 0,0xCED6, 0, 0, 0, 0,0xCCA5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xECF6,0xE2E1,0xE3BE, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xFCC8, 0, 0, +0xCDF0, 0,0xF9F6, 0, 0,0xDFF0, 0, 0, + 0,0xE5BF, 0, 0, 0,0xCEBF, 0, 0, + 0, 0,0xFCE1,0xEDB0,0xFDD1,0xF6BB, 0, 0, +0xF9CF,0xEBDA,0xCAC1, 0,0xD2B8,0xCDF1, 0,0xE3D3, +0xFDE6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE6ED, 0, 0, + 0,0xE3FA, 0, 0,0xF0AA,0xF9D0, 0, 0, + 0, 0, 0, 0,0xFCE2, 0,0xF8A7, 0, + 0, 0,0xE1E5,0xEEF9, 0, 0, 0,0xE7F6, +0xEAED, 0, 0,0xFCB4,0xF5C2, 0, 0,0xD7DC, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF0F5, 0,0xDDE8,0xD3ED,0xF5FC, 0,0xDABF, 0, +0xCCFB, 0, 0, 0,0xD3FA,0xF4A4, 0, 0, + 0, 0, 0, 0, 0,0xEFD7, 0,0xD4C3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFBE3, 0, 0, 0, 0, 0, 0, + 0, 0,0xFBED, 0,0xE0AD, 0, 0,0xEAEE, +0xFBB3,0xE4C2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF6E7,0xD2DD, 0,0xDFCC, 0, 0,0xFCC9, 0, + 0,0xE5A9,0xE0F6,0xF6B3, 0, 0, 0, 0, + 0,0xE1FE, 0, 0, 0, 0,0xCBF0, 0, +0xEAEF,0xEAF0, 0, 0, 0,0xDAC0,0xF8B4,0xEBF2, + 0, 0, 0, 0, 0,0xE4C3, 0, 0, + 0, 0,0xE9D7,0xE4F1, 0, 0, 0,0xCAEF, + 0, 0, 0, 0, 0, 0, 0,0xCED7, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFCCA, 0, 0, 0,0xF3E1, 0, 0,0xCBC4, + 0, 0, 0, 0,0xE3E5, 0,0xCBC5,0xEAB4, + 0, 0,0xE9BD, 0,0xD7C9, 0, 0,0xEBDB, +0xEDB1, 0,0xCCC3,0xF7BE,0xFCCB, 0, 0, 0, + 0, 0, 0,0xF8F4, 0,0xD9B7, 0, 0, +0xF3D3,0xF3D4, 0, 0, 0,0xF7E4, 0,0xF7D1, + 0, 0,0xD8B7,0xCEB1,0xCAC2, 0, 0,0xFBB4, +0xCBC6, 0, 0,0xF0F6, 0, 0,0xD5E7, 0, +0xEAD0, 0, 0, 0, 0, 0,0xCCD4,0xCBAF, + 0, 0, 0, 0, 0,0xF4AA,0xE9AF, 0, + 0,0xF5C3,0xE9D8, 0, 0, 0, 0, 0, + 0, 0,0xDDE9, 0, 0, 0,0xF1F3, 0, +0xD5FB,0xDEBB, 0, 0,0xF4FB, 0, 0, 0, +0xFDF3,0xFDF2,0xF7A6, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDDC9, 0, 0,0xD4D3, + 0,0xCCA8, 0,0xDAC1,0xCCD5, 0,0xD9E4, 0, + 0, 0,0xFACA, 0, 0, 0,0xE5E3, 0, + 0, 0,0xD3BC, 0, 0, 0,0xCAF0, 0, + 0, 0, 0,0xD0C4, 0, 0, 0,0xCAD0, +0xFAAB,0xEBEB,0xE7F8,0xD9E5, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD1D7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF3A4, 0, 0, 0,0xD4FB,0xFCE3, +0xFAD8, 0,0xF3D5, 0,0xCFAB, 0, 0,0xEBF3, +0xD5FC, 0, 0, 0, 0, 0, 0,0xD3D4, +0xCDFC, 0,0xD9E6, 0,0xE2F9,0xE2A1,0xEBD4, 0, +0xE0F7,0xE4B2,0xCCFC, 0, 0, 0,0xFBE4, 0, + 0, 0,0xF4AB, 0, 0, 0, 0,0xD0BD, + 0,0xCAF1, 0, 0, 0, 0, 0, 0, + 0, 0,0xEFB8, 0, 0, 0,0xD7C0, 0, +0xEEFA,0xFDF4, 0, 0,0xD3E3, 0,0xFBC2, 0, + 0, 0, 0, 0, 0, 0,0xD5E8,0xDBAE, +0xE1B6,0xF8B7, 0, 0, 0, 0, 0,0xE0BF, +0xFBC3,0xDDEA, 0,0xE2A2, 0,0xEEA6, 0, 0, + 0, 0, 0,0xF6E8, 0, 0, 0, 0, +0xF6F5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xDDCA, 0, + 0,0xD0E2, 0, 0, 0, 0,0xDDA6, 0, + 0,0xDDEB, 0, 0,0xE4F9, 0, 0,0xE3AF, +0xD0FC, 0, 0, 0,0xF4FC, 0, 0, 0, + 0,0xCCBC,0xF7EA, 0, 0, 0, 0, 0, + 0,0xE5E4,0xDFF1, 0, 0,0xF7E1, 0,0xF9F7, +0xEFB9, 0, 0,0xF8D8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF9A9, 0, 0, 0, 0, + 0,0xF8D9, 0, 0, 0,0xEEBD, 0, 0, + 0,0xD8C6, 0, 0,0xE4E3,0xF5CE, 0, 0, + 0, 0,0xDDD9, 0, 0, 0, 0,0xD9E7, +0xD2B9,0xD5C3, 0, 0,0xDAE5,0xDAD0, 0,0xD1D9, +0xCED8, 0,0xCBDE,0xF4AC,0xDAFB, 0,0xF6E9,0xE8F3, +0xCFAC,0xF0F0, 0,0xF4FD,0xDBC8, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCEC0,0xE3D4,0xD1CF,0xF1F5, + 0,0xCDF2, 0,0xCFEB, 0, 0, 0,0xCDB8, + 0, 0, 0, 0, 0, 0,0xE3A6,0xD1DA, + 0,0xF2A5, 0, 0, 0, 0, 0,0xF2A6, + 0,0xE4CE, 0, 0, 0, 0, 0, 0, + 0,0xD3FB, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF1A9, 0, 0, 0,0xF2C9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xEFD8,0xE6C9, 0,0xD8B8,0xFAF3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF3B5, 0, 0,0xF8A4, 0, 0,0xD1F3, +0xE6C8, 0, 0, 0, 0,0xF8DA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xDCE9, +0xDED7, 0, 0, 0, 0, 0,0xCBDF, 0, + 0, 0,0xCFEC, 0, 0, 0, 0,0xF4DF, + 0, 0,0xD1F4,0xD2BA, 0, 0, 0,0xDFF2, + 0, 0, 0,0xE1B7, 0, 0, 0, 0, +0xE2A3,0xD3FC, 0, 0,0xEDE6, 0, 0, 0, + 0, 0,0xDBC9, 0, 0, 0,0xE4FA, 0, +0xCFDE, 0, 0,0xCED0, 0, 0, 0, 0, +0xD5D3,0xF3F5,0xF7AE, 0, 0,0xEFC8, 0,0xCDF3, +0xF5CF,0xE5F3,0xF0C2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCAD1, 0, 0, 0,0xEAF1, 0,0xD0A6, 0, + 0, 0, 0, 0, 0, 0, 0,0xD9DA, +0xF0AB, 0, 0, 0, 0, 0,0xEBE7, 0, + 0, 0,0xE5C0,0xFCB5, 0, 0, 0, 0, + 0,0xE4C4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xCCA9,0xFDC6, 0, + 0, 0, 0, 0,0xEAB5, 0,0xE5AA,0xDFBA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE1DF, 0,0xDAD1, + 0, 0, 0, 0,0xE1B8, 0,0xE8F4,0xD3FD, + 0, 0, 0, 0,0xE2A4, 0, 0, 0, + 0, 0,0xF2CA, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDAE6,0xF7B3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xFDCD, 0, 0, 0,0xF3B6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEED7, 0, 0, 0, 0, 0, 0, 0, +0xF5C4, 0, 0, 0, 0, 0, 0, 0, + 0,0xD8A4, 0, 0, 0, 0, 0,0xF2A7, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD9B8,0xD9B9,0xEFC9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD6CE, 0, 0, 0, 0, 0, 0, 0, + 0,0xF7CB,0xDFAE,0xE8F5, 0, 0, 0, 0, + 0, 0,0xD2B5, 0, 0, 0,0xD3D5, 0, + 0, 0, 0, 0,0xF4CC,0xDAFC, 0, 0, + 0, 0, 0,0xD9E8, 0,0xF7EB,0xF5C9, 0, +0xF3BC, 0,0xDAD2, 0, 0, 0, 0, 0, + 0, 0, 0,0xD3B5, 0, 0, 0, 0, + 0,0xE8B6, 0, 0,0xD6CF,0xF4BA, 0,0xF7C9, + 0, 0,0xCCAA, 0, 0,0xF0C3,0xCCD6, 0, + 0, 0,0xD0D3, 0,0xD3BD, 0, 0, 0, +0xDBFB, 0,0xCBE0, 0, 0, 0, 0, 0, + 0,0xD3E4,0xF6F7, 0, 0,0xD5BA,0xF3CD,0xCBE1, + 0, 0, 0, 0,0xEBF4, 0, 0, 0, + 0, 0,0xF4AD, 0,0xFCAA, 0, 0, 0, + 0, 0,0xF7EC, 0, 0, 0,0xE8F6, 0, +0xDAE7, 0, 0, 0,0xF7CC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE5C1, 0, 0, 0, 0,0xE0EE, 0, 0, + 0, 0, 0,0xD5FD, 0, 0, 0, 0, + 0, 0,0xCEE6,0xFCAB,0xD5BB, 0, 0,0xF2A8, + 0, 0, 0, 0, 0, 0,0xE2A5,0xCDB9, +0xEAF2,0xCBC7, 0,0xCDF4, 0, 0,0xDBAF,0xEFD9, + 0, 0, 0, 0, 0,0xCDBA, 0, 0, +0xFCF9, 0, 0, 0, 0,0xDFF3,0xCEE7,0xDAC2, + 0,0xCFAD, 0, 0, 0, 0,0xE7F9,0xF8A8, + 0, 0, 0, 0, 0, 0,0xF3E2, 0, + 0, 0,0xCAF2,0xDFA4, 0, 0,0xD4C4, 0, + 0, 0, 0, 0,0xCCD7,0xE5C2, 0, 0, + 0, 0,0xCDBB, 0,0xEFDA,0xEED8, 0,0xDDA7, +0xE2A6, 0, 0, 0, 0, 0,0xE0C0, 0, + 0, 0,0xD6B0,0xF8CA, 0,0xFCFA, 0,0xD9FE, + 0, 0, 0, 0,0xDEB0, 0, 0, 0, +0xDDEC,0xDAE8, 0, 0, 0, 0, 0,0xD4E0, + 0,0xD6F9, 0,0xCDD7,0xDED8, 0, 0,0xF2F8, + 0,0xE4D6, 0, 0,0xD0C5,0xF4AE, 0,0xDDA8, + 0, 0, 0,0xEDC5,0xF3D6, 0, 0,0xDED9, +0xE3E6, 0, 0, 0, 0, 0, 0,0xD3A8, + 0,0xDBB0, 0, 0,0xE5DA,0xE3BF, 0, 0, + 0,0xDBB1, 0, 0, 0,0xD5E9, 0, 0, + 0, 0, 0,0xE0C1,0xEFDB, 0, 0,0xF0E9, + 0, 0,0xD7B2, 0, 0, 0, 0,0xD0FD, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD9E9, 0, 0,0xD0FE, 0,0xECED,0xD3A9, 0, +0xF2A9,0xF0C4, 0, 0,0xE2E2,0xE9EF, 0, 0, + 0,0xF9D1, 0, 0,0xE9D9, 0, 0, 0, + 0, 0,0xE8DA,0xDAC3,0xDAC4,0xD4C5, 0,0xE7FA, + 0, 0, 0, 0, 0, 0,0xCDE0,0xE3B0, + 0,0xDBB2,0xFBC4, 0,0xF3E3, 0,0xD9A5,0xFBE7, +0xDDCB,0xD0D4, 0,0xE6B6,0xE0AE,0xFDDA, 0, 0, + 0, 0, 0, 0, 0, 0,0xDCB5,0xE0F8, +0xE7B1, 0, 0, 0, 0,0xF5F0, 0,0xD8DC, +0xEDC6, 0, 0, 0, 0,0xE1B9, 0,0xE3C0, +0xF9C0,0xE9F0, 0, 0,0xD9DB, 0,0xF3E4, 0, + 0, 0,0xDCB6,0xE4E9, 0, 0, 0, 0, + 0,0xF0C5,0xE3C1,0xFCCC,0xFCCD, 0, 0, 0, + 0,0xF2CB, 0,0xF2CC, 0, 0, 0,0xE4CF, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF1DB, 0,0xFAD9, 0,0xF1B8,0xFDF5,0xE0F9, + 0, 0, 0, 0,0xE7FB,0xFCB7,0xFCE4,0xFBC5, +0xE3E7,0xD8B9, 0,0xF6F8, 0, 0,0xDCC5,0xCCD8, + 0, 0, 0,0xE0AF,0xF4E7, 0,0xEFDC,0xCFFC, +0xEFDD, 0,0xF2AA, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFDBE, 0, 0,0xCAAC, +0xFDBB,0xFDC7, 0, 0, 0, 0,0xE7B2, 0, +0xEAD1,0xDFF4, 0, 0, 0, 0,0xD1EC,0xE4DE, +0xE5C3, 0, 0, 0, 0,0xD9A6, 0, 0, +0xCDBC, 0,0xF3E5, 0, 0, 0, 0, 0, + 0, 0, 0,0xEDD5, 0, 0,0xD9BA, 0, + 0, 0,0xEDE7,0xFBB5,0xF8EC, 0, 0, 0, + 0,0xE0E7, 0,0xCCD9, 0, 0,0xD4C6, 0, + 0, 0, 0, 0,0xE7A5, 0,0xD5F5,0xD3BE, + 0,0xFCFB, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE4F2, 0, + 0,0xDFF5, 0, 0,0xE8F8,0xF8ED, 0, 0, +0xCEC7, 0, 0, 0, 0, 0,0xFDF6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE8D8, 0,0xCDD8,0xE7D6,0xCCDA, 0, 0,0xCAE3, +0xDFF6,0xF0C7,0xF0C6, 0,0xD8BA, 0,0xF1F4,0xF4F0, +0xF5CC, 0, 0,0xFCE5, 0, 0, 0, 0, +0xEAC5,0xEAF3, 0,0xDDDB, 0,0xDCD7, 0, 0, + 0, 0, 0, 0,0xDEFD,0xF2F9, 0,0xD5C7, + 0, 0, 0,0xD8D0, 0,0xF0C8,0xD1A1,0xD1A2, + 0, 0, 0, 0, 0, 0,0xD9D4,0xD6E8, +0xD9CA, 0,0xDAB1,0xD8C7,0xDCE2,0xF3CE,0xF5F4, 0, + 0,0xF1B9, 0, 0,0xDAD3, 0,0xF6EA, 0, + 0, 0,0xCFF5, 0, 0,0xFDAE, 0, 0, + 0, 0, 0, 0, 0, 0,0xCAD2, 0, + 0,0xDFB4, 0, 0, 0, 0,0xD7DD,0xFABA, +0xEEA7,0xF5BD, 0,0xF8F5, 0, 0,0xEDE8, 0, + 0, 0, 0, 0,0xD4E1, 0,0xD1A3,0xE1D6, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF9F8, 0,0xDBCA, +0xCBF9,0xD4D4, 0,0xD9DC, 0,0xEEBE, 0,0xF7ED, + 0, 0, 0,0xD2EE, 0, 0,0xE1E6,0xF7F9, + 0, 0, 0, 0, 0, 0, 0,0xDDED, + 0,0xE8DB, 0,0xDBB3, 0, 0, 0,0xD1F7, +0xE0B0, 0, 0,0xD4E2, 0,0xF6D7, 0,0xD7F9, + 0, 0,0xD8DD, 0,0xCDFD,0xF2AB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCDBD, +0xF8C2, 0, 0,0xF2AC, 0, 0,0xCAAD,0xCAAE, +0xCFAE, 0, 0, 0, 0, 0,0xE3C2, 0, + 0, 0, 0, 0,0xDCB7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xDBDA, +0xD9BB,0xCAF3,0xF6D3,0xE6F8,0xEAF5, 0, 0, 0, + 0, 0,0xEAF6, 0, 0,0xF6F9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCFAF, 0, 0,0xCAD3, 0, 0,0xCAAF, +0xD2B0,0xF1BA, 0,0xD7B3,0xE3C3,0xF3FD,0xDEDA, 0, + 0, 0, 0,0xDEDB, 0, 0,0xEFDE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE2E3,0xEEFB, 0, 0,0xDFF7,0xD7CA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCEE8,0xDBDB, 0, 0, 0, 0, 0, + 0, 0,0xF1BB, 0, 0, 0, 0,0xE9F1, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFAB7,0xD0C6, 0, 0,0xCCAB,0xEEA8, 0, 0, +0xCBFA,0xF9F9,0xCCFD,0xD3FE, 0, 0, 0, 0, +0xE4D0, 0, 0, 0, 0, 0,0xF2EE, 0, +0xD4D5,0xDFCD, 0,0xFCB8,0xD1D0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF2CD, 0, 0, + 0, 0, 0, 0, 0, 0,0xF7D2, 0, + 0, 0, 0, 0, 0, 0, 0,0xCAD4, + 0,0xD5D9, 0, 0, 0,0xD8DE, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCDD9, + 0, 0, 0,0xEEA9,0xF6BC, 0, 0,0xCCDB, + 0, 0, 0, 0, 0,0xF0C9, 0,0xFCFC, + 0,0xE8C9,0xF4FE, 0, 0, 0, 0,0xE7FC, +0xD7DE, 0, 0, 0, 0,0xDEDC, 0,0xF0AC, +0xCCFE,0xCDE1, 0,0xE1BA, 0,0xDBEF,0xDAB2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xD1A5,0xDCB8, 0, 0, + 0,0xD8F6, 0,0xD1A4, 0,0xCDE2, 0, 0, + 0, 0,0xDCEA, 0, 0,0xF0F7, 0,0xF0CA, +0xD0BE, 0,0xDDDC, 0, 0, 0, 0,0xD4D6, +0xD3D6, 0, 0, 0, 0, 0, 0,0xEDD0, +0xCDA1, 0, 0, 0, 0, 0,0xDFB5, 0, + 0, 0,0xDFF8, 0, 0, 0, 0, 0, + 0,0xD4A1,0xCEB2, 0, 0, 0, 0, 0, +0xE8CA, 0, 0, 0, 0,0xEBF5, 0, 0, + 0, 0, 0, 0, 0,0xE3D5,0xF5D0, 0, + 0, 0,0xF5A1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD9A7, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE5AB, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE6CB, 0,0xF5F1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE5C5, 0, 0, 0, 0, 0, + 0, 0, 0,0xF9A3,0xE0DB,0xF6EB, 0,0xCBF1, + 0,0xD9EA,0xF5A2, 0, 0, 0,0xD7D1, 0, +0xD1F8,0xEAF8,0xEAF9,0xDAB3, 0, 0, 0, 0, +0xEFDF, 0, 0,0xF1EF, 0,0xE5F6,0xEEBF,0xE2E4, + 0, 0, 0, 0, 0,0xD0BF, 0,0xFAAC, +0xF5D1,0xE7B3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE9BE, 0, 0, + 0, 0, 0,0xF2CE,0xDBB4, 0, 0, 0, + 0, 0, 0, 0, 0,0xFCCE, 0,0xDDEE, + 0, 0, 0, 0, 0, 0,0xE7B4, 0, + 0, 0, 0, 0,0xD7B4, 0, 0, 0, + 0, 0, 0,0xF7B4, 0, 0, 0, 0, + 0,0xCDBE, 0,0xDAE9, 0, 0, 0, 0, + 0, 0, 0,0xCFB0,0xF7D9,0xF3E6, 0, 0, +0xCED9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCEAA, 0,0xCBC8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD0A7, 0,0xF0CB, 0,0xD0C7, + 0, 0,0xE4C5, 0, 0, 0, 0, 0, + 0, 0,0xDBE0, 0, 0, 0, 0, 0, + 0,0xD5DA, 0,0xD7A7, 0, 0, 0,0xEEC0, + 0,0xF8F6, 0, 0, 0, 0,0xF5D2,0xEDE9, + 0,0xD9BC, 0,0xE5C6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF5A3, 0, 0, +0xDAD4,0xE2A7,0xFBFC, 0, 0,0xF1DC, 0, 0, + 0, 0, 0, 0,0xCAF4, 0, 0, 0, +0xE8FA, 0, 0,0xCEE9, 0, 0, 0, 0, + 0, 0,0xE9F8,0xE2E5, 0, 0, 0, 0, +0xD0B9,0xD4F2, 0, 0, 0, 0, 0,0xD1A6, + 0,0xDFCE, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFCF4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD3AA, 0, 0, 0,0xCCAC, 0, 0, 0, + 0,0xEFE0, 0, 0, 0,0xE5E5,0xD0D5, 0, + 0, 0, 0, 0, 0, 0, 0,0xDBFC, + 0, 0, 0, 0,0xFCE6, 0, 0, 0, + 0, 0,0xCBFE,0xEDEA, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xDEB1, 0, 0, 0, 0, + 0, 0, 0,0xF9E3, 0, 0, 0, 0, + 0, 0,0xD4A2,0xCFF6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD6D0, 0, 0, 0, 0, + 0, 0,0xD5EA,0xF1EE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFACB, 0, + 0, 0, 0,0xE5A1, 0, 0, 0, 0, + 0, 0, 0, 0,0xD5B1, 0, 0, 0, + 0, 0,0xCFED, 0,0xEDEB, 0, 0, 0, + 0, 0,0xD5B2, 0, 0, 0,0xD5BC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFDE2,0xF3AD, 0,0xFDDB, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE9B0, 0, 0, 0, 0, 0, + 0, 0,0xD1A7, 0, 0,0xFDE3,0xCEB3, 0, + 0, 0, 0, 0, 0, 0,0xFDE4,0xFACE, + 0, 0, 0, 0,0xCAB0, 0,0xF7A7, 0, +0xCFB1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE6A2, + 0,0xFCB6,0xF2AD,0xEFE1,0xF3AE,0xDCC6,0xD9EB, 0, + 0, 0,0xE8E0, 0, 0, 0, 0, 0, + 0, 0,0xE1A8, 0, 0, 0, 0,0xD5F6, +0xCFFD, 0, 0,0xDEDD, 0, 0, 0,0xD9D1, + 0, 0, 0,0xE4EA,0xF2CF, 0,0xF7BF, 0, + 0,0xE2E6,0xE2A8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE3D6, 0, +0xEDD1, 0, 0, 0, 0, 0,0xE9F9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD6B1,0xDEB2, + 0, 0,0xE0E8, 0, 0,0xD3AB, 0,0xEBDC, + 0, 0,0xDFAF, 0,0xCAC3, 0, 0,0xEEFC, + 0,0xFDC3, 0, 0, 0,0xEBF6,0xCFB2, 0, + 0, 0, 0,0xD9EC, 0,0xD9BD, 0,0xD8DF, + 0, 0,0xD4B8,0xEBBE,0xDDEF, 0,0xDDF0,0xDDF1, +0xDDF2, 0, 0,0xD9BE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFBC6,0xCFB3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEEFD, 0, 0, 0, 0, 0, 0,0xE4AB, + 0,0xDAC5, 0,0xD8EC, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD1A8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE2A9, 0, 0,0xDEBC, +0xE7B5, 0, 0, 0, 0, 0,0xDBF0, 0, +0xEFE2,0xF1F0,0xCFB4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xDBF1, 0, +0xE0B1, 0, 0, 0, 0,0xDFA5, 0,0xF9D2, + 0, 0,0xE7FD, 0, 0,0xE6A3,0xFBF1,0xCBB0, +0xF2AE, 0, 0, 0, 0, 0, 0, 0, +0xCDE7, 0,0xE8DC, 0, 0,0xE7D7, 0, 0, +0xF7C0, 0,0xD0E3, 0, 0, 0,0xDAA1, 0, + 0, 0,0xCCBD, 0, 0,0xD1A9,0xDDCC, 0, + 0,0xE3FE,0xD1AA,0xE8AA, 0,0xEAB6,0xF9FA,0xE6CC, +0xF6D8, 0, 0, 0,0xD4C7, 0, 0, 0, +0xD9CB, 0,0xD9D2,0xD3CB,0xD8F7,0xDAA9,0xF5F8, 0, + 0,0xDEDE,0xF2AF,0xF8A9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD8C8, 0, 0,0xEEC1, 0, + 0, 0, 0,0xF9C1, 0, 0, 0, 0, +0xDDF3,0xEAFA, 0,0xF6BD,0xE1BB,0xCDBF,0xF4D4,0xE6CD, + 0,0xFCCF,0xFBA2, 0,0xE0DC, 0, 0, 0, + 0,0xF4BB,0xDAD5, 0,0xF9B2, 0, 0, 0, + 0, 0, 0,0xFBF2, 0,0xDBF6, 0,0xDEDF, + 0, 0, 0,0xDBF2, 0, 0, 0, 0, + 0,0xF8DC,0xF7EE,0xEBE8, 0,0xD2FA, 0, 0, +0xF1BC, 0, 0,0xFADA, 0, 0,0xDAEA,0xDAC6, +0xF7C1, 0, 0,0xE7B6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE5C7,0xD6AC, 0, 0, 0, + 0,0xDCC7, 0, 0, 0, 0, 0,0xE1A9, + 0,0xE2AA, 0,0xD5A6, 0, 0,0xD4D7, 0, + 0, 0, 0, 0, 0,0xF2D0, 0,0xEAFB, + 0,0xE0DD,0xFBF3, 0, 0, 0, 0, 0, + 0, 0,0xF1BD, 0, 0,0xE2E7,0xFDD7, 0, +0xCEC8,0xEAB7, 0,0xFCC0, 0,0xFDE7,0xF7EF, 0, + 0,0xD7B5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEFBA,0xF1DD, 0,0xDEB3, 0, 0, 0, + 0, 0, 0,0xE8CB, 0, 0,0xF8DD, 0, + 0,0xFBC7,0xD5C8, 0,0xD7DF, 0,0xDDA9, 0, + 0, 0, 0, 0,0xE9B1, 0, 0,0xFAAD, +0xF6D9,0xFAF4, 0, 0, 0, 0, 0,0xF8AA, + 0, 0, 0, 0, 0,0xE6EE, 0,0xCCDC, +0xE1BC,0xE0EF, 0, 0,0xE9BF,0xFCFD,0xE6CE, 0, + 0,0xE1D7, 0,0xE6CF, 0,0xF4F1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE4F3, + 0, 0,0xE4FB, 0, 0,0xF9E4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEFE3, 0, 0,0xCFEE,0xF6BE,0xE0B2,0xFCFE,0xD1AB, + 0, 0, 0,0xD7FA, 0, 0, 0,0xFBC8, + 0,0xE2D7, 0, 0, 0, 0, 0, 0, +0xD4A3,0xF0F8,0xD7A8, 0, 0, 0,0xE1E7, 0, + 0,0xD3BF, 0, 0, 0, 0, 0, 0, +0xEFE4, 0,0xD7C5,0xEBE2, 0, 0,0xFCE7, 0, + 0,0xE4A2, 0,0xE2E8, 0,0xE6D0, 0,0xFBE8, +0xF4E8,0xE5F4,0xF4BC,0xF4D5, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xDFB6, + 0,0xFCB9,0xEEC2,0xCAF5, 0, 0, 0,0xEFE5, +0xCBE2,0xD4A4, 0,0xDEE0,0xDAFD,0xE4C6,0xE8BE, 0, + 0, 0, 0,0xE0DE,0xF6B4,0xEAD2, 0,0xF9FB, + 0, 0,0xE0C2, 0,0xCAE4, 0,0xE7B7, 0, +0xEAFD, 0,0xD9DD, 0,0xDAB4,0xEEAA,0xFBE9, 0, + 0, 0, 0,0xDBCB,0xDAB5, 0, 0, 0, + 0, 0,0xF1BE, 0, 0,0xD3AC, 0, 0, + 0, 0, 0, 0, 0, 0,0xFBC9, 0, +0xDFCF, 0, 0,0xD3C0,0xE3D7, 0,0xEFE6,0xFCD0, + 0, 0, 0, 0, 0, 0, 0,0xE9C0, + 0, 0, 0,0xF5D3, 0, 0,0xECDC,0xF7B7, + 0, 0,0xEAB8,0xD1F9, 0, 0, 0, 0, + 0, 0,0xDCC8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEAB9, 0, 0, 0, 0, 0,0xF1DE, 0, + 0, 0, 0, 0,0xD7B6,0xCFB5, 0,0xD9A8, + 0, 0,0xECEE, 0, 0,0xDDAA, 0, 0, + 0, 0,0xCDA2,0xE8AE, 0, 0, 0,0xE1BD, + 0,0xF2D1, 0, 0, 0, 0,0xE9C1, 0, + 0, 0,0xD2FC, 0, 0, 0, 0, 0, + 0, 0,0xDBB5, 0,0xF3E7,0xD8FE, 0, 0, + 0,0xFCD1, 0,0xEDB2,0xF4AF, 0,0xFBA3, 0, + 0,0xFCC1, 0,0xEEAB,0xD4A5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xF4F2, + 0, 0, 0, 0,0xEED9, 0, 0, 0, +0xFBCA, 0, 0, 0, 0, 0,0xCDE3,0xD8BB, + 0,0xE5DB,0xF8F7, 0, 0, 0,0xF6D4, 0, + 0, 0, 0, 0, 0, 0, 0,0xD7A9, + 0,0xCBC9, 0, 0,0xE6D1,0xF0CC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD8AE, 0,0xF9D3,0xD5FE, 0, 0, 0, 0, + 0, 0, 0,0xD8BC,0xF2B0, 0, 0, 0, + 0,0xE2AB,0xF3E8, 0, 0, 0, 0, 0, +0xEFC2, 0, 0, 0, 0, 0, 0,0xEDEC, + 0,0xE7B8, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xDAFE, 0, 0,0xCCBE, 0, 0,0xF2FC, +0xDAEB, 0,0xE2D8,0xEDD6, 0, 0,0xD6D1,0xE0B3, + 0, 0,0xFCD2, 0,0xEBC8, 0, 0, 0, + 0, 0, 0, 0, 0,0xD3C1,0xF0CD, 0, +0xCFF7, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xEDD2, 0,0xD4D8,0xDCC9,0xD7F1, 0, + 0,0xDFBB, 0, 0,0xF3A5, 0, 0, 0, +0xF4CD, 0, 0, 0, 0,0xF1BF,0xF8B1, 0, +0xE9FA, 0, 0, 0,0xFBCB, 0, 0,0xCAD5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF9D4,0xF7CA, 0, 0,0xD6C8, + 0, 0, 0, 0, 0, 0,0xFCE8,0xF3BD, + 0,0xEEFE, 0,0xE7FE, 0, 0, 0, 0, + 0,0xD3C2, 0, 0, 0, 0,0xD3B6, 0, +0xCCAD,0xF6FA,0xD6B2,0xD2D8, 0, 0, 0, 0, + 0, 0,0xE7D8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE3A5, 0, 0, + 0, 0,0xE7B9, 0, 0, 0, 0,0xF0AD, +0xFBCC,0xEBA1, 0, 0,0xD4A6, 0, 0, 0, + 0,0xFBCD, 0,0xD5BD,0xF1DF, 0, 0,0xF6FB, + 0,0xDEB4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD5EB, 0, + 0,0xE5C8, 0, 0, 0,0xFBA4,0xD4B9, 0, + 0,0xDEE1, 0,0xE4A3, 0, 0, 0,0xD7B7, + 0,0xF8EE, 0, 0, 0,0xDEB5, 0, 0, +0xD6D2, 0,0xF9D5,0xE7BA,0xEBD5,0xD5F7,0xEFE7,0xE1BE, + 0, 0, 0,0xFAAE, 0, 0, 0,0xD6E9, +0xD6EE, 0, 0, 0, 0, 0, 0,0xE7BB, + 0, 0, 0, 0, 0, 0, 0,0xECCB, + 0, 0, 0, 0, 0, 0,0xD5B3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCEB4, 0, 0, 0, +0xFBA5,0xE1EE, 0, 0, 0, 0, 0, 0, +0xF7A8, 0, 0, 0, 0,0xFBCE, 0, 0, + 0, 0, 0,0xD8BD, 0, 0, 0, 0, + 0, 0, 0,0xFBFD, 0, 0, 0, 0, +0xFCE9, 0, 0, 0, 0, 0, 0, 0, +0xCFB6, 0, 0, 0,0xEDC7,0xEEAC, 0, 0, + 0, 0, 0, 0, 0,0xCCDD, 0, 0, + 0, 0,0xF6A7, 0, 0, 0,0xE6FA, 0, + 0, 0,0xF5A4, 0, 0, 0, 0, 0, +0xFDDC,0xEDB3,0xCEC9, 0, 0, 0, 0, 0, + 0,0xEFE8, 0, 0,0xE1BF, 0, 0, 0, + 0, 0, 0,0xFADB,0xCBE3,0xF7A9, 0,0xFBA6, + 0, 0, 0,0xDCB9, 0, 0, 0,0xF1C0, +0xEDC8,0xEFC3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD6AD, 0, 0,0xFDCE, 0, 0, 0,0xE8A1, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFBF4,0xD5A7, 0, 0, 0,0xF1F6, 0,0xE6D3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCCDE, 0, 0, 0, 0, 0, 0, + 0,0xF8B2, 0, 0, 0,0xDCEB, 0, 0, + 0, 0, 0, 0,0xFDB6, 0, 0, 0, + 0,0xE5EA, 0, 0,0xF1E0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xDBCC,0xDDCD, 0, 0, 0,0xD4C8, 0, + 0,0xD9ED, 0, 0, 0, 0,0xF5A5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE6FB, 0, 0, 0, 0, 0,0xE6D4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xFDC8, + 0,0xD6A1,0xFDBF, 0,0xFCD3, 0,0xEFA1, 0, +0xE7BC, 0, 0, 0, 0, 0,0xD1EE, 0, + 0,0xE6D5, 0, 0,0xE9F2, 0,0xDFB0, 0, + 0, 0, 0, 0,0xD8E0,0xFCBA,0xFDAF,0xF0CE, + 0,0xDBE1, 0, 0,0xE5C9, 0,0xEDB4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE0C3, 0, 0, + 0, 0, 0, 0,0xE3D8, 0, 0, 0, + 0,0xE9FB,0xEAA8, 0, 0, 0, 0,0xFDB7, + 0, 0,0xFBA7, 0,0xE9C2, 0, 0, 0, + 0,0xFDF7, 0, 0, 0, 0, 0,0xE2D9, + 0, 0,0xDCEC, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE8A2, 0, 0, 0, + 0,0xE6F0, 0, 0, 0, 0, 0, 0, + 0,0xFDF8,0xFDF9, 0, 0, 0,0xF6BF, 0, + 0,0xE7A7, 0,0xE6D7, 0, 0, 0, 0, +0xD4F3,0xD4C9, 0, 0, 0, 0,0xD6FA, 0, +0xD7F2, 0,0xE1C0, 0,0xDBE2,0xE6D8, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE7BD, + 0, 0, 0, 0, 0,0xF0CF,0xF3BE,0xE2AC, + 0, 0, 0, 0, 0,0xF5B7,0xE0F0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFDB8,0xE3E8, 0,0xD4A7,0xE8FC, +0xFAD2, 0, 0, 0, 0, 0,0xF8EF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD6D3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD5B4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF0D0, 0,0xF7F0,0xEEB3, 0, 0, +0xEABA, 0,0xEAD3, 0, 0,0xEDC9,0xDDAB, 0, + 0, 0,0xE5AC,0xFDA1, 0,0xDFD0,0xECB3, 0, +0xDFD1, 0, 0, 0, 0, 0,0xEDED,0xF8B8, +0xF7FA, 0, 0, 0,0xF8AB, 0, 0, 0, + 0, 0,0xF4E0, 0, 0, 0, 0, 0, +0xD4BA,0xE4B3, 0,0xE9DA, 0,0xDEB6, 0,0xD9BF, + 0,0xD9C0,0xD6EF, 0, 0, 0, 0,0xD9CC, + 0,0xDAAA, 0, 0, 0, 0, 0, 0, + 0, 0,0xDFE5, 0, 0, 0, 0, 0, + 0,0xF7E5, 0, 0, 0,0xCCB2, 0, 0, +0xDFF9,0xD7E0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD4BB, 0, 0, 0, 0,0xFDFA, + 0, 0, 0, 0,0xCCB3, 0, 0,0xDBF3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xDFD2, 0,0xCECA, 0,0xEEDA, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE4E4, 0, +0xFBCF, 0, 0, 0, 0, 0, 0,0xCFB7, + 0,0xEEC3, 0, 0, 0, 0, 0, 0, + 0,0xCEEA, 0, 0, 0, 0, 0, 0, + 0,0xE2AD, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD7E1,0xFAF5, 0, 0,0xD5C9,0xF8AC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE7D9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF3E9, 0, + 0, 0, 0,0xD8ED,0xE3C4,0xF0F1, 0, 0, + 0, 0, 0, 0, 0,0xE8E5, 0, 0, + 0,0xE0FA,0xEEC4,0xD9DE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xEBA2,0xEBA3, + 0, 0, 0, 0, 0, 0,0xFCC2,0xEABB, + 0, 0, 0, 0,0xE8AB,0xDEE2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEDEF, 0,0xE8A3, 0, 0, 0, 0,0xCFF1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD4BC, 0,0xFCEA, 0, 0, 0, 0, 0, +0xE7BE, 0,0xFCF2, 0, 0,0xD6B4, 0, 0, +0xE2AE, 0,0xD3B7,0xFACC, 0, 0, 0, 0, + 0, 0, 0, 0,0xFADC, 0,0xEDB5,0xE1E3, + 0,0xE8AC, 0,0xE8DD, 0, 0,0xEFE9, 0, + 0, 0, 0, 0,0xF4BD, 0,0xCFB8,0xE9DB, +0xD1AC, 0, 0, 0, 0, 0, 0,0xDAC7, + 0, 0, 0, 0, 0, 0, 0,0xEBC9, + 0,0xE8CC, 0, 0, 0,0xDEB7, 0, 0, + 0, 0,0xD6BC,0xD3E5, 0, 0, 0, 0, + 0,0xFADD, 0, 0, 0, 0, 0, 0, +0xDAD6, 0,0xCAB1, 0, 0, 0, 0, 0, + 0,0xDAC8,0xDFA6, 0,0xF9B3,0xF2D2, 0,0xCAC4, + 0, 0, 0, 0, 0, 0,0xCECB, 0, + 0,0xCDF5, 0, 0, 0,0xFDB0,0xD5A8, 0, +0xF1C1, 0, 0,0xE2E9,0xDCCA,0xECB4,0xFAC0, 0, + 0,0xFBA8,0xD0A8, 0, 0,0xDAEC, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD9EE, + 0,0xE0FB, 0, 0, 0,0xEFEA,0xFADE, 0, + 0,0xE0C4, 0,0xCFB9, 0,0xD5CA,0xD7E2,0xE2AF, + 0,0xD7B8, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE8CD, 0, 0, 0, 0, + 0, 0, 0,0xF6DA, 0, 0, 0, 0, +0xEFA2,0xE2DA,0xF6FC, 0, 0,0xFBD0,0xD1AD, 0, +0xCDE4, 0,0xD1AE,0xDCED,0xE8CE, 0,0xF0F9,0xCEB5, +0xE6FC, 0, 0,0xD7FB,0xD0D6,0xDDF5,0xF7F1, 0, +0xF6FD, 0,0xDBF7, 0, 0, 0, 0,0xFBEA, +0xE9DC,0xD9C1, 0,0xF5F2,0xE0C5, 0, 0, 0, + 0, 0, 0,0xEAD4, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF9C2, 0,0xEABC, + 0,0xD2C5,0xFBD1,0xE7C0,0xEBA5, 0,0xDFFA,0xE3A2, +0xD7B9, 0,0xE9C3, 0,0xE8FD,0xE8AF, 0, 0, +0xF2D3,0xFBA9,0xD8A5, 0, 0, 0, 0,0xD5CB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD0C8, 0, + 0, 0,0xD1AF,0xD7E3, 0, 0, 0,0xE0C6, + 0,0xD6A2, 0,0xEDF0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD7F3, 0, 0, 0,0xFCD4, 0,0xDAD7,0xCCDF, + 0,0xF2D4, 0,0xD1B0, 0,0xCCE0, 0,0xDBFD, +0xF3BF, 0,0xF0D1, 0, 0, 0, 0, 0, +0xFCBB, 0,0xE2B0, 0, 0,0xE6A5, 0, 0, + 0,0xE2DB, 0, 0, 0,0xDFDE, 0,0xE0C7, + 0, 0, 0, 0, 0, 0,0xF2EF, 0, + 0, 0,0xCCE1, 0, 0, 0, 0,0xD6EA, + 0, 0, 0, 0,0xE7C2, 0, 0, 0, +0xCEB6, 0,0xF3C0, 0,0xCDFE, 0, 0, 0, +0xFBD2, 0,0xF8F8,0xF7FB, 0, 0,0xE8BF, 0, + 0, 0, 0, 0, 0, 0,0xE8B7, 0, + 0, 0, 0, 0, 0, 0, 0,0xEDB6, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xDCBA, 0, 0,0xCCB4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF1F7, 0, 0, 0,0xE8B8, 0, 0, +0xCAF6, 0,0xE4A4,0xF4D6, 0, 0, 0,0xDFE6, + 0, 0, 0,0xDFA7, 0,0xDFE7,0xE1C1, 0, +0xE9C4, 0, 0,0xDCCB,0xE9C5, 0, 0, 0, +0xEFA3,0xEBA6,0xCBA3,0xE3E9, 0, 0, 0,0xD1FB, +0xEFA4, 0,0xEFEB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD0B4, + 0, 0, 0, 0,0xCDA3, 0, 0,0xE8E6, + 0,0xEFA5, 0,0xD3CC,0xDAED, 0, 0, 0, + 0,0xD7BA, 0,0xF2D5,0xF5E5,0xD9EF, 0, 0, + 0, 0,0xF9B4, 0, 0,0xD5D4,0xFDCF, 0, + 0, 0,0xDBE3, 0, 0, 0, 0,0xF1E1, +0xECB6, 0, 0, 0, 0,0xFBFE,0xD3D7, 0, +0xD1B1, 0,0xCBB1, 0, 0, 0, 0,0xD1B2, + 0, 0, 0, 0, 0, 0,0xCBB2,0xF1C2, + 0, 0,0xF4E1,0xF9B5, 0, 0,0xE1C3,0xE1C2, + 0,0xEBF7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xDFA8, 0, 0, + 0, 0, 0, 0, 0,0xCBCA, 0, 0, + 0, 0, 0,0xE6B9, 0, 0, 0, 0, + 0,0xF8DE,0xF9AA,0xCAF7, 0,0xEDB7, 0, 0, +0xD3B8,0xF2D6, 0, 0,0xD4D9,0xEEC5,0xF2F0, 0, + 0, 0,0xCAB2, 0, 0,0xDCBB, 0,0xF1F8, + 0, 0, 0, 0, 0,0xECB7, 0, 0, + 0, 0,0xE5CA, 0,0xF6C0,0xFDDD, 0, 0, +0xD4E3,0xCCE2, 0,0xF7D4, 0, 0, 0, 0, + 0, 0,0xD7E5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD3C3, 0,0xD8A6, 0,0xF6C1, 0, 0, 0, + 0, 0,0xDDF6, 0,0xCDC0, 0, 0, 0, +0xE5DC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE5CB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE1C4, 0, 0, 0, 0, 0,0xE8B0, +0xF4B0,0xF3EA,0xDAEE, 0,0xD7BB, 0,0xE2B1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD7AA, 0, 0, 0, 0, + 0, 0,0xD6FB, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE4DF, 0,0xCAD6, 0, + 0, 0,0xEBA8, 0, 0, 0,0xDBFE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF6C2, 0, 0,0xEFBB, 0, 0, 0, + 0,0xD4FD, 0, 0,0xE0C8, 0, 0, 0, +0xE8B9, 0,0xEFA6, 0, 0, 0, 0, 0, +0xCDA4, 0, 0,0xD4F4,0xDBA1,0xDBDC,0xDBDD, 0, + 0, 0, 0, 0,0xEEDC, 0,0xCBCB,0xFCD5, + 0, 0, 0, 0, 0, 0,0xCEEB, 0, +0xCDC1, 0, 0,0xFBD3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF9AB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF5D4, 0, 0, 0, 0,0xD9A9, + 0, 0,0xE9DD,0xDBCD, 0, 0,0xDDCE, 0, +0xE7C3, 0,0xECCC, 0, 0, 0, 0, 0, + 0, 0,0xF9EC, 0, 0, 0,0xCBCC, 0, + 0, 0, 0,0xE0FC,0xD4A8, 0,0xEDD3,0xD8EF, + 0,0xF2D7, 0,0xCAF8,0xDAEF, 0, 0,0xD6D4, + 0, 0, 0, 0, 0, 0,0xD9CD, 0, + 0, 0,0xD8EE, 0,0xF2C1, 0, 0, 0, +0xDFD3, 0, 0, 0,0xDAF0, 0,0xE2EA, 0, + 0,0xE0FD, 0, 0,0xD8F8, 0, 0, 0, +0xF7AF,0xDAB6, 0,0xCAD7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF2D8, 0, +0xD8F9, 0, 0, 0, 0, 0, 0, 0, + 0,0xFADF, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCFEF, +0xD9C2, 0,0xF0D2, 0,0xE4D1, 0, 0, 0, +0xF3B7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xFAE0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xEFEC, 0, 0, 0, 0, + 0,0xE2B2, 0,0xD4BD, 0, 0,0xD9CE, 0, + 0, 0, 0,0xF4E2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xD4A9, 0, 0, 0, 0,0xCDC2,0xE7DA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF2D9, 0, 0, 0, 0, + 0,0xD9AA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD8BE, 0, + 0, 0, 0, 0, 0,0xDCAD, 0, 0, + 0, 0, 0, 0,0xE2EB,0xD6FC, 0, 0, +0xCAF9, 0, 0,0xD4DA, 0, 0, 0, 0, + 0, 0, 0,0xF4D7,0xCCA1, 0, 0,0xCFBA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xF5B8, + 0, 0, 0,0xD9C3,0xD0E8, 0, 0, 0, + 0, 0,0xE3C5,0xEBF8, 0,0xF2B1, 0, 0, + 0,0xCFBB, 0, 0, 0,0xD3AD,0xE8E1,0xCEEC, + 0, 0, 0,0xE0B4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xDEE3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xDDF7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF2B2,0xF3F6,0xF6DB, + 0, 0, 0, 0,0xD7FE, 0, 0, 0, + 0, 0,0xF8DF, 0,0xF7F2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD0A9, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE6DA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF5A6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD7BC,0xCCE3, 0, 0,0xE6DB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDDDD, 0, 0, 0, + 0,0xD1B3, 0, 0, 0, 0, 0,0xEFED, + 0, 0, 0, 0,0xD6DE,0xE4F4,0xE1EF, 0, + 0,0xDDF8, 0, 0, 0, 0, 0,0xE8CF, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xCAE5, 0, 0, 0,0xDCA1, + 0,0xE0B5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xFCAC,0xFCAD,0xD8A7, 0, 0, 0, + 0,0xEDB8, 0, 0, 0,0xDBB6, 0, 0, + 0, 0,0xD6F0,0xF3AF, 0, 0,0xCDA5, 0, +0xDAF1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD8A8, 0, 0, 0,0xCCE4, 0, 0,0xD1B4, + 0, 0, 0, 0, 0,0xCAD8, 0, 0, + 0, 0, 0,0xDAF2, 0, 0, 0, 0, + 0,0xF5A7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF5A8, 0, + 0, 0, 0, 0, 0, 0,0xE6A6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD5EC,0xD5F8,0xDAF3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE3C6, 0, 0, 0,0xDEE4, 0, +0xDEE5,0xD1B5, 0, 0, 0, 0, 0,0xD1B6, +0xD1B7,0xF2B3, 0, 0, 0, 0, 0, 0, +0xE9DE, 0, 0, 0, 0, 0,0xF0D3,0xF2B4, + 0, 0,0xF0D4,0xCBE4,0xFBD4,0xF5E6,0xE3EA, 0, +0xDEE6, 0, 0, 0, 0,0xDFD4, 0, 0, +0xF8F9, 0, 0, 0, 0,0xF0AE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD1B8, 0, 0, 0, 0,0xD6DF, + 0,0xD0D7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xFCA1,0xEFEE,0xDCD8, + 0,0xE9DF, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE5DD,0xFDFB, + 0, 0,0xE0C9, 0, 0, 0,0xD6C9, 0, + 0,0xD4AA, 0,0xE5CC, 0, 0, 0, 0, + 0,0xE9E0, 0, 0, 0,0xD0D8,0xFCA2,0xD4BE, +0xE2B3,0xDEE7, 0, 0, 0, 0, 0, 0, + 0,0xDCBC,0xD2B6,0xF5D5, 0, 0, 0, 0, + 0,0xCEA1,0xF5A9, 0, 0,0xDDF9, 0, 0, +0xDDFA, 0, 0, 0, 0, 0, 0,0xF0D5, + 0, 0, 0, 0,0xF6DF, 0,0xF2DA,0xE4EB, + 0,0xF2F1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xECB9, 0, 0, 0, 0, +0xFDFC, 0, 0, 0, 0,0xE1AA, 0, 0, +0xCAD9, 0, 0,0xEFEF, 0,0xF5AA, 0, 0, + 0, 0, 0, 0,0xECF9, 0, 0,0xF8AD, + 0,0xF2C2,0xF6C3, 0,0xD7D2, 0, 0,0xF9A2, +0xF0D6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF0FA, 0, + 0,0xF6E0, 0, 0, 0, 0,0xE9F3,0xF2C3, + 0, 0, 0,0xD4AB,0xCAB3,0xCDA6, 0,0xCDC3, +0xCDDA, 0, 0, 0, 0, 0,0xD9CF, 0, + 0,0xF6C4, 0, 0, 0,0xEEDD,0xE7C4, 0, + 0, 0, 0, 0, 0, 0, 0,0xE2B4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xDFE2,0xE7DB, 0, 0, 0, 0, 0, + 0,0xE8B1, 0,0xFCAE, 0, 0, 0, 0, +0xE5CD, 0, 0, 0,0xFAEB, 0,0xCFBC, 0, + 0,0xCFE2,0xCDF6, 0, 0,0xEFF0, 0,0xF4BE, + 0,0xD4CD, 0, 0,0xF3B8, 0, 0, 0, +0xE9A1, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF2F2,0xF3EB, 0,0xF0D7, 0, 0, +0xCFD7, 0, 0, 0, 0, 0, 0,0xCFDF, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE8C0,0xE8C1, 0, 0, 0,0xCFE3,0xE9A2, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD0AA, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF3C1,0xD0AB, 0,0xD4E4, + 0, 0,0xEFBC,0xD8A1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD9DF, + 0,0xF3D7, 0, 0, 0,0xDCBD, 0,0xCCE5, +0xEDF1, 0, 0,0xF1E2, 0,0xD4DB, 0, 0, + 0, 0,0xE2B5, 0, 0,0xCAE6, 0,0xD3AE, + 0, 0, 0, 0, 0, 0,0xCCE6, 0, + 0,0xF1D3,0xF5E7, 0, 0, 0, 0,0xCADA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xFBEE, + 0,0xE1C5, 0, 0, 0, 0, 0, 0, + 0,0xDFE9, 0,0xEEDE, 0, 0,0xF7C2, 0, +0xD8A2, 0, 0, 0, 0, 0,0xDDAC, 0, + 0, 0, 0, 0,0xF0AF,0xD6BD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE1AB, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF9B6, 0, + 0,0xD4F5, 0,0xD0C9,0xEFA7,0xE2EC, 0,0xDBEA, +0xCECC,0xF5E8,0xF7D5, 0,0xD3CD, 0,0xF3FE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD0B5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE0FE, 0,0xDFFB, 0, + 0, 0, 0, 0, 0,0xE6DD, 0, 0, + 0, 0, 0, 0, 0,0xE8A4, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCBCD, + 0, 0, 0,0xEFA8, 0, 0, 0,0xEEB4, + 0, 0, 0, 0,0xDAD8,0xD1B9, 0,0xDFA9, + 0, 0,0xF3B0, 0, 0,0xCCC4, 0, 0, + 0,0xCEB7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xEFA9, 0, 0, + 0,0xDFD5, 0, 0,0xEDD7, 0, 0, 0, +0xEEC6, 0, 0, 0, 0, 0, 0, 0, +0xEFBD,0xFCD6, 0, 0,0xDBF4, 0,0xEFAA,0xF8B9, + 0,0xF5E9, 0, 0, 0, 0, 0, 0, + 0, 0,0xE3D9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE1C6, 0, 0, 0,0xD4BF, 0, 0, 0, + 0,0xDEE8, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xF0EA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF3C2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD3AF, 0, + 0,0xCADB, 0, 0, 0, 0, 0,0xFCD7, + 0, 0,0xEDD8,0xE1C7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF4D8,0xD6B3,0xDDAD, + 0, 0, 0,0xD5BE, 0, 0, 0, 0, + 0, 0, 0, 0,0xF1C3,0xEEDF, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD6EB, 0, 0, 0,0xF4D9, 0, 0, 0, + 0, 0, 0, 0,0xD7E6, 0, 0, 0, + 0, 0, 0,0xDAB7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xDDFB, 0, 0, 0, 0, + 0,0xDDCF, 0, 0, 0, 0, 0, 0, + 0, 0,0xD8A3, 0, 0,0xDAD9, 0,0xF0D8, +0xEFC4, 0, 0, 0, 0, 0, 0,0xE1D8, + 0, 0, 0, 0, 0,0xF1D4, 0,0xEDF2, + 0, 0, 0, 0, 0, 0,0xD5DB, 0, + 0,0xD5DC,0xF3C4,0xCBD7, 0, 0, 0, 0, + 0,0xE2B6, 0, 0, 0, 0,0xEFF1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xFBD5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD3D8, 0, + 0, 0, 0, 0, 0, 0,0xDDD0,0xF0D9, +0xCBB3, 0, 0, 0, 0, 0, 0,0xD5DD, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xCDA7, 0, 0,0xD0AC, 0, +0xD1BA, 0,0xF1C4, 0,0xE5B3,0xFBF5,0xE9E1,0xFDE0, +0xFCBC, 0,0xDAA2,0xDAA3, 0,0xD2A1, 0, 0, +0xD2EF, 0, 0, 0,0xE2ED, 0, 0,0xDEE9, +0xCEDC,0xF2B5,0xD0E4,0xDDD1, 0, 0, 0, 0, +0xE1C8,0xDBB7,0xDFE3, 0, 0, 0, 0, 0, + 0, 0, 0,0xEDB9,0xF1C5, 0,0xF3CF,0xD7AB, +0xE1AC, 0, 0,0xE3EB, 0,0xEEC7, 0, 0, + 0,0xE1C9,0xCAFA, 0, 0, 0, 0, 0, + 0, 0,0xF0FB,0xFAE1,0xF0DA,0xCCE7,0xDAF4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCCBF, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xCEED, 0, + 0,0xD5A9,0xFAE2, 0, 0, 0,0xD0E5, 0, +0xEBD6, 0,0xECDF, 0, 0, 0,0xDFFC, 0, + 0,0xF7D6,0xDEEA,0xCBB4, 0, 0,0xEFBE, 0, + 0,0xCCB5, 0, 0, 0, 0, 0,0xCFBD, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xEFF2,0xE2B7, + 0, 0, 0,0xCCE8, 0, 0, 0, 0, + 0, 0, 0, 0,0xF0FC, 0, 0, 0, +0xD6E0, 0,0xF1C6, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE2B8,0xEBAB, 0, 0, + 0,0xCBB5,0xD8D1, 0,0xF4CE,0xF3F7, 0, 0, +0xD7C6, 0,0xD1BB,0xF7AA, 0,0xEDCA,0xD7D3,0xD8FA, + 0, 0, 0, 0, 0, 0, 0,0xF6C5, + 0, 0,0xD1CC,0xDDFC, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xDFFD, 0, +0xF9E5, 0,0xE0CA, 0, 0,0xF2FD,0xD3B0, 0, +0xF4F3,0xDAC9, 0,0xE6DE, 0, 0, 0, 0, +0xF8BA,0xE8D0, 0, 0,0xD8FB, 0, 0,0xEAD5, + 0, 0, 0, 0,0xD6A3, 0, 0, 0, + 0, 0, 0,0xF6C6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF2DB,0xE4FC, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE8B2, 0, 0, + 0, 0, 0,0xDADA, 0,0xF2DC,0xFBD6,0xE9B2, + 0,0xEEAD, 0,0xFAE3, 0, 0, 0, 0, + 0, 0, 0,0xDCEE, 0, 0,0xF5EA,0xE6E0, + 0,0xF0FD, 0, 0, 0, 0, 0,0xD7AC, + 0, 0, 0, 0, 0,0xF5C5,0xEEE0, 0, + 0,0xDBE5, 0,0xDDDE, 0, 0,0xD9F0,0xE9A3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF1F9, 0,0xF2C4,0xE0CB, 0, 0, + 0, 0, 0, 0, 0, 0,0xE9A4, 0, + 0,0xE2B9, 0, 0, 0, 0, 0, 0, + 0,0xE3B1,0xFCEB,0xCDA8, 0,0xCCB6, 0, 0, +0xF0DB, 0, 0, 0, 0, 0, 0, 0, + 0,0xE6BA, 0, 0,0xCDA9, 0, 0, 0, + 0, 0,0xF3C3, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE1D9, 0, 0,0xEFAB, + 0, 0, 0,0xE7C5, 0, 0,0xE0E9, 0, +0xF3C5, 0, 0,0xD4C0,0xD5BF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xDDAE, 0, +0xF9FC, 0,0xCCC0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE5A2, 0, 0, 0, +0xCEB8, 0, 0, 0,0xD8D2,0xF9D6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF1AA,0xCED1, 0, 0,0xF6C7, 0, +0xDBEB, 0,0xDFFE, 0, 0,0xD8E1, 0,0xF7F3, + 0,0xD7E7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD4FE, 0, 0, +0xD1BC, 0,0xE5CF, 0,0xCBB6, 0,0xDAB8, 0, + 0, 0, 0, 0,0xCDC4, 0, 0, 0, + 0, 0,0xD6BE, 0, 0, 0,0xE2BA, 0, + 0, 0, 0, 0,0xCFD8, 0, 0, 0, +0xE0CC,0xEBF9, 0, 0, 0, 0, 0, 0, + 0, 0,0xFDFD, 0, 0, 0, 0, 0, +0xD7E8,0xCBD8, 0, 0, 0,0xE9E2, 0, 0, + 0,0xE8BA, 0, 0, 0,0xE3C7, 0, 0, + 0, 0,0xECCD, 0,0xECCE, 0,0xD6BF, 0, + 0, 0,0xE3A7, 0,0xDFD6,0xFDE8, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xEEE1, +0xF6A8,0xDDFD, 0, 0, 0, 0, 0, 0, + 0,0xF8BB, 0,0xE8D1, 0, 0, 0, 0, +0xF9D7, 0, 0, 0, 0, 0, 0, 0, + 0,0xCEEE, 0, 0,0xECCF, 0, 0, 0, +0xE9A5,0xD6D5, 0,0xCDC5, 0,0xEDBA,0xD1BD, 0, + 0,0xCFBE, 0, 0,0xECBB, 0, 0, 0, +0xD2B1, 0, 0, 0, 0,0xCCE9, 0,0xD9C4, +0xE9FC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD1BE, 0, 0, + 0, 0, 0,0xECBC, 0, 0,0xE5AD, 0, + 0, 0, 0, 0, 0,0xF7B0, 0,0xCCEA, + 0, 0, 0,0xD3C4, 0, 0,0xD6C0, 0, + 0, 0,0xD6FD, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE1A1, 0, +0xDEBD, 0,0xF6A9, 0, 0, 0,0xDAA4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD6A4, +0xF5C6, 0,0xE1A2,0xE9C6, 0, 0, 0,0xF2C5, + 0, 0, 0, 0, 0,0xF4E9,0xD6EC,0xEBD3, + 0, 0, 0, 0,0xECBD,0xE2DC,0xDEEB,0xF0DC, + 0,0xEBBF, 0,0xD7CE,0xD1BF, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF5AB, 0, + 0, 0, 0,0xF9FD, 0,0xCADC, 0, 0, + 0,0xCDC6,0xF2B6, 0, 0,0xDDFE, 0, 0, + 0,0xCCB7,0xDBB8, 0, 0, 0, 0,0xD0E9, + 0,0xCEDD,0xEBC0, 0,0xFDA2, 0, 0, 0, + 0, 0,0xF8CB, 0, 0, 0, 0, 0, + 0, 0, 0,0xEAD6,0xF1B0, 0, 0, 0, + 0, 0, 0, 0,0xDBCE, 0,0xF7C3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xDBCF,0xCBA4, 0, 0,0xF8E0, 0, + 0,0xFBD7, 0, 0,0xEBCA,0xE0A1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCECD, 0, 0,0xD4DC, 0, 0, 0, +0xFDD8, 0, 0, 0, 0,0xD2F6, 0, 0, + 0, 0,0xF2B7, 0, 0,0xFAF6,0xF6AA,0xFAF7, +0xD8E6, 0,0xF4B1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE8D2, 0,0xCAC5,0xCCEB, 0, 0, 0, 0, + 0, 0, 0,0xE2EE, 0, 0, 0, 0, + 0,0xE2BB, 0,0xF7AD, 0, 0, 0,0xF8E1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF3EC, 0, 0, 0, 0,0xDEA1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE4FD, 0, 0,0xE3EC, 0, +0xDDAF,0xDDB0, 0, 0,0xCBB7,0xE8D3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE1A3,0xD2E0, 0, + 0, 0, 0,0xF0FE, 0, 0, 0, 0, +0xE9A6,0xCBF2, 0, 0, 0, 0, 0, 0, +0xEDF3,0xDCD9,0xE0CD, 0, 0, 0, 0,0xF7DA, +0xDBB9, 0, 0, 0, 0, 0, 0, 0, +0xCCAE, 0,0xDADB, 0, 0, 0, 0,0xCDC7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xDDB1, 0,0xD8AF,0xE3A3, 0, 0, +0xCEEF, 0, 0,0xF2F3, 0, 0, 0, 0, +0xF8B3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE0CE, 0,0xF5FD, 0, 0, + 0, 0,0xEBEC, 0, 0,0xD3C5,0xFCEC,0xD2DB, +0xD4EB, 0,0xDEA2, 0, 0, 0,0xE5E6, 0, + 0, 0, 0, 0, 0,0xF0B0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD5C4, 0, 0, 0, 0, 0, 0,0xEDF4, + 0, 0, 0,0xE3ED, 0,0xE8C2, 0,0xEDF5, +0xD7FC, 0,0xEDBB, 0, 0,0xF6AB, 0, 0, + 0, 0, 0,0xF2B8,0xF6C8, 0, 0, 0, + 0, 0,0xD3E6,0xF2DD,0xCFBF, 0,0xEBAC, 0, + 0, 0, 0, 0, 0,0xCFC0, 0,0xE6A8, +0xFDE9, 0,0xCFC1, 0,0xE0DF,0xDEEC, 0, 0, + 0, 0,0xE0A2, 0, 0, 0, 0, 0, + 0, 0, 0,0xF4BF,0xE2EF, 0,0xD9F1,0xF1C7, + 0,0xCBB8, 0, 0, 0, 0, 0, 0, + 0, 0,0xF9FE,0xDBBA,0xDAF5, 0, 0, 0, + 0, 0, 0, 0, 0,0xF6EC,0xDADC,0xFAE4, + 0,0xE0CF, 0, 0, 0, 0, 0, 0, +0xDDB2, 0, 0, 0, 0,0xE6A9, 0,0xEFF3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF3ED, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xEBFA, 0,0xF9E6, 0, + 0, 0, 0, 0, 0, 0,0xCADD,0xD5DE, + 0,0xCADE,0xDFE4, 0, 0, 0,0xE6FD, 0, +0xF5AC, 0, 0, 0, 0, 0,0xE4F5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE9E3, 0,0xEDCB,0xCFE4, 0, + 0, 0,0xD8D3, 0, 0, 0, 0, 0, + 0,0xDDB3,0xD4EC, 0, 0,0xF2B9, 0,0xDFB7, + 0, 0, 0, 0, 0,0xCBCE,0xFBD8, 0, + 0,0xD0D9, 0, 0,0xDDD2,0xF7F4,0xE7DC,0xE4A5, + 0,0xFCA3, 0,0xDBBB, 0, 0, 0,0xF2BA, +0xE9FD,0xD0CA, 0,0xF5D6,0xD9C5,0xE4B4, 0,0xEDA7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEABD,0xE6FE, 0,0xF7C4,0xF5AD, 0,0xD9E0, + 0, 0, 0,0xCAB4, 0, 0,0xF8E2,0xCFC2, + 0,0xECBE, 0, 0, 0,0xE5B4,0xCDC8,0xEEC8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE7C8, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xCDC9,0xF9B7, 0, + 0,0xF1E8,0xD9F2,0xDBF5,0xCAB5,0xD9C6, 0, 0, + 0,0xD8C9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD9AB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEDBC, 0, 0,0xD8D4, 0, 0, 0,0xDCDA, + 0,0xE2BC, 0, 0,0xFCED,0xECE0,0xD2FE, 0, +0xE9C7,0xE6AA, 0, 0, 0, 0, 0, 0, +0xE2F0, 0, 0, 0, 0, 0, 0,0xFABB, + 0,0xF5AE,0xFBAA, 0, 0, 0, 0,0xECFB, + 0,0xECBF,0xFCD8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD4E5, 0, 0, 0,0xF9C3, + 0, 0, 0,0xEEE2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xD7E9,0xEDF6, 0, 0, 0,0xDEED, 0, + 0, 0, 0, 0, 0, 0,0xCCEC, 0, +0xE3EE, 0, 0, 0, 0, 0,0xE8D4, 0, + 0, 0,0xFAF8, 0, 0, 0, 0, 0, + 0,0xDDB4,0xE4B5,0xD8B0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD8D5, 0, 0, + 0,0xF4EA, 0, 0, 0,0xCEB9, 0, 0, + 0,0xD6E1,0xCFD2, 0,0xD0B6, 0, 0, 0, + 0, 0, 0,0xCEA2, 0, 0,0xF3EE, 0, + 0, 0, 0, 0,0xF3F8, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xDCCC, 0,0xD0CB, 0, 0, 0,0xFCA4, +0xCDCA,0xD7D4,0xDEA3, 0,0xE4E0, 0, 0, 0, + 0,0xEEC9, 0, 0, 0,0xE2DD, 0, 0, + 0, 0, 0,0xF5FE,0xD4AC, 0, 0, 0, + 0, 0,0xD5D1, 0,0xD8F0,0xF8C3,0xEAD7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF5D7, 0, 0,0xD8BF, 0, 0, 0, + 0,0xFDC0, 0, 0, 0, 0, 0, 0, +0xEBAD, 0, 0, 0, 0,0xD5AA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE7A8, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xEECA, + 0, 0, 0,0xCAE7, 0, 0, 0, 0, + 0,0xF8E3, 0,0xD4DD, 0, 0,0xEAD8, 0, + 0, 0, 0,0xFBD9,0xEDF7, 0, 0,0xE5B5, + 0, 0, 0, 0, 0,0xD0AD, 0, 0, + 0, 0,0xF1F1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE2BD, 0, 0, 0,0xE3C8, 0, 0, 0, + 0,0xD9D5, 0, 0,0xDFAA, 0, 0, 0, + 0,0xDBBC, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF8E4, 0, 0, 0, 0, 0, +0xF1FA, 0, 0,0xE5B6,0xF3EF, 0, 0,0xFBDA, +0xE1E0, 0,0xD9AC, 0,0xF5EB, 0,0xE0B6, 0, + 0,0xE9C8, 0,0xCBCF, 0,0xE3C9, 0, 0, + 0,0xDEEE, 0, 0, 0, 0, 0, 0, + 0, 0,0xE2BE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDCEF, 0,0xD6A5, 0, + 0, 0, 0, 0,0xE2F1, 0, 0, 0, + 0, 0, 0, 0,0xD6FE, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xD9A1, 0,0xD8C0,0xDCDB, 0, 0,0xEDBD, +0xDFB8, 0,0xEAA5, 0, 0, 0,0xD7AD, 0, + 0,0xF3F9, 0,0xEDF8, 0,0xF5C7, 0, 0, + 0, 0, 0, 0,0xE1CA,0xEBE3, 0,0xF2DE, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF8CC, 0,0xEAD9, + 0,0xD3C6, 0,0xDBE6, 0, 0, 0, 0, + 0,0xF5AF, 0, 0, 0, 0,0xCEF0, 0, + 0, 0, 0,0xE9FE, 0, 0, 0, 0, + 0,0xFBB6, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE2F2, 0, 0, 0, 0, +0xCFF2,0xF7B9,0xD9F3, 0, 0,0xE1CB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDADD, 0, 0,0xDAB9, + 0, 0, 0, 0, 0, 0, 0,0xEBFB, + 0,0xCBB9, 0, 0,0xEDF9, 0, 0, 0, + 0, 0, 0,0xE0E0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF4C0, 0, +0xFDBC,0xDFB1,0xE3EF, 0, 0, 0, 0,0xE0A3, +0xFDB9, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF0B1, 0, 0, 0, 0, 0, + 0,0xCDCB, 0, 0, 0, 0, 0, 0, + 0,0xEDBE, 0, 0, 0,0xD5C0,0xE3F0,0xEDFA, + 0, 0, 0, 0, 0,0xE9E4, 0, 0, + 0, 0, 0, 0,0xD5ED,0xE7DD, 0, 0, + 0, 0, 0, 0,0xD4F6,0xE5B7, 0, 0, + 0,0xDBE7,0xE2BF, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xEECB, + 0, 0,0xD7F4,0xF0DD, 0, 0, 0,0xCEAB, + 0, 0,0xE7DE, 0, 0, 0,0xD6D6,0xE1CC, + 0, 0,0xE8B3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE5EE,0xDCA2, + 0, 0,0xE0D0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD5B5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD5A1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFBDB, 0, +0xF9CB, 0, 0, 0,0xCBF3,0xF4A5, 0, 0, + 0, 0, 0,0xFAC8,0xD6D7, 0,0xE9E5,0xFBDC, + 0, 0, 0, 0, 0, 0, 0,0xFDD0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFBF6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xDAA5, 0,0xDBBD, 0, 0, 0, + 0, 0, 0,0xECE2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xCDF7,0xF0DE, 0, 0, 0, + 0,0xF6C9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xDEEF, + 0, 0, 0,0xD3B1, 0, 0, 0, 0, + 0, 0, 0, 0,0xFCEE, 0, 0, 0, + 0,0xE8C3, 0,0xF1C8, 0, 0, 0,0xCEF1, + 0, 0, 0, 0,0xF9ED, 0, 0, 0, + 0, 0, 0, 0, 0,0xF2F4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE4B6, 0, +0xF5B9, 0,0xDCF0,0xE3F1, 0, 0, 0, 0, +0xE8A5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF2BB, 0,0xDEA4, 0,0xDACC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xCAE9, 0, + 0, 0, 0, 0, 0,0xE3DA, 0,0xFCD9, + 0, 0, 0, 0, 0, 0, 0,0xEADA, + 0, 0, 0, 0, 0, 0,0xF9C4, 0, +0xE3A4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFBDD, 0,0xEFCA, 0, +0xE8C4, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD5CC, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xEBD7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD9AD, + 0, 0,0xFBAB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD3D9, 0, 0, 0, 0, + 0, 0,0xD5A2, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF6DE, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xDAF6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE0D1, 0, 0,0xE9A8, + 0, 0,0xF5F9, 0, 0, 0, 0, 0, + 0,0xFAAF, 0,0xEBFC, 0, 0,0xE0EA, 0, + 0, 0, 0, 0, 0,0xE3B2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD5C5, + 0, 0,0xF1E3,0xD5EE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCDCC, 0, 0, 0, 0,0xEDD9, 0, + 0, 0, 0,0xD8C1, 0, 0, 0, 0, +0xFAEC, 0, 0, 0, 0, 0,0xF1EB, 0, + 0, 0, 0, 0,0xFABC,0xE6E2, 0, 0, + 0, 0,0xFAE5,0xE2FA, 0, 0, 0,0xCAB6, + 0,0xE4B7, 0,0xEADB, 0,0xF5FA, 0, 0, + 0,0xFBAC,0xCFC3,0xEBFD, 0, 0, 0, 0, +0xF8FA, 0, 0,0xDFB9, 0, 0, 0, 0, +0xE1F1, 0,0xD2A4, 0, 0, 0, 0,0xF5FB, + 0, 0, 0, 0, 0, 0,0xD0DA,0xD0DB, + 0,0xEABE,0xD9B1, 0, 0, 0, 0, 0, +0xCAB7, 0, 0,0xD3E7, 0,0xF8E5, 0, 0, + 0, 0,0xD3B2, 0, 0, 0,0xE2C0,0xF2DF, + 0, 0, 0, 0, 0, 0,0xCDE5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF9AC, 0, 0, 0, 0, + 0, 0, 0, 0,0xCDCD, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEEAE,0xD6AE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD7EA, + 0, 0, 0, 0,0xE7E0,0xEBAE, 0, 0, + 0,0xCFD9, 0, 0,0xDCCD,0xEDFB, 0,0xDEF0, + 0,0xD7EB, 0, 0, 0, 0, 0, 0, +0xDEA5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xDFD7,0xDBD0,0xDBD1, 0, 0, +0xD5A3, 0, 0, 0, 0,0xF0B2, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xDCDC, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCAE8, 0,0xF8E6,0xDCCE, 0, 0, 0, 0, +0xEADC,0xDBD2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE9B3, 0, 0, + 0, 0,0xF7DB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE3A8, 0, +0xD7AE, 0, 0,0xE0E1, 0, 0, 0, 0, + 0,0xCBBA, 0, 0,0xE5D1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD0DC, + 0, 0, 0, 0,0xD5C1, 0, 0, 0, + 0, 0,0xD8CA, 0, 0, 0, 0, 0, + 0, 0,0xE3A9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE0A4, + 0,0xE9A9, 0,0xD3C7, 0, 0,0xDCDD,0xF8AE, + 0, 0, 0,0xCCB8, 0, 0, 0,0xD0AE, + 0, 0, 0,0xD8F2, 0, 0,0xE3CA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCCAF, 0, 0, 0, 0, 0, 0, + 0,0xD4AD,0xF6D1, 0, 0, 0, 0, 0, + 0, 0,0xD0CC, 0, 0, 0, 0, 0, + 0, 0,0xCAC6, 0, 0,0xD5C2, 0, 0, +0xCEBA, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xCAC7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFAB0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDFD8, 0, 0, 0, +0xF5BA, 0, 0, 0, 0, 0, 0, 0, +0xE5EB, 0,0xEFF4,0xDDB5, 0, 0, 0, 0, +0xCDAA, 0,0xE3F2, 0,0xFBF7, 0,0xF7D0, 0, + 0, 0, 0,0xFDBA, 0, 0,0xFDE1,0xF6FE, +0xD1C0, 0, 0,0xE8C5, 0,0xE4B8, 0,0xE1E8, + 0, 0, 0,0xCCC1, 0,0xD2ED, 0, 0, + 0, 0,0xDBBE, 0, 0,0xE0E2, 0, 0, + 0,0xFAC9, 0, 0,0xE1CD, 0,0xCAB8, 0, + 0, 0,0xF2E0,0xF1C9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xDEF1, 0, 0, 0,0xF0DF,0xF8C4, 0, 0, + 0, 0, 0,0xEECC, 0, 0,0xDEF2, 0, +0xE7C9, 0,0xE2F3,0xE7E1, 0, 0,0xE3CB, 0, + 0,0xE3CC, 0, 0, 0,0xCFF8,0xEFAC, 0, +0xFDFE,0xFCA5,0xFAB1,0xDFD9, 0,0xE0D2, 0, 0, + 0,0xF4DA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF1CA, 0,0xCEA3, + 0, 0, 0, 0,0xF2BC,0xECE3, 0, 0, + 0, 0, 0,0xE0A5, 0,0xF7AB, 0, 0, +0xEBAF, 0, 0, 0, 0, 0,0xE5DE, 0, +0xE1A4,0xCDAB, 0,0xD9F4,0xE8A6,0xCDCE,0xE1E9, 0, +0xFCEF, 0,0xE0E3, 0, 0, 0, 0, 0, +0xE2C1, 0,0xCEA4, 0, 0, 0, 0, 0, + 0,0xDEA6, 0, 0,0xEBFE, 0,0xEBDD,0xF0E0, + 0, 0,0xF4DB, 0,0xE2F4, 0, 0,0xD3C8, + 0, 0, 0,0xF4EB, 0,0xEEB5, 0,0xF5D8, + 0, 0,0xD5DF, 0, 0, 0,0xD6E5, 0, + 0, 0, 0,0xEBB0,0xF4E3, 0, 0, 0, + 0,0xE3CD, 0, 0, 0, 0,0xF4F4,0xFAB2, + 0, 0,0xEFF5,0xCADF, 0,0xEBB1,0xEDBF, 0, + 0,0xFDC9, 0, 0, 0, 0,0xE4A6,0xF9A4, +0xF0B3, 0,0xE5EC, 0, 0, 0,0xD1E7, 0, +0xD9C7,0xE4D7,0xEADD, 0,0xD4F7, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xDABA, 0, +0xDACD, 0, 0, 0,0xF9CC, 0,0xE1DA,0xDBBF, + 0,0xCCC5,0xECD0,0xCBBB, 0,0xDEF3, 0, 0, +0xE9AA, 0, 0, 0, 0, 0, 0, 0, +0xD9C8, 0, 0,0xEEE3,0xD7BD, 0, 0, 0, + 0, 0, 0,0xCFC4, 0, 0, 0, 0, + 0,0xD0CD, 0, 0, 0, 0, 0, 0, + 0,0xFCA6, 0, 0, 0, 0, 0, 0, + 0,0xF1FB, 0, 0, 0, 0,0xFDD2,0xD1C1, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE3DB, 0,0xD3C9, 0,0xDCCF, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xCCED, 0, + 0, 0, 0, 0,0xDEA7, 0, 0,0xE6BB, +0xECA1, 0, 0, 0,0xCCB9, 0, 0,0xFBDE, + 0, 0, 0, 0, 0,0xE7E2, 0, 0, +0xD4C1, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xDCA8, 0, 0, 0, 0, 0, +0xE2C2, 0,0xF3D8,0xE5D3, 0, 0,0xF3D9, 0, + 0, 0,0xF3C6, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCDDB, + 0, 0, 0, 0, 0, 0, 0,0xCDAC, + 0,0xFCC3, 0, 0, 0, 0,0xD4E7, 0, +0xD1C2, 0,0xF9A5, 0,0xE8D5, 0, 0, 0, + 0, 0, 0, 0, 0,0xE3CE, 0, 0, + 0, 0,0xD4CA, 0, 0, 0, 0, 0, + 0,0xDFDA, 0, 0, 0, 0, 0, 0, + 0, 0,0xFBDF,0xE7E3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF8FB,0xE3CF, 0, 0, 0, 0, 0, + 0, 0,0xF5B0, 0, 0, 0, 0, 0, + 0, 0,0xD8E7, 0,0xD9C9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF8AF,0xEFF6, 0, +0xDDB6,0xEEAF,0xCDF8, 0, 0, 0, 0,0xDEB8, +0xFCA7,0xF7FC,0xF7B1,0xCEBB,0xF4A1, 0, 0,0xEECD, +0xE1AE, 0, 0,0xECC3,0xCFFE, 0,0xF8BF,0xD8E2, +0xD3E8, 0, 0,0xDEA8,0xF4E4,0xECC2, 0,0xD9F5, +0xF9C5,0xDDD3,0xD6F1,0xECFC,0xFCF0, 0, 0,0xEDC0, +0xCAB9, 0,0xEEE4, 0, 0, 0, 0, 0, + 0,0xF2E1, 0,0xDEB9, 0, 0, 0, 0, + 0, 0,0xD6F2, 0,0xDEF4, 0,0xDFDB, 0, +0xDBD3, 0,0xFAE7,0xD8E3,0xF4C1, 0,0xDDB7, 0, + 0, 0,0xF2F5, 0, 0,0xD4AE, 0, 0, + 0, 0, 0, 0,0xD6F3, 0, 0, 0, + 0, 0, 0,0xDDB8,0xCFC5,0xDFDF, 0, 0, + 0, 0, 0, 0,0xF2BE,0xF6A1, 0,0xEBCB, +0xF1FC, 0,0xF3C7, 0, 0,0xE0EB, 0, 0, + 0, 0, 0,0xEDFC, 0, 0,0xE1DB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xEEE5, 0,0xDEF5, 0, + 0, 0, 0,0xFAD3, 0, 0, 0, 0, +0xF1CB, 0, 0,0xD0AF,0xDDB9, 0, 0,0xD1C3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF5B1, 0, 0, + 0, 0,0xEAC6, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF0E1, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF6AC, 0, 0, 0, 0, +0xF5D9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF0EB, 0, 0, 0, 0, + 0, 0,0xDDBA, 0, 0, 0,0xF2BF, 0, + 0, 0, 0, 0, 0, 0,0xF7C5, 0, + 0, 0, 0,0xDBA2,0xF2F6, 0, 0,0xCABA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF7F5, 0,0xCBE5, 0, 0, + 0,0xEEE6, 0,0xE0D3, 0, 0, 0, 0, +0xCEA5, 0, 0, 0, 0, 0, 0,0xD6D8, + 0, 0, 0,0xD4AF, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE9C9, 0, 0, 0, 0,0xD3CE, +0xF4C2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xCBE6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF1A1, 0, 0, 0, 0, 0, +0xEBB2, 0, 0, 0, 0,0xF1A2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xEBB3, 0,0xF0B4, 0, 0,0xCBF4, +0xD4B0,0xF3B2,0xFBB7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF5EC, 0, 0, 0, 0, 0,0xEEE7, +0xF4B2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF5ED, 0,0xCFF3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF0E2, 0, 0, 0, 0, 0,0xEECE, + 0, 0,0xF1CC, 0, 0,0xE5B8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD7F5,0xE3F3,0xCFE5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCFC6, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF3B3,0xE4D8,0xCFF9,0xCFDA, 0, 0, + 0, 0,0xFACD, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE6E3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF2E2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF5EE, 0, 0,0xCABB, 0, 0,0xE3DC, 0, + 0, 0, 0,0xCEF2, 0,0xD6D9, 0, 0, + 0,0xEEB0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF4E5,0xD8C2,0xDCD0,0xCCEE, 0, 0, + 0, 0, 0,0xD5E0,0xF6CA,0xFDCA,0xD8D6,0xF4CF, + 0, 0, 0, 0, 0, 0,0xD6A6,0xDCBE, + 0,0xDBD4,0xD7C7, 0, 0, 0, 0,0xF2FE, + 0, 0, 0,0xF1CD, 0, 0, 0, 0, +0xE2C3,0xDCDE, 0,0xDCDF, 0, 0,0xEFAD,0xE6AB, + 0, 0, 0, 0,0xF9DD,0xEABF, 0, 0, + 0,0xEFAE, 0, 0, 0,0xF4D0,0xCEF3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE6AC, 0,0xCEDE, + 0, 0,0xD5F9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE3F4,0xCDD0, 0, 0, 0, + 0, 0, 0,0xD5B8, 0, 0,0xF7FD, 0, +0xDCA9, 0, 0, 0, 0,0xDEF6, 0,0xDCAA, +0xF2E3,0xE9B4,0xD2DC, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE9E6, 0, 0,0xE3F6, 0, 0, + 0, 0, 0, 0, 0, 0,0xE7CA, 0, + 0,0xD0CE, 0, 0,0xDAF7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xCABC, 0, + 0, 0,0xEEE8,0xDADE, 0,0xF2F7, 0, 0, +0xE2FB, 0,0xCCA6, 0, 0, 0, 0,0xDABB, + 0,0xEEE9, 0, 0, 0,0xF5DA, 0, 0, +0xF7DC,0xE1EA,0xCEC1,0xD4B1, 0,0xFDB1,0xE6BD, 0, +0xFBAD, 0, 0,0xF8E7, 0,0xE1CE, 0,0xF7E2, +0xF5EF,0xCFC7, 0, 0,0xD4B2,0xCCEF, 0,0xD4E8, + 0,0xEECF,0xF7D7, 0, 0,0xE0A6,0xD6C1,0xE1DC, +0xF0E3,0xF1E4,0xDCF1,0xD6A7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF4F5, 0, + 0,0xF1CE,0xF2E4, 0, 0,0xD0B0, 0, 0, +0xECEF, 0, 0, 0,0xF9BA, 0,0xEBB5, 0, + 0,0xD4ED,0xE2C4, 0, 0, 0, 0,0xE9E7, + 0, 0,0xEBB4,0xEAA1, 0,0xF8BC,0xCEA6, 0, +0xF9C6,0xFCDA, 0,0xD4B3,0xD3B9,0xEADE, 0, 0, + 0,0xE9AB, 0, 0,0xE1E1,0xD3CF,0xF4F6, 0, +0xEAC0,0xE1CF, 0,0xCCBA, 0, 0, 0, 0, + 0,0xEEEA, 0, 0, 0,0xF0E4,0xF3B4,0xD4EE, + 0, 0,0xF2C0, 0, 0,0xF1E5, 0,0xF4C3, +0xE0D4, 0,0xEBB6, 0,0xD7A1,0xCBE8, 0,0xF9AD, +0xE9AD,0xD8E4,0xFAB3,0xE2C5,0xFCBD, 0, 0,0xECC4, +0xD8B1, 0,0xDCAB, 0, 0, 0, 0,0xD5A4, + 0,0xEBE9, 0, 0, 0,0xE8BB, 0, 0, + 0,0xD8D7, 0, 0, 0, 0, 0, 0, + 0, 0,0xFBAE,0xD1E1, 0, 0,0xDBC0, 0, +0xF5BE, 0,0xDEF7, 0, 0, 0, 0,0xCAFB, +0xF7C6,0xCFC8, 0, 0, 0,0xE1D0, 0, 0, +0xEED0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE9F4, 0, 0, 0, 0, 0, 0, + 0, 0,0xCEF4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD5CD, 0, + 0,0xCFDB, 0, 0, 0, 0, 0, 0, +0xDDBB, 0, 0, 0, 0,0xCEAC, 0, 0, + 0, 0, 0, 0, 0,0xE9E8, 0, 0, + 0, 0, 0, 0, 0,0xD4B4, 0, 0, + 0, 0,0xE4C7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF5DB, 0, 0,0xFAC1, 0, 0, + 0,0xDEA9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xD4F8, + 0, 0, 0, 0, 0,0xEFF7, 0, 0, + 0, 0,0xD3B3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEBB7,0xEFF8,0xF5DC,0xEDCC,0xDBD5,0xF1CF, 0, + 0, 0,0xF1D0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF5B2, 0, 0, 0, 0, 0, + 0,0xD9AE,0xD5AC, 0,0xE2C6, 0, 0, 0, + 0, 0, 0, 0, 0,0xFDA3, 0,0xFBE5, +0xDFAB, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE2F5, + 0,0xF6AD, 0,0xF5B3, 0,0xF0B5, 0, 0, + 0, 0,0xE1A5, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF5DD, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xECA2,0xEDFD, 0,0xF5B4,0xFBB8, + 0,0xDBA3, 0, 0,0xD6CA,0xCBD9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE5D4, 0, 0, 0, 0, 0, 0,0xF3FA, + 0,0xEBB8, 0,0xE0B7,0xD7EC,0xF1EC,0xE5AF,0xD5E1, +0xD7ED,0xD1D1, 0, 0, 0, 0, 0,0xE1F2, +0xEFF9, 0, 0, 0,0xDDBC,0xF6DC, 0, 0, + 0, 0, 0,0xF0E5, 0, 0, 0,0xF4C4, + 0, 0,0xE9E9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF3FB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD4EF, 0, 0, +0xCCA2,0xF7FE,0xDFBC, 0, 0, 0, 0,0xEBCD, + 0, 0, 0, 0, 0, 0,0xD0B7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xD6C2, 0, 0, 0, + 0, 0,0xE8AD, 0, 0, 0, 0,0xEFAF, +0xCBA5, 0, 0, 0, 0,0xCBE9, 0, 0, + 0,0xFAE8, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCCC6, + 0, 0, 0,0xE6E7, 0, 0,0xEAC7, 0, + 0, 0,0xDBA4, 0,0xCFC9,0xE2FC,0xEFFA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEBDE, 0, 0,0xF5C8, 0,0xD4DE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE0D5, 0,0xEFB0, 0, 0,0xE2C7, 0, +0xD9AF, 0, 0, 0,0xF9E7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE7E5, 0, 0,0xCFCA,0xE1D1, + 0,0xE2C8, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xEFFB, 0, 0,0xFAF9, + 0, 0,0xDCF2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE0A7, 0, 0, 0, + 0, 0,0xF8E8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCBEA, 0, 0, 0,0xCBBC, 0, 0, 0, + 0, 0, 0, 0,0xD6E2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF5DE, 0, 0, 0, 0, 0, 0, 0, +0xF5DF, 0,0xEEB6, 0, 0, 0,0xE2F6,0xD3CA, +0xEFFC,0xD1C4,0xEFB1, 0,0xD1C5, 0,0xD0DE, 0, +0xD9E1, 0, 0,0xE0B8, 0, 0,0xCDD1,0xF3B9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE7CC, 0,0xD6A8,0xCEA7, 0,0xD4B5, 0, 0, + 0, 0, 0, 0,0xE4C8, 0, 0, 0, + 0, 0, 0,0xD3B4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xEBB9, 0, + 0, 0, 0, 0, 0,0xCBF5, 0, 0, + 0, 0, 0, 0,0xF6DD, 0,0xF1A3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCCC7, 0, 0, 0, + 0, 0, 0, 0,0xE9CA, 0,0xE1F0, 0, + 0, 0,0xF5E0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFBAF, 0, 0, 0,0xCBD1, + 0, 0, 0, 0,0xFBE0,0xF2E5, 0, 0, +0xECF0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF0EC, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEEEB, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE9CB, 0, + 0,0xCCF0, 0, 0,0xD7AF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF3A1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFCF5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF1A4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE0D6, 0, 0, + 0, 0, 0,0xEFB2, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF4D1, 0, 0, +0xF7A1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF1D1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCAFC,0xCAFD, 0, 0, 0, 0, 0, + 0, 0, 0,0xCECE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF3C8, 0,0xF3BA +}; + +/* page 7 0x9577-0x9F9C */ +static uint16 tab_uni_ksc56017[]={ +0xEDFE, 0, 0, 0, 0, 0, 0, 0, + 0,0xDAA6, 0, 0,0xE0EC, 0, 0, 0, + 0, 0,0xF8CD, 0,0xCBD2, 0, 0, 0, +0xEBCE, 0,0xF9D8,0xF9D9,0xCAE0,0xDACA, 0, 0, + 0,0xCBA6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCAC8,0xF9EE,0xDBEC, 0, + 0,0xD0B1, 0, 0, 0, 0,0xD5EF, 0, + 0, 0,0xE6F3, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE7A2,0xE4D9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE4E1, 0, 0,0xFCC4, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF9EF,0xCFF4,0xF7E6, + 0, 0, 0, 0, 0,0xCEBC, 0, 0, + 0, 0,0xF4C5,0xDCA3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xDDBD, 0, 0, + 0, 0,0xF4C6, 0, 0, 0, 0, 0, + 0, 0, 0,0xF8A1, 0, 0, 0,0xE8D6, + 0, 0, 0,0xDBC1, 0, 0, 0, 0, + 0, 0, 0, 0,0xF0E6, 0, 0, 0, +0xE4B9,0xF6ED, 0,0xF9AE, 0,0xDDBE, 0, 0, + 0, 0, 0, 0,0xD7B0,0xD8E8,0xCBBD, 0, + 0,0xF9DA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xF8CE,0xF9F0,0xE0ED,0xE3B3, +0xF4B3, 0, 0,0xEAC2,0xF2E6,0xF0B6, 0, 0, + 0, 0, 0,0xDBD6, 0, 0, 0, 0, + 0,0xEBE4, 0, 0,0xF2E7, 0,0xD7D5,0xD4B6, +0xF9E8,0xD7C1, 0, 0, 0, 0,0xE5D5, 0, + 0, 0, 0, 0, 0, 0,0xE9EA,0xD7CC, + 0, 0, 0,0xD3E9,0xE2C9, 0,0xFCDB,0xCDAD, + 0, 0, 0, 0, 0,0xCCB0,0xEAA2, 0, + 0,0xE4F6,0xD0C0, 0,0xF0B7,0xEEA1, 0, 0, + 0, 0, 0, 0,0xD7F6, 0, 0, 0, +0xE2CA,0xE2CB, 0,0xFACF, 0, 0, 0, 0, + 0, 0,0xEBDF, 0, 0, 0, 0, 0, +0xD6CB, 0, 0, 0,0xF4B4, 0, 0, 0, + 0,0xEDCD,0xE4D2, 0, 0,0xEAA9,0xE4BA,0xF3A2, +0xCDD2, 0,0xF6CB, 0,0xF1E6,0xEDC1,0xE8BC,0xEED1, + 0, 0, 0, 0, 0, 0,0xF0E7,0xE2CC, + 0, 0,0xE4AA, 0,0xF5E1,0xEDDA, 0, 0, + 0, 0, 0,0xD7EE,0xD1F1, 0, 0, 0, + 0,0xE9EB,0xE9EC,0xE0E4, 0, 0, 0, 0, +0xDAA7,0xDDD4, 0,0xEAA3, 0, 0, 0,0xD6C3, +0xD6F4, 0,0xDADF, 0,0xEFB3, 0, 0, 0, + 0,0xE2CD, 0, 0, 0, 0, 0,0xEFFD, +0xF2E8, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xEFC5, 0,0xE7E7, 0, 0,0xD7FD, + 0, 0,0xE7CE, 0, 0,0xDFDC, 0,0xF9C7, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD9F6, 0, 0, 0, 0, 0, 0, 0, + 0,0xDFAC, 0,0xD6DA, 0, 0, 0, 0, + 0, 0,0xDCA4, 0, 0, 0,0xF0B8, 0, + 0, 0, 0,0xD5FA, 0,0xE4F7, 0, 0, + 0,0xD6C4, 0, 0, 0, 0, 0, 0, + 0, 0,0xF4EC, 0, 0, 0, 0,0xEFFE, + 0, 0, 0, 0, 0,0xF0A1, 0,0xDEAA, + 0, 0,0xDABC,0xD8FC, 0, 0, 0, 0, + 0, 0,0xFAD4, 0, 0, 0,0xECE5, 0, + 0, 0, 0, 0, 0,0xFCA8, 0, 0, +0xECE6, 0, 0,0xD8CB, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFBB9, 0,0xE4D3, 0, +0xCDF9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCFD3, 0, 0, 0, 0, 0, 0, + 0,0xCAEA, 0, 0,0xCFD4, 0,0xF8BD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xF4C7, + 0, 0, 0, 0,0xEADF, 0, 0, 0, + 0, 0, 0, 0,0xF9DB, 0, 0, 0, + 0, 0, 0, 0, 0,0xD4B7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xEBE5, 0, 0,0xE1D2, + 0, 0, 0, 0,0xEAA4, 0, 0, 0, +0xFAC2,0xFBE1,0xFAED,0xF0A2,0xCCF1, 0,0xFAA3,0xE2F7, + 0,0xE2CE, 0,0xE9F5, 0,0xE1EB, 0, 0, + 0,0xE7E8,0xE8D7,0xDAF8,0xD4CB, 0, 0, 0, +0xF7F6,0xD6C5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD4E9, 0, + 0,0xFAFA, 0, 0, 0, 0, 0, 0, + 0,0xCCF2,0xF7DD, 0,0xDEBA, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xCEA8, + 0, 0, 0, 0, 0,0xF0B9,0xE4FE,0xE4C9, + 0, 0, 0, 0, 0,0xE4D4, 0, 0, + 0,0xEAC3, 0,0xEFB4, 0, 0, 0,0xD7BE, + 0, 0, 0, 0, 0, 0,0xFBE2, 0, +0xCDD3, 0, 0, 0,0xEFB5, 0, 0, 0, +0xFAE9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF9A6, 0, 0, 0, 0, 0, 0, +0xDFBD, 0,0xF7C7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xF8FD, 0, 0, +0xF8FC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDEAB,0xDBE8, 0, 0, +0xE3DD, 0,0xE1E2,0xD1C6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF6D0,0xEBE6, +0xDAF9, 0, 0, 0, 0,0xECC7, 0, 0, + 0, 0, 0, 0, 0,0xDEF8,0xF8E9,0xE3DE, + 0, 0, 0, 0,0xCEF5, 0, 0, 0, + 0, 0,0xFAC3,0xE5D7, 0,0xECC8, 0, 0, + 0,0xF3C9, 0, 0,0xE4BB, 0, 0, 0, + 0,0xE6AE, 0, 0, 0, 0, 0,0xEFB6, + 0,0xDCBF, 0, 0, 0, 0, 0, 0, + 0,0xCEBD, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD8C3, 0, + 0, 0,0xD0CF, 0,0xCFFA,0xF3CA,0xE0D7, 0, + 0, 0,0xD1C7,0xE9AE, 0,0xE8BD, 0, 0, +0xFAC4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE2CF, + 0, 0,0xFAC5, 0, 0, 0,0xF9B8, 0, + 0, 0, 0, 0, 0, 0,0xDCE0, 0, + 0,0xFBB0, 0, 0, 0,0xD8A9,0xE5DF,0xF9A7, + 0, 0,0xF6EE, 0,0xF6CC,0xE2F8, 0, 0, + 0, 0,0xECF1, 0, 0, 0, 0, 0, + 0, 0,0xDAE0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xF1D2,0xD2CC,0xCFCB, 0, 0,0xCABD, 0, + 0, 0,0xDDBF, 0, 0, 0,0xF6EF, 0, +0xDEF9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFAB4, 0, + 0, 0,0xD5AD, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xF1E7, 0,0xDEBE, 0, 0, 0, 0, 0, + 0,0xDCC0, 0, 0, 0, 0, 0,0xD1C8, +0xD1C9, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xF8BE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCBF6, 0, 0, 0, + 0,0xD4F9, 0, 0, 0, 0, 0,0xF5E2, +0xE1D3, 0, 0, 0, 0, 0, 0, 0, + 0,0xD8E9, 0, 0,0xF8FE, 0,0xCFCC, 0, + 0, 0, 0, 0, 0, 0,0xFDA4, 0, + 0, 0, 0, 0, 0, 0,0xCEF6, 0, +0xFAD0, 0, 0,0xCCF3,0xE6BE, 0, 0, 0, +0xF6AE, 0, 0,0xD5F0, 0, 0,0xD1CA, 0, + 0, 0,0xFCBE,0xD5F1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xCDE9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFAB5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE2D0,0xF4F7, 0, 0, + 0,0xCDD4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE7A3, 0, + 0, 0, 0, 0, 0, 0, 0,0xDBA5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE2D1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD7A2, 0, 0,0xF7E3, 0, 0, 0, 0, + 0, 0,0xEAA6, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xD0A1, 0, 0, + 0, 0,0xCEDA,0xFBEB,0xDBA6,0xDBDE,0xD8E5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEAE0, 0, 0, 0, 0,0xD8AA, 0, 0, + 0, 0, 0,0xE5E0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD6DB, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xEFC6, + 0, 0,0xF8EA, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE4D5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xCEF7, 0, 0,0xE0D8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD7EF, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xF4ED, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xCDE6, 0, 0, + 0,0xCCF4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF5E3, 0, + 0,0xE4CA, 0,0xDCE1, 0, 0,0xF9C8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xFCBF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE8A7, 0, 0, 0, 0, + 0, 0, 0, 0,0xD8C4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCBBE, 0,0xDCAE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xD7F7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xF0E8, 0, +0xDDC0, 0,0xCFCD, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDCF3,0xD9B0, 0,0xE6E9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE4BC, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xEAC4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE4EC, + 0,0xE4E5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xFBF8, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xCCBB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE4BD, 0, + 0,0xCDDC,0xD9F7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xDDDF, 0, 0, + 0, 0, 0,0xEDCE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xD9D0, 0, 0, 0, 0, 0, +0xE5A3, 0, 0, 0, 0,0xF9CD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xCDAE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xCFCE, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF6AF, 0, 0, 0, 0, + 0,0xFDD3,0xEBED,0xD6DC, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE5A4, 0, 0, 0,0xD5B6, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD6DD, 0, + 0, 0,0xF9E9, 0, 0, 0,0xE7A4, 0, +0xD6E3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xD1CB,0xD6E4, 0, 0, 0, +0xD5F2, 0, 0, 0, 0, 0,0xDEFA, 0, +0xD7F8, 0, 0, 0, 0, 0,0xD8EA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xCFD5,0xD8FD, 0, + 0, 0, 0, 0,0xD8AB, 0, 0,0xFDCB, + 0, 0, 0, 0,0xFCDC, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0A8,0xD5F3, + 0, 0,0xFDD9, 0, 0,0xCCA3, 0, 0, + 0,0xD9F9, 0, 0,0xD3EA,0xF5F5, 0,0xEFC7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xD3DA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xDABD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE8A8,0xDCAF, 0, 0, 0, 0, 0,0xF0A3, + 0, 0, 0, 0,0xCDD5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE0A9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xDEAC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xF0BA,0xEEB1, 0, 0,0xEEB2, + 0, 0, 0,0xF6CD, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEED2, 0,0xD6C6, 0, 0, 0, 0, 0, +0xE0E5, 0, 0,0xF3BB, 0,0xE5E1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE4CB, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xD7A3, 0, + 0,0xDBC2, 0, 0, 0, 0,0xCAFE, 0, + 0, 0, 0, 0, 0,0xCFCF}; + +/* page 8 0xAC00-0xD7A3 */ +static uint16 tab_uni_ksc56018[]={ +0xB0A1,0xB0A2,0x8141,0x8142,0xB0A3,0x8143,0x8144,0xB0A4, +0xB0A5,0xB0A6,0xB0A7,0x8145,0x8146,0x8147,0x8148,0x8149, +0xB0A8,0xB0A9,0xB0AA,0xB0AB,0xB0AC,0xB0AD,0xB0AE,0xB0AF, +0x814A,0xB0B0,0xB0B1,0xB0B2,0xB0B3,0xB0B4,0x814B,0x814C, +0xB0B5,0x814D,0x814E,0x814F,0xB0B6,0x8150,0x8151,0x8152, +0x8153,0x8154,0x8155,0x8156,0xB0B7,0xB0B8,0x8157,0xB0B9, +0xB0BA,0xB0BB,0x8158,0x8159,0x815A,0x8161,0x8162,0x8163, +0xB0BC,0xB0BD,0x8164,0x8165,0xB0BE,0x8166,0x8167,0x8168, +0xB0BF,0x8169,0x816A,0x816B,0x816C,0x816D,0x816E,0x816F, +0x8170,0x8171,0x8172,0xB0C0,0x8173,0xB0C1,0x8174,0x8175, +0x8176,0x8177,0x8178,0x8179,0xB0C2,0x817A,0x8181,0x8182, +0xB0C3,0x8183,0x8184,0x8185,0xB0C4,0x8186,0x8187,0x8188, +0x8189,0x818A,0x818B,0x818C,0x818D,0x818E,0x818F,0x8190, +0x8191,0x8192,0x8193,0x8194,0x8195,0x8196,0x8197,0x8198, +0xB0C5,0xB0C6,0x8199,0x819A,0xB0C7,0x819B,0x819C,0xB0C8, +0xB0C9,0x819D,0xB0CA,0x819E,0x819F,0x81A0,0x81A1,0x81A2, +0xB0CB,0xB0CC,0x81A3,0xB0CD,0xB0CE,0xB0CF,0xB0D0,0x81A4, +0x81A5,0xB0D1,0xB0D2,0xB0D3,0xB0D4,0x81A6,0x81A7,0x81A8, +0xB0D5,0x81A9,0x81AA,0x81AB,0xB0D6,0x81AC,0x81AD,0x81AE, +0x81AF,0x81B0,0x81B1,0x81B2,0xB0D7,0xB0D8,0x81B3,0xB0D9, +0xB0DA,0xB0DB,0x81B4,0x81B5,0x81B6,0x81B7,0x81B8,0x81B9, +0xB0DC,0xB0DD,0xB0DE,0x81BA,0xB0DF,0x81BB,0x81BC,0xB0E0, +0xB0E1,0x81BD,0x81BE,0x81BF,0x81C0,0x81C1,0x81C2,0x81C3, +0xB0E2,0xB0E3,0x81C4,0xB0E4,0xB0E5,0xB0E6,0x81C5,0x81C6, +0x81C7,0xB0E7,0x81C8,0x81C9,0xB0E8,0x81CA,0x81CB,0x81CC, +0xB0E9,0x81CD,0x81CE,0x81CF,0xB0EA,0x81D0,0x81D1,0x81D2, +0x81D3,0x81D4,0x81D5,0x81D6,0x81D7,0xB0EB,0x81D8,0xB0EC, +0x81D9,0x81DA,0x81DB,0x81DC,0x81DD,0x81DE,0x81DF,0x81E0, +0xB0ED,0xB0EE,0x81E1,0x81E2,0xB0EF,0x81E3,0x81E4,0xB0F0, +0xB0F1,0x81E5,0xB0F2,0x81E6,0xB0F3,0x81E7,0x81E8,0xB0F4, +0xB0F5,0xB0F6,0x81E9,0xB0F7,0x81EA,0xB0F8,0xB0F9,0x81EB, +0x81EC,0x81ED,0x81EE,0x81EF,0xB0FA,0xB0FB,0x81F0,0x81F1, +0xB0FC,0x81F2,0x81F3,0x81F4,0xB0FD,0x81F5,0xB0FE,0x81F6, +0x81F7,0x81F8,0x81F9,0x81FA,0xB1A1,0xB1A2,0x81FB,0xB1A3, +0x81FC,0xB1A4,0x81FD,0x81FE,0x8241,0x8242,0x8243,0x8244, +0xB1A5,0x8245,0x8246,0x8247,0xB1A6,0x8248,0x8249,0x824A, +0xB1A7,0x824B,0x824C,0x824D,0x824E,0x824F,0x8250,0x8251, +0x8252,0xB1A8,0x8253,0x8254,0xB1A9,0xB1AA,0x8255,0x8256, +0x8257,0x8258,0x8259,0x825A,0xB1AB,0xB1AC,0x8261,0x8262, +0xB1AD,0x8263,0x8264,0x8265,0xB1AE,0x8266,0x8267,0x8268, +0x8269,0x826A,0x826B,0x826C,0xB1AF,0xB1B0,0x826D,0xB1B1, +0x826E,0xB1B2,0x826F,0x8270,0x8271,0x8272,0x8273,0x8274, +0xB1B3,0x8275,0x8276,0x8277,0xB1B4,0x8278,0x8279,0x827A, +0xB1B5,0x8281,0x8282,0x8283,0x8284,0x8285,0x8286,0x8287, +0x8288,0xB1B6,0x8289,0xB1B7,0x828A,0x828B,0x828C,0x828D, +0x828E,0x828F,0x8290,0x8291,0xB1B8,0xB1B9,0x8292,0x8293, +0xB1BA,0x8294,0x8295,0xB1BB,0xB1BC,0xB1BD,0xB1BE,0x8296, +0x8297,0x8298,0x8299,0xB1BF,0xB1C0,0xB1C1,0x829A,0xB1C2, +0x829B,0xB1C3,0xB1C4,0x829C,0x829D,0x829E,0x829F,0x82A0, +0xB1C5,0xB1C6,0x82A1,0x82A2,0xB1C7,0x82A3,0x82A4,0x82A5, +0xB1C8,0x82A6,0x82A7,0x82A8,0x82A9,0x82AA,0x82AB,0x82AC, +0x82AD,0x82AE,0x82AF,0x82B0,0xB1C9,0xB1CA,0x82B1,0x82B2, +0x82B3,0x82B4,0x82B5,0x82B6,0xB1CB,0x82B7,0x82B8,0x82B9, +0x82BA,0x82BB,0x82BC,0x82BD,0x82BE,0x82BF,0x82C0,0x82C1, +0x82C2,0x82C3,0x82C4,0x82C5,0x82C6,0x82C7,0x82C8,0xB1CC, +0x82C9,0x82CA,0x82CB,0x82CC,0x82CD,0x82CE,0x82CF,0x82D0, +0xB1CD,0xB1CE,0x82D1,0x82D2,0xB1CF,0x82D3,0x82D4,0x82D5, +0xB1D0,0x82D6,0x82D7,0x82D8,0x82D9,0x82DA,0x82DB,0x82DC, +0xB1D1,0xB1D2,0x82DD,0xB1D3,0x82DE,0x82DF,0x82E0,0x82E1, +0x82E2,0x82E3,0x82E4,0x82E5,0xB1D4,0x82E6,0x82E7,0x82E8, +0xB1D5,0x82E9,0x82EA,0x82EB,0xB1D6,0x82EC,0x82ED,0x82EE, +0x82EF,0x82F0,0x82F1,0x82F2,0x82F3,0x82F4,0x82F5,0x82F6, +0x82F7,0x82F8,0x82F9,0x82FA,0x82FB,0x82FC,0x82FD,0x82FE, +0xB1D7,0xB1D8,0x8341,0x8342,0xB1D9,0x8343,0x8344,0xB1DA, +0xB1DB,0xB1DC,0x8345,0x8346,0x8347,0x8348,0x8349,0x834A, +0xB1DD,0xB1DE,0x834B,0xB1DF,0x834C,0xB1E0,0x834D,0x834E, +0x834F,0x8350,0x8351,0x8352,0xB1E1,0x8353,0x8354,0x8355, +0x8356,0x8357,0x8358,0x8359,0x835A,0x8361,0x8362,0x8363, +0x8364,0x8365,0x8366,0x8367,0x8368,0x8369,0x836A,0x836B, +0x836C,0x836D,0x836E,0x836F,0x8370,0x8371,0x8372,0x8373, +0xB1E2,0xB1E3,0x8374,0x8375,0xB1E4,0x8376,0x8377,0xB1E5, +0xB1E6,0x8378,0xB1E7,0x8379,0x837A,0x8381,0x8382,0x8383, +0xB1E8,0xB1E9,0x8384,0xB1EA,0x8385,0xB1EB,0xB1EC,0x8386, +0x8387,0x8388,0xB1ED,0x8389,0xB1EE,0xB1EF,0xB1F0,0x838A, +0xB1F1,0x838B,0x838C,0x838D,0xB1F2,0x838E,0xB1F3,0x838F, +0x8390,0x8391,0x8392,0x8393,0xB1F4,0xB1F5,0x8394,0xB1F6, +0xB1F7,0xB1F8,0x8395,0x8396,0x8397,0xB1F9,0x8398,0x8399, +0xB1FA,0xB1FB,0x839A,0x839B,0xB1FC,0x839C,0x839D,0x839E, +0xB1FD,0x839F,0x83A0,0x83A1,0x83A2,0x83A3,0x83A4,0x83A5, +0xB1FE,0xB2A1,0x83A6,0xB2A2,0xB2A3,0xB2A4,0x83A7,0x83A8, +0x83A9,0x83AA,0x83AB,0x83AC,0xB2A5,0xB2A6,0x83AD,0x83AE, +0x83AF,0x83B0,0x83B1,0x83B2,0xB2A7,0x83B3,0x83B4,0x83B5, +0x83B6,0x83B7,0x83B8,0x83B9,0x83BA,0x83BB,0x83BC,0x83BD, +0x83BE,0x83BF,0x83C0,0x83C1,0x83C2,0x83C3,0x83C4,0x83C5, +0x83C6,0x83C7,0x83C8,0x83C9,0x83CA,0x83CB,0x83CC,0x83CD, +0x83CE,0x83CF,0x83D0,0x83D1,0x83D2,0x83D3,0x83D4,0x83D5, +0x83D6,0x83D7,0x83D8,0x83D9,0x83DA,0x83DB,0x83DC,0x83DD, +0x83DE,0x83DF,0x83E0,0x83E1,0xB2A8,0xB2A9,0xB2AA,0x83E2, +0xB2AB,0x83E3,0x83E4,0x83E5,0xB2AC,0x83E6,0x83E7,0x83E8, +0x83E9,0x83EA,0x83EB,0x83EC,0xB2AD,0xB2AE,0x83ED,0xB2AF, +0xB2B0,0xB2B1,0x83EE,0x83EF,0x83F0,0x83F1,0x83F2,0x83F3, +0xB2B2,0xB2B3,0x83F4,0x83F5,0xB2B4,0x83F6,0x83F7,0x83F8, +0x83F9,0x83FA,0x83FB,0x83FC,0x83FD,0x83FE,0x8441,0x8442, +0xB2B5,0x8443,0x8444,0xB2B6,0x8445,0xB2B7,0x8446,0x8447, +0x8448,0x8449,0x844A,0x844B,0xB2B8,0x844C,0x844D,0x844E, +0xB2B9,0x844F,0x8450,0x8451,0xB2BA,0x8452,0x8453,0x8454, +0x8455,0x8456,0x8457,0x8458,0x8459,0x845A,0x8461,0xB2BB, +0xB2BC,0x8462,0x8463,0x8464,0x8465,0xB2BD,0x8466,0x8467, +0xB2BE,0x8468,0x8469,0x846A,0x846B,0x846C,0x846D,0x846E, +0x846F,0x8470,0x8471,0x8472,0x8473,0x8474,0x8475,0x8476, +0x8477,0x8478,0x8479,0x847A,0x8481,0x8482,0x8483,0x8484, +0x8485,0x8486,0x8487,0x8488,0xB2BF,0xB2C0,0x8489,0x848A, +0xB2C1,0x848B,0xB2C2,0x848C,0xB2C3,0x848D,0x848E,0x848F, +0x8490,0x8491,0x8492,0x8493,0xB2C4,0xB2C5,0x8494,0xB2C6, +0x8495,0xB2C7,0xB2C8,0xB2C9,0x8496,0x8497,0x8498,0x8499, +0xB2CA,0xB2CB,0x849A,0x849B,0x849C,0x849D,0x849E,0x849F, +0xB2CC,0x84A0,0x84A1,0x84A2,0x84A3,0x84A4,0x84A5,0x84A6, +0x84A7,0x84A8,0x84A9,0x84AA,0xB2CD,0xB2CE,0x84AB,0x84AC, +0x84AD,0x84AE,0x84AF,0x84B0,0xB2CF,0xB2D0,0x84B1,0x84B2, +0x84B3,0x84B4,0x84B5,0x84B6,0x84B7,0x84B8,0x84B9,0x84BA, +0x84BB,0x84BC,0x84BD,0x84BE,0x84BF,0x84C0,0x84C1,0x84C2, +0x84C3,0xB2D1,0x84C4,0x84C5,0x84C6,0x84C7,0x84C8,0x84C9, +0xB2D2,0x84CA,0x84CB,0x84CC,0xB2D3,0x84CD,0x84CE,0x84CF, +0xB2D4,0x84D0,0x84D1,0x84D2,0x84D3,0x84D4,0x84D5,0x84D6, +0xB2D5,0xB2D6,0x84D7,0x84D8,0x84D9,0xB2D7,0x84DA,0x84DB, +0x84DC,0x84DD,0x84DE,0x84DF,0xB2D8,0x84E0,0x84E1,0x84E2, +0x84E3,0x84E4,0x84E5,0x84E6,0x84E7,0x84E8,0x84E9,0x84EA, +0x84EB,0x84EC,0x84ED,0x84EE,0x84EF,0x84F0,0x84F1,0x84F2, +0x84F3,0x84F4,0x84F5,0x84F6,0x84F7,0x84F8,0x84F9,0x84FA, +0xB2D9,0xB2DA,0x84FB,0x84FC,0xB2DB,0x84FD,0x84FE,0x8541, +0xB2DC,0x8542,0x8543,0x8544,0x8545,0x8546,0x8547,0xB2DD, +0xB2DE,0xB2DF,0x8548,0xB2E0,0x8549,0xB2E1,0xB2E2,0x854A, +0x854B,0x854C,0x854D,0x854E,0xB2E3,0x854F,0x8550,0x8551, +0x8552,0x8553,0x8554,0x8555,0xB2E4,0x8556,0x8557,0x8558, +0x8559,0x855A,0x8561,0x8562,0x8563,0x8564,0x8565,0x8566, +0xB2E5,0xB2E6,0x8567,0x8568,0x8569,0x856A,0x856B,0x856C, +0xB2E7,0xB2E8,0x856D,0x856E,0xB2E9,0x856F,0x8570,0x8571, +0xB2EA,0x8572,0x8573,0x8574,0x8575,0x8576,0x8577,0x8578, +0xB2EB,0xB2EC,0x8579,0x857A,0xB2ED,0x8581,0x8582,0x8583, +0x8584,0x8585,0x8586,0x8587,0xB2EE,0x8588,0x8589,0x858A, +0xB2EF,0x858B,0x858C,0x858D,0xB2F0,0x858E,0x858F,0x8590, +0x8591,0x8592,0x8593,0x8594,0xB2F1,0xB2F2,0x8595,0x8596, +0x8597,0x8598,0x8599,0x859A,0x859B,0x859C,0x859D,0x859E, +0xB2F3,0x859F,0x85A0,0x85A1,0x85A2,0x85A3,0x85A4,0x85A5, +0x85A6,0x85A7,0x85A8,0x85A9,0x85AA,0x85AB,0x85AC,0x85AD, +0x85AE,0x85AF,0x85B0,0x85B1,0x85B2,0x85B3,0x85B4,0x85B5, +0x85B6,0x85B7,0x85B8,0x85B9,0xB2F4,0xB2F5,0x85BA,0x85BB, +0xB2F6,0x85BC,0xB2F7,0x85BD,0xB2F8,0x85BE,0xB2F9,0x85BF, +0x85C0,0x85C1,0x85C2,0xB2FA,0xB2FB,0xB2FC,0x85C3,0xB2FD, +0x85C4,0xB2FE,0x85C5,0x85C6,0x85C7,0xB3A1,0x85C8,0x85C9, +0x85CA,0x85CB,0x85CC,0x85CD,0x85CE,0x85CF,0x85D0,0x85D1, +0x85D2,0x85D3,0x85D4,0x85D5,0x85D6,0x85D7,0x85D8,0x85D9, +0x85DA,0x85DB,0x85DC,0x85DD,0x85DE,0x85DF,0x85E0,0x85E1, +0x85E2,0x85E3,0x85E4,0x85E5,0xB3A2,0xB3A3,0x85E6,0x85E7, +0xB3A4,0x85E8,0x85E9,0x85EA,0xB3A5,0x85EB,0x85EC,0x85ED, +0x85EE,0x85EF,0x85F0,0x85F1,0xB3A6,0xB3A7,0x85F2,0xB3A8, +0x85F3,0xB3A9,0x85F4,0x85F5,0x85F6,0x85F7,0x85F8,0x85F9, +0xB3AA,0xB3AB,0xB3AC,0x85FA,0xB3AD,0x85FB,0x85FC,0xB3AE, +0xB3AF,0xB3B0,0xB3B1,0x85FD,0x85FE,0x8641,0x8642,0x8643, +0xB3B2,0xB3B3,0x8644,0xB3B4,0xB3B5,0xB3B6,0xB3B7,0xB3B8, +0x8645,0xB3B9,0x8646,0xB3BA,0xB3BB,0xB3BC,0x8647,0x8648, +0xB3BD,0x8649,0x864A,0x864B,0xB3BE,0x864C,0x864D,0x864E, +0x864F,0x8650,0x8651,0x8652,0xB3BF,0xB3C0,0x8653,0xB3C1, +0xB3C2,0xB3C3,0x8654,0x8655,0x8656,0x8657,0x8658,0x8659, +0xB3C4,0xB3C5,0x865A,0x8661,0xB3C6,0x8662,0x8663,0x8664, +0xB3C7,0x8665,0x8666,0x8667,0x8668,0x8669,0x866A,0x866B, +0xB3C8,0x866C,0x866D,0x866E,0x866F,0xB3C9,0x8670,0x8671, +0x8672,0x8673,0x8674,0x8675,0x8676,0x8677,0x8678,0x8679, +0x867A,0x8681,0x8682,0x8683,0x8684,0x8685,0x8686,0x8687, +0x8688,0x8689,0x868A,0x868B,0x868C,0x868D,0x868E,0x868F, +0x8690,0x8691,0x8692,0x8693,0x8694,0x8695,0x8696,0x8697, +0xB3CA,0xB3CB,0x8698,0xB3CC,0xB3CD,0x8699,0x869A,0x869B, +0xB3CE,0x869C,0xB3CF,0xB3D0,0x869D,0x869E,0x869F,0x86A0, +0xB3D1,0xB3D2,0x86A1,0xB3D3,0xB3D4,0xB3D5,0x86A2,0x86A3, +0x86A4,0x86A5,0x86A6,0xB3D6,0xB3D7,0xB3D8,0x86A7,0x86A8, +0xB3D9,0x86A9,0x86AA,0x86AB,0xB3DA,0x86AC,0x86AD,0x86AE, +0x86AF,0x86B0,0x86B1,0x86B2,0xB3DB,0xB3DC,0x86B3,0xB3DD, +0xB3DE,0xB3DF,0x86B4,0x86B5,0x86B6,0x86B7,0x86B8,0x86B9, +0xB3E0,0xB3E1,0x86BA,0x86BB,0xB3E2,0x86BC,0x86BD,0x86BE, +0xB3E3,0x86BF,0x86C0,0x86C1,0x86C2,0x86C3,0x86C4,0x86C5, +0xB3E4,0xB3E5,0x86C6,0x86C7,0xB3E6,0xB3E7,0x86C8,0x86C9, +0xB3E8,0x86CA,0x86CB,0x86CC,0xB3E9,0x86CD,0x86CE,0x86CF, +0xB3EA,0x86D0,0x86D1,0x86D2,0x86D3,0x86D4,0x86D5,0x86D6, +0x86D7,0x86D8,0x86D9,0x86DA,0x86DB,0x86DC,0x86DD,0x86DE, +0x86DF,0x86E0,0x86E1,0x86E2,0x86E3,0x86E4,0x86E5,0x86E6, +0xB3EB,0xB3EC,0x86E7,0x86E8,0xB3ED,0x86E9,0x86EA,0x86EB, +0xB3EE,0x86EC,0xB3EF,0x86ED,0x86EE,0x86EF,0x86F0,0x86F1, +0xB3F0,0xB3F1,0x86F2,0xB3F2,0x86F3,0xB3F3,0x86F4,0x86F5, +0x86F6,0x86F7,0xB3F4,0xB3F5,0xB3F6,0x86F8,0x86F9,0x86FA, +0xB3F7,0x86FB,0x86FC,0x86FD,0xB3F8,0x86FE,0x8741,0x8742, +0x8743,0x8744,0x8745,0x8746,0x8747,0x8748,0x8749,0x874A, +0xB3F9,0x874B,0x874C,0x874D,0x874E,0x874F,0x8750,0x8751, +0x8752,0x8753,0x8754,0x8755,0x8756,0x8757,0x8758,0x8759, +0x875A,0x8761,0x8762,0x8763,0x8764,0x8765,0x8766,0x8767, +0x8768,0x8769,0x876A,0x876B,0x876C,0x876D,0x876E,0x876F, +0x8770,0x8771,0x8772,0x8773,0xB3FA,0x8774,0x8775,0x8776, +0xB3FB,0x8777,0x8778,0x8779,0xB3FC,0x877A,0x8781,0x8782, +0x8783,0x8784,0x8785,0x8786,0xB3FD,0xB3FE,0x8787,0xB4A1, +0x8788,0x8789,0x878A,0x878B,0x878C,0x878D,0x878E,0x878F, +0xB4A2,0xB4A3,0x8790,0x8791,0xB4A4,0x8792,0x8793,0x8794, +0xB4A5,0x8795,0x8796,0x8797,0x8798,0x8799,0x879A,0x879B, +0x879C,0xB4A6,0x879D,0xB4A7,0x879E,0xB4A8,0x879F,0x87A0, +0x87A1,0x87A2,0x87A3,0x87A4,0xB4A9,0xB4AA,0x87A5,0x87A6, +0xB4AB,0x87A7,0x87A8,0xB4AC,0xB4AD,0x87A9,0x87AA,0x87AB, +0x87AC,0x87AD,0x87AE,0x87AF,0xB4AE,0xB4AF,0x87B0,0xB4B0, +0x87B1,0xB4B1,0x87B2,0x87B3,0x87B4,0x87B5,0x87B6,0x87B7, +0xB4B2,0x87B8,0x87B9,0x87BA,0x87BB,0x87BC,0x87BD,0x87BE, +0x87BF,0x87C0,0x87C1,0x87C2,0x87C3,0x87C4,0x87C5,0x87C6, +0x87C7,0x87C8,0x87C9,0x87CA,0xB4B3,0x87CB,0x87CC,0x87CD, +0x87CE,0x87CF,0x87D0,0x87D1,0xB4B4,0x87D2,0x87D3,0x87D4, +0x87D5,0x87D6,0x87D7,0x87D8,0x87D9,0x87DA,0x87DB,0x87DC, +0x87DD,0x87DE,0x87DF,0x87E0,0x87E1,0x87E2,0x87E3,0x87E4, +0x87E5,0x87E6,0x87E7,0x87E8,0x87E9,0x87EA,0x87EB,0x87EC, +0xB4B5,0x87ED,0x87EE,0x87EF,0xB4B6,0x87F0,0x87F1,0x87F2, +0xB4B7,0x87F3,0x87F4,0x87F5,0x87F6,0x87F7,0x87F8,0x87F9, +0xB4B8,0xB4B9,0x87FA,0x87FB,0x87FC,0x87FD,0x87FE,0x8841, +0x8842,0x8843,0x8844,0x8845,0xB4BA,0xB4BB,0x8846,0x8847, +0x8848,0x8849,0x884A,0x884B,0xB4BC,0x884C,0x884D,0x884E, +0x884F,0x8850,0x8851,0x8852,0xB4BD,0xB4BE,0x8853,0x8854, +0x8855,0xB4BF,0x8856,0x8857,0x8858,0x8859,0x885A,0x8861, +0xB4C0,0xB4C1,0x8862,0x8863,0xB4C2,0x8864,0x8865,0x8866, +0xB4C3,0xB4C4,0xB4C5,0x8867,0x8868,0x8869,0x886A,0x886B, +0xB4C6,0xB4C7,0x886C,0xB4C8,0x886D,0xB4C9,0xB4CA,0x886E, +0x886F,0x8870,0xB4CB,0x8871,0xB4CC,0x8872,0x8873,0x8874, +0xB4CD,0x8875,0x8876,0x8877,0xB4CE,0x8878,0x8879,0x887A, +0x8881,0x8882,0x8883,0x8884,0x8885,0x8886,0x8887,0x8888, +0x8889,0x888A,0x888B,0x888C,0x888D,0x888E,0x888F,0x8890, +0xB4CF,0xB4D0,0x8891,0x8892,0xB4D1,0x8893,0x8894,0x8895, +0xB4D2,0x8896,0xB4D3,0x8897,0x8898,0x8899,0x889A,0x889B, +0xB4D4,0xB4D5,0x889C,0xB4D6,0x889D,0xB4D7,0x889E,0x889F, +0x88A0,0x88A1,0xB4D8,0x88A2,0xB4D9,0xB4DA,0xB4DB,0x88A3, +0xB4DC,0x88A4,0x88A5,0xB4DD,0xB4DE,0xB4DF,0xB4E0,0xB4E1, +0x88A6,0x88A7,0x88A8,0xB4E2,0xB4E3,0xB4E4,0x88A9,0xB4E5, +0xB4E6,0xB4E7,0xB4E8,0xB4E9,0x88AA,0x88AB,0x88AC,0xB4EA, +0xB4EB,0xB4EC,0x88AD,0x88AE,0xB4ED,0x88AF,0x88B0,0x88B1, +0xB4EE,0x88B2,0x88B3,0x88B4,0x88B5,0x88B6,0x88B7,0x88B8, +0xB4EF,0xB4F0,0x88B9,0xB4F1,0xB4F2,0xB4F3,0x88BA,0x88BB, +0x88BC,0x88BD,0x88BE,0x88BF,0xB4F4,0x88C0,0x88C1,0x88C2, +0x88C3,0x88C4,0x88C5,0x88C6,0x88C7,0x88C8,0x88C9,0x88CA, +0x88CB,0x88CC,0x88CD,0x88CE,0x88CF,0x88D0,0x88D1,0x88D2, +0x88D3,0x88D4,0x88D5,0x88D6,0x88D7,0x88D8,0x88D9,0x88DA, +0x88DB,0x88DC,0x88DD,0x88DE,0x88DF,0x88E0,0x88E1,0x88E2, +0x88E3,0x88E4,0x88E5,0x88E6,0x88E7,0x88E8,0x88E9,0x88EA, +0x88EB,0x88EC,0x88ED,0x88EE,0x88EF,0x88F0,0x88F1,0x88F2, +0x88F3,0x88F4,0x88F5,0x88F6,0xB4F5,0xB4F6,0xB4F7,0x88F7, +0xB4F8,0x88F8,0x88F9,0xB4F9,0xB4FA,0x88FA,0xB4FB,0xB4FC, +0x88FB,0x88FC,0x88FD,0x88FE,0xB4FD,0xB4FE,0x8941,0xB5A1, +0x8942,0xB5A2,0x8943,0xB5A3,0x8944,0x8945,0xB5A4,0x8946, +0xB5A5,0xB5A6,0x8947,0x8948,0xB5A7,0x8949,0x894A,0x894B, +0xB5A8,0x894C,0x894D,0x894E,0x894F,0x8950,0x8951,0x8952, +0xB5A9,0xB5AA,0x8953,0xB5AB,0xB5AC,0xB5AD,0x8954,0x8955, +0x8956,0x8957,0x8958,0x8959,0xB5AE,0x895A,0x8961,0x8962, +0xB5AF,0x8963,0x8964,0x8965,0xB5B0,0x8966,0x8967,0x8968, +0x8969,0x896A,0x896B,0x896C,0x896D,0x896E,0x896F,0x8970, +0xB5B1,0xB5B2,0x8971,0x8972,0x8973,0x8974,0x8975,0x8976, +0xB5B3,0x8977,0x8978,0x8979,0xB5B4,0x897A,0x8981,0x8982, +0x8983,0x8984,0x8985,0x8986,0x8987,0x8988,0x8989,0x898A, +0x898B,0x898C,0x898D,0x898E,0x898F,0x8990,0x8991,0x8992, +0x8993,0x8994,0x8995,0x8996,0xB5B5,0xB5B6,0x8997,0x8998, +0xB5B7,0x8999,0x899A,0xB5B8,0xB5B9,0x899B,0xB5BA,0x899C, +0xB5BB,0x899D,0x899E,0x899F,0xB5BC,0xB5BD,0x89A0,0xB5BE, +0x89A1,0xB5BF,0x89A2,0xB5C0,0x89A3,0xB5C1,0x89A4,0x89A5, +0xB5C2,0x89A6,0x89A7,0x89A8,0xB5C3,0x89A9,0x89AA,0x89AB, +0xB5C4,0x89AC,0x89AD,0x89AE,0x89AF,0x89B0,0x89B1,0x89B2, +0x89B3,0x89B4,0x89B5,0x89B6,0x89B7,0x89B8,0x89B9,0x89BA, +0x89BB,0x89BC,0x89BD,0x89BE,0xB5C5,0x89BF,0x89C0,0x89C1, +0x89C2,0x89C3,0x89C4,0x89C5,0x89C6,0x89C7,0x89C8,0x89C9, +0x89CA,0x89CB,0x89CC,0x89CD,0x89CE,0x89CF,0x89D0,0x89D1, +0xB5C6,0x89D2,0x89D3,0x89D4,0x89D5,0x89D6,0x89D7,0x89D8, +0xB5C7,0x89D9,0x89DA,0x89DB,0xB5C8,0x89DC,0x89DD,0x89DE, +0xB5C9,0x89DF,0x89E0,0x89E1,0x89E2,0x89E3,0x89E4,0x89E5, +0xB5CA,0xB5CB,0x89E6,0xB5CC,0x89E7,0x89E8,0x89E9,0x89EA, +0x89EB,0x89EC,0x89ED,0x89EE,0xB5CD,0x89EF,0x89F0,0x89F1, +0x89F2,0x89F3,0x89F4,0x89F5,0x89F6,0x89F7,0x89F8,0x89F9, +0x89FA,0x89FB,0x89FC,0x89FD,0x89FE,0x8A41,0x8A42,0x8A43, +0x8A44,0x8A45,0x8A46,0x8A47,0x8A48,0x8A49,0x8A4A,0x8A4B, +0xB5CE,0xB5CF,0x8A4C,0x8A4D,0xB5D0,0x8A4E,0x8A4F,0x8A50, +0xB5D1,0x8A51,0x8A52,0x8A53,0x8A54,0x8A55,0x8A56,0x8A57, +0xB5D2,0xB5D3,0x8A58,0xB5D4,0x8A59,0xB5D5,0x8A5A,0x8A61, +0x8A62,0x8A63,0x8A64,0x8A65,0xB5D6,0x8A66,0x8A67,0x8A68, +0x8A69,0x8A6A,0x8A6B,0x8A6C,0x8A6D,0x8A6E,0x8A6F,0x8A70, +0x8A71,0x8A72,0x8A73,0x8A74,0x8A75,0x8A76,0x8A77,0x8A78, +0xB5D7,0x8A79,0x8A7A,0x8A81,0x8A82,0x8A83,0x8A84,0x8A85, +0xB5D8,0x8A86,0x8A87,0x8A88,0x8A89,0x8A8A,0x8A8B,0x8A8C, +0x8A8D,0x8A8E,0x8A8F,0x8A90,0x8A91,0x8A92,0x8A93,0x8A94, +0x8A95,0x8A96,0x8A97,0x8A98,0x8A99,0xB5D9,0x8A9A,0x8A9B, +0x8A9C,0x8A9D,0x8A9E,0x8A9F,0xB5DA,0x8AA0,0x8AA1,0x8AA2, +0xB5DB,0x8AA3,0x8AA4,0x8AA5,0xB5DC,0x8AA6,0x8AA7,0x8AA8, +0x8AA9,0x8AAA,0x8AAB,0x8AAC,0x8AAD,0xB5DD,0x8AAE,0xB5DE, +0x8AAF,0xB5DF,0x8AB0,0x8AB1,0x8AB2,0x8AB3,0x8AB4,0x8AB5, +0xB5E0,0x8AB6,0x8AB7,0x8AB8,0xB5E1,0x8AB9,0x8ABA,0x8ABB, +0xB5E2,0x8ABC,0x8ABD,0x8ABE,0x8ABF,0x8AC0,0x8AC1,0x8AC2, +0xB5E3,0x8AC3,0x8AC4,0x8AC5,0x8AC6,0xB5E4,0x8AC7,0x8AC8, +0x8AC9,0x8ACA,0x8ACB,0x8ACC,0xB5E5,0xB5E6,0x8ACD,0x8ACE, +0xB5E7,0x8ACF,0x8AD0,0xB5E8,0xB5E9,0x8AD1,0xB5EA,0x8AD2, +0x8AD3,0x8AD4,0x8AD5,0x8AD6,0xB5EB,0xB5EC,0x8AD7,0xB5ED, +0x8AD8,0xB5EE,0x8AD9,0x8ADA,0x8ADB,0x8ADC,0x8ADD,0x8ADE, +0xB5EF,0x8ADF,0x8AE0,0x8AE1,0x8AE2,0x8AE3,0x8AE4,0x8AE5, +0x8AE6,0x8AE7,0x8AE8,0x8AE9,0x8AEA,0x8AEB,0x8AEC,0x8AED, +0x8AEE,0x8AEF,0x8AF0,0x8AF1,0x8AF2,0x8AF3,0x8AF4,0x8AF5, +0x8AF6,0x8AF7,0x8AF8,0x8AF9,0xB5F0,0xB5F1,0x8AFA,0x8AFB, +0xB5F2,0x8AFC,0x8AFD,0xB5F3,0xB5F4,0x8AFE,0x8B41,0x8B42, +0x8B43,0x8B44,0x8B45,0x8B46,0xB5F5,0xB5F6,0x8B47,0xB5F7, +0xB5F8,0xB5F9,0xB5FA,0x8B48,0x8B49,0x8B4A,0x8B4B,0x8B4C, +0xB5FB,0xB5FC,0x8B4D,0x8B4E,0xB5FD,0x8B4F,0x8B50,0x8B51, +0xB5FE,0x8B52,0x8B53,0x8B54,0x8B55,0x8B56,0x8B57,0x8B58, +0xB6A1,0xB6A2,0x8B59,0xB6A3,0xB6A4,0xB6A5,0x8B5A,0x8B61, +0x8B62,0x8B63,0x8B64,0xB6A6,0xB6A7,0xB6A8,0x8B65,0x8B66, +0xB6A9,0x8B67,0x8B68,0x8B69,0xB6AA,0x8B6A,0x8B6B,0x8B6C, +0x8B6D,0x8B6E,0x8B6F,0x8B70,0xB6AB,0xB6AC,0x8B71,0xB6AD, +0xB6AE,0xB6AF,0x8B72,0x8B73,0x8B74,0x8B75,0x8B76,0x8B77, +0x8B78,0x8B79,0x8B7A,0x8B81,0x8B82,0x8B83,0x8B84,0x8B85, +0x8B86,0x8B87,0x8B88,0x8B89,0x8B8A,0x8B8B,0x8B8C,0x8B8D, +0x8B8E,0x8B8F,0x8B90,0x8B91,0x8B92,0x8B93,0x8B94,0x8B95, +0x8B96,0x8B97,0x8B98,0x8B99,0x8B9A,0x8B9B,0x8B9C,0x8B9D, +0x8B9E,0x8B9F,0x8BA0,0x8BA1,0x8BA2,0x8BA3,0x8BA4,0x8BA5, +0x8BA6,0x8BA7,0x8BA8,0x8BA9,0x8BAA,0x8BAB,0x8BAC,0x8BAD, +0x8BAE,0x8BAF,0x8BB0,0x8BB1,0x8BB2,0x8BB3,0x8BB4,0x8BB5, +0xB6B0,0xB6B1,0x8BB6,0x8BB7,0xB6B2,0x8BB8,0x8BB9,0x8BBA, +0xB6B3,0x8BBB,0xB6B4,0xB6B5,0x8BBC,0x8BBD,0x8BBE,0x8BBF, +0xB6B6,0xB6B7,0x8BC0,0xB6B8,0xB6B9,0xB6BA,0x8BC1,0x8BC2, +0x8BC3,0x8BC4,0x8BC5,0xB6BB,0xB6BC,0xB6BD,0x8BC6,0x8BC7, +0xB6BE,0x8BC8,0x8BC9,0x8BCA,0xB6BF,0x8BCB,0x8BCC,0x8BCD, +0x8BCE,0x8BCF,0x8BD0,0x8BD1,0xB6C0,0xB6C1,0x8BD2,0xB6C2, +0xB6C3,0xB6C4,0x8BD3,0x8BD4,0x8BD5,0x8BD6,0x8BD7,0x8BD8, +0xB6C5,0x8BD9,0x8BDA,0x8BDB,0x8BDC,0x8BDD,0x8BDE,0x8BDF, +0x8BE0,0x8BE1,0x8BE2,0x8BE3,0x8BE4,0x8BE5,0x8BE6,0x8BE7, +0x8BE8,0x8BE9,0x8BEA,0x8BEB,0xB6C6,0x8BEC,0x8BED,0x8BEE, +0x8BEF,0x8BF0,0x8BF1,0x8BF2,0x8BF3,0x8BF4,0x8BF5,0x8BF6, +0x8BF7,0x8BF8,0x8BF9,0x8BFA,0x8BFB,0x8BFC,0x8BFD,0x8BFE, +0x8C41,0x8C42,0x8C43,0x8C44,0x8C45,0x8C46,0x8C47,0x8C48, +0x8C49,0x8C4A,0x8C4B,0x8C4C,0x8C4D,0x8C4E,0x8C4F,0x8C50, +0xB6C7,0xB6C8,0x8C51,0x8C52,0xB6C9,0x8C53,0x8C54,0x8C55, +0xB6CA,0x8C56,0x8C57,0x8C58,0x8C59,0x8C5A,0x8C61,0x8C62, +0x8C63,0x8C64,0x8C65,0x8C66,0x8C67,0xB6CB,0x8C68,0x8C69, +0x8C6A,0x8C6B,0x8C6C,0x8C6D,0xB6CC,0x8C6E,0x8C6F,0x8C70, +0x8C71,0x8C72,0x8C73,0x8C74,0xB6CD,0x8C75,0x8C76,0x8C77, +0x8C78,0x8C79,0x8C7A,0x8C81,0x8C82,0x8C83,0x8C84,0x8C85, +0x8C86,0x8C87,0x8C88,0x8C89,0x8C8A,0x8C8B,0x8C8C,0x8C8D, +0xB6CE,0x8C8E,0x8C8F,0x8C90,0x8C91,0x8C92,0x8C93,0x8C94, +0x8C95,0x8C96,0x8C97,0x8C98,0x8C99,0x8C9A,0x8C9B,0x8C9C, +0x8C9D,0x8C9E,0x8C9F,0x8CA0,0x8CA1,0x8CA2,0x8CA3,0x8CA4, +0x8CA5,0x8CA6,0x8CA7,0x8CA8,0xB6CF,0x8CA9,0x8CAA,0x8CAB, +0xB6D0,0x8CAC,0x8CAD,0x8CAE,0x8CAF,0x8CB0,0x8CB1,0x8CB2, +0x8CB3,0x8CB4,0x8CB5,0x8CB6,0x8CB7,0x8CB8,0x8CB9,0x8CBA, +0x8CBB,0x8CBC,0x8CBD,0x8CBE,0x8CBF,0x8CC0,0x8CC1,0x8CC2, +0x8CC3,0x8CC4,0x8CC5,0x8CC6,0x8CC7,0x8CC8,0x8CC9,0x8CCA, +0x8CCB,0x8CCC,0x8CCD,0x8CCE,0x8CCF,0x8CD0,0x8CD1,0x8CD2, +0x8CD3,0x8CD4,0x8CD5,0x8CD6,0x8CD7,0x8CD8,0x8CD9,0x8CDA, +0x8CDB,0x8CDC,0x8CDD,0x8CDE,0xB6D1,0xB6D2,0x8CDF,0x8CE0, +0xB6D3,0x8CE1,0x8CE2,0x8CE3,0xB6D4,0x8CE4,0x8CE5,0x8CE6, +0x8CE7,0x8CE8,0x8CE9,0xB6D5,0xB6D6,0x8CEA,0x8CEB,0x8CEC, +0x8CED,0xB6D7,0x8CEE,0x8CEF,0x8CF0,0x8CF1,0x8CF2,0x8CF3, +0x8CF4,0x8CF5,0x8CF6,0x8CF7,0x8CF8,0x8CF9,0x8CFA,0x8CFB, +0x8CFC,0x8CFD,0x8CFE,0x8D41,0x8D42,0x8D43,0x8D44,0x8D45, +0x8D46,0x8D47,0x8D48,0x8D49,0x8D4A,0x8D4B,0x8D4C,0x8D4D, +0x8D4E,0x8D4F,0x8D50,0x8D51,0xB6D8,0x8D52,0x8D53,0x8D54, +0x8D55,0x8D56,0x8D57,0x8D58,0x8D59,0x8D5A,0x8D61,0x8D62, +0x8D63,0x8D64,0x8D65,0x8D66,0x8D67,0x8D68,0x8D69,0x8D6A, +0x8D6B,0x8D6C,0x8D6D,0x8D6E,0x8D6F,0x8D70,0x8D71,0x8D72, +0xB6D9,0x8D73,0x8D74,0x8D75,0xB6DA,0x8D76,0x8D77,0x8D78, +0xB6DB,0x8D79,0x8D7A,0x8D81,0x8D82,0x8D83,0x8D84,0x8D85, +0xB6DC,0xB6DD,0x8D86,0x8D87,0x8D88,0xB6DE,0x8D89,0x8D8A, +0x8D8B,0x8D8C,0x8D8D,0x8D8E,0x8D8F,0x8D90,0x8D91,0x8D92, +0x8D93,0x8D94,0x8D95,0x8D96,0x8D97,0x8D98,0x8D99,0x8D9A, +0x8D9B,0x8D9C,0x8D9D,0x8D9E,0x8D9F,0x8DA0,0x8DA1,0x8DA2, +0x8DA3,0x8DA4,0x8DA5,0x8DA6,0x8DA7,0x8DA8,0x8DA9,0x8DAA, +0xB6DF,0xB6E0,0x8DAB,0x8DAC,0xB6E1,0x8DAD,0x8DAE,0xB6E2, +0xB6E3,0x8DAF,0x8DB0,0x8DB1,0x8DB2,0x8DB3,0x8DB4,0x8DB5, +0xB6E4,0xB6E5,0x8DB6,0xB6E6,0x8DB7,0x8DB8,0x8DB9,0x8DBA, +0x8DBB,0x8DBC,0x8DBD,0x8DBE,0xB6E7,0x8DBF,0x8DC0,0x8DC1, +0xB6E8,0x8DC2,0x8DC3,0x8DC4,0xB6E9,0x8DC5,0x8DC6,0x8DC7, +0x8DC8,0x8DC9,0x8DCA,0x8DCB,0xB6EA,0xB6EB,0x8DCC,0x8DCD, +0x8DCE,0x8DCF,0x8DD0,0x8DD1,0x8DD2,0x8DD3,0x8DD4,0x8DD5, +0xB6EC,0x8DD6,0x8DD7,0x8DD8,0xB6ED,0x8DD9,0x8DDA,0x8DDB, +0xB6EE,0x8DDC,0x8DDD,0x8DDE,0x8DDF,0x8DE0,0x8DE1,0x8DE2, +0xB6EF,0xB6F0,0x8DE3,0xB6F1,0x8DE4,0xB6F2,0x8DE5,0x8DE6, +0x8DE7,0x8DE8,0x8DE9,0x8DEA,0xB6F3,0xB6F4,0x8DEB,0x8DEC, +0xB6F5,0x8DED,0x8DEE,0x8DEF,0xB6F6,0x8DF0,0x8DF1,0x8DF2, +0x8DF3,0x8DF4,0x8DF5,0x8DF6,0xB6F7,0xB6F8,0x8DF7,0xB6F9, +0xB6FA,0xB6FB,0xB6FC,0x8DF8,0x8DF9,0x8DFA,0xB6FD,0xB6FE, +0xB7A1,0xB7A2,0x8DFB,0x8DFC,0xB7A3,0x8DFD,0x8DFE,0x8E41, +0xB7A4,0x8E42,0x8E43,0x8E44,0x8E45,0x8E46,0x8E47,0x8E48, +0xB7A5,0xB7A6,0x8E49,0xB7A7,0xB7A8,0xB7A9,0x8E4A,0x8E4B, +0x8E4C,0x8E4D,0x8E4E,0x8E4F,0xB7AA,0xB7AB,0x8E50,0x8E51, +0xB7AC,0x8E52,0x8E53,0x8E54,0x8E55,0x8E56,0x8E57,0x8E58, +0x8E59,0x8E5A,0x8E61,0x8E62,0x8E63,0x8E64,0x8E65,0xB7AD, +0x8E66,0xB7AE,0x8E67,0x8E68,0x8E69,0x8E6A,0x8E6B,0x8E6C, +0x8E6D,0x8E6E,0x8E6F,0x8E70,0x8E71,0x8E72,0x8E73,0x8E74, +0x8E75,0x8E76,0x8E77,0x8E78,0x8E79,0x8E7A,0x8E81,0x8E82, +0x8E83,0x8E84,0x8E85,0x8E86,0x8E87,0x8E88,0x8E89,0x8E8A, +0x8E8B,0x8E8C,0x8E8D,0x8E8E,0xB7AF,0xB7B0,0x8E8F,0x8E90, +0xB7B1,0x8E91,0x8E92,0x8E93,0xB7B2,0x8E94,0x8E95,0x8E96, +0x8E97,0x8E98,0x8E99,0x8E9A,0xB7B3,0xB7B4,0x8E9B,0xB7B5, +0xB7B6,0xB7B7,0x8E9C,0x8E9D,0x8E9E,0x8E9F,0x8EA0,0xB7B8, +0xB7B9,0xB7BA,0x8EA1,0x8EA2,0xB7BB,0x8EA3,0x8EA4,0x8EA5, +0xB7BC,0x8EA6,0x8EA7,0x8EA8,0x8EA9,0x8EAA,0x8EAB,0x8EAC, +0xB7BD,0xB7BE,0x8EAD,0xB7BF,0x8EAE,0xB7C0,0x8EAF,0x8EB0, +0x8EB1,0x8EB2,0x8EB3,0x8EB4,0xB7C1,0xB7C2,0x8EB5,0x8EB6, +0xB7C3,0x8EB7,0x8EB8,0x8EB9,0xB7C4,0x8EBA,0x8EBB,0x8EBC, +0x8EBD,0x8EBE,0x8EBF,0x8EC0,0xB7C5,0xB7C6,0x8EC1,0xB7C7, +0xB7C8,0xB7C9,0x8EC2,0x8EC3,0x8EC4,0x8EC5,0x8EC6,0x8EC7, +0xB7CA,0x8EC8,0x8EC9,0x8ECA,0xB7CB,0x8ECB,0x8ECC,0x8ECD, +0x8ECE,0x8ECF,0x8ED0,0x8ED1,0x8ED2,0x8ED3,0x8ED4,0x8ED5, +0x8ED6,0xB7CC,0x8ED7,0xB7CD,0x8ED8,0x8ED9,0x8EDA,0x8EDB, +0x8EDC,0x8EDD,0x8EDE,0x8EDF,0xB7CE,0xB7CF,0x8EE0,0x8EE1, +0xB7D0,0x8EE2,0x8EE3,0x8EE4,0xB7D1,0x8EE5,0x8EE6,0x8EE7, +0x8EE8,0x8EE9,0x8EEA,0x8EEB,0xB7D2,0xB7D3,0x8EEC,0xB7D4, +0x8EED,0xB7D5,0x8EEE,0x8EEF,0x8EF0,0x8EF1,0x8EF2,0x8EF3, +0xB7D6,0x8EF4,0x8EF5,0x8EF6,0xB7D7,0x8EF7,0x8EF8,0x8EF9, +0x8EFA,0x8EFB,0x8EFC,0x8EFD,0x8EFE,0x8F41,0x8F42,0x8F43, +0x8F44,0x8F45,0x8F46,0x8F47,0x8F48,0xB7D8,0x8F49,0x8F4A, +0x8F4B,0x8F4C,0x8F4D,0x8F4E,0x8F4F,0x8F50,0x8F51,0x8F52, +0x8F53,0x8F54,0x8F55,0x8F56,0x8F57,0x8F58,0x8F59,0x8F5A, +0x8F61,0x8F62,0x8F63,0x8F64,0x8F65,0x8F66,0x8F67,0x8F68, +0xB7D9,0x8F69,0x8F6A,0x8F6B,0x8F6C,0x8F6D,0x8F6E,0x8F6F, +0xB7DA,0x8F70,0x8F71,0x8F72,0xB7DB,0x8F73,0x8F74,0x8F75, +0xB7DC,0x8F76,0x8F77,0x8F78,0x8F79,0x8F7A,0x8F81,0x8F82, +0xB7DD,0xB7DE,0x8F83,0xB7DF,0x8F84,0xB7E0,0x8F85,0x8F86, +0x8F87,0x8F88,0x8F89,0x8F8A,0xB7E1,0x8F8B,0x8F8C,0x8F8D, +0xB7E2,0x8F8E,0x8F8F,0x8F90,0xB7E3,0x8F91,0x8F92,0x8F93, +0x8F94,0x8F95,0x8F96,0x8F97,0x8F98,0xB7E4,0x8F99,0xB7E5, +0x8F9A,0xB7E6,0x8F9B,0x8F9C,0x8F9D,0x8F9E,0x8F9F,0x8FA0, +0xB7E7,0xB7E8,0x8FA1,0x8FA2,0xB7E9,0x8FA3,0x8FA4,0x8FA5, +0xB7EA,0x8FA6,0x8FA7,0x8FA8,0x8FA9,0x8FAA,0x8FAB,0x8FAC, +0xB7EB,0xB7EC,0x8FAD,0xB7ED,0x8FAE,0xB7EE,0x8FAF,0x8FB0, +0x8FB1,0x8FB2,0x8FB3,0x8FB4,0xB7EF,0x8FB5,0x8FB6,0x8FB7, +0x8FB8,0x8FB9,0x8FBA,0x8FBB,0x8FBC,0x8FBD,0x8FBE,0x8FBF, +0x8FC0,0x8FC1,0x8FC2,0x8FC3,0x8FC4,0x8FC5,0x8FC6,0x8FC7, +0xB7F0,0x8FC8,0x8FC9,0x8FCA,0x8FCB,0x8FCC,0x8FCD,0x8FCE, +0xB7F1,0x8FCF,0x8FD0,0x8FD1,0x8FD2,0x8FD3,0x8FD4,0x8FD5, +0x8FD6,0x8FD7,0x8FD8,0x8FD9,0x8FDA,0x8FDB,0x8FDC,0x8FDD, +0x8FDE,0x8FDF,0x8FE0,0x8FE1,0x8FE2,0x8FE3,0x8FE4,0x8FE5, +0x8FE6,0x8FE7,0x8FE8,0x8FE9,0xB7F2,0xB7F3,0x8FEA,0x8FEB, +0xB7F4,0x8FEC,0x8FED,0x8FEE,0xB7F5,0x8FEF,0x8FF0,0x8FF1, +0x8FF2,0x8FF3,0x8FF4,0x8FF5,0xB7F6,0x8FF6,0x8FF7,0xB7F7, +0x8FF8,0xB7F8,0x8FF9,0x8FFA,0x8FFB,0x8FFC,0x8FFD,0x8FFE, +0xB7F9,0xB7FA,0x9041,0x9042,0xB7FB,0x9043,0x9044,0x9045, +0xB7FC,0x9046,0x9047,0x9048,0x9049,0x904A,0x904B,0x904C, +0xB7FD,0xB7FE,0x904D,0xB8A1,0x904E,0xB8A2,0x904F,0x9050, +0x9051,0x9052,0x9053,0x9054,0xB8A3,0xB8A4,0x9055,0x9056, +0xB8A5,0x9057,0x9058,0x9059,0xB8A6,0x905A,0x9061,0x9062, +0x9063,0x9064,0x9065,0x9066,0xB8A7,0xB8A8,0x9067,0xB8A9, +0x9068,0xB8AA,0xB8AB,0x9069,0x906A,0xB8AC,0xB8AD,0x906B, +0x906C,0x906D,0x906E,0x906F,0x9070,0x9071,0x9072,0x9073, +0x9074,0x9075,0x9076,0x9077,0x9078,0x9079,0x907A,0x9081, +0x9082,0x9083,0x9084,0x9085,0x9086,0x9087,0x9088,0x9089, +0x908A,0x908B,0x908C,0x908D,0xB8AE,0xB8AF,0x908E,0x908F, +0xB8B0,0x9090,0x9091,0x9092,0xB8B1,0x9093,0x9094,0x9095, +0x9096,0x9097,0x9098,0x9099,0xB8B2,0xB8B3,0x909A,0xB8B4, +0x909B,0xB8B5,0x909C,0x909D,0x909E,0x909F,0x90A0,0x90A1, +0xB8B6,0xB8B7,0x90A2,0x90A3,0xB8B8,0x90A4,0xB8B9,0xB8BA, +0xB8BB,0xB8BC,0xB8BD,0x90A5,0x90A6,0x90A7,0x90A8,0x90A9, +0xB8BE,0xB8BF,0x90AA,0xB8C0,0x90AB,0xB8C1,0xB8C2,0x90AC, +0x90AD,0xB8C3,0x90AE,0xB8C4,0xB8C5,0xB8C6,0x90AF,0x90B0, +0xB8C7,0x90B1,0x90B2,0x90B3,0xB8C8,0x90B4,0x90B5,0x90B6, +0x90B7,0x90B8,0x90B9,0x90BA,0xB8C9,0xB8CA,0x90BB,0xB8CB, +0xB8CC,0xB8CD,0xB8CE,0x90BC,0x90BD,0x90BE,0x90BF,0x90C0, +0xB8CF,0xB8D0,0x90C1,0x90C2,0x90C3,0x90C4,0x90C5,0x90C6, +0xB8D1,0x90C7,0x90C8,0x90C9,0x90CA,0x90CB,0x90CC,0x90CD, +0x90CE,0x90CF,0x90D0,0x90D1,0x90D2,0xB8D2,0x90D3,0x90D4, +0x90D5,0x90D6,0x90D7,0x90D8,0x90D9,0x90DA,0x90DB,0x90DC, +0x90DD,0x90DE,0x90DF,0x90E0,0x90E1,0x90E2,0x90E3,0x90E4, +0x90E5,0x90E6,0x90E7,0x90E8,0x90E9,0x90EA,0x90EB,0x90EC, +0x90ED,0x90EE,0x90EF,0x90F0,0x90F1,0x90F2,0x90F3,0x90F4, +0xB8D3,0xB8D4,0x90F5,0x90F6,0xB8D5,0x90F7,0x90F8,0x90F9, +0xB8D6,0x90FA,0xB8D7,0x90FB,0x90FC,0x90FD,0x90FE,0x9141, +0xB8D8,0xB8D9,0x9142,0xB8DA,0x9143,0xB8DB,0xB8DC,0x9144, +0x9145,0x9146,0x9147,0xB8DD,0xB8DE,0xB8DF,0x9148,0x9149, +0xB8E0,0x914A,0x914B,0x914C,0xB8E1,0x914D,0x914E,0x914F, +0x9150,0x9151,0x9152,0x9153,0xB8E2,0xB8E3,0x9154,0xB8E4, +0xB8E5,0xB8E6,0x9155,0x9156,0x9157,0x9158,0x9159,0x915A, +0xB8E7,0xB8E8,0x9161,0x9162,0xB8E9,0x9163,0x9164,0x9165, +0xB8EA,0x9166,0x9167,0x9168,0x9169,0x916A,0x916B,0x916C, +0x916D,0x916E,0x916F,0xB8EB,0xB8EC,0xB8ED,0x9170,0xB8EE, +0x9171,0x9172,0x9173,0x9174,0xB8EF,0x9175,0x9176,0x9177, +0x9178,0x9179,0x917A,0x9181,0x9182,0x9183,0x9184,0x9185, +0x9186,0x9187,0x9188,0x9189,0x918A,0x918B,0x918C,0x918D, +0x918E,0x918F,0x9190,0x9191,0x9192,0x9193,0x9194,0x9195, +0xB8F0,0xB8F1,0x9196,0xB8F2,0xB8F3,0x9197,0x9198,0x9199, +0xB8F4,0x919A,0xB8F5,0x919B,0x919C,0x919D,0x919E,0x919F, +0xB8F6,0xB8F7,0x91A0,0xB8F8,0x91A1,0xB8F9,0x91A2,0x91A3, +0x91A4,0x91A5,0x91A6,0x91A7,0xB8FA,0x91A8,0x91A9,0x91AA, +0xB8FB,0x91AB,0x91AC,0x91AD,0x91AE,0x91AF,0x91B0,0x91B1, +0x91B2,0x91B3,0x91B4,0x91B5,0x91B6,0x91B7,0x91B8,0x91B9, +0xB8FC,0xB8FD,0x91BA,0x91BB,0x91BC,0x91BD,0x91BE,0x91BF, +0x91C0,0x91C1,0x91C2,0x91C3,0x91C4,0x91C5,0x91C6,0x91C7, +0x91C8,0x91C9,0x91CA,0x91CB,0x91CC,0x91CD,0x91CE,0x91CF, +0x91D0,0x91D1,0x91D2,0x91D3,0x91D4,0x91D5,0x91D6,0x91D7, +0x91D8,0x91D9,0x91DA,0x91DB,0xB8FE,0x91DC,0x91DD,0x91DE, +0xB9A1,0x91DF,0x91E0,0x91E1,0xB9A2,0x91E2,0x91E3,0x91E4, +0x91E5,0x91E6,0x91E7,0x91E8,0x91E9,0xB9A3,0x91EA,0xB9A4, +0x91EB,0xB9A5,0x91EC,0x91ED,0x91EE,0x91EF,0x91F0,0x91F1, +0xB9A6,0x91F2,0x91F3,0x91F4,0xB9A7,0x91F5,0x91F6,0x91F7, +0xB9A8,0x91F8,0x91F9,0x91FA,0x91FB,0x91FC,0x91FD,0x91FE, +0x9241,0xB9A9,0x9242,0xB9AA,0x9243,0x9244,0x9245,0x9246, +0x9247,0x9248,0x9249,0x924A,0xB9AB,0xB9AC,0xB9AD,0x924B, +0xB9AE,0x924C,0x924D,0xB9AF,0xB9B0,0xB9B1,0xB9B2,0x924E, +0x924F,0x9250,0x9251,0x9252,0xB9B3,0xB9B4,0x9253,0xB9B5, +0x9254,0xB9B6,0x9255,0x9256,0x9257,0xB9B7,0x9258,0xB9B8, +0xB9B9,0x9259,0x925A,0x9261,0xB9BA,0x9262,0x9263,0x9264, +0xB9BB,0x9265,0x9266,0x9267,0x9268,0x9269,0x926A,0x926B, +0x926C,0xB9BC,0x926D,0xB9BD,0x926E,0x926F,0x9270,0x9271, +0x9272,0x9273,0x9274,0x9275,0xB9BE,0x9276,0x9277,0x9278, +0x9279,0x927A,0x9281,0x9282,0x9283,0x9284,0x9285,0x9286, +0x9287,0x9288,0x9289,0x928A,0x928B,0x928C,0x928D,0x928E, +0x928F,0x9290,0x9291,0x9292,0x9293,0x9294,0x9295,0x9296, +0xB9BF,0x9297,0x9298,0x9299,0xB9C0,0x929A,0x929B,0x929C, +0xB9C1,0x929D,0x929E,0x929F,0x92A0,0x92A1,0x92A2,0x92A3, +0x92A4,0x92A5,0x92A6,0x92A7,0x92A8,0x92A9,0x92AA,0x92AB, +0x92AC,0x92AD,0x92AE,0x92AF,0xB9C2,0x92B0,0x92B1,0x92B2, +0xB9C3,0x92B3,0x92B4,0x92B5,0xB9C4,0x92B6,0x92B7,0x92B8, +0x92B9,0x92BA,0x92BB,0x92BC,0xB9C5,0x92BD,0x92BE,0xB9C6, +0x92BF,0x92C0,0x92C1,0x92C2,0x92C3,0x92C4,0x92C5,0x92C6, +0xB9C7,0x92C7,0x92C8,0x92C9,0xB9C8,0x92CA,0x92CB,0x92CC, +0xB9C9,0x92CD,0x92CE,0x92CF,0x92D0,0x92D1,0x92D2,0x92D3, +0xB9CA,0x92D4,0x92D5,0xB9CB,0x92D6,0x92D7,0x92D8,0x92D9, +0x92DA,0x92DB,0x92DC,0x92DD,0x92DE,0x92DF,0x92E0,0x92E1, +0x92E2,0x92E3,0x92E4,0x92E5,0x92E6,0x92E7,0x92E8,0x92E9, +0x92EA,0x92EB,0x92EC,0x92ED,0x92EE,0x92EF,0x92F0,0x92F1, +0x92F2,0x92F3,0x92F4,0x92F5,0x92F6,0x92F7,0x92F8,0x92F9, +0xB9CC,0xB9CD,0x92FA,0x92FB,0xB9CE,0x92FC,0x92FD,0xB9CF, +0xB9D0,0x92FE,0xB9D1,0x9341,0x9342,0x9343,0x9344,0x9345, +0xB9D2,0xB9D3,0x9346,0xB9D4,0xB9D5,0xB9D6,0x9347,0xB9D7, +0x9348,0xB9D8,0x9349,0x934A,0xB9D9,0xB9DA,0xB9DB,0xB9DC, +0xB9DD,0x934B,0x934C,0xB9DE,0xB9DF,0xB9E0,0xB9E1,0xB9E2, +0x934D,0x934E,0x934F,0x9350,0xB9E3,0xB9E4,0x9351,0xB9E5, +0x9352,0xB9E6,0x9353,0x9354,0x9355,0xB9E7,0x9356,0x9357, +0xB9E8,0xB9E9,0x9358,0x9359,0xB9EA,0x935A,0x9361,0x9362, +0xB9EB,0x9363,0x9364,0x9365,0x9366,0x9367,0x9368,0x9369, +0xB9EC,0xB9ED,0x936A,0xB9EE,0xB9EF,0xB9F0,0x936B,0x936C, +0x936D,0xB9F1,0x936E,0x936F,0xB9F2,0xB9F3,0x9370,0x9371, +0xB9F4,0x9372,0x9373,0x9374,0x9375,0x9376,0x9377,0x9378, +0x9379,0x937A,0x9381,0x9382,0x9383,0xB9F5,0x9384,0x9385, +0x9386,0x9387,0x9388,0x9389,0x938A,0x938B,0x938C,0x938D, +0x938E,0x938F,0x9390,0x9391,0x9392,0x9393,0x9394,0x9395, +0x9396,0x9397,0x9398,0x9399,0x939A,0x939B,0x939C,0x939D, +0x939E,0x939F,0x93A0,0x93A1,0x93A2,0x93A3,0x93A4,0x93A5, +0x93A6,0x93A7,0x93A8,0x93A9,0xB9F6,0xB9F7,0x93AA,0x93AB, +0xB9F8,0x93AC,0x93AD,0xB9F9,0xB9FA,0x93AE,0xB9FB,0x93AF, +0x93B0,0x93B1,0x93B2,0x93B3,0xB9FC,0xB9FD,0x93B4,0xB9FE, +0x93B5,0xBAA1,0xBAA2,0x93B6,0x93B7,0x93B8,0x93B9,0x93BA, +0xBAA3,0xBAA4,0x93BB,0x93BC,0xBAA5,0x93BD,0x93BE,0xBAA6, +0xBAA7,0x93BF,0x93C0,0x93C1,0x93C2,0x93C3,0x93C4,0x93C5, +0xBAA8,0xBAA9,0x93C6,0xBAAA,0xBAAB,0xBAAC,0x93C7,0x93C8, +0x93C9,0x93CA,0x93CB,0x93CC,0xBAAD,0xBAAE,0x93CD,0x93CE, +0xBAAF,0x93CF,0x93D0,0x93D1,0xBAB0,0x93D2,0x93D3,0x93D4, +0x93D5,0x93D6,0x93D7,0x93D8,0x93D9,0xBAB1,0x93DA,0xBAB2, +0xBAB3,0xBAB4,0x93DB,0x93DC,0x93DD,0xBAB5,0x93DE,0x93DF, +0xBAB6,0x93E0,0x93E1,0x93E2,0xBAB7,0x93E3,0x93E4,0x93E5, +0x93E6,0x93E7,0x93E8,0x93E9,0x93EA,0x93EB,0x93EC,0x93ED, +0x93EE,0x93EF,0x93F0,0x93F1,0x93F2,0x93F3,0x93F4,0x93F5, +0x93F6,0x93F7,0x93F8,0x93F9,0xBAB8,0xBAB9,0xBABA,0x93FA, +0xBABB,0x93FB,0x93FC,0x93FD,0xBABC,0x93FE,0x9441,0x9442, +0x9443,0x9444,0x9445,0x9446,0xBABD,0xBABE,0x9447,0xBABF, +0x9448,0xBAC0,0x9449,0x944A,0x944B,0x944C,0x944D,0x944E, +0xBAC1,0x944F,0x9450,0x9451,0xBAC2,0x9452,0x9453,0x9454, +0x9455,0x9456,0x9457,0x9458,0x9459,0x945A,0x9461,0x9462, +0x9463,0x9464,0x9465,0x9466,0xBAC3,0x9467,0x9468,0x9469, +0x946A,0x946B,0x946C,0x946D,0xBAC4,0x946E,0x946F,0x9470, +0x9471,0x9472,0x9473,0x9474,0x9475,0x9476,0x9477,0x9478, +0x9479,0x947A,0x9481,0x9482,0x9483,0x9484,0x9485,0x9486, +0xBAC5,0x9487,0x9488,0x9489,0x948A,0x948B,0x948C,0x948D, +0xBAC6,0xBAC7,0x948E,0x948F,0xBAC8,0x9490,0x9491,0x9492, +0xBAC9,0x9493,0x9494,0x9495,0x9496,0x9497,0x9498,0x9499, +0xBACA,0xBACB,0x949A,0x949B,0x949C,0x949D,0x949E,0x949F, +0x94A0,0x94A1,0x94A2,0x94A3,0xBACC,0x94A4,0x94A5,0x94A6, +0xBACD,0x94A7,0x94A8,0x94A9,0x94AA,0x94AB,0x94AC,0x94AD, +0x94AE,0x94AF,0x94B0,0x94B1,0x94B2,0x94B3,0x94B4,0x94B5, +0x94B6,0x94B7,0x94B8,0x94B9,0x94BA,0x94BB,0x94BC,0x94BD, +0xBACE,0xBACF,0x94BE,0x94BF,0xBAD0,0x94C0,0x94C1,0xBAD1, +0xBAD2,0xBAD3,0xBAD4,0x94C2,0x94C3,0x94C4,0x94C5,0x94C6, +0xBAD5,0xBAD6,0x94C7,0xBAD7,0x94C8,0xBAD8,0x94C9,0x94CA, +0x94CB,0xBAD9,0xBADA,0x94CC,0xBADB,0x94CD,0x94CE,0x94CF, +0x94D0,0x94D1,0x94D2,0x94D3,0xBADC,0x94D4,0x94D5,0x94D6, +0x94D7,0x94D8,0x94D9,0x94DA,0x94DB,0x94DC,0x94DD,0x94DE, +0xBADD,0x94DF,0x94E0,0x94E1,0x94E2,0x94E3,0x94E4,0x94E5, +0xBADE,0x94E6,0x94E7,0x94E8,0x94E9,0x94EA,0x94EB,0x94EC, +0x94ED,0x94EE,0x94EF,0x94F0,0x94F1,0x94F2,0x94F3,0x94F4, +0x94F5,0x94F6,0x94F7,0x94F8,0x94F9,0x94FA,0x94FB,0x94FC, +0x94FD,0x94FE,0x9541,0x9542,0xBADF,0xBAE0,0x9543,0x9544, +0xBAE1,0x9545,0x9546,0x9547,0xBAE2,0x9548,0x9549,0x954A, +0x954B,0x954C,0x954D,0x954E,0x954F,0x9550,0x9551,0x9552, +0x9553,0xBAE3,0x9554,0x9555,0x9556,0x9557,0x9558,0x9559, +0xBAE4,0x955A,0x9561,0x9562,0xBAE5,0x9563,0x9564,0x9565, +0xBAE6,0x9566,0x9567,0x9568,0x9569,0x956A,0x956B,0x956C, +0xBAE7,0x956D,0x956E,0xBAE8,0x956F,0xBAE9,0x9570,0x9571, +0x9572,0x9573,0x9574,0x9575,0xBAEA,0xBAEB,0x9576,0x9577, +0xBAEC,0x9578,0x9579,0x957A,0xBAED,0x9581,0x9582,0x9583, +0x9584,0x9585,0x9586,0x9587,0xBAEE,0xBAEF,0x9588,0xBAF0, +0x9589,0x958A,0x958B,0x958C,0x958D,0x958E,0x958F,0x9590, +0x9591,0x9592,0x9593,0x9594,0x9595,0x9596,0x9597,0x9598, +0x9599,0x959A,0x959B,0x959C,0x959D,0x959E,0x959F,0x95A0, +0x95A1,0x95A2,0x95A3,0x95A4,0x95A5,0x95A6,0x95A7,0x95A8, +0x95A9,0x95AA,0x95AB,0x95AC,0xBAF1,0xBAF2,0x95AD,0x95AE, +0xBAF3,0x95AF,0x95B0,0x95B1,0xBAF4,0x95B2,0xBAF5,0x95B3, +0x95B4,0x95B5,0x95B6,0x95B7,0xBAF6,0xBAF7,0x95B8,0xBAF8, +0x95B9,0xBAF9,0xBAFA,0xBAFB,0x95BA,0x95BB,0x95BC,0x95BD, +0xBAFC,0xBAFD,0x95BE,0x95BF,0xBAFE,0x95C0,0x95C1,0x95C2, +0xBBA1,0x95C3,0xBBA2,0x95C4,0x95C5,0x95C6,0x95C7,0x95C8, +0xBBA3,0xBBA4,0x95C9,0xBBA5,0xBBA6,0xBBA7,0x95CA,0x95CB, +0x95CC,0x95CD,0x95CE,0xBBA8,0xBBA9,0xBBAA,0x95CF,0x95D0, +0xBBAB,0x95D1,0x95D2,0x95D3,0xBBAC,0x95D4,0x95D5,0x95D6, +0x95D7,0x95D8,0x95D9,0x95DA,0xBBAD,0xBBAE,0x95DB,0xBBAF, +0xBBB0,0xBBB1,0x95DC,0x95DD,0x95DE,0x95DF,0x95E0,0x95E1, +0xBBB2,0xBBB3,0x95E2,0x95E3,0x95E4,0x95E5,0x95E6,0x95E7, +0x95E8,0x95E9,0x95EA,0x95EB,0x95EC,0x95ED,0x95EE,0x95EF, +0xBBB4,0x95F0,0x95F1,0x95F2,0x95F3,0x95F4,0x95F5,0x95F6, +0x95F7,0x95F8,0x95F9,0x95FA,0x95FB,0x95FC,0x95FD,0x95FE, +0x9641,0x9642,0x9643,0x9644,0x9645,0x9646,0x9647,0x9648, +0x9649,0x964A,0x964B,0x964C,0x964D,0x964E,0x964F,0x9650, +0x9651,0x9652,0x9653,0x9654,0x9655,0x9656,0x9657,0x9658, +0xBBB5,0xBBB6,0x9659,0x965A,0xBBB7,0x9661,0x9662,0xBBB8, +0xBBB9,0x9663,0x9664,0x9665,0x9666,0x9667,0x9668,0x9669, +0xBBBA,0x966A,0x966B,0xBBBB,0xBBBC,0xBBBD,0x966C,0x966D, +0x966E,0x966F,0x9670,0x9671,0xBBBE,0x9672,0x9673,0x9674, +0x9675,0x9676,0x9677,0x9678,0x9679,0x967A,0x9681,0x9682, +0x9683,0x9684,0x9685,0x9686,0x9687,0x9688,0x9689,0x968A, +0x968B,0xBBBF,0x968C,0x968D,0x968E,0x968F,0x9690,0x9691, +0xBBC0,0xBBC1,0x9692,0x9693,0x9694,0x9695,0x9696,0x9697, +0x9698,0x9699,0x969A,0x969B,0x969C,0x969D,0x969E,0x969F, +0xBBC2,0xBBC3,0x96A0,0xBBC4,0xBBC5,0xBBC6,0x96A1,0x96A2, +0x96A3,0x96A4,0x96A5,0x96A6,0x96A7,0x96A8,0x96A9,0x96AA, +0x96AB,0x96AC,0x96AD,0x96AE,0x96AF,0x96B0,0x96B1,0x96B2, +0x96B3,0x96B4,0x96B5,0x96B6,0x96B7,0x96B8,0x96B9,0x96BA, +0x96BB,0x96BC,0x96BD,0x96BE,0x96BF,0x96C0,0x96C1,0x96C2, +0xBBC7,0xBBC8,0x96C3,0x96C4,0xBBC9,0x96C5,0x96C6,0x96C7, +0xBBCA,0x96C8,0x96C9,0x96CA,0x96CB,0x96CC,0x96CD,0x96CE, +0xBBCB,0xBBCC,0x96CF,0x96D0,0x96D1,0xBBCD,0x96D2,0x96D3, +0x96D4,0x96D5,0x96D6,0x96D7,0x96D8,0x96D9,0x96DA,0x96DB, +0x96DC,0x96DD,0x96DE,0x96DF,0x96E0,0x96E1,0x96E2,0x96E3, +0x96E4,0x96E5,0x96E6,0x96E7,0x96E8,0x96E9,0x96EA,0x96EB, +0x96EC,0x96ED,0x96EE,0x96EF,0x96F0,0x96F1,0x96F2,0x96F3, +0x96F4,0x96F5,0x96F6,0x96F7,0x96F8,0x96F9,0x96FA,0x96FB, +0x96FC,0x96FD,0x96FE,0x9741,0x9742,0x9743,0x9744,0x9745, +0x9746,0x9747,0x9748,0x9749,0x974A,0x974B,0x974C,0x974D, +0x974E,0x974F,0x9750,0x9751,0xBBCE,0x9752,0x9753,0x9754, +0x9755,0x9756,0x9757,0x9758,0x9759,0x975A,0x9761,0x9762, +0x9763,0x9764,0x9765,0x9766,0x9767,0x9768,0x9769,0x976A, +0x976B,0x976C,0x976D,0x976E,0x976F,0x9770,0x9771,0x9772, +0xBBCF,0x9773,0x9774,0x9775,0x9776,0x9777,0x9778,0x9779, +0x977A,0x9781,0x9782,0x9783,0x9784,0x9785,0x9786,0x9787, +0x9788,0x9789,0x978A,0x978B,0x978C,0xBBD0,0x978D,0x978E, +0x978F,0x9790,0x9791,0x9792,0xBBD1,0xBBD2,0x9793,0x9794, +0xBBD3,0x9795,0x9796,0x9797,0xBBD4,0x9798,0x9799,0x979A, +0x979B,0x979C,0x979D,0x979E,0xBBD5,0x979F,0x97A0,0xBBD6, +0x97A1,0xBBD7,0x97A2,0x97A3,0x97A4,0x97A5,0x97A6,0x97A7, +0x97A8,0x97A9,0x97AA,0x97AB,0x97AC,0x97AD,0x97AE,0x97AF, +0x97B0,0x97B1,0x97B2,0x97B3,0x97B4,0x97B5,0x97B6,0x97B7, +0x97B8,0x97B9,0x97BA,0x97BB,0x97BC,0x97BD,0x97BE,0x97BF, +0x97C0,0x97C1,0x97C2,0x97C3,0x97C4,0x97C5,0x97C6,0x97C7, +0x97C8,0x97C9,0x97CA,0x97CB,0x97CC,0x97CD,0x97CE,0x97CF, +0x97D0,0x97D1,0x97D2,0x97D3,0x97D4,0x97D5,0x97D6,0x97D7, +0x97D8,0x97D9,0x97DA,0x97DB,0x97DC,0x97DD,0x97DE,0x97DF, +0x97E0,0x97E1,0x97E2,0x97E3,0x97E4,0x97E5,0x97E6,0x97E7, +0x97E8,0x97E9,0x97EA,0x97EB,0x97EC,0x97ED,0x97EE,0x97EF, +0x97F0,0x97F1,0x97F2,0x97F3,0x97F4,0x97F5,0x97F6,0x97F7, +0x97F8,0x97F9,0x97FA,0x97FB,0xBBD8,0x97FC,0x97FD,0x97FE, +0x9841,0x9842,0x9843,0x9844,0x9845,0x9846,0x9847,0x9848, +0x9849,0x984A,0x984B,0x984C,0x984D,0x984E,0x984F,0x9850, +0x9851,0xBBD9,0x9852,0x9853,0x9854,0x9855,0x9856,0x9857, +0xBBDA,0x9858,0x9859,0x985A,0xBBDB,0x9861,0x9862,0x9863, +0xBBDC,0x9864,0x9865,0x9866,0x9867,0x9868,0x9869,0x986A, +0xBBDD,0xBBDE,0x986B,0x986C,0x986D,0x986E,0x986F,0x9870, +0x9871,0x9872,0x9873,0x9874,0x9875,0x9876,0x9877,0x9878, +0x9879,0x987A,0x9881,0x9882,0x9883,0x9884,0x9885,0x9886, +0x9887,0x9888,0x9889,0x988A,0x988B,0x988C,0x988D,0x988E, +0x988F,0x9890,0x9891,0x9892,0x9893,0x9894,0x9895,0x9896, +0xBBDF,0xBBE0,0x9897,0x9898,0xBBE1,0x9899,0x989A,0x989B, +0xBBE2,0x989C,0x989D,0x989E,0x989F,0x98A0,0x98A1,0x98A2, +0xBBE3,0xBBE4,0x98A3,0xBBE5,0x98A4,0xBBE6,0x98A5,0x98A6, +0x98A7,0x98A8,0x98A9,0x98AA,0xBBE7,0xBBE8,0x98AB,0xBBE9, +0xBBEA,0x98AC,0x98AD,0xBBEB,0xBBEC,0xBBED,0xBBEE,0x98AE, +0x98AF,0x98B0,0x98B1,0x98B2,0xBBEF,0xBBF0,0x98B3,0xBBF1, +0xBBF2,0xBBF3,0x98B4,0x98B5,0x98B6,0xBBF4,0x98B7,0x98B8, +0xBBF5,0xBBF6,0x98B9,0x98BA,0xBBF7,0x98BB,0x98BC,0x98BD, +0xBBF8,0x98BE,0x98BF,0x98C0,0x98C1,0x98C2,0x98C3,0x98C4, +0xBBF9,0xBBFA,0x98C5,0xBBFB,0xBBFC,0xBBFD,0x98C6,0x98C7, +0x98C8,0x98C9,0x98CA,0x98CB,0xBBFE,0xBCA1,0x98CC,0x98CD, +0xBCA2,0x98CE,0x98CF,0x98D0,0xBCA3,0x98D1,0x98D2,0x98D3, +0x98D4,0x98D5,0x98D6,0x98D7,0xBCA4,0xBCA5,0x98D8,0xBCA6, +0x98D9,0xBCA7,0x98DA,0x98DB,0x98DC,0x98DD,0x98DE,0x98DF, +0xBCA8,0x98E0,0x98E1,0x98E2,0xBCA9,0x98E3,0x98E4,0x98E5, +0xBCAA,0x98E6,0x98E7,0x98E8,0x98E9,0x98EA,0x98EB,0x98EC, +0xBCAB,0x98ED,0x98EE,0x98EF,0x98F0,0xBCAC,0x98F1,0x98F2, +0x98F3,0x98F4,0x98F5,0x98F6,0xBCAD,0xBCAE,0xBCAF,0xBCB0, +0xBCB1,0x98F7,0x98F8,0xBCB2,0xBCB3,0x98F9,0xBCB4,0xBCB5, +0x98FA,0x98FB,0x98FC,0x98FD,0xBCB6,0xBCB7,0x98FE,0xBCB8, +0xBCB9,0xBCBA,0x9941,0x9942,0x9943,0x9944,0xBCBB,0x9945, +0xBCBC,0xBCBD,0x9946,0x9947,0xBCBE,0x9948,0x9949,0x994A, +0xBCBF,0x994B,0x994C,0x994D,0x994E,0x994F,0x9950,0x9951, +0xBCC0,0xBCC1,0x9952,0xBCC2,0xBCC3,0xBCC4,0x9953,0x9954, +0x9955,0x9956,0x9957,0x9958,0xBCC5,0xBCC6,0x9959,0x995A, +0xBCC7,0x9961,0x9962,0x9963,0xBCC8,0x9964,0x9965,0x9966, +0x9967,0x9968,0x9969,0x996A,0xBCC9,0xBCCA,0x996B,0xBCCB, +0xBCCC,0xBCCD,0x996C,0x996D,0x996E,0x996F,0x9970,0x9971, +0xBCCE,0x9972,0x9973,0x9974,0xBCCF,0x9975,0x9976,0x9977, +0xBCD0,0x9978,0x9979,0x997A,0x9981,0x9982,0x9983,0x9984, +0x9985,0x9986,0x9987,0x9988,0x9989,0xBCD1,0x998A,0x998B, +0x998C,0x998D,0x998E,0x998F,0xBCD2,0xBCD3,0xBCD4,0x9990, +0xBCD5,0x9991,0x9992,0x9993,0xBCD6,0x9994,0xBCD7,0x9995, +0x9996,0x9997,0x9998,0x9999,0xBCD8,0xBCD9,0x999A,0xBCDA, +0x999B,0xBCDB,0x999C,0x999D,0x999E,0xBCDC,0x999F,0x99A0, +0xBCDD,0xBCDE,0x99A1,0x99A2,0xBCDF,0x99A3,0x99A4,0x99A5, +0xBCE0,0x99A6,0x99A7,0x99A8,0x99A9,0x99AA,0x99AB,0x99AC, +0x99AD,0x99AE,0x99AF,0x99B0,0x99B1,0xBCE1,0x99B2,0x99B3, +0x99B4,0x99B5,0x99B6,0x99B7,0xBCE2,0x99B8,0x99B9,0x99BA, +0xBCE3,0x99BB,0x99BC,0x99BD,0xBCE4,0x99BE,0x99BF,0x99C0, +0x99C1,0x99C2,0x99C3,0x99C4,0xBCE5,0x99C5,0x99C6,0xBCE6, +0xBCE7,0x99C7,0x99C8,0x99C9,0x99CA,0x99CB,0x99CC,0x99CD, +0xBCE8,0x99CE,0x99CF,0x99D0,0xBCE9,0x99D1,0x99D2,0x99D3, +0xBCEA,0x99D4,0x99D5,0x99D6,0x99D7,0x99D8,0x99D9,0x99DA, +0xBCEB,0xBCEC,0x99DB,0xBCED,0x99DC,0x99DD,0x99DE,0x99DF, +0x99E0,0x99E1,0x99E2,0x99E3,0xBCEE,0xBCEF,0x99E4,0x99E5, +0xBCF0,0x99E6,0x99E7,0x99E8,0xBCF1,0x99E9,0x99EA,0x99EB, +0x99EC,0x99ED,0x99EE,0x99EF,0xBCF2,0xBCF3,0x99F0,0xBCF4, +0x99F1,0xBCF5,0x99F2,0x99F3,0x99F4,0x99F5,0x99F6,0x99F7, +0xBCF6,0xBCF7,0x99F8,0x99F9,0xBCF8,0x99FA,0x99FB,0xBCF9, +0xBCFA,0x99FC,0x99FD,0x99FE,0x9A41,0x9A42,0x9A43,0x9A44, +0xBCFB,0xBCFC,0x9A45,0xBCFD,0x9A46,0xBCFE,0x9A47,0xBDA1, +0x9A48,0xBDA2,0xBDA3,0x9A49,0xBDA4,0x9A4A,0x9A4B,0x9A4C, +0x9A4D,0x9A4E,0x9A4F,0x9A50,0x9A51,0x9A52,0x9A53,0x9A54, +0x9A55,0x9A56,0x9A57,0x9A58,0x9A59,0x9A5A,0x9A61,0x9A62, +0xBDA5,0x9A63,0x9A64,0x9A65,0x9A66,0x9A67,0x9A68,0x9A69, +0xBDA6,0xBDA7,0x9A6A,0x9A6B,0xBDA8,0x9A6C,0x9A6D,0x9A6E, +0xBDA9,0x9A6F,0x9A70,0x9A71,0x9A72,0x9A73,0x9A74,0x9A75, +0xBDAA,0x9A76,0x9A77,0x9A78,0x9A79,0xBDAB,0x9A7A,0x9A81, +0x9A82,0x9A83,0x9A84,0x9A85,0xBDAC,0xBDAD,0x9A86,0x9A87, +0xBDAE,0x9A88,0x9A89,0x9A8A,0xBDAF,0x9A8B,0x9A8C,0x9A8D, +0x9A8E,0x9A8F,0x9A90,0x9A91,0xBDB0,0xBDB1,0x9A92,0xBDB2, +0x9A93,0xBDB3,0x9A94,0x9A95,0x9A96,0x9A97,0x9A98,0x9A99, +0xBDB4,0xBDB5,0x9A9A,0x9A9B,0x9A9C,0x9A9D,0x9A9E,0x9A9F, +0xBDB6,0x9AA0,0x9AA1,0x9AA2,0x9AA3,0x9AA4,0x9AA5,0x9AA6, +0xBDB7,0x9AA7,0x9AA8,0xBDB8,0x9AA9,0xBDB9,0x9AAA,0x9AAB, +0x9AAC,0x9AAD,0x9AAE,0x9AAF,0xBDBA,0xBDBB,0x9AB0,0x9AB1, +0xBDBC,0x9AB2,0x9AB3,0x9AB4,0xBDBD,0xBDBE,0x9AB5,0x9AB6, +0x9AB7,0x9AB8,0x9AB9,0x9ABA,0xBDBF,0xBDC0,0x9ABB,0xBDC1, +0x9ABC,0xBDC2,0x9ABD,0x9ABE,0x9ABF,0x9AC0,0x9AC1,0x9AC2, +0x9AC3,0x9AC4,0x9AC5,0x9AC6,0x9AC7,0x9AC8,0x9AC9,0x9ACA, +0x9ACB,0x9ACC,0x9ACD,0x9ACE,0x9ACF,0x9AD0,0x9AD1,0x9AD2, +0x9AD3,0x9AD4,0x9AD5,0x9AD6,0x9AD7,0x9AD8,0x9AD9,0x9ADA, +0x9ADB,0x9ADC,0x9ADD,0x9ADE,0xBDC3,0xBDC4,0x9ADF,0x9AE0, +0xBDC5,0x9AE1,0x9AE2,0xBDC6,0xBDC7,0x9AE3,0x9AE4,0x9AE5, +0x9AE6,0x9AE7,0x9AE8,0xBDC8,0xBDC9,0xBDCA,0x9AE9,0xBDCB, +0x9AEA,0xBDCC,0x9AEB,0x9AEC,0x9AED,0x9AEE,0xBDCD,0x9AEF, +0xBDCE,0xBDCF,0x9AF0,0xBDD0,0xBDD1,0x9AF1,0x9AF2,0x9AF3, +0xBDD2,0x9AF4,0x9AF5,0x9AF6,0x9AF7,0x9AF8,0x9AF9,0x9AFA, +0xBDD3,0xBDD4,0x9AFB,0x9AFC,0xBDD5,0xBDD6,0x9AFD,0x9AFE, +0x9B41,0x9B42,0x9B43,0xBDD7,0xBDD8,0xBDD9,0x9B44,0x9B45, +0xBDDA,0x9B46,0x9B47,0x9B48,0xBDDB,0x9B49,0x9B4A,0x9B4B, +0x9B4C,0x9B4D,0x9B4E,0x9B4F,0xBDDC,0xBDDD,0x9B50,0x9B51, +0xBDDE,0xBDDF,0x9B52,0x9B53,0x9B54,0x9B55,0x9B56,0x9B57, +0x9B58,0x9B59,0x9B5A,0x9B61,0x9B62,0x9B63,0x9B64,0x9B65, +0x9B66,0x9B67,0x9B68,0x9B69,0x9B6A,0x9B6B,0x9B6C,0x9B6D, +0x9B6E,0x9B6F,0x9B70,0x9B71,0x9B72,0xBDE0,0x9B73,0x9B74, +0x9B75,0x9B76,0x9B77,0x9B78,0x9B79,0x9B7A,0x9B81,0x9B82, +0x9B83,0x9B84,0x9B85,0x9B86,0x9B87,0x9B88,0x9B89,0x9B8A, +0x9B8B,0x9B8C,0x9B8D,0x9B8E,0x9B8F,0x9B90,0x9B91,0x9B92, +0x9B93,0x9B94,0x9B95,0x9B96,0x9B97,0x9B98,0x9B99,0x9B9A, +0xBDE1,0xBDE2,0x9B9B,0x9B9C,0xBDE3,0x9B9D,0x9B9E,0x9B9F, +0xBDE4,0x9BA0,0xBDE5,0x9BA1,0x9BA2,0x9BA3,0x9BA4,0x9BA5, +0xBDE6,0xBDE7,0x9BA6,0x9BA7,0xBDE8,0xBDE9,0x9BA8,0x9BA9, +0x9BAA,0x9BAB,0x9BAC,0x9BAD,0xBDEA,0x9BAE,0x9BAF,0x9BB0, +0xBDEB,0x9BB1,0x9BB2,0x9BB3,0xBDEC,0x9BB4,0x9BB5,0x9BB6, +0x9BB7,0x9BB8,0x9BB9,0x9BBA,0x9BBB,0x9BBC,0x9BBD,0x9BBE, +0x9BBF,0x9BC0,0x9BC1,0x9BC2,0x9BC3,0x9BC4,0x9BC5,0x9BC6, +0x9BC7,0x9BC8,0x9BC9,0x9BCA,0x9BCB,0x9BCC,0x9BCD,0x9BCE, +0x9BCF,0x9BD0,0x9BD1,0x9BD2,0x9BD3,0x9BD4,0x9BD5,0x9BD6, +0x9BD7,0x9BD8,0x9BD9,0x9BDA,0x9BDB,0x9BDC,0x9BDD,0x9BDE, +0x9BDF,0x9BE0,0x9BE1,0x9BE2,0x9BE3,0x9BE4,0x9BE5,0x9BE6, +0xBDED,0x9BE7,0x9BE8,0x9BE9,0x9BEA,0x9BEB,0x9BEC,0x9BED, +0x9BEE,0x9BEF,0x9BF0,0x9BF1,0x9BF2,0x9BF3,0x9BF4,0x9BF5, +0x9BF6,0x9BF7,0x9BF8,0x9BF9,0x9BFA,0x9BFB,0x9BFC,0x9BFD, +0xBDEE,0xBDEF,0x9BFE,0x9C41,0xBDF0,0x9C42,0x9C43,0xBDF1, +0xBDF2,0x9C44,0xBDF3,0x9C45,0x9C46,0x9C47,0x9C48,0x9C49, +0xBDF4,0xBDF5,0x9C4A,0x9C4B,0x9C4C,0xBDF6,0x9C4D,0x9C4E, +0x9C4F,0x9C50,0x9C51,0x9C52,0xBDF7,0xBDF8,0x9C53,0x9C54, +0xBDF9,0x9C55,0x9C56,0x9C57,0x9C58,0x9C59,0x9C5A,0x9C61, +0x9C62,0x9C63,0x9C64,0x9C65,0x9C66,0x9C67,0x9C68,0x9C69, +0xBDFA,0x9C6A,0x9C6B,0x9C6C,0x9C6D,0x9C6E,0x9C6F,0x9C70, +0xBDFB,0x9C71,0x9C72,0x9C73,0x9C74,0x9C75,0x9C76,0x9C77, +0x9C78,0x9C79,0x9C7A,0x9C81,0x9C82,0x9C83,0x9C84,0x9C85, +0x9C86,0x9C87,0x9C88,0x9C89,0xBDFC,0x9C8A,0x9C8B,0x9C8C, +0x9C8D,0x9C8E,0x9C8F,0x9C90,0xBDFD,0x9C91,0x9C92,0x9C93, +0xBDFE,0x9C94,0x9C95,0x9C96,0xBEA1,0x9C97,0x9C98,0x9C99, +0x9C9A,0x9C9B,0x9C9C,0x9C9D,0xBEA2,0xBEA3,0x9C9E,0x9C9F, +0x9CA0,0x9CA1,0x9CA2,0x9CA3,0x9CA4,0x9CA5,0x9CA6,0x9CA7, +0xBEA4,0x9CA8,0x9CA9,0x9CAA,0x9CAB,0x9CAC,0x9CAD,0x9CAE, +0x9CAF,0x9CB0,0x9CB1,0x9CB2,0x9CB3,0x9CB4,0x9CB5,0x9CB6, +0x9CB7,0x9CB8,0x9CB9,0x9CBA,0x9CBB,0x9CBC,0x9CBD,0x9CBE, +0x9CBF,0x9CC0,0x9CC1,0x9CC2,0xBEA5,0xBEA6,0x9CC3,0x9CC4, +0xBEA7,0x9CC5,0x9CC6,0x9CC7,0xBEA8,0x9CC8,0x9CC9,0x9CCA, +0x9CCB,0x9CCC,0x9CCD,0x9CCE,0xBEA9,0xBEAA,0x9CCF,0x9CD0, +0x9CD1,0xBEAB,0x9CD2,0x9CD3,0x9CD4,0x9CD5,0x9CD6,0x9CD7, +0xBEAC,0x9CD8,0x9CD9,0x9CDA,0x9CDB,0x9CDC,0x9CDD,0x9CDE, +0x9CDF,0x9CE0,0x9CE1,0x9CE2,0x9CE3,0x9CE4,0x9CE5,0x9CE6, +0x9CE7,0x9CE8,0x9CE9,0x9CEA,0xBEAD,0x9CEB,0x9CEC,0x9CED, +0x9CEE,0x9CEF,0x9CF0,0x9CF1,0xBEAE,0x9CF2,0x9CF3,0x9CF4, +0x9CF5,0x9CF6,0x9CF7,0x9CF8,0x9CF9,0x9CFA,0x9CFB,0x9CFC, +0x9CFD,0x9CFE,0x9D41,0x9D42,0x9D43,0x9D44,0x9D45,0x9D46, +0x9D47,0x9D48,0x9D49,0x9D4A,0x9D4B,0x9D4C,0x9D4D,0x9D4E, +0xBEAF,0x9D4F,0x9D50,0x9D51,0xBEB0,0x9D52,0x9D53,0x9D54, +0x9D55,0x9D56,0x9D57,0x9D58,0x9D59,0x9D5A,0x9D61,0x9D62, +0x9D63,0x9D64,0x9D65,0x9D66,0x9D67,0x9D68,0x9D69,0x9D6A, +0x9D6B,0x9D6C,0x9D6D,0x9D6E,0x9D6F,0x9D70,0x9D71,0x9D72, +0x9D73,0x9D74,0x9D75,0x9D76,0x9D77,0x9D78,0x9D79,0x9D7A, +0x9D81,0x9D82,0x9D83,0x9D84,0x9D85,0x9D86,0x9D87,0x9D88, +0x9D89,0xBEB1,0x9D8A,0x9D8B,0x9D8C,0x9D8D,0x9D8E,0x9D8F, +0xBEB2,0xBEB3,0x9D90,0x9D91,0xBEB4,0x9D92,0x9D93,0x9D94, +0xBEB5,0x9D95,0xBEB6,0x9D96,0x9D97,0x9D98,0x9D99,0xBEB7, +0xBEB8,0xBEB9,0x9D9A,0x9D9B,0x9D9C,0x9D9D,0x9D9E,0x9D9F, +0x9DA0,0x9DA1,0x9DA2,0x9DA3,0xBEBA,0x9DA4,0x9DA5,0x9DA6, +0xBEBB,0x9DA7,0x9DA8,0x9DA9,0xBEBC,0x9DAA,0x9DAB,0x9DAC, +0x9DAD,0x9DAE,0x9DAF,0x9DB0,0xBEBD,0x9DB1,0x9DB2,0x9DB3, +0x9DB4,0x9DB5,0x9DB6,0x9DB7,0x9DB8,0x9DB9,0x9DBA,0x9DBB, +0xBEBE,0xBEBF,0x9DBC,0x9DBD,0xBEC0,0x9DBE,0x9DBF,0x9DC0, +0xBEC1,0x9DC1,0x9DC2,0x9DC3,0x9DC4,0x9DC5,0x9DC6,0x9DC7, +0xBEC2,0xBEC3,0x9DC8,0xBEC4,0x9DC9,0xBEC5,0x9DCA,0x9DCB, +0x9DCC,0x9DCD,0x9DCE,0x9DCF,0xBEC6,0xBEC7,0x9DD0,0x9DD1, +0xBEC8,0xBEC9,0xBECA,0x9DD2,0xBECB,0xBECC,0xBECD,0x9DD3, +0x9DD4,0x9DD5,0x9DD6,0xBECE,0xBECF,0xBED0,0x9DD7,0xBED1, +0xBED2,0xBED3,0x9DD8,0x9DD9,0x9DDA,0xBED4,0xBED5,0x9DDB, +0xBED6,0xBED7,0x9DDC,0x9DDD,0xBED8,0x9DDE,0x9DDF,0x9DE0, +0xBED9,0x9DE1,0x9DE2,0x9DE3,0x9DE4,0x9DE5,0x9DE6,0x9DE7, +0xBEDA,0xBEDB,0x9DE8,0xBEDC,0xBEDD,0xBEDE,0x9DE9,0x9DEA, +0x9DEB,0x9DEC,0x9DED,0x9DEE,0xBEDF,0xBEE0,0x9DEF,0x9DF0, +0xBEE1,0x9DF1,0x9DF2,0x9DF3,0xBEE2,0x9DF4,0x9DF5,0xBEE3, +0x9DF6,0x9DF7,0x9DF8,0x9DF9,0xBEE4,0xBEE5,0x9DFA,0xBEE6, +0x9DFB,0xBEE7,0x9DFC,0x9DFD,0x9DFE,0xBEE8,0x9E41,0xBEE9, +0xBEEA,0x9E42,0x9E43,0x9E44,0xBEEB,0x9E45,0x9E46,0x9E47, +0xBEEC,0x9E48,0x9E49,0x9E4A,0x9E4B,0x9E4C,0x9E4D,0x9E4E, +0x9E4F,0xBEED,0x9E50,0x9E51,0x9E52,0x9E53,0x9E54,0x9E55, +0x9E56,0x9E57,0x9E58,0x9E59,0xBEEE,0xBEEF,0x9E5A,0x9E61, +0xBEF0,0xBEF1,0x9E62,0xBEF2,0xBEF3,0xBEF4,0xBEF5,0x9E63, +0x9E64,0x9E65,0x9E66,0x9E67,0xBEF6,0xBEF7,0xBEF8,0xBEF9, +0xBEFA,0xBEFB,0xBEFC,0x9E68,0xBEFD,0x9E69,0xBEFE,0x9E6A, +0xBFA1,0xBFA2,0x9E6B,0x9E6C,0xBFA3,0x9E6D,0x9E6E,0x9E6F, +0xBFA4,0x9E70,0x9E71,0x9E72,0x9E73,0x9E74,0x9E75,0x9E76, +0xBFA5,0xBFA6,0x9E77,0xBFA7,0x9E78,0xBFA8,0x9E79,0x9E7A, +0x9E81,0x9E82,0x9E83,0x9E84,0xBFA9,0xBFAA,0xBFAB,0x9E85, +0xBFAC,0x9E86,0x9E87,0x9E88,0xBFAD,0x9E89,0xBFAE,0xBFAF, +0x9E8A,0x9E8B,0x9E8C,0x9E8D,0xBFB0,0xBFB1,0xBFB2,0xBFB3, +0xBFB4,0xBFB5,0x9E8E,0x9E8F,0x9E90,0xBFB6,0xBFB7,0xBFB8, +0xBFB9,0x9E91,0x9E92,0x9E93,0xBFBA,0x9E94,0x9E95,0x9E96, +0xBFBB,0x9E97,0x9E98,0x9E99,0x9E9A,0x9E9B,0x9E9C,0x9E9D, +0xBFBC,0xBFBD,0x9E9E,0xBFBE,0xBFBF,0x9E9F,0x9EA0,0x9EA1, +0x9EA2,0x9EA3,0x9EA4,0x9EA5,0xBFC0,0xBFC1,0x9EA6,0x9EA7, +0xBFC2,0x9EA8,0x9EA9,0x9EAA,0xBFC3,0xBFC4,0xBFC5,0x9EAB, +0xBFC6,0x9EAC,0x9EAD,0xBFC7,0xBFC8,0xBFC9,0x9EAE,0xBFCA, +0x9EAF,0xBFCB,0x9EB0,0xBFCC,0x9EB1,0x9EB2,0x9EB3,0x9EB4, +0xBFCD,0xBFCE,0x9EB5,0x9EB6,0xBFCF,0x9EB7,0x9EB8,0x9EB9, +0xBFD0,0x9EBA,0x9EBB,0x9EBC,0x9EBD,0x9EBE,0x9EBF,0x9EC0, +0xBFD1,0xBFD2,0x9EC1,0xBFD3,0xBFD4,0xBFD5,0x9EC2,0x9EC3, +0x9EC4,0x9EC5,0x9EC6,0x9EC7,0xBFD6,0xBFD7,0x9EC8,0x9EC9, +0xBFD8,0x9ECA,0x9ECB,0x9ECC,0x9ECD,0x9ECE,0x9ECF,0x9ED0, +0x9ED1,0x9ED2,0x9ED3,0x9ED4,0xBFD9,0x9ED5,0x9ED6,0xBFDA, +0x9ED7,0xBFDB,0x9ED8,0x9ED9,0x9EDA,0x9EDB,0x9EDC,0x9EDD, +0xBFDC,0xBFDD,0x9EDE,0x9EDF,0xBFDE,0x9EE0,0x9EE1,0x9EE2, +0xBFDF,0x9EE3,0x9EE4,0x9EE5,0x9EE6,0x9EE7,0x9EE8,0x9EE9, +0xBFE0,0xBFE1,0x9EEA,0xBFE2,0x9EEB,0xBFE3,0x9EEC,0x9EED, +0x9EEE,0x9EEF,0x9EF0,0x9EF1,0xBFE4,0xBFE5,0x9EF2,0x9EF3, +0xBFE6,0x9EF4,0x9EF5,0x9EF6,0xBFE7,0x9EF7,0x9EF8,0x9EF9, +0x9EFA,0x9EFB,0x9EFC,0x9EFD,0xBFE8,0xBFE9,0x9EFE,0xBFEA, +0x9F41,0xBFEB,0x9F42,0x9F43,0x9F44,0x9F45,0x9F46,0x9F47, +0xBFEC,0xBFED,0x9F48,0x9F49,0xBFEE,0x9F4A,0x9F4B,0x9F4C, +0xBFEF,0xBFF0,0xBFF1,0x9F4D,0x9F4E,0x9F4F,0x9F50,0x9F51, +0xBFF2,0xBFF3,0x9F52,0xBFF4,0x9F53,0xBFF5,0x9F54,0x9F55, +0x9F56,0x9F57,0x9F58,0x9F59,0xBFF6,0xBFF7,0x9F5A,0x9F61, +0xBFF8,0x9F62,0x9F63,0x9F64,0xBFF9,0x9F65,0x9F66,0x9F67, +0x9F68,0x9F69,0x9F6A,0x9F6B,0xBFFA,0xBFFB,0x9F6C,0x9F6D, +0xBFFC,0xBFFD,0x9F6E,0x9F6F,0x9F70,0x9F71,0x9F72,0x9F73, +0xBFFE,0xC0A1,0x9F74,0x9F75,0xC0A2,0x9F76,0x9F77,0x9F78, +0xC0A3,0x9F79,0x9F7A,0x9F81,0x9F82,0x9F83,0x9F84,0x9F85, +0xC0A4,0xC0A5,0x9F86,0x9F87,0x9F88,0xC0A6,0x9F89,0x9F8A, +0x9F8B,0x9F8C,0x9F8D,0x9F8E,0xC0A7,0xC0A8,0x9F8F,0x9F90, +0xC0A9,0x9F91,0x9F92,0x9F93,0xC0AA,0x9F94,0x9F95,0x9F96, +0x9F97,0x9F98,0x9F99,0x9F9A,0xC0AB,0xC0AC,0x9F9B,0xC0AD, +0x9F9C,0xC0AE,0x9F9D,0x9F9E,0x9F9F,0x9FA0,0x9FA1,0x9FA2, +0xC0AF,0xC0B0,0x9FA3,0x9FA4,0xC0B1,0x9FA5,0x9FA6,0x9FA7, +0xC0B2,0x9FA8,0x9FA9,0x9FAA,0x9FAB,0x9FAC,0x9FAD,0x9FAE, +0xC0B3,0xC0B4,0x9FAF,0xC0B5,0x9FB0,0xC0B6,0x9FB1,0xC0B7, +0x9FB2,0x9FB3,0x9FB4,0x9FB5,0xC0B8,0xC0B9,0x9FB6,0x9FB7, +0xC0BA,0x9FB8,0x9FB9,0x9FBA,0xC0BB,0x9FBB,0x9FBC,0x9FBD, +0x9FBE,0x9FBF,0xC0BC,0x9FC0,0xC0BD,0xC0BE,0x9FC1,0xC0BF, +0x9FC2,0xC0C0,0xC0C1,0xC0C2,0xC0C3,0xC0C4,0xC0C5,0xC0C6, +0xC0C7,0x9FC3,0x9FC4,0x9FC5,0xC0C8,0x9FC6,0x9FC7,0x9FC8, +0xC0C9,0x9FC9,0x9FCA,0x9FCB,0x9FCC,0x9FCD,0x9FCE,0x9FCF, +0xC0CA,0x9FD0,0x9FD1,0xC0CB,0x9FD2,0x9FD3,0x9FD4,0x9FD5, +0x9FD6,0x9FD7,0x9FD8,0x9FD9,0xC0CC,0xC0CD,0x9FDA,0x9FDB, +0xC0CE,0x9FDC,0x9FDD,0x9FDE,0xC0CF,0xC0D0,0xC0D1,0x9FDF, +0x9FE0,0x9FE1,0x9FE2,0xC0D2,0xC0D3,0xC0D4,0x9FE3,0xC0D5, +0xC0D6,0xC0D7,0xC0D8,0x9FE4,0x9FE5,0x9FE6,0xC0D9,0x9FE7, +0xC0DA,0xC0DB,0x9FE8,0x9FE9,0xC0DC,0x9FEA,0xC0DD,0xC0DE, +0xC0DF,0x9FEB,0xC0E0,0x9FEC,0x9FED,0x9FEE,0x9FEF,0x9FF0, +0xC0E1,0xC0E2,0x9FF1,0xC0E3,0xC0E4,0xC0E5,0xC0E6,0x9FF2, +0x9FF3,0x9FF4,0x9FF5,0x9FF6,0xC0E7,0xC0E8,0x9FF7,0x9FF8, +0xC0E9,0x9FF9,0x9FFA,0x9FFB,0xC0EA,0x9FFC,0x9FFD,0x9FFE, +0xA041,0xA042,0xA043,0xA044,0xC0EB,0xC0EC,0xA045,0xC0ED, +0xC0EE,0xC0EF,0xA046,0xA047,0xA048,0xA049,0xA04A,0xA04B, +0xC0F0,0xC0F1,0xA04C,0xA04D,0xC0F2,0xA04E,0xC0F3,0xA04F, +0xC0F4,0xA050,0xA051,0xA052,0xA053,0xA054,0xA055,0xA056, +0xC0F5,0xA057,0xA058,0xA059,0xA05A,0xC0F6,0xA061,0xA062, +0xA063,0xA064,0xA065,0xA066,0xC0F7,0xA067,0xA068,0xA069, +0xC0F8,0xA06A,0xA06B,0xA06C,0xC0F9,0xA06D,0xA06E,0xA06F, +0xA070,0xA071,0xA072,0xA073,0xA074,0xA075,0xA076,0xA077, +0xA078,0xA079,0xA07A,0xA081,0xA082,0xA083,0xA084,0xA085, +0xC0FA,0xC0FB,0xA086,0xA087,0xC0FC,0xA088,0xA089,0xA08A, +0xC0FD,0xA08B,0xC0FE,0xA08C,0xA08D,0xA08E,0xA08F,0xA090, +0xC1A1,0xC1A2,0xA091,0xC1A3,0xA092,0xC1A4,0xC1A5,0xA093, +0xA094,0xA095,0xA096,0xA097,0xC1A6,0xC1A7,0xA098,0xA099, +0xC1A8,0xA09A,0xA09B,0xA09C,0xC1A9,0xA09D,0xA09E,0xA09F, +0xA0A0,0xA0A1,0xA0A2,0xA0A3,0xC1AA,0xC1AB,0xA0A4,0xC1AC, +0xA0A5,0xC1AD,0xA0A6,0xA0A7,0xA0A8,0xA0A9,0xA0AA,0xA0AB, +0xC1AE,0xA0AC,0xA0AD,0xA0AE,0xC1AF,0xA0AF,0xA0B0,0xA0B1, +0xC1B0,0xA0B2,0xA0B3,0xA0B4,0xA0B5,0xA0B6,0xA0B7,0xA0B8, +0xC1B1,0xC1B2,0xA0B9,0xA0BA,0xC1B3,0xC1B4,0xA0BB,0xA0BC, +0xA0BD,0xA0BE,0xA0BF,0xA0C0,0xC1B5,0xA0C1,0xA0C2,0xA0C3, +0xA0C4,0xA0C5,0xA0C6,0xA0C7,0xA0C8,0xA0C9,0xA0CA,0xA0CB, +0xA0CC,0xA0CD,0xA0CE,0xA0CF,0xA0D0,0xA0D1,0xA0D2,0xA0D3, +0xA0D4,0xA0D5,0xA0D6,0xA0D7,0xA0D8,0xA0D9,0xA0DA,0xA0DB, +0xC1B6,0xC1B7,0xA0DC,0xA0DD,0xC1B8,0xA0DE,0xA0DF,0xA0E0, +0xC1B9,0xA0E1,0xC1BA,0xA0E2,0xA0E3,0xA0E4,0xA0E5,0xA0E6, +0xC1BB,0xC1BC,0xA0E7,0xC1BD,0xA0E8,0xC1BE,0xC1BF,0xC1C0, +0xA0E9,0xA0EA,0xA0EB,0xC1C1,0xC1C2,0xC1C3,0xA0EC,0xA0ED, +0xA0EE,0xA0EF,0xA0F0,0xA0F1,0xC1C4,0xA0F2,0xA0F3,0xA0F4, +0xA0F5,0xA0F6,0xA0F7,0xA0F8,0xA0F9,0xC1C5,0xA0FA,0xC1C6, +0xA0FB,0xC1C7,0xA0FC,0xA0FD,0xA0FE,0xA141,0xA142,0xA143, +0xC1C8,0xA144,0xA145,0xA146,0xA147,0xA148,0xA149,0xA14A, +0xA14B,0xA14C,0xA14D,0xA14E,0xA14F,0xA150,0xA151,0xA152, +0xA153,0xA154,0xA155,0xA156,0xC1C9,0xC1CA,0xA157,0xA158, +0xA159,0xA15A,0xA161,0xA162,0xC1CB,0xA163,0xA164,0xA165, +0xC1CC,0xA166,0xA167,0xA168,0xC1CD,0xA169,0xA16A,0xA16B, +0xA16C,0xA16D,0xA16E,0xA16F,0xC1CE,0xC1CF,0xA170,0xC1D0, +0xA171,0xC1D1,0xA172,0xA173,0xA174,0xA175,0xA176,0xA177, +0xC1D2,0xC1D3,0xA178,0xA179,0xC1D4,0xA17A,0xA181,0xA182, +0xA183,0xA184,0xA185,0xA186,0xA187,0xA188,0xA189,0xA18A, +0xA18B,0xA18C,0xA18D,0xA18E,0xA18F,0xC1D5,0xA190,0xA191, +0xA192,0xA193,0xA194,0xA195,0xC1D6,0xC1D7,0xA196,0xA197, +0xC1D8,0xA198,0xA199,0xA19A,0xC1D9,0xC1DA,0xC1DB,0xA19B, +0xA19C,0xA19D,0xA19E,0xA19F,0xC1DC,0xC1DD,0xA1A0,0xC1DE, +0xA241,0xC1DF,0xA242,0xA243,0xA244,0xA245,0xA246,0xA247, +0xC1E0,0xA248,0xA249,0xA24A,0xA24B,0xA24C,0xA24D,0xA24E, +0xA24F,0xA250,0xA251,0xA252,0xA253,0xA254,0xA255,0xA256, +0xA257,0xA258,0xA259,0xA25A,0xC1E1,0xA261,0xA262,0xA263, +0xA264,0xA265,0xA266,0xA267,0xC1E2,0xA268,0xA269,0xA26A, +0xA26B,0xA26C,0xA26D,0xA26E,0xA26F,0xA270,0xA271,0xA272, +0xA273,0xA274,0xA275,0xA276,0xA277,0xA278,0xA279,0xA27A, +0xA281,0xA282,0xA283,0xA284,0xA285,0xA286,0xA287,0xA288, +0xC1E3,0xC1E4,0xA289,0xA28A,0xC1E5,0xA28B,0xA28C,0xA28D, +0xC1E6,0xA28E,0xA28F,0xA290,0xA291,0xA292,0xA293,0xA294, +0xC1E7,0xC1E8,0xA295,0xC1E9,0xA296,0xA297,0xA298,0xA299, +0xA29A,0xA29B,0xA29C,0xA29D,0xC1EA,0xA29E,0xA29F,0xA2A0, +0xC1EB,0xA341,0xA342,0xA343,0xC1EC,0xA344,0xA345,0xA346, +0xA347,0xA348,0xA349,0xA34A,0xC1ED,0xA34B,0xA34C,0xA34D, +0xA34E,0xA34F,0xA350,0xA351,0xA352,0xA353,0xA354,0xA355, +0xC1EE,0xC1EF,0xA356,0xA357,0xC1F0,0xA358,0xA359,0xA35A, +0xC1F1,0xA361,0xA362,0xA363,0xA364,0xA365,0xA366,0xA367, +0xC1F2,0xC1F3,0xA368,0xC1F4,0xA369,0xC1F5,0xA36A,0xA36B, +0xA36C,0xA36D,0xA36E,0xA36F,0xA370,0xA371,0xA372,0xA373, +0xA374,0xA375,0xA376,0xA377,0xA378,0xA379,0xA37A,0xA381, +0xA382,0xA383,0xA384,0xA385,0xA386,0xA387,0xA388,0xA389, +0xA38A,0xA38B,0xA38C,0xA38D,0xA38E,0xA38F,0xA390,0xA391, +0xC1F6,0xC1F7,0xA392,0xA393,0xC1F8,0xA394,0xA395,0xC1F9, +0xC1FA,0xA396,0xC1FB,0xA397,0xA398,0xA399,0xA39A,0xA39B, +0xC1FC,0xC1FD,0xA39C,0xC1FE,0xA39D,0xC2A1,0xC2A2,0xA39E, +0xA39F,0xC2A3,0xC2A4,0xA3A0,0xC2A5,0xC2A6,0xA441,0xA442, +0xC2A7,0xA443,0xC2A8,0xA444,0xC2A9,0xA445,0xA446,0xC2AA, +0xA447,0xA448,0xA449,0xA44A,0xC2AB,0xC2AC,0xA44B,0xC2AD, +0xC2AE,0xC2AF,0xA44C,0xA44D,0xA44E,0xA44F,0xA450,0xA451, +0xC2B0,0xC2B1,0xA452,0xA453,0xC2B2,0xA454,0xA455,0xA456, +0xC2B3,0xA457,0xA458,0xA459,0xA45A,0xA461,0xA462,0xA463, +0xC2B4,0xC2B5,0xA464,0xC2B6,0xC2B7,0xC2B8,0xA465,0xA466, +0xA467,0xA468,0xA469,0xA46A,0xC2B9,0xA46B,0xA46C,0xA46D, +0xC2BA,0xA46E,0xA46F,0xA470,0xA471,0xA472,0xA473,0xA474, +0xA475,0xA476,0xA477,0xA478,0xA479,0xA47A,0xA481,0xA482, +0xA483,0xC2BB,0xA484,0xA485,0xA486,0xA487,0xA488,0xA489, +0xA48A,0xA48B,0xA48C,0xA48D,0xA48E,0xA48F,0xA490,0xA491, +0xA492,0xA493,0xA494,0xA495,0xA496,0xA497,0xA498,0xA499, +0xA49A,0xA49B,0xA49C,0xA49D,0xA49E,0xA49F,0xA4A0,0xA541, +0xA542,0xA543,0xA544,0xA545,0xC2BC,0xC2BD,0xA546,0xA547, +0xC2BE,0xA548,0xA549,0xA54A,0xC2BF,0xA54B,0xA54C,0xA54D, +0xA54E,0xA54F,0xA550,0xA551,0xC2C0,0xC2C1,0xA552,0xC2C2, +0xC2C3,0xC2C4,0xA553,0xA554,0xA555,0xA556,0xA557,0xA558, +0xC2C5,0xA559,0xA55A,0xA561,0xA562,0xA563,0xA564,0xA565, +0xA566,0xA567,0xA568,0xA569,0xA56A,0xA56B,0xA56C,0xA56D, +0xA56E,0xA56F,0xA570,0xA571,0xA572,0xC2C6,0xA573,0xA574, +0xA575,0xA576,0xA577,0xA578,0xC2C7,0xA579,0xA57A,0xA581, +0xA582,0xA583,0xA584,0xA585,0xA586,0xA587,0xA588,0xA589, +0xA58A,0xA58B,0xA58C,0xA58D,0xA58E,0xA58F,0xA590,0xA591, +0xC2C8,0xA592,0xA593,0xA594,0xA595,0xA596,0xA597,0xA598, +0xA599,0xA59A,0xA59B,0xA59C,0xA59D,0xA59E,0xA59F,0xA5A0, +0xA641,0xA642,0xA643,0xA644,0xA645,0xA646,0xA647,0xA648, +0xA649,0xA64A,0xA64B,0xA64C,0xA64D,0xA64E,0xA64F,0xA650, +0xA651,0xA652,0xA653,0xA654,0xC2C9,0xC2CA,0xA655,0xA656, +0xC2CB,0xA657,0xA658,0xA659,0xC2CC,0xA65A,0xA661,0xA662, +0xA663,0xA664,0xA665,0xA666,0xC2CD,0xC2CE,0xA667,0xC2CF, +0xA668,0xC2D0,0xA669,0xC2D1,0xA66A,0xA66B,0xA66C,0xA66D, +0xC2D2,0xC2D3,0xA66E,0xA66F,0xA670,0xA671,0xA672,0xA673, +0xC2D4,0xA674,0xA675,0xA676,0xA677,0xA678,0xA679,0xA67A, +0xA681,0xA682,0xA683,0xA684,0xC2D5,0xA685,0xA686,0xA687, +0xA688,0xA689,0xA68A,0xA68B,0xC2D6,0xA68C,0xA68D,0xA68E, +0xA68F,0xA690,0xA691,0xA692,0xA693,0xA694,0xA695,0xA696, +0xA697,0xA698,0xA699,0xA69A,0xA69B,0xA69C,0xA69D,0xA69E, +0xC2D7,0xA69F,0xA6A0,0xA741,0xA742,0xA743,0xA744,0xA745, +0xC2D8,0xA746,0xA747,0xA748,0xC2D9,0xA749,0xA74A,0xA74B, +0xC2DA,0xA74C,0xA74D,0xA74E,0xA74F,0xA750,0xA751,0xA752, +0xC2DB,0xC2DC,0xA753,0xA754,0xA755,0xA756,0xA757,0xA758, +0xA759,0xA75A,0xA761,0xA762,0xA763,0xA764,0xA765,0xA766, +0xA767,0xA768,0xA769,0xA76A,0xA76B,0xA76C,0xA76D,0xA76E, +0xA76F,0xA770,0xA771,0xA772,0xA773,0xA774,0xA775,0xA776, +0xA777,0xC2DD,0xA778,0xA779,0xA77A,0xA781,0xA782,0xA783, +0xC2DE,0xC2DF,0xA784,0xA785,0xC2E0,0xA786,0xA787,0xA788, +0xC2E1,0xA789,0xA78A,0xA78B,0xA78C,0xA78D,0xA78E,0xA78F, +0xC2E2,0xC2E3,0xA790,0xA791,0xA792,0xC2E4,0xA793,0xA794, +0xA795,0xA796,0xA797,0xA798,0xC2E5,0xA799,0xA79A,0xA79B, +0xA79C,0xA79D,0xA79E,0xA79F,0xA7A0,0xA841,0xA842,0xA843, +0xA844,0xA845,0xA846,0xA847,0xA848,0xA849,0xA84A,0xA84B, +0xC2E6,0xC2E7,0xA84C,0xA84D,0xA84E,0xA84F,0xA850,0xA851, +0xA852,0xA853,0xA854,0xA855,0xA856,0xA857,0xA858,0xA859, +0xA85A,0xA861,0xA862,0xA863,0xA864,0xA865,0xA866,0xA867, +0xA868,0xA869,0xA86A,0xA86B,0xA86C,0xA86D,0xA86E,0xA86F, +0xA870,0xA871,0xA872,0xA873,0xC2E8,0xA874,0xA875,0xA876, +0xA877,0xA878,0xA879,0xA87A,0xA881,0xA882,0xA883,0xA884, +0xA885,0xA886,0xA887,0xA888,0xA889,0xA88A,0xA88B,0xA88C, +0xA88D,0xA88E,0xA88F,0xA890,0xA891,0xA892,0xA893,0xA894, +0xC2E9,0xA895,0xA896,0xA897,0xA898,0xA899,0xA89A,0xA89B, +0xA89C,0xA89D,0xA89E,0xA89F,0xA8A0,0xA941,0xA942,0xA943, +0xA944,0xA945,0xA946,0xA947,0xA948,0xA949,0xA94A,0xA94B, +0xA94C,0xA94D,0xA94E,0xA94F,0xC2EA,0xA950,0xA951,0xA952, +0xA953,0xA954,0xA955,0xA956,0xA957,0xA958,0xA959,0xA95A, +0xA961,0xA962,0xA963,0xA964,0xC2EB,0xA965,0xA966,0xC2EC, +0xA967,0xC2ED,0xA968,0xA969,0xA96A,0xA96B,0xA96C,0xA96D, +0xA96E,0xA96F,0xA970,0xA971,0xA972,0xA973,0xA974,0xA975, +0xA976,0xA977,0xA978,0xA979,0xA97A,0xA981,0xA982,0xA983, +0xA984,0xA985,0xA986,0xA987,0xA988,0xA989,0xA98A,0xA98B, +0xA98C,0xA98D,0xA98E,0xA98F,0xC2EE,0xC2EF,0xA990,0xA991, +0xC2F0,0xA992,0xA993,0xA994,0xC2F1,0xA995,0xA996,0xA997, +0xA998,0xA999,0xA99A,0xA99B,0xC2F2,0xC2F3,0xA99C,0xA99D, +0xA99E,0xC2F4,0xC2F5,0xA99F,0xA9A0,0xAA41,0xAA42,0xC2F6, +0xC2F7,0xC2F8,0xAA43,0xAA44,0xC2F9,0xAA45,0xC2FA,0xAA46, +0xC2FB,0xAA47,0xAA48,0xAA49,0xAA4A,0xAA4B,0xAA4C,0xAA4D, +0xC2FC,0xC2FD,0xAA4E,0xC2FE,0xC3A1,0xC3A2,0xC3A3,0xAA4F, +0xAA50,0xAA51,0xAA52,0xAA53,0xC3A4,0xC3A5,0xAA54,0xAA55, +0xC3A6,0xAA56,0xAA57,0xAA58,0xC3A7,0xAA59,0xAA5A,0xAA61, +0xAA62,0xAA63,0xAA64,0xAA65,0xC3A8,0xC3A9,0xAA66,0xC3AA, +0xC3AB,0xC3AC,0xAA67,0xAA68,0xAA69,0xAA6A,0xAA6B,0xAA6C, +0xC3AD,0xAA6D,0xAA6E,0xAA6F,0xC3AE,0xAA70,0xC3AF,0xAA71, +0xC3B0,0xAA72,0xAA73,0xAA74,0xAA75,0xAA76,0xAA77,0xAA78, +0xC3B1,0xAA79,0xAA7A,0xAA81,0xAA82,0xC3B2,0xAA83,0xAA84, +0xAA85,0xAA86,0xAA87,0xAA88,0xAA89,0xAA8A,0xAA8B,0xAA8C, +0xAA8D,0xAA8E,0xAA8F,0xAA90,0xAA91,0xAA92,0xAA93,0xAA94, +0xAA95,0xAA96,0xAA97,0xAA98,0xAA99,0xAA9A,0xAA9B,0xAA9C, +0xAA9D,0xAA9E,0xAA9F,0xAAA0,0xAB41,0xAB42,0xAB43,0xAB44, +0xC3B3,0xC3B4,0xAB45,0xAB46,0xC3B5,0xAB47,0xAB48,0xAB49, +0xC3B6,0xAB4A,0xAB4B,0xAB4C,0xAB4D,0xAB4E,0xAB4F,0xAB50, +0xC3B7,0xC3B8,0xAB51,0xC3B9,0xC3BA,0xC3BB,0xAB52,0xAB53, +0xAB54,0xAB55,0xAB56,0xAB57,0xC3BC,0xC3BD,0xAB58,0xAB59, +0xC3BE,0xAB5A,0xAB61,0xAB62,0xC3BF,0xAB63,0xAB64,0xAB65, +0xAB66,0xAB67,0xAB68,0xAB69,0xC3C0,0xC3C1,0xAB6A,0xC3C2, +0xAB6B,0xC3C3,0xAB6C,0xAB6D,0xAB6E,0xAB6F,0xAB70,0xAB71, +0xC3C4,0xAB72,0xAB73,0xAB74,0xC3C5,0xAB75,0xAB76,0xAB77, +0xAB78,0xAB79,0xAB7A,0xAB81,0xAB82,0xAB83,0xAB84,0xAB85, +0xAB86,0xAB87,0xAB88,0xAB89,0xC3C6,0xAB8A,0xAB8B,0xAB8C, +0xAB8D,0xAB8E,0xAB8F,0xAB90,0xC3C7,0xAB91,0xAB92,0xAB93, +0xC3C8,0xAB94,0xAB95,0xAB96,0xAB97,0xAB98,0xAB99,0xAB9A, +0xAB9B,0xAB9C,0xAB9D,0xAB9E,0xAB9F,0xABA0,0xAC41,0xAC42, +0xAC43,0xC3C9,0xAC44,0xAC45,0xAC46,0xAC47,0xAC48,0xAC49, +0xC3CA,0xC3CB,0xAC4A,0xAC4B,0xC3CC,0xAC4C,0xAC4D,0xAC4E, +0xC3CD,0xAC4F,0xAC50,0xAC51,0xAC52,0xAC53,0xAC54,0xAC55, +0xC3CE,0xC3CF,0xAC56,0xC3D0,0xAC57,0xC3D1,0xAC58,0xAC59, +0xAC5A,0xAC61,0xAC62,0xAC63,0xC3D2,0xAC64,0xAC65,0xAC66, +0xC3D3,0xAC67,0xAC68,0xAC69,0xC3D4,0xAC6A,0xAC6B,0xAC6C, +0xAC6D,0xAC6E,0xAC6F,0xAC70,0xAC71,0xAC72,0xAC73,0xAC74, +0xAC75,0xC3D5,0xAC76,0xAC77,0xAC78,0xAC79,0xAC7A,0xAC81, +0xAC82,0xAC83,0xAC84,0xAC85,0xAC86,0xAC87,0xAC88,0xAC89, +0xAC8A,0xAC8B,0xAC8C,0xAC8D,0xAC8E,0xAC8F,0xAC90,0xAC91, +0xAC92,0xAC93,0xAC94,0xAC95,0xAC96,0xAC97,0xAC98,0xAC99, +0xAC9A,0xAC9B,0xAC9C,0xAC9D,0xC3D6,0xAC9E,0xAC9F,0xACA0, +0xC3D7,0xAD41,0xAD42,0xAD43,0xC3D8,0xAD44,0xAD45,0xAD46, +0xAD47,0xAD48,0xAD49,0xAD4A,0xC3D9,0xC3DA,0xAD4B,0xC3DB, +0xAD4C,0xC3DC,0xAD4D,0xAD4E,0xAD4F,0xAD50,0xAD51,0xAD52, +0xC3DD,0xAD53,0xAD54,0xAD55,0xAD56,0xAD57,0xAD58,0xAD59, +0xAD5A,0xAD61,0xAD62,0xAD63,0xAD64,0xAD65,0xAD66,0xAD67, +0xC3DE,0xAD68,0xAD69,0xAD6A,0xAD6B,0xAD6C,0xAD6D,0xAD6E, +0xAD6F,0xAD70,0xAD71,0xAD72,0xC3DF,0xC3E0,0xAD73,0xAD74, +0xC3E1,0xAD75,0xAD76,0xAD77,0xC3E2,0xAD78,0xAD79,0xAD7A, +0xAD81,0xAD82,0xAD83,0xAD84,0xC3E3,0xC3E4,0xAD85,0xC3E5, +0xAD86,0xC3E6,0xAD87,0xAD88,0xAD89,0xAD8A,0xAD8B,0xAD8C, +0xC3E7,0xAD8D,0xAD8E,0xAD8F,0xAD90,0xAD91,0xAD92,0xAD93, +0xAD94,0xAD95,0xAD96,0xAD97,0xAD98,0xAD99,0xAD9A,0xAD9B, +0xAD9C,0xAD9D,0xAD9E,0xAD9F,0xC3E8,0xADA0,0xAE41,0xAE42, +0xAE43,0xAE44,0xAE45,0xAE46,0xC3E9,0xAE47,0xAE48,0xAE49, +0xC3EA,0xAE4A,0xAE4B,0xAE4C,0xAE4D,0xAE4E,0xAE4F,0xAE50, +0xAE51,0xAE52,0xAE53,0xAE54,0xAE55,0xAE56,0xAE57,0xAE58, +0xAE59,0xAE5A,0xAE61,0xAE62,0xAE63,0xAE64,0xAE65,0xAE66, +0xC3EB,0xAE67,0xAE68,0xAE69,0xC3EC,0xAE6A,0xAE6B,0xAE6C, +0xC3ED,0xAE6D,0xAE6E,0xAE6F,0xAE70,0xAE71,0xAE72,0xAE73, +0xC3EE,0xC3EF,0xAE74,0xC3F0,0xAE75,0xC3F1,0xAE76,0xAE77, +0xAE78,0xAE79,0xAE7A,0xAE81,0xC3F2,0xAE82,0xAE83,0xAE84, +0xC3F3,0xAE85,0xAE86,0xAE87,0xC3F4,0xAE88,0xAE89,0xAE8A, +0xAE8B,0xAE8C,0xAE8D,0xAE8E,0xC3F5,0xAE8F,0xAE90,0xAE91, +0xAE92,0xC3F6,0xAE93,0xAE94,0xAE95,0xAE96,0xAE97,0xAE98, +0xC3F7,0xC3F8,0xAE99,0xAE9A,0xC3F9,0xAE9B,0xAE9C,0xAE9D, +0xC3FA,0xAE9E,0xAE9F,0xAEA0,0xAF41,0xAF42,0xAF43,0xAF44, +0xC3FB,0xC3FC,0xAF45,0xC3FD,0xAF46,0xC3FE,0xAF47,0xAF48, +0xAF49,0xAF4A,0xAF4B,0xAF4C,0xAF4D,0xAF4E,0xAF4F,0xAF50, +0xAF51,0xAF52,0xAF53,0xAF54,0xAF55,0xAF56,0xAF57,0xAF58, +0xAF59,0xAF5A,0xAF61,0xAF62,0xAF63,0xAF64,0xAF65,0xAF66, +0xAF67,0xAF68,0xAF69,0xAF6A,0xAF6B,0xAF6C,0xAF6D,0xAF6E, +0xC4A1,0xC4A2,0xAF6F,0xAF70,0xC4A3,0xAF71,0xAF72,0xC4A4, +0xC4A5,0xC4A6,0xAF73,0xAF74,0xAF75,0xAF76,0xAF77,0xAF78, +0xC4A7,0xC4A8,0xAF79,0xC4A9,0xAF7A,0xC4AA,0xAF81,0xAF82, +0xAF83,0xAF84,0xAF85,0xAF86,0xC4AB,0xC4AC,0xAF87,0xAF88, +0xC4AD,0xAF89,0xAF8A,0xAF8B,0xC4AE,0xAF8C,0xAF8D,0xAF8E, +0xAF8F,0xAF90,0xAF91,0xAF92,0xC4AF,0xC4B0,0xAF93,0xC4B1, +0xAF94,0xC4B2,0xAF95,0xAF96,0xAF97,0xAF98,0xAF99,0xAF9A, +0xC4B3,0xC4B4,0xAF9B,0xAF9C,0xC4B5,0xAF9D,0xAF9E,0xAF9F, +0xC4B6,0xAFA0,0xB041,0xB042,0xB043,0xB044,0xB045,0xB046, +0xC4B7,0xC4B8,0xB047,0xC4B9,0xC4BA,0xC4BB,0xB048,0xB049, +0xB04A,0xB04B,0xB04C,0xB04D,0xC4BC,0xC4BD,0xB04E,0xB04F, +0xB050,0xB051,0xB052,0xB053,0xB054,0xB055,0xB056,0xB057, +0xB058,0xB059,0xB05A,0xB061,0xB062,0xB063,0xB064,0xB065, +0xB066,0xC4BE,0xB067,0xB068,0xB069,0xB06A,0xB06B,0xB06C, +0xB06D,0xB06E,0xB06F,0xB070,0xB071,0xB072,0xB073,0xB074, +0xB075,0xB076,0xB077,0xB078,0xB079,0xB07A,0xB081,0xB082, +0xB083,0xB084,0xB085,0xB086,0xB087,0xB088,0xB089,0xB08A, +0xB08B,0xB08C,0xB08D,0xB08E,0xC4BF,0xC4C0,0xB08F,0xB090, +0xC4C1,0xB091,0xB092,0xC4C2,0xC4C3,0xB093,0xB094,0xB095, +0xB096,0xB097,0xB098,0xB099,0xC4C4,0xC4C5,0xB09A,0xC4C6, +0xC4C7,0xC4C8,0xB09B,0xB09C,0xB09D,0xB09E,0xB09F,0xB0A0, +0xC4C9,0xC4CA,0xB141,0xB142,0xC4CB,0xB143,0xB144,0xB145, +0xC4CC,0xB146,0xB147,0xB148,0xB149,0xB14A,0xB14B,0xB14C, +0xC4CD,0xC4CE,0xB14D,0xC4CF,0xB14E,0xC4D0,0xB14F,0xB150, +0xB151,0xB152,0xB153,0xB154,0xC4D1,0xB155,0xB156,0xB157, +0xC4D2,0xB158,0xB159,0xB15A,0xC4D3,0xB161,0xB162,0xB163, +0xB164,0xB165,0xB166,0xB167,0xC4D4,0xC4D5,0xB168,0xC4D6, +0xC4D7,0xC4D8,0xB169,0xB16A,0xB16B,0xB16C,0xB16D,0xB16E, +0xC4D9,0xB16F,0xB170,0xB171,0xB172,0xB173,0xB174,0xB175, +0xB176,0xB177,0xB178,0xB179,0xB17A,0xB181,0xB182,0xB183, +0xB184,0xB185,0xB186,0xB187,0xB188,0xB189,0xB18A,0xB18B, +0xB18C,0xB18D,0xB18E,0xB18F,0xC4DA,0xC4DB,0xB190,0xB191, +0xC4DC,0xB192,0xB193,0xB194,0xC4DD,0xB195,0xB196,0xB197, +0xB198,0xB199,0xB19A,0xB19B,0xC4DE,0xC4DF,0xB19C,0xC4E0, +0xB19D,0xC4E1,0xB19E,0xB19F,0xB1A0,0xB241,0xB242,0xB243, +0xC4E2,0xC4E3,0xB244,0xB245,0xC4E4,0xB246,0xB247,0xB248, +0xC4E5,0xB249,0xB24A,0xB24B,0xB24C,0xB24D,0xB24E,0xB24F, +0xC4E6,0xB250,0xB251,0xB252,0xB253,0xC4E7,0xB254,0xB255, +0xB256,0xB257,0xB258,0xB259,0xC4E8,0xB25A,0xB261,0xB262, +0xB263,0xB264,0xB265,0xB266,0xB267,0xB268,0xB269,0xB26A, +0xB26B,0xB26C,0xB26D,0xB26E,0xB26F,0xB270,0xB271,0xB272, +0xB273,0xC4E9,0xB274,0xB275,0xB276,0xB277,0xB278,0xB279, +0xC4EA,0xB27A,0xB281,0xB282,0xB283,0xB284,0xB285,0xB286, +0xC4EB,0xB287,0xB288,0xB289,0xB28A,0xB28B,0xB28C,0xB28D, +0xB28E,0xB28F,0xB290,0xB291,0xB292,0xB293,0xB294,0xB295, +0xB296,0xB297,0xB298,0xB299,0xC4EC,0xB29A,0xB29B,0xB29C, +0xB29D,0xB29E,0xB29F,0xB2A0,0xB341,0xB342,0xB343,0xB344, +0xB345,0xB346,0xB347,0xB348,0xB349,0xB34A,0xB34B,0xB34C, +0xB34D,0xB34E,0xB34F,0xB350,0xB351,0xB352,0xB353,0xB354, +0xC4ED,0xC4EE,0xB355,0xB356,0xC4EF,0xB357,0xB358,0xB359, +0xC4F0,0xB35A,0xB361,0xB362,0xB363,0xB364,0xB365,0xB366, +0xC4F1,0xC4F2,0xB367,0xC4F3,0xB368,0xC4F4,0xB369,0xB36A, +0xB36B,0xB36C,0xB36D,0xB36E,0xC4F5,0xB36F,0xB370,0xB371, +0xC4F6,0xB372,0xB373,0xB374,0xC4F7,0xB375,0xB376,0xB377, +0xB378,0xB379,0xB37A,0xB381,0xB382,0xB383,0xB384,0xB385, +0xB386,0xC4F8,0xB387,0xB388,0xB389,0xB38A,0xB38B,0xB38C, +0xC4F9,0xB38D,0xB38E,0xB38F,0xB390,0xB391,0xB392,0xB393, +0xB394,0xB395,0xB396,0xB397,0xB398,0xB399,0xB39A,0xB39B, +0xB39C,0xB39D,0xB39E,0xB39F,0xB3A0,0xC4FA,0xB441,0xB442, +0xB443,0xB444,0xB445,0xB446,0xC4FB,0xC4FC,0xB447,0xB448, +0xC4FD,0xB449,0xB44A,0xB44B,0xC4FE,0xB44C,0xB44D,0xB44E, +0xB44F,0xB450,0xB451,0xB452,0xC5A1,0xC5A2,0xB453,0xC5A3, +0xB454,0xC5A4,0xB455,0xB456,0xB457,0xB458,0xB459,0xB45A, +0xC5A5,0xB461,0xB462,0xB463,0xC5A6,0xB464,0xB465,0xB466, +0xC5A7,0xB467,0xB468,0xB469,0xB46A,0xB46B,0xB46C,0xB46D, +0xC5A8,0xB46E,0xB46F,0xB470,0xB471,0xB472,0xB473,0xB474, +0xB475,0xB476,0xB477,0xB478,0xC5A9,0xC5AA,0xB479,0xB47A, +0xC5AB,0xB481,0xB482,0xB483,0xC5AC,0xB484,0xB485,0xB486, +0xB487,0xB488,0xB489,0xB48A,0xC5AD,0xC5AE,0xB48B,0xB48C, +0xB48D,0xC5AF,0xB48E,0xB48F,0xB490,0xB491,0xB492,0xB493, +0xB494,0xB495,0xB496,0xB497,0xB498,0xB499,0xB49A,0xB49B, +0xB49C,0xB49D,0xB49E,0xB49F,0xB4A0,0xB541,0xB542,0xB543, +0xB544,0xB545,0xB546,0xB547,0xB548,0xB549,0xB54A,0xB54B, +0xB54C,0xB54D,0xB54E,0xB54F,0xC5B0,0xC5B1,0xB550,0xB551, +0xC5B2,0xB552,0xB553,0xB554,0xC5B3,0xB555,0xB556,0xB557, +0xB558,0xB559,0xB55A,0xB561,0xC5B4,0xC5B5,0xB562,0xC5B6, +0xB563,0xC5B7,0xB564,0xB565,0xB566,0xB567,0xB568,0xB569, +0xC5B8,0xC5B9,0xB56A,0xB56B,0xC5BA,0xB56C,0xB56D,0xB56E, +0xC5BB,0xC5BC,0xB56F,0xB570,0xB571,0xB572,0xB573,0xB574, +0xC5BD,0xC5BE,0xB575,0xC5BF,0xC5C0,0xC5C1,0xB576,0xB577, +0xB578,0xB579,0xB57A,0xB581,0xC5C2,0xC5C3,0xB582,0xB583, +0xC5C4,0xB584,0xB585,0xB586,0xC5C5,0xB587,0xB588,0xB589, +0xB58A,0xB58B,0xB58C,0xB58D,0xC5C6,0xC5C7,0xB58E,0xC5C8, +0xC5C9,0xC5CA,0xB58F,0xB590,0xB591,0xB592,0xB593,0xB594, +0xC5CB,0xB595,0xB596,0xB597,0xB598,0xB599,0xB59A,0xB59B, +0xB59C,0xB59D,0xB59E,0xB59F,0xB5A0,0xB641,0xB642,0xB643, +0xB644,0xB645,0xB646,0xB647,0xB648,0xC5CC,0xB649,0xB64A, +0xB64B,0xB64C,0xB64D,0xB64E,0xB64F,0xB650,0xB651,0xB652, +0xB653,0xB654,0xB655,0xB656,0xB657,0xB658,0xB659,0xB65A, +0xB661,0xB662,0xB663,0xB664,0xB665,0xB666,0xB667,0xB668, +0xB669,0xB66A,0xB66B,0xB66C,0xB66D,0xB66E,0xB66F,0xB670, +0xC5CD,0xC5CE,0xB671,0xB672,0xC5CF,0xB673,0xB674,0xB675, +0xC5D0,0xB676,0xC5D1,0xB677,0xB678,0xB679,0xB67A,0xB681, +0xC5D2,0xC5D3,0xB682,0xC5D4,0xC5D5,0xC5D6,0xB683,0xB684, +0xB685,0xB686,0xB687,0xB688,0xC5D7,0xC5D8,0xB689,0xB68A, +0xC5D9,0xB68B,0xB68C,0xB68D,0xC5DA,0xB68E,0xB68F,0xB690, +0xB691,0xB692,0xB693,0xB694,0xC5DB,0xC5DC,0xB695,0xC5DD, +0xB696,0xC5DE,0xB697,0xB698,0xB699,0xB69A,0xB69B,0xB69C, +0xC5DF,0xB69D,0xB69E,0xB69F,0xC5E0,0xB6A0,0xB741,0xB742, +0xB743,0xB744,0xB745,0xB746,0xB747,0xB748,0xB749,0xB74A, +0xB74B,0xB74C,0xB74D,0xB74E,0xC5E1,0xB74F,0xB750,0xB751, +0xB752,0xB753,0xB754,0xB755,0xC5E2,0xB756,0xB757,0xB758, +0xC5E3,0xB759,0xB75A,0xB761,0xB762,0xB763,0xB764,0xB765, +0xB766,0xB767,0xB768,0xB769,0xB76A,0xB76B,0xB76C,0xB76D, +0xB76E,0xB76F,0xB770,0xB771,0xB772,0xB773,0xB774,0xB775, +0xC5E4,0xC5E5,0xB776,0xB777,0xC5E6,0xB778,0xB779,0xB77A, +0xC5E7,0xB781,0xB782,0xB783,0xB784,0xB785,0xB786,0xB787, +0xC5E8,0xC5E9,0xB788,0xC5EA,0xB789,0xC5EB,0xB78A,0xB78B, +0xB78C,0xB78D,0xC5EC,0xB78E,0xC5ED,0xB78F,0xB790,0xB791, +0xC5EE,0xB792,0xB793,0xB794,0xB795,0xB796,0xB797,0xB798, +0xB799,0xB79A,0xB79B,0xB79C,0xB79D,0xB79E,0xB79F,0xB7A0, +0xB841,0xB842,0xB843,0xB844,0xB845,0xB846,0xB847,0xB848, +0xC5EF,0xB849,0xB84A,0xB84B,0xB84C,0xB84D,0xB84E,0xB84F, +0xB850,0xB851,0xB852,0xB853,0xB854,0xB855,0xB856,0xB857, +0xB858,0xB859,0xB85A,0xB861,0xB862,0xB863,0xB864,0xB865, +0xB866,0xB867,0xB868,0xB869,0xC5F0,0xB86A,0xB86B,0xB86C, +0xC5F1,0xB86D,0xB86E,0xB86F,0xB870,0xB871,0xB872,0xB873, +0xB874,0xB875,0xB876,0xB877,0xB878,0xB879,0xB87A,0xC5F2, +0xB881,0xC5F3,0xB882,0xB883,0xB884,0xB885,0xB886,0xB887, +0xC5F4,0xB888,0xB889,0xB88A,0xB88B,0xB88C,0xB88D,0xB88E, +0xB88F,0xB890,0xB891,0xB892,0xB893,0xB894,0xB895,0xB896, +0xB897,0xB898,0xB899,0xB89A,0xB89B,0xB89C,0xB89D,0xB89E, +0xB89F,0xB8A0,0xB941,0xB942,0xC5F5,0xC5F6,0xB943,0xB944, +0xC5F7,0xB945,0xB946,0xB947,0xC5F8,0xB948,0xB949,0xB94A, +0xB94B,0xB94C,0xB94D,0xB94E,0xC5F9,0xC5FA,0xB94F,0xC5FB, +0xB950,0xC5FC,0xB951,0xB952,0xB953,0xB954,0xB955,0xB956, +0xC5FD,0xB957,0xB958,0xB959,0xB95A,0xB961,0xB962,0xB963, +0xB964,0xB965,0xB966,0xB967,0xB968,0xB969,0xB96A,0xB96B, +0xB96C,0xB96D,0xB96E,0xB96F,0xC5FE,0xB970,0xB971,0xB972, +0xB973,0xB974,0xB975,0xB976,0xC6A1,0xB977,0xB978,0xB979, +0xB97A,0xB981,0xB982,0xB983,0xB984,0xB985,0xB986,0xB987, +0xB988,0xB989,0xB98A,0xB98B,0xB98C,0xB98D,0xB98E,0xB98F, +0xB990,0xB991,0xB992,0xB993,0xB994,0xB995,0xB996,0xB997, +0xC6A2,0xC6A3,0xB998,0xB999,0xC6A4,0xB99A,0xB99B,0xB99C, +0xC6A5,0xB99D,0xB99E,0xB99F,0xB9A0,0xBA41,0xBA42,0xBA43, +0xC6A6,0xC6A7,0xBA44,0xBA45,0xBA46,0xC6A8,0xBA47,0xBA48, +0xBA49,0xBA4A,0xBA4B,0xBA4C,0xC6A9,0xBA4D,0xBA4E,0xBA4F, +0xC6AA,0xBA50,0xBA51,0xBA52,0xC6AB,0xBA53,0xBA54,0xBA55, +0xBA56,0xBA57,0xBA58,0xBA59,0xC6AC,0xBA5A,0xBA61,0xBA62, +0xBA63,0xC6AD,0xBA64,0xBA65,0xBA66,0xBA67,0xBA68,0xBA69, +0xC6AE,0xC6AF,0xBA6A,0xBA6B,0xC6B0,0xBA6C,0xBA6D,0xC6B1, +0xC6B2,0xBA6E,0xC6B3,0xBA6F,0xBA70,0xBA71,0xBA72,0xBA73, +0xC6B4,0xC6B5,0xBA74,0xC6B6,0xBA75,0xBA76,0xBA77,0xBA78, +0xBA79,0xBA7A,0xBA81,0xBA82,0xC6B7,0xBA83,0xBA84,0xBA85, +0xC6B8,0xBA86,0xBA87,0xBA88,0xC6B9,0xBA89,0xBA8A,0xBA8B, +0xBA8C,0xBA8D,0xBA8E,0xBA8F,0xC6BA,0xC6BB,0xBA90,0xBA91, +0xBA92,0xBA93,0xBA94,0xBA95,0xBA96,0xBA97,0xBA98,0xBA99, +0xC6BC,0xC6BD,0xBA9A,0xBA9B,0xC6BE,0xBA9C,0xBA9D,0xBA9E, +0xC6BF,0xBA9F,0xBAA0,0xBB41,0xBB42,0xBB43,0xBB44,0xBB45, +0xC6C0,0xC6C1,0xBB46,0xC6C2,0xBB47,0xC6C3,0xBB48,0xBB49, +0xBB4A,0xBB4B,0xBB4C,0xBB4D,0xC6C4,0xC6C5,0xC6C6,0xBB4E, +0xC6C7,0xBB4F,0xBB50,0xBB51,0xC6C8,0xBB52,0xC6C9,0xBB53, +0xBB54,0xBB55,0xBB56,0xBB57,0xC6CA,0xC6CB,0xBB58,0xC6CC, +0xC6CD,0xC6CE,0xBB59,0xBB5A,0xBB61,0xC6CF,0xBB62,0xBB63, +0xC6D0,0xC6D1,0xBB64,0xBB65,0xC6D2,0xBB66,0xBB67,0xBB68, +0xC6D3,0xBB69,0xBB6A,0xBB6B,0xBB6C,0xBB6D,0xBB6E,0xBB6F, +0xC6D4,0xC6D5,0xBB70,0xC6D6,0xC6D7,0xC6D8,0xBB71,0xBB72, +0xBB73,0xBB74,0xBB75,0xBB76,0xC6D9,0xC6DA,0xBB77,0xBB78, +0xBB79,0xBB7A,0xBB81,0xBB82,0xBB83,0xBB84,0xBB85,0xBB86, +0xBB87,0xBB88,0xBB89,0xBB8A,0xBB8B,0xBB8C,0xBB8D,0xBB8E, +0xBB8F,0xBB90,0xBB91,0xBB92,0xBB93,0xBB94,0xBB95,0xBB96, +0xBB97,0xBB98,0xBB99,0xBB9A,0xBB9B,0xBB9C,0xBB9D,0xBB9E, +0xBB9F,0xBBA0,0xBC41,0xBC42,0xBC43,0xBC44,0xBC45,0xBC46, +0xBC47,0xBC48,0xBC49,0xBC4A,0xBC4B,0xBC4C,0xBC4D,0xBC4E, +0xBC4F,0xBC50,0xBC51,0xBC52,0xC6DB,0xC6DC,0xBC53,0xBC54, +0xC6DD,0xBC55,0xBC56,0xBC57,0xC6DE,0xBC58,0xBC59,0xBC5A, +0xBC61,0xBC62,0xBC63,0xBC64,0xC6DF,0xC6E0,0xBC65,0xC6E1, +0xC6E2,0xC6E3,0xBC66,0xBC67,0xBC68,0xBC69,0xBC6A,0xBC6B, +0xC6E4,0xC6E5,0xBC6C,0xBC6D,0xC6E6,0xBC6E,0xBC6F,0xBC70, +0xC6E7,0xBC71,0xBC72,0xBC73,0xBC74,0xBC75,0xBC76,0xBC77, +0xC6E8,0xC6E9,0xBC78,0xC6EA,0xBC79,0xC6EB,0xBC7A,0xBC81, +0xBC82,0xBC83,0xBC84,0xBC85,0xC6EC,0xBC86,0xBC87,0xBC88, +0xC6ED,0xBC89,0xBC8A,0xBC8B,0xC6EE,0xBC8C,0xBC8D,0xBC8E, +0xBC8F,0xBC90,0xBC91,0xBC92,0xC6EF,0xC6F0,0xBC93,0xBC94, +0xC6F1,0xC6F2,0xBC95,0xBC96,0xBC97,0xBC98,0xBC99,0xBC9A, +0xC6F3,0xBC9B,0xBC9C,0xBC9D,0xBC9E,0xBC9F,0xBCA0,0xBD41, +0xC6F4,0xBD42,0xBD43,0xBD44,0xBD45,0xBD46,0xBD47,0xBD48, +0xBD49,0xC6F5,0xBD4A,0xC6F6,0xBD4B,0xBD4C,0xBD4D,0xBD4E, +0xBD4F,0xBD50,0xBD51,0xBD52,0xC6F7,0xC6F8,0xBD53,0xBD54, +0xC6F9,0xBD55,0xBD56,0xBD57,0xC6FA,0xBD58,0xBD59,0xBD5A, +0xBD61,0xBD62,0xBD63,0xBD64,0xC6FB,0xC6FC,0xBD65,0xC6FD, +0xBD66,0xC6FE,0xBD67,0xBD68,0xBD69,0xBD6A,0xBD6B,0xBD6C, +0xC7A1,0xBD6D,0xBD6E,0xBD6F,0xBD70,0xBD71,0xBD72,0xBD73, +0xBD74,0xBD75,0xBD76,0xBD77,0xBD78,0xBD79,0xBD7A,0xBD81, +0xBD82,0xBD83,0xBD84,0xBD85,0xBD86,0xC7A2,0xBD87,0xBD88, +0xBD89,0xBD8A,0xBD8B,0xBD8C,0xBD8D,0xBD8E,0xBD8F,0xBD90, +0xBD91,0xBD92,0xBD93,0xBD94,0xBD95,0xBD96,0xBD97,0xBD98, +0xBD99,0xBD9A,0xBD9B,0xBD9C,0xBD9D,0xBD9E,0xBD9F,0xBDA0, +0xBE41,0xBE42,0xBE43,0xBE44,0xBE45,0xBE46,0xBE47,0xBE48, +0xC7A3,0xBE49,0xBE4A,0xBE4B,0xC7A4,0xBE4C,0xBE4D,0xBE4E, +0xBE4F,0xBE50,0xBE51,0xBE52,0xBE53,0xBE54,0xBE55,0xBE56, +0xBE57,0xBE58,0xBE59,0xBE5A,0xBE61,0xBE62,0xBE63,0xBE64, +0xBE65,0xBE66,0xBE67,0xBE68,0xC7A5,0xBE69,0xBE6A,0xBE6B, +0xC7A6,0xBE6C,0xBE6D,0xBE6E,0xC7A7,0xBE6F,0xBE70,0xBE71, +0xBE72,0xBE73,0xBE74,0xBE75,0xBE76,0xC7A8,0xBE77,0xC7A9, +0xBE78,0xBE79,0xBE7A,0xBE81,0xBE82,0xBE83,0xBE84,0xBE85, +0xC7AA,0xC7AB,0xBE86,0xBE87,0xC7AC,0xBE88,0xBE89,0xC7AD, +0xC7AE,0xBE8A,0xC7AF,0xBE8B,0xBE8C,0xBE8D,0xBE8E,0xBE8F, +0xC7B0,0xC7B1,0xBE90,0xC7B2,0xBE91,0xC7B3,0xBE92,0xBE93, +0xBE94,0xBE95,0xBE96,0xBE97,0xC7B4,0xBE98,0xBE99,0xBE9A, +0xBE9B,0xBE9C,0xBE9D,0xBE9E,0xBE9F,0xBEA0,0xBF41,0xBF42, +0xBF43,0xBF44,0xBF45,0xBF46,0xBF47,0xBF48,0xBF49,0xBF4A, +0xBF4B,0xC7B5,0xBF4C,0xBF4D,0xBF4E,0xBF4F,0xBF50,0xBF51, +0xBF52,0xBF53,0xBF54,0xBF55,0xBF56,0xBF57,0xBF58,0xBF59, +0xBF5A,0xBF61,0xBF62,0xBF63,0xBF64,0xBF65,0xBF66,0xBF67, +0xBF68,0xBF69,0xBF6A,0xBF6B,0xBF6C,0xBF6D,0xBF6E,0xBF6F, +0xBF70,0xBF71,0xBF72,0xBF73,0xC7B6,0xBF74,0xBF75,0xBF76, +0xC7B7,0xBF77,0xBF78,0xBF79,0xC7B8,0xBF7A,0xBF81,0xBF82, +0xBF83,0xBF84,0xBF85,0xBF86,0xC7B9,0xBF87,0xBF88,0xC7BA, +0xBF89,0xBF8A,0xBF8B,0xBF8C,0xBF8D,0xBF8E,0xBF8F,0xBF90, +0xC7BB,0xBF91,0xBF92,0xBF93,0xC7BC,0xBF94,0xBF95,0xBF96, +0xC7BD,0xBF97,0xBF98,0xBF99,0xBF9A,0xBF9B,0xBF9C,0xBF9D, +0xC7BE,0xBF9E,0xBF9F,0xC7BF,0xBFA0,0xC7C0,0xC041,0xC042, +0xC043,0xC044,0xC045,0xC046,0xC7C1,0xC047,0xC048,0xC049, +0xC7C2,0xC04A,0xC04B,0xC04C,0xC7C3,0xC04D,0xC04E,0xC04F, +0xC050,0xC051,0xC052,0xC053,0xC7C4,0xC7C5,0xC054,0xC7C6, +0xC055,0xC056,0xC057,0xC058,0xC059,0xC05A,0xC061,0xC062, +0xC063,0xC064,0xC065,0xC066,0xC067,0xC068,0xC069,0xC06A, +0xC06B,0xC06C,0xC06D,0xC06E,0xC06F,0xC070,0xC071,0xC072, +0xC073,0xC074,0xC075,0xC076,0xC077,0xC078,0xC079,0xC07A, +0xC081,0xC082,0xC083,0xC084,0xC7C7,0xC7C8,0xC085,0xC086, +0xC7C9,0xC087,0xC088,0xC089,0xC7CA,0xC08A,0xC08B,0xC08C, +0xC08D,0xC08E,0xC08F,0xC090,0xC7CB,0xC7CC,0xC091,0xC7CD, +0xC092,0xC7CE,0xC093,0xC094,0xC095,0xC096,0xC097,0xC098, +0xC7CF,0xC7D0,0xC099,0xC09A,0xC7D1,0xC09B,0xC09C,0xC09D, +0xC7D2,0xC09E,0xC09F,0xC0A0,0xC141,0xC7D3,0xC142,0xC143, +0xC7D4,0xC7D5,0xC144,0xC7D6,0xC145,0xC7D7,0xC146,0xC147, +0xC148,0xC149,0xC14A,0xC14B,0xC7D8,0xC7D9,0xC14C,0xC14D, +0xC7DA,0xC14E,0xC14F,0xC150,0xC7DB,0xC151,0xC152,0xC153, +0xC154,0xC155,0xC156,0xC157,0xC7DC,0xC7DD,0xC158,0xC7DE, +0xC7DF,0xC7E0,0xC159,0xC15A,0xC161,0xC162,0xC163,0xC164, +0xC7E1,0xC165,0xC166,0xC167,0xC168,0xC169,0xC16A,0xC16B, +0xC16C,0xC16D,0xC16E,0xC16F,0xC170,0xC171,0xC172,0xC173, +0xC174,0xC175,0xC176,0xC177,0xC178,0xC7E2,0xC179,0xC17A, +0xC181,0xC182,0xC183,0xC184,0xC185,0xC186,0xC187,0xC188, +0xC189,0xC18A,0xC18B,0xC18C,0xC18D,0xC18E,0xC18F,0xC190, +0xC191,0xC192,0xC193,0xC194,0xC195,0xC196,0xC197,0xC198, +0xC199,0xC19A,0xC19B,0xC19C,0xC19D,0xC19E,0xC19F,0xC1A0, +0xC7E3,0xC7E4,0xC241,0xC242,0xC7E5,0xC243,0xC244,0xC245, +0xC7E6,0xC246,0xC7E7,0xC247,0xC248,0xC249,0xC24A,0xC24B, +0xC7E8,0xC7E9,0xC24C,0xC7EA,0xC24D,0xC7EB,0xC24E,0xC24F, +0xC250,0xC251,0xC252,0xC253,0xC7EC,0xC7ED,0xC254,0xC255, +0xC7EE,0xC256,0xC257,0xC258,0xC7EF,0xC259,0xC25A,0xC261, +0xC262,0xC263,0xC264,0xC265,0xC7F0,0xC7F1,0xC266,0xC7F2, +0xC267,0xC7F3,0xC268,0xC269,0xC26A,0xC26B,0xC26C,0xC26D, +0xC7F4,0xC7F5,0xC26E,0xC26F,0xC7F6,0xC270,0xC271,0xC272, +0xC7F7,0xC273,0xC274,0xC275,0xC276,0xC277,0xC278,0xC279, +0xC7F8,0xC7F9,0xC27A,0xC7FA,0xC7FB,0xC7FC,0xC281,0xC282, +0xC283,0xC284,0xC285,0xC286,0xC7FD,0xC287,0xC288,0xC289, +0xC7FE,0xC28A,0xC28B,0xC28C,0xC8A1,0xC28D,0xC28E,0xC28F, +0xC290,0xC291,0xC292,0xC293,0xC294,0xC8A2,0xC295,0xC296, +0xC297,0xC298,0xC299,0xC29A,0xC29B,0xC29C,0xC29D,0xC29E, +0xC8A3,0xC8A4,0xC29F,0xC2A0,0xC8A5,0xC341,0xC342,0xC343, +0xC8A6,0xC344,0xC345,0xC346,0xC347,0xC8A7,0xC348,0xC349, +0xC8A8,0xC8A9,0xC34A,0xC8AA,0xC34B,0xC8AB,0xC34C,0xC34D, +0xC34E,0xC8AC,0xC34F,0xC350,0xC8AD,0xC8AE,0xC351,0xC352, +0xC8AF,0xC353,0xC354,0xC355,0xC8B0,0xC356,0xC357,0xC358, +0xC359,0xC35A,0xC361,0xC362,0xC363,0xC364,0xC365,0xC8B1, +0xC366,0xC8B2,0xC367,0xC368,0xC369,0xC36A,0xC36B,0xC36C, +0xC8B3,0xC8B4,0xC36D,0xC36E,0xC8B5,0xC36F,0xC370,0xC371, +0xC372,0xC373,0xC374,0xC375,0xC376,0xC377,0xC378,0xC379, +0xC37A,0xC381,0xC382,0xC8B6,0xC383,0xC8B7,0xC384,0xC385, +0xC386,0xC387,0xC388,0xC389,0xC8B8,0xC8B9,0xC38A,0xC38B, +0xC8BA,0xC38C,0xC38D,0xC38E,0xC8BB,0xC38F,0xC390,0xC391, +0xC392,0xC393,0xC394,0xC395,0xC396,0xC8BC,0xC397,0xC8BD, +0xC398,0xC8BE,0xC399,0xC39A,0xC39B,0xC39C,0xC39D,0xC39E, +0xC8BF,0xC39F,0xC3A0,0xC441,0xC8C0,0xC442,0xC443,0xC444, +0xC8C1,0xC445,0xC446,0xC447,0xC448,0xC449,0xC44A,0xC44B, +0xC44C,0xC8C2,0xC44D,0xC8C3,0xC44E,0xC44F,0xC450,0xC451, +0xC452,0xC453,0xC454,0xC455,0xC8C4,0xC8C5,0xC456,0xC457, +0xC8C6,0xC458,0xC459,0xC45A,0xC8C7,0xC461,0xC462,0xC463, +0xC464,0xC8C8,0xC465,0xC466,0xC8C9,0xC467,0xC468,0xC8CA, +0xC469,0xC8CB,0xC46A,0xC46B,0xC46C,0xC46D,0xC46E,0xC46F, +0xC8CC,0xC470,0xC471,0xC472,0xC8CD,0xC473,0xC474,0xC475, +0xC8CE,0xC476,0xC477,0xC478,0xC479,0xC47A,0xC481,0xC482, +0xC8CF,0xC483,0xC484,0xC485,0xC486,0xC8D0,0xC487,0xC488, +0xC489,0xC48A,0xC48B,0xC48C,0xC8D1,0xC8D2,0xC48D,0xC48E, +0xC8D3,0xC48F,0xC490,0xC491,0xC8D4,0xC492,0xC493,0xC494, +0xC495,0xC496,0xC497,0xC498,0xC499,0xC49A,0xC49B,0xC49C, +0xC49D,0xC8D5,0xC49E,0xC49F,0xC4A0,0xC541,0xC542,0xC543, +0xC8D6,0xC8D7,0xC544,0xC545,0xC8D8,0xC546,0xC547,0xC548, +0xC8D9,0xC549,0xC54A,0xC54B,0xC54C,0xC54D,0xC54E,0xC54F, +0xC8DA,0xC8DB,0xC550,0xC8DC,0xC551,0xC8DD,0xC552,0xC553, +0xC554,0xC555,0xC556,0xC557,0xC8DE,0xC8DF,0xC558,0xC559, +0xC8E0,0xC55A,0xC561,0xC562,0xC8E1,0xC563,0xC564,0xC565, +0xC566,0xC567,0xC568,0xC569,0xC8E2,0xC56A,0xC56B,0xC8E3, +0xC56C,0xC8E4,0xC56D,0xC56E,0xC56F,0xC570,0xC571,0xC572, +0xC8E5,0xC8E6,0xC573,0xC574,0xC8E7,0xC575,0xC8E8,0xC8E9, +0xC8EA,0xC8EB,0xC576,0xC577,0xC578,0xC579,0xC57A,0xC581, +0xC8EC,0xC8ED,0xC582,0xC8EE,0xC583,0xC8EF,0xC584,0xC585, +0xC586,0xC8F0,0xC587,0xC588,0xC8F1,0xC589,0xC58A,0xC58B, +0xC8F2,0xC58C,0xC58D,0xC58E,0xC8F3,0xC58F,0xC590,0xC591, +0xC592,0xC593,0xC594,0xC595,0xC8F4,0xC8F5,0xC596,0xC597, +0xC598,0xC8F6,0xC599,0xC59A,0xC59B,0xC59C,0xC59D,0xC59E, +0xC8F7,0xC8F8,0xC59F,0xC5A0,0xC8F9,0xC641,0xC642,0xC643, +0xC8FA,0xC644,0xC645,0xC646,0xC647,0xC648,0xC649,0xC64A, +0xC8FB,0xC8FC,0xC64B,0xC8FD,0xC64C,0xC8FE,0xC64D,0xC64E, +0xC64F,0xC650,0xC651,0xC652}; + +/* page 9 0xF900-0xFA0B */ +static uint16 tab_uni_ksc56019[]={ +0xCBD0,0xCBD6,0xCBE7,0xCDCF,0xCDE8,0xCEAD,0xCFFB,0xD0A2, +0xD0B8,0xD0D0,0xD0DD,0xD1D4,0xD1D5,0xD1D8,0xD1DB,0xD1DC, +0xD1DD,0xD1DE,0xD1DF,0xD1E0,0xD1E2,0xD1E3,0xD1E4,0xD1E5, +0xD1E6,0xD1E8,0xD1E9,0xD1EA,0xD1EB,0xD1ED,0xD1EF,0xD1F0, +0xD1F2,0xD1F6,0xD1FA,0xD1FC,0xD1FD,0xD1FE,0xD2A2,0xD2A3, +0xD2A7,0xD2A8,0xD2A9,0xD2AA,0xD2AB,0xD2AD,0xD2B2,0xD2BE, +0xD2C2,0xD2C3,0xD2C4,0xD2C6,0xD2C7,0xD2C8,0xD2C9,0xD2CA, +0xD2CB,0xD2CD,0xD2CE,0xD2CF,0xD2D0,0xD2D1,0xD2D2,0xD2D3, +0xD2D4,0xD2D5,0xD2D6,0xD2D7,0xD2D9,0xD2DA,0xD2DE,0xD2DF, +0xD2E1,0xD2E2,0xD2E4,0xD2E5,0xD2E6,0xD2E7,0xD2E8,0xD2E9, +0xD2EA,0xD2EB,0xD2F0,0xD2F1,0xD2F2,0xD2F3,0xD2F4,0xD2F5, +0xD2F7,0xD2F8,0xD4E6,0xD4FC,0xD5A5,0xD5AB,0xD5AE,0xD6B8, +0xD6CD,0xD7CB,0xD7E4,0xDBC5,0xDBE4,0xDCA5,0xDDA5,0xDDD5, +0xDDF4,0xDEFC,0xDEFE,0xDFB3,0xDFE1,0xDFE8,0xE0F1,0xE1AD, +0xE1ED,0xE3F5,0xE4A1,0xE4A9,0xE5AE,0xE5B1,0xE5B2,0xE5B9, +0xE5BB,0xE5BC,0xE5C4,0xE5CE,0xE5D0,0xE5D2,0xE5D6,0xE5FA, +0xE5FB,0xE5FC,0xE5FE,0xE6A1,0xE6A4,0xE6A7,0xE6AD,0xE6AF, +0xE6B0,0xE6B1,0xE6B3,0xE6B7,0xE6B8,0xE6BC,0xE6C4,0xE6C6, +0xE6C7,0xE6CA,0xE6D2,0xE6D6,0xE6D9,0xE6DC,0xE6DF,0xE6E1, +0xE6E4,0xE6E5,0xE6E6,0xE6E8,0xE6EA,0xE6EB,0xE6EC,0xE6EF, +0xE6F1,0xE6F2,0xE6F5,0xE6F6,0xE6F7,0xE6F9,0xE7A1,0xE7A6, +0xE7A9,0xE7AA,0xE7AC,0xE7AD,0xE7B0,0xE7BF,0xE7C1,0xE7C6, +0xE7C7,0xE7CB,0xE7CD,0xE7CF,0xE7D0,0xE7D3,0xE7DF,0xE7E4, +0xE7E6,0xE7F7,0xE8E7,0xE8E8,0xE8F0,0xE8F1,0xE8F7,0xE8F9, +0xE8FB,0xE8FE,0xE9A7,0xE9AC,0xE9CC,0xE9F7,0xEAC1,0xEAE5, +0xEAF4,0xEAF7,0xEAFC,0xEAFE,0xEBA4,0xEBA7,0xEBA9,0xEBAA, +0xEBBA,0xEBBB,0xEBBD,0xEBC1,0xEBC2,0xEBC6,0xEBC7,0xEBCC, +0xEBCF,0xEBD0,0xEBD1,0xEBD2,0xEBD8,0xECA6,0xECA7,0xECAA, +0xECAF,0xECB0,0xECB1,0xECB2,0xECB5,0xECB8,0xECBA,0xECC0, +0xECC1,0xECC5,0xECC6,0xECC9,0xECCA,0xECD5,0xECDD,0xECDE, +0xECE1,0xECE4,0xECE7,0xECE8,0xECF7,0xECF8,0xECFA,0xEDA1, +0xEDA2,0xEDA3,0xEDEE,0xEEDB,0xF2BD,0xF2FA,0xF3B1,0xF4A7, +0xF4EE,0xF6F4,0xF6F6,0xF7B8,0xF7C8,0xF7D3,0xF8DB,0xF8F0, +0xFAA1,0xFAA2,0xFAE6,0xFCA9}; + +/* page 10 0xFF01-0xFFE6 */ +static uint16 tab_uni_ksc560110[]={ +0xA3A1,0xA3A2,0xA3A3,0xA3A4,0xA3A5,0xA3A6,0xA3A7,0xA3A8, +0xA3A9,0xA3AA,0xA3AB,0xA3AC,0xA3AD,0xA3AE,0xA3AF,0xA3B0, +0xA3B1,0xA3B2,0xA3B3,0xA3B4,0xA3B5,0xA3B6,0xA3B7,0xA3B8, +0xA3B9,0xA3BA,0xA3BB,0xA3BC,0xA3BD,0xA3BE,0xA3BF,0xA3C0, +0xA3C1,0xA3C2,0xA3C3,0xA3C4,0xA3C5,0xA3C6,0xA3C7,0xA3C8, +0xA3C9,0xA3CA,0xA3CB,0xA3CC,0xA3CD,0xA3CE,0xA3CF,0xA3D0, +0xA3D1,0xA3D2,0xA3D3,0xA3D4,0xA3D5,0xA3D6,0xA3D7,0xA3D8, +0xA3D9,0xA3DA,0xA3DB,0xA1AC,0xA3DD,0xA3DE,0xA3DF,0xA3E0, +0xA3E1,0xA3E2,0xA3E3,0xA3E4,0xA3E5,0xA3E6,0xA3E7,0xA3E8, +0xA3E9,0xA3EA,0xA3EB,0xA3EC,0xA3ED,0xA3EE,0xA3EF,0xA3F0, +0xA3F1,0xA3F2,0xA3F3,0xA3F4,0xA3F5,0xA3F6,0xA3F7,0xA3F8, +0xA3F9,0xA3FA,0xA3FB,0xA3FC,0xA3FD,0xA2A6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA1CB, +0xA1CC,0xA1FE,0xA3FE, 0,0xA1CD,0xA3DC}; + +static int func_uni_ksc5601_onechar(int code){ + if ((code>=0x00A1)&&(code<=0x0167)) + return(tab_uni_ksc56010[code-0x00A1]); + if ((code>=0x02C7)&&(code<=0x0451)) + return(tab_uni_ksc56011[code-0x02C7]); + if ((code>=0x2015)&&(code<=0x2312)) + return(tab_uni_ksc56012[code-0x2015]); + if ((code>=0x2460)&&(code<=0x266D)) + return(tab_uni_ksc56013[code-0x2460]); + if ((code>=0x3000)&&(code<=0x327F)) + return(tab_uni_ksc56014[code-0x3000]); + if ((code>=0x3380)&&(code<=0x33DD)) + return(tab_uni_ksc56015[code-0x3380]); + if ((code>=0x4E00)&&(code<=0x947F)) + return(tab_uni_ksc56016[code-0x4E00]); + if ((code>=0x9577)&&(code<=0x9F9C)) + return(tab_uni_ksc56017[code-0x9577]); + if ((code>=0xAC00)&&(code<=0xD7A3)) + return(tab_uni_ksc56018[code-0xAC00]); + if ((code>=0xF900)&&(code<=0xFA0B)) + return(tab_uni_ksc56019[code-0xF900]); + if ((code>=0xFF01)&&(code<=0xFFE6)) + return(tab_uni_ksc560110[code-0xFF01]); + return(0); +} + + +static int +my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + int code; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((uint) wc < 0x80) + { + s[0]= (uchar) wc; + return 1; + } + + if (!(code=func_uni_ksc5601_onechar(wc))) + return MY_CS_ILUNI; + + if (s+2>e) + return MY_CS_TOOSMALL2; + + s[0]=code>>8; + s[1]=code&0xFF; + + return 2; +} + + +static int +my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e) +{ + + int hi; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((hi= s[0]) < 0x80) + { + pwc[0]=hi; + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + if (!(pwc[0]=func_ksc5601_uni_onechar((hi<<8)+s[1]))) + return -2; + + return 2; +} + + +/* + Returns well formed length of a EUC-KR string. +*/ +static size_t +my_well_formed_len_euckr(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) +{ + const char *b0= b; + const char *emb= e - 1; /* Last possible end of an MB character */ + + *error= 0; + while (pos-- && b < e) + { + if ((uchar) b[0] < 128) + { + /* Single byte ascii character */ + b++; + } + else if (b < emb && iseuc_kr_head(*b) && iseuc_kr_tail(b[1])) + { + /* Double byte character */ + b+= 2; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (size_t) (b - b0); +} + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_simple, /* strnncoll */ + my_strnncollsp_simple, + my_strnxfrm_mb, /* strnxfrm */ + my_strnxfrmlen_simple, + my_like_range_mb, /* like_range */ + my_wildcmp_mb, /* wildcmp */ + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + ismbchar_euc_kr, + mbcharlen_euc_kr, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_euckr, + my_lengthsp_8bit, + my_numcells_8bit, + my_mb_wc_euc_kr, /* mb_wc */ + my_wc_mb_euc_kr, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + +CHARSET_INFO my_charset_euckr_korean_ci= +{ + 19,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "euckr", /* cs name */ + "euckr_korean_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_euc_kr, + to_lower_euc_kr, + to_upper_euc_kr, + sort_order_euc_kr, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + + +CHARSET_INFO my_charset_euckr_bin= +{ + 85,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "euckr", /* cs name */ + "euckr_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_euc_kr, + to_lower_euc_kr, + to_upper_euc_kr, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_mb_bin_handler +}; + +#endif diff --git a/externals/mysql/strings/ctype-eucjpms.c b/externals/mysql/strings/ctype-eucjpms.c new file mode 100644 index 0000000..dc23297 --- /dev/null +++ b/externals/mysql/strings/ctype-eucjpms.c @@ -0,0 +1,8759 @@ +/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* This file is for Japanese EUC charset, and created based on +ctype-ujis.c file. + */ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. mbmaxlen_eucjpms=3 + */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_eucjpms + + +static uchar NEAR ctype_eucjpms[257] = +{ + 0, /* For standard library */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ + 0040, 0050, 0050, 0050, 0050, 0050, 0040, 0040, /* ^H - ^O */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^P - ^W */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^X - ^Z ^[ ^\ ^] ^^ ^_ */ + 0110, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* SPC ! " # $ % ^ ' */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* ( ) * + , - . / */ + 0204, 0204, 0204, 0204, 0204, 0204, 0204, 0204, /* 0 1 2 3 4 5 6 7 */ + 0204, 0204, 0020, 0020, 0020, 0020, 0020, 0020, /* 8 9 : ; < = > ? */ + 0020, 0201, 0201, 0201, 0201, 0201, 0201, 0001, /* @ A B C D E F G */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* H I J K L M N O */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* P Q R S T U V W */ + 0001, 0001, 0001, 0020, 0020, 0020, 0020, 0020, /* X Y Z [ \ ] ^ _ */ + 0020, 0202, 0202, 0202, 0202, 0202, 0202, 0002, /* ` a b c d e f g */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* h i j k l m n o */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* p q r s t u v w */ + 0002, 0002, 0002, 0020, 0020, 0020, 0020, 0040, /* x y z { | } + DEL */ + 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, + 0000, 0000, 0000, 0000, 0000, 0000, 0020, 0020, + 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, + 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, + 0000, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, +}; + +static uchar NEAR to_lower_eucjpms[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR to_upper_eucjpms[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR sort_order_eucjpms[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375', (uchar) (uchar) '\376', (uchar) '\377' +}; + + +#define iseucjpms(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xfe)) +#define iskata(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xdf)) +#define iseucjpms_ss2(c) (((c)&0xff) == 0x8e) +#define iseucjpms_ss3(c) (((c)&0xff) == 0x8f) + + +static uint ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return ((*(uchar*)(p)<0x80)? 0:\ + iseucjpms(*(p)) && (e)-(p)>1 && iseucjpms(*((p)+1))? 2:\ + iseucjpms_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\ + iseucjpms_ss3(*(p)) && (e)-(p)>2 && iseucjpms(*((p)+1)) && iseucjpms(*((p)+2))? 3:\ + 0); +} + +static uint mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c) +{ + return (iseucjpms(c)? 2: iseucjpms_ss2(c)? 2: iseucjpms_ss3(c)? 3: 1); +} + + +static uint16 tab_jisx0201_uni[256]={ + 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67, +0xFF68,0xFF69,0xFF6A,0xFF6B,0xFF6C,0xFF6D,0xFF6E,0xFF6F, +0xFF70,0xFF71,0xFF72,0xFF73,0xFF74,0xFF75,0xFF76,0xFF77, +0xFF78,0xFF79,0xFF7A,0xFF7B,0xFF7C,0xFF7D,0xFF7E,0xFF7F, +0xFF80,0xFF81,0xFF82,0xFF83,0xFF84,0xFF85,0xFF86,0xFF87, +0xFF88,0xFF89,0xFF8A,0xFF8B,0xFF8C,0xFF8D,0xFF8E,0xFF8F, +0xFF90,0xFF91,0xFF92,0xFF93,0xFF94,0xFF95,0xFF96,0xFF97, +0xFF98,0xFF99,0xFF9A,0xFF9B,0xFF9C,0xFF9D,0xFF9E,0xFF9F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +static int +my_mb_wc_jisx0201(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *wc,const uchar *s, + const uchar *e __attribute__((unused))) +{ + wc[0]=tab_jisx0201_uni[*s]; + return (!wc[0] && s[0]) ? -1 : 1; +} + + +static int +my_wc_mb_jisx0201(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, + uchar *e __attribute__((unused))) +{ + + if ((int) wc <= 0x7D) + { + *s = (uchar) wc; + return (wc == 0x5C) ? MY_CS_ILUNI : 1; + } + + if (wc >= 0xFF61 && wc <= 0xFF9F) + { + *s = (uchar) (wc - 0xFEC0); + return 1; + } + + return MY_CS_ILUNI; +} + + +/* page 0 0x2121-0x217E */ +static uint16 tab_jisx0208_uni0[]={ +0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B, +0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E, +0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD, +0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0xFF3C, +0xFF5E,0x2225,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C, +0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B, +0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E, +0x300F,0x3010,0x3011,0xFF0B,0xFF0D,0x00B1,0x00D7,0x00F7, +0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234, +0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04, +0xFFE0,0xFFE1,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7, +0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7}; + +/* page 1 0x2221-0x227E */ +static uint16 tab_jisx0208_uni1[]={ +0x25C6,0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B, +0x3012,0x2192,0x2190,0x2191,0x2193,0x3013, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A, +0x2229, 0, 0, 0, 0, 0, 0, 0, + 0,0x2227,0x2228,0xFFE2,0x21D2,0x21D4,0x2200,0x2203, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2220,0x22A5,0x2312,0x2202,0x2207, +0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x2235, +0x222B,0x222C, 0, 0, 0, 0, 0, 0, + 0,0x212B,0x2030,0x266F,0x266D,0x266A,0x2020,0x2021, +0x00B6, 0, 0, 0, 0,0x25EF}; + +/* page 2 0x2330-0x237A */ +static uint16 tab_jisx0208_uni2[]={ +0xFF10,0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17, +0xFF18,0xFF19, 0, 0, 0, 0, 0, 0, + 0,0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27, +0xFF28,0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F, +0xFF30,0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37, +0xFF38,0xFF39,0xFF3A, 0, 0, 0, 0, 0, + 0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47, +0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F, +0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57, +0xFF58,0xFF59,0xFF5A}; + +/* page 3 0x2421-0x2473 */ +static uint16 tab_jisx0208_uni3[]={ +0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048, +0x3049,0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050, +0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058, +0x3059,0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060, +0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068, +0x3069,0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070, +0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078, +0x3079,0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080, +0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088, +0x3089,0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090, +0x3091,0x3092,0x3093}; + +/* page 4 0x2521-0x2576 */ +static uint16 tab_jisx0208_uni4[]={ +0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8, +0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0, +0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8, +0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0, +0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8, +0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0, +0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8, +0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF,0x30E0, +0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7,0x30E8, +0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF,0x30F0, +0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6}; + +/* page 5 0x2621-0x2658 */ +static uint16 tab_jisx0208_uni5[]={ +0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398, +0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0, +0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9, + 0, 0, 0, 0, 0, 0, 0, 0, +0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8, +0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0, +0x03C1,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9 +}; + +/* page 6 0x2721-0x2771 */ +static uint16 tab_jisx0208_uni6[]={ +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416, +0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426, +0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E, +0x042F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, +0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446, +0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E, +0x044F}; + +/* page 7 0x2821-0x2840 */ +static uint16 tab_jisx0208_uni7[]={ +0x2500,0x2502,0x250C,0x2510,0x2518,0x2514,0x251C,0x252C, +0x2524,0x2534,0x253C,0x2501,0x2503,0x250F,0x2513,0x251B, +0x2517,0x2523,0x2533,0x252B,0x253B,0x254B,0x2520,0x252F, +0x2528,0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542 +}; + +/* page 8 0x3021-0x307E */ +static uint16 tab_jisx0208_uni8[]={ +0x4E9C,0x5516,0x5A03,0x963F,0x54C0,0x611B,0x6328,0x59F6, +0x9022,0x8475,0x831C,0x7A50,0x60AA,0x63E1,0x6E25,0x65ED, +0x8466,0x82A6,0x9BF5,0x6893,0x5727,0x65A1,0x6271,0x5B9B, +0x59D0,0x867B,0x98F4,0x7D62,0x7DBE,0x9B8E,0x6216,0x7C9F, +0x88B7,0x5B89,0x5EB5,0x6309,0x6697,0x6848,0x95C7,0x978D, +0x674F,0x4EE5,0x4F0A,0x4F4D,0x4F9D,0x5049,0x56F2,0x5937, +0x59D4,0x5A01,0x5C09,0x60DF,0x610F,0x6170,0x6613,0x6905, +0x70BA,0x754F,0x7570,0x79FB,0x7DAD,0x7DEF,0x80C3,0x840E, +0x8863,0x8B02,0x9055,0x907A,0x533B,0x4E95,0x4EA5,0x57DF, +0x80B2,0x90C1,0x78EF,0x4E00,0x58F1,0x6EA2,0x9038,0x7A32, +0x8328,0x828B,0x9C2F,0x5141,0x5370,0x54BD,0x54E1,0x56E0, +0x59FB,0x5F15,0x98F2,0x6DEB,0x80E4,0x852D}; + +/* page 9 0x3121-0x317E */ +static uint16 tab_jisx0208_uni9[]={ +0x9662,0x9670,0x96A0,0x97FB,0x540B,0x53F3,0x5B87,0x70CF, +0x7FBD,0x8FC2,0x96E8,0x536F,0x9D5C,0x7ABA,0x4E11,0x7893, +0x81FC,0x6E26,0x5618,0x5504,0x6B1D,0x851A,0x9C3B,0x59E5, +0x53A9,0x6D66,0x74DC,0x958F,0x5642,0x4E91,0x904B,0x96F2, +0x834F,0x990C,0x53E1,0x55B6,0x5B30,0x5F71,0x6620,0x66F3, +0x6804,0x6C38,0x6CF3,0x6D29,0x745B,0x76C8,0x7A4E,0x9834, +0x82F1,0x885B,0x8A60,0x92ED,0x6DB2,0x75AB,0x76CA,0x99C5, +0x60A6,0x8B01,0x8D8A,0x95B2,0x698E,0x53AD,0x5186,0x5712, +0x5830,0x5944,0x5BB4,0x5EF6,0x6028,0x63A9,0x63F4,0x6CBF, +0x6F14,0x708E,0x7114,0x7159,0x71D5,0x733F,0x7E01,0x8276, +0x82D1,0x8597,0x9060,0x925B,0x9D1B,0x5869,0x65BC,0x6C5A, +0x7525,0x51F9,0x592E,0x5965,0x5F80,0x5FDC}; + +/* page 10 0x3221-0x327E */ +static uint16 tab_jisx0208_uni10[]={ +0x62BC,0x65FA,0x6A2A,0x6B27,0x6BB4,0x738B,0x7FC1,0x8956, +0x9D2C,0x9D0E,0x9EC4,0x5CA1,0x6C96,0x837B,0x5104,0x5C4B, +0x61B6,0x81C6,0x6876,0x7261,0x4E59,0x4FFA,0x5378,0x6069, +0x6E29,0x7A4F,0x97F3,0x4E0B,0x5316,0x4EEE,0x4F55,0x4F3D, +0x4FA1,0x4F73,0x52A0,0x53EF,0x5609,0x590F,0x5AC1,0x5BB6, +0x5BE1,0x79D1,0x6687,0x679C,0x67B6,0x6B4C,0x6CB3,0x706B, +0x73C2,0x798D,0x79BE,0x7A3C,0x7B87,0x82B1,0x82DB,0x8304, +0x8377,0x83EF,0x83D3,0x8766,0x8AB2,0x5629,0x8CA8,0x8FE6, +0x904E,0x971E,0x868A,0x4FC4,0x5CE8,0x6211,0x7259,0x753B, +0x81E5,0x82BD,0x86FE,0x8CC0,0x96C5,0x9913,0x99D5,0x4ECB, +0x4F1A,0x89E3,0x56DE,0x584A,0x58CA,0x5EFB,0x5FEB,0x602A, +0x6094,0x6062,0x61D0,0x6212,0x62D0,0x6539}; + +/* page 11 0x3321-0x337E */ +static uint16 tab_jisx0208_uni11[]={ +0x9B41,0x6666,0x68B0,0x6D77,0x7070,0x754C,0x7686,0x7D75, +0x82A5,0x87F9,0x958B,0x968E,0x8C9D,0x51F1,0x52BE,0x5916, +0x54B3,0x5BB3,0x5D16,0x6168,0x6982,0x6DAF,0x788D,0x84CB, +0x8857,0x8A72,0x93A7,0x9AB8,0x6D6C,0x99A8,0x86D9,0x57A3, +0x67FF,0x86CE,0x920E,0x5283,0x5687,0x5404,0x5ED3,0x62E1, +0x64B9,0x683C,0x6838,0x6BBB,0x7372,0x78BA,0x7A6B,0x899A, +0x89D2,0x8D6B,0x8F03,0x90ED,0x95A3,0x9694,0x9769,0x5B66, +0x5CB3,0x697D,0x984D,0x984E,0x639B,0x7B20,0x6A2B,0x6A7F, +0x68B6,0x9C0D,0x6F5F,0x5272,0x559D,0x6070,0x62EC,0x6D3B, +0x6E07,0x6ED1,0x845B,0x8910,0x8F44,0x4E14,0x9C39,0x53F6, +0x691B,0x6A3A,0x9784,0x682A,0x515C,0x7AC3,0x84B2,0x91DC, +0x938C,0x565B,0x9D28,0x6822,0x8305,0x8431}; + +/* page 12 0x3421-0x347E */ +static uint16 tab_jisx0208_uni12[]={ +0x7CA5,0x5208,0x82C5,0x74E6,0x4E7E,0x4F83,0x51A0,0x5BD2, +0x520A,0x52D8,0x52E7,0x5DFB,0x559A,0x582A,0x59E6,0x5B8C, +0x5B98,0x5BDB,0x5E72,0x5E79,0x60A3,0x611F,0x6163,0x61BE, +0x63DB,0x6562,0x67D1,0x6853,0x68FA,0x6B3E,0x6B53,0x6C57, +0x6F22,0x6F97,0x6F45,0x74B0,0x7518,0x76E3,0x770B,0x7AFF, +0x7BA1,0x7C21,0x7DE9,0x7F36,0x7FF0,0x809D,0x8266,0x839E, +0x89B3,0x8ACC,0x8CAB,0x9084,0x9451,0x9593,0x9591,0x95A2, +0x9665,0x97D3,0x9928,0x8218,0x4E38,0x542B,0x5CB8,0x5DCC, +0x73A9,0x764C,0x773C,0x5CA9,0x7FEB,0x8D0B,0x96C1,0x9811, +0x9854,0x9858,0x4F01,0x4F0E,0x5371,0x559C,0x5668,0x57FA, +0x5947,0x5B09,0x5BC4,0x5C90,0x5E0C,0x5E7E,0x5FCC,0x63EE, +0x673A,0x65D7,0x65E2,0x671F,0x68CB,0x68C4}; + +/* page 13 0x3521-0x357E */ +static uint16 tab_jisx0208_uni13[]={ +0x6A5F,0x5E30,0x6BC5,0x6C17,0x6C7D,0x757F,0x7948,0x5B63, +0x7A00,0x7D00,0x5FBD,0x898F,0x8A18,0x8CB4,0x8D77,0x8ECC, +0x8F1D,0x98E2,0x9A0E,0x9B3C,0x4E80,0x507D,0x5100,0x5993, +0x5B9C,0x622F,0x6280,0x64EC,0x6B3A,0x72A0,0x7591,0x7947, +0x7FA9,0x87FB,0x8ABC,0x8B70,0x63AC,0x83CA,0x97A0,0x5409, +0x5403,0x55AB,0x6854,0x6A58,0x8A70,0x7827,0x6775,0x9ECD, +0x5374,0x5BA2,0x811A,0x8650,0x9006,0x4E18,0x4E45,0x4EC7, +0x4F11,0x53CA,0x5438,0x5BAE,0x5F13,0x6025,0x6551,0x673D, +0x6C42,0x6C72,0x6CE3,0x7078,0x7403,0x7A76,0x7AAE,0x7B08, +0x7D1A,0x7CFE,0x7D66,0x65E7,0x725B,0x53BB,0x5C45,0x5DE8, +0x62D2,0x62E0,0x6319,0x6E20,0x865A,0x8A31,0x8DDD,0x92F8, +0x6F01,0x79A6,0x9B5A,0x4EA8,0x4EAB,0x4EAC}; + +/* page 14 0x3621-0x367E */ +static uint16 tab_jisx0208_uni14[]={ +0x4F9B,0x4FA0,0x50D1,0x5147,0x7AF6,0x5171,0x51F6,0x5354, +0x5321,0x537F,0x53EB,0x55AC,0x5883,0x5CE1,0x5F37,0x5F4A, +0x602F,0x6050,0x606D,0x631F,0x6559,0x6A4B,0x6CC1,0x72C2, +0x72ED,0x77EF,0x80F8,0x8105,0x8208,0x854E,0x90F7,0x93E1, +0x97FF,0x9957,0x9A5A,0x4EF0,0x51DD,0x5C2D,0x6681,0x696D, +0x5C40,0x66F2,0x6975,0x7389,0x6850,0x7C81,0x50C5,0x52E4, +0x5747,0x5DFE,0x9326,0x65A4,0x6B23,0x6B3D,0x7434,0x7981, +0x79BD,0x7B4B,0x7DCA,0x82B9,0x83CC,0x887F,0x895F,0x8B39, +0x8FD1,0x91D1,0x541F,0x9280,0x4E5D,0x5036,0x53E5,0x533A, +0x72D7,0x7396,0x77E9,0x82E6,0x8EAF,0x99C6,0x99C8,0x99D2, +0x5177,0x611A,0x865E,0x55B0,0x7A7A,0x5076,0x5BD3,0x9047, +0x9685,0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48}; + +/* page 15 0x3721-0x377E */ +static uint16 tab_jisx0208_uni15[]={ +0x6398,0x7A9F,0x6C93,0x9774,0x8F61,0x7AAA,0x718A,0x9688, +0x7C82,0x6817,0x7E70,0x6851,0x936C,0x52F2,0x541B,0x85AB, +0x8A13,0x7FA4,0x8ECD,0x90E1,0x5366,0x8888,0x7941,0x4FC2, +0x50BE,0x5211,0x5144,0x5553,0x572D,0x73EA,0x578B,0x5951, +0x5F62,0x5F84,0x6075,0x6176,0x6167,0x61A9,0x63B2,0x643A, +0x656C,0x666F,0x6842,0x6E13,0x7566,0x7A3D,0x7CFB,0x7D4C, +0x7D99,0x7E4B,0x7F6B,0x830E,0x834A,0x86CD,0x8A08,0x8A63, +0x8B66,0x8EFD,0x981A,0x9D8F,0x82B8,0x8FCE,0x9BE8,0x5287, +0x621F,0x6483,0x6FC0,0x9699,0x6841,0x5091,0x6B20,0x6C7A, +0x6F54,0x7A74,0x7D50,0x8840,0x8A23,0x6708,0x4EF6,0x5039, +0x5026,0x5065,0x517C,0x5238,0x5263,0x55A7,0x570F,0x5805, +0x5ACC,0x5EFA,0x61B2,0x61F8,0x62F3,0x6372}; + +/* page 16 0x3821-0x387E */ +static uint16 tab_jisx0208_uni16[]={ +0x691C,0x6A29,0x727D,0x72AC,0x732E,0x7814,0x786F,0x7D79, +0x770C,0x80A9,0x898B,0x8B19,0x8CE2,0x8ED2,0x9063,0x9375, +0x967A,0x9855,0x9A13,0x9E78,0x5143,0x539F,0x53B3,0x5E7B, +0x5F26,0x6E1B,0x6E90,0x7384,0x73FE,0x7D43,0x8237,0x8A00, +0x8AFA,0x9650,0x4E4E,0x500B,0x53E4,0x547C,0x56FA,0x59D1, +0x5B64,0x5DF1,0x5EAB,0x5F27,0x6238,0x6545,0x67AF,0x6E56, +0x72D0,0x7CCA,0x88B4,0x80A1,0x80E1,0x83F0,0x864E,0x8A87, +0x8DE8,0x9237,0x96C7,0x9867,0x9F13,0x4E94,0x4E92,0x4F0D, +0x5348,0x5449,0x543E,0x5A2F,0x5F8C,0x5FA1,0x609F,0x68A7, +0x6A8E,0x745A,0x7881,0x8A9E,0x8AA4,0x8B77,0x9190,0x4E5E, +0x9BC9,0x4EA4,0x4F7C,0x4FAF,0x5019,0x5016,0x5149,0x516C, +0x529F,0x52B9,0x52FE,0x539A,0x53E3,0x5411}; + +/* page 17 0x3921-0x397E */ +static uint16 tab_jisx0208_uni17[]={ +0x540E,0x5589,0x5751,0x57A2,0x597D,0x5B54,0x5B5D,0x5B8F, +0x5DE5,0x5DE7,0x5DF7,0x5E78,0x5E83,0x5E9A,0x5EB7,0x5F18, +0x6052,0x614C,0x6297,0x62D8,0x63A7,0x653B,0x6602,0x6643, +0x66F4,0x676D,0x6821,0x6897,0x69CB,0x6C5F,0x6D2A,0x6D69, +0x6E2F,0x6E9D,0x7532,0x7687,0x786C,0x7A3F,0x7CE0,0x7D05, +0x7D18,0x7D5E,0x7DB1,0x8015,0x8003,0x80AF,0x80B1,0x8154, +0x818F,0x822A,0x8352,0x884C,0x8861,0x8B1B,0x8CA2,0x8CFC, +0x90CA,0x9175,0x9271,0x783F,0x92FC,0x95A4,0x964D,0x9805, +0x9999,0x9AD8,0x9D3B,0x525B,0x52AB,0x53F7,0x5408,0x58D5, +0x62F7,0x6FE0,0x8C6A,0x8F5F,0x9EB9,0x514B,0x523B,0x544A, +0x56FD,0x7A40,0x9177,0x9D60,0x9ED2,0x7344,0x6F09,0x8170, +0x7511,0x5FFD,0x60DA,0x9AA8,0x72DB,0x8FBC}; + +/* page 18 0x3A21-0x3A7E */ +static uint16 tab_jisx0208_uni18[]={ +0x6B64,0x9803,0x4ECA,0x56F0,0x5764,0x58BE,0x5A5A,0x6068, +0x61C7,0x660F,0x6606,0x6839,0x68B1,0x6DF7,0x75D5,0x7D3A, +0x826E,0x9B42,0x4E9B,0x4F50,0x53C9,0x5506,0x5D6F,0x5DE6, +0x5DEE,0x67FB,0x6C99,0x7473,0x7802,0x8A50,0x9396,0x88DF, +0x5750,0x5EA7,0x632B,0x50B5,0x50AC,0x518D,0x6700,0x54C9, +0x585E,0x59BB,0x5BB0,0x5F69,0x624D,0x63A1,0x683D,0x6B73, +0x6E08,0x707D,0x91C7,0x7280,0x7815,0x7826,0x796D,0x658E, +0x7D30,0x83DC,0x88C1,0x8F09,0x969B,0x5264,0x5728,0x6750, +0x7F6A,0x8CA1,0x51B4,0x5742,0x962A,0x583A,0x698A,0x80B4, +0x54B2,0x5D0E,0x57FC,0x7895,0x9DFA,0x4F5C,0x524A,0x548B, +0x643E,0x6628,0x6714,0x67F5,0x7A84,0x7B56,0x7D22,0x932F, +0x685C,0x9BAD,0x7B39,0x5319,0x518A,0x5237}; + +/* page 19 0x3B21-0x3B7E */ +static uint16 tab_jisx0208_uni19[]={ +0x5BDF,0x62F6,0x64AE,0x64E6,0x672D,0x6BBA,0x85A9,0x96D1, +0x7690,0x9BD6,0x634C,0x9306,0x9BAB,0x76BF,0x6652,0x4E09, +0x5098,0x53C2,0x5C71,0x60E8,0x6492,0x6563,0x685F,0x71E6, +0x73CA,0x7523,0x7B97,0x7E82,0x8695,0x8B83,0x8CDB,0x9178, +0x9910,0x65AC,0x66AB,0x6B8B,0x4ED5,0x4ED4,0x4F3A,0x4F7F, +0x523A,0x53F8,0x53F2,0x55E3,0x56DB,0x58EB,0x59CB,0x59C9, +0x59FF,0x5B50,0x5C4D,0x5E02,0x5E2B,0x5FD7,0x601D,0x6307, +0x652F,0x5B5C,0x65AF,0x65BD,0x65E8,0x679D,0x6B62,0x6B7B, +0x6C0F,0x7345,0x7949,0x79C1,0x7CF8,0x7D19,0x7D2B,0x80A2, +0x8102,0x81F3,0x8996,0x8A5E,0x8A69,0x8A66,0x8A8C,0x8AEE, +0x8CC7,0x8CDC,0x96CC,0x98FC,0x6B6F,0x4E8B,0x4F3C,0x4F8D, +0x5150,0x5B57,0x5BFA,0x6148,0x6301,0x6642}; + +/* page 20 0x3C21-0x3C7E */ +static uint16 tab_jisx0208_uni20[]={ +0x6B21,0x6ECB,0x6CBB,0x723E,0x74BD,0x75D4,0x78C1,0x793A, +0x800C,0x8033,0x81EA,0x8494,0x8F9E,0x6C50,0x9E7F,0x5F0F, +0x8B58,0x9D2B,0x7AFA,0x8EF8,0x5B8D,0x96EB,0x4E03,0x53F1, +0x57F7,0x5931,0x5AC9,0x5BA4,0x6089,0x6E7F,0x6F06,0x75BE, +0x8CEA,0x5B9F,0x8500,0x7BE0,0x5072,0x67F4,0x829D,0x5C61, +0x854A,0x7E1E,0x820E,0x5199,0x5C04,0x6368,0x8D66,0x659C, +0x716E,0x793E,0x7D17,0x8005,0x8B1D,0x8ECA,0x906E,0x86C7, +0x90AA,0x501F,0x52FA,0x5C3A,0x6753,0x707C,0x7235,0x914C, +0x91C8,0x932B,0x82E5,0x5BC2,0x5F31,0x60F9,0x4E3B,0x53D6, +0x5B88,0x624B,0x6731,0x6B8A,0x72E9,0x73E0,0x7A2E,0x816B, +0x8DA3,0x9152,0x9996,0x5112,0x53D7,0x546A,0x5BFF,0x6388, +0x6A39,0x7DAC,0x9700,0x56DA,0x53CE,0x5468}; + +/* page 21 0x3D21-0x3D7E */ +static uint16 tab_jisx0208_uni21[]={ +0x5B97,0x5C31,0x5DDE,0x4FEE,0x6101,0x62FE,0x6D32,0x79C0, +0x79CB,0x7D42,0x7E4D,0x7FD2,0x81ED,0x821F,0x8490,0x8846, +0x8972,0x8B90,0x8E74,0x8F2F,0x9031,0x914B,0x916C,0x96C6, +0x919C,0x4EC0,0x4F4F,0x5145,0x5341,0x5F93,0x620E,0x67D4, +0x6C41,0x6E0B,0x7363,0x7E26,0x91CD,0x9283,0x53D4,0x5919, +0x5BBF,0x6DD1,0x795D,0x7E2E,0x7C9B,0x587E,0x719F,0x51FA, +0x8853,0x8FF0,0x4FCA,0x5CFB,0x6625,0x77AC,0x7AE3,0x821C, +0x99FF,0x51C6,0x5FAA,0x65EC,0x696F,0x6B89,0x6DF3,0x6E96, +0x6F64,0x76FE,0x7D14,0x5DE1,0x9075,0x9187,0x9806,0x51E6, +0x521D,0x6240,0x6691,0x66D9,0x6E1A,0x5EB6,0x7DD2,0x7F72, +0x66F8,0x85AF,0x85F7,0x8AF8,0x52A9,0x53D9,0x5973,0x5E8F, +0x5F90,0x6055,0x92E4,0x9664,0x50B7,0x511F}; + +/* page 22 0x3E21-0x3E7E */ +static uint16 tab_jisx0208_uni22[]={ +0x52DD,0x5320,0x5347,0x53EC,0x54E8,0x5546,0x5531,0x5617, +0x5968,0x59BE,0x5A3C,0x5BB5,0x5C06,0x5C0F,0x5C11,0x5C1A, +0x5E84,0x5E8A,0x5EE0,0x5F70,0x627F,0x6284,0x62DB,0x638C, +0x6377,0x6607,0x660C,0x662D,0x6676,0x677E,0x68A2,0x6A1F, +0x6A35,0x6CBC,0x6D88,0x6E09,0x6E58,0x713C,0x7126,0x7167, +0x75C7,0x7701,0x785D,0x7901,0x7965,0x79F0,0x7AE0,0x7B11, +0x7CA7,0x7D39,0x8096,0x83D6,0x848B,0x8549,0x885D,0x88F3, +0x8A1F,0x8A3C,0x8A54,0x8A73,0x8C61,0x8CDE,0x91A4,0x9266, +0x937E,0x9418,0x969C,0x9798,0x4E0A,0x4E08,0x4E1E,0x4E57, +0x5197,0x5270,0x57CE,0x5834,0x58CC,0x5B22,0x5E38,0x60C5, +0x64FE,0x6761,0x6756,0x6D44,0x72B6,0x7573,0x7A63,0x84B8, +0x8B72,0x91B8,0x9320,0x5631,0x57F4,0x98FE}; + +/* page 23 0x3F21-0x3F7E */ +static uint16 tab_jisx0208_uni23[]={ +0x62ED,0x690D,0x6B96,0x71ED,0x7E54,0x8077,0x8272,0x89E6, +0x98DF,0x8755,0x8FB1,0x5C3B,0x4F38,0x4FE1,0x4FB5,0x5507, +0x5A20,0x5BDD,0x5BE9,0x5FC3,0x614E,0x632F,0x65B0,0x664B, +0x68EE,0x699B,0x6D78,0x6DF1,0x7533,0x75B9,0x771F,0x795E, +0x79E6,0x7D33,0x81E3,0x82AF,0x85AA,0x89AA,0x8A3A,0x8EAB, +0x8F9B,0x9032,0x91DD,0x9707,0x4EBA,0x4EC1,0x5203,0x5875, +0x58EC,0x5C0B,0x751A,0x5C3D,0x814E,0x8A0A,0x8FC5,0x9663, +0x976D,0x7B25,0x8ACF,0x9808,0x9162,0x56F3,0x53A8,0x9017, +0x5439,0x5782,0x5E25,0x63A8,0x6C34,0x708A,0x7761,0x7C8B, +0x7FE0,0x8870,0x9042,0x9154,0x9310,0x9318,0x968F,0x745E, +0x9AC4,0x5D07,0x5D69,0x6570,0x67A2,0x8DA8,0x96DB,0x636E, +0x6749,0x6919,0x83C5,0x9817,0x96C0,0x88FE}; + +/* page 24 0x4021-0x407E */ +static uint16 tab_jisx0208_uni24[]={ +0x6F84,0x647A,0x5BF8,0x4E16,0x702C,0x755D,0x662F,0x51C4, +0x5236,0x52E2,0x59D3,0x5F81,0x6027,0x6210,0x653F,0x6574, +0x661F,0x6674,0x68F2,0x6816,0x6B63,0x6E05,0x7272,0x751F, +0x76DB,0x7CBE,0x8056,0x58F0,0x88FD,0x897F,0x8AA0,0x8A93, +0x8ACB,0x901D,0x9192,0x9752,0x9759,0x6589,0x7A0E,0x8106, +0x96BB,0x5E2D,0x60DC,0x621A,0x65A5,0x6614,0x6790,0x77F3, +0x7A4D,0x7C4D,0x7E3E,0x810A,0x8CAC,0x8D64,0x8DE1,0x8E5F, +0x78A9,0x5207,0x62D9,0x63A5,0x6442,0x6298,0x8A2D,0x7A83, +0x7BC0,0x8AAC,0x96EA,0x7D76,0x820C,0x8749,0x4ED9,0x5148, +0x5343,0x5360,0x5BA3,0x5C02,0x5C16,0x5DDD,0x6226,0x6247, +0x64B0,0x6813,0x6834,0x6CC9,0x6D45,0x6D17,0x67D3,0x6F5C, +0x714E,0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA}; + +/* page 25 0x4121-0x417E */ +static uint16 tab_jisx0208_uni25[]={ +0x7E4A,0x7FA8,0x817A,0x821B,0x8239,0x85A6,0x8A6E,0x8CCE, +0x8DF5,0x9078,0x9077,0x92AD,0x9291,0x9583,0x9BAE,0x524D, +0x5584,0x6F38,0x7136,0x5168,0x7985,0x7E55,0x81B3,0x7CCE, +0x564C,0x5851,0x5CA8,0x63AA,0x66FE,0x66FD,0x695A,0x72D9, +0x758F,0x758E,0x790E,0x7956,0x79DF,0x7C97,0x7D20,0x7D44, +0x8607,0x8A34,0x963B,0x9061,0x9F20,0x50E7,0x5275,0x53CC, +0x53E2,0x5009,0x55AA,0x58EE,0x594F,0x723D,0x5B8B,0x5C64, +0x531D,0x60E3,0x60F3,0x635C,0x6383,0x633F,0x63BB,0x64CD, +0x65E9,0x66F9,0x5DE3,0x69CD,0x69FD,0x6F15,0x71E5,0x4E89, +0x75E9,0x76F8,0x7A93,0x7CDF,0x7DCF,0x7D9C,0x8061,0x8349, +0x8358,0x846C,0x84BC,0x85FB,0x88C5,0x8D70,0x9001,0x906D, +0x9397,0x971C,0x9A12,0x50CF,0x5897,0x618E}; + +/* page 26 0x4221-0x427E */ +static uint16 tab_jisx0208_uni26[]={ +0x81D3,0x8535,0x8D08,0x9020,0x4FC3,0x5074,0x5247,0x5373, +0x606F,0x6349,0x675F,0x6E2C,0x8DB3,0x901F,0x4FD7,0x5C5E, +0x8CCA,0x65CF,0x7D9A,0x5352,0x8896,0x5176,0x63C3,0x5B58, +0x5B6B,0x5C0A,0x640D,0x6751,0x905C,0x4ED6,0x591A,0x592A, +0x6C70,0x8A51,0x553E,0x5815,0x59A5,0x60F0,0x6253,0x67C1, +0x8235,0x6955,0x9640,0x99C4,0x9A28,0x4F53,0x5806,0x5BFE, +0x8010,0x5CB1,0x5E2F,0x5F85,0x6020,0x614B,0x6234,0x66FF, +0x6CF0,0x6EDE,0x80CE,0x817F,0x82D4,0x888B,0x8CB8,0x9000, +0x902E,0x968A,0x9EDB,0x9BDB,0x4EE3,0x53F0,0x5927,0x7B2C, +0x918D,0x984C,0x9DF9,0x6EDD,0x7027,0x5353,0x5544,0x5B85, +0x6258,0x629E,0x62D3,0x6CA2,0x6FEF,0x7422,0x8A17,0x9438, +0x6FC1,0x8AFE,0x8338,0x51E7,0x86F8,0x53EA}; + +/* page 27 0x4321-0x437E */ +static uint16 tab_jisx0208_uni27[]={ +0x53E9,0x4F46,0x9054,0x8FB0,0x596A,0x8131,0x5DFD,0x7AEA, +0x8FBF,0x68DA,0x8C37,0x72F8,0x9C48,0x6A3D,0x8AB0,0x4E39, +0x5358,0x5606,0x5766,0x62C5,0x63A2,0x65E6,0x6B4E,0x6DE1, +0x6E5B,0x70AD,0x77ED,0x7AEF,0x7BAA,0x7DBB,0x803D,0x80C6, +0x86CB,0x8A95,0x935B,0x56E3,0x58C7,0x5F3E,0x65AD,0x6696, +0x6A80,0x6BB5,0x7537,0x8AC7,0x5024,0x77E5,0x5730,0x5F1B, +0x6065,0x667A,0x6C60,0x75F4,0x7A1A,0x7F6E,0x81F4,0x8718, +0x9045,0x99B3,0x7BC9,0x755C,0x7AF9,0x7B51,0x84C4,0x9010, +0x79E9,0x7A92,0x8336,0x5AE1,0x7740,0x4E2D,0x4EF2,0x5B99, +0x5FE0,0x62BD,0x663C,0x67F1,0x6CE8,0x866B,0x8877,0x8A3B, +0x914E,0x92F3,0x99D0,0x6A17,0x7026,0x732A,0x82E7,0x8457, +0x8CAF,0x4E01,0x5146,0x51CB,0x558B,0x5BF5}; + +/* page 28 0x4421-0x447E */ +static uint16 tab_jisx0208_uni28[]={ +0x5E16,0x5E33,0x5E81,0x5F14,0x5F35,0x5F6B,0x5FB4,0x61F2, +0x6311,0x66A2,0x671D,0x6F6E,0x7252,0x753A,0x773A,0x8074, +0x8139,0x8178,0x8776,0x8ABF,0x8ADC,0x8D85,0x8DF3,0x929A, +0x9577,0x9802,0x9CE5,0x52C5,0x6357,0x76F4,0x6715,0x6C88, +0x73CD,0x8CC3,0x93AE,0x9673,0x6D25,0x589C,0x690E,0x69CC, +0x8FFD,0x939A,0x75DB,0x901A,0x585A,0x6802,0x63B4,0x69FB, +0x4F43,0x6F2C,0x67D8,0x8FBB,0x8526,0x7DB4,0x9354,0x693F, +0x6F70,0x576A,0x58F7,0x5B2C,0x7D2C,0x722A,0x540A,0x91E3, +0x9DB4,0x4EAD,0x4F4E,0x505C,0x5075,0x5243,0x8C9E,0x5448, +0x5824,0x5B9A,0x5E1D,0x5E95,0x5EAD,0x5EF7,0x5F1F,0x608C, +0x62B5,0x633A,0x63D0,0x68AF,0x6C40,0x7887,0x798E,0x7A0B, +0x7DE0,0x8247,0x8A02,0x8AE6,0x8E44,0x9013}; + +/* page 29 0x4521-0x457E */ +static uint16 tab_jisx0208_uni29[]={ +0x90B8,0x912D,0x91D8,0x9F0E,0x6CE5,0x6458,0x64E2,0x6575, +0x6EF4,0x7684,0x7B1B,0x9069,0x93D1,0x6EBA,0x54F2,0x5FB9, +0x64A4,0x8F4D,0x8FED,0x9244,0x5178,0x586B,0x5929,0x5C55, +0x5E97,0x6DFB,0x7E8F,0x751C,0x8CBC,0x8EE2,0x985B,0x70B9, +0x4F1D,0x6BBF,0x6FB1,0x7530,0x96FB,0x514E,0x5410,0x5835, +0x5857,0x59AC,0x5C60,0x5F92,0x6597,0x675C,0x6E21,0x767B, +0x83DF,0x8CED,0x9014,0x90FD,0x934D,0x7825,0x783A,0x52AA, +0x5EA6,0x571F,0x5974,0x6012,0x5012,0x515A,0x51AC,0x51CD, +0x5200,0x5510,0x5854,0x5858,0x5957,0x5B95,0x5CF6,0x5D8B, +0x60BC,0x6295,0x642D,0x6771,0x6843,0x68BC,0x68DF,0x76D7, +0x6DD8,0x6E6F,0x6D9B,0x706F,0x71C8,0x5F53,0x75D8,0x7977, +0x7B49,0x7B54,0x7B52,0x7CD6,0x7D71,0x5230}; + +/* page 30 0x4621-0x467E */ +static uint16 tab_jisx0208_uni30[]={ +0x8463,0x8569,0x85E4,0x8A0E,0x8B04,0x8C46,0x8E0F,0x9003, +0x900F,0x9419,0x9676,0x982D,0x9A30,0x95D8,0x50CD,0x52D5, +0x540C,0x5802,0x5C0E,0x61A7,0x649E,0x6D1E,0x77B3,0x7AE5, +0x80F4,0x8404,0x9053,0x9285,0x5CE0,0x9D07,0x533F,0x5F97, +0x5FB3,0x6D9C,0x7279,0x7763,0x79BF,0x7BE4,0x6BD2,0x72EC, +0x8AAD,0x6803,0x6A61,0x51F8,0x7A81,0x6934,0x5C4A,0x9CF6, +0x82EB,0x5BC5,0x9149,0x701E,0x5678,0x5C6F,0x60C7,0x6566, +0x6C8C,0x8C5A,0x9041,0x9813,0x5451,0x66C7,0x920D,0x5948, +0x90A3,0x5185,0x4E4D,0x51EA,0x8599,0x8B0E,0x7058,0x637A, +0x934B,0x6962,0x99B4,0x7E04,0x7577,0x5357,0x6960,0x8EDF, +0x96E3,0x6C5D,0x4E8C,0x5C3C,0x5F10,0x8FE9,0x5302,0x8CD1, +0x8089,0x8679,0x5EFF,0x65E5,0x4E73,0x5165}; + +/* page 31 0x4721-0x477E */ +static uint16 tab_jisx0208_uni31[]={ +0x5982,0x5C3F,0x97EE,0x4EFB,0x598A,0x5FCD,0x8A8D,0x6FE1, +0x79B0,0x7962,0x5BE7,0x8471,0x732B,0x71B1,0x5E74,0x5FF5, +0x637B,0x649A,0x71C3,0x7C98,0x4E43,0x5EFC,0x4E4B,0x57DC, +0x56A2,0x60A9,0x6FC3,0x7D0D,0x80FD,0x8133,0x81BF,0x8FB2, +0x8997,0x86A4,0x5DF4,0x628A,0x64AD,0x8987,0x6777,0x6CE2, +0x6D3E,0x7436,0x7834,0x5A46,0x7F75,0x82AD,0x99AC,0x4FF3, +0x5EC3,0x62DD,0x6392,0x6557,0x676F,0x76C3,0x724C,0x80CC, +0x80BA,0x8F29,0x914D,0x500D,0x57F9,0x5A92,0x6885,0x6973, +0x7164,0x72FD,0x8CB7,0x58F2,0x8CE0,0x966A,0x9019,0x877F, +0x79E4,0x77E7,0x8429,0x4F2F,0x5265,0x535A,0x62CD,0x67CF, +0x6CCA,0x767D,0x7B94,0x7C95,0x8236,0x8584,0x8FEB,0x66DD, +0x6F20,0x7206,0x7E1B,0x83AB,0x99C1,0x9EA6}; + +/* page 32 0x4821-0x487E */ +static uint16 tab_jisx0208_uni32[]={ +0x51FD,0x7BB1,0x7872,0x7BB8,0x8087,0x7B48,0x6AE8,0x5E61, +0x808C,0x7551,0x7560,0x516B,0x9262,0x6E8C,0x767A,0x9197, +0x9AEA,0x4F10,0x7F70,0x629C,0x7B4F,0x95A5,0x9CE9,0x567A, +0x5859,0x86E4,0x96BC,0x4F34,0x5224,0x534A,0x53CD,0x53DB, +0x5E06,0x642C,0x6591,0x677F,0x6C3E,0x6C4E,0x7248,0x72AF, +0x73ED,0x7554,0x7E41,0x822C,0x85E9,0x8CA9,0x7BC4,0x91C6, +0x7169,0x9812,0x98EF,0x633D,0x6669,0x756A,0x76E4,0x78D0, +0x8543,0x86EE,0x532A,0x5351,0x5426,0x5983,0x5E87,0x5F7C, +0x60B2,0x6249,0x6279,0x62AB,0x6590,0x6BD4,0x6CCC,0x75B2, +0x76AE,0x7891,0x79D8,0x7DCB,0x7F77,0x80A5,0x88AB,0x8AB9, +0x8CBB,0x907F,0x975E,0x98DB,0x6A0B,0x7C38,0x5099,0x5C3E, +0x5FAE,0x6787,0x6BD8,0x7435,0x7709,0x7F8E}; + +/* page 33 0x4921-0x497E */ +static uint16 tab_jisx0208_uni33[]={ +0x9F3B,0x67CA,0x7A17,0x5339,0x758B,0x9AED,0x5F66,0x819D, +0x83F1,0x8098,0x5F3C,0x5FC5,0x7562,0x7B46,0x903C,0x6867, +0x59EB,0x5A9B,0x7D10,0x767E,0x8B2C,0x4FF5,0x5F6A,0x6A19, +0x6C37,0x6F02,0x74E2,0x7968,0x8868,0x8A55,0x8C79,0x5EDF, +0x63CF,0x75C5,0x79D2,0x82D7,0x9328,0x92F2,0x849C,0x86ED, +0x9C2D,0x54C1,0x5F6C,0x658C,0x6D5C,0x7015,0x8CA7,0x8CD3, +0x983B,0x654F,0x74F6,0x4E0D,0x4ED8,0x57E0,0x592B,0x5A66, +0x5BCC,0x51A8,0x5E03,0x5E9C,0x6016,0x6276,0x6577,0x65A7, +0x666E,0x6D6E,0x7236,0x7B26,0x8150,0x819A,0x8299,0x8B5C, +0x8CA0,0x8CE6,0x8D74,0x961C,0x9644,0x4FAE,0x64AB,0x6B66, +0x821E,0x8461,0x856A,0x90E8,0x5C01,0x6953,0x98A8,0x847A, +0x8557,0x4F0F,0x526F,0x5FA9,0x5E45,0x670D}; + +/* page 34 0x4A21-0x4A7E */ +static uint16 tab_jisx0208_uni34[]={ +0x798F,0x8179,0x8907,0x8986,0x6DF5,0x5F17,0x6255,0x6CB8, +0x4ECF,0x7269,0x9B92,0x5206,0x543B,0x5674,0x58B3,0x61A4, +0x626E,0x711A,0x596E,0x7C89,0x7CDE,0x7D1B,0x96F0,0x6587, +0x805E,0x4E19,0x4F75,0x5175,0x5840,0x5E63,0x5E73,0x5F0A, +0x67C4,0x4E26,0x853D,0x9589,0x965B,0x7C73,0x9801,0x50FB, +0x58C1,0x7656,0x78A7,0x5225,0x77A5,0x8511,0x7B86,0x504F, +0x5909,0x7247,0x7BC7,0x7DE8,0x8FBA,0x8FD4,0x904D,0x4FBF, +0x52C9,0x5A29,0x5F01,0x97AD,0x4FDD,0x8217,0x92EA,0x5703, +0x6355,0x6B69,0x752B,0x88DC,0x8F14,0x7A42,0x52DF,0x5893, +0x6155,0x620A,0x66AE,0x6BCD,0x7C3F,0x83E9,0x5023,0x4FF8, +0x5305,0x5446,0x5831,0x5949,0x5B9D,0x5CF0,0x5CEF,0x5D29, +0x5E96,0x62B1,0x6367,0x653E,0x65B9,0x670B}; + +/* page 35 0x4B21-0x4B7E */ +static uint16 tab_jisx0208_uni35[]={ +0x6CD5,0x6CE1,0x70F9,0x7832,0x7E2B,0x80DE,0x82B3,0x840C, +0x84EC,0x8702,0x8912,0x8A2A,0x8C4A,0x90A6,0x92D2,0x98FD, +0x9CF3,0x9D6C,0x4E4F,0x4EA1,0x508D,0x5256,0x574A,0x59A8, +0x5E3D,0x5FD8,0x5FD9,0x623F,0x66B4,0x671B,0x67D0,0x68D2, +0x5192,0x7D21,0x80AA,0x81A8,0x8B00,0x8C8C,0x8CBF,0x927E, +0x9632,0x5420,0x982C,0x5317,0x50D5,0x535C,0x58A8,0x64B2, +0x6734,0x7267,0x7766,0x7A46,0x91E6,0x52C3,0x6CA1,0x6B86, +0x5800,0x5E4C,0x5954,0x672C,0x7FFB,0x51E1,0x76C6,0x6469, +0x78E8,0x9B54,0x9EBB,0x57CB,0x59B9,0x6627,0x679A,0x6BCE, +0x54E9,0x69D9,0x5E55,0x819C,0x6795,0x9BAA,0x67FE,0x9C52, +0x685D,0x4EA6,0x4FE3,0x53C8,0x62B9,0x672B,0x6CAB,0x8FC4, +0x4FAD,0x7E6D,0x9EBF,0x4E07,0x6162,0x6E80}; + +/* page 36 0x4C21-0x4C7E */ +static uint16 tab_jisx0208_uni36[]={ +0x6F2B,0x8513,0x5473,0x672A,0x9B45,0x5DF3,0x7B95,0x5CAC, +0x5BC6,0x871C,0x6E4A,0x84D1,0x7A14,0x8108,0x5999,0x7C8D, +0x6C11,0x7720,0x52D9,0x5922,0x7121,0x725F,0x77DB,0x9727, +0x9D61,0x690B,0x5A7F,0x5A18,0x51A5,0x540D,0x547D,0x660E, +0x76DF,0x8FF7,0x9298,0x9CF4,0x59EA,0x725D,0x6EC5,0x514D, +0x68C9,0x7DBF,0x7DEC,0x9762,0x9EBA,0x6478,0x6A21,0x8302, +0x5984,0x5B5F,0x6BDB,0x731B,0x76F2,0x7DB2,0x8017,0x8499, +0x5132,0x6728,0x9ED9,0x76EE,0x6762,0x52FF,0x9905,0x5C24, +0x623B,0x7C7E,0x8CB0,0x554F,0x60B6,0x7D0B,0x9580,0x5301, +0x4E5F,0x51B6,0x591C,0x723A,0x8036,0x91CE,0x5F25,0x77E2, +0x5384,0x5F79,0x7D04,0x85AC,0x8A33,0x8E8D,0x9756,0x67F3, +0x85AE,0x9453,0x6109,0x6108,0x6CB9,0x7652}; + +/* page 37 0x4D21-0x4D7E */ +static uint16 tab_jisx0208_uni37[]={ +0x8AED,0x8F38,0x552F,0x4F51,0x512A,0x52C7,0x53CB,0x5BA5, +0x5E7D,0x60A0,0x6182,0x63D6,0x6709,0x67DA,0x6E67,0x6D8C, +0x7336,0x7337,0x7531,0x7950,0x88D5,0x8A98,0x904A,0x9091, +0x90F5,0x96C4,0x878D,0x5915,0x4E88,0x4F59,0x4E0E,0x8A89, +0x8F3F,0x9810,0x50AD,0x5E7C,0x5996,0x5BB9,0x5EB8,0x63DA, +0x63FA,0x64C1,0x66DC,0x694A,0x69D8,0x6D0B,0x6EB6,0x7194, +0x7528,0x7AAF,0x7F8A,0x8000,0x8449,0x84C9,0x8981,0x8B21, +0x8E0A,0x9065,0x967D,0x990A,0x617E,0x6291,0x6B32,0x6C83, +0x6D74,0x7FCC,0x7FFC,0x6DC0,0x7F85,0x87BA,0x88F8,0x6765, +0x83B1,0x983C,0x96F7,0x6D1B,0x7D61,0x843D,0x916A,0x4E71, +0x5375,0x5D50,0x6B04,0x6FEB,0x85CD,0x862D,0x89A7,0x5229, +0x540F,0x5C65,0x674E,0x68A8,0x7406,0x7483}; + +/* page 38 0x4E21-0x4E7E */ +static uint16 tab_jisx0208_uni38[]={ +0x75E2,0x88CF,0x88E1,0x91CC,0x96E2,0x9678,0x5F8B,0x7387, +0x7ACB,0x844E,0x63A0,0x7565,0x5289,0x6D41,0x6E9C,0x7409, +0x7559,0x786B,0x7C92,0x9686,0x7ADC,0x9F8D,0x4FB6,0x616E, +0x65C5,0x865C,0x4E86,0x4EAE,0x50DA,0x4E21,0x51CC,0x5BEE, +0x6599,0x6881,0x6DBC,0x731F,0x7642,0x77AD,0x7A1C,0x7CE7, +0x826F,0x8AD2,0x907C,0x91CF,0x9675,0x9818,0x529B,0x7DD1, +0x502B,0x5398,0x6797,0x6DCB,0x71D0,0x7433,0x81E8,0x8F2A, +0x96A3,0x9C57,0x9E9F,0x7460,0x5841,0x6D99,0x7D2F,0x985E, +0x4EE4,0x4F36,0x4F8B,0x51B7,0x52B1,0x5DBA,0x601C,0x73B2, +0x793C,0x82D3,0x9234,0x96B7,0x96F6,0x970A,0x9E97,0x9F62, +0x66A6,0x6B74,0x5217,0x52A3,0x70C8,0x88C2,0x5EC9,0x604B, +0x6190,0x6F23,0x7149,0x7C3E,0x7DF4,0x806F}; + +/* page 39 0x4F21-0x4F53 */ +static uint16 tab_jisx0208_uni39[]={ +0x84EE,0x9023,0x932C,0x5442,0x9B6F,0x6AD3,0x7089,0x8CC2, +0x8DEF,0x9732,0x52B4,0x5A41,0x5ECA,0x5F04,0x6717,0x697C, +0x6994,0x6D6A,0x6F0F,0x7262,0x72FC,0x7BED,0x8001,0x807E, +0x874B,0x90CE,0x516D,0x9E93,0x7984,0x808B,0x9332,0x8AD6, +0x502D,0x548C,0x8A71,0x6B6A,0x8CC4,0x8107,0x60D1,0x67A0, +0x9DF2,0x4E99,0x4E98,0x9C10,0x8A6B,0x85C1,0x8568,0x6900, +0x6E7E,0x7897,0x8155}; + +/* page 40 0x5021-0x507E */ +static uint16 tab_jisx0208_uni40[]={ +0x5F0C,0x4E10,0x4E15,0x4E2A,0x4E31,0x4E36,0x4E3C,0x4E3F, +0x4E42,0x4E56,0x4E58,0x4E82,0x4E85,0x8C6B,0x4E8A,0x8212, +0x5F0D,0x4E8E,0x4E9E,0x4E9F,0x4EA0,0x4EA2,0x4EB0,0x4EB3, +0x4EB6,0x4ECE,0x4ECD,0x4EC4,0x4EC6,0x4EC2,0x4ED7,0x4EDE, +0x4EED,0x4EDF,0x4EF7,0x4F09,0x4F5A,0x4F30,0x4F5B,0x4F5D, +0x4F57,0x4F47,0x4F76,0x4F88,0x4F8F,0x4F98,0x4F7B,0x4F69, +0x4F70,0x4F91,0x4F6F,0x4F86,0x4F96,0x5118,0x4FD4,0x4FDF, +0x4FCE,0x4FD8,0x4FDB,0x4FD1,0x4FDA,0x4FD0,0x4FE4,0x4FE5, +0x501A,0x5028,0x5014,0x502A,0x5025,0x5005,0x4F1C,0x4FF6, +0x5021,0x5029,0x502C,0x4FFE,0x4FEF,0x5011,0x5006,0x5043, +0x5047,0x6703,0x5055,0x5050,0x5048,0x505A,0x5056,0x506C, +0x5078,0x5080,0x509A,0x5085,0x50B4,0x50B2}; + +/* page 41 0x5121-0x517E */ +static uint16 tab_jisx0208_uni41[]={ +0x50C9,0x50CA,0x50B3,0x50C2,0x50D6,0x50DE,0x50E5,0x50ED, +0x50E3,0x50EE,0x50F9,0x50F5,0x5109,0x5101,0x5102,0x5116, +0x5115,0x5114,0x511A,0x5121,0x513A,0x5137,0x513C,0x513B, +0x513F,0x5140,0x5152,0x514C,0x5154,0x5162,0x7AF8,0x5169, +0x516A,0x516E,0x5180,0x5182,0x56D8,0x518C,0x5189,0x518F, +0x5191,0x5193,0x5195,0x5196,0x51A4,0x51A6,0x51A2,0x51A9, +0x51AA,0x51AB,0x51B3,0x51B1,0x51B2,0x51B0,0x51B5,0x51BD, +0x51C5,0x51C9,0x51DB,0x51E0,0x8655,0x51E9,0x51ED,0x51F0, +0x51F5,0x51FE,0x5204,0x520B,0x5214,0x520E,0x5227,0x522A, +0x522E,0x5233,0x5239,0x524F,0x5244,0x524B,0x524C,0x525E, +0x5254,0x526A,0x5274,0x5269,0x5273,0x527F,0x527D,0x528D, +0x5294,0x5292,0x5271,0x5288,0x5291,0x8FA8}; + +/* page 42 0x5221-0x527E */ +static uint16 tab_jisx0208_uni42[]={ +0x8FA7,0x52AC,0x52AD,0x52BC,0x52B5,0x52C1,0x52CD,0x52D7, +0x52DE,0x52E3,0x52E6,0x98ED,0x52E0,0x52F3,0x52F5,0x52F8, +0x52F9,0x5306,0x5308,0x7538,0x530D,0x5310,0x530F,0x5315, +0x531A,0x5323,0x532F,0x5331,0x5333,0x5338,0x5340,0x5346, +0x5345,0x4E17,0x5349,0x534D,0x51D6,0x535E,0x5369,0x536E, +0x5918,0x537B,0x5377,0x5382,0x5396,0x53A0,0x53A6,0x53A5, +0x53AE,0x53B0,0x53B6,0x53C3,0x7C12,0x96D9,0x53DF,0x66FC, +0x71EE,0x53EE,0x53E8,0x53ED,0x53FA,0x5401,0x543D,0x5440, +0x542C,0x542D,0x543C,0x542E,0x5436,0x5429,0x541D,0x544E, +0x548F,0x5475,0x548E,0x545F,0x5471,0x5477,0x5470,0x5492, +0x547B,0x5480,0x5476,0x5484,0x5490,0x5486,0x54C7,0x54A2, +0x54B8,0x54A5,0x54AC,0x54C4,0x54C8,0x54A8}; + +/* page 43 0x5321-0x537E */ +static uint16 tab_jisx0208_uni43[]={ +0x54AB,0x54C2,0x54A4,0x54BE,0x54BC,0x54D8,0x54E5,0x54E6, +0x550F,0x5514,0x54FD,0x54EE,0x54ED,0x54FA,0x54E2,0x5539, +0x5540,0x5563,0x554C,0x552E,0x555C,0x5545,0x5556,0x5557, +0x5538,0x5533,0x555D,0x5599,0x5580,0x54AF,0x558A,0x559F, +0x557B,0x557E,0x5598,0x559E,0x55AE,0x557C,0x5583,0x55A9, +0x5587,0x55A8,0x55DA,0x55C5,0x55DF,0x55C4,0x55DC,0x55E4, +0x55D4,0x5614,0x55F7,0x5616,0x55FE,0x55FD,0x561B,0x55F9, +0x564E,0x5650,0x71DF,0x5634,0x5636,0x5632,0x5638,0x566B, +0x5664,0x562F,0x566C,0x566A,0x5686,0x5680,0x568A,0x56A0, +0x5694,0x568F,0x56A5,0x56AE,0x56B6,0x56B4,0x56C2,0x56BC, +0x56C1,0x56C3,0x56C0,0x56C8,0x56CE,0x56D1,0x56D3,0x56D7, +0x56EE,0x56F9,0x5700,0x56FF,0x5704,0x5709}; + +/* page 44 0x5421-0x547E */ +static uint16 tab_jisx0208_uni44[]={ +0x5708,0x570B,0x570D,0x5713,0x5718,0x5716,0x55C7,0x571C, +0x5726,0x5737,0x5738,0x574E,0x573B,0x5740,0x574F,0x5769, +0x57C0,0x5788,0x5761,0x577F,0x5789,0x5793,0x57A0,0x57B3, +0x57A4,0x57AA,0x57B0,0x57C3,0x57C6,0x57D4,0x57D2,0x57D3, +0x580A,0x57D6,0x57E3,0x580B,0x5819,0x581D,0x5872,0x5821, +0x5862,0x584B,0x5870,0x6BC0,0x5852,0x583D,0x5879,0x5885, +0x58B9,0x589F,0x58AB,0x58BA,0x58DE,0x58BB,0x58B8,0x58AE, +0x58C5,0x58D3,0x58D1,0x58D7,0x58D9,0x58D8,0x58E5,0x58DC, +0x58E4,0x58DF,0x58EF,0x58FA,0x58F9,0x58FB,0x58FC,0x58FD, +0x5902,0x590A,0x5910,0x591B,0x68A6,0x5925,0x592C,0x592D, +0x5932,0x5938,0x593E,0x7AD2,0x5955,0x5950,0x594E,0x595A, +0x5958,0x5962,0x5960,0x5967,0x596C,0x5969}; + +/* page 45 0x5521-0x557E */ +static uint16 tab_jisx0208_uni45[]={ +0x5978,0x5981,0x599D,0x4F5E,0x4FAB,0x59A3,0x59B2,0x59C6, +0x59E8,0x59DC,0x598D,0x59D9,0x59DA,0x5A25,0x5A1F,0x5A11, +0x5A1C,0x5A09,0x5A1A,0x5A40,0x5A6C,0x5A49,0x5A35,0x5A36, +0x5A62,0x5A6A,0x5A9A,0x5ABC,0x5ABE,0x5ACB,0x5AC2,0x5ABD, +0x5AE3,0x5AD7,0x5AE6,0x5AE9,0x5AD6,0x5AFA,0x5AFB,0x5B0C, +0x5B0B,0x5B16,0x5B32,0x5AD0,0x5B2A,0x5B36,0x5B3E,0x5B43, +0x5B45,0x5B40,0x5B51,0x5B55,0x5B5A,0x5B5B,0x5B65,0x5B69, +0x5B70,0x5B73,0x5B75,0x5B78,0x6588,0x5B7A,0x5B80,0x5B83, +0x5BA6,0x5BB8,0x5BC3,0x5BC7,0x5BC9,0x5BD4,0x5BD0,0x5BE4, +0x5BE6,0x5BE2,0x5BDE,0x5BE5,0x5BEB,0x5BF0,0x5BF6,0x5BF3, +0x5C05,0x5C07,0x5C08,0x5C0D,0x5C13,0x5C20,0x5C22,0x5C28, +0x5C38,0x5C39,0x5C41,0x5C46,0x5C4E,0x5C53}; + +/* page 46 0x5621-0x567E */ +static uint16 tab_jisx0208_uni46[]={ +0x5C50,0x5C4F,0x5B71,0x5C6C,0x5C6E,0x4E62,0x5C76,0x5C79, +0x5C8C,0x5C91,0x5C94,0x599B,0x5CAB,0x5CBB,0x5CB6,0x5CBC, +0x5CB7,0x5CC5,0x5CBE,0x5CC7,0x5CD9,0x5CE9,0x5CFD,0x5CFA, +0x5CED,0x5D8C,0x5CEA,0x5D0B,0x5D15,0x5D17,0x5D5C,0x5D1F, +0x5D1B,0x5D11,0x5D14,0x5D22,0x5D1A,0x5D19,0x5D18,0x5D4C, +0x5D52,0x5D4E,0x5D4B,0x5D6C,0x5D73,0x5D76,0x5D87,0x5D84, +0x5D82,0x5DA2,0x5D9D,0x5DAC,0x5DAE,0x5DBD,0x5D90,0x5DB7, +0x5DBC,0x5DC9,0x5DCD,0x5DD3,0x5DD2,0x5DD6,0x5DDB,0x5DEB, +0x5DF2,0x5DF5,0x5E0B,0x5E1A,0x5E19,0x5E11,0x5E1B,0x5E36, +0x5E37,0x5E44,0x5E43,0x5E40,0x5E4E,0x5E57,0x5E54,0x5E5F, +0x5E62,0x5E64,0x5E47,0x5E75,0x5E76,0x5E7A,0x9EBC,0x5E7F, +0x5EA0,0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF}; + +/* page 47 0x5721-0x577E */ +static uint16 tab_jisx0208_uni47[]={ +0x5ED6,0x5EE3,0x5EDD,0x5EDA,0x5EDB,0x5EE2,0x5EE1,0x5EE8, +0x5EE9,0x5EEC,0x5EF1,0x5EF3,0x5EF0,0x5EF4,0x5EF8,0x5EFE, +0x5F03,0x5F09,0x5F5D,0x5F5C,0x5F0B,0x5F11,0x5F16,0x5F29, +0x5F2D,0x5F38,0x5F41,0x5F48,0x5F4C,0x5F4E,0x5F2F,0x5F51, +0x5F56,0x5F57,0x5F59,0x5F61,0x5F6D,0x5F73,0x5F77,0x5F83, +0x5F82,0x5F7F,0x5F8A,0x5F88,0x5F91,0x5F87,0x5F9E,0x5F99, +0x5F98,0x5FA0,0x5FA8,0x5FAD,0x5FBC,0x5FD6,0x5FFB,0x5FE4, +0x5FF8,0x5FF1,0x5FDD,0x60B3,0x5FFF,0x6021,0x6060,0x6019, +0x6010,0x6029,0x600E,0x6031,0x601B,0x6015,0x602B,0x6026, +0x600F,0x603A,0x605A,0x6041,0x606A,0x6077,0x605F,0x604A, +0x6046,0x604D,0x6063,0x6043,0x6064,0x6042,0x606C,0x606B, +0x6059,0x6081,0x608D,0x60E7,0x6083,0x609A}; + +/* page 48 0x5821-0x587E */ +static uint16 tab_jisx0208_uni48[]={ +0x6084,0x609B,0x6096,0x6097,0x6092,0x60A7,0x608B,0x60E1, +0x60B8,0x60E0,0x60D3,0x60B4,0x5FF0,0x60BD,0x60C6,0x60B5, +0x60D8,0x614D,0x6115,0x6106,0x60F6,0x60F7,0x6100,0x60F4, +0x60FA,0x6103,0x6121,0x60FB,0x60F1,0x610D,0x610E,0x6147, +0x613E,0x6128,0x6127,0x614A,0x613F,0x613C,0x612C,0x6134, +0x613D,0x6142,0x6144,0x6173,0x6177,0x6158,0x6159,0x615A, +0x616B,0x6174,0x616F,0x6165,0x6171,0x615F,0x615D,0x6153, +0x6175,0x6199,0x6196,0x6187,0x61AC,0x6194,0x619A,0x618A, +0x6191,0x61AB,0x61AE,0x61CC,0x61CA,0x61C9,0x61F7,0x61C8, +0x61C3,0x61C6,0x61BA,0x61CB,0x7F79,0x61CD,0x61E6,0x61E3, +0x61F6,0x61FA,0x61F4,0x61FF,0x61FD,0x61FC,0x61FE,0x6200, +0x6208,0x6209,0x620D,0x620C,0x6214,0x621B}; + +/* page 49 0x5921-0x597E */ +static uint16 tab_jisx0208_uni49[]={ +0x621E,0x6221,0x622A,0x622E,0x6230,0x6232,0x6233,0x6241, +0x624E,0x625E,0x6263,0x625B,0x6260,0x6268,0x627C,0x6282, +0x6289,0x627E,0x6292,0x6293,0x6296,0x62D4,0x6283,0x6294, +0x62D7,0x62D1,0x62BB,0x62CF,0x62FF,0x62C6,0x64D4,0x62C8, +0x62DC,0x62CC,0x62CA,0x62C2,0x62C7,0x629B,0x62C9,0x630C, +0x62EE,0x62F1,0x6327,0x6302,0x6308,0x62EF,0x62F5,0x6350, +0x633E,0x634D,0x641C,0x634F,0x6396,0x638E,0x6380,0x63AB, +0x6376,0x63A3,0x638F,0x6389,0x639F,0x63B5,0x636B,0x6369, +0x63BE,0x63E9,0x63C0,0x63C6,0x63E3,0x63C9,0x63D2,0x63F6, +0x63C4,0x6416,0x6434,0x6406,0x6413,0x6426,0x6436,0x651D, +0x6417,0x6428,0x640F,0x6467,0x646F,0x6476,0x644E,0x652A, +0x6495,0x6493,0x64A5,0x64A9,0x6488,0x64BC}; + +/* page 50 0x5A21-0x5A7E */ +static uint16 tab_jisx0208_uni50[]={ +0x64DA,0x64D2,0x64C5,0x64C7,0x64BB,0x64D8,0x64C2,0x64F1, +0x64E7,0x8209,0x64E0,0x64E1,0x62AC,0x64E3,0x64EF,0x652C, +0x64F6,0x64F4,0x64F2,0x64FA,0x6500,0x64FD,0x6518,0x651C, +0x6505,0x6524,0x6523,0x652B,0x6534,0x6535,0x6537,0x6536, +0x6538,0x754B,0x6548,0x6556,0x6555,0x654D,0x6558,0x655E, +0x655D,0x6572,0x6578,0x6582,0x6583,0x8B8A,0x659B,0x659F, +0x65AB,0x65B7,0x65C3,0x65C6,0x65C1,0x65C4,0x65CC,0x65D2, +0x65DB,0x65D9,0x65E0,0x65E1,0x65F1,0x6772,0x660A,0x6603, +0x65FB,0x6773,0x6635,0x6636,0x6634,0x661C,0x664F,0x6644, +0x6649,0x6641,0x665E,0x665D,0x6664,0x6667,0x6668,0x665F, +0x6662,0x6670,0x6683,0x6688,0x668E,0x6689,0x6684,0x6698, +0x669D,0x66C1,0x66B9,0x66C9,0x66BE,0x66BC}; + +/* page 51 0x5B21-0x5B7E */ +static uint16 tab_jisx0208_uni51[]={ +0x66C4,0x66B8,0x66D6,0x66DA,0x66E0,0x663F,0x66E6,0x66E9, +0x66F0,0x66F5,0x66F7,0x670F,0x6716,0x671E,0x6726,0x6727, +0x9738,0x672E,0x673F,0x6736,0x6741,0x6738,0x6737,0x6746, +0x675E,0x6760,0x6759,0x6763,0x6764,0x6789,0x6770,0x67A9, +0x677C,0x676A,0x678C,0x678B,0x67A6,0x67A1,0x6785,0x67B7, +0x67EF,0x67B4,0x67EC,0x67B3,0x67E9,0x67B8,0x67E4,0x67DE, +0x67DD,0x67E2,0x67EE,0x67B9,0x67CE,0x67C6,0x67E7,0x6A9C, +0x681E,0x6846,0x6829,0x6840,0x684D,0x6832,0x684E,0x68B3, +0x682B,0x6859,0x6863,0x6877,0x687F,0x689F,0x688F,0x68AD, +0x6894,0x689D,0x689B,0x6883,0x6AAE,0x68B9,0x6874,0x68B5, +0x68A0,0x68BA,0x690F,0x688D,0x687E,0x6901,0x68CA,0x6908, +0x68D8,0x6922,0x6926,0x68E1,0x690C,0x68CD}; + +/* page 52 0x5C21-0x5C7E */ +static uint16 tab_jisx0208_uni52[]={ +0x68D4,0x68E7,0x68D5,0x6936,0x6912,0x6904,0x68D7,0x68E3, +0x6925,0x68F9,0x68E0,0x68EF,0x6928,0x692A,0x691A,0x6923, +0x6921,0x68C6,0x6979,0x6977,0x695C,0x6978,0x696B,0x6954, +0x697E,0x696E,0x6939,0x6974,0x693D,0x6959,0x6930,0x6961, +0x695E,0x695D,0x6981,0x696A,0x69B2,0x69AE,0x69D0,0x69BF, +0x69C1,0x69D3,0x69BE,0x69CE,0x5BE8,0x69CA,0x69DD,0x69BB, +0x69C3,0x69A7,0x6A2E,0x6991,0x69A0,0x699C,0x6995,0x69B4, +0x69DE,0x69E8,0x6A02,0x6A1B,0x69FF,0x6B0A,0x69F9,0x69F2, +0x69E7,0x6A05,0x69B1,0x6A1E,0x69ED,0x6A14,0x69EB,0x6A0A, +0x6A12,0x6AC1,0x6A23,0x6A13,0x6A44,0x6A0C,0x6A72,0x6A36, +0x6A78,0x6A47,0x6A62,0x6A59,0x6A66,0x6A48,0x6A38,0x6A22, +0x6A90,0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3}; + +/* page 53 0x5D21-0x5D7E */ +static uint16 tab_jisx0208_uni53[]={ +0x6A97,0x8617,0x6ABB,0x6AC3,0x6AC2,0x6AB8,0x6AB3,0x6AAC, +0x6ADE,0x6AD1,0x6ADF,0x6AAA,0x6ADA,0x6AEA,0x6AFB,0x6B05, +0x8616,0x6AFA,0x6B12,0x6B16,0x9B31,0x6B1F,0x6B38,0x6B37, +0x76DC,0x6B39,0x98EE,0x6B47,0x6B43,0x6B49,0x6B50,0x6B59, +0x6B54,0x6B5B,0x6B5F,0x6B61,0x6B78,0x6B79,0x6B7F,0x6B80, +0x6B84,0x6B83,0x6B8D,0x6B98,0x6B95,0x6B9E,0x6BA4,0x6BAA, +0x6BAB,0x6BAF,0x6BB2,0x6BB1,0x6BB3,0x6BB7,0x6BBC,0x6BC6, +0x6BCB,0x6BD3,0x6BDF,0x6BEC,0x6BEB,0x6BF3,0x6BEF,0x9EBE, +0x6C08,0x6C13,0x6C14,0x6C1B,0x6C24,0x6C23,0x6C5E,0x6C55, +0x6C62,0x6C6A,0x6C82,0x6C8D,0x6C9A,0x6C81,0x6C9B,0x6C7E, +0x6C68,0x6C73,0x6C92,0x6C90,0x6CC4,0x6CF1,0x6CD3,0x6CBD, +0x6CD7,0x6CC5,0x6CDD,0x6CAE,0x6CB1,0x6CBE}; + +/* page 54 0x5E21-0x5E7E */ +static uint16 tab_jisx0208_uni54[]={ +0x6CBA,0x6CDB,0x6CEF,0x6CD9,0x6CEA,0x6D1F,0x884D,0x6D36, +0x6D2B,0x6D3D,0x6D38,0x6D19,0x6D35,0x6D33,0x6D12,0x6D0C, +0x6D63,0x6D93,0x6D64,0x6D5A,0x6D79,0x6D59,0x6D8E,0x6D95, +0x6FE4,0x6D85,0x6DF9,0x6E15,0x6E0A,0x6DB5,0x6DC7,0x6DE6, +0x6DB8,0x6DC6,0x6DEC,0x6DDE,0x6DCC,0x6DE8,0x6DD2,0x6DC5, +0x6DFA,0x6DD9,0x6DE4,0x6DD5,0x6DEA,0x6DEE,0x6E2D,0x6E6E, +0x6E2E,0x6E19,0x6E72,0x6E5F,0x6E3E,0x6E23,0x6E6B,0x6E2B, +0x6E76,0x6E4D,0x6E1F,0x6E43,0x6E3A,0x6E4E,0x6E24,0x6EFF, +0x6E1D,0x6E38,0x6E82,0x6EAA,0x6E98,0x6EC9,0x6EB7,0x6ED3, +0x6EBD,0x6EAF,0x6EC4,0x6EB2,0x6ED4,0x6ED5,0x6E8F,0x6EA5, +0x6EC2,0x6E9F,0x6F41,0x6F11,0x704C,0x6EEC,0x6EF8,0x6EFE, +0x6F3F,0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC}; + +/* page 55 0x5F21-0x5F7E */ +static uint16 tab_jisx0208_uni55[]={ +0x6F3E,0x6F13,0x6EF7,0x6F86,0x6F7A,0x6F78,0x6F81,0x6F80, +0x6F6F,0x6F5B,0x6FF3,0x6F6D,0x6F82,0x6F7C,0x6F58,0x6F8E, +0x6F91,0x6FC2,0x6F66,0x6FB3,0x6FA3,0x6FA1,0x6FA4,0x6FB9, +0x6FC6,0x6FAA,0x6FDF,0x6FD5,0x6FEC,0x6FD4,0x6FD8,0x6FF1, +0x6FEE,0x6FDB,0x7009,0x700B,0x6FFA,0x7011,0x7001,0x700F, +0x6FFE,0x701B,0x701A,0x6F74,0x701D,0x7018,0x701F,0x7030, +0x703E,0x7032,0x7051,0x7063,0x7099,0x7092,0x70AF,0x70F1, +0x70AC,0x70B8,0x70B3,0x70AE,0x70DF,0x70CB,0x70DD,0x70D9, +0x7109,0x70FD,0x711C,0x7119,0x7165,0x7155,0x7188,0x7166, +0x7162,0x714C,0x7156,0x716C,0x718F,0x71FB,0x7184,0x7195, +0x71A8,0x71AC,0x71D7,0x71B9,0x71BE,0x71D2,0x71C9,0x71D4, +0x71CE,0x71E0,0x71EC,0x71E7,0x71F5,0x71FC}; + +/* page 56 0x6021-0x607E */ +static uint16 tab_jisx0208_uni56[]={ +0x71F9,0x71FF,0x720D,0x7210,0x721B,0x7228,0x722D,0x722C, +0x7230,0x7232,0x723B,0x723C,0x723F,0x7240,0x7246,0x724B, +0x7258,0x7274,0x727E,0x7282,0x7281,0x7287,0x7292,0x7296, +0x72A2,0x72A7,0x72B9,0x72B2,0x72C3,0x72C6,0x72C4,0x72CE, +0x72D2,0x72E2,0x72E0,0x72E1,0x72F9,0x72F7,0x500F,0x7317, +0x730A,0x731C,0x7316,0x731D,0x7334,0x732F,0x7329,0x7325, +0x733E,0x734E,0x734F,0x9ED8,0x7357,0x736A,0x7368,0x7370, +0x7378,0x7375,0x737B,0x737A,0x73C8,0x73B3,0x73CE,0x73BB, +0x73C0,0x73E5,0x73EE,0x73DE,0x74A2,0x7405,0x746F,0x7425, +0x73F8,0x7432,0x743A,0x7455,0x743F,0x745F,0x7459,0x7441, +0x745C,0x7469,0x7470,0x7463,0x746A,0x7476,0x747E,0x748B, +0x749E,0x74A7,0x74CA,0x74CF,0x74D4,0x73F1}; + +/* page 57 0x6121-0x617E */ +static uint16 tab_jisx0208_uni57[]={ +0x74E0,0x74E3,0x74E7,0x74E9,0x74EE,0x74F2,0x74F0,0x74F1, +0x74F8,0x74F7,0x7504,0x7503,0x7505,0x750C,0x750E,0x750D, +0x7515,0x7513,0x751E,0x7526,0x752C,0x753C,0x7544,0x754D, +0x754A,0x7549,0x755B,0x7546,0x755A,0x7569,0x7564,0x7567, +0x756B,0x756D,0x7578,0x7576,0x7586,0x7587,0x7574,0x758A, +0x7589,0x7582,0x7594,0x759A,0x759D,0x75A5,0x75A3,0x75C2, +0x75B3,0x75C3,0x75B5,0x75BD,0x75B8,0x75BC,0x75B1,0x75CD, +0x75CA,0x75D2,0x75D9,0x75E3,0x75DE,0x75FE,0x75FF,0x75FC, +0x7601,0x75F0,0x75FA,0x75F2,0x75F3,0x760B,0x760D,0x7609, +0x761F,0x7627,0x7620,0x7621,0x7622,0x7624,0x7634,0x7630, +0x763B,0x7647,0x7648,0x7646,0x765C,0x7658,0x7661,0x7662, +0x7668,0x7669,0x766A,0x7667,0x766C,0x7670}; + +/* page 58 0x6221-0x627E */ +static uint16 tab_jisx0208_uni58[]={ +0x7672,0x7676,0x7678,0x767C,0x7680,0x7683,0x7688,0x768B, +0x768E,0x7696,0x7693,0x7699,0x769A,0x76B0,0x76B4,0x76B8, +0x76B9,0x76BA,0x76C2,0x76CD,0x76D6,0x76D2,0x76DE,0x76E1, +0x76E5,0x76E7,0x76EA,0x862F,0x76FB,0x7708,0x7707,0x7704, +0x7729,0x7724,0x771E,0x7725,0x7726,0x771B,0x7737,0x7738, +0x7747,0x775A,0x7768,0x776B,0x775B,0x7765,0x777F,0x777E, +0x7779,0x778E,0x778B,0x7791,0x77A0,0x779E,0x77B0,0x77B6, +0x77B9,0x77BF,0x77BC,0x77BD,0x77BB,0x77C7,0x77CD,0x77D7, +0x77DA,0x77DC,0x77E3,0x77EE,0x77FC,0x780C,0x7812,0x7926, +0x7820,0x792A,0x7845,0x788E,0x7874,0x7886,0x787C,0x789A, +0x788C,0x78A3,0x78B5,0x78AA,0x78AF,0x78D1,0x78C6,0x78CB, +0x78D4,0x78BE,0x78BC,0x78C5,0x78CA,0x78EC}; + +/* page 59 0x6321-0x637E */ +static uint16 tab_jisx0208_uni59[]={ +0x78E7,0x78DA,0x78FD,0x78F4,0x7907,0x7912,0x7911,0x7919, +0x792C,0x792B,0x7940,0x7960,0x7957,0x795F,0x795A,0x7955, +0x7953,0x797A,0x797F,0x798A,0x799D,0x79A7,0x9F4B,0x79AA, +0x79AE,0x79B3,0x79B9,0x79BA,0x79C9,0x79D5,0x79E7,0x79EC, +0x79E1,0x79E3,0x7A08,0x7A0D,0x7A18,0x7A19,0x7A20,0x7A1F, +0x7980,0x7A31,0x7A3B,0x7A3E,0x7A37,0x7A43,0x7A57,0x7A49, +0x7A61,0x7A62,0x7A69,0x9F9D,0x7A70,0x7A79,0x7A7D,0x7A88, +0x7A97,0x7A95,0x7A98,0x7A96,0x7AA9,0x7AC8,0x7AB0,0x7AB6, +0x7AC5,0x7AC4,0x7ABF,0x9083,0x7AC7,0x7ACA,0x7ACD,0x7ACF, +0x7AD5,0x7AD3,0x7AD9,0x7ADA,0x7ADD,0x7AE1,0x7AE2,0x7AE6, +0x7AED,0x7AF0,0x7B02,0x7B0F,0x7B0A,0x7B06,0x7B33,0x7B18, +0x7B19,0x7B1E,0x7B35,0x7B28,0x7B36,0x7B50}; + +/* page 60 0x6421-0x647E */ +static uint16 tab_jisx0208_uni60[]={ +0x7B7A,0x7B04,0x7B4D,0x7B0B,0x7B4C,0x7B45,0x7B75,0x7B65, +0x7B74,0x7B67,0x7B70,0x7B71,0x7B6C,0x7B6E,0x7B9D,0x7B98, +0x7B9F,0x7B8D,0x7B9C,0x7B9A,0x7B8B,0x7B92,0x7B8F,0x7B5D, +0x7B99,0x7BCB,0x7BC1,0x7BCC,0x7BCF,0x7BB4,0x7BC6,0x7BDD, +0x7BE9,0x7C11,0x7C14,0x7BE6,0x7BE5,0x7C60,0x7C00,0x7C07, +0x7C13,0x7BF3,0x7BF7,0x7C17,0x7C0D,0x7BF6,0x7C23,0x7C27, +0x7C2A,0x7C1F,0x7C37,0x7C2B,0x7C3D,0x7C4C,0x7C43,0x7C54, +0x7C4F,0x7C40,0x7C50,0x7C58,0x7C5F,0x7C64,0x7C56,0x7C65, +0x7C6C,0x7C75,0x7C83,0x7C90,0x7CA4,0x7CAD,0x7CA2,0x7CAB, +0x7CA1,0x7CA8,0x7CB3,0x7CB2,0x7CB1,0x7CAE,0x7CB9,0x7CBD, +0x7CC0,0x7CC5,0x7CC2,0x7CD8,0x7CD2,0x7CDC,0x7CE2,0x9B3B, +0x7CEF,0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06}; + +/* page 61 0x6521-0x657E */ +static uint16 tab_jisx0208_uni61[]={ +0x7D02,0x7D1C,0x7D15,0x7D0A,0x7D45,0x7D4B,0x7D2E,0x7D32, +0x7D3F,0x7D35,0x7D46,0x7D73,0x7D56,0x7D4E,0x7D72,0x7D68, +0x7D6E,0x7D4F,0x7D63,0x7D93,0x7D89,0x7D5B,0x7D8F,0x7D7D, +0x7D9B,0x7DBA,0x7DAE,0x7DA3,0x7DB5,0x7DC7,0x7DBD,0x7DAB, +0x7E3D,0x7DA2,0x7DAF,0x7DDC,0x7DB8,0x7D9F,0x7DB0,0x7DD8, +0x7DDD,0x7DE4,0x7DDE,0x7DFB,0x7DF2,0x7DE1,0x7E05,0x7E0A, +0x7E23,0x7E21,0x7E12,0x7E31,0x7E1F,0x7E09,0x7E0B,0x7E22, +0x7E46,0x7E66,0x7E3B,0x7E35,0x7E39,0x7E43,0x7E37,0x7E32, +0x7E3A,0x7E67,0x7E5D,0x7E56,0x7E5E,0x7E59,0x7E5A,0x7E79, +0x7E6A,0x7E69,0x7E7C,0x7E7B,0x7E83,0x7DD5,0x7E7D,0x8FAE, +0x7E7F,0x7E88,0x7E89,0x7E8C,0x7E92,0x7E90,0x7E93,0x7E94, +0x7E96,0x7E8E,0x7E9B,0x7E9C,0x7F38,0x7F3A}; + +/* page 62 0x6621-0x667E */ +static uint16 tab_jisx0208_uni62[]={ +0x7F45,0x7F4C,0x7F4D,0x7F4E,0x7F50,0x7F51,0x7F55,0x7F54, +0x7F58,0x7F5F,0x7F60,0x7F68,0x7F69,0x7F67,0x7F78,0x7F82, +0x7F86,0x7F83,0x7F88,0x7F87,0x7F8C,0x7F94,0x7F9E,0x7F9D, +0x7F9A,0x7FA3,0x7FAF,0x7FB2,0x7FB9,0x7FAE,0x7FB6,0x7FB8, +0x8B71,0x7FC5,0x7FC6,0x7FCA,0x7FD5,0x7FD4,0x7FE1,0x7FE6, +0x7FE9,0x7FF3,0x7FF9,0x98DC,0x8006,0x8004,0x800B,0x8012, +0x8018,0x8019,0x801C,0x8021,0x8028,0x803F,0x803B,0x804A, +0x8046,0x8052,0x8058,0x805A,0x805F,0x8062,0x8068,0x8073, +0x8072,0x8070,0x8076,0x8079,0x807D,0x807F,0x8084,0x8086, +0x8085,0x809B,0x8093,0x809A,0x80AD,0x5190,0x80AC,0x80DB, +0x80E5,0x80D9,0x80DD,0x80C4,0x80DA,0x80D6,0x8109,0x80EF, +0x80F1,0x811B,0x8129,0x8123,0x812F,0x814B}; + +/* page 63 0x6721-0x677E */ +static uint16 tab_jisx0208_uni63[]={ +0x968B,0x8146,0x813E,0x8153,0x8151,0x80FC,0x8171,0x816E, +0x8165,0x8166,0x8174,0x8183,0x8188,0x818A,0x8180,0x8182, +0x81A0,0x8195,0x81A4,0x81A3,0x815F,0x8193,0x81A9,0x81B0, +0x81B5,0x81BE,0x81B8,0x81BD,0x81C0,0x81C2,0x81BA,0x81C9, +0x81CD,0x81D1,0x81D9,0x81D8,0x81C8,0x81DA,0x81DF,0x81E0, +0x81E7,0x81FA,0x81FB,0x81FE,0x8201,0x8202,0x8205,0x8207, +0x820A,0x820D,0x8210,0x8216,0x8229,0x822B,0x8238,0x8233, +0x8240,0x8259,0x8258,0x825D,0x825A,0x825F,0x8264,0x8262, +0x8268,0x826A,0x826B,0x822E,0x8271,0x8277,0x8278,0x827E, +0x828D,0x8292,0x82AB,0x829F,0x82BB,0x82AC,0x82E1,0x82E3, +0x82DF,0x82D2,0x82F4,0x82F3,0x82FA,0x8393,0x8303,0x82FB, +0x82F9,0x82DE,0x8306,0x82DC,0x8309,0x82D9}; + +/* page 64 0x6821-0x687E */ +static uint16 tab_jisx0208_uni64[]={ +0x8335,0x8334,0x8316,0x8332,0x8331,0x8340,0x8339,0x8350, +0x8345,0x832F,0x832B,0x8317,0x8318,0x8385,0x839A,0x83AA, +0x839F,0x83A2,0x8396,0x8323,0x838E,0x8387,0x838A,0x837C, +0x83B5,0x8373,0x8375,0x83A0,0x8389,0x83A8,0x83F4,0x8413, +0x83EB,0x83CE,0x83FD,0x8403,0x83D8,0x840B,0x83C1,0x83F7, +0x8407,0x83E0,0x83F2,0x840D,0x8422,0x8420,0x83BD,0x8438, +0x8506,0x83FB,0x846D,0x842A,0x843C,0x855A,0x8484,0x8477, +0x846B,0x84AD,0x846E,0x8482,0x8469,0x8446,0x842C,0x846F, +0x8479,0x8435,0x84CA,0x8462,0x84B9,0x84BF,0x849F,0x84D9, +0x84CD,0x84BB,0x84DA,0x84D0,0x84C1,0x84C6,0x84D6,0x84A1, +0x8521,0x84FF,0x84F4,0x8517,0x8518,0x852C,0x851F,0x8515, +0x8514,0x84FC,0x8540,0x8563,0x8558,0x8548}; + +/* page 65 0x6921-0x697E */ +static uint16 tab_jisx0208_uni65[]={ +0x8541,0x8602,0x854B,0x8555,0x8580,0x85A4,0x8588,0x8591, +0x858A,0x85A8,0x856D,0x8594,0x859B,0x85EA,0x8587,0x859C, +0x8577,0x857E,0x8590,0x85C9,0x85BA,0x85CF,0x85B9,0x85D0, +0x85D5,0x85DD,0x85E5,0x85DC,0x85F9,0x860A,0x8613,0x860B, +0x85FE,0x85FA,0x8606,0x8622,0x861A,0x8630,0x863F,0x864D, +0x4E55,0x8654,0x865F,0x8667,0x8671,0x8693,0x86A3,0x86A9, +0x86AA,0x868B,0x868C,0x86B6,0x86AF,0x86C4,0x86C6,0x86B0, +0x86C9,0x8823,0x86AB,0x86D4,0x86DE,0x86E9,0x86EC,0x86DF, +0x86DB,0x86EF,0x8712,0x8706,0x8708,0x8700,0x8703,0x86FB, +0x8711,0x8709,0x870D,0x86F9,0x870A,0x8734,0x873F,0x8737, +0x873B,0x8725,0x8729,0x871A,0x8760,0x875F,0x8778,0x874C, +0x874E,0x8774,0x8757,0x8768,0x876E,0x8759}; + +/* page 66 0x6A21-0x6A7E */ +static uint16 tab_jisx0208_uni66[]={ +0x8753,0x8763,0x876A,0x8805,0x87A2,0x879F,0x8782,0x87AF, +0x87CB,0x87BD,0x87C0,0x87D0,0x96D6,0x87AB,0x87C4,0x87B3, +0x87C7,0x87C6,0x87BB,0x87EF,0x87F2,0x87E0,0x880F,0x880D, +0x87FE,0x87F6,0x87F7,0x880E,0x87D2,0x8811,0x8816,0x8815, +0x8822,0x8821,0x8831,0x8836,0x8839,0x8827,0x883B,0x8844, +0x8842,0x8852,0x8859,0x885E,0x8862,0x886B,0x8881,0x887E, +0x889E,0x8875,0x887D,0x88B5,0x8872,0x8882,0x8897,0x8892, +0x88AE,0x8899,0x88A2,0x888D,0x88A4,0x88B0,0x88BF,0x88B1, +0x88C3,0x88C4,0x88D4,0x88D8,0x88D9,0x88DD,0x88F9,0x8902, +0x88FC,0x88F4,0x88E8,0x88F2,0x8904,0x890C,0x890A,0x8913, +0x8943,0x891E,0x8925,0x892A,0x892B,0x8941,0x8944,0x893B, +0x8936,0x8938,0x894C,0x891D,0x8960,0x895E}; + +/* page 67 0x6B21-0x6B7E */ +static uint16 tab_jisx0208_uni67[]={ +0x8966,0x8964,0x896D,0x896A,0x896F,0x8974,0x8977,0x897E, +0x8983,0x8988,0x898A,0x8993,0x8998,0x89A1,0x89A9,0x89A6, +0x89AC,0x89AF,0x89B2,0x89BA,0x89BD,0x89BF,0x89C0,0x89DA, +0x89DC,0x89DD,0x89E7,0x89F4,0x89F8,0x8A03,0x8A16,0x8A10, +0x8A0C,0x8A1B,0x8A1D,0x8A25,0x8A36,0x8A41,0x8A5B,0x8A52, +0x8A46,0x8A48,0x8A7C,0x8A6D,0x8A6C,0x8A62,0x8A85,0x8A82, +0x8A84,0x8AA8,0x8AA1,0x8A91,0x8AA5,0x8AA6,0x8A9A,0x8AA3, +0x8AC4,0x8ACD,0x8AC2,0x8ADA,0x8AEB,0x8AF3,0x8AE7,0x8AE4, +0x8AF1,0x8B14,0x8AE0,0x8AE2,0x8AF7,0x8ADE,0x8ADB,0x8B0C, +0x8B07,0x8B1A,0x8AE1,0x8B16,0x8B10,0x8B17,0x8B20,0x8B33, +0x97AB,0x8B26,0x8B2B,0x8B3E,0x8B28,0x8B41,0x8B4C,0x8B4F, +0x8B4E,0x8B49,0x8B56,0x8B5B,0x8B5A,0x8B6B}; + +/* page 68 0x6C21-0x6C7E */ +static uint16 tab_jisx0208_uni68[]={ +0x8B5F,0x8B6C,0x8B6F,0x8B74,0x8B7D,0x8B80,0x8B8C,0x8B8E, +0x8B92,0x8B93,0x8B96,0x8B99,0x8B9A,0x8C3A,0x8C41,0x8C3F, +0x8C48,0x8C4C,0x8C4E,0x8C50,0x8C55,0x8C62,0x8C6C,0x8C78, +0x8C7A,0x8C82,0x8C89,0x8C85,0x8C8A,0x8C8D,0x8C8E,0x8C94, +0x8C7C,0x8C98,0x621D,0x8CAD,0x8CAA,0x8CBD,0x8CB2,0x8CB3, +0x8CAE,0x8CB6,0x8CC8,0x8CC1,0x8CE4,0x8CE3,0x8CDA,0x8CFD, +0x8CFA,0x8CFB,0x8D04,0x8D05,0x8D0A,0x8D07,0x8D0F,0x8D0D, +0x8D10,0x9F4E,0x8D13,0x8CCD,0x8D14,0x8D16,0x8D67,0x8D6D, +0x8D71,0x8D73,0x8D81,0x8D99,0x8DC2,0x8DBE,0x8DBA,0x8DCF, +0x8DDA,0x8DD6,0x8DCC,0x8DDB,0x8DCB,0x8DEA,0x8DEB,0x8DDF, +0x8DE3,0x8DFC,0x8E08,0x8E09,0x8DFF,0x8E1D,0x8E1E,0x8E10, +0x8E1F,0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A}; + +/* page 69 0x6D21-0x6D7E */ +static uint16 tab_jisx0208_uni69[]={ +0x8E47,0x8E49,0x8E4C,0x8E50,0x8E48,0x8E59,0x8E64,0x8E60, +0x8E2A,0x8E63,0x8E55,0x8E76,0x8E72,0x8E7C,0x8E81,0x8E87, +0x8E85,0x8E84,0x8E8B,0x8E8A,0x8E93,0x8E91,0x8E94,0x8E99, +0x8EAA,0x8EA1,0x8EAC,0x8EB0,0x8EC6,0x8EB1,0x8EBE,0x8EC5, +0x8EC8,0x8ECB,0x8EDB,0x8EE3,0x8EFC,0x8EFB,0x8EEB,0x8EFE, +0x8F0A,0x8F05,0x8F15,0x8F12,0x8F19,0x8F13,0x8F1C,0x8F1F, +0x8F1B,0x8F0C,0x8F26,0x8F33,0x8F3B,0x8F39,0x8F45,0x8F42, +0x8F3E,0x8F4C,0x8F49,0x8F46,0x8F4E,0x8F57,0x8F5C,0x8F62, +0x8F63,0x8F64,0x8F9C,0x8F9F,0x8FA3,0x8FAD,0x8FAF,0x8FB7, +0x8FDA,0x8FE5,0x8FE2,0x8FEA,0x8FEF,0x9087,0x8FF4,0x9005, +0x8FF9,0x8FFA,0x9011,0x9015,0x9021,0x900D,0x901E,0x9016, +0x900B,0x9027,0x9036,0x9035,0x9039,0x8FF8}; + +/* page 70 0x6E21-0x6E7E */ +static uint16 tab_jisx0208_uni70[]={ +0x904F,0x9050,0x9051,0x9052,0x900E,0x9049,0x903E,0x9056, +0x9058,0x905E,0x9068,0x906F,0x9076,0x96A8,0x9072,0x9082, +0x907D,0x9081,0x9080,0x908A,0x9089,0x908F,0x90A8,0x90AF, +0x90B1,0x90B5,0x90E2,0x90E4,0x6248,0x90DB,0x9102,0x9112, +0x9119,0x9132,0x9130,0x914A,0x9156,0x9158,0x9163,0x9165, +0x9169,0x9173,0x9172,0x918B,0x9189,0x9182,0x91A2,0x91AB, +0x91AF,0x91AA,0x91B5,0x91B4,0x91BA,0x91C0,0x91C1,0x91C9, +0x91CB,0x91D0,0x91D6,0x91DF,0x91E1,0x91DB,0x91FC,0x91F5, +0x91F6,0x921E,0x91FF,0x9214,0x922C,0x9215,0x9211,0x925E, +0x9257,0x9245,0x9249,0x9264,0x9248,0x9295,0x923F,0x924B, +0x9250,0x929C,0x9296,0x9293,0x929B,0x925A,0x92CF,0x92B9, +0x92B7,0x92E9,0x930F,0x92FA,0x9344,0x932E}; + +/* page 71 0x6F21-0x6F7E */ +static uint16 tab_jisx0208_uni71[]={ +0x9319,0x9322,0x931A,0x9323,0x933A,0x9335,0x933B,0x935C, +0x9360,0x937C,0x936E,0x9356,0x93B0,0x93AC,0x93AD,0x9394, +0x93B9,0x93D6,0x93D7,0x93E8,0x93E5,0x93D8,0x93C3,0x93DD, +0x93D0,0x93C8,0x93E4,0x941A,0x9414,0x9413,0x9403,0x9407, +0x9410,0x9436,0x942B,0x9435,0x9421,0x943A,0x9441,0x9452, +0x9444,0x945B,0x9460,0x9462,0x945E,0x946A,0x9229,0x9470, +0x9475,0x9477,0x947D,0x945A,0x947C,0x947E,0x9481,0x947F, +0x9582,0x9587,0x958A,0x9594,0x9596,0x9598,0x9599,0x95A0, +0x95A8,0x95A7,0x95AD,0x95BC,0x95BB,0x95B9,0x95BE,0x95CA, +0x6FF6,0x95C3,0x95CD,0x95CC,0x95D5,0x95D4,0x95D6,0x95DC, +0x95E1,0x95E5,0x95E2,0x9621,0x9628,0x962E,0x962F,0x9642, +0x964C,0x964F,0x964B,0x9677,0x965C,0x965E}; + +/* page 72 0x7021-0x707E */ +static uint16 tab_jisx0208_uni72[]={ +0x965D,0x965F,0x9666,0x9672,0x966C,0x968D,0x9698,0x9695, +0x9697,0x96AA,0x96A7,0x96B1,0x96B2,0x96B0,0x96B4,0x96B6, +0x96B8,0x96B9,0x96CE,0x96CB,0x96C9,0x96CD,0x894D,0x96DC, +0x970D,0x96D5,0x96F9,0x9704,0x9706,0x9708,0x9713,0x970E, +0x9711,0x970F,0x9716,0x9719,0x9724,0x972A,0x9730,0x9739, +0x973D,0x973E,0x9744,0x9746,0x9748,0x9742,0x9749,0x975C, +0x9760,0x9764,0x9766,0x9768,0x52D2,0x976B,0x9771,0x9779, +0x9785,0x977C,0x9781,0x977A,0x9786,0x978B,0x978F,0x9790, +0x979C,0x97A8,0x97A6,0x97A3,0x97B3,0x97B4,0x97C3,0x97C6, +0x97C8,0x97CB,0x97DC,0x97ED,0x9F4F,0x97F2,0x7ADF,0x97F6, +0x97F5,0x980F,0x980C,0x9838,0x9824,0x9821,0x9837,0x983D, +0x9846,0x984F,0x984B,0x986B,0x986F,0x9870}; + +/* page 73 0x7121-0x717E */ +static uint16 tab_jisx0208_uni73[]={ +0x9871,0x9874,0x9873,0x98AA,0x98AF,0x98B1,0x98B6,0x98C4, +0x98C3,0x98C6,0x98E9,0x98EB,0x9903,0x9909,0x9912,0x9914, +0x9918,0x9921,0x991D,0x991E,0x9924,0x9920,0x992C,0x992E, +0x993D,0x993E,0x9942,0x9949,0x9945,0x9950,0x994B,0x9951, +0x9952,0x994C,0x9955,0x9997,0x9998,0x99A5,0x99AD,0x99AE, +0x99BC,0x99DF,0x99DB,0x99DD,0x99D8,0x99D1,0x99ED,0x99EE, +0x99F1,0x99F2,0x99FB,0x99F8,0x9A01,0x9A0F,0x9A05,0x99E2, +0x9A19,0x9A2B,0x9A37,0x9A45,0x9A42,0x9A40,0x9A43,0x9A3E, +0x9A55,0x9A4D,0x9A5B,0x9A57,0x9A5F,0x9A62,0x9A65,0x9A64, +0x9A69,0x9A6B,0x9A6A,0x9AAD,0x9AB0,0x9ABC,0x9AC0,0x9ACF, +0x9AD1,0x9AD3,0x9AD4,0x9ADE,0x9ADF,0x9AE2,0x9AE3,0x9AE6, +0x9AEF,0x9AEB,0x9AEE,0x9AF4,0x9AF1,0x9AF7}; + +/* page 74 0x7221-0x727E */ +static uint16 tab_jisx0208_uni74[]={ +0x9AFB,0x9B06,0x9B18,0x9B1A,0x9B1F,0x9B22,0x9B23,0x9B25, +0x9B27,0x9B28,0x9B29,0x9B2A,0x9B2E,0x9B2F,0x9B32,0x9B44, +0x9B43,0x9B4F,0x9B4D,0x9B4E,0x9B51,0x9B58,0x9B74,0x9B93, +0x9B83,0x9B91,0x9B96,0x9B97,0x9B9F,0x9BA0,0x9BA8,0x9BB4, +0x9BC0,0x9BCA,0x9BB9,0x9BC6,0x9BCF,0x9BD1,0x9BD2,0x9BE3, +0x9BE2,0x9BE4,0x9BD4,0x9BE1,0x9C3A,0x9BF2,0x9BF1,0x9BF0, +0x9C15,0x9C14,0x9C09,0x9C13,0x9C0C,0x9C06,0x9C08,0x9C12, +0x9C0A,0x9C04,0x9C2E,0x9C1B,0x9C25,0x9C24,0x9C21,0x9C30, +0x9C47,0x9C32,0x9C46,0x9C3E,0x9C5A,0x9C60,0x9C67,0x9C76, +0x9C78,0x9CE7,0x9CEC,0x9CF0,0x9D09,0x9D08,0x9CEB,0x9D03, +0x9D06,0x9D2A,0x9D26,0x9DAF,0x9D23,0x9D1F,0x9D44,0x9D15, +0x9D12,0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48}; + +/* page 75 0x7321-0x737E */ +static uint16 tab_jisx0208_uni75[]={ +0x9D5D,0x9D5E,0x9D64,0x9D51,0x9D50,0x9D59,0x9D72,0x9D89, +0x9D87,0x9DAB,0x9D6F,0x9D7A,0x9D9A,0x9DA4,0x9DA9,0x9DB2, +0x9DC4,0x9DC1,0x9DBB,0x9DB8,0x9DBA,0x9DC6,0x9DCF,0x9DC2, +0x9DD9,0x9DD3,0x9DF8,0x9DE6,0x9DED,0x9DEF,0x9DFD,0x9E1A, +0x9E1B,0x9E1E,0x9E75,0x9E79,0x9E7D,0x9E81,0x9E88,0x9E8B, +0x9E8C,0x9E92,0x9E95,0x9E91,0x9E9D,0x9EA5,0x9EA9,0x9EB8, +0x9EAA,0x9EAD,0x9761,0x9ECC,0x9ECE,0x9ECF,0x9ED0,0x9ED4, +0x9EDC,0x9EDE,0x9EDD,0x9EE0,0x9EE5,0x9EE8,0x9EEF,0x9EF4, +0x9EF6,0x9EF7,0x9EF9,0x9EFB,0x9EFC,0x9EFD,0x9F07,0x9F08, +0x76B7,0x9F15,0x9F21,0x9F2C,0x9F3E,0x9F4A,0x9F52,0x9F54, +0x9F63,0x9F5F,0x9F60,0x9F61,0x9F66,0x9F67,0x9F6C,0x9F6A, +0x9F77,0x9F72,0x9F76,0x9F95,0x9F9C,0x9FA0}; + +/* page 76 0x7421-0x7426 */ +static uint16 tab_jisx0208_uni76[]={ +0x582F,0x69C7,0x9059,0x7464,0x51DC,0x7199}; + +/* page 77 0x2D21 - 0x2D7C */ +static uint16 tab_nec13_uni0[]={ +0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467, +0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F, +0x2470,0x2471,0x2472,0x2473,0x2160,0x2161,0x2162,0x2163, +0x2164,0x2165,0x2166,0x2167,0x2168,0x2169, 0,0x3349, +0x3314,0x3322,0x334D,0x3318,0x3327,0x3303,0x3336,0x3351, +0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,0x333B,0x339C, +0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1, 0, 0, + 0, 0, 0, 0, 0, 0,0x337B,0x301D, +0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7, +0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252, +0x2261,0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F, +0x22BF,0x2235,0x2229,0x222A}; + +static int +my_jisx0208_uni_onechar(int code){ + if ((code>=0x2121)&&(code<=0x217E)) + return(tab_jisx0208_uni0[code-0x2121]); + if ((code>=0x2221)&&(code<=0x227E)) + return(tab_jisx0208_uni1[code-0x2221]); + if ((code>=0x2330)&&(code<=0x237A)) + return(tab_jisx0208_uni2[code-0x2330]); + if ((code>=0x2421)&&(code<=0x2473)) + return(tab_jisx0208_uni3[code-0x2421]); + if ((code>=0x2521)&&(code<=0x2576)) + return(tab_jisx0208_uni4[code-0x2521]); + if ((code>=0x2621)&&(code<=0x2658)) + return(tab_jisx0208_uni5[code-0x2621]); + if ((code>=0x2721)&&(code<=0x2771)) + return(tab_jisx0208_uni6[code-0x2721]); + if ((code>=0x2821)&&(code<=0x2840)) + return(tab_jisx0208_uni7[code-0x2821]); + if ((code>=0x3021)&&(code<=0x307E)) + return(tab_jisx0208_uni8[code-0x3021]); + if ((code>=0x3121)&&(code<=0x317E)) + return(tab_jisx0208_uni9[code-0x3121]); + if ((code>=0x3221)&&(code<=0x327E)) + return(tab_jisx0208_uni10[code-0x3221]); + if ((code>=0x3321)&&(code<=0x337E)) + return(tab_jisx0208_uni11[code-0x3321]); + if ((code>=0x3421)&&(code<=0x347E)) + return(tab_jisx0208_uni12[code-0x3421]); + if ((code>=0x3521)&&(code<=0x357E)) + return(tab_jisx0208_uni13[code-0x3521]); + if ((code>=0x3621)&&(code<=0x367E)) + return(tab_jisx0208_uni14[code-0x3621]); + if ((code>=0x3721)&&(code<=0x377E)) + return(tab_jisx0208_uni15[code-0x3721]); + if ((code>=0x3821)&&(code<=0x387E)) + return(tab_jisx0208_uni16[code-0x3821]); + if ((code>=0x3921)&&(code<=0x397E)) + return(tab_jisx0208_uni17[code-0x3921]); + if ((code>=0x3A21)&&(code<=0x3A7E)) + return(tab_jisx0208_uni18[code-0x3A21]); + if ((code>=0x3B21)&&(code<=0x3B7E)) + return(tab_jisx0208_uni19[code-0x3B21]); + if ((code>=0x3C21)&&(code<=0x3C7E)) + return(tab_jisx0208_uni20[code-0x3C21]); + if ((code>=0x3D21)&&(code<=0x3D7E)) + return(tab_jisx0208_uni21[code-0x3D21]); + if ((code>=0x3E21)&&(code<=0x3E7E)) + return(tab_jisx0208_uni22[code-0x3E21]); + if ((code>=0x3F21)&&(code<=0x3F7E)) + return(tab_jisx0208_uni23[code-0x3F21]); + if ((code>=0x4021)&&(code<=0x407E)) + return(tab_jisx0208_uni24[code-0x4021]); + if ((code>=0x4121)&&(code<=0x417E)) + return(tab_jisx0208_uni25[code-0x4121]); + if ((code>=0x4221)&&(code<=0x427E)) + return(tab_jisx0208_uni26[code-0x4221]); + if ((code>=0x4321)&&(code<=0x437E)) + return(tab_jisx0208_uni27[code-0x4321]); + if ((code>=0x4421)&&(code<=0x447E)) + return(tab_jisx0208_uni28[code-0x4421]); + if ((code>=0x4521)&&(code<=0x457E)) + return(tab_jisx0208_uni29[code-0x4521]); + if ((code>=0x4621)&&(code<=0x467E)) + return(tab_jisx0208_uni30[code-0x4621]); + if ((code>=0x4721)&&(code<=0x477E)) + return(tab_jisx0208_uni31[code-0x4721]); + if ((code>=0x4821)&&(code<=0x487E)) + return(tab_jisx0208_uni32[code-0x4821]); + if ((code>=0x4921)&&(code<=0x497E)) + return(tab_jisx0208_uni33[code-0x4921]); + if ((code>=0x4A21)&&(code<=0x4A7E)) + return(tab_jisx0208_uni34[code-0x4A21]); + if ((code>=0x4B21)&&(code<=0x4B7E)) + return(tab_jisx0208_uni35[code-0x4B21]); + if ((code>=0x4C21)&&(code<=0x4C7E)) + return(tab_jisx0208_uni36[code-0x4C21]); + if ((code>=0x4D21)&&(code<=0x4D7E)) + return(tab_jisx0208_uni37[code-0x4D21]); + if ((code>=0x4E21)&&(code<=0x4E7E)) + return(tab_jisx0208_uni38[code-0x4E21]); + if ((code>=0x4F21)&&(code<=0x4F53)) + return(tab_jisx0208_uni39[code-0x4F21]); + if ((code>=0x5021)&&(code<=0x507E)) + return(tab_jisx0208_uni40[code-0x5021]); + if ((code>=0x5121)&&(code<=0x517E)) + return(tab_jisx0208_uni41[code-0x5121]); + if ((code>=0x5221)&&(code<=0x527E)) + return(tab_jisx0208_uni42[code-0x5221]); + if ((code>=0x5321)&&(code<=0x537E)) + return(tab_jisx0208_uni43[code-0x5321]); + if ((code>=0x5421)&&(code<=0x547E)) + return(tab_jisx0208_uni44[code-0x5421]); + if ((code>=0x5521)&&(code<=0x557E)) + return(tab_jisx0208_uni45[code-0x5521]); + if ((code>=0x5621)&&(code<=0x567E)) + return(tab_jisx0208_uni46[code-0x5621]); + if ((code>=0x5721)&&(code<=0x577E)) + return(tab_jisx0208_uni47[code-0x5721]); + if ((code>=0x5821)&&(code<=0x587E)) + return(tab_jisx0208_uni48[code-0x5821]); + if ((code>=0x5921)&&(code<=0x597E)) + return(tab_jisx0208_uni49[code-0x5921]); + if ((code>=0x5A21)&&(code<=0x5A7E)) + return(tab_jisx0208_uni50[code-0x5A21]); + if ((code>=0x5B21)&&(code<=0x5B7E)) + return(tab_jisx0208_uni51[code-0x5B21]); + if ((code>=0x5C21)&&(code<=0x5C7E)) + return(tab_jisx0208_uni52[code-0x5C21]); + if ((code>=0x5D21)&&(code<=0x5D7E)) + return(tab_jisx0208_uni53[code-0x5D21]); + if ((code>=0x5E21)&&(code<=0x5E7E)) + return(tab_jisx0208_uni54[code-0x5E21]); + if ((code>=0x5F21)&&(code<=0x5F7E)) + return(tab_jisx0208_uni55[code-0x5F21]); + if ((code>=0x6021)&&(code<=0x607E)) + return(tab_jisx0208_uni56[code-0x6021]); + if ((code>=0x6121)&&(code<=0x617E)) + return(tab_jisx0208_uni57[code-0x6121]); + if ((code>=0x6221)&&(code<=0x627E)) + return(tab_jisx0208_uni58[code-0x6221]); + if ((code>=0x6321)&&(code<=0x637E)) + return(tab_jisx0208_uni59[code-0x6321]); + if ((code>=0x6421)&&(code<=0x647E)) + return(tab_jisx0208_uni60[code-0x6421]); + if ((code>=0x6521)&&(code<=0x657E)) + return(tab_jisx0208_uni61[code-0x6521]); + if ((code>=0x6621)&&(code<=0x667E)) + return(tab_jisx0208_uni62[code-0x6621]); + if ((code>=0x6721)&&(code<=0x677E)) + return(tab_jisx0208_uni63[code-0x6721]); + if ((code>=0x6821)&&(code<=0x687E)) + return(tab_jisx0208_uni64[code-0x6821]); + if ((code>=0x6921)&&(code<=0x697E)) + return(tab_jisx0208_uni65[code-0x6921]); + if ((code>=0x6A21)&&(code<=0x6A7E)) + return(tab_jisx0208_uni66[code-0x6A21]); + if ((code>=0x6B21)&&(code<=0x6B7E)) + return(tab_jisx0208_uni67[code-0x6B21]); + if ((code>=0x6C21)&&(code<=0x6C7E)) + return(tab_jisx0208_uni68[code-0x6C21]); + if ((code>=0x6D21)&&(code<=0x6D7E)) + return(tab_jisx0208_uni69[code-0x6D21]); + if ((code>=0x6E21)&&(code<=0x6E7E)) + return(tab_jisx0208_uni70[code-0x6E21]); + if ((code>=0x6F21)&&(code<=0x6F7E)) + return(tab_jisx0208_uni71[code-0x6F21]); + if ((code>=0x7021)&&(code<=0x707E)) + return(tab_jisx0208_uni72[code-0x7021]); + if ((code>=0x7121)&&(code<=0x717E)) + return(tab_jisx0208_uni73[code-0x7121]); + if ((code>=0x7221)&&(code<=0x727E)) + return(tab_jisx0208_uni74[code-0x7221]); + if ((code>=0x7321)&&(code<=0x737E)) + return(tab_jisx0208_uni75[code-0x7321]); + if ((code>=0x7421)&&(code<=0x7426)) + return(tab_jisx0208_uni76[code-0x7421]); + if ((code>=0x2D21)&&(code<=0x2D7C)) + return(tab_nec13_uni0[code-0x2D21]); + return(0); +} + +/* page 0 0x005C-0x005C */ +static uint16 tab_uni_jisx02080[]={ +0x5C}; + +/* page 1 0x00A2-0x00B6 */ +static uint16 tab_uni_jisx02081[]={ + 0, 0, 0, 0, 0,0x2178,0x212F, 0, + 0, 0, 0, 0, 0, 0,0x216B,0x215E, + 0, 0,0x212D, 0,0x2279}; + +/* page 2 0x00D7-0x00D7 */ +static uint16 tab_uni_jisx02082[]={ +0x215F}; + +/* page 3 0x00F7-0x00F7 */ +static uint16 tab_uni_jisx02083[]={ +0x2160}; + +/* page 4 0x0391-0x03C9 */ +static uint16 tab_uni_jisx02084[]={ +0x2621,0x2622,0x2623,0x2624,0x2625,0x2626,0x2627,0x2628, +0x2629,0x262A,0x262B,0x262C,0x262D,0x262E,0x262F,0x2630, +0x2631, 0,0x2632,0x2633,0x2634,0x2635,0x2636,0x2637, +0x2638, 0, 0, 0, 0, 0, 0, 0, +0x2641,0x2642,0x2643,0x2644,0x2645,0x2646,0x2647,0x2648, +0x2649,0x264A,0x264B,0x264C,0x264D,0x264E,0x264F,0x2650, +0x2651, 0,0x2652,0x2653,0x2654,0x2655,0x2656,0x2657, +0x2658}; + +/* page 5 0x0401-0x0451 */ +static uint16 tab_uni_jisx02085[]={ +0x2727, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2721, +0x2722,0x2723,0x2724,0x2725,0x2726,0x2728,0x2729,0x272A, +0x272B,0x272C,0x272D,0x272E,0x272F,0x2730,0x2731,0x2732, +0x2733,0x2734,0x2735,0x2736,0x2737,0x2738,0x2739,0x273A, +0x273B,0x273C,0x273D,0x273E,0x273F,0x2740,0x2741,0x2751, +0x2752,0x2753,0x2754,0x2755,0x2756,0x2758,0x2759,0x275A, +0x275B,0x275C,0x275D,0x275E,0x275F,0x2760,0x2761,0x2762, +0x2763,0x2764,0x2765,0x2766,0x2767,0x2768,0x2769,0x276A, +0x276B,0x276C,0x276D,0x276E,0x276F,0x2770,0x2771, 0, +0x2757}; + +/* page 6 0x2010-0x203B */ +static uint16 tab_uni_jisx02086[]={ +0x213E, 0, 0, 0, 0,0x213D, 0, 0, +0x2146,0x2147, 0, 0,0x2148,0x2149, 0, 0, +0x2277,0x2278, 0, 0, 0,0x2145,0x2144, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2273, 0,0x216C,0x216D, 0, 0, 0, 0, + 0, 0, 0,0x2228}; + +/* page 7 0x2100-0x2116 */ +static uint16 tab_uni_jisx02087[]={ + 0, 0, 0,0x216E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x2D62}; + +/* page 8 0x2120-0x212B */ +static uint16 tab_uni_jisx02088[]={ + 0,0x2D64, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2272}; + +/* page 9 0x2160-0x2169 */ +static uint16 tab_uni_jisx02089[]={ +0x2D35,0x2D36,0x2D37,0x2D38,0x2D39,0x2D3A,0x2D3B,0x2D3C, +0x2D3D,0x2D3E}; + +/* page 10 0x2190-0x2193 */ +static uint16 tab_uni_jisx020810[]={ +0x222B,0x222C,0x222A,0x222D}; + +/* page 11 0x21D2-0x21D4 */ +static uint16 tab_uni_jisx020811[]={ +0x224D, 0,0x224E}; + +/* page 12 0x2200-0x223D */ +static uint16 tab_uni_jisx020812[]={ +0x224F, 0,0x225F,0x2250, 0, 0, 0,0x2260, +0x223A, 0, 0,0x223B, 0, 0, 0, 0, + 0,0x2D74, 0, 0, 0, 0, 0, 0, + 0, 0,0x2265, 0, 0,0x2267,0x2167,0x2D78, +0x225C, 0, 0, 0, 0,0x2142, 0,0x224A, +0x224B,0x2241,0x2240,0x2269,0x226A, 0,0x2D73, 0, + 0, 0, 0, 0,0x2168,0x2268, 0, 0, + 0, 0, 0, 0, 0,0x2266}; + +/* page 13 0x2252-0x226B */ +static uint16 tab_uni_jisx020813[]={ +0x2262, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x2162,0x2261, + 0, 0, 0, 0,0x2165,0x2166, 0, 0, +0x2263,0x2264}; + +/* page 14 0x2282-0x2287 */ +static uint16 tab_uni_jisx020814[]={ +0x223E,0x223F, 0, 0,0x223C,0x223D}; + +/* page 15 0x22A0-0x22BF */ +static uint16 tab_uni_jisx020815[]={ + 0, 0, 0, 0, 0,0x225D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2D79}; + +/* page 16 0x2312-0x2312 */ +static uint16 tab_uni_jisx020816[]={ +0x225E}; + +/* page 17 0x2460-0x2473 */ +static uint16 tab_uni_jisx020817[]={ +0x2D21,0x2D22,0x2D23,0x2D24,0x2D25,0x2D26,0x2D27,0x2D28, +0x2D29,0x2D2A,0x2D2B,0x2D2C,0x2D2D,0x2D2E,0x2D2F,0x2D30, +0x2D31,0x2D32,0x2D33,0x2D34}; + +/* page 18 0x2500-0x254B */ +static uint16 tab_uni_jisx020818[]={ +0x2821,0x282C,0x2822,0x282D, 0, 0, 0, 0, + 0, 0, 0, 0,0x2823, 0, 0,0x282E, +0x2824, 0, 0,0x282F,0x2826, 0, 0,0x2831, +0x2825, 0, 0,0x2830,0x2827,0x283C, 0, 0, +0x2837, 0, 0,0x2832,0x2829,0x283E, 0, 0, +0x2839, 0, 0,0x2834,0x2828, 0, 0,0x2838, +0x283D, 0, 0,0x2833,0x282A, 0, 0,0x283A, +0x283F, 0, 0,0x2835,0x282B, 0, 0,0x283B, + 0, 0,0x2840, 0, 0, 0, 0, 0, + 0, 0, 0,0x2836}; + +/* page 19 0x25A0-0x25CF */ +static uint16 tab_uni_jisx020819[]={ +0x2223,0x2222, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2225,0x2224, 0, 0, 0, 0, + 0, 0, 0, 0,0x2227,0x2226, 0, 0, + 0, 0, 0, 0, 0, 0,0x2221,0x217E, + 0, 0, 0,0x217B, 0, 0,0x217D,0x217C +}; + +/* page 20 0x25EF-0x25EF */ +static uint16 tab_uni_jisx020820[]={ +0x227E}; + +/* page 21 0x2605-0x2606 */ +static uint16 tab_uni_jisx020821[]={ +0x217A,0x2179}; + +/* page 22 0x2640-0x2642 */ +static uint16 tab_uni_jisx020822[]={ +0x216A, 0,0x2169}; + +/* page 23 0x266A-0x266F */ +static uint16 tab_uni_jisx020823[]={ +0x2276, 0, 0,0x2275, 0,0x2274}; + +/* page 24 0x3000-0x301F */ +static uint16 tab_uni_jisx020824[]={ +0x2121,0x2122,0x2123,0x2137, 0,0x2139,0x213A,0x213B, +0x2152,0x2153,0x2154,0x2155,0x2156,0x2157,0x2158,0x2159, +0x215A,0x215B,0x2229,0x222E,0x214C,0x214D, 0, 0, + 0, 0, 0, 0, 0,0x2D60, 0,0x2D61}; + +/* page 25 0x3041-0x30FE */ +static uint16 tab_uni_jisx020825[]={ +0x2421,0x2422,0x2423,0x2424,0x2425,0x2426,0x2427,0x2428, +0x2429,0x242A,0x242B,0x242C,0x242D,0x242E,0x242F,0x2430, +0x2431,0x2432,0x2433,0x2434,0x2435,0x2436,0x2437,0x2438, +0x2439,0x243A,0x243B,0x243C,0x243D,0x243E,0x243F,0x2440, +0x2441,0x2442,0x2443,0x2444,0x2445,0x2446,0x2447,0x2448, +0x2449,0x244A,0x244B,0x244C,0x244D,0x244E,0x244F,0x2450, +0x2451,0x2452,0x2453,0x2454,0x2455,0x2456,0x2457,0x2458, +0x2459,0x245A,0x245B,0x245C,0x245D,0x245E,0x245F,0x2460, +0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468, +0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470, +0x2471,0x2472,0x2473, 0, 0, 0, 0, 0, + 0, 0,0x212B,0x212C,0x2135,0x2136, 0, 0, +0x2521,0x2522,0x2523,0x2524,0x2525,0x2526,0x2527,0x2528, +0x2529,0x252A,0x252B,0x252C,0x252D,0x252E,0x252F,0x2530, +0x2531,0x2532,0x2533,0x2534,0x2535,0x2536,0x2537,0x2538, +0x2539,0x253A,0x253B,0x253C,0x253D,0x253E,0x253F,0x2540, +0x2541,0x2542,0x2543,0x2544,0x2545,0x2546,0x2547,0x2548, +0x2549,0x254A,0x254B,0x254C,0x254D,0x254E,0x254F,0x2550, +0x2551,0x2552,0x2553,0x2554,0x2555,0x2556,0x2557,0x2558, +0x2559,0x255A,0x255B,0x255C,0x255D,0x255E,0x255F,0x2560, +0x2561,0x2562,0x2563,0x2564,0x2565,0x2566,0x2567,0x2568, +0x2569,0x256A,0x256B,0x256C,0x256D,0x256E,0x256F,0x2570, +0x2571,0x2572,0x2573,0x2574,0x2575,0x2576, 0, 0, + 0, 0,0x2126,0x213C,0x2133,0x2134}; + +/* page 26 0x3230-0x3239 */ +static uint16 tab_uni_jisx020826[]={ + 0,0x2D6A,0x2D6B, 0, 0, 0, 0, 0, + 0,0x2D6C}; + +/* page 27 0x32A0-0x32A8 */ +static uint16 tab_uni_jisx020827[]={ + 0, 0, 0, 0,0x2D65,0x2D66,0x2D67,0x2D68, +0x2D69}; + +/* page 28 0x3300-0x33CD */ +static uint16 tab_uni_jisx020828[]={ + 0, 0, 0,0x2D46, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x2D4A, 0, 0, + 0, 0, 0, 0,0x2D41, 0, 0, 0, +0x2D44, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2D42,0x2D4C, 0, 0,0x2D4B,0x2D45, + 0, 0, 0,0x2D4D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x2D47, 0, + 0, 0, 0,0x2D4F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x2D40,0x2D4E, 0, 0,0x2D43, 0, 0, + 0,0x2D48, 0, 0, 0, 0, 0,0x2D49, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2D5F,0x2D6F,0x2D6E,0x2D6D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x2D53,0x2D54, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x2D50,0x2D51,0x2D52, 0, + 0,0x2D56, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x2D55, 0, 0, 0, + 0, 0, 0, 0, 0,0x2D63}; + +/* page 29 0x4E00-0x5516 */ +static uint16 tab_uni_jisx020829[]={ +0x306C,0x437A, 0,0x3C37, 0, 0, 0,0x4B7C, +0x3E66,0x3B30,0x3E65,0x323C, 0,0x4954,0x4D3F, 0, +0x5022,0x312F, 0, 0,0x336E,0x5023,0x4024,0x5242, +0x3556,0x4A3A, 0, 0, 0, 0,0x3E67, 0, + 0,0x4E3E, 0, 0, 0, 0,0x4A42, 0, + 0, 0,0x5024, 0, 0,0x4366, 0, 0, + 0,0x5025,0x367A, 0, 0, 0,0x5026, 0, +0x345D,0x4330, 0,0x3C67,0x5027, 0, 0,0x5028, + 0, 0,0x5029,0x4735, 0,0x3557, 0, 0, + 0, 0, 0,0x4737, 0,0x4663,0x3843,0x4B33, + 0, 0, 0, 0, 0,0x6949,0x502A,0x3E68, +0x502B,0x3235, 0, 0, 0,0x3665,0x3870,0x4C69, + 0, 0,0x5626, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4D70, 0,0x467D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3425, 0, +0x3535, 0,0x502C, 0, 0,0x502D,0x4E3B, 0, +0x4D3D,0x4168,0x502F,0x3B76,0x4673, 0,0x5032, 0, + 0,0x313E,0x385F, 0,0x385E,0x3066, 0, 0, +0x4F4B,0x4F4A, 0,0x3A33,0x3021, 0,0x5033,0x5034, +0x5035,0x4B34,0x5036, 0,0x3872,0x3067,0x4B72, 0, +0x357C, 0, 0,0x357D,0x357E,0x4462,0x4E3C, 0, +0x5037, 0, 0,0x5038, 0, 0,0x5039, 0, + 0, 0,0x3F4D, 0, 0, 0, 0, 0, +0x3D3A,0x3F4E,0x503E, 0,0x503C, 0,0x503D,0x3558, + 0, 0,0x3A23,0x3270, 0,0x503B,0x503A,0x4A29, + 0, 0, 0, 0,0x3B46,0x3B45,0x423E,0x503F, +0x4955,0x4067, 0, 0, 0,0x2138,0x5040,0x5042, + 0, 0, 0,0x4265,0x4E61,0x304A, 0, 0, + 0, 0, 0, 0, 0,0x5041,0x323E, 0, +0x3644, 0,0x4367, 0, 0, 0,0x376F,0x5043, + 0, 0, 0,0x4724, 0, 0, 0, 0, + 0,0x346B, 0, 0, 0, 0, 0, 0, + 0,0x5044,0x304B, 0, 0,0x3860,0x346C,0x497A, +0x4832,0x3559, 0, 0, 0, 0, 0, 0, + 0, 0,0x3271, 0,0x5067,0x4541, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x476C, +0x5046, 0, 0, 0,0x483C, 0,0x4E62, 0, +0x3F2D, 0,0x3B47, 0,0x3B77,0x3240, 0, 0, + 0, 0, 0,0x4451, 0, 0,0x4322,0x504A, + 0, 0, 0, 0, 0,0x304C,0x4463,0x3D3B, +0x3A34,0x4D24, 0,0x424E, 0,0x323F, 0,0x5049, + 0,0x4D3E,0x5045,0x5047,0x3A6E,0x5048,0x5524, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5050, 0, 0, 0, 0, 0,0x5053, +0x5051, 0, 0,0x3242, 0,0x4A3B,0x504B, 0, + 0, 0, 0,0x504F,0x3873, 0, 0,0x3B48, + 0, 0, 0,0x3426, 0, 0,0x5054, 0, +0x504C, 0, 0,0x4E63, 0,0x3B78, 0,0x504D, + 0,0x5052, 0, 0, 0, 0,0x5055, 0, +0x504E, 0, 0,0x3621, 0,0x304D, 0, 0, +0x3622,0x3241, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5525, 0,0x4B79,0x496E,0x3874, + 0, 0, 0, 0, 0,0x3F2F,0x4E37, 0, + 0, 0, 0, 0, 0, 0, 0,0x4A58, + 0, 0,0x3738,0x4225,0x3264, 0, 0, 0, + 0, 0,0x3D53, 0, 0, 0,0x5059, 0, +0x505E,0x505C, 0, 0,0x5057, 0, 0,0x422F, +0x505A, 0,0x505D,0x505B, 0,0x4A5D, 0,0x5058, + 0,0x3F2E, 0,0x4B73,0x505F,0x5060, 0, 0, + 0, 0, 0, 0, 0, 0,0x3D24,0x506D, + 0, 0, 0,0x4750, 0,0x4936,0x5068, 0, +0x4A70, 0,0x3236, 0, 0, 0,0x506C, 0, + 0, 0, 0, 0, 0,0x5066,0x506F, 0, + 0,0x4152, 0,0x3844, 0,0x475C, 0,0x6047, + 0,0x506E,0x455D, 0,0x5063, 0,0x3876, 0, + 0,0x3875,0x5061, 0, 0, 0, 0,0x3C5A, + 0,0x5069, 0,0x4A6F,0x434D,0x5065,0x3771, 0, +0x5062,0x506A,0x5064,0x4E51,0x506B,0x4F41, 0, 0, + 0, 0, 0, 0, 0, 0,0x3666, 0, + 0,0x3770, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5070, 0, 0, 0,0x5071, +0x5075,0x304E, 0, 0, 0, 0, 0,0x4A50, +0x5074, 0, 0, 0, 0,0x5073,0x5077, 0, + 0, 0,0x5076, 0,0x4464, 0, 0, 0, + 0, 0, 0, 0, 0,0x3772, 0, 0, + 0, 0, 0, 0,0x5078, 0, 0, 0, + 0, 0,0x3C45, 0,0x4226,0x4465,0x3676, 0, +0x5079, 0, 0, 0, 0,0x3536, 0, 0, +0x507A, 0, 0, 0, 0,0x507C, 0, 0, + 0, 0, 0, 0, 0,0x4B35, 0, 0, + 0,0x3766, 0, 0, 0, 0, 0, 0, +0x3B31,0x4877,0x507B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3A45,0x4D43, 0, 0, + 0, 0,0x507E,0x5123,0x507D,0x3A44, 0,0x3D7D, + 0, 0, 0, 0, 0, 0,0x3739, 0, + 0, 0,0x5124, 0, 0,0x364F, 0, 0, + 0,0x5121,0x5122, 0, 0,0x462F, 0,0x417C, + 0,0x3623, 0, 0, 0,0x4B4D,0x5125, 0, + 0, 0,0x4E3D, 0, 0, 0,0x5126, 0, + 0, 0, 0,0x5129, 0,0x5127, 0,0x414E, + 0, 0, 0, 0, 0,0x5128,0x512A, 0, + 0, 0, 0, 0, 0,0x512C, 0, 0, + 0,0x512B, 0,0x4A48, 0, 0, 0, 0, +0x3537,0x512E,0x512F, 0,0x322F, 0, 0, 0, + 0,0x512D, 0, 0, 0, 0, 0, 0, + 0, 0,0x3C74, 0,0x5132,0x5131,0x5130, 0, +0x5056, 0,0x5133, 0, 0, 0, 0,0x3D7E, + 0,0x5134, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D25, 0, 0, 0, 0, 0, + 0, 0,0x4C59, 0, 0, 0, 0,0x5136, + 0, 0,0x5135,0x5138,0x5137, 0, 0,0x5139, +0x513A,0x3074, 0,0x3835,0x373B,0x3D3C,0x437B,0x3624, +0x4068,0x3877, 0,0x396E,0x513C,0x4C48,0x4546, 0, +0x3B79, 0,0x513B, 0,0x513D, 0, 0, 0, + 0, 0,0x455E, 0,0x3375, 0, 0, 0, + 0, 0,0x513E, 0, 0,0x467E, 0, 0, +0x4134,0x5140,0x5141,0x482C,0x3878,0x4F3B,0x5142, 0, + 0,0x3626, 0, 0, 0,0x4A3C,0x4236,0x3671, +0x4535, 0, 0, 0,0x3773, 0, 0, 0, +0x5143, 0,0x5144, 0, 0,0x4662,0x315F, 0, + 0,0x5147,0x3A7D, 0,0x5146,0x3A46, 0,0x5148, +0x666E,0x5149,0x4B41,0x514A, 0,0x514B,0x514C,0x3E69, + 0,0x3C4C, 0, 0, 0, 0, 0, 0, +0x3427, 0,0x514F, 0,0x514D,0x4C3D,0x514E, 0, +0x495A,0x5150,0x5151,0x5152,0x455F, 0, 0, 0, +0x5156,0x5154,0x5155,0x5153,0x3A63,0x5157,0x4C6A,0x4E64, + 0, 0, 0, 0, 0,0x5158, 0, 0, + 0, 0, 0, 0,0x4028,0x5159,0x3D5A, 0, + 0,0x515A, 0,0x437C,0x4E3F,0x4560, 0, 0, + 0, 0, 0, 0, 0, 0,0x5245, 0, + 0, 0, 0,0x515B,0x7425,0x3645, 0, 0, +0x515C,0x4B5E, 0, 0, 0, 0,0x3D68,0x427C, + 0,0x515E,0x4664, 0, 0,0x515F, 0, 0, +0x5160,0x332E, 0, 0, 0,0x5161,0x3627, 0, +0x464C,0x317A,0x3D50, 0, 0,0x4821,0x5162, 0, +0x4561, 0, 0,0x3F4F,0x5163, 0,0x4A2C,0x405A, +0x3422, 0,0x3429,0x5164, 0, 0,0x5166, 0, + 0,0x373A, 0, 0,0x5165, 0, 0,0x4E73, + 0, 0, 0, 0, 0,0x3D69, 0, 0, + 0, 0, 0, 0,0x483D,0x4A4C, 0,0x5167, + 0,0x4D78,0x5168, 0, 0, 0,0x5169, 0, +0x457E, 0, 0,0x516A, 0, 0,0x4029,0x3A7E, +0x3774,0x516B,0x3B49,0x396F, 0, 0, 0, 0, + 0, 0, 0,0x4466,0x516D, 0, 0,0x4227, + 0, 0,0x3A6F,0x516E,0x516F,0x4130, 0,0x516C, + 0, 0, 0, 0,0x5171, 0,0x4B36, 0, + 0, 0, 0,0x3964, 0, 0,0x5170, 0, + 0, 0, 0,0x3775,0x3A5E,0x476D, 0, 0, + 0,0x5174,0x5172, 0, 0, 0, 0,0x497B, +0x3E6A,0x517B,0x3364,0x5175,0x5173,0x414F, 0, 0, + 0, 0, 0, 0, 0,0x5177, 0,0x5176, + 0, 0, 0,0x3344, 0, 0, 0,0x3760, +0x517C,0x4E2D, 0, 0, 0,0x5178, 0, 0, + 0,0x517D,0x517A, 0,0x5179, 0, 0, 0, + 0, 0, 0,0x4E4F, 0, 0, 0,0x3879, +0x3243, 0, 0,0x4E74, 0, 0, 0, 0, + 0,0x3D75,0x4558,0x3965,0x5222,0x5223, 0, 0, + 0,0x4E65, 0, 0,0x4F2B,0x5225, 0, 0, + 0,0x387A, 0, 0,0x5224, 0,0x332F, 0, + 0,0x5226, 0,0x4B56, 0,0x443C, 0,0x4D26, + 0,0x4A59, 0, 0, 0,0x5227, 0, 0, + 0, 0,0x7055, 0, 0,0x4630, 0,0x5228, +0x342A,0x4C33, 0, 0, 0,0x3E21,0x5229,0x4A67, +0x522D, 0,0x402A,0x522A,0x3650, 0,0x522B,0x342B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x372E,0x522E, 0,0x522F, 0, 0, +0x5230,0x5231,0x3C5B, 0, 0, 0,0x387B,0x4C5E, + 0,0x4C68,0x4677, 0, 0,0x4A71,0x5232, 0, +0x5233, 0, 0, 0, 0,0x5235, 0,0x5237, +0x5236, 0, 0, 0, 0,0x5238,0x323D,0x4B4C, + 0,0x3A7C,0x5239, 0, 0,0x4159, 0, 0, +0x3E22,0x3629, 0,0x523A, 0, 0, 0, 0, + 0, 0,0x485B, 0, 0, 0, 0,0x523B, + 0,0x523C, 0,0x523D, 0, 0, 0, 0, +0x523E,0x4924,0x3668,0x3065, 0, 0, 0,0x463F, +0x523F,0x3D3D, 0,0x4069, 0,0x5241,0x5240,0x3E23, +0x3861,0x5243,0x483E, 0, 0,0x5244, 0, 0, + 0,0x485C,0x4234,0x426E,0x3628, 0, 0,0x466E, +0x4331, 0,0x476E, 0,0x4B4E, 0,0x5246, 0, +0x406A, 0, 0, 0, 0, 0,0x3735, 0, + 0,0x5247, 0, 0, 0, 0,0x5248,0x312C, +0x3075,0x346D, 0,0x4228,0x3551,0x4D71, 0,0x524B, +0x3237, 0, 0,0x524A, 0, 0, 0,0x362A, + 0, 0,0x524C, 0,0x4C71, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x524D, 0, +0x4E52, 0,0x387C, 0, 0, 0, 0,0x3836, +0x524E, 0, 0, 0, 0,0x5250,0x524F, 0, +0x3F5F,0x3139, 0, 0, 0,0x315E,0x5251, 0, +0x5252, 0, 0,0x3837, 0, 0,0x5253, 0, + 0, 0, 0,0x356E, 0, 0, 0, 0, + 0, 0,0x3B32,0x5254, 0, 0, 0, 0, +0x4B74,0x3A35,0x355A,0x4D27,0x4150,0x483F,0x3C7D, 0, + 0, 0, 0, 0,0x3D47, 0,0x3C68,0x3C75, + 0,0x3D76, 0,0x4840, 0, 0, 0,0x5257, + 0,0x3143,0x4151,0x387D,0x3845,0x3667, 0, 0, +0x525B,0x4321,0x427E,0x362B,0x3E24,0x525C,0x525A,0x3244, +0x4266,0x3C38,0x3B4B,0x3126, 0, 0,0x3370,0x3966, +0x3B4A, 0,0x525D, 0, 0, 0, 0, 0, + 0,0x525E, 0,0x3549,0x3346, 0, 0, 0, +0x3967,0x3548,0x445F,0x3125,0x4631,0x4C3E,0x3921,0x4D79, +0x4547,0x387E, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x372F, 0,0x5267, 0,0x3663, +0x4B4A, 0, 0, 0, 0, 0,0x485D, 0, + 0,0x5266, 0,0x345E,0x5261,0x5262,0x5264, 0, + 0, 0, 0, 0, 0, 0,0x5265, 0, +0x355B,0x3F61, 0,0x4A2D,0x5263,0x525F,0x3863, 0, +0x5260, 0,0x4F24, 0, 0, 0,0x4A72, 0, +0x4468,0x3862,0x3970, 0, 0, 0,0x5268, 0, + 0,0x465D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x526C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3C7E, 0,0x3C76, 0, 0, 0, 0, 0, +0x526F,0x526D, 0,0x4C23, 0,0x526A,0x5273,0x526E, + 0, 0, 0,0x5271,0x3846,0x4C3F, 0, 0, +0x5272, 0, 0, 0,0x5274, 0,0x5276, 0, + 0, 0, 0,0x3A70,0x4F42, 0,0x526B,0x5269, +0x5275, 0,0x5270, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5278, 0,0x5323,0x527A, 0, 0, +0x527E, 0, 0,0x5321,0x527B, 0, 0,0x533E, + 0, 0,0x3A69,0x3331, 0, 0, 0, 0, +0x5279, 0, 0, 0,0x5325,0x3076,0x5324, 0, +0x3025,0x494A,0x5322, 0,0x527C, 0, 0,0x5277, +0x527D,0x3A48, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5326, 0, 0, 0, 0, 0, 0, 0, + 0,0x3077,0x532F, 0, 0,0x5327,0x5328, 0, +0x3E25,0x4B69, 0, 0, 0,0x532D,0x532C, 0, + 0, 0,0x452F, 0, 0, 0, 0, 0, + 0, 0,0x532E, 0, 0,0x532B, 0, 0, + 0, 0, 0, 0,0x3134, 0,0x3A36,0x3F30, + 0, 0, 0, 0, 0, 0, 0,0x5329, +0x4562, 0, 0, 0,0x532A, 0,0x3022}; + +/* page 30 0x552E-0x5563 */ +static uint16 tab_uni_jisx020830[]={ +0x5334,0x4D23, 0,0x3E27, 0,0x533A, 0, 0, + 0, 0,0x5339,0x5330, 0, 0, 0, 0, +0x4243, 0,0x5331, 0, 0, 0,0x426F,0x5336, +0x3E26, 0, 0, 0, 0, 0,0x5333, 0, + 0,0x4C64, 0, 0, 0,0x373C, 0, 0, +0x5337,0x5338, 0, 0, 0, 0,0x5335,0x533B, + 0, 0, 0, 0, 0,0x5332}; + +/* page 31 0x557B-0x576A */ +static uint16 tab_uni_jisx020831[]={ +0x5341,0x5346, 0,0x5342, 0,0x533D, 0, 0, +0x5347,0x4131, 0, 0,0x5349, 0,0x3922,0x533F, +0x437D, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5343,0x533C,0x342D, + 0,0x346E,0x3365,0x5344,0x5340, 0, 0, 0, + 0, 0, 0, 0,0x3776,0x534A,0x5348,0x4153, +0x354A,0x362C, 0,0x5345, 0,0x3674, 0, 0, + 0, 0, 0,0x3144, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x534E,0x534C, 0,0x5427, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5351, 0, 0, 0, 0, 0,0x534B, + 0,0x534F, 0, 0,0x534D, 0, 0, 0, +0x3B4C,0x5350, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5353, 0,0x5358, 0, + 0, 0,0x5356,0x5355, 0, 0, 0, 0, + 0, 0, 0,0x4332, 0, 0,0x3245, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5352, 0,0x5354,0x3E28,0x3133, 0, 0, +0x5357, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x325E, 0, + 0, 0, 0, 0,0x5362, 0,0x3E7C,0x535E, + 0,0x535C, 0,0x535D, 0,0x535F, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x313D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4139, 0,0x5359, 0,0x535A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x337A, 0, 0, 0, 0, 0, 0, 0, + 0,0x5361, 0, 0, 0,0x346F, 0,0x5364, +0x5360,0x5363, 0, 0, 0, 0, 0, 0, + 0,0x4A2E, 0, 0, 0,0x4655, 0,0x4838, + 0, 0, 0, 0, 0,0x5366, 0, 0, + 0, 0, 0,0x5365,0x3345, 0, 0,0x5367, + 0, 0, 0, 0,0x536A, 0, 0, 0, + 0,0x5369, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5368, 0,0x4739, + 0, 0,0x536B, 0, 0, 0, 0, 0, + 0, 0, 0,0x536C, 0, 0, 0, 0, + 0,0x536E, 0,0x536D, 0, 0, 0, 0, + 0,0x5370, 0, 0, 0,0x5373,0x5371,0x536F, +0x5372, 0, 0, 0, 0,0x5374, 0, 0, + 0, 0, 0,0x5375, 0, 0,0x5376, 0, +0x5377, 0, 0, 0,0x5378,0x5145, 0,0x3C7C, +0x3B4D, 0, 0,0x3273, 0,0x3078, 0, 0, +0x4344, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5379, 0,0x3A24, 0,0x304F, +0x3F5E, 0, 0, 0, 0, 0,0x537A,0x3847, + 0, 0,0x3971, 0,0x537C,0x537B, 0, 0, +0x4A60,0x537D, 0, 0, 0,0x5421,0x537E, 0, +0x5422, 0,0x5423, 0,0x3777, 0, 0,0x3160, +0x5424, 0, 0,0x5426, 0,0x5425, 0, 0, + 0,0x5428, 0, 0,0x455A, 0, 0, 0, + 0, 0, 0,0x5429,0x3035,0x3A5F, 0, 0, + 0, 0,0x373D, 0, 0,0x434F, 0, 0, + 0, 0, 0, 0,0x542A,0x542B, 0, 0, +0x542D, 0, 0, 0, 0,0x542E, 0,0x3A64, + 0, 0, 0, 0,0x3651, 0, 0,0x4B37, + 0, 0, 0,0x542C,0x542F,0x3A41,0x3923, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5433, 0, + 0,0x3A25, 0,0x4333, 0, 0,0x5430,0x445A +}; + +/* page 32 0x577F-0x5A9B */ +static uint16 tab_uni_jisx020832[]={ +0x5434, 0, 0,0x3F62, 0, 0, 0, 0, + 0,0x5432,0x5435, 0,0x373F, 0, 0, 0, + 0, 0, 0, 0,0x5436, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5437, 0,0x3924,0x3340,0x5439, 0, 0, + 0, 0, 0,0x543A, 0, 0, 0, 0, + 0,0x543B, 0, 0,0x5438, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5431, 0, 0,0x543C, 0, 0,0x543D, + 0, 0, 0, 0,0x4B64, 0, 0,0x3E6B, + 0, 0, 0,0x543F,0x5440,0x543E, 0,0x5442, + 0, 0, 0, 0, 0,0x4738, 0, 0, +0x3068,0x4956, 0, 0,0x5443, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3E7D, 0, 0, +0x3C39, 0,0x475D,0x3470, 0,0x3A6B, 0, 0, + 0,0x4B59, 0,0x4632, 0, 0,0x3778,0x424F, + 0, 0, 0,0x5441,0x5444, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4244, 0, + 0, 0,0x5445, 0, 0, 0,0x5446, 0, + 0, 0,0x5448, 0, 0,0x4469, 0, 0, + 0, 0, 0,0x342E, 0, 0, 0, 0, +0x7421,0x3161,0x4A73, 0, 0,0x3E6C,0x4548, 0, + 0, 0, 0,0x3A66, 0, 0,0x544E, 0, + 0,0x4A3D,0x4E5D, 0, 0, 0, 0, 0, + 0, 0, 0,0x3274,0x544A, 0, 0, 0, + 0, 0,0x413A,0x544D, 0,0x4563, 0, 0, +0x4549,0x4564,0x4839,0x444D, 0, 0, 0,0x3A49, + 0, 0, 0,0x5449, 0, 0, 0, 0, + 0, 0,0x3176, 0,0x4536, 0, 0, 0, + 0,0x544B, 0,0x5447, 0, 0,0x3F50, 0, + 0, 0,0x544F, 0, 0, 0, 0,0x3D4E, + 0, 0, 0, 0,0x362D, 0,0x5450, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4A68, 0, 0, 0, +0x417D, 0, 0, 0, 0,0x4446, 0, 0, +0x5452, 0, 0, 0, 0, 0, 0, 0, + 0,0x4B4F, 0, 0,0x5453, 0, 0,0x5458, + 0, 0, 0, 0,0x4A2F, 0, 0, 0, + 0,0x5457,0x5451,0x5454,0x5456, 0, 0,0x3A26, + 0, 0,0x4A49, 0, 0, 0,0x5459, 0, +0x4345, 0, 0,0x3275, 0,0x3E6D, 0, 0, + 0, 0,0x545B, 0,0x545A, 0,0x3968, 0, +0x545C,0x545E,0x545D, 0, 0,0x5460, 0,0x5455, +0x5462, 0, 0, 0, 0,0x5461,0x545F, 0, + 0, 0, 0, 0,0x3B4E,0x3F51, 0,0x4154, +0x5463,0x403C,0x306D,0x4764, 0, 0, 0, 0, +0x445B, 0,0x5465,0x5464,0x5466,0x5467,0x5468, 0, + 0, 0, 0,0x5469, 0, 0, 0, 0, + 0, 0,0x4A51,0x546A, 0, 0, 0, 0, +0x3246,0x546B, 0, 0, 0, 0,0x4D3C,0x3330, + 0,0x5249,0x3D48,0x423F,0x546C,0x4C6B, 0, 0, + 0, 0, 0,0x4C34, 0, 0,0x546E, 0, +0x4267, 0,0x4537,0x4240,0x4957,0x546F,0x5470,0x317B, + 0, 0,0x3C3A,0x5471, 0, 0, 0, 0, +0x3050,0x5472, 0, 0, 0, 0, 0,0x5473, + 0, 0, 0, 0, 0,0x3162, 0, 0, +0x3471,0x4660,0x4A74, 0, 0, 0, 0,0x5477, +0x4155,0x5476,0x3740, 0, 0,0x4B5B,0x5475, 0, +0x4565,0x5479, 0,0x5478, 0, 0, 0, 0, + 0,0x547B, 0,0x547A, 0, 0,0x317C, 0, +0x547C,0x3E29,0x547E,0x4325, 0,0x547D, 0,0x4A33, + 0, 0, 0, 0,0x3D77,0x455B, 0, 0, + 0,0x5521, 0, 0, 0, 0,0x3925, 0, + 0, 0,0x5522,0x4721,0x485E,0x4C51, 0, 0, + 0, 0, 0,0x4725, 0, 0,0x552B, 0, + 0, 0, 0, 0,0x3538, 0, 0,0x4D45, + 0, 0,0x4C2F, 0,0x562C, 0,0x5523, 0, + 0, 0, 0, 0,0x5526, 0,0x4245, 0, + 0,0x4B38, 0, 0, 0,0x454A, 0, 0, + 0, 0, 0,0x5527, 0, 0, 0, 0, + 0, 0,0x4B65, 0,0x3A4A, 0, 0,0x3E2A, + 0, 0, 0, 0, 0, 0, 0,0x5528, + 0, 0,0x3B50, 0,0x3B4F, 0, 0, 0, + 0,0x3039,0x3848, 0,0x402B,0x3051, 0, 0, + 0, 0,0x552C,0x552D, 0,0x552A, 0, 0, + 0, 0, 0, 0, 0, 0,0x3138,0x342F, + 0,0x5529, 0,0x4C45,0x4931, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3028, + 0, 0, 0, 0,0x3079, 0, 0, 0, +0x3B51, 0,0x3052, 0,0x3023, 0, 0, 0, + 0, 0,0x5532, 0, 0, 0, 0, 0, + 0, 0,0x5530, 0, 0, 0, 0, 0, + 0,0x4C3C, 0,0x5533, 0,0x5531, 0, 0, +0x552F,0x3F31, 0, 0, 0, 0,0x552E, 0, + 0, 0,0x4A5A, 0, 0, 0, 0, 0, +0x3864, 0, 0, 0, 0, 0,0x5537,0x5538, + 0, 0, 0, 0, 0,0x3E2B, 0, 0, + 0,0x5534,0x4F2C, 0, 0, 0, 0,0x474C, + 0, 0,0x5536, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3A27, 0, 0, 0, 0, + 0, 0, 0,0x5539, 0, 0, 0,0x4958, + 0, 0, 0,0x553A, 0,0x5535, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4C3B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x475E, 0, 0, 0, 0, + 0, 0, 0,0x553B,0x4932}; + +/* page 33 0x5ABC-0x5D29 */ +static uint16 tab_uni_jisx020833[]={ +0x553C,0x5540,0x553D, 0, 0,0x3247,0x553F, 0, + 0, 0, 0, 0, 0,0x3C3B, 0,0x553E, +0x3779, 0, 0, 0,0x554C, 0, 0, 0, + 0, 0,0x5545,0x5542, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4364, 0,0x5541, + 0, 0,0x5543, 0, 0,0x5544, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5546,0x5547, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3472, 0,0x5549, +0x5548, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x554A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3E6E, 0, + 0, 0, 0, 0, 0, 0,0x554D, 0, +0x445C, 0, 0, 0,0x3145, 0,0x554B, 0, + 0, 0,0x554E, 0, 0, 0, 0, 0, + 0, 0,0x554F, 0,0x5552, 0, 0,0x5550, + 0,0x5551, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3B52,0x5553, 0, 0, +0x3926,0x5554, 0,0x3B7A,0x4238, 0,0x5555,0x5556, +0x3B5A,0x3927, 0,0x4C52, 0, 0, 0,0x3528, +0x3849,0x5557,0x3358, 0, 0,0x5558, 0,0x4239, + 0, 0, 0, 0,0x5559,0x5623, 0,0x555A, + 0,0x555B, 0, 0,0x555C, 0,0x555E, 0, + 0, 0, 0, 0,0x555F, 0, 0,0x5560, + 0,0x4270, 0,0x3127,0x3C69,0x3042, 0,0x4157, +0x3430,0x3C35, 0,0x3928, 0, 0, 0, 0, + 0,0x4566, 0,0x3D21,0x3431,0x4368,0x446A,0x3038, +0x3539,0x4A75, 0,0x3C42, 0, 0,0x3552,0x406B, +0x3C3C,0x4D28,0x5561, 0, 0, 0, 0, 0, + 0, 0,0x355C, 0,0x3A4B, 0, 0,0x3332, +0x3163,0x3E2C,0x3248, 0,0x5562,0x4D46, 0, 0, + 0, 0, 0,0x3D49, 0, 0,0x3C64,0x5563, +0x3473,0x4652,0x4C29,0x5564, 0,0x5565, 0, 0, +0x4959, 0, 0, 0,0x5567, 0,0x3428,0x3677, +0x5566, 0, 0, 0, 0, 0, 0,0x3432, + 0,0x3F32,0x556B,0x3B21, 0,0x3249,0x556A, 0, +0x5568,0x556C,0x5569,0x472B,0x5C4D,0x3F33, 0,0x556D, + 0, 0,0x4E40, 0,0x556E, 0, 0,0x5570, + 0,0x437E,0x556F, 0,0x4023, 0,0x3B7B, 0, + 0, 0,0x4250,0x3C77, 0,0x4975,0x406C, 0, +0x3C4D,0x5571,0x3E2D,0x5572,0x5573,0x3053,0x423A,0x3F52, + 0,0x5574,0x4633,0x3E2E, 0,0x3E2F, 0,0x5575, + 0, 0,0x406D, 0, 0, 0,0x3E30, 0, + 0, 0, 0, 0,0x5576, 0,0x5577, 0, +0x4C60, 0, 0, 0,0x5578, 0, 0, 0, + 0,0x3646, 0, 0, 0,0x3D22, 0, 0, + 0, 0, 0, 0,0x5579,0x557A,0x3C5C,0x3F2C, +0x4674,0x3F54,0x4878,0x4722,0x3649,0x557B, 0, 0, + 0,0x356F,0x557C, 0,0x367E, 0,0x464F,0x3230, + 0,0x3B53,0x557D,0x5622,0x5621,0x367D, 0,0x557E, + 0,0x4538, 0, 0, 0, 0, 0, 0, + 0, 0,0x4230, 0,0x454B,0x3C48, 0, 0, +0x4158,0x4D7A, 0, 0, 0, 0, 0, 0, +0x5624, 0,0x5625,0x4656, 0,0x3B33, 0, 0, + 0, 0,0x5627, 0, 0,0x5628, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5629, 0, 0, 0,0x3474,0x562A, 0, 0, +0x562B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x322C, 0, 0, + 0, 0, 0, 0,0x413B,0x3464, 0,0x562D, +0x4C28, 0, 0, 0, 0,0x4252, 0,0x3359, + 0, 0,0x562F,0x5631,0x345F, 0, 0,0x562E, +0x5630, 0,0x5633, 0, 0, 0, 0, 0, + 0,0x5632, 0,0x5634, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5635, 0, 0, + 0, 0, 0, 0,0x463D,0x362E, 0, 0, + 0, 0, 0, 0,0x3265,0x5636,0x563B, 0, + 0,0x5639, 0,0x4A77,0x4A76, 0, 0, 0, + 0, 0,0x4567, 0, 0, 0,0x5638,0x3D54, + 0,0x5637, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F72, 0, 0, 0,0x563C, + 0, 0,0x3A6A, 0, 0,0x5642, 0, 0, +0x5643,0x563D,0x3333,0x563E,0x5647,0x5646,0x5645,0x5641, + 0, 0, 0,0x5640, 0, 0,0x5644, 0, + 0, 0, 0, 0, 0,0x4A78}; + +/* page 34 0x5D4B-0x6BF3 */ +static uint16 tab_uni_jisx020834[]={ +0x564B,0x5648, 0,0x564A, 0,0x4D72, 0,0x5649, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x563F, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3F73, 0, + 0,0x564C, 0, 0,0x3A37, 0, 0, 0, +0x564D, 0, 0,0x564E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5651, + 0,0x5650, 0, 0,0x564F, 0, 0, 0, +0x4568,0x563A, 0, 0, 0,0x5657, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5653, 0, 0, 0, 0,0x5652, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5654, 0,0x5655, 0, 0, 0, 0, + 0, 0, 0, 0,0x5658, 0, 0,0x4E66, + 0,0x5659,0x5656, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x565A, 0, + 0,0x3460,0x565B, 0, 0, 0, 0,0x565D, +0x565C, 0, 0,0x565E, 0, 0, 0, 0, +0x565F, 0,0x406E,0x3D23, 0, 0,0x3D64, 0, +0x4163, 0,0x3929,0x3A38,0x392A,0x3570, 0, 0, +0x5660, 0, 0,0x3A39, 0, 0,0x384A,0x5661, +0x4C26,0x4743,0x5662, 0,0x392B, 0, 0, 0, +0x342C, 0,0x4327,0x3652, 0, 0, 0,0x3B54, +0x495B, 0, 0,0x4841, 0, 0, 0, 0, +0x5663,0x3475, 0, 0, 0, 0,0x5666, 0, + 0, 0, 0,0x4421, 0, 0,0x5665,0x5664, +0x5667, 0,0x446B, 0, 0, 0, 0, 0, + 0, 0,0x3F63, 0, 0, 0, 0, 0, +0x3B55, 0,0x404A, 0,0x4253,0x3522, 0, 0, +0x4422, 0, 0,0x5668,0x5669,0x3E6F, 0, 0, + 0, 0,0x4B39, 0, 0,0x566C, 0, 0, +0x566B,0x566A,0x497D, 0,0x5673, 0, 0, 0, + 0,0x4B5A, 0,0x566D, 0, 0, 0, 0, + 0,0x566F,0x4B6B, 0,0x566E, 0, 0, 0, + 0, 0, 0, 0,0x5670, 0,0x4828,0x5671, +0x4A3E,0x5672, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3433, +0x4A3F,0x472F,0x5674,0x5675, 0,0x392C,0x3434,0x5676, +0x3838,0x4D44,0x4D29,0x3476,0x5678, 0,0x4423, 0, +0x392D,0x3E31, 0, 0,0x485F, 0, 0,0x3E32, + 0, 0, 0, 0,0x3D78, 0, 0, 0, + 0, 0,0x446C,0x4A79,0x4539, 0, 0,0x392E, + 0,0x495C, 0, 0, 0,0x5679, 0, 0, + 0, 0, 0,0x4559,0x3A42, 0, 0, 0, +0x384B, 0,0x446D, 0, 0, 0, 0, 0, + 0, 0,0x3043,0x3D6E,0x392F,0x4D47, 0, 0, + 0, 0, 0, 0, 0, 0,0x567A,0x567B, +0x4751, 0, 0, 0, 0,0x567C,0x4E77,0x4F2D, + 0, 0, 0, 0,0x567E,0x567D, 0, 0, +0x3347, 0, 0,0x5721, 0, 0, 0,0x5724, +0x5725, 0,0x5723, 0,0x4940,0x3E33,0x5727,0x5726, +0x5722, 0, 0, 0, 0,0x5728,0x5729, 0, + 0,0x572A, 0, 0, 0,0x572D,0x572B, 0, +0x572C,0x572E, 0,0x3164,0x446E,0x572F, 0,0x377A, +0x3276,0x4736, 0,0x5730,0x467B, 0,0x4A5B, 0, +0x5731,0x4F2E, 0, 0, 0, 0,0x5732,0x4A40, +0x5735,0x5021,0x5031, 0,0x3C30,0x4675,0x5736, 0, +0x355D,0x4424,0x307A,0x5737,0x4A26,0x3930, 0, 0, +0x4350, 0, 0, 0,0x446F, 0, 0, 0, + 0, 0,0x4C6F,0x3839,0x384C, 0,0x5738, 0, + 0, 0,0x5739, 0,0x573F, 0,0x3C65, 0, + 0, 0,0x4425, 0,0x362F,0x573A, 0, 0, + 0,0x492B, 0,0x4346, 0, 0,0x573B, 0, + 0, 0, 0, 0, 0,0x573C, 0,0x3630, + 0,0x573D, 0,0x573E, 0, 0,0x5740, 0, +0x4576, 0, 0,0x5741,0x5742, 0,0x5743, 0, + 0,0x5734,0x5733, 0, 0, 0,0x5744,0x3741, + 0, 0, 0,0x4927, 0, 0,0x3A4C,0x4937, +0x4426,0x494B,0x5745, 0, 0,0x3E34,0x3146, 0, +0x5746, 0, 0, 0,0x5747, 0,0x4C72, 0, + 0,0x4860, 0, 0,0x574A,0x317D,0x402C,0x5749, +0x5748,0x3742,0x4254, 0,0x574E,0x574C, 0,0x574B, +0x4E27,0x3865, 0, 0, 0,0x3D79,0x574D,0x454C, +0x3D3E, 0, 0, 0,0x4640,0x5751,0x5750, 0, + 0, 0, 0,0x574F, 0,0x5752,0x3866, 0, + 0, 0, 0, 0, 0,0x5753,0x497C,0x3D5B, + 0, 0,0x5754,0x4879, 0, 0, 0, 0, +0x4641,0x4427, 0, 0, 0, 0,0x4530, 0, + 0,0x5755,0x352B, 0, 0, 0, 0, 0, +0x3F34, 0,0x492C, 0, 0, 0, 0, 0, + 0,0x3477,0x4726, 0, 0, 0, 0, 0, + 0, 0, 0,0x5756,0x3B56,0x4B3A,0x4B3B, 0, + 0,0x317E,0x575B, 0, 0,0x4369, 0, 0, + 0,0x5758, 0, 0, 0, 0, 0, 0, +0x3277, 0, 0, 0, 0,0x582D,0x575A, 0, + 0, 0,0x4730, 0, 0,0x5759, 0, 0, +0x5757, 0,0x397A, 0,0x575D, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5763,0x5769,0x5761, 0,0x455C, + 0, 0,0x5766,0x495D, 0, 0,0x5760, 0, +0x5765,0x4E67,0x3B57, 0, 0,0x4255,0x575E, 0, + 0, 0,0x355E,0x5768,0x402D,0x3165,0x5762,0x3278, +0x5767, 0, 0, 0,0x3631, 0,0x5764, 0, + 0, 0, 0, 0, 0, 0, 0,0x576A, + 0, 0, 0, 0, 0, 0,0x576C,0x5776, +0x5774, 0, 0,0x5771, 0, 0, 0,0x5770, +0x4E78, 0,0x5772, 0, 0,0x3632, 0,0x3931, + 0, 0,0x3D7A, 0, 0, 0,0x5779,0x576B, + 0, 0, 0, 0,0x576F,0x575F, 0,0x327A, +0x5773,0x5775,0x4351, 0, 0,0x3A28,0x3238,0x576D, +0x5778,0x5777,0x3633, 0,0x4229,0x3366, 0, 0, + 0, 0,0x3743, 0,0x576E, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x577A, 0, +0x577D,0x5821, 0, 0, 0, 0,0x3C3D, 0, +0x5827,0x4470,0x577B, 0, 0, 0, 0,0x5825, + 0,0x3279, 0,0x5823,0x5824, 0, 0,0x577E, +0x5822, 0, 0, 0,0x3867,0x4D2A, 0, 0, +0x3435, 0, 0,0x3159,0x5826, 0,0x473A,0x302D, + 0, 0, 0, 0, 0, 0, 0,0x4861, +0x575C,0x582C,0x5830,0x4C65, 0,0x5829, 0, 0, + 0,0x4569,0x582E, 0, 0, 0, 0, 0, + 0, 0,0x3E70,0x582F,0x4657, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4F47, 0, +0x582B, 0, 0, 0, 0,0x5831, 0,0x397B, + 0,0x404B, 0, 0,0x3054,0x582A,0x5828, 0, +0x415A, 0, 0, 0,0x577C,0x3B34, 0, 0, + 0, 0, 0, 0, 0,0x4246,0x583D, 0, +0x415B,0x5838, 0,0x5835,0x5836, 0,0x3C66,0x5839, +0x583C, 0, 0, 0, 0,0x5837,0x3D25, 0, +0x583A, 0, 0,0x5834, 0,0x4C7C,0x4C7B, 0, + 0, 0,0x583E,0x583F,0x3055, 0, 0, 0, + 0, 0,0x5833, 0, 0, 0, 0,0x3672, +0x3026, 0, 0, 0,0x3436, 0,0x583B, 0, + 0, 0, 0, 0,0x5843,0x5842, 0, 0, + 0,0x5847, 0, 0, 0, 0, 0, 0, + 0,0x5848, 0, 0, 0, 0, 0, 0, + 0,0x5846,0x5849,0x5841,0x5845, 0, 0,0x584A, + 0,0x584B, 0, 0,0x5840,0x3B7C, 0,0x5844, +0x4256,0x3932,0x5832,0x3F35, 0, 0, 0, 0, +0x5858, 0,0x4A69, 0, 0,0x584E,0x584F,0x5850, + 0, 0,0x5857, 0,0x5856, 0, 0,0x4B7D, +0x3437, 0,0x5854, 0,0x3745,0x3334, 0, 0, +0x5851, 0, 0,0x4E38,0x5853,0x3056,0x5855, 0, +0x584C,0x5852,0x5859,0x3744,0x584D, 0, 0, 0, + 0, 0, 0,0x4D5D, 0, 0, 0,0x4D2B, + 0, 0, 0, 0,0x585C, 0, 0,0x5860, + 0, 0, 0,0x417E, 0,0x4E79,0x5861, 0, + 0,0x585E, 0,0x585B, 0, 0,0x585A,0x585F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4A30, 0, 0,0x4634, 0,0x3746, 0, +0x5862,0x585D, 0,0x5863, 0, 0, 0,0x377B, + 0, 0, 0,0x3231, 0, 0, 0,0x586B, + 0, 0, 0,0x3438, 0, 0, 0, 0, +0x5869, 0, 0,0x586A,0x3A29,0x5868,0x5866,0x5865, +0x586C,0x5864,0x586E, 0, 0,0x327B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5870, 0, 0,0x586F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4428, + 0,0x5873, 0,0x5871,0x5867,0x377C, 0,0x5872, + 0,0x5876,0x5875,0x5877,0x5874,0x5878, 0, 0, + 0, 0, 0, 0, 0,0x5879,0x587A,0x4A6A, + 0,0x587C,0x587B,0x3D3F, 0,0x402E,0x3266,0x327C, + 0,0x587D, 0,0x303F, 0, 0, 0,0x404C, +0x587E, 0,0x6C43,0x5921,0x3761, 0,0x5922, 0, + 0, 0, 0,0x406F, 0, 0, 0,0x5923, + 0, 0, 0,0x5924,0x353A,0x5925, 0,0x5926, +0x5927,0x4257, 0, 0, 0,0x384D, 0, 0, +0x4C61, 0, 0, 0,0x4B3C,0x3D6A,0x5928, 0, + 0, 0, 0, 0,0x4070,0x6E3D,0x4862, 0, +0x3C6A, 0,0x3A4D,0x5929, 0, 0, 0, 0, +0x4247, 0,0x4A27, 0, 0,0x4271, 0, 0, +0x592C, 0, 0,0x592A, 0,0x592D, 0, 0, +0x592B, 0, 0, 0, 0,0x592E, 0, 0, + 0, 0, 0,0x4A31, 0, 0,0x3037, 0, + 0, 0, 0,0x495E, 0, 0,0x4863, 0, + 0,0x592F, 0,0x5932,0x3E35,0x353B, 0,0x5930, +0x5937,0x3E36, 0, 0, 0, 0,0x5931,0x4744, + 0, 0, 0, 0, 0, 0,0x4D5E,0x5933, +0x5934,0x5938,0x456A,0x5935,0x3933,0x405E, 0, 0, +0x5946,0x4834, 0,0x4272, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4864,0x5A2D, 0, 0, 0, 0,0x4A7A, 0, + 0, 0,0x4471, 0, 0, 0,0x4B75, 0, +0x593B,0x3221,0x436A, 0, 0, 0, 0,0x5944, + 0, 0,0x4334,0x593E,0x5945,0x5940,0x5947,0x5943, + 0,0x5942,0x476F, 0,0x593C,0x327D,0x593A,0x3571, +0x4273,0x5936, 0, 0,0x5939,0x3934,0x405B, 0, +0x3E37,0x5941,0x4752, 0, 0,0x3572,0x3348, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3367,0x3F21,0x5949,0x594E, 0,0x594A, 0, +0x377D, 0,0x594F,0x3B22,0x3969, 0, 0, 0, + 0, 0, 0,0x3D26,0x593D, 0,0x3B7D,0x594C, + 0, 0, 0, 0,0x3B58,0x594D,0x3044, 0, + 0,0x5948, 0, 0, 0, 0,0x4429, 0, + 0, 0, 0, 0, 0, 0,0x3573, 0, + 0, 0, 0, 0,0x3634, 0, 0, 0, + 0, 0, 0, 0,0x594B,0x3027, 0, 0, +0x3A43, 0, 0, 0,0x3F36, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4472, + 0, 0,0x4854,0x5951,0x415E, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x422A, 0, + 0,0x3B2B,0x5952, 0,0x5954,0x5950, 0, 0, + 0, 0,0x4A61, 0,0x443D, 0, 0, 0, + 0,0x415C, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4A7B,0x3C4E,0x5960, 0, +0x595F, 0, 0,0x3F78, 0, 0, 0,0x377E, + 0, 0, 0,0x5959,0x3E39, 0, 0,0x4668, +0x4731, 0, 0, 0, 0,0x5957, 0, 0, +0x415D, 0, 0, 0, 0,0x3C78,0x595C, 0, + 0,0x3E38, 0,0x5956,0x595B, 0, 0,0x4753, + 0, 0, 0,0x5955, 0,0x3721, 0, 0, +0x335D, 0, 0, 0,0x595D,0x4E2B,0x3A4E,0x4335, +0x595A, 0,0x405C, 0,0x3935,0x3F64,0x3166,0x413C, +0x5958,0x3545, 0, 0, 0, 0, 0,0x3747, + 0,0x444F,0x595E, 0, 0, 0, 0, 0, +0x415F, 0, 0,0x5961, 0,0x5963, 0, 0, +0x4237,0x5969, 0,0x5964, 0, 0,0x5966, 0, + 0, 0, 0, 0,0x4941,0x4473, 0,0x5967, + 0, 0, 0,0x4D2C, 0, 0, 0,0x4D48, +0x3439, 0, 0, 0, 0, 0,0x302E, 0, +0x5965, 0, 0, 0, 0, 0,0x5962, 0, + 0, 0, 0,0x3478, 0, 0, 0, 0, + 0,0x3167, 0,0x5968, 0, 0, 0,0x4D49, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x596C, 0, 0, 0, 0, + 0, 0,0x423B, 0,0x5973, 0, 0, 0, +0x596D, 0, 0,0x596A,0x5971, 0, 0, 0, + 0,0x5953, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x596E, 0,0x5972, 0, 0, + 0,0x4842,0x456B, 0, 0, 0, 0, 0, + 0,0x596B, 0,0x596F, 0, 0, 0,0x3748, + 0, 0, 0,0x3A71, 0, 0, 0,0x405D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5977, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4526, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5974, 0,0x4B60, 0, + 0, 0, 0, 0,0x5975, 0, 0, 0, + 0, 0, 0,0x5976, 0,0x4C4E, 0,0x4022, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3762, 0, 0, 0, 0,0x597D, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3B35, +0x597A, 0,0x5979, 0, 0, 0, 0,0x4732, + 0, 0, 0,0x4635, 0, 0, 0, 0, + 0,0x4531,0x597B, 0, 0, 0,0x597C, 0, +0x496F, 0,0x4745,0x3B23, 0,0x4071, 0,0x4B50, + 0, 0, 0, 0, 0, 0,0x3349, 0, +0x5A25,0x597E, 0, 0, 0, 0,0x4D4A,0x5A27, + 0, 0,0x5A23, 0,0x5A24, 0, 0, 0, + 0, 0,0x4160, 0, 0, 0, 0,0x5A22, + 0,0x593F, 0, 0, 0,0x5A26, 0,0x5A21, + 0, 0, 0, 0, 0,0x5A2B,0x5A2C,0x4527, +0x5A2E, 0, 0,0x3B24,0x5A29, 0, 0, 0, + 0,0x353C, 0, 0,0x5A2F, 0,0x5A28,0x5A33, + 0,0x5A32, 0,0x5A31, 0, 0, 0,0x5A34, + 0, 0,0x5A36,0x3E71, 0,0x5A35, 0, 0, + 0, 0,0x5A39, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5A37, 0, 0, + 0,0x5A38,0x5970, 0, 0, 0, 0, 0, +0x5A3B,0x5A3A, 0, 0, 0, 0, 0,0x5978, +0x5A3C,0x5A30, 0, 0,0x3B59, 0, 0, 0, + 0,0x5A3D,0x5A3E,0x5A40,0x5A3F,0x5A41,0x327E, 0, +0x3936, 0, 0,0x4A7C,0x402F, 0, 0, 0, + 0, 0,0x384E, 0, 0,0x5A43, 0, 0, + 0, 0,0x5A46, 0,0x4952, 0,0x355F, 0, + 0, 0,0x5A45,0x5A44,0x4754,0x5A47,0x3635, 0, + 0, 0,0x5A49,0x5A48, 0, 0, 0,0x343A, +0x3B36, 0, 0,0x4658, 0, 0, 0, 0, + 0,0x3749, 0, 0, 0,0x3F74, 0,0x5A4A, + 0,0x4030,0x4528, 0,0x495F,0x5A4B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5A4C, +0x5A4D, 0, 0, 0,0x4A38,0x555D,0x4046, 0, + 0,0x494C, 0,0x3A58, 0,0x4865,0x4843, 0, + 0, 0, 0, 0,0x454D, 0,0x4E41, 0, +0x5A4F,0x3C50, 0, 0,0x5A50, 0,0x3036, 0, + 0,0x3654,0x404D, 0,0x4960, 0, 0, 0, +0x5A51,0x3B42,0x4347, 0,0x3B5B,0x3F37, 0, 0, + 0, 0, 0, 0,0x5A52, 0,0x4A7D, 0, + 0,0x3177,0x3B5C, 0, 0, 0,0x5A55, 0, +0x5A53,0x5A56,0x4E39,0x5A54, 0, 0, 0, 0, +0x407B,0x5A57, 0, 0,0x4232, 0, 0,0x5A58, + 0, 0, 0, 0,0x347A, 0,0x5A5A, 0, +0x5A59, 0, 0, 0, 0,0x5A5B,0x5A5C,0x347B, + 0, 0,0x467C,0x4336,0x356C,0x3B5D,0x4161, 0, + 0,0x3D5C,0x3030, 0, 0, 0,0x5A5D, 0, + 0, 0, 0, 0, 0, 0, 0,0x3222, +0x5A61, 0, 0, 0, 0, 0, 0,0x3937, +0x5A60, 0, 0,0x3A2B,0x3E3A, 0, 0,0x5A5F, + 0,0x3E3B, 0,0x4C40,0x3A2A, 0, 0, 0, +0x3057,0x404E, 0, 0, 0, 0, 0, 0, + 0,0x5A66, 0, 0,0x4031,0x3147, 0, 0, + 0, 0,0x3D55, 0,0x4B66,0x3A72, 0, 0, + 0, 0,0x3E3C, 0,0x4027, 0, 0, 0, + 0,0x5A65,0x5A63,0x5A64, 0, 0, 0, 0, + 0,0x436B, 0, 0,0x5B26, 0,0x5A6A,0x3B7E, +0x3938,0x5A68, 0, 0, 0, 0,0x5A69, 0, +0x3F38, 0, 0, 0,0x5A67, 0, 0,0x3B2F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5A6C,0x5A6B,0x5A70, 0, 0,0x5A71, + 0,0x5A6D, 0,0x3322,0x5A6E,0x5A6F,0x4855, 0, + 0, 0, 0,0x4961,0x374A,0x5A72, 0, 0, + 0,0x4032, 0,0x3E3D, 0, 0, 0,0x4352, + 0, 0, 0, 0, 0, 0,0x3647, 0, +0x5A73,0x5A77, 0, 0,0x324B,0x5A74,0x5A76, 0, + 0, 0, 0,0x5A75, 0, 0,0x3D6B, 0, + 0, 0, 0,0x4348,0x3045,0x5A78, 0, 0, + 0, 0,0x5A79, 0, 0, 0, 0,0x442A, + 0, 0, 0,0x4E71, 0, 0, 0, 0, +0x3B43, 0, 0,0x4A6B, 0, 0, 0, 0, + 0,0x4B3D, 0, 0, 0,0x5B22,0x5A7B, 0, + 0,0x5A7E, 0,0x5A7D, 0, 0,0x5A7A, 0, + 0,0x5B21, 0, 0,0x465E, 0,0x5A7C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5B23, 0, 0,0x3D6C,0x5B24, + 0,0x4D4B,0x4778, 0, 0,0x5B25, 0, 0, + 0, 0, 0,0x5B27, 0, 0,0x5B28, 0, + 0, 0, 0, 0, 0,0x5B29, 0,0x364A, +0x3148,0x3939,0x5B2A, 0,0x5B2B,0x3D71,0x4162, 0, + 0,0x5258,0x413E,0x413D,0x4258,0x3A47, 0, 0, +0x5072, 0, 0, 0, 0,0x376E,0x4D2D, 0, +0x4A7E, 0,0x497E, 0,0x5B2C, 0, 0, 0, + 0,0x3A73,0x443F,0x5B2D,0x4F2F, 0, 0, 0, +0x4B3E, 0,0x442B,0x5B2E,0x347C, 0, 0, 0, + 0, 0, 0,0x5B2F,0x5B30,0x4C5A, 0,0x4C24, +0x4B76,0x4B5C,0x3B25,0x5B32, 0, 0,0x3C6B, 0, + 0,0x4B51, 0,0x5B34,0x5B37,0x5B36, 0,0x3479, + 0, 0,0x3560, 0,0x5B33, 0,0x5B35, 0, + 0, 0, 0,0x5B38, 0, 0,0x3F79, 0, + 0, 0, 0,0x4D7B,0x3049,0x3A60,0x423C, 0, +0x3C5D, 0, 0,0x3E73, 0, 0,0x5B3B, 0, + 0,0x454E, 0,0x5B39,0x422B,0x5B3A,0x3E72,0x4C5D, +0x5B3C,0x5B3D,0x4D68, 0, 0, 0, 0,0x5B42, + 0, 0,0x393A, 0,0x4755,0x5B3F,0x456C,0x5A5E, +0x5A62, 0,0x354F, 0,0x4747, 0, 0, 0, + 0,0x5B41, 0,0x3E3E,0x4844, 0, 0, 0, + 0, 0,0x5B47, 0,0x487A, 0,0x5B3E, 0, +0x5B44,0x5B43, 0, 0, 0,0x404F, 0, 0, + 0, 0,0x4B6D, 0,0x4E53, 0, 0,0x4B67, + 0,0x324C,0x3B5E, 0, 0,0x4F48,0x5B46,0x3F75, + 0, 0, 0,0x5B45, 0, 0,0x5B40, 0, + 0, 0, 0, 0,0x384F, 0, 0, 0, +0x5B4C,0x5B4A, 0,0x324D,0x5B48,0x5B4E,0x5B54, 0, + 0, 0, 0, 0, 0, 0,0x4248, 0, + 0,0x4A41, 0,0x5B56, 0, 0, 0,0x4922, + 0, 0, 0,0x5B55,0x4770,0x4B3F,0x343B, 0, +0x4077,0x3D40, 0, 0, 0,0x4453, 0,0x4D2E, + 0, 0,0x5B51,0x5B50, 0, 0, 0,0x5B52, + 0,0x5B4F, 0, 0,0x5B57, 0,0x5B4D, 0, + 0,0x5B4B, 0,0x5B53,0x5B49, 0,0x436C, 0, +0x4C78,0x3C46,0x3A74, 0, 0, 0, 0, 0, +0x3A3A, 0, 0,0x4B6F,0x3341, 0, 0,0x444E, +0x464A,0x3149, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4072, 0, 0,0x4034,0x372A, 0, 0, 0, + 0, 0, 0,0x5B59, 0, 0,0x393B,0x337C, + 0, 0, 0, 0, 0, 0,0x5B5B,0x3374, +0x5B61, 0, 0, 0, 0, 0, 0,0x5B5E, + 0,0x4073, 0, 0, 0,0x334B,0x3A2C, 0, + 0,0x334A,0x3A4F, 0, 0,0x5B5C,0x3765,0x374B, +0x456D, 0, 0,0x5B5A, 0,0x3046, 0, 0, + 0, 0,0x5B5D,0x5B5F, 0,0x364D,0x372C, 0, +0x343C,0x354B, 0, 0, 0, 0,0x5B62, 0, + 0,0x3A79,0x4B71, 0,0x3B37, 0, 0, 0, +0x5B63, 0, 0, 0,0x4930, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B6F, 0,0x3233,0x5B64, 0, 0, 0, + 0, 0, 0,0x5B75,0x5B65, 0,0x4E42, 0, +0x5B6C, 0,0x475F, 0, 0, 0, 0, 0, + 0, 0,0x5B74, 0,0x5B67, 0, 0, 0, +0x3034,0x5B69, 0, 0,0x393C, 0, 0, 0, +0x5B6B, 0,0x5B6A, 0,0x5B66,0x5B71, 0,0x3E3F, + 0, 0, 0,0x546D,0x3868,0x4D7C, 0, 0, + 0, 0,0x5B68, 0,0x4474,0x3323,0x3A2D, 0, +0x5B60, 0,0x5B70,0x3361, 0, 0,0x5B6E,0x5B72, + 0,0x456E, 0, 0, 0, 0, 0, 0, + 0,0x347E, 0,0x5C32, 0, 0,0x4C49,0x5B77, +0x347D, 0,0x5B7E, 0, 0, 0, 0,0x4B40, + 0,0x5C21,0x5C23, 0,0x5C27,0x5B79, 0,0x432A, + 0, 0, 0, 0,0x456F,0x5C2B,0x5B7C, 0, +0x5C28, 0, 0, 0,0x5C22, 0, 0, 0, + 0, 0, 0,0x3F39,0x5C2C, 0, 0,0x4033, + 0, 0, 0, 0, 0, 0,0x5C2A,0x343D, + 0, 0, 0, 0, 0,0x4F50,0x5B76, 0, + 0,0x5C26,0x3058, 0, 0,0x5B78, 0, 0, +0x4C3A,0x5B7D,0x3F22,0x4447,0x5B73, 0, 0,0x5C25, + 0, 0, 0, 0, 0, 0,0x3F7A,0x5C2F, +0x3371,0x3821, 0, 0, 0, 0,0x5C31,0x5B7A, +0x5C30, 0,0x5C29,0x5B7B, 0,0x5C2D, 0,0x5C2E, + 0, 0, 0, 0, 0,0x5C3F, 0, 0, + 0,0x464E, 0,0x5C24, 0, 0,0x5C3B, 0, + 0, 0,0x5C3D, 0,0x4458, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4D4C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4976,0x5C38,0x424A, 0, 0, 0,0x5C3E,0x413F, + 0,0x5C35,0x5C42,0x5C41, 0,0x466F,0x5C40,0x466A, + 0, 0, 0, 0, 0, 0, 0,0x5C44, +0x5C37, 0,0x3648,0x5C3A,0x3D5D, 0, 0, 0, +0x4760,0x5C3C,0x364B, 0,0x5C34,0x5C36,0x5C33, 0, + 0,0x4F30,0x335A,0x5C39, 0, 0,0x5C43,0x3335, + 0, 0, 0, 0, 0, 0, 0,0x3A67, + 0, 0, 0,0x315D, 0, 0,0x5C54, 0, + 0,0x4F31,0x5C57, 0, 0, 0, 0, 0, +0x3F3A,0x5C56, 0, 0, 0,0x5C55, 0, 0, + 0, 0, 0, 0,0x5C52, 0, 0, 0, + 0, 0, 0,0x5C46, 0, 0,0x5C63,0x5C45, + 0,0x5C58, 0, 0, 0, 0, 0, 0, +0x5C50, 0, 0,0x5C4B,0x5C48, 0,0x5C49, 0, +0x5C51, 0, 0, 0,0x7422, 0, 0,0x5C4E, +0x393D,0x4448,0x4164,0x5C4C, 0,0x5C47, 0, 0, +0x5C4A, 0, 0, 0, 0,0x4D4D,0x4B6A, 0, + 0, 0,0x5C4F,0x5C59, 0, 0, 0, 0, + 0, 0, 0, 0,0x5C61,0x5C5A, 0, 0, +0x5C67, 0,0x5C65, 0, 0, 0, 0,0x5C60, + 0, 0, 0, 0, 0, 0,0x5C5F, 0, +0x4450, 0,0x4165, 0,0x5C5D, 0, 0,0x5C5B, + 0, 0,0x5C62, 0, 0, 0, 0,0x5C68, +0x4875,0x5C6E, 0, 0, 0, 0, 0,0x5C69, +0x5C6C,0x5C66, 0, 0,0x4374, 0,0x4938, 0, +0x5C5C, 0, 0,0x5C64,0x3E40, 0,0x4C4F,0x5C78, +0x5C6B, 0, 0, 0, 0, 0,0x3822,0x3223, +0x335F, 0, 0,0x5C53, 0, 0, 0, 0, + 0, 0,0x3E41,0x5C70, 0,0x5C77,0x3C79,0x3372, + 0, 0,0x432E, 0, 0, 0, 0, 0, + 0,0x5C6D, 0, 0,0x5C72,0x5C76, 0, 0, +0x3636, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x354C,0x5C74, 0, + 0, 0, 0, 0,0x3521, 0,0x464B,0x5C73, + 0, 0, 0,0x5C75, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5C6F, + 0, 0, 0, 0, 0,0x5C71, 0, 0, + 0, 0, 0, 0,0x3360,0x4349, 0, 0, + 0,0x5C7C, 0, 0, 0, 0, 0, 0, + 0, 0,0x5C7A,0x3869, 0,0x5C79, 0, 0, + 0, 0, 0, 0,0x5D21, 0, 0, 0, + 0,0x5B58, 0, 0, 0,0x5C7B, 0,0x5C7D, +0x5C7E, 0, 0, 0, 0, 0, 0,0x5D2C, + 0,0x5D28, 0,0x5B6D, 0, 0, 0, 0, +0x5D27, 0, 0, 0, 0,0x5D26, 0, 0, +0x5D23, 0, 0, 0, 0, 0,0x5C6A,0x5D25, +0x5D24, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5D2A, 0, +0x4F26, 0, 0, 0, 0, 0, 0,0x5D2D, +0x367B, 0, 0,0x5D29,0x5D2B, 0, 0, 0, + 0, 0, 0, 0, 0,0x4827, 0,0x5D2E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5D32, +0x5D2F, 0, 0, 0, 0, 0, 0, 0, + 0,0x4D73,0x5D30, 0, 0, 0, 0,0x5C5E, + 0, 0, 0, 0, 0, 0, 0,0x5D33, + 0, 0, 0,0x5D34, 0, 0, 0, 0, + 0, 0,0x3135, 0,0x5D36,0x3767,0x3C21, 0, +0x3655, 0, 0, 0,0x3224, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4D5F, + 0, 0, 0, 0,0x5D38,0x5D37,0x5D3A,0x353D, + 0, 0,0x3656,0x343E, 0, 0, 0, 0, +0x5D3D, 0, 0, 0,0x5D3C, 0,0x5D3E, 0, + 0,0x324E, 0,0x4337, 0,0x5D3F, 0, 0, +0x343F,0x5D41, 0, 0, 0, 0,0x5D40, 0, +0x5D42, 0, 0, 0,0x5D43, 0,0x5D44,0x3B5F, +0x4035,0x3A21, 0,0x4970, 0, 0,0x4A62,0x4F44, + 0, 0, 0, 0,0x3B75, 0, 0, 0, +0x3A50,0x4E72, 0, 0, 0,0x5D45,0x5D46, 0, +0x3B60, 0, 0, 0,0x5D47,0x5D48, 0, 0, +0x5D4A,0x5D49, 0,0x4B58, 0, 0,0x3D5E,0x3C6C, +0x3B44, 0,0x5D4B, 0, 0, 0, 0, 0, + 0, 0,0x5D4D,0x3F23, 0,0x5D4C, 0, 0, + 0, 0, 0,0x5D4E, 0, 0, 0, 0, + 0,0x5D4F, 0, 0, 0, 0, 0,0x5D50, +0x5D51, 0, 0, 0,0x5D52, 0,0x5D54,0x5D53, +0x5D55,0x3225,0x434A, 0,0x5D56, 0, 0,0x3B26, +0x334C,0x5D57, 0, 0,0x4542,0x544C, 0, 0, + 0, 0,0x3523,0x5D58, 0, 0, 0, 0, +0x5D59, 0,0x4A6C,0x4B68, 0, 0, 0,0x4647, +0x5D5A,0x4866, 0, 0, 0,0x487B, 0, 0, +0x4C53, 0, 0, 0,0x5D5B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5D5D,0x5D5C, 0, 0,0x5D5F, 0, 0, 0, +0x5D5E}; + +/* page 35 0x6C08-0x6CF3 */ +static uint16 tab_uni_jisx020835[]={ +0x5D61, 0, 0, 0, 0, 0, 0,0x3B61, + 0,0x4C31, 0,0x5D62,0x5D63, 0, 0,0x3524, + 0, 0, 0,0x5D64, 0, 0, 0, 0, + 0, 0, 0,0x5D66,0x5D65, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3F65, 0, 0,0x4939, +0x314A, 0, 0, 0, 0, 0,0x4845, 0, +0x4475,0x3D41,0x3561, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4846, 0, +0x3C2E, 0, 0, 0, 0,0x5D68, 0,0x3440, + 0, 0,0x3178, 0, 0,0x4672,0x5D67,0x393E, +0x4353, 0,0x5D69, 0, 0, 0, 0, 0, +0x5D71, 0,0x5D6A, 0, 0, 0, 0, 0, +0x4241, 0,0x3562,0x5D72, 0, 0, 0, 0, + 0, 0,0x3768, 0, 0,0x3525,0x5D70, 0, + 0,0x5D6E,0x5D6B,0x4D60, 0, 0, 0, 0, +0x4440, 0, 0, 0,0x4659,0x5D6C, 0, 0, +0x5D74, 0,0x5D73,0x3723, 0, 0,0x322D, 0, + 0,0x3A3B,0x5D6D,0x5D6F, 0, 0, 0, 0, + 0,0x4B57,0x4274, 0, 0, 0, 0, 0, + 0, 0, 0,0x4B77, 0, 0,0x5D7C, 0, + 0,0x5D7D, 0,0x324F, 0, 0, 0, 0, +0x4A28,0x4C7D,0x5E21,0x3C23,0x3E42,0x5D78,0x5D7E,0x3168, + 0,0x3637, 0, 0,0x5D75,0x5D7A, 0, 0, + 0,0x4074,0x4771, 0,0x4867, 0, 0, 0, + 0, 0, 0,0x5D77, 0,0x4B21, 0,0x5D79, + 0,0x5E24, 0,0x5E22, 0,0x5D7B, 0, 0, + 0,0x4B22,0x4748,0x3563, 0,0x4525, 0, 0, +0x436D, 0,0x5E25, 0, 0, 0, 0,0x5E23, +0x4259,0x5D76, 0,0x314B}; + +/* page 36 0x6D0B-0x7409 */ +static uint16 tab_uni_jisx020836[]={ +0x4D4E,0x5E30, 0, 0, 0, 0, 0,0x5E2F, + 0, 0, 0, 0,0x4076, 0,0x5E2C, 0, +0x4D6C, 0, 0,0x4636,0x5E26, 0, 0, 0, + 0, 0,0x4445, 0, 0, 0,0x314C,0x393F, +0x5E29, 0, 0, 0, 0, 0, 0,0x3D27, +0x5E2E, 0,0x5E2D,0x5E28, 0,0x5E2B, 0, 0, +0x3368, 0,0x5E2A,0x4749, 0, 0,0x4E2E, 0, + 0,0x3E74,0x4075, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5E36,0x5E34, + 0,0x494D, 0, 0, 0, 0, 0, 0, +0x5E31,0x5E33, 0,0x313A, 0, 0,0x3940,0x4F32, + 0,0x333D, 0,0x4962, 0, 0, 0, 0, + 0,0x4D61, 0, 0,0x3324,0x3F3B,0x5E35, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5E3A, 0, 0,0x3E43, 0, 0, + 0,0x4D30, 0,0x5E37, 0, 0, 0, 0, +0x5E32, 0,0x5E38, 0, 0, 0,0x4E5E, 0, +0x4573,0x4642, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3336, 0, 0,0x3155, + 0, 0,0x5E3E, 0, 0,0x5E41, 0, 0, + 0,0x4E43, 0, 0, 0,0x4D64, 0, 0, + 0, 0,0x5E48,0x5E42,0x5E3F, 0, 0, 0, +0x4E54,0x5E45, 0, 0, 0, 0,0x3D4A,0x5E47, + 0, 0,0x5E4C, 0, 0,0x4571,0x5E4A, 0, + 0, 0, 0,0x5E44, 0, 0,0x4338, 0, + 0,0x5E4B, 0,0x5E40, 0,0x5E46, 0,0x5E4D, +0x307C,0x5E43, 0,0x5E4E, 0, 0,0x3F3C, 0, +0x3D5F, 0,0x4A25, 0,0x3A2E, 0,0x5E3B,0x5E49, +0x453A, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4036, 0,0x3369,0x3A51,0x3E44,0x5E3D, +0x3D42, 0, 0, 0, 0, 0, 0, 0, +0x374C, 0,0x5E3C, 0, 0, 0,0x5E52,0x3D6D, +0x383A, 0,0x5E61, 0,0x5E5B,0x3574,0x454F, 0, +0x5E56,0x5E5F,0x302F,0x3132, 0, 0,0x3239, 0, +0x5E58,0x422C,0x5E4F,0x5E51,0x3941, 0, 0, 0, + 0, 0, 0, 0, 0,0x5E62, 0,0x5E5D, + 0, 0, 0,0x5E55, 0, 0, 0, 0, +0x5E5C, 0, 0, 0, 0, 0, 0,0x4C2B, + 0, 0,0x5E5A,0x5E5E, 0, 0, 0, 0, + 0, 0, 0,0x3850, 0,0x3E45, 0, 0, +0x4339, 0, 0, 0,0x5E54, 0, 0, 0, + 0, 0, 0, 0,0x4D2F, 0, 0, 0, +0x5E57, 0, 0,0x5E50,0x4572, 0, 0,0x5E53, + 0, 0, 0,0x5E59, 0, 0, 0, 0, + 0, 0, 0,0x4F51,0x3C3E,0x4B7E, 0,0x5E63, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x482E, 0, 0,0x5E6F,0x383B, 0, 0, + 0, 0, 0,0x3D60, 0,0x5E65, 0, 0, + 0,0x4E2F,0x3942, 0,0x5E72, 0, 0,0x306E, + 0, 0,0x5E70, 0, 0, 0, 0,0x5E64, + 0, 0, 0, 0,0x5E6A, 0, 0,0x5E6C, + 0, 0, 0,0x4D4F,0x5E67, 0, 0,0x452E, + 0, 0,0x5E69, 0, 0, 0, 0,0x5E71, + 0,0x5E6B,0x4C47, 0, 0, 0,0x5E66, 0, +0x3C22,0x5E7E, 0, 0, 0, 0,0x336A, 0, +0x5E68,0x5E6D,0x5E6E, 0, 0, 0, 0, 0, + 0, 0,0x426C,0x425A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E76, 0, 0,0x5E7C, 0, 0,0x5E7A, + 0,0x4529, 0, 0,0x5F23,0x5E77, 0, 0, + 0, 0, 0,0x5E78,0x5E60, 0,0x3579,0x493A, + 0, 0, 0,0x3C3F, 0, 0,0x3977, 0, + 0, 0, 0, 0,0x4F33, 0,0x5E74, 0, +0x5F22,0x3169,0x4166, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4779, 0,0x3441, +0x4E7A, 0, 0, 0, 0, 0, 0, 0, +0x4C21,0x4452, 0, 0, 0, 0,0x5E7B,0x5E7D, + 0, 0, 0, 0, 0,0x4132, 0, 0, + 0, 0, 0,0x5F21,0x5E79, 0,0x5E73, 0, + 0, 0,0x3443, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3769, 0, 0, 0,0x5F2F, 0, 0, +0x5F2A,0x4078, 0, 0,0x3363, 0, 0, 0, + 0,0x3D61, 0,0x5F33, 0, 0, 0, 0, + 0, 0,0x5F2C,0x442C,0x5F29,0x4459, 0, 0, + 0,0x5F4C, 0, 0, 0,0x5F26, 0,0x5F25, + 0,0x5F2E, 0, 0, 0,0x5F28,0x5F27,0x5F2D, + 0,0x4021, 0,0x5F24, 0, 0, 0, 0, + 0, 0, 0,0x5F30, 0, 0,0x5F31, 0, + 0, 0, 0, 0,0x3442, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F36, 0, +0x5F35,0x5F37, 0, 0, 0, 0, 0,0x5F3A, + 0, 0, 0, 0, 0, 0,0x4543, 0, +0x5F34, 0, 0, 0, 0, 0,0x5F38, 0, + 0, 0, 0, 0, 0,0x3763,0x4279,0x5F32, +0x473B, 0, 0,0x5F39, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F3E,0x5F3C, 0, 0,0x5F3F, 0, 0, +0x5F42, 0, 0, 0,0x5F3B,0x396A,0x4728, 0, + 0,0x5E39, 0, 0, 0, 0, 0, 0, +0x4D74,0x5F3D, 0,0x5F41,0x4275, 0,0x5F40, 0, +0x5F2B, 0, 0,0x6F69, 0, 0, 0,0x5F45, + 0, 0, 0,0x5F49, 0, 0,0x5F47, 0, + 0, 0, 0, 0, 0, 0,0x5F43, 0, +0x5F44, 0, 0, 0,0x5F48, 0,0x5F46, 0, + 0, 0,0x494E, 0, 0,0x5F4E, 0,0x5F4B, +0x5F4A, 0,0x5F4D,0x4654,0x5F4F, 0, 0, 0, + 0, 0, 0,0x4375,0x426D, 0, 0, 0, + 0,0x4025, 0, 0, 0,0x5F50, 0,0x5F52, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5F51, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E75, 0, 0, 0, 0,0x5F53, 0, + 0, 0, 0, 0, 0,0x4667, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F54, 0, 0, 0, 0, 0, 0, 0, +0x3250, 0, 0, 0,0x4574,0x3325, 0, 0, + 0, 0, 0, 0, 0,0x3564, 0, 0, + 0,0x3C5E,0x3A52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4F27,0x3F66, + 0, 0, 0,0x316A, 0, 0, 0,0x5F56, + 0, 0, 0, 0, 0, 0,0x5F55, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F59,0x433A,0x5F5C,0x5F57, 0, 0, 0, +0x5F5B, 0, 0, 0, 0,0x5F5A,0x4540,0x3059, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4E75, 0, 0, +0x5F5E, 0, 0, 0,0x3128, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F60, 0, + 0, 0,0x5F5F, 0,0x5F5D, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F58, 0, + 0, 0, 0, 0, 0, 0,0x4B23, 0, + 0, 0,0x5F62, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F61, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x316B, 0, 0, 0, 0,0x5F64,0x4A32, + 0,0x5F63, 0, 0, 0, 0,0x4C35, 0, + 0, 0, 0,0x3E47, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4133, 0, 0, 0, 0, + 0,0x3E46, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4E7B, 0, + 0,0x5F6A, 0,0x4079, 0, 0, 0, 0, + 0, 0,0x5F66,0x5F6B, 0, 0,0x316C, 0, + 0, 0, 0, 0, 0, 0, 0,0x5F69, + 0,0x4761,0x5F65,0x5F68,0x3E48, 0,0x4851, 0, + 0,0x5F6C, 0,0x3C51, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x407A, 0, 0, 0, 0, 0, + 0,0x5F6F, 0, 0, 0,0x5F67, 0,0x3727, + 0, 0, 0, 0,0x5F6D, 0, 0, 0, + 0,0x4D50,0x5F70, 0, 0, 0,0x7426, 0, + 0, 0, 0, 0,0x3D4F, 0, 0, 0, + 0, 0, 0, 0, 0,0x5F71, 0, 0, + 0,0x5F72, 0, 0, 0, 0,0x472E, 0, + 0, 0, 0, 0, 0, 0,0x5F74, 0, + 0, 0, 0,0x5F75, 0, 0, 0, 0, +0x4733, 0, 0, 0, 0,0x4575,0x5F77, 0, + 0, 0, 0,0x5F79, 0,0x4E55, 0,0x5F76, + 0,0x5F78,0x316D, 0,0x5F73, 0, 0, 0, + 0, 0, 0, 0,0x535B,0x5F7A, 0, 0, + 0, 0,0x4167,0x3B38,0x5F7C, 0, 0, 0, + 0,0x5F7B,0x3F24,0x5259, 0, 0, 0, 0, + 0, 0,0x5F7D, 0, 0, 0,0x6021, 0, +0x5F6E,0x5F7E, 0, 0,0x6022, 0, 0, 0, + 0, 0, 0,0x477A, 0, 0, 0, 0, + 0, 0,0x6023, 0, 0,0x6024, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6025, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6026, 0,0x445E, + 0,0x6028,0x6027, 0, 0,0x6029, 0,0x602A, + 0, 0,0x3C5F,0x4963, 0, 0, 0,0x4C6C, +0x602B,0x602C,0x4156,0x3C24,0x602D,0x602E, 0, 0, + 0, 0, 0,0x602F,0x4A52,0x4847, 0, 0, +0x6030,0x4757, 0, 0, 0, 0, 0,0x442D, + 0, 0, 0, 0, 0,0x6031,0x3267, 0, +0x356D, 0,0x4C46, 0,0x4C36, 0,0x3234,0x4F34, + 0, 0, 0, 0,0x4B52, 0,0x4A2A, 0, + 0, 0, 0, 0, 0, 0, 0,0x4037, + 0,0x6032, 0, 0, 0, 0,0x4643, 0, + 0, 0,0x3823,0x6033, 0,0x3A54,0x6035,0x6034, + 0, 0, 0, 0,0x6036, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6037, + 0, 0, 0,0x6038, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x353E, 0,0x6039, + 0, 0, 0, 0,0x603A, 0, 0, 0, + 0,0x3824, 0, 0,0x4848, 0, 0,0x603C, + 0, 0, 0,0x3E75, 0, 0,0x603B, 0, + 0, 0, 0, 0, 0, 0, 0,0x3638, +0x603D,0x603F, 0,0x603E, 0, 0, 0, 0, + 0, 0, 0,0x6040, 0,0x3851, 0,0x6041, + 0, 0, 0, 0,0x3669, 0,0x4140, 0, +0x397D, 0, 0, 0, 0,0x6043,0x6044,0x6042, + 0, 0, 0, 0, 0, 0,0x3C6D, 0, + 0,0x4648,0x3639, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6046,0x432C,0x6045, 0, + 0,0x4F35,0x4762, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6049, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x604B,0x6048, 0, 0, 0, +0x4C54,0x604A,0x604C, 0,0x4E44, 0, 0, 0, + 0, 0,0x6050, 0, 0, 0,0x604F,0x4376, +0x472D, 0, 0,0x3825,0x604E, 0, 0, 0, + 0,0x604D, 0,0x4D31,0x4D32, 0, 0, 0, + 0, 0, 0,0x6051,0x316E, 0, 0, 0, + 0,0x3976,0x3B62, 0, 0, 0, 0, 0, + 0, 0, 0,0x6052,0x6053, 0, 0, 0, + 0, 0, 0, 0,0x6055, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3D43, 0, 0, 0, 0,0x6057, 0,0x6056, + 0, 0, 0, 0, 0,0x6058, 0,0x334D, + 0, 0,0x605A, 0, 0,0x6059, 0,0x605C, +0x605B, 0, 0, 0, 0, 0, 0, 0, + 0,0x383C, 0, 0,0x4E28, 0,0x364C, 0, +0x3226, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x366A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3461, 0, + 0, 0, 0, 0, 0, 0, 0,0x4E68, +0x605E, 0, 0, 0, 0, 0, 0, 0, +0x6060, 0, 0, 0, 0,0x6061, 0,0x3251, + 0, 0, 0, 0, 0,0x605D, 0,0x3B39, + 0, 0,0x4441,0x605F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6064, 0,0x3C6E, 0, 0, + 0, 0,0x6062, 0, 0, 0, 0,0x373E, + 0, 0,0x4849,0x6063, 0, 0,0x607E, 0, + 0, 0, 0, 0, 0,0x6069, 0, 0, + 0, 0, 0,0x383D, 0, 0, 0, 0, +0x3565, 0,0x6066,0x4D7D, 0, 0,0x4E30}; + +/* page 37 0x7422-0x7845 */ +static uint16 tab_uni_jisx020837[]={ +0x4276, 0, 0,0x6068, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x606A,0x4E56,0x3657,0x487C,0x474A, 0, 0, 0, +0x606B, 0, 0, 0, 0,0x606D, 0,0x6070, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x606C, 0, 0, 0,0x606F, +0x386A,0x314D,0x6071, 0,0x3F70,0x606E,0x4E5C, 0, + 0,0x6074,0x7424, 0, 0, 0, 0,0x6072, +0x6075, 0, 0, 0, 0,0x6067,0x6073, 0, + 0,0x3A3C, 0, 0,0x6076, 0, 0, 0, + 0, 0, 0, 0,0x6077, 0, 0, 0, + 0,0x4D7E, 0, 0, 0, 0, 0, 0, + 0,0x6078, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6079, 0, 0, 0, +0x6065, 0, 0, 0, 0,0x607A, 0, 0, + 0, 0, 0, 0, 0, 0,0x3444, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3C25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x607B, 0, 0, 0, 0,0x607C, 0, 0, + 0, 0,0x607D, 0, 0, 0, 0, 0, + 0, 0,0x313B, 0, 0, 0,0x6121, 0, +0x493B,0x6122, 0, 0,0x3424,0x6123, 0,0x6124, + 0, 0, 0, 0,0x6125, 0,0x6127,0x6128, +0x6126, 0, 0, 0,0x4953,0x612A,0x6129, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x612C,0x612B,0x612D, 0, 0, 0, 0, + 0, 0,0x612E,0x6130,0x612F, 0, 0,0x3979, + 0,0x6132, 0,0x6131, 0, 0,0x3445, 0, +0x3F53, 0,0x453C, 0,0x6133,0x4038, 0, 0, + 0,0x3B3A, 0,0x3179,0x6134, 0,0x4D51, 0, + 0,0x4A63,0x6135, 0, 0, 0,0x4544,0x4D33, +0x3943,0x3F3D, 0, 0, 0,0x434B,0x5234, 0, +0x442E,0x3268,0x6136, 0, 0, 0, 0, 0, + 0, 0,0x6137, 0,0x613C, 0, 0,0x613A, +0x6139,0x5A42,0x3326,0x6138, 0,0x305A, 0,0x482A, + 0, 0,0x484A, 0, 0, 0, 0,0x4E31, +0x613D,0x613B,0x435C,0x4026, 0, 0,0x482B, 0, +0x492D, 0,0x613F,0x4E2C,0x374D,0x6140, 0,0x613E, +0x4856,0x6141, 0,0x6142, 0, 0,0x305B, 0, + 0,0x3E76,0x6147, 0,0x6144,0x466D,0x6143, 0, + 0, 0, 0, 0, 0,0x3526, 0, 0, +0x614A, 0, 0, 0,0x6145,0x6146, 0,0x6149, +0x6148,0x4925, 0, 0,0x4142,0x4141, 0,0x353F, + 0, 0,0x614B, 0, 0, 0, 0, 0, +0x614C, 0, 0,0x614D, 0, 0, 0, 0, + 0,0x614F, 0,0x614E, 0, 0, 0, 0, + 0,0x3156, 0, 0, 0, 0, 0,0x6157, +0x4868,0x6151, 0,0x6153, 0, 0,0x6155,0x3F3E, + 0, 0,0x6156,0x6154,0x3C40, 0, 0, 0, +0x6150,0x6152, 0,0x4942, 0,0x3E49, 0, 0, +0x6159, 0, 0,0x6158, 0, 0, 0, 0, +0x615A, 0,0x3C26,0x3A2F, 0, 0,0x4577,0x615B, + 0,0x444B, 0, 0,0x615D, 0, 0, 0, +0x4E21,0x615C, 0, 0, 0, 0, 0,0x4169, + 0, 0, 0, 0, 0, 0,0x6162, 0, +0x6164,0x6165,0x4354, 0, 0, 0, 0, 0, +0x6163, 0,0x6160, 0,0x615E,0x615F, 0,0x6161, + 0, 0, 0, 0, 0, 0, 0,0x6168, + 0,0x6166, 0,0x6167, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6169,0x616B,0x616C, +0x616D, 0,0x616E, 0, 0,0x616A, 0, 0, + 0, 0, 0, 0, 0, 0,0x6170, 0, + 0, 0,0x616F, 0, 0, 0, 0, 0, + 0,0x6171, 0, 0, 0, 0, 0, 0, +0x4E45, 0, 0, 0,0x6174,0x6172,0x6173, 0, + 0, 0,0x3462, 0, 0, 0, 0, 0, +0x4C7E, 0, 0, 0,0x4A4A, 0,0x6176, 0, + 0, 0,0x6175, 0, 0, 0, 0,0x6177, +0x6178, 0, 0, 0, 0,0x617C,0x6179,0x617A, +0x617B, 0,0x617D, 0, 0, 0,0x617E, 0, +0x6221, 0, 0, 0,0x6222, 0,0x6223, 0, +0x482F,0x4550,0x6224,0x4772,0x4934, 0,0x6225, 0, + 0,0x6226,0x452A, 0,0x3327,0x3944,0x6227, 0, + 0,0x6228, 0, 0,0x6229, 0,0x3B29, 0, + 0,0x622B, 0, 0,0x622A, 0, 0,0x622C, +0x622D, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4869, 0,0x622E, 0, + 0, 0,0x622F, 0, 0,0x7369,0x6230,0x6231, +0x6232, 0, 0, 0, 0,0x3B2E, 0, 0, +0x6233,0x4756, 0, 0,0x4B5F, 0,0x314E, 0, +0x3157, 0, 0,0x6234, 0, 0, 0, 0, +0x6236, 0, 0, 0,0x6235,0x4570, 0, 0, + 0,0x4039,0x5D39, 0,0x6237,0x4C41, 0,0x6238, + 0,0x3446,0x4857,0x6239, 0,0x623A, 0, 0, +0x623B, 0, 0, 0,0x4C5C, 0, 0, 0, +0x4C55, 0,0x443E, 0, 0, 0,0x416A, 0, + 0,0x623D, 0, 0,0x3D62, 0, 0,0x3E4A, + 0, 0,0x6240, 0, 0,0x623F,0x623E,0x487D, + 0,0x3447,0x3829, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6246, 0, 0,0x6243,0x3F3F,0x4C32, 0, + 0, 0,0x6242,0x6244,0x6245, 0, 0,0x6241, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6247,0x6248, 0, +0x442F, 0,0x3463, 0, 0, 0,0x4365, 0, + 0, 0, 0, 0, 0,0x6249, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x624A,0x624D, 0, 0, 0, 0, 0,0x3F67, + 0,0x4644, 0,0x624E,0x4B53, 0,0x624B, 0, + 0,0x624C, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6251, + 0, 0, 0, 0,0x6250,0x624F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6253, 0, 0,0x6252, 0, 0,0x6254, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6256, 0,0x6255, 0, + 0, 0, 0,0x4A4D, 0, 0, 0, 0, + 0, 0,0x3D56,0x4E46, 0, 0,0x6257, 0, + 0,0x4637, 0, 0,0x6258, 0, 0,0x6259, + 0,0x625D,0x625B,0x625C, 0,0x625A, 0, 0, + 0, 0, 0, 0, 0,0x625E, 0, 0, + 0, 0, 0,0x625F, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6260, 0, 0, +0x6261,0x4C37,0x6262, 0, 0, 0, 0, 0, +0x4C70,0x6263, 0,0x434E, 0,0x476A, 0,0x366B, + 0, 0, 0,0x433B,0x6264,0x363A, 0, 0, + 0,0x4050, 0, 0, 0, 0, 0, 0, + 0, 0,0x6265, 0, 0, 0, 0, 0, +0x3A3D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6266, 0, 0, 0, 0, 0, +0x6267, 0,0x3826,0x3A55, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6269, 0, + 0, 0, 0,0x4556,0x3A56,0x354E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4B24, 0,0x474B, 0, 0, 0, 0, 0, +0x4557, 0, 0, 0, 0,0x395C, 0, 0, + 0, 0, 0,0x626B}; + +/* page 38 0x785D-0x7E9C */ +static uint16 tab_uni_jisx020838[]={ +0x3E4B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4E32,0x3945, + 0, 0,0x3827, 0, 0,0x4823, 0,0x626D, + 0, 0, 0, 0, 0, 0, 0,0x626F, + 0, 0, 0, 0,0x386B, 0, 0, 0, + 0,0x626E,0x4476, 0, 0, 0, 0,0x6271, +0x3337,0x626C, 0, 0,0x486A, 0,0x3130, 0, +0x3A6C, 0,0x4F52, 0, 0,0x6270, 0, 0, + 0, 0, 0, 0, 0, 0,0x6272, 0, + 0, 0,0x4A4B, 0,0x4059,0x6274, 0, 0, + 0, 0,0x6275, 0, 0, 0, 0, 0, +0x6273, 0, 0, 0, 0,0x334E, 0,0x627B, + 0,0x627A, 0, 0,0x3C27, 0, 0, 0, +0x627C,0x6277, 0, 0, 0,0x627D,0x6278, 0, + 0, 0, 0,0x4858,0x6276, 0, 0,0x6279, + 0, 0, 0, 0, 0,0x6322, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6321,0x4B61, 0, 0, 0,0x627E, + 0, 0,0x306B, 0, 0, 0, 0,0x6324, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6323, 0, 0, 0,0x3E4C, 0, 0, 0, + 0, 0,0x6325, 0, 0, 0, 0, 0, + 0,0x4143, 0, 0,0x6327,0x6326, 0, 0, + 0, 0, 0, 0,0x6328, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6268, 0, 0, 0,0x626A,0x632A,0x6329, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3C28, 0,0x4E69, + 0,0x3C52, 0,0x632B,0x3737, 0, 0, 0, + 0, 0,0x3540,0x3527,0x3B63, 0, 0, 0, + 0, 0, 0,0x4D34, 0, 0,0x6331, 0, +0x6330,0x4144,0x632D, 0, 0,0x632F, 0, 0, +0x3D4B,0x3F40,0x632E,0x632C, 0,0x472A, 0, 0, +0x3E4D, 0, 0,0x493C, 0, 0, 0, 0, +0x3A57, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4578, 0, 0,0x6332, 0, 0, + 0, 0,0x6333,0x6349,0x3658, 0, 0,0x4F3D, +0x4135, 0, 0, 0, 0,0x6334, 0, 0, +0x3252,0x4477,0x4A21, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6335, 0, 0, 0, 0, 0, 0, 0, + 0,0x357A,0x6336, 0, 0,0x6338, 0, 0, + 0,0x6339, 0,0x4729, 0, 0,0x633A, 0, + 0, 0, 0, 0,0x633B,0x633C, 0, 0, +0x3659,0x3253,0x4645,0x3D28,0x3B64, 0, 0, 0, + 0, 0, 0, 0,0x633D, 0,0x3D29, 0, + 0, 0, 0, 0,0x324A,0x4943, 0, 0, +0x633E, 0, 0,0x486B, 0, 0, 0, 0, + 0, 0,0x4145, 0,0x6341, 0,0x6342,0x4769, + 0,0x3F41,0x633F, 0,0x4361, 0, 0,0x6340, + 0, 0, 0,0x3E4E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x305C, 0, + 0, 0, 0,0x3529, 0, 0, 0, 0, + 0, 0, 0,0x6343, 0, 0,0x4478, 0, +0x6344,0x4047, 0, 0, 0, 0, 0,0x4C2D, + 0, 0,0x4923,0x6345,0x6346,0x4355, 0,0x4E47, + 0, 0,0x6348,0x6347, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3C6F, 0, 0,0x634A,0x3070, 0, 0, + 0, 0,0x634D, 0, 0, 0,0x634B,0x3254, +0x374E,0x634C,0x3946,0x3972, 0,0x4A66,0x634E, 0, + 0,0x4B54, 0, 0,0x6350, 0, 0, 0, +0x4051,0x314F,0x323A,0x302C, 0, 0, 0, 0, + 0, 0,0x634F, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6351,0x6352,0x3E77, 0, + 0, 0, 0, 0,0x6353, 0,0x334F, 0, + 0, 0, 0,0x6355, 0, 0, 0,0x376A, + 0,0x3566, 0, 0,0x6356,0x3675, 0, 0, +0x6357, 0,0x407C, 0,0x464D, 0,0x4060,0x3A75, + 0, 0, 0,0x6358, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4362,0x416B, 0, +0x635A,0x635C,0x6359,0x635B, 0, 0, 0, 0, + 0, 0,0x3722, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x635D,0x3726, 0, 0, + 0,0x3567,0x4D52,0x635F, 0, 0, 0, 0, + 0,0x6360, 0, 0, 0,0x312E, 0, 0, + 0, 0,0x6363, 0, 0, 0,0x3376,0x6362, +0x6361, 0,0x6365,0x635E, 0,0x6366,0x4E29, 0, +0x6367, 0,0x6368, 0, 0,0x5474,0x636A, 0, +0x6369, 0, 0, 0,0x636B,0x636C, 0,0x4E35, +0x636D, 0,0x706F,0x3E4F,0x636E,0x636F,0x3D57, 0, +0x4638,0x6370, 0, 0, 0,0x4328, 0, 0, +0x6371, 0,0x433C,0x6372, 0, 0, 0, 0, + 0,0x3625, 0,0x513F,0x435D,0x3C33, 0, 0, + 0, 0,0x3448, 0, 0,0x6373, 0,0x6422, + 0,0x6376, 0,0x3568, 0,0x6375,0x6424, 0, + 0, 0,0x6374, 0,0x3E50, 0, 0, 0, + 0, 0, 0,0x6378,0x6379, 0,0x452B, 0, + 0,0x637A, 0,0x335E, 0, 0, 0, 0, +0x3F5A,0x4964, 0,0x637C, 0, 0, 0,0x4268, + 0, 0, 0, 0, 0, 0,0x6377, 0, +0x637B,0x637D, 0, 0,0x3A7B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6426,0x492E, 0,0x4826,0x4579, 0,0x365A,0x6425, +0x6423, 0,0x4835,0x637E,0x435E,0x457B, 0,0x457A, + 0,0x3A76, 0, 0, 0, 0, 0, 0, +0x6438, 0, 0, 0, 0, 0, 0, 0, +0x6428, 0,0x642A, 0, 0, 0, 0,0x642D, + 0,0x642E, 0,0x642B,0x642C, 0, 0,0x6429, +0x6427, 0, 0, 0, 0,0x6421, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4A4F,0x3255, 0, 0, 0,0x6435, 0, +0x6432, 0,0x6437, 0, 0,0x6436, 0,0x4773, +0x4C27, 0,0x3B3B,0x6430,0x6439,0x6434, 0,0x6433, +0x642F, 0,0x6431, 0,0x3449, 0, 0, 0, + 0, 0, 0, 0, 0,0x433D, 0, 0, +0x407D, 0, 0, 0,0x4822, 0, 0,0x643E, + 0, 0, 0,0x4824, 0, 0, 0, 0, + 0, 0, 0,0x4061,0x643B, 0, 0,0x484F, + 0,0x643F,0x4A53, 0,0x435B, 0,0x643A,0x643C, + 0, 0,0x643D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6440, 0, 0,0x3C44, 0, 0, 0,0x4646, +0x6445,0x6444, 0, 0,0x6441, 0, 0, 0, +0x4F36, 0, 0, 0, 0, 0,0x644A, 0, + 0,0x644E,0x644B, 0, 0, 0, 0, 0, + 0, 0, 0,0x6447, 0, 0, 0, 0, + 0, 0,0x6448, 0, 0, 0, 0, 0, +0x644D, 0, 0, 0,0x6442,0x5255,0x6449,0x6443, + 0, 0,0x644C, 0, 0, 0, 0, 0, + 0, 0,0x6452, 0,0x344A, 0,0x644F, 0, + 0, 0,0x6450, 0, 0,0x6451,0x6454, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6453,0x4876, 0, 0, 0, 0, +0x6455,0x4E7C,0x4A6D,0x645A, 0, 0,0x6457, 0, + 0, 0, 0, 0, 0, 0, 0,0x6456, +0x4052, 0,0x6459,0x645B, 0, 0, 0,0x6458, + 0,0x645F, 0,0x645C, 0, 0, 0, 0, + 0, 0,0x645D,0x6446, 0, 0, 0,0x645E, +0x6460, 0, 0, 0, 0, 0, 0,0x6461, + 0, 0, 0, 0, 0, 0,0x4A46, 0, +0x6462, 0, 0, 0, 0, 0, 0, 0, + 0,0x4C62, 0, 0,0x364E,0x3729,0x6463, 0, + 0, 0, 0, 0,0x4A34, 0,0x3F68, 0, +0x4C30, 0, 0,0x6464, 0,0x4E33, 0, 0, +0x4774, 0,0x4146,0x4734, 0, 0,0x3D4D, 0, + 0, 0,0x3040, 0,0x6469,0x6467, 0,0x6465, +0x3421, 0,0x3E51,0x646A, 0, 0,0x6468, 0, +0x6466,0x646E, 0, 0,0x646D,0x646C,0x646B, 0, + 0, 0, 0, 0,0x646F, 0, 0, 0, +0x6470,0x403A, 0,0x6471, 0,0x6473, 0, 0, +0x6472, 0, 0, 0, 0,0x3852, 0, 0, + 0,0x4138, 0, 0, 0,0x6475, 0, 0, + 0,0x457C, 0,0x6474, 0, 0, 0,0x6476, + 0,0x4A35,0x416C,0x3947, 0,0x6477, 0, 0, + 0, 0,0x4E48, 0, 0, 0, 0, 0, + 0, 0,0x6479, 0, 0,0x647A, 0,0x647B, + 0,0x647C, 0,0x3B65, 0,0x647D,0x374F, 0, + 0,0x356A, 0,0x352A, 0,0x6521, 0,0x4C73, +0x3948,0x647E, 0, 0, 0,0x6524,0x4C66, 0, +0x473C, 0, 0,0x4933, 0, 0, 0,0x3D63, +0x6523, 0,0x3C53,0x3949,0x3B66,0x3569,0x4A36,0x6522, + 0, 0, 0,0x4147,0x4B42,0x3A77, 0, 0, + 0, 0, 0, 0, 0, 0,0x3B67,0x445D, + 0,0x6527,0x4E5F,0x3A59, 0,0x6528,0x3F42, 0, +0x652A, 0, 0, 0,0x3E52,0x3A30, 0, 0, + 0, 0,0x6529, 0, 0,0x3D2A,0x383E,0x4148, +0x6525,0x652B, 0, 0, 0, 0,0x6526,0x3750, + 0,0x652E,0x6532,0x376B, 0, 0, 0, 0, + 0,0x652D, 0, 0, 0, 0,0x6536, 0, + 0,0x394A, 0, 0,0x4D6D,0x303C,0x6533, 0, + 0,0x356B, 0,0x6530, 0, 0, 0, 0, + 0,0x6531, 0, 0,0x457D,0x652F,0x652C, 0, +0x3328,0x4064, 0, 0,0x3828, 0, 0, 0, +0x6538, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6535, 0, 0, 0, + 0, 0,0x6537, 0, 0, 0,0x6534, 0, + 0, 0, 0, 0,0x3751,0x4233,0x6539,0x416E, + 0, 0,0x6546, 0, 0,0x6542,0x653C, 0, + 0, 0, 0, 0, 0, 0,0x6540,0x3C7A, +0x305D,0x653B,0x6543,0x6547,0x394B,0x4C56, 0,0x4456, +0x653D, 0, 0,0x6545, 0,0x653A,0x433E, 0, +0x653F,0x303D,0x4C4A, 0, 0, 0, 0, 0, + 0, 0,0x653E, 0, 0,0x365B,0x486C, 0, + 0, 0,0x416D, 0,0x4E50,0x3D6F, 0, 0, +0x656E, 0, 0,0x6548, 0,0x407E, 0,0x6544, +0x6549,0x654B, 0,0x4479,0x654E, 0, 0,0x654A, + 0, 0, 0,0x4A54,0x344B, 0, 0,0x4C4B, + 0, 0,0x305E, 0, 0,0x654D, 0,0x4E7D, + 0, 0, 0, 0, 0, 0,0x654C, 0, + 0, 0, 0, 0,0x316F, 0, 0,0x466C, +0x654F, 0, 0, 0,0x6556,0x6550,0x6557, 0, + 0, 0, 0, 0, 0,0x6553, 0, 0, + 0, 0, 0, 0, 0, 0,0x477B, 0, + 0,0x3C4A,0x6555, 0,0x6552,0x6558,0x6551, 0, + 0,0x3D44, 0, 0, 0, 0,0x4B25, 0, + 0,0x3D4C, 0, 0,0x6554,0x6560, 0, 0, +0x655C, 0,0x655F, 0,0x655D,0x6561,0x655B, 0, +0x6541,0x4053, 0, 0,0x484B, 0,0x655E, 0, + 0,0x6559, 0, 0, 0,0x4121,0x3752, 0, +0x3D2B, 0, 0, 0, 0, 0, 0,0x3F25, +0x4136,0x6564, 0, 0,0x6566,0x6567, 0, 0, +0x6563,0x6565, 0, 0, 0, 0, 0, 0, + 0,0x655A,0x6562, 0,0x656A,0x6569, 0, 0, +0x4B7A, 0, 0,0x372B, 0, 0, 0, 0, + 0, 0, 0, 0,0x6568, 0,0x656C,0x656B, +0x656F, 0,0x6571, 0, 0,0x3B3C,0x656D, 0, + 0, 0, 0,0x6572,0x6573, 0, 0,0x6574, + 0,0x657A,0x453B,0x6576, 0,0x6575,0x6577,0x6578, + 0,0x6579, 0, 0, 0, 0,0x657B,0x657C +}; + +/* page 39 0x7F36-0x8358 */ +static uint16 tab_uni_jisx020839[]={ +0x344C, 0,0x657D, 0,0x657E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6621, + 0, 0, 0, 0, 0, 0,0x6622,0x6623, +0x6624, 0,0x6625,0x6626, 0, 0,0x6628,0x6627, + 0, 0,0x6629, 0, 0, 0, 0, 0, + 0,0x662A,0x662B, 0, 0, 0, 0, 0, + 0,0x662E,0x662C,0x662D,0x3A61,0x3753, 0, 0, +0x4356, 0,0x4833, 0,0x3D70, 0, 0,0x474D, + 0,0x486D,0x662F,0x586D, 0, 0, 0, 0, + 0, 0, 0, 0,0x6630,0x6632, 0,0x4D65, +0x6631,0x6634,0x6633, 0,0x4D53, 0,0x6635, 0, +0x487E, 0, 0, 0, 0, 0,0x6636, 0, + 0, 0, 0, 0,0x6639, 0, 0,0x6638, +0x6637, 0, 0, 0, 0,0x663A,0x3732, 0, + 0, 0,0x4122,0x3541, 0, 0, 0, 0, +0x663E,0x663B, 0, 0,0x663C, 0, 0, 0, +0x663F, 0,0x6640,0x663D, 0, 0, 0,0x3129, + 0, 0, 0,0x3227, 0, 0, 0,0x6642, +0x6643, 0, 0, 0,0x6644, 0,0x4D62, 0, + 0, 0, 0, 0,0x3D2C, 0,0x6646,0x6645, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3F69,0x6647, 0, 0, 0, 0, +0x6648, 0, 0,0x6649, 0,0x3465, 0, 0, + 0, 0,0x344D, 0, 0,0x664A, 0, 0, + 0, 0, 0,0x664B, 0,0x4B5D,0x4D63, 0, + 0, 0,0x4D54,0x4F37, 0,0x394D,0x664E,0x3C54, +0x664D, 0, 0, 0, 0,0x664F,0x3C29, 0, + 0, 0,0x4251, 0,0x6650, 0, 0,0x394C, + 0,0x4C57,0x6651,0x6652, 0, 0,0x6653, 0, + 0, 0, 0,0x6654, 0, 0, 0, 0, + 0, 0,0x6655, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3C2A, 0, 0, +0x4C6D, 0, 0, 0, 0,0x6657, 0,0x433F, + 0,0x6656, 0, 0, 0, 0, 0, 0, +0x6659, 0, 0, 0,0x6658, 0, 0, 0, + 0, 0, 0, 0,0x665A, 0, 0, 0, +0x403B, 0,0x665B, 0,0x665C, 0, 0, 0, +0x4A39,0x665D, 0,0x416F,0x665E, 0, 0, 0, + 0, 0,0x665F, 0, 0, 0, 0, 0, + 0,0x4E7E,0x6662, 0,0x6661,0x6660,0x4430, 0, +0x6663,0x3F26, 0,0x6664, 0, 0, 0,0x6665, +0x4F38,0x6666, 0, 0, 0, 0,0x6667,0x6669, +0x6668,0x4825, 0,0x4679, 0,0x4F3E,0x4829, 0, + 0, 0, 0, 0, 0,0x666B, 0, 0, +0x3E53, 0,0x492A, 0,0x666C,0x666A, 0,0x344E, + 0, 0, 0,0x3854,0x3B68, 0, 0,0x486E, + 0, 0, 0,0x382A,0x4B43, 0,0x666F,0x666D, + 0,0x394E, 0,0x394F,0x3069, 0,0x3A68, 0, + 0, 0, 0, 0,0x4759, 0, 0, 0, + 0, 0, 0, 0, 0,0x305F,0x6674, 0, +0x4340, 0, 0, 0, 0, 0,0x4758, 0, +0x425B, 0, 0, 0, 0, 0, 0, 0, +0x6676, 0, 0,0x6672,0x6675,0x6670, 0,0x6673, +0x4B26, 0, 0,0x3855, 0, 0,0x307D,0x6671, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6678, 0,0x6679, 0, 0,0x4639, 0, + 0, 0,0x363B, 0, 0, 0,0x6726,0x473D, + 0, 0, 0, 0,0x3B69, 0, 0,0x363C, +0x4048,0x4F46,0x4C2E,0x6677,0x4054, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3553,0x667A, 0, 0, + 0, 0, 0, 0, 0,0x667C, 0, 0, + 0, 0, 0,0x667B, 0, 0, 0, 0, + 0,0x667D, 0,0x4326, 0,0x473E, 0, 0, + 0, 0, 0,0x4431, 0, 0, 0, 0, +0x6723, 0, 0, 0, 0, 0, 0, 0, +0x6722, 0, 0, 0, 0,0x667E, 0, 0, +0x3F55, 0,0x4965,0x6725, 0,0x6724,0x3950,0x4F53, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6735, 0, 0, 0, 0, 0,0x6729, +0x672A, 0, 0, 0, 0,0x3C70, 0, 0, +0x6728, 0,0x3978,0x6727, 0, 0,0x672B, 0, + 0, 0,0x4432,0x4A22,0x4123, 0, 0, 0, + 0,0x425C,0x672F, 0,0x6730,0x672C, 0, 0, + 0, 0,0x672D, 0,0x672E, 0, 0, 0, + 0,0x3951, 0, 0, 0,0x6736, 0,0x6732, + 0, 0, 0, 0,0x4966, 0,0x4B6C,0x4928, + 0, 0,0x6731, 0, 0,0x6734,0x6733, 0, + 0, 0,0x4B44,0x6737, 0, 0, 0, 0, + 0, 0,0x6738, 0, 0,0x4137, 0,0x6739, + 0, 0,0x673B, 0,0x673F, 0, 0,0x673C, +0x673A,0x473F,0x673D, 0,0x673E, 0, 0, 0, +0x3232, 0,0x6745,0x6740, 0, 0, 0,0x6741, + 0, 0, 0,0x6742, 0,0x4221, 0, 0, + 0, 0,0x6744,0x6743,0x6746, 0, 0, 0, + 0,0x6747,0x6748, 0, 0,0x3F43, 0,0x3269, + 0,0x6749,0x4E57, 0,0x3C2B, 0, 0,0x3D2D, + 0, 0, 0, 0, 0,0x3B6A,0x4357, 0, + 0, 0, 0, 0,0x674A,0x674B,0x3131, 0, +0x674C, 0, 0,0x674D,0x674E, 0, 0,0x674F, + 0,0x6750,0x363D,0x5A2A,0x6751, 0,0x4065,0x6752, +0x3C4B, 0,0x6753, 0,0x5030, 0, 0, 0, +0x6754,0x4A5E,0x345C, 0, 0,0x4124,0x3D58, 0, +0x4971,0x3D2E, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6755,0x3952,0x6756,0x484C, 0, +0x6764, 0, 0, 0, 0,0x6758, 0,0x4249, +0x4775,0x383F,0x6757,0x4125, 0, 0, 0, 0, + 0, 0,0x6759, 0, 0, 0, 0, 0, + 0,0x447A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x675B,0x675A,0x675D, 0, 0,0x675C, + 0,0x675E, 0, 0,0x6760, 0,0x675F, 0, +0x344F, 0,0x6761, 0,0x6762,0x6763, 0, 0, +0x3A31,0x4E49, 0,0x6765,0x3F27, 0, 0, 0, +0x3170,0x6766,0x6767, 0, 0, 0, 0, 0, +0x6768, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3072, 0,0x6769, + 0, 0, 0, 0,0x676A, 0, 0, 0, + 0, 0, 0,0x4967, 0, 0, 0,0x3C47, + 0,0x676C, 0, 0, 0, 0, 0,0x3329, +0x3032, 0, 0, 0, 0,0x676B,0x676E,0x474E, + 0,0x3F44, 0,0x3256, 0,0x4B27, 0, 0, + 0, 0,0x375D,0x365C, 0,0x676D, 0,0x326A, + 0, 0, 0, 0, 0, 0, 0,0x3423, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3171,0x6772,0x4E6A,0x425D, 0, + 0,0x4944, 0,0x677E, 0,0x3257,0x677C, 0, +0x677A,0x6771, 0,0x676F, 0,0x6770, 0,0x3C63, +0x366C,0x4377, 0, 0, 0,0x4651, 0, 0, + 0, 0, 0,0x3151, 0,0x6774,0x6773, 0, + 0, 0, 0,0x6779,0x6775,0x6778, 0, 0, + 0, 0, 0, 0,0x4C50,0x6777,0x3258,0x337D, +0x677B, 0, 0,0x677D, 0, 0, 0, 0, +0x3754, 0, 0, 0, 0, 0, 0, 0, +0x6823,0x682C,0x682D, 0, 0, 0,0x302B, 0, + 0, 0, 0, 0, 0,0x6834, 0, 0, + 0, 0,0x3071, 0, 0,0x682B, 0, 0, + 0,0x682A, 0,0x6825,0x6824, 0,0x6822,0x6821, +0x4363, 0,0x427B,0x6827, 0, 0, 0, 0, + 0, 0,0x6826, 0, 0, 0, 0,0x6829, + 0, 0, 0,0x4170,0x3755, 0, 0, 0, + 0,0x3141,0x6828, 0,0x3953, 0, 0, 0, + 0, 0,0x4171}; + +/* page 40 0x8373-0x8B9A */ +static uint16 tab_uni_jisx020840[]={ +0x683A, 0,0x683B, 0,0x3259, 0, 0, 0, +0x322E,0x6838, 0, 0, 0, 0, 0, 0, + 0, 0,0x682E, 0,0x6836, 0,0x683D,0x6837, + 0, 0, 0,0x6835, 0, 0, 0, 0, +0x6776, 0, 0,0x6833, 0, 0, 0,0x682F, + 0, 0, 0,0x3450,0x6831,0x683C, 0,0x6832, + 0, 0, 0, 0, 0,0x683E, 0,0x6830, +0x477C, 0, 0, 0, 0, 0,0x4D69, 0, + 0, 0,0x6839, 0, 0, 0, 0, 0, + 0, 0,0x684F, 0, 0, 0,0x6847, 0, + 0, 0,0x3F7B, 0, 0, 0, 0,0x3546, + 0,0x365D, 0,0x6842, 0, 0, 0, 0, +0x325B, 0, 0,0x3E54, 0,0x6845, 0, 0, + 0,0x3A5A, 0, 0,0x4551,0x684A, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A6E, 0, +0x6841, 0, 0, 0,0x325A,0x3856,0x4929,0x684B, + 0,0x683F, 0, 0,0x6848, 0, 0, 0, +0x6852, 0,0x6843, 0, 0, 0, 0, 0, +0x6844,0x463A, 0, 0,0x6849, 0, 0, 0, +0x6846,0x4B28,0x684C,0x3060, 0, 0, 0, 0, +0x6840, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x684E, 0,0x684D, + 0, 0, 0, 0, 0, 0,0x476B,0x6854, + 0,0x685F, 0, 0, 0, 0,0x337E, 0, + 0, 0,0x6862, 0, 0,0x6850, 0, 0, + 0,0x6855,0x4D6E, 0, 0, 0, 0, 0, + 0, 0, 0,0x685E, 0, 0,0x4D55, 0, + 0, 0, 0,0x4E2A, 0, 0, 0, 0, + 0, 0, 0, 0,0x4378, 0, 0, 0, +0x336B, 0, 0, 0, 0, 0,0x4972,0x6864, +0x4621, 0, 0,0x3031, 0, 0,0x685D, 0, +0x6859,0x4172,0x6853,0x685B,0x6860, 0,0x472C, 0, + 0, 0,0x302A, 0,0x6858, 0,0x6861,0x4978, + 0, 0, 0, 0, 0, 0, 0,0x685C, + 0,0x6857, 0, 0, 0, 0, 0, 0, +0x3E55, 0, 0, 0, 0,0x3D2F, 0, 0, + 0,0x3C2C, 0, 0, 0, 0,0x4C58, 0, + 0,0x4947, 0, 0,0x6867, 0,0x6870, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x685A, 0, 0, 0, 0,0x3377, + 0, 0, 0, 0, 0,0x3E78,0x6865, 0, +0x686A,0x4173, 0, 0,0x6866, 0,0x686D, 0, + 0,0x435F, 0,0x686E, 0, 0,0x4D56,0x6863, +0x3338, 0,0x6869, 0, 0,0x686C,0x4C2C, 0, + 0, 0, 0,0x686F, 0, 0,0x6868,0x686B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4B29, 0,0x4F21, 0, 0, 0, 0, + 0,0x6873, 0, 0, 0, 0, 0, 0, + 0,0x687A, 0, 0,0x6872,0x3C43, 0, 0, + 0, 0, 0,0x6851, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A4E, 0, +0x4C22,0x6879,0x6878, 0,0x6874,0x6875, 0,0x3136, + 0, 0, 0, 0,0x6877, 0,0x6871, 0, + 0, 0, 0,0x4455, 0, 0, 0, 0, + 0,0x6876,0x307E, 0, 0, 0, 0, 0, + 0, 0,0x4222, 0, 0, 0, 0, 0, + 0, 0,0x4A43, 0, 0,0x687B,0x6921, 0, +0x4859, 0, 0, 0, 0,0x687E,0x3E56,0x3C49, +0x6923, 0, 0,0x363E, 0, 0, 0, 0, + 0, 0,0x6924, 0,0x4979,0x687D, 0,0x6856, + 0, 0, 0, 0, 0, 0, 0, 0, +0x687C, 0, 0, 0, 0,0x4F4F,0x4622,0x4973, + 0, 0,0x692B, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6931, 0, 0, 0, + 0, 0, 0,0x6932, 0,0x6925, 0, 0, + 0,0x4776, 0, 0,0x692F,0x6927, 0,0x6929, + 0, 0, 0, 0, 0,0x6933,0x6928, 0, + 0,0x692C, 0, 0,0x3172, 0,0x4665, 0, +0x692D,0x6930, 0, 0, 0, 0, 0, 0, + 0,0x6926, 0,0x4126, 0,0x692A,0x3B27,0x3F45, +0x3730,0x4C74, 0,0x4C79,0x3D72, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6937,0x6935, + 0, 0, 0, 0, 0, 0,0x4F4E, 0, + 0, 0, 0, 0, 0, 0,0x6934, 0, + 0, 0,0x4D75, 0,0x6936,0x6938, 0, 0, + 0, 0,0x6939, 0, 0, 0, 0, 0, + 0,0x693C,0x693A, 0, 0, 0, 0, 0, + 0,0x4623,0x693B, 0, 0, 0,0x484D,0x692E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3D73, 0,0x693D,0x6942, +0x4174, 0, 0,0x6941, 0, 0, 0,0x6922, + 0, 0, 0,0x6943,0x4149, 0, 0,0x693E, +0x6940, 0, 0, 0, 0, 0, 0, 0, +0x693F, 0, 0,0x5D31,0x5D22, 0, 0,0x6945, + 0, 0, 0, 0, 0, 0, 0,0x6944, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D76, 0,0x623C,0x6946, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6947, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6948,0x3857, 0,0x3554, 0, 0, + 0,0x694A,0x515D, 0, 0, 0, 0,0x3575, + 0,0x4E3A, 0,0x3673,0x694B, 0, 0, 0, + 0, 0, 0, 0,0x694C, 0, 0, 0, +0x436E, 0, 0, 0, 0, 0,0x694D, 0, + 0, 0, 0, 0, 0, 0,0x467A, 0, +0x303A, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3263, +0x6952,0x6953, 0, 0, 0, 0, 0, 0, +0x694E, 0,0x3B3D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x694F,0x4742, 0, 0, 0, 0,0x6950,0x6951, +0x695B, 0, 0, 0,0x6955,0x6958, 0, 0, + 0, 0, 0,0x6954, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6956, 0,0x6957,0x3C58, 0,0x6959, 0, +0x4341, 0,0x3756,0x3342, 0, 0, 0, 0, + 0,0x695C, 0, 0, 0, 0,0x333F, 0, +0x6961, 0, 0,0x695D,0x6960, 0, 0, 0, + 0,0x483A, 0, 0, 0, 0,0x695E, 0, + 0,0x695F,0x4948,0x485A,0x6962, 0, 0, 0, + 0, 0, 0, 0, 0,0x427D,0x696C, 0, +0x6968, 0, 0,0x326B, 0,0x6966, 0,0x4B2A, +0x6967, 0, 0,0x6964, 0,0x6965,0x696A,0x696D, + 0, 0,0x696B, 0, 0, 0,0x6969,0x6963, + 0, 0, 0, 0, 0,0x4358, 0,0x6974, + 0,0x4C2A, 0, 0, 0, 0, 0, 0, + 0, 0,0x6972, 0, 0, 0,0x6973, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x696E, 0, 0,0x6970, 0, 0, 0, +0x6971, 0, 0, 0,0x696F, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4066, 0, +0x4F39,0x6978, 0,0x6979, 0, 0, 0, 0, +0x6A21, 0,0x3F2A, 0,0x697B, 0,0x697E, 0, + 0, 0, 0, 0,0x6976,0x6975, 0, 0, +0x6A22, 0, 0,0x325C, 0,0x697C, 0,0x6A23, + 0, 0, 0,0x697D, 0, 0, 0, 0, + 0,0x697A, 0,0x4433, 0,0x6977, 0, 0, + 0, 0, 0, 0,0x4768, 0, 0,0x6A27, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D3B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6A26, 0, 0,0x6A25, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6A2E, 0, 0, 0,0x6A28, 0, 0, 0, +0x6A30, 0, 0, 0, 0, 0, 0,0x4D66, +0x6A33, 0,0x6A2A, 0, 0,0x6A2B, 0, 0, + 0,0x6A2F, 0,0x6A32,0x6A31, 0, 0, 0, +0x6A29, 0, 0, 0, 0,0x6A2C, 0,0x6A3D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6A36, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6A34, 0, 0,0x6A35, + 0, 0, 0,0x6A3A,0x6A3B, 0,0x332A, 0, +0x3542, 0, 0,0x6A39, 0, 0, 0, 0, + 0, 0,0x6A24, 0, 0, 0, 0, 0, + 0, 0,0x6A38,0x6A3C,0x6A37, 0,0x6A3E, 0, + 0, 0,0x6A40,0x6A3F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A42,0x6A41, +0x695A, 0, 0, 0,0x6A46, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A43, 0, + 0, 0, 0,0x6A44, 0, 0,0x6A45, 0, +0x6A47, 0, 0, 0, 0,0x376C, 0,0x6A49, + 0,0x6A48, 0,0x3D30, 0, 0, 0, 0, + 0,0x3954,0x5E27, 0, 0, 0, 0,0x6A4A, +0x3D51, 0, 0, 0,0x3339, 0,0x6A4B, 0, +0x3152, 0,0x3E57,0x6A4C, 0, 0,0x3955,0x6A4D, +0x3061, 0, 0, 0, 0,0x493D, 0, 0, +0x6A4E, 0, 0, 0, 0,0x3F6A, 0,0x6A55, + 0, 0,0x6A52, 0,0x436F, 0, 0, 0, + 0, 0,0x6A53,0x6A50,0x365E, 0,0x6A4F,0x6A56, + 0, 0, 0, 0, 0,0x3736, 0, 0, +0x425E, 0,0x6A5C, 0, 0, 0, 0,0x6A58, + 0, 0, 0,0x4235,0x6A57, 0,0x6A5A, 0, + 0, 0, 0,0x6A51, 0, 0, 0,0x6A5B, + 0,0x6A5D, 0, 0, 0, 0, 0, 0, +0x486F, 0, 0,0x6A59, 0,0x6A5E,0x6A60, 0, + 0,0x3853,0x6A54, 0,0x3041, 0, 0, 0, + 0, 0, 0, 0,0x6A5F, 0,0x3A5B,0x4E76, +0x6A61,0x6A62,0x4175, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4E22, 0, 0, 0, + 0,0x6A63,0x4D35, 0, 0,0x6A64,0x6A65, 0, + 0,0x4A64,0x6A66, 0,0x3A40, 0,0x4E23, 0, + 0, 0, 0, 0, 0,0x6A6B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6A6C, +0x3E58,0x6A6A, 0, 0, 0,0x4D67,0x6A67, 0, + 0,0x6A69,0x403D,0x3F7E, 0, 0, 0,0x6A68, + 0,0x6A6D, 0, 0,0x4A23, 0, 0,0x6A6F, + 0,0x6A6E, 0, 0, 0,0x336C, 0,0x4B2B, +0x6A70, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6A7C,0x6A72, 0, 0, 0, 0, + 0, 0,0x6A73, 0, 0, 0, 0,0x6A74, +0x6A75, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6A79, 0,0x6A7A, 0, 0, +0x6A78, 0, 0, 0, 0, 0,0x6A76, 0, +0x6A71,0x6A77, 0, 0, 0, 0, 0, 0, + 0,0x6A7B,0x7037, 0, 0, 0, 0, 0, + 0, 0, 0,0x3228, 0, 0, 0, 0, + 0, 0, 0,0x6A7E,0x365F,0x6A7D, 0, 0, + 0,0x6B22, 0,0x6B21, 0, 0, 0,0x6B24, + 0, 0,0x6B23, 0,0x6B25, 0, 0,0x3D31, + 0,0x6B26, 0, 0,0x6B27, 0, 0, 0, + 0, 0, 0,0x6B28,0x403E, 0,0x4D57, 0, +0x6B29, 0, 0,0x4A24,0x4746,0x6B2A, 0,0x6B2B, +0x382B, 0, 0, 0,0x352C, 0, 0, 0, +0x6B2C, 0, 0,0x3B6B,0x4741,0x6B2D, 0,0x3350, + 0, 0, 0, 0, 0, 0,0x6B2E, 0, + 0, 0, 0,0x6B30,0x4D77, 0,0x6B2F,0x3F46, + 0,0x6B31, 0, 0,0x6B32, 0, 0,0x6B33, +0x3451, 0, 0, 0, 0, 0, 0,0x6B34, + 0, 0,0x6B35, 0,0x6B36,0x6B37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3351, + 0, 0, 0, 0, 0, 0, 0,0x6B38, + 0,0x6B39,0x6B3A, 0, 0, 0, 0, 0, +0x3272, 0, 0,0x3F28,0x6B3B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B3C, 0, 0, 0,0x6B3D, 0, 0, + 0, 0, 0, 0, 0,0x3840, 0,0x447B, +0x6B3E, 0, 0, 0, 0,0x3757, 0,0x3F56, + 0,0x6B41, 0,0x4624, 0,0x6B40, 0, 0, +0x3731, 0, 0,0x6B3F,0x4277,0x352D, 0, 0, +0x6B42, 0,0x6B43, 0,0x3E59, 0, 0, 0, +0x376D, 0,0x6B44, 0, 0, 0, 0,0x4B2C, + 0, 0,0x405F, 0, 0, 0,0x3576, 0, +0x4C75,0x414A, 0,0x6B45, 0, 0, 0,0x3F47, +0x4370,0x3E5A, 0, 0, 0, 0,0x6B46, 0, + 0, 0, 0,0x6B49, 0,0x6B4A, 0, 0, + 0, 0, 0, 0, 0,0x3A3E,0x4242,0x6B48, + 0,0x3E5B,0x493E, 0, 0, 0, 0, 0, +0x6B47, 0, 0,0x3B6C, 0,0x3153, 0,0x6B4E, +0x3758, 0, 0,0x3B6E, 0, 0,0x3B6D, 0, +0x4F4D,0x6B4D,0x6B4C,0x4127, 0,0x354D,0x4F43,0x333A, +0x3E5C, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B4B, 0, 0, 0, 0, 0,0x6B50, + 0,0x6B51,0x6B4F, 0,0x3858, 0,0x4D40, 0, + 0,0x3B6F,0x4727, 0, 0, 0,0x6B54, 0, +0x4040, 0,0x4342, 0, 0,0x4D36, 0,0x6B57, + 0, 0, 0,0x386C, 0,0x403F,0x6B53, 0, +0x6B58,0x386D,0x6B55,0x6B56, 0,0x6B52, 0, 0, + 0,0x4062,0x4649, 0, 0,0x432F, 0,0x325D, + 0, 0, 0, 0, 0, 0,0x4870, 0, + 0,0x3543, 0, 0,0x4434, 0, 0,0x6B5B, + 0,0x6B59, 0, 0,0x434C, 0, 0, 0, +0x4041,0x3452,0x6B5A, 0,0x3F5B, 0, 0,0x4E4A, + 0, 0, 0,0x4F40, 0, 0, 0,0x6B5C, +0x6B67,0x4435, 0,0x6B66, 0,0x6B63,0x6B6B,0x6B64, + 0,0x6B60, 0,0x447C,0x6B5F, 0, 0, 0, +0x6B5D, 0,0x4D21,0x3B70, 0, 0,0x6B61, 0, +0x6B5E, 0, 0, 0,0x6B65,0x3D74, 0,0x3841, + 0, 0, 0,0x427A, 0,0x4B45,0x315A,0x3062, + 0,0x4625, 0, 0,0x6B69, 0, 0, 0, + 0,0x6B68, 0,0x4666, 0,0x6B6D, 0, 0, + 0,0x6B62, 0,0x6B6C,0x6B6E, 0,0x382C,0x6B6A, +0x3956, 0,0x3C55, 0, 0,0x6B6F,0x4D58, 0, + 0, 0, 0,0x6B72, 0,0x6B75, 0, 0, +0x6B73,0x4935, 0, 0, 0, 0, 0, 0, +0x6B70, 0, 0, 0, 0, 0,0x3660, 0, + 0, 0, 0,0x6B74, 0, 0,0x6B76, 0, + 0, 0, 0, 0, 0, 0,0x6B7A, 0, + 0,0x6B77, 0,0x6B79,0x6B78, 0, 0, 0, + 0, 0, 0,0x6B7B, 0,0x3C31, 0,0x6B7D, +0x6B7C,0x4968, 0, 0,0x6C21, 0, 0, 0, + 0, 0, 0,0x3759, 0, 0, 0, 0, +0x6B7E,0x6C22, 0, 0,0x6C23,0x3544,0x6641,0x3E79, + 0,0x6C24, 0, 0,0x386E, 0, 0, 0, + 0, 0,0x6C25, 0, 0,0x6C26, 0, 0, +0x3B3E, 0, 0, 0, 0, 0, 0,0x5A4E, + 0,0x6C27, 0,0x6C28, 0,0x3D32, 0,0x6C29, +0x6C2A, 0, 0,0x6C2B, 0, 0,0x6C2C,0x6C2D +}; + +/* page 41 0x8C37-0x8D16 */ +static uint16 tab_uni_jisx020841[]={ +0x432B, 0, 0,0x6C2E, 0, 0, 0, 0, +0x6C30, 0,0x6C2F, 0, 0, 0, 0,0x4626, + 0,0x6C31, 0,0x4B2D, 0,0x6C32, 0,0x6C33, + 0,0x6C34, 0, 0, 0, 0,0x6C35, 0, + 0, 0, 0,0x465A, 0, 0, 0, 0, + 0, 0,0x3E5D,0x6C36, 0, 0, 0, 0, + 0, 0, 0,0x396B,0x502E,0x6C37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6C38,0x493F,0x6C39, 0,0x6C41, 0, 0, + 0, 0, 0,0x6C3A, 0, 0,0x6C3C, 0, + 0, 0,0x6C3B,0x6C3D, 0,0x4B46,0x6C3E,0x6C3F, + 0, 0, 0, 0, 0,0x6C40, 0, 0, + 0,0x6C42, 0, 0, 0, 0,0x332D,0x4467, + 0,0x4969,0x3A62,0x3957, 0, 0, 0, 0, +0x494F,0x325F,0x484E,0x6C45,0x3453,0x4055,0x6C44,0x6C49, +0x4379,0x4C63, 0,0x6C47,0x6C48,0x352E, 0,0x6C4A, +0x4763,0x425F, 0, 0,0x4871,0x453D,0x6C46, 0, +0x4B47,0x326C,0x6C4C,0x4F28,0x4442,0x4F45, 0, 0, +0x3B71,0x6C4B, 0,0x4231, 0, 0,0x6C5C,0x4128, + 0, 0,0x4678, 0,0x4950, 0, 0, 0, + 0, 0, 0,0x6C4F,0x3B3F,0x3B72, 0,0x3E5E, + 0,0x4765, 0,0x382D,0x6C4E,0x6C4D, 0,0x496A, + 0, 0, 0,0x3C41, 0, 0,0x4552, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C51,0x6C52,0x3958,0x6C50, 0, + 0, 0, 0, 0, 0,0x6C53,0x6C54, 0, +0x6C56,0x4223, 0,0x6C55,0x3466, 0,0x6C58, 0, +0x6C57,0x6C59, 0, 0,0x6C5B,0x6C5D, 0,0x6C5E +}; + +/* page 42 0x8D64-0x8F64 */ +static uint16 tab_uni_jisx020842[]={ +0x4056, 0,0x3C4F,0x6C5F, 0, 0, 0,0x3352, + 0,0x6C60, 0, 0,0x4176,0x6C61, 0,0x6C62, +0x496B, 0, 0,0x352F, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C63, 0, 0, + 0,0x4436, 0, 0, 0, 0,0x315B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C64, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C71, + 0, 0, 0, 0,0x3F76, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x422D, + 0, 0, 0, 0, 0, 0,0x6C67, 0, + 0, 0,0x6C66, 0, 0, 0,0x6C65, 0, + 0, 0, 0, 0, 0, 0, 0,0x6C6D, +0x6C6B, 0, 0,0x6C68, 0, 0, 0, 0, + 0, 0,0x6C6A, 0, 0, 0,0x6C69,0x6C6C, + 0,0x3577, 0,0x6C70, 0,0x4057, 0,0x6C71, + 0, 0, 0, 0,0x3859, 0,0x6C6E,0x6C6F, + 0, 0, 0,0x4F29, 0, 0, 0,0x4437, + 0,0x4129, 0, 0, 0, 0, 0, 0, +0x6C72, 0, 0,0x6C75, 0, 0, 0, 0, + 0, 0, 0, 0,0x6C73,0x6C74,0x4D59, 0, + 0, 0, 0,0x4627,0x6C78, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6C76,0x6C77,0x6C79, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D29, 0, + 0, 0, 0, 0,0x6C7C, 0, 0, 0, +0x6C7D,0x6C7B, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6C7A, 0, +0x447D, 0, 0,0x6D21,0x6D25,0x6D22,0x6C7E, 0, +0x6D23, 0, 0, 0,0x6D24, 0, 0, 0, + 0,0x6D2B, 0, 0, 0,0x6D26, 0, 0, + 0, 0, 0,0x4058,0x6D28, 0, 0,0x6D2A, +0x6D27, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D2D, 0, +0x3D33, 0,0x6D2C, 0, 0, 0, 0, 0, +0x6D2E, 0, 0, 0, 0,0x6D2F, 0, 0, +0x6D32,0x6D31, 0,0x6D30, 0, 0,0x6D34,0x6D33, + 0,0x4C76, 0, 0, 0,0x6D36, 0,0x6D35, +0x6D37, 0, 0, 0, 0,0x6D38, 0, 0, + 0, 0, 0, 0, 0,0x6D3A, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D39,0x3F48, +0x6D3B, 0, 0,0x366D,0x6D3C,0x6D3E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6D3F, 0, 0, 0, 0, 0, + 0,0x6D40,0x6D3D, 0,0x6D41, 0,0x3C56,0x6D42, +0x3530,0x3733, 0, 0, 0, 0,0x382E, 0, + 0, 0, 0, 0, 0, 0, 0,0x6D43, + 0, 0, 0,0x4670, 0, 0,0x453E,0x6D44, + 0, 0, 0, 0, 0, 0, 0,0x6D47, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3C34, 0, 0,0x6D46, +0x6D45,0x375A,0x6D48, 0, 0, 0, 0,0x3353, + 0,0x6D4A, 0, 0, 0,0x3A5C,0x6D49, 0, +0x6D52, 0, 0, 0, 0, 0,0x6D4C,0x6D4E, +0x4A65,0x6D4B, 0, 0, 0,0x6D4D, 0,0x6D51, +0x6D4F,0x3531, 0,0x6D50, 0, 0, 0, 0, + 0, 0,0x6D53, 0, 0,0x475A,0x4E58, 0, + 0, 0, 0,0x3D34, 0, 0, 0,0x6D54, + 0, 0, 0, 0,0x4D22,0x6D56, 0,0x6D55, + 0, 0,0x6D59,0x4D41, 0, 0,0x6D58, 0, +0x336D,0x6D57,0x6D5C, 0, 0,0x6D5B, 0, 0, +0x6D5A,0x4532,0x6D5D, 0, 0, 0, 0, 0, + 0, 0, 0,0x6D5E, 0, 0, 0, 0, +0x6D5F, 0, 0,0x396C, 0,0x3725,0x6D60,0x6D61, +0x6D62}; + +/* page 43 0x8F9B-0x9132 */ +static uint16 tab_uni_jisx020843[]={ +0x3F49,0x6D63, 0,0x3C2D,0x6D64, 0, 0, 0, +0x6D65, 0, 0, 0,0x5221,0x517E, 0, 0, + 0, 0,0x6D66,0x6570,0x6D67,0x4324,0x3F2B,0x4740, + 0, 0, 0, 0,0x6D68, 0, 0,0x4A55, +0x4454,0x397E, 0, 0,0x4329, 0, 0,0x312A, + 0,0x4B78,0x3F57, 0, 0, 0, 0, 0, + 0, 0, 0,0x375E, 0, 0,0x3661, 0, + 0,0x4A56, 0, 0, 0, 0, 0,0x6D69, + 0, 0, 0, 0, 0, 0, 0,0x6D6B, + 0, 0,0x6D6A,0x3260, 0, 0,0x4676,0x6D6C, +0x4777, 0,0x4533, 0,0x6D6D,0x3D52, 0, 0, + 0,0x6D6F, 0, 0,0x4C42,0x6D7E,0x6D71,0x6D72, + 0, 0,0x4449, 0, 0,0x4260,0x4177, 0, +0x4628, 0,0x6D70,0x3555, 0, 0, 0, 0, +0x6D79, 0,0x6D76,0x6E25,0x4629,0x4360,0x6D73, 0, +0x447E,0x4553,0x6D74,0x6D78,0x3F60, 0,0x4767,0x444C, + 0, 0,0x4042,0x6D77,0x422E,0x4224,0x6D75,0x3029, +0x4F22, 0, 0, 0,0x6D7A, 0, 0, 0, + 0, 0, 0,0x4261, 0, 0,0x3D35,0x3F4A, + 0, 0,0x6D7C,0x6D7B, 0,0x306F,0x6D7D, 0, + 0,0x492F, 0,0x6E27, 0, 0,0x465B,0x3F6B, + 0, 0,0x4359, 0,0x3678, 0,0x6E26,0x4D37, +0x313F, 0,0x4A57,0x3261,0x6E21,0x6E22,0x6E23,0x6E24, +0x463B,0x4323,0x3063,0x6E28, 0,0x6E29,0x7423, 0, + 0,0x423D, 0,0x6E2A, 0,0x3173,0x414C, 0, +0x382F, 0,0x4D5A, 0, 0,0x6E2B,0x452C, 0, + 0, 0,0x4178,0x3C57,0x6E2C, 0, 0,0x6E2F, + 0, 0,0x3D65,0x6E2D,0x412B,0x412A, 0,0x3064, + 0,0x4E4B,0x6E31, 0,0x4872,0x6E33,0x6E32,0x6E30, +0x6364,0x3454, 0, 0,0x6D6E, 0,0x6E35,0x6E34, + 0, 0, 0, 0,0x6E36, 0,0x4D38, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4661, 0, 0,0x4B2E, 0,0x6E37, 0,0x3C59, + 0, 0, 0, 0,0x6E38, 0,0x6E39, 0, + 0, 0,0x6E3A, 0, 0,0x4521, 0, 0, + 0, 0, 0, 0, 0, 0,0x306A, 0, + 0, 0, 0, 0, 0, 0, 0,0x3959, + 0, 0, 0,0x4F3A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6E3E, 0, 0, 0, 0, 0,0x3734,0x6E3B, + 0,0x6E3C, 0, 0, 0,0x4974, 0, 0, + 0, 0,0x3354, 0, 0, 0, 0, 0, + 0, 0,0x4D39, 0,0x363F, 0, 0, 0, + 0, 0,0x4554, 0, 0, 0, 0,0x6E3F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6E40, + 0, 0, 0, 0, 0, 0,0x6E41, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4522, 0, 0,0x6E43, 0,0x6E42 +}; + +/* page 44 0x9149-0x92B9 */ +static uint16 tab_uni_jisx020844[]={ +0x4653,0x6E44,0x3D36,0x3C60,0x475B,0x4371, 0, 0, + 0,0x3C72, 0,0x3F6C, 0,0x6E45, 0,0x6E46, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3F5D,0x6E47, 0,0x6E48, 0, 0, 0, +0x6E49,0x4D6F, 0,0x3D37, 0, 0, 0, 0, + 0,0x6E4B,0x6E4A, 0,0x395A, 0,0x3973,0x3B40, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6E4E, 0, 0, 0, 0,0x3D66, 0, +0x6E4D, 0,0x6E4C, 0,0x4269, 0, 0,0x386F, + 0,0x4043, 0, 0, 0, 0,0x4830, 0, + 0, 0, 0,0x3D39, 0, 0, 0, 0, + 0,0x6E4F, 0,0x3E5F, 0, 0, 0, 0, + 0,0x6E52,0x6E50, 0, 0, 0,0x6E51, 0, + 0, 0, 0,0x6E54,0x6E53, 0, 0,0x3E7A, + 0,0x6E55, 0, 0, 0, 0, 0,0x6E56, +0x6E57, 0, 0, 0, 0,0x4850,0x3A53,0x3C61, +0x6E58, 0,0x6E59,0x4E24,0x3D45,0x4C6E,0x4E4C,0x6E5A, +0x3662, 0, 0, 0, 0,0x6E5B, 0,0x4523, + 0, 0,0x6E5E,0x3378,0x3F4B, 0,0x6E5C, 0, +0x6E5D, 0,0x4460, 0, 0,0x4B55,0x367C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6E60,0x6E61, 0, 0, + 0, 0, 0,0x6E5F, 0, 0,0x6E63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x465F,0x3343, 0, 0, +0x6E67, 0, 0,0x6E64,0x6E66, 0, 0, 0, + 0, 0, 0, 0, 0,0x6E62, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6F4F, 0, 0,0x6E65, 0, 0, 0, 0, + 0, 0, 0,0x4E6B, 0, 0,0x385A, 0, + 0, 0, 0, 0, 0, 0,0x6E6F, 0, + 0, 0, 0,0x4534,0x6E6A, 0, 0,0x6E6D, +0x6E6B, 0,0x6E70, 0, 0, 0, 0,0x6E71, + 0, 0, 0, 0, 0, 0,0x6E69, 0, + 0,0x6E76,0x3174, 0, 0,0x6E68, 0, 0, + 0,0x482D, 0,0x6E6C, 0,0x3E60, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x395B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4B48, 0,0x3664, + 0, 0,0x3D46, 0,0x463C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x412D, 0,0x6E74, 0,0x6E6E,0x6E73, 0,0x4C43, + 0,0x4438,0x6E75,0x6E72, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x412C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6E79, 0, +0x6E78}; + +/* page 45 0x92CF-0x93E8 */ +static uint16 tab_uni_jisx020845[]={ +0x6E77, 0, 0,0x4B2F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3D7B, 0, 0, + 0, 0,0x6E7A,0x4A5F, 0, 0,0x3154, 0, + 0, 0, 0,0x4946,0x4372, 0, 0, 0, + 0,0x3578, 0,0x6E7C, 0,0x395D, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3B2C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6E7B,0x3F6D, 0, 0, 0, 0, 0, 0, + 0,0x3F6E,0x6F21,0x6F23, 0, 0, 0, 0, + 0,0x3E7B, 0,0x6F22,0x6F24, 0, 0,0x3653, + 0,0x4945, 0, 0,0x3C62,0x4F23, 0,0x6E7E, +0x3A78, 0, 0,0x4F3F, 0, 0,0x6F26, 0, + 0, 0, 0,0x6F25,0x6F27, 0, 0, 0, + 0, 0, 0, 0, 0,0x6E7D, 0, 0, + 0, 0, 0, 0,0x4669, 0,0x4555, 0, + 0, 0, 0, 0, 0,0x4457, 0,0x6F2C, + 0, 0, 0, 0,0x4343,0x6F28, 0, 0, + 0,0x6F29, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x372D, 0,0x6F2B, + 0, 0, 0, 0, 0, 0,0x3830, 0, + 0, 0, 0, 0, 0,0x6F2A, 0,0x3E61, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3379, 0, 0, + 0, 0, 0, 0, 0,0x6F30, 0,0x3A3F, +0x4179, 0, 0,0x444A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x333B, 0, 0, 0, 0,0x6F2E,0x6F2F,0x4443, + 0,0x6F2D, 0, 0, 0, 0, 0, 0, + 0, 0,0x6F31, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6F37, 0, 0, 0, + 0,0x6F3A, 0, 0, 0, 0, 0, 0, + 0,0x6F39,0x452D, 0, 0, 0, 0,0x6F32, +0x6F33,0x6F36, 0, 0, 0, 0,0x6F38, 0, + 0, 0,0x3640, 0, 0,0x6F3B,0x6F35, 0, + 0,0x6F34}; + +/* page 46 0x9403-0x9481 */ +static uint16 tab_uni_jisx020846[]={ +0x6F3F, 0, 0, 0,0x6F40, 0, 0, 0, + 0, 0, 0, 0, 0,0x6F41, 0, 0, +0x6F3E,0x6F3D, 0, 0, 0,0x3E62,0x462A,0x6F3C, + 0, 0, 0, 0, 0, 0,0x6F45, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6F43, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6F44,0x6F42, 0,0x4278, 0,0x6F46, + 0, 0, 0, 0, 0, 0,0x6F47, 0, + 0,0x6F49, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3455,0x6F48, +0x4C7A, 0, 0, 0, 0, 0, 0,0x6F54, +0x6F4A, 0, 0,0x6F4D, 0,0x6F4B, 0,0x6F4C, + 0, 0, 0, 0, 0, 0, 0,0x6F4E, + 0, 0, 0, 0, 0,0x6F50, 0, 0, + 0, 0,0x6F51, 0,0x6F52, 0, 0, 0, + 0,0x6F55,0x6F53,0x6F56,0x6F58, 0,0x6F57}; + +/* page 47 0x9577-0x95E5 */ +static uint16 tab_uni_jisx020847[]={ +0x4439, 0, 0, 0, 0, 0, 0, 0, + 0,0x4C67, 0,0x6F59,0x412E, 0, 0, 0, +0x6F5A, 0,0x4A44,0x6F5B,0x332B, 0, 0, 0, +0x313C, 0,0x3457, 0,0x3456,0x6F5C, 0,0x6F5D, + 0,0x6F5E,0x6F5F, 0, 0, 0, 0, 0, + 0,0x6F60, 0,0x3458,0x3355,0x395E,0x4836, 0, +0x6F62,0x6F61, 0, 0, 0, 0,0x6F63, 0, + 0, 0, 0,0x315C, 0, 0, 0, 0, + 0, 0,0x6F66, 0,0x6F65,0x6F64, 0,0x6F67, + 0, 0, 0, 0,0x6F6A, 0, 0, 0, +0x3047, 0, 0,0x6F68, 0,0x6F6C,0x6F6B, 0, + 0, 0, 0, 0, 0,0x6F6E,0x6F6D,0x6F6F, + 0,0x462E, 0, 0, 0,0x6F70, 0, 0, + 0, 0,0x6F71,0x6F73, 0, 0,0x6F72}; + +/* page 48 0x961C-0x9874 */ +static uint16 tab_uni_jisx020848[]={ +0x496C, 0, 0, 0, 0,0x6F74, 0, 0, + 0, 0, 0, 0,0x6F75, 0,0x3A65, 0, + 0, 0,0x6F76,0x6F77, 0, 0,0x4B49, 0, + 0, 0, 0, 0, 0, 0, 0,0x414B, + 0, 0, 0,0x3024,0x424B, 0,0x6F78, 0, +0x496D, 0, 0, 0, 0, 0, 0,0x6F7B, +0x6F79,0x395F, 0,0x6F7A,0x3842, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4A45, +0x6F7D,0x7021,0x6F7E,0x7022, 0, 0,0x3121,0x3F58, +0x3D7C,0x3459,0x7023, 0, 0, 0,0x4766, 0, +0x7025, 0, 0, 0,0x3122, 0,0x7024,0x4444, + 0,0x4E4D,0x462B,0x6F7C,0x4E26, 0,0x3831, 0, + 0,0x4D5B, 0, 0, 0, 0, 0, 0, + 0,0x3679,0x4E34, 0,0x3728, 0,0x4262,0x6721, + 0,0x7026,0x332C,0x3F6F, 0, 0, 0, 0, +0x3356,0x7028, 0,0x7029,0x7027,0x3764, 0,0x3A5D, +0x3E63, 0, 0, 0,0x3123, 0, 0,0x4E59, + 0, 0, 0,0x702B,0x6E2E, 0,0x702A, 0, + 0, 0, 0, 0,0x702E,0x702C,0x702D, 0, +0x702F, 0,0x7030,0x4E6C,0x7031,0x7032, 0,0x4049, +0x483B, 0, 0, 0,0x3F7D,0x3467, 0, 0, +0x4D3A,0x326D,0x3D38,0x385B, 0,0x7035, 0,0x7034, +0x3B73,0x7036,0x7033, 0, 0,0x3B28, 0, 0, + 0,0x703A,0x6A2D, 0, 0,0x5256, 0,0x3F77, +0x7038, 0, 0, 0, 0, 0,0x4E25,0x4671, + 0, 0, 0, 0,0x312B, 0,0x4063,0x3C36, + 0, 0, 0, 0,0x4A37, 0,0x3140, 0, + 0, 0,0x4E6D,0x4D6B, 0,0x703B, 0,0x4545, + 0, 0, 0, 0,0x3C7B, 0, 0, 0, +0x703C, 0,0x703D,0x3F4C,0x703E, 0,0x4E6E, 0, + 0,0x7039,0x7040,0x7042, 0,0x7041, 0,0x703F, + 0, 0,0x7043, 0, 0,0x7044, 0, 0, +0x417A, 0,0x3262, 0, 0, 0, 0, 0, +0x7045, 0, 0,0x4C38, 0, 0,0x7046, 0, + 0, 0, 0, 0,0x7047, 0,0x4F2A, 0, + 0, 0, 0, 0,0x5B31,0x7048, 0, 0, + 0,0x7049,0x704A, 0, 0, 0,0x704E, 0, +0x704B, 0,0x704C, 0,0x704D,0x704F, 0, 0, + 0, 0, 0, 0, 0, 0,0x4044, 0, + 0, 0,0x4C77, 0, 0,0x4045, 0, 0, +0x7050, 0,0x4873, 0,0x7051,0x7353,0x4C4C, 0, +0x7052, 0,0x7053, 0,0x7054,0x3357, 0,0x7056, + 0,0x3F59, 0, 0, 0,0x7057, 0, 0, +0x3724, 0, 0, 0, 0,0x7058,0x705C, 0, +0x705A, 0, 0, 0, 0,0x705B, 0, 0, +0x3373,0x7059,0x705D, 0, 0, 0, 0,0x705E, + 0,0x3048, 0,0x705F,0x7060, 0, 0, 0, + 0, 0, 0, 0,0x3E64, 0, 0, 0, +0x7061, 0, 0, 0,0x3547, 0, 0,0x7064, + 0, 0,0x7063, 0,0x7062, 0, 0,0x6B71, + 0,0x4A5C, 0, 0, 0, 0, 0,0x7065, +0x7066, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7067, + 0, 0,0x7068, 0,0x7069, 0, 0,0x706A, + 0, 0, 0, 0, 0, 0, 0,0x345A, + 0, 0, 0, 0, 0, 0, 0, 0, +0x706B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x706C,0x4723, 0, 0, 0,0x706E,0x323B, + 0,0x7071,0x7070, 0, 0, 0, 0,0x3124, + 0, 0, 0,0x3641, 0,0x4A47,0x443A,0x3A22, + 0,0x3960,0x3D67, 0,0x3F5C, 0, 0, 0, +0x7073, 0, 0,0x7072,0x4D42,0x3468,0x4852,0x465C, + 0, 0, 0,0x3F7C,0x4E4E, 0,0x375B, 0, + 0, 0, 0, 0, 0,0x7076, 0, 0, +0x7075, 0, 0, 0, 0, 0, 0, 0, +0x4B4B,0x462C, 0, 0, 0, 0, 0, 0, +0x3150, 0, 0,0x7077,0x7074, 0, 0,0x4951, +0x4D6A,0x7078, 0, 0, 0, 0, 0, 0, + 0, 0,0x7079, 0, 0, 0, 0,0x707B, +0x426A,0x335B,0x335C,0x707A, 0, 0, 0, 0, +0x3469,0x3832, 0, 0,0x346A, 0, 0,0x453F, + 0, 0,0x4E60, 0, 0, 0, 0, 0, + 0, 0, 0,0x385C, 0, 0, 0,0x707C, + 0, 0, 0,0x707D,0x707E,0x7121, 0,0x7123, +0x7122}; + +/* page 49 0x98A8-0x98C6 */ +static uint16 tab_uni_jisx020849[]={ +0x4977, 0,0x7124, 0, 0, 0, 0,0x7125, + 0,0x7126, 0, 0, 0, 0,0x7127, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x7129,0x7128, 0,0x712A}; + +/* page 50 0x98DB-0x9957 */ +static uint16 tab_uni_jisx020850[]={ +0x4874,0x664C, 0, 0,0x3F29, 0, 0,0x3532, + 0, 0, 0, 0, 0, 0,0x712B, 0, +0x712C, 0,0x522C,0x5D3B,0x4853, 0, 0,0x307B, + 0,0x303B, 0, 0, 0, 0, 0, 0, + 0,0x3B74,0x4B30,0x3E7E, 0, 0, 0, 0, +0x712D, 0,0x4C5F, 0, 0, 0,0x712E,0x4D5C, + 0,0x3142, 0, 0, 0,0x3B41, 0,0x712F, +0x326E,0x7130, 0, 0, 0,0x7131, 0, 0, + 0, 0,0x7133,0x7134, 0,0x7136,0x7132, 0, + 0,0x7135, 0, 0, 0,0x345B, 0, 0, + 0,0x7137, 0,0x7138, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7139,0x713A, 0, 0, 0,0x713B, + 0, 0,0x713D, 0, 0, 0,0x713C, 0, +0x713F,0x7142, 0, 0, 0,0x713E,0x7140,0x7141, + 0, 0,0x7143, 0,0x3642}; + +/* page 51 0x9996-0x9A6B */ +static uint16 tab_uni_jisx020851[]={ +0x3C73,0x7144,0x7145,0x3961, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7146, + 0, 0,0x333E, 0, 0, 0,0x474F,0x7147, +0x7148, 0, 0, 0, 0,0x435A,0x466B, 0, + 0, 0, 0, 0, 0, 0,0x7149, 0, + 0, 0, 0,0x477D, 0, 0,0x424C,0x3158, +0x366E, 0,0x366F, 0, 0, 0, 0, 0, + 0, 0,0x4373,0x714E,0x3670, 0, 0,0x326F, + 0, 0,0x714D, 0, 0,0x714B, 0,0x714C, + 0,0x714A, 0, 0,0x7158, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x714F, +0x7150, 0, 0,0x7151,0x7152, 0, 0, 0, + 0, 0,0x7154, 0, 0,0x7153, 0, 0, + 0,0x3D59, 0,0x7155, 0, 0, 0,0x7157, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3533,0x7156, 0, 0,0x417B,0x3833, 0, 0, + 0, 0, 0,0x7159, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x424D, 0, 0,0x715A, 0, 0, + 0, 0,0x462D, 0, 0, 0, 0, 0, + 0,0x715B, 0, 0, 0, 0, 0, 0, +0x7160, 0,0x715E, 0,0x715D,0x715F, 0,0x715C, + 0, 0, 0, 0, 0, 0, 0,0x7162, + 0, 0, 0, 0, 0, 0, 0,0x7161, + 0,0x7164, 0, 0,0x3643,0x7163, 0, 0, + 0,0x7165, 0, 0,0x7166, 0,0x7168,0x7167, + 0, 0, 0,0x7169,0x716B,0x716A}; + +/* page 52 0x9AA8-0x9B5A */ +static uint16 tab_uni_jisx020852[]={ +0x397C, 0, 0, 0, 0,0x716C, 0, 0, +0x716D, 0, 0, 0, 0, 0, 0, 0, +0x333C, 0, 0, 0,0x716E, 0, 0, 0, +0x716F, 0, 0, 0,0x3F71, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7170, + 0,0x7171, 0,0x7172,0x7173, 0, 0, 0, +0x3962, 0, 0, 0, 0, 0,0x7174,0x7175, + 0, 0,0x7176,0x7177, 0, 0,0x7178, 0, + 0, 0,0x4831,0x717A, 0,0x4926,0x717B,0x7179, + 0,0x717D, 0, 0,0x717C, 0, 0,0x717E, + 0, 0, 0,0x7221, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7222, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7223, 0,0x7224, 0, 0, 0, 0,0x7225, + 0, 0,0x7226,0x7227, 0,0x7228, 0,0x7229, +0x722A,0x722B,0x722C, 0, 0, 0,0x722D,0x722E, + 0,0x5D35,0x722F, 0, 0, 0, 0, 0, + 0, 0, 0,0x6478,0x3534, 0, 0, 0, + 0,0x3321,0x3A32,0x7231,0x7230,0x4C25, 0, 0, + 0, 0, 0, 0, 0,0x7233,0x7234,0x7232, + 0,0x7235, 0, 0,0x4B62, 0, 0, 0, +0x7236, 0,0x357B}; + +/* page 53 0x9B6F-0x9C78 */ +static uint16 tab_uni_jisx020853[]={ +0x4F25, 0, 0, 0, 0,0x7237, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x7239, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x303E, + 0, 0,0x723A,0x4A2B,0x7238, 0, 0,0x723B, +0x723C, 0, 0, 0, 0, 0, 0, 0, +0x723D,0x723E, 0, 0, 0, 0, 0, 0, + 0,0x723F, 0,0x4B6E,0x3B2D, 0,0x3A7A,0x412F, + 0, 0, 0, 0, 0,0x7240, 0, 0, + 0, 0,0x7243, 0, 0, 0, 0, 0, + 0,0x7241, 0, 0, 0, 0, 0,0x7244, + 0, 0,0x3871,0x7242, 0, 0, 0, 0, +0x7245, 0,0x7246,0x7247, 0,0x724B, 0,0x3B2A, + 0, 0, 0, 0,0x4264, 0, 0, 0, + 0, 0,0x724C,0x7249,0x7248,0x724A, 0, 0, + 0,0x375F, 0, 0, 0, 0, 0, 0, + 0,0x7250,0x724F,0x724E, 0, 0,0x3033, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x725A, 0,0x7256, + 0,0x7257,0x7253,0x7259, 0,0x7255,0x3362, 0, + 0,0x4F4C, 0,0x7258,0x7254,0x7252,0x7251, 0, + 0, 0, 0, 0,0x725C, 0, 0, 0, + 0, 0,0x725F, 0, 0,0x725E,0x725D, 0, + 0, 0, 0, 0, 0, 0,0x4949,0x725B, +0x3073,0x7260, 0,0x7262, 0, 0, 0, 0, + 0, 0,0x336F,0x724D,0x3137, 0, 0,0x7264, + 0, 0, 0, 0, 0, 0, 0,0x7263, +0x7261,0x432D, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4B70, 0, 0, 0, 0, +0x4E5A, 0, 0,0x7265, 0, 0, 0, 0, + 0,0x7266, 0, 0, 0, 0, 0, 0, +0x7267, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7268, + 0,0x7269}; + +/* page 54 0x9CE5-0x9DFD */ +static uint16 tab_uni_jisx020854[]={ +0x443B, 0,0x726A, 0,0x4837, 0,0x726F,0x726B, + 0, 0, 0,0x726C, 0, 0,0x4B31,0x4C44, + 0,0x4650, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7270, 0, + 0,0x7271,0x463E,0x726E,0x726D, 0, 0, 0, + 0,0x322A, 0, 0, 0,0x7279, 0, 0, +0x7278, 0, 0, 0, 0, 0,0x3175, 0, + 0, 0,0x7276, 0, 0, 0,0x7275, 0, + 0,0x7273, 0,0x337B, 0,0x7272,0x3C32,0x3229, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3963, 0, + 0,0x727C,0x727B, 0,0x727A, 0, 0,0x7277, + 0,0x727D, 0,0x727E, 0, 0, 0, 0, + 0, 0, 0,0x7325,0x7324, 0, 0, 0, + 0, 0, 0, 0,0x7326, 0, 0,0x312D, +0x7321,0x7322, 0,0x3974,0x4C39, 0, 0,0x7323, + 0, 0, 0, 0, 0, 0, 0,0x4B32, + 0, 0,0x732B, 0, 0,0x7327, 0, 0, + 0, 0, 0, 0, 0,0x732C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7329, 0,0x7328, 0, 0, 0, + 0, 0,0x375C, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x732D, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x732E, + 0, 0, 0, 0,0x732F, 0,0x732A, 0, + 0, 0,0x7274, 0, 0,0x7330, 0,0x4461, + 0, 0, 0,0x7334, 0,0x7335,0x7333, 0, + 0, 0, 0, 0,0x7332,0x7338, 0,0x7331, + 0,0x7336, 0, 0, 0, 0, 0, 0, + 0, 0,0x7337, 0, 0, 0,0x733A, 0, + 0, 0, 0, 0,0x7339, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x733C, 0, 0, 0, 0, 0, 0, +0x733D, 0,0x733E, 0, 0,0x4F49, 0, 0, + 0, 0, 0,0x733B,0x426B,0x3A6D, 0, 0, +0x733F}; + +/* page 55 0x9E1A-0x9E1E */ +static uint16 tab_uni_jisx020855[]={ +0x7340,0x7341, 0, 0,0x7342}; + +/* page 56 0x9E75-0x9F77 */ +static uint16 tab_uni_jisx020856[]={ +0x7343, 0, 0,0x3834,0x7344, 0, 0, 0, +0x7345, 0,0x3C2F, 0,0x7346, 0, 0, 0, + 0, 0, 0,0x7347, 0, 0,0x7348,0x7349, + 0, 0, 0, 0,0x734C,0x734A,0x4F3C, 0, +0x734B, 0,0x4E6F, 0, 0, 0, 0, 0, +0x734D, 0,0x4E5B, 0, 0, 0, 0, 0, +0x734E,0x477E, 0, 0,0x734F,0x7351, 0, 0, +0x7352, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x7350,0x396D,0x4C4D,0x4B63,0x5677, + 0,0x5D60,0x4B7B, 0, 0, 0, 0,0x322B, + 0, 0, 0, 0, 0, 0, 0,0x7354, +0x3550,0x7355,0x7356,0x7357, 0,0x3975, 0,0x7358, + 0, 0, 0,0x6054,0x4C5B, 0,0x4263,0x7359, +0x735B,0x735A, 0,0x735C, 0, 0, 0, 0, +0x735D, 0, 0,0x735E, 0, 0, 0, 0, + 0, 0,0x735F, 0, 0, 0, 0,0x7360, + 0,0x7361,0x7362, 0,0x7363, 0,0x7364,0x7365, +0x7366, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7367,0x7368, 0, 0, 0, 0, + 0,0x4524, 0, 0, 0, 0,0x385D, 0, +0x736A, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x414D,0x736B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x736C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4921, 0, + 0,0x736D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x736E,0x6337, 0, + 0,0x6C5A,0x706D, 0, 0,0x736F, 0,0x7370, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7372,0x7373,0x7374,0x4E70,0x7371, 0, + 0,0x7375,0x7376, 0, 0,0x7378, 0,0x7377, + 0, 0, 0, 0, 0,0x737A, 0, 0, + 0,0x737B,0x7379}; + +/* page 57 0x9F8D-0x9FA0 */ +static uint16 tab_uni_jisx020857[]={ +0x4E36, 0, 0, 0, 0, 0, 0, 0, +0x737C, 0, 0, 0, 0, 0, 0,0x737D, +0x6354, 0, 0,0x737E}; + +/* page 58 0xFF01-0xFF5E */ +static uint16 tab_uni_jisx020858[]={ +0x212A, 0,0x2174,0x2170,0x2173,0x2175, 0,0x214A, +0x214B,0x2176,0x215C,0x2124,0x215D,0x2125,0x213F,0x2330, +0x2331,0x2332,0x2333,0x2334,0x2335,0x2336,0x2337,0x2338, +0x2339,0x2127,0x2128,0x2163,0x2161,0x2164,0x2129,0x2177, +0x2341,0x2342,0x2343,0x2344,0x2345,0x2346,0x2347,0x2348, +0x2349,0x234A,0x234B,0x234C,0x234D,0x234E,0x234F,0x2350, +0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,0x2358, +0x2359,0x235A,0x214E,0x2140,0x214F,0x2130,0x2132,0x212E, +0x2361,0x2362,0x2363,0x2364,0x2365,0x2366,0x2367,0x2368, +0x2369,0x236A,0x236B,0x236C,0x236D,0x236E,0x236F,0x2370, +0x2371,0x2372,0x2373,0x2374,0x2375,0x2376,0x2377,0x2378, +0x2379,0x237A,0x2150,0x2143,0x2151,0x2141}; + +/* page 59 0xFFE0-0xFFE5 */ +static uint16 tab_uni_jisx020859[]={ +0x2171,0x2172,0x224C,0x2131, 0,0x216F}; + +static int +my_uni_jisx0208_onechar(int code){ + if ((code>=0x005C)&&(code<=0x005C)) + return(tab_uni_jisx02080[code-0x005C]); + if ((code>=0x00A2)&&(code<=0x00B6)) + return(tab_uni_jisx02081[code-0x00A2]); + if ((code>=0x00D7)&&(code<=0x00D7)) + return(tab_uni_jisx02082[code-0x00D7]); + if ((code>=0x00F7)&&(code<=0x00F7)) + return(tab_uni_jisx02083[code-0x00F7]); + if ((code>=0x0391)&&(code<=0x03C9)) + return(tab_uni_jisx02084[code-0x0391]); + if ((code>=0x0401)&&(code<=0x0451)) + return(tab_uni_jisx02085[code-0x0401]); + if ((code>=0x2010)&&(code<=0x203B)) + return(tab_uni_jisx02086[code-0x2010]); + if ((code>=0x2100)&&(code<=0x2116)) + return(tab_uni_jisx02087[code-0x2100]); + if ((code>=0x2120)&&(code<=0x212B)) + return(tab_uni_jisx02088[code-0x2120]); + if ((code>=0x2160)&&(code<=0x2169)) + return(tab_uni_jisx02089[code-0x2160]); + if ((code>=0x2190)&&(code<=0x2193)) + return(tab_uni_jisx020810[code-0x2190]); + if ((code>=0x21D2)&&(code<=0x21D4)) + return(tab_uni_jisx020811[code-0x21D2]); + if ((code>=0x2200)&&(code<=0x223D)) + return(tab_uni_jisx020812[code-0x2200]); + if ((code>=0x2252)&&(code<=0x226B)) + return(tab_uni_jisx020813[code-0x2252]); + if ((code>=0x2282)&&(code<=0x2287)) + return(tab_uni_jisx020814[code-0x2282]); + if ((code>=0x22A0)&&(code<=0x22BF)) + return(tab_uni_jisx020815[code-0x22A0]); + if ((code>=0x2312)&&(code<=0x2312)) + return(tab_uni_jisx020816[code-0x2312]); + if ((code>=0x2460)&&(code<=0x2473)) + return(tab_uni_jisx020817[code-0x2460]); + if ((code>=0x2500)&&(code<=0x254B)) + return(tab_uni_jisx020818[code-0x2500]); + if ((code>=0x25A0)&&(code<=0x25CF)) + return(tab_uni_jisx020819[code-0x25A0]); + if ((code>=0x25EF)&&(code<=0x25EF)) + return(tab_uni_jisx020820[code-0x25EF]); + if ((code>=0x2605)&&(code<=0x2606)) + return(tab_uni_jisx020821[code-0x2605]); + if ((code>=0x2640)&&(code<=0x2642)) + return(tab_uni_jisx020822[code-0x2640]); + if ((code>=0x266A)&&(code<=0x266F)) + return(tab_uni_jisx020823[code-0x266A]); + if ((code>=0x3000)&&(code<=0x301F)) + return(tab_uni_jisx020824[code-0x3000]); + if ((code>=0x3041)&&(code<=0x30FE)) + return(tab_uni_jisx020825[code-0x3041]); + if ((code>=0x3230)&&(code<=0x3239)) + return(tab_uni_jisx020826[code-0x3230]); + if ((code>=0x32A0)&&(code<=0x32A8)) + return(tab_uni_jisx020827[code-0x32A0]); + if ((code>=0x3300)&&(code<=0x33CD)) + return(tab_uni_jisx020828[code-0x3300]); + if ((code>=0x4E00)&&(code<=0x5516)) + return(tab_uni_jisx020829[code-0x4E00]); + if ((code>=0x552E)&&(code<=0x5563)) + return(tab_uni_jisx020830[code-0x552E]); + if ((code>=0x557B)&&(code<=0x576A)) + return(tab_uni_jisx020831[code-0x557B]); + if ((code>=0x577F)&&(code<=0x5A9B)) + return(tab_uni_jisx020832[code-0x577F]); + if ((code>=0x5ABC)&&(code<=0x5D29)) + return(tab_uni_jisx020833[code-0x5ABC]); + if ((code>=0x5D4B)&&(code<=0x6BF3)) + return(tab_uni_jisx020834[code-0x5D4B]); + if ((code>=0x6C08)&&(code<=0x6CF3)) + return(tab_uni_jisx020835[code-0x6C08]); + if ((code>=0x6D0B)&&(code<=0x7409)) + return(tab_uni_jisx020836[code-0x6D0B]); + if ((code>=0x7422)&&(code<=0x7845)) + return(tab_uni_jisx020837[code-0x7422]); + if ((code>=0x785D)&&(code<=0x7E9C)) + return(tab_uni_jisx020838[code-0x785D]); + if ((code>=0x7F36)&&(code<=0x8358)) + return(tab_uni_jisx020839[code-0x7F36]); + if ((code>=0x8373)&&(code<=0x8B9A)) + return(tab_uni_jisx020840[code-0x8373]); + if ((code>=0x8C37)&&(code<=0x8D16)) + return(tab_uni_jisx020841[code-0x8C37]); + if ((code>=0x8D64)&&(code<=0x8F64)) + return(tab_uni_jisx020842[code-0x8D64]); + if ((code>=0x8F9B)&&(code<=0x9132)) + return(tab_uni_jisx020843[code-0x8F9B]); + if ((code>=0x9149)&&(code<=0x92B9)) + return(tab_uni_jisx020844[code-0x9149]); + if ((code>=0x92CF)&&(code<=0x93E8)) + return(tab_uni_jisx020845[code-0x92CF]); + if ((code>=0x9403)&&(code<=0x9481)) + return(tab_uni_jisx020846[code-0x9403]); + if ((code>=0x9577)&&(code<=0x95E5)) + return(tab_uni_jisx020847[code-0x9577]); + if ((code>=0x961C)&&(code<=0x9874)) + return(tab_uni_jisx020848[code-0x961C]); + if ((code>=0x98A8)&&(code<=0x98C6)) + return(tab_uni_jisx020849[code-0x98A8]); + if ((code>=0x98DB)&&(code<=0x9957)) + return(tab_uni_jisx020850[code-0x98DB]); + if ((code>=0x9996)&&(code<=0x9A6B)) + return(tab_uni_jisx020851[code-0x9996]); + if ((code>=0x9AA8)&&(code<=0x9B5A)) + return(tab_uni_jisx020852[code-0x9AA8]); + if ((code>=0x9B6F)&&(code<=0x9C78)) + return(tab_uni_jisx020853[code-0x9B6F]); + if ((code>=0x9CE5)&&(code<=0x9DFD)) + return(tab_uni_jisx020854[code-0x9CE5]); + if ((code>=0x9E1A)&&(code<=0x9E1E)) + return(tab_uni_jisx020855[code-0x9E1A]); + if ((code>=0x9E75)&&(code<=0x9F77)) + return(tab_uni_jisx020856[code-0x9E75]); + if ((code>=0x9F8D)&&(code<=0x9FA0)) + return(tab_uni_jisx020857[code-0x9F8D]); + if ((code>=0xFF01)&&(code<=0xFF5E)) + return(tab_uni_jisx020858[code-0xFF01]); + if ((code>=0xFFE0)&&(code<=0xFFE5)) + return(tab_uni_jisx020859[code-0xFFE0]); + return(0); +} + + +/* page 0 0x007E-0x007E */ +static uint16 tab_uni_jisx02120[]={ + 0}; + +/* page 1 0x00A1-0x017E */ +static uint16 tab_uni_jisx02121[]={ +0x2242, 0, 0,0x2270, 0, 0, 0, 0, +0x226D,0x226C, 0, 0, 0,0x226E,0x2234, 0, + 0, 0, 0, 0, 0, 0, 0,0x2231, + 0,0x226B, 0, 0, 0, 0,0x2244,0x2A22, +0x2A21,0x2A24,0x2A2A,0x2A23,0x2A29,0x2921,0x2A2E,0x2A32, +0x2A31,0x2A34,0x2A33,0x2A40,0x2A3F,0x2A42,0x2A41, 0, +0x2A50,0x2A52,0x2A51,0x2A54,0x2A58,0x2A53, 0,0x292C, +0x2A63,0x2A62,0x2A65,0x2A64,0x2A72,0x2930,0x294E,0x2B22, +0x2B21,0x2B24,0x2B2A,0x2B23,0x2B29,0x2941,0x2B2E,0x2B32, +0x2B31,0x2B34,0x2B33,0x2B40,0x2B3F,0x2B42,0x2B41,0x2943, +0x2B50,0x2B52,0x2B51,0x2B54,0x2B58,0x2B53, 0,0x294C, +0x2B63,0x2B62,0x2B65,0x2B64,0x2B72,0x2950,0x2B73,0x2A27, +0x2B27,0x2A25,0x2B25,0x2A28,0x2B28,0x2A2B,0x2B2B,0x2A2C, +0x2B2C,0x2A2F,0x2B2F,0x2A2D,0x2B2D,0x2A30,0x2B30,0x2922, +0x2942,0x2A37,0x2B37, 0, 0,0x2A36,0x2B36,0x2A38, +0x2B38,0x2A35,0x2B35,0x2A3A,0x2B3A,0x2A3B,0x2B3B,0x2A3D, +0x2B3D,0x2A3C, 0,0x2A3E,0x2B3E,0x2924,0x2944,0x2A47, +0x2B47,0x2A45,0x2B45, 0, 0,0x2A46,0x2B46,0x2A44, +0x2945,0x2926,0x2946,0x2A48,0x2B48,0x2A49,0x2B49,0x2947, +0x2A4A,0x2B4A,0x2A4C,0x2B4C,0x2A4B,0x2B4B,0x2929,0x2949, +0x2928,0x2948,0x2A4D,0x2B4D,0x2A4F,0x2B4F,0x2A4E,0x2B4E, +0x294A,0x292B,0x294B,0x2A57,0x2B57, 0, 0,0x2A56, +0x2B56,0x292D,0x294D,0x2A59,0x2B59,0x2A5B,0x2B5B,0x2A5A, +0x2B5A,0x2A5C,0x2B5C,0x2A5D,0x2B5D,0x2A5F,0x2B5F,0x2A5E, +0x2B5E,0x2A61,0x2B61,0x2A60,0x2B60,0x292F,0x294F,0x2A6C, +0x2B6C,0x2A69,0x2B69,0x2A66,0x2B66,0x2A6B,0x2B6B,0x2A68, +0x2B68,0x2A6A,0x2B6A,0x2A71,0x2B71,0x2A74,0x2B74,0x2A73, +0x2A75,0x2B75,0x2A77,0x2B77,0x2A76,0x2B76}; + +/* page 2 0x01CD-0x01DC */ +static uint16 tab_uni_jisx02122[]={ +0x2A26,0x2B26,0x2A43,0x2B43,0x2A55,0x2B55,0x2A67,0x2B67, +0x2A70,0x2B70,0x2A6D,0x2B6D,0x2A6F,0x2B6F,0x2A6E,0x2B6E +}; + +/* page 3 0x01F5-0x01F5 */ +static uint16 tab_uni_jisx02123[]={ +0x2B39}; + +/* page 4 0x02C7-0x02DD */ +static uint16 tab_uni_jisx02124[]={ +0x2230, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x222F,0x2232,0x2236,0x2235, 0,0x2233}; + +/* page 5 0x0384-0x0390 */ +static uint16 tab_uni_jisx02125[]={ +0x2238,0x2239,0x2661, 0,0x2662,0x2663,0x2664, 0, +0x2667, 0,0x2669,0x266C,0x2676}; + +/* page 6 0x03AA-0x03CE */ +static uint16 tab_uni_jisx02126[]={ +0x2665,0x266A,0x2671,0x2672,0x2673,0x2674,0x267B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2678, 0, 0, 0, 0, 0, 0, 0, +0x2675,0x267A,0x2677,0x2679,0x267C}; + +/* page 7 0x0402-0x040F */ +static uint16 tab_uni_jisx02127[]={ +0x2742,0x2743,0x2744,0x2745,0x2746,0x2747,0x2748,0x2749, +0x274A,0x274B,0x274C, 0,0x274D,0x274E}; + +/* page 8 0x0452-0x045F */ +static uint16 tab_uni_jisx02128[]={ +0x2772,0x2773,0x2774,0x2775,0x2776,0x2777,0x2778,0x2779, +0x277A,0x277B,0x277C, 0,0x277D,0x277E}; + +/* page 9 0x2122-0x2122 */ +static uint16 tab_uni_jisx02129[]={ +0x226F}; + +/* page 10 0x2170-0x2179 */ +static uint16 tab_uni_jisx021210[]={ +0x7373,0x7374,0x7375,0x7376,0x7377,0x7378,0x7379,0x737A, +0x737B,0x737C}; + +/* page 11 0x4E02-0x4F19 */ +static uint16 tab_uni_jisx021211[]={ +0x3021, 0,0x3022,0x3023, 0, 0, 0, 0, + 0, 0,0x3024, 0, 0, 0, 0, 0, +0x3025, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3026, 0, 0, + 0,0x3027,0x3028, 0, 0, 0,0x3029, 0, + 0,0x302A, 0, 0,0x302B,0x302C,0x302D, 0, + 0, 0, 0,0x302E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x302F,0x3030, + 0, 0,0x3031, 0, 0,0x3032, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3033, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3034, 0,0x3035, 0, 0, 0, 0, 0, + 0,0x3036, 0, 0, 0, 0,0x3037,0x3038, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3039,0x303A, 0, 0, 0,0x303B, + 0, 0, 0, 0, 0,0x303C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x303D, 0, 0, 0, 0, + 0, 0, 0, 0,0x303E,0x303F, 0, 0, + 0, 0, 0,0x3040, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3041, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3042, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3043, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3044, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3045,0x3046, 0, 0, 0, 0,0x3047,0x3048, +0x3049, 0, 0, 0, 0, 0,0x304A, 0, + 0, 0, 0, 0, 0,0x304B, 0,0x304C, + 0,0x304D, 0,0x304E, 0, 0, 0, 0, + 0, 0,0x742F,0x304F,0x3050,0x3051,0x3052, 0, +0x3053,0x3054, 0, 0, 0, 0,0x3055, 0, + 0,0x3056,0x3057, 0, 0, 0, 0, 0, +0x3058, 0, 0,0x3059,0x305A,0x305B, 0,0x305C +}; + +/* page 12 0x4F2E-0x5166 */ +static uint16 tab_uni_jisx021212[]={ +0x305D, 0, 0,0x305E, 0,0x3060, 0,0x3061, + 0,0x3062, 0,0x3063, 0,0x3064, 0, 0, +0x3065, 0,0x3066, 0,0x3067, 0, 0, 0, + 0, 0,0x3068,0x3069, 0,0x306A,0x306B, 0, + 0, 0, 0, 0,0x306C, 0,0x306D, 0, +0x306E, 0,0x306F, 0, 0, 0, 0, 0, + 0,0x3070,0x305F, 0, 0,0x3071, 0, 0, + 0, 0, 0, 0,0x3072, 0,0x3073, 0, +0x3074, 0, 0,0x3075, 0, 0, 0, 0, + 0,0x3076,0x3077,0x3078,0x3079, 0, 0,0x307A, +0x307B, 0, 0,0x307C,0x307D, 0,0x307E,0x3121, + 0, 0, 0,0x3122,0x3123, 0,0x3124, 0, +0x3125, 0,0x3126, 0,0x3127,0x3128,0x3129, 0, + 0,0x312A, 0,0x312B,0x312C, 0, 0, 0, +0x312D,0x312E, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x312F, 0, 0, 0, + 0,0x3130, 0,0x3131, 0,0x3132,0x3133,0x3134, +0x3135, 0,0x3136,0x3137, 0, 0, 0,0x3138, +0x3139, 0,0x313A,0x313B, 0,0x313C,0x313D,0x313E, + 0,0x313F, 0, 0,0x3140, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3141, 0, + 0, 0,0x3142, 0,0x3143, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3144, 0,0x3145, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3146,0x3147, + 0,0x3148,0x3149,0x314A, 0, 0,0x314B, 0, + 0,0x314C, 0, 0,0x314D, 0,0x314E, 0, +0x314F, 0,0x3150, 0, 0,0x3151, 0, 0, + 0,0x3152,0x3153, 0, 0,0x3154,0x3155,0x3156, +0x3157, 0, 0, 0,0x3158, 0, 0, 0, + 0,0x3159, 0, 0, 0, 0, 0, 0, +0x315A, 0,0x315B, 0,0x315C,0x315D, 0,0x315E, + 0, 0, 0, 0, 0,0x3176, 0, 0, + 0, 0,0x315F,0x3160,0x3161, 0, 0,0x3162, +0x3163, 0, 0, 0,0x3164, 0,0x3165, 0, +0x3166, 0, 0,0x3167,0x3168,0x3169, 0, 0, + 0,0x316A, 0,0x316B, 0, 0, 0, 0, + 0,0x316C,0x316D, 0,0x316E,0x316F, 0, 0, +0x3170,0x3171, 0, 0,0x3172, 0, 0,0x3173, + 0, 0,0x3174,0x3175, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3177, 0,0x3178,0x3179, 0, +0x317A, 0, 0, 0,0x317B, 0, 0, 0, +0x317C,0x317D,0x317E, 0,0x3221,0x3222,0x3223, 0, +0x3224, 0, 0, 0, 0,0x3225,0x3226, 0, +0x3227,0x3228,0x3229,0x322A,0x322B, 0, 0, 0, + 0, 0, 0, 0,0x322C, 0, 0, 0, + 0,0x322D,0x322E, 0, 0, 0, 0, 0, + 0, 0, 0,0x322F,0x3230, 0, 0,0x3231, + 0, 0,0x3232, 0, 0,0x3233,0x3234, 0, + 0,0x3235, 0, 0, 0, 0,0x3236, 0, +0x3237, 0,0x3238, 0, 0,0x3239,0x323A, 0, + 0, 0,0x323B, 0, 0, 0,0x323C,0x323D, + 0,0x323E, 0, 0,0x323F, 0,0x3240, 0, +0x3241, 0,0x3242,0x3243, 0, 0, 0, 0, + 0,0x3244, 0,0x3245,0x3251, 0,0x7430, 0, +0x3246, 0, 0, 0,0x3247, 0, 0, 0, +0x3248, 0, 0, 0, 0,0x3249, 0, 0, +0x324A,0x324B,0x324C, 0, 0,0x324D,0x324E,0x324F, +0x3250, 0,0x3252, 0, 0, 0, 0, 0, + 0,0x3253, 0,0x3254, 0,0x3255,0x3256,0x3257, +0x3258, 0, 0, 0, 0,0x3259, 0, 0, + 0,0x325A,0x325B, 0, 0, 0,0x325C,0x325D, + 0,0x325E, 0,0x325F, 0,0x3260,0x3261,0x3262, + 0, 0,0x3263,0x3264, 0, 0, 0, 0, + 0, 0, 0, 0,0x3265, 0, 0, 0, + 0, 0, 0, 0,0x3266, 0, 0, 0, + 0,0x3267, 0, 0, 0,0x3268, 0,0x3269, + 0,0x326A,0x326B, 0, 0, 0, 0, 0, + 0,0x326C, 0, 0, 0, 0,0x326D, 0, +0x326E}; + +/* page 13 0x517E-0x5515 */ +static uint16 tab_uni_jisx021213[]={ +0x326F, 0, 0, 0, 0,0x3270,0x3271, 0, + 0, 0, 0, 0, 0,0x3272, 0, 0, +0x3273, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3274, 0, 0, 0, 0,0x3275, + 0, 0, 0,0x3276, 0,0x3277, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3278, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3279, 0,0x327A, 0,0x327B, 0, +0x327C,0x327D, 0, 0,0x327E, 0, 0, 0, + 0, 0,0x3321, 0, 0, 0, 0, 0, + 0,0x3322, 0,0x3323,0x3324,0x3325, 0,0x3326, + 0, 0,0x3327, 0, 0, 0, 0, 0, +0x3328, 0, 0, 0,0x3329, 0, 0,0x332A, + 0, 0, 0, 0, 0, 0,0x7431, 0, +0x332B, 0, 0, 0,0x332C,0x332D,0x332E, 0, + 0,0x332F, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3330,0x3331, 0, 0,0x3332, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3333,0x3334, 0,0x3335, +0x3336, 0,0x3337, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3338, 0, 0, 0, + 0, 0,0x3339, 0, 0, 0, 0, 0, + 0, 0, 0,0x333A,0x333B, 0, 0,0x333C, + 0, 0, 0, 0, 0, 0,0x333D, 0, + 0, 0, 0, 0, 0, 0, 0,0x333E, + 0, 0, 0,0x333F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3340, + 0,0x3341,0x3342, 0,0x3343, 0,0x3344, 0, + 0,0x3345,0x3346,0x3347, 0, 0, 0, 0, +0x3348, 0, 0, 0, 0, 0, 0, 0, +0x3349, 0, 0, 0, 0, 0, 0, 0, + 0,0x334A,0x334B,0x334C, 0, 0, 0, 0, + 0, 0,0x334D, 0,0x334E, 0, 0,0x334F, + 0, 0, 0, 0,0x3350, 0,0x3351, 0, + 0, 0, 0, 0, 0,0x3352, 0,0x3353, +0x3354,0x3355,0x3356, 0,0x3357, 0,0x3358, 0, + 0, 0, 0, 0, 0, 0,0x3359,0x335A, +0x335B,0x335C, 0, 0, 0, 0, 0, 0, + 0,0x335D,0x335E, 0, 0, 0, 0, 0, +0x335F,0x3360,0x3361, 0,0x3362,0x3363, 0,0x3364, + 0, 0,0x3365, 0, 0, 0,0x3366, 0, +0x3367, 0,0x3368, 0, 0, 0,0x3369, 0, + 0,0x336A, 0,0x336B, 0, 0,0x336C, 0, +0x336D, 0, 0, 0, 0,0x336E,0x336F, 0, + 0, 0, 0,0x3370, 0, 0, 0,0x3371, + 0, 0,0x3372,0x3373,0x3374, 0,0x3375, 0, + 0, 0,0x3376,0x3377, 0, 0,0x3378, 0, +0x3379,0x337A, 0, 0, 0, 0, 0, 0, + 0, 0,0x337B, 0, 0,0x337C, 0, 0, + 0,0x7432, 0, 0,0x337D,0x337E,0x3421, 0, + 0, 0, 0,0x3422, 0,0x3423, 0, 0, + 0, 0,0x3424, 0, 0,0x3425,0x3426, 0, +0x3427,0x3428, 0, 0, 0, 0,0x7433,0x3429, + 0,0x342A,0x342B,0x342C, 0,0x342D,0x342E,0x342F, + 0, 0,0x3430, 0,0x3431, 0, 0,0x3432, + 0, 0, 0, 0, 0, 0,0x3433,0x3434, +0x3435, 0, 0, 0,0x3436, 0, 0, 0, + 0, 0, 0, 0, 0,0x3438,0x3437, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3439, 0,0x343A, 0, 0, + 0, 0, 0,0x343B, 0,0x343C, 0,0x343D, + 0, 0, 0, 0, 0, 0,0x343E,0x343F, + 0, 0, 0, 0,0x3440, 0, 0, 0, + 0, 0, 0,0x3441, 0, 0, 0, 0, +0x3442, 0, 0, 0, 0,0x3443, 0, 0, + 0,0x3444,0x3445, 0, 0, 0, 0, 0, +0x3446, 0, 0, 0, 0,0x3447,0x3448, 0, + 0, 0, 0,0x3449, 0, 0, 0,0x344A, + 0, 0, 0,0x344B, 0, 0,0x344C, 0, + 0, 0, 0, 0,0x344D,0x344E, 0, 0, + 0,0x344F, 0, 0,0x3450, 0,0x3451,0x3452, + 0,0x3453,0x3454, 0,0x3455, 0, 0,0x3456, + 0, 0,0x3457, 0, 0, 0, 0,0x3458, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3459, 0, 0,0x345A,0x345B, 0,0x345C, + 0, 0, 0, 0,0x345D, 0, 0,0x345E, +0x345F, 0,0x3460, 0, 0, 0, 0, 0, +0x3461,0x3462, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3463, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3465, 0, 0, + 0, 0, 0, 0,0x3466, 0, 0, 0, + 0, 0, 0,0x3467, 0, 0, 0, 0, + 0,0x3468,0x3469, 0,0x346A, 0, 0, 0, + 0,0x346B, 0,0x346C, 0, 0,0x346D,0x346E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x346F,0x3470, 0, + 0,0x3471, 0, 0, 0, 0, 0,0x3472, + 0,0x3473, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3474, 0, 0, 0,0x3475, 0,0x3476, 0, +0x3477,0x3478, 0,0x3479, 0,0x347A, 0,0x347B, +0x347C, 0, 0, 0, 0, 0,0x347D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x347E, 0,0x3521, 0,0x3522, 0,0x3523, + 0, 0,0x3524,0x3525,0x7435, 0, 0,0x3526, + 0, 0, 0,0x3527, 0, 0, 0,0x3528, +0x3529, 0, 0, 0, 0, 0,0x352A, 0, + 0,0x352B, 0,0x352C, 0, 0, 0, 0, +0x352D,0x352E, 0,0x352F,0x3530, 0, 0,0x3531, +0x3532, 0, 0,0x3533, 0, 0, 0, 0, + 0,0x3534, 0,0x3535,0x3536,0x3537, 0, 0, + 0,0x3538, 0, 0, 0, 0, 0, 0, +0x3539, 0, 0, 0,0x353A, 0, 0,0x353B, +0x353C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x353D, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x353E, 0,0x353F, 0, + 0,0x3540, 0, 0, 0, 0, 0, 0, +0x3541, 0, 0, 0, 0, 0,0x3542, 0, +0x3543,0x3544,0x3545,0x3546, 0, 0, 0,0x3547, + 0, 0,0x3548,0x3549, 0, 0,0x354A,0x354B, +0x354C, 0, 0, 0, 0, 0, 0,0x354D +}; + +/* page 14 0x552A-0x5566 */ +static uint16 tab_uni_jisx021214[]={ +0x354E,0x354F, 0, 0, 0, 0, 0, 0, +0x3550, 0, 0,0x3551,0x3552, 0, 0, 0, + 0,0x3553,0x3554,0x3555, 0, 0, 0,0x3556, + 0, 0, 0, 0, 0,0x3557, 0,0x3558, +0x3559, 0, 0,0x355A, 0, 0,0x355B,0x355C, + 0, 0, 0, 0, 0, 0,0x355D, 0, +0x355E,0x355F, 0, 0,0x3560, 0,0x3561,0x3562, + 0, 0,0x3563, 0,0x3564}; + +/* page 15 0x557F-0x5C36 */ +static uint16 tab_uni_jisx021215[]={ +0x3565, 0,0x3566,0x3567, 0, 0, 0,0x3568, + 0,0x3569, 0, 0, 0, 0, 0,0x356A, +0x356B, 0,0x356C,0x356D,0x356E,0x356F, 0, 0, +0x3570, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3571,0x3572, 0, 0, + 0, 0, 0, 0, 0, 0,0x3573, 0, + 0, 0, 0,0x3574, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3575, 0,0x3576, 0,0x3577, 0, 0,0x3578, + 0, 0,0x3579, 0,0x357A,0x357B, 0,0x357C, + 0, 0,0x357D,0x357E,0x3621, 0, 0, 0, +0x3622,0x3623, 0, 0,0x3624, 0, 0,0x3625, + 0, 0, 0,0x3626, 0, 0, 0, 0, + 0, 0,0x3627, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3628, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3629, 0, 0, 0, 0, 0,0x362A, 0, + 0,0x362B, 0,0x362C, 0, 0,0x362D,0x362E, +0x362F,0x3630,0x3631,0x3632, 0, 0, 0, 0, + 0, 0,0x3633, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3634, 0, 0, + 0,0x3635, 0, 0,0x3636, 0,0x3637, 0, +0x3638, 0,0x3639, 0,0x363A,0x363B,0x363C, 0, +0x363D,0x363E,0x363F, 0,0x3640,0x3641, 0,0x3642, + 0, 0,0x3643, 0,0x3644, 0,0x3645, 0, +0x3646, 0, 0, 0, 0,0x3647, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3648, + 0,0x3649,0x364A,0x364B,0x364C, 0, 0,0x364D, + 0, 0,0x364E, 0, 0, 0,0x364F, 0, +0x3650, 0,0x3651,0x3652, 0, 0,0x3653, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3654,0x3655, 0, + 0,0x3656, 0, 0,0x3657,0x3658, 0, 0, + 0, 0, 0, 0, 0, 0,0x3659, 0, + 0, 0,0x365A,0x365B, 0, 0,0x365C,0x365D, +0x365E, 0, 0, 0, 0, 0, 0,0x365F, +0x3660,0x3661,0x3662, 0,0x3663,0x3664,0x3665, 0, + 0, 0,0x3666, 0,0x3667, 0, 0, 0, +0x3668, 0, 0, 0, 0, 0, 0,0x3669, + 0, 0, 0, 0, 0, 0,0x366A, 0, + 0, 0,0x366B,0x366C,0x366D,0x3670,0x3671, 0, +0x366E,0x366F, 0, 0, 0, 0, 0, 0, + 0, 0,0x3672, 0, 0,0x3673,0x3674, 0, +0x3675, 0,0x3676, 0, 0,0x3677,0x3678,0x3679, +0x367A,0x367B, 0, 0,0x367D, 0,0x367E, 0, + 0, 0,0x367C, 0, 0, 0, 0,0x3721, +0x3722, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3723,0x3724, 0, 0, 0, 0, +0x3725, 0, 0,0x3726, 0,0x3727, 0, 0, + 0, 0,0x3728, 0, 0, 0,0x3729, 0, + 0, 0, 0,0x372A,0x372B, 0,0x372C, 0, + 0,0x372D, 0,0x372E,0x372F,0x3730,0x3731, 0, + 0, 0,0x3732,0x3733, 0,0x3734, 0,0x3735, +0x3736, 0, 0, 0,0x3737,0x3738, 0, 0, + 0, 0, 0, 0, 0, 0,0x3739,0x373A, +0x373B, 0, 0, 0, 0, 0,0x373C,0x373D, + 0, 0, 0, 0, 0,0x373E,0x373F, 0, + 0, 0, 0,0x3740, 0, 0, 0, 0, + 0, 0,0x7436, 0, 0, 0, 0, 0, + 0, 0, 0,0x3741, 0, 0,0x3742, 0, +0x3743,0x3744, 0, 0,0x3745, 0,0x3746,0x3747, +0x3748,0x3749,0x374A, 0,0x374B,0x374C,0x374D, 0, +0x374E, 0,0x374F,0x3750,0x3751,0x3752, 0,0x3753, + 0, 0,0x3754, 0,0x3755, 0, 0, 0, + 0, 0, 0, 0, 0,0x3756, 0, 0, + 0, 0, 0, 0, 0,0x3757,0x3760, 0, +0x3758, 0,0x3759,0x375A, 0,0x375B,0x375C,0x375D, +0x375E, 0,0x375F, 0, 0, 0, 0, 0, +0x3761,0x3762,0x3763, 0, 0,0x3764, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3765, 0, 0, 0, 0,0x3766, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3767,0x3768, 0, 0, 0,0x3769, 0, 0, +0x376A, 0, 0, 0, 0, 0,0x376B, 0, + 0, 0, 0, 0, 0, 0,0x376C,0x376D, + 0, 0,0x377E, 0, 0,0x376E, 0,0x376F, +0x3770, 0,0x3771, 0, 0, 0,0x3772, 0, + 0,0x3773, 0, 0, 0, 0,0x3774,0x3775, + 0,0x3776, 0, 0, 0, 0,0x3777,0x3778, +0x3779, 0, 0, 0,0x377A,0x377B, 0, 0, + 0,0x377C,0x377D, 0, 0,0x3821,0x3822, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3823, 0, 0,0x3824, +0x3825,0x3826, 0, 0, 0, 0, 0,0x3827, +0x3828, 0, 0, 0, 0, 0,0x3829, 0, + 0, 0, 0,0x382A, 0, 0, 0, 0, + 0, 0,0x382B, 0, 0, 0, 0, 0, +0x382C, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x382D, 0, 0,0x382E,0x382F, 0, +0x3830,0x3831, 0, 0, 0, 0,0x3832, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3833, 0,0x3834, 0, 0,0x3835, 0, 0, +0x3836,0x3837, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3838, 0, 0, 0,0x3839, 0, 0, +0x383A,0x383B,0x383C, 0, 0, 0, 0, 0, +0x383D,0x383E,0x383F,0x3840, 0,0x3841,0x3842, 0, +0x3843,0x3844, 0, 0, 0,0x3845, 0,0x3846, + 0, 0, 0, 0, 0, 0,0x3847,0x7439, + 0,0x3848,0x3849,0x384A, 0, 0, 0,0x384B, + 0, 0,0x384C, 0, 0, 0, 0, 0, + 0, 0,0x384D,0x384E, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3850, 0, 0, + 0, 0, 0,0x3851, 0,0x384F, 0, 0, + 0,0x3852, 0, 0, 0, 0,0x3853,0x3854, + 0,0x3855, 0,0x3856, 0,0x3857, 0,0x3858, + 0, 0, 0,0x3859, 0, 0,0x385A, 0, + 0, 0,0x385B,0x385C, 0, 0, 0, 0, + 0, 0,0x385D, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x385E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x385F,0x3860, + 0, 0, 0, 0,0x3861,0x3862, 0, 0, + 0, 0, 0,0x3863,0x3864,0x3865, 0, 0, + 0, 0, 0, 0, 0, 0,0x3867, 0, + 0, 0,0x3868, 0,0x3869,0x386A, 0, 0, + 0,0x386B, 0, 0, 0, 0, 0, 0, +0x386C,0x386D, 0, 0,0x386E, 0,0x386F,0x3870, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3871, 0, 0, 0,0x3872, 0, 0,0x3873, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3874,0x3875, 0, 0, 0, + 0, 0,0x3876, 0,0x3877, 0,0x3878,0x3879, +0x387A, 0,0x387B, 0,0x387C, 0, 0, 0, + 0, 0, 0, 0,0x387D, 0,0x387E, 0, +0x3921, 0, 0,0x3922, 0, 0,0x3923,0x3924, + 0, 0,0x3925, 0,0x3926,0x3927, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3928,0x3929, 0,0x392A, + 0, 0, 0,0x392B, 0, 0,0x392C, 0, +0x392D, 0, 0, 0, 0, 0, 0, 0, +0x392E, 0, 0, 0, 0,0x392F, 0, 0, +0x3930, 0, 0, 0, 0, 0,0x3931,0x3932, +0x3933,0x3934, 0, 0,0x3935, 0, 0, 0, +0x3936, 0, 0,0x3937, 0,0x3938, 0, 0, + 0, 0,0x3939, 0,0x393A,0x393B, 0, 0, + 0,0x393C, 0,0x393D, 0, 0,0x393E, 0, + 0, 0, 0,0x393F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3940,0x3941, +0x3942, 0, 0, 0,0x3943,0x3944, 0, 0, +0x3945, 0, 0, 0, 0, 0, 0,0x3946, +0x3947, 0,0x3948,0x3949, 0,0x394A, 0, 0, +0x394B, 0, 0, 0, 0, 0, 0, 0, + 0,0x394C, 0, 0, 0,0x394D, 0, 0, + 0, 0, 0, 0, 0,0x394E,0x394F,0x3950, + 0, 0, 0,0x3951,0x3952, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3953, + 0, 0, 0, 0,0x3954,0x3955, 0, 0, +0x3956,0x3957, 0,0x3958, 0, 0,0x3959, 0, + 0,0x395A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x395B,0x395C, 0, +0x395D,0x395E, 0, 0, 0,0x395F, 0, 0, + 0,0x3960, 0, 0, 0, 0,0x3961, 0, + 0, 0, 0, 0, 0, 0, 0,0x3962, + 0, 0, 0, 0,0x3963, 0,0x3964, 0, +0x3965, 0, 0, 0, 0, 0,0x3966, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3967, 0, 0,0x3968,0x3969, 0, 0,0x396A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x396B, 0, 0, 0, + 0,0x396C, 0, 0,0x396D, 0, 0,0x396E, + 0, 0,0x396F, 0, 0,0x3970, 0,0x3971, +0x3972,0x3973, 0,0x3974, 0, 0, 0, 0, +0x3975, 0, 0, 0, 0,0x3976, 0, 0, + 0, 0,0x3977,0x3978,0x3979, 0,0x397A, 0, + 0,0x397B, 0,0x397C,0x397D, 0, 0, 0, +0x397E, 0, 0, 0, 0,0x3A21, 0,0x3A22, + 0,0x3A23, 0, 0, 0, 0, 0, 0, +0x3A24, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3A25, 0,0x3A26, 0, 0, + 0,0x3A27, 0, 0, 0, 0,0x3A28, 0, + 0, 0, 0,0x3A29, 0, 0, 0,0x3A2A, + 0, 0, 0, 0, 0, 0,0x3A2B,0x3A2C, + 0, 0, 0, 0, 0, 0,0x3A2D, 0, + 0,0x3A2E,0x3A2F, 0, 0, 0, 0, 0, + 0,0x3A30, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3A31, 0,0x3A33, 0,0x3A34, 0,0x3A35, 0, + 0, 0,0x3A36, 0, 0, 0,0x3A37, 0, + 0, 0, 0, 0, 0, 0,0x3A38, 0, + 0, 0, 0, 0, 0,0x3A32, 0, 0, + 0,0x3A39, 0, 0, 0, 0, 0, 0, + 0, 0,0x3A3A, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3A3B,0x3A3C, 0, 0, + 0, 0, 0,0x3A3D, 0, 0, 0,0x3A3E, + 0, 0, 0, 0, 0, 0, 0,0x3A3F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3A40, 0, 0, 0, 0, 0,0x3A41, +0x3A42, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3A43,0x3A44,0x3A45, +0x3A46, 0,0x3A47, 0, 0,0x3A48, 0,0x3A49, + 0, 0, 0,0x3A4A, 0, 0, 0,0x3A4B, + 0,0x3A4C,0x3A4D, 0,0x3A4E,0x3A4F, 0,0x3A50, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3A51,0x3A52, 0, 0,0x3A53,0x3A54, 0, +0x3A55, 0,0x3A56,0x3A57, 0, 0, 0, 0, +0x3A58, 0, 0,0x3A59, 0,0x3A5A, 0, 0, + 0,0x3A5B,0x3A5C, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3A5D, 0, +0x3A5E, 0, 0, 0, 0, 0, 0,0x3A5F, +0x3A60,0x3A61,0x3A62,0x3A63, 0, 0, 0, 0, + 0,0x3A64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x743A, 0, 0, +0x3A65, 0,0x3A66, 0, 0,0x3A67, 0, 0, + 0, 0, 0, 0, 0, 0,0x3A68, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3A69, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3A6A, 0, 0, 0, 0, 0, 0,0x3A6B, +0x3A6C, 0, 0, 0,0x3A6D, 0, 0,0x3A6E, + 0, 0,0x3A6F, 0,0x3A70,0x3A71, 0,0x3A72, + 0,0x3A73, 0,0x3A74, 0, 0,0x3A75,0x3A76 +}; + +/* page 16 0x5C59-0x5EEB */ +static uint16 tab_uni_jisx021216[]={ +0x3A77,0x3A78, 0,0x3A79, 0, 0, 0, 0, + 0,0x3A7A,0x3A7B, 0, 0, 0,0x3A7C,0x3A7D, +0x3A7E, 0, 0, 0,0x3B21, 0, 0,0x3B22, + 0, 0, 0,0x3B23,0x3B24, 0, 0, 0, + 0,0x3B25,0x3B26,0x3B27,0x3B28, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3B29,0x3B2A, + 0,0x3B2B, 0, 0, 0, 0,0x3B2C, 0, + 0,0x3B2D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3B2E, 0,0x3B2F,0x3B30, + 0,0x3B31,0x3B32, 0, 0,0x3B33, 0, 0, + 0,0x3B34, 0, 0, 0, 0, 0, 0, + 0,0x3B35, 0,0x3B36,0x3B37, 0, 0, 0, + 0,0x3B38, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3B39, 0,0x3B3A, 0, 0, 0, 0, 0, + 0,0x3B3B, 0, 0, 0, 0,0x3B3D, 0, + 0, 0, 0, 0,0x3B3C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3B3E, 0, 0, +0x3B3F,0x3B40, 0,0x3B41,0x743B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3B42, 0, 0, 0, 0,0x3B43, 0, 0, + 0, 0, 0, 0,0x3B44, 0, 0, 0, + 0,0x3B45, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3B47,0x3B48, 0,0x3B49,0x3B4A, 0, + 0, 0,0x3B46, 0, 0, 0, 0, 0, +0x3B4B, 0, 0,0x3B4C, 0, 0, 0, 0, +0x3B4D, 0, 0, 0,0x3B4E, 0,0x3B4F, 0, + 0,0x3B50,0x3B51, 0, 0,0x3B52, 0,0x3B53, + 0,0x3B57, 0, 0, 0, 0, 0, 0, +0x3B55, 0,0x743C, 0,0x3B54, 0, 0, 0, +0x3B56, 0, 0, 0, 0, 0,0x3B58,0x3B59, +0x3B5A,0x3B5B, 0,0x3B5C, 0, 0, 0, 0, + 0,0x3B5D, 0, 0,0x3B5E, 0, 0,0x3B5F, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3B60,0x3B61, 0, 0, 0,0x3B62,0x3B63, 0, +0x3B64, 0,0x3B65, 0, 0, 0, 0,0x3B66, + 0,0x3B67, 0, 0, 0, 0, 0, 0, + 0,0x3B68,0x3B69,0x3B6A,0x3B6B, 0, 0, 0, +0x3B6C, 0,0x3B6D, 0, 0, 0,0x3B6E,0x3B6F, + 0, 0, 0, 0, 0, 0,0x3B70, 0, + 0, 0,0x3B71, 0, 0, 0, 0,0x3B72, + 0,0x6674, 0,0x3B73, 0, 0, 0,0x3B74, +0x3B75, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3B76, 0, 0, 0,0x3B77, 0, + 0, 0,0x3B78, 0, 0,0x3B7A, 0,0x3B79, + 0, 0, 0, 0, 0, 0, 0,0x3B7B, +0x3B7C, 0, 0, 0, 0, 0, 0,0x3B7D, + 0, 0, 0,0x3B7E, 0, 0, 0, 0, +0x3C21, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C22, +0x3C23, 0, 0, 0, 0, 0, 0,0x3C24, + 0, 0, 0, 0, 0, 0,0x3C25, 0, + 0, 0, 0, 0,0x3C26, 0, 0, 0, + 0,0x3C27, 0,0x3C28,0x3C29, 0, 0,0x3C2A, + 0, 0, 0, 0, 0, 0,0x3C2B,0x3C2C, + 0, 0, 0, 0, 0, 0, 0,0x3C2E, + 0, 0, 0, 0, 0,0x3C2D, 0, 0, + 0,0x3C2F, 0, 0,0x3C30, 0, 0, 0, + 0, 0, 0, 0, 0,0x3C31, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3C34, 0,0x3C32, 0, 0, 0, 0,0x3C33, +0x3C35, 0, 0, 0, 0,0x3C36, 0,0x3C37, + 0, 0,0x3C38,0x3C39, 0,0x3C3A, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C3B, + 0,0x3C3C,0x3C3D,0x3C3E,0x3C3F,0x3C40, 0,0x3C41, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C42, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3C43, 0, 0,0x3C44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3C45, 0,0x3C46,0x3C47, 0, 0,0x3C48, + 0,0x3C49, 0,0x3C4A, 0, 0, 0, 0, +0x3C4B, 0,0x3C4C, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3C4D,0x3C4E,0x3C4F, 0, + 0, 0, 0, 0, 0,0x3C50, 0, 0, + 0, 0,0x3C52,0x3C51, 0,0x3C53, 0, 0, +0x3C54,0x3C55, 0,0x3C56,0x3C57, 0, 0, 0, + 0, 0, 0,0x3C58, 0,0x3C59, 0, 0, + 0, 0, 0, 0,0x3C5A, 0, 0, 0, + 0, 0,0x3C5B}; + +/* page 17 0x5F02-0x6149 */ +static uint16 tab_uni_jisx021217[]={ +0x3C5C, 0, 0, 0,0x3C5D,0x3C5E,0x3C5F, 0, + 0, 0, 0, 0,0x3C60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C61, + 0, 0,0x3C62,0x3C63, 0, 0, 0,0x3C64, +0x3C65,0x3C66,0x3C67, 0, 0, 0,0x3C68, 0, + 0,0x3C69,0x3C6A, 0,0x3C6B, 0,0x3C6C, 0, + 0, 0,0x3C6D, 0,0x3C6E, 0, 0, 0, + 0,0x3C6F, 0,0x3C70, 0,0x3C71,0x3C72, 0, + 0, 0,0x3C73,0x3C74, 0,0x3C75, 0, 0, + 0, 0, 0,0x3C76, 0, 0,0x3C77, 0, + 0, 0,0x3C78, 0, 0, 0,0x3C79, 0, + 0,0x3C7A, 0, 0, 0, 0,0x3C7B, 0, + 0,0x3C7C,0x3C7D, 0, 0,0x3C7E, 0, 0, + 0, 0, 0, 0, 0,0x3D21, 0, 0, +0x3D22, 0,0x3D23,0x3D24, 0, 0,0x3D25, 0, +0x3D26, 0, 0,0x3D27,0x3D28, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3D29, + 0, 0, 0,0x3D2A, 0,0x3D2B, 0, 0, + 0, 0, 0, 0,0x3D2C, 0, 0, 0, + 0, 0,0x3D2D,0x3D2E, 0, 0, 0, 0, +0x3D2F, 0,0x3D32, 0, 0,0x3D30, 0, 0, + 0,0x3D31,0x3D33, 0, 0,0x3D34,0x3D35,0x3D36, + 0, 0, 0, 0, 0,0x743E,0x3D37, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3D38, 0, 0,0x3D39,0x3D3A,0x3D3B, + 0,0x3D3C, 0, 0, 0, 0,0x3D3D,0x3D3E, +0x3D3F,0x3D40,0x3D41, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3D42, 0, 0,0x3D43, +0x3D44, 0, 0, 0, 0, 0,0x3D45,0x3D46, +0x3D47, 0,0x3D48,0x3D49,0x3D4A,0x3D4B, 0, 0, +0x3D4C,0x3D4D, 0, 0,0x3D4E, 0, 0, 0, +0x3D4F, 0,0x3D50, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3D51, 0, 0, +0x3D52, 0, 0,0x3D53, 0, 0, 0, 0, + 0,0x3D54,0x3D55, 0, 0,0x3D56,0x3D57, 0, +0x3D58, 0, 0, 0, 0,0x3D59, 0, 0, + 0, 0,0x3D5A, 0, 0, 0, 0, 0, + 0, 0, 0,0x3D5B, 0, 0, 0, 0, + 0,0x3D5C, 0,0x3D5D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3D5E, 0, + 0, 0, 0, 0, 0,0x3D5F,0x3D60,0x3D61, + 0, 0,0x3D62, 0, 0, 0, 0,0x3D63, + 0, 0,0x3D64, 0,0x3D65,0x3D66, 0, 0, + 0, 0, 0,0x3D67, 0, 0, 0,0x3D68, + 0, 0, 0, 0, 0,0x3D69, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3D6A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3D6B,0x3D6C, 0, 0, +0x3D6D, 0, 0,0x743F,0x3D6E, 0,0x3D6F, 0, +0x3D70, 0, 0, 0,0x3D71, 0, 0,0x3D72, + 0,0x3D73, 0,0x3D74, 0, 0,0x3D75, 0, + 0, 0, 0,0x3D76,0x3D77, 0, 0, 0, +0x3D78, 0,0x3D79,0x3D7A, 0, 0,0x3D7B, 0, + 0, 0, 0, 0, 0, 0,0x3D7C,0x3D7D, + 0, 0, 0, 0, 0,0x3D7E, 0, 0, + 0,0x3E21, 0, 0,0x3E22, 0, 0, 0, +0x3E23, 0,0x3E24, 0, 0, 0,0x3E25,0x3E26, +0x3E27,0x3E28, 0, 0,0x3E29,0x3E2A, 0, 0, + 0, 0,0x3E2B,0x3E2C, 0, 0, 0,0x3E2D, + 0,0x3E2E, 0,0x3E2F,0x3E30, 0, 0, 0, +0x3E31, 0, 0,0x3E32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3E33, 0, 0,0x3E34, 0, 0,0x3E35, 0, + 0, 0,0x3E36,0x3E37, 0, 0, 0, 0, +0x3E38, 0, 0, 0, 0,0x3E39, 0, 0, +0x3E3A, 0,0x3E3B, 0, 0, 0,0x3E3C,0x3E3D, +0x3E3E,0x3E3F,0x3E40, 0,0x3E41,0x3E42, 0,0x3E43, + 0, 0,0x3E44, 0,0x3E45, 0,0x7440, 0, +0x3E46, 0, 0, 0, 0, 0, 0, 0, +0x3E47,0x3E48, 0, 0, 0, 0,0x3E49,0x3E4A, + 0, 0, 0,0x3E4B,0x3E4C,0x3E4D, 0,0x3E4E, + 0, 0, 0, 0, 0, 0, 0,0x3E4F, + 0, 0, 0,0x3E50,0x3E51, 0, 0,0x3E52 +}; + +/* page 18 0x615E-0x6290 */ +static uint16 tab_uni_jisx021218[]={ +0x3E53, 0,0x3E54, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3E55, 0, + 0, 0, 0, 0,0x3E56, 0, 0, 0, + 0, 0,0x3E57, 0, 0,0x3E58,0x3E59, 0, + 0,0x3E5A,0x3E5B,0x3E5C, 0,0x3E5D,0x3E5E, 0, + 0, 0, 0, 0, 0,0x3E5F, 0,0x3E60, + 0, 0, 0, 0,0x3E61,0x3E62, 0, 0, + 0,0x3E63,0x3E64, 0, 0, 0,0x3E65,0x3E66, + 0,0x3E67,0x3E68, 0, 0, 0, 0,0x3E69, + 0, 0,0x3E6A, 0,0x3E6B, 0, 0,0x3E6C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3E6D,0x3E6E, 0, 0,0x3E6F, 0, + 0, 0,0x3E70,0x3E71,0x3E72, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3E73,0x3E74, 0, 0, 0, 0, 0,0x3E75, + 0, 0, 0, 0, 0, 0,0x3E76,0x3E77, +0x3E78,0x3E79, 0,0x3E7A,0x3E7B, 0, 0,0x3E7E, + 0,0x3E7C, 0,0x3E7D, 0, 0,0x3F21,0x3F22, + 0,0x3F23, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F24, 0,0x3F25,0x3F26, 0, + 0,0x3F27, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3F28, 0,0x3F29, + 0, 0, 0, 0, 0, 0,0x3F2A, 0, + 0, 0,0x3F2B, 0,0x3F2C,0x3F2D, 0, 0, + 0,0x3F2E, 0,0x3F2F, 0,0x3F30, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F31, 0, 0, 0,0x3F32, + 0, 0, 0, 0,0x3F33,0x3F34,0x3F35, 0, +0x3F36, 0, 0, 0, 0, 0,0x3F37, 0, + 0, 0,0x3F38,0x3F39,0x3F3A, 0,0x3F3B, 0, +0x3F3C, 0, 0, 0,0x3F3D, 0,0x3F3E, 0, + 0, 0, 0, 0, 0, 0,0x3F3F, 0, + 0, 0, 0, 0, 0, 0, 0,0x3F40, + 0,0x3F41, 0, 0, 0,0x3F42, 0, 0, + 0, 0, 0, 0,0x3F43, 0, 0,0x3F44, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3F45, +0x3F46,0x3F47,0x3F48}; + +/* page 19 0x62A6-0x679B */ +static uint16 tab_uni_jisx021219[]={ +0x3F49, 0,0x3F4A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3F4B, 0, 0, +0x3F4C,0x3F4D, 0, 0,0x3F4E, 0, 0, 0, +0x3F4F,0x3F50, 0, 0, 0, 0,0x3F51, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3F52, 0, 0, 0, 0, 0, 0,0x3F53, +0x3F54, 0, 0, 0,0x3F55, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3F56, 0, 0, 0, + 0, 0, 0, 0,0x3F57, 0,0x3F58, 0, + 0, 0, 0, 0, 0, 0,0x3F59,0x3F5A, + 0, 0, 0, 0, 0,0x3F5B,0x3F5C, 0, + 0, 0, 0, 0,0x3F5D,0x3F5E, 0,0x3F5F, + 0, 0,0x3F60, 0, 0,0x3F61, 0, 0, +0x3F62, 0,0x3F63, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F64,0x3F65, 0, 0,0x3F66, + 0, 0, 0, 0, 0, 0, 0,0x3F67, +0x3F68, 0, 0,0x3F69, 0, 0,0x3F6A, 0, + 0, 0, 0,0x3F6B,0x3F6C,0x3F6D,0x3F6E, 0, +0x3F6F, 0, 0, 0,0x3F70,0x3F71, 0, 0, +0x3F72, 0, 0, 0,0x3F73,0x3F74,0x3F75, 0, + 0, 0,0x3F76, 0, 0,0x3F77, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3F78, +0x3F79, 0, 0, 0, 0, 0,0x3F7A,0x3F7B, + 0, 0, 0,0x3F7C, 0, 0,0x3F7D,0x3F7E, + 0, 0,0x4021, 0, 0, 0,0x4022,0x4023, + 0,0x4024, 0, 0,0x4025, 0,0x4026, 0, + 0,0x4027, 0, 0,0x4028, 0, 0, 0, + 0, 0,0x4029, 0, 0, 0,0x402A,0x402B, + 0, 0, 0,0x402C,0x402D, 0, 0, 0, +0x402E, 0, 0, 0, 0, 0,0x402F, 0, +0x4030, 0, 0, 0, 0, 0, 0,0x4031, +0x4032,0x4033, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4034, + 0, 0, 0,0x4035, 0, 0, 0,0x4036, + 0, 0,0x4037, 0, 0, 0, 0, 0, +0x4038, 0, 0,0x4039, 0,0x403A,0x403B,0x403C, + 0, 0, 0, 0, 0, 0,0x403D, 0, + 0, 0,0x403E, 0, 0, 0, 0,0x403F, + 0, 0, 0, 0,0x4040, 0,0x4041, 0, + 0, 0, 0, 0,0x4042,0x4043, 0,0x4044, + 0, 0,0x4045,0x4046, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4047,0x4048, 0, 0, 0, + 0, 0,0x4049, 0,0x404A, 0,0x404B, 0, + 0, 0,0x404C, 0, 0, 0, 0, 0, +0x404D, 0,0x404E, 0,0x404F, 0,0x4050,0x4051, + 0, 0, 0,0x4052,0x4053, 0, 0, 0, + 0,0x4054,0x4055, 0, 0, 0, 0,0x4056, + 0, 0, 0, 0, 0, 0, 0,0x4057, + 0,0x4058, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4059, 0, 0, + 0,0x405A, 0,0x405B,0x405C,0x405D,0x405E, 0, + 0, 0, 0, 0,0x405F,0x4060,0x4061,0x4062, + 0,0x4063,0x4064,0x4065, 0,0x4066, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4067, + 0, 0, 0, 0, 0,0x4068,0x4069, 0, + 0, 0, 0, 0, 0,0x406A, 0,0x406B, + 0, 0, 0, 0, 0, 0, 0,0x406C, + 0,0x406D, 0, 0, 0, 0, 0, 0, + 0,0x406E,0x406F,0x4070, 0, 0, 0, 0, + 0, 0,0x4071,0x4072, 0,0x4073, 0,0x4074, + 0,0x4075, 0,0x4076, 0,0x4077, 0, 0, +0x4078, 0,0x4079, 0, 0, 0,0x407A, 0, + 0, 0, 0, 0, 0,0x407B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x407C, +0x407D,0x407E, 0, 0, 0, 0,0x4121, 0, + 0, 0, 0,0x4122,0x4123,0x4124,0x4125, 0, +0x4126, 0,0x4127,0x4128, 0, 0, 0,0x4129, + 0,0x412A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x412B,0x412C, + 0, 0, 0,0x412D,0x412E, 0, 0,0x412F, + 0, 0,0x4130, 0, 0, 0, 0,0x4131, + 0,0x4132, 0, 0, 0,0x4133, 0, 0, + 0,0x4134, 0,0x4135, 0, 0,0x4136, 0, + 0, 0,0x4137,0x4138,0x4139, 0, 0, 0, + 0,0x413A, 0, 0, 0,0x413B,0x413C, 0, +0x413D, 0, 0,0x413E, 0,0x413F, 0, 0, +0x4140,0x4141, 0, 0,0x4142, 0, 0, 0, +0x4143, 0, 0,0x4144, 0, 0, 0, 0, +0x4145, 0, 0,0x4146, 0, 0, 0, 0, + 0, 0, 0, 0,0x4147, 0,0x4148,0x4149, + 0, 0, 0, 0, 0,0x414A, 0, 0, + 0,0x414B, 0,0x414C, 0, 0, 0, 0, +0x7441, 0,0x414D, 0,0x414E, 0,0x414F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4150,0x4151, 0, 0, 0, 0, 0, + 0,0x4152, 0, 0, 0,0x4153, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4154, 0, 0,0x4155, + 0, 0, 0,0x4156, 0, 0, 0,0x4157, + 0, 0, 0, 0,0x4158, 0, 0, 0, + 0, 0, 0, 0,0x4159, 0, 0,0x415A, + 0, 0,0x415B, 0, 0, 0, 0,0x415C, + 0, 0,0x415D, 0, 0,0x415E, 0, 0, +0x415F, 0, 0, 0, 0, 0, 0, 0, +0x4160, 0, 0, 0,0x4161,0x4162,0x4163, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4164, 0, 0,0x4165, 0, 0, 0, + 0, 0,0x4166,0x4167, 0, 0, 0, 0, +0x4168, 0,0x4169, 0, 0, 0,0x416A, 0, +0x416B, 0,0x416C, 0, 0, 0, 0, 0, + 0,0x416D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x416E, 0,0x416F, 0,0x4170,0x4171, + 0, 0, 0,0x4172, 0, 0, 0, 0, +0x4173,0x4174,0x4175, 0, 0, 0,0x4176, 0, + 0, 0,0x4177,0x4178, 0, 0, 0,0x4179, + 0, 0, 0,0x417A,0x417B, 0, 0,0x417C, +0x417D, 0, 0, 0, 0, 0, 0,0x417E, +0x4221, 0, 0,0x4222,0x4223,0x4224,0x4225, 0, +0x4226, 0, 0,0x4227,0x4228,0x4229,0x422A, 0, +0x422B, 0,0x422C,0x422D, 0,0x422E, 0, 0, + 0,0x4230, 0,0x422F, 0,0x7442, 0, 0, + 0, 0,0x4231, 0, 0, 0, 0,0x4232, +0x4233, 0, 0, 0,0x4234, 0,0x4235, 0, +0x4237, 0, 0,0x4236, 0, 0, 0, 0, + 0,0x4238,0x4239,0x423A, 0,0x423B,0x423C, 0, + 0, 0,0x423D,0x423E, 0, 0, 0,0x7443, + 0, 0, 0, 0,0x4240,0x4241,0x4242, 0, + 0, 0, 0, 0, 0,0x4244, 0,0x4245, + 0,0x4247,0x4248,0x4249, 0,0x424A,0x424C, 0, +0x4243,0x4246,0x424B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x424D,0x424E,0x424F, + 0, 0,0x4250, 0,0x4251, 0, 0, 0, + 0, 0, 0,0x4252,0x4253,0x4254,0x4255, 0, + 0,0x4256,0x4257, 0, 0, 0,0x4258, 0, + 0, 0, 0, 0, 0, 0, 0,0x4259, + 0, 0, 0,0x425A,0x425B, 0, 0,0x425C, + 0, 0, 0, 0, 0,0x425D, 0, 0, + 0,0x425E,0x425F, 0,0x4260,0x4261, 0, 0, + 0, 0,0x4262, 0, 0, 0,0x4263, 0, +0x4264,0x4265, 0, 0, 0, 0,0x4266, 0, + 0, 0, 0, 0, 0,0x4267, 0, 0, + 0,0x4268, 0, 0, 0, 0, 0, 0, + 0, 0,0x4269, 0, 0,0x426A,0x426B, 0, +0x426C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x426D,0x423F, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x426E, + 0,0x426F, 0, 0, 0, 0, 0, 0, +0x4270, 0, 0, 0, 0,0x4271, 0, 0, + 0, 0, 0,0x4272, 0, 0,0x4273, 0, + 0, 0,0x4274, 0,0x4275, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4276, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4277, 0, 0, 0, 0, 0, 0,0x4278, + 0,0x4279,0x427A, 0, 0, 0,0x427B, 0, + 0, 0, 0, 0, 0, 0,0x427C,0x427D, + 0, 0, 0, 0, 0, 0, 0,0x427E, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4321, 0, 0, 0, 0, 0,0x4322, 0, +0x4323, 0, 0, 0, 0, 0,0x4324, 0, +0x4325, 0, 0, 0, 0,0x4326, 0, 0, + 0, 0, 0,0x4327, 0, 0,0x4328, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4329,0x432A, 0,0x432B, 0,0x432C, 0, 0, +0x432D, 0,0x432E,0x432F, 0,0x4330}; + +/* page 20 0x67B0-0x6801 */ +static uint16 tab_uni_jisx021220[]={ +0x4331,0x4332,0x4333, 0, 0,0x4334, 0, 0, + 0, 0, 0,0x4335,0x4336,0x4337, 0, 0, +0x4339, 0,0x433A,0x433B, 0,0x433C, 0, 0, +0x433D,0x433E, 0, 0, 0, 0, 0, 0, + 0, 0,0x433F, 0, 0, 0, 0,0x4340, + 0,0x4341, 0, 0,0x4342, 0, 0, 0, + 0,0x4343, 0, 0, 0, 0,0x4344, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4345, 0,0x4346, 0, 0, 0,0x4347,0x4348, + 0,0x4338, 0, 0, 0, 0, 0, 0, + 0,0x7446}; + +/* page 21 0x6814-0x6917 */ +static uint16 tab_uni_jisx021221[]={ +0x434A, 0, 0, 0, 0,0x434B, 0, 0, + 0,0x434C, 0,0x434D, 0, 0, 0, 0, + 0, 0, 0,0x434F,0x434E, 0, 0, 0, +0x4350,0x4351, 0,0x4352,0x4353,0x4354, 0,0x4355, + 0, 0, 0, 0, 0, 0, 0,0x4356, + 0, 0, 0,0x4357, 0, 0, 0, 0, +0x4358,0x4359, 0, 0, 0, 0,0x435A, 0, +0x435B, 0, 0, 0, 0, 0,0x4349, 0, + 0,0x435C, 0,0x435D,0x435E, 0, 0,0x435F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4360, + 0, 0,0x4361,0x4362,0x4363,0x4364,0x4365, 0, + 0,0x4366, 0, 0, 0,0x4367,0x4368,0x4369, +0x436A, 0, 0, 0, 0, 0,0x436B, 0, +0x436C, 0,0x436D, 0,0x436E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x436F, 0,0x4370, 0,0x4371, 0, +0x4372, 0, 0, 0, 0,0x4373, 0,0x4374, + 0,0x4375, 0, 0, 0,0x4376,0x4377, 0, + 0, 0,0x4378, 0, 0, 0,0x4379, 0, + 0, 0, 0, 0, 0, 0, 0,0x437A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x437B, 0, 0,0x437C, 0, 0, 0, +0x437D, 0, 0,0x437E,0x4421,0x4422, 0,0x4423, + 0, 0,0x4424, 0, 0,0x4425, 0, 0, +0x4426,0x4427, 0, 0, 0, 0, 0, 0, + 0,0x4428, 0, 0,0x4429, 0,0x442A,0x442B, +0x442C,0x442D, 0, 0,0x442E,0x442F, 0, 0, + 0,0x4430,0x4431, 0, 0, 0, 0,0x4432, +0x4433,0x4434, 0, 0, 0, 0, 0, 0, + 0, 0,0x4435, 0, 0,0x4436,0x4437, 0, + 0, 0, 0, 0,0x4438,0x4439, 0,0x443A, + 0, 0,0x443B,0x443C}; + +/* page 22 0x6931-0x6D3F */ +static uint16 tab_uni_jisx021222[]={ +0x443D, 0,0x443E, 0,0x443F, 0, 0,0x4440, + 0, 0,0x4441, 0, 0, 0, 0, 0, + 0,0x4442, 0, 0,0x4443, 0, 0, 0, +0x4444, 0, 0, 0, 0,0x4445, 0, 0, + 0, 0, 0, 0, 0, 0,0x4446, 0, + 0, 0,0x4447, 0, 0, 0, 0, 0, + 0, 0,0x4448,0x4449,0x444A,0x444B, 0,0x444C, +0x444D, 0, 0,0x444E, 0, 0, 0,0x444F, +0x4450,0x4451, 0, 0, 0, 0, 0, 0, + 0,0x4452,0x4453, 0, 0, 0,0x4454,0x4455, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4456, 0, 0, 0, + 0,0x4457, 0, 0, 0,0x4458, 0,0x4459, + 0, 0, 0, 0, 0, 0, 0, 0, +0x445A, 0, 0, 0,0x445B,0x445C, 0,0x445D, + 0, 0,0x445E, 0,0x445F, 0,0x4460, 0, + 0, 0, 0, 0, 0, 0,0x4461,0x4462, + 0,0x4463, 0,0x4464, 0, 0, 0, 0, + 0, 0, 0, 0,0x4465, 0, 0,0x4466, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4467, 0, 0, 0, 0,0x4468,0x4469, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x446A, 0, 0,0x446B, 0, 0, 0, + 0, 0, 0, 0, 0,0x446C,0x446D, 0, +0x446E, 0,0x446F, 0,0x4470, 0, 0, 0, + 0, 0, 0, 0, 0,0x4471, 0,0x4472, +0x4473, 0,0x4474, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4475, 0, +0x4476, 0, 0, 0,0x4477, 0, 0, 0, + 0,0x4478, 0, 0,0x4479, 0, 0,0x447A, + 0, 0, 0,0x447B, 0, 0, 0,0x447C, + 0, 0, 0, 0, 0, 0, 0,0x447D, + 0,0x447E, 0,0x4521, 0, 0,0x4522, 0, + 0, 0,0x4523, 0, 0,0x4524,0x4525, 0, + 0, 0, 0, 0,0x4526,0x4527, 0, 0, +0x4528,0x4529, 0, 0, 0,0x452A, 0,0x452B, +0x452C,0x452D, 0, 0,0x452E,0x452F, 0, 0, + 0, 0,0x4530, 0, 0, 0, 0, 0, + 0, 0, 0,0x4531, 0, 0,0x4532, 0, + 0,0x4533,0x7449, 0, 0, 0, 0, 0, +0x4534, 0,0x4535, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4536, 0, 0, +0x4537, 0,0x4538, 0, 0,0x4539,0x453A, 0, +0x453B, 0,0x453C, 0, 0, 0, 0, 0, +0x453D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x453E, 0,0x453F,0x4540,0x4541, 0, + 0, 0, 0, 0,0x4542, 0, 0, 0, + 0, 0,0x4543, 0, 0, 0,0x4544,0x4545, +0x4546, 0, 0,0x4547, 0, 0, 0, 0, + 0, 0, 0, 0,0x4548,0x4549,0x454A, 0, + 0, 0, 0, 0, 0,0x454B, 0,0x454D, +0x454C, 0, 0,0x454E, 0, 0, 0,0x454F, + 0, 0, 0,0x4550,0x4551,0x4552, 0, 0, + 0, 0, 0,0x4553,0x4554, 0, 0, 0, + 0,0x744A, 0,0x4555, 0, 0,0x4556, 0, + 0, 0, 0,0x4557, 0, 0, 0,0x4558, +0x4559,0x455A, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x455B,0x455C, 0, 0, 0, + 0,0x455D,0x455E, 0, 0,0x455F,0x4560, 0, +0x4561, 0, 0, 0, 0, 0,0x4562,0x4563, +0x4564, 0, 0, 0, 0, 0,0x4565, 0, + 0, 0,0x4566, 0, 0,0x4567, 0, 0, + 0, 0, 0,0x4568, 0, 0, 0,0x4569, + 0, 0,0x456A,0x456B, 0, 0,0x456C, 0, + 0, 0, 0, 0,0x456D,0x456E, 0, 0, + 0, 0,0x456F, 0, 0, 0,0x4570, 0, + 0, 0, 0, 0, 0,0x4571, 0, 0, + 0,0x4572, 0, 0,0x4573, 0, 0, 0, + 0,0x4574, 0, 0, 0,0x4575, 0,0x4576, + 0, 0, 0, 0,0x4577, 0, 0,0x4578, + 0, 0, 0, 0, 0, 0,0x4579, 0, + 0, 0,0x457A, 0, 0,0x457B, 0,0x457C, + 0, 0, 0, 0,0x457D, 0, 0, 0, + 0, 0, 0, 0,0x457E,0x4621, 0, 0, + 0,0x4622, 0, 0,0x4623, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4624, 0, + 0, 0,0x4625, 0, 0, 0,0x4626,0x4627, + 0,0x4628,0x4629, 0, 0, 0, 0,0x462A, +0x462B, 0, 0,0x462C,0x462D,0x462E, 0,0x462F, + 0, 0, 0, 0, 0, 0, 0,0x4630, +0x4631, 0, 0, 0,0x4632,0x4633, 0, 0, + 0, 0,0x4634,0x4635, 0, 0, 0, 0, +0x4636, 0, 0,0x4637, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4638, 0, 0, + 0,0x4639, 0, 0, 0, 0, 0, 0, +0x463A, 0,0x463B, 0, 0,0x463C,0x463D, 0, + 0, 0, 0, 0, 0,0x463E, 0, 0, +0x463F, 0, 0, 0, 0, 0,0x4640, 0, +0x4641, 0, 0, 0, 0, 0,0x4642, 0, + 0,0x4643, 0,0x4644,0x4645, 0, 0, 0, +0x4646, 0, 0, 0,0x4647,0x4648, 0,0x4649, + 0,0x464A, 0, 0, 0, 0, 0, 0, +0x464B, 0, 0, 0, 0, 0,0x464C, 0, + 0, 0, 0, 0, 0,0x464D,0x464E,0x464F, + 0, 0, 0,0x4650, 0,0x4651, 0, 0, + 0, 0,0x4652, 0,0x4653,0x4654, 0, 0, + 0,0x4655,0x4656, 0, 0, 0,0x4657, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4658,0x4659, 0,0x465A, 0,0x465B, 0, + 0,0x465C, 0,0x465D, 0, 0, 0, 0, +0x465E, 0,0x465F,0x4660, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4736, 0, + 0, 0,0x4661, 0,0x4662, 0,0x4663, 0, + 0, 0, 0,0x4664, 0,0x4665, 0,0x4666, +0x4667, 0,0x4668, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4669,0x466A,0x466B, 0, +0x466C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x466D,0x466E, 0,0x466F,0x4670, + 0, 0, 0,0x4671, 0, 0,0x4672, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4673, + 0,0x4674, 0,0x4675, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4676, 0, 0, 0,0x4677, 0, 0, + 0, 0, 0, 0,0x4678, 0,0x4679,0x467A, +0x467B,0x467C, 0,0x467D, 0,0x467E, 0, 0, + 0,0x4721, 0,0x4722, 0, 0, 0,0x4723, + 0, 0, 0, 0, 0, 0,0x4724, 0, +0x4725, 0,0x4726,0x4727, 0,0x4728, 0, 0, + 0,0x4729, 0,0x472A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x472B, 0, 0,0x472C, 0, + 0,0x472D, 0, 0, 0,0x472E,0x472F, 0, +0x4730, 0,0x4731, 0, 0, 0, 0, 0, + 0,0x4732, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4733,0x4734,0x4735, + 0, 0, 0, 0, 0,0x4737,0x4738, 0, +0x4739, 0, 0, 0, 0, 0, 0, 0, +0x473A, 0, 0,0x473B, 0, 0,0x473C}; + +/* page 23 0x6D57-0x6E04 */ +static uint16 tab_uni_jisx021223[]={ +0x473D, 0, 0, 0, 0, 0, 0,0x473E, +0x473F, 0,0x4740, 0, 0, 0,0x4741, 0, +0x4742, 0, 0, 0, 0, 0, 0, 0, +0x4743,0x4744, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4745, 0, 0, + 0, 0, 0,0x4746, 0, 0, 0, 0, +0x4747, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4748,0x4749, 0,0x474A, 0,0x474B, +0x474C,0x474D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x474E, 0,0x474F, 0, 0, + 0, 0, 0, 0, 0,0x4750, 0, 0, +0x4751, 0,0x4752, 0, 0, 0,0x4753, 0, +0x4754, 0, 0, 0, 0,0x4755, 0, 0, + 0,0x4756, 0,0x4757, 0, 0, 0,0x4758, +0x4759, 0, 0, 0, 0, 0, 0,0x475A, + 0, 0, 0, 0,0x475B, 0,0x475C, 0, +0x475D,0x475E, 0,0x475F, 0, 0,0x4760, 0, + 0, 0,0x4761, 0, 0, 0, 0, 0, +0x4762,0x4763, 0,0x744C, 0,0x4764, 0,0x4765, + 0,0x744B, 0, 0, 0,0x4766, 0, 0, + 0,0x4767, 0, 0, 0,0x4768}; + +/* page 24 0x6E1E-0x6ECF */ +static uint16 tab_uni_jisx021224[]={ +0x4769, 0, 0, 0,0x476A, 0, 0, 0, + 0,0x476B, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x476C, 0, 0, 0, +0x476D, 0, 0,0x476E, 0,0x476F,0x4770, 0, + 0, 0, 0, 0, 0, 0,0x4771,0x4772, + 0, 0,0x4773,0x4774, 0,0x4775, 0, 0, + 0,0x4776, 0,0x4777,0x4778,0x4779,0x477A, 0, + 0,0x477B, 0, 0, 0, 0,0x477C,0x477D, +0x477E, 0, 0, 0,0x4821,0x4822, 0, 0, + 0, 0,0x4823, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4824, 0, 0, + 0, 0, 0, 0, 0,0x4825, 0,0x4826, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4827, + 0, 0, 0, 0, 0,0x4828, 0, 0, + 0, 0, 0,0x4829, 0, 0, 0, 0, + 0, 0,0x482A, 0, 0, 0, 0, 0, + 0,0x482B, 0, 0, 0, 0, 0,0x482C, +0x482D, 0, 0,0x482E, 0,0x482F, 0, 0, + 0, 0, 0, 0, 0,0x4830, 0, 0, + 0,0x4831,0x4832,0x4833, 0,0x4834, 0, 0, + 0,0x4835,0x4836, 0,0x4837, 0, 0,0x4838, +0x4839,0x483A}; + +/* page 25 0x6EEB-0x70E4 */ +static uint16 tab_uni_jisx021225[]={ +0x483B, 0,0x483C,0x483D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x483E, 0, +0x483F, 0,0x4840, 0, 0, 0, 0, 0, + 0,0x4841, 0, 0, 0,0x4842, 0,0x4843, + 0,0x4844,0x4845, 0, 0, 0, 0, 0, + 0, 0, 0,0x4846, 0,0x4847, 0,0x4848, +0x4849, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x484A, 0, 0,0x484B,0x484C, + 0, 0,0x4853, 0,0x484D,0x484E, 0, 0, +0x484F, 0, 0,0x4850, 0, 0, 0, 0, +0x4851,0x4852, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4854, 0,0x4855,0x4856, +0x4857, 0, 0, 0,0x4858, 0,0x4859,0x485A, + 0, 0,0x485B,0x485C, 0, 0,0x485D,0x485E, + 0, 0, 0, 0, 0,0x485F, 0, 0, + 0,0x4860, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4861,0x4862, 0, 0, 0, 0, +0x4863, 0, 0, 0,0x4864,0x4865, 0, 0, +0x4866,0x4867,0x4868, 0, 0,0x4869, 0,0x486A, +0x486B,0x486C, 0,0x486D, 0, 0, 0,0x486E, + 0, 0, 0, 0,0x486F,0x4870, 0, 0, + 0, 0,0x4871,0x4872,0x4873,0x4874, 0, 0, + 0, 0, 0,0x4875,0x4876,0x4877, 0, 0, + 0, 0,0x4878,0x4879, 0, 0, 0, 0, + 0,0x487A, 0, 0, 0, 0, 0, 0, + 0, 0,0x487B, 0,0x487C,0x487D, 0,0x487E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4921, + 0, 0, 0,0x4922, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4923,0x4924, 0, + 0, 0, 0, 0, 0,0x4925, 0, 0, + 0, 0,0x4926, 0, 0, 0,0x4927, 0, + 0,0x4928,0x4929, 0, 0,0x492A, 0, 0, + 0, 0,0x492B,0x492C,0x492D, 0, 0, 0, + 0, 0,0x492E, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x492F, 0, 0, 0, + 0, 0, 0, 0, 0,0x4930, 0, 0, +0x4931, 0, 0, 0, 0,0x744D, 0, 0, + 0, 0, 0, 0,0x4932, 0, 0, 0, + 0,0x4933, 0, 0,0x4934, 0,0x4935, 0, + 0,0x4936, 0, 0, 0, 0, 0, 0, +0x4937,0x4938, 0, 0, 0,0x4939,0x493A,0x493B, +0x493C, 0, 0,0x4941, 0, 0, 0, 0, + 0,0x493D,0x493E, 0, 0, 0, 0, 0, + 0, 0,0x493F,0x4940, 0, 0, 0, 0, + 0,0x4942,0x4943, 0, 0, 0, 0, 0, + 0,0x4944, 0,0x4945, 0, 0, 0, 0, + 0, 0,0x4946,0x4947, 0, 0, 0, 0, + 0, 0, 0,0x4948, 0, 0,0x4949, 0, + 0, 0,0x494A,0x494B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x494C,0x494D,0x494E,0x494F,0x4950, 0, 0, +0x4951, 0, 0, 0, 0, 0, 0, 0, + 0,0x4952, 0, 0, 0, 0, 0, 0, +0x4953, 0, 0, 0, 0,0x4954,0x4955, 0, + 0,0x4956, 0, 0,0x4957, 0, 0, 0, +0x742E, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4958, + 0, 0, 0, 0, 0, 0,0x4959, 0, +0x495A,0x495B,0x495C,0x495D, 0,0x495E, 0, 0, + 0,0x495F, 0, 0, 0, 0, 0, 0, + 0,0x4960}; + +/* page 26 0x70FA-0x71DC */ +static uint16 tab_uni_jisx021226[]={ +0x4961, 0, 0, 0, 0, 0, 0, 0, + 0,0x4962,0x4963,0x4964,0x4965,0x4966, 0, 0, + 0,0x4967,0x4968, 0, 0,0x4969, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x496A, 0,0x496B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x496C, 0,0x496D, 0,0x496E,0x496F,0x4970, + 0, 0, 0, 0, 0, 0,0x4971, 0, + 0, 0, 0, 0, 0, 0, 0,0x4972, + 0, 0, 0,0x4973,0x4974,0x4975, 0, 0, +0x4976,0x4977, 0, 0, 0, 0,0x4978, 0, +0x4979, 0, 0, 0, 0,0x497A, 0, 0, +0x497B, 0,0x497C, 0,0x497D, 0,0x497E, 0, + 0, 0, 0, 0, 0, 0,0x4A21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4A22, + 0, 0, 0, 0, 0, 0,0x4A23, 0, + 0, 0, 0,0x4A24, 0,0x4A25, 0, 0, + 0, 0,0x4A26, 0, 0, 0, 0, 0, +0x4A27, 0, 0, 0, 0, 0, 0, 0, +0x4A28,0x4A29, 0, 0, 0, 0,0x4A2A, 0, +0x4A2B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4A2C,0x4A2D, 0, +0x4A2E,0x4A2F, 0, 0, 0, 0, 0, 0, +0x4A30, 0, 0, 0, 0,0x4A31,0x4A32,0x4A33, + 0, 0,0x4A34, 0, 0, 0, 0, 0, + 0,0x4A35,0x4A36, 0, 0, 0, 0, 0, + 0,0x4A37, 0, 0,0x4A38, 0, 0,0x4A39, +0x4A3A, 0,0x4A3B}; + +/* page 27 0x71F8-0x7E9E */ +static uint16 tab_uni_jisx021227[]={ +0x4A3C, 0, 0, 0, 0, 0,0x4A3D, 0, +0x4A3E, 0, 0, 0, 0, 0, 0,0x4A3F, +0x4A40,0x4A41, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4A42, 0, 0, 0,0x4A43, + 0, 0,0x4A44, 0, 0,0x4A45, 0,0x4A46, + 0, 0, 0, 0,0x4A47, 0, 0, 0, + 0, 0, 0,0x4A48, 0, 0, 0,0x4A49, + 0, 0, 0, 0,0x4A4A, 0, 0, 0, +0x4A4B,0x4A4C, 0, 0, 0, 0, 0, 0, + 0,0x4A4D,0x4A4E,0x4A4F, 0,0x4A50, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A51,0x4A52, +0x4A53, 0, 0,0x4A54, 0,0x4A55,0x4A56, 0, + 0, 0,0x4A57, 0,0x4A58, 0,0x4A59, 0, +0x4A5A, 0, 0,0x4A5B, 0, 0, 0, 0, +0x4A5C, 0, 0,0x4A5D, 0, 0,0x4A5E,0x4A5F, + 0,0x4A60, 0, 0, 0, 0, 0,0x4A61, +0x4A62, 0, 0,0x4A63,0x4A64, 0, 0,0x4A65, + 0, 0, 0, 0,0x4A66, 0, 0, 0, + 0,0x4A67, 0, 0, 0,0x4A68,0x4A69, 0, + 0, 0, 0,0x4A6A, 0, 0, 0, 0, + 0, 0, 0,0x4A6B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4A6C, 0, 0, 0, 0,0x4A6D,0x4A6E, 0, + 0,0x4A6F, 0, 0,0x4A70, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A71, 0, + 0,0x4A72, 0, 0, 0, 0, 0,0x4A73, + 0,0x4A74, 0, 0,0x4A75, 0, 0, 0, + 0, 0, 0, 0, 0,0x4A76,0x4A77, 0, +0x4A78, 0, 0, 0, 0, 0, 0,0x4A79, + 0, 0, 0, 0, 0,0x4A7A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4A7B,0x4A7C, 0, 0, 0, + 0, 0,0x4A7D,0x4A7E, 0, 0,0x4B21, 0, + 0, 0,0x4B22, 0,0x4B23,0x4B24, 0,0x4B25, + 0, 0, 0,0x4B26, 0,0x4B27, 0, 0, + 0, 0,0x4B28,0x4B29, 0, 0, 0, 0, +0x4B2A,0x4B2B, 0, 0, 0, 0,0x4B2C, 0, + 0, 0,0x4B2D, 0,0x4B2E, 0, 0,0x4B2F, +0x4B30, 0, 0, 0,0x4B31, 0, 0, 0, + 0,0x4B32,0x4B33, 0, 0,0x4B34, 0, 0, + 0, 0,0x4B35,0x4B36, 0,0x4B37, 0, 0, + 0, 0, 0,0x4B38, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4B39, 0, 0, +0x4B3A, 0,0x4B3B, 0, 0, 0,0x4B3C, 0, +0x4B3D, 0, 0, 0, 0,0x4B3E,0x4B3F,0x4B40, +0x4B41, 0, 0, 0, 0, 0,0x4B42,0x4B43, + 0,0x4B44, 0,0x4B45,0x4B46, 0,0x4B47,0x4B48, + 0,0x4B49, 0, 0, 0, 0, 0,0x4B4A, + 0,0x4B4B, 0, 0,0x4B4C, 0, 0, 0, +0x4B4D,0x4B4E, 0,0x4B4F, 0,0x4B50,0x4B51, 0, + 0, 0, 0, 0, 0, 0,0x4B52, 0, +0x4B53, 0, 0,0x4B54, 0,0x4B55, 0,0x4B56, +0x4B57, 0, 0, 0,0x4B58, 0,0x4B59,0x4B5A, +0x4B5B, 0,0x4B5C, 0, 0,0x4B5D,0x4B5E, 0, + 0, 0,0x4B5F,0x4B60, 0,0x4B61, 0, 0, + 0, 0, 0, 0, 0,0x4B62, 0,0x4B63, + 0,0x4B64, 0, 0,0x4B65,0x4B66, 0,0x4B67, + 0, 0, 0, 0, 0,0x4B68,0x4B69, 0, + 0,0x4B6A, 0,0x4B6B,0x4B6C, 0, 0,0x4B6D, + 0, 0,0x4B6E,0x4B6F, 0, 0,0x4B70, 0, + 0,0x4B71, 0, 0, 0,0x4B72, 0, 0, + 0,0x4B73, 0,0x4B74, 0, 0,0x4B75,0x4B76, + 0,0x4B77, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4B78,0x4B79, 0,0x4B7A, + 0,0x4B7B,0x4B7C,0x4B7D, 0,0x4B7E, 0,0x4C21, +0x4C22,0x4C23, 0, 0,0x4C24, 0, 0,0x4C25, + 0, 0,0x4C26, 0, 0, 0, 0, 0, + 0,0x4C27, 0, 0, 0, 0, 0, 0, + 0, 0,0x4C28,0x4C29, 0, 0, 0, 0, + 0, 0, 0, 0,0x4C2A, 0,0x4C2B, 0, +0x4C2C,0x4C2D,0x4C2E,0x4C2F,0x4C30,0x4C31,0x4C32,0x4C33, +0x4C34,0x4C35, 0, 0, 0, 0, 0, 0, + 0,0x4C36, 0, 0, 0, 0, 0, 0, +0x4C37, 0, 0,0x4C38,0x4C39, 0,0x4C3A,0x4C3B, + 0, 0, 0,0x4C3C, 0,0x4C3D, 0, 0, + 0,0x4C3E,0x4C3F, 0, 0, 0, 0,0x4C40, + 0, 0, 0, 0, 0,0x4C41, 0, 0, + 0, 0,0x4C42, 0, 0, 0,0x4C43,0x4C44, +0x4C45, 0, 0,0x4C46, 0,0x4C47,0x4C48, 0, + 0,0x4C49,0x4C4A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4C4B,0x4C4C, 0, 0, 0,0x4C4D,0x4C4E,0x4C4F, + 0,0x4C50, 0, 0, 0, 0, 0,0x4C51, +0x4C52,0x4C53,0x4C54, 0, 0, 0, 0, 0, +0x4C55,0x4C56,0x4C57, 0,0x4C58, 0, 0,0x4C59, +0x4C5A,0x4C5B, 0,0x4C5C, 0, 0,0x4C5D, 0, +0x4C5E,0x4C5F,0x4C60,0x4C61, 0, 0,0x4C62,0x4C63, + 0,0x4C64,0x4C65, 0, 0,0x4C66, 0, 0, + 0,0x4C67, 0,0x4C68, 0, 0, 0,0x4C69, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4C6A,0x4C6B, 0, 0,0x4C6C, 0, 0, 0, +0x4C6D, 0, 0,0x4C6E, 0, 0, 0, 0, +0x4C6F, 0,0x4C70,0x4C71, 0, 0,0x4C72,0x4C73, + 0, 0, 0, 0,0x4C74, 0, 0, 0, +0x4C75, 0,0x4C76,0x4C77, 0, 0, 0,0x4C78, + 0, 0, 0, 0,0x4C79, 0, 0, 0, + 0, 0,0x4C7A,0x4C7B,0x4C7C, 0, 0,0x4C7D, + 0,0x7450, 0, 0, 0, 0,0x4C7E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D21, 0, 0, 0,0x4D22,0x4D23, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4D24,0x4D25, 0, 0,0x4D26, 0, 0,0x4D27, + 0,0x4D28,0x4D29, 0, 0, 0, 0,0x4D2A, + 0, 0, 0, 0, 0, 0,0x4D2B, 0, + 0,0x4D2C, 0, 0, 0,0x4D2D,0x4D2E,0x4D2F, +0x4D30, 0, 0,0x4D31, 0, 0, 0,0x4D32, +0x4D33, 0, 0, 0, 0, 0,0x4D34, 0, +0x4D35, 0,0x4D36, 0, 0, 0, 0,0x4D37, + 0, 0, 0, 0, 0, 0,0x4D38,0x4D39, + 0,0x4D3A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4D3B, + 0,0x4D3C, 0, 0, 0, 0, 0, 0, + 0,0x4D3D,0x4D3E,0x4D3F,0x4D40,0x4D41,0x4D42, 0, + 0,0x4D43, 0, 0, 0,0x4D44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4D45, 0,0x4D46,0x4D47, 0,0x4D48, 0, 0, + 0,0x4D49, 0, 0,0x4D4A, 0, 0, 0, + 0, 0,0x4D4B, 0,0x4D4C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4D4D, 0, 0, 0, + 0, 0,0x4D4E, 0, 0, 0, 0,0x4D4F, +0x4D50,0x4D51, 0, 0,0x4D52, 0,0x4D53, 0, + 0, 0, 0, 0,0x4D54, 0,0x4D55,0x4D56, + 0, 0, 0, 0, 0, 0, 0,0x4D57, + 0, 0, 0, 0,0x4D58, 0, 0,0x4D59, +0x4D5A,0x4D5B, 0, 0,0x4D5C, 0, 0,0x4D5D, + 0, 0, 0, 0,0x4D5E, 0,0x4D5F,0x4D60, + 0,0x4D61, 0, 0, 0, 0, 0, 0, + 0,0x4D62, 0, 0, 0, 0, 0, 0, +0x4D63, 0,0x4D64,0x4D65,0x4D66, 0, 0,0x4D67, +0x4D68, 0,0x4D69, 0,0x4D6A, 0, 0,0x4D6B, + 0, 0,0x4D6C,0x4D6D, 0,0x4D6E,0x4D6F, 0, + 0,0x4D70, 0,0x4D71,0x4D72,0x4D73,0x4D74, 0, + 0, 0, 0,0x4D75, 0,0x4D76,0x4D77, 0, + 0,0x4D78, 0, 0, 0,0x4D79, 0, 0, + 0, 0,0x4D7A,0x4D7B, 0,0x4D7C, 0, 0, +0x4D7D,0x4D7E,0x4E21, 0,0x4E22, 0, 0, 0, +0x4E24,0x4E25, 0,0x4E26,0x4E27,0x4E28, 0, 0, + 0,0x4E29,0x4E23,0x4E2A, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4E2B, 0, 0, + 0,0x4E2C, 0, 0, 0, 0, 0,0x4E2D, + 0, 0, 0, 0,0x4E2E,0x4E2F, 0, 0, + 0, 0, 0, 0, 0,0x4E30,0x4E31,0x4E32, + 0,0x4E33, 0, 0,0x4E34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4E35,0x7451, 0, 0,0x4E36, 0, 0, + 0, 0, 0, 0,0x4E37,0x4E38, 0, 0, + 0, 0, 0, 0, 0,0x4E39, 0, 0, + 0, 0, 0,0x4E3A,0x4E3B,0x4E3C,0x7452,0x4E3D, +0x4E3E, 0,0x4E3F,0x4E40,0x4E41,0x4E42,0x4E43,0x4E44, +0x4E45, 0,0x4E46, 0, 0,0x4E47, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4E48, 0, 0, + 0,0x4E49, 0, 0, 0,0x4E4A, 0, 0, + 0,0x4E4B, 0,0x4E4C,0x4E4D, 0,0x4E4E, 0, + 0, 0, 0, 0,0x4E4F, 0, 0, 0, + 0,0x4E50, 0, 0, 0, 0, 0, 0, +0x4E51, 0, 0, 0, 0, 0,0x4E52, 0, +0x4E53, 0, 0, 0,0x4E54, 0, 0, 0, +0x4E55,0x4E56, 0, 0, 0, 0,0x4E57, 0, + 0,0x4E58, 0, 0,0x4E59, 0, 0, 0, +0x4E5A, 0, 0, 0, 0, 0,0x4E5B, 0, + 0, 0,0x4E5C, 0, 0, 0,0x4E5D, 0, + 0, 0,0x4E5E, 0,0x4E5F,0x4E60, 0,0x4E61, + 0,0x4E62,0x4E63, 0,0x4E64, 0, 0, 0, + 0, 0,0x4E65, 0, 0, 0, 0, 0, +0x4E66, 0, 0, 0, 0,0x4E67,0x4E68,0x4E69, + 0, 0, 0, 0,0x4E6A,0x4E6B,0x4E6C, 0, + 0,0x4E6D, 0, 0, 0,0x4E6E,0x4E6F, 0, + 0, 0,0x4E70, 0, 0,0x4E71,0x4E72, 0, + 0, 0,0x4E73, 0, 0,0x4E74,0x4E75,0x4E76, + 0, 0,0x4E77, 0, 0, 0,0x4E78,0x4E79, + 0, 0, 0, 0,0x4E7A, 0,0x4E7B,0x4E7C, +0x4E7D, 0,0x4E7E, 0,0x4F21, 0, 0,0x4F22, + 0, 0,0x4F23, 0,0x4F24, 0, 0, 0, +0x4F25, 0,0x4F26,0x4F27,0x4F28, 0, 0, 0, + 0, 0,0x4F29, 0, 0,0x4F2A, 0, 0, +0x4F2B, 0, 0, 0,0x4F2C, 0, 0, 0, + 0, 0, 0, 0,0x4F2D,0x4F2E, 0, 0, + 0, 0, 0, 0,0x4F2F,0x4F30,0x4F31, 0, + 0, 0,0x4F32, 0, 0, 0, 0,0x4F33, + 0, 0,0x4F34, 0, 0, 0, 0,0x4F35, + 0, 0,0x4F36, 0, 0, 0,0x4F37,0x4F38, + 0,0x4F39, 0, 0, 0,0x4F3A, 0, 0, + 0, 0, 0, 0, 0, 0,0x4F3B, 0, + 0, 0, 0,0x4F3C, 0, 0, 0, 0, + 0,0x4F3D, 0, 0, 0, 0, 0, 0, + 0,0x4F3E,0x4F3F, 0, 0,0x4F40, 0, 0, + 0,0x4F41, 0, 0, 0, 0,0x4F42,0x4F43, +0x4F44, 0, 0, 0,0x4F45, 0,0x4F46, 0, + 0, 0,0x4F47, 0,0x4F48, 0, 0, 0, +0x4F49,0x4F4A, 0, 0,0x4F4B, 0, 0, 0, +0x4F4C, 0, 0,0x4F4D, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4F4E,0x4F4F, 0, + 0,0x4F50, 0, 0, 0,0x4F51,0x4F52, 0, + 0,0x4F53, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4F54, 0, 0, + 0,0x4F55,0x4F56,0x4F57, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4F58,0x4F59, 0, +0x4F5A, 0, 0, 0, 0,0x4F5B, 0,0x4F5C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4F5D,0x4F5E, 0, 0,0x4F5F, +0x4F60, 0, 0, 0,0x4F61, 0,0x4F62, 0, + 0, 0,0x4F63, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4F64, 0,0x4F65, 0, +0x4F66,0x4F67, 0,0x4F68,0x4F69, 0, 0, 0, +0x4F6A, 0,0x4F6B, 0, 0, 0,0x4F6C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4F6D, 0, 0, 0,0x4F6E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4F6F, 0, 0, 0, 0,0x4F70, + 0, 0, 0, 0,0x4F71, 0, 0, 0, +0x4F72, 0, 0, 0, 0,0x4F74,0x4F75,0x4F76, + 0,0x4F73, 0, 0,0x4F77, 0, 0, 0, +0x4F78, 0, 0, 0,0x4F79,0x4F7A, 0, 0, +0x4F7B,0x4F7C,0x4F7D,0x4F7E, 0, 0, 0, 0, + 0, 0, 0,0x5021, 0,0x5022, 0,0x5023, + 0, 0, 0, 0, 0, 0, 0,0x5024, +0x5025,0x5026, 0, 0,0x5027, 0,0x5028, 0, + 0, 0,0x5029,0x502A, 0,0x502B,0x502C, 0, + 0, 0, 0,0x502E, 0, 0, 0,0x502F, +0x5030,0x5031, 0, 0,0x502D, 0,0x5032, 0, + 0, 0,0x5033, 0, 0, 0, 0, 0, + 0, 0,0x5034,0x5035, 0, 0,0x5037,0x5038, + 0, 0,0x5039,0x503A, 0, 0, 0,0x503B, +0x5036, 0, 0, 0, 0, 0,0x503C, 0, + 0, 0, 0, 0,0x503D, 0, 0, 0, +0x503E, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x503F, 0,0x5040, 0,0x5041,0x5042, +0x5043, 0, 0, 0, 0,0x5044, 0,0x5045, + 0,0x5046, 0, 0, 0,0x5047, 0, 0, +0x7454,0x5048, 0, 0,0x5049,0x504A, 0, 0, + 0, 0, 0,0x504B, 0,0x504C, 0,0x504D, + 0, 0, 0, 0,0x504E,0x504F,0x5050, 0, + 0, 0,0x5051,0x5052, 0, 0, 0,0x5053, + 0,0x5054, 0, 0,0x5055, 0, 0, 0, +0x5056, 0, 0,0x5057,0x5058, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5059, + 0,0x505A, 0,0x505B, 0, 0, 0, 0, + 0, 0,0x505C, 0, 0, 0, 0, 0, + 0,0x505D, 0,0x505E,0x505F, 0,0x5060, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5061,0x5062, 0, 0, 0, + 0,0x5063, 0,0x5064,0x5065,0x5066,0x5067, 0, +0x5068, 0, 0,0x5069,0x506A, 0, 0, 0, + 0,0x506B, 0, 0, 0, 0, 0, 0, +0x506C,0x506D, 0,0x506E, 0, 0, 0,0x506F, + 0,0x5070, 0, 0,0x5071, 0, 0, 0, +0x5072, 0, 0,0x5073, 0, 0, 0, 0, + 0, 0,0x5074, 0,0x5075, 0, 0,0x5076, +0x5077, 0,0x5078, 0, 0, 0, 0,0x5079, + 0, 0, 0, 0,0x507A, 0,0x507B, 0, + 0, 0,0x507C, 0, 0,0x507D,0x507E, 0, +0x5121, 0,0x5122, 0, 0,0x5123, 0, 0, + 0, 0,0x5124,0x5125, 0,0x5126, 0, 0, + 0,0x5127, 0, 0, 0, 0, 0, 0, +0x5128, 0, 0, 0,0x5129, 0, 0, 0, + 0, 0,0x512A,0x512B, 0, 0, 0,0x512C, + 0,0x512D,0x512E, 0,0x512F, 0, 0, 0, + 0,0x5130, 0, 0, 0,0x5131, 0, 0, + 0, 0, 0,0x5132, 0, 0,0x5133, 0, + 0,0x5134, 0, 0, 0, 0, 0,0x5135, + 0, 0, 0,0x5136, 0,0x5137, 0,0x5138, +0x5139, 0, 0, 0,0x513A,0x513B, 0, 0, +0x513C,0x513D,0x513E, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x513F,0x5140, 0,0x5141, +0x5142, 0, 0, 0,0x5143, 0, 0, 0, + 0, 0, 0, 0, 0,0x5144,0x5145, 0, + 0,0x5146, 0, 0,0x5147,0x5148, 0,0x5149, +0x514A, 0, 0, 0, 0,0x514B, 0,0x514C, + 0, 0,0x514D, 0, 0,0x514E, 0, 0, + 0, 0, 0, 0, 0,0x514F, 0, 0, +0x5150, 0, 0, 0, 0, 0,0x5151, 0, +0x5152, 0,0x5153, 0, 0,0x5154,0x5155, 0, + 0, 0,0x5156,0x5157, 0, 0, 0, 0, +0x5158,0x5159, 0, 0,0x515A, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x515B, 0, +0x515C, 0, 0,0x515D, 0, 0, 0, 0, + 0, 0, 0, 0,0x515E, 0, 0, 0, + 0, 0, 0,0x515F, 0,0x5160, 0, 0, + 0,0x5161, 0,0x5162,0x5163, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5164, 0, + 0,0x5165, 0, 0,0x5166, 0,0x5167, 0, + 0,0x5168, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5169, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7459, +0x516A,0x516B, 0,0x516C,0x516D, 0, 0, 0, + 0,0x516E, 0, 0,0x516F, 0, 0, 0, + 0, 0, 0,0x5170, 0,0x5171,0x5172, 0, + 0, 0, 0, 0, 0, 0, 0,0x5173, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5174, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5175, + 0, 0, 0,0x5176, 0, 0, 0,0x5177, + 0,0x5178,0x5179,0x517A, 0,0x517B,0x517C,0x517D, +0x517E,0x5221, 0, 0,0x5222, 0, 0, 0, + 0, 0, 0, 0, 0,0x5223, 0,0x5224, +0x5225,0x5226, 0, 0, 0, 0, 0,0x5227, + 0, 0, 0, 0, 0, 0,0x5228, 0, + 0, 0, 0, 0, 0,0x5229, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x522A, 0, 0, 0,0x522B, 0,0x522C, 0, + 0,0x522D,0x522E, 0, 0,0x522F, 0,0x5230, + 0, 0,0x5231,0x5232, 0, 0, 0,0x5233, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5234, 0, 0, 0, + 0,0x5235, 0, 0, 0, 0,0x5236, 0, +0x5237,0x5238, 0, 0, 0, 0,0x5239, 0, + 0, 0, 0,0x523A, 0, 0,0x523B, 0, +0x523C, 0, 0, 0, 0,0x523D, 0, 0, + 0, 0, 0, 0,0x523E, 0, 0,0x523F, +0x5240, 0,0x5241, 0, 0,0x5242,0x5243, 0, + 0, 0,0x5244,0x5245,0x5246,0x5247, 0, 0, + 0, 0,0x5248, 0, 0,0x5249, 0, 0, +0x524A, 0,0x524B, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x524C, 0,0x524D,0x524E, + 0,0x524F,0x5250,0x5251, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5252, 0,0x5253, 0, 0, 0, 0, 0, + 0, 0,0x5254, 0,0x5255,0x5256, 0, 0, +0x5257,0x5258,0x5259, 0,0x525A, 0,0x525B, 0, + 0,0x525C,0x525D,0x525E,0x525F, 0,0x5260, 0, + 0,0x5261, 0,0x5262,0x5263, 0,0x5264,0x5265, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5266, 0,0x5267, 0, 0, 0, 0, +0x5268, 0, 0, 0, 0,0x5269,0x526A, 0, +0x526B, 0, 0, 0,0x526C, 0, 0, 0, + 0,0x526D, 0,0x526E,0x526F, 0,0x5270, 0, + 0,0x5271,0x5272, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5273, 0, + 0, 0,0x5274, 0, 0, 0, 0, 0, + 0,0x5276,0x5277,0x5278, 0,0x5275, 0, 0, + 0,0x5279,0x527A,0x527B,0x527C,0x527D,0x527E, 0, + 0,0x5321, 0,0x5322, 0, 0, 0,0x5323, + 0,0x5324, 0, 0, 0,0x5325,0x5326, 0, +0x5327, 0,0x5328, 0, 0, 0, 0, 0, + 0,0x5329, 0, 0,0x532A,0x532B, 0, 0, + 0, 0, 0, 0, 0, 0,0x532C,0x532D, + 0, 0, 0, 0, 0, 0, 0,0x532E, + 0, 0, 0, 0,0x532F, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5330, 0, +0x5331, 0, 0, 0, 0, 0,0x5332, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5333, 0, 0, 0, 0, 0,0x5334,0x5335, + 0, 0,0x5336,0x5337,0x5338, 0, 0,0x5339, + 0, 0, 0, 0,0x533A, 0, 0,0x533B, +0x533C,0x533D, 0, 0, 0,0x533E, 0,0x533F, + 0, 0, 0,0x5340,0x5341,0x5342, 0,0x5343, + 0,0x5344,0x5345, 0, 0,0x5346, 0, 0, + 0, 0, 0, 0, 0, 0,0x5347, 0, + 0,0x5348, 0,0x5349, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x534A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x534B, 0, 0, 0,0x534C, +0x534D,0x534E, 0, 0, 0, 0, 0,0x534F, + 0,0x5350,0x5351,0x5352, 0, 0,0x5353, 0, + 0, 0, 0, 0, 0,0x5354,0x5355, 0, + 0, 0, 0,0x5356, 0, 0,0x5357, 0, + 0, 0,0x5358, 0, 0,0x5359, 0, 0, + 0,0x535A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x535B,0x535C,0x535D, 0, +0x535E,0x535F, 0, 0, 0, 0, 0,0x5360, +0x5361, 0, 0, 0, 0,0x5362, 0, 0, + 0,0x5363, 0,0x5364, 0, 0, 0,0x5365, + 0,0x5366,0x5367, 0,0x5368,0x5369, 0, 0, + 0, 0, 0, 0, 0,0x536A, 0,0x536B, + 0, 0,0x536C, 0, 0, 0, 0, 0, +0x536D, 0, 0, 0, 0, 0, 0, 0, +0x536E, 0,0x536F,0x5370, 0, 0, 0,0x5371, + 0,0x5372,0x5373,0x5374, 0,0x5375,0x5376, 0, +0x5377, 0, 0,0x5378,0x5379,0x537A, 0, 0, + 0,0x537B, 0, 0, 0, 0,0x537C,0x537D, + 0, 0, 0, 0, 0,0x537E,0x5421, 0, +0x745C, 0, 0, 0, 0, 0,0x5422,0x5423, + 0, 0,0x5424, 0, 0, 0, 0, 0, + 0, 0, 0,0x5425, 0, 0,0x5426,0x5427, + 0,0x5428, 0, 0, 0, 0, 0, 0, + 0, 0,0x5429,0x542A,0x542B,0x542C,0x542D, 0, + 0, 0, 0, 0,0x542E,0x542F,0x5430, 0, + 0, 0, 0, 0, 0, 0,0x745D,0x5431, + 0,0x5432, 0, 0, 0, 0, 0, 0, + 0, 0,0x5434, 0, 0,0x5435,0x5436, 0, + 0, 0,0x5437,0x5438, 0,0x5439, 0, 0, + 0,0x543A, 0, 0, 0,0x543B,0x543C, 0, + 0,0x543D,0x543E, 0, 0, 0, 0, 0, +0x5433, 0, 0, 0, 0, 0, 0, 0, +0x543F, 0, 0, 0, 0, 0, 0, 0, +0x5440,0x5441, 0, 0, 0,0x5442, 0,0x5443, + 0, 0, 0, 0,0x5444,0x5445, 0, 0, +0x5446, 0, 0, 0, 0, 0, 0,0x5447, +0x5448, 0, 0, 0,0x5449,0x544A, 0,0x544B, + 0, 0, 0,0x544C, 0, 0,0x544D, 0, + 0, 0, 0, 0, 0, 0, 0,0x544E, + 0, 0, 0, 0,0x544F,0x5450, 0,0x5451, + 0, 0, 0, 0, 0, 0,0x5452, 0, +0x5453, 0,0x5454, 0, 0, 0, 0, 0, +0x5455, 0, 0, 0, 0, 0, 0,0x5456, + 0,0x5457,0x5458, 0, 0,0x5459, 0, 0, + 0, 0, 0,0x545A, 0, 0,0x545B,0x545C, + 0, 0, 0,0x545D, 0, 0, 0, 0, +0x545E, 0, 0, 0, 0, 0,0x545F, 0, + 0,0x5460, 0, 0, 0, 0,0x5461,0x5462, + 0, 0,0x5463, 0, 0,0x5464, 0, 0, + 0,0x5465, 0, 0, 0,0x5466, 0, 0, +0x5467, 0,0x5468, 0, 0,0x5469,0x546A}; + +/* page 28 0x7F3B-0x8044 */ +static uint16 tab_uni_jisx021228[]={ +0x546C,0x546B,0x546D,0x546E,0x546F, 0, 0, 0, +0x5470,0x5471, 0, 0,0x5472, 0, 0, 0, + 0, 0, 0, 0,0x5473, 0, 0,0x5474, +0x5475, 0, 0, 0, 0, 0, 0, 0, +0x5476,0x5477,0x5478, 0, 0, 0,0x5479, 0, +0x547A,0x547B,0x547C,0x547D, 0, 0, 0, 0, + 0, 0,0x547E, 0, 0, 0,0x5521, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5522,0x5523,0x5524,0x5525, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5526, 0,0x5527, 0,0x5528,0x5529,0x552A, 0, + 0, 0, 0,0x552B,0x552C, 0, 0, 0, + 0,0x552D, 0, 0, 0, 0,0x552E,0x552F, + 0, 0, 0,0x5530, 0, 0, 0,0x5531, + 0, 0,0x5532, 0, 0, 0, 0, 0, + 0,0x5533, 0, 0, 0, 0, 0, 0, + 0,0x5534, 0, 0,0x5535,0x5536, 0, 0, +0x5537, 0, 0, 0, 0,0x5538, 0, 0, + 0, 0, 0,0x5539,0x553A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x553B, 0, 0, 0,0x553C, 0, 0, 0, +0x553D, 0,0x553E, 0, 0,0x553F, 0, 0, + 0,0x5540, 0,0x5541,0x5542, 0, 0,0x5543, + 0, 0, 0, 0, 0, 0, 0,0x5544, + 0, 0,0x5545,0x5546,0x5547, 0, 0, 0, + 0, 0, 0, 0,0x5548,0x5549, 0,0x554A, + 0, 0,0x554B,0x554C,0x554D, 0,0x554E, 0, +0x554F,0x5550, 0,0x5551, 0, 0, 0, 0, + 0, 0,0x5552,0x5553,0x5554,0x5555, 0, 0, + 0,0x5556, 0,0x5557, 0, 0, 0, 0, + 0,0x5558, 0,0x5559, 0,0x555A, 0, 0, + 0,0x555B,0x555C, 0,0x555D, 0,0x555E,0x555F, + 0,0x5560, 0,0x5561, 0,0x5562, 0, 0, + 0,0x5563}; + +/* page 29 0x8060-0x8362 */ +static uint16 tab_uni_jisx021229[]={ +0x5564, 0, 0, 0,0x5565, 0,0x5566, 0, + 0, 0, 0, 0, 0,0x5567, 0, 0, + 0,0x5568, 0, 0, 0,0x5569, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x556A, 0, 0, 0, 0, 0, 0, +0x556B, 0, 0, 0, 0, 0,0x556C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x556D, 0,0x556E, 0, + 0, 0, 0, 0, 0, 0,0x556F,0x5570, + 0, 0, 0,0x5571, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5572,0x5573, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5574, 0, 0, 0, 0,0x5575, 0,0x5576, + 0, 0,0x5577, 0,0x5578,0x5579, 0,0x557A, +0x557B, 0, 0, 0, 0, 0, 0, 0, +0x557C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x557D,0x557E, 0, +0x5621, 0,0x5622,0x5623, 0, 0,0x5624, 0, + 0,0x5625,0x5626, 0, 0, 0,0x5627, 0, + 0, 0, 0,0x5628, 0, 0, 0, 0, + 0, 0, 0,0x5629, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x562A,0x562B, +0x562C, 0, 0, 0,0x562D, 0,0x562E, 0, +0x562F, 0, 0, 0,0x5630, 0, 0,0x5631, + 0, 0, 0, 0,0x5632, 0, 0, 0, +0x5633, 0, 0, 0, 0,0x5634, 0, 0, + 0, 0,0x5635, 0,0x5636, 0, 0, 0, + 0, 0, 0, 0, 0,0x5637, 0,0x5638, + 0, 0,0x5639, 0,0x563A, 0, 0, 0, + 0, 0,0x563B, 0, 0, 0, 0,0x563C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x563D,0x563E, 0, 0, 0, 0, 0,0x563F, +0x5640,0x5641, 0, 0, 0,0x5642, 0,0x5643, + 0, 0, 0, 0, 0, 0, 0,0x5644, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5645, 0, 0,0x5647,0x5648,0x5649, 0, + 0, 0, 0,0x564A, 0, 0,0x564B, 0, +0x5646, 0, 0, 0, 0, 0,0x564C, 0, +0x564D, 0, 0,0x564E, 0, 0,0x564F, 0, + 0, 0,0x5650, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5651, 0, + 0, 0,0x5652, 0,0x5653, 0, 0, 0, + 0, 0, 0,0x5654, 0, 0, 0, 0, + 0, 0, 0,0x5656, 0,0x5657, 0, 0, + 0, 0,0x5658,0x5655, 0, 0,0x5659,0x565A, + 0, 0, 0, 0, 0,0x565B, 0,0x565C, + 0, 0, 0,0x565D, 0,0x565E,0x565F, 0, + 0,0x5660, 0, 0,0x5661, 0, 0, 0, + 0, 0, 0,0x5662,0x5663, 0, 0, 0, +0x5664,0x5665,0x5666, 0, 0,0x5667,0x5668, 0, +0x5669,0x566A, 0, 0, 0,0x566B, 0,0x566C, +0x566D, 0, 0,0x566E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x566F, + 0, 0, 0,0x5670,0x5671, 0, 0, 0, + 0,0x5672,0x5673, 0, 0,0x5674, 0, 0, + 0,0x5675,0x5676, 0, 0, 0, 0, 0, +0x5677, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5678, 0,0x5679, 0, 0, 0, + 0, 0,0x567A, 0, 0, 0, 0, 0, + 0, 0, 0,0x567B,0x567C,0x567D,0x567E, 0, + 0, 0, 0,0x5721, 0, 0,0x5722,0x5723, + 0,0x5724, 0, 0, 0, 0,0x5725, 0, + 0, 0, 0, 0,0x5726, 0, 0, 0, +0x5727, 0, 0,0x5728, 0, 0, 0,0x5729, + 0, 0, 0, 0, 0,0x572A, 0, 0, + 0, 0, 0, 0,0x572B, 0, 0, 0, + 0, 0, 0,0x572C, 0,0x572D, 0,0x572E, +0x572F,0x5730, 0,0x5731,0x5732, 0, 0,0x5733, + 0,0x5734,0x5735, 0, 0, 0,0x5736, 0, + 0,0x5737, 0, 0,0x5738, 0,0x5739, 0, +0x573A, 0,0x573B,0x573C, 0, 0, 0, 0, +0x573D,0x573E, 0,0x573F,0x5740, 0, 0,0x5741, +0x5742,0x5743,0x5744, 0, 0, 0,0x5745, 0, +0x5746, 0,0x5747, 0,0x5748, 0, 0,0x5749, + 0, 0,0x574A, 0,0x574B, 0,0x574C,0x574D, + 0, 0, 0, 0, 0, 0,0x574E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x574F, 0, 0, 0, 0,0x5750, 0, 0, + 0, 0,0x5751, 0, 0, 0, 0, 0, +0x5752, 0,0x5753, 0,0x5754, 0, 0, 0, +0x5755, 0,0x5756, 0, 0,0x5757, 0,0x5758, + 0, 0, 0, 0, 0, 0,0x5759,0x575A, + 0, 0, 0, 0, 0,0x575B,0x575C, 0, +0x575D,0x575E, 0, 0, 0, 0, 0,0x575F, +0x5760, 0,0x5761,0x5762, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5764, 0,0x5765,0x5766,0x5767, + 0,0x5768,0x5769, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x576A,0x576B,0x576C, 0, +0x576D, 0, 0,0x576E, 0, 0, 0,0x576F, + 0, 0,0x5770, 0,0x5771,0x5772, 0, 0, + 0, 0,0x5773,0x5774,0x5775, 0, 0,0x5776, + 0, 0, 0, 0, 0,0x5777,0x5778, 0, + 0,0x5779, 0,0x583E,0x5763,0x577A,0x577B,0x577C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x745F}; + +/* page 30 0x8370-0x8419 */ +static uint16 tab_uni_jisx021230[]={ +0x577D, 0, 0, 0, 0, 0, 0, 0, +0x577E, 0, 0, 0, 0,0x5821, 0,0x5822, +0x5823, 0,0x5824, 0,0x5825, 0,0x5826, 0, + 0, 0, 0, 0, 0,0x5827, 0, 0, + 0, 0,0x5828, 0,0x5829,0x582A, 0, 0, +0x582B,0x582C, 0,0x582D,0x582E,0x582F, 0, 0, + 0, 0, 0, 0, 0, 0,0x5830,0x5831, + 0,0x5832, 0, 0,0x5833,0x584C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5834,0x5835, +0x5836, 0, 0, 0, 0, 0, 0,0x5837, + 0,0x5838, 0, 0, 0, 0, 0,0x5839, +0x583A,0x583B, 0, 0,0x583C, 0, 0, 0, + 0, 0, 0, 0, 0,0x583D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x583F, 0,0x5840, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5841, 0, +0x5842,0x5843, 0, 0,0x5844, 0, 0, 0, + 0,0x5845, 0, 0, 0, 0,0x5846, 0, + 0, 0,0x5847, 0, 0, 0, 0,0x5848, + 0,0x5849, 0, 0, 0,0x584A, 0, 0, + 0,0x584B}; + +/* page 31 0x842F-0x8880 */ +static uint16 tab_uni_jisx021231[]={ +0x584D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x584E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x584F, 0, +0x5850,0x5851, 0,0x5852, 0, 0,0x5853, 0, +0x5854, 0,0x5855,0x5856, 0, 0, 0,0x5857, + 0,0x5858,0x5859,0x585A, 0,0x585B, 0, 0, + 0,0x585C, 0, 0, 0,0x585D,0x585E, 0, +0x585F, 0, 0,0x5860, 0, 0, 0, 0, + 0,0x5861, 0, 0,0x5862,0x5863, 0,0x5864, + 0,0x5865, 0, 0, 0,0x5866,0x5867, 0, + 0, 0,0x5868, 0, 0, 0,0x5869, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x586A,0x586B, 0,0x586C, 0, + 0, 0, 0, 0, 0, 0, 0,0x586D, + 0, 0, 0, 0, 0, 0, 0,0x586E, + 0,0x586F,0x5870,0x5871, 0, 0, 0, 0, +0x5872, 0,0x5873, 0, 0,0x5874, 0, 0, + 0, 0, 0,0x5875, 0, 0,0x5876,0x5877, + 0,0x5878, 0,0x5879, 0, 0, 0, 0, +0x587A,0x587B, 0, 0, 0,0x587C, 0, 0, +0x587D, 0, 0, 0,0x587E, 0, 0, 0, + 0, 0, 0, 0, 0,0x5921, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5922, 0, 0,0x5923, 0, 0, 0, 0, +0x5924,0x5925,0x5926,0x5927, 0, 0, 0, 0, +0x5928, 0, 0,0x592A,0x592B, 0,0x592C, 0, + 0, 0, 0,0x592D,0x592E, 0, 0, 0, +0x592F, 0, 0, 0, 0,0x5930, 0,0x5931, + 0,0x5932, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5933, 0,0x5934, + 0, 0, 0,0x5935,0x5936,0x5937,0x5938, 0, +0x5939, 0, 0,0x593A,0x593B, 0, 0, 0, +0x593C, 0, 0,0x5929,0x593D,0x593E, 0,0x593F, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5940, 0, 0, 0, 0, 0, 0,0x5941, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5942,0x5943,0x5944,0x5945,0x5946, 0, 0,0x5947, + 0, 0,0x5948, 0, 0,0x5949,0x594A,0x594B, +0x594C,0x594D,0x594E,0x594F, 0,0x5950, 0, 0, + 0, 0, 0, 0,0x5951, 0, 0, 0, +0x5952, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5953,0x5954,0x5955, 0,0x5956, 0, +0x5957, 0,0x5958, 0, 0, 0,0x5959,0x595A, + 0, 0,0x595B, 0,0x595C,0x595D, 0, 0, +0x595E, 0, 0, 0,0x595F, 0, 0, 0, + 0,0x5960, 0, 0, 0, 0,0x5961, 0, +0x5962,0x5963, 0,0x5964, 0, 0,0x5965, 0, +0x5966, 0, 0, 0, 0, 0,0x5974, 0, + 0,0x7461, 0, 0, 0,0x5967, 0,0x5968, +0x5969,0x596A, 0, 0, 0,0x596B,0x596C,0x596D, +0x596E, 0, 0,0x596F, 0, 0, 0, 0, +0x5970, 0, 0,0x5971,0x5972, 0, 0,0x5973, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5975, 0,0x5976, 0, 0, 0, 0, +0x5977,0x5978, 0, 0, 0, 0, 0,0x5979, + 0,0x597A, 0, 0, 0, 0,0x597B, 0, + 0, 0, 0, 0,0x597C, 0, 0,0x597D, + 0, 0, 0, 0, 0,0x597E, 0, 0, +0x5A21,0x5A22, 0, 0, 0,0x5A23,0x5A24, 0, + 0, 0, 0, 0, 0, 0,0x5A25,0x5A26, + 0,0x5A27,0x5A28,0x5A29, 0, 0, 0, 0, + 0,0x5A2A,0x5A2B, 0,0x5A2C, 0, 0,0x5A2D, + 0, 0,0x5A2E, 0, 0, 0, 0, 0, +0x5A2F, 0,0x5A30, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5A31, + 0,0x5A32, 0,0x5A33, 0,0x5A34,0x5A35, 0, + 0,0x5A36,0x3866,0x5A37, 0, 0, 0,0x5A38, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5A39,0x5A3A, 0, 0,0x5A3B, +0x5A3C,0x5A3D,0x5A3E, 0, 0, 0,0x5A3F, 0, + 0,0x5A40,0x5A41,0x5A42,0x5A43,0x5A44, 0, 0, + 0, 0,0x5A45, 0, 0,0x5A46, 0, 0, +0x5A47, 0, 0, 0, 0, 0,0x5A48,0x5A49, +0x5A4A, 0, 0,0x5A4B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5A6D, 0, 0, 0, 0,0x5A4C, 0, + 0, 0,0x5A4D, 0, 0, 0, 0,0x5A4E, + 0,0x5A4F, 0,0x5A50, 0,0x5A51, 0, 0, + 0, 0,0x5A52, 0, 0, 0, 0,0x5A53, +0x5A54,0x5A55, 0, 0, 0, 0,0x5A56, 0, + 0, 0,0x5A57, 0,0x5A58,0x5A59,0x5A5A, 0, +0x5A5B,0x5A5C,0x5A5D, 0, 0, 0, 0, 0, +0x5A5E,0x5A5F,0x5A60, 0,0x5A61, 0,0x5A62, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5A63,0x5A64, 0, 0,0x5A65, 0, +0x5A66, 0, 0,0x5A67, 0,0x5A68, 0, 0, + 0,0x5A69, 0, 0,0x5A6A, 0,0x5A6B, 0, +0x5A6C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5A6E, 0,0x5A6F,0x5A70, 0, + 0, 0, 0, 0, 0,0x5A71,0x5A72, 0, +0x5A73, 0, 0, 0,0x5A74, 0, 0,0x5A75, +0x5A76,0x5A77, 0, 0,0x5A78,0x5A79, 0, 0, + 0, 0,0x5A7A, 0, 0, 0, 0,0x5A7B, +0x5A7C, 0,0x5A7D, 0,0x5A7E, 0, 0, 0, + 0,0x5B21, 0, 0, 0, 0, 0,0x5B22, +0x5B23, 0,0x5B24,0x5B25, 0, 0, 0, 0, + 0, 0,0x5B26,0x5B27, 0,0x5B28,0x5B29,0x5B2A, + 0,0x5B2B, 0, 0,0x5B2C, 0,0x5B2D, 0, + 0, 0, 0, 0, 0, 0,0x5B2E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B2F, 0, 0, 0, 0,0x5B30, 0, + 0, 0,0x5B31, 0, 0,0x5B32,0x5B33, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5B34, 0,0x5B35,0x5B36, 0, 0, 0, 0, + 0, 0, 0, 0,0x5B37, 0, 0, 0, + 0, 0, 0, 0,0x5B38,0x5B39,0x5B3A,0x5B3B, +0x5B3C,0x5B3D,0x5B3E, 0,0x5B3F,0x5B40, 0, 0, + 0,0x5B41, 0, 0,0x5B42, 0,0x5B43, 0, +0x5B44,0x5B45,0x5B46, 0, 0, 0, 0,0x5B47, + 0,0x5B48, 0, 0,0x5B49, 0, 0, 0, +0x5B4A, 0, 0, 0, 0,0x5B4B,0x5B4C,0x5B4D, + 0, 0,0x5B4E, 0, 0, 0,0x5B4F, 0, + 0, 0, 0, 0, 0, 0, 0,0x5B50, +0x5B51, 0,0x5B52, 0, 0, 0, 0, 0, + 0,0x5B53,0x5B54,0x5B55, 0, 0, 0,0x5B56, + 0, 0, 0, 0, 0, 0,0x5B57,0x5B58, + 0, 0,0x5B59,0x5B5A, 0,0x5B5B, 0, 0, +0x5B5C, 0, 0,0x5B5D,0x5B5E,0x5B5F, 0, 0, + 0, 0, 0,0x5B60,0x5B61, 0,0x5B62, 0, + 0, 0,0x5B63, 0,0x5B64, 0, 0, 0, + 0,0x5B65, 0,0x5B66, 0, 0, 0, 0, +0x5B67, 0,0x5B68, 0,0x5B69, 0, 0,0x5B6A, +0x7464, 0,0x5B6B,0x5B6C,0x5B6D, 0, 0, 0, + 0,0x5B6E, 0,0x5B70,0x5B71,0x5B72, 0, 0, + 0,0x5B73,0x5B6F,0x5B74,0x5B75,0x5B76, 0,0x5B77, +0x5B78, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B79, 0, 0, 0, 0,0x5B7A,0x5B7B, + 0,0x5B7C, 0,0x5B7D, 0, 0,0x5B7E, 0, + 0, 0, 0,0x5C21, 0,0x5C22, 0, 0, + 0, 0,0x5C23, 0,0x5C24, 0,0x5C25, 0, + 0,0x5C26,0x5C27,0x5C28,0x5C29, 0, 0,0x5C2A, + 0, 0,0x5C2B, 0, 0, 0,0x5C2C,0x5C2D, + 0,0x5C2E, 0,0x5C2F, 0,0x5C30, 0, 0, +0x5C31,0x5C32, 0, 0, 0,0x5C33, 0, 0, + 0, 0,0x5C34, 0, 0, 0, 0, 0, + 0, 0,0x5C35, 0, 0, 0, 0, 0, + 0, 0,0x5C36, 0,0x5C37, 0, 0, 0, + 0,0x5C38}; + +/* page 32 0x8898-0x89BC */ +static uint16 tab_uni_jisx021232[]={ +0x5C39, 0,0x5C3A,0x5C3B,0x5C3C, 0, 0,0x5C3D, +0x5C3E, 0, 0, 0, 0, 0, 0, 0, +0x5C3F, 0,0x5C40, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5C41, 0, 0,0x5C42,0x5C43, 0, +0x5C44, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5C45,0x5C46,0x5C47,0x5C48,0x5C49, 0, + 0,0x5C4A,0x5C4B,0x5C4C, 0, 0, 0, 0, + 0, 0, 0,0x5C4D, 0, 0,0x5C4E, 0, + 0, 0, 0, 0, 0, 0, 0,0x5C4F, + 0, 0, 0, 0, 0, 0, 0,0x5C50, +0x5C51,0x5C52, 0, 0, 0,0x5C53, 0,0x5C54, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5C55, 0, 0, 0, 0,0x5C56, 0, + 0, 0, 0, 0, 0,0x5C57,0x5C58,0x5C59, + 0, 0, 0, 0, 0,0x5C5A,0x5C5B, 0, +0x5C5C,0x5C5D,0x5C5E, 0,0x5C5F, 0, 0, 0, +0x5C60, 0, 0, 0, 0, 0,0x5C61,0x5C62, +0x5C63, 0, 0, 0, 0, 0, 0, 0, +0x5C64,0x5C65,0x5C66, 0, 0,0x5C67, 0, 0, + 0,0x5C68,0x5C69, 0, 0, 0,0x5C6A, 0, +0x5C6B, 0,0x5C6C, 0, 0,0x5C6D,0x5C6E, 0, + 0,0x5C6F, 0, 0, 0, 0, 0,0x5C70, + 0, 0,0x5C71, 0, 0, 0, 0,0x5C72, + 0, 0,0x5C73,0x5C74,0x5C75, 0, 0, 0, + 0,0x5C76,0x5C77,0x5C78, 0, 0, 0, 0, + 0, 0, 0,0x5C79, 0, 0,0x5C7A, 0, +0x5C7B, 0, 0,0x5C7C, 0,0x5C7D, 0, 0, + 0, 0,0x5C7E,0x5D21,0x5D22,0x5D23, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D24, 0, 0, 0,0x5D25, 0, 0, +0x5D26, 0, 0, 0,0x5D27,0x5D28, 0, 0, + 0, 0, 0,0x5D29,0x5D2A, 0, 0,0x5D2B, +0x5D2C, 0, 0, 0, 0,0x5D2D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5D2E, 0, 0, 0,0x5D2F,0x5D30,0x5D31,0x5D32, + 0, 0, 0, 0,0x5D33}; + +/* page 33 0x89D4-0x8B9F */ +static uint16 tab_uni_jisx021233[]={ +0x5D34,0x5D35,0x5D36,0x5D37,0x5D38, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D39, 0, 0, 0,0x5D3A, 0,0x5D3B, + 0,0x5D3C, 0, 0, 0,0x5D3D, 0,0x5D3E, + 0, 0,0x5D3F, 0, 0,0x5D40, 0, 0, + 0,0x5D41, 0,0x5D42, 0, 0, 0, 0, +0x5D43,0x5D44, 0,0x5D45, 0, 0, 0, 0, + 0, 0, 0,0x5D46, 0,0x5D47,0x5D48, 0, +0x5D49,0x5D4A, 0, 0, 0, 0, 0, 0, + 0, 0,0x5D4B, 0,0x5D4C, 0,0x5D4D, 0, +0x5D4E, 0,0x5D4F, 0, 0, 0, 0,0x5D50, +0x5D51, 0, 0,0x5D52, 0, 0, 0, 0, + 0,0x5D53, 0,0x5D54, 0, 0, 0, 0, + 0,0x5D55,0x5D56, 0,0x5D57, 0, 0,0x5D58, + 0,0x5D59, 0,0x5D5A, 0,0x5D5B, 0, 0, + 0,0x5D5C,0x5D5D, 0, 0, 0, 0,0x5D5E, + 0, 0,0x5D5F,0x5D60,0x5D61, 0, 0, 0, +0x5D62,0x5D63, 0, 0, 0,0x5D64, 0, 0, + 0,0x5D65, 0,0x5D66, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D67,0x5D68,0x5D69, 0,0x5D6A,0x5D6B,0x5D6C, + 0, 0,0x5D6D,0x5D6E,0x5D6F, 0, 0,0x5D70, + 0, 0,0x5D71, 0, 0, 0, 0,0x5D72, + 0, 0, 0,0x5D73,0x5D74, 0,0x5D75, 0, + 0, 0,0x5D76,0x5D77, 0,0x5D78, 0, 0, + 0, 0, 0,0x5D79, 0, 0, 0, 0, + 0, 0, 0,0x5D7A, 0,0x5D7B, 0, 0, + 0, 0,0x5D7C,0x5D7D, 0, 0, 0,0x5D7E, + 0, 0,0x5E21,0x5E22, 0, 0, 0,0x5E23, + 0, 0,0x5E24, 0, 0, 0, 0,0x5E25, + 0, 0,0x5E26, 0,0x5E27,0x5E28,0x5E29, 0, + 0, 0, 0, 0, 0,0x5E2A, 0,0x5E2B, +0x5E2C,0x5E2D, 0,0x5E2E, 0, 0, 0, 0, + 0,0x5E2F, 0,0x5E30, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5E31, 0, 0, 0,0x5E32, 0, 0, 0, +0x5E33,0x5E34,0x5E35, 0, 0, 0, 0, 0, +0x5E36, 0, 0,0x5E37, 0, 0, 0, 0, + 0,0x5E38,0x5E39, 0, 0, 0,0x5E3F,0x5E3A, + 0, 0, 0, 0, 0,0x5E3B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5E3C, 0,0x5E3D,0x5E3E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E40, 0, 0,0x5E41, 0, 0, 0, + 0, 0, 0,0x5E42, 0, 0, 0, 0, +0x5E43, 0, 0, 0, 0, 0,0x5E44,0x5E45, +0x5E46,0x5E47,0x5E48, 0,0x5E49, 0, 0, 0, + 0,0x5E4E, 0, 0, 0, 0,0x5E4A,0x5E4B, +0x5E4C, 0, 0, 0, 0,0x5E4D, 0, 0, + 0, 0,0x5E4F, 0, 0, 0, 0,0x5E50, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E51, 0, 0, 0, 0, 0, 0, + 0, 0,0x5E52, 0,0x5E53,0x5E54, 0, 0, +0x5E55, 0,0x5E56,0x7466, 0,0x5E57, 0, 0, +0x5E58,0x5E59, 0, 0, 0, 0, 0,0x5E5A, + 0,0x5E5B, 0,0x5E5C, 0, 0, 0, 0, +0x5E5D,0x5E5E, 0, 0, 0, 0, 0, 0, +0x5E5F, 0,0x5E60,0x5E61}; + +/* page 34 0x8C38-0x8CA4 */ +static uint16 tab_uni_jisx021234[]={ +0x5E62,0x5E63, 0, 0, 0,0x5E64,0x5E65, 0, + 0, 0, 0, 0, 0,0x5E66, 0,0x5E67, + 0,0x5E68, 0,0x5E69, 0, 0, 0,0x5E6A, + 0,0x5E6B, 0,0x5E6C,0x5E6D, 0, 0,0x5E6E, +0x5E6F,0x5E72, 0,0x5E70, 0,0x5E71, 0, 0, + 0, 0, 0,0x5E73,0x5E74, 0,0x5E75, 0, +0x5E76,0x5E77, 0, 0, 0,0x5E78, 0, 0, + 0, 0, 0,0x5E79, 0,0x5E7A,0x5E7B, 0, + 0, 0, 0,0x5E7C, 0, 0,0x5E7D, 0, + 0, 0, 0, 0, 0, 0,0x5E7E,0x5F21, + 0, 0, 0,0x5F22, 0, 0, 0, 0, +0x5F23, 0,0x5F24,0x5F25, 0, 0, 0, 0, + 0,0x5F26, 0,0x5F27,0x5F28, 0, 0, 0, + 0, 0, 0, 0,0x5F29}; + +/* page 35 0x8CB9-0x8D1B */ +static uint16 tab_uni_jisx021235[]={ +0x5F2A,0x5F2B, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5F2C,0x5F2D, 0, 0, +0x5F2E, 0,0x5F2F, 0, 0, 0,0x5F30, 0, + 0, 0, 0, 0,0x5F32,0x5F31, 0, 0, +0x5F33, 0, 0, 0,0x5F34, 0, 0, 0, +0x5F35, 0, 0, 0, 0, 0, 0,0x5F36, + 0, 0, 0,0x5F37, 0, 0,0x5F38,0x5F39, + 0,0x5F3A, 0,0x7467,0x5F3B, 0,0x5F3C,0x5F3D, + 0, 0, 0, 0, 0,0x5F3E,0x5F3F, 0, +0x5F40, 0,0x5F41, 0, 0, 0, 0, 0, +0x5F42, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F43, 0, 0, 0, 0,0x5F44, 0, + 0, 0,0x5F45}; + +/* page 36 0x8D65-0x8F65 */ +static uint16 tab_uni_jisx021236[]={ +0x5F46, 0, 0, 0,0x5F47, 0, 0,0x5F48, + 0,0x5F49, 0, 0, 0, 0, 0, 0, + 0,0x7468, 0, 0, 0, 0, 0, 0, + 0, 0,0x5F4A, 0, 0,0x5F4B, 0,0x5F4C, + 0, 0, 0,0x5F4D, 0, 0, 0, 0, +0x5F4E, 0, 0,0x5F4F,0x5F50, 0, 0, 0, +0x5F51, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F52,0x5F53,0x5F54, 0, 0, 0, 0, + 0,0x5F55, 0, 0, 0, 0,0x5F56,0x5F57, + 0, 0,0x5F58, 0, 0,0x5F59, 0, 0, +0x5F5A, 0,0x5F5B, 0,0x5F5C, 0,0x5F5D,0x5F6F, + 0, 0, 0,0x5F5E, 0, 0, 0, 0, +0x5F5F,0x5F60,0x5F61,0x5F62, 0,0x5F63, 0, 0, + 0,0x5F64, 0, 0,0x5F65, 0, 0,0x5F66, +0x5F67, 0,0x5F68, 0,0x5F69, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5F6A, +0x5F6B, 0,0x5F6C, 0, 0, 0, 0,0x5F6D, + 0, 0, 0,0x5F6E,0x5F70,0x5F71, 0,0x5F72, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F73, 0, 0, 0,0x5F74, 0, 0,0x5F75, +0x5F76,0x5F77, 0, 0, 0, 0,0x5F78, 0, + 0, 0, 0, 0,0x5F79, 0, 0,0x5F7A, + 0,0x5F7B, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5F7C,0x5F7D,0x5F7E,0x6021, 0, + 0,0x6022,0x6023, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6024, 0,0x6025, 0, + 0,0x6026,0x6027,0x6028,0x6029, 0, 0, 0, +0x602A, 0, 0,0x602B,0x602C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x602D, 0, +0x602E,0x602F,0x6030, 0, 0, 0, 0,0x6031, + 0, 0, 0, 0, 0, 0,0x6032,0x6033, +0x6034,0x6035, 0, 0,0x6036,0x6037, 0, 0, + 0, 0, 0, 0,0x6038, 0, 0,0x6039, +0x603A, 0,0x603B,0x603C,0x603D, 0, 0, 0, + 0, 0, 0, 0,0x603E,0x603F,0x6040, 0, + 0, 0, 0, 0, 0,0x6041,0x6042, 0, + 0, 0, 0, 0,0x6043, 0, 0, 0, + 0, 0, 0,0x6044, 0,0x6045, 0, 0, +0x6046, 0, 0, 0, 0,0x6047,0x6048, 0, +0x6049,0x604A, 0, 0, 0,0x604B, 0, 0, + 0, 0,0x604C, 0,0x604D, 0, 0, 0, +0x604E,0x604F, 0, 0, 0, 0,0x6050, 0, +0x6051, 0, 0, 0, 0,0x6052,0x6053, 0, + 0, 0, 0,0x6054,0x6055, 0,0x6056,0x6057, + 0, 0,0x6058, 0, 0, 0, 0, 0, + 0, 0,0x6059, 0,0x605A, 0, 0,0x605B, + 0, 0, 0, 0, 0, 0, 0,0x605C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x605D, 0, 0, 0, 0, +0x6064,0x605E, 0,0x605F,0x6060, 0, 0, 0, + 0, 0,0x6061, 0,0x6062,0x6063, 0, 0, + 0, 0, 0,0x6065, 0,0x6066, 0, 0, + 0, 0,0x6067,0x6068, 0, 0, 0, 0, + 0, 0,0x6069,0x606A, 0, 0, 0, 0, + 0,0x606B,0x606C,0x606D, 0, 0, 0, 0, + 0,0x606E, 0,0x606F,0x6070, 0,0x6071, 0, +0x6072, 0,0x6073,0x6074, 0, 0, 0,0x6075, +0x6076,0x6077, 0, 0, 0, 0, 0,0x6078, +0x6079,0x607A,0x607B, 0, 0,0x607C, 0, 0, + 0, 0, 0,0x607D,0x607E, 0,0x6121, 0, + 0, 0,0x6122, 0, 0, 0, 0, 0, + 0, 0,0x6123, 0,0x6124,0x6125,0x6126,0x6127, +0x6128, 0, 0,0x6129, 0, 0, 0, 0, +0x612A,0x612B, 0, 0, 0, 0, 0, 0, +0x612C}; + +/* page 37 0x8F9D-0x9484 */ +static uint16 tab_uni_jisx021237[]={ +0x612D, 0, 0,0x612E,0x612F, 0, 0,0x6130, +0x6131,0x6132, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6133,0x6134, 0,0x6135, 0, 0, 0, 0, + 0,0x6136, 0,0x6137,0x6138, 0, 0, 0, + 0,0x6139, 0, 0, 0,0x613A,0x613B, 0, +0x613C, 0, 0,0x613D, 0,0x613E,0x613F, 0, +0x6140, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6141, 0, 0,0x6142,0x6143, + 0, 0, 0,0x6144, 0, 0, 0, 0, + 0,0x6145, 0, 0,0x6146, 0, 0, 0, +0x6147,0x6148, 0, 0, 0, 0,0x6149, 0, + 0,0x614A, 0, 0, 0,0x614B, 0,0x614C, + 0, 0, 0,0x614D, 0, 0, 0,0x614E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x614F, 0, 0,0x6150, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6151,0x6152,0x6154, 0,0x6155, +0x6156, 0,0x6153, 0, 0, 0,0x6157,0x6158, + 0, 0,0x6159, 0, 0, 0, 0, 0, + 0, 0,0x615A, 0, 0, 0,0x615B,0x615C, + 0, 0, 0, 0, 0, 0, 0,0x615D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x615E, 0, +0x615F, 0, 0, 0, 0,0x6160, 0, 0, + 0,0x6161,0x6162, 0, 0, 0, 0,0x6163, + 0, 0, 0,0x6164, 0, 0, 0,0x6165, + 0, 0, 0, 0,0x6166, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6167, 0, 0,0x6168, 0, 0,0x6169,0x616A, + 0,0x616B, 0,0x616C, 0, 0, 0, 0, +0x616D, 0,0x616E,0x616F,0x6170, 0,0x6171, 0, + 0, 0, 0,0x6172,0x6173,0x6174, 0, 0, +0x6175, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6176, 0,0x6177,0x6178,0x6179, + 0,0x617A, 0, 0, 0, 0, 0, 0, +0x617B,0x617D, 0, 0, 0, 0,0x617E,0x6221, +0x6222, 0,0x6223,0x6224, 0, 0, 0,0x617C, + 0, 0, 0, 0, 0,0x622D, 0, 0, +0x6225, 0,0x6226,0x6227,0x6228, 0, 0,0x6229, +0x622A,0x746C,0x622B, 0, 0, 0, 0, 0, +0x622C, 0, 0, 0, 0, 0,0x622F, 0, + 0, 0,0x6230,0x6231, 0, 0, 0,0x6232, + 0,0x622E, 0, 0, 0, 0, 0, 0, + 0,0x6233,0x6234,0x6235, 0, 0, 0,0x6236, +0x6237,0x6238, 0,0x6239, 0, 0, 0, 0, +0x623A, 0, 0,0x623B, 0, 0, 0,0x623C, +0x746E,0x623D,0x623E,0x623F, 0,0x6240, 0,0x6241, + 0,0x6242, 0,0x6243, 0,0x6245,0x6246, 0, +0x6244, 0,0x6247, 0,0x6248, 0, 0, 0, + 0,0x6249,0x624A, 0,0x624B, 0, 0,0x624C, + 0,0x624D,0x624E, 0,0x624F,0x6250, 0,0x6251, +0x6252, 0, 0, 0, 0, 0,0x6253, 0, + 0, 0,0x6254,0x6255, 0, 0, 0, 0, + 0, 0,0x6256, 0, 0, 0,0x6257, 0, + 0, 0,0x6258, 0,0x6259,0x625A,0x625B, 0, + 0, 0, 0, 0,0x625C, 0, 0,0x625D, + 0, 0,0x625E, 0, 0, 0, 0, 0, +0x625F, 0, 0, 0, 0, 0, 0,0x6260, + 0, 0, 0, 0,0x6261,0x6262,0x6263, 0, + 0, 0, 0, 0,0x6264, 0,0x6265, 0, +0x6266,0x6267, 0, 0, 0,0x6268, 0, 0, + 0,0x6269, 0, 0,0x626A, 0,0x626B,0x626C, +0x626D, 0, 0,0x626E, 0, 0, 0, 0, + 0,0x626F, 0, 0,0x6270, 0, 0, 0, + 0,0x6271, 0,0x6272, 0, 0, 0,0x6273, +0x6274,0x6275, 0,0x6276,0x6277,0x6278,0x6279, 0, + 0,0x627A, 0, 0, 0, 0,0x627B,0x627C, +0x627D, 0,0x627E, 0, 0,0x6321,0x6322, 0, +0x6323, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6324,0x6325, + 0, 0,0x6326, 0,0x6327,0x6328, 0, 0, + 0,0x6329, 0, 0, 0, 0, 0,0x632A, +0x632B, 0, 0, 0,0x632C,0x632D, 0,0x632E, +0x632F,0x6330,0x6331,0x6332,0x6333, 0, 0, 0, + 0, 0,0x6334, 0,0x6335, 0,0x6336, 0, +0x6337, 0, 0,0x6338,0x6339, 0, 0,0x633A, +0x633B,0x633C,0x633D, 0,0x633E,0x633F, 0,0x6340, + 0, 0, 0,0x6341, 0,0x6342,0x6343, 0, + 0,0x6344, 0,0x6345, 0, 0, 0,0x6346, +0x6347, 0, 0, 0, 0, 0,0x6348,0x6349, +0x634A,0x634B, 0,0x634C, 0, 0, 0, 0, + 0,0x634D,0x634E,0x634F, 0, 0,0x6350, 0, +0x6351,0x6352, 0,0x6353,0x6354,0x6355, 0,0x6356, + 0,0x6357, 0,0x6358, 0,0x6359,0x635A, 0, + 0,0x635B,0x635C, 0, 0,0x635D, 0, 0, +0x635E,0x635F,0x6360, 0,0x6361, 0, 0, 0, + 0, 0, 0,0x6362,0x6363, 0, 0,0x6364, +0x6365, 0, 0,0x6366,0x6367, 0, 0, 0, +0x6368, 0,0x6369,0x636A,0x636B, 0, 0, 0, + 0,0x636C,0x636D,0x636E, 0, 0, 0, 0, +0x636F,0x6370,0x6371,0x6372,0x6373, 0,0x6374,0x6375, +0x6376, 0,0x6377, 0, 0, 0, 0, 0, + 0, 0, 0,0x6378,0x6379,0x637A, 0, 0, +0x637B,0x637C, 0, 0, 0,0x637D, 0, 0, + 0, 0,0x637E, 0,0x6421, 0, 0, 0, + 0, 0,0x6422,0x6423, 0, 0, 0,0x6424, +0x6425, 0,0x6426,0x6427, 0, 0,0x6428, 0, + 0, 0,0x6429, 0, 0,0x642A, 0, 0, + 0,0x642B, 0,0x642C, 0,0x642D,0x642E,0x642F, +0x6430, 0,0x6431,0x6432,0x6433,0x6434,0x6435, 0, +0x6436,0x6437,0x6438,0x6439, 0, 0,0x643A,0x643B, +0x643C,0x643D, 0,0x643E, 0, 0,0x643F, 0, +0x6440, 0,0x6441,0x6442,0x6443, 0, 0,0x6444, +0x6445, 0,0x6446,0x6447,0x6448, 0,0x6449, 0, +0x644A, 0,0x644B,0x644C, 0, 0, 0,0x644D, + 0,0x644E, 0,0x644F, 0, 0, 0, 0, + 0, 0, 0, 0,0x6450, 0,0x6451, 0, + 0, 0,0x6452,0x6453, 0,0x6454, 0, 0, + 0, 0, 0,0x6455, 0, 0, 0, 0, +0x6456, 0, 0, 0,0x6457, 0, 0,0x6458, +0x6459, 0, 0, 0, 0, 0, 0,0x645A, +0x645B,0x645C,0x645D, 0,0x645E, 0, 0,0x645F, +0x6460, 0,0x6461, 0,0x6462,0x6463, 0, 0, + 0, 0, 0, 0, 0, 0,0x6464,0x6465, + 0,0x6466,0x6467, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6468,0x6469,0x646A, 0, 0, 0, + 0, 0, 0,0x646B,0x646C,0x646D, 0, 0, +0x646E, 0,0x646F,0x6470, 0,0x6471, 0, 0, + 0,0x6472, 0, 0, 0, 0, 0,0x6473, +0x6474, 0,0x6475, 0,0x6476,0x6477, 0, 0, +0x6478, 0,0x6479,0x647A,0x647B, 0,0x647C,0x647D, + 0,0x647E, 0, 0, 0,0x6521, 0, 0, +0x6522, 0,0x6523,0x6524,0x6525,0x6526, 0, 0, + 0, 0, 0,0x6527, 0,0x6528,0x6529, 0, +0x652A, 0,0x652B, 0, 0,0x652C, 0, 0, +0x652D, 0, 0,0x652E, 0, 0,0x652F, 0, + 0,0x6530, 0, 0,0x6531, 0,0x6532,0x6533, + 0,0x6534, 0,0x6535,0x653B, 0,0x6536, 0, + 0, 0, 0, 0, 0, 0, 0,0x6537, +0x6538,0x6539, 0, 0, 0,0x653A, 0, 0, + 0, 0, 0, 0,0x653C, 0, 0,0x653D, +0x653E,0x653F,0x6540, 0,0x6541,0x6542,0x6543,0x6544, +0x6545, 0, 0, 0, 0, 0,0x6546, 0, + 0, 0, 0, 0,0x6547, 0, 0,0x6548, + 0,0x6549,0x654A, 0, 0,0x654B, 0, 0, + 0,0x654C,0x654D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x654F,0x6550,0x654E,0x6551,0x6552, 0, +0x6553, 0, 0, 0,0x6554,0x6555, 0,0x6556, + 0, 0, 0,0x6557,0x6558, 0, 0, 0, +0x6559,0x655A,0x655B, 0, 0, 0, 0, 0, +0x655C,0x655D,0x655E, 0, 0, 0, 0, 0, + 0, 0,0x655F, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6560,0x6561, 0,0x6562,0x6563,0x6564,0x6565, + 0, 0, 0, 0, 0, 0,0x6566, 0, +0x6568, 0,0x6567, 0, 0, 0,0x6569, 0, +0x656A, 0, 0,0x656B, 0,0x656C, 0,0x656D, + 0, 0, 0, 0, 0, 0, 0, 0, +0x656E, 0, 0, 0,0x656F, 0, 0,0x6570, + 0, 0,0x6571, 0,0x6572, 0,0x6573, 0, + 0, 0, 0,0x6574, 0, 0,0x6575, 0, +0x6576,0x6577,0x6578, 0,0x6579,0x657A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x657C,0x657B +}; + +/* page 38 0x9578-0x95E6 */ +static uint16 tab_uni_jisx021238[]={ +0x657D,0x657E, 0, 0, 0, 0,0x6621, 0, + 0, 0, 0, 0,0x6622, 0, 0, 0, +0x6623, 0, 0, 0,0x6624,0x6625,0x6626, 0, + 0, 0,0x7471, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6627,0x6628,0x6629, + 0,0x662A, 0, 0, 0, 0,0x662B, 0, + 0,0x662C, 0,0x662D,0x662E, 0, 0, 0, + 0, 0, 0, 0,0x662F, 0,0x6630, 0, + 0, 0,0x6631, 0, 0,0x6632, 0,0x6633, + 0, 0, 0, 0, 0, 0,0x6634, 0, +0x6635,0x6636, 0,0x6637, 0, 0, 0, 0, +0x6638,0x6639,0x663A,0x663B, 0, 0, 0, 0, + 0,0x663C,0x663D, 0, 0,0x663E,0x663F,0x6640, +0x6641, 0, 0, 0,0x6642, 0,0x6643}; + +/* page 39 0x961D-0x986C */ +static uint16 tab_uni_jisx021239[]={ +0x6644,0x6645, 0, 0, 0,0x6646, 0,0x6647, +0x6648,0x6649, 0, 0, 0, 0, 0,0x664A, + 0, 0, 0, 0,0x664B, 0,0x664C, 0, + 0, 0,0x664D,0x664E,0x664F,0x6650, 0,0x6651, +0x6652, 0, 0, 0,0x6653, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6654, 0,0x6655, + 0,0x6656,0x6657,0x6658, 0, 0, 0, 0, + 0, 0, 0, 0,0x6659, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x665A, 0, 0, 0, 0, 0,0x665B, + 0, 0, 0, 0, 0, 0,0x665C,0x665D, + 0,0x665E,0x665F, 0,0x6660,0x6661,0x6662,0x6663, + 0, 0, 0, 0,0x6664, 0, 0, 0, + 0, 0, 0, 0,0x6665, 0, 0, 0, + 0,0x6666, 0, 0, 0,0x6667, 0, 0, +0x6668, 0,0x6669, 0, 0, 0, 0,0x666A, +0x666B,0x666C, 0, 0,0x666D, 0, 0, 0, + 0,0x666E,0x666F, 0, 0, 0,0x6670, 0, + 0, 0, 0, 0, 0,0x6671, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6672, 0, 0, + 0, 0, 0, 0, 0,0x6673, 0, 0, + 0, 0, 0,0x6675, 0,0x6676, 0, 0, +0x6677,0x6678,0x6679, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x667A, 0, 0, 0, + 0, 0,0x667B, 0,0x667C, 0, 0, 0, + 0, 0, 0, 0, 0,0x667D, 0, 0, + 0, 0, 0, 0, 0,0x667E,0x6721, 0, +0x6722, 0, 0, 0,0x6723, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6724,0x6725, 0, +0x6726, 0, 0, 0,0x6727,0x6728,0x6729, 0, + 0, 0, 0,0x672A, 0, 0, 0, 0, + 0, 0, 0, 0,0x672B, 0,0x672C, 0, + 0, 0, 0, 0, 0, 0,0x7474, 0, + 0, 0, 0, 0,0x672D, 0,0x672E, 0, + 0, 0, 0, 0, 0,0x672F, 0, 0, +0x7475,0x6730,0x6731, 0,0x7476, 0, 0, 0, +0x6732, 0,0x6733,0x6734, 0,0x6735,0x6736, 0, + 0, 0, 0, 0, 0, 0,0x6737, 0, + 0, 0,0x6738, 0, 0,0x6739, 0, 0, + 0,0x673A, 0, 0, 0, 0,0x673B, 0, + 0,0x673C,0x673D,0x673E, 0, 0,0x673F, 0, +0x6740, 0,0x6741,0x6742, 0, 0, 0, 0, + 0, 0, 0, 0,0x6743, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6744,0x6745,0x6746, 0,0x6747,0x6748, 0, 0, + 0,0x6749,0x674A, 0, 0,0x674B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x674C, + 0,0x674D, 0, 0,0x674E,0x674F, 0, 0, +0x6750,0x6751, 0,0x6752,0x6753,0x6754, 0,0x6755, + 0,0x6756,0x6757, 0,0x6758, 0, 0,0x6759, +0x675A, 0,0x675B, 0,0x675C,0x675D, 0,0x675E, +0x675F,0x6760, 0,0x6761,0x6762, 0, 0,0x6763, + 0, 0,0x6764,0x6765,0x6766, 0,0x676A, 0, +0x6767,0x6768, 0,0x6769,0x676B, 0, 0,0x676C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x676D, 0,0x676E, 0, 0,0x676F, + 0, 0,0x6770,0x6771, 0,0x6772, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6773, 0, 0,0x6774, 0, 0, +0x6776,0x6777, 0, 0, 0, 0, 0,0x6778, + 0,0x6779, 0, 0,0x6775, 0, 0,0x677A, + 0,0x677B, 0,0x677C, 0, 0,0x677D, 0, +0x6828,0x677E, 0, 0, 0, 0,0x6821, 0, + 0,0x6822,0x6823,0x6824, 0,0x6825,0x6826, 0, +0x6827, 0, 0, 0, 0, 0, 0, 0, + 0,0x6829, 0, 0, 0, 0, 0,0x682A, + 0, 0,0x682B, 0, 0,0x682C, 0, 0, + 0, 0, 0, 0,0x682D,0x682E,0x682F, 0, + 0,0x6830,0x6831, 0,0x6832,0x6833, 0, 0, + 0, 0, 0, 0, 0,0x6834,0x6835, 0, +0x6836,0x6837, 0, 0, 0,0x6838, 0,0x6839 +}; + +/* page 40 0x98AB-0x98CC */ +static uint16 tab_uni_jisx021240[]={ +0x683A, 0,0x683B,0x683C, 0,0x683D, 0, 0, + 0,0x683E, 0, 0,0x683F,0x6840, 0,0x6841, +0x6842, 0, 0, 0,0x6843, 0, 0,0x6844, + 0, 0,0x6845, 0, 0,0x6846, 0, 0, + 0,0x6847}; + +/* page 41 0x98E1-0x9960 */ +static uint16 tab_uni_jisx021241[]={ +0x6848, 0,0x6849, 0,0x684A,0x684B,0x684C, 0, + 0,0x684D, 0, 0, 0, 0, 0, 0, + 0, 0,0x684E, 0, 0,0x684F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6850, 0, 0, 0, 0,0x6851,0x6852, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6853, 0, 0, 0,0x6854,0x6855,0x6856, 0, + 0,0x6857,0x6858,0x6859, 0, 0,0x685A, 0, + 0,0x685B, 0, 0, 0,0x685C,0x685D, 0, + 0, 0,0x685E, 0, 0, 0, 0, 0, +0x685F,0x6860,0x6861,0x6862,0x6863, 0, 0, 0, +0x6864,0x6865,0x6866,0x6867, 0, 0, 0,0x6868, +0x6869, 0, 0, 0, 0,0x686A,0x686B,0x686C, + 0, 0, 0, 0,0x686D,0x686E, 0, 0, + 0, 0, 0,0x686F, 0, 0, 0,0x6870, +0x6871, 0,0x6872,0x6873, 0,0x6874,0x6875,0x6876 +}; + +/* page 42 0x999B-0x9A5D */ +static uint16 tab_uni_jisx021242[]={ +0x6877, 0,0x6878,0x747A,0x6879, 0, 0, 0, + 0, 0, 0,0x687A, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x687B,0x687C,0x687D, + 0, 0,0x687E, 0, 0, 0,0x6921,0x6922, + 0, 0,0x6923, 0,0x6924, 0, 0, 0, +0x6925, 0, 0, 0, 0, 0,0x6926, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6927,0x6928, 0, 0, 0, 0,0x6929,0x692A, + 0,0x692B, 0,0x692C, 0, 0, 0, 0, + 0, 0, 0, 0,0x692D, 0, 0,0x692E, +0x692F,0x6930, 0, 0, 0,0x6931, 0, 0, + 0,0x6932,0x6933, 0, 0, 0,0x6934, 0, + 0, 0,0x6935,0x6936, 0, 0, 0,0x6937, +0x6938,0x6939, 0, 0, 0, 0, 0, 0, +0x693A,0x693B, 0, 0, 0,0x693C,0x693D, 0, + 0, 0, 0,0x693E, 0, 0, 0, 0, + 0, 0, 0,0x693F, 0,0x6940, 0,0x6941, +0x6942,0x6943, 0, 0,0x6944, 0, 0, 0, + 0, 0,0x6945,0x6946, 0, 0, 0, 0, +0x6947, 0,0x6948,0x6949, 0,0x694A, 0, 0, + 0, 0, 0, 0, 0, 0,0x694C, 0, + 0,0x694D, 0, 0,0x694B, 0, 0,0x694E, +0x694F,0x6950, 0,0x6951, 0, 0,0x6952, 0, + 0,0x6953, 0,0x6954, 0, 0, 0, 0, + 0, 0,0x6955}; + +/* page 43 0x9AAA-0x9C7B */ +static uint16 tab_uni_jisx021243[]={ +0x6956, 0,0x6957, 0,0x6958,0x6959, 0, 0, +0x695A, 0,0x695B,0x695C,0x695D, 0, 0,0x695E, + 0,0x695F, 0, 0,0x6960,0x6961, 0,0x6962, + 0,0x6963, 0, 0,0x6964, 0,0x6965, 0, + 0, 0, 0, 0,0x6966, 0,0x6967, 0, +0x6968, 0, 0,0x6969,0x696A,0x696B, 0,0x747B, + 0,0x696C,0x696D, 0, 0, 0,0x696E, 0, + 0, 0,0x696F,0x6970, 0,0x6971, 0,0x6972, + 0, 0,0x6973, 0, 0, 0, 0, 0, +0x6974,0x6975, 0,0x6976, 0, 0, 0,0x6977, +0x6978, 0, 0,0x6979, 0,0x697A,0x697B,0x697C, +0x697D,0x697E,0x6A21,0x6A22, 0, 0,0x6A23,0x6A24, + 0,0x6A25,0x6A26,0x6A27,0x6A28, 0,0x6A29, 0, +0x6A2A, 0, 0, 0,0x6A2B, 0, 0,0x6A2C, + 0,0x6A2D,0x6A2E, 0, 0, 0,0x6A2F, 0, + 0, 0, 0, 0,0x6A30, 0, 0, 0, + 0,0x6A31, 0,0x6A32, 0, 0, 0, 0, + 0,0x6A33,0x6A34,0x6A35, 0,0x6A36, 0,0x6A37, +0x6A38, 0, 0,0x6A39, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A3A, 0, + 0,0x6A3B,0x6A3C, 0, 0, 0, 0, 0, + 0, 0, 0,0x6A3D,0x6A3E,0x6A3F, 0, 0, + 0,0x6A40, 0, 0,0x6A41, 0, 0,0x6A42, + 0,0x6A43, 0,0x6A44,0x6A45, 0,0x6A46, 0, +0x6A47,0x6A48,0x6A49,0x6A4A,0x6A4B, 0, 0, 0, +0x747C,0x6A4C, 0,0x6A4D, 0,0x6A4E,0x6A4F,0x6A50, + 0, 0, 0, 0, 0,0x6A51,0x6A52, 0, + 0, 0,0x6A53,0x6A54,0x6A55,0x6A56, 0,0x6A57, +0x6A58,0x6A59, 0,0x6A5A, 0,0x6A5B,0x6A5C, 0, + 0, 0,0x6A5D, 0, 0, 0, 0, 0, +0x6A5E, 0, 0,0x6A5F,0x6A60, 0, 0, 0, + 0, 0, 0, 0,0x6A61,0x6A62, 0,0x6A63, + 0, 0,0x6A64, 0, 0, 0,0x6A65,0x6A66, +0x6A67, 0, 0, 0, 0,0x6A68,0x6A69, 0, + 0,0x6A6A,0x6A6B, 0,0x6A6C,0x6A6D, 0,0x6A6E, + 0, 0, 0, 0, 0,0x6A6F,0x6A70, 0, + 0, 0, 0, 0,0x6A71, 0,0x6A72, 0, + 0, 0, 0, 0, 0,0x6A73,0x6A74, 0, + 0, 0, 0,0x6A75, 0,0x6A76, 0, 0, + 0, 0, 0,0x6A77, 0,0x6A78, 0, 0, +0x6A79,0x6A7A, 0, 0, 0,0x6A7B, 0, 0, + 0,0x6A7C, 0, 0, 0,0x6A7D,0x6A7E,0x6B21, +0x6B22, 0, 0,0x6B23, 0,0x6B24,0x6B25, 0, +0x6B26, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B27, 0, 0, 0,0x6B28, 0,0x6B29, + 0, 0, 0, 0,0x6B2A, 0,0x6B2B,0x6B2C, +0x6B2D, 0,0x6B2E, 0,0x6B2F, 0, 0, 0, +0x6B30,0x6B31, 0, 0,0x6B32,0x6B33,0x6B34,0x6B35, +0x6B36, 0, 0, 0, 0, 0, 0,0x6B37, + 0, 0, 0,0x6B38,0x6B39,0x6B3A, 0, 0, + 0, 0, 0,0x6B3B, 0, 0, 0,0x6B3C, + 0,0x6B3D,0x6B3E,0x6B3F, 0, 0, 0,0x6B40, +0x6B41, 0, 0, 0,0x6B42,0x6B43,0x6B44, 0, + 0,0x6B45,0x6B46, 0,0x6B47, 0,0x6B48, 0, + 0,0x6B49,0x6B50,0x6B4A,0x6B4B,0x6B4C, 0, 0, + 0,0x6B4D, 0, 0, 0, 0,0x6B52,0x6B4E, +0x6B4F,0x6B51, 0, 0,0x6B53, 0,0x6B54, 0, +0x6B55, 0, 0,0x6B56, 0,0x6B57, 0, 0, + 0,0x6B58}; + +/* page 44 0x9CE6-0x9E1D */ +static uint16 tab_uni_jisx021244[]={ +0x6B59, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6B5A, 0, 0, 0, + 0,0x6B5B, 0,0x6B5C, 0, 0, 0, 0, + 0, 0, 0, 0,0x6B5E, 0, 0, 0, + 0, 0, 0, 0, 0,0x6B5D, 0, 0, + 0, 0, 0,0x6B5F, 0, 0, 0, 0, + 0,0x6B60,0x6B61, 0, 0, 0,0x6B62,0x6B63, +0x6B64, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B65,0x6B66, 0,0x6B67,0x6B68,0x6B69, 0, + 0, 0, 0, 0,0x6B6A, 0,0x6B6B,0x6B6D, + 0, 0, 0, 0,0x6B6E,0x6B6F, 0,0x6B6C, + 0,0x6B70, 0, 0,0x6B71, 0, 0, 0, + 0, 0, 0, 0, 0,0x6B72,0x6B73, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B74, 0, 0,0x6B76,0x6B75, 0,0x6B77, + 0, 0, 0,0x6B78,0x6B79,0x6B7A, 0, 0, + 0, 0,0x6B7B, 0, 0, 0, 0, 0, +0x6B7C,0x6B7D, 0, 0, 0,0x6B7E,0x6C21, 0, +0x6C22, 0, 0, 0, 0,0x6C23,0x6C24, 0, +0x6C25, 0, 0, 0,0x6C26, 0, 0,0x6C27, +0x6C28, 0, 0, 0,0x6C29,0x6C2A, 0,0x6C2B, +0x6C2C,0x6C2D,0x6C2E, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C2F, 0, 0, 0, 0, + 0, 0, 0, 0,0x6C30, 0,0x6C31, 0, +0x6C32, 0, 0,0x6C33, 0, 0, 0,0x6C34, + 0, 0, 0,0x6C35, 0, 0,0x6C36, 0, + 0,0x6C37, 0, 0, 0,0x6C38, 0, 0, + 0,0x6C39, 0,0x6C3A,0x6C3B, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6C3C,0x6C3D, +0x6C3E,0x6C3F, 0, 0,0x6C40, 0, 0, 0, +0x6C41,0x6C42,0x6C43, 0, 0, 0, 0,0x6C44, + 0,0x6C45, 0,0x6C46, 0,0x6C47, 0, 0, +0x6C48, 0,0x6C49, 0, 0,0x6C4A,0x6C4B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C4C, 0, 0, 0,0x6C4E, 0, 0, 0, + 0,0x6C4F, 0, 0,0x6C4D, 0, 0, 0, +0x6C50, 0,0x6C51,0x6C52,0x6C53, 0, 0,0x6C54, +0x6C55, 0, 0,0x6C56, 0, 0,0x6C57,0x6C58 +}; + +/* page 45 0x9E7A-0x9FA5 */ +static uint16 tab_uni_jisx021245[]={ +0x6C59,0x6C5A,0x6C5B, 0, 0, 0,0x6C5C, 0, +0x6C5D,0x6C5E,0x6C5F,0x6C60, 0,0x6C61, 0, 0, + 0, 0, 0, 0,0x6C62,0x6C63, 0, 0, + 0, 0, 0, 0,0x6C64, 0,0x6C65, 0, + 0,0x6C66, 0, 0,0x6C67, 0, 0, 0, + 0, 0,0x6C68, 0, 0, 0,0x6C69, 0, + 0, 0,0x6C6A, 0,0x6C6B,0x6C6C,0x6C6D, 0, + 0,0x6C6E,0x6C6F,0x6C70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6C71, 0,0x6C72, 0, + 0,0x6C73, 0, 0, 0, 0, 0,0x747E, + 0, 0, 0,0x6C74, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C75, 0, 0, + 0, 0,0x6C76, 0, 0,0x6C77, 0, 0, + 0, 0,0x6C78,0x6C79,0x6C7A, 0,0x6C7B,0x6C7C, +0x6C7D, 0, 0,0x6C7E, 0, 0,0x6D21, 0, + 0, 0, 0, 0, 0,0x6D22, 0, 0, +0x6D23,0x6D24, 0, 0, 0, 0, 0,0x6D25, + 0, 0, 0, 0, 0,0x6D26,0x6D27,0x6D28, +0x6D29, 0,0x6D2A, 0,0x6D2B,0x6D2C, 0,0x6D2D, +0x6D2E,0x6D2F, 0, 0, 0,0x6D30, 0, 0, +0x6D31, 0, 0, 0,0x6D32, 0, 0, 0, +0x6D33,0x6D34, 0, 0, 0,0x6D35, 0,0x6D36, +0x6D37, 0,0x6D38, 0, 0,0x6D39, 0,0x6D3A, +0x6D3B, 0,0x6D3C,0x6D3D, 0,0x6D3E, 0,0x6D3F, + 0,0x6D40,0x6D41,0x6D42,0x6D43,0x6D44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6D45, 0,0x6D46,0x6D47,0x6D48,0x6D49, 0, +0x6D4A, 0, 0,0x6D4B,0x6D4C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D4D,0x6D4E, + 0, 0, 0,0x6D4F,0x6D50,0x6D51,0x6D52,0x6D53, + 0,0x6D54, 0,0x6D55, 0, 0, 0, 0, +0x6D56, 0, 0,0x6D57, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6D58,0x6D59,0x6D5A, +0x6D5B, 0,0x6D5C, 0,0x6D5D,0x6D5E, 0, 0, + 0, 0, 0, 0,0x6D5F, 0, 0,0x6D60, +0x6D61,0x6D62, 0,0x6D63}; + +/* page 46 0xF929-0xF929 */ +static uint16 tab_uni_jisx021246[]={ +0x7445}; + +/* page 47 0xF9DC-0xF9DC */ +static uint16 tab_uni_jisx021247[]={ +0x7472}; + +/* page 48 0xFA00-0xFA2D */ +static uint16 tab_uni_jisx021248[]={ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7434,0x7437, +0x7438,0x743D,0x7444,0x7447,0x7448,0x744E,0x744F,0x7453, +0x7455,0x7456,0x7457,0x7458,0x745A,0x745B,0x745E,0x7460, +0x7462,0x7463,0x7465,0x7469,0x746A,0x746B,0x746D,0x746F, +0x7470,0x7473,0x7477,0x7478,0x7479,0x747D}; + +/* page 49 0xFF00-0XFF07 */ +static uint16 tab_uni_jisx021249[]={ + 0, 0,0x742A, 0, 0, 0, 0,0x7429}; + +/* page 50 0xFFE4-0xFFE4 */ +static uint16 tab_uni_jisx021250[]={ +0x2243}; + +static int +my_uni_jisx0212_onechar(int code){ + if ((code>=0x007E)&&(code<=0x007E)) + return(tab_uni_jisx02120[code-0x007E]); + if ((code>=0x00A1)&&(code<=0x017E)) + return(tab_uni_jisx02121[code-0x00A1]); + if ((code>=0x01CD)&&(code<=0x01DC)) + return(tab_uni_jisx02122[code-0x01CD]); + if ((code>=0x01F5)&&(code<=0x01F5)) + return(tab_uni_jisx02123[code-0x01F5]); + if ((code>=0x02C7)&&(code<=0x02DD)) + return(tab_uni_jisx02124[code-0x02C7]); + if ((code>=0x0384)&&(code<=0x0390)) + return(tab_uni_jisx02125[code-0x0384]); + if ((code>=0x03AA)&&(code<=0x03CE)) + return(tab_uni_jisx02126[code-0x03AA]); + if ((code>=0x0402)&&(code<=0x040F)) + return(tab_uni_jisx02127[code-0x0402]); + if ((code>=0x0452)&&(code<=0x045F)) + return(tab_uni_jisx02128[code-0x0452]); + if ((code>=0x2122)&&(code<=0x2122)) + return(tab_uni_jisx02129[code-0x2122]); + if ((code>=0x2170)&&(code<=0x2179)) + return(tab_uni_jisx021210[code-0x2170]); + if ((code>=0x4E02)&&(code<=0x4F19)) + return(tab_uni_jisx021211[code-0x4E02]); + if ((code>=0x4F2E)&&(code<=0x5166)) + return(tab_uni_jisx021212[code-0x4F2E]); + if ((code>=0x517E)&&(code<=0x5515)) + return(tab_uni_jisx021213[code-0x517E]); + if ((code>=0x552A)&&(code<=0x5566)) + return(tab_uni_jisx021214[code-0x552A]); + if ((code>=0x557F)&&(code<=0x5C36)) + return(tab_uni_jisx021215[code-0x557F]); + if ((code>=0x5C59)&&(code<=0x5EEB)) + return(tab_uni_jisx021216[code-0x5C59]); + if ((code>=0x5F02)&&(code<=0x6149)) + return(tab_uni_jisx021217[code-0x5F02]); + if ((code>=0x615E)&&(code<=0x6290)) + return(tab_uni_jisx021218[code-0x615E]); + if ((code>=0x62A6)&&(code<=0x679B)) + return(tab_uni_jisx021219[code-0x62A6]); + if ((code>=0x67B0)&&(code<=0x6801)) + return(tab_uni_jisx021220[code-0x67B0]); + if ((code>=0x6814)&&(code<=0x6917)) + return(tab_uni_jisx021221[code-0x6814]); + if ((code>=0x6931)&&(code<=0x6D3F)) + return(tab_uni_jisx021222[code-0x6931]); + if ((code>=0x6D57)&&(code<=0x6E04)) + return(tab_uni_jisx021223[code-0x6D57]); + if ((code>=0x6E1E)&&(code<=0x6ECF)) + return(tab_uni_jisx021224[code-0x6E1E]); + if ((code>=0x6EEB)&&(code<=0x70E4)) + return(tab_uni_jisx021225[code-0x6EEB]); + if ((code>=0x70FA)&&(code<=0x71DC)) + return(tab_uni_jisx021226[code-0x70FA]); + if ((code>=0x71F8)&&(code<=0x7E9E)) + return(tab_uni_jisx021227[code-0x71F8]); + if ((code>=0x7F3B)&&(code<=0x8044)) + return(tab_uni_jisx021228[code-0x7F3B]); + if ((code>=0x8060)&&(code<=0x8362)) + return(tab_uni_jisx021229[code-0x8060]); + if ((code>=0x8370)&&(code<=0x8419)) + return(tab_uni_jisx021230[code-0x8370]); + if ((code>=0x842F)&&(code<=0x8880)) + return(tab_uni_jisx021231[code-0x842F]); + if ((code>=0x8898)&&(code<=0x89BC)) + return(tab_uni_jisx021232[code-0x8898]); + if ((code>=0x89D4)&&(code<=0x8B9F)) + return(tab_uni_jisx021233[code-0x89D4]); + if ((code>=0x8C38)&&(code<=0x8CA4)) + return(tab_uni_jisx021234[code-0x8C38]); + if ((code>=0x8CB9)&&(code<=0x8D1B)) + return(tab_uni_jisx021235[code-0x8CB9]); + if ((code>=0x8D65)&&(code<=0x8F65)) + return(tab_uni_jisx021236[code-0x8D65]); + if ((code>=0x8F9D)&&(code<=0x9484)) + return(tab_uni_jisx021237[code-0x8F9D]); + if ((code>=0x9578)&&(code<=0x95E6)) + return(tab_uni_jisx021238[code-0x9578]); + if ((code>=0x961D)&&(code<=0x986C)) + return(tab_uni_jisx021239[code-0x961D]); + if ((code>=0x98AB)&&(code<=0x98CC)) + return(tab_uni_jisx021240[code-0x98AB]); + if ((code>=0x98E1)&&(code<=0x9960)) + return(tab_uni_jisx021241[code-0x98E1]); + if ((code>=0x999B)&&(code<=0x9A5D)) + return(tab_uni_jisx021242[code-0x999B]); + if ((code>=0x9AAA)&&(code<=0x9C7B)) + return(tab_uni_jisx021243[code-0x9AAA]); + if ((code>=0x9CE6)&&(code<=0x9E1D)) + return(tab_uni_jisx021244[code-0x9CE6]); + if ((code>=0x9E7A)&&(code<=0x9FA5)) + return(tab_uni_jisx021245[code-0x9E7A]); + if ((code>=0xF929)&&(code<=0xF929)) + return(tab_uni_jisx021246[code-0xF929]); + if ((code>=0xF9DC)&&(code<=0xF9DC)) + return(tab_uni_jisx021247[code-0xF9DC]); + if ((code>=0xFA00)&&(code<=0xFA2D)) + return(tab_uni_jisx021248[code-0xFA00]); + if ((code>=0xFF00)&&(code<=0xFF07)) + return(tab_uni_jisx021249[code-0xFF00]); + if ((code>=0xFFE4)&&(code<=0xFFE4)) + return(tab_uni_jisx021250[code-0xFFE4]); + return(0); +} + +/* page 0 0x222F-0x2244 */ +static uint16 tab_jisx0212_uni0[]={ +0x02D8,0x02C7,0x00B8,0x02D9,0x02DD,0x00AF,0x02DB,0x02DA, +0xFF5E,0x0384,0x0385, 0, 0, 0, 0, 0, + 0, 0, 0,0x00A1,0xFFE4,0x00BF}; + +/* page 1 0x226B-0x2271 */ +static uint16 tab_jisx0212_uni1[]={ +0x00BA,0x00AA,0x00A9,0x00AE,0x2122,0x00A4,0x2116}; + +/* page 2 0x2661-0x267C */ +static uint16 tab_jisx0212_uni2[]={ +0x0386,0x0388,0x0389,0x038A,0x03AA, 0,0x038C, 0, +0x038E,0x03AB, 0,0x038F, 0, 0, 0, 0, +0x03AC,0x03AD,0x03AE,0x03AF,0x03CA,0x0390,0x03CC,0x03C2, +0x03CD,0x03CB,0x03B0,0x03CE}; + +/* page 3 0x2742-0x274E */ +static uint16 tab_jisx0212_uni3[]={ +0x0402,0x0403,0x0404,0x0405,0x0406,0x0407,0x0408,0x0409, +0x040A,0x040B,0x040C,0x040E,0x040F}; + +/* page 4 0x2772-0x277E */ +static uint16 tab_jisx0212_uni4[]={ +0x0452,0x0453,0x0454,0x0455,0x0456,0x0457,0x0458,0x0459, +0x045A,0x045B,0x045C,0x045E,0x045F}; + +/* page 5 0x2921-0x2950 */ +static uint16 tab_jisx0212_uni5[]={ +0x00C6,0x0110, 0,0x0126, 0,0x0132, 0,0x0141, +0x013F, 0,0x014A,0x00D8,0x0152, 0,0x0166,0x00DE, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x00E6,0x0111,0x00F0,0x0127,0x0131,0x0133,0x0138,0x0142, +0x0140,0x0149,0x014B,0x00F8,0x0153,0x00DF,0x0167,0x00FE +}; + +/* page 6 0x2A21-0x2A77 */ +static uint16 tab_jisx0212_uni6[]={ +0x00C1,0x00C0,0x00C4,0x00C2,0x0102,0x01CD,0x0100,0x0104, +0x00C5,0x00C3,0x0106,0x0108,0x010C,0x00C7,0x010A,0x010E, +0x00C9,0x00C8,0x00CB,0x00CA,0x011A,0x0116,0x0112,0x0118, + 0,0x011C,0x011E,0x0122,0x0120,0x0124,0x00CD,0x00CC, +0x00CF,0x00CE,0x01CF,0x0130,0x012A,0x012E,0x0128,0x0134, +0x0136,0x0139,0x013D,0x013B,0x0143,0x0147,0x0145,0x00D1, +0x00D3,0x00D2,0x00D6,0x00D4,0x01D1,0x0150,0x014C,0x00D5, +0x0154,0x0158,0x0156,0x015A,0x015C,0x0160,0x015E,0x0164, +0x0162,0x00DA,0x00D9,0x00DC,0x00DB,0x016C,0x01D3,0x0170, +0x016A,0x0172,0x016E,0x0168,0x01D7,0x01DB,0x01D9,0x01D5, +0x0174,0x00DD,0x0178,0x0176,0x0179,0x017D,0x017B}; + +/* page 7 0x2B21-0x2B77 */ +static uint16 tab_jisx0212_uni7[]={ +0x00E1,0x00E0,0x00E4,0x00E2,0x0103,0x01CE,0x0101,0x0105, +0x00E5,0x00E3,0x0107,0x0109,0x010D,0x00E7,0x010B,0x010F, +0x00E9,0x00E8,0x00EB,0x00EA,0x011B,0x0117,0x0113,0x0119, +0x01F5,0x011D,0x011F, 0,0x0121,0x0125,0x00ED,0x00EC, +0x00EF,0x00EE,0x01D0, 0,0x012B,0x012F,0x0129,0x0135, +0x0137,0x013A,0x013E,0x013C,0x0144,0x0148,0x0146,0x00F1, +0x00F3,0x00F2,0x00F6,0x00F4,0x01D2,0x0151,0x014D,0x00F5, +0x0155,0x0159,0x0157,0x015B,0x015D,0x0161,0x015F,0x0165, +0x0163,0x00FA,0x00F9,0x00FC,0x00FB,0x016D,0x01D4,0x0171, +0x016B,0x0173,0x016F,0x0169,0x01D8,0x01DC,0x01DA,0x01D6, +0x0175,0x00FD,0x00FF,0x0177,0x017A,0x017E,0x017C}; + +/* page 8 0x3021-0x307E */ +static uint16 tab_jisx0212_uni8[]={ +0x4E02,0x4E04,0x4E05,0x4E0C,0x4E12,0x4E1F,0x4E23,0x4E24, +0x4E28,0x4E2B,0x4E2E,0x4E2F,0x4E30,0x4E35,0x4E40,0x4E41, +0x4E44,0x4E47,0x4E51,0x4E5A,0x4E5C,0x4E63,0x4E68,0x4E69, +0x4E74,0x4E75,0x4E79,0x4E7F,0x4E8D,0x4E96,0x4E97,0x4E9D, +0x4EAF,0x4EB9,0x4EC3,0x4ED0,0x4EDA,0x4EDB,0x4EE0,0x4EE1, +0x4EE2,0x4EE8,0x4EEF,0x4EF1,0x4EF3,0x4EF5,0x4EFD,0x4EFE, +0x4EFF,0x4F00,0x4F02,0x4F03,0x4F08,0x4F0B,0x4F0C,0x4F12, +0x4F15,0x4F16,0x4F17,0x4F19,0x4F2E,0x4F31,0x4F60,0x4F33, +0x4F35,0x4F37,0x4F39,0x4F3B,0x4F3E,0x4F40,0x4F42,0x4F48, +0x4F49,0x4F4B,0x4F4C,0x4F52,0x4F54,0x4F56,0x4F58,0x4F5F, +0x4F63,0x4F6A,0x4F6C,0x4F6E,0x4F71,0x4F77,0x4F78,0x4F79, +0x4F7A,0x4F7D,0x4F7E,0x4F81,0x4F82,0x4F84}; + +/* page 9 0x3121-0x317E */ +static uint16 tab_jisx0212_uni9[]={ +0x4F85,0x4F89,0x4F8A,0x4F8C,0x4F8E,0x4F90,0x4F92,0x4F93, +0x4F94,0x4F97,0x4F99,0x4F9A,0x4F9E,0x4F9F,0x4FB2,0x4FB7, +0x4FB9,0x4FBB,0x4FBC,0x4FBD,0x4FBE,0x4FC0,0x4FC1,0x4FC5, +0x4FC6,0x4FC8,0x4FC9,0x4FCB,0x4FCC,0x4FCD,0x4FCF,0x4FD2, +0x4FDC,0x4FE0,0x4FE2,0x4FF0,0x4FF2,0x4FFC,0x4FFD,0x4FFF, +0x5000,0x5001,0x5004,0x5007,0x500A,0x500C,0x500E,0x5010, +0x5013,0x5017,0x5018,0x501B,0x501C,0x501D,0x501E,0x5022, +0x5027,0x502E,0x5030,0x5032,0x5033,0x5035,0x5040,0x5041, +0x5042,0x5045,0x5046,0x504A,0x504C,0x504E,0x5051,0x5052, +0x5053,0x5057,0x5059,0x505F,0x5060,0x5062,0x5063,0x5066, +0x5067,0x506A,0x506D,0x5070,0x5071,0x503B,0x5081,0x5083, +0x5084,0x5086,0x508A,0x508E,0x508F,0x5090}; + +/* page 10 0x3221-0x327E */ +static uint16 tab_jisx0212_uni10[]={ +0x5092,0x5093,0x5094,0x5096,0x509B,0x509C,0x509E,0x509F, +0x50A0,0x50A1,0x50A2,0x50AA,0x50AF,0x50B0,0x50B9,0x50BA, +0x50BD,0x50C0,0x50C3,0x50C4,0x50C7,0x50CC,0x50CE,0x50D0, +0x50D3,0x50D4,0x50D8,0x50DC,0x50DD,0x50DF,0x50E2,0x50E4, +0x50E6,0x50E8,0x50E9,0x50EF,0x50F1,0x50F6,0x50FA,0x50FE, +0x5103,0x5106,0x5107,0x5108,0x510B,0x510C,0x510D,0x510E, +0x50F2,0x5110,0x5117,0x5119,0x511B,0x511C,0x511D,0x511E, +0x5123,0x5127,0x5128,0x512C,0x512D,0x512F,0x5131,0x5133, +0x5134,0x5135,0x5138,0x5139,0x5142,0x514A,0x514F,0x5153, +0x5155,0x5157,0x5158,0x515F,0x5164,0x5166,0x517E,0x5183, +0x5184,0x518B,0x518E,0x5198,0x519D,0x51A1,0x51A3,0x51AD, +0x51B8,0x51BA,0x51BC,0x51BE,0x51BF,0x51C2}; + +/* page 11 0x3321-0x337E */ +static uint16 tab_jisx0212_uni11[]={ +0x51C8,0x51CF,0x51D1,0x51D2,0x51D3,0x51D5,0x51D8,0x51DE, +0x51E2,0x51E5,0x51EE,0x51F2,0x51F3,0x51F4,0x51F7,0x5201, +0x5202,0x5205,0x5212,0x5213,0x5215,0x5216,0x5218,0x5222, +0x5228,0x5231,0x5232,0x5235,0x523C,0x5245,0x5249,0x5255, +0x5257,0x5258,0x525A,0x525C,0x525F,0x5260,0x5261,0x5266, +0x526E,0x5277,0x5278,0x5279,0x5280,0x5282,0x5285,0x528A, +0x528C,0x5293,0x5295,0x5296,0x5297,0x5298,0x529A,0x529C, +0x52A4,0x52A5,0x52A6,0x52A7,0x52AF,0x52B0,0x52B6,0x52B7, +0x52B8,0x52BA,0x52BB,0x52BD,0x52C0,0x52C4,0x52C6,0x52C8, +0x52CC,0x52CF,0x52D1,0x52D4,0x52D6,0x52DB,0x52DC,0x52E1, +0x52E5,0x52E8,0x52E9,0x52EA,0x52EC,0x52F0,0x52F1,0x52F4, +0x52F6,0x52F7,0x5300,0x5303,0x530A,0x530B}; + +/* page 12 0x3421-0x347E */ +static uint16 tab_jisx0212_uni12[]={ +0x530C,0x5311,0x5313,0x5318,0x531B,0x531C,0x531E,0x531F, +0x5325,0x5327,0x5328,0x5329,0x532B,0x532C,0x532D,0x5330, +0x5332,0x5335,0x533C,0x533D,0x533E,0x5342,0x534C,0x534B, +0x5359,0x535B,0x5361,0x5363,0x5365,0x536C,0x536D,0x5372, +0x5379,0x537E,0x5383,0x5387,0x5388,0x538E,0x5393,0x5394, +0x5399,0x539D,0x53A1,0x53A4,0x53AA,0x53AB,0x53AF,0x53B2, +0x53B4,0x53B5,0x53B7,0x53B8,0x53BA,0x53BD,0x53C0,0x53C5, +0x53CF,0x53D2,0x53D3,0x53D5,0x53DA,0x53DD,0x53DE,0x53E0, +0x53E6,0x53E7,0x53F5,0x5402,0x5413,0x541A,0x5421,0x5427, +0x5428,0x542A,0x542F,0x5431,0x5434,0x5435,0x5443,0x5444, +0x5447,0x544D,0x544F,0x545E,0x5462,0x5464,0x5466,0x5467, +0x5469,0x546B,0x546D,0x546E,0x5474,0x547F}; + +/* page 13 0x3521-0x357E */ +static uint16 tab_jisx0212_uni13[]={ +0x5481,0x5483,0x5485,0x5488,0x5489,0x548D,0x5491,0x5495, +0x5496,0x549C,0x549F,0x54A1,0x54A6,0x54A7,0x54A9,0x54AA, +0x54AD,0x54AE,0x54B1,0x54B7,0x54B9,0x54BA,0x54BB,0x54BF, +0x54C6,0x54CA,0x54CD,0x54CE,0x54E0,0x54EA,0x54EC,0x54EF, +0x54F6,0x54FC,0x54FE,0x54FF,0x5500,0x5501,0x5505,0x5508, +0x5509,0x550C,0x550D,0x550E,0x5515,0x552A,0x552B,0x5532, +0x5535,0x5536,0x553B,0x553C,0x553D,0x5541,0x5547,0x5549, +0x554A,0x554D,0x5550,0x5551,0x5558,0x555A,0x555B,0x555E, +0x5560,0x5561,0x5564,0x5566,0x557F,0x5581,0x5582,0x5586, +0x5588,0x558E,0x558F,0x5591,0x5592,0x5593,0x5594,0x5597, +0x55A3,0x55A4,0x55AD,0x55B2,0x55BF,0x55C1,0x55C3,0x55C6, +0x55C9,0x55CB,0x55CC,0x55CE,0x55D1,0x55D2}; + +/* page 14 0x3621-0x367E */ +static uint16 tab_jisx0212_uni14[]={ +0x55D3,0x55D7,0x55D8,0x55DB,0x55DE,0x55E2,0x55E9,0x55F6, +0x55FF,0x5605,0x5608,0x560A,0x560D,0x560E,0x560F,0x5610, +0x5611,0x5612,0x5619,0x562C,0x5630,0x5633,0x5635,0x5637, +0x5639,0x563B,0x563C,0x563D,0x563F,0x5640,0x5641,0x5643, +0x5644,0x5646,0x5649,0x564B,0x564D,0x564F,0x5654,0x565E, +0x5660,0x5661,0x5662,0x5663,0x5666,0x5669,0x566D,0x566F, +0x5671,0x5672,0x5675,0x5684,0x5685,0x5688,0x568B,0x568C, +0x5695,0x5699,0x569A,0x569D,0x569E,0x569F,0x56A6,0x56A7, +0x56A8,0x56A9,0x56AB,0x56AC,0x56AD,0x56B1,0x56B3,0x56B7, +0x56BE,0x56C5,0x56C9,0x56CA,0x56CB,0x56CF,0x56D0,0x56CC, +0x56CD,0x56D9,0x56DC,0x56DD,0x56DF,0x56E1,0x56E4,0x56E5, +0x56E6,0x56E7,0x56E8,0x56F1,0x56EB,0x56ED}; + +/* page 15 0x3721-0x377E */ +static uint16 tab_jisx0212_uni15[]={ +0x56F6,0x56F7,0x5701,0x5702,0x5707,0x570A,0x570C,0x5711, +0x5715,0x571A,0x571B,0x571D,0x5720,0x5722,0x5723,0x5724, +0x5725,0x5729,0x572A,0x572C,0x572E,0x572F,0x5733,0x5734, +0x573D,0x573E,0x573F,0x5745,0x5746,0x574C,0x574D,0x5752, +0x5762,0x5765,0x5767,0x5768,0x576B,0x576D,0x576E,0x576F, +0x5770,0x5771,0x5773,0x5774,0x5775,0x5777,0x5779,0x577A, +0x577B,0x577C,0x577E,0x5781,0x5783,0x578C,0x5794,0x5797, +0x5799,0x579A,0x579C,0x579D,0x579E,0x579F,0x57A1,0x5795, +0x57A7,0x57A8,0x57A9,0x57AC,0x57B8,0x57BD,0x57C7,0x57C8, +0x57CC,0x57CF,0x57D5,0x57DD,0x57DE,0x57E4,0x57E6,0x57E7, +0x57E9,0x57ED,0x57F0,0x57F5,0x57F6,0x57F8,0x57FD,0x57FE, +0x57FF,0x5803,0x5804,0x5808,0x5809,0x57E1}; + +/* page 16 0x3821-0x387E */ +static uint16 tab_jisx0212_uni16[]={ +0x580C,0x580D,0x581B,0x581E,0x581F,0x5820,0x5826,0x5827, +0x582D,0x5832,0x5839,0x583F,0x5849,0x584C,0x584D,0x584F, +0x5850,0x5855,0x585F,0x5861,0x5864,0x5867,0x5868,0x5878, +0x587C,0x587F,0x5880,0x5881,0x5887,0x5888,0x5889,0x588A, +0x588C,0x588D,0x588F,0x5890,0x5894,0x5896,0x589D,0x58A0, +0x58A1,0x58A2,0x58A6,0x58A9,0x58B1,0x58B2,0x58C4,0x58BC, +0x58C2,0x58C8,0x58CD,0x58CE,0x58D0,0x58D2,0x58D4,0x58D6, +0x58DA,0x58DD,0x58E1,0x58E2,0x58E9,0x58F3,0x5905,0x5906, +0x590B,0x590C,0x5912,0x5913,0x5914,0x8641,0x591D,0x5921, +0x5923,0x5924,0x5928,0x592F,0x5930,0x5933,0x5935,0x5936, +0x593F,0x5943,0x5946,0x5952,0x5953,0x5959,0x595B,0x595D, +0x595E,0x595F,0x5961,0x5963,0x596B,0x596D}; + +/* page 17 0x3921-0x397E */ +static uint16 tab_jisx0212_uni17[]={ +0x596F,0x5972,0x5975,0x5976,0x5979,0x597B,0x597C,0x598B, +0x598C,0x598E,0x5992,0x5995,0x5997,0x599F,0x59A4,0x59A7, +0x59AD,0x59AE,0x59AF,0x59B0,0x59B3,0x59B7,0x59BA,0x59BC, +0x59C1,0x59C3,0x59C4,0x59C8,0x59CA,0x59CD,0x59D2,0x59DD, +0x59DE,0x59DF,0x59E3,0x59E4,0x59E7,0x59EE,0x59EF,0x59F1, +0x59F2,0x59F4,0x59F7,0x5A00,0x5A04,0x5A0C,0x5A0D,0x5A0E, +0x5A12,0x5A13,0x5A1E,0x5A23,0x5A24,0x5A27,0x5A28,0x5A2A, +0x5A2D,0x5A30,0x5A44,0x5A45,0x5A47,0x5A48,0x5A4C,0x5A50, +0x5A55,0x5A5E,0x5A63,0x5A65,0x5A67,0x5A6D,0x5A77,0x5A7A, +0x5A7B,0x5A7E,0x5A8B,0x5A90,0x5A93,0x5A96,0x5A99,0x5A9C, +0x5A9E,0x5A9F,0x5AA0,0x5AA2,0x5AA7,0x5AAC,0x5AB1,0x5AB2, +0x5AB3,0x5AB5,0x5AB8,0x5ABA,0x5ABB,0x5ABF}; + +/* page 18 0x3A21-0x3A7E */ +static uint16 tab_jisx0212_uni18[]={ +0x5AC4,0x5AC6,0x5AC8,0x5ACF,0x5ADA,0x5ADC,0x5AE0,0x5AE5, +0x5AEA,0x5AEE,0x5AF5,0x5AF6,0x5AFD,0x5B00,0x5B01,0x5B08, +0x5B17,0x5B34,0x5B19,0x5B1B,0x5B1D,0x5B21,0x5B25,0x5B2D, +0x5B38,0x5B41,0x5B4B,0x5B4C,0x5B52,0x5B56,0x5B5E,0x5B68, +0x5B6E,0x5B6F,0x5B7C,0x5B7D,0x5B7E,0x5B7F,0x5B81,0x5B84, +0x5B86,0x5B8A,0x5B8E,0x5B90,0x5B91,0x5B93,0x5B94,0x5B96, +0x5BA8,0x5BA9,0x5BAC,0x5BAD,0x5BAF,0x5BB1,0x5BB2,0x5BB7, +0x5BBA,0x5BBC,0x5BC0,0x5BC1,0x5BCD,0x5BCF,0x5BD6,0x5BD7, +0x5BD8,0x5BD9,0x5BDA,0x5BE0,0x5BEF,0x5BF1,0x5BF4,0x5BFD, +0x5C0C,0x5C17,0x5C1E,0x5C1F,0x5C23,0x5C26,0x5C29,0x5C2B, +0x5C2C,0x5C2E,0x5C30,0x5C32,0x5C35,0x5C36,0x5C59,0x5C5A, +0x5C5C,0x5C62,0x5C63,0x5C67,0x5C68,0x5C69}; + +/* page 19 0x3B21-0x3B7E */ +static uint16 tab_jisx0212_uni19[]={ +0x5C6D,0x5C70,0x5C74,0x5C75,0x5C7A,0x5C7B,0x5C7C,0x5C7D, +0x5C87,0x5C88,0x5C8A,0x5C8F,0x5C92,0x5C9D,0x5C9F,0x5CA0, +0x5CA2,0x5CA3,0x5CA6,0x5CAA,0x5CB2,0x5CB4,0x5CB5,0x5CBA, +0x5CC9,0x5CCB,0x5CD2,0x5CDD,0x5CD7,0x5CEE,0x5CF1,0x5CF2, +0x5CF4,0x5D01,0x5D06,0x5D0D,0x5D12,0x5D2B,0x5D23,0x5D24, +0x5D26,0x5D27,0x5D31,0x5D34,0x5D39,0x5D3D,0x5D3F,0x5D42, +0x5D43,0x5D46,0x5D48,0x5D55,0x5D51,0x5D59,0x5D4A,0x5D5F, +0x5D60,0x5D61,0x5D62,0x5D64,0x5D6A,0x5D6D,0x5D70,0x5D79, +0x5D7A,0x5D7E,0x5D7F,0x5D81,0x5D83,0x5D88,0x5D8A,0x5D92, +0x5D93,0x5D94,0x5D95,0x5D99,0x5D9B,0x5D9F,0x5DA0,0x5DA7, +0x5DAB,0x5DB0,0x5DB4,0x5DB8,0x5DB9,0x5DC3,0x5DC7,0x5DCB, +0x5DD0,0x5DCE,0x5DD8,0x5DD9,0x5DE0,0x5DE4}; + +/* page 20 0x3C21-0x3C7E */ +static uint16 tab_jisx0212_uni20[]={ +0x5DE9,0x5DF8,0x5DF9,0x5E00,0x5E07,0x5E0D,0x5E12,0x5E14, +0x5E15,0x5E18,0x5E1F,0x5E20,0x5E2E,0x5E28,0x5E32,0x5E35, +0x5E3E,0x5E4B,0x5E50,0x5E49,0x5E51,0x5E56,0x5E58,0x5E5B, +0x5E5C,0x5E5E,0x5E68,0x5E6A,0x5E6B,0x5E6C,0x5E6D,0x5E6E, +0x5E70,0x5E80,0x5E8B,0x5E8E,0x5EA2,0x5EA4,0x5EA5,0x5EA8, +0x5EAA,0x5EAC,0x5EB1,0x5EB3,0x5EBD,0x5EBE,0x5EBF,0x5EC6, +0x5ECC,0x5ECB,0x5ECE,0x5ED1,0x5ED2,0x5ED4,0x5ED5,0x5EDC, +0x5EDE,0x5EE5,0x5EEB,0x5F02,0x5F06,0x5F07,0x5F08,0x5F0E, +0x5F19,0x5F1C,0x5F1D,0x5F21,0x5F22,0x5F23,0x5F24,0x5F28, +0x5F2B,0x5F2C,0x5F2E,0x5F30,0x5F34,0x5F36,0x5F3B,0x5F3D, +0x5F3F,0x5F40,0x5F44,0x5F45,0x5F47,0x5F4D,0x5F50,0x5F54, +0x5F58,0x5F5B,0x5F60,0x5F63,0x5F64,0x5F67}; + +/* page 21 0x3D21-0x3D7E */ +static uint16 tab_jisx0212_uni21[]={ +0x5F6F,0x5F72,0x5F74,0x5F75,0x5F78,0x5F7A,0x5F7D,0x5F7E, +0x5F89,0x5F8D,0x5F8F,0x5F96,0x5F9C,0x5F9D,0x5FA2,0x5FA7, +0x5FAB,0x5FA4,0x5FAC,0x5FAF,0x5FB0,0x5FB1,0x5FB8,0x5FC4, +0x5FC7,0x5FC8,0x5FC9,0x5FCB,0x5FD0,0x5FD1,0x5FD2,0x5FD3, +0x5FD4,0x5FDE,0x5FE1,0x5FE2,0x5FE8,0x5FE9,0x5FEA,0x5FEC, +0x5FED,0x5FEE,0x5FEF,0x5FF2,0x5FF3,0x5FF6,0x5FFA,0x5FFC, +0x6007,0x600A,0x600D,0x6013,0x6014,0x6017,0x6018,0x601A, +0x601F,0x6024,0x602D,0x6033,0x6035,0x6040,0x6047,0x6048, +0x6049,0x604C,0x6051,0x6054,0x6056,0x6057,0x605D,0x6061, +0x6067,0x6071,0x607E,0x607F,0x6082,0x6086,0x6088,0x608A, +0x608E,0x6091,0x6093,0x6095,0x6098,0x609D,0x609E,0x60A2, +0x60A4,0x60A5,0x60A8,0x60B0,0x60B1,0x60B7}; + +/* page 22 0x3E21-0x3E7E */ +static uint16 tab_jisx0212_uni22[]={ +0x60BB,0x60BE,0x60C2,0x60C4,0x60C8,0x60C9,0x60CA,0x60CB, +0x60CE,0x60CF,0x60D4,0x60D5,0x60D9,0x60DB,0x60DD,0x60DE, +0x60E2,0x60E5,0x60F2,0x60F5,0x60F8,0x60FC,0x60FD,0x6102, +0x6107,0x610A,0x610C,0x6110,0x6111,0x6112,0x6113,0x6114, +0x6116,0x6117,0x6119,0x611C,0x611E,0x6122,0x612A,0x612B, +0x6130,0x6131,0x6135,0x6136,0x6137,0x6139,0x6141,0x6145, +0x6146,0x6149,0x615E,0x6160,0x616C,0x6172,0x6178,0x617B, +0x617C,0x617F,0x6180,0x6181,0x6183,0x6184,0x618B,0x618D, +0x6192,0x6193,0x6197,0x6198,0x619C,0x619D,0x619F,0x61A0, +0x61A5,0x61A8,0x61AA,0x61AD,0x61B8,0x61B9,0x61BC,0x61C0, +0x61C1,0x61C2,0x61CE,0x61CF,0x61D5,0x61DC,0x61DD,0x61DE, +0x61DF,0x61E1,0x61E2,0x61E7,0x61E9,0x61E5}; + +/* page 23 0x3F21-0x3F7E */ +static uint16 tab_jisx0212_uni23[]={ +0x61EC,0x61ED,0x61EF,0x6201,0x6203,0x6204,0x6207,0x6213, +0x6215,0x621C,0x6220,0x6222,0x6223,0x6227,0x6229,0x622B, +0x6239,0x623D,0x6242,0x6243,0x6244,0x6246,0x624C,0x6250, +0x6251,0x6252,0x6254,0x6256,0x625A,0x625C,0x6264,0x626D, +0x626F,0x6273,0x627A,0x627D,0x628D,0x628E,0x628F,0x6290, +0x62A6,0x62A8,0x62B3,0x62B6,0x62B7,0x62BA,0x62BE,0x62BF, +0x62C4,0x62CE,0x62D5,0x62D6,0x62DA,0x62EA,0x62F2,0x62F4, +0x62FC,0x62FD,0x6303,0x6304,0x630A,0x630B,0x630D,0x6310, +0x6313,0x6316,0x6318,0x6329,0x632A,0x632D,0x6335,0x6336, +0x6339,0x633C,0x6341,0x6342,0x6343,0x6344,0x6346,0x634A, +0x634B,0x634E,0x6352,0x6353,0x6354,0x6358,0x635B,0x6365, +0x6366,0x636C,0x636D,0x6371,0x6374,0x6375}; + +/* page 24 0x4021-0x407E */ +static uint16 tab_jisx0212_uni24[]={ +0x6378,0x637C,0x637D,0x637F,0x6382,0x6384,0x6387,0x638A, +0x6390,0x6394,0x6395,0x6399,0x639A,0x639E,0x63A4,0x63A6, +0x63AD,0x63AE,0x63AF,0x63BD,0x63C1,0x63C5,0x63C8,0x63CE, +0x63D1,0x63D3,0x63D4,0x63D5,0x63DC,0x63E0,0x63E5,0x63EA, +0x63EC,0x63F2,0x63F3,0x63F5,0x63F8,0x63F9,0x6409,0x640A, +0x6410,0x6412,0x6414,0x6418,0x641E,0x6420,0x6422,0x6424, +0x6425,0x6429,0x642A,0x642F,0x6430,0x6435,0x643D,0x643F, +0x644B,0x644F,0x6451,0x6452,0x6453,0x6454,0x645A,0x645B, +0x645C,0x645D,0x645F,0x6460,0x6461,0x6463,0x646D,0x6473, +0x6474,0x647B,0x647D,0x6485,0x6487,0x648F,0x6490,0x6491, +0x6498,0x6499,0x649B,0x649D,0x649F,0x64A1,0x64A3,0x64A6, +0x64A8,0x64AC,0x64B3,0x64BD,0x64BE,0x64BF}; + +/* page 25 0x4121-0x417E */ +static uint16 tab_jisx0212_uni25[]={ +0x64C4,0x64C9,0x64CA,0x64CB,0x64CC,0x64CE,0x64D0,0x64D1, +0x64D5,0x64D7,0x64E4,0x64E5,0x64E9,0x64EA,0x64ED,0x64F0, +0x64F5,0x64F7,0x64FB,0x64FF,0x6501,0x6504,0x6508,0x6509, +0x650A,0x650F,0x6513,0x6514,0x6516,0x6519,0x651B,0x651E, +0x651F,0x6522,0x6526,0x6529,0x652E,0x6531,0x653A,0x653C, +0x653D,0x6543,0x6547,0x6549,0x6550,0x6552,0x6554,0x655F, +0x6560,0x6567,0x656B,0x657A,0x657D,0x6581,0x6585,0x658A, +0x6592,0x6595,0x6598,0x659D,0x65A0,0x65A3,0x65A6,0x65AE, +0x65B2,0x65B3,0x65B4,0x65BF,0x65C2,0x65C8,0x65C9,0x65CE, +0x65D0,0x65D4,0x65D6,0x65D8,0x65DF,0x65F0,0x65F2,0x65F4, +0x65F5,0x65F9,0x65FE,0x65FF,0x6600,0x6604,0x6608,0x6609, +0x660D,0x6611,0x6612,0x6615,0x6616,0x661D}; + +/* page 26 0x4221-0x427E */ +static uint16 tab_jisx0212_uni26[]={ +0x661E,0x6621,0x6622,0x6623,0x6624,0x6626,0x6629,0x662A, +0x662B,0x662C,0x662E,0x6630,0x6631,0x6633,0x6639,0x6637, +0x6640,0x6645,0x6646,0x664A,0x664C,0x6651,0x664E,0x6657, +0x6658,0x6659,0x665B,0x665C,0x6660,0x6661,0x66FB,0x666A, +0x666B,0x666C,0x667E,0x6673,0x6675,0x667F,0x6677,0x6678, +0x6679,0x667B,0x6680,0x667C,0x668B,0x668C,0x668D,0x6690, +0x6692,0x6699,0x669A,0x669B,0x669C,0x669F,0x66A0,0x66A4, +0x66AD,0x66B1,0x66B2,0x66B5,0x66BB,0x66BF,0x66C0,0x66C2, +0x66C3,0x66C8,0x66CC,0x66CE,0x66CF,0x66D4,0x66DB,0x66DF, +0x66E8,0x66EB,0x66EC,0x66EE,0x66FA,0x6705,0x6707,0x670E, +0x6713,0x6719,0x671C,0x6720,0x6722,0x6733,0x673E,0x6745, +0x6747,0x6748,0x674C,0x6754,0x6755,0x675D}; + +/* page 27 0x4321-0x437E */ +static uint16 tab_jisx0212_uni27[]={ +0x6766,0x676C,0x676E,0x6774,0x6776,0x677B,0x6781,0x6784, +0x678E,0x678F,0x6791,0x6793,0x6796,0x6798,0x6799,0x679B, +0x67B0,0x67B1,0x67B2,0x67B5,0x67BB,0x67BC,0x67BD,0x67F9, +0x67C0,0x67C2,0x67C3,0x67C5,0x67C8,0x67C9,0x67D2,0x67D7, +0x67D9,0x67DC,0x67E1,0x67E6,0x67F0,0x67F2,0x67F6,0x67F7, +0x6852,0x6814,0x6819,0x681D,0x681F,0x6828,0x6827,0x682C, +0x682D,0x682F,0x6830,0x6831,0x6833,0x683B,0x683F,0x6844, +0x6845,0x684A,0x684C,0x6855,0x6857,0x6858,0x685B,0x686B, +0x686E,0x686F,0x6870,0x6871,0x6872,0x6875,0x6879,0x687A, +0x687B,0x687C,0x6882,0x6884,0x6886,0x6888,0x6896,0x6898, +0x689A,0x689C,0x68A1,0x68A3,0x68A5,0x68A9,0x68AA,0x68AE, +0x68B2,0x68BB,0x68C5,0x68C8,0x68CC,0x68CF}; + +/* page 28 0x4421-0x447E */ +static uint16 tab_jisx0212_uni28[]={ +0x68D0,0x68D1,0x68D3,0x68D6,0x68D9,0x68DC,0x68DD,0x68E5, +0x68E8,0x68EA,0x68EB,0x68EC,0x68ED,0x68F0,0x68F1,0x68F5, +0x68F6,0x68FB,0x68FC,0x68FD,0x6906,0x6909,0x690A,0x6910, +0x6911,0x6913,0x6916,0x6917,0x6931,0x6933,0x6935,0x6938, +0x693B,0x6942,0x6945,0x6949,0x694E,0x6957,0x695B,0x6963, +0x6964,0x6965,0x6966,0x6968,0x6969,0x696C,0x6970,0x6971, +0x6972,0x697A,0x697B,0x697F,0x6980,0x698D,0x6992,0x6996, +0x6998,0x69A1,0x69A5,0x69A6,0x69A8,0x69AB,0x69AD,0x69AF, +0x69B7,0x69B8,0x69BA,0x69BC,0x69C5,0x69C8,0x69D1,0x69D6, +0x69D7,0x69E2,0x69E5,0x69EE,0x69EF,0x69F1,0x69F3,0x69F5, +0x69FE,0x6A00,0x6A01,0x6A03,0x6A0F,0x6A11,0x6A15,0x6A1A, +0x6A1D,0x6A20,0x6A24,0x6A28,0x6A30,0x6A32}; + +/* page 29 0x4521-0x457E */ +static uint16 tab_jisx0212_uni29[]={ +0x6A34,0x6A37,0x6A3B,0x6A3E,0x6A3F,0x6A45,0x6A46,0x6A49, +0x6A4A,0x6A4E,0x6A50,0x6A51,0x6A52,0x6A55,0x6A56,0x6A5B, +0x6A64,0x6A67,0x6A6A,0x6A71,0x6A73,0x6A7E,0x6A81,0x6A83, +0x6A86,0x6A87,0x6A89,0x6A8B,0x6A91,0x6A9B,0x6A9D,0x6A9E, +0x6A9F,0x6AA5,0x6AAB,0x6AAF,0x6AB0,0x6AB1,0x6AB4,0x6ABD, +0x6ABE,0x6ABF,0x6AC6,0x6AC9,0x6AC8,0x6ACC,0x6AD0,0x6AD4, +0x6AD5,0x6AD6,0x6ADC,0x6ADD,0x6AE4,0x6AE7,0x6AEC,0x6AF0, +0x6AF1,0x6AF2,0x6AFC,0x6AFD,0x6B02,0x6B03,0x6B06,0x6B07, +0x6B09,0x6B0F,0x6B10,0x6B11,0x6B17,0x6B1B,0x6B1E,0x6B24, +0x6B28,0x6B2B,0x6B2C,0x6B2F,0x6B35,0x6B36,0x6B3B,0x6B3F, +0x6B46,0x6B4A,0x6B4D,0x6B52,0x6B56,0x6B58,0x6B5D,0x6B60, +0x6B67,0x6B6B,0x6B6E,0x6B70,0x6B75,0x6B7D}; + +/* page 30 0x4621-0x467E */ +static uint16 tab_jisx0212_uni30[]={ +0x6B7E,0x6B82,0x6B85,0x6B97,0x6B9B,0x6B9F,0x6BA0,0x6BA2, +0x6BA3,0x6BA8,0x6BA9,0x6BAC,0x6BAD,0x6BAE,0x6BB0,0x6BB8, +0x6BB9,0x6BBD,0x6BBE,0x6BC3,0x6BC4,0x6BC9,0x6BCC,0x6BD6, +0x6BDA,0x6BE1,0x6BE3,0x6BE6,0x6BE7,0x6BEE,0x6BF1,0x6BF7, +0x6BF9,0x6BFF,0x6C02,0x6C04,0x6C05,0x6C09,0x6C0D,0x6C0E, +0x6C10,0x6C12,0x6C19,0x6C1F,0x6C26,0x6C27,0x6C28,0x6C2C, +0x6C2E,0x6C33,0x6C35,0x6C36,0x6C3A,0x6C3B,0x6C3F,0x6C4A, +0x6C4B,0x6C4D,0x6C4F,0x6C52,0x6C54,0x6C59,0x6C5B,0x6C5C, +0x6C6B,0x6C6D,0x6C6F,0x6C74,0x6C76,0x6C78,0x6C79,0x6C7B, +0x6C85,0x6C86,0x6C87,0x6C89,0x6C94,0x6C95,0x6C97,0x6C98, +0x6C9C,0x6C9F,0x6CB0,0x6CB2,0x6CB4,0x6CC2,0x6CC6,0x6CCD, +0x6CCF,0x6CD0,0x6CD1,0x6CD2,0x6CD4,0x6CD6}; + +/* page 31 0x4721-0x477E */ +static uint16 tab_jisx0212_uni31[]={ +0x6CDA,0x6CDC,0x6CE0,0x6CE7,0x6CE9,0x6CEB,0x6CEC,0x6CEE, +0x6CF2,0x6CF4,0x6D04,0x6D07,0x6D0A,0x6D0E,0x6D0F,0x6D11, +0x6D13,0x6D1A,0x6D26,0x6D27,0x6D28,0x6C67,0x6D2E,0x6D2F, +0x6D31,0x6D39,0x6D3C,0x6D3F,0x6D57,0x6D5E,0x6D5F,0x6D61, +0x6D65,0x6D67,0x6D6F,0x6D70,0x6D7C,0x6D82,0x6D87,0x6D91, +0x6D92,0x6D94,0x6D96,0x6D97,0x6D98,0x6DAA,0x6DAC,0x6DB4, +0x6DB7,0x6DB9,0x6DBD,0x6DBF,0x6DC4,0x6DC8,0x6DCA,0x6DCE, +0x6DCF,0x6DD6,0x6DDB,0x6DDD,0x6DDF,0x6DE0,0x6DE2,0x6DE5, +0x6DE9,0x6DEF,0x6DF0,0x6DF4,0x6DF6,0x6DFC,0x6E00,0x6E04, +0x6E1E,0x6E22,0x6E27,0x6E32,0x6E36,0x6E39,0x6E3B,0x6E3C, +0x6E44,0x6E45,0x6E48,0x6E49,0x6E4B,0x6E4F,0x6E51,0x6E52, +0x6E53,0x6E54,0x6E57,0x6E5C,0x6E5D,0x6E5E}; + +/* page 32 0x4821-0x487E */ +static uint16 tab_jisx0212_uni32[]={ +0x6E62,0x6E63,0x6E68,0x6E73,0x6E7B,0x6E7D,0x6E8D,0x6E93, +0x6E99,0x6EA0,0x6EA7,0x6EAD,0x6EAE,0x6EB1,0x6EB3,0x6EBB, +0x6EBF,0x6EC0,0x6EC1,0x6EC3,0x6EC7,0x6EC8,0x6ECA,0x6ECD, +0x6ECE,0x6ECF,0x6EEB,0x6EED,0x6EEE,0x6EF9,0x6EFB,0x6EFD, +0x6F04,0x6F08,0x6F0A,0x6F0C,0x6F0D,0x6F16,0x6F18,0x6F1A, +0x6F1B,0x6F26,0x6F29,0x6F2A,0x6F2F,0x6F30,0x6F33,0x6F36, +0x6F3B,0x6F3C,0x6F2D,0x6F4F,0x6F51,0x6F52,0x6F53,0x6F57, +0x6F59,0x6F5A,0x6F5D,0x6F5E,0x6F61,0x6F62,0x6F68,0x6F6C, +0x6F7D,0x6F7E,0x6F83,0x6F87,0x6F88,0x6F8B,0x6F8C,0x6F8D, +0x6F90,0x6F92,0x6F93,0x6F94,0x6F96,0x6F9A,0x6F9F,0x6FA0, +0x6FA5,0x6FA6,0x6FA7,0x6FA8,0x6FAE,0x6FAF,0x6FB0,0x6FB5, +0x6FB6,0x6FBC,0x6FC5,0x6FC7,0x6FC8,0x6FCA}; + +/* page 33 0x4921-0x497E */ +static uint16 tab_jisx0212_uni33[]={ +0x6FDA,0x6FDE,0x6FE8,0x6FE9,0x6FF0,0x6FF5,0x6FF9,0x6FFC, +0x6FFD,0x7000,0x7005,0x7006,0x7007,0x700D,0x7017,0x7020, +0x7023,0x702F,0x7034,0x7037,0x7039,0x703C,0x7043,0x7044, +0x7048,0x7049,0x704A,0x704B,0x7054,0x7055,0x705D,0x705E, +0x704E,0x7064,0x7065,0x706C,0x706E,0x7075,0x7076,0x707E, +0x7081,0x7085,0x7086,0x7094,0x7095,0x7096,0x7097,0x7098, +0x709B,0x70A4,0x70AB,0x70B0,0x70B1,0x70B4,0x70B7,0x70CA, +0x70D1,0x70D3,0x70D4,0x70D5,0x70D6,0x70D8,0x70DC,0x70E4, +0x70FA,0x7103,0x7104,0x7105,0x7106,0x7107,0x710B,0x710C, +0x710F,0x711E,0x7120,0x712B,0x712D,0x712F,0x7130,0x7131, +0x7138,0x7141,0x7145,0x7146,0x7147,0x714A,0x714B,0x7150, +0x7152,0x7157,0x715A,0x715C,0x715E,0x7160}; + +/* page 34 0x4A21-0x4A7E */ +static uint16 tab_jisx0212_uni34[]={ +0x7168,0x7179,0x7180,0x7185,0x7187,0x718C,0x7192,0x719A, +0x719B,0x71A0,0x71A2,0x71AF,0x71B0,0x71B2,0x71B3,0x71BA, +0x71BF,0x71C0,0x71C1,0x71C4,0x71CB,0x71CC,0x71D3,0x71D6, +0x71D9,0x71DA,0x71DC,0x71F8,0x71FE,0x7200,0x7207,0x7208, +0x7209,0x7213,0x7217,0x721A,0x721D,0x721F,0x7224,0x722B, +0x722F,0x7234,0x7238,0x7239,0x7241,0x7242,0x7243,0x7245, +0x724E,0x724F,0x7250,0x7253,0x7255,0x7256,0x725A,0x725C, +0x725E,0x7260,0x7263,0x7268,0x726B,0x726E,0x726F,0x7271, +0x7277,0x7278,0x727B,0x727C,0x727F,0x7284,0x7289,0x728D, +0x728E,0x7293,0x729B,0x72A8,0x72AD,0x72AE,0x72B1,0x72B4, +0x72BE,0x72C1,0x72C7,0x72C9,0x72CC,0x72D5,0x72D6,0x72D8, +0x72DF,0x72E5,0x72F3,0x72F4,0x72FA,0x72FB}; + +/* page 35 0x4B21-0x4B7E */ +static uint16 tab_jisx0212_uni35[]={ +0x72FE,0x7302,0x7304,0x7305,0x7307,0x730B,0x730D,0x7312, +0x7313,0x7318,0x7319,0x731E,0x7322,0x7324,0x7327,0x7328, +0x732C,0x7331,0x7332,0x7335,0x733A,0x733B,0x733D,0x7343, +0x734D,0x7350,0x7352,0x7356,0x7358,0x735D,0x735E,0x735F, +0x7360,0x7366,0x7367,0x7369,0x736B,0x736C,0x736E,0x736F, +0x7371,0x7377,0x7379,0x737C,0x7380,0x7381,0x7383,0x7385, +0x7386,0x738E,0x7390,0x7393,0x7395,0x7397,0x7398,0x739C, +0x739E,0x739F,0x73A0,0x73A2,0x73A5,0x73A6,0x73AA,0x73AB, +0x73AD,0x73B5,0x73B7,0x73B9,0x73BC,0x73BD,0x73BF,0x73C5, +0x73C6,0x73C9,0x73CB,0x73CC,0x73CF,0x73D2,0x73D3,0x73D6, +0x73D9,0x73DD,0x73E1,0x73E3,0x73E6,0x73E7,0x73E9,0x73F4, +0x73F5,0x73F7,0x73F9,0x73FA,0x73FB,0x73FD}; + +/* page 36 0x4C21-0x4C7E */ +static uint16 tab_jisx0212_uni36[]={ +0x73FF,0x7400,0x7401,0x7404,0x7407,0x740A,0x7411,0x741A, +0x741B,0x7424,0x7426,0x7428,0x7429,0x742A,0x742B,0x742C, +0x742D,0x742E,0x742F,0x7430,0x7431,0x7439,0x7440,0x7443, +0x7444,0x7446,0x7447,0x744B,0x744D,0x7451,0x7452,0x7457, +0x745D,0x7462,0x7466,0x7467,0x7468,0x746B,0x746D,0x746E, +0x7471,0x7472,0x7480,0x7481,0x7485,0x7486,0x7487,0x7489, +0x748F,0x7490,0x7491,0x7492,0x7498,0x7499,0x749A,0x749C, +0x749F,0x74A0,0x74A1,0x74A3,0x74A6,0x74A8,0x74A9,0x74AA, +0x74AB,0x74AE,0x74AF,0x74B1,0x74B2,0x74B5,0x74B9,0x74BB, +0x74BF,0x74C8,0x74C9,0x74CC,0x74D0,0x74D3,0x74D8,0x74DA, +0x74DB,0x74DE,0x74DF,0x74E4,0x74E8,0x74EA,0x74EB,0x74EF, +0x74F4,0x74FA,0x74FB,0x74FC,0x74FF,0x7506}; + +/* page 37 0x4D21-0x4D7E */ +static uint16 tab_jisx0212_uni37[]={ +0x7512,0x7516,0x7517,0x7520,0x7521,0x7524,0x7527,0x7529, +0x752A,0x752F,0x7536,0x7539,0x753D,0x753E,0x753F,0x7540, +0x7543,0x7547,0x7548,0x754E,0x7550,0x7552,0x7557,0x755E, +0x755F,0x7561,0x756F,0x7571,0x7579,0x757A,0x757B,0x757C, +0x757D,0x757E,0x7581,0x7585,0x7590,0x7592,0x7593,0x7595, +0x7599,0x759C,0x75A2,0x75A4,0x75B4,0x75BA,0x75BF,0x75C0, +0x75C1,0x75C4,0x75C6,0x75CC,0x75CE,0x75CF,0x75D7,0x75DC, +0x75DF,0x75E0,0x75E1,0x75E4,0x75E7,0x75EC,0x75EE,0x75EF, +0x75F1,0x75F9,0x7600,0x7602,0x7603,0x7604,0x7607,0x7608, +0x760A,0x760C,0x760F,0x7612,0x7613,0x7615,0x7616,0x7619, +0x761B,0x761C,0x761D,0x761E,0x7623,0x7625,0x7626,0x7629, +0x762D,0x7632,0x7633,0x7635,0x7638,0x7639}; + +/* page 38 0x4E21-0x4E7E */ +static uint16 tab_jisx0212_uni38[]={ +0x763A,0x763C,0x764A,0x7640,0x7641,0x7643,0x7644,0x7645, +0x7649,0x764B,0x7655,0x7659,0x765F,0x7664,0x7665,0x766D, +0x766E,0x766F,0x7671,0x7674,0x7681,0x7685,0x768C,0x768D, +0x7695,0x769B,0x769C,0x769D,0x769F,0x76A0,0x76A2,0x76A3, +0x76A4,0x76A5,0x76A6,0x76A7,0x76A8,0x76AA,0x76AD,0x76BD, +0x76C1,0x76C5,0x76C9,0x76CB,0x76CC,0x76CE,0x76D4,0x76D9, +0x76E0,0x76E6,0x76E8,0x76EC,0x76F0,0x76F1,0x76F6,0x76F9, +0x76FC,0x7700,0x7706,0x770A,0x770E,0x7712,0x7714,0x7715, +0x7717,0x7719,0x771A,0x771C,0x7722,0x7728,0x772D,0x772E, +0x772F,0x7734,0x7735,0x7736,0x7739,0x773D,0x773E,0x7742, +0x7745,0x7746,0x774A,0x774D,0x774E,0x774F,0x7752,0x7756, +0x7757,0x775C,0x775E,0x775F,0x7760,0x7762}; + +/* page 39 0x4F21-0x4F7E */ +static uint16 tab_jisx0212_uni39[]={ +0x7764,0x7767,0x776A,0x776C,0x7770,0x7772,0x7773,0x7774, +0x777A,0x777D,0x7780,0x7784,0x778C,0x778D,0x7794,0x7795, +0x7796,0x779A,0x779F,0x77A2,0x77A7,0x77AA,0x77AE,0x77AF, +0x77B1,0x77B5,0x77BE,0x77C3,0x77C9,0x77D1,0x77D2,0x77D5, +0x77D9,0x77DE,0x77DF,0x77E0,0x77E4,0x77E6,0x77EA,0x77EC, +0x77F0,0x77F1,0x77F4,0x77F8,0x77FB,0x7805,0x7806,0x7809, +0x780D,0x780E,0x7811,0x781D,0x7821,0x7822,0x7823,0x782D, +0x782E,0x7830,0x7835,0x7837,0x7843,0x7844,0x7847,0x7848, +0x784C,0x784E,0x7852,0x785C,0x785E,0x7860,0x7861,0x7863, +0x7864,0x7868,0x786A,0x786E,0x787A,0x787E,0x788A,0x788F, +0x7894,0x7898,0x78A1,0x789D,0x789E,0x789F,0x78A4,0x78A8, +0x78AC,0x78AD,0x78B0,0x78B1,0x78B2,0x78B3}; + +/* page 40 0x5021-0x507E */ +static uint16 tab_jisx0212_uni40[]={ +0x78BB,0x78BD,0x78BF,0x78C7,0x78C8,0x78C9,0x78CC,0x78CE, +0x78D2,0x78D3,0x78D5,0x78D6,0x78E4,0x78DB,0x78DF,0x78E0, +0x78E1,0x78E6,0x78EA,0x78F2,0x78F3,0x7900,0x78F6,0x78F7, +0x78FA,0x78FB,0x78FF,0x7906,0x790C,0x7910,0x791A,0x791C, +0x791E,0x791F,0x7920,0x7925,0x7927,0x7929,0x792D,0x7931, +0x7934,0x7935,0x793B,0x793D,0x793F,0x7944,0x7945,0x7946, +0x794A,0x794B,0x794F,0x7951,0x7954,0x7958,0x795B,0x795C, +0x7967,0x7969,0x796B,0x7972,0x7979,0x797B,0x797C,0x797E, +0x798B,0x798C,0x7991,0x7993,0x7994,0x7995,0x7996,0x7998, +0x799B,0x799C,0x79A1,0x79A8,0x79A9,0x79AB,0x79AF,0x79B1, +0x79B4,0x79B8,0x79BB,0x79C2,0x79C4,0x79C7,0x79C8,0x79CA, +0x79CF,0x79D4,0x79D6,0x79DA,0x79DD,0x79DE}; + +/* page 41 0x5121-0x517E */ +static uint16 tab_jisx0212_uni41[]={ +0x79E0,0x79E2,0x79E5,0x79EA,0x79EB,0x79ED,0x79F1,0x79F8, +0x79FC,0x7A02,0x7A03,0x7A07,0x7A09,0x7A0A,0x7A0C,0x7A11, +0x7A15,0x7A1B,0x7A1E,0x7A21,0x7A27,0x7A2B,0x7A2D,0x7A2F, +0x7A30,0x7A34,0x7A35,0x7A38,0x7A39,0x7A3A,0x7A44,0x7A45, +0x7A47,0x7A48,0x7A4C,0x7A55,0x7A56,0x7A59,0x7A5C,0x7A5D, +0x7A5F,0x7A60,0x7A65,0x7A67,0x7A6A,0x7A6D,0x7A75,0x7A78, +0x7A7E,0x7A80,0x7A82,0x7A85,0x7A86,0x7A8A,0x7A8B,0x7A90, +0x7A91,0x7A94,0x7A9E,0x7AA0,0x7AA3,0x7AAC,0x7AB3,0x7AB5, +0x7AB9,0x7ABB,0x7ABC,0x7AC6,0x7AC9,0x7ACC,0x7ACE,0x7AD1, +0x7ADB,0x7AE8,0x7AE9,0x7AEB,0x7AEC,0x7AF1,0x7AF4,0x7AFB, +0x7AFD,0x7AFE,0x7B07,0x7B14,0x7B1F,0x7B23,0x7B27,0x7B29, +0x7B2A,0x7B2B,0x7B2D,0x7B2E,0x7B2F,0x7B30}; + +/* page 42 0x5221-0x527E */ +static uint16 tab_jisx0212_uni42[]={ +0x7B31,0x7B34,0x7B3D,0x7B3F,0x7B40,0x7B41,0x7B47,0x7B4E, +0x7B55,0x7B60,0x7B64,0x7B66,0x7B69,0x7B6A,0x7B6D,0x7B6F, +0x7B72,0x7B73,0x7B77,0x7B84,0x7B89,0x7B8E,0x7B90,0x7B91, +0x7B96,0x7B9B,0x7B9E,0x7BA0,0x7BA5,0x7BAC,0x7BAF,0x7BB0, +0x7BB2,0x7BB5,0x7BB6,0x7BBA,0x7BBB,0x7BBC,0x7BBD,0x7BC2, +0x7BC5,0x7BC8,0x7BCA,0x7BD4,0x7BD6,0x7BD7,0x7BD9,0x7BDA, +0x7BDB,0x7BE8,0x7BEA,0x7BF2,0x7BF4,0x7BF5,0x7BF8,0x7BF9, +0x7BFA,0x7BFC,0x7BFE,0x7C01,0x7C02,0x7C03,0x7C04,0x7C06, +0x7C09,0x7C0B,0x7C0C,0x7C0E,0x7C0F,0x7C19,0x7C1B,0x7C20, +0x7C25,0x7C26,0x7C28,0x7C2C,0x7C31,0x7C33,0x7C34,0x7C36, +0x7C39,0x7C3A,0x7C46,0x7C4A,0x7C55,0x7C51,0x7C52,0x7C53, +0x7C59,0x7C5A,0x7C5B,0x7C5C,0x7C5D,0x7C5E}; + +/* page 43 0x5321-0x537E */ +static uint16 tab_jisx0212_uni43[]={ +0x7C61,0x7C63,0x7C67,0x7C69,0x7C6D,0x7C6E,0x7C70,0x7C72, +0x7C79,0x7C7C,0x7C7D,0x7C86,0x7C87,0x7C8F,0x7C94,0x7C9E, +0x7CA0,0x7CA6,0x7CB0,0x7CB6,0x7CB7,0x7CBA,0x7CBB,0x7CBC, +0x7CBF,0x7CC4,0x7CC7,0x7CC8,0x7CC9,0x7CCD,0x7CCF,0x7CD3, +0x7CD4,0x7CD5,0x7CD7,0x7CD9,0x7CDA,0x7CDD,0x7CE6,0x7CE9, +0x7CEB,0x7CF5,0x7D03,0x7D07,0x7D08,0x7D09,0x7D0F,0x7D11, +0x7D12,0x7D13,0x7D16,0x7D1D,0x7D1E,0x7D23,0x7D26,0x7D2A, +0x7D2D,0x7D31,0x7D3C,0x7D3D,0x7D3E,0x7D40,0x7D41,0x7D47, +0x7D48,0x7D4D,0x7D51,0x7D53,0x7D57,0x7D59,0x7D5A,0x7D5C, +0x7D5D,0x7D65,0x7D67,0x7D6A,0x7D70,0x7D78,0x7D7A,0x7D7B, +0x7D7F,0x7D81,0x7D82,0x7D83,0x7D85,0x7D86,0x7D88,0x7D8B, +0x7D8C,0x7D8D,0x7D91,0x7D96,0x7D97,0x7D9D}; + +/* page 44 0x5421-0x547E */ +static uint16 tab_jisx0212_uni44[]={ +0x7D9E,0x7DA6,0x7DA7,0x7DAA,0x7DB3,0x7DB6,0x7DB7,0x7DB9, +0x7DC2,0x7DC3,0x7DC4,0x7DC5,0x7DC6,0x7DCC,0x7DCD,0x7DCE, +0x7DD7,0x7DD9,0x7E00,0x7DE2,0x7DE5,0x7DE6,0x7DEA,0x7DEB, +0x7DED,0x7DF1,0x7DF5,0x7DF6,0x7DF9,0x7DFA,0x7E08,0x7E10, +0x7E11,0x7E15,0x7E17,0x7E1C,0x7E1D,0x7E20,0x7E27,0x7E28, +0x7E2C,0x7E2D,0x7E2F,0x7E33,0x7E36,0x7E3F,0x7E44,0x7E45, +0x7E47,0x7E4E,0x7E50,0x7E52,0x7E58,0x7E5F,0x7E61,0x7E62, +0x7E65,0x7E6B,0x7E6E,0x7E6F,0x7E73,0x7E78,0x7E7E,0x7E81, +0x7E86,0x7E87,0x7E8A,0x7E8D,0x7E91,0x7E95,0x7E98,0x7E9A, +0x7E9D,0x7E9E,0x7F3C,0x7F3B,0x7F3D,0x7F3E,0x7F3F,0x7F43, +0x7F44,0x7F47,0x7F4F,0x7F52,0x7F53,0x7F5B,0x7F5C,0x7F5D, +0x7F61,0x7F63,0x7F64,0x7F65,0x7F66,0x7F6D}; + +/* page 45 0x5521-0x557E */ +static uint16 tab_jisx0212_uni45[]={ +0x7F71,0x7F7D,0x7F7E,0x7F7F,0x7F80,0x7F8B,0x7F8D,0x7F8F, +0x7F90,0x7F91,0x7F96,0x7F97,0x7F9C,0x7FA1,0x7FA2,0x7FA6, +0x7FAA,0x7FAD,0x7FB4,0x7FBC,0x7FBF,0x7FC0,0x7FC3,0x7FC8, +0x7FCE,0x7FCF,0x7FDB,0x7FDF,0x7FE3,0x7FE5,0x7FE8,0x7FEC, +0x7FEE,0x7FEF,0x7FF2,0x7FFA,0x7FFD,0x7FFE,0x7FFF,0x8007, +0x8008,0x800A,0x800D,0x800E,0x800F,0x8011,0x8013,0x8014, +0x8016,0x801D,0x801E,0x801F,0x8020,0x8024,0x8026,0x802C, +0x802E,0x8030,0x8034,0x8035,0x8037,0x8039,0x803A,0x803C, +0x803E,0x8040,0x8044,0x8060,0x8064,0x8066,0x806D,0x8071, +0x8075,0x8081,0x8088,0x808E,0x809C,0x809E,0x80A6,0x80A7, +0x80AB,0x80B8,0x80B9,0x80C8,0x80CD,0x80CF,0x80D2,0x80D4, +0x80D5,0x80D7,0x80D8,0x80E0,0x80ED,0x80EE}; + +/* page 46 0x5621-0x567E */ +static uint16 tab_jisx0212_uni46[]={ +0x80F0,0x80F2,0x80F3,0x80F6,0x80F9,0x80FA,0x80FE,0x8103, +0x810B,0x8116,0x8117,0x8118,0x811C,0x811E,0x8120,0x8124, +0x8127,0x812C,0x8130,0x8135,0x813A,0x813C,0x8145,0x8147, +0x814A,0x814C,0x8152,0x8157,0x8160,0x8161,0x8167,0x8168, +0x8169,0x816D,0x816F,0x8177,0x8181,0x8190,0x8184,0x8185, +0x8186,0x818B,0x818E,0x8196,0x8198,0x819B,0x819E,0x81A2, +0x81AE,0x81B2,0x81B4,0x81BB,0x81CB,0x81C3,0x81C5,0x81CA, +0x81CE,0x81CF,0x81D5,0x81D7,0x81DB,0x81DD,0x81DE,0x81E1, +0x81E4,0x81EB,0x81EC,0x81F0,0x81F1,0x81F2,0x81F5,0x81F6, +0x81F8,0x81F9,0x81FD,0x81FF,0x8200,0x8203,0x820F,0x8213, +0x8214,0x8219,0x821A,0x821D,0x8221,0x8222,0x8228,0x8232, +0x8234,0x823A,0x8243,0x8244,0x8245,0x8246}; + +/* page 47 0x5721-0x577E */ +static uint16 tab_jisx0212_uni47[]={ +0x824B,0x824E,0x824F,0x8251,0x8256,0x825C,0x8260,0x8263, +0x8267,0x826D,0x8274,0x827B,0x827D,0x827F,0x8280,0x8281, +0x8283,0x8284,0x8287,0x8289,0x828A,0x828E,0x8291,0x8294, +0x8296,0x8298,0x829A,0x829B,0x82A0,0x82A1,0x82A3,0x82A4, +0x82A7,0x82A8,0x82A9,0x82AA,0x82AE,0x82B0,0x82B2,0x82B4, +0x82B7,0x82BA,0x82BC,0x82BE,0x82BF,0x82C6,0x82D0,0x82D5, +0x82DA,0x82E0,0x82E2,0x82E4,0x82E8,0x82EA,0x82ED,0x82EF, +0x82F6,0x82F7,0x82FD,0x82FE,0x8300,0x8301,0x8307,0x8308, +0x830A,0x830B,0x8354,0x831B,0x831D,0x831E,0x831F,0x8321, +0x8322,0x832C,0x832D,0x832E,0x8330,0x8333,0x8337,0x833A, +0x833C,0x833D,0x8342,0x8343,0x8344,0x8347,0x834D,0x834E, +0x8351,0x8355,0x8356,0x8357,0x8370,0x8378}; + +/* page 48 0x5821-0x587E */ +static uint16 tab_jisx0212_uni48[]={ +0x837D,0x837F,0x8380,0x8382,0x8384,0x8386,0x838D,0x8392, +0x8394,0x8395,0x8398,0x8399,0x839B,0x839C,0x839D,0x83A6, +0x83A7,0x83A9,0x83AC,0x83BE,0x83BF,0x83C0,0x83C7,0x83C9, +0x83CF,0x83D0,0x83D1,0x83D4,0x83DD,0x8353,0x83E8,0x83EA, +0x83F6,0x83F8,0x83F9,0x83FC,0x8401,0x8406,0x840A,0x840F, +0x8411,0x8415,0x8419,0x83AD,0x842F,0x8439,0x8445,0x8447, +0x8448,0x844A,0x844D,0x844F,0x8451,0x8452,0x8456,0x8458, +0x8459,0x845A,0x845C,0x8460,0x8464,0x8465,0x8467,0x846A, +0x8470,0x8473,0x8474,0x8476,0x8478,0x847C,0x847D,0x8481, +0x8485,0x8492,0x8493,0x8495,0x849E,0x84A6,0x84A8,0x84A9, +0x84AA,0x84AF,0x84B1,0x84B4,0x84BA,0x84BD,0x84BE,0x84C0, +0x84C2,0x84C7,0x84C8,0x84CC,0x84CF,0x84D3}; + +/* page 49 0x5921-0x597E */ +static uint16 tab_jisx0212_uni49[]={ +0x84DC,0x84E7,0x84EA,0x84EF,0x84F0,0x84F1,0x84F2,0x84F7, +0x8532,0x84FA,0x84FB,0x84FD,0x8502,0x8503,0x8507,0x850C, +0x850E,0x8510,0x851C,0x851E,0x8522,0x8523,0x8524,0x8525, +0x8527,0x852A,0x852B,0x852F,0x8533,0x8534,0x8536,0x853F, +0x8546,0x854F,0x8550,0x8551,0x8552,0x8553,0x8556,0x8559, +0x855C,0x855D,0x855E,0x855F,0x8560,0x8561,0x8562,0x8564, +0x856B,0x856F,0x8579,0x857A,0x857B,0x857D,0x857F,0x8581, +0x8585,0x8586,0x8589,0x858B,0x858C,0x858F,0x8593,0x8598, +0x859D,0x859F,0x85A0,0x85A2,0x85A5,0x85A7,0x85B4,0x85B6, +0x85B7,0x85B8,0x85BC,0x85BD,0x85BE,0x85BF,0x85C2,0x85C7, +0x85CA,0x85CB,0x85CE,0x85AD,0x85D8,0x85DA,0x85DF,0x85E0, +0x85E6,0x85E8,0x85ED,0x85F3,0x85F6,0x85FC}; + +/* page 50 0x5A21-0x5A7E */ +static uint16 tab_jisx0212_uni50[]={ +0x85FF,0x8600,0x8604,0x8605,0x860D,0x860E,0x8610,0x8611, +0x8612,0x8618,0x8619,0x861B,0x861E,0x8621,0x8627,0x8629, +0x8636,0x8638,0x863A,0x863C,0x863D,0x8640,0x8642,0x8646, +0x8652,0x8653,0x8656,0x8657,0x8658,0x8659,0x865D,0x8660, +0x8661,0x8662,0x8663,0x8664,0x8669,0x866C,0x866F,0x8675, +0x8676,0x8677,0x867A,0x868D,0x8691,0x8696,0x8698,0x869A, +0x869C,0x86A1,0x86A6,0x86A7,0x86A8,0x86AD,0x86B1,0x86B3, +0x86B4,0x86B5,0x86B7,0x86B8,0x86B9,0x86BF,0x86C0,0x86C1, +0x86C3,0x86C5,0x86D1,0x86D2,0x86D5,0x86D7,0x86DA,0x86DC, +0x86E0,0x86E3,0x86E5,0x86E7,0x8688,0x86FA,0x86FC,0x86FD, +0x8704,0x8705,0x8707,0x870B,0x870E,0x870F,0x8710,0x8713, +0x8714,0x8719,0x871E,0x871F,0x8721,0x8723}; + +/* page 51 0x5B21-0x5B7E */ +static uint16 tab_jisx0212_uni51[]={ +0x8728,0x872E,0x872F,0x8731,0x8732,0x8739,0x873A,0x873C, +0x873D,0x873E,0x8740,0x8743,0x8745,0x874D,0x8758,0x875D, +0x8761,0x8764,0x8765,0x876F,0x8771,0x8772,0x877B,0x8783, +0x8784,0x8785,0x8786,0x8787,0x8788,0x8789,0x878B,0x878C, +0x8790,0x8793,0x8795,0x8797,0x8798,0x8799,0x879E,0x87A0, +0x87A3,0x87A7,0x87AC,0x87AD,0x87AE,0x87B1,0x87B5,0x87BE, +0x87BF,0x87C1,0x87C8,0x87C9,0x87CA,0x87CE,0x87D5,0x87D6, +0x87D9,0x87DA,0x87DC,0x87DF,0x87E2,0x87E3,0x87E4,0x87EA, +0x87EB,0x87ED,0x87F1,0x87F3,0x87F8,0x87FA,0x87FF,0x8801, +0x8803,0x8806,0x8809,0x880A,0x880B,0x8810,0x8819,0x8812, +0x8813,0x8814,0x8818,0x881A,0x881B,0x881C,0x881E,0x881F, +0x8828,0x882D,0x882E,0x8830,0x8832,0x8835}; + +/* page 52 0x5C21-0x5C7E */ +static uint16 tab_jisx0212_uni52[]={ +0x883A,0x883C,0x8841,0x8843,0x8845,0x8848,0x8849,0x884A, +0x884B,0x884E,0x8851,0x8855,0x8856,0x8858,0x885A,0x885C, +0x885F,0x8860,0x8864,0x8869,0x8871,0x8879,0x887B,0x8880, +0x8898,0x889A,0x889B,0x889C,0x889F,0x88A0,0x88A8,0x88AA, +0x88BA,0x88BD,0x88BE,0x88C0,0x88CA,0x88CB,0x88CC,0x88CD, +0x88CE,0x88D1,0x88D2,0x88D3,0x88DB,0x88DE,0x88E7,0x88EF, +0x88F0,0x88F1,0x88F5,0x88F7,0x8901,0x8906,0x890D,0x890E, +0x890F,0x8915,0x8916,0x8918,0x8919,0x891A,0x891C,0x8920, +0x8926,0x8927,0x8928,0x8930,0x8931,0x8932,0x8935,0x8939, +0x893A,0x893E,0x8940,0x8942,0x8945,0x8946,0x8949,0x894F, +0x8952,0x8957,0x895A,0x895B,0x895C,0x8961,0x8962,0x8963, +0x896B,0x896E,0x8970,0x8973,0x8975,0x897A}; + +/* page 53 0x5D21-0x5D7E */ +static uint16 tab_jisx0212_uni53[]={ +0x897B,0x897C,0x897D,0x8989,0x898D,0x8990,0x8994,0x8995, +0x899B,0x899C,0x899F,0x89A0,0x89A5,0x89B0,0x89B4,0x89B5, +0x89B6,0x89B7,0x89BC,0x89D4,0x89D5,0x89D6,0x89D7,0x89D8, +0x89E5,0x89E9,0x89EB,0x89ED,0x89F1,0x89F3,0x89F6,0x89F9, +0x89FD,0x89FF,0x8A04,0x8A05,0x8A07,0x8A0F,0x8A11,0x8A12, +0x8A14,0x8A15,0x8A1E,0x8A20,0x8A22,0x8A24,0x8A26,0x8A2B, +0x8A2C,0x8A2F,0x8A35,0x8A37,0x8A3D,0x8A3E,0x8A40,0x8A43, +0x8A45,0x8A47,0x8A49,0x8A4D,0x8A4E,0x8A53,0x8A56,0x8A57, +0x8A58,0x8A5C,0x8A5D,0x8A61,0x8A65,0x8A67,0x8A75,0x8A76, +0x8A77,0x8A79,0x8A7A,0x8A7B,0x8A7E,0x8A7F,0x8A80,0x8A83, +0x8A86,0x8A8B,0x8A8F,0x8A90,0x8A92,0x8A96,0x8A97,0x8A99, +0x8A9F,0x8AA7,0x8AA9,0x8AAE,0x8AAF,0x8AB3}; + +/* page 54 0x5E21-0x5E7E */ +static uint16 tab_jisx0212_uni54[]={ +0x8AB6,0x8AB7,0x8ABB,0x8ABE,0x8AC3,0x8AC6,0x8AC8,0x8AC9, +0x8ACA,0x8AD1,0x8AD3,0x8AD4,0x8AD5,0x8AD7,0x8ADD,0x8ADF, +0x8AEC,0x8AF0,0x8AF4,0x8AF5,0x8AF6,0x8AFC,0x8AFF,0x8B05, +0x8B06,0x8B0B,0x8B11,0x8B1C,0x8B1E,0x8B1F,0x8B0A,0x8B2D, +0x8B30,0x8B37,0x8B3C,0x8B42,0x8B43,0x8B44,0x8B45,0x8B46, +0x8B48,0x8B52,0x8B53,0x8B54,0x8B59,0x8B4D,0x8B5E,0x8B63, +0x8B6D,0x8B76,0x8B78,0x8B79,0x8B7C,0x8B7E,0x8B81,0x8B84, +0x8B85,0x8B8B,0x8B8D,0x8B8F,0x8B94,0x8B95,0x8B9C,0x8B9E, +0x8B9F,0x8C38,0x8C39,0x8C3D,0x8C3E,0x8C45,0x8C47,0x8C49, +0x8C4B,0x8C4F,0x8C51,0x8C53,0x8C54,0x8C57,0x8C58,0x8C5B, +0x8C5D,0x8C59,0x8C63,0x8C64,0x8C66,0x8C68,0x8C69,0x8C6D, +0x8C73,0x8C75,0x8C76,0x8C7B,0x8C7E,0x8C86}; + +/* page 55 0x5F21-0x5F7E */ +static uint16 tab_jisx0212_uni55[]={ +0x8C87,0x8C8B,0x8C90,0x8C92,0x8C93,0x8C99,0x8C9B,0x8C9C, +0x8CA4,0x8CB9,0x8CBA,0x8CC5,0x8CC6,0x8CC9,0x8CCB,0x8CCF, +0x8CD6,0x8CD5,0x8CD9,0x8CDD,0x8CE1,0x8CE8,0x8CEC,0x8CEF, +0x8CF0,0x8CF2,0x8CF5,0x8CF7,0x8CF8,0x8CFE,0x8CFF,0x8D01, +0x8D03,0x8D09,0x8D12,0x8D17,0x8D1B,0x8D65,0x8D69,0x8D6C, +0x8D6E,0x8D7F,0x8D82,0x8D84,0x8D88,0x8D8D,0x8D90,0x8D91, +0x8D95,0x8D9E,0x8D9F,0x8DA0,0x8DA6,0x8DAB,0x8DAC,0x8DAF, +0x8DB2,0x8DB5,0x8DB7,0x8DB9,0x8DBB,0x8DC0,0x8DC5,0x8DC6, +0x8DC7,0x8DC8,0x8DCA,0x8DCE,0x8DD1,0x8DD4,0x8DD5,0x8DD7, +0x8DD9,0x8DE4,0x8DE5,0x8DE7,0x8DEC,0x8DF0,0x8DBC,0x8DF1, +0x8DF2,0x8DF4,0x8DFD,0x8E01,0x8E04,0x8E05,0x8E06,0x8E0B, +0x8E11,0x8E14,0x8E16,0x8E20,0x8E21,0x8E22}; + +/* page 56 0x6021-0x607E */ +static uint16 tab_jisx0212_uni56[]={ +0x8E23,0x8E26,0x8E27,0x8E31,0x8E33,0x8E36,0x8E37,0x8E38, +0x8E39,0x8E3D,0x8E40,0x8E41,0x8E4B,0x8E4D,0x8E4E,0x8E4F, +0x8E54,0x8E5B,0x8E5C,0x8E5D,0x8E5E,0x8E61,0x8E62,0x8E69, +0x8E6C,0x8E6D,0x8E6F,0x8E70,0x8E71,0x8E79,0x8E7A,0x8E7B, +0x8E82,0x8E83,0x8E89,0x8E90,0x8E92,0x8E95,0x8E9A,0x8E9B, +0x8E9D,0x8E9E,0x8EA2,0x8EA7,0x8EA9,0x8EAD,0x8EAE,0x8EB3, +0x8EB5,0x8EBA,0x8EBB,0x8EC0,0x8EC1,0x8EC3,0x8EC4,0x8EC7, +0x8ECF,0x8ED1,0x8ED4,0x8EDC,0x8EE8,0x8EEE,0x8EF0,0x8EF1, +0x8EF7,0x8EF9,0x8EFA,0x8EED,0x8F00,0x8F02,0x8F07,0x8F08, +0x8F0F,0x8F10,0x8F16,0x8F17,0x8F18,0x8F1E,0x8F20,0x8F21, +0x8F23,0x8F25,0x8F27,0x8F28,0x8F2C,0x8F2D,0x8F2E,0x8F34, +0x8F35,0x8F36,0x8F37,0x8F3A,0x8F40,0x8F41}; + +/* page 57 0x6121-0x617E */ +static uint16 tab_jisx0212_uni57[]={ +0x8F43,0x8F47,0x8F4F,0x8F51,0x8F52,0x8F53,0x8F54,0x8F55, +0x8F58,0x8F5D,0x8F5E,0x8F65,0x8F9D,0x8FA0,0x8FA1,0x8FA4, +0x8FA5,0x8FA6,0x8FB5,0x8FB6,0x8FB8,0x8FBE,0x8FC0,0x8FC1, +0x8FC6,0x8FCA,0x8FCB,0x8FCD,0x8FD0,0x8FD2,0x8FD3,0x8FD5, +0x8FE0,0x8FE3,0x8FE4,0x8FE8,0x8FEE,0x8FF1,0x8FF5,0x8FF6, +0x8FFB,0x8FFE,0x9002,0x9004,0x9008,0x900C,0x9018,0x901B, +0x9028,0x9029,0x902F,0x902A,0x902C,0x902D,0x9033,0x9034, +0x9037,0x903F,0x9043,0x9044,0x904C,0x905B,0x905D,0x9062, +0x9066,0x9067,0x906C,0x9070,0x9074,0x9079,0x9085,0x9088, +0x908B,0x908C,0x908E,0x9090,0x9095,0x9097,0x9098,0x9099, +0x909B,0x90A0,0x90A1,0x90A2,0x90A5,0x90B0,0x90B2,0x90B3, +0x90B4,0x90B6,0x90BD,0x90CC,0x90BE,0x90C3}; + +/* page 58 0x6221-0x627E */ +static uint16 tab_jisx0212_uni58[]={ +0x90C4,0x90C5,0x90C7,0x90C8,0x90D5,0x90D7,0x90D8,0x90D9, +0x90DC,0x90DD,0x90DF,0x90E5,0x90D2,0x90F6,0x90EB,0x90EF, +0x90F0,0x90F4,0x90FE,0x90FF,0x9100,0x9104,0x9105,0x9106, +0x9108,0x910D,0x9110,0x9114,0x9116,0x9117,0x9118,0x911A, +0x911C,0x911E,0x9120,0x9125,0x9122,0x9123,0x9127,0x9129, +0x912E,0x912F,0x9131,0x9134,0x9136,0x9137,0x9139,0x913A, +0x913C,0x913D,0x9143,0x9147,0x9148,0x914F,0x9153,0x9157, +0x9159,0x915A,0x915B,0x9161,0x9164,0x9167,0x916D,0x9174, +0x9179,0x917A,0x917B,0x9181,0x9183,0x9185,0x9186,0x918A, +0x918E,0x9191,0x9193,0x9194,0x9195,0x9198,0x919E,0x91A1, +0x91A6,0x91A8,0x91AC,0x91AD,0x91AE,0x91B0,0x91B1,0x91B2, +0x91B3,0x91B6,0x91BB,0x91BC,0x91BD,0x91BF}; + +/* page 59 0x6321-0x637E */ +static uint16 tab_jisx0212_uni59[]={ +0x91C2,0x91C3,0x91C5,0x91D3,0x91D4,0x91D7,0x91D9,0x91DA, +0x91DE,0x91E4,0x91E5,0x91E9,0x91EA,0x91EC,0x91ED,0x91EE, +0x91EF,0x91F0,0x91F1,0x91F7,0x91F9,0x91FB,0x91FD,0x9200, +0x9201,0x9204,0x9205,0x9206,0x9207,0x9209,0x920A,0x920C, +0x9210,0x9212,0x9213,0x9216,0x9218,0x921C,0x921D,0x9223, +0x9224,0x9225,0x9226,0x9228,0x922E,0x922F,0x9230,0x9233, +0x9235,0x9236,0x9238,0x9239,0x923A,0x923C,0x923E,0x9240, +0x9242,0x9243,0x9246,0x9247,0x924A,0x924D,0x924E,0x924F, +0x9251,0x9258,0x9259,0x925C,0x925D,0x9260,0x9261,0x9265, +0x9267,0x9268,0x9269,0x926E,0x926F,0x9270,0x9275,0x9276, +0x9277,0x9278,0x9279,0x927B,0x927C,0x927D,0x927F,0x9288, +0x9289,0x928A,0x928D,0x928E,0x9292,0x9297}; + +/* page 60 0x6421-0x647E */ +static uint16 tab_jisx0212_uni60[]={ +0x9299,0x929F,0x92A0,0x92A4,0x92A5,0x92A7,0x92A8,0x92AB, +0x92AF,0x92B2,0x92B6,0x92B8,0x92BA,0x92BB,0x92BC,0x92BD, +0x92BF,0x92C0,0x92C1,0x92C2,0x92C3,0x92C5,0x92C6,0x92C7, +0x92C8,0x92CB,0x92CC,0x92CD,0x92CE,0x92D0,0x92D3,0x92D5, +0x92D7,0x92D8,0x92D9,0x92DC,0x92DD,0x92DF,0x92E0,0x92E1, +0x92E3,0x92E5,0x92E7,0x92E8,0x92EC,0x92EE,0x92F0,0x92F9, +0x92FB,0x92FF,0x9300,0x9302,0x9308,0x930D,0x9311,0x9314, +0x9315,0x931C,0x931D,0x931E,0x931F,0x9321,0x9324,0x9325, +0x9327,0x9329,0x932A,0x9333,0x9334,0x9336,0x9337,0x9347, +0x9348,0x9349,0x9350,0x9351,0x9352,0x9355,0x9357,0x9358, +0x935A,0x935E,0x9364,0x9365,0x9367,0x9369,0x936A,0x936D, +0x936F,0x9370,0x9371,0x9373,0x9374,0x9376}; + +/* page 61 0x6521-0x657E */ +static uint16 tab_jisx0212_uni61[]={ +0x937A,0x937D,0x937F,0x9380,0x9381,0x9382,0x9388,0x938A, +0x938B,0x938D,0x938F,0x9392,0x9395,0x9398,0x939B,0x939E, +0x93A1,0x93A3,0x93A4,0x93A6,0x93A8,0x93AB,0x93B4,0x93B5, +0x93B6,0x93BA,0x93A9,0x93C1,0x93C4,0x93C5,0x93C6,0x93C7, +0x93C9,0x93CA,0x93CB,0x93CC,0x93CD,0x93D3,0x93D9,0x93DC, +0x93DE,0x93DF,0x93E2,0x93E6,0x93E7,0x93F9,0x93F7,0x93F8, +0x93FA,0x93FB,0x93FD,0x9401,0x9402,0x9404,0x9408,0x9409, +0x940D,0x940E,0x940F,0x9415,0x9416,0x9417,0x941F,0x942E, +0x942F,0x9431,0x9432,0x9433,0x9434,0x943B,0x943F,0x943D, +0x9443,0x9445,0x9448,0x944A,0x944C,0x9455,0x9459,0x945C, +0x945F,0x9461,0x9463,0x9468,0x946B,0x946D,0x946E,0x946F, +0x9471,0x9472,0x9484,0x9483,0x9578,0x9579}; + +/* page 62 0x6621-0x667E */ +static uint16 tab_jisx0212_uni62[]={ +0x957E,0x9584,0x9588,0x958C,0x958D,0x958E,0x959D,0x959E, +0x959F,0x95A1,0x95A6,0x95A9,0x95AB,0x95AC,0x95B4,0x95B6, +0x95BA,0x95BD,0x95BF,0x95C6,0x95C8,0x95C9,0x95CB,0x95D0, +0x95D1,0x95D2,0x95D3,0x95D9,0x95DA,0x95DD,0x95DE,0x95DF, +0x95E0,0x95E4,0x95E6,0x961D,0x961E,0x9622,0x9624,0x9625, +0x9626,0x962C,0x9631,0x9633,0x9637,0x9638,0x9639,0x963A, +0x963C,0x963D,0x9641,0x9652,0x9654,0x9656,0x9657,0x9658, +0x9661,0x966E,0x9674,0x967B,0x967C,0x967E,0x967F,0x9681, +0x9682,0x9683,0x9684,0x9689,0x9691,0x9696,0x969A,0x969D, +0x969F,0x96A4,0x96A5,0x96A6,0x96A9,0x96AE,0x96AF,0x96B3, +0x96BA,0x96CA,0x96D2,0x5DB2,0x96D8,0x96DA,0x96DD,0x96DE, +0x96DF,0x96E9,0x96EF,0x96F1,0x96FA,0x9702}; + +/* page 63 0x6721-0x677E */ +static uint16 tab_jisx0212_uni63[]={ +0x9703,0x9705,0x9709,0x971A,0x971B,0x971D,0x9721,0x9722, +0x9723,0x9728,0x9731,0x9733,0x9741,0x9743,0x974A,0x974E, +0x974F,0x9755,0x9757,0x9758,0x975A,0x975B,0x9763,0x9767, +0x976A,0x976E,0x9773,0x9776,0x9777,0x9778,0x977B,0x977D, +0x977F,0x9780,0x9789,0x9795,0x9796,0x9797,0x9799,0x979A, +0x979E,0x979F,0x97A2,0x97AC,0x97AE,0x97B1,0x97B2,0x97B5, +0x97B6,0x97B8,0x97B9,0x97BA,0x97BC,0x97BE,0x97BF,0x97C1, +0x97C4,0x97C5,0x97C7,0x97C9,0x97CA,0x97CC,0x97CD,0x97CE, +0x97D0,0x97D1,0x97D4,0x97D7,0x97D8,0x97D9,0x97DD,0x97DE, +0x97E0,0x97DB,0x97E1,0x97E4,0x97EF,0x97F1,0x97F4,0x97F7, +0x97F8,0x97FA,0x9807,0x980A,0x9819,0x980D,0x980E,0x9814, +0x9816,0x981C,0x981E,0x9820,0x9823,0x9826}; + +/* page 64 0x6821-0x687E */ +static uint16 tab_jisx0212_uni64[]={ +0x982B,0x982E,0x982F,0x9830,0x9832,0x9833,0x9835,0x9825, +0x983E,0x9844,0x9847,0x984A,0x9851,0x9852,0x9853,0x9856, +0x9857,0x9859,0x985A,0x9862,0x9863,0x9865,0x9866,0x986A, +0x986C,0x98AB,0x98AD,0x98AE,0x98B0,0x98B4,0x98B7,0x98B8, +0x98BA,0x98BB,0x98BF,0x98C2,0x98C5,0x98C8,0x98CC,0x98E1, +0x98E3,0x98E5,0x98E6,0x98E7,0x98EA,0x98F3,0x98F6,0x9902, +0x9907,0x9908,0x9911,0x9915,0x9916,0x9917,0x991A,0x991B, +0x991C,0x991F,0x9922,0x9926,0x9927,0x992B,0x9931,0x9932, +0x9933,0x9934,0x9935,0x9939,0x993A,0x993B,0x993C,0x9940, +0x9941,0x9946,0x9947,0x9948,0x994D,0x994E,0x9954,0x9958, +0x9959,0x995B,0x995C,0x995E,0x995F,0x9960,0x999B,0x999D, +0x999F,0x99A6,0x99B0,0x99B1,0x99B2,0x99B5}; + +/* page 65 0x6921-0x697E */ +static uint16 tab_jisx0212_uni65[]={ +0x99B9,0x99BA,0x99BD,0x99BF,0x99C3,0x99C9,0x99D3,0x99D4, +0x99D9,0x99DA,0x99DC,0x99DE,0x99E7,0x99EA,0x99EB,0x99EC, +0x99F0,0x99F4,0x99F5,0x99F9,0x99FD,0x99FE,0x9A02,0x9A03, +0x9A04,0x9A0B,0x9A0C,0x9A10,0x9A11,0x9A16,0x9A1E,0x9A20, +0x9A22,0x9A23,0x9A24,0x9A27,0x9A2D,0x9A2E,0x9A33,0x9A35, +0x9A36,0x9A38,0x9A47,0x9A41,0x9A44,0x9A4A,0x9A4B,0x9A4C, +0x9A4E,0x9A51,0x9A54,0x9A56,0x9A5D,0x9AAA,0x9AAC,0x9AAE, +0x9AAF,0x9AB2,0x9AB4,0x9AB5,0x9AB6,0x9AB9,0x9ABB,0x9ABE, +0x9ABF,0x9AC1,0x9AC3,0x9AC6,0x9AC8,0x9ACE,0x9AD0,0x9AD2, +0x9AD5,0x9AD6,0x9AD7,0x9ADB,0x9ADC,0x9AE0,0x9AE4,0x9AE5, +0x9AE7,0x9AE9,0x9AEC,0x9AF2,0x9AF3,0x9AF5,0x9AF9,0x9AFA, +0x9AFD,0x9AFF,0x9B00,0x9B01,0x9B02,0x9B03}; + +/* page 66 0x6A21-0x6A7E */ +static uint16 tab_jisx0212_uni66[]={ +0x9B04,0x9B05,0x9B08,0x9B09,0x9B0B,0x9B0C,0x9B0D,0x9B0E, +0x9B10,0x9B12,0x9B16,0x9B19,0x9B1B,0x9B1C,0x9B20,0x9B26, +0x9B2B,0x9B2D,0x9B33,0x9B34,0x9B35,0x9B37,0x9B39,0x9B3A, +0x9B3D,0x9B48,0x9B4B,0x9B4C,0x9B55,0x9B56,0x9B57,0x9B5B, +0x9B5E,0x9B61,0x9B63,0x9B65,0x9B66,0x9B68,0x9B6A,0x9B6B, +0x9B6C,0x9B6D,0x9B6E,0x9B73,0x9B75,0x9B77,0x9B78,0x9B79, +0x9B7F,0x9B80,0x9B84,0x9B85,0x9B86,0x9B87,0x9B89,0x9B8A, +0x9B8B,0x9B8D,0x9B8F,0x9B90,0x9B94,0x9B9A,0x9B9D,0x9B9E, +0x9BA6,0x9BA7,0x9BA9,0x9BAC,0x9BB0,0x9BB1,0x9BB2,0x9BB7, +0x9BB8,0x9BBB,0x9BBC,0x9BBE,0x9BBF,0x9BC1,0x9BC7,0x9BC8, +0x9BCE,0x9BD0,0x9BD7,0x9BD8,0x9BDD,0x9BDF,0x9BE5,0x9BE7, +0x9BEA,0x9BEB,0x9BEF,0x9BF3,0x9BF7,0x9BF8}; + +/* page 67 0x6B21-0x6B7E */ +static uint16 tab_jisx0212_uni67[]={ +0x9BF9,0x9BFA,0x9BFD,0x9BFF,0x9C00,0x9C02,0x9C0B,0x9C0F, +0x9C11,0x9C16,0x9C18,0x9C19,0x9C1A,0x9C1C,0x9C1E,0x9C22, +0x9C23,0x9C26,0x9C27,0x9C28,0x9C29,0x9C2A,0x9C31,0x9C35, +0x9C36,0x9C37,0x9C3D,0x9C41,0x9C43,0x9C44,0x9C45,0x9C49, +0x9C4A,0x9C4E,0x9C4F,0x9C50,0x9C53,0x9C54,0x9C56,0x9C58, +0x9C5B,0x9C5D,0x9C5E,0x9C5F,0x9C63,0x9C69,0x9C6A,0x9C5C, +0x9C6B,0x9C68,0x9C6E,0x9C70,0x9C72,0x9C75,0x9C77,0x9C7B, +0x9CE6,0x9CF2,0x9CF7,0x9CF9,0x9D0B,0x9D02,0x9D11,0x9D17, +0x9D18,0x9D1C,0x9D1D,0x9D1E,0x9D2F,0x9D30,0x9D32,0x9D33, +0x9D34,0x9D3A,0x9D3C,0x9D45,0x9D3D,0x9D42,0x9D43,0x9D47, +0x9D4A,0x9D53,0x9D54,0x9D5F,0x9D63,0x9D62,0x9D65,0x9D69, +0x9D6A,0x9D6B,0x9D70,0x9D76,0x9D77,0x9D7B}; + +/* page 68 0x6C21-0x6C7E */ +static uint16 tab_jisx0212_uni68[]={ +0x9D7C,0x9D7E,0x9D83,0x9D84,0x9D86,0x9D8A,0x9D8D,0x9D8E, +0x9D92,0x9D93,0x9D95,0x9D96,0x9D97,0x9D98,0x9DA1,0x9DAA, +0x9DAC,0x9DAE,0x9DB1,0x9DB5,0x9DB9,0x9DBC,0x9DBF,0x9DC3, +0x9DC7,0x9DC9,0x9DCA,0x9DD4,0x9DD5,0x9DD6,0x9DD7,0x9DDA, +0x9DDE,0x9DDF,0x9DE0,0x9DE5,0x9DE7,0x9DE9,0x9DEB,0x9DEE, +0x9DF0,0x9DF3,0x9DF4,0x9DFE,0x9E0A,0x9E02,0x9E07,0x9E0E, +0x9E10,0x9E11,0x9E12,0x9E15,0x9E16,0x9E19,0x9E1C,0x9E1D, +0x9E7A,0x9E7B,0x9E7C,0x9E80,0x9E82,0x9E83,0x9E84,0x9E85, +0x9E87,0x9E8E,0x9E8F,0x9E96,0x9E98,0x9E9B,0x9E9E,0x9EA4, +0x9EA8,0x9EAC,0x9EAE,0x9EAF,0x9EB0,0x9EB3,0x9EB4,0x9EB5, +0x9EC6,0x9EC8,0x9ECB,0x9ED5,0x9EDF,0x9EE4,0x9EE7,0x9EEC, +0x9EED,0x9EEE,0x9EF0,0x9EF1,0x9EF2,0x9EF5}; + +/* page 69 0x6D21-0x6D63 */ +static uint16 tab_jisx0212_uni69[]={ +0x9EF8,0x9EFF,0x9F02,0x9F03,0x9F09,0x9F0F,0x9F10,0x9F11, +0x9F12,0x9F14,0x9F16,0x9F17,0x9F19,0x9F1A,0x9F1B,0x9F1F, +0x9F22,0x9F26,0x9F2A,0x9F2B,0x9F2F,0x9F31,0x9F32,0x9F34, +0x9F37,0x9F39,0x9F3A,0x9F3C,0x9F3D,0x9F3F,0x9F41,0x9F43, +0x9F44,0x9F45,0x9F46,0x9F47,0x9F53,0x9F55,0x9F56,0x9F57, +0x9F58,0x9F5A,0x9F5D,0x9F5E,0x9F68,0x9F69,0x9F6D,0x9F6E, +0x9F6F,0x9F70,0x9F71,0x9F73,0x9F75,0x9F7A,0x9F7D,0x9F8F, +0x9F90,0x9F91,0x9F92,0x9F94,0x9F96,0x9F97,0x9F9E,0x9FA1, +0x9FA2,0x9FA3,0x9FA5}; + +/* page 70 0x7371-0x737E IBM Kanji and Nonkanji */ +static uint16 tab_jisx0212_uni70[]={ + 0, 0,0x2170,0x2171,0x2172,0x2173,0x2174,0x2175, +0x2176,0x2177,0x2178,0x2179,0x2160,0x2161}; + +/* page 71 0x7421-0x747E IBM Kanji and Nonkanji*/ +static uint16 tab_jisx0212_uni71[]={ +0x2162,0x2163,0x2164,0x2165,0x2166,0x2167,0x2168,0x2169, +0xFF07,0xFF02,0x3231,0x2116,0x2121,0x70BB,0x4EFC,0x50F4, +0x51EC,0x5307,0x5324,0xFA0E,0x548A,0x5759,0xFA0F,0xFA10, +0x589E,0x5BEC,0x5CF5,0x5D53,0xFA11,0x5FB7,0x6085,0x6120, +0x654E,0x663B,0x6665,0xFA12,0xF929,0x6801,0xFA13,0xFA14, +0x6A6B,0x6AE2,0x6DF8,0x6DF2,0x7028,0xFA15,0xFA16,0x7501, +0x7682,0x769E,0xFA17,0x7930,0xFA18,0xFA19,0xFA1A,0xFA1B, +0x7AE7,0xFA1C,0xFA1D,0x7DA0,0x7DD6,0xFA1E,0x8362,0xFA1F, +0x85B0,0xFA20,0xFA21,0x8807,0xFA22,0x8B7F,0x8CF4,0x8D76, +0xFA23,0xFA24,0xFA25,0x90DE,0xFA26,0x9115,0xFA27,0xFA28, +0x9592,0xF9DC,0xFA29,0x973B,0x974D,0x9751,0xFA2A,0xFA2B, +0xFA2C,0x999E,0x9AD9,0x9B72,0xFA2D,0x9ED1}; + +static int +my_jisx0212_uni_onechar(int code){ + if ((code>=0x222F)&&(code<=0x2244)) + return(tab_jisx0212_uni0[code-0x222F]); + if ((code>=0x226B)&&(code<=0x2271)) + return(tab_jisx0212_uni1[code-0x226B]); + if ((code>=0x2661)&&(code<=0x267C)) + return(tab_jisx0212_uni2[code-0x2661]); + if ((code>=0x2742)&&(code<=0x274E)) + return(tab_jisx0212_uni3[code-0x2742]); + if ((code>=0x2772)&&(code<=0x277E)) + return(tab_jisx0212_uni4[code-0x2772]); + if ((code>=0x2921)&&(code<=0x2950)) + return(tab_jisx0212_uni5[code-0x2921]); + if ((code>=0x2A21)&&(code<=0x2A77)) + return(tab_jisx0212_uni6[code-0x2A21]); + if ((code>=0x2B21)&&(code<=0x2B77)) + return(tab_jisx0212_uni7[code-0x2B21]); + if ((code>=0x3021)&&(code<=0x307E)) + return(tab_jisx0212_uni8[code-0x3021]); + if ((code>=0x3121)&&(code<=0x317E)) + return(tab_jisx0212_uni9[code-0x3121]); + if ((code>=0x3221)&&(code<=0x327E)) + return(tab_jisx0212_uni10[code-0x3221]); + if ((code>=0x3321)&&(code<=0x337E)) + return(tab_jisx0212_uni11[code-0x3321]); + if ((code>=0x3421)&&(code<=0x347E)) + return(tab_jisx0212_uni12[code-0x3421]); + if ((code>=0x3521)&&(code<=0x357E)) + return(tab_jisx0212_uni13[code-0x3521]); + if ((code>=0x3621)&&(code<=0x367E)) + return(tab_jisx0212_uni14[code-0x3621]); + if ((code>=0x3721)&&(code<=0x377E)) + return(tab_jisx0212_uni15[code-0x3721]); + if ((code>=0x3821)&&(code<=0x387E)) + return(tab_jisx0212_uni16[code-0x3821]); + if ((code>=0x3921)&&(code<=0x397E)) + return(tab_jisx0212_uni17[code-0x3921]); + if ((code>=0x3A21)&&(code<=0x3A7E)) + return(tab_jisx0212_uni18[code-0x3A21]); + if ((code>=0x3B21)&&(code<=0x3B7E)) + return(tab_jisx0212_uni19[code-0x3B21]); + if ((code>=0x3C21)&&(code<=0x3C7E)) + return(tab_jisx0212_uni20[code-0x3C21]); + if ((code>=0x3D21)&&(code<=0x3D7E)) + return(tab_jisx0212_uni21[code-0x3D21]); + if ((code>=0x3E21)&&(code<=0x3E7E)) + return(tab_jisx0212_uni22[code-0x3E21]); + if ((code>=0x3F21)&&(code<=0x3F7E)) + return(tab_jisx0212_uni23[code-0x3F21]); + if ((code>=0x4021)&&(code<=0x407E)) + return(tab_jisx0212_uni24[code-0x4021]); + if ((code>=0x4121)&&(code<=0x417E)) + return(tab_jisx0212_uni25[code-0x4121]); + if ((code>=0x4221)&&(code<=0x427E)) + return(tab_jisx0212_uni26[code-0x4221]); + if ((code>=0x4321)&&(code<=0x437E)) + return(tab_jisx0212_uni27[code-0x4321]); + if ((code>=0x4421)&&(code<=0x447E)) + return(tab_jisx0212_uni28[code-0x4421]); + if ((code>=0x4521)&&(code<=0x457E)) + return(tab_jisx0212_uni29[code-0x4521]); + if ((code>=0x4621)&&(code<=0x467E)) + return(tab_jisx0212_uni30[code-0x4621]); + if ((code>=0x4721)&&(code<=0x477E)) + return(tab_jisx0212_uni31[code-0x4721]); + if ((code>=0x4821)&&(code<=0x487E)) + return(tab_jisx0212_uni32[code-0x4821]); + if ((code>=0x4921)&&(code<=0x497E)) + return(tab_jisx0212_uni33[code-0x4921]); + if ((code>=0x4A21)&&(code<=0x4A7E)) + return(tab_jisx0212_uni34[code-0x4A21]); + if ((code>=0x4B21)&&(code<=0x4B7E)) + return(tab_jisx0212_uni35[code-0x4B21]); + if ((code>=0x4C21)&&(code<=0x4C7E)) + return(tab_jisx0212_uni36[code-0x4C21]); + if ((code>=0x4D21)&&(code<=0x4D7E)) + return(tab_jisx0212_uni37[code-0x4D21]); + if ((code>=0x4E21)&&(code<=0x4E7E)) + return(tab_jisx0212_uni38[code-0x4E21]); + if ((code>=0x4F21)&&(code<=0x4F7E)) + return(tab_jisx0212_uni39[code-0x4F21]); + if ((code>=0x5021)&&(code<=0x507E)) + return(tab_jisx0212_uni40[code-0x5021]); + if ((code>=0x5121)&&(code<=0x517E)) + return(tab_jisx0212_uni41[code-0x5121]); + if ((code>=0x5221)&&(code<=0x527E)) + return(tab_jisx0212_uni42[code-0x5221]); + if ((code>=0x5321)&&(code<=0x537E)) + return(tab_jisx0212_uni43[code-0x5321]); + if ((code>=0x5421)&&(code<=0x547E)) + return(tab_jisx0212_uni44[code-0x5421]); + if ((code>=0x5521)&&(code<=0x557E)) + return(tab_jisx0212_uni45[code-0x5521]); + if ((code>=0x5621)&&(code<=0x567E)) + return(tab_jisx0212_uni46[code-0x5621]); + if ((code>=0x5721)&&(code<=0x577E)) + return(tab_jisx0212_uni47[code-0x5721]); + if ((code>=0x5821)&&(code<=0x587E)) + return(tab_jisx0212_uni48[code-0x5821]); + if ((code>=0x5921)&&(code<=0x597E)) + return(tab_jisx0212_uni49[code-0x5921]); + if ((code>=0x5A21)&&(code<=0x5A7E)) + return(tab_jisx0212_uni50[code-0x5A21]); + if ((code>=0x5B21)&&(code<=0x5B7E)) + return(tab_jisx0212_uni51[code-0x5B21]); + if ((code>=0x5C21)&&(code<=0x5C7E)) + return(tab_jisx0212_uni52[code-0x5C21]); + if ((code>=0x5D21)&&(code<=0x5D7E)) + return(tab_jisx0212_uni53[code-0x5D21]); + if ((code>=0x5E21)&&(code<=0x5E7E)) + return(tab_jisx0212_uni54[code-0x5E21]); + if ((code>=0x5F21)&&(code<=0x5F7E)) + return(tab_jisx0212_uni55[code-0x5F21]); + if ((code>=0x6021)&&(code<=0x607E)) + return(tab_jisx0212_uni56[code-0x6021]); + if ((code>=0x6121)&&(code<=0x617E)) + return(tab_jisx0212_uni57[code-0x6121]); + if ((code>=0x6221)&&(code<=0x627E)) + return(tab_jisx0212_uni58[code-0x6221]); + if ((code>=0x6321)&&(code<=0x637E)) + return(tab_jisx0212_uni59[code-0x6321]); + if ((code>=0x6421)&&(code<=0x647E)) + return(tab_jisx0212_uni60[code-0x6421]); + if ((code>=0x6521)&&(code<=0x657E)) + return(tab_jisx0212_uni61[code-0x6521]); + if ((code>=0x6621)&&(code<=0x667E)) + return(tab_jisx0212_uni62[code-0x6621]); + if ((code>=0x6721)&&(code<=0x677E)) + return(tab_jisx0212_uni63[code-0x6721]); + if ((code>=0x6821)&&(code<=0x687E)) + return(tab_jisx0212_uni64[code-0x6821]); + if ((code>=0x6921)&&(code<=0x697E)) + return(tab_jisx0212_uni65[code-0x6921]); + if ((code>=0x6A21)&&(code<=0x6A7E)) + return(tab_jisx0212_uni66[code-0x6A21]); + if ((code>=0x6B21)&&(code<=0x6B7E)) + return(tab_jisx0212_uni67[code-0x6B21]); + if ((code>=0x6C21)&&(code<=0x6C7E)) + return(tab_jisx0212_uni68[code-0x6C21]); + if ((code>=0x6D21)&&(code<=0x6D63)) + return(tab_jisx0212_uni69[code-0x6D21]); + if ((code>=0x7371)&&(code<=0x737E)) + return(tab_jisx0212_uni70[code-0x7371]); + if ((code>=0x7421)&&(code<=0x747E)) + return(tab_jisx0212_uni71[code-0x7421]); + return(0); +} + +/* + EUC-JP encoding subcomponents: + [x00-x7F] # ASCII/JIS-Roman (one-byte/character) + [x8E][xA0-xDF] # half-width katakana (two bytes/char) + [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char) + [xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char) +*/ + +static +size_t my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), + const char *beg, const char *end, size_t pos, + int *error) +{ + const uchar *b= (uchar *) beg; + *error=0; + + for ( ; pos && b < (uchar*) end; pos--, b++) + { + char *chbeg; + uint ch= *b; + + if (ch <= 0x7F) /* one byte */ + continue; + + chbeg= (char *) b++; + if (b >= (uchar *) end) /* need more bytes */ + return (uint) (chbeg - beg); /* unexpected EOL */ + + if (ch == 0x8E) /* [x8E][xA0-xDF] */ + { + if (*b >= 0xA0 && *b <= 0xDF) + continue; + *error=1; + return (uint) (chbeg - beg); /* invalid sequence */ + } + + if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */ + { + ch= *b++; + if (b >= (uchar*) end) + { + *error= 1; + return (uint)(chbeg - beg); /* unexpected EOL */ + } + } + + if (ch >= 0xA1 && ch <= 0xFE && + *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ + continue; + *error=1; + return (size_t) (chbeg - beg); /* invalid sequence */ + } + return (size_t) (b - (uchar *) beg); +} + + +static +size_t my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *str_end) +{ + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; + + for (clen= 0; b < e; ) + { + if (*b == 0x8E) + { + clen++; + b+= 2; + } + else if (*b == 0x8F) + { + clen+= 2; + b+= 3; + } + else if (*b & 0x80) + { + clen+= 2; + b+= 2; + } + else + { + clen++; + b++; + } + } + return clen; +} + +static int +my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) +{ + int c1,c2,c3; + + if (s >= e) + return MY_CS_TOOSMALL; + + c1=s[0]; + + /* Ascii code set */ + if (c1<=0x7F) + { + *pwc=c1; + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + c2=s[1]; + + + /* JIS X 0208 code set */ + if (c1>=0xA1 && c1<=0xFE) + { + if (c2 < 0xA1 || c2 >0xFE) + return MY_CS_ILSEQ; + + if (c1 < 0xF5) + { + pwc[0]=my_jisx0208_uni_onechar( ((c1-0x80) << 8) + (c2-0x80)); + if (!pwc[0]) + return -2; + } + else + { + /* User defined range */ + pwc[0]=0xE000 + 94*(c1-0xF5) +(c2-0xA1); + } + return 2; + } + + /* JIS X 0201 code set (Half Width Tatakana) */ + if (c1==0x8E) + { + int ret; + + if (c2<0xA1 || c2>0xDF) + return MY_CS_ILSEQ; + + ret = my_mb_wc_jisx0201(cs,pwc,s+1,e); + if (ret!=1) + return -2; + return 2; + } + + /* JIS X 0212 code set */ + if (c1==0x8F) + { + if (c2<0xA1 || c2>=0xFF) + return MY_CS_ILSEQ; + + if (s+3>e) + return MY_CS_TOOSMALL3; + + c3=s[2]; + if (c3 < 0xA1 || c3>=0xFF) + return MY_CS_ILSEQ; + + if (c2<0xF5) + { + pwc[0]=my_jisx0212_uni_onechar((c2-0x80)*256 + (c3-0x80)); + if (!pwc[0]) + return -3; + } + else + { + /* User defined range */ + pwc[0]= 0xE3AC + 94*(c2-0xF5) + (c3-0xA1); + } + return 3; + } + + return MY_CS_ILSEQ; +} + +static int +my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, uchar *s, uchar *e) +{ + uchar c1; + int jp; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((int) wc < 0x80) + { + *s= (uchar) wc; + return 1; + } + + if ((jp=my_uni_jisx0208_onechar(wc))) + { + if (s+2>e) + return MY_CS_TOOSMALL2; + + jp+=0x8080; + s[0]=jp>>8; + s[1]=jp&0xFF; + return 2; + } + + /* Half width Katakana */ + if (my_wc_mb_jisx0201(c,wc,s,e) == 1) + { + if (s+2>e) + return MY_CS_TOOSMALL2; + s[1]= s[0]; + s[0]= 0x8E; + return 2; + } + + + if ((jp=my_uni_jisx0212_onechar(wc))) + { + if (s+3>e) + return MY_CS_TOOSMALL3; + + jp+=0x8080; + s[0]=0x8F; + s[1]=jp>>8; + s[2]=jp&0xFF; + return 3; + } + + + /* User defined range */ + if (wc>=0xE000 && wc<0xE3AC) + { + if (s+2>e) + return MY_CS_TOOSMALL2; + + c1=((unsigned)(wc-0xE000)/94)+0xF5; + s[0]=c1; + c1=((unsigned)(wc-0xE000)%94)+0xa1; + s[1]=c1; + return 2; + } + + + /* User defined range */ + if (wc>=0xE3AC && wc<0xE758) + { + if (s+3>e) + return MY_CS_TOOSMALL3; + + s[0]=0x8F; + c1=((unsigned)(wc-0xE3AC)/94)+0xF5; + s[1]=c1; + c1=((unsigned)(wc-0xE3AC)%94)+0xa1; + s[2]=c1; + return 3; + } + + return MY_CS_ILUNI; +} + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple, + my_strnxfrm_mb, /* strnxfrm */ + my_strnxfrmlen_simple, + my_like_range_mb, /* like_range */ + my_wildcmp_mb, /* wildcmp */ + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + ismbchar_eucjpms, + mbcharlen_eucjpms, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_eucjpms, + my_lengthsp_8bit, + my_numcells_eucjp, + my_mb_wc_euc_jp, /* mb_wc */ + my_wc_mb_euc_jp, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + + +CHARSET_INFO my_charset_eucjpms_japanese_ci= +{ + 97,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "eucjpms", /* cs name */ + "eucjpms_japanese_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_eucjpms, + to_lower_eucjpms, + to_upper_eucjpms, + sort_order_eucjpms, + NULL, /* sort_order_big*/ + NULL, /* contractions */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + + +CHARSET_INFO my_charset_eucjpms_bin= +{ + 98,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "eucjpms", /* cs name */ + "eucjpms_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_eucjpms, + to_lower_eucjpms, + to_upper_eucjpms, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_mb_bin_handler +}; + + +#endif diff --git a/externals/mysql/strings/ctype-extra.c b/externals/mysql/strings/ctype-extra.c new file mode 100644 index 0000000..ae7af0d --- /dev/null +++ b/externals/mysql/strings/ctype-extra.c @@ -0,0 +1,8773 @@ +/* + This file was generated by the conf_to_src utility. Do not edit it directly, + edit the XML definitions in sql/share/charsets/ instead. + + To re-generate, run the following in the strings/ directory: + ./conf_to_src ../sql/share/charsets/ > FILE +*/ + +/* Copyright (C) 2000-2007 MySQL AB + + 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; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include +#include + +#ifdef HAVE_CHARSET_dec8 +uchar ctype_dec8_swedish_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_dec8_swedish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_dec8_swedish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_dec8_swedish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0x41,0x41,0x41,0x41,0x5C,0x5B,0x5C,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49, +0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x5D,0xD7,0xD8,0x55,0x55,0x55,0x59,0x59,0xDE,0xDF, +0x41,0x41,0x41,0x41,0x5C,0x5B,0x5C,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49, +0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x5D,0xF7,0xD8,0x55,0x55,0x55,0x59,0x59,0xDE,0xFF +}; + +uint16 to_uni_dec8_swedish_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x00A1,0x00A2,0x00A3,0x0000,0x00A5,0x0000,0x00A7, +0x00A4,0x00A9,0x00AA,0x00AB,0x0000,0x0000,0x0000,0x0000, +0x00B0,0x00B1,0x00B2,0x00B3,0x0000,0x00B5,0x00B6,0x00B7, +0x0000,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x0000,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x0000,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x0152, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0178,0x0000,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x0000,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x0153, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FF,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_cp850 +uchar ctype_cp850_general_ci[] = { +0x00, +0x20,0x30,0x30,0x30,0x30,0x30,0x30,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x30,0x30, +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x20,0x30,0x30,0x30,0x30,0x30, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x30, +0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01, +0x01,0x02,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x02,0x10,0x01,0x10,0x10, +0x02,0x02,0x02,0x02,0x02,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x02,0x01,0x01,0x01,0x01,0x02,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10,0x01,0x10, +0x01,0x02,0x01,0x01,0x02,0x01,0x10,0x02,0x01,0x01,0x01,0x01,0x02,0x01,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20 +}; + +uchar to_lower_cp850_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x84,0x86, +0x82,0x91,0x91,0x93,0x94,0x95,0x96,0x97,0x98,0x94,0x81,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA4,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp850_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, +0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_cp850_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x51,0x53,0x55,0x59,0x63,0x65,0x67,0x69,0x74,0x76,0x78,0x7A,0x7C,0x80, +0x8E,0x90,0x92,0x94,0x97,0x99,0xA3,0xA5,0xA7,0xA9,0xAE,0xB1,0xB2,0xB3,0xB4,0xB5, +0xB6,0x41,0x51,0x53,0x55,0x59,0x63,0x65,0x67,0x69,0x74,0x76,0x78,0x7A,0x7C,0x80, +0x8E,0x90,0x92,0x94,0x97,0x99,0xA3,0xA5,0xA7,0xA9,0xAE,0xB7,0xB8,0xB9,0xBA,0xBB, +0x54,0xA1,0x5D,0x47,0x4B,0x43,0x4D,0x54,0x5F,0x61,0x5B,0x71,0x6F,0x6B,0x4B,0x4D, +0x5D,0x4F,0x4F,0x86,0x8A,0x82,0x9F,0x9B,0xAD,0x8A,0xA1,0x8C,0xE3,0x8C,0xBD,0xBE, +0x45,0x6D,0x84,0x9D,0x7E,0x7E,0xEA,0xFA,0xFF,0xEE,0xEC,0xFD,0xFC,0xCE,0xEB,0xFB, +0xDC,0xDD,0xDE,0xC3,0xC9,0x45,0x47,0x43,0xE9,0xD5,0xCF,0xD1,0xD3,0xE2,0xE5,0xC5, +0xC6,0xCB,0xCA,0xC8,0xC2,0xCC,0x49,0x49,0xD2,0xD0,0xD7,0xD6,0xD4,0xCD,0xD8,0xE4, +0x57,0x57,0x5F,0x61,0x5B,0x73,0x6D,0x6F,0x71,0xC7,0xC4,0xDB,0xDA,0xE6,0x6B,0xD9, +0x84,0x96,0x86,0x82,0x88,0x88,0xF5,0xB0,0xB0,0x9D,0x9F,0x9B,0xAB,0xAB,0xEF,0xF4, +0xED,0xF1,0xC1,0xFE,0xF6,0xE7,0xBF,0xBC,0xF0,0xE8,0xF7,0xF9,0xF3,0xF2,0xDF,0xE0 +}; + +uint16 to_uni_cp850_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C7,0x00FC,0x00E9,0x00E2,0x00E4,0x00E0,0x00E5,0x00E7, +0x00EA,0x00EB,0x00E8,0x00EF,0x00EE,0x00EC,0x00C4,0x00C5, +0x00C9,0x00E6,0x00C6,0x00F4,0x00F6,0x00F2,0x00FB,0x00F9, +0x00FF,0x00D6,0x00DC,0x00F8,0x00A3,0x00D8,0x00D7,0x0192, +0x00E1,0x00ED,0x00F3,0x00FA,0x00F1,0x00D1,0x00AA,0x00BA, +0x00BF,0x00AE,0x00AC,0x00BD,0x00BC,0x00A1,0x00AB,0x00BB, +0x2591,0x2592,0x2593,0x2502,0x2524,0x00C1,0x00C2,0x00C0, +0x00A9,0x2563,0x2551,0x2557,0x255D,0x00A2,0x00A5,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x00E3,0x00C3, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x00A4, +0x00F0,0x00D0,0x00CA,0x00CB,0x00C8,0x0131,0x00CD,0x00CE, +0x00CF,0x2518,0x250C,0x2588,0x2584,0x00A6,0x00CC,0x2580, +0x00D3,0x00DF,0x00D4,0x00D2,0x00F5,0x00D5,0x00B5,0x00FE, +0x00DE,0x00DA,0x00DB,0x00D9,0x00FD,0x00DD,0x00AF,0x00B4, +0x00AD,0x00B1,0x2017,0x00BE,0x00B6,0x00A7,0x00F7,0x00B8, +0x00B0,0x00A8,0x00B7,0x00B9,0x00B3,0x00B2,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_latin1 +uchar ctype_latin1_german1_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x00,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x01,0x00,0x01,0x00, +0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x02,0x00,0x02,0x01, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_latin1_german1_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin1_german1_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin1_german1_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49, +0xD0,0x4E,0x4F,0x4F,0x4F,0x4F,0x4F,0xD7,0x4F,0x55,0x55,0x55,0x55,0x59,0xDE,0x53, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49, +0xD0,0x4E,0x4F,0x4F,0x4F,0x4F,0x4F,0xF7,0x4F,0x55,0x55,0x55,0x55,0x59,0xDE,0xFF +}; + +uint16 to_uni_latin1_german1_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F, +0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; + +#endif + +#ifdef HAVE_CHARSET_hp8 +uchar ctype_hp8_english_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x02,0x02, +0x01,0x10,0x10,0x01,0x02,0x10,0x10,0x02,0x01,0x10,0x01,0x01,0x01,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20 +}; + +uchar to_lower_hp8_english_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xC8,0xC0,0xC9,0xC1,0xCD,0xD1,0xDD,0xA8,0xA9,0xAA,0xAB,0xAC,0xCB,0xC3,0xAF, +0xB0,0xB2,0xB2,0xB3,0xB5,0xB5,0xB7,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD4,0xD1,0xD6,0xD7,0xD4,0xD5,0xD6,0xD7,0xCC,0xD9,0xCE,0xCF,0xC5,0xDD,0xDE,0xC2, +0xC4,0xE2,0xE2,0xE4,0xE4,0xD5,0xD9,0xC6,0xCA,0xEA,0xEA,0xEC,0xEC,0xC7,0xEF,0xEF, +0xF1,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_hp8_english_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB1,0xB3,0xB4,0xB4,0xB6,0xB6,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xA2,0xA4,0xDF,0xAE,0xE0,0xDC,0xE7,0xED,0xA1,0xA3,0xE8,0xAD,0xD8,0xA5,0xDA,0xDB, +0xD0,0xA6,0xD2,0xD3,0xD0,0xE5,0xD2,0xD3,0xD8,0xE6,0xDA,0xDB,0xDC,0xA7,0xDE,0xDF, +0xE0,0xE1,0xE1,0xE3,0xE3,0xE5,0xE6,0xE7,0xE8,0xE9,0xE9,0xEB,0xEB,0xED,0xEE,0xEE, +0xF0,0xF0,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_hp8_english_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5C,0x5D,0x5B,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_hp8_english_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x00C0,0x00C2,0x00C8,0x00CA,0x00CB,0x00CE,0x00CF, +0x00B4,0x02CB,0x02C6,0x00A8,0x02DC,0x00D9,0x00DB,0x20A4, +0x00AF,0x00DD,0x00FD,0x00B0,0x00C7,0x00E7,0x00D1,0x00F1, +0x00A1,0x00BF,0x00A4,0x00A3,0x00A5,0x00A7,0x0192,0x00A2, +0x00E2,0x00EA,0x00F4,0x00FB,0x00E1,0x00E9,0x00F3,0x00FA, +0x00E0,0x00E8,0x00F2,0x00F9,0x00E4,0x00EB,0x00F6,0x00FC, +0x00C5,0x00EE,0x00D8,0x00C6,0x00E5,0x00ED,0x00F8,0x00E6, +0x00C4,0x00EC,0x00D6,0x00DC,0x00C9,0x00EF,0x00DF,0x00D4, +0x00C1,0x00C3,0x00E3,0x00D0,0x00F0,0x00CD,0x00CC,0x00D3, +0x00D2,0x00D5,0x00F5,0x0160,0x0161,0x00DA,0x0178,0x00FF, +0x00DE,0x00FE,0x00B7,0x00B5,0x00B6,0x00BE,0x2014,0x00BC, +0x00BD,0x00AA,0x00BA,0x00AB,0x25A0,0x00BB,0x00B1,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_koi8r +uchar ctype_koi8r_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 +}; + +uchar to_lower_koi8r_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar to_upper_koi8r_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xB3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_koi8r_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xE5,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE, +0xAF,0xB0,0xB1,0xE5,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD, +0xFE,0xDF,0xE0,0xF6,0xE3,0xE4,0xF4,0xE2,0xF5,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE, +0xEF,0xFF,0xF0,0xF1,0xF2,0xF3,0xE6,0xE1,0xFC,0xFB,0xE7,0xF8,0xFD,0xF9,0xF7,0xFA, +0xFE,0xDF,0xE0,0xF6,0xE3,0xE4,0xF4,0xE2,0xF5,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE, +0xEF,0xFF,0xF0,0xF1,0xF2,0xF3,0xE6,0xE1,0xFC,0xFB,0xE7,0xF8,0xFD,0xF9,0xF7,0xFA +}; + +uint16 to_uni_koi8r_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x2500,0x2502,0x250C,0x2510,0x2514,0x2518,0x251C,0x2524, +0x252C,0x2534,0x253C,0x2580,0x2584,0x2588,0x258C,0x2590, +0x2591,0x2592,0x2593,0x2320,0x25A0,0x2219,0x221A,0x2248, +0x2264,0x2265,0x00A0,0x2321,0x00B0,0x00B2,0x00B7,0x00F7, +0x2550,0x2551,0x2552,0x0451,0x2553,0x2554,0x2555,0x2556, +0x2557,0x2558,0x2559,0x255A,0x255B,0x255C,0x255D,0x255E, +0x255F,0x2560,0x2561,0x0401,0x2562,0x2563,0x2564,0x2565, +0x2566,0x2567,0x2568,0x2569,0x256A,0x256B,0x256C,0x00A9, +0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433, +0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432, +0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A, +0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413, +0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412, +0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A +}; + +#endif + +#ifdef HAVE_CHARSET_latin2 +uchar ctype_latin2_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x01,0x10,0x01,0x10,0x01,0x01,0x10,0x10,0x01,0x01,0x01,0x01,0x10,0x01,0x01, +0x10,0x02,0x10,0x02,0x10,0x02,0x02,0x10,0x10,0x02,0x02,0x02,0x02,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin2_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xB1,0xA2,0xB3,0xA4,0xB5,0xB6,0xA7,0xA8,0xB9,0xBA,0xBB,0xBC,0xAD,0xBE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin2_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xA1,0xB2,0xA3,0xB4,0xA5,0xA6,0xB7,0xB8,0xA9,0xAA,0xAB,0xAC,0xBD,0xAE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin2_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x44,0x45,0x48,0x49,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x53,0x54,0x56, +0x58,0x59,0x5A,0x5B,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x68,0x69,0x6A,0x6B,0x6C, +0x6D,0x41,0x44,0x45,0x48,0x49,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x53,0x54,0x56, +0x58,0x59,0x5A,0x5B,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x6E,0x6F,0x70,0x71,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0x42,0xFF,0x52,0xFF,0x51,0x5C,0xFF,0xFF,0x5D,0x5B,0x5E,0x65,0xFF,0x67,0x66, +0xFF,0x42,0xFF,0x52,0xFF,0x51,0x5C,0xFF,0xFF,0x5D,0x5B,0x5E,0x65,0xFF,0x67,0x66, +0x5A,0x43,0x43,0x43,0x43,0x51,0x46,0x45,0x47,0x49,0x4A,0x49,0x49,0x4E,0x4E,0x48, +0xFF,0x55,0x54,0x57,0x56,0x56,0x56,0xFF,0x5A,0x5F,0x5F,0x5F,0x5F,0x63,0x5E,0xFF, +0x5A,0x43,0x43,0x43,0x43,0x51,0x46,0x45,0x47,0x49,0x4A,0x49,0x49,0x4E,0x4E,0x48, +0xFF,0x55,0x54,0x57,0x56,0x56,0x56,0xFF,0x5A,0x5F,0x5F,0x5F,0x5F,0x63,0x5E,0xFF +}; + +uint16 to_uni_latin2_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, +0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, +0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, +0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_swe7 +uchar ctype_swe7_swedish_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10, +0x01,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_swe7_swedish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_swe7_swedish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_swe7_swedish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x45,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5C,0x5D,0x5B,0x59,0x5F, +0x45,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5C,0x5D,0x5B,0x59,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_swe7_swedish_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x00C9,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x00C4,0x00D6,0x00C5,0x00DC,0x005F, +0x00E9,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x00E4,0x00F6,0x00E5,0x00FC,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_ascii +uchar ctype_ascii_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_ascii_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_ascii_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_ascii_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_ascii_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1251 +uchar ctype_cp1251_bulgarian_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x01, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02, +0x00,0x01,0x02,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x01,0x02,0x02,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x01,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_cp1251_bulgarian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x90,0x83,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA2,0xA2,0xBC,0xA4,0xB4,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB3,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1251_bulgarian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x81,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x8E,0x8F, +0xA0,0xA1,0xA1,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar sort_order_cp1251_bulgarian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7C,0x7D,0x7E,0x7F,0x80, +0x81,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x82,0x83,0x84,0x85,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x61,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x61,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B, +0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B, +0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B, +0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B +}; + +uint16 to_uni_cp1251_bulgarian_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, +0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, +0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407, +0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7, +0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, +0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, +0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, +0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, +0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, +0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F +}; + +#endif + +#ifdef HAVE_CHARSET_latin1 +uchar ctype_latin1_danish_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x00,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x01,0x00,0x01,0x00, +0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x02,0x00,0x02,0x01, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_latin1_danish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin1_danish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin1_danish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0x41,0x41,0x41,0x41,0x5B,0x5D,0x5B,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49, +0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x5C,0xD7,0x5C,0x55,0x55,0x55,0x59,0x59,0xDE,0xDF, +0x41,0x41,0x41,0x41,0x5B,0x5D,0x5B,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49, +0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x5C,0xF7,0x5C,0x55,0x55,0x55,0x59,0x59,0xDE,0xFF +}; + +uint16 to_uni_latin1_danish_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F, +0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; + +#endif + +#ifdef HAVE_CHARSET_hebrew +uchar ctype_hebrew_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x00 +}; + +uchar to_lower_hebrew_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_hebrew_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_hebrew_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_hebrew_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x203E, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2017, +0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, +0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, +0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, +0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x200E,0x200F,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_latin7 +uchar ctype_latin7_estonian_cs[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x01,0x20,0x10,0x20,0x10,0x10,0x00,0x00,0x20,0x10,0x20,0x10,0x20,0x10,0x10,0x10, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x00,0x20,0x10,0x20,0x10,0x10,0x20, +0x48,0x20,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin7_estonian_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin7_estonian_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin7_estonian_cs[] = { +0x00,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x2E,0x2F,0x30,0x31,0x32,0x0A,0x0B, +0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B, +0x2C,0x33,0x34,0x35,0x36,0x37,0x38,0x27,0x39,0x3A,0x3B,0x5D,0x3C,0x28,0x3D,0x3E, +0x76,0x7A,0x7C,0x7E,0x80,0x81,0x82,0x83,0x84,0x85,0x3F,0x40,0x5E,0x5F,0x60,0x41, +0x42,0x86,0x90,0x92,0x98,0x9A,0xA4,0xA6,0xAA,0xAC,0xB2,0xB4,0xB8,0xBE,0xC0,0xC6, +0xCE,0xD0,0xD2,0xD6,0xE5,0xE8,0xEE,0xF0,0xFA,0xFC,0xDD,0x43,0x44,0x45,0x46,0x47, +0x48,0x87,0x91,0x93,0x99,0x9B,0xA5,0xA7,0xAB,0xAD,0xB3,0xB5,0xB9,0xBF,0xC1,0xC7, +0xCF,0xD1,0xD3,0xD7,0xE6,0xE9,0xEF,0xF1,0xFB,0xFD,0xDE,0x49,0x4A,0x4B,0x4C,0x1C, +0x01,0x1D,0x57,0x1E,0x5A,0x74,0x71,0x72,0x1F,0x75,0x20,0x5B,0x21,0x4E,0x52,0x51, +0x22,0x55,0x56,0x58,0x59,0x73,0x2A,0x2B,0x23,0xE7,0x24,0x5C,0x25,0x4F,0x54,0x26, +0x2D,0xFE,0x66,0x67,0x68,0xFF,0x4D,0x69,0xCC,0x6A,0xD4,0x62,0x6B,0x29,0x6C,0x8E, +0x6D,0x61,0x7D,0x7F,0x50,0x6E,0x6F,0x70,0xCD,0x7B,0xD5,0x63,0x77,0x78,0x79,0x8F, +0x8C,0xB0,0x88,0x94,0xF4,0x8A,0xA2,0xA0,0x96,0x9C,0xDF,0x9E,0xA8,0xB6,0xAE,0xBA, +0xDB,0xC2,0xC4,0xC8,0xCA,0xF2,0xF6,0x64,0xEC,0xBC,0xD8,0xEA,0xF8,0xE1,0xE3,0xDA, +0x8D,0xB1,0x89,0x95,0xF5,0x8B,0xA3,0xA1,0x97,0x9D,0xE0,0x9F,0xA9,0xB7,0xAF,0xBB, +0xDC,0xC3,0xC5,0xC9,0xCB,0xF3,0xF7,0x65,0xED,0xBD,0xD9,0xEB,0xF9,0xE2,0xE4,0x53 +}; + +uint16 to_uni_latin7_estonian_cs[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7, +0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, +0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7, +0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, +0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, +0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, +0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, +0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, +0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, +0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, +0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, +0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019 +}; + +#endif + +#ifdef HAVE_CHARSET_latin2 +uchar ctype_latin2_hungarian_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x01,0x10,0x01,0x10,0x01,0x01,0x10,0x10,0x01,0x01,0x01,0x01,0x10,0x01,0x01, +0x10,0x02,0x10,0x02,0x10,0x02,0x02,0x10,0x10,0x02,0x02,0x02,0x02,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin2_hungarian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xB1,0xA2,0xB3,0xA4,0xB5,0xB6,0xA7,0xA8,0xB9,0xBA,0xBB,0xBC,0xAD,0xBE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin2_hungarian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xA1,0xB2,0xA3,0xB4,0xA5,0xA6,0xB7,0xB8,0xA9,0xAA,0xAB,0xAC,0xBD,0xAE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin2_hungarian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x47,0x48,0x4C,0x4E,0x53,0x54,0x55,0x56,0x5A,0x5B,0x5C,0x60,0x61,0x64, +0x69,0x6A,0x6B,0x6E,0x72,0x75,0x7A,0x7B,0x7C,0x7D,0x7F,0x83,0x84,0x85,0x86,0x87, +0x88,0x41,0x47,0x48,0x4C,0x4E,0x53,0x54,0x55,0x56,0x5A,0x5B,0x5C,0x60,0x61,0x64, +0x69,0x6A,0x6B,0x6E,0x72,0x75,0x7A,0x7B,0x7C,0x7D,0x7F,0x89,0x8A,0x8B,0x8C,0x00, +0x01,0x78,0x4E,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x67,0x67,0x56,0x56,0x0F,0x41, +0x4E,0x12,0x13,0x67,0x67,0x64,0x78,0x75,0x78,0x67,0x78,0x1C,0x1D,0x1E,0x1F,0xFF, +0x41,0x56,0x64,0x75,0x5E,0x6F,0xFF,0x67,0xFF,0x70,0x71,0x73,0x80,0xFF,0x81,0x82, +0xFF,0x42,0xFF,0x5D,0xFF,0x41,0x6F,0xFF,0xFF,0x70,0x71,0x73,0x80,0xFF,0x81,0x82, +0x6C,0x41,0x44,0x45,0x46,0x5F,0x49,0x4B,0x4A,0x4E,0x51,0x52,0x50,0x56,0x57,0x4D, +0xFF,0x62,0x63,0x64,0x66,0x67,0x67,0xFF,0x6D,0x77,0x75,0x78,0x78,0x7E,0x74,0xFF, +0x64,0x41,0x44,0x45,0x46,0x5F,0x49,0x4B,0x4A,0x4E,0x51,0x78,0x50,0x56,0x58,0x4D, +0xFF,0x62,0x63,0x64,0x66,0x67,0x67,0xFF,0x6D,0x77,0x75,0x78,0x78,0x7E,0x74,0xFF +}; + +uint16 to_uni_latin2_hungarian_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, +0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, +0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, +0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_koi8u +uchar ctype_koi8u_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x02,0x02,0x10,0x02,0x02,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10, +0x10,0x10,0x10,0x01,0x01,0x10,0x01,0x01,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 +}; + +uchar to_lower_koi8u_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x20,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0xA3,0xA4,0x20,0xA6,0xA7,0x20,0x20,0x20,0x20,0x20,0xAD,0x20,0x20, +0x20,0x20,0x20,0xA3,0xA4,0x20,0xA6,0xA7,0x20,0x20,0x20,0x20,0x20,0xAD,0x20,0x20, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar to_upper_koi8u_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x20,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0xB3,0xB4,0x20,0xB6,0xB7,0x20,0x20,0x20,0x20,0x20,0xBD,0x20,0x20, +0x20,0x20,0x20,0xB3,0xB4,0x20,0xB6,0xB7,0x20,0x20,0x20,0x20,0x20,0xBD,0x20,0x20, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_koi8u_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x20,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4, +0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4, +0xC5,0xC6,0xC7,0x88,0x87,0xC8,0x8C,0x8D,0xC9,0xCA,0xCB,0xCC,0xCD,0x84,0xCE,0xCF, +0xD0,0xD1,0xD2,0x88,0x87,0xD3,0x8C,0x8D,0xD4,0xD5,0xD6,0xD7,0xD8,0x84,0xD9,0xDA, +0xA3,0x80,0x81,0x9B,0x85,0x86,0x99,0x83,0x9A,0x8B,0x8E,0x8F,0x90,0x91,0x92,0x93, +0x94,0xA4,0x95,0x96,0x97,0x98,0x89,0x82,0xA1,0xA0,0x8A,0x9D,0xA2,0x9E,0x9C,0x9F, +0xA3,0x80,0x81,0x9B,0x85,0x86,0x99,0x83,0x9A,0x8B,0x8E,0x8F,0x90,0x91,0x92,0x93, +0x94,0xA4,0x95,0x96,0x97,0x98,0x89,0x82,0xA1,0xA0,0x8A,0x9D,0xA2,0x9E,0x9C,0x9F +}; + +uint16 to_uni_koi8u_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x2500,0x2502,0x250C,0x2510,0x2514,0x2518,0x251C,0x2524, +0x252C,0x2534,0x253C,0x2580,0x2584,0x2588,0x258C,0x2590, +0x2591,0x2592,0x2593,0x2320,0x25A0,0x2022,0x221A,0x2248, +0x2264,0x2265,0x00A0,0x2321,0x00B0,0x00B2,0x00B7,0x00F7, +0x2550,0x2551,0x2552,0x0451,0x0454,0x2554,0x0456,0x0457, +0x2557,0x2558,0x2559,0x255A,0x255B,0x0491,0x255D,0x255E, +0x255F,0x2560,0x2561,0x0401,0x0404,0x2563,0x0406,0x0407, +0x2566,0x2567,0x2568,0x2569,0x256A,0x0490,0x256C,0x00A9, +0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433, +0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432, +0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A, +0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413, +0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412, +0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A +}; + +#endif + +#ifdef HAVE_CHARSET_cp1251 +uchar ctype_cp1251_ukrainian_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x01, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02, +0x00,0x01,0x02,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x01,0x02,0x02,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x01,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_cp1251_ukrainian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x90,0x83,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA2,0xA2,0xBC,0xA4,0xB4,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB3,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1251_ukrainian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x81,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x8E,0x8F, +0xA0,0xA1,0xA1,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar sort_order_cp1251_ukrainian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x20,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4, +0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4, +0xC5,0xC6,0xC7,0xC8,0xC9,0x84,0xCA,0xCB,0x88,0xCC,0x87,0xCD,0xCE,0xCF,0xD0,0x8D, +0xD1,0xD2,0x8C,0x8C,0x84,0xD3,0xD4,0xD5,0x88,0xD6,0x87,0xD7,0xD8,0xD9,0xDA,0x8D, +0x80,0x81,0x82,0x83,0x85,0x86,0x89,0x8A,0x8B,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94, +0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4, +0x80,0x81,0x82,0x83,0x85,0x86,0x89,0x8A,0x8B,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94, +0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4 +}; + +uint16 to_uni_cp1251_ukrainian_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, +0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, +0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407, +0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7, +0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, +0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, +0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, +0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, +0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, +0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F +}; + +#endif + +#ifdef HAVE_CHARSET_greek +uchar ctype_greek_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x00,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x01,0x01,0x01,0x10,0x01,0x10,0x01,0x01, +0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00 +}; + +uchar to_lower_greek_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xDC,0xB7,0xDD,0xDE,0xDF,0xBB,0xFC,0xBD,0xFD,0xFE, +0xC0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xD2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_greek_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xDA,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xC1,0xC5,0xC7,0xC9, +0xDB,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD3,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xCF,0xD5,0xD9,0xFF +}; + +uchar sort_order_greek_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xC1,0xB7,0xC5,0xC7,0xC9,0xBB,0xCF,0xBD,0xD5,0xD9, +0xC9,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xC9,0xD5,0xC1,0xC5,0xC7,0xC9, +0xD5,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD3,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xC9,0xD5,0xCF,0xD5,0xD9,0xFF +}; + +uint16 to_uni_greek_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x02BD,0x02BC,0x00A3,0x0000,0x0000,0x00A6,0x00A7, +0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x0000,0x2015, +0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x0385,0x0386,0x00B7, +0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F, +0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397, +0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F, +0x03A0,0x03A1,0x0000,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7, +0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF, +0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7, +0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF, +0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7, +0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1250 +uchar ctype_cp1250_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x20,0x20,0x10,0x20,0x10,0x10,0x10,0x10,0x20,0x10,0x01,0x10,0x01,0x01,0x01,0x01, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x02,0x10,0x02,0x02,0x02,0x02, +0x48,0x10,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x02,0x02,0x10,0x01,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_cp1250_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xB3,0xA4,0xB9,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBE,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1250_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_cp1250_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x46,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x55, +0x56,0x57,0x58,0x59,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x63,0x64,0x65,0x66,0x67, +0x68,0x41,0x42,0x43,0x46,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x55, +0x56,0x57,0x58,0x59,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x5A,0x8B,0x5A,0x5B,0x62,0x62, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x5A,0x9B,0x5A,0x5B,0x62,0x62, +0x20,0xA1,0xA2,0x50,0xA4,0x41,0xA6,0x59,0xA8,0xA9,0x59,0xAB,0xAC,0xAD,0xAE,0x62, +0xB0,0xB1,0xB2,0x50,0xB4,0xB5,0xB6,0xB7,0xB8,0x41,0x59,0xBB,0x50,0xBD,0x50,0x62, +0x58,0x41,0x41,0x41,0x41,0x50,0x45,0x43,0x44,0x49,0x49,0x49,0x49,0x4D,0x4D,0x46, +0x47,0x53,0x53,0x55,0x55,0x55,0x55,0xD7,0x58,0x5C,0x5C,0x5C,0x5C,0x60,0x5B,0x59, +0x58,0x41,0x41,0x41,0x41,0x50,0x45,0x43,0x44,0x49,0x49,0x49,0x49,0x4D,0x4D,0x46, +0x47,0x53,0x53,0x55,0x55,0x55,0x55,0xF7,0x58,0x5C,0x5C,0x5C,0x5C,0x60,0x5B,0xFF +}; + +uint16 to_uni_cp1250_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A, +0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7, +0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B, +0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_latin2 +uchar ctype_latin2_croatian_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x01,0x10,0x01,0x10,0x01,0x01,0x10,0x10,0x01,0x01,0x01,0x01,0x10,0x01,0x01, +0x10,0x02,0x10,0x02,0x10,0x02,0x02,0x10,0x10,0x02,0x02,0x02,0x02,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin2_croatian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xB1,0xA2,0xB3,0xA4,0xB5,0xB6,0xA7,0xA8,0xB9,0xBA,0xBB,0xBC,0xAD,0xBE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin2_croatian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xA1,0xB2,0xA3,0xB4,0xA5,0xA6,0xB7,0xB8,0xA9,0xAA,0xAB,0xAC,0xBD,0xAE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin2_croatian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0xC6,0xC7,0xC8,0xC9,0xCA, +0xCB,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0xCC,0xCD,0xCE,0xCF,0xD0, +0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0, +0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0, +0xF1,0x41,0xF2,0x54,0xF3,0x54,0x5F,0xF4,0xF5,0x61,0x5F,0x62,0x6B,0xF6,0x8E,0x6B, +0xF7,0x41,0xF8,0x54,0xF9,0x54,0x5F,0xFA,0xFB,0x61,0x5F,0x62,0x6B,0xFC,0x8E,0x6B, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x46,0x4B,0x4B,0x4B,0x4B,0x50,0x50,0x48, +0x4A,0x57,0x57,0x59,0x59,0x59,0x59,0xFD,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0x5F, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x46,0x4B,0x4B,0x4B,0x4B,0x50,0x50,0x48, +0x4A,0x57,0x57,0x59,0x59,0x59,0x59,0xFE,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0xFF +}; + +uint16 to_uni_latin2_croatian_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, +0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, +0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, +0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1257 +uchar ctype_cp1257_lithuanian_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00 +}; + +uchar to_lower_cp1257_lithuanian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1257_lithuanian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_cp1257_lithuanian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x44,0x46,0x47,0x4A,0x4B,0x4C,0x4D,0x50,0x51,0x52,0x53,0x54,0x55, +0x56,0x57,0x58,0x59,0x5B,0x5C,0x5F,0x60,0x61,0x4E,0xFF,0x62,0x63,0x64,0x65,0x66, +0x67,0x41,0x43,0x44,0x46,0x47,0x4A,0x4B,0x4C,0x4D,0x50,0x51,0x52,0x53,0x54,0x55, +0x56,0x57,0x58,0x59,0x5B,0x5C,0x5F,0x60,0x61,0x4E,0xFF,0x68,0x69,0x6A,0x6B,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0x42,0x4F,0xFF,0xFF,0xFF,0xFF,0x48,0xFF,0x45,0xFF,0xFF,0x49,0xFF,0xFF,0xFF,0xFF, +0x5A,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x5E,0xFF,0xFF,0x5D,0xFF,0xFF,0xFF,0xFF, +0xFF,0x4F,0xFF,0xFF,0xFF,0xFF,0x48,0xFF,0x45,0xFF,0xFF,0x49,0xFF,0xFF,0xFF,0xFF, +0x5A,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x5E,0xFF,0xFF,0x5D,0xFF,0xFF,0xFF,0xFF +}; + +uint16 to_uni_cp1257_lithuanian_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0000,0x2039,0x0000,0x00A8,0x02C7,0x00B8, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0000,0x203A,0x0000,0x00AF,0x02DB,0x0000, +0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x0000,0x00A6,0x00A7, +0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, +0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, +0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, +0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, +0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, +0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, +0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, +0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, +0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_latin5 +uchar ctype_latin5_turkish_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_latin5_turkish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0xFD,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0x69,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin5_turkish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0xDD,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0x49,0xDE,0xFF +}; + +uchar sort_order_latin5_turkish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x45,0x46,0x47,0x48,0x4A,0x4B,0x4D,0x4E,0x4F,0x50,0x51,0x52, +0x54,0x55,0x56,0x57,0x59,0x5A,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65, +0x66,0x41,0x42,0x43,0x45,0x46,0x47,0x48,0x4A,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52, +0x54,0x55,0x56,0x57,0x59,0x5A,0x5C,0x5D,0x5E,0x5F,0x60,0x87,0x88,0x89,0x8A,0x8B, +0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B, +0x9C,0x9D,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB, +0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB, +0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x44,0x46,0x46,0x46,0x46,0x4C,0x4C,0x4C,0x4C, +0x49,0x51,0x52,0x52,0x52,0x52,0x53,0xE0,0x52,0x5A,0x5A,0x5A,0x5B,0x4C,0x58,0x57, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x44,0x46,0x46,0x46,0x46,0x4C,0x4C,0x4C,0x4C, +0x49,0x51,0x52,0x52,0x52,0x52,0x53,0xFA,0x52,0x5A,0x5A,0x5A,0x5B,0x4B,0x58,0x5F +}; + +uint16 to_uni_latin5_turkish_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x011E,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0130,0x015E,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x011F,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x0131,0x015F,0x00FF +}; + +#endif + +#ifdef HAVE_CHARSET_armscii8 +uchar ctype_armscii8_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x10,0x10 +}; + +uchar to_lower_armscii8_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB3,0xB3,0xB5,0xB5,0xB7,0xB7,0xB9,0xB9,0xBB,0xBB,0xBD,0xBD,0xBF,0xBF, +0xC1,0xC1,0xC3,0xC3,0xC5,0xC5,0xC7,0xC7,0xC9,0xC9,0xCB,0xCB,0xCD,0xCD,0xCF,0xCF, +0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xD9,0xD9,0xDB,0xDB,0xDD,0xDD,0xDF,0xDF, +0xE1,0xE1,0xE3,0xE3,0xE5,0xE5,0xE7,0xE7,0xE9,0xE9,0xEB,0xEB,0xED,0xED,0xEF,0xEF, +0xF1,0xF1,0xF3,0xF3,0xF5,0xF5,0xF7,0xF7,0xF9,0xF9,0xFB,0xFB,0xFD,0xFD,0xFE,0xFF +}; + +uchar to_upper_armscii8_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB2,0xB4,0xB4,0xB6,0xB6,0xB8,0xB8,0xBA,0xBA,0xBC,0xBC,0xBE,0xBE, +0xC0,0xC0,0xC2,0xC2,0xC4,0xC4,0xC6,0xC6,0xC8,0xC8,0xCA,0xCA,0xCC,0xCC,0xCE,0xCE, +0xD0,0xD0,0xD2,0xD2,0xD4,0xD4,0xD6,0xD6,0xD8,0xD8,0xDA,0xDA,0xDC,0xDC,0xDE,0xDE, +0xE0,0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE, +0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFE,0xFF +}; + +uchar sort_order_armscii8_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_armscii8_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x2741,0x00A7,0x0589,0x0029,0x0028,0x00BB,0x00AB, +0x2014,0x002E,0x055D,0x002C,0x002D,0x055F,0x2026,0x055C, +0x055B,0x055E,0x0531,0x0561,0x0532,0x0562,0x0533,0x0563, +0x0534,0x0564,0x0535,0x0565,0x0536,0x0566,0x0537,0x0567, +0x0538,0x0568,0x0539,0x0569,0x053A,0x056A,0x053B,0x056B, +0x053C,0x056C,0x053D,0x056D,0x053E,0x056E,0x053F,0x056F, +0x0540,0x0570,0x0541,0x0571,0x0542,0x0572,0x0543,0x0573, +0x0544,0x0574,0x0545,0x0575,0x0546,0x0576,0x0547,0x0577, +0x0548,0x0578,0x0549,0x0579,0x054A,0x057A,0x054B,0x057B, +0x054C,0x057C,0x054D,0x057D,0x054E,0x057E,0x054F,0x057F, +0x0550,0x0580,0x0551,0x0581,0x0552,0x0582,0x0553,0x0583, +0x0554,0x0584,0x0555,0x0585,0x0556,0x0586,0x2019,0x0027 +}; + +#endif + +#ifdef HAVE_CHARSET_cp866 +uchar ctype_cp866_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48 +}; + +uchar to_lower_cp866_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0x86,0x87,0x88,0x89,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0x86,0x87,0x88,0x89,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF1,0xF1,0xF3,0xF3,0xF5,0xF5,0xF7,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp866_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_cp866_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59,0x5B,0x5D, +0x5F,0x61,0x63,0x65,0x67,0x69,0x6B,0x6D,0x6F,0x71,0x73,0xBD,0xBE,0xBF,0xC0,0xC1, +0xC2,0x41,0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59,0x5B,0x5D, +0x5F,0x61,0x63,0x65,0x67,0x69,0x6B,0x6D,0x6F,0x71,0x73,0xC3,0xC4,0xC5,0xC6,0xC7, +0x75,0x77,0x79,0x7B,0x7D,0x7F,0x85,0x87,0x89,0x8D,0x8F,0x91,0x93,0x95,0x97,0x99, +0x9B,0x9D,0x9F,0xA1,0xA5,0xA7,0xA9,0xAB,0xAD,0xAF,0xB1,0xB3,0xB5,0xB7,0xB9,0xBB, +0x75,0x77,0x79,0x7B,0x7D,0x7F,0x85,0x87,0x89,0x8D,0x8F,0x91,0x93,0x95,0x97,0x99, +0xC8,0xC9,0xCA,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0x9B,0x9D,0x9F,0xA1,0xA5,0xA7,0xA9,0xAB,0xAD,0xAF,0xB1,0xB3,0xB5,0xB7,0xB9,0xBB, +0x81,0x81,0x83,0x83,0x8B,0x8B,0xA3,0xA3,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2 +}; + +uint16 to_uni_cp866_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, +0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, +0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, +0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, +0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556, +0x2555,0x2563,0x2551,0x2557,0x255D,0x255C,0x255B,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x255E,0x255F, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x2567, +0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256B, +0x256A,0x2518,0x250C,0x2588,0x2584,0x258C,0x2590,0x2580, +0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, +0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F, +0x0401,0x0451,0x0404,0x0454,0x0407,0x0457,0x040E,0x045E, +0x00B0,0x2219,0x00B7,0x221A,0x207F,0x00B2,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_keybcs2 +uchar ctype_keybcs2_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x02,0x82,0x02,0x02,0x01,0x01,0x02,0x82,0x81,0x01,0x01,0x02,0x02,0x01,0x01, +0x81,0x02,0x01,0x02,0x02,0x01,0x02,0x01,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x02,0x01,0x02,0x01,0x02,0x00,0x02,0x01,0x01,0x01,0x02,0x00,0x02,0x02,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48 +}; + +uchar to_lower_keybcs2_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x81,0x82,0x83,0x84,0x83,0x86,0x87,0x88,0x88,0x8D,0xA1,0x8C,0x8D,0x84,0xA0, +0x82,0x91,0x91,0x93,0x94,0xA2,0x96,0xA3,0x98,0x94,0x81,0x9B,0x8C,0x98,0xA9,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA4,0x96,0x93,0x9B,0xA9,0xAA,0xAA,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xED,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_keybcs2_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x68,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x9A,0x90,0x85,0x8E,0x85,0x86,0x80,0x89,0x89,0x8A,0x8B,0x9C,0x8A,0x8E,0x8F, +0x90,0x92,0x92,0xA7,0x99,0x95,0xA6,0x97,0x9D,0x99,0x9A,0xA8,0x9C,0x9D,0x9E,0x9F, +0x8F,0x8B,0x95,0x97,0xA5,0xA5,0xA6,0xA7,0xA8,0x9E,0xAB,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xE8,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_keybcs2_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x44,0x45,0x47,0x49,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x5A, +0x5E,0x5F,0x60,0x63,0x66,0x68,0x6C,0x6D,0x6E,0x6F,0x72,0x90,0x91,0x92,0x93,0x94, +0x95,0x41,0x44,0x45,0x47,0x49,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x5A, +0x5E,0x5F,0x60,0x63,0x66,0x68,0x6C,0x6D,0x6E,0x6F,0x72,0x96,0x97,0x98,0x99,0x9A, +0x45,0x68,0x49,0x47,0x41,0x47,0x66,0x45,0x49,0x49,0x56,0x53,0x56,0x56,0x41,0x41, +0x49,0x72,0x72,0x5A,0x5A,0x5A,0x68,0x68,0x6F,0x5A,0x68,0x63,0x56,0x6F,0x60,0x66, +0x41,0x53,0x5A,0x68,0x58,0x58,0x68,0x5A,0x63,0x60,0x60,0x60,0xA0,0xA1,0xA2,0xA3, +0xA4,0xA5,0xA6,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC, +0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC, +0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC, +0x80,0x65,0x83,0x87,0x88,0x89,0xDD,0x8A,0x85,0x8B,0x84,0x81,0xDE,0x85,0x82,0xDF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_keybcs2_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x010C,0x00FC,0x00E9,0x010F,0x00E4,0x010E,0x0164,0x010D, +0x011B,0x011A,0x0139,0x00CD,0x013E,0x013A,0x00C4,0x00C1, +0x00C9,0x017E,0x017D,0x00F4,0x00F6,0x00D3,0x016F,0x00DA, +0x00FD,0x00D6,0x00DC,0x0160,0x013D,0x00DD,0x0158,0x0165, +0x00E1,0x00ED,0x00F3,0x00FA,0x0148,0x0147,0x016E,0x00D4, +0x0161,0x0159,0x0155,0x0154,0x00BC,0x00A1,0x00AB,0x00BB, +0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556, +0x2555,0x2563,0x2551,0x2557,0x255D,0x255C,0x255B,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x255E,0x255F, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x2567, +0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256B, +0x256A,0x2518,0x250C,0x2588,0x2584,0x258C,0x2590,0x2580, +0x03B1,0x00DF,0x0393,0x03C0,0x03A3,0x03C3,0x00B5,0x03C4, +0x03A6,0x0398,0x03A9,0x03B4,0x221E,0x03C6,0x03B5,0x2229, +0x2261,0x00B1,0x2265,0x2264,0x2320,0x2321,0x00F7,0x2248, +0x00B0,0x2219,0x00B7,0x221A,0x207F,0x00B2,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_macce +uchar ctype_macce_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x02,0x01,0x01,0x01,0x01,0x02,0x02,0x01,0x02,0x02,0x01,0x02,0x02,0x01, +0x02,0x01,0x02,0x02,0x01,0x02,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x02, +0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x02,0x01, +0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01, +0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x01,0x02,0x01, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x02,0x01,0x00,0x00,0x02,0x01, +0x02,0x01,0x00,0x00,0x02,0x01,0x02,0x01,0x01,0x02,0x01,0x01,0x02,0x01,0x01,0x01, +0x02,0x01,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x02,0x01,0x01,0x02,0x01,0x00 +}; + +uchar to_lower_macce_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x8A,0x82,0x82,0x8E,0x88,0x9A,0x9F,0x87,0x88,0x8B,0x8A,0x8B,0x8D,0x8D,0x8E,0x90, +0x90,0x93,0x92,0x93,0x95,0x95,0x98,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9E,0x9E,0x9F, +0xA0,0xA1,0xAB,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xB0, +0xB0,0xB4,0xB2,0xB3,0xB4,0xFA,0xB6,0xB7,0xB8,0xBA,0xBA,0xBC,0xBC,0xBE,0xBE,0xC0, +0xC0,0xC4,0xC2,0xC3,0xC4,0xCB,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCE,0x9B,0xCE,0xD8, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xDA,0xDA,0xDE,0xDC,0xDD,0xDE,0xE0, +0xE0,0xE4,0xE2,0xE3,0xE4,0xE6,0xE6,0x87,0xE9,0xE9,0x92,0xEC,0xEC,0xF0,0x97,0x99, +0xF0,0xF3,0x9C,0xF3,0xF5,0xF5,0xF7,0xF7,0xF9,0xF9,0xFA,0xFD,0xB8,0xFD,0xAE,0xFF +}; + +uchar to_upper_macce_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x81,0x83,0x84,0x85,0x86,0xE7,0x84,0x89,0x80,0x89,0x8C,0x8C,0x83,0x8F, +0x8F,0x91,0xEA,0x91,0x94,0x94,0x96,0xEE,0x96,0xEF,0x85,0xCD,0xF2,0x9D,0x9D,0x86, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xA2,0xAC,0xAD,0xFE,0xAF, +0xAF,0xB1,0xB2,0xB3,0xB1,0xB5,0xB6,0xB7,0xFC,0xB9,0xB9,0xBB,0xBB,0xBD,0xBD,0xBF, +0xBF,0xC1,0xC2,0xC3,0xC1,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xC5,0xCC,0xCD,0xCC,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xCF,0xD9,0xD9,0xDB,0xDC,0xDD,0xDB,0xDF, +0xDF,0xE1,0xE2,0xE3,0xE1,0xE5,0xE5,0xE7,0xE8,0xE8,0xEA,0xEB,0xEB,0xED,0xEE,0xEF, +0xED,0xF1,0xF2,0xF1,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xB5,0xFB,0xFC,0xFB,0xFE,0xFF +}; + +uchar sort_order_macce_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x46,0x47,0x4A,0x4C,0x52,0x53,0x55,0x56,0x5A,0x5B,0x5D,0x62,0x62,0x67, +0x6F,0x70,0x71,0x75,0x79,0x81,0x88,0x89,0x8A,0x8B,0x8D,0x90,0x91,0x92,0x93,0x94, +0x95,0x41,0x46,0x47,0x4A,0x4C,0x52,0x53,0x55,0x56,0x5A,0x5B,0x5D,0x62,0x62,0x67, +0x6F,0x70,0x71,0x75,0x79,0x81,0x88,0x89,0x8A,0x8B,0x8D,0x96,0x97,0x98,0x99,0x9A, +0x41,0x41,0x41,0x4C,0x41,0x67,0x81,0x41,0x41,0x47,0x41,0x47,0x47,0x47,0x4C,0x8D, +0x8D,0x4A,0x56,0x4A,0x4C,0x4C,0x4C,0x67,0x4C,0x67,0x67,0x67,0x81,0x4C,0x4C,0x81, +0xA0,0xA1,0x4C,0xA3,0xA4,0xA5,0xA6,0x75,0xA8,0xA9,0xAA,0x4C,0xAC,0xAD,0x53,0x56, +0x56,0x56,0xB2,0xB3,0x56,0x5B,0xB6,0xB7,0x5D,0x5D,0x5D,0x5D,0x5D,0x5D,0x5D,0x62, +0x62,0x62,0xC2,0xC3,0x62,0x62,0xC6,0xC7,0xC8,0xC9,0xCA,0x62,0x67,0x67,0x67,0x67, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0x67,0x71,0x71,0x71,0xDC,0xDD,0x71,0x71, +0x71,0x75,0xE2,0xE3,0x75,0x75,0x75,0x41,0x79,0x79,0x56,0x8D,0x8D,0x81,0x67,0x67, +0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x8B,0x8B,0x5B,0x8D,0x5D,0x8D,0x53,0xFF +}; + +uint16 to_uni_macce_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C4,0x0100,0x0101,0x00C9,0x0104,0x00D6,0x00DC,0x00E1, +0x0105,0x010C,0x00E4,0x010D,0x0106,0x0107,0x00E9,0x0179, +0x017A,0x010E,0x00ED,0x010F,0x0112,0x0113,0x0116,0x00F3, +0x0117,0x00F4,0x00F6,0x00F5,0x00FA,0x011A,0x011B,0x00FC, +0x2020,0x00B0,0x0118,0x00A3,0x00A7,0x2022,0x00B6,0x00DF, +0x00AE,0x00A9,0x2122,0x0119,0x00A8,0x2260,0x0123,0x012E, +0x012F,0x012A,0x2264,0x2265,0x012B,0x0136,0x2202,0x2211, +0x0142,0x013B,0x013C,0x013D,0x013E,0x0139,0x013A,0x0145, +0x0146,0x0143,0x00AC,0x221A,0x0144,0x0147,0x2206,0x00AB, +0x00BB,0x2026,0x00A0,0x0148,0x0150,0x00D5,0x0151,0x014C, +0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA, +0x014D,0x0154,0x0155,0x0158,0x2039,0x203A,0x0159,0x0156, +0x0157,0x0160,0x201A,0x201E,0x0161,0x015A,0x015B,0x00C1, +0x0164,0x0165,0x00CD,0x017D,0x017E,0x016A,0x00D3,0x00D4, +0x016B,0x016E,0x00DA,0x016F,0x0170,0x0171,0x0172,0x0173, +0x00DD,0x00FD,0x0137,0x017B,0x0141,0x017C,0x0122,0x02C7 +}; + +#endif + +#ifdef HAVE_CHARSET_macroman +uchar ctype_macroman_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x10, +0x20,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02, +0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x01,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x20,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x00,0x01,0x01,0x01,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_macroman_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x8A,0x8C,0x8D,0x8E,0x96,0x9A,0x9F,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xBE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0x88,0x8B,0x9B,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD8,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0x89,0x90,0x87,0x91,0x8F,0x92,0x94,0x95,0x93,0x97,0x99, +0xF0,0x98,0x9C,0x9E,0x9D,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_macroman_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0xE7,0xCB,0xE5,0x80,0xCC,0x81,0x82,0x83,0xE9, +0xE6,0xE8,0xEA,0xED,0xEB,0xEC,0x84,0xEE,0xF1,0xEF,0x85,0xCD,0xF2,0xF4,0xF3,0x86, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xAE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD9,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_macroman_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x49,0x50,0x52,0x53,0x57,0x59,0x60,0x61,0x67,0x68,0x69,0x70,0x71,0x72, +0x79,0x80,0x81,0x82,0x84,0x85,0x90,0x91,0x92,0x93,0x95,0xA0,0xA1,0xA2,0xA3,0xA4, +0xA5,0x41,0x49,0x50,0x52,0x53,0x57,0x59,0x60,0x61,0x67,0x68,0x69,0x70,0x71,0x72, +0x79,0x80,0x81,0x82,0x84,0x85,0x90,0x91,0x92,0x93,0x95,0xA6,0xA7,0xA8,0xA9,0xAA, +0x41,0x41,0x50,0x53,0x71,0x72,0x85,0x41,0x41,0x41,0x41,0x41,0x41,0x50,0x53,0x53, +0x53,0x53,0x61,0x61,0x61,0x61,0x71,0x72,0x72,0x72,0x72,0x72,0x85,0x85,0x85,0x85, +0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0x82,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0x48,0x72, +0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0x48,0x72, +0xC6,0xC7,0xC8,0xC9,0x57,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0x41,0x41,0x72,0xD0,0xD1, +0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0x93,0x93,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0x41,0x53,0x41,0x53,0x53,0x61,0x61,0x61,0x61,0x72,0x72, +0xF0,0x72,0x85,0x85,0x85,0x61,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_macroman_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1, +0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8, +0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3, +0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC, +0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF, +0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8, +0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211, +0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8, +0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB, +0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153, +0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA, +0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02, +0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1, +0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4, +0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC, +0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7 +}; + +#endif + +#ifdef HAVE_CHARSET_cp852 +uchar ctype_cp852_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x02,0x01,0x01,0x01, +0x01,0x01,0x02,0x02,0x02,0x01,0x02,0x01,0x02,0x01,0x01,0x01,0x02,0x01,0x00,0x02, +0x02,0x02,0x02,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x00,0x02,0x01,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x01,0x01,0x01,0x02,0x01,0x01,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x01,0x00, +0x01,0x02,0x01,0x01,0x02,0x02,0x01,0x02,0x01,0x01,0x02,0x01,0x02,0x01,0x02,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x02,0x00,0x48 +}; + +uchar to_lower_cp852_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8B,0x8B,0x8C,0xAB,0x84,0x86, +0x82,0x92,0x92,0x93,0x94,0x96,0x96,0x98,0x98,0x94,0x81,0x9C,0x9C,0x88,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAA,0xAB,0x9F,0xB8,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xA0,0x83,0xD8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD0,0xD4,0x89,0xD4,0xE5,0xA1,0x8C,0xD8,0xD9,0xDA,0xDB,0xDC,0xEE,0x85,0xDF, +0xA2,0xE1,0x93,0xE4,0xE4,0xE5,0xE7,0xE7,0xEA,0xA3,0xE8,0xFB,0xEC,0xEC,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp852_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F, +0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0xAC, +0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xAD,0xB9,0xBA,0xBB,0xBC,0xBE,0xBD,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF +}; + +uchar sort_order_cp852_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x47,0x48,0x4C,0x4F,0x54,0x55,0x56,0x57,0x5A,0x5B,0x5C,0x5E,0x5F,0x62, +0x67,0x68,0x69,0x6C,0x71,0x74,0x75,0x76,0x77,0x78,0x7B,0x90,0x91,0x92,0x93,0x94, +0x95,0x41,0x47,0x48,0x4C,0x4F,0x54,0x55,0x56,0x57,0x5A,0x5B,0x5C,0x5E,0x5F,0x62, +0x67,0x68,0x69,0x6C,0x71,0x74,0x75,0x76,0x77,0x78,0x7B,0x96,0x97,0x98,0x99,0x9A, +0x48,0x74,0x4F,0x41,0x41,0x74,0x48,0x48,0x5C,0x4F,0x62,0x62,0x57,0x7B,0x41,0x48, +0x4F,0x5C,0x5C,0x62,0x62,0x5C,0x5C,0x6C,0x6C,0x62,0x74,0x71,0x71,0x5C,0x9E,0x48, +0x41,0x57,0x62,0x74,0x41,0x41,0x7B,0x7B,0x4F,0x4F,0xAA,0x7B,0x48,0x6C,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0x41,0x41,0x4F,0x6C,0xB5,0xBA,0xBB,0xBC,0x7B,0x7B,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0x41,0x41,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0x4C,0x4C,0x4C,0x4F,0x4C,0x60,0x57,0x57,0x4F,0xD9,0xDA,0xDB,0xDC,0x71,0x74,0xDF, +0x62,0x70,0x62,0x60,0x60,0x60,0x6C,0x6C,0x69,0x74,0x69,0x74,0x78,0x78,0x71,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0x74,0x69,0x69,0xFE,0xFF +}; + +uint16 to_uni_cp852_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C7,0x00FC,0x00E9,0x00E2,0x00E4,0x016F,0x0107,0x00E7, +0x0142,0x00EB,0x0150,0x0151,0x00EE,0x0179,0x00C4,0x0106, +0x00C9,0x0139,0x013A,0x00F4,0x00F6,0x013D,0x013E,0x015A, +0x015B,0x00D6,0x00DC,0x0164,0x0165,0x0141,0x00D7,0x010D, +0x00E1,0x00ED,0x00F3,0x00FA,0x0104,0x0105,0x017D,0x017E, +0x0118,0x0119,0x00AC,0x017A,0x010C,0x015F,0x00AB,0x00BB, +0x2591,0x2592,0x2593,0x2502,0x2524,0x00C1,0x00C2,0x011A, +0x015E,0x2563,0x2551,0x2557,0x255D,0x017B,0x017C,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x0102,0x0103, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x00A4, +0x0111,0x0110,0x010E,0x00CB,0x010F,0x0147,0x00CD,0x00CE, +0x011B,0x2518,0x250C,0x2588,0x2584,0x0162,0x016E,0x2580, +0x00D3,0x00DF,0x00D4,0x0143,0x0144,0x0148,0x0160,0x0161, +0x0154,0x00DA,0x0155,0x0170,0x00FD,0x00DD,0x0163,0x00B4, +0x00AD,0x02DD,0x02DB,0x02C7,0x02D8,0x00A7,0x00F7,0x00B8, +0x00B0,0x00A8,0x02D9,0x0171,0x0158,0x0159,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_latin7 +uchar ctype_latin7_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x01,0x20,0x10,0x20,0x10,0x10,0x00,0x00,0x20,0x10,0x20,0x10,0x20,0x10,0x10,0x10, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x00,0x20,0x10,0x20,0x10,0x10,0x20, +0x48,0x20,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin7_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin7_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin7_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x30,0x32,0x33,0x34,0x35,0x36,0x37,0x2B,0x38,0x39,0x3A,0x5C,0x3B,0x2C,0x3C,0x3D, +0x76,0x7A,0x7C,0x7E,0x80,0x81,0x82,0x83,0x84,0x85,0x3E,0x3F,0x5D,0x5E,0x5F,0x40, +0x41,0x86,0x92,0x94,0x9A,0x9C,0xA6,0xA8,0xAC,0xAE,0xB4,0xB6,0xBA,0xC0,0xC2,0xC8, +0xD4,0xD6,0xD8,0xDC,0xE3,0xE6,0xEE,0xF0,0xF2,0xF4,0xF6,0x42,0x43,0x44,0x45,0x46, +0x47,0x86,0x92,0x94,0x9A,0x9C,0xA6,0xA8,0xAC,0xAE,0xB4,0xB6,0xBA,0xC0,0xC2,0xC8, +0xD4,0xD6,0xD8,0xDC,0xE2,0xE6,0xEE,0xF0,0xF2,0xF4,0xF6,0x48,0x49,0x4A,0x4B,0x20, +0x75,0x21,0x56,0x22,0x59,0x73,0x70,0x71,0x23,0x74,0x24,0x5A,0x25,0x4D,0x51,0x50, +0x26,0x54,0x55,0x57,0x58,0x72,0x2E,0x2F,0x27,0xE5,0x28,0x5B,0x29,0x4E,0x53,0x2A, +0x31,0xFE,0x65,0x66,0x67,0xFF,0x4C,0x68,0x2D,0x69,0xDA,0x61,0x6A,0x2D,0x6B,0x90, +0x6C,0x60,0x7D,0x7F,0x4F,0x6D,0x6E,0x6F,0xD3,0x7B,0xDB,0x62,0x77,0x78,0x79,0x90, +0x8E,0xB2,0x8A,0x96,0x88,0x8C,0xA4,0xA2,0x98,0x9E,0xF8,0xA0,0xAA,0xB8,0xB0,0xBE, +0xE1,0xC4,0xC6,0xCA,0xCE,0xD0,0xCC,0x63,0xEC,0xBC,0xDE,0xEA,0xE8,0xFA,0xFC,0xE0, +0x8E,0xB2,0x8A,0x96,0x88,0x8C,0xA4,0xA2,0x98,0x9E,0xF8,0xA0,0xAA,0xB8,0xB0,0xBE, +0xE1,0xC4,0xC6,0xCA,0xCE,0xD0,0xCC,0x64,0xEC,0xBC,0xDE,0xEA,0xE8,0xFA,0xFC,0x52 +}; + +uint16 to_uni_latin7_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7, +0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, +0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7, +0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, +0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, +0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, +0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, +0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, +0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, +0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, +0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, +0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019 +}; + +#endif + +#ifdef HAVE_CHARSET_latin7 +uchar ctype_latin7_general_cs[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x01,0x20,0x10,0x20,0x10,0x10,0x00,0x00,0x20,0x10,0x20,0x10,0x20,0x10,0x10,0x10, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x00,0x20,0x10,0x20,0x10,0x10,0x20, +0x48,0x20,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin7_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin7_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin7_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x30,0x32,0x33,0x34,0x35,0x36,0x37,0x2B,0x38,0x39,0x3A,0x5C,0x3B,0x2C,0x3C,0x3D, +0x76,0x7A,0x7C,0x7E,0x80,0x81,0x82,0x83,0x84,0x85,0x3E,0x3F,0x5D,0x5E,0x5F,0x40, +0x41,0x86,0x92,0x94,0x9A,0x9C,0xA6,0xA8,0xAC,0xAE,0xB4,0xB6,0xBA,0xC0,0xC2,0xC8, +0xD4,0xD6,0xD8,0xDC,0xE3,0xE6,0xEE,0xF0,0xF2,0xF4,0xF6,0x42,0x43,0x44,0x45,0x46, +0x47,0x87,0x93,0x95,0x9B,0x9D,0xA7,0xA9,0xAD,0xAF,0xB5,0xB7,0xBB,0xC1,0xC3,0xC9, +0xD5,0xD7,0xD9,0xDD,0xE4,0xE7,0xEF,0xF1,0xF3,0xF5,0xF7,0x48,0x49,0x4A,0x4B,0x20, +0x75,0x21,0x56,0x22,0x59,0x73,0x70,0x71,0x23,0x74,0x24,0x5A,0x25,0x4D,0x51,0x50, +0x26,0x54,0x55,0x57,0x58,0x72,0x2E,0x2F,0x27,0xE5,0x28,0x5B,0x29,0x4E,0x53,0x2A, +0x31,0xFE,0x65,0x66,0x67,0xFF,0x4C,0x68,0xD3,0x69,0xDA,0x61,0x6A,0x2D,0x6B,0x90, +0x6C,0x60,0x7D,0x7F,0x4F,0x6D,0x6E,0x6F,0xD2,0x7B,0xDB,0x62,0x77,0x78,0x79,0x91, +0x8E,0xB2,0x8A,0x96,0x88,0x8C,0xA4,0xA2,0x98,0x9E,0xF8,0xA0,0xAA,0xB8,0xB0,0xBE, +0xE1,0xC4,0xC6,0xCA,0xCE,0xD0,0xCC,0x63,0xEC,0xBC,0xDE,0xEA,0xE8,0xFA,0xFC,0xE0, +0x8F,0xB3,0x8B,0x97,0x89,0x8D,0xA5,0xA3,0x99,0x9F,0xF9,0xA1,0xAB,0xB9,0xB1,0xBF, +0xE2,0xC5,0xC7,0xCB,0xCF,0xD1,0xCD,0x64,0xED,0xBD,0xDF,0xEB,0xE9,0xFB,0xFD,0x52 +}; + +uint16 to_uni_latin7_general_cs[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7, +0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, +0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7, +0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, +0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, +0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, +0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, +0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, +0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, +0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, +0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, +0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019 +}; + +#endif + +#ifdef HAVE_CHARSET_macce +uchar ctype_macce_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x02,0x01,0x01,0x01,0x01,0x02,0x02,0x01,0x02,0x02,0x01,0x02,0x02,0x01, +0x02,0x01,0x02,0x02,0x01,0x02,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x02, +0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x02,0x01, +0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01, +0x02,0x01,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x01,0x02,0x01, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x02,0x01,0x00,0x00,0x02,0x01, +0x02,0x01,0x00,0x00,0x02,0x01,0x02,0x01,0x01,0x02,0x01,0x01,0x02,0x01,0x01,0x01, +0x02,0x01,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x02,0x01,0x01,0x02,0x01,0x00 +}; + +uchar to_lower_macce_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x8A,0x82,0x82,0x8E,0x88,0x9A,0x9F,0x87,0x88,0x8B,0x8A,0x8B,0x8D,0x8D,0x8E,0x90, +0x90,0x93,0x92,0x93,0x95,0x95,0x98,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9E,0x9E,0x9F, +0xA0,0xA1,0xAB,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xB0, +0xB0,0xB4,0xB2,0xB3,0xB4,0xFA,0xB6,0xB7,0xB8,0xBA,0xBA,0xBC,0xBC,0xBE,0xBE,0xC0, +0xC0,0xC4,0xC2,0xC3,0xC4,0xCB,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCE,0x9B,0xCE,0xD8, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xDA,0xDA,0xDE,0xDC,0xDD,0xDE,0xE0, +0xE0,0xE4,0xE2,0xE3,0xE4,0xE6,0xE6,0x87,0xE9,0xE9,0x92,0xEC,0xEC,0xF0,0x97,0x99, +0xF0,0xF3,0x9C,0xF3,0xF5,0xF5,0xF7,0xF7,0xF9,0xF9,0xFA,0xFD,0xB8,0xFD,0xAE,0xFF +}; + +uchar to_upper_macce_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x81,0x83,0x84,0x85,0x86,0xE7,0x84,0x89,0x80,0x89,0x8C,0x8C,0x83,0x8F, +0x8F,0x91,0xEA,0x91,0x94,0x94,0x96,0xEE,0x96,0xEF,0x85,0xCD,0xF2,0x9D,0x9D,0x86, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xA2,0xAC,0xAD,0xFE,0xAF, +0xAF,0xB1,0xB2,0xB3,0xB1,0xB5,0xB6,0xB7,0xFC,0xB9,0xB9,0xBB,0xBB,0xBD,0xBD,0xBF, +0xBF,0xC1,0xC2,0xC3,0xC1,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xC5,0xCC,0xCD,0xCC,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xCF,0xD9,0xD9,0xDB,0xDC,0xDD,0xDB,0xDF, +0xDF,0xE1,0xE2,0xE3,0xE1,0xE5,0xE5,0xE7,0xE8,0xE8,0xEA,0xEB,0xEB,0xED,0xEE,0xEF, +0xED,0xF1,0xF2,0xF1,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xB5,0xFB,0xFC,0xFB,0xFE,0xFF +}; + +uint16 to_uni_macce_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C4,0x0100,0x0101,0x00C9,0x0104,0x00D6,0x00DC,0x00E1, +0x0105,0x010C,0x00E4,0x010D,0x0106,0x0107,0x00E9,0x0179, +0x017A,0x010E,0x00ED,0x010F,0x0112,0x0113,0x0116,0x00F3, +0x0117,0x00F4,0x00F6,0x00F5,0x00FA,0x011A,0x011B,0x00FC, +0x2020,0x00B0,0x0118,0x00A3,0x00A7,0x2022,0x00B6,0x00DF, +0x00AE,0x00A9,0x2122,0x0119,0x00A8,0x2260,0x0123,0x012E, +0x012F,0x012A,0x2264,0x2265,0x012B,0x0136,0x2202,0x2211, +0x0142,0x013B,0x013C,0x013D,0x013E,0x0139,0x013A,0x0145, +0x0146,0x0143,0x00AC,0x221A,0x0144,0x0147,0x2206,0x00AB, +0x00BB,0x2026,0x00A0,0x0148,0x0150,0x00D5,0x0151,0x014C, +0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA, +0x014D,0x0154,0x0155,0x0158,0x2039,0x203A,0x0159,0x0156, +0x0157,0x0160,0x201A,0x201E,0x0161,0x015A,0x015B,0x00C1, +0x0164,0x0165,0x00CD,0x017D,0x017E,0x016A,0x00D3,0x00D4, +0x016B,0x016E,0x00DA,0x016F,0x0170,0x0171,0x0172,0x0173, +0x00DD,0x00FD,0x0137,0x017B,0x0141,0x017C,0x0122,0x02C7 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1250 +uchar ctype_cp1250_croatian_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x20,0x20,0x10,0x20,0x10,0x10,0x10,0x10,0x20,0x10,0x01,0x10,0x01,0x01,0x01,0x01, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x02,0x10,0x02,0x02,0x02,0x02, +0x48,0x10,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x02,0x02,0x10,0x01,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_cp1250_croatian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xB3,0xA4,0xB9,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBE,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1250_croatian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_cp1250_croatian_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0x90,0x91,0x92,0x93,0x94, +0x95,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0x96,0x97,0x98,0x99,0x9A, +0x9B,0x9C,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0x60,0xA6,0x5F,0x62,0x6C,0x6B, +0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0x60,0xB1,0x5F,0x62,0x6C,0x6B, +0xB2,0xB3,0xB4,0x54,0xB5,0x41,0xB6,0xB7,0xB8,0xB9,0x5F,0xBA,0xBB,0xBC,0xBD,0x6B, +0xBE,0xBF,0xC0,0x54,0xC1,0xC2,0xC3,0xC4,0xC5,0x41,0x5F,0xC6,0x54,0xC7,0x54,0x6B, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x46,0x4B,0x4B,0x4B,0x4B,0x50,0x50,0x48, +0x4A,0x57,0x57,0x59,0x59,0x59,0x59,0xC8,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0x5F, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x46,0x4B,0x4B,0x4B,0x4B,0x50,0x50,0x48, +0x4A,0x57,0x57,0x59,0x59,0x59,0x59,0xC9,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0xFF +}; + +uint16 to_uni_cp1250_croatian_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A, +0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7, +0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B, +0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_latin1 +uchar ctype_latin1_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x00,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x01,0x00,0x01,0x00, +0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x02,0x00,0x02,0x01, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_latin1_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin1_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin1_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x51,0x53,0x57,0x5B,0x65,0x67,0x69,0x6B,0x75,0x77,0x79,0x7B,0x7D,0x81, +0x8F,0x91,0x93,0x95,0x98,0x9A,0xA4,0xA6,0xA8,0xAA,0xAF,0xB3,0xB4,0xB5,0xB6,0xB7, +0xB8,0x41,0x51,0x53,0x57,0x5B,0x65,0x67,0x69,0x6B,0x75,0x77,0x79,0x7B,0x7D,0x81, +0x8F,0x91,0x93,0x95,0x98,0x9A,0xA4,0xA6,0xA8,0xAA,0xAF,0xB9,0xBA,0xBB,0xBC,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x55,0x5D,0x5F,0x61,0x63,0x6D,0x6F,0x71,0x73, +0x59,0x7F,0x83,0x85,0x87,0x89,0x8B,0xBD,0x8D,0x9C,0x9E,0xA0,0xA2,0xAC,0xB1,0x97, +0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x55,0x5D,0x5F,0x61,0x63,0x6D,0x6F,0x71,0x73, +0x59,0x7F,0x83,0x85,0x87,0x89,0x8B,0xBE,0x8D,0x9C,0x9E,0xA0,0xA2,0xAC,0xB1,0xAE +}; + +uint16 to_uni_latin1_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F, +0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; + +#endif + +#ifdef HAVE_CHARSET_latin1 +uchar ctype_latin1_general_cs[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x00,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x01,0x00,0x01,0x00, +0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x02,0x00,0x02,0x01, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_latin1_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin1_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin1_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x51,0x53,0x57,0x5B,0x65,0x67,0x69,0x6B,0x75,0x77,0x79,0x7B,0x7D,0x81, +0x8F,0x91,0x93,0x95,0x98,0x9A,0xA4,0xA6,0xA8,0xAA,0xAF,0xB3,0xB4,0xB5,0xB6,0xB7, +0xB8,0x42,0x52,0x54,0x58,0x5C,0x66,0x68,0x6A,0x6C,0x76,0x78,0x7A,0x7C,0x7E,0x82, +0x90,0x92,0x94,0x96,0x99,0x9B,0xA5,0xA7,0xA9,0xAB,0xB0,0xB9,0xBA,0xBB,0xBC,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x55,0x5D,0x5F,0x61,0x63,0x6D,0x6F,0x71,0x73, +0x59,0x7F,0x83,0x85,0x87,0x89,0x8B,0xBD,0x8D,0x9C,0x9E,0xA0,0xA2,0xAC,0xB1,0x97, +0x44,0x46,0x48,0x4A,0x4C,0x4E,0x50,0x56,0x5E,0x60,0x62,0x64,0x6E,0x70,0x72,0x74, +0x5A,0x80,0x84,0x86,0x88,0x8A,0x8C,0xBE,0x8E,0x9D,0x9F,0xA1,0xA3,0xAD,0xB2,0xAE +}; + +uint16 to_uni_latin1_general_cs[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F, +0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; + +#endif + +#ifdef HAVE_CHARSET_cp1251 +uchar ctype_cp1251_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x01, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02, +0x00,0x01,0x02,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x01,0x02,0x02,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x01,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_cp1251_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x90,0x83,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA2,0xA2,0xBC,0xA4,0xB4,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB3,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1251_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x81,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x8E,0x8F, +0xA0,0xA1,0xA1,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uint16 to_uni_cp1251_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, +0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, +0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407, +0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7, +0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, +0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, +0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, +0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, +0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, +0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F +}; + +#endif + +#ifdef HAVE_CHARSET_cp1251 +uchar ctype_cp1251_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x01, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02, +0x00,0x01,0x02,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x01,0x02,0x02,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x01,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_cp1251_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x90,0x83,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA2,0xA2,0xBC,0xA4,0xB4,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB3,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1251_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x81,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x8E,0x8F, +0xA0,0xA1,0xA1,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar sort_order_cp1251_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59,0x5B,0x5D, +0x5F,0x61,0x63,0x65,0x67,0x69,0x6B,0x6D,0x6F,0x71,0x73,0xD3,0xD4,0xD5,0xD6,0xD7, +0xD8,0x41,0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59,0x5B,0x5D, +0x5F,0x61,0x63,0x65,0x67,0x69,0x6B,0x6D,0x6F,0x71,0x73,0xD9,0xDA,0xDB,0xDC,0xDD, +0x81,0x83,0xDE,0x83,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xA1,0xE5,0xA7,0x9D,0xB3,0xC1, +0x81,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xA1,0xEF,0xA7,0x9D,0xB3,0xC1, +0xF0,0xB7,0xB7,0x99,0xF1,0x7D,0xF2,0xF3,0x87,0xF4,0x89,0xF5,0xF6,0xF7,0xF8,0x95, +0xF9,0xFA,0x93,0x93,0x7D,0xFB,0xFC,0xFD,0x87,0xFE,0x89,0xFF,0x99,0x8F,0x8F,0x95, +0x75,0x77,0x79,0x7B,0x7F,0x85,0x8B,0x8D,0x91,0x97,0x9B,0x9F,0xA3,0xA5,0xA9,0xAB, +0xAD,0xAF,0xB1,0xB5,0xB9,0xBB,0xBD,0xBF,0xC3,0xC5,0xC7,0xC9,0xCB,0xCD,0xCF,0xD1, +0x75,0x77,0x79,0x7B,0x7F,0x85,0x8B,0x8D,0x91,0x97,0x9B,0x9F,0xA3,0xA5,0xA9,0xAB, +0xAD,0xAF,0xB1,0xB5,0xB9,0xBB,0xBD,0xBF,0xC3,0xC5,0xC7,0xC9,0xCB,0xCD,0xCF,0xD1 +}; + +uint16 to_uni_cp1251_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, +0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, +0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407, +0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7, +0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, +0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, +0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, +0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, +0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, +0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F +}; + +#endif + +#ifdef HAVE_CHARSET_cp1251 +uchar ctype_cp1251_general_cs[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x01,0x01, +0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x02,0x02,0x02, +0x00,0x01,0x02,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x01,0x02,0x02,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x01,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_cp1251_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x90,0x83,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA2,0xA2,0xBC,0xA4,0xB4,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB3,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1251_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x81,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x8E,0x8F, +0xA0,0xA1,0xA1,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar sort_order_cp1251_general_cs[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x45,0x47,0x49,0x4B,0x4D,0x4F,0x51,0x53,0x55,0x57,0x59,0x5B,0x5D, +0x5F,0x61,0x63,0x65,0x67,0x69,0x6B,0x6D,0x6F,0x71,0x73,0xD3,0xD4,0xD5,0xD6,0xD7, +0xD8,0x42,0x44,0x46,0x48,0x4A,0x4C,0x4E,0x50,0x52,0x54,0x56,0x58,0x5A,0x5C,0x5E, +0x60,0x62,0x64,0x66,0x68,0x6A,0x6C,0x6E,0x70,0x72,0x74,0xD9,0xDA,0xDB,0xDC,0xDD, +0x81,0x83,0xDE,0x84,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xA1,0xE5,0xA7,0x9D,0xB3,0xC1, +0x82,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xA2,0xEF,0xA8,0x9E,0xB4,0xC2, +0xF0,0xB7,0xB8,0x99,0xF1,0x7D,0xF2,0xF3,0x87,0xF4,0x89,0xF5,0xF6,0xF7,0xF8,0x95, +0xF9,0xFA,0x93,0x94,0x7E,0xFB,0xFC,0xFD,0x88,0xFE,0x8A,0xFF,0x9A,0x8F,0x90,0x96, +0x75,0x77,0x79,0x7B,0x7F,0x85,0x8B,0x8D,0x91,0x97,0x9B,0x9F,0xA3,0xA5,0xA9,0xAB, +0xAD,0xAF,0xB1,0xB5,0xB9,0xBB,0xBD,0xBF,0xC3,0xC5,0xC7,0xC9,0xCB,0xCD,0xCF,0xD1, +0x76,0x78,0x7A,0x7C,0x80,0x86,0x8C,0x8E,0x92,0x98,0x9C,0xA0,0xA4,0xA6,0xAA,0xAC, +0xAE,0xB0,0xB2,0xB6,0xBA,0xBC,0xBE,0xC0,0xC4,0xC6,0xC8,0xCA,0xCC,0xCE,0xD0,0xD2 +}; + +uint16 to_uni_cp1251_general_cs[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F, +0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F, +0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7, +0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407, +0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7, +0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, +0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, +0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, +0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, +0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, +0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F +}; + +#endif + +#ifdef HAVE_CHARSET_macroman +uchar ctype_macroman_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x10, +0x20,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02, +0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x01,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x20,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x00,0x01,0x01,0x01,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_macroman_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x8A,0x8C,0x8D,0x8E,0x96,0x9A,0x9F,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xBE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0x88,0x8B,0x9B,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD8,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0x89,0x90,0x87,0x91,0x8F,0x92,0x94,0x95,0x93,0x97,0x99, +0xF0,0x98,0x9C,0x9E,0x9D,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_macroman_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0xE7,0xCB,0xE5,0x80,0xCC,0x81,0x82,0x83,0xE9, +0xE6,0xE8,0xEA,0xED,0xEB,0xEC,0x84,0xEE,0xF1,0xEF,0x85,0xCD,0xF2,0xF4,0xF3,0x86, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xAE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD9,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_macroman_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1, +0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8, +0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3, +0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC, +0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF, +0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8, +0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211, +0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8, +0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB, +0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153, +0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA, +0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02, +0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1, +0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4, +0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC, +0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1256 +uchar ctype_cp1256_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x00,0x00, +0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x03,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x00, +0x03,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x00,0x00, +0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x10, +0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x02,0x03,0x02,0x03,0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x02,0x03,0x03,0x02,0x02, +0x03,0x03,0x03,0x03,0x02,0x03,0x03,0x00,0x03,0x02,0x03,0x02,0x02,0x00,0x00,0x00 +}; + +uchar to_lower_cp1256_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x9C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1256_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5F,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7F,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_cp1256_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x45,0x47,0x4A,0x4C,0x52,0x55,0x57,0x59,0x5D,0x5F,0x61,0x63,0x65,0x67, +0x6C,0x6E,0x70,0x72,0x74,0x76,0x7B,0x7D,0x7F,0x81,0x83,0xB9,0xBA,0xBB,0xBC,0xBD, +0xBE,0x41,0x45,0x47,0x4A,0x4C,0x52,0x55,0x57,0x59,0x5D,0x5F,0x61,0x63,0x65,0x67, +0x6C,0x6E,0x70,0x72,0x74,0x76,0x7B,0x7D,0x7F,0x81,0x83,0xBF,0xC0,0xC1,0xC2,0xC3, +0xC4,0x8E,0xC5,0x54,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0x6A,0x92,0x99,0xCE, +0xA5,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0x6A,0xDA,0xDB,0xDC, +0xDD,0xB6,0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB, +0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xB7,0xF6,0xF7,0xF8,0xF9,0xB8, +0xFA,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x9F,0x90,0x91,0x93,0x94,0x95, +0x96,0x97,0x98,0x9A,0x9B,0x9C,0x9D,0xFB,0x9E,0x9F,0xA0,0xA1,0xAD,0xA2,0xA3,0xA4, +0x43,0xA6,0x44,0xA7,0xA8,0xA9,0xAA,0x49,0x4E,0x4F,0x50,0x51,0xAB,0xAC,0x5B,0x5C, +0xAE,0xAF,0xB0,0xB1,0x69,0xB2,0xB3,0xFC,0xB4,0x78,0xB5,0x79,0x7A,0xFD,0xFE,0xFF +}; + +uint16 to_uni_cp1256_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x067E,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0000,0x2039,0x0152,0x0686,0x0698,0x0000, +0x06AF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0000,0x203A,0x0153,0x200C,0x200D,0x0000, +0x00A0,0x060C,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x061B,0x00BB,0x00BC,0x00BD,0x00BE,0x061F, +0x0000,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627, +0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F, +0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x00D7, +0x0637,0x0638,0x0639,0x063A,0x0640,0x0641,0x0642,0x0643, +0x00E0,0x0644,0x00E2,0x0645,0x0646,0x0647,0x0648,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x0649,0x064A,0x00EE,0x00EF, +0x064B,0x064C,0x064D,0x064E,0x00F4,0x064F,0x0650,0x00F7, +0x0651,0x00F9,0x0652,0x00FB,0x00FC,0x200E,0x200F,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1257 +uchar ctype_cp1257_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00 +}; + +uchar to_lower_cp1257_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1257_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uint16 to_uni_cp1257_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0000,0x2039,0x0000,0x00A8,0x02C7,0x00B8, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0000,0x203A,0x0000,0x00AF,0x02DB,0x0000, +0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x0000,0x00A6,0x00A7, +0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, +0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, +0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, +0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, +0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, +0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, +0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, +0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, +0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1257 +uchar ctype_cp1257_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x00,0x00,0x00,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00 +}; + +uchar to_lower_cp1257_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1257_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_cp1257_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x4D,0x4F,0x55,0x57,0x61,0x63,0x67,0x69,0x6F,0x71,0x75,0x7B,0x7D,0x83, +0x8F,0x91,0x93,0x97,0x9E,0xA0,0xA8,0xAA,0xAC,0xAE,0xB0,0xB8,0xB9,0xBA,0xBB,0xBC, +0xBD,0x41,0x4D,0x4F,0x55,0x57,0x61,0x63,0x67,0x69,0x6F,0x71,0x75,0x7B,0x7D,0x83, +0x8F,0x91,0x93,0x97,0x9E,0xA0,0xA8,0xAA,0xAC,0xAE,0xB0,0xBE,0xBF,0xC0,0xC1,0xC4, +0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4, +0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4, +0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0x83,0xED,0x93,0xEE,0xEF,0xF0,0xF1,0x41, +0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0x83,0xFA,0x93,0xFB,0xFC,0xFD,0xFE,0x41, +0x41,0x69,0x41,0x4F,0x41,0x41,0x57,0x57,0x4F,0x57,0xB0,0x57,0x63,0x71,0x69,0x75, +0x97,0x7D,0x7D,0x83,0x83,0x83,0x83,0xC2,0xA0,0x75,0x97,0xA0,0xA0,0xB0,0xB0,0x97, +0x41,0x69,0x41,0x4F,0x41,0x41,0x57,0x57,0x4F,0x57,0xB0,0x57,0x63,0x71,0x69,0x75, +0x97,0x7D,0x7D,0x83,0x83,0x83,0x83,0xC3,0xA0,0x75,0x97,0xA0,0xA0,0xB0,0xB0,0xFF +}; + +uint16 to_uni_cp1257_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0000,0x2039,0x0000,0x00A8,0x02C7,0x00B8, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0000,0x203A,0x0000,0x00AF,0x02DB,0x0000, +0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x0000,0x00A6,0x00A7, +0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, +0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, +0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, +0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, +0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, +0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, +0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, +0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, +0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_armscii8 +uchar ctype_armscii8_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x10,0x10 +}; + +uchar to_lower_armscii8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB3,0xB3,0xB5,0xB5,0xB7,0xB7,0xB9,0xB9,0xBB,0xBB,0xBD,0xBD,0xBF,0xBF, +0xC1,0xC1,0xC3,0xC3,0xC5,0xC5,0xC7,0xC7,0xC9,0xC9,0xCB,0xCB,0xCD,0xCD,0xCF,0xCF, +0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xD9,0xD9,0xDB,0xDB,0xDD,0xDD,0xDF,0xDF, +0xE1,0xE1,0xE3,0xE3,0xE5,0xE5,0xE7,0xE7,0xE9,0xE9,0xEB,0xEB,0xED,0xED,0xEF,0xEF, +0xF1,0xF1,0xF3,0xF3,0xF5,0xF5,0xF7,0xF7,0xF9,0xF9,0xFB,0xFB,0xFD,0xFD,0xFE,0xFF +}; + +uchar to_upper_armscii8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB2,0xB4,0xB4,0xB6,0xB6,0xB8,0xB8,0xBA,0xBA,0xBC,0xBC,0xBE,0xBE, +0xC0,0xC0,0xC2,0xC2,0xC4,0xC4,0xC6,0xC6,0xC8,0xC8,0xCA,0xCA,0xCC,0xCC,0xCE,0xCE, +0xD0,0xD0,0xD2,0xD2,0xD4,0xD4,0xD6,0xD6,0xD8,0xD8,0xDA,0xDA,0xDC,0xDC,0xDE,0xDE, +0xE0,0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE, +0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFE,0xFF +}; + +uint16 to_uni_armscii8_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x2741,0x00A7,0x0589,0x0029,0x0028,0x00BB,0x00AB, +0x2014,0x002E,0x055D,0x002C,0x002D,0x055F,0x2026,0x055C, +0x055B,0x055E,0x0531,0x0561,0x0532,0x0562,0x0533,0x0563, +0x0534,0x0564,0x0535,0x0565,0x0536,0x0566,0x0537,0x0567, +0x0538,0x0568,0x0539,0x0569,0x053A,0x056A,0x053B,0x056B, +0x053C,0x056C,0x053D,0x056D,0x053E,0x056E,0x053F,0x056F, +0x0540,0x0570,0x0541,0x0571,0x0542,0x0572,0x0543,0x0573, +0x0544,0x0574,0x0545,0x0575,0x0546,0x0576,0x0547,0x0577, +0x0548,0x0578,0x0549,0x0579,0x054A,0x057A,0x054B,0x057B, +0x054C,0x057C,0x054D,0x057D,0x054E,0x057E,0x054F,0x057F, +0x0550,0x0580,0x0551,0x0581,0x0552,0x0582,0x0553,0x0583, +0x0554,0x0584,0x0555,0x0585,0x0556,0x0586,0x2019,0x0027 +}; + +#endif + +#ifdef HAVE_CHARSET_ascii +uchar ctype_ascii_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_ascii_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_ascii_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_ascii_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1250 +uchar ctype_cp1250_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x20,0x20,0x10,0x20,0x10,0x10,0x10,0x10,0x20,0x10,0x01,0x10,0x01,0x01,0x01,0x01, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x02,0x10,0x02,0x02,0x02,0x02, +0x48,0x10,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x02,0x02,0x10,0x01,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_cp1250_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xB3,0xA4,0xB9,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBE,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1250_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uint16 to_uni_cp1250_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A, +0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7, +0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B, +0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_cp1256 +uchar ctype_cp1256_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x00,0x00, +0x00,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x03,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x00, +0x03,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, +0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x00,0x00, +0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x10, +0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x02,0x03,0x02,0x03,0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x02,0x03,0x03,0x02,0x02, +0x03,0x03,0x03,0x03,0x02,0x03,0x03,0x00,0x03,0x02,0x03,0x02,0x02,0x00,0x00,0x00 +}; + +uchar to_lower_cp1256_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x54,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x9C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1256_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5F,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x74,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7F,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_cp1256_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x067E,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0000,0x2039,0x0152,0x0686,0x0698,0x0000, +0x06AF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0000,0x203A,0x0153,0x200C,0x200D,0x0000, +0x00A0,0x060C,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x061B,0x00BB,0x00BC,0x00BD,0x00BE,0x061F, +0x0000,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627, +0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F, +0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x00D7, +0x0637,0x0638,0x0639,0x063A,0x0640,0x0641,0x0642,0x0643, +0x00E0,0x0644,0x00E2,0x0645,0x0646,0x0647,0x0648,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x0649,0x064A,0x00EE,0x00EF, +0x064B,0x064C,0x064D,0x064E,0x00F4,0x064F,0x0650,0x00F7, +0x0651,0x00F9,0x0652,0x00FB,0x00FC,0x200E,0x200F,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_cp866 +uchar ctype_cp866_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48 +}; + +uchar to_lower_cp866_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0x86,0x87,0x88,0x89,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0x86,0x87,0x88,0x89,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF1,0xF1,0xF3,0xF3,0xF5,0xF5,0xF7,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp866_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_cp866_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417, +0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F, +0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427, +0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437, +0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F, +0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556, +0x2555,0x2563,0x2551,0x2557,0x255D,0x255C,0x255B,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x255E,0x255F, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x2567, +0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256B, +0x256A,0x2518,0x250C,0x2588,0x2584,0x258C,0x2590,0x2580, +0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447, +0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F, +0x0401,0x0451,0x0404,0x0454,0x0407,0x0457,0x040E,0x045E, +0x00B0,0x2219,0x00B7,0x221A,0x207F,0x00B2,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_dec8 +uchar ctype_dec8_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_dec8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_dec8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uint16 to_uni_dec8_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x00A1,0x00A2,0x00A3,0x0000,0x00A5,0x0000,0x00A7, +0x00A4,0x00A9,0x00AA,0x00AB,0x0000,0x0000,0x0000,0x0000, +0x00B0,0x00B1,0x00B2,0x00B3,0x0000,0x00B5,0x00B6,0x00B7, +0x0000,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x0000,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x0000,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x0152, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0178,0x0000,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x0000,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x0153, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FF,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_greek +uchar ctype_greek_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x10,0x10,0x00,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x01,0x01,0x01,0x10,0x01,0x10,0x01,0x01, +0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00 +}; + +uchar to_lower_greek_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xDC,0xB7,0xDD,0xDE,0xDF,0xBB,0xFC,0xBD,0xFD,0xFE, +0xC0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xD2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_greek_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xDA,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xC1,0xC5,0xC7,0xC9, +0xDB,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD3,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xCF,0xD5,0xD9,0xFF +}; + +uint16 to_uni_greek_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x02BD,0x02BC,0x00A3,0x0000,0x0000,0x00A6,0x00A7, +0x00A8,0x00A9,0x0000,0x00AB,0x00AC,0x00AD,0x0000,0x2015, +0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x0385,0x0386,0x00B7, +0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F, +0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397, +0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F, +0x03A0,0x03A1,0x0000,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7, +0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF, +0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7, +0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF, +0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7, +0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_hebrew +uchar ctype_hebrew_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x00 +}; + +uchar to_lower_hebrew_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_hebrew_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_hebrew_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x0000,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x203E, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2017, +0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, +0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, +0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, +0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x200E,0x200F,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_hp8 +uchar ctype_hp8_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x02,0x02, +0x01,0x10,0x10,0x01,0x02,0x10,0x10,0x02,0x01,0x10,0x01,0x01,0x01,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20 +}; + +uchar to_lower_hp8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xC8,0xC0,0xC9,0xC1,0xCD,0xD1,0xDD,0xA8,0xA9,0xAA,0xAB,0xAC,0xCB,0xC3,0xAF, +0xB0,0xB2,0xB2,0xB3,0xB5,0xB5,0xB7,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD4,0xD1,0xD6,0xD7,0xD4,0xD5,0xD6,0xD7,0xCC,0xD9,0xCE,0xCF,0xC5,0xDD,0xDE,0xC2, +0xC4,0xE2,0xE2,0xE4,0xE4,0xD5,0xD9,0xC6,0xCA,0xEA,0xEA,0xEC,0xEC,0xC7,0xEF,0xEF, +0xF1,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_hp8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB1,0xB3,0xB4,0xB4,0xB6,0xB6,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xA2,0xA4,0xDF,0xAE,0xE0,0xDC,0xE7,0xED,0xA1,0xA3,0xE8,0xAD,0xD8,0xA5,0xDA,0xDB, +0xD0,0xA6,0xD2,0xD3,0xD0,0xE5,0xD2,0xD3,0xD8,0xE6,0xDA,0xDB,0xDC,0xA7,0xDE,0xDF, +0xE0,0xE1,0xE1,0xE3,0xE3,0xE5,0xE6,0xE7,0xE8,0xE9,0xE9,0xEB,0xEB,0xED,0xEE,0xEE, +0xF0,0xF0,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_hp8_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x00C0,0x00C2,0x00C8,0x00CA,0x00CB,0x00CE,0x00CF, +0x00B4,0x02CB,0x02C6,0x00A8,0x02DC,0x00D9,0x00DB,0x20A4, +0x00AF,0x00DD,0x00FD,0x00B0,0x00C7,0x00E7,0x00D1,0x00F1, +0x00A1,0x00BF,0x00A4,0x00A3,0x00A5,0x00A7,0x0192,0x00A2, +0x00E2,0x00EA,0x00F4,0x00FB,0x00E1,0x00E9,0x00F3,0x00FA, +0x00E0,0x00E8,0x00F2,0x00F9,0x00E4,0x00EB,0x00F6,0x00FC, +0x00C5,0x00EE,0x00D8,0x00C6,0x00E5,0x00ED,0x00F8,0x00E6, +0x00C4,0x00EC,0x00D6,0x00DC,0x00C9,0x00EF,0x00DF,0x00D4, +0x00C1,0x00C3,0x00E3,0x00D0,0x00F0,0x00CD,0x00CC,0x00D3, +0x00D2,0x00D5,0x00F5,0x0160,0x0161,0x00DA,0x0178,0x00FF, +0x00DE,0x00FE,0x00B7,0x00B5,0x00B6,0x00BE,0x2014,0x00BC, +0x00BD,0x00AA,0x00BA,0x00AB,0x25A0,0x00BB,0x00B1,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_keybcs2 +uchar ctype_keybcs2_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x02,0x82,0x02,0x02,0x01,0x01,0x02,0x82,0x81,0x01,0x01,0x02,0x02,0x01,0x01, +0x81,0x02,0x01,0x02,0x02,0x01,0x02,0x01,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x01,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x02,0x01,0x02,0x01,0x02,0x00,0x02,0x01,0x01,0x01,0x02,0x00,0x02,0x02,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48 +}; + +uchar to_lower_keybcs2_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x81,0x82,0x83,0x84,0x83,0x86,0x87,0x88,0x88,0x8D,0xA1,0x8C,0x8D,0x84,0xA0, +0x82,0x91,0x91,0x93,0x94,0xA2,0x96,0xA3,0x98,0x94,0x81,0x9B,0x8C,0x98,0xA9,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA4,0x96,0x93,0x9B,0xA9,0xAA,0xAA,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xED,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_keybcs2_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x68,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x9A,0x90,0x85,0x8E,0x85,0x86,0x80,0x89,0x89,0x8A,0x8B,0x9C,0x8A,0x8E,0x8F, +0x90,0x92,0x92,0xA7,0x99,0x95,0xA6,0x97,0x9D,0x99,0x9A,0xA8,0x9C,0x9D,0x9E,0x9F, +0x8F,0x8B,0x95,0x97,0xA5,0xA5,0xA6,0xA7,0xA8,0x9E,0xAB,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xE8,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_keybcs2_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x010C,0x00FC,0x00E9,0x010F,0x00E4,0x010E,0x0164,0x010D, +0x011B,0x011A,0x0139,0x00CD,0x013E,0x013A,0x00C4,0x00C1, +0x00C9,0x017E,0x017D,0x00F4,0x00F6,0x00D3,0x016F,0x00DA, +0x00FD,0x00D6,0x00DC,0x0160,0x013D,0x00DD,0x0158,0x0165, +0x00E1,0x00ED,0x00F3,0x00FA,0x0148,0x0147,0x016E,0x00D4, +0x0161,0x0159,0x0155,0x0154,0x00BC,0x00A1,0x00AB,0x00BB, +0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556, +0x2555,0x2563,0x2551,0x2557,0x255D,0x255C,0x255B,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x255E,0x255F, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x2567, +0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256B, +0x256A,0x2518,0x250C,0x2588,0x2584,0x258C,0x2590,0x2580, +0x03B1,0x00DF,0x0393,0x03C0,0x03A3,0x03C3,0x00B5,0x03C4, +0x03A6,0x0398,0x03A9,0x03B4,0x221E,0x03C6,0x03B5,0x2229, +0x2261,0x00B1,0x2265,0x2264,0x2320,0x2321,0x00F7,0x2248, +0x00B0,0x2219,0x00B7,0x221A,0x207F,0x00B2,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_koi8r +uchar ctype_koi8r_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 +}; + +uchar to_lower_koi8r_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar to_upper_koi8r_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xB3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_koi8r_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x2500,0x2502,0x250C,0x2510,0x2514,0x2518,0x251C,0x2524, +0x252C,0x2534,0x253C,0x2580,0x2584,0x2588,0x258C,0x2590, +0x2591,0x2592,0x2593,0x2320,0x25A0,0x2219,0x221A,0x2248, +0x2264,0x2265,0x00A0,0x2321,0x00B0,0x00B2,0x00B7,0x00F7, +0x2550,0x2551,0x2552,0x0451,0x2553,0x2554,0x2555,0x2556, +0x2557,0x2558,0x2559,0x255A,0x255B,0x255C,0x255D,0x255E, +0x255F,0x2560,0x2561,0x0401,0x2562,0x2563,0x2564,0x2565, +0x2566,0x2567,0x2568,0x2569,0x256A,0x256B,0x256C,0x00A9, +0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433, +0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432, +0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A, +0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413, +0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412, +0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A +}; + +#endif + +#ifdef HAVE_CHARSET_koi8u +uchar ctype_koi8u_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x02,0x02,0x10,0x02,0x02,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10, +0x10,0x10,0x10,0x01,0x01,0x10,0x01,0x01,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 +}; + +uchar to_lower_koi8u_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x20,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0xA3,0xA4,0x20,0xA6,0xA7,0x20,0x20,0x20,0x20,0x20,0xAD,0x20,0x20, +0x20,0x20,0x20,0xA3,0xA4,0x20,0xA6,0xA7,0x20,0x20,0x20,0x20,0x20,0xAD,0x20,0x20, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF +}; + +uchar to_upper_koi8u_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x20,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x20,0x20,0x20,0xB3,0xB4,0x20,0xB6,0xB7,0x20,0x20,0x20,0x20,0x20,0xBD,0x20,0x20, +0x20,0x20,0x20,0xB3,0xB4,0x20,0xB6,0xB7,0x20,0x20,0x20,0x20,0x20,0xBD,0x20,0x20, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_koi8u_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x2500,0x2502,0x250C,0x2510,0x2514,0x2518,0x251C,0x2524, +0x252C,0x2534,0x253C,0x2580,0x2584,0x2588,0x258C,0x2590, +0x2591,0x2592,0x2593,0x2320,0x25A0,0x2022,0x221A,0x2248, +0x2264,0x2265,0x00A0,0x2321,0x00B0,0x00B2,0x00B7,0x00F7, +0x2550,0x2551,0x2552,0x0451,0x0454,0x2554,0x0456,0x0457, +0x2557,0x2558,0x2559,0x255A,0x255B,0x0491,0x255D,0x255E, +0x255F,0x2560,0x2561,0x0401,0x0404,0x2563,0x0406,0x0407, +0x2566,0x2567,0x2568,0x2569,0x256A,0x0490,0x256C,0x00A9, +0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433, +0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432, +0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A, +0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413, +0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412, +0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A +}; + +#endif + +#ifdef HAVE_CHARSET_latin2 +uchar ctype_latin2_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x01,0x10,0x01,0x10,0x01,0x01,0x10,0x10,0x01,0x01,0x01,0x01,0x10,0x01,0x01, +0x10,0x02,0x10,0x02,0x10,0x02,0x02,0x10,0x10,0x02,0x02,0x02,0x02,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin2_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xB1,0xA2,0xB3,0xA4,0xB5,0xB6,0xA7,0xA8,0xB9,0xBA,0xBB,0xBC,0xAD,0xBE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin2_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xA1,0xB2,0xA3,0xB4,0xA5,0xA6,0xB7,0xB8,0xA9,0xAA,0xAB,0xAC,0xBD,0xAE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uint16 to_uni_latin2_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, +0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, +0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, +0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +#ifdef HAVE_CHARSET_latin5 +uchar ctype_latin5_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_latin5_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0xFD,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0x69,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin5_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0xDD,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0x49,0xDE,0xFF +}; + +uint16 to_uni_latin5_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x011E,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0130,0x015E,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x011F,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x0131,0x015F,0x00FF +}; + +#endif + +#ifdef HAVE_CHARSET_latin7 +uchar ctype_latin7_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x01,0x20,0x10,0x20,0x10,0x10,0x00,0x00,0x20,0x10,0x20,0x10,0x20,0x10,0x10,0x10, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x00,0x20,0x10,0x20,0x10,0x10,0x20, +0x48,0x20,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_latin7_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xB8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin7_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uint16 to_uni_latin7_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x00A0,0x201D,0x00A2,0x00A3,0x00A4,0x201E,0x00A6,0x00A7, +0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6, +0x00B0,0x00B1,0x00B2,0x00B3,0x201C,0x00B5,0x00B6,0x00B7, +0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6, +0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112, +0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B, +0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7, +0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF, +0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113, +0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C, +0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7, +0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x2019 +}; + +#endif + +#ifdef HAVE_CHARSET_cp850 +uchar ctype_cp850_bin[] = { +0x00, +0x20,0x30,0x30,0x30,0x30,0x30,0x30,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x30,0x30, +0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x20,0x30,0x30,0x30,0x30,0x30, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x30, +0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01, +0x01,0x02,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,0x02,0x10,0x01,0x10,0x10, +0x02,0x02,0x02,0x02,0x02,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x01,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x02,0x01,0x01,0x01,0x01,0x02,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10,0x01,0x10, +0x01,0x02,0x01,0x01,0x02,0x01,0x10,0x02,0x01,0x01,0x01,0x01,0x02,0x01,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20 +}; + +uchar to_lower_cp850_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x84,0x86, +0x82,0x91,0x91,0x93,0x94,0x95,0x96,0x97,0x98,0x94,0x81,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA4,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp850_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F, +0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_cp850_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C7,0x00FC,0x00E9,0x00E2,0x00E4,0x00E0,0x00E5,0x00E7, +0x00EA,0x00EB,0x00E8,0x00EF,0x00EE,0x00EC,0x00C4,0x00C5, +0x00C9,0x00E6,0x00C6,0x00F4,0x00F6,0x00F2,0x00FB,0x00F9, +0x00FF,0x00D6,0x00DC,0x00F8,0x00A3,0x00D8,0x00D7,0x0192, +0x00E1,0x00ED,0x00F3,0x00FA,0x00F1,0x00D1,0x00AA,0x00BA, +0x00BF,0x00AE,0x00AC,0x00BD,0x00BC,0x00A1,0x00AB,0x00BB, +0x2591,0x2592,0x2593,0x2502,0x2524,0x00C1,0x00C2,0x00C0, +0x00A9,0x2563,0x2551,0x2557,0x255D,0x00A2,0x00A5,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x00E3,0x00C3, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x00A4, +0x00F0,0x00D0,0x00CA,0x00CB,0x00C8,0x0131,0x00CD,0x00CE, +0x00CF,0x2518,0x250C,0x2588,0x2584,0x00A6,0x00CC,0x2580, +0x00D3,0x00DF,0x00D4,0x00D2,0x00F5,0x00D5,0x00B5,0x00FE, +0x00DE,0x00DA,0x00DB,0x00D9,0x00FD,0x00DD,0x00AF,0x00B4, +0x00AD,0x00B1,0x2017,0x00BE,0x00B6,0x00A7,0x00F7,0x00B8, +0x00B0,0x00A8,0x00B7,0x00B9,0x00B3,0x00B2,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_cp852 +uchar ctype_cp852_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x00, +0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x02,0x01,0x01,0x01, +0x01,0x01,0x02,0x02,0x02,0x01,0x02,0x01,0x02,0x01,0x01,0x01,0x02,0x01,0x00,0x02, +0x02,0x02,0x02,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x00,0x02,0x01,0x01,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x02,0x01,0x01,0x01,0x02,0x01,0x01,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x01,0x00, +0x01,0x02,0x01,0x01,0x02,0x02,0x01,0x02,0x01,0x01,0x02,0x01,0x02,0x01,0x02,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01,0x02,0x00,0x48 +}; + +uchar to_lower_cp852_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x87,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8B,0x8B,0x8C,0xAB,0x84,0x86, +0x82,0x92,0x92,0x93,0x94,0x96,0x96,0x98,0x98,0x94,0x81,0x9C,0x9C,0x88,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAA,0xAB,0x9F,0xB8,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xA0,0x83,0xD8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD0,0xD4,0x89,0xD4,0xE5,0xA1,0x8C,0xD8,0xD9,0xDA,0xDB,0xDC,0xEE,0x85,0xDF, +0xA2,0xE1,0x93,0xE4,0xE4,0xE5,0xE7,0xE7,0xEA,0xA3,0xE8,0xFB,0xEC,0xEC,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp852_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F, +0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0xAC, +0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xAD,0xB9,0xBA,0xBB,0xBC,0xBE,0xBD,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF +}; + +uint16 to_uni_cp852_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x00C7,0x00FC,0x00E9,0x00E2,0x00E4,0x016F,0x0107,0x00E7, +0x0142,0x00EB,0x0150,0x0151,0x00EE,0x0179,0x00C4,0x0106, +0x00C9,0x0139,0x013A,0x00F4,0x00F6,0x013D,0x013E,0x015A, +0x015B,0x00D6,0x00DC,0x0164,0x0165,0x0141,0x00D7,0x010D, +0x00E1,0x00ED,0x00F3,0x00FA,0x0104,0x0105,0x017D,0x017E, +0x0118,0x0119,0x00AC,0x017A,0x010C,0x015F,0x00AB,0x00BB, +0x2591,0x2592,0x2593,0x2502,0x2524,0x00C1,0x00C2,0x011A, +0x015E,0x2563,0x2551,0x2557,0x255D,0x017B,0x017C,0x2510, +0x2514,0x2534,0x252C,0x251C,0x2500,0x253C,0x0102,0x0103, +0x255A,0x2554,0x2569,0x2566,0x2560,0x2550,0x256C,0x00A4, +0x0111,0x0110,0x010E,0x00CB,0x010F,0x0147,0x00CD,0x00CE, +0x011B,0x2518,0x250C,0x2588,0x2584,0x0162,0x016E,0x2580, +0x00D3,0x00DF,0x00D4,0x0143,0x0144,0x0148,0x0160,0x0161, +0x0154,0x00DA,0x0155,0x0170,0x00FD,0x00DD,0x0163,0x00B4, +0x00AD,0x02DD,0x02DB,0x02C7,0x02D8,0x00A7,0x00F7,0x00B8, +0x00B0,0x00A8,0x02D9,0x0171,0x0158,0x0159,0x25A0,0x00A0 +}; + +#endif + +#ifdef HAVE_CHARSET_swe7 +uchar ctype_swe7_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10, +0x01,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x20, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_swe7_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_swe7_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_swe7_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x00C9,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x00C4,0x00D6,0x00C5,0x00DC,0x005F, +0x00E9,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x00E4,0x00F6,0x00E5,0x00FC,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_geostd8 +uchar ctype_geostd8_general_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00, +0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_geostd8_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_geostd8_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar sort_order_geostd8_general_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_geostd8_general_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0000,0x2039,0x0000,0x0000,0x0000,0x0000, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x0000,0x0000,0x203A,0x0000,0x0000,0x0000,0x0000, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10F1, +0x10D7,0x10D8,0x10D9,0x10DA,0x10DB,0x10DC,0x10F2,0x10DD, +0x10DE,0x10DF,0x10E0,0x10E1,0x10E2,0x10F3,0x10E3,0x10E4, +0x10E5,0x10E6,0x10E7,0x10E8,0x10E9,0x10EA,0x10EB,0x10EC, +0x10ED,0x10EE,0x10F4,0x10EF,0x10F0,0x10F5,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x2116,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_geostd8 +uchar ctype_geostd8_bin[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x00,0x00,0x10,0x00,0x10,0x10,0x10,0x10,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00, +0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, +0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +uchar to_lower_geostd8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_geostd8_bin[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uint16 to_uni_geostd8_bin[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0000,0x2039,0x0000,0x0000,0x0000,0x0000, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x0000,0x0000,0x203A,0x0000,0x0000,0x0000,0x0000, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10F1, +0x10D7,0x10D8,0x10D9,0x10DA,0x10DB,0x10DC,0x10F2,0x10DD, +0x10DE,0x10DF,0x10E0,0x10E1,0x10E2,0x10F3,0x10E3,0x10E4, +0x10E5,0x10E6,0x10E7,0x10E8,0x10E9,0x10EA,0x10EB,0x10EC, +0x10ED,0x10EE,0x10F4,0x10EF,0x10F0,0x10F5,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x2116,0x0000,0x0000 +}; + +#endif + +#ifdef HAVE_CHARSET_latin1 +uchar ctype_latin1_spanish_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x10,0x00,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x10,0x01,0x10,0x01,0x00,0x01,0x00, +0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x02,0x10,0x02,0x00,0x02,0x01, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02 +}; + +uchar to_lower_latin1_spanish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_latin1_spanish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_latin1_spanish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x51,0x53,0x57,0x5B,0x65,0x67,0x69,0x6B,0x75,0x77,0x79,0x7B,0x7D,0x81, +0x8F,0x91,0x93,0x95,0x98,0x9A,0xA4,0xA6,0xA8,0xAA,0xAF,0xB3,0xB4,0xB5,0xB6,0xB7, +0xB8,0x41,0x51,0x53,0x57,0x5B,0x65,0x67,0x69,0x6B,0x75,0x77,0x79,0x7B,0x7D,0x81, +0x8F,0x91,0x93,0x95,0x98,0x9A,0xA4,0xA6,0xA8,0xAA,0xAF,0xB9,0xBA,0xBB,0xBC,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x53,0x5B,0x5B,0x5B,0x5B,0x6B,0x6B,0x6B,0x6B, +0x57,0x7F,0x81,0x81,0x81,0x81,0x81,0xBD,0x81,0x9A,0x9A,0x9A,0x9A,0xAA,0xB1,0x97, +0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x53,0x5B,0x5B,0x5B,0x5B,0x6B,0x6B,0x6B,0x6B, +0x57,0x7F,0x81,0x81,0x81,0x81,0x81,0xBE,0x81,0x9A,0x9A,0x9A,0x9A,0xAA,0xB1,0xAA +}; + +uint16 to_uni_latin1_spanish_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F, +0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; + +#endif + +#ifdef HAVE_CHARSET_cp1250 +uchar ctype_cp1250_polish_ci[] = { +0x00, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x28,0x28,0x28,0x28,0x20,0x20, +0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, +0x48,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x10,0x10,0x10,0x10,0x10,0x10, +0x10,0x81,0x81,0x81,0x81,0x81,0x81,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x10,0x10,0x10,0x10, +0x10,0x82,0x82,0x82,0x82,0x82,0x82,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x10,0x10,0x10,0x20, +0x20,0x20,0x10,0x20,0x10,0x10,0x10,0x10,0x20,0x10,0x01,0x10,0x01,0x01,0x01,0x01, +0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x02,0x10,0x02,0x02,0x02,0x02, +0x48,0x10,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x10,0x01,0x10,0x10,0x10,0x10,0x01, +0x10,0x10,0x10,0x02,0x10,0x10,0x10,0x10,0x10,0x02,0x02,0x10,0x01,0x10,0x02,0x02, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x10 +}; + +uchar to_lower_cp1250_polish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x9A,0x8B,0x9C,0x9D,0x9E,0x9F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, +0xA0,0xA1,0xA2,0xB3,0xA4,0xB9,0xA6,0xA7,0xA8,0xA9,0xBA,0xAB,0xAC,0xAD,0xAE,0xBF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBE,0xBD,0xBE,0xBF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xD7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + +uchar to_upper_cp1250_polish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, +0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF +}; + +uchar sort_order_cp1250_polish_ci[] = { +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0x90,0x91,0x92,0x93,0x94, +0x95,0x41,0x43,0x44,0x48,0x4B,0x4D,0x4E,0x4F,0x50,0x52,0x53,0x54,0x56,0x57,0x59, +0x5B,0x5C,0x5D,0x5F,0x62,0x64,0x66,0x67,0x68,0x69,0x6B,0x96,0x97,0x98,0x99,0x9A, +0x9B,0x9C,0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0x5F,0xA6,0x60,0x62,0x6B,0x6C, +0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0x5F,0xB1,0x60,0x62,0x6B,0x6C, +0xB2,0xB3,0xB4,0x55,0xB5,0x42,0xB6,0xB7,0xB8,0xB9,0x5F,0xBA,0xBB,0xBC,0xBD,0x6D, +0xBE,0xBF,0xC0,0x55,0xC1,0xC2,0xC3,0xC4,0xC5,0x42,0x5F,0xC6,0x54,0xC7,0x54,0x6D, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x44,0x4B,0x4C,0x4B,0x4B,0x50,0x50,0x48, +0x48,0x58,0x57,0x5A,0x59,0x59,0x59,0xC8,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0x5F, +0x5D,0x41,0x41,0x41,0x41,0x54,0x47,0x44,0x44,0x4B,0x4C,0x4B,0x4B,0x50,0x50,0x48, +0x48,0x58,0x57,0x5A,0x59,0x59,0x59,0xC9,0x5D,0x64,0x64,0x64,0x64,0x69,0x62,0xFF +}; + +uint16 to_uni_cp1250_polish_ci[] = { +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0000,0x201A,0x0000,0x201E,0x2026,0x2020,0x2021, +0x0000,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179, +0x0000,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x0000,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A, +0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7, +0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B, +0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + +#endif + +CHARSET_INFO compiled_charsets[] = { +#ifdef HAVE_CHARSET_dec8 +{ + 3,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "dec8", /* cset name */ + "dec8_swedish_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_dec8_swedish_ci, /* ctype */ + to_lower_dec8_swedish_ci, /* lower */ + to_upper_dec8_swedish_ci, /* upper */ + sort_order_dec8_swedish_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_dec8_swedish_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp850 +{ + 4,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "cp850", /* cset name */ + "cp850_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp850_general_ci, /* ctype */ + to_lower_cp850_general_ci, /* lower */ + to_upper_cp850_general_ci, /* upper */ + sort_order_cp850_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp850_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin1 +{ + 5,0,0, + MY_CS_COMPILED, + "latin1", /* cset name */ + "latin1_german1_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1_german1_ci, /* ctype */ + to_lower_latin1_german1_ci, /* lower */ + to_upper_latin1_german1_ci, /* upper */ + sort_order_latin1_german1_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin1_german1_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hp8 +{ + 6,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "hp8", /* cset name */ + "hp8_english_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_hp8_english_ci, /* ctype */ + to_lower_hp8_english_ci, /* lower */ + to_upper_hp8_english_ci, /* upper */ + sort_order_hp8_english_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_hp8_english_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8r +{ + 7,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "koi8r", /* cset name */ + "koi8r_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_koi8r_general_ci, /* ctype */ + to_lower_koi8r_general_ci, /* lower */ + to_upper_koi8r_general_ci, /* upper */ + sort_order_koi8r_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_koi8r_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin2 +{ + 9,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "latin2", /* cset name */ + "latin2_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin2_general_ci, /* ctype */ + to_lower_latin2_general_ci, /* lower */ + to_upper_latin2_general_ci, /* upper */ + sort_order_latin2_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin2_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_swe7 +{ + 10,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_NONASCII, + "swe7", /* cset name */ + "swe7_swedish_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_swe7_swedish_ci, /* ctype */ + to_lower_swe7_swedish_ci, /* lower */ + to_upper_swe7_swedish_ci, /* upper */ + sort_order_swe7_swedish_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_swe7_swedish_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_ascii +{ + 11,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_PUREASCII, + "ascii", /* cset name */ + "ascii_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ascii_general_ci, /* ctype */ + to_lower_ascii_general_ci, /* lower */ + to_upper_ascii_general_ci, /* upper */ + sort_order_ascii_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_ascii_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1251 +{ + 14,0,0, + MY_CS_COMPILED, + "cp1251", /* cset name */ + "cp1251_bulgarian_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1251_bulgarian_ci, /* ctype */ + to_lower_cp1251_bulgarian_ci, /* lower */ + to_upper_cp1251_bulgarian_ci, /* upper */ + sort_order_cp1251_bulgarian_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1251_bulgarian_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin1 +{ + 15,0,0, + MY_CS_COMPILED, + "latin1", /* cset name */ + "latin1_danish_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1_danish_ci, /* ctype */ + to_lower_latin1_danish_ci, /* lower */ + to_upper_latin1_danish_ci, /* upper */ + sort_order_latin1_danish_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin1_danish_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hebrew +{ + 16,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "hebrew", /* cset name */ + "hebrew_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_hebrew_general_ci, /* ctype */ + to_lower_hebrew_general_ci, /* lower */ + to_upper_hebrew_general_ci, /* upper */ + sort_order_hebrew_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_hebrew_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin7 +{ + 20,0,0, + MY_CS_COMPILED|MY_CS_CSSORT, + "latin7", /* cset name */ + "latin7_estonian_cs", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin7_estonian_cs, /* ctype */ + to_lower_latin7_estonian_cs, /* lower */ + to_upper_latin7_estonian_cs, /* upper */ + sort_order_latin7_estonian_cs, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin7_estonian_cs, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin2 +{ + 21,0,0, + MY_CS_COMPILED, + "latin2", /* cset name */ + "latin2_hungarian_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin2_hungarian_ci, /* ctype */ + to_lower_latin2_hungarian_ci, /* lower */ + to_upper_latin2_hungarian_ci, /* upper */ + sort_order_latin2_hungarian_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin2_hungarian_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8u +{ + 22,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "koi8u", /* cset name */ + "koi8u_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_koi8u_general_ci, /* ctype */ + to_lower_koi8u_general_ci, /* lower */ + to_upper_koi8u_general_ci, /* upper */ + sort_order_koi8u_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_koi8u_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1251 +{ + 23,0,0, + MY_CS_COMPILED, + "cp1251", /* cset name */ + "cp1251_ukrainian_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1251_ukrainian_ci, /* ctype */ + to_lower_cp1251_ukrainian_ci, /* lower */ + to_upper_cp1251_ukrainian_ci, /* upper */ + sort_order_cp1251_ukrainian_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1251_ukrainian_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_greek +{ + 25,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "greek", /* cset name */ + "greek_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_greek_general_ci, /* ctype */ + to_lower_greek_general_ci, /* lower */ + to_upper_greek_general_ci, /* upper */ + sort_order_greek_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_greek_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1250 +{ + 26,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "cp1250", /* cset name */ + "cp1250_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1250_general_ci, /* ctype */ + to_lower_cp1250_general_ci, /* lower */ + to_upper_cp1250_general_ci, /* upper */ + sort_order_cp1250_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1250_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin2 +{ + 27,0,0, + MY_CS_COMPILED, + "latin2", /* cset name */ + "latin2_croatian_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin2_croatian_ci, /* ctype */ + to_lower_latin2_croatian_ci, /* lower */ + to_upper_latin2_croatian_ci, /* upper */ + sort_order_latin2_croatian_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin2_croatian_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1257 +{ + 29,0,0, + MY_CS_COMPILED, + "cp1257", /* cset name */ + "cp1257_lithuanian_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1257_lithuanian_ci, /* ctype */ + to_lower_cp1257_lithuanian_ci, /* lower */ + to_upper_cp1257_lithuanian_ci, /* upper */ + sort_order_cp1257_lithuanian_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1257_lithuanian_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin5 +{ + 30,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "latin5", /* cset name */ + "latin5_turkish_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin5_turkish_ci, /* ctype */ + to_lower_latin5_turkish_ci, /* lower */ + to_upper_latin5_turkish_ci, /* upper */ + sort_order_latin5_turkish_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin5_turkish_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_armscii8 +{ + 32,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "armscii8", /* cset name */ + "armscii8_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_armscii8_general_ci, /* ctype */ + to_lower_armscii8_general_ci, /* lower */ + to_upper_armscii8_general_ci, /* upper */ + sort_order_armscii8_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_armscii8_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp866 +{ + 36,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "cp866", /* cset name */ + "cp866_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp866_general_ci, /* ctype */ + to_lower_cp866_general_ci, /* lower */ + to_upper_cp866_general_ci, /* upper */ + sort_order_cp866_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp866_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_keybcs2 +{ + 37,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "keybcs2", /* cset name */ + "keybcs2_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_keybcs2_general_ci, /* ctype */ + to_lower_keybcs2_general_ci, /* lower */ + to_upper_keybcs2_general_ci, /* upper */ + sort_order_keybcs2_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_keybcs2_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macce +{ + 38,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "macce", /* cset name */ + "macce_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_macce_general_ci, /* ctype */ + to_lower_macce_general_ci, /* lower */ + to_upper_macce_general_ci, /* upper */ + sort_order_macce_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_macce_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macroman +{ + 39,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "macroman", /* cset name */ + "macroman_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_macroman_general_ci, /* ctype */ + to_lower_macroman_general_ci, /* lower */ + to_upper_macroman_general_ci, /* upper */ + sort_order_macroman_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_macroman_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp852 +{ + 40,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "cp852", /* cset name */ + "cp852_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp852_general_ci, /* ctype */ + to_lower_cp852_general_ci, /* lower */ + to_upper_cp852_general_ci, /* upper */ + sort_order_cp852_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp852_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin7 +{ + 41,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "latin7", /* cset name */ + "latin7_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin7_general_ci, /* ctype */ + to_lower_latin7_general_ci, /* lower */ + to_upper_latin7_general_ci, /* upper */ + sort_order_latin7_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin7_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin7 +{ + 42,0,0, + MY_CS_COMPILED|MY_CS_CSSORT, + "latin7", /* cset name */ + "latin7_general_cs", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin7_general_cs, /* ctype */ + to_lower_latin7_general_cs, /* lower */ + to_upper_latin7_general_cs, /* upper */ + sort_order_latin7_general_cs, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin7_general_cs, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macce +{ + 43,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "macce", /* cset name */ + "macce_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_macce_bin, /* ctype */ + to_lower_macce_bin, /* lower */ + to_upper_macce_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_macce_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1250 +{ + 44,0,0, + MY_CS_COMPILED, + "cp1250", /* cset name */ + "cp1250_croatian_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1250_croatian_ci, /* ctype */ + to_lower_cp1250_croatian_ci, /* lower */ + to_upper_cp1250_croatian_ci, /* upper */ + sort_order_cp1250_croatian_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1250_croatian_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin1 +{ + 48,0,0, + MY_CS_COMPILED, + "latin1", /* cset name */ + "latin1_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1_general_ci, /* ctype */ + to_lower_latin1_general_ci, /* lower */ + to_upper_latin1_general_ci, /* upper */ + sort_order_latin1_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin1_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin1 +{ + 49,0,0, + MY_CS_COMPILED|MY_CS_CSSORT, + "latin1", /* cset name */ + "latin1_general_cs", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1_general_cs, /* ctype */ + to_lower_latin1_general_cs, /* lower */ + to_upper_latin1_general_cs, /* upper */ + sort_order_latin1_general_cs, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin1_general_cs, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1251 +{ + 50,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "cp1251", /* cset name */ + "cp1251_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1251_bin, /* ctype */ + to_lower_cp1251_bin, /* lower */ + to_upper_cp1251_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1251_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1251 +{ + 51,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "cp1251", /* cset name */ + "cp1251_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1251_general_ci, /* ctype */ + to_lower_cp1251_general_ci, /* lower */ + to_upper_cp1251_general_ci, /* upper */ + sort_order_cp1251_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1251_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1251 +{ + 52,0,0, + MY_CS_COMPILED|MY_CS_CSSORT, + "cp1251", /* cset name */ + "cp1251_general_cs", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1251_general_cs, /* ctype */ + to_lower_cp1251_general_cs, /* lower */ + to_upper_cp1251_general_cs, /* upper */ + sort_order_cp1251_general_cs, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1251_general_cs, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_macroman +{ + 53,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "macroman", /* cset name */ + "macroman_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_macroman_bin, /* ctype */ + to_lower_macroman_bin, /* lower */ + to_upper_macroman_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_macroman_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1256 +{ + 57,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "cp1256", /* cset name */ + "cp1256_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1256_general_ci, /* ctype */ + to_lower_cp1256_general_ci, /* lower */ + to_upper_cp1256_general_ci, /* upper */ + sort_order_cp1256_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1256_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1257 +{ + 58,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "cp1257", /* cset name */ + "cp1257_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1257_bin, /* ctype */ + to_lower_cp1257_bin, /* lower */ + to_upper_cp1257_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1257_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1257 +{ + 59,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "cp1257", /* cset name */ + "cp1257_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1257_general_ci, /* ctype */ + to_lower_cp1257_general_ci, /* lower */ + to_upper_cp1257_general_ci, /* upper */ + sort_order_cp1257_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1257_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_armscii8 +{ + 64,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "armscii8", /* cset name */ + "armscii8_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_armscii8_bin, /* ctype */ + to_lower_armscii8_bin, /* lower */ + to_upper_armscii8_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_armscii8_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_ascii +{ + 65,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PUREASCII, + "ascii", /* cset name */ + "ascii_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ascii_bin, /* ctype */ + to_lower_ascii_bin, /* lower */ + to_upper_ascii_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_ascii_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1250 +{ + 66,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "cp1250", /* cset name */ + "cp1250_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1250_bin, /* ctype */ + to_lower_cp1250_bin, /* lower */ + to_upper_cp1250_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1250_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1256 +{ + 67,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "cp1256", /* cset name */ + "cp1256_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1256_bin, /* ctype */ + to_lower_cp1256_bin, /* lower */ + to_upper_cp1256_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1256_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp866 +{ + 68,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "cp866", /* cset name */ + "cp866_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp866_bin, /* ctype */ + to_lower_cp866_bin, /* lower */ + to_upper_cp866_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp866_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_dec8 +{ + 69,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "dec8", /* cset name */ + "dec8_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_dec8_bin, /* ctype */ + to_lower_dec8_bin, /* lower */ + to_upper_dec8_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_dec8_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_greek +{ + 70,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "greek", /* cset name */ + "greek_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_greek_bin, /* ctype */ + to_lower_greek_bin, /* lower */ + to_upper_greek_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_greek_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hebrew +{ + 71,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "hebrew", /* cset name */ + "hebrew_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_hebrew_bin, /* ctype */ + to_lower_hebrew_bin, /* lower */ + to_upper_hebrew_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_hebrew_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_hp8 +{ + 72,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "hp8", /* cset name */ + "hp8_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_hp8_bin, /* ctype */ + to_lower_hp8_bin, /* lower */ + to_upper_hp8_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_hp8_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_keybcs2 +{ + 73,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "keybcs2", /* cset name */ + "keybcs2_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_keybcs2_bin, /* ctype */ + to_lower_keybcs2_bin, /* lower */ + to_upper_keybcs2_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_keybcs2_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8r +{ + 74,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "koi8r", /* cset name */ + "koi8r_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_koi8r_bin, /* ctype */ + to_lower_koi8r_bin, /* lower */ + to_upper_koi8r_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_koi8r_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_koi8u +{ + 75,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "koi8u", /* cset name */ + "koi8u_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_koi8u_bin, /* ctype */ + to_lower_koi8u_bin, /* lower */ + to_upper_koi8u_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_koi8u_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin2 +{ + 77,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "latin2", /* cset name */ + "latin2_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin2_bin, /* ctype */ + to_lower_latin2_bin, /* lower */ + to_upper_latin2_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin2_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin5 +{ + 78,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "latin5", /* cset name */ + "latin5_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin5_bin, /* ctype */ + to_lower_latin5_bin, /* lower */ + to_upper_latin5_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin5_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin7 +{ + 79,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "latin7", /* cset name */ + "latin7_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin7_bin, /* ctype */ + to_lower_latin7_bin, /* lower */ + to_upper_latin7_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin7_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp850 +{ + 80,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "cp850", /* cset name */ + "cp850_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp850_bin, /* ctype */ + to_lower_cp850_bin, /* lower */ + to_upper_cp850_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp850_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp852 +{ + 81,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "cp852", /* cset name */ + "cp852_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp852_bin, /* ctype */ + to_lower_cp852_bin, /* lower */ + to_upper_cp852_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp852_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_swe7 +{ + 82,0,0, + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NONASCII, + "swe7", /* cset name */ + "swe7_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_swe7_bin, /* ctype */ + to_lower_swe7_bin, /* lower */ + to_upper_swe7_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_swe7_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_geostd8 +{ + 92,0,0, + MY_CS_COMPILED|MY_CS_PRIMARY, + "geostd8", /* cset name */ + "geostd8_general_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_geostd8_general_ci, /* ctype */ + to_lower_geostd8_general_ci, /* lower */ + to_upper_geostd8_general_ci, /* upper */ + sort_order_geostd8_general_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_geostd8_general_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_geostd8 +{ + 93,0,0, + MY_CS_COMPILED|MY_CS_BINSORT, + "geostd8", /* cset name */ + "geostd8_bin", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_geostd8_bin, /* ctype */ + to_lower_geostd8_bin, /* lower */ + to_upper_geostd8_bin, /* upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_geostd8_bin, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_bin_handler, +} +, +#endif +#ifdef HAVE_CHARSET_latin1 +{ + 94,0,0, + MY_CS_COMPILED, + "latin1", /* cset name */ + "latin1_spanish_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1_spanish_ci, /* ctype */ + to_lower_latin1_spanish_ci, /* lower */ + to_upper_latin1_spanish_ci, /* upper */ + sort_order_latin1_spanish_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_latin1_spanish_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +#ifdef HAVE_CHARSET_cp1250 +{ + 99,0,0, + MY_CS_COMPILED, + "cp1250", /* cset name */ + "cp1250_polish_ci", /* coll name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_cp1250_polish_ci, /* ctype */ + to_lower_cp1250_polish_ci, /* lower */ + to_upper_cp1250_polish_ci, /* upper */ + sort_order_cp1250_polish_ci, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + to_uni_cp1250_polish_ci, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +, +#endif +{ + 0,0,0, + MY_CS_COMPILED, + NULL, /* cset name */ + NULL, /* coll name */ + NULL, /* comment */ + NULL, /* tailoging */ + NULL, /* ctype */ + NULL, /* lower */ + NULL, /* upper */ + NULL, /* sort order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* to_uni */ + NULL, /* from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state map */ + NULL, /* ident map */ + 1, /* strxfrm_multiply*/ + 1, /* caseup_multiply*/ + 1, /* casedn_multiply*/ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad_char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_8bit_simple_ci_handler, +} +}; diff --git a/externals/mysql/strings/ctype-gb2312.c b/externals/mysql/strings/ctype-gb2312.c new file mode 100644 index 0000000..1d2c962 --- /dev/null +++ b/externals/mysql/strings/ctype-gb2312.c @@ -0,0 +1,5837 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file is for Chinese EUC character sets (GB2312), and created by Miles Tsai (net-bull@126.com). + */ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. mbmaxlen_gb2312=2 + */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_gb2312 + +static uchar NEAR ctype_gb2312[257] = +{ + 0, /* For standard library */ + 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 72,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 132,132,132,132,132,132,132,132,132,132,16,16,16,16,16,16, + 16,129,129,129,129,129,129,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,16,16,16,16,16, + 16,130,130,130,130,130,130,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,32, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, +}; + +static uchar NEAR to_lower_gb2312[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR to_upper_gb2312[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR sort_order_gb2312[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '\\', ']', '[', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', 0x7E, '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +/* Support for Chinese(GB2312) characters, by Miles Tsai (net-bull@126.com) + modified by Wei He (hewei@mail.ied.ac.cn) */ + +#define isgb2312head(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xf7) +#define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe) + + +static uint ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0); +} + +static uint mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c) +{ + return (isgb2312head(c)? 2 : 1); +} + + +/* page 0 0x2121-0x2658 */ +static uint16 tab_gb2312_uni0[]={ +0x3000,0x3001,0x3002,0x30FB,0x02C9,0x02C7,0x00A8,0x3003, +0x3005,0x2015,0xFF5E,0x2016,0x2026,0x2018,0x2019,0x201C, +0x201D,0x3014,0x3015,0x3008,0x3009,0x300A,0x300B,0x300C, +0x300D,0x300E,0x300F,0x3016,0x3017,0x3010,0x3011,0x00B1, +0x00D7,0x00F7,0x2236,0x2227,0x2228,0x2211,0x220F,0x222A, +0x2229,0x2208,0x2237,0x221A,0x22A5,0x2225,0x2220,0x2312, +0x2299,0x222B,0x222E,0x2261,0x224C,0x2248,0x223D,0x221D, +0x2260,0x226E,0x226F,0x2264,0x2265,0x221E,0x2235,0x2234, +0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFF04,0x00A4, +0xFFE0,0xFFE1,0x2030,0x00A7,0x2116,0x2606,0x2605,0x25CB, +0x25CF,0x25CE,0x25C7,0x25C6,0x25A1,0x25A0,0x25B3,0x25B2, +0x203B,0x2192,0x2190,0x2191,0x2193,0x3013, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2488,0x2489,0x248A,0x248B,0x248C,0x248D,0x248E,0x248F, +0x2490,0x2491,0x2492,0x2493,0x2494,0x2495,0x2496,0x2497, +0x2498,0x2499,0x249A,0x249B,0x2474,0x2475,0x2476,0x2477, +0x2478,0x2479,0x247A,0x247B,0x247C,0x247D,0x247E,0x247F, +0x2480,0x2481,0x2482,0x2483,0x2484,0x2485,0x2486,0x2487, +0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467, +0x2468,0x2469, 0, 0,0x3220,0x3221,0x3222,0x3223, +0x3224,0x3225,0x3226,0x3227,0x3228,0x3229, 0, 0, +0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,0x2167, +0x2168,0x2169,0x216A,0x216B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFF01,0xFF02,0xFF03,0xFFE5,0xFF05,0xFF06,0xFF07,0xFF08, +0xFF09,0xFF0A,0xFF0B,0xFF0C,0xFF0D,0xFF0E,0xFF0F,0xFF10, +0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17,0xFF18, +0xFF19,0xFF1A,0xFF1B,0xFF1C,0xFF1D,0xFF1E,0xFF1F,0xFF20, +0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28, +0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,0xFF30, +0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38, +0xFF39,0xFF3A,0xFF3B,0xFF3C,0xFF3D,0xFF3E,0xFF3F,0xFF40, +0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48, +0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,0xFF50, +0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58, +0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048, +0x3049,0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050, +0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058, +0x3059,0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060, +0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068, +0x3069,0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070, +0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078, +0x3079,0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080, +0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088, +0x3089,0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090, +0x3091,0x3092,0x3093, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8, +0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0, +0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8, +0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0, +0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8, +0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0, +0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8, +0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF,0x30E0, +0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7,0x30E8, +0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF,0x30F0, +0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398, +0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0, +0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9, + 0, 0, 0, 0, 0, 0, 0, 0, +0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8, +0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0, +0x03C1,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9 +}; + +/* page 1 0x2721-0x296F */ +static uint16 tab_gb2312_uni1[]={ +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416, +0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426, +0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E, +0x042F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, +0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446, +0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E, +0x044F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0101,0x00E1,0x01CE,0x00E0,0x0113,0x00E9,0x011B,0x00E8, +0x012B,0x00ED,0x01D0,0x00EC,0x014D,0x00F3,0x01D2,0x00F2, +0x016B,0x00FA,0x01D4,0x00F9,0x01D6,0x01D8,0x01DA,0x01DC, +0x00FC,0x00EA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3105,0x3106,0x3107,0x3108, +0x3109,0x310A,0x310B,0x310C,0x310D,0x310E,0x310F,0x3110, +0x3111,0x3112,0x3113,0x3114,0x3115,0x3116,0x3117,0x3118, +0x3119,0x311A,0x311B,0x311C,0x311D,0x311E,0x311F,0x3120, +0x3121,0x3122,0x3123,0x3124,0x3125,0x3126,0x3127,0x3128, +0x3129, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2500,0x2501,0x2502,0x2503,0x2504, +0x2505,0x2506,0x2507,0x2508,0x2509,0x250A,0x250B,0x250C, +0x250D,0x250E,0x250F,0x2510,0x2511,0x2512,0x2513,0x2514, +0x2515,0x2516,0x2517,0x2518,0x2519,0x251A,0x251B,0x251C, +0x251D,0x251E,0x251F,0x2520,0x2521,0x2522,0x2523,0x2524, +0x2525,0x2526,0x2527,0x2528,0x2529,0x252A,0x252B,0x252C, +0x252D,0x252E,0x252F,0x2530,0x2531,0x2532,0x2533,0x2534, +0x2535,0x2536,0x2537,0x2538,0x2539,0x253A,0x253B,0x253C, +0x253D,0x253E,0x253F,0x2540,0x2541,0x2542,0x2543,0x2544, +0x2545,0x2546,0x2547,0x2548,0x2549,0x254A,0x254B}; + +/* page 2 0x3021-0x777E */ +static uint16 tab_gb2312_uni2[]={ +0x554A,0x963F,0x57C3,0x6328,0x54CE,0x5509,0x54C0,0x7691, +0x764C,0x853C,0x77EE,0x827E,0x788D,0x7231,0x9698,0x978D, +0x6C28,0x5B89,0x4FFA,0x6309,0x6697,0x5CB8,0x80FA,0x6848, +0x80AE,0x6602,0x76CE,0x51F9,0x6556,0x71AC,0x7FF1,0x8884, +0x50B2,0x5965,0x61CA,0x6FB3,0x82AD,0x634C,0x6252,0x53ED, +0x5427,0x7B06,0x516B,0x75A4,0x5DF4,0x62D4,0x8DCB,0x9776, +0x628A,0x8019,0x575D,0x9738,0x7F62,0x7238,0x767D,0x67CF, +0x767E,0x6446,0x4F70,0x8D25,0x62DC,0x7A17,0x6591,0x73ED, +0x642C,0x6273,0x822C,0x9881,0x677F,0x7248,0x626E,0x62CC, +0x4F34,0x74E3,0x534A,0x529E,0x7ECA,0x90A6,0x5E2E,0x6886, +0x699C,0x8180,0x7ED1,0x68D2,0x78C5,0x868C,0x9551,0x508D, +0x8C24,0x82DE,0x80DE,0x5305,0x8912,0x5265, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8584,0x96F9,0x4FDD,0x5821,0x9971,0x5B9D,0x62B1,0x62A5, +0x66B4,0x8C79,0x9C8D,0x7206,0x676F,0x7891,0x60B2,0x5351, +0x5317,0x8F88,0x80CC,0x8D1D,0x94A1,0x500D,0x72C8,0x5907, +0x60EB,0x7119,0x88AB,0x5954,0x82EF,0x672C,0x7B28,0x5D29, +0x7EF7,0x752D,0x6CF5,0x8E66,0x8FF8,0x903C,0x9F3B,0x6BD4, +0x9119,0x7B14,0x5F7C,0x78A7,0x84D6,0x853D,0x6BD5,0x6BD9, +0x6BD6,0x5E01,0x5E87,0x75F9,0x95ED,0x655D,0x5F0A,0x5FC5, +0x8F9F,0x58C1,0x81C2,0x907F,0x965B,0x97AD,0x8FB9,0x7F16, +0x8D2C,0x6241,0x4FBF,0x53D8,0x535E,0x8FA8,0x8FA9,0x8FAB, +0x904D,0x6807,0x5F6A,0x8198,0x8868,0x9CD6,0x618B,0x522B, +0x762A,0x5F6C,0x658C,0x6FD2,0x6EE8,0x5BBE,0x6448,0x5175, +0x51B0,0x67C4,0x4E19,0x79C9,0x997C,0x70B3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x75C5,0x5E76,0x73BB,0x83E0,0x64AD,0x62E8,0x94B5,0x6CE2, +0x535A,0x52C3,0x640F,0x94C2,0x7B94,0x4F2F,0x5E1B,0x8236, +0x8116,0x818A,0x6E24,0x6CCA,0x9A73,0x6355,0x535C,0x54FA, +0x8865,0x57E0,0x4E0D,0x5E03,0x6B65,0x7C3F,0x90E8,0x6016, +0x64E6,0x731C,0x88C1,0x6750,0x624D,0x8D22,0x776C,0x8E29, +0x91C7,0x5F69,0x83DC,0x8521,0x9910,0x53C2,0x8695,0x6B8B, +0x60ED,0x60E8,0x707F,0x82CD,0x8231,0x4ED3,0x6CA7,0x85CF, +0x64CD,0x7CD9,0x69FD,0x66F9,0x8349,0x5395,0x7B56,0x4FA7, +0x518C,0x6D4B,0x5C42,0x8E6D,0x63D2,0x53C9,0x832C,0x8336, +0x67E5,0x78B4,0x643D,0x5BDF,0x5C94,0x5DEE,0x8BE7,0x62C6, +0x67F4,0x8C7A,0x6400,0x63BA,0x8749,0x998B,0x8C17,0x7F20, +0x94F2,0x4EA7,0x9610,0x98A4,0x660C,0x7316, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x573A,0x5C1D,0x5E38,0x957F,0x507F,0x80A0,0x5382,0x655E, +0x7545,0x5531,0x5021,0x8D85,0x6284,0x949E,0x671D,0x5632, +0x6F6E,0x5DE2,0x5435,0x7092,0x8F66,0x626F,0x64A4,0x63A3, +0x5F7B,0x6F88,0x90F4,0x81E3,0x8FB0,0x5C18,0x6668,0x5FF1, +0x6C89,0x9648,0x8D81,0x886C,0x6491,0x79F0,0x57CE,0x6A59, +0x6210,0x5448,0x4E58,0x7A0B,0x60E9,0x6F84,0x8BDA,0x627F, +0x901E,0x9A8B,0x79E4,0x5403,0x75F4,0x6301,0x5319,0x6C60, +0x8FDF,0x5F1B,0x9A70,0x803B,0x9F7F,0x4F88,0x5C3A,0x8D64, +0x7FC5,0x65A5,0x70BD,0x5145,0x51B2,0x866B,0x5D07,0x5BA0, +0x62BD,0x916C,0x7574,0x8E0C,0x7A20,0x6101,0x7B79,0x4EC7, +0x7EF8,0x7785,0x4E11,0x81ED,0x521D,0x51FA,0x6A71,0x53A8, +0x8E87,0x9504,0x96CF,0x6EC1,0x9664,0x695A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7840,0x50A8,0x77D7,0x6410,0x89E6,0x5904,0x63E3,0x5DDD, +0x7A7F,0x693D,0x4F20,0x8239,0x5598,0x4E32,0x75AE,0x7A97, +0x5E62,0x5E8A,0x95EF,0x521B,0x5439,0x708A,0x6376,0x9524, +0x5782,0x6625,0x693F,0x9187,0x5507,0x6DF3,0x7EAF,0x8822, +0x6233,0x7EF0,0x75B5,0x8328,0x78C1,0x96CC,0x8F9E,0x6148, +0x74F7,0x8BCD,0x6B64,0x523A,0x8D50,0x6B21,0x806A,0x8471, +0x56F1,0x5306,0x4ECE,0x4E1B,0x51D1,0x7C97,0x918B,0x7C07, +0x4FC3,0x8E7F,0x7BE1,0x7A9C,0x6467,0x5D14,0x50AC,0x8106, +0x7601,0x7CB9,0x6DEC,0x7FE0,0x6751,0x5B58,0x5BF8,0x78CB, +0x64AE,0x6413,0x63AA,0x632B,0x9519,0x642D,0x8FBE,0x7B54, +0x7629,0x6253,0x5927,0x5446,0x6B79,0x50A3,0x6234,0x5E26, +0x6B86,0x4EE3,0x8D37,0x888B,0x5F85,0x902E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6020,0x803D,0x62C5,0x4E39,0x5355,0x90F8,0x63B8,0x80C6, +0x65E6,0x6C2E,0x4F46,0x60EE,0x6DE1,0x8BDE,0x5F39,0x86CB, +0x5F53,0x6321,0x515A,0x8361,0x6863,0x5200,0x6363,0x8E48, +0x5012,0x5C9B,0x7977,0x5BFC,0x5230,0x7A3B,0x60BC,0x9053, +0x76D7,0x5FB7,0x5F97,0x7684,0x8E6C,0x706F,0x767B,0x7B49, +0x77AA,0x51F3,0x9093,0x5824,0x4F4E,0x6EF4,0x8FEA,0x654C, +0x7B1B,0x72C4,0x6DA4,0x7FDF,0x5AE1,0x62B5,0x5E95,0x5730, +0x8482,0x7B2C,0x5E1D,0x5F1F,0x9012,0x7F14,0x98A0,0x6382, +0x6EC7,0x7898,0x70B9,0x5178,0x975B,0x57AB,0x7535,0x4F43, +0x7538,0x5E97,0x60E6,0x5960,0x6DC0,0x6BBF,0x7889,0x53FC, +0x96D5,0x51CB,0x5201,0x6389,0x540A,0x9493,0x8C03,0x8DCC, +0x7239,0x789F,0x8776,0x8FED,0x8C0D,0x53E0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4E01,0x76EF,0x53EE,0x9489,0x9876,0x9F0E,0x952D,0x5B9A, +0x8BA2,0x4E22,0x4E1C,0x51AC,0x8463,0x61C2,0x52A8,0x680B, +0x4F97,0x606B,0x51BB,0x6D1E,0x515C,0x6296,0x6597,0x9661, +0x8C46,0x9017,0x75D8,0x90FD,0x7763,0x6BD2,0x728A,0x72EC, +0x8BFB,0x5835,0x7779,0x8D4C,0x675C,0x9540,0x809A,0x5EA6, +0x6E21,0x5992,0x7AEF,0x77ED,0x953B,0x6BB5,0x65AD,0x7F0E, +0x5806,0x5151,0x961F,0x5BF9,0x58A9,0x5428,0x8E72,0x6566, +0x987F,0x56E4,0x949D,0x76FE,0x9041,0x6387,0x54C6,0x591A, +0x593A,0x579B,0x8EB2,0x6735,0x8DFA,0x8235,0x5241,0x60F0, +0x5815,0x86FE,0x5CE8,0x9E45,0x4FC4,0x989D,0x8BB9,0x5A25, +0x6076,0x5384,0x627C,0x904F,0x9102,0x997F,0x6069,0x800C, +0x513F,0x8033,0x5C14,0x9975,0x6D31,0x4E8C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8D30,0x53D1,0x7F5A,0x7B4F,0x4F10,0x4E4F,0x9600,0x6CD5, +0x73D0,0x85E9,0x5E06,0x756A,0x7FFB,0x6A0A,0x77FE,0x9492, +0x7E41,0x51E1,0x70E6,0x53CD,0x8FD4,0x8303,0x8D29,0x72AF, +0x996D,0x6CDB,0x574A,0x82B3,0x65B9,0x80AA,0x623F,0x9632, +0x59A8,0x4EFF,0x8BBF,0x7EBA,0x653E,0x83F2,0x975E,0x5561, +0x98DE,0x80A5,0x532A,0x8BFD,0x5420,0x80BA,0x5E9F,0x6CB8, +0x8D39,0x82AC,0x915A,0x5429,0x6C1B,0x5206,0x7EB7,0x575F, +0x711A,0x6C7E,0x7C89,0x594B,0x4EFD,0x5FFF,0x6124,0x7CAA, +0x4E30,0x5C01,0x67AB,0x8702,0x5CF0,0x950B,0x98CE,0x75AF, +0x70FD,0x9022,0x51AF,0x7F1D,0x8BBD,0x5949,0x51E4,0x4F5B, +0x5426,0x592B,0x6577,0x80A4,0x5B75,0x6276,0x62C2,0x8F90, +0x5E45,0x6C1F,0x7B26,0x4F0F,0x4FD8,0x670D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6D6E,0x6DAA,0x798F,0x88B1,0x5F17,0x752B,0x629A,0x8F85, +0x4FEF,0x91DC,0x65A7,0x812F,0x8151,0x5E9C,0x8150,0x8D74, +0x526F,0x8986,0x8D4B,0x590D,0x5085,0x4ED8,0x961C,0x7236, +0x8179,0x8D1F,0x5BCC,0x8BA3,0x9644,0x5987,0x7F1A,0x5490, +0x5676,0x560E,0x8BE5,0x6539,0x6982,0x9499,0x76D6,0x6E89, +0x5E72,0x7518,0x6746,0x67D1,0x7AFF,0x809D,0x8D76,0x611F, +0x79C6,0x6562,0x8D63,0x5188,0x521A,0x94A2,0x7F38,0x809B, +0x7EB2,0x5C97,0x6E2F,0x6760,0x7BD9,0x768B,0x9AD8,0x818F, +0x7F94,0x7CD5,0x641E,0x9550,0x7A3F,0x544A,0x54E5,0x6B4C, +0x6401,0x6208,0x9E3D,0x80F3,0x7599,0x5272,0x9769,0x845B, +0x683C,0x86E4,0x9601,0x9694,0x94EC,0x4E2A,0x5404,0x7ED9, +0x6839,0x8DDF,0x8015,0x66F4,0x5E9A,0x7FB9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x57C2,0x803F,0x6897,0x5DE5,0x653B,0x529F,0x606D,0x9F9A, +0x4F9B,0x8EAC,0x516C,0x5BAB,0x5F13,0x5DE9,0x6C5E,0x62F1, +0x8D21,0x5171,0x94A9,0x52FE,0x6C9F,0x82DF,0x72D7,0x57A2, +0x6784,0x8D2D,0x591F,0x8F9C,0x83C7,0x5495,0x7B8D,0x4F30, +0x6CBD,0x5B64,0x59D1,0x9F13,0x53E4,0x86CA,0x9AA8,0x8C37, +0x80A1,0x6545,0x987E,0x56FA,0x96C7,0x522E,0x74DC,0x5250, +0x5BE1,0x6302,0x8902,0x4E56,0x62D0,0x602A,0x68FA,0x5173, +0x5B98,0x51A0,0x89C2,0x7BA1,0x9986,0x7F50,0x60EF,0x704C, +0x8D2F,0x5149,0x5E7F,0x901B,0x7470,0x89C4,0x572D,0x7845, +0x5F52,0x9F9F,0x95FA,0x8F68,0x9B3C,0x8BE1,0x7678,0x6842, +0x67DC,0x8DEA,0x8D35,0x523D,0x8F8A,0x6EDA,0x68CD,0x9505, +0x90ED,0x56FD,0x679C,0x88F9,0x8FC7,0x54C8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9AB8,0x5B69,0x6D77,0x6C26,0x4EA5,0x5BB3,0x9A87,0x9163, +0x61A8,0x90AF,0x97E9,0x542B,0x6DB5,0x5BD2,0x51FD,0x558A, +0x7F55,0x7FF0,0x64BC,0x634D,0x65F1,0x61BE,0x608D,0x710A, +0x6C57,0x6C49,0x592F,0x676D,0x822A,0x58D5,0x568E,0x8C6A, +0x6BEB,0x90DD,0x597D,0x8017,0x53F7,0x6D69,0x5475,0x559D, +0x8377,0x83CF,0x6838,0x79BE,0x548C,0x4F55,0x5408,0x76D2, +0x8C89,0x9602,0x6CB3,0x6DB8,0x8D6B,0x8910,0x9E64,0x8D3A, +0x563F,0x9ED1,0x75D5,0x5F88,0x72E0,0x6068,0x54FC,0x4EA8, +0x6A2A,0x8861,0x6052,0x8F70,0x54C4,0x70D8,0x8679,0x9E3F, +0x6D2A,0x5B8F,0x5F18,0x7EA2,0x5589,0x4FAF,0x7334,0x543C, +0x539A,0x5019,0x540E,0x547C,0x4E4E,0x5FFD,0x745A,0x58F6, +0x846B,0x80E1,0x8774,0x72D0,0x7CCA,0x6E56, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F27,0x864E,0x552C,0x62A4,0x4E92,0x6CAA,0x6237,0x82B1, +0x54D7,0x534E,0x733E,0x6ED1,0x753B,0x5212,0x5316,0x8BDD, +0x69D0,0x5F8A,0x6000,0x6DEE,0x574F,0x6B22,0x73AF,0x6853, +0x8FD8,0x7F13,0x6362,0x60A3,0x5524,0x75EA,0x8C62,0x7115, +0x6DA3,0x5BA6,0x5E7B,0x8352,0x614C,0x9EC4,0x78FA,0x8757, +0x7C27,0x7687,0x51F0,0x60F6,0x714C,0x6643,0x5E4C,0x604D, +0x8C0E,0x7070,0x6325,0x8F89,0x5FBD,0x6062,0x86D4,0x56DE, +0x6BC1,0x6094,0x6167,0x5349,0x60E0,0x6666,0x8D3F,0x79FD, +0x4F1A,0x70E9,0x6C47,0x8BB3,0x8BF2,0x7ED8,0x8364,0x660F, +0x5A5A,0x9B42,0x6D51,0x6DF7,0x8C41,0x6D3B,0x4F19,0x706B, +0x83B7,0x6216,0x60D1,0x970D,0x8D27,0x7978,0x51FB,0x573E, +0x57FA,0x673A,0x7578,0x7A3D,0x79EF,0x7B95, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x808C,0x9965,0x8FF9,0x6FC0,0x8BA5,0x9E21,0x59EC,0x7EE9, +0x7F09,0x5409,0x6781,0x68D8,0x8F91,0x7C4D,0x96C6,0x53CA, +0x6025,0x75BE,0x6C72,0x5373,0x5AC9,0x7EA7,0x6324,0x51E0, +0x810A,0x5DF1,0x84DF,0x6280,0x5180,0x5B63,0x4F0E,0x796D, +0x5242,0x60B8,0x6D4E,0x5BC4,0x5BC2,0x8BA1,0x8BB0,0x65E2, +0x5FCC,0x9645,0x5993,0x7EE7,0x7EAA,0x5609,0x67B7,0x5939, +0x4F73,0x5BB6,0x52A0,0x835A,0x988A,0x8D3E,0x7532,0x94BE, +0x5047,0x7A3C,0x4EF7,0x67B6,0x9A7E,0x5AC1,0x6B7C,0x76D1, +0x575A,0x5C16,0x7B3A,0x95F4,0x714E,0x517C,0x80A9,0x8270, +0x5978,0x7F04,0x8327,0x68C0,0x67EC,0x78B1,0x7877,0x62E3, +0x6361,0x7B80,0x4FED,0x526A,0x51CF,0x8350,0x69DB,0x9274, +0x8DF5,0x8D31,0x89C1,0x952E,0x7BAD,0x4EF6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5065,0x8230,0x5251,0x996F,0x6E10,0x6E85,0x6DA7,0x5EFA, +0x50F5,0x59DC,0x5C06,0x6D46,0x6C5F,0x7586,0x848B,0x6868, +0x5956,0x8BB2,0x5320,0x9171,0x964D,0x8549,0x6912,0x7901, +0x7126,0x80F6,0x4EA4,0x90CA,0x6D47,0x9A84,0x5A07,0x56BC, +0x6405,0x94F0,0x77EB,0x4FA5,0x811A,0x72E1,0x89D2,0x997A, +0x7F34,0x7EDE,0x527F,0x6559,0x9175,0x8F7F,0x8F83,0x53EB, +0x7A96,0x63ED,0x63A5,0x7686,0x79F8,0x8857,0x9636,0x622A, +0x52AB,0x8282,0x6854,0x6770,0x6377,0x776B,0x7AED,0x6D01, +0x7ED3,0x89E3,0x59D0,0x6212,0x85C9,0x82A5,0x754C,0x501F, +0x4ECB,0x75A5,0x8BEB,0x5C4A,0x5DFE,0x7B4B,0x65A4,0x91D1, +0x4ECA,0x6D25,0x895F,0x7D27,0x9526,0x4EC5,0x8C28,0x8FDB, +0x9773,0x664B,0x7981,0x8FD1,0x70EC,0x6D78, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5C3D,0x52B2,0x8346,0x5162,0x830E,0x775B,0x6676,0x9CB8, +0x4EAC,0x60CA,0x7CBE,0x7CB3,0x7ECF,0x4E95,0x8B66,0x666F, +0x9888,0x9759,0x5883,0x656C,0x955C,0x5F84,0x75C9,0x9756, +0x7ADF,0x7ADE,0x51C0,0x70AF,0x7A98,0x63EA,0x7A76,0x7EA0, +0x7396,0x97ED,0x4E45,0x7078,0x4E5D,0x9152,0x53A9,0x6551, +0x65E7,0x81FC,0x8205,0x548E,0x5C31,0x759A,0x97A0,0x62D8, +0x72D9,0x75BD,0x5C45,0x9A79,0x83CA,0x5C40,0x5480,0x77E9, +0x4E3E,0x6CAE,0x805A,0x62D2,0x636E,0x5DE8,0x5177,0x8DDD, +0x8E1E,0x952F,0x4FF1,0x53E5,0x60E7,0x70AC,0x5267,0x6350, +0x9E43,0x5A1F,0x5026,0x7737,0x5377,0x7EE2,0x6485,0x652B, +0x6289,0x6398,0x5014,0x7235,0x89C9,0x51B3,0x8BC0,0x7EDD, +0x5747,0x83CC,0x94A7,0x519B,0x541B,0x5CFB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4FCA,0x7AE3,0x6D5A,0x90E1,0x9A8F,0x5580,0x5496,0x5361, +0x54AF,0x5F00,0x63E9,0x6977,0x51EF,0x6168,0x520A,0x582A, +0x52D8,0x574E,0x780D,0x770B,0x5EB7,0x6177,0x7CE0,0x625B, +0x6297,0x4EA2,0x7095,0x8003,0x62F7,0x70E4,0x9760,0x5777, +0x82DB,0x67EF,0x68F5,0x78D5,0x9897,0x79D1,0x58F3,0x54B3, +0x53EF,0x6E34,0x514B,0x523B,0x5BA2,0x8BFE,0x80AF,0x5543, +0x57A6,0x6073,0x5751,0x542D,0x7A7A,0x6050,0x5B54,0x63A7, +0x62A0,0x53E3,0x6263,0x5BC7,0x67AF,0x54ED,0x7A9F,0x82E6, +0x9177,0x5E93,0x88E4,0x5938,0x57AE,0x630E,0x8DE8,0x80EF, +0x5757,0x7B77,0x4FA9,0x5FEB,0x5BBD,0x6B3E,0x5321,0x7B50, +0x72C2,0x6846,0x77FF,0x7736,0x65F7,0x51B5,0x4E8F,0x76D4, +0x5CBF,0x7AA5,0x8475,0x594E,0x9B41,0x5080, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9988,0x6127,0x6E83,0x5764,0x6606,0x6346,0x56F0,0x62EC, +0x6269,0x5ED3,0x9614,0x5783,0x62C9,0x5587,0x8721,0x814A, +0x8FA3,0x5566,0x83B1,0x6765,0x8D56,0x84DD,0x5A6A,0x680F, +0x62E6,0x7BEE,0x9611,0x5170,0x6F9C,0x8C30,0x63FD,0x89C8, +0x61D2,0x7F06,0x70C2,0x6EE5,0x7405,0x6994,0x72FC,0x5ECA, +0x90CE,0x6717,0x6D6A,0x635E,0x52B3,0x7262,0x8001,0x4F6C, +0x59E5,0x916A,0x70D9,0x6D9D,0x52D2,0x4E50,0x96F7,0x956D, +0x857E,0x78CA,0x7D2F,0x5121,0x5792,0x64C2,0x808B,0x7C7B, +0x6CEA,0x68F1,0x695E,0x51B7,0x5398,0x68A8,0x7281,0x9ECE, +0x7BF1,0x72F8,0x79BB,0x6F13,0x7406,0x674E,0x91CC,0x9CA4, +0x793C,0x8389,0x8354,0x540F,0x6817,0x4E3D,0x5389,0x52B1, +0x783E,0x5386,0x5229,0x5088,0x4F8B,0x4FD0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x75E2,0x7ACB,0x7C92,0x6CA5,0x96B6,0x529B,0x7483,0x54E9, +0x4FE9,0x8054,0x83B2,0x8FDE,0x9570,0x5EC9,0x601C,0x6D9F, +0x5E18,0x655B,0x8138,0x94FE,0x604B,0x70BC,0x7EC3,0x7CAE, +0x51C9,0x6881,0x7CB1,0x826F,0x4E24,0x8F86,0x91CF,0x667E, +0x4EAE,0x8C05,0x64A9,0x804A,0x50DA,0x7597,0x71CE,0x5BE5, +0x8FBD,0x6F66,0x4E86,0x6482,0x9563,0x5ED6,0x6599,0x5217, +0x88C2,0x70C8,0x52A3,0x730E,0x7433,0x6797,0x78F7,0x9716, +0x4E34,0x90BB,0x9CDE,0x6DCB,0x51DB,0x8D41,0x541D,0x62CE, +0x73B2,0x83F1,0x96F6,0x9F84,0x94C3,0x4F36,0x7F9A,0x51CC, +0x7075,0x9675,0x5CAD,0x9886,0x53E6,0x4EE4,0x6E9C,0x7409, +0x69B4,0x786B,0x998F,0x7559,0x5218,0x7624,0x6D41,0x67F3, +0x516D,0x9F99,0x804B,0x5499,0x7B3C,0x7ABF, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9686,0x5784,0x62E2,0x9647,0x697C,0x5A04,0x6402,0x7BD3, +0x6F0F,0x964B,0x82A6,0x5362,0x9885,0x5E90,0x7089,0x63B3, +0x5364,0x864F,0x9C81,0x9E93,0x788C,0x9732,0x8DEF,0x8D42, +0x9E7F,0x6F5E,0x7984,0x5F55,0x9646,0x622E,0x9A74,0x5415, +0x94DD,0x4FA3,0x65C5,0x5C65,0x5C61,0x7F15,0x8651,0x6C2F, +0x5F8B,0x7387,0x6EE4,0x7EFF,0x5CE6,0x631B,0x5B6A,0x6EE6, +0x5375,0x4E71,0x63A0,0x7565,0x62A1,0x8F6E,0x4F26,0x4ED1, +0x6CA6,0x7EB6,0x8BBA,0x841D,0x87BA,0x7F57,0x903B,0x9523, +0x7BA9,0x9AA1,0x88F8,0x843D,0x6D1B,0x9A86,0x7EDC,0x5988, +0x9EBB,0x739B,0x7801,0x8682,0x9A6C,0x9A82,0x561B,0x5417, +0x57CB,0x4E70,0x9EA6,0x5356,0x8FC8,0x8109,0x7792,0x9992, +0x86EE,0x6EE1,0x8513,0x66FC,0x6162,0x6F2B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8C29,0x8292,0x832B,0x76F2,0x6C13,0x5FD9,0x83BD,0x732B, +0x8305,0x951A,0x6BDB,0x77DB,0x94C6,0x536F,0x8302,0x5192, +0x5E3D,0x8C8C,0x8D38,0x4E48,0x73AB,0x679A,0x6885,0x9176, +0x9709,0x7164,0x6CA1,0x7709,0x5A92,0x9541,0x6BCF,0x7F8E, +0x6627,0x5BD0,0x59B9,0x5A9A,0x95E8,0x95F7,0x4EEC,0x840C, +0x8499,0x6AAC,0x76DF,0x9530,0x731B,0x68A6,0x5B5F,0x772F, +0x919A,0x9761,0x7CDC,0x8FF7,0x8C1C,0x5F25,0x7C73,0x79D8, +0x89C5,0x6CCC,0x871C,0x5BC6,0x5E42,0x68C9,0x7720,0x7EF5, +0x5195,0x514D,0x52C9,0x5A29,0x7F05,0x9762,0x82D7,0x63CF, +0x7784,0x85D0,0x79D2,0x6E3A,0x5E99,0x5999,0x8511,0x706D, +0x6C11,0x62BF,0x76BF,0x654F,0x60AF,0x95FD,0x660E,0x879F, +0x9E23,0x94ED,0x540D,0x547D,0x8C2C,0x6478, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6479,0x8611,0x6A21,0x819C,0x78E8,0x6469,0x9B54,0x62B9, +0x672B,0x83AB,0x58A8,0x9ED8,0x6CAB,0x6F20,0x5BDE,0x964C, +0x8C0B,0x725F,0x67D0,0x62C7,0x7261,0x4EA9,0x59C6,0x6BCD, +0x5893,0x66AE,0x5E55,0x52DF,0x6155,0x6728,0x76EE,0x7766, +0x7267,0x7A46,0x62FF,0x54EA,0x5450,0x94A0,0x90A3,0x5A1C, +0x7EB3,0x6C16,0x4E43,0x5976,0x8010,0x5948,0x5357,0x7537, +0x96BE,0x56CA,0x6320,0x8111,0x607C,0x95F9,0x6DD6,0x5462, +0x9981,0x5185,0x5AE9,0x80FD,0x59AE,0x9713,0x502A,0x6CE5, +0x5C3C,0x62DF,0x4F60,0x533F,0x817B,0x9006,0x6EBA,0x852B, +0x62C8,0x5E74,0x78BE,0x64B5,0x637B,0x5FF5,0x5A18,0x917F, +0x9E1F,0x5C3F,0x634F,0x8042,0x5B7D,0x556E,0x954A,0x954D, +0x6D85,0x60A8,0x67E0,0x72DE,0x51DD,0x5B81, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x62E7,0x6CDE,0x725B,0x626D,0x94AE,0x7EBD,0x8113,0x6D53, +0x519C,0x5F04,0x5974,0x52AA,0x6012,0x5973,0x6696,0x8650, +0x759F,0x632A,0x61E6,0x7CEF,0x8BFA,0x54E6,0x6B27,0x9E25, +0x6BB4,0x85D5,0x5455,0x5076,0x6CA4,0x556A,0x8DB4,0x722C, +0x5E15,0x6015,0x7436,0x62CD,0x6392,0x724C,0x5F98,0x6E43, +0x6D3E,0x6500,0x6F58,0x76D8,0x78D0,0x76FC,0x7554,0x5224, +0x53DB,0x4E53,0x5E9E,0x65C1,0x802A,0x80D6,0x629B,0x5486, +0x5228,0x70AE,0x888D,0x8DD1,0x6CE1,0x5478,0x80DA,0x57F9, +0x88F4,0x8D54,0x966A,0x914D,0x4F69,0x6C9B,0x55B7,0x76C6, +0x7830,0x62A8,0x70F9,0x6F8E,0x5F6D,0x84EC,0x68DA,0x787C, +0x7BF7,0x81A8,0x670B,0x9E4F,0x6367,0x78B0,0x576F,0x7812, +0x9739,0x6279,0x62AB,0x5288,0x7435,0x6BD7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5564,0x813E,0x75B2,0x76AE,0x5339,0x75DE,0x50FB,0x5C41, +0x8B6C,0x7BC7,0x504F,0x7247,0x9A97,0x98D8,0x6F02,0x74E2, +0x7968,0x6487,0x77A5,0x62FC,0x9891,0x8D2B,0x54C1,0x8058, +0x4E52,0x576A,0x82F9,0x840D,0x5E73,0x51ED,0x74F6,0x8BC4, +0x5C4F,0x5761,0x6CFC,0x9887,0x5A46,0x7834,0x9B44,0x8FEB, +0x7C95,0x5256,0x6251,0x94FA,0x4EC6,0x8386,0x8461,0x83E9, +0x84B2,0x57D4,0x6734,0x5703,0x666E,0x6D66,0x8C31,0x66DD, +0x7011,0x671F,0x6B3A,0x6816,0x621A,0x59BB,0x4E03,0x51C4, +0x6F06,0x67D2,0x6C8F,0x5176,0x68CB,0x5947,0x6B67,0x7566, +0x5D0E,0x8110,0x9F50,0x65D7,0x7948,0x7941,0x9A91,0x8D77, +0x5C82,0x4E5E,0x4F01,0x542F,0x5951,0x780C,0x5668,0x6C14, +0x8FC4,0x5F03,0x6C7D,0x6CE3,0x8BAB,0x6390, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6070,0x6D3D,0x7275,0x6266,0x948E,0x94C5,0x5343,0x8FC1, +0x7B7E,0x4EDF,0x8C26,0x4E7E,0x9ED4,0x94B1,0x94B3,0x524D, +0x6F5C,0x9063,0x6D45,0x8C34,0x5811,0x5D4C,0x6B20,0x6B49, +0x67AA,0x545B,0x8154,0x7F8C,0x5899,0x8537,0x5F3A,0x62A2, +0x6A47,0x9539,0x6572,0x6084,0x6865,0x77A7,0x4E54,0x4FA8, +0x5DE7,0x9798,0x64AC,0x7FD8,0x5CED,0x4FCF,0x7A8D,0x5207, +0x8304,0x4E14,0x602F,0x7A83,0x94A6,0x4FB5,0x4EB2,0x79E6, +0x7434,0x52E4,0x82B9,0x64D2,0x79BD,0x5BDD,0x6C81,0x9752, +0x8F7B,0x6C22,0x503E,0x537F,0x6E05,0x64CE,0x6674,0x6C30, +0x60C5,0x9877,0x8BF7,0x5E86,0x743C,0x7A77,0x79CB,0x4E18, +0x90B1,0x7403,0x6C42,0x56DA,0x914B,0x6CC5,0x8D8B,0x533A, +0x86C6,0x66F2,0x8EAF,0x5C48,0x9A71,0x6E20, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x53D6,0x5A36,0x9F8B,0x8DA3,0x53BB,0x5708,0x98A7,0x6743, +0x919B,0x6CC9,0x5168,0x75CA,0x62F3,0x72AC,0x5238,0x529D, +0x7F3A,0x7094,0x7638,0x5374,0x9E4A,0x69B7,0x786E,0x96C0, +0x88D9,0x7FA4,0x7136,0x71C3,0x5189,0x67D3,0x74E4,0x58E4, +0x6518,0x56B7,0x8BA9,0x9976,0x6270,0x7ED5,0x60F9,0x70ED, +0x58EC,0x4EC1,0x4EBA,0x5FCD,0x97E7,0x4EFB,0x8BA4,0x5203, +0x598A,0x7EAB,0x6254,0x4ECD,0x65E5,0x620E,0x8338,0x84C9, +0x8363,0x878D,0x7194,0x6EB6,0x5BB9,0x7ED2,0x5197,0x63C9, +0x67D4,0x8089,0x8339,0x8815,0x5112,0x5B7A,0x5982,0x8FB1, +0x4E73,0x6C5D,0x5165,0x8925,0x8F6F,0x962E,0x854A,0x745E, +0x9510,0x95F0,0x6DA6,0x82E5,0x5F31,0x6492,0x6D12,0x8428, +0x816E,0x9CC3,0x585E,0x8D5B,0x4E09,0x53C1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4F1E,0x6563,0x6851,0x55D3,0x4E27,0x6414,0x9A9A,0x626B, +0x5AC2,0x745F,0x8272,0x6DA9,0x68EE,0x50E7,0x838E,0x7802, +0x6740,0x5239,0x6C99,0x7EB1,0x50BB,0x5565,0x715E,0x7B5B, +0x6652,0x73CA,0x82EB,0x6749,0x5C71,0x5220,0x717D,0x886B, +0x95EA,0x9655,0x64C5,0x8D61,0x81B3,0x5584,0x6C55,0x6247, +0x7F2E,0x5892,0x4F24,0x5546,0x8D4F,0x664C,0x4E0A,0x5C1A, +0x88F3,0x68A2,0x634E,0x7A0D,0x70E7,0x828D,0x52FA,0x97F6, +0x5C11,0x54E8,0x90B5,0x7ECD,0x5962,0x8D4A,0x86C7,0x820C, +0x820D,0x8D66,0x6444,0x5C04,0x6151,0x6D89,0x793E,0x8BBE, +0x7837,0x7533,0x547B,0x4F38,0x8EAB,0x6DF1,0x5A20,0x7EC5, +0x795E,0x6C88,0x5BA1,0x5A76,0x751A,0x80BE,0x614E,0x6E17, +0x58F0,0x751F,0x7525,0x7272,0x5347,0x7EF3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7701,0x76DB,0x5269,0x80DC,0x5723,0x5E08,0x5931,0x72EE, +0x65BD,0x6E7F,0x8BD7,0x5C38,0x8671,0x5341,0x77F3,0x62FE, +0x65F6,0x4EC0,0x98DF,0x8680,0x5B9E,0x8BC6,0x53F2,0x77E2, +0x4F7F,0x5C4E,0x9A76,0x59CB,0x5F0F,0x793A,0x58EB,0x4E16, +0x67FF,0x4E8B,0x62ED,0x8A93,0x901D,0x52BF,0x662F,0x55DC, +0x566C,0x9002,0x4ED5,0x4F8D,0x91CA,0x9970,0x6C0F,0x5E02, +0x6043,0x5BA4,0x89C6,0x8BD5,0x6536,0x624B,0x9996,0x5B88, +0x5BFF,0x6388,0x552E,0x53D7,0x7626,0x517D,0x852C,0x67A2, +0x68B3,0x6B8A,0x6292,0x8F93,0x53D4,0x8212,0x6DD1,0x758F, +0x4E66,0x8D4E,0x5B70,0x719F,0x85AF,0x6691,0x66D9,0x7F72, +0x8700,0x9ECD,0x9F20,0x5C5E,0x672F,0x8FF0,0x6811,0x675F, +0x620D,0x7AD6,0x5885,0x5EB6,0x6570,0x6F31, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6055,0x5237,0x800D,0x6454,0x8870,0x7529,0x5E05,0x6813, +0x62F4,0x971C,0x53CC,0x723D,0x8C01,0x6C34,0x7761,0x7A0E, +0x542E,0x77AC,0x987A,0x821C,0x8BF4,0x7855,0x6714,0x70C1, +0x65AF,0x6495,0x5636,0x601D,0x79C1,0x53F8,0x4E1D,0x6B7B, +0x8086,0x5BFA,0x55E3,0x56DB,0x4F3A,0x4F3C,0x9972,0x5DF3, +0x677E,0x8038,0x6002,0x9882,0x9001,0x5B8B,0x8BBC,0x8BF5, +0x641C,0x8258,0x64DE,0x55FD,0x82CF,0x9165,0x4FD7,0x7D20, +0x901F,0x7C9F,0x50F3,0x5851,0x6EAF,0x5BBF,0x8BC9,0x8083, +0x9178,0x849C,0x7B97,0x867D,0x968B,0x968F,0x7EE5,0x9AD3, +0x788E,0x5C81,0x7A57,0x9042,0x96A7,0x795F,0x5B59,0x635F, +0x7B0B,0x84D1,0x68AD,0x5506,0x7F29,0x7410,0x7D22,0x9501, +0x6240,0x584C,0x4ED6,0x5B83,0x5979,0x5854, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x736D,0x631E,0x8E4B,0x8E0F,0x80CE,0x82D4,0x62AC,0x53F0, +0x6CF0,0x915E,0x592A,0x6001,0x6C70,0x574D,0x644A,0x8D2A, +0x762B,0x6EE9,0x575B,0x6A80,0x75F0,0x6F6D,0x8C2D,0x8C08, +0x5766,0x6BEF,0x8892,0x78B3,0x63A2,0x53F9,0x70AD,0x6C64, +0x5858,0x642A,0x5802,0x68E0,0x819B,0x5510,0x7CD6,0x5018, +0x8EBA,0x6DCC,0x8D9F,0x70EB,0x638F,0x6D9B,0x6ED4,0x7EE6, +0x8404,0x6843,0x9003,0x6DD8,0x9676,0x8BA8,0x5957,0x7279, +0x85E4,0x817E,0x75BC,0x8A8A,0x68AF,0x5254,0x8E22,0x9511, +0x63D0,0x9898,0x8E44,0x557C,0x4F53,0x66FF,0x568F,0x60D5, +0x6D95,0x5243,0x5C49,0x5929,0x6DFB,0x586B,0x7530,0x751C, +0x606C,0x8214,0x8146,0x6311,0x6761,0x8FE2,0x773A,0x8DF3, +0x8D34,0x94C1,0x5E16,0x5385,0x542C,0x70C3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C40,0x5EF7,0x505C,0x4EAD,0x5EAD,0x633A,0x8247,0x901A, +0x6850,0x916E,0x77B3,0x540C,0x94DC,0x5F64,0x7AE5,0x6876, +0x6345,0x7B52,0x7EDF,0x75DB,0x5077,0x6295,0x5934,0x900F, +0x51F8,0x79C3,0x7A81,0x56FE,0x5F92,0x9014,0x6D82,0x5C60, +0x571F,0x5410,0x5154,0x6E4D,0x56E2,0x63A8,0x9893,0x817F, +0x8715,0x892A,0x9000,0x541E,0x5C6F,0x81C0,0x62D6,0x6258, +0x8131,0x9E35,0x9640,0x9A6E,0x9A7C,0x692D,0x59A5,0x62D3, +0x553E,0x6316,0x54C7,0x86D9,0x6D3C,0x5A03,0x74E6,0x889C, +0x6B6A,0x5916,0x8C4C,0x5F2F,0x6E7E,0x73A9,0x987D,0x4E38, +0x70F7,0x5B8C,0x7897,0x633D,0x665A,0x7696,0x60CB,0x5B9B, +0x5A49,0x4E07,0x8155,0x6C6A,0x738B,0x4EA1,0x6789,0x7F51, +0x5F80,0x65FA,0x671B,0x5FD8,0x5984,0x5A01, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5DCD,0x5FAE,0x5371,0x97E6,0x8FDD,0x6845,0x56F4,0x552F, +0x60DF,0x4E3A,0x6F4D,0x7EF4,0x82C7,0x840E,0x59D4,0x4F1F, +0x4F2A,0x5C3E,0x7EAC,0x672A,0x851A,0x5473,0x754F,0x80C3, +0x5582,0x9B4F,0x4F4D,0x6E2D,0x8C13,0x5C09,0x6170,0x536B, +0x761F,0x6E29,0x868A,0x6587,0x95FB,0x7EB9,0x543B,0x7A33, +0x7D0A,0x95EE,0x55E1,0x7FC1,0x74EE,0x631D,0x8717,0x6DA1, +0x7A9D,0x6211,0x65A1,0x5367,0x63E1,0x6C83,0x5DEB,0x545C, +0x94A8,0x4E4C,0x6C61,0x8BEC,0x5C4B,0x65E0,0x829C,0x68A7, +0x543E,0x5434,0x6BCB,0x6B66,0x4E94,0x6342,0x5348,0x821E, +0x4F0D,0x4FAE,0x575E,0x620A,0x96FE,0x6664,0x7269,0x52FF, +0x52A1,0x609F,0x8BEF,0x6614,0x7199,0x6790,0x897F,0x7852, +0x77FD,0x6670,0x563B,0x5438,0x9521,0x727A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7A00,0x606F,0x5E0C,0x6089,0x819D,0x5915,0x60DC,0x7184, +0x70EF,0x6EAA,0x6C50,0x7280,0x6A84,0x88AD,0x5E2D,0x4E60, +0x5AB3,0x559C,0x94E3,0x6D17,0x7CFB,0x9699,0x620F,0x7EC6, +0x778E,0x867E,0x5323,0x971E,0x8F96,0x6687,0x5CE1,0x4FA0, +0x72ED,0x4E0B,0x53A6,0x590F,0x5413,0x6380,0x9528,0x5148, +0x4ED9,0x9C9C,0x7EA4,0x54B8,0x8D24,0x8854,0x8237,0x95F2, +0x6D8E,0x5F26,0x5ACC,0x663E,0x9669,0x73B0,0x732E,0x53BF, +0x817A,0x9985,0x7FA1,0x5BAA,0x9677,0x9650,0x7EBF,0x76F8, +0x53A2,0x9576,0x9999,0x7BB1,0x8944,0x6E58,0x4E61,0x7FD4, +0x7965,0x8BE6,0x60F3,0x54CD,0x4EAB,0x9879,0x5DF7,0x6A61, +0x50CF,0x5411,0x8C61,0x8427,0x785D,0x9704,0x524A,0x54EE, +0x56A3,0x9500,0x6D88,0x5BB5,0x6DC6,0x6653, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5C0F,0x5B5D,0x6821,0x8096,0x5578,0x7B11,0x6548,0x6954, +0x4E9B,0x6B47,0x874E,0x978B,0x534F,0x631F,0x643A,0x90AA, +0x659C,0x80C1,0x8C10,0x5199,0x68B0,0x5378,0x87F9,0x61C8, +0x6CC4,0x6CFB,0x8C22,0x5C51,0x85AA,0x82AF,0x950C,0x6B23, +0x8F9B,0x65B0,0x5FFB,0x5FC3,0x4FE1,0x8845,0x661F,0x8165, +0x7329,0x60FA,0x5174,0x5211,0x578B,0x5F62,0x90A2,0x884C, +0x9192,0x5E78,0x674F,0x6027,0x59D3,0x5144,0x51F6,0x80F8, +0x5308,0x6C79,0x96C4,0x718A,0x4F11,0x4FEE,0x7F9E,0x673D, +0x55C5,0x9508,0x79C0,0x8896,0x7EE3,0x589F,0x620C,0x9700, +0x865A,0x5618,0x987B,0x5F90,0x8BB8,0x84C4,0x9157,0x53D9, +0x65ED,0x5E8F,0x755C,0x6064,0x7D6E,0x5A7F,0x7EEA,0x7EED, +0x8F69,0x55A7,0x5BA3,0x60AC,0x65CB,0x7384, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9009,0x7663,0x7729,0x7EDA,0x9774,0x859B,0x5B66,0x7A74, +0x96EA,0x8840,0x52CB,0x718F,0x5FAA,0x65EC,0x8BE2,0x5BFB, +0x9A6F,0x5DE1,0x6B89,0x6C5B,0x8BAD,0x8BAF,0x900A,0x8FC5, +0x538B,0x62BC,0x9E26,0x9E2D,0x5440,0x4E2B,0x82BD,0x7259, +0x869C,0x5D16,0x8859,0x6DAF,0x96C5,0x54D1,0x4E9A,0x8BB6, +0x7109,0x54BD,0x9609,0x70DF,0x6DF9,0x76D0,0x4E25,0x7814, +0x8712,0x5CA9,0x5EF6,0x8A00,0x989C,0x960E,0x708E,0x6CBF, +0x5944,0x63A9,0x773C,0x884D,0x6F14,0x8273,0x5830,0x71D5, +0x538C,0x781A,0x96C1,0x5501,0x5F66,0x7130,0x5BB4,0x8C1A, +0x9A8C,0x6B83,0x592E,0x9E2F,0x79E7,0x6768,0x626C,0x4F6F, +0x75A1,0x7F8A,0x6D0B,0x9633,0x6C27,0x4EF0,0x75D2,0x517B, +0x6837,0x6F3E,0x9080,0x8170,0x5996,0x7476, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6447,0x5C27,0x9065,0x7A91,0x8C23,0x59DA,0x54AC,0x8200, +0x836F,0x8981,0x8000,0x6930,0x564E,0x8036,0x7237,0x91CE, +0x51B6,0x4E5F,0x9875,0x6396,0x4E1A,0x53F6,0x66F3,0x814B, +0x591C,0x6DB2,0x4E00,0x58F9,0x533B,0x63D6,0x94F1,0x4F9D, +0x4F0A,0x8863,0x9890,0x5937,0x9057,0x79FB,0x4EEA,0x80F0, +0x7591,0x6C82,0x5B9C,0x59E8,0x5F5D,0x6905,0x8681,0x501A, +0x5DF2,0x4E59,0x77E3,0x4EE5,0x827A,0x6291,0x6613,0x9091, +0x5C79,0x4EBF,0x5F79,0x81C6,0x9038,0x8084,0x75AB,0x4EA6, +0x88D4,0x610F,0x6BC5,0x5FC6,0x4E49,0x76CA,0x6EA2,0x8BE3, +0x8BAE,0x8C0A,0x8BD1,0x5F02,0x7FFC,0x7FCC,0x7ECE,0x8335, +0x836B,0x56E0,0x6BB7,0x97F3,0x9634,0x59FB,0x541F,0x94F6, +0x6DEB,0x5BC5,0x996E,0x5C39,0x5F15,0x9690, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5370,0x82F1,0x6A31,0x5A74,0x9E70,0x5E94,0x7F28,0x83B9, +0x8424,0x8425,0x8367,0x8747,0x8FCE,0x8D62,0x76C8,0x5F71, +0x9896,0x786C,0x6620,0x54DF,0x62E5,0x4F63,0x81C3,0x75C8, +0x5EB8,0x96CD,0x8E0A,0x86F9,0x548F,0x6CF3,0x6D8C,0x6C38, +0x607F,0x52C7,0x7528,0x5E7D,0x4F18,0x60A0,0x5FE7,0x5C24, +0x7531,0x90AE,0x94C0,0x72B9,0x6CB9,0x6E38,0x9149,0x6709, +0x53CB,0x53F3,0x4F51,0x91C9,0x8BF1,0x53C8,0x5E7C,0x8FC2, +0x6DE4,0x4E8E,0x76C2,0x6986,0x865E,0x611A,0x8206,0x4F59, +0x4FDE,0x903E,0x9C7C,0x6109,0x6E1D,0x6E14,0x9685,0x4E88, +0x5A31,0x96E8,0x4E0E,0x5C7F,0x79B9,0x5B87,0x8BED,0x7FBD, +0x7389,0x57DF,0x828B,0x90C1,0x5401,0x9047,0x55BB,0x5CEA, +0x5FA1,0x6108,0x6B32,0x72F1,0x80B2,0x8A89, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6D74,0x5BD3,0x88D5,0x9884,0x8C6B,0x9A6D,0x9E33,0x6E0A, +0x51A4,0x5143,0x57A3,0x8881,0x539F,0x63F4,0x8F95,0x56ED, +0x5458,0x5706,0x733F,0x6E90,0x7F18,0x8FDC,0x82D1,0x613F, +0x6028,0x9662,0x66F0,0x7EA6,0x8D8A,0x8DC3,0x94A5,0x5CB3, +0x7CA4,0x6708,0x60A6,0x9605,0x8018,0x4E91,0x90E7,0x5300, +0x9668,0x5141,0x8FD0,0x8574,0x915D,0x6655,0x97F5,0x5B55, +0x531D,0x7838,0x6742,0x683D,0x54C9,0x707E,0x5BB0,0x8F7D, +0x518D,0x5728,0x54B1,0x6512,0x6682,0x8D5E,0x8D43,0x810F, +0x846C,0x906D,0x7CDF,0x51FF,0x85FB,0x67A3,0x65E9,0x6FA1, +0x86A4,0x8E81,0x566A,0x9020,0x7682,0x7076,0x71E5,0x8D23, +0x62E9,0x5219,0x6CFD,0x8D3C,0x600E,0x589E,0x618E,0x66FE, +0x8D60,0x624E,0x55B3,0x6E23,0x672D,0x8F67, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x94E1,0x95F8,0x7728,0x6805,0x69A8,0x548B,0x4E4D,0x70B8, +0x8BC8,0x6458,0x658B,0x5B85,0x7A84,0x503A,0x5BE8,0x77BB, +0x6BE1,0x8A79,0x7C98,0x6CBE,0x76CF,0x65A9,0x8F97,0x5D2D, +0x5C55,0x8638,0x6808,0x5360,0x6218,0x7AD9,0x6E5B,0x7EFD, +0x6A1F,0x7AE0,0x5F70,0x6F33,0x5F20,0x638C,0x6DA8,0x6756, +0x4E08,0x5E10,0x8D26,0x4ED7,0x80C0,0x7634,0x969C,0x62DB, +0x662D,0x627E,0x6CBC,0x8D75,0x7167,0x7F69,0x5146,0x8087, +0x53EC,0x906E,0x6298,0x54F2,0x86F0,0x8F99,0x8005,0x9517, +0x8517,0x8FD9,0x6D59,0x73CD,0x659F,0x771F,0x7504,0x7827, +0x81FB,0x8D1E,0x9488,0x4FA6,0x6795,0x75B9,0x8BCA,0x9707, +0x632F,0x9547,0x9635,0x84B8,0x6323,0x7741,0x5F81,0x72F0, +0x4E89,0x6014,0x6574,0x62EF,0x6B63,0x653F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5E27,0x75C7,0x90D1,0x8BC1,0x829D,0x679D,0x652F,0x5431, +0x8718,0x77E5,0x80A2,0x8102,0x6C41,0x4E4B,0x7EC7,0x804C, +0x76F4,0x690D,0x6B96,0x6267,0x503C,0x4F84,0x5740,0x6307, +0x6B62,0x8DBE,0x53EA,0x65E8,0x7EB8,0x5FD7,0x631A,0x63B7, +0x81F3,0x81F4,0x7F6E,0x5E1C,0x5CD9,0x5236,0x667A,0x79E9, +0x7A1A,0x8D28,0x7099,0x75D4,0x6EDE,0x6CBB,0x7A92,0x4E2D, +0x76C5,0x5FE0,0x949F,0x8877,0x7EC8,0x79CD,0x80BF,0x91CD, +0x4EF2,0x4F17,0x821F,0x5468,0x5DDE,0x6D32,0x8BCC,0x7CA5, +0x8F74,0x8098,0x5E1A,0x5492,0x76B1,0x5B99,0x663C,0x9AA4, +0x73E0,0x682A,0x86DB,0x6731,0x732A,0x8BF8,0x8BDB,0x9010, +0x7AF9,0x70DB,0x716E,0x62C4,0x77A9,0x5631,0x4E3B,0x8457, +0x67F1,0x52A9,0x86C0,0x8D2E,0x94F8,0x7B51, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4F4F,0x6CE8,0x795D,0x9A7B,0x6293,0x722A,0x62FD,0x4E13, +0x7816,0x8F6C,0x64B0,0x8D5A,0x7BC6,0x6869,0x5E84,0x88C5, +0x5986,0x649E,0x58EE,0x72B6,0x690E,0x9525,0x8FFD,0x8D58, +0x5760,0x7F00,0x8C06,0x51C6,0x6349,0x62D9,0x5353,0x684C, +0x7422,0x8301,0x914C,0x5544,0x7740,0x707C,0x6D4A,0x5179, +0x54A8,0x8D44,0x59FF,0x6ECB,0x6DC4,0x5B5C,0x7D2B,0x4ED4, +0x7C7D,0x6ED3,0x5B50,0x81EA,0x6E0D,0x5B57,0x9B03,0x68D5, +0x8E2A,0x5B97,0x7EFC,0x603B,0x7EB5,0x90B9,0x8D70,0x594F, +0x63CD,0x79DF,0x8DB3,0x5352,0x65CF,0x7956,0x8BC5,0x963B, +0x7EC4,0x94BB,0x7E82,0x5634,0x9189,0x6700,0x7F6A,0x5C0A, +0x9075,0x6628,0x5DE6,0x4F50,0x67DE,0x505A,0x4F5C,0x5750, +0x5EA7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4E8D,0x4E0C,0x5140,0x4E10,0x5EFF,0x5345,0x4E15,0x4E98, +0x4E1E,0x9B32,0x5B6C,0x5669,0x4E28,0x79BA,0x4E3F,0x5315, +0x4E47,0x592D,0x723B,0x536E,0x6C10,0x56DF,0x80E4,0x9997, +0x6BD3,0x777E,0x9F17,0x4E36,0x4E9F,0x9F10,0x4E5C,0x4E69, +0x4E93,0x8288,0x5B5B,0x556C,0x560F,0x4EC4,0x538D,0x539D, +0x53A3,0x53A5,0x53AE,0x9765,0x8D5D,0x531A,0x53F5,0x5326, +0x532E,0x533E,0x8D5C,0x5366,0x5363,0x5202,0x5208,0x520E, +0x522D,0x5233,0x523F,0x5240,0x524C,0x525E,0x5261,0x525C, +0x84AF,0x527D,0x5282,0x5281,0x5290,0x5293,0x5182,0x7F54, +0x4EBB,0x4EC3,0x4EC9,0x4EC2,0x4EE8,0x4EE1,0x4EEB,0x4EDE, +0x4F1B,0x4EF3,0x4F22,0x4F64,0x4EF5,0x4F25,0x4F27,0x4F09, +0x4F2B,0x4F5E,0x4F67,0x6538,0x4F5A,0x4F5D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4F5F,0x4F57,0x4F32,0x4F3D,0x4F76,0x4F74,0x4F91,0x4F89, +0x4F83,0x4F8F,0x4F7E,0x4F7B,0x4FAA,0x4F7C,0x4FAC,0x4F94, +0x4FE6,0x4FE8,0x4FEA,0x4FC5,0x4FDA,0x4FE3,0x4FDC,0x4FD1, +0x4FDF,0x4FF8,0x5029,0x504C,0x4FF3,0x502C,0x500F,0x502E, +0x502D,0x4FFE,0x501C,0x500C,0x5025,0x5028,0x507E,0x5043, +0x5055,0x5048,0x504E,0x506C,0x507B,0x50A5,0x50A7,0x50A9, +0x50BA,0x50D6,0x5106,0x50ED,0x50EC,0x50E6,0x50EE,0x5107, +0x510B,0x4EDD,0x6C3D,0x4F58,0x4F65,0x4FCE,0x9FA0,0x6C46, +0x7C74,0x516E,0x5DFD,0x9EC9,0x9998,0x5181,0x5914,0x52F9, +0x530D,0x8A07,0x5310,0x51EB,0x5919,0x5155,0x4EA0,0x5156, +0x4EB3,0x886E,0x88A4,0x4EB5,0x8114,0x88D2,0x7980,0x5B34, +0x8803,0x7FB8,0x51AB,0x51B1,0x51BD,0x51BC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x51C7,0x5196,0x51A2,0x51A5,0x8BA0,0x8BA6,0x8BA7,0x8BAA, +0x8BB4,0x8BB5,0x8BB7,0x8BC2,0x8BC3,0x8BCB,0x8BCF,0x8BCE, +0x8BD2,0x8BD3,0x8BD4,0x8BD6,0x8BD8,0x8BD9,0x8BDC,0x8BDF, +0x8BE0,0x8BE4,0x8BE8,0x8BE9,0x8BEE,0x8BF0,0x8BF3,0x8BF6, +0x8BF9,0x8BFC,0x8BFF,0x8C00,0x8C02,0x8C04,0x8C07,0x8C0C, +0x8C0F,0x8C11,0x8C12,0x8C14,0x8C15,0x8C16,0x8C19,0x8C1B, +0x8C18,0x8C1D,0x8C1F,0x8C20,0x8C21,0x8C25,0x8C27,0x8C2A, +0x8C2B,0x8C2E,0x8C2F,0x8C32,0x8C33,0x8C35,0x8C36,0x5369, +0x537A,0x961D,0x9622,0x9621,0x9631,0x962A,0x963D,0x963C, +0x9642,0x9649,0x9654,0x965F,0x9667,0x966C,0x9672,0x9674, +0x9688,0x968D,0x9697,0x96B0,0x9097,0x909B,0x909D,0x9099, +0x90AC,0x90A1,0x90B4,0x90B3,0x90B6,0x90BA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x90B8,0x90B0,0x90CF,0x90C5,0x90BE,0x90D0,0x90C4,0x90C7, +0x90D3,0x90E6,0x90E2,0x90DC,0x90D7,0x90DB,0x90EB,0x90EF, +0x90FE,0x9104,0x9122,0x911E,0x9123,0x9131,0x912F,0x9139, +0x9143,0x9146,0x520D,0x5942,0x52A2,0x52AC,0x52AD,0x52BE, +0x54FF,0x52D0,0x52D6,0x52F0,0x53DF,0x71EE,0x77CD,0x5EF4, +0x51F5,0x51FC,0x9B2F,0x53B6,0x5F01,0x755A,0x5DEF,0x574C, +0x57A9,0x57A1,0x587E,0x58BC,0x58C5,0x58D1,0x5729,0x572C, +0x572A,0x5733,0x5739,0x572E,0x572F,0x575C,0x573B,0x5742, +0x5769,0x5785,0x576B,0x5786,0x577C,0x577B,0x5768,0x576D, +0x5776,0x5773,0x57AD,0x57A4,0x578C,0x57B2,0x57CF,0x57A7, +0x57B4,0x5793,0x57A0,0x57D5,0x57D8,0x57DA,0x57D9,0x57D2, +0x57B8,0x57F4,0x57EF,0x57F8,0x57E4,0x57DD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x580B,0x580D,0x57FD,0x57ED,0x5800,0x581E,0x5819,0x5844, +0x5820,0x5865,0x586C,0x5881,0x5889,0x589A,0x5880,0x99A8, +0x9F19,0x61FF,0x8279,0x827D,0x827F,0x828F,0x828A,0x82A8, +0x8284,0x828E,0x8291,0x8297,0x8299,0x82AB,0x82B8,0x82BE, +0x82B0,0x82C8,0x82CA,0x82E3,0x8298,0x82B7,0x82AE,0x82CB, +0x82CC,0x82C1,0x82A9,0x82B4,0x82A1,0x82AA,0x829F,0x82C4, +0x82CE,0x82A4,0x82E1,0x8309,0x82F7,0x82E4,0x830F,0x8307, +0x82DC,0x82F4,0x82D2,0x82D8,0x830C,0x82FB,0x82D3,0x8311, +0x831A,0x8306,0x8314,0x8315,0x82E0,0x82D5,0x831C,0x8351, +0x835B,0x835C,0x8308,0x8392,0x833C,0x8334,0x8331,0x839B, +0x835E,0x832F,0x834F,0x8347,0x8343,0x835F,0x8340,0x8317, +0x8360,0x832D,0x833A,0x8333,0x8366,0x8365, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8368,0x831B,0x8369,0x836C,0x836A,0x836D,0x836E,0x83B0, +0x8378,0x83B3,0x83B4,0x83A0,0x83AA,0x8393,0x839C,0x8385, +0x837C,0x83B6,0x83A9,0x837D,0x83B8,0x837B,0x8398,0x839E, +0x83A8,0x83BA,0x83BC,0x83C1,0x8401,0x83E5,0x83D8,0x5807, +0x8418,0x840B,0x83DD,0x83FD,0x83D6,0x841C,0x8438,0x8411, +0x8406,0x83D4,0x83DF,0x840F,0x8403,0x83F8,0x83F9,0x83EA, +0x83C5,0x83C0,0x8426,0x83F0,0x83E1,0x845C,0x8451,0x845A, +0x8459,0x8473,0x8487,0x8488,0x847A,0x8489,0x8478,0x843C, +0x8446,0x8469,0x8476,0x848C,0x848E,0x8431,0x846D,0x84C1, +0x84CD,0x84D0,0x84E6,0x84BD,0x84D3,0x84CA,0x84BF,0x84BA, +0x84E0,0x84A1,0x84B9,0x84B4,0x8497,0x84E5,0x84E3,0x850C, +0x750D,0x8538,0x84F0,0x8539,0x851F,0x853A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8556,0x853B,0x84FF,0x84FC,0x8559,0x8548,0x8568,0x8564, +0x855E,0x857A,0x77A2,0x8543,0x8572,0x857B,0x85A4,0x85A8, +0x8587,0x858F,0x8579,0x85AE,0x859C,0x8585,0x85B9,0x85B7, +0x85B0,0x85D3,0x85C1,0x85DC,0x85FF,0x8627,0x8605,0x8629, +0x8616,0x863C,0x5EFE,0x5F08,0x593C,0x5941,0x8037,0x5955, +0x595A,0x5958,0x530F,0x5C22,0x5C25,0x5C2C,0x5C34,0x624C, +0x626A,0x629F,0x62BB,0x62CA,0x62DA,0x62D7,0x62EE,0x6322, +0x62F6,0x6339,0x634B,0x6343,0x63AD,0x63F6,0x6371,0x637A, +0x638E,0x63B4,0x636D,0x63AC,0x638A,0x6369,0x63AE,0x63BC, +0x63F2,0x63F8,0x63E0,0x63FF,0x63C4,0x63DE,0x63CE,0x6452, +0x63C6,0x63BE,0x6445,0x6441,0x640B,0x641B,0x6420,0x640C, +0x6426,0x6421,0x645E,0x6484,0x646D,0x6496, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x647A,0x64B7,0x64B8,0x6499,0x64BA,0x64C0,0x64D0,0x64D7, +0x64E4,0x64E2,0x6509,0x6525,0x652E,0x5F0B,0x5FD2,0x7519, +0x5F11,0x535F,0x53F1,0x53FD,0x53E9,0x53E8,0x53FB,0x5412, +0x5416,0x5406,0x544B,0x5452,0x5453,0x5454,0x5456,0x5443, +0x5421,0x5457,0x5459,0x5423,0x5432,0x5482,0x5494,0x5477, +0x5471,0x5464,0x549A,0x549B,0x5484,0x5476,0x5466,0x549D, +0x54D0,0x54AD,0x54C2,0x54B4,0x54D2,0x54A7,0x54A6,0x54D3, +0x54D4,0x5472,0x54A3,0x54D5,0x54BB,0x54BF,0x54CC,0x54D9, +0x54DA,0x54DC,0x54A9,0x54AA,0x54A4,0x54DD,0x54CF,0x54DE, +0x551B,0x54E7,0x5520,0x54FD,0x5514,0x54F3,0x5522,0x5523, +0x550F,0x5511,0x5527,0x552A,0x5567,0x558F,0x55B5,0x5549, +0x556D,0x5541,0x5555,0x553F,0x5550,0x553C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5537,0x5556,0x5575,0x5576,0x5577,0x5533,0x5530,0x555C, +0x558B,0x55D2,0x5583,0x55B1,0x55B9,0x5588,0x5581,0x559F, +0x557E,0x55D6,0x5591,0x557B,0x55DF,0x55BD,0x55BE,0x5594, +0x5599,0x55EA,0x55F7,0x55C9,0x561F,0x55D1,0x55EB,0x55EC, +0x55D4,0x55E6,0x55DD,0x55C4,0x55EF,0x55E5,0x55F2,0x55F3, +0x55CC,0x55CD,0x55E8,0x55F5,0x55E4,0x8F94,0x561E,0x5608, +0x560C,0x5601,0x5624,0x5623,0x55FE,0x5600,0x5627,0x562D, +0x5658,0x5639,0x5657,0x562C,0x564D,0x5662,0x5659,0x565C, +0x564C,0x5654,0x5686,0x5664,0x5671,0x566B,0x567B,0x567C, +0x5685,0x5693,0x56AF,0x56D4,0x56D7,0x56DD,0x56E1,0x56F5, +0x56EB,0x56F9,0x56FF,0x5704,0x570A,0x5709,0x571C,0x5E0F, +0x5E19,0x5E14,0x5E11,0x5E31,0x5E3B,0x5E3C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5E37,0x5E44,0x5E54,0x5E5B,0x5E5E,0x5E61,0x5C8C,0x5C7A, +0x5C8D,0x5C90,0x5C96,0x5C88,0x5C98,0x5C99,0x5C91,0x5C9A, +0x5C9C,0x5CB5,0x5CA2,0x5CBD,0x5CAC,0x5CAB,0x5CB1,0x5CA3, +0x5CC1,0x5CB7,0x5CC4,0x5CD2,0x5CE4,0x5CCB,0x5CE5,0x5D02, +0x5D03,0x5D27,0x5D26,0x5D2E,0x5D24,0x5D1E,0x5D06,0x5D1B, +0x5D58,0x5D3E,0x5D34,0x5D3D,0x5D6C,0x5D5B,0x5D6F,0x5D5D, +0x5D6B,0x5D4B,0x5D4A,0x5D69,0x5D74,0x5D82,0x5D99,0x5D9D, +0x8C73,0x5DB7,0x5DC5,0x5F73,0x5F77,0x5F82,0x5F87,0x5F89, +0x5F8C,0x5F95,0x5F99,0x5F9C,0x5FA8,0x5FAD,0x5FB5,0x5FBC, +0x8862,0x5F61,0x72AD,0x72B0,0x72B4,0x72B7,0x72B8,0x72C3, +0x72C1,0x72CE,0x72CD,0x72D2,0x72E8,0x72EF,0x72E9,0x72F2, +0x72F4,0x72F7,0x7301,0x72F3,0x7303,0x72FA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x72FB,0x7317,0x7313,0x7321,0x730A,0x731E,0x731D,0x7315, +0x7322,0x7339,0x7325,0x732C,0x7338,0x7331,0x7350,0x734D, +0x7357,0x7360,0x736C,0x736F,0x737E,0x821B,0x5925,0x98E7, +0x5924,0x5902,0x9963,0x9967,0x9968,0x9969,0x996A,0x996B, +0x996C,0x9974,0x9977,0x997D,0x9980,0x9984,0x9987,0x998A, +0x998D,0x9990,0x9991,0x9993,0x9994,0x9995,0x5E80,0x5E91, +0x5E8B,0x5E96,0x5EA5,0x5EA0,0x5EB9,0x5EB5,0x5EBE,0x5EB3, +0x8D53,0x5ED2,0x5ED1,0x5EDB,0x5EE8,0x5EEA,0x81BA,0x5FC4, +0x5FC9,0x5FD6,0x5FCF,0x6003,0x5FEE,0x6004,0x5FE1,0x5FE4, +0x5FFE,0x6005,0x6006,0x5FEA,0x5FED,0x5FF8,0x6019,0x6035, +0x6026,0x601B,0x600F,0x600D,0x6029,0x602B,0x600A,0x603F, +0x6021,0x6078,0x6079,0x607B,0x607A,0x6042, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x606A,0x607D,0x6096,0x609A,0x60AD,0x609D,0x6083,0x6092, +0x608C,0x609B,0x60EC,0x60BB,0x60B1,0x60DD,0x60D8,0x60C6, +0x60DA,0x60B4,0x6120,0x6126,0x6115,0x6123,0x60F4,0x6100, +0x610E,0x612B,0x614A,0x6175,0x61AC,0x6194,0x61A7,0x61B7, +0x61D4,0x61F5,0x5FDD,0x96B3,0x95E9,0x95EB,0x95F1,0x95F3, +0x95F5,0x95F6,0x95FC,0x95FE,0x9603,0x9604,0x9606,0x9608, +0x960A,0x960B,0x960C,0x960D,0x960F,0x9612,0x9615,0x9616, +0x9617,0x9619,0x961A,0x4E2C,0x723F,0x6215,0x6C35,0x6C54, +0x6C5C,0x6C4A,0x6CA3,0x6C85,0x6C90,0x6C94,0x6C8C,0x6C68, +0x6C69,0x6C74,0x6C76,0x6C86,0x6CA9,0x6CD0,0x6CD4,0x6CAD, +0x6CF7,0x6CF8,0x6CF1,0x6CD7,0x6CB2,0x6CE0,0x6CD6,0x6CFA, +0x6CEB,0x6CEE,0x6CB1,0x6CD3,0x6CEF,0x6CFE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6D39,0x6D27,0x6D0C,0x6D43,0x6D48,0x6D07,0x6D04,0x6D19, +0x6D0E,0x6D2B,0x6D4D,0x6D2E,0x6D35,0x6D1A,0x6D4F,0x6D52, +0x6D54,0x6D33,0x6D91,0x6D6F,0x6D9E,0x6DA0,0x6D5E,0x6D93, +0x6D94,0x6D5C,0x6D60,0x6D7C,0x6D63,0x6E1A,0x6DC7,0x6DC5, +0x6DDE,0x6E0E,0x6DBF,0x6DE0,0x6E11,0x6DE6,0x6DDD,0x6DD9, +0x6E16,0x6DAB,0x6E0C,0x6DAE,0x6E2B,0x6E6E,0x6E4E,0x6E6B, +0x6EB2,0x6E5F,0x6E86,0x6E53,0x6E54,0x6E32,0x6E25,0x6E44, +0x6EDF,0x6EB1,0x6E98,0x6EE0,0x6F2D,0x6EE2,0x6EA5,0x6EA7, +0x6EBD,0x6EBB,0x6EB7,0x6ED7,0x6EB4,0x6ECF,0x6E8F,0x6EC2, +0x6E9F,0x6F62,0x6F46,0x6F47,0x6F24,0x6F15,0x6EF9,0x6F2F, +0x6F36,0x6F4B,0x6F74,0x6F2A,0x6F09,0x6F29,0x6F89,0x6F8D, +0x6F8C,0x6F78,0x6F72,0x6F7C,0x6F7A,0x6FD1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6FC9,0x6FA7,0x6FB9,0x6FB6,0x6FC2,0x6FE1,0x6FEE,0x6FDE, +0x6FE0,0x6FEF,0x701A,0x7023,0x701B,0x7039,0x7035,0x704F, +0x705E,0x5B80,0x5B84,0x5B95,0x5B93,0x5BA5,0x5BB8,0x752F, +0x9A9E,0x6434,0x5BE4,0x5BEE,0x8930,0x5BF0,0x8E47,0x8B07, +0x8FB6,0x8FD3,0x8FD5,0x8FE5,0x8FEE,0x8FE4,0x8FE9,0x8FE6, +0x8FF3,0x8FE8,0x9005,0x9004,0x900B,0x9026,0x9011,0x900D, +0x9016,0x9021,0x9035,0x9036,0x902D,0x902F,0x9044,0x9051, +0x9052,0x9050,0x9068,0x9058,0x9062,0x905B,0x66B9,0x9074, +0x907D,0x9082,0x9088,0x9083,0x908B,0x5F50,0x5F57,0x5F56, +0x5F58,0x5C3B,0x54AB,0x5C50,0x5C59,0x5B71,0x5C63,0x5C66, +0x7FBC,0x5F2A,0x5F29,0x5F2D,0x8274,0x5F3C,0x9B3B,0x5C6E, +0x5981,0x5983,0x598D,0x59A9,0x59AA,0x59A3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5997,0x59CA,0x59AB,0x599E,0x59A4,0x59D2,0x59B2,0x59AF, +0x59D7,0x59BE,0x5A05,0x5A06,0x59DD,0x5A08,0x59E3,0x59D8, +0x59F9,0x5A0C,0x5A09,0x5A32,0x5A34,0x5A11,0x5A23,0x5A13, +0x5A40,0x5A67,0x5A4A,0x5A55,0x5A3C,0x5A62,0x5A75,0x80EC, +0x5AAA,0x5A9B,0x5A77,0x5A7A,0x5ABE,0x5AEB,0x5AB2,0x5AD2, +0x5AD4,0x5AB8,0x5AE0,0x5AE3,0x5AF1,0x5AD6,0x5AE6,0x5AD8, +0x5ADC,0x5B09,0x5B17,0x5B16,0x5B32,0x5B37,0x5B40,0x5C15, +0x5C1C,0x5B5A,0x5B65,0x5B73,0x5B51,0x5B53,0x5B62,0x9A75, +0x9A77,0x9A78,0x9A7A,0x9A7F,0x9A7D,0x9A80,0x9A81,0x9A85, +0x9A88,0x9A8A,0x9A90,0x9A92,0x9A93,0x9A96,0x9A98,0x9A9B, +0x9A9C,0x9A9D,0x9A9F,0x9AA0,0x9AA2,0x9AA3,0x9AA5,0x9AA7, +0x7E9F,0x7EA1,0x7EA3,0x7EA5,0x7EA8,0x7EA9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7EAD,0x7EB0,0x7EBE,0x7EC0,0x7EC1,0x7EC2,0x7EC9,0x7ECB, +0x7ECC,0x7ED0,0x7ED4,0x7ED7,0x7EDB,0x7EE0,0x7EE1,0x7EE8, +0x7EEB,0x7EEE,0x7EEF,0x7EF1,0x7EF2,0x7F0D,0x7EF6,0x7EFA, +0x7EFB,0x7EFE,0x7F01,0x7F02,0x7F03,0x7F07,0x7F08,0x7F0B, +0x7F0C,0x7F0F,0x7F11,0x7F12,0x7F17,0x7F19,0x7F1C,0x7F1B, +0x7F1F,0x7F21,0x7F22,0x7F23,0x7F24,0x7F25,0x7F26,0x7F27, +0x7F2A,0x7F2B,0x7F2C,0x7F2D,0x7F2F,0x7F30,0x7F31,0x7F32, +0x7F33,0x7F35,0x5E7A,0x757F,0x5DDB,0x753E,0x9095,0x738E, +0x7391,0x73AE,0x73A2,0x739F,0x73CF,0x73C2,0x73D1,0x73B7, +0x73B3,0x73C0,0x73C9,0x73C8,0x73E5,0x73D9,0x987C,0x740A, +0x73E9,0x73E7,0x73DE,0x73BA,0x73F2,0x740F,0x742A,0x745B, +0x7426,0x7425,0x7428,0x7430,0x742E,0x742C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x741B,0x741A,0x7441,0x745C,0x7457,0x7455,0x7459,0x7477, +0x746D,0x747E,0x749C,0x748E,0x7480,0x7481,0x7487,0x748B, +0x749E,0x74A8,0x74A9,0x7490,0x74A7,0x74D2,0x74BA,0x97EA, +0x97EB,0x97EC,0x674C,0x6753,0x675E,0x6748,0x6769,0x67A5, +0x6787,0x676A,0x6773,0x6798,0x67A7,0x6775,0x67A8,0x679E, +0x67AD,0x678B,0x6777,0x677C,0x67F0,0x6809,0x67D8,0x680A, +0x67E9,0x67B0,0x680C,0x67D9,0x67B5,0x67DA,0x67B3,0x67DD, +0x6800,0x67C3,0x67B8,0x67E2,0x680E,0x67C1,0x67FD,0x6832, +0x6833,0x6860,0x6861,0x684E,0x6862,0x6844,0x6864,0x6883, +0x681D,0x6855,0x6866,0x6841,0x6867,0x6840,0x683E,0x684A, +0x6849,0x6829,0x68B5,0x688F,0x6874,0x6877,0x6893,0x686B, +0x68C2,0x696E,0x68FC,0x691F,0x6920,0x68F9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6924,0x68F0,0x690B,0x6901,0x6957,0x68E3,0x6910,0x6971, +0x6939,0x6960,0x6942,0x695D,0x6984,0x696B,0x6980,0x6998, +0x6978,0x6934,0x69CC,0x6987,0x6988,0x69CE,0x6989,0x6966, +0x6963,0x6979,0x699B,0x69A7,0x69BB,0x69AB,0x69AD,0x69D4, +0x69B1,0x69C1,0x69CA,0x69DF,0x6995,0x69E0,0x698D,0x69FF, +0x6A2F,0x69ED,0x6A17,0x6A18,0x6A65,0x69F2,0x6A44,0x6A3E, +0x6AA0,0x6A50,0x6A5B,0x6A35,0x6A8E,0x6A79,0x6A3D,0x6A28, +0x6A58,0x6A7C,0x6A91,0x6A90,0x6AA9,0x6A97,0x6AAB,0x7337, +0x7352,0x6B81,0x6B82,0x6B87,0x6B84,0x6B92,0x6B93,0x6B8D, +0x6B9A,0x6B9B,0x6BA1,0x6BAA,0x8F6B,0x8F6D,0x8F71,0x8F72, +0x8F73,0x8F75,0x8F76,0x8F78,0x8F77,0x8F79,0x8F7A,0x8F7C, +0x8F7E,0x8F81,0x8F82,0x8F84,0x8F87,0x8F8B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8F8D,0x8F8E,0x8F8F,0x8F98,0x8F9A,0x8ECE,0x620B,0x6217, +0x621B,0x621F,0x6222,0x6221,0x6225,0x6224,0x622C,0x81E7, +0x74EF,0x74F4,0x74FF,0x750F,0x7511,0x7513,0x6534,0x65EE, +0x65EF,0x65F0,0x660A,0x6619,0x6772,0x6603,0x6615,0x6600, +0x7085,0x66F7,0x661D,0x6634,0x6631,0x6636,0x6635,0x8006, +0x665F,0x6654,0x6641,0x664F,0x6656,0x6661,0x6657,0x6677, +0x6684,0x668C,0x66A7,0x669D,0x66BE,0x66DB,0x66DC,0x66E6, +0x66E9,0x8D32,0x8D33,0x8D36,0x8D3B,0x8D3D,0x8D40,0x8D45, +0x8D46,0x8D48,0x8D49,0x8D47,0x8D4D,0x8D55,0x8D59,0x89C7, +0x89CA,0x89CB,0x89CC,0x89CE,0x89CF,0x89D0,0x89D1,0x726E, +0x729F,0x725D,0x7266,0x726F,0x727E,0x727F,0x7284,0x728B, +0x728D,0x728F,0x7292,0x6308,0x6332,0x63B0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x643F,0x64D8,0x8004,0x6BEA,0x6BF3,0x6BFD,0x6BF5,0x6BF9, +0x6C05,0x6C07,0x6C06,0x6C0D,0x6C15,0x6C18,0x6C19,0x6C1A, +0x6C21,0x6C29,0x6C24,0x6C2A,0x6C32,0x6535,0x6555,0x656B, +0x724D,0x7252,0x7256,0x7230,0x8662,0x5216,0x809F,0x809C, +0x8093,0x80BC,0x670A,0x80BD,0x80B1,0x80AB,0x80AD,0x80B4, +0x80B7,0x80E7,0x80E8,0x80E9,0x80EA,0x80DB,0x80C2,0x80C4, +0x80D9,0x80CD,0x80D7,0x6710,0x80DD,0x80EB,0x80F1,0x80F4, +0x80ED,0x810D,0x810E,0x80F2,0x80FC,0x6715,0x8112,0x8C5A, +0x8136,0x811E,0x812C,0x8118,0x8132,0x8148,0x814C,0x8153, +0x8174,0x8159,0x815A,0x8171,0x8160,0x8169,0x817C,0x817D, +0x816D,0x8167,0x584D,0x5AB5,0x8188,0x8182,0x8191,0x6ED5, +0x81A3,0x81AA,0x81CC,0x6726,0x81CA,0x81BB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81C1,0x81A6,0x6B24,0x6B37,0x6B39,0x6B43,0x6B46,0x6B59, +0x98D1,0x98D2,0x98D3,0x98D5,0x98D9,0x98DA,0x6BB3,0x5F40, +0x6BC2,0x89F3,0x6590,0x9F51,0x6593,0x65BC,0x65C6,0x65C4, +0x65C3,0x65CC,0x65CE,0x65D2,0x65D6,0x7080,0x709C,0x7096, +0x709D,0x70BB,0x70C0,0x70B7,0x70AB,0x70B1,0x70E8,0x70CA, +0x7110,0x7113,0x7116,0x712F,0x7131,0x7173,0x715C,0x7168, +0x7145,0x7172,0x714A,0x7178,0x717A,0x7198,0x71B3,0x71B5, +0x71A8,0x71A0,0x71E0,0x71D4,0x71E7,0x71F9,0x721D,0x7228, +0x706C,0x7118,0x7166,0x71B9,0x623E,0x623D,0x6243,0x6248, +0x6249,0x793B,0x7940,0x7946,0x7949,0x795B,0x795C,0x7953, +0x795A,0x7962,0x7957,0x7960,0x796F,0x7967,0x797A,0x7985, +0x798A,0x799A,0x79A7,0x79B3,0x5FD1,0x5FD0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x603C,0x605D,0x605A,0x6067,0x6041,0x6059,0x6063,0x60AB, +0x6106,0x610D,0x615D,0x61A9,0x619D,0x61CB,0x61D1,0x6206, +0x8080,0x807F,0x6C93,0x6CF6,0x6DFC,0x77F6,0x77F8,0x7800, +0x7809,0x7817,0x7818,0x7811,0x65AB,0x782D,0x781C,0x781D, +0x7839,0x783A,0x783B,0x781F,0x783C,0x7825,0x782C,0x7823, +0x7829,0x784E,0x786D,0x7856,0x7857,0x7826,0x7850,0x7847, +0x784C,0x786A,0x789B,0x7893,0x789A,0x7887,0x789C,0x78A1, +0x78A3,0x78B2,0x78B9,0x78A5,0x78D4,0x78D9,0x78C9,0x78EC, +0x78F2,0x7905,0x78F4,0x7913,0x7924,0x791E,0x7934,0x9F9B, +0x9EF9,0x9EFB,0x9EFC,0x76F1,0x7704,0x770D,0x76F9,0x7707, +0x7708,0x771A,0x7722,0x7719,0x772D,0x7726,0x7735,0x7738, +0x7750,0x7751,0x7747,0x7743,0x775A,0x7768, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7762,0x7765,0x777F,0x778D,0x777D,0x7780,0x778C,0x7791, +0x779F,0x77A0,0x77B0,0x77B5,0x77BD,0x753A,0x7540,0x754E, +0x754B,0x7548,0x755B,0x7572,0x7579,0x7583,0x7F58,0x7F61, +0x7F5F,0x8A48,0x7F68,0x7F74,0x7F71,0x7F79,0x7F81,0x7F7E, +0x76CD,0x76E5,0x8832,0x9485,0x9486,0x9487,0x948B,0x948A, +0x948C,0x948D,0x948F,0x9490,0x9494,0x9497,0x9495,0x949A, +0x949B,0x949C,0x94A3,0x94A4,0x94AB,0x94AA,0x94AD,0x94AC, +0x94AF,0x94B0,0x94B2,0x94B4,0x94B6,0x94B7,0x94B8,0x94B9, +0x94BA,0x94BC,0x94BD,0x94BF,0x94C4,0x94C8,0x94C9,0x94CA, +0x94CB,0x94CC,0x94CD,0x94CE,0x94D0,0x94D1,0x94D2,0x94D5, +0x94D6,0x94D7,0x94D9,0x94D8,0x94DB,0x94DE,0x94DF,0x94E0, +0x94E2,0x94E4,0x94E5,0x94E7,0x94E8,0x94EA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x94E9,0x94EB,0x94EE,0x94EF,0x94F3,0x94F4,0x94F5,0x94F7, +0x94F9,0x94FC,0x94FD,0x94FF,0x9503,0x9502,0x9506,0x9507, +0x9509,0x950A,0x950D,0x950E,0x950F,0x9512,0x9513,0x9514, +0x9515,0x9516,0x9518,0x951B,0x951D,0x951E,0x951F,0x9522, +0x952A,0x952B,0x9529,0x952C,0x9531,0x9532,0x9534,0x9536, +0x9537,0x9538,0x953C,0x953E,0x953F,0x9542,0x9535,0x9544, +0x9545,0x9546,0x9549,0x954C,0x954E,0x954F,0x9552,0x9553, +0x9554,0x9556,0x9557,0x9558,0x9559,0x955B,0x955E,0x955F, +0x955D,0x9561,0x9562,0x9564,0x9565,0x9566,0x9567,0x9568, +0x9569,0x956A,0x956B,0x956C,0x956F,0x9571,0x9572,0x9573, +0x953A,0x77E7,0x77EC,0x96C9,0x79D5,0x79ED,0x79E3,0x79EB, +0x7A06,0x5D47,0x7A03,0x7A02,0x7A1E,0x7A14, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7A39,0x7A37,0x7A51,0x9ECF,0x99A5,0x7A70,0x7688,0x768E, +0x7693,0x7699,0x76A4,0x74DE,0x74E0,0x752C,0x9E20,0x9E22, +0x9E28,0x9E29,0x9E2A,0x9E2B,0x9E2C,0x9E32,0x9E31,0x9E36, +0x9E38,0x9E37,0x9E39,0x9E3A,0x9E3E,0x9E41,0x9E42,0x9E44, +0x9E46,0x9E47,0x9E48,0x9E49,0x9E4B,0x9E4C,0x9E4E,0x9E51, +0x9E55,0x9E57,0x9E5A,0x9E5B,0x9E5C,0x9E5E,0x9E63,0x9E66, +0x9E67,0x9E68,0x9E69,0x9E6A,0x9E6B,0x9E6C,0x9E71,0x9E6D, +0x9E73,0x7592,0x7594,0x7596,0x75A0,0x759D,0x75AC,0x75A3, +0x75B3,0x75B4,0x75B8,0x75C4,0x75B1,0x75B0,0x75C3,0x75C2, +0x75D6,0x75CD,0x75E3,0x75E8,0x75E6,0x75E4,0x75EB,0x75E7, +0x7603,0x75F1,0x75FC,0x75FF,0x7610,0x7600,0x7605,0x760C, +0x7617,0x760A,0x7625,0x7618,0x7615,0x7619, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x761B,0x763C,0x7622,0x7620,0x7640,0x762D,0x7630,0x763F, +0x7635,0x7643,0x763E,0x7633,0x764D,0x765E,0x7654,0x765C, +0x7656,0x766B,0x766F,0x7FCA,0x7AE6,0x7A78,0x7A79,0x7A80, +0x7A86,0x7A88,0x7A95,0x7AA6,0x7AA0,0x7AAC,0x7AA8,0x7AAD, +0x7AB3,0x8864,0x8869,0x8872,0x887D,0x887F,0x8882,0x88A2, +0x88C6,0x88B7,0x88BC,0x88C9,0x88E2,0x88CE,0x88E3,0x88E5, +0x88F1,0x891A,0x88FC,0x88E8,0x88FE,0x88F0,0x8921,0x8919, +0x8913,0x891B,0x890A,0x8934,0x892B,0x8936,0x8941,0x8966, +0x897B,0x758B,0x80E5,0x76B2,0x76B4,0x77DC,0x8012,0x8014, +0x8016,0x801C,0x8020,0x8022,0x8025,0x8026,0x8027,0x8029, +0x8028,0x8031,0x800B,0x8035,0x8043,0x8046,0x804D,0x8052, +0x8069,0x8071,0x8983,0x9878,0x9880,0x9883, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9889,0x988C,0x988D,0x988F,0x9894,0x989A,0x989B,0x989E, +0x989F,0x98A1,0x98A2,0x98A5,0x98A6,0x864D,0x8654,0x866C, +0x866E,0x867F,0x867A,0x867C,0x867B,0x86A8,0x868D,0x868B, +0x86AC,0x869D,0x86A7,0x86A3,0x86AA,0x8693,0x86A9,0x86B6, +0x86C4,0x86B5,0x86CE,0x86B0,0x86BA,0x86B1,0x86AF,0x86C9, +0x86CF,0x86B4,0x86E9,0x86F1,0x86F2,0x86ED,0x86F3,0x86D0, +0x8713,0x86DE,0x86F4,0x86DF,0x86D8,0x86D1,0x8703,0x8707, +0x86F8,0x8708,0x870A,0x870D,0x8709,0x8723,0x873B,0x871E, +0x8725,0x872E,0x871A,0x873E,0x8748,0x8734,0x8731,0x8729, +0x8737,0x873F,0x8782,0x8722,0x877D,0x877E,0x877B,0x8760, +0x8770,0x874C,0x876E,0x878B,0x8753,0x8763,0x877C,0x8764, +0x8759,0x8765,0x8793,0x87AF,0x87A8,0x87D2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x87C6,0x8788,0x8785,0x87AD,0x8797,0x8783,0x87AB,0x87E5, +0x87AC,0x87B5,0x87B3,0x87CB,0x87D3,0x87BD,0x87D1,0x87C0, +0x87CA,0x87DB,0x87EA,0x87E0,0x87EE,0x8816,0x8813,0x87FE, +0x880A,0x881B,0x8821,0x8839,0x883C,0x7F36,0x7F42,0x7F44, +0x7F45,0x8210,0x7AFA,0x7AFD,0x7B08,0x7B03,0x7B04,0x7B15, +0x7B0A,0x7B2B,0x7B0F,0x7B47,0x7B38,0x7B2A,0x7B19,0x7B2E, +0x7B31,0x7B20,0x7B25,0x7B24,0x7B33,0x7B3E,0x7B1E,0x7B58, +0x7B5A,0x7B45,0x7B75,0x7B4C,0x7B5D,0x7B60,0x7B6E,0x7B7B, +0x7B62,0x7B72,0x7B71,0x7B90,0x7BA6,0x7BA7,0x7BB8,0x7BAC, +0x7B9D,0x7BA8,0x7B85,0x7BAA,0x7B9C,0x7BA2,0x7BAB,0x7BB4, +0x7BD1,0x7BC1,0x7BCC,0x7BDD,0x7BDA,0x7BE5,0x7BE6,0x7BEA, +0x7C0C,0x7BFE,0x7BFC,0x7C0F,0x7C16,0x7C0B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7C1F,0x7C2A,0x7C26,0x7C38,0x7C41,0x7C40,0x81FE,0x8201, +0x8202,0x8204,0x81EC,0x8844,0x8221,0x8222,0x8223,0x822D, +0x822F,0x8228,0x822B,0x8238,0x823B,0x8233,0x8234,0x823E, +0x8244,0x8249,0x824B,0x824F,0x825A,0x825F,0x8268,0x887E, +0x8885,0x8888,0x88D8,0x88DF,0x895E,0x7F9D,0x7F9F,0x7FA7, +0x7FAF,0x7FB0,0x7FB2,0x7C7C,0x6549,0x7C91,0x7C9D,0x7C9C, +0x7C9E,0x7CA2,0x7CB2,0x7CBC,0x7CBD,0x7CC1,0x7CC7,0x7CCC, +0x7CCD,0x7CC8,0x7CC5,0x7CD7,0x7CE8,0x826E,0x66A8,0x7FBF, +0x7FCE,0x7FD5,0x7FE5,0x7FE1,0x7FE6,0x7FE9,0x7FEE,0x7FF3, +0x7CF8,0x7D77,0x7DA6,0x7DAE,0x7E47,0x7E9B,0x9EB8,0x9EB4, +0x8D73,0x8D84,0x8D94,0x8D91,0x8DB1,0x8D67,0x8D6D,0x8C47, +0x8C49,0x914A,0x9150,0x914E,0x914F,0x9164, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9162,0x9161,0x9170,0x9169,0x916F,0x917D,0x917E,0x9172, +0x9174,0x9179,0x918C,0x9185,0x9190,0x918D,0x9191,0x91A2, +0x91A3,0x91AA,0x91AD,0x91AE,0x91AF,0x91B5,0x91B4,0x91BA, +0x8C55,0x9E7E,0x8DB8,0x8DEB,0x8E05,0x8E59,0x8E69,0x8DB5, +0x8DBF,0x8DBC,0x8DBA,0x8DC4,0x8DD6,0x8DD7,0x8DDA,0x8DDE, +0x8DCE,0x8DCF,0x8DDB,0x8DC6,0x8DEC,0x8DF7,0x8DF8,0x8DE3, +0x8DF9,0x8DFB,0x8DE4,0x8E09,0x8DFD,0x8E14,0x8E1D,0x8E1F, +0x8E2C,0x8E2E,0x8E23,0x8E2F,0x8E3A,0x8E40,0x8E39,0x8E35, +0x8E3D,0x8E31,0x8E49,0x8E41,0x8E42,0x8E51,0x8E52,0x8E4A, +0x8E70,0x8E76,0x8E7C,0x8E6F,0x8E74,0x8E85,0x8E8F,0x8E94, +0x8E90,0x8E9C,0x8E9E,0x8C78,0x8C82,0x8C8A,0x8C85,0x8C98, +0x8C94,0x659B,0x89D6,0x89DE,0x89DA,0x89DC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x89E5,0x89EB,0x89EF,0x8A3E,0x8B26,0x9753,0x96E9,0x96F3, +0x96EF,0x9706,0x9701,0x9708,0x970F,0x970E,0x972A,0x972D, +0x9730,0x973E,0x9F80,0x9F83,0x9F85,0x9F86,0x9F87,0x9F88, +0x9F89,0x9F8A,0x9F8C,0x9EFE,0x9F0B,0x9F0D,0x96B9,0x96BC, +0x96BD,0x96CE,0x96D2,0x77BF,0x96E0,0x928E,0x92AE,0x92C8, +0x933E,0x936A,0x93CA,0x938F,0x943E,0x946B,0x9C7F,0x9C82, +0x9C85,0x9C86,0x9C87,0x9C88,0x7A23,0x9C8B,0x9C8E,0x9C90, +0x9C91,0x9C92,0x9C94,0x9C95,0x9C9A,0x9C9B,0x9C9E,0x9C9F, +0x9CA0,0x9CA1,0x9CA2,0x9CA3,0x9CA5,0x9CA6,0x9CA7,0x9CA8, +0x9CA9,0x9CAB,0x9CAD,0x9CAE,0x9CB0,0x9CB1,0x9CB2,0x9CB3, +0x9CB4,0x9CB5,0x9CB6,0x9CB7,0x9CBA,0x9CBB,0x9CBC,0x9CBD, +0x9CC4,0x9CC5,0x9CC6,0x9CC7,0x9CCA,0x9CCB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9CCC,0x9CCD,0x9CCE,0x9CCF,0x9CD0,0x9CD3,0x9CD4,0x9CD5, +0x9CD7,0x9CD8,0x9CD9,0x9CDC,0x9CDD,0x9CDF,0x9CE2,0x977C, +0x9785,0x9791,0x9792,0x9794,0x97AF,0x97AB,0x97A3,0x97B2, +0x97B4,0x9AB1,0x9AB0,0x9AB7,0x9E58,0x9AB6,0x9ABA,0x9ABC, +0x9AC1,0x9AC0,0x9AC5,0x9AC2,0x9ACB,0x9ACC,0x9AD1,0x9B45, +0x9B43,0x9B47,0x9B49,0x9B48,0x9B4D,0x9B51,0x98E8,0x990D, +0x992E,0x9955,0x9954,0x9ADF,0x9AE1,0x9AE6,0x9AEF,0x9AEB, +0x9AFB,0x9AED,0x9AF9,0x9B08,0x9B0F,0x9B13,0x9B1F,0x9B23, +0x9EBD,0x9EBE,0x7E3B,0x9E82,0x9E87,0x9E88,0x9E8B,0x9E92, +0x93D6,0x9E9D,0x9E9F,0x9EDB,0x9EDC,0x9EDD,0x9EE0,0x9EDF, +0x9EE2,0x9EE9,0x9EE7,0x9EE5,0x9EEA,0x9EEF,0x9F22,0x9F2C, +0x9F2F,0x9F39,0x9F37,0x9F3D,0x9F3E,0x9F44}; + +static int func_gb2312_uni_onechar(int code){ + if ((code>=0x2121)&&(code<=0x2658)) + return(tab_gb2312_uni0[code-0x2121]); + if ((code>=0x2721)&&(code<=0x296F)) + return(tab_gb2312_uni1[code-0x2721]); + if ((code>=0x3021)&&(code<=0x777E)) + return(tab_gb2312_uni2[code-0x3021]); + return(0); +} + + +/* page 0 0x00A4-0x01DC */ +static uint16 tab_uni_gb23120[]={ +0x2168, 0, 0,0x216C,0x2127, 0, 0, 0, + 0, 0, 0, 0,0x2163,0x2140, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2141, 0, 0, 0, 0, + 0, 0, 0, 0,0x2824,0x2822, 0, 0, + 0, 0, 0, 0,0x2828,0x2826,0x283A, 0, +0x282C,0x282A, 0, 0, 0, 0,0x2830,0x282E, + 0, 0, 0,0x2142, 0,0x2834,0x2832, 0, +0x2839, 0, 0, 0, 0,0x2821, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2825, + 0, 0, 0, 0, 0, 0, 0,0x2827, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2829, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x282D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2831, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2823, 0,0x282B, 0,0x282F, 0, +0x2833, 0,0x2835, 0,0x2836, 0,0x2837, 0, +0x2838}; + +/* page 1 0x02C7-0x0451 */ +static uint16 tab_uni_gb23121[]={ +0x2126, 0,0x2125, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2621,0x2622,0x2623,0x2624,0x2625,0x2626, +0x2627,0x2628,0x2629,0x262A,0x262B,0x262C,0x262D,0x262E, +0x262F,0x2630,0x2631, 0,0x2632,0x2633,0x2634,0x2635, +0x2636,0x2637,0x2638, 0, 0, 0, 0, 0, + 0, 0,0x2641,0x2642,0x2643,0x2644,0x2645,0x2646, +0x2647,0x2648,0x2649,0x264A,0x264B,0x264C,0x264D,0x264E, +0x264F,0x2650,0x2651, 0,0x2652,0x2653,0x2654,0x2655, +0x2656,0x2657,0x2658, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2727, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x2721,0x2722,0x2723,0x2724,0x2725,0x2726,0x2728, +0x2729,0x272A,0x272B,0x272C,0x272D,0x272E,0x272F,0x2730, +0x2731,0x2732,0x2733,0x2734,0x2735,0x2736,0x2737,0x2738, +0x2739,0x273A,0x273B,0x273C,0x273D,0x273E,0x273F,0x2740, +0x2741,0x2751,0x2752,0x2753,0x2754,0x2755,0x2756,0x2758, +0x2759,0x275A,0x275B,0x275C,0x275D,0x275E,0x275F,0x2760, +0x2761,0x2762,0x2763,0x2764,0x2765,0x2766,0x2767,0x2768, +0x2769,0x276A,0x276B,0x276C,0x276D,0x276E,0x276F,0x2770, +0x2771, 0,0x2757}; + +/* page 2 0x2015-0x2312 */ +static uint16 tab_uni_gb23122[]={ +0x212A,0x212C, 0,0x212E,0x212F, 0, 0,0x2130, +0x2131, 0, 0, 0, 0, 0, 0, 0, + 0,0x212D, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x216B, 0,0x2164,0x2165, 0, + 0, 0, 0, 0, 0, 0,0x2179, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x2166, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x216D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2271,0x2272,0x2273,0x2274,0x2275, +0x2276,0x2277,0x2278,0x2279,0x227A,0x227B,0x227C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x217B,0x217C,0x217A,0x217D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x214A, 0, 0, 0, 0, + 0, 0,0x2147, 0,0x2146, 0, 0, 0, + 0, 0, 0, 0, 0,0x214C, 0, 0, +0x2158,0x215E, 0,0x214F, 0, 0, 0, 0, +0x214E, 0,0x2144,0x2145,0x2149,0x2148,0x2152, 0, + 0,0x2153, 0, 0, 0, 0, 0,0x2160, +0x215F,0x2143,0x214B, 0, 0, 0, 0, 0, +0x2157, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2156, 0, 0, 0,0x2155, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2159,0x2154, 0, 0,0x215C, +0x215D, 0, 0, 0, 0, 0, 0, 0, + 0,0x215A,0x215B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x2151, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x214D, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x2150}; + +/* page 3 0x2460-0x2642 */ +static uint16 tab_uni_gb23123[]={ +0x2259,0x225A,0x225B,0x225C,0x225D,0x225E,0x225F,0x2260, +0x2261,0x2262, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x2245,0x2246,0x2247,0x2248, +0x2249,0x224A,0x224B,0x224C,0x224D,0x224E,0x224F,0x2250, +0x2251,0x2252,0x2253,0x2254,0x2255,0x2256,0x2257,0x2258, +0x2231,0x2232,0x2233,0x2234,0x2235,0x2236,0x2237,0x2238, +0x2239,0x223A,0x223B,0x223C,0x223D,0x223E,0x223F,0x2240, +0x2241,0x2242,0x2243,0x2244, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2924,0x2925,0x2926,0x2927,0x2928,0x2929,0x292A,0x292B, +0x292C,0x292D,0x292E,0x292F,0x2930,0x2931,0x2932,0x2933, +0x2934,0x2935,0x2936,0x2937,0x2938,0x2939,0x293A,0x293B, +0x293C,0x293D,0x293E,0x293F,0x2940,0x2941,0x2942,0x2943, +0x2944,0x2945,0x2946,0x2947,0x2948,0x2949,0x294A,0x294B, +0x294C,0x294D,0x294E,0x294F,0x2950,0x2951,0x2952,0x2953, +0x2954,0x2955,0x2956,0x2957,0x2958,0x2959,0x295A,0x295B, +0x295C,0x295D,0x295E,0x295F,0x2960,0x2961,0x2962,0x2963, +0x2964,0x2965,0x2966,0x2967,0x2968,0x2969,0x296A,0x296B, +0x296C,0x296D,0x296E,0x296F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2176,0x2175, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2178,0x2177, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x2174,0x2173, + 0, 0, 0,0x2170, 0, 0,0x2172,0x2171, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x216F,0x216E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2162, 0,0x2161}; + +/* page 4 0x3000-0x3129 */ +static uint16 tab_uni_gb23124[]={ +0x2121,0x2122,0x2123,0x2128, 0,0x2129, 0, 0, +0x2134,0x2135,0x2136,0x2137,0x2138,0x2139,0x213A,0x213B, +0x213E,0x213F, 0,0x217E,0x2132,0x2133,0x213C,0x213D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x2421,0x2422,0x2423,0x2424,0x2425,0x2426,0x2427, +0x2428,0x2429,0x242A,0x242B,0x242C,0x242D,0x242E,0x242F, +0x2430,0x2431,0x2432,0x2433,0x2434,0x2435,0x2436,0x2437, +0x2438,0x2439,0x243A,0x243B,0x243C,0x243D,0x243E,0x243F, +0x2440,0x2441,0x2442,0x2443,0x2444,0x2445,0x2446,0x2447, +0x2448,0x2449,0x244A,0x244B,0x244C,0x244D,0x244E,0x244F, +0x2450,0x2451,0x2452,0x2453,0x2454,0x2455,0x2456,0x2457, +0x2458,0x2459,0x245A,0x245B,0x245C,0x245D,0x245E,0x245F, +0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467, +0x2468,0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F, +0x2470,0x2471,0x2472,0x2473, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x2521,0x2522,0x2523,0x2524,0x2525,0x2526,0x2527, +0x2528,0x2529,0x252A,0x252B,0x252C,0x252D,0x252E,0x252F, +0x2530,0x2531,0x2532,0x2533,0x2534,0x2535,0x2536,0x2537, +0x2538,0x2539,0x253A,0x253B,0x253C,0x253D,0x253E,0x253F, +0x2540,0x2541,0x2542,0x2543,0x2544,0x2545,0x2546,0x2547, +0x2548,0x2549,0x254A,0x254B,0x254C,0x254D,0x254E,0x254F, +0x2550,0x2551,0x2552,0x2553,0x2554,0x2555,0x2556,0x2557, +0x2558,0x2559,0x255A,0x255B,0x255C,0x255D,0x255E,0x255F, +0x2560,0x2561,0x2562,0x2563,0x2564,0x2565,0x2566,0x2567, +0x2568,0x2569,0x256A,0x256B,0x256C,0x256D,0x256E,0x256F, +0x2570,0x2571,0x2572,0x2573,0x2574,0x2575,0x2576, 0, + 0, 0, 0,0x2124, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x2845,0x2846,0x2847, +0x2848,0x2849,0x284A,0x284B,0x284C,0x284D,0x284E,0x284F, +0x2850,0x2851,0x2852,0x2853,0x2854,0x2855,0x2856,0x2857, +0x2858,0x2859,0x285A,0x285B,0x285C,0x285D,0x285E,0x285F, +0x2860,0x2861,0x2862,0x2863,0x2864,0x2865,0x2866,0x2867, +0x2868,0x2869}; + +/* page 5 0x3220-0x3229 */ +static uint16 tab_uni_gb23125[]={ +0x2265,0x2266,0x2267,0x2268,0x2269,0x226A,0x226B,0x226C, +0x226D,0x226E}; + +/* page 6 0x4E00-0x9B54 */ +static uint16 tab_uni_gb23126[]={ +0x523B,0x3621, 0,0x465F, 0, 0, 0,0x4D72, +0x5549,0x487D,0x494F,0x4F42,0x5822,0x323B,0x536B, 0, +0x5824,0x3373, 0,0x5728,0x4752,0x5827,0x4A40, 0, +0x4770,0x317B,0x5235,0x3454,0x362B,0x4B3F,0x5829, 0, + 0, 0,0x362A, 0,0x413D,0x514F, 0,0x4925, +0x582D, 0,0x3876,0x513E,0x635C,0x5650, 0, 0, +0x3761, 0,0x342E, 0,0x4159, 0,0x583C, 0, +0x4D68,0x3524,0x4E2A,0x5677, 0,0x4076,0x3E59,0x582F, + 0, 0, 0,0x444B, 0,0x3E43, 0,0x5831, +0x4334,0x5265, 0,0x562E,0x4E5A,0x5527,0x3A75,0x3726, +0x4056, 0,0x4639,0x4552,0x4747, 0,0x3954, 0, +0x334B,0x5252, 0, 0,0x583F,0x3E45,0x4672,0x5232, +0x4F30,0x4F67, 0, 0, 0, 0,0x4A69, 0, + 0,0x5840, 0, 0, 0, 0, 0, 0, +0x4272,0x4252, 0,0x4869, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x472C, 0, + 0, 0, 0, 0, 0, 0,0x414B, 0, +0x5368,0x5579, 0,0x4A42,0x367E,0x5821,0x535A,0x3F77, + 0,0x5446,0x3B25,0x5841,0x4E65,0x3E2E, 0, 0, +0x5828, 0,0x5147,0x5029, 0, 0, 0,0x583D, +0x596F,0x4D76,0x3F3A, 0,0x3D3B,0x3A25,0x5260,0x327A, +0x3A60,0x4436, 0,0x4F6D,0x3E29,0x4D24,0x4141, 0, + 0, 0,0x4757,0x5971, 0,0x5974, 0, 0, + 0, 0,0x484B,0x5869, 0, 0, 0,0x525A, +0x4A32,0x484A,0x586C,0x586A,0x5846,0x3D76,0x464D,0x3370, + 0,0x586B,0x3D71,0x3D69, 0,0x4854,0x3453, 0, + 0,0x4258, 0,0x3256,0x5750,0x4A4B,0x4B7B,0x554C, +0x3836,0x4F49, 0, 0, 0,0x595A,0x5870,0x472A, + 0,0x586E, 0,0x347A,0x416E,0x5254, 0, 0, +0x586D, 0,0x5247,0x586F,0x4347, 0, 0, 0, +0x5176, 0,0x5659,0x5872, 0,0x5875,0x3C7E,0x3C5B, + 0, 0, 0,0x484E, 0,0x375D, 0,0x3742, + 0,0x4673, 0, 0, 0, 0, 0, 0, + 0,0x5878,0x5241, 0, 0,0x4E69,0x3C3F,0x377C, +0x3725,0x505D, 0, 0, 0, 0, 0,0x565A, +0x5345,0x3B6F,0x3B61,0x5871, 0, 0,0x4921,0x4E30, +0x342B, 0,0x5873, 0,0x494B,0x5876,0x4257,0x5877, + 0, 0,0x4E31,0x5879, 0, 0, 0,0x322E, +0x3940, 0,0x5923, 0,0x3069, 0,0x4166, 0, +0x496C, 0,0x4B45, 0,0x4B46,0x5924, 0, 0, + 0, 0, 0,0x3568, 0, 0,0x352B, 0, + 0, 0, 0, 0, 0,0x4E3B,0x354D,0x5721, +0x5774,0x5353, 0,0x4C65, 0,0x3A4E, 0,0x5922, +0x595C,0x5360,0x587D,0x3770,0x5777,0x587E,0x587A,0x5921, +0x4463, 0, 0,0x5336,0x5874,0x595D, 0,0x587B, + 0,0x4565, 0, 0,0x4050, 0, 0,0x5170, +0x305B, 0, 0,0x3C51,0x5926, 0,0x5925, 0, + 0, 0, 0,0x592C,0x592E, 0,0x592B,0x4A39, + 0, 0, 0,0x5929,0x5636, 0, 0, 0, +0x335E,0x5928, 0,0x407D, 0,0x4A4C, 0,0x592A, + 0,0x5927, 0, 0,0x5930, 0, 0,0x3631, + 0, 0, 0,0x3929, 0,0x5240, 0, 0, +0x4F40, 0, 0,0x4242, 0,0x3D44,0x556C,0x3260, +0x4748,0x3F6B,0x592D, 0,0x592F, 0,0x4E6A,0x3A6E, + 0, 0, 0, 0, 0,0x4756, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3163, + 0, 0, 0,0x3459,0x366D,0x5934, 0, 0, + 0, 0,0x3F21, 0, 0, 0,0x595E,0x474E, +0x407E,0x5938, 0, 0, 0, 0, 0,0x4B57, +0x377D, 0,0x5935, 0,0x5937,0x3123,0x5361,0x5939, + 0,0x5045, 0,0x5936, 0, 0,0x5931, 0, +0x5932,0x4129,0x5933, 0, 0,0x3C73,0x505E,0x3829, + 0,0x3E63, 0,0x593D, 0, 0, 0, 0, +0x593A, 0,0x3033, 0, 0, 0,0x5942, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5944,0x3136, 0,0x593F, + 0, 0,0x3539, 0,0x3E73, 0, 0, 0, +0x4C48,0x3A72,0x5250, 0,0x5943, 0, 0,0x3D68, + 0,0x332B, 0, 0, 0,0x5945,0x3E6B, 0, +0x5946,0x593B,0x445F, 0,0x593E,0x5941,0x5940, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x552E, 0,0x5635, 0,0x4763, 0, + 0, 0, 0,0x5948, 0, 0, 0,0x3C59, +0x594A, 0, 0, 0,0x593C, 0,0x594B,0x462B, + 0, 0, 0, 0, 0,0x5949, 0, 0, + 0, 0,0x5776, 0,0x4D23, 0, 0, 0, + 0, 0, 0, 0, 0,0x3D21, 0, 0, + 0, 0, 0, 0,0x594C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x453C,0x4D35, + 0, 0, 0,0x594D, 0, 0,0x5947,0x3325, +0x3F7E, 0, 0, 0, 0,0x3835, 0, 0, +0x407C, 0, 0, 0, 0,0x3078, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3476, 0,0x594E, 0,0x594F, +0x3422,0x5950, 0, 0,0x345F, 0, 0, 0, + 0, 0,0x3041, 0, 0, 0, 0, 0, + 0, 0,0x5951,0x4935, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4F71, + 0, 0, 0, 0, 0, 0,0x5952, 0, + 0, 0,0x4145, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5956,0x492E, + 0, 0, 0, 0,0x5955,0x5954,0x5957, 0, + 0, 0, 0,0x4B5B, 0,0x3D29, 0, 0, + 0, 0, 0,0x4627, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5953,0x5958, + 0, 0, 0,0x5959, 0, 0, 0, 0, + 0, 0,0x4865, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x405C, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3679, +0x5823,0x544A, 0,0x542A,0x5056,0x3364,0x5557, 0, +0x4F48,0x3962, 0,0x3F4B, 0,0x4362, 0, 0, + 0,0x3652, 0, 0,0x4D43,0x596E,0x5970, 0, + 0, 0,0x3533, 0,0x3635, 0, 0, 0, + 0, 0,0x3E24, 0, 0,0x486B, 0, 0, +0x482B, 0, 0,0x304B,0x392B,0x4179,0x5962, 0, +0x403C,0x3932, 0,0x3958,0x504B,0x3178,0x4664,0x3E5F, +0x3564,0x5748, 0,0x5178,0x3C66,0x4A5E, 0, 0, +0x3C3D,0x5966,0x5867, 0, 0,0x445A, 0, 0, +0x3854,0x483D, 0, 0,0x3261,0x5459, 0, 0, + 0, 0,0x4330, 0, 0,0x4361,0x5A22,0x485F, + 0,0x5034, 0,0x3E7C,0x4529, 0, 0, 0, +0x395A, 0,0x5A23, 0,0x5429,0x5A24, 0, 0, + 0, 0, 0,0x597B,0x362C, 0, 0,0x376B, +0x3179,0x597C,0x3365,0x3E76, 0,0x3F76,0x5231,0x4064, + 0, 0, 0,0x3633,0x597E,0x597D, 0, 0, +0x3E3B, 0, 0, 0,0x4660, 0,0x573C,0x5A21, + 0,0x4139, 0,0x3572,0x4168, 0, 0,0x3C75, + 0,0x3455, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x415D, 0,0x447D, 0, 0, +0x3C38,0x3732, 0, 0,0x376F, 0, 0, 0, + 0, 0, 0,0x596C, 0,0x463E, 0,0x3F2D, +0x3B4B, 0, 0,0x354A, 0,0x5B49,0x5057, 0, +0x4D39,0x303C,0x3376,0x3B77,0x5B4A,0x3A2F, 0,0x5464, +0x3536,0x3573,0x5856,0x4850, 0, 0,0x3756,0x4750, +0x5857, 0,0x3F2F, 0, 0,0x5B3B,0x5858, 0, + 0,0x504C,0x3B2E, 0, 0, 0,0x6B3E,0x4150, +0x4175,0x5472,0x3855,0x3434, 0,0x3375, 0, 0, +0x493E, 0, 0, 0,0x4550, 0, 0, 0, +0x4559,0x407B, 0,0x3170, 0,0x5859,0x394E, 0, +0x353D, 0, 0,0x585A, 0, 0,0x5646,0x4B22, +0x482F,0x4932,0x344C,0x3F4C, 0,0x3974, 0,0x585B, +0x585C,0x3667,0x3C41,0x4C6A, 0, 0, 0, 0, + 0, 0,0x4F77, 0,0x585D,0x4730, 0, 0, +0x3950,0x3D23, 0, 0,0x4C5E, 0,0x464A, 0, + 0, 0, 0, 0,0x5860, 0,0x585E, 0, + 0,0x585F, 0, 0, 0,0x307E, 0,0x3E67, + 0,0x4A23,0x3C74, 0, 0, 0, 0,0x3831, + 0, 0,0x386E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5862, 0,0x3D4B, + 0,0x5864,0x5863, 0, 0, 0, 0, 0, +0x457C, 0, 0, 0, 0, 0, 0, 0, +0x5865, 0, 0,0x5866, 0, 0, 0, 0, + 0, 0, 0,0x4126, 0,0x4830,0x306C,0x3926, +0x3C53,0x4E71,0x5B3D,0x4153, 0, 0, 0, 0, +0x362F,0x567A,0x452C,0x3D59,0x5B3E,0x5B3F, 0, 0, + 0,0x4078,0x3E22,0x404D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5B40,0x4A46, + 0, 0, 0,0x322A, 0, 0, 0,0x5342, + 0,0x4363, 0,0x512B, 0, 0, 0, 0, +0x5B42, 0,0x4055, 0, 0, 0,0x5B43, 0, +0x3F31, 0, 0, 0, 0, 0, 0,0x443C, + 0, 0, 0, 0,0x475A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5B44, 0, 0, 0, 0, 0, 0, 0, + 0,0x5968,0x4957, 0, 0, 0,0x3934,0x4E70, +0x5448, 0, 0, 0, 0,0x307C,0x3452, 0, +0x5059, 0, 0, 0, 0,0x5969, 0,0x5E4B, +0x596B, 0, 0, 0, 0,0x5830,0x3B2F,0x3131, + 0,0x3357,0x584E, 0, 0,0x5451, 0, 0, +0x3D33,0x3F6F, 0,0x4F3B, 0, 0,0x5850, 0, + 0, 0,0x374B, 0, 0, 0,0x5851, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4625,0x4778,0x523D, 0, 0,0x5852,0x4464, + 0,0x4A2E, 0,0x4727, 0,0x5826, 0,0x497D, +0x4E67,0x3B5C,0x306B, 0, 0, 0,0x3B2A,0x502D, + 0,0x3130,0x5764,0x573F, 0,0x3525,0x4274,0x444F, + 0, 0,0x3229, 0,0x3237, 0,0x3165,0x5F32, +0x553C,0x3F28,0x422C,0x5855,0x4231, 0,0x5854,0x4E54, + 0,0x5A60, 0,0x4E40, 0, 0,0x5834,0x432E, +0x5321,0x4E23, 0,0x3C34,0x4834,0x4251, 0,0x3E6D, +0x5036, 0,0x5A61, 0, 0, 0, 0,0x4764, + 0, 0,0x3327, 0,0x3672,0x4C7C,0x407A, 0, + 0,0x4077, 0,0x5139,0x5161,0x5847, 0, 0, + 0, 0, 0, 0, 0,0x325E, 0, 0, +0x4065, 0,0x3A71, 0, 0,0x5848, 0,0x542D, + 0, 0,0x4F61,0x5849, 0,0x584A,0x4F43, 0, +0x3378,0x3E47, 0, 0, 0, 0,0x584B, 0, + 0, 0, 0, 0, 0, 0,0x5B4C, 0, + 0, 0, 0,0x4825, 0, 0, 0,0x4F58, + 0,0x487E,0x324E, 0, 0, 0, 0, 0, +0x5356,0x3266,0x3C30,0x5351,0x4B2B,0x3734, 0, 0, + 0,0x3722, 0, 0,0x4A65, 0,0x4821,0x4A5C, +0x3164,0x5070, 0,0x4551, 0, 0, 0,0x5B45, +0x357E, 0, 0,0x3F5A,0x3945,0x3E64,0x416D, 0, +0x5F36,0x5F35,0x563B,0x3D50,0x5559,0x3048,0x3623,0x3F49, +0x4C28,0x5F33,0x4A37,0x5352, 0,0x584F,0x5236,0x3A45, +0x4B3E,0x4C3E, 0,0x5F37,0x3570,0x5F34, 0, 0, + 0,0x5375, 0,0x3354,0x3877, 0,0x5F3A, 0, +0x3A4F,0x3C2A,0x3575, 0,0x4D2C,0x437B,0x3A73,0x4074, +0x4D42,0x4F72,0x5F38,0x4F45, 0,0x4240,0x5F39,0x4270, + 0, 0, 0,0x3E7D, 0,0x415F,0x4D4C,0x5277, +0x374D,0x5F41, 0,0x5F44, 0, 0,0x3771,0x3049, +0x3656,0x3754, 0,0x3A2C,0x4C7D,0x3F54,0x4B31,0x4674, + 0,0x5628,0x5F45, 0,0x4E62,0x3333, 0, 0, +0x4E7C,0x3435, 0,0x4E47,0x3A70, 0,0x4E61, 0, +0x513D, 0, 0,0x5F40, 0, 0,0x3474, 0, +0x334A, 0,0x3866,0x5F3B, 0, 0, 0, 0, +0x4445, 0,0x5F3C,0x5F3D,0x5F3E,0x453B,0x5F3F,0x5F42, +0x5431,0x5F43, 0,0x473A,0x4E58, 0, 0, 0, + 0, 0,0x4458, 0,0x5F4A, 0,0x5F4F, 0, +0x565C, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F49,0x5F5A,0x4E36, 0,0x3A47,0x5F4E,0x5F48, +0x455E, 0, 0,0x496B,0x3A74,0x437C, 0, 0, +0x3E57, 0,0x5F46, 0,0x5F4D, 0,0x4558, 0, + 0, 0, 0,0x5526,0x3A4D, 0,0x3E4C,0x533D, +0x3840, 0,0x5664, 0,0x5F47,0x393E,0x3F27, 0, + 0,0x417C,0x5F4B,0x5F4C, 0,0x5F50, 0, 0, + 0, 0, 0,0x5F5B,0x5F65, 0,0x5F57,0x5F56, +0x5749,0x5F63,0x5F64,0x656B,0x5227,0x5F52, 0,0x3F29, + 0,0x545B, 0,0x3F48,0x5F54, 0, 0, 0, +0x4F4C, 0, 0,0x5F5D, 0,0x514A, 0,0x5F5E, +0x3027,0x4637,0x5F53, 0,0x3A65, 0,0x365F,0x4D5B, +0x397E,0x5455, 0, 0,0x5F5F,0x4F6C,0x3025,0x5F67, +0x5F51,0x5146,0x5F55,0x5F58,0x5F59,0x5F5C, 0,0x3B29, + 0,0x5F60,0x5F61, 0,0x5F62,0x5F66,0x5F68,0x5334, + 0, 0, 0, 0, 0,0x3867,0x4536,0x5F6A, +0x495A,0x4128,0x4444, 0, 0,0x3F5E,0x4F78, 0, + 0, 0,0x555C,0x5F6E, 0, 0, 0, 0, + 0, 0,0x3238, 0,0x3A5F,0x5F6C, 0,0x5B41, + 0,0x5164, 0, 0, 0, 0,0x4B74,0x343D, + 0,0x3026, 0, 0, 0, 0, 0,0x5F71, +0x4C46,0x5F72, 0, 0,0x5F6D, 0, 0, 0, + 0, 0, 0,0x5F69, 0, 0, 0, 0, +0x5F6B, 0,0x5F6F,0x5F70,0x3B3D, 0, 0,0x5F73, + 0, 0,0x5F74, 0,0x3B23, 0,0x4A5B,0x4E28, +0x6027,0x332A, 0,0x6026, 0, 0, 0,0x6021, + 0, 0, 0, 0,0x5F7E, 0,0x4D59,0x5F7C, + 0,0x5F7A, 0,0x3F50,0x5744, 0,0x494C, 0, + 0,0x5F78,0x3021, 0, 0, 0, 0, 0, +0x5F7D, 0, 0, 0, 0,0x5F7B,0x6022, 0, + 0, 0, 0, 0,0x6028, 0, 0, 0, + 0,0x3748, 0, 0,0x4621,0x4936,0x4032,0x5F75, + 0, 0,0x453E, 0,0x5844,0x5F79,0x4476, 0, + 0, 0, 0, 0, 0,0x6023,0x6024,0x6025, +0x5025, 0, 0,0x6034,0x4C64, 0,0x6031, 0, +0x3F26,0x602F,0x4E39,0x602B,0x4946, 0, 0,0x402E, +0x602E,0x3A6D,0x3A30,0x6029, 0, 0, 0,0x5F76, + 0,0x6033, 0, 0,0x6038, 0, 0, 0, +0x342D,0x6039, 0, 0,0x4F32,0x3A48, 0,0x6030, + 0, 0, 0, 0, 0, 0, 0,0x507A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x602C, 0,0x547B, 0,0x5F77, 0,0x4567, + 0,0x602D, 0,0x5377, 0,0x6036,0x6037, 0, + 0, 0, 0, 0,0x6044,0x5061, 0, 0, + 0,0x603C, 0, 0,0x6049,0x604A, 0, 0, + 0,0x603E,0x602A,0x4924,0x6041, 0,0x6032, 0, + 0, 0, 0, 0,0x4A48,0x6043, 0,0x6035, + 0,0x4E4B, 0,0x4B43,0x604D,0x6046,0x6042, 0, +0x604B, 0,0x603A,0x603F,0x6040, 0, 0,0x6045, + 0, 0,0x6047,0x6048, 0,0x604C, 0,0x603B, + 0, 0, 0, 0, 0,0x4B54,0x6055, 0, +0x6056,0x6052, 0, 0, 0, 0, 0, 0, +0x6050,0x3C4E, 0, 0,0x6051, 0,0x3842,0x5845, + 0, 0, 0, 0, 0, 0, 0, 0, +0x506A, 0, 0,0x426F, 0, 0,0x604F,0x603D, + 0, 0, 0,0x6054,0x6053, 0, 0,0x6057, + 0, 0, 0, 0,0x605C,0x6058, 0, 0, + 0,0x5676,0x3330, 0,0x576C, 0,0x4B3B, 0, + 0,0x605A, 0,0x4E7B, 0, 0, 0,0x3A59, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6061,0x605D,0x522D, 0, + 0, 0, 0, 0,0x6062, 0, 0,0x605B, +0x6059,0x605F, 0, 0,0x6060, 0, 0, 0, + 0, 0,0x605E, 0,0x6064, 0, 0, 0, +0x4677,0x582C,0x546B,0x6066,0x4A49, 0, 0, 0, + 0,0x6065, 0, 0, 0, 0,0x3841, 0, + 0, 0, 0,0x6067,0x6068, 0, 0, 0, + 0, 0, 0, 0, 0,0x6069,0x6063, 0, + 0, 0, 0, 0, 0, 0,0x3A3F,0x4C67, + 0, 0, 0,0x606A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4F79, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x606B, + 0, 0, 0, 0, 0, 0, 0,0x4842, + 0, 0, 0, 0,0x3D40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4452, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x606C, 0, 0,0x606D, + 0, 0,0x4774,0x4B44, 0,0x606E,0x3B58,0x5836, +0x5272,0x606F,0x4D45, 0,0x365A, 0, 0, 0, + 0, 0, 0,0x6071, 0,0x5430, 0, 0, +0x4027,0x3451, 0, 0,0x4E27,0x6070, 0, 0, + 0,0x6072,0x394C, 0, 0,0x397A,0x4D3C,0x6073, + 0, 0, 0,0x4654,0x6074, 0,0x5432, 0, +0x4826,0x6076,0x6075, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6077, 0, 0,0x4D41, + 0, 0, 0,0x4A25, 0, 0, 0, 0, +0x545A,0x5B57,0x5B59, 0,0x5B58,0x3967,0x5B5C,0x5B5D, +0x3558, 0, 0,0x5B5A, 0, 0, 0, 0, + 0,0x5B5B,0x3321,0x5B5F, 0, 0,0x3B78, 0, +0x5637, 0,0x5B60, 0, 0, 0, 0,0x3E79, + 0, 0,0x373B, 0,0x5B50,0x4C2E,0x3F32,0x3B35, +0x5778,0x3F53, 0, 0, 0, 0, 0,0x3F69, + 0, 0,0x3C61,0x4C33,0x5B5E,0x3053,0x4E6B,0x3758, +0x5739,0x4642, 0, 0,0x4024, 0,0x4C39, 0, +0x5B67,0x5B61,0x463A,0x5B63, 0,0x5B68, 0,0x4577, + 0, 0, 0,0x5B6A, 0, 0,0x5B69,0x3F40, + 0, 0, 0,0x5B66,0x5B65, 0, 0, 0, + 0, 0,0x3439,0x402C,0x4222,0x5B62,0x5B64, 0, + 0, 0, 0,0x504D,0x5B6D, 0, 0, 0, + 0, 0,0x405D,0x5B72, 0, 0, 0, 0, + 0, 0, 0,0x3662, 0, 0, 0, 0, +0x5B73,0x5B52,0x3938,0x542B,0x5B6C, 0,0x3F51,0x5B70, + 0,0x5B51, 0,0x3566, 0,0x5B6B,0x3F65, 0, + 0, 0,0x5B6E, 0,0x5B71, 0, 0, 0, +0x5B79, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3921,0x3023, 0, 0, 0, 0, + 0, 0, 0,0x4271, 0, 0,0x3347,0x5B6F, + 0, 0,0x5B78, 0,0x4652,0x5B74, 0, 0, +0x5B75,0x5B77,0x5B76, 0, 0,0x5B7E, 0,0x5372, +0x323A, 0, 0, 0,0x5B7D, 0, 0, 0, + 0, 0, 0, 0, 0,0x5C24, 0,0x5B7B, + 0, 0, 0, 0,0x5B7A, 0, 0, 0, +0x5B7C,0x4560,0x3B79, 0, 0,0x5C23, 0, 0, +0x5C25, 0,0x4C43, 0, 0, 0,0x3651,0x5D40, + 0, 0, 0,0x5C21, 0,0x5C22, 0, 0, + 0,0x4735, 0, 0, 0,0x3669, 0, 0, + 0,0x5C27, 0, 0, 0, 0,0x5C26, 0, +0x5C29,0x3124, 0, 0,0x354C, 0, 0, 0, + 0, 0,0x3F30, 0, 0, 0, 0, 0, +0x515F, 0, 0, 0, 0,0x3642, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5C28, 0, 0, 0, + 0, 0, 0, 0,0x4B7A,0x6B73, 0, 0, + 0,0x4B5C, 0, 0,0x4B7E, 0, 0, 0, +0x4C41, 0, 0, 0, 0, 0,0x487B, 0, + 0, 0, 0, 0, 0,0x5C2A, 0, 0, + 0, 0, 0,0x4C6E,0x5C2B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5B53, 0, +0x5C2F,0x5C2C, 0,0x3E33, 0,0x4A7B, 0, 0, + 0,0x5C2D, 0, 0, 0, 0, 0, 0, + 0, 0,0x494A,0x4439, 0, 0, 0, 0, + 0,0x473D,0x5C2E, 0, 0, 0,0x5476,0x5066, + 0, 0, 0, 0, 0, 0, 0, 0, +0x442B,0x3655, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5B54, 0, 0, 0, + 0,0x315A, 0, 0, 0,0x5B55, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B56, 0, 0, 0,0x3A3E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4840, 0, 0, 0, + 0, 0, 0,0x4A3F,0x4849, 0,0x5733, 0, +0x4979, 0, 0,0x3F47, 0, 0,0x3A78, 0, + 0,0x523C, 0, 0, 0, 0, 0, 0, + 0, 0,0x623A, 0,0x3426, 0, 0,0x3138, + 0, 0, 0, 0, 0,0x3834, 0,0x4F44, + 0, 0, 0, 0,0x5967,0x4F26,0x4D62, 0, + 0,0x596D,0x3660, 0,0x5239, 0, 0,0x393B, + 0, 0, 0, 0,0x6239,0x6237, 0,0x3473, + 0,0x4C6C,0x4C2B,0x3772, 0,0x5832,0x516B,0x3A3B, + 0,0x4A27, 0, 0,0x4D37, 0, 0,0x5244, +0x3F64,0x3C50,0x3661, 0,0x5E45, 0, 0, 0, + 0,0x5E46,0x5B3C, 0,0x5159, 0, 0,0x4666, +0x444E,0x376E, 0,0x375C, 0, 0,0x3F7C,0x5760, + 0,0x4675, 0, 0,0x313C,0x5E48,0x3D31,0x4C57, +0x5E4A, 0,0x5E49, 0, 0, 0, 0, 0, +0x356C, 0,0x495D, 0, 0,0x3042, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x452E,0x452B, 0,0x444C, 0, +0x3C69,0x4B7D, 0, 0, 0,0x3A43, 0, 0, + 0,0x6579,0x4867,0x657A,0x4D7D, 0,0x5731,0x383E, +0x4268, 0,0x4851, 0, 0,0x657B, 0, 0, + 0, 0,0x364A,0x3C4B, 0, 0,0x517D,0x6621, + 0,0x436E, 0, 0, 0, 0,0x6624, 0, + 0, 0, 0,0x657E,0x6625,0x4D57, 0, 0, +0x3741,0x657C,0x657D,0x6623, 0, 0,0x445D,0x6628, + 0, 0,0x6627, 0, 0, 0, 0, 0, + 0,0x4343, 0,0x465E, 0, 0,0x662A, 0, + 0, 0, 0, 0, 0, 0,0x4437, 0, + 0, 0,0x6622,0x4A3C, 0, 0, 0, 0, +0x3D63,0x3943,0x6626,0x5055,0x4E2F, 0, 0,0x6629, +0x6630, 0,0x5226, 0,0x3D2A,0x662D, 0, 0, + 0, 0, 0,0x662F, 0,0x4051, 0, 0, +0x524C, 0, 0, 0,0x3C27, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6631, 0,0x5276, 0, 0, 0,0x574B, + 0,0x4D7E, 0,0x4D5E,0x4226,0x662B,0x662C,0x3D3F, +0x662E,0x6633, 0, 0,0x6632, 0, 0, 0, + 0,0x6636, 0,0x6638, 0, 0, 0, 0, +0x446F, 0, 0, 0,0x4448, 0, 0,0x3E6A, +0x496F, 0, 0,0x6637, 0,0x3670, 0, 0, + 0,0x4364, 0, 0, 0, 0, 0, 0, + 0,0x5369,0x6634, 0,0x6635, 0,0x4822, 0, + 0, 0, 0, 0,0x663D, 0, 0, 0, +0x6639, 0, 0, 0, 0, 0,0x4645, 0, + 0,0x4D71,0x663B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x663C, 0, 0, + 0, 0,0x3B69, 0, 0, 0, 0, 0, + 0, 0,0x663E, 0, 0, 0, 0,0x663A, + 0, 0,0x4037, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5324,0x663F,0x4974,0x6643, + 0, 0,0x6644, 0, 0, 0, 0,0x5076, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x433D, 0, 0, 0, 0, 0, + 0, 0,0x4344,0x6642, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6641, 0, 0, 0, 0, 0, + 0, 0,0x6647,0x4F31, 0,0x6B74, 0, 0, +0x664A, 0, 0, 0, 0, 0,0x6645, 0, + 0,0x3C5E,0x4929, 0, 0, 0, 0, 0, + 0,0x3C35, 0, 0,0x4F53, 0, 0, 0, + 0, 0,0x6648, 0,0x6649, 0,0x664E, 0, +0x6650, 0, 0, 0,0x6651, 0, 0, 0, +0x664B,0x3555, 0,0x664C, 0, 0,0x664F, 0, + 0,0x445B, 0,0x6646, 0, 0, 0, 0, + 0,0x664D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6652, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6654,0x6653, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6655, 0,0x5978, 0, 0,0x6656, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6657, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5753,0x665D, 0,0x665E,0x3F57,0x5450, 0,0x5756, +0x3466,0x4B6F,0x665A,0x5843,0x574E,0x5022, 0,0x434F, + 0, 0,0x665F,0x3C3E,0x3942,0x665B,0x5127, 0, + 0,0x3A22,0x424F, 0,0x582B, 0, 0, 0, +0x4A6B,0x656E, 0,0x665C, 0,0x3775, 0, 0, + 0, 0,0x4866, 0, 0,0x4475, 0, 0, +0x6532,0x447E, 0,0x4B7C,0x6533,0x552C, 0,0x536E, +0x4A58,0x3032, 0,0x4B4E,0x4D6A, 0, 0,0x3A6A, + 0, 0, 0,0x6535, 0,0x6534, 0,0x575A, +0x3959,0x5666,0x3628,0x4D70,0x524B,0x3126,0x4A35, 0, +0x3368,0x4973,0x3F4D,0x507B,0x4A52,0x6536,0x3B42, 0, + 0, 0,0x4F5C,0x392C, 0, 0, 0, 0, +0x5457, 0, 0,0x3A26,0x5167,0x4F7C,0x3C52, 0, +0x6537,0x485D, 0, 0, 0,0x3F6D,0x3176,0x4B5E, + 0, 0,0x3C45, 0,0x3C44,0x527A,0x435C,0x3F5C, + 0, 0, 0, 0,0x383B, 0, 0, 0, +0x4342, 0,0x3A2E,0x5422, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x475E,0x442F,0x326C, + 0,0x3951, 0, 0,0x653B,0x4148, 0, 0, +0x552F, 0, 0, 0, 0, 0,0x653C, 0, +0x653E, 0, 0, 0, 0, 0, 0, 0, +0x3467,0x3654,0x4B42,0x5130,0x353C, 0, 0,0x4A59, + 0,0x3762, 0, 0,0x4964, 0,0x3D2B, 0, + 0,0x4E3E,0x5770, 0, 0, 0, 0,0x5021, + 0,0x4959, 0, 0,0x367B,0x6658,0x3C62, 0, +0x333E, 0,0x4950, 0,0x6659,0x3322, 0, 0, + 0, 0,0x5E4C, 0,0x5348,0x5E4D, 0,0x5222, + 0, 0, 0, 0,0x5E4E, 0, 0, 0, + 0,0x3E4D, 0, 0,0x5E4F, 0, 0, 0, +0x4A2C,0x527C,0x335F,0x656A,0x4461,0x3E21,0x4E32,0x4472, +0x3E56,0x4628,0x3263, 0, 0,0x3E53, 0, 0, +0x477C,0x4C6B,0x3D6C,0x4E5D, 0, 0,0x4A3A,0x4641, +0x656C,0x503C, 0, 0, 0,0x5539, 0, 0, + 0,0x656D, 0, 0, 0, 0,0x4A74, 0, +0x4D40,0x4245, 0,0x656F, 0,0x4244,0x6570, 0, + 0, 0, 0, 0, 0, 0,0x6578,0x4D4D, + 0,0x493D, 0, 0, 0, 0, 0, 0, + 0,0x5259,0x6128, 0, 0, 0, 0,0x536C, + 0,0x4B6A,0x4671, 0, 0, 0, 0, 0, +0x612C, 0, 0, 0,0x6127,0x6129, 0, 0, +0x612A,0x612F, 0, 0,0x326D, 0,0x612B,0x385A, +0x612D,0x612E,0x6130,0x353A,0x6131, 0, 0, 0, + 0, 0,0x6133,0x6138, 0, 0, 0, 0, + 0,0x5152, 0,0x6136,0x6135,0x416B, 0, 0, + 0,0x6137, 0,0x5440, 0,0x6132, 0,0x613A, +0x3036, 0, 0, 0, 0,0x6134, 0,0x3F79, + 0,0x6139, 0, 0,0x613B, 0, 0, 0, + 0, 0, 0,0x613E, 0, 0, 0, 0, + 0, 0,0x613C, 0, 0, 0, 0, 0, + 0,0x5645, 0, 0, 0, 0, 0, 0, + 0,0x4F3F, 0, 0,0x613D,0x613F,0x424D, 0, +0x366B, 0,0x5378, 0, 0,0x474D, 0, 0, +0x3765, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3E7E, 0, 0, 0, 0, + 0, 0,0x6140,0x6141, 0, 0,0x6147,0x3367, + 0, 0, 0, 0, 0, 0,0x4669, 0, + 0, 0, 0, 0,0x345E, 0,0x5142, 0, + 0, 0, 0,0x6148, 0, 0,0x6146, 0, + 0, 0, 0, 0,0x6145, 0,0x6143,0x6142, + 0,0x3140, 0, 0, 0,0x5538,0x6144, 0, + 0, 0, 0, 0,0x614B, 0, 0, 0, + 0, 0, 0, 0, 0,0x614C,0x614A, 0, + 0, 0, 0, 0, 0, 0, 0,0x6F7A, + 0, 0,0x6153,0x6152,0x4736, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6149, 0, 0,0x614E, 0,0x6150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6154, 0,0x6151,0x614D, 0, 0,0x614F, + 0, 0, 0, 0,0x6155, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6156, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6157, 0, 0, 0,0x6158, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x615A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x615B, 0, 0, + 0, 0, 0, 0, 0,0x4E21, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x675D, 0,0x3428,0x565D, 0, + 0,0x5132,0x3332, 0, 0,0x3924,0x5773,0x4749, +0x3E5E,0x392E, 0,0x4E57, 0, 0,0x326E,0x5B4F, + 0,0x3C3A,0x5251,0x4B48,0x304D, 0, 0,0x4F6F, + 0, 0, 0, 0, 0,0x5963,0x3D6D, 0, + 0,0x3152,0x4A50,0x323C, 0,0x4B27,0x372B, 0, +0x4A26, 0, 0, 0,0x4F23, 0, 0,0x6078, +0x554A,0x607B, 0, 0,0x607A,0x4541,0x4C7B, 0, +0x4131,0x6079,0x5663,0x322F,0x5644,0x355B, 0, 0, + 0, 0, 0, 0, 0, 0,0x3478,0x5621, + 0, 0, 0, 0, 0,0x4F2F,0x306F, 0, + 0,0x607C, 0, 0, 0, 0, 0,0x6121, +0x3323, 0, 0,0x607D,0x607E,0x4331, 0, 0, + 0, 0,0x435D, 0,0x6122,0x3779, 0, 0, + 0, 0, 0, 0,0x3B4F, 0, 0, 0, + 0, 0, 0, 0,0x6123,0x443B, 0, 0, + 0, 0, 0,0x6124, 0, 0,0x6125, 0, + 0,0x6126,0x3431, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3849,0x463D,0x446A, 0,0x3222, 0, +0x5052, 0,0x675B,0x3B43,0x5357,0x5344, 0,0x3963, +0x624F, 0, 0, 0,0x572F, 0,0x476C,0x3153, + 0, 0,0x3432,0x6251, 0, 0, 0,0x5072, +0x422E,0x6250, 0,0x3F62,0x5326,0x3557,0x6252,0x356A, + 0,0x436D,0x387D, 0,0x382E, 0,0x4553,0x374F, +0x6254, 0, 0, 0, 0,0x6253,0x3648,0x5779, + 0, 0, 0, 0, 0,0x4D25, 0, 0, + 0, 0, 0,0x6258, 0,0x6256,0x4A7C,0x3F35, +0x5339,0x6255, 0, 0, 0, 0,0x6257, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x412E,0x4048, 0, 0, 0, 0, 0, + 0,0x625B,0x625A,0x402A, 0, 0,0x414E, 0, + 0, 0, 0,0x625C, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x625D, 0,0x625E, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5B48, 0,0x5153,0x4D22, + 0, 0,0x3D28, 0, 0, 0,0x5E43,0x5825, +0x3F2A,0x5B4D,0x526C,0x467A,0x452A, 0, 0, 0, +0x5E44, 0,0x3157,0x5F2E, 0, 0, 0,0x4A3D, + 0,0x5F31, 0,0x392D, 0,0x527D, 0,0x3825, +0x3A6B, 0, 0,0x335A, 0, 0, 0,0x355C, +0x5545, 0, 0, 0, 0,0x4356,0x4F52,0x3B21, + 0,0x6573,0x6572, 0, 0,0x6574, 0,0x4D64, + 0,0x4875, 0, 0, 0, 0, 0, 0, + 0,0x352F,0x473F, 0,0x6576, 0, 0, 0, +0x6C30, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6566, 0,0x3969,0x3531, 0,0x423C,0x6568,0x6567, +0x6569, 0, 0, 0, 0,0x524D, 0, 0, + 0,0x616A,0x504E, 0,0x4D2E, 0,0x5165, 0, + 0,0x324A,0x316B, 0,0x3172,0x456D, 0, 0, +0x5543,0x5330, 0,0x615C, 0, 0, 0,0x615D, + 0,0x525B, 0,0x3339,0x314B, 0, 0, 0, +0x4D79,0x5577,0x615E, 0,0x3E36,0x347D, 0,0x615F, +0x3A5C,0x6160,0x3B32,0x4249,0x6161, 0, 0, 0, +0x506C, 0,0x4D3D, 0, 0,0x6162, 0,0x3543, +0x4547,0x6163, 0, 0,0x6164, 0, 0, 0, + 0,0x5379, 0, 0, 0, 0, 0, 0, +0x6165, 0,0x512D, 0, 0,0x6166,0x4E22, 0, + 0, 0, 0, 0, 0,0x6167, 0,0x3542, + 0, 0, 0, 0,0x6168,0x3B55, 0, 0, + 0, 0, 0,0x5044,0x6260,0x3158,0x5264, 0, + 0,0x6261, 0, 0,0x3C49,0x484C, 0,0x6263, +0x6C7E,0x6C7D,0x5F2F, 0, 0, 0,0x6262,0x563E, +0x4D7C,0x4326, 0, 0, 0,0x6343, 0, 0, +0x5652,0x6267, 0, 0,0x6268, 0, 0,0x5347, + 0, 0,0x626C,0x3F6C, 0,0x626D,0x6265, 0, + 0,0x3340, 0, 0, 0,0x446E, 0, 0, +0x626E, 0, 0,0x5043, 0,0x3A76,0x6269,0x375E, +0x3B33,0x4C2C,0x4B4B,0x6264,0x6266,0x626A,0x626B, 0, + 0, 0,0x6277, 0, 0,0x6274,0x5475,0x6273, + 0, 0,0x452D, 0,0x557A,0x4542,0x3240, 0, + 0,0x626F, 0,0x6272,0x412F,0x4B3C, 0, 0, +0x3521,0x6279, 0, 0, 0,0x3C31,0x6271,0x5054, +0x5439,0x6275,0x3956,0x6276, 0, 0, 0,0x4753, + 0, 0, 0, 0, 0,0x6270, 0, 0, + 0, 0, 0,0x575C,0x6D21, 0, 0,0x6278, + 0,0x6D25,0x627E,0x4A51, 0, 0, 0, 0, + 0, 0, 0,0x4135, 0,0x3B50, 0, 0, +0x3F56, 0,0x3A63, 0, 0,0x4B21, 0, 0, + 0,0x6D26,0x6D23, 0, 0,0x6D22, 0, 0, + 0, 0,0x3B56,0x6D27,0x5074, 0, 0,0x6D24, +0x3A5E,0x3677,0x6321,0x3632,0x4C71,0x3927, 0,0x4F22, +0x4721, 0, 0,0x3F52, 0, 0,0x3671, 0, +0x627A,0x627B,0x627D,0x627C,0x4455,0x6322, 0,0x5341, + 0, 0, 0,0x6327,0x4744, 0, 0, 0, + 0,0x4F24, 0, 0,0x6329,0x3A37, 0, 0, + 0, 0,0x6328, 0,0x3B5A, 0,0x6323, 0, + 0, 0,0x6324,0x632A, 0,0x6326, 0,0x4E72, +0x5346, 0, 0,0x3B3C, 0, 0,0x5443, 0, +0x447A, 0, 0,0x6D28,0x507C,0x6325, 0,0x4375, + 0,0x632D,0x312F, 0,0x6332, 0, 0, 0, +0x3C42, 0, 0,0x632C,0x353F, 0, 0, 0, + 0, 0, 0, 0, 0,0x4769,0x6330, 0, + 0, 0,0x3E2A,0x4D6F, 0, 0, 0, 0, + 0,0x3B73, 0, 0, 0,0x4C68, 0, 0, +0x632F, 0,0x6331, 0,0x4F27,0x632E, 0,0x4E29, +0x3B5D, 0, 0, 0, 0, 0,0x356B,0x3E65, +0x3252,0x334D, 0,0x3139,0x632B,0x3251,0x352C,0x395F, +0x3668, 0, 0,0x4F6B,0x6337, 0,0x3B4C, 0, + 0,0x4847,0x504A, 0, 0, 0, 0, 0, +0x6338,0x336E, 0, 0, 0, 0,0x6D29, 0, +0x537A,0x5364, 0, 0, 0,0x6D2A,0x6339,0x5262, + 0, 0, 0, 0, 0,0x6335, 0, 0, + 0, 0,0x535E, 0, 0, 0, 0,0x3850, +0x6333, 0, 0,0x6336,0x375F, 0,0x6334,0x4022, + 0, 0, 0,0x633A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5438, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3448, 0,0x633B, 0,0x3B45, 0,0x4977, 0, + 0,0x4965, 0, 0, 0,0x443D, 0, 0, + 0, 0, 0, 0, 0,0x6D2B, 0, 0, + 0, 0,0x427D, 0, 0, 0, 0,0x3B5B, +0x3F2E, 0, 0, 0, 0, 0, 0, 0, +0x4E3F, 0, 0, 0, 0,0x633C, 0,0x3F36, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x316F, 0, 0,0x5477, 0, + 0, 0, 0, 0,0x633E, 0, 0, 0, + 0, 0, 0, 0, 0,0x6D2D, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x633F, +0x3A29,0x6D2C, 0, 0,0x633D, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6340, + 0, 0, 0, 0, 0, 0,0x3A36, 0, + 0, 0,0x362E, 0, 0, 0, 0, 0, +0x5038, 0,0x3043,0x6D2E, 0, 0, 0, 0, + 0,0x6D2F,0x4041, 0,0x6341, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4533, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6342, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5C32, + 0, 0, 0, 0, 0, 0,0x6D30, 0, +0x386A, 0,0x4E6C,0x6A27,0x5067,0x4A79,0x4856,0x4F37, +0x3349,0x4E52,0x3D64, 0, 0,0x635E,0x3B72,0x6A28, +0x553D, 0,0x465D,0x6A29, 0, 0, 0,0x6A2A, + 0,0x6A2C,0x6A2B, 0,0x6A2E,0x6A2D, 0, 0, + 0, 0,0x3D58, 0,0x6A2F, 0,0x423E, 0, + 0, 0, 0,0x3441,0x3477, 0, 0,0x3B27, + 0, 0, 0, 0, 0,0x6C66,0x6C65,0x373F, +0x4B79,0x3162, 0,0x6C67, 0, 0, 0,0x4948, +0x6C68,0x6C69, 0,0x4A56,0x5E50,0x3245,0x547A, 0, + 0,0x464B,0x3047,0x3472,0x4853, 0, 0, 0, +0x4D50, 0, 0,0x3F38, 0, 0, 0, 0, + 0, 0, 0,0x3F5B, 0, 0,0x4724,0x5634, + 0,0x4029,0x5E51,0x4928,0x516F,0x4524,0x3067,0x3336, +0x4845, 0, 0,0x3062, 0, 0,0x3776, 0, + 0,0x457A, 0, 0,0x3673, 0,0x5552,0x3350, +0x3C3C, 0, 0, 0,0x332D, 0, 0, 0, + 0,0x3E71,0x3051, 0, 0, 0, 0, 0, + 0,0x5256,0x4A63,0x5725, 0,0x4D36,0x3636,0x3F39, +0x555B, 0,0x3827,0x4557, 0, 0, 0,0x5E52, +0x3F59,0x4255,0x4740, 0,0x3B24,0x3128, 0, 0, +0x456A, 0, 0,0x457B,0x4C27, 0, 0, 0, + 0,0x3127, 0, 0, 0,0x3556, 0, 0, + 0,0x4428, 0,0x5E53,0x513A,0x3369, 0,0x4372, + 0, 0,0x3777, 0,0x5674,0x3523,0x3270,0x4434, +0x4469,0x402D,0x5E54, 0,0x3068,0x4544,0x4160, 0, +0x3955, 0,0x3E5C,0x4D58,0x304E, 0,0x4D4F,0x5E56, +0x3E50,0x573E,0x5E55,0x5550,0x305D, 0, 0,0x4462, + 0, 0,0x4223,0x3C70, 0,0x5335,0x4039,0x4521, +0x3226,0x5471, 0, 0,0x4028,0x4A43,0x5E57,0x557C, + 0,0x3930, 0,0x482D,0x4B29, 0,0x5E59,0x3F3D, + 0, 0, 0, 0,0x4634,0x5727,0x4A30,0x4443, + 0,0x3356,0x3952, 0, 0, 0, 0,0x5638, +0x6A7C,0x3034, 0, 0, 0, 0,0x3F66, 0, + 0,0x4C74, 0, 0, 0, 0,0x4D5A, 0, + 0, 0,0x563F,0x424E, 0,0x4E4E,0x4C22,0x502E, +0x4453,0x3532,0x5E58,0x5575,0x3C37,0x3B53, 0, 0, +0x3024, 0,0x4532,0x346C, 0, 0, 0,0x5571, + 0, 0,0x6A7D, 0, 0, 0, 0, 0, + 0,0x5E5A,0x4D26, 0, 0,0x4D6C, 0, 0, + 0, 0,0x4E66,0x5E5C, 0,0x4D31,0x4026, 0, + 0,0x573D, 0,0x5E5B,0x3046,0x3A34,0x4953,0x4473, +0x3E68, 0, 0, 0, 0,0x3236, 0, 0, + 0, 0, 0, 0, 0, 0,0x404C,0x4B70, + 0,0x3C71,0x3B3B,0x3537, 0, 0, 0,0x4575, + 0,0x5E66, 0, 0, 0,0x5E63,0x3E5D, 0, + 0,0x5E5F, 0, 0, 0, 0,0x3437,0x3D5D, + 0, 0,0x5E60,0x446D, 0, 0, 0, 0, +0x4F46, 0,0x3560, 0, 0, 0, 0,0x365E, +0x4A5A,0x3574,0x5E65, 0,0x5546, 0,0x5E61,0x4C4D, +0x467E, 0,0x4545, 0, 0, 0,0x5234, 0, +0x3E72, 0, 0, 0, 0, 0, 0, 0, +0x4253, 0,0x4C3D,0x3338, 0,0x3D53, 0,0x3F58, +0x4D46,0x515A,0x346B, 0,0x5E64,0x5E5D,0x5E67, 0, +0x6A7E, 0, 0,0x4230,0x5E62, 0, 0,0x5640, +0x3527, 0,0x3274, 0,0x5E68, 0,0x5E72, 0, + 0, 0, 0, 0,0x5E6D, 0,0x5E71, 0, + 0,0x4860, 0, 0, 0,0x5761,0x5E6F,0x4368, +0x4C61, 0,0x3265, 0, 0, 0,0x523E, 0, + 0, 0, 0, 0, 0, 0,0x5E6E, 0, +0x5E6B,0x4E55, 0,0x3427, 0, 0, 0, 0, + 0,0x3F2B,0x3E3E, 0, 0,0x3D52, 0, 0, + 0, 0,0x5E69, 0,0x542E, 0,0x5E5E, 0, +0x5E6A, 0, 0, 0, 0,0x403F, 0,0x5E6C, +0x3273,0x3869,0x4227, 0, 0,0x3D41, 0, 0, + 0, 0, 0,0x5E75,0x5E78, 0, 0,0x322B, +0x3424, 0, 0,0x346A,0x4926, 0, 0, 0, + 0, 0, 0,0x5E76,0x4B51, 0,0x3863, 0, +0x5E77,0x5E7A, 0, 0, 0, 0,0x5E79, 0, + 0, 0,0x4C42, 0,0x3061,0x346E, 0, 0, + 0, 0, 0, 0,0x653A, 0, 0, 0, + 0, 0,0x502F, 0, 0,0x326B, 0,0x6B21, + 0,0x5E74, 0, 0,0x4963,0x5E73,0x305A,0x5221, +0x3177, 0,0x4C2F, 0, 0, 0, 0, 0, + 0, 0,0x5E70, 0,0x4B24, 0, 0, 0, +0x552A, 0, 0, 0, 0, 0,0x5E7B, 0, + 0, 0, 0, 0, 0, 0, 0,0x345D, + 0,0x4426, 0, 0, 0,0x5E7D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x437E,0x4421,0x5F21, 0, 0, 0, 0, 0, + 0, 0,0x414C, 0,0x5E7C,0x3E6F, 0,0x4632, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3345,0x4876, 0, 0,0x4B3A,0x5E7E, 0, + 0,0x5F24, 0, 0, 0, 0,0x5732, 0, + 0, 0, 0, 0,0x3337, 0, 0, 0, + 0,0x4143, 0, 0,0x474B,0x3225,0x3469, 0, +0x572B, 0, 0, 0, 0,0x446C, 0,0x5F22, +0x5F23, 0,0x5F25, 0,0x3A33, 0, 0, 0, +0x5F26, 0,0x405E, 0, 0,0x4943, 0, 0, + 0, 0, 0, 0, 0,0x3259,0x4766, 0, +0x5F27, 0,0x475C, 0, 0, 0, 0,0x5F28, +0x6B22, 0, 0, 0, 0, 0,0x4B53, 0, + 0, 0,0x5F2A, 0,0x5F29, 0,0x3241, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x454A, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F2B, 0, 0, 0, 0, 0, 0, + 0, 0,0x545C, 0, 0, 0, 0, 0, +0x4841, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5F2C, 0, 0, + 0, 0, 0,0x3E70, 0, 0,0x5F2D,0x5627, + 0, 0, 0, 0,0x6A37,0x6B36,0x4A55, 0, +0x587C,0x3844, 0,0x3925, 0, 0,0x3745,0x557E, + 0, 0, 0, 0, 0,0x394A, 0, 0, +0x5027,0x744D, 0, 0,0x3550, 0, 0,0x4374, + 0,0x3E48, 0, 0, 0,0x6B37,0x303D, 0, + 0,0x3D4C, 0,0x4132, 0,0x3156,0x3328, 0, + 0, 0,0x3852,0x4922, 0, 0,0x3658, 0, + 0, 0, 0,0x6B38,0x3E34, 0, 0, 0, +0x4A7D, 0,0x4743, 0,0x557B, 0, 0,0x3773, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4E44, + 0, 0, 0,0x552B,0x3173, 0, 0, 0, +0x6C33,0x305F, 0,0x6C35, 0, 0, 0,0x3637, + 0,0x414F, 0,0x757A,0x5031, 0, 0,0x5565, + 0,0x4E53, 0, 0,0x3D6F,0x3362, 0,0x382B, + 0,0x5536, 0,0x6D3D, 0,0x364F, 0,0x4B39, +0x5042, 0, 0, 0, 0, 0, 0, 0, + 0,0x373D, 0, 0,0x6C36,0x4A29, 0, 0, + 0,0x4554, 0,0x6C39,0x6C38,0x4243,0x6C37, 0, + 0, 0, 0,0x507D,0x6C3A, 0,0x6C3B,0x5765, + 0, 0,0x6C3C, 0, 0, 0,0x6C3D,0x466C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4E5E, 0,0x3C48, 0, 0,0x4855,0x3529,0x3E49, +0x563C,0x5467, 0, 0,0x512E,0x5071,0x6A38,0x6A39, +0x6A3A,0x3A35, 0, 0, 0, 0,0x4A31,0x3F75, + 0, 0,0x4D7A, 0, 0, 0, 0, 0, +0x6A40, 0,0x303A,0x6A3E, 0, 0,0x4025, 0, + 0, 0,0x6A3B, 0,0x327D, 0,0x4377,0x3B68, + 0, 0, 0,0x5257,0x4E74,0x6A3F, 0, 0, + 0,0x6A3C, 0, 0, 0,0x6A43, 0,0x5047, +0x5333, 0, 0, 0, 0,0x343A, 0,0x4341, +0x5772, 0, 0, 0, 0,0x5551, 0,0x4A47, + 0,0x6A45, 0, 0,0x6A44,0x6A47,0x6A46, 0, + 0, 0, 0, 0,0x5667, 0,0x4F54, 0, + 0,0x6A4B, 0,0x3B4E, 0, 0, 0, 0, + 0, 0, 0,0x3D7A,0x494E, 0, 0,0x6A4C, + 0, 0,0x4939,0x4F7E,0x6A4A,0x544E,0x6A4D,0x6A4F, + 0, 0,0x4D6D, 0, 0, 0, 0,0x6A49, + 0,0x6A4E, 0, 0,0x4E6E, 0,0x3B5E, 0, +0x333F, 0, 0, 0, 0, 0,0x4655,0x3E30, +0x4E7A, 0, 0, 0,0x4767, 0,0x3E27,0x6A50, + 0, 0,0x5647, 0, 0, 0,0x4140, 0, + 0, 0,0x545D, 0,0x6A51, 0, 0,0x4F3E, + 0, 0, 0, 0,0x6A52, 0, 0, 0, + 0,0x4A6E, 0, 0, 0, 0,0x452F,0x3035, + 0, 0, 0, 0, 0,0x6A54, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6A53, +0x745F, 0, 0, 0, 0, 0,0x443A, 0, + 0, 0, 0, 0,0x3129, 0, 0, 0, + 0,0x655F, 0, 0, 0, 0,0x6A55, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4A6F, 0,0x6A56,0x6A57,0x4658, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A58, 0, + 0,0x6A59, 0, 0, 0, 0, 0, 0, +0x543B, 0,0x477A,0x5237,0x387C, 0, 0,0x6A42, + 0,0x325C, 0, 0,0x427C, 0,0x5478,0x4C66, +0x576E, 0, 0, 0, 0, 0, 0, 0, +0x5442,0x5350,0x6B43,0x4573, 0,0x377E, 0, 0, +0x6B54, 0, 0, 0,0x4B37,0x6B5E, 0,0x404A, + 0, 0, 0,0x4D7B, 0,0x332F, 0,0x465A, + 0, 0, 0, 0, 0, 0,0x6B7C, 0, +0x443E, 0,0x4E34,0x4429,0x313E,0x547D, 0,0x4A75, + 0,0x566C, 0, 0,0x4653,0x3664, 0, 0, + 0, 0,0x3B7A, 0, 0,0x5060, 0, 0, +0x4931, 0,0x5453,0x4828, 0, 0,0x384B, 0, +0x683E,0x493C, 0, 0,0x683B, 0,0x406E,0x5053, +0x3244,0x3465, 0,0x683C, 0, 0,0x5548, 0, + 0, 0, 0, 0,0x3645, 0,0x683D,0x4A78, +0x385C,0x4C75, 0, 0, 0,0x4034, 0, 0, +0x516E,0x683F,0x6842, 0, 0,0x3A3C, 0,0x312D, +0x3D5C, 0,0x6A3D,0x6843, 0,0x6846, 0,0x684B, + 0, 0, 0, 0,0x684C, 0,0x4B49,0x3065, + 0,0x3C2B, 0, 0,0x3939, 0, 0,0x6841, + 0,0x4D77, 0,0x684A, 0, 0, 0, 0, +0x4E76, 0, 0, 0, 0,0x556D, 0,0x4156, +0x6844, 0,0x4336, 0,0x397B,0x5626,0x6848, 0, + 0, 0,0x4A60,0x5466, 0,0x6840, 0,0x6845, +0x6847, 0,0x4739,0x3763, 0,0x6849, 0,0x3F5D, +0x6852, 0, 0,0x6857, 0,0x6855,0x3C5C,0x3C4F, +0x685B, 0, 0, 0, 0, 0, 0, 0, + 0,0x685E, 0,0x685A,0x317A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3058, +0x4433,0x384C,0x4662,0x483E,0x4861, 0, 0, 0, +0x684F,0x6854,0x6856, 0,0x3971,0x6858,0x5775, 0, +0x447B, 0,0x685C, 0, 0,0x3269, 0, 0, + 0,0x6851, 0, 0,0x3C6D, 0, 0,0x3F42, +0x684D,0x5679, 0,0x4178,0x3271, 0, 0, 0, + 0, 0, 0, 0, 0,0x685F, 0,0x4A41, +0x6859, 0, 0, 0, 0,0x5524, 0,0x316A, +0x553B,0x684E,0x6850,0x3630,0x6853, 0,0x685D,0x4038, + 0,0x4A77, 0,0x4B28, 0, 0,0x465C,0x4075, + 0, 0, 0, 0, 0,0x6869, 0, 0, + 0,0x5023, 0, 0, 0, 0, 0, 0, + 0,0x6872,0x566A, 0, 0, 0, 0, 0, + 0, 0,0x6860,0x6861, 0, 0, 0,0x5179, +0x3A4B,0x3879, 0, 0,0x3871,0x5454,0x686F, 0, +0x686E,0x686C,0x3970,0x4C52,0x6866,0x4E26,0x3F72, 0, +0x3038,0x6871,0x6870, 0,0x5740, 0,0x6864, 0, +0x4D29,0x4923, 0,0x3B38,0x3D5B,0x686A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6862,0x6863,0x6865,0x3535,0x6867,0x4745,0x686B,0x686D, +0x3D30,0x572E, 0,0x6878, 0, 0, 0, 0, + 0, 0, 0, 0,0x6875, 0,0x4D30,0x6876, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x413A, 0,0x6868, 0,0x4337,0x3070, 0, + 0, 0, 0, 0, 0, 0, 0,0x6874, + 0, 0, 0,0x6877, 0, 0, 0,0x3923, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4952, 0, 0, 0,0x434E,0x4E60, +0x4066, 0, 0, 0, 0,0x4B73, 0,0x4C5D, +0x5035, 0, 0,0x4A61, 0,0x6873, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3C6C, 0,0x6879, 0, 0, 0, 0, 0, + 0,0x435E, 0,0x4665, 0,0x3977, 0, 0, + 0, 0,0x3074, 0, 0,0x5758, 0, 0, +0x3C2C, 0,0x456F, 0, 0, 0, 0, 0, +0x4C44, 0, 0,0x6926, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x492D, 0, +0x6922,0x4062, 0, 0, 0,0x3F43, 0, 0, + 0,0x687E,0x3957, 0,0x687B, 0, 0, 0, + 0,0x6924, 0, 0, 0,0x524E, 0, 0, + 0, 0, 0,0x6923, 0,0x5632,0x5735, 0, +0x6927, 0,0x3D37, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x687C, +0x687D, 0, 0, 0,0x6921, 0, 0, 0, + 0, 0, 0, 0, 0,0x4D56, 0, 0, +0x522C, 0, 0, 0,0x6932, 0, 0, 0, + 0,0x6929, 0, 0, 0,0x342A, 0,0x343B, + 0, 0,0x692B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5028, 0, 0,0x6925, + 0, 0,0x337E, 0, 0,0x692C,0x4063, 0, +0x692A, 0, 0,0x6939, 0, 0,0x6938, 0, + 0, 0, 0,0x692E, 0, 0,0x687A, 0, + 0,0x6928, 0, 0, 0, 0, 0,0x3F2C, +0x6931,0x693A, 0, 0,0x4225, 0, 0, 0, +0x692F, 0,0x3845, 0,0x692D, 0,0x535C,0x6934, +0x6935,0x6937, 0, 0, 0,0x6947, 0, 0, + 0, 0, 0, 0,0x4046,0x6945, 0, 0, +0x6930, 0, 0,0x693B,0x3071, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x693C, +0x5525, 0, 0,0x693E, 0,0x693F, 0, 0, + 0,0x6941, 0, 0,0x4171, 0, 0,0x4836, + 0, 0, 0,0x693D, 0, 0, 0, 0, + 0,0x6942, 0, 0, 0, 0, 0, 0, + 0, 0,0x6943, 0,0x6933, 0,0x6936, 0, +0x3B31, 0, 0, 0,0x6940, 0, 0, 0, + 0, 0, 0,0x3C77, 0, 0, 0,0x6944, +0x6946, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x694A, 0, 0, + 0, 0,0x694E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x325B, 0,0x6948, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x372E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x694B, +0x694C, 0, 0, 0, 0, 0, 0,0x5541, + 0,0x4423, 0, 0, 0, 0, 0, 0, +0x6958, 0,0x3A61, 0, 0, 0, 0,0x6949, + 0,0x5323, 0, 0, 0,0x6954, 0, 0, + 0, 0, 0, 0, 0,0x6957,0x6950, 0, + 0, 0, 0, 0,0x694F, 0, 0,0x4741, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6952, 0, 0, 0, 0, 0, 0, 0, +0x6959,0x3348, 0,0x6953, 0, 0, 0, 0, + 0,0x4F70, 0, 0, 0,0x694D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3377, 0, 0, 0, 0, 0, 0, + 0,0x6956, 0, 0,0x695A, 0, 0, 0, +0x4C34, 0, 0, 0,0x4F2D, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6955, 0, +0x695C,0x695B, 0, 0, 0, 0, 0,0x695E, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6951, 0, 0, 0, 0, 0, 0, 0, + 0,0x695D, 0,0x695F,0x434A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4737,0x344E,0x3B36,0x5040,0x6C23, 0, 0,0x4537, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x537B, 0, 0, 0, 0,0x6C24, + 0,0x6C25,0x465B, 0, 0, 0,0x3F6E, 0, + 0, 0, 0,0x6C26, 0, 0,0x6C27,0x502A, + 0,0x4738, 0, 0,0x3868, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6C28, 0, 0, 0, 0, 0, 0, + 0, 0,0x5639,0x557D,0x344B,0x323D,0x4E64,0x4667, + 0, 0,0x4D61, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3475, 0,0x4B40,0x3C5F, 0, 0, 0, + 0,0x6962,0x6963,0x516A,0x6965, 0,0x3479,0x6964, + 0,0x5133,0x4A62,0x3250, 0,0x6968, 0, 0, + 0, 0,0x6966,0x6967, 0, 0,0x5633, 0, + 0, 0,0x6969,0x696A, 0, 0, 0, 0, + 0,0x696B, 0, 0, 0, 0, 0, 0, + 0, 0,0x696C, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C2F,0x4539,0x364E, 0,0x5273, + 0, 0, 0, 0, 0, 0, 0,0x356E, + 0,0x3B59,0x6C31, 0, 0,0x5263, 0, 0, + 0, 0, 0,0x4E63, 0,0x4438, 0,0x433F, + 0, 0,0x363E,0x5839,0x3148,0x314F,0x3151,0x457E, + 0,0x3150, 0,0x432B, 0, 0, 0, 0, + 0,0x5531, 0, 0, 0, 0, 0, 0, + 0, 0,0x6B24,0x3A41, 0, 0, 0,0x4C3A, + 0, 0, 0,0x6B25, 0,0x6B27, 0, 0, + 0,0x6B28, 0, 0, 0,0x6B26, 0, 0, + 0, 0, 0, 0, 0,0x6B29,0x6B2B,0x6B2A, + 0, 0, 0, 0, 0,0x6B2C, 0,0x4A4F, +0x5835,0x4371, 0,0x4325,0x4678,0x6B2D,0x444A, 0, +0x6B2E,0x6B2F,0x6B30,0x3755, 0, 0, 0,0x377A, + 0,0x6B31,0x4762, 0,0x6B33, 0,0x3A24,0x5175, +0x3031,0x6B32,0x6B34, 0, 0, 0,0x352A,0x4248, +0x4768, 0,0x6B35, 0,0x4B2E,0x635F, 0, 0, +0x5340, 0, 0, 0, 0,0x595B, 0, 0, +0x4D21,0x562D,0x4773, 0, 0, 0,0x5960,0x3B63, + 0,0x3A3A,0x6362, 0, 0, 0, 0, 0, +0x4F2B, 0, 0, 0,0x6360,0x4947, 0,0x3A39, + 0, 0, 0,0x5134,0x6361,0x486A,0x392F,0x3D2D, +0x3358,0x4E5B, 0, 0,0x4C40, 0, 0, 0, +0x6368,0x6369,0x4D74, 0, 0, 0, 0, 0, +0x4C2D, 0,0x3C33, 0,0x636A, 0,0x636B, 0, + 0,0x505A, 0, 0, 0,0x467B,0x375A, 0, + 0,0x475F,0x524A,0x4E56, 0,0x6364,0x636C, 0, +0x4972,0x3341, 0, 0,0x6367, 0, 0,0x4663, +0x6365, 0, 0,0x6D33,0x6366, 0, 0, 0, + 0,0x4933, 0,0x4566, 0, 0, 0,0x3935, + 0,0x433B, 0,0x6363,0x453D,0x4124,0x4259,0x3257, + 0,0x636D,0x3B26,0x442D, 0,0x6370,0x3E5A, 0, + 0,0x637B,0x6375,0x3A53, 0, 0, 0, 0, +0x3750,0x534D, 0,0x564E,0x5553,0x3941,0x5534,0x5158, + 0, 0, 0, 0,0x5039,0x4776, 0, 0, + 0,0x482A,0x3234, 0,0x435A, 0, 0, 0, +0x636E, 0, 0,0x637C,0x636F,0x3728,0x6377,0x6374, + 0, 0, 0,0x373A, 0, 0,0x4522, 0, +0x6376,0x455D,0x3228,0x467C, 0,0x4460, 0, 0, +0x5722, 0,0x4061,0x6379, 0, 0,0x637A,0x637D, +0x4C29,0x6373, 0,0x533E, 0,0x3143,0x6D34,0x6371, +0x6372, 0,0x6378,0x503A,0x4643,0x5473,0x637E, 0, + 0,0x3D60, 0, 0,0x6427, 0, 0,0x6426, + 0, 0, 0,0x5173,0x6423, 0,0x6429, 0, + 0, 0,0x4877, 0, 0, 0, 0,0x4F34, + 0,0x6428,0x642E,0x4265, 0, 0,0x3634, 0, + 0, 0, 0, 0, 0,0x3D72, 0,0x6422, + 0, 0,0x3A69,0x642A, 0, 0,0x642C, 0, + 0,0x367D,0x565E,0x6432, 0,0x642D, 0, 0, + 0,0x6421, 0,0x3B6E,0x4D5D,0x4722,0x4549, 0, + 0,0x4177, 0,0x6424, 0,0x4733,0x3D2C,0x3D3D, +0x6425, 0,0x5747,0x3262, 0,0x642B,0x3C43,0x642F, + 0,0x3B6B,0x6430,0x4528,0x6431, 0, 0, 0, + 0,0x5563,0x3F23, 0,0x643A, 0,0x6437, 0, +0x643B, 0, 0,0x643D, 0, 0,0x4656, 0, + 0,0x3A46,0x404B, 0, 0, 0,0x3821,0x6434, + 0, 0, 0, 0,0x5421, 0, 0,0x3A23, +0x3D7E, 0, 0, 0,0x643C, 0, 0, 0, + 0, 0,0x4D3F, 0, 0,0x4479, 0, 0, +0x4F7B,0x4966, 0, 0,0x533F, 0,0x4F51, 0, + 0,0x6433, 0,0x6438,0x6439,0x4C69, 0, 0, + 0, 0, 0,0x4C4E, 0,0x4054,0x6435,0x4130, +0x6436,0x4E50, 0,0x3B41,0x3553, 0,0x4873,0x3D27, +0x5547,0x492C,0x3822,0x644A, 0, 0,0x644C,0x5144, + 0, 0,0x523A, 0, 0,0x3A2D, 0, 0, +0x3A54, 0, 0, 0, 0, 0, 0,0x6443, +0x356D, 0, 0, 0,0x574D,0x6440,0x4F7D,0x643F, + 0, 0, 0,0x415C,0x4C4A, 0, 0, 0, + 0,0x4A67, 0, 0, 0, 0,0x4457, 0, +0x4C54,0x6448, 0, 0, 0,0x6447,0x6441, 0, +0x6444,0x352D, 0, 0,0x5359, 0,0x6446, 0, + 0, 0, 0,0x5279,0x3463, 0,0x3B34, 0, + 0,0x496E, 0,0x343E, 0, 0, 0,0x3B6C, + 0,0x514D, 0,0x4C6D,0x6D35, 0, 0, 0, + 0, 0, 0, 0, 0,0x4765, 0, 0, + 0, 0,0x5428, 0,0x644B,0x5755,0x6442, 0, +0x3D25,0x6445, 0, 0,0x5366, 0,0x6449,0x4978, + 0, 0,0x643E, 0, 0,0x5365, 0, 0, +0x477E,0x3649, 0,0x547C,0x3233,0x6457, 0, 0, + 0,0x4E42, 0,0x644D, 0,0x4E3C, 0,0x385B, + 0, 0,0x6456, 0,0x3F4A, 0, 0, 0, +0x534E, 0,0x436C, 0, 0, 0, 0, 0, + 0, 0, 0,0x4548,0x6458, 0, 0, 0, + 0, 0, 0, 0, 0,0x4D44,0x644F, 0, + 0, 0, 0,0x6454,0x6455, 0,0x3A7E, 0, +0x4F66, 0, 0,0x553F, 0, 0, 0,0x6452, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6450, 0, 0,0x644E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4D65,0x4A2A, + 0, 0, 0,0x4023, 0,0x3D26,0x6453, 0, + 0,0x3848, 0, 0, 0, 0, 0,0x6467, +0x5434, 0, 0, 0, 0, 0, 0, 0, +0x645B, 0, 0, 0,0x416F, 0, 0,0x6469, + 0, 0,0x5267, 0, 0,0x645F, 0,0x6460, + 0, 0,0x4F2A, 0, 0, 0, 0,0x4B5D, + 0,0x645A,0x6451, 0,0x6465, 0,0x485C,0x6463, + 0, 0,0x4467,0x6462, 0,0x6461, 0, 0, + 0,0x337C,0x6468, 0, 0, 0, 0,0x3561, + 0, 0, 0,0x574C, 0, 0, 0,0x6466, + 0,0x3B2C, 0,0x5752,0x4C4F,0x6B78, 0,0x6464, + 0, 0,0x3976, 0, 0, 0,0x564D,0x6459, +0x645C,0x427A,0x645E, 0,0x424B,0x4044,0x4250, 0, +0x3175,0x4C32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x354E, 0, 0, 0, + 0,0x646F, 0, 0, 0, 0, 0, 0, + 0, 0,0x462F, 0, 0, 0,0x4661, 0, + 0,0x6475, 0, 0, 0, 0, 0,0x4229, + 0, 0, 0,0x406C,0x515D,0x646E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x442E, 0, 0, 0,0x646D, 0, 0, 0, + 0,0x6476,0x6474,0x427E, 0,0x645D, 0,0x6470, + 0,0x4A7E, 0,0x5544, 0, 0,0x6471, 0, + 0, 0, 0, 0, 0, 0,0x517A, 0, + 0, 0, 0, 0, 0, 0,0x646B,0x646C, + 0, 0, 0,0x6472, 0,0x4E2B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x454B, 0, 0, 0,0x4731, 0,0x423A, 0, + 0, 0,0x646A, 0, 0, 0,0x414A, 0, + 0, 0, 0, 0, 0,0x4C36,0x3331, 0, + 0, 0,0x647B, 0,0x6473, 0, 0, 0, +0x647A, 0,0x647D, 0,0x647C, 0, 0, 0, + 0, 0, 0, 0,0x334E, 0, 0, 0, +0x333A,0x6477, 0, 0,0x6479,0x6478,0x456C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x403D, 0, 0, 0, + 0,0x5468, 0, 0, 0, 0, 0,0x6522, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3044, 0, 0,0x6524, 0, + 0,0x6523, 0, 0, 0, 0, 0, 0, +0x3C24, 0,0x6525, 0, 0, 0, 0, 0, + 0,0x6521, 0, 0, 0, 0, 0, 0, + 0,0x647E,0x3174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6528, 0, +0x6529,0x6526, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6527,0x652A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4659, 0, 0, 0, 0, 0, 0, + 0, 0,0x652B,0x652D, 0, 0, 0, 0, + 0, 0, 0,0x652C, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x652F, 0, 0, + 0,0x652E, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3960, 0, 0,0x6530, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6531, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3B70,0x6C61,0x4370, 0,0x3546, +0x3B52, 0, 0, 0, 0,0x4169,0x546E, 0, +0x3E44, 0, 0, 0,0x5746, 0,0x5456,0x3253, +0x6C3E, 0, 0, 0, 0,0x6A41, 0, 0, + 0,0x422F,0x3436, 0, 0, 0,0x5157, 0, + 0, 0,0x3334, 0,0x4832,0x3F3B,0x6C40, 0, + 0,0x564B, 0, 0,0x6C3F,0x6C41, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C45,0x3E66,0x4C3F,0x455A,0x3E3C, + 0,0x6C46, 0,0x317E, 0, 0, 0,0x6C44, +0x5528,0x3563, 0,0x6C42,0x4136,0x3363, 0, 0, +0x6C43,0x4B38,0x4043,0x4C7E, 0, 0, 0, 0, +0x4152, 0,0x6C48, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3A66,0x4053, 0,0x5672, 0, 0, 0,0x514C, + 0, 0, 0, 0,0x3F3E, 0,0x3733,0x4955, +0x6C47,0x3B62, 0,0x4C4C,0x3D7D,0x4848, 0,0x4F29, + 0, 0, 0, 0, 0, 0, 0,0x4D69, + 0,0x456B, 0, 0, 0,0x3769, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5149,0x3A38, 0, 0, 0, 0, 0, +0x6C49, 0, 0,0x6C4A, 0,0x3B40,0x6C4B, 0, +0x6C62,0x313A,0x3759, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3D39, 0, + 0, 0, 0, 0, 0, 0, 0,0x6C4C, +0x5166,0x6C4D, 0, 0, 0, 0,0x483B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C51, 0, 0, + 0, 0,0x6C53, 0,0x3B4D, 0,0x3C65, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6C4F, 0,0x4937, 0, + 0, 0, 0, 0,0x433A, 0,0x6C63,0x5555, +0x6C50, 0, 0, 0, 0, 0,0x5673, 0, + 0, 0,0x6C52,0x6C4E, 0, 0, 0, 0, +0x6C54, 0,0x6C55, 0, 0,0x493F, 0, 0, + 0, 0, 0, 0,0x4F28, 0, 0, 0, + 0, 0,0x505C, 0, 0, 0, 0,0x512C, + 0, 0, 0, 0,0x485B, 0, 0, 0, +0x6C56,0x4E75, 0, 0, 0, 0, 0,0x4A6C, +0x6C5A, 0, 0, 0, 0, 0, 0, 0, +0x6C59, 0, 0, 0,0x303E, 0, 0, 0, + 0, 0, 0,0x6C57, 0,0x6C58, 0, 0, + 0,0x6C64, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x483C, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4147, 0, + 0, 0, 0, 0,0x6C5C,0x5160, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C5B, 0, 0, 0, 0,0x546F, 0,0x6C5D, + 0, 0, 0, 0, 0, 0,0x5B46, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6C5E, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x312C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C5F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C60, 0,0x5726, 0,0x4540, 0, 0, 0, +0x6B3C,0x302E, 0, 0, 0,0x3E74,0x3838,0x522F, +0x3056,0x3579, 0,0x5833, 0,0x4B2C, 0,0x635D, + 0, 0, 0, 0, 0, 0, 0,0x462C, +0x3066, 0, 0, 0,0x4546,0x6B39, 0, 0, + 0, 0,0x6B3A, 0, 0, 0,0x6B3B, 0, + 0,0x5140, 0,0x4523, 0,0x6A72, 0,0x4432, + 0,0x4435,0x404E, 0, 0, 0,0x6A73,0x4441, + 0,0x4E6F, 0, 0, 0, 0,0x6A70,0x6A74, + 0, 0,0x497C, 0, 0,0x4723, 0, 0, + 0,0x4C58,0x4E7E, 0, 0, 0,0x6A75,0x6A76, +0x4F2C,0x4067, 0, 0,0x6A77, 0, 0, 0, + 0, 0,0x363F,0x6A78, 0,0x6A79, 0,0x6A7A, + 0, 0,0x6A7B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6A71, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x482E,0x616B, 0,0x3738, +0x616C, 0, 0, 0,0x616D, 0,0x5734,0x616E, +0x616F,0x534C, 0, 0, 0, 0, 0, 0, + 0,0x6171,0x3F71,0x6170,0x3552, 0, 0, 0, +0x3137, 0, 0, 0, 0,0x6173,0x6172, 0, +0x3A7C, 0,0x6174, 0, 0, 0, 0,0x3937, + 0,0x3E51, 0, 0, 0, 0,0x447C, 0, +0x3A5D,0x3D46, 0, 0, 0, 0, 0, 0, +0x6175,0x6177, 0, 0,0x3640,0x4F41,0x4A28,0x6176, +0x5578,0x537C,0x6178,0x617C,0x6179, 0, 0,0x617A, +0x406A, 0,0x617E,0x6221,0x4047, 0, 0, 0, + 0,0x617B, 0,0x617D, 0, 0, 0, 0, + 0, 0,0x6225, 0, 0, 0,0x4154, 0, + 0, 0, 0,0x6223, 0,0x6228,0x327E,0x6222, + 0, 0, 0,0x434D,0x3242,0x6227,0x6226, 0, + 0,0x6224,0x6229, 0, 0,0x622B, 0, 0, + 0,0x5049,0x566D,0x4328,0x622C, 0,0x4F57, 0, + 0,0x622E, 0, 0,0x3A6F, 0, 0,0x6960, +0x622D,0x622A, 0, 0, 0, 0,0x3B2B,0x5433, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6230, 0, 0, +0x622F, 0,0x6961, 0, 0, 0, 0,0x6231, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6232, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6233,0x4C21, 0,0x6234, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6235, 0, + 0, 0, 0, 0,0x507E, 0, 0,0x424A, + 0,0x5371, 0,0x4D75, 0, 0,0x6760, 0, + 0,0x6761, 0, 0, 0, 0,0x3E41, 0, + 0, 0, 0,0x426A, 0, 0, 0,0x6764, + 0, 0,0x6763, 0, 0, 0, 0, 0, + 0,0x4D66, 0,0x4335, 0, 0,0x6762,0x3B37, +0x4F56, 0,0x4161,0x6769, 0, 0, 0,0x6768, + 0, 0,0x6774,0x3223, 0, 0, 0, 0, +0x676A, 0,0x6766, 0, 0, 0, 0, 0, +0x676C,0x676B,0x493A, 0, 0,0x5564, 0,0x6765, +0x3729,0x6767, 0, 0, 0, 0, 0, 0, + 0,0x676E, 0, 0, 0, 0,0x6773, 0, +0x5669, 0, 0, 0, 0,0x676D, 0,0x6772, + 0,0x6771, 0, 0, 0,0x3060, 0, 0, + 0, 0,0x6775, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4772, 0,0x4045,0x406D, 0, + 0,0x4170,0x6770, 0, 0, 0, 0,0x6776, +0x4B76, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6822,0x6821, 0, 0, 0, 0, + 0, 0,0x5741, 0, 0,0x677A,0x6779, 0, +0x677B, 0,0x6777, 0,0x677E, 0,0x677D, 0, +0x677C, 0, 0,0x4155,0x4759,0x457D,0x4543, 0, + 0, 0, 0, 0,0x476D, 0, 0, 0, + 0,0x6823, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6826, 0,0x6825, + 0,0x6827,0x3A77,0x6778,0x6824, 0,0x4870,0x492A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6829, 0, 0, +0x3965, 0, 0, 0, 0, 0,0x517E,0x6828, + 0, 0, 0, 0, 0, 0,0x682A, 0, +0x682D,0x682E, 0,0x4127, 0, 0, 0,0x682F, + 0, 0, 0,0x6830, 0, 0,0x682C, 0, +0x6834, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x682B, 0,0x6831, 0, + 0, 0, 0, 0, 0, 0, 0,0x6835, +0x6832,0x6833, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6837, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6836, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x394F, 0,0x702C, 0, +0x702D, 0,0x4630,0x306A,0x483F, 0,0x4D5F, 0, + 0, 0, 0, 0, 0, 0,0x4E4D,0x6A31, + 0, 0, 0, 0,0x6A32, 0,0x463F,0x3449, + 0, 0, 0, 0, 0, 0, 0,0x6A33, + 0, 0, 0, 0,0x5567, 0, 0, 0, + 0, 0, 0, 0, 0,0x5D79, 0,0x6A34, + 0,0x6A35, 0,0x6A36, 0, 0, 0, 0, +0x384A,0x5F30,0x4975, 0,0x4C70, 0, 0,0x497A, + 0, 0, 0, 0, 0,0x497B, 0, 0, +0x5343,0x4B26, 0,0x3826,0x702E,0x3142, 0,0x6538, +0x4C6F,0x5349,0x3C57,0x496A, 0,0x3567, 0,0x4450, +0x3569, 0,0x6E2E,0x3B2D, 0, 0,0x675E, 0, +0x6E2F, 0, 0, 0, 0,0x3329, 0, 0, +0x6E32, 0, 0,0x6E31,0x3D67, 0,0x6E30,0x4E37, + 0, 0, 0, 0,0x454F, 0, 0, 0, + 0,0x4174,0x5B4E,0x6E33,0x5073, 0, 0, 0, + 0, 0, 0, 0, 0,0x4254,0x4668, 0, + 0, 0,0x372C, 0, 0, 0, 0, 0, + 0, 0,0x6E34, 0,0x336B, 0, 0, 0, +0x3B7B,0x6E35, 0, 0, 0, 0, 0,0x675C, + 0, 0, 0,0x6E36, 0, 0,0x3D2E, 0, + 0, 0, 0,0x7162, 0, 0, 0,0x4A68, + 0,0x5249,0x705A, 0,0x705B, 0,0x705C,0x4146, + 0,0x386D,0x3E4E, 0, 0,0x705E, 0,0x4531, +0x705D,0x5171, 0,0x7060,0x304C,0x3D6A, 0, 0, + 0, 0, 0,0x525F,0x705F, 0,0x342F,0x3768, +0x7066,0x7065,0x4623,0x7061,0x7062,0x3443, 0, 0, +0x7063,0x556E, 0, 0,0x4C5B,0x3E52,0x3C32, 0, + 0, 0,0x7068,0x7067,0x7064,0x3221, 0,0x5622, +0x5338,0x3E37,0x482C, 0, 0,0x706A, 0, 0, + 0, 0,0x5177, 0,0x564C,0x3A5B,0x7069, 0, +0x363B, 0, 0,0x4D34, 0, 0,0x4626, 0, + 0, 0,0x4121,0x706B,0x706E, 0,0x706D,0x7070, +0x706C, 0,0x3B3E,0x706F, 0, 0, 0, 0, +0x4C35,0x7072, 0, 0,0x3355, 0, 0, 0, + 0,0x3154, 0, 0,0x7073, 0, 0,0x7074, +0x7076,0x3461, 0,0x7071, 0,0x7077, 0, 0, + 0, 0,0x707A, 0,0x7078, 0, 0, 0, +0x7075, 0, 0, 0, 0,0x707D, 0,0x7079, +0x707C,0x707E, 0,0x7121, 0, 0, 0,0x4E41, +0x7124, 0,0x7123, 0,0x4176,0x707B,0x4A5D, 0, + 0,0x3471,0x3171,0x4C31, 0,0x7126, 0, 0, +0x7127, 0, 0,0x712C,0x554E,0x7129, 0, 0, +0x4833, 0, 0, 0,0x7122, 0,0x712B,0x7128, +0x7125, 0, 0,0x712A, 0, 0, 0, 0, + 0, 0, 0, 0,0x3029,0x712D, 0, 0, + 0, 0, 0, 0,0x712F, 0,0x7131, 0, + 0, 0, 0, 0,0x7130, 0,0x712E, 0, + 0, 0, 0,0x5122, 0, 0, 0, 0, + 0, 0, 0,0x7132, 0, 0, 0,0x7133, + 0, 0, 0, 0, 0, 0, 0, 0, +0x396F, 0, 0,0x3547, 0,0x3057,0x3059, 0, + 0, 0,0x546D, 0,0x3544, 0,0x3D54,0x3B4A, +0x7027, 0, 0,0x385E, 0, 0,0x7028, 0, + 0,0x3028, 0,0x7029, 0, 0,0x4D6E, 0, + 0,0x702A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x702B, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4624, 0, + 0,0x5665,0x7164, 0,0x7165, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4373, + 0, 0,0x535B, 0, 0,0x5651,0x4568, 0, +0x532F, 0,0x5266, 0, 0,0x6E41,0x303B,0x5535, +0x514E,0x3C60,0x3A50, 0,0x3F78, 0,0x3847,0x3541, +0x454C, 0, 0,0x4A22, 0, 0, 0,0x434B, + 0, 0, 0, 0, 0,0x6E42, 0, 0, + 0, 0, 0, 0, 0, 0,0x443F,0x3622, + 0,0x6D6C,0x4324, 0,0x5631, 0, 0, 0, +0x4F60,0x6D6F, 0, 0,0x454E, 0,0x365C, 0, + 0,0x4A21, 0, 0,0x6D6D, 0, 0,0x6D70, +0x6D71,0x433C, 0,0x3F34, 0,0x6D6E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6D74,0x6D72, 0, 0, 0, 0,0x5566, +0x435F, 0,0x6D73, 0, 0, 0,0x6D76, 0, +0x5523,0x5123, 0, 0, 0,0x6D75, 0,0x4350, + 0, 0, 0, 0, 0,0x6D77,0x3F74,0x3E6C, +0x6D78, 0,0x4C77, 0,0x515B, 0, 0, 0, +0x5745,0x5576, 0,0x6D7C, 0, 0, 0,0x6D7B, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6D79,0x6D7A, 0, 0, 0, 0, 0, 0, + 0, 0,0x6D7D,0x3E26, 0, 0, 0, 0, + 0,0x4B2F,0x6E21,0x363D, 0,0x6E22,0x4440, 0, +0x6D7E, 0, 0,0x3D5E,0x3247, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3643, 0, 0, 0,0x6E25,0x583A,0x6E23, +0x6E26, 0, 0, 0,0x4369,0x3372, 0, 0, + 0, 0, 0, 0,0x6E27,0x6E24,0x4F39, 0, + 0,0x6E28,0x4277, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6E29, +0x6E2A, 0,0x5E2B, 0, 0,0x4633, 0,0x4746, + 0,0x5675,0x3549, 0,0x4B32, 0, 0, 0, +0x6E2B, 0, 0,0x4D2B, 0,0x6E2C, 0, 0, + 0, 0, 0,0x5530, 0,0x6E2D, 0,0x7644, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5B47, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3423, + 0, 0, 0,0x432C,0x7166, 0, 0, 0, + 0, 0,0x4A38,0x5253, 0,0x562A, 0,0x6F72, + 0,0x3E58, 0,0x3D43,0x6F73,0x364C,0x302B, 0, + 0, 0, 0,0x4A2F, 0, 0,0x6D36, 0, +0x6D37, 0, 0, 0, 0,0x4E79,0x372F,0x3F73, +0x6D38,0x426B,0x4930, 0, 0, 0, 0, 0, + 0,0x6D39, 0, 0,0x4676,0x3F33, 0, 0, + 0,0x6D3C,0x4578, 0,0x5150, 0,0x5729,0x6D3A, +0x6D3B, 0,0x5162, 0,0x6D3F,0x6D40, 0,0x6D44, + 0, 0, 0,0x6D48, 0,0x6D46,0x6D4E,0x5568, + 0,0x6D49, 0, 0,0x6D47,0x6D3E, 0, 0, +0x4569, 0, 0, 0,0x4646, 0, 0,0x4969, +0x5452,0x6D41,0x6D42,0x6D43,0x6D45, 0,0x4079, 0, +0x3421, 0, 0, 0, 0,0x3968, 0,0x6D50, + 0, 0, 0, 0,0x6D51, 0,0x6D4A, 0, +0x6D4F, 0,0x4E78, 0, 0,0x4B36,0x6D4C,0x6D4D, + 0, 0, 0, 0, 0,0x4F75, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6D52,0x4172,0x5332,0x6D4B,0x4837, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C6F, + 0, 0, 0, 0,0x4570, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6D56, + 0,0x356F, 0, 0,0x4235,0x302D,0x4B69, 0, + 0,0x312E, 0,0x6D54, 0, 0, 0,0x4D6B, +0x3562, 0,0x6D55,0x6D53,0x6D57, 0, 0,0x357A, + 0,0x6D58, 0,0x6D59, 0,0x6D5C, 0,0x314C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4576,0x3C6E,0x6D5A,0x4C3C,0x326A, 0, 0, 0, + 0,0x6D5B, 0, 0, 0, 0,0x446B, 0, + 0,0x3445, 0, 0, 0,0x3075, 0, 0, + 0,0x6D5F,0x405A,0x3468, 0, 0, 0, 0, +0x454D, 0, 0, 0,0x6D5D,0x3F44, 0, 0, + 0,0x6D5E, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4425, 0, 0, 0,0x6D60, 0, 0, 0, + 0, 0,0x6D61, 0,0x6D63, 0, 0,0x4157, + 0, 0,0x3B47, 0, 0, 0, 0, 0, + 0,0x3D38, 0, 0, 0,0x6D62, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6D64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D66, 0, + 0, 0, 0, 0,0x6D65, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6D67, 0, 0, 0, + 0, 0,0x4A3E,0x6C6A,0x4071, 0,0x4967, 0, +0x6C6B,0x466E, 0, 0, 0, 0,0x6C6C, 0, +0x466D,0x6C6D, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C70, 0, 0,0x5766,0x6C73, + 0, 0,0x6C71,0x6C6E,0x6C6F,0x5723,0x4971,0x4B6E, +0x6C74, 0,0x6C72, 0, 0,0x4F69, 0,0x6C76, +0x4631, 0, 0, 0, 0,0x3C40, 0,0x6C75, + 0, 0, 0, 0, 0, 0, 0,0x353B, +0x3B76, 0,0x6C77, 0, 0, 0, 0, 0, +0x5977,0x3D7B, 0, 0,0x423B,0x6C78, 0, 0, + 0, 0,0x6C79, 0, 0, 0, 0,0x3823, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6C7A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6C7B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C7C, 0, 0, 0, 0, + 0,0x536D,0x582E,0x406B, 0,0x475D,0x3A4C, 0, +0x5063,0x4B3D, 0,0x4D3A, 0, 0,0x3851, 0, + 0,0x317C, 0,0x476F, 0,0x5656, 0, 0, + 0,0x3F46,0x436B, 0, 0,0x6F75, 0, 0, +0x4358, 0, 0, 0, 0, 0, 0,0x5762, + 0, 0, 0,0x6F77,0x3353, 0,0x4758,0x516D, + 0,0x5648, 0,0x6F78, 0,0x6F76, 0,0x3B7D, +0x3346, 0, 0, 0, 0, 0, 0, 0, +0x3D55, 0, 0,0x5246, 0,0x3B60, 0, 0, +0x4F21, 0,0x6F7C,0x6F7B, 0, 0,0x6F79, 0, + 0, 0, 0,0x334C, 0,0x4954,0x4B30, 0, + 0, 0, 0, 0,0x6F7E, 0, 0,0x305E, + 0, 0,0x5649, 0, 0, 0,0x6F7D, 0, +0x336D, 0, 0,0x7655, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4E48, 0, 0, 0,0x7022, + 0,0x7021, 0,0x353E,0x3C5A,0x3B7C, 0,0x3865, + 0, 0, 0, 0, 0, 0,0x4442, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7023, 0, 0, 0, 0, 0,0x4B6B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7026, 0, 0, 0,0x5128, 0,0x3E3F,0x476E, +0x7136,0x7137,0x3F55, 0, 0, 0, 0,0x3429, +0x7138,0x4D3B, 0,0x4754,0x552D, 0,0x7139, 0, +0x713A, 0, 0, 0, 0,0x474F, 0, 0, + 0,0x5224,0x564F, 0, 0,0x713B,0x3D51,0x3430, +0x3E3D, 0, 0, 0,0x345C,0x4E51, 0,0x3F5F, +0x713D, 0, 0, 0, 0,0x3F7A,0x713C, 0, +0x713F, 0, 0, 0,0x713E,0x7140, 0, 0, + 0, 0, 0,0x7141, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x417E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4122, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A7A, 0, + 0,0x553E, 0, 0, 0, 0,0x3E3A,0x3E39, +0x5542, 0, 0,0x3F22, 0,0x4D2F,0x7135, 0, + 0, 0, 0, 0, 0,0x3D5F, 0,0x364B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5671,0x7343, 0, 0,0x7344, 0,0x384D, + 0, 0, 0,0x7346,0x7347, 0,0x304A, 0, +0x7345, 0,0x7349,0x4B71, 0, 0, 0,0x734B, + 0,0x5026, 0, 0,0x314A,0x7348, 0, 0, + 0,0x734F, 0,0x3551, 0, 0,0x7357, 0, +0x7352, 0, 0, 0,0x7354,0x7353,0x377B, 0, +0x313F, 0,0x734E,0x734A,0x355A, 0,0x7350, 0, + 0,0x7351, 0,0x7355, 0, 0, 0, 0, +0x734D, 0,0x3C63, 0,0x417D, 0,0x7356, 0, + 0, 0, 0, 0, 0,0x735A, 0,0x734C, + 0,0x3548, 0,0x3D6E,0x735C, 0, 0,0x3724, +0x3F70,0x567E,0x4D32, 0,0x3470, 0,0x325F, 0, +0x7358, 0,0x7359,0x4938, 0,0x735D, 0, 0, +0x735E, 0,0x7361, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x735F, 0, + 0,0x7363,0x7362, 0, 0,0x735B, 0,0x3F6A, + 0,0x336F, 0,0x7360, 0, 0,0x4729, 0, +0x3C72, 0, 0, 0, 0,0x736B, 0, 0, + 0, 0, 0, 0, 0,0x393F, 0, 0, +0x7364, 0, 0, 0,0x322D,0x3B7E, 0,0x4B63, + 0, 0, 0, 0,0x736D,0x7369, 0, 0, + 0,0x395C,0x736E, 0, 0, 0,0x7365,0x7366, +0x736A,0x4261,0x736C,0x736F,0x7368,0x3C7D, 0, 0, + 0,0x4F64, 0, 0,0x7370, 0, 0, 0, +0x7367, 0, 0, 0, 0, 0, 0, 0, + 0,0x7372, 0, 0, 0, 0,0x572D,0x462A, + 0, 0, 0, 0,0x7373, 0, 0, 0, + 0,0x7371, 0,0x4228, 0, 0, 0, 0, + 0,0x385D,0x7375, 0, 0,0x7374, 0, 0, + 0,0x345B, 0, 0, 0,0x7376,0x7377, 0, + 0, 0,0x7378, 0, 0, 0,0x403A, 0, + 0,0x4069, 0, 0, 0, 0, 0,0x4571, + 0, 0, 0, 0,0x737B, 0,0x737A, 0, + 0, 0, 0, 0, 0, 0, 0,0x3458, + 0, 0, 0,0x737E,0x7379, 0, 0,0x737C, + 0, 0, 0, 0, 0, 0,0x737D, 0, + 0, 0, 0, 0, 0, 0, 0,0x7421, + 0, 0, 0, 0, 0, 0,0x7423,0x3B49, + 0, 0,0x7422, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7424, 0, 0, 0, 0, 0, 0,0x323E, +0x7426,0x7425, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3C2E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4357,0x5961, 0, 0, 0, + 0, 0, 0,0x4060,0x744C,0x5751, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x375B, 0, 0, 0, 0, 0, 0, + 0,0x744E,0x4123, 0, 0,0x4649, 0,0x3456, +0x5533, 0, 0, 0,0x7450,0x744F,0x7451,0x4B5A, + 0, 0,0x7452, 0,0x5441,0x5660, 0, 0, + 0, 0,0x3760, 0, 0, 0,0x4138, 0, + 0,0x413B,0x7453,0x3E2C, 0, 0, 0, 0, + 0,0x3462, 0, 0,0x7454,0x7455,0x3E2B, 0, + 0,0x7456, 0, 0, 0,0x745B, 0,0x7457, +0x745A, 0,0x3A7D, 0,0x7458,0x7459, 0, 0, + 0, 0, 0, 0, 0,0x3862,0x4C47,0x745C, + 0,0x325A, 0, 0,0x4353, 0, 0,0x5463, +0x3F37, 0, 0, 0, 0, 0, 0, 0, +0x745D, 0, 0, 0, 0, 0, 0,0x4534, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7469, 0, 0,0x4F35, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4E49, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4B58, 0,0x4B77, 0, 0, 0, 0,0x3D74, + 0, 0, 0,0x574F, 0, 0, 0,0x405B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5075, 0, + 0, 0, 0, 0, 0, 0, 0,0x746A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x746B, 0, + 0, 0, 0, 0, 0, 0,0x746C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x7763, 0, 0, 0, 0, + 0,0x3731, 0, 0, 0, 0, 0,0x746D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x576B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x746E, 0, 0, 0,0x6679, +0x3E40,0x667A,0x3A6C,0x667B,0x4F4B,0x667C,0x543C,0x3C36, +0x667D,0x667E,0x3C4D,0x4852,0x4E33,0x6721, 0,0x343F, +0x6722,0x4934,0x3859,0x4449, 0,0x575D,0x425A,0x3757, +0x563D,0x4E46,0x3744, 0, 0,0x4526,0x6723,0x4F5F, +0x6724,0x6725,0x6726,0x4137,0x5769,0x4970,0x4F38,0x562F, +0x5655,0x6727,0x306D,0x6728,0x6729,0x495C,0x526F,0x3E2D, +0x672A,0x3073,0x485E,0x3D61,0x672B,0x4846, 0,0x672C, +0x3B66,0x3878,0x5124,0x672D,0x4267,0x3E78,0x3D4A,0x4D33, +0x672E,0x672F,0x3E6E,0x5065, 0,0x4B67,0x4C50,0x3C4C, +0x6730,0x3C28,0x5077,0x6731, 0,0x5078,0x6732,0x6733, +0x3442,0x6734,0x6735,0x497E,0x4E2C,0x4360,0x6737,0x3141, +0x3371, 0,0x6738,0x6739,0x575B,0x5540,0x673A,0x424C, +0x573A,0x673B,0x673C,0x673D,0x3C6A,0x4365,0x4042,0x673E, +0x673F,0x3C29, 0,0x6740,0x6741,0x6736,0x3650,0x6742, + 0,0x6743,0x6744,0x3B3A,0x355E,0x4246,0x3160,0x6745, +0x5435,0x6746,0x383F,0x6748,0x6747,0x376C, 0,0x6749, +0x3278,0x674A,0x674B,0x674C,0x674D,0x674E,0x674F,0x6750, +0x5327,0x4B75,0x6751,0x6752,0x6753,0x6754,0x4949,0x6755, +0x6756,0x6757,0x6758,0x6759,0x3D49,0x675A,0x733E, 0, +0x3857, 0,0x4831, 0, 0, 0, 0, 0, + 0, 0,0x733F, 0,0x7340,0x7341, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x395E,0x4D78, 0, 0,0x5868,0x3A31, 0,0x425E, +0x6E37, 0,0x3723, 0, 0, 0, 0,0x6E39, + 0,0x6E38,0x3055, 0, 0, 0, 0, 0, +0x6E3B,0x5556,0x576F, 0, 0, 0,0x5643, 0, + 0,0x6E3D,0x4A70, 0,0x6E3C, 0, 0, 0, + 0,0x6E3E, 0, 0, 0, 0,0x6E40, 0, + 0,0x6E3F, 0, 0, 0, 0, 0, 0, + 0, 0,0x5172, 0,0x473C, 0,0x4340, 0, + 0, 0, 0, 0,0x3861, 0, 0, 0, + 0, 0,0x4167, 0, 0,0x7446,0x505F,0x7447, + 0,0x4F5B, 0, 0,0x483A, 0, 0,0x7448, + 0, 0, 0, 0, 0, 0, 0,0x7449, +0x744A, 0,0x744B, 0, 0, 0, 0, 0, +0x597A,0x387E, 0, 0,0x6571,0x5370, 0,0x7460, + 0,0x4E4C, 0, 0, 0,0x3361, 0, 0, + 0, 0,0x7134, 0,0x526E, 0,0x7461, 0, + 0, 0, 0, 0,0x4F68,0x7462, 0, 0, +0x474C, 0, 0, 0, 0, 0, 0,0x3554, +0x3464,0x7464, 0, 0, 0,0x7463,0x7465, 0, + 0,0x7466, 0, 0, 0, 0,0x7467, 0, +0x3A32,0x303F, 0,0x7468, 0, 0, 0, 0, + 0, 0, 0,0x372D,0x526D, 0, 0, 0, +0x522B,0x404F, 0,0x3F3C,0x6B23,0x555F,0x6A48, 0, + 0, 0, 0,0x7173,0x3678,0x4B23, 0, 0, +0x444D, 0,0x7167, 0,0x7168,0x387B,0x7169,0x3A44, +0x5445,0x3052, 0, 0,0x716A, 0, 0, 0, +0x716B, 0,0x716C, 0, 0,0x716D,0x716E,0x716F, +0x7171,0x7170,0x4555, 0, 0, 0, 0, 0, + 0,0x7172, 0,0x367A, 0,0x7174,0x522E,0x5E47, +0x4B4A, 0, 0,0x335C, 0,0x3522, 0,0x3922, + 0, 0,0x4474,0x7175, 0, 0,0x7176, 0, + 0, 0,0x4144,0x417B,0x5630,0x7177, 0, 0, + 0, 0,0x7178, 0,0x412A, 0, 0, 0, +0x4638, 0,0x3E5B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7179,0x344F, 0, 0, 0, 0, 0, + 0,0x717A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6D32, +0x6D31, 0, 0,0x4B60,0x525E, 0,0x4B41,0x5558, + 0,0x4862, 0,0x405F,0x3C21, 0, 0, 0, + 0, 0, 0,0x6B41, 0, 0,0x5024, 0, +0x5662, 0,0x3647,0x3858,0x6B40,0x384E, 0,0x6B3F, +0x3326,0x3949,0x562B, 0,0x3774,0x374A, 0, 0, + 0,0x3C67,0x373E,0x6B46, 0,0x6B47,0x3039,0x3F4F, + 0,0x6B45,0x537D, 0,0x6B48, 0, 0,0x6B49, + 0, 0,0x374E, 0,0x6B42,0x6B44,0x4976,0x5657, +0x554D,0x5032,0x6B4F,0x4E38,0x6B50, 0,0x3528, 0, + 0, 0, 0, 0,0x3133,0x6B52,0x4C25, 0, + 0, 0, 0, 0, 0, 0,0x4556,0x6B53, + 0,0x6B51,0x455F,0x6B4E,0x4A24,0x6B55,0x307B, 0, + 0,0x3A7A, 0, 0,0x5837,0x7163, 0,0x6B4A, +0x6B4B,0x6B4C,0x6B4D,0x6B56,0x6640,0x6B59, 0,0x3F68, +0x5248,0x6B57,0x6B5C,0x386C,0x6B58, 0,0x3D3A, 0, +0x5058, 0,0x3037, 0,0x6B5D,0x445C, 0, 0, + 0, 0,0x562C, 0, 0, 0,0x3460, 0, + 0,0x4276,0x3C39, 0, 0,0x6B5A,0x6B5B,0x5460, +0x466A,0x4454,0x6B5F,0x4527,0x5975, 0,0x3231, 0, +0x6B64, 0,0x3D45, 0, 0, 0,0x6B62, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6B63, 0, 0,0x382C, + 0,0x4D51,0x6B65, 0, 0, 0,0x6B61, 0, +0x4133, 0, 0, 0, 0, 0,0x4622, 0, + 0, 0, 0, 0, 0, 0,0x4C73, 0, +0x6B66, 0,0x4030,0x5238,0x6B67, 0, 0, 0, +0x382F,0x382D, 0,0x6B68,0x473B,0x4D73, 0, 0, + 0,0x6B6A,0x6B6B, 0, 0, 0, 0, 0, +0x6B6D, 0, 0, 0, 0,0x5048, 0,0x6B72, + 0,0x6B6E, 0, 0, 0,0x6B71,0x4879, 0, +0x517C,0x6B6C, 0, 0,0x6B69, 0, 0, 0, + 0,0x3839,0x4F59,0x4465,0x6B6F,0x6B70,0x4C5A,0x4D48, +0x3072, 0,0x6B76, 0, 0, 0, 0, 0, +0x6B75, 0,0x3232, 0, 0, 0, 0,0x3860, + 0,0x6B77, 0, 0, 0, 0, 0, 0, +0x316C, 0, 0,0x4C45,0x4424,0x4F25, 0, 0, + 0, 0, 0,0x6B79, 0, 0,0x6C22, 0, +0x4572, 0,0x6B7A, 0, 0, 0, 0, 0, + 0, 0, 0,0x4945, 0, 0, 0, 0, + 0, 0,0x625F,0x6B7E, 0, 0, 0, 0, +0x4D4E,0x6C21,0x315B,0x5337, 0, 0,0x525C, 0, + 0, 0,0x6B7D, 0,0x6B7B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x333C, 0, 0, 0,0x6A30, + 0, 0,0x5754, 0,0x742B,0x3374, 0, 0, + 0, 0, 0,0x5641,0x5642, 0, 0, 0, + 0, 0, 0,0x5569,0x3E4A, 0,0x7427, 0, +0x5228,0x7428,0x7429, 0,0x742A,0x3E4B,0x535F, 0, + 0, 0, 0, 0,0x4960,0x4961, 0, 0, +0x7342, 0,0x4A66, 0,0x4C72, 0, 0, 0, + 0, 0, 0,0x6236,0x4B34, 0,0x4E68,0x565B, + 0,0x742D,0x742E,0x742F, 0, 0, 0, 0, +0x7432, 0,0x3A3D,0x7433,0x3063,0x7430, 0,0x7431, +0x3D22,0x3255, 0,0x7436,0x7437,0x3666,0x3230,0x4F4F, +0x7434,0x342C, 0,0x7435, 0, 0,0x7438, 0, + 0, 0, 0, 0,0x7439, 0, 0,0x4D27, + 0,0x743A, 0,0x743B, 0, 0, 0,0x743C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4B52, 0,0x743D, 0, 0, 0, 0,0x743E, + 0, 0, 0, 0, 0, 0, 0, 0, +0x743F, 0, 0, 0, 0, 0,0x745E,0x413C, +0x3C68, 0,0x492B,0x515E,0x6575, 0, 0, 0, + 0,0x5C33,0x5255, 0, 0,0x5C34,0x302C,0x5C35, + 0, 0,0x3D5A, 0,0x5C39, 0, 0, 0, +0x5842, 0,0x5C37,0x5373, 0,0x4956,0x5C3A,0x5C36, + 0,0x5C3B,0x4322, 0, 0, 0, 0,0x5C3C, +0x5C45,0x5C3D, 0, 0,0x4E5F,0x5625, 0,0x5C4F, + 0,0x5C4D, 0, 0,0x5C52,0x3D66,0x422B, 0, +0x5C38,0x5C4B,0x5C4E,0x5C3E,0x3752,0x3045,0x5C47,0x503E, +0x5C41,0x3B28, 0,0x373C,0x5C4C, 0, 0,0x5C46, +0x5C3F,0x475B, 0, 0, 0,0x513F,0x5C40, 0, + 0,0x5C4A, 0, 0,0x5C50, 0, 0,0x4E2D, +0x5C42, 0,0x5C43,0x5C48,0x5C49,0x3254,0x5C51,0x4B55, + 0,0x5437,0x5C5B,0x5C5F,0x4C26,0x5C66, 0,0x4367, +0x5C5C, 0, 0,0x3F41,0x5C59, 0,0x307A,0x3936, +0x5C65,0x5C53, 0,0x5C44,0x5C56,0x4874,0x3F60, 0, + 0, 0, 0,0x493B, 0, 0, 0,0x313D, + 0,0x5322, 0, 0,0x5C5A, 0, 0,0x5C55, + 0,0x463B, 0,0x5C5E, 0, 0, 0, 0, + 0,0x5742,0x432F,0x3736,0x4751,0x4329,0x5C62,0x5C58, +0x5C6B,0x5C54, 0, 0,0x5C5D, 0,0x3E25,0x5C57, + 0,0x5C60, 0, 0,0x5C63,0x5C64, 0,0x5C78, + 0, 0,0x5C61,0x5D22,0x5C67, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C6B, +0x3444, 0, 0,0x4323,0x3267,0x5C7A, 0,0x5C72, + 0,0x5C6F, 0,0x5C7C,0x5C6E,0x5270,0x3268, 0, +0x4857,0x4863,0x5C7B, 0,0x5C6D, 0, 0, 0, +0x5C77, 0, 0,0x5C75, 0, 0,0x3E23,0x5C74, + 0,0x325D, 0, 0, 0, 0, 0,0x5C73, +0x3C76,0x5C68,0x3B44, 0,0x4073, 0, 0, 0, + 0, 0,0x3C54,0x5C69,0x5C6A, 0,0x5C71,0x5C76, +0x5C79,0x3534, 0,0x4859,0x3B67,0x5C7E,0x5C7D,0x532B, +0x5D21,0x5D23,0x5D25,0x5271,0x5D24,0x5D26,0x5D27,0x5229, + 0, 0, 0, 0, 0, 0, 0,0x3A49, +0x5D29, 0, 0,0x5D36,0x5D31,0x5D34, 0, 0, + 0, 0, 0, 0, 0,0x5D30,0x464E, 0, + 0,0x4072, 0, 0, 0, 0,0x492F, 0, + 0, 0,0x5C6C,0x5D2E, 0, 0, 0, 0, +0x5D37, 0, 0,0x5C70,0x5D2F, 0,0x5D38, 0, +0x5D2C, 0, 0, 0, 0, 0, 0, 0, +0x5D39,0x5D33,0x5D2D,0x442A, 0, 0, 0, 0, +0x5D28,0x4033,0x412B,0x5D2A,0x5D2B, 0,0x5D32,0x3B71, +0x5D35,0x5328,0x5D3A, 0,0x5D3B,0x4327, 0, 0, +0x5D52,0x5D3C, 0, 0, 0,0x5D51, 0,0x393D, + 0, 0,0x3E55, 0,0x3E7A, 0, 0,0x3A4A, + 0, 0, 0, 0,0x5D4A, 0,0x5D45, 0, +0x5D3F, 0, 0, 0,0x324B,0x5D43, 0,0x5D4B, +0x3224,0x5D55, 0, 0, 0,0x5D3E, 0, 0, + 0,0x4650,0x5D50, 0, 0, 0, 0, 0, +0x5D54,0x4162,0x3746, 0, 0, 0, 0, 0, +0x5D4E,0x5D4F, 0, 0, 0,0x5D44, 0, 0, + 0,0x5D3D, 0,0x5D4D,0x4C51, 0,0x5D49, 0, + 0, 0, 0,0x5D42,0x4348,0x463C,0x4E2E,0x5D4C, + 0,0x5D48, 0, 0, 0, 0, 0, 0, +0x5D41, 0, 0, 0,0x5D46,0x425C, 0, 0, + 0, 0, 0, 0,0x5329,0x532A,0x5D53,0x4F74, +0x4878, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D66, 0, 0, 0, 0, 0, 0, +0x5D47, 0, 0, 0,0x5D60,0x4264, 0, 0, + 0, 0, 0, 0, 0, 0,0x5D61, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D57, 0, 0, 0, 0, 0,0x5678, + 0,0x5D59,0x5D58,0x3870,0x5D56, 0, 0, 0, + 0,0x464F, 0,0x362D, 0, 0, 0, 0, + 0,0x5D62, 0,0x3A79,0x5461,0x5D67, 0, 0, + 0,0x3450, 0,0x5D5A, 0,0x3F7B,0x5D63, 0, +0x5D5F, 0,0x5D5D, 0, 0, 0, 0, 0, + 0, 0,0x3559, 0, 0, 0, 0,0x5D5B, +0x5D5C,0x5D5E, 0,0x3D2F,0x5D64, 0,0x5D65, 0, + 0, 0, 0, 0, 0, 0, 0,0x5D75, + 0,0x4349, 0, 0,0x4B62, 0, 0, 0, + 0,0x5D72, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5861, + 0, 0,0x4651, 0,0x5D74, 0, 0, 0, +0x5574,0x5D73,0x5D70, 0, 0,0x5D6C, 0,0x5D6F, + 0,0x5D68, 0, 0,0x506E, 0, 0, 0, + 0,0x4858,0x5D6E, 0, 0,0x5D69, 0, 0, +0x5D6A,0x4B72, 0,0x5D6D, 0, 0,0x314D, 0, + 0, 0, 0, 0, 0,0x4036, 0,0x3C3B, +0x5D71, 0, 0,0x5D77, 0,0x5D76,0x5D6B, 0, + 0, 0, 0, 0,0x456E, 0, 0, 0, +0x5D7B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5E24, 0, 0,0x5E23, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5D78, 0, 0, 0, + 0,0x436F, 0,0x427B, 0, 0, 0,0x5561, + 0, 0,0x4E35, 0, 0, 0, 0,0x5D7D, + 0,0x324C, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4468,0x4A5F, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x473E, +0x5D7A,0x5D7C,0x5D7E,0x5E22,0x302A,0x314E, 0, 0, + 0, 0, 0,0x5E2C, 0, 0, 0, 0, +0x5E26,0x3D36,0x486F, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5E21, 0, + 0,0x5E25, 0, 0, 0, 0,0x5E29, 0, + 0, 0, 0, 0,0x5E28, 0, 0, 0, +0x5E27, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5E2D, 0,0x544C, 0, 0, 0, + 0,0x5E33,0x5E2A,0x5E2E, 0, 0,0x4059, 0, + 0, 0, 0, 0,0x3121,0x5E36, 0,0x5E31, + 0, 0, 0, 0, 0, 0, 0,0x5E32, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5126,0x5E35, 0, 0, 0, + 0, 0, 0, 0,0x5E2F, 0, 0, 0, +0x5E30, 0,0x503D, 0, 0, 0,0x5E34,0x4A6D, +0x5E39, 0, 0, 0, 0, 0, 0,0x5E38, + 0,0x5E37, 0, 0, 0, 0, 0, 0, + 0,0x5E3B, 0, 0, 0, 0, 0, 0, + 0,0x3D65, 0, 0, 0, 0, 0,0x3258, +0x436A, 0, 0,0x5E3A, 0,0x453A, 0, 0, + 0, 0, 0, 0,0x5E3C, 0, 0, 0, + 0, 0, 0, 0,0x4C59, 0, 0, 0, + 0,0x372A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5465, 0, 0, 0,0x5E3D, + 0, 0, 0, 0, 0,0x5E3F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4422, 0, 0, 0, 0,0x5E41, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5E3E, + 0,0x5E40, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x553A, 0, 0, 0,0x5E42, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x722E,0x3B22,0x4232, +0x4530,0x4247, 0, 0,0x722F, 0, 0, 0, + 0, 0,0x5069, 0, 0, 0,0x535D, 0, + 0, 0,0x6B3D, 0, 0, 0, 0, 0, + 0, 0, 0,0x3366,0x7230, 0,0x7231, 0, + 0,0x4A2D, 0, 0, 0, 0, 0, 0, + 0,0x3A67,0x7233,0x7235,0x7234,0x4B64,0x4F3A,0x7232, +0x4A34,0x524F,0x426C, 0, 0, 0, 0, 0, + 0, 0,0x4E43,0x7238,0x3076,0x7237, 0, 0, + 0, 0, 0,0x723E, 0,0x324F, 0, 0, + 0, 0, 0, 0,0x5141,0x723A, 0, 0, + 0, 0, 0,0x723C,0x5469, 0, 0,0x723B, +0x7236,0x723F,0x723D, 0,0x7239, 0, 0,0x7247, +0x7244,0x7246, 0, 0,0x724A,0x7242,0x7240, 0, + 0, 0,0x7245, 0, 0, 0, 0, 0, +0x567B, 0, 0, 0,0x7241, 0,0x4779,0x495F, + 0,0x7248,0x3946,0x3530, 0, 0,0x7243,0x7249, +0x7250,0x7256, 0, 0,0x3B57, 0, 0, 0, +0x7255,0x4D5C, 0,0x566B, 0, 0,0x7252,0x7254, + 0, 0, 0, 0,0x3872, 0, 0, 0, + 0,0x724B, 0, 0, 0,0x724E,0x4279, 0, +0x555D,0x724C,0x724D,0x724F,0x7253, 0, 0, 0, +0x7259,0x533C, 0, 0, 0, 0,0x366A, 0, +0x4A71, 0,0x3764,0x7257, 0, 0, 0,0x7258, +0x725A,0x725D,0x725B, 0, 0,0x725C, 0, 0, + 0, 0,0x5151,0x7251, 0,0x4D49, 0,0x4E4F, +0x5629, 0,0x7263, 0,0x435B, 0,0x7260, 0, + 0,0x402F,0x726C,0x725E, 0,0x7261, 0, 0, + 0,0x7268, 0, 0, 0, 0,0x7262, 0, + 0,0x7267, 0, 0,0x7266, 0, 0,0x7269, + 0, 0, 0,0x725F, 0, 0,0x7264,0x726A, + 0, 0, 0, 0, 0, 0, 0,0x532C, +0x7265,0x3275, 0, 0,0x7272, 0,0x502B, 0, + 0, 0, 0,0x7275, 0, 0, 0,0x3B48, + 0,0x7279, 0, 0, 0, 0, 0, 0, +0x7270, 0, 0,0x7276,0x7278,0x727A, 0, 0, + 0, 0, 0, 0, 0, 0,0x7273, 0, +0x7271, 0, 0, 0,0x3A7B, 0,0x357B, 0, + 0, 0, 0,0x726F,0x7277,0x726D,0x726E, 0, + 0, 0,0x726B,0x7326, 0,0x7323, 0, 0, +0x7322, 0, 0,0x7274, 0,0x485A, 0, 0, + 0, 0, 0,0x727B, 0, 0, 0,0x7325, + 0, 0, 0, 0, 0, 0, 0,0x4378, + 0, 0, 0, 0, 0, 0, 0, 0, +0x727D, 0, 0,0x7327,0x7329,0x7324, 0,0x727C, + 0, 0, 0,0x732B, 0,0x732A, 0, 0, + 0, 0,0x425D, 0, 0,0x732E, 0, 0, +0x7330, 0, 0, 0, 0, 0,0x7321, 0, + 0, 0,0x7331,0x732C, 0, 0, 0, 0, + 0,0x732F,0x727E,0x732D, 0, 0, 0, 0, + 0, 0, 0,0x7332, 0, 0, 0, 0, +0x7334, 0, 0, 0, 0,0x7328, 0, 0, + 0, 0,0x7333, 0, 0, 0,0x7335, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5037, 0, 0, 0, 0,0x7338, 0, + 0, 0, 0,0x5979, 0, 0, 0, 0, + 0, 0,0x7339, 0, 0, 0, 0, 0, + 0, 0, 0,0x7337, 0,0x4864,0x7336, 0, + 0, 0, 0,0x733A, 0, 0, 0, 0, + 0,0x733B,0x3440, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6E43, 0, 0, 0, 0, 0, + 0,0x733C, 0, 0,0x733D, 0, 0, 0, +0x512A, 0, 0, 0,0x742C,0x5046, 0, 0, + 0, 0, 0, 0,0x5050,0x515C, 0, 0, + 0, 0, 0, 0,0x4F4E, 0, 0,0x3D56, + 0,0x5143, 0, 0, 0, 0, 0, 0, + 0,0x3A62,0x6169,0x5242,0x7142,0x3239, 0, 0, +0x316D,0x7143, 0,0x4940,0x3344, 0,0x5972, 0, +0x4B25, 0,0x7144, 0, 0, 0, 0,0x5654, + 0, 0, 0, 0, 0,0x7145,0x7440,0x7146, + 0,0x542C,0x7147, 0,0x3040,0x7441, 0, 0, +0x7442, 0, 0,0x347C, 0,0x455B, 0, 0, + 0, 0,0x4C3B, 0, 0, 0,0x5064, 0, + 0, 0, 0, 0,0x4D60, 0, 0, 0, + 0, 0,0x7148, 0,0x5973, 0, 0, 0, + 0, 0, 0,0x313B, 0,0x4F2E, 0, 0, + 0,0x3824, 0, 0, 0, 0, 0,0x714A, + 0, 0, 0, 0,0x714B, 0, 0, 0, + 0,0x3243,0x4151, 0, 0,0x5730,0x7149, 0, + 0,0x714C, 0, 0, 0, 0,0x714E, 0, + 0, 0,0x5976, 0,0x5261,0x5423, 0, 0, +0x7443,0x4839, 0, 0, 0, 0, 0,0x7444, + 0, 0,0x714D,0x714F,0x3F63,0x7150, 0, 0, +0x7154, 0, 0, 0, 0, 0, 0, 0, +0x7156,0x7151, 0,0x4951,0x4561, 0, 0, 0, +0x4263,0x397C, 0, 0,0x7153, 0,0x7155, 0, + 0, 0,0x3953, 0, 0, 0, 0, 0, + 0, 0,0x715B, 0, 0, 0, 0, 0, +0x3A56, 0,0x307D,0x7159, 0, 0, 0, 0, + 0,0x7158,0x7152,0x715A, 0, 0, 0, 0, + 0,0x7157, 0, 0, 0,0x486C, 0, 0, + 0, 0,0x4D4A,0x715D, 0, 0, 0, 0, +0x653D, 0, 0, 0,0x715C, 0,0x715E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x715F, 0, 0,0x4F65, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7445,0x3D73, + 0, 0, 0, 0, 0, 0,0x7160, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x7161, 0, 0, 0,0x4E77, + 0,0x522A, 0,0x717B, 0, 0,0x3832, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3C7B,0x395B, 0,0x3966,0x4359,0x4A53,0x6A68, +0x4040,0x3E75,0x6A69,0x6A6A,0x6A6B, 0,0x6A6C,0x6A6D, +0x6A6E,0x6A6F,0x3D47, 0, 0, 0,0x757B, 0, + 0, 0,0x757D, 0,0x757E, 0,0x757C, 0, + 0, 0, 0,0x3D62, 0,0x7621,0x3425, 0, + 0, 0, 0,0x7622, 0, 0, 0,0x7623, + 0, 0, 0,0x6C32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5154, 0, 0, 0, 0, 0, 0,0x596A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7624, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6E3A, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5532, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x537E,0x4C5C, 0, 0, 0, 0, 0, + 0, 0, 0,0x4A44, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6540, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7625, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3E2F, 0, + 0, 0, 0, 0,0x4629, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5A25,0x3C46,0x3629,0x383C,0x484F,0x3C25,0x5A26,0x5A27, +0x4C56,0x4843,0x5A28,0x467D, 0,0x5135,0x5269,0x5136, +0x3C47, 0,0x3D32,0x3B64,0x5A29,0x5A2A,0x5148,0x5A2B, +0x506D,0x366F,0x425B, 0,0x4B4F,0x376D,0x4968,0x3743, +0x3E77,0x5624,0x5A2C,0x5A2D,0x4640,0x5767,0x4A36, 0, +0x5529,0x4B5F,0x556F,0x5A2E,0x565F,0x344A,0x5A30,0x5A2F, + 0,0x526B,0x5A31,0x5A32,0x5A33,0x4A54,0x5A34,0x4A2B, +0x5A35,0x5A36,0x334F,0x566F,0x5A37,0x3B30,0x352E,0x5A38, +0x5A39,0x396E,0x512F,0x5268,0x5A3A,0x3843,0x4F6A,0x326F, +0x5A3B,0x5A3C, 0,0x3D6B,0x4E5C,0x536F,0x5A3D,0x4E73, +0x5A3E,0x5355,0x3B65,0x5A3F,0x4B35,0x4B50,0x5A40,0x476B, +0x566E,0x5A41,0x4535,0x3641,0x5A42,0x374C,0x3F4E,0x5A43, +0x5A44,0x4B2D,0x5A45,0x3577,0x5A46,0x4142,0x573B,0x5A47, +0x4C38, 0,0x526A,0x4431,0x5A48,0x357D,0x3B51,0x5A49, +0x5033,0x5A4A,0x5A4B,0x4E3D,0x5A4C,0x5A4D,0x5A4E,0x3277, +0x5A51,0x5A4F,0x5168,0x5A50,0x4355,0x5A52, 0,0x5A53, +0x5A54,0x5A55,0x503B,0x5225,0x3079,0x5A56,0x472B,0x5A57, +0x3D77,0x4321,0x5A58,0x5A59,0x437D,0x4C37,0x5A5A,0x5A5B, +0x403E,0x4657,0x5A5C,0x5A5D,0x4734,0x5A5E,0x5A5F,0x3948, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3B6D, 0, 0, 0, 0,0x3639,0x7478, + 0,0x7479, 0, 0,0x4D63, 0, 0, 0, + 0, 0, 0, 0, 0,0x7539, 0, 0, + 0, 0,0x6B60, 0, 0, 0, 0, 0, + 0,0x4F73,0x3B3F, 0, 0, 0, 0, 0, + 0, 0,0x3A40,0x5425, 0, 0, 0, 0, + 0, 0, 0,0x6159, 0, 0, 0, 0, +0x7574,0x312A,0x3272, 0, 0, 0, 0, 0, + 0, 0,0x7575, 0, 0,0x7577, 0, 0, + 0,0x3A51,0x7576, 0,0x4332, 0, 0, 0, + 0, 0, 0, 0,0x7579, 0, 0, 0, +0x7578, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3134,0x556A,0x383A, + 0,0x3931,0x3246,0x5470,0x4F4D,0x305C,0x554B,0x3B75, +0x564A,0x3737,0x4C30,0x4636,0x3161,0x393A,0x567C,0x3961, +0x3721,0x3C7A,0x6A5A,0x6A5B,0x4C79,0x3973,0x6A5C,0x347B, +0x4333,0x3751,0x3A58,0x6A5D,0x5474,0x6A5E,0x3C56,0x3B5F, +0x6A5F,0x415E,0x4238,0x545F,0x574A,0x6A60,0x6A61,0x6A64, +0x6A62,0x6A63,0x495E,0x3833,0x3644,0x6A65,0x4A6A,0x494D, +0x344D, 0, 0,0x6259,0x4562,0x6A66,0x4035, 0, +0x5738,0x6A67,0x572C,0x487C,0x5853,0x584D,0x545E, 0, +0x5479,0x4944,0x532E,0x3853,0x3360, 0,0x4962,0x7476, + 0, 0, 0,0x3A55, 0,0x7477, 0, 0, +0x575F, 0, 0,0x7471,0x3830,0x5554,0x384F,0x4670, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3343, 0, 0,0x7472,0x332C, 0, 0, + 0, 0,0x543D,0x4777, 0, 0, 0, 0, + 0,0x7474, 0, 0,0x7473, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4C4B, + 0, 0, 0,0x4824, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7475, 0,0x5763,0x453F,0x7540, 0, 0, +0x753B, 0,0x7543, 0,0x7542, 0,0x563A,0x7541, + 0, 0, 0,0x543E,0x7544, 0,0x754C, 0, + 0, 0, 0,0x304F,0x3578, 0,0x7549,0x754A, + 0,0x455C, 0, 0, 0, 0,0x7545,0x7546, + 0, 0,0x7547,0x754B, 0,0x3E60,0x7548,0x387A, + 0, 0, 0,0x7550,0x7553, 0, 0, 0, +0x3F67, 0,0x3972,0x753C,0x754D, 0, 0,0x4237, + 0, 0, 0,0x4C78, 0,0x3C79, 0,0x754E, +0x754F,0x7551,0x3665,0x7552, 0,0x7555, 0, 0, + 0, 0, 0, 0, 0,0x753D, 0, 0, + 0,0x7554,0x533B, 0,0x336C, 0, 0,0x4C24, + 0, 0, 0, 0,0x7556, 0, 0, 0, + 0, 0, 0, 0, 0,0x7557,0x3E61,0x7558, + 0, 0,0x4C5F,0x755B, 0, 0, 0, 0, + 0,0x3248,0x5759, 0,0x7559, 0,0x755A,0x755C, + 0,0x7562, 0, 0, 0,0x7560, 0, 0, + 0,0x755F,0x755D, 0, 0,0x7561, 0, 0, +0x755E,0x7564,0x7565, 0,0x4C63, 0, 0,0x653F, +0x3538,0x7563,0x7568,0x4C23, 0, 0, 0, 0, + 0,0x7566,0x7567, 0, 0, 0, 0, 0, + 0,0x753E, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3144, 0, + 0,0x753F, 0, 0,0x3545,0x3264, 0,0x756C, +0x7569, 0,0x3657, 0,0x756D, 0,0x756A, 0, + 0, 0, 0, 0,0x756B, 0, 0,0x345A, + 0,0x546A, 0, 0, 0,0x756E, 0,0x3379, + 0, 0, 0, 0, 0, 0, 0,0x756F, +0x7571, 0, 0, 0,0x7570, 0, 0, 0, + 0, 0, 0, 0,0x7572, 0,0x7573, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x496D,0x392A, 0, 0,0x477B, + 0, 0,0x3663, 0, 0, 0, 0, 0, + 0, 0,0x4C49, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A26, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3335,0x547E, +0x396C,0x5079, 0,0x696D,0x572A,0x696E,0x4256,0x486D, +0x3A64,0x696F,0x6970,0x6971,0x5661,0x6972,0x6973,0x6975, +0x6974,0x6976,0x6977,0x4761,0x6978,0x5458,0x6979,0x3D4E, + 0,0x697A,0x697B,0x3D4F,0x697C,0x3828,0x413E,0x697D, +0x3132,0x3B54,0x3975,0x697E, 0,0x6A21,0x6A22,0x6A23, +0x3778,0x3C2D, 0,0x4A64,0x604E,0x542F,0x4F3D,0x5537, +0x6A24,0x555E,0x6A25,0x5041,0x393C, 0,0x3447,0x3159, + 0, 0, 0,0x4031, 0, 0, 0, 0, +0x3166,0x3167, 0,0x3168, 0, 0, 0, 0, +0x333D,0x4868, 0, 0, 0, 0,0x6541, 0, + 0,0x315F, 0, 0, 0,0x4149,0x346F, 0, + 0,0x4728,0x5358, 0,0x4679,0x5138, 0,0x397D, +0x4275, 0, 0, 0, 0, 0,0x532D, 0, +0x544B,0x3D7C, 0,0x6542,0x3735,0x6543, 0, 0, +0x3B39,0x5562, 0,0x3D78,0x5436,0x4E25,0x412C,0x3359, + 0, 0,0x4C76, 0,0x6546,0x6544,0x6548, 0, +0x654A,0x6547,0x354F,0x4648, 0,0x357C,0x6545, 0, +0x4A76, 0, 0,0x6549, 0, 0, 0,0x4354, +0x3145,0x3C23, 0, 0, 0,0x5737, 0, 0, +0x4D4B,0x4B4D,0x4A4A,0x4C53,0x654C,0x654B,0x4466, 0, + 0,0x5121,0x5137,0x654D, 0,0x6550, 0,0x4D38, +0x5670,0x654F,0x355D, 0,0x4D3E, 0,0x6551,0x363A, + 0, 0,0x4D28,0x3964, 0,0x4A45,0x3351,0x4B59, +0x546C,0x6552,0x376A, 0, 0, 0,0x654E, 0, + 0, 0, 0, 0, 0,0x6555,0x347E,0x6556, + 0, 0, 0, 0, 0,0x6553,0x6554, 0, +0x525D, 0, 0,0x425F,0x3146, 0,0x5362, 0, + 0,0x365D,0x4B6C, 0,0x6557, 0, 0,0x5376, + 0, 0, 0, 0, 0,0x3169, 0,0x3674, +0x655A,0x6558,0x6559,0x3540, 0, 0, 0,0x5245, +0x655C, 0, 0,0x655E, 0, 0, 0, 0, + 0, 0,0x655D,0x4732, 0,0x5223, 0, 0, +0x655B, 0, 0, 0, 0,0x5462,0x555A, 0, + 0, 0, 0, 0,0x6560,0x5771, 0, 0, + 0, 0, 0, 0, 0,0x6561, 0,0x315C, +0x517B, 0,0x6562,0x6564, 0, 0, 0, 0, +0x6563, 0, 0,0x6565, 0, 0, 0, 0, + 0,0x5258, 0,0x354B, 0,0x675F, 0,0x5A75, + 0,0x5A78, 0,0x5A76, 0,0x5A77, 0, 0, + 0,0x5A7A,0x504F,0x4447, 0, 0,0x306E, 0, + 0, 0,0x5030, 0,0x5A79, 0,0x534A,0x3A2A, +0x5B22,0x4771, 0,0x5A7C,0x5A7B,0x495B,0x5A7D, 0, +0x5B21,0x575E,0x5A7E,0x415A, 0, 0,0x5B25, 0, + 0,0x5374, 0, 0,0x5B27,0x5B24, 0,0x5B28, + 0, 0,0x3D3C, 0, 0, 0,0x4049,0x5B23, +0x5B26,0x5623, 0,0x5B29, 0, 0, 0,0x5B2D, + 0, 0, 0,0x5B2E,0x5B2C,0x3A42, 0, 0, + 0,0x3F24,0x5B2B, 0, 0, 0,0x5B2A,0x5447, +0x323F, 0, 0,0x5B2F, 0,0x3979, 0,0x5B30, + 0, 0, 0, 0,0x333B, 0, 0, 0, +0x3526, 0, 0, 0, 0,0x363C,0x5B31, 0, + 0, 0,0x3675, 0,0x5B32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3149, 0, 0, 0, 0,0x5B34, 0, + 0, 0,0x5B33,0x5B35, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5B37, + 0,0x5B36, 0, 0, 0, 0, 0, 0, + 0,0x5B38, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5B39, 0, 0,0x5B3A, 0, + 0,0x534F,0x747A,0x4775,0x5743,0x4564,0x747C,0x747D, +0x747B, 0,0x3E46, 0, 0, 0, 0,0x506F, + 0, 0,0x3753, 0, 0,0x544D,0x4C2A, 0, + 0,0x7522,0x7521,0x3A28,0x747E,0x4B56, 0, 0, + 0,0x7524,0x4052, 0,0x336A, 0,0x4D2A,0x7525, +0x7523,0x3D34,0x7528, 0,0x7529,0x3D4D,0x4338,0x3F61, +0x4B61,0x752A, 0, 0, 0,0x7526,0x7527,0x4470, + 0, 0, 0, 0, 0,0x752C, 0,0x343C, + 0,0x576D, 0,0x3457,0x752B,0x752E, 0, 0, +0x752D,0x752F,0x5051, 0, 0, 0, 0, 0, + 0, 0,0x4351,0x4829, 0, 0, 0, 0, + 0, 0,0x7530,0x7531, 0, 0, 0, 0, + 0, 0,0x7532, 0, 0,0x7533,0x7534,0x7535, + 0, 0, 0, 0,0x7537,0x7536, 0, 0, + 0, 0,0x7538, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3249, + 0,0x5354,0x4A4D, 0,0x406F,0x5658,0x5230,0x413F, + 0,0x3D70, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x382A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3C78, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7646, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7647, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7648, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7649, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x764A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x764C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x764B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7769, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x764D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x764E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6E44,0x6E45,0x6E46, +0x556B,0x3624,0x6E48,0x6E47,0x6E49,0x6E4A,0x4725,0x6E4B, +0x6E4C, 0,0x3730,0x3576,0x6E4D,0x6E4F, 0,0x6E4E, + 0,0x3846,0x6E50,0x6E51,0x6E52,0x365B,0x332E,0x5653, +0x4446,0x3135,0x3856,0x6E53,0x6E54,0x543F,0x4755,0x3E7B, +0x4E59,0x3933,0x6E56,0x6E55,0x6E58,0x6E57,0x4525,0x6E59, +0x6E5A,0x472E,0x6E5B,0x472F,0x6E5C,0x3227,0x6E5D,0x6E5E, +0x6E5F,0x6E60,0x6E61,0x576A,0x6E62,0x6E63,0x3C58,0x6E64, +0x534B,0x4C7A,0x322C,0x4165,0x6E65,0x4726,0x432D, 0, +0x6E66,0x6E67,0x6E68,0x6E69,0x6E6A,0x6E6B,0x6E6C, 0, +0x6E6D,0x6E6E,0x6E6F, 0, 0,0x6E70,0x6E71,0x6E72, +0x6E74,0x6E73, 0,0x6E75,0x4D2D,0x4241,0x6E76,0x6E77, +0x6E78,0x5521,0x6E79,0x4F33,0x6E7A,0x6E7B, 0,0x6E7C, +0x6E7D,0x6F21,0x6E7E,0x6F22,0x3875,0x437A,0x6F23,0x6F24, +0x3D42,0x523F,0x3279,0x6F25,0x6F26,0x6F27,0x5278,0x6F28, +0x567D,0x6F29,0x464C, 0,0x6F2A,0x6F2B,0x4134,0x6F2C, +0x4F7A,0x4B78,0x6F2E,0x6F2D,0x337A,0x3978,0x6F2F,0x6F30, +0x5062,0x6F31,0x6F32,0x3766,0x503F,0x6F33,0x6F34,0x6F35, +0x4871,0x4C60,0x6F36,0x6F37,0x6F38,0x6F39,0x6F3A,0x5560, +0x6F3B,0x346D,0x432A,0x6F3C, 0,0x6F3D,0x6F3E,0x6F3F, + 0,0x4E7D,0x6F40,0x4260,0x3438,0x5736,0x3D75, 0, +0x4F47,0x6F43,0x6F41,0x6F42,0x6F44,0x3627,0x3C7C,0x3E62, +0x434C,0x6F45,0x6F46, 0,0x6F47,0x6F4F,0x6F48,0x6F49, +0x6F4A,0x4742,0x6F71,0x364D,0x6F4B, 0,0x6F4C,0x6F4D, +0x3646,0x433E,0x6F4E, 0,0x6F50,0x6F51,0x6F52,0x5572, + 0,0x6F53,0x4477, 0,0x6F54,0x4478,0x6F55,0x6F56, +0x3864,0x3077,0x6F57,0x6F58,0x6F59, 0,0x6F5A,0x6F5B, +0x6F5C,0x6F5D, 0,0x6F5E,0x3E35,0x6F61,0x6F5F,0x6F60, + 0,0x6F62,0x6F63,0x414D,0x6F64,0x6F65,0x6F66,0x6F67, +0x6F68,0x6F69,0x6F6A,0x6F6B,0x6F6C,0x4058, 0,0x6F6D, +0x412D,0x6F6E,0x6F6F,0x6F70, 0, 0,0x4F62, 0, + 0, 0, 0, 0, 0, 0, 0,0x3324, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4345,0x6345,0x4941,0x6346, 0,0x3155,0x4E4A,0x3433, +0x4872,0x6347,0x4F50,0x6348,0x3C64,0x6349,0x634A,0x4346, +0x5522,0x4456,0x396B,0x4E45,0x634B,0x4376,0x634C, 0, +0x3727,0x3873,0x3A52,0x634D,0x634E,0x5444,0x634F, 0, +0x6350,0x514B,0x6351,0x6352,0x6353,0x6354,0x5156,0x6355, +0x327B,0x403B,0x6356, 0,0x402B,0x6357,0x6358,0x6359, + 0,0x635A,0x635B, 0,0x3837,0x5A62, 0,0x3653, + 0,0x5A64,0x5A63, 0, 0, 0, 0, 0, + 0, 0,0x5A66, 0, 0, 0,0x486E, 0, + 0,0x5A65,0x3740,0x5174,0x5275,0x5573,0x3D57, 0, + 0, 0, 0,0x5768,0x5A68,0x5A67, 0,0x3022, +0x4D53, 0,0x5A69, 0,0x383D,0x3C4A,0x423D,0x4224, +0x3342,0x5A6A, 0,0x422A,0x4430,0x3D35, 0, 0, +0x4F5E, 0, 0, 0,0x5A6B,0x4942, 0, 0, + 0, 0, 0,0x315D, 0, 0, 0,0x5A6C, + 0,0x3638,0x543A, 0,0x337D, 0, 0,0x5A6D, +0x5449,0x4F55,0x4563, 0,0x5A6E, 0, 0, 0, + 0, 0,0x5A6F, 0,0x5A70,0x416A,0x4C55,0x4F5D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5367,0x4221, 0, +0x5A71, 0, 0,0x4B65, 0,0x5A72, 0,0x4B66, +0x527E, 0, 0, 0,0x3874, 0, 0,0x5A73, +0x302F,0x4F36, 0, 0,0x554F, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4B6D, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5A74, 0, 0,0x6344, 0, 0,0x4125, 0, + 0,0x763F, 0, 0,0x7640,0x7641,0x4451, 0, +0x4838,0x5163, 0, 0,0x505B,0x5145,0x3C2F,0x394D, + 0,0x6F74, 0, 0,0x3446,0x533A,0x7642,0x337B, + 0, 0,0x7643, 0, 0,0x3571, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7645, 0, 0, 0, 0, 0, 0, 0, +0x536A,0x7627,0x5129, 0, 0, 0, 0,0x7629, + 0, 0, 0,0x7628, 0, 0,0x4163,0x4057, + 0,0x3122, 0, 0, 0, 0,0x4E6D, 0, +0x5068,0x762B, 0, 0,0x4F76, 0,0x762A,0x5570, +0x762C,0x4339, 0, 0, 0,0x3B74,0x762E,0x762D, + 0, 0, 0,0x445E, 0, 0,0x4158, 0, + 0, 0, 0, 0,0x4B2A, 0,0x4F3C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x762F, 0, 0,0x7630, 0, 0, +0x7631, 0,0x4236, 0, 0, 0, 0, 0, +0x3054,0x4579, 0, 0, 0, 0,0x7632, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4760,0x7626, 0, 0,0x3E38, 0, + 0,0x3E32, 0,0x3565, 0, 0,0x3747, 0, +0x3F3F,0x4352,0x4366, 0, 0,0x584C, 0, 0, + 0,0x386F, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3D79,0x5125, 0,0x3050, 0, + 0, 0, 0, 0,0x7730, 0, 0, 0, + 0, 0, 0, 0, 0,0x7731, 0, 0, + 0, 0, 0,0x502C, 0,0x3030, 0, 0, + 0,0x7732,0x7733, 0,0x7734, 0, 0, 0, +0x474A, 0, 0, 0, 0, 0, 0, 0, +0x3E4F, 0, 0,0x7737, 0, 0, 0, 0, + 0, 0, 0,0x7736, 0,0x315E, 0,0x7735, + 0, 0,0x7738, 0,0x7739, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4E24,0x484D, + 0,0x3A2B,0x6838,0x6839,0x683A,0x3E42, 0, 0, + 0, 0, 0,0x5274, 0,0x544F,0x4958, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5233,0x3625,0x476A, +0x717C,0x4F6E,0x4B33,0x506B,0x676F,0x4D67,0x394B,0x3659, +0x717D,0x3064,0x4B4C,0x717E,0x5424,0x422D,0x416C,0x4644, +0x3E31,0x7221,0x3C55, 0,0x7222,0x7223, 0,0x7224, +0x5243,0x4635, 0,0x4D47,0x7225, 0,0x5331,0x3F45, +0x4C62, 0,0x7226,0x7227,0x5155,0x366E,0x7228,0x7229, +0x355F,0x722A,0x722B, 0,0x327C,0x722C,0x722D,0x4827, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3767, 0, + 0,0x6C29,0x6C2A,0x6C2B, 0,0x6C2C, 0, 0, +0x462E,0x6C2D,0x6C2E, 0, 0, 0,0x3749,0x4A33, + 0, 0, 0, 0, 0, 0, 0,0x6238, +0x774F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x7750, 0, 0, +0x324D, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7751, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x7753,0x7752, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x623B, 0,0x3C22, 0,0x623C, +0x623D,0x623E,0x623F,0x6240,0x6241,0x3739,0x527B,0x3D24, +0x4A4E,0x3125,0x4B47, 0,0x6242,0x367C,0x4844,0x6243, + 0, 0,0x3D48, 0,0x317D,0x6244, 0,0x3676, +0x6245,0x4459, 0, 0,0x6246,0x4F5A,0x395D,0x6247, +0x4021, 0,0x6248,0x3276, 0,0x6249, 0,0x4173, +0x624A,0x624B,0x4278,0x624C,0x624D,0x624E,0x4A57,0x5838, +0x5965,0x4F63, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x7025, 0, 0, +0x5C30, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x426D,0x5426,0x4D54,0x5131, +0x335B,0x477D, 0,0x3235,0x423F,0x6660,0x4A3B,0x6661, +0x6662,0x3E54,0x6663,0x5724,0x4D55,0x6665,0x3C5D,0x6664, +0x6666,0x6667,0x426E, 0,0x3D3E,0x6668,0x4266,0x3A27, +0x6669, 0,0x666A,0x3352,0x5169, 0, 0,0x3F25, +0x666B,0x466F,0x666C,0x666D, 0, 0,0x666E,0x462D, +0x666F, 0,0x4927,0x6670,0x6671,0x6672,0x6539,0x6673, +0x6674,0x4262,0x6675,0x6676,0x5668,0x6677, 0,0x6678, +0x3947, 0, 0, 0, 0, 0, 0, 0, +0x773B,0x773A, 0, 0, 0, 0,0x773E,0x773C, +0x3A21, 0,0x773F, 0,0x7740, 0, 0, 0, +0x7742,0x7741,0x7744, 0, 0,0x7743, 0, 0, + 0, 0, 0,0x7745,0x7746, 0, 0, 0, + 0,0x7747, 0,0x4B68, 0, 0, 0, 0, +0x385F, 0, 0, 0, 0, 0, 0,0x7754, + 0,0x7755, 0, 0, 0, 0,0x7756, 0, + 0, 0, 0,0x7758, 0,0x775A, 0,0x7757, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x775B, 0,0x7759, 0, 0, 0, 0, + 0, 0, 0,0x5757, 0, 0, 0, 0, +0x775C, 0, 0, 0, 0, 0, 0,0x775D, + 0, 0, 0,0x775E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x775F, + 0, 0, 0,0x7760, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5B4B, + 0, 0,0x582A, 0, 0, 0, 0, 0, + 0, 0, 0,0x6577,0x396D, 0, 0, 0, + 0,0x3F7D,0x3B6A,0x7749,0x4647,0x7748, 0,0x774A, +0x774C,0x774B, 0, 0, 0,0x774D, 0,0x4E3A, + 0,0x774E, 0, 0,0x4427}; + +/* page 7 0x9C7C-0x9CE2 */ +static uint16 tab_uni_gb23127[]={ +0x5363, 0, 0,0x764F, 0,0x4233,0x7650, 0, + 0,0x7651,0x7652,0x7653,0x7654, 0, 0,0x7656, + 0,0x312B,0x7657, 0,0x7658,0x7659,0x765A, 0, +0x765B,0x765C, 0, 0, 0, 0,0x765D,0x765E, +0x4F4A, 0,0x765F,0x7660,0x7661,0x7662,0x7663,0x7664, +0x4070,0x7665,0x7666,0x7667,0x7668,0x7669, 0,0x766A, + 0,0x766B,0x766C, 0,0x766D,0x766E,0x766F,0x7670, +0x7671,0x7672,0x7673,0x7674,0x3E28, 0,0x7675,0x7676, +0x7677,0x7678, 0, 0, 0, 0, 0,0x487A, +0x7679,0x767A,0x767B,0x767C, 0, 0,0x767D,0x767E, +0x7721,0x7722,0x7723,0x7724,0x7725, 0, 0,0x7726, +0x7727,0x7728,0x316E,0x7729,0x772A,0x772B, 0, 0, +0x772C,0x772D,0x415B,0x772E, 0, 0,0x772F}; + +/* page 8 0x9E1F-0x9FA0 */ +static uint16 tab_uni_gb23128[]={ +0x4471,0x702F,0x3C26,0x7030,0x4379, 0,0x4538,0x513B, + 0,0x7031,0x7032,0x7033,0x7034,0x7035,0x513C, 0, +0x516C, 0,0x7037,0x7036,0x5427, 0,0x4D52,0x7038, +0x703A,0x7039,0x703B,0x703C, 0, 0,0x386B,0x703D, +0x3A68, 0,0x703E,0x703F,0x3E69,0x7040,0x366C,0x7041, +0x7042,0x7043,0x7044,0x4835,0x7045,0x7046, 0,0x7047, +0x4574, 0,0x7048, 0, 0, 0,0x7049, 0, +0x704A,0x773D, 0,0x704B,0x704C,0x704D, 0,0x704E, + 0, 0, 0, 0,0x704F,0x3A57, 0,0x7050, +0x7051,0x7052,0x7053,0x7054,0x7055,0x7056,0x7058, 0, + 0,0x5325,0x7057, 0,0x7059, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x753A, +0x4239, 0, 0,0x7764, 0, 0, 0, 0, +0x7765,0x7766, 0, 0,0x7767, 0, 0, 0, + 0, 0, 0,0x7768,0x4234, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x776A, 0, +0x776B, 0, 0, 0, 0, 0, 0,0x4273, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x7470, 0, 0, + 0,0x746F, 0, 0,0x4269, 0,0x7761,0x7762, + 0, 0, 0, 0, 0,0x3B46, 0, 0, + 0, 0,0x5964, 0, 0, 0,0x4A72,0x4068, +0x7024, 0,0x3A5A, 0, 0,0x472D, 0, 0, + 0,0x442C, 0, 0,0x776C,0x776D,0x776E, 0, +0x7770,0x776F, 0,0x7771, 0, 0,0x7774, 0, +0x7773, 0,0x7772,0x7775, 0, 0, 0, 0, +0x7776, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6D69, 0,0x6D6A,0x6D6B, 0,0x763C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x763D, 0,0x763E,0x3626, + 0,0x583E, 0, 0,0x3944, 0, 0, 0, +0x583B, 0,0x5C31, 0, 0, 0, 0, 0, + 0,0x4A73, 0,0x7777, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x7778, 0, 0, +0x7779, 0, 0, 0, 0, 0, 0, 0, +0x777B, 0,0x777A, 0,0x3147, 0,0x777C,0x777D, + 0, 0, 0, 0, 0,0x777E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x466B,0x6C34, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x335D,0x7633, 0, 0,0x7634,0x4164,0x7635,0x7636, +0x7637,0x7638,0x7639,0x763A,0x4823,0x763B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x417A,0x3928,0x6D68, 0, 0, 0, +0x396A,0x595F}; + +/* page 9 0xFF01-0xFFE5 */ +static uint16 tab_uni_gb23129[]={ +0x2321,0x2322,0x2323,0x2167,0x2325,0x2326,0x2327,0x2328, +0x2329,0x232A,0x232B,0x232C,0x232D,0x232E,0x232F,0x2330, +0x2331,0x2332,0x2333,0x2334,0x2335,0x2336,0x2337,0x2338, +0x2339,0x233A,0x233B,0x233C,0x233D,0x233E,0x233F,0x2340, +0x2341,0x2342,0x2343,0x2344,0x2345,0x2346,0x2347,0x2348, +0x2349,0x234A,0x234B,0x234C,0x234D,0x234E,0x234F,0x2350, +0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,0x2358, +0x2359,0x235A,0x235B,0x235C,0x235D,0x235E,0x235F,0x2360, +0x2361,0x2362,0x2363,0x2364,0x2365,0x2366,0x2367,0x2368, +0x2369,0x236A,0x236B,0x236C,0x236D,0x236E,0x236F,0x2370, +0x2371,0x2372,0x2373,0x2374,0x2375,0x2376,0x2377,0x2378, +0x2379,0x237A,0x237B,0x237C,0x237D,0x212B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2169, +0x216A, 0,0x237E, 0,0x2324}; + +static int func_uni_gb2312_onechar(int code){ + if ((code>=0x00A4)&&(code<=0x01DC)) + return(tab_uni_gb23120[code-0x00A4]); + if ((code>=0x02C7)&&(code<=0x0451)) + return(tab_uni_gb23121[code-0x02C7]); + if ((code>=0x2015)&&(code<=0x2312)) + return(tab_uni_gb23122[code-0x2015]); + if ((code>=0x2460)&&(code<=0x2642)) + return(tab_uni_gb23123[code-0x2460]); + if ((code>=0x3000)&&(code<=0x3129)) + return(tab_uni_gb23124[code-0x3000]); + if ((code>=0x3220)&&(code<=0x3229)) + return(tab_uni_gb23125[code-0x3220]); + if ((code>=0x4E00)&&(code<=0x9B54)) + return(tab_uni_gb23126[code-0x4E00]); + if ((code>=0x9C7C)&&(code<=0x9CE2)) + return(tab_uni_gb23127[code-0x9C7C]); + if ((code>=0x9E1F)&&(code<=0x9FA0)) + return(tab_uni_gb23128[code-0x9E1F]); + if ((code>=0xFF01)&&(code<=0xFFE5)) + return(tab_uni_gb23129[code-0xFF01]); + return(0); +} + + +static int +my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + int code; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((uint) wc < 0x80) + { + s[0]= (uchar) wc; + return 1; + } + + if (!(code=func_uni_gb2312_onechar(wc))) + return MY_CS_ILUNI; + + if (s+2>e) + return MY_CS_TOOSMALL2; + + code|=0x8080; + s[0]=code>>8; + s[1]=code&0xFF; + return 2; +} + + +static int +my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e){ + int hi; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((hi= s[0]) < 0x80) + { + pwc[0]=hi; + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + if (!(pwc[0]=func_gb2312_uni_onechar(((hi<<8)+s[1])&0x7F7F))) + return -2; + + return 2; +} + + +/* + Returns well formed length of a EUC-KR string. +*/ +static size_t +my_well_formed_len_gb2312(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) +{ + const char *b0= b; + const char *emb= e - 1; /* Last possible end of an MB character */ + + *error= 0; + while (pos-- && b < e) + { + if ((uchar) b[0] < 128) + { + /* Single byte ascii character */ + b++; + } + else if (b < emb && isgb2312head(*b) && isgb2312tail(b[1])) + { + /* Double byte character */ + b+= 2; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (size_t) (b - b0); +} + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_simple, /* strnncoll */ + my_strnncollsp_simple, + my_strnxfrm_mb, /* strnxfrm */ + my_strnxfrmlen_simple, + my_like_range_mb, /* like_range */ + my_wildcmp_mb, /* wildcmp */ + my_strcasecmp_mb, /* instr */ + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + ismbchar_gb2312, + mbcharlen_gb2312, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_gb2312, + my_lengthsp_8bit, + my_numcells_8bit, + my_mb_wc_gb2312, /* mb_wc */ + my_wc_mb_gb2312, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + +CHARSET_INFO my_charset_gb2312_chinese_ci= +{ + 24,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "gb2312", /* cs name */ + "gb2312_chinese_ci",/* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gb2312, + to_lower_gb2312, + to_upper_gb2312, + sort_order_gb2312, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + +CHARSET_INFO my_charset_gb2312_bin= +{ + 86,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "gb2312", /* cs name */ + "gb2312_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gb2312, + to_lower_gb2312, + to_upper_gb2312, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_mb_bin_handler +}; + +#endif diff --git a/externals/mysql/strings/ctype-gbk.c b/externals/mysql/strings/ctype-gbk.c new file mode 100644 index 0000000..6fa8ca8 --- /dev/null +++ b/externals/mysql/strings/ctype-gbk.c @@ -0,0 +1,10100 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file is for Chinese character sets GBK, created by Wei He + (hewei@mail.ied.ac.cn) +*/ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. strxfrm_multiply_gbk=1 + * .configure. mbmaxlen_gbk=2 + */ + + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_gbk + + +/* Support for Chinese(GBK) characters, by hewei@mail.ied.ac.cn */ + +#define isgbkhead(c) (0x81<=(uchar)(c) && (uchar)(c)<=0xfe) +#define isgbktail(c) ((0x40<=(uchar)(c) && (uchar)(c)<=0x7e) || \ + (0x80<=(uchar)(c) && (uchar)(c)<=0xfe)) + +#define isgbkcode(c,d) (isgbkhead(c) && isgbktail(d)) +#define gbkcode(c,d) ((((uint) (uchar) (c)) <<8) | (uchar)(d)) +#define gbkhead(e) ((uchar)(e>>8)) +#define gbktail(e) ((uchar)(e&0xff)) + +static uchar NEAR ctype_gbk[257] = +{ + 0, /* For standard library */ + 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 72,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 132,132,132,132,132,132,132,132,132,132,16,16,16,16,16,16, + 16,129,129,129,129,129,129,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,16,16,16,16,16, + 16,130,130,130,130,130,130,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,32, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, +}; + +static uchar NEAR to_lower_gbk[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR to_upper_gbk[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR sort_order_gbk[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '\\', ']', '[', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', 0x7E, '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uint16 NEAR gbk_order[]= +{ +8653,14277,17116,11482,11160,2751,14613,3913,13337,9827, +19496,1759,8105,7103,7836,5638,2223,21433,5878,8006, +4851,18766,18879,16728,8129,6200,19133,6389,2500,19084, +16228,5074,8130,5900,6201,3985,14597,11566,8588,8769, +15885,11411,11965,1961,18012,18303,12242,14118,11490,12911, +15015,4367,3184,2093,20937,5710,5108,10560,9993,18982, +8393,10697,14620,19558,14970,15193,5359,18189,12666,18192, +3310,18659,17358,7973,18673,19537,3404,9723,4221,16486, +7023,13648,16310,1049,1726,4799,15534,4366,17133,4192, +6219,5118,1804,2360,2279,14279,13740,4511,2361,12906, +16650,18590,4723,2001,16313,3594,21026,12146,19561,3800, +4161,16774,18892,17657,7025,892,7917,12245,3394,4813, +11902,3189,20002,2365,12964,18115,17660,20227,17182,11907, +11671,17562,17864,21131,13423,1361,12246,18897,14978,18848, +20727,5902,10726,21241,1906,13424,1408,20519,3038,18495, +20446,1431,17138,13464,14558,1221,6720,6137,17348,5268, +4448,11313,1760,6172,6870,5744,13541,3044,17701,14368, +16114,5051,9142,18776,5669,19089,11088,17867,925,10395, +4372,10578,2138,2554,18118,21087,13862,7461,14983,3322, +15305,11844,7924,8087,2542,20701,21772,2754,10490,8218, +14800,15869,14436,16119,1814,11543,17398,16069,19659,17020, +17844,5694,8833,16744,18925,4957,9812,6852,8036,12966, +14038,12145,16833,11165,17076,17756,3673,2367,20916,9143, +14927,6885,17486,7469,1661,2827,4627,18198,1307,19711, +17637,2595,2262,20807,1764,8150,18547,3192,9711,16262, +9144,2006,21629,5311,15743,14733,10991,15402,2916,17724, +12195,12622,5141,8039,15169,7780,4568,20835,21575,10580, +15022,9470,6853,3926,21563,1342,16745,8181,11526,1947, +7402,18641,14145,13149,19222,2468,12920,13916,21077,2968, +16438,19667,1768,15632,18374,4738,15517,16655,4309,2374, +14492,8602,3679,2103,1312,18681,6613,18604,20451,2755, +18218,19473,17854,20316,3003,4998,1391,20938,11169,7049, +18861,17577,18091,1937,4085,2059,20633,15948,1313,20138, +7785,16439,15081,20955,15117,17065,19924,13831,11913,20062, +7568,10703,3717,15480,6047,7790,16867,14223,12971,8429, +2008,2833,14026,1317,17493,19411,18551,15452,15257,18504, +4441,1769,7249,20128,5509,1970,9420,19365,20190,21617, +12202,15041,2871,19676,20388,21674,14258,2901,8058,5970, +20472,13257,18226,3694,17591,10279,1318,12409,7901,9794, +10416,10769,12876,17154,15455,19298,3970,21327,14228,13095, +8096,16072,21748,12581,9326,2311,5683,12641,3583,2184, +16464,6969,1795,6778,2880,15819,3433,7674,4713,17297, +8231,4333,9995,1841,5558,17155,17298,11283,18694,7946, +7311,13129,4753,21149,905,14010,18821,8532,11873,2190, +19006,3456,8874,7433,2841,7680,14143,20130,1993,1699, +976,15361,2736,2154,9202,11685,7951,12982,11008,16763, +11829,13327,11686,2299,9940,10507,8917,1277,19790,1636, +20143,21002,15011,19443,6026,13299,2455,9667,15612,16477, +10261,2811,2202,13674,14760,6818,9691,10624,20145,11940, +15524,18349,9437,11578,20132,17736,4121,4122,16023,2280, +4371,4373,7873,18307,14602,14695,13054,5410,6065,14389, +3979,1137,5411,6672,16311,11632,9829,19575,5901,15708, +12553,7165,18983,10860,13664,18242,10848,2049,8075,5579, +8083,10863,21136,5445,17851,19132,8597,18771,11054,14631, +10997,8292,8803,11246,4999,17559,11134,15369,5155,6407, +12054,4857,11265,12834,7322,15057,10937,15984,5544,8040, +13291,3961,5142,19101,869,9631,2009,11315,21404,3172, +14941,4204,7947,9997,16906,4035,4476,4477,8171,2818, +20725,4724,11453,20868,4725,4729,8565,5109,12490,8862, +5920,13737,2888,6930,12963,3223,6934,3395,16243,8397, +9475,4858,13515,3777,11266,10029,21028,1671,7765,7766, +14169,2221,5328,2907,8951,4225,4416,7770,3046,8014, +3975,10636,20236,19825,3248,8717,2140,2908,3249,9477, +4628,2225,12676,2909,21564,5167,1225,4186,13266,4017, +7471,7146,18214,6890,4195,16037,16688,5583,14497,7476, +3286,8566,2910,2862,2232,16038,10417,9492,12234,14190, +8793,5573,6486,20322,21455,9734,8317,10143,5781,7681, +5782,7500,7501,15466,7188,7511,7512,21003,2203,21693, +11350,9540,21212,18183,7918,8754,17511,20869,18899,21160, +11356,9315,8364,8798,18460,16189,17483,11415,8897,7771, +9917,8718,7926,5228,11270,2644,9269,19404,8719,8367, +13267,10400,1914,2157,8584,11171,3964,17881,16785,18951, +18052,16616,14500,9323,10418,12410,14661,6963,7570,7668, +13601,17386,18995,8437,4460,8346,15920,8318,3387,10734, +18057,18058,10525,9654,2390,13675,13603,20000,8106,1260, +10824,1426,5075,5076,18887,12175,8174,15558,5269,4304, +5380,3287,8156,5386,11605,8142,18768,7580,8641,6319, +13425,4478,13147,2019,8900,6331,19668,5756,6769,3381, +9009,9730,9735,15160,4036,8167,13489,17009,8667,18308, +13439,18112,11735,21667,14617,17010,16290,16291,17515,3368, +7050,14841,5636,16826,17573,7760,18493,13306,14312,2619, +17868,13609,8991,7038,4310,16881,14020,16422,20565,5941, +18174,3642,20346,12080,856,13144,18158,20908,10800,15630, +14340,15837,21707,4629,2060,19870,9632,3718,7902,994, +5762,18391,9647,2312,9199,9648,18281,18342,19911,5367, +9950,13834,13513,8771,9414,4057,21302,1963,1964,1967, +902,3349,14697,5602,1071,13959,14621,21428,7288,15079, +7039,16495,13949,3111,5580,13365,2615,4109,6202,11213, +10792,17918,21538,3226,18658,11985,6862,18734,2752,13232, +7838,1907,4252,6223,16703,11495,18037,3974,6301,5226, +8514,10487,5267,10892,12763,16706,7702,20003,2616,14457, +16083,16587,4296,14513,8355,12171,16590,10670,13651,3646, +14626,21132,15826,17015,18911,12792,12461,21545,17848,18912, +17396,3277,13516,5918,16115,12548,1673,4864,18438,6078, +5880,3263,16211,21784,1909,15296,17183,6884,12796,4417, +4299,17021,21137,14801,17484,8852,6512,15560,4300,17921, +5819,9342,15900,17742,19525,3869,11715,17703,12554,6040, +19865,10267,12549,10804,21670,6091,17277,9319,12531,9840, +1060,11215,10514,15170,4892,5904,14898,19534,5469,5470, +1128,5922,18937,7270,15971,17189,16263,9474,13382,2369, +20210,18177,3976,12767,3618,13236,10885,5397,15621,8770, +9830,9310,14121,21573,16634,19148,12803,4381,13051,956, +20237,3755,19551,15744,9169,16852,866,11893,21439,3680, +6197,17412,17324,16086,16747,16602,3834,5510,12770,12771, +3420,16198,21552,1421,3198,6097,18178,12772,20576,9831, +17200,19226,5584,20226,5822,10609,11641,3599,13550,15387, +5361,15481,952,3426,19731,20581,21103,2153,16223,19719, +20139,18533,11172,6356,20044,6584,6585,6954,21058,16397, +14150,17888,6618,4199,11775,9843,19732,14051,2564,13093, +18379,3377,12174,1968,19359,16350,19294,12243,1294,5362, +20214,6898,15645,18557,6146,13005,14084,19366,6272,17534, +10713,2104,5894,13900,16200,6964,12093,16692,12975,21496, +9358,16216,7314,15280,3056,14008,5363,11510,13001,1474, +997,9724,21709,20612,11383,15441,7715,2684,7622,8585, +15456,14192,872,17497,10281,17428,6338,6779,5831,11989, +17156,20245,2293,12512,3560,10705,6367,5040,15465,18663, +14003,7716,17498,6462,10721,13660,9327,17501,6973,9010, +17433,6024,10669,13098,2842,15393,3436,18133,4283,21749, +4461,2571,6707,1986,2900,3138,3434,19771,9090,16900, +12816,6022,9736,17830,6708,19167,18099,11781,14950,18337, +19249,3270,20404,21152,11875,6791,17596,7723,19933,884, +19376,8877,19687,12164,3544,17647,4150,3457,17648,12338, +19127,21715,11831,3635,9259,15329,6901,17127,18710,4191, +12352,21112,7195,7956,2300,18061,10887,15701,10319,6808, +1859,19445,11794,19170,6436,10969,6216,20594,9522,10157, +5898,11567,11326,18410,9674,10340,10229,11345,3447,2456, +12439,12340,17368,10889,17057,4224,8845,18285,2207,19263, +3872,9117,15331,17456,2995,6523,6919,21337,11803,17457, +1936,9533,2248,2161,9697,19072,10607,20163,15100,6199, +20287,7392,20107,21238,9225,11809,13650,10203,6717,19085, +11816,16035,8643,19823,8084,12359,20004,3059,6719,4253, +5838,15886,15982,5839,13638,13780,5840,15341,5842,19140, +6854,5923,10582,5843,2868,16398,19872,13534,8824,12598, +19879,19880,18208,16051,16004,16005,16039,10567,6783,19020, +10539,10550,18184,16018,15868,12573,10392,8863,8172,19697, +12845,12846,21424,3476,12833,17119,14167,11764,11357,7264, +20873,18048,18901,13220,4667,8756,16106,4705,1432,8009, +3665,7966,7128,2587,7967,12053,15477,13430,20832,5587, +15350,8076,18496,4801,10396,13339,5438,18013,1074,10032, +21247,4985,6322,20909,989,3323,12104,11235,7138,6138, +10512,3008,2621,19090,6306,4110,20541,4877,5674,18543, +4231,5748,2116,18465,17517,14702,1762,6233,3281,8548, +3479,6000,954,17677,17278,1186,4803,1097,18938,19207, +5954,17874,2917,13191,1374,4557,13610,19406,8518,7240, +3675,9306,8357,7882,20573,9913,6446,1915,8078,18661, +3600,18200,13551,15199,13252,16268,8298,10602,20739,8775, +2704,3928,15450,1948,2829,1375,8603,4214,18952,20841, +21403,12685,8299,11653,8726,9031,11701,7331,5169,19721, +4311,5546,9471,4548,18163,9032,972,14386,11607,15974, +2517,6540,1462,9789,5823,21324,1244,19595,10838,7744, +13909,18685,5360,21578,19596,6619,4318,18552,1268,3013, +10906,2309,16148,12551,4773,21079,7858,7887,6198,5174, +2935,8605,12479,9418,17729,6610,4093,16233,17928,17030, +7062,8871,19299,19417,8569,15122,14579,11123,16618,2526, +15997,13618,21060,9639,12203,1209,20185,4112,15728,16751, +20767,18053,20711,898,5381,18272,8607,16540,17592,10190, +5887,9300,2294,12204,1384,2426,10427,10374,11972,12978, +10920,11384,16040,14865,10301,1622,2072,20975,20512,8617, +3765,2439,20849,7172,5829,13045,7943,3700,3174,18392, +15307,20290,12928,16506,21383,13068,14230,14231,1088,12583, +8875,3942,4462,13626,4146,3217,3701,14505,4242,4245, +15413,3587,11432,4684,6631,15414,3271,18690,21282,7502, +1039,13032,13072,8748,19021,12316,3766,7551,18665,1852, +15419,9243,8322,6513,3492,13684,12987,18062,9260,16999, +906,18151,3529,13911,7957,9427,8940,10341,18286,15427, +16481,6514,10263,10264,13950,9675,9985,2208,18070,18291, +9406,1106,16240,14024,21355,18735,10727,21254,21358,6353, +9064,6357,17889,9070,14715,10820,4147,14718,18755,5496, +7582,4769,20373,1592,15166,13637,10033,3251,17753,17613, +11596,17130,19916,10850,4182,13264,11964,5447,12805,11003, +11047,2440,20269,5601,5209,15535,15370,18300,1406,6926, +20037,7229,1056,4359,3596,12118,8363,17518,3735,18497, +6573,8553,20360,1351,6662,4610,3780,18127,1363,1032, +16617,12536,16800,1037,7571,9731,4203,19993,7572,14677, +4715,6902,1527,10540,2376,3886,12847,8131,11926,2135, +17136,4517,7104,6221,3365,4816,8031,5875,16599,21029, +11997,5995,21069,20005,4807,2552,8400,21341,18361,11496, +17629,4669,4726,16292,4072,1075,21429,20521,11523,19918, +15958,17185,18913,4247,11358,1436,14370,4248,6080,17849, +4434,20728,11236,1173,4817,10034,21539,13666,14173,18439, +10741,21482,8275,13754,3952,7040,5056,17377,6456,8339, +5443,7327,7328,11738,20834,20673,17273,6182,5675,8491, +8847,18364,11314,9918,12150,4302,19527,18255,14375,14566, +5749,13543,15020,6234,17279,14316,2502,17574,10805,4827, +11443,8723,2979,2980,15870,17708,11546,19581,12503,11626, +20926,5924,21344,12472,16076,17280,16710,18256,16748,16841, +18260,19582,14989,9609,8190,21375,12628,17194,21440,3929, +10404,879,4249,10275,11146,3095,12550,8191,1949,10054, +17413,14766,12773,6692,5001,16647,16648,15405,4581,4582, +15709,11654,13552,8046,7979,12868,3756,17726,6421,16231, +9150,19109,21097,11614,5002,10583,973,9033,19149,18201, +8192,9622,3737,17195,6447,6480,3483,18605,11564,13964, +7294,15949,19734,16351,3689,13838,10941,3378,13918,13178, +6693,16657,12924,2936,11189,5005,7831,4086,18806,21080, +6620,11148,932,19228,17929,7745,16352,20747,13345,15635, +17584,16171,9790,10871,13670,14932,12361,16502,16199,3132, +6358,7791,1245,17817,15950,5715,21662,18558,19882,13796, +13901,10132,10944,12039,1026,10672,9002,13206,20689,19883, +7746,13800,11302,19235,15124,11752,15542,12085,9276,11609, +1235,12346,18996,19759,17966,10773,18749,8627,19370,11703, +5719,7905,21307,20246,5908,9361,20563,6426,6427,1034, +13922,10677,12423,5487,16758,13099,16174,20438,11193,17210, +17211,11392,9864,9712,6490,5723,3572,20852,17832,18753, +6482,16901,9011,13705,18396,2181,7625,10946,4534,4463, +17161,19022,6168,7724,4536,14680,15209,13033,9774,17945, +17649,11755,3943,19023,1971,907,11742,11832,10673,15800, +2738,7958,3028,19632,12437,13822,13876,11528,18236,15363, +19255,12988,19972,11154,1403,14431,17732,11711,4037,10186, +19849,9247,18411,10100,7696,11743,9249,17172,19264,14855, +6822,13579,11104,9538,10541,18292,21213,9251,8394,21477, +17662,14984,15342,19522,21318,15232,11216,3096,12869,18145, +11682,21506,9501,18022,1877,11517,11798,19265,10542,13830, +13303,7230,13858,18591,18772,8010,21395,21223,6229,14563, +18794,15793,14603,2503,13642,5375,17403,20364,3516,14419, +6659,11115,8804,1950,20141,19831,13343,6142,20637,7482, +11825,1770,6541,13226,14576,11826,7938,11847,20963,19677, +1247,8885,11827,8312,13229,6339,14584,11828,14425,16469, +17560,8886,6784,8533,19039,18830,1257,13187,2705,1258, +4762,10511,4124,12519,21303,4828,8724,7588,21305,18092, +14812,4131,3527,7762,4393,4394,14764,14280,11327,9907, +17242,17243,9046,16304,9904,10796,16305,16306,16307,18541, +4232,8998,21059,5110,5515,16061,5115,5116,17012,1390, +7844,15716,3798,14519,20669,17576,11649,16842,16843,10758, +10309,12474,15684,4631,17585,10500,2084,17597,8329,8391, +9883,8392,21237,17624,11692,16188,17134,9579,4288,3503, +6742,10206,13743,16775,5949,14364,2765,18725,19947,1157, +18592,981,16777,7768,4290,4670,16248,12907,12663,7839, +21769,21770,18498,8276,5161,18015,12501,9591,15773,13432, +4865,16137,12288,1030,8924,13433,12525,15774,10036,2589, +12463,2091,1185,15898,18016,1588,6083,8721,10649,4303, +4990,3826,10399,4363,4375,5057,13530,18786,11438,14567, +926,16386,6533,11113,9552,7139,3954,16387,19529,5502, +9919,18545,7610,4258,17519,1884,13639,4736,11585,9555, +19464,17281,13793,3517,14382,2504,15985,5349,5231,17082, +19141,19665,9307,8616,17234,13611,2695,15316,9955,6478, +8193,9151,11248,9034,9035,21671,5547,18164,5179,10584, +10585,10055,4187,20740,19151,3965,5926,20741,16440,12301, +7787,21672,8823,3930,19152,21490,20275,6621,19597,18474, +4742,13395,18475,15636,18862,20956,14654,4319,21271,8594, +10518,18318,10942,5932,6955,6586,15855,16795,19598,21579, +9193,8712,18267,18268,16447,21580,2121,15200,8679,13179, +12699,15998,4113,16882,16619,2010,15485,13801,7795,870, +10133,16801,13060,1368,3719,12950,19418,11778,3238,14580, +13968,15043,21588,7596,9858,8628,2233,3853,2076,3890, +15978,10302,20433,20434,998,2031,13447,13009,3175,21713, +3524,3525,16958,19760,12160,10221,17387,2085,1796,13182, +7626,18232,9328,20458,9866,9867,7890,4243,21738,7721, +8441,18574,7627,18575,8442,20405,19024,18023,11593,18705, +18706,18824,11788,17251,7074,17601,8707,5724,3710,1040, +21730,16369,13823,3530,10114,7818,19688,19975,19196,13859, +7823,9660,5732,10230,10231,19319,16937,8244,2209,19345, +8961,18287,11599,13580,2359,3159,10543,3729,3730,11805, +18293,18294,18354,8989,18295,8861,6605,7968,2341,9938, +8768,12561,12562,13406,20792,20522,18795,7897,15252,13598, +12240,4852,20087,3876,11763,4648,12010,20874,6409,3412, +3325,11359,4866,11367,18927,18928,12467,12835,8356,13863, +14839,14878,13123,20625,14523,13643,3336,5707,12475,20508, +7408,16232,3339,14148,12687,4061,6287,20780,17818,16400, +18969,1192,12480,3839,5382,12040,15543,11124,7309,15602, +6704,21044,14193,1623,5847,20247,11469,1193,8019,2236, +20985,6342,1492,1504,20496,11136,13073,2171,4685,11015, +1195,2739,11224,2793,7816,17258,9214,7318,1761,5147, +7112,15831,20270,5689,10886,13188,4163,18175,1124,7840, +21342,18140,3047,15899,18853,20918,15766,20919,17405,15986, +5754,8835,10998,19501,1885,1763,2547,9152,7051,15026, +14808,13284,19736,11210,15061,2064,17327,4633,8155,4327, +16448,10191,17124,15062,20964,1923,13258,8159,8160,10282, +19210,3348,10428,18997,2788,16006,14951,17645,11211,2313, +16759,4637,5691,8789,8878,1513,13034,9999,9884,10342, +7208,19346,17173,15845,19387,9539,15847,18074,3612,12524, +6721,11524,6722,4706,8251,18309,20183,18728,4413,14016, +4414,14663,3799,6402,16674,3664,7583,1095,14412,20469, +15536,4954,3649,2329,20674,18787,8365,14285,19827,8041, +3781,20470,7589,13024,12198,1463,14347,15407,7422,5256, +4428,1475,8794,7429,1682,17439,3437,5832,7552,6264, +11065,5836,16239,8476,7122,10397,6770,6771,18825,18826, +18836,19941,19942,16558,18365,19706,2556,3782,19419,12386, +2582,21425,16167,7028,21030,16314,3597,10037,4867,16320, +16834,16192,2543,20927,8042,3094,20798,3097,16984,7154, +20939,3065,21098,9153,17578,7857,7477,14656,7295,1595, +5007,16449,1210,16883,20750,12413,15649,3561,20754,1676, +2686,2387,18576,6792,10927,10271,17338,1280,13490,9371, +13717,3895,5069,13719,5093,18895,14619,16819,4457,19220, +11238,16588,16780,7029,17016,7841,16249,3061,19702,12664, +3190,15371,16092,12908,6842,17740,16318,17139,8623,8277, +18915,1238,11239,12128,8801,1174,11583,15810,5542,8283, +19457,3670,15969,19460,4821,17017,1437,19436,17979,3064, +1738,6656,18038,12251,14802,16835,15386,19400,11360,8772, +14633,17022,9344,6183,8902,11416,20884,17520,15767,3827, +6041,5750,12620,17485,14929,6328,13340,6723,2645,18788, +17743,5604,10010,2624,14282,13531,19953,12179,3554,6754, +17406,10801,19407,19828,12258,19955,19722,15988,7855,20577, +10011,6042,13150,15685,1916,12969,16845,10742,18954,6179, +2544,16786,9484,9295,3066,18955,9610,11603,4312,16788, +3098,3557,2322,10985,9623,5646,5641,12629,8777,15745, +10586,16868,8604,5796,11702,4142,5857,20398,19836,7885, +7161,9956,19723,6106,13553,15406,15689,11772,2981,6832, +17639,4282,15278,21613,7332,19412,3558,11608,20063,3840, +2970,13315,2065,1573,6835,21581,15637,1324,17930,16353, +5277,16450,1465,17931,6587,11173,19413,12806,14256,19110, +2421,10875,12840,8731,900,13156,18319,13919,21614,13998, +19229,13624,5383,20021,15132,12707,18560,15042,6665,7064, +5516,8313,2911,11704,17535,8570,20769,19420,2042,18131, +14446,1834,8586,17035,6859,19422,18507,9640,14053,15544, +19118,17896,15382,20067,11316,5407,3101,12414,11470,5848, +2665,1985,1980,1978,3176,11284,20476,15945,1035,14866, +5648,13627,20215,8161,9726,11995,15044,7944,19212,10523, +14260,16041,10744,12882,14352,13297,3707,20853,10283,8383, +12648,12643,19772,12491,9860,3115,19442,2687,20986,15946, +2474,12817,13449,12214,1335,13328,7628,2661,9737,12494, +9012,6786,2533,19214,19215,16992,16993,3438,15415,4244, +4177,15139,8454,2074,17434,4465,4714,9329,9362,17212, +11285,9868,16760,1987,8443,3139,17304,15442,14485,12280, +19025,17162,11876,3439,15443,8022,15032,6985,16515,6520, +13218,13213,8323,2043,8750,19256,19026,10001,14089,8534, +6504,908,18238,9098,17128,2669,19633,19217,3316,11048, +910,11016,4136,12731,11353,9205,10989,2740,21004,11955, +2792,18512,1860,21010,8942,8918,19446,4850,10158,11225, +2540,6809,2254,9248,6506,17972,13691,2256,7209,8336, +6524,14358,9808,11563,11076,15525,8477,21363,5186,19944, +5244,7323,3962,3835,1943,7276,20814,8973,20456,13010, +5259,7430,19761,18334,17044,20461,17050,17052,13492,6403, +6405,4289,14622,15676,10851,3752,14272,18796,18858,18320, +13367,9372,4512,13896,20126,20502,3797,19543,8815,5950, +14365,2095,16110,5497,16776,3566,13744,2096,12909,7265, +19564,1029,16825,20875,20905,3567,18301,8908,1583,8173, +16589,6347,19948,13234,14413,20763,20038,16250,11622,12542, +12543,1073,1020,20229,20006,1739,20880,11540,12559,18593, +20671,20312,18440,6068,11675,18672,2642,12253,7231,10952, +13434,2822,7233,20423,12100,11484,12910,16116,1125,3651, +8284,9079,12829,12861,6169,11818,5398,3221,2622,17521, +2054,6683,1109,20920,9081,4212,4213,11887,20702,5270, +7704,3956,11486,9920,20313,10367,3828,8407,9912,8256, +18196,17190,19661,16120,1820,5350,15671,2509,14122,8758, +10939,11888,8182,12193,7403,14178,13957,17523,2101,4770, +7655,8183,6886,15989,12544,20274,15038,18649,8414,16254, +1917,21752,18677,20375,10368,15058,16121,1188,16434,16294, +13198,14335,11249,10977,4962,3511,16649,8358,19962,21612, +15746,15973,1355,13958,21757,16656,12631,2512,14067,10572, +13292,5170,3655,6855,12688,14737,12872,10056,18202,20742, +9832,5590,11679,6891,18375,20766,1952,1731,15687,21643, +8751,12006,7737,11319,5333,10992,14052,12235,11944,7413, +20748,8118,7414,18273,11558,6209,12344,16354,13999,11761, +14657,21615,20712,18094,6624,1596,18476,6588,18321,21705, +17819,8705,7046,15690,9113,9121,2422,8120,15995,6694, +5325,2707,17426,17586,12922,2106,1289,18553,16355,3565, +16605,21616,5326,5451,13240,13802,13619,2711,15246,15234, +13803,12205,8685,18561,3522,20817,11914,9109,13419,17244, +7939,11219,4328,2922,14191,15318,20350,12042,9641,15545, +6359,20965,16202,17095,16606,13043,15730,20641,4329,11939, +13563,20368,16752,14349,8638,13804,13990,2234,15265,8122, +2685,2894,5849,4775,3702,12812,15070,9770,2475,2568, +5649,10429,10303,21619,5080,6428,20369,13046,15531,6487, +11516,7546,5720,19339,1004,20987,11782,10745,2253,8795, +2767,14353,16042,7675,2169,12884,1662,7594,18566,5458, +12885,6974,12417,9313,4151,17301,13910,5783,20142,19007, +17213,2477,11592,6276,5697,3272,11727,9998,20770,6709, +7682,7117,2025,15459,3406,1797,2375,8390,17435,1358, +4973,21451,16175,12569,13241,4148,6463,7683,15325,13131, +16643,7435,19378,11574,10380,21452,20254,12571,2992,6993, +3467,14090,13276,7756,8860,3388,17543,18699,1043,8324, +18700,4343,10993,11066,7118,15364,3531,9246,8267,18656, +13908,18715,18711,11688,6903,7819,1717,11833,5263,21005, +7817,9093,11343,7524,17550,9943,15396,1121,15086,10320, +10570,13706,21006,18513,9453,1932,14761,3157,11732,17259, +8542,9676,9130,6569,19320,10343,10265,12893,12894,12899, +9215,17174,19266,10930,2173,19321,3154,17554,14359,10645, +10933,11077,2580,20146,10544,15397,9698,3731,16207,3470, +7698,9252,9704,5767,5771,6957,18101,8654,18849,5096, +1140,12527,3715,8802,11271,16783,6092,2057,2828,5274, +17882,7710,2416,20634,4197,19671,1129,17883,4198,11776, +3738,4188,18970,8713,18381,6958,15960,17494,4200,18478, +17067,11280,873,874,3633,20715,14821,9870,13450,17754, +18870,7685,14235,7686,21462,19040,9775,1521,9528,17504, +17505,18011,12669,12677,8419,20377,20378,1147,19690,9221, +16487,14459,7291,7296,19678,7717,15962,4011,19137,12994, +13466,20429,21443,21447,21453,13211,9972,21463,2846,4106, +21215,7846,5998,12151,19461,11481,12678,12263,10127,4830, +4569,7982,20546,18863,14293,7483,4368,20996,4466,12391, +4467,20414,8881,15223,19646,7123,7156,6895,17513,15764, +15348,3667,17805,2222,18456,14564,11240,11241,16084,2931, +16740,1302,1158,7769,14460,6416,4564,5768,17920,4651, +13221,6324,18251,20273,4565,14437,8285,18467,1742,17981, +12528,20675,10041,6038,11368,1593,17872,6829,21627,14637, +4625,3870,16539,3924,878,1743,983,10210,8927,15794, +14574,6661,17923,8964,8848,7656,7929,20929,15903,6271, +5059,17362,5957,8521,17282,9030,21142,16846,14496,20578, +20579,5961,6045,16271,15748,21444,21722,21126,14210,11681, +16870,12775,20768,18971,961,16277,9958,2268,16325,17473, +4602,17975,18813,20068,6698,17857,11253,18643,19350,14773, +16456,13275,10876,11552,7423,18479,2937,18567,15281,12600, +7676,8573,5236,16622,2324,12813,6052,18393,9649,7183, +10986,20150,17598,6053,11393,3076,11708,20482,6787,5977, +17968,2874,9874,15444,8023,12418,9973,16994,19027,7189, +6675,3350,18695,18696,9655,15420,15927,17477,4639,14429, +20556,6027,19041,17388,17691,14198,7688,1278,8067,18405, +911,18712,13881,11019,9668,2434,8943,3863,3864,18635, +6920,10483,13827,10236,10646,10545,14163,15526,18355,21216, +19936,18904,6325,14734,2028,14470,20288,1984,17891,6772, +19191,13158,4664,12324,1141,10042,4606,13468,11921,15795, +9298,21708,11298,6609,16087,12635,19232,21586,16342,15928, +9305,9330,10237,12445,14794,15622,13718,1053,4209,3505, +9582,13370,8108,1407,2494,3042,13898,12854,19565,16680, +18079,4479,21541,13747,16113,3668,10797,2553,18905,5077, +5370,18773,7584,14171,16293,8133,10798,16977,19860,4621, +3922,17141,2932,14727,6475,17634,11859,2753,15018,19951, +7925,6942,10831,1438,984,4672,18918,4818,11541,6417, +18159,3988,17654,18530,4279,20540,20056,21718,14461,3671, +10325,15019,11542,17145,14990,16978,5598,4878,11369,18930, +18674,18679,14638,11766,1414,18789,11678,9105,6085,12036, +4480,21036,3332,3009,18518,4822,14731,14306,15021,14376, +11545,19408,20921,20314,3416,5467,12563,990,4879,1816, +4233,1400,20361,14991,21256,12130,14627,5599,2118,18599, +8149,10174,10898,9600,13786,20199,13996,19405,18087,12800, +20626,18797,17351,20707,9612,14076,8590,1730,13728,1115, +13729,1765,21485,2719,18941,3049,7472,21719,4379,4400, +19713,4440,5399,20394,9613,19097,18942,14643,4893,13865, +18798,8821,13311,14040,18042,4234,2918,11418,20093,11959, +19223,7782,10175,20449,18088,13977,20635,1287,15839,9083, +8048,1826,1356,13929,16855,9278,10177,4739,12632,16593, +8497,5125,15113,13389,19504,10268,12182,21359,3681,17925, +15994,20213,19535,1457,3622,5928,20813,13761,1314,7409, +6581,16272,11937,7244,15777,7157,17414,10492,8890,2079, +4675,15024,14993,4001,13223,19335,8195,9065,21441,2164, +16441,8049,9485,1732,17122,4802,15566,20941,9154,9720, +21415,9489,12807,1750,10589,3067,12973,12700,1958,2177, +20582,4613,12019,1206,6836,2519,20201,9633,19738,19739, +5551,5813,3967,5172,16326,3257,4489,2466,20454,12776, +19839,18322,19740,13535,18972,13732,12637,21417,4914,9159, +21645,21646,4658,2395,13272,11658,16278,10412,6019,7748, +2723,8257,8226,2520,21758,13002,18147,12304,21445,21499, +1690,12201,3903,2804,2269,10970,6448,7415,5716,17031, +3539,5774,3739,20815,13600,11483,4965,5335,12236,14225, +18807,14390,4216,5014,16457,16361,7297,21587,7347,18814, +16955,18388,18328,7348,19679,6110,16663,12369,1476,18535, +5825,17823,13967,18480,9122,18274,1353,6699,8975,7859, +8976,14937,4748,16173,7052,11471,10877,8831,6364,15860, +19611,19481,3070,17992,18505,20643,12370,18691,7796,18692, +14887,19602,16362,10915,15692,7058,7797,13854,6628,9380, +13564,17332,14606,15409,16542,14408,2779,12309,7300,18998, +20435,4929,11948,11127,5527,7497,15300,18609,14133,19889, +21557,11307,15133,7310,18568,7806,6674,5148,12929,10706, +19890,13809,14585,20820,16547,15861,13805,15490,20380,14943, +14506,8690,16890,5522,12644,5215,15238,12043,15547,5289, +2939,20652,11894,7070,5455,13011,12953,10921,17901,5184, +21420,16154,13096,18523,3721,7301,20976,3526,10222,14042, +16962,6975,9771,6788,19373,12983,5864,5087,5088,16043, +6488,14108,3179,12211,19513,7574,6431,6596,5784,11783, +19008,5199,8631,5725,5726,10747,20588,21351,9382,9302, +2427,3077,9502,17769,13277,14867,15892,5652,20250,15140, +9392,10377,9824,11135,10286,2347,15141,8693,1628,10435, +8123,20614,20325,14755,10748,11476,18525,15782,12212,21285, +14134,13572,7358,3078,6976,18233,18030,4423,18102,20856, +21710,3109,12603,14824,6489,9018,20659,14236,16908,2943, +3767,4430,11338,16764,13698,10016,10150,13104,17305,13956, +4494,20440,9353,20031,14892,4152,2480,15500,11009,15148, +8456,15421,6793,6986,11941,16176,11841,13935,15929,20295, +4689,13329,13672,6191,12935,5489,10184,9364,5200,16995, +14508,21558,14031,7083,3981,7995,7513,2845,3312,14758, +7555,10004,11581,19193,6801,14199,21731,17970,2484,5149, +8239,21734,19042,12606,4757,6738,3493,7196,15214,12496, +2537,2812,21294,6802,7084,7835,7303,14686,7436,13036, +3547,18872,1660,15033,14328,9661,19171,15580,15366,11155, +12734,16046,1734,6907,7202,12892,11690,11836,18759,5223, +7525,19218,11897,13288,18340,12735,11140,20559,5788,2945, +7000,8981,12517,3592,2794,5299,11156,19448,21012,6670, +12895,9430,9397,13995,10385,9669,3158,10527,11228,6814, +11979,10481,21007,5204,4039,19906,9677,4643,21465,15088, +9750,7602,2798,13302,21190,10348,18289,9683,21191,2458, +7824,4352,15099,6508,11800,19802,10238,9134,7646,17260, +5738,8268,17458,10103,19270,7384,19200,19492,19326,17341, +11884,1869,2211,9222,8270,14857,14362,21736,3113,13582, +13493,2022,8170,19809,10630,9701,3160,10546,3472,8481, +18296,9253,9228,21217,9411,9575,1108,11572,19816,10106, +5687,6517,12857,17808,2331,2825,12804,8582,18943,8415, +17025,17875,6069,9000,9273,8891,14905,862,17820,2629, +13239,8606,8893,8608,2873,5568,19113,19613,17429,18697, +16694,15460,7948,11973,6343,15695,6518,17833,12166,16996, +17502,17837,16910,9776,2847,19043,4350,19637,2994,6526, +1911,1912,8286,12915,2596,14082,2630,14086,21061,15203, +15204,9650,20251,19624,9656,5733,4287,20567,11361,11362, +18595,14464,17876,8421,12838,13390,15114,13269,18973,15961, +18686,1977,6837,3849,20653,20047,16543,2763,15696,7949, +14264,19168,3788,8162,9019,3165,3389,4080,7556,9803, +1719,4040,7378,7385,21257,13293,18956,14123,8704,13125, +18554,18129,6773,13628,6970,11974,6737,4103,18760,17463, +5637,10935,877,7830,12293,2197,10829,10830,12290,9911, +7237,13997,11460,16169,18089,4401,13794,17235,8221,13391, +4002,11963,12138,8227,4189,1392,14019,10878,14001,14749, +16184,6111,15323,14021,10479,11433,9507,15930,13816,20410, +14071,20411,11022,10386,3868,8398,12785,18461,11633,1712, +14377,12801,16847,13253,18205,3934,18508,20026,20762,1727, +3474,14876,9373,11693,4515,5741,1683,20271,11161,3776, +19946,2881,16244,4518,3320,16111,10794,13371,12447,12849, +16675,16676,16020,8132,20793,20876,12855,8011,8012,13939, +8490,6225,13589,1584,5137,21027,12072,8402,6390,11853, +17866,17869,20007,18302,3413,19454,6411,6881,11856,10893, +11109,2678,12073,1411,20877,12056,21372,20089,10122,20230, +4728,10953,20092,16118,9594,11089,18779,4425,15717,14926, +8925,8085,8177,18919,7234,21033,6746,1340,20232,21196, +19437,5466,6326,12178,3039,2590,15105,2462,14981,8217, +18039,14462,8404,4871,7106,5640,3414,19139,21089,18675, +6685,20127,2505,16388,6308,7465,14994,4376,17705,4881, +14075,20887,19205,16712,8657,10654,967,15679,11417,9442, +18739,11091,13545,12529,17465,17570,15107,8903,13152,8279, +12469,17744,20923,5676,11294,16683,13435,18931,8037,14521, +12239,2224,7927,9925,13383,16435,5925,10806,19465,1821, +3996,6240,18944,19334,9236,5943,9556,5331,9787,2951, +4771,18945,15905,9322,7242,2680,8090,15171,2467,12153, +17283,14440,9076,12453,5958,7977,11723,15972,17490,15872, +4259,16085,9614,14879,14995,9444,14880,4024,20015,6180, +17728,14711,2982,20493,8778,16273,16125,3931,16635,8196, +14343,9816,6833,15317,13154,3556,8372,5511,5858,5962, +21099,12232,6046,2264,12633,4546,2598,10405,8222,9445, +20611,12476,15747,19725,11655,10406,11118,8050,10058,10587, +13473,19726,11725,1619,6334,19837,9155,13254,12949,20890, +19184,1827,1343,19832,16603,13965,4583,19833,8711,7158, +14344,14079,12690,12343,16858,19835,13840,6589,7416,11927, +13397,15856,4743,16636,15639,16356,13868,2066,6099,18323, +6248,11097,10835,19230,18324,6210,14493,10943,20116,6845, +11533,5758,2653,4321,9791,12808,12809,10910,15727,3118, +16401,1969,6764,1831,17856,7060,7411,4788,18974,19208, +14577,7749,20638,15453,19603,1467,11277,14526,15975,14474, +19414,8228,3968,16054,7670,13398,15464,10220,6896,19874, +11559,1178,19508,13557,21347,9845,2178,17201,2956,6144, +21500,10759,19295,9119,4744,10277,16402,17092,19296,12506, +7940,5777,15282,19885,9727,18607,11004,21405,2527,15381, +3290,16203,5419,14055,20320,14581,10603,10688,16363,20117, +16802,16544,13006,20243,14529,871,20023,19114,15127,15290, +14530,863,12065,2837,16620,2011,11220,5286,6049,6673, +17036,3626,20966,19240,7798,5258,15176,7713,6775,19158, +5194,14849,2958,17495,19750,17782,6429,1478,1624,20977, +7595,8809,14451,14261,11128,1000,10375,6397,19441,2235, +4533,19372,5803,10762,13286,19619,7174,18171,2345,16989, +7175,10304,10223,7907,5850,3102,20854,5089,13030,7718, +3071,2961,16044,11996,15605,18664,16959,11129,15491,14262, +5975,9728,16204,2609,5113,12206,21572,8630,12187,20495, +2697,17902,6879,7499,18230,2902,9861,3185,15650,7549, +3103,19341,6258,17658,14820,5650,3104,9047,17903,20978, +12349,8444,7722,12508,3487,6789,7811,16761,12009,7075, +16410,15146,12956,17045,17046,15253,4178,11286,13955,15142, +20657,3105,18999,20988,16237,15394,18100,9013,18645,16007, +13982,6167,1505,2192,14780,12602,9969,16411,14095,14088, +2534,8099,6491,7629,9363,3218,6277,5938,20028,10192, +6278,4935,6054,6122,17214,7503,14197,17047,1038,10378, +11848,19634,10003,14486,3458,6599,20255,17604,19780,14681, +18024,10085,10782,21520,19379,6794,1994,9801,3768,18707, +6550,20660,10783,3407,19029,15210,12351,8325,15326,13215, +21459,11877,5833,7953,12165,14091,7085,16516,2810,15332, +15034,15884,14092,21234,9744,11102,14544,14825,11137,11849, +19312,19313,11017,7959,12732,7197,21716,16667,15553,19197, +19128,4133,3029,6904,13300,9261,8537,885,16413,1701, +5533,12941,19314,1702,9094,4642,2014,10888,7526,16478, +10666,20155,10454,9662,19447,18514,10384,15013,20997,19355, +4038,16334,6715,17614,12048,14432,1638,2200,11226,10159, +7375,14097,2539,5536,1706,6914,17311,10344,13242,13826, +9678,8070,17452,19323,15190,16484,6507,18047,21188,10232, +9181,4137,4537,6383,9182,14762,10097,19324,11103,7217, +9806,7528,19267,9986,19065,7382,2210,3359,13676,7450, +9216,4504,14870,19851,21470,4763,14360,9433,9217,3112, +13491,19388,12943,4452,8473,18429,19327,13983,20164,10547, +18419,9534,11105,14250,15398,3471,7699,2249,19329,6064, +21214,9266,9226,11577,16241,10551,18111,17265,18432,5152, +18436,19820,5668,17394,17395,6679,6203,21322,20357,17563, +2639,20109,12794,21034,4673,11860,16561,12560,18920,12254, +8580,12058,8581,12097,11457,9905,5670,17663,5671,5672, +1567,3282,17079,20734,21198,8710,20525,4882,1078,17571, +17572,10118,21411,12108,15354,18500,15887,14207,16389,6658, +21091,7657,17877,6186,13592,6579,17760,17761,17236,19142, +16686,21093,18548,14644,16345,15906,18043,20114,8583,17083, +17974,20736,12532,6727,5679,2381,6689,2412,6757,9927, +4902,8091,2382,12596,15840,21435,15874,5886,9299,14182, +17884,2650,13795,6355,16860,14740,6143,18051,8837,8422, +17415,16861,21360,8525,3682,17580,7053,16793,10493,18376, +8223,10013,9039,6857,16088,16871,3203,16719,6211,8304, +4966,16661,3068,4789,12481,13316,13966,16872,13317,17669, +18975,7618,19741,5182,12305,5517,16327,14475,5569,14290, +14291,11634,5336,16357,2424,6147,8993,21062,17068,6700, +4790,9796,17681,7671,1479,19233,21230,16458,16032,14211, +16885,11929,11930,2182,18227,8092,8097,10963,16505,20340, +7936,13322,13855,6591,4490,13402,15205,18481,9934,7752, +20216,5570,19990,11554,14664,9847,5456,15492,2357,4362, +1842,6667,17539,17041,16805,19992,6118,6149,16892,20027, +11515,14213,13323,18623,11130,9732,19304,16753,5408,18394, +13052,1494,1629,3079,10436,7359,10287,12213,15178,19011, +15893,8445,21592,6432,18822,20989,16509,10181,5978,11975, +13712,8098,9051,3163,20296,7366,16912,16913,19012,17503, +2668,6635,2240,18698,18103,18400,18104,13075,8536,3573, +4179,14399,7632,4690,14958,19781,9974,8100,14299,4691, +18105,9258,10947,15533,19030,8101,10987,8024,8025,19309, +19044,18025,9206,15383,1996,16919,13631,21622,9751,6739, +21208,10093,16371,19045,17549,20557,6803,3299,11934,1757, +13882,6156,18066,7961,2742,3549,18631,6157,9262,1641, +13824,9670,11406,13972,10528,9131,992,18071,8944,14917, +9891,9684,10349,8463,9900,18415,16939,17617,10239,18716, +1999,13688,19981,9263,3114,2702,5658,8338,2392,11075, +15527,9264,21218,9254,10107,19822,20533,20731,12109,2465, +16403,5936,8446,18652,21685,4404,2899,8671,20171,3850, +13012,19374,13037,12060,2338,7339,2893,19614,20341,1553, +1200,1843,2895,19515,4041,2471,11852,8109,15294,13748, +10790,4544,5162,18363,5246,1303,14992,19530,5248,11439, +3653,13599,13548,21566,10808,8760,12870,9490,12552,5173, +15593,1345,13558,2957,7254,4749,8686,8229,2786,17042, +1329,10661,7863,10679,14022,16510,9508,4153,15931,13105, +16920,9671,4042,9945,12024,12395,1866,16940,2714,16419, +13701,2715,1072,7105,2148,21426,5242,8645,1807,6302, +18190,19135,4458,21357,8910,21070,11455,12255,8219,18780, +17675,16139,10039,12256,11676,18596,19523,18040,3396,1811, +23007,23008,23009,23010,23011,23012,23013,23014,23015,23016, +23017,23018,23019,23020,23021,23022,23023,23024,23025,23026, +23027,23028,23029,23030,23031,23032,23033,23034,23035,23036, +23037,23038,23039,23040,23041,23042,23043,23044,23045,23046, +23047,23048,23049,23050,23051,23052,23053,23054,23055,23056, +23057,23058,23059,23060,23061,23062,23063,23064,23065,23066, +23067,23068,23069,23070,23071,23072,23073,23074,23075,23076, +23077,23078,23079,23080,23081,23082,23083,23084,23085,23086, +23087,23088,23089,23090,23091,23092,23093,23094,23095,23096, +23097,23098,23099,23100,23101,23102,11,34,37,328, +70,72,68,118,23934,6,66,74,330,75, +76,77,78,109,112,88,90,92,94,96, +98,100,102,114,115,104,106,131,132,133, +151,143,144,136,135,146,145,134,152,137, +165,142,140,167,124,147,148,158,155,154, +153,138,157,163,164,159,160,431,150,149, +339,338,327,79,80,443,18,323,321,322, +331,325,491,335,336,176,178,177,175,174, +169,168,171,170,332,185,189,183,187,334, +23103,23104,23105,23106,23107,23108,23109,23110,23111,23112, +23113,23114,23115,23116,23117,23118,23119,23120,23121,23122, +23123,23124,23125,23126,23127,23128,23129,23130,23131,23132, +23133,23134,23135,23136,23137,23138,23139,23140,23141,23142, +23143,23144,23145,23146,23147,23148,23149,23150,23151,23152, +23153,23154,23155,23156,23157,23158,23159,23160,23161,23162, +23163,23164,23165,23166,23167,23168,23169,23170,23171,23172, +23173,23174,23175,23176,23177,23178,23179,23180,23181,23182, +23183,23184,23185,23186,23187,23188,23189,23190,23191,23192, +23193,23194,23195,23196,23197,23198,345,352,359,366, +373,380,387,394,401,407,23679,23680,23681,23682, +23683,23684,344,351,358,365,372,379,386,393, +400,406,410,413,416,418,420,422,424,426, +428,430,343,350,357,364,371,378,385,392, +399,405,409,412,415,417,419,421,423,425, +427,429,342,349,356,363,370,377,384,391, +398,404,23685,23686,18727,4412,14015,14972,16730,10188, +12616,1048,8127,14553,23687,23688,346,353,360,367, +374,381,388,395,402,408,411,414,23689,23690, +23199,23200,23201,23202,23203,23204,23205,23206,23207,23208, +23209,23210,23211,23212,23213,23214,23215,23216,23217,23218, +23219,23220,23221,23222,23223,23224,23225,23226,23227,23228, +23229,23230,23231,23232,23233,23234,23235,23236,23237,23238, +23239,23240,23241,23242,23243,23244,23245,23246,23247,23248, +23249,23250,23251,23252,23253,23254,23255,23256,23257,23258, +23259,23260,23261,23262,23263,23264,23265,23266,23267,23268, +23269,23270,23271,23272,23273,23274,23275,23276,23277,23278, +23279,23280,23281,23282,23283,23284,23285,23286,23287,23288, +23289,23290,23291,23292,23293,23294,13,14,16,324, +20,22,1,24,27,30,121,32,3,36, +38,340,341,348,355,362,369,376,383,390, +397,40,43,126,128,130,45,47,432,439, +441,447,449,456,459,462,464,470,472,477, +481,487,492,498,500,502,504,506,509,520, +522,524,526,528,48,50,51,52,53,57, +433,440,442,448,450,457,460,463,465,471, +473,478,482,488,493,499,501,503,505,507, +510,521,523,525,527,529,60,62,64,69, +23295,23296,23297,23298,23299,23300,23301,23302,23303,23304, +23305,23306,23307,23308,23309,23310,23311,23312,23313,23314, +23315,23316,23317,23318,23319,23320,23321,23322,23323,23324, +23325,23326,23327,23328,23329,23330,23331,23332,23333,23334, +23335,23336,23337,23338,23339,23340,23341,23342,23343,23344, +23345,23346,23347,23348,23349,23350,23351,23352,23353,23354, +23355,23356,23357,23358,23359,23360,23361,23362,23363,23364, +23365,23366,23367,23368,23369,23370,23371,23372,23373,23374, +23375,23376,23377,23378,23379,23380,23381,23382,23383,23384, +23385,23386,23387,23388,23389,23390,645,647,649,651, +653,655,658,660,662,664,667,669,671,673, +675,677,680,682,684,686,688,690,692,694, +696,698,700,702,704,706,708,710,712,714, +716,718,720,722,724,726,728,730,732,734, +736,738,740,742,744,746,748,750,752,754, +756,758,760,762,764,766,768,770,772,774, +776,778,780,782,784,786,788,790,792,794, +796,798,800,802,804,806,808,810,812,23691, +23692,23693,23694,23695,23696,23697,23698,23699,23700,23701, +23391,23392,23393,23394,23395,23396,23397,23398,23399,23400, +23401,23402,23403,23404,23405,23406,23407,23408,23409,23410, +23411,23412,23413,23414,23415,23416,23417,23418,23419,23420, +23421,23422,23423,23424,23425,23426,23427,23428,23429,23430, +23431,23432,23433,23434,23435,23436,23437,23438,23439,23440, +23441,23442,23443,23444,23445,23446,23447,23448,23449,23450, +23451,23452,23453,23454,23455,23456,23457,23458,23459,23460, +23461,23462,23463,23464,23465,23466,23467,23468,23469,23470, +23471,23472,23473,23474,23475,23476,23477,23478,23479,23480, +23481,23482,23483,23484,23485,23486,644,646,648,650, +652,654,657,659,661,663,666,668,670,672, +674,676,679,681,683,685,687,689,691,693, +695,697,699,701,703,705,707,709,711,713, +715,717,719,721,723,725,727,729,731,733, +735,737,739,741,743,745,747,749,751,753, +755,757,759,761,763,765,767,769,771,773, +775,777,779,781,783,785,787,789,791,793, +795,797,799,801,803,805,807,809,811,656, +665,678,23702,23703,23704,23705,23706,23707,23708,23709, +23487,23488,23489,23490,23491,23492,23493,23494,23495,23496, +23497,23498,23499,23500,23501,23502,23503,23504,23505,23506, +23507,23508,23509,23510,23511,23512,23513,23514,23515,23516, +23517,23518,23519,23520,23521,23522,23523,23524,23525,23526, +23527,23528,23529,23530,23531,23532,23533,23534,23535,23536, +23537,23538,23539,23540,23541,23542,23543,23544,23545,23546, +23547,23548,23549,23550,23551,23552,23553,23554,23555,23556, +23557,23558,23559,23560,23561,23562,23563,23564,23565,23566, +23567,23568,23569,23570,23571,23572,23573,23574,23575,23576, +23577,23578,23579,23580,23581,23582,530,532,534,536, +538,540,542,544,546,548,550,552,554,556, +558,560,562,564,566,568,570,572,574,576, +23710,23711,23712,23713,23714,23715,23716,23717,531,533, +535,537,539,541,543,545,547,549,551,553, +555,557,559,561,563,565,567,569,571,573, +575,577,23718,23719,23720,23721,23722,23723,23724,25, +28,110,113,89,91,93,95,97,99,101, +103,23725,23726,105,107,61,65,8,23727,82, +87,23728,23729,23730,23731,23732,23733,23734,23735,23736, +23583,23584,23585,23586,23587,23588,23589,23590,23591,23592, +23593,23594,23595,23596,23597,23598,23599,23600,23601,23602, +23603,23604,23605,23606,23607,23608,23609,23610,23611,23612, +23613,23614,23615,23616,23617,23618,23619,23620,23621,23622, +23623,23624,23625,23626,23627,23628,23629,23630,23631,23632, +23633,23634,23635,23636,23637,23638,23639,23640,23641,23642, +23643,23644,23645,23646,23647,23648,23649,23650,23651,23652, +23653,23654,23655,23656,23657,23658,23659,23660,23661,23662, +23663,23664,23665,23666,23667,23668,23669,23670,23671,23672, +23673,23674,23675,23676,23677,23678,578,580,582,584, +586,588,590,592,594,596,598,600,602,604, +606,608,610,612,614,616,618,620,622,624, +626,628,630,632,634,636,638,640,642,23737, +23738,23739,23740,23741,23742,23743,23744,23745,23746,23747, +23748,23749,23750,23751,579,581,583,585,587,589, +591,593,595,597,599,601,603,605,607,609, +611,613,615,617,619,621,623,625,627,629, +631,633,635,637,639,641,643,23752,23753,23754, +23755,23756,23757,23758,23759,23760,23761,23762,23763,23764, +71,58,73,5,7,329,81,446,458,190, +184,186,188,123,139,141,156,161,162,166, +197,204,209,210,211,217,218,219,225,226, +227,233,234,235,245,246,247,256,257,258, +267,268,269,278,279,280,297,298,299,212, +220,236,228,300,301,302,303,307,309,311, +313,315,317,319,318,316,314,312,310,308, +304,320,305,306,172,173,179,180,181,182, +337,122,333,116,117,23765,23766,23767,23768,23769, +23770,23771,23772,23773,23774,23775,437,434,436,435, +455,451,454,452,469,466,468,467,497,494, +496,495,515,511,514,512,519,516,518,517, +513,453,438,23776,489,490,23777,461,23778,23779, +23780,23781,813,814,815,816,817,818,819,820, +821,822,823,824,825,826,827,828,829,830, +831,832,833,834,835,836,837,838,839,840, +841,842,843,844,845,846,847,848,849,23782, +23783,23784,23785,23786,23787,23788,23789,23790,23791,23792, +23793,23794,23795,23796,23797,23798,23799,23800,23801,23802, +347,354,361,368,375,382,389,396,403,20773, +484,474,486,445,475,483,444,476,479,480, +485,41,326,67,23803,508,21167,23804,4,23805, +23806,23807,23935,9,10,23936,23937,119,23938,23939, +83,84,85,86,54,55,56,31,33,35, +42,39,44,12,23,26,59,63,108,111, +15,21,29,120,2,125,129,127,49,17, +19,46,23808,23809,23810,23811,23812,23813,23814,23815, +23816,23817,23818,23819,23820,0,23821,23822,23823,23824, +23825,23826,23827,23828,23829,23830,23831,23832,23833,191, +192,198,199,193,194,200,201,195,196,202, +203,205,206,207,208,213,214,215,216,221, +222,223,224,229,230,231,232,237,238,239, +240,241,242,243,244,248,249,250,251,252, +253,254,255,259,260,261,262,263,264,265, +266,270,271,272,273,274,275,276,277,281, +282,283,284,285,286,287,288,289,290,291, +292,293,294,295,296,23834,23835,23836,23837,23838, +23839,23840,23841,23842,23843,23844,23845,23846,23847,23848, +8829,17231,6535,6086,20542,7042,18120,14179,15314,15901, +9317,10807,16850,17084,1310,20931,18257,14124,5959,7983, +12018,4587,17416,1130,12691,1620,19209,9156,7333,12998, +9036,18384,21630,20942,20743,18167,9930,2092,21583,5037, +4745,16637,19875,2869,16031,18206,17531,7250,1549,19478, +18563,15235,1836,11304,15065,10689,19887,3315,19763,14531, +6021,13003,18986,20644,2012,6025,10777,7575,11431,2185, +1002,5217,3180,1359,1506,1495,6633,1901,9970,17909, +15926,18626,14914,17436,14719,4149,7725,5316,8386,4033, +6795,8879,17252,17253,11834,1558,21785,21786,21787,21788, +21789,21790,21791,21792,21793,21794,21795,21796,21797,21798, +21799,21800,21801,21802,21803,21804,21805,21806,21807,21808, +21809,21810,21811,21812,21813,21814,21815,21816,21817,21818, +21819,21820,21821,21822,21823,21824,21825,21826,21827,21828, +21829,21830,21831,21832,21833,21834,21835,21836,21837,21838, +21839,21840,21841,21842,21843,21844,21845,21846,21847,21848, +21849,21850,21851,21852,21853,21854,21855,21856,21857,21858, +21859,21860,21861,21862,21863,21864,21865,21866,21867,21868, +21869,21870,21871,21872,21873,21874,21875,21876,21877,21878, +6905,11896,11018,9944,11594,5692,14720,10345,15311,17313, +11073,13677,11600,10627,17262,12754,8479,11208,21486,10333, +15102,13369,5048,9375,1054,6226,3669,2883,5098,19567, +12765,19568,2317,6231,16742,4819,7847,18193,10973,1202, +19952,8405,20040,8406,7324,3397,12430,12996,18932,951, +12470,4883,17960,3000,5431,7289,14307,3007,13669,14466, +14378,15344,21686,10176,1444,20623,7883,7706,7474,9616, +5680,17147,21094,18216,17786,18471,17853,15109,13192,19144, +18090,1242,17380,17085,5708,2681,17878,12154,9347,3452, +19224,16567,4261,2513,15633,16750,21879,21880,21881,21882, +21883,21884,21885,21886,21887,21888,21889,21890,21891,21892, +21893,21894,21895,21896,21897,21898,21899,21900,21901,21902, +21903,21904,21905,21906,21907,21908,21909,21910,21911,21912, +21913,21914,21915,21916,21917,21918,21919,21920,21921,21922, +21923,21924,21925,21926,21927,21928,21929,21930,21931,21932, +21933,21934,21935,21936,21937,21938,21939,21940,21941,21942, +21943,21944,21945,21946,21947,21948,21949,21950,21951,21952, +21953,21954,21955,21956,21957,21958,21959,21960,21961,21962, +21963,21964,21965,21966,21967,21968,21969,21970,21971,21972, +16716,2510,8526,10903,1315,15875,17286,2830,5964,17964, +18262,17987,17789,4903,16862,10059,9624,7886,15277,4741, +16257,3760,12433,20430,14083,11250,19742,9160,11251,14501, +16404,15749,2834,1377,2472,4330,2270,1378,10413,5626, +3784,1321,12999,21418,13200,4454,7888,4062,7860,6701, +19680,10917,2940,17937,15646,17682,3347,13842,11254,7350, +16459,13920,6592,17537,2863,7424,21326,2323,9797,13565, +4098,18168,6630,10141,14536,13811,15283,18569,16545,16756, +20654,7945,19306,10691,15548,10144,9651,9282,15761,13013, +3229,8438,20536,1694,14752,2296,21973,21974,21975,21976, +21977,21978,21979,21980,21981,21982,21983,21984,21985,21986, +21987,21988,21989,21990,21991,21992,21993,21994,21995,21996, +21997,21998,21999,22000,22001,22002,22003,22004,22005,22006, +22007,22008,22009,22010,22011,22012,22013,22014,22015,22016, +22017,22018,22019,22020,22021,22022,22023,22024,22025,22026, +22027,22028,22029,22030,22031,22032,22033,22034,22035,22036, +22037,22038,22039,22040,22041,22042,22043,22044,22045,22046, +22047,22048,22049,22050,22051,22052,22053,22054,22055,22056, +22057,22058,22059,22060,22061,22062,22063,22064,22065,22066, +9052,21308,3080,18756,12724,8021,20202,13409,1006,9772, +10979,19169,6464,16517,16723,3574,17793,20297,18106,13480, +3494,9975,9876,13330,15149,5727,8026,4496,7891,10151, +6988,6796,8027,912,20204,3459,7689,5816,15446,6804, +6553,14096,15216,15737,2813,19638,7962,10346,1705,14771, +21717,9211,17004,7203,17971,13927,16668,5090,9398,4043, +9679,21013,13850,9709,20158,13332,15702,5736,15188,9135, +10240,10350,9685,9265,19271,11078,17342,13335,5659,3552, +20166,6564,1812,1822,20848,9705,14696,17347,13055,1161, +12167,4566,3398,4797,11233,16212,22067,22068,22069,22070, +22071,22072,22073,22074,22075,22076,22077,22078,22079,22080, +22081,22082,22083,22084,22085,22086,22087,22088,22089,22090, +22091,22092,22093,22094,22095,22096,22097,22098,22099,22100, +22101,22102,22103,22104,22105,22106,22107,22108,22109,22110, +22111,22112,22113,22114,22115,22116,22117,22118,22119,22120, +22121,22122,22123,22124,22125,22126,22127,22128,22129,22130, +22131,22132,22133,22134,22135,22136,22137,22138,22139,22140, +22141,22142,22143,22144,22145,22146,22147,22148,22149,22150, +22151,22152,22153,22154,22155,22156,22157,22158,22159,22160, +6350,18790,1138,8373,2289,2560,10201,3484,11035,21378, +12482,1554,21148,10202,3018,19241,12814,17208,10305,3708, +11976,21309,10017,16765,3445,16627,19259,18343,15724,5934, +2291,13265,14383,2227,2228,13930,15091,14397,10393,4786, +20334,4856,12451,3878,13590,10995,1440,8146,15241,10123, +11440,20011,4884,5330,7849,4885,15720,11441,15587,7543, +16196,4895,11547,11444,11445,2058,15723,5061,1451,3266, +20943,10563,12032,18741,6481,19604,19605,11447,8527,18957, +10129,3842,6483,3455,21380,7592,2530,2325,16105,9393, +2111,10152,3859,10020,7559,2744,22161,22162,22163,22164, +22165,22166,22167,22168,22169,22170,22171,22172,22173,22174, +22175,22176,22177,22178,22179,22180,22181,22182,22183,22184, +22185,22186,22187,22188,22189,22190,22191,22192,22193,22194, +22195,22196,22197,22198,22199,22200,22201,22202,22203,22204, +22205,22206,22207,22208,22209,22210,22211,22212,22213,22214, +22215,22216,22217,22218,22219,22220,22221,22222,22223,22224, +22225,22226,22227,22228,22229,22230,22231,22232,22233,22234, +22235,22236,22237,22238,22239,22240,22241,22242,22243,22244, +22245,22246,22247,22248,22249,22250,22251,22252,22253,22254, +12354,3866,3867,7773,3417,14744,20979,11522,1412,5163, +21124,17120,17806,2446,18041,12674,17062,3191,1445,21628, +18004,20808,4436,20891,4630,8185,14183,11699,15601,15889, +7738,16442,6730,15388,2651,10960,8055,17418,15976,10812, +17419,15158,12565,4201,14713,18987,1369,20510,5627,10676, +9961,7166,15752,935,2656,1481,11255,4114,8681,18181, +3134,14449,21064,20980,19764,4751,18483,2428,15999,5830, +16571,6595,8842,19119,8448,16903,5616,19013,2896,6780, +11925,3722,20516,14453,3142,19031,21634,15089,14093,3815, +10313,10314,13216,4943,9879,13106,22255,22256,22257,22258, +22259,22260,22261,22262,22263,22264,22265,22266,22267,22268, +22269,22270,22271,22272,22273,22274,22275,22276,22277,22278, +22279,22280,22281,22282,22283,22284,22285,22286,22287,22288, +22289,22290,22291,22292,22293,22294,22295,22296,22297,22298, +22299,22300,22301,22302,22303,22304,22305,22306,22307,22308, +22309,22310,22311,22312,22313,22314,22315,22316,22317,22318, +22319,22320,22321,22322,22323,22324,22325,22326,22327,22328, +22329,22330,22331,22332,22333,22334,22335,22336,22337,22338, +22339,22340,22341,22342,22343,22344,22345,22346,22347,22348, +10154,9331,17220,4640,3390,19213,6155,17221,5617,16373, +11889,19795,16417,19383,9428,9663,14784,3446,10006,10007, +1681,7210,2577,18515,7757,20761,10891,9692,6922,9185, +7009,17978,19348,19201,19392,15399,3732,10647,10554,10555, +1775,1778,1079,4426,4427,13140,1389,20208,10861,11998, +3040,10047,11370,7043,12233,5191,4263,5968,1468,2727, +12976,875,17476,6055,6676,6056,20256,3188,6057,17480, +18701,6059,7691,916,17694,6671,9686,12406,6134,7731, +5119,12121,13399,13620,20323,5528,8503,8504,21150,20327, +20328,20443,4044,12766,19283,1286,852,851,860,861, +857,859,858,868,876,882,881,891,901,893, +896,941,928,924,955,966,974,965,970,969, +979,982,985,987,993,1005,1009,1023,1031,1033, +1042,1041,1058,1061,1052,1051,1055,1062,1047,1059, +1050,1076,1084,1093,1090,12005,1094,1105,1098,1096, +1111,1114,1112,1120,1113,1126,1127,1131,1145,1142, +1146,1139,1143,1144,1159,1160,1172,1175,1171,1183, +1170,1169,1176,1184,1187,1189,1199,1201,1197,1205, +1214,1203,1215,1204,1208,1223,1224,1220,1230,1780, +20526,6087,6094,1781,16266,19553,4527,4967,13400,3540, +10420,20432,9504,7908,17904,7356,12044,942,10339,17862, +21113,3495,947,5537,9687,5138,16340,12795,19913,15721, +17636,17023,4733,11245,11295,14640,20012,12031,4567,10866, +17275,14645,18444,20737,18600,14384,6887,3311,20680,8930, +8186,14441,10957,11371,21261,20628,14646,3832,11700,21568, +2356,1747,11093,10214,15909,3871,3683,11623,11299,17988, +20709,18472,11377,21078,11372,10912,13094,5969,6565,2548, +3240,8376,4264,10760,17289,16874,9077,14212,15753,5814, +16235,9473,14665,13324,9935,20751,1853,1236,1240,1243, +1239,1237,1262,1261,1273,1263,1270,1279,1285,1290, +1288,1284,1295,1323,1305,1297,1306,1308,1298,1301, +1319,1320,1311,1339,1350,1349,1357,1364,1365,1373, +1380,1387,1381,1393,1402,1405,1423,1417,1413,1496, +1483,1501,1429,1449,1443,1427,1433,1480,1430,1456, +1493,1428,1488,1511,1523,1519,1448,1563,1546,1550, +1568,1569,1590,1591,1580,1605,1606,1608,1598,1615, +1614,1630,1654,1666,1665,1672,1680,1687,1689,1700, +1691,1686,1713,1729,1728,1744,1735,1740,1746,1745, +9494,9172,15206,8380,12347,6839,10421,5195,21127,19620, +6840,10704,17125,17716,6705,5815,20118,2971,7351,10964, +6291,17939,15762,17905,4443,16666,5780,11053,16623,8812, +3489,2399,13325,11395,4702,20257,20518,19032,3789,8796, +11396,14893,3085,10290,2572,10750,5728,6600,14894,16921, +12586,14430,9909,2391,7518,18702,17913,11423,5785,7519, +18713,917,6810,7442,20560,10929,2758,14072,11842,18068, +18634,6910,11023,11157,12440,11158,9431,8945,17951,11159, +6923,10352,11028,10241,5660,10767,17006,15528,8622,21239, +13193,19743,14907,20244,8482,14416,1766,1758,1779,1791, +1798,1776,1785,1777,1829,1815,1835,1825,1844,1805, +1809,1828,1790,1845,1830,1810,1808,1898,1894,1897, +1896,1920,1904,1905,1908,1929,1919,1910,1931,1938, +1944,1940,1939,1941,1953,1956,1946,1951,1957,1959, +1972,1962,1975,1974,1976,1983,1991,2004,2007,2000, +2003,2021,2026,2027,2034,2029,2041,2052,2067,2051, +2050,2055,2083,2088,2105,2094,2119,2120,2117,2128, +2122,2127,2137,2142,2139,2145,2150,2152,2166,2165, +2186,2180,2175,2183,2229,2220,2230,2255,2261,2265, +6285,19332,21100,7690,20298,19940,1104,3897,12790,21542, +16782,20568,8817,5164,3370,8409,9603,4823,16562,4280, +8624,20888,7851,1685,4297,20569,15195,16213,7878,11373, +8187,19715,10638,16144,4306,11446,21225,11910,12454,10048, +12122,9378,1782,12534,19430,8931,8759,13555,21171,5682, +4313,12839,10408,16443,895,17287,18263,12184,9348,6244, +13270,16498,13091,2089,8761,13614,2252,9283,6212,19606, +17421,17093,1207,10269,19415,2371,2385,18385,14130,9067, +5518,2090,6449,10371,2437,11932,15030,21448,8763,18329, +21381,8779,2528,12708,21631,13294,2306,2285,2287,2278, +2286,2281,2305,2310,2318,2321,2319,2335,2328,2332, +2342,2346,2348,2340,2354,2355,2364,2373,2388,2384, +2378,2389,2394,2404,2407,2403,2417,2405,2406,2408, +2449,2445,2478,2447,2501,2536,2493,2495,2507,2521, +2518,2535,2498,2496,2545,2546,2550,2551,2569,2592, +2597,2585,2588,2584,2586,2625,2620,2618,2614,2640, +2648,2638,2646,2675,2676,2693,2694,2703,2709,2733, +2724,2735,2728,2726,2729,2716,2721,2756,2750,2760, +2766,2764,2791,2774,2796,2778,2785,2775,2772,2808, +9962,8501,1793,11256,7352,6148,13621,9465,19159,16754, +12709,10591,11591,13923,18276,3907,16152,19236,8734,16465, +14913,20655,4100,17099,3488,15648,11612,15732,12815,4175, +4752,13629,13069,10692,5387,15143,4269,10146,14954,15497, +6465,12273,8996,15734,17102,12649,9738,16511,20050,4115, +9114,12030,18577,21312,2195,12820,1008,12190,10193,10382, +8620,2903,2441,19121,9424,12390,12821,12822,3181,21599, +2993,10596,6994,14238,9332,20299,7520,17053,3911,3770, +1800,20104,13077,3608,9664,7521,16922,20497,13108,7443, +19791,21391,6128,8738,20260,9454,2803,2805,2851,2836, +2838,2819,2854,2859,2861,2872,2864,2867,2879,2882, +2890,2892,21361,2898,2444,2905,2912,2913,2920,2926, +2915,2933,2938,2963,2950,2954,2948,2974,2976,2983, +3001,3012,3021,3022,3019,3017,3014,3006,3037,3045, +3053,3043,3084,3069,2889,3058,3057,3093,3117,3123, +3141,3143,3130,3153,3164,3162,3177,3170,3171,3196, +3204,3205,3200,3207,3215,3220,3225,3231,3232,3228, +3255,3252,3260,3267,3274,3291,3295,3308,3309,3313, +3317,3318,3354,3329,3333,3319,3335,3342,3330,3344, +7820,2814,18717,13633,3496,18873,12281,12282,19642,12426, +12824,919,8701,7379,19796,13928,12125,3032,1861,18516, +10710,17224,8946,9400,9432,21017,9680,9688,4505,13636, +12126,19272,9693,10242,10243,11408,14858,5661,9223,1934, +18297,13775,19949,15295,10699,17566,18531,12671,1362,4125, +21071,21072,18737,14570,19531,20924,15776,4991,11114,15161, +10955,2151,10494,19666,16717,21262,5755,17086,20809,5232, +5233,14881,7934,14443,5062,9066,3684,15570,5552,5647, +21724,10070,10414,3520,20845,1469,2807,6702,19510,19115, +21507,6897,20646,19928,16720,17245,3331,3372,3367,3364, +3366,3373,3403,3399,3410,3427,3411,3422,3423,3415, +3421,3425,3451,3464,3465,3480,3481,3500,3518,3532, +3515,3513,3519,3512,3534,3545,3535,3541,3537,3562, +3555,3564,3579,3568,3569,3580,3589,3584,3582,3603, +3595,3606,3617,3619,3623,3613,3620,20383,3628,3650, +3648,3663,3693,3685,3674,3666,3677,3692,3723,3716, +3720,3740,3736,3734,3769,3751,3745,3746,3747,3750, +3757,3759,3758,3761,3786,3775,3790,3779,3774,3806, +3801,3802,3805,3821,3820,3854,3858,3824,3836,3848, +18482,20818,18748,10918,14938,3695,1326,20656,19424,7176, +5237,15494,14944,10707,15324,5018,17941,12725,19792,6989, +15008,2196,3441,5786,15217,9568,11879,11071,3533,9672, +19982,20829,20167,9459,13835,17581,15967,13720,21543,2115, +18921,17143,11714,13342,4709,6039,20013,20801,7974,20802, +19709,8836,1177,12259,11650,9619,19466,12260,1823,10049, +11716,21755,20810,8288,6872,15910,20945,6873,6101,19102, +21492,20946,13731,4075,21265,11871,5008,5212,20276,14882, +9068,5127,7987,15640,15996,18209,10599,10423,5555,21760, +21408,1211,6966,20967,9071,9466,3873,3880,3875,3881, +3887,3889,3906,3898,3894,3914,3918,3919,3941,3944, +3948,3957,3950,3955,3949,3958,3978,3987,3984,3990, +3994,3998,4005,3977,4020,4023,4029,4058,4025,4060, +4064,4063,4070,4078,4071,4073,4076,4069,4087,4090, +4101,4091,4092,4094,4111,4123,4119,4120,4145,4141, +4155,4143,4170,4162,4169,4166,4171,4196,4184,4181, +4193,4211,4219,4208,4240,4236,4226,4237,4235,4268, +4257,4267,4255,4273,4251,4256,4305,4286,4293,4326, +4316,4308,4360,4370,4369,4396,4395,4399,4398,4411, +12208,9994,21675,19752,10565,10566,18751,17043,1575,7177, +4930,1497,11949,7753,21065,21589,17827,2452,3542,9799, +21513,19773,17910,20990,5218,5529,13812,15211,13833,7190, +8632,1988,10980,21008,7178,10445,15095,6990,19343,16596, +13353,9102,19033,6642,13165,7119,17444,12587,7635,21421, +15934,21735,10508,15219,11881,14098,6811,13673,11957,19797, +12427,7211,16066,16597,2486,6911,8947,10510,1645,14100, +21422,9542,3161,18186,19547,14379,8015,18615,9318,18601, +1234,1748,16197,21202,7707,3803,16689,5712,2891,18619, +17422,2514,8807,3431,21449,17824,4418,4424,4437,4442, +4433,4432,4439,4449,4453,4469,4456,4459,4468,4492, +4481,4483,4499,4475,4485,4510,4514,4521,4522,4516, +4520,4519,4541,4542,4539,4556,4555,4553,4554,4560, +4561,4563,4575,4585,4578,4580,4576,4600,4608,4609, +4619,4624,4620,4622,4626,4650,4661,4647,4652,4646, +4649,4668,4680,4671,4701,4707,4704,4708,4711,4712, +4721,4731,4730,4750,4737,4747,4722,4732,4740,4772, +4768,4777,4780,4785,4784,4800,4806,4812,4843,4820, +4841,4860,4869,4924,4913,4880,4904,4854,4876,4870, +15094,5614,21419,16641,16205,18210,13326,18578,18579,15799, +2349,15735,3816,8326,9877,16914,16809,8957,2897,20531, +8894,8895,2485,3210,9880,20221,3168,13134,13333,4013, +20225,10266,13170,2820,14560,4986,12858,2826,6236,12675, +6016,14467,4654,11209,13505,21263,10050,10216,1767,1117, +15001,6249,8056,3810,18988,14815,8052,13509,12456,9505, +21320,2086,3575,3219,16224,8072,8612,8073,9377,12194, +2593,10802,21199,16252,7658,15162,13222,18161,21374,19867, +6002,2081,12295,18859,3932,14186,17088,21204,11505,5473, +13155,11275,1226,2061,12156,10060,4894,4901,4919,4912, +4853,4952,4951,4964,4959,4960,4956,4963,4968,4953, +4971,4994,5000,5034,5013,4989,5004,4980,4987,4978, +5016,4982,5006,4979,4983,4981,5015,4984,5045,5044, +5052,5070,5085,5078,5079,5081,5091,5092,5097,5103, +5104,5099,5123,5128,5120,5124,5150,5153,5156,5166, +5165,5160,5159,5158,5180,5181,5201,5187,5190,5198, +5188,5202,5213,5220,5219,5227,5250,5257,5255,5240, +5253,5251,5247,5254,5273,5279,5275,5281,5272,5283, +5313,5308,5309,5317,5319,5320,5332,5327,5329,5344, +11905,4905,4487,5126,4528,14605,10857,14651,13312,11276, +10656,5775,13442,2602,19111,18620,1422,9084,7665,15245, +13869,6960,6007,21081,9161,3454,2069,4838,16000,9495, +9286,8258,5628,7425,5935,15941,17098,20969,2522,15163, +21278,21761,15857,2070,5235,5112,8905,20024,11962,17475, +12547,9163,21648,12021,1499,5314,15358,5600,19556,7357, +20552,6398,20755,14154,21128,10431,9963,8529,4931,20324, +5486,12886,8530,2927,2073,21676,1875,17942,1555,15248, +17248,12492,17686,6371,14539,19939,2941,10524,16696,3945, +14915,7077,7800,17687,10967,4535,5348,5352,5354,5364, +5369,5368,5376,5379,5371,5378,5366,5374,5365,5394, +5395,5396,5404,5403,5415,5412,5414,5429,5428,5442, +5439,5441,5446,5481,5474,5462,5485,5461,5465,5464, +5463,5524,5495,5513,5504,5500,5501,5543,5545,5541, +5553,5564,5563,5582,5585,5589,5594,5596,5597,5603, +5612,5605,5607,5608,5606,5629,5625,5663,5642,5657, +5639,5667,5688,5695,5717,5702,5699,5711,5698,5701, +5706,5742,5753,5746,5751,5773,5769,5779,5772,5765, +5799,5800,5812,5828,5821,5841,5856,5868,5872,5879, +2875,4754,21288,6262,13163,13350,11202,12984,5488,14588, +20032,6124,15501,19974,2713,13971,20758,11789,12986,17478, +5388,12086,4067,21460,2789,14159,21289,13016,10227,7367, +1927,6805,1515,3634,3086,18237,14110,3166,12318,12404, +19798,16045,20258,14160,5787,18832,6434,2241,8813,12497, +20219,6995,10307,2075,11731,15268,3167,3793,15269,9383, +9810,17445,1862,11141,14161,3497,9885,3392,4975,7444, +11287,9022,3357,7639,15249,9333,17453,10460,14689,20135, +12781,12023,12736,12321,5133,8333,10461,10455,18288,3461, +14012,21296,5424,12896,9758,14690,5883,5882,5884,5893, +5890,5892,5891,5906,5910,5916,5933,5915,5929,5931, +5917,5944,5942,5983,5982,5956,5953,5981,5955,5963, +5951,5948,5993,5999,6003,6029,6028,6023,6018,6035, +6034,6044,6036,6043,6067,6070,6096,6102,6093,6074, +6079,6076,6075,6100,6114,6089,6081,6098,6151,6150, +6152,6139,6166,6165,6170,6173,6174,6176,6178,6177, +6190,6192,6184,6204,6205,6207,6239,6247,6235,6224, +6220,6222,6286,6284,6288,6300,6305,6310,6303,6321, +6318,6323,6366,6352,6363,6351,6373,6349,6372,6360, +9218,9024,19647,19977,6031,20667,15367,15704,11801,2745, +18839,12746,15615,21338,21157,4472,14789,21156,12944,21473, +15617,10469,10353,7389,16187,19328,19812,9187,10246,13171, +9764,9227,12904,19984,21054,13495,9765,1566,4108,21702, +9543,14550,10632,19331,19986,21475,19821,4482,14371,20570, +14380,11917,6088,11647,3227,20507,12863,20374,1418,1163, +16789,14125,8625,13837,1419,15197,19145,20574,11094,15377, +6420,5107,8294,11378,21145,2563,15115,6250,15913,2062, +9960,21348,1118,9312,4384,13443,6107,17294,4920,9561, +19968,10432,8232,12716,1132,20479,6348,6391,6393,6410, +6401,6412,6404,6444,6455,6454,6461,6460,6476,6474, +6473,6477,6501,6499,6498,6500,6511,6516,6531,6537, +6530,6566,6576,6580,6575,6590,6593,6582,6578,6574, +6570,6607,6611,6617,6641,6639,6644,6612,6614,6623, +6629,6660,6664,6657,6663,6678,6684,6696,6713,6682, +6731,6718,6774,6735,6785,6741,6763,6760,6758,6761, +6744,6756,6743,6745,6752,6749,6830,6828,6831,6846, +6843,6856,6867,6871,6875,6874,6888,6882,6894,6906, +6883,6892,6929,6935,6952,6936,6965,6978,6949,6971, +5865,6450,14029,15498,1577,11182,21633,7505,9509,17606, +4847,11952,1336,5531,17783,7259,21352,15505,14032,4717, +7598,11340,14033,14034,11956,2670,9826,8882,1880,6558, +14787,7212,17314,16048,11806,9689,21783,3638,11807,15809, +9267,14923,8111,5372,20764,8113,19524,7143,2143,21139, +18085,19938,6237,19549,5249,16253,13755,16564,13384,11502, +21487,15959,11862,4804,7147,14736,2952,12261,20708,14126, +6241,20892,7045,4656,20016,13758,3402,7884,4570,3193, +8138,20094,1064,4831,20948,12639,2710,6245,20095,17027, +4906,17582,14388,1788,21266,13507,6938,6932,6944,6987, +6928,6941,6947,6953,6961,7026,7033,7057,7069,7092, +7061,7024,7041,7047,7030,7032,7063,7031,7108,7101, +7109,7102,7168,7131,7187,7136,7126,7159,7135,7155, +7142,7153,7152,7124,7125,7140,7130,7134,7129,7148, +7127,7257,7236,7228,7232,7241,7227,7268,7278,7292, +7287,7293,7307,7312,7304,7306,7305,7308,7320,7330, +7319,7317,7334,7321,7349,7329,7325,7326,7316,7341, +7401,7410,7400,7432,7418,7397,7404,7426,7399,7407, +7406,7467,7498,7494,7491,7468,7458,7495,7504,7459, +10061,21267,14318,5144,18503,4907,16147,20682,3340,2831, +14524,21042,17196,21688,8079,1179,13475,11379,14809,21720, +8933,7984,13763,6008,17588,7792,21174,2725,5592,1119, +8431,8934,6362,3051,6542,5337,15540,17532,8840,7666, +13560,5071,10657,17991,1366,17290,4915,5318,15914,13798, +15804,19112,9419,17589,8377,5063,3843,15940,14934,7591, +17353,6765,8432,7427,8381,2570,16607,20713,10498,2523, +13403,14750,1198,15942,17427,6544,13180,5355,17781,15647, +17792,17538,6255,17038,4921,15841,15186,4130,9072,4839, +7991,6424,20819,18270,8095,4776,7470,7475,7464,7463, +7478,7486,7473,7462,7548,7539,7540,7542,7538,7561, +7569,7567,7566,7565,7581,7593,7585,7631,7616,7634, +7617,7615,7606,7607,7611,7614,7609,8468,7663,7662, +7660,7650,7661,7652,7648,7654,7687,7653,7667,7711, +7719,7708,7709,7701,7712,7747,7736,7735,7739,7751, +7733,7805,7767,7763,8220,7772,7788,7799,7808,7777, +7778,7832,7829,7842,7867,7843,7848,7854,7837,7850, +7853,7845,7869,7889,7871,7874,7870,7876,7894,7898, +7904,7895,7903,7923,7942,7930,7941,7922,7932,7931, +7167,17898,13734,21590,2398,4220,9652,10521,9822,2734, +13594,14319,12717,21406,12719,16283,12980,17299,14717,16407, +15572,16284,5175,16330,1371,21384,1955,5866,3206,10592, +10180,12779,20457,1500,2988,10080,11150,12647,13160,15733, +21591,5804,21649,16894,21514,17730,9835,7909,4590,13931, +11258,19765,21620,4491,10522,17906,19242,14284,12720,17911, +17335,7360,8735,17302,13924,11151,6979,4102,2699,3709, +11259,10841,19892,17599,1253,14955,13351,1556,6568,5340, +3082,11178,16512,5021,16470,15956,5421,11203,17544,9800, +21593,1601,5807,19122,15651,5574,7919,7920,7975,7992, +7972,7989,7986,7996,7969,7980,7993,7990,7971,8005, +8030,8017,8016,8064,8060,8054,8068,8034,8043,8059, +8051,8044,8032,8088,8093,8119,8110,8107,8135,8137, +8128,8134,8126,8139,8152,8153,8143,8144,8157,8145, +8154,8147,8213,8176,8178,8184,8175,8180,8224,8216, +8250,8254,8253,8252,8315,8278,8301,8273,8282,8303, +8320,8311,8290,8272,8300,8287,8293,8341,8345,8340, +8366,8374,8354,8370,8389,8478,8401,8418,8413,8458, +8412,8396,8399,8410,8489,8499,8494,8487,8488,8519, +20998,20073,2479,2194,3351,17103,19893,21621,17834,14484, +16366,5341,14114,19310,7954,19034,21386,11709,1194,5530, +12046,21153,7368,3004,13574,14868,20076,17105,3182,7191, +13817,15551,5027,20033,20693,5221,13907,6376,20131,15608, +17306,15147,20694,21635,15552,6668,1960,1516,4779,3144, +9516,15270,18339,17000,21637,9395,21332,12989,10785,20858, +10509,11400,12392,9745,18000,21623,6996,14200,15220,10526, +1372,18758,14058,11323,13047,6848,17166,7198,14144,17799, +13663,18001,15224,13080,20301,21765,20826,14241,14035,9981, +19799,4501,9886,2337,21741,7527,8515,8528,8522,8516, +8524,8545,8544,8546,10204,8552,8554,8571,8559,8567, +8589,8593,8591,8598,8600,8614,8626,8629,8633,8637, +8644,8639,8647,8655,8656,8659,8664,8668,8669,8670, +8680,8695,8692,8673,8702,8703,8708,8714,8715,8716, +8720,8725,8741,8745,8743,8744,8757,8755,8773,8786, +8785,8787,8790,8797,8800,8805,8819,8820,8826,8830, +8843,8832,8841,8846,8853,8855,8857,8856,8864,8872, +8866,8865,8884,8892,8896,8904,8909,8929,8926,8932, +8923,8922,8950,8954,8952,8955,8971,8963,8977,8992, +13709,2243,13936,17800,6812,6495,21698,16928,13049,20034, +3300,14487,6815,7213,14099,7445,7562,6559,13081,3089, +7868,7694,1531,2204,19057,11885,15225,19058,14141,13884, +7218,1708,12959,9219,12590,18072,12747,12225,18637,11409, +9457,17555,21701,8948,19449,17915,9401,17176,2212,7697, +10354,2213,19276,1945,13689,17180,21712,21703,10667,17007, +9255,9412,9809,6227,13749,21244,20700,3829,17026,19231, +15568,20065,17291,3173,17568,4808,4809,12626,1789,12483, +17382,20548,5176,19250,5654,21742,15425,2017,12825,16628, +19268,9402,15432,10355,14973,5154,9008,9004,9005,9028, +9029,9062,9075,9080,9078,9089,9088,9103,9104,9115, +9124,9120,9127,9106,9148,9141,9173,9196,9192,9191, +9190,9204,9195,9188,9200,9198,9237,9235,9244,9238, +9256,9257,9279,9281,9274,9277,9270,9296,9308,9311, +9314,9316,9340,9341,9343,9360,9357,9356,9379,9369, +9388,9396,9425,9422,9446,9426,9417,9451,9440,9443, +9441,9463,9464,9469,9476,9478,9486,9514,9515,9479, +9480,9493,9558,9549,9550,9566,9547,9482,9605,9581, +9611,9583,9578,9585,9618,9577,9584,9630,9590,9598, +13649,14373,5471,21226,8188,10999,11247,5591,15642,8378, +4916,14394,5593,21450,19753,962,4444,14945,10708,10182, +1101,4446,2350,16518,1507,7199,2690,10185,8387,11142, +20561,10621,12322,7014,7020,10548,11086,3283,18469,19502, +19500,4676,1065,18521,5506,12997,20172,5189,18958,21268, +18808,13799,13645,13044,6545,17295,18990,18509,13014,12933, +19625,5342,19899,4502,14203,4694,14204,9780,11891,13053, +5405,2682,4657,6242,2647,3194,4908,17089,12172,9107, +12264,10189,20949,13476,16951,17533,16878,8706,6767,6695, +17423,14153,6256,7547,3543,14155,9634,9580,9626,9588, +9597,9576,9503,9553,9710,9721,9718,9714,9757,9725, +9716,9717,9715,9766,9768,9793,9786,9785,9783,9819, +9813,9815,9820,9811,9828,9842,9846,9844,9839,9841, +9869,9855,9856,9854,9875,9857,9853,9352,9902,9908, +9881,9859,9906,9914,9933,9926,9915,9929,9959,9952, +9979,9977,9953,9951,9988,9957,9996,10012,10009,10027, +10044,10067,10078,10079,10051,10028,10063,10046,10030,10052, +10035,10112,10116,10115,10119,10128,10140,10130,10138,10126, +10121,10145,10125,10173,10187,10205,10218,10207,10217,10226, +2662,17943,2667,21594,16297,6710,6295,6153,12393,9746, +13485,1012,9982,12173,13135,1014,6816,17952,3550,9339, +5432,5435,5433,3833,13915,4377,4084,15836,12265,2599, +13519,7246,8295,2780,10600,7071,20259,10291,7001,9365, +6915,19450,6509,18906,13195,20018,3371,6243,20837,20838, +20683,2383,20745,19505,16215,15770,4385,18207,15813,14106, +6050,14504,9936,7994,1424,3660,5851,16572,17907,12484, +3072,3908,3909,15864,8264,3083,8956,9739,9740,16624, +9016,9747,9752,3087,14478,15045,15843,9023,11795,20859, +3393,11837,13142,7531,15844,15846,10219,10258,10260,10257, +10280,10273,10300,10306,10310,10308,10323,10321,10335,10322, +10327,10369,10365,10366,10372,10466,10422,10316,10425,10401, +10411,10444,10415,10398,10394,10434,10474,10486,10496,10488, +10491,10505,10497,10499,10515,10519,10513,10516,10419,10517, +10531,10532,10530,10536,10557,10558,10561,10562,10571,10579, +10574,10573,10576,10577,10601,10612,10620,10608,10613,10616, +10617,10618,10640,10658,10650,10653,10651,10671,10675,10684, +10685,10686,10682,10701,10714,10712,10715,10718,10728,10729, +10725,10730,10749,10746,10743,10761,10780,10768,10775,10776, +10247,20545,14996,15128,20554,18888,13372,8740,2045,5245, +3614,6572,2617,13750,13891,19917,2099,5919,4674,12129, +12074,19459,13652,16591,12673,12291,16831,16832,8742,3830, +1446,1080,1817,13469,15722,21544,4607,20803,11696,12180, +21570,4824,17192,11442,13437,8674,2623,18443,12075,2557, +17745,4380,6188,21571,5709,2511,15796,3195,10900,17524, +17525,10731,17526,11815,16604,16594,17764,8053,19506,6181, +9931,14184,15876,10904,2955,14444,7274,15592,8343,7054, +17763,17666,16126,2515,16070,4003,11606,12332,5512,9461, +20509,15201,7750,9833,14872,1621,10770,10795,10803,10799, +10994,10793,10817,10825,10833,10840,10827,10828,10856,10849, +10864,10865,10872,10881,10867,10890,10896,10895,10902,10922, +10926,10916,10894,10899,10907,10945,10936,10938,10954,10959, +10951,10958,10971,10983,10990,11001,11036,11021,11005,11037, +11034,11046,11045,11096,11064,11072,11067,11057,11060,11055, +11085,11116,11112,11111,11132,11117,11121,11149,11145,11147, +11170,11162,11166,11168,11175,11181,11188,11190,11191,11204, +11198,11200,11207,11206,11221,11217,11234,11268,11264,11274, +11273,11272,11292,11311,11293,11300,11291,11318,11321,11325, +10590,12368,5874,13561,2924,3428,11628,11514,13764,14445, +2985,8199,3969,12308,5846,16664,10919,13921,4173,2657, +10615,11988,3696,936,11611,14847,20069,21063,13843,16001, +16461,7672,7255,4099,1482,2292,12954,16218,14714,15495, +15134,21382,19001,9862,7072,12312,17540,10502,11977,2297, +10437,5853,12078,2853,7577,4844,21310,10438,7630,19353, +10480,18031,2077,15932,11710,9878,3209,5729,17440,15598, +4497,20857,7633,6344,3208,18724,17336,15189,4716,21295, +3409,8880,11880,8459,2848,8361,9129,9777,16103,12737, +3213,1720,18067,11618,16669,20188,11331,11346,11332,11333, +11339,11336,11349,11352,11355,11376,11391,11401,11364,11386, +11385,11366,11420,11413,11428,11437,11435,11434,11436,11429, +11467,11475,11468,11464,11474,11450,11452,11472,11458,11479, +11485,11491,11621,11501,11494,11499,11497,11521,11518,11519, +11531,11529,11544,11539,11549,11568,11584,11604,11602,11613, +11615,11625,11627,11493,11635,11636,11642,11665,11648,11646, +11643,11674,11673,11698,11707,11697,11705,18231,11712,11713, +11729,11728,11724,11737,11741,11744,11747,11758,11760,11769, +11799,11771,11786,11787,11768,11817,11823,11822,11830,11819, +17312,1642,17733,9056,9132,18239,10351,6921,20098,10644, +13496,20189,10549,11670,20099,12859,16654,5696,9980,5693, +7647,7162,5193,2761,11152,11790,5278,7488,3845,20816, +17766,15359,17271,2100,13616,19682,17688,8265,8163,17671, +14339,8136,15389,14673,15458,12611,12612,5631,6496,15763, +17100,3507,4484,12000,15378,4486,2866,10331,10066,17090, +13319,12084,8849,4922,20217,4778,9497,19616,9287,15880, +1846,11740,8205,6638,21595,1602,11477,3857,3983,1216, +2110,19035,2015,10292,3355,18032,18632,3577,3462,13039, +10387,18874,7091,7532,6916,12748,11821,11845,11851,11855, +11861,11858,11870,11869,11866,11886,11901,11908,11912,11915, +11928,11924,11923,11936,11954,11958,11942,11961,11968,11971, +11969,11992,11986,11987,11994,12001,11999,12004,12011,12012, +12007,12014,12017,12020,12016,12027,12026,12034,12033,12037, +12045,12061,12062,12055,12059,12071,12081,12083,12094,12098, +12099,12103,12102,12107,12110,12117,12119,12127,12131,12137, +12141,12139,12135,12155,12148,12147,12163,12168,12181,12177, +12183,12215,12199,12209,12200,12207,12217,12218,12192,12210, +12231,12237,12250,12257,12284,12247,12252,12272,12306,12292, +10389,10356,2216,14861,7370,12455,18412,18428,2040,9374, +15833,15771,7605,12191,18896,2097,11144,5094,19700,6408, +21561,6750,15167,20902,16093,16427,12791,16560,13721,4862, +21245,6445,8403,7133,1021,2773,10862,13776,5996,19136, +19498,18907,13139,12331,3672,3616,9596,19429,1304,18852, +21250,11677,1813,1741,17779,18597,17144,6232,20347,3923, +3823,11765,6327,10897,14463,5565,1441,16492,4875,21479, +20882,7144,3063,11749,18017,5271,9604,13789,2155,2410, +19710,6011,21562,9922,16714,4185,5705,3048,5444,5677, +7613,19579,21484,4438,10819,21073,12299,12307,12294,12285, +12327,12333,12350,12341,12355,12363,12360,12358,12381,12389, +12387,12399,12408,12416,12419,12425,12435,12431,12443,12449, +12450,12462,12464,12477,12458,12460,12473,12459,12466,12500, +12502,12505,12511,12533,12539,12526,12535,12540,12558,12566, +12555,12575,12578,12576,12580,12594,12592,12593,12597,12595, +12601,12614,12613,12636,12638,12624,12630,12619,12615,12623, +12646,12621,12618,12667,12701,12668,12670,12692,12686,12680, +12660,12715,12672,12659,12698,12769,12760,12756,12758,12762, +12797,12798,12818,12783,12787,12788,12789,12793,12784,12827, +12856,21200,6536,4825,5058,3284,2878,7976,4378,968, +13088,2594,12471,7879,9345,14805,21343,3285,2056,19580, +4074,16436,9481,3997,4829,13730,19146,1918,20042,15173, +2506,2413,16715,1674,16851,5353,21264,11375,21346,21756, +16122,13385,15256,2414,12196,11000,17725,7978,2370,8495, +18259,3253,5960,3254,7272,16315,19468,11863,14289,17284, +16601,7783,11548,11461,16026,11637,10818,3050,3686,13470, +3933,21644,9108,10409,16499,11773,9037,12577,20115,5211, +5860,10588,2722,2921,20453,10978,9487,1266,13237,8359, +13196,3656,7740,7900,13092,15355,12836,12837,12862,12848, +12860,12867,12842,12851,12878,12843,12873,12919,12937,12917, +12918,12912,12932,12952,12947,12957,12970,12972,12962,12979, +12995,12990,13004,12991,13026,13028,13025,13041,13074,13067, +13065,13056,13090,13107,13086,13087,13115,13132,13130,13126, +13122,13119,13124,13138,13141,13143,13146,13148,13174,13173, +13172,13194,13199,13204,13190,13210,13201,13228,13235,13245, +13247,13246,13248,13249,13255,13278,13271,13273,13268,13282, +13283,13290,13318,13308,13341,13336,13338,13392,13373,13366, +13381,13375,13446,13421,13440,13422,13441,13431,13429,13474, +5334,6458,13177,930,16324,1376,21125,7336,9992,15438, +15726,3538,6394,6103,2934,2290,6538,4632,9157,14149, +18315,18805,14308,7160,5611,2063,20684,16182,8116,1459, +18961,11002,1282,12123,3902,13346,8682,17383,16296,19673, +19674,5009,9792,17934,11560,2068,16638,2969,17424,1551, +11465,933,19297,9085,9086,7545,11176,21759,21780,21665, +13841,16985,18688,934,13477,7342,4917,10520,7343,12170, +6251,6252,6289,18386,15977,21503,13274,11098,6626,14391, +5082,21146,7489,16452,1832,16358,7163,4095,18621,15175, +13562,20639,6838,14528,9194,21585,13504,13506,13511,13522, +13514,13533,13585,13540,13575,13544,13539,13554,13547,13588, +13597,13596,13605,13604,13607,13608,13623,13625,13615,13613, +13644,13646,13658,13662,13665,13668,13680,13686,13687,13685, +13690,13695,13702,13707,13710,13711,13716,13715,13713,13726, +13752,13742,13738,13736,13746,13745,13772,13773,13778,13784, +13790,13807,13791,13818,13810,13806,13792,13788,13829,13839, +13836,13857,13864,13885,13873,13877,13861,13893,13892,13890, +13895,13906,13914,13912,13933,13944,13943,13951,13952,13960, +13962,13978,13979,13988,14002,14005,14000,14009,14014,14017, +18534,19838,10913,19989,14810,21325,5613,13671,18005,9007, +16453,19509,15066,19116,14532,2959,14582,19991,20647,13870, +9643,13606,19888,9644,8261,16887,2776,17846,16002,10135, +6899,3741,12977,21666,12537,3242,19840,2781,19754,12041, +12579,11511,16956,4681,20025,13969,2013,11061,15236,11305, +15067,10136,16957,5477,9280,5086,3259,15488,10639,17938, +18608,5778,21618,5801,21781,15779,2071,12157,9197,14395, +9301,10074,3811,15780,10858,15891,21207,938,9729,3073, +12485,13348,7910,2962,7809,16408,16057,2033,19774,19002, +8233,1484,10376,1924,20480,9391,14025,14027,14041,14043, +14050,14054,14056,14066,14068,14085,14074,14077,14107,14111, +14127,14120,14115,14119,14116,14117,14142,14147,14152,14158, +14162,14180,14218,14170,14164,14168,14194,14175,14205,14206, +14234,14240,14237,14224,14216,14220,14232,14259,14253,14255, +14274,14273,14278,14281,14270,14287,14286,14292,14288,14304, +14303,14309,14310,14315,14313,14314,14321,14323,14332,14329, +14334,14346,14350,14341,14348,14342,14338,14337,14385,14363, +14369,14366,14367,14387,14381,14372,14407,14414,14415,14422, +14438,14435,14447,14442,14458,14455,14476,14465,14454,14483, +13031,10779,18277,10081,7164,1625,5805,5945,3629,10433, +14354,14263,3630,18056,1883,3704,3243,14398,17996,6368, +1007,11100,10284,21045,12513,7573,11131,3074,11754,6781, +8384,19162,14195,19117,5852,2425,6430,14131,8810,12981, +10678,2020,20249,9510,16471,7078,12934,14507,11011,11991, +2237,3742,13934,9423,19626,13101,2787,6466,7361,10722, +20029,1229,19487,10446,13697,4337,15652,4616,8449,4638, +13872,4686,9017,14891,18182,17835,5022,3490,16722,3946, +14956,17441,17048,10224,20074,14298,7362,15239,10086,19783, +17104,15010,11878,17946,20077,19775,14490,14498,14499,14468, +14494,14512,14511,14522,14520,14527,14516,14510,14514,14552, +14556,14568,14559,14555,14572,14571,14562,14561,14595,14596, +14599,14604,14601,14600,14618,14616,14609,14612,14639,14623, +14635,14675,14649,14625,14636,14662,14679,14642,14614,14624, +14660,14630,14610,14615,14634,14632,14628,14629,14698,14699, +14703,14701,14705,14710,14709,14706,14716,14708,14756,14728, +14738,14735,14724,14751,14726,14746,14739,14745,14722,14768, +14767,14770,14782,14774,14783,14776,14779,14775,14777,21229, +14795,14799,14803,14797,14796,14804,14818,14807,14814,14819, +16964,6058,909,6797,6798,7192,3030,17333,16299,11222, +9468,7554,1995,14400,13035,9748,8691,19900,3297,15698, +15469,20407,15240,17163,4498,3892,17607,5532,14781,7514, +6015,13994,18059,18628,1134,4134,12438,16476,11835,2741, +10716,12400,12823,20205,2432,20662,4408,11689,19315,3110, +17446,12733,4447,7437,17912,8982,1579,3818,11138,9207, +7960,13331,13166,17249,17222,15151,10482,19052,17914,17561, +19053,9116,9429,7726,3636,20898,1292,18633,11403,6601, +1639,15087,15426,16058,13334,13109,16528,10160,6806,11980, +5224,20082,1256,9681,14785,21189,14806,14831,14833,14836, +14835,14837,14838,14845,14843,14851,14848,14864,14871,14875, +14885,14883,14886,14895,14888,14889,14897,14906,14903,14902, +14933,14952,14949,14928,14924,14922,14921,14968,15004,14974, +15003,14971,14976,14977,14986,14969,15017,15039,15036,15051, +15050,15048,15047,15049,15063,15072,15084,14911,15090,15092, +15101,15110,15111,15118,15131,15123,15126,15112,15104,15106, +15159,15164,15165,15168,15183,15184,15182,15192,15207,15194, +15218,15202,15208,15196,15229,15242,15243,15264,15260,15254, +15266,15276,15275,15279,15273,15299,15292,15293,7828,15306, +887,10021,17953,13243,9184,16186,16814,13937,13938,12741, +10347,15097,16067,10816,20085,12498,19692,18069,7214,8082, +17954,13359,15098,8104,4796,1882,13678,19066,17261,19804, +8245,9781,9782,19199,13040,19269,10233,15964,6453,19979, +10101,18587,10931,5991,8962,9220,7219,3498,10789,9458, +9403,6497,4764,20827,16533,8987,6510,9535,7221,9435, +6515,10628,7015,8988,10471,7393,14013,15618,9409,13595, +17464,19080,10552,10982,1669,14930,17409,2832,6335,17814, +3236,4911,17821,10373,6396,6051,7623,8309,1275,18279, +20462,20463,8958,1703,17054,14830,15308,15313,15333,15328, +15345,15352,15351,15347,15376,15379,15368,15373,15372,15384, +15391,15385,15395,15392,15400,15423,15410,15416,15412,15403, +15435,15439,15436,15457,15451,15448,15449,15462,15484,15486, +15479,15482,15499,15478,15502,15516,15521,15518,15532,15530, +15539,15537,15546,15538,15569,15563,15562,15567,15564,15584, +15585,15590,15613,15603,15600,15604,15624,15623,15626,15625, +15638,15654,15656,15634,15670,15691,15699,15686,15682,15678, +15677,15707,15710,15729,15715,15725,15718,15754,15750,15768, +15772,15775,15801,15807,15811,15816,15827,15830,15834,15838, +3778,13376,2463,14515,8411,20571,14331,19550,5921,21548, +17360,4547,4307,1066,2626,12865,16565,19957,19958,8496, +12681,15908,12682,19868,8416,6728,13197,12683,21076,11462, +16316,4677,4678,6004,4995,13655,12112,11657,3341,12478, +2600,8296,9628,5003,20338,5436,12302,1873,17198,3783, +1675,1749,20396,15817,5514,19293,5280,3052,6732,10813, +5010,9932,18747,17203,9635,18976,12486,7793,14333,18809, +16328,11381,13157,5759,13321,9350,17684,7861,13404,7279, +16078,2372,1328,5971,17965,20714,4970,17246,9288,1485, +19841,19511,7801,3429,3762,6733,15832,15849,15853,15850, +15851,15871,15878,15888,15904,15917,15933,15895,15911,15897, +15912,15938,15937,15939,15936,15944,15947,15954,15953,15965, +15966,15968,15970,15983,15987,15992,15990,15993,16017,16019, +16025,16030,16034,16056,16059,16071,16079,16080,16075,16082, +16091,16102,16117,16109,16127,16146,16134,16132,16141,16172, +16168,16179,16181,16193,16190,16201,16194,16191,16208,16214, +16222,16226,16238,16229,16234,16251,16255,16242,16256,16247, +16282,16264,16265,16280,16270,16261,16269,16289,16295,16308, +16312,16309,16321,16317,16319,16339,16341,16337,16336,16344, +15031,8206,12721,19766,8531,14946,10593,9653,3855,15573, +9048,5937,5976,1213,4604,16466,4144,19845,15291,12955, +13945,11661,16467,9836,3935,4334,1166,3705,16331,1979, +11099,2187,9125,7067,15865,10883,17836,11153,7755,14586, +17944,18335,13845,16367,5023,19894,10968,16513,13925,17546, +17071,19245,14540,2700,15468,21180,21596,15653,19895,11012, +9128,4032,13352,16963,16644,19994,13510,19307,7550,1150, +14959,3054,16917,16613,9749,1151,13819,7086,16697,17798, +5984,18827,1395,6467,18871,4079,11536,6126,6377,6736, +10693,19037,16577,19311,15609,21047,16374,16360,16343,16379, +16384,16391,16381,16393,16395,16378,16406,16396,16428,16444, +16429,16423,16424,16425,16426,16489,16507,16491,16493,16494, +16501,16527,16490,16503,16500,16497,16508,16488,16548,16541, +16566,16557,16563,16559,16586,16595,16592,16598,16611,16610, +16625,16630,16642,16632,16640,16646,16665,16653,16659,16651, +16681,16679,16685,16672,16677,16684,16682,16701,16707,16711, +16705,16704,16702,16741,16729,16746,16731,16757,16733,16743, +16734,16772,16803,16791,16781,16770,16771,16787,16784,16827, +16893,16828,16821,16863,16829,16869,16899,16823,16888,16849, +2016,15014,12728,15788,14266,3713,10452,16524,21009,2430, +13482,12319,19639,7522,10293,13231,19198,7557,16580,17447, +10786,20593,20616,10681,5837,10155,3088,9519,10765,17448, +2301,11404,21711,14961,13356,15597,20860,12222,7692,13486, +1678,9887,5764,17002,7120,21314,4605,9334,8461,8462, +19172,2201,7640,11595,17454,11427,2701,18108,14962,2795, +2487,3463,9570,14243,18875,8029,3301,12826,3033,17369, +14355,13219,19325,2160,9673,20280,17955,21209,20264,17510, +10823,17619,12749,13828,7451,6032,21471,7826,1709,6073, +4508,9434,7825,9138,11289,9690,16875,16844,16824,16853, +16904,16817,16854,16891,16859,16884,16820,16873,16966,16952, +16950,16948,16954,16983,16982,16979,17013,17034,17011,17018, +17070,17063,17073,17110,17101,17096,17077,17074,17080,17117, +17123,17121,17118,17149,17153,17135,17132,17158,17137,17188, +17187,17199,17197,17184,17191,17186,17206,17232,17233,17269, +17293,17266,17296,17288,17292,17274,17285,17272,17270,17320, +17323,17343,17321,17334,17337,17328,17318,17354,17352,17349, +17364,17359,17357,17379,17378,17389,17385,17376,17381,17417, +17420,17438,17399,17487,17451,17425,17407,17404,17468,17472, +13417,11808,10357,4082,17461,21194,10248,9537,10249,12092, +18646,12326,11569,5540,19277,14790,16944,1981,13498,13584, +1982,10757,7827,21219,21423,6608,11919,12132,21082,10733, +4420,8555,11230,17060,8615,19923,13471,10069,17989,14811, +15915,10270,17207,6374,16514,3546,2689,16519,3548,21401, +5121,19572,18781,4826,4655,7774,21038,3400,18935,21074, +7852,20805,17527,13653,20806,8492,2158,6687,13654,16145, +10111,1267,18618,21778,1452,14317,8297,6140,18019,20681, +18801,12013,1783,3598,4996,5798,20934,20950,13656,18947, +16123,11503,5416,17985,20575,13438,17471,17481,17489,17482, +17492,17491,17488,17507,17506,17508,17509,17547,17512,17522, +17536,17514,17529,17516,17530,17558,17579,17569,17618,17603, +17564,17565,17590,17575,17650,17631,17642,17635,17632,17643, +17630,17627,17664,17667,17676,17683,17680,17679,17674,17696, +17704,17699,17698,17697,17717,17721,17719,17722,17720,17735, +17734,17746,17737,17741,17749,17750,17755,17757,17762,17780, +17895,17790,17784,17788,17787,17831,17804,17828,17815,17826, +17811,17845,17847,17899,17887,17870,17863,17865,17879,17871, +17893,17890,17885,17886,17919,17927,17922,17962,17963,17959, +19727,11058,1784,1792,2631,2627,8838,13762,7590,7479, +11380,7789,4382,13866,21172,5713,19103,8550,17710,14105, +9038,11753,14813,7252,9069,9562,8344,14392,5282,20685, +10131,7169,18993,1899,21350,14884,13647,9559,17794,2168, +9042,15571,19930,10075,2632,2271,2730,9834,12142,4589, +5802,18331,4030,20981,12777,12710,5863,8753,12640,15694, +14674,4932,2698,17595,3856,9049,4088,17795,17796,19931, +5019,19623,16055,18333,6706,12115,3383,20048,15303,5422, +6502,13814,19932,11535,8102,2129,1152,14046,11756,19251, +7865,6505,8844,9741,9511,14542,17973,17977,17984,17983, +18006,18007,18014,18010,18029,18036,18049,18054,18093,18077, +18080,18075,18078,18076,18123,18116,18113,18114,18122,18117, +18138,18141,18142,18144,18139,18137,18157,18154,18162,18165, +18170,18166,18180,18176,18185,18188,18221,18212,18223,18215, +18220,18261,18245,18258,18271,18250,18243,18248,18278,18266, +18253,18252,18305,18313,18314,18310,18332,18371,18380,18401, +18360,18367,18387,18368,18366,18382,18369,18377,18373,18442, +18437,18446,18445,18457,18452,18459,18462,18453,18468,18455, +18501,18494,18502,18499,18520,18524,18538,18536,18529,18570, +10506,19038,3822,17611,17167,16525,1658,2035,7193,14109, +1232,1508,4944,7438,21333,7439,3211,7088,3391,20105, +4500,1857,17390,18107,1677,13699,10764,9208,1027,20261, +5789,2047,15221,11882,2172,9779,3460,14786,15447,1533, +9212,4947,20899,15340,14788,16219,14691,1122,17552,1870, +2459,9186,10244,16974,17178,9224,20600,3361,8271,20168, +14549,7456,19077,9231,18187,16822,4781,5011,4798,1103, +6132,7017,7022,7460,5609,1594,18372,5714,8423,12377, +10870,11119,11120,11218,14652,15002,2167,20686,8433,11125, +15805,9733,18624,20982,8505,16960,18562,18540,18565,18550, +18555,18544,18598,18603,18616,18617,18636,18642,18644,18648, +18647,18662,18660,18657,18669,18682,18666,18667,18668,18687, +18671,18683,18726,18744,18733,18745,18743,18736,18731,18732, +18818,18770,18812,18804,18767,18800,18820,18774,18777,18785, +18835,18864,18855,18857,18844,18843,18850,18845,18885,18903, +18917,18909,18893,18881,18902,19048,18966,18991,18933,18891, +18992,18984,19009,18884,18880,18946,18985,18923,18889,18948, +18908,18894,19047,18960,18922,19093,19094,19086,19098,19095, +19088,19091,19134,19155,19153,19150,19181,19178,19179,19183, +14214,16368,17049,15756,19635,9245,4344,4065,13183,12095, +7200,11312,19316,5459,13526,20464,7963,5618,3578,7529, +10622,13527,7380,16418,8470,13529,10625,9250,14433,3639, +5623,18362,15751,13378,7881,3124,20951,2363,7048,3430, +3657,6484,13566,5287,14667,5760,7833,6860,13407,17685, +11662,6980,10439,20326,1518,17692,14267,5390,21014,18026, +2850,16932,18840,10470,8475,16942,18422,16946,18249,3899, +4992,13379,13380,7705,7145,4524,18124,3804,6274,2102, +15586,17812,7784,3418,13759,18125,19147,14221,12802,16124, +7150,18126,19163,4262,4659,18203,19203,19221,19247,19227, +19261,19219,19243,19289,19290,19291,19288,19305,19284,19318, +19286,19340,19338,19351,19349,19357,19361,19360,19382,19362, +19364,19368,19423,19421,19399,19401,19409,19397,19410,19403, +19428,19438,19432,19439,19433,19452,19453,19456,19472,19455, +19458,19477,19499,19495,19494,19518,19520,19539,19532,19517, +19519,19545,19552,19557,19570,19612,19617,19610,19622,19562, +19574,19608,19573,19600,19554,19588,19592,19559,19583,19658, +19653,19656,19662,19655,19663,19657,19694,19720,19699,19705, +19696,19745,19733,19712,19737,19749,19724,19708,19704,19756, +18532,15052,14424,19154,17640,8425,17469,11624,2418,19475, +20893,17747,4572,17668,2333,14345,18264,13980,21407,17855, +18962,18963,15119,2565,6071,14393,6108,17894,20687,21273, +20781,5448,21556,20399,5519,5012,7420,3846,10071,3658, +18522,11590,12064,21147,5145,18977,8302,18622,20367,16149, +18810,13508,20549,12487,1471,17752,13445,1083,3292,21689, +15541,21232,3015,20584,19416,17858,18095,18994,6666,6112, +14668,2126,17496,14534,6175,2144,5452,5761,13567,6776, +7802,6485,5065,17355,16365,14396,2731,3971,11062,11320, +4332,6703,18275,17748,5595,4422,19714,19735,19744,19717, +19776,19695,19830,19834,19826,19854,19861,19869,19864,19873, +19891,19858,19857,19866,19886,19884,19876,19912,19919,19929, +19920,19921,19935,19937,19966,19964,19954,19950,19965,19943, +19956,19961,20017,19999,20014,20001,20041,20035,20055,20075, +20061,20059,20071,20054,20088,20101,20100,20113,20112,20110, +20120,20121,20124,20125,20137,20144,20149,20152,20173,20184, +20186,20191,20192,20195,20206,20198,20197,20203,20200,20224, +20218,20212,20209,20207,20220,20234,20231,20228,20233,20277, +20283,20292,20293,20289,20307,20332,20317,20319,20333,20335, +1772,15798,18815,9421,21176,8906,8850,16693,7179,20983, +13770,3136,9303,4270,8914,16896,15881,3432,1331,2188, +19541,8764,13127,13181,14834,939,19683,17499,2529,7864, +17300,16695,16806,5238,15054,1890,6782,8062,14899,20716, +14900,4031,6451,2326,14873,7813,8736,13451,3106,17470, +15212,16332,17215,4617,2573,15327,19014,11487,19164,3814, +12335,21456,2238,2400,21400,7185,12650,15417,21387,16472, +8207,13287,3947,20783,20252,21650,12887,21457,9849,7506, +2843,17126,10604,14426,1657,6492,12372,19628,3860,17838, +12380,14682,17947,14683,6861,6493,20339,20337,20348,20362, +20370,20311,20356,20363,20358,20379,20376,20382,20384,20386, +20389,20412,20392,20401,20395,20391,20427,20424,20436,20428, +20426,20466,20448,20445,20447,20450,20455,20452,20483,20471, +20475,20477,20468,20494,20492,20504,20500,20503,20506,20501, +20505,20517,20511,20523,20524,20534,20535,20543,20550,20551, +20538,20553,20537,20564,20566,20572,20583,20592,20602,20603, +20613,20607,20609,20622,20642,20629,20645,20630,20661,20618, +20619,20620,20672,20679,20670,20720,20705,20719,20699,20752, +20733,20744,20729,20735,20726,20730,20771,20765,20772,20778, +4345,21083,3711,17548,4939,12605,15866,7515,12780,19784, +21521,21313,16998,6799,19124,943,17217,11555,2431,4783, +21183,18484,18402,6643,17948,5296,11950,12652,11422,18708, +16520,17689,15611,21114,14239,12516,9020,6669,6908,5264, +19317,11063,17479,11139,17001,13038,2402,18046,15658,15152, +1217,2613,12890,14688,7578,19902,17612,17449,15554,18582, +18583,20824,19643,1640,3116,9520,11341,11342,14268,20595, +11324,7446,20262,21692,9755,10294,1998,11981,5817,16967, +21466,1013,1044,7915,20596,18837,6345,7603,10787,2353, +5988,6469,2245,17839,20302,14103,20777,20779,20776,20774, +20790,20794,20787,20791,20821,20795,20797,20811,20789,20786, +20796,20842,20833,20843,20844,20830,20836,20831,20872,20885, +20866,20894,20867,20870,20878,20903,20928,20940,20901,20933, +20970,20911,20917,20907,20958,20932,20968,20914,20913,20944, +20959,20912,20947,21025,21037,21032,21039,21041,21035,21056, +21055,21075,21067,21068,21085,21088,21084,21090,21086,21104, +21119,21122,21123,21133,21143,21134,21138,21154,21168,21166, +21175,21159,21170,21169,21162,21203,21195,21201,21231,21224, +21236,21233,21222,21269,21255,21243,21270,21251,21277,21272, +16933,20329,4138,20785,11597,9213,4278,19356,8464,7003, +21751,7695,1881,6817,21335,11347,20285,20345,14592,13110, +15428,20286,12608,14488,17956,20222,15431,3468,15227,17175, +7006,7730,9760,11892,18763,888,20415,6740,6819,19067, +19068,14244,13692,11900,12960,4140,15338,6438,21117,6033, +920,19273,7386,19805,7455,6826,4047,20599,17958,20165, +9436,14434,16535,2250,9702,18841,1611,20601,18423,4355, +2748,16537,2749,18639,2217,13693,19202,9229,2460,17556, +11810,6528,20169,19082,3473,20422,18433,4056,16108,13741, +17739,17751,1434,21092,14421,17816,21242,21249,21259,21253, +21293,21298,21299,21301,21304,21317,21329,21328,21330,21345, +21340,21349,21339,21362,21354,21356,21367,21368,21365,21385, +21373,21376,21399,21402,21413,21410,21409,21414,21446,21430, +21437,21438,21442,21427,21432,21480,21481,21489,21483,21501, +21491,21478,21553,21476,21536,21554,21537,21560,21567,21559, +21603,21582,21598,21574,21576,21610,21626,21638,21658,21660, +21661,21663,21668,21669,21673,21687,21681,21682,21683,21704, +21700,21714,21729,21723,21725,21737,21739,21754,21763,21764, +21773,21779,21766,21767,21777,23849,23850,23851,23852,23853, +12866,6246,17064,7055,6257,5909,6213,16924,16925,9888, +5946,4048,10251,12768,9563,3570,1394,14823,17309,4758, +21018,21024,18434,18435,2824,6691,16095,18964,18965,7337, +1068,6313,4323,2777,7355,8746,5066,8310,4842,16897, +1695,21184,7260,4692,16926,1858,16549,6554,3637,21600, +4696,19059,971,12303,11506,12266,5437,11508,19538,11382, +15005,6546,8747,6113,975,9506,11663,1425,19689,7261, +16033,10826,16927,19049,8332,2769,15429,6527,8484,1299, +20624,19863,4993,1942,5406,15591,18949,6006,16258,12432, +6893,4529,15390,5645,20242,20952,2817,6927,16768,5073, +11736,13984,12244,5322,2492,5276,11580,4342,5794,19576, +12420,1404,16107,18527,18539,20788,3641,17661,19206,8968, +19762,5197,15583,21221,7034,11534,11212,6933,12658,11087, +1806,14078,5526,20268,14336,3250,18312,8430,14942,18704, +18403,4538,12518,5745,8999,1571,20253,5586,19497,3501, +18883,16585,8008,8816,5766,8560,9118,6945,14219,16230, +8859,12385,8436,13064,6865,19019,8074,16322,13714,3874, +20491,9367,13976,18886,11451,13739,19654,12329,18155,16209, +16732,2260,2002,8640,21240,11843,8547,19434,18898,5413, +4419,21274,14659,1472,21509,4421,5776,12379,1572,10720, +3345,14502,8935,4634,15814,18811,2603,10873,6145,1346, +10424,10014,6777,5067,12371,21510,7298,17900,20278,7673, +5068,20174,7493,19246,18132,20717,14326,1696,1697,13408, +14327,2886,20176,21108,9174,20151,3055,2401,14275,15757, +12143,5343,17216,10735,7507,15213,5025,15461,3107,3108, +20993,6981,20515,4066,7955,11260,2972,20078,1255,20119, +9176,4795,2024,6998,14509,913,21334,5030,5460,14011, +20263,9889,19054,1135,2443,16301,21011,21392,1643,19998, +20308,3448,20159,18413,12589,14245,15896,16133,11672,5039, +7035,4415,19521,8851,8599,21161,18910,15765,2149,7649, +11867,11414,2717,18306,9599,13377,9551,19660,12452,19402, +14988,4787,12968,13961,12015,21412,14732,10637,16631,1416, +15680,5610,8774,8291,4710,18311,17528,7151,16346,21611, +10274,15519,1688,11938,2655,16889,8018,7496,7621,8158, +15919,17940,3386,15894,16104,14330,12852,21684,19976,3150, +3615,16818,18128,6267,5855,2242,8986,1219,12574,6206, +4899,4855,15103,14979,15952,18304,1819,5795,10869,17583, +10535,12546,1751,19308,10643,9399,1725,6406,9916,17230, +16303,19330,7964,5409,17225,20177,1540,4049,14772,18420, +18421,18003,10272,5151,20179,19855,1473,21105,4791,19995, +16865,15916,17039,2473,2482,17106,15507,21657,9606,14222, +13314,13224,17240,21495,8426,13225,2601,3002,2450,3847, +3604,17033,20400,8434,7068,2605,2783,5572,18045,15806, +4217,5130,15267,3137,16961,20555,15137,19192,8235,7508, +13630,2989,3187,10440,3491,13354,21522,15655,13456,2671, +6649,13111,13082,7727,20223,15706,4410,20148,16687,8677, +8427,2436,4549,19963,1099,12694,16183,18978,7490,10072, +10961,8825,3041,12830,21275,8201,15023,11106,21057,11297, +18241,7764,6273,14215,11967,8274,11620,5499,6066,3643, +20539,13427,18775,8898,9416,5588,7775,6680,14374,5440, +13542,20775,6851,17850,13120,5229,8911,16836,21640,21436, +16437,19585,14420,2226,15198,2419,7480,18044,18684,4314, +19728,17926,931,3687,21494,12378,11328,3466,15120,14658, +11122,20585,7428,20284,13097,8439,18397,20403,2457,7759, +7896,4977,16773,12844,8007,1155,3748,21768,1283,17700, +5054,20925,11767,21642,2919,12298,16349,6615,16445,16965, +5914,13307,8919,10791,16678,4540,1736,12249,1300,18670, +15815,12038,8306,11659,18816,7170,4238,4239,21177,13568, +21300,17356,2658,1383,20971,7280,1954,3294,8234,14753, +16008,2839,8063,11780,17432,1925,3222,11449,14754,7677, +13066,11051,7509,12727,16645,16473,7814,7080,11784,8208, +11785,10594,10441,9467,16286,13573,21677,13164,12651,3140, +21597,12238,20757,19636,4180,2973,19426,3712,20353,2442, +16156,15504,4940,21678,11951,2132,16073,13018,20441,3724, +15659,7089,10195,20156,1524,2692,10456,9890,15471,3358, +15153,17003,8997,7204,20861,13020,20862,12050,21601,9754, +20193,11733,16068,8242,17171,21052,3644,15349,7267,20915, +21163,8867,17019,6532,20057,9608,19333,5230,16837,4889, +12297,15404,18316,8375,18228,19160,20473,12514,14229,21651, +10098,4761,2771,6571,10724,13465,14311,6077,5306,11033, +17880,17541,15080,17610,8469,19177,12946,3475,2320,14919, +1581,1352,13396,1354,4301,4435,14769,6984,19377,6154, +16380,16673,5241,20698,8920,12330,18769,9587,12661,1156, +5100,10259,3749,10324,2379,3647,16136,11644,11456,988, +18194,3825,3951,8561,14177,14271,11601,5055,19138,2508, +14573,5820,18050,9924,19922,20840,957,18953,12300,11739, +1801,3148,8466,10022,15304,13083,13084,9852,4156,5634, +3303,1537,1538,8334,13137,4160,2746,7010,16767,19983, +11734,20864,9699,21021,2801,4107,16536,10252,10024,17179, +16538,9230,13682,17623,11811,15339,13500,7098,3155,21696, +17008,8990,8485,10025,3375,4660,15672,4218,5385,9291, +13735,10641,883,6982,8236,8781,8782,18338,10948,8634, +13458,10295,9366,4222,20863,18414,15674,3551,19279,19817, +2366,20336,5752,8493,19959,17665,3337,17924,4525,13760, +14185,8912,14742,16097,2420,3343,4315,11507,12695,10836, +13917,8913,12923,21319,6208,6336,12197,16027,14069,3338, +8822,3838,19108,9462,6312,5285,19881,10772,19369,9821, +2608,17651,12325,19076,2039,7604,11520,4068,12850,6939, +16246,17738,12761,17319,4861,18247,20009,4863,7132,9589, +4294,8280,12287,20879,13940,17268,2282,3060,13189,16779, +12965,12665,14172,1586,21246,8791,18851,11365,5102,12421, +10209,1077,11459,8179,13667,13281,2591,4874,10040,11748, +19204,10854,19285,13310,11243,14305,12967,18791,13694,1447, +3011,8255,15902,6725,21165,15852,13089,4888,13727,17723, +13546,6751,18086,11296,12799,7612,2679,7541,10652,19287, +13478,8936,3659,10073,3346,991,20688,4530,8907,18506, +12185,1322,5479,5480,12113,21276,13832,4324,1085,21120, +20895,18556,8683,18979,13256,14669,12488,4386,5401,8230, +7714,5684,10426,8572,13569,21106,20123,20972,14325,9848, +19768,14297,19485,6567,13641,20587,16285,4972,13260,21109, +11664,10082,20590,20459,9850,21518,6711,16333,2990,5869, +8609,18869,12216,12985,5808,11730,12493,5630,1333,10595, +12022,9825,13926,13847,7087,18485,17218,2876,3122,2944, +5297,19490,6215,14757,5028,21523,4941,16550,1360,20442, +19640,16551,8610,5492,20664,17108,12913,5324,7928,10719, +15231,6238,21141,8601,1401,14575,16633,19503,4260,10901, +19467,9620,15991,17148,4897,15172,19469,3621,17638,16267, +9275,19225,2953,7985,12693,16864,15028,7899,11532,12634, +1082,14741,2266,15812,19589,6539,1458,4910,16028,3424, +3201,18222,21664,3482,7335,16276,19292,5475,5965,12828, +4746,13765,17330,16359,2231,8568,12810,9006,16986,4322, +1246,12002,15858,10278,12028,17933,7251,20648,14533,13904, +11387,4361,1327,16621,6012,7066,9498,1212,7354,14910, +9309,19302,19755,15135,11007,3980,16990,9773,3135,10015, +19903,10457,7641,2351,21321,16529,6849,18033,20598,7728, +20465,1892,9355,4697,4470,9984,5302,14101,8613,6560, +18877,7093,21393,4392,19806,7533,6218,9405,12162,9700, +9703,10358,10026,3321,21095,9818,16546,3016,21726,1600, +9126,3025,18008,1182,1604,1607,1154,3034,1609,1610, +11872,11874,20695,2978,18729,13774,4513,14557,13897,2162, +5095,19546,18846,12617,20310,16338,16024,21396,3275,5997, +3276,4254,21031,2380,11694,2643,2409,21252,15559,16140, +13517,6726,3960,19533,11525,18793,7779,9923,18121,4168, +8089,19470,13386,3678,8045,18860,13479,8811,17917,9899, +6790,18134,8450,13932,21728,7079,11010,4493,12726,6265, +17608,6214,16370,19036,16626,15085,1517,6014,15365,13879, +18064,17254,5222,9523,6917,13488,6195,4506,11802,11079, +5393,18929,8916,9713,3265,18926,16840,20182,12111,19451, +9903,5049,5111,14700,10972,16036,2393,4955,1589,1022, +7776,7651,20091,18940,10605,8520,15760,18650,867,11504, +7110,5845,1116,8194,12545,9928,12921,5643,3841,20318, +18204,13238,19601,960,17932,1771,8970,19926,14747,4364, +2852,7346,14909,20431,11946,14044,10659,19239,20850,5974, +20610,16790,9719,15289,6729,5507,9158,1344,3256,8428, +1382,19476,21101,7935,19729,2984,15688,3289,19914,11945, +3485,15185,18326,2604,15643,14578,20640,19479,20066,4325, +5873,3293,16405,11551,18564,2762,18130,15319,3697,2606, +19915,15129,10690,5651,20481,14676,1935,2663,15138,4176, +3706,10285,2611,3230,13708,12888,17976,19777,18823,4338, +9873,14684,10736,6552,20408,15607,4409,1559,1562,9524, +19907,19493,10629,9573,15848,12757,14166,19560,13860,16260, +4814,8642,1684,17628,14411,19856,3214,6876,1191,8281, +1435,16210,8899,5703,14517,8818,20586,17542,10318,21750, +3151,5132,6598,12337,17718,21461,6868,21706,11576,18882, +15589,3326,14655,1895,2637,6931,8799,3502,9370,20309, +850,18528,4815,4950,18900,3314,9586,4292,1409,1123, +5818,13233,19180,20090,8543,17061,5581,10117,3920,11820, +4183,11582,19435,14925,8901,6943,14417,6681,3264,9910, +18784,17400,1442,2999,5673,6747,17758,18738,12025,8868, +4210,7137,11214,11052,20359,11868,5321,11412,10702,2555, +9320,5347,16709,20315,15274,20211,16839,21776,6946,4782, +20238,11943,11187,9954,21323,20528,15565,6332,3197,14146, +5053,6082,7036,6304,17702,16949,5718,11935,9289,18254, +2499,3995,10489,4958,16708,9272,7269,5346,1818,17024, +13518,17466,12627,13250,21096,21641,12465,9149,11651,19471, +1926,17322,8225,19380,13058,18742,10905,13963,1316,14743, +19672,20060,6311,8966,17325,17326,15059,15483,11301,16880, +13894,2835,21505,21647,18689,16691,17331,20019,13059,19367, +10874,2343,4840,9898,21306,6425,13062,10771,13063,17859, +3585,1529,18097,1502,20291,16409,20782,10882,9965,3384, +11013,18703,2046,8876,4755,11014,8939,9778,20154,2198, +19444,6999,18407,2206,20157,6522,19358,3419,1787,3901, +9268,9621,14832,2855,3837,3268,11550,9488,8969,7742, +19393,9001,8117,15060,19107,2652,7743,10276,8839,16639, +6762,13205,996,15121,4019,8730,11777,6072,2397,15262, +5284,855,11638,6020,3714,880,897,14908,5881,15890, +2566,12158,9460,2030,12411,12642,19238,1370,15082,3605, +11126,12188,8388,9863,12568,2856,7720,11960,13209,10317, +2082,3571,6013,7952,8453,18754,14004,12276,13875,1930, +6913,11565,16377,7396,11538,10575,6346,10031,19526,19664, +13251,19669,19897,16382,20910,12149,15515,2718,20239,5844, +16941,20162,9694,19586,18317,21721,10837,3376,4004,20636, +19871,4833,15711,12831,12507,2732,20129,2987,19540,19211, +12582,21727,5888,16412,10443,9242,18234,15575,20439,15418, +21388,17219,4021,15445,13412,2964,20079,4431,8698,15074, +2757,3234,20080,19431,986,20372,7599,12405,2244,19800, +9521,20194,18761,7601,15430,12509,11883,19069,18416,19070, +11745,13887,2747,18424,10104,11081,11082,11746,17673,7732, +14551,11084,18430,1587,14653,14692,9525,7875,5043,18856, +9897,3508,20527,3884,12504,13388,1081,20632,20839,1067, +10559,4961,11527,3807,14187,13116,16394,16658,10774,20514, +4934,4464,7027,12759,12853,12662,13426,18156,17267,1028, +2078,9189,1057,6413,8709,3921,7266,17785,3324,5427, +10852,11237,18914,3953,7703,18081,20732,9321,9145,15025, +18219,5548,17467,5824,8776,8417,13797,18606,16225,20122, +16399,19599,3237,10299,21498,10908,14503,15029,7114,20513, +9968,3588,1704,18831,3725,2636,4562,3128,18119,18466, +6307,9146,16981,2288,6622,18559,20756,7684,13499,14165, +13587,13368,964,5690,10683,11857,20039,17075,12106,4623, +13787,8869,14707,15230,1450,8369,9615,19584,17237,19143, +8806,2885,21551,4488,19590,16690,5966,5171,12696,10810, +13781,3688,15000,17028,18967,2147,14525,16022,16866,11918, +12871,13394,7481,12267,18653,19185,1092,4550,2423,17712, +3993,19967,12874,4837,1922,11509,17641,4265,8435,4172, +5418,19186,12925,1165,13989,13722,2336,11864,4662,20045, +18865,13202,12268,5827,6253,19156,8500,3809,18980,21043, +16987,5083,13782,6878,15380,8649,19877,10336,11639,16569, +4202,21515,11660,16003,14670,11257,5484,8689,10076,1752, +3020,5523,1837,12269,19757,15006,21762,1889,19483,3763, +7299,20649,14607,14671,15818,8307,15157,18740,5859,10610, +11656,14322,3131,11059,6361,2123,16451,16504,10911,11588, +20478,8061,8447,9871,17605,18063,6525,2877,6880,15233, +19161,20865,14554,15476,16094,17014,13753,19703,2641,18783, +17361,1786,19587,6844,2107,15068,11330,17768,7911,14030, +21331,11571,12328,16736,5743,12105,17759,17350,16170,929, +19670,1455,5338,999,7906,2191,17602,10000,19257,17626, +3504,3224,2251,16738,20904,11993,2677,16737,8579,2316, +2906,15016,1582,11854,6414,2821,12176,3279,18517,21771, +11645,4868,2330,18916,18778,15943,18213,2053,8562,18082, +12926,14535,15302,17994,20529,1269,6115,1489,14477,2784, +14583,1838,21279,2659,20096,12522,15918,12927,4925,20385, +10859,12879,4926,9645,19969,12270,18447,1180,1794,7803, +5420,14817,20753,11448,11683,11779,3698,7256,11473,15440, +14409,18866,14939,8937,8551,1296,15921,17713,6259,7678, +2633,4405,5315,1753,14587,11421,5877,19165,8506,21107, +2708,17365,15922,11389,9448,6972,19769,17908,13724,21753, +20984,14226,2664,16991,17714,13571,12271,15820,21181,6292, +11308,8854,18571,17157,17209,17770,8507,2108,9351,7073, +12334,13871,11101,18752,19120,5685,8722,20058,1309,15037, +12864,8953,9061,18939,15681,13532,13153,17727,4611,2308, +16323,2720,6333,3199,20064,9003,4320,9472,21377,13117, +1466,15125,12951,19371,8020,13100,2688,2844,10002,11041, +15741,6714,14842,18244,16385,6228,11267,8646,15315,10475, +9063,8115,9297,19730,2267,17029,16568,6834,4317,13520, +13617,6116,15731,13622,8618,21353,12035,12992,14874,12786, +14975,2136,4727,19859,11454,11163,4164,11108,5498,1585, +16600,6010,16383,9376,5101,14798,10208,10326,18441,14985, +4227,10038,10853,10648,17980,12057,16138,6230,11269,7970, +963,3917,19512,14087,8662,12931,14947,11640,3812,5979, +13947,14678,8765,13411,17437,20591,17797,20187,15627,3261, +5575,6279,19375,4009,10504,10925,9292,16298,17646,20030, +1334,15144,19778,2189,15882,1850,5980,7282,6263,8347, +4756,2170,16287,20995,14957,8348,6468,19685,15784,8938, +21458,10568,17715,13230,14452,5939,10569,18654,2790,20305, +8209,17303,4271,10814,12570,9512,12067,13948,2532,5239, +9565,15596,1733,21286,20718,15979,10183,21732,8328,2315, +19847,7369,5177,3817,15577,2298,10597,8737,10087,12277, +10447,9518,13017,12144,8362,11261,6534,16432,9921,7238, +20621,19092,6724,21164,7141,17873,6748,15561,18083,7586, +10124,6392,18084,13899,15108,16713,9147,16392,21434,8342, +2080,1190,16848,10940,6577,21228,12689,16857,15027,4026, +21416,12342,14482,5143,4601,3099,14423,5644,10407,14846, +17587,18224,11174,7664,15064,6625,17892,12169,7338,17990, +16660,10909,18389,13207,8732,14351,10821,19301,12599,9642, +13902,15301,6858,1477,17791,4969,15487,12077,11303,6632, +19303,17430,9240,2032,6340,10660,6594,9798,21179,18750, +10430,17967,5129,14822,14953,14196,14320,15925,2193,9175, +21733,12219,977,12278,17307,18149,21369,9452,854,8783, +15330,9054,4034,16521,2928,21524,20759,1348,11791,21636, +2965,15422,3910,12729,12936,21389,6991,19785,7914,5632, +10845,2273,15758,16918,9802,15578,5559,3262,14826,20663, +10448,11040,10449,6452,1659,5046,9164,8749,4551,16762, +11537,16300,6399,3563,17164,17165,6866,9851,4451,10981, +8575,18450,3609,9804,5835,17255,4081,16011,16414,16288, +5031,13848,7090,4348,8510,20665,15660,20344,6435,18486, +4105,17109,19641,8766,14479,6646,16479,5032,20532,2112, +13167,14545,6217,8983,11953,13078,15179,9567,3440,20406, +9743,13878,12585,1522,6030,21464,5990,17616,19322,19978, +4719,6061,1107,11143,5740,3477,11110,19528,2411,11846, +12880,12883,16804,9865,12889,6549,7441,7440,2977,18191, +16739,8086,20235,18782,4397,7235,8035,3328,6309,12082, +1886,9557,13387,17410,15683,13640,8965,16347,6583,10410, +2870,6627,13401,17094,1003,5453,15320,10137,17159,9971, +8327,17609,11205,15222,9110,7121,6759,16053,20957,8651, +20883,6948,4250,2176,16988,8319,2257,8033,11909,11090, +4909,1464,19811,2377,14901,4577,18246,16735,19701,1410, +13079,6297,15951,21624,6555,18714,11263,7523,4089,7516, +14960,8984,6381,17949,20606,7821,20666,1560,21050,21527, +17773,18655,10949,12029,865,5072,12938,10928,2113,3302, +1218,17111,9756,15284,8587,18584,18718,11898,16614,13825, +15510,15285,13021,5300,14916,2929,1863,12051,3273,1397, +14048,5178,21528,16699,19260,6677,15790,10162,8576,15250, +14138,15075,16302,5225,20722,20723,9293,19055,19905,15523, +11796,16968,7262,5266,10694,8350,15056,21691,15286,15287, +4759,16553,11489,10388,15288,11982,21680,16047,17777,5656, +18002,9805,14721,10766,11405,10623,7921,21540,5700,11850, +19563,14980,3278,21118,14174,13145,18195,13703,14730,9784, +7608,12424,2141,9554,12448,16195,17193,15255,3676,16433, +4281,8047,1655,7786,2263,1454,2174,11911,1024,19925, +15854,16794,5449,11329,12345,899,12434,2567,9500,18229, +13027,12412,2295,9389,20474,16902,14233,1512,11757,10674, +14853,5047,5042,4859,11903,21497,7761,8395,1222,20180, +14987,4988,21639,18924,11904,15343,17402,6457,12366,9483, +12697,8728,21366,1966,20962,16799,1036,10139,14227,1627, +3075,20460,7215,17339,14920,19544,21130,5243,16245,8921, +1534,16530,10165,3611,14036,21625,18838,10462,8767,13022, +3183,12656,2303,15472,10788,19385,2246,4760,8071,1644, +14827,10315,17801,3090,10234,20160,7530,2038,9529,17131, +16935,8635,14869,1388,20487,12897,2488,10467,6470,7094, +12591,6820,13023,12510,9987,14102,17802,17315,2489,9025, +14965,10167,11598,6651,12422,15226,4507,13112,13538,18489, +15473,17392,8471,7642,21744,9892,13169,9336,4139,17656, +20136,7007,7452,21053,3593,18153,19347,4118,8472,11899, +15705,12610,15822,15823,20499,3893,14246,8558,7453,4644, +15228,10390,8352,6823,19807,9762,20008,12248,14725,5140, +17567,4872,21135,4873,2823,3327,8834,6001,7587,5351, +17408,15631,10062,12774,4584,14283,5797,4215,14712,10178, +13593,16274,21493,8729,17329,15641,11201,6766,14935,1597, +5417,21379,11252,7937,20690,13903,5214,9496,18989,7353, +1692,12388,10778,9390,11322,14057,17545,9872,20294,7553, +12958,13076,6551,21699,18526,6977,2858,20111,19363,3877, +6937,16431,4653,11242,8408,8672,10212,3753,3334,12530, +11244,7239,4402,5400,17813,18160,6187,18549,10655,16980, +6690,9767,12703,19234,12702,6395,9040,18325,3100,16279, +21468,13085,12901,21472,9404,1541,15824,6562,17553,4207, +5871,2491,8337,4698,3304,19073,921,21609,18136,3819, +21292,6196,21394,7016,11691,6135,6924,13263,1710,19275, +9027,11838,17842,7534,7535,12961,2134,21023,11231,9541, +9407,7018,21695,8949,14276,12230,9139,4052,14918,2997, +10529,1652,1281,10391,17226,8888,10253,4356,10359,7536, +9232,1872,7394,18640,2218,17345,7537,16947,5664,2023, +11812,9438,3156,13502,12070,10633,21697,10553,20196,11814, +8486,15529,21220,9233,13985,18463,17706,1265,17711,10811, +18146,20953,17150,19675,12711,2272,2396,8198,10879,19615, +19927,17097,11610,904,15493,7913,6636,19248,3186,3081, +17969,20484,12584,1997,13484,10450,1528,20161,16609,16463, +20070,15549,16778,1613,12764,2098,10698,9593,12289,11196, +18594,13941,7398,2802,2497,3062,17397,4543,12003,21248, +11530,20922,20608,10211,8148,12468,10328,17078,17401,19462, +20886,16180,20799,10043,5430,3652,9601,16142,2464,8658, +9346,18143,13696,20930,20627,5678,12625,15873,9082,8151, +6479,6185,6755,7781,10533,8368,927,17852,4526,5549, +4900,8420,21550,15259,10057,2806,4679,4027,12974,20547, +20973,19237,6634,21516,1851,15522,13815,1386,10153,6556, +9136,2215,2283,2284,8140,1025,3852,8457,9901,11080, +10975,10700,14844,14209,6889,10976,18265,1460,5967,1461, +14188,8557,8650,1367,6254,13953,14039,17204,7492,7344, +11278,17066,14877,4006,20342,11616,20402,12186,17115,10077, +1599,1490,13954,6119,5615,5291,5260,4445,2840,6275, +5721,11282,14113,9073,9304,10477,15862,14156,8237,19970, +19971,2239,13523,10019,2274,14137,9074,18235,16578,18280, +4346,6841,19786,16579,6280,1231,6281,13525,18611,16581, +1168,944,16415,19129,9095,13632,10614,2923,9817,5862, +7484,3690,8197,3119,14448,11553,20321,9795,9239,7065, +12444,8260,13347,4096,2925,2451,10476,2125,8259,17993, +10914,19300,20651,4614,15322,15247,17594,5196,3178,5216, +14912,1693,13808,21178,17593,7912,13029,12645,2768,15496, +21182,6370,5131,19973,13279,16159,8455,13103,13214,10381, +21740,16907,8238,19898,9394,18282,10005,1879,2130,19482, +1001,11363,3129,14254,15742,20043,9788,12402,3379,7059, +1714,19028,13751,4298,5468,8675,10330,20889,18936,20677, +6330,9607,18546,14648,20936,13549,10402,20580,11726,16329, +9210,4022,13576,12241,15738,11797,15335,8577,6129,13634, +2904,5619,4012,12782,8959,15512,5621,12401,8621,17058, +6821,2247,12283,3499,6561,15337,16583,16584,5952,8563, +4018,6768,15321,6548,9368,17659,18890,20900,19087,18454, +3986,4291,14456,12134,5157,20036,20871,12286,2461,4295, +13428,3645,10110,16135,1737,4228,14729,4229,4374,5747, +19548,8517,13121,17707,2949,4997,17081,14208,14469,12564, +20703,17276,3514,12136,18950,4127,10581,19100,8189,2415, +10403,14471,17239,19105,21227,18473,13777,17091,2696,18378, +19106,19591,3602,16348,11774,4128,2986,21504,3121,10442, +9976,16496,7315,12993,7273,7113,7056,8595,3581,5084, +7431,20175,11970,10045,1921,1385,20306,12353,12556,5038, +9111,5136,6037,15401,5210,20272,17633,20010,5770,6084, +20140,10855,19707,2307,11695,12679,14495,18678,2339,18370, +6688,1888,5927,5757,17935,8974,903,11306,16089,18065, +18630,16938,11575,1341,14641,8928,18792,20935,21488,5060, +7933,20710,9170,13393,6962,15454,5020,2163,7149,16953, +3624,19618,5457,7950,13521,7466,7597,12446,10832,5503, +16749,5550,6959,8305,7340,12362,8661,13151,15258,1110, +959,7741,5064,18327,6697,20046,16797,15489,7171,3523, +995,17040,19188,13991,13704,9966,16060,3586,12314,15187, +19770,17250,4683,11687,4388,6992,3528,19195,20999,10262, +16936,9658,9665,6141,20812,18968,13203,12875,6543,5454, +8379,6341,20103,19629,2737,15181,5989,6909,14852,5655, +2797,20106,19384,7002,16929,10197,9526,11556,18027,20108, +7099,7100,11492,4810,14081,11466,4663,12076,20020,2660, +18448,953,11006,3764,3486,6337,3813,11478,2429,20343, +10083,12653,21110,6266,20409,19125,21290,16101,10088,3973, +19252,16810,10094,10095,6268,19130,5288,1878,10868,11430, +3202,7485,14018,14748,2314,10473,12604,13494,12415,3506, +17140,2860,3925,18199,19099,8727,20022,12557,2649,7669, +4028,3851,19514,19862,5854,19945,16652,13785,6606,8013, +13913,15374,5373,21397,11498,18542,12948,10213,3959,8549, +10329,7290,14439,21140,21775,5566,20676,13467,20804,8038, +5681,3963,18217,8870,13987,5885,12367,20706,11095,16096, +10611,3247,12101,16275,11759,7988,18225,4603,19607,21584, +3904,7487,3120,11561,11177,16217,4331,14816,2525,19352, +5290,10501,1715,15606,20991,20371,5534,11020,14059,14201, +10737,10738,20051,10196,11049,1707,16812,16531,9099,16969, +19060,3449,15620,19808,10235,3360,7095,12079,18491,16420, +16421,17059,7222,11050,11029,9408,9706,6925,890,4645, +3363,10254,10105,923,4765,9708,1259,6160,6161,6163, +1774,13244,15712,20650,2476,13296,8066,8069,15714,4588, +11180,1271,15759,6824,18721,3885,2124,7345,13766,3625, +4077,16798,13767,13208,11865,19189,13981,11512,11390,21690, +1181,19004,18625,15574,1133,7754,6260,12114,1754,19123, +5293,15576,7081,940,6171,5402,12832,15842,19354,15180, +15785,17998,8788,1379,15334,20498,9753,10018,19566,16856, +18746,14151,17644,16909,1616,13986,8308,15069,1634,1635, +14723,5450,5483,6380,4612,6983,9203,19569,12152,10834, +20393,7981,11680,10134,18868,18458,16430,4165,13050,14569, +6329,21258,17982,15353,18680,18470,16792,5930,10984,2334, +18383,6365,19751,16364,4097,1227,17936,1552,16077,10120, +10781,14265,20072,19010,19782,4495,15215,17256,8474,3169, +1612,3536,17897,16911,9592,6415,8077,6422,4586,14611, +14982,17142,20881,13436,6418,4886,21774,11056,20800,3010, +20631,15769,12704,2179,17037,21454,16997,13679,15588,15434, +1525,9096,9140,17615,1196,4365,13357,13358,6130,13136, +11480,7371,3610,11966,15555,15336,17551,12052,5303,1535, +9100,15474,10297,5791,13113,18009,7011,7390,7563,2258, +3305,6440,17263,12905,4053,16220,7395,9234,16390,13768, +4933,10965,13602,5294,16474,13133,5940,2327,9097,13856, +20083,14356,16482,5301,1136,15556,5426,20084,5205,1536, +16485,6825,4050,16221,4054,4890,8141,17160,17600,17168, +7004,20102,9381,12220,6650,19258,20086,12226,949,19131, +17372,6441,18676,3888,13285,8967,17384,14890,5907,17822, +18817,17825,5557,15053,8995,12712,4126,7271,6753,11920, +13757,18519,21565,13612,12877,11279,15595,12819,4132,10884, +10988,5185,11762,19698,3280,18018,11199,6940,5139,3478, +17809,2368,4167,18197,21431,1547,4734,4450,894,9617, +10215,20349,15907,3654,9112,16143,4896,17709,10809,17087, +13057,20387,3966,11586,5312,16662,12811,4129,1325,3905, +2438,21121,7807,3703,17995,1574,20589,5806,14045,13298, +13481,4154,3590,7560,1933,11024,1871,8592,20896,4946, +4976,17807,11167,8792,4158,11197,3369,14491,19829,18799, +15174,21569,2561,11419,9171,7417,3691,15261,18169,11706, +6009,19758,16259,1148,4174,3631,3385,12066,12538,10113, +2386,8065,9449,6123,13070,4339,4272,16475,7815,9091, +14427,18828,18829,8697,4116,1603,12457,9450,15808,7283, +15957,6800,8980,7284,10606,15883,2483,19344,19996,6379, +5985,8028,16062,16063,12436,9177,16064,21529,21530,2930, +3912,9178,15424,5986,12891,8699,3212,8103,13184,18833, +14006,15663,4275,4351,18283,16608,8611,19395,21315,18284, +17257,17672,18876,19934,14049,3726,3727,7579,8960,9456, +9337,12407,16227,10740,3149,18588,6062,13114,5562,18135, +18352,6827,2259,13888,11031,1711,15177,12348,13946,15083, +8978,10880,8694,11310,12403,2481,8619,9978,5538,15835, +1439,13591,15719,4523,20678,14324,16281,16052,4887,5168, +5505,9636,18330,12311,9241,9517,6997,20300,6095,5653, +8353,7872,5041,18847,12499,20520,9896,16021,2884,14176, +10974,2146,11916,1913,15375,8289,1162,12914,4545,8648, +3989,6877,1091,19716,20738,5508,8678,12520,1887,1824, +19960,11463,15437,3754,14904,14650,17986,15298,1453,11652, +12262,4194,8660,9349,4403,19507,2516,7275,11587,18651, +2470,3808,19104,8564,21173,15877,3915,6459,13556,5876, +17264,12442,10360,10008,11813,13586,15879,8094,12541,19337, +19394,9455,4735,3916,5571,4927,17069,20437,1626,13993, +1086,15360,9939,5576,17999,14300,8330,1637,14963,16483, +18488,18586,15077,8578,14061,4471,10166,16971,10198,12396, +12397,10169,1647,1648,1649,9894,1650,14104,4766,17778, +18464,20425,14940,18572,10142,4579,4473,4599,14565,1965, +6951,3900,14997,16128,20397,16098,13769,19746,8382,2654, +19190,4531,4532,15237,19187,21280,18819,21782,1491,7834, +15550,1248,3026,15828,15007,1249,14672,4241,5895,13771, +15755,7679,7281,1755,18573,15923,14128,15803,20746,14080, +2706,15463,958,13867,9325,9162,15594,8762,20304,9560, +5234,4266,3258,10564,10179,8556,7421,9285,13227,8202, +853,13008,11947,1347,3559,8733,9043,5556,6864,12140, +8360,15411,21512,13161,8574,14948,4335,2109,15071,6547, +864,10312,13015,4636,10923,11397,5292,8349,11488,10147, +19015,7258,1698,1633,15470,10784,10619,19381,21679,17997, +3607,2199,8460,12588,10383,4135,9209,12607,3152,13019, +3591,6912,21467,19056,2133,1646,21046,14418,3241,20974, +1415,21546,11374,14765,10495,6956,4835,9284,8687,13733, +3027,17366,18510,8385,4406,9387,16898,1799,11629,4341, +1891,8535,4010,15145,19630,16905,18580,6847,5870,14685, +7517,21390,1756,17308,1928,18709,3442,4594,20485,16522, +5633,4347,11931,20081,6382,6647,6807,7372,6298,914, +15509,4665,16526,5535,2114,15055,15511,1864,5203,17055, +9021,10163,15076,15581,18719,16554,11344,15513,10752,1530, +19803,17776,7916,14037,9026,21336,14247,2672,3450,19071, +7008,13700,2490,16534,17373,20416,4666,5899,11030,18425, +11351,2219,17374,10634,20170,11573,3896,16112,4230,6090, +9386,16838,3999,8523,5861,5520,20691,7184,14094,11721, +5035,13681,5704,7659,6048,16886,12515,3831,6423,19398, +8112,19824,1241,20704,5472,3927,10332,13472,2559,14931, +4383,20954,5567,17765,10534,1833,9491,5521,19748,17205, +15644,16755,11192,937,1291,2960,6369,4336,3023,10924, +16807,18627,7365,19254,20615,10194,9882,7638,8164,19794, +6437,10459,5662,11619,3879,7734,9595,14217,9602,19463, +5105,8676,3401,20365,12120,21260,17961,7243,18179,18803, +20960,9324,16796,3239,17202,14129,21206,4635,5554,16460, +19681,19555,3380,9123,19000,6290,2159,10311,7302,14070, +18693,1839,4682,1847,11684,1503,1854,16010,5911,4595, +7373,945,918,17170,19997,4699,12428,17653,10687,19747, +4774,5973,3699,16153,16129,2607,18096,21281,20822,12159, +17670,13783,13992,20049,16573,20851,3405,10478,19486,1848, +1251,8440,16155,19005,13448,12567,13452,8080,12523,20530, +19846,12189,21151,8316,21287,11906,8210,12274,20181,7313, +10084,20692,15346,5026,18511,14608,1509,16157,16158,15009, +10148,10709,12375,15579,21000,13820,15610,3972,18060,13536, +14401,8081,4407,5896,1855,21185,19126,10663,21111,3443, +5897,10156,8240,15046,13185,10815,2666,11394,1149,7076, +6640,1632,10642,19342,20390,10225,19194,2712,1153,9179, +19051,3771,12339,3728,13497,18959,15040,16830,13309,21398, +1570,18602,15797,4007,8688,19621,18055,8314,19684,18730, +2131,11500,13756,7880,10956,12063,3453,7248,5252,8752, +9722,2524,9769,7419,1656,2809,15693,1486,8203,4190, +3269,1330,1250,10503,1576,9201,2634,20605,13048,13883, +12069,18173,17810,8498,3216,7877,9415,21547,2362,14999, +6863,9359,15520,11990,10288,7576,11895,11410,3844,3882, +3374,10065,11824,5826,9015,1010,15408,5903,12684,6005, +9294,5987,16012,17950,16081,8538,4284,2549,17693,15012, +10458,21370,21116,14357,12376,9057,15582,9165,21602,8739, +12738,12739,18408,4596,14062,18409,5304,18612,16815,12383, +3091,12384,12942,4597,6652,12940,6869,19648,15666,13537, +17113,21604,8985,13851,14964,5578,16163,5735,15078,12900, +2541,21015,10168,12228,15614,16972,2044,4045,18417,19908, +21655,14063,14248,12751,21019,14856,10468,16973,10626,20488, +11407,1046,1973,1651,3092,13461,1542,21020,19810,17841, +6471,1802,15154,17462,9989,20467,4157,10172,16165,2087, +3773,7643,15825,18426,10635,20418,7794,6109,19336,8684, +5972,4340,21311,11792,10739,14047,6060,13886,12441,6320, +12916,13374,7107,2156,6686,5310,10996,4898,12296,13942, +17238,6017,7856,5377,3991,19182,2558,5905,5476,6104, +9629,19474,13657,20366,13344,10068,2469,19536,13320,7277, +11589,20961,14936,13444,15859,9087,12705,7619,18477,10839, +14450,20562,14296,16721,9499,2782,4923,13007,13259,12722, +16895,19767,4591,5867,5834,19003,12313,15783,13570,16236, +9290,11039,2942,13813,11562,4936,8979,8696,5024,15073, +19627,19488,10289,13410,1557,10843,13217,1011,10763,10822, +8003,19078,18722,16131,12429,21158,18431,10255,10485,15619, +17346,7226,14862,8249,16976,6529,9544,1653,13779,19096, +1617,17678,13176,21577,15116,8972,14854,16446,16454,16455, +19609,5146,18981,980,1272,1332,3005,15673,13071,8858, +16074,5357,12373,19644,15191,1867,17455,12096,1868,3235, +11348,9893,10298,17459,20178,15675,1723,8889,10361,5192, +13128,8652,13118,9338,14073,9041,3627,4573,17771,13659, +3435,9050,1716,4429,12275,4455,15697,1274,1510,10844, +4937,4389,13821,13454,5389,9092,12221,21297,14301,15271, +15700,9666,1718,15703,12224,15035,10680,19901,16916,2574, +15503,12087,14687,6645,2037,12394,15506,16923,17391,21049, +20486,14840,10846,12223,6813,12049,14242,6918,11042,2205, +9759,11229,9536,4083,13501,4805,19244,13301,17129,14647, +21197,19577,7044,4059,6950,7405,20544,21549,6419,13313, +12521,3288,14472,20240,5434,9625,14998,15778,7245,1548, +2562,8808,1470,17241,18269,13559,20749,8502,14666,5183, +12008,14294,17474,13295,20248,13159,21283,13970,12930,16185, +1498,3382,8780,19843,17431,20658,9014,6637,6293,5423, +4618,9657,1514,2612,15150,11227,3982,10451,4104,5763, +20760,21605,14896,7447,4223,6384,9133,12750,9761,20696, +12229,10711,14023,10754,10755,14112,17843,9947,12902,12903, +11570,9101,11839,1724,13683,4000,4008,11617,6282,17056, +4014,5947,4015,4016,8125,19818,19819,18404,4974,17655, +5734,21606,10199,5737,14269,10962,12713,12714,5050,17829, +19793,16065,12655,9838,5117,12398,1539,12752,17840,2759, +18356,20419,19594,3510,13723,7804,1070,6261,16130,3632, +7116,19631,4274,13162,14135,5994,16100,11398,7866,14428, +1167,19896,12315,10379,16574,6375,10338,20097,4559,4687, +11513,19489,12382,11337,6127,17107,3772,20134,3576,1876, +9183,21155,19571,19578,2683,17032,11770,11922,2865,14181, +18854,1420,21040,1164,4571,5307,10334,21205,20241,16879, +14295,16462,11038,14704,2036,2691,11026,13175,11750,7247, +13405,14132,1532,3601,13042,15263,7812,15467,16915,17146, +11092,1063,9627,15802,16876,21502,1992,9964,21632,14028, +6294,20133,3024,17860,13844,13420,7600,5323,7173,18934, +10064,16877,21284,4615,7434,12364,6125,19046,11107,20846, +12718,12778,18581,3553,4834,13459,8114,8200,9937,21511, +20147,11557,20604,7544,2628,3883,5106,21144,18802,5482, +13455,5912,12279,10089,16160,1102,13413,12495,4942,1520, +7201,16523,8211,3791,1856,19491,5810,12317,11718,17690, +15362,1276,5029,20354,8321,5490,14590,3936,3352,15309, +7822,14759,6316,17370,4390,946,16416,20558,21186,19216, +9941,10664,15935,18834,19050,1773,16480,7636,8828,5730, +17169,5298,6734,9354,4945,8665,17774,4206,8511,15664, +11179,14302,20355,15272,13186,19645,11630,20597,5811,5358, +15096,16725,13415,14202,12572,6602,15789,9569,14139,14140, +8666,11025,2538,9527,21659,16930,19427,14403,21531,12742, +13262,17371,11631,2966,7216,3795,3133,16151,17152,11317, +20897,18395,14537,2531,16009,9447,9053,12133,6378,15657, +17861,5889,15508,9335,1893,7729,16934,8335,9571,18073, +14598,3244,4159,13304,18021,3145,1679,1264,15297,7412, +4832,13000,20847,4836,14189,9637,16150,7253,1874,15356, +8994,13061,1487,17247,17151,6967,7620,9823,7180,2975, +6503,2610,20994,3743,1849,20855,7510,3861,2857,21066, +8266,4205,3233,12374,13846,11793,12047,12654,2799,8465, +12609,4503,3147,21210,10023,2214,9946,21694,17625,20906, +3785,11388,17767,11402,12320,6354,8424,14257,5478,21508, +13168,5561,21129,3938,9166,4598,11667,19061,9058,10463, +8165,2276,7998,10598,10099,21653,9530,11043,21607,21016, +11722,6400,19649,3662,14546,14405,6603,15667,6299,17695, +21193,9137,21608,7205,1564,1565,6604,13581,20281,16375, +16376,19650,2946,13852,3865,6653,9807,18344,13360,13361, +7448,1399,4353,18490,5036,14007,7383,17072,16178,6385, +14693,13973,17957,16555,7387,6063,16700,12091,14064,10170, +10696,14594,14547,5622,21534,15616,15312,18589,5305,19396, +12945,12753,16556,13974,14410,9763,1017,9385,6716,11290, +7223,15792,13462,7391,14406,10756,5384,15136,20992,21555, +13289,8057,19593,9638,16570,15863,7181,12161,4592,14157, +19173,889,17316,10717,2448,8262,1228,15781,21517,19166, +19686,2991,16670,11164,19878,16164,21364,15244,8371,8204, +10662,8331,2743,13305,10537,16808,20153,11424,1045,10161, +1338,17652,19480,4558,1100,12489,11717,10337,15093,5017, +6314,15357,5722,7810,16468,4387,7182,7624,17367,18098, +5356,9513,9742,7363,14589,15787,5809,14136,6597,7186, +13261,10090,21652,4593,9055,2275,5560,11666,11719,3792, +14543,21526,4718,3862,4349,13355,5033,6648,1561,14060, +16975,13418,1664,7224,7220,21211,7564,13363,21316,19390, +20489,8636,18035,1667,19813,13463,17393,1803,7700,18109, +15155,6654,21746,14251,14252,4474,5792,9991,18110,11195, +17005,20303,17344,4720,5624,6317,8883,20282,14065,20420, +5135,5793,14489,9574,2304,9410,14791,922,13889,7225, +17916,6442,14793,9707,9949,10668,11232,20668,17375,4358, +10362,5666,9545,17181,3509,7111,16099,1069,6117,19484, +20351,1840,12310,8663,15924,20279,6315,8873,20352,8508, +19425,12730,14402,1396,2302,15661,16552,16372,13577,7558, +12088,7377,16532,16970,6439,5134,1015,12740,15310,5620, +18585,9384,1663,18034,10753,11288,19386,5790,14249,21745, +9572,3296,18449,3298,13102,10751,7376,8214,13849,5425, +1337,7862,15955,8827,5493,3661,6296,5295,8700,1526, +10296,12841,8887,1721,4051,10966,1087,18336,9837,17442, +16335,2578,17363,18398,15829,15557,19389,1618,9044,10842, +13661,15786,7194,21525,17772,13578,8124,1722,6563,9948, +11335,6712,11068,7115,8509,21235,11070,12745,1016,14361, +9990,3356,2849,19516,17112,18762,13460,4046,9532,13280, +1989,978,4693,19542,16726,18357,16943,13414,5913,20330, +20417,5635,11751,18867,4928,9646,8121,1900,18390,4891, +3787,6968,4792,13905,5114,14538,4793,11309,1252,19844, +20823,6433,13212,4845,4688,16575,7364,14541,19779,4811, +18537,8451,8452,12336,6519,20721,1254,18399,18148,20784, +4552,4794,16576,11978,3353,5261,13874,10091,11223,4938, +16161,11262,9659,1578,21001,5262,19848,3031,13483,17443, +2575,3444,8212,18610,5491,21048,19787,18451,19788,18150, +15821,19789,15736,19253,4117,16698,4391,5577,915,20825, +18406,6193,17450,7285,9942,21187,18487,15662,6269,10453, +13880,11425,5265,13725,7637,17775,22349,22350,22351,22352, +22353,22354,22355,22356,22357,22358,22359,22360,22361,22362, +22363,22364,22365,22366,22367,22368,22369,22370,22371,22372, +22373,22374,22375,22376,22377,22378,22379,22380,22381,22382, +22383,22384,22385,22386,22387,22388,22389,22390,22391,22392, +22393,22394,22395,22396,22397,22398,22399,22400,22401,22402, +22403,22404,22405,22406,22407,22408,22409,22410,22411,22412, +22413,22414,22415,22416,22417,22418,22419,22420,22421,22422, +22423,22424,22425,22426,22427,22428,22429,22430,22431,22432, +22433,22434,22435,22436,22437,22438,22439,22440,22441,22442, +21115,2576,10665,6194,11720,4285,10538,7286,7206,16013, +6521,16177,1902,16724,8351,19801,1865,8539,8540,1398, +16931,8541,8241,15980,7997,15665,4276,4277,8915,5539, +16766,14404,9180,7693,12068,10464,12323,14763,4948,948, +21469,12227,13416,12898,1293,3796,10465,13635,7381,8243, +16029,18152,19850,12743,9531,18720,21371,8784,4246,9059, +14481,12744,7999,19062,19063,8000,21532,9167,3939,12657, +2967,5345,8215,8467,19064,21743,7005,14828,14829,2673, +11194,13853,950,13362,15668,6386,15669,4354,7758,10847, +4949,2947,16014,18345,6133,19909,22443,22444,22445,22446, +22447,22448,22449,22450,22451,22452,22453,22454,22455,22456, +22457,22458,22459,22460,22461,22462,22463,22464,22465,22466, +22467,22468,22469,22470,22471,22472,22473,22474,22475,22476, +22477,22478,22479,22480,22481,22482,22483,22484,22485,22486, +22487,22488,22489,22490,22491,22492,22493,22494,22495,22496, +22497,22498,22499,22500,22501,22502,22503,22504,22505,22506, +22507,22508,22509,22510,22511,22512,22513,22514,22515,22516, +22517,22518,22519,22520,22521,22522,22523,22524,22525,22526, +22527,22528,22529,22530,22531,22532,22533,22534,22535,22536, +12365,9060,10932,6387,19262,2887,16816,8246,3940,2018, +4574,6388,19274,19910,17177,16615,14548,6158,2800,15514, +17114,13975,10171,7096,5494,7388,15251,5992,3035,3036, +19074,18638,18418,7012,9695,15739,8814,15628,15629,19075, +16015,10695,17460,5206,15740,2435,7097,16049,20617,1018, +18614,18764,11983,2674,21022,10200,19391,10484,1543,14859, +21474,19651,16727,8480,19176,15433,14966,7644,19079,6472, +1544,19278,15156,6655,4509,7645,9895,18427,5208,8169, +17227,17228,16016,10723,21747,19814,19280,10472,16050,17229, +18028,19081,12356,14792,10631,16945,22537,22538,22539,22540, +22541,22542,22543,22544,22545,22546,22547,22548,22549,22550, +22551,22552,22553,22554,22555,22556,22557,22558,22559,22560, +22561,22562,22563,22564,22565,22566,22567,22568,22569,22570, +22571,22572,22573,22574,22575,22576,22577,22578,22579,22580, +22581,22582,22583,22584,22585,22586,22587,22588,22589,22590, +22591,22592,22593,22594,22595,22596,22597,22598,22599,22600, +22601,22602,22603,22604,22605,22606,22607,22608,22609,22610, +22611,22612,22613,22614,22615,22616,22617,22618,22619,22620, +22621,22622,22623,22624,22625,22626,22627,22628,22629,22630, +18842,7021,20267,19652,20421,18723,18492,12357,11840,6443, +11083,19281,11032,3640,19985,19815,9439,1903,10363,6162, +10256,14863,19988,19282,5665,13503,9546,10556,14518,2005, +17411,10053,18020,6189,21102,16718,9045,12881,5339,19842, +15130,6120,13349,19016,16612,10149,7082,19017,18757,6557, +20413,11027,14860,10370,7892,10092,7449,17223,3245,7454, +7457,18298,19440,3125,1631,3126,12116,21291,7374,11069, +19691,10164,2433,8512,9983,11668,8166,8513,8001,9682, +17340,18290,7263,11074,9696,20490,8004,12755,10108,18299, +3127,10732,6121,2358,4846,11183,22631,22632,22633,22634, +22635,22636,22637,22638,22639,22640,22641,22642,22643,22644, +22645,22646,22647,22648,22649,22650,22651,22652,22653,22654, +22655,22656,22657,22658,22659,22660,22661,22662,22663,22664, +22665,22666,22667,22668,22669,22670,22671,22672,22673,22674, +22675,22676,22677,22678,22679,22680,22681,22682,22683,22684, +22685,22686,22687,22688,22689,22690,22691,22692,22693,22694, +22695,22696,22697,22698,22699,22700,22701,22702,22703,22704, +22705,22706,22707,22708,22709,22710,22711,22712,22713,22714, +22715,22716,22717,22718,22719,22720,22721,22722,22723,22724, +11184,4848,12124,13524,13457,11426,4849,17310,9168,11186, +2581,4767,13453,11185,11334,11354,21654,11933,4700,6616, +7893,5686,15713,15963,6494,8941,6270,2583,6164,19018, +3408,17051,16090,11399,12939,3744,18341,10950,18346,19980, +3469,18240,18350,18351,20724,20697,3362,1990,18765,10934, +20444,18359,4055,10364,4703,11281,19904,3146,13528,2352, +16206,21192,20828,11044,1019,1668,16166,1545,2344,11133, +3891,21519,5525,3937,4695,19852,2277,5207,2048,19853, +15475,15599,14778,4641,16582,1089,3794,16162,21051,13487, +14480,14591,14593,15867,8247,8002,22725,22726,22727,22728, +22729,22730,22731,22732,22733,22734,22735,22736,22737,22738, +22739,22740,22741,22742,22743,22744,22745,22746,22747,22748, +22749,22750,22751,22752,22753,22754,22755,22756,22757,22758, +22759,22760,22761,22762,22763,22764,22765,22766,22767,22768, +22769,22770,22771,22772,22773,22774,22775,22776,22777,22778, +22779,22780,22781,22782,22783,22784,22785,22786,22787,22788, +22789,22790,22791,22792,22793,22794,22795,22796,22797,22798, +22799,22800,22801,22802,22803,22804,22805,22806,22807,22808, +22809,22810,22811,22812,22813,22814,22815,22816,22817,22818, +6850,8248,18353,15981,14967,17317,9413,18629,16811,16813, +6283,17622,6159,17803,16629,20331,11890,11579,12723,20381, +7207,21533,7013,7019,2635,2453,2454,6131,18172,19174, +17620,1233,20265,14694,21535,2579,18347,8269,15791,10102, +10096,2770,13583,17621,19175,11804,8168,18613,2996,20052, +19693,2815,18878,11669,20266,2998,13512,20053,18358,11984, +4357,16671,19083,3246,21656,3733,2816,7965,18211,6105, +19157,10228,12089,5391,12090,18348,10245,10250,5392,8596, +3306,10109,3307,5731,13364,1670,2914,6136,8483,17557, +19987,9271,9814,5122,9564,9967,22819,22820,22821,22822, +22823,22824,22825,22826,22827,22828,22829,22830,22831,22832, +22833,22834,22835,22836,22837,22838,22839,22840,22841,22842, +22843,22844,22845,22846,22847,22848,22849,22850,22851,22852, +22853,22854,22855,22856,22857,22858,22859,22860,22861,22862, +22863,22864,22865,22866,22867,22868,22869,22870,22871,22872, +22873,22874,22875,22876,22877,22878,22879,22880,22881,22882, +22883,22884,22885,22886,22887,22888,22889,22890,22891,22892, +22893,22894,22895,22896,22897,22898,22899,22900,22901,22902, +22903,22904,22905,22906,22907,22908,22909,22910,22911,22912, +16769,6900,14850,19718,12706,4918,8263,9548,886,5739, +14473,3992,7037,17500,17731,3521,23854,23855,23856,23857, +23858,23859,23860,23861,23862,23863,23864,23865,23866,23867, +23868,23869,23870,23871,23872,23873,23874,23875,23876,23877, +23878,23879,23880,23881,23882,23883,23884,23885,23886,23887, +23888,23889,23890,23891,23892,23893,23894,23895,23896,23897, +23898,23899,23900,23901,23902,23903,23904,23905,23906,23907, +23908,23909,23910,23911,23912,23913,23914,23915,23916,23917, +23918,23919,23920,23921,23922,23923,23924,23925,23926,23927, +23928,23929,23930,23931,23932,23933,22913,22914,22915,22916, +22917,22918,22919,22920,22921,22922,22923,22924,22925,22926, +22927,22928,22929,22930,22931,22932,22933,22934,22935,22936, +22937,22938,22939,22940,22941,22942,22943,22944,22945,22946, +22947,22948,22949,22950,22951,22952,22953,22954,22955,22956, +22957,22958,22959,22960,22961,22962,22963,22964,22965,22966, +22967,22968,22969,22970,22971,22972,22973,22974,22975,22976, +22977,22978,22979,22980,22981,22982,22983,22984,22985,22986, +22987,22988,22989,22990,22991,22992,22993,22994,22995,22996, +22997,22998,22999,23000,23001,23002,23003,23004,23005,23006 +}; + +static uint16 gbksortorder(uint16 i) +{ + uint idx=gbktail(i); + if (idx>0x7f) idx-=0x41; + else idx-=0x40; + idx+=(gbkhead(i)-0x81)*0xbe; + return 0x8100+gbk_order[idx]; +} + + +int my_strnncoll_gbk_internal(const uchar **a_res, const uchar **b_res, + size_t length) +{ + const uchar *a= *a_res, *b= *b_res; + uint a_char,b_char; + + while (length--) + { + if ((length > 0) && isgbkcode(*a,*(a+1)) && isgbkcode(*b, *(b+1))) + { + a_char= gbkcode(*a,*(a+1)); + b_char= gbkcode(*b,*(b+1)); + if (a_char != b_char) + return ((int) gbksortorder((uint16) a_char) - + (int) gbksortorder((uint16) b_char)); + a+= 2; + b+= 2; + length--; + } + else if (sort_order_gbk[*a++] != sort_order_gbk[*b++]) + return ((int) sort_order_gbk[a[-1]] - + (int) sort_order_gbk[b[-1]]); + } + *a_res= a; + *b_res= b; + return 0; +} + + + +int my_strnncoll_gbk(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool b_is_prefix) +{ + size_t length= min(a_length, b_length); + int res= my_strnncoll_gbk_internal(&a, &b, length); + return res ? res : (int) ((b_is_prefix ? length : a_length) - b_length); +} + + +static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + size_t length= min(a_length, b_length); + int res= my_strnncoll_gbk_internal(&a, &b, length); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + if (!res && a_length != b_length) + { + const uchar *end; + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a_length < b_length) + { + /* put shorter key in a */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (end= a + a_length-length; a < end ; a++) + { + if (*a != ' ') + return (*a < ' ') ? -swap : swap; + } + } + return res; +} + + +static size_t +my_strnxfrm_gbk(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *d0= dst; + uchar *de= dst + dstlen; + const uchar *se= src + srclen; + const uchar *sort_order= cs->sort_order; + + for (; dst < de && src < se && nweights; nweights--) + { + if (cs->cset->ismbchar(cs, (const char*) src, (const char*) se)) + { + /* + Note, it is safe not to check (src < se) + in the code below, because ismbchar() would + not return TRUE if src was too short + */ + uint16 e= gbksortorder((uint16) gbkcode(*src, *(src + 1))); + *dst++= gbkhead(e); + if (dst < de) + *dst++= gbktail(e); + src+= 2; + } + else + *dst++= sort_order ? sort_order[*src++] : *src++; + } + return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0); +} + + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +#define max_sort_char ((uchar) 255) + +static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr,size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) +{ + const char *end= ptr + ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + size_t charlen= res_length / cs->mbmaxlen; + + for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) + { + if (ptr+1 != end && isgbkcode(ptr[0],ptr[1])) + { + *min_str++= *max_str++ = *ptr++; + *min_str++= *max_str++ = *ptr; + continue; + } + if (*ptr == escape && ptr+1 != end) + { + ptr++; /* Skip escape */ + if (isgbkcode(ptr[0], ptr[1])) + *min_str++= *max_str++ = *ptr; + if (min_str < min_end) + *min_str++= *max_str++= *ptr; + continue; + } + if (*ptr == w_one) /* '_' in SQL */ + { + *min_str++='\0'; /* This should be min char */ + *max_str++=max_sort_char; + continue; + } + if (*ptr == w_many) /* '%' in SQL */ + { + /* + Calculate length of keys: + 'a\0\0... is the smallest possible string when we have space expand + a\ff\ff... is the biggest possible string + */ + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + do { + *min_str++= 0; + *max_str++= max_sort_char; + } while (min_str != min_end); + return 0; + } + *min_str++= *max_str++ = *ptr; + } + + *min_length= *max_length = (size_t) (min_str - min_org); + while (min_str != min_end) + *min_str++= *max_str++= ' '; /* Because if key compression */ + return 0; +} + + +static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0); +} + +static uint mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c) +{ + return (isgbkhead(c)? 2 : 1); +} + +/* page 0 0x8140-0xFE4F */ +static uint16 tab_gbk_uni0[]={ +0x4E02,0x4E04,0x4E05,0x4E06,0x4E0F,0x4E12,0x4E17,0x4E1F, +0x4E20,0x4E21,0x4E23,0x4E26,0x4E29,0x4E2E,0x4E2F,0x4E31, +0x4E33,0x4E35,0x4E37,0x4E3C,0x4E40,0x4E41,0x4E42,0x4E44, +0x4E46,0x4E4A,0x4E51,0x4E55,0x4E57,0x4E5A,0x4E5B,0x4E62, +0x4E63,0x4E64,0x4E65,0x4E67,0x4E68,0x4E6A,0x4E6B,0x4E6C, +0x4E6D,0x4E6E,0x4E6F,0x4E72,0x4E74,0x4E75,0x4E76,0x4E77, +0x4E78,0x4E79,0x4E7A,0x4E7B,0x4E7C,0x4E7D,0x4E7F,0x4E80, +0x4E81,0x4E82,0x4E83,0x4E84,0x4E85,0x4E87,0x4E8A, 0, +0x4E90,0x4E96,0x4E97,0x4E99,0x4E9C,0x4E9D,0x4E9E,0x4EA3, +0x4EAA,0x4EAF,0x4EB0,0x4EB1,0x4EB4,0x4EB6,0x4EB7,0x4EB8, +0x4EB9,0x4EBC,0x4EBD,0x4EBE,0x4EC8,0x4ECC,0x4ECF,0x4ED0, +0x4ED2,0x4EDA,0x4EDB,0x4EDC,0x4EE0,0x4EE2,0x4EE6,0x4EE7, +0x4EE9,0x4EED,0x4EEE,0x4EEF,0x4EF1,0x4EF4,0x4EF8,0x4EF9, +0x4EFA,0x4EFC,0x4EFE,0x4F00,0x4F02,0x4F03,0x4F04,0x4F05, +0x4F06,0x4F07,0x4F08,0x4F0B,0x4F0C,0x4F12,0x4F13,0x4F14, +0x4F15,0x4F16,0x4F1C,0x4F1D,0x4F21,0x4F23,0x4F28,0x4F29, +0x4F2C,0x4F2D,0x4F2E,0x4F31,0x4F33,0x4F35,0x4F37,0x4F39, +0x4F3B,0x4F3E,0x4F3F,0x4F40,0x4F41,0x4F42,0x4F44,0x4F45, +0x4F47,0x4F48,0x4F49,0x4F4A,0x4F4B,0x4F4C,0x4F52,0x4F54, +0x4F56,0x4F61,0x4F62,0x4F66,0x4F68,0x4F6A,0x4F6B,0x4F6D, +0x4F6E,0x4F71,0x4F72,0x4F75,0x4F77,0x4F78,0x4F79,0x4F7A, +0x4F7D,0x4F80,0x4F81,0x4F82,0x4F85,0x4F86,0x4F87,0x4F8A, +0x4F8C,0x4F8E,0x4F90,0x4F92,0x4F93,0x4F95,0x4F96,0x4F98, +0x4F99,0x4F9A,0x4F9C,0x4F9E,0x4F9F,0x4FA1,0x4FA2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4FA4,0x4FAB,0x4FAD,0x4FB0,0x4FB1,0x4FB2,0x4FB3,0x4FB4, +0x4FB6,0x4FB7,0x4FB8,0x4FB9,0x4FBA,0x4FBB,0x4FBC,0x4FBD, +0x4FBE,0x4FC0,0x4FC1,0x4FC2,0x4FC6,0x4FC7,0x4FC8,0x4FC9, +0x4FCB,0x4FCC,0x4FCD,0x4FD2,0x4FD3,0x4FD4,0x4FD5,0x4FD6, +0x4FD9,0x4FDB,0x4FE0,0x4FE2,0x4FE4,0x4FE5,0x4FE7,0x4FEB, +0x4FEC,0x4FF0,0x4FF2,0x4FF4,0x4FF5,0x4FF6,0x4FF7,0x4FF9, +0x4FFB,0x4FFC,0x4FFD,0x4FFF,0x5000,0x5001,0x5002,0x5003, +0x5004,0x5005,0x5006,0x5007,0x5008,0x5009,0x500A, 0, +0x500B,0x500E,0x5010,0x5011,0x5013,0x5015,0x5016,0x5017, +0x501B,0x501D,0x501E,0x5020,0x5022,0x5023,0x5024,0x5027, +0x502B,0x502F,0x5030,0x5031,0x5032,0x5033,0x5034,0x5035, +0x5036,0x5037,0x5038,0x5039,0x503B,0x503D,0x503F,0x5040, +0x5041,0x5042,0x5044,0x5045,0x5046,0x5049,0x504A,0x504B, +0x504D,0x5050,0x5051,0x5052,0x5053,0x5054,0x5056,0x5057, +0x5058,0x5059,0x505B,0x505D,0x505E,0x505F,0x5060,0x5061, +0x5062,0x5063,0x5064,0x5066,0x5067,0x5068,0x5069,0x506A, +0x506B,0x506D,0x506E,0x506F,0x5070,0x5071,0x5072,0x5073, +0x5074,0x5075,0x5078,0x5079,0x507A,0x507C,0x507D,0x5081, +0x5082,0x5083,0x5084,0x5086,0x5087,0x5089,0x508A,0x508B, +0x508C,0x508E,0x508F,0x5090,0x5091,0x5092,0x5093,0x5094, +0x5095,0x5096,0x5097,0x5098,0x5099,0x509A,0x509B,0x509C, +0x509D,0x509E,0x509F,0x50A0,0x50A1,0x50A2,0x50A4,0x50A6, +0x50AA,0x50AB,0x50AD,0x50AE,0x50AF,0x50B0,0x50B1,0x50B3, +0x50B4,0x50B5,0x50B6,0x50B7,0x50B8,0x50B9,0x50BC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x50BD,0x50BE,0x50BF,0x50C0,0x50C1,0x50C2,0x50C3,0x50C4, +0x50C5,0x50C6,0x50C7,0x50C8,0x50C9,0x50CA,0x50CB,0x50CC, +0x50CD,0x50CE,0x50D0,0x50D1,0x50D2,0x50D3,0x50D4,0x50D5, +0x50D7,0x50D8,0x50D9,0x50DB,0x50DC,0x50DD,0x50DE,0x50DF, +0x50E0,0x50E1,0x50E2,0x50E3,0x50E4,0x50E5,0x50E8,0x50E9, +0x50EA,0x50EB,0x50EF,0x50F0,0x50F1,0x50F2,0x50F4,0x50F6, +0x50F7,0x50F8,0x50F9,0x50FA,0x50FC,0x50FD,0x50FE,0x50FF, +0x5100,0x5101,0x5102,0x5103,0x5104,0x5105,0x5108, 0, +0x5109,0x510A,0x510C,0x510D,0x510E,0x510F,0x5110,0x5111, +0x5113,0x5114,0x5115,0x5116,0x5117,0x5118,0x5119,0x511A, +0x511B,0x511C,0x511D,0x511E,0x511F,0x5120,0x5122,0x5123, +0x5124,0x5125,0x5126,0x5127,0x5128,0x5129,0x512A,0x512B, +0x512C,0x512D,0x512E,0x512F,0x5130,0x5131,0x5132,0x5133, +0x5134,0x5135,0x5136,0x5137,0x5138,0x5139,0x513A,0x513B, +0x513C,0x513D,0x513E,0x5142,0x5147,0x514A,0x514C,0x514E, +0x514F,0x5150,0x5152,0x5153,0x5157,0x5158,0x5159,0x515B, +0x515D,0x515E,0x515F,0x5160,0x5161,0x5163,0x5164,0x5166, +0x5167,0x5169,0x516A,0x516F,0x5172,0x517A,0x517E,0x517F, +0x5183,0x5184,0x5186,0x5187,0x518A,0x518B,0x518E,0x518F, +0x5190,0x5191,0x5193,0x5194,0x5198,0x519A,0x519D,0x519E, +0x519F,0x51A1,0x51A3,0x51A6,0x51A7,0x51A8,0x51A9,0x51AA, +0x51AD,0x51AE,0x51B4,0x51B8,0x51B9,0x51BA,0x51BE,0x51BF, +0x51C1,0x51C2,0x51C3,0x51C5,0x51C8,0x51CA,0x51CD,0x51CE, +0x51D0,0x51D2,0x51D3,0x51D4,0x51D5,0x51D6,0x51D7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x51D8,0x51D9,0x51DA,0x51DC,0x51DE,0x51DF,0x51E2,0x51E3, +0x51E5,0x51E6,0x51E7,0x51E8,0x51E9,0x51EA,0x51EC,0x51EE, +0x51F1,0x51F2,0x51F4,0x51F7,0x51FE,0x5204,0x5205,0x5209, +0x520B,0x520C,0x520F,0x5210,0x5213,0x5214,0x5215,0x521C, +0x521E,0x521F,0x5221,0x5222,0x5223,0x5225,0x5226,0x5227, +0x522A,0x522C,0x522F,0x5231,0x5232,0x5234,0x5235,0x523C, +0x523E,0x5244,0x5245,0x5246,0x5247,0x5248,0x5249,0x524B, +0x524E,0x524F,0x5252,0x5253,0x5255,0x5257,0x5258, 0, +0x5259,0x525A,0x525B,0x525D,0x525F,0x5260,0x5262,0x5263, +0x5264,0x5266,0x5268,0x526B,0x526C,0x526D,0x526E,0x5270, +0x5271,0x5273,0x5274,0x5275,0x5276,0x5277,0x5278,0x5279, +0x527A,0x527B,0x527C,0x527E,0x5280,0x5283,0x5284,0x5285, +0x5286,0x5287,0x5289,0x528A,0x528B,0x528C,0x528D,0x528E, +0x528F,0x5291,0x5292,0x5294,0x5295,0x5296,0x5297,0x5298, +0x5299,0x529A,0x529C,0x52A4,0x52A5,0x52A6,0x52A7,0x52AE, +0x52AF,0x52B0,0x52B4,0x52B5,0x52B6,0x52B7,0x52B8,0x52B9, +0x52BA,0x52BB,0x52BC,0x52BD,0x52C0,0x52C1,0x52C2,0x52C4, +0x52C5,0x52C6,0x52C8,0x52CA,0x52CC,0x52CD,0x52CE,0x52CF, +0x52D1,0x52D3,0x52D4,0x52D5,0x52D7,0x52D9,0x52DA,0x52DB, +0x52DC,0x52DD,0x52DE,0x52E0,0x52E1,0x52E2,0x52E3,0x52E5, +0x52E6,0x52E7,0x52E8,0x52E9,0x52EA,0x52EB,0x52EC,0x52ED, +0x52EE,0x52EF,0x52F1,0x52F2,0x52F3,0x52F4,0x52F5,0x52F6, +0x52F7,0x52F8,0x52FB,0x52FC,0x52FD,0x5301,0x5302,0x5303, +0x5304,0x5307,0x5309,0x530A,0x530B,0x530C,0x530E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5311,0x5312,0x5313,0x5314,0x5318,0x531B,0x531C,0x531E, +0x531F,0x5322,0x5324,0x5325,0x5327,0x5328,0x5329,0x532B, +0x532C,0x532D,0x532F,0x5330,0x5331,0x5332,0x5333,0x5334, +0x5335,0x5336,0x5337,0x5338,0x533C,0x533D,0x5340,0x5342, +0x5344,0x5346,0x534B,0x534C,0x534D,0x5350,0x5354,0x5358, +0x5359,0x535B,0x535D,0x5365,0x5368,0x536A,0x536C,0x536D, +0x5372,0x5376,0x5379,0x537B,0x537C,0x537D,0x537E,0x5380, +0x5381,0x5383,0x5387,0x5388,0x538A,0x538E,0x538F, 0, +0x5390,0x5391,0x5392,0x5393,0x5394,0x5396,0x5397,0x5399, +0x539B,0x539C,0x539E,0x53A0,0x53A1,0x53A4,0x53A7,0x53AA, +0x53AB,0x53AC,0x53AD,0x53AF,0x53B0,0x53B1,0x53B2,0x53B3, +0x53B4,0x53B5,0x53B7,0x53B8,0x53B9,0x53BA,0x53BC,0x53BD, +0x53BE,0x53C0,0x53C3,0x53C4,0x53C5,0x53C6,0x53C7,0x53CE, +0x53CF,0x53D0,0x53D2,0x53D3,0x53D5,0x53DA,0x53DC,0x53DD, +0x53DE,0x53E1,0x53E2,0x53E7,0x53F4,0x53FA,0x53FE,0x53FF, +0x5400,0x5402,0x5405,0x5407,0x540B,0x5414,0x5418,0x5419, +0x541A,0x541C,0x5422,0x5424,0x5425,0x542A,0x5430,0x5433, +0x5436,0x5437,0x543A,0x543D,0x543F,0x5441,0x5442,0x5444, +0x5445,0x5447,0x5449,0x544C,0x544D,0x544E,0x544F,0x5451, +0x545A,0x545D,0x545E,0x545F,0x5460,0x5461,0x5463,0x5465, +0x5467,0x5469,0x546A,0x546B,0x546C,0x546D,0x546E,0x546F, +0x5470,0x5474,0x5479,0x547A,0x547E,0x547F,0x5481,0x5483, +0x5485,0x5487,0x5488,0x5489,0x548A,0x548D,0x5491,0x5493, +0x5497,0x5498,0x549C,0x549E,0x549F,0x54A0,0x54A1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x54A2,0x54A5,0x54AE,0x54B0,0x54B2,0x54B5,0x54B6,0x54B7, +0x54B9,0x54BA,0x54BC,0x54BE,0x54C3,0x54C5,0x54CA,0x54CB, +0x54D6,0x54D8,0x54DB,0x54E0,0x54E1,0x54E2,0x54E3,0x54E4, +0x54EB,0x54EC,0x54EF,0x54F0,0x54F1,0x54F4,0x54F5,0x54F6, +0x54F7,0x54F8,0x54F9,0x54FB,0x54FE,0x5500,0x5502,0x5503, +0x5504,0x5505,0x5508,0x550A,0x550B,0x550C,0x550D,0x550E, +0x5512,0x5513,0x5515,0x5516,0x5517,0x5518,0x5519,0x551A, +0x551C,0x551D,0x551E,0x551F,0x5521,0x5525,0x5526, 0, +0x5528,0x5529,0x552B,0x552D,0x5532,0x5534,0x5535,0x5536, +0x5538,0x5539,0x553A,0x553B,0x553D,0x5540,0x5542,0x5545, +0x5547,0x5548,0x554B,0x554C,0x554D,0x554E,0x554F,0x5551, +0x5552,0x5553,0x5554,0x5557,0x5558,0x5559,0x555A,0x555B, +0x555D,0x555E,0x555F,0x5560,0x5562,0x5563,0x5568,0x5569, +0x556B,0x556F,0x5570,0x5571,0x5572,0x5573,0x5574,0x5579, +0x557A,0x557D,0x557F,0x5585,0x5586,0x558C,0x558D,0x558E, +0x5590,0x5592,0x5593,0x5595,0x5596,0x5597,0x559A,0x559B, +0x559E,0x55A0,0x55A1,0x55A2,0x55A3,0x55A4,0x55A5,0x55A6, +0x55A8,0x55A9,0x55AA,0x55AB,0x55AC,0x55AD,0x55AE,0x55AF, +0x55B0,0x55B2,0x55B4,0x55B6,0x55B8,0x55BA,0x55BC,0x55BF, +0x55C0,0x55C1,0x55C2,0x55C3,0x55C6,0x55C7,0x55C8,0x55CA, +0x55CB,0x55CE,0x55CF,0x55D0,0x55D5,0x55D7,0x55D8,0x55D9, +0x55DA,0x55DB,0x55DE,0x55E0,0x55E2,0x55E7,0x55E9,0x55ED, +0x55EE,0x55F0,0x55F1,0x55F4,0x55F6,0x55F8,0x55F9,0x55FA, +0x55FB,0x55FC,0x55FF,0x5602,0x5603,0x5604,0x5605, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5606,0x5607,0x560A,0x560B,0x560D,0x5610,0x5611,0x5612, +0x5613,0x5614,0x5615,0x5616,0x5617,0x5619,0x561A,0x561C, +0x561D,0x5620,0x5621,0x5622,0x5625,0x5626,0x5628,0x5629, +0x562A,0x562B,0x562E,0x562F,0x5630,0x5633,0x5635,0x5637, +0x5638,0x563A,0x563C,0x563D,0x563E,0x5640,0x5641,0x5642, +0x5643,0x5644,0x5645,0x5646,0x5647,0x5648,0x5649,0x564A, +0x564B,0x564F,0x5650,0x5651,0x5652,0x5653,0x5655,0x5656, +0x565A,0x565B,0x565D,0x565E,0x565F,0x5660,0x5661, 0, +0x5663,0x5665,0x5666,0x5667,0x566D,0x566E,0x566F,0x5670, +0x5672,0x5673,0x5674,0x5675,0x5677,0x5678,0x5679,0x567A, +0x567D,0x567E,0x567F,0x5680,0x5681,0x5682,0x5683,0x5684, +0x5687,0x5688,0x5689,0x568A,0x568B,0x568C,0x568D,0x5690, +0x5691,0x5692,0x5694,0x5695,0x5696,0x5697,0x5698,0x5699, +0x569A,0x569B,0x569C,0x569D,0x569E,0x569F,0x56A0,0x56A1, +0x56A2,0x56A4,0x56A5,0x56A6,0x56A7,0x56A8,0x56A9,0x56AA, +0x56AB,0x56AC,0x56AD,0x56AE,0x56B0,0x56B1,0x56B2,0x56B3, +0x56B4,0x56B5,0x56B6,0x56B8,0x56B9,0x56BA,0x56BB,0x56BD, +0x56BE,0x56BF,0x56C0,0x56C1,0x56C2,0x56C3,0x56C4,0x56C5, +0x56C6,0x56C7,0x56C8,0x56C9,0x56CB,0x56CC,0x56CD,0x56CE, +0x56CF,0x56D0,0x56D1,0x56D2,0x56D3,0x56D5,0x56D6,0x56D8, +0x56D9,0x56DC,0x56E3,0x56E5,0x56E6,0x56E7,0x56E8,0x56E9, +0x56EA,0x56EC,0x56EE,0x56EF,0x56F2,0x56F3,0x56F6,0x56F7, +0x56F8,0x56FB,0x56FC,0x5700,0x5701,0x5702,0x5705,0x5707, +0x570B,0x570C,0x570D,0x570E,0x570F,0x5710,0x5711, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5712,0x5713,0x5714,0x5715,0x5716,0x5717,0x5718,0x5719, +0x571A,0x571B,0x571D,0x571E,0x5720,0x5721,0x5722,0x5724, +0x5725,0x5726,0x5727,0x572B,0x5731,0x5732,0x5734,0x5735, +0x5736,0x5737,0x5738,0x573C,0x573D,0x573F,0x5741,0x5743, +0x5744,0x5745,0x5746,0x5748,0x5749,0x574B,0x5752,0x5753, +0x5754,0x5755,0x5756,0x5758,0x5759,0x5762,0x5763,0x5765, +0x5767,0x576C,0x576E,0x5770,0x5771,0x5772,0x5774,0x5775, +0x5778,0x5779,0x577A,0x577D,0x577E,0x577F,0x5780, 0, +0x5781,0x5787,0x5788,0x5789,0x578A,0x578D,0x578E,0x578F, +0x5790,0x5791,0x5794,0x5795,0x5796,0x5797,0x5798,0x5799, +0x579A,0x579C,0x579D,0x579E,0x579F,0x57A5,0x57A8,0x57AA, +0x57AC,0x57AF,0x57B0,0x57B1,0x57B3,0x57B5,0x57B6,0x57B7, +0x57B9,0x57BA,0x57BB,0x57BC,0x57BD,0x57BE,0x57BF,0x57C0, +0x57C1,0x57C4,0x57C5,0x57C6,0x57C7,0x57C8,0x57C9,0x57CA, +0x57CC,0x57CD,0x57D0,0x57D1,0x57D3,0x57D6,0x57D7,0x57DB, +0x57DC,0x57DE,0x57E1,0x57E2,0x57E3,0x57E5,0x57E6,0x57E7, +0x57E8,0x57E9,0x57EA,0x57EB,0x57EC,0x57EE,0x57F0,0x57F1, +0x57F2,0x57F3,0x57F5,0x57F6,0x57F7,0x57FB,0x57FC,0x57FE, +0x57FF,0x5801,0x5803,0x5804,0x5805,0x5808,0x5809,0x580A, +0x580C,0x580E,0x580F,0x5810,0x5812,0x5813,0x5814,0x5816, +0x5817,0x5818,0x581A,0x581B,0x581C,0x581D,0x581F,0x5822, +0x5823,0x5825,0x5826,0x5827,0x5828,0x5829,0x582B,0x582C, +0x582D,0x582E,0x582F,0x5831,0x5832,0x5833,0x5834,0x5836, +0x5837,0x5838,0x5839,0x583A,0x583B,0x583C,0x583D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x583E,0x583F,0x5840,0x5841,0x5842,0x5843,0x5845,0x5846, +0x5847,0x5848,0x5849,0x584A,0x584B,0x584E,0x584F,0x5850, +0x5852,0x5853,0x5855,0x5856,0x5857,0x5859,0x585A,0x585B, +0x585C,0x585D,0x585F,0x5860,0x5861,0x5862,0x5863,0x5864, +0x5866,0x5867,0x5868,0x5869,0x586A,0x586D,0x586E,0x586F, +0x5870,0x5871,0x5872,0x5873,0x5874,0x5875,0x5876,0x5877, +0x5878,0x5879,0x587A,0x587B,0x587C,0x587D,0x587F,0x5882, +0x5884,0x5886,0x5887,0x5888,0x588A,0x588B,0x588C, 0, +0x588D,0x588E,0x588F,0x5890,0x5891,0x5894,0x5895,0x5896, +0x5897,0x5898,0x589B,0x589C,0x589D,0x58A0,0x58A1,0x58A2, +0x58A3,0x58A4,0x58A5,0x58A6,0x58A7,0x58AA,0x58AB,0x58AC, +0x58AD,0x58AE,0x58AF,0x58B0,0x58B1,0x58B2,0x58B3,0x58B4, +0x58B5,0x58B6,0x58B7,0x58B8,0x58B9,0x58BA,0x58BB,0x58BD, +0x58BE,0x58BF,0x58C0,0x58C2,0x58C3,0x58C4,0x58C6,0x58C7, +0x58C8,0x58C9,0x58CA,0x58CB,0x58CC,0x58CD,0x58CE,0x58CF, +0x58D0,0x58D2,0x58D3,0x58D4,0x58D6,0x58D7,0x58D8,0x58D9, +0x58DA,0x58DB,0x58DC,0x58DD,0x58DE,0x58DF,0x58E0,0x58E1, +0x58E2,0x58E3,0x58E5,0x58E6,0x58E7,0x58E8,0x58E9,0x58EA, +0x58ED,0x58EF,0x58F1,0x58F2,0x58F4,0x58F5,0x58F7,0x58F8, +0x58FA,0x58FB,0x58FC,0x58FD,0x58FE,0x58FF,0x5900,0x5901, +0x5903,0x5905,0x5906,0x5908,0x5909,0x590A,0x590B,0x590C, +0x590E,0x5910,0x5911,0x5912,0x5913,0x5917,0x5918,0x591B, +0x591D,0x591E,0x5920,0x5921,0x5922,0x5923,0x5926,0x5928, +0x592C,0x5930,0x5932,0x5933,0x5935,0x5936,0x593B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x593D,0x593E,0x593F,0x5940,0x5943,0x5945,0x5946,0x594A, +0x594C,0x594D,0x5950,0x5952,0x5953,0x5959,0x595B,0x595C, +0x595D,0x595E,0x595F,0x5961,0x5963,0x5964,0x5966,0x5967, +0x5968,0x5969,0x596A,0x596B,0x596C,0x596D,0x596E,0x596F, +0x5970,0x5971,0x5972,0x5975,0x5977,0x597A,0x597B,0x597C, +0x597E,0x597F,0x5980,0x5985,0x5989,0x598B,0x598C,0x598E, +0x598F,0x5990,0x5991,0x5994,0x5995,0x5998,0x599A,0x599B, +0x599C,0x599D,0x599F,0x59A0,0x59A1,0x59A2,0x59A6, 0, +0x59A7,0x59AC,0x59AD,0x59B0,0x59B1,0x59B3,0x59B4,0x59B5, +0x59B6,0x59B7,0x59B8,0x59BA,0x59BC,0x59BD,0x59BF,0x59C0, +0x59C1,0x59C2,0x59C3,0x59C4,0x59C5,0x59C7,0x59C8,0x59C9, +0x59CC,0x59CD,0x59CE,0x59CF,0x59D5,0x59D6,0x59D9,0x59DB, +0x59DE,0x59DF,0x59E0,0x59E1,0x59E2,0x59E4,0x59E6,0x59E7, +0x59E9,0x59EA,0x59EB,0x59ED,0x59EE,0x59EF,0x59F0,0x59F1, +0x59F2,0x59F3,0x59F4,0x59F5,0x59F6,0x59F7,0x59F8,0x59FA, +0x59FC,0x59FD,0x59FE,0x5A00,0x5A02,0x5A0A,0x5A0B,0x5A0D, +0x5A0E,0x5A0F,0x5A10,0x5A12,0x5A14,0x5A15,0x5A16,0x5A17, +0x5A19,0x5A1A,0x5A1B,0x5A1D,0x5A1E,0x5A21,0x5A22,0x5A24, +0x5A26,0x5A27,0x5A28,0x5A2A,0x5A2B,0x5A2C,0x5A2D,0x5A2E, +0x5A2F,0x5A30,0x5A33,0x5A35,0x5A37,0x5A38,0x5A39,0x5A3A, +0x5A3B,0x5A3D,0x5A3E,0x5A3F,0x5A41,0x5A42,0x5A43,0x5A44, +0x5A45,0x5A47,0x5A48,0x5A4B,0x5A4C,0x5A4D,0x5A4E,0x5A4F, +0x5A50,0x5A51,0x5A52,0x5A53,0x5A54,0x5A56,0x5A57,0x5A58, +0x5A59,0x5A5B,0x5A5C,0x5A5D,0x5A5E,0x5A5F,0x5A60, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5A61,0x5A63,0x5A64,0x5A65,0x5A66,0x5A68,0x5A69,0x5A6B, +0x5A6C,0x5A6D,0x5A6E,0x5A6F,0x5A70,0x5A71,0x5A72,0x5A73, +0x5A78,0x5A79,0x5A7B,0x5A7C,0x5A7D,0x5A7E,0x5A80,0x5A81, +0x5A82,0x5A83,0x5A84,0x5A85,0x5A86,0x5A87,0x5A88,0x5A89, +0x5A8A,0x5A8B,0x5A8C,0x5A8D,0x5A8E,0x5A8F,0x5A90,0x5A91, +0x5A93,0x5A94,0x5A95,0x5A96,0x5A97,0x5A98,0x5A99,0x5A9C, +0x5A9D,0x5A9E,0x5A9F,0x5AA0,0x5AA1,0x5AA2,0x5AA3,0x5AA4, +0x5AA5,0x5AA6,0x5AA7,0x5AA8,0x5AA9,0x5AAB,0x5AAC, 0, +0x5AAD,0x5AAE,0x5AAF,0x5AB0,0x5AB1,0x5AB4,0x5AB6,0x5AB7, +0x5AB9,0x5ABA,0x5ABB,0x5ABC,0x5ABD,0x5ABF,0x5AC0,0x5AC3, +0x5AC4,0x5AC5,0x5AC6,0x5AC7,0x5AC8,0x5ACA,0x5ACB,0x5ACD, +0x5ACE,0x5ACF,0x5AD0,0x5AD1,0x5AD3,0x5AD5,0x5AD7,0x5AD9, +0x5ADA,0x5ADB,0x5ADD,0x5ADE,0x5ADF,0x5AE2,0x5AE4,0x5AE5, +0x5AE7,0x5AE8,0x5AEA,0x5AEC,0x5AED,0x5AEE,0x5AEF,0x5AF0, +0x5AF2,0x5AF3,0x5AF4,0x5AF5,0x5AF6,0x5AF7,0x5AF8,0x5AF9, +0x5AFA,0x5AFB,0x5AFC,0x5AFD,0x5AFE,0x5AFF,0x5B00,0x5B01, +0x5B02,0x5B03,0x5B04,0x5B05,0x5B06,0x5B07,0x5B08,0x5B0A, +0x5B0B,0x5B0C,0x5B0D,0x5B0E,0x5B0F,0x5B10,0x5B11,0x5B12, +0x5B13,0x5B14,0x5B15,0x5B18,0x5B19,0x5B1A,0x5B1B,0x5B1C, +0x5B1D,0x5B1E,0x5B1F,0x5B20,0x5B21,0x5B22,0x5B23,0x5B24, +0x5B25,0x5B26,0x5B27,0x5B28,0x5B29,0x5B2A,0x5B2B,0x5B2C, +0x5B2D,0x5B2E,0x5B2F,0x5B30,0x5B31,0x5B33,0x5B35,0x5B36, +0x5B38,0x5B39,0x5B3A,0x5B3B,0x5B3C,0x5B3D,0x5B3E,0x5B3F, +0x5B41,0x5B42,0x5B43,0x5B44,0x5B45,0x5B46,0x5B47, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5B48,0x5B49,0x5B4A,0x5B4B,0x5B4C,0x5B4D,0x5B4E,0x5B4F, +0x5B52,0x5B56,0x5B5E,0x5B60,0x5B61,0x5B67,0x5B68,0x5B6B, +0x5B6D,0x5B6E,0x5B6F,0x5B72,0x5B74,0x5B76,0x5B77,0x5B78, +0x5B79,0x5B7B,0x5B7C,0x5B7E,0x5B7F,0x5B82,0x5B86,0x5B8A, +0x5B8D,0x5B8E,0x5B90,0x5B91,0x5B92,0x5B94,0x5B96,0x5B9F, +0x5BA7,0x5BA8,0x5BA9,0x5BAC,0x5BAD,0x5BAE,0x5BAF,0x5BB1, +0x5BB2,0x5BB7,0x5BBA,0x5BBB,0x5BBC,0x5BC0,0x5BC1,0x5BC3, +0x5BC8,0x5BC9,0x5BCA,0x5BCB,0x5BCD,0x5BCE,0x5BCF, 0, +0x5BD1,0x5BD4,0x5BD5,0x5BD6,0x5BD7,0x5BD8,0x5BD9,0x5BDA, +0x5BDB,0x5BDC,0x5BE0,0x5BE2,0x5BE3,0x5BE6,0x5BE7,0x5BE9, +0x5BEA,0x5BEB,0x5BEC,0x5BED,0x5BEF,0x5BF1,0x5BF2,0x5BF3, +0x5BF4,0x5BF5,0x5BF6,0x5BF7,0x5BFD,0x5BFE,0x5C00,0x5C02, +0x5C03,0x5C05,0x5C07,0x5C08,0x5C0B,0x5C0C,0x5C0D,0x5C0E, +0x5C10,0x5C12,0x5C13,0x5C17,0x5C19,0x5C1B,0x5C1E,0x5C1F, +0x5C20,0x5C21,0x5C23,0x5C26,0x5C28,0x5C29,0x5C2A,0x5C2B, +0x5C2D,0x5C2E,0x5C2F,0x5C30,0x5C32,0x5C33,0x5C35,0x5C36, +0x5C37,0x5C43,0x5C44,0x5C46,0x5C47,0x5C4C,0x5C4D,0x5C52, +0x5C53,0x5C54,0x5C56,0x5C57,0x5C58,0x5C5A,0x5C5B,0x5C5C, +0x5C5D,0x5C5F,0x5C62,0x5C64,0x5C67,0x5C68,0x5C69,0x5C6A, +0x5C6B,0x5C6C,0x5C6D,0x5C70,0x5C72,0x5C73,0x5C74,0x5C75, +0x5C76,0x5C77,0x5C78,0x5C7B,0x5C7C,0x5C7D,0x5C7E,0x5C80, +0x5C83,0x5C84,0x5C85,0x5C86,0x5C87,0x5C89,0x5C8A,0x5C8B, +0x5C8E,0x5C8F,0x5C92,0x5C93,0x5C95,0x5C9D,0x5C9E,0x5C9F, +0x5CA0,0x5CA1,0x5CA4,0x5CA5,0x5CA6,0x5CA7,0x5CA8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5CAA,0x5CAE,0x5CAF,0x5CB0,0x5CB2,0x5CB4,0x5CB6,0x5CB9, +0x5CBA,0x5CBB,0x5CBC,0x5CBE,0x5CC0,0x5CC2,0x5CC3,0x5CC5, +0x5CC6,0x5CC7,0x5CC8,0x5CC9,0x5CCA,0x5CCC,0x5CCD,0x5CCE, +0x5CCF,0x5CD0,0x5CD1,0x5CD3,0x5CD4,0x5CD5,0x5CD6,0x5CD7, +0x5CD8,0x5CDA,0x5CDB,0x5CDC,0x5CDD,0x5CDE,0x5CDF,0x5CE0, +0x5CE2,0x5CE3,0x5CE7,0x5CE9,0x5CEB,0x5CEC,0x5CEE,0x5CEF, +0x5CF1,0x5CF2,0x5CF3,0x5CF4,0x5CF5,0x5CF6,0x5CF7,0x5CF8, +0x5CF9,0x5CFA,0x5CFC,0x5CFD,0x5CFE,0x5CFF,0x5D00, 0, +0x5D01,0x5D04,0x5D05,0x5D08,0x5D09,0x5D0A,0x5D0B,0x5D0C, +0x5D0D,0x5D0F,0x5D10,0x5D11,0x5D12,0x5D13,0x5D15,0x5D17, +0x5D18,0x5D19,0x5D1A,0x5D1C,0x5D1D,0x5D1F,0x5D20,0x5D21, +0x5D22,0x5D23,0x5D25,0x5D28,0x5D2A,0x5D2B,0x5D2C,0x5D2F, +0x5D30,0x5D31,0x5D32,0x5D33,0x5D35,0x5D36,0x5D37,0x5D38, +0x5D39,0x5D3A,0x5D3B,0x5D3C,0x5D3F,0x5D40,0x5D41,0x5D42, +0x5D43,0x5D44,0x5D45,0x5D46,0x5D48,0x5D49,0x5D4D,0x5D4E, +0x5D4F,0x5D50,0x5D51,0x5D52,0x5D53,0x5D54,0x5D55,0x5D56, +0x5D57,0x5D59,0x5D5A,0x5D5C,0x5D5E,0x5D5F,0x5D60,0x5D61, +0x5D62,0x5D63,0x5D64,0x5D65,0x5D66,0x5D67,0x5D68,0x5D6A, +0x5D6D,0x5D6E,0x5D70,0x5D71,0x5D72,0x5D73,0x5D75,0x5D76, +0x5D77,0x5D78,0x5D79,0x5D7A,0x5D7B,0x5D7C,0x5D7D,0x5D7E, +0x5D7F,0x5D80,0x5D81,0x5D83,0x5D84,0x5D85,0x5D86,0x5D87, +0x5D88,0x5D89,0x5D8A,0x5D8B,0x5D8C,0x5D8D,0x5D8E,0x5D8F, +0x5D90,0x5D91,0x5D92,0x5D93,0x5D94,0x5D95,0x5D96,0x5D97, +0x5D98,0x5D9A,0x5D9B,0x5D9C,0x5D9E,0x5D9F,0x5DA0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5DA1,0x5DA2,0x5DA3,0x5DA4,0x5DA5,0x5DA6,0x5DA7,0x5DA8, +0x5DA9,0x5DAA,0x5DAB,0x5DAC,0x5DAD,0x5DAE,0x5DAF,0x5DB0, +0x5DB1,0x5DB2,0x5DB3,0x5DB4,0x5DB5,0x5DB6,0x5DB8,0x5DB9, +0x5DBA,0x5DBB,0x5DBC,0x5DBD,0x5DBE,0x5DBF,0x5DC0,0x5DC1, +0x5DC2,0x5DC3,0x5DC4,0x5DC6,0x5DC7,0x5DC8,0x5DC9,0x5DCA, +0x5DCB,0x5DCC,0x5DCE,0x5DCF,0x5DD0,0x5DD1,0x5DD2,0x5DD3, +0x5DD4,0x5DD5,0x5DD6,0x5DD7,0x5DD8,0x5DD9,0x5DDA,0x5DDC, +0x5DDF,0x5DE0,0x5DE3,0x5DE4,0x5DEA,0x5DEC,0x5DED, 0, +0x5DF0,0x5DF5,0x5DF6,0x5DF8,0x5DF9,0x5DFA,0x5DFB,0x5DFC, +0x5DFF,0x5E00,0x5E04,0x5E07,0x5E09,0x5E0A,0x5E0B,0x5E0D, +0x5E0E,0x5E12,0x5E13,0x5E17,0x5E1E,0x5E1F,0x5E20,0x5E21, +0x5E22,0x5E23,0x5E24,0x5E25,0x5E28,0x5E29,0x5E2A,0x5E2B, +0x5E2C,0x5E2F,0x5E30,0x5E32,0x5E33,0x5E34,0x5E35,0x5E36, +0x5E39,0x5E3A,0x5E3E,0x5E3F,0x5E40,0x5E41,0x5E43,0x5E46, +0x5E47,0x5E48,0x5E49,0x5E4A,0x5E4B,0x5E4D,0x5E4E,0x5E4F, +0x5E50,0x5E51,0x5E52,0x5E53,0x5E56,0x5E57,0x5E58,0x5E59, +0x5E5A,0x5E5C,0x5E5D,0x5E5F,0x5E60,0x5E63,0x5E64,0x5E65, +0x5E66,0x5E67,0x5E68,0x5E69,0x5E6A,0x5E6B,0x5E6C,0x5E6D, +0x5E6E,0x5E6F,0x5E70,0x5E71,0x5E75,0x5E77,0x5E79,0x5E7E, +0x5E81,0x5E82,0x5E83,0x5E85,0x5E88,0x5E89,0x5E8C,0x5E8D, +0x5E8E,0x5E92,0x5E98,0x5E9B,0x5E9D,0x5EA1,0x5EA2,0x5EA3, +0x5EA4,0x5EA8,0x5EA9,0x5EAA,0x5EAB,0x5EAC,0x5EAE,0x5EAF, +0x5EB0,0x5EB1,0x5EB2,0x5EB4,0x5EBA,0x5EBB,0x5EBC,0x5EBD, +0x5EBF,0x5EC0,0x5EC1,0x5EC2,0x5EC3,0x5EC4,0x5EC5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5EC6,0x5EC7,0x5EC8,0x5ECB,0x5ECC,0x5ECD,0x5ECE,0x5ECF, +0x5ED0,0x5ED4,0x5ED5,0x5ED7,0x5ED8,0x5ED9,0x5EDA,0x5EDC, +0x5EDD,0x5EDE,0x5EDF,0x5EE0,0x5EE1,0x5EE2,0x5EE3,0x5EE4, +0x5EE5,0x5EE6,0x5EE7,0x5EE9,0x5EEB,0x5EEC,0x5EED,0x5EEE, +0x5EEF,0x5EF0,0x5EF1,0x5EF2,0x5EF3,0x5EF5,0x5EF8,0x5EF9, +0x5EFB,0x5EFC,0x5EFD,0x5F05,0x5F06,0x5F07,0x5F09,0x5F0C, +0x5F0D,0x5F0E,0x5F10,0x5F12,0x5F14,0x5F16,0x5F19,0x5F1A, +0x5F1C,0x5F1D,0x5F1E,0x5F21,0x5F22,0x5F23,0x5F24, 0, +0x5F28,0x5F2B,0x5F2C,0x5F2E,0x5F30,0x5F32,0x5F33,0x5F34, +0x5F35,0x5F36,0x5F37,0x5F38,0x5F3B,0x5F3D,0x5F3E,0x5F3F, +0x5F41,0x5F42,0x5F43,0x5F44,0x5F45,0x5F46,0x5F47,0x5F48, +0x5F49,0x5F4A,0x5F4B,0x5F4C,0x5F4D,0x5F4E,0x5F4F,0x5F51, +0x5F54,0x5F59,0x5F5A,0x5F5B,0x5F5C,0x5F5E,0x5F5F,0x5F60, +0x5F63,0x5F65,0x5F67,0x5F68,0x5F6B,0x5F6E,0x5F6F,0x5F72, +0x5F74,0x5F75,0x5F76,0x5F78,0x5F7A,0x5F7D,0x5F7E,0x5F7F, +0x5F83,0x5F86,0x5F8D,0x5F8E,0x5F8F,0x5F91,0x5F93,0x5F94, +0x5F96,0x5F9A,0x5F9B,0x5F9D,0x5F9E,0x5F9F,0x5FA0,0x5FA2, +0x5FA3,0x5FA4,0x5FA5,0x5FA6,0x5FA7,0x5FA9,0x5FAB,0x5FAC, +0x5FAF,0x5FB0,0x5FB1,0x5FB2,0x5FB3,0x5FB4,0x5FB6,0x5FB8, +0x5FB9,0x5FBA,0x5FBB,0x5FBE,0x5FBF,0x5FC0,0x5FC1,0x5FC2, +0x5FC7,0x5FC8,0x5FCA,0x5FCB,0x5FCE,0x5FD3,0x5FD4,0x5FD5, +0x5FDA,0x5FDB,0x5FDC,0x5FDE,0x5FDF,0x5FE2,0x5FE3,0x5FE5, +0x5FE6,0x5FE8,0x5FE9,0x5FEC,0x5FEF,0x5FF0,0x5FF2,0x5FF3, +0x5FF4,0x5FF6,0x5FF7,0x5FF9,0x5FFA,0x5FFC,0x6007, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6008,0x6009,0x600B,0x600C,0x6010,0x6011,0x6013,0x6017, +0x6018,0x601A,0x601E,0x601F,0x6022,0x6023,0x6024,0x602C, +0x602D,0x602E,0x6030,0x6031,0x6032,0x6033,0x6034,0x6036, +0x6037,0x6038,0x6039,0x603A,0x603D,0x603E,0x6040,0x6044, +0x6045,0x6046,0x6047,0x6048,0x6049,0x604A,0x604C,0x604E, +0x604F,0x6051,0x6053,0x6054,0x6056,0x6057,0x6058,0x605B, +0x605C,0x605E,0x605F,0x6060,0x6061,0x6065,0x6066,0x606E, +0x6071,0x6072,0x6074,0x6075,0x6077,0x607E,0x6080, 0, +0x6081,0x6082,0x6085,0x6086,0x6087,0x6088,0x608A,0x608B, +0x608E,0x608F,0x6090,0x6091,0x6093,0x6095,0x6097,0x6098, +0x6099,0x609C,0x609E,0x60A1,0x60A2,0x60A4,0x60A5,0x60A7, +0x60A9,0x60AA,0x60AE,0x60B0,0x60B3,0x60B5,0x60B6,0x60B7, +0x60B9,0x60BA,0x60BD,0x60BE,0x60BF,0x60C0,0x60C1,0x60C2, +0x60C3,0x60C4,0x60C7,0x60C8,0x60C9,0x60CC,0x60CD,0x60CE, +0x60CF,0x60D0,0x60D2,0x60D3,0x60D4,0x60D6,0x60D7,0x60D9, +0x60DB,0x60DE,0x60E1,0x60E2,0x60E3,0x60E4,0x60E5,0x60EA, +0x60F1,0x60F2,0x60F5,0x60F7,0x60F8,0x60FB,0x60FC,0x60FD, +0x60FE,0x60FF,0x6102,0x6103,0x6104,0x6105,0x6107,0x610A, +0x610B,0x610C,0x6110,0x6111,0x6112,0x6113,0x6114,0x6116, +0x6117,0x6118,0x6119,0x611B,0x611C,0x611D,0x611E,0x6121, +0x6122,0x6125,0x6128,0x6129,0x612A,0x612C,0x612D,0x612E, +0x612F,0x6130,0x6131,0x6132,0x6133,0x6134,0x6135,0x6136, +0x6137,0x6138,0x6139,0x613A,0x613B,0x613C,0x613D,0x613E, +0x6140,0x6141,0x6142,0x6143,0x6144,0x6145,0x6146, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6147,0x6149,0x614B,0x614D,0x614F,0x6150,0x6152,0x6153, +0x6154,0x6156,0x6157,0x6158,0x6159,0x615A,0x615B,0x615C, +0x615E,0x615F,0x6160,0x6161,0x6163,0x6164,0x6165,0x6166, +0x6169,0x616A,0x616B,0x616C,0x616D,0x616E,0x616F,0x6171, +0x6172,0x6173,0x6174,0x6176,0x6178,0x6179,0x617A,0x617B, +0x617C,0x617D,0x617E,0x617F,0x6180,0x6181,0x6182,0x6183, +0x6184,0x6185,0x6186,0x6187,0x6188,0x6189,0x618A,0x618C, +0x618D,0x618F,0x6190,0x6191,0x6192,0x6193,0x6195, 0, +0x6196,0x6197,0x6198,0x6199,0x619A,0x619B,0x619C,0x619E, +0x619F,0x61A0,0x61A1,0x61A2,0x61A3,0x61A4,0x61A5,0x61A6, +0x61AA,0x61AB,0x61AD,0x61AE,0x61AF,0x61B0,0x61B1,0x61B2, +0x61B3,0x61B4,0x61B5,0x61B6,0x61B8,0x61B9,0x61BA,0x61BB, +0x61BC,0x61BD,0x61BF,0x61C0,0x61C1,0x61C3,0x61C4,0x61C5, +0x61C6,0x61C7,0x61C9,0x61CC,0x61CD,0x61CE,0x61CF,0x61D0, +0x61D3,0x61D5,0x61D6,0x61D7,0x61D8,0x61D9,0x61DA,0x61DB, +0x61DC,0x61DD,0x61DE,0x61DF,0x61E0,0x61E1,0x61E2,0x61E3, +0x61E4,0x61E5,0x61E7,0x61E8,0x61E9,0x61EA,0x61EB,0x61EC, +0x61ED,0x61EE,0x61EF,0x61F0,0x61F1,0x61F2,0x61F3,0x61F4, +0x61F6,0x61F7,0x61F8,0x61F9,0x61FA,0x61FB,0x61FC,0x61FD, +0x61FE,0x6200,0x6201,0x6202,0x6203,0x6204,0x6205,0x6207, +0x6209,0x6213,0x6214,0x6219,0x621C,0x621D,0x621E,0x6220, +0x6223,0x6226,0x6227,0x6228,0x6229,0x622B,0x622D,0x622F, +0x6230,0x6231,0x6232,0x6235,0x6236,0x6238,0x6239,0x623A, +0x623B,0x623C,0x6242,0x6244,0x6245,0x6246,0x624A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x624F,0x6250,0x6255,0x6256,0x6257,0x6259,0x625A,0x625C, +0x625D,0x625E,0x625F,0x6260,0x6261,0x6262,0x6264,0x6265, +0x6268,0x6271,0x6272,0x6274,0x6275,0x6277,0x6278,0x627A, +0x627B,0x627D,0x6281,0x6282,0x6283,0x6285,0x6286,0x6287, +0x6288,0x628B,0x628C,0x628D,0x628E,0x628F,0x6290,0x6294, +0x6299,0x629C,0x629D,0x629E,0x62A3,0x62A6,0x62A7,0x62A9, +0x62AA,0x62AD,0x62AE,0x62AF,0x62B0,0x62B2,0x62B3,0x62B4, +0x62B6,0x62B7,0x62B8,0x62BA,0x62BE,0x62C0,0x62C1, 0, +0x62C3,0x62CB,0x62CF,0x62D1,0x62D5,0x62DD,0x62DE,0x62E0, +0x62E1,0x62E4,0x62EA,0x62EB,0x62F0,0x62F2,0x62F5,0x62F8, +0x62F9,0x62FA,0x62FB,0x6300,0x6303,0x6304,0x6305,0x6306, +0x630A,0x630B,0x630C,0x630D,0x630F,0x6310,0x6312,0x6313, +0x6314,0x6315,0x6317,0x6318,0x6319,0x631C,0x6326,0x6327, +0x6329,0x632C,0x632D,0x632E,0x6330,0x6331,0x6333,0x6334, +0x6335,0x6336,0x6337,0x6338,0x633B,0x633C,0x633E,0x633F, +0x6340,0x6341,0x6344,0x6347,0x6348,0x634A,0x6351,0x6352, +0x6353,0x6354,0x6356,0x6357,0x6358,0x6359,0x635A,0x635B, +0x635C,0x635D,0x6360,0x6364,0x6365,0x6366,0x6368,0x636A, +0x636B,0x636C,0x636F,0x6370,0x6372,0x6373,0x6374,0x6375, +0x6378,0x6379,0x637C,0x637D,0x637E,0x637F,0x6381,0x6383, +0x6384,0x6385,0x6386,0x638B,0x638D,0x6391,0x6393,0x6394, +0x6395,0x6397,0x6399,0x639A,0x639B,0x639C,0x639D,0x639E, +0x639F,0x63A1,0x63A4,0x63A6,0x63AB,0x63AF,0x63B1,0x63B2, +0x63B5,0x63B6,0x63B9,0x63BB,0x63BD,0x63BF,0x63C0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x63C1,0x63C2,0x63C3,0x63C5,0x63C7,0x63C8,0x63CA,0x63CB, +0x63CC,0x63D1,0x63D3,0x63D4,0x63D5,0x63D7,0x63D8,0x63D9, +0x63DA,0x63DB,0x63DC,0x63DD,0x63DF,0x63E2,0x63E4,0x63E5, +0x63E6,0x63E7,0x63E8,0x63EB,0x63EC,0x63EE,0x63EF,0x63F0, +0x63F1,0x63F3,0x63F5,0x63F7,0x63F9,0x63FA,0x63FB,0x63FC, +0x63FE,0x6403,0x6404,0x6406,0x6407,0x6408,0x6409,0x640A, +0x640D,0x640E,0x6411,0x6412,0x6415,0x6416,0x6417,0x6418, +0x6419,0x641A,0x641D,0x641F,0x6422,0x6423,0x6424, 0, +0x6425,0x6427,0x6428,0x6429,0x642B,0x642E,0x642F,0x6430, +0x6431,0x6432,0x6433,0x6435,0x6436,0x6437,0x6438,0x6439, +0x643B,0x643C,0x643E,0x6440,0x6442,0x6443,0x6449,0x644B, +0x644C,0x644D,0x644E,0x644F,0x6450,0x6451,0x6453,0x6455, +0x6456,0x6457,0x6459,0x645A,0x645B,0x645C,0x645D,0x645F, +0x6460,0x6461,0x6462,0x6463,0x6464,0x6465,0x6466,0x6468, +0x646A,0x646B,0x646C,0x646E,0x646F,0x6470,0x6471,0x6472, +0x6473,0x6474,0x6475,0x6476,0x6477,0x647B,0x647C,0x647D, +0x647E,0x647F,0x6480,0x6481,0x6483,0x6486,0x6488,0x6489, +0x648A,0x648B,0x648C,0x648D,0x648E,0x648F,0x6490,0x6493, +0x6494,0x6497,0x6498,0x649A,0x649B,0x649C,0x649D,0x649F, +0x64A0,0x64A1,0x64A2,0x64A3,0x64A5,0x64A6,0x64A7,0x64A8, +0x64AA,0x64AB,0x64AF,0x64B1,0x64B2,0x64B3,0x64B4,0x64B6, +0x64B9,0x64BB,0x64BD,0x64BE,0x64BF,0x64C1,0x64C3,0x64C4, +0x64C6,0x64C7,0x64C8,0x64C9,0x64CA,0x64CB,0x64CC,0x64CF, +0x64D1,0x64D3,0x64D4,0x64D5,0x64D6,0x64D9,0x64DA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x64DB,0x64DC,0x64DD,0x64DF,0x64E0,0x64E1,0x64E3,0x64E5, +0x64E7,0x64E8,0x64E9,0x64EA,0x64EB,0x64EC,0x64ED,0x64EE, +0x64EF,0x64F0,0x64F1,0x64F2,0x64F3,0x64F4,0x64F5,0x64F6, +0x64F7,0x64F8,0x64F9,0x64FA,0x64FB,0x64FC,0x64FD,0x64FE, +0x64FF,0x6501,0x6502,0x6503,0x6504,0x6505,0x6506,0x6507, +0x6508,0x650A,0x650B,0x650C,0x650D,0x650E,0x650F,0x6510, +0x6511,0x6513,0x6514,0x6515,0x6516,0x6517,0x6519,0x651A, +0x651B,0x651C,0x651D,0x651E,0x651F,0x6520,0x6521, 0, +0x6522,0x6523,0x6524,0x6526,0x6527,0x6528,0x6529,0x652A, +0x652C,0x652D,0x6530,0x6531,0x6532,0x6533,0x6537,0x653A, +0x653C,0x653D,0x6540,0x6541,0x6542,0x6543,0x6544,0x6546, +0x6547,0x654A,0x654B,0x654D,0x654E,0x6550,0x6552,0x6553, +0x6554,0x6557,0x6558,0x655A,0x655C,0x655F,0x6560,0x6561, +0x6564,0x6565,0x6567,0x6568,0x6569,0x656A,0x656D,0x656E, +0x656F,0x6571,0x6573,0x6575,0x6576,0x6578,0x6579,0x657A, +0x657B,0x657C,0x657D,0x657E,0x657F,0x6580,0x6581,0x6582, +0x6583,0x6584,0x6585,0x6586,0x6588,0x6589,0x658A,0x658D, +0x658E,0x658F,0x6592,0x6594,0x6595,0x6596,0x6598,0x659A, +0x659D,0x659E,0x65A0,0x65A2,0x65A3,0x65A6,0x65A8,0x65AA, +0x65AC,0x65AE,0x65B1,0x65B2,0x65B3,0x65B4,0x65B5,0x65B6, +0x65B7,0x65B8,0x65BA,0x65BB,0x65BE,0x65BF,0x65C0,0x65C2, +0x65C7,0x65C8,0x65C9,0x65CA,0x65CD,0x65D0,0x65D1,0x65D3, +0x65D4,0x65D5,0x65D8,0x65D9,0x65DA,0x65DB,0x65DC,0x65DD, +0x65DE,0x65DF,0x65E1,0x65E3,0x65E4,0x65EA,0x65EB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x65F2,0x65F3,0x65F4,0x65F5,0x65F8,0x65F9,0x65FB,0x65FC, +0x65FD,0x65FE,0x65FF,0x6601,0x6604,0x6605,0x6607,0x6608, +0x6609,0x660B,0x660D,0x6610,0x6611,0x6612,0x6616,0x6617, +0x6618,0x661A,0x661B,0x661C,0x661E,0x6621,0x6622,0x6623, +0x6624,0x6626,0x6629,0x662A,0x662B,0x662C,0x662E,0x6630, +0x6632,0x6633,0x6637,0x6638,0x6639,0x663A,0x663B,0x663D, +0x663F,0x6640,0x6642,0x6644,0x6645,0x6646,0x6647,0x6648, +0x6649,0x664A,0x664D,0x664E,0x6650,0x6651,0x6658, 0, +0x6659,0x665B,0x665C,0x665D,0x665E,0x6660,0x6662,0x6663, +0x6665,0x6667,0x6669,0x666A,0x666B,0x666C,0x666D,0x6671, +0x6672,0x6673,0x6675,0x6678,0x6679,0x667B,0x667C,0x667D, +0x667F,0x6680,0x6681,0x6683,0x6685,0x6686,0x6688,0x6689, +0x668A,0x668B,0x668D,0x668E,0x668F,0x6690,0x6692,0x6693, +0x6694,0x6695,0x6698,0x6699,0x669A,0x669B,0x669C,0x669E, +0x669F,0x66A0,0x66A1,0x66A2,0x66A3,0x66A4,0x66A5,0x66A6, +0x66A9,0x66AA,0x66AB,0x66AC,0x66AD,0x66AF,0x66B0,0x66B1, +0x66B2,0x66B3,0x66B5,0x66B6,0x66B7,0x66B8,0x66BA,0x66BB, +0x66BC,0x66BD,0x66BF,0x66C0,0x66C1,0x66C2,0x66C3,0x66C4, +0x66C5,0x66C6,0x66C7,0x66C8,0x66C9,0x66CA,0x66CB,0x66CC, +0x66CD,0x66CE,0x66CF,0x66D0,0x66D1,0x66D2,0x66D3,0x66D4, +0x66D5,0x66D6,0x66D7,0x66D8,0x66DA,0x66DE,0x66DF,0x66E0, +0x66E1,0x66E2,0x66E3,0x66E4,0x66E5,0x66E7,0x66E8,0x66EA, +0x66EB,0x66EC,0x66ED,0x66EE,0x66EF,0x66F1,0x66F5,0x66F6, +0x66F8,0x66FA,0x66FB,0x66FD,0x6701,0x6702,0x6703, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6704,0x6705,0x6706,0x6707,0x670C,0x670E,0x670F,0x6711, +0x6712,0x6713,0x6716,0x6718,0x6719,0x671A,0x671C,0x671E, +0x6720,0x6721,0x6722,0x6723,0x6724,0x6725,0x6727,0x6729, +0x672E,0x6730,0x6732,0x6733,0x6736,0x6737,0x6738,0x6739, +0x673B,0x673C,0x673E,0x673F,0x6741,0x6744,0x6745,0x6747, +0x674A,0x674B,0x674D,0x6752,0x6754,0x6755,0x6757,0x6758, +0x6759,0x675A,0x675B,0x675D,0x6762,0x6763,0x6764,0x6766, +0x6767,0x676B,0x676C,0x676E,0x6771,0x6774,0x6776, 0, +0x6778,0x6779,0x677A,0x677B,0x677D,0x6780,0x6782,0x6783, +0x6785,0x6786,0x6788,0x678A,0x678C,0x678D,0x678E,0x678F, +0x6791,0x6792,0x6793,0x6794,0x6796,0x6799,0x679B,0x679F, +0x67A0,0x67A1,0x67A4,0x67A6,0x67A9,0x67AC,0x67AE,0x67B1, +0x67B2,0x67B4,0x67B9,0x67BA,0x67BB,0x67BC,0x67BD,0x67BE, +0x67BF,0x67C0,0x67C2,0x67C5,0x67C6,0x67C7,0x67C8,0x67C9, +0x67CA,0x67CB,0x67CC,0x67CD,0x67CE,0x67D5,0x67D6,0x67D7, +0x67DB,0x67DF,0x67E1,0x67E3,0x67E4,0x67E6,0x67E7,0x67E8, +0x67EA,0x67EB,0x67ED,0x67EE,0x67F2,0x67F5,0x67F6,0x67F7, +0x67F8,0x67F9,0x67FA,0x67FB,0x67FC,0x67FE,0x6801,0x6802, +0x6803,0x6804,0x6806,0x680D,0x6810,0x6812,0x6814,0x6815, +0x6818,0x6819,0x681A,0x681B,0x681C,0x681E,0x681F,0x6820, +0x6822,0x6823,0x6824,0x6825,0x6826,0x6827,0x6828,0x682B, +0x682C,0x682D,0x682E,0x682F,0x6830,0x6831,0x6834,0x6835, +0x6836,0x683A,0x683B,0x683F,0x6847,0x684B,0x684D,0x684F, +0x6852,0x6856,0x6857,0x6858,0x6859,0x685A,0x685B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x685C,0x685D,0x685E,0x685F,0x686A,0x686C,0x686D,0x686E, +0x686F,0x6870,0x6871,0x6872,0x6873,0x6875,0x6878,0x6879, +0x687A,0x687B,0x687C,0x687D,0x687E,0x687F,0x6880,0x6882, +0x6884,0x6887,0x6888,0x6889,0x688A,0x688B,0x688C,0x688D, +0x688E,0x6890,0x6891,0x6892,0x6894,0x6895,0x6896,0x6898, +0x6899,0x689A,0x689B,0x689C,0x689D,0x689E,0x689F,0x68A0, +0x68A1,0x68A3,0x68A4,0x68A5,0x68A9,0x68AA,0x68AB,0x68AC, +0x68AE,0x68B1,0x68B2,0x68B4,0x68B6,0x68B7,0x68B8, 0, +0x68B9,0x68BA,0x68BB,0x68BC,0x68BD,0x68BE,0x68BF,0x68C1, +0x68C3,0x68C4,0x68C5,0x68C6,0x68C7,0x68C8,0x68CA,0x68CC, +0x68CE,0x68CF,0x68D0,0x68D1,0x68D3,0x68D4,0x68D6,0x68D7, +0x68D9,0x68DB,0x68DC,0x68DD,0x68DE,0x68DF,0x68E1,0x68E2, +0x68E4,0x68E5,0x68E6,0x68E7,0x68E8,0x68E9,0x68EA,0x68EB, +0x68EC,0x68ED,0x68EF,0x68F2,0x68F3,0x68F4,0x68F6,0x68F7, +0x68F8,0x68FB,0x68FD,0x68FE,0x68FF,0x6900,0x6902,0x6903, +0x6904,0x6906,0x6907,0x6908,0x6909,0x690A,0x690C,0x690F, +0x6911,0x6913,0x6914,0x6915,0x6916,0x6917,0x6918,0x6919, +0x691A,0x691B,0x691C,0x691D,0x691E,0x6921,0x6922,0x6923, +0x6925,0x6926,0x6927,0x6928,0x6929,0x692A,0x692B,0x692C, +0x692E,0x692F,0x6931,0x6932,0x6933,0x6935,0x6936,0x6937, +0x6938,0x693A,0x693B,0x693C,0x693E,0x6940,0x6941,0x6943, +0x6944,0x6945,0x6946,0x6947,0x6948,0x6949,0x694A,0x694B, +0x694C,0x694D,0x694E,0x694F,0x6950,0x6951,0x6952,0x6953, +0x6955,0x6956,0x6958,0x6959,0x695B,0x695C,0x695F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6961,0x6962,0x6964,0x6965,0x6967,0x6968,0x6969,0x696A, +0x696C,0x696D,0x696F,0x6970,0x6972,0x6973,0x6974,0x6975, +0x6976,0x697A,0x697B,0x697D,0x697E,0x697F,0x6981,0x6983, +0x6985,0x698A,0x698B,0x698C,0x698E,0x698F,0x6990,0x6991, +0x6992,0x6993,0x6996,0x6997,0x6999,0x699A,0x699D,0x699E, +0x699F,0x69A0,0x69A1,0x69A2,0x69A3,0x69A4,0x69A5,0x69A6, +0x69A9,0x69AA,0x69AC,0x69AE,0x69AF,0x69B0,0x69B2,0x69B3, +0x69B5,0x69B6,0x69B8,0x69B9,0x69BA,0x69BC,0x69BD, 0, +0x69BE,0x69BF,0x69C0,0x69C2,0x69C3,0x69C4,0x69C5,0x69C6, +0x69C7,0x69C8,0x69C9,0x69CB,0x69CD,0x69CF,0x69D1,0x69D2, +0x69D3,0x69D5,0x69D6,0x69D7,0x69D8,0x69D9,0x69DA,0x69DC, +0x69DD,0x69DE,0x69E1,0x69E2,0x69E3,0x69E4,0x69E5,0x69E6, +0x69E7,0x69E8,0x69E9,0x69EA,0x69EB,0x69EC,0x69EE,0x69EF, +0x69F0,0x69F1,0x69F3,0x69F4,0x69F5,0x69F6,0x69F7,0x69F8, +0x69F9,0x69FA,0x69FB,0x69FC,0x69FE,0x6A00,0x6A01,0x6A02, +0x6A03,0x6A04,0x6A05,0x6A06,0x6A07,0x6A08,0x6A09,0x6A0B, +0x6A0C,0x6A0D,0x6A0E,0x6A0F,0x6A10,0x6A11,0x6A12,0x6A13, +0x6A14,0x6A15,0x6A16,0x6A19,0x6A1A,0x6A1B,0x6A1C,0x6A1D, +0x6A1E,0x6A20,0x6A22,0x6A23,0x6A24,0x6A25,0x6A26,0x6A27, +0x6A29,0x6A2B,0x6A2C,0x6A2D,0x6A2E,0x6A30,0x6A32,0x6A33, +0x6A34,0x6A36,0x6A37,0x6A38,0x6A39,0x6A3A,0x6A3B,0x6A3C, +0x6A3F,0x6A40,0x6A41,0x6A42,0x6A43,0x6A45,0x6A46,0x6A48, +0x6A49,0x6A4A,0x6A4B,0x6A4C,0x6A4D,0x6A4E,0x6A4F,0x6A51, +0x6A52,0x6A53,0x6A54,0x6A55,0x6A56,0x6A57,0x6A5A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6A5C,0x6A5D,0x6A5E,0x6A5F,0x6A60,0x6A62,0x6A63,0x6A64, +0x6A66,0x6A67,0x6A68,0x6A69,0x6A6A,0x6A6B,0x6A6C,0x6A6D, +0x6A6E,0x6A6F,0x6A70,0x6A72,0x6A73,0x6A74,0x6A75,0x6A76, +0x6A77,0x6A78,0x6A7A,0x6A7B,0x6A7D,0x6A7E,0x6A7F,0x6A81, +0x6A82,0x6A83,0x6A85,0x6A86,0x6A87,0x6A88,0x6A89,0x6A8A, +0x6A8B,0x6A8C,0x6A8D,0x6A8F,0x6A92,0x6A93,0x6A94,0x6A95, +0x6A96,0x6A98,0x6A99,0x6A9A,0x6A9B,0x6A9C,0x6A9D,0x6A9E, +0x6A9F,0x6AA1,0x6AA2,0x6AA3,0x6AA4,0x6AA5,0x6AA6, 0, +0x6AA7,0x6AA8,0x6AAA,0x6AAD,0x6AAE,0x6AAF,0x6AB0,0x6AB1, +0x6AB2,0x6AB3,0x6AB4,0x6AB5,0x6AB6,0x6AB7,0x6AB8,0x6AB9, +0x6ABA,0x6ABB,0x6ABC,0x6ABD,0x6ABE,0x6ABF,0x6AC0,0x6AC1, +0x6AC2,0x6AC3,0x6AC4,0x6AC5,0x6AC6,0x6AC7,0x6AC8,0x6AC9, +0x6ACA,0x6ACB,0x6ACC,0x6ACD,0x6ACE,0x6ACF,0x6AD0,0x6AD1, +0x6AD2,0x6AD3,0x6AD4,0x6AD5,0x6AD6,0x6AD7,0x6AD8,0x6AD9, +0x6ADA,0x6ADB,0x6ADC,0x6ADD,0x6ADE,0x6ADF,0x6AE0,0x6AE1, +0x6AE2,0x6AE3,0x6AE4,0x6AE5,0x6AE6,0x6AE7,0x6AE8,0x6AE9, +0x6AEA,0x6AEB,0x6AEC,0x6AED,0x6AEE,0x6AEF,0x6AF0,0x6AF1, +0x6AF2,0x6AF3,0x6AF4,0x6AF5,0x6AF6,0x6AF7,0x6AF8,0x6AF9, +0x6AFA,0x6AFB,0x6AFC,0x6AFD,0x6AFE,0x6AFF,0x6B00,0x6B01, +0x6B02,0x6B03,0x6B04,0x6B05,0x6B06,0x6B07,0x6B08,0x6B09, +0x6B0A,0x6B0B,0x6B0C,0x6B0D,0x6B0E,0x6B0F,0x6B10,0x6B11, +0x6B12,0x6B13,0x6B14,0x6B15,0x6B16,0x6B17,0x6B18,0x6B19, +0x6B1A,0x6B1B,0x6B1C,0x6B1D,0x6B1E,0x6B1F,0x6B25,0x6B26, +0x6B28,0x6B29,0x6B2A,0x6B2B,0x6B2C,0x6B2D,0x6B2E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6B2F,0x6B30,0x6B31,0x6B33,0x6B34,0x6B35,0x6B36,0x6B38, +0x6B3B,0x6B3C,0x6B3D,0x6B3F,0x6B40,0x6B41,0x6B42,0x6B44, +0x6B45,0x6B48,0x6B4A,0x6B4B,0x6B4D,0x6B4E,0x6B4F,0x6B50, +0x6B51,0x6B52,0x6B53,0x6B54,0x6B55,0x6B56,0x6B57,0x6B58, +0x6B5A,0x6B5B,0x6B5C,0x6B5D,0x6B5E,0x6B5F,0x6B60,0x6B61, +0x6B68,0x6B69,0x6B6B,0x6B6C,0x6B6D,0x6B6E,0x6B6F,0x6B70, +0x6B71,0x6B72,0x6B73,0x6B74,0x6B75,0x6B76,0x6B77,0x6B78, +0x6B7A,0x6B7D,0x6B7E,0x6B7F,0x6B80,0x6B85,0x6B88, 0, +0x6B8C,0x6B8E,0x6B8F,0x6B90,0x6B91,0x6B94,0x6B95,0x6B97, +0x6B98,0x6B99,0x6B9C,0x6B9D,0x6B9E,0x6B9F,0x6BA0,0x6BA2, +0x6BA3,0x6BA4,0x6BA5,0x6BA6,0x6BA7,0x6BA8,0x6BA9,0x6BAB, +0x6BAC,0x6BAD,0x6BAE,0x6BAF,0x6BB0,0x6BB1,0x6BB2,0x6BB6, +0x6BB8,0x6BB9,0x6BBA,0x6BBB,0x6BBC,0x6BBD,0x6BBE,0x6BC0, +0x6BC3,0x6BC4,0x6BC6,0x6BC7,0x6BC8,0x6BC9,0x6BCA,0x6BCC, +0x6BCE,0x6BD0,0x6BD1,0x6BD8,0x6BDA,0x6BDC,0x6BDD,0x6BDE, +0x6BDF,0x6BE0,0x6BE2,0x6BE3,0x6BE4,0x6BE5,0x6BE6,0x6BE7, +0x6BE8,0x6BE9,0x6BEC,0x6BED,0x6BEE,0x6BF0,0x6BF1,0x6BF2, +0x6BF4,0x6BF6,0x6BF7,0x6BF8,0x6BFA,0x6BFB,0x6BFC,0x6BFE, +0x6BFF,0x6C00,0x6C01,0x6C02,0x6C03,0x6C04,0x6C08,0x6C09, +0x6C0A,0x6C0B,0x6C0C,0x6C0E,0x6C12,0x6C17,0x6C1C,0x6C1D, +0x6C1E,0x6C20,0x6C23,0x6C25,0x6C2B,0x6C2C,0x6C2D,0x6C31, +0x6C33,0x6C36,0x6C37,0x6C39,0x6C3A,0x6C3B,0x6C3C,0x6C3E, +0x6C3F,0x6C43,0x6C44,0x6C45,0x6C48,0x6C4B,0x6C4C,0x6C4D, +0x6C4E,0x6C4F,0x6C51,0x6C52,0x6C53,0x6C56,0x6C58, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C59,0x6C5A,0x6C62,0x6C63,0x6C65,0x6C66,0x6C67,0x6C6B, +0x6C6C,0x6C6D,0x6C6E,0x6C6F,0x6C71,0x6C73,0x6C75,0x6C77, +0x6C78,0x6C7A,0x6C7B,0x6C7C,0x6C7F,0x6C80,0x6C84,0x6C87, +0x6C8A,0x6C8B,0x6C8D,0x6C8E,0x6C91,0x6C92,0x6C95,0x6C96, +0x6C97,0x6C98,0x6C9A,0x6C9C,0x6C9D,0x6C9E,0x6CA0,0x6CA2, +0x6CA8,0x6CAC,0x6CAF,0x6CB0,0x6CB4,0x6CB5,0x6CB6,0x6CB7, +0x6CBA,0x6CC0,0x6CC1,0x6CC2,0x6CC3,0x6CC6,0x6CC7,0x6CC8, +0x6CCB,0x6CCD,0x6CCE,0x6CCF,0x6CD1,0x6CD2,0x6CD8, 0, +0x6CD9,0x6CDA,0x6CDC,0x6CDD,0x6CDF,0x6CE4,0x6CE6,0x6CE7, +0x6CE9,0x6CEC,0x6CED,0x6CF2,0x6CF4,0x6CF9,0x6CFF,0x6D00, +0x6D02,0x6D03,0x6D05,0x6D06,0x6D08,0x6D09,0x6D0A,0x6D0D, +0x6D0F,0x6D10,0x6D11,0x6D13,0x6D14,0x6D15,0x6D16,0x6D18, +0x6D1C,0x6D1D,0x6D1F,0x6D20,0x6D21,0x6D22,0x6D23,0x6D24, +0x6D26,0x6D28,0x6D29,0x6D2C,0x6D2D,0x6D2F,0x6D30,0x6D34, +0x6D36,0x6D37,0x6D38,0x6D3A,0x6D3F,0x6D40,0x6D42,0x6D44, +0x6D49,0x6D4C,0x6D50,0x6D55,0x6D56,0x6D57,0x6D58,0x6D5B, +0x6D5D,0x6D5F,0x6D61,0x6D62,0x6D64,0x6D65,0x6D67,0x6D68, +0x6D6B,0x6D6C,0x6D6D,0x6D70,0x6D71,0x6D72,0x6D73,0x6D75, +0x6D76,0x6D79,0x6D7A,0x6D7B,0x6D7D,0x6D7E,0x6D7F,0x6D80, +0x6D81,0x6D83,0x6D84,0x6D86,0x6D87,0x6D8A,0x6D8B,0x6D8D, +0x6D8F,0x6D90,0x6D92,0x6D96,0x6D97,0x6D98,0x6D99,0x6D9A, +0x6D9C,0x6DA2,0x6DA5,0x6DAC,0x6DAD,0x6DB0,0x6DB1,0x6DB3, +0x6DB4,0x6DB6,0x6DB7,0x6DB9,0x6DBA,0x6DBB,0x6DBC,0x6DBD, +0x6DBE,0x6DC1,0x6DC2,0x6DC3,0x6DC8,0x6DC9,0x6DCA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6DCD,0x6DCE,0x6DCF,0x6DD0,0x6DD2,0x6DD3,0x6DD4,0x6DD5, +0x6DD7,0x6DDA,0x6DDB,0x6DDC,0x6DDF,0x6DE2,0x6DE3,0x6DE5, +0x6DE7,0x6DE8,0x6DE9,0x6DEA,0x6DED,0x6DEF,0x6DF0,0x6DF2, +0x6DF4,0x6DF5,0x6DF6,0x6DF8,0x6DFA,0x6DFD,0x6DFE,0x6DFF, +0x6E00,0x6E01,0x6E02,0x6E03,0x6E04,0x6E06,0x6E07,0x6E08, +0x6E09,0x6E0B,0x6E0F,0x6E12,0x6E13,0x6E15,0x6E18,0x6E19, +0x6E1B,0x6E1C,0x6E1E,0x6E1F,0x6E22,0x6E26,0x6E27,0x6E28, +0x6E2A,0x6E2C,0x6E2E,0x6E30,0x6E31,0x6E33,0x6E35, 0, +0x6E36,0x6E37,0x6E39,0x6E3B,0x6E3C,0x6E3D,0x6E3E,0x6E3F, +0x6E40,0x6E41,0x6E42,0x6E45,0x6E46,0x6E47,0x6E48,0x6E49, +0x6E4A,0x6E4B,0x6E4C,0x6E4F,0x6E50,0x6E51,0x6E52,0x6E55, +0x6E57,0x6E59,0x6E5A,0x6E5C,0x6E5D,0x6E5E,0x6E60,0x6E61, +0x6E62,0x6E63,0x6E64,0x6E65,0x6E66,0x6E67,0x6E68,0x6E69, +0x6E6A,0x6E6C,0x6E6D,0x6E6F,0x6E70,0x6E71,0x6E72,0x6E73, +0x6E74,0x6E75,0x6E76,0x6E77,0x6E78,0x6E79,0x6E7A,0x6E7B, +0x6E7C,0x6E7D,0x6E80,0x6E81,0x6E82,0x6E84,0x6E87,0x6E88, +0x6E8A,0x6E8B,0x6E8C,0x6E8D,0x6E8E,0x6E91,0x6E92,0x6E93, +0x6E94,0x6E95,0x6E96,0x6E97,0x6E99,0x6E9A,0x6E9B,0x6E9D, +0x6E9E,0x6EA0,0x6EA1,0x6EA3,0x6EA4,0x6EA6,0x6EA8,0x6EA9, +0x6EAB,0x6EAC,0x6EAD,0x6EAE,0x6EB0,0x6EB3,0x6EB5,0x6EB8, +0x6EB9,0x6EBC,0x6EBE,0x6EBF,0x6EC0,0x6EC3,0x6EC4,0x6EC5, +0x6EC6,0x6EC8,0x6EC9,0x6ECA,0x6ECC,0x6ECD,0x6ECE,0x6ED0, +0x6ED2,0x6ED6,0x6ED8,0x6ED9,0x6EDB,0x6EDC,0x6EDD,0x6EE3, +0x6EE7,0x6EEA,0x6EEB,0x6EEC,0x6EED,0x6EEE,0x6EEF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6EF0,0x6EF1,0x6EF2,0x6EF3,0x6EF5,0x6EF6,0x6EF7,0x6EF8, +0x6EFA,0x6EFB,0x6EFC,0x6EFD,0x6EFE,0x6EFF,0x6F00,0x6F01, +0x6F03,0x6F04,0x6F05,0x6F07,0x6F08,0x6F0A,0x6F0B,0x6F0C, +0x6F0D,0x6F0E,0x6F10,0x6F11,0x6F12,0x6F16,0x6F17,0x6F18, +0x6F19,0x6F1A,0x6F1B,0x6F1C,0x6F1D,0x6F1E,0x6F1F,0x6F21, +0x6F22,0x6F23,0x6F25,0x6F26,0x6F27,0x6F28,0x6F2C,0x6F2E, +0x6F30,0x6F32,0x6F34,0x6F35,0x6F37,0x6F38,0x6F39,0x6F3A, +0x6F3B,0x6F3C,0x6F3D,0x6F3F,0x6F40,0x6F41,0x6F42, 0, +0x6F43,0x6F44,0x6F45,0x6F48,0x6F49,0x6F4A,0x6F4C,0x6F4E, +0x6F4F,0x6F50,0x6F51,0x6F52,0x6F53,0x6F54,0x6F55,0x6F56, +0x6F57,0x6F59,0x6F5A,0x6F5B,0x6F5D,0x6F5F,0x6F60,0x6F61, +0x6F63,0x6F64,0x6F65,0x6F67,0x6F68,0x6F69,0x6F6A,0x6F6B, +0x6F6C,0x6F6F,0x6F70,0x6F71,0x6F73,0x6F75,0x6F76,0x6F77, +0x6F79,0x6F7B,0x6F7D,0x6F7E,0x6F7F,0x6F80,0x6F81,0x6F82, +0x6F83,0x6F85,0x6F86,0x6F87,0x6F8A,0x6F8B,0x6F8F,0x6F90, +0x6F91,0x6F92,0x6F93,0x6F94,0x6F95,0x6F96,0x6F97,0x6F98, +0x6F99,0x6F9A,0x6F9B,0x6F9D,0x6F9E,0x6F9F,0x6FA0,0x6FA2, +0x6FA3,0x6FA4,0x6FA5,0x6FA6,0x6FA8,0x6FA9,0x6FAA,0x6FAB, +0x6FAC,0x6FAD,0x6FAE,0x6FAF,0x6FB0,0x6FB1,0x6FB2,0x6FB4, +0x6FB5,0x6FB7,0x6FB8,0x6FBA,0x6FBB,0x6FBC,0x6FBD,0x6FBE, +0x6FBF,0x6FC1,0x6FC3,0x6FC4,0x6FC5,0x6FC6,0x6FC7,0x6FC8, +0x6FCA,0x6FCB,0x6FCC,0x6FCD,0x6FCE,0x6FCF,0x6FD0,0x6FD3, +0x6FD4,0x6FD5,0x6FD6,0x6FD7,0x6FD8,0x6FD9,0x6FDA,0x6FDB, +0x6FDC,0x6FDD,0x6FDF,0x6FE2,0x6FE3,0x6FE4,0x6FE5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6FE6,0x6FE7,0x6FE8,0x6FE9,0x6FEA,0x6FEB,0x6FEC,0x6FED, +0x6FF0,0x6FF1,0x6FF2,0x6FF3,0x6FF4,0x6FF5,0x6FF6,0x6FF7, +0x6FF8,0x6FF9,0x6FFA,0x6FFB,0x6FFC,0x6FFD,0x6FFE,0x6FFF, +0x7000,0x7001,0x7002,0x7003,0x7004,0x7005,0x7006,0x7007, +0x7008,0x7009,0x700A,0x700B,0x700C,0x700D,0x700E,0x700F, +0x7010,0x7012,0x7013,0x7014,0x7015,0x7016,0x7017,0x7018, +0x7019,0x701C,0x701D,0x701E,0x701F,0x7020,0x7021,0x7022, +0x7024,0x7025,0x7026,0x7027,0x7028,0x7029,0x702A, 0, +0x702B,0x702C,0x702D,0x702E,0x702F,0x7030,0x7031,0x7032, +0x7033,0x7034,0x7036,0x7037,0x7038,0x703A,0x703B,0x703C, +0x703D,0x703E,0x703F,0x7040,0x7041,0x7042,0x7043,0x7044, +0x7045,0x7046,0x7047,0x7048,0x7049,0x704A,0x704B,0x704D, +0x704E,0x7050,0x7051,0x7052,0x7053,0x7054,0x7055,0x7056, +0x7057,0x7058,0x7059,0x705A,0x705B,0x705C,0x705D,0x705F, +0x7060,0x7061,0x7062,0x7063,0x7064,0x7065,0x7066,0x7067, +0x7068,0x7069,0x706A,0x706E,0x7071,0x7072,0x7073,0x7074, +0x7077,0x7079,0x707A,0x707B,0x707D,0x7081,0x7082,0x7083, +0x7084,0x7086,0x7087,0x7088,0x708B,0x708C,0x708D,0x708F, +0x7090,0x7091,0x7093,0x7097,0x7098,0x709A,0x709B,0x709E, +0x709F,0x70A0,0x70A1,0x70A2,0x70A3,0x70A4,0x70A5,0x70A6, +0x70A7,0x70A8,0x70A9,0x70AA,0x70B0,0x70B2,0x70B4,0x70B5, +0x70B6,0x70BA,0x70BE,0x70BF,0x70C4,0x70C5,0x70C6,0x70C7, +0x70C9,0x70CB,0x70CC,0x70CD,0x70CE,0x70CF,0x70D0,0x70D1, +0x70D2,0x70D3,0x70D4,0x70D5,0x70D6,0x70D7,0x70DA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x70DC,0x70DD,0x70DE,0x70E0,0x70E1,0x70E2,0x70E3,0x70E5, +0x70EA,0x70EE,0x70F0,0x70F1,0x70F2,0x70F3,0x70F4,0x70F5, +0x70F6,0x70F8,0x70FA,0x70FB,0x70FC,0x70FE,0x70FF,0x7100, +0x7101,0x7102,0x7103,0x7104,0x7105,0x7106,0x7107,0x7108, +0x710B,0x710C,0x710D,0x710E,0x710F,0x7111,0x7112,0x7114, +0x7117,0x711B,0x711C,0x711D,0x711E,0x711F,0x7120,0x7121, +0x7122,0x7123,0x7124,0x7125,0x7127,0x7128,0x7129,0x712A, +0x712B,0x712C,0x712D,0x712E,0x7132,0x7133,0x7134, 0, +0x7135,0x7137,0x7138,0x7139,0x713A,0x713B,0x713C,0x713D, +0x713E,0x713F,0x7140,0x7141,0x7142,0x7143,0x7144,0x7146, +0x7147,0x7148,0x7149,0x714B,0x714D,0x714F,0x7150,0x7151, +0x7152,0x7153,0x7154,0x7155,0x7156,0x7157,0x7158,0x7159, +0x715A,0x715B,0x715D,0x715F,0x7160,0x7161,0x7162,0x7163, +0x7165,0x7169,0x716A,0x716B,0x716C,0x716D,0x716F,0x7170, +0x7171,0x7174,0x7175,0x7176,0x7177,0x7179,0x717B,0x717C, +0x717E,0x717F,0x7180,0x7181,0x7182,0x7183,0x7185,0x7186, +0x7187,0x7188,0x7189,0x718B,0x718C,0x718D,0x718E,0x7190, +0x7191,0x7192,0x7193,0x7195,0x7196,0x7197,0x719A,0x719B, +0x719C,0x719D,0x719E,0x71A1,0x71A2,0x71A3,0x71A4,0x71A5, +0x71A6,0x71A7,0x71A9,0x71AA,0x71AB,0x71AD,0x71AE,0x71AF, +0x71B0,0x71B1,0x71B2,0x71B4,0x71B6,0x71B7,0x71B8,0x71BA, +0x71BB,0x71BC,0x71BD,0x71BE,0x71BF,0x71C0,0x71C1,0x71C2, +0x71C4,0x71C5,0x71C6,0x71C7,0x71C8,0x71C9,0x71CA,0x71CB, +0x71CC,0x71CD,0x71CF,0x71D0,0x71D1,0x71D2,0x71D3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x71D6,0x71D7,0x71D8,0x71D9,0x71DA,0x71DB,0x71DC,0x71DD, +0x71DE,0x71DF,0x71E1,0x71E2,0x71E3,0x71E4,0x71E6,0x71E8, +0x71E9,0x71EA,0x71EB,0x71EC,0x71ED,0x71EF,0x71F0,0x71F1, +0x71F2,0x71F3,0x71F4,0x71F5,0x71F6,0x71F7,0x71F8,0x71FA, +0x71FB,0x71FC,0x71FD,0x71FE,0x71FF,0x7200,0x7201,0x7202, +0x7203,0x7204,0x7205,0x7207,0x7208,0x7209,0x720A,0x720B, +0x720C,0x720D,0x720E,0x720F,0x7210,0x7211,0x7212,0x7213, +0x7214,0x7215,0x7216,0x7217,0x7218,0x7219,0x721A, 0, +0x721B,0x721C,0x721E,0x721F,0x7220,0x7221,0x7222,0x7223, +0x7224,0x7225,0x7226,0x7227,0x7229,0x722B,0x722D,0x722E, +0x722F,0x7232,0x7233,0x7234,0x723A,0x723C,0x723E,0x7240, +0x7241,0x7242,0x7243,0x7244,0x7245,0x7246,0x7249,0x724A, +0x724B,0x724E,0x724F,0x7250,0x7251,0x7253,0x7254,0x7255, +0x7257,0x7258,0x725A,0x725C,0x725E,0x7260,0x7263,0x7264, +0x7265,0x7268,0x726A,0x726B,0x726C,0x726D,0x7270,0x7271, +0x7273,0x7274,0x7276,0x7277,0x7278,0x727B,0x727C,0x727D, +0x7282,0x7283,0x7285,0x7286,0x7287,0x7288,0x7289,0x728C, +0x728E,0x7290,0x7291,0x7293,0x7294,0x7295,0x7296,0x7297, +0x7298,0x7299,0x729A,0x729B,0x729C,0x729D,0x729E,0x72A0, +0x72A1,0x72A2,0x72A3,0x72A4,0x72A5,0x72A6,0x72A7,0x72A8, +0x72A9,0x72AA,0x72AB,0x72AE,0x72B1,0x72B2,0x72B3,0x72B5, +0x72BA,0x72BB,0x72BC,0x72BD,0x72BE,0x72BF,0x72C0,0x72C5, +0x72C6,0x72C7,0x72C9,0x72CA,0x72CB,0x72CC,0x72CF,0x72D1, +0x72D3,0x72D4,0x72D5,0x72D6,0x72D8,0x72DA,0x72DB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3000,0x3001,0x3002,0x00B7,0x02C9,0x02C7,0x00A8, +0x3003,0x3005,0x2014,0xFF5E,0x2016,0x2026,0x2018,0x2019, +0x201C,0x201D,0x3014,0x3015,0x3008,0x3009,0x300A,0x300B, +0x300C,0x300D,0x300E,0x300F,0x3016,0x3017,0x3010,0x3011, +0x00B1,0x00D7,0x00F7,0x2236,0x2227,0x2228,0x2211,0x220F, +0x222A,0x2229,0x2208,0x2237,0x221A,0x22A5,0x2225,0x2220, +0x2312,0x2299,0x222B,0x222E,0x2261,0x224C,0x2248,0x223D, +0x221D,0x2260,0x226E,0x226F,0x2264,0x2265,0x221E,0x2235, +0x2234,0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFF04, +0x00A4,0xFFE0,0xFFE1,0x2030,0x00A7,0x2116,0x2606,0x2605, +0x25CB,0x25CF,0x25CE,0x25C7,0x25C6,0x25A1,0x25A0,0x25B3, +0x25B2,0x203B,0x2192,0x2190,0x2191,0x2193,0x3013, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x2170,0x2171,0x2172,0x2173,0x2174,0x2175,0x2176, +0x2177,0x2178,0x2179, 0, 0, 0, 0, 0, + 0,0x2488,0x2489,0x248A,0x248B,0x248C,0x248D,0x248E, +0x248F,0x2490,0x2491,0x2492,0x2493,0x2494,0x2495,0x2496, +0x2497,0x2498,0x2499,0x249A,0x249B,0x2474,0x2475,0x2476, +0x2477,0x2478,0x2479,0x247A,0x247B,0x247C,0x247D,0x247E, +0x247F,0x2480,0x2481,0x2482,0x2483,0x2484,0x2485,0x2486, +0x2487,0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466, +0x2467,0x2468,0x2469, 0, 0,0x3220,0x3221,0x3222, +0x3223,0x3224,0x3225,0x3226,0x3227,0x3228,0x3229, 0, + 0,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166, +0x2167,0x2168,0x2169,0x216A,0x216B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFF01,0xFF02,0xFF03,0xFFE5,0xFF05,0xFF06,0xFF07, +0xFF08,0xFF09,0xFF0A,0xFF0B,0xFF0C,0xFF0D,0xFF0E,0xFF0F, +0xFF10,0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17, +0xFF18,0xFF19,0xFF1A,0xFF1B,0xFF1C,0xFF1D,0xFF1E,0xFF1F, +0xFF20,0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27, +0xFF28,0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F, +0xFF30,0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37, +0xFF38,0xFF39,0xFF3A,0xFF3B,0xFF3C,0xFF3D,0xFF3E,0xFF3F, +0xFF40,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47, +0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F, +0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57, +0xFF58,0xFF59,0xFF5A,0xFF5B,0xFF5C,0xFF5D,0xFFE3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047, +0x3048,0x3049,0x304A,0x304B,0x304C,0x304D,0x304E,0x304F, +0x3050,0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057, +0x3058,0x3059,0x305A,0x305B,0x305C,0x305D,0x305E,0x305F, +0x3060,0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067, +0x3068,0x3069,0x306A,0x306B,0x306C,0x306D,0x306E,0x306F, +0x3070,0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077, +0x3078,0x3079,0x307A,0x307B,0x307C,0x307D,0x307E,0x307F, +0x3080,0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087, +0x3088,0x3089,0x308A,0x308B,0x308C,0x308D,0x308E,0x308F, +0x3090,0x3091,0x3092,0x3093, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7, +0x30A8,0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF, +0x30B0,0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7, +0x30B8,0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF, +0x30C0,0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7, +0x30C8,0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF, +0x30D0,0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7, +0x30D8,0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF, +0x30E0,0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7, +0x30E8,0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF, +0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397, +0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F, +0x03A0,0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8, +0x03A9, 0, 0, 0, 0, 0, 0, 0, + 0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7, +0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF, +0x03C0,0x03C1,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8, +0x03C9, 0, 0, 0, 0, 0, 0, 0, +0xFE35,0xFE36,0xFE39,0xFE3A,0xFE3F,0xFE40,0xFE3D,0xFE3E, +0xFE41,0xFE42,0xFE43,0xFE44, 0, 0,0xFE3B,0xFE3C, +0xFE37,0xFE38,0xFE31, 0,0xFE33,0xFE34, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401, +0x0416,0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D, +0x041E,0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425, +0x0426,0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D, +0x042E,0x042F, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451, +0x0436,0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D, +0x043E,0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445, +0x0446,0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D, +0x044E,0x044F, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x02CA,0x02CB,0x02D9,0x2013,0x2015,0x2025,0x2035,0x2105, +0x2109,0x2196,0x2197,0x2198,0x2199,0x2215,0x221F,0x2223, +0x2252,0x2266,0x2267,0x22BF,0x2550,0x2551,0x2552,0x2553, +0x2554,0x2555,0x2556,0x2557,0x2558,0x2559,0x255A,0x255B, +0x255C,0x255D,0x255E,0x255F,0x2560,0x2561,0x2562,0x2563, +0x2564,0x2565,0x2566,0x2567,0x2568,0x2569,0x256A,0x256B, +0x256C,0x256D,0x256E,0x256F,0x2570,0x2571,0x2572,0x2573, +0x2581,0x2582,0x2583,0x2584,0x2585,0x2586,0x2587, 0, +0x2588,0x2589,0x258A,0x258B,0x258C,0x258D,0x258E,0x258F, +0x2593,0x2594,0x2595,0x25BC,0x25BD,0x25E2,0x25E3,0x25E4, +0x25E5,0x2609,0x2295,0x3012,0x301D,0x301E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x0101,0x00E1,0x01CE,0x00E0,0x0113,0x00E9,0x011B, +0x00E8,0x012B,0x00ED,0x01D0,0x00EC,0x014D,0x00F3,0x01D2, +0x00F2,0x016B,0x00FA,0x01D4,0x00F9,0x01D6,0x01D8,0x01DA, +0x01DC,0x00FC,0x00EA,0x0251, 0,0x0144,0x0148, 0, +0x0261, 0, 0, 0, 0,0x3105,0x3106,0x3107, +0x3108,0x3109,0x310A,0x310B,0x310C,0x310D,0x310E,0x310F, +0x3110,0x3111,0x3112,0x3113,0x3114,0x3115,0x3116,0x3117, +0x3118,0x3119,0x311A,0x311B,0x311C,0x311D,0x311E,0x311F, +0x3120,0x3121,0x3122,0x3123,0x3124,0x3125,0x3126,0x3127, +0x3128,0x3129, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3021,0x3022,0x3023,0x3024,0x3025,0x3026,0x3027,0x3028, +0x3029,0x32A3,0x338E,0x338F,0x339C,0x339D,0x339E,0x33A1, +0x33C4,0x33CE,0x33D1,0x33D2,0x33D5,0xFE30,0xFFE2,0xFFE4, + 0,0x2121,0x3231, 0,0x2010, 0, 0, 0, +0x30FC,0x309B,0x309C,0x30FD,0x30FE,0x3006,0x309D,0x309E, +0xFE49,0xFE4A,0xFE4B,0xFE4C,0xFE4D,0xFE4E,0xFE4F,0xFE50, +0xFE51,0xFE52,0xFE54,0xFE55,0xFE56,0xFE57,0xFE59,0xFE5A, +0xFE5B,0xFE5C,0xFE5D,0xFE5E,0xFE5F,0xFE60,0xFE61, 0, +0xFE62,0xFE63,0xFE64,0xFE65,0xFE66,0xFE68,0xFE69,0xFE6A, +0xFE6B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3007, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x2500,0x2501,0x2502,0x2503, +0x2504,0x2505,0x2506,0x2507,0x2508,0x2509,0x250A,0x250B, +0x250C,0x250D,0x250E,0x250F,0x2510,0x2511,0x2512,0x2513, +0x2514,0x2515,0x2516,0x2517,0x2518,0x2519,0x251A,0x251B, +0x251C,0x251D,0x251E,0x251F,0x2520,0x2521,0x2522,0x2523, +0x2524,0x2525,0x2526,0x2527,0x2528,0x2529,0x252A,0x252B, +0x252C,0x252D,0x252E,0x252F,0x2530,0x2531,0x2532,0x2533, +0x2534,0x2535,0x2536,0x2537,0x2538,0x2539,0x253A,0x253B, +0x253C,0x253D,0x253E,0x253F,0x2540,0x2541,0x2542,0x2543, +0x2544,0x2545,0x2546,0x2547,0x2548,0x2549,0x254A,0x254B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x72DC,0x72DD,0x72DF,0x72E2,0x72E3,0x72E4,0x72E5,0x72E6, +0x72E7,0x72EA,0x72EB,0x72F5,0x72F6,0x72F9,0x72FD,0x72FE, +0x72FF,0x7300,0x7302,0x7304,0x7305,0x7306,0x7307,0x7308, +0x7309,0x730B,0x730C,0x730D,0x730F,0x7310,0x7311,0x7312, +0x7314,0x7318,0x7319,0x731A,0x731F,0x7320,0x7323,0x7324, +0x7326,0x7327,0x7328,0x732D,0x732F,0x7330,0x7332,0x7333, +0x7335,0x7336,0x733A,0x733B,0x733C,0x733D,0x7340,0x7341, +0x7342,0x7343,0x7344,0x7345,0x7346,0x7347,0x7348, 0, +0x7349,0x734A,0x734B,0x734C,0x734E,0x734F,0x7351,0x7353, +0x7354,0x7355,0x7356,0x7358,0x7359,0x735A,0x735B,0x735C, +0x735D,0x735E,0x735F,0x7361,0x7362,0x7363,0x7364,0x7365, +0x7366,0x7367,0x7368,0x7369,0x736A,0x736B,0x736E,0x7370, +0x7371, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7372,0x7373,0x7374,0x7375,0x7376,0x7377,0x7378,0x7379, +0x737A,0x737B,0x737C,0x737D,0x737F,0x7380,0x7381,0x7382, +0x7383,0x7385,0x7386,0x7388,0x738A,0x738C,0x738D,0x738F, +0x7390,0x7392,0x7393,0x7394,0x7395,0x7397,0x7398,0x7399, +0x739A,0x739C,0x739D,0x739E,0x73A0,0x73A1,0x73A3,0x73A4, +0x73A5,0x73A6,0x73A7,0x73A8,0x73AA,0x73AC,0x73AD,0x73B1, +0x73B4,0x73B5,0x73B6,0x73B8,0x73B9,0x73BC,0x73BD,0x73BE, +0x73BF,0x73C1,0x73C3,0x73C4,0x73C5,0x73C6,0x73C7, 0, +0x73CB,0x73CC,0x73CE,0x73D2,0x73D3,0x73D4,0x73D5,0x73D6, +0x73D7,0x73D8,0x73DA,0x73DB,0x73DC,0x73DD,0x73DF,0x73E1, +0x73E2,0x73E3,0x73E4,0x73E6,0x73E8,0x73EA,0x73EB,0x73EC, +0x73EE,0x73EF,0x73F0,0x73F1,0x73F3,0x73F4,0x73F5,0x73F6, +0x73F7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x73F8,0x73F9,0x73FA,0x73FB,0x73FC,0x73FD,0x73FE,0x73FF, +0x7400,0x7401,0x7402,0x7404,0x7407,0x7408,0x740B,0x740C, +0x740D,0x740E,0x7411,0x7412,0x7413,0x7414,0x7415,0x7416, +0x7417,0x7418,0x7419,0x741C,0x741D,0x741E,0x741F,0x7420, +0x7421,0x7423,0x7424,0x7427,0x7429,0x742B,0x742D,0x742F, +0x7431,0x7432,0x7437,0x7438,0x7439,0x743A,0x743B,0x743D, +0x743E,0x743F,0x7440,0x7442,0x7443,0x7444,0x7445,0x7446, +0x7447,0x7448,0x7449,0x744A,0x744B,0x744C,0x744D, 0, +0x744E,0x744F,0x7450,0x7451,0x7452,0x7453,0x7454,0x7456, +0x7458,0x745D,0x7460,0x7461,0x7462,0x7463,0x7464,0x7465, +0x7466,0x7467,0x7468,0x7469,0x746A,0x746B,0x746C,0x746E, +0x746F,0x7471,0x7472,0x7473,0x7474,0x7475,0x7478,0x7479, +0x747A, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x747B,0x747C,0x747D,0x747F,0x7482,0x7484,0x7485,0x7486, +0x7488,0x7489,0x748A,0x748C,0x748D,0x748F,0x7491,0x7492, +0x7493,0x7494,0x7495,0x7496,0x7497,0x7498,0x7499,0x749A, +0x749B,0x749D,0x749F,0x74A0,0x74A1,0x74A2,0x74A3,0x74A4, +0x74A5,0x74A6,0x74AA,0x74AB,0x74AC,0x74AD,0x74AE,0x74AF, +0x74B0,0x74B1,0x74B2,0x74B3,0x74B4,0x74B5,0x74B6,0x74B7, +0x74B8,0x74B9,0x74BB,0x74BC,0x74BD,0x74BE,0x74BF,0x74C0, +0x74C1,0x74C2,0x74C3,0x74C4,0x74C5,0x74C6,0x74C7, 0, +0x74C8,0x74C9,0x74CA,0x74CB,0x74CC,0x74CD,0x74CE,0x74CF, +0x74D0,0x74D1,0x74D3,0x74D4,0x74D5,0x74D6,0x74D7,0x74D8, +0x74D9,0x74DA,0x74DB,0x74DD,0x74DF,0x74E1,0x74E5,0x74E7, +0x74E8,0x74E9,0x74EA,0x74EB,0x74EC,0x74ED,0x74F0,0x74F1, +0x74F2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x74F3,0x74F5,0x74F8,0x74F9,0x74FA,0x74FB,0x74FC,0x74FD, +0x74FE,0x7500,0x7501,0x7502,0x7503,0x7505,0x7506,0x7507, +0x7508,0x7509,0x750A,0x750B,0x750C,0x750E,0x7510,0x7512, +0x7514,0x7515,0x7516,0x7517,0x751B,0x751D,0x751E,0x7520, +0x7521,0x7522,0x7523,0x7524,0x7526,0x7527,0x752A,0x752E, +0x7534,0x7536,0x7539,0x753C,0x753D,0x753F,0x7541,0x7542, +0x7543,0x7544,0x7546,0x7547,0x7549,0x754A,0x754D,0x7550, +0x7551,0x7552,0x7553,0x7555,0x7556,0x7557,0x7558, 0, +0x755D,0x755E,0x755F,0x7560,0x7561,0x7562,0x7563,0x7564, +0x7567,0x7568,0x7569,0x756B,0x756C,0x756D,0x756E,0x756F, +0x7570,0x7571,0x7573,0x7575,0x7576,0x7577,0x757A,0x757B, +0x757C,0x757D,0x757E,0x7580,0x7581,0x7582,0x7584,0x7585, +0x7587, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7588,0x7589,0x758A,0x758C,0x758D,0x758E,0x7590,0x7593, +0x7595,0x7598,0x759B,0x759C,0x759E,0x75A2,0x75A6,0x75A7, +0x75A8,0x75A9,0x75AA,0x75AD,0x75B6,0x75B7,0x75BA,0x75BB, +0x75BF,0x75C0,0x75C1,0x75C6,0x75CB,0x75CC,0x75CE,0x75CF, +0x75D0,0x75D1,0x75D3,0x75D7,0x75D9,0x75DA,0x75DC,0x75DD, +0x75DF,0x75E0,0x75E1,0x75E5,0x75E9,0x75EC,0x75ED,0x75EE, +0x75EF,0x75F2,0x75F3,0x75F5,0x75F6,0x75F7,0x75F8,0x75FA, +0x75FB,0x75FD,0x75FE,0x7602,0x7604,0x7606,0x7607, 0, +0x7608,0x7609,0x760B,0x760D,0x760E,0x760F,0x7611,0x7612, +0x7613,0x7614,0x7616,0x761A,0x761C,0x761D,0x761E,0x7621, +0x7623,0x7627,0x7628,0x762C,0x762E,0x762F,0x7631,0x7632, +0x7636,0x7637,0x7639,0x763A,0x763B,0x763D,0x7641,0x7642, +0x7644, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7645,0x7646,0x7647,0x7648,0x7649,0x764A,0x764B,0x764E, +0x764F,0x7650,0x7651,0x7652,0x7653,0x7655,0x7657,0x7658, +0x7659,0x765A,0x765B,0x765D,0x765F,0x7660,0x7661,0x7662, +0x7664,0x7665,0x7666,0x7667,0x7668,0x7669,0x766A,0x766C, +0x766D,0x766E,0x7670,0x7671,0x7672,0x7673,0x7674,0x7675, +0x7676,0x7677,0x7679,0x767A,0x767C,0x767F,0x7680,0x7681, +0x7683,0x7685,0x7689,0x768A,0x768C,0x768D,0x768F,0x7690, +0x7692,0x7694,0x7695,0x7697,0x7698,0x769A,0x769B, 0, +0x769C,0x769D,0x769E,0x769F,0x76A0,0x76A1,0x76A2,0x76A3, +0x76A5,0x76A6,0x76A7,0x76A8,0x76A9,0x76AA,0x76AB,0x76AC, +0x76AD,0x76AF,0x76B0,0x76B3,0x76B5,0x76B6,0x76B7,0x76B8, +0x76B9,0x76BA,0x76BB,0x76BC,0x76BD,0x76BE,0x76C0,0x76C1, +0x76C3,0x554A,0x963F,0x57C3,0x6328,0x54CE,0x5509,0x54C0, +0x7691,0x764C,0x853C,0x77EE,0x827E,0x788D,0x7231,0x9698, +0x978D,0x6C28,0x5B89,0x4FFA,0x6309,0x6697,0x5CB8,0x80FA, +0x6848,0x80AE,0x6602,0x76CE,0x51F9,0x6556,0x71AC,0x7FF1, +0x8884,0x50B2,0x5965,0x61CA,0x6FB3,0x82AD,0x634C,0x6252, +0x53ED,0x5427,0x7B06,0x516B,0x75A4,0x5DF4,0x62D4,0x8DCB, +0x9776,0x628A,0x8019,0x575D,0x9738,0x7F62,0x7238,0x767D, +0x67CF,0x767E,0x6446,0x4F70,0x8D25,0x62DC,0x7A17,0x6591, +0x73ED,0x642C,0x6273,0x822C,0x9881,0x677F,0x7248,0x626E, +0x62CC,0x4F34,0x74E3,0x534A,0x529E,0x7ECA,0x90A6,0x5E2E, +0x6886,0x699C,0x8180,0x7ED1,0x68D2,0x78C5,0x868C,0x9551, +0x508D,0x8C24,0x82DE,0x80DE,0x5305,0x8912,0x5265, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x76C4,0x76C7,0x76C9,0x76CB,0x76CC,0x76D3,0x76D5,0x76D9, +0x76DA,0x76DC,0x76DD,0x76DE,0x76E0,0x76E1,0x76E2,0x76E3, +0x76E4,0x76E6,0x76E7,0x76E8,0x76E9,0x76EA,0x76EB,0x76EC, +0x76ED,0x76F0,0x76F3,0x76F5,0x76F6,0x76F7,0x76FA,0x76FB, +0x76FD,0x76FF,0x7700,0x7702,0x7703,0x7705,0x7706,0x770A, +0x770C,0x770E,0x770F,0x7710,0x7711,0x7712,0x7713,0x7714, +0x7715,0x7716,0x7717,0x7718,0x771B,0x771C,0x771D,0x771E, +0x7721,0x7723,0x7724,0x7725,0x7727,0x772A,0x772B, 0, +0x772C,0x772E,0x7730,0x7731,0x7732,0x7733,0x7734,0x7739, +0x773B,0x773D,0x773E,0x773F,0x7742,0x7744,0x7745,0x7746, +0x7748,0x7749,0x774A,0x774B,0x774C,0x774D,0x774E,0x774F, +0x7752,0x7753,0x7754,0x7755,0x7756,0x7757,0x7758,0x7759, +0x775C,0x8584,0x96F9,0x4FDD,0x5821,0x9971,0x5B9D,0x62B1, +0x62A5,0x66B4,0x8C79,0x9C8D,0x7206,0x676F,0x7891,0x60B2, +0x5351,0x5317,0x8F88,0x80CC,0x8D1D,0x94A1,0x500D,0x72C8, +0x5907,0x60EB,0x7119,0x88AB,0x5954,0x82EF,0x672C,0x7B28, +0x5D29,0x7EF7,0x752D,0x6CF5,0x8E66,0x8FF8,0x903C,0x9F3B, +0x6BD4,0x9119,0x7B14,0x5F7C,0x78A7,0x84D6,0x853D,0x6BD5, +0x6BD9,0x6BD6,0x5E01,0x5E87,0x75F9,0x95ED,0x655D,0x5F0A, +0x5FC5,0x8F9F,0x58C1,0x81C2,0x907F,0x965B,0x97AD,0x8FB9, +0x7F16,0x8D2C,0x6241,0x4FBF,0x53D8,0x535E,0x8FA8,0x8FA9, +0x8FAB,0x904D,0x6807,0x5F6A,0x8198,0x8868,0x9CD6,0x618B, +0x522B,0x762A,0x5F6C,0x658C,0x6FD2,0x6EE8,0x5BBE,0x6448, +0x5175,0x51B0,0x67C4,0x4E19,0x79C9,0x997C,0x70B3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x775D,0x775E,0x775F,0x7760,0x7764,0x7767,0x7769,0x776A, +0x776D,0x776E,0x776F,0x7770,0x7771,0x7772,0x7773,0x7774, +0x7775,0x7776,0x7777,0x7778,0x777A,0x777B,0x777C,0x7781, +0x7782,0x7783,0x7786,0x7787,0x7788,0x7789,0x778A,0x778B, +0x778F,0x7790,0x7793,0x7794,0x7795,0x7796,0x7797,0x7798, +0x7799,0x779A,0x779B,0x779C,0x779D,0x779E,0x77A1,0x77A3, +0x77A4,0x77A6,0x77A8,0x77AB,0x77AD,0x77AE,0x77AF,0x77B1, +0x77B2,0x77B4,0x77B6,0x77B7,0x77B8,0x77B9,0x77BA, 0, +0x77BC,0x77BE,0x77C0,0x77C1,0x77C2,0x77C3,0x77C4,0x77C5, +0x77C6,0x77C7,0x77C8,0x77C9,0x77CA,0x77CB,0x77CC,0x77CE, +0x77CF,0x77D0,0x77D1,0x77D2,0x77D3,0x77D4,0x77D5,0x77D6, +0x77D8,0x77D9,0x77DA,0x77DD,0x77DE,0x77DF,0x77E0,0x77E1, +0x77E4,0x75C5,0x5E76,0x73BB,0x83E0,0x64AD,0x62E8,0x94B5, +0x6CE2,0x535A,0x52C3,0x640F,0x94C2,0x7B94,0x4F2F,0x5E1B, +0x8236,0x8116,0x818A,0x6E24,0x6CCA,0x9A73,0x6355,0x535C, +0x54FA,0x8865,0x57E0,0x4E0D,0x5E03,0x6B65,0x7C3F,0x90E8, +0x6016,0x64E6,0x731C,0x88C1,0x6750,0x624D,0x8D22,0x776C, +0x8E29,0x91C7,0x5F69,0x83DC,0x8521,0x9910,0x53C2,0x8695, +0x6B8B,0x60ED,0x60E8,0x707F,0x82CD,0x8231,0x4ED3,0x6CA7, +0x85CF,0x64CD,0x7CD9,0x69FD,0x66F9,0x8349,0x5395,0x7B56, +0x4FA7,0x518C,0x6D4B,0x5C42,0x8E6D,0x63D2,0x53C9,0x832C, +0x8336,0x67E5,0x78B4,0x643D,0x5BDF,0x5C94,0x5DEE,0x8BE7, +0x62C6,0x67F4,0x8C7A,0x6400,0x63BA,0x8749,0x998B,0x8C17, +0x7F20,0x94F2,0x4EA7,0x9610,0x98A4,0x660C,0x7316, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x77E6,0x77E8,0x77EA,0x77EF,0x77F0,0x77F1,0x77F2,0x77F4, +0x77F5,0x77F7,0x77F9,0x77FA,0x77FB,0x77FC,0x7803,0x7804, +0x7805,0x7806,0x7807,0x7808,0x780A,0x780B,0x780E,0x780F, +0x7810,0x7813,0x7815,0x7819,0x781B,0x781E,0x7820,0x7821, +0x7822,0x7824,0x7828,0x782A,0x782B,0x782E,0x782F,0x7831, +0x7832,0x7833,0x7835,0x7836,0x783D,0x783F,0x7841,0x7842, +0x7843,0x7844,0x7846,0x7848,0x7849,0x784A,0x784B,0x784D, +0x784F,0x7851,0x7853,0x7854,0x7858,0x7859,0x785A, 0, +0x785B,0x785C,0x785E,0x785F,0x7860,0x7861,0x7862,0x7863, +0x7864,0x7865,0x7866,0x7867,0x7868,0x7869,0x786F,0x7870, +0x7871,0x7872,0x7873,0x7874,0x7875,0x7876,0x7878,0x7879, +0x787A,0x787B,0x787D,0x787E,0x787F,0x7880,0x7881,0x7882, +0x7883,0x573A,0x5C1D,0x5E38,0x957F,0x507F,0x80A0,0x5382, +0x655E,0x7545,0x5531,0x5021,0x8D85,0x6284,0x949E,0x671D, +0x5632,0x6F6E,0x5DE2,0x5435,0x7092,0x8F66,0x626F,0x64A4, +0x63A3,0x5F7B,0x6F88,0x90F4,0x81E3,0x8FB0,0x5C18,0x6668, +0x5FF1,0x6C89,0x9648,0x8D81,0x886C,0x6491,0x79F0,0x57CE, +0x6A59,0x6210,0x5448,0x4E58,0x7A0B,0x60E9,0x6F84,0x8BDA, +0x627F,0x901E,0x9A8B,0x79E4,0x5403,0x75F4,0x6301,0x5319, +0x6C60,0x8FDF,0x5F1B,0x9A70,0x803B,0x9F7F,0x4F88,0x5C3A, +0x8D64,0x7FC5,0x65A5,0x70BD,0x5145,0x51B2,0x866B,0x5D07, +0x5BA0,0x62BD,0x916C,0x7574,0x8E0C,0x7A20,0x6101,0x7B79, +0x4EC7,0x7EF8,0x7785,0x4E11,0x81ED,0x521D,0x51FA,0x6A71, +0x53A8,0x8E87,0x9504,0x96CF,0x6EC1,0x9664,0x695A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7884,0x7885,0x7886,0x7888,0x788A,0x788B,0x788F,0x7890, +0x7892,0x7894,0x7895,0x7896,0x7899,0x789D,0x789E,0x78A0, +0x78A2,0x78A4,0x78A6,0x78A8,0x78A9,0x78AA,0x78AB,0x78AC, +0x78AD,0x78AE,0x78AF,0x78B5,0x78B6,0x78B7,0x78B8,0x78BA, +0x78BB,0x78BC,0x78BD,0x78BF,0x78C0,0x78C2,0x78C3,0x78C4, +0x78C6,0x78C7,0x78C8,0x78CC,0x78CD,0x78CE,0x78CF,0x78D1, +0x78D2,0x78D3,0x78D6,0x78D7,0x78D8,0x78DA,0x78DB,0x78DC, +0x78DD,0x78DE,0x78DF,0x78E0,0x78E1,0x78E2,0x78E3, 0, +0x78E4,0x78E5,0x78E6,0x78E7,0x78E9,0x78EA,0x78EB,0x78ED, +0x78EE,0x78EF,0x78F0,0x78F1,0x78F3,0x78F5,0x78F6,0x78F8, +0x78F9,0x78FB,0x78FC,0x78FD,0x78FE,0x78FF,0x7900,0x7902, +0x7903,0x7904,0x7906,0x7907,0x7908,0x7909,0x790A,0x790B, +0x790C,0x7840,0x50A8,0x77D7,0x6410,0x89E6,0x5904,0x63E3, +0x5DDD,0x7A7F,0x693D,0x4F20,0x8239,0x5598,0x4E32,0x75AE, +0x7A97,0x5E62,0x5E8A,0x95EF,0x521B,0x5439,0x708A,0x6376, +0x9524,0x5782,0x6625,0x693F,0x9187,0x5507,0x6DF3,0x7EAF, +0x8822,0x6233,0x7EF0,0x75B5,0x8328,0x78C1,0x96CC,0x8F9E, +0x6148,0x74F7,0x8BCD,0x6B64,0x523A,0x8D50,0x6B21,0x806A, +0x8471,0x56F1,0x5306,0x4ECE,0x4E1B,0x51D1,0x7C97,0x918B, +0x7C07,0x4FC3,0x8E7F,0x7BE1,0x7A9C,0x6467,0x5D14,0x50AC, +0x8106,0x7601,0x7CB9,0x6DEC,0x7FE0,0x6751,0x5B58,0x5BF8, +0x78CB,0x64AE,0x6413,0x63AA,0x632B,0x9519,0x642D,0x8FBE, +0x7B54,0x7629,0x6253,0x5927,0x5446,0x6B79,0x50A3,0x6234, +0x5E26,0x6B86,0x4EE3,0x8D37,0x888B,0x5F85,0x902E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x790D,0x790E,0x790F,0x7910,0x7911,0x7912,0x7914,0x7915, +0x7916,0x7917,0x7918,0x7919,0x791A,0x791B,0x791C,0x791D, +0x791F,0x7920,0x7921,0x7922,0x7923,0x7925,0x7926,0x7927, +0x7928,0x7929,0x792A,0x792B,0x792C,0x792D,0x792E,0x792F, +0x7930,0x7931,0x7932,0x7933,0x7935,0x7936,0x7937,0x7938, +0x7939,0x793D,0x793F,0x7942,0x7943,0x7944,0x7945,0x7947, +0x794A,0x794B,0x794C,0x794D,0x794E,0x794F,0x7950,0x7951, +0x7952,0x7954,0x7955,0x7958,0x7959,0x7961,0x7963, 0, +0x7964,0x7966,0x7969,0x796A,0x796B,0x796C,0x796E,0x7970, +0x7971,0x7972,0x7973,0x7974,0x7975,0x7976,0x7979,0x797B, +0x797C,0x797D,0x797E,0x797F,0x7982,0x7983,0x7986,0x7987, +0x7988,0x7989,0x798B,0x798C,0x798D,0x798E,0x7990,0x7991, +0x7992,0x6020,0x803D,0x62C5,0x4E39,0x5355,0x90F8,0x63B8, +0x80C6,0x65E6,0x6C2E,0x4F46,0x60EE,0x6DE1,0x8BDE,0x5F39, +0x86CB,0x5F53,0x6321,0x515A,0x8361,0x6863,0x5200,0x6363, +0x8E48,0x5012,0x5C9B,0x7977,0x5BFC,0x5230,0x7A3B,0x60BC, +0x9053,0x76D7,0x5FB7,0x5F97,0x7684,0x8E6C,0x706F,0x767B, +0x7B49,0x77AA,0x51F3,0x9093,0x5824,0x4F4E,0x6EF4,0x8FEA, +0x654C,0x7B1B,0x72C4,0x6DA4,0x7FDF,0x5AE1,0x62B5,0x5E95, +0x5730,0x8482,0x7B2C,0x5E1D,0x5F1F,0x9012,0x7F14,0x98A0, +0x6382,0x6EC7,0x7898,0x70B9,0x5178,0x975B,0x57AB,0x7535, +0x4F43,0x7538,0x5E97,0x60E6,0x5960,0x6DC0,0x6BBF,0x7889, +0x53FC,0x96D5,0x51CB,0x5201,0x6389,0x540A,0x9493,0x8C03, +0x8DCC,0x7239,0x789F,0x8776,0x8FED,0x8C0D,0x53E0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7993,0x7994,0x7995,0x7996,0x7997,0x7998,0x7999,0x799B, +0x799C,0x799D,0x799E,0x799F,0x79A0,0x79A1,0x79A2,0x79A3, +0x79A4,0x79A5,0x79A6,0x79A8,0x79A9,0x79AA,0x79AB,0x79AC, +0x79AD,0x79AE,0x79AF,0x79B0,0x79B1,0x79B2,0x79B4,0x79B5, +0x79B6,0x79B7,0x79B8,0x79BC,0x79BF,0x79C2,0x79C4,0x79C5, +0x79C7,0x79C8,0x79CA,0x79CC,0x79CE,0x79CF,0x79D0,0x79D3, +0x79D4,0x79D6,0x79D7,0x79D9,0x79DA,0x79DB,0x79DC,0x79DD, +0x79DE,0x79E0,0x79E1,0x79E2,0x79E5,0x79E8,0x79EA, 0, +0x79EC,0x79EE,0x79F1,0x79F2,0x79F3,0x79F4,0x79F5,0x79F6, +0x79F7,0x79F9,0x79FA,0x79FC,0x79FE,0x79FF,0x7A01,0x7A04, +0x7A05,0x7A07,0x7A08,0x7A09,0x7A0A,0x7A0C,0x7A0F,0x7A10, +0x7A11,0x7A12,0x7A13,0x7A15,0x7A16,0x7A18,0x7A19,0x7A1B, +0x7A1C,0x4E01,0x76EF,0x53EE,0x9489,0x9876,0x9F0E,0x952D, +0x5B9A,0x8BA2,0x4E22,0x4E1C,0x51AC,0x8463,0x61C2,0x52A8, +0x680B,0x4F97,0x606B,0x51BB,0x6D1E,0x515C,0x6296,0x6597, +0x9661,0x8C46,0x9017,0x75D8,0x90FD,0x7763,0x6BD2,0x728A, +0x72EC,0x8BFB,0x5835,0x7779,0x8D4C,0x675C,0x9540,0x809A, +0x5EA6,0x6E21,0x5992,0x7AEF,0x77ED,0x953B,0x6BB5,0x65AD, +0x7F0E,0x5806,0x5151,0x961F,0x5BF9,0x58A9,0x5428,0x8E72, +0x6566,0x987F,0x56E4,0x949D,0x76FE,0x9041,0x6387,0x54C6, +0x591A,0x593A,0x579B,0x8EB2,0x6735,0x8DFA,0x8235,0x5241, +0x60F0,0x5815,0x86FE,0x5CE8,0x9E45,0x4FC4,0x989D,0x8BB9, +0x5A25,0x6076,0x5384,0x627C,0x904F,0x9102,0x997F,0x6069, +0x800C,0x513F,0x8033,0x5C14,0x9975,0x6D31,0x4E8C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7A1D,0x7A1F,0x7A21,0x7A22,0x7A24,0x7A25,0x7A26,0x7A27, +0x7A28,0x7A29,0x7A2A,0x7A2B,0x7A2C,0x7A2D,0x7A2E,0x7A2F, +0x7A30,0x7A31,0x7A32,0x7A34,0x7A35,0x7A36,0x7A38,0x7A3A, +0x7A3E,0x7A40,0x7A41,0x7A42,0x7A43,0x7A44,0x7A45,0x7A47, +0x7A48,0x7A49,0x7A4A,0x7A4B,0x7A4C,0x7A4D,0x7A4E,0x7A4F, +0x7A50,0x7A52,0x7A53,0x7A54,0x7A55,0x7A56,0x7A58,0x7A59, +0x7A5A,0x7A5B,0x7A5C,0x7A5D,0x7A5E,0x7A5F,0x7A60,0x7A61, +0x7A62,0x7A63,0x7A64,0x7A65,0x7A66,0x7A67,0x7A68, 0, +0x7A69,0x7A6A,0x7A6B,0x7A6C,0x7A6D,0x7A6E,0x7A6F,0x7A71, +0x7A72,0x7A73,0x7A75,0x7A7B,0x7A7C,0x7A7D,0x7A7E,0x7A82, +0x7A85,0x7A87,0x7A89,0x7A8A,0x7A8B,0x7A8C,0x7A8E,0x7A8F, +0x7A90,0x7A93,0x7A94,0x7A99,0x7A9A,0x7A9B,0x7A9E,0x7AA1, +0x7AA2,0x8D30,0x53D1,0x7F5A,0x7B4F,0x4F10,0x4E4F,0x9600, +0x6CD5,0x73D0,0x85E9,0x5E06,0x756A,0x7FFB,0x6A0A,0x77FE, +0x9492,0x7E41,0x51E1,0x70E6,0x53CD,0x8FD4,0x8303,0x8D29, +0x72AF,0x996D,0x6CDB,0x574A,0x82B3,0x65B9,0x80AA,0x623F, +0x9632,0x59A8,0x4EFF,0x8BBF,0x7EBA,0x653E,0x83F2,0x975E, +0x5561,0x98DE,0x80A5,0x532A,0x8BFD,0x5420,0x80BA,0x5E9F, +0x6CB8,0x8D39,0x82AC,0x915A,0x5429,0x6C1B,0x5206,0x7EB7, +0x575F,0x711A,0x6C7E,0x7C89,0x594B,0x4EFD,0x5FFF,0x6124, +0x7CAA,0x4E30,0x5C01,0x67AB,0x8702,0x5CF0,0x950B,0x98CE, +0x75AF,0x70FD,0x9022,0x51AF,0x7F1D,0x8BBD,0x5949,0x51E4, +0x4F5B,0x5426,0x592B,0x6577,0x80A4,0x5B75,0x6276,0x62C2, +0x8F90,0x5E45,0x6C1F,0x7B26,0x4F0F,0x4FD8,0x670D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7AA3,0x7AA4,0x7AA7,0x7AA9,0x7AAA,0x7AAB,0x7AAE,0x7AAF, +0x7AB0,0x7AB1,0x7AB2,0x7AB4,0x7AB5,0x7AB6,0x7AB7,0x7AB8, +0x7AB9,0x7ABA,0x7ABB,0x7ABC,0x7ABD,0x7ABE,0x7AC0,0x7AC1, +0x7AC2,0x7AC3,0x7AC4,0x7AC5,0x7AC6,0x7AC7,0x7AC8,0x7AC9, +0x7ACA,0x7ACC,0x7ACD,0x7ACE,0x7ACF,0x7AD0,0x7AD1,0x7AD2, +0x7AD3,0x7AD4,0x7AD5,0x7AD7,0x7AD8,0x7ADA,0x7ADB,0x7ADC, +0x7ADD,0x7AE1,0x7AE2,0x7AE4,0x7AE7,0x7AE8,0x7AE9,0x7AEA, +0x7AEB,0x7AEC,0x7AEE,0x7AF0,0x7AF1,0x7AF2,0x7AF3, 0, +0x7AF4,0x7AF5,0x7AF6,0x7AF7,0x7AF8,0x7AFB,0x7AFC,0x7AFE, +0x7B00,0x7B01,0x7B02,0x7B05,0x7B07,0x7B09,0x7B0C,0x7B0D, +0x7B0E,0x7B10,0x7B12,0x7B13,0x7B16,0x7B17,0x7B18,0x7B1A, +0x7B1C,0x7B1D,0x7B1F,0x7B21,0x7B22,0x7B23,0x7B27,0x7B29, +0x7B2D,0x6D6E,0x6DAA,0x798F,0x88B1,0x5F17,0x752B,0x629A, +0x8F85,0x4FEF,0x91DC,0x65A7,0x812F,0x8151,0x5E9C,0x8150, +0x8D74,0x526F,0x8986,0x8D4B,0x590D,0x5085,0x4ED8,0x961C, +0x7236,0x8179,0x8D1F,0x5BCC,0x8BA3,0x9644,0x5987,0x7F1A, +0x5490,0x5676,0x560E,0x8BE5,0x6539,0x6982,0x9499,0x76D6, +0x6E89,0x5E72,0x7518,0x6746,0x67D1,0x7AFF,0x809D,0x8D76, +0x611F,0x79C6,0x6562,0x8D63,0x5188,0x521A,0x94A2,0x7F38, +0x809B,0x7EB2,0x5C97,0x6E2F,0x6760,0x7BD9,0x768B,0x9AD8, +0x818F,0x7F94,0x7CD5,0x641E,0x9550,0x7A3F,0x544A,0x54E5, +0x6B4C,0x6401,0x6208,0x9E3D,0x80F3,0x7599,0x5272,0x9769, +0x845B,0x683C,0x86E4,0x9601,0x9694,0x94EC,0x4E2A,0x5404, +0x7ED9,0x6839,0x8DDF,0x8015,0x66F4,0x5E9A,0x7FB9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7B2F,0x7B30,0x7B32,0x7B34,0x7B35,0x7B36,0x7B37,0x7B39, +0x7B3B,0x7B3D,0x7B3F,0x7B40,0x7B41,0x7B42,0x7B43,0x7B44, +0x7B46,0x7B48,0x7B4A,0x7B4D,0x7B4E,0x7B53,0x7B55,0x7B57, +0x7B59,0x7B5C,0x7B5E,0x7B5F,0x7B61,0x7B63,0x7B64,0x7B65, +0x7B66,0x7B67,0x7B68,0x7B69,0x7B6A,0x7B6B,0x7B6C,0x7B6D, +0x7B6F,0x7B70,0x7B73,0x7B74,0x7B76,0x7B78,0x7B7A,0x7B7C, +0x7B7D,0x7B7F,0x7B81,0x7B82,0x7B83,0x7B84,0x7B86,0x7B87, +0x7B88,0x7B89,0x7B8A,0x7B8B,0x7B8C,0x7B8E,0x7B8F, 0, +0x7B91,0x7B92,0x7B93,0x7B96,0x7B98,0x7B99,0x7B9A,0x7B9B, +0x7B9E,0x7B9F,0x7BA0,0x7BA3,0x7BA4,0x7BA5,0x7BAE,0x7BAF, +0x7BB0,0x7BB2,0x7BB3,0x7BB5,0x7BB6,0x7BB7,0x7BB9,0x7BBA, +0x7BBB,0x7BBC,0x7BBD,0x7BBE,0x7BBF,0x7BC0,0x7BC2,0x7BC3, +0x7BC4,0x57C2,0x803F,0x6897,0x5DE5,0x653B,0x529F,0x606D, +0x9F9A,0x4F9B,0x8EAC,0x516C,0x5BAB,0x5F13,0x5DE9,0x6C5E, +0x62F1,0x8D21,0x5171,0x94A9,0x52FE,0x6C9F,0x82DF,0x72D7, +0x57A2,0x6784,0x8D2D,0x591F,0x8F9C,0x83C7,0x5495,0x7B8D, +0x4F30,0x6CBD,0x5B64,0x59D1,0x9F13,0x53E4,0x86CA,0x9AA8, +0x8C37,0x80A1,0x6545,0x987E,0x56FA,0x96C7,0x522E,0x74DC, +0x5250,0x5BE1,0x6302,0x8902,0x4E56,0x62D0,0x602A,0x68FA, +0x5173,0x5B98,0x51A0,0x89C2,0x7BA1,0x9986,0x7F50,0x60EF, +0x704C,0x8D2F,0x5149,0x5E7F,0x901B,0x7470,0x89C4,0x572D, +0x7845,0x5F52,0x9F9F,0x95FA,0x8F68,0x9B3C,0x8BE1,0x7678, +0x6842,0x67DC,0x8DEA,0x8D35,0x523D,0x8F8A,0x6EDA,0x68CD, +0x9505,0x90ED,0x56FD,0x679C,0x88F9,0x8FC7,0x54C8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7BC5,0x7BC8,0x7BC9,0x7BCA,0x7BCB,0x7BCD,0x7BCE,0x7BCF, +0x7BD0,0x7BD2,0x7BD4,0x7BD5,0x7BD6,0x7BD7,0x7BD8,0x7BDB, +0x7BDC,0x7BDE,0x7BDF,0x7BE0,0x7BE2,0x7BE3,0x7BE4,0x7BE7, +0x7BE8,0x7BE9,0x7BEB,0x7BEC,0x7BED,0x7BEF,0x7BF0,0x7BF2, +0x7BF3,0x7BF4,0x7BF5,0x7BF6,0x7BF8,0x7BF9,0x7BFA,0x7BFB, +0x7BFD,0x7BFF,0x7C00,0x7C01,0x7C02,0x7C03,0x7C04,0x7C05, +0x7C06,0x7C08,0x7C09,0x7C0A,0x7C0D,0x7C0E,0x7C10,0x7C11, +0x7C12,0x7C13,0x7C14,0x7C15,0x7C17,0x7C18,0x7C19, 0, +0x7C1A,0x7C1B,0x7C1C,0x7C1D,0x7C1E,0x7C20,0x7C21,0x7C22, +0x7C23,0x7C24,0x7C25,0x7C28,0x7C29,0x7C2B,0x7C2C,0x7C2D, +0x7C2E,0x7C2F,0x7C30,0x7C31,0x7C32,0x7C33,0x7C34,0x7C35, +0x7C36,0x7C37,0x7C39,0x7C3A,0x7C3B,0x7C3C,0x7C3D,0x7C3E, +0x7C42,0x9AB8,0x5B69,0x6D77,0x6C26,0x4EA5,0x5BB3,0x9A87, +0x9163,0x61A8,0x90AF,0x97E9,0x542B,0x6DB5,0x5BD2,0x51FD, +0x558A,0x7F55,0x7FF0,0x64BC,0x634D,0x65F1,0x61BE,0x608D, +0x710A,0x6C57,0x6C49,0x592F,0x676D,0x822A,0x58D5,0x568E, +0x8C6A,0x6BEB,0x90DD,0x597D,0x8017,0x53F7,0x6D69,0x5475, +0x559D,0x8377,0x83CF,0x6838,0x79BE,0x548C,0x4F55,0x5408, +0x76D2,0x8C89,0x9602,0x6CB3,0x6DB8,0x8D6B,0x8910,0x9E64, +0x8D3A,0x563F,0x9ED1,0x75D5,0x5F88,0x72E0,0x6068,0x54FC, +0x4EA8,0x6A2A,0x8861,0x6052,0x8F70,0x54C4,0x70D8,0x8679, +0x9E3F,0x6D2A,0x5B8F,0x5F18,0x7EA2,0x5589,0x4FAF,0x7334, +0x543C,0x539A,0x5019,0x540E,0x547C,0x4E4E,0x5FFD,0x745A, +0x58F6,0x846B,0x80E1,0x8774,0x72D0,0x7CCA,0x6E56, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7C43,0x7C44,0x7C45,0x7C46,0x7C47,0x7C48,0x7C49,0x7C4A, +0x7C4B,0x7C4C,0x7C4E,0x7C4F,0x7C50,0x7C51,0x7C52,0x7C53, +0x7C54,0x7C55,0x7C56,0x7C57,0x7C58,0x7C59,0x7C5A,0x7C5B, +0x7C5C,0x7C5D,0x7C5E,0x7C5F,0x7C60,0x7C61,0x7C62,0x7C63, +0x7C64,0x7C65,0x7C66,0x7C67,0x7C68,0x7C69,0x7C6A,0x7C6B, +0x7C6C,0x7C6D,0x7C6E,0x7C6F,0x7C70,0x7C71,0x7C72,0x7C75, +0x7C76,0x7C77,0x7C78,0x7C79,0x7C7A,0x7C7E,0x7C7F,0x7C80, +0x7C81,0x7C82,0x7C83,0x7C84,0x7C85,0x7C86,0x7C87, 0, +0x7C88,0x7C8A,0x7C8B,0x7C8C,0x7C8D,0x7C8E,0x7C8F,0x7C90, +0x7C93,0x7C94,0x7C96,0x7C99,0x7C9A,0x7C9B,0x7CA0,0x7CA1, +0x7CA3,0x7CA6,0x7CA7,0x7CA8,0x7CA9,0x7CAB,0x7CAC,0x7CAD, +0x7CAF,0x7CB0,0x7CB4,0x7CB5,0x7CB6,0x7CB7,0x7CB8,0x7CBA, +0x7CBB,0x5F27,0x864E,0x552C,0x62A4,0x4E92,0x6CAA,0x6237, +0x82B1,0x54D7,0x534E,0x733E,0x6ED1,0x753B,0x5212,0x5316, +0x8BDD,0x69D0,0x5F8A,0x6000,0x6DEE,0x574F,0x6B22,0x73AF, +0x6853,0x8FD8,0x7F13,0x6362,0x60A3,0x5524,0x75EA,0x8C62, +0x7115,0x6DA3,0x5BA6,0x5E7B,0x8352,0x614C,0x9EC4,0x78FA, +0x8757,0x7C27,0x7687,0x51F0,0x60F6,0x714C,0x6643,0x5E4C, +0x604D,0x8C0E,0x7070,0x6325,0x8F89,0x5FBD,0x6062,0x86D4, +0x56DE,0x6BC1,0x6094,0x6167,0x5349,0x60E0,0x6666,0x8D3F, +0x79FD,0x4F1A,0x70E9,0x6C47,0x8BB3,0x8BF2,0x7ED8,0x8364, +0x660F,0x5A5A,0x9B42,0x6D51,0x6DF7,0x8C41,0x6D3B,0x4F19, +0x706B,0x83B7,0x6216,0x60D1,0x970D,0x8D27,0x7978,0x51FB, +0x573E,0x57FA,0x673A,0x7578,0x7A3D,0x79EF,0x7B95, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7CBF,0x7CC0,0x7CC2,0x7CC3,0x7CC4,0x7CC6,0x7CC9,0x7CCB, +0x7CCE,0x7CCF,0x7CD0,0x7CD1,0x7CD2,0x7CD3,0x7CD4,0x7CD8, +0x7CDA,0x7CDB,0x7CDD,0x7CDE,0x7CE1,0x7CE2,0x7CE3,0x7CE4, +0x7CE5,0x7CE6,0x7CE7,0x7CE9,0x7CEA,0x7CEB,0x7CEC,0x7CED, +0x7CEE,0x7CF0,0x7CF1,0x7CF2,0x7CF3,0x7CF4,0x7CF5,0x7CF6, +0x7CF7,0x7CF9,0x7CFA,0x7CFC,0x7CFD,0x7CFE,0x7CFF,0x7D00, +0x7D01,0x7D02,0x7D03,0x7D04,0x7D05,0x7D06,0x7D07,0x7D08, +0x7D09,0x7D0B,0x7D0C,0x7D0D,0x7D0E,0x7D0F,0x7D10, 0, +0x7D11,0x7D12,0x7D13,0x7D14,0x7D15,0x7D16,0x7D17,0x7D18, +0x7D19,0x7D1A,0x7D1B,0x7D1C,0x7D1D,0x7D1E,0x7D1F,0x7D21, +0x7D23,0x7D24,0x7D25,0x7D26,0x7D28,0x7D29,0x7D2A,0x7D2C, +0x7D2D,0x7D2E,0x7D30,0x7D31,0x7D32,0x7D33,0x7D34,0x7D35, +0x7D36,0x808C,0x9965,0x8FF9,0x6FC0,0x8BA5,0x9E21,0x59EC, +0x7EE9,0x7F09,0x5409,0x6781,0x68D8,0x8F91,0x7C4D,0x96C6, +0x53CA,0x6025,0x75BE,0x6C72,0x5373,0x5AC9,0x7EA7,0x6324, +0x51E0,0x810A,0x5DF1,0x84DF,0x6280,0x5180,0x5B63,0x4F0E, +0x796D,0x5242,0x60B8,0x6D4E,0x5BC4,0x5BC2,0x8BA1,0x8BB0, +0x65E2,0x5FCC,0x9645,0x5993,0x7EE7,0x7EAA,0x5609,0x67B7, +0x5939,0x4F73,0x5BB6,0x52A0,0x835A,0x988A,0x8D3E,0x7532, +0x94BE,0x5047,0x7A3C,0x4EF7,0x67B6,0x9A7E,0x5AC1,0x6B7C, +0x76D1,0x575A,0x5C16,0x7B3A,0x95F4,0x714E,0x517C,0x80A9, +0x8270,0x5978,0x7F04,0x8327,0x68C0,0x67EC,0x78B1,0x7877, +0x62E3,0x6361,0x7B80,0x4FED,0x526A,0x51CF,0x8350,0x69DB, +0x9274,0x8DF5,0x8D31,0x89C1,0x952E,0x7BAD,0x4EF6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7D37,0x7D38,0x7D39,0x7D3A,0x7D3B,0x7D3C,0x7D3D,0x7D3E, +0x7D3F,0x7D40,0x7D41,0x7D42,0x7D43,0x7D44,0x7D45,0x7D46, +0x7D47,0x7D48,0x7D49,0x7D4A,0x7D4B,0x7D4C,0x7D4D,0x7D4E, +0x7D4F,0x7D50,0x7D51,0x7D52,0x7D53,0x7D54,0x7D55,0x7D56, +0x7D57,0x7D58,0x7D59,0x7D5A,0x7D5B,0x7D5C,0x7D5D,0x7D5E, +0x7D5F,0x7D60,0x7D61,0x7D62,0x7D63,0x7D64,0x7D65,0x7D66, +0x7D67,0x7D68,0x7D69,0x7D6A,0x7D6B,0x7D6C,0x7D6D,0x7D6F, +0x7D70,0x7D71,0x7D72,0x7D73,0x7D74,0x7D75,0x7D76, 0, +0x7D78,0x7D79,0x7D7A,0x7D7B,0x7D7C,0x7D7D,0x7D7E,0x7D7F, +0x7D80,0x7D81,0x7D82,0x7D83,0x7D84,0x7D85,0x7D86,0x7D87, +0x7D88,0x7D89,0x7D8A,0x7D8B,0x7D8C,0x7D8D,0x7D8E,0x7D8F, +0x7D90,0x7D91,0x7D92,0x7D93,0x7D94,0x7D95,0x7D96,0x7D97, +0x7D98,0x5065,0x8230,0x5251,0x996F,0x6E10,0x6E85,0x6DA7, +0x5EFA,0x50F5,0x59DC,0x5C06,0x6D46,0x6C5F,0x7586,0x848B, +0x6868,0x5956,0x8BB2,0x5320,0x9171,0x964D,0x8549,0x6912, +0x7901,0x7126,0x80F6,0x4EA4,0x90CA,0x6D47,0x9A84,0x5A07, +0x56BC,0x6405,0x94F0,0x77EB,0x4FA5,0x811A,0x72E1,0x89D2, +0x997A,0x7F34,0x7EDE,0x527F,0x6559,0x9175,0x8F7F,0x8F83, +0x53EB,0x7A96,0x63ED,0x63A5,0x7686,0x79F8,0x8857,0x9636, +0x622A,0x52AB,0x8282,0x6854,0x6770,0x6377,0x776B,0x7AED, +0x6D01,0x7ED3,0x89E3,0x59D0,0x6212,0x85C9,0x82A5,0x754C, +0x501F,0x4ECB,0x75A5,0x8BEB,0x5C4A,0x5DFE,0x7B4B,0x65A4, +0x91D1,0x4ECA,0x6D25,0x895F,0x7D27,0x9526,0x4EC5,0x8C28, +0x8FDB,0x9773,0x664B,0x7981,0x8FD1,0x70EC,0x6D78, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7D99,0x7D9A,0x7D9B,0x7D9C,0x7D9D,0x7D9E,0x7D9F,0x7DA0, +0x7DA1,0x7DA2,0x7DA3,0x7DA4,0x7DA5,0x7DA7,0x7DA8,0x7DA9, +0x7DAA,0x7DAB,0x7DAC,0x7DAD,0x7DAF,0x7DB0,0x7DB1,0x7DB2, +0x7DB3,0x7DB4,0x7DB5,0x7DB6,0x7DB7,0x7DB8,0x7DB9,0x7DBA, +0x7DBB,0x7DBC,0x7DBD,0x7DBE,0x7DBF,0x7DC0,0x7DC1,0x7DC2, +0x7DC3,0x7DC4,0x7DC5,0x7DC6,0x7DC7,0x7DC8,0x7DC9,0x7DCA, +0x7DCB,0x7DCC,0x7DCD,0x7DCE,0x7DCF,0x7DD0,0x7DD1,0x7DD2, +0x7DD3,0x7DD4,0x7DD5,0x7DD6,0x7DD7,0x7DD8,0x7DD9, 0, +0x7DDA,0x7DDB,0x7DDC,0x7DDD,0x7DDE,0x7DDF,0x7DE0,0x7DE1, +0x7DE2,0x7DE3,0x7DE4,0x7DE5,0x7DE6,0x7DE7,0x7DE8,0x7DE9, +0x7DEA,0x7DEB,0x7DEC,0x7DED,0x7DEE,0x7DEF,0x7DF0,0x7DF1, +0x7DF2,0x7DF3,0x7DF4,0x7DF5,0x7DF6,0x7DF7,0x7DF8,0x7DF9, +0x7DFA,0x5C3D,0x52B2,0x8346,0x5162,0x830E,0x775B,0x6676, +0x9CB8,0x4EAC,0x60CA,0x7CBE,0x7CB3,0x7ECF,0x4E95,0x8B66, +0x666F,0x9888,0x9759,0x5883,0x656C,0x955C,0x5F84,0x75C9, +0x9756,0x7ADF,0x7ADE,0x51C0,0x70AF,0x7A98,0x63EA,0x7A76, +0x7EA0,0x7396,0x97ED,0x4E45,0x7078,0x4E5D,0x9152,0x53A9, +0x6551,0x65E7,0x81FC,0x8205,0x548E,0x5C31,0x759A,0x97A0, +0x62D8,0x72D9,0x75BD,0x5C45,0x9A79,0x83CA,0x5C40,0x5480, +0x77E9,0x4E3E,0x6CAE,0x805A,0x62D2,0x636E,0x5DE8,0x5177, +0x8DDD,0x8E1E,0x952F,0x4FF1,0x53E5,0x60E7,0x70AC,0x5267, +0x6350,0x9E43,0x5A1F,0x5026,0x7737,0x5377,0x7EE2,0x6485, +0x652B,0x6289,0x6398,0x5014,0x7235,0x89C9,0x51B3,0x8BC0, +0x7EDD,0x5747,0x83CC,0x94A7,0x519B,0x541B,0x5CFB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7DFB,0x7DFC,0x7DFD,0x7DFE,0x7DFF,0x7E00,0x7E01,0x7E02, +0x7E03,0x7E04,0x7E05,0x7E06,0x7E07,0x7E08,0x7E09,0x7E0A, +0x7E0B,0x7E0C,0x7E0D,0x7E0E,0x7E0F,0x7E10,0x7E11,0x7E12, +0x7E13,0x7E14,0x7E15,0x7E16,0x7E17,0x7E18,0x7E19,0x7E1A, +0x7E1B,0x7E1C,0x7E1D,0x7E1E,0x7E1F,0x7E20,0x7E21,0x7E22, +0x7E23,0x7E24,0x7E25,0x7E26,0x7E27,0x7E28,0x7E29,0x7E2A, +0x7E2B,0x7E2C,0x7E2D,0x7E2E,0x7E2F,0x7E30,0x7E31,0x7E32, +0x7E33,0x7E34,0x7E35,0x7E36,0x7E37,0x7E38,0x7E39, 0, +0x7E3A,0x7E3C,0x7E3D,0x7E3E,0x7E3F,0x7E40,0x7E42,0x7E43, +0x7E44,0x7E45,0x7E46,0x7E48,0x7E49,0x7E4A,0x7E4B,0x7E4C, +0x7E4D,0x7E4E,0x7E4F,0x7E50,0x7E51,0x7E52,0x7E53,0x7E54, +0x7E55,0x7E56,0x7E57,0x7E58,0x7E59,0x7E5A,0x7E5B,0x7E5C, +0x7E5D,0x4FCA,0x7AE3,0x6D5A,0x90E1,0x9A8F,0x5580,0x5496, +0x5361,0x54AF,0x5F00,0x63E9,0x6977,0x51EF,0x6168,0x520A, +0x582A,0x52D8,0x574E,0x780D,0x770B,0x5EB7,0x6177,0x7CE0, +0x625B,0x6297,0x4EA2,0x7095,0x8003,0x62F7,0x70E4,0x9760, +0x5777,0x82DB,0x67EF,0x68F5,0x78D5,0x9897,0x79D1,0x58F3, +0x54B3,0x53EF,0x6E34,0x514B,0x523B,0x5BA2,0x8BFE,0x80AF, +0x5543,0x57A6,0x6073,0x5751,0x542D,0x7A7A,0x6050,0x5B54, +0x63A7,0x62A0,0x53E3,0x6263,0x5BC7,0x67AF,0x54ED,0x7A9F, +0x82E6,0x9177,0x5E93,0x88E4,0x5938,0x57AE,0x630E,0x8DE8, +0x80EF,0x5757,0x7B77,0x4FA9,0x5FEB,0x5BBD,0x6B3E,0x5321, +0x7B50,0x72C2,0x6846,0x77FF,0x7736,0x65F7,0x51B5,0x4E8F, +0x76D4,0x5CBF,0x7AA5,0x8475,0x594E,0x9B41,0x5080, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7E5E,0x7E5F,0x7E60,0x7E61,0x7E62,0x7E63,0x7E64,0x7E65, +0x7E66,0x7E67,0x7E68,0x7E69,0x7E6A,0x7E6B,0x7E6C,0x7E6D, +0x7E6E,0x7E6F,0x7E70,0x7E71,0x7E72,0x7E73,0x7E74,0x7E75, +0x7E76,0x7E77,0x7E78,0x7E79,0x7E7A,0x7E7B,0x7E7C,0x7E7D, +0x7E7E,0x7E7F,0x7E80,0x7E81,0x7E83,0x7E84,0x7E85,0x7E86, +0x7E87,0x7E88,0x7E89,0x7E8A,0x7E8B,0x7E8C,0x7E8D,0x7E8E, +0x7E8F,0x7E90,0x7E91,0x7E92,0x7E93,0x7E94,0x7E95,0x7E96, +0x7E97,0x7E98,0x7E99,0x7E9A,0x7E9C,0x7E9D,0x7E9E, 0, +0x7EAE,0x7EB4,0x7EBB,0x7EBC,0x7ED6,0x7EE4,0x7EEC,0x7EF9, +0x7F0A,0x7F10,0x7F1E,0x7F37,0x7F39,0x7F3B,0x7F3C,0x7F3D, +0x7F3E,0x7F3F,0x7F40,0x7F41,0x7F43,0x7F46,0x7F47,0x7F48, +0x7F49,0x7F4A,0x7F4B,0x7F4C,0x7F4D,0x7F4E,0x7F4F,0x7F52, +0x7F53,0x9988,0x6127,0x6E83,0x5764,0x6606,0x6346,0x56F0, +0x62EC,0x6269,0x5ED3,0x9614,0x5783,0x62C9,0x5587,0x8721, +0x814A,0x8FA3,0x5566,0x83B1,0x6765,0x8D56,0x84DD,0x5A6A, +0x680F,0x62E6,0x7BEE,0x9611,0x5170,0x6F9C,0x8C30,0x63FD, +0x89C8,0x61D2,0x7F06,0x70C2,0x6EE5,0x7405,0x6994,0x72FC, +0x5ECA,0x90CE,0x6717,0x6D6A,0x635E,0x52B3,0x7262,0x8001, +0x4F6C,0x59E5,0x916A,0x70D9,0x6D9D,0x52D2,0x4E50,0x96F7, +0x956D,0x857E,0x78CA,0x7D2F,0x5121,0x5792,0x64C2,0x808B, +0x7C7B,0x6CEA,0x68F1,0x695E,0x51B7,0x5398,0x68A8,0x7281, +0x9ECE,0x7BF1,0x72F8,0x79BB,0x6F13,0x7406,0x674E,0x91CC, +0x9CA4,0x793C,0x8389,0x8354,0x540F,0x6817,0x4E3D,0x5389, +0x52B1,0x783E,0x5386,0x5229,0x5088,0x4F8B,0x4FD0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7F56,0x7F59,0x7F5B,0x7F5C,0x7F5D,0x7F5E,0x7F60,0x7F63, +0x7F64,0x7F65,0x7F66,0x7F67,0x7F6B,0x7F6C,0x7F6D,0x7F6F, +0x7F70,0x7F73,0x7F75,0x7F76,0x7F77,0x7F78,0x7F7A,0x7F7B, +0x7F7C,0x7F7D,0x7F7F,0x7F80,0x7F82,0x7F83,0x7F84,0x7F85, +0x7F86,0x7F87,0x7F88,0x7F89,0x7F8B,0x7F8D,0x7F8F,0x7F90, +0x7F91,0x7F92,0x7F93,0x7F95,0x7F96,0x7F97,0x7F98,0x7F99, +0x7F9B,0x7F9C,0x7FA0,0x7FA2,0x7FA3,0x7FA5,0x7FA6,0x7FA8, +0x7FA9,0x7FAA,0x7FAB,0x7FAC,0x7FAD,0x7FAE,0x7FB1, 0, +0x7FB3,0x7FB4,0x7FB5,0x7FB6,0x7FB7,0x7FBA,0x7FBB,0x7FBE, +0x7FC0,0x7FC2,0x7FC3,0x7FC4,0x7FC6,0x7FC7,0x7FC8,0x7FC9, +0x7FCB,0x7FCD,0x7FCF,0x7FD0,0x7FD1,0x7FD2,0x7FD3,0x7FD6, +0x7FD7,0x7FD9,0x7FDA,0x7FDB,0x7FDC,0x7FDD,0x7FDE,0x7FE2, +0x7FE3,0x75E2,0x7ACB,0x7C92,0x6CA5,0x96B6,0x529B,0x7483, +0x54E9,0x4FE9,0x8054,0x83B2,0x8FDE,0x9570,0x5EC9,0x601C, +0x6D9F,0x5E18,0x655B,0x8138,0x94FE,0x604B,0x70BC,0x7EC3, +0x7CAE,0x51C9,0x6881,0x7CB1,0x826F,0x4E24,0x8F86,0x91CF, +0x667E,0x4EAE,0x8C05,0x64A9,0x804A,0x50DA,0x7597,0x71CE, +0x5BE5,0x8FBD,0x6F66,0x4E86,0x6482,0x9563,0x5ED6,0x6599, +0x5217,0x88C2,0x70C8,0x52A3,0x730E,0x7433,0x6797,0x78F7, +0x9716,0x4E34,0x90BB,0x9CDE,0x6DCB,0x51DB,0x8D41,0x541D, +0x62CE,0x73B2,0x83F1,0x96F6,0x9F84,0x94C3,0x4F36,0x7F9A, +0x51CC,0x7075,0x9675,0x5CAD,0x9886,0x53E6,0x4EE4,0x6E9C, +0x7409,0x69B4,0x786B,0x998F,0x7559,0x5218,0x7624,0x6D41, +0x67F3,0x516D,0x9F99,0x804B,0x5499,0x7B3C,0x7ABF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7FE4,0x7FE7,0x7FE8,0x7FEA,0x7FEB,0x7FEC,0x7FED,0x7FEF, +0x7FF2,0x7FF4,0x7FF5,0x7FF6,0x7FF7,0x7FF8,0x7FF9,0x7FFA, +0x7FFD,0x7FFE,0x7FFF,0x8002,0x8007,0x8008,0x8009,0x800A, +0x800E,0x800F,0x8011,0x8013,0x801A,0x801B,0x801D,0x801E, +0x801F,0x8021,0x8023,0x8024,0x802B,0x802C,0x802D,0x802E, +0x802F,0x8030,0x8032,0x8034,0x8039,0x803A,0x803C,0x803E, +0x8040,0x8041,0x8044,0x8045,0x8047,0x8048,0x8049,0x804E, +0x804F,0x8050,0x8051,0x8053,0x8055,0x8056,0x8057, 0, +0x8059,0x805B,0x805C,0x805D,0x805E,0x805F,0x8060,0x8061, +0x8062,0x8063,0x8064,0x8065,0x8066,0x8067,0x8068,0x806B, +0x806C,0x806D,0x806E,0x806F,0x8070,0x8072,0x8073,0x8074, +0x8075,0x8076,0x8077,0x8078,0x8079,0x807A,0x807B,0x807C, +0x807D,0x9686,0x5784,0x62E2,0x9647,0x697C,0x5A04,0x6402, +0x7BD3,0x6F0F,0x964B,0x82A6,0x5362,0x9885,0x5E90,0x7089, +0x63B3,0x5364,0x864F,0x9C81,0x9E93,0x788C,0x9732,0x8DEF, +0x8D42,0x9E7F,0x6F5E,0x7984,0x5F55,0x9646,0x622E,0x9A74, +0x5415,0x94DD,0x4FA3,0x65C5,0x5C65,0x5C61,0x7F15,0x8651, +0x6C2F,0x5F8B,0x7387,0x6EE4,0x7EFF,0x5CE6,0x631B,0x5B6A, +0x6EE6,0x5375,0x4E71,0x63A0,0x7565,0x62A1,0x8F6E,0x4F26, +0x4ED1,0x6CA6,0x7EB6,0x8BBA,0x841D,0x87BA,0x7F57,0x903B, +0x9523,0x7BA9,0x9AA1,0x88F8,0x843D,0x6D1B,0x9A86,0x7EDC, +0x5988,0x9EBB,0x739B,0x7801,0x8682,0x9A6C,0x9A82,0x561B, +0x5417,0x57CB,0x4E70,0x9EA6,0x5356,0x8FC8,0x8109,0x7792, +0x9992,0x86EE,0x6EE1,0x8513,0x66FC,0x6162,0x6F2B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x807E,0x8081,0x8082,0x8085,0x8088,0x808A,0x808D,0x808E, +0x808F,0x8090,0x8091,0x8092,0x8094,0x8095,0x8097,0x8099, +0x809E,0x80A3,0x80A6,0x80A7,0x80A8,0x80AC,0x80B0,0x80B3, +0x80B5,0x80B6,0x80B8,0x80B9,0x80BB,0x80C5,0x80C7,0x80C8, +0x80C9,0x80CA,0x80CB,0x80CF,0x80D0,0x80D1,0x80D2,0x80D3, +0x80D4,0x80D5,0x80D8,0x80DF,0x80E0,0x80E2,0x80E3,0x80E6, +0x80EE,0x80F5,0x80F7,0x80F9,0x80FB,0x80FE,0x80FF,0x8100, +0x8101,0x8103,0x8104,0x8105,0x8107,0x8108,0x810B, 0, +0x810C,0x8115,0x8117,0x8119,0x811B,0x811C,0x811D,0x811F, +0x8120,0x8121,0x8122,0x8123,0x8124,0x8125,0x8126,0x8127, +0x8128,0x8129,0x812A,0x812B,0x812D,0x812E,0x8130,0x8133, +0x8134,0x8135,0x8137,0x8139,0x813A,0x813B,0x813C,0x813D, +0x813F,0x8C29,0x8292,0x832B,0x76F2,0x6C13,0x5FD9,0x83BD, +0x732B,0x8305,0x951A,0x6BDB,0x77DB,0x94C6,0x536F,0x8302, +0x5192,0x5E3D,0x8C8C,0x8D38,0x4E48,0x73AB,0x679A,0x6885, +0x9176,0x9709,0x7164,0x6CA1,0x7709,0x5A92,0x9541,0x6BCF, +0x7F8E,0x6627,0x5BD0,0x59B9,0x5A9A,0x95E8,0x95F7,0x4EEC, +0x840C,0x8499,0x6AAC,0x76DF,0x9530,0x731B,0x68A6,0x5B5F, +0x772F,0x919A,0x9761,0x7CDC,0x8FF7,0x8C1C,0x5F25,0x7C73, +0x79D8,0x89C5,0x6CCC,0x871C,0x5BC6,0x5E42,0x68C9,0x7720, +0x7EF5,0x5195,0x514D,0x52C9,0x5A29,0x7F05,0x9762,0x82D7, +0x63CF,0x7784,0x85D0,0x79D2,0x6E3A,0x5E99,0x5999,0x8511, +0x706D,0x6C11,0x62BF,0x76BF,0x654F,0x60AF,0x95FD,0x660E, +0x879F,0x9E23,0x94ED,0x540D,0x547D,0x8C2C,0x6478, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8140,0x8141,0x8142,0x8143,0x8144,0x8145,0x8147,0x8149, +0x814D,0x814E,0x814F,0x8152,0x8156,0x8157,0x8158,0x815B, +0x815C,0x815D,0x815E,0x815F,0x8161,0x8162,0x8163,0x8164, +0x8166,0x8168,0x816A,0x816B,0x816C,0x816F,0x8172,0x8173, +0x8175,0x8176,0x8177,0x8178,0x8181,0x8183,0x8184,0x8185, +0x8186,0x8187,0x8189,0x818B,0x818C,0x818D,0x818E,0x8190, +0x8192,0x8193,0x8194,0x8195,0x8196,0x8197,0x8199,0x819A, +0x819E,0x819F,0x81A0,0x81A1,0x81A2,0x81A4,0x81A5, 0, +0x81A7,0x81A9,0x81AB,0x81AC,0x81AD,0x81AE,0x81AF,0x81B0, +0x81B1,0x81B2,0x81B4,0x81B5,0x81B6,0x81B7,0x81B8,0x81B9, +0x81BC,0x81BD,0x81BE,0x81BF,0x81C4,0x81C5,0x81C7,0x81C8, +0x81C9,0x81CB,0x81CD,0x81CE,0x81CF,0x81D0,0x81D1,0x81D2, +0x81D3,0x6479,0x8611,0x6A21,0x819C,0x78E8,0x6469,0x9B54, +0x62B9,0x672B,0x83AB,0x58A8,0x9ED8,0x6CAB,0x6F20,0x5BDE, +0x964C,0x8C0B,0x725F,0x67D0,0x62C7,0x7261,0x4EA9,0x59C6, +0x6BCD,0x5893,0x66AE,0x5E55,0x52DF,0x6155,0x6728,0x76EE, +0x7766,0x7267,0x7A46,0x62FF,0x54EA,0x5450,0x94A0,0x90A3, +0x5A1C,0x7EB3,0x6C16,0x4E43,0x5976,0x8010,0x5948,0x5357, +0x7537,0x96BE,0x56CA,0x6320,0x8111,0x607C,0x95F9,0x6DD6, +0x5462,0x9981,0x5185,0x5AE9,0x80FD,0x59AE,0x9713,0x502A, +0x6CE5,0x5C3C,0x62DF,0x4F60,0x533F,0x817B,0x9006,0x6EBA, +0x852B,0x62C8,0x5E74,0x78BE,0x64B5,0x637B,0x5FF5,0x5A18, +0x917F,0x9E1F,0x5C3F,0x634F,0x8042,0x5B7D,0x556E,0x954A, +0x954D,0x6D85,0x60A8,0x67E0,0x72DE,0x51DD,0x5B81, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81D4,0x81D5,0x81D6,0x81D7,0x81D8,0x81D9,0x81DA,0x81DB, +0x81DC,0x81DD,0x81DE,0x81DF,0x81E0,0x81E1,0x81E2,0x81E4, +0x81E5,0x81E6,0x81E8,0x81E9,0x81EB,0x81EE,0x81EF,0x81F0, +0x81F1,0x81F2,0x81F5,0x81F6,0x81F7,0x81F8,0x81F9,0x81FA, +0x81FD,0x81FF,0x8203,0x8207,0x8208,0x8209,0x820A,0x820B, +0x820E,0x820F,0x8211,0x8213,0x8215,0x8216,0x8217,0x8218, +0x8219,0x821A,0x821D,0x8220,0x8224,0x8225,0x8226,0x8227, +0x8229,0x822E,0x8232,0x823A,0x823C,0x823D,0x823F, 0, +0x8240,0x8241,0x8242,0x8243,0x8245,0x8246,0x8248,0x824A, +0x824C,0x824D,0x824E,0x8250,0x8251,0x8252,0x8253,0x8254, +0x8255,0x8256,0x8257,0x8259,0x825B,0x825C,0x825D,0x825E, +0x8260,0x8261,0x8262,0x8263,0x8264,0x8265,0x8266,0x8267, +0x8269,0x62E7,0x6CDE,0x725B,0x626D,0x94AE,0x7EBD,0x8113, +0x6D53,0x519C,0x5F04,0x5974,0x52AA,0x6012,0x5973,0x6696, +0x8650,0x759F,0x632A,0x61E6,0x7CEF,0x8BFA,0x54E6,0x6B27, +0x9E25,0x6BB4,0x85D5,0x5455,0x5076,0x6CA4,0x556A,0x8DB4, +0x722C,0x5E15,0x6015,0x7436,0x62CD,0x6392,0x724C,0x5F98, +0x6E43,0x6D3E,0x6500,0x6F58,0x76D8,0x78D0,0x76FC,0x7554, +0x5224,0x53DB,0x4E53,0x5E9E,0x65C1,0x802A,0x80D6,0x629B, +0x5486,0x5228,0x70AE,0x888D,0x8DD1,0x6CE1,0x5478,0x80DA, +0x57F9,0x88F4,0x8D54,0x966A,0x914D,0x4F69,0x6C9B,0x55B7, +0x76C6,0x7830,0x62A8,0x70F9,0x6F8E,0x5F6D,0x84EC,0x68DA, +0x787C,0x7BF7,0x81A8,0x670B,0x9E4F,0x6367,0x78B0,0x576F, +0x7812,0x9739,0x6279,0x62AB,0x5288,0x7435,0x6BD7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x826A,0x826B,0x826C,0x826D,0x8271,0x8275,0x8276,0x8277, +0x8278,0x827B,0x827C,0x8280,0x8281,0x8283,0x8285,0x8286, +0x8287,0x8289,0x828C,0x8290,0x8293,0x8294,0x8295,0x8296, +0x829A,0x829B,0x829E,0x82A0,0x82A2,0x82A3,0x82A7,0x82B2, +0x82B5,0x82B6,0x82BA,0x82BB,0x82BC,0x82BF,0x82C0,0x82C2, +0x82C3,0x82C5,0x82C6,0x82C9,0x82D0,0x82D6,0x82D9,0x82DA, +0x82DD,0x82E2,0x82E7,0x82E8,0x82E9,0x82EA,0x82EC,0x82ED, +0x82EE,0x82F0,0x82F2,0x82F3,0x82F5,0x82F6,0x82F8, 0, +0x82FA,0x82FC,0x82FD,0x82FE,0x82FF,0x8300,0x830A,0x830B, +0x830D,0x8310,0x8312,0x8313,0x8316,0x8318,0x8319,0x831D, +0x831E,0x831F,0x8320,0x8321,0x8322,0x8323,0x8324,0x8325, +0x8326,0x8329,0x832A,0x832E,0x8330,0x8332,0x8337,0x833B, +0x833D,0x5564,0x813E,0x75B2,0x76AE,0x5339,0x75DE,0x50FB, +0x5C41,0x8B6C,0x7BC7,0x504F,0x7247,0x9A97,0x98D8,0x6F02, +0x74E2,0x7968,0x6487,0x77A5,0x62FC,0x9891,0x8D2B,0x54C1, +0x8058,0x4E52,0x576A,0x82F9,0x840D,0x5E73,0x51ED,0x74F6, +0x8BC4,0x5C4F,0x5761,0x6CFC,0x9887,0x5A46,0x7834,0x9B44, +0x8FEB,0x7C95,0x5256,0x6251,0x94FA,0x4EC6,0x8386,0x8461, +0x83E9,0x84B2,0x57D4,0x6734,0x5703,0x666E,0x6D66,0x8C31, +0x66DD,0x7011,0x671F,0x6B3A,0x6816,0x621A,0x59BB,0x4E03, +0x51C4,0x6F06,0x67D2,0x6C8F,0x5176,0x68CB,0x5947,0x6B67, +0x7566,0x5D0E,0x8110,0x9F50,0x65D7,0x7948,0x7941,0x9A91, +0x8D77,0x5C82,0x4E5E,0x4F01,0x542F,0x5951,0x780C,0x5668, +0x6C14,0x8FC4,0x5F03,0x6C7D,0x6CE3,0x8BAB,0x6390, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x833E,0x833F,0x8341,0x8342,0x8344,0x8345,0x8348,0x834A, +0x834B,0x834C,0x834D,0x834E,0x8353,0x8355,0x8356,0x8357, +0x8358,0x8359,0x835D,0x8362,0x8370,0x8371,0x8372,0x8373, +0x8374,0x8375,0x8376,0x8379,0x837A,0x837E,0x837F,0x8380, +0x8381,0x8382,0x8383,0x8384,0x8387,0x8388,0x838A,0x838B, +0x838C,0x838D,0x838F,0x8390,0x8391,0x8394,0x8395,0x8396, +0x8397,0x8399,0x839A,0x839D,0x839F,0x83A1,0x83A2,0x83A3, +0x83A4,0x83A5,0x83A6,0x83A7,0x83AC,0x83AD,0x83AE, 0, +0x83AF,0x83B5,0x83BB,0x83BE,0x83BF,0x83C2,0x83C3,0x83C4, +0x83C6,0x83C8,0x83C9,0x83CB,0x83CD,0x83CE,0x83D0,0x83D1, +0x83D2,0x83D3,0x83D5,0x83D7,0x83D9,0x83DA,0x83DB,0x83DE, +0x83E2,0x83E3,0x83E4,0x83E6,0x83E7,0x83E8,0x83EB,0x83EC, +0x83ED,0x6070,0x6D3D,0x7275,0x6266,0x948E,0x94C5,0x5343, +0x8FC1,0x7B7E,0x4EDF,0x8C26,0x4E7E,0x9ED4,0x94B1,0x94B3, +0x524D,0x6F5C,0x9063,0x6D45,0x8C34,0x5811,0x5D4C,0x6B20, +0x6B49,0x67AA,0x545B,0x8154,0x7F8C,0x5899,0x8537,0x5F3A, +0x62A2,0x6A47,0x9539,0x6572,0x6084,0x6865,0x77A7,0x4E54, +0x4FA8,0x5DE7,0x9798,0x64AC,0x7FD8,0x5CED,0x4FCF,0x7A8D, +0x5207,0x8304,0x4E14,0x602F,0x7A83,0x94A6,0x4FB5,0x4EB2, +0x79E6,0x7434,0x52E4,0x82B9,0x64D2,0x79BD,0x5BDD,0x6C81, +0x9752,0x8F7B,0x6C22,0x503E,0x537F,0x6E05,0x64CE,0x6674, +0x6C30,0x60C5,0x9877,0x8BF7,0x5E86,0x743C,0x7A77,0x79CB, +0x4E18,0x90B1,0x7403,0x6C42,0x56DA,0x914B,0x6CC5,0x8D8B, +0x533A,0x86C6,0x66F2,0x8EAF,0x5C48,0x9A71,0x6E20, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x83EE,0x83EF,0x83F3,0x83F4,0x83F5,0x83F6,0x83F7,0x83FA, +0x83FB,0x83FC,0x83FE,0x83FF,0x8400,0x8402,0x8405,0x8407, +0x8408,0x8409,0x840A,0x8410,0x8412,0x8413,0x8414,0x8415, +0x8416,0x8417,0x8419,0x841A,0x841B,0x841E,0x841F,0x8420, +0x8421,0x8422,0x8423,0x8429,0x842A,0x842B,0x842C,0x842D, +0x842E,0x842F,0x8430,0x8432,0x8433,0x8434,0x8435,0x8436, +0x8437,0x8439,0x843A,0x843B,0x843E,0x843F,0x8440,0x8441, +0x8442,0x8443,0x8444,0x8445,0x8447,0x8448,0x8449, 0, +0x844A,0x844B,0x844C,0x844D,0x844E,0x844F,0x8450,0x8452, +0x8453,0x8454,0x8455,0x8456,0x8458,0x845D,0x845E,0x845F, +0x8460,0x8462,0x8464,0x8465,0x8466,0x8467,0x8468,0x846A, +0x846E,0x846F,0x8470,0x8472,0x8474,0x8477,0x8479,0x847B, +0x847C,0x53D6,0x5A36,0x9F8B,0x8DA3,0x53BB,0x5708,0x98A7, +0x6743,0x919B,0x6CC9,0x5168,0x75CA,0x62F3,0x72AC,0x5238, +0x529D,0x7F3A,0x7094,0x7638,0x5374,0x9E4A,0x69B7,0x786E, +0x96C0,0x88D9,0x7FA4,0x7136,0x71C3,0x5189,0x67D3,0x74E4, +0x58E4,0x6518,0x56B7,0x8BA9,0x9976,0x6270,0x7ED5,0x60F9, +0x70ED,0x58EC,0x4EC1,0x4EBA,0x5FCD,0x97E7,0x4EFB,0x8BA4, +0x5203,0x598A,0x7EAB,0x6254,0x4ECD,0x65E5,0x620E,0x8338, +0x84C9,0x8363,0x878D,0x7194,0x6EB6,0x5BB9,0x7ED2,0x5197, +0x63C9,0x67D4,0x8089,0x8339,0x8815,0x5112,0x5B7A,0x5982, +0x8FB1,0x4E73,0x6C5D,0x5165,0x8925,0x8F6F,0x962E,0x854A, +0x745E,0x9510,0x95F0,0x6DA6,0x82E5,0x5F31,0x6492,0x6D12, +0x8428,0x816E,0x9CC3,0x585E,0x8D5B,0x4E09,0x53C1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x847D,0x847E,0x847F,0x8480,0x8481,0x8483,0x8484,0x8485, +0x8486,0x848A,0x848D,0x848F,0x8490,0x8491,0x8492,0x8493, +0x8494,0x8495,0x8496,0x8498,0x849A,0x849B,0x849D,0x849E, +0x849F,0x84A0,0x84A2,0x84A3,0x84A4,0x84A5,0x84A6,0x84A7, +0x84A8,0x84A9,0x84AA,0x84AB,0x84AC,0x84AD,0x84AE,0x84B0, +0x84B1,0x84B3,0x84B5,0x84B6,0x84B7,0x84BB,0x84BC,0x84BE, +0x84C0,0x84C2,0x84C3,0x84C5,0x84C6,0x84C7,0x84C8,0x84CB, +0x84CC,0x84CE,0x84CF,0x84D2,0x84D4,0x84D5,0x84D7, 0, +0x84D8,0x84D9,0x84DA,0x84DB,0x84DC,0x84DE,0x84E1,0x84E2, +0x84E4,0x84E7,0x84E8,0x84E9,0x84EA,0x84EB,0x84ED,0x84EE, +0x84EF,0x84F1,0x84F2,0x84F3,0x84F4,0x84F5,0x84F6,0x84F7, +0x84F8,0x84F9,0x84FA,0x84FB,0x84FD,0x84FE,0x8500,0x8501, +0x8502,0x4F1E,0x6563,0x6851,0x55D3,0x4E27,0x6414,0x9A9A, +0x626B,0x5AC2,0x745F,0x8272,0x6DA9,0x68EE,0x50E7,0x838E, +0x7802,0x6740,0x5239,0x6C99,0x7EB1,0x50BB,0x5565,0x715E, +0x7B5B,0x6652,0x73CA,0x82EB,0x6749,0x5C71,0x5220,0x717D, +0x886B,0x95EA,0x9655,0x64C5,0x8D61,0x81B3,0x5584,0x6C55, +0x6247,0x7F2E,0x5892,0x4F24,0x5546,0x8D4F,0x664C,0x4E0A, +0x5C1A,0x88F3,0x68A2,0x634E,0x7A0D,0x70E7,0x828D,0x52FA, +0x97F6,0x5C11,0x54E8,0x90B5,0x7ECD,0x5962,0x8D4A,0x86C7, +0x820C,0x820D,0x8D66,0x6444,0x5C04,0x6151,0x6D89,0x793E, +0x8BBE,0x7837,0x7533,0x547B,0x4F38,0x8EAB,0x6DF1,0x5A20, +0x7EC5,0x795E,0x6C88,0x5BA1,0x5A76,0x751A,0x80BE,0x614E, +0x6E17,0x58F0,0x751F,0x7525,0x7272,0x5347,0x7EF3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8503,0x8504,0x8505,0x8506,0x8507,0x8508,0x8509,0x850A, +0x850B,0x850D,0x850E,0x850F,0x8510,0x8512,0x8514,0x8515, +0x8516,0x8518,0x8519,0x851B,0x851C,0x851D,0x851E,0x8520, +0x8522,0x8523,0x8524,0x8525,0x8526,0x8527,0x8528,0x8529, +0x852A,0x852D,0x852E,0x852F,0x8530,0x8531,0x8532,0x8533, +0x8534,0x8535,0x8536,0x853E,0x853F,0x8540,0x8541,0x8542, +0x8544,0x8545,0x8546,0x8547,0x854B,0x854C,0x854D,0x854E, +0x854F,0x8550,0x8551,0x8552,0x8553,0x8554,0x8555, 0, +0x8557,0x8558,0x855A,0x855B,0x855C,0x855D,0x855F,0x8560, +0x8561,0x8562,0x8563,0x8565,0x8566,0x8567,0x8569,0x856A, +0x856B,0x856C,0x856D,0x856E,0x856F,0x8570,0x8571,0x8573, +0x8575,0x8576,0x8577,0x8578,0x857C,0x857D,0x857F,0x8580, +0x8581,0x7701,0x76DB,0x5269,0x80DC,0x5723,0x5E08,0x5931, +0x72EE,0x65BD,0x6E7F,0x8BD7,0x5C38,0x8671,0x5341,0x77F3, +0x62FE,0x65F6,0x4EC0,0x98DF,0x8680,0x5B9E,0x8BC6,0x53F2, +0x77E2,0x4F7F,0x5C4E,0x9A76,0x59CB,0x5F0F,0x793A,0x58EB, +0x4E16,0x67FF,0x4E8B,0x62ED,0x8A93,0x901D,0x52BF,0x662F, +0x55DC,0x566C,0x9002,0x4ED5,0x4F8D,0x91CA,0x9970,0x6C0F, +0x5E02,0x6043,0x5BA4,0x89C6,0x8BD5,0x6536,0x624B,0x9996, +0x5B88,0x5BFF,0x6388,0x552E,0x53D7,0x7626,0x517D,0x852C, +0x67A2,0x68B3,0x6B8A,0x6292,0x8F93,0x53D4,0x8212,0x6DD1, +0x758F,0x4E66,0x8D4E,0x5B70,0x719F,0x85AF,0x6691,0x66D9, +0x7F72,0x8700,0x9ECD,0x9F20,0x5C5E,0x672F,0x8FF0,0x6811, +0x675F,0x620D,0x7AD6,0x5885,0x5EB6,0x6570,0x6F31, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8582,0x8583,0x8586,0x8588,0x8589,0x858A,0x858B,0x858C, +0x858D,0x858E,0x8590,0x8591,0x8592,0x8593,0x8594,0x8595, +0x8596,0x8597,0x8598,0x8599,0x859A,0x859D,0x859E,0x859F, +0x85A0,0x85A1,0x85A2,0x85A3,0x85A5,0x85A6,0x85A7,0x85A9, +0x85AB,0x85AC,0x85AD,0x85B1,0x85B2,0x85B3,0x85B4,0x85B5, +0x85B6,0x85B8,0x85BA,0x85BB,0x85BC,0x85BD,0x85BE,0x85BF, +0x85C0,0x85C2,0x85C3,0x85C4,0x85C5,0x85C6,0x85C7,0x85C8, +0x85CA,0x85CB,0x85CC,0x85CD,0x85CE,0x85D1,0x85D2, 0, +0x85D4,0x85D6,0x85D7,0x85D8,0x85D9,0x85DA,0x85DB,0x85DD, +0x85DE,0x85DF,0x85E0,0x85E1,0x85E2,0x85E3,0x85E5,0x85E6, +0x85E7,0x85E8,0x85EA,0x85EB,0x85EC,0x85ED,0x85EE,0x85EF, +0x85F0,0x85F1,0x85F2,0x85F3,0x85F4,0x85F5,0x85F6,0x85F7, +0x85F8,0x6055,0x5237,0x800D,0x6454,0x8870,0x7529,0x5E05, +0x6813,0x62F4,0x971C,0x53CC,0x723D,0x8C01,0x6C34,0x7761, +0x7A0E,0x542E,0x77AC,0x987A,0x821C,0x8BF4,0x7855,0x6714, +0x70C1,0x65AF,0x6495,0x5636,0x601D,0x79C1,0x53F8,0x4E1D, +0x6B7B,0x8086,0x5BFA,0x55E3,0x56DB,0x4F3A,0x4F3C,0x9972, +0x5DF3,0x677E,0x8038,0x6002,0x9882,0x9001,0x5B8B,0x8BBC, +0x8BF5,0x641C,0x8258,0x64DE,0x55FD,0x82CF,0x9165,0x4FD7, +0x7D20,0x901F,0x7C9F,0x50F3,0x5851,0x6EAF,0x5BBF,0x8BC9, +0x8083,0x9178,0x849C,0x7B97,0x867D,0x968B,0x968F,0x7EE5, +0x9AD3,0x788E,0x5C81,0x7A57,0x9042,0x96A7,0x795F,0x5B59, +0x635F,0x7B0B,0x84D1,0x68AD,0x5506,0x7F29,0x7410,0x7D22, +0x9501,0x6240,0x584C,0x4ED6,0x5B83,0x5979,0x5854, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x85F9,0x85FA,0x85FC,0x85FD,0x85FE,0x8600,0x8601,0x8602, +0x8603,0x8604,0x8606,0x8607,0x8608,0x8609,0x860A,0x860B, +0x860C,0x860D,0x860E,0x860F,0x8610,0x8612,0x8613,0x8614, +0x8615,0x8617,0x8618,0x8619,0x861A,0x861B,0x861C,0x861D, +0x861E,0x861F,0x8620,0x8621,0x8622,0x8623,0x8624,0x8625, +0x8626,0x8628,0x862A,0x862B,0x862C,0x862D,0x862E,0x862F, +0x8630,0x8631,0x8632,0x8633,0x8634,0x8635,0x8636,0x8637, +0x8639,0x863A,0x863B,0x863D,0x863E,0x863F,0x8640, 0, +0x8641,0x8642,0x8643,0x8644,0x8645,0x8646,0x8647,0x8648, +0x8649,0x864A,0x864B,0x864C,0x8652,0x8653,0x8655,0x8656, +0x8657,0x8658,0x8659,0x865B,0x865C,0x865D,0x865F,0x8660, +0x8661,0x8663,0x8664,0x8665,0x8666,0x8667,0x8668,0x8669, +0x866A,0x736D,0x631E,0x8E4B,0x8E0F,0x80CE,0x82D4,0x62AC, +0x53F0,0x6CF0,0x915E,0x592A,0x6001,0x6C70,0x574D,0x644A, +0x8D2A,0x762B,0x6EE9,0x575B,0x6A80,0x75F0,0x6F6D,0x8C2D, +0x8C08,0x5766,0x6BEF,0x8892,0x78B3,0x63A2,0x53F9,0x70AD, +0x6C64,0x5858,0x642A,0x5802,0x68E0,0x819B,0x5510,0x7CD6, +0x5018,0x8EBA,0x6DCC,0x8D9F,0x70EB,0x638F,0x6D9B,0x6ED4, +0x7EE6,0x8404,0x6843,0x9003,0x6DD8,0x9676,0x8BA8,0x5957, +0x7279,0x85E4,0x817E,0x75BC,0x8A8A,0x68AF,0x5254,0x8E22, +0x9511,0x63D0,0x9898,0x8E44,0x557C,0x4F53,0x66FF,0x568F, +0x60D5,0x6D95,0x5243,0x5C49,0x5929,0x6DFB,0x586B,0x7530, +0x751C,0x606C,0x8214,0x8146,0x6311,0x6761,0x8FE2,0x773A, +0x8DF3,0x8D34,0x94C1,0x5E16,0x5385,0x542C,0x70C3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x866D,0x866F,0x8670,0x8672,0x8673,0x8674,0x8675,0x8676, +0x8677,0x8678,0x8683,0x8684,0x8685,0x8686,0x8687,0x8688, +0x8689,0x868E,0x868F,0x8690,0x8691,0x8692,0x8694,0x8696, +0x8697,0x8698,0x8699,0x869A,0x869B,0x869E,0x869F,0x86A0, +0x86A1,0x86A2,0x86A5,0x86A6,0x86AB,0x86AD,0x86AE,0x86B2, +0x86B3,0x86B7,0x86B8,0x86B9,0x86BB,0x86BC,0x86BD,0x86BE, +0x86BF,0x86C1,0x86C2,0x86C3,0x86C5,0x86C8,0x86CC,0x86CD, +0x86D2,0x86D3,0x86D5,0x86D6,0x86D7,0x86DA,0x86DC, 0, +0x86DD,0x86E0,0x86E1,0x86E2,0x86E3,0x86E5,0x86E6,0x86E7, +0x86E8,0x86EA,0x86EB,0x86EC,0x86EF,0x86F5,0x86F6,0x86F7, +0x86FA,0x86FB,0x86FC,0x86FD,0x86FF,0x8701,0x8704,0x8705, +0x8706,0x870B,0x870C,0x870E,0x870F,0x8710,0x8711,0x8714, +0x8716,0x6C40,0x5EF7,0x505C,0x4EAD,0x5EAD,0x633A,0x8247, +0x901A,0x6850,0x916E,0x77B3,0x540C,0x94DC,0x5F64,0x7AE5, +0x6876,0x6345,0x7B52,0x7EDF,0x75DB,0x5077,0x6295,0x5934, +0x900F,0x51F8,0x79C3,0x7A81,0x56FE,0x5F92,0x9014,0x6D82, +0x5C60,0x571F,0x5410,0x5154,0x6E4D,0x56E2,0x63A8,0x9893, +0x817F,0x8715,0x892A,0x9000,0x541E,0x5C6F,0x81C0,0x62D6, +0x6258,0x8131,0x9E35,0x9640,0x9A6E,0x9A7C,0x692D,0x59A5, +0x62D3,0x553E,0x6316,0x54C7,0x86D9,0x6D3C,0x5A03,0x74E6, +0x889C,0x6B6A,0x5916,0x8C4C,0x5F2F,0x6E7E,0x73A9,0x987D, +0x4E38,0x70F7,0x5B8C,0x7897,0x633D,0x665A,0x7696,0x60CB, +0x5B9B,0x5A49,0x4E07,0x8155,0x6C6A,0x738B,0x4EA1,0x6789, +0x7F51,0x5F80,0x65FA,0x671B,0x5FD8,0x5984,0x5A01, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8719,0x871B,0x871D,0x871F,0x8720,0x8724,0x8726,0x8727, +0x8728,0x872A,0x872B,0x872C,0x872D,0x872F,0x8730,0x8732, +0x8733,0x8735,0x8736,0x8738,0x8739,0x873A,0x873C,0x873D, +0x8740,0x8741,0x8742,0x8743,0x8744,0x8745,0x8746,0x874A, +0x874B,0x874D,0x874F,0x8750,0x8751,0x8752,0x8754,0x8755, +0x8756,0x8758,0x875A,0x875B,0x875C,0x875D,0x875E,0x875F, +0x8761,0x8762,0x8766,0x8767,0x8768,0x8769,0x876A,0x876B, +0x876C,0x876D,0x876F,0x8771,0x8772,0x8773,0x8775, 0, +0x8777,0x8778,0x8779,0x877A,0x877F,0x8780,0x8781,0x8784, +0x8786,0x8787,0x8789,0x878A,0x878C,0x878E,0x878F,0x8790, +0x8791,0x8792,0x8794,0x8795,0x8796,0x8798,0x8799,0x879A, +0x879B,0x879C,0x879D,0x879E,0x87A0,0x87A1,0x87A2,0x87A3, +0x87A4,0x5DCD,0x5FAE,0x5371,0x97E6,0x8FDD,0x6845,0x56F4, +0x552F,0x60DF,0x4E3A,0x6F4D,0x7EF4,0x82C7,0x840E,0x59D4, +0x4F1F,0x4F2A,0x5C3E,0x7EAC,0x672A,0x851A,0x5473,0x754F, +0x80C3,0x5582,0x9B4F,0x4F4D,0x6E2D,0x8C13,0x5C09,0x6170, +0x536B,0x761F,0x6E29,0x868A,0x6587,0x95FB,0x7EB9,0x543B, +0x7A33,0x7D0A,0x95EE,0x55E1,0x7FC1,0x74EE,0x631D,0x8717, +0x6DA1,0x7A9D,0x6211,0x65A1,0x5367,0x63E1,0x6C83,0x5DEB, +0x545C,0x94A8,0x4E4C,0x6C61,0x8BEC,0x5C4B,0x65E0,0x829C, +0x68A7,0x543E,0x5434,0x6BCB,0x6B66,0x4E94,0x6342,0x5348, +0x821E,0x4F0D,0x4FAE,0x575E,0x620A,0x96FE,0x6664,0x7269, +0x52FF,0x52A1,0x609F,0x8BEF,0x6614,0x7199,0x6790,0x897F, +0x7852,0x77FD,0x6670,0x563B,0x5438,0x9521,0x727A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x87A5,0x87A6,0x87A7,0x87A9,0x87AA,0x87AE,0x87B0,0x87B1, +0x87B2,0x87B4,0x87B6,0x87B7,0x87B8,0x87B9,0x87BB,0x87BC, +0x87BE,0x87BF,0x87C1,0x87C2,0x87C3,0x87C4,0x87C5,0x87C7, +0x87C8,0x87C9,0x87CC,0x87CD,0x87CE,0x87CF,0x87D0,0x87D4, +0x87D5,0x87D6,0x87D7,0x87D8,0x87D9,0x87DA,0x87DC,0x87DD, +0x87DE,0x87DF,0x87E1,0x87E2,0x87E3,0x87E4,0x87E6,0x87E7, +0x87E8,0x87E9,0x87EB,0x87EC,0x87ED,0x87EF,0x87F0,0x87F1, +0x87F2,0x87F3,0x87F4,0x87F5,0x87F6,0x87F7,0x87F8, 0, +0x87FA,0x87FB,0x87FC,0x87FD,0x87FF,0x8800,0x8801,0x8802, +0x8804,0x8805,0x8806,0x8807,0x8808,0x8809,0x880B,0x880C, +0x880D,0x880E,0x880F,0x8810,0x8811,0x8812,0x8814,0x8817, +0x8818,0x8819,0x881A,0x881C,0x881D,0x881E,0x881F,0x8820, +0x8823,0x7A00,0x606F,0x5E0C,0x6089,0x819D,0x5915,0x60DC, +0x7184,0x70EF,0x6EAA,0x6C50,0x7280,0x6A84,0x88AD,0x5E2D, +0x4E60,0x5AB3,0x559C,0x94E3,0x6D17,0x7CFB,0x9699,0x620F, +0x7EC6,0x778E,0x867E,0x5323,0x971E,0x8F96,0x6687,0x5CE1, +0x4FA0,0x72ED,0x4E0B,0x53A6,0x590F,0x5413,0x6380,0x9528, +0x5148,0x4ED9,0x9C9C,0x7EA4,0x54B8,0x8D24,0x8854,0x8237, +0x95F2,0x6D8E,0x5F26,0x5ACC,0x663E,0x9669,0x73B0,0x732E, +0x53BF,0x817A,0x9985,0x7FA1,0x5BAA,0x9677,0x9650,0x7EBF, +0x76F8,0x53A2,0x9576,0x9999,0x7BB1,0x8944,0x6E58,0x4E61, +0x7FD4,0x7965,0x8BE6,0x60F3,0x54CD,0x4EAB,0x9879,0x5DF7, +0x6A61,0x50CF,0x5411,0x8C61,0x8427,0x785D,0x9704,0x524A, +0x54EE,0x56A3,0x9500,0x6D88,0x5BB5,0x6DC6,0x6653, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8824,0x8825,0x8826,0x8827,0x8828,0x8829,0x882A,0x882B, +0x882C,0x882D,0x882E,0x882F,0x8830,0x8831,0x8833,0x8834, +0x8835,0x8836,0x8837,0x8838,0x883A,0x883B,0x883D,0x883E, +0x883F,0x8841,0x8842,0x8843,0x8846,0x8847,0x8848,0x8849, +0x884A,0x884B,0x884E,0x884F,0x8850,0x8851,0x8852,0x8853, +0x8855,0x8856,0x8858,0x885A,0x885B,0x885C,0x885D,0x885E, +0x885F,0x8860,0x8866,0x8867,0x886A,0x886D,0x886F,0x8871, +0x8873,0x8874,0x8875,0x8876,0x8878,0x8879,0x887A, 0, +0x887B,0x887C,0x8880,0x8883,0x8886,0x8887,0x8889,0x888A, +0x888C,0x888E,0x888F,0x8890,0x8891,0x8893,0x8894,0x8895, +0x8897,0x8898,0x8899,0x889A,0x889B,0x889D,0x889E,0x889F, +0x88A0,0x88A1,0x88A3,0x88A5,0x88A6,0x88A7,0x88A8,0x88A9, +0x88AA,0x5C0F,0x5B5D,0x6821,0x8096,0x5578,0x7B11,0x6548, +0x6954,0x4E9B,0x6B47,0x874E,0x978B,0x534F,0x631F,0x643A, +0x90AA,0x659C,0x80C1,0x8C10,0x5199,0x68B0,0x5378,0x87F9, +0x61C8,0x6CC4,0x6CFB,0x8C22,0x5C51,0x85AA,0x82AF,0x950C, +0x6B23,0x8F9B,0x65B0,0x5FFB,0x5FC3,0x4FE1,0x8845,0x661F, +0x8165,0x7329,0x60FA,0x5174,0x5211,0x578B,0x5F62,0x90A2, +0x884C,0x9192,0x5E78,0x674F,0x6027,0x59D3,0x5144,0x51F6, +0x80F8,0x5308,0x6C79,0x96C4,0x718A,0x4F11,0x4FEE,0x7F9E, +0x673D,0x55C5,0x9508,0x79C0,0x8896,0x7EE3,0x589F,0x620C, +0x9700,0x865A,0x5618,0x987B,0x5F90,0x8BB8,0x84C4,0x9157, +0x53D9,0x65ED,0x5E8F,0x755C,0x6064,0x7D6E,0x5A7F,0x7EEA, +0x7EED,0x8F69,0x55A7,0x5BA3,0x60AC,0x65CB,0x7384, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x88AC,0x88AE,0x88AF,0x88B0,0x88B2,0x88B3,0x88B4,0x88B5, +0x88B6,0x88B8,0x88B9,0x88BA,0x88BB,0x88BD,0x88BE,0x88BF, +0x88C0,0x88C3,0x88C4,0x88C7,0x88C8,0x88CA,0x88CB,0x88CC, +0x88CD,0x88CF,0x88D0,0x88D1,0x88D3,0x88D6,0x88D7,0x88DA, +0x88DB,0x88DC,0x88DD,0x88DE,0x88E0,0x88E1,0x88E6,0x88E7, +0x88E9,0x88EA,0x88EB,0x88EC,0x88ED,0x88EE,0x88EF,0x88F2, +0x88F5,0x88F6,0x88F7,0x88FA,0x88FB,0x88FD,0x88FF,0x8900, +0x8901,0x8903,0x8904,0x8905,0x8906,0x8907,0x8908, 0, +0x8909,0x890B,0x890C,0x890D,0x890E,0x890F,0x8911,0x8914, +0x8915,0x8916,0x8917,0x8918,0x891C,0x891D,0x891E,0x891F, +0x8920,0x8922,0x8923,0x8924,0x8926,0x8927,0x8928,0x8929, +0x892C,0x892D,0x892E,0x892F,0x8931,0x8932,0x8933,0x8935, +0x8937,0x9009,0x7663,0x7729,0x7EDA,0x9774,0x859B,0x5B66, +0x7A74,0x96EA,0x8840,0x52CB,0x718F,0x5FAA,0x65EC,0x8BE2, +0x5BFB,0x9A6F,0x5DE1,0x6B89,0x6C5B,0x8BAD,0x8BAF,0x900A, +0x8FC5,0x538B,0x62BC,0x9E26,0x9E2D,0x5440,0x4E2B,0x82BD, +0x7259,0x869C,0x5D16,0x8859,0x6DAF,0x96C5,0x54D1,0x4E9A, +0x8BB6,0x7109,0x54BD,0x9609,0x70DF,0x6DF9,0x76D0,0x4E25, +0x7814,0x8712,0x5CA9,0x5EF6,0x8A00,0x989C,0x960E,0x708E, +0x6CBF,0x5944,0x63A9,0x773C,0x884D,0x6F14,0x8273,0x5830, +0x71D5,0x538C,0x781A,0x96C1,0x5501,0x5F66,0x7130,0x5BB4, +0x8C1A,0x9A8C,0x6B83,0x592E,0x9E2F,0x79E7,0x6768,0x626C, +0x4F6F,0x75A1,0x7F8A,0x6D0B,0x9633,0x6C27,0x4EF0,0x75D2, +0x517B,0x6837,0x6F3E,0x9080,0x8170,0x5996,0x7476, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8938,0x8939,0x893A,0x893B,0x893C,0x893D,0x893E,0x893F, +0x8940,0x8942,0x8943,0x8945,0x8946,0x8947,0x8948,0x8949, +0x894A,0x894B,0x894C,0x894D,0x894E,0x894F,0x8950,0x8951, +0x8952,0x8953,0x8954,0x8955,0x8956,0x8957,0x8958,0x8959, +0x895A,0x895B,0x895C,0x895D,0x8960,0x8961,0x8962,0x8963, +0x8964,0x8965,0x8967,0x8968,0x8969,0x896A,0x896B,0x896C, +0x896D,0x896E,0x896F,0x8970,0x8971,0x8972,0x8973,0x8974, +0x8975,0x8976,0x8977,0x8978,0x8979,0x897A,0x897C, 0, +0x897D,0x897E,0x8980,0x8982,0x8984,0x8985,0x8987,0x8988, +0x8989,0x898A,0x898B,0x898C,0x898D,0x898E,0x898F,0x8990, +0x8991,0x8992,0x8993,0x8994,0x8995,0x8996,0x8997,0x8998, +0x8999,0x899A,0x899B,0x899C,0x899D,0x899E,0x899F,0x89A0, +0x89A1,0x6447,0x5C27,0x9065,0x7A91,0x8C23,0x59DA,0x54AC, +0x8200,0x836F,0x8981,0x8000,0x6930,0x564E,0x8036,0x7237, +0x91CE,0x51B6,0x4E5F,0x9875,0x6396,0x4E1A,0x53F6,0x66F3, +0x814B,0x591C,0x6DB2,0x4E00,0x58F9,0x533B,0x63D6,0x94F1, +0x4F9D,0x4F0A,0x8863,0x9890,0x5937,0x9057,0x79FB,0x4EEA, +0x80F0,0x7591,0x6C82,0x5B9C,0x59E8,0x5F5D,0x6905,0x8681, +0x501A,0x5DF2,0x4E59,0x77E3,0x4EE5,0x827A,0x6291,0x6613, +0x9091,0x5C79,0x4EBF,0x5F79,0x81C6,0x9038,0x8084,0x75AB, +0x4EA6,0x88D4,0x610F,0x6BC5,0x5FC6,0x4E49,0x76CA,0x6EA2, +0x8BE3,0x8BAE,0x8C0A,0x8BD1,0x5F02,0x7FFC,0x7FCC,0x7ECE, +0x8335,0x836B,0x56E0,0x6BB7,0x97F3,0x9634,0x59FB,0x541F, +0x94F6,0x6DEB,0x5BC5,0x996E,0x5C39,0x5F15,0x9690, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x89A2,0x89A3,0x89A4,0x89A5,0x89A6,0x89A7,0x89A8,0x89A9, +0x89AA,0x89AB,0x89AC,0x89AD,0x89AE,0x89AF,0x89B0,0x89B1, +0x89B2,0x89B3,0x89B4,0x89B5,0x89B6,0x89B7,0x89B8,0x89B9, +0x89BA,0x89BB,0x89BC,0x89BD,0x89BE,0x89BF,0x89C0,0x89C3, +0x89CD,0x89D3,0x89D4,0x89D5,0x89D7,0x89D8,0x89D9,0x89DB, +0x89DD,0x89DF,0x89E0,0x89E1,0x89E2,0x89E4,0x89E7,0x89E8, +0x89E9,0x89EA,0x89EC,0x89ED,0x89EE,0x89F0,0x89F1,0x89F2, +0x89F4,0x89F5,0x89F6,0x89F7,0x89F8,0x89F9,0x89FA, 0, +0x89FB,0x89FC,0x89FD,0x89FE,0x89FF,0x8A01,0x8A02,0x8A03, +0x8A04,0x8A05,0x8A06,0x8A08,0x8A09,0x8A0A,0x8A0B,0x8A0C, +0x8A0D,0x8A0E,0x8A0F,0x8A10,0x8A11,0x8A12,0x8A13,0x8A14, +0x8A15,0x8A16,0x8A17,0x8A18,0x8A19,0x8A1A,0x8A1B,0x8A1C, +0x8A1D,0x5370,0x82F1,0x6A31,0x5A74,0x9E70,0x5E94,0x7F28, +0x83B9,0x8424,0x8425,0x8367,0x8747,0x8FCE,0x8D62,0x76C8, +0x5F71,0x9896,0x786C,0x6620,0x54DF,0x62E5,0x4F63,0x81C3, +0x75C8,0x5EB8,0x96CD,0x8E0A,0x86F9,0x548F,0x6CF3,0x6D8C, +0x6C38,0x607F,0x52C7,0x7528,0x5E7D,0x4F18,0x60A0,0x5FE7, +0x5C24,0x7531,0x90AE,0x94C0,0x72B9,0x6CB9,0x6E38,0x9149, +0x6709,0x53CB,0x53F3,0x4F51,0x91C9,0x8BF1,0x53C8,0x5E7C, +0x8FC2,0x6DE4,0x4E8E,0x76C2,0x6986,0x865E,0x611A,0x8206, +0x4F59,0x4FDE,0x903E,0x9C7C,0x6109,0x6E1D,0x6E14,0x9685, +0x4E88,0x5A31,0x96E8,0x4E0E,0x5C7F,0x79B9,0x5B87,0x8BED, +0x7FBD,0x7389,0x57DF,0x828B,0x90C1,0x5401,0x9047,0x55BB, +0x5CEA,0x5FA1,0x6108,0x6B32,0x72F1,0x80B2,0x8A89, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8A1E,0x8A1F,0x8A20,0x8A21,0x8A22,0x8A23,0x8A24,0x8A25, +0x8A26,0x8A27,0x8A28,0x8A29,0x8A2A,0x8A2B,0x8A2C,0x8A2D, +0x8A2E,0x8A2F,0x8A30,0x8A31,0x8A32,0x8A33,0x8A34,0x8A35, +0x8A36,0x8A37,0x8A38,0x8A39,0x8A3A,0x8A3B,0x8A3C,0x8A3D, +0x8A3F,0x8A40,0x8A41,0x8A42,0x8A43,0x8A44,0x8A45,0x8A46, +0x8A47,0x8A49,0x8A4A,0x8A4B,0x8A4C,0x8A4D,0x8A4E,0x8A4F, +0x8A50,0x8A51,0x8A52,0x8A53,0x8A54,0x8A55,0x8A56,0x8A57, +0x8A58,0x8A59,0x8A5A,0x8A5B,0x8A5C,0x8A5D,0x8A5E, 0, +0x8A5F,0x8A60,0x8A61,0x8A62,0x8A63,0x8A64,0x8A65,0x8A66, +0x8A67,0x8A68,0x8A69,0x8A6A,0x8A6B,0x8A6C,0x8A6D,0x8A6E, +0x8A6F,0x8A70,0x8A71,0x8A72,0x8A73,0x8A74,0x8A75,0x8A76, +0x8A77,0x8A78,0x8A7A,0x8A7B,0x8A7C,0x8A7D,0x8A7E,0x8A7F, +0x8A80,0x6D74,0x5BD3,0x88D5,0x9884,0x8C6B,0x9A6D,0x9E33, +0x6E0A,0x51A4,0x5143,0x57A3,0x8881,0x539F,0x63F4,0x8F95, +0x56ED,0x5458,0x5706,0x733F,0x6E90,0x7F18,0x8FDC,0x82D1, +0x613F,0x6028,0x9662,0x66F0,0x7EA6,0x8D8A,0x8DC3,0x94A5, +0x5CB3,0x7CA4,0x6708,0x60A6,0x9605,0x8018,0x4E91,0x90E7, +0x5300,0x9668,0x5141,0x8FD0,0x8574,0x915D,0x6655,0x97F5, +0x5B55,0x531D,0x7838,0x6742,0x683D,0x54C9,0x707E,0x5BB0, +0x8F7D,0x518D,0x5728,0x54B1,0x6512,0x6682,0x8D5E,0x8D43, +0x810F,0x846C,0x906D,0x7CDF,0x51FF,0x85FB,0x67A3,0x65E9, +0x6FA1,0x86A4,0x8E81,0x566A,0x9020,0x7682,0x7076,0x71E5, +0x8D23,0x62E9,0x5219,0x6CFD,0x8D3C,0x600E,0x589E,0x618E, +0x66FE,0x8D60,0x624E,0x55B3,0x6E23,0x672D,0x8F67, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8A81,0x8A82,0x8A83,0x8A84,0x8A85,0x8A86,0x8A87,0x8A88, +0x8A8B,0x8A8C,0x8A8D,0x8A8E,0x8A8F,0x8A90,0x8A91,0x8A92, +0x8A94,0x8A95,0x8A96,0x8A97,0x8A98,0x8A99,0x8A9A,0x8A9B, +0x8A9C,0x8A9D,0x8A9E,0x8A9F,0x8AA0,0x8AA1,0x8AA2,0x8AA3, +0x8AA4,0x8AA5,0x8AA6,0x8AA7,0x8AA8,0x8AA9,0x8AAA,0x8AAB, +0x8AAC,0x8AAD,0x8AAE,0x8AAF,0x8AB0,0x8AB1,0x8AB2,0x8AB3, +0x8AB4,0x8AB5,0x8AB6,0x8AB7,0x8AB8,0x8AB9,0x8ABA,0x8ABB, +0x8ABC,0x8ABD,0x8ABE,0x8ABF,0x8AC0,0x8AC1,0x8AC2, 0, +0x8AC3,0x8AC4,0x8AC5,0x8AC6,0x8AC7,0x8AC8,0x8AC9,0x8ACA, +0x8ACB,0x8ACC,0x8ACD,0x8ACE,0x8ACF,0x8AD0,0x8AD1,0x8AD2, +0x8AD3,0x8AD4,0x8AD5,0x8AD6,0x8AD7,0x8AD8,0x8AD9,0x8ADA, +0x8ADB,0x8ADC,0x8ADD,0x8ADE,0x8ADF,0x8AE0,0x8AE1,0x8AE2, +0x8AE3,0x94E1,0x95F8,0x7728,0x6805,0x69A8,0x548B,0x4E4D, +0x70B8,0x8BC8,0x6458,0x658B,0x5B85,0x7A84,0x503A,0x5BE8, +0x77BB,0x6BE1,0x8A79,0x7C98,0x6CBE,0x76CF,0x65A9,0x8F97, +0x5D2D,0x5C55,0x8638,0x6808,0x5360,0x6218,0x7AD9,0x6E5B, +0x7EFD,0x6A1F,0x7AE0,0x5F70,0x6F33,0x5F20,0x638C,0x6DA8, +0x6756,0x4E08,0x5E10,0x8D26,0x4ED7,0x80C0,0x7634,0x969C, +0x62DB,0x662D,0x627E,0x6CBC,0x8D75,0x7167,0x7F69,0x5146, +0x8087,0x53EC,0x906E,0x6298,0x54F2,0x86F0,0x8F99,0x8005, +0x9517,0x8517,0x8FD9,0x6D59,0x73CD,0x659F,0x771F,0x7504, +0x7827,0x81FB,0x8D1E,0x9488,0x4FA6,0x6795,0x75B9,0x8BCA, +0x9707,0x632F,0x9547,0x9635,0x84B8,0x6323,0x7741,0x5F81, +0x72F0,0x4E89,0x6014,0x6574,0x62EF,0x6B63,0x653F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8AE4,0x8AE5,0x8AE6,0x8AE7,0x8AE8,0x8AE9,0x8AEA,0x8AEB, +0x8AEC,0x8AED,0x8AEE,0x8AEF,0x8AF0,0x8AF1,0x8AF2,0x8AF3, +0x8AF4,0x8AF5,0x8AF6,0x8AF7,0x8AF8,0x8AF9,0x8AFA,0x8AFB, +0x8AFC,0x8AFD,0x8AFE,0x8AFF,0x8B00,0x8B01,0x8B02,0x8B03, +0x8B04,0x8B05,0x8B06,0x8B08,0x8B09,0x8B0A,0x8B0B,0x8B0C, +0x8B0D,0x8B0E,0x8B0F,0x8B10,0x8B11,0x8B12,0x8B13,0x8B14, +0x8B15,0x8B16,0x8B17,0x8B18,0x8B19,0x8B1A,0x8B1B,0x8B1C, +0x8B1D,0x8B1E,0x8B1F,0x8B20,0x8B21,0x8B22,0x8B23, 0, +0x8B24,0x8B25,0x8B27,0x8B28,0x8B29,0x8B2A,0x8B2B,0x8B2C, +0x8B2D,0x8B2E,0x8B2F,0x8B30,0x8B31,0x8B32,0x8B33,0x8B34, +0x8B35,0x8B36,0x8B37,0x8B38,0x8B39,0x8B3A,0x8B3B,0x8B3C, +0x8B3D,0x8B3E,0x8B3F,0x8B40,0x8B41,0x8B42,0x8B43,0x8B44, +0x8B45,0x5E27,0x75C7,0x90D1,0x8BC1,0x829D,0x679D,0x652F, +0x5431,0x8718,0x77E5,0x80A2,0x8102,0x6C41,0x4E4B,0x7EC7, +0x804C,0x76F4,0x690D,0x6B96,0x6267,0x503C,0x4F84,0x5740, +0x6307,0x6B62,0x8DBE,0x53EA,0x65E8,0x7EB8,0x5FD7,0x631A, +0x63B7,0x81F3,0x81F4,0x7F6E,0x5E1C,0x5CD9,0x5236,0x667A, +0x79E9,0x7A1A,0x8D28,0x7099,0x75D4,0x6EDE,0x6CBB,0x7A92, +0x4E2D,0x76C5,0x5FE0,0x949F,0x8877,0x7EC8,0x79CD,0x80BF, +0x91CD,0x4EF2,0x4F17,0x821F,0x5468,0x5DDE,0x6D32,0x8BCC, +0x7CA5,0x8F74,0x8098,0x5E1A,0x5492,0x76B1,0x5B99,0x663C, +0x9AA4,0x73E0,0x682A,0x86DB,0x6731,0x732A,0x8BF8,0x8BDB, +0x9010,0x7AF9,0x70DB,0x716E,0x62C4,0x77A9,0x5631,0x4E3B, +0x8457,0x67F1,0x52A9,0x86C0,0x8D2E,0x94F8,0x7B51, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B46,0x8B47,0x8B48,0x8B49,0x8B4A,0x8B4B,0x8B4C,0x8B4D, +0x8B4E,0x8B4F,0x8B50,0x8B51,0x8B52,0x8B53,0x8B54,0x8B55, +0x8B56,0x8B57,0x8B58,0x8B59,0x8B5A,0x8B5B,0x8B5C,0x8B5D, +0x8B5E,0x8B5F,0x8B60,0x8B61,0x8B62,0x8B63,0x8B64,0x8B65, +0x8B67,0x8B68,0x8B69,0x8B6A,0x8B6B,0x8B6D,0x8B6E,0x8B6F, +0x8B70,0x8B71,0x8B72,0x8B73,0x8B74,0x8B75,0x8B76,0x8B77, +0x8B78,0x8B79,0x8B7A,0x8B7B,0x8B7C,0x8B7D,0x8B7E,0x8B7F, +0x8B80,0x8B81,0x8B82,0x8B83,0x8B84,0x8B85,0x8B86, 0, +0x8B87,0x8B88,0x8B89,0x8B8A,0x8B8B,0x8B8C,0x8B8D,0x8B8E, +0x8B8F,0x8B90,0x8B91,0x8B92,0x8B93,0x8B94,0x8B95,0x8B96, +0x8B97,0x8B98,0x8B99,0x8B9A,0x8B9B,0x8B9C,0x8B9D,0x8B9E, +0x8B9F,0x8BAC,0x8BB1,0x8BBB,0x8BC7,0x8BD0,0x8BEA,0x8C09, +0x8C1E,0x4F4F,0x6CE8,0x795D,0x9A7B,0x6293,0x722A,0x62FD, +0x4E13,0x7816,0x8F6C,0x64B0,0x8D5A,0x7BC6,0x6869,0x5E84, +0x88C5,0x5986,0x649E,0x58EE,0x72B6,0x690E,0x9525,0x8FFD, +0x8D58,0x5760,0x7F00,0x8C06,0x51C6,0x6349,0x62D9,0x5353, +0x684C,0x7422,0x8301,0x914C,0x5544,0x7740,0x707C,0x6D4A, +0x5179,0x54A8,0x8D44,0x59FF,0x6ECB,0x6DC4,0x5B5C,0x7D2B, +0x4ED4,0x7C7D,0x6ED3,0x5B50,0x81EA,0x6E0D,0x5B57,0x9B03, +0x68D5,0x8E2A,0x5B97,0x7EFC,0x603B,0x7EB5,0x90B9,0x8D70, +0x594F,0x63CD,0x79DF,0x8DB3,0x5352,0x65CF,0x7956,0x8BC5, +0x963B,0x7EC4,0x94BB,0x7E82,0x5634,0x9189,0x6700,0x7F6A, +0x5C0A,0x9075,0x6628,0x5DE6,0x4F50,0x67DE,0x505A,0x4F5C, +0x5750,0x5EA7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8C38,0x8C39,0x8C3A,0x8C3B,0x8C3C,0x8C3D,0x8C3E,0x8C3F, +0x8C40,0x8C42,0x8C43,0x8C44,0x8C45,0x8C48,0x8C4A,0x8C4B, +0x8C4D,0x8C4E,0x8C4F,0x8C50,0x8C51,0x8C52,0x8C53,0x8C54, +0x8C56,0x8C57,0x8C58,0x8C59,0x8C5B,0x8C5C,0x8C5D,0x8C5E, +0x8C5F,0x8C60,0x8C63,0x8C64,0x8C65,0x8C66,0x8C67,0x8C68, +0x8C69,0x8C6C,0x8C6D,0x8C6E,0x8C6F,0x8C70,0x8C71,0x8C72, +0x8C74,0x8C75,0x8C76,0x8C77,0x8C7B,0x8C7C,0x8C7D,0x8C7E, +0x8C7F,0x8C80,0x8C81,0x8C83,0x8C84,0x8C86,0x8C87, 0, +0x8C88,0x8C8B,0x8C8D,0x8C8E,0x8C8F,0x8C90,0x8C91,0x8C92, +0x8C93,0x8C95,0x8C96,0x8C97,0x8C99,0x8C9A,0x8C9B,0x8C9C, +0x8C9D,0x8C9E,0x8C9F,0x8CA0,0x8CA1,0x8CA2,0x8CA3,0x8CA4, +0x8CA5,0x8CA6,0x8CA7,0x8CA8,0x8CA9,0x8CAA,0x8CAB,0x8CAC, +0x8CAD,0x4E8D,0x4E0C,0x5140,0x4E10,0x5EFF,0x5345,0x4E15, +0x4E98,0x4E1E,0x9B32,0x5B6C,0x5669,0x4E28,0x79BA,0x4E3F, +0x5315,0x4E47,0x592D,0x723B,0x536E,0x6C10,0x56DF,0x80E4, +0x9997,0x6BD3,0x777E,0x9F17,0x4E36,0x4E9F,0x9F10,0x4E5C, +0x4E69,0x4E93,0x8288,0x5B5B,0x556C,0x560F,0x4EC4,0x538D, +0x539D,0x53A3,0x53A5,0x53AE,0x9765,0x8D5D,0x531A,0x53F5, +0x5326,0x532E,0x533E,0x8D5C,0x5366,0x5363,0x5202,0x5208, +0x520E,0x522D,0x5233,0x523F,0x5240,0x524C,0x525E,0x5261, +0x525C,0x84AF,0x527D,0x5282,0x5281,0x5290,0x5293,0x5182, +0x7F54,0x4EBB,0x4EC3,0x4EC9,0x4EC2,0x4EE8,0x4EE1,0x4EEB, +0x4EDE,0x4F1B,0x4EF3,0x4F22,0x4F64,0x4EF5,0x4F25,0x4F27, +0x4F09,0x4F2B,0x4F5E,0x4F67,0x6538,0x4F5A,0x4F5D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8CAE,0x8CAF,0x8CB0,0x8CB1,0x8CB2,0x8CB3,0x8CB4,0x8CB5, +0x8CB6,0x8CB7,0x8CB8,0x8CB9,0x8CBA,0x8CBB,0x8CBC,0x8CBD, +0x8CBE,0x8CBF,0x8CC0,0x8CC1,0x8CC2,0x8CC3,0x8CC4,0x8CC5, +0x8CC6,0x8CC7,0x8CC8,0x8CC9,0x8CCA,0x8CCB,0x8CCC,0x8CCD, +0x8CCE,0x8CCF,0x8CD0,0x8CD1,0x8CD2,0x8CD3,0x8CD4,0x8CD5, +0x8CD6,0x8CD7,0x8CD8,0x8CD9,0x8CDA,0x8CDB,0x8CDC,0x8CDD, +0x8CDE,0x8CDF,0x8CE0,0x8CE1,0x8CE2,0x8CE3,0x8CE4,0x8CE5, +0x8CE6,0x8CE7,0x8CE8,0x8CE9,0x8CEA,0x8CEB,0x8CEC, 0, +0x8CED,0x8CEE,0x8CEF,0x8CF0,0x8CF1,0x8CF2,0x8CF3,0x8CF4, +0x8CF5,0x8CF6,0x8CF7,0x8CF8,0x8CF9,0x8CFA,0x8CFB,0x8CFC, +0x8CFD,0x8CFE,0x8CFF,0x8D00,0x8D01,0x8D02,0x8D03,0x8D04, +0x8D05,0x8D06,0x8D07,0x8D08,0x8D09,0x8D0A,0x8D0B,0x8D0C, +0x8D0D,0x4F5F,0x4F57,0x4F32,0x4F3D,0x4F76,0x4F74,0x4F91, +0x4F89,0x4F83,0x4F8F,0x4F7E,0x4F7B,0x4FAA,0x4F7C,0x4FAC, +0x4F94,0x4FE6,0x4FE8,0x4FEA,0x4FC5,0x4FDA,0x4FE3,0x4FDC, +0x4FD1,0x4FDF,0x4FF8,0x5029,0x504C,0x4FF3,0x502C,0x500F, +0x502E,0x502D,0x4FFE,0x501C,0x500C,0x5025,0x5028,0x507E, +0x5043,0x5055,0x5048,0x504E,0x506C,0x507B,0x50A5,0x50A7, +0x50A9,0x50BA,0x50D6,0x5106,0x50ED,0x50EC,0x50E6,0x50EE, +0x5107,0x510B,0x4EDD,0x6C3D,0x4F58,0x4F65,0x4FCE,0x9FA0, +0x6C46,0x7C74,0x516E,0x5DFD,0x9EC9,0x9998,0x5181,0x5914, +0x52F9,0x530D,0x8A07,0x5310,0x51EB,0x5919,0x5155,0x4EA0, +0x5156,0x4EB3,0x886E,0x88A4,0x4EB5,0x8114,0x88D2,0x7980, +0x5B34,0x8803,0x7FB8,0x51AB,0x51B1,0x51BD,0x51BC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8D0E,0x8D0F,0x8D10,0x8D11,0x8D12,0x8D13,0x8D14,0x8D15, +0x8D16,0x8D17,0x8D18,0x8D19,0x8D1A,0x8D1B,0x8D1C,0x8D20, +0x8D51,0x8D52,0x8D57,0x8D5F,0x8D65,0x8D68,0x8D69,0x8D6A, +0x8D6C,0x8D6E,0x8D6F,0x8D71,0x8D72,0x8D78,0x8D79,0x8D7A, +0x8D7B,0x8D7C,0x8D7D,0x8D7E,0x8D7F,0x8D80,0x8D82,0x8D83, +0x8D86,0x8D87,0x8D88,0x8D89,0x8D8C,0x8D8D,0x8D8E,0x8D8F, +0x8D90,0x8D92,0x8D93,0x8D95,0x8D96,0x8D97,0x8D98,0x8D99, +0x8D9A,0x8D9B,0x8D9C,0x8D9D,0x8D9E,0x8DA0,0x8DA1, 0, +0x8DA2,0x8DA4,0x8DA5,0x8DA6,0x8DA7,0x8DA8,0x8DA9,0x8DAA, +0x8DAB,0x8DAC,0x8DAD,0x8DAE,0x8DAF,0x8DB0,0x8DB2,0x8DB6, +0x8DB7,0x8DB9,0x8DBB,0x8DBD,0x8DC0,0x8DC1,0x8DC2,0x8DC5, +0x8DC7,0x8DC8,0x8DC9,0x8DCA,0x8DCD,0x8DD0,0x8DD2,0x8DD3, +0x8DD4,0x51C7,0x5196,0x51A2,0x51A5,0x8BA0,0x8BA6,0x8BA7, +0x8BAA,0x8BB4,0x8BB5,0x8BB7,0x8BC2,0x8BC3,0x8BCB,0x8BCF, +0x8BCE,0x8BD2,0x8BD3,0x8BD4,0x8BD6,0x8BD8,0x8BD9,0x8BDC, +0x8BDF,0x8BE0,0x8BE4,0x8BE8,0x8BE9,0x8BEE,0x8BF0,0x8BF3, +0x8BF6,0x8BF9,0x8BFC,0x8BFF,0x8C00,0x8C02,0x8C04,0x8C07, +0x8C0C,0x8C0F,0x8C11,0x8C12,0x8C14,0x8C15,0x8C16,0x8C19, +0x8C1B,0x8C18,0x8C1D,0x8C1F,0x8C20,0x8C21,0x8C25,0x8C27, +0x8C2A,0x8C2B,0x8C2E,0x8C2F,0x8C32,0x8C33,0x8C35,0x8C36, +0x5369,0x537A,0x961D,0x9622,0x9621,0x9631,0x962A,0x963D, +0x963C,0x9642,0x9649,0x9654,0x965F,0x9667,0x966C,0x9672, +0x9674,0x9688,0x968D,0x9697,0x96B0,0x9097,0x909B,0x909D, +0x9099,0x90AC,0x90A1,0x90B4,0x90B3,0x90B6,0x90BA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8DD5,0x8DD8,0x8DD9,0x8DDC,0x8DE0,0x8DE1,0x8DE2,0x8DE5, +0x8DE6,0x8DE7,0x8DE9,0x8DED,0x8DEE,0x8DF0,0x8DF1,0x8DF2, +0x8DF4,0x8DF6,0x8DFC,0x8DFE,0x8DFF,0x8E00,0x8E01,0x8E02, +0x8E03,0x8E04,0x8E06,0x8E07,0x8E08,0x8E0B,0x8E0D,0x8E0E, +0x8E10,0x8E11,0x8E12,0x8E13,0x8E15,0x8E16,0x8E17,0x8E18, +0x8E19,0x8E1A,0x8E1B,0x8E1C,0x8E20,0x8E21,0x8E24,0x8E25, +0x8E26,0x8E27,0x8E28,0x8E2B,0x8E2D,0x8E30,0x8E32,0x8E33, +0x8E34,0x8E36,0x8E37,0x8E38,0x8E3B,0x8E3C,0x8E3E, 0, +0x8E3F,0x8E43,0x8E45,0x8E46,0x8E4C,0x8E4D,0x8E4E,0x8E4F, +0x8E50,0x8E53,0x8E54,0x8E55,0x8E56,0x8E57,0x8E58,0x8E5A, +0x8E5B,0x8E5C,0x8E5D,0x8E5E,0x8E5F,0x8E60,0x8E61,0x8E62, +0x8E63,0x8E64,0x8E65,0x8E67,0x8E68,0x8E6A,0x8E6B,0x8E6E, +0x8E71,0x90B8,0x90B0,0x90CF,0x90C5,0x90BE,0x90D0,0x90C4, +0x90C7,0x90D3,0x90E6,0x90E2,0x90DC,0x90D7,0x90DB,0x90EB, +0x90EF,0x90FE,0x9104,0x9122,0x911E,0x9123,0x9131,0x912F, +0x9139,0x9143,0x9146,0x520D,0x5942,0x52A2,0x52AC,0x52AD, +0x52BE,0x54FF,0x52D0,0x52D6,0x52F0,0x53DF,0x71EE,0x77CD, +0x5EF4,0x51F5,0x51FC,0x9B2F,0x53B6,0x5F01,0x755A,0x5DEF, +0x574C,0x57A9,0x57A1,0x587E,0x58BC,0x58C5,0x58D1,0x5729, +0x572C,0x572A,0x5733,0x5739,0x572E,0x572F,0x575C,0x573B, +0x5742,0x5769,0x5785,0x576B,0x5786,0x577C,0x577B,0x5768, +0x576D,0x5776,0x5773,0x57AD,0x57A4,0x578C,0x57B2,0x57CF, +0x57A7,0x57B4,0x5793,0x57A0,0x57D5,0x57D8,0x57DA,0x57D9, +0x57D2,0x57B8,0x57F4,0x57EF,0x57F8,0x57E4,0x57DD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E73,0x8E75,0x8E77,0x8E78,0x8E79,0x8E7A,0x8E7B,0x8E7D, +0x8E7E,0x8E80,0x8E82,0x8E83,0x8E84,0x8E86,0x8E88,0x8E89, +0x8E8A,0x8E8B,0x8E8C,0x8E8D,0x8E8E,0x8E91,0x8E92,0x8E93, +0x8E95,0x8E96,0x8E97,0x8E98,0x8E99,0x8E9A,0x8E9B,0x8E9D, +0x8E9F,0x8EA0,0x8EA1,0x8EA2,0x8EA3,0x8EA4,0x8EA5,0x8EA6, +0x8EA7,0x8EA8,0x8EA9,0x8EAA,0x8EAD,0x8EAE,0x8EB0,0x8EB1, +0x8EB3,0x8EB4,0x8EB5,0x8EB6,0x8EB7,0x8EB8,0x8EB9,0x8EBB, +0x8EBC,0x8EBD,0x8EBE,0x8EBF,0x8EC0,0x8EC1,0x8EC2, 0, +0x8EC3,0x8EC4,0x8EC5,0x8EC6,0x8EC7,0x8EC8,0x8EC9,0x8ECA, +0x8ECB,0x8ECC,0x8ECD,0x8ECF,0x8ED0,0x8ED1,0x8ED2,0x8ED3, +0x8ED4,0x8ED5,0x8ED6,0x8ED7,0x8ED8,0x8ED9,0x8EDA,0x8EDB, +0x8EDC,0x8EDD,0x8EDE,0x8EDF,0x8EE0,0x8EE1,0x8EE2,0x8EE3, +0x8EE4,0x580B,0x580D,0x57FD,0x57ED,0x5800,0x581E,0x5819, +0x5844,0x5820,0x5865,0x586C,0x5881,0x5889,0x589A,0x5880, +0x99A8,0x9F19,0x61FF,0x8279,0x827D,0x827F,0x828F,0x828A, +0x82A8,0x8284,0x828E,0x8291,0x8297,0x8299,0x82AB,0x82B8, +0x82BE,0x82B0,0x82C8,0x82CA,0x82E3,0x8298,0x82B7,0x82AE, +0x82CB,0x82CC,0x82C1,0x82A9,0x82B4,0x82A1,0x82AA,0x829F, +0x82C4,0x82CE,0x82A4,0x82E1,0x8309,0x82F7,0x82E4,0x830F, +0x8307,0x82DC,0x82F4,0x82D2,0x82D8,0x830C,0x82FB,0x82D3, +0x8311,0x831A,0x8306,0x8314,0x8315,0x82E0,0x82D5,0x831C, +0x8351,0x835B,0x835C,0x8308,0x8392,0x833C,0x8334,0x8331, +0x839B,0x835E,0x832F,0x834F,0x8347,0x8343,0x835F,0x8340, +0x8317,0x8360,0x832D,0x833A,0x8333,0x8366,0x8365, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8EE5,0x8EE6,0x8EE7,0x8EE8,0x8EE9,0x8EEA,0x8EEB,0x8EEC, +0x8EED,0x8EEE,0x8EEF,0x8EF0,0x8EF1,0x8EF2,0x8EF3,0x8EF4, +0x8EF5,0x8EF6,0x8EF7,0x8EF8,0x8EF9,0x8EFA,0x8EFB,0x8EFC, +0x8EFD,0x8EFE,0x8EFF,0x8F00,0x8F01,0x8F02,0x8F03,0x8F04, +0x8F05,0x8F06,0x8F07,0x8F08,0x8F09,0x8F0A,0x8F0B,0x8F0C, +0x8F0D,0x8F0E,0x8F0F,0x8F10,0x8F11,0x8F12,0x8F13,0x8F14, +0x8F15,0x8F16,0x8F17,0x8F18,0x8F19,0x8F1A,0x8F1B,0x8F1C, +0x8F1D,0x8F1E,0x8F1F,0x8F20,0x8F21,0x8F22,0x8F23, 0, +0x8F24,0x8F25,0x8F26,0x8F27,0x8F28,0x8F29,0x8F2A,0x8F2B, +0x8F2C,0x8F2D,0x8F2E,0x8F2F,0x8F30,0x8F31,0x8F32,0x8F33, +0x8F34,0x8F35,0x8F36,0x8F37,0x8F38,0x8F39,0x8F3A,0x8F3B, +0x8F3C,0x8F3D,0x8F3E,0x8F3F,0x8F40,0x8F41,0x8F42,0x8F43, +0x8F44,0x8368,0x831B,0x8369,0x836C,0x836A,0x836D,0x836E, +0x83B0,0x8378,0x83B3,0x83B4,0x83A0,0x83AA,0x8393,0x839C, +0x8385,0x837C,0x83B6,0x83A9,0x837D,0x83B8,0x837B,0x8398, +0x839E,0x83A8,0x83BA,0x83BC,0x83C1,0x8401,0x83E5,0x83D8, +0x5807,0x8418,0x840B,0x83DD,0x83FD,0x83D6,0x841C,0x8438, +0x8411,0x8406,0x83D4,0x83DF,0x840F,0x8403,0x83F8,0x83F9, +0x83EA,0x83C5,0x83C0,0x8426,0x83F0,0x83E1,0x845C,0x8451, +0x845A,0x8459,0x8473,0x8487,0x8488,0x847A,0x8489,0x8478, +0x843C,0x8446,0x8469,0x8476,0x848C,0x848E,0x8431,0x846D, +0x84C1,0x84CD,0x84D0,0x84E6,0x84BD,0x84D3,0x84CA,0x84BF, +0x84BA,0x84E0,0x84A1,0x84B9,0x84B4,0x8497,0x84E5,0x84E3, +0x850C,0x750D,0x8538,0x84F0,0x8539,0x851F,0x853A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8F45,0x8F46,0x8F47,0x8F48,0x8F49,0x8F4A,0x8F4B,0x8F4C, +0x8F4D,0x8F4E,0x8F4F,0x8F50,0x8F51,0x8F52,0x8F53,0x8F54, +0x8F55,0x8F56,0x8F57,0x8F58,0x8F59,0x8F5A,0x8F5B,0x8F5C, +0x8F5D,0x8F5E,0x8F5F,0x8F60,0x8F61,0x8F62,0x8F63,0x8F64, +0x8F65,0x8F6A,0x8F80,0x8F8C,0x8F92,0x8F9D,0x8FA0,0x8FA1, +0x8FA2,0x8FA4,0x8FA5,0x8FA6,0x8FA7,0x8FAA,0x8FAC,0x8FAD, +0x8FAE,0x8FAF,0x8FB2,0x8FB3,0x8FB4,0x8FB5,0x8FB7,0x8FB8, +0x8FBA,0x8FBB,0x8FBC,0x8FBF,0x8FC0,0x8FC3,0x8FC6, 0, +0x8FC9,0x8FCA,0x8FCB,0x8FCC,0x8FCD,0x8FCF,0x8FD2,0x8FD6, +0x8FD7,0x8FDA,0x8FE0,0x8FE1,0x8FE3,0x8FE7,0x8FEC,0x8FEF, +0x8FF1,0x8FF2,0x8FF4,0x8FF5,0x8FF6,0x8FFA,0x8FFB,0x8FFC, +0x8FFE,0x8FFF,0x9007,0x9008,0x900C,0x900E,0x9013,0x9015, +0x9018,0x8556,0x853B,0x84FF,0x84FC,0x8559,0x8548,0x8568, +0x8564,0x855E,0x857A,0x77A2,0x8543,0x8572,0x857B,0x85A4, +0x85A8,0x8587,0x858F,0x8579,0x85AE,0x859C,0x8585,0x85B9, +0x85B7,0x85B0,0x85D3,0x85C1,0x85DC,0x85FF,0x8627,0x8605, +0x8629,0x8616,0x863C,0x5EFE,0x5F08,0x593C,0x5941,0x8037, +0x5955,0x595A,0x5958,0x530F,0x5C22,0x5C25,0x5C2C,0x5C34, +0x624C,0x626A,0x629F,0x62BB,0x62CA,0x62DA,0x62D7,0x62EE, +0x6322,0x62F6,0x6339,0x634B,0x6343,0x63AD,0x63F6,0x6371, +0x637A,0x638E,0x63B4,0x636D,0x63AC,0x638A,0x6369,0x63AE, +0x63BC,0x63F2,0x63F8,0x63E0,0x63FF,0x63C4,0x63DE,0x63CE, +0x6452,0x63C6,0x63BE,0x6445,0x6441,0x640B,0x641B,0x6420, +0x640C,0x6426,0x6421,0x645E,0x6484,0x646D,0x6496, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9019,0x901C,0x9023,0x9024,0x9025,0x9027,0x9028,0x9029, +0x902A,0x902B,0x902C,0x9030,0x9031,0x9032,0x9033,0x9034, +0x9037,0x9039,0x903A,0x903D,0x903F,0x9040,0x9043,0x9045, +0x9046,0x9048,0x9049,0x904A,0x904B,0x904C,0x904E,0x9054, +0x9055,0x9056,0x9059,0x905A,0x905C,0x905D,0x905E,0x905F, +0x9060,0x9061,0x9064,0x9066,0x9067,0x9069,0x906A,0x906B, +0x906C,0x906F,0x9070,0x9071,0x9072,0x9073,0x9076,0x9077, +0x9078,0x9079,0x907A,0x907B,0x907C,0x907E,0x9081, 0, +0x9084,0x9085,0x9086,0x9087,0x9089,0x908A,0x908C,0x908D, +0x908E,0x908F,0x9090,0x9092,0x9094,0x9096,0x9098,0x909A, +0x909C,0x909E,0x909F,0x90A0,0x90A4,0x90A5,0x90A7,0x90A8, +0x90A9,0x90AB,0x90AD,0x90B2,0x90B7,0x90BC,0x90BD,0x90BF, +0x90C0,0x647A,0x64B7,0x64B8,0x6499,0x64BA,0x64C0,0x64D0, +0x64D7,0x64E4,0x64E2,0x6509,0x6525,0x652E,0x5F0B,0x5FD2, +0x7519,0x5F11,0x535F,0x53F1,0x53FD,0x53E9,0x53E8,0x53FB, +0x5412,0x5416,0x5406,0x544B,0x5452,0x5453,0x5454,0x5456, +0x5443,0x5421,0x5457,0x5459,0x5423,0x5432,0x5482,0x5494, +0x5477,0x5471,0x5464,0x549A,0x549B,0x5484,0x5476,0x5466, +0x549D,0x54D0,0x54AD,0x54C2,0x54B4,0x54D2,0x54A7,0x54A6, +0x54D3,0x54D4,0x5472,0x54A3,0x54D5,0x54BB,0x54BF,0x54CC, +0x54D9,0x54DA,0x54DC,0x54A9,0x54AA,0x54A4,0x54DD,0x54CF, +0x54DE,0x551B,0x54E7,0x5520,0x54FD,0x5514,0x54F3,0x5522, +0x5523,0x550F,0x5511,0x5527,0x552A,0x5567,0x558F,0x55B5, +0x5549,0x556D,0x5541,0x5555,0x553F,0x5550,0x553C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x90C2,0x90C3,0x90C6,0x90C8,0x90C9,0x90CB,0x90CC,0x90CD, +0x90D2,0x90D4,0x90D5,0x90D6,0x90D8,0x90D9,0x90DA,0x90DE, +0x90DF,0x90E0,0x90E3,0x90E4,0x90E5,0x90E9,0x90EA,0x90EC, +0x90EE,0x90F0,0x90F1,0x90F2,0x90F3,0x90F5,0x90F6,0x90F7, +0x90F9,0x90FA,0x90FB,0x90FC,0x90FF,0x9100,0x9101,0x9103, +0x9105,0x9106,0x9107,0x9108,0x9109,0x910A,0x910B,0x910C, +0x910D,0x910E,0x910F,0x9110,0x9111,0x9112,0x9113,0x9114, +0x9115,0x9116,0x9117,0x9118,0x911A,0x911B,0x911C, 0, +0x911D,0x911F,0x9120,0x9121,0x9124,0x9125,0x9126,0x9127, +0x9128,0x9129,0x912A,0x912B,0x912C,0x912D,0x912E,0x9130, +0x9132,0x9133,0x9134,0x9135,0x9136,0x9137,0x9138,0x913A, +0x913B,0x913C,0x913D,0x913E,0x913F,0x9140,0x9141,0x9142, +0x9144,0x5537,0x5556,0x5575,0x5576,0x5577,0x5533,0x5530, +0x555C,0x558B,0x55D2,0x5583,0x55B1,0x55B9,0x5588,0x5581, +0x559F,0x557E,0x55D6,0x5591,0x557B,0x55DF,0x55BD,0x55BE, +0x5594,0x5599,0x55EA,0x55F7,0x55C9,0x561F,0x55D1,0x55EB, +0x55EC,0x55D4,0x55E6,0x55DD,0x55C4,0x55EF,0x55E5,0x55F2, +0x55F3,0x55CC,0x55CD,0x55E8,0x55F5,0x55E4,0x8F94,0x561E, +0x5608,0x560C,0x5601,0x5624,0x5623,0x55FE,0x5600,0x5627, +0x562D,0x5658,0x5639,0x5657,0x562C,0x564D,0x5662,0x5659, +0x565C,0x564C,0x5654,0x5686,0x5664,0x5671,0x566B,0x567B, +0x567C,0x5685,0x5693,0x56AF,0x56D4,0x56D7,0x56DD,0x56E1, +0x56F5,0x56EB,0x56F9,0x56FF,0x5704,0x570A,0x5709,0x571C, +0x5E0F,0x5E19,0x5E14,0x5E11,0x5E31,0x5E3B,0x5E3C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9145,0x9147,0x9148,0x9151,0x9153,0x9154,0x9155,0x9156, +0x9158,0x9159,0x915B,0x915C,0x915F,0x9160,0x9166,0x9167, +0x9168,0x916B,0x916D,0x9173,0x917A,0x917B,0x917C,0x9180, +0x9181,0x9182,0x9183,0x9184,0x9186,0x9188,0x918A,0x918E, +0x918F,0x9193,0x9194,0x9195,0x9196,0x9197,0x9198,0x9199, +0x919C,0x919D,0x919E,0x919F,0x91A0,0x91A1,0x91A4,0x91A5, +0x91A6,0x91A7,0x91A8,0x91A9,0x91AB,0x91AC,0x91B0,0x91B1, +0x91B2,0x91B3,0x91B6,0x91B7,0x91B8,0x91B9,0x91BB, 0, +0x91BC,0x91BD,0x91BE,0x91BF,0x91C0,0x91C1,0x91C2,0x91C3, +0x91C4,0x91C5,0x91C6,0x91C8,0x91CB,0x91D0,0x91D2,0x91D3, +0x91D4,0x91D5,0x91D6,0x91D7,0x91D8,0x91D9,0x91DA,0x91DB, +0x91DD,0x91DE,0x91DF,0x91E0,0x91E1,0x91E2,0x91E3,0x91E4, +0x91E5,0x5E37,0x5E44,0x5E54,0x5E5B,0x5E5E,0x5E61,0x5C8C, +0x5C7A,0x5C8D,0x5C90,0x5C96,0x5C88,0x5C98,0x5C99,0x5C91, +0x5C9A,0x5C9C,0x5CB5,0x5CA2,0x5CBD,0x5CAC,0x5CAB,0x5CB1, +0x5CA3,0x5CC1,0x5CB7,0x5CC4,0x5CD2,0x5CE4,0x5CCB,0x5CE5, +0x5D02,0x5D03,0x5D27,0x5D26,0x5D2E,0x5D24,0x5D1E,0x5D06, +0x5D1B,0x5D58,0x5D3E,0x5D34,0x5D3D,0x5D6C,0x5D5B,0x5D6F, +0x5D5D,0x5D6B,0x5D4B,0x5D4A,0x5D69,0x5D74,0x5D82,0x5D99, +0x5D9D,0x8C73,0x5DB7,0x5DC5,0x5F73,0x5F77,0x5F82,0x5F87, +0x5F89,0x5F8C,0x5F95,0x5F99,0x5F9C,0x5FA8,0x5FAD,0x5FB5, +0x5FBC,0x8862,0x5F61,0x72AD,0x72B0,0x72B4,0x72B7,0x72B8, +0x72C3,0x72C1,0x72CE,0x72CD,0x72D2,0x72E8,0x72EF,0x72E9, +0x72F2,0x72F4,0x72F7,0x7301,0x72F3,0x7303,0x72FA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x91E6,0x91E7,0x91E8,0x91E9,0x91EA,0x91EB,0x91EC,0x91ED, +0x91EE,0x91EF,0x91F0,0x91F1,0x91F2,0x91F3,0x91F4,0x91F5, +0x91F6,0x91F7,0x91F8,0x91F9,0x91FA,0x91FB,0x91FC,0x91FD, +0x91FE,0x91FF,0x9200,0x9201,0x9202,0x9203,0x9204,0x9205, +0x9206,0x9207,0x9208,0x9209,0x920A,0x920B,0x920C,0x920D, +0x920E,0x920F,0x9210,0x9211,0x9212,0x9213,0x9214,0x9215, +0x9216,0x9217,0x9218,0x9219,0x921A,0x921B,0x921C,0x921D, +0x921E,0x921F,0x9220,0x9221,0x9222,0x9223,0x9224, 0, +0x9225,0x9226,0x9227,0x9228,0x9229,0x922A,0x922B,0x922C, +0x922D,0x922E,0x922F,0x9230,0x9231,0x9232,0x9233,0x9234, +0x9235,0x9236,0x9237,0x9238,0x9239,0x923A,0x923B,0x923C, +0x923D,0x923E,0x923F,0x9240,0x9241,0x9242,0x9243,0x9244, +0x9245,0x72FB,0x7317,0x7313,0x7321,0x730A,0x731E,0x731D, +0x7315,0x7322,0x7339,0x7325,0x732C,0x7338,0x7331,0x7350, +0x734D,0x7357,0x7360,0x736C,0x736F,0x737E,0x821B,0x5925, +0x98E7,0x5924,0x5902,0x9963,0x9967,0x9968,0x9969,0x996A, +0x996B,0x996C,0x9974,0x9977,0x997D,0x9980,0x9984,0x9987, +0x998A,0x998D,0x9990,0x9991,0x9993,0x9994,0x9995,0x5E80, +0x5E91,0x5E8B,0x5E96,0x5EA5,0x5EA0,0x5EB9,0x5EB5,0x5EBE, +0x5EB3,0x8D53,0x5ED2,0x5ED1,0x5EDB,0x5EE8,0x5EEA,0x81BA, +0x5FC4,0x5FC9,0x5FD6,0x5FCF,0x6003,0x5FEE,0x6004,0x5FE1, +0x5FE4,0x5FFE,0x6005,0x6006,0x5FEA,0x5FED,0x5FF8,0x6019, +0x6035,0x6026,0x601B,0x600F,0x600D,0x6029,0x602B,0x600A, +0x603F,0x6021,0x6078,0x6079,0x607B,0x607A,0x6042, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9246,0x9247,0x9248,0x9249,0x924A,0x924B,0x924C,0x924D, +0x924E,0x924F,0x9250,0x9251,0x9252,0x9253,0x9254,0x9255, +0x9256,0x9257,0x9258,0x9259,0x925A,0x925B,0x925C,0x925D, +0x925E,0x925F,0x9260,0x9261,0x9262,0x9263,0x9264,0x9265, +0x9266,0x9267,0x9268,0x9269,0x926A,0x926B,0x926C,0x926D, +0x926E,0x926F,0x9270,0x9271,0x9272,0x9273,0x9275,0x9276, +0x9277,0x9278,0x9279,0x927A,0x927B,0x927C,0x927D,0x927E, +0x927F,0x9280,0x9281,0x9282,0x9283,0x9284,0x9285, 0, +0x9286,0x9287,0x9288,0x9289,0x928A,0x928B,0x928C,0x928D, +0x928F,0x9290,0x9291,0x9292,0x9293,0x9294,0x9295,0x9296, +0x9297,0x9298,0x9299,0x929A,0x929B,0x929C,0x929D,0x929E, +0x929F,0x92A0,0x92A1,0x92A2,0x92A3,0x92A4,0x92A5,0x92A6, +0x92A7,0x606A,0x607D,0x6096,0x609A,0x60AD,0x609D,0x6083, +0x6092,0x608C,0x609B,0x60EC,0x60BB,0x60B1,0x60DD,0x60D8, +0x60C6,0x60DA,0x60B4,0x6120,0x6126,0x6115,0x6123,0x60F4, +0x6100,0x610E,0x612B,0x614A,0x6175,0x61AC,0x6194,0x61A7, +0x61B7,0x61D4,0x61F5,0x5FDD,0x96B3,0x95E9,0x95EB,0x95F1, +0x95F3,0x95F5,0x95F6,0x95FC,0x95FE,0x9603,0x9604,0x9606, +0x9608,0x960A,0x960B,0x960C,0x960D,0x960F,0x9612,0x9615, +0x9616,0x9617,0x9619,0x961A,0x4E2C,0x723F,0x6215,0x6C35, +0x6C54,0x6C5C,0x6C4A,0x6CA3,0x6C85,0x6C90,0x6C94,0x6C8C, +0x6C68,0x6C69,0x6C74,0x6C76,0x6C86,0x6CA9,0x6CD0,0x6CD4, +0x6CAD,0x6CF7,0x6CF8,0x6CF1,0x6CD7,0x6CB2,0x6CE0,0x6CD6, +0x6CFA,0x6CEB,0x6CEE,0x6CB1,0x6CD3,0x6CEF,0x6CFE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x92A8,0x92A9,0x92AA,0x92AB,0x92AC,0x92AD,0x92AF,0x92B0, +0x92B1,0x92B2,0x92B3,0x92B4,0x92B5,0x92B6,0x92B7,0x92B8, +0x92B9,0x92BA,0x92BB,0x92BC,0x92BD,0x92BE,0x92BF,0x92C0, +0x92C1,0x92C2,0x92C3,0x92C4,0x92C5,0x92C6,0x92C7,0x92C9, +0x92CA,0x92CB,0x92CC,0x92CD,0x92CE,0x92CF,0x92D0,0x92D1, +0x92D2,0x92D3,0x92D4,0x92D5,0x92D6,0x92D7,0x92D8,0x92D9, +0x92DA,0x92DB,0x92DC,0x92DD,0x92DE,0x92DF,0x92E0,0x92E1, +0x92E2,0x92E3,0x92E4,0x92E5,0x92E6,0x92E7,0x92E8, 0, +0x92E9,0x92EA,0x92EB,0x92EC,0x92ED,0x92EE,0x92EF,0x92F0, +0x92F1,0x92F2,0x92F3,0x92F4,0x92F5,0x92F6,0x92F7,0x92F8, +0x92F9,0x92FA,0x92FB,0x92FC,0x92FD,0x92FE,0x92FF,0x9300, +0x9301,0x9302,0x9303,0x9304,0x9305,0x9306,0x9307,0x9308, +0x9309,0x6D39,0x6D27,0x6D0C,0x6D43,0x6D48,0x6D07,0x6D04, +0x6D19,0x6D0E,0x6D2B,0x6D4D,0x6D2E,0x6D35,0x6D1A,0x6D4F, +0x6D52,0x6D54,0x6D33,0x6D91,0x6D6F,0x6D9E,0x6DA0,0x6D5E, +0x6D93,0x6D94,0x6D5C,0x6D60,0x6D7C,0x6D63,0x6E1A,0x6DC7, +0x6DC5,0x6DDE,0x6E0E,0x6DBF,0x6DE0,0x6E11,0x6DE6,0x6DDD, +0x6DD9,0x6E16,0x6DAB,0x6E0C,0x6DAE,0x6E2B,0x6E6E,0x6E4E, +0x6E6B,0x6EB2,0x6E5F,0x6E86,0x6E53,0x6E54,0x6E32,0x6E25, +0x6E44,0x6EDF,0x6EB1,0x6E98,0x6EE0,0x6F2D,0x6EE2,0x6EA5, +0x6EA7,0x6EBD,0x6EBB,0x6EB7,0x6ED7,0x6EB4,0x6ECF,0x6E8F, +0x6EC2,0x6E9F,0x6F62,0x6F46,0x6F47,0x6F24,0x6F15,0x6EF9, +0x6F2F,0x6F36,0x6F4B,0x6F74,0x6F2A,0x6F09,0x6F29,0x6F89, +0x6F8D,0x6F8C,0x6F78,0x6F72,0x6F7C,0x6F7A,0x6FD1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x930A,0x930B,0x930C,0x930D,0x930E,0x930F,0x9310,0x9311, +0x9312,0x9313,0x9314,0x9315,0x9316,0x9317,0x9318,0x9319, +0x931A,0x931B,0x931C,0x931D,0x931E,0x931F,0x9320,0x9321, +0x9322,0x9323,0x9324,0x9325,0x9326,0x9327,0x9328,0x9329, +0x932A,0x932B,0x932C,0x932D,0x932E,0x932F,0x9330,0x9331, +0x9332,0x9333,0x9334,0x9335,0x9336,0x9337,0x9338,0x9339, +0x933A,0x933B,0x933C,0x933D,0x933F,0x9340,0x9341,0x9342, +0x9343,0x9344,0x9345,0x9346,0x9347,0x9348,0x9349, 0, +0x934A,0x934B,0x934C,0x934D,0x934E,0x934F,0x9350,0x9351, +0x9352,0x9353,0x9354,0x9355,0x9356,0x9357,0x9358,0x9359, +0x935A,0x935B,0x935C,0x935D,0x935E,0x935F,0x9360,0x9361, +0x9362,0x9363,0x9364,0x9365,0x9366,0x9367,0x9368,0x9369, +0x936B,0x6FC9,0x6FA7,0x6FB9,0x6FB6,0x6FC2,0x6FE1,0x6FEE, +0x6FDE,0x6FE0,0x6FEF,0x701A,0x7023,0x701B,0x7039,0x7035, +0x704F,0x705E,0x5B80,0x5B84,0x5B95,0x5B93,0x5BA5,0x5BB8, +0x752F,0x9A9E,0x6434,0x5BE4,0x5BEE,0x8930,0x5BF0,0x8E47, +0x8B07,0x8FB6,0x8FD3,0x8FD5,0x8FE5,0x8FEE,0x8FE4,0x8FE9, +0x8FE6,0x8FF3,0x8FE8,0x9005,0x9004,0x900B,0x9026,0x9011, +0x900D,0x9016,0x9021,0x9035,0x9036,0x902D,0x902F,0x9044, +0x9051,0x9052,0x9050,0x9068,0x9058,0x9062,0x905B,0x66B9, +0x9074,0x907D,0x9082,0x9088,0x9083,0x908B,0x5F50,0x5F57, +0x5F56,0x5F58,0x5C3B,0x54AB,0x5C50,0x5C59,0x5B71,0x5C63, +0x5C66,0x7FBC,0x5F2A,0x5F29,0x5F2D,0x8274,0x5F3C,0x9B3B, +0x5C6E,0x5981,0x5983,0x598D,0x59A9,0x59AA,0x59A3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x936C,0x936D,0x936E,0x936F,0x9370,0x9371,0x9372,0x9373, +0x9374,0x9375,0x9376,0x9377,0x9378,0x9379,0x937A,0x937B, +0x937C,0x937D,0x937E,0x937F,0x9380,0x9381,0x9382,0x9383, +0x9384,0x9385,0x9386,0x9387,0x9388,0x9389,0x938A,0x938B, +0x938C,0x938D,0x938E,0x9390,0x9391,0x9392,0x9393,0x9394, +0x9395,0x9396,0x9397,0x9398,0x9399,0x939A,0x939B,0x939C, +0x939D,0x939E,0x939F,0x93A0,0x93A1,0x93A2,0x93A3,0x93A4, +0x93A5,0x93A6,0x93A7,0x93A8,0x93A9,0x93AA,0x93AB, 0, +0x93AC,0x93AD,0x93AE,0x93AF,0x93B0,0x93B1,0x93B2,0x93B3, +0x93B4,0x93B5,0x93B6,0x93B7,0x93B8,0x93B9,0x93BA,0x93BB, +0x93BC,0x93BD,0x93BE,0x93BF,0x93C0,0x93C1,0x93C2,0x93C3, +0x93C4,0x93C5,0x93C6,0x93C7,0x93C8,0x93C9,0x93CB,0x93CC, +0x93CD,0x5997,0x59CA,0x59AB,0x599E,0x59A4,0x59D2,0x59B2, +0x59AF,0x59D7,0x59BE,0x5A05,0x5A06,0x59DD,0x5A08,0x59E3, +0x59D8,0x59F9,0x5A0C,0x5A09,0x5A32,0x5A34,0x5A11,0x5A23, +0x5A13,0x5A40,0x5A67,0x5A4A,0x5A55,0x5A3C,0x5A62,0x5A75, +0x80EC,0x5AAA,0x5A9B,0x5A77,0x5A7A,0x5ABE,0x5AEB,0x5AB2, +0x5AD2,0x5AD4,0x5AB8,0x5AE0,0x5AE3,0x5AF1,0x5AD6,0x5AE6, +0x5AD8,0x5ADC,0x5B09,0x5B17,0x5B16,0x5B32,0x5B37,0x5B40, +0x5C15,0x5C1C,0x5B5A,0x5B65,0x5B73,0x5B51,0x5B53,0x5B62, +0x9A75,0x9A77,0x9A78,0x9A7A,0x9A7F,0x9A7D,0x9A80,0x9A81, +0x9A85,0x9A88,0x9A8A,0x9A90,0x9A92,0x9A93,0x9A96,0x9A98, +0x9A9B,0x9A9C,0x9A9D,0x9A9F,0x9AA0,0x9AA2,0x9AA3,0x9AA5, +0x9AA7,0x7E9F,0x7EA1,0x7EA3,0x7EA5,0x7EA8,0x7EA9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x93CE,0x93CF,0x93D0,0x93D1,0x93D2,0x93D3,0x93D4,0x93D5, +0x93D7,0x93D8,0x93D9,0x93DA,0x93DB,0x93DC,0x93DD,0x93DE, +0x93DF,0x93E0,0x93E1,0x93E2,0x93E3,0x93E4,0x93E5,0x93E6, +0x93E7,0x93E8,0x93E9,0x93EA,0x93EB,0x93EC,0x93ED,0x93EE, +0x93EF,0x93F0,0x93F1,0x93F2,0x93F3,0x93F4,0x93F5,0x93F6, +0x93F7,0x93F8,0x93F9,0x93FA,0x93FB,0x93FC,0x93FD,0x93FE, +0x93FF,0x9400,0x9401,0x9402,0x9403,0x9404,0x9405,0x9406, +0x9407,0x9408,0x9409,0x940A,0x940B,0x940C,0x940D, 0, +0x940E,0x940F,0x9410,0x9411,0x9412,0x9413,0x9414,0x9415, +0x9416,0x9417,0x9418,0x9419,0x941A,0x941B,0x941C,0x941D, +0x941E,0x941F,0x9420,0x9421,0x9422,0x9423,0x9424,0x9425, +0x9426,0x9427,0x9428,0x9429,0x942A,0x942B,0x942C,0x942D, +0x942E,0x7EAD,0x7EB0,0x7EBE,0x7EC0,0x7EC1,0x7EC2,0x7EC9, +0x7ECB,0x7ECC,0x7ED0,0x7ED4,0x7ED7,0x7EDB,0x7EE0,0x7EE1, +0x7EE8,0x7EEB,0x7EEE,0x7EEF,0x7EF1,0x7EF2,0x7F0D,0x7EF6, +0x7EFA,0x7EFB,0x7EFE,0x7F01,0x7F02,0x7F03,0x7F07,0x7F08, +0x7F0B,0x7F0C,0x7F0F,0x7F11,0x7F12,0x7F17,0x7F19,0x7F1C, +0x7F1B,0x7F1F,0x7F21,0x7F22,0x7F23,0x7F24,0x7F25,0x7F26, +0x7F27,0x7F2A,0x7F2B,0x7F2C,0x7F2D,0x7F2F,0x7F30,0x7F31, +0x7F32,0x7F33,0x7F35,0x5E7A,0x757F,0x5DDB,0x753E,0x9095, +0x738E,0x7391,0x73AE,0x73A2,0x739F,0x73CF,0x73C2,0x73D1, +0x73B7,0x73B3,0x73C0,0x73C9,0x73C8,0x73E5,0x73D9,0x987C, +0x740A,0x73E9,0x73E7,0x73DE,0x73BA,0x73F2,0x740F,0x742A, +0x745B,0x7426,0x7425,0x7428,0x7430,0x742E,0x742C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x942F,0x9430,0x9431,0x9432,0x9433,0x9434,0x9435,0x9436, +0x9437,0x9438,0x9439,0x943A,0x943B,0x943C,0x943D,0x943F, +0x9440,0x9441,0x9442,0x9443,0x9444,0x9445,0x9446,0x9447, +0x9448,0x9449,0x944A,0x944B,0x944C,0x944D,0x944E,0x944F, +0x9450,0x9451,0x9452,0x9453,0x9454,0x9455,0x9456,0x9457, +0x9458,0x9459,0x945A,0x945B,0x945C,0x945D,0x945E,0x945F, +0x9460,0x9461,0x9462,0x9463,0x9464,0x9465,0x9466,0x9467, +0x9468,0x9469,0x946A,0x946C,0x946D,0x946E,0x946F, 0, +0x9470,0x9471,0x9472,0x9473,0x9474,0x9475,0x9476,0x9477, +0x9478,0x9479,0x947A,0x947B,0x947C,0x947D,0x947E,0x947F, +0x9480,0x9481,0x9482,0x9483,0x9484,0x9491,0x9496,0x9498, +0x94C7,0x94CF,0x94D3,0x94D4,0x94DA,0x94E6,0x94FB,0x951C, +0x9520,0x741B,0x741A,0x7441,0x745C,0x7457,0x7455,0x7459, +0x7477,0x746D,0x747E,0x749C,0x748E,0x7480,0x7481,0x7487, +0x748B,0x749E,0x74A8,0x74A9,0x7490,0x74A7,0x74D2,0x74BA, +0x97EA,0x97EB,0x97EC,0x674C,0x6753,0x675E,0x6748,0x6769, +0x67A5,0x6787,0x676A,0x6773,0x6798,0x67A7,0x6775,0x67A8, +0x679E,0x67AD,0x678B,0x6777,0x677C,0x67F0,0x6809,0x67D8, +0x680A,0x67E9,0x67B0,0x680C,0x67D9,0x67B5,0x67DA,0x67B3, +0x67DD,0x6800,0x67C3,0x67B8,0x67E2,0x680E,0x67C1,0x67FD, +0x6832,0x6833,0x6860,0x6861,0x684E,0x6862,0x6844,0x6864, +0x6883,0x681D,0x6855,0x6866,0x6841,0x6867,0x6840,0x683E, +0x684A,0x6849,0x6829,0x68B5,0x688F,0x6874,0x6877,0x6893, +0x686B,0x68C2,0x696E,0x68FC,0x691F,0x6920,0x68F9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9527,0x9533,0x953D,0x9543,0x9548,0x954B,0x9555,0x955A, +0x9560,0x956E,0x9574,0x9575,0x9577,0x9578,0x9579,0x957A, +0x957B,0x957C,0x957D,0x957E,0x9580,0x9581,0x9582,0x9583, +0x9584,0x9585,0x9586,0x9587,0x9588,0x9589,0x958A,0x958B, +0x958C,0x958D,0x958E,0x958F,0x9590,0x9591,0x9592,0x9593, +0x9594,0x9595,0x9596,0x9597,0x9598,0x9599,0x959A,0x959B, +0x959C,0x959D,0x959E,0x959F,0x95A0,0x95A1,0x95A2,0x95A3, +0x95A4,0x95A5,0x95A6,0x95A7,0x95A8,0x95A9,0x95AA, 0, +0x95AB,0x95AC,0x95AD,0x95AE,0x95AF,0x95B0,0x95B1,0x95B2, +0x95B3,0x95B4,0x95B5,0x95B6,0x95B7,0x95B8,0x95B9,0x95BA, +0x95BB,0x95BC,0x95BD,0x95BE,0x95BF,0x95C0,0x95C1,0x95C2, +0x95C3,0x95C4,0x95C5,0x95C6,0x95C7,0x95C8,0x95C9,0x95CA, +0x95CB,0x6924,0x68F0,0x690B,0x6901,0x6957,0x68E3,0x6910, +0x6971,0x6939,0x6960,0x6942,0x695D,0x6984,0x696B,0x6980, +0x6998,0x6978,0x6934,0x69CC,0x6987,0x6988,0x69CE,0x6989, +0x6966,0x6963,0x6979,0x699B,0x69A7,0x69BB,0x69AB,0x69AD, +0x69D4,0x69B1,0x69C1,0x69CA,0x69DF,0x6995,0x69E0,0x698D, +0x69FF,0x6A2F,0x69ED,0x6A17,0x6A18,0x6A65,0x69F2,0x6A44, +0x6A3E,0x6AA0,0x6A50,0x6A5B,0x6A35,0x6A8E,0x6A79,0x6A3D, +0x6A28,0x6A58,0x6A7C,0x6A91,0x6A90,0x6AA9,0x6A97,0x6AAB, +0x7337,0x7352,0x6B81,0x6B82,0x6B87,0x6B84,0x6B92,0x6B93, +0x6B8D,0x6B9A,0x6B9B,0x6BA1,0x6BAA,0x8F6B,0x8F6D,0x8F71, +0x8F72,0x8F73,0x8F75,0x8F76,0x8F78,0x8F77,0x8F79,0x8F7A, +0x8F7C,0x8F7E,0x8F81,0x8F82,0x8F84,0x8F87,0x8F8B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x95CC,0x95CD,0x95CE,0x95CF,0x95D0,0x95D1,0x95D2,0x95D3, +0x95D4,0x95D5,0x95D6,0x95D7,0x95D8,0x95D9,0x95DA,0x95DB, +0x95DC,0x95DD,0x95DE,0x95DF,0x95E0,0x95E1,0x95E2,0x95E3, +0x95E4,0x95E5,0x95E6,0x95E7,0x95EC,0x95FF,0x9607,0x9613, +0x9618,0x961B,0x961E,0x9620,0x9623,0x9624,0x9625,0x9626, +0x9627,0x9628,0x9629,0x962B,0x962C,0x962D,0x962F,0x9630, +0x9637,0x9638,0x9639,0x963A,0x963E,0x9641,0x9643,0x964A, +0x964E,0x964F,0x9651,0x9652,0x9653,0x9656,0x9657, 0, +0x9658,0x9659,0x965A,0x965C,0x965D,0x965E,0x9660,0x9663, +0x9665,0x9666,0x966B,0x966D,0x966E,0x966F,0x9670,0x9671, +0x9673,0x9678,0x9679,0x967A,0x967B,0x967C,0x967D,0x967E, +0x967F,0x9680,0x9681,0x9682,0x9683,0x9684,0x9687,0x9689, +0x968A,0x8F8D,0x8F8E,0x8F8F,0x8F98,0x8F9A,0x8ECE,0x620B, +0x6217,0x621B,0x621F,0x6222,0x6221,0x6225,0x6224,0x622C, +0x81E7,0x74EF,0x74F4,0x74FF,0x750F,0x7511,0x7513,0x6534, +0x65EE,0x65EF,0x65F0,0x660A,0x6619,0x6772,0x6603,0x6615, +0x6600,0x7085,0x66F7,0x661D,0x6634,0x6631,0x6636,0x6635, +0x8006,0x665F,0x6654,0x6641,0x664F,0x6656,0x6661,0x6657, +0x6677,0x6684,0x668C,0x66A7,0x669D,0x66BE,0x66DB,0x66DC, +0x66E6,0x66E9,0x8D32,0x8D33,0x8D36,0x8D3B,0x8D3D,0x8D40, +0x8D45,0x8D46,0x8D48,0x8D49,0x8D47,0x8D4D,0x8D55,0x8D59, +0x89C7,0x89CA,0x89CB,0x89CC,0x89CE,0x89CF,0x89D0,0x89D1, +0x726E,0x729F,0x725D,0x7266,0x726F,0x727E,0x727F,0x7284, +0x728B,0x728D,0x728F,0x7292,0x6308,0x6332,0x63B0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x968C,0x968E,0x9691,0x9692,0x9693,0x9695,0x9696,0x969A, +0x969B,0x969D,0x969E,0x969F,0x96A0,0x96A1,0x96A2,0x96A3, +0x96A4,0x96A5,0x96A6,0x96A8,0x96A9,0x96AA,0x96AB,0x96AC, +0x96AD,0x96AE,0x96AF,0x96B1,0x96B2,0x96B4,0x96B5,0x96B7, +0x96B8,0x96BA,0x96BB,0x96BF,0x96C2,0x96C3,0x96C8,0x96CA, +0x96CB,0x96D0,0x96D1,0x96D3,0x96D4,0x96D6,0x96D7,0x96D8, +0x96D9,0x96DA,0x96DB,0x96DC,0x96DD,0x96DE,0x96DF,0x96E1, +0x96E2,0x96E3,0x96E4,0x96E5,0x96E6,0x96E7,0x96EB, 0, +0x96EC,0x96ED,0x96EE,0x96F0,0x96F1,0x96F2,0x96F4,0x96F5, +0x96F8,0x96FA,0x96FB,0x96FC,0x96FD,0x96FF,0x9702,0x9703, +0x9705,0x970A,0x970B,0x970C,0x9710,0x9711,0x9712,0x9714, +0x9715,0x9717,0x9718,0x9719,0x971A,0x971B,0x971D,0x971F, +0x9720,0x643F,0x64D8,0x8004,0x6BEA,0x6BF3,0x6BFD,0x6BF5, +0x6BF9,0x6C05,0x6C07,0x6C06,0x6C0D,0x6C15,0x6C18,0x6C19, +0x6C1A,0x6C21,0x6C29,0x6C24,0x6C2A,0x6C32,0x6535,0x6555, +0x656B,0x724D,0x7252,0x7256,0x7230,0x8662,0x5216,0x809F, +0x809C,0x8093,0x80BC,0x670A,0x80BD,0x80B1,0x80AB,0x80AD, +0x80B4,0x80B7,0x80E7,0x80E8,0x80E9,0x80EA,0x80DB,0x80C2, +0x80C4,0x80D9,0x80CD,0x80D7,0x6710,0x80DD,0x80EB,0x80F1, +0x80F4,0x80ED,0x810D,0x810E,0x80F2,0x80FC,0x6715,0x8112, +0x8C5A,0x8136,0x811E,0x812C,0x8118,0x8132,0x8148,0x814C, +0x8153,0x8174,0x8159,0x815A,0x8171,0x8160,0x8169,0x817C, +0x817D,0x816D,0x8167,0x584D,0x5AB5,0x8188,0x8182,0x8191, +0x6ED5,0x81A3,0x81AA,0x81CC,0x6726,0x81CA,0x81BB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9721,0x9722,0x9723,0x9724,0x9725,0x9726,0x9727,0x9728, +0x9729,0x972B,0x972C,0x972E,0x972F,0x9731,0x9733,0x9734, +0x9735,0x9736,0x9737,0x973A,0x973B,0x973C,0x973D,0x973F, +0x9740,0x9741,0x9742,0x9743,0x9744,0x9745,0x9746,0x9747, +0x9748,0x9749,0x974A,0x974B,0x974C,0x974D,0x974E,0x974F, +0x9750,0x9751,0x9754,0x9755,0x9757,0x9758,0x975A,0x975C, +0x975D,0x975F,0x9763,0x9764,0x9766,0x9767,0x9768,0x976A, +0x976B,0x976C,0x976D,0x976E,0x976F,0x9770,0x9771, 0, +0x9772,0x9775,0x9777,0x9778,0x9779,0x977A,0x977B,0x977D, +0x977E,0x977F,0x9780,0x9781,0x9782,0x9783,0x9784,0x9786, +0x9787,0x9788,0x9789,0x978A,0x978C,0x978E,0x978F,0x9790, +0x9793,0x9795,0x9796,0x9797,0x9799,0x979A,0x979B,0x979C, +0x979D,0x81C1,0x81A6,0x6B24,0x6B37,0x6B39,0x6B43,0x6B46, +0x6B59,0x98D1,0x98D2,0x98D3,0x98D5,0x98D9,0x98DA,0x6BB3, +0x5F40,0x6BC2,0x89F3,0x6590,0x9F51,0x6593,0x65BC,0x65C6, +0x65C4,0x65C3,0x65CC,0x65CE,0x65D2,0x65D6,0x7080,0x709C, +0x7096,0x709D,0x70BB,0x70C0,0x70B7,0x70AB,0x70B1,0x70E8, +0x70CA,0x7110,0x7113,0x7116,0x712F,0x7131,0x7173,0x715C, +0x7168,0x7145,0x7172,0x714A,0x7178,0x717A,0x7198,0x71B3, +0x71B5,0x71A8,0x71A0,0x71E0,0x71D4,0x71E7,0x71F9,0x721D, +0x7228,0x706C,0x7118,0x7166,0x71B9,0x623E,0x623D,0x6243, +0x6248,0x6249,0x793B,0x7940,0x7946,0x7949,0x795B,0x795C, +0x7953,0x795A,0x7962,0x7957,0x7960,0x796F,0x7967,0x797A, +0x7985,0x798A,0x799A,0x79A7,0x79B3,0x5FD1,0x5FD0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x979E,0x979F,0x97A1,0x97A2,0x97A4,0x97A5,0x97A6,0x97A7, +0x97A8,0x97A9,0x97AA,0x97AC,0x97AE,0x97B0,0x97B1,0x97B3, +0x97B5,0x97B6,0x97B7,0x97B8,0x97B9,0x97BA,0x97BB,0x97BC, +0x97BD,0x97BE,0x97BF,0x97C0,0x97C1,0x97C2,0x97C3,0x97C4, +0x97C5,0x97C6,0x97C7,0x97C8,0x97C9,0x97CA,0x97CB,0x97CC, +0x97CD,0x97CE,0x97CF,0x97D0,0x97D1,0x97D2,0x97D3,0x97D4, +0x97D5,0x97D6,0x97D7,0x97D8,0x97D9,0x97DA,0x97DB,0x97DC, +0x97DD,0x97DE,0x97DF,0x97E0,0x97E1,0x97E2,0x97E3, 0, +0x97E4,0x97E5,0x97E8,0x97EE,0x97EF,0x97F0,0x97F1,0x97F2, +0x97F4,0x97F7,0x97F8,0x97F9,0x97FA,0x97FB,0x97FC,0x97FD, +0x97FE,0x97FF,0x9800,0x9801,0x9802,0x9803,0x9804,0x9805, +0x9806,0x9807,0x9808,0x9809,0x980A,0x980B,0x980C,0x980D, +0x980E,0x603C,0x605D,0x605A,0x6067,0x6041,0x6059,0x6063, +0x60AB,0x6106,0x610D,0x615D,0x61A9,0x619D,0x61CB,0x61D1, +0x6206,0x8080,0x807F,0x6C93,0x6CF6,0x6DFC,0x77F6,0x77F8, +0x7800,0x7809,0x7817,0x7818,0x7811,0x65AB,0x782D,0x781C, +0x781D,0x7839,0x783A,0x783B,0x781F,0x783C,0x7825,0x782C, +0x7823,0x7829,0x784E,0x786D,0x7856,0x7857,0x7826,0x7850, +0x7847,0x784C,0x786A,0x789B,0x7893,0x789A,0x7887,0x789C, +0x78A1,0x78A3,0x78B2,0x78B9,0x78A5,0x78D4,0x78D9,0x78C9, +0x78EC,0x78F2,0x7905,0x78F4,0x7913,0x7924,0x791E,0x7934, +0x9F9B,0x9EF9,0x9EFB,0x9EFC,0x76F1,0x7704,0x770D,0x76F9, +0x7707,0x7708,0x771A,0x7722,0x7719,0x772D,0x7726,0x7735, +0x7738,0x7750,0x7751,0x7747,0x7743,0x775A,0x7768, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x980F,0x9810,0x9811,0x9812,0x9813,0x9814,0x9815,0x9816, +0x9817,0x9818,0x9819,0x981A,0x981B,0x981C,0x981D,0x981E, +0x981F,0x9820,0x9821,0x9822,0x9823,0x9824,0x9825,0x9826, +0x9827,0x9828,0x9829,0x982A,0x982B,0x982C,0x982D,0x982E, +0x982F,0x9830,0x9831,0x9832,0x9833,0x9834,0x9835,0x9836, +0x9837,0x9838,0x9839,0x983A,0x983B,0x983C,0x983D,0x983E, +0x983F,0x9840,0x9841,0x9842,0x9843,0x9844,0x9845,0x9846, +0x9847,0x9848,0x9849,0x984A,0x984B,0x984C,0x984D, 0, +0x984E,0x984F,0x9850,0x9851,0x9852,0x9853,0x9854,0x9855, +0x9856,0x9857,0x9858,0x9859,0x985A,0x985B,0x985C,0x985D, +0x985E,0x985F,0x9860,0x9861,0x9862,0x9863,0x9864,0x9865, +0x9866,0x9867,0x9868,0x9869,0x986A,0x986B,0x986C,0x986D, +0x986E,0x7762,0x7765,0x777F,0x778D,0x777D,0x7780,0x778C, +0x7791,0x779F,0x77A0,0x77B0,0x77B5,0x77BD,0x753A,0x7540, +0x754E,0x754B,0x7548,0x755B,0x7572,0x7579,0x7583,0x7F58, +0x7F61,0x7F5F,0x8A48,0x7F68,0x7F74,0x7F71,0x7F79,0x7F81, +0x7F7E,0x76CD,0x76E5,0x8832,0x9485,0x9486,0x9487,0x948B, +0x948A,0x948C,0x948D,0x948F,0x9490,0x9494,0x9497,0x9495, +0x949A,0x949B,0x949C,0x94A3,0x94A4,0x94AB,0x94AA,0x94AD, +0x94AC,0x94AF,0x94B0,0x94B2,0x94B4,0x94B6,0x94B7,0x94B8, +0x94B9,0x94BA,0x94BC,0x94BD,0x94BF,0x94C4,0x94C8,0x94C9, +0x94CA,0x94CB,0x94CC,0x94CD,0x94CE,0x94D0,0x94D1,0x94D2, +0x94D5,0x94D6,0x94D7,0x94D9,0x94D8,0x94DB,0x94DE,0x94DF, +0x94E0,0x94E2,0x94E4,0x94E5,0x94E7,0x94E8,0x94EA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x986F,0x9870,0x9871,0x9872,0x9873,0x9874,0x988B,0x988E, +0x9892,0x9895,0x9899,0x98A3,0x98A8,0x98A9,0x98AA,0x98AB, +0x98AC,0x98AD,0x98AE,0x98AF,0x98B0,0x98B1,0x98B2,0x98B3, +0x98B4,0x98B5,0x98B6,0x98B7,0x98B8,0x98B9,0x98BA,0x98BB, +0x98BC,0x98BD,0x98BE,0x98BF,0x98C0,0x98C1,0x98C2,0x98C3, +0x98C4,0x98C5,0x98C6,0x98C7,0x98C8,0x98C9,0x98CA,0x98CB, +0x98CC,0x98CD,0x98CF,0x98D0,0x98D4,0x98D6,0x98D7,0x98DB, +0x98DC,0x98DD,0x98E0,0x98E1,0x98E2,0x98E3,0x98E4, 0, +0x98E5,0x98E6,0x98E9,0x98EA,0x98EB,0x98EC,0x98ED,0x98EE, +0x98EF,0x98F0,0x98F1,0x98F2,0x98F3,0x98F4,0x98F5,0x98F6, +0x98F7,0x98F8,0x98F9,0x98FA,0x98FB,0x98FC,0x98FD,0x98FE, +0x98FF,0x9900,0x9901,0x9902,0x9903,0x9904,0x9905,0x9906, +0x9907,0x94E9,0x94EB,0x94EE,0x94EF,0x94F3,0x94F4,0x94F5, +0x94F7,0x94F9,0x94FC,0x94FD,0x94FF,0x9503,0x9502,0x9506, +0x9507,0x9509,0x950A,0x950D,0x950E,0x950F,0x9512,0x9513, +0x9514,0x9515,0x9516,0x9518,0x951B,0x951D,0x951E,0x951F, +0x9522,0x952A,0x952B,0x9529,0x952C,0x9531,0x9532,0x9534, +0x9536,0x9537,0x9538,0x953C,0x953E,0x953F,0x9542,0x9535, +0x9544,0x9545,0x9546,0x9549,0x954C,0x954E,0x954F,0x9552, +0x9553,0x9554,0x9556,0x9557,0x9558,0x9559,0x955B,0x955E, +0x955F,0x955D,0x9561,0x9562,0x9564,0x9565,0x9566,0x9567, +0x9568,0x9569,0x956A,0x956B,0x956C,0x956F,0x9571,0x9572, +0x9573,0x953A,0x77E7,0x77EC,0x96C9,0x79D5,0x79ED,0x79E3, +0x79EB,0x7A06,0x5D47,0x7A03,0x7A02,0x7A1E,0x7A14, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9908,0x9909,0x990A,0x990B,0x990C,0x990E,0x990F,0x9911, +0x9912,0x9913,0x9914,0x9915,0x9916,0x9917,0x9918,0x9919, +0x991A,0x991B,0x991C,0x991D,0x991E,0x991F,0x9920,0x9921, +0x9922,0x9923,0x9924,0x9925,0x9926,0x9927,0x9928,0x9929, +0x992A,0x992B,0x992C,0x992D,0x992F,0x9930,0x9931,0x9932, +0x9933,0x9934,0x9935,0x9936,0x9937,0x9938,0x9939,0x993A, +0x993B,0x993C,0x993D,0x993E,0x993F,0x9940,0x9941,0x9942, +0x9943,0x9944,0x9945,0x9946,0x9947,0x9948,0x9949, 0, +0x994A,0x994B,0x994C,0x994D,0x994E,0x994F,0x9950,0x9951, +0x9952,0x9953,0x9956,0x9957,0x9958,0x9959,0x995A,0x995B, +0x995C,0x995D,0x995E,0x995F,0x9960,0x9961,0x9962,0x9964, +0x9966,0x9973,0x9978,0x9979,0x997B,0x997E,0x9982,0x9983, +0x9989,0x7A39,0x7A37,0x7A51,0x9ECF,0x99A5,0x7A70,0x7688, +0x768E,0x7693,0x7699,0x76A4,0x74DE,0x74E0,0x752C,0x9E20, +0x9E22,0x9E28,0x9E29,0x9E2A,0x9E2B,0x9E2C,0x9E32,0x9E31, +0x9E36,0x9E38,0x9E37,0x9E39,0x9E3A,0x9E3E,0x9E41,0x9E42, +0x9E44,0x9E46,0x9E47,0x9E48,0x9E49,0x9E4B,0x9E4C,0x9E4E, +0x9E51,0x9E55,0x9E57,0x9E5A,0x9E5B,0x9E5C,0x9E5E,0x9E63, +0x9E66,0x9E67,0x9E68,0x9E69,0x9E6A,0x9E6B,0x9E6C,0x9E71, +0x9E6D,0x9E73,0x7592,0x7594,0x7596,0x75A0,0x759D,0x75AC, +0x75A3,0x75B3,0x75B4,0x75B8,0x75C4,0x75B1,0x75B0,0x75C3, +0x75C2,0x75D6,0x75CD,0x75E3,0x75E8,0x75E6,0x75E4,0x75EB, +0x75E7,0x7603,0x75F1,0x75FC,0x75FF,0x7610,0x7600,0x7605, +0x760C,0x7617,0x760A,0x7625,0x7618,0x7615,0x7619, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x998C,0x998E,0x999A,0x999B,0x999C,0x999D,0x999E,0x999F, +0x99A0,0x99A1,0x99A2,0x99A3,0x99A4,0x99A6,0x99A7,0x99A9, +0x99AA,0x99AB,0x99AC,0x99AD,0x99AE,0x99AF,0x99B0,0x99B1, +0x99B2,0x99B3,0x99B4,0x99B5,0x99B6,0x99B7,0x99B8,0x99B9, +0x99BA,0x99BB,0x99BC,0x99BD,0x99BE,0x99BF,0x99C0,0x99C1, +0x99C2,0x99C3,0x99C4,0x99C5,0x99C6,0x99C7,0x99C8,0x99C9, +0x99CA,0x99CB,0x99CC,0x99CD,0x99CE,0x99CF,0x99D0,0x99D1, +0x99D2,0x99D3,0x99D4,0x99D5,0x99D6,0x99D7,0x99D8, 0, +0x99D9,0x99DA,0x99DB,0x99DC,0x99DD,0x99DE,0x99DF,0x99E0, +0x99E1,0x99E2,0x99E3,0x99E4,0x99E5,0x99E6,0x99E7,0x99E8, +0x99E9,0x99EA,0x99EB,0x99EC,0x99ED,0x99EE,0x99EF,0x99F0, +0x99F1,0x99F2,0x99F3,0x99F4,0x99F5,0x99F6,0x99F7,0x99F8, +0x99F9,0x761B,0x763C,0x7622,0x7620,0x7640,0x762D,0x7630, +0x763F,0x7635,0x7643,0x763E,0x7633,0x764D,0x765E,0x7654, +0x765C,0x7656,0x766B,0x766F,0x7FCA,0x7AE6,0x7A78,0x7A79, +0x7A80,0x7A86,0x7A88,0x7A95,0x7AA6,0x7AA0,0x7AAC,0x7AA8, +0x7AAD,0x7AB3,0x8864,0x8869,0x8872,0x887D,0x887F,0x8882, +0x88A2,0x88C6,0x88B7,0x88BC,0x88C9,0x88E2,0x88CE,0x88E3, +0x88E5,0x88F1,0x891A,0x88FC,0x88E8,0x88FE,0x88F0,0x8921, +0x8919,0x8913,0x891B,0x890A,0x8934,0x892B,0x8936,0x8941, +0x8966,0x897B,0x758B,0x80E5,0x76B2,0x76B4,0x77DC,0x8012, +0x8014,0x8016,0x801C,0x8020,0x8022,0x8025,0x8026,0x8027, +0x8029,0x8028,0x8031,0x800B,0x8035,0x8043,0x8046,0x804D, +0x8052,0x8069,0x8071,0x8983,0x9878,0x9880,0x9883, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x99FA,0x99FB,0x99FC,0x99FD,0x99FE,0x99FF,0x9A00,0x9A01, +0x9A02,0x9A03,0x9A04,0x9A05,0x9A06,0x9A07,0x9A08,0x9A09, +0x9A0A,0x9A0B,0x9A0C,0x9A0D,0x9A0E,0x9A0F,0x9A10,0x9A11, +0x9A12,0x9A13,0x9A14,0x9A15,0x9A16,0x9A17,0x9A18,0x9A19, +0x9A1A,0x9A1B,0x9A1C,0x9A1D,0x9A1E,0x9A1F,0x9A20,0x9A21, +0x9A22,0x9A23,0x9A24,0x9A25,0x9A26,0x9A27,0x9A28,0x9A29, +0x9A2A,0x9A2B,0x9A2C,0x9A2D,0x9A2E,0x9A2F,0x9A30,0x9A31, +0x9A32,0x9A33,0x9A34,0x9A35,0x9A36,0x9A37,0x9A38, 0, +0x9A39,0x9A3A,0x9A3B,0x9A3C,0x9A3D,0x9A3E,0x9A3F,0x9A40, +0x9A41,0x9A42,0x9A43,0x9A44,0x9A45,0x9A46,0x9A47,0x9A48, +0x9A49,0x9A4A,0x9A4B,0x9A4C,0x9A4D,0x9A4E,0x9A4F,0x9A50, +0x9A51,0x9A52,0x9A53,0x9A54,0x9A55,0x9A56,0x9A57,0x9A58, +0x9A59,0x9889,0x988C,0x988D,0x988F,0x9894,0x989A,0x989B, +0x989E,0x989F,0x98A1,0x98A2,0x98A5,0x98A6,0x864D,0x8654, +0x866C,0x866E,0x867F,0x867A,0x867C,0x867B,0x86A8,0x868D, +0x868B,0x86AC,0x869D,0x86A7,0x86A3,0x86AA,0x8693,0x86A9, +0x86B6,0x86C4,0x86B5,0x86CE,0x86B0,0x86BA,0x86B1,0x86AF, +0x86C9,0x86CF,0x86B4,0x86E9,0x86F1,0x86F2,0x86ED,0x86F3, +0x86D0,0x8713,0x86DE,0x86F4,0x86DF,0x86D8,0x86D1,0x8703, +0x8707,0x86F8,0x8708,0x870A,0x870D,0x8709,0x8723,0x873B, +0x871E,0x8725,0x872E,0x871A,0x873E,0x8748,0x8734,0x8731, +0x8729,0x8737,0x873F,0x8782,0x8722,0x877D,0x877E,0x877B, +0x8760,0x8770,0x874C,0x876E,0x878B,0x8753,0x8763,0x877C, +0x8764,0x8759,0x8765,0x8793,0x87AF,0x87A8,0x87D2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9A5A,0x9A5B,0x9A5C,0x9A5D,0x9A5E,0x9A5F,0x9A60,0x9A61, +0x9A62,0x9A63,0x9A64,0x9A65,0x9A66,0x9A67,0x9A68,0x9A69, +0x9A6A,0x9A6B,0x9A72,0x9A83,0x9A89,0x9A8D,0x9A8E,0x9A94, +0x9A95,0x9A99,0x9AA6,0x9AA9,0x9AAA,0x9AAB,0x9AAC,0x9AAD, +0x9AAE,0x9AAF,0x9AB2,0x9AB3,0x9AB4,0x9AB5,0x9AB9,0x9ABB, +0x9ABD,0x9ABE,0x9ABF,0x9AC3,0x9AC4,0x9AC6,0x9AC7,0x9AC8, +0x9AC9,0x9ACA,0x9ACD,0x9ACE,0x9ACF,0x9AD0,0x9AD2,0x9AD4, +0x9AD5,0x9AD6,0x9AD7,0x9AD9,0x9ADA,0x9ADB,0x9ADC, 0, +0x9ADD,0x9ADE,0x9AE0,0x9AE2,0x9AE3,0x9AE4,0x9AE5,0x9AE7, +0x9AE8,0x9AE9,0x9AEA,0x9AEC,0x9AEE,0x9AF0,0x9AF1,0x9AF2, +0x9AF3,0x9AF4,0x9AF5,0x9AF6,0x9AF7,0x9AF8,0x9AFA,0x9AFC, +0x9AFD,0x9AFE,0x9AFF,0x9B00,0x9B01,0x9B02,0x9B04,0x9B05, +0x9B06,0x87C6,0x8788,0x8785,0x87AD,0x8797,0x8783,0x87AB, +0x87E5,0x87AC,0x87B5,0x87B3,0x87CB,0x87D3,0x87BD,0x87D1, +0x87C0,0x87CA,0x87DB,0x87EA,0x87E0,0x87EE,0x8816,0x8813, +0x87FE,0x880A,0x881B,0x8821,0x8839,0x883C,0x7F36,0x7F42, +0x7F44,0x7F45,0x8210,0x7AFA,0x7AFD,0x7B08,0x7B03,0x7B04, +0x7B15,0x7B0A,0x7B2B,0x7B0F,0x7B47,0x7B38,0x7B2A,0x7B19, +0x7B2E,0x7B31,0x7B20,0x7B25,0x7B24,0x7B33,0x7B3E,0x7B1E, +0x7B58,0x7B5A,0x7B45,0x7B75,0x7B4C,0x7B5D,0x7B60,0x7B6E, +0x7B7B,0x7B62,0x7B72,0x7B71,0x7B90,0x7BA6,0x7BA7,0x7BB8, +0x7BAC,0x7B9D,0x7BA8,0x7B85,0x7BAA,0x7B9C,0x7BA2,0x7BAB, +0x7BB4,0x7BD1,0x7BC1,0x7BCC,0x7BDD,0x7BDA,0x7BE5,0x7BE6, +0x7BEA,0x7C0C,0x7BFE,0x7BFC,0x7C0F,0x7C16,0x7C0B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9B07,0x9B09,0x9B0A,0x9B0B,0x9B0C,0x9B0D,0x9B0E,0x9B10, +0x9B11,0x9B12,0x9B14,0x9B15,0x9B16,0x9B17,0x9B18,0x9B19, +0x9B1A,0x9B1B,0x9B1C,0x9B1D,0x9B1E,0x9B20,0x9B21,0x9B22, +0x9B24,0x9B25,0x9B26,0x9B27,0x9B28,0x9B29,0x9B2A,0x9B2B, +0x9B2C,0x9B2D,0x9B2E,0x9B30,0x9B31,0x9B33,0x9B34,0x9B35, +0x9B36,0x9B37,0x9B38,0x9B39,0x9B3A,0x9B3D,0x9B3E,0x9B3F, +0x9B40,0x9B46,0x9B4A,0x9B4B,0x9B4C,0x9B4E,0x9B50,0x9B52, +0x9B53,0x9B55,0x9B56,0x9B57,0x9B58,0x9B59,0x9B5A, 0, +0x9B5B,0x9B5C,0x9B5D,0x9B5E,0x9B5F,0x9B60,0x9B61,0x9B62, +0x9B63,0x9B64,0x9B65,0x9B66,0x9B67,0x9B68,0x9B69,0x9B6A, +0x9B6B,0x9B6C,0x9B6D,0x9B6E,0x9B6F,0x9B70,0x9B71,0x9B72, +0x9B73,0x9B74,0x9B75,0x9B76,0x9B77,0x9B78,0x9B79,0x9B7A, +0x9B7B,0x7C1F,0x7C2A,0x7C26,0x7C38,0x7C41,0x7C40,0x81FE, +0x8201,0x8202,0x8204,0x81EC,0x8844,0x8221,0x8222,0x8223, +0x822D,0x822F,0x8228,0x822B,0x8238,0x823B,0x8233,0x8234, +0x823E,0x8244,0x8249,0x824B,0x824F,0x825A,0x825F,0x8268, +0x887E,0x8885,0x8888,0x88D8,0x88DF,0x895E,0x7F9D,0x7F9F, +0x7FA7,0x7FAF,0x7FB0,0x7FB2,0x7C7C,0x6549,0x7C91,0x7C9D, +0x7C9C,0x7C9E,0x7CA2,0x7CB2,0x7CBC,0x7CBD,0x7CC1,0x7CC7, +0x7CCC,0x7CCD,0x7CC8,0x7CC5,0x7CD7,0x7CE8,0x826E,0x66A8, +0x7FBF,0x7FCE,0x7FD5,0x7FE5,0x7FE1,0x7FE6,0x7FE9,0x7FEE, +0x7FF3,0x7CF8,0x7D77,0x7DA6,0x7DAE,0x7E47,0x7E9B,0x9EB8, +0x9EB4,0x8D73,0x8D84,0x8D94,0x8D91,0x8DB1,0x8D67,0x8D6D, +0x8C47,0x8C49,0x914A,0x9150,0x914E,0x914F,0x9164, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9B7C,0x9B7D,0x9B7E,0x9B7F,0x9B80,0x9B81,0x9B82,0x9B83, +0x9B84,0x9B85,0x9B86,0x9B87,0x9B88,0x9B89,0x9B8A,0x9B8B, +0x9B8C,0x9B8D,0x9B8E,0x9B8F,0x9B90,0x9B91,0x9B92,0x9B93, +0x9B94,0x9B95,0x9B96,0x9B97,0x9B98,0x9B99,0x9B9A,0x9B9B, +0x9B9C,0x9B9D,0x9B9E,0x9B9F,0x9BA0,0x9BA1,0x9BA2,0x9BA3, +0x9BA4,0x9BA5,0x9BA6,0x9BA7,0x9BA8,0x9BA9,0x9BAA,0x9BAB, +0x9BAC,0x9BAD,0x9BAE,0x9BAF,0x9BB0,0x9BB1,0x9BB2,0x9BB3, +0x9BB4,0x9BB5,0x9BB6,0x9BB7,0x9BB8,0x9BB9,0x9BBA, 0, +0x9BBB,0x9BBC,0x9BBD,0x9BBE,0x9BBF,0x9BC0,0x9BC1,0x9BC2, +0x9BC3,0x9BC4,0x9BC5,0x9BC6,0x9BC7,0x9BC8,0x9BC9,0x9BCA, +0x9BCB,0x9BCC,0x9BCD,0x9BCE,0x9BCF,0x9BD0,0x9BD1,0x9BD2, +0x9BD3,0x9BD4,0x9BD5,0x9BD6,0x9BD7,0x9BD8,0x9BD9,0x9BDA, +0x9BDB,0x9162,0x9161,0x9170,0x9169,0x916F,0x917D,0x917E, +0x9172,0x9174,0x9179,0x918C,0x9185,0x9190,0x918D,0x9191, +0x91A2,0x91A3,0x91AA,0x91AD,0x91AE,0x91AF,0x91B5,0x91B4, +0x91BA,0x8C55,0x9E7E,0x8DB8,0x8DEB,0x8E05,0x8E59,0x8E69, +0x8DB5,0x8DBF,0x8DBC,0x8DBA,0x8DC4,0x8DD6,0x8DD7,0x8DDA, +0x8DDE,0x8DCE,0x8DCF,0x8DDB,0x8DC6,0x8DEC,0x8DF7,0x8DF8, +0x8DE3,0x8DF9,0x8DFB,0x8DE4,0x8E09,0x8DFD,0x8E14,0x8E1D, +0x8E1F,0x8E2C,0x8E2E,0x8E23,0x8E2F,0x8E3A,0x8E40,0x8E39, +0x8E35,0x8E3D,0x8E31,0x8E49,0x8E41,0x8E42,0x8E51,0x8E52, +0x8E4A,0x8E70,0x8E76,0x8E7C,0x8E6F,0x8E74,0x8E85,0x8E8F, +0x8E94,0x8E90,0x8E9C,0x8E9E,0x8C78,0x8C82,0x8C8A,0x8C85, +0x8C98,0x8C94,0x659B,0x89D6,0x89DE,0x89DA,0x89DC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9BDC,0x9BDD,0x9BDE,0x9BDF,0x9BE0,0x9BE1,0x9BE2,0x9BE3, +0x9BE4,0x9BE5,0x9BE6,0x9BE7,0x9BE8,0x9BE9,0x9BEA,0x9BEB, +0x9BEC,0x9BED,0x9BEE,0x9BEF,0x9BF0,0x9BF1,0x9BF2,0x9BF3, +0x9BF4,0x9BF5,0x9BF6,0x9BF7,0x9BF8,0x9BF9,0x9BFA,0x9BFB, +0x9BFC,0x9BFD,0x9BFE,0x9BFF,0x9C00,0x9C01,0x9C02,0x9C03, +0x9C04,0x9C05,0x9C06,0x9C07,0x9C08,0x9C09,0x9C0A,0x9C0B, +0x9C0C,0x9C0D,0x9C0E,0x9C0F,0x9C10,0x9C11,0x9C12,0x9C13, +0x9C14,0x9C15,0x9C16,0x9C17,0x9C18,0x9C19,0x9C1A, 0, +0x9C1B,0x9C1C,0x9C1D,0x9C1E,0x9C1F,0x9C20,0x9C21,0x9C22, +0x9C23,0x9C24,0x9C25,0x9C26,0x9C27,0x9C28,0x9C29,0x9C2A, +0x9C2B,0x9C2C,0x9C2D,0x9C2E,0x9C2F,0x9C30,0x9C31,0x9C32, +0x9C33,0x9C34,0x9C35,0x9C36,0x9C37,0x9C38,0x9C39,0x9C3A, +0x9C3B,0x89E5,0x89EB,0x89EF,0x8A3E,0x8B26,0x9753,0x96E9, +0x96F3,0x96EF,0x9706,0x9701,0x9708,0x970F,0x970E,0x972A, +0x972D,0x9730,0x973E,0x9F80,0x9F83,0x9F85,0x9F86,0x9F87, +0x9F88,0x9F89,0x9F8A,0x9F8C,0x9EFE,0x9F0B,0x9F0D,0x96B9, +0x96BC,0x96BD,0x96CE,0x96D2,0x77BF,0x96E0,0x928E,0x92AE, +0x92C8,0x933E,0x936A,0x93CA,0x938F,0x943E,0x946B,0x9C7F, +0x9C82,0x9C85,0x9C86,0x9C87,0x9C88,0x7A23,0x9C8B,0x9C8E, +0x9C90,0x9C91,0x9C92,0x9C94,0x9C95,0x9C9A,0x9C9B,0x9C9E, +0x9C9F,0x9CA0,0x9CA1,0x9CA2,0x9CA3,0x9CA5,0x9CA6,0x9CA7, +0x9CA8,0x9CA9,0x9CAB,0x9CAD,0x9CAE,0x9CB0,0x9CB1,0x9CB2, +0x9CB3,0x9CB4,0x9CB5,0x9CB6,0x9CB7,0x9CBA,0x9CBB,0x9CBC, +0x9CBD,0x9CC4,0x9CC5,0x9CC6,0x9CC7,0x9CCA,0x9CCB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9C3C,0x9C3D,0x9C3E,0x9C3F,0x9C40,0x9C41,0x9C42,0x9C43, +0x9C44,0x9C45,0x9C46,0x9C47,0x9C48,0x9C49,0x9C4A,0x9C4B, +0x9C4C,0x9C4D,0x9C4E,0x9C4F,0x9C50,0x9C51,0x9C52,0x9C53, +0x9C54,0x9C55,0x9C56,0x9C57,0x9C58,0x9C59,0x9C5A,0x9C5B, +0x9C5C,0x9C5D,0x9C5E,0x9C5F,0x9C60,0x9C61,0x9C62,0x9C63, +0x9C64,0x9C65,0x9C66,0x9C67,0x9C68,0x9C69,0x9C6A,0x9C6B, +0x9C6C,0x9C6D,0x9C6E,0x9C6F,0x9C70,0x9C71,0x9C72,0x9C73, +0x9C74,0x9C75,0x9C76,0x9C77,0x9C78,0x9C79,0x9C7A, 0, +0x9C7B,0x9C7D,0x9C7E,0x9C80,0x9C83,0x9C84,0x9C89,0x9C8A, +0x9C8C,0x9C8F,0x9C93,0x9C96,0x9C97,0x9C98,0x9C99,0x9C9D, +0x9CAA,0x9CAC,0x9CAF,0x9CB9,0x9CBE,0x9CBF,0x9CC0,0x9CC1, +0x9CC2,0x9CC8,0x9CC9,0x9CD1,0x9CD2,0x9CDA,0x9CDB,0x9CE0, +0x9CE1,0x9CCC,0x9CCD,0x9CCE,0x9CCF,0x9CD0,0x9CD3,0x9CD4, +0x9CD5,0x9CD7,0x9CD8,0x9CD9,0x9CDC,0x9CDD,0x9CDF,0x9CE2, +0x977C,0x9785,0x9791,0x9792,0x9794,0x97AF,0x97AB,0x97A3, +0x97B2,0x97B4,0x9AB1,0x9AB0,0x9AB7,0x9E58,0x9AB6,0x9ABA, +0x9ABC,0x9AC1,0x9AC0,0x9AC5,0x9AC2,0x9ACB,0x9ACC,0x9AD1, +0x9B45,0x9B43,0x9B47,0x9B49,0x9B48,0x9B4D,0x9B51,0x98E8, +0x990D,0x992E,0x9955,0x9954,0x9ADF,0x9AE1,0x9AE6,0x9AEF, +0x9AEB,0x9AFB,0x9AED,0x9AF9,0x9B08,0x9B0F,0x9B13,0x9B1F, +0x9B23,0x9EBD,0x9EBE,0x7E3B,0x9E82,0x9E87,0x9E88,0x9E8B, +0x9E92,0x93D6,0x9E9D,0x9E9F,0x9EDB,0x9EDC,0x9EDD,0x9EE0, +0x9EDF,0x9EE2,0x9EE9,0x9EE7,0x9EE5,0x9EEA,0x9EEF,0x9F22, +0x9F2C,0x9F2F,0x9F39,0x9F37,0x9F3D,0x9F3E,0x9F44, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9CE3,0x9CE4,0x9CE5,0x9CE6,0x9CE7,0x9CE8,0x9CE9,0x9CEA, +0x9CEB,0x9CEC,0x9CED,0x9CEE,0x9CEF,0x9CF0,0x9CF1,0x9CF2, +0x9CF3,0x9CF4,0x9CF5,0x9CF6,0x9CF7,0x9CF8,0x9CF9,0x9CFA, +0x9CFB,0x9CFC,0x9CFD,0x9CFE,0x9CFF,0x9D00,0x9D01,0x9D02, +0x9D03,0x9D04,0x9D05,0x9D06,0x9D07,0x9D08,0x9D09,0x9D0A, +0x9D0B,0x9D0C,0x9D0D,0x9D0E,0x9D0F,0x9D10,0x9D11,0x9D12, +0x9D13,0x9D14,0x9D15,0x9D16,0x9D17,0x9D18,0x9D19,0x9D1A, +0x9D1B,0x9D1C,0x9D1D,0x9D1E,0x9D1F,0x9D20,0x9D21, 0, +0x9D22,0x9D23,0x9D24,0x9D25,0x9D26,0x9D27,0x9D28,0x9D29, +0x9D2A,0x9D2B,0x9D2C,0x9D2D,0x9D2E,0x9D2F,0x9D30,0x9D31, +0x9D32,0x9D33,0x9D34,0x9D35,0x9D36,0x9D37,0x9D38,0x9D39, +0x9D3A,0x9D3B,0x9D3C,0x9D3D,0x9D3E,0x9D3F,0x9D40,0x9D41, +0x9D42, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9D43,0x9D44,0x9D45,0x9D46,0x9D47,0x9D48,0x9D49,0x9D4A, +0x9D4B,0x9D4C,0x9D4D,0x9D4E,0x9D4F,0x9D50,0x9D51,0x9D52, +0x9D53,0x9D54,0x9D55,0x9D56,0x9D57,0x9D58,0x9D59,0x9D5A, +0x9D5B,0x9D5C,0x9D5D,0x9D5E,0x9D5F,0x9D60,0x9D61,0x9D62, +0x9D63,0x9D64,0x9D65,0x9D66,0x9D67,0x9D68,0x9D69,0x9D6A, +0x9D6B,0x9D6C,0x9D6D,0x9D6E,0x9D6F,0x9D70,0x9D71,0x9D72, +0x9D73,0x9D74,0x9D75,0x9D76,0x9D77,0x9D78,0x9D79,0x9D7A, +0x9D7B,0x9D7C,0x9D7D,0x9D7E,0x9D7F,0x9D80,0x9D81, 0, +0x9D82,0x9D83,0x9D84,0x9D85,0x9D86,0x9D87,0x9D88,0x9D89, +0x9D8A,0x9D8B,0x9D8C,0x9D8D,0x9D8E,0x9D8F,0x9D90,0x9D91, +0x9D92,0x9D93,0x9D94,0x9D95,0x9D96,0x9D97,0x9D98,0x9D99, +0x9D9A,0x9D9B,0x9D9C,0x9D9D,0x9D9E,0x9D9F,0x9DA0,0x9DA1, +0x9DA2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9DA3,0x9DA4,0x9DA5,0x9DA6,0x9DA7,0x9DA8,0x9DA9,0x9DAA, +0x9DAB,0x9DAC,0x9DAD,0x9DAE,0x9DAF,0x9DB0,0x9DB1,0x9DB2, +0x9DB3,0x9DB4,0x9DB5,0x9DB6,0x9DB7,0x9DB8,0x9DB9,0x9DBA, +0x9DBB,0x9DBC,0x9DBD,0x9DBE,0x9DBF,0x9DC0,0x9DC1,0x9DC2, +0x9DC3,0x9DC4,0x9DC5,0x9DC6,0x9DC7,0x9DC8,0x9DC9,0x9DCA, +0x9DCB,0x9DCC,0x9DCD,0x9DCE,0x9DCF,0x9DD0,0x9DD1,0x9DD2, +0x9DD3,0x9DD4,0x9DD5,0x9DD6,0x9DD7,0x9DD8,0x9DD9,0x9DDA, +0x9DDB,0x9DDC,0x9DDD,0x9DDE,0x9DDF,0x9DE0,0x9DE1, 0, +0x9DE2,0x9DE3,0x9DE4,0x9DE5,0x9DE6,0x9DE7,0x9DE8,0x9DE9, +0x9DEA,0x9DEB,0x9DEC,0x9DED,0x9DEE,0x9DEF,0x9DF0,0x9DF1, +0x9DF2,0x9DF3,0x9DF4,0x9DF5,0x9DF6,0x9DF7,0x9DF8,0x9DF9, +0x9DFA,0x9DFB,0x9DFC,0x9DFD,0x9DFE,0x9DFF,0x9E00,0x9E01, +0x9E02, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9E03,0x9E04,0x9E05,0x9E06,0x9E07,0x9E08,0x9E09,0x9E0A, +0x9E0B,0x9E0C,0x9E0D,0x9E0E,0x9E0F,0x9E10,0x9E11,0x9E12, +0x9E13,0x9E14,0x9E15,0x9E16,0x9E17,0x9E18,0x9E19,0x9E1A, +0x9E1B,0x9E1C,0x9E1D,0x9E1E,0x9E24,0x9E27,0x9E2E,0x9E30, +0x9E34,0x9E3B,0x9E3C,0x9E40,0x9E4D,0x9E50,0x9E52,0x9E53, +0x9E54,0x9E56,0x9E59,0x9E5D,0x9E5F,0x9E60,0x9E61,0x9E62, +0x9E65,0x9E6E,0x9E6F,0x9E72,0x9E74,0x9E75,0x9E76,0x9E77, +0x9E78,0x9E79,0x9E7A,0x9E7B,0x9E7C,0x9E7D,0x9E80, 0, +0x9E81,0x9E83,0x9E84,0x9E85,0x9E86,0x9E89,0x9E8A,0x9E8C, +0x9E8D,0x9E8E,0x9E8F,0x9E90,0x9E91,0x9E94,0x9E95,0x9E96, +0x9E97,0x9E98,0x9E99,0x9E9A,0x9E9B,0x9E9C,0x9E9E,0x9EA0, +0x9EA1,0x9EA2,0x9EA3,0x9EA4,0x9EA5,0x9EA7,0x9EA8,0x9EA9, +0x9EAA, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9EAB,0x9EAC,0x9EAD,0x9EAE,0x9EAF,0x9EB0,0x9EB1,0x9EB2, +0x9EB3,0x9EB5,0x9EB6,0x9EB7,0x9EB9,0x9EBA,0x9EBC,0x9EBF, +0x9EC0,0x9EC1,0x9EC2,0x9EC3,0x9EC5,0x9EC6,0x9EC7,0x9EC8, +0x9ECA,0x9ECB,0x9ECC,0x9ED0,0x9ED2,0x9ED3,0x9ED5,0x9ED6, +0x9ED7,0x9ED9,0x9EDA,0x9EDE,0x9EE1,0x9EE3,0x9EE4,0x9EE6, +0x9EE8,0x9EEB,0x9EEC,0x9EED,0x9EEE,0x9EF0,0x9EF1,0x9EF2, +0x9EF3,0x9EF4,0x9EF5,0x9EF6,0x9EF7,0x9EF8,0x9EFA,0x9EFD, +0x9EFF,0x9F00,0x9F01,0x9F02,0x9F03,0x9F04,0x9F05, 0, +0x9F06,0x9F07,0x9F08,0x9F09,0x9F0A,0x9F0C,0x9F0F,0x9F11, +0x9F12,0x9F14,0x9F15,0x9F16,0x9F18,0x9F1A,0x9F1B,0x9F1C, +0x9F1D,0x9F1E,0x9F1F,0x9F21,0x9F23,0x9F24,0x9F25,0x9F26, +0x9F27,0x9F28,0x9F29,0x9F2A,0x9F2B,0x9F2D,0x9F2E,0x9F30, +0x9F31, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9F32,0x9F33,0x9F34,0x9F35,0x9F36,0x9F38,0x9F3A,0x9F3C, +0x9F3F,0x9F40,0x9F41,0x9F42,0x9F43,0x9F45,0x9F46,0x9F47, +0x9F48,0x9F49,0x9F4A,0x9F4B,0x9F4C,0x9F4D,0x9F4E,0x9F4F, +0x9F52,0x9F53,0x9F54,0x9F55,0x9F56,0x9F57,0x9F58,0x9F59, +0x9F5A,0x9F5B,0x9F5C,0x9F5D,0x9F5E,0x9F5F,0x9F60,0x9F61, +0x9F62,0x9F63,0x9F64,0x9F65,0x9F66,0x9F67,0x9F68,0x9F69, +0x9F6A,0x9F6B,0x9F6C,0x9F6D,0x9F6E,0x9F6F,0x9F70,0x9F71, +0x9F72,0x9F73,0x9F74,0x9F75,0x9F76,0x9F77,0x9F78, 0, +0x9F79,0x9F7A,0x9F7B,0x9F7C,0x9F7D,0x9F7E,0x9F81,0x9F82, +0x9F8D,0x9F8E,0x9F8F,0x9F90,0x9F91,0x9F92,0x9F93,0x9F94, +0x9F95,0x9F96,0x9F97,0x9F98,0x9F9C,0x9F9D,0x9F9E,0x9FA1, +0x9FA2,0x9FA3,0x9FA4,0x9FA5,0xF92C,0xF979,0xF995,0xF9E7, +0xF9F1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFA0C,0xFA0D,0xFA0E,0xFA0F,0xFA11,0xFA13,0xFA14,0xFA18, +0xFA1F,0xFA20,0xFA21,0xFA23,0xFA24,0xFA27,0xFA28,0xFA29 +}; + +static int func_gbk_uni_onechar(int code){ + if ((code>=0x8140)&&(code<=0xFE4F)) + return(tab_gbk_uni0[code-0x8140]); + return(0); +} + + + +/* page 0 0x00A4-0x0451 */ +static uint16 tab_uni_gbk0[]={ +0xA1E8, 0, 0,0xA1EC,0xA1A7, 0, 0, 0, + 0, 0, 0, 0,0xA1E3,0xA1C0, 0, 0, + 0, 0, 0,0xA1A4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA1C1, 0, 0, 0, 0, + 0, 0, 0, 0,0xA8A4,0xA8A2, 0, 0, + 0, 0, 0, 0,0xA8A8,0xA8A6,0xA8BA, 0, +0xA8AC,0xA8AA, 0, 0, 0, 0,0xA8B0,0xA8AE, + 0, 0, 0,0xA1C2, 0,0xA8B4,0xA8B2, 0, +0xA8B9, 0, 0, 0, 0,0xA8A1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA8A5, + 0, 0, 0, 0, 0, 0, 0,0xA8A7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA8A9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA8BD, 0, 0, 0,0xA8BE, 0, 0, 0, + 0,0xA8AD, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA8B1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA8A3, 0,0xA8AB, 0,0xA8AF, 0, +0xA8B3, 0,0xA8B5, 0,0xA8B6, 0,0xA8B7, 0, +0xA8B8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA8BB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA8C0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA1A6, 0,0xA1A5,0xA840,0xA841, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA842, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA6A1,0xA6A2,0xA6A3, +0xA6A4,0xA6A5,0xA6A6,0xA6A7,0xA6A8,0xA6A9,0xA6AA,0xA6AB, +0xA6AC,0xA6AD,0xA6AE,0xA6AF,0xA6B0,0xA6B1, 0,0xA6B2, +0xA6B3,0xA6B4,0xA6B5,0xA6B6,0xA6B7,0xA6B8, 0, 0, + 0, 0, 0, 0, 0,0xA6C1,0xA6C2,0xA6C3, +0xA6C4,0xA6C5,0xA6C6,0xA6C7,0xA6C8,0xA6C9,0xA6CA,0xA6CB, +0xA6CC,0xA6CD,0xA6CE,0xA6CF,0xA6D0,0xA6D1, 0,0xA6D2, +0xA6D3,0xA6D4,0xA6D5,0xA6D6,0xA6D7,0xA6D8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA7A7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA7A1,0xA7A2,0xA7A3,0xA7A4, +0xA7A5,0xA7A6,0xA7A8,0xA7A9,0xA7AA,0xA7AB,0xA7AC,0xA7AD, +0xA7AE,0xA7AF,0xA7B0,0xA7B1,0xA7B2,0xA7B3,0xA7B4,0xA7B5, +0xA7B6,0xA7B7,0xA7B8,0xA7B9,0xA7BA,0xA7BB,0xA7BC,0xA7BD, +0xA7BE,0xA7BF,0xA7C0,0xA7C1,0xA7D1,0xA7D2,0xA7D3,0xA7D4, +0xA7D5,0xA7D6,0xA7D8,0xA7D9,0xA7DA,0xA7DB,0xA7DC,0xA7DD, +0xA7DE,0xA7DF,0xA7E0,0xA7E1,0xA7E2,0xA7E3,0xA7E4,0xA7E5, +0xA7E6,0xA7E7,0xA7E8,0xA7E9,0xA7EA,0xA7EB,0xA7EC,0xA7ED, +0xA7EE,0xA7EF,0xA7F0,0xA7F1, 0,0xA7D7}; + +/* page 1 0x2010-0x2312 */ +static uint16 tab_uni_gbk1[]={ +0xA95C, 0, 0,0xA843,0xA1AA,0xA844,0xA1AC, 0, +0xA1AE,0xA1AF, 0, 0,0xA1B0,0xA1B1, 0, 0, + 0, 0, 0, 0, 0,0xA845,0xA1AD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1EB, 0,0xA1E4,0xA1E5, 0,0xA846, 0, 0, + 0, 0, 0,0xA1F9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA1E6, 0,0xA847, 0, 0, + 0,0xA848, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA1ED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA959, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA2F1,0xA2F2,0xA2F3,0xA2F4,0xA2F5,0xA2F6,0xA2F7,0xA2F8, +0xA2F9,0xA2FA,0xA2FB,0xA2FC, 0, 0, 0, 0, +0xA2A1,0xA2A2,0xA2A3,0xA2A4,0xA2A5,0xA2A6,0xA2A7,0xA2A8, +0xA2A9,0xA2AA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1FB,0xA1FC,0xA1FA,0xA1FD, 0, 0,0xA849,0xA84A, +0xA84B,0xA84C, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1CA, 0, 0, 0, 0, 0, 0,0xA1C7, + 0,0xA1C6, 0, 0, 0,0xA84D, 0, 0, + 0, 0,0xA1CC, 0, 0,0xA1D8,0xA1DE,0xA84E, +0xA1CF, 0, 0,0xA84F, 0,0xA1CE, 0,0xA1C4, +0xA1C5,0xA1C9,0xA1C8,0xA1D2, 0, 0,0xA1D3, 0, + 0, 0, 0, 0,0xA1E0,0xA1DF,0xA1C3,0xA1CB, + 0, 0, 0, 0, 0,0xA1D7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1D6, 0, 0, 0,0xA1D5, 0, 0, 0, + 0, 0,0xA850, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1D9,0xA1D4, 0, 0,0xA1DC,0xA1DD,0xA851,0xA852, + 0, 0, 0, 0, 0, 0,0xA1DA,0xA1DB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA892, 0, 0, + 0,0xA1D1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1CD, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xA853, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA1D0}; + +/* page 2 0x2460-0x2642 */ +static uint16 tab_uni_gbk2[]={ +0xA2D9,0xA2DA,0xA2DB,0xA2DC,0xA2DD,0xA2DE,0xA2DF,0xA2E0, +0xA2E1,0xA2E2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xA2C5,0xA2C6,0xA2C7,0xA2C8, +0xA2C9,0xA2CA,0xA2CB,0xA2CC,0xA2CD,0xA2CE,0xA2CF,0xA2D0, +0xA2D1,0xA2D2,0xA2D3,0xA2D4,0xA2D5,0xA2D6,0xA2D7,0xA2D8, +0xA2B1,0xA2B2,0xA2B3,0xA2B4,0xA2B5,0xA2B6,0xA2B7,0xA2B8, +0xA2B9,0xA2BA,0xA2BB,0xA2BC,0xA2BD,0xA2BE,0xA2BF,0xA2C0, +0xA2C1,0xA2C2,0xA2C3,0xA2C4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA9A4,0xA9A5,0xA9A6,0xA9A7,0xA9A8,0xA9A9,0xA9AA,0xA9AB, +0xA9AC,0xA9AD,0xA9AE,0xA9AF,0xA9B0,0xA9B1,0xA9B2,0xA9B3, +0xA9B4,0xA9B5,0xA9B6,0xA9B7,0xA9B8,0xA9B9,0xA9BA,0xA9BB, +0xA9BC,0xA9BD,0xA9BE,0xA9BF,0xA9C0,0xA9C1,0xA9C2,0xA9C3, +0xA9C4,0xA9C5,0xA9C6,0xA9C7,0xA9C8,0xA9C9,0xA9CA,0xA9CB, +0xA9CC,0xA9CD,0xA9CE,0xA9CF,0xA9D0,0xA9D1,0xA9D2,0xA9D3, +0xA9D4,0xA9D5,0xA9D6,0xA9D7,0xA9D8,0xA9D9,0xA9DA,0xA9DB, +0xA9DC,0xA9DD,0xA9DE,0xA9DF,0xA9E0,0xA9E1,0xA9E2,0xA9E3, +0xA9E4,0xA9E5,0xA9E6,0xA9E7,0xA9E8,0xA9E9,0xA9EA,0xA9EB, +0xA9EC,0xA9ED,0xA9EE,0xA9EF, 0, 0, 0, 0, +0xA854,0xA855,0xA856,0xA857,0xA858,0xA859,0xA85A,0xA85B, +0xA85C,0xA85D,0xA85E,0xA85F,0xA860,0xA861,0xA862,0xA863, +0xA864,0xA865,0xA866,0xA867,0xA868,0xA869,0xA86A,0xA86B, +0xA86C,0xA86D,0xA86E,0xA86F,0xA870,0xA871,0xA872,0xA873, +0xA874,0xA875,0xA876,0xA877, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA878,0xA879,0xA87A,0xA87B,0xA87C,0xA87D,0xA87E, +0xA880,0xA881,0xA882,0xA883,0xA884,0xA885,0xA886,0xA887, + 0, 0, 0,0xA888,0xA889,0xA88A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1F6,0xA1F5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA1F8,0xA1F7, 0, 0, 0, 0, + 0, 0, 0, 0,0xA88B,0xA88C, 0, 0, + 0, 0, 0, 0, 0, 0,0xA1F4,0xA1F3, + 0, 0, 0,0xA1F0, 0, 0,0xA1F2,0xA1F1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xA88D,0xA88E,0xA88F,0xA890, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xA1EF,0xA1EE, 0, + 0,0xA891, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1E2, 0,0xA1E1}; + +/* page 3 0x3000-0x3129 */ +static uint16 tab_uni_gbk3[]={ +0xA1A1,0xA1A2,0xA1A3,0xA1A8, 0,0xA1A9,0xA965,0xA996, +0xA1B4,0xA1B5,0xA1B6,0xA1B7,0xA1B8,0xA1B9,0xA1BA,0xA1BB, +0xA1BE,0xA1BF,0xA893,0xA1FE,0xA1B2,0xA1B3,0xA1BC,0xA1BD, + 0, 0, 0, 0, 0,0xA894,0xA895, 0, + 0,0xA940,0xA941,0xA942,0xA943,0xA944,0xA945,0xA946, +0xA947,0xA948, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA4A1,0xA4A2,0xA4A3,0xA4A4,0xA4A5,0xA4A6,0xA4A7, +0xA4A8,0xA4A9,0xA4AA,0xA4AB,0xA4AC,0xA4AD,0xA4AE,0xA4AF, +0xA4B0,0xA4B1,0xA4B2,0xA4B3,0xA4B4,0xA4B5,0xA4B6,0xA4B7, +0xA4B8,0xA4B9,0xA4BA,0xA4BB,0xA4BC,0xA4BD,0xA4BE,0xA4BF, +0xA4C0,0xA4C1,0xA4C2,0xA4C3,0xA4C4,0xA4C5,0xA4C6,0xA4C7, +0xA4C8,0xA4C9,0xA4CA,0xA4CB,0xA4CC,0xA4CD,0xA4CE,0xA4CF, +0xA4D0,0xA4D1,0xA4D2,0xA4D3,0xA4D4,0xA4D5,0xA4D6,0xA4D7, +0xA4D8,0xA4D9,0xA4DA,0xA4DB,0xA4DC,0xA4DD,0xA4DE,0xA4DF, +0xA4E0,0xA4E1,0xA4E2,0xA4E3,0xA4E4,0xA4E5,0xA4E6,0xA4E7, +0xA4E8,0xA4E9,0xA4EA,0xA4EB,0xA4EC,0xA4ED,0xA4EE,0xA4EF, +0xA4F0,0xA4F1,0xA4F2,0xA4F3, 0, 0, 0, 0, + 0, 0, 0,0xA961,0xA962,0xA966,0xA967, 0, + 0,0xA5A1,0xA5A2,0xA5A3,0xA5A4,0xA5A5,0xA5A6,0xA5A7, +0xA5A8,0xA5A9,0xA5AA,0xA5AB,0xA5AC,0xA5AD,0xA5AE,0xA5AF, +0xA5B0,0xA5B1,0xA5B2,0xA5B3,0xA5B4,0xA5B5,0xA5B6,0xA5B7, +0xA5B8,0xA5B9,0xA5BA,0xA5BB,0xA5BC,0xA5BD,0xA5BE,0xA5BF, +0xA5C0,0xA5C1,0xA5C2,0xA5C3,0xA5C4,0xA5C5,0xA5C6,0xA5C7, +0xA5C8,0xA5C9,0xA5CA,0xA5CB,0xA5CC,0xA5CD,0xA5CE,0xA5CF, +0xA5D0,0xA5D1,0xA5D2,0xA5D3,0xA5D4,0xA5D5,0xA5D6,0xA5D7, +0xA5D8,0xA5D9,0xA5DA,0xA5DB,0xA5DC,0xA5DD,0xA5DE,0xA5DF, +0xA5E0,0xA5E1,0xA5E2,0xA5E3,0xA5E4,0xA5E5,0xA5E6,0xA5E7, +0xA5E8,0xA5E9,0xA5EA,0xA5EB,0xA5EC,0xA5ED,0xA5EE,0xA5EF, +0xA5F0,0xA5F1,0xA5F2,0xA5F3,0xA5F4,0xA5F5,0xA5F6, 0, + 0, 0, 0, 0,0xA960,0xA963,0xA964, 0, + 0, 0, 0, 0, 0,0xA8C5,0xA8C6,0xA8C7, +0xA8C8,0xA8C9,0xA8CA,0xA8CB,0xA8CC,0xA8CD,0xA8CE,0xA8CF, +0xA8D0,0xA8D1,0xA8D2,0xA8D3,0xA8D4,0xA8D5,0xA8D6,0xA8D7, +0xA8D8,0xA8D9,0xA8DA,0xA8DB,0xA8DC,0xA8DD,0xA8DE,0xA8DF, +0xA8E0,0xA8E1,0xA8E2,0xA8E3,0xA8E4,0xA8E5,0xA8E6,0xA8E7, +0xA8E8,0xA8E9}; + +/* page 4 0x3220-0x32A3 */ +static uint16 tab_uni_gbk4[]={ +0xA2E5,0xA2E6,0xA2E7,0xA2E8,0xA2E9,0xA2EA,0xA2EB,0xA2EC, +0xA2ED,0xA2EE, 0, 0, 0, 0, 0, 0, + 0,0xA95A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xA949}; + +/* page 5 0x338E-0x33D5 */ +static uint16 tab_uni_gbk5[]={ +0xA94A,0xA94B, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA94C,0xA94D, +0xA94E, 0, 0,0xA94F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xA950, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA951, 0, 0,0xA952,0xA953, 0, 0,0xA954 +}; + +/* page 6 0x4E00-0x9FA5 */ +static uint16 tab_uni_gbk6[]={ +0xD2BB,0xB6A1,0x8140,0xC6DF,0x8141,0x8142,0x8143,0xCDF2, +0xD5C9,0xC8FD,0xC9CF,0xCFC2,0xD8A2,0xB2BB,0xD3EB,0x8144, +0xD8A4,0xB3F3,0x8145,0xD7A8,0xC7D2,0xD8A7,0xCAC0,0x8146, +0xC7F0,0xB1FB,0xD2B5,0xB4D4,0xB6AB,0xCBBF,0xD8A9,0x8147, +0x8148,0x8149,0xB6AA,0x814A,0xC1BD,0xD1CF,0x814B,0xC9A5, +0xD8AD,0x814C,0xB8F6,0xD1BE,0xE3DC,0xD6D0,0x814D,0x814E, +0xB7E1,0x814F,0xB4AE,0x8150,0xC1D9,0x8151,0xD8BC,0x8152, +0xCDE8,0xB5A4,0xCEAA,0xD6F7,0x8153,0xC0F6,0xBED9,0xD8AF, +0x8154,0x8155,0x8156,0xC4CB,0x8157,0xBEC3,0x8158,0xD8B1, +0xC3B4,0xD2E5,0x8159,0xD6AE,0xCEDA,0xD5A7,0xBAF5,0xB7A6, +0xC0D6,0x815A,0xC6B9,0xC5D2,0xC7C7,0x815B,0xB9D4,0x815C, +0xB3CB,0xD2D2,0x815D,0x815E,0xD8BF,0xBEC5,0xC6F2,0xD2B2, +0xCFB0,0xCFE7,0x815F,0x8160,0x8161,0x8162,0xCAE9,0x8163, +0x8164,0xD8C0,0x8165,0x8166,0x8167,0x8168,0x8169,0x816A, +0xC2F2,0xC2D2,0x816B,0xC8E9,0x816C,0x816D,0x816E,0x816F, +0x8170,0x8171,0x8172,0x8173,0x8174,0x8175,0xC7AC,0x8176, +0x8177,0x8178,0x8179,0x817A,0x817B,0x817C,0xC1CB,0x817D, +0xD3E8,0xD5F9,0x817E,0xCAC2,0xB6FE,0xD8A1,0xD3DA,0xBFF7, +0x8180,0xD4C6,0xBBA5,0xD8C1,0xCEE5,0xBEAE,0x8181,0x8182, +0xD8A8,0x8183,0xD1C7,0xD0A9,0x8184,0x8185,0x8186,0xD8BD, +0xD9EF,0xCDF6,0xBFBA,0x8187,0xBDBB,0xBAA5,0xD2E0,0xB2FA, +0xBAE0,0xC4B6,0x8188,0xCFED,0xBEA9,0xCDA4,0xC1C1,0x8189, +0x818A,0x818B,0xC7D7,0xD9F1,0x818C,0xD9F4,0x818D,0x818E, +0x818F,0x8190,0xC8CB,0xD8E9,0x8191,0x8192,0x8193,0xD2DA, +0xCAB2,0xC8CA,0xD8EC,0xD8EA,0xD8C6,0xBDF6,0xC6CD,0xB3F0, +0x8194,0xD8EB,0xBDF1,0xBDE9,0x8195,0xC8D4,0xB4D3,0x8196, +0x8197,0xC2D8,0x8198,0xB2D6,0xD7D0,0xCACB,0xCBFB,0xD5CC, +0xB8B6,0xCFC9,0x8199,0x819A,0x819B,0xD9DA,0xD8F0,0xC7AA, +0x819C,0xD8EE,0x819D,0xB4FA,0xC1EE,0xD2D4,0x819E,0x819F, +0xD8ED,0x81A0,0xD2C7,0xD8EF,0xC3C7,0x81A1,0x81A2,0x81A3, +0xD1F6,0x81A4,0xD6D9,0xD8F2,0x81A5,0xD8F5,0xBCFE,0xBCDB, +0x81A6,0x81A7,0x81A8,0xC8CE,0x81A9,0xB7DD,0x81AA,0xB7C2, +0x81AB,0xC6F3,0x81AC,0x81AD,0x81AE,0x81AF,0x81B0,0x81B1, +0x81B2,0xD8F8,0xD2C1,0x81B3,0x81B4,0xCEE9,0xBCBF,0xB7FC, +0xB7A5,0xD0DD,0x81B5,0x81B6,0x81B7,0x81B8,0x81B9,0xD6DA, +0xD3C5,0xBBEF,0xBBE1,0xD8F1,0x81BA,0x81BB,0xC9A1,0xCEB0, +0xB4AB,0x81BC,0xD8F3,0x81BD,0xC9CB,0xD8F6,0xC2D7,0xD8F7, +0x81BE,0x81BF,0xCEB1,0xD8F9,0x81C0,0x81C1,0x81C2,0xB2AE, +0xB9C0,0x81C3,0xD9A3,0x81C4,0xB0E9,0x81C5,0xC1E6,0x81C6, +0xC9EC,0x81C7,0xCBC5,0x81C8,0xCBC6,0xD9A4,0x81C9,0x81CA, +0x81CB,0x81CC,0x81CD,0xB5E8,0x81CE,0x81CF,0xB5AB,0x81D0, +0x81D1,0x81D2,0x81D3,0x81D4,0x81D5,0xCEBB,0xB5CD,0xD7A1, +0xD7F4,0xD3D3,0x81D6,0xCCE5,0x81D7,0xBACE,0x81D8,0xD9A2, +0xD9DC,0xD3E0,0xD8FD,0xB7F0,0xD7F7,0xD8FE,0xD8FA,0xD9A1, +0xC4E3,0x81D9,0x81DA,0xD3B6,0xD8F4,0xD9DD,0x81DB,0xD8FB, +0x81DC,0xC5E5,0x81DD,0x81DE,0xC0D0,0x81DF,0x81E0,0xD1F0, +0xB0DB,0x81E1,0x81E2,0xBCD1,0xD9A6,0x81E3,0xD9A5,0x81E4, +0x81E5,0x81E6,0x81E7,0xD9AC,0xD9AE,0x81E8,0xD9AB,0xCAB9, +0x81E9,0x81EA,0x81EB,0xD9A9,0xD6B6,0x81EC,0x81ED,0x81EE, +0xB3DE,0xD9A8,0x81EF,0xC0FD,0x81F0,0xCACC,0x81F1,0xD9AA, +0x81F2,0xD9A7,0x81F3,0x81F4,0xD9B0,0x81F5,0x81F6,0xB6B1, +0x81F7,0x81F8,0x81F9,0xB9A9,0x81FA,0xD2C0,0x81FB,0x81FC, +0xCFC0,0x81FD,0x81FE,0xC2C2,0x8240,0xBDC4,0xD5EC,0xB2E0, +0xC7C8,0xBFEB,0xD9AD,0x8241,0xD9AF,0x8242,0xCEEA,0xBAEE, +0x8243,0x8244,0x8245,0x8246,0x8247,0xC7D6,0x8248,0x8249, +0x824A,0x824B,0x824C,0x824D,0x824E,0x824F,0x8250,0xB1E3, +0x8251,0x8252,0x8253,0xB4D9,0xB6ED,0xD9B4,0x8254,0x8255, +0x8256,0x8257,0xBFA1,0x8258,0x8259,0x825A,0xD9DE,0xC7CE, +0xC0FE,0xD9B8,0x825B,0x825C,0x825D,0x825E,0x825F,0xCBD7, +0xB7FD,0x8260,0xD9B5,0x8261,0xD9B7,0xB1A3,0xD3E1,0xD9B9, +0x8262,0xD0C5,0x8263,0xD9B6,0x8264,0x8265,0xD9B1,0x8266, +0xD9B2,0xC1A9,0xD9B3,0x8267,0x8268,0xBCF3,0xD0DE,0xB8A9, +0x8269,0xBEE3,0x826A,0xD9BD,0x826B,0x826C,0x826D,0x826E, +0xD9BA,0x826F,0xB0B3,0x8270,0x8271,0x8272,0xD9C2,0x8273, +0x8274,0x8275,0x8276,0x8277,0x8278,0x8279,0x827A,0x827B, +0x827C,0x827D,0x827E,0x8280,0xD9C4,0xB1B6,0x8281,0xD9BF, +0x8282,0x8283,0xB5B9,0x8284,0xBEF3,0x8285,0x8286,0x8287, +0xCCC8,0xBAF2,0xD2D0,0x8288,0xD9C3,0x8289,0x828A,0xBDE8, +0x828B,0xB3AB,0x828C,0x828D,0x828E,0xD9C5,0xBEEB,0x828F, +0xD9C6,0xD9BB,0xC4DF,0x8290,0xD9BE,0xD9C1,0xD9C0,0x8291, +0x8292,0x8293,0x8294,0x8295,0x8296,0x8297,0x8298,0x8299, +0x829A,0x829B,0xD5AE,0x829C,0xD6B5,0x829D,0xC7E3,0x829E, +0x829F,0x82A0,0x82A1,0xD9C8,0x82A2,0x82A3,0x82A4,0xBCD9, +0xD9CA,0x82A5,0x82A6,0x82A7,0xD9BC,0x82A8,0xD9CB,0xC6AB, +0x82A9,0x82AA,0x82AB,0x82AC,0x82AD,0xD9C9,0x82AE,0x82AF, +0x82B0,0x82B1,0xD7F6,0x82B2,0xCDA3,0x82B3,0x82B4,0x82B5, +0x82B6,0x82B7,0x82B8,0x82B9,0x82BA,0xBDA1,0x82BB,0x82BC, +0x82BD,0x82BE,0x82BF,0x82C0,0xD9CC,0x82C1,0x82C2,0x82C3, +0x82C4,0x82C5,0x82C6,0x82C7,0x82C8,0x82C9,0xC5BC,0xCDB5, +0x82CA,0x82CB,0x82CC,0xD9CD,0x82CD,0x82CE,0xD9C7,0xB3A5, +0xBFFE,0x82CF,0x82D0,0x82D1,0x82D2,0xB8B5,0x82D3,0x82D4, +0xC0FC,0x82D5,0x82D6,0x82D7,0x82D8,0xB0F8,0x82D9,0x82DA, +0x82DB,0x82DC,0x82DD,0x82DE,0x82DF,0x82E0,0x82E1,0x82E2, +0x82E3,0x82E4,0x82E5,0x82E6,0x82E7,0x82E8,0x82E9,0x82EA, +0x82EB,0x82EC,0x82ED,0xB4F6,0x82EE,0xD9CE,0x82EF,0xD9CF, +0xB4A2,0xD9D0,0x82F0,0x82F1,0xB4DF,0x82F2,0x82F3,0x82F4, +0x82F5,0x82F6,0xB0C1,0x82F7,0x82F8,0x82F9,0x82FA,0x82FB, +0x82FC,0x82FD,0xD9D1,0xC9B5,0x82FE,0x8340,0x8341,0x8342, +0x8343,0x8344,0x8345,0x8346,0x8347,0x8348,0x8349,0x834A, +0x834B,0x834C,0x834D,0x834E,0x834F,0x8350,0x8351,0xCFF1, +0x8352,0x8353,0x8354,0x8355,0x8356,0x8357,0xD9D2,0x8358, +0x8359,0x835A,0xC1C5,0x835B,0x835C,0x835D,0x835E,0x835F, +0x8360,0x8361,0x8362,0x8363,0x8364,0x8365,0xD9D6,0xC9AE, +0x8366,0x8367,0x8368,0x8369,0xD9D5,0xD9D4,0xD9D7,0x836A, +0x836B,0x836C,0x836D,0xCBDB,0x836E,0xBDA9,0x836F,0x8370, +0x8371,0x8372,0x8373,0xC6A7,0x8374,0x8375,0x8376,0x8377, +0x8378,0x8379,0x837A,0x837B,0x837C,0x837D,0xD9D3,0xD9D8, +0x837E,0x8380,0x8381,0xD9D9,0x8382,0x8383,0x8384,0x8385, +0x8386,0x8387,0xC8E5,0x8388,0x8389,0x838A,0x838B,0x838C, +0x838D,0x838E,0x838F,0x8390,0x8391,0x8392,0x8393,0x8394, +0x8395,0xC0DC,0x8396,0x8397,0x8398,0x8399,0x839A,0x839B, +0x839C,0x839D,0x839E,0x839F,0x83A0,0x83A1,0x83A2,0x83A3, +0x83A4,0x83A5,0x83A6,0x83A7,0x83A8,0x83A9,0x83AA,0x83AB, +0x83AC,0x83AD,0x83AE,0x83AF,0x83B0,0x83B1,0x83B2,0xB6F9, +0xD8A3,0xD4CA,0x83B3,0xD4AA,0xD0D6,0xB3E4,0xD5D7,0x83B4, +0xCFC8,0xB9E2,0x83B5,0xBFCB,0x83B6,0xC3E2,0x83B7,0x83B8, +0x83B9,0xB6D2,0x83BA,0x83BB,0xCDC3,0xD9EE,0xD9F0,0x83BC, +0x83BD,0x83BE,0xB5B3,0x83BF,0xB6B5,0x83C0,0x83C1,0x83C2, +0x83C3,0x83C4,0xBEA4,0x83C5,0x83C6,0xC8EB,0x83C7,0x83C8, +0xC8AB,0x83C9,0x83CA,0xB0CB,0xB9AB,0xC1F9,0xD9E2,0x83CB, +0xC0BC,0xB9B2,0x83CC,0xB9D8,0xD0CB,0xB1F8,0xC6E4,0xBEDF, +0xB5E4,0xD7C8,0x83CD,0xD1F8,0xBCE6,0xCADE,0x83CE,0x83CF, +0xBCBD,0xD9E6,0xD8E7,0x83D0,0x83D1,0xC4DA,0x83D2,0x83D3, +0xB8D4,0xC8BD,0x83D4,0x83D5,0xB2E1,0xD4D9,0x83D6,0x83D7, +0x83D8,0x83D9,0xC3B0,0x83DA,0x83DB,0xC3E1,0xDAA2,0xC8DF, +0x83DC,0xD0B4,0x83DD,0xBEFC,0xC5A9,0x83DE,0x83DF,0x83E0, +0xB9DA,0x83E1,0xDAA3,0x83E2,0xD4A9,0xDAA4,0x83E3,0x83E4, +0x83E5,0x83E6,0x83E7,0xD9FB,0xB6AC,0x83E8,0x83E9,0xB7EB, +0xB1F9,0xD9FC,0xB3E5,0xBEF6,0x83EA,0xBFF6,0xD2B1,0xC0E4, +0x83EB,0x83EC,0x83ED,0xB6B3,0xD9FE,0xD9FD,0x83EE,0x83EF, +0xBEBB,0x83F0,0x83F1,0x83F2,0xC6E0,0x83F3,0xD7BC,0xDAA1, +0x83F4,0xC1B9,0x83F5,0xB5F2,0xC1E8,0x83F6,0x83F7,0xBCF5, +0x83F8,0xB4D5,0x83F9,0x83FA,0x83FB,0x83FC,0x83FD,0x83FE, +0x8440,0x8441,0x8442,0xC1DD,0x8443,0xC4FD,0x8444,0x8445, +0xBCB8,0xB7B2,0x8446,0x8447,0xB7EF,0x8448,0x8449,0x844A, +0x844B,0x844C,0x844D,0xD9EC,0x844E,0xC6BE,0x844F,0xBFAD, +0xBBCB,0x8450,0x8451,0xB5CA,0x8452,0xDBC9,0xD0D7,0x8453, +0xCDB9,0xB0BC,0xB3F6,0xBBF7,0xDBCA,0xBAAF,0x8454,0xD4E4, +0xB5B6,0xB5F3,0xD8D6,0xC8D0,0x8455,0x8456,0xB7D6,0xC7D0, +0xD8D7,0x8457,0xBFAF,0x8458,0x8459,0xDBBB,0xD8D8,0x845A, +0x845B,0xD0CC,0xBBAE,0x845C,0x845D,0x845E,0xEBBE,0xC1D0, +0xC1F5,0xD4F2,0xB8D5,0xB4B4,0x845F,0xB3F5,0x8460,0x8461, +0xC9BE,0x8462,0x8463,0x8464,0xC5D0,0x8465,0x8466,0x8467, +0xC5D9,0xC0FB,0x8468,0xB1F0,0x8469,0xD8D9,0xB9CE,0x846A, +0xB5BD,0x846B,0x846C,0xD8DA,0x846D,0x846E,0xD6C6,0xCBA2, +0xC8AF,0xC9B2,0xB4CC,0xBFCC,0x846F,0xB9F4,0x8470,0xD8DB, +0xD8DC,0xB6E7,0xBCC1,0xCCEA,0x8471,0x8472,0x8473,0x8474, +0x8475,0x8476,0xCFF7,0x8477,0xD8DD,0xC7B0,0x8478,0x8479, +0xB9D0,0xBDA3,0x847A,0x847B,0xCCDE,0x847C,0xC6CA,0x847D, +0x847E,0x8480,0x8481,0x8482,0xD8E0,0x8483,0xD8DE,0x8484, +0x8485,0xD8DF,0x8486,0x8487,0x8488,0xB0FE,0x8489,0xBEE7, +0x848A,0xCAA3,0xBCF4,0x848B,0x848C,0x848D,0x848E,0xB8B1, +0x848F,0x8490,0xB8EE,0x8491,0x8492,0x8493,0x8494,0x8495, +0x8496,0x8497,0x8498,0x8499,0x849A,0xD8E2,0x849B,0xBDCB, +0x849C,0xD8E4,0xD8E3,0x849D,0x849E,0x849F,0x84A0,0x84A1, +0xC5FC,0x84A2,0x84A3,0x84A4,0x84A5,0x84A6,0x84A7,0x84A8, +0xD8E5,0x84A9,0x84AA,0xD8E6,0x84AB,0x84AC,0x84AD,0x84AE, +0x84AF,0x84B0,0x84B1,0xC1A6,0x84B2,0xC8B0,0xB0EC,0xB9A6, +0xBCD3,0xCEF1,0xDBBD,0xC1D3,0x84B3,0x84B4,0x84B5,0x84B6, +0xB6AF,0xD6FA,0xC5AC,0xBDD9,0xDBBE,0xDBBF,0x84B7,0x84B8, +0x84B9,0xC0F8,0xBEA2,0xC0CD,0x84BA,0x84BB,0x84BC,0x84BD, +0x84BE,0x84BF,0x84C0,0x84C1,0x84C2,0x84C3,0xDBC0,0xCAC6, +0x84C4,0x84C5,0x84C6,0xB2AA,0x84C7,0x84C8,0x84C9,0xD3C2, +0x84CA,0xC3E3,0x84CB,0xD1AB,0x84CC,0x84CD,0x84CE,0x84CF, +0xDBC2,0x84D0,0xC0D5,0x84D1,0x84D2,0x84D3,0xDBC3,0x84D4, +0xBFB1,0x84D5,0x84D6,0x84D7,0x84D8,0x84D9,0x84DA,0xC4BC, +0x84DB,0x84DC,0x84DD,0x84DE,0xC7DA,0x84DF,0x84E0,0x84E1, +0x84E2,0x84E3,0x84E4,0x84E5,0x84E6,0x84E7,0x84E8,0x84E9, +0xDBC4,0x84EA,0x84EB,0x84EC,0x84ED,0x84EE,0x84EF,0x84F0, +0x84F1,0xD9E8,0xC9D7,0x84F2,0x84F3,0x84F4,0xB9B4,0xCEF0, +0xD4C8,0x84F5,0x84F6,0x84F7,0x84F8,0xB0FC,0xB4D2,0x84F9, +0xD0D9,0x84FA,0x84FB,0x84FC,0x84FD,0xD9E9,0x84FE,0xDECB, +0xD9EB,0x8540,0x8541,0x8542,0x8543,0xD8B0,0xBBAF,0xB1B1, +0x8544,0xB3D7,0xD8CE,0x8545,0x8546,0xD4D1,0x8547,0x8548, +0xBDB3,0xBFEF,0x8549,0xCFBB,0x854A,0x854B,0xD8D0,0x854C, +0x854D,0x854E,0xB7CB,0x854F,0x8550,0x8551,0xD8D1,0x8552, +0x8553,0x8554,0x8555,0x8556,0x8557,0x8558,0x8559,0x855A, +0x855B,0xC6A5,0xC7F8,0xD2BD,0x855C,0x855D,0xD8D2,0xC4E4, +0x855E,0xCAAE,0x855F,0xC7A7,0x8560,0xD8A6,0x8561,0xC9FD, +0xCEE7,0xBBDC,0xB0EB,0x8562,0x8563,0x8564,0xBBAA,0xD0AD, +0x8565,0xB1B0,0xD7E4,0xD7BF,0x8566,0xB5A5,0xC2F4,0xC4CF, +0x8567,0x8568,0xB2A9,0x8569,0xB2B7,0x856A,0xB1E5,0xDFB2, +0xD5BC,0xBFA8,0xC2AC,0xD8D5,0xC2B1,0x856B,0xD8D4,0xCED4, +0x856C,0xDAE0,0x856D,0xCEC0,0x856E,0x856F,0xD8B4,0xC3AE, +0xD3A1,0xCEA3,0x8570,0xBCB4,0xC8B4,0xC2D1,0x8571,0xBEED, +0xD0B6,0x8572,0xDAE1,0x8573,0x8574,0x8575,0x8576,0xC7E4, +0x8577,0x8578,0xB3A7,0x8579,0xB6F2,0xCCFC,0xC0FA,0x857A, +0x857B,0xC0F7,0x857C,0xD1B9,0xD1E1,0xD8C7,0x857D,0x857E, +0x8580,0x8581,0x8582,0x8583,0x8584,0xB2DE,0x8585,0x8586, +0xC0E5,0x8587,0xBAF1,0x8588,0x8589,0xD8C8,0x858A,0xD4AD, +0x858B,0x858C,0xCFE1,0xD8C9,0x858D,0xD8CA,0xCFC3,0x858E, +0xB3F8,0xBEC7,0x858F,0x8590,0x8591,0x8592,0xD8CB,0x8593, +0x8594,0x8595,0x8596,0x8597,0x8598,0x8599,0xDBCC,0x859A, +0x859B,0x859C,0x859D,0xC8A5,0x859E,0x859F,0x85A0,0xCFD8, +0x85A1,0xC8FE,0xB2CE,0x85A2,0x85A3,0x85A4,0x85A5,0x85A6, +0xD3D6,0xB2E6,0xBCB0,0xD3D1,0xCBAB,0xB7B4,0x85A7,0x85A8, +0x85A9,0xB7A2,0x85AA,0x85AB,0xCAE5,0x85AC,0xC8A1,0xCADC, +0xB1E4,0xD0F0,0x85AD,0xC5D1,0x85AE,0x85AF,0x85B0,0xDBC5, +0xB5FE,0x85B1,0x85B2,0xBFDA,0xB9C5,0xBEE4,0xC1ED,0x85B3, +0xDFB6,0xDFB5,0xD6BB,0xBDD0,0xD5D9,0xB0C8,0xB6A3,0xBFC9, +0xCCA8,0xDFB3,0xCAB7,0xD3D2,0x85B4,0xD8CF,0xD2B6,0xBAC5, +0xCBBE,0xCCBE,0x85B5,0xDFB7,0xB5F0,0xDFB4,0x85B6,0x85B7, +0x85B8,0xD3F5,0x85B9,0xB3D4,0xB8F7,0x85BA,0xDFBA,0x85BB, +0xBACF,0xBCAA,0xB5F5,0x85BC,0xCDAC,0xC3FB,0xBAF3,0xC0F4, +0xCDC2,0xCFF2,0xDFB8,0xCFC5,0x85BD,0xC2C0,0xDFB9,0xC2F0, +0x85BE,0x85BF,0x85C0,0xBEFD,0x85C1,0xC1DF,0xCDCC,0xD2F7, +0xB7CD,0xDFC1,0x85C2,0xDFC4,0x85C3,0x85C4,0xB7F1,0xB0C9, +0xB6D6,0xB7D4,0x85C5,0xBAAC,0xCCFD,0xBFD4,0xCBB1,0xC6F4, +0x85C6,0xD6A8,0xDFC5,0x85C7,0xCEE2,0xB3B3,0x85C8,0x85C9, +0xCEFC,0xB4B5,0x85CA,0xCEC7,0xBAF0,0x85CB,0xCEE1,0x85CC, +0xD1BD,0x85CD,0x85CE,0xDFC0,0x85CF,0x85D0,0xB4F4,0x85D1, +0xB3CA,0x85D2,0xB8E6,0xDFBB,0x85D3,0x85D4,0x85D5,0x85D6, +0xC4C5,0x85D7,0xDFBC,0xDFBD,0xDFBE,0xC5BB,0xDFBF,0xDFC2, +0xD4B1,0xDFC3,0x85D8,0xC7BA,0xCED8,0x85D9,0x85DA,0x85DB, +0x85DC,0x85DD,0xC4D8,0x85DE,0xDFCA,0x85DF,0xDFCF,0x85E0, +0xD6DC,0x85E1,0x85E2,0x85E3,0x85E4,0x85E5,0x85E6,0x85E7, +0x85E8,0xDFC9,0xDFDA,0xCEB6,0x85E9,0xBAC7,0xDFCE,0xDFC8, +0xC5DE,0x85EA,0x85EB,0xC9EB,0xBAF4,0xC3FC,0x85EC,0x85ED, +0xBED7,0x85EE,0xDFC6,0x85EF,0xDFCD,0x85F0,0xC5D8,0x85F1, +0x85F2,0x85F3,0x85F4,0xD5A6,0xBACD,0x85F5,0xBECC,0xD3BD, +0xB8C0,0x85F6,0xD6E4,0x85F7,0xDFC7,0xB9BE,0xBFA7,0x85F8, +0x85F9,0xC1FC,0xDFCB,0xDFCC,0x85FA,0xDFD0,0x85FB,0x85FC, +0x85FD,0x85FE,0x8640,0xDFDB,0xDFE5,0x8641,0xDFD7,0xDFD6, +0xD7C9,0xDFE3,0xDFE4,0xE5EB,0xD2A7,0xDFD2,0x8642,0xBFA9, +0x8643,0xD4DB,0x8644,0xBFC8,0xDFD4,0x8645,0x8646,0x8647, +0xCFCC,0x8648,0x8649,0xDFDD,0x864A,0xD1CA,0x864B,0xDFDE, +0xB0A7,0xC6B7,0xDFD3,0x864C,0xBAE5,0x864D,0xB6DF,0xCDDB, +0xB9FE,0xD4D5,0x864E,0x864F,0xDFDF,0xCFEC,0xB0A5,0xDFE7, +0xDFD1,0xD1C6,0xDFD5,0xDFD8,0xDFD9,0xDFDC,0x8650,0xBBA9, +0x8651,0xDFE0,0xDFE1,0x8652,0xDFE2,0xDFE6,0xDFE8,0xD3B4, +0x8653,0x8654,0x8655,0x8656,0x8657,0xB8E7,0xC5B6,0xDFEA, +0xC9DA,0xC1A8,0xC4C4,0x8658,0x8659,0xBFDE,0xCFF8,0x865A, +0x865B,0x865C,0xD5DC,0xDFEE,0x865D,0x865E,0x865F,0x8660, +0x8661,0x8662,0xB2B8,0x8663,0xBADF,0xDFEC,0x8664,0xDBC1, +0x8665,0xD1E4,0x8666,0x8667,0x8668,0x8669,0xCBF4,0xB4BD, +0x866A,0xB0A6,0x866B,0x866C,0x866D,0x866E,0x866F,0xDFF1, +0xCCC6,0xDFF2,0x8670,0x8671,0xDFED,0x8672,0x8673,0x8674, +0x8675,0x8676,0x8677,0xDFE9,0x8678,0x8679,0x867A,0x867B, +0xDFEB,0x867C,0xDFEF,0xDFF0,0xBBBD,0x867D,0x867E,0xDFF3, +0x8680,0x8681,0xDFF4,0x8682,0xBBA3,0x8683,0xCADB,0xCEA8, +0xE0A7,0xB3AA,0x8684,0xE0A6,0x8685,0x8686,0x8687,0xE0A1, +0x8688,0x8689,0x868A,0x868B,0xDFFE,0x868C,0xCDD9,0xDFFC, +0x868D,0xDFFA,0x868E,0xBFD0,0xD7C4,0x868F,0xC9CC,0x8690, +0x8691,0xDFF8,0xB0A1,0x8692,0x8693,0x8694,0x8695,0x8696, +0xDFFD,0x8697,0x8698,0x8699,0x869A,0xDFFB,0xE0A2,0x869B, +0x869C,0x869D,0x869E,0x869F,0xE0A8,0x86A0,0x86A1,0x86A2, +0x86A3,0xB7C8,0x86A4,0x86A5,0xC6A1,0xC9B6,0xC0B2,0xDFF5, +0x86A6,0x86A7,0xC5BE,0x86A8,0xD8C4,0xDFF9,0xC4F6,0x86A9, +0x86AA,0x86AB,0x86AC,0x86AD,0x86AE,0xE0A3,0xE0A4,0xE0A5, +0xD0A5,0x86AF,0x86B0,0xE0B4,0xCCE4,0x86B1,0xE0B1,0x86B2, +0xBFA6,0xE0AF,0xCEB9,0xE0AB,0xC9C6,0x86B3,0x86B4,0xC0AE, +0xE0AE,0xBAED,0xBAB0,0xE0A9,0x86B5,0x86B6,0x86B7,0xDFF6, +0x86B8,0xE0B3,0x86B9,0x86BA,0xE0B8,0x86BB,0x86BC,0x86BD, +0xB4AD,0xE0B9,0x86BE,0x86BF,0xCFB2,0xBAC8,0x86C0,0xE0B0, +0x86C1,0x86C2,0x86C3,0x86C4,0x86C5,0x86C6,0x86C7,0xD0FA, +0x86C8,0x86C9,0x86CA,0x86CB,0x86CC,0x86CD,0x86CE,0x86CF, +0x86D0,0xE0AC,0x86D1,0xD4FB,0x86D2,0xDFF7,0x86D3,0xC5E7, +0x86D4,0xE0AD,0x86D5,0xD3F7,0x86D6,0xE0B6,0xE0B7,0x86D7, +0x86D8,0x86D9,0x86DA,0x86DB,0xE0C4,0xD0E1,0x86DC,0x86DD, +0x86DE,0xE0BC,0x86DF,0x86E0,0xE0C9,0xE0CA,0x86E1,0x86E2, +0x86E3,0xE0BE,0xE0AA,0xC9A4,0xE0C1,0x86E4,0xE0B2,0x86E5, +0x86E6,0x86E7,0x86E8,0x86E9,0xCAC8,0xE0C3,0x86EA,0xE0B5, +0x86EB,0xCECB,0x86EC,0xCBC3,0xE0CD,0xE0C6,0xE0C2,0x86ED, +0xE0CB,0x86EE,0xE0BA,0xE0BF,0xE0C0,0x86EF,0x86F0,0xE0C5, +0x86F1,0x86F2,0xE0C7,0xE0C8,0x86F3,0xE0CC,0x86F4,0xE0BB, +0x86F5,0x86F6,0x86F7,0x86F8,0x86F9,0xCBD4,0xE0D5,0x86FA, +0xE0D6,0xE0D2,0x86FB,0x86FC,0x86FD,0x86FE,0x8740,0x8741, +0xE0D0,0xBCCE,0x8742,0x8743,0xE0D1,0x8744,0xB8C2,0xD8C5, +0x8745,0x8746,0x8747,0x8748,0x8749,0x874A,0x874B,0x874C, +0xD0EA,0x874D,0x874E,0xC2EF,0x874F,0x8750,0xE0CF,0xE0BD, +0x8751,0x8752,0x8753,0xE0D4,0xE0D3,0x8754,0x8755,0xE0D7, +0x8756,0x8757,0x8758,0x8759,0xE0DC,0xE0D8,0x875A,0x875B, +0x875C,0xD6F6,0xB3B0,0x875D,0xD7EC,0x875E,0xCBBB,0x875F, +0x8760,0xE0DA,0x8761,0xCEFB,0x8762,0x8763,0x8764,0xBAD9, +0x8765,0x8766,0x8767,0x8768,0x8769,0x876A,0x876B,0x876C, +0x876D,0x876E,0x876F,0x8770,0xE0E1,0xE0DD,0xD2AD,0x8771, +0x8772,0x8773,0x8774,0x8775,0xE0E2,0x8776,0x8777,0xE0DB, +0xE0D9,0xE0DF,0x8778,0x8779,0xE0E0,0x877A,0x877B,0x877C, +0x877D,0x877E,0xE0DE,0x8780,0xE0E4,0x8781,0x8782,0x8783, +0xC6F7,0xD8AC,0xD4EB,0xE0E6,0xCAC9,0x8784,0x8785,0x8786, +0x8787,0xE0E5,0x8788,0x8789,0x878A,0x878B,0xB8C1,0x878C, +0x878D,0x878E,0x878F,0xE0E7,0xE0E8,0x8790,0x8791,0x8792, +0x8793,0x8794,0x8795,0x8796,0x8797,0xE0E9,0xE0E3,0x8798, +0x8799,0x879A,0x879B,0x879C,0x879D,0x879E,0xBABF,0xCCE7, +0x879F,0x87A0,0x87A1,0xE0EA,0x87A2,0x87A3,0x87A4,0x87A5, +0x87A6,0x87A7,0x87A8,0x87A9,0x87AA,0x87AB,0x87AC,0x87AD, +0x87AE,0x87AF,0x87B0,0xCFF9,0x87B1,0x87B2,0x87B3,0x87B4, +0x87B5,0x87B6,0x87B7,0x87B8,0x87B9,0x87BA,0x87BB,0xE0EB, +0x87BC,0x87BD,0x87BE,0x87BF,0x87C0,0x87C1,0x87C2,0xC8C2, +0x87C3,0x87C4,0x87C5,0x87C6,0xBDC0,0x87C7,0x87C8,0x87C9, +0x87CA,0x87CB,0x87CC,0x87CD,0x87CE,0x87CF,0x87D0,0x87D1, +0x87D2,0x87D3,0xC4D2,0x87D4,0x87D5,0x87D6,0x87D7,0x87D8, +0x87D9,0x87DA,0x87DB,0x87DC,0xE0EC,0x87DD,0x87DE,0xE0ED, +0x87DF,0x87E0,0xC7F4,0xCBC4,0x87E1,0xE0EE,0xBBD8,0xD8B6, +0xD2F2,0xE0EF,0xCDC5,0x87E2,0xB6DA,0x87E3,0x87E4,0x87E5, +0x87E6,0x87E7,0x87E8,0xE0F1,0x87E9,0xD4B0,0x87EA,0x87EB, +0xC0A7,0xB4D1,0x87EC,0x87ED,0xCEA7,0xE0F0,0x87EE,0x87EF, +0x87F0,0xE0F2,0xB9CC,0x87F1,0x87F2,0xB9FA,0xCDBC,0xE0F3, +0x87F3,0x87F4,0x87F5,0xC6D4,0xE0F4,0x87F6,0xD4B2,0x87F7, +0xC8A6,0xE0F6,0xE0F5,0x87F8,0x87F9,0x87FA,0x87FB,0x87FC, +0x87FD,0x87FE,0x8840,0x8841,0x8842,0x8843,0x8844,0x8845, +0x8846,0x8847,0x8848,0x8849,0xE0F7,0x884A,0x884B,0xCDC1, +0x884C,0x884D,0x884E,0xCAA5,0x884F,0x8850,0x8851,0x8852, +0xD4DA,0xDBD7,0xDBD9,0x8853,0xDBD8,0xB9E7,0xDBDC,0xDBDD, +0xB5D8,0x8854,0x8855,0xDBDA,0x8856,0x8857,0x8858,0x8859, +0x885A,0xDBDB,0xB3A1,0xDBDF,0x885B,0x885C,0xBBF8,0x885D, +0xD6B7,0x885E,0xDBE0,0x885F,0x8860,0x8861,0x8862,0xBEF9, +0x8863,0x8864,0xB7BB,0x8865,0xDBD0,0xCCAE,0xBFB2,0xBBB5, +0xD7F8,0xBFD3,0x8866,0x8867,0x8868,0x8869,0x886A,0xBFE9, +0x886B,0x886C,0xBCE1,0xCCB3,0xDBDE,0xB0D3,0xCEEB,0xB7D8, +0xD7B9,0xC6C2,0x886D,0x886E,0xC0A4,0x886F,0xCCB9,0x8870, +0xDBE7,0xDBE1,0xC6BA,0xDBE3,0x8871,0xDBE8,0x8872,0xC5F7, +0x8873,0x8874,0x8875,0xDBEA,0x8876,0x8877,0xDBE9,0xBFC0, +0x8878,0x8879,0x887A,0xDBE6,0xDBE5,0x887B,0x887C,0x887D, +0x887E,0x8880,0xB4B9,0xC0AC,0xC2A2,0xDBE2,0xDBE4,0x8881, +0x8882,0x8883,0x8884,0xD0CD,0xDBED,0x8885,0x8886,0x8887, +0x8888,0x8889,0xC0DD,0xDBF2,0x888A,0x888B,0x888C,0x888D, +0x888E,0x888F,0x8890,0xB6E2,0x8891,0x8892,0x8893,0x8894, +0xDBF3,0xDBD2,0xB9B8,0xD4AB,0xDBEC,0x8895,0xBFD1,0xDBF0, +0x8896,0xDBD1,0x8897,0xB5E6,0x8898,0xDBEB,0xBFE5,0x8899, +0x889A,0x889B,0xDBEE,0x889C,0xDBF1,0x889D,0x889E,0x889F, +0xDBF9,0x88A0,0x88A1,0x88A2,0x88A3,0x88A4,0x88A5,0x88A6, +0x88A7,0x88A8,0xB9A1,0xB0A3,0x88A9,0x88AA,0x88AB,0x88AC, +0x88AD,0x88AE,0x88AF,0xC2F1,0x88B0,0x88B1,0xB3C7,0xDBEF, +0x88B2,0x88B3,0xDBF8,0x88B4,0xC6D2,0xDBF4,0x88B5,0x88B6, +0xDBF5,0xDBF7,0xDBF6,0x88B7,0x88B8,0xDBFE,0x88B9,0xD3F2, +0xB2BA,0x88BA,0x88BB,0x88BC,0xDBFD,0x88BD,0x88BE,0x88BF, +0x88C0,0x88C1,0x88C2,0x88C3,0x88C4,0xDCA4,0x88C5,0xDBFB, +0x88C6,0x88C7,0x88C8,0x88C9,0xDBFA,0x88CA,0x88CB,0x88CC, +0xDBFC,0xC5E0,0xBBF9,0x88CD,0x88CE,0xDCA3,0x88CF,0x88D0, +0xDCA5,0x88D1,0xCCC3,0x88D2,0x88D3,0x88D4,0xB6D1,0xDDC0, +0x88D5,0x88D6,0x88D7,0xDCA1,0x88D8,0xDCA2,0x88D9,0x88DA, +0x88DB,0xC7B5,0x88DC,0x88DD,0x88DE,0xB6E9,0x88DF,0x88E0, +0x88E1,0xDCA7,0x88E2,0x88E3,0x88E4,0x88E5,0xDCA6,0x88E6, +0xDCA9,0xB1A4,0x88E7,0x88E8,0xB5CC,0x88E9,0x88EA,0x88EB, +0x88EC,0x88ED,0xBFB0,0x88EE,0x88EF,0x88F0,0x88F1,0x88F2, +0xD1DF,0x88F3,0x88F4,0x88F5,0x88F6,0xB6C2,0x88F7,0x88F8, +0x88F9,0x88FA,0x88FB,0x88FC,0x88FD,0x88FE,0x8940,0x8941, +0x8942,0x8943,0x8944,0x8945,0xDCA8,0x8946,0x8947,0x8948, +0x8949,0x894A,0x894B,0x894C,0xCBFA,0xEBF3,0x894D,0x894E, +0x894F,0xCBDC,0x8950,0x8951,0xCBFE,0x8952,0x8953,0x8954, +0xCCC1,0x8955,0x8956,0x8957,0x8958,0x8959,0xC8FB,0x895A, +0x895B,0x895C,0x895D,0x895E,0x895F,0xDCAA,0x8960,0x8961, +0x8962,0x8963,0x8964,0xCCEE,0xDCAB,0x8965,0x8966,0x8967, +0x8968,0x8969,0x896A,0x896B,0x896C,0x896D,0x896E,0x896F, +0x8970,0x8971,0x8972,0x8973,0x8974,0x8975,0xDBD3,0x8976, +0xDCAF,0xDCAC,0x8977,0xBEB3,0x8978,0xCAFB,0x8979,0x897A, +0x897B,0xDCAD,0x897C,0x897D,0x897E,0x8980,0x8981,0x8982, +0x8983,0x8984,0xC9CA,0xC4B9,0x8985,0x8986,0x8987,0x8988, +0x8989,0xC7BD,0xDCAE,0x898A,0x898B,0x898C,0xD4F6,0xD0E6, +0x898D,0x898E,0x898F,0x8990,0x8991,0x8992,0x8993,0x8994, +0xC4AB,0xB6D5,0x8995,0x8996,0x8997,0x8998,0x8999,0x899A, +0x899B,0x899C,0x899D,0x899E,0x899F,0x89A0,0x89A1,0x89A2, +0x89A3,0x89A4,0x89A5,0x89A6,0xDBD4,0x89A7,0x89A8,0x89A9, +0x89AA,0xB1DA,0x89AB,0x89AC,0x89AD,0xDBD5,0x89AE,0x89AF, +0x89B0,0x89B1,0x89B2,0x89B3,0x89B4,0x89B5,0x89B6,0x89B7, +0x89B8,0xDBD6,0x89B9,0x89BA,0x89BB,0xBABE,0x89BC,0x89BD, +0x89BE,0x89BF,0x89C0,0x89C1,0x89C2,0x89C3,0x89C4,0x89C5, +0x89C6,0x89C7,0x89C8,0x89C9,0xC8C0,0x89CA,0x89CB,0x89CC, +0x89CD,0x89CE,0x89CF,0xCABF,0xC8C9,0x89D0,0xD7B3,0x89D1, +0xC9F9,0x89D2,0x89D3,0xBFC7,0x89D4,0x89D5,0xBAF8,0x89D6, +0x89D7,0xD2BC,0x89D8,0x89D9,0x89DA,0x89DB,0x89DC,0x89DD, +0x89DE,0x89DF,0xE2BA,0x89E0,0xB4A6,0x89E1,0x89E2,0xB1B8, +0x89E3,0x89E4,0x89E5,0x89E6,0x89E7,0xB8B4,0x89E8,0xCFC4, +0x89E9,0x89EA,0x89EB,0x89EC,0xD9E7,0xCFA6,0xCDE2,0x89ED, +0x89EE,0xD9ED,0xB6E0,0x89EF,0xD2B9,0x89F0,0x89F1,0xB9BB, +0x89F2,0x89F3,0x89F4,0x89F5,0xE2B9,0xE2B7,0x89F6,0xB4F3, +0x89F7,0xCCEC,0xCCAB,0xB7F2,0x89F8,0xD8B2,0xD1EB,0xBABB, +0x89F9,0xCAA7,0x89FA,0x89FB,0xCDB7,0x89FC,0x89FD,0xD2C4, +0xBFE4,0xBCD0,0xB6E1,0x89FE,0xDEC5,0x8A40,0x8A41,0x8A42, +0x8A43,0xDEC6,0xDBBC,0x8A44,0xD1D9,0x8A45,0x8A46,0xC6E6, +0xC4CE,0xB7EE,0x8A47,0xB7DC,0x8A48,0x8A49,0xBFFC,0xD7E0, +0x8A4A,0xC6F5,0x8A4B,0x8A4C,0xB1BC,0xDEC8,0xBDB1,0xCCD7, +0xDECA,0x8A4D,0xDEC9,0x8A4E,0x8A4F,0x8A50,0x8A51,0x8A52, +0xB5EC,0x8A53,0xC9DD,0x8A54,0x8A55,0xB0C2,0x8A56,0x8A57, +0x8A58,0x8A59,0x8A5A,0x8A5B,0x8A5C,0x8A5D,0x8A5E,0x8A5F, +0x8A60,0x8A61,0x8A62,0xC5AE,0xC5AB,0x8A63,0xC4CC,0x8A64, +0xBCE9,0xCBFD,0x8A65,0x8A66,0x8A67,0xBAC3,0x8A68,0x8A69, +0x8A6A,0xE5F9,0xC8E7,0xE5FA,0xCDFD,0x8A6B,0xD7B1,0xB8BE, +0xC2E8,0x8A6C,0xC8D1,0x8A6D,0x8A6E,0xE5FB,0x8A6F,0x8A70, +0x8A71,0x8A72,0xB6CA,0xBCCB,0x8A73,0x8A74,0xD1FD,0xE6A1, +0x8A75,0xC3EE,0x8A76,0x8A77,0x8A78,0x8A79,0xE6A4,0x8A7A, +0x8A7B,0x8A7C,0x8A7D,0xE5FE,0xE6A5,0xCDD7,0x8A7E,0x8A80, +0xB7C1,0xE5FC,0xE5FD,0xE6A3,0x8A81,0x8A82,0xC4DD,0xE6A8, +0x8A83,0x8A84,0xE6A7,0x8A85,0x8A86,0x8A87,0x8A88,0x8A89, +0x8A8A,0xC3C3,0x8A8B,0xC6DE,0x8A8C,0x8A8D,0xE6AA,0x8A8E, +0x8A8F,0x8A90,0x8A91,0x8A92,0x8A93,0x8A94,0xC4B7,0x8A95, +0x8A96,0x8A97,0xE6A2,0xCABC,0x8A98,0x8A99,0x8A9A,0x8A9B, +0xBDE3,0xB9C3,0xE6A6,0xD0D5,0xCEAF,0x8A9C,0x8A9D,0xE6A9, +0xE6B0,0x8A9E,0xD2A6,0x8A9F,0xBDAA,0xE6AD,0x8AA0,0x8AA1, +0x8AA2,0x8AA3,0x8AA4,0xE6AF,0x8AA5,0xC0D1,0x8AA6,0x8AA7, +0xD2CC,0x8AA8,0x8AA9,0x8AAA,0xBCA7,0x8AAB,0x8AAC,0x8AAD, +0x8AAE,0x8AAF,0x8AB0,0x8AB1,0x8AB2,0x8AB3,0x8AB4,0x8AB5, +0x8AB6,0xE6B1,0x8AB7,0xD2F6,0x8AB8,0x8AB9,0x8ABA,0xD7CB, +0x8ABB,0xCDFE,0x8ABC,0xCDDE,0xC2A6,0xE6AB,0xE6AC,0xBDBF, +0xE6AE,0xE6B3,0x8ABD,0x8ABE,0xE6B2,0x8ABF,0x8AC0,0x8AC1, +0x8AC2,0xE6B6,0x8AC3,0xE6B8,0x8AC4,0x8AC5,0x8AC6,0x8AC7, +0xC4EF,0x8AC8,0x8AC9,0x8ACA,0xC4C8,0x8ACB,0x8ACC,0xBEEA, +0xC9EF,0x8ACD,0x8ACE,0xE6B7,0x8ACF,0xB6F0,0x8AD0,0x8AD1, +0x8AD2,0xC3E4,0x8AD3,0x8AD4,0x8AD5,0x8AD6,0x8AD7,0x8AD8, +0x8AD9,0xD3E9,0xE6B4,0x8ADA,0xE6B5,0x8ADB,0xC8A2,0x8ADC, +0x8ADD,0x8ADE,0x8ADF,0x8AE0,0xE6BD,0x8AE1,0x8AE2,0x8AE3, +0xE6B9,0x8AE4,0x8AE5,0x8AE6,0x8AE7,0x8AE8,0xC6C5,0x8AE9, +0x8AEA,0xCDF1,0xE6BB,0x8AEB,0x8AEC,0x8AED,0x8AEE,0x8AEF, +0x8AF0,0x8AF1,0x8AF2,0x8AF3,0x8AF4,0xE6BC,0x8AF5,0x8AF6, +0x8AF7,0x8AF8,0xBBE9,0x8AF9,0x8AFA,0x8AFB,0x8AFC,0x8AFD, +0x8AFE,0x8B40,0xE6BE,0x8B41,0x8B42,0x8B43,0x8B44,0xE6BA, +0x8B45,0x8B46,0xC0B7,0x8B47,0x8B48,0x8B49,0x8B4A,0x8B4B, +0x8B4C,0x8B4D,0x8B4E,0x8B4F,0xD3A4,0xE6BF,0xC9F4,0xE6C3, +0x8B50,0x8B51,0xE6C4,0x8B52,0x8B53,0x8B54,0x8B55,0xD0F6, +0x8B56,0x8B57,0x8B58,0x8B59,0x8B5A,0x8B5B,0x8B5C,0x8B5D, +0x8B5E,0x8B5F,0x8B60,0x8B61,0x8B62,0x8B63,0x8B64,0x8B65, +0x8B66,0x8B67,0xC3BD,0x8B68,0x8B69,0x8B6A,0x8B6B,0x8B6C, +0x8B6D,0x8B6E,0xC3C4,0xE6C2,0x8B6F,0x8B70,0x8B71,0x8B72, +0x8B73,0x8B74,0x8B75,0x8B76,0x8B77,0x8B78,0x8B79,0x8B7A, +0x8B7B,0x8B7C,0xE6C1,0x8B7D,0x8B7E,0x8B80,0x8B81,0x8B82, +0x8B83,0x8B84,0xE6C7,0xCFB1,0x8B85,0xEBF4,0x8B86,0x8B87, +0xE6CA,0x8B88,0x8B89,0x8B8A,0x8B8B,0x8B8C,0xE6C5,0x8B8D, +0x8B8E,0xBCDE,0xC9A9,0x8B8F,0x8B90,0x8B91,0x8B92,0x8B93, +0x8B94,0xBCB5,0x8B95,0x8B96,0xCFD3,0x8B97,0x8B98,0x8B99, +0x8B9A,0x8B9B,0xE6C8,0x8B9C,0xE6C9,0x8B9D,0xE6CE,0x8B9E, +0xE6D0,0x8B9F,0x8BA0,0x8BA1,0xE6D1,0x8BA2,0x8BA3,0x8BA4, +0xE6CB,0xB5D5,0x8BA5,0xE6CC,0x8BA6,0x8BA7,0xE6CF,0x8BA8, +0x8BA9,0xC4DB,0x8BAA,0xE6C6,0x8BAB,0x8BAC,0x8BAD,0x8BAE, +0x8BAF,0xE6CD,0x8BB0,0x8BB1,0x8BB2,0x8BB3,0x8BB4,0x8BB5, +0x8BB6,0x8BB7,0x8BB8,0x8BB9,0x8BBA,0x8BBB,0x8BBC,0x8BBD, +0x8BBE,0x8BBF,0x8BC0,0x8BC1,0x8BC2,0x8BC3,0x8BC4,0x8BC5, +0x8BC6,0xE6D2,0x8BC7,0x8BC8,0x8BC9,0x8BCA,0x8BCB,0x8BCC, +0x8BCD,0x8BCE,0x8BCF,0x8BD0,0x8BD1,0x8BD2,0xE6D4,0xE6D3, +0x8BD3,0x8BD4,0x8BD5,0x8BD6,0x8BD7,0x8BD8,0x8BD9,0x8BDA, +0x8BDB,0x8BDC,0x8BDD,0x8BDE,0x8BDF,0x8BE0,0x8BE1,0x8BE2, +0x8BE3,0x8BE4,0x8BE5,0x8BE6,0x8BE7,0x8BE8,0x8BE9,0x8BEA, +0x8BEB,0x8BEC,0xE6D5,0x8BED,0xD9F8,0x8BEE,0x8BEF,0xE6D6, +0x8BF0,0x8BF1,0x8BF2,0x8BF3,0x8BF4,0x8BF5,0x8BF6,0x8BF7, +0xE6D7,0x8BF8,0x8BF9,0x8BFA,0x8BFB,0x8BFC,0x8BFD,0x8BFE, +0x8C40,0x8C41,0x8C42,0x8C43,0x8C44,0x8C45,0x8C46,0x8C47, +0xD7D3,0xE6DD,0x8C48,0xE6DE,0xBFD7,0xD4D0,0x8C49,0xD7D6, +0xB4E6,0xCBEF,0xE6DA,0xD8C3,0xD7CE,0xD0A2,0x8C4A,0xC3CF, +0x8C4B,0x8C4C,0xE6DF,0xBCBE,0xB9C2,0xE6DB,0xD1A7,0x8C4D, +0x8C4E,0xBAA2,0xC2CF,0x8C4F,0xD8AB,0x8C50,0x8C51,0x8C52, +0xCAEB,0xE5EE,0x8C53,0xE6DC,0x8C54,0xB7F5,0x8C55,0x8C56, +0x8C57,0x8C58,0xC8E6,0x8C59,0x8C5A,0xC4F5,0x8C5B,0x8C5C, +0xE5B2,0xC4FE,0x8C5D,0xCBFC,0xE5B3,0xD5AC,0x8C5E,0xD3EE, +0xCAD8,0xB0B2,0x8C5F,0xCBCE,0xCDEA,0x8C60,0x8C61,0xBAEA, +0x8C62,0x8C63,0x8C64,0xE5B5,0x8C65,0xE5B4,0x8C66,0xD7DA, +0xB9D9,0xD6E6,0xB6A8,0xCDF0,0xD2CB,0xB1A6,0xCAB5,0x8C67, +0xB3E8,0xC9F3,0xBFCD,0xD0FB,0xCAD2,0xE5B6,0xBBC2,0x8C68, +0x8C69,0x8C6A,0xCFDC,0xB9AC,0x8C6B,0x8C6C,0x8C6D,0x8C6E, +0xD4D7,0x8C6F,0x8C70,0xBAA6,0xD1E7,0xCFFC,0xBCD2,0x8C71, +0xE5B7,0xC8DD,0x8C72,0x8C73,0x8C74,0xBFED,0xB1F6,0xCBDE, +0x8C75,0x8C76,0xBCC5,0x8C77,0xBCC4,0xD2FA,0xC3DC,0xBFDC, +0x8C78,0x8C79,0x8C7A,0x8C7B,0xB8BB,0x8C7C,0x8C7D,0x8C7E, +0xC3C2,0x8C80,0xBAAE,0xD4A2,0x8C81,0x8C82,0x8C83,0x8C84, +0x8C85,0x8C86,0x8C87,0x8C88,0x8C89,0xC7DE,0xC4AF,0xB2EC, +0x8C8A,0xB9D1,0x8C8B,0x8C8C,0xE5BB,0xC1C8,0x8C8D,0x8C8E, +0xD5AF,0x8C8F,0x8C90,0x8C91,0x8C92,0x8C93,0xE5BC,0x8C94, +0xE5BE,0x8C95,0x8C96,0x8C97,0x8C98,0x8C99,0x8C9A,0x8C9B, +0xB4E7,0xB6D4,0xCBC2,0xD1B0,0xB5BC,0x8C9C,0x8C9D,0xCAD9, +0x8C9E,0xB7E2,0x8C9F,0x8CA0,0xC9E4,0x8CA1,0xBDAB,0x8CA2, +0x8CA3,0xCEBE,0xD7F0,0x8CA4,0x8CA5,0x8CA6,0x8CA7,0xD0A1, +0x8CA8,0xC9D9,0x8CA9,0x8CAA,0xB6FB,0xE6D8,0xBCE2,0x8CAB, +0xB3BE,0x8CAC,0xC9D0,0x8CAD,0xE6D9,0xB3A2,0x8CAE,0x8CAF, +0x8CB0,0x8CB1,0xDECC,0x8CB2,0xD3C8,0xDECD,0x8CB3,0xD2A2, +0x8CB4,0x8CB5,0x8CB6,0x8CB7,0xDECE,0x8CB8,0x8CB9,0x8CBA, +0x8CBB,0xBECD,0x8CBC,0x8CBD,0xDECF,0x8CBE,0x8CBF,0x8CC0, +0xCAAC,0xD2FC,0xB3DF,0xE5EA,0xC4E1,0xBEA1,0xCEB2,0xC4F2, +0xBED6,0xC6A8,0xB2E3,0x8CC1,0x8CC2,0xBED3,0x8CC3,0x8CC4, +0xC7FC,0xCCEB,0xBDEC,0xCEDD,0x8CC5,0x8CC6,0xCABA,0xC6C1, +0xE5EC,0xD0BC,0x8CC7,0x8CC8,0x8CC9,0xD5B9,0x8CCA,0x8CCB, +0x8CCC,0xE5ED,0x8CCD,0x8CCE,0x8CCF,0x8CD0,0xCAF4,0x8CD1, +0xCDC0,0xC2C5,0x8CD2,0xE5EF,0x8CD3,0xC2C4,0xE5F0,0x8CD4, +0x8CD5,0x8CD6,0x8CD7,0x8CD8,0x8CD9,0x8CDA,0xE5F8,0xCDCD, +0x8CDB,0xC9BD,0x8CDC,0x8CDD,0x8CDE,0x8CDF,0x8CE0,0x8CE1, +0x8CE2,0xD2D9,0xE1A8,0x8CE3,0x8CE4,0x8CE5,0x8CE6,0xD3EC, +0x8CE7,0xCBEA,0xC6F1,0x8CE8,0x8CE9,0x8CEA,0x8CEB,0x8CEC, +0xE1AC,0x8CED,0x8CEE,0x8CEF,0xE1A7,0xE1A9,0x8CF0,0x8CF1, +0xE1AA,0xE1AF,0x8CF2,0x8CF3,0xB2ED,0x8CF4,0xE1AB,0xB8DA, +0xE1AD,0xE1AE,0xE1B0,0xB5BA,0xE1B1,0x8CF5,0x8CF6,0x8CF7, +0x8CF8,0x8CF9,0xE1B3,0xE1B8,0x8CFA,0x8CFB,0x8CFC,0x8CFD, +0x8CFE,0xD1D2,0x8D40,0xE1B6,0xE1B5,0xC1EB,0x8D41,0x8D42, +0x8D43,0xE1B7,0x8D44,0xD4C0,0x8D45,0xE1B2,0x8D46,0xE1BA, +0xB0B6,0x8D47,0x8D48,0x8D49,0x8D4A,0xE1B4,0x8D4B,0xBFF9, +0x8D4C,0xE1B9,0x8D4D,0x8D4E,0xE1BB,0x8D4F,0x8D50,0x8D51, +0x8D52,0x8D53,0x8D54,0xE1BE,0x8D55,0x8D56,0x8D57,0x8D58, +0x8D59,0x8D5A,0xE1BC,0x8D5B,0x8D5C,0x8D5D,0x8D5E,0x8D5F, +0x8D60,0xD6C5,0x8D61,0x8D62,0x8D63,0x8D64,0x8D65,0x8D66, +0x8D67,0xCFBF,0x8D68,0x8D69,0xE1BD,0xE1BF,0xC2CD,0x8D6A, +0xB6EB,0x8D6B,0xD3F8,0x8D6C,0x8D6D,0xC7CD,0x8D6E,0x8D6F, +0xB7E5,0x8D70,0x8D71,0x8D72,0x8D73,0x8D74,0x8D75,0x8D76, +0x8D77,0x8D78,0x8D79,0xBEFE,0x8D7A,0x8D7B,0x8D7C,0x8D7D, +0x8D7E,0x8D80,0xE1C0,0xE1C1,0x8D81,0x8D82,0xE1C7,0xB3E7, +0x8D83,0x8D84,0x8D85,0x8D86,0x8D87,0x8D88,0xC6E9,0x8D89, +0x8D8A,0x8D8B,0x8D8C,0x8D8D,0xB4DE,0x8D8E,0xD1C2,0x8D8F, +0x8D90,0x8D91,0x8D92,0xE1C8,0x8D93,0x8D94,0xE1C6,0x8D95, +0x8D96,0x8D97,0x8D98,0x8D99,0xE1C5,0x8D9A,0xE1C3,0xE1C2, +0x8D9B,0xB1C0,0x8D9C,0x8D9D,0x8D9E,0xD5B8,0xE1C4,0x8D9F, +0x8DA0,0x8DA1,0x8DA2,0x8DA3,0xE1CB,0x8DA4,0x8DA5,0x8DA6, +0x8DA7,0x8DA8,0x8DA9,0x8DAA,0x8DAB,0xE1CC,0xE1CA,0x8DAC, +0x8DAD,0x8DAE,0x8DAF,0x8DB0,0x8DB1,0x8DB2,0x8DB3,0xEFFA, +0x8DB4,0x8DB5,0xE1D3,0xE1D2,0xC7B6,0x8DB6,0x8DB7,0x8DB8, +0x8DB9,0x8DBA,0x8DBB,0x8DBC,0x8DBD,0x8DBE,0x8DBF,0x8DC0, +0xE1C9,0x8DC1,0x8DC2,0xE1CE,0x8DC3,0xE1D0,0x8DC4,0x8DC5, +0x8DC6,0x8DC7,0x8DC8,0x8DC9,0x8DCA,0x8DCB,0x8DCC,0x8DCD, +0x8DCE,0xE1D4,0x8DCF,0xE1D1,0xE1CD,0x8DD0,0x8DD1,0xE1CF, +0x8DD2,0x8DD3,0x8DD4,0x8DD5,0xE1D5,0x8DD6,0x8DD7,0x8DD8, +0x8DD9,0x8DDA,0x8DDB,0x8DDC,0x8DDD,0x8DDE,0x8DDF,0x8DE0, +0x8DE1,0x8DE2,0xE1D6,0x8DE3,0x8DE4,0x8DE5,0x8DE6,0x8DE7, +0x8DE8,0x8DE9,0x8DEA,0x8DEB,0x8DEC,0x8DED,0x8DEE,0x8DEF, +0x8DF0,0x8DF1,0x8DF2,0x8DF3,0x8DF4,0x8DF5,0x8DF6,0x8DF7, +0x8DF8,0xE1D7,0x8DF9,0x8DFA,0x8DFB,0xE1D8,0x8DFC,0x8DFD, +0x8DFE,0x8E40,0x8E41,0x8E42,0x8E43,0x8E44,0x8E45,0x8E46, +0x8E47,0x8E48,0x8E49,0x8E4A,0x8E4B,0x8E4C,0x8E4D,0x8E4E, +0x8E4F,0x8E50,0x8E51,0x8E52,0x8E53,0x8E54,0x8E55,0xE1DA, +0x8E56,0x8E57,0x8E58,0x8E59,0x8E5A,0x8E5B,0x8E5C,0x8E5D, +0x8E5E,0x8E5F,0x8E60,0x8E61,0x8E62,0xE1DB,0x8E63,0x8E64, +0x8E65,0x8E66,0x8E67,0x8E68,0x8E69,0xCEA1,0x8E6A,0x8E6B, +0x8E6C,0x8E6D,0x8E6E,0x8E6F,0x8E70,0x8E71,0x8E72,0x8E73, +0x8E74,0x8E75,0x8E76,0xE7DD,0x8E77,0xB4A8,0xD6DD,0x8E78, +0x8E79,0xD1B2,0xB3B2,0x8E7A,0x8E7B,0xB9A4,0xD7F3,0xC7C9, +0xBEDE,0xB9AE,0x8E7C,0xCED7,0x8E7D,0x8E7E,0xB2EE,0xDBCF, +0x8E80,0xBCBA,0xD2D1,0xCBC8,0xB0CD,0x8E81,0x8E82,0xCFEF, +0x8E83,0x8E84,0x8E85,0x8E86,0x8E87,0xD9E3,0xBDED,0x8E88, +0x8E89,0xB1D2,0xCAD0,0xB2BC,0x8E8A,0xCBA7,0xB7AB,0x8E8B, +0xCAA6,0x8E8C,0x8E8D,0x8E8E,0xCFA3,0x8E8F,0x8E90,0xE0F8, +0xD5CA,0xE0FB,0x8E91,0x8E92,0xE0FA,0xC5C1,0xCCFB,0x8E93, +0xC1B1,0xE0F9,0xD6E3,0xB2AF,0xD6C4,0xB5DB,0x8E94,0x8E95, +0x8E96,0x8E97,0x8E98,0x8E99,0x8E9A,0x8E9B,0xB4F8,0xD6A1, +0x8E9C,0x8E9D,0x8E9E,0x8E9F,0x8EA0,0xCFAF,0xB0EF,0x8EA1, +0x8EA2,0xE0FC,0x8EA3,0x8EA4,0x8EA5,0x8EA6,0x8EA7,0xE1A1, +0xB3A3,0x8EA8,0x8EA9,0xE0FD,0xE0FE,0xC3B1,0x8EAA,0x8EAB, +0x8EAC,0x8EAD,0xC3DD,0x8EAE,0xE1A2,0xB7F9,0x8EAF,0x8EB0, +0x8EB1,0x8EB2,0x8EB3,0x8EB4,0xBBCF,0x8EB5,0x8EB6,0x8EB7, +0x8EB8,0x8EB9,0x8EBA,0x8EBB,0xE1A3,0xC4BB,0x8EBC,0x8EBD, +0x8EBE,0x8EBF,0x8EC0,0xE1A4,0x8EC1,0x8EC2,0xE1A5,0x8EC3, +0x8EC4,0xE1A6,0xB4B1,0x8EC5,0x8EC6,0x8EC7,0x8EC8,0x8EC9, +0x8ECA,0x8ECB,0x8ECC,0x8ECD,0x8ECE,0x8ECF,0x8ED0,0x8ED1, +0x8ED2,0x8ED3,0xB8C9,0xC6BD,0xC4EA,0x8ED4,0xB2A2,0x8ED5, +0xD0D2,0x8ED6,0xE7DB,0xBBC3,0xD3D7,0xD3C4,0x8ED7,0xB9E3, +0xE2CF,0x8ED8,0x8ED9,0x8EDA,0xD7AF,0x8EDB,0xC7EC,0xB1D3, +0x8EDC,0x8EDD,0xB4B2,0xE2D1,0x8EDE,0x8EDF,0x8EE0,0xD0F2, +0xC2AE,0xE2D0,0x8EE1,0xBFE2,0xD3A6,0xB5D7,0xE2D2,0xB5EA, +0x8EE2,0xC3ED,0xB8FD,0x8EE3,0xB8AE,0x8EE4,0xC5D3,0xB7CF, +0xE2D4,0x8EE5,0x8EE6,0x8EE7,0x8EE8,0xE2D3,0xB6C8,0xD7F9, +0x8EE9,0x8EEA,0x8EEB,0x8EEC,0x8EED,0xCDA5,0x8EEE,0x8EEF, +0x8EF0,0x8EF1,0x8EF2,0xE2D8,0x8EF3,0xE2D6,0xCAFC,0xBFB5, +0xD3B9,0xE2D5,0x8EF4,0x8EF5,0x8EF6,0x8EF7,0xE2D7,0x8EF8, +0x8EF9,0x8EFA,0x8EFB,0x8EFC,0x8EFD,0x8EFE,0x8F40,0x8F41, +0x8F42,0xC1AE,0xC0C8,0x8F43,0x8F44,0x8F45,0x8F46,0x8F47, +0x8F48,0xE2DB,0xE2DA,0xC0AA,0x8F49,0x8F4A,0xC1CE,0x8F4B, +0x8F4C,0x8F4D,0x8F4E,0xE2DC,0x8F4F,0x8F50,0x8F51,0x8F52, +0x8F53,0x8F54,0x8F55,0x8F56,0x8F57,0x8F58,0x8F59,0x8F5A, +0xE2DD,0x8F5B,0xE2DE,0x8F5C,0x8F5D,0x8F5E,0x8F5F,0x8F60, +0x8F61,0x8F62,0x8F63,0x8F64,0xDBC8,0x8F65,0xD1D3,0xCDA2, +0x8F66,0x8F67,0xBDA8,0x8F68,0x8F69,0x8F6A,0xDEC3,0xD8A5, +0xBFAA,0xDBCD,0xD2EC,0xC6FA,0xC5AA,0x8F6B,0x8F6C,0x8F6D, +0xDEC4,0x8F6E,0xB1D7,0xDFAE,0x8F6F,0x8F70,0x8F71,0xCABD, +0x8F72,0xDFB1,0x8F73,0xB9AD,0x8F74,0xD2FD,0x8F75,0xB8A5, +0xBAEB,0x8F76,0x8F77,0xB3DA,0x8F78,0x8F79,0x8F7A,0xB5DC, +0xD5C5,0x8F7B,0x8F7C,0x8F7D,0x8F7E,0xC3D6,0xCFD2,0xBBA1, +0x8F80,0xE5F3,0xE5F2,0x8F81,0x8F82,0xE5F4,0x8F83,0xCDE4, +0x8F84,0xC8F5,0x8F85,0x8F86,0x8F87,0x8F88,0x8F89,0x8F8A, +0x8F8B,0xB5AF,0xC7BF,0x8F8C,0xE5F6,0x8F8D,0x8F8E,0x8F8F, +0xECB0,0x8F90,0x8F91,0x8F92,0x8F93,0x8F94,0x8F95,0x8F96, +0x8F97,0x8F98,0x8F99,0x8F9A,0x8F9B,0x8F9C,0x8F9D,0x8F9E, +0xE5E6,0x8F9F,0xB9E9,0xB5B1,0x8FA0,0xC2BC,0xE5E8,0xE5E7, +0xE5E9,0x8FA1,0x8FA2,0x8FA3,0x8FA4,0xD2CD,0x8FA5,0x8FA6, +0x8FA7,0xE1EA,0xD0CE,0x8FA8,0xCDAE,0x8FA9,0xD1E5,0x8FAA, +0x8FAB,0xB2CA,0xB1EB,0x8FAC,0xB1F2,0xC5ED,0x8FAD,0x8FAE, +0xD5C3,0xD3B0,0x8FAF,0xE1DC,0x8FB0,0x8FB1,0x8FB2,0xE1DD, +0x8FB3,0xD2DB,0x8FB4,0xB3B9,0xB1CB,0x8FB5,0x8FB6,0x8FB7, +0xCDF9,0xD5F7,0xE1DE,0x8FB8,0xBEB6,0xB4FD,0x8FB9,0xE1DF, +0xBADC,0xE1E0,0xBBB2,0xC2C9,0xE1E1,0x8FBA,0x8FBB,0x8FBC, +0xD0EC,0x8FBD,0xCDBD,0x8FBE,0x8FBF,0xE1E2,0x8FC0,0xB5C3, +0xC5C7,0xE1E3,0x8FC1,0x8FC2,0xE1E4,0x8FC3,0x8FC4,0x8FC5, +0x8FC6,0xD3F9,0x8FC7,0x8FC8,0x8FC9,0x8FCA,0x8FCB,0x8FCC, +0xE1E5,0x8FCD,0xD1AD,0x8FCE,0x8FCF,0xE1E6,0xCEA2,0x8FD0, +0x8FD1,0x8FD2,0x8FD3,0x8FD4,0x8FD5,0xE1E7,0x8FD6,0xB5C2, +0x8FD7,0x8FD8,0x8FD9,0x8FDA,0xE1E8,0xBBD5,0x8FDB,0x8FDC, +0x8FDD,0x8FDE,0x8FDF,0xD0C4,0xE2E0,0xB1D8,0xD2E4,0x8FE0, +0x8FE1,0xE2E1,0x8FE2,0x8FE3,0xBCC9,0xC8CC,0x8FE4,0xE2E3, +0xECFE,0xECFD,0xDFAF,0x8FE5,0x8FE6,0x8FE7,0xE2E2,0xD6BE, +0xCDFC,0xC3A6,0x8FE8,0x8FE9,0x8FEA,0xE3C3,0x8FEB,0x8FEC, +0xD6D2,0xE2E7,0x8FED,0x8FEE,0xE2E8,0x8FEF,0x8FF0,0xD3C7, +0x8FF1,0x8FF2,0xE2EC,0xBFEC,0x8FF3,0xE2ED,0xE2E5,0x8FF4, +0x8FF5,0xB3C0,0x8FF6,0x8FF7,0x8FF8,0xC4EE,0x8FF9,0x8FFA, +0xE2EE,0x8FFB,0x8FFC,0xD0C3,0x8FFD,0xBAF6,0xE2E9,0xB7DE, +0xBBB3,0xCCAC,0xCBCB,0xE2E4,0xE2E6,0xE2EA,0xE2EB,0x8FFE, +0x9040,0x9041,0xE2F7,0x9042,0x9043,0xE2F4,0xD4F5,0xE2F3, +0x9044,0x9045,0xC5AD,0x9046,0xD5FA,0xC5C2,0xB2C0,0x9047, +0x9048,0xE2EF,0x9049,0xE2F2,0xC1AF,0xCBBC,0x904A,0x904B, +0xB5A1,0xE2F9,0x904C,0x904D,0x904E,0xBCB1,0xE2F1,0xD0D4, +0xD4B9,0xE2F5,0xB9D6,0xE2F6,0x904F,0x9050,0x9051,0xC7D3, +0x9052,0x9053,0x9054,0x9055,0x9056,0xE2F0,0x9057,0x9058, +0x9059,0x905A,0x905B,0xD7DC,0xEDA1,0x905C,0x905D,0xE2F8, +0x905E,0xEDA5,0xE2FE,0xCAD1,0x905F,0x9060,0x9061,0x9062, +0x9063,0x9064,0x9065,0xC1B5,0x9066,0xBBD0,0x9067,0x9068, +0xBFD6,0x9069,0xBAE3,0x906A,0x906B,0xCBA1,0x906C,0x906D, +0x906E,0xEDA6,0xEDA3,0x906F,0x9070,0xEDA2,0x9071,0x9072, +0x9073,0x9074,0xBBD6,0xEDA7,0xD0F4,0x9075,0x9076,0xEDA4, +0xBADE,0xB6F7,0xE3A1,0xB6B2,0xCCF1,0xB9A7,0x9077,0xCFA2, +0xC7A1,0x9078,0x9079,0xBFD2,0x907A,0x907B,0xB6F1,0x907C, +0xE2FA,0xE2FB,0xE2FD,0xE2FC,0xC4D5,0xE3A2,0x907D,0xD3C1, +0x907E,0x9080,0x9081,0xE3A7,0xC7C4,0x9082,0x9083,0x9084, +0x9085,0xCFA4,0x9086,0x9087,0xE3A9,0xBAB7,0x9088,0x9089, +0x908A,0x908B,0xE3A8,0x908C,0xBBDA,0x908D,0xE3A3,0x908E, +0x908F,0x9090,0xE3A4,0xE3AA,0x9091,0xE3A6,0x9092,0xCEF2, +0xD3C6,0x9093,0x9094,0xBBBC,0x9095,0x9096,0xD4C3,0x9097, +0xC4FA,0x9098,0x9099,0xEDA8,0xD0FC,0xE3A5,0x909A,0xC3F5, +0x909B,0xE3AD,0xB1AF,0x909C,0xE3B2,0x909D,0x909E,0x909F, +0xBCC2,0x90A0,0x90A1,0xE3AC,0xB5BF,0x90A2,0x90A3,0x90A4, +0x90A5,0x90A6,0x90A7,0x90A8,0x90A9,0xC7E9,0xE3B0,0x90AA, +0x90AB,0x90AC,0xBEAA,0xCDEF,0x90AD,0x90AE,0x90AF,0x90B0, +0x90B1,0xBBF3,0x90B2,0x90B3,0x90B4,0xCCE8,0x90B5,0x90B6, +0xE3AF,0x90B7,0xE3B1,0x90B8,0xCFA7,0xE3AE,0x90B9,0xCEA9, +0xBBDD,0x90BA,0x90BB,0x90BC,0x90BD,0x90BE,0xB5EB,0xBEE5, +0xB2D2,0xB3CD,0x90BF,0xB1B9,0xE3AB,0xB2D1,0xB5AC,0xB9DF, +0xB6E8,0x90C0,0x90C1,0xCFEB,0xE3B7,0x90C2,0xBBCC,0x90C3, +0x90C4,0xC8C7,0xD0CA,0x90C5,0x90C6,0x90C7,0x90C8,0x90C9, +0xE3B8,0xB3EE,0x90CA,0x90CB,0x90CC,0x90CD,0xEDA9,0x90CE, +0xD3FA,0xD3E4,0x90CF,0x90D0,0x90D1,0xEDAA,0xE3B9,0xD2E2, +0x90D2,0x90D3,0x90D4,0x90D5,0x90D6,0xE3B5,0x90D7,0x90D8, +0x90D9,0x90DA,0xD3DE,0x90DB,0x90DC,0x90DD,0x90DE,0xB8D0, +0xE3B3,0x90DF,0x90E0,0xE3B6,0xB7DF,0x90E1,0xE3B4,0xC0A2, +0x90E2,0x90E3,0x90E4,0xE3BA,0x90E5,0x90E6,0x90E7,0x90E8, +0x90E9,0x90EA,0x90EB,0x90EC,0x90ED,0x90EE,0x90EF,0x90F0, +0x90F1,0x90F2,0x90F3,0x90F4,0x90F5,0x90F6,0x90F7,0xD4B8, +0x90F8,0x90F9,0x90FA,0x90FB,0x90FC,0x90FD,0x90FE,0x9140, +0xB4C8,0x9141,0xE3BB,0x9142,0xBBC5,0x9143,0xC9F7,0x9144, +0x9145,0xC9E5,0x9146,0x9147,0x9148,0xC4BD,0x9149,0x914A, +0x914B,0x914C,0x914D,0x914E,0x914F,0xEDAB,0x9150,0x9151, +0x9152,0x9153,0xC2FD,0x9154,0x9155,0x9156,0x9157,0xBBDB, +0xBFAE,0x9158,0x9159,0x915A,0x915B,0x915C,0x915D,0x915E, +0xCEBF,0x915F,0x9160,0x9161,0x9162,0xE3BC,0x9163,0xBFB6, +0x9164,0x9165,0x9166,0x9167,0x9168,0x9169,0x916A,0x916B, +0x916C,0x916D,0x916E,0x916F,0x9170,0x9171,0x9172,0x9173, +0x9174,0x9175,0x9176,0xB1EF,0x9177,0x9178,0xD4F7,0x9179, +0x917A,0x917B,0x917C,0x917D,0xE3BE,0x917E,0x9180,0x9181, +0x9182,0x9183,0x9184,0x9185,0x9186,0xEDAD,0x9187,0x9188, +0x9189,0x918A,0x918B,0x918C,0x918D,0x918E,0x918F,0xE3BF, +0xBAA9,0xEDAC,0x9190,0x9191,0xE3BD,0x9192,0x9193,0x9194, +0x9195,0x9196,0x9197,0x9198,0x9199,0x919A,0x919B,0xE3C0, +0x919C,0x919D,0x919E,0x919F,0x91A0,0x91A1,0xBAB6,0x91A2, +0x91A3,0x91A4,0xB6AE,0x91A5,0x91A6,0x91A7,0x91A8,0x91A9, +0xD0B8,0x91AA,0xB0C3,0xEDAE,0x91AB,0x91AC,0x91AD,0x91AE, +0x91AF,0xEDAF,0xC0C1,0x91B0,0xE3C1,0x91B1,0x91B2,0x91B3, +0x91B4,0x91B5,0x91B6,0x91B7,0x91B8,0x91B9,0x91BA,0x91BB, +0x91BC,0x91BD,0x91BE,0x91BF,0x91C0,0x91C1,0xC5B3,0x91C2, +0x91C3,0x91C4,0x91C5,0x91C6,0x91C7,0x91C8,0x91C9,0x91CA, +0x91CB,0x91CC,0x91CD,0x91CE,0x91CF,0xE3C2,0x91D0,0x91D1, +0x91D2,0x91D3,0x91D4,0x91D5,0x91D6,0x91D7,0x91D8,0xDCB2, +0x91D9,0x91DA,0x91DB,0x91DC,0x91DD,0x91DE,0xEDB0,0x91DF, +0xB8EA,0x91E0,0xCEEC,0xEAA7,0xD0E7,0xCAF9,0xC8D6,0xCFB7, +0xB3C9,0xCED2,0xBDE4,0x91E1,0x91E2,0xE3DE,0xBBF2,0xEAA8, +0xD5BD,0x91E3,0xC6DD,0xEAA9,0x91E4,0x91E5,0x91E6,0xEAAA, +0x91E7,0xEAAC,0xEAAB,0x91E8,0xEAAE,0xEAAD,0x91E9,0x91EA, +0x91EB,0x91EC,0xBDD8,0x91ED,0xEAAF,0x91EE,0xC2BE,0x91EF, +0x91F0,0x91F1,0x91F2,0xB4C1,0xB4F7,0x91F3,0x91F4,0xBBA7, +0x91F5,0x91F6,0x91F7,0x91F8,0x91F9,0xECE6,0xECE5,0xB7BF, +0xCBF9,0xB1E2,0x91FA,0xECE7,0x91FB,0x91FC,0x91FD,0xC9C8, +0xECE8,0xECE9,0x91FE,0xCAD6,0xDED0,0xB2C5,0xD4FA,0x9240, +0x9241,0xC6CB,0xB0C7,0xB4F2,0xC8D3,0x9242,0x9243,0x9244, +0xCDD0,0x9245,0x9246,0xBFB8,0x9247,0x9248,0x9249,0x924A, +0x924B,0x924C,0x924D,0xBFDB,0x924E,0x924F,0xC7A4,0xD6B4, +0x9250,0xC0A9,0xDED1,0xC9A8,0xD1EF,0xC5A4,0xB0E7,0xB3B6, +0xC8C5,0x9251,0x9252,0xB0E2,0x9253,0x9254,0xB7F6,0x9255, +0x9256,0xC5FA,0x9257,0x9258,0xB6F3,0x9259,0xD5D2,0xB3D0, +0xBCBC,0x925A,0x925B,0x925C,0xB3AD,0x925D,0x925E,0x925F, +0x9260,0xBEF1,0xB0D1,0x9261,0x9262,0x9263,0x9264,0x9265, +0x9266,0xD2D6,0xCAE3,0xD7A5,0x9267,0xCDB6,0xB6B6,0xBFB9, +0xD5DB,0x9268,0xB8A7,0xC5D7,0x9269,0x926A,0x926B,0xDED2, +0xBFD9,0xC2D5,0xC7C0,0x926C,0xBBA4,0xB1A8,0x926D,0x926E, +0xC5EA,0x926F,0x9270,0xC5FB,0xCCA7,0x9271,0x9272,0x9273, +0x9274,0xB1A7,0x9275,0x9276,0x9277,0xB5D6,0x9278,0x9279, +0x927A,0xC4A8,0x927B,0xDED3,0xD1BA,0xB3E9,0x927C,0xC3F2, +0x927D,0x927E,0xB7F7,0x9280,0xD6F4,0xB5A3,0xB2F0,0xC4B4, +0xC4E9,0xC0AD,0xDED4,0x9281,0xB0E8,0xC5C4,0xC1E0,0x9282, +0xB9D5,0x9283,0xBEDC,0xCDD8,0xB0CE,0x9284,0xCDCF,0xDED6, +0xBED0,0xD7BE,0xDED5,0xD5D0,0xB0DD,0x9285,0x9286,0xC4E2, +0x9287,0x9288,0xC2A3,0xBCF0,0x9289,0xD3B5,0xC0B9,0xC5A1, +0xB2A6,0xD4F1,0x928A,0x928B,0xC0A8,0xCAC3,0xDED7,0xD5FC, +0x928C,0xB9B0,0x928D,0xC8AD,0xCBA9,0x928E,0xDED9,0xBFBD, +0x928F,0x9290,0x9291,0x9292,0xC6B4,0xD7A7,0xCAB0,0xC4C3, +0x9293,0xB3D6,0xB9D2,0x9294,0x9295,0x9296,0x9297,0xD6B8, +0xEAFC,0xB0B4,0x9298,0x9299,0x929A,0x929B,0xBFE6,0x929C, +0x929D,0xCCF4,0x929E,0x929F,0x92A0,0x92A1,0xCDDA,0x92A2, +0x92A3,0x92A4,0xD6BF,0xC2CE,0x92A5,0xCECE,0xCCA2,0xD0AE, +0xC4D3,0xB5B2,0xDED8,0xD5F5,0xBCB7,0xBBD3,0x92A6,0x92A7, +0xB0A4,0x92A8,0xC5B2,0xB4EC,0x92A9,0x92AA,0x92AB,0xD5F1, +0x92AC,0x92AD,0xEAFD,0x92AE,0x92AF,0x92B0,0x92B1,0x92B2, +0x92B3,0xDEDA,0xCDA6,0x92B4,0x92B5,0xCDEC,0x92B6,0x92B7, +0x92B8,0x92B9,0xCEE6,0xDEDC,0x92BA,0xCDB1,0xC0A6,0x92BB, +0x92BC,0xD7BD,0x92BD,0xDEDB,0xB0C6,0xBAB4,0xC9D3,0xC4F3, +0xBEE8,0x92BE,0x92BF,0x92C0,0x92C1,0xB2B6,0x92C2,0x92C3, +0x92C4,0x92C5,0x92C6,0x92C7,0x92C8,0x92C9,0xC0CC,0xCBF0, +0x92CA,0xBCF1,0xBBBB,0xB5B7,0x92CB,0x92CC,0x92CD,0xC5F5, +0x92CE,0xDEE6,0x92CF,0x92D0,0x92D1,0xDEE3,0xBEDD,0x92D2, +0x92D3,0xDEDF,0x92D4,0x92D5,0x92D6,0x92D7,0xB4B7,0xBDDD, +0x92D8,0x92D9,0xDEE0,0xC4ED,0x92DA,0x92DB,0x92DC,0x92DD, +0xCFC6,0x92DE,0xB5E0,0x92DF,0x92E0,0x92E1,0x92E2,0xB6DE, +0xCADA,0xB5F4,0xDEE5,0x92E3,0xD5C6,0x92E4,0xDEE1,0xCCCD, +0xC6FE,0x92E5,0xC5C5,0x92E6,0x92E7,0x92E8,0xD2B4,0x92E9, +0xBEF2,0x92EA,0x92EB,0x92EC,0x92ED,0x92EE,0x92EF,0x92F0, +0xC2D3,0x92F1,0xCCBD,0xB3B8,0x92F2,0xBDD3,0x92F3,0xBFD8, +0xCDC6,0xD1DA,0xB4EB,0x92F4,0xDEE4,0xDEDD,0xDEE7,0x92F5, +0xEAFE,0x92F6,0x92F7,0xC2B0,0xDEE2,0x92F8,0x92F9,0xD6C0, +0xB5A7,0x92FA,0xB2F4,0x92FB,0xDEE8,0x92FC,0xDEF2,0x92FD, +0x92FE,0x9340,0x9341,0x9342,0xDEED,0x9343,0xDEF1,0x9344, +0x9345,0xC8E0,0x9346,0x9347,0x9348,0xD7E1,0xDEEF,0xC3E8, +0xCCE1,0x9349,0xB2E5,0x934A,0x934B,0x934C,0xD2BE,0x934D, +0x934E,0x934F,0x9350,0x9351,0x9352,0x9353,0xDEEE,0x9354, +0xDEEB,0xCED5,0x9355,0xB4A7,0x9356,0x9357,0x9358,0x9359, +0x935A,0xBFAB,0xBEBE,0x935B,0x935C,0xBDD2,0x935D,0x935E, +0x935F,0x9360,0xDEE9,0x9361,0xD4AE,0x9362,0xDEDE,0x9363, +0xDEEA,0x9364,0x9365,0x9366,0x9367,0xC0BF,0x9368,0xDEEC, +0xB2F3,0xB8E9,0xC2A7,0x9369,0x936A,0xBDC1,0x936B,0x936C, +0x936D,0x936E,0x936F,0xDEF5,0xDEF8,0x9370,0x9371,0xB2AB, +0xB4A4,0x9372,0x9373,0xB4EA,0xC9A6,0x9374,0x9375,0x9376, +0x9377,0x9378,0x9379,0xDEF6,0xCBD1,0x937A,0xB8E3,0x937B, +0xDEF7,0xDEFA,0x937C,0x937D,0x937E,0x9380,0xDEF9,0x9381, +0x9382,0x9383,0xCCC2,0x9384,0xB0E1,0xB4EE,0x9385,0x9386, +0x9387,0x9388,0x9389,0x938A,0xE5BA,0x938B,0x938C,0x938D, +0x938E,0x938F,0xD0AF,0x9390,0x9391,0xB2EB,0x9392,0xEBA1, +0x9393,0xDEF4,0x9394,0x9395,0xC9E3,0xDEF3,0xB0DA,0xD2A1, +0xB1F7,0x9396,0xCCAF,0x9397,0x9398,0x9399,0x939A,0x939B, +0x939C,0x939D,0xDEF0,0x939E,0xCBA4,0x939F,0x93A0,0x93A1, +0xD5AA,0x93A2,0x93A3,0x93A4,0x93A5,0x93A6,0xDEFB,0x93A7, +0x93A8,0x93A9,0x93AA,0x93AB,0x93AC,0x93AD,0x93AE,0xB4DD, +0x93AF,0xC4A6,0x93B0,0x93B1,0x93B2,0xDEFD,0x93B3,0x93B4, +0x93B5,0x93B6,0x93B7,0x93B8,0x93B9,0x93BA,0x93BB,0x93BC, +0xC3FE,0xC4A1,0xDFA1,0x93BD,0x93BE,0x93BF,0x93C0,0x93C1, +0x93C2,0x93C3,0xC1CC,0x93C4,0xDEFC,0xBEEF,0x93C5,0xC6B2, +0x93C6,0x93C7,0x93C8,0x93C9,0x93CA,0x93CB,0x93CC,0x93CD, +0x93CE,0xB3C5,0xC8F6,0x93CF,0x93D0,0xCBBA,0xDEFE,0x93D1, +0x93D2,0xDFA4,0x93D3,0x93D4,0x93D5,0x93D6,0xD7B2,0x93D7, +0x93D8,0x93D9,0x93DA,0x93DB,0xB3B7,0x93DC,0x93DD,0x93DE, +0x93DF,0xC1C3,0x93E0,0x93E1,0xC7CB,0xB2A5,0xB4E9,0x93E2, +0xD7AB,0x93E3,0x93E4,0x93E5,0x93E6,0xC4EC,0x93E7,0xDFA2, +0xDFA3,0x93E8,0xDFA5,0x93E9,0xBAB3,0x93EA,0x93EB,0x93EC, +0xDFA6,0x93ED,0xC0DE,0x93EE,0x93EF,0xC9C3,0x93F0,0x93F1, +0x93F2,0x93F3,0x93F4,0x93F5,0x93F6,0xB2D9,0xC7E6,0x93F7, +0xDFA7,0x93F8,0xC7DC,0x93F9,0x93FA,0x93FB,0x93FC,0xDFA8, +0xEBA2,0x93FD,0x93FE,0x9440,0x9441,0x9442,0xCBD3,0x9443, +0x9444,0x9445,0xDFAA,0x9446,0xDFA9,0x9447,0xB2C1,0x9448, +0x9449,0x944A,0x944B,0x944C,0x944D,0x944E,0x944F,0x9450, +0x9451,0x9452,0x9453,0x9454,0x9455,0x9456,0x9457,0x9458, +0x9459,0x945A,0x945B,0x945C,0x945D,0x945E,0x945F,0x9460, +0xC5CA,0x9461,0x9462,0x9463,0x9464,0x9465,0x9466,0x9467, +0x9468,0xDFAB,0x9469,0x946A,0x946B,0x946C,0x946D,0x946E, +0x946F,0x9470,0xD4DC,0x9471,0x9472,0x9473,0x9474,0x9475, +0xC8C1,0x9476,0x9477,0x9478,0x9479,0x947A,0x947B,0x947C, +0x947D,0x947E,0x9480,0x9481,0x9482,0xDFAC,0x9483,0x9484, +0x9485,0x9486,0x9487,0xBEF0,0x9488,0x9489,0xDFAD,0xD6A7, +0x948A,0x948B,0x948C,0x948D,0xEAB7,0xEBB6,0xCAD5,0x948E, +0xD8FC,0xB8C4,0x948F,0xB9A5,0x9490,0x9491,0xB7C5,0xD5FE, +0x9492,0x9493,0x9494,0x9495,0x9496,0xB9CA,0x9497,0x9498, +0xD0A7,0xF4CD,0x9499,0x949A,0xB5D0,0x949B,0x949C,0xC3F4, +0x949D,0xBEC8,0x949E,0x949F,0x94A0,0xEBB7,0xB0BD,0x94A1, +0x94A2,0xBDCC,0x94A3,0xC1B2,0x94A4,0xB1D6,0xB3A8,0x94A5, +0x94A6,0x94A7,0xB8D2,0xC9A2,0x94A8,0x94A9,0xB6D8,0x94AA, +0x94AB,0x94AC,0x94AD,0xEBB8,0xBEB4,0x94AE,0x94AF,0x94B0, +0xCAFD,0x94B1,0xC7C3,0x94B2,0xD5FB,0x94B3,0x94B4,0xB7F3, +0x94B5,0x94B6,0x94B7,0x94B8,0x94B9,0x94BA,0x94BB,0x94BC, +0x94BD,0x94BE,0x94BF,0x94C0,0x94C1,0x94C2,0x94C3,0xCEC4, +0x94C4,0x94C5,0x94C6,0xD5AB,0xB1F3,0x94C7,0x94C8,0x94C9, +0xECB3,0xB0DF,0x94CA,0xECB5,0x94CB,0x94CC,0x94CD,0xB6B7, +0x94CE,0xC1CF,0x94CF,0xF5FA,0xD0B1,0x94D0,0x94D1,0xD5E5, +0x94D2,0xCED3,0x94D3,0x94D4,0xBDEF,0xB3E2,0x94D5,0xB8AB, +0x94D6,0xD5B6,0x94D7,0xEDBD,0x94D8,0xB6CF,0x94D9,0xCBB9, +0xD0C2,0x94DA,0x94DB,0x94DC,0x94DD,0x94DE,0x94DF,0x94E0, +0x94E1,0xB7BD,0x94E2,0x94E3,0xECB6,0xCAA9,0x94E4,0x94E5, +0x94E6,0xC5D4,0x94E7,0xECB9,0xECB8,0xC2C3,0xECB7,0x94E8, +0x94E9,0x94EA,0x94EB,0xD0FD,0xECBA,0x94EC,0xECBB,0xD7E5, +0x94ED,0x94EE,0xECBC,0x94EF,0x94F0,0x94F1,0xECBD,0xC6EC, +0x94F2,0x94F3,0x94F4,0x94F5,0x94F6,0x94F7,0x94F8,0x94F9, +0xCEDE,0x94FA,0xBCC8,0x94FB,0x94FC,0xC8D5,0xB5A9,0xBEC9, +0xD6BC,0xD4E7,0x94FD,0x94FE,0xD1AE,0xD0F1,0xEAB8,0xEAB9, +0xEABA,0xBAB5,0x9540,0x9541,0x9542,0x9543,0xCAB1,0xBFF5, +0x9544,0x9545,0xCDFA,0x9546,0x9547,0x9548,0x9549,0x954A, +0xEAC0,0x954B,0xB0BA,0xEABE,0x954C,0x954D,0xC0A5,0x954E, +0x954F,0x9550,0xEABB,0x9551,0xB2FD,0x9552,0xC3F7,0xBBE8, +0x9553,0x9554,0x9555,0xD2D7,0xCEF4,0xEABF,0x9556,0x9557, +0x9558,0xEABC,0x9559,0x955A,0x955B,0xEAC3,0x955C,0xD0C7, +0xD3B3,0x955D,0x955E,0x955F,0x9560,0xB4BA,0x9561,0xC3C1, +0xD7F2,0x9562,0x9563,0x9564,0x9565,0xD5D1,0x9566,0xCAC7, +0x9567,0xEAC5,0x9568,0x9569,0xEAC4,0xEAC7,0xEAC6,0x956A, +0x956B,0x956C,0x956D,0x956E,0xD6E7,0x956F,0xCFD4,0x9570, +0x9571,0xEACB,0x9572,0xBBCE,0x9573,0x9574,0x9575,0x9576, +0x9577,0x9578,0x9579,0xBDFA,0xC9CE,0x957A,0x957B,0xEACC, +0x957C,0x957D,0xC9B9,0xCFFE,0xEACA,0xD4CE,0xEACD,0xEACF, +0x957E,0x9580,0xCDED,0x9581,0x9582,0x9583,0x9584,0xEAC9, +0x9585,0xEACE,0x9586,0x9587,0xCEEE,0x9588,0xBBDE,0x9589, +0xB3BF,0x958A,0x958B,0x958C,0x958D,0x958E,0xC6D5,0xBEB0, +0xCEFA,0x958F,0x9590,0x9591,0xC7E7,0x9592,0xBEA7,0xEAD0, +0x9593,0x9594,0xD6C7,0x9595,0x9596,0x9597,0xC1C0,0x9598, +0x9599,0x959A,0xD4DD,0x959B,0xEAD1,0x959C,0x959D,0xCFBE, +0x959E,0x959F,0x95A0,0x95A1,0xEAD2,0x95A2,0x95A3,0x95A4, +0x95A5,0xCAEE,0x95A6,0x95A7,0x95A8,0x95A9,0xC5AF,0xB0B5, +0x95AA,0x95AB,0x95AC,0x95AD,0x95AE,0xEAD4,0x95AF,0x95B0, +0x95B1,0x95B2,0x95B3,0x95B4,0x95B5,0x95B6,0x95B7,0xEAD3, +0xF4DF,0x95B8,0x95B9,0x95BA,0x95BB,0x95BC,0xC4BA,0x95BD, +0x95BE,0x95BF,0x95C0,0x95C1,0xB1A9,0x95C2,0x95C3,0x95C4, +0x95C5,0xE5DF,0x95C6,0x95C7,0x95C8,0x95C9,0xEAD5,0x95CA, +0x95CB,0x95CC,0x95CD,0x95CE,0x95CF,0x95D0,0x95D1,0x95D2, +0x95D3,0x95D4,0x95D5,0x95D6,0x95D7,0x95D8,0x95D9,0x95DA, +0x95DB,0x95DC,0x95DD,0x95DE,0x95DF,0x95E0,0x95E1,0x95E2, +0x95E3,0xCAEF,0x95E4,0xEAD6,0xEAD7,0xC6D8,0x95E5,0x95E6, +0x95E7,0x95E8,0x95E9,0x95EA,0x95EB,0x95EC,0xEAD8,0x95ED, +0x95EE,0xEAD9,0x95EF,0x95F0,0x95F1,0x95F2,0x95F3,0x95F4, +0xD4BB,0x95F5,0xC7FA,0xD2B7,0xB8FC,0x95F6,0x95F7,0xEAC2, +0x95F8,0xB2DC,0x95F9,0x95FA,0xC2FC,0x95FB,0xD4F8,0xCCE6, +0xD7EE,0x95FC,0x95FD,0x95FE,0x9640,0x9641,0x9642,0x9643, +0xD4C2,0xD3D0,0xEBC3,0xC5F3,0x9644,0xB7FE,0x9645,0x9646, +0xEBD4,0x9647,0x9648,0x9649,0xCBB7,0xEBDE,0x964A,0xC0CA, +0x964B,0x964C,0x964D,0xCDFB,0x964E,0xB3AF,0x964F,0xC6DA, +0x9650,0x9651,0x9652,0x9653,0x9654,0x9655,0xEBFC,0x9656, +0xC4BE,0x9657,0xCEB4,0xC4A9,0xB1BE,0xD4FD,0x9658,0xCAF5, +0x9659,0xD6EC,0x965A,0x965B,0xC6D3,0xB6E4,0x965C,0x965D, +0x965E,0x965F,0xBBFA,0x9660,0x9661,0xD0E0,0x9662,0x9663, +0xC9B1,0x9664,0xD4D3,0xC8A8,0x9665,0x9666,0xB8CB,0x9667, +0xE8BE,0xC9BC,0x9668,0x9669,0xE8BB,0x966A,0xC0EE,0xD0D3, +0xB2C4,0xB4E5,0x966B,0xE8BC,0x966C,0x966D,0xD5C8,0x966E, +0x966F,0x9670,0x9671,0x9672,0xB6C5,0x9673,0xE8BD,0xCAF8, +0xB8DC,0xCCF5,0x9674,0x9675,0x9676,0xC0B4,0x9677,0x9678, +0xD1EE,0xE8BF,0xE8C2,0x9679,0x967A,0xBABC,0x967B,0xB1AD, +0xBDDC,0x967C,0xEABD,0xE8C3,0x967D,0xE8C6,0x967E,0xE8CB, +0x9680,0x9681,0x9682,0x9683,0xE8CC,0x9684,0xCBC9,0xB0E5, +0x9685,0xBCAB,0x9686,0x9687,0xB9B9,0x9688,0x9689,0xE8C1, +0x968A,0xCDF7,0x968B,0xE8CA,0x968C,0x968D,0x968E,0x968F, +0xCEF6,0x9690,0x9691,0x9692,0x9693,0xD5ED,0x9694,0xC1D6, +0xE8C4,0x9695,0xC3B6,0x9696,0xB9FB,0xD6A6,0xE8C8,0x9697, +0x9698,0x9699,0xCAE0,0xD4E6,0x969A,0xE8C0,0x969B,0xE8C5, +0xE8C7,0x969C,0xC7B9,0xB7E3,0x969D,0xE8C9,0x969E,0xBFDD, +0xE8D2,0x969F,0x96A0,0xE8D7,0x96A1,0xE8D5,0xBCDC,0xBCCF, +0xE8DB,0x96A2,0x96A3,0x96A4,0x96A5,0x96A6,0x96A7,0x96A8, +0x96A9,0xE8DE,0x96AA,0xE8DA,0xB1FA,0x96AB,0x96AC,0x96AD, +0x96AE,0x96AF,0x96B0,0x96B1,0x96B2,0x96B3,0x96B4,0xB0D8, +0xC4B3,0xB8CC,0xC6E2,0xC8BE,0xC8E1,0x96B5,0x96B6,0x96B7, +0xE8CF,0xE8D4,0xE8D6,0x96B8,0xB9F1,0xE8D8,0xD7F5,0x96B9, +0xC4FB,0x96BA,0xE8DC,0x96BB,0x96BC,0xB2E9,0x96BD,0x96BE, +0x96BF,0xE8D1,0x96C0,0x96C1,0xBCED,0x96C2,0x96C3,0xBFC2, +0xE8CD,0xD6F9,0x96C4,0xC1F8,0xB2F1,0x96C5,0x96C6,0x96C7, +0x96C8,0x96C9,0x96CA,0x96CB,0x96CC,0xE8DF,0x96CD,0xCAC1, +0xE8D9,0x96CE,0x96CF,0x96D0,0x96D1,0xD5A4,0x96D2,0xB1EA, +0xD5BB,0xE8CE,0xE8D0,0xB6B0,0xE8D3,0x96D3,0xE8DD,0xC0B8, +0x96D4,0xCAF7,0x96D5,0xCBA8,0x96D6,0x96D7,0xC6DC,0xC0F5, +0x96D8,0x96D9,0x96DA,0x96DB,0x96DC,0xE8E9,0x96DD,0x96DE, +0x96DF,0xD0A3,0x96E0,0x96E1,0x96E2,0x96E3,0x96E4,0x96E5, +0x96E6,0xE8F2,0xD6EA,0x96E7,0x96E8,0x96E9,0x96EA,0x96EB, +0x96EC,0x96ED,0xE8E0,0xE8E1,0x96EE,0x96EF,0x96F0,0xD1F9, +0xBACB,0xB8F9,0x96F1,0x96F2,0xB8F1,0xD4D4,0xE8EF,0x96F3, +0xE8EE,0xE8EC,0xB9F0,0xCCD2,0xE8E6,0xCEA6,0xBFF2,0x96F4, +0xB0B8,0xE8F1,0xE8F0,0x96F5,0xD7C0,0x96F6,0xE8E4,0x96F7, +0xCDA9,0xC9A3,0x96F8,0xBBB8,0xBDDB,0xE8EA,0x96F9,0x96FA, +0x96FB,0x96FC,0x96FD,0x96FE,0x9740,0x9741,0x9742,0x9743, +0xE8E2,0xE8E3,0xE8E5,0xB5B5,0xE8E7,0xC7C5,0xE8EB,0xE8ED, +0xBDB0,0xD7AE,0x9744,0xE8F8,0x9745,0x9746,0x9747,0x9748, +0x9749,0x974A,0x974B,0x974C,0xE8F5,0x974D,0xCDB0,0xE8F6, +0x974E,0x974F,0x9750,0x9751,0x9752,0x9753,0x9754,0x9755, +0x9756,0xC1BA,0x9757,0xE8E8,0x9758,0xC3B7,0xB0F0,0x9759, +0x975A,0x975B,0x975C,0x975D,0x975E,0x975F,0x9760,0xE8F4, +0x9761,0x9762,0x9763,0xE8F7,0x9764,0x9765,0x9766,0xB9A3, +0x9767,0x9768,0x9769,0x976A,0x976B,0x976C,0x976D,0x976E, +0x976F,0x9770,0xC9D2,0x9771,0x9772,0x9773,0xC3CE,0xCEE0, +0xC0E6,0x9774,0x9775,0x9776,0x9777,0xCBF3,0x9778,0xCCDD, +0xD0B5,0x9779,0x977A,0xCAE1,0x977B,0xE8F3,0x977C,0x977D, +0x977E,0x9780,0x9781,0x9782,0x9783,0x9784,0x9785,0x9786, +0xBCEC,0x9787,0xE8F9,0x9788,0x9789,0x978A,0x978B,0x978C, +0x978D,0xC3DE,0x978E,0xC6E5,0x978F,0xB9F7,0x9790,0x9791, +0x9792,0x9793,0xB0F4,0x9794,0x9795,0xD7D8,0x9796,0x9797, +0xBCAC,0x9798,0xC5EF,0x9799,0x979A,0x979B,0x979C,0x979D, +0xCCC4,0x979E,0x979F,0xE9A6,0x97A0,0x97A1,0x97A2,0x97A3, +0x97A4,0x97A5,0x97A6,0x97A7,0x97A8,0x97A9,0xC9AD,0x97AA, +0xE9A2,0xC0E2,0x97AB,0x97AC,0x97AD,0xBFC3,0x97AE,0x97AF, +0x97B0,0xE8FE,0xB9D7,0x97B1,0xE8FB,0x97B2,0x97B3,0x97B4, +0x97B5,0xE9A4,0x97B6,0x97B7,0x97B8,0xD2CE,0x97B9,0x97BA, +0x97BB,0x97BC,0x97BD,0xE9A3,0x97BE,0xD6B2,0xD7B5,0x97BF, +0xE9A7,0x97C0,0xBDB7,0x97C1,0x97C2,0x97C3,0x97C4,0x97C5, +0x97C6,0x97C7,0x97C8,0x97C9,0x97CA,0x97CB,0x97CC,0xE8FC, +0xE8FD,0x97CD,0x97CE,0x97CF,0xE9A1,0x97D0,0x97D1,0x97D2, +0x97D3,0x97D4,0x97D5,0x97D6,0x97D7,0xCDD6,0x97D8,0x97D9, +0xD2AC,0x97DA,0x97DB,0x97DC,0xE9B2,0x97DD,0x97DE,0x97DF, +0x97E0,0xE9A9,0x97E1,0x97E2,0x97E3,0xB4AA,0x97E4,0xB4BB, +0x97E5,0x97E6,0xE9AB,0x97E7,0x97E8,0x97E9,0x97EA,0x97EB, +0x97EC,0x97ED,0x97EE,0x97EF,0x97F0,0x97F1,0x97F2,0x97F3, +0x97F4,0x97F5,0x97F6,0x97F7,0xD0A8,0x97F8,0x97F9,0xE9A5, +0x97FA,0x97FB,0xB3FE,0x97FC,0x97FD,0xE9AC,0xC0E3,0x97FE, +0xE9AA,0x9840,0x9841,0xE9B9,0x9842,0x9843,0xE9B8,0x9844, +0x9845,0x9846,0x9847,0xE9AE,0x9848,0x9849,0xE8FA,0x984A, +0x984B,0xE9A8,0x984C,0x984D,0x984E,0x984F,0x9850,0xBFAC, +0xE9B1,0xE9BA,0x9851,0x9852,0xC2A5,0x9853,0x9854,0x9855, +0xE9AF,0x9856,0xB8C5,0x9857,0xE9AD,0x9858,0xD3DC,0xE9B4, +0xE9B5,0xE9B7,0x9859,0x985A,0x985B,0xE9C7,0x985C,0x985D, +0x985E,0x985F,0x9860,0x9861,0xC0C6,0xE9C5,0x9862,0x9863, +0xE9B0,0x9864,0x9865,0xE9BB,0xB0F1,0x9866,0x9867,0x9868, +0x9869,0x986A,0x986B,0x986C,0x986D,0x986E,0x986F,0xE9BC, +0xD5A5,0x9870,0x9871,0xE9BE,0x9872,0xE9BF,0x9873,0x9874, +0x9875,0xE9C1,0x9876,0x9877,0xC1F1,0x9878,0x9879,0xC8B6, +0x987A,0x987B,0x987C,0xE9BD,0x987D,0x987E,0x9880,0x9881, +0x9882,0xE9C2,0x9883,0x9884,0x9885,0x9886,0x9887,0x9888, +0x9889,0x988A,0xE9C3,0x988B,0xE9B3,0x988C,0xE9B6,0x988D, +0xBBB1,0x988E,0x988F,0x9890,0xE9C0,0x9891,0x9892,0x9893, +0x9894,0x9895,0x9896,0xBCF7,0x9897,0x9898,0x9899,0xE9C4, +0xE9C6,0x989A,0x989B,0x989C,0x989D,0x989E,0x989F,0x98A0, +0x98A1,0x98A2,0x98A3,0x98A4,0x98A5,0xE9CA,0x98A6,0x98A7, +0x98A8,0x98A9,0xE9CE,0x98AA,0x98AB,0x98AC,0x98AD,0x98AE, +0x98AF,0x98B0,0x98B1,0x98B2,0x98B3,0xB2DB,0x98B4,0xE9C8, +0x98B5,0x98B6,0x98B7,0x98B8,0x98B9,0x98BA,0x98BB,0x98BC, +0x98BD,0x98BE,0xB7AE,0x98BF,0x98C0,0x98C1,0x98C2,0x98C3, +0x98C4,0x98C5,0x98C6,0x98C7,0x98C8,0x98C9,0x98CA,0xE9CB, +0xE9CC,0x98CB,0x98CC,0x98CD,0x98CE,0x98CF,0x98D0,0xD5C1, +0x98D1,0xC4A3,0x98D2,0x98D3,0x98D4,0x98D5,0x98D6,0x98D7, +0xE9D8,0x98D8,0xBAE1,0x98D9,0x98DA,0x98DB,0x98DC,0xE9C9, +0x98DD,0xD3A3,0x98DE,0x98DF,0x98E0,0xE9D4,0x98E1,0x98E2, +0x98E3,0x98E4,0x98E5,0x98E6,0x98E7,0xE9D7,0xE9D0,0x98E8, +0x98E9,0x98EA,0x98EB,0x98EC,0xE9CF,0x98ED,0x98EE,0xC7C1, +0x98EF,0x98F0,0x98F1,0x98F2,0x98F3,0x98F4,0x98F5,0x98F6, +0xE9D2,0x98F7,0x98F8,0x98F9,0x98FA,0x98FB,0x98FC,0x98FD, +0xE9D9,0xB3C8,0x98FE,0xE9D3,0x9940,0x9941,0x9942,0x9943, +0x9944,0xCFF0,0x9945,0x9946,0x9947,0xE9CD,0x9948,0x9949, +0x994A,0x994B,0x994C,0x994D,0x994E,0x994F,0x9950,0x9951, +0x9952,0xB3F7,0x9953,0x9954,0x9955,0x9956,0x9957,0x9958, +0x9959,0xE9D6,0x995A,0x995B,0xE9DA,0x995C,0x995D,0x995E, +0xCCB4,0x995F,0x9960,0x9961,0xCFAD,0x9962,0x9963,0x9964, +0x9965,0x9966,0x9967,0x9968,0x9969,0x996A,0xE9D5,0x996B, +0xE9DC,0xE9DB,0x996C,0x996D,0x996E,0x996F,0x9970,0xE9DE, +0x9971,0x9972,0x9973,0x9974,0x9975,0x9976,0x9977,0x9978, +0xE9D1,0x9979,0x997A,0x997B,0x997C,0x997D,0x997E,0x9980, +0x9981,0xE9DD,0x9982,0xE9DF,0xC3CA,0x9983,0x9984,0x9985, +0x9986,0x9987,0x9988,0x9989,0x998A,0x998B,0x998C,0x998D, +0x998E,0x998F,0x9990,0x9991,0x9992,0x9993,0x9994,0x9995, +0x9996,0x9997,0x9998,0x9999,0x999A,0x999B,0x999C,0x999D, +0x999E,0x999F,0x99A0,0x99A1,0x99A2,0x99A3,0x99A4,0x99A5, +0x99A6,0x99A7,0x99A8,0x99A9,0x99AA,0x99AB,0x99AC,0x99AD, +0x99AE,0x99AF,0x99B0,0x99B1,0x99B2,0x99B3,0x99B4,0x99B5, +0x99B6,0x99B7,0x99B8,0x99B9,0x99BA,0x99BB,0x99BC,0x99BD, +0x99BE,0x99BF,0x99C0,0x99C1,0x99C2,0x99C3,0x99C4,0x99C5, +0x99C6,0x99C7,0x99C8,0x99C9,0x99CA,0x99CB,0x99CC,0x99CD, +0x99CE,0x99CF,0x99D0,0x99D1,0x99D2,0x99D3,0x99D4,0x99D5, +0x99D6,0x99D7,0x99D8,0x99D9,0x99DA,0x99DB,0x99DC,0x99DD, +0x99DE,0x99DF,0x99E0,0x99E1,0x99E2,0x99E3,0x99E4,0x99E5, +0x99E6,0x99E7,0x99E8,0x99E9,0x99EA,0x99EB,0x99EC,0x99ED, +0x99EE,0x99EF,0x99F0,0x99F1,0x99F2,0x99F3,0x99F4,0x99F5, +0xC7B7,0xB4CE,0xBBB6,0xD0C0,0xECA3,0x99F6,0x99F7,0xC5B7, +0x99F8,0x99F9,0x99FA,0x99FB,0x99FC,0x99FD,0x99FE,0x9A40, +0x9A41,0x9A42,0xD3FB,0x9A43,0x9A44,0x9A45,0x9A46,0xECA4, +0x9A47,0xECA5,0xC6DB,0x9A48,0x9A49,0x9A4A,0xBFEE,0x9A4B, +0x9A4C,0x9A4D,0x9A4E,0xECA6,0x9A4F,0x9A50,0xECA7,0xD0AA, +0x9A51,0xC7B8,0x9A52,0x9A53,0xB8E8,0x9A54,0x9A55,0x9A56, +0x9A57,0x9A58,0x9A59,0x9A5A,0x9A5B,0x9A5C,0x9A5D,0x9A5E, +0x9A5F,0xECA8,0x9A60,0x9A61,0x9A62,0x9A63,0x9A64,0x9A65, +0x9A66,0x9A67,0xD6B9,0xD5FD,0xB4CB,0xB2BD,0xCEE4,0xC6E7, +0x9A68,0x9A69,0xCDE1,0x9A6A,0x9A6B,0x9A6C,0x9A6D,0x9A6E, +0x9A6F,0x9A70,0x9A71,0x9A72,0x9A73,0x9A74,0x9A75,0x9A76, +0x9A77,0xB4F5,0x9A78,0xCBC0,0xBCDF,0x9A79,0x9A7A,0x9A7B, +0x9A7C,0xE9E2,0xE9E3,0xD1EA,0xE9E5,0x9A7D,0xB4F9,0xE9E4, +0x9A7E,0xD1B3,0xCAE2,0xB2D0,0x9A80,0xE9E8,0x9A81,0x9A82, +0x9A83,0x9A84,0xE9E6,0xE9E7,0x9A85,0x9A86,0xD6B3,0x9A87, +0x9A88,0x9A89,0xE9E9,0xE9EA,0x9A8A,0x9A8B,0x9A8C,0x9A8D, +0x9A8E,0xE9EB,0x9A8F,0x9A90,0x9A91,0x9A92,0x9A93,0x9A94, +0x9A95,0x9A96,0xE9EC,0x9A97,0x9A98,0x9A99,0x9A9A,0x9A9B, +0x9A9C,0x9A9D,0x9A9E,0xECAF,0xC5B9,0xB6CE,0x9A9F,0xD2F3, +0x9AA0,0x9AA1,0x9AA2,0x9AA3,0x9AA4,0x9AA5,0x9AA6,0xB5EE, +0x9AA7,0xBBD9,0xECB1,0x9AA8,0x9AA9,0xD2E3,0x9AAA,0x9AAB, +0x9AAC,0x9AAD,0x9AAE,0xCEE3,0x9AAF,0xC4B8,0x9AB0,0xC3BF, +0x9AB1,0x9AB2,0xB6BE,0xD8B9,0xB1C8,0xB1CF,0xB1D1,0xC5FE, +0x9AB3,0xB1D0,0x9AB4,0xC3AB,0x9AB5,0x9AB6,0x9AB7,0x9AB8, +0x9AB9,0xD5B1,0x9ABA,0x9ABB,0x9ABC,0x9ABD,0x9ABE,0x9ABF, +0x9AC0,0x9AC1,0xEBA4,0xBAC1,0x9AC2,0x9AC3,0x9AC4,0xCCBA, +0x9AC5,0x9AC6,0x9AC7,0xEBA5,0x9AC8,0xEBA7,0x9AC9,0x9ACA, +0x9ACB,0xEBA8,0x9ACC,0x9ACD,0x9ACE,0xEBA6,0x9ACF,0x9AD0, +0x9AD1,0x9AD2,0x9AD3,0x9AD4,0x9AD5,0xEBA9,0xEBAB,0xEBAA, +0x9AD6,0x9AD7,0x9AD8,0x9AD9,0x9ADA,0xEBAC,0x9ADB,0xCACF, +0xD8B5,0xC3F1,0x9ADC,0xC3A5,0xC6F8,0xEBAD,0xC4CA,0x9ADD, +0xEBAE,0xEBAF,0xEBB0,0xB7D5,0x9ADE,0x9ADF,0x9AE0,0xB7FA, +0x9AE1,0xEBB1,0xC7E2,0x9AE2,0xEBB3,0x9AE3,0xBAA4,0xD1F5, +0xB0B1,0xEBB2,0xEBB4,0x9AE4,0x9AE5,0x9AE6,0xB5AA,0xC2C8, +0xC7E8,0x9AE7,0xEBB5,0x9AE8,0xCBAE,0xE3DF,0x9AE9,0x9AEA, +0xD3C0,0x9AEB,0x9AEC,0x9AED,0x9AEE,0xD9DB,0x9AEF,0x9AF0, +0xCDA1,0xD6AD,0xC7F3,0x9AF1,0x9AF2,0x9AF3,0xD9E0,0xBBE3, +0x9AF4,0xBABA,0xE3E2,0x9AF5,0x9AF6,0x9AF7,0x9AF8,0x9AF9, +0xCFAB,0x9AFA,0x9AFB,0x9AFC,0xE3E0,0xC9C7,0x9AFD,0xBAB9, +0x9AFE,0x9B40,0x9B41,0xD1B4,0xE3E1,0xC8EA,0xB9AF,0xBDAD, +0xB3D8,0xCEDB,0x9B42,0x9B43,0xCCC0,0x9B44,0x9B45,0x9B46, +0xE3E8,0xE3E9,0xCDF4,0x9B47,0x9B48,0x9B49,0x9B4A,0x9B4B, +0xCCAD,0x9B4C,0xBCB3,0x9B4D,0xE3EA,0x9B4E,0xE3EB,0x9B4F, +0x9B50,0xD0DA,0x9B51,0x9B52,0x9B53,0xC6FB,0xB7DA,0x9B54, +0x9B55,0xC7DF,0xD2CA,0xCED6,0x9B56,0xE3E4,0xE3EC,0x9B57, +0xC9F2,0xB3C1,0x9B58,0x9B59,0xE3E7,0x9B5A,0x9B5B,0xC6E3, +0xE3E5,0x9B5C,0x9B5D,0xEDB3,0xE3E6,0x9B5E,0x9B5F,0x9B60, +0x9B61,0xC9B3,0x9B62,0xC5E6,0x9B63,0x9B64,0x9B65,0xB9B5, +0x9B66,0xC3BB,0x9B67,0xE3E3,0xC5BD,0xC1A4,0xC2D9,0xB2D7, +0x9B68,0xE3ED,0xBBA6,0xC4AD,0x9B69,0xE3F0,0xBEDA,0x9B6A, +0x9B6B,0xE3FB,0xE3F5,0xBAD3,0x9B6C,0x9B6D,0x9B6E,0x9B6F, +0xB7D0,0xD3CD,0x9B70,0xD6CE,0xD5D3,0xB9C1,0xD5B4,0xD1D8, +0x9B71,0x9B72,0x9B73,0x9B74,0xD0B9,0xC7F6,0x9B75,0x9B76, +0x9B77,0xC8AA,0xB2B4,0x9B78,0xC3DA,0x9B79,0x9B7A,0x9B7B, +0xE3EE,0x9B7C,0x9B7D,0xE3FC,0xE3EF,0xB7A8,0xE3F7,0xE3F4, +0x9B7E,0x9B80,0x9B81,0xB7BA,0x9B82,0x9B83,0xC5A2,0x9B84, +0xE3F6,0xC5DD,0xB2A8,0xC6FC,0x9B85,0xC4E0,0x9B86,0x9B87, +0xD7A2,0x9B88,0xC0E1,0xE3F9,0x9B89,0x9B8A,0xE3FA,0xE3FD, +0xCCA9,0xE3F3,0x9B8B,0xD3BE,0x9B8C,0xB1C3,0xEDB4,0xE3F1, +0xE3F2,0x9B8D,0xE3F8,0xD0BA,0xC6C3,0xD4F3,0xE3FE,0x9B8E, +0x9B8F,0xBDE0,0x9B90,0x9B91,0xE4A7,0x9B92,0x9B93,0xE4A6, +0x9B94,0x9B95,0x9B96,0xD1F3,0xE4A3,0x9B97,0xE4A9,0x9B98, +0x9B99,0x9B9A,0xC8F7,0x9B9B,0x9B9C,0x9B9D,0x9B9E,0xCFB4, +0x9B9F,0xE4A8,0xE4AE,0xC2E5,0x9BA0,0x9BA1,0xB6B4,0x9BA2, +0x9BA3,0x9BA4,0x9BA5,0x9BA6,0x9BA7,0xBDF2,0x9BA8,0xE4A2, +0x9BA9,0x9BAA,0xBAE9,0xE4AA,0x9BAB,0x9BAC,0xE4AC,0x9BAD, +0x9BAE,0xB6FD,0xD6DE,0xE4B2,0x9BAF,0xE4AD,0x9BB0,0x9BB1, +0x9BB2,0xE4A1,0x9BB3,0xBBEE,0xCDDD,0xC7A2,0xC5C9,0x9BB4, +0x9BB5,0xC1F7,0x9BB6,0xE4A4,0x9BB7,0xC7B3,0xBDAC,0xBDBD, +0xE4A5,0x9BB8,0xD7C7,0xB2E2,0x9BB9,0xE4AB,0xBCC3,0xE4AF, +0x9BBA,0xBBEB,0xE4B0,0xC5A8,0xE4B1,0x9BBB,0x9BBC,0x9BBD, +0x9BBE,0xD5E3,0xBFA3,0x9BBF,0xE4BA,0x9BC0,0xE4B7,0x9BC1, +0xE4BB,0x9BC2,0x9BC3,0xE4BD,0x9BC4,0x9BC5,0xC6D6,0x9BC6, +0x9BC7,0xBAC6,0xC0CB,0x9BC8,0x9BC9,0x9BCA,0xB8A1,0xE4B4, +0x9BCB,0x9BCC,0x9BCD,0x9BCE,0xD4A1,0x9BCF,0x9BD0,0xBAA3, +0xBDFE,0x9BD1,0x9BD2,0x9BD3,0xE4BC,0x9BD4,0x9BD5,0x9BD6, +0x9BD7,0x9BD8,0xCDBF,0x9BD9,0x9BDA,0xC4F9,0x9BDB,0x9BDC, +0xCFFB,0xC9E6,0x9BDD,0x9BDE,0xD3BF,0x9BDF,0xCFD1,0x9BE0, +0x9BE1,0xE4B3,0x9BE2,0xE4B8,0xE4B9,0xCCE9,0x9BE3,0x9BE4, +0x9BE5,0x9BE6,0x9BE7,0xCCCE,0x9BE8,0xC0D4,0xE4B5,0xC1B0, +0xE4B6,0xCED0,0x9BE9,0xBBC1,0xB5D3,0x9BEA,0xC8F3,0xBDA7, +0xD5C7,0xC9AC,0xB8A2,0xE4CA,0x9BEB,0x9BEC,0xE4CC,0xD1C4, +0x9BED,0x9BEE,0xD2BA,0x9BEF,0x9BF0,0xBAAD,0x9BF1,0x9BF2, +0xBAD4,0x9BF3,0x9BF4,0x9BF5,0x9BF6,0x9BF7,0x9BF8,0xE4C3, +0xB5ED,0x9BF9,0x9BFA,0x9BFB,0xD7CD,0xE4C0,0xCFFD,0xE4BF, +0x9BFC,0x9BFD,0x9BFE,0xC1DC,0xCCCA,0x9C40,0x9C41,0x9C42, +0x9C43,0xCAE7,0x9C44,0x9C45,0x9C46,0x9C47,0xC4D7,0x9C48, +0xCCD4,0xE4C8,0x9C49,0x9C4A,0x9C4B,0xE4C7,0xE4C1,0x9C4C, +0xE4C4,0xB5AD,0x9C4D,0x9C4E,0xD3D9,0x9C4F,0xE4C6,0x9C50, +0x9C51,0x9C52,0x9C53,0xD2F9,0xB4E3,0x9C54,0xBBB4,0x9C55, +0x9C56,0xC9EE,0x9C57,0xB4BE,0x9C58,0x9C59,0x9C5A,0xBBEC, +0x9C5B,0xD1CD,0x9C5C,0xCCED,0xEDB5,0x9C5D,0x9C5E,0x9C5F, +0x9C60,0x9C61,0x9C62,0x9C63,0x9C64,0xC7E5,0x9C65,0x9C66, +0x9C67,0x9C68,0xD4A8,0x9C69,0xE4CB,0xD7D5,0xE4C2,0x9C6A, +0xBDA5,0xE4C5,0x9C6B,0x9C6C,0xD3E6,0x9C6D,0xE4C9,0xC9F8, +0x9C6E,0x9C6F,0xE4BE,0x9C70,0x9C71,0xD3E5,0x9C72,0x9C73, +0xC7FE,0xB6C9,0x9C74,0xD4FC,0xB2B3,0xE4D7,0x9C75,0x9C76, +0x9C77,0xCEC2,0x9C78,0xE4CD,0x9C79,0xCEBC,0x9C7A,0xB8DB, +0x9C7B,0x9C7C,0xE4D6,0x9C7D,0xBFCA,0x9C7E,0x9C80,0x9C81, +0xD3CE,0x9C82,0xC3EC,0x9C83,0x9C84,0x9C85,0x9C86,0x9C87, +0x9C88,0x9C89,0x9C8A,0xC5C8,0xE4D8,0x9C8B,0x9C8C,0x9C8D, +0x9C8E,0x9C8F,0x9C90,0x9C91,0x9C92,0xCDC4,0xE4CF,0x9C93, +0x9C94,0x9C95,0x9C96,0xE4D4,0xE4D5,0x9C97,0xBAFE,0x9C98, +0xCFE6,0x9C99,0x9C9A,0xD5BF,0x9C9B,0x9C9C,0x9C9D,0xE4D2, +0x9C9E,0x9C9F,0x9CA0,0x9CA1,0x9CA2,0x9CA3,0x9CA4,0x9CA5, +0x9CA6,0x9CA7,0x9CA8,0xE4D0,0x9CA9,0x9CAA,0xE4CE,0x9CAB, +0x9CAC,0x9CAD,0x9CAE,0x9CAF,0x9CB0,0x9CB1,0x9CB2,0x9CB3, +0x9CB4,0x9CB5,0x9CB6,0x9CB7,0x9CB8,0x9CB9,0xCDE5,0xCAAA, +0x9CBA,0x9CBB,0x9CBC,0xC0A3,0x9CBD,0xBDA6,0xE4D3,0x9CBE, +0x9CBF,0xB8C8,0x9CC0,0x9CC1,0x9CC2,0x9CC3,0x9CC4,0xE4E7, +0xD4B4,0x9CC5,0x9CC6,0x9CC7,0x9CC8,0x9CC9,0x9CCA,0x9CCB, +0xE4DB,0x9CCC,0x9CCD,0x9CCE,0xC1EF,0x9CCF,0x9CD0,0xE4E9, +0x9CD1,0x9CD2,0xD2E7,0x9CD3,0x9CD4,0xE4DF,0x9CD5,0xE4E0, +0x9CD6,0x9CD7,0xCFAA,0x9CD8,0x9CD9,0x9CDA,0x9CDB,0xCBDD, +0x9CDC,0xE4DA,0xE4D1,0x9CDD,0xE4E5,0x9CDE,0xC8DC,0xE4E3, +0x9CDF,0x9CE0,0xC4E7,0xE4E2,0x9CE1,0xE4E1,0x9CE2,0x9CE3, +0x9CE4,0xB3FC,0xE4E8,0x9CE5,0x9CE6,0x9CE7,0x9CE8,0xB5E1, +0x9CE9,0x9CEA,0x9CEB,0xD7CC,0x9CEC,0x9CED,0x9CEE,0xE4E6, +0x9CEF,0xBBAC,0x9CF0,0xD7D2,0xCCCF,0xEBF8,0x9CF1,0xE4E4, +0x9CF2,0x9CF3,0xB9F6,0x9CF4,0x9CF5,0x9CF6,0xD6CD,0xE4D9, +0xE4DC,0xC2FA,0xE4DE,0x9CF7,0xC2CB,0xC0C4,0xC2D0,0x9CF8, +0xB1F5,0xCCB2,0x9CF9,0x9CFA,0x9CFB,0x9CFC,0x9CFD,0x9CFE, +0x9D40,0x9D41,0x9D42,0x9D43,0xB5CE,0x9D44,0x9D45,0x9D46, +0x9D47,0xE4EF,0x9D48,0x9D49,0x9D4A,0x9D4B,0x9D4C,0x9D4D, +0x9D4E,0x9D4F,0xC6AF,0x9D50,0x9D51,0x9D52,0xC6E1,0x9D53, +0x9D54,0xE4F5,0x9D55,0x9D56,0x9D57,0x9D58,0x9D59,0xC2A9, +0x9D5A,0x9D5B,0x9D5C,0xC0EC,0xD1DD,0xE4EE,0x9D5D,0x9D5E, +0x9D5F,0x9D60,0x9D61,0x9D62,0x9D63,0x9D64,0x9D65,0x9D66, +0xC4AE,0x9D67,0x9D68,0x9D69,0xE4ED,0x9D6A,0x9D6B,0x9D6C, +0x9D6D,0xE4F6,0xE4F4,0xC2FE,0x9D6E,0xE4DD,0x9D6F,0xE4F0, +0x9D70,0xCAFE,0x9D71,0xD5C4,0x9D72,0x9D73,0xE4F1,0x9D74, +0x9D75,0x9D76,0x9D77,0x9D78,0x9D79,0x9D7A,0xD1FA,0x9D7B, +0x9D7C,0x9D7D,0x9D7E,0x9D80,0x9D81,0x9D82,0xE4EB,0xE4EC, +0x9D83,0x9D84,0x9D85,0xE4F2,0x9D86,0xCEAB,0x9D87,0x9D88, +0x9D89,0x9D8A,0x9D8B,0x9D8C,0x9D8D,0x9D8E,0x9D8F,0x9D90, +0xC5CB,0x9D91,0x9D92,0x9D93,0xC7B1,0x9D94,0xC2BA,0x9D95, +0x9D96,0x9D97,0xE4EA,0x9D98,0x9D99,0x9D9A,0xC1CA,0x9D9B, +0x9D9C,0x9D9D,0x9D9E,0x9D9F,0x9DA0,0xCCB6,0xB3B1,0x9DA1, +0x9DA2,0x9DA3,0xE4FB,0x9DA4,0xE4F3,0x9DA5,0x9DA6,0x9DA7, +0xE4FA,0x9DA8,0xE4FD,0x9DA9,0xE4FC,0x9DAA,0x9DAB,0x9DAC, +0x9DAD,0x9DAE,0x9DAF,0x9DB0,0xB3CE,0x9DB1,0x9DB2,0x9DB3, +0xB3BA,0xE4F7,0x9DB4,0x9DB5,0xE4F9,0xE4F8,0xC5EC,0x9DB6, +0x9DB7,0x9DB8,0x9DB9,0x9DBA,0x9DBB,0x9DBC,0x9DBD,0x9DBE, +0x9DBF,0x9DC0,0x9DC1,0x9DC2,0xC0BD,0x9DC3,0x9DC4,0x9DC5, +0x9DC6,0xD4E8,0x9DC7,0x9DC8,0x9DC9,0x9DCA,0x9DCB,0xE5A2, +0x9DCC,0x9DCD,0x9DCE,0x9DCF,0x9DD0,0x9DD1,0x9DD2,0x9DD3, +0x9DD4,0x9DD5,0x9DD6,0xB0C4,0x9DD7,0x9DD8,0xE5A4,0x9DD9, +0x9DDA,0xE5A3,0x9DDB,0x9DDC,0x9DDD,0x9DDE,0x9DDF,0x9DE0, +0xBCA4,0x9DE1,0xE5A5,0x9DE2,0x9DE3,0x9DE4,0x9DE5,0x9DE6, +0x9DE7,0xE5A1,0x9DE8,0x9DE9,0x9DEA,0x9DEB,0x9DEC,0x9DED, +0x9DEE,0xE4FE,0xB1F4,0x9DEF,0x9DF0,0x9DF1,0x9DF2,0x9DF3, +0x9DF4,0x9DF5,0x9DF6,0x9DF7,0x9DF8,0x9DF9,0xE5A8,0x9DFA, +0xE5A9,0xE5A6,0x9DFB,0x9DFC,0x9DFD,0x9DFE,0x9E40,0x9E41, +0x9E42,0x9E43,0x9E44,0x9E45,0x9E46,0x9E47,0xE5A7,0xE5AA, +0x9E48,0x9E49,0x9E4A,0x9E4B,0x9E4C,0x9E4D,0x9E4E,0x9E4F, +0x9E50,0x9E51,0x9E52,0x9E53,0x9E54,0x9E55,0x9E56,0x9E57, +0x9E58,0x9E59,0x9E5A,0x9E5B,0x9E5C,0x9E5D,0x9E5E,0x9E5F, +0x9E60,0x9E61,0x9E62,0x9E63,0x9E64,0x9E65,0x9E66,0x9E67, +0x9E68,0xC6D9,0x9E69,0x9E6A,0x9E6B,0x9E6C,0x9E6D,0x9E6E, +0x9E6F,0x9E70,0xE5AB,0xE5AD,0x9E71,0x9E72,0x9E73,0x9E74, +0x9E75,0x9E76,0x9E77,0xE5AC,0x9E78,0x9E79,0x9E7A,0x9E7B, +0x9E7C,0x9E7D,0x9E7E,0x9E80,0x9E81,0x9E82,0x9E83,0x9E84, +0x9E85,0x9E86,0x9E87,0x9E88,0x9E89,0xE5AF,0x9E8A,0x9E8B, +0x9E8C,0xE5AE,0x9E8D,0x9E8E,0x9E8F,0x9E90,0x9E91,0x9E92, +0x9E93,0x9E94,0x9E95,0x9E96,0x9E97,0x9E98,0x9E99,0x9E9A, +0x9E9B,0x9E9C,0x9E9D,0x9E9E,0xB9E0,0x9E9F,0x9EA0,0xE5B0, +0x9EA1,0x9EA2,0x9EA3,0x9EA4,0x9EA5,0x9EA6,0x9EA7,0x9EA8, +0x9EA9,0x9EAA,0x9EAB,0x9EAC,0x9EAD,0x9EAE,0xE5B1,0x9EAF, +0x9EB0,0x9EB1,0x9EB2,0x9EB3,0x9EB4,0x9EB5,0x9EB6,0x9EB7, +0x9EB8,0x9EB9,0x9EBA,0xBBF0,0xECE1,0xC3F0,0x9EBB,0xB5C6, +0xBBD2,0x9EBC,0x9EBD,0x9EBE,0x9EBF,0xC1E9,0xD4EE,0x9EC0, +0xBEC4,0x9EC1,0x9EC2,0x9EC3,0xD7C6,0x9EC4,0xD4D6,0xB2D3, +0xECBE,0x9EC5,0x9EC6,0x9EC7,0x9EC8,0xEAC1,0x9EC9,0x9ECA, +0x9ECB,0xC2AF,0xB4B6,0x9ECC,0x9ECD,0x9ECE,0xD1D7,0x9ECF, +0x9ED0,0x9ED1,0xB3B4,0x9ED2,0xC8B2,0xBFBB,0xECC0,0x9ED3, +0x9ED4,0xD6CB,0x9ED5,0x9ED6,0xECBF,0xECC1,0x9ED7,0x9ED8, +0x9ED9,0x9EDA,0x9EDB,0x9EDC,0x9EDD,0x9EDE,0x9EDF,0x9EE0, +0x9EE1,0x9EE2,0x9EE3,0xECC5,0xBEE6,0xCCBF,0xC5DA,0xBEBC, +0x9EE4,0xECC6,0x9EE5,0xB1FE,0x9EE6,0x9EE7,0x9EE8,0xECC4, +0xD5A8,0xB5E3,0x9EE9,0xECC2,0xC1B6,0xB3E3,0x9EEA,0x9EEB, +0xECC3,0xCBB8,0xC0C3,0xCCFE,0x9EEC,0x9EED,0x9EEE,0x9EEF, +0xC1D2,0x9EF0,0xECC8,0x9EF1,0x9EF2,0x9EF3,0x9EF4,0x9EF5, +0x9EF6,0x9EF7,0x9EF8,0x9EF9,0x9EFA,0x9EFB,0x9EFC,0x9EFD, +0xBAE6,0xC0D3,0x9EFE,0xD6F2,0x9F40,0x9F41,0x9F42,0xD1CC, +0x9F43,0x9F44,0x9F45,0x9F46,0xBFBE,0x9F47,0xB7B3,0xC9D5, +0xECC7,0xBBE2,0x9F48,0xCCCC,0xBDFD,0xC8C8,0x9F49,0xCFA9, +0x9F4A,0x9F4B,0x9F4C,0x9F4D,0x9F4E,0x9F4F,0x9F50,0xCDE9, +0x9F51,0xC5EB,0x9F52,0x9F53,0x9F54,0xB7E9,0x9F55,0x9F56, +0x9F57,0x9F58,0x9F59,0x9F5A,0x9F5B,0x9F5C,0x9F5D,0x9F5E, +0x9F5F,0xD1C9,0xBAB8,0x9F60,0x9F61,0x9F62,0x9F63,0x9F64, +0xECC9,0x9F65,0x9F66,0xECCA,0x9F67,0xBBC0,0xECCB,0x9F68, +0xECE2,0xB1BA,0xB7D9,0x9F69,0x9F6A,0x9F6B,0x9F6C,0x9F6D, +0x9F6E,0x9F6F,0x9F70,0x9F71,0x9F72,0x9F73,0xBDB9,0x9F74, +0x9F75,0x9F76,0x9F77,0x9F78,0x9F79,0x9F7A,0x9F7B,0xECCC, +0xD1E6,0xECCD,0x9F7C,0x9F7D,0x9F7E,0x9F80,0xC8BB,0x9F81, +0x9F82,0x9F83,0x9F84,0x9F85,0x9F86,0x9F87,0x9F88,0x9F89, +0x9F8A,0x9F8B,0x9F8C,0x9F8D,0x9F8E,0xECD1,0x9F8F,0x9F90, +0x9F91,0x9F92,0xECD3,0x9F93,0xBBCD,0x9F94,0xBCE5,0x9F95, +0x9F96,0x9F97,0x9F98,0x9F99,0x9F9A,0x9F9B,0x9F9C,0x9F9D, +0x9F9E,0x9F9F,0x9FA0,0x9FA1,0xECCF,0x9FA2,0xC9B7,0x9FA3, +0x9FA4,0x9FA5,0x9FA6,0x9FA7,0xC3BA,0x9FA8,0xECE3,0xD5D5, +0xECD0,0x9FA9,0x9FAA,0x9FAB,0x9FAC,0x9FAD,0xD6F3,0x9FAE, +0x9FAF,0x9FB0,0xECD2,0xECCE,0x9FB1,0x9FB2,0x9FB3,0x9FB4, +0xECD4,0x9FB5,0xECD5,0x9FB6,0x9FB7,0xC9BF,0x9FB8,0x9FB9, +0x9FBA,0x9FBB,0x9FBC,0x9FBD,0xCFA8,0x9FBE,0x9FBF,0x9FC0, +0x9FC1,0x9FC2,0xD0DC,0x9FC3,0x9FC4,0x9FC5,0x9FC6,0xD1AC, +0x9FC7,0x9FC8,0x9FC9,0x9FCA,0xC8DB,0x9FCB,0x9FCC,0x9FCD, +0xECD6,0xCEF5,0x9FCE,0x9FCF,0x9FD0,0x9FD1,0x9FD2,0xCAEC, +0xECDA,0x9FD3,0x9FD4,0x9FD5,0x9FD6,0x9FD7,0x9FD8,0x9FD9, +0xECD9,0x9FDA,0x9FDB,0x9FDC,0xB0BE,0x9FDD,0x9FDE,0x9FDF, +0x9FE0,0x9FE1,0x9FE2,0xECD7,0x9FE3,0xECD8,0x9FE4,0x9FE5, +0x9FE6,0xECE4,0x9FE7,0x9FE8,0x9FE9,0x9FEA,0x9FEB,0x9FEC, +0x9FED,0x9FEE,0x9FEF,0xC8BC,0x9FF0,0x9FF1,0x9FF2,0x9FF3, +0x9FF4,0x9FF5,0x9FF6,0x9FF7,0x9FF8,0x9FF9,0xC1C7,0x9FFA, +0x9FFB,0x9FFC,0x9FFD,0x9FFE,0xECDC,0xD1E0,0xA040,0xA041, +0xA042,0xA043,0xA044,0xA045,0xA046,0xA047,0xA048,0xA049, +0xECDB,0xA04A,0xA04B,0xA04C,0xA04D,0xD4EF,0xA04E,0xECDD, +0xA04F,0xA050,0xA051,0xA052,0xA053,0xA054,0xDBC6,0xA055, +0xA056,0xA057,0xA058,0xA059,0xA05A,0xA05B,0xA05C,0xA05D, +0xA05E,0xECDE,0xA05F,0xA060,0xA061,0xA062,0xA063,0xA064, +0xA065,0xA066,0xA067,0xA068,0xA069,0xA06A,0xB1AC,0xA06B, +0xA06C,0xA06D,0xA06E,0xA06F,0xA070,0xA071,0xA072,0xA073, +0xA074,0xA075,0xA076,0xA077,0xA078,0xA079,0xA07A,0xA07B, +0xA07C,0xA07D,0xA07E,0xA080,0xA081,0xECDF,0xA082,0xA083, +0xA084,0xA085,0xA086,0xA087,0xA088,0xA089,0xA08A,0xA08B, +0xECE0,0xA08C,0xD7A6,0xA08D,0xC5C0,0xA08E,0xA08F,0xA090, +0xEBBC,0xB0AE,0xA091,0xA092,0xA093,0xBEF4,0xB8B8,0xD2AF, +0xB0D6,0xB5F9,0xA094,0xD8B3,0xA095,0xCBAC,0xA096,0xE3DD, +0xA097,0xA098,0xA099,0xA09A,0xA09B,0xA09C,0xA09D,0xC6AC, +0xB0E6,0xA09E,0xA09F,0xA0A0,0xC5C6,0xEBB9,0xA0A1,0xA0A2, +0xA0A3,0xA0A4,0xEBBA,0xA0A5,0xA0A6,0xA0A7,0xEBBB,0xA0A8, +0xA0A9,0xD1C0,0xA0AA,0xC5A3,0xA0AB,0xEAF2,0xA0AC,0xC4B2, +0xA0AD,0xC4B5,0xC0CE,0xA0AE,0xA0AF,0xA0B0,0xEAF3,0xC4C1, +0xA0B1,0xCEEF,0xA0B2,0xA0B3,0xA0B4,0xA0B5,0xEAF0,0xEAF4, +0xA0B6,0xA0B7,0xC9FC,0xA0B8,0xA0B9,0xC7A3,0xA0BA,0xA0BB, +0xA0BC,0xCCD8,0xCEFE,0xA0BD,0xA0BE,0xA0BF,0xEAF5,0xEAF6, +0xCFAC,0xC0E7,0xA0C0,0xA0C1,0xEAF7,0xA0C2,0xA0C3,0xA0C4, +0xA0C5,0xA0C6,0xB6BF,0xEAF8,0xA0C7,0xEAF9,0xA0C8,0xEAFA, +0xA0C9,0xA0CA,0xEAFB,0xA0CB,0xA0CC,0xA0CD,0xA0CE,0xA0CF, +0xA0D0,0xA0D1,0xA0D2,0xA0D3,0xA0D4,0xA0D5,0xA0D6,0xEAF1, +0xA0D7,0xA0D8,0xA0D9,0xA0DA,0xA0DB,0xA0DC,0xA0DD,0xA0DE, +0xA0DF,0xA0E0,0xA0E1,0xA0E2,0xC8AE,0xE1EB,0xA0E3,0xB7B8, +0xE1EC,0xA0E4,0xA0E5,0xA0E6,0xE1ED,0xA0E7,0xD7B4,0xE1EE, +0xE1EF,0xD3CC,0xA0E8,0xA0E9,0xA0EA,0xA0EB,0xA0EC,0xA0ED, +0xA0EE,0xE1F1,0xBFF1,0xE1F0,0xB5D2,0xA0EF,0xA0F0,0xA0F1, +0xB1B7,0xA0F2,0xA0F3,0xA0F4,0xA0F5,0xE1F3,0xE1F2,0xA0F6, +0xBAFC,0xA0F7,0xE1F4,0xA0F8,0xA0F9,0xA0FA,0xA0FB,0xB9B7, +0xA0FC,0xBED1,0xA0FD,0xA0FE,0xAA40,0xAA41,0xC4FC,0xAA42, +0xBADD,0xBDC6,0xAA43,0xAA44,0xAA45,0xAA46,0xAA47,0xAA48, +0xE1F5,0xE1F7,0xAA49,0xAA4A,0xB6C0,0xCFC1,0xCAA8,0xE1F6, +0xD5F8,0xD3FC,0xE1F8,0xE1FC,0xE1F9,0xAA4B,0xAA4C,0xE1FA, +0xC0EA,0xAA4D,0xE1FE,0xE2A1,0xC0C7,0xAA4E,0xAA4F,0xAA50, +0xAA51,0xE1FB,0xAA52,0xE1FD,0xAA53,0xAA54,0xAA55,0xAA56, +0xAA57,0xAA58,0xE2A5,0xAA59,0xAA5A,0xAA5B,0xC1D4,0xAA5C, +0xAA5D,0xAA5E,0xAA5F,0xE2A3,0xAA60,0xE2A8,0xB2FE,0xE2A2, +0xAA61,0xAA62,0xAA63,0xC3CD,0xB2C2,0xE2A7,0xE2A6,0xAA64, +0xAA65,0xE2A4,0xE2A9,0xAA66,0xAA67,0xE2AB,0xAA68,0xAA69, +0xAA6A,0xD0C9,0xD6ED,0xC3A8,0xE2AC,0xAA6B,0xCFD7,0xAA6C, +0xAA6D,0xE2AE,0xAA6E,0xAA6F,0xBAEF,0xAA70,0xAA71,0xE9E0, +0xE2AD,0xE2AA,0xAA72,0xAA73,0xAA74,0xAA75,0xBBAB,0xD4B3, +0xAA76,0xAA77,0xAA78,0xAA79,0xAA7A,0xAA7B,0xAA7C,0xAA7D, +0xAA7E,0xAA80,0xAA81,0xAA82,0xAA83,0xE2B0,0xAA84,0xAA85, +0xE2AF,0xAA86,0xE9E1,0xAA87,0xAA88,0xAA89,0xAA8A,0xE2B1, +0xAA8B,0xAA8C,0xAA8D,0xAA8E,0xAA8F,0xAA90,0xAA91,0xAA92, +0xE2B2,0xAA93,0xAA94,0xAA95,0xAA96,0xAA97,0xAA98,0xAA99, +0xAA9A,0xAA9B,0xAA9C,0xAA9D,0xE2B3,0xCCA1,0xAA9E,0xE2B4, +0xAA9F,0xAAA0,0xAB40,0xAB41,0xAB42,0xAB43,0xAB44,0xAB45, +0xAB46,0xAB47,0xAB48,0xAB49,0xAB4A,0xAB4B,0xE2B5,0xAB4C, +0xAB4D,0xAB4E,0xAB4F,0xAB50,0xD0FE,0xAB51,0xAB52,0xC2CA, +0xAB53,0xD3F1,0xAB54,0xCDF5,0xAB55,0xAB56,0xE7E0,0xAB57, +0xAB58,0xE7E1,0xAB59,0xAB5A,0xAB5B,0xAB5C,0xBEC1,0xAB5D, +0xAB5E,0xAB5F,0xAB60,0xC2EA,0xAB61,0xAB62,0xAB63,0xE7E4, +0xAB64,0xAB65,0xE7E3,0xAB66,0xAB67,0xAB68,0xAB69,0xAB6A, +0xAB6B,0xCDE6,0xAB6C,0xC3B5,0xAB6D,0xAB6E,0xE7E2,0xBBB7, +0xCFD6,0xAB6F,0xC1E1,0xE7E9,0xAB70,0xAB71,0xAB72,0xE7E8, +0xAB73,0xAB74,0xE7F4,0xB2A3,0xAB75,0xAB76,0xAB77,0xAB78, +0xE7EA,0xAB79,0xE7E6,0xAB7A,0xAB7B,0xAB7C,0xAB7D,0xAB7E, +0xE7EC,0xE7EB,0xC9BA,0xAB80,0xAB81,0xD5E4,0xAB82,0xE7E5, +0xB7A9,0xE7E7,0xAB83,0xAB84,0xAB85,0xAB86,0xAB87,0xAB88, +0xAB89,0xE7EE,0xAB8A,0xAB8B,0xAB8C,0xAB8D,0xE7F3,0xAB8E, +0xD6E9,0xAB8F,0xAB90,0xAB91,0xAB92,0xE7ED,0xAB93,0xE7F2, +0xAB94,0xE7F1,0xAB95,0xAB96,0xAB97,0xB0E0,0xAB98,0xAB99, +0xAB9A,0xAB9B,0xE7F5,0xAB9C,0xAB9D,0xAB9E,0xAB9F,0xABA0, +0xAC40,0xAC41,0xAC42,0xAC43,0xAC44,0xAC45,0xAC46,0xAC47, +0xAC48,0xAC49,0xAC4A,0xC7F2,0xAC4B,0xC0C5,0xC0ED,0xAC4C, +0xAC4D,0xC1F0,0xE7F0,0xAC4E,0xAC4F,0xAC50,0xAC51,0xE7F6, +0xCBF6,0xAC52,0xAC53,0xAC54,0xAC55,0xAC56,0xAC57,0xAC58, +0xAC59,0xAC5A,0xE8A2,0xE8A1,0xAC5B,0xAC5C,0xAC5D,0xAC5E, +0xAC5F,0xAC60,0xD7C1,0xAC61,0xAC62,0xE7FA,0xE7F9,0xAC63, +0xE7FB,0xAC64,0xE7F7,0xAC65,0xE7FE,0xAC66,0xE7FD,0xAC67, +0xE7FC,0xAC68,0xAC69,0xC1D5,0xC7D9,0xC5FD,0xC5C3,0xAC6A, +0xAC6B,0xAC6C,0xAC6D,0xAC6E,0xC7ED,0xAC6F,0xAC70,0xAC71, +0xAC72,0xE8A3,0xAC73,0xAC74,0xAC75,0xAC76,0xAC77,0xAC78, +0xAC79,0xAC7A,0xAC7B,0xAC7C,0xAC7D,0xAC7E,0xAC80,0xAC81, +0xAC82,0xAC83,0xAC84,0xAC85,0xAC86,0xE8A6,0xAC87,0xE8A5, +0xAC88,0xE8A7,0xBAF7,0xE7F8,0xE8A4,0xAC89,0xC8F0,0xC9AA, +0xAC8A,0xAC8B,0xAC8C,0xAC8D,0xAC8E,0xAC8F,0xAC90,0xAC91, +0xAC92,0xAC93,0xAC94,0xAC95,0xAC96,0xE8A9,0xAC97,0xAC98, +0xB9E5,0xAC99,0xAC9A,0xAC9B,0xAC9C,0xAC9D,0xD1FE,0xE8A8, +0xAC9E,0xAC9F,0xACA0,0xAD40,0xAD41,0xAD42,0xE8AA,0xAD43, +0xE8AD,0xE8AE,0xAD44,0xC1A7,0xAD45,0xAD46,0xAD47,0xE8AF, +0xAD48,0xAD49,0xAD4A,0xE8B0,0xAD4B,0xAD4C,0xE8AC,0xAD4D, +0xE8B4,0xAD4E,0xAD4F,0xAD50,0xAD51,0xAD52,0xAD53,0xAD54, +0xAD55,0xAD56,0xAD57,0xAD58,0xE8AB,0xAD59,0xE8B1,0xAD5A, +0xAD5B,0xAD5C,0xAD5D,0xAD5E,0xAD5F,0xAD60,0xAD61,0xE8B5, +0xE8B2,0xE8B3,0xAD62,0xAD63,0xAD64,0xAD65,0xAD66,0xAD67, +0xAD68,0xAD69,0xAD6A,0xAD6B,0xAD6C,0xAD6D,0xAD6E,0xAD6F, +0xAD70,0xAD71,0xE8B7,0xAD72,0xAD73,0xAD74,0xAD75,0xAD76, +0xAD77,0xAD78,0xAD79,0xAD7A,0xAD7B,0xAD7C,0xAD7D,0xAD7E, +0xAD80,0xAD81,0xAD82,0xAD83,0xAD84,0xAD85,0xAD86,0xAD87, +0xAD88,0xAD89,0xE8B6,0xAD8A,0xAD8B,0xAD8C,0xAD8D,0xAD8E, +0xAD8F,0xAD90,0xAD91,0xAD92,0xB9CF,0xAD93,0xF0AC,0xAD94, +0xF0AD,0xAD95,0xC6B0,0xB0EA,0xC8BF,0xAD96,0xCDDF,0xAD97, +0xAD98,0xAD99,0xAD9A,0xAD9B,0xAD9C,0xAD9D,0xCECD,0xEAB1, +0xAD9E,0xAD9F,0xADA0,0xAE40,0xEAB2,0xAE41,0xC6BF,0xB4C9, +0xAE42,0xAE43,0xAE44,0xAE45,0xAE46,0xAE47,0xAE48,0xEAB3, +0xAE49,0xAE4A,0xAE4B,0xAE4C,0xD5E7,0xAE4D,0xAE4E,0xAE4F, +0xAE50,0xAE51,0xAE52,0xAE53,0xAE54,0xDDF9,0xAE55,0xEAB4, +0xAE56,0xEAB5,0xAE57,0xEAB6,0xAE58,0xAE59,0xAE5A,0xAE5B, +0xB8CA,0xDFB0,0xC9F5,0xAE5C,0xCCF0,0xAE5D,0xAE5E,0xC9FA, +0xAE5F,0xAE60,0xAE61,0xAE62,0xAE63,0xC9FB,0xAE64,0xAE65, +0xD3C3,0xCBA6,0xAE66,0xB8A6,0xF0AE,0xB1C2,0xAE67,0xE5B8, +0xCCEF,0xD3C9,0xBCD7,0xC9EA,0xAE68,0xB5E7,0xAE69,0xC4D0, +0xB5E9,0xAE6A,0xEEAE,0xBBAD,0xAE6B,0xAE6C,0xE7DE,0xAE6D, +0xEEAF,0xAE6E,0xAE6F,0xAE70,0xAE71,0xB3A9,0xAE72,0xAE73, +0xEEB2,0xAE74,0xAE75,0xEEB1,0xBDE7,0xAE76,0xEEB0,0xCEB7, +0xAE77,0xAE78,0xAE79,0xAE7A,0xC5CF,0xAE7B,0xAE7C,0xAE7D, +0xAE7E,0xC1F4,0xDBCE,0xEEB3,0xD0F3,0xAE80,0xAE81,0xAE82, +0xAE83,0xAE84,0xAE85,0xAE86,0xAE87,0xC2D4,0xC6E8,0xAE88, +0xAE89,0xAE8A,0xB7AC,0xAE8B,0xAE8C,0xAE8D,0xAE8E,0xAE8F, +0xAE90,0xAE91,0xEEB4,0xAE92,0xB3EB,0xAE93,0xAE94,0xAE95, +0xBBFB,0xEEB5,0xAE96,0xAE97,0xAE98,0xAE99,0xAE9A,0xE7DC, +0xAE9B,0xAE9C,0xAE9D,0xEEB6,0xAE9E,0xAE9F,0xBDAE,0xAEA0, +0xAF40,0xAF41,0xAF42,0xF1E2,0xAF43,0xAF44,0xAF45,0xCAE8, +0xAF46,0xD2C9,0xF0DA,0xAF47,0xF0DB,0xAF48,0xF0DC,0xC1C6, +0xAF49,0xB8ED,0xBECE,0xAF4A,0xAF4B,0xF0DE,0xAF4C,0xC5B1, +0xF0DD,0xD1F1,0xAF4D,0xF0E0,0xB0CC,0xBDEA,0xAF4E,0xAF4F, +0xAF50,0xAF51,0xAF52,0xD2DF,0xF0DF,0xAF53,0xB4AF,0xB7E8, +0xF0E6,0xF0E5,0xC6A3,0xF0E1,0xF0E2,0xB4C3,0xAF54,0xAF55, +0xF0E3,0xD5EE,0xAF56,0xAF57,0xCCDB,0xBED2,0xBCB2,0xAF58, +0xAF59,0xAF5A,0xF0E8,0xF0E7,0xF0E4,0xB2A1,0xAF5B,0xD6A2, +0xD3B8,0xBEB7,0xC8AC,0xAF5C,0xAF5D,0xF0EA,0xAF5E,0xAF5F, +0xAF60,0xAF61,0xD1F7,0xAF62,0xD6CC,0xBADB,0xF0E9,0xAF63, +0xB6BB,0xAF64,0xAF65,0xCDB4,0xAF66,0xAF67,0xC6A6,0xAF68, +0xAF69,0xAF6A,0xC1A1,0xF0EB,0xF0EE,0xAF6B,0xF0ED,0xF0F0, +0xF0EC,0xAF6C,0xBBBE,0xF0EF,0xAF6D,0xAF6E,0xAF6F,0xAF70, +0xCCB5,0xF0F2,0xAF71,0xAF72,0xB3D5,0xAF73,0xAF74,0xAF75, +0xAF76,0xB1D4,0xAF77,0xAF78,0xF0F3,0xAF79,0xAF7A,0xF0F4, +0xF0F6,0xB4E1,0xAF7B,0xF0F1,0xAF7C,0xF0F7,0xAF7D,0xAF7E, +0xAF80,0xAF81,0xF0FA,0xAF82,0xF0F8,0xAF83,0xAF84,0xAF85, +0xF0F5,0xAF86,0xAF87,0xAF88,0xAF89,0xF0FD,0xAF8A,0xF0F9, +0xF0FC,0xF0FE,0xAF8B,0xF1A1,0xAF8C,0xAF8D,0xAF8E,0xCEC1, +0xF1A4,0xAF8F,0xF1A3,0xAF90,0xC1F6,0xF0FB,0xCADD,0xAF91, +0xAF92,0xB4F1,0xB1F1,0xCCB1,0xAF93,0xF1A6,0xAF94,0xAF95, +0xF1A7,0xAF96,0xAF97,0xF1AC,0xD5CE,0xF1A9,0xAF98,0xAF99, +0xC8B3,0xAF9A,0xAF9B,0xAF9C,0xF1A2,0xAF9D,0xF1AB,0xF1A8, +0xF1A5,0xAF9E,0xAF9F,0xF1AA,0xAFA0,0xB040,0xB041,0xB042, +0xB043,0xB044,0xB045,0xB046,0xB0A9,0xF1AD,0xB047,0xB048, +0xB049,0xB04A,0xB04B,0xB04C,0xF1AF,0xB04D,0xF1B1,0xB04E, +0xB04F,0xB050,0xB051,0xB052,0xF1B0,0xB053,0xF1AE,0xB054, +0xB055,0xB056,0xB057,0xD1A2,0xB058,0xB059,0xB05A,0xB05B, +0xB05C,0xB05D,0xB05E,0xF1B2,0xB05F,0xB060,0xB061,0xF1B3, +0xB062,0xB063,0xB064,0xB065,0xB066,0xB067,0xB068,0xB069, +0xB9EF,0xB06A,0xB06B,0xB5C7,0xB06C,0xB0D7,0xB0D9,0xB06D, +0xB06E,0xB06F,0xD4ED,0xB070,0xB5C4,0xB071,0xBDD4,0xBBCA, +0xF0A7,0xB072,0xB073,0xB8DE,0xB074,0xB075,0xF0A8,0xB076, +0xB077,0xB0A8,0xB078,0xF0A9,0xB079,0xB07A,0xCDEE,0xB07B, +0xB07C,0xF0AA,0xB07D,0xB07E,0xB080,0xB081,0xB082,0xB083, +0xB084,0xB085,0xB086,0xB087,0xF0AB,0xB088,0xB089,0xB08A, +0xB08B,0xB08C,0xB08D,0xB08E,0xB08F,0xB090,0xC6A4,0xB091, +0xB092,0xD6E5,0xF1E4,0xB093,0xF1E5,0xB094,0xB095,0xB096, +0xB097,0xB098,0xB099,0xB09A,0xB09B,0xB09C,0xB09D,0xC3F3, +0xB09E,0xB09F,0xD3DB,0xB0A0,0xB140,0xD6D1,0xC5E8,0xB141, +0xD3AF,0xB142,0xD2E6,0xB143,0xB144,0xEEC1,0xB0BB,0xD5B5, +0xD1CE,0xBCE0,0xBAD0,0xB145,0xBFF8,0xB146,0xB8C7,0xB5C1, +0xC5CC,0xB147,0xB148,0xCAA2,0xB149,0xB14A,0xB14B,0xC3CB, +0xB14C,0xB14D,0xB14E,0xB14F,0xB150,0xEEC2,0xB151,0xB152, +0xB153,0xB154,0xB155,0xB156,0xB157,0xB158,0xC4BF,0xB6A2, +0xB159,0xEDEC,0xC3A4,0xB15A,0xD6B1,0xB15B,0xB15C,0xB15D, +0xCFE0,0xEDEF,0xB15E,0xB15F,0xC5CE,0xB160,0xB6DC,0xB161, +0xB162,0xCAA1,0xB163,0xB164,0xEDED,0xB165,0xB166,0xEDF0, +0xEDF1,0xC3BC,0xB167,0xBFB4,0xB168,0xEDEE,0xB169,0xB16A, +0xB16B,0xB16C,0xB16D,0xB16E,0xB16F,0xB170,0xB171,0xB172, +0xB173,0xEDF4,0xEDF2,0xB174,0xB175,0xB176,0xB177,0xD5E6, +0xC3DF,0xB178,0xEDF3,0xB179,0xB17A,0xB17B,0xEDF6,0xB17C, +0xD5A3,0xD1A3,0xB17D,0xB17E,0xB180,0xEDF5,0xB181,0xC3D0, +0xB182,0xB183,0xB184,0xB185,0xB186,0xEDF7,0xBFF4,0xBEEC, +0xEDF8,0xB187,0xCCF7,0xB188,0xD1DB,0xB189,0xB18A,0xB18B, +0xD7C5,0xD5F6,0xB18C,0xEDFC,0xB18D,0xB18E,0xB18F,0xEDFB, +0xB190,0xB191,0xB192,0xB193,0xB194,0xB195,0xB196,0xB197, +0xEDF9,0xEDFA,0xB198,0xB199,0xB19A,0xB19B,0xB19C,0xB19D, +0xB19E,0xB19F,0xEDFD,0xBEA6,0xB1A0,0xB240,0xB241,0xB242, +0xB243,0xCBAF,0xEEA1,0xB6BD,0xB244,0xEEA2,0xC4C0,0xB245, +0xEDFE,0xB246,0xB247,0xBDDE,0xB2C7,0xB248,0xB249,0xB24A, +0xB24B,0xB24C,0xB24D,0xB24E,0xB24F,0xB250,0xB251,0xB252, +0xB253,0xB6C3,0xB254,0xB255,0xB256,0xEEA5,0xD8BA,0xEEA3, +0xEEA6,0xB257,0xB258,0xB259,0xC3E9,0xB3F2,0xB25A,0xB25B, +0xB25C,0xB25D,0xB25E,0xB25F,0xEEA7,0xEEA4,0xCFB9,0xB260, +0xB261,0xEEA8,0xC2F7,0xB262,0xB263,0xB264,0xB265,0xB266, +0xB267,0xB268,0xB269,0xB26A,0xB26B,0xB26C,0xB26D,0xEEA9, +0xEEAA,0xB26E,0xDEAB,0xB26F,0xB270,0xC6B3,0xB271,0xC7C6, +0xB272,0xD6F5,0xB5C9,0xB273,0xCBB2,0xB274,0xB275,0xB276, +0xEEAB,0xB277,0xB278,0xCDAB,0xB279,0xEEAC,0xB27A,0xB27B, +0xB27C,0xB27D,0xB27E,0xD5B0,0xB280,0xEEAD,0xB281,0xF6C4, +0xB282,0xB283,0xB284,0xB285,0xB286,0xB287,0xB288,0xB289, +0xB28A,0xB28B,0xB28C,0xB28D,0xB28E,0xDBC7,0xB28F,0xB290, +0xB291,0xB292,0xB293,0xB294,0xB295,0xB296,0xB297,0xB4A3, +0xB298,0xB299,0xB29A,0xC3AC,0xF1E6,0xB29B,0xB29C,0xB29D, +0xB29E,0xB29F,0xCAB8,0xD2D3,0xB2A0,0xD6AA,0xB340,0xEFF2, +0xB341,0xBED8,0xB342,0xBDC3,0xEFF3,0xB6CC,0xB0AB,0xB343, +0xB344,0xB345,0xB346,0xCAAF,0xB347,0xB348,0xEDB6,0xB349, +0xEDB7,0xB34A,0xB34B,0xB34C,0xB34D,0xCEF9,0xB7AF,0xBFF3, +0xEDB8,0xC2EB,0xC9B0,0xB34E,0xB34F,0xB350,0xB351,0xB352, +0xB353,0xEDB9,0xB354,0xB355,0xC6F6,0xBFB3,0xB356,0xB357, +0xB358,0xEDBC,0xC5F8,0xB359,0xD1D0,0xB35A,0xD7A9,0xEDBA, +0xEDBB,0xB35B,0xD1E2,0xB35C,0xEDBF,0xEDC0,0xB35D,0xEDC4, +0xB35E,0xB35F,0xB360,0xEDC8,0xB361,0xEDC6,0xEDCE,0xD5E8, +0xB362,0xEDC9,0xB363,0xB364,0xEDC7,0xEDBE,0xB365,0xB366, +0xC5E9,0xB367,0xB368,0xB369,0xC6C6,0xB36A,0xB36B,0xC9E9, +0xD4D2,0xEDC1,0xEDC2,0xEDC3,0xEDC5,0xB36C,0xC0F9,0xB36D, +0xB4A1,0xB36E,0xB36F,0xB370,0xB371,0xB9E8,0xB372,0xEDD0, +0xB373,0xB374,0xB375,0xB376,0xEDD1,0xB377,0xEDCA,0xB378, +0xEDCF,0xB379,0xCEF8,0xB37A,0xB37B,0xCBB6,0xEDCC,0xEDCD, +0xB37C,0xB37D,0xB37E,0xB380,0xB381,0xCFF5,0xB382,0xB383, +0xB384,0xB385,0xB386,0xB387,0xB388,0xB389,0xB38A,0xB38B, +0xB38C,0xB38D,0xEDD2,0xC1F2,0xD3B2,0xEDCB,0xC8B7,0xB38E, +0xB38F,0xB390,0xB391,0xB392,0xB393,0xB394,0xB395,0xBCEF, +0xB396,0xB397,0xB398,0xB399,0xC5F0,0xB39A,0xB39B,0xB39C, +0xB39D,0xB39E,0xB39F,0xB3A0,0xB440,0xB441,0xB442,0xEDD6, +0xB443,0xB5EF,0xB444,0xB445,0xC2B5,0xB0AD,0xCBE9,0xB446, +0xB447,0xB1AE,0xB448,0xEDD4,0xB449,0xB44A,0xB44B,0xCDEB, +0xB5E2,0xB44C,0xEDD5,0xEDD3,0xEDD7,0xB44D,0xB44E,0xB5FA, +0xB44F,0xEDD8,0xB450,0xEDD9,0xB451,0xEDDC,0xB452,0xB1CC, +0xB453,0xB454,0xB455,0xB456,0xB457,0xB458,0xB459,0xB45A, +0xC5F6,0xBCEE,0xEDDA,0xCCBC,0xB2EA,0xB45B,0xB45C,0xB45D, +0xB45E,0xEDDB,0xB45F,0xB460,0xB461,0xB462,0xC4EB,0xB463, +0xB464,0xB4C5,0xB465,0xB466,0xB467,0xB0F5,0xB468,0xB469, +0xB46A,0xEDDF,0xC0DA,0xB4E8,0xB46B,0xB46C,0xB46D,0xB46E, +0xC5CD,0xB46F,0xB470,0xB471,0xEDDD,0xBFC4,0xB472,0xB473, +0xB474,0xEDDE,0xB475,0xB476,0xB477,0xB478,0xB479,0xB47A, +0xB47B,0xB47C,0xB47D,0xB47E,0xB480,0xB481,0xB482,0xB483, +0xC4A5,0xB484,0xB485,0xB486,0xEDE0,0xB487,0xB488,0xB489, +0xB48A,0xB48B,0xEDE1,0xB48C,0xEDE3,0xB48D,0xB48E,0xC1D7, +0xB48F,0xB490,0xBBC7,0xB491,0xB492,0xB493,0xB494,0xB495, +0xB496,0xBDB8,0xB497,0xB498,0xB499,0xEDE2,0xB49A,0xB49B, +0xB49C,0xB49D,0xB49E,0xB49F,0xB4A0,0xB540,0xB541,0xB542, +0xB543,0xB544,0xB545,0xEDE4,0xB546,0xB547,0xB548,0xB549, +0xB54A,0xB54B,0xB54C,0xB54D,0xB54E,0xB54F,0xEDE6,0xB550, +0xB551,0xB552,0xB553,0xB554,0xEDE5,0xB555,0xB556,0xB557, +0xB558,0xB559,0xB55A,0xB55B,0xB55C,0xB55D,0xB55E,0xB55F, +0xB560,0xB561,0xB562,0xB563,0xEDE7,0xB564,0xB565,0xB566, +0xB567,0xB568,0xCABE,0xECEA,0xC0F1,0xB569,0xC9E7,0xB56A, +0xECEB,0xC6EE,0xB56B,0xB56C,0xB56D,0xB56E,0xECEC,0xB56F, +0xC6ED,0xECED,0xB570,0xB571,0xB572,0xB573,0xB574,0xB575, +0xB576,0xB577,0xB578,0xECF0,0xB579,0xB57A,0xD7E6,0xECF3, +0xB57B,0xB57C,0xECF1,0xECEE,0xECEF,0xD7A3,0xC9F1,0xCBEE, +0xECF4,0xB57D,0xECF2,0xB57E,0xB580,0xCFE9,0xB581,0xECF6, +0xC6B1,0xB582,0xB583,0xB584,0xB585,0xBCC0,0xB586,0xECF5, +0xB587,0xB588,0xB589,0xB58A,0xB58B,0xB58C,0xB58D,0xB5BB, +0xBBF6,0xB58E,0xECF7,0xB58F,0xB590,0xB591,0xB592,0xB593, +0xD9F7,0xBDFB,0xB594,0xB595,0xC2BB,0xECF8,0xB596,0xB597, +0xB598,0xB599,0xECF9,0xB59A,0xB59B,0xB59C,0xB59D,0xB8A3, +0xB59E,0xB59F,0xB5A0,0xB640,0xB641,0xB642,0xB643,0xB644, +0xB645,0xB646,0xECFA,0xB647,0xB648,0xB649,0xB64A,0xB64B, +0xB64C,0xB64D,0xB64E,0xB64F,0xB650,0xB651,0xB652,0xECFB, +0xB653,0xB654,0xB655,0xB656,0xB657,0xB658,0xB659,0xB65A, +0xB65B,0xB65C,0xB65D,0xECFC,0xB65E,0xB65F,0xB660,0xB661, +0xB662,0xD3ED,0xD8AE,0xC0EB,0xB663,0xC7DD,0xBACC,0xB664, +0xD0E3,0xCBBD,0xB665,0xCDBA,0xB666,0xB667,0xB8D1,0xB668, +0xB669,0xB1FC,0xB66A,0xC7EF,0xB66B,0xD6D6,0xB66C,0xB66D, +0xB66E,0xBFC6,0xC3EB,0xB66F,0xB670,0xEFF5,0xB671,0xB672, +0xC3D8,0xB673,0xB674,0xB675,0xB676,0xB677,0xB678,0xD7E2, +0xB679,0xB67A,0xB67B,0xEFF7,0xB3D3,0xB67C,0xC7D8,0xD1ED, +0xB67D,0xD6C8,0xB67E,0xEFF8,0xB680,0xEFF6,0xB681,0xBBFD, +0xB3C6,0xB682,0xB683,0xB684,0xB685,0xB686,0xB687,0xB688, +0xBDD5,0xB689,0xB68A,0xD2C6,0xB68B,0xBBE0,0xB68C,0xB68D, +0xCFA1,0xB68E,0xEFFC,0xEFFB,0xB68F,0xB690,0xEFF9,0xB691, +0xB692,0xB693,0xB694,0xB3CC,0xB695,0xC9D4,0xCBB0,0xB696, +0xB697,0xB698,0xB699,0xB69A,0xEFFE,0xB69B,0xB69C,0xB0DE, +0xB69D,0xB69E,0xD6C9,0xB69F,0xB6A0,0xB740,0xEFFD,0xB741, +0xB3ED,0xB742,0xB743,0xF6D5,0xB744,0xB745,0xB746,0xB747, +0xB748,0xB749,0xB74A,0xB74B,0xB74C,0xB74D,0xB74E,0xB74F, +0xB750,0xB751,0xB752,0xCEC8,0xB753,0xB754,0xB755,0xF0A2, +0xB756,0xF0A1,0xB757,0xB5BE,0xBCDA,0xBBFC,0xB758,0xB8E5, +0xB759,0xB75A,0xB75B,0xB75C,0xB75D,0xB75E,0xC4C2,0xB75F, +0xB760,0xB761,0xB762,0xB763,0xB764,0xB765,0xB766,0xB767, +0xB768,0xF0A3,0xB769,0xB76A,0xB76B,0xB76C,0xB76D,0xCBEB, +0xB76E,0xB76F,0xB770,0xB771,0xB772,0xB773,0xB774,0xB775, +0xB776,0xB777,0xB778,0xB779,0xB77A,0xB77B,0xB77C,0xB77D, +0xB77E,0xB780,0xB781,0xB782,0xB783,0xB784,0xB785,0xB786, +0xF0A6,0xB787,0xB788,0xB789,0xD1A8,0xB78A,0xBEBF,0xC7EE, +0xF1B6,0xF1B7,0xBFD5,0xB78B,0xB78C,0xB78D,0xB78E,0xB4A9, +0xF1B8,0xCDBB,0xB78F,0xC7D4,0xD5AD,0xB790,0xF1B9,0xB791, +0xF1BA,0xB792,0xB793,0xB794,0xB795,0xC7CF,0xB796,0xB797, +0xB798,0xD2A4,0xD6CF,0xB799,0xB79A,0xF1BB,0xBDD1,0xB4B0, +0xBEBD,0xB79B,0xB79C,0xB79D,0xB4DC,0xCED1,0xB79E,0xBFDF, +0xF1BD,0xB79F,0xB7A0,0xB840,0xB841,0xBFFA,0xF1BC,0xB842, +0xF1BF,0xB843,0xB844,0xB845,0xF1BE,0xF1C0,0xB846,0xB847, +0xB848,0xB849,0xB84A,0xF1C1,0xB84B,0xB84C,0xB84D,0xB84E, +0xB84F,0xB850,0xB851,0xB852,0xB853,0xB854,0xB855,0xC1FE, +0xB856,0xB857,0xB858,0xB859,0xB85A,0xB85B,0xB85C,0xB85D, +0xB85E,0xB85F,0xB860,0xC1A2,0xB861,0xB862,0xB863,0xB864, +0xB865,0xB866,0xB867,0xB868,0xB869,0xB86A,0xCAFA,0xB86B, +0xB86C,0xD5BE,0xB86D,0xB86E,0xB86F,0xB870,0xBEBA,0xBEB9, +0xD5C2,0xB871,0xB872,0xBFA2,0xB873,0xCDAF,0xF1B5,0xB874, +0xB875,0xB876,0xB877,0xB878,0xB879,0xBDDF,0xB87A,0xB6CB, +0xB87B,0xB87C,0xB87D,0xB87E,0xB880,0xB881,0xB882,0xB883, +0xB884,0xD6F1,0xF3C3,0xB885,0xB886,0xF3C4,0xB887,0xB8CD, +0xB888,0xB889,0xB88A,0xF3C6,0xF3C7,0xB88B,0xB0CA,0xB88C, +0xF3C5,0xB88D,0xF3C9,0xCBF1,0xB88E,0xB88F,0xB890,0xF3CB, +0xB891,0xD0A6,0xB892,0xB893,0xB1CA,0xF3C8,0xB894,0xB895, +0xB896,0xF3CF,0xB897,0xB5D1,0xB898,0xB899,0xF3D7,0xB89A, +0xF3D2,0xB89B,0xB89C,0xB89D,0xF3D4,0xF3D3,0xB7FB,0xB89E, +0xB1BF,0xB89F,0xF3CE,0xF3CA,0xB5DA,0xB8A0,0xF3D0,0xB940, +0xB941,0xF3D1,0xB942,0xF3D5,0xB943,0xB944,0xB945,0xB946, +0xF3CD,0xB947,0xBCE3,0xB948,0xC1FD,0xB949,0xF3D6,0xB94A, +0xB94B,0xB94C,0xB94D,0xB94E,0xB94F,0xF3DA,0xB950,0xF3CC, +0xB951,0xB5C8,0xB952,0xBDEE,0xF3DC,0xB953,0xB954,0xB7A4, +0xBFF0,0xD6FE,0xCDB2,0xB955,0xB4F0,0xB956,0xB2DF,0xB957, +0xF3D8,0xB958,0xF3D9,0xC9B8,0xB959,0xF3DD,0xB95A,0xB95B, +0xF3DE,0xB95C,0xF3E1,0xB95D,0xB95E,0xB95F,0xB960,0xB961, +0xB962,0xB963,0xB964,0xB965,0xB966,0xB967,0xF3DF,0xB968, +0xB969,0xF3E3,0xF3E2,0xB96A,0xB96B,0xF3DB,0xB96C,0xBFEA, +0xB96D,0xB3EF,0xB96E,0xF3E0,0xB96F,0xB970,0xC7A9,0xB971, +0xBCF2,0xB972,0xB973,0xB974,0xB975,0xF3EB,0xB976,0xB977, +0xB978,0xB979,0xB97A,0xB97B,0xB97C,0xB9BF,0xB97D,0xB97E, +0xF3E4,0xB980,0xB981,0xB982,0xB2AD,0xBBFE,0xB983,0xCBE3, +0xB984,0xB985,0xB986,0xB987,0xF3ED,0xF3E9,0xB988,0xB989, +0xB98A,0xB9DC,0xF3EE,0xB98B,0xB98C,0xB98D,0xF3E5,0xF3E6, +0xF3EA,0xC2E1,0xF3EC,0xF3EF,0xF3E8,0xBCFD,0xB98E,0xB98F, +0xB990,0xCFE4,0xB991,0xB992,0xF3F0,0xB993,0xB994,0xB995, +0xF3E7,0xB996,0xB997,0xB998,0xB999,0xB99A,0xB99B,0xB99C, +0xB99D,0xF3F2,0xB99E,0xB99F,0xB9A0,0xBA40,0xD7AD,0xC6AA, +0xBA41,0xBA42,0xBA43,0xBA44,0xF3F3,0xBA45,0xBA46,0xBA47, +0xBA48,0xF3F1,0xBA49,0xC2A8,0xBA4A,0xBA4B,0xBA4C,0xBA4D, +0xBA4E,0xB8DD,0xF3F5,0xBA4F,0xBA50,0xF3F4,0xBA51,0xBA52, +0xBA53,0xB4DB,0xBA54,0xBA55,0xBA56,0xF3F6,0xF3F7,0xBA57, +0xBA58,0xBA59,0xF3F8,0xBA5A,0xBA5B,0xBA5C,0xC0BA,0xBA5D, +0xBA5E,0xC0E9,0xBA5F,0xBA60,0xBA61,0xBA62,0xBA63,0xC5F1, +0xBA64,0xBA65,0xBA66,0xBA67,0xF3FB,0xBA68,0xF3FA,0xBA69, +0xBA6A,0xBA6B,0xBA6C,0xBA6D,0xBA6E,0xBA6F,0xBA70,0xB4D8, +0xBA71,0xBA72,0xBA73,0xF3FE,0xF3F9,0xBA74,0xBA75,0xF3FC, +0xBA76,0xBA77,0xBA78,0xBA79,0xBA7A,0xBA7B,0xF3FD,0xBA7C, +0xBA7D,0xBA7E,0xBA80,0xBA81,0xBA82,0xBA83,0xBA84,0xF4A1, +0xBA85,0xBA86,0xBA87,0xBA88,0xBA89,0xBA8A,0xF4A3,0xBBC9, +0xBA8B,0xBA8C,0xF4A2,0xBA8D,0xBA8E,0xBA8F,0xBA90,0xBA91, +0xBA92,0xBA93,0xBA94,0xBA95,0xBA96,0xBA97,0xBA98,0xBA99, +0xF4A4,0xBA9A,0xBA9B,0xBA9C,0xBA9D,0xBA9E,0xBA9F,0xB2BE, +0xF4A6,0xF4A5,0xBAA0,0xBB40,0xBB41,0xBB42,0xBB43,0xBB44, +0xBB45,0xBB46,0xBB47,0xBB48,0xBB49,0xBCAE,0xBB4A,0xBB4B, +0xBB4C,0xBB4D,0xBB4E,0xBB4F,0xBB50,0xBB51,0xBB52,0xBB53, +0xBB54,0xBB55,0xBB56,0xBB57,0xBB58,0xBB59,0xBB5A,0xBB5B, +0xBB5C,0xBB5D,0xBB5E,0xBB5F,0xBB60,0xBB61,0xBB62,0xBB63, +0xBB64,0xBB65,0xBB66,0xBB67,0xBB68,0xBB69,0xBB6A,0xBB6B, +0xBB6C,0xBB6D,0xBB6E,0xC3D7,0xD9E1,0xBB6F,0xBB70,0xBB71, +0xBB72,0xBB73,0xBB74,0xC0E0,0xF4CC,0xD7D1,0xBB75,0xBB76, +0xBB77,0xBB78,0xBB79,0xBB7A,0xBB7B,0xBB7C,0xBB7D,0xBB7E, +0xBB80,0xB7DB,0xBB81,0xBB82,0xBB83,0xBB84,0xBB85,0xBB86, +0xBB87,0xF4CE,0xC1A3,0xBB88,0xBB89,0xC6C9,0xBB8A,0xB4D6, +0xD5B3,0xBB8B,0xBB8C,0xBB8D,0xF4D0,0xF4CF,0xF4D1,0xCBDA, +0xBB8E,0xBB8F,0xF4D2,0xBB90,0xD4C1,0xD6E0,0xBB91,0xBB92, +0xBB93,0xBB94,0xB7E0,0xBB95,0xBB96,0xBB97,0xC1B8,0xBB98, +0xBB99,0xC1BB,0xF4D3,0xBEAC,0xBB9A,0xBB9B,0xBB9C,0xBB9D, +0xBB9E,0xB4E2,0xBB9F,0xBBA0,0xF4D4,0xF4D5,0xBEAB,0xBC40, +0xBC41,0xF4D6,0xBC42,0xBC43,0xBC44,0xF4DB,0xBC45,0xF4D7, +0xF4DA,0xBC46,0xBAFD,0xBC47,0xF4D8,0xF4D9,0xBC48,0xBC49, +0xBC4A,0xBC4B,0xBC4C,0xBC4D,0xBC4E,0xB8E2,0xCCC7,0xF4DC, +0xBC4F,0xB2DA,0xBC50,0xBC51,0xC3D3,0xBC52,0xBC53,0xD4E3, +0xBFB7,0xBC54,0xBC55,0xBC56,0xBC57,0xBC58,0xBC59,0xBC5A, +0xF4DD,0xBC5B,0xBC5C,0xBC5D,0xBC5E,0xBC5F,0xBC60,0xC5B4, +0xBC61,0xBC62,0xBC63,0xBC64,0xBC65,0xBC66,0xBC67,0xBC68, +0xF4E9,0xBC69,0xBC6A,0xCFB5,0xBC6B,0xBC6C,0xBC6D,0xBC6E, +0xBC6F,0xBC70,0xBC71,0xBC72,0xBC73,0xBC74,0xBC75,0xBC76, +0xBC77,0xBC78,0xCEC9,0xBC79,0xBC7A,0xBC7B,0xBC7C,0xBC7D, +0xBC7E,0xBC80,0xBC81,0xBC82,0xBC83,0xBC84,0xBC85,0xBC86, +0xBC87,0xBC88,0xBC89,0xBC8A,0xBC8B,0xBC8C,0xBC8D,0xBC8E, +0xCBD8,0xBC8F,0xCBF7,0xBC90,0xBC91,0xBC92,0xBC93,0xBDF4, +0xBC94,0xBC95,0xBC96,0xD7CF,0xBC97,0xBC98,0xBC99,0xC0DB, +0xBC9A,0xBC9B,0xBC9C,0xBC9D,0xBC9E,0xBC9F,0xBCA0,0xBD40, +0xBD41,0xBD42,0xBD43,0xBD44,0xBD45,0xBD46,0xBD47,0xBD48, +0xBD49,0xBD4A,0xBD4B,0xBD4C,0xBD4D,0xBD4E,0xBD4F,0xBD50, +0xBD51,0xBD52,0xBD53,0xBD54,0xBD55,0xBD56,0xBD57,0xBD58, +0xBD59,0xBD5A,0xBD5B,0xBD5C,0xBD5D,0xBD5E,0xBD5F,0xBD60, +0xBD61,0xBD62,0xBD63,0xBD64,0xBD65,0xBD66,0xBD67,0xBD68, +0xBD69,0xBD6A,0xBD6B,0xBD6C,0xBD6D,0xBD6E,0xBD6F,0xBD70, +0xBD71,0xBD72,0xBD73,0xBD74,0xBD75,0xBD76,0xD0F5,0xBD77, +0xBD78,0xBD79,0xBD7A,0xBD7B,0xBD7C,0xBD7D,0xBD7E,0xF4EA, +0xBD80,0xBD81,0xBD82,0xBD83,0xBD84,0xBD85,0xBD86,0xBD87, +0xBD88,0xBD89,0xBD8A,0xBD8B,0xBD8C,0xBD8D,0xBD8E,0xBD8F, +0xBD90,0xBD91,0xBD92,0xBD93,0xBD94,0xBD95,0xBD96,0xBD97, +0xBD98,0xBD99,0xBD9A,0xBD9B,0xBD9C,0xBD9D,0xBD9E,0xBD9F, +0xBDA0,0xBE40,0xBE41,0xBE42,0xBE43,0xBE44,0xBE45,0xBE46, +0xBE47,0xBE48,0xBE49,0xBE4A,0xBE4B,0xBE4C,0xF4EB,0xBE4D, +0xBE4E,0xBE4F,0xBE50,0xBE51,0xBE52,0xBE53,0xF4EC,0xBE54, +0xBE55,0xBE56,0xBE57,0xBE58,0xBE59,0xBE5A,0xBE5B,0xBE5C, +0xBE5D,0xBE5E,0xBE5F,0xBE60,0xBE61,0xBE62,0xBE63,0xBE64, +0xBE65,0xBE66,0xBE67,0xBE68,0xBE69,0xBE6A,0xBE6B,0xBE6C, +0xBE6D,0xBE6E,0xBE6F,0xBE70,0xBE71,0xBE72,0xBE73,0xBE74, +0xBE75,0xBE76,0xBE77,0xBE78,0xBE79,0xBE7A,0xBE7B,0xBE7C, +0xBE7D,0xBE7E,0xBE80,0xBE81,0xBE82,0xBE83,0xBE84,0xBE85, +0xBE86,0xBE87,0xBE88,0xBE89,0xBE8A,0xBE8B,0xBE8C,0xBE8D, +0xBE8E,0xBE8F,0xBE90,0xBE91,0xBE92,0xBE93,0xBE94,0xBE95, +0xBE96,0xBE97,0xBE98,0xBE99,0xBE9A,0xBE9B,0xBE9C,0xBE9D, +0xBE9E,0xBE9F,0xBEA0,0xBF40,0xBF41,0xBF42,0xBF43,0xBF44, +0xBF45,0xBF46,0xBF47,0xBF48,0xBF49,0xBF4A,0xBF4B,0xBF4C, +0xBF4D,0xBF4E,0xBF4F,0xBF50,0xBF51,0xBF52,0xBF53,0xBF54, +0xBF55,0xBF56,0xBF57,0xBF58,0xBF59,0xBF5A,0xBF5B,0xBF5C, +0xBF5D,0xBF5E,0xBF5F,0xBF60,0xBF61,0xBF62,0xBF63,0xBF64, +0xBF65,0xBF66,0xBF67,0xBF68,0xBF69,0xBF6A,0xBF6B,0xBF6C, +0xBF6D,0xBF6E,0xBF6F,0xBF70,0xBF71,0xBF72,0xBF73,0xBF74, +0xBF75,0xBF76,0xBF77,0xBF78,0xBF79,0xBF7A,0xBF7B,0xBF7C, +0xBF7D,0xBF7E,0xBF80,0xF7E3,0xBF81,0xBF82,0xBF83,0xBF84, +0xBF85,0xB7B1,0xBF86,0xBF87,0xBF88,0xBF89,0xBF8A,0xF4ED, +0xBF8B,0xBF8C,0xBF8D,0xBF8E,0xBF8F,0xBF90,0xBF91,0xBF92, +0xBF93,0xBF94,0xBF95,0xBF96,0xBF97,0xBF98,0xBF99,0xBF9A, +0xBF9B,0xBF9C,0xBF9D,0xBF9E,0xBF9F,0xBFA0,0xC040,0xC041, +0xC042,0xC043,0xC044,0xC045,0xC046,0xC047,0xC048,0xC049, +0xC04A,0xC04B,0xC04C,0xC04D,0xC04E,0xC04F,0xC050,0xC051, +0xC052,0xC053,0xC054,0xC055,0xC056,0xC057,0xC058,0xC059, +0xC05A,0xC05B,0xC05C,0xC05D,0xC05E,0xC05F,0xC060,0xC061, +0xC062,0xC063,0xD7EB,0xC064,0xC065,0xC066,0xC067,0xC068, +0xC069,0xC06A,0xC06B,0xC06C,0xC06D,0xC06E,0xC06F,0xC070, +0xC071,0xC072,0xC073,0xC074,0xC075,0xC076,0xC077,0xC078, +0xC079,0xC07A,0xC07B,0xF4EE,0xC07C,0xC07D,0xC07E,0xE6F9, +0xBEC0,0xE6FA,0xBAEC,0xE6FB,0xCFCB,0xE6FC,0xD4BC,0xBCB6, +0xE6FD,0xE6FE,0xBCCD,0xC8D2,0xCEB3,0xE7A1,0xC080,0xB4BF, +0xE7A2,0xC9B4,0xB8D9,0xC4C9,0xC081,0xD7DD,0xC2DA,0xB7D7, +0xD6BD,0xCEC6,0xB7C4,0xC082,0xC083,0xC5A6,0xE7A3,0xCFDF, +0xE7A4,0xE7A5,0xE7A6,0xC1B7,0xD7E9,0xC9F0,0xCFB8,0xD6AF, +0xD6D5,0xE7A7,0xB0ED,0xE7A8,0xE7A9,0xC9DC,0xD2EF,0xBEAD, +0xE7AA,0xB0F3,0xC8DE,0xBDE1,0xE7AB,0xC8C6,0xC084,0xE7AC, +0xBBE6,0xB8F8,0xD1A4,0xE7AD,0xC2E7,0xBEF8,0xBDCA,0xCDB3, +0xE7AE,0xE7AF,0xBEEE,0xD0E5,0xC085,0xCBE7,0xCCD0,0xBCCC, +0xE7B0,0xBCA8,0xD0F7,0xE7B1,0xC086,0xD0F8,0xE7B2,0xE7B3, +0xB4C2,0xE7B4,0xE7B5,0xC9FE,0xCEAC,0xC3E0,0xE7B7,0xB1C1, +0xB3F1,0xC087,0xE7B8,0xE7B9,0xD7DB,0xD5C0,0xE7BA,0xC2CC, +0xD7BA,0xE7BB,0xE7BC,0xE7BD,0xBCEA,0xC3E5,0xC0C2,0xE7BE, +0xE7BF,0xBCA9,0xC088,0xE7C0,0xE7C1,0xE7B6,0xB6D0,0xE7C2, +0xC089,0xE7C3,0xE7C4,0xBBBA,0xB5DE,0xC2C6,0xB1E0,0xE7C5, +0xD4B5,0xE7C6,0xB8BF,0xE7C8,0xE7C7,0xB7EC,0xC08A,0xE7C9, +0xB2F8,0xE7CA,0xE7CB,0xE7CC,0xE7CD,0xE7CE,0xE7CF,0xE7D0, +0xD3A7,0xCBF5,0xE7D1,0xE7D2,0xE7D3,0xE7D4,0xC9C9,0xE7D5, +0xE7D6,0xE7D7,0xE7D8,0xE7D9,0xBDC9,0xE7DA,0xF3BE,0xC08B, +0xB8D7,0xC08C,0xC8B1,0xC08D,0xC08E,0xC08F,0xC090,0xC091, +0xC092,0xC093,0xF3BF,0xC094,0xF3C0,0xF3C1,0xC095,0xC096, +0xC097,0xC098,0xC099,0xC09A,0xC09B,0xC09C,0xC09D,0xC09E, +0xB9DE,0xCDF8,0xC09F,0xC0A0,0xD8E8,0xBAB1,0xC140,0xC2DE, +0xEEB7,0xC141,0xB7A3,0xC142,0xC143,0xC144,0xC145,0xEEB9, +0xC146,0xEEB8,0xB0D5,0xC147,0xC148,0xC149,0xC14A,0xC14B, +0xEEBB,0xD5D6,0xD7EF,0xC14C,0xC14D,0xC14E,0xD6C3,0xC14F, +0xC150,0xEEBD,0xCAF0,0xC151,0xEEBC,0xC152,0xC153,0xC154, +0xC155,0xEEBE,0xC156,0xC157,0xC158,0xC159,0xEEC0,0xC15A, +0xC15B,0xEEBF,0xC15C,0xC15D,0xC15E,0xC15F,0xC160,0xC161, +0xC162,0xC163,0xD1F2,0xC164,0xC7BC,0xC165,0xC3C0,0xC166, +0xC167,0xC168,0xC169,0xC16A,0xB8E1,0xC16B,0xC16C,0xC16D, +0xC16E,0xC16F,0xC1E7,0xC170,0xC171,0xF4C6,0xD0DF,0xF4C7, +0xC172,0xCFDB,0xC173,0xC174,0xC8BA,0xC175,0xC176,0xF4C8, +0xC177,0xC178,0xC179,0xC17A,0xC17B,0xC17C,0xC17D,0xF4C9, +0xF4CA,0xC17E,0xF4CB,0xC180,0xC181,0xC182,0xC183,0xC184, +0xD9FA,0xB8FE,0xC185,0xC186,0xE5F1,0xD3F0,0xC187,0xF4E0, +0xC188,0xCECC,0xC189,0xC18A,0xC18B,0xB3E1,0xC18C,0xC18D, +0xC18E,0xC18F,0xF1B4,0xC190,0xD2EE,0xC191,0xF4E1,0xC192, +0xC193,0xC194,0xC195,0xC196,0xCFE8,0xF4E2,0xC197,0xC198, +0xC7CC,0xC199,0xC19A,0xC19B,0xC19C,0xC19D,0xC19E,0xB5D4, +0xB4E4,0xF4E4,0xC19F,0xC1A0,0xC240,0xF4E3,0xF4E5,0xC241, +0xC242,0xF4E6,0xC243,0xC244,0xC245,0xC246,0xF4E7,0xC247, +0xBAB2,0xB0BF,0xC248,0xF4E8,0xC249,0xC24A,0xC24B,0xC24C, +0xC24D,0xC24E,0xC24F,0xB7AD,0xD2ED,0xC250,0xC251,0xC252, +0xD2AB,0xC0CF,0xC253,0xBFBC,0xEBA3,0xD5DF,0xEAC8,0xC254, +0xC255,0xC256,0xC257,0xF1F3,0xB6F8,0xCBA3,0xC258,0xC259, +0xC4CD,0xC25A,0xF1E7,0xC25B,0xF1E8,0xB8FB,0xF1E9,0xBAC4, +0xD4C5,0xB0D2,0xC25C,0xC25D,0xF1EA,0xC25E,0xC25F,0xC260, +0xF1EB,0xC261,0xF1EC,0xC262,0xC263,0xF1ED,0xF1EE,0xF1EF, +0xF1F1,0xF1F0,0xC5D5,0xC264,0xC265,0xC266,0xC267,0xC268, +0xC269,0xF1F2,0xC26A,0xB6FA,0xC26B,0xF1F4,0xD2AE,0xDEC7, +0xCBCA,0xC26C,0xC26D,0xB3DC,0xC26E,0xB5A2,0xC26F,0xB9A2, +0xC270,0xC271,0xC4F4,0xF1F5,0xC272,0xC273,0xF1F6,0xC274, +0xC275,0xC276,0xC1C4,0xC1FB,0xD6B0,0xF1F7,0xC277,0xC278, +0xC279,0xC27A,0xF1F8,0xC27B,0xC1AA,0xC27C,0xC27D,0xC27E, +0xC6B8,0xC280,0xBEDB,0xC281,0xC282,0xC283,0xC284,0xC285, +0xC286,0xC287,0xC288,0xC289,0xC28A,0xC28B,0xC28C,0xC28D, +0xC28E,0xF1F9,0xB4CF,0xC28F,0xC290,0xC291,0xC292,0xC293, +0xC294,0xF1FA,0xC295,0xC296,0xC297,0xC298,0xC299,0xC29A, +0xC29B,0xC29C,0xC29D,0xC29E,0xC29F,0xC2A0,0xC340,0xEDB2, +0xEDB1,0xC341,0xC342,0xCBE0,0xD2DE,0xC343,0xCBC1,0xD5D8, +0xC344,0xC8E2,0xC345,0xC0DF,0xBCA1,0xC346,0xC347,0xC348, +0xC349,0xC34A,0xC34B,0xEBC1,0xC34C,0xC34D,0xD0A4,0xC34E, +0xD6E2,0xC34F,0xB6C7,0xB8D8,0xEBC0,0xB8CE,0xC350,0xEBBF, +0xB3A6,0xB9C9,0xD6AB,0xC351,0xB7F4,0xB7CA,0xC352,0xC353, +0xC354,0xBCE7,0xB7BE,0xEBC6,0xC355,0xEBC7,0xB0B9,0xBFCF, +0xC356,0xEBC5,0xD3FD,0xC357,0xEBC8,0xC358,0xC359,0xEBC9, +0xC35A,0xC35B,0xB7CE,0xC35C,0xEBC2,0xEBC4,0xC9F6,0xD6D7, +0xD5CD,0xD0B2,0xEBCF,0xCEB8,0xEBD0,0xC35D,0xB5A8,0xC35E, +0xC35F,0xC360,0xC361,0xC362,0xB1B3,0xEBD2,0xCCA5,0xC363, +0xC364,0xC365,0xC366,0xC367,0xC368,0xC369,0xC5D6,0xEBD3, +0xC36A,0xEBD1,0xC5DF,0xEBCE,0xCAA4,0xEBD5,0xB0FB,0xC36B, +0xC36C,0xBAFA,0xC36D,0xC36E,0xD8B7,0xF1E3,0xC36F,0xEBCA, +0xEBCB,0xEBCC,0xEBCD,0xEBD6,0xE6C0,0xEBD9,0xC370,0xBFE8, +0xD2C8,0xEBD7,0xEBDC,0xB8EC,0xEBD8,0xC371,0xBDBA,0xC372, +0xD0D8,0xC373,0xB0B7,0xC374,0xEBDD,0xC4DC,0xC375,0xC376, +0xC377,0xC378,0xD6AC,0xC379,0xC37A,0xC37B,0xB4E0,0xC37C, +0xC37D,0xC2F6,0xBCB9,0xC37E,0xC380,0xEBDA,0xEBDB,0xD4E0, +0xC6EA,0xC4D4,0xEBDF,0xC5A7,0xD9F5,0xC381,0xB2B1,0xC382, +0xEBE4,0xC383,0xBDC5,0xC384,0xC385,0xC386,0xEBE2,0xC387, +0xC388,0xC389,0xC38A,0xC38B,0xC38C,0xC38D,0xC38E,0xC38F, +0xC390,0xC391,0xC392,0xC393,0xEBE3,0xC394,0xC395,0xB8AC, +0xC396,0xCDD1,0xEBE5,0xC397,0xC398,0xC399,0xEBE1,0xC39A, +0xC1B3,0xC39B,0xC39C,0xC39D,0xC39E,0xC39F,0xC6A2,0xC3A0, +0xC440,0xC441,0xC442,0xC443,0xC444,0xC445,0xCCF3,0xC446, +0xEBE6,0xC447,0xC0B0,0xD2B8,0xEBE7,0xC448,0xC449,0xC44A, +0xB8AF,0xB8AD,0xC44B,0xEBE8,0xC7BB,0xCDF3,0xC44C,0xC44D, +0xC44E,0xEBEA,0xEBEB,0xC44F,0xC450,0xC451,0xC452,0xC453, +0xEBED,0xC454,0xC455,0xC456,0xC457,0xD0C8,0xC458,0xEBF2, +0xC459,0xEBEE,0xC45A,0xC45B,0xC45C,0xEBF1,0xC8F9,0xC45D, +0xD1FC,0xEBEC,0xC45E,0xC45F,0xEBE9,0xC460,0xC461,0xC462, +0xC463,0xB8B9,0xCFD9,0xC4E5,0xEBEF,0xEBF0,0xCCDA,0xCDC8, +0xB0F2,0xC464,0xEBF6,0xC465,0xC466,0xC467,0xC468,0xC469, +0xEBF5,0xC46A,0xB2B2,0xC46B,0xC46C,0xC46D,0xC46E,0xB8E0, +0xC46F,0xEBF7,0xC470,0xC471,0xC472,0xC473,0xC474,0xC475, +0xB1EC,0xC476,0xC477,0xCCC5,0xC4A4,0xCFA5,0xC478,0xC479, +0xC47A,0xC47B,0xC47C,0xEBF9,0xC47D,0xC47E,0xECA2,0xC480, +0xC5F2,0xC481,0xEBFA,0xC482,0xC483,0xC484,0xC485,0xC486, +0xC487,0xC488,0xC489,0xC9C5,0xC48A,0xC48B,0xC48C,0xC48D, +0xC48E,0xC48F,0xE2DF,0xEBFE,0xC490,0xC491,0xC492,0xC493, +0xCDCE,0xECA1,0xB1DB,0xD3B7,0xC494,0xC495,0xD2DC,0xC496, +0xC497,0xC498,0xEBFD,0xC499,0xEBFB,0xC49A,0xC49B,0xC49C, +0xC49D,0xC49E,0xC49F,0xC4A0,0xC540,0xC541,0xC542,0xC543, +0xC544,0xC545,0xC546,0xC547,0xC548,0xC549,0xC54A,0xC54B, +0xC54C,0xC54D,0xC54E,0xB3BC,0xC54F,0xC550,0xC551,0xEAB0, +0xC552,0xC553,0xD7D4,0xC554,0xF4AB,0xB3F4,0xC555,0xC556, +0xC557,0xC558,0xC559,0xD6C1,0xD6C2,0xC55A,0xC55B,0xC55C, +0xC55D,0xC55E,0xC55F,0xD5E9,0xBECA,0xC560,0xF4A7,0xC561, +0xD2A8,0xF4A8,0xF4A9,0xC562,0xF4AA,0xBECB,0xD3DF,0xC563, +0xC564,0xC565,0xC566,0xC567,0xC9E0,0xC9E1,0xC568,0xC569, +0xF3C2,0xC56A,0xCAE6,0xC56B,0xCCF2,0xC56C,0xC56D,0xC56E, +0xC56F,0xC570,0xC571,0xE2B6,0xCBB4,0xC572,0xCEE8,0xD6DB, +0xC573,0xF4AD,0xF4AE,0xF4AF,0xC574,0xC575,0xC576,0xC577, +0xF4B2,0xC578,0xBABD,0xF4B3,0xB0E3,0xF4B0,0xC579,0xF4B1, +0xBDA2,0xB2D5,0xC57A,0xF4B6,0xF4B7,0xB6E6,0xB2B0,0xCFCF, +0xF4B4,0xB4AC,0xC57B,0xF4B5,0xC57C,0xC57D,0xF4B8,0xC57E, +0xC580,0xC581,0xC582,0xC583,0xF4B9,0xC584,0xC585,0xCDA7, +0xC586,0xF4BA,0xC587,0xF4BB,0xC588,0xC589,0xC58A,0xF4BC, +0xC58B,0xC58C,0xC58D,0xC58E,0xC58F,0xC590,0xC591,0xC592, +0xCBD2,0xC593,0xF4BD,0xC594,0xC595,0xC596,0xC597,0xF4BE, +0xC598,0xC599,0xC59A,0xC59B,0xC59C,0xC59D,0xC59E,0xC59F, +0xF4BF,0xC5A0,0xC640,0xC641,0xC642,0xC643,0xF4DE,0xC1BC, +0xBCE8,0xC644,0xC9AB,0xD1DE,0xE5F5,0xC645,0xC646,0xC647, +0xC648,0xDCB3,0xD2D5,0xC649,0xC64A,0xDCB4,0xB0AC,0xDCB5, +0xC64B,0xC64C,0xBDDA,0xC64D,0xDCB9,0xC64E,0xC64F,0xC650, +0xD8C2,0xC651,0xDCB7,0xD3F3,0xC652,0xC9D6,0xDCBA,0xDCB6, +0xC653,0xDCBB,0xC3A2,0xC654,0xC655,0xC656,0xC657,0xDCBC, +0xDCC5,0xDCBD,0xC658,0xC659,0xCEDF,0xD6A5,0xC65A,0xDCCF, +0xC65B,0xDCCD,0xC65C,0xC65D,0xDCD2,0xBDE6,0xC2AB,0xC65E, +0xDCB8,0xDCCB,0xDCCE,0xDCBE,0xB7D2,0xB0C5,0xDCC7,0xD0BE, +0xDCC1,0xBBA8,0xC65F,0xB7BC,0xDCCC,0xC660,0xC661,0xDCC6, +0xDCBF,0xC7DB,0xC662,0xC663,0xC664,0xD1BF,0xDCC0,0xC665, +0xC666,0xDCCA,0xC667,0xC668,0xDCD0,0xC669,0xC66A,0xCEAD, +0xDCC2,0xC66B,0xDCC3,0xDCC8,0xDCC9,0xB2D4,0xDCD1,0xCBD5, +0xC66C,0xD4B7,0xDCDB,0xDCDF,0xCCA6,0xDCE6,0xC66D,0xC3E7, +0xDCDC,0xC66E,0xC66F,0xBFC1,0xDCD9,0xC670,0xB0FA,0xB9B6, +0xDCE5,0xDCD3,0xC671,0xDCC4,0xDCD6,0xC8F4,0xBFE0,0xC672, +0xC673,0xC674,0xC675,0xC9BB,0xC676,0xC677,0xC678,0xB1BD, +0xC679,0xD3A2,0xC67A,0xC67B,0xDCDA,0xC67C,0xC67D,0xDCD5, +0xC67E,0xC6BB,0xC680,0xDCDE,0xC681,0xC682,0xC683,0xC684, +0xC685,0xD7C2,0xC3AF,0xB7B6,0xC7D1,0xC3A9,0xDCE2,0xDCD8, +0xDCEB,0xDCD4,0xC686,0xC687,0xDCDD,0xC688,0xBEA5,0xDCD7, +0xC689,0xDCE0,0xC68A,0xC68B,0xDCE3,0xDCE4,0xC68C,0xDCF8, +0xC68D,0xC68E,0xDCE1,0xDDA2,0xDCE7,0xC68F,0xC690,0xC691, +0xC692,0xC693,0xC694,0xC695,0xC696,0xC697,0xC698,0xBCEB, +0xB4C4,0xC699,0xC69A,0xC3A3,0xB2E7,0xDCFA,0xC69B,0xDCF2, +0xC69C,0xDCEF,0xC69D,0xDCFC,0xDCEE,0xD2F0,0xB2E8,0xC69E, +0xC8D7,0xC8E3,0xDCFB,0xC69F,0xDCED,0xC6A0,0xC740,0xC741, +0xDCF7,0xC742,0xC743,0xDCF5,0xC744,0xC745,0xBEA3,0xDCF4, +0xC746,0xB2DD,0xC747,0xC748,0xC749,0xC74A,0xC74B,0xDCF3, +0xBCF6,0xDCE8,0xBBC4,0xC74C,0xC0F3,0xC74D,0xC74E,0xC74F, +0xC750,0xC751,0xBCD4,0xDCE9,0xDCEA,0xC752,0xDCF1,0xDCF6, +0xDCF9,0xB5B4,0xC753,0xC8D9,0xBBE7,0xDCFE,0xDCFD,0xD3AB, +0xDDA1,0xDDA3,0xDDA5,0xD2F1,0xDDA4,0xDDA6,0xDDA7,0xD2A9, +0xC754,0xC755,0xC756,0xC757,0xC758,0xC759,0xC75A,0xBAC9, +0xDDA9,0xC75B,0xC75C,0xDDB6,0xDDB1,0xDDB4,0xC75D,0xC75E, +0xC75F,0xC760,0xC761,0xC762,0xC763,0xDDB0,0xC6CE,0xC764, +0xC765,0xC0F2,0xC766,0xC767,0xC768,0xC769,0xC9AF,0xC76A, +0xC76B,0xC76C,0xDCEC,0xDDAE,0xC76D,0xC76E,0xC76F,0xC770, +0xDDB7,0xC771,0xC772,0xDCF0,0xDDAF,0xC773,0xDDB8,0xC774, +0xDDAC,0xC775,0xC776,0xC777,0xC778,0xC779,0xC77A,0xC77B, +0xDDB9,0xDDB3,0xDDAD,0xC4AA,0xC77C,0xC77D,0xC77E,0xC780, +0xDDA8,0xC0B3,0xC1AB,0xDDAA,0xDDAB,0xC781,0xDDB2,0xBBF1, +0xDDB5,0xD3A8,0xDDBA,0xC782,0xDDBB,0xC3A7,0xC783,0xC784, +0xDDD2,0xDDBC,0xC785,0xC786,0xC787,0xDDD1,0xC788,0xB9BD, +0xC789,0xC78A,0xBED5,0xC78B,0xBEFA,0xC78C,0xC78D,0xBACA, +0xC78E,0xC78F,0xC790,0xC791,0xDDCA,0xC792,0xDDC5,0xC793, +0xDDBF,0xC794,0xC795,0xC796,0xB2CB,0xDDC3,0xC797,0xDDCB, +0xB2A4,0xDDD5,0xC798,0xC799,0xC79A,0xDDBE,0xC79B,0xC79C, +0xC79D,0xC6D0,0xDDD0,0xC79E,0xC79F,0xC7A0,0xC840,0xC841, +0xDDD4,0xC1E2,0xB7C6,0xC842,0xC843,0xC844,0xC845,0xC846, +0xDDCE,0xDDCF,0xC847,0xC848,0xC849,0xDDC4,0xC84A,0xC84B, +0xC84C,0xDDBD,0xC84D,0xDDCD,0xCCD1,0xC84E,0xDDC9,0xC84F, +0xC850,0xC851,0xC852,0xDDC2,0xC3C8,0xC6BC,0xCEAE,0xDDCC, +0xC853,0xDDC8,0xC854,0xC855,0xC856,0xC857,0xC858,0xC859, +0xDDC1,0xC85A,0xC85B,0xC85C,0xDDC6,0xC2DC,0xC85D,0xC85E, +0xC85F,0xC860,0xC861,0xC862,0xD3A9,0xD3AA,0xDDD3,0xCFF4, +0xC8F8,0xC863,0xC864,0xC865,0xC866,0xC867,0xC868,0xC869, +0xC86A,0xDDE6,0xC86B,0xC86C,0xC86D,0xC86E,0xC86F,0xC870, +0xDDC7,0xC871,0xC872,0xC873,0xDDE0,0xC2E4,0xC874,0xC875, +0xC876,0xC877,0xC878,0xC879,0xC87A,0xC87B,0xDDE1,0xC87C, +0xC87D,0xC87E,0xC880,0xC881,0xC882,0xC883,0xC884,0xC885, +0xC886,0xDDD7,0xC887,0xC888,0xC889,0xC88A,0xC88B,0xD6F8, +0xC88C,0xDDD9,0xDDD8,0xB8F0,0xDDD6,0xC88D,0xC88E,0xC88F, +0xC890,0xC6CF,0xC891,0xB6AD,0xC892,0xC893,0xC894,0xC895, +0xC896,0xDDE2,0xC897,0xBAF9,0xD4E1,0xDDE7,0xC898,0xC899, +0xC89A,0xB4D0,0xC89B,0xDDDA,0xC89C,0xBFFB,0xDDE3,0xC89D, +0xDDDF,0xC89E,0xDDDD,0xC89F,0xC8A0,0xC940,0xC941,0xC942, +0xC943,0xC944,0xB5D9,0xC945,0xC946,0xC947,0xC948,0xDDDB, +0xDDDC,0xDDDE,0xC949,0xBDAF,0xDDE4,0xC94A,0xDDE5,0xC94B, +0xC94C,0xC94D,0xC94E,0xC94F,0xC950,0xC951,0xC952,0xDDF5, +0xC953,0xC3C9,0xC954,0xC955,0xCBE2,0xC956,0xC957,0xC958, +0xC959,0xDDF2,0xC95A,0xC95B,0xC95C,0xC95D,0xC95E,0xC95F, +0xC960,0xC961,0xC962,0xC963,0xC964,0xC965,0xC966,0xD8E1, +0xC967,0xC968,0xC6D1,0xC969,0xDDF4,0xC96A,0xC96B,0xC96C, +0xD5F4,0xDDF3,0xDDF0,0xC96D,0xC96E,0xDDEC,0xC96F,0xDDEF, +0xC970,0xDDE8,0xC971,0xC972,0xD0EE,0xC973,0xC974,0xC975, +0xC976,0xC8D8,0xDDEE,0xC977,0xC978,0xDDE9,0xC979,0xC97A, +0xDDEA,0xCBF2,0xC97B,0xDDED,0xC97C,0xC97D,0xB1CD,0xC97E, +0xC980,0xC981,0xC982,0xC983,0xC984,0xC0B6,0xC985,0xBCBB, +0xDDF1,0xC986,0xC987,0xDDF7,0xC988,0xDDF6,0xDDEB,0xC989, +0xC98A,0xC98B,0xC98C,0xC98D,0xC5EE,0xC98E,0xC98F,0xC990, +0xDDFB,0xC991,0xC992,0xC993,0xC994,0xC995,0xC996,0xC997, +0xC998,0xC999,0xC99A,0xC99B,0xDEA4,0xC99C,0xC99D,0xDEA3, +0xC99E,0xC99F,0xC9A0,0xCA40,0xCA41,0xCA42,0xCA43,0xCA44, +0xCA45,0xCA46,0xCA47,0xCA48,0xDDF8,0xCA49,0xCA4A,0xCA4B, +0xCA4C,0xC3EF,0xCA4D,0xC2FB,0xCA4E,0xCA4F,0xCA50,0xD5E1, +0xCA51,0xCA52,0xCEB5,0xCA53,0xCA54,0xCA55,0xCA56,0xDDFD, +0xCA57,0xB2CC,0xCA58,0xCA59,0xCA5A,0xCA5B,0xCA5C,0xCA5D, +0xCA5E,0xCA5F,0xCA60,0xC4E8,0xCADF,0xCA61,0xCA62,0xCA63, +0xCA64,0xCA65,0xCA66,0xCA67,0xCA68,0xCA69,0xCA6A,0xC7BE, +0xDDFA,0xDDFC,0xDDFE,0xDEA2,0xB0AA,0xB1CE,0xCA6B,0xCA6C, +0xCA6D,0xCA6E,0xCA6F,0xDEAC,0xCA70,0xCA71,0xCA72,0xCA73, +0xDEA6,0xBDB6,0xC8EF,0xCA74,0xCA75,0xCA76,0xCA77,0xCA78, +0xCA79,0xCA7A,0xCA7B,0xCA7C,0xCA7D,0xCA7E,0xDEA1,0xCA80, +0xCA81,0xDEA5,0xCA82,0xCA83,0xCA84,0xCA85,0xDEA9,0xCA86, +0xCA87,0xCA88,0xCA89,0xCA8A,0xDEA8,0xCA8B,0xCA8C,0xCA8D, +0xDEA7,0xCA8E,0xCA8F,0xCA90,0xCA91,0xCA92,0xCA93,0xCA94, +0xCA95,0xCA96,0xDEAD,0xCA97,0xD4CC,0xCA98,0xCA99,0xCA9A, +0xCA9B,0xDEB3,0xDEAA,0xDEAE,0xCA9C,0xCA9D,0xC0D9,0xCA9E, +0xCA9F,0xCAA0,0xCB40,0xCB41,0xB1A1,0xDEB6,0xCB42,0xDEB1, +0xCB43,0xCB44,0xCB45,0xCB46,0xCB47,0xCB48,0xCB49,0xDEB2, +0xCB4A,0xCB4B,0xCB4C,0xCB4D,0xCB4E,0xCB4F,0xCB50,0xCB51, +0xCB52,0xCB53,0xCB54,0xD1A6,0xDEB5,0xCB55,0xCB56,0xCB57, +0xCB58,0xCB59,0xCB5A,0xCB5B,0xDEAF,0xCB5C,0xCB5D,0xCB5E, +0xDEB0,0xCB5F,0xD0BD,0xCB60,0xCB61,0xCB62,0xDEB4,0xCAED, +0xDEB9,0xCB63,0xCB64,0xCB65,0xCB66,0xCB67,0xCB68,0xDEB8, +0xCB69,0xDEB7,0xCB6A,0xCB6B,0xCB6C,0xCB6D,0xCB6E,0xCB6F, +0xCB70,0xDEBB,0xCB71,0xCB72,0xCB73,0xCB74,0xCB75,0xCB76, +0xCB77,0xBDE5,0xCB78,0xCB79,0xCB7A,0xCB7B,0xCB7C,0xB2D8, +0xC3EA,0xCB7D,0xCB7E,0xDEBA,0xCB80,0xC5BA,0xCB81,0xCB82, +0xCB83,0xCB84,0xCB85,0xCB86,0xDEBC,0xCB87,0xCB88,0xCB89, +0xCB8A,0xCB8B,0xCB8C,0xCB8D,0xCCD9,0xCB8E,0xCB8F,0xCB90, +0xCB91,0xB7AA,0xCB92,0xCB93,0xCB94,0xCB95,0xCB96,0xCB97, +0xCB98,0xCB99,0xCB9A,0xCB9B,0xCB9C,0xCB9D,0xCB9E,0xCB9F, +0xCBA0,0xCC40,0xCC41,0xD4E5,0xCC42,0xCC43,0xCC44,0xDEBD, +0xCC45,0xCC46,0xCC47,0xCC48,0xCC49,0xDEBF,0xCC4A,0xCC4B, +0xCC4C,0xCC4D,0xCC4E,0xCC4F,0xCC50,0xCC51,0xCC52,0xCC53, +0xCC54,0xC4A2,0xCC55,0xCC56,0xCC57,0xCC58,0xDEC1,0xCC59, +0xCC5A,0xCC5B,0xCC5C,0xCC5D,0xCC5E,0xCC5F,0xCC60,0xCC61, +0xCC62,0xCC63,0xCC64,0xCC65,0xCC66,0xCC67,0xCC68,0xDEBE, +0xCC69,0xDEC0,0xCC6A,0xCC6B,0xCC6C,0xCC6D,0xCC6E,0xCC6F, +0xCC70,0xCC71,0xCC72,0xCC73,0xCC74,0xCC75,0xCC76,0xCC77, +0xD5BA,0xCC78,0xCC79,0xCC7A,0xDEC2,0xCC7B,0xCC7C,0xCC7D, +0xCC7E,0xCC80,0xCC81,0xCC82,0xCC83,0xCC84,0xCC85,0xCC86, +0xCC87,0xCC88,0xCC89,0xCC8A,0xCC8B,0xF2AE,0xBBA2,0xC2B2, +0xC5B0,0xC2C7,0xCC8C,0xCC8D,0xF2AF,0xCC8E,0xCC8F,0xCC90, +0xCC91,0xCC92,0xD0E9,0xCC93,0xCC94,0xCC95,0xD3DD,0xCC96, +0xCC97,0xCC98,0xEBBD,0xCC99,0xCC9A,0xCC9B,0xCC9C,0xCC9D, +0xCC9E,0xCC9F,0xCCA0,0xB3E6,0xF2B0,0xCD40,0xF2B1,0xCD41, +0xCD42,0xCAAD,0xCD43,0xCD44,0xCD45,0xCD46,0xCD47,0xCD48, +0xCD49,0xBAE7,0xF2B3,0xF2B5,0xF2B4,0xCBE4,0xCFBA,0xF2B2, +0xCAB4,0xD2CF,0xC2EC,0xCD4A,0xCD4B,0xCD4C,0xCD4D,0xCD4E, +0xCD4F,0xCD50,0xCEC3,0xF2B8,0xB0F6,0xF2B7,0xCD51,0xCD52, +0xCD53,0xCD54,0xCD55,0xF2BE,0xCD56,0xB2CF,0xCD57,0xCD58, +0xCD59,0xCD5A,0xCD5B,0xCD5C,0xD1C1,0xF2BA,0xCD5D,0xCD5E, +0xCD5F,0xCD60,0xCD61,0xF2BC,0xD4E9,0xCD62,0xCD63,0xF2BB, +0xF2B6,0xF2BF,0xF2BD,0xCD64,0xF2B9,0xCD65,0xCD66,0xF2C7, +0xF2C4,0xF2C6,0xCD67,0xCD68,0xF2CA,0xF2C2,0xF2C0,0xCD69, +0xCD6A,0xCD6B,0xF2C5,0xCD6C,0xCD6D,0xCD6E,0xCD6F,0xCD70, +0xD6FB,0xCD71,0xCD72,0xCD73,0xF2C1,0xCD74,0xC7F9,0xC9DF, +0xCD75,0xF2C8,0xB9C6,0xB5B0,0xCD76,0xCD77,0xF2C3,0xF2C9, +0xF2D0,0xF2D6,0xCD78,0xCD79,0xBBD7,0xCD7A,0xCD7B,0xCD7C, +0xF2D5,0xCDDC,0xCD7D,0xD6EB,0xCD7E,0xCD80,0xF2D2,0xF2D4, +0xCD81,0xCD82,0xCD83,0xCD84,0xB8F2,0xCD85,0xCD86,0xCD87, +0xCD88,0xF2CB,0xCD89,0xCD8A,0xCD8B,0xF2CE,0xC2F9,0xCD8C, +0xD5DD,0xF2CC,0xF2CD,0xF2CF,0xF2D3,0xCD8D,0xCD8E,0xCD8F, +0xF2D9,0xD3BC,0xCD90,0xCD91,0xCD92,0xCD93,0xB6EA,0xCD94, +0xCAF1,0xCD95,0xB7E4,0xF2D7,0xCD96,0xCD97,0xCD98,0xF2D8, +0xF2DA,0xF2DD,0xF2DB,0xCD99,0xCD9A,0xF2DC,0xCD9B,0xCD9C, +0xCD9D,0xCD9E,0xD1D1,0xF2D1,0xCD9F,0xCDC9,0xCDA0,0xCECF, +0xD6A9,0xCE40,0xF2E3,0xCE41,0xC3DB,0xCE42,0xF2E0,0xCE43, +0xCE44,0xC0AF,0xF2EC,0xF2DE,0xCE45,0xF2E1,0xCE46,0xCE47, +0xCE48,0xF2E8,0xCE49,0xCE4A,0xCE4B,0xCE4C,0xF2E2,0xCE4D, +0xCE4E,0xF2E7,0xCE4F,0xCE50,0xF2E6,0xCE51,0xCE52,0xF2E9, +0xCE53,0xCE54,0xCE55,0xF2DF,0xCE56,0xCE57,0xF2E4,0xF2EA, +0xCE58,0xCE59,0xCE5A,0xCE5B,0xCE5C,0xCE5D,0xCE5E,0xD3AC, +0xF2E5,0xB2F5,0xCE5F,0xCE60,0xF2F2,0xCE61,0xD0AB,0xCE62, +0xCE63,0xCE64,0xCE65,0xF2F5,0xCE66,0xCE67,0xCE68,0xBBC8, +0xCE69,0xF2F9,0xCE6A,0xCE6B,0xCE6C,0xCE6D,0xCE6E,0xCE6F, +0xF2F0,0xCE70,0xCE71,0xF2F6,0xF2F8,0xF2FA,0xCE72,0xCE73, +0xCE74,0xCE75,0xCE76,0xCE77,0xCE78,0xCE79,0xF2F3,0xCE7A, +0xF2F1,0xCE7B,0xCE7C,0xCE7D,0xBAFB,0xCE7E,0xB5FB,0xCE80, +0xCE81,0xCE82,0xCE83,0xF2EF,0xF2F7,0xF2ED,0xF2EE,0xCE84, +0xCE85,0xCE86,0xF2EB,0xF3A6,0xCE87,0xF3A3,0xCE88,0xCE89, +0xF3A2,0xCE8A,0xCE8B,0xF2F4,0xCE8C,0xC8DA,0xCE8D,0xCE8E, +0xCE8F,0xCE90,0xCE91,0xF2FB,0xCE92,0xCE93,0xCE94,0xF3A5, +0xCE95,0xCE96,0xCE97,0xCE98,0xCE99,0xCE9A,0xCE9B,0xC3F8, +0xCE9C,0xCE9D,0xCE9E,0xCE9F,0xCEA0,0xCF40,0xCF41,0xCF42, +0xF2FD,0xCF43,0xCF44,0xF3A7,0xF3A9,0xF3A4,0xCF45,0xF2FC, +0xCF46,0xCF47,0xCF48,0xF3AB,0xCF49,0xF3AA,0xCF4A,0xCF4B, +0xCF4C,0xCF4D,0xC2DD,0xCF4E,0xCF4F,0xF3AE,0xCF50,0xCF51, +0xF3B0,0xCF52,0xCF53,0xCF54,0xCF55,0xCF56,0xF3A1,0xCF57, +0xCF58,0xCF59,0xF3B1,0xF3AC,0xCF5A,0xCF5B,0xCF5C,0xCF5D, +0xCF5E,0xF3AF,0xF2FE,0xF3AD,0xCF5F,0xCF60,0xCF61,0xCF62, +0xCF63,0xCF64,0xCF65,0xF3B2,0xCF66,0xCF67,0xCF68,0xCF69, +0xF3B4,0xCF6A,0xCF6B,0xCF6C,0xCF6D,0xF3A8,0xCF6E,0xCF6F, +0xCF70,0xCF71,0xF3B3,0xCF72,0xCF73,0xCF74,0xF3B5,0xCF75, +0xCF76,0xCF77,0xCF78,0xCF79,0xCF7A,0xCF7B,0xCF7C,0xCF7D, +0xCF7E,0xD0B7,0xCF80,0xCF81,0xCF82,0xCF83,0xF3B8,0xCF84, +0xCF85,0xCF86,0xCF87,0xD9F9,0xCF88,0xCF89,0xCF8A,0xCF8B, +0xCF8C,0xCF8D,0xF3B9,0xCF8E,0xCF8F,0xCF90,0xCF91,0xCF92, +0xCF93,0xCF94,0xCF95,0xF3B7,0xCF96,0xC8E4,0xF3B6,0xCF97, +0xCF98,0xCF99,0xCF9A,0xF3BA,0xCF9B,0xCF9C,0xCF9D,0xCF9E, +0xCF9F,0xF3BB,0xB4C0,0xCFA0,0xD040,0xD041,0xD042,0xD043, +0xD044,0xD045,0xD046,0xD047,0xD048,0xD049,0xD04A,0xD04B, +0xD04C,0xD04D,0xEEC3,0xD04E,0xD04F,0xD050,0xD051,0xD052, +0xD053,0xF3BC,0xD054,0xD055,0xF3BD,0xD056,0xD057,0xD058, +0xD1AA,0xD059,0xD05A,0xD05B,0xF4AC,0xD0C6,0xD05C,0xD05D, +0xD05E,0xD05F,0xD060,0xD061,0xD0D0,0xD1DC,0xD062,0xD063, +0xD064,0xD065,0xD066,0xD067,0xCFCE,0xD068,0xD069,0xBDD6, +0xD06A,0xD1C3,0xD06B,0xD06C,0xD06D,0xD06E,0xD06F,0xD070, +0xD071,0xBAE2,0xE1E9,0xD2C2,0xF1C2,0xB2B9,0xD072,0xD073, +0xB1ED,0xF1C3,0xD074,0xC9C0,0xB3C4,0xD075,0xD9F2,0xD076, +0xCBA5,0xD077,0xF1C4,0xD078,0xD079,0xD07A,0xD07B,0xD6D4, +0xD07C,0xD07D,0xD07E,0xD080,0xD081,0xF1C5,0xF4C0,0xF1C6, +0xD082,0xD4AC,0xF1C7,0xD083,0xB0C0,0xF4C1,0xD084,0xD085, +0xF4C2,0xD086,0xD087,0xB4FC,0xD088,0xC5DB,0xD089,0xD08A, +0xD08B,0xD08C,0xCCBB,0xD08D,0xD08E,0xD08F,0xD0E4,0xD090, +0xD091,0xD092,0xD093,0xD094,0xCDE0,0xD095,0xD096,0xD097, +0xD098,0xD099,0xF1C8,0xD09A,0xD9F3,0xD09B,0xD09C,0xD09D, +0xD09E,0xD09F,0xD0A0,0xB1BB,0xD140,0xCFAE,0xD141,0xD142, +0xD143,0xB8A4,0xD144,0xD145,0xD146,0xD147,0xD148,0xF1CA, +0xD149,0xD14A,0xD14B,0xD14C,0xF1CB,0xD14D,0xD14E,0xD14F, +0xD150,0xB2C3,0xC1D1,0xD151,0xD152,0xD7B0,0xF1C9,0xD153, +0xD154,0xF1CC,0xD155,0xD156,0xD157,0xD158,0xF1CE,0xD159, +0xD15A,0xD15B,0xD9F6,0xD15C,0xD2E1,0xD4A3,0xD15D,0xD15E, +0xF4C3,0xC8B9,0xD15F,0xD160,0xD161,0xD162,0xD163,0xF4C4, +0xD164,0xD165,0xF1CD,0xF1CF,0xBFE3,0xF1D0,0xD166,0xD167, +0xF1D4,0xD168,0xD169,0xD16A,0xD16B,0xD16C,0xD16D,0xD16E, +0xF1D6,0xF1D1,0xD16F,0xC9D1,0xC5E1,0xD170,0xD171,0xD172, +0xC2E3,0xB9FC,0xD173,0xD174,0xF1D3,0xD175,0xF1D5,0xD176, +0xD177,0xD178,0xB9D3,0xD179,0xD17A,0xD17B,0xD17C,0xD17D, +0xD17E,0xD180,0xF1DB,0xD181,0xD182,0xD183,0xD184,0xD185, +0xBAD6,0xD186,0xB0FD,0xF1D9,0xD187,0xD188,0xD189,0xD18A, +0xD18B,0xF1D8,0xF1D2,0xF1DA,0xD18C,0xD18D,0xD18E,0xD18F, +0xD190,0xF1D7,0xD191,0xD192,0xD193,0xC8EC,0xD194,0xD195, +0xD196,0xD197,0xCDCA,0xF1DD,0xD198,0xD199,0xD19A,0xD19B, +0xE5BD,0xD19C,0xD19D,0xD19E,0xF1DC,0xD19F,0xF1DE,0xD1A0, +0xD240,0xD241,0xD242,0xD243,0xD244,0xD245,0xD246,0xD247, +0xD248,0xF1DF,0xD249,0xD24A,0xCFE5,0xD24B,0xD24C,0xD24D, +0xD24E,0xD24F,0xD250,0xD251,0xD252,0xD253,0xD254,0xD255, +0xD256,0xD257,0xD258,0xD259,0xD25A,0xD25B,0xD25C,0xD25D, +0xD25E,0xD25F,0xD260,0xD261,0xD262,0xD263,0xF4C5,0xBDF3, +0xD264,0xD265,0xD266,0xD267,0xD268,0xD269,0xF1E0,0xD26A, +0xD26B,0xD26C,0xD26D,0xD26E,0xD26F,0xD270,0xD271,0xD272, +0xD273,0xD274,0xD275,0xD276,0xD277,0xD278,0xD279,0xD27A, +0xD27B,0xD27C,0xD27D,0xF1E1,0xD27E,0xD280,0xD281,0xCEF7, +0xD282,0xD2AA,0xD283,0xF1FB,0xD284,0xD285,0xB8B2,0xD286, +0xD287,0xD288,0xD289,0xD28A,0xD28B,0xD28C,0xD28D,0xD28E, +0xD28F,0xD290,0xD291,0xD292,0xD293,0xD294,0xD295,0xD296, +0xD297,0xD298,0xD299,0xD29A,0xD29B,0xD29C,0xD29D,0xD29E, +0xD29F,0xD2A0,0xD340,0xD341,0xD342,0xD343,0xD344,0xD345, +0xD346,0xD347,0xD348,0xD349,0xD34A,0xD34B,0xD34C,0xD34D, +0xD34E,0xD34F,0xD350,0xD351,0xD352,0xD353,0xD354,0xD355, +0xD356,0xD357,0xD358,0xD359,0xD35A,0xD35B,0xD35C,0xD35D, +0xD35E,0xBCFB,0xB9DB,0xD35F,0xB9E6,0xC3D9,0xCAD3,0xEAE8, +0xC0C0,0xBEF5,0xEAE9,0xEAEA,0xEAEB,0xD360,0xEAEC,0xEAED, +0xEAEE,0xEAEF,0xBDC7,0xD361,0xD362,0xD363,0xF5FB,0xD364, +0xD365,0xD366,0xF5FD,0xD367,0xF5FE,0xD368,0xF5FC,0xD369, +0xD36A,0xD36B,0xD36C,0xBDE2,0xD36D,0xF6A1,0xB4A5,0xD36E, +0xD36F,0xD370,0xD371,0xF6A2,0xD372,0xD373,0xD374,0xF6A3, +0xD375,0xD376,0xD377,0xECB2,0xD378,0xD379,0xD37A,0xD37B, +0xD37C,0xD37D,0xD37E,0xD380,0xD381,0xD382,0xD383,0xD384, +0xD1D4,0xD385,0xD386,0xD387,0xD388,0xD389,0xD38A,0xD9EA, +0xD38B,0xD38C,0xD38D,0xD38E,0xD38F,0xD390,0xD391,0xD392, +0xD393,0xD394,0xD395,0xD396,0xD397,0xD398,0xD399,0xD39A, +0xD39B,0xD39C,0xD39D,0xD39E,0xD39F,0xD3A0,0xD440,0xD441, +0xD442,0xD443,0xD444,0xD445,0xD446,0xD447,0xD448,0xD449, +0xD44A,0xD44B,0xD44C,0xD44D,0xD44E,0xD44F,0xD450,0xD451, +0xD452,0xD453,0xD454,0xD455,0xD456,0xD457,0xD458,0xD459, +0xD45A,0xD45B,0xD45C,0xD45D,0xD45E,0xD45F,0xF6A4,0xD460, +0xD461,0xD462,0xD463,0xD464,0xD465,0xD466,0xD467,0xD468, +0xEEBA,0xD469,0xD46A,0xD46B,0xD46C,0xD46D,0xD46E,0xD46F, +0xD470,0xD471,0xD472,0xD473,0xD474,0xD475,0xD476,0xD477, +0xD478,0xD479,0xD47A,0xD47B,0xD47C,0xD47D,0xD47E,0xD480, +0xD481,0xD482,0xD483,0xD484,0xD485,0xD486,0xD487,0xD488, +0xD489,0xD48A,0xD48B,0xD48C,0xD48D,0xD48E,0xD48F,0xD490, +0xD491,0xD492,0xD493,0xD494,0xD495,0xD496,0xD497,0xD498, +0xD499,0xD5B2,0xD49A,0xD49B,0xD49C,0xD49D,0xD49E,0xD49F, +0xD4A0,0xD540,0xD541,0xD542,0xD543,0xD544,0xD545,0xD546, +0xD547,0xD3FE,0xCCDC,0xD548,0xD549,0xD54A,0xD54B,0xD54C, +0xD54D,0xD54E,0xD54F,0xCAC4,0xD550,0xD551,0xD552,0xD553, +0xD554,0xD555,0xD556,0xD557,0xD558,0xD559,0xD55A,0xD55B, +0xD55C,0xD55D,0xD55E,0xD55F,0xD560,0xD561,0xD562,0xD563, +0xD564,0xD565,0xD566,0xD567,0xD568,0xD569,0xD56A,0xD56B, +0xD56C,0xD56D,0xD56E,0xD56F,0xD570,0xD571,0xD572,0xD573, +0xD574,0xD575,0xD576,0xD577,0xD578,0xD579,0xD57A,0xD57B, +0xD57C,0xD57D,0xD57E,0xD580,0xD581,0xD582,0xD583,0xD584, +0xD585,0xD586,0xD587,0xD588,0xD589,0xD58A,0xD58B,0xD58C, +0xD58D,0xD58E,0xD58F,0xD590,0xD591,0xD592,0xD593,0xD594, +0xD595,0xD596,0xD597,0xD598,0xD599,0xD59A,0xD59B,0xD59C, +0xD59D,0xD59E,0xD59F,0xD5A0,0xD640,0xD641,0xD642,0xD643, +0xD644,0xD645,0xD646,0xD647,0xD648,0xD649,0xD64A,0xD64B, +0xD64C,0xD64D,0xD64E,0xD64F,0xD650,0xD651,0xD652,0xD653, +0xD654,0xD655,0xD656,0xD657,0xD658,0xD659,0xD65A,0xD65B, +0xD65C,0xD65D,0xD65E,0xD65F,0xD660,0xD661,0xD662,0xE5C0, +0xD663,0xD664,0xD665,0xD666,0xD667,0xD668,0xD669,0xD66A, +0xD66B,0xD66C,0xD66D,0xD66E,0xD66F,0xD670,0xD671,0xD672, +0xD673,0xD674,0xD675,0xD676,0xD677,0xD678,0xD679,0xD67A, +0xD67B,0xD67C,0xD67D,0xD67E,0xD680,0xD681,0xF6A5,0xD682, +0xD683,0xD684,0xD685,0xD686,0xD687,0xD688,0xD689,0xD68A, +0xD68B,0xD68C,0xD68D,0xD68E,0xD68F,0xD690,0xD691,0xD692, +0xD693,0xD694,0xD695,0xD696,0xD697,0xD698,0xD699,0xD69A, +0xD69B,0xD69C,0xD69D,0xD69E,0xD69F,0xD6A0,0xD740,0xD741, +0xD742,0xD743,0xD744,0xD745,0xD746,0xD747,0xD748,0xD749, +0xD74A,0xD74B,0xD74C,0xD74D,0xD74E,0xD74F,0xD750,0xD751, +0xD752,0xD753,0xD754,0xD755,0xD756,0xD757,0xD758,0xD759, +0xD75A,0xD75B,0xD75C,0xD75D,0xD75E,0xD75F,0xBEAF,0xD760, +0xD761,0xD762,0xD763,0xD764,0xC6A9,0xD765,0xD766,0xD767, +0xD768,0xD769,0xD76A,0xD76B,0xD76C,0xD76D,0xD76E,0xD76F, +0xD770,0xD771,0xD772,0xD773,0xD774,0xD775,0xD776,0xD777, +0xD778,0xD779,0xD77A,0xD77B,0xD77C,0xD77D,0xD77E,0xD780, +0xD781,0xD782,0xD783,0xD784,0xD785,0xD786,0xD787,0xD788, +0xD789,0xD78A,0xD78B,0xD78C,0xD78D,0xD78E,0xD78F,0xD790, +0xD791,0xD792,0xD793,0xD794,0xD795,0xD796,0xD797,0xD798, +0xDAA5,0xBCC6,0xB6A9,0xB8BC,0xC8CF,0xBCA5,0xDAA6,0xDAA7, +0xCCD6,0xC8C3,0xDAA8,0xC6FD,0xD799,0xD1B5,0xD2E9,0xD1B6, +0xBCC7,0xD79A,0xBDB2,0xBBE4,0xDAA9,0xDAAA,0xD1C8,0xDAAB, +0xD0ED,0xB6EF,0xC2DB,0xD79B,0xCBCF,0xB7ED,0xC9E8,0xB7C3, +0xBEF7,0xD6A4,0xDAAC,0xDAAD,0xC6C0,0xD7E7,0xCAB6,0xD79C, +0xD5A9,0xCBDF,0xD5EF,0xDAAE,0xD6DF,0xB4CA,0xDAB0,0xDAAF, +0xD79D,0xD2EB,0xDAB1,0xDAB2,0xDAB3,0xCAD4,0xDAB4,0xCAAB, +0xDAB5,0xDAB6,0xB3CF,0xD6EF,0xDAB7,0xBBB0,0xB5AE,0xDAB8, +0xDAB9,0xB9EE,0xD1AF,0xD2E8,0xDABA,0xB8C3,0xCFEA,0xB2EF, +0xDABB,0xDABC,0xD79E,0xBDEB,0xCEDC,0xD3EF,0xDABD,0xCEF3, +0xDABE,0xD3D5,0xBBE5,0xDABF,0xCBB5,0xCBD0,0xDAC0,0xC7EB, +0xD6EE,0xDAC1,0xC5B5,0xB6C1,0xDAC2,0xB7CC,0xBFCE,0xDAC3, +0xDAC4,0xCBAD,0xDAC5,0xB5F7,0xDAC6,0xC1C2,0xD7BB,0xDAC7, +0xCCB8,0xD79F,0xD2EA,0xC4B1,0xDAC8,0xB5FD,0xBBD1,0xDAC9, +0xD0B3,0xDACA,0xDACB,0xCEBD,0xDACC,0xDACD,0xDACE,0xB2F7, +0xDAD1,0xDACF,0xD1E8,0xDAD0,0xC3D5,0xDAD2,0xD7A0,0xDAD3, +0xDAD4,0xDAD5,0xD0BB,0xD2A5,0xB0F9,0xDAD6,0xC7AB,0xDAD7, +0xBDF7,0xC3A1,0xDAD8,0xDAD9,0xC3FD,0xCCB7,0xDADA,0xDADB, +0xC0BE,0xC6D7,0xDADC,0xDADD,0xC7B4,0xDADE,0xDADF,0xB9C8, +0xD840,0xD841,0xD842,0xD843,0xD844,0xD845,0xD846,0xD847, +0xD848,0xBBED,0xD849,0xD84A,0xD84B,0xD84C,0xB6B9,0xF4F8, +0xD84D,0xF4F9,0xD84E,0xD84F,0xCDE3,0xD850,0xD851,0xD852, +0xD853,0xD854,0xD855,0xD856,0xD857,0xF5B9,0xD858,0xD859, +0xD85A,0xD85B,0xEBE0,0xD85C,0xD85D,0xD85E,0xD85F,0xD860, +0xD861,0xCFF3,0xBBBF,0xD862,0xD863,0xD864,0xD865,0xD866, +0xD867,0xD868,0xBAC0,0xD4A5,0xD869,0xD86A,0xD86B,0xD86C, +0xD86D,0xD86E,0xD86F,0xE1D9,0xD870,0xD871,0xD872,0xD873, +0xF5F4,0xB1AA,0xB2F2,0xD874,0xD875,0xD876,0xD877,0xD878, +0xD879,0xD87A,0xF5F5,0xD87B,0xD87C,0xF5F7,0xD87D,0xD87E, +0xD880,0xBAD1,0xF5F6,0xD881,0xC3B2,0xD882,0xD883,0xD884, +0xD885,0xD886,0xD887,0xD888,0xF5F9,0xD889,0xD88A,0xD88B, +0xF5F8,0xD88C,0xD88D,0xD88E,0xD88F,0xD890,0xD891,0xD892, +0xD893,0xD894,0xD895,0xD896,0xD897,0xD898,0xD899,0xD89A, +0xD89B,0xD89C,0xD89D,0xD89E,0xD89F,0xD8A0,0xD940,0xD941, +0xD942,0xD943,0xD944,0xD945,0xD946,0xD947,0xD948,0xD949, +0xD94A,0xD94B,0xD94C,0xD94D,0xD94E,0xD94F,0xD950,0xD951, +0xD952,0xD953,0xD954,0xD955,0xD956,0xD957,0xD958,0xD959, +0xD95A,0xD95B,0xD95C,0xD95D,0xD95E,0xD95F,0xD960,0xD961, +0xD962,0xD963,0xD964,0xD965,0xD966,0xD967,0xD968,0xD969, +0xD96A,0xD96B,0xD96C,0xD96D,0xD96E,0xD96F,0xD970,0xD971, +0xD972,0xD973,0xD974,0xD975,0xD976,0xD977,0xD978,0xD979, +0xD97A,0xD97B,0xD97C,0xD97D,0xD97E,0xD980,0xD981,0xD982, +0xD983,0xD984,0xD985,0xD986,0xD987,0xD988,0xD989,0xD98A, +0xD98B,0xD98C,0xD98D,0xD98E,0xD98F,0xD990,0xD991,0xD992, +0xD993,0xD994,0xD995,0xD996,0xD997,0xD998,0xD999,0xD99A, +0xD99B,0xD99C,0xD99D,0xD99E,0xD99F,0xD9A0,0xDA40,0xDA41, +0xDA42,0xDA43,0xDA44,0xDA45,0xDA46,0xDA47,0xDA48,0xDA49, +0xDA4A,0xDA4B,0xDA4C,0xDA4D,0xDA4E,0xB1B4,0xD5EA,0xB8BA, +0xDA4F,0xB9B1,0xB2C6,0xD4F0,0xCFCD,0xB0DC,0xD5CB,0xBBF5, +0xD6CA,0xB7B7,0xCCB0,0xC6B6,0xB1E1,0xB9BA,0xD6FC,0xB9E1, +0xB7A1,0xBCFA,0xEADA,0xEADB,0xCCF9,0xB9F3,0xEADC,0xB4FB, +0xC3B3,0xB7D1,0xBAD8,0xEADD,0xD4F4,0xEADE,0xBCD6,0xBBDF, +0xEADF,0xC1DE,0xC2B8,0xD4DF,0xD7CA,0xEAE0,0xEAE1,0xEAE4, +0xEAE2,0xEAE3,0xC9DE,0xB8B3,0xB6C4,0xEAE5,0xCAEA,0xC9CD, +0xB4CD,0xDA50,0xDA51,0xE2D9,0xC5E2,0xEAE6,0xC0B5,0xDA52, +0xD7B8,0xEAE7,0xD7AC,0xC8FC,0xD8D3,0xD8CD,0xD4DE,0xDA53, +0xD4F9,0xC9C4,0xD3AE,0xB8D3,0xB3E0,0xDA54,0xC9E2,0xF4F6, +0xDA55,0xDA56,0xDA57,0xBAD5,0xDA58,0xF4F7,0xDA59,0xDA5A, +0xD7DF,0xDA5B,0xDA5C,0xF4F1,0xB8B0,0xD5D4,0xB8CF,0xC6F0, +0xDA5D,0xDA5E,0xDA5F,0xDA60,0xDA61,0xDA62,0xDA63,0xDA64, +0xDA65,0xB3C3,0xDA66,0xDA67,0xF4F2,0xB3AC,0xDA68,0xDA69, +0xDA6A,0xDA6B,0xD4BD,0xC7F7,0xDA6C,0xDA6D,0xDA6E,0xDA6F, +0xDA70,0xF4F4,0xDA71,0xDA72,0xF4F3,0xDA73,0xDA74,0xDA75, +0xDA76,0xDA77,0xDA78,0xDA79,0xDA7A,0xDA7B,0xDA7C,0xCCCB, +0xDA7D,0xDA7E,0xDA80,0xC8A4,0xDA81,0xDA82,0xDA83,0xDA84, +0xDA85,0xDA86,0xDA87,0xDA88,0xDA89,0xDA8A,0xDA8B,0xDA8C, +0xDA8D,0xF4F5,0xDA8E,0xD7E3,0xC5BF,0xF5C0,0xDA8F,0xDA90, +0xF5BB,0xDA91,0xF5C3,0xDA92,0xF5C2,0xDA93,0xD6BA,0xF5C1, +0xDA94,0xDA95,0xDA96,0xD4BE,0xF5C4,0xDA97,0xF5CC,0xDA98, +0xDA99,0xDA9A,0xDA9B,0xB0CF,0xB5F8,0xDA9C,0xF5C9,0xF5CA, +0xDA9D,0xC5DC,0xDA9E,0xDA9F,0xDAA0,0xDB40,0xF5C5,0xF5C6, +0xDB41,0xDB42,0xF5C7,0xF5CB,0xDB43,0xBEE0,0xF5C8,0xB8FA, +0xDB44,0xDB45,0xDB46,0xF5D0,0xF5D3,0xDB47,0xDB48,0xDB49, +0xBFE7,0xDB4A,0xB9F2,0xF5BC,0xF5CD,0xDB4B,0xDB4C,0xC2B7, +0xDB4D,0xDB4E,0xDB4F,0xCCF8,0xDB50,0xBCF9,0xDB51,0xF5CE, +0xF5CF,0xF5D1,0xB6E5,0xF5D2,0xDB52,0xF5D5,0xDB53,0xDB54, +0xDB55,0xDB56,0xDB57,0xDB58,0xDB59,0xF5BD,0xDB5A,0xDB5B, +0xDB5C,0xF5D4,0xD3BB,0xDB5D,0xB3EC,0xDB5E,0xDB5F,0xCCA4, +0xDB60,0xDB61,0xDB62,0xDB63,0xF5D6,0xDB64,0xDB65,0xDB66, +0xDB67,0xDB68,0xDB69,0xDB6A,0xDB6B,0xF5D7,0xBEE1,0xF5D8, +0xDB6C,0xDB6D,0xCCDF,0xF5DB,0xDB6E,0xDB6F,0xDB70,0xDB71, +0xDB72,0xB2C8,0xD7D9,0xDB73,0xF5D9,0xDB74,0xF5DA,0xF5DC, +0xDB75,0xF5E2,0xDB76,0xDB77,0xDB78,0xF5E0,0xDB79,0xDB7A, +0xDB7B,0xF5DF,0xF5DD,0xDB7C,0xDB7D,0xF5E1,0xDB7E,0xDB80, +0xF5DE,0xF5E4,0xF5E5,0xDB81,0xCCE3,0xDB82,0xDB83,0xE5BF, +0xB5B8,0xF5E3,0xF5E8,0xCCA3,0xDB84,0xDB85,0xDB86,0xDB87, +0xDB88,0xF5E6,0xF5E7,0xDB89,0xDB8A,0xDB8B,0xDB8C,0xDB8D, +0xDB8E,0xF5BE,0xDB8F,0xDB90,0xDB91,0xDB92,0xDB93,0xDB94, +0xDB95,0xDB96,0xDB97,0xDB98,0xDB99,0xDB9A,0xB1C4,0xDB9B, +0xDB9C,0xF5BF,0xDB9D,0xDB9E,0xB5C5,0xB2E4,0xDB9F,0xF5EC, +0xF5E9,0xDBA0,0xB6D7,0xDC40,0xF5ED,0xDC41,0xF5EA,0xDC42, +0xDC43,0xDC44,0xDC45,0xDC46,0xF5EB,0xDC47,0xDC48,0xB4DA, +0xDC49,0xD4EA,0xDC4A,0xDC4B,0xDC4C,0xF5EE,0xDC4D,0xB3F9, +0xDC4E,0xDC4F,0xDC50,0xDC51,0xDC52,0xDC53,0xDC54,0xF5EF, +0xF5F1,0xDC55,0xDC56,0xDC57,0xF5F0,0xDC58,0xDC59,0xDC5A, +0xDC5B,0xDC5C,0xDC5D,0xDC5E,0xF5F2,0xDC5F,0xF5F3,0xDC60, +0xDC61,0xDC62,0xDC63,0xDC64,0xDC65,0xDC66,0xDC67,0xDC68, +0xDC69,0xDC6A,0xDC6B,0xC9ED,0xB9AA,0xDC6C,0xDC6D,0xC7FB, +0xDC6E,0xDC6F,0xB6E3,0xDC70,0xDC71,0xDC72,0xDC73,0xDC74, +0xDC75,0xDC76,0xCCC9,0xDC77,0xDC78,0xDC79,0xDC7A,0xDC7B, +0xDC7C,0xDC7D,0xDC7E,0xDC80,0xDC81,0xDC82,0xDC83,0xDC84, +0xDC85,0xDC86,0xDC87,0xDC88,0xDC89,0xDC8A,0xEAA6,0xDC8B, +0xDC8C,0xDC8D,0xDC8E,0xDC8F,0xDC90,0xDC91,0xDC92,0xDC93, +0xDC94,0xDC95,0xDC96,0xDC97,0xDC98,0xDC99,0xDC9A,0xDC9B, +0xDC9C,0xDC9D,0xDC9E,0xDC9F,0xDCA0,0xDD40,0xDD41,0xDD42, +0xDD43,0xDD44,0xDD45,0xDD46,0xDD47,0xDD48,0xDD49,0xDD4A, +0xDD4B,0xDD4C,0xDD4D,0xDD4E,0xDD4F,0xDD50,0xDD51,0xDD52, +0xDD53,0xDD54,0xDD55,0xDD56,0xDD57,0xDD58,0xDD59,0xDD5A, +0xDD5B,0xDD5C,0xDD5D,0xDD5E,0xDD5F,0xDD60,0xDD61,0xDD62, +0xDD63,0xDD64,0xDD65,0xDD66,0xDD67,0xDD68,0xDD69,0xDD6A, +0xDD6B,0xDD6C,0xDD6D,0xDD6E,0xDD6F,0xDD70,0xDD71,0xDD72, +0xDD73,0xDD74,0xDD75,0xDD76,0xDD77,0xDD78,0xDD79,0xDD7A, +0xDD7B,0xDD7C,0xDD7D,0xDD7E,0xDD80,0xDD81,0xDD82,0xDD83, +0xDD84,0xDD85,0xDD86,0xDD87,0xDD88,0xDD89,0xDD8A,0xDD8B, +0xDD8C,0xDD8D,0xDD8E,0xDD8F,0xDD90,0xDD91,0xDD92,0xDD93, +0xDD94,0xDD95,0xDD96,0xDD97,0xDD98,0xDD99,0xDD9A,0xDD9B, +0xDD9C,0xDD9D,0xDD9E,0xDD9F,0xDDA0,0xDE40,0xDE41,0xDE42, +0xDE43,0xDE44,0xDE45,0xDE46,0xDE47,0xDE48,0xDE49,0xDE4A, +0xDE4B,0xDE4C,0xDE4D,0xDE4E,0xDE4F,0xDE50,0xDE51,0xDE52, +0xDE53,0xDE54,0xDE55,0xDE56,0xDE57,0xDE58,0xDE59,0xDE5A, +0xDE5B,0xDE5C,0xDE5D,0xDE5E,0xDE5F,0xDE60,0xB3B5,0xD4FE, +0xB9EC,0xD0F9,0xDE61,0xE9ED,0xD7AA,0xE9EE,0xC2D6,0xC8ED, +0xBAE4,0xE9EF,0xE9F0,0xE9F1,0xD6E1,0xE9F2,0xE9F3,0xE9F5, +0xE9F4,0xE9F6,0xE9F7,0xC7E1,0xE9F8,0xD4D8,0xE9F9,0xBDCE, +0xDE62,0xE9FA,0xE9FB,0xBDCF,0xE9FC,0xB8A8,0xC1BE,0xE9FD, +0xB1B2,0xBBD4,0xB9F5,0xE9FE,0xDE63,0xEAA1,0xEAA2,0xEAA3, +0xB7F8,0xBCAD,0xDE64,0xCAE4,0xE0CE,0xD4AF,0xCFBD,0xD5B7, +0xEAA4,0xD5DE,0xEAA5,0xD0C1,0xB9BC,0xDE65,0xB4C7,0xB1D9, +0xDE66,0xDE67,0xDE68,0xC0B1,0xDE69,0xDE6A,0xDE6B,0xDE6C, +0xB1E6,0xB1E7,0xDE6D,0xB1E8,0xDE6E,0xDE6F,0xDE70,0xDE71, +0xB3BD,0xC8E8,0xDE72,0xDE73,0xDE74,0xDE75,0xE5C1,0xDE76, +0xDE77,0xB1DF,0xDE78,0xDE79,0xDE7A,0xC1C9,0xB4EF,0xDE7B, +0xDE7C,0xC7A8,0xD3D8,0xDE7D,0xC6F9,0xD1B8,0xDE7E,0xB9FD, +0xC2F5,0xDE80,0xDE81,0xDE82,0xDE83,0xDE84,0xD3AD,0xDE85, +0xD4CB,0xBDFC,0xDE86,0xE5C2,0xB7B5,0xE5C3,0xDE87,0xDE88, +0xBBB9,0xD5E2,0xDE89,0xBDF8,0xD4B6,0xCEA5,0xC1AC,0xB3D9, +0xDE8A,0xDE8B,0xCCF6,0xDE8C,0xE5C6,0xE5C4,0xE5C8,0xDE8D, +0xE5CA,0xE5C7,0xB5CF,0xC6C8,0xDE8E,0xB5FC,0xE5C5,0xDE8F, +0xCAF6,0xDE90,0xDE91,0xE5C9,0xDE92,0xDE93,0xDE94,0xC3D4, +0xB1C5,0xBCA3,0xDE95,0xDE96,0xDE97,0xD7B7,0xDE98,0xDE99, +0xCDCB,0xCBCD,0xCACA,0xCCD3,0xE5CC,0xE5CB,0xC4E6,0xDE9A, +0xDE9B,0xD1A1,0xD1B7,0xE5CD,0xDE9C,0xE5D0,0xDE9D,0xCDB8, +0xD6F0,0xE5CF,0xB5DD,0xDE9E,0xCDBE,0xDE9F,0xE5D1,0xB6BA, +0xDEA0,0xDF40,0xCDA8,0xB9E4,0xDF41,0xCAC5,0xB3D1,0xCBD9, +0xD4EC,0xE5D2,0xB7EA,0xDF42,0xDF43,0xDF44,0xE5CE,0xDF45, +0xDF46,0xDF47,0xDF48,0xDF49,0xDF4A,0xE5D5,0xB4FE,0xE5D6, +0xDF4B,0xDF4C,0xDF4D,0xDF4E,0xDF4F,0xE5D3,0xE5D4,0xDF50, +0xD2DD,0xDF51,0xDF52,0xC2DF,0xB1C6,0xDF53,0xD3E2,0xDF54, +0xDF55,0xB6DD,0xCBEC,0xDF56,0xE5D7,0xDF57,0xDF58,0xD3F6, +0xDF59,0xDF5A,0xDF5B,0xDF5C,0xDF5D,0xB1E9,0xDF5E,0xB6F4, +0xE5DA,0xE5D8,0xE5D9,0xB5C0,0xDF5F,0xDF60,0xDF61,0xD2C5, +0xE5DC,0xDF62,0xDF63,0xE5DE,0xDF64,0xDF65,0xDF66,0xDF67, +0xDF68,0xDF69,0xE5DD,0xC7B2,0xDF6A,0xD2A3,0xDF6B,0xDF6C, +0xE5DB,0xDF6D,0xDF6E,0xDF6F,0xDF70,0xD4E2,0xD5DA,0xDF71, +0xDF72,0xDF73,0xDF74,0xDF75,0xE5E0,0xD7F1,0xDF76,0xDF77, +0xDF78,0xDF79,0xDF7A,0xDF7B,0xDF7C,0xE5E1,0xDF7D,0xB1DC, +0xD1FB,0xDF7E,0xE5E2,0xE5E4,0xDF80,0xDF81,0xDF82,0xDF83, +0xE5E3,0xDF84,0xDF85,0xE5E5,0xDF86,0xDF87,0xDF88,0xDF89, +0xDF8A,0xD2D8,0xDF8B,0xB5CB,0xDF8C,0xE7DF,0xDF8D,0xDAF5, +0xDF8E,0xDAF8,0xDF8F,0xDAF6,0xDF90,0xDAF7,0xDF91,0xDF92, +0xDF93,0xDAFA,0xD0CF,0xC4C7,0xDF94,0xDF95,0xB0EE,0xDF96, +0xDF97,0xDF98,0xD0B0,0xDF99,0xDAF9,0xDF9A,0xD3CA,0xBAAA, +0xDBA2,0xC7F1,0xDF9B,0xDAFC,0xDAFB,0xC9DB,0xDAFD,0xDF9C, +0xDBA1,0xD7DE,0xDAFE,0xC1DA,0xDF9D,0xDF9E,0xDBA5,0xDF9F, +0xDFA0,0xD3F4,0xE040,0xE041,0xDBA7,0xDBA4,0xE042,0xDBA8, +0xE043,0xE044,0xBDBC,0xE045,0xE046,0xE047,0xC0C9,0xDBA3, +0xDBA6,0xD6A3,0xE048,0xDBA9,0xE049,0xE04A,0xE04B,0xDBAD, +0xE04C,0xE04D,0xE04E,0xDBAE,0xDBAC,0xBAC2,0xE04F,0xE050, +0xE051,0xBFA4,0xDBAB,0xE052,0xE053,0xE054,0xDBAA,0xD4C7, +0xB2BF,0xE055,0xE056,0xDBAF,0xE057,0xB9F9,0xE058,0xDBB0, +0xE059,0xE05A,0xE05B,0xE05C,0xB3BB,0xE05D,0xE05E,0xE05F, +0xB5A6,0xE060,0xE061,0xE062,0xE063,0xB6BC,0xDBB1,0xE064, +0xE065,0xE066,0xB6F5,0xE067,0xDBB2,0xE068,0xE069,0xE06A, +0xE06B,0xE06C,0xE06D,0xE06E,0xE06F,0xE070,0xE071,0xE072, +0xE073,0xE074,0xE075,0xE076,0xE077,0xE078,0xE079,0xE07A, +0xE07B,0xB1C9,0xE07C,0xE07D,0xE07E,0xE080,0xDBB4,0xE081, +0xE082,0xE083,0xDBB3,0xDBB5,0xE084,0xE085,0xE086,0xE087, +0xE088,0xE089,0xE08A,0xE08B,0xE08C,0xE08D,0xE08E,0xDBB7, +0xE08F,0xDBB6,0xE090,0xE091,0xE092,0xE093,0xE094,0xE095, +0xE096,0xDBB8,0xE097,0xE098,0xE099,0xE09A,0xE09B,0xE09C, +0xE09D,0xE09E,0xE09F,0xDBB9,0xE0A0,0xE140,0xDBBA,0xE141, +0xE142,0xD3CF,0xF4FA,0xC7F5,0xD7C3,0xC5E4,0xF4FC,0xF4FD, +0xF4FB,0xE143,0xBEC6,0xE144,0xE145,0xE146,0xE147,0xD0EF, +0xE148,0xE149,0xB7D3,0xE14A,0xE14B,0xD4CD,0xCCAA,0xE14C, +0xE14D,0xF5A2,0xF5A1,0xBAA8,0xF4FE,0xCBD6,0xE14E,0xE14F, +0xE150,0xF5A4,0xC0D2,0xE151,0xB3EA,0xE152,0xCDAA,0xF5A5, +0xF5A3,0xBDB4,0xF5A8,0xE153,0xF5A9,0xBDCD,0xC3B8,0xBFE1, +0xCBE1,0xF5AA,0xE154,0xE155,0xE156,0xF5A6,0xF5A7,0xC4F0, +0xE157,0xE158,0xE159,0xE15A,0xE15B,0xF5AC,0xE15C,0xB4BC, +0xE15D,0xD7ED,0xE15E,0xB4D7,0xF5AB,0xF5AE,0xE15F,0xE160, +0xF5AD,0xF5AF,0xD0D1,0xE161,0xE162,0xE163,0xE164,0xE165, +0xE166,0xE167,0xC3D1,0xC8A9,0xE168,0xE169,0xE16A,0xE16B, +0xE16C,0xE16D,0xF5B0,0xF5B1,0xE16E,0xE16F,0xE170,0xE171, +0xE172,0xE173,0xF5B2,0xE174,0xE175,0xF5B3,0xF5B4,0xF5B5, +0xE176,0xE177,0xE178,0xE179,0xF5B7,0xF5B6,0xE17A,0xE17B, +0xE17C,0xE17D,0xF5B8,0xE17E,0xE180,0xE181,0xE182,0xE183, +0xE184,0xE185,0xE186,0xE187,0xE188,0xE189,0xE18A,0xB2C9, +0xE18B,0xD3D4,0xCACD,0xE18C,0xC0EF,0xD6D8,0xD2B0,0xC1BF, +0xE18D,0xBDF0,0xE18E,0xE18F,0xE190,0xE191,0xE192,0xE193, +0xE194,0xE195,0xE196,0xE197,0xB8AA,0xE198,0xE199,0xE19A, +0xE19B,0xE19C,0xE19D,0xE19E,0xE19F,0xE1A0,0xE240,0xE241, +0xE242,0xE243,0xE244,0xE245,0xE246,0xE247,0xE248,0xE249, +0xE24A,0xE24B,0xE24C,0xE24D,0xE24E,0xE24F,0xE250,0xE251, +0xE252,0xE253,0xE254,0xE255,0xE256,0xE257,0xE258,0xE259, +0xE25A,0xE25B,0xE25C,0xE25D,0xE25E,0xE25F,0xE260,0xE261, +0xE262,0xE263,0xE264,0xE265,0xE266,0xE267,0xE268,0xE269, +0xE26A,0xE26B,0xE26C,0xE26D,0xE26E,0xE26F,0xE270,0xE271, +0xE272,0xE273,0xE274,0xE275,0xE276,0xE277,0xE278,0xE279, +0xE27A,0xE27B,0xE27C,0xE27D,0xE27E,0xE280,0xE281,0xE282, +0xE283,0xE284,0xE285,0xE286,0xE287,0xE288,0xE289,0xE28A, +0xE28B,0xE28C,0xE28D,0xE28E,0xE28F,0xE290,0xE291,0xE292, +0xE293,0xE294,0xE295,0xE296,0xE297,0xE298,0xE299,0xE29A, +0xE29B,0xE29C,0xE29D,0xE29E,0xE29F,0xE2A0,0xE340,0xE341, +0xE342,0xE343,0xE344,0xE345,0xE346,0xE347,0xE348,0xE349, +0xE34A,0xE34B,0xE34C,0xE34D,0xE34E,0xE34F,0xE350,0xE351, +0xE352,0xE353,0xE354,0xE355,0xE356,0xE357,0xE358,0xE359, +0xE35A,0xE35B,0xE35C,0xE35D,0xE35E,0xE35F,0xE360,0xE361, +0xE362,0xE363,0xE364,0xE365,0xE366,0xE367,0xE368,0xE369, +0xE36A,0xE36B,0xE36C,0xE36D,0xBCF8,0xE36E,0xE36F,0xE370, +0xE371,0xE372,0xE373,0xE374,0xE375,0xE376,0xE377,0xE378, +0xE379,0xE37A,0xE37B,0xE37C,0xE37D,0xE37E,0xE380,0xE381, +0xE382,0xE383,0xE384,0xE385,0xE386,0xE387,0xF6C6,0xE388, +0xE389,0xE38A,0xE38B,0xE38C,0xE38D,0xE38E,0xE38F,0xE390, +0xE391,0xE392,0xE393,0xE394,0xE395,0xE396,0xE397,0xE398, +0xE399,0xE39A,0xE39B,0xE39C,0xE39D,0xE39E,0xE39F,0xE3A0, +0xE440,0xE441,0xE442,0xE443,0xE444,0xE445,0xF6C7,0xE446, +0xE447,0xE448,0xE449,0xE44A,0xE44B,0xE44C,0xE44D,0xE44E, +0xE44F,0xE450,0xE451,0xE452,0xE453,0xE454,0xE455,0xE456, +0xE457,0xE458,0xE459,0xE45A,0xE45B,0xE45C,0xE45D,0xE45E, +0xF6C8,0xE45F,0xE460,0xE461,0xE462,0xE463,0xE464,0xE465, +0xE466,0xE467,0xE468,0xE469,0xE46A,0xE46B,0xE46C,0xE46D, +0xE46E,0xE46F,0xE470,0xE471,0xE472,0xE473,0xE474,0xE475, +0xE476,0xE477,0xE478,0xE479,0xE47A,0xE47B,0xE47C,0xE47D, +0xE47E,0xE480,0xE481,0xE482,0xE483,0xE484,0xE485,0xE486, +0xE487,0xE488,0xE489,0xE48A,0xE48B,0xE48C,0xE48D,0xE48E, +0xE48F,0xE490,0xE491,0xE492,0xE493,0xE494,0xE495,0xE496, +0xE497,0xE498,0xE499,0xE49A,0xE49B,0xE49C,0xE49D,0xE49E, +0xE49F,0xE4A0,0xE540,0xE541,0xE542,0xE543,0xE544,0xE545, +0xE546,0xE547,0xE548,0xE549,0xE54A,0xE54B,0xE54C,0xE54D, +0xE54E,0xE54F,0xE550,0xE551,0xE552,0xE553,0xE554,0xE555, +0xE556,0xE557,0xE558,0xE559,0xE55A,0xE55B,0xE55C,0xE55D, +0xE55E,0xE55F,0xE560,0xE561,0xE562,0xE563,0xE564,0xE565, +0xE566,0xE567,0xE568,0xE569,0xE56A,0xE56B,0xE56C,0xE56D, +0xE56E,0xE56F,0xE570,0xE571,0xE572,0xE573,0xF6C9,0xE574, +0xE575,0xE576,0xE577,0xE578,0xE579,0xE57A,0xE57B,0xE57C, +0xE57D,0xE57E,0xE580,0xE581,0xE582,0xE583,0xE584,0xE585, +0xE586,0xE587,0xE588,0xE589,0xE58A,0xE58B,0xE58C,0xE58D, +0xE58E,0xE58F,0xE590,0xE591,0xE592,0xE593,0xE594,0xE595, +0xE596,0xE597,0xE598,0xE599,0xE59A,0xE59B,0xE59C,0xE59D, +0xE59E,0xE59F,0xF6CA,0xE5A0,0xE640,0xE641,0xE642,0xE643, +0xE644,0xE645,0xE646,0xE647,0xE648,0xE649,0xE64A,0xE64B, +0xE64C,0xE64D,0xE64E,0xE64F,0xE650,0xE651,0xE652,0xE653, +0xE654,0xE655,0xE656,0xE657,0xE658,0xE659,0xE65A,0xE65B, +0xE65C,0xE65D,0xE65E,0xE65F,0xE660,0xE661,0xE662,0xF6CC, +0xE663,0xE664,0xE665,0xE666,0xE667,0xE668,0xE669,0xE66A, +0xE66B,0xE66C,0xE66D,0xE66E,0xE66F,0xE670,0xE671,0xE672, +0xE673,0xE674,0xE675,0xE676,0xE677,0xE678,0xE679,0xE67A, +0xE67B,0xE67C,0xE67D,0xE67E,0xE680,0xE681,0xE682,0xE683, +0xE684,0xE685,0xE686,0xE687,0xE688,0xE689,0xE68A,0xE68B, +0xE68C,0xE68D,0xE68E,0xE68F,0xE690,0xE691,0xE692,0xE693, +0xE694,0xE695,0xE696,0xE697,0xE698,0xE699,0xE69A,0xE69B, +0xE69C,0xE69D,0xF6CB,0xE69E,0xE69F,0xE6A0,0xE740,0xE741, +0xE742,0xE743,0xE744,0xE745,0xE746,0xE747,0xF7E9,0xE748, +0xE749,0xE74A,0xE74B,0xE74C,0xE74D,0xE74E,0xE74F,0xE750, +0xE751,0xE752,0xE753,0xE754,0xE755,0xE756,0xE757,0xE758, +0xE759,0xE75A,0xE75B,0xE75C,0xE75D,0xE75E,0xE75F,0xE760, +0xE761,0xE762,0xE763,0xE764,0xE765,0xE766,0xE767,0xE768, +0xE769,0xE76A,0xE76B,0xE76C,0xE76D,0xE76E,0xE76F,0xE770, +0xE771,0xE772,0xE773,0xE774,0xE775,0xE776,0xE777,0xE778, +0xE779,0xE77A,0xE77B,0xE77C,0xE77D,0xE77E,0xE780,0xE781, +0xE782,0xE783,0xE784,0xE785,0xE786,0xE787,0xE788,0xE789, +0xE78A,0xE78B,0xE78C,0xE78D,0xE78E,0xE78F,0xE790,0xE791, +0xE792,0xE793,0xE794,0xE795,0xE796,0xE797,0xE798,0xE799, +0xE79A,0xE79B,0xE79C,0xE79D,0xE79E,0xE79F,0xE7A0,0xE840, +0xE841,0xE842,0xE843,0xE844,0xE845,0xE846,0xE847,0xE848, +0xE849,0xE84A,0xE84B,0xE84C,0xE84D,0xE84E,0xF6CD,0xE84F, +0xE850,0xE851,0xE852,0xE853,0xE854,0xE855,0xE856,0xE857, +0xE858,0xE859,0xE85A,0xE85B,0xE85C,0xE85D,0xE85E,0xE85F, +0xE860,0xE861,0xE862,0xE863,0xE864,0xE865,0xE866,0xE867, +0xE868,0xE869,0xE86A,0xE86B,0xE86C,0xE86D,0xE86E,0xE86F, +0xE870,0xE871,0xE872,0xE873,0xE874,0xE875,0xE876,0xE877, +0xE878,0xE879,0xE87A,0xF6CE,0xE87B,0xE87C,0xE87D,0xE87E, +0xE880,0xE881,0xE882,0xE883,0xE884,0xE885,0xE886,0xE887, +0xE888,0xE889,0xE88A,0xE88B,0xE88C,0xE88D,0xE88E,0xE88F, +0xE890,0xE891,0xE892,0xE893,0xE894,0xEEC4,0xEEC5,0xEEC6, +0xD5EB,0xB6A4,0xEEC8,0xEEC7,0xEEC9,0xEECA,0xC7A5,0xEECB, +0xEECC,0xE895,0xB7B0,0xB5F6,0xEECD,0xEECF,0xE896,0xEECE, +0xE897,0xB8C6,0xEED0,0xEED1,0xEED2,0xB6DB,0xB3AE,0xD6D3, +0xC4C6,0xB1B5,0xB8D6,0xEED3,0xEED4,0xD4BF,0xC7D5,0xBEFB, +0xCED9,0xB9B3,0xEED6,0xEED5,0xEED8,0xEED7,0xC5A5,0xEED9, +0xEEDA,0xC7AE,0xEEDB,0xC7AF,0xEEDC,0xB2A7,0xEEDD,0xEEDE, +0xEEDF,0xEEE0,0xEEE1,0xD7EA,0xEEE2,0xEEE3,0xBCD8,0xEEE4, +0xD3CB,0xCCFA,0xB2AC,0xC1E5,0xEEE5,0xC7A6,0xC3AD,0xE898, +0xEEE6,0xEEE7,0xEEE8,0xEEE9,0xEEEA,0xEEEB,0xEEEC,0xE899, +0xEEED,0xEEEE,0xEEEF,0xE89A,0xE89B,0xEEF0,0xEEF1,0xEEF2, +0xEEF4,0xEEF3,0xE89C,0xEEF5,0xCDAD,0xC2C1,0xEEF6,0xEEF7, +0xEEF8,0xD5A1,0xEEF9,0xCFB3,0xEEFA,0xEEFB,0xE89D,0xEEFC, +0xEEFD,0xEFA1,0xEEFE,0xEFA2,0xB8F5,0xC3FA,0xEFA3,0xEFA4, +0xBDC2,0xD2BF,0xB2F9,0xEFA5,0xEFA6,0xEFA7,0xD2F8,0xEFA8, +0xD6FD,0xEFA9,0xC6CC,0xE89E,0xEFAA,0xEFAB,0xC1B4,0xEFAC, +0xCFFA,0xCBF8,0xEFAE,0xEFAD,0xB3FA,0xB9F8,0xEFAF,0xEFB0, +0xD0E2,0xEFB1,0xEFB2,0xB7E6,0xD0BF,0xEFB3,0xEFB4,0xEFB5, +0xC8F1,0xCCE0,0xEFB6,0xEFB7,0xEFB8,0xEFB9,0xEFBA,0xD5E0, +0xEFBB,0xB4ED,0xC3AA,0xEFBC,0xE89F,0xEFBD,0xEFBE,0xEFBF, +0xE8A0,0xCEFD,0xEFC0,0xC2E0,0xB4B8,0xD7B6,0xBDF5,0xE940, +0xCFC7,0xEFC3,0xEFC1,0xEFC2,0xEFC4,0xB6A7,0xBCFC,0xBEE2, +0xC3CC,0xEFC5,0xEFC6,0xE941,0xEFC7,0xEFCF,0xEFC8,0xEFC9, +0xEFCA,0xC7C2,0xEFF1,0xB6CD,0xEFCB,0xE942,0xEFCC,0xEFCD, +0xB6C6,0xC3BE,0xEFCE,0xE943,0xEFD0,0xEFD1,0xEFD2,0xD5F2, +0xE944,0xEFD3,0xC4F7,0xE945,0xEFD4,0xC4F8,0xEFD5,0xEFD6, +0xB8E4,0xB0F7,0xEFD7,0xEFD8,0xEFD9,0xE946,0xEFDA,0xEFDB, +0xEFDC,0xEFDD,0xE947,0xEFDE,0xBEB5,0xEFE1,0xEFDF,0xEFE0, +0xE948,0xEFE2,0xEFE3,0xC1CD,0xEFE4,0xEFE5,0xEFE6,0xEFE7, +0xEFE8,0xEFE9,0xEFEA,0xEFEB,0xEFEC,0xC0D8,0xE949,0xEFED, +0xC1AD,0xEFEE,0xEFEF,0xEFF0,0xE94A,0xE94B,0xCFE2,0xE94C, +0xE94D,0xE94E,0xE94F,0xE950,0xE951,0xE952,0xE953,0xB3A4, +0xE954,0xE955,0xE956,0xE957,0xE958,0xE959,0xE95A,0xE95B, +0xE95C,0xE95D,0xE95E,0xE95F,0xE960,0xE961,0xE962,0xE963, +0xE964,0xE965,0xE966,0xE967,0xE968,0xE969,0xE96A,0xE96B, +0xE96C,0xE96D,0xE96E,0xE96F,0xE970,0xE971,0xE972,0xE973, +0xE974,0xE975,0xE976,0xE977,0xE978,0xE979,0xE97A,0xE97B, +0xE97C,0xE97D,0xE97E,0xE980,0xE981,0xE982,0xE983,0xE984, +0xE985,0xE986,0xE987,0xE988,0xE989,0xE98A,0xE98B,0xE98C, +0xE98D,0xE98E,0xE98F,0xE990,0xE991,0xE992,0xE993,0xE994, +0xE995,0xE996,0xE997,0xE998,0xE999,0xE99A,0xE99B,0xE99C, +0xE99D,0xE99E,0xE99F,0xE9A0,0xEA40,0xEA41,0xEA42,0xEA43, +0xEA44,0xEA45,0xEA46,0xEA47,0xEA48,0xEA49,0xEA4A,0xEA4B, +0xEA4C,0xEA4D,0xEA4E,0xEA4F,0xEA50,0xEA51,0xEA52,0xEA53, +0xEA54,0xEA55,0xEA56,0xEA57,0xEA58,0xEA59,0xEA5A,0xEA5B, +0xC3C5,0xE3C5,0xC9C1,0xE3C6,0xEA5C,0xB1D5,0xCECA,0xB4B3, +0xC8F2,0xE3C7,0xCFD0,0xE3C8,0xBCE4,0xE3C9,0xE3CA,0xC3C6, +0xD5A2,0xC4D6,0xB9EB,0xCEC5,0xE3CB,0xC3F6,0xE3CC,0xEA5D, +0xB7A7,0xB8F3,0xBAD2,0xE3CD,0xE3CE,0xD4C4,0xE3CF,0xEA5E, +0xE3D0,0xD1CB,0xE3D1,0xE3D2,0xE3D3,0xE3D4,0xD1D6,0xE3D5, +0xB2FB,0xC0BB,0xE3D6,0xEA5F,0xC0AB,0xE3D7,0xE3D8,0xE3D9, +0xEA60,0xE3DA,0xE3DB,0xEA61,0xB8B7,0xDAE2,0xEA62,0xB6D3, +0xEA63,0xDAE4,0xDAE3,0xEA64,0xEA65,0xEA66,0xEA67,0xEA68, +0xEA69,0xEA6A,0xDAE6,0xEA6B,0xEA6C,0xEA6D,0xC8EE,0xEA6E, +0xEA6F,0xDAE5,0xB7C0,0xD1F4,0xD2F5,0xD5F3,0xBDD7,0xEA70, +0xEA71,0xEA72,0xEA73,0xD7E8,0xDAE8,0xDAE7,0xEA74,0xB0A2, +0xCDD3,0xEA75,0xDAE9,0xEA76,0xB8BD,0xBCCA,0xC2BD,0xC2A4, +0xB3C2,0xDAEA,0xEA77,0xC2AA,0xC4B0,0xBDB5,0xEA78,0xEA79, +0xCFDE,0xEA7A,0xEA7B,0xEA7C,0xDAEB,0xC9C2,0xEA7D,0xEA7E, +0xEA80,0xEA81,0xEA82,0xB1DD,0xEA83,0xEA84,0xEA85,0xDAEC, +0xEA86,0xB6B8,0xD4BA,0xEA87,0xB3FD,0xEA88,0xEA89,0xDAED, +0xD4C9,0xCFD5,0xC5E3,0xEA8A,0xDAEE,0xEA8B,0xEA8C,0xEA8D, +0xEA8E,0xEA8F,0xDAEF,0xEA90,0xDAF0,0xC1EA,0xCCD5,0xCFDD, +0xEA91,0xEA92,0xEA93,0xEA94,0xEA95,0xEA96,0xEA97,0xEA98, +0xEA99,0xEA9A,0xEA9B,0xEA9C,0xEA9D,0xD3E7,0xC2A1,0xEA9E, +0xDAF1,0xEA9F,0xEAA0,0xCBE5,0xEB40,0xDAF2,0xEB41,0xCBE6, +0xD2FE,0xEB42,0xEB43,0xEB44,0xB8F4,0xEB45,0xEB46,0xDAF3, +0xB0AF,0xCFB6,0xEB47,0xEB48,0xD5CF,0xEB49,0xEB4A,0xEB4B, +0xEB4C,0xEB4D,0xEB4E,0xEB4F,0xEB50,0xEB51,0xEB52,0xCBED, +0xEB53,0xEB54,0xEB55,0xEB56,0xEB57,0xEB58,0xEB59,0xEB5A, +0xDAF4,0xEB5B,0xEB5C,0xE3C4,0xEB5D,0xEB5E,0xC1A5,0xEB5F, +0xEB60,0xF6BF,0xEB61,0xEB62,0xF6C0,0xF6C1,0xC4D1,0xEB63, +0xC8B8,0xD1E3,0xEB64,0xEB65,0xD0DB,0xD1C5,0xBCAF,0xB9CD, +0xEB66,0xEFF4,0xEB67,0xEB68,0xB4C6,0xD3BA,0xF6C2,0xB3FB, +0xEB69,0xEB6A,0xF6C3,0xEB6B,0xEB6C,0xB5F1,0xEB6D,0xEB6E, +0xEB6F,0xEB70,0xEB71,0xEB72,0xEB73,0xEB74,0xEB75,0xEB76, +0xF6C5,0xEB77,0xEB78,0xEB79,0xEB7A,0xEB7B,0xEB7C,0xEB7D, +0xD3EA,0xF6A7,0xD1A9,0xEB7E,0xEB80,0xEB81,0xEB82,0xF6A9, +0xEB83,0xEB84,0xEB85,0xF6A8,0xEB86,0xEB87,0xC1E3,0xC0D7, +0xEB88,0xB1A2,0xEB89,0xEB8A,0xEB8B,0xEB8C,0xCEED,0xEB8D, +0xD0E8,0xF6AB,0xEB8E,0xEB8F,0xCFF6,0xEB90,0xF6AA,0xD5F0, +0xF6AC,0xC3B9,0xEB91,0xEB92,0xEB93,0xBBF4,0xF6AE,0xF6AD, +0xEB94,0xEB95,0xEB96,0xC4DE,0xEB97,0xEB98,0xC1D8,0xEB99, +0xEB9A,0xEB9B,0xEB9C,0xEB9D,0xCBAA,0xEB9E,0xCFBC,0xEB9F, +0xEBA0,0xEC40,0xEC41,0xEC42,0xEC43,0xEC44,0xEC45,0xEC46, +0xEC47,0xEC48,0xF6AF,0xEC49,0xEC4A,0xF6B0,0xEC4B,0xEC4C, +0xF6B1,0xEC4D,0xC2B6,0xEC4E,0xEC4F,0xEC50,0xEC51,0xEC52, +0xB0D4,0xC5F9,0xEC53,0xEC54,0xEC55,0xEC56,0xF6B2,0xEC57, +0xEC58,0xEC59,0xEC5A,0xEC5B,0xEC5C,0xEC5D,0xEC5E,0xEC5F, +0xEC60,0xEC61,0xEC62,0xEC63,0xEC64,0xEC65,0xEC66,0xEC67, +0xEC68,0xEC69,0xC7E0,0xF6A6,0xEC6A,0xEC6B,0xBEB8,0xEC6C, +0xEC6D,0xBEB2,0xEC6E,0xB5E5,0xEC6F,0xEC70,0xB7C7,0xEC71, +0xBFBF,0xC3D2,0xC3E6,0xEC72,0xEC73,0xD8CC,0xEC74,0xEC75, +0xEC76,0xB8EF,0xEC77,0xEC78,0xEC79,0xEC7A,0xEC7B,0xEC7C, +0xEC7D,0xEC7E,0xEC80,0xBDF9,0xD1A5,0xEC81,0xB0D0,0xEC82, +0xEC83,0xEC84,0xEC85,0xEC86,0xF7B0,0xEC87,0xEC88,0xEC89, +0xEC8A,0xEC8B,0xEC8C,0xEC8D,0xEC8E,0xF7B1,0xEC8F,0xEC90, +0xEC91,0xEC92,0xEC93,0xD0AC,0xEC94,0xB0B0,0xEC95,0xEC96, +0xEC97,0xF7B2,0xF7B3,0xEC98,0xF7B4,0xEC99,0xEC9A,0xEC9B, +0xC7CA,0xEC9C,0xEC9D,0xEC9E,0xEC9F,0xECA0,0xED40,0xED41, +0xBECF,0xED42,0xED43,0xF7B7,0xED44,0xED45,0xED46,0xED47, +0xED48,0xED49,0xED4A,0xF7B6,0xED4B,0xB1DE,0xED4C,0xF7B5, +0xED4D,0xED4E,0xF7B8,0xED4F,0xF7B9,0xED50,0xED51,0xED52, +0xED53,0xED54,0xED55,0xED56,0xED57,0xED58,0xED59,0xED5A, +0xED5B,0xED5C,0xED5D,0xED5E,0xED5F,0xED60,0xED61,0xED62, +0xED63,0xED64,0xED65,0xED66,0xED67,0xED68,0xED69,0xED6A, +0xED6B,0xED6C,0xED6D,0xED6E,0xED6F,0xED70,0xED71,0xED72, +0xED73,0xED74,0xED75,0xED76,0xED77,0xED78,0xED79,0xED7A, +0xED7B,0xED7C,0xED7D,0xED7E,0xED80,0xED81,0xCEA4,0xC8CD, +0xED82,0xBAAB,0xE8B8,0xE8B9,0xE8BA,0xBEC2,0xED83,0xED84, +0xED85,0xED86,0xED87,0xD2F4,0xED88,0xD4CF,0xC9D8,0xED89, +0xED8A,0xED8B,0xED8C,0xED8D,0xED8E,0xED8F,0xED90,0xED91, +0xED92,0xED93,0xED94,0xED95,0xED96,0xED97,0xED98,0xED99, +0xED9A,0xED9B,0xED9C,0xED9D,0xED9E,0xED9F,0xEDA0,0xEE40, +0xEE41,0xEE42,0xEE43,0xEE44,0xEE45,0xEE46,0xEE47,0xEE48, +0xEE49,0xEE4A,0xEE4B,0xEE4C,0xEE4D,0xEE4E,0xEE4F,0xEE50, +0xEE51,0xEE52,0xEE53,0xEE54,0xEE55,0xEE56,0xEE57,0xEE58, +0xEE59,0xEE5A,0xEE5B,0xEE5C,0xEE5D,0xEE5E,0xEE5F,0xEE60, +0xEE61,0xEE62,0xEE63,0xEE64,0xEE65,0xEE66,0xEE67,0xEE68, +0xEE69,0xEE6A,0xEE6B,0xEE6C,0xEE6D,0xEE6E,0xEE6F,0xEE70, +0xEE71,0xEE72,0xEE73,0xEE74,0xEE75,0xEE76,0xEE77,0xEE78, +0xEE79,0xEE7A,0xEE7B,0xEE7C,0xEE7D,0xEE7E,0xEE80,0xEE81, +0xEE82,0xEE83,0xEE84,0xEE85,0xEE86,0xEE87,0xEE88,0xEE89, +0xEE8A,0xEE8B,0xEE8C,0xEE8D,0xEE8E,0xEE8F,0xEE90,0xEE91, +0xEE92,0xEE93,0xEE94,0xEE95,0xEE96,0xEE97,0xEE98,0xEE99, +0xEE9A,0xEE9B,0xEE9C,0xEE9D,0xEE9E,0xEE9F,0xEEA0,0xEF40, +0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xD2B3,0xB6A5,0xC7EA, +0xF1FC,0xCFEE,0xCBB3,0xD0EB,0xE7EF,0xCDE7,0xB9CB,0xB6D9, +0xF1FD,0xB0E4,0xCBCC,0xF1FE,0xD4A4,0xC2AD,0xC1EC,0xC6C4, +0xBEB1,0xF2A1,0xBCD5,0xEF46,0xF2A2,0xF2A3,0xEF47,0xF2A4, +0xD2C3,0xC6B5,0xEF48,0xCDC7,0xF2A5,0xEF49,0xD3B1,0xBFC5, +0xCCE2,0xEF4A,0xF2A6,0xF2A7,0xD1D5,0xB6EE,0xF2A8,0xF2A9, +0xB5DF,0xF2AA,0xF2AB,0xEF4B,0xB2FC,0xF2AC,0xF2AD,0xC8A7, +0xEF4C,0xEF4D,0xEF4E,0xEF4F,0xEF50,0xEF51,0xEF52,0xEF53, +0xEF54,0xEF55,0xEF56,0xEF57,0xEF58,0xEF59,0xEF5A,0xEF5B, +0xEF5C,0xEF5D,0xEF5E,0xEF5F,0xEF60,0xEF61,0xEF62,0xEF63, +0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0xEF6B, +0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0xB7E7,0xEF72, +0xEF73,0xECA9,0xECAA,0xECAB,0xEF74,0xECAC,0xEF75,0xEF76, +0xC6AE,0xECAD,0xECAE,0xEF77,0xEF78,0xEF79,0xB7C9,0xCAB3, +0xEF7A,0xEF7B,0xEF7C,0xEF7D,0xEF7E,0xEF80,0xEF81,0xE2B8, +0xF7CF,0xEF82,0xEF83,0xEF84,0xEF85,0xEF86,0xEF87,0xEF88, +0xEF89,0xEF8A,0xEF8B,0xEF8C,0xEF8D,0xEF8E,0xEF8F,0xEF90, +0xEF91,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0xEF97,0xEF98, +0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0xEF9F,0xEFA0, +0xF040,0xF041,0xF042,0xF043,0xF044,0xF7D0,0xF045,0xF046, +0xB2CD,0xF047,0xF048,0xF049,0xF04A,0xF04B,0xF04C,0xF04D, +0xF04E,0xF04F,0xF050,0xF051,0xF052,0xF053,0xF054,0xF055, +0xF056,0xF057,0xF058,0xF059,0xF05A,0xF05B,0xF05C,0xF05D, +0xF05E,0xF05F,0xF060,0xF061,0xF062,0xF063,0xF7D1,0xF064, +0xF065,0xF066,0xF067,0xF068,0xF069,0xF06A,0xF06B,0xF06C, +0xF06D,0xF06E,0xF06F,0xF070,0xF071,0xF072,0xF073,0xF074, +0xF075,0xF076,0xF077,0xF078,0xF079,0xF07A,0xF07B,0xF07C, +0xF07D,0xF07E,0xF080,0xF081,0xF082,0xF083,0xF084,0xF085, +0xF086,0xF087,0xF088,0xF089,0xF7D3,0xF7D2,0xF08A,0xF08B, +0xF08C,0xF08D,0xF08E,0xF08F,0xF090,0xF091,0xF092,0xF093, +0xF094,0xF095,0xF096,0xE2BB,0xF097,0xBCA2,0xF098,0xE2BC, +0xE2BD,0xE2BE,0xE2BF,0xE2C0,0xE2C1,0xB7B9,0xD2FB,0xBDA4, +0xCACE,0xB1A5,0xCBC7,0xF099,0xE2C2,0xB6FC,0xC8C4,0xE2C3, +0xF09A,0xF09B,0xBDC8,0xF09C,0xB1FD,0xE2C4,0xF09D,0xB6F6, +0xE2C5,0xC4D9,0xF09E,0xF09F,0xE2C6,0xCFDA,0xB9DD,0xE2C7, +0xC0A1,0xF0A0,0xE2C8,0xB2F6,0xF140,0xE2C9,0xF141,0xC1F3, +0xE2CA,0xE2CB,0xC2F8,0xE2CC,0xE2CD,0xE2CE,0xCAD7,0xD8B8, +0xD9E5,0xCFE3,0xF142,0xF143,0xF144,0xF145,0xF146,0xF147, +0xF148,0xF149,0xF14A,0xF14B,0xF14C,0xF0A5,0xF14D,0xF14E, +0xDCB0,0xF14F,0xF150,0xF151,0xF152,0xF153,0xF154,0xF155, +0xF156,0xF157,0xF158,0xF159,0xF15A,0xF15B,0xF15C,0xF15D, +0xF15E,0xF15F,0xF160,0xF161,0xF162,0xF163,0xF164,0xF165, +0xF166,0xF167,0xF168,0xF169,0xF16A,0xF16B,0xF16C,0xF16D, +0xF16E,0xF16F,0xF170,0xF171,0xF172,0xF173,0xF174,0xF175, +0xF176,0xF177,0xF178,0xF179,0xF17A,0xF17B,0xF17C,0xF17D, +0xF17E,0xF180,0xF181,0xF182,0xF183,0xF184,0xF185,0xF186, +0xF187,0xF188,0xF189,0xF18A,0xF18B,0xF18C,0xF18D,0xF18E, +0xF18F,0xF190,0xF191,0xF192,0xF193,0xF194,0xF195,0xF196, +0xF197,0xF198,0xF199,0xF19A,0xF19B,0xF19C,0xF19D,0xF19E, +0xF19F,0xF1A0,0xF240,0xF241,0xF242,0xF243,0xF244,0xF245, +0xF246,0xF247,0xF248,0xF249,0xF24A,0xF24B,0xF24C,0xF24D, +0xF24E,0xF24F,0xF250,0xF251,0xF252,0xF253,0xF254,0xF255, +0xF256,0xF257,0xF258,0xF259,0xF25A,0xF25B,0xF25C,0xF25D, +0xF25E,0xF25F,0xF260,0xF261,0xF262,0xF263,0xF264,0xF265, +0xF266,0xF267,0xF268,0xF269,0xF26A,0xF26B,0xF26C,0xF26D, +0xF26E,0xF26F,0xF270,0xF271,0xF272,0xF273,0xF274,0xF275, +0xF276,0xF277,0xF278,0xF279,0xF27A,0xF27B,0xF27C,0xF27D, +0xF27E,0xF280,0xF281,0xF282,0xF283,0xF284,0xF285,0xF286, +0xF287,0xF288,0xF289,0xF28A,0xF28B,0xF28C,0xF28D,0xF28E, +0xF28F,0xF290,0xF291,0xF292,0xF293,0xF294,0xF295,0xF296, +0xF297,0xF298,0xF299,0xF29A,0xF29B,0xF29C,0xF29D,0xF29E, +0xF29F,0xF2A0,0xF340,0xF341,0xF342,0xF343,0xF344,0xF345, +0xF346,0xF347,0xF348,0xF349,0xF34A,0xF34B,0xF34C,0xF34D, +0xF34E,0xF34F,0xF350,0xF351,0xC2ED,0xD4A6,0xCDD4,0xD1B1, +0xB3DB,0xC7FD,0xF352,0xB2B5,0xC2BF,0xE6E0,0xCABB,0xE6E1, +0xE6E2,0xBED4,0xE6E3,0xD7A4,0xCDD5,0xE6E5,0xBCDD,0xE6E4, +0xE6E6,0xE6E7,0xC2EE,0xF353,0xBDBE,0xE6E8,0xC2E6,0xBAA7, +0xE6E9,0xF354,0xE6EA,0xB3D2,0xD1E9,0xF355,0xF356,0xBFA5, +0xE6EB,0xC6EF,0xE6EC,0xE6ED,0xF357,0xF358,0xE6EE,0xC6AD, +0xE6EF,0xF359,0xC9A7,0xE6F0,0xE6F1,0xE6F2,0xE5B9,0xE6F3, +0xE6F4,0xC2E2,0xE6F5,0xE6F6,0xD6E8,0xE6F7,0xF35A,0xE6F8, +0xB9C7,0xF35B,0xF35C,0xF35D,0xF35E,0xF35F,0xF360,0xF361, +0xF7BB,0xF7BA,0xF362,0xF363,0xF364,0xF365,0xF7BE,0xF7BC, +0xBAA1,0xF366,0xF7BF,0xF367,0xF7C0,0xF368,0xF369,0xF36A, +0xF7C2,0xF7C1,0xF7C4,0xF36B,0xF36C,0xF7C3,0xF36D,0xF36E, +0xF36F,0xF370,0xF371,0xF7C5,0xF7C6,0xF372,0xF373,0xF374, +0xF375,0xF7C7,0xF376,0xCBE8,0xF377,0xF378,0xF379,0xF37A, +0xB8DF,0xF37B,0xF37C,0xF37D,0xF37E,0xF380,0xF381,0xF7D4, +0xF382,0xF7D5,0xF383,0xF384,0xF385,0xF386,0xF7D6,0xF387, +0xF388,0xF389,0xF38A,0xF7D8,0xF38B,0xF7DA,0xF38C,0xF7D7, +0xF38D,0xF38E,0xF38F,0xF390,0xF391,0xF392,0xF393,0xF394, +0xF395,0xF7DB,0xF396,0xF7D9,0xF397,0xF398,0xF399,0xF39A, +0xF39B,0xF39C,0xF39D,0xD7D7,0xF39E,0xF39F,0xF3A0,0xF440, +0xF7DC,0xF441,0xF442,0xF443,0xF444,0xF445,0xF446,0xF7DD, +0xF447,0xF448,0xF449,0xF7DE,0xF44A,0xF44B,0xF44C,0xF44D, +0xF44E,0xF44F,0xF450,0xF451,0xF452,0xF453,0xF454,0xF7DF, +0xF455,0xF456,0xF457,0xF7E0,0xF458,0xF459,0xF45A,0xF45B, +0xF45C,0xF45D,0xF45E,0xF45F,0xF460,0xF461,0xF462,0xDBCB, +0xF463,0xF464,0xD8AA,0xF465,0xF466,0xF467,0xF468,0xF469, +0xF46A,0xF46B,0xF46C,0xE5F7,0xB9ED,0xF46D,0xF46E,0xF46F, +0xF470,0xBFFD,0xBBEA,0xF7C9,0xC6C7,0xF7C8,0xF471,0xF7CA, +0xF7CC,0xF7CB,0xF472,0xF473,0xF474,0xF7CD,0xF475,0xCEBA, +0xF476,0xF7CE,0xF477,0xF478,0xC4A7,0xF479,0xF47A,0xF47B, +0xF47C,0xF47D,0xF47E,0xF480,0xF481,0xF482,0xF483,0xF484, +0xF485,0xF486,0xF487,0xF488,0xF489,0xF48A,0xF48B,0xF48C, +0xF48D,0xF48E,0xF48F,0xF490,0xF491,0xF492,0xF493,0xF494, +0xF495,0xF496,0xF497,0xF498,0xF499,0xF49A,0xF49B,0xF49C, +0xF49D,0xF49E,0xF49F,0xF4A0,0xF540,0xF541,0xF542,0xF543, +0xF544,0xF545,0xF546,0xF547,0xF548,0xF549,0xF54A,0xF54B, +0xF54C,0xF54D,0xF54E,0xF54F,0xF550,0xF551,0xF552,0xF553, +0xF554,0xF555,0xF556,0xF557,0xF558,0xF559,0xF55A,0xF55B, +0xF55C,0xF55D,0xF55E,0xF55F,0xF560,0xF561,0xF562,0xF563, +0xF564,0xF565,0xF566,0xF567,0xF568,0xF569,0xF56A,0xF56B, +0xF56C,0xF56D,0xF56E,0xF56F,0xF570,0xF571,0xF572,0xF573, +0xF574,0xF575,0xF576,0xF577,0xF578,0xF579,0xF57A,0xF57B, +0xF57C,0xF57D,0xF57E,0xF580,0xF581,0xF582,0xF583,0xF584, +0xF585,0xF586,0xF587,0xF588,0xF589,0xF58A,0xF58B,0xF58C, +0xF58D,0xF58E,0xF58F,0xF590,0xF591,0xF592,0xF593,0xF594, +0xF595,0xF596,0xF597,0xF598,0xF599,0xF59A,0xF59B,0xF59C, +0xF59D,0xF59E,0xF59F,0xF5A0,0xF640,0xF641,0xF642,0xF643, +0xF644,0xF645,0xF646,0xF647,0xF648,0xF649,0xF64A,0xF64B, +0xF64C,0xF64D,0xF64E,0xF64F,0xF650,0xF651,0xF652,0xF653, +0xF654,0xF655,0xF656,0xF657,0xF658,0xF659,0xF65A,0xF65B, +0xF65C,0xF65D,0xF65E,0xF65F,0xF660,0xF661,0xF662,0xF663, +0xF664,0xF665,0xF666,0xF667,0xF668,0xF669,0xF66A,0xF66B, +0xF66C,0xF66D,0xF66E,0xF66F,0xF670,0xF671,0xF672,0xF673, +0xF674,0xF675,0xF676,0xF677,0xF678,0xF679,0xF67A,0xF67B, +0xF67C,0xF67D,0xF67E,0xF680,0xF681,0xF682,0xF683,0xF684, +0xF685,0xF686,0xF687,0xF688,0xF689,0xF68A,0xF68B,0xF68C, +0xF68D,0xF68E,0xF68F,0xF690,0xF691,0xF692,0xF693,0xF694, +0xF695,0xF696,0xF697,0xF698,0xF699,0xF69A,0xF69B,0xF69C, +0xF69D,0xF69E,0xF69F,0xF6A0,0xF740,0xF741,0xF742,0xF743, +0xF744,0xF745,0xF746,0xF747,0xF748,0xF749,0xF74A,0xF74B, +0xF74C,0xF74D,0xF74E,0xF74F,0xF750,0xF751,0xF752,0xF753, +0xF754,0xF755,0xF756,0xF757,0xF758,0xF759,0xF75A,0xF75B, +0xF75C,0xF75D,0xF75E,0xF75F,0xF760,0xF761,0xF762,0xF763, +0xF764,0xF765,0xF766,0xF767,0xF768,0xF769,0xF76A,0xF76B, +0xF76C,0xF76D,0xF76E,0xF76F,0xF770,0xF771,0xF772,0xF773, +0xF774,0xF775,0xF776,0xF777,0xF778,0xF779,0xF77A,0xF77B, +0xF77C,0xF77D,0xF77E,0xF780,0xD3E3,0xF781,0xF782,0xF6CF, +0xF783,0xC2B3,0xF6D0,0xF784,0xF785,0xF6D1,0xF6D2,0xF6D3, +0xF6D4,0xF786,0xF787,0xF6D6,0xF788,0xB1AB,0xF6D7,0xF789, +0xF6D8,0xF6D9,0xF6DA,0xF78A,0xF6DB,0xF6DC,0xF78B,0xF78C, +0xF78D,0xF78E,0xF6DD,0xF6DE,0xCFCA,0xF78F,0xF6DF,0xF6E0, +0xF6E1,0xF6E2,0xF6E3,0xF6E4,0xC0F0,0xF6E5,0xF6E6,0xF6E7, +0xF6E8,0xF6E9,0xF790,0xF6EA,0xF791,0xF6EB,0xF6EC,0xF792, +0xF6ED,0xF6EE,0xF6EF,0xF6F0,0xF6F1,0xF6F2,0xF6F3,0xF6F4, +0xBEA8,0xF793,0xF6F5,0xF6F6,0xF6F7,0xF6F8,0xF794,0xF795, +0xF796,0xF797,0xF798,0xC8FA,0xF6F9,0xF6FA,0xF6FB,0xF6FC, +0xF799,0xF79A,0xF6FD,0xF6FE,0xF7A1,0xF7A2,0xF7A3,0xF7A4, +0xF7A5,0xF79B,0xF79C,0xF7A6,0xF7A7,0xF7A8,0xB1EE,0xF7A9, +0xF7AA,0xF7AB,0xF79D,0xF79E,0xF7AC,0xF7AD,0xC1DB,0xF7AE, +0xF79F,0xF7A0,0xF7AF,0xF840,0xF841,0xF842,0xF843,0xF844, +0xF845,0xF846,0xF847,0xF848,0xF849,0xF84A,0xF84B,0xF84C, +0xF84D,0xF84E,0xF84F,0xF850,0xF851,0xF852,0xF853,0xF854, +0xF855,0xF856,0xF857,0xF858,0xF859,0xF85A,0xF85B,0xF85C, +0xF85D,0xF85E,0xF85F,0xF860,0xF861,0xF862,0xF863,0xF864, +0xF865,0xF866,0xF867,0xF868,0xF869,0xF86A,0xF86B,0xF86C, +0xF86D,0xF86E,0xF86F,0xF870,0xF871,0xF872,0xF873,0xF874, +0xF875,0xF876,0xF877,0xF878,0xF879,0xF87A,0xF87B,0xF87C, +0xF87D,0xF87E,0xF880,0xF881,0xF882,0xF883,0xF884,0xF885, +0xF886,0xF887,0xF888,0xF889,0xF88A,0xF88B,0xF88C,0xF88D, +0xF88E,0xF88F,0xF890,0xF891,0xF892,0xF893,0xF894,0xF895, +0xF896,0xF897,0xF898,0xF899,0xF89A,0xF89B,0xF89C,0xF89D, +0xF89E,0xF89F,0xF8A0,0xF940,0xF941,0xF942,0xF943,0xF944, +0xF945,0xF946,0xF947,0xF948,0xF949,0xF94A,0xF94B,0xF94C, +0xF94D,0xF94E,0xF94F,0xF950,0xF951,0xF952,0xF953,0xF954, +0xF955,0xF956,0xF957,0xF958,0xF959,0xF95A,0xF95B,0xF95C, +0xF95D,0xF95E,0xF95F,0xF960,0xF961,0xF962,0xF963,0xF964, +0xF965,0xF966,0xF967,0xF968,0xF969,0xF96A,0xF96B,0xF96C, +0xF96D,0xF96E,0xF96F,0xF970,0xF971,0xF972,0xF973,0xF974, +0xF975,0xF976,0xF977,0xF978,0xF979,0xF97A,0xF97B,0xF97C, +0xF97D,0xF97E,0xF980,0xF981,0xF982,0xF983,0xF984,0xF985, +0xF986,0xF987,0xF988,0xF989,0xF98A,0xF98B,0xF98C,0xF98D, +0xF98E,0xF98F,0xF990,0xF991,0xF992,0xF993,0xF994,0xF995, +0xF996,0xF997,0xF998,0xF999,0xF99A,0xF99B,0xF99C,0xF99D, +0xF99E,0xF99F,0xF9A0,0xFA40,0xFA41,0xFA42,0xFA43,0xFA44, +0xFA45,0xFA46,0xFA47,0xFA48,0xFA49,0xFA4A,0xFA4B,0xFA4C, +0xFA4D,0xFA4E,0xFA4F,0xFA50,0xFA51,0xFA52,0xFA53,0xFA54, +0xFA55,0xFA56,0xFA57,0xFA58,0xFA59,0xFA5A,0xFA5B,0xFA5C, +0xFA5D,0xFA5E,0xFA5F,0xFA60,0xFA61,0xFA62,0xFA63,0xFA64, +0xFA65,0xFA66,0xFA67,0xFA68,0xFA69,0xFA6A,0xFA6B,0xFA6C, +0xFA6D,0xFA6E,0xFA6F,0xFA70,0xFA71,0xFA72,0xFA73,0xFA74, +0xFA75,0xFA76,0xFA77,0xFA78,0xFA79,0xFA7A,0xFA7B,0xFA7C, +0xFA7D,0xFA7E,0xFA80,0xFA81,0xFA82,0xFA83,0xFA84,0xFA85, +0xFA86,0xFA87,0xFA88,0xFA89,0xFA8A,0xFA8B,0xFA8C,0xFA8D, +0xFA8E,0xFA8F,0xFA90,0xFA91,0xFA92,0xFA93,0xFA94,0xFA95, +0xFA96,0xFA97,0xFA98,0xFA99,0xFA9A,0xFA9B,0xFA9C,0xFA9D, +0xFA9E,0xFA9F,0xFAA0,0xFB40,0xFB41,0xFB42,0xFB43,0xFB44, +0xFB45,0xFB46,0xFB47,0xFB48,0xFB49,0xFB4A,0xFB4B,0xFB4C, +0xFB4D,0xFB4E,0xFB4F,0xFB50,0xFB51,0xFB52,0xFB53,0xFB54, +0xFB55,0xFB56,0xFB57,0xFB58,0xFB59,0xFB5A,0xFB5B,0xC4F1, +0xF0AF,0xBCA6,0xF0B0,0xC3F9,0xFB5C,0xC5B8,0xD1BB,0xFB5D, +0xF0B1,0xF0B2,0xF0B3,0xF0B4,0xF0B5,0xD1BC,0xFB5E,0xD1EC, +0xFB5F,0xF0B7,0xF0B6,0xD4A7,0xFB60,0xCDD2,0xF0B8,0xF0BA, +0xF0B9,0xF0BB,0xF0BC,0xFB61,0xFB62,0xB8EB,0xF0BD,0xBAE8, +0xFB63,0xF0BE,0xF0BF,0xBEE9,0xF0C0,0xB6EC,0xF0C1,0xF0C2, +0xF0C3,0xF0C4,0xC8B5,0xF0C5,0xF0C6,0xFB64,0xF0C7,0xC5F4, +0xFB65,0xF0C8,0xFB66,0xFB67,0xFB68,0xF0C9,0xFB69,0xF0CA, +0xF7BD,0xFB6A,0xF0CB,0xF0CC,0xF0CD,0xFB6B,0xF0CE,0xFB6C, +0xFB6D,0xFB6E,0xFB6F,0xF0CF,0xBAD7,0xFB70,0xF0D0,0xF0D1, +0xF0D2,0xF0D3,0xF0D4,0xF0D5,0xF0D6,0xF0D8,0xFB71,0xFB72, +0xD3A5,0xF0D7,0xFB73,0xF0D9,0xFB74,0xFB75,0xFB76,0xFB77, +0xFB78,0xFB79,0xFB7A,0xFB7B,0xFB7C,0xFB7D,0xF5BA,0xC2B9, +0xFB7E,0xFB80,0xF7E4,0xFB81,0xFB82,0xFB83,0xFB84,0xF7E5, +0xF7E6,0xFB85,0xFB86,0xF7E7,0xFB87,0xFB88,0xFB89,0xFB8A, +0xFB8B,0xFB8C,0xF7E8,0xC2B4,0xFB8D,0xFB8E,0xFB8F,0xFB90, +0xFB91,0xFB92,0xFB93,0xFB94,0xFB95,0xF7EA,0xFB96,0xF7EB, +0xFB97,0xFB98,0xFB99,0xFB9A,0xFB9B,0xFB9C,0xC2F3,0xFB9D, +0xFB9E,0xFB9F,0xFBA0,0xFC40,0xFC41,0xFC42,0xFC43,0xFC44, +0xFC45,0xFC46,0xFC47,0xFC48,0xF4F0,0xFC49,0xFC4A,0xFC4B, +0xF4EF,0xFC4C,0xFC4D,0xC2E9,0xFC4E,0xF7E1,0xF7E2,0xFC4F, +0xFC50,0xFC51,0xFC52,0xFC53,0xBBC6,0xFC54,0xFC55,0xFC56, +0xFC57,0xD9E4,0xFC58,0xFC59,0xFC5A,0xCAF2,0xC0E8,0xF0A4, +0xFC5B,0xBADA,0xFC5C,0xFC5D,0xC7AD,0xFC5E,0xFC5F,0xFC60, +0xC4AC,0xFC61,0xFC62,0xF7EC,0xF7ED,0xF7EE,0xFC63,0xF7F0, +0xF7EF,0xFC64,0xF7F1,0xFC65,0xFC66,0xF7F4,0xFC67,0xF7F3, +0xFC68,0xF7F2,0xF7F5,0xFC69,0xFC6A,0xFC6B,0xFC6C,0xF7F6, +0xFC6D,0xFC6E,0xFC6F,0xFC70,0xFC71,0xFC72,0xFC73,0xFC74, +0xFC75,0xEDE9,0xFC76,0xEDEA,0xEDEB,0xFC77,0xF6BC,0xFC78, +0xFC79,0xFC7A,0xFC7B,0xFC7C,0xFC7D,0xFC7E,0xFC80,0xFC81, +0xFC82,0xFC83,0xFC84,0xF6BD,0xFC85,0xF6BE,0xB6A6,0xFC86, +0xD8BE,0xFC87,0xFC88,0xB9C4,0xFC89,0xFC8A,0xFC8B,0xD8BB, +0xFC8C,0xDCB1,0xFC8D,0xFC8E,0xFC8F,0xFC90,0xFC91,0xFC92, +0xCAF3,0xFC93,0xF7F7,0xFC94,0xFC95,0xFC96,0xFC97,0xFC98, +0xFC99,0xFC9A,0xFC9B,0xFC9C,0xF7F8,0xFC9D,0xFC9E,0xF7F9, +0xFC9F,0xFCA0,0xFD40,0xFD41,0xFD42,0xFD43,0xFD44,0xF7FB, +0xFD45,0xF7FA,0xFD46,0xB1C7,0xFD47,0xF7FC,0xF7FD,0xFD48, +0xFD49,0xFD4A,0xFD4B,0xFD4C,0xF7FE,0xFD4D,0xFD4E,0xFD4F, +0xFD50,0xFD51,0xFD52,0xFD53,0xFD54,0xFD55,0xFD56,0xFD57, +0xC6EB,0xECB4,0xFD58,0xFD59,0xFD5A,0xFD5B,0xFD5C,0xFD5D, +0xFD5E,0xFD5F,0xFD60,0xFD61,0xFD62,0xFD63,0xFD64,0xFD65, +0xFD66,0xFD67,0xFD68,0xFD69,0xFD6A,0xFD6B,0xFD6C,0xFD6D, +0xFD6E,0xFD6F,0xFD70,0xFD71,0xFD72,0xFD73,0xFD74,0xFD75, +0xFD76,0xFD77,0xFD78,0xFD79,0xFD7A,0xFD7B,0xFD7C,0xFD7D, +0xFD7E,0xFD80,0xFD81,0xFD82,0xFD83,0xFD84,0xFD85,0xB3DD, +0xF6B3,0xFD86,0xFD87,0xF6B4,0xC1E4,0xF6B5,0xF6B6,0xF6B7, +0xF6B8,0xF6B9,0xF6BA,0xC8A3,0xF6BB,0xFD88,0xFD89,0xFD8A, +0xFD8B,0xFD8C,0xFD8D,0xFD8E,0xFD8F,0xFD90,0xFD91,0xFD92, +0xFD93,0xC1FA,0xB9A8,0xEDE8,0xFD94,0xFD95,0xFD96,0xB9EA, +0xD9DF,0xFD97,0xFD98,0xFD99,0xFD9A,0xFD9B}; + +/* page 7 0xF92C-0xFA29 */ +static uint16 tab_uni_gbk7[]={ +0xFD9C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xFD9D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFD9E, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xFD9F, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xFDA0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xFE40,0xFE41,0xFE42,0xFE43, 0,0xFE44, 0,0xFE45, +0xFE46, 0, 0, 0,0xFE47, 0, 0, 0, + 0, 0, 0,0xFE48,0xFE49,0xFE4A, 0,0xFE4B, +0xFE4C, 0, 0,0xFE4D,0xFE4E,0xFE4F}; + +/* page 8 0xFE30-0xFFE5 */ +static uint16 tab_uni_gbk8[]={ +0xA955,0xA6F2, 0,0xA6F4,0xA6F5,0xA6E0,0xA6E1,0xA6F0, +0xA6F1,0xA6E2,0xA6E3,0xA6EE,0xA6EF,0xA6E6,0xA6E7,0xA6E4, +0xA6E5,0xA6E8,0xA6E9,0xA6EA,0xA6EB, 0, 0, 0, + 0,0xA968,0xA969,0xA96A,0xA96B,0xA96C,0xA96D,0xA96E, +0xA96F,0xA970,0xA971, 0,0xA972,0xA973,0xA974,0xA975, + 0,0xA976,0xA977,0xA978,0xA979,0xA97A,0xA97B,0xA97C, +0xA97D,0xA97E,0xA980,0xA981,0xA982,0xA983,0xA984, 0, +0xA985,0xA986,0xA987,0xA988, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xA3A1,0xA3A2,0xA3A3,0xA1E7,0xA3A5,0xA3A6,0xA3A7, +0xA3A8,0xA3A9,0xA3AA,0xA3AB,0xA3AC,0xA3AD,0xA3AE,0xA3AF, +0xA3B0,0xA3B1,0xA3B2,0xA3B3,0xA3B4,0xA3B5,0xA3B6,0xA3B7, +0xA3B8,0xA3B9,0xA3BA,0xA3BB,0xA3BC,0xA3BD,0xA3BE,0xA3BF, +0xA3C0,0xA3C1,0xA3C2,0xA3C3,0xA3C4,0xA3C5,0xA3C6,0xA3C7, +0xA3C8,0xA3C9,0xA3CA,0xA3CB,0xA3CC,0xA3CD,0xA3CE,0xA3CF, +0xA3D0,0xA3D1,0xA3D2,0xA3D3,0xA3D4,0xA3D5,0xA3D6,0xA3D7, +0xA3D8,0xA3D9,0xA3DA,0xA3DB,0xA3DC,0xA3DD,0xA3DE,0xA3DF, +0xA3E0,0xA3E1,0xA3E2,0xA3E3,0xA3E4,0xA3E5,0xA3E6,0xA3E7, +0xA3E8,0xA3E9,0xA3EA,0xA3EB,0xA3EC,0xA3ED,0xA3EE,0xA3EF, +0xA3F0,0xA3F1,0xA3F2,0xA3F3,0xA3F4,0xA3F5,0xA3F6,0xA3F7, +0xA3F8,0xA3F9,0xA3FA,0xA3FB,0xA3FC,0xA3FD,0xA1AB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xA1E9,0xA1EA,0xA956,0xA3FE,0xA957,0xA3A4}; + +static int func_uni_gbk_onechar(int code){ + if ((code>=0x00A4)&&(code<=0x0451)) + return(tab_uni_gbk0[code-0x00A4]); + if ((code>=0x2010)&&(code<=0x2312)) + return(tab_uni_gbk1[code-0x2010]); + if ((code>=0x2460)&&(code<=0x2642)) + return(tab_uni_gbk2[code-0x2460]); + if ((code>=0x3000)&&(code<=0x3129)) + return(tab_uni_gbk3[code-0x3000]); + if ((code>=0x3220)&&(code<=0x32A3)) + return(tab_uni_gbk4[code-0x3220]); + if ((code>=0x338E)&&(code<=0x33D5)) + return(tab_uni_gbk5[code-0x338E]); + if ((code>=0x4E00)&&(code<=0x9FA5)) + return(tab_uni_gbk6[code-0x4E00]); + if ((code>=0xF92C)&&(code<=0xFA29)) + return(tab_uni_gbk7[code-0xF92C]); + if ((code>=0xFE30)&&(code<=0xFFE5)) + return(tab_uni_gbk8[code-0xFE30]); + return(0); +} + +static int +my_wc_mb_gbk(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + int code; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((uint) wc < 0x80) + { + s[0]= (uchar) wc; + return 1; + } + + if (!(code=func_uni_gbk_onechar(wc))) + return MY_CS_ILUNI; + + if (s+2>e) + return MY_CS_TOOSMALL2; + + s[0]=code>>8; + s[1]=code&0xFF; + return 2; +} + +static int +my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e) +{ + int hi; + + if (s >= e) + return MY_CS_TOOSMALL; + + hi=s[0]; + + if (hi<0x80) + { + pwc[0]=hi; + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + if (!(pwc[0]=func_gbk_uni_onechar( (hi<<8) + s[1]))) + return -2; + + return 2; + +} + + +/* + Returns well formed length of a GBK string. +*/ +static +size_t my_well_formed_len_gbk(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) +{ + const char *b0= b; + const char *emb= e - 1; /* Last possible end of an MB character */ + + *error= 0; + while (pos-- && b < e) + { + if ((uchar) b[0] < 128) + { + /* Single byte ascii character */ + b++; + } + else if ((b < emb) && isgbkcode((uchar)*b, (uchar)b[1])) + { + /* Double byte character */ + b+= 2; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (size_t) (b - b0); +} + + + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_gbk, + my_strnncollsp_gbk, + my_strnxfrm_gbk, + my_strnxfrmlen_simple, + my_like_range_gbk, + my_wildcmp_mb, + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + ismbchar_gbk, + mbcharlen_gbk, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_gbk, + my_lengthsp_8bit, + my_numcells_8bit, + my_mb_wc_gbk, + my_wc_mb_gbk, + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + +CHARSET_INFO my_charset_gbk_chinese_ci= +{ + 28,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ + "gbk", /* cs name */ + "gbk_chinese_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gbk, + to_lower_gbk, + to_upper_gbk, + sort_order_gbk, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + +CHARSET_INFO my_charset_gbk_bin= +{ + 87,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "gbk", /* cs name */ + "gbk_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_gbk, + to_lower_gbk, + to_upper_gbk, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_mb_bin_handler +}; + + +#endif diff --git a/externals/mysql/strings/ctype-latin1.c b/externals/mysql/strings/ctype-latin1.c new file mode 100644 index 0000000..e2a52b5 --- /dev/null +++ b/externals/mysql/strings/ctype-latin1.c @@ -0,0 +1,791 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +static uchar ctype_latin1[] = { + 0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16, + 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, + 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, + 16, 0, 16, 2, 16, 16, 16, 16, 16, 16, 1, 16, 1, 0, 1, 0, + 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, 2, 0, 2, 1, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2 +}; + +static uchar to_lower_latin1[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95, + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,215,248,249,250,251,252,253,254,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + +static uchar to_upper_latin1[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255 +}; + +static uchar sort_order_latin1[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79, 93,215,216, 85, 85, 85, 89, 89,222,223, + 65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79, 93,247,216, 85, 85, 85, 89, 89,222,255 +}; + +/* + WL#1494 notes: + + We'll use cp1252 instead of iso-8859-1. + cp1252 contains printable characters in the range 0x80-0x9F. + In ISO 8859-1, these code points have no associated printable + characters. Therefore, by converting from CP1252 to ISO 8859-1, + one would lose the euro (for instance). Since most people are + unaware of the difference, and since we don't really want a + "Windows ANSI" to differ from a "Unix ANSI", we will: + + - continue to pretend the latin1 character set is ISO 8859-1 + - actually allow the storage of euro etc. so it's actually cp1252 + + Also we'll map these five undefined cp1252 character: + 0x81, 0x8D, 0x8F, 0x90, 0x9D + into corresponding control characters: + U+0081, U+008D, U+008F, U+0090, U+009D. + like ISO-8859-1 does. Otherwise, loading "mysqldump" + output doesn't reproduce these undefined characters. +*/ + +unsigned short cs_to_uni[256]={ +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC,0x0081,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, +0x02C6,0x2030,0x0160,0x2039,0x0152,0x008D,0x017D,0x008F, +0x0090,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, +0x02DC,0x2122,0x0161,0x203A,0x0153,0x009D,0x017E,0x0178, +0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF +}; +uchar pl00[256]={ +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, +0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, +0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, +0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, +0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, +0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, +0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, +0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, +0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x00,0x81,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x8D,0x00,0x8F, +0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x9D,0x00,0x00, +0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, +0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, +0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, +0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, +0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, +0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, +0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, +0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, +0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, +0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, +0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, +0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; +uchar pl01[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x8C,0x9C,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x8A,0x9A,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x9F,0x00,0x00,0x00,0x00,0x8E,0x9E,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x83,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +uchar pl02[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x98,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +uchar pl20[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x96,0x97,0x00,0x00,0x00, +0x91,0x92,0x82,0x00,0x93,0x94,0x84,0x00, +0x86,0x87,0x95,0x00,0x00,0x00,0x85,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x8B,0x9B,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +uchar pl21[256]={ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x99,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; +uchar *uni_to_cs[256]={ +pl00,pl01,pl02,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +pl20,pl21,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL +}; + +static +int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *wc, + const uchar *str, + const uchar *end __attribute__((unused))) +{ + if (str >= end) + return MY_CS_TOOSMALL; + + *wc=cs_to_uni[*str]; + return (!wc[0] && str[0]) ? -1 : 1; +} + +static +int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, + uchar *str, + uchar *end __attribute__((unused))) +{ + uchar *pl; + + if (str >= end) + return MY_CS_TOOSMALL; + + pl= uni_to_cs[(wc>>8) & 0xFF]; + str[0]= pl ? pl[wc & 0xFF] : '\0'; + return (!str[0] && wc) ? MY_CS_ILUNI : 1; +} + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + NULL, + my_mbcharlen_8bit, + my_numchars_8bit, + my_charpos_8bit, + my_well_formed_len_8bit, + my_lengthsp_8bit, + my_numcells_8bit, + my_mb_wc_latin1, + my_wc_mb_latin1, + my_mb_ctype_8bit, + my_caseup_str_8bit, + my_casedn_str_8bit, + my_caseup_8bit, + my_casedn_8bit, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + +CHARSET_INFO my_charset_latin1= +{ + 8,0,0, /* number */ + MY_CS_COMPILED | MY_CS_PRIMARY, /* state */ + "latin1", /* cs name */ + "latin1_swedish_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + sort_order_latin1, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + cs_to_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_8bit_simple_ci_handler +}; + + + + +/* + * This file is the latin1 character set with German sorting + * + * The modern sort order is used, where: + * + * 'ä' -> "ae" + * 'ö' -> "oe" + * 'ü' -> "ue" + * 'ß' -> "ss" + */ + + +/* + * This is a simple latin1 mapping table, which maps all accented + * characters to their non-accented equivalents. Note: in this + * table, 'ä' is mapped to 'A', '˙' is mapped to 'Y', etc. - all + * accented characters except the following are treated the same way. + * Ü, ü, Ö, ö, Ä, ä + */ + +static uchar sort_order_latin1_de[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 65, 65, 65, 65,196, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79,214,215,216, 85, 85, 85,220, 89,222,223, + 65, 65, 65, 65,196, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79,214,247,216, 85, 85, 85,220, 89,222, 89 +}; + + +/* + same as sort_order_latin_de, but maps ALL accented chars to unaccented ones +*/ + +uchar combo1map[]={ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 65, 65, 65, 65, 65, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79, 79,215,216, 85, 85, 85, 85, 89,222, 83, + 65, 65, 65, 65, 65, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79, 79,247,216, 85, 85, 85, 85, 89,222, 89 +}; + +uchar combo2map[]={ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0,69, 0, 0,83, 0, 0, 0, 0,69, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0,69, 0, 0, 0, 0 +}; + + +/* + Some notes about the following comparison rules: + By definition, my_strnncoll_latin_de must works exactly as if had called + my_strnxfrm_latin_de() on both strings and compared the result strings. + + This means that: + Ä must also matches ÁE and Ač, because my_strxn_frm_latin_de() will convert + both to AE. + + The other option would be to not do any accent removal in + sort_order_latin_de[] at all +*/ + + +static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool b_is_prefix) +{ + const uchar *a_end= a + a_length; + const uchar *b_end= b + b_length; + uchar a_char, a_extend= 0, b_char, b_extend= 0; + + while ((a < a_end || a_extend) && (b < b_end || b_extend)) + { + if (a_extend) + { + a_char=a_extend; a_extend=0; + } + else + { + a_extend=combo2map[*a]; + a_char=combo1map[*a++]; + } + if (b_extend) + { + b_char=b_extend; b_extend=0; + } + else + { + b_extend=combo2map[*b]; + b_char=combo1map[*b++]; + } + if (a_char != b_char) + return (int) a_char - (int) b_char; + } + /* + A simple test of string lengths won't work -- we test to see + which string ran out first + */ + return ((a < a_end || a_extend) ? (b_is_prefix ? 0 : 1) : + (b < b_end || b_extend) ? -1 : 0); +} + + +static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + const uchar *a_end= a + a_length, *b_end= b + b_length; + uchar a_char, a_extend= 0, b_char, b_extend= 0; + int res; + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + while ((a < a_end || a_extend) && (b < b_end || b_extend)) + { + if (a_extend) + { + a_char=a_extend; + a_extend= 0; + } + else + { + a_extend= combo2map[*a]; + a_char= combo1map[*a++]; + } + if (b_extend) + { + b_char= b_extend; + b_extend= 0; + } + else + { + b_extend= combo2map[*b]; + b_char= combo1map[*b++]; + } + if (a_char != b_char) + return (int) a_char - (int) b_char; + } + /* Check if double character last */ + if (a_extend) + return 1; + if (b_extend) + return -1; + + res= 0; + if (a != a_end || b != b_end) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a == a_end) + { + /* put shorter key in a */ + a_end= b_end; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for ( ; a < a_end ; a++) + { + if (*a != ' ') + return (*a < ' ') ? -swap : swap; + } + } + return res; +} + + +static size_t +my_strnxfrm_latin1_de(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar* src, size_t srclen, uint flags) +{ + uchar *de= dst + dstlen; + const uchar *se= src + srclen; + uchar *d0= dst; + for (; src < se && dst < de && nweights; src++, nweights--) + { + uchar chr= combo1map[*src]; + *dst++= chr; + if ((chr= combo2map[*src]) && dst < de && nweights > 1) + { + *dst++= chr; + nweights--; + } + } + return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0); +} + + +void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) +{ + const uchar *end; + /* + Remove end space. We have to do this to be able to compare + 'AE' and 'Ä' as identical + */ + end= skip_trailing_space(key, len); + + for (; key < end ; key++) + { + uint X= (uint) combo1map[(uint) *key]; + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * X) + (nr1[0] << 8); + nr2[0]+=3; + if ((X= combo2map[*key])) + { + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * X) + (nr1[0] << 8); + nr2[0]+=3; + } + } +} + + +static MY_COLLATION_HANDLER my_collation_german2_ci_handler= +{ + NULL, /* init */ + my_strnncoll_latin1_de, + my_strnncollsp_latin1_de, + my_strnxfrm_latin1_de, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_8bit, + my_strcasecmp_8bit, + my_instr_simple, + my_hash_sort_latin1_de, + my_propagate_complex +}; + + +CHARSET_INFO my_charset_latin1_german2_ci= +{ + 31,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ + "latin1", /* cs name */ + "latin1_german2_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + sort_order_latin1_de, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + cs_to_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 2, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 247, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_german2_ci_handler +}; + + +CHARSET_INFO my_charset_latin1_bin= +{ + 47,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "latin1", /* cs name */ + "latin1_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + cs_to_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_8bit_bin_handler +}; + diff --git a/externals/mysql/strings/ctype-mb.c b/externals/mysql/strings/ctype-mb.c new file mode 100644 index 0000000..d041542 --- /dev/null +++ b/externals/mysql/strings/ctype-mb.c @@ -0,0 +1,1150 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include "m_ctype.h" +#include "m_string.h" + +#ifdef USE_MB + + +size_t my_caseup_str_mb(CHARSET_INFO * cs, char *str) +{ + register uint32 l; + register uchar *map= cs->to_upper; + char *str_orig= str; + + while (*str) + { + /* Pointing after the '\0' is safe here. */ + if ((l= my_ismbchar(cs, str, str + cs->mbmaxlen))) + str+= l; + else + { + *str= (char) map[(uchar)*str]; + str++; + } + } + return (size_t) (str - str_orig); +} + + +size_t my_casedn_str_mb(CHARSET_INFO * cs, char *str) +{ + register uint32 l; + register uchar *map= cs->to_lower; + char *str_orig= str; + + while (*str) + { + /* Pointing after the '\0' is safe here. */ + if ((l= my_ismbchar(cs, str, str + cs->mbmaxlen))) + str+= l; + else + { + *str= (char) map[(uchar)*str]; + str++; + } + } + return (size_t) (str - str_orig); +} + + +size_t my_caseup_mb(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + register uint32 l; + register char *srcend= src + srclen; + register uchar *map= cs->to_upper; + + DBUG_ASSERT(src == dst && srclen == dstlen); + while (src < srcend) + { + if ((l=my_ismbchar(cs, src, srcend))) + src+= l; + else + { + *src=(char) map[(uchar) *src]; + src++; + } + } + return srclen; +} + + +size_t my_casedn_mb(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + register uint32 l; + register char *srcend= src + srclen; + register uchar *map=cs->to_lower; + + DBUG_ASSERT(src == dst && srclen == dstlen); + while (src < srcend) + { + if ((l= my_ismbchar(cs, src, srcend))) + src+= l; + else + { + *src= (char) map[(uchar)*src]; + src++; + } + } + return srclen; +} + + +/* + my_strcasecmp_mb() returns 0 if strings are equal, non-zero otherwise. + */ + +int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t) +{ + register uint32 l; + register uchar *map=cs->to_upper; + + while (*s && *t) + { + /* Pointing after the '\0' is safe here. */ + if ((l=my_ismbchar(cs, s, s + cs->mbmaxlen))) + { + while (l--) + if (*s++ != *t++) + return 1; + } + else if (my_mbcharlen(cs, *t) > 1) + return 1; + else if (map[(uchar) *s++] != map[(uchar) *t++]) + return 1; + } + /* At least one of '*s' and '*t' is zero here. */ + return (*t != *s); +} + + +/* +** Compare string against string with wildcard +** 0 if matched +** -1 if not matched with wildcard +** 1 if matched with wildcard +*/ + +#define INC_PTR(cs,A,B) A+=(my_ismbchar(cs,A,B) ? my_ismbchar(cs,A,B) : 1) + +#define likeconv(s,A) (uchar) (s)->sort_order[(uchar) (A)] + +int my_wildcmp_mb(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + int result= -1; /* Not found, using wildcards */ + + while (wildstr != wildend) + { + while (*wildstr != w_many && *wildstr != w_one) + { + int l; + if (*wildstr == escape && wildstr+1 != wildend) + wildstr++; + if ((l = my_ismbchar(cs, wildstr, wildend))) + { + if (str+l > str_end || memcmp(str, wildstr, l) != 0) + return 1; + str += l; + wildstr += l; + } + else + if (str == str_end || likeconv(cs,*wildstr++) != likeconv(cs,*str++)) + return(1); /* No match */ + if (wildstr == wildend) + return (str != str_end); /* Match if both are at end */ + result=1; /* Found an anchor char */ + } + if (*wildstr == w_one) + { + do + { + if (str == str_end) /* Skip one char if possible */ + return (result); + INC_PTR(cs,str,str_end); + } while (++wildstr < wildend && *wildstr == w_one); + if (wildstr == wildend) + break; + } + if (*wildstr == w_many) + { /* Found w_many */ + uchar cmp; + const char* mb = wildstr; + int mb_len=0; + + wildstr++; + /* Remove any '%' and '_' from the wild search string */ + for (; wildstr != wildend ; wildstr++) + { + if (*wildstr == w_many) + continue; + if (*wildstr == w_one) + { + if (str == str_end) + return (-1); + INC_PTR(cs,str,str_end); + continue; + } + break; /* Not a wild character */ + } + if (wildstr == wildend) + return(0); /* Ok if w_many is last */ + if (str == str_end) + return -1; + + if ((cmp= *wildstr) == escape && wildstr+1 != wildend) + cmp= *++wildstr; + + mb=wildstr; + mb_len= my_ismbchar(cs, wildstr, wildend); + INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ + cmp=likeconv(cs,cmp); + do + { + for (;;) + { + if (str >= str_end) + return -1; + if (mb_len) + { + if (str+mb_len <= str_end && memcmp(str, mb, mb_len) == 0) + { + str += mb_len; + break; + } + } + else if (!my_ismbchar(cs, str, str_end) && + likeconv(cs,*str) == cmp) + { + str++; + break; + } + INC_PTR(cs,str, str_end); + } + { + int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one, + w_many); + if (tmp <= 0) + return (tmp); + } + } while (str != str_end && wildstr[0] != w_many); + return(-1); + } + } + return (str != str_end ? 1 : 0); +} + + +size_t my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), + const char *pos, const char *end) +{ + register size_t count= 0; + while (pos < end) + { + uint mb_len; + pos+= (mb_len= my_ismbchar(cs,pos,end)) ? mb_len : 1; + count++; + } + return count; +} + + +size_t my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), + const char *pos, const char *end, size_t length) +{ + const char *start= pos; + while (length && pos < end) + { + uint mb_len; + pos+= (mb_len= my_ismbchar(cs, pos, end)) ? mb_len : 1; + length--; + } + return (size_t) (length ? end+2-start : pos-start); +} + + +size_t my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, + size_t pos, int *error) +{ + const char *b_start= b; + *error= 0; + while (pos) + { + my_wc_t wc; + int mb_len; + + if ((mb_len= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0) + { + *error= b < e ? 1 : 0; + break; + } + b+= mb_len; + pos--; + } + return (size_t) (b - b_start); +} + + +uint my_instr_mb(CHARSET_INFO *cs, + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch) +{ + register const char *end, *b0; + int res= 0; + + if (s_length <= b_length) + { + if (!s_length) + { + if (nmatch) + { + match->beg= 0; + match->end= 0; + match->mb_len= 0; + } + return 1; /* Empty string is always found */ + } + + b0= b; + end= b+b_length-s_length+1; + + while (b < end) + { + int mb_len; + + if (!cs->coll->strnncoll(cs, (uchar*) b, s_length, + (uchar*) s, s_length, 0)) + { + if (nmatch) + { + match[0].beg= 0; + match[0].end= (size_t) (b-b0); + match[0].mb_len= res; + if (nmatch > 1) + { + match[1].beg= match[0].end; + match[1].end= match[0].end+s_length; + match[1].mb_len= 0; /* Not computed */ + } + } + return 2; + } + mb_len= (mb_len= my_ismbchar(cs, b, end)) ? mb_len : 1; + b+= mb_len; + b_length-= mb_len; + res++; + } + } + return 0; +} + + +/* BINARY collations handlers for MB charsets */ + +int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + size_t len=min(slen,tlen); + int cmp= memcmp(s,t,len); + return cmp ? cmp : (int) ((t_is_prefix ? len : slen) - tlen); +} + + +/* + Compare two strings. + + SYNOPSIS + my_strnncollsp_mb_bin() + cs Chararacter set + s String to compare + slen Length of 's' + t String to compare + tlen Length of 't' + diff_if_only_endspace_difference + Set to 1 if the strings should be regarded as different + if they only difference in end space + + NOTE + This function is used for character strings with binary collations. + The shorter string is extended with end space to be as long as the longer + one. + + RETURN + A negative number if s < t + A positive number if s > t + 0 if strings are equal +*/ + +int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + const uchar *end; + size_t length; + int res; + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + end= a + (length= min(a_length, b_length)); + while (a < end) + { + if (*a++ != *b++) + return ((int) a[-1] - (int) b[-1]); + } + res= 0; + if (a_length != b_length) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a_length < b_length) + { + /* put shorter key in s */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (end= a + a_length-length; a < end ; a++) + { + if (*a != ' ') + return (*a < ' ') ? -swap : swap; + } + } + return res; +} + + +/* + Copy one non-ascii character. + "dst" must have enough room for the character. + Note, we don't use sort_order[] in this macros. + This is correct even for case insensitive collations: + - basic Latin letters are processed outside this macros; + - for other characters sort_order[x] is equal to x. +*/ +#define my_strnxfrm_mb_non_ascii_char(cs, dst, src, se) \ +{ \ + switch (cs->cset->ismbchar(cs, (const char*) src, (const char*) se)) { \ + case 4: \ + *dst++= *src++; \ + /* fall through */ \ + case 3: \ + *dst++= *src++; \ + /* fall through */ \ + case 2: \ + *dst++= *src++; \ + /* fall through */ \ + case 0: \ + *dst++= *src++; /* byte in range 0x80..0xFF which is not MB head */ \ + } \ +} + + +/* + For character sets with two or three byte multi-byte + characters having multibyte weights *equal* to their codes: + cp932, euckr, gb2312, sjis, eucjpms, ujis. +*/ +size_t +my_strnxfrm_mb(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *d0= dst; + uchar *de= dst + dstlen; + const uchar *se= src + srclen; + const uchar *sort_order= cs->sort_order; + + DBUG_ASSERT(cs->mbmaxlen <= 4); + + /* + If "srclen" is smaller than both "dstlen" and "nweights" + then we can run a simplified loop - + without checking "nweights" and "de". + */ + if (dstlen >= srclen && nweights >= srclen) + { + if (sort_order) + { + /* Optimized version for a case insensitive collation */ + for (; src < se; nweights--) + { + if (*src < 128) /* quickly catch ASCII characters */ + *dst++= sort_order[*src++]; + else + my_strnxfrm_mb_non_ascii_char(cs, dst, src, se); + } + } + else + { + /* Optimized version for a case sensitive collation (no sort_order) */ + for (; src < se; nweights--) + { + if (*src < 128) /* quickly catch ASCII characters */ + *dst++= *src++; + else + my_strnxfrm_mb_non_ascii_char(cs, dst, src, se); + } + } + goto pad; + } + + /* + A thourough loop, checking all possible limits: + "se", "nweights" and "de". + */ + for (; src < se && nweights && dst < de; nweights--) + { + int chlen; + if (*src < 128 || + !(chlen= cs->cset->ismbchar(cs, (const char*) src, (const char*) se))) + { + /* Single byte character */ + *dst++= sort_order ? sort_order[*src++] : *src++; + } + else + { + /* Multi-byte character */ + int len= (dst + chlen <= de) ? chlen : de - dst; + memcpy(dst, src, len); + dst+= len; + src+= len; + } + } + +pad: + return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0); +} + + +int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)), + const char *s, const char *t) +{ + return strcmp(s,t); +} + + +void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2) +{ + const uchar *pos = key; + + /* + Remove trailing spaces. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + key= skip_trailing_space(key, len); + + for (; pos < (uchar*) key ; pos++) + { + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * + ((uint)*pos)) + (nr1[0] << 8); + nr2[0]+=3; + } +} + + +/* + Fill the given buffer with 'maximum character' for given charset + SYNOPSIS + pad_max_char() + cs Character set + str Start of buffer to fill + end End of buffer to fill + + DESCRIPTION + Write max key: + - for non-Unicode character sets: + just set to 255. + - for Unicode character set (utf-8): + create a buffer with multibyte representation of the max_sort_char + character, and copy it into max_str in a loop. +*/ +static void pad_max_char(CHARSET_INFO *cs, char *str, char *end) +{ + char buf[10]; + char buflen; + + if (!(cs->state & MY_CS_UNICODE)) + { + bfill(str, end - str, 255); + return; + } + + buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf, + (uchar*) buf + sizeof(buf)); + + DBUG_ASSERT(buflen > 0); + do + { + if ((str + buflen) < end) + { + /* Enough space for the characer */ + memcpy(str, buf, buflen); + str+= buflen; + } + else + { + /* + There is no space for whole multibyte + character, then add trailing spaces. + */ + *str++= ' '; + } + } while (str < end); +} + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +my_bool my_like_range_mb(CHARSET_INFO *cs, + const char *ptr,size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) +{ + uint mb_len; + const char *end= ptr + ptr_length; + char *min_org= min_str; + char *min_end= min_str + res_length; + char *max_end= max_str + res_length; + size_t maxcharlen= res_length / cs->mbmaxlen; + const char *contraction_flags= cs->contractions ? + ((const char*) cs->contractions) + 0x40*0x40 : NULL; + + for (; ptr != end && min_str != min_end && maxcharlen ; maxcharlen--) + { + /* We assume here that escape, w_any, w_namy are one-byte characters */ + if (*ptr == escape && ptr+1 != end) + ptr++; /* Skip escape */ + else if (*ptr == w_one || *ptr == w_many) /* '_' and '%' in SQL */ + { +fill_max_and_min: + /* + Calculate length of keys: + 'a\0\0... is the smallest possible string when we have space expand + a\ff\ff... is the biggest possible string + */ + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + /* Create min key */ + do + { + *min_str++= (char) cs->min_sort_char; + } while (min_str != min_end); + + /* + Write max key: create a buffer with multibyte + representation of the max_sort_char character, + and copy it into max_str in a loop. + */ + *max_length= res_length; + pad_max_char(cs, max_str, max_end); + return 0; + } + if ((mb_len= my_ismbchar(cs, ptr, end)) > 1) + { + if (ptr+mb_len > end || min_str+mb_len > min_end) + break; + while (mb_len--) + *min_str++= *max_str++= *ptr++; + } + else + { + /* + Special case for collations with contractions. + For example, in Chezh, 'ch' is a separate letter + which is sorted between 'h' and 'i'. + If the pattern 'abc%', 'c' at the end can mean: + - letter 'c' itself, + - beginning of the contraction 'ch'. + + If we simply return this LIKE range: + + 'abc\min\min\min' and 'abc\max\max\max' + + then this query: SELECT * FROM t1 WHERE a LIKE 'abc%' + will only find values starting from 'abc[^h]', + but won't find values starting from 'abch'. + + We must ignore contraction heads followed by w_one or w_many. + ('Contraction head' means any letter which can be the first + letter in a contraction) + + For example, for Czech 'abc%', we will return LIKE range, + which is equal to LIKE range for 'ab%': + + 'ab\min\min\min\min' and 'ab\max\max\max\max'. + + */ + if (contraction_flags && ptr + 1 < end && + contraction_flags[(uchar) *ptr]) + { + /* Ptr[0] is a contraction head. */ + + if (ptr[1] == w_one || ptr[1] == w_many) + { + /* Contraction head followed by a wildcard, quit. */ + goto fill_max_and_min; + } + + /* + Some letters can be both contraction heads and contraction tails. + For example, in Danish 'aa' is a separate single letter which + is sorted after 'z'. So 'a' can be both head and tail. + + If ptr[0]+ptr[1] is a contraction, + then put both letters together. + + If ptr[1] can be a contraction part, but ptr[0]+ptr[1] + is not a contraction, then we put only ptr[0], + and continue with ptr[1] on the next loop. + */ + if (contraction_flags[(uchar) ptr[1]] && + cs->contractions[(*ptr-0x40)*0x40 + ptr[1] - 0x40]) + { + /* Contraction found */ + if (maxcharlen == 1 || min_str + 1 >= min_end) + { + /* Both contraction parts don't fit, quit */ + goto fill_max_and_min; + } + + /* Put contraction head */ + *min_str++= *max_str++= *ptr++; + maxcharlen--; + } + } + /* Put contraction tail, or a single character */ + *min_str++= *max_str++= *ptr++; + } + } + + *min_length= *max_length = (size_t) (min_str - min_org); + while (min_str != min_end) + *min_str++= *max_str++= ' '; /* Because if key compression */ + return 0; +} + + +int my_wildcmp_mb_bin(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + int result= -1; /* Not found, using wildcards */ + + while (wildstr != wildend) + { + while (*wildstr != w_many && *wildstr != w_one) + { + int l; + if (*wildstr == escape && wildstr+1 != wildend) + wildstr++; + if ((l = my_ismbchar(cs, wildstr, wildend))) + { + if (str+l > str_end || memcmp(str, wildstr, l) != 0) + return 1; + str += l; + wildstr += l; + } + else + if (str == str_end || *wildstr++ != *str++) + return(1); /* No match */ + if (wildstr == wildend) + return (str != str_end); /* Match if both are at end */ + result=1; /* Found an anchor char */ + } + if (*wildstr == w_one) + { + do + { + if (str == str_end) /* Skip one char if possible */ + return (result); + INC_PTR(cs,str,str_end); + } while (++wildstr < wildend && *wildstr == w_one); + if (wildstr == wildend) + break; + } + if (*wildstr == w_many) + { /* Found w_many */ + uchar cmp; + const char* mb = wildstr; + int mb_len=0; + + wildstr++; + /* Remove any '%' and '_' from the wild search string */ + for (; wildstr != wildend ; wildstr++) + { + if (*wildstr == w_many) + continue; + if (*wildstr == w_one) + { + if (str == str_end) + return (-1); + INC_PTR(cs,str,str_end); + continue; + } + break; /* Not a wild character */ + } + if (wildstr == wildend) + return(0); /* Ok if w_many is last */ + if (str == str_end) + return -1; + + if ((cmp= *wildstr) == escape && wildstr+1 != wildend) + cmp= *++wildstr; + + mb=wildstr; + mb_len= my_ismbchar(cs, wildstr, wildend); + INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ + do + { + for (;;) + { + if (str >= str_end) + return -1; + if (mb_len) + { + if (str+mb_len <= str_end && memcmp(str, mb, mb_len) == 0) + { + str += mb_len; + break; + } + } + else if (!my_ismbchar(cs, str, str_end) && *str == cmp) + { + str++; + break; + } + INC_PTR(cs,str, str_end); + } + { + int tmp=my_wildcmp_mb_bin(cs,str,str_end,wildstr,wildend,escape,w_one,w_many); + if (tmp <= 0) + return (tmp); + } + } while (str != str_end && wildstr[0] != w_many); + return(-1); + } + } + return (str != str_end ? 1 : 0); +} + + +/* + Data was produced from EastAsianWidth.txt + using utt11-dump utility. +*/ +static char pg11[256]= +{ +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,0,0,0,0,0,1, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pg23[256]= +{ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pg2E[256]= +{ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pg2F[256]= +{ +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,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 +}; + +static char pg30[256]= +{ +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,0, +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,0,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 +}; + +static char pg31[256]= +{ +0,0,0,0,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,0,0,0,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,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,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 +}; + +static char pg32[256]= +{ +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,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,0,0,0,0,0,0,0,0,0,0,0,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,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,0 +}; + +static char pg4D[256]= +{ +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,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pg9F[256]= +{ +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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pgA4[256]= +{ +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,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pgD7[256]= +{ +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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pgFA[256]= +{ +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,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pgFE[256]= +{ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,1,1,1,1,1,1,1,1,1,1,1,1, +1,1,1,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static char pgFF[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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +static struct {int page; char *p;} utr11_data[256]= +{ +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,pg11},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,pg23},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,pg2E},{0,pg2F}, +{0,pg30},{0,pg31},{0,pg32},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pg4D},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pg9F}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pgA4},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL}, +{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{1,NULL},{0,pgD7}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL},{0,NULL}, +{0,NULL},{1,NULL},{0,pgFA},{0,NULL},{0,NULL},{0,NULL},{0,pgFE},{0,pgFF} +}; + + +size_t my_numcells_mb(CHARSET_INFO *cs, const char *b, const char *e) +{ + my_wc_t wc; + size_t clen= 0; + + while (b < e) + { + int mb_len; + uint pg; + if ((mb_len= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <= 0 || + wc > 0xFFFF) + { + /* + Let's think a wrong sequence takes 1 dysplay cell. + Also, consider supplementary characters as taking one cell. + */ + mb_len= 1; + b++; + continue; + } + b+= mb_len; + pg= (wc >> 8) & 0xFF; + clen+= utr11_data[pg].p ? utr11_data[pg].p[wc & 0xFF] : utr11_data[pg].page; + clen++; + } + return clen; +} + + +int my_mb_ctype_mb(CHARSET_INFO *cs, int *ctype, + const uchar *s, const uchar *e) +{ + my_wc_t wc; + int res= cs->cset->mb_wc(cs, &wc, s, e); + if (res <= 0 || wc > 0xFFFF) + *ctype= 0; + else + *ctype= my_uni_ctype[wc>>8].ctype ? + my_uni_ctype[wc>>8].ctype[wc&0xFF] : + my_uni_ctype[wc>>8].pctype; + return res; +} + + +MY_COLLATION_HANDLER my_collation_mb_bin_handler = +{ + NULL, /* init */ + my_strnncoll_mb_bin, + my_strnncollsp_mb_bin, + my_strnxfrm_mb, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_bin, + my_propagate_simple +}; + +#endif diff --git a/externals/mysql/strings/ctype-simple.c b/externals/mysql/strings/ctype-simple.c new file mode 100644 index 0000000..e041a27 --- /dev/null +++ b/externals/mysql/strings/ctype-simple.c @@ -0,0 +1,1969 @@ +/* Copyright (C) 2002 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include "m_string.h" +#include "m_ctype.h" +#include "my_sys.h" /* Needed for MY_ERRNO_ERANGE */ +#include + +#include "stdarg.h" + +/* + Returns the number of bytes required for strnxfrm(). +*/ + +size_t my_strnxfrmlen_simple(CHARSET_INFO *cs, size_t len) +{ + return len * (cs->strxfrm_multiply ? cs->strxfrm_multiply : 1); +} + + +/* + Converts a string into its sort key. + + SYNOPSIS + my_strnxfrm_xxx() + + IMPLEMENTATION + + The my_strxfrm_xxx() function transforms a string pointed to by + 'src' with length 'srclen' according to the charset+collation + pair 'cs' and copies the result key into 'dest'. + + Comparing two strings using memcmp() after my_strnxfrm_xxx() + is equal to comparing two original strings with my_strnncollsp_xxx(). + + Not more than 'dstlen' bytes are written into 'dst'. + To garantee that the whole string is transformed, 'dstlen' must be + at least srclen*cs->strnxfrm_multiply bytes long. Otherwise, + consequent memcmp() may return a non-accurate result. + + If the source string is too short to fill whole 'dstlen' bytes, + then the 'dest' string is padded up to 'dstlen', ensuring that: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + my_strnxfrm_simple() is implemented for 8bit charsets and + simple collations with one-to-one string->key transformation. + + See also implementations for various charsets/collations in + other ctype-xxx.c files. + + RETURN + + Target len 'dstlen'. + +*/ + + +size_t my_strnxfrm_simple(CHARSET_INFO * cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *map= cs->sort_order; + uchar *d0= dst; + uint frmlen; + if ((frmlen= min(dstlen, nweights)) > srclen) + frmlen= srclen; + if (dst != src) + { + const uchar *end; + for (end= src + frmlen; src < end;) + *dst++= map[*src++]; + } + else + { + const uchar *end; + for (end= dst + frmlen; dst < end; dst++) + *dst= map[(uchar) *dst]; + } + return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, d0 + dstlen, + nweights - frmlen, flags, 0); +} + + +int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + size_t len = ( slen > tlen ) ? tlen : slen; + uchar *map= cs->sort_order; + if (t_is_prefix && slen > tlen) + slen=tlen; + while (len--) + { + if (map[*s++] != map[*t++]) + return ((int) map[s[-1]] - (int) map[t[-1]]); + } + /* + We can't use (slen - tlen) here as the result may be outside of the + precision of a signed int + */ + return slen > tlen ? 1 : slen < tlen ? -1 : 0 ; +} + + +/* + Compare strings, discarding end space + + SYNOPSIS + my_strnncollsp_simple() + cs character set handler + a First string to compare + a_length Length of 'a' + b Second string to compare + b_length Length of 'b' + diff_if_only_endspace_difference + Set to 1 if the strings should be regarded as different + if they only difference in end space + + IMPLEMENTATION + If one string is shorter as the other, then we space extend the other + so that the strings have equal length. + + This will ensure that the following things hold: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + RETURN + < 0 a < b + = 0 a == b + > 0 a > b +*/ + +int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + const uchar *map= cs->sort_order, *end; + size_t length; + int res; + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + end= a + (length= min(a_length, b_length)); + while (a < end) + { + if (map[*a++] != map[*b++]) + return ((int) map[a[-1]] - (int) map[b[-1]]); + } + res= 0; + if (a_length != b_length) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a_length < b_length) + { + /* put shorter key in s */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (end= a + a_length-length; a < end ; a++) + { + if (map[*a] != ' ') + return (map[*a] < ' ') ? -swap : swap; + } + } + return res; +} + + +size_t my_caseup_str_8bit(CHARSET_INFO * cs,char *str) +{ + register uchar *map= cs->to_upper; + char *str_orig= str; + while ((*str= (char) map[(uchar) *str]) != 0) + str++; + return (size_t) (str - str_orig); +} + + +size_t my_casedn_str_8bit(CHARSET_INFO * cs,char *str) +{ + register uchar *map= cs->to_lower; + char *str_orig= str; + while ((*str= (char) map[(uchar) *str]) != 0) + str++; + return (size_t) (str - str_orig); +} + + +size_t my_caseup_8bit(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + char *end= src + srclen; + register uchar *map= cs->to_upper; + DBUG_ASSERT(src == dst && srclen == dstlen); + for ( ; src != end ; src++) + *src= (char) map[(uchar) *src]; + return srclen; +} + + +size_t my_casedn_8bit(CHARSET_INFO * cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + char *end= src + srclen; + register uchar *map=cs->to_lower; + DBUG_ASSERT(src == dst && srclen == dstlen); + for ( ; src != end ; src++) + *src= (char) map[(uchar) *src]; + return srclen; +} + +int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t) +{ + register uchar *map=cs->to_upper; + while (map[(uchar) *s] == map[(uchar) *t++]) + if (!*s++) return 0; + return ((int) map[(uchar) s[0]] - (int) map[(uchar) t[-1]]); +} + + +int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, + const uchar *str, + const uchar *end __attribute__((unused))) +{ + if (str >= end) + return MY_CS_TOOSMALL; + + *wc=cs->tab_to_uni[*str]; + return (!wc[0] && str[0]) ? -1 : 1; +} + +int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, + uchar *str, + uchar *end) +{ + MY_UNI_IDX *idx; + + if (str >= end) + return MY_CS_TOOSMALL; + + for (idx=cs->tab_from_uni; idx->tab ; idx++) + { + if (idx->from <= wc && idx->to >= wc) + { + str[0]= idx->tab[wc - idx->from]; + return (!str[0] && wc) ? MY_CS_ILUNI : 1; + } + } + return MY_CS_ILUNI; +} + + +/* + We can't use vsprintf here as it's not guaranteed to return + the length on all operating systems. + This function is also not called in a safe environment, so the + end buffer must be checked. +*/ + +size_t my_snprintf_8bit(CHARSET_INFO *cs __attribute__((unused)), + char* to, size_t n __attribute__((unused)), + const char* fmt, ...) +{ + va_list args; + int result; + va_start(args,fmt); + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; +} + + +void my_hash_sort_simple(CHARSET_INFO *cs, + const uchar *key, size_t len, + ulong *nr1, ulong *nr2) +{ + register uchar *sort_order=cs->sort_order; + const uchar *end; + + /* + Remove end space. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + end= skip_trailing_space(key, len); + + for (; key < (uchar*) end ; key++) + { + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * + ((uint) sort_order[(uint) *key])) + (nr1[0] << 8); + nr2[0]+=3; + } +} + + +long my_strntol_8bit(CHARSET_INFO *cs, + const char *nptr, size_t l, int base, + char **endptr, int *err) +{ + int negative; + register uint32 cutoff; + register uint cutlim; + register uint32 i; + register const char *s; + register uchar c; + const char *save, *e; + int overflow; + + *err= 0; /* Initialize error indicator */ +#ifdef NOT_USED + if (base < 0 || base == 1 || base > 36) + base = 10; +#endif + + s = nptr; + e = nptr+l; + + for ( ; s='0' && c<='9') + c -= '0'; + else if (c>='A' && c<='Z') + c = c - 'A' + 10; + else if (c>='a' && c<='z') + c = c - 'a' + 10; + else + break; + if (c >= base) + break; + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + i *= (uint32) base; + i += c; + } + } + + if (s == save) + goto noconv; + + if (endptr != NULL) + *endptr = (char *) s; + + if (negative) + { + if (i > (uint32) INT_MIN32) + overflow = 1; + } + else if (i > INT_MAX32) + overflow = 1; + + if (overflow) + { + err[0]= ERANGE; + return negative ? INT_MIN32 : INT_MAX32; + } + + return (negative ? -((long) i) : (long) i); + +noconv: + err[0]= EDOM; + if (endptr != NULL) + *endptr = (char *) nptr; + return 0L; +} + + +ulong my_strntoul_8bit(CHARSET_INFO *cs, + const char *nptr, size_t l, int base, + char **endptr, int *err) +{ + int negative; + register uint32 cutoff; + register uint cutlim; + register uint32 i; + register const char *s; + register uchar c; + const char *save, *e; + int overflow; + + *err= 0; /* Initialize error indicator */ +#ifdef NOT_USED + if (base < 0 || base == 1 || base > 36) + base = 10; +#endif + + s = nptr; + e = nptr+l; + + for( ; s='0' && c<='9') + c -= '0'; + else if (c>='A' && c<='Z') + c = c - 'A' + 10; + else if (c>='a' && c<='z') + c = c - 'a' + 10; + else + break; + if (c >= base) + break; + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + i *= (uint32) base; + i += c; + } + } + + if (s == save) + goto noconv; + + if (endptr != NULL) + *endptr = (char *) s; + + if (overflow) + { + err[0]= ERANGE; + return (~(uint32) 0); + } + + return (negative ? -((long) i) : (long) i); + +noconv: + err[0]= EDOM; + if (endptr != NULL) + *endptr = (char *) nptr; + return 0L; +} + + +longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *nptr, size_t l, int base, + char **endptr,int *err) +{ + int negative; + register ulonglong cutoff; + register uint cutlim; + register ulonglong i; + register const char *s, *e; + const char *save; + int overflow; + + *err= 0; /* Initialize error indicator */ +#ifdef NOT_USED + if (base < 0 || base == 1 || base > 36) + base = 10; +#endif + + s = nptr; + e = nptr+l; + + for(; s='0' && c<='9') + c -= '0'; + else if (c>='A' && c<='Z') + c = c - 'A' + 10; + else if (c>='a' && c<='z') + c = c - 'a' + 10; + else + break; + if (c >= base) + break; + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + i *= (ulonglong) base; + i += c; + } + } + + if (s == save) + goto noconv; + + if (endptr != NULL) + *endptr = (char *) s; + + if (negative) + { + if (i > (ulonglong) LONGLONG_MIN) + overflow = 1; + } + else if (i > (ulonglong) LONGLONG_MAX) + overflow = 1; + + if (overflow) + { + err[0]= ERANGE; + return negative ? LONGLONG_MIN : LONGLONG_MAX; + } + + return (negative ? -((longlong) i) : (longlong) i); + +noconv: + err[0]= EDOM; + if (endptr != NULL) + *endptr = (char *) nptr; + return 0L; +} + + +ulonglong my_strntoull_8bit(CHARSET_INFO *cs, + const char *nptr, size_t l, int base, + char **endptr, int *err) +{ + int negative; + register ulonglong cutoff; + register uint cutlim; + register ulonglong i; + register const char *s, *e; + const char *save; + int overflow; + + *err= 0; /* Initialize error indicator */ +#ifdef NOT_USED + if (base < 0 || base == 1 || base > 36) + base = 10; +#endif + + s = nptr; + e = nptr+l; + + for(; s='0' && c<='9') + c -= '0'; + else if (c>='A' && c<='Z') + c = c - 'A' + 10; + else if (c>='a' && c<='z') + c = c - 'a' + 10; + else + break; + if (c >= base) + break; + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + i *= (ulonglong) base; + i += c; + } + } + + if (s == save) + goto noconv; + + if (endptr != NULL) + *endptr = (char *) s; + + if (overflow) + { + err[0]= ERANGE; + return (~(ulonglong) 0); + } + + return (negative ? -((longlong) i) : (longlong) i); + +noconv: + err[0]= EDOM; + if (endptr != NULL) + *endptr = (char *) nptr; + return 0L; +} + + +/* + Read double from string + + SYNOPSIS: + my_strntod_8bit() + cs Character set information + str String to convert to double + length Optional length for string. + end result pointer to end of converted string + err Error number if failed conversion + + NOTES: + If length is not INT_MAX32 or str[length] != 0 then the given str must + be writeable + If length == INT_MAX32 the str must be \0 terminated. + + It's implemented this way to save a buffer allocation and a memory copy. + + RETURN + Value of number in string +*/ + + +double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *str, size_t length, + char **end, int *err) +{ + if (length == INT_MAX32) + length= 65535; /* Should be big enough */ + *end= str + length; + return my_strtod(str, end, err); +} + + +/* + This is a fast version optimized for the case of radix 10 / -10 + + Assume len >= 1 +*/ + +size_t my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, long int val) +{ + char buffer[66]; + register char *p, *e; + long int new_val; + uint sign=0; + unsigned long int uval = (unsigned long int) val; + + e = p = &buffer[sizeof(buffer)-1]; + *p= 0; + + if (radix < 0) + { + if (val < 0) + { + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval= (unsigned long int)0 - uval; + *dst++= '-'; + len--; + sign= 1; + } + } + + new_val = (long) (uval / 10); + *--p = '0'+ (char) (uval - (unsigned long) new_val * 10); + val = new_val; + + while (val != 0) + { + new_val=val/10; + *--p = '0' + (char) (val-new_val*10); + val= new_val; + } + + len= min(len, (size_t) (e-p)); + memcpy(dst, p, len); + return len+sign; +} + + +size_t my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *dst, size_t len, int radix, + longlong val) +{ + char buffer[65]; + register char *p, *e; + long long_val; + uint sign= 0; + ulonglong uval = (ulonglong)val; + + if (radix < 0) + { + if (val < 0) + { + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval = (ulonglong)0 - uval; + *dst++= '-'; + len--; + sign= 1; + } + } + + e = p = &buffer[sizeof(buffer)-1]; + *p= 0; + + if (uval == 0) + { + *--p= '0'; + len= 1; + goto cnv; + } + + while (uval > (ulonglong) LONG_MAX) + { + ulonglong quo= uval/(uint) 10; + uint rem= (uint) (uval- quo* (uint) 10); + *--p = '0' + rem; + uval= quo; + } + + long_val= (long) uval; + while (long_val != 0) + { + long quo= long_val/10; + *--p = (char) ('0' + (long_val - quo*10)); + long_val= quo; + } + + len= min(len, (size_t) (e-p)); +cnv: + memcpy(dst, p, len); + return len+sign; +} + + +/* +** Compare string against string with wildcard +** 0 if matched +** -1 if not matched with wildcard +** 1 if matched with wildcard +*/ + +#ifdef LIKE_CMP_TOUPPER +#define likeconv(s,A) (uchar) my_toupper(s,A) +#else +#define likeconv(s,A) (uchar) (s)->sort_order[(uchar) (A)] +#endif + +#define INC_PTR(cs,A,B) (A)++ + + +int my_wildcmp_8bit(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + int result= -1; /* Not found, using wildcards */ + + while (wildstr != wildend) + { + while (*wildstr != w_many && *wildstr != w_one) + { + if (*wildstr == escape && wildstr+1 != wildend) + wildstr++; + + if (str == str_end || likeconv(cs,*wildstr++) != likeconv(cs,*str++)) + return(1); /* No match */ + if (wildstr == wildend) + return(str != str_end); /* Match if both are at end */ + result=1; /* Found an anchor char */ + } + if (*wildstr == w_one) + { + do + { + if (str == str_end) /* Skip one char if possible */ + return(result); + INC_PTR(cs,str,str_end); + } while (++wildstr < wildend && *wildstr == w_one); + if (wildstr == wildend) + break; + } + if (*wildstr == w_many) + { /* Found w_many */ + uchar cmp; + + wildstr++; + /* Remove any '%' and '_' from the wild search string */ + for (; wildstr != wildend ; wildstr++) + { + if (*wildstr == w_many) + continue; + if (*wildstr == w_one) + { + if (str == str_end) + return(-1); + INC_PTR(cs,str,str_end); + continue; + } + break; /* Not a wild character */ + } + if (wildstr == wildend) + return(0); /* Ok if w_many is last */ + if (str == str_end) + return(-1); + + if ((cmp= *wildstr) == escape && wildstr+1 != wildend) + cmp= *++wildstr; + + INC_PTR(cs,wildstr,wildend); /* This is compared trough cmp */ + cmp=likeconv(cs,cmp); + do + { + while (str != str_end && (uchar) likeconv(cs,*str) != cmp) + str++; + if (str++ == str_end) return(-1); + { + int tmp=my_wildcmp_8bit(cs,str,str_end,wildstr,wildend,escape,w_one, + w_many); + if (tmp <= 0) + return(tmp); + } + } while (str != str_end && wildstr[0] != w_many); + return(-1); + } + } + return(str != str_end ? 1 : 0); +} + + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +my_bool my_like_range_simple(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length, size_t *max_length) +{ + const char *end= ptr + ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + size_t charlen= res_length / cs->mbmaxlen; + + for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) + { + if (*ptr == escape && ptr+1 != end) + { + ptr++; /* Skip escape */ + *min_str++= *max_str++ = *ptr; + continue; + } + if (*ptr == w_one) /* '_' in SQL */ + { + *min_str++='\0'; /* This should be min char */ + *max_str++= (char) cs->max_sort_char; + continue; + } + if (*ptr == w_many) /* '%' in SQL */ + { + /* Calculate length of keys */ + *min_length= ((cs->state & MY_CS_BINSORT) ? + (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + do + { + *min_str++= 0; + *max_str++= (char) cs->max_sort_char; + } while (min_str != min_end); + return 0; + } + *min_str++= *max_str++ = *ptr; + } + + *min_length= *max_length = (size_t) (min_str - min_org); + while (min_str != min_end) + *min_str++= *max_str++ = ' '; /* Because if key compression */ + return 0; +} + + +size_t my_scan_8bit(CHARSET_INFO *cs, const char *str, const char *end, int sq) +{ + const char *str0= str; + switch (sq) + { + case MY_SEQ_INTTAIL: + if (*str == '.') + { + for(str++ ; str != end && *str == '0' ; str++); + return (size_t) (str - str0); + } + return 0; + + case MY_SEQ_SPACES: + for ( ; str < end ; str++) + { + if (!my_isspace(cs,*str)) + break; + } + return (size_t) (str - str0); + default: + return 0; + } +} + + +void my_fill_8bit(CHARSET_INFO *cs __attribute__((unused)), + char *s, size_t l, int fill) +{ + bfill((uchar*) s,l,fill); +} + + +size_t my_numchars_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) +{ + return (size_t) (e - b); +} + + +size_t my_numcells_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) +{ + return (size_t) (e - b); +} + + +size_t my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused)), + size_t pos) +{ + return pos; +} + + +size_t my_well_formed_len_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *start, const char *end, + size_t nchars, int *error) +{ + size_t nbytes= (size_t) (end-start); + *error= 0; + return min(nbytes, nchars); +} + + +size_t my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) +{ + const char *end; + end= (const char *) skip_trailing_space((const uchar *)ptr, length); + return (size_t) (end-ptr); +} + + +uint my_instr_simple(CHARSET_INFO *cs, + const char *b, size_t b_length, + const char *s, size_t s_length, + my_match_t *match, uint nmatch) +{ + register const uchar *str, *search, *end, *search_end; + + if (s_length <= b_length) + { + if (!s_length) + { + if (nmatch) + { + match->beg= 0; + match->end= 0; + match->mb_len= 0; + } + return 1; /* Empty string is always found */ + } + + str= (const uchar*) b; + search= (const uchar*) s; + end= (const uchar*) b+b_length-s_length+1; + search_end= (const uchar*) s + s_length; + +skip: + while (str != end) + { + if (cs->sort_order[*str++] == cs->sort_order[*search]) + { + register const uchar *i,*j; + + i= str; + j= search+1; + + while (j != search_end) + if (cs->sort_order[*i++] != cs->sort_order[*j++]) + goto skip; + + if (nmatch > 0) + { + match[0].beg= 0; + match[0].end= (size_t) (str- (const uchar*)b-1); + match[0].mb_len= match[0].end; + + if (nmatch > 1) + { + match[1].beg= match[0].end; + match[1].end= match[0].end+s_length; + match[1].mb_len= match[1].end-match[1].beg; + } + } + return 2; + } + } + } + return 0; +} + + +typedef struct +{ + int nchars; + MY_UNI_IDX uidx; +} uni_idx; + +#define PLANE_SIZE 0x100 +#define PLANE_NUM 0x100 +#define PLANE_NUMBER(x) (((x)>>8) % PLANE_NUM) + +static int pcmp(const void * f, const void * s) +{ + const uni_idx *F= (const uni_idx*) f; + const uni_idx *S= (const uni_idx*) s; + int res; + + if (!(res=((S->nchars)-(F->nchars)))) + res=((F->uidx.from)-(S->uidx.to)); + return res; +} + +static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(size_t)) +{ + uni_idx idx[PLANE_NUM]; + int i,n; + + /* + Check that Unicode map is loaded. + It can be not loaded when the collation is + listed in Index.xml but not specified + in the character set specific XML file. + */ + if (!cs->tab_to_uni) + return TRUE; + + /* Clear plane statistics */ + bzero(idx,sizeof(idx)); + + /* Count number of characters in each plane */ + for (i=0; i< 0x100; i++) + { + uint16 wc=cs->tab_to_uni[i]; + int pl= PLANE_NUMBER(wc); + + if (wc || !i) + { + if (!idx[pl].nchars) + { + idx[pl].uidx.from=wc; + idx[pl].uidx.to=wc; + }else + { + idx[pl].uidx.from=wcidx[pl].uidx.to?wc:idx[pl].uidx.to; + } + idx[pl].nchars++; + } + } + + /* Sort planes in descending order */ + qsort(&idx,PLANE_NUM,sizeof(uni_idx),&pcmp); + + for (i=0; i < PLANE_NUM; i++) + { + int ch,numchars; + + /* Skip empty plane */ + if (!idx[i].nchars) + break; + + numchars=idx[i].uidx.to-idx[i].uidx.from+1; + if (!(idx[i].uidx.tab=(uchar*) alloc(numchars * sizeof(*idx[i].uidx.tab)))) + return TRUE; + + bzero(idx[i].uidx.tab,numchars*sizeof(*idx[i].uidx.tab)); + + for (ch=1; ch < PLANE_SIZE; ch++) + { + uint16 wc=cs->tab_to_uni[ch]; + if (wc >= idx[i].uidx.from && wc <= idx[i].uidx.to && wc) + { + int ofs= wc - idx[i].uidx.from; + idx[i].uidx.tab[ofs]= ch; + } + } + } + + /* Allocate and fill reverse table for each plane */ + n=i; + if (!(cs->tab_from_uni= (MY_UNI_IDX*) alloc(sizeof(MY_UNI_IDX)*(n+1)))) + return TRUE; + + for (i=0; i< n; i++) + cs->tab_from_uni[i]= idx[i].uidx; + + /* Set end-of-list marker */ + bzero(&cs->tab_from_uni[i],sizeof(MY_UNI_IDX)); + return FALSE; +} + +static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(size_t)) +{ + cs->caseup_multiply= 1; + cs->casedn_multiply= 1; + cs->pad_char= ' '; + return create_fromuni(cs, alloc); +} + +static void set_max_sort_char(CHARSET_INFO *cs) +{ + uchar max_char; + uint i; + + if (!cs->sort_order) + return; + + max_char=cs->sort_order[(uchar) cs->max_sort_char]; + for (i= 0; i < 256; i++) + { + if ((uchar) cs->sort_order[i] > max_char) + { + max_char=(uchar) cs->sort_order[i]; + cs->max_sort_char= i; + } + } +} + +static my_bool my_coll_init_simple(CHARSET_INFO *cs, + void *(*alloc)(size_t) __attribute__((unused))) +{ + set_max_sort_char(cs); + return FALSE; +} + + +longlong my_strtoll10_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *nptr, char **endptr, int *error) +{ + return my_strtoll10(nptr, endptr, error); +} + + +int my_mb_ctype_8bit(CHARSET_INFO *cs, int *ctype, + const uchar *s, const uchar *e) +{ + if (s >= e) + { + *ctype= 0; + return MY_CS_TOOSMALL; + } + *ctype= cs->ctype[*s + 1]; + return 1; +} + + +#undef ULONGLONG_MAX +/* + Needed under MetroWerks Compiler, since MetroWerks compiler does not + properly handle a constant expression containing a mod operator +*/ +#if defined(__NETWARE__) && defined(__MWERKS__) +static ulonglong ulonglong_max= ~(ulonglong) 0; +#define ULONGLONG_MAX ulonglong_max +#else +#define ULONGLONG_MAX (~(ulonglong) 0) +#endif /* __NETWARE__ && __MWERKS__ */ + + +#define CUTOFF (ULONGLONG_MAX / 10) +#define CUTLIM (ULONGLONG_MAX % 10) +#define DIGITS_IN_ULONGLONG 20 + +static ulonglong d10[DIGITS_IN_ULONGLONG]= +{ + 1, + 10, + 100, + 1000, + 10000, + 100000, + 1000000, + 10000000, + 100000000, + 1000000000, + 10000000000ULL, + 100000000000ULL, + 1000000000000ULL, + 10000000000000ULL, + 100000000000000ULL, + 1000000000000000ULL, + 10000000000000000ULL, + 100000000000000000ULL, + 1000000000000000000ULL, + 10000000000000000000ULL +}; + + +/* + + Convert a string to unsigned long long integer value + with rounding. + + SYNOPSYS + my_strntoull10_8bit() + cs in pointer to character set + str in pointer to the string to be converted + length in string length + unsigned_flag in whether the number is unsigned + endptr out pointer to the stop character + error out returned error code + + DESCRIPTION + This function takes the decimal representation of integer number + from string str and converts it to an signed or unsigned + long long integer value. + Space characters and tab are ignored. + A sign character might precede the digit characters. + The number may have any number of pre-zero digits. + The number may have decimal point and exponent. + Rounding is always done in "away from zero" style: + 0.5 -> 1 + -0.5 -> -1 + + The function stops reading the string str after "length" bytes + or at the first character that is not a part of correct number syntax: + + ::= + [ ] [ E [ ] ] + + ::= + [ [ ] ] + | + ::= ... + + RETURN VALUES + Value of string as a signed/unsigned longlong integer + + endptr cannot be NULL. The function will store the end pointer + to the stop character here. + + The error parameter contains information how things went: + 0 ok + ERANGE If the the value of the converted number is out of range + In this case the return value is: + - ULONGLONG_MAX if unsigned_flag and the number was too big + - 0 if unsigned_flag and the number was negative + - LONGLONG_MAX if no unsigned_flag and the number is too big + - LONGLONG_MIN if no unsigned_flag and the number it too big negative + + EDOM If the string didn't contain any digits. + In this case the return value is 0. +*/ + +ulonglong +my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *str, size_t length, int unsigned_flag, + char **endptr, int *error) +{ + const char *dot, *end9, *beg, *end= str + length; + ulonglong ull; + ulong ul; + uchar ch; + int shift= 0, digits= 0, negative, addon; + + /* Skip leading spaces and tabs */ + for ( ; str < end && (*str == ' ' || *str == '\t') ; str++); + + if (str >= end) + goto ret_edom; + + if ((negative= (*str == '-')) || *str=='+') /* optional sign */ + { + if (++str == end) + goto ret_edom; + } + + beg= str; + end9= (str + 9) > end ? end : (str + 9); + /* Accumulate small number into ulong, for performance purposes */ + for (ul= 0 ; str < end9 && (ch= (uchar) (*str - '0')) < 10; str++) + { + ul= ul * 10 + ch; + } + + if (str >= end) /* Small number without dots and expanents */ + { + *endptr= (char*) str; + if (negative) + { + if (unsigned_flag) + { + *error= ul ? MY_ERRNO_ERANGE : 0; + return 0; + } + else + { + *error= 0; + return (ulonglong) (longlong) -(long) ul; + } + } + else + { + *error=0; + return (ulonglong) ul; + } + } + + digits= str - beg; + + /* Continue to accumulate into ulonglong */ + for (dot= NULL, ull= ul; str < end; str++) + { + if ((ch= (uchar) (*str - '0')) < 10) + { + if (ull < CUTOFF || (ull == CUTOFF && ch <= CUTLIM)) + { + ull= ull * 10 + ch; + digits++; + continue; + } + /* + Adding the next digit would overflow. + Remember the next digit in "addon", for rounding. + Scan all digits with an optional single dot. + */ + if (ull == CUTOFF) + { + ull= ULONGLONG_MAX; + addon= 1; + str++; + } + else + addon= (*str >= '5'); + if (!dot) + { + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; shift++, str++); + if (str < end && *str == '.') + { + str++; + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; str++); + } + } + else + { + shift= dot - str; + for ( ; str < end && (ch= (uchar) (*str - '0')) < 10; str++); + } + goto exp; + } + + if (*str == '.') + { + if (dot) + { + /* The second dot character */ + addon= 0; + goto exp; + } + else + { + dot= str + 1; + } + continue; + } + + /* Unknown character, exit the loop */ + break; + } + shift= dot ? dot - str : 0; /* Right shift */ + addon= 0; + +exp: /* [ E [ ] ] */ + + if (!digits) + { + str= beg; + goto ret_edom; + } + + if (str < end && (*str == 'e' || *str == 'E')) + { + str++; + if (str < end) + { + int negative_exp, exponent; + if ((negative_exp= (*str == '-')) || *str=='+') + { + if (++str == end) + goto ret_sign; + } + for (exponent= 0 ; + str < end && (ch= (uchar) (*str - '0')) < 10; + str++) + { + exponent= exponent * 10 + ch; + } + shift+= negative_exp ? -exponent : exponent; + } + } + + if (shift == 0) /* No shift, check addon digit */ + { + if (addon) + { + if (ull == ULONGLONG_MAX) + goto ret_too_big; + ull++; + } + goto ret_sign; + } + + if (shift < 0) /* Right shift */ + { + ulonglong d, r; + + if (-shift >= DIGITS_IN_ULONGLONG) + goto ret_zero; /* Exponent is a big negative number, return 0 */ + + d= d10[-shift]; + r= (ull % d) * 2; + ull /= d; + if (r >= d) + ull++; + goto ret_sign; + } + + if (shift > DIGITS_IN_ULONGLONG) /* Huge left shift */ + { + if (!ull) + goto ret_sign; + goto ret_too_big; + } + + for ( ; shift > 0; shift--, ull*= 10) /* Left shift */ + { + if (ull > CUTOFF) + goto ret_too_big; /* Overflow, number too big */ + } + +ret_sign: + *endptr= (char*) str; + + if (!unsigned_flag) + { + if (negative) + { + if (ull > (ulonglong) LONGLONG_MIN) + { + *error= MY_ERRNO_ERANGE; + return (ulonglong) LONGLONG_MIN; + } + *error= 0; + return (ulonglong) -(longlong) ull; + } + else + { + if (ull > (ulonglong) LONGLONG_MAX) + { + *error= MY_ERRNO_ERANGE; + return (ulonglong) LONGLONG_MAX; + } + *error= 0; + return ull; + } + } + + /* Unsigned number */ + if (negative && ull) + { + *error= MY_ERRNO_ERANGE; + return 0; + } + *error= 0; + return ull; + +ret_zero: + *endptr= (char*) str; + *error= 0; + return 0; + +ret_edom: + *endptr= (char*) str; + *error= MY_ERRNO_EDOM; + return 0; + +ret_too_big: + *endptr= (char*) str; + *error= MY_ERRNO_ERANGE; + return unsigned_flag ? + ULONGLONG_MAX : + negative ? (ulonglong) LONGLONG_MIN : (ulonglong) LONGLONG_MAX; +} + + +/* + Check if a constant can be propagated + + SYNOPSIS: + my_propagate_simple() + cs Character set information + str String to convert to double + length Optional length for string. + + NOTES: + Takes the string in the given charset and check + if it can be safely propagated in the optimizer. + + create table t1 ( + s char(5) character set latin1 collate latin1_german2_ci); + insert into t1 values (0xf6); -- o-umlaut + select * from t1 where length(s)=1 and s='oe'; + + The above query should return one row. + We cannot convert this query into: + select * from t1 where length('oe')=1 and s='oe'; + + Currently we don't check the constant itself, + and decide not to propagate a constant + just if the collation itself allows tricky things + like expansions and contractions. In the future + we can write a more sophisticated functions to + check the constants. For example, 'oa' can always + be safety propagated in German2 because unlike + 'oe' it does not have any special meaning. + + RETURN + 1 if constant can be safely propagated + 0 if it is not safe to propagate the constant +*/ + + + +my_bool my_propagate_simple(CHARSET_INFO *cs __attribute__((unused)), + const uchar *str __attribute__((unused)), + size_t length __attribute__((unused))) +{ + return 1; +} + + +my_bool my_propagate_complex(CHARSET_INFO *cs __attribute__((unused)), + const uchar *str __attribute__((unused)), + size_t length __attribute__((unused))) +{ + return 0; +} + + + +/* + Normalize strxfrm flags + + SYNOPSIS: + my_strxfrm_flag_normalize() + flags - non-normalized flags + nlevels - number of levels + + NOTES: + If levels are omitted, then 1-maximum is assumed. + If any level number is greater than the maximum, + it is treated as the maximum. + + RETURN + normalized flags +*/ + +uint my_strxfrm_flag_normalize(uint flags, uint maximum) +{ + DBUG_ASSERT(maximum >= 1 && maximum <= MY_STRXFRM_NLEVELS); + + /* If levels are omitted, then 1-maximum is assumed*/ + if (!(flags & MY_STRXFRM_LEVEL_ALL)) + { + static uint def_level_flags[]= {0, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F }; + uint flag_pad= flags & + (MY_STRXFRM_PAD_WITH_SPACE | MY_STRXFRM_PAD_TO_MAXLEN); + flags= def_level_flags[maximum] | flag_pad; + } + else + { + uint i; + uint flag_lev= flags & MY_STRXFRM_LEVEL_ALL; + uint flag_dsc= (flags >> MY_STRXFRM_DESC_SHIFT) & MY_STRXFRM_LEVEL_ALL; + uint flag_rev= (flags >> MY_STRXFRM_REVERSE_SHIFT) & MY_STRXFRM_LEVEL_ALL; + uint flag_pad= flags & + (MY_STRXFRM_PAD_WITH_SPACE | MY_STRXFRM_PAD_TO_MAXLEN); + + /* + If any level number is greater than the maximum, + it is treated as the maximum. + */ + for (maximum--, flags= 0, i= 0; i < MY_STRXFRM_NLEVELS; i++) + { + uint src_bit= 1 << i; + if (flag_lev & src_bit) + { + uint dst_bit= 1 << min(i, maximum); + flags|= dst_bit; + flags|= (flag_dsc & dst_bit) << MY_STRXFRM_DESC_SHIFT; + flags|= (flag_rev & dst_bit) << MY_STRXFRM_REVERSE_SHIFT; + } + else + { + /* Check that there are no DESC or REVERSE flag for skipped level */ + DBUG_ASSERT(!(flag_dsc & src_bit) && !(flag_rev & src_bit)); + } + } + flags|= flag_pad; + } + + return flags; +} + +/* + Apply DESC and REVERSE collation rules. + + SYNOPSIS: + my_strxfrm_desc_and_reverse() + str - pointer to string + strend - end of string + flags - flags + level - which level, starting from 0. + + NOTES: + Apply DESC or REVERSE or both flags. + + If DESC flag is given, then the weights + come out NOTed or negated for that level. + + If REVERSE flags is given, then the weights come out in + reverse order for that level, that is, starting with + the last character and ending with the first character. + + If nether DESC nor REVERSE flags are give, + the string is not changed. + +*/ +void my_strxfrm_desc_and_reverse(uchar *str, uchar *strend, + uint flags, uint level) +{ + if (flags & (MY_STRXFRM_DESC_LEVEL1 << level)) + { + if (flags & (MY_STRXFRM_REVERSE_LEVEL1 << level)) + { + for (strend--; str <= strend;) + { + uchar tmp= *str; + *str++= ~*strend; + *strend--= ~tmp; + } + } + else + { + for (; str < strend; str++) + *str= ~*str; + } + } + else if (flags & (MY_STRXFRM_REVERSE_LEVEL1 << level)) + { + for (strend--; str < strend;) + { + uchar tmp= *str; + *str++= *strend; + *strend--= tmp; + } + } +} + + +size_t +my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs, + uchar *str, uchar *frmend, uchar *strend, + uint nweights, uint flags, uint level) +{ + if (nweights && frmend < strend && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + uint fill_length= min((uint) (strend - frmend), nweights * cs->mbminlen); + cs->cset->fill(cs, (char*) frmend, fill_length, cs->pad_char); + frmend+= fill_length; + } + my_strxfrm_desc_and_reverse(str, frmend, flags, level); + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && frmend < strend) + { + uint fill_length= strend - frmend; + cs->cset->fill(cs, (char*) frmend, fill_length, cs->pad_char); + frmend= strend; + } + return frmend - str; +} + + +MY_CHARSET_HANDLER my_charset_8bit_handler= +{ + my_cset_init_8bit, + NULL, /* ismbchar */ + my_mbcharlen_8bit, /* mbcharlen */ + my_numchars_8bit, + my_charpos_8bit, + my_well_formed_len_8bit, + my_lengthsp_8bit, + my_numcells_8bit, + my_mb_wc_8bit, + my_wc_mb_8bit, + my_mb_ctype_8bit, + my_caseup_str_8bit, + my_casedn_str_8bit, + my_caseup_8bit, + my_casedn_8bit, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + +MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler = +{ + my_coll_init_simple, /* init */ + my_strnncoll_simple, + my_strnncollsp_simple, + my_strnxfrm_simple, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_8bit, + my_strcasecmp_8bit, + my_instr_simple, + my_hash_sort_simple, + my_propagate_simple +}; diff --git a/externals/mysql/strings/ctype-sjis.c b/externals/mysql/strings/ctype-sjis.c new file mode 100644 index 0000000..762379c --- /dev/null +++ b/externals/mysql/strings/ctype-sjis.c @@ -0,0 +1,4716 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This file is for Shift JIS charset, and created by tommy@valley.ne.jp. + */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_sjis + + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. strxfrm_multiply_sjis=1 + * .configure. mbmaxlen_sjis=2 + */ + +static uchar NEAR ctype_sjis[257] = +{ + 0, /* For standard library */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ + 0040, 0050, 0050, 0050, 0050, 0050, 0040, 0040, /* ^H - ^O */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^P - ^W */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^X - ^Z ^[ ^\ ^] ^^ ^_ */ + 0110, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* SPC ! " # $ % ^ ' */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* ( ) * + , - . / */ + 0204, 0204, 0204, 0204, 0204, 0204, 0204, 0204, /* 0 1 2 3 4 5 6 7 */ + 0204, 0204, 0020, 0020, 0020, 0020, 0020, 0020, /* 8 9 : ; < = > ? */ + 0020, 0201, 0201, 0201, 0201, 0201, 0201, 0001, /* @ A B C D E F G */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* H I J K L M N O */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* P Q R S T U V W */ + 0001, 0001, 0001, 0020, 0020, 0020, 0020, 0020, /* X Y Z [ \ ] ^ _ */ + 0020, 0202, 0202, 0202, 0202, 0202, 0202, 0002, /* ` a b c d e f g */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* h i j k l m n o */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* p q r s t u v w */ + 0002, 0002, 0002, 0020, 0020, 0020, 0020, 0040, /* x y z { | } + DEL */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0000, 0000, 0000 +}; + +static uchar NEAR to_lower_sjis[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR to_upper_sjis[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR sort_order_sjis[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +#define issjishead(c) ((0x81<=(c) && (c)<=0x9f) || \ + ((0xe0<=(c)) && (c)<=0xfc)) +#define issjistail(c) ((0x40<=(c) && (c)<=0x7e) || \ + (0x80<=(c) && (c)<=0xfc)) + + +static uint ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0); +} + +static uint mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c) +{ + return (issjishead((uchar) c) ? 2 : 1); +} + + +#define sjiscode(c,d) ((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d)) + + +static int my_strnncoll_sjis_internal(CHARSET_INFO *cs, + const uchar **a_res, size_t a_length, + const uchar **b_res, size_t b_length) +{ + const uchar *a= *a_res, *b= *b_res; + const uchar *a_end= a + a_length; + const uchar *b_end= b + b_length; + while (a < a_end && b < b_end) + { + if (ismbchar_sjis(cs,(char*) a, (char*) a_end) && + ismbchar_sjis(cs,(char*) b, (char*) b_end)) + { + uint a_char= sjiscode(*a, *(a+1)); + uint b_char= sjiscode(*b, *(b+1)); + if (a_char != b_char) + return (int) a_char - (int) b_char; + a += 2; + b += 2; + } else + { + if (sort_order_sjis[(uchar)*a] != sort_order_sjis[(uchar)*b]) + return sort_order_sjis[(uchar)*a] - sort_order_sjis[(uchar)*b]; + a++; + b++; + } + } + *a_res= a; + *b_res= b; + return 0; +} + + +static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool b_is_prefix) +{ + int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length); + if (b_is_prefix && a_length > b_length) + a_length= b_length; + return res ? res : (int) (a_length - b_length); +} + + +static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)), + const uchar *a, size_t a_length, + const uchar *b, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + const uchar *a_end= a + a_length, *b_end= b + b_length; + int res= my_strnncoll_sjis_internal(cs, &a, a_length, &b, b_length); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + if (!res && (a != a_end || b != b_end)) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a == a_end) + { + /* put shorter key in a */ + a_end= b_end; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (; a < a_end ; a++) + { + if (*a != ' ') + return (*a < ' ') ? -swap : swap; + } + } + return res; +} + + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +#define max_sort_char ((char) 255) + +static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr,size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) +{ + const char *end= ptr + ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + size_t charlen= res_length / cs->mbmaxlen; + + for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--) + { + if (ismbchar_sjis(cs, ptr, end)) { + *min_str++ = *max_str++ = *ptr++; + if (min_str < min_end) + *min_str++ = *max_str++ = *ptr++; + continue; + } + if (*ptr == escape && ptr+1 < end) { + ptr++; /* Skip escape */ + if (ismbchar_sjis(cs, ptr, end)) + *min_str++ = *max_str++ = *ptr++; + if (min_str < min_end) + *min_str++ = *max_str++ = *ptr++; + continue; + } + if (*ptr == w_one) { /* '_' in SQL */ + *min_str++ = '\0'; /* This should be min char */ + *max_str++ = max_sort_char; + ptr++; + continue; + } + if (*ptr == w_many) + { /* '%' in SQL */ + /* + Calculate length of keys: + 'a\0\0... is the smallest possible string when we have space expand + a\ff\ff... is the biggest possible string + */ + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + do + { + *min_str++= 0; + *max_str++= max_sort_char; + } while (min_str < min_end); + return 0; + } + *min_str++ = *max_str++ = *ptr++; + } + + *min_length= *max_length= (size_t) (min_str - min_org); + while (min_str != min_end) + *min_str++= *max_str++= ' '; /* Because if key compression */ + return 0; +} + +/* page 0 0x00A1-0x00DF */ +static uint16 tab_sjis_uni0[]={ +0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67,0xFF68, +0xFF69,0xFF6A,0xFF6B,0xFF6C,0xFF6D,0xFF6E,0xFF6F,0xFF70, +0xFF71,0xFF72,0xFF73,0xFF74,0xFF75,0xFF76,0xFF77,0xFF78, +0xFF79,0xFF7A,0xFF7B,0xFF7C,0xFF7D,0xFF7E,0xFF7F,0xFF80, +0xFF81,0xFF82,0xFF83,0xFF84,0xFF85,0xFF86,0xFF87,0xFF88, +0xFF89,0xFF8A,0xFF8B,0xFF8C,0xFF8D,0xFF8E,0xFF8F,0xFF90, +0xFF91,0xFF92,0xFF93,0xFF94,0xFF95,0xFF96,0xFF97,0xFF98, +0xFF99,0xFF9A,0xFF9B,0xFF9C,0xFF9D,0xFF9E,0xFF9F}; + +/* page 1 0x8140-0x84BE */ +static uint16 tab_sjis_uni1[]={ +0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B, +0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E, +0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD, +0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0x005C, +0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C, +0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B, +0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E, +0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7, 0, +0x00F7,0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E, +0x2234,0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5, +0xFF04,0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20, +0x00A7,0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,0x25C6, +0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B,0x3012, +0x2192,0x2190,0x2191,0x2193,0x3013, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,0x2229, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2220,0x22A5,0x2312,0x2202,0x2207,0x2261, +0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x2235,0x222B, +0x222C, 0, 0, 0, 0, 0, 0, 0, +0x212B,0x2030,0x266F,0x266D,0x266A,0x2020,0x2021,0x00B6, + 0, 0, 0, 0,0x25EF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xFF10, +0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17,0xFF18, +0xFF19, 0, 0, 0, 0, 0, 0, 0, +0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27,0xFF28, +0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F,0xFF30, +0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37,0xFF38, +0xFF39,0xFF3A, 0, 0, 0, 0, 0, 0, + 0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47, +0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F, +0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57, +0xFF58,0xFF59,0xFF5A, 0, 0, 0, 0,0x3041, +0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048,0x3049, +0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050,0x3051, +0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058,0x3059, +0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060,0x3061, +0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068,0x3069, +0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070,0x3071, +0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078,0x3079, +0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080,0x3081, +0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088,0x3089, +0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090,0x3091, +0x3092,0x3093, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8, +0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0, +0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8, +0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0, +0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8, +0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0, +0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8, +0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF, 0, +0x30E0,0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7, +0x30E8,0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF, +0x30F0,0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6, 0, + 0, 0, 0, 0, 0, 0, 0,0x0391, +0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399, +0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0,0x03A1, +0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9, 0, + 0, 0, 0, 0, 0, 0, 0,0x03B1, +0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8,0x03B9, +0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0,0x03C1, +0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416, +0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426, +0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E, +0x042F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, +0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D, 0, +0x043E,0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445, +0x0446,0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D, +0x044E,0x044F, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2500, +0x2502,0x250C,0x2510,0x2518,0x2514,0x251C,0x252C,0x2524, +0x2534,0x253C,0x2501,0x2503,0x250F,0x2513,0x251B,0x2517, +0x2523,0x2533,0x252B,0x253B,0x254B,0x2520,0x252F,0x2528, +0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542}; + +/* page 2 0x889F-0x9FFC */ +static uint16 tab_sjis_uni2[]={ +0x4E9C,0x5516,0x5A03,0x963F,0x54C0,0x611B,0x6328,0x59F6, +0x9022,0x8475,0x831C,0x7A50,0x60AA,0x63E1,0x6E25,0x65ED, +0x8466,0x82A6,0x9BF5,0x6893,0x5727,0x65A1,0x6271,0x5B9B, +0x59D0,0x867B,0x98F4,0x7D62,0x7DBE,0x9B8E,0x6216,0x7C9F, +0x88B7,0x5B89,0x5EB5,0x6309,0x6697,0x6848,0x95C7,0x978D, +0x674F,0x4EE5,0x4F0A,0x4F4D,0x4F9D,0x5049,0x56F2,0x5937, +0x59D4,0x5A01,0x5C09,0x60DF,0x610F,0x6170,0x6613,0x6905, +0x70BA,0x754F,0x7570,0x79FB,0x7DAD,0x7DEF,0x80C3,0x840E, +0x8863,0x8B02,0x9055,0x907A,0x533B,0x4E95,0x4EA5,0x57DF, +0x80B2,0x90C1,0x78EF,0x4E00,0x58F1,0x6EA2,0x9038,0x7A32, +0x8328,0x828B,0x9C2F,0x5141,0x5370,0x54BD,0x54E1,0x56E0, +0x59FB,0x5F15,0x98F2,0x6DEB,0x80E4,0x852D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9662,0x9670,0x96A0,0x97FB,0x540B,0x53F3,0x5B87, +0x70CF,0x7FBD,0x8FC2,0x96E8,0x536F,0x9D5C,0x7ABA,0x4E11, +0x7893,0x81FC,0x6E26,0x5618,0x5504,0x6B1D,0x851A,0x9C3B, +0x59E5,0x53A9,0x6D66,0x74DC,0x958F,0x5642,0x4E91,0x904B, +0x96F2,0x834F,0x990C,0x53E1,0x55B6,0x5B30,0x5F71,0x6620, +0x66F3,0x6804,0x6C38,0x6CF3,0x6D29,0x745B,0x76C8,0x7A4E, +0x9834,0x82F1,0x885B,0x8A60,0x92ED,0x6DB2,0x75AB,0x76CA, +0x99C5,0x60A6,0x8B01,0x8D8A,0x95B2,0x698E,0x53AD,0x5186, + 0,0x5712,0x5830,0x5944,0x5BB4,0x5EF6,0x6028,0x63A9, +0x63F4,0x6CBF,0x6F14,0x708E,0x7114,0x7159,0x71D5,0x733F, +0x7E01,0x8276,0x82D1,0x8597,0x9060,0x925B,0x9D1B,0x5869, +0x65BC,0x6C5A,0x7525,0x51F9,0x592E,0x5965,0x5F80,0x5FDC, +0x62BC,0x65FA,0x6A2A,0x6B27,0x6BB4,0x738B,0x7FC1,0x8956, +0x9D2C,0x9D0E,0x9EC4,0x5CA1,0x6C96,0x837B,0x5104,0x5C4B, +0x61B6,0x81C6,0x6876,0x7261,0x4E59,0x4FFA,0x5378,0x6069, +0x6E29,0x7A4F,0x97F3,0x4E0B,0x5316,0x4EEE,0x4F55,0x4F3D, +0x4FA1,0x4F73,0x52A0,0x53EF,0x5609,0x590F,0x5AC1,0x5BB6, +0x5BE1,0x79D1,0x6687,0x679C,0x67B6,0x6B4C,0x6CB3,0x706B, +0x73C2,0x798D,0x79BE,0x7A3C,0x7B87,0x82B1,0x82DB,0x8304, +0x8377,0x83EF,0x83D3,0x8766,0x8AB2,0x5629,0x8CA8,0x8FE6, +0x904E,0x971E,0x868A,0x4FC4,0x5CE8,0x6211,0x7259,0x753B, +0x81E5,0x82BD,0x86FE,0x8CC0,0x96C5,0x9913,0x99D5,0x4ECB, +0x4F1A,0x89E3,0x56DE,0x584A,0x58CA,0x5EFB,0x5FEB,0x602A, +0x6094,0x6062,0x61D0,0x6212,0x62D0,0x6539, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9B41,0x6666,0x68B0,0x6D77,0x7070,0x754C,0x7686, +0x7D75,0x82A5,0x87F9,0x958B,0x968E,0x8C9D,0x51F1,0x52BE, +0x5916,0x54B3,0x5BB3,0x5D16,0x6168,0x6982,0x6DAF,0x788D, +0x84CB,0x8857,0x8A72,0x93A7,0x9AB8,0x6D6C,0x99A8,0x86D9, +0x57A3,0x67FF,0x86CE,0x920E,0x5283,0x5687,0x5404,0x5ED3, +0x62E1,0x64B9,0x683C,0x6838,0x6BBB,0x7372,0x78BA,0x7A6B, +0x899A,0x89D2,0x8D6B,0x8F03,0x90ED,0x95A3,0x9694,0x9769, +0x5B66,0x5CB3,0x697D,0x984D,0x984E,0x639B,0x7B20,0x6A2B, + 0,0x6A7F,0x68B6,0x9C0D,0x6F5F,0x5272,0x559D,0x6070, +0x62EC,0x6D3B,0x6E07,0x6ED1,0x845B,0x8910,0x8F44,0x4E14, +0x9C39,0x53F6,0x691B,0x6A3A,0x9784,0x682A,0x515C,0x7AC3, +0x84B2,0x91DC,0x938C,0x565B,0x9D28,0x6822,0x8305,0x8431, +0x7CA5,0x5208,0x82C5,0x74E6,0x4E7E,0x4F83,0x51A0,0x5BD2, +0x520A,0x52D8,0x52E7,0x5DFB,0x559A,0x582A,0x59E6,0x5B8C, +0x5B98,0x5BDB,0x5E72,0x5E79,0x60A3,0x611F,0x6163,0x61BE, +0x63DB,0x6562,0x67D1,0x6853,0x68FA,0x6B3E,0x6B53,0x6C57, +0x6F22,0x6F97,0x6F45,0x74B0,0x7518,0x76E3,0x770B,0x7AFF, +0x7BA1,0x7C21,0x7DE9,0x7F36,0x7FF0,0x809D,0x8266,0x839E, +0x89B3,0x8ACC,0x8CAB,0x9084,0x9451,0x9593,0x9591,0x95A2, +0x9665,0x97D3,0x9928,0x8218,0x4E38,0x542B,0x5CB8,0x5DCC, +0x73A9,0x764C,0x773C,0x5CA9,0x7FEB,0x8D0B,0x96C1,0x9811, +0x9854,0x9858,0x4F01,0x4F0E,0x5371,0x559C,0x5668,0x57FA, +0x5947,0x5B09,0x5BC4,0x5C90,0x5E0C,0x5E7E,0x5FCC,0x63EE, +0x673A,0x65D7,0x65E2,0x671F,0x68CB,0x68C4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6A5F,0x5E30,0x6BC5,0x6C17,0x6C7D,0x757F,0x7948, +0x5B63,0x7A00,0x7D00,0x5FBD,0x898F,0x8A18,0x8CB4,0x8D77, +0x8ECC,0x8F1D,0x98E2,0x9A0E,0x9B3C,0x4E80,0x507D,0x5100, +0x5993,0x5B9C,0x622F,0x6280,0x64EC,0x6B3A,0x72A0,0x7591, +0x7947,0x7FA9,0x87FB,0x8ABC,0x8B70,0x63AC,0x83CA,0x97A0, +0x5409,0x5403,0x55AB,0x6854,0x6A58,0x8A70,0x7827,0x6775, +0x9ECD,0x5374,0x5BA2,0x811A,0x8650,0x9006,0x4E18,0x4E45, +0x4EC7,0x4F11,0x53CA,0x5438,0x5BAE,0x5F13,0x6025,0x6551, + 0,0x673D,0x6C42,0x6C72,0x6CE3,0x7078,0x7403,0x7A76, +0x7AAE,0x7B08,0x7D1A,0x7CFE,0x7D66,0x65E7,0x725B,0x53BB, +0x5C45,0x5DE8,0x62D2,0x62E0,0x6319,0x6E20,0x865A,0x8A31, +0x8DDD,0x92F8,0x6F01,0x79A6,0x9B5A,0x4EA8,0x4EAB,0x4EAC, +0x4F9B,0x4FA0,0x50D1,0x5147,0x7AF6,0x5171,0x51F6,0x5354, +0x5321,0x537F,0x53EB,0x55AC,0x5883,0x5CE1,0x5F37,0x5F4A, +0x602F,0x6050,0x606D,0x631F,0x6559,0x6A4B,0x6CC1,0x72C2, +0x72ED,0x77EF,0x80F8,0x8105,0x8208,0x854E,0x90F7,0x93E1, +0x97FF,0x9957,0x9A5A,0x4EF0,0x51DD,0x5C2D,0x6681,0x696D, +0x5C40,0x66F2,0x6975,0x7389,0x6850,0x7C81,0x50C5,0x52E4, +0x5747,0x5DFE,0x9326,0x65A4,0x6B23,0x6B3D,0x7434,0x7981, +0x79BD,0x7B4B,0x7DCA,0x82B9,0x83CC,0x887F,0x895F,0x8B39, +0x8FD1,0x91D1,0x541F,0x9280,0x4E5D,0x5036,0x53E5,0x533A, +0x72D7,0x7396,0x77E9,0x82E6,0x8EAF,0x99C6,0x99C8,0x99D2, +0x5177,0x611A,0x865E,0x55B0,0x7A7A,0x5076,0x5BD3,0x9047, +0x9685,0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6398,0x7A9F,0x6C93,0x9774,0x8F61,0x7AAA,0x718A, +0x9688,0x7C82,0x6817,0x7E70,0x6851,0x936C,0x52F2,0x541B, +0x85AB,0x8A13,0x7FA4,0x8ECD,0x90E1,0x5366,0x8888,0x7941, +0x4FC2,0x50BE,0x5211,0x5144,0x5553,0x572D,0x73EA,0x578B, +0x5951,0x5F62,0x5F84,0x6075,0x6176,0x6167,0x61A9,0x63B2, +0x643A,0x656C,0x666F,0x6842,0x6E13,0x7566,0x7A3D,0x7CFB, +0x7D4C,0x7D99,0x7E4B,0x7F6B,0x830E,0x834A,0x86CD,0x8A08, +0x8A63,0x8B66,0x8EFD,0x981A,0x9D8F,0x82B8,0x8FCE,0x9BE8, + 0,0x5287,0x621F,0x6483,0x6FC0,0x9699,0x6841,0x5091, +0x6B20,0x6C7A,0x6F54,0x7A74,0x7D50,0x8840,0x8A23,0x6708, +0x4EF6,0x5039,0x5026,0x5065,0x517C,0x5238,0x5263,0x55A7, +0x570F,0x5805,0x5ACC,0x5EFA,0x61B2,0x61F8,0x62F3,0x6372, +0x691C,0x6A29,0x727D,0x72AC,0x732E,0x7814,0x786F,0x7D79, +0x770C,0x80A9,0x898B,0x8B19,0x8CE2,0x8ED2,0x9063,0x9375, +0x967A,0x9855,0x9A13,0x9E78,0x5143,0x539F,0x53B3,0x5E7B, +0x5F26,0x6E1B,0x6E90,0x7384,0x73FE,0x7D43,0x8237,0x8A00, +0x8AFA,0x9650,0x4E4E,0x500B,0x53E4,0x547C,0x56FA,0x59D1, +0x5B64,0x5DF1,0x5EAB,0x5F27,0x6238,0x6545,0x67AF,0x6E56, +0x72D0,0x7CCA,0x88B4,0x80A1,0x80E1,0x83F0,0x864E,0x8A87, +0x8DE8,0x9237,0x96C7,0x9867,0x9F13,0x4E94,0x4E92,0x4F0D, +0x5348,0x5449,0x543E,0x5A2F,0x5F8C,0x5FA1,0x609F,0x68A7, +0x6A8E,0x745A,0x7881,0x8A9E,0x8AA4,0x8B77,0x9190,0x4E5E, +0x9BC9,0x4EA4,0x4F7C,0x4FAF,0x5019,0x5016,0x5149,0x516C, +0x529F,0x52B9,0x52FE,0x539A,0x53E3,0x5411, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x540E,0x5589,0x5751,0x57A2,0x597D,0x5B54,0x5B5D, +0x5B8F,0x5DE5,0x5DE7,0x5DF7,0x5E78,0x5E83,0x5E9A,0x5EB7, +0x5F18,0x6052,0x614C,0x6297,0x62D8,0x63A7,0x653B,0x6602, +0x6643,0x66F4,0x676D,0x6821,0x6897,0x69CB,0x6C5F,0x6D2A, +0x6D69,0x6E2F,0x6E9D,0x7532,0x7687,0x786C,0x7A3F,0x7CE0, +0x7D05,0x7D18,0x7D5E,0x7DB1,0x8015,0x8003,0x80AF,0x80B1, +0x8154,0x818F,0x822A,0x8352,0x884C,0x8861,0x8B1B,0x8CA2, +0x8CFC,0x90CA,0x9175,0x9271,0x783F,0x92FC,0x95A4,0x964D, + 0,0x9805,0x9999,0x9AD8,0x9D3B,0x525B,0x52AB,0x53F7, +0x5408,0x58D5,0x62F7,0x6FE0,0x8C6A,0x8F5F,0x9EB9,0x514B, +0x523B,0x544A,0x56FD,0x7A40,0x9177,0x9D60,0x9ED2,0x7344, +0x6F09,0x8170,0x7511,0x5FFD,0x60DA,0x9AA8,0x72DB,0x8FBC, +0x6B64,0x9803,0x4ECA,0x56F0,0x5764,0x58BE,0x5A5A,0x6068, +0x61C7,0x660F,0x6606,0x6839,0x68B1,0x6DF7,0x75D5,0x7D3A, +0x826E,0x9B42,0x4E9B,0x4F50,0x53C9,0x5506,0x5D6F,0x5DE6, +0x5DEE,0x67FB,0x6C99,0x7473,0x7802,0x8A50,0x9396,0x88DF, +0x5750,0x5EA7,0x632B,0x50B5,0x50AC,0x518D,0x6700,0x54C9, +0x585E,0x59BB,0x5BB0,0x5F69,0x624D,0x63A1,0x683D,0x6B73, +0x6E08,0x707D,0x91C7,0x7280,0x7815,0x7826,0x796D,0x658E, +0x7D30,0x83DC,0x88C1,0x8F09,0x969B,0x5264,0x5728,0x6750, +0x7F6A,0x8CA1,0x51B4,0x5742,0x962A,0x583A,0x698A,0x80B4, +0x54B2,0x5D0E,0x57FC,0x7895,0x9DFA,0x4F5C,0x524A,0x548B, +0x643E,0x6628,0x6714,0x67F5,0x7A84,0x7B56,0x7D22,0x932F, +0x685C,0x9BAD,0x7B39,0x5319,0x518A,0x5237, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5BDF,0x62F6,0x64AE,0x64E6,0x672D,0x6BBA,0x85A9, +0x96D1,0x7690,0x9BD6,0x634C,0x9306,0x9BAB,0x76BF,0x6652, +0x4E09,0x5098,0x53C2,0x5C71,0x60E8,0x6492,0x6563,0x685F, +0x71E6,0x73CA,0x7523,0x7B97,0x7E82,0x8695,0x8B83,0x8CDB, +0x9178,0x9910,0x65AC,0x66AB,0x6B8B,0x4ED5,0x4ED4,0x4F3A, +0x4F7F,0x523A,0x53F8,0x53F2,0x55E3,0x56DB,0x58EB,0x59CB, +0x59C9,0x59FF,0x5B50,0x5C4D,0x5E02,0x5E2B,0x5FD7,0x601D, +0x6307,0x652F,0x5B5C,0x65AF,0x65BD,0x65E8,0x679D,0x6B62, + 0,0x6B7B,0x6C0F,0x7345,0x7949,0x79C1,0x7CF8,0x7D19, +0x7D2B,0x80A2,0x8102,0x81F3,0x8996,0x8A5E,0x8A69,0x8A66, +0x8A8C,0x8AEE,0x8CC7,0x8CDC,0x96CC,0x98FC,0x6B6F,0x4E8B, +0x4F3C,0x4F8D,0x5150,0x5B57,0x5BFA,0x6148,0x6301,0x6642, +0x6B21,0x6ECB,0x6CBB,0x723E,0x74BD,0x75D4,0x78C1,0x793A, +0x800C,0x8033,0x81EA,0x8494,0x8F9E,0x6C50,0x9E7F,0x5F0F, +0x8B58,0x9D2B,0x7AFA,0x8EF8,0x5B8D,0x96EB,0x4E03,0x53F1, +0x57F7,0x5931,0x5AC9,0x5BA4,0x6089,0x6E7F,0x6F06,0x75BE, +0x8CEA,0x5B9F,0x8500,0x7BE0,0x5072,0x67F4,0x829D,0x5C61, +0x854A,0x7E1E,0x820E,0x5199,0x5C04,0x6368,0x8D66,0x659C, +0x716E,0x793E,0x7D17,0x8005,0x8B1D,0x8ECA,0x906E,0x86C7, +0x90AA,0x501F,0x52FA,0x5C3A,0x6753,0x707C,0x7235,0x914C, +0x91C8,0x932B,0x82E5,0x5BC2,0x5F31,0x60F9,0x4E3B,0x53D6, +0x5B88,0x624B,0x6731,0x6B8A,0x72E9,0x73E0,0x7A2E,0x816B, +0x8DA3,0x9152,0x9996,0x5112,0x53D7,0x546A,0x5BFF,0x6388, +0x6A39,0x7DAC,0x9700,0x56DA,0x53CE,0x5468, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B97,0x5C31,0x5DDE,0x4FEE,0x6101,0x62FE,0x6D32, +0x79C0,0x79CB,0x7D42,0x7E4D,0x7FD2,0x81ED,0x821F,0x8490, +0x8846,0x8972,0x8B90,0x8E74,0x8F2F,0x9031,0x914B,0x916C, +0x96C6,0x919C,0x4EC0,0x4F4F,0x5145,0x5341,0x5F93,0x620E, +0x67D4,0x6C41,0x6E0B,0x7363,0x7E26,0x91CD,0x9283,0x53D4, +0x5919,0x5BBF,0x6DD1,0x795D,0x7E2E,0x7C9B,0x587E,0x719F, +0x51FA,0x8853,0x8FF0,0x4FCA,0x5CFB,0x6625,0x77AC,0x7AE3, +0x821C,0x99FF,0x51C6,0x5FAA,0x65EC,0x696F,0x6B89,0x6DF3, + 0,0x6E96,0x6F64,0x76FE,0x7D14,0x5DE1,0x9075,0x9187, +0x9806,0x51E6,0x521D,0x6240,0x6691,0x66D9,0x6E1A,0x5EB6, +0x7DD2,0x7F72,0x66F8,0x85AF,0x85F7,0x8AF8,0x52A9,0x53D9, +0x5973,0x5E8F,0x5F90,0x6055,0x92E4,0x9664,0x50B7,0x511F, +0x52DD,0x5320,0x5347,0x53EC,0x54E8,0x5546,0x5531,0x5617, +0x5968,0x59BE,0x5A3C,0x5BB5,0x5C06,0x5C0F,0x5C11,0x5C1A, +0x5E84,0x5E8A,0x5EE0,0x5F70,0x627F,0x6284,0x62DB,0x638C, +0x6377,0x6607,0x660C,0x662D,0x6676,0x677E,0x68A2,0x6A1F, +0x6A35,0x6CBC,0x6D88,0x6E09,0x6E58,0x713C,0x7126,0x7167, +0x75C7,0x7701,0x785D,0x7901,0x7965,0x79F0,0x7AE0,0x7B11, +0x7CA7,0x7D39,0x8096,0x83D6,0x848B,0x8549,0x885D,0x88F3, +0x8A1F,0x8A3C,0x8A54,0x8A73,0x8C61,0x8CDE,0x91A4,0x9266, +0x937E,0x9418,0x969C,0x9798,0x4E0A,0x4E08,0x4E1E,0x4E57, +0x5197,0x5270,0x57CE,0x5834,0x58CC,0x5B22,0x5E38,0x60C5, +0x64FE,0x6761,0x6756,0x6D44,0x72B6,0x7573,0x7A63,0x84B8, +0x8B72,0x91B8,0x9320,0x5631,0x57F4,0x98FE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x62ED,0x690D,0x6B96,0x71ED,0x7E54,0x8077,0x8272, +0x89E6,0x98DF,0x8755,0x8FB1,0x5C3B,0x4F38,0x4FE1,0x4FB5, +0x5507,0x5A20,0x5BDD,0x5BE9,0x5FC3,0x614E,0x632F,0x65B0, +0x664B,0x68EE,0x699B,0x6D78,0x6DF1,0x7533,0x75B9,0x771F, +0x795E,0x79E6,0x7D33,0x81E3,0x82AF,0x85AA,0x89AA,0x8A3A, +0x8EAB,0x8F9B,0x9032,0x91DD,0x9707,0x4EBA,0x4EC1,0x5203, +0x5875,0x58EC,0x5C0B,0x751A,0x5C3D,0x814E,0x8A0A,0x8FC5, +0x9663,0x976D,0x7B25,0x8ACF,0x9808,0x9162,0x56F3,0x53A8, + 0,0x9017,0x5439,0x5782,0x5E25,0x63A8,0x6C34,0x708A, +0x7761,0x7C8B,0x7FE0,0x8870,0x9042,0x9154,0x9310,0x9318, +0x968F,0x745E,0x9AC4,0x5D07,0x5D69,0x6570,0x67A2,0x8DA8, +0x96DB,0x636E,0x6749,0x6919,0x83C5,0x9817,0x96C0,0x88FE, +0x6F84,0x647A,0x5BF8,0x4E16,0x702C,0x755D,0x662F,0x51C4, +0x5236,0x52E2,0x59D3,0x5F81,0x6027,0x6210,0x653F,0x6574, +0x661F,0x6674,0x68F2,0x6816,0x6B63,0x6E05,0x7272,0x751F, +0x76DB,0x7CBE,0x8056,0x58F0,0x88FD,0x897F,0x8AA0,0x8A93, +0x8ACB,0x901D,0x9192,0x9752,0x9759,0x6589,0x7A0E,0x8106, +0x96BB,0x5E2D,0x60DC,0x621A,0x65A5,0x6614,0x6790,0x77F3, +0x7A4D,0x7C4D,0x7E3E,0x810A,0x8CAC,0x8D64,0x8DE1,0x8E5F, +0x78A9,0x5207,0x62D9,0x63A5,0x6442,0x6298,0x8A2D,0x7A83, +0x7BC0,0x8AAC,0x96EA,0x7D76,0x820C,0x8749,0x4ED9,0x5148, +0x5343,0x5360,0x5BA3,0x5C02,0x5C16,0x5DDD,0x6226,0x6247, +0x64B0,0x6813,0x6834,0x6CC9,0x6D45,0x6D17,0x67D3,0x6F5C, +0x714E,0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x7E4A,0x7FA8,0x817A,0x821B,0x8239,0x85A6,0x8A6E, +0x8CCE,0x8DF5,0x9078,0x9077,0x92AD,0x9291,0x9583,0x9BAE, +0x524D,0x5584,0x6F38,0x7136,0x5168,0x7985,0x7E55,0x81B3, +0x7CCE,0x564C,0x5851,0x5CA8,0x63AA,0x66FE,0x66FD,0x695A, +0x72D9,0x758F,0x758E,0x790E,0x7956,0x79DF,0x7C97,0x7D20, +0x7D44,0x8607,0x8A34,0x963B,0x9061,0x9F20,0x50E7,0x5275, +0x53CC,0x53E2,0x5009,0x55AA,0x58EE,0x594F,0x723D,0x5B8B, +0x5C64,0x531D,0x60E3,0x60F3,0x635C,0x6383,0x633F,0x63BB, + 0,0x64CD,0x65E9,0x66F9,0x5DE3,0x69CD,0x69FD,0x6F15, +0x71E5,0x4E89,0x75E9,0x76F8,0x7A93,0x7CDF,0x7DCF,0x7D9C, +0x8061,0x8349,0x8358,0x846C,0x84BC,0x85FB,0x88C5,0x8D70, +0x9001,0x906D,0x9397,0x971C,0x9A12,0x50CF,0x5897,0x618E, +0x81D3,0x8535,0x8D08,0x9020,0x4FC3,0x5074,0x5247,0x5373, +0x606F,0x6349,0x675F,0x6E2C,0x8DB3,0x901F,0x4FD7,0x5C5E, +0x8CCA,0x65CF,0x7D9A,0x5352,0x8896,0x5176,0x63C3,0x5B58, +0x5B6B,0x5C0A,0x640D,0x6751,0x905C,0x4ED6,0x591A,0x592A, +0x6C70,0x8A51,0x553E,0x5815,0x59A5,0x60F0,0x6253,0x67C1, +0x8235,0x6955,0x9640,0x99C4,0x9A28,0x4F53,0x5806,0x5BFE, +0x8010,0x5CB1,0x5E2F,0x5F85,0x6020,0x614B,0x6234,0x66FF, +0x6CF0,0x6EDE,0x80CE,0x817F,0x82D4,0x888B,0x8CB8,0x9000, +0x902E,0x968A,0x9EDB,0x9BDB,0x4EE3,0x53F0,0x5927,0x7B2C, +0x918D,0x984C,0x9DF9,0x6EDD,0x7027,0x5353,0x5544,0x5B85, +0x6258,0x629E,0x62D3,0x6CA2,0x6FEF,0x7422,0x8A17,0x9438, +0x6FC1,0x8AFE,0x8338,0x51E7,0x86F8,0x53EA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x53E9,0x4F46,0x9054,0x8FB0,0x596A,0x8131,0x5DFD, +0x7AEA,0x8FBF,0x68DA,0x8C37,0x72F8,0x9C48,0x6A3D,0x8AB0, +0x4E39,0x5358,0x5606,0x5766,0x62C5,0x63A2,0x65E6,0x6B4E, +0x6DE1,0x6E5B,0x70AD,0x77ED,0x7AEF,0x7BAA,0x7DBB,0x803D, +0x80C6,0x86CB,0x8A95,0x935B,0x56E3,0x58C7,0x5F3E,0x65AD, +0x6696,0x6A80,0x6BB5,0x7537,0x8AC7,0x5024,0x77E5,0x5730, +0x5F1B,0x6065,0x667A,0x6C60,0x75F4,0x7A1A,0x7F6E,0x81F4, +0x8718,0x9045,0x99B3,0x7BC9,0x755C,0x7AF9,0x7B51,0x84C4, + 0,0x9010,0x79E9,0x7A92,0x8336,0x5AE1,0x7740,0x4E2D, +0x4EF2,0x5B99,0x5FE0,0x62BD,0x663C,0x67F1,0x6CE8,0x866B, +0x8877,0x8A3B,0x914E,0x92F3,0x99D0,0x6A17,0x7026,0x732A, +0x82E7,0x8457,0x8CAF,0x4E01,0x5146,0x51CB,0x558B,0x5BF5, +0x5E16,0x5E33,0x5E81,0x5F14,0x5F35,0x5F6B,0x5FB4,0x61F2, +0x6311,0x66A2,0x671D,0x6F6E,0x7252,0x753A,0x773A,0x8074, +0x8139,0x8178,0x8776,0x8ABF,0x8ADC,0x8D85,0x8DF3,0x929A, +0x9577,0x9802,0x9CE5,0x52C5,0x6357,0x76F4,0x6715,0x6C88, +0x73CD,0x8CC3,0x93AE,0x9673,0x6D25,0x589C,0x690E,0x69CC, +0x8FFD,0x939A,0x75DB,0x901A,0x585A,0x6802,0x63B4,0x69FB, +0x4F43,0x6F2C,0x67D8,0x8FBB,0x8526,0x7DB4,0x9354,0x693F, +0x6F70,0x576A,0x58F7,0x5B2C,0x7D2C,0x722A,0x540A,0x91E3, +0x9DB4,0x4EAD,0x4F4E,0x505C,0x5075,0x5243,0x8C9E,0x5448, +0x5824,0x5B9A,0x5E1D,0x5E95,0x5EAD,0x5EF7,0x5F1F,0x608C, +0x62B5,0x633A,0x63D0,0x68AF,0x6C40,0x7887,0x798E,0x7A0B, +0x7DE0,0x8247,0x8A02,0x8AE6,0x8E44,0x9013, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x90B8,0x912D,0x91D8,0x9F0E,0x6CE5,0x6458,0x64E2, +0x6575,0x6EF4,0x7684,0x7B1B,0x9069,0x93D1,0x6EBA,0x54F2, +0x5FB9,0x64A4,0x8F4D,0x8FED,0x9244,0x5178,0x586B,0x5929, +0x5C55,0x5E97,0x6DFB,0x7E8F,0x751C,0x8CBC,0x8EE2,0x985B, +0x70B9,0x4F1D,0x6BBF,0x6FB1,0x7530,0x96FB,0x514E,0x5410, +0x5835,0x5857,0x59AC,0x5C60,0x5F92,0x6597,0x675C,0x6E21, +0x767B,0x83DF,0x8CED,0x9014,0x90FD,0x934D,0x7825,0x783A, +0x52AA,0x5EA6,0x571F,0x5974,0x6012,0x5012,0x515A,0x51AC, + 0,0x51CD,0x5200,0x5510,0x5854,0x5858,0x5957,0x5B95, +0x5CF6,0x5D8B,0x60BC,0x6295,0x642D,0x6771,0x6843,0x68BC, +0x68DF,0x76D7,0x6DD8,0x6E6F,0x6D9B,0x706F,0x71C8,0x5F53, +0x75D8,0x7977,0x7B49,0x7B54,0x7B52,0x7CD6,0x7D71,0x5230, +0x8463,0x8569,0x85E4,0x8A0E,0x8B04,0x8C46,0x8E0F,0x9003, +0x900F,0x9419,0x9676,0x982D,0x9A30,0x95D8,0x50CD,0x52D5, +0x540C,0x5802,0x5C0E,0x61A7,0x649E,0x6D1E,0x77B3,0x7AE5, +0x80F4,0x8404,0x9053,0x9285,0x5CE0,0x9D07,0x533F,0x5F97, +0x5FB3,0x6D9C,0x7279,0x7763,0x79BF,0x7BE4,0x6BD2,0x72EC, +0x8AAD,0x6803,0x6A61,0x51F8,0x7A81,0x6934,0x5C4A,0x9CF6, +0x82EB,0x5BC5,0x9149,0x701E,0x5678,0x5C6F,0x60C7,0x6566, +0x6C8C,0x8C5A,0x9041,0x9813,0x5451,0x66C7,0x920D,0x5948, +0x90A3,0x5185,0x4E4D,0x51EA,0x8599,0x8B0E,0x7058,0x637A, +0x934B,0x6962,0x99B4,0x7E04,0x7577,0x5357,0x6960,0x8EDF, +0x96E3,0x6C5D,0x4E8C,0x5C3C,0x5F10,0x8FE9,0x5302,0x8CD1, +0x8089,0x8679,0x5EFF,0x65E5,0x4E73,0x5165, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5982,0x5C3F,0x97EE,0x4EFB,0x598A,0x5FCD,0x8A8D, +0x6FE1,0x79B0,0x7962,0x5BE7,0x8471,0x732B,0x71B1,0x5E74, +0x5FF5,0x637B,0x649A,0x71C3,0x7C98,0x4E43,0x5EFC,0x4E4B, +0x57DC,0x56A2,0x60A9,0x6FC3,0x7D0D,0x80FD,0x8133,0x81BF, +0x8FB2,0x8997,0x86A4,0x5DF4,0x628A,0x64AD,0x8987,0x6777, +0x6CE2,0x6D3E,0x7436,0x7834,0x5A46,0x7F75,0x82AD,0x99AC, +0x4FF3,0x5EC3,0x62DD,0x6392,0x6557,0x676F,0x76C3,0x724C, +0x80CC,0x80BA,0x8F29,0x914D,0x500D,0x57F9,0x5A92,0x6885, + 0,0x6973,0x7164,0x72FD,0x8CB7,0x58F2,0x8CE0,0x966A, +0x9019,0x877F,0x79E4,0x77E7,0x8429,0x4F2F,0x5265,0x535A, +0x62CD,0x67CF,0x6CCA,0x767D,0x7B94,0x7C95,0x8236,0x8584, +0x8FEB,0x66DD,0x6F20,0x7206,0x7E1B,0x83AB,0x99C1,0x9EA6, +0x51FD,0x7BB1,0x7872,0x7BB8,0x8087,0x7B48,0x6AE8,0x5E61, +0x808C,0x7551,0x7560,0x516B,0x9262,0x6E8C,0x767A,0x9197, +0x9AEA,0x4F10,0x7F70,0x629C,0x7B4F,0x95A5,0x9CE9,0x567A, +0x5859,0x86E4,0x96BC,0x4F34,0x5224,0x534A,0x53CD,0x53DB, +0x5E06,0x642C,0x6591,0x677F,0x6C3E,0x6C4E,0x7248,0x72AF, +0x73ED,0x7554,0x7E41,0x822C,0x85E9,0x8CA9,0x7BC4,0x91C6, +0x7169,0x9812,0x98EF,0x633D,0x6669,0x756A,0x76E4,0x78D0, +0x8543,0x86EE,0x532A,0x5351,0x5426,0x5983,0x5E87,0x5F7C, +0x60B2,0x6249,0x6279,0x62AB,0x6590,0x6BD4,0x6CCC,0x75B2, +0x76AE,0x7891,0x79D8,0x7DCB,0x7F77,0x80A5,0x88AB,0x8AB9, +0x8CBB,0x907F,0x975E,0x98DB,0x6A0B,0x7C38,0x5099,0x5C3E, +0x5FAE,0x6787,0x6BD8,0x7435,0x7709,0x7F8E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9F3B,0x67CA,0x7A17,0x5339,0x758B,0x9AED,0x5F66, +0x819D,0x83F1,0x8098,0x5F3C,0x5FC5,0x7562,0x7B46,0x903C, +0x6867,0x59EB,0x5A9B,0x7D10,0x767E,0x8B2C,0x4FF5,0x5F6A, +0x6A19,0x6C37,0x6F02,0x74E2,0x7968,0x8868,0x8A55,0x8C79, +0x5EDF,0x63CF,0x75C5,0x79D2,0x82D7,0x9328,0x92F2,0x849C, +0x86ED,0x9C2D,0x54C1,0x5F6C,0x658C,0x6D5C,0x7015,0x8CA7, +0x8CD3,0x983B,0x654F,0x74F6,0x4E0D,0x4ED8,0x57E0,0x592B, +0x5A66,0x5BCC,0x51A8,0x5E03,0x5E9C,0x6016,0x6276,0x6577, + 0,0x65A7,0x666E,0x6D6E,0x7236,0x7B26,0x8150,0x819A, +0x8299,0x8B5C,0x8CA0,0x8CE6,0x8D74,0x961C,0x9644,0x4FAE, +0x64AB,0x6B66,0x821E,0x8461,0x856A,0x90E8,0x5C01,0x6953, +0x98A8,0x847A,0x8557,0x4F0F,0x526F,0x5FA9,0x5E45,0x670D, +0x798F,0x8179,0x8907,0x8986,0x6DF5,0x5F17,0x6255,0x6CB8, +0x4ECF,0x7269,0x9B92,0x5206,0x543B,0x5674,0x58B3,0x61A4, +0x626E,0x711A,0x596E,0x7C89,0x7CDE,0x7D1B,0x96F0,0x6587, +0x805E,0x4E19,0x4F75,0x5175,0x5840,0x5E63,0x5E73,0x5F0A, +0x67C4,0x4E26,0x853D,0x9589,0x965B,0x7C73,0x9801,0x50FB, +0x58C1,0x7656,0x78A7,0x5225,0x77A5,0x8511,0x7B86,0x504F, +0x5909,0x7247,0x7BC7,0x7DE8,0x8FBA,0x8FD4,0x904D,0x4FBF, +0x52C9,0x5A29,0x5F01,0x97AD,0x4FDD,0x8217,0x92EA,0x5703, +0x6355,0x6B69,0x752B,0x88DC,0x8F14,0x7A42,0x52DF,0x5893, +0x6155,0x620A,0x66AE,0x6BCD,0x7C3F,0x83E9,0x5023,0x4FF8, +0x5305,0x5446,0x5831,0x5949,0x5B9D,0x5CF0,0x5CEF,0x5D29, +0x5E96,0x62B1,0x6367,0x653E,0x65B9,0x670B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6CD5,0x6CE1,0x70F9,0x7832,0x7E2B,0x80DE,0x82B3, +0x840C,0x84EC,0x8702,0x8912,0x8A2A,0x8C4A,0x90A6,0x92D2, +0x98FD,0x9CF3,0x9D6C,0x4E4F,0x4EA1,0x508D,0x5256,0x574A, +0x59A8,0x5E3D,0x5FD8,0x5FD9,0x623F,0x66B4,0x671B,0x67D0, +0x68D2,0x5192,0x7D21,0x80AA,0x81A8,0x8B00,0x8C8C,0x8CBF, +0x927E,0x9632,0x5420,0x982C,0x5317,0x50D5,0x535C,0x58A8, +0x64B2,0x6734,0x7267,0x7766,0x7A46,0x91E6,0x52C3,0x6CA1, +0x6B86,0x5800,0x5E4C,0x5954,0x672C,0x7FFB,0x51E1,0x76C6, + 0,0x6469,0x78E8,0x9B54,0x9EBB,0x57CB,0x59B9,0x6627, +0x679A,0x6BCE,0x54E9,0x69D9,0x5E55,0x819C,0x6795,0x9BAA, +0x67FE,0x9C52,0x685D,0x4EA6,0x4FE3,0x53C8,0x62B9,0x672B, +0x6CAB,0x8FC4,0x4FAD,0x7E6D,0x9EBF,0x4E07,0x6162,0x6E80, +0x6F2B,0x8513,0x5473,0x672A,0x9B45,0x5DF3,0x7B95,0x5CAC, +0x5BC6,0x871C,0x6E4A,0x84D1,0x7A14,0x8108,0x5999,0x7C8D, +0x6C11,0x7720,0x52D9,0x5922,0x7121,0x725F,0x77DB,0x9727, +0x9D61,0x690B,0x5A7F,0x5A18,0x51A5,0x540D,0x547D,0x660E, +0x76DF,0x8FF7,0x9298,0x9CF4,0x59EA,0x725D,0x6EC5,0x514D, +0x68C9,0x7DBF,0x7DEC,0x9762,0x9EBA,0x6478,0x6A21,0x8302, +0x5984,0x5B5F,0x6BDB,0x731B,0x76F2,0x7DB2,0x8017,0x8499, +0x5132,0x6728,0x9ED9,0x76EE,0x6762,0x52FF,0x9905,0x5C24, +0x623B,0x7C7E,0x8CB0,0x554F,0x60B6,0x7D0B,0x9580,0x5301, +0x4E5F,0x51B6,0x591C,0x723A,0x8036,0x91CE,0x5F25,0x77E2, +0x5384,0x5F79,0x7D04,0x85AC,0x8A33,0x8E8D,0x9756,0x67F3, +0x85AE,0x9453,0x6109,0x6108,0x6CB9,0x7652, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AED,0x8F38,0x552F,0x4F51,0x512A,0x52C7,0x53CB, +0x5BA5,0x5E7D,0x60A0,0x6182,0x63D6,0x6709,0x67DA,0x6E67, +0x6D8C,0x7336,0x7337,0x7531,0x7950,0x88D5,0x8A98,0x904A, +0x9091,0x90F5,0x96C4,0x878D,0x5915,0x4E88,0x4F59,0x4E0E, +0x8A89,0x8F3F,0x9810,0x50AD,0x5E7C,0x5996,0x5BB9,0x5EB8, +0x63DA,0x63FA,0x64C1,0x66DC,0x694A,0x69D8,0x6D0B,0x6EB6, +0x7194,0x7528,0x7AAF,0x7F8A,0x8000,0x8449,0x84C9,0x8981, +0x8B21,0x8E0A,0x9065,0x967D,0x990A,0x617E,0x6291,0x6B32, + 0,0x6C83,0x6D74,0x7FCC,0x7FFC,0x6DC0,0x7F85,0x87BA, +0x88F8,0x6765,0x83B1,0x983C,0x96F7,0x6D1B,0x7D61,0x843D, +0x916A,0x4E71,0x5375,0x5D50,0x6B04,0x6FEB,0x85CD,0x862D, +0x89A7,0x5229,0x540F,0x5C65,0x674E,0x68A8,0x7406,0x7483, +0x75E2,0x88CF,0x88E1,0x91CC,0x96E2,0x9678,0x5F8B,0x7387, +0x7ACB,0x844E,0x63A0,0x7565,0x5289,0x6D41,0x6E9C,0x7409, +0x7559,0x786B,0x7C92,0x9686,0x7ADC,0x9F8D,0x4FB6,0x616E, +0x65C5,0x865C,0x4E86,0x4EAE,0x50DA,0x4E21,0x51CC,0x5BEE, +0x6599,0x6881,0x6DBC,0x731F,0x7642,0x77AD,0x7A1C,0x7CE7, +0x826F,0x8AD2,0x907C,0x91CF,0x9675,0x9818,0x529B,0x7DD1, +0x502B,0x5398,0x6797,0x6DCB,0x71D0,0x7433,0x81E8,0x8F2A, +0x96A3,0x9C57,0x9E9F,0x7460,0x5841,0x6D99,0x7D2F,0x985E, +0x4EE4,0x4F36,0x4F8B,0x51B7,0x52B1,0x5DBA,0x601C,0x73B2, +0x793C,0x82D3,0x9234,0x96B7,0x96F6,0x970A,0x9E97,0x9F62, +0x66A6,0x6B74,0x5217,0x52A3,0x70C8,0x88C2,0x5EC9,0x604B, +0x6190,0x6F23,0x7149,0x7C3E,0x7DF4,0x806F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x84EE,0x9023,0x932C,0x5442,0x9B6F,0x6AD3,0x7089, +0x8CC2,0x8DEF,0x9732,0x52B4,0x5A41,0x5ECA,0x5F04,0x6717, +0x697C,0x6994,0x6D6A,0x6F0F,0x7262,0x72FC,0x7BED,0x8001, +0x807E,0x874B,0x90CE,0x516D,0x9E93,0x7984,0x808B,0x9332, +0x8AD6,0x502D,0x548C,0x8A71,0x6B6A,0x8CC4,0x8107,0x60D1, +0x67A0,0x9DF2,0x4E99,0x4E98,0x9C10,0x8A6B,0x85C1,0x8568, +0x6900,0x6E7E,0x7897,0x8155, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F0C,0x4E10,0x4E15,0x4E2A,0x4E31,0x4E36,0x4E3C,0x4E3F, +0x4E42,0x4E56,0x4E58,0x4E82,0x4E85,0x8C6B,0x4E8A,0x8212, +0x5F0D,0x4E8E,0x4E9E,0x4E9F,0x4EA0,0x4EA2,0x4EB0,0x4EB3, +0x4EB6,0x4ECE,0x4ECD,0x4EC4,0x4EC6,0x4EC2,0x4ED7,0x4EDE, +0x4EED,0x4EDF,0x4EF7,0x4F09,0x4F5A,0x4F30,0x4F5B,0x4F5D, +0x4F57,0x4F47,0x4F76,0x4F88,0x4F8F,0x4F98,0x4F7B,0x4F69, +0x4F70,0x4F91,0x4F6F,0x4F86,0x4F96,0x5118,0x4FD4,0x4FDF, +0x4FCE,0x4FD8,0x4FDB,0x4FD1,0x4FDA,0x4FD0,0x4FE4,0x4FE5, +0x501A,0x5028,0x5014,0x502A,0x5025,0x5005,0x4F1C,0x4FF6, +0x5021,0x5029,0x502C,0x4FFE,0x4FEF,0x5011,0x5006,0x5043, +0x5047,0x6703,0x5055,0x5050,0x5048,0x505A,0x5056,0x506C, +0x5078,0x5080,0x509A,0x5085,0x50B4,0x50B2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x50C9,0x50CA,0x50B3,0x50C2,0x50D6,0x50DE,0x50E5, +0x50ED,0x50E3,0x50EE,0x50F9,0x50F5,0x5109,0x5101,0x5102, +0x5116,0x5115,0x5114,0x511A,0x5121,0x513A,0x5137,0x513C, +0x513B,0x513F,0x5140,0x5152,0x514C,0x5154,0x5162,0x7AF8, +0x5169,0x516A,0x516E,0x5180,0x5182,0x56D8,0x518C,0x5189, +0x518F,0x5191,0x5193,0x5195,0x5196,0x51A4,0x51A6,0x51A2, +0x51A9,0x51AA,0x51AB,0x51B3,0x51B1,0x51B2,0x51B0,0x51B5, +0x51BD,0x51C5,0x51C9,0x51DB,0x51E0,0x8655,0x51E9,0x51ED, + 0,0x51F0,0x51F5,0x51FE,0x5204,0x520B,0x5214,0x520E, +0x5227,0x522A,0x522E,0x5233,0x5239,0x524F,0x5244,0x524B, +0x524C,0x525E,0x5254,0x526A,0x5274,0x5269,0x5273,0x527F, +0x527D,0x528D,0x5294,0x5292,0x5271,0x5288,0x5291,0x8FA8, +0x8FA7,0x52AC,0x52AD,0x52BC,0x52B5,0x52C1,0x52CD,0x52D7, +0x52DE,0x52E3,0x52E6,0x98ED,0x52E0,0x52F3,0x52F5,0x52F8, +0x52F9,0x5306,0x5308,0x7538,0x530D,0x5310,0x530F,0x5315, +0x531A,0x5323,0x532F,0x5331,0x5333,0x5338,0x5340,0x5346, +0x5345,0x4E17,0x5349,0x534D,0x51D6,0x535E,0x5369,0x536E, +0x5918,0x537B,0x5377,0x5382,0x5396,0x53A0,0x53A6,0x53A5, +0x53AE,0x53B0,0x53B6,0x53C3,0x7C12,0x96D9,0x53DF,0x66FC, +0x71EE,0x53EE,0x53E8,0x53ED,0x53FA,0x5401,0x543D,0x5440, +0x542C,0x542D,0x543C,0x542E,0x5436,0x5429,0x541D,0x544E, +0x548F,0x5475,0x548E,0x545F,0x5471,0x5477,0x5470,0x5492, +0x547B,0x5480,0x5476,0x5484,0x5490,0x5486,0x54C7,0x54A2, +0x54B8,0x54A5,0x54AC,0x54C4,0x54C8,0x54A8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x54AB,0x54C2,0x54A4,0x54BE,0x54BC,0x54D8,0x54E5, +0x54E6,0x550F,0x5514,0x54FD,0x54EE,0x54ED,0x54FA,0x54E2, +0x5539,0x5540,0x5563,0x554C,0x552E,0x555C,0x5545,0x5556, +0x5557,0x5538,0x5533,0x555D,0x5599,0x5580,0x54AF,0x558A, +0x559F,0x557B,0x557E,0x5598,0x559E,0x55AE,0x557C,0x5583, +0x55A9,0x5587,0x55A8,0x55DA,0x55C5,0x55DF,0x55C4,0x55DC, +0x55E4,0x55D4,0x5614,0x55F7,0x5616,0x55FE,0x55FD,0x561B, +0x55F9,0x564E,0x5650,0x71DF,0x5634,0x5636,0x5632,0x5638, + 0,0x566B,0x5664,0x562F,0x566C,0x566A,0x5686,0x5680, +0x568A,0x56A0,0x5694,0x568F,0x56A5,0x56AE,0x56B6,0x56B4, +0x56C2,0x56BC,0x56C1,0x56C3,0x56C0,0x56C8,0x56CE,0x56D1, +0x56D3,0x56D7,0x56EE,0x56F9,0x5700,0x56FF,0x5704,0x5709, +0x5708,0x570B,0x570D,0x5713,0x5718,0x5716,0x55C7,0x571C, +0x5726,0x5737,0x5738,0x574E,0x573B,0x5740,0x574F,0x5769, +0x57C0,0x5788,0x5761,0x577F,0x5789,0x5793,0x57A0,0x57B3, +0x57A4,0x57AA,0x57B0,0x57C3,0x57C6,0x57D4,0x57D2,0x57D3, +0x580A,0x57D6,0x57E3,0x580B,0x5819,0x581D,0x5872,0x5821, +0x5862,0x584B,0x5870,0x6BC0,0x5852,0x583D,0x5879,0x5885, +0x58B9,0x589F,0x58AB,0x58BA,0x58DE,0x58BB,0x58B8,0x58AE, +0x58C5,0x58D3,0x58D1,0x58D7,0x58D9,0x58D8,0x58E5,0x58DC, +0x58E4,0x58DF,0x58EF,0x58FA,0x58F9,0x58FB,0x58FC,0x58FD, +0x5902,0x590A,0x5910,0x591B,0x68A6,0x5925,0x592C,0x592D, +0x5932,0x5938,0x593E,0x7AD2,0x5955,0x5950,0x594E,0x595A, +0x5958,0x5962,0x5960,0x5967,0x596C,0x5969, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5978,0x5981,0x599D,0x4F5E,0x4FAB,0x59A3,0x59B2, +0x59C6,0x59E8,0x59DC,0x598D,0x59D9,0x59DA,0x5A25,0x5A1F, +0x5A11,0x5A1C,0x5A09,0x5A1A,0x5A40,0x5A6C,0x5A49,0x5A35, +0x5A36,0x5A62,0x5A6A,0x5A9A,0x5ABC,0x5ABE,0x5ACB,0x5AC2, +0x5ABD,0x5AE3,0x5AD7,0x5AE6,0x5AE9,0x5AD6,0x5AFA,0x5AFB, +0x5B0C,0x5B0B,0x5B16,0x5B32,0x5AD0,0x5B2A,0x5B36,0x5B3E, +0x5B43,0x5B45,0x5B40,0x5B51,0x5B55,0x5B5A,0x5B5B,0x5B65, +0x5B69,0x5B70,0x5B73,0x5B75,0x5B78,0x6588,0x5B7A,0x5B80, + 0,0x5B83,0x5BA6,0x5BB8,0x5BC3,0x5BC7,0x5BC9,0x5BD4, +0x5BD0,0x5BE4,0x5BE6,0x5BE2,0x5BDE,0x5BE5,0x5BEB,0x5BF0, +0x5BF6,0x5BF3,0x5C05,0x5C07,0x5C08,0x5C0D,0x5C13,0x5C20, +0x5C22,0x5C28,0x5C38,0x5C39,0x5C41,0x5C46,0x5C4E,0x5C53, +0x5C50,0x5C4F,0x5B71,0x5C6C,0x5C6E,0x4E62,0x5C76,0x5C79, +0x5C8C,0x5C91,0x5C94,0x599B,0x5CAB,0x5CBB,0x5CB6,0x5CBC, +0x5CB7,0x5CC5,0x5CBE,0x5CC7,0x5CD9,0x5CE9,0x5CFD,0x5CFA, +0x5CED,0x5D8C,0x5CEA,0x5D0B,0x5D15,0x5D17,0x5D5C,0x5D1F, +0x5D1B,0x5D11,0x5D14,0x5D22,0x5D1A,0x5D19,0x5D18,0x5D4C, +0x5D52,0x5D4E,0x5D4B,0x5D6C,0x5D73,0x5D76,0x5D87,0x5D84, +0x5D82,0x5DA2,0x5D9D,0x5DAC,0x5DAE,0x5DBD,0x5D90,0x5DB7, +0x5DBC,0x5DC9,0x5DCD,0x5DD3,0x5DD2,0x5DD6,0x5DDB,0x5DEB, +0x5DF2,0x5DF5,0x5E0B,0x5E1A,0x5E19,0x5E11,0x5E1B,0x5E36, +0x5E37,0x5E44,0x5E43,0x5E40,0x5E4E,0x5E57,0x5E54,0x5E5F, +0x5E62,0x5E64,0x5E47,0x5E75,0x5E76,0x5E7A,0x9EBC,0x5E7F, +0x5EA0,0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5ED6,0x5EE3,0x5EDD,0x5EDA,0x5EDB,0x5EE2,0x5EE1, +0x5EE8,0x5EE9,0x5EEC,0x5EF1,0x5EF3,0x5EF0,0x5EF4,0x5EF8, +0x5EFE,0x5F03,0x5F09,0x5F5D,0x5F5C,0x5F0B,0x5F11,0x5F16, +0x5F29,0x5F2D,0x5F38,0x5F41,0x5F48,0x5F4C,0x5F4E,0x5F2F, +0x5F51,0x5F56,0x5F57,0x5F59,0x5F61,0x5F6D,0x5F73,0x5F77, +0x5F83,0x5F82,0x5F7F,0x5F8A,0x5F88,0x5F91,0x5F87,0x5F9E, +0x5F99,0x5F98,0x5FA0,0x5FA8,0x5FAD,0x5FBC,0x5FD6,0x5FFB, +0x5FE4,0x5FF8,0x5FF1,0x5FDD,0x60B3,0x5FFF,0x6021,0x6060, + 0,0x6019,0x6010,0x6029,0x600E,0x6031,0x601B,0x6015, +0x602B,0x6026,0x600F,0x603A,0x605A,0x6041,0x606A,0x6077, +0x605F,0x604A,0x6046,0x604D,0x6063,0x6043,0x6064,0x6042, +0x606C,0x606B,0x6059,0x6081,0x608D,0x60E7,0x6083,0x609A, +0x6084,0x609B,0x6096,0x6097,0x6092,0x60A7,0x608B,0x60E1, +0x60B8,0x60E0,0x60D3,0x60B4,0x5FF0,0x60BD,0x60C6,0x60B5, +0x60D8,0x614D,0x6115,0x6106,0x60F6,0x60F7,0x6100,0x60F4, +0x60FA,0x6103,0x6121,0x60FB,0x60F1,0x610D,0x610E,0x6147, +0x613E,0x6128,0x6127,0x614A,0x613F,0x613C,0x612C,0x6134, +0x613D,0x6142,0x6144,0x6173,0x6177,0x6158,0x6159,0x615A, +0x616B,0x6174,0x616F,0x6165,0x6171,0x615F,0x615D,0x6153, +0x6175,0x6199,0x6196,0x6187,0x61AC,0x6194,0x619A,0x618A, +0x6191,0x61AB,0x61AE,0x61CC,0x61CA,0x61C9,0x61F7,0x61C8, +0x61C3,0x61C6,0x61BA,0x61CB,0x7F79,0x61CD,0x61E6,0x61E3, +0x61F6,0x61FA,0x61F4,0x61FF,0x61FD,0x61FC,0x61FE,0x6200, +0x6208,0x6209,0x620D,0x620C,0x6214,0x621B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x621E,0x6221,0x622A,0x622E,0x6230,0x6232,0x6233, +0x6241,0x624E,0x625E,0x6263,0x625B,0x6260,0x6268,0x627C, +0x6282,0x6289,0x627E,0x6292,0x6293,0x6296,0x62D4,0x6283, +0x6294,0x62D7,0x62D1,0x62BB,0x62CF,0x62FF,0x62C6,0x64D4, +0x62C8,0x62DC,0x62CC,0x62CA,0x62C2,0x62C7,0x629B,0x62C9, +0x630C,0x62EE,0x62F1,0x6327,0x6302,0x6308,0x62EF,0x62F5, +0x6350,0x633E,0x634D,0x641C,0x634F,0x6396,0x638E,0x6380, +0x63AB,0x6376,0x63A3,0x638F,0x6389,0x639F,0x63B5,0x636B, + 0,0x6369,0x63BE,0x63E9,0x63C0,0x63C6,0x63E3,0x63C9, +0x63D2,0x63F6,0x63C4,0x6416,0x6434,0x6406,0x6413,0x6426, +0x6436,0x651D,0x6417,0x6428,0x640F,0x6467,0x646F,0x6476, +0x644E,0x652A,0x6495,0x6493,0x64A5,0x64A9,0x6488,0x64BC, +0x64DA,0x64D2,0x64C5,0x64C7,0x64BB,0x64D8,0x64C2,0x64F1, +0x64E7,0x8209,0x64E0,0x64E1,0x62AC,0x64E3,0x64EF,0x652C, +0x64F6,0x64F4,0x64F2,0x64FA,0x6500,0x64FD,0x6518,0x651C, +0x6505,0x6524,0x6523,0x652B,0x6534,0x6535,0x6537,0x6536, +0x6538,0x754B,0x6548,0x6556,0x6555,0x654D,0x6558,0x655E, +0x655D,0x6572,0x6578,0x6582,0x6583,0x8B8A,0x659B,0x659F, +0x65AB,0x65B7,0x65C3,0x65C6,0x65C1,0x65C4,0x65CC,0x65D2, +0x65DB,0x65D9,0x65E0,0x65E1,0x65F1,0x6772,0x660A,0x6603, +0x65FB,0x6773,0x6635,0x6636,0x6634,0x661C,0x664F,0x6644, +0x6649,0x6641,0x665E,0x665D,0x6664,0x6667,0x6668,0x665F, +0x6662,0x6670,0x6683,0x6688,0x668E,0x6689,0x6684,0x6698, +0x669D,0x66C1,0x66B9,0x66C9,0x66BE,0x66BC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x66C4,0x66B8,0x66D6,0x66DA,0x66E0,0x663F,0x66E6, +0x66E9,0x66F0,0x66F5,0x66F7,0x670F,0x6716,0x671E,0x6726, +0x6727,0x9738,0x672E,0x673F,0x6736,0x6741,0x6738,0x6737, +0x6746,0x675E,0x6760,0x6759,0x6763,0x6764,0x6789,0x6770, +0x67A9,0x677C,0x676A,0x678C,0x678B,0x67A6,0x67A1,0x6785, +0x67B7,0x67EF,0x67B4,0x67EC,0x67B3,0x67E9,0x67B8,0x67E4, +0x67DE,0x67DD,0x67E2,0x67EE,0x67B9,0x67CE,0x67C6,0x67E7, +0x6A9C,0x681E,0x6846,0x6829,0x6840,0x684D,0x6832,0x684E, + 0,0x68B3,0x682B,0x6859,0x6863,0x6877,0x687F,0x689F, +0x688F,0x68AD,0x6894,0x689D,0x689B,0x6883,0x6AAE,0x68B9, +0x6874,0x68B5,0x68A0,0x68BA,0x690F,0x688D,0x687E,0x6901, +0x68CA,0x6908,0x68D8,0x6922,0x6926,0x68E1,0x690C,0x68CD, +0x68D4,0x68E7,0x68D5,0x6936,0x6912,0x6904,0x68D7,0x68E3, +0x6925,0x68F9,0x68E0,0x68EF,0x6928,0x692A,0x691A,0x6923, +0x6921,0x68C6,0x6979,0x6977,0x695C,0x6978,0x696B,0x6954, +0x697E,0x696E,0x6939,0x6974,0x693D,0x6959,0x6930,0x6961, +0x695E,0x695D,0x6981,0x696A,0x69B2,0x69AE,0x69D0,0x69BF, +0x69C1,0x69D3,0x69BE,0x69CE,0x5BE8,0x69CA,0x69DD,0x69BB, +0x69C3,0x69A7,0x6A2E,0x6991,0x69A0,0x699C,0x6995,0x69B4, +0x69DE,0x69E8,0x6A02,0x6A1B,0x69FF,0x6B0A,0x69F9,0x69F2, +0x69E7,0x6A05,0x69B1,0x6A1E,0x69ED,0x6A14,0x69EB,0x6A0A, +0x6A12,0x6AC1,0x6A23,0x6A13,0x6A44,0x6A0C,0x6A72,0x6A36, +0x6A78,0x6A47,0x6A62,0x6A59,0x6A66,0x6A48,0x6A38,0x6A22, +0x6A90,0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6A97,0x8617,0x6ABB,0x6AC3,0x6AC2,0x6AB8,0x6AB3, +0x6AAC,0x6ADE,0x6AD1,0x6ADF,0x6AAA,0x6ADA,0x6AEA,0x6AFB, +0x6B05,0x8616,0x6AFA,0x6B12,0x6B16,0x9B31,0x6B1F,0x6B38, +0x6B37,0x76DC,0x6B39,0x98EE,0x6B47,0x6B43,0x6B49,0x6B50, +0x6B59,0x6B54,0x6B5B,0x6B5F,0x6B61,0x6B78,0x6B79,0x6B7F, +0x6B80,0x6B84,0x6B83,0x6B8D,0x6B98,0x6B95,0x6B9E,0x6BA4, +0x6BAA,0x6BAB,0x6BAF,0x6BB2,0x6BB1,0x6BB3,0x6BB7,0x6BBC, +0x6BC6,0x6BCB,0x6BD3,0x6BDF,0x6BEC,0x6BEB,0x6BF3,0x6BEF, + 0,0x9EBE,0x6C08,0x6C13,0x6C14,0x6C1B,0x6C24,0x6C23, +0x6C5E,0x6C55,0x6C62,0x6C6A,0x6C82,0x6C8D,0x6C9A,0x6C81, +0x6C9B,0x6C7E,0x6C68,0x6C73,0x6C92,0x6C90,0x6CC4,0x6CF1, +0x6CD3,0x6CBD,0x6CD7,0x6CC5,0x6CDD,0x6CAE,0x6CB1,0x6CBE, +0x6CBA,0x6CDB,0x6CEF,0x6CD9,0x6CEA,0x6D1F,0x884D,0x6D36, +0x6D2B,0x6D3D,0x6D38,0x6D19,0x6D35,0x6D33,0x6D12,0x6D0C, +0x6D63,0x6D93,0x6D64,0x6D5A,0x6D79,0x6D59,0x6D8E,0x6D95, +0x6FE4,0x6D85,0x6DF9,0x6E15,0x6E0A,0x6DB5,0x6DC7,0x6DE6, +0x6DB8,0x6DC6,0x6DEC,0x6DDE,0x6DCC,0x6DE8,0x6DD2,0x6DC5, +0x6DFA,0x6DD9,0x6DE4,0x6DD5,0x6DEA,0x6DEE,0x6E2D,0x6E6E, +0x6E2E,0x6E19,0x6E72,0x6E5F,0x6E3E,0x6E23,0x6E6B,0x6E2B, +0x6E76,0x6E4D,0x6E1F,0x6E43,0x6E3A,0x6E4E,0x6E24,0x6EFF, +0x6E1D,0x6E38,0x6E82,0x6EAA,0x6E98,0x6EC9,0x6EB7,0x6ED3, +0x6EBD,0x6EAF,0x6EC4,0x6EB2,0x6ED4,0x6ED5,0x6E8F,0x6EA5, +0x6EC2,0x6E9F,0x6F41,0x6F11,0x704C,0x6EEC,0x6EF8,0x6EFE, +0x6F3F,0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC}; + +/* page 3 0xE040-0xEAA4 */ +static uint16 tab_sjis_uni3[]={ +0x6F3E,0x6F13,0x6EF7,0x6F86,0x6F7A,0x6F78,0x6F81,0x6F80, +0x6F6F,0x6F5B,0x6FF3,0x6F6D,0x6F82,0x6F7C,0x6F58,0x6F8E, +0x6F91,0x6FC2,0x6F66,0x6FB3,0x6FA3,0x6FA1,0x6FA4,0x6FB9, +0x6FC6,0x6FAA,0x6FDF,0x6FD5,0x6FEC,0x6FD4,0x6FD8,0x6FF1, +0x6FEE,0x6FDB,0x7009,0x700B,0x6FFA,0x7011,0x7001,0x700F, +0x6FFE,0x701B,0x701A,0x6F74,0x701D,0x7018,0x701F,0x7030, +0x703E,0x7032,0x7051,0x7063,0x7099,0x7092,0x70AF,0x70F1, +0x70AC,0x70B8,0x70B3,0x70AE,0x70DF,0x70CB,0x70DD, 0, +0x70D9,0x7109,0x70FD,0x711C,0x7119,0x7165,0x7155,0x7188, +0x7166,0x7162,0x714C,0x7156,0x716C,0x718F,0x71FB,0x7184, +0x7195,0x71A8,0x71AC,0x71D7,0x71B9,0x71BE,0x71D2,0x71C9, +0x71D4,0x71CE,0x71E0,0x71EC,0x71E7,0x71F5,0x71FC,0x71F9, +0x71FF,0x720D,0x7210,0x721B,0x7228,0x722D,0x722C,0x7230, +0x7232,0x723B,0x723C,0x723F,0x7240,0x7246,0x724B,0x7258, +0x7274,0x727E,0x7282,0x7281,0x7287,0x7292,0x7296,0x72A2, +0x72A7,0x72B9,0x72B2,0x72C3,0x72C6,0x72C4,0x72CE,0x72D2, +0x72E2,0x72E0,0x72E1,0x72F9,0x72F7,0x500F,0x7317,0x730A, +0x731C,0x7316,0x731D,0x7334,0x732F,0x7329,0x7325,0x733E, +0x734E,0x734F,0x9ED8,0x7357,0x736A,0x7368,0x7370,0x7378, +0x7375,0x737B,0x737A,0x73C8,0x73B3,0x73CE,0x73BB,0x73C0, +0x73E5,0x73EE,0x73DE,0x74A2,0x7405,0x746F,0x7425,0x73F8, +0x7432,0x743A,0x7455,0x743F,0x745F,0x7459,0x7441,0x745C, +0x7469,0x7470,0x7463,0x746A,0x7476,0x747E,0x748B,0x749E, +0x74A7,0x74CA,0x74CF,0x74D4,0x73F1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x74E0,0x74E3,0x74E7,0x74E9,0x74EE,0x74F2,0x74F0,0x74F1, +0x74F8,0x74F7,0x7504,0x7503,0x7505,0x750C,0x750E,0x750D, +0x7515,0x7513,0x751E,0x7526,0x752C,0x753C,0x7544,0x754D, +0x754A,0x7549,0x755B,0x7546,0x755A,0x7569,0x7564,0x7567, +0x756B,0x756D,0x7578,0x7576,0x7586,0x7587,0x7574,0x758A, +0x7589,0x7582,0x7594,0x759A,0x759D,0x75A5,0x75A3,0x75C2, +0x75B3,0x75C3,0x75B5,0x75BD,0x75B8,0x75BC,0x75B1,0x75CD, +0x75CA,0x75D2,0x75D9,0x75E3,0x75DE,0x75FE,0x75FF, 0, +0x75FC,0x7601,0x75F0,0x75FA,0x75F2,0x75F3,0x760B,0x760D, +0x7609,0x761F,0x7627,0x7620,0x7621,0x7622,0x7624,0x7634, +0x7630,0x763B,0x7647,0x7648,0x7646,0x765C,0x7658,0x7661, +0x7662,0x7668,0x7669,0x766A,0x7667,0x766C,0x7670,0x7672, +0x7676,0x7678,0x767C,0x7680,0x7683,0x7688,0x768B,0x768E, +0x7696,0x7693,0x7699,0x769A,0x76B0,0x76B4,0x76B8,0x76B9, +0x76BA,0x76C2,0x76CD,0x76D6,0x76D2,0x76DE,0x76E1,0x76E5, +0x76E7,0x76EA,0x862F,0x76FB,0x7708,0x7707,0x7704,0x7729, +0x7724,0x771E,0x7725,0x7726,0x771B,0x7737,0x7738,0x7747, +0x775A,0x7768,0x776B,0x775B,0x7765,0x777F,0x777E,0x7779, +0x778E,0x778B,0x7791,0x77A0,0x779E,0x77B0,0x77B6,0x77B9, +0x77BF,0x77BC,0x77BD,0x77BB,0x77C7,0x77CD,0x77D7,0x77DA, +0x77DC,0x77E3,0x77EE,0x77FC,0x780C,0x7812,0x7926,0x7820, +0x792A,0x7845,0x788E,0x7874,0x7886,0x787C,0x789A,0x788C, +0x78A3,0x78B5,0x78AA,0x78AF,0x78D1,0x78C6,0x78CB,0x78D4, +0x78BE,0x78BC,0x78C5,0x78CA,0x78EC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x78E7,0x78DA,0x78FD,0x78F4,0x7907,0x7912,0x7911,0x7919, +0x792C,0x792B,0x7940,0x7960,0x7957,0x795F,0x795A,0x7955, +0x7953,0x797A,0x797F,0x798A,0x799D,0x79A7,0x9F4B,0x79AA, +0x79AE,0x79B3,0x79B9,0x79BA,0x79C9,0x79D5,0x79E7,0x79EC, +0x79E1,0x79E3,0x7A08,0x7A0D,0x7A18,0x7A19,0x7A20,0x7A1F, +0x7980,0x7A31,0x7A3B,0x7A3E,0x7A37,0x7A43,0x7A57,0x7A49, +0x7A61,0x7A62,0x7A69,0x9F9D,0x7A70,0x7A79,0x7A7D,0x7A88, +0x7A97,0x7A95,0x7A98,0x7A96,0x7AA9,0x7AC8,0x7AB0, 0, +0x7AB6,0x7AC5,0x7AC4,0x7ABF,0x9083,0x7AC7,0x7ACA,0x7ACD, +0x7ACF,0x7AD5,0x7AD3,0x7AD9,0x7ADA,0x7ADD,0x7AE1,0x7AE2, +0x7AE6,0x7AED,0x7AF0,0x7B02,0x7B0F,0x7B0A,0x7B06,0x7B33, +0x7B18,0x7B19,0x7B1E,0x7B35,0x7B28,0x7B36,0x7B50,0x7B7A, +0x7B04,0x7B4D,0x7B0B,0x7B4C,0x7B45,0x7B75,0x7B65,0x7B74, +0x7B67,0x7B70,0x7B71,0x7B6C,0x7B6E,0x7B9D,0x7B98,0x7B9F, +0x7B8D,0x7B9C,0x7B9A,0x7B8B,0x7B92,0x7B8F,0x7B5D,0x7B99, +0x7BCB,0x7BC1,0x7BCC,0x7BCF,0x7BB4,0x7BC6,0x7BDD,0x7BE9, +0x7C11,0x7C14,0x7BE6,0x7BE5,0x7C60,0x7C00,0x7C07,0x7C13, +0x7BF3,0x7BF7,0x7C17,0x7C0D,0x7BF6,0x7C23,0x7C27,0x7C2A, +0x7C1F,0x7C37,0x7C2B,0x7C3D,0x7C4C,0x7C43,0x7C54,0x7C4F, +0x7C40,0x7C50,0x7C58,0x7C5F,0x7C64,0x7C56,0x7C65,0x7C6C, +0x7C75,0x7C83,0x7C90,0x7CA4,0x7CAD,0x7CA2,0x7CAB,0x7CA1, +0x7CA8,0x7CB3,0x7CB2,0x7CB1,0x7CAE,0x7CB9,0x7CBD,0x7CC0, +0x7CC5,0x7CC2,0x7CD8,0x7CD2,0x7CDC,0x7CE2,0x9B3B,0x7CEF, +0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7D02,0x7D1C,0x7D15,0x7D0A,0x7D45,0x7D4B,0x7D2E,0x7D32, +0x7D3F,0x7D35,0x7D46,0x7D73,0x7D56,0x7D4E,0x7D72,0x7D68, +0x7D6E,0x7D4F,0x7D63,0x7D93,0x7D89,0x7D5B,0x7D8F,0x7D7D, +0x7D9B,0x7DBA,0x7DAE,0x7DA3,0x7DB5,0x7DC7,0x7DBD,0x7DAB, +0x7E3D,0x7DA2,0x7DAF,0x7DDC,0x7DB8,0x7D9F,0x7DB0,0x7DD8, +0x7DDD,0x7DE4,0x7DDE,0x7DFB,0x7DF2,0x7DE1,0x7E05,0x7E0A, +0x7E23,0x7E21,0x7E12,0x7E31,0x7E1F,0x7E09,0x7E0B,0x7E22, +0x7E46,0x7E66,0x7E3B,0x7E35,0x7E39,0x7E43,0x7E37, 0, +0x7E32,0x7E3A,0x7E67,0x7E5D,0x7E56,0x7E5E,0x7E59,0x7E5A, +0x7E79,0x7E6A,0x7E69,0x7E7C,0x7E7B,0x7E83,0x7DD5,0x7E7D, +0x8FAE,0x7E7F,0x7E88,0x7E89,0x7E8C,0x7E92,0x7E90,0x7E93, +0x7E94,0x7E96,0x7E8E,0x7E9B,0x7E9C,0x7F38,0x7F3A,0x7F45, +0x7F4C,0x7F4D,0x7F4E,0x7F50,0x7F51,0x7F55,0x7F54,0x7F58, +0x7F5F,0x7F60,0x7F68,0x7F69,0x7F67,0x7F78,0x7F82,0x7F86, +0x7F83,0x7F88,0x7F87,0x7F8C,0x7F94,0x7F9E,0x7F9D,0x7F9A, +0x7FA3,0x7FAF,0x7FB2,0x7FB9,0x7FAE,0x7FB6,0x7FB8,0x8B71, +0x7FC5,0x7FC6,0x7FCA,0x7FD5,0x7FD4,0x7FE1,0x7FE6,0x7FE9, +0x7FF3,0x7FF9,0x98DC,0x8006,0x8004,0x800B,0x8012,0x8018, +0x8019,0x801C,0x8021,0x8028,0x803F,0x803B,0x804A,0x8046, +0x8052,0x8058,0x805A,0x805F,0x8062,0x8068,0x8073,0x8072, +0x8070,0x8076,0x8079,0x807D,0x807F,0x8084,0x8086,0x8085, +0x809B,0x8093,0x809A,0x80AD,0x5190,0x80AC,0x80DB,0x80E5, +0x80D9,0x80DD,0x80C4,0x80DA,0x80D6,0x8109,0x80EF,0x80F1, +0x811B,0x8129,0x8123,0x812F,0x814B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x968B,0x8146,0x813E,0x8153,0x8151,0x80FC,0x8171,0x816E, +0x8165,0x8166,0x8174,0x8183,0x8188,0x818A,0x8180,0x8182, +0x81A0,0x8195,0x81A4,0x81A3,0x815F,0x8193,0x81A9,0x81B0, +0x81B5,0x81BE,0x81B8,0x81BD,0x81C0,0x81C2,0x81BA,0x81C9, +0x81CD,0x81D1,0x81D9,0x81D8,0x81C8,0x81DA,0x81DF,0x81E0, +0x81E7,0x81FA,0x81FB,0x81FE,0x8201,0x8202,0x8205,0x8207, +0x820A,0x820D,0x8210,0x8216,0x8229,0x822B,0x8238,0x8233, +0x8240,0x8259,0x8258,0x825D,0x825A,0x825F,0x8264, 0, +0x8262,0x8268,0x826A,0x826B,0x822E,0x8271,0x8277,0x8278, +0x827E,0x828D,0x8292,0x82AB,0x829F,0x82BB,0x82AC,0x82E1, +0x82E3,0x82DF,0x82D2,0x82F4,0x82F3,0x82FA,0x8393,0x8303, +0x82FB,0x82F9,0x82DE,0x8306,0x82DC,0x8309,0x82D9,0x8335, +0x8334,0x8316,0x8332,0x8331,0x8340,0x8339,0x8350,0x8345, +0x832F,0x832B,0x8317,0x8318,0x8385,0x839A,0x83AA,0x839F, +0x83A2,0x8396,0x8323,0x838E,0x8387,0x838A,0x837C,0x83B5, +0x8373,0x8375,0x83A0,0x8389,0x83A8,0x83F4,0x8413,0x83EB, +0x83CE,0x83FD,0x8403,0x83D8,0x840B,0x83C1,0x83F7,0x8407, +0x83E0,0x83F2,0x840D,0x8422,0x8420,0x83BD,0x8438,0x8506, +0x83FB,0x846D,0x842A,0x843C,0x855A,0x8484,0x8477,0x846B, +0x84AD,0x846E,0x8482,0x8469,0x8446,0x842C,0x846F,0x8479, +0x8435,0x84CA,0x8462,0x84B9,0x84BF,0x849F,0x84D9,0x84CD, +0x84BB,0x84DA,0x84D0,0x84C1,0x84C6,0x84D6,0x84A1,0x8521, +0x84FF,0x84F4,0x8517,0x8518,0x852C,0x851F,0x8515,0x8514, +0x84FC,0x8540,0x8563,0x8558,0x8548, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8541,0x8602,0x854B,0x8555,0x8580,0x85A4,0x8588,0x8591, +0x858A,0x85A8,0x856D,0x8594,0x859B,0x85EA,0x8587,0x859C, +0x8577,0x857E,0x8590,0x85C9,0x85BA,0x85CF,0x85B9,0x85D0, +0x85D5,0x85DD,0x85E5,0x85DC,0x85F9,0x860A,0x8613,0x860B, +0x85FE,0x85FA,0x8606,0x8622,0x861A,0x8630,0x863F,0x864D, +0x4E55,0x8654,0x865F,0x8667,0x8671,0x8693,0x86A3,0x86A9, +0x86AA,0x868B,0x868C,0x86B6,0x86AF,0x86C4,0x86C6,0x86B0, +0x86C9,0x8823,0x86AB,0x86D4,0x86DE,0x86E9,0x86EC, 0, +0x86DF,0x86DB,0x86EF,0x8712,0x8706,0x8708,0x8700,0x8703, +0x86FB,0x8711,0x8709,0x870D,0x86F9,0x870A,0x8734,0x873F, +0x8737,0x873B,0x8725,0x8729,0x871A,0x8760,0x875F,0x8778, +0x874C,0x874E,0x8774,0x8757,0x8768,0x876E,0x8759,0x8753, +0x8763,0x876A,0x8805,0x87A2,0x879F,0x8782,0x87AF,0x87CB, +0x87BD,0x87C0,0x87D0,0x96D6,0x87AB,0x87C4,0x87B3,0x87C7, +0x87C6,0x87BB,0x87EF,0x87F2,0x87E0,0x880F,0x880D,0x87FE, +0x87F6,0x87F7,0x880E,0x87D2,0x8811,0x8816,0x8815,0x8822, +0x8821,0x8831,0x8836,0x8839,0x8827,0x883B,0x8844,0x8842, +0x8852,0x8859,0x885E,0x8862,0x886B,0x8881,0x887E,0x889E, +0x8875,0x887D,0x88B5,0x8872,0x8882,0x8897,0x8892,0x88AE, +0x8899,0x88A2,0x888D,0x88A4,0x88B0,0x88BF,0x88B1,0x88C3, +0x88C4,0x88D4,0x88D8,0x88D9,0x88DD,0x88F9,0x8902,0x88FC, +0x88F4,0x88E8,0x88F2,0x8904,0x890C,0x890A,0x8913,0x8943, +0x891E,0x8925,0x892A,0x892B,0x8941,0x8944,0x893B,0x8936, +0x8938,0x894C,0x891D,0x8960,0x895E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8966,0x8964,0x896D,0x896A,0x896F,0x8974,0x8977,0x897E, +0x8983,0x8988,0x898A,0x8993,0x8998,0x89A1,0x89A9,0x89A6, +0x89AC,0x89AF,0x89B2,0x89BA,0x89BD,0x89BF,0x89C0,0x89DA, +0x89DC,0x89DD,0x89E7,0x89F4,0x89F8,0x8A03,0x8A16,0x8A10, +0x8A0C,0x8A1B,0x8A1D,0x8A25,0x8A36,0x8A41,0x8A5B,0x8A52, +0x8A46,0x8A48,0x8A7C,0x8A6D,0x8A6C,0x8A62,0x8A85,0x8A82, +0x8A84,0x8AA8,0x8AA1,0x8A91,0x8AA5,0x8AA6,0x8A9A,0x8AA3, +0x8AC4,0x8ACD,0x8AC2,0x8ADA,0x8AEB,0x8AF3,0x8AE7, 0, +0x8AE4,0x8AF1,0x8B14,0x8AE0,0x8AE2,0x8AF7,0x8ADE,0x8ADB, +0x8B0C,0x8B07,0x8B1A,0x8AE1,0x8B16,0x8B10,0x8B17,0x8B20, +0x8B33,0x97AB,0x8B26,0x8B2B,0x8B3E,0x8B28,0x8B41,0x8B4C, +0x8B4F,0x8B4E,0x8B49,0x8B56,0x8B5B,0x8B5A,0x8B6B,0x8B5F, +0x8B6C,0x8B6F,0x8B74,0x8B7D,0x8B80,0x8B8C,0x8B8E,0x8B92, +0x8B93,0x8B96,0x8B99,0x8B9A,0x8C3A,0x8C41,0x8C3F,0x8C48, +0x8C4C,0x8C4E,0x8C50,0x8C55,0x8C62,0x8C6C,0x8C78,0x8C7A, +0x8C82,0x8C89,0x8C85,0x8C8A,0x8C8D,0x8C8E,0x8C94,0x8C7C, +0x8C98,0x621D,0x8CAD,0x8CAA,0x8CBD,0x8CB2,0x8CB3,0x8CAE, +0x8CB6,0x8CC8,0x8CC1,0x8CE4,0x8CE3,0x8CDA,0x8CFD,0x8CFA, +0x8CFB,0x8D04,0x8D05,0x8D0A,0x8D07,0x8D0F,0x8D0D,0x8D10, +0x9F4E,0x8D13,0x8CCD,0x8D14,0x8D16,0x8D67,0x8D6D,0x8D71, +0x8D73,0x8D81,0x8D99,0x8DC2,0x8DBE,0x8DBA,0x8DCF,0x8DDA, +0x8DD6,0x8DCC,0x8DDB,0x8DCB,0x8DEA,0x8DEB,0x8DDF,0x8DE3, +0x8DFC,0x8E08,0x8E09,0x8DFF,0x8E1D,0x8E1E,0x8E10,0x8E1F, +0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E47,0x8E49,0x8E4C,0x8E50,0x8E48,0x8E59,0x8E64,0x8E60, +0x8E2A,0x8E63,0x8E55,0x8E76,0x8E72,0x8E7C,0x8E81,0x8E87, +0x8E85,0x8E84,0x8E8B,0x8E8A,0x8E93,0x8E91,0x8E94,0x8E99, +0x8EAA,0x8EA1,0x8EAC,0x8EB0,0x8EC6,0x8EB1,0x8EBE,0x8EC5, +0x8EC8,0x8ECB,0x8EDB,0x8EE3,0x8EFC,0x8EFB,0x8EEB,0x8EFE, +0x8F0A,0x8F05,0x8F15,0x8F12,0x8F19,0x8F13,0x8F1C,0x8F1F, +0x8F1B,0x8F0C,0x8F26,0x8F33,0x8F3B,0x8F39,0x8F45,0x8F42, +0x8F3E,0x8F4C,0x8F49,0x8F46,0x8F4E,0x8F57,0x8F5C, 0, +0x8F62,0x8F63,0x8F64,0x8F9C,0x8F9F,0x8FA3,0x8FAD,0x8FAF, +0x8FB7,0x8FDA,0x8FE5,0x8FE2,0x8FEA,0x8FEF,0x9087,0x8FF4, +0x9005,0x8FF9,0x8FFA,0x9011,0x9015,0x9021,0x900D,0x901E, +0x9016,0x900B,0x9027,0x9036,0x9035,0x9039,0x8FF8,0x904F, +0x9050,0x9051,0x9052,0x900E,0x9049,0x903E,0x9056,0x9058, +0x905E,0x9068,0x906F,0x9076,0x96A8,0x9072,0x9082,0x907D, +0x9081,0x9080,0x908A,0x9089,0x908F,0x90A8,0x90AF,0x90B1, +0x90B5,0x90E2,0x90E4,0x6248,0x90DB,0x9102,0x9112,0x9119, +0x9132,0x9130,0x914A,0x9156,0x9158,0x9163,0x9165,0x9169, +0x9173,0x9172,0x918B,0x9189,0x9182,0x91A2,0x91AB,0x91AF, +0x91AA,0x91B5,0x91B4,0x91BA,0x91C0,0x91C1,0x91C9,0x91CB, +0x91D0,0x91D6,0x91DF,0x91E1,0x91DB,0x91FC,0x91F5,0x91F6, +0x921E,0x91FF,0x9214,0x922C,0x9215,0x9211,0x925E,0x9257, +0x9245,0x9249,0x9264,0x9248,0x9295,0x923F,0x924B,0x9250, +0x929C,0x9296,0x9293,0x929B,0x925A,0x92CF,0x92B9,0x92B7, +0x92E9,0x930F,0x92FA,0x9344,0x932E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9319,0x9322,0x931A,0x9323,0x933A,0x9335,0x933B,0x935C, +0x9360,0x937C,0x936E,0x9356,0x93B0,0x93AC,0x93AD,0x9394, +0x93B9,0x93D6,0x93D7,0x93E8,0x93E5,0x93D8,0x93C3,0x93DD, +0x93D0,0x93C8,0x93E4,0x941A,0x9414,0x9413,0x9403,0x9407, +0x9410,0x9436,0x942B,0x9435,0x9421,0x943A,0x9441,0x9452, +0x9444,0x945B,0x9460,0x9462,0x945E,0x946A,0x9229,0x9470, +0x9475,0x9477,0x947D,0x945A,0x947C,0x947E,0x9481,0x947F, +0x9582,0x9587,0x958A,0x9594,0x9596,0x9598,0x9599, 0, +0x95A0,0x95A8,0x95A7,0x95AD,0x95BC,0x95BB,0x95B9,0x95BE, +0x95CA,0x6FF6,0x95C3,0x95CD,0x95CC,0x95D5,0x95D4,0x95D6, +0x95DC,0x95E1,0x95E5,0x95E2,0x9621,0x9628,0x962E,0x962F, +0x9642,0x964C,0x964F,0x964B,0x9677,0x965C,0x965E,0x965D, +0x965F,0x9666,0x9672,0x966C,0x968D,0x9698,0x9695,0x9697, +0x96AA,0x96A7,0x96B1,0x96B2,0x96B0,0x96B4,0x96B6,0x96B8, +0x96B9,0x96CE,0x96CB,0x96C9,0x96CD,0x894D,0x96DC,0x970D, +0x96D5,0x96F9,0x9704,0x9706,0x9708,0x9713,0x970E,0x9711, +0x970F,0x9716,0x9719,0x9724,0x972A,0x9730,0x9739,0x973D, +0x973E,0x9744,0x9746,0x9748,0x9742,0x9749,0x975C,0x9760, +0x9764,0x9766,0x9768,0x52D2,0x976B,0x9771,0x9779,0x9785, +0x977C,0x9781,0x977A,0x9786,0x978B,0x978F,0x9790,0x979C, +0x97A8,0x97A6,0x97A3,0x97B3,0x97B4,0x97C3,0x97C6,0x97C8, +0x97CB,0x97DC,0x97ED,0x9F4F,0x97F2,0x7ADF,0x97F6,0x97F5, +0x980F,0x980C,0x9838,0x9824,0x9821,0x9837,0x983D,0x9846, +0x984F,0x984B,0x986B,0x986F,0x9870, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9871,0x9874,0x9873,0x98AA,0x98AF,0x98B1,0x98B6,0x98C4, +0x98C3,0x98C6,0x98E9,0x98EB,0x9903,0x9909,0x9912,0x9914, +0x9918,0x9921,0x991D,0x991E,0x9924,0x9920,0x992C,0x992E, +0x993D,0x993E,0x9942,0x9949,0x9945,0x9950,0x994B,0x9951, +0x9952,0x994C,0x9955,0x9997,0x9998,0x99A5,0x99AD,0x99AE, +0x99BC,0x99DF,0x99DB,0x99DD,0x99D8,0x99D1,0x99ED,0x99EE, +0x99F1,0x99F2,0x99FB,0x99F8,0x9A01,0x9A0F,0x9A05,0x99E2, +0x9A19,0x9A2B,0x9A37,0x9A45,0x9A42,0x9A40,0x9A43, 0, +0x9A3E,0x9A55,0x9A4D,0x9A5B,0x9A57,0x9A5F,0x9A62,0x9A65, +0x9A64,0x9A69,0x9A6B,0x9A6A,0x9AAD,0x9AB0,0x9ABC,0x9AC0, +0x9ACF,0x9AD1,0x9AD3,0x9AD4,0x9ADE,0x9ADF,0x9AE2,0x9AE3, +0x9AE6,0x9AEF,0x9AEB,0x9AEE,0x9AF4,0x9AF1,0x9AF7,0x9AFB, +0x9B06,0x9B18,0x9B1A,0x9B1F,0x9B22,0x9B23,0x9B25,0x9B27, +0x9B28,0x9B29,0x9B2A,0x9B2E,0x9B2F,0x9B32,0x9B44,0x9B43, +0x9B4F,0x9B4D,0x9B4E,0x9B51,0x9B58,0x9B74,0x9B93,0x9B83, +0x9B91,0x9B96,0x9B97,0x9B9F,0x9BA0,0x9BA8,0x9BB4,0x9BC0, +0x9BCA,0x9BB9,0x9BC6,0x9BCF,0x9BD1,0x9BD2,0x9BE3,0x9BE2, +0x9BE4,0x9BD4,0x9BE1,0x9C3A,0x9BF2,0x9BF1,0x9BF0,0x9C15, +0x9C14,0x9C09,0x9C13,0x9C0C,0x9C06,0x9C08,0x9C12,0x9C0A, +0x9C04,0x9C2E,0x9C1B,0x9C25,0x9C24,0x9C21,0x9C30,0x9C47, +0x9C32,0x9C46,0x9C3E,0x9C5A,0x9C60,0x9C67,0x9C76,0x9C78, +0x9CE7,0x9CEC,0x9CF0,0x9D09,0x9D08,0x9CEB,0x9D03,0x9D06, +0x9D2A,0x9D26,0x9DAF,0x9D23,0x9D1F,0x9D44,0x9D15,0x9D12, +0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9D5D,0x9D5E,0x9D64,0x9D51,0x9D50,0x9D59,0x9D72,0x9D89, +0x9D87,0x9DAB,0x9D6F,0x9D7A,0x9D9A,0x9DA4,0x9DA9,0x9DB2, +0x9DC4,0x9DC1,0x9DBB,0x9DB8,0x9DBA,0x9DC6,0x9DCF,0x9DC2, +0x9DD9,0x9DD3,0x9DF8,0x9DE6,0x9DED,0x9DEF,0x9DFD,0x9E1A, +0x9E1B,0x9E1E,0x9E75,0x9E79,0x9E7D,0x9E81,0x9E88,0x9E8B, +0x9E8C,0x9E92,0x9E95,0x9E91,0x9E9D,0x9EA5,0x9EA9,0x9EB8, +0x9EAA,0x9EAD,0x9761,0x9ECC,0x9ECE,0x9ECF,0x9ED0,0x9ED4, +0x9EDC,0x9EDE,0x9EDD,0x9EE0,0x9EE5,0x9EE8,0x9EEF, 0, +0x9EF4,0x9EF6,0x9EF7,0x9EF9,0x9EFB,0x9EFC,0x9EFD,0x9F07, +0x9F08,0x76B7,0x9F15,0x9F21,0x9F2C,0x9F3E,0x9F4A,0x9F52, +0x9F54,0x9F63,0x9F5F,0x9F60,0x9F61,0x9F66,0x9F67,0x9F6C, +0x9F6A,0x9F77,0x9F72,0x9F76,0x9F95,0x9F9C,0x9FA0,0x582F, +0x69C7,0x9059,0x7464,0x51DC,0x7199}; + +static int func_sjis_uni_onechar(int code){ + if ((code>=0x00A1)&&(code<=0x00DF)) + return(tab_sjis_uni0[code-0x00A1]); + if ((code>=0x8140)&&(code<=0x84BE)) + return(tab_sjis_uni1[code-0x8140]); + if ((code>=0x889F)&&(code<=0x9FFC)) + return(tab_sjis_uni2[code-0x889F]); + if ((code>=0xE040)&&(code<=0xEAA4)) + return(tab_sjis_uni3[code-0xE040]); + return(0); +} +/* page 0 0x005C-0x00F7 */ +static uint16 tab_uni_sjis0[]={ +0x815F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8191,0x8192, + 0, 0, 0,0x8198,0x814E, 0, 0, 0, +0x81CA, 0, 0, 0,0x818B,0x817D, 0, 0, +0x814C, 0,0x81F7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x817E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8180}; + +/* page 1 0x0391-0x0451 */ +static uint16 tab_uni_sjis1[]={ +0x839F,0x83A0,0x83A1,0x83A2,0x83A3,0x83A4,0x83A5,0x83A6, +0x83A7,0x83A8,0x83A9,0x83AA,0x83AB,0x83AC,0x83AD,0x83AE, +0x83AF, 0,0x83B0,0x83B1,0x83B2,0x83B3,0x83B4,0x83B5, +0x83B6, 0, 0, 0, 0, 0, 0, 0, +0x83BF,0x83C0,0x83C1,0x83C2,0x83C3,0x83C4,0x83C5,0x83C6, +0x83C7,0x83C8,0x83C9,0x83CA,0x83CB,0x83CC,0x83CD,0x83CE, +0x83CF, 0,0x83D0,0x83D1,0x83D2,0x83D3,0x83D4,0x83D5, +0x83D6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8446, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8440, +0x8441,0x8442,0x8443,0x8444,0x8445,0x8447,0x8448,0x8449, +0x844A,0x844B,0x844C,0x844D,0x844E,0x844F,0x8450,0x8451, +0x8452,0x8453,0x8454,0x8455,0x8456,0x8457,0x8458,0x8459, +0x845A,0x845B,0x845C,0x845D,0x845E,0x845F,0x8460,0x8470, +0x8471,0x8472,0x8473,0x8474,0x8475,0x8477,0x8478,0x8479, +0x847A,0x847B,0x847C,0x847D,0x847E,0x8480,0x8481,0x8482, +0x8483,0x8484,0x8485,0x8486,0x8487,0x8488,0x8489,0x848A, +0x848B,0x848C,0x848D,0x848E,0x848F,0x8490,0x8491, 0, +0x8476}; + +/* page 2 0x2010-0x2312 */ +static uint16 tab_uni_sjis2[]={ +0x815D, 0, 0, 0, 0,0x815C,0x8161, 0, +0x8165,0x8166, 0, 0,0x8167,0x8168, 0, 0, +0x81F5,0x81F6, 0, 0, 0,0x8164,0x8163, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81F1, 0,0x818C,0x818D, 0, 0, 0, 0, + 0, 0, 0,0x81A6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x818E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x81F0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81A9,0x81AA,0x81A8,0x81AB, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81CB, 0,0x81CC, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81CD, 0,0x81DD,0x81CE, 0, 0, 0,0x81DE, +0x81B8, 0, 0,0x81B9, 0, 0, 0, 0, + 0, 0,0x817C, 0, 0, 0, 0, 0, + 0, 0,0x81E3, 0, 0,0x81E5,0x8187, 0, +0x81DA, 0, 0, 0, 0, 0, 0,0x81C8, +0x81C9,0x81BF,0x81BE,0x81E7,0x81E8, 0, 0, 0, + 0, 0, 0, 0,0x8188,0x81E6, 0, 0, + 0, 0, 0, 0, 0,0x81E4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81E0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8182,0x81DF, 0, 0, 0, 0,0x8185,0x8186, + 0, 0,0x81E1,0x81E2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81BC,0x81BD, 0, 0,0x81BA,0x81BB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x81DB, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81DC}; + +/* page 3 0x2500-0x266F */ +static uint16 tab_uni_sjis3[]={ +0x849F,0x84AA,0x84A0,0x84AB, 0, 0, 0, 0, + 0, 0, 0, 0,0x84A1, 0, 0,0x84AC, +0x84A2, 0, 0,0x84AD,0x84A4, 0, 0,0x84AF, +0x84A3, 0, 0,0x84AE,0x84A5,0x84BA, 0, 0, +0x84B5, 0, 0,0x84B0,0x84A7,0x84BC, 0, 0, +0x84B7, 0, 0,0x84B2,0x84A6, 0, 0,0x84B6, +0x84BB, 0, 0,0x84B1,0x84A8, 0, 0,0x84B8, +0x84BD, 0, 0,0x84B3,0x84A9, 0, 0,0x84B9, + 0, 0,0x84BE, 0, 0, 0, 0, 0, + 0, 0, 0,0x84B4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x81A1,0x81A0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81A3,0x81A2, 0, 0, 0, 0, + 0, 0, 0, 0,0x81A5,0x81A4, 0, 0, + 0, 0, 0, 0, 0, 0,0x819F,0x819E, + 0, 0, 0,0x819B, 0, 0,0x819D,0x819C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x81FC, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x819A,0x8199, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x818A, 0,0x8189, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x81F4, 0, 0,0x81F3, 0,0x81F2 +}; + +/* page 4 0x3000-0x30FE */ +static uint16 tab_uni_sjis4[]={ +0x8140,0x8141,0x8142,0x8156, 0,0x8158,0x8159,0x815A, +0x8171,0x8172,0x8173,0x8174,0x8175,0x8176,0x8177,0x8178, +0x8179,0x817A,0x81A7,0x81AC,0x816B,0x816C, 0, 0, + 0, 0, 0, 0,0x8160, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x829F,0x82A0,0x82A1,0x82A2,0x82A3,0x82A4,0x82A5, +0x82A6,0x82A7,0x82A8,0x82A9,0x82AA,0x82AB,0x82AC,0x82AD, +0x82AE,0x82AF,0x82B0,0x82B1,0x82B2,0x82B3,0x82B4,0x82B5, +0x82B6,0x82B7,0x82B8,0x82B9,0x82BA,0x82BB,0x82BC,0x82BD, +0x82BE,0x82BF,0x82C0,0x82C1,0x82C2,0x82C3,0x82C4,0x82C5, +0x82C6,0x82C7,0x82C8,0x82C9,0x82CA,0x82CB,0x82CC,0x82CD, +0x82CE,0x82CF,0x82D0,0x82D1,0x82D2,0x82D3,0x82D4,0x82D5, +0x82D6,0x82D7,0x82D8,0x82D9,0x82DA,0x82DB,0x82DC,0x82DD, +0x82DE,0x82DF,0x82E0,0x82E1,0x82E2,0x82E3,0x82E4,0x82E5, +0x82E6,0x82E7,0x82E8,0x82E9,0x82EA,0x82EB,0x82EC,0x82ED, +0x82EE,0x82EF,0x82F0,0x82F1, 0, 0, 0, 0, + 0, 0, 0,0x814A,0x814B,0x8154,0x8155, 0, + 0,0x8340,0x8341,0x8342,0x8343,0x8344,0x8345,0x8346, +0x8347,0x8348,0x8349,0x834A,0x834B,0x834C,0x834D,0x834E, +0x834F,0x8350,0x8351,0x8352,0x8353,0x8354,0x8355,0x8356, +0x8357,0x8358,0x8359,0x835A,0x835B,0x835C,0x835D,0x835E, +0x835F,0x8360,0x8361,0x8362,0x8363,0x8364,0x8365,0x8366, +0x8367,0x8368,0x8369,0x836A,0x836B,0x836C,0x836D,0x836E, +0x836F,0x8370,0x8371,0x8372,0x8373,0x8374,0x8375,0x8376, +0x8377,0x8378,0x8379,0x837A,0x837B,0x837C,0x837D,0x837E, +0x8380,0x8381,0x8382,0x8383,0x8384,0x8385,0x8386,0x8387, +0x8388,0x8389,0x838A,0x838B,0x838C,0x838D,0x838E,0x838F, +0x8390,0x8391,0x8392,0x8393,0x8394,0x8395,0x8396, 0, + 0, 0, 0,0x8145,0x815B,0x8152,0x8153}; + +/* page 5 0x4E00-0x9481 */ +static uint16 tab_uni_sjis5[]={ +0x88EA,0x929A, 0,0x8EB5, 0, 0, 0,0x969C, +0x8FE4,0x8E4F,0x8FE3,0x89BA, 0,0x9573,0x975E, 0, +0x98A0,0x894E, 0, 0,0x8A8E,0x98A1,0x90A2,0x99C0, +0x8B75,0x95B8, 0, 0, 0, 0,0x8FE5, 0, + 0,0x97BC, 0, 0, 0, 0,0x95C0, 0, + 0, 0,0x98A2, 0, 0,0x9286, 0, 0, + 0,0x98A3,0x8BF8, 0, 0, 0,0x98A4, 0, +0x8ADB,0x924F, 0,0x8EE5,0x98A5, 0, 0,0x98A6, + 0, 0,0x98A7,0x9454, 0,0x8B76, 0, 0, + 0, 0, 0,0x9456, 0,0x93E1,0x8CC1,0x9652, + 0, 0, 0, 0, 0,0xE568,0x98A8,0x8FE6, +0x98A9,0x89B3, 0, 0, 0,0x8BE3,0x8CEE,0x96E7, + 0, 0,0x9BA4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9790, 0,0x93FB, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8AA3, 0, +0x8B54, 0,0x98AA, 0, 0,0x98AB,0x97B9, 0, +0x975C,0x9188,0x98AD,0x8E96,0x93F1, 0,0x98B0, 0, + 0,0x895D,0x8CDD, 0,0x8CDC,0x88E4, 0, 0, +0x986A,0x9869, 0,0x8DB1,0x889F, 0,0x98B1,0x98B2, +0x98B3,0x9653,0x98B4, 0,0x8CF0,0x88E5,0x9692, 0, +0x8B9C, 0, 0,0x8B9D,0x8B9E,0x92E0,0x97BA, 0, +0x98B5, 0, 0,0x98B6, 0, 0,0x98B7, 0, + 0, 0,0x906C, 0, 0, 0, 0, 0, +0x8F59,0x906D,0x98BC, 0,0x98BA, 0,0x98BB,0x8B77, + 0, 0,0x8DA1,0x89EE, 0,0x98B9,0x98B8,0x95A7, + 0, 0, 0, 0,0x8E65,0x8E64,0x91BC,0x98BD, +0x9574,0x90E5, 0, 0, 0,0x8157,0x98BE,0x98C0, + 0, 0, 0,0x91E3,0x97DF,0x88C8, 0, 0, + 0, 0, 0, 0, 0,0x98BF,0x89BC, 0, +0x8BC2, 0,0x9287, 0, 0, 0,0x8C8F,0x98C1, + 0, 0, 0,0x9443, 0, 0, 0, 0, + 0,0x8AE9, 0, 0, 0, 0, 0, 0, + 0,0x98C2,0x88C9, 0, 0,0x8CDE,0x8AEA,0x959A, +0x94B0,0x8B78, 0, 0, 0, 0, 0, 0, + 0, 0,0x89EF, 0,0x98E5,0x9360, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x948C, +0x98C4, 0, 0, 0,0x94BA, 0,0x97E0, 0, +0x904C, 0,0x8E66, 0,0x8E97,0x89BE, 0, 0, + 0, 0, 0,0x92CF, 0, 0,0x9241,0x98C8, + 0, 0, 0, 0, 0,0x88CA,0x92E1,0x8F5A, +0x8DB2,0x9743, 0,0x91CC, 0,0x89BD, 0,0x98C7, + 0,0x975D,0x98C3,0x98C5,0x8DEC,0x98C6,0x9B43, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x98CE, 0, 0, 0, 0, 0,0x98D1, +0x98CF, 0, 0,0x89C0, 0,0x95B9,0x98C9, 0, + 0, 0, 0,0x98CD,0x8CF1, 0, 0,0x8E67, + 0, 0, 0,0x8AA4, 0, 0,0x98D2, 0, +0x98CA, 0, 0,0x97E1, 0,0x8E98, 0,0x98CB, + 0,0x98D0, 0, 0, 0, 0,0x98D3, 0, +0x98CC, 0, 0,0x8B9F, 0,0x88CB, 0, 0, +0x8BA0,0x89BF, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9B44, 0,0x9699,0x958E,0x8CF2, + 0, 0, 0, 0, 0,0x904E,0x97B5, 0, + 0, 0, 0, 0, 0, 0, 0,0x95D6, + 0, 0,0x8C57,0x91A3,0x89E2, 0, 0, 0, + 0, 0,0x8F72, 0, 0, 0,0x98D7, 0, +0x98DC,0x98DA, 0, 0,0x98D5, 0, 0,0x91AD, +0x98D8, 0,0x98DB,0x98D9, 0,0x95DB, 0,0x98D6, + 0,0x904D, 0,0x9693,0x98DD,0x98DE, 0, 0, + 0, 0, 0, 0, 0, 0,0x8F43,0x98EB, + 0, 0, 0,0x946F, 0,0x9555,0x98E6, 0, +0x95EE, 0,0x89B4, 0, 0, 0,0x98EA, 0, + 0, 0, 0, 0, 0,0x98E4,0x98ED, 0, + 0,0x9171, 0,0x8CC2, 0,0x947B, 0,0xE0C5, + 0,0x98EC,0x937C, 0,0x98E1, 0,0x8CF4, 0, + 0,0x8CF3,0x98DF, 0, 0, 0, 0,0x8ED8, + 0,0x98E7, 0,0x95ED,0x926C,0x98E3,0x8C91, 0, +0x98E0,0x98E8,0x98E2,0x97CF,0x98E9,0x9860, 0, 0, + 0, 0, 0, 0, 0, 0,0x8BE4, 0, + 0,0x8C90, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x98EE, 0, 0, 0,0x98EF, +0x98F3,0x88CC, 0, 0, 0, 0, 0,0x95CE, +0x98F2, 0, 0, 0, 0,0x98F1,0x98F5, 0, + 0, 0,0x98F4, 0,0x92E2, 0, 0, 0, + 0, 0, 0, 0, 0,0x8C92, 0, 0, + 0, 0, 0, 0,0x98F6, 0, 0, 0, + 0, 0,0x8EC3, 0,0x91A4,0x92E3,0x8BF4, 0, +0x98F7, 0, 0, 0, 0,0x8B55, 0, 0, +0x98F8, 0, 0, 0, 0,0x98FA, 0, 0, + 0, 0, 0, 0, 0,0x9654, 0, 0, + 0,0x8C86, 0, 0, 0, 0, 0, 0, +0x8E50,0x94F5,0x98F9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8DC3,0x9762, 0, 0, + 0, 0,0x98FC,0x9942,0x98FB,0x8DC2, 0,0x8F9D, + 0, 0, 0, 0, 0, 0,0x8C58, 0, + 0, 0,0x9943, 0, 0,0x8BCD, 0, 0, + 0,0x9940,0x9941, 0, 0,0x93AD, 0,0x919C, + 0,0x8BA1, 0, 0, 0,0x966C,0x9944, 0, + 0, 0,0x97BB, 0, 0, 0,0x9945, 0, + 0, 0, 0,0x9948, 0,0x9946, 0,0x916D, + 0, 0, 0, 0, 0,0x9947,0x9949, 0, + 0, 0, 0, 0, 0,0x994B, 0, 0, + 0,0x994A, 0,0x95C6, 0, 0, 0, 0, +0x8B56,0x994D,0x994E, 0,0x89AD, 0, 0, 0, + 0,0x994C, 0, 0, 0, 0, 0, 0, + 0, 0,0x8EF2, 0,0x9951,0x9950,0x994F, 0, +0x98D4, 0,0x9952, 0, 0, 0, 0,0x8F9E, + 0,0x9953, 0, 0, 0, 0, 0, 0, + 0, 0,0x9744, 0, 0, 0, 0, 0, + 0, 0,0x96D7, 0, 0, 0, 0,0x9955, + 0, 0,0x9954,0x9957,0x9956, 0, 0,0x9958, +0x9959,0x88F2, 0,0x8CB3,0x8C5A,0x8F5B,0x929B,0x8BA2, +0x90E6,0x8CF5, 0,0x8D8E,0x995B,0x96C6,0x9365, 0, +0x8E99, 0,0x995A, 0,0x995C, 0, 0, 0, + 0, 0,0x937D, 0,0x8A95, 0, 0, 0, + 0, 0,0x995D, 0, 0,0x93FC, 0, 0, +0x9153,0x995F,0x9960,0x94AA,0x8CF6,0x985A,0x9961, 0, + 0,0x8BA4, 0, 0, 0,0x95BA,0x91B4,0x8BEF, +0x9354, 0, 0, 0,0x8C93, 0, 0, 0, +0x9962, 0,0x9963, 0, 0,0x93E0,0x897E, 0, + 0,0x9966,0x8DFB, 0,0x9965,0x8DC4, 0,0x9967, +0xE3EC,0x9968,0x9660,0x9969, 0,0x996A,0x996B,0x8FE7, + 0,0x8ECA, 0, 0, 0, 0, 0, 0, +0x8AA5, 0,0x996E, 0,0x996C,0x96BB,0x996D, 0, +0x9579,0x996F,0x9970,0x9971,0x937E, 0, 0, 0, +0x9975,0x9973,0x9974,0x9972,0x8DE1,0x9976,0x96E8,0x97E2, + 0, 0, 0, 0, 0,0x9977, 0, 0, + 0, 0, 0, 0,0x90A6,0x9978,0x8F79, 0, + 0,0x9979, 0,0x929C,0x97BD,0x9380, 0, 0, + 0, 0, 0, 0, 0, 0,0x99C3, 0, + 0, 0, 0,0x997A,0xEAA3,0x8BC3, 0, 0, +0x997B,0x967D, 0, 0, 0, 0,0x8F88,0x91FA, + 0,0x997D,0x93E2, 0, 0,0x997E, 0, 0, +0x9980,0x8A4D, 0, 0, 0,0x9981,0x8BA5, 0, +0x93CA,0x899A,0x8F6F, 0, 0,0x949F,0x9982, 0, +0x9381, 0, 0,0x906E,0x9983, 0,0x95AA,0x90D8, +0x8AA0, 0,0x8AA7,0x9984, 0, 0,0x9986, 0, + 0,0x8C59, 0, 0,0x9985, 0, 0,0x97F1, + 0, 0, 0, 0, 0,0x8F89, 0, 0, + 0, 0, 0, 0,0x94BB,0x95CA, 0,0x9987, + 0,0x9798,0x9988, 0, 0, 0,0x9989, 0, +0x939E, 0, 0,0x998A, 0, 0,0x90A7,0x8DFC, +0x8C94,0x998B,0x8E68,0x8D8F, 0, 0, 0, 0, + 0, 0, 0,0x92E4,0x998D, 0, 0,0x91A5, + 0, 0,0x8DED,0x998E,0x998F,0x914F, 0,0x998C, + 0, 0, 0, 0,0x9991, 0,0x9655, 0, + 0, 0, 0,0x8D84, 0, 0,0x9990, 0, + 0, 0, 0,0x8C95,0x8DDC,0x948D, 0, 0, + 0,0x9994,0x9992, 0, 0, 0, 0,0x959B, +0x8FE8,0x999B,0x8A84,0x9995,0x9993,0x916E, 0, 0, + 0, 0, 0, 0, 0,0x9997, 0,0x9996, + 0, 0, 0,0x8A63, 0, 0, 0,0x8C80, +0x999C,0x97AB, 0, 0, 0,0x9998, 0, 0, + 0,0x999D,0x999A, 0,0x9999, 0, 0, 0, + 0, 0, 0,0x97CD, 0, 0, 0,0x8CF7, +0x89C1, 0, 0,0x97F2, 0, 0, 0, 0, + 0,0x8F95,0x9377,0x8D85,0x99A0,0x99A1, 0, 0, + 0,0x97E3, 0, 0,0x984A,0x99A3, 0, 0, + 0,0x8CF8, 0, 0,0x99A2, 0,0x8A4E, 0, + 0,0x99A4, 0,0x9675, 0,0x92BA, 0,0x9745, + 0,0x95D7, 0, 0, 0,0x99A5, 0, 0, + 0, 0,0xE8D3, 0, 0,0x93AE, 0,0x99A6, +0x8AA8,0x96B1, 0, 0, 0,0x8F9F,0x99A7,0x95E5, +0x99AB, 0,0x90A8,0x99A8,0x8BCE, 0,0x99A9,0x8AA9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8C4D,0x99AC, 0,0x99AD, 0, 0, +0x99AE,0x99AF,0x8ED9, 0, 0, 0,0x8CF9,0x96DC, + 0,0x96E6,0x93F5, 0, 0,0x95EF,0x99B0, 0, +0x99B1, 0, 0, 0, 0,0x99B3, 0,0x99B5, +0x99B4, 0, 0, 0, 0,0x99B6,0x89BB,0x966B, + 0,0x8DFA,0x99B7, 0, 0,0x9178, 0, 0, +0x8FA0,0x8BA7, 0,0x99B8, 0, 0, 0, 0, + 0, 0,0x94D9, 0, 0, 0, 0,0x99B9, + 0,0x99BA, 0,0x99BB, 0, 0, 0, 0, +0x99BC,0x9543,0x8BE6,0x88E3, 0, 0, 0,0x93BD, +0x99BD,0x8F5C, 0,0x90E7, 0,0x99BF,0x99BE,0x8FA1, +0x8CDF,0x99C1,0x94BC, 0, 0,0x99C2, 0, 0, + 0,0x94DA,0x91B2,0x91EC,0x8BA6, 0, 0,0x93EC, +0x9250, 0,0x948E, 0,0x966D, 0,0x99C4, 0, +0x90E8, 0, 0, 0, 0, 0,0x8C54, 0, + 0,0x99C5, 0, 0, 0, 0,0x99C6,0x894B, +0x88F3,0x8AEB, 0,0x91A6,0x8B70,0x9791, 0,0x99C9, +0x89B5, 0, 0,0x99C8, 0, 0, 0,0x8BA8, + 0, 0,0x99CA, 0,0x96EF, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x99CB, 0, +0x97D0, 0,0x8CFA, 0, 0, 0, 0,0x8CB4, +0x99CC, 0, 0, 0, 0,0x99CE,0x99CD, 0, +0x907E,0x8958, 0, 0, 0,0x897D,0x99CF, 0, +0x99D0, 0, 0,0x8CB5, 0, 0,0x99D1, 0, + 0, 0, 0,0x8B8E, 0, 0, 0, 0, + 0, 0,0x8E51,0x99D2, 0, 0, 0, 0, +0x9694,0x8DB3,0x8B79,0x9746,0x916F,0x94BD,0x8EFB, 0, + 0, 0, 0, 0,0x8F66, 0,0x8EE6,0x8EF3, + 0,0x8F96, 0,0x94BE, 0, 0, 0,0x99D5, + 0,0x8962,0x9170,0x8CFB,0x8CC3,0x8BE5, 0, 0, +0x99D9,0x9240,0x91FC,0x8BA9,0x8FA2,0x99DA,0x99D8,0x89C2, +0x91E4,0x8EB6,0x8E6A,0x8945, 0, 0,0x8A90,0x8D86, +0x8E69, 0,0x99DB, 0, 0, 0, 0, 0, + 0,0x99DC, 0,0x8B68,0x8A65, 0, 0, 0, +0x8D87,0x8B67,0x92DD,0x8944,0x93AF,0x96BC,0x8D40,0x9799, +0x9366,0x8CFC, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8C4E, 0,0x99E5, 0,0x8BE1, +0x9669, 0, 0, 0, 0, 0,0x94DB, 0, + 0,0x99E4, 0,0x8ADC,0x99DF,0x99E0,0x99E2, 0, + 0, 0, 0, 0, 0, 0,0x99E3, 0, +0x8B7A,0x9081, 0,0x95AB,0x99E1,0x99DD,0x8CE1, 0, +0x99DE, 0,0x9843, 0, 0, 0,0x95F0, 0, +0x92E6,0x8CE0,0x8D90, 0, 0, 0,0x99E6, 0, + 0,0x93DB, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x99EA, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8EFC, 0,0x8EF4, 0, 0, 0, 0, 0, +0x99ED,0x99EB, 0,0x96A1, 0,0x99E8,0x99F1,0x99EC, + 0, 0, 0,0x99EF,0x8CC4,0x96BD, 0, 0, +0x99F0, 0, 0, 0,0x99F2, 0,0x99F4, 0, + 0, 0, 0,0x8DEE,0x9861, 0,0x99E9,0x99E7, +0x99F3, 0,0x99EE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x99F6, 0,0x9A42,0x99F8, 0, 0, +0x99FC, 0, 0,0x9A40,0x99F9, 0, 0,0x9A5D, + 0, 0,0x8DE7,0x8A50, 0, 0, 0, 0, +0x99F7, 0, 0, 0,0x9A44,0x88F4,0x9A43, 0, +0x88A3,0x9569,0x9A41, 0,0x99FA, 0, 0,0x99F5, +0x99FB,0x8DC6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9A45, 0, 0, 0, 0, 0, 0, 0, + 0,0x88F5,0x9A4E, 0, 0,0x9A46,0x9A47, 0, +0x8FA3,0x9689, 0, 0, 0,0x9A4C,0x9A4B, 0, + 0, 0,0x934E, 0, 0, 0, 0, 0, + 0, 0,0x9A4D, 0, 0,0x9A4A, 0, 0, + 0, 0, 0, 0,0x8953, 0,0x8DB4,0x904F, + 0, 0, 0, 0, 0, 0, 0,0x9A48, +0x9382, 0, 0, 0,0x9A49, 0,0x88A0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9A53,0x9742, + 0,0x8FA5, 0,0x9A59, 0, 0, 0, 0, +0x9A58,0x9A4F, 0, 0, 0, 0,0x91C1, 0, +0x9A50, 0, 0, 0,0x91ED,0x9A55,0x8FA4, 0, + 0, 0, 0, 0,0x9A52, 0, 0,0x96E2, + 0, 0, 0,0x8C5B, 0, 0,0x9A56,0x9A57, + 0, 0, 0, 0,0x9A54,0x9A5A, 0, 0, + 0, 0, 0,0x9A51, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9A60,0x9A65, 0,0x9A61, 0, +0x9A5C, 0, 0,0x9A66,0x9150, 0, 0,0x9A68, + 0,0x8D41,0x9A5E,0x929D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9A62,0x9A5B,0x8AAB, 0,0x8AEC,0x8A85,0x9A63,0x9A5F, + 0, 0, 0, 0, 0, 0, 0,0x8C96, +0x9A69,0x9A67,0x9172,0x8B69,0x8BAA, 0,0x9A64, 0, +0x8BF2, 0, 0, 0, 0, 0,0x8963, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A6D,0x9A6B, 0,0x9AA5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A70, 0, 0, 0, + 0, 0,0x9A6A, 0,0x9A6E, 0, 0,0x9A6C, + 0, 0, 0,0x8E6B,0x9A6F, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9A72, + 0,0x9A77, 0, 0, 0,0x9A75,0x9A74, 0, + 0, 0, 0, 0, 0, 0,0x9251, 0, + 0,0x89C3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A71, 0,0x9A73,0x8FA6, +0x8952, 0, 0,0x9A76, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x89DC, 0, 0, 0, 0, 0,0x9A82, + 0,0x8FFA,0x9A7D, 0,0x9A7B, 0,0x9A7C, 0, +0x9A7E, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x895C, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9158, 0,0x9A78, 0, +0x9A79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8A9A, 0, 0, 0, 0, + 0, 0, 0, 0,0x9A81, 0, 0, 0, +0x8AED, 0,0x9A84,0x9A80,0x9A83, 0, 0, 0, + 0, 0, 0, 0,0x95AC, 0, 0, 0, +0x93D3, 0,0x94B6, 0, 0, 0, 0, 0, +0x9A86, 0, 0, 0, 0, 0,0x9A85,0x8A64, + 0, 0,0x9A87, 0, 0, 0, 0,0x9A8A, + 0, 0, 0, 0,0x9A89, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9A88, 0,0x9458, 0, 0,0x9A8B, 0, 0, + 0, 0, 0, 0, 0, 0,0x9A8C, 0, + 0, 0, 0, 0,0x9A8E, 0,0x9A8D, 0, + 0, 0, 0, 0,0x9A90, 0, 0, 0, +0x9A93,0x9A91,0x9A8F,0x9A92, 0, 0, 0, 0, +0x9A94, 0, 0, 0, 0, 0,0x9A95, 0, + 0,0x9A96, 0,0x9A97, 0, 0, 0,0x9A98, +0x9964, 0,0x8EFA,0x8E6C, 0, 0,0x89F1, 0, +0x88F6, 0, 0,0x9263, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9A99, 0, +0x8DA2, 0,0x88CD,0x907D, 0, 0, 0, 0, + 0,0x9A9A,0x8CC5, 0, 0,0x8D91, 0,0x9A9C, +0x9A9B, 0, 0,0x95DE,0x9A9D, 0, 0, 0, +0x9A9F,0x9A9E, 0,0x9AA0, 0,0x9AA1, 0,0x8C97, + 0, 0,0x8980,0x9AA2, 0, 0,0x9AA4, 0, +0x9AA3, 0, 0, 0,0x9AA6, 0, 0,0x9379, + 0, 0, 0, 0, 0, 0,0x9AA7,0x88B3, +0x8DDD, 0, 0, 0, 0,0x8C5C, 0, 0, +0x926E, 0, 0, 0, 0, 0, 0,0x9AA8, +0x9AA9, 0, 0,0x9AAB, 0, 0, 0, 0, +0x9AAC, 0,0x8DE2, 0, 0, 0, 0,0x8BCF, + 0, 0,0x9656, 0, 0, 0,0x9AAA,0x9AAD, +0x8DBF,0x8D42, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9AB1, 0, 0,0x8DA3, 0,0x9252, 0, + 0,0x9AAE,0x92D8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9AB2, + 0, 0,0x9082, 0, 0, 0, 0, 0, +0x9AB0,0x9AB3, 0,0x8C5E, 0, 0, 0, 0, + 0, 0, 0,0x9AB4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9AB5, 0,0x8D43,0x8A5F,0x9AB7, 0, 0, 0, + 0, 0,0x9AB8, 0, 0, 0, 0, 0, +0x9AB9, 0, 0,0x9AB6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9AAF, 0, 0,0x9ABA, 0, 0,0x9ABB, 0, + 0, 0, 0,0x9684, 0, 0,0x8FE9, 0, + 0, 0,0x9ABD,0x9ABE,0x9ABC, 0,0x9AC0, 0, + 0, 0, 0, 0,0x9457, 0, 0,0x88E6, +0x9575, 0, 0,0x9AC1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8FFB, 0, 0,0x8EB7, + 0,0x947C,0x8AEE, 0,0x8DE9, 0, 0, 0, +0x9678, 0,0x93B0, 0, 0,0x8C98,0x91CD, 0, + 0, 0,0x9ABF,0x9AC2, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x91C2, 0, 0, + 0,0x9AC3, 0, 0, 0,0x9AC4, 0, 0, + 0,0x9AC6, 0, 0,0x92E7, 0, 0, 0, + 0, 0,0x8AAC, 0, 0, 0, 0,0xEA9F, +0x8981,0x95F1, 0, 0,0x8FEA,0x9367, 0, 0, + 0, 0,0x8DE4, 0, 0,0x9ACC, 0, 0, +0x95BB,0x97DB, 0, 0, 0, 0, 0, 0, + 0, 0,0x89F2,0x9AC8, 0, 0, 0, 0, + 0,0x9159,0x9ACB, 0,0x9383, 0, 0,0x9368, +0x9384,0x94B7,0x92CB, 0, 0, 0,0x8DC7, 0, + 0, 0,0x9AC7, 0, 0, 0, 0, 0, + 0,0x8996, 0,0x9355, 0, 0, 0, 0, +0x9AC9, 0,0x9AC5, 0, 0,0x906F, 0, 0, + 0,0x9ACD, 0, 0, 0, 0,0x8F6D, 0, + 0, 0, 0,0x8BAB, 0,0x9ACE, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x95E6, 0, 0, 0,0x919D, + 0, 0, 0, 0,0x92C4, 0, 0,0x9AD0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x966E, 0, 0,0x9AD1, 0, 0,0x9AD6, 0, + 0, 0, 0,0x95AD, 0, 0, 0, 0, +0x9AD5,0x9ACF,0x9AD2,0x9AD4, 0, 0,0x8DA4, 0, + 0,0x95C7, 0, 0, 0,0x9AD7, 0,0x9264, + 0, 0,0x89F3, 0,0x8FEB, 0, 0, 0, + 0,0x9AD9, 0,0x9AD8, 0,0x8D88, 0,0x9ADA, +0x9ADC,0x9ADB, 0, 0,0x9ADE, 0,0x9AD3,0x9AE0, + 0, 0, 0, 0,0x9ADF,0x9ADD, 0, 0, + 0, 0, 0,0x8E6D,0x9070, 0,0x9173,0x9AE1, +0x90BA,0x88EB,0x9484, 0, 0, 0, 0,0x92D9, + 0,0x9AE3,0x9AE2,0x9AE4,0x9AE5,0x9AE6, 0, 0, + 0, 0,0x9AE7, 0, 0, 0, 0, 0, + 0,0x95CF,0x9AE8, 0, 0, 0, 0,0x89C4, +0x9AE9, 0, 0, 0, 0,0x975B,0x8A4F, 0, +0x99C7,0x8F67,0x91BD,0x9AEA,0x96E9, 0, 0, 0, + 0, 0,0x96B2, 0, 0,0x9AEC, 0,0x91E5, + 0,0x9356,0x91BE,0x9576,0x9AED,0x9AEE,0x899B, 0, + 0,0x8EB8,0x9AEF, 0, 0, 0, 0,0x88CE, +0x9AF0, 0, 0, 0, 0, 0,0x9AF1, 0, + 0, 0, 0, 0,0x8982, 0, 0,0x8AEF, +0x93DE,0x95F2, 0, 0, 0, 0,0x9AF5,0x9174, +0x9AF4,0x8C5F, 0, 0,0x967A,0x9AF3, 0,0x9385, +0x9AF7, 0,0x9AF6, 0, 0, 0, 0, 0, +0x9AF9, 0,0x9AF8, 0, 0,0x899C, 0,0x9AFA, +0x8FA7,0x9AFC,0x9244, 0,0x9AFB, 0,0x95B1, 0, + 0, 0, 0,0x8F97,0x937A, 0, 0, 0, +0x9B40, 0, 0, 0, 0,0x8D44, 0, 0, + 0,0x9B41,0x9440,0x94DC,0x96CF, 0, 0, 0, + 0, 0,0x9444, 0, 0,0x9B4A, 0, 0, + 0, 0, 0,0x8B57, 0, 0,0x9764, 0, + 0,0x96AD, 0,0x9BAA, 0,0x9B42, 0, 0, + 0, 0, 0,0x9B45, 0,0x91C3, 0, 0, +0x9657, 0, 0, 0,0x9369, 0, 0, 0, + 0, 0,0x9B46, 0, 0, 0, 0, 0, + 0,0x9685, 0,0x8DC8, 0, 0,0x8FA8, 0, + 0, 0, 0, 0, 0, 0,0x9B47, 0, + 0,0x8E6F, 0,0x8E6E, 0, 0, 0, 0, +0x88B7,0x8CC6, 0,0x90A9,0x88CF, 0, 0, 0, + 0,0x9B4B,0x9B4C, 0,0x9B49, 0, 0, 0, + 0, 0, 0, 0, 0,0x8957,0x8AAD, 0, +0x9B48, 0,0x96C3,0x9550, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x88A6, 0, + 0, 0, 0,0x88F7, 0, 0, 0,0x8E70, + 0,0x88D0, 0,0x88A1, 0, 0, 0, 0, + 0,0x9B51, 0, 0, 0, 0, 0, 0, + 0,0x9B4F, 0, 0, 0, 0, 0, 0, +0x96BA, 0,0x9B52, 0,0x9B50, 0, 0,0x9B4E, +0x9050, 0, 0, 0, 0,0x9B4D, 0, 0, + 0,0x95D8, 0, 0, 0, 0, 0,0x8CE2, + 0, 0, 0, 0, 0,0x9B56,0x9B57, 0, + 0, 0, 0, 0,0x8FA9, 0, 0, 0, +0x9B53,0x984B, 0, 0, 0, 0,0x946B, 0, + 0,0x9B55, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8DA5, 0, 0, 0, 0, 0, + 0, 0,0x9B58, 0, 0, 0,0x9577, 0, + 0, 0,0x9B59, 0,0x9B54, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x96B9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x947D, 0, 0, 0, 0, 0, + 0, 0,0x9B5A,0x9551, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9B5B,0x9B5F,0x9B5C, 0, + 0,0x89C5,0x9B5E, 0, 0, 0, 0, 0, + 0,0x8EB9, 0,0x9B5D,0x8C99, 0, 0, 0, +0x9B6B, 0, 0, 0, 0, 0,0x9B64,0x9B61, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9284, 0,0x9B60, 0, 0,0x9B62, 0, + 0,0x9B63, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9B65,0x9B66, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AF0, 0,0x9B68,0x9B67, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9B69, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8FEC, 0, 0, 0, 0, 0, + 0, 0,0x9B6C, 0,0x92DA, 0, 0, 0, +0x8964, 0,0x9B6A, 0, 0, 0,0x9B6D, 0, + 0, 0, 0, 0, 0, 0,0x9B6E, 0, +0x9B71, 0, 0,0x9B6F, 0,0x9B70, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8E71,0x9B72, 0, 0,0x8D45,0x9B73, 0,0x8E9A, +0x91B6, 0,0x9B74,0x9B75,0x8E79,0x8D46, 0,0x96D0, + 0, 0, 0,0x8B47,0x8CC7,0x9B76,0x8A77, 0, + 0,0x9B77, 0,0x91B7, 0, 0, 0, 0, +0x9B78,0x9BA1, 0,0x9B79, 0,0x9B7A, 0, 0, +0x9B7B, 0,0x9B7D, 0, 0, 0, 0, 0, +0x9B7E, 0, 0,0x9B80, 0,0x91EE, 0,0x8946, +0x8EE7,0x88C0, 0,0x9176,0x8AAE,0x8EB3, 0,0x8D47, + 0, 0, 0, 0, 0,0x9386, 0,0x8F40, +0x8AAF,0x9288,0x92E8,0x88B6,0x8B58,0x95F3, 0,0x8EC0, + 0, 0,0x8B71,0x90E9,0x8EBA,0x9747,0x9B81, 0, + 0, 0, 0, 0, 0, 0,0x8B7B, 0, +0x8DC9, 0, 0,0x8A51,0x8983,0x8FAA,0x89C6, 0, +0x9B82,0x9765, 0, 0, 0, 0, 0,0x8F68, + 0, 0,0x8EE2,0x9B83,0x8AF1,0x93D0,0x96A7,0x9B84, + 0,0x9B85, 0, 0,0x9578, 0, 0, 0, +0x9B87, 0,0x8AA6,0x8BF5,0x9B86, 0, 0, 0, + 0, 0, 0,0x8AB0, 0,0x9051,0x9B8B,0x8E40, + 0,0x89C7,0x9B8A, 0,0x9B88,0x9B8C,0x9B89,0x944A, +0x9ECB,0x9052, 0,0x9B8D, 0, 0,0x97BE, 0, +0x9B8E, 0, 0,0x9B90, 0,0x929E,0x9B8F, 0, +0x90A1, 0,0x8E9B, 0, 0, 0,0x91CE,0x8EF5, + 0,0x9595,0x90EA, 0,0x8ECB,0x9B91,0x8FAB,0x9B92, +0x9B93,0x88D1,0x91B8,0x9071, 0,0x9B94,0x93B1,0x8FAC, + 0,0x8FAD, 0,0x9B95, 0, 0,0x90EB, 0, + 0, 0,0x8FAE, 0, 0, 0, 0, 0, +0x9B96, 0,0x9B97, 0,0x96DE, 0, 0, 0, +0x9B98, 0, 0, 0, 0,0x8BC4, 0, 0, + 0,0x8F41, 0, 0, 0, 0, 0, 0, +0x9B99,0x9B9A,0x8EDA,0x904B,0x93F2,0x9073,0x94F6,0x9441, +0x8BC7,0x9B9B, 0, 0, 0,0x8B8F,0x9B9C, 0, +0x8BFC, 0,0x93CD,0x89AE, 0,0x8E72,0x9B9D,0x9BA0, +0x9B9F,0x8BFB, 0,0x9B9E, 0,0x9357, 0, 0, + 0, 0, 0, 0, 0, 0,0x91AE, 0, +0x936A,0x8EC6, 0, 0,0x9177,0x979A, 0, 0, + 0, 0, 0, 0,0x9BA2, 0,0x9BA3,0x93D4, + 0,0x8E52, 0, 0, 0, 0,0x9BA5, 0, + 0,0x9BA6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9BA7, 0, 0, 0, +0x8AF2,0x9BA8, 0, 0,0x9BA9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x89AA, 0, 0, 0, 0, 0, 0, +0x915A,0x8AE2, 0,0x9BAB,0x96A6, 0, 0, 0, + 0,0x91D0, 0,0x8A78, 0, 0,0x9BAD,0x9BAF, +0x8ADD, 0, 0,0x9BAC,0x9BAE, 0,0x9BB1, 0, + 0, 0, 0, 0, 0,0x9BB0, 0,0x9BB2, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9BB3, 0, 0, 0, 0, 0, 0, +0x93BB,0x8BAC, 0, 0, 0, 0, 0, 0, +0x89E3,0x9BB4,0x9BB9, 0, 0,0x9BB7, 0,0x95F5, +0x95F4, 0, 0, 0, 0, 0,0x9387, 0, + 0, 0,0x9BB6,0x8F73, 0,0x9BB5, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9092, + 0, 0, 0,0x9BBA, 0, 0,0x8DE8, 0, + 0,0x9BC0, 0, 0,0x9BC1,0x9BBB,0x8A52,0x9BBC, +0x9BC5,0x9BC4,0x9BC3,0x9BBF, 0, 0, 0,0x9BBE, + 0, 0,0x9BC2, 0, 0, 0, 0, 0, + 0,0x95F6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9BC9,0x9BC6, 0,0x9BC8, 0, +0x9792, 0,0x9BC7, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9BBD, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9093, 0, 0,0x9BCA, 0, 0,0x8DB5, + 0, 0, 0,0x9BCB, 0, 0,0x9BCC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9BCF, 0,0x9BCE, 0, 0,0x9BCD, + 0, 0, 0,0x9388,0x9BB8, 0, 0, 0, +0x9BD5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9BD1, 0, 0, + 0, 0,0x9BD0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9BD2, 0,0x9BD3, 0, + 0, 0, 0, 0, 0, 0, 0,0x9BD6, + 0, 0,0x97E4, 0,0x9BD7,0x9BD4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9BD8, 0, 0,0x8ADE,0x9BD9, 0, 0, + 0, 0,0x9BDB,0x9BDA, 0, 0,0x9BDC, 0, + 0, 0, 0,0x9BDD, 0,0x90EC,0x8F42, 0, + 0,0x8F84, 0,0x9183, 0,0x8D48,0x8DB6,0x8D49, +0x8B90, 0, 0,0x9BDE, 0, 0,0x8DB7, 0, + 0,0x8CC8,0x9BDF,0x96A4,0x9462,0x9BE0, 0,0x8D4A, + 0, 0, 0,0x8AAA, 0,0x9246,0x8BD0, 0, + 0, 0,0x8E73,0x957A, 0, 0,0x94BF, 0, + 0, 0, 0,0x9BE1,0x8AF3, 0, 0, 0, + 0,0x9BE4, 0, 0, 0, 0,0x929F, 0, + 0,0x9BE3,0x9BE2,0x9BE5, 0,0x92E9, 0, 0, + 0, 0, 0, 0, 0,0x9083, 0, 0, + 0, 0, 0,0x8E74, 0,0x90C8, 0,0x91D1, +0x8B41, 0, 0,0x92A0, 0, 0,0x9BE6,0x9BE7, +0x8FED, 0, 0, 0, 0,0x9658, 0, 0, +0x9BEA, 0, 0,0x9BE9,0x9BE8,0x959D, 0,0x9BF1, + 0, 0, 0, 0,0x9679, 0,0x9BEB, 0, + 0, 0, 0, 0,0x9BED,0x968B, 0,0x9BEC, + 0, 0, 0, 0, 0, 0, 0,0x9BEE, + 0,0x94A6,0x9BEF,0x95BC,0x9BF0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8AB1,0x95BD,0x944E,0x9BF2,0x9BF3, 0, +0x8D4B,0x8AB2,0x9BF4,0x8CB6,0x9763,0x9748,0x8AF4,0x9BF6, + 0,0x92A1, 0,0x8D4C,0x8FAF, 0, 0,0x94DD, + 0, 0,0x8FB0, 0, 0, 0, 0,0x8F98, + 0, 0, 0, 0, 0,0x92EA,0x95F7,0x9358, + 0, 0,0x8D4D, 0,0x957B, 0, 0, 0, +0x9BF7, 0, 0, 0, 0, 0,0x9378,0x8DC0, + 0, 0, 0,0x8CC9, 0,0x92EB, 0, 0, + 0, 0, 0, 0, 0,0x88C1,0x8F8E,0x8D4E, +0x9766, 0, 0, 0, 0, 0, 0, 0, + 0,0x9BF8,0x9BF9,0x9470, 0, 0, 0, 0, +0x9BFA,0x97F5,0x984C, 0, 0, 0, 0,0x9BFC, +0x9BFB, 0, 0,0x8A66, 0, 0,0x9C40, 0, + 0, 0,0x9C43,0x9C44, 0,0x9C42, 0,0x955F, +0x8FB1,0x9C46,0x9C45,0x9C41, 0, 0, 0, 0, +0x9C47,0x9C48, 0, 0,0x9C49, 0, 0, 0, +0x9C4C,0x9C4A, 0,0x9C4B,0x9C4D, 0,0x8984,0x92EC, +0x9C4E, 0,0x8C9A,0x89F4,0x9455, 0,0x9C4F,0x93F9, + 0,0x95D9, 0,0x9C50,0x984D, 0, 0, 0, + 0,0x9C51,0x95BE,0x9C54,0x989F,0x98AF, 0,0x8EAE, +0x93F3,0x9C55, 0,0x8B7C,0x92A2,0x88F8,0x9C56,0x95A4, +0x8D4F, 0, 0,0x926F, 0, 0, 0,0x92ED, + 0, 0, 0, 0, 0,0x96ED,0x8CB7,0x8CCA, + 0,0x9C57, 0, 0, 0,0x9C58, 0,0x9C5E, + 0,0x8EE3, 0, 0, 0,0x92A3, 0,0x8BAD, +0x9C59, 0, 0, 0,0x954A, 0,0x9265, 0, + 0,0x9C5A, 0, 0, 0, 0, 0, 0, +0x9C5B, 0,0x8BAE, 0,0x9C5C, 0,0x9C5D, 0, + 0,0x9C5F, 0,0x9396, 0, 0,0x9C60,0x9C61, + 0,0x9C62, 0, 0,0x9C53,0x9C52, 0, 0, + 0,0x9C63,0x8C60, 0, 0, 0,0x9546, 0, + 0,0x8DCA,0x9556,0x92A4,0x956A,0x9C64, 0, 0, +0x8FB2,0x8965, 0,0x9C65, 0, 0, 0,0x9C66, + 0,0x96F0, 0, 0,0x94DE, 0, 0,0x9C69, +0x899D,0x90AA,0x9C68,0x9C67,0x8C61,0x91D2, 0,0x9C6D, +0x9C6B, 0,0x9C6A,0x97A5,0x8CE3, 0, 0, 0, +0x8F99,0x9C6C,0x936B,0x8F5D, 0, 0, 0,0x93BE, +0x9C70,0x9C6F, 0, 0, 0, 0,0x9C6E, 0, +0x9C71,0x8CE4, 0, 0, 0, 0, 0, 0, +0x9C72,0x959C,0x8F7A, 0, 0,0x9C73,0x94F7, 0, + 0, 0, 0,0x93BF,0x92A5, 0, 0, 0, + 0,0x934F, 0, 0,0x9C74,0x8B4A, 0, 0, + 0, 0, 0,0x9053, 0,0x954B, 0, 0, + 0, 0, 0, 0,0x8AF5,0x9445, 0, 0, + 0, 0, 0, 0, 0, 0,0x9C75,0x8E75, +0x9659,0x965A, 0, 0,0x899E,0x9C7A, 0, 0, +0x9289, 0, 0, 0,0x9C77, 0, 0, 0, + 0, 0, 0,0x89F5, 0, 0, 0, 0, +0x9CAB,0x9C79, 0, 0, 0,0x944F, 0, 0, +0x9C78, 0, 0,0x9C76, 0,0x8D9A, 0,0x9C7C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9C83,0x9C89, +0x9C81, 0,0x937B, 0, 0,0x9C86,0x957C, 0, + 0,0x9C80, 0,0x9C85,0x97E5,0x8E76, 0, 0, +0x91D3,0x9C7D, 0, 0, 0,0x8B7D,0x9C88,0x90AB, +0x8985,0x9C82,0x89F6,0x9C87, 0, 0, 0,0x8BAF, + 0,0x9C84, 0, 0, 0, 0, 0, 0, + 0, 0,0x9C8A, 0, 0, 0, 0, 0, + 0,0x9C8C,0x9C96,0x9C94, 0, 0,0x9C91, 0, + 0, 0,0x9C90,0x97F6, 0,0x9C92, 0, 0, +0x8BB0, 0,0x8D50, 0, 0,0x8F9A, 0, 0, + 0,0x9C99,0x9C8B, 0, 0, 0, 0,0x9C8F, +0x9C7E, 0,0x89F8,0x9C93,0x9C95,0x9270, 0, 0, +0x8DA6,0x89B6,0x9C8D,0x9C98,0x9C97,0x8BB1, 0,0x91A7, +0x8A86, 0, 0, 0, 0,0x8C62, 0,0x9C8E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9C9A, 0,0x9C9D,0x9C9F, 0, 0, 0, + 0,0x8EBB, 0,0x9CA5,0x92EE,0x9C9B, 0, 0, + 0, 0,0x9CA3, 0,0x89F7, 0,0x9CA1,0x9CA2, + 0, 0,0x9C9E,0x9CA0, 0, 0, 0,0x8CE5, +0x9749, 0, 0,0x8AB3, 0, 0,0x8978,0x9CA4, + 0,0x9459,0x88AB, 0, 0, 0, 0, 0, + 0, 0,0x94DF,0x9C7B,0x9CAA,0x9CAE,0x96E3, 0, +0x9CA7, 0, 0, 0,0x9389,0x9CAC, 0, 0, + 0, 0, 0, 0, 0,0x8FEE,0x9CAD,0x93D5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9866, 0,0x9CA9, 0, 0, 0, 0, +0x9CAF, 0,0x8D9B, 0,0x90C9, 0, 0,0x88D2, +0x9CA8,0x9CA6, 0,0x9179, 0, 0, 0,0x9C9C, +0x8E53, 0, 0, 0, 0, 0, 0, 0, +0x91C4,0x9CBB, 0,0x917A,0x9CB6, 0,0x9CB3,0x9CB4, + 0,0x8EE4,0x9CB7,0x9CBA, 0, 0, 0, 0, +0x9CB5,0x8F44, 0,0x9CB8, 0, 0,0x9CB2, 0, +0x96FA,0x96F9, 0, 0, 0,0x9CBC,0x9CBD,0x88D3, + 0, 0, 0, 0, 0,0x9CB1, 0, 0, + 0, 0,0x8BF0,0x88A4, 0, 0, 0,0x8AB4, + 0,0x9CB9, 0, 0, 0, 0, 0,0x9CC1, +0x9CC0, 0, 0, 0,0x9CC5, 0, 0, 0, + 0, 0, 0, 0,0x9CC6, 0, 0, 0, + 0, 0, 0, 0,0x9CC4,0x9CC7,0x9CBF,0x9CC3, + 0, 0,0x9CC8, 0,0x9CC9, 0, 0,0x9CBE, +0x8E9C, 0,0x9CC2,0x91D4,0x8D51,0x9CB0,0x9054, 0, + 0, 0, 0,0x9CD6, 0,0x95E7, 0, 0, +0x9CCC,0x9CCD,0x9CCE, 0, 0,0x9CD5, 0,0x9CD4, + 0, 0,0x969D,0x8AB5, 0,0x9CD2, 0,0x8C64, +0x8A53, 0, 0,0x9CCF, 0, 0,0x97B6,0x9CD1, +0x88D4,0x9CD3, 0,0x9CCA,0x9CD0,0x9CD7,0x8C63,0x9CCB, + 0, 0, 0, 0, 0, 0,0x977C, 0, + 0, 0,0x974A, 0, 0, 0, 0,0x9CDA, + 0, 0,0x9CDE, 0, 0, 0,0x919E, 0, +0x97F7,0x9CDF, 0, 0,0x9CDC, 0,0x9CD9, 0, + 0,0x9CD8,0x9CDD, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x95AE, 0, 0,0x93B2, + 0,0x8C65, 0,0x9CE0,0x9CDB, 0,0x9CE1, 0, + 0, 0,0x8C9B, 0, 0, 0,0x89AF, 0, + 0, 0,0x9CE9, 0, 0, 0,0x8AB6, 0, + 0, 0, 0,0x9CE7, 0, 0,0x9CE8,0x8DA7, +0x9CE6,0x9CE4,0x9CE3,0x9CEA,0x9CE2,0x9CEC, 0, 0, +0x89F9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9CEE, 0, 0,0x9CED, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x92A6, 0,0x9CF1, 0,0x9CEF,0x9CE5, +0x8C9C, 0,0x9CF0, 0,0x9CF4,0x9CF3,0x9CF5,0x9CF2, +0x9CF6, 0, 0, 0, 0, 0, 0, 0, +0x9CF7,0x9CF8,0x95E8, 0,0x9CFA,0x9CF9,0x8F5E, 0, +0x90AC,0x89E4,0x89FA, 0,0x9CFB, 0,0x88BD, 0, + 0, 0,0x90CA,0x9CFC, 0,0xE6C1,0x9D40,0x8C81, + 0,0x9D41, 0, 0, 0, 0,0x90ED, 0, + 0, 0,0x9D42, 0, 0, 0,0x9D43,0x8B59, +0x9D44, 0,0x9D45,0x9D46,0x91D5, 0, 0, 0, +0x8CCB, 0, 0,0x96DF, 0, 0, 0,0x965B, +0x8F8A,0x9D47, 0, 0, 0, 0, 0,0x90EE, +0xE7BB,0x94E0, 0,0x8EE8, 0,0x8DCB,0x9D48, 0, + 0, 0, 0,0x91C5, 0,0x95A5, 0, 0, +0x91EF, 0, 0,0x9D4B, 0, 0,0x9D49, 0, +0x9D4C, 0, 0,0x9D4A, 0, 0, 0, 0, +0x9D4D, 0, 0, 0, 0, 0,0x95AF, 0, + 0,0x88B5, 0, 0, 0, 0,0x957D, 0, + 0,0x94E1, 0, 0,0x9D4E, 0,0x9D51,0x8FB3, +0x8B5A, 0,0x9D4F,0x9D56,0x8FB4, 0, 0, 0, + 0,0x9D50,0x9463, 0, 0, 0, 0, 0, + 0,0x977D,0x9D52,0x9D53,0x9D57,0x938A,0x9D54,0x8D52, +0x90DC, 0, 0,0x9D65,0x94B2, 0,0x91F0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x94E2,0x9DAB, 0, 0, 0, + 0,0x95F8, 0, 0, 0,0x92EF, 0, 0, + 0,0x9695, 0,0x9D5A,0x899F,0x928A, 0, 0, + 0, 0,0x9D63, 0, 0,0x9253,0x9D5D,0x9D64, +0x9D5F,0x9D66,0x9D62, 0,0x9D61,0x948F, 0,0x9D5B, +0x89FB,0x9D59,0x8B91,0x91F1,0x9D55, 0, 0,0x9D58, +0x8D53,0x90D9, 0,0x8FB5,0x9D60,0x9471, 0, 0, +0x8B92,0x8A67, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8A87,0x9040,0x9D68,0x9D6D, + 0,0x9D69, 0,0x8C9D, 0,0x9D6E,0x8E41,0x8D89, + 0, 0, 0, 0, 0, 0,0x8F45,0x9D5C, + 0,0x8E9D,0x9D6B, 0, 0, 0, 0,0x8E77, +0x9D6C,0x88C2, 0, 0,0x9D67, 0, 0, 0, + 0,0x92A7, 0, 0, 0, 0, 0, 0, + 0,0x8B93, 0, 0, 0, 0, 0,0x8BB2, + 0, 0, 0, 0, 0, 0, 0,0x9D6A, +0x88A5, 0, 0,0x8DC1, 0, 0, 0,0x9055, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x92F0, 0, 0,0x94D2,0x9D70,0x917D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x91A8, 0, 0,0x8E4A,0x9D71, 0,0x9D73, +0x9D6F, 0, 0, 0, 0,0x95DF, 0,0x92BB, + 0, 0, 0, 0,0x917B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x95F9, +0x8ECC,0x9D80, 0,0x9D7E, 0, 0,0x9098, 0, + 0, 0,0x8C9E, 0, 0, 0,0x9D78,0x8FB7, + 0, 0,0x93E6,0x9450, 0, 0, 0, 0, +0x9D76, 0, 0,0x917C, 0, 0, 0, 0, +0x8EF6,0x9D7B, 0, 0,0x8FB6, 0,0x9D75,0x9D7A, + 0, 0,0x9472, 0, 0, 0,0x9D74, 0, +0x8C40, 0, 0,0x8A7C, 0, 0, 0,0x9D7C, +0x97A9,0x8DCC,0x9254,0x9D79, 0,0x90DA, 0,0x8D54, +0x9084,0x8986,0x915B,0x9D77,0x8B64, 0, 0, 0, + 0, 0,0x8C66, 0,0x92CD,0x9D7D, 0, 0, + 0, 0, 0,0x917E, 0, 0,0x9D81, 0, +0x9D83, 0, 0,0x91B5,0x9D89, 0,0x9D84, 0, + 0,0x9D86, 0, 0, 0, 0, 0,0x9560, +0x92F1, 0,0x9D87, 0, 0, 0,0x974B, 0, + 0, 0,0x9767,0x8AB7, 0, 0, 0, 0, + 0,0x88AC, 0,0x9D85, 0, 0, 0, 0, + 0,0x9D82, 0, 0, 0, 0,0x8AF6, 0, + 0, 0, 0, 0,0x8987, 0,0x9D88, 0, + 0, 0,0x9768, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9D8C, 0, + 0, 0, 0, 0, 0,0x91B9, 0,0x9D93, + 0, 0, 0,0x9D8D, 0, 0,0x9D8A,0x9D91, + 0, 0, 0, 0,0x9D72, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9D8E, 0, +0x9D92, 0, 0, 0,0x94C0,0x938B, 0, 0, + 0, 0, 0, 0,0x9D8B, 0,0x9D8F, 0, + 0, 0,0x8C67, 0, 0, 0,0x8DEF, 0, + 0, 0,0x90DB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9D97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9345, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9D94, + 0,0x9680, 0, 0, 0, 0, 0,0x9D95, + 0, 0, 0, 0, 0, 0,0x9D96, 0, +0x96CC, 0,0x90A0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8C82, 0, 0, 0, 0, +0x9D9D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8E54,0x9D9A, 0,0x9D99, 0, 0, + 0, 0,0x9451, 0, 0, 0,0x93B3, 0, + 0, 0, 0, 0,0x9350,0x9D9B, 0, 0, + 0,0x9D9C, 0,0x958F, 0,0x9464,0x8E42, 0, +0x90EF, 0,0x966F, 0, 0, 0, 0, 0, + 0,0x8A68, 0,0x9DA3,0x9D9E, 0, 0, 0, + 0,0x9769,0x9DA5, 0, 0,0x9DA1, 0,0x9DA2, + 0, 0, 0, 0, 0,0x9180, 0, 0, + 0, 0,0x9DA0, 0,0x9D5E, 0, 0, 0, +0x9DA4, 0,0x9D9F, 0, 0, 0, 0, 0, +0x9DA9,0x9DAA,0x9346,0x9DAC, 0, 0,0x8E43,0x9DA7, + 0, 0, 0, 0,0x8B5B, 0, 0,0x9DAD, + 0,0x9DA6,0x9DB1, 0,0x9DB0, 0,0x9DAF, 0, + 0, 0,0x9DB2, 0, 0,0x9DB4,0x8FEF, 0, +0x9DB3, 0, 0, 0, 0,0x9DB7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9DB5, 0, 0, 0,0x9DB6,0x9D90, 0, 0, + 0, 0, 0,0x9DB9,0x9DB8, 0, 0, 0, + 0, 0,0x9D98,0x9DBA,0x9DAE, 0, 0,0x8E78, + 0, 0, 0, 0,0x9DBB,0x9DBC,0x9DBE,0x9DBD, +0x9DBF,0x89FC, 0,0x8D55, 0, 0,0x95FA,0x90AD, + 0, 0, 0, 0, 0,0x8CCC, 0, 0, +0x9DC1, 0, 0, 0, 0,0x9DC4, 0,0x9571, + 0,0x8B7E, 0, 0, 0,0x9DC3,0x9DC2,0x9473, +0x9DC5,0x8BB3, 0, 0, 0,0x9DC7,0x9DC6, 0, + 0, 0,0x8AB8,0x8E55, 0, 0,0x93D6, 0, + 0, 0, 0, 0,0x8C68, 0, 0, 0, +0x9094, 0,0x9DC8, 0,0x90AE,0x9347, 0,0x957E, +0x9DC9, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9DCA,0x9DCB, 0, 0, 0,0x95B6, +0x9B7C,0x90C4, 0, 0,0x956B, 0,0x8DD6, 0, +0x94E3,0x94C1, 0, 0, 0, 0, 0,0x936C, + 0,0x97BF, 0,0x9DCD,0x8ECE, 0, 0,0x9DCE, + 0,0x88B4, 0, 0,0x8BD2,0x90CB, 0,0x9580, + 0, 0, 0,0x9DCF,0x8E61,0x9266, 0,0x8E7A, +0x9056, 0, 0, 0, 0, 0, 0,0x9DD0, + 0,0x95FB, 0, 0,0x8997,0x8E7B, 0, 0, + 0,0x9DD3, 0,0x9DD1,0x9DD4,0x97B7,0x9DD2, 0, + 0, 0, 0,0x90F9,0x9DD5, 0, 0,0x91B0, + 0, 0,0x9DD6, 0, 0, 0, 0,0x8AF8, + 0,0x9DD8, 0,0x9DD7, 0, 0, 0, 0, +0x9DD9,0x9DDA,0x8AF9, 0, 0,0x93FA,0x9255,0x8B8C, +0x8E7C,0x9181, 0, 0,0x8F7B,0x88AE, 0, 0, + 0,0x9DDB, 0, 0, 0, 0, 0, 0, + 0, 0,0x89A0,0x9DDF, 0, 0, 0, 0, + 0, 0,0x8D56,0x9DDE, 0, 0,0x8DA9,0x8FB8, + 0, 0,0x9DDD, 0,0x8FB9, 0,0x96BE,0x8DA8, + 0, 0, 0,0x88D5,0x90CC, 0, 0, 0, + 0, 0, 0, 0,0x9DE4, 0, 0,0x90AF, +0x8966, 0, 0, 0, 0,0x8F74, 0,0x9686, +0x8DF0, 0, 0, 0, 0,0x8FBA, 0,0x90A5, + 0, 0, 0, 0,0x9DE3,0x9DE1,0x9DE2, 0, + 0, 0, 0, 0,0x928B, 0, 0,0x9E45, + 0,0x9DE8,0x8E9E,0x8D57,0x9DE6, 0, 0, 0, + 0,0x9DE7, 0,0x9057, 0, 0, 0,0x9DE5, + 0, 0,0x8E4E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9DEA,0x9DE9,0x9DEE, + 0, 0,0x9DEF, 0,0x9DEB, 0,0x8A41,0x9DEC, +0x9DED,0x94D3, 0, 0, 0, 0,0x9581,0x8C69, +0x9DF0, 0, 0, 0,0x90B0, 0,0x8FBB, 0, + 0, 0,0x9271, 0, 0, 0, 0, 0, + 0,0x8BC5, 0,0x9DF1,0x9DF5, 0, 0,0x89C9, +0x9DF2,0x9DF4, 0, 0, 0, 0,0x9DF3, 0, + 0,0x8F8B, 0, 0, 0, 0,0x9267,0x88C3, +0x9DF6, 0, 0, 0, 0,0x9DF7, 0, 0, + 0, 0,0x92A8, 0, 0, 0,0x97EF, 0, + 0, 0, 0,0x8E62, 0, 0,0x95E9, 0, + 0, 0, 0, 0,0x965C, 0, 0, 0, +0x9E41,0x9DF9, 0, 0,0x9DFC, 0,0x9DFB, 0, + 0,0x9DF8, 0, 0,0x9E40, 0, 0,0x93DC, + 0,0x9DFA, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9E42, 0, + 0,0x8F8C,0x9E43, 0,0x976A,0x9498, 0, 0, +0x9E44, 0, 0, 0, 0, 0,0x9E46, 0, + 0,0x9E47, 0, 0, 0, 0, 0, 0, +0x9E48, 0,0x8BC8,0x8967,0x8D58,0x9E49, 0,0x9E4A, +0x8F91,0x9182, 0, 0,0x99D6,0x915D,0x915C,0x91D6, +0x8DC5, 0, 0,0x98F0, 0, 0, 0, 0, +0x8C8E,0x974C, 0,0x95FC, 0,0x959E, 0,0x9E4B, + 0, 0, 0, 0,0x8DF1,0x92BD,0x9E4C,0x984E, + 0, 0, 0,0x965D, 0,0x92A9,0x9E4D,0x8AFA, + 0, 0, 0, 0, 0, 0,0x9E4E,0x9E4F, +0x96D8, 0,0x96A2,0x9696,0x967B,0x8E44,0x9E51, 0, + 0,0x8EE9, 0, 0,0x9670, 0,0x9E53,0x9E56, +0x9E55, 0,0x8AF7, 0, 0,0x8B80, 0,0x9E52, + 0,0x9E54, 0, 0, 0, 0,0x9E57, 0, + 0,0x9099, 0, 0, 0, 0,0x979B,0x88C7, +0x8DDE,0x91BA, 0,0x8EDB, 0, 0,0x8FF1, 0, + 0,0x9E5A, 0, 0,0x936D, 0,0x9E58,0x91A9, +0x9E59,0x8FF0,0x96DB,0x9E5B,0x9E5C,0x9788, 0, 0, + 0, 0,0x9E61, 0, 0,0x8D59, 0,0x9474, +0x9E5E,0x938C,0x9DDC,0x9DE0, 0,0x8B6E, 0,0x9466, + 0, 0, 0, 0,0x9E60, 0,0x8FBC,0x94C2, + 0, 0, 0, 0, 0,0x9E66, 0,0x94F8, + 0,0x9E5D, 0,0x9E63,0x9E62, 0, 0, 0, +0x90CD, 0, 0, 0, 0,0x968D, 0,0x97D1, + 0, 0,0x9687, 0,0x89CA,0x8E7D, 0, 0, +0x9867,0x9E65,0x9095, 0, 0, 0,0x9E64, 0, + 0,0x9E5F, 0, 0, 0, 0, 0,0x8CCD, + 0, 0, 0,0x9E6B,0x9E69, 0,0x89CB,0x9E67, +0x9E6D,0x9E73, 0, 0, 0, 0, 0, 0, + 0,0x91C6, 0, 0,0x95BF, 0,0x9E75, 0, + 0, 0,0x9541, 0, 0, 0,0x9E74,0x9490, +0x965E,0x8AB9, 0,0x90F5,0x8F5F, 0, 0, 0, +0x92D1, 0,0x974D, 0, 0,0x9E70,0x9E6F, 0, + 0, 0,0x9E71, 0,0x9E6E, 0, 0,0x9E76, + 0,0x9E6C, 0, 0,0x9E6A, 0,0x9E72,0x9E68, + 0,0x928C, 0,0x96F6,0x8EC4,0x8DF2, 0, 0, + 0, 0, 0,0x8DB8, 0, 0,0x968F,0x8A60, + 0, 0,0x92CC,0x93C8,0x8968, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x90F0, 0, 0,0x90B2,0x8C49, + 0, 0, 0, 0, 0, 0,0x9E78, 0, + 0,0x8D5A,0x8A9C, 0, 0, 0, 0, 0, + 0,0x9E7A,0x8A94,0x9E81, 0, 0, 0, 0, + 0, 0,0x9E7D, 0,0x90F1, 0, 0, 0, +0x8A6A,0x8DAA, 0, 0,0x8A69,0x8DCD, 0, 0, +0x9E7B,0x8C85,0x8C6A,0x938D, 0, 0,0x9E79, 0, +0x88C4, 0, 0, 0, 0,0x9E7C,0x9E7E, 0, +0x8BCB,0x8C4B, 0,0x8ABA,0x8B6A, 0, 0, 0, + 0,0x9E82, 0, 0,0x8DF7,0x9691, 0,0x8E56, + 0, 0, 0,0x9E83, 0, 0, 0,0x954F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9E8F, 0,0x89B1,0x9E84, + 0, 0, 0, 0, 0, 0,0x9E95,0x9E85, + 0,0x97C0, 0,0x9E8C, 0,0x947E, 0, 0, + 0, 0, 0, 0, 0,0x9E94, 0,0x9E87, + 0, 0, 0,0x88B2,0x9E89, 0, 0,0x8D5B, + 0, 0, 0,0x9E8B, 0,0x9E8A, 0,0x9E86, +0x9E91, 0,0x8FBD, 0, 0, 0,0x9AEB,0x8CE6, +0x979C, 0, 0, 0, 0,0x9E88, 0,0x92F2, +0x8A42,0x8DAB, 0,0x9E80, 0,0x9E90,0x8A81, 0, + 0,0x9E8E,0x9E92, 0,0x938E, 0, 0, 0, + 0, 0, 0, 0,0x8AFC, 0,0x9EB0, 0, + 0,0x96C7,0x9E97,0x8AFB, 0,0x9E9E, 0, 0, + 0, 0,0x965F, 0,0x9E9F,0x9EA1, 0,0x9EA5, +0x9E99, 0,0x9249, 0, 0, 0, 0,0x938F, +0x9EA9,0x9E9C, 0,0x9EA6, 0, 0, 0,0x9EA0, + 0, 0, 0, 0, 0, 0,0x9058,0x9EAA, + 0, 0,0x90B1, 0, 0, 0, 0, 0, + 0,0x9EA8,0x8ABB, 0, 0, 0, 0, 0, +0x986F,0x9E96, 0, 0,0x9EA4,0x88D6, 0, 0, +0x9E98, 0, 0,0x96B8,0x9E9D,0x9041,0x92C5,0x9E93, + 0, 0,0x9EA3, 0, 0, 0, 0, 0, + 0,0x909A,0x9EAD,0x8A91,0x8C9F, 0, 0, 0, + 0,0x9EAF,0x9E9A,0x9EAE, 0,0x9EA7,0x9E9B, 0, +0x9EAB, 0,0x9EAC, 0, 0, 0, 0, 0, +0x9EBD, 0, 0, 0,0x93CC, 0,0x9EA2, 0, + 0,0x9EB9, 0, 0, 0,0x9EBB, 0,0x92D6, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x976B, 0, 0, 0, 0, 0, + 0, 0, 0,0x9596,0x9EB6,0x91C8, 0, 0, + 0,0x9EBC,0x915E, 0,0x9EB3,0x9EC0,0x9EBF, 0, +0x93ED,0x9EBE,0x93E8, 0, 0, 0, 0, 0, + 0, 0,0x9EC2,0x9EB5, 0,0x8BC6,0x9EB8,0x8F7C, + 0, 0, 0,0x9480,0x9EBA,0x8BC9, 0,0x9EB2, +0x9EB4,0x9EB1, 0, 0,0x984F,0x8A79,0x9EB7, 0, + 0,0x9EC1,0x8A54, 0, 0, 0, 0, 0, + 0, 0,0x8DE5, 0, 0, 0,0x897C, 0, + 0,0x9ED2, 0, 0,0x9850,0x9ED5, 0, 0, + 0, 0, 0,0x9059,0x9ED4, 0, 0, 0, +0x9ED3, 0, 0, 0, 0, 0, 0,0x9ED0, + 0, 0, 0, 0, 0, 0,0x9EC4, 0, + 0,0x9EE1,0x9EC3, 0,0x9ED6, 0, 0, 0, + 0, 0, 0,0x9ECE, 0, 0,0x9EC9,0x9EC6, + 0,0x9EC7, 0,0x9ECF, 0, 0, 0,0xEAA0, + 0, 0,0x9ECC,0x8D5C,0x92C6,0x9184,0x9ECA, 0, +0x9EC5, 0, 0,0x9EC8, 0, 0, 0, 0, +0x976C,0x968A, 0, 0, 0,0x9ECD,0x9ED7, 0, + 0, 0, 0, 0, 0, 0, 0,0x9EDF, +0x9ED8, 0, 0,0x9EE5, 0,0x9EE3, 0, 0, + 0, 0,0x9EDE, 0, 0, 0, 0, 0, + 0,0x9EDD, 0,0x92CE, 0,0x9185, 0,0x9EDB, + 0, 0,0x9ED9, 0, 0,0x9EE0, 0, 0, + 0, 0,0x9EE6,0x94F3,0x9EEC, 0, 0, 0, + 0, 0,0x9EE7,0x9EEA,0x9EE4, 0, 0,0x9294, + 0,0x9557, 0,0x9EDA, 0, 0,0x9EE2,0x8FBE, + 0,0x96CD,0x9EF6,0x9EE9, 0, 0, 0, 0, + 0,0x8CA0,0x89A1,0x8A7E, 0, 0,0x9ED1, 0, + 0, 0, 0, 0, 0,0x8FBF,0x9EEE, 0, +0x9EF5,0x8EF7,0x8A92, 0, 0,0x924D, 0, 0, + 0, 0, 0, 0,0x9EEB, 0, 0,0x9EF0, +0x9EF4, 0, 0,0x8BB4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B6B,0x9EF2, 0, 0, 0, 0, 0,0x8B40, + 0,0x93C9,0x9EF1, 0, 0, 0,0x9EF3, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9EED, 0, 0, 0, 0, 0, +0x9EEF, 0, 0, 0, 0, 0, 0,0x8A80, +0x9268, 0, 0, 0,0x9EFA, 0, 0, 0, + 0, 0, 0, 0, 0,0x9EF8,0x8CE7, 0, +0x9EF7, 0, 0, 0, 0, 0, 0,0x9F40, + 0, 0, 0, 0,0x9E77, 0, 0, 0, +0x9EF9, 0,0x9EFB,0x9EFC, 0, 0, 0, 0, + 0, 0,0x9F4B, 0,0x9F47, 0,0x9E8D, 0, + 0, 0, 0,0x9F46, 0, 0, 0, 0, +0x9F45, 0, 0,0x9F42, 0, 0, 0, 0, + 0,0x9EE8,0x9F44,0x9F43, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9F49, 0,0x9845, 0, 0, 0, 0, + 0, 0,0x9F4C,0x8BF9, 0, 0,0x9F48,0x9F4A, + 0, 0, 0, 0, 0, 0, 0, 0, +0x94A5, 0,0x9F4D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9F51,0x9F4E, 0, 0, 0, 0, + 0, 0, 0, 0,0x9793,0x9F4F, 0, 0, + 0, 0,0x9EDC, 0, 0, 0, 0, 0, + 0, 0,0x9F52, 0, 0, 0,0x9F53, 0, + 0, 0, 0, 0, 0,0x8954, 0,0x9F55, +0x8C87,0x8E9F, 0,0x8BD3, 0, 0, 0,0x89A2, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x977E, 0, 0, 0, 0,0x9F57, +0x9F56,0x9F59,0x8B5C, 0, 0,0x8BD4,0x8ABC, 0, + 0, 0, 0,0x9F5C, 0, 0, 0,0x9F5B, + 0,0x9F5D, 0, 0,0x89CC, 0,0x9256, 0, +0x9F5E, 0, 0,0x8ABD,0x9F60, 0, 0, 0, + 0,0x9F5F, 0,0x9F61, 0, 0, 0,0x9F62, + 0,0x9F63,0x8E7E,0x90B3,0x8D9F, 0,0x9590, 0, + 0,0x95E0,0x9863, 0, 0, 0, 0,0x8E95, + 0, 0, 0,0x8DCE,0x97F0, 0, 0, 0, +0x9F64,0x9F65, 0,0x8E80, 0, 0, 0,0x9F66, +0x9F67, 0, 0,0x9F69,0x9F68, 0,0x9677, 0, + 0,0x8F7D,0x8EEA,0x8E63, 0,0x9F6A, 0, 0, + 0, 0, 0, 0, 0,0x9F6C,0x9042, 0, +0x9F6B, 0, 0, 0, 0, 0,0x9F6D, 0, + 0, 0, 0, 0,0x9F6E, 0, 0, 0, + 0, 0,0x9F6F,0x9F70, 0, 0, 0,0x9F71, + 0,0x9F73,0x9F72,0x9F74,0x89A3,0x9269, 0,0x9F75, + 0, 0,0x8E45,0x8A6B,0x9F76, 0, 0,0x9361, +0x9ACA, 0, 0, 0, 0,0x8B42,0x9F77, 0, + 0, 0, 0,0x9F78, 0,0x95EA,0x9688, 0, + 0, 0,0x93C5,0x9F79,0x94E4, 0, 0, 0, +0x94F9, 0, 0,0x96D1, 0, 0, 0,0x9F7A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9F7C,0x9F7B, 0, 0,0x9F7E, + 0, 0, 0,0x9F7D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9F81, 0, 0, 0, 0, 0, 0,0x8E81, + 0,0x96AF, 0,0x9F82,0x9F83, 0, 0,0x8B43, + 0, 0, 0,0x9F84, 0, 0, 0, 0, + 0, 0, 0,0x9F86,0x9F85, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9085, 0, 0,0x9558, +0x8969, 0, 0, 0, 0, 0,0x94C3, 0, +0x92F3,0x8F60,0x8B81, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x94C4, 0, +0x8EAC, 0, 0, 0, 0,0x9F88, 0,0x8ABE, + 0, 0,0x8998, 0, 0,0x93F0,0x9F87,0x8D5D, +0x9272, 0,0x9F89, 0, 0, 0, 0, 0, +0x9F91, 0,0x9F8A, 0, 0, 0, 0, 0, +0x91BF, 0,0x8B82,0x9F92, 0, 0, 0, 0, + 0, 0,0x8C88, 0, 0,0x8B44,0x9F90, 0, + 0,0x9F8E,0x9F8B,0x9780, 0, 0, 0, 0, +0x92BE, 0, 0, 0,0x93D7,0x9F8C, 0, 0, +0x9F94, 0,0x9F93,0x8C42, 0, 0,0x89AB, 0, + 0,0x8DB9,0x9F8D,0x9F8F, 0, 0, 0, 0, + 0,0x9676,0x91F2, 0, 0, 0, 0, 0, + 0, 0, 0,0x9697, 0, 0,0x9F9C, 0, + 0,0x9F9D, 0,0x89CD, 0, 0, 0, 0, +0x95A6,0x96FB,0x9F9F,0x8EA1,0x8FC0,0x9F98,0x9F9E,0x8988, + 0,0x8BB5, 0, 0,0x9F95,0x9F9A, 0, 0, + 0,0x90F2,0x9491, 0,0x94E5, 0, 0, 0, + 0, 0, 0,0x9F97, 0,0x9640, 0,0x9F99, + 0,0x9FA2, 0,0x9FA0, 0,0x9F9B, 0, 0, + 0,0x9641,0x9467,0x8B83, 0,0x9344, 0, 0, +0x928D, 0,0x9FA3, 0, 0, 0, 0,0x9FA1, +0x91D7,0x9F96, 0,0x896A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x976D,0x9FAE, 0, 0, 0, + 0, 0,0x9FAD, 0, 0, 0, 0,0x90F4, + 0,0x9FAA, 0,0x978C, 0, 0,0x93B4,0x9FA4, + 0, 0, 0, 0, 0,0x92C3, 0, 0, + 0,0x896B,0x8D5E,0x9FA7, 0, 0, 0, 0, + 0, 0,0x8F46,0x9FAC, 0,0x9FAB,0x9FA6, 0, +0x9FA9, 0, 0,0x8A88, 0,0x9FA8,0x9468, 0, + 0,0x97AC, 0, 0,0x8FF2,0x90F3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9FB4,0x9FB2, 0,0x956C, 0, 0, 0, + 0, 0, 0,0x9FAF,0x9FB1, 0,0x8959, 0, + 0,0x8D5F,0x9851, 0,0x8A5C, 0,0x9582, 0, + 0, 0, 0, 0,0x9781, 0, 0,0x8A43, +0x905A,0x9FB3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9FB8, 0, 0, +0x8FC1, 0, 0, 0,0x974F, 0,0x9FB5, 0, + 0, 0, 0,0x9FB0, 0,0x9FB6, 0, 0, + 0,0x97DC, 0,0x9393,0x93C0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8A55, + 0, 0,0x8974, 0, 0,0x9FBC, 0, 0, +0x9FBF, 0, 0, 0,0x97C1, 0, 0, 0, +0x9784, 0, 0, 0, 0,0x9FC6,0x9FC0,0x9FBD, + 0, 0, 0,0x97D2,0x9FC3, 0, 0, 0, + 0,0x8F69,0x9FC5, 0, 0,0x9FCA, 0, 0, +0x9391,0x9FC8, 0, 0, 0, 0,0x9FC2, 0, + 0,0x9257, 0, 0,0x9FC9, 0,0x9FBE, 0, +0x9FC4, 0,0x9FCB,0x88FA,0x9FC1, 0,0x9FCC, 0, + 0,0x905B, 0,0x8F7E, 0,0x95A3, 0,0x8DAC, + 0,0x9FB9,0x9FC7,0x9359, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x90B4, 0,0x8A89, +0x8DCF,0x8FC2,0x9FBB,0x8F61, 0, 0, 0, 0, + 0, 0, 0,0x8C6B, 0,0x9FBA, 0, 0, + 0,0x9FD0,0x8F8D,0x8CB8, 0,0x9FDF, 0,0x9FD9, +0x8B94,0x936E, 0,0x9FD4,0x9FDD,0x88AD,0x8951, 0, + 0,0x89B7, 0,0x9FD6,0x91AA,0x9FCD,0x9FCF,0x8D60, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9FE0, 0,0x9FDB, 0, 0, 0,0x9FD3, 0, + 0, 0, 0,0x9FDA, 0, 0, 0, 0, + 0, 0,0x96A9, 0, 0,0x9FD8,0x9FDC, 0, + 0, 0, 0, 0, 0, 0,0x8CCE, 0, +0x8FC3, 0, 0,0x9258, 0, 0, 0,0x9FD2, + 0, 0, 0, 0, 0, 0, 0,0x974E, + 0, 0, 0,0x9FD5, 0, 0,0x9FCE,0x9392, + 0, 0,0x9FD1, 0, 0, 0,0x9FD7, 0, + 0, 0, 0, 0, 0, 0,0x9870,0x8EBC, +0x969E, 0,0x9FE1, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x94AC, 0, 0,0x9FED, +0x8CB9, 0, 0, 0, 0, 0,0x8F80, 0, +0x9FE3, 0, 0, 0,0x97AD,0x8D61, 0,0x9FF0, + 0, 0,0x88EC, 0, 0,0x9FEE, 0, 0, + 0, 0,0x9FE2, 0, 0, 0, 0,0x9FE8, + 0, 0,0x9FEA, 0, 0, 0,0x976E,0x9FE5, + 0, 0,0x934D, 0, 0,0x9FE7, 0, 0, + 0, 0,0x9FEF, 0,0x9FE9,0x96C5, 0, 0, + 0,0x9FE4, 0,0x8EA0,0x9FFC, 0, 0, 0, + 0,0x8A8A, 0,0x9FE6,0x9FEB,0x9FEC, 0, 0, + 0, 0, 0, 0, 0,0x91EA,0x91D8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9FF4, 0, 0,0x9FFA, + 0, 0,0x9FF8, 0,0x9348, 0, 0,0xE042, +0x9FF5, 0, 0, 0, 0, 0,0x9FF6,0x9FDE, + 0,0x8B99,0x9559, 0, 0, 0,0x8EBD, 0, + 0,0x8D97, 0, 0, 0, 0, 0,0x9852, + 0,0x9FF2, 0,0xE041,0x8989,0x9186, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9499, 0,0x8ABF,0x97F8, 0, 0, 0, 0, + 0, 0, 0,0x969F,0x92D0, 0, 0, 0, + 0,0x9FF9,0x9FFB, 0, 0, 0, 0, 0, +0x9151, 0, 0, 0, 0, 0,0xE040,0x9FF7, + 0,0x9FF1, 0, 0, 0,0x8AC1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8C89, 0, 0, 0, +0xE04E, 0, 0,0xE049,0x90F6, 0, 0,0x8A83, + 0, 0, 0, 0,0x8F81, 0,0xE052, 0, + 0, 0, 0, 0, 0,0xE04B,0x92AA,0xE048, +0x92D7, 0, 0, 0,0xE06B, 0, 0, 0, +0xE045, 0,0xE044, 0,0xE04D, 0, 0, 0, +0xE047,0xE046,0xE04C, 0,0x909F, 0,0xE043, 0, + 0, 0, 0, 0, 0, 0,0xE04F, 0, + 0,0xE050, 0, 0, 0, 0, 0,0x8AC0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE055, 0,0xE054,0xE056, 0, 0, 0, + 0, 0,0xE059, 0, 0, 0, 0, 0, + 0,0x9362, 0,0xE053, 0, 0, 0, 0, + 0,0xE057, 0, 0, 0, 0, 0, 0, +0x8C83,0x91F7,0xE051,0x945A, 0, 0,0xE058, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE05D,0xE05B, 0, 0, +0xE05E, 0, 0,0xE061, 0, 0, 0,0xE05A, +0x8D8A,0x9447, 0, 0,0x9FB7, 0, 0, 0, + 0, 0, 0,0x9794,0xE05C, 0,0xE060,0x91F3, + 0,0xE05F, 0,0xE04A, 0, 0,0xE889, 0, + 0, 0,0xE064, 0, 0, 0,0xE068, 0, + 0,0xE066, 0, 0, 0, 0, 0, 0, + 0,0xE062, 0,0xE063, 0, 0, 0,0xE067, + 0,0xE065, 0, 0, 0,0x956D, 0, 0, +0xE06D, 0,0xE06A,0xE069, 0,0xE06C,0x93D2,0xE06E, + 0, 0, 0, 0, 0, 0,0x9295,0x91EB, + 0, 0, 0, 0,0x90A3, 0, 0, 0, +0xE06F, 0,0xE071, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE070, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9FF3, 0, 0, 0, + 0,0xE072, 0, 0, 0, 0, 0, 0, +0x93E5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE073, 0, 0, 0, 0, + 0, 0, 0,0x89CE, 0, 0, 0,0x9394, +0x8A44, 0, 0, 0, 0, 0, 0, 0, +0x8B84, 0, 0, 0,0x8EDC,0x8DD0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9846,0x9086, 0, 0, 0,0x898A, 0, + 0, 0,0xE075, 0, 0, 0, 0, 0, + 0,0xE074, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE078,0x9259,0xE07B,0xE076, + 0, 0, 0,0xE07A, 0, 0, 0, 0, +0xE079,0x935F,0x88D7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x97F3, 0, 0,0xE07D, 0, 0, 0,0x8947, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE080, 0, 0, 0,0xE07E, 0,0xE07C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE077, 0, 0, 0, 0, 0, 0, + 0,0x9642, 0, 0, 0,0xE082, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE081, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x898B, 0, 0, 0, + 0,0xE084,0x95B0, 0,0xE083, 0, 0, 0, + 0,0x96B3, 0, 0, 0, 0,0x8FC5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9152, 0, + 0, 0, 0, 0,0x8FC4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x97F9, 0, 0,0xE08A, 0,0x90F7, 0, + 0, 0, 0, 0, 0,0xE086,0xE08B, 0, + 0,0x898C, 0, 0, 0, 0, 0, 0, + 0, 0,0xE089, 0,0x9481,0xE085,0xE088,0x8FC6, + 0,0x94CF, 0, 0,0xE08C, 0,0x8ECF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x90F8, 0, 0, + 0, 0, 0, 0,0xE08F, 0, 0, 0, +0xE087, 0,0x8C46, 0, 0, 0, 0,0xE08D, + 0, 0, 0, 0,0x976F,0xE090, 0, 0, + 0,0xEAA4, 0, 0, 0, 0, 0,0x8F6E, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE091, 0, 0, 0,0xE092, 0, 0, 0, + 0,0x944D, 0, 0, 0, 0, 0, 0, + 0,0xE094, 0, 0, 0, 0,0xE095, 0, + 0, 0, 0,0x9452, 0, 0, 0, 0, +0x9395,0xE097, 0, 0, 0, 0,0xE099, 0, +0x97D3, 0,0xE096, 0,0xE098,0x898D, 0,0xE093, + 0, 0, 0, 0, 0, 0, 0,0x9A7A, +0xE09A, 0, 0, 0, 0,0x9187,0x8E57,0xE09C, + 0, 0, 0, 0,0xE09B,0x9043,0x99D7, 0, + 0, 0, 0, 0, 0,0xE09D, 0, 0, + 0,0xE09F, 0,0xE08E,0xE09E, 0, 0,0xE0A0, + 0, 0, 0, 0, 0, 0,0x949A, 0, + 0, 0, 0, 0, 0,0xE0A1, 0, 0, +0xE0A2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE0A3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE0A4, 0,0x92DC, 0,0xE0A6,0xE0A5, 0, 0, +0xE0A7, 0,0xE0A8, 0, 0,0x8EDD,0x9583, 0, + 0, 0,0x96EA,0xE0A9,0xE0AA,0x9175,0x8EA2,0xE0AB, +0xE0AC, 0, 0, 0, 0, 0,0xE0AD,0x95D0, +0x94C5, 0, 0,0xE0AE,0x9476, 0, 0, 0, + 0, 0,0x92AB, 0, 0, 0, 0, 0, +0xE0AF,0x89E5, 0,0x8B8D, 0,0x96C4, 0,0x96B4, + 0,0x89B2,0x9853, 0, 0, 0, 0,0x9671, + 0,0x95A8, 0, 0, 0, 0, 0, 0, + 0, 0,0x90B5, 0,0xE0B0, 0, 0, 0, + 0,0x93C1, 0, 0, 0,0x8CA1,0xE0B1, 0, +0x8DD2,0xE0B3,0xE0B2, 0, 0, 0, 0,0xE0B4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE0B5, 0, 0, 0,0xE0B6, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8B5D, 0,0xE0B7, 0, 0, 0, 0,0xE0B8, + 0, 0, 0, 0,0x8CA2, 0, 0,0x94C6, + 0, 0,0xE0BA, 0, 0, 0,0x8FF3, 0, + 0,0xE0B9, 0, 0, 0, 0, 0, 0, + 0, 0,0x8BB6,0xE0BB,0xE0BD, 0,0xE0BC, 0, + 0, 0, 0, 0, 0, 0,0xE0BE, 0, +0x8CCF, 0,0xE0BF, 0, 0, 0, 0,0x8BE7, + 0,0x915F, 0,0x8D9D, 0, 0, 0, 0, +0xE0C1,0xE0C2,0xE0C0, 0, 0, 0, 0, 0, + 0,0x8EEB, 0, 0,0x93C6,0x8BB7, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE0C4, +0x924B,0xE0C3, 0, 0,0x9854,0x9482, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE0C7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0C9,0xE0C6, + 0, 0, 0,0x96D2,0xE0C8,0xE0CA, 0,0x97C2, + 0, 0, 0, 0, 0,0xE0CE, 0, 0, + 0,0xE0CD,0x9296,0x944C, 0, 0,0x8CA3,0xE0CC, + 0, 0, 0, 0,0xE0CB, 0,0x9750,0x9751, + 0, 0, 0, 0, 0, 0,0xE0CF,0x898E, + 0, 0, 0, 0,0x8D96,0x8E82, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0D0,0xE0D1, + 0, 0, 0, 0, 0, 0, 0,0xE0D3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8F62, 0, 0, 0, 0, +0xE0D5, 0,0xE0D4, 0, 0, 0, 0, 0, +0xE0D6, 0,0x8A6C, 0, 0,0xE0D8, 0, 0, +0xE0D7, 0,0xE0DA,0xE0D9, 0, 0, 0, 0, + 0, 0, 0, 0,0x8CBA, 0, 0,0x97A6, + 0,0x8BCA, 0,0x89A4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8BE8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8ADF, 0, 0, 0, 0, 0, 0, + 0, 0,0x97E6,0xE0DC, 0, 0, 0, 0, + 0, 0, 0,0xE0DE, 0, 0, 0, 0, +0xE0DF, 0,0x89CF, 0, 0, 0, 0, 0, +0xE0DB, 0,0x8E58, 0, 0,0x92BF,0xE0DD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0E2, 0, +0x8EEC, 0, 0, 0, 0,0xE0E0, 0, 0, + 0, 0,0x8C5D, 0, 0,0x94C7,0xE0E1, 0, + 0,0xE0FC, 0, 0, 0, 0, 0, 0, +0xE0E7, 0, 0, 0, 0, 0,0x8CBB, 0, + 0, 0, 0,0x8B85, 0,0xE0E4,0x979D, 0, + 0,0x97AE, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x91F4, 0, 0,0xE0E6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE0E8,0x97D4,0x8BD5,0x94FA,0x9469, 0, + 0, 0,0xE0E9, 0, 0, 0, 0,0xE0EB, + 0,0xE0EE, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE0EA, 0, 0, + 0,0xE0ED,0x8CE8,0x896C,0xE0EF, 0,0x9090,0xE0EC, +0x97DA, 0, 0,0xE0F2,0xEAA2, 0, 0, 0, + 0,0xE0F0,0xE0F3, 0, 0, 0, 0,0xE0E5, +0xE0F1, 0, 0,0x8DBA, 0, 0,0xE0F4, 0, + 0, 0, 0, 0, 0, 0,0xE0F5, 0, + 0, 0, 0,0x979E, 0, 0, 0, 0, + 0, 0, 0,0xE0F6, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE0F7, 0, + 0, 0,0xE0E3, 0, 0, 0, 0,0xE0F8, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8AC2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x8EA3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE0F9, 0, 0, 0, 0,0xE0FA, + 0, 0, 0, 0,0xE0FB, 0, 0, 0, + 0, 0, 0, 0,0x895A, 0, 0, 0, +0xE140, 0,0x955A,0xE141, 0, 0,0x8AA2,0xE142, + 0,0xE143, 0, 0, 0, 0,0xE144, 0, +0xE146,0xE147,0xE145, 0, 0, 0,0x9572,0xE149, +0xE148, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE14B,0xE14A,0xE14C, 0, 0, + 0, 0, 0, 0,0xE14D,0xE14F,0xE14E, 0, + 0,0x8D99, 0,0xE151, 0,0xE150, 0, 0, +0x8AC3, 0,0x9072, 0,0x935B, 0,0xE152,0x90B6, + 0, 0, 0,0x8E59, 0,0x8999,0xE153, 0, +0x9770, 0, 0,0x95E1,0xE154, 0, 0, 0, +0x9363,0x9752,0x8D62,0x905C, 0, 0, 0,0x926A, +0x99B2, 0,0x92AC,0x89E6,0xE155, 0, 0, 0, + 0, 0, 0, 0,0xE156, 0,0xE15B, 0, + 0,0xE159,0xE158,0x9DC0,0x8A45,0xE157, 0,0x88D8, + 0,0x94A8, 0, 0,0x94C8, 0, 0, 0, + 0,0x97AF,0xE15C,0xE15A,0x927B,0x90A4, 0, 0, +0x94A9, 0,0x954C, 0,0xE15E,0x97AA,0x8C6C,0xE15F, + 0,0xE15D,0x94D4,0xE160, 0,0xE161, 0, 0, +0x88D9, 0, 0,0x8FF4,0xE166, 0,0xE163,0x93EB, +0xE162, 0, 0, 0, 0, 0, 0,0x8B45, + 0, 0,0xE169, 0, 0, 0,0xE164,0xE165, + 0,0xE168,0xE167,0x9544, 0, 0,0x9161,0x9160, + 0,0x8B5E, 0, 0,0xE16A, 0, 0, 0, + 0, 0,0xE16B, 0, 0,0xE16C, 0, 0, + 0, 0, 0,0xE16E, 0,0xE16D, 0, 0, + 0, 0, 0,0x8975, 0, 0, 0, 0, + 0,0xE176,0x94E6,0xE170, 0,0xE172, 0, 0, +0xE174,0x905D, 0, 0,0xE175,0xE173,0x8EBE, 0, + 0, 0,0xE16F,0xE171, 0,0x9561, 0,0x8FC7, + 0, 0,0xE178, 0, 0,0xE177, 0, 0, + 0, 0,0xE179, 0,0x8EA4,0x8DAD, 0, 0, +0x9397,0xE17A, 0,0x92C9, 0, 0,0xE17C, 0, + 0, 0,0x979F,0xE17B, 0, 0, 0, 0, + 0,0x9189, 0, 0, 0, 0, 0, 0, +0xE182, 0,0xE184,0xE185,0x9273, 0, 0, 0, + 0, 0,0xE183, 0,0xE180, 0,0xE17D,0xE17E, + 0,0xE181, 0, 0, 0, 0, 0, 0, + 0,0xE188, 0,0xE186, 0,0xE187, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE189, +0xE18B,0xE18C,0xE18D, 0,0xE18E, 0, 0,0xE18A, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE190, 0, 0, 0,0xE18F, 0, 0, 0, + 0, 0, 0,0xE191, 0, 0, 0, 0, + 0, 0,0x97C3, 0, 0, 0,0xE194,0xE192, +0xE193, 0, 0, 0,0x8AE0, 0, 0, 0, + 0, 0,0x96FC, 0, 0, 0,0x95C8, 0, +0xE196, 0, 0, 0,0xE195, 0, 0, 0, + 0,0xE197,0xE198, 0, 0, 0, 0,0xE19C, +0xE199,0xE19A,0xE19B, 0,0xE19D, 0, 0, 0, +0xE19E, 0,0xE19F, 0, 0, 0,0xE1A0, 0, +0xE1A1, 0,0x94AD,0x936F,0xE1A2,0x9492,0x9553, 0, +0xE1A3, 0, 0,0xE1A4,0x9349, 0,0x8A46,0x8D63, +0xE1A5, 0, 0,0xE1A6, 0, 0,0xE1A7, 0, +0x8E48, 0, 0,0xE1A9, 0, 0,0xE1A8, 0, + 0,0xE1AA,0xE1AB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x94E7, 0, +0xE1AC, 0, 0, 0,0xE1AD, 0, 0,0xEA89, +0xE1AE,0xE1AF,0xE1B0, 0, 0, 0, 0,0x8E4D, + 0, 0,0xE1B1,0x9475, 0, 0,0x967E, 0, +0x896D, 0,0x8976, 0, 0,0xE1B2, 0, 0, + 0, 0,0xE1B4, 0, 0, 0,0xE1B3,0x9390, + 0, 0, 0,0x90B7,0x9F58, 0,0xE1B5,0x96BF, + 0,0xE1B6, 0,0x8AC4,0x94D5,0xE1B7, 0,0xE1B8, + 0, 0,0xE1B9, 0, 0, 0,0x96DA, 0, + 0, 0,0x96D3, 0,0x92BC, 0, 0, 0, +0x918A, 0, 0,0xE1BB, 0, 0,0x8F82, 0, + 0,0x8FC8, 0, 0,0xE1BE, 0, 0,0xE1BD, +0xE1BC,0x94FB, 0,0x8AC5,0x8CA7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE1C4, 0, 0,0xE1C1,0x905E, +0x96B0, 0, 0, 0,0xE1C0,0xE1C2,0xE1C3, 0, + 0,0xE1BF, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE1C5, +0xE1C6, 0,0x92AD, 0,0x8AE1, 0, 0, 0, +0x9285, 0, 0, 0, 0, 0, 0,0xE1C7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE1C8,0xE1CB, 0, 0, 0, 0, + 0,0x9087, 0,0x93C2, 0,0xE1CC,0x9672, 0, +0xE1C9, 0, 0,0xE1CA, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE1CF, 0, 0, 0, 0,0xE1CE,0xE1CD, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE1D1, 0, 0,0xE1D0, 0, + 0,0xE1D2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE1D4, 0, +0xE1D3, 0, 0, 0, 0,0x95CB, 0, 0, + 0, 0, 0, 0,0x8F75,0x97C4, 0, 0, +0xE1D5, 0, 0,0x93B5, 0, 0,0xE1D6, 0, + 0,0xE1D7, 0,0xE1DB,0xE1D9,0xE1DA, 0,0xE1D8, + 0, 0, 0, 0, 0, 0, 0,0xE1DC, + 0, 0, 0, 0, 0,0xE1DD, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE1DE, + 0, 0,0xE1DF,0x96B5,0xE1E0, 0, 0, 0, + 0, 0,0x96EE,0xE1E1, 0,0x926D, 0,0x948A, + 0,0x8BE9, 0, 0, 0,0x925A,0xE1E2,0x8BB8, + 0, 0, 0,0x90CE, 0, 0, 0, 0, + 0, 0, 0, 0,0xE1E3, 0, 0, 0, + 0, 0,0x8DBB, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE1E4, 0, 0, 0, + 0, 0,0xE1E5, 0,0x8CA4,0x8DD3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE1E7, 0, 0, 0, 0,0x9375,0x8DD4,0x8B6D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9643, 0,0x946A, 0, 0, 0, + 0, 0,0x9376, 0, 0, 0, 0,0x8D7B, + 0, 0, 0, 0, 0,0xE1E9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x8FC9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x97B0,0x8D64, 0, 0,0x8CA5, + 0, 0,0x94A1, 0,0xE1EB, 0, 0, 0, + 0, 0, 0, 0,0xE1ED, 0, 0, 0, + 0,0x8CE9, 0, 0, 0, 0,0xE1EC,0x92F4, + 0, 0, 0, 0,0xE1EF,0x8A56,0xE1EA, 0, + 0,0x94E8, 0,0x894F, 0,0x8DEA, 0,0x9871, + 0, 0,0xE1EE, 0, 0, 0, 0, 0, + 0, 0, 0,0xE1F0, 0, 0, 0,0x95C9, + 0,0x90D7,0xE1F2, 0, 0, 0, 0,0xE1F3, + 0, 0, 0, 0, 0,0xE1F1, 0, 0, + 0, 0,0x8A6D, 0,0xE1F9, 0,0xE1F8, 0, + 0,0x8EA5, 0, 0, 0,0xE1FA,0xE1F5, 0, + 0, 0,0xE1FB,0xE1F6, 0, 0, 0, 0, +0x94D6,0xE1F4, 0, 0,0xE1F7, 0, 0, 0, + 0, 0,0xE241, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE240, +0x9681, 0, 0, 0,0xE1FC, 0, 0,0x88E9, + 0, 0, 0, 0,0xE243, 0, 0, 0, + 0, 0, 0, 0, 0,0xE242, 0, 0, + 0,0x8FCA, 0, 0, 0, 0, 0,0xE244, + 0, 0, 0, 0, 0, 0,0x9162, 0, + 0,0xE246,0xE245, 0, 0, 0, 0, 0, + 0,0xE247, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE1E6, 0, + 0, 0,0xE1E8,0xE249,0xE248, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8EA6, 0,0x97E7, 0,0x8ED0, 0, +0xE24A,0x8C56, 0, 0, 0, 0, 0,0x8B5F, +0x8B46,0x8E83, 0, 0, 0, 0, 0, 0, +0x9753, 0, 0,0xE250, 0,0xE24F,0x9163,0xE24C, + 0, 0,0xE24E, 0, 0,0x8F6A,0x905F,0xE24D, +0xE24B, 0,0x9449, 0, 0,0x8FCB, 0, 0, +0x955B, 0, 0, 0, 0,0x8DD5, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x9398, + 0, 0,0xE251, 0, 0, 0, 0,0xE252, +0xE268,0x8BD6, 0, 0,0x985C,0x9154, 0, 0, + 0, 0,0xE253, 0, 0,0x89D0,0x92F5,0x959F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE254, 0, 0, + 0, 0, 0, 0, 0, 0,0x8B9A,0xE255, + 0, 0,0xE257, 0, 0, 0,0xE258, 0, +0x9448, 0, 0,0xE259, 0, 0, 0, 0, + 0,0xE25A,0xE25B, 0, 0,0x8BD7,0x89D1,0x93C3, +0x8F47,0x8E84, 0, 0, 0, 0, 0, 0, + 0,0xE25C, 0,0x8F48, 0, 0, 0, 0, + 0,0x89C8,0x9562, 0, 0,0xE25D, 0, 0, +0x94E9, 0, 0, 0, 0, 0, 0,0x9164, + 0,0xE260, 0,0xE261,0x9489, 0,0x9060,0xE25E, + 0,0x9281, 0, 0,0xE25F, 0, 0, 0, +0x8FCC, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x88DA, 0, 0, 0, 0, +0x8B48, 0, 0, 0, 0, 0, 0, 0, +0xE262, 0, 0,0x92F6, 0,0xE263,0x90C5, 0, + 0, 0, 0, 0,0x96AB, 0, 0,0x9542, +0xE264,0xE265,0x9274, 0,0x97C5, 0, 0,0xE267, +0xE266, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8EED, 0, + 0,0xE269,0x88EE, 0, 0, 0, 0,0xE26C, + 0, 0, 0,0xE26A,0x89D2,0x8C6D,0xE26B,0x8D65, +0x8D92, 0,0x95E4,0xE26D, 0, 0,0x9673, 0, + 0,0xE26F, 0, 0, 0,0x90CF,0x896E,0x89B8, +0x88AA, 0, 0, 0, 0, 0, 0,0xE26E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE270,0xE271,0x8FF5, 0, 0, 0, 0, + 0,0xE272, 0,0x8A6E, 0, 0, 0, 0, +0xE274, 0, 0, 0,0x8C8A, 0,0x8B86, 0, + 0,0xE275,0x8BF3, 0, 0,0xE276, 0,0x90FA, + 0,0x93CB, 0,0x90DE,0x8DF3, 0, 0, 0, +0xE277, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x9282,0x918B, 0,0xE279,0xE27B,0xE278, +0xE27A, 0, 0, 0, 0, 0, 0,0x8C41, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE27C,0x8C45, 0, 0, 0,0x8B87,0x9771, +0xE27E, 0, 0, 0, 0, 0,0xE280, 0, + 0, 0,0x894D, 0, 0, 0, 0,0xE283, + 0, 0, 0,0x8A96,0xE282,0xE281, 0,0xE285, +0xE27D, 0,0xE286,0x97A7, 0,0xE287, 0,0xE288, + 0, 0,0x9AF2,0xE28A, 0,0xE289, 0, 0, + 0,0xE28B,0xE28C, 0,0x97B3,0xE28D, 0,0xE8ED, +0x8FCD,0xE28E,0xE28F,0x8F76, 0,0x93B6,0xE290, 0, + 0, 0,0x9247, 0, 0,0xE291, 0,0x925B, +0xE292, 0, 0, 0, 0, 0,0x8BA3, 0, +0x995E,0x927C,0x8EB1, 0, 0, 0, 0,0x8AC6, + 0, 0,0xE293, 0,0xE2A0, 0,0xE296, 0, +0x8B88, 0,0xE295,0xE2A2, 0, 0, 0,0xE294, + 0,0x8FCE, 0, 0, 0, 0, 0, 0, +0xE298,0xE299, 0,0x934A, 0, 0,0xE29A, 0, +0x8A7D, 0, 0, 0, 0,0x9079,0x9584, 0, +0xE29C, 0, 0, 0,0x91E6, 0, 0, 0, + 0, 0, 0,0xE297, 0,0xE29B,0xE29D, 0, + 0,0x8DF9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE2A4,0x954D, 0, +0x94A4,0x9399, 0,0x8BD8,0xE2A3,0xE2A1, 0,0x94B3, +0xE29E,0x927D,0x939B, 0,0x939A, 0,0x8DF4, 0, + 0, 0, 0, 0, 0,0xE2B6, 0, 0, + 0, 0, 0, 0, 0,0xE2A6, 0,0xE2A8, + 0, 0, 0, 0,0xE2AB, 0,0xE2AC, 0, +0xE2A9,0xE2AA, 0, 0,0xE2A7,0xE2A5, 0, 0, + 0, 0,0xE29F, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x95CD,0x89D3, + 0, 0, 0,0xE2B3, 0,0xE2B0, 0,0xE2B5, + 0, 0,0xE2B4, 0,0x9493,0x96A5, 0,0x8E5A, +0xE2AE,0xE2B7,0xE2B2, 0,0xE2B1,0xE2AD, 0,0xE2AF, + 0,0x8AC7, 0, 0, 0, 0, 0, 0, + 0, 0,0x925C, 0, 0,0x90FB, 0, 0, + 0,0x94A0, 0, 0,0xE2BC, 0, 0, 0, +0x94A2, 0, 0, 0, 0, 0, 0, 0, +0x90DF,0xE2B9, 0, 0,0x94CD, 0,0xE2BD,0x95D1, + 0,0x927A, 0,0xE2B8,0xE2BA, 0, 0,0xE2BB, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE2BE, 0, 0, +0x8EC2, 0, 0, 0,0x93C4,0xE2C3,0xE2C2, 0, + 0,0xE2BF, 0, 0, 0,0x9855, 0, 0, + 0, 0, 0,0xE2C8, 0, 0,0xE2CC,0xE2C9, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE2C5, 0, 0, 0, 0, 0, 0,0xE2C6, + 0, 0, 0, 0, 0,0xE2CB, 0, 0, + 0,0xE2C0,0x99D3,0xE2C7,0xE2C1, 0, 0,0xE2CA, + 0, 0, 0, 0, 0, 0, 0,0xE2D0, + 0,0x8AC8, 0,0xE2CD, 0, 0, 0,0xE2CE, + 0, 0,0xE2CF,0xE2D2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE2D1, +0x94F4, 0, 0, 0, 0,0xE2D3,0x97FA,0x95EB, +0xE2D8, 0, 0,0xE2D5, 0, 0, 0, 0, + 0, 0, 0, 0,0xE2D4,0x90D0, 0,0xE2D7, +0xE2D9, 0, 0, 0,0xE2D6, 0,0xE2DD, 0, +0xE2DA, 0, 0, 0, 0, 0, 0,0xE2DB, +0xE2C4, 0, 0, 0,0xE2DC,0xE2DE, 0, 0, + 0, 0, 0, 0,0xE2DF, 0, 0, 0, + 0, 0, 0,0x95C4, 0,0xE2E0, 0, 0, + 0, 0, 0, 0, 0, 0,0x96E0, 0, + 0,0x8BCC,0x8C48,0xE2E1, 0, 0, 0, 0, + 0,0x95B2, 0,0x9088, 0,0x96AE, 0, 0, +0xE2E2, 0,0x97B1, 0, 0,0x9494, 0,0x9165, +0x9453, 0, 0,0x8F6C, 0, 0, 0,0x88BE, + 0,0xE2E7,0xE2E5, 0,0xE2E3,0x8A9F, 0,0x8FCF, +0xE2E8, 0, 0,0xE2E6, 0,0xE2E4,0xE2EC, 0, + 0,0xE2EB,0xE2EA,0xE2E9, 0, 0, 0, 0, + 0,0xE2ED, 0, 0, 0,0xE2EE,0x90B8, 0, +0xE2EF, 0,0xE2F1, 0, 0,0xE2F0, 0, 0, + 0, 0,0x8CD0, 0, 0, 0,0x9157, 0, + 0, 0,0xE2F3, 0, 0, 0,0x939C, 0, +0xE2F2, 0, 0, 0,0xE2F4, 0,0x95B3,0x918C, +0x8D66, 0,0xE2F5, 0, 0, 0, 0,0x97C6, + 0, 0, 0, 0, 0, 0, 0,0xE2F7, + 0, 0,0xE2F8, 0,0xE2F9, 0,0xE2FA, 0, +0x8E85, 0,0xE2FB,0x8C6E, 0, 0,0x8B8A, 0, +0x8B49, 0,0xE340, 0,0x96F1,0x8D67,0xE2FC, 0, + 0, 0,0xE343,0x96E4, 0,0x945B, 0, 0, +0x9552, 0, 0, 0,0x8F83,0xE342, 0,0x8ED1, +0x8D68,0x8E86,0x8B89,0x95B4,0xE341, 0, 0, 0, +0x9166,0x9661,0x8DF5, 0, 0, 0, 0, 0, + 0, 0, 0,0x8E87,0x92DB, 0,0xE346,0x97DD, +0x8DD7, 0,0xE347,0x9061, 0,0xE349, 0, 0, + 0,0x8FD0,0x8DAE, 0, 0, 0, 0,0xE348, + 0, 0,0x8F49,0x8CBC,0x9167,0xE344,0xE34A, 0, + 0, 0, 0,0xE345,0x8C6F, 0,0xE34D,0xE351, +0x8C8B, 0, 0, 0, 0, 0,0xE34C, 0, + 0, 0, 0,0xE355, 0, 0,0x8D69, 0, + 0,0x978D,0x88BA,0xE352, 0, 0,0x8B8B, 0, +0xE34F, 0, 0, 0, 0, 0,0xE350, 0, + 0,0x939D,0xE34E,0xE34B, 0,0x8A47,0x90E2, 0, + 0,0x8CA6, 0, 0, 0,0xE357, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE354, 0, 0, 0, 0, 0,0xE356, + 0, 0, 0,0xE353, 0, 0, 0, 0, + 0,0x8C70,0x91B1,0xE358,0x918E, 0, 0,0xE365, + 0, 0,0xE361,0xE35B, 0, 0, 0, 0, + 0, 0, 0,0xE35F,0x8EF8,0x88DB,0xE35A,0xE362, +0xE366,0x8D6A,0x96D4, 0,0x92D4,0xE35C, 0, 0, +0xE364, 0,0xE359,0x925D, 0,0xE35E,0x88BB,0x96C8, + 0, 0, 0, 0, 0, 0, 0,0xE35D, + 0, 0,0x8BD9,0x94EA, 0, 0, 0,0x918D, + 0,0x97CE,0x8F8F, 0, 0,0xE38E, 0, 0, +0xE367, 0,0x90FC, 0,0xE363,0xE368,0xE36A, 0, +0x92F7,0xE36D, 0, 0,0xE369, 0, 0, 0, +0x95D2,0x8AC9, 0, 0,0x96C9, 0, 0,0x88DC, + 0, 0,0xE36C, 0,0x97FB, 0, 0, 0, + 0, 0, 0,0xE36B, 0, 0, 0, 0, + 0,0x898F, 0, 0,0x93EA,0xE36E, 0, 0, + 0,0xE375,0xE36F,0xE376, 0, 0, 0, 0, + 0, 0,0xE372, 0, 0, 0, 0, 0, + 0, 0, 0,0x949B, 0, 0,0x8EC8,0xE374, + 0,0xE371,0xE377,0xE370, 0, 0,0x8F63, 0, + 0, 0, 0,0x9644, 0, 0,0x8F6B, 0, + 0,0xE373,0xE380, 0, 0,0xE37B, 0,0xE37E, + 0,0xE37C,0xE381,0xE37A, 0,0xE360,0x90D1, 0, + 0,0x94C9, 0,0xE37D, 0, 0,0xE378, 0, + 0, 0,0x9140,0x8C71, 0,0x8F4A, 0, 0, + 0, 0, 0, 0,0x9044,0x9155,0xE384, 0, + 0,0xE386,0xE387, 0, 0,0xE383,0xE385, 0, + 0, 0, 0, 0, 0, 0,0xE379,0xE382, + 0,0xE38A,0xE389, 0, 0,0x969A, 0, 0, +0x8C4A, 0, 0, 0, 0, 0, 0, 0, + 0,0xE388, 0,0xE38C,0xE38B,0xE38F, 0,0xE391, + 0, 0,0x8E5B,0xE38D, 0, 0, 0, 0, +0xE392,0xE393, 0, 0,0xE394, 0,0xE39A,0x935A, +0xE396, 0,0xE395,0xE397,0xE398, 0,0xE399, 0, + 0, 0, 0,0xE39B,0xE39C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8ACA, 0, +0xE39D, 0,0xE39E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE39F, 0, 0, + 0, 0, 0, 0,0xE3A0,0xE3A1,0xE3A2, 0, +0xE3A3,0xE3A4, 0, 0,0xE3A6,0xE3A5, 0, 0, +0xE3A7, 0, 0, 0, 0, 0, 0,0xE3A8, +0xE3A9, 0, 0, 0, 0, 0, 0,0xE3AC, +0xE3AA,0xE3AB,0x8DDF,0x8C72, 0, 0,0x9275, 0, +0x94B1, 0,0x8F90, 0, 0,0x946C, 0,0x94EB, +0xE3AD,0x9CEB, 0, 0, 0, 0, 0, 0, + 0, 0,0xE3AE,0xE3B0, 0,0x9785,0xE3AF,0xE3B2, +0xE3B1, 0,0x9772, 0,0xE3B3, 0,0x94FC, 0, + 0, 0, 0, 0,0xE3B4, 0, 0, 0, + 0, 0,0xE3B7, 0, 0,0xE3B6,0xE3B5, 0, + 0, 0, 0,0xE3B8,0x8C51, 0, 0, 0, +0x9141,0x8B60, 0, 0, 0, 0,0xE3BC,0xE3B9, + 0, 0,0xE3BA, 0, 0, 0,0xE3BD, 0, +0xE3BE,0xE3BB, 0, 0, 0,0x8948, 0, 0, + 0,0x89A5, 0, 0, 0,0xE3C0,0xE3C1, 0, + 0, 0,0xE3C2, 0,0x9782, 0, 0, 0, + 0, 0,0x8F4B, 0,0xE3C4,0xE3C3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9089,0xE3C5, 0, 0, 0, 0,0xE3C6, 0, + 0,0xE3C7, 0,0x8AE3, 0, 0, 0, 0, +0x8ACB, 0, 0,0xE3C8, 0, 0, 0, 0, + 0,0xE3C9, 0,0x967C,0x9783, 0, 0, 0, +0x9773,0x9856, 0,0x8D6C,0xE3CC,0x8ED2,0xE3CB, 0, + 0, 0, 0,0xE3CD,0x8EA7, 0, 0, 0, +0x91CF, 0,0xE3CE, 0, 0,0x8D6B, 0,0x96D5, +0xE3CF,0xE3D0, 0, 0,0xE3D1, 0, 0, 0, + 0,0xE3D2, 0, 0, 0, 0, 0, 0, +0xE3D3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8EA8, 0, 0,0x96EB, 0, + 0, 0, 0,0xE3D5, 0,0x925E, 0,0xE3D4, + 0, 0, 0, 0, 0, 0,0xE3D7, 0, + 0, 0,0xE3D6, 0, 0, 0, 0, 0, + 0, 0,0xE3D8, 0, 0, 0,0x90B9, 0, +0xE3D9, 0,0xE3DA, 0, 0, 0,0x95B7,0xE3DB, + 0,0x918F,0xE3DC, 0, 0, 0, 0, 0, +0xE3DD, 0, 0, 0, 0, 0, 0,0x97FC, +0xE3E0, 0,0xE3DF,0xE3DE,0x92AE, 0,0xE3E1,0x9045, + 0,0xE3E2, 0, 0, 0,0xE3E3,0x9857,0xE3E4, + 0, 0, 0, 0,0xE3E5,0xE3E7,0xE3E6,0x94A3, + 0,0x93F7, 0,0x985D,0x94A7, 0, 0, 0, + 0, 0, 0,0xE3E9, 0, 0,0x8FD1, 0, +0x9549, 0,0xE3EA,0xE3E8, 0,0x8ACC, 0, 0, + 0,0x8CD2,0x8E88, 0, 0,0x94EC, 0, 0, + 0,0x8CA8,0x9662, 0,0xE3ED,0xE3EB, 0,0x8D6D, + 0,0x8D6E,0x88E7, 0,0x8DE6, 0, 0, 0, + 0, 0,0x9478, 0, 0, 0, 0, 0, + 0, 0, 0,0x88DD,0xE3F2, 0,0x925F, 0, + 0, 0, 0, 0,0x9477, 0,0x91D9, 0, + 0, 0, 0, 0, 0, 0,0xE3F4, 0, + 0,0xE3F0,0xE3F3,0xE3EE, 0,0xE3F1,0x9645, 0, + 0,0x8CD3, 0, 0,0x88FB,0xE3EF, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE3F6, + 0,0xE3F7, 0, 0,0x93B7, 0, 0, 0, +0x8BB9, 0, 0, 0,0xE445,0x945C, 0, 0, + 0, 0,0x8E89, 0, 0,0x8BBA,0x90C6,0x9865, +0x96AC,0xE3F5,0x90D2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8B72,0xE3F8, 0, 0, 0, 0, + 0, 0, 0,0xE3FA, 0, 0, 0, 0, + 0,0xE3F9, 0, 0, 0, 0, 0,0xE3FB, + 0,0x9245, 0,0x945D, 0, 0, 0, 0, + 0,0x92AF, 0, 0, 0, 0,0xE442, 0, + 0, 0, 0, 0, 0, 0,0xE441, 0, + 0, 0, 0,0xE3FC, 0, 0,0x9074, 0, +0x9585,0xE444, 0,0xE443,0x8D6F,0x9872, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE454, + 0, 0, 0, 0, 0,0xE448,0xE449, 0, + 0, 0, 0,0x8EEE, 0, 0,0xE447, 0, +0x8D98,0xE446, 0, 0,0xE44A, 0, 0, 0, +0x92B0,0x95A0,0x9142, 0, 0, 0, 0,0x91DA, +0xE44E, 0,0xE44F,0xE44B, 0, 0, 0, 0, +0xE44C, 0,0xE44D, 0, 0, 0, 0,0x8D70, + 0, 0, 0,0xE455, 0,0xE451, 0, 0, + 0, 0,0x9586, 0,0x968C,0x9547, 0, 0, +0xE450, 0, 0,0xE453,0xE452, 0, 0, 0, +0x9663,0xE456, 0, 0, 0, 0, 0, 0, +0xE457, 0, 0,0x9156, 0,0xE458, 0, 0, +0xE45A, 0,0xE45E, 0, 0,0xE45B,0xE459,0x945E, +0xE45C, 0,0xE45D, 0, 0, 0,0x89B0, 0, +0xE464,0xE45F, 0, 0, 0,0xE460, 0, 0, + 0,0xE461, 0,0x919F, 0, 0, 0, 0, +0xE463,0xE462,0xE465, 0, 0, 0, 0,0xE466, +0xE467, 0, 0,0x9062, 0,0x89E7, 0,0xE468, +0x97D5, 0,0x8EA9, 0, 0,0x8F4C, 0, 0, + 0, 0, 0,0x8E8A,0x9276, 0, 0, 0, + 0, 0,0xE469,0xE46A,0x8950, 0,0xE46B, 0, + 0,0xE46C,0xE46D, 0, 0,0xE46E, 0,0xE46F, +0x8BBB,0x9DA8,0xE470, 0,0x90E3,0xE471,0x8EC9, 0, +0xE472, 0,0x98AE, 0, 0, 0,0xE473,0x95DC, +0x8ADA, 0, 0,0x9143,0x8F77, 0,0x9591,0x8F4D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE474,0x8D71,0xE475,0x94CA, 0,0xE484, 0, + 0, 0, 0,0xE477, 0,0x91C7,0x9495,0x8CBD, +0xE476,0x9144, 0, 0, 0, 0, 0, 0, +0xE478, 0, 0, 0, 0, 0, 0,0x92F8, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE47A,0xE479,0xE47C, 0, 0,0xE47B, 0,0xE47D, + 0, 0,0xE480, 0,0xE47E, 0,0x8ACD, 0, +0xE481, 0,0xE482,0xE483, 0, 0,0x8DAF,0x97C7, + 0,0xE485,0x9046, 0, 0, 0,0x8990,0xE486, +0xE487, 0, 0, 0, 0, 0,0xE488, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x88F0, 0,0xE489, 0, 0, + 0, 0,0xE48A, 0, 0, 0, 0, 0, + 0,0x9587, 0, 0, 0,0x8EC5, 0,0xE48C, + 0, 0, 0, 0, 0,0x8A48,0x88B0, 0, + 0, 0, 0,0xE48B,0xE48E,0x946D, 0,0x9063, + 0,0x89D4, 0,0x9646, 0, 0, 0, 0, +0x8C7C,0x8BDA, 0,0xE48D, 0,0x89E8, 0, 0, + 0, 0, 0, 0, 0,0x8AA1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8991,0xE492,0x97E8,0x91DB, 0, 0,0x9563, + 0,0xE49E, 0,0x89D5,0xE49C, 0,0xE49A,0xE491, + 0,0xE48F, 0,0xE490, 0,0x8EE1,0x8BEA,0x9297, + 0, 0, 0,0x93CF, 0, 0, 0, 0, + 0,0x8970, 0,0xE494,0xE493, 0, 0, 0, + 0,0xE499,0xE495,0xE498, 0, 0, 0, 0, + 0, 0,0x96CE,0xE497,0x89D6,0x8A9D,0xE49B, 0, + 0,0xE49D, 0, 0, 0, 0,0x8C73, 0, + 0, 0, 0, 0, 0, 0,0xE4A1,0xE4AA, +0xE4AB, 0, 0, 0,0x88A9, 0, 0, 0, + 0, 0, 0,0xE4B2, 0, 0, 0, 0, +0x88EF, 0, 0,0xE4A9, 0, 0, 0,0xE4A8, + 0,0xE4A3,0xE4A2, 0,0xE4A0,0xE49F,0x9283, 0, +0x91F9,0xE4A5, 0, 0, 0, 0, 0, 0, +0xE4A4, 0, 0, 0, 0,0xE4A7, 0, 0, + 0,0x9190,0x8C74, 0, 0, 0, 0,0x8960, +0xE4A6, 0,0x8D72, 0, 0, 0, 0, 0, +0x9191, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE4B8, 0,0xE4B9, 0,0x89D7, + 0, 0, 0,0x89AC,0xE4B6, 0, 0, 0, + 0, 0, 0, 0, 0,0xE4AC, 0,0xE4B4, + 0,0xE4BB,0xE4B5, 0, 0, 0,0xE4B3, 0, + 0, 0, 0,0xE496, 0, 0,0xE4B1, 0, + 0, 0,0xE4AD, 0, 0, 0,0x8ACE,0xE4AF, +0xE4BA, 0,0xE4B0, 0, 0, 0, 0, 0, +0xE4BC, 0,0xE4AE,0x949C, 0, 0, 0, 0, + 0,0x9789, 0, 0, 0,0xE4B7, 0, 0, + 0, 0, 0, 0, 0,0xE4CD, 0, 0, + 0,0xE4C5, 0, 0, 0,0x909B, 0, 0, + 0, 0,0x8B65, 0,0x8BDB, 0,0xE4C0, 0, + 0, 0, 0,0x89D9, 0, 0,0x8FD2, 0, +0xE4C3, 0, 0, 0,0x8DD8, 0, 0,0x9370, +0xE4C8, 0, 0, 0, 0, 0, 0, 0, + 0,0x95EC, 0,0xE4BF, 0, 0, 0,0x89D8, +0x8CD4,0x9548,0xE4C9, 0,0xE4BD, 0, 0,0xE4C6, + 0, 0, 0,0xE4D0, 0,0xE4C1, 0, 0, + 0, 0, 0,0xE4C2,0x93B8, 0, 0,0xE4C7, + 0, 0, 0,0xE4C4,0x9647,0xE4CA,0x88DE, 0, + 0, 0, 0,0xE4BE, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE4CC, 0,0xE4CB, 0, 0, 0, 0, 0, + 0,0x948B,0xE4D2, 0,0xE4DD, 0, 0, 0, + 0,0x8A9E, 0, 0, 0,0xE4E0, 0, 0, +0xE4CE, 0, 0, 0,0xE4D3,0x978E, 0, 0, + 0, 0, 0, 0, 0, 0,0xE4DC, 0, + 0,0x9774, 0, 0, 0, 0,0x97A8, 0, + 0, 0, 0, 0, 0, 0, 0,0x9298, + 0, 0, 0,0x8A8B, 0, 0, 0, 0, + 0,0x9592,0xE4E2,0x939F, 0, 0,0x88AF, 0, + 0,0xE4DB, 0,0xE4D7,0x9192,0xE4D1,0xE4D9,0xE4DE, + 0,0x944B, 0, 0, 0,0x88A8, 0,0xE4D6, + 0,0xE4DF,0x9598, 0, 0, 0, 0, 0, + 0, 0,0xE4DA, 0,0xE4D5, 0, 0, 0, + 0, 0, 0,0x8FD3, 0, 0, 0, 0, +0x8F4E, 0, 0, 0,0x8EAA, 0, 0, 0, + 0,0x96D6, 0, 0,0x9566, 0, 0,0xE4E5, + 0,0xE4EE, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE4D8, 0, 0, + 0, 0,0x8A97, 0, 0, 0, 0, 0, +0x8FF6,0xE4E3, 0,0xE4E8,0x9193, 0, 0,0xE4E4, + 0,0xE4EB, 0, 0,0x927E, 0,0xE4EC, 0, + 0,0x9775,0xE4E1,0x8A57, 0,0xE4E7, 0, 0, +0xE4EA,0x96AA, 0, 0, 0, 0,0xE4ED, 0, + 0,0xE4E6,0xE4E9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9648, 0,0x9840, 0, + 0, 0, 0, 0,0xE4F1, 0, 0, 0, + 0, 0, 0, 0,0xE4F8, 0, 0,0xE4F0, +0x8EC1, 0, 0, 0, 0, 0,0xE4CF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x95CC, 0,0x96A0,0xE4F7,0xE4F6, 0,0xE4F2, +0xE4F3, 0,0x8955, 0, 0, 0, 0,0xE4F5, + 0,0xE4EF, 0, 0, 0, 0,0x92D3, 0, + 0, 0, 0, 0,0xE4F4,0x88FC, 0, 0, + 0, 0, 0, 0, 0,0x91A0, 0, 0, + 0, 0, 0, 0, 0,0x95C1, 0, 0, +0xE4F9,0xE540, 0,0x94D7, 0, 0, 0, 0, +0xE4FC,0x8FD4,0x8EC7,0xE542, 0, 0,0x8BBC, 0, + 0, 0, 0, 0, 0,0xE543, 0,0x9599, +0xE4FB, 0,0xE4D4, 0, 0, 0, 0, 0, + 0, 0, 0,0xE4FA, 0, 0, 0, 0, +0x986E,0x93A0,0x9593, 0, 0,0xE54A, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE550, + 0, 0, 0, 0, 0, 0,0xE551, 0, +0xE544, 0, 0, 0,0x9496, 0, 0,0xE54E, +0xE546, 0,0xE548, 0, 0, 0, 0, 0, +0xE552,0xE547, 0, 0,0xE54B, 0, 0,0x8992, + 0,0x93E3, 0,0xE54C,0xE54F, 0, 0, 0, + 0, 0, 0, 0,0xE545, 0,0x9145, 0, +0xE549,0x8E46,0x9064,0x8C4F,0x96F2, 0,0x96F7,0x8F92, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE556,0xE554, 0, 0, 0, 0, 0, + 0,0x986D, 0, 0, 0, 0, 0, 0, + 0,0xE553, 0, 0, 0,0x9795, 0,0xE555, +0xE557, 0, 0, 0, 0,0xE558, 0, 0, + 0, 0, 0, 0,0xE55B,0xE559, 0, 0, + 0, 0, 0, 0,0x93A1,0xE55A, 0, 0, + 0,0x94CB,0xE54D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8F93, + 0,0xE55C,0xE561,0x9194, 0, 0,0xE560, 0, + 0, 0,0xE541, 0, 0, 0,0xE562,0x9168, + 0, 0,0xE55D,0xE55F, 0, 0, 0, 0, + 0, 0, 0,0xE55E, 0, 0,0x9F50,0x9F41, + 0, 0,0xE564, 0, 0, 0, 0, 0, + 0, 0,0xE563, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9796, 0,0xE1BA, +0xE565, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE566, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE567,0x8CD5, 0, +0x8B73, 0, 0, 0,0xE569,0x997C, 0, 0, + 0, 0,0x8B95, 0,0x97B8, 0,0x8BF1,0xE56A, + 0, 0, 0, 0, 0, 0, 0,0xE56B, + 0, 0, 0,0x928E, 0, 0, 0, 0, + 0,0xE56C, 0, 0, 0, 0, 0, 0, + 0,0x93F8, 0,0x88B8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x89E1,0xE571,0xE572, 0, 0, 0, + 0, 0, 0,0xE56D, 0,0x8E5C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE56E,0x9461, 0, 0, 0, + 0,0xE56F,0xE570,0xE57A, 0, 0, 0,0xE574, +0xE577, 0, 0, 0, 0, 0,0xE573, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE575, 0,0xE576,0x8ED6, + 0,0xE578, 0,0x9260, 0,0x8C75,0x8A61, 0, + 0, 0, 0, 0,0xE57B, 0, 0, 0, + 0,0x8A5E, 0,0xE581, 0, 0,0xE57C,0xE580, + 0, 0, 0, 0,0x94B8, 0, 0, 0, + 0,0xE57D, 0, 0,0xE57E,0x9567,0x94D8,0xE582, + 0, 0, 0, 0, 0, 0, 0, 0, +0x91FB,0xE58C, 0,0xE588, 0, 0,0x89E9, 0, +0xE586, 0,0x9649,0xE587, 0, 0,0xE584, 0, +0xE585,0xE58A,0xE58D, 0, 0,0xE58B, 0, 0, + 0,0xE589,0xE583, 0, 0, 0, 0, 0, +0x9277, 0,0xE594, 0,0x96A8, 0, 0, 0, + 0, 0, 0, 0, 0,0xE592, 0, 0, + 0,0xE593, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE58E, 0, 0,0xE590, + 0, 0, 0,0xE591, 0, 0, 0,0xE58F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x90E4, 0,0x9858,0xE598, 0,0xE599, 0, + 0, 0, 0,0xE59F, 0,0x9049, 0,0xE59B, + 0,0xE59E, 0, 0, 0, 0, 0,0xE596, +0xE595, 0, 0,0xE5A0, 0, 0,0x89DA, 0, +0xE59C, 0,0xE5A1, 0, 0, 0,0xE59D, 0, + 0, 0, 0, 0,0xE59A, 0,0x92B1, 0, +0xE597, 0, 0, 0, 0, 0, 0,0x9488, + 0, 0,0xE5A5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x975A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE5A4, + 0, 0,0xE5A3, 0, 0, 0, 0, 0, + 0, 0, 0,0xE5AC, 0, 0, 0,0xE5A6, + 0, 0, 0,0xE5AE, 0, 0, 0, 0, + 0, 0,0x9786,0xE5B1, 0,0xE5A8, 0, 0, +0xE5A9, 0, 0, 0,0xE5AD, 0,0xE5B0,0xE5AF, + 0, 0, 0,0xE5A7, 0, 0, 0, 0, +0xE5AA, 0,0xE5BB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE5B4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE5B2, + 0, 0,0xE5B3, 0, 0, 0,0xE5B8,0xE5B9, + 0,0x8A49, 0,0x8B61, 0, 0,0xE5B7, 0, + 0, 0, 0, 0, 0,0xE5A2, 0, 0, + 0, 0, 0, 0, 0,0xE5B6,0xE5BA,0xE5B5, + 0,0xE5BC, 0, 0, 0,0xE5BE,0xE5BD, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE5C0,0xE5BF,0xE579, 0, 0, 0,0xE5C4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE5C1, 0, 0, 0, 0,0xE5C2, 0, + 0,0xE5C3, 0,0xE5C5, 0, 0, 0, 0, +0x8C8C, 0,0xE5C7, 0,0xE5C6, 0,0x8F4F, 0, + 0, 0, 0, 0,0x8D73,0x9FA5, 0, 0, + 0, 0,0xE5C8,0x8F70, 0, 0, 0,0x8A58, + 0,0xE5C9, 0,0x8971, 0,0x8FD5,0xE5CA, 0, + 0,0x8D74,0xE5CB,0x88DF, 0, 0, 0, 0, +0x955C, 0, 0,0xE5CC, 0, 0, 0, 0, +0x908A, 0,0xE5D3, 0, 0,0xE5D0, 0,0x928F, + 0, 0, 0, 0, 0,0xE5D1,0xE5CE,0x8BDC, + 0,0xE5CD,0xE5D4, 0, 0, 0, 0, 0, +0x8C55, 0, 0,0x91DC, 0,0xE5DA, 0, 0, + 0, 0,0xE5D6, 0, 0, 0,0x91B3,0xE5D5, + 0,0xE5D8, 0, 0, 0, 0,0xE5CF, 0, + 0, 0,0xE5D9, 0,0xE5DB, 0, 0, 0, + 0, 0, 0,0x94ED, 0, 0,0xE5D7, 0, +0xE5DC,0xE5DE, 0, 0,0x8CD1,0xE5D2, 0,0x88BF, + 0, 0, 0, 0, 0, 0, 0,0xE5DD, + 0,0x8DD9,0x97F4,0xE5DF,0xE5E0,0x9195, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x97A0, + 0, 0, 0, 0,0xE5E1,0x9754, 0, 0, +0xE5E2,0xE5E3, 0, 0,0x95E2,0xE5E4, 0,0x8DBE, + 0,0x97A1, 0, 0, 0, 0, 0, 0, +0xE5E9, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE5EA,0x8FD6,0xE5E8, 0, 0, 0, +0x9787,0xE5E5, 0, 0,0xE5E7,0x90BB,0x909E, 0, + 0, 0,0xE5E6, 0,0xE5EB, 0, 0,0x95A1, + 0, 0,0xE5ED, 0,0xE5EC, 0, 0, 0, +0x8A8C, 0,0x964A,0xE5EE, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE5FA,0xE5F0, 0, + 0, 0, 0, 0, 0,0xE5F1, 0, 0, + 0, 0,0xE5F2,0xE5F3, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE5F7, 0, +0xE5F8, 0, 0,0xE5F6, 0, 0, 0, 0, + 0,0xE5F4, 0,0xE5EF,0xE5F5, 0, 0, 0, + 0, 0, 0, 0,0xE5F9,0xE8B5, 0, 0, + 0, 0, 0, 0, 0, 0,0x89A6, 0, + 0, 0, 0, 0, 0, 0,0xE5FC,0x8BDD, +0xE5FB, 0, 0, 0,0xE641, 0,0xE640, 0, + 0, 0,0xE643, 0, 0,0xE642, 0,0xE644, + 0, 0,0x8F50, 0,0xE645, 0, 0,0xE646, + 0, 0, 0, 0, 0, 0,0xE647,0x90BC, + 0,0x9776, 0,0xE648, 0, 0,0x95A2,0x9465, +0xE649, 0,0xE64A,0x8CA9, 0, 0, 0,0x8B4B, + 0, 0, 0,0xE64B, 0, 0,0x8E8B,0x9460, +0xE64C, 0,0x8A6F, 0, 0, 0, 0, 0, + 0,0xE64D, 0, 0, 0, 0,0xE64F,0x9797, + 0,0xE64E,0x9065, 0,0xE650, 0, 0,0xE651, + 0, 0,0xE652,0x8ACF, 0, 0, 0, 0, + 0, 0,0xE653, 0, 0,0xE654, 0,0xE655, +0xE656, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8A70, 0, 0, 0, 0, 0, + 0, 0,0xE657, 0,0xE658,0xE659, 0, 0, + 0, 0, 0,0x89F0, 0, 0,0x9047,0xE65A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE65B, 0, 0, 0, +0xE65C, 0, 0, 0, 0, 0, 0, 0, +0x8CBE, 0,0x92F9,0xE65D, 0, 0, 0, 0, +0x8C76, 0,0x9075, 0,0xE660, 0,0x93A2, 0, +0xE65F, 0, 0,0x8C50, 0, 0,0xE65E,0x91F5, +0x8B4C, 0, 0,0xE661, 0,0xE662, 0,0x8FD7, + 0, 0, 0,0x8C8D, 0,0xE663, 0, 0, + 0, 0,0x964B, 0, 0,0x90DD, 0, 0, + 0,0x8B96, 0,0x96F3,0x9169, 0,0xE664, 0, + 0, 0,0x9066,0x9290,0x8FD8, 0, 0, 0, + 0,0xE665, 0, 0, 0, 0,0xE668, 0, +0xE669, 0, 0, 0, 0, 0, 0, 0, +0x8DBC,0x91C0,0xE667, 0,0x8FD9,0x955D, 0, 0, + 0, 0, 0,0xE666, 0, 0,0x8E8C, 0, +0x8972, 0,0xE66D,0x8C77, 0, 0,0x8E8E, 0, + 0,0x8E8D, 0,0x986C,0xE66C,0xE66B,0x9146, 0, +0x8B6C,0x9862,0x8A59,0x8FDA, 0, 0, 0, 0, + 0, 0, 0, 0,0xE66A, 0, 0, 0, + 0, 0,0xE66F, 0,0xE670,0xE66E, 0,0x8CD6, + 0,0x975F, 0, 0,0x8E8F,0x9446, 0, 0, + 0,0xE673, 0,0x90BE, 0,0x9261, 0, 0, +0x9755, 0,0xE676, 0, 0, 0,0x8CEA, 0, +0x90BD,0xE672, 0,0xE677,0x8CEB,0xE674,0xE675, 0, +0xE671, 0, 0, 0,0x90E0,0x93C7, 0, 0, +0x924E, 0,0x89DB, 0, 0, 0, 0, 0, + 0,0x94EE, 0, 0,0x8B62, 0, 0,0x92B2, + 0, 0,0xE67A, 0,0xE678, 0, 0,0x926B, + 0, 0, 0,0x90BF,0x8AD0,0xE679, 0,0x907A, + 0, 0,0x97C8, 0, 0, 0,0x985F, 0, + 0, 0,0xE67B,0xE687,0x92B3, 0,0xE686, 0, +0xE683,0xE68B,0xE684, 0,0xE680, 0,0x92FA,0xE67E, + 0, 0, 0,0xE67C, 0,0x9740,0x8E90, 0, + 0,0xE681, 0,0xE67D, 0, 0, 0,0xE685, +0x8F94, 0,0x8CBF, 0, 0, 0,0x91F8, 0, +0x9664,0x8979,0x88E0, 0,0x93A3, 0, 0,0xE689, + 0, 0, 0, 0,0xE688, 0,0x93E4, 0, +0xE68D, 0, 0, 0,0xE682, 0,0xE68C,0xE68E, + 0,0x8CAA,0xE68A,0x8D75, 0,0x8ED3, 0, 0, +0xE68F,0x9777, 0, 0, 0, 0,0xE692, 0, +0xE695, 0, 0,0xE693,0x9554, 0, 0, 0, + 0, 0, 0,0xE690, 0, 0, 0, 0, + 0,0x8BDE, 0, 0, 0, 0,0xE694, 0, + 0,0xE696, 0, 0, 0, 0, 0, 0, + 0,0xE69A, 0, 0,0xE697, 0,0xE699,0xE698, + 0, 0, 0, 0, 0, 0,0xE69B, 0, +0x8EAF, 0,0xE69D,0xE69C,0x9588, 0, 0,0xE69F, + 0, 0, 0, 0, 0, 0,0x8C78, 0, + 0, 0, 0,0xE69E,0xE6A0, 0, 0,0xE6A1, +0x8B63,0xE3BF,0x8FF7, 0,0xE6A2, 0, 0,0x8CEC, + 0, 0, 0, 0, 0,0xE6A3, 0, 0, +0xE6A4, 0, 0,0x8E5D, 0, 0, 0, 0, + 0, 0,0x9DCC, 0,0xE6A5, 0,0xE6A6, 0, +0x8F51, 0,0xE6A7,0xE6A8, 0, 0,0xE6A9, 0, + 0,0xE6AA,0xE6AB, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x924A, + 0, 0,0xE6AC, 0, 0, 0, 0,0xE6AE, + 0,0xE6AD, 0, 0, 0, 0,0x93A4, 0, +0xE6AF, 0,0x964C, 0,0xE6B0, 0,0xE6B1, 0, +0xE6B2, 0, 0, 0, 0,0xE6B3, 0, 0, + 0, 0,0x93D8, 0, 0, 0, 0, 0, + 0,0x8FDB,0xE6B4, 0, 0, 0, 0, 0, + 0, 0,0x8D8B,0x98AC,0xE6B5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE6B6,0x955E,0xE6B7, 0,0xE6BF, 0, 0, 0, + 0, 0,0xE6B8, 0, 0,0xE6BA, 0, 0, + 0,0xE6B9,0xE6BB, 0,0x9665,0xE6BC,0xE6BD, 0, + 0, 0, 0, 0,0xE6BE, 0, 0, 0, +0xE6C0, 0, 0, 0, 0,0x8A4C,0x92E5, 0, +0x9589,0x8DE0,0x8D76, 0, 0, 0, 0,0x956E, +0x89DD,0x94CC,0xE6C3,0x8AD1,0x90D3,0xE6C2,0xE6C7,0x9299, +0x96E1, 0,0xE6C5,0xE6C6,0x8B4D, 0,0xE6C8,0x9483, +0x91DD, 0, 0,0x94EF,0x935C,0xE6C4, 0,0x9666, +0x89EA,0xE6CA,0x9847,0x92C0,0x9864, 0, 0,0x8E91, +0xE6C9, 0,0x91AF, 0, 0,0xE6DA,0x9147, 0, + 0,0x93F6, 0,0x956F, 0, 0, 0, 0, + 0, 0,0xE6CD,0x8E5E,0x8E92, 0,0x8FDC, 0, +0x9485, 0,0x8CAB,0xE6CC,0xE6CB, 0,0x958A, 0, + 0, 0,0x8EBF, 0, 0,0x9371, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE6CF,0xE6D0,0x8D77,0xE6CE, 0, 0, + 0, 0, 0, 0,0xE6D1,0xE6D2, 0,0xE6D4, +0x91A1, 0,0xE6D3,0x8AE4, 0,0xE6D6, 0,0xE6D5, +0xE6D7, 0, 0,0xE6D9,0xE6DB, 0,0xE6DC, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x90D4, 0,0x8ECD,0xE6DD, + 0, 0, 0,0x8A71, 0,0xE6DE, 0, 0, +0x9196,0xE6DF, 0,0xE6E0,0x958B, 0, 0,0x8B4E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE6E1, 0, 0, 0,0x92B4, 0, 0, + 0, 0,0x897A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE6E2, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x8EEF, 0, 0, 0, 0, +0x9096, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x91AB, 0, 0, 0, 0, + 0, 0,0xE6E5, 0, 0, 0,0xE6E4, 0, + 0, 0,0xE6E3, 0, 0, 0, 0, 0, + 0, 0, 0,0xE6EB,0xE6E9, 0, 0,0xE6E6, + 0, 0, 0, 0, 0, 0,0xE6E8, 0, + 0, 0,0xE6E7,0xE6EA, 0,0x8B97, 0,0xE6EE, + 0,0x90D5, 0,0xE6EF, 0, 0, 0, 0, +0x8CD7, 0,0xE6EC,0xE6ED, 0, 0, 0,0x9848, + 0, 0, 0,0x92B5, 0,0x9148, 0, 0, + 0, 0, 0, 0,0xE6F0, 0, 0,0xE6F3, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE6F1,0xE6F2,0x9778, 0, 0, 0, 0,0x93A5, +0xE6F6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE6F4,0xE6F5,0xE6F7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE748, 0, 0, 0, 0, 0, +0xE6FA, 0, 0, 0,0xE6FB,0xE6F9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE6F8, 0,0x92FB, 0, 0,0xE740, +0xE744,0xE741,0xE6FC, 0,0xE742, 0, 0, 0, +0xE743, 0, 0, 0, 0,0xE74A, 0, 0, + 0,0xE745, 0, 0, 0, 0, 0,0x90D6, +0xE747, 0, 0,0xE749,0xE746, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE74C, 0,0x8F52, 0,0xE74B, 0, + 0, 0, 0, 0,0xE74D, 0, 0, 0, + 0,0xE74E, 0, 0,0xE751,0xE750, 0,0xE74F, + 0, 0,0xE753,0xE752, 0,0x96F4, 0, 0, + 0,0xE755, 0,0xE754,0xE756, 0, 0, 0, + 0,0xE757, 0, 0, 0, 0, 0, 0, + 0,0xE759, 0, 0, 0, 0, 0, 0, + 0, 0,0xE758,0x9067,0xE75A, 0, 0,0x8BEB, +0xE75B,0xE75D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE75E, 0, + 0, 0, 0, 0, 0,0xE75F,0xE75C, 0, +0xE760, 0,0x8ED4,0xE761,0x8B4F,0x8C52, 0, 0, + 0, 0,0x8CAC, 0, 0, 0, 0, 0, + 0, 0, 0,0xE762, 0, 0, 0,0x93EE, + 0, 0,0x935D,0xE763, 0, 0, 0, 0, + 0, 0, 0,0xE766, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8EB2, 0, 0,0xE765,0xE764,0x8C79,0xE767, 0, + 0, 0, 0,0x8A72, 0,0xE769, 0, 0, + 0,0x8DDA,0xE768, 0,0xE771, 0, 0, 0, + 0, 0,0xE76B,0xE76D,0x95E3,0xE76A, 0, 0, + 0,0xE76C, 0,0xE770,0xE76E,0x8B50, 0,0xE76F, + 0, 0, 0, 0, 0, 0,0xE772, 0, + 0,0x9479,0x97D6, 0, 0, 0, 0,0x8F53, + 0, 0, 0,0xE773, 0, 0, 0, 0, +0x9741,0xE775, 0,0xE774, 0, 0,0xE778,0x9760, + 0, 0,0xE777, 0,0x8A8D,0xE776,0xE77B, 0, + 0,0xE77A, 0, 0,0xE779,0x9351,0xE77C, 0, + 0, 0, 0, 0, 0, 0, 0,0xE77D, + 0, 0, 0, 0,0xE77E, 0, 0,0x8D8C, + 0,0x8C44,0xE780,0xE781,0xE782, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9068,0xE783, 0,0x8EAB,0xE784, + 0, 0, 0,0xE785, 0, 0, 0,0x999F, +0x999E, 0, 0, 0, 0,0xE786,0xE390,0xE787, +0x9243,0x904A,0x945F, 0, 0, 0, 0,0xE788, + 0, 0,0x95D3,0x92D2,0x8D9E, 0, 0,0x9248, + 0, 0,0x8949, 0,0x9698,0x9076, 0, 0, + 0, 0, 0, 0, 0, 0,0x8C7D, 0, + 0,0x8BDF, 0, 0,0x95D4, 0, 0, 0, + 0, 0,0xE789, 0, 0, 0, 0, 0, + 0, 0,0xE78B, 0, 0,0xE78A,0x89DE, 0, + 0,0x93F4,0xE78C,0x9497, 0,0x9352, 0,0xE78D, +0x8F71, 0, 0, 0,0xE78F, 0, 0,0x96C0, +0xE79E,0xE791,0xE792, 0, 0,0x92C7, 0, 0, +0x91DE,0x9197, 0,0x93A6, 0,0xE790,0x8B74, 0, + 0, 0, 0,0xE799, 0,0xE796,0xE7A3,0x93A7, +0x9280,0xE793, 0,0x92FC,0x9372,0xE794,0xE798,0x9080, + 0,0x9487,0x92CA, 0, 0,0x90C0,0xE797,0x91AC, +0x91A2,0xE795,0x88A7,0x9841, 0, 0, 0,0xE79A, + 0, 0, 0, 0, 0, 0,0x91DF, 0, + 0,0x8F54,0x9069, 0, 0,0xE79C,0xE79B, 0, +0x88ED,0xE79D, 0, 0,0x954E, 0,0xE7A5, 0, + 0,0x93D9,0x908B, 0, 0,0x9278, 0,0x8BF6, + 0,0xE7A4,0x9756,0x895E, 0,0x95D5,0x89DF,0xE79F, +0xE7A0,0xE7A1,0xE7A2,0x93B9,0x9242,0x88E1,0xE7A6, 0, +0xE7A7,0xEAA1, 0, 0,0x91BB, 0,0xE7A8, 0, +0x8993,0x916B, 0,0x8CAD, 0,0x9779, 0, 0, +0xE7A9,0x934B, 0, 0, 0,0x9198,0x8ED5,0xE7AA, + 0, 0,0xE7AD, 0, 0,0x8F85,0xE7AB,0x914A, +0x9149, 0,0x88E2, 0,0x97C9,0xE7AF, 0,0x94F0, +0xE7B1,0xE7B0,0xE7AE,0xE284,0x8AD2, 0, 0,0xE78E, + 0,0xE7B3,0xE7B2, 0, 0, 0, 0,0xE7B4, + 0,0x9757, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x93DF, 0, 0,0x964D, 0, +0xE7B5, 0,0x8ED7, 0, 0, 0, 0,0xE7B6, + 0,0xE7B7, 0, 0, 0,0xE7B8, 0, 0, +0x9340, 0, 0, 0, 0, 0, 0, 0, + 0,0x88E8, 0, 0, 0, 0, 0, 0, + 0, 0,0x8D78, 0, 0, 0,0x9859, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE7BC, 0, 0, 0, 0, + 0,0x8C53,0xE7B9, 0,0xE7BA, 0, 0, 0, +0x9594, 0, 0, 0, 0,0x8A73, 0, 0, + 0, 0, 0, 0, 0,0x9758, 0,0x8BBD, + 0, 0, 0, 0, 0,0x9373, 0, 0, + 0, 0,0xE7BD, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE7BE, 0, 0, 0, 0, 0, + 0,0xE7BF, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x9341, 0, 0, +0xE7C1, 0,0xE7C0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x93D1,0xE7C2,0x8F55,0x8EDE,0x947A,0x9291, 0, + 0, 0,0x8EF0, 0,0x908C, 0,0xE7C3, 0, +0xE7C4, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x907C,0xE7C5, 0,0xE7C6, 0, 0, + 0,0xE7C7,0x978F, 0,0x8F56, 0, 0, 0, + 0, 0,0xE7C9,0xE7C8, 0,0x8D79, 0,0x8D93, +0x8E5F, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0xE7CC, 0, 0, 0, 0,0x8F86, + 0,0xE7CB, 0,0xE7CA, 0,0x91E7, 0, 0, +0x8CED, 0,0x90C1, 0, 0, 0, 0,0x94AE, + 0, 0, 0, 0,0x8F58, 0, 0, 0, + 0, 0,0xE7CD, 0,0x8FDD, 0, 0, 0, + 0, 0,0xE7D0,0xE7CE, 0, 0, 0,0xE7CF, + 0, 0, 0, 0,0xE7D2,0xE7D1, 0, 0, +0x8FF8, 0,0xE7D3, 0, 0, 0, 0, 0, +0xE7D4,0xE7D5, 0, 0, 0, 0,0x94CE,0x8DD1, +0x8EDF,0xE7D6, 0,0xE7D7,0x97A2,0x8F64,0x96EC,0x97CA, +0xE7D8,0x8BE0, 0, 0, 0, 0,0xE7D9, 0, +0x9342, 0, 0,0xE7DC,0x8A98,0x906A, 0,0xE7DA, + 0,0xE7DB, 0,0x92DE, 0, 0,0x9674,0x8BFA, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE7DE,0xE7DF, 0, + 0, 0, 0, 0,0xE7DD, 0, 0,0xE7E1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x93DD,0x8A62, 0, + 0,0xE7E5, 0, 0,0xE7E2,0xE7E4, 0, 0, + 0, 0, 0, 0, 0, 0,0xE7E0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE86E, 0, 0,0xE7E3, 0, 0, 0, + 0, 0, 0, 0,0x97E9, 0, 0,0x8CD8, + 0, 0, 0, 0, 0, 0, 0,0xE7ED, + 0, 0, 0, 0,0x9353,0xE7E8, 0, 0, +0xE7EB,0xE7E9, 0,0xE7EE, 0, 0, 0, 0, +0xE7EF, 0, 0, 0, 0, 0, 0,0xE7E7, + 0, 0,0xE7F4,0x8994, 0, 0,0xE7E6, 0, + 0, 0,0x94AB, 0,0xE7EA, 0,0x8FDE, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8D7A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x9667, 0, +0x8BE2, 0, 0,0x8F65, 0,0x93BA, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x914C, 0,0xE7F2, 0,0xE7EC,0xE7F1, 0, +0x96C1, 0,0x92B6,0xE7F3,0xE7F0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x914B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE7F7, + 0,0xE7F6, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE7F5, + 0, 0,0x964E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8F9B, 0, 0, 0, + 0,0xE7F8,0x95DD, 0, 0,0x8973, 0, 0, + 0, 0,0x9565,0x9292, 0, 0, 0, 0, +0x8B98, 0,0xE7FA, 0,0x8D7C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x8E4B, 0, + 0, 0, 0, 0, 0, 0, 0,0xE7F9, +0x908D, 0, 0, 0, 0, 0, 0, 0, +0x908E,0xE840,0xE842, 0, 0, 0, 0, 0, +0x8FF9, 0,0xE841,0xE843, 0, 0,0x8BD1, 0, +0x9564, 0, 0,0x8EE0,0x9842, 0,0xE7FC,0x8DF6, + 0, 0,0x985E, 0, 0,0xE845, 0, 0, + 0, 0,0xE844,0xE846, 0, 0, 0, 0, + 0, 0, 0, 0,0xE7FB, 0, 0, 0, + 0, 0, 0,0x93E7, 0,0x9374, 0, 0, + 0, 0, 0, 0,0x92D5, 0,0xE84B, 0, + 0, 0, 0,0x9262,0xE847, 0, 0, 0, +0xE848, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8C4C, 0,0xE84A, 0, + 0, 0, 0, 0, 0,0x8CAE, 0, 0, + 0, 0, 0, 0,0xE849, 0,0x8FDF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8A99, 0, 0, 0, + 0, 0, 0, 0,0xE84F, 0,0x8DBD,0x9199, + 0, 0,0x92C8, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8A5A, + 0, 0, 0, 0,0xE84D,0xE84E,0x92C1, 0, +0xE84C, 0, 0, 0, 0, 0, 0, 0, + 0,0xE850, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE856, 0, 0, 0, 0, +0xE859, 0, 0, 0, 0, 0, 0, 0, +0xE858,0x934C, 0, 0, 0, 0,0xE851,0xE852, +0xE855, 0, 0, 0, 0,0xE857, 0, 0, + 0,0x8BBE, 0, 0,0xE85A,0xE854, 0, 0, +0xE853, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE85E, 0, 0, 0,0xE85F, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE860, 0, 0,0xE85D,0xE85C, 0, 0, 0, +0x8FE0,0x93A8,0xE85B, 0, 0, 0, 0, 0, + 0,0xE864, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xE862, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE863,0xE861, 0, +0x91F6, 0,0xE865, 0, 0, 0, 0, 0, + 0,0xE866, 0, 0,0xE868, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8AD3,0xE867,0x96F8, 0, 0, 0, 0, + 0, 0,0xE873,0xE869, 0, 0,0xE86C, 0, +0xE86A, 0,0xE86B, 0, 0, 0, 0, 0, + 0, 0,0xE86D, 0, 0, 0, 0, 0, +0xE86F, 0, 0, 0, 0,0xE870, 0,0xE871, + 0, 0, 0, 0,0xE874,0xE872,0xE875,0xE877, + 0,0xE876}; + +/* page 6 0x9577-0x9FA0 */ +static uint16 tab_uni_sjis6[]={ +0x92B7, 0, 0, 0, 0, 0, 0, 0, + 0,0x96E5, 0,0xE878,0x914D, 0, 0, 0, +0xE879, 0,0x95C2,0xE87A,0x8A4A, 0, 0, 0, +0x895B, 0,0x8AD5, 0,0x8AD4,0xE87B, 0,0xE87C, + 0,0xE87D,0xE87E, 0, 0, 0, 0, 0, + 0,0xE880, 0,0x8AD6,0x8A74,0x8D7D,0x94B4, 0, +0xE882,0xE881, 0, 0, 0, 0,0xE883, 0, + 0, 0, 0,0x897B, 0, 0, 0, 0, + 0, 0,0xE886, 0,0xE885,0xE884, 0,0xE887, + 0, 0, 0, 0,0xE88A, 0, 0, 0, +0x88C5, 0, 0,0xE888, 0,0xE88C,0xE88B, 0, + 0, 0, 0, 0, 0,0xE88E,0xE88D,0xE88F, + 0,0x93AC, 0, 0, 0,0xE890, 0, 0, + 0, 0,0xE891,0xE893, 0, 0,0xE892, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x958C, 0, 0, + 0, 0,0xE894, 0, 0, 0, 0, 0, + 0,0xE895, 0,0x8DE3, 0, 0, 0,0xE896, +0xE897, 0, 0,0x9668, 0, 0, 0, 0, + 0, 0, 0, 0,0x916A, 0, 0, 0, +0x88A2,0x91C9, 0,0xE898, 0,0x958D, 0, 0, + 0, 0, 0, 0,0xE89B,0xE899,0x8D7E, 0, +0xE89A,0x8CC0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x95C3,0xE89D,0xE89F,0xE89E, +0xE8A0, 0, 0,0x8940,0x9077,0x8F9C,0x8AD7,0xE8A1, + 0, 0, 0,0x9486, 0,0xE8A3, 0, 0, + 0,0x8941, 0,0xE8A2,0x92C2, 0,0x97CB,0x93A9, +0xE89C,0x97A4, 0,0x8CAF, 0, 0,0x977A, 0, + 0, 0, 0, 0, 0, 0,0x8BF7,0x97B2, + 0,0x8C47, 0,0x91E0,0xE440, 0,0xE8A4,0x8A4B, +0x908F, 0, 0, 0, 0,0x8A75,0xE8A6, 0, +0xE8A7,0xE8A5,0x8C84, 0,0x8DDB,0x8FE1, 0, 0, + 0,0x8942, 0, 0,0x97D7, 0, 0, 0, +0xE8A9,0xE7AC, 0,0xE8A8, 0, 0, 0, 0, + 0,0xE8AC,0xE8AA,0xE8AB, 0,0xE8AD, 0,0xE8AE, +0x97EA,0xE8AF,0xE8B0, 0,0x90C7,0x94B9, 0, 0, + 0,0x909D,0x8AE5, 0, 0,0x9759,0x89EB,0x8F57, +0x8CD9, 0,0xE8B3, 0,0xE8B2,0x8E93,0xE8B4,0xE8B1, + 0, 0,0x8E47, 0, 0, 0,0xE8B8,0xE5AB, + 0, 0,0x99D4, 0,0x9097,0xE8B6, 0, 0, + 0, 0, 0,0x97A3,0x93EF, 0, 0, 0, + 0,0x894A, 0,0x90E1,0x8EB4, 0, 0, 0, + 0,0x95B5, 0,0x895F, 0, 0, 0,0x97EB, +0x978B, 0,0xE8B9, 0,0x9364, 0, 0, 0, + 0,0x8EF9, 0, 0, 0,0xE8BA, 0,0xE8BB, +0x906B,0xE8BC, 0,0x97EC, 0, 0,0xE8B7,0xE8BE, +0xE8C0, 0,0xE8BF, 0,0xE8BD, 0, 0,0xE8C1, + 0, 0,0xE8C2, 0, 0,0x919A, 0,0x89E0, + 0, 0, 0, 0, 0,0xE8C3, 0, 0, +0x96B6, 0, 0,0xE8C4, 0, 0, 0, 0, + 0,0xE8C5, 0,0x9849, 0, 0, 0, 0, + 0,0x9E50,0xE8C6, 0, 0, 0,0xE8C7,0xE8C8, + 0, 0, 0,0xE8CC, 0,0xE8C9, 0,0xE8CA, + 0,0xE8CB,0xE8CD, 0, 0, 0, 0, 0, + 0, 0, 0,0x90C2, 0, 0, 0,0x96F5, + 0, 0,0x90C3, 0, 0,0xE8CE, 0,0x94F1, + 0,0xE8CF,0xEA72,0x96CA, 0,0xE8D0, 0,0xE8D1, + 0,0xE8D2,0x8A76, 0,0xE8D4, 0,0x9078, 0, + 0, 0,0xE8D5, 0, 0,0x8C43, 0, 0, + 0, 0,0xE8D6,0xE8DA, 0,0xE8D8, 0, 0, + 0, 0,0xE8D9, 0, 0,0x8A93,0xE8D7,0xE8DB, + 0, 0, 0, 0,0xE8DC, 0,0x88C6, 0, +0xE8DD,0xE8DE, 0, 0, 0, 0, 0, 0, + 0,0x8FE2, 0, 0, 0,0xE8DF, 0, 0, + 0,0x8B66, 0, 0,0xE8E2, 0, 0,0xE8E1, + 0,0xE8E0, 0, 0,0xE691, 0,0x95DA, 0, + 0, 0, 0, 0,0xE8E3,0xE8E4, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE8E5, 0, 0,0xE8E6, + 0,0xE8E7, 0, 0,0xE8E8, 0, 0, 0, + 0, 0, 0, 0,0x8AD8, 0, 0, 0, + 0, 0, 0, 0, 0,0xE8E9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE8EA,0x9442, + 0, 0, 0,0xE8EC,0x89B9, 0,0xE8EF,0xE8EE, + 0, 0, 0, 0,0x8943, 0, 0, 0, +0x8BBF, 0,0x95C5,0x92B8,0x8DA0, 0,0x8D80,0x8F87, + 0,0x907B, 0, 0, 0,0xE8F1, 0, 0, +0xE8F0,0x9761,0x8AE6,0x94D0,0x93DA, 0, 0, 0, +0x909C,0x97CC, 0,0x8C7A, 0, 0, 0, 0, + 0, 0,0xE8F4, 0, 0,0xE8F3, 0, 0, + 0, 0, 0, 0, 0,0x966A,0x93AA, 0, + 0, 0, 0, 0, 0,0x896F, 0, 0, +0xE8F5,0xE8F2, 0, 0,0x9570,0x978A,0xE8F6, 0, + 0, 0, 0, 0, 0, 0, 0,0xE8F7, + 0, 0, 0, 0,0xE8F9,0x91E8,0x8A7A,0x8A7B, +0xE8F8, 0, 0, 0, 0,0x8AE7,0x8CB0, 0, + 0,0x8AE8, 0, 0,0x935E, 0, 0,0x97DE, + 0, 0, 0, 0, 0, 0, 0, 0, +0x8CDA, 0, 0, 0,0xE8FA, 0, 0, 0, +0xE8FB,0xE8FC,0xE940, 0,0xE942,0xE941, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x9597, 0,0xE943, 0, 0, 0, 0, +0xE944, 0,0xE945, 0, 0, 0, 0,0xE946, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE948,0xE947, 0,0xE949, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x94F2,0xE3CA, 0, 0, +0x9048, 0, 0,0x8B51, 0, 0, 0, 0, + 0, 0,0xE94A, 0,0xE94B, 0,0x99AA,0x9F5A, +0x94D1, 0, 0,0x88F9, 0,0x88B9, 0, 0, + 0, 0, 0, 0, 0,0x8E94,0x964F,0x8FFC, + 0, 0, 0, 0,0xE94C, 0,0x96DD, 0, + 0, 0,0xE94D,0x977B, 0,0x8961, 0, 0, + 0,0x8E60, 0,0xE94E,0x89EC,0xE94F, 0, 0, + 0,0xE950, 0, 0, 0, 0,0xE952,0xE953, + 0,0xE955,0xE951, 0, 0,0xE954, 0, 0, + 0,0x8AD9, 0, 0, 0,0xE956, 0,0xE957, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE958,0xE959, + 0, 0, 0,0xE95A, 0, 0,0xE95C, 0, + 0, 0,0xE95B, 0,0xE95E,0xE961, 0, 0, + 0,0xE95D,0xE95F,0xE960, 0, 0,0xE962, 0, +0x8BC0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x8EF1, +0xE963,0xE964,0x8D81, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE965, 0, + 0,0x8A5D, 0, 0, 0,0x946E,0xE966,0xE967, + 0, 0, 0, 0,0x9279,0x93E9, 0, 0, + 0, 0, 0, 0, 0,0xE968, 0, 0, + 0, 0,0x949D, 0, 0,0x91CA,0x8977,0x8BEC, + 0,0x8BED, 0, 0, 0, 0, 0, 0, + 0,0x9293,0xE96D,0x8BEE, 0, 0,0x89ED, 0, + 0,0xE96C, 0, 0,0xE96A, 0,0xE96B, 0, +0xE969, 0, 0,0xE977, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xE96E,0xE96F, + 0, 0,0xE970,0xE971, 0, 0, 0, 0, + 0,0xE973, 0, 0,0xE972, 0, 0, 0, +0x8F78, 0,0xE974, 0, 0, 0,0xE976, 0, + 0, 0, 0, 0, 0, 0, 0,0x8B52, +0xE975, 0, 0,0x919B,0x8CB1, 0, 0, 0, + 0, 0,0xE978, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x91CB, 0, 0,0xE979, 0, 0, 0, + 0,0x93AB, 0, 0, 0, 0, 0, 0, +0xE97A, 0, 0, 0, 0, 0, 0,0xE980, + 0,0xE97D, 0,0xE97C,0xE97E, 0,0xE97B, 0, + 0, 0, 0, 0, 0, 0,0xE982, 0, + 0, 0, 0, 0, 0, 0,0xE981, 0, +0xE984, 0, 0,0x8BC1,0xE983, 0, 0, 0, +0xE985, 0, 0,0xE986, 0,0xE988,0xE987, 0, + 0, 0,0xE989,0xE98B,0xE98A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x8D9C, 0, 0, 0, 0,0xE98C, 0, + 0,0xE98D, 0, 0, 0, 0, 0, 0, + 0,0x8A5B, 0, 0, 0,0xE98E, 0, 0, + 0,0xE98F, 0, 0, 0,0x9091, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xE990, 0,0xE991, 0,0xE992,0xE993, 0, 0, + 0,0x8D82, 0, 0, 0, 0, 0,0xE994, +0xE995, 0, 0,0xE996,0xE997, 0, 0,0xE998, + 0, 0, 0,0x94AF,0xE99A, 0,0x9545,0xE99B, +0xE999, 0,0xE99D, 0, 0,0xE99C, 0, 0, +0xE99E, 0, 0, 0,0xE99F, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE9A0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xE9A1, 0,0xE9A2, 0, 0, 0, 0, +0xE9A3, 0, 0,0xE9A4,0xE9A5, 0,0xE9A6, 0, +0xE9A7,0xE9A8,0xE9A9,0xE9AA, 0, 0, 0,0xE9AB, +0xE9AC, 0,0x9F54,0xE9AD, 0, 0, 0, 0, + 0, 0, 0, 0,0xE2F6,0x8B53, 0, 0, + 0, 0,0x8A40,0x8DB0,0xE9AF,0xE9AE,0x96A3, 0, + 0, 0, 0, 0, 0, 0,0xE9B1,0xE9B2, +0xE9B0, 0,0xE9B3, 0, 0,0x9682, 0, 0, + 0,0xE9B4, 0,0x8B9B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x9844, 0, 0, 0, 0,0xE9B5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE9B7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x88BC, + 0, 0,0xE9B8,0x95A9,0xE9B6, 0, 0,0xE9B9, +0xE9BA, 0, 0, 0, 0, 0, 0, 0, +0xE9BB,0xE9BC, 0, 0, 0, 0, 0, 0, + 0,0xE9BD, 0,0x968E,0x8E4C, 0,0x8DF8,0x914E, + 0, 0, 0, 0, 0,0xE9BE, 0, 0, + 0, 0,0xE9C1, 0, 0, 0, 0, 0, + 0,0xE9BF, 0, 0, 0, 0, 0,0xE9C2, + 0, 0,0x8CEF,0xE9C0, 0, 0, 0, 0, +0xE9C3, 0,0xE9C4,0xE9C5, 0,0xE9C9, 0,0x8E49, + 0, 0, 0, 0,0x91E2, 0, 0, 0, + 0, 0,0xE9CA,0xE9C7,0xE9C6,0xE9C8, 0, 0, + 0,0x8C7E, 0, 0, 0, 0, 0, 0, + 0,0xE9CE,0xE9CD,0xE9CC, 0, 0,0x88B1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xE9D8, 0,0xE9D4, + 0,0xE9D5,0xE9D1,0xE9D7, 0,0xE9D3,0x8A82, 0, + 0,0x986B, 0,0xE9D6,0xE9D2,0xE9D0,0xE9CF, 0, + 0, 0, 0, 0,0xE9DA, 0, 0, 0, + 0, 0,0xE9DD, 0, 0,0xE9DC,0xE9DB, 0, + 0, 0, 0, 0, 0, 0,0x9568,0xE9D9, +0x88F1,0xE9DE, 0,0xE9E0, 0, 0, 0, 0, + 0, 0,0x8A8F,0xE9CB,0x8956, 0, 0,0xE9E2, + 0, 0, 0, 0, 0, 0, 0,0xE9E1, +0xE9DF,0x924C, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x9690, 0, 0, 0, 0, +0x97D8, 0, 0,0xE9E3, 0, 0, 0, 0, + 0,0xE9E4, 0, 0, 0, 0, 0, 0, +0xE9E5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xE9E6, + 0,0xE9E7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x92B9, 0, +0xE9E8, 0,0x94B5, 0,0xE9ED,0xE9E9, 0, 0, + 0,0xE9EA, 0, 0,0x9650,0x96C2, 0,0x93CE, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0xE9EE, 0, 0,0xE9EF, +0x93BC,0xE9EC,0xE9EB, 0, 0, 0, 0,0x89A8, + 0, 0, 0,0xE9F7, 0, 0,0xE9F6, 0, + 0, 0, 0, 0,0x8995, 0, 0, 0, +0xE9F4, 0, 0, 0,0xE9F3, 0, 0,0xE9F1, + 0,0x8A9B, 0,0xE9F0,0x8EB0,0x89A7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x8D83, 0, 0,0xE9FA, +0xE9F9, 0,0xE9F8, 0, 0,0xE9F5, 0,0xE9FB, + 0,0xE9FC, 0, 0, 0, 0, 0, 0, + 0,0xEA44,0xEA43, 0, 0, 0, 0, 0, + 0, 0,0xEA45, 0, 0,0x894C,0xEA40,0xEA41, + 0,0x8D94,0x96B7, 0, 0,0xEA42, 0, 0, + 0, 0, 0, 0, 0,0x9651, 0, 0, +0xEA4A, 0, 0,0xEA46, 0, 0, 0, 0, + 0, 0, 0,0xEA4B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA48, 0,0xEA47, 0, 0, 0, 0, 0, +0x8C7B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xEA4C, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xEA4D, 0, 0, + 0, 0,0xEA4E, 0,0xEA49, 0, 0, 0, +0xE9F2, 0, 0,0xEA4F, 0,0x92DF, 0, 0, + 0,0xEA53, 0,0xEA54,0xEA52, 0, 0, 0, + 0, 0,0xEA51,0xEA57, 0,0xEA50, 0,0xEA55, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA56, 0, 0, 0,0xEA59, 0, 0, 0, + 0, 0,0xEA58, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0xEA5B, + 0, 0, 0, 0, 0, 0,0xEA5C, 0, +0xEA5D, 0, 0,0x9868, 0, 0, 0, 0, + 0,0xEA5A,0x91E9,0x8DEB, 0, 0,0xEA5E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xEA5F,0xEA60, 0, 0,0xEA61, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0xEA62, 0, + 0,0x8CB2,0xEA63, 0, 0, 0,0xEA64, 0, +0x8EAD, 0,0xEA65, 0, 0, 0, 0, 0, + 0,0xEA66, 0, 0,0xEA67,0xEA68, 0, 0, + 0, 0,0xEA6B,0xEA69,0x985B, 0,0xEA6A, 0, +0x97ED, 0, 0, 0, 0, 0,0xEA6C, 0, +0x97D9, 0, 0, 0, 0, 0,0xEA6D,0x949E, + 0, 0,0xEA6E,0xEA70, 0, 0,0xEA71, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xEA6F,0x8D8D,0x96CB,0x9683,0x9BF5, 0,0x9F80, +0x969B, 0, 0, 0, 0,0x89A9, 0, 0, + 0, 0, 0, 0, 0,0xEA73,0x8B6F,0xEA74, +0xEA75,0xEA76, 0,0x8D95, 0,0xEA77, 0, 0, + 0,0xE0D2,0x96D9, 0,0x91E1,0xEA78,0xEA7A,0xEA79, + 0,0xEA7B, 0, 0, 0, 0,0xEA7C, 0, + 0,0xEA7D, 0, 0, 0, 0, 0, 0, +0xEA7E, 0, 0, 0, 0,0xEA80, 0,0xEA81, +0xEA82, 0,0xEA83, 0,0xEA84,0xEA85,0xEA86, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA87,0xEA88, 0, 0, 0, 0, 0,0x9343, + 0, 0, 0, 0,0x8CDB, 0,0xEA8A, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x916C,0xEA8B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0xEA8C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x9540, 0, 0,0xEA8D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0xEA8E,0xE256, 0, 0,0xE6D8, +0xE8EB, 0, 0,0xEA8F, 0,0xEA90, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0xEA92,0xEA93,0xEA94,0x97EE,0xEA91, 0, 0,0xEA95, +0xEA96, 0, 0,0xEA98, 0,0xEA97, 0, 0, + 0, 0, 0,0xEA9A, 0, 0, 0,0xEA9B, +0xEA99, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x97B4, 0, + 0, 0, 0, 0, 0, 0,0xEA9C, 0, + 0, 0, 0, 0, 0,0xEA9D,0xE273, 0, + 0,0xEA9E}; + +/* page 7 0xFF01-0xFFE5 */ +static uint16 tab_uni_sjis7[]={ +0x8149, 0,0x8194,0x8190,0x8193,0x8195, 0,0x8169, +0x816A,0x8196,0x817B,0x8143, 0,0x8144,0x815E,0x824F, +0x8250,0x8251,0x8252,0x8253,0x8254,0x8255,0x8256,0x8257, +0x8258,0x8146,0x8147,0x8183,0x8181,0x8184,0x8148,0x8197, +0x8260,0x8261,0x8262,0x8263,0x8264,0x8265,0x8266,0x8267, +0x8268,0x8269,0x826A,0x826B,0x826C,0x826D,0x826E,0x826F, +0x8270,0x8271,0x8272,0x8273,0x8274,0x8275,0x8276,0x8277, +0x8278,0x8279,0x816D, 0,0x816E,0x814F,0x8151,0x814D, +0x8281,0x8282,0x8283,0x8284,0x8285,0x8286,0x8287,0x8288, +0x8289,0x828A,0x828B,0x828C,0x828D,0x828E,0x828F,0x8290, +0x8291,0x8292,0x8293,0x8294,0x8295,0x8296,0x8297,0x8298, +0x8299,0x829A,0x816F,0x8162,0x8170, 0, 0, 0, +0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8, +0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0, +0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8, +0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0, +0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8, +0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0, +0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8, +0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x8150, 0,0x818F}; + +static int func_uni_sjis_onechar(int code){ + if ((code>=0x005C)&&(code<=0x00F7)) + return(tab_uni_sjis0[code-0x005C]); + if ((code>=0x0391)&&(code<=0x0451)) + return(tab_uni_sjis1[code-0x0391]); + if ((code>=0x2010)&&(code<=0x2312)) + return(tab_uni_sjis2[code-0x2010]); + if ((code>=0x2500)&&(code<=0x266F)) + return(tab_uni_sjis3[code-0x2500]); + if ((code>=0x3000)&&(code<=0x30FE)) + return(tab_uni_sjis4[code-0x3000]); + if ((code>=0x4E00)&&(code<=0x9481)) + return(tab_uni_sjis5[code-0x4E00]); + if ((code>=0x9577)&&(code<=0x9FA0)) + return(tab_uni_sjis6[code-0x9577]); + if ((code>=0xFF01)&&(code<=0xFFE5)) + return(tab_uni_sjis7[code-0xFF01]); + return(0); +} + + +static int +my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + int code; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((int) wc < 0x80) + { + if (wc == 0x5c) + { + code= 0x815f; + goto mb; + } + s[0]= (uchar) wc; + return 1; + } + + if (!(code=func_uni_sjis_onechar(wc))) + return MY_CS_ILUNI; + + if (code>=0xA1 && code <= 0xDF) + { + s[0]= code; + return 1; + } + +mb: + if (s+2>e) + return MY_CS_TOOSMALL2; + + s[0]=code>>8; + s[1]=code&0xFF; + return 2; +} + + +static int +my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e){ + int hi; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((hi= s[0]) < 0x80) + { + pwc[0]=hi; + return 1; + } + + if (hi >= 0xA1 && hi <= 0xDF) + { + pwc[0]= func_sjis_uni_onechar(hi); + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + if (!(pwc[0]=func_sjis_uni_onechar((hi<<8)+s[1]))) + return -2; + + return 2; +} + +static +size_t my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *str_end) +{ + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; + + for (clen= 0; b < e; ) + { + if (*b >= 0xA1 && *b <= 0xDF) + { + clen++; + b++; + } + else if (*b > 0x7F) + { + clen+= 2; + b+= 2; + } + else + { + clen++; + b++; + } + } + return clen; +} + +/* + Returns a well formed length of a SJIS string. + CP932 additional characters are also accepted. +*/ +static +size_t my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t pos, int *error) +{ + const char *b0= b; + *error= 0; + while (pos-- && b < e) + { + if ((uchar) b[0] < 128) + { + /* Single byte ascii character */ + b++; + } + else if (issjishead((uchar)*b) && (e-b)>1 && issjistail((uchar)b[1])) + { + /* Double byte character */ + b+= 2; + } + else if (((uchar)*b) >= 0xA1 && ((uchar)*b) <= 0xDF) + { + /* Half width kana */ + b++; + } + else + { + /* Wrong byte sequence */ + *error= 1; + break; + } + } + return (size_t) (b - b0); +} + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_sjis, + my_strnncollsp_sjis, + my_strnxfrm_mb, + my_strnxfrmlen_simple, + my_like_range_sjis, + my_wildcmp_mb, /* wildcmp */ + my_strcasecmp_8bit, + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + ismbchar_sjis, + mbcharlen_sjis, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_sjis, + my_lengthsp_8bit, + my_numcells_sjis, + my_mb_wc_sjis, /* mb_wc */ + my_wc_mb_sjis, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_8bit, + my_casedn_str_8bit, + my_caseup_8bit, + my_casedn_8bit, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + +CHARSET_INFO my_charset_sjis_japanese_ci= +{ + 13,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_NONASCII, /* state */ + "sjis", /* cs name */ + "sjis_japanese_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_sjis, + to_lower_sjis, + to_upper_sjis, + sort_order_sjis, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + +CHARSET_INFO my_charset_sjis_bin= +{ + 88,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NONASCII, /* state */ + "sjis", /* cs name */ + "sjis_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_sjis, + to_lower_sjis, + to_upper_sjis, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 1, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_mb_bin_handler +}; + +#endif diff --git a/externals/mysql/strings/ctype-tis620.c b/externals/mysql/strings/ctype-tis620.c new file mode 100644 index 0000000..a151053 --- /dev/null +++ b/externals/mysql/strings/ctype-tis620.c @@ -0,0 +1,977 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Copyright (C) 2003 by Sathit Jittanupat + + * solving bug crash with long text field string + * sorting with different number of space or sign char. within string + + Copyright (C) 2001 by Korakot Chaovavanich and + Apisilp Trunganont + Copyright (C) 1998, 1999 by Pruet Boonma + Copyright (C) 1998 by Theppitak Karoonboonyanan + Copyright (C) 1989, 1991 by Samphan Raruenrom + + Permission to use, copy, modify, distribute and sell this software + and its documentation for any purpose is hereby granted without fee, + provided that the above copyright notice appear in all copies. + Samphan Raruenrom , Theppitak Karoonboonyanan , Pruet Boonma , + Korakot Chaovavanich and Apisilp Trunganont makes no representations + about the suitability of this software for any purpose. It is provided + "as is" without express or implied warranty. +*/ + + +/* + This file is basicly tis620 character sets with some extra functions + for tis-620 handling +*/ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. strxfrm_multiply_tis620=4 + */ + +#include +#include +#include "m_string.h" +#include "m_ctype.h" +#include "t_ctype.h" + +#ifdef HAVE_CHARSET_tis620 + +#define BUFFER_MULTIPLY 4 +#define M L_MIDDLE +#define U L_UPPER +#define L L_LOWER +#define UU L_UPRUPR +#define X L_MIDDLE + + +static int t_ctype[][TOT_LEVELS] = { + /*0x00*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x01*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x02*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x03*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x04*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x05*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x06*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x07*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x08*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x09*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x0A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x0B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x0C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x0D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x0E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x0F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x10*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x11*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x12*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x13*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x14*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x15*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x16*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x17*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x18*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x19*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x1A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x1B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x1C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x1D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x1E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x1F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x20*/ { IGNORE, IGNORE, L3_SPACE, IGNORE, M}, + /*0x21*/ { IGNORE, IGNORE, L3_EXCLAMATION, IGNORE, M }, + /*0x22*/ { IGNORE, IGNORE, L3_QUOTATION, IGNORE, M }, + /*0x23*/ { IGNORE, IGNORE, L3_NUMBER, IGNORE, M }, + /*0x24*/ { IGNORE, IGNORE, L3_DOLLAR, IGNORE, M }, + /*0x25*/ { IGNORE, IGNORE, L3_PERCENT, IGNORE, M }, + /*0x26*/ { IGNORE, IGNORE, L3_AMPERSAND, IGNORE, M }, + /*0x27*/ { IGNORE, IGNORE, L3_APOSTROPHE, IGNORE, M }, + /*0x28*/ { IGNORE, IGNORE, L3_L_PARANTHESIS, IGNORE, M }, + /*0x29*/ { IGNORE, IGNORE, L3_R_PARENTHESIS, IGNORE, M }, + /*0x2A*/ { IGNORE, IGNORE, L3_ASTERISK, IGNORE, M }, + /*0x2B*/ { IGNORE, IGNORE, L3_PLUS, IGNORE, M }, + /*0x2C*/ { IGNORE, IGNORE, L3_COMMA, IGNORE, M }, + /*0x2D*/ { IGNORE, IGNORE, L3_HYPHEN, IGNORE, M }, + /*0x2E*/ { IGNORE, IGNORE, L3_FULL_STOP, IGNORE, M }, + /*0x2F*/ { IGNORE, IGNORE, L3_SOLIDUS, IGNORE, M }, + /*0x30*/ { L1_08, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x31*/ { L1_18, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x32*/ { L1_28, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x33*/ { L1_38, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x34*/ { L1_48, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x35*/ { L1_58, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x36*/ { L1_68, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x37*/ { L1_78, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x38*/ { L1_88, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x39*/ { L1_98, L2_BLANK, L3_BLANK, L4_BLANK, M }, + /*0x3A*/ { IGNORE, IGNORE, L3_COLON, IGNORE, M }, + /*0x3B*/ { IGNORE, IGNORE, L3_SEMICOLON, IGNORE, M }, + /*0x3C*/ { IGNORE, IGNORE, L3_LESS_THAN, IGNORE, M }, + /*0x3D*/ { IGNORE, IGNORE, L3_EQUAL, IGNORE, M }, + /*0x3E*/ { IGNORE, IGNORE, L3_GREATER_THAN, IGNORE, M }, + /*0x3F*/ { IGNORE, IGNORE, L3_QUESTION, IGNORE, M }, + /*0x40*/ { IGNORE, IGNORE, L3_AT, IGNORE, M }, + /*0x41*/ { L1_A8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x42*/ { L1_B8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x43*/ { L1_C8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x44*/ { L1_D8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x45*/ { L1_E8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x46*/ { L1_F8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x47*/ { L1_G8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x48*/ { L1_H8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x49*/ { L1_I8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x4A*/ { L1_J8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x4B*/ { L1_K8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x4C*/ { L1_L8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x4D*/ { L1_M8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x4E*/ { L1_N8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x4F*/ { L1_O8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x50*/ { L1_P8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x51*/ { L1_Q8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x52*/ { L1_R8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x53*/ { L1_S8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x54*/ { L1_T8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x55*/ { L1_U8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x56*/ { L1_V8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x57*/ { L1_W8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x58*/ { L1_X8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x59*/ { L1_Y8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x5A*/ { L1_Z8, L2_BLANK, L3_BLANK, L4_CAP, M }, + /*0x5B*/ { IGNORE, IGNORE, L3_L_BRACKET, IGNORE, M }, + /*0x5C*/ { IGNORE, IGNORE, L3_BK_SOLIDUS, IGNORE, M }, + /*0x5D*/ { IGNORE, IGNORE, L3_R_BRACKET, IGNORE, M }, + /*0x5E*/ { IGNORE, IGNORE, L3_CIRCUMFLEX, IGNORE, M }, + /*0x5F*/ { IGNORE, IGNORE, L3_LOW_LINE, IGNORE, M }, + /*0x60*/ { IGNORE, IGNORE, L3_GRAVE, IGNORE, M }, + /*0x61*/ { L1_A8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x62*/ { L1_B8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x63*/ { L1_C8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x64*/ { L1_D8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x65*/ { L1_E8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x66*/ { L1_F8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x67*/ { L1_G8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x68*/ { L1_H8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x69*/ { L1_I8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x6A*/ { L1_J8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x6B*/ { L1_K8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x6C*/ { L1_L8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x6D*/ { L1_M8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x6E*/ { L1_N8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x6F*/ { L1_O8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x70*/ { L1_P8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x71*/ { L1_Q8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x72*/ { L1_R8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x73*/ { L1_S8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x74*/ { L1_T8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x75*/ { L1_U8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x76*/ { L1_V8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x77*/ { L1_W8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x78*/ { L1_X8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x79*/ { L1_Y8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x7A*/ { L1_Z8, L2_BLANK, L3_BLANK, L4_MIN, M }, + /*0x7B*/ { IGNORE, IGNORE, L3_L_BRACE, IGNORE, M }, + /*0x7C*/ { IGNORE, IGNORE, L3_V_LINE, IGNORE, M }, + /*0x7D*/ { IGNORE, IGNORE, L3_R_BRACE, IGNORE, M }, + /*0x7E*/ { IGNORE, IGNORE, L3_TILDE, IGNORE, M }, + /*0x7F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x80*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x81*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x82*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x83*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x84*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x85*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x86*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x87*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x88*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x89*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x8A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x8B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x8C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x8D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x8E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x8F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x90*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x91*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x92*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x93*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x94*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x95*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x96*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x97*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x98*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x99*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x9A*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x9B*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x9C*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x9D*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x9E*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0x9F*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0xA0*/ { IGNORE, IGNORE, L3_NB_SACE, IGNORE, X }, + /*0xA1*/ { L1_KO_KAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA2*/ { L1_KHO_KHAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA3*/ { L1_KHO_KHUAT, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA4*/ { L1_KHO_KHWAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA5*/ { L1_KHO_KHON, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA6*/ { L1_KHO_RAKHANG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA7*/ { L1_NGO_NGU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA8*/ { L1_CHO_CHAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xA9*/ { L1_CHO_CHING, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xAA*/ { L1_CHO_CHANG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xAB*/ { L1_SO_SO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xAC*/ { L1_CHO_CHOE, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xAD*/ { L1_YO_YING, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xAE*/ { L1_DO_CHADA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xAF*/ { L1_TO_PATAK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB0*/ { L1_THO_THAN, L2_BLANK,L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB1*/ { L1_THO_NANGMONTHO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB2*/ { L1_THO_PHUTHAO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB3*/ { L1_NO_NEN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB4*/ { L1_DO_DEK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB5*/ { L1_TO_TAO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB6*/ { L1_THO_THUNG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB7*/ { L1_THO_THAHAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB8*/ { L1_THO_THONG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xB9*/ { L1_NO_NU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xBA*/ { L1_BO_BAIMAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xBB*/ { L1_PO_PLA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xBC*/ { L1_PHO_PHUNG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xBD*/ { L1_FO_FA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xBE*/ { L1_PHO_PHAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xBF*/ { L1_FO_FAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC0*/ { L1_PHO_SAMPHAO, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC1*/ { L1_MO_MA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC2*/ { L1_YO_YAK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC3*/ { L1_RO_RUA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC4*/ { L1_RU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC5*/ { L1_LO_LING, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC6*/ { L1_LU, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC7*/ { L1_WO_WAEN, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC8*/ { L1_SO_SALA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xC9*/ { L1_SO_RUSI, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xCA*/ { L1_SO_SUA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xCB*/ { L1_HO_HIP, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xCC*/ { L1_LO_CHULA, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xCD*/ { L1_O_ANG, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xCE*/ { L1_HO_NOKHUK, L2_BLANK, L3_BLANK, L4_BLANK, M | _consnt}, + /*0xCF*/ { IGNORE, IGNORE, L3_PAIYAN_NOI, IGNORE, M}, + /*0xD0*/ { L1_SARA_A, L2_BLANK, L3_BLANK, L4_BLANK, M | _fllwvowel}, + /*0xD1*/ { L1_MAI_HAN_AKAT, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, + /*0xD2*/ { L1_SARA_AA, L2_BLANK, L3_BLANK, L4_BLANK, M | _fllwvowel}, + /*0xD3*/ { L1_SARA_AM, L2_BLANK, L3_BLANK, L4_BLANK, M | _fllwvowel}, + /*0xD4*/ { L1_SARA_I, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, + /*0xD5*/ { L1_SARA_II, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, + /*0xD6*/ { L1_SARA_UE, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, + /*0xD7*/ { L1_SARA_UEE, L2_BLANK, L3_BLANK, L4_BLANK, U | _uprvowel}, + /*0xD8*/ { L1_SARA_U, L2_BLANK, L3_BLANK, L4_BLANK, L | _lwrvowel}, + /*0xD9*/ { L1_SARA_UU, L2_BLANK, L3_BLANK, L4_BLANK, L | _lwrvowel}, + /*0xDA*/ { IGNORE, L2_PINTHU, L3_BLANK, L4_BLANK, L }, + /*0xDB*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0xDC*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0xDD*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0xDE*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0xDF*/ { IGNORE, IGNORE, L3_BAHT, IGNORE, M}, + /*0xE0*/ { L1_SARA_E, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, + /*0xE1*/ { L1_SARA_AE, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, + /*0xE2*/ { L1_SARA_O, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, + /*0xE3*/ { L1_SARA_AI_MAIMUAN, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, + /*0xE4*/ { L1_SARA_AI_MAIMALAI, L2_BLANK, L3_BLANK, L4_BLANK, M | _ldvowel }, + /*0xE5*/ { L1_SARA_AA, L2_BLANK, L3_BLANK, L4_EXT, M | _fllwvowel }, + /*0xE6*/ { IGNORE, IGNORE, L3_MAI_YAMOK, IGNORE, M | _stone }, + /*0xE7*/ { IGNORE, L2_TYKHU, L3_BLANK, L4_BLANK, U | _diacrt1 | _stone }, + /*0xE8*/ { IGNORE, L2_TONE1, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, + /*0xE9*/ { IGNORE, L2_TONE2, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, + /*0xEA*/ { IGNORE, L2_TONE3, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, + /*0xEB*/ { IGNORE, L2_TONE4, L3_BLANK, L4_BLANK, UU | _tone | _combine | _stone }, + /*0xEC*/ { IGNORE, L2_GARAN, L3_BLANK, L4_BLANK, UU | _diacrt2 | _combine | _stone }, + /*0xED*/ { L1_NKHIT, L2_BLANK, L3_BLANK, L4_BLANK, U | _diacrt1 }, + /*0xEE*/ { IGNORE, L2_YAMAK, L3_BLANK, L4_BLANK, U | _diacrt1 }, + /*0xEF*/ { IGNORE, IGNORE, L3_FONGMAN, IGNORE, M }, + /*0xF0*/ { L1_08, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF1*/ { L1_18, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF2*/ { L1_28, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF3*/ { L1_38, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF4*/ { L1_48, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF5*/ { L1_58, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF6*/ { L1_68, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF7*/ { L1_78, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF8*/ { L1_88, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xF9*/ { L1_98, L2_THAII, L3_BLANK, L4_BLANK, M | _tdig }, + /*0xFA*/ { IGNORE, IGNORE, L3_ANGKHANKHU, IGNORE, X }, + /*0xFB*/ { IGNORE, IGNORE, L3_KHOMUT, IGNORE, X }, + /*0xFC*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0xFD*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /*0xFE*/ { IGNORE, IGNORE, IGNORE, IGNORE, X }, + /* Utilize 0xFF for max_sort_chr in my_like_range_tis620 */ + /*0xFF*/ { 255 /*IGNORE*/, IGNORE, IGNORE, IGNORE, X }, +}; + +static uchar NEAR ctype_tis620[257] = +{ + 0, /* For standard library */ + 32,32,32,32,32,32,32,32,32,40,40,40,40,40,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 72,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 132,132,132,132,132,132,132,132,132,132,16,16,16,16,16,16, + 16,129,129,129,129,129,129,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,16,16,16,16,16, + 16,130,130,130,130,130,130,2,2,2,2,2,2,2,2,2, + 2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,32, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +}; + +static uchar NEAR to_lower_tis620[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR to_upper_tis620[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + +static uchar NEAR sort_order_tis620[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '\\', ']', '[', '^', '_', + 'E', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', 'Y', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377', +}; + + +/* + Convert thai string to "Standard C String Function" sortable string + + SYNOPSIS + thai2sortable() + tstr String to convert. Does not have to end with \0 + len Length of tstr +*/ + +static size_t thai2sortable(uchar *tstr, size_t len) +{ + uchar *p; + int tlen; + uchar l2bias; + + tlen= len; + l2bias= 256 - 8; + for (p= tstr; tlen > 0; p++, tlen--) + { + uchar c= *p; + + if (isthai(c)) + { + int *t_ctype0= t_ctype[c]; + + if (isconsnt(c)) + l2bias -= 8; + if (isldvowel(c) && tlen != 1 && isconsnt(p[1])) + { + /* simply swap between leading-vowel and consonant */ + *p= p[1]; + p[1]= c; + tlen--; + p++; + continue; + } + + /* if found level 2 char (L2_GARAN,L2_TONE*,L2_TYKHU) move to last */ + if (t_ctype0[1] >= L2_GARAN) + { + /* + l2bias use to control position weight of l2char + example (*=l2char) XX*X must come before X*XX + */ + memmove((char*) p, (char*) (p+1), tlen-1); + tstr[len-1]= l2bias + t_ctype0[1]- L2_GARAN +1; + p--; + continue; + } + } + else + { + l2bias-= 8; + *p= to_lower_tis620[c]; + } + } + return len; +} + + +/* + strncoll() replacement, compare 2 string, both are converted to sortable + string + + NOTE: + We can't cut strings at end \0 as this would break comparision with + LIKE characters, where the min range is stored as end \0 + + Arg: 2 Strings and it compare length + Ret: strcmp result +*/ + +static +int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, + my_bool s2_is_prefix) +{ + uchar buf[80] ; + uchar *tc1, *tc2; + int i; + + if (s2_is_prefix && len1 > len2) + len1= len2; + + tc1= buf; + if ((len1 + len2 +2) > (int) sizeof(buf)) + tc1= (uchar*) my_str_malloc(len1+len2+2); + tc2= tc1 + len1+1; + memcpy((char*) tc1, (char*) s1, len1); + tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */ + memcpy((char *)tc2, (char *)s2, len2); + tc2[len2]= 0; /* put end of string */ + thai2sortable(tc1, len1); + thai2sortable(tc2, len2); + i= strcmp((char*)tc1, (char*)tc2); + if (tc1 != buf) + my_str_free(tc1); + return i; +} + + +static +int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), + const uchar *a0, size_t a_length, + const uchar *b0, size_t b_length, + my_bool diff_if_only_endspace_difference) +{ + uchar buf[80], *end, *a, *b, *alloced= NULL; + size_t length; + int res= 0; + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + a= buf; + if ((a_length + b_length +2) > (int) sizeof(buf)) + alloced= a= (uchar*) my_str_malloc(a_length+b_length+2); + + b= a + a_length+1; + memcpy((char*) a, (char*) a0, a_length); + a[a_length]= 0; /* if length(a0)> len1, need to put 'end of string' */ + memcpy((char *)b, (char *)b0, b_length); + b[b_length]= 0; /* put end of string */ + a_length= thai2sortable(a, a_length); + b_length= thai2sortable(b, b_length); + + end= a + (length= min(a_length, b_length)); + while (a < end) + { + if (*a++ != *b++) + { + res= ((int) a[-1] - (int) b[-1]); + goto ret; + } + } + if (a_length != b_length) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + /* + Check the next not space character of the longer key. If it's < ' ', + then it's smaller than the other key. + */ + if (a_length < b_length) + { + /* put shorter key in s */ + a_length= b_length; + a= b; + swap= -1; /* swap sign of result */ + res= -res; + } + for (end= a + a_length-length; a < end ; a++) + { + if (*a != ' ') + { + res= (*a < ' ') ? -swap : swap; + goto ret; + } + } + } + +ret: + + if (alloced) + my_str_free(alloced); + return res; +} + + +/* + strnxfrm replacment, convert Thai string to sortable string + + Arg: Destination buffer, source string, dest length and source length + Ret: Conveted string size +*/ + +static +size_t my_strnxfrm_tis620(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + size_t len, dstlen0= dstlen; + len= (uint) (strmake((char*) dst, (char*) src, min(dstlen, srclen)) - + (char*) dst); + len= thai2sortable(dst, len); + set_if_smaller(dstlen, nweights); + set_if_smaller(len, dstlen); + len= my_strxfrm_pad_desc_and_reverse(cs, dst, dst + len, dst + dstlen, + dstlen - len, flags, 0); + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && len < dstlen0) + { + uint fill_length= dstlen0 - len; + cs->cset->fill(cs, (char*) dst + len, fill_length, cs->pad_char); + len= dstlen0; + } + return len; +} + + +static unsigned short cs_to_uni[256]={ +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0xFFFD,0x0E01,0x0E02,0x0E03,0x0E04,0x0E05,0x0E06,0x0E07, +0x0E08,0x0E09,0x0E0A,0x0E0B,0x0E0C,0x0E0D,0x0E0E,0x0E0F, +0x0E10,0x0E11,0x0E12,0x0E13,0x0E14,0x0E15,0x0E16,0x0E17, +0x0E18,0x0E19,0x0E1A,0x0E1B,0x0E1C,0x0E1D,0x0E1E,0x0E1F, +0x0E20,0x0E21,0x0E22,0x0E23,0x0E24,0x0E25,0x0E26,0x0E27, +0x0E28,0x0E29,0x0E2A,0x0E2B,0x0E2C,0x0E2D,0x0E2E,0x0E2F, +0x0E30,0x0E31,0x0E32,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37, +0x0E38,0x0E39,0x0E3A,0xFFFD,0xFFFD,0xFFFD,0xFFFD,0x0E3F, +0x0E40,0x0E41,0x0E42,0x0E43,0x0E44,0x0E45,0x0E46,0x0E47, +0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D,0x0E4E,0x0E4F, +0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57, +0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFD,0xFFFD,0xFFFD,0xFFFD +}; +static uchar pl00[256]={ +0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; +static uchar pl0E[256]={ +0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, +0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, +0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, +0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, +0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, +0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, +0x00D8,0x00D9,0x00DA,0x0000,0x0000,0x0000,0x0000,0x00DF, +0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, +0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, +0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, +0x00F8,0x00F9,0x00FA,0x00FB,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; +static uchar plFF[256]={ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x00FF,0x0000,0x0000 +}; +static uchar *uni_to_cs[256]={ +pl00,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,pl0E,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,plFF +}; + + +static +int my_mb_wc_tis620(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *wc, + const uchar *str, + const uchar *end __attribute__((unused))) +{ + if (str >= end) + return MY_CS_TOOSMALL; + + *wc=cs_to_uni[*str]; + return (!wc[0] && str[0]) ? -1 : 1; +} + +static +int my_wc_mb_tis620(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, + uchar *str, + uchar *end __attribute__((unused))) +{ + uchar *pl; + + if (str >= end) + return MY_CS_TOOSMALL; + + pl= uni_to_cs[(wc>>8) & 0xFF]; + str[0]= pl ? pl[wc & 0xFF] : '\0'; + return (!str[0] && wc) ? MY_CS_ILUNI : 1; +} + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_tis620, + my_strnncollsp_tis620, + my_strnxfrm_tis620, + my_strnxfrmlen_simple, + my_like_range_simple, + my_wildcmp_8bit, /* wildcmp */ + my_strcasecmp_8bit, + my_instr_simple, /* QQ: To be fixed */ + my_hash_sort_simple, + my_propagate_simple +}; + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + NULL, /* ismbchar */ + my_mbcharlen_8bit, /* mbcharlen */ + my_numchars_8bit, + my_charpos_8bit, + my_well_formed_len_8bit, + my_lengthsp_8bit, + my_numcells_8bit, + my_mb_wc_tis620, /* mb_wc */ + my_wc_mb_tis620, /* wc_mb */ + my_mb_ctype_8bit, + my_caseup_str_8bit, + my_casedn_str_8bit, + my_caseup_8bit, + my_casedn_8bit, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + + +CHARSET_INFO my_charset_tis620_thai_ci= +{ + 18,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */ + "tis620", /* cs name */ + "tis620_thai_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_tis620, + to_lower_tis620, + to_upper_tis620, + sort_order_tis620, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 4, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + +CHARSET_INFO my_charset_tis620_bin= +{ + 89,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "tis620", /* cs name */ + "tis620_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_tis620, + to_lower_tis620, + to_upper_tis620, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_8bit_bin_handler +}; + + +#endif diff --git a/externals/mysql/strings/ctype-uca.c b/externals/mysql/strings/ctype-uca.c new file mode 100644 index 0000000..48a43fa --- /dev/null +++ b/externals/mysql/strings/ctype-uca.c @@ -0,0 +1,11672 @@ +/* Copyright (C) 2004 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* + UCA (Unicode Collation Algorithm) support. + Written by Alexander Barkov + + Currently supports only subset of the full UCA: + - Only Primary level key comparison + - Basic Latin letters contraction is implemented + - Variable weighting is done for Non-ignorable option + + Features that are not implemented yet: + - No Normalization From D is done + + No decomposition is done + + No Thai/Lao orderding is done + - No combining marks processing is done +*/ + + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_UCA_COLLATIONS + +#define MY_UCA_NPAGES 256 +#define MY_UCA_NCHARS 256 +#define MY_UCA_CMASK 255 +#define MY_UCA_PSHIFT 8 + +uint16 page000data[]= { /* 0000 (4 weights per char) */ +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0201,0x0000,0x0000,0x0000, +0x0202,0x0000,0x0000,0x0000, 0x0203,0x0000,0x0000,0x0000, +0x0204,0x0000,0x0000,0x0000, 0x0205,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000, 0x0251,0x0000,0x0000,0x0000, +0x027E,0x0000,0x0000,0x0000, 0x02D2,0x0000,0x0000,0x0000, +0x0E0F,0x0000,0x0000,0x0000, 0x02D3,0x0000,0x0000,0x0000, +0x02CF,0x0000,0x0000,0x0000, 0x0277,0x0000,0x0000,0x0000, +0x0288,0x0000,0x0000,0x0000, 0x0289,0x0000,0x0000,0x0000, +0x02C8,0x0000,0x0000,0x0000, 0x0428,0x0000,0x0000,0x0000, +0x022F,0x0000,0x0000,0x0000, 0x0221,0x0000,0x0000,0x0000, +0x025D,0x0000,0x0000,0x0000, 0x02CC,0x0000,0x0000,0x0000, +0x0E29,0x0000,0x0000,0x0000, 0x0E2A,0x0000,0x0000,0x0000, +0x0E2B,0x0000,0x0000,0x0000, 0x0E2C,0x0000,0x0000,0x0000, +0x0E2D,0x0000,0x0000,0x0000, 0x0E2E,0x0000,0x0000,0x0000, +0x0E2F,0x0000,0x0000,0x0000, 0x0E30,0x0000,0x0000,0x0000, +0x0E31,0x0000,0x0000,0x0000, 0x0E32,0x0000,0x0000,0x0000, +0x023D,0x0000,0x0000,0x0000, 0x023A,0x0000,0x0000,0x0000, +0x042C,0x0000,0x0000,0x0000, 0x042D,0x0000,0x0000,0x0000, +0x042E,0x0000,0x0000,0x0000, 0x0255,0x0000,0x0000,0x0000, +0x02C7,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E4A,0x0000,0x0000,0x0000, 0x0E60,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000, 0x0E8B,0x0000,0x0000,0x0000, +0x0EB9,0x0000,0x0000,0x0000, 0x0EC1,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000, 0x0EFB,0x0000,0x0000,0x0000, +0x0F10,0x0000,0x0000,0x0000, 0x0F21,0x0000,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000, 0x0F5B,0x0000,0x0000,0x0000, +0x0F64,0x0000,0x0000,0x0000, 0x0F82,0x0000,0x0000,0x0000, +0x0FA7,0x0000,0x0000,0x0000, 0x0FB4,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000, 0x0FEA,0x0000,0x0000,0x0000, +0x1002,0x0000,0x0000,0x0000, 0x101F,0x0000,0x0000,0x0000, +0x1044,0x0000,0x0000,0x0000, 0x1051,0x0000,0x0000,0x0000, +0x105A,0x0000,0x0000,0x0000, 0x105E,0x0000,0x0000,0x0000, +0x106A,0x0000,0x0000,0x0000, 0x028A,0x0000,0x0000,0x0000, +0x02CE,0x0000,0x0000,0x0000, 0x028B,0x0000,0x0000,0x0000, +0x020F,0x0000,0x0000,0x0000, 0x021B,0x0000,0x0000,0x0000, +0x020C,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E4A,0x0000,0x0000,0x0000, 0x0E60,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000, 0x0E8B,0x0000,0x0000,0x0000, +0x0EB9,0x0000,0x0000,0x0000, 0x0EC1,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000, 0x0EFB,0x0000,0x0000,0x0000, +0x0F10,0x0000,0x0000,0x0000, 0x0F21,0x0000,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000, 0x0F5B,0x0000,0x0000,0x0000, +0x0F64,0x0000,0x0000,0x0000, 0x0F82,0x0000,0x0000,0x0000, +0x0FA7,0x0000,0x0000,0x0000, 0x0FB4,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000, 0x0FEA,0x0000,0x0000,0x0000, +0x1002,0x0000,0x0000,0x0000, 0x101F,0x0000,0x0000,0x0000, +0x1044,0x0000,0x0000,0x0000, 0x1051,0x0000,0x0000,0x0000, +0x105A,0x0000,0x0000,0x0000, 0x105E,0x0000,0x0000,0x0000, +0x106A,0x0000,0x0000,0x0000, 0x028C,0x0000,0x0000,0x0000, +0x0430,0x0000,0x0000,0x0000, 0x028D,0x0000,0x0000,0x0000, +0x0433,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0206,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000, 0x0252,0x0000,0x0000,0x0000, +0x0E0E,0x0000,0x0000,0x0000, 0x0E10,0x0000,0x0000,0x0000, +0x0E0D,0x0000,0x0000,0x0000, 0x0E11,0x0000,0x0000,0x0000, +0x0431,0x0000,0x0000,0x0000, 0x02C2,0x0000,0x0000,0x0000, +0x0214,0x0000,0x0000,0x0000, 0x02C5,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000, 0x0286,0x0000,0x0000,0x0000, +0x042F,0x0000,0x0000,0x0000, 0x0220,0x0000,0x0000,0x0000, +0x02C6,0x0000,0x0000,0x0000, 0x0210,0x0000,0x0000,0x0000, +0x034A,0x0000,0x0000,0x0000, 0x0429,0x0000,0x0000,0x0000, +0x0E2B,0x0000,0x0000,0x0000, 0x0E2C,0x0000,0x0000,0x0000, +0x020D,0x0000,0x0000,0x0000, 0x10F8,0x0000,0x0000,0x0000, +0x02C3,0x0000,0x0000,0x0000, 0x0267,0x0000,0x0000,0x0000, +0x0219,0x0000,0x0000,0x0000, 0x0E2A,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x0287,0x0000,0x0000,0x0000, +0x0E2A,0x02CD,0x0E2D,0x0000, 0x0E2A,0x02CD,0x0E2B,0x0000, +0x0E2C,0x02CD,0x0E2D,0x0000, 0x0256,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E38,0x0000,0x0000,0x0000, 0x0E60,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000, 0x0E8B,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000, 0x0E8B,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000, 0x0EFB,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000, 0x0EFB,0x0000,0x0000,0x0000, +0x0E86,0x0000,0x0000,0x0000, 0x0F64,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x0F82,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x0F82,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x042B,0x0000,0x0000,0x0000, +0x0F8D,0x0000,0x0000,0x0000, 0x101F,0x0000,0x0000,0x0000, +0x101F,0x0000,0x0000,0x0000, 0x101F,0x0000,0x0000,0x0000, +0x101F,0x0000,0x0000,0x0000, 0x105E,0x0000,0x0000,0x0000, +0x1094,0x0000,0x0000,0x0000, 0x0FEA,0x0FEA,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E38,0x0000,0x0000,0x0000, 0x0E60,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000, 0x0E8B,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000, 0x0E8B,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000, 0x0EFB,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000, 0x0EFB,0x0000,0x0000,0x0000, +0x0E86,0x0000,0x0000,0x0000, 0x0F64,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x0F82,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x0F82,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x042A,0x0000,0x0000,0x0000, +0x0F8D,0x0000,0x0000,0x0000, 0x101F,0x0000,0x0000,0x0000, +0x101F,0x0000,0x0000,0x0000, 0x101F,0x0000,0x0000,0x0000, +0x101F,0x0000,0x0000,0x0000, 0x105E,0x0000,0x0000,0x0000, +0x1094,0x0000,0x0000,0x0000, 0x105E,0x0000,0x0000,0x0000 +}; + +uint16 page001data[]= { /* 0100 (3 weights per char) */ +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E60,0x0000,0x0000, 0x0E60,0x0000,0x0000, 0x0E60,0x0000,0x0000, +0x0E60,0x0000,0x0000, 0x0E60,0x0000,0x0000, 0x0E60,0x0000,0x0000, +0x0E60,0x0000,0x0000, 0x0E60,0x0000,0x0000, 0x0E6D,0x0000,0x0000, +0x0E6D,0x0000,0x0000, 0x0E72,0x0000,0x0000, 0x0E72,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0EC1,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0EC1,0x0000,0x0000, 0x0EC1,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0EC1,0x0000,0x0000, 0x0EC1,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0EED,0x0000,0x0000, +0x0EED,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0EFB,0x0000,0x0000, 0x0EFF,0x0000,0x0000, 0x0EFB,0x0F10,0x0000, +0x0EFB,0x0F10,0x0000, 0x0F10,0x0000,0x0000, 0x0F10,0x0000,0x0000, +0x0F21,0x0000,0x0000, 0x0F21,0x0000,0x0000, 0x0FBC,0x0000,0x0000, +0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, +0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, +0x0F2E,0x0267,0x0000, 0x0F2E,0x0267,0x0000, 0x0F36,0x0000,0x0000, +0x0F36,0x0000,0x0000, 0x0F64,0x0000,0x0000, 0x0F64,0x0000,0x0000, +0x0F64,0x0000,0x0000, 0x0F64,0x0000,0x0000, 0x0F64,0x0000,0x0000, +0x0F64,0x0000,0x0000, 0x10B1,0x0F64,0x0000, 0x0F7E,0x0000,0x0000, +0x0F7E,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0E8B,0x0000, 0x0F82,0x0E8B,0x0000, +0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x1002,0x0000,0x0000, +0x1002,0x0000,0x0000, 0x1002,0x0000,0x0000, 0x1002,0x0000,0x0000, +0x1007,0x0000,0x0000, 0x1007,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x1051,0x0000,0x0000, +0x1051,0x0000,0x0000, 0x105E,0x0000,0x0000, 0x105E,0x0000,0x0000, +0x105E,0x0000,0x0000, 0x106A,0x0000,0x0000, 0x106A,0x0000,0x0000, +0x106A,0x0000,0x0000, 0x106A,0x0000,0x0000, 0x106A,0x0000,0x0000, +0x106A,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x0E52,0x0000,0x0000, +0x0E58,0x0000,0x0000, 0x0E5C,0x0000,0x0000, 0x0E5C,0x0000,0x0000, +0x10A8,0x0000,0x0000, 0x10A8,0x0000,0x0000, 0x0F92,0x0000,0x0000, +0x0E65,0x0000,0x0000, 0x0E65,0x0000,0x0000, 0x0E76,0x0000,0x0000, +0x0E7A,0x0000,0x0000, 0x0E7E,0x0000,0x0000, 0x0E7E,0x0000,0x0000, +0x106A,0x1051,0x0000, 0x0E90,0x0000,0x0000, 0x0E94,0x0000,0x0000, +0x0E98,0x0000,0x0000, 0x0EBD,0x0000,0x0000, 0x0EBD,0x0000,0x0000, +0x0ED1,0x0000,0x0000, 0x0ED9,0x0000,0x0000, 0x0EE9,0x0000,0x0000, +0x0F0C,0x0000,0x0000, 0x0F08,0x0000,0x0000, 0x0F26,0x0000,0x0000, +0x0F26,0x0000,0x0000, 0x0F3B,0x0000,0x0000, 0x0F53,0x0000,0x0000, +0x1037,0x0000,0x0000, 0x0F6E,0x0000,0x0000, 0x0F72,0x0000,0x0000, +0x0F9A,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0EDD,0x0000,0x0000, 0x0EDD,0x0000,0x0000, 0x0FAC,0x0000,0x0000, +0x0FAC,0x0000,0x0000, 0x0FC4,0x0000,0x0000, 0x10A0,0x0000,0x0000, +0x10A0,0x0000,0x0000, 0x0FF2,0x0000,0x0000, 0x0FF6,0x0000,0x0000, +0x100B,0x0000,0x0000, 0x100F,0x0000,0x0000, 0x100F,0x0000,0x0000, +0x1013,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x1040,0x0000,0x0000, 0x1049,0x0000,0x0000, 0x1066,0x0000,0x0000, +0x1066,0x0000,0x0000, 0x106F,0x0000,0x0000, 0x106F,0x0000,0x0000, +0x107F,0x0000,0x0000, 0x1084,0x0000,0x0000, 0x1084,0x0000,0x0000, +0x1088,0x0000,0x0000, 0x109C,0x0000,0x0000, 0x10A4,0x0000,0x0000, +0x10A4,0x0000,0x0000, 0x1002,0x0FEA,0x0000, 0x1098,0x0000,0x0000, +0x10C8,0x0000,0x0000, 0x10CC,0x0000,0x0000, 0x10D0,0x0000,0x0000, +0x10D4,0x0000,0x0000, 0x0E6D,0x106A,0x0000, 0x0E6D,0x106A,0x0000, +0x0E6D,0x106A,0x0000, 0x0F2E,0x0F10,0x0000, 0x0F2E,0x0F10,0x0000, +0x0F2E,0x0F10,0x0000, 0x0F64,0x0F10,0x0000, 0x0F64,0x0F10,0x0000, +0x0F64,0x0F10,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x0E90,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E38,0x0000,0x0000, 0x0E38,0x0000,0x0000, +0x0ECD,0x0000,0x0000, 0x0ECD,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0EC1,0x0000,0x0000, 0x0F21,0x0000,0x0000, 0x0F21,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x107F,0x0000,0x0000, 0x107F,0x0000,0x0000, +0x0F10,0x0000,0x0000, 0x0E6D,0x106A,0x0000, 0x0E6D,0x106A,0x0000, +0x0E6D,0x106A,0x0000, 0x0EC1,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0EE9,0x0000,0x0000, 0x1098,0x0000,0x0000, 0x0F64,0x0000,0x0000, +0x0F64,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E38,0x0000,0x0000, 0x0E38,0x0000,0x0000, 0x0F8D,0x0000,0x0000, +0x0F8D,0x0000,0x0000 }; + +uint16 page002data[]= { /* 0200 (3 weights per char) */ +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x1002,0x0000,0x0000, +0x1002,0x0000,0x0000, 0x1090,0x0000,0x0000, 0x1090,0x0000,0x0000, +0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0F72,0x0000,0x0000, +0x0E82,0x0000,0x0000, 0x0FA2,0x0000,0x0000, 0x0FA2,0x0000,0x0000, +0x1073,0x0000,0x0000, 0x1073,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x105E,0x0000,0x0000, +0x105E,0x0000,0x0000, 0x0F4B,0x0000,0x0000, 0x0F7A,0x0000,0x0000, +0x1017,0x0000,0x0000, 0xFBC0,0x8237,0x0000, 0xFBC0,0x8238,0x0000, +0xFBC0,0x8239,0x0000, 0xFBC0,0x823A,0x0000, 0xFBC0,0x823B,0x0000, +0xFBC0,0x823C,0x0000, 0xFBC0,0x823D,0x0000, 0xFBC0,0x823E,0x0000, +0xFBC0,0x823F,0x0000, 0xFBC0,0x8240,0x0000, 0xFBC0,0x8241,0x0000, +0xFBC0,0x8242,0x0000, 0xFBC0,0x8243,0x0000, 0xFBC0,0x8244,0x0000, +0xFBC0,0x8245,0x0000, 0xFBC0,0x8246,0x0000, 0xFBC0,0x8247,0x0000, +0xFBC0,0x8248,0x0000, 0xFBC0,0x8249,0x0000, 0xFBC0,0x824A,0x0000, +0xFBC0,0x824B,0x0000, 0xFBC0,0x824C,0x0000, 0xFBC0,0x824D,0x0000, +0xFBC0,0x824E,0x0000, 0xFBC0,0x824F,0x0000, 0x0E3E,0x0000,0x0000, +0x0E42,0x0000,0x0000, 0x0E46,0x0000,0x0000, 0x0E58,0x0000,0x0000, +0x0F92,0x0000,0x0000, 0x0E69,0x0000,0x0000, 0x0E76,0x0000,0x0000, +0x0E7A,0x0000,0x0000, 0x0E9C,0x0000,0x0000, 0x0E94,0x0000,0x0000, +0x0EA0,0x0000,0x0000, 0x0E98,0x0000,0x0000, 0x0EA4,0x0000,0x0000, +0x0EA9,0x0000,0x0000, 0x0EAD,0x0000,0x0000, 0x0F19,0x0000,0x0000, +0x0ED1,0x0000,0x0000, 0x0EC5,0x0000,0x0000, 0x0EC9,0x0000,0x0000, +0x0ED9,0x0000,0x0000, 0x0EB5,0x0000,0x0000, 0x102B,0x0000,0x0000, +0x0EF1,0x0000,0x0000, 0x0EF5,0x0000,0x0000, 0x0F08,0x0000,0x0000, +0x0F0C,0x0000,0x0000, 0x0F03,0x0000,0x0000, 0x0F3F,0x0000,0x0000, +0x0F43,0x0000,0x0000, 0x0F47,0x0000,0x0000, 0x0F4F,0x0000,0x0000, +0x1037,0x0000,0x0000, 0x103C,0x0000,0x0000, 0x0F60,0x0000,0x0000, +0x0F6E,0x0000,0x0000, 0x0F76,0x0000,0x0000, 0x0F68,0x0000,0x0000, +0x0F9A,0x0000,0x0000, 0x0F88,0x0000,0x0000, 0x0F9E,0x0000,0x0000, +0x0FB0,0x0000,0x0000, 0x0FC9,0x0000,0x0000, 0x0FCE,0x0000,0x0000, +0x0FD2,0x0000,0x0000, 0x0FD6,0x0000,0x0000, 0x0FDA,0x0000,0x0000, +0x0FDE,0x0000,0x0000, 0x0FE2,0x0000,0x0000, 0x0FC4,0x0000,0x0000, +0x0FE6,0x0000,0x0000, 0x0FEE,0x0000,0x0000, 0x0FF2,0x0000,0x0000, +0x0F1D,0x0000,0x0000, 0x0FFA,0x0000,0x0000, 0x0FFE,0x0000,0x0000, +0x101B,0x0000,0x0000, 0x1013,0x0000,0x0000, 0x1027,0x0000,0x0000, +0x1040,0x0000,0x0000, 0x1049,0x0000,0x0000, 0x104D,0x0000,0x0000, +0x1056,0x0000,0x0000, 0x0F57,0x0000,0x0000, 0x1062,0x0000,0x0000, +0x1077,0x0000,0x0000, 0x107B,0x0000,0x0000, 0x107F,0x0000,0x0000, +0x108C,0x0000,0x0000, 0x10AC,0x0000,0x0000, 0x10B4,0x0000,0x0000, +0x10C4,0x0000,0x0000, 0x10D8,0x0000,0x0000, 0x10DC,0x0000,0x0000, +0x0E4E,0x0000,0x0000, 0x0EB1,0x0000,0x0000, 0x0ED5,0x0000,0x0000, +0x0EE5,0x0000,0x0000, 0x0F15,0x0000,0x0000, 0x0F2A,0x0000,0x0000, +0x0F32,0x0000,0x0000, 0x0FB8,0x0000,0x0000, 0x10BC,0x0000,0x0000, +0x10C0,0x0000,0x0000, 0x0E6D,0x106A,0x0000, 0x0E6D,0x107F,0x0000, +0x0E6D,0x107B,0x0000, 0x1002,0x0FEA,0x0000, 0x1002,0x0FF2,0x0000, +0x1002,0x0E69,0x0000, 0x0EB9,0x0F7E,0x0000, 0x0F2E,0x0FEA,0x0000, +0x0F2E,0x106A,0x0000, 0x10E0,0x0000,0x0000, 0x10E4,0x0000,0x0000, +0x102F,0x0000,0x0000, 0x1033,0x0000,0x0000, 0x0EE1,0x0000,0x0000, +0x0EF1,0x0000,0x0000, 0x0F10,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FC9,0x0000,0x0000, 0x0FD2,0x0000,0x0000, 0x0FE6,0x0000,0x0000, +0x1051,0x0000,0x0000, 0x105E,0x0000,0x0000, 0x0317,0x0000,0x0000, +0x0319,0x0000,0x0000, 0x0EF9,0x0000,0x0000, 0x10B1,0x0000,0x0000, +0x0EFA,0x0000,0x0000, 0x10B3,0x0000,0x0000, 0x10B8,0x0000,0x0000, +0x10B0,0x0000,0x0000, 0x10B9,0x0000,0x0000, 0x031A,0x0000,0x0000, +0x031B,0x0000,0x0000, 0x031C,0x0000,0x0000, 0x031D,0x0000,0x0000, +0x031E,0x0000,0x0000, 0x031F,0x0000,0x0000, 0x0320,0x0000,0x0000, +0x0321,0x0000,0x0000, 0x0322,0x0000,0x0000, 0x0323,0x0000,0x0000, +0x0324,0x0000,0x0000, 0x0325,0x0000,0x0000, 0x0326,0x0000,0x0000, +0x0327,0x0000,0x0000, 0x0E01,0x0000,0x0000, 0x0E02,0x0000,0x0000, +0x0328,0x0000,0x0000, 0x0329,0x0000,0x0000, 0x032A,0x0000,0x0000, +0x032B,0x0000,0x0000, 0x032C,0x0000,0x0000, 0x032D,0x0000,0x0000, +0x0212,0x0000,0x0000, 0x0213,0x0000,0x0000, 0x0215,0x0000,0x0000, +0x021A,0x0000,0x0000, 0x020E,0x0000,0x0000, 0x0216,0x0000,0x0000, +0x032E,0x0000,0x0000, 0x032F,0x0000,0x0000, 0x0ED9,0x0000,0x0000, +0x0F2E,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x105A,0x0000,0x0000, +0x10B4,0x0000,0x0000, 0x0330,0x0000,0x0000, 0x0331,0x0000,0x0000, +0x0332,0x0000,0x0000, 0x0333,0x0000,0x0000, 0x0334,0x0000,0x0000, +0x0335,0x0000,0x0000, 0x0336,0x0000,0x0000, 0x0337,0x0000,0x0000, +0x0338,0x0000,0x0000, 0x10B2,0x0000,0x0000, 0x0339,0x0000,0x0000, +0x033A,0x0000,0x0000, 0x033B,0x0000,0x0000, 0x033C,0x0000,0x0000, +0x033D,0x0000,0x0000, 0x033E,0x0000,0x0000, 0x033F,0x0000,0x0000, +0x0340,0x0000,0x0000, 0x0341,0x0000,0x0000, 0x0342,0x0000,0x0000, +0x0343,0x0000,0x0000, 0x0344,0x0000,0x0000, 0x0345,0x0000,0x0000, +0x0346,0x0000,0x0000, 0x0347,0x0000,0x0000, 0x0348,0x0000,0x0000, +0x0349,0x0000,0x0000 }; + +uint16 page003data[]= { /* 0300 (4 weights per char) */ +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0xFBC0,0x8358,0x0000,0x0000, 0xFBC0,0x8359,0x0000,0x0000, +0xFBC0,0x835A,0x0000,0x0000, 0xFBC0,0x835B,0x0000,0x0000, +0xFBC0,0x835C,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x0E33,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000, 0x0EFB,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000, 0x101F,0x0000,0x0000,0x0000, +0x0E60,0x0000,0x0000,0x0000, 0x0E6D,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000, 0x0F5B,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000, 0x1002,0x0000,0x0000,0x0000, +0x1044,0x0000,0x0000,0x0000, 0x105A,0x0000,0x0000,0x0000, +0xFBC0,0x8370,0x0000,0x0000, 0xFBC0,0x8371,0x0000,0x0000, +0xFBC0,0x8372,0x0000,0x0000, 0xFBC0,0x8373,0x0000,0x0000, +0x0317,0x0000,0x0000,0x0000, 0x0318,0x0000,0x0000,0x0000, +0xFBC0,0x8376,0x0000,0x0000, 0xFBC0,0x8377,0x0000,0x0000, +0xFBC0,0x8378,0x0000,0x0000, 0xFBC0,0x8379,0x0000,0x0000, +0x10F3,0x0000,0x0000,0x0000, 0xFBC0,0x837B,0x0000,0x0000, +0xFBC0,0x837C,0x0000,0x0000, 0xFBC0,0x837D,0x0000,0x0000, +0x023A,0x0000,0x0000,0x0000, 0xFBC0,0x837F,0x0000,0x0000, +0xFBC0,0x8380,0x0000,0x0000, 0xFBC0,0x8381,0x0000,0x0000, +0xFBC0,0x8382,0x0000,0x0000, 0xFBC0,0x8383,0x0000,0x0000, +0x020D,0x0000,0x0000,0x0000, 0x0214,0x0000,0x0000,0x0000, +0x10E8,0x0000,0x0000,0x0000, 0x0267,0x0000,0x0000,0x0000, +0x10ED,0x0000,0x0000,0x0000, 0x10F1,0x0000,0x0000,0x0000, +0x10F3,0x0000,0x0000,0x0000, 0xFBC0,0x838B,0x0000,0x0000, +0x10FB,0x0000,0x0000,0x0000, 0xFBC0,0x838D,0x0000,0x0000, +0x1104,0x0000,0x0000,0x0000, 0x1109,0x0000,0x0000,0x0000, +0x10F3,0x0000,0x0000,0x0000, 0x10E8,0x0000,0x0000,0x0000, +0x10E9,0x0000,0x0000,0x0000, 0x10EA,0x0000,0x0000,0x0000, +0x10EC,0x0000,0x0000,0x0000, 0x10ED,0x0000,0x0000,0x0000, +0x10F0,0x0000,0x0000,0x0000, 0x10F1,0x0000,0x0000,0x0000, +0x10F2,0x0000,0x0000,0x0000, 0x10F3,0x0000,0x0000,0x0000, +0x10F5,0x0000,0x0000,0x0000, 0x10F6,0x0000,0x0000,0x0000, +0x10F8,0x0000,0x0000,0x0000, 0x10F9,0x0000,0x0000,0x0000, +0x10FA,0x0000,0x0000,0x0000, 0x10FB,0x0000,0x0000,0x0000, +0x10FC,0x0000,0x0000,0x0000, 0x1100,0x0000,0x0000,0x0000, +0xFBC0,0x83A2,0x0000,0x0000, 0x1102,0x0000,0x0000,0x0000, +0x1103,0x0000,0x0000,0x0000, 0x1104,0x0000,0x0000,0x0000, +0x1105,0x0000,0x0000,0x0000, 0x1106,0x0000,0x0000,0x0000, +0x1107,0x0000,0x0000,0x0000, 0x1109,0x0000,0x0000,0x0000, +0x10F3,0x0000,0x0000,0x0000, 0x1104,0x0000,0x0000,0x0000, +0x10E8,0x0000,0x0000,0x0000, 0x10ED,0x0000,0x0000,0x0000, +0x10F1,0x0000,0x0000,0x0000, 0x10F3,0x0000,0x0000,0x0000, +0x1104,0x0000,0x0000,0x0000, 0x10E8,0x0000,0x0000,0x0000, +0x10E9,0x0000,0x0000,0x0000, 0x10EA,0x0000,0x0000,0x0000, +0x10EC,0x0000,0x0000,0x0000, 0x10ED,0x0000,0x0000,0x0000, +0x10F0,0x0000,0x0000,0x0000, 0x10F1,0x0000,0x0000,0x0000, +0x10F2,0x0000,0x0000,0x0000, 0x10F3,0x0000,0x0000,0x0000, +0x10F5,0x0000,0x0000,0x0000, 0x10F6,0x0000,0x0000,0x0000, +0x10F8,0x0000,0x0000,0x0000, 0x10F9,0x0000,0x0000,0x0000, +0x10FA,0x0000,0x0000,0x0000, 0x10FB,0x0000,0x0000,0x0000, +0x10FC,0x0000,0x0000,0x0000, 0x1100,0x0000,0x0000,0x0000, +0x1102,0x0000,0x0000,0x0000, 0x1102,0x0000,0x0000,0x0000, +0x1103,0x0000,0x0000,0x0000, 0x1104,0x0000,0x0000,0x0000, +0x1105,0x0000,0x0000,0x0000, 0x1106,0x0000,0x0000,0x0000, +0x1107,0x0000,0x0000,0x0000, 0x1109,0x0000,0x0000,0x0000, +0x10F3,0x0000,0x0000,0x0000, 0x1104,0x0000,0x0000,0x0000, +0x10FB,0x0000,0x0000,0x0000, 0x1104,0x0000,0x0000,0x0000, +0x1109,0x0000,0x0000,0x0000, 0xFBC0,0x83CF,0x0000,0x0000, +0x10E9,0x0000,0x0000,0x0000, 0x10F2,0x0000,0x0000,0x0000, +0x1104,0x0000,0x0000,0x0000, 0x1104,0x0000,0x0000,0x0000, +0x1104,0x0000,0x0000,0x0000, 0x1105,0x0000,0x0000,0x0000, +0x10FC,0x0000,0x0000,0x0000, 0x10F5,0x10E8,0x10F3,0x0000, +0x10FF,0x0000,0x0000,0x0000, 0x10FF,0x0000,0x0000,0x0000, +0x10EF,0x0000,0x0000,0x0000, 0x10EF,0x0000,0x0000,0x0000, +0x10EE,0x0000,0x0000,0x0000, 0x10EE,0x0000,0x0000,0x0000, +0x10FE,0x0000,0x0000,0x0000, 0x10FE,0x0000,0x0000,0x0000, +0x110A,0x0000,0x0000,0x0000, 0x110A,0x0000,0x0000,0x0000, +0x110D,0x0000,0x0000,0x0000, 0x110D,0x0000,0x0000,0x0000, +0x110E,0x0000,0x0000,0x0000, 0x110E,0x0000,0x0000,0x0000, +0x110F,0x0000,0x0000,0x0000, 0x110F,0x0000,0x0000,0x0000, +0x1110,0x0000,0x0000,0x0000, 0x1110,0x0000,0x0000,0x0000, +0x1111,0x0000,0x0000,0x0000, 0x1111,0x0000,0x0000,0x0000, +0x1112,0x0000,0x0000,0x0000, 0x1112,0x0000,0x0000,0x0000, +0x1113,0x0000,0x0000,0x0000, 0x1113,0x0000,0x0000,0x0000, +0x10F5,0x0000,0x0000,0x0000, 0x1100,0x0000,0x0000,0x0000, +0x1102,0x0000,0x0000,0x0000, 0x10F4,0x0000,0x0000,0x0000, +0x10F2,0x0000,0x0000,0x0000, 0x10ED,0x0000,0x0000,0x0000, +0x0423,0x0000,0x0000,0x0000, 0x110B,0x0000,0x0000,0x0000, +0x110B,0x0000,0x0000,0x0000, 0x1102,0x0000,0x0000,0x0000, +0x110C,0x0000,0x0000,0x0000, 0x110C,0x0000,0x0000,0x0000, +0xFBC0,0x83FC,0x0000,0x0000, 0xFBC0,0x83FD,0x0000,0x0000, +0xFBC0,0x83FE,0x0000,0x0000, 0xFBC0,0x83FF,0x0000,0x0000 +}; + +uint16 page004data[]= { /* 0400 (3 weights per char) */ +0x1152,0x0000,0x0000, 0x1152,0x0000,0x0000, 0x1145,0x0000,0x0000, +0x114A,0x0000,0x0000, 0x115A,0x0000,0x0000, 0x1173,0x0000,0x0000, +0x1188,0x0000,0x0000, 0x118C,0x0000,0x0000, 0x1194,0x0000,0x0000, +0x11B9,0x0000,0x0000, 0x11DA,0x0000,0x0000, 0x1215,0x0000,0x0000, +0x1219,0x0000,0x0000, 0x117C,0x0000,0x0000, 0x1221,0x0000,0x0000, +0x127D,0x0000,0x0000, 0x1114,0x0000,0x0000, 0x112C,0x0000,0x0000, +0x1130,0x0000,0x0000, 0x1134,0x0000,0x0000, 0x1140,0x0000,0x0000, +0x1152,0x0000,0x0000, 0x115E,0x0000,0x0000, 0x116A,0x0000,0x0000, +0x117C,0x0000,0x0000, 0x1190,0x0000,0x0000, 0x1198,0x0000,0x0000, +0x11B0,0x0000,0x0000, 0x11BE,0x0000,0x0000, 0x11C6,0x0000,0x0000, +0x11DF,0x0000,0x0000, 0x11EF,0x0000,0x0000, 0x11FB,0x0000,0x0000, +0x1203,0x0000,0x0000, 0x120C,0x0000,0x0000, 0x121D,0x0000,0x0000, +0x1239,0x0000,0x0000, 0x123D,0x0000,0x0000, 0x1259,0x0000,0x0000, +0x1261,0x0000,0x0000, 0x1281,0x0000,0x0000, 0x1285,0x0000,0x0000, +0x1289,0x0000,0x0000, 0x128D,0x0000,0x0000, 0x1295,0x0000,0x0000, +0x12A1,0x0000,0x0000, 0x12A9,0x0000,0x0000, 0x12AD,0x0000,0x0000, +0x1114,0x0000,0x0000, 0x112C,0x0000,0x0000, 0x1130,0x0000,0x0000, +0x1134,0x0000,0x0000, 0x1140,0x0000,0x0000, 0x1152,0x0000,0x0000, +0x115E,0x0000,0x0000, 0x116A,0x0000,0x0000, 0x117C,0x0000,0x0000, +0x1190,0x0000,0x0000, 0x1198,0x0000,0x0000, 0x11B0,0x0000,0x0000, +0x11BE,0x0000,0x0000, 0x11C6,0x0000,0x0000, 0x11DF,0x0000,0x0000, +0x11EF,0x0000,0x0000, 0x11FB,0x0000,0x0000, 0x1203,0x0000,0x0000, +0x120C,0x0000,0x0000, 0x121D,0x0000,0x0000, 0x1239,0x0000,0x0000, +0x123D,0x0000,0x0000, 0x1259,0x0000,0x0000, 0x1261,0x0000,0x0000, +0x1281,0x0000,0x0000, 0x1285,0x0000,0x0000, 0x1289,0x0000,0x0000, +0x128D,0x0000,0x0000, 0x1295,0x0000,0x0000, 0x12A1,0x0000,0x0000, +0x12A9,0x0000,0x0000, 0x12AD,0x0000,0x0000, 0x1152,0x0000,0x0000, +0x1152,0x0000,0x0000, 0x1145,0x0000,0x0000, 0x114A,0x0000,0x0000, +0x115A,0x0000,0x0000, 0x1173,0x0000,0x0000, 0x1188,0x0000,0x0000, +0x118C,0x0000,0x0000, 0x1194,0x0000,0x0000, 0x11B9,0x0000,0x0000, +0x11DA,0x0000,0x0000, 0x1215,0x0000,0x0000, 0x1219,0x0000,0x0000, +0x117C,0x0000,0x0000, 0x1221,0x0000,0x0000, 0x127D,0x0000,0x0000, +0x1249,0x0000,0x0000, 0x1249,0x0000,0x0000, 0x129D,0x0000,0x0000, +0x129D,0x0000,0x0000, 0x12B1,0x0000,0x0000, 0x12B1,0x0000,0x0000, +0x12B5,0x0000,0x0000, 0x12B5,0x0000,0x0000, 0x12BD,0x0000,0x0000, +0x12BD,0x0000,0x0000, 0x12B9,0x0000,0x0000, 0x12B9,0x0000,0x0000, +0x12C1,0x0000,0x0000, 0x12C1,0x0000,0x0000, 0x12C5,0x0000,0x0000, +0x12C5,0x0000,0x0000, 0x12C9,0x0000,0x0000, 0x12C9,0x0000,0x0000, +0x12CD,0x0000,0x0000, 0x12CD,0x0000,0x0000, 0x12D1,0x0000,0x0000, +0x12D1,0x0000,0x0000, 0x12D5,0x0000,0x0000, 0x12D5,0x0000,0x0000, +0x1235,0x0000,0x0000, 0x1235,0x0000,0x0000, 0x1255,0x0000,0x0000, +0x1255,0x0000,0x0000, 0x1251,0x0000,0x0000, 0x1251,0x0000,0x0000, +0x124D,0x0000,0x0000, 0x124D,0x0000,0x0000, 0x11F7,0x0000,0x0000, +0x11F7,0x0000,0x0000, 0x034B,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x8487,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x1180,0x0000,0x0000, 0x1180,0x0000,0x0000, 0x1299,0x0000,0x0000, +0x1299,0x0000,0x0000, 0x11FF,0x0000,0x0000, 0x11FF,0x0000,0x0000, +0x1134,0x0000,0x0000, 0x1134,0x0000,0x0000, 0x1138,0x0000,0x0000, +0x1138,0x0000,0x0000, 0x113C,0x0000,0x0000, 0x113C,0x0000,0x0000, +0x1166,0x0000,0x0000, 0x1166,0x0000,0x0000, 0x114E,0x0000,0x0000, +0x114E,0x0000,0x0000, 0x119C,0x0000,0x0000, 0x119C,0x0000,0x0000, +0x11AC,0x0000,0x0000, 0x11AC,0x0000,0x0000, 0x11A8,0x0000,0x0000, +0x11A8,0x0000,0x0000, 0x11A4,0x0000,0x0000, 0x11A4,0x0000,0x0000, +0x11CE,0x0000,0x0000, 0x11CE,0x0000,0x0000, 0x11D6,0x0000,0x0000, +0x11D6,0x0000,0x0000, 0x11F3,0x0000,0x0000, 0x11F3,0x0000,0x0000, +0x12D9,0x0000,0x0000, 0x12D9,0x0000,0x0000, 0x1208,0x0000,0x0000, +0x1208,0x0000,0x0000, 0x1211,0x0000,0x0000, 0x1211,0x0000,0x0000, +0x122D,0x0000,0x0000, 0x122D,0x0000,0x0000, 0x1231,0x0000,0x0000, +0x1231,0x0000,0x0000, 0x1241,0x0000,0x0000, 0x1241,0x0000,0x0000, +0x125D,0x0000,0x0000, 0x125D,0x0000,0x0000, 0x1269,0x0000,0x0000, +0x1269,0x0000,0x0000, 0x1271,0x0000,0x0000, 0x1271,0x0000,0x0000, +0x1245,0x0000,0x0000, 0x1245,0x0000,0x0000, 0x1275,0x0000,0x0000, +0x1275,0x0000,0x0000, 0x1279,0x0000,0x0000, 0x1279,0x0000,0x0000, +0x12DD,0x0000,0x0000, 0x115E,0x0000,0x0000, 0x115E,0x0000,0x0000, +0x11A0,0x0000,0x0000, 0x11A0,0x0000,0x0000, 0x11B5,0x0000,0x0000, +0x11B5,0x0000,0x0000, 0x11D2,0x0000,0x0000, 0x11D2,0x0000,0x0000, +0x11CA,0x0000,0x0000, 0x11CA,0x0000,0x0000, 0x126D,0x0000,0x0000, +0x126D,0x0000,0x0000, 0x11C2,0x0000,0x0000, 0x11C2,0x0000,0x0000, +0xFBC0,0x84CF,0x0000, 0x1118,0x0000,0x0000, 0x1118,0x0000,0x0000, +0x111C,0x0000,0x0000, 0x111C,0x0000,0x0000, 0x1128,0x0000,0x0000, +0x1128,0x0000,0x0000, 0x1156,0x0000,0x0000, 0x1156,0x0000,0x0000, +0x1120,0x0000,0x0000, 0x1120,0x0000,0x0000, 0x1124,0x0000,0x0000, +0x1124,0x0000,0x0000, 0x1162,0x0000,0x0000, 0x1162,0x0000,0x0000, +0x116F,0x0000,0x0000, 0x116F,0x0000,0x0000, 0x1177,0x0000,0x0000, +0x1177,0x0000,0x0000, 0x117C,0x0000,0x0000, 0x117C,0x0000,0x0000, +0x1184,0x0000,0x0000, 0x1184,0x0000,0x0000, 0x11E3,0x0000,0x0000, +0x11E3,0x0000,0x0000, 0x11E7,0x0000,0x0000, 0x11E7,0x0000,0x0000, +0x11EB,0x0000,0x0000, 0x11EB,0x0000,0x0000, 0x12A5,0x0000,0x0000, +0x12A5,0x0000,0x0000, 0x121D,0x0000,0x0000, 0x121D,0x0000,0x0000, +0x1225,0x0000,0x0000, 0x1225,0x0000,0x0000, 0x1229,0x0000,0x0000, +0x1229,0x0000,0x0000, 0x1265,0x0000,0x0000, 0x1265,0x0000,0x0000, +0xFBC0,0x84F6,0x0000, 0xFBC0,0x84F7,0x0000, 0x1291,0x0000,0x0000, +0x1291,0x0000,0x0000, 0xFBC0,0x84FA,0x0000, 0xFBC0,0x84FB,0x0000, +0xFBC0,0x84FC,0x0000, 0xFBC0,0x84FD,0x0000, 0xFBC0,0x84FE,0x0000, +0xFBC0,0x84FF,0x0000 }; + +uint16 page005data[]= { /* 0500 (3 weights per char) */ +0x1144,0x0000,0x0000, 0x1144,0x0000,0x0000, 0x1149,0x0000,0x0000, +0x1149,0x0000,0x0000, 0x116E,0x0000,0x0000, 0x116E,0x0000,0x0000, +0x117B,0x0000,0x0000, 0x117B,0x0000,0x0000, 0x11BD,0x0000,0x0000, +0x11BD,0x0000,0x0000, 0x11DE,0x0000,0x0000, 0x11DE,0x0000,0x0000, +0x1207,0x0000,0x0000, 0x1207,0x0000,0x0000, 0x1210,0x0000,0x0000, +0x1210,0x0000,0x0000, 0xFBC0,0x8510,0x0000, 0xFBC0,0x8511,0x0000, +0xFBC0,0x8512,0x0000, 0xFBC0,0x8513,0x0000, 0xFBC0,0x8514,0x0000, +0xFBC0,0x8515,0x0000, 0xFBC0,0x8516,0x0000, 0xFBC0,0x8517,0x0000, +0xFBC0,0x8518,0x0000, 0xFBC0,0x8519,0x0000, 0xFBC0,0x851A,0x0000, +0xFBC0,0x851B,0x0000, 0xFBC0,0x851C,0x0000, 0xFBC0,0x851D,0x0000, +0xFBC0,0x851E,0x0000, 0xFBC0,0x851F,0x0000, 0xFBC0,0x8520,0x0000, +0xFBC0,0x8521,0x0000, 0xFBC0,0x8522,0x0000, 0xFBC0,0x8523,0x0000, +0xFBC0,0x8524,0x0000, 0xFBC0,0x8525,0x0000, 0xFBC0,0x8526,0x0000, +0xFBC0,0x8527,0x0000, 0xFBC0,0x8528,0x0000, 0xFBC0,0x8529,0x0000, +0xFBC0,0x852A,0x0000, 0xFBC0,0x852B,0x0000, 0xFBC0,0x852C,0x0000, +0xFBC0,0x852D,0x0000, 0xFBC0,0x852E,0x0000, 0xFBC0,0x852F,0x0000, +0xFBC0,0x8530,0x0000, 0x130A,0x0000,0x0000, 0x130B,0x0000,0x0000, +0x130C,0x0000,0x0000, 0x130D,0x0000,0x0000, 0x130E,0x0000,0x0000, +0x130F,0x0000,0x0000, 0x1310,0x0000,0x0000, 0x1311,0x0000,0x0000, +0x1312,0x0000,0x0000, 0x1313,0x0000,0x0000, 0x1314,0x0000,0x0000, +0x1315,0x0000,0x0000, 0x1316,0x0000,0x0000, 0x1317,0x0000,0x0000, +0x1318,0x0000,0x0000, 0x1319,0x0000,0x0000, 0x131A,0x0000,0x0000, +0x131B,0x0000,0x0000, 0x131C,0x0000,0x0000, 0x131D,0x0000,0x0000, +0x131E,0x0000,0x0000, 0x131F,0x0000,0x0000, 0x1320,0x0000,0x0000, +0x1321,0x0000,0x0000, 0x1322,0x0000,0x0000, 0x1323,0x0000,0x0000, +0x1324,0x0000,0x0000, 0x1325,0x0000,0x0000, 0x1326,0x0000,0x0000, +0x1327,0x0000,0x0000, 0x1328,0x0000,0x0000, 0x1329,0x0000,0x0000, +0x132A,0x0000,0x0000, 0x132B,0x0000,0x0000, 0x132C,0x0000,0x0000, +0x132D,0x0000,0x0000, 0x132E,0x0000,0x0000, 0x132F,0x0000,0x0000, +0xFBC0,0x8557,0x0000, 0xFBC0,0x8558,0x0000, 0x1330,0x0000,0x0000, +0x02EC,0x0000,0x0000, 0x02ED,0x0000,0x0000, 0x0253,0x0000,0x0000, +0x0230,0x0000,0x0000, 0x0257,0x0000,0x0000, 0x02EE,0x0000,0x0000, +0xFBC0,0x8560,0x0000, 0x130A,0x0000,0x0000, 0x130B,0x0000,0x0000, +0x130C,0x0000,0x0000, 0x130D,0x0000,0x0000, 0x130E,0x0000,0x0000, +0x130F,0x0000,0x0000, 0x1310,0x0000,0x0000, 0x1311,0x0000,0x0000, +0x1312,0x0000,0x0000, 0x1313,0x0000,0x0000, 0x1314,0x0000,0x0000, +0x1315,0x0000,0x0000, 0x1316,0x0000,0x0000, 0x1317,0x0000,0x0000, +0x1318,0x0000,0x0000, 0x1319,0x0000,0x0000, 0x131A,0x0000,0x0000, +0x131B,0x0000,0x0000, 0x131C,0x0000,0x0000, 0x131D,0x0000,0x0000, +0x131E,0x0000,0x0000, 0x131F,0x0000,0x0000, 0x1320,0x0000,0x0000, +0x1321,0x0000,0x0000, 0x1322,0x0000,0x0000, 0x1323,0x0000,0x0000, +0x1324,0x0000,0x0000, 0x1325,0x0000,0x0000, 0x1326,0x0000,0x0000, +0x1327,0x0000,0x0000, 0x1328,0x0000,0x0000, 0x1329,0x0000,0x0000, +0x132A,0x0000,0x0000, 0x132B,0x0000,0x0000, 0x132C,0x0000,0x0000, +0x132D,0x0000,0x0000, 0x132E,0x0000,0x0000, 0x132F,0x0000,0x0000, +0x130E,0x132B,0x0000, 0xFBC0,0x8588,0x0000, 0x023E,0x0000,0x0000, +0x0222,0x0000,0x0000, 0xFBC0,0x858B,0x0000, 0xFBC0,0x858C,0x0000, +0xFBC0,0x858D,0x0000, 0xFBC0,0x858E,0x0000, 0xFBC0,0x858F,0x0000, +0xFBC0,0x8590,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x85A2,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x85BA,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x02EF,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x02F0,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x02F1,0x0000,0x0000, 0x0000,0x0000,0x0000, 0xFBC0,0x85C5,0x0000, +0xFBC0,0x85C6,0x0000, 0xFBC0,0x85C7,0x0000, 0xFBC0,0x85C8,0x0000, +0xFBC0,0x85C9,0x0000, 0xFBC0,0x85CA,0x0000, 0xFBC0,0x85CB,0x0000, +0xFBC0,0x85CC,0x0000, 0xFBC0,0x85CD,0x0000, 0xFBC0,0x85CE,0x0000, +0xFBC0,0x85CF,0x0000, 0x1331,0x0000,0x0000, 0x1332,0x0000,0x0000, +0x1333,0x0000,0x0000, 0x1334,0x0000,0x0000, 0x1335,0x0000,0x0000, +0x1336,0x0000,0x0000, 0x1337,0x0000,0x0000, 0x1338,0x0000,0x0000, +0x1339,0x0000,0x0000, 0x133A,0x0000,0x0000, 0x133B,0x0000,0x0000, +0x133B,0x0000,0x0000, 0x133C,0x0000,0x0000, 0x133D,0x0000,0x0000, +0x133D,0x0000,0x0000, 0x133E,0x0000,0x0000, 0x133E,0x0000,0x0000, +0x133F,0x0000,0x0000, 0x1340,0x0000,0x0000, 0x1341,0x0000,0x0000, +0x1341,0x0000,0x0000, 0x1342,0x0000,0x0000, 0x1342,0x0000,0x0000, +0x1343,0x0000,0x0000, 0x1344,0x0000,0x0000, 0x1345,0x0000,0x0000, +0x1346,0x0000,0x0000, 0xFBC0,0x85EB,0x0000, 0xFBC0,0x85EC,0x0000, +0xFBC0,0x85ED,0x0000, 0xFBC0,0x85EE,0x0000, 0xFBC0,0x85EF,0x0000, +0x1336,0x1336,0x0000, 0x1336,0x133A,0x0000, 0x133A,0x133A,0x0000, +0x02F2,0x0000,0x0000, 0x02F3,0x0000,0x0000, 0xFBC0,0x85F5,0x0000, +0xFBC0,0x85F6,0x0000, 0xFBC0,0x85F7,0x0000, 0xFBC0,0x85F8,0x0000, +0xFBC0,0x85F9,0x0000, 0xFBC0,0x85FA,0x0000, 0xFBC0,0x85FB,0x0000, +0xFBC0,0x85FC,0x0000, 0xFBC0,0x85FD,0x0000, 0xFBC0,0x85FE,0x0000, +0xFBC0,0x85FF,0x0000 }; + +uint16 page006data[]= { /* 0600 (3 weights per char) */ +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8604,0x0000, 0xFBC0,0x8605,0x0000, +0xFBC0,0x8606,0x0000, 0xFBC0,0x8607,0x0000, 0xFBC0,0x8608,0x0000, +0xFBC0,0x8609,0x0000, 0xFBC0,0x860A,0x0000, 0xFBC0,0x860B,0x0000, +0x0231,0x0000,0x0000, 0x0232,0x0000,0x0000, 0x034C,0x0000,0x0000, +0x034D,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8616,0x0000, 0xFBC0,0x8617,0x0000, +0xFBC0,0x8618,0x0000, 0xFBC0,0x8619,0x0000, 0xFBC0,0x861A,0x0000, +0x023B,0x0000,0x0000, 0xFBC0,0x861C,0x0000, 0xFBC0,0x861D,0x0000, +0xFBC0,0x861E,0x0000, 0x0258,0x0000,0x0000, 0xFBC0,0x8620,0x0000, +0x1347,0x0000,0x0000, 0x1348,0x0000,0x0000, 0x1349,0x0000,0x0000, +0x134C,0x0000,0x0000, 0x134D,0x0000,0x0000, 0x134F,0x0000,0x0000, +0x1350,0x0000,0x0000, 0x1352,0x0000,0x0000, 0x1356,0x0000,0x0000, +0x1357,0x0000,0x0000, 0x1358,0x0000,0x0000, 0x135E,0x0000,0x0000, +0x1364,0x0000,0x0000, 0x1365,0x0000,0x0000, 0x1369,0x0000,0x0000, +0x136A,0x0000,0x0000, 0x1375,0x0000,0x0000, 0x1376,0x0000,0x0000, +0x1381,0x0000,0x0000, 0x1382,0x0000,0x0000, 0x1387,0x0000,0x0000, +0x1388,0x0000,0x0000, 0x138C,0x0000,0x0000, 0x138D,0x0000,0x0000, +0x138F,0x0000,0x0000, 0x1390,0x0000,0x0000, 0xFBC0,0x863B,0x0000, +0xFBC0,0x863C,0x0000, 0xFBC0,0x863D,0x0000, 0xFBC0,0x863E,0x0000, +0xFBC0,0x863F,0x0000, 0x020B,0x0000,0x0000, 0x1393,0x0000,0x0000, +0x139B,0x0000,0x0000, 0x139E,0x0000,0x0000, 0x13AB,0x0000,0x0000, +0x13B0,0x0000,0x0000, 0x13B1,0x0000,0x0000, 0x13B7,0x0000,0x0000, +0x13BD,0x0000,0x0000, 0x13C7,0x0000,0x0000, 0x13C8,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0xFBC0,0x8659,0x0000, +0xFBC0,0x865A,0x0000, 0xFBC0,0x865B,0x0000, 0xFBC0,0x865C,0x0000, +0xFBC0,0x865D,0x0000, 0xFBC0,0x865E,0x0000, 0xFBC0,0x865F,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0x02D4,0x0000,0x0000, 0x0233,0x0000,0x0000, +0x0234,0x0000,0x0000, 0x02CB,0x0000,0x0000, 0x1351,0x0000,0x0000, +0x139A,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x134B,0x0000,0x0000, +0x134A,0x0000,0x0000, 0x134E,0x0000,0x0000, 0x1347,0x0000,0x0000, +0x1350,0x1347,0x0000, 0x13BD,0x1347,0x0000, 0x13C1,0x1347,0x0000, +0x13C8,0x1347,0x0000, 0x1359,0x0000,0x0000, 0x135A,0x0000,0x0000, +0x1353,0x0000,0x0000, 0x135B,0x0000,0x0000, 0x135C,0x0000,0x0000, +0x1354,0x0000,0x0000, 0x135D,0x0000,0x0000, 0x1355,0x0000,0x0000, +0x1366,0x0000,0x0000, 0x1367,0x0000,0x0000, 0x135F,0x0000,0x0000, +0x1360,0x0000,0x0000, 0x1368,0x0000,0x0000, 0x1361,0x0000,0x0000, +0x1363,0x0000,0x0000, 0x136B,0x0000,0x0000, 0x136C,0x0000,0x0000, +0x136D,0x0000,0x0000, 0x136E,0x0000,0x0000, 0x136F,0x0000,0x0000, +0x1370,0x0000,0x0000, 0x1371,0x0000,0x0000, 0x1372,0x0000,0x0000, +0x1373,0x0000,0x0000, 0x1377,0x0000,0x0000, 0x1378,0x0000,0x0000, +0x1379,0x0000,0x0000, 0x137A,0x0000,0x0000, 0x137B,0x0000,0x0000, +0x137C,0x0000,0x0000, 0x137D,0x0000,0x0000, 0x137E,0x0000,0x0000, +0x137F,0x0000,0x0000, 0x1383,0x0000,0x0000, 0x1384,0x0000,0x0000, +0x1385,0x0000,0x0000, 0x1389,0x0000,0x0000, 0x138A,0x0000,0x0000, +0x138E,0x0000,0x0000, 0x1391,0x0000,0x0000, 0x1394,0x0000,0x0000, +0x1395,0x0000,0x0000, 0x1396,0x0000,0x0000, 0x1397,0x0000,0x0000, +0x1398,0x0000,0x0000, 0x1399,0x0000,0x0000, 0x139C,0x0000,0x0000, +0x139D,0x0000,0x0000, 0x139F,0x0000,0x0000, 0x13A0,0x0000,0x0000, +0x13A1,0x0000,0x0000, 0x13A2,0x0000,0x0000, 0x13A3,0x0000,0x0000, +0x13A4,0x0000,0x0000, 0x13A5,0x0000,0x0000, 0x13A6,0x0000,0x0000, +0x13A7,0x0000,0x0000, 0x13A8,0x0000,0x0000, 0x13A9,0x0000,0x0000, +0x13AA,0x0000,0x0000, 0x13AC,0x0000,0x0000, 0x13AD,0x0000,0x0000, +0x13AE,0x0000,0x0000, 0x13AF,0x0000,0x0000, 0x13B6,0x0000,0x0000, +0x13B2,0x0000,0x0000, 0x13B3,0x0000,0x0000, 0x13B4,0x0000,0x0000, +0x13B5,0x0000,0x0000, 0x13B8,0x0000,0x0000, 0x1362,0x0000,0x0000, +0x13BC,0x0000,0x0000, 0x13B9,0x0000,0x0000, 0x13B9,0x0000,0x0000, +0x13BA,0x0000,0x0000, 0x13BE,0x0000,0x0000, 0x13BF,0x0000,0x0000, +0x13C0,0x0000,0x0000, 0x13C1,0x0000,0x0000, 0x13C2,0x0000,0x0000, +0x13C3,0x0000,0x0000, 0x13C4,0x0000,0x0000, 0x13C5,0x0000,0x0000, +0x13C9,0x0000,0x0000, 0x13CA,0x0000,0x0000, 0x13CB,0x0000,0x0000, +0x13C6,0x0000,0x0000, 0x13CC,0x0000,0x0000, 0x13CD,0x0000,0x0000, +0x13CE,0x0000,0x0000, 0x13CE,0x0000,0x0000, 0x025F,0x0000,0x0000, +0x13BC,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x13BD,0x0000,0x0000, 0x13C8,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x034E,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x1374,0x0000,0x0000, 0x1380,0x0000,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0x1386,0x0000,0x0000, 0x138B,0x0000,0x0000, +0x1392,0x0000,0x0000, 0x1347,0x0000,0x0000, 0x13B0,0x0000,0x0000, +0x13BB,0x0000,0x0000 }; + +uint16 page007data[]= { /* 0700 (3 weights per char) */ +0x0270,0x0000,0x0000, 0x0260,0x0000,0x0000, 0x0261,0x0000,0x0000, +0x023F,0x0000,0x0000, 0x0240,0x0000,0x0000, 0x0241,0x0000,0x0000, +0x0242,0x0000,0x0000, 0x0243,0x0000,0x0000, 0x0244,0x0000,0x0000, +0x0259,0x0000,0x0000, 0x02F4,0x0000,0x0000, 0x02F5,0x0000,0x0000, +0x02F6,0x0000,0x0000, 0x02F7,0x0000,0x0000, 0xFBC0,0x870E,0x0000, +0x0000,0x0000,0x0000, 0x13CF,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x13D0,0x0000,0x0000, 0x13D1,0x0000,0x0000, 0x13D1,0x0000,0x0000, +0x13D3,0x0000,0x0000, 0x13D2,0x0000,0x0000, 0x13D4,0x0000,0x0000, +0x13D5,0x0000,0x0000, 0x13D6,0x0000,0x0000, 0x13D8,0x0000,0x0000, +0x13D9,0x0000,0x0000, 0x13D9,0x0000,0x0000, 0x13DA,0x0000,0x0000, +0x13DB,0x0000,0x0000, 0x13DC,0x0000,0x0000, 0x13DE,0x0000,0x0000, +0x13DF,0x0000,0x0000, 0x13E0,0x0000,0x0000, 0x13E1,0x0000,0x0000, +0x13E1,0x0000,0x0000, 0x13E2,0x0000,0x0000, 0x13E3,0x0000,0x0000, +0x13E3,0x0000,0x0000, 0x13E5,0x0000,0x0000, 0x13E6,0x0000,0x0000, +0x13E7,0x0000,0x0000, 0x13E8,0x0000,0x0000, 0x13E9,0x0000,0x0000, +0x13D0,0x0000,0x0000, 0x13D1,0x0000,0x0000, 0x13D3,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x874B,0x0000, 0xFBC0,0x874C,0x0000, 0x13D7,0x0000,0x0000, +0x13DD,0x0000,0x0000, 0x13E4,0x0000,0x0000, 0xFBC0,0x8750,0x0000, +0xFBC0,0x8751,0x0000, 0xFBC0,0x8752,0x0000, 0xFBC0,0x8753,0x0000, +0xFBC0,0x8754,0x0000, 0xFBC0,0x8755,0x0000, 0xFBC0,0x8756,0x0000, +0xFBC0,0x8757,0x0000, 0xFBC0,0x8758,0x0000, 0xFBC0,0x8759,0x0000, +0xFBC0,0x875A,0x0000, 0xFBC0,0x875B,0x0000, 0xFBC0,0x875C,0x0000, +0xFBC0,0x875D,0x0000, 0xFBC0,0x875E,0x0000, 0xFBC0,0x875F,0x0000, +0xFBC0,0x8760,0x0000, 0xFBC0,0x8761,0x0000, 0xFBC0,0x8762,0x0000, +0xFBC0,0x8763,0x0000, 0xFBC0,0x8764,0x0000, 0xFBC0,0x8765,0x0000, +0xFBC0,0x8766,0x0000, 0xFBC0,0x8767,0x0000, 0xFBC0,0x8768,0x0000, +0xFBC0,0x8769,0x0000, 0xFBC0,0x876A,0x0000, 0xFBC0,0x876B,0x0000, +0xFBC0,0x876C,0x0000, 0xFBC0,0x876D,0x0000, 0xFBC0,0x876E,0x0000, +0xFBC0,0x876F,0x0000, 0xFBC0,0x8770,0x0000, 0xFBC0,0x8771,0x0000, +0xFBC0,0x8772,0x0000, 0xFBC0,0x8773,0x0000, 0xFBC0,0x8774,0x0000, +0xFBC0,0x8775,0x0000, 0xFBC0,0x8776,0x0000, 0xFBC0,0x8777,0x0000, +0xFBC0,0x8778,0x0000, 0xFBC0,0x8779,0x0000, 0xFBC0,0x877A,0x0000, +0xFBC0,0x877B,0x0000, 0xFBC0,0x877C,0x0000, 0xFBC0,0x877D,0x0000, +0xFBC0,0x877E,0x0000, 0xFBC0,0x877F,0x0000, 0x13EA,0x0000,0x0000, +0x13ED,0x0000,0x0000, 0x13EE,0x0000,0x0000, 0x13EF,0x0000,0x0000, +0x13F1,0x0000,0x0000, 0x13F2,0x0000,0x0000, 0x13F3,0x0000,0x0000, +0x13F4,0x0000,0x0000, 0x13F7,0x0000,0x0000, 0x13F9,0x0000,0x0000, +0x13FA,0x0000,0x0000, 0x13FB,0x0000,0x0000, 0x13FD,0x0000,0x0000, +0x1401,0x0000,0x0000, 0x1402,0x0000,0x0000, 0x1404,0x0000,0x0000, +0x1405,0x0000,0x0000, 0x1409,0x0000,0x0000, 0x140A,0x0000,0x0000, +0x140B,0x0000,0x0000, 0x140C,0x0000,0x0000, 0x140D,0x0000,0x0000, +0x140E,0x0000,0x0000, 0x140F,0x0000,0x0000, 0x13FE,0x0000,0x0000, +0x13EB,0x0000,0x0000, 0x13EC,0x0000,0x0000, 0x13FC,0x0000,0x0000, +0x13F0,0x0000,0x0000, 0x1406,0x0000,0x0000, 0x1407,0x0000,0x0000, +0x1408,0x0000,0x0000, 0x13FF,0x0000,0x0000, 0x1400,0x0000,0x0000, +0x13F5,0x0000,0x0000, 0x13F6,0x0000,0x0000, 0x1403,0x0000,0x0000, +0x13F8,0x0000,0x0000, 0x1411,0x0000,0x0000, 0x1412,0x0000,0x0000, +0x1413,0x0000,0x0000, 0x1414,0x0000,0x0000, 0x1415,0x0000,0x0000, +0x1416,0x0000,0x0000, 0x1417,0x0000,0x0000, 0x1418,0x0000,0x0000, +0x1419,0x0000,0x0000, 0x141A,0x0000,0x0000, 0x141B,0x0000,0x0000, +0x1410,0x0000,0x0000, 0xFBC0,0x87B2,0x0000, 0xFBC0,0x87B3,0x0000, +0xFBC0,0x87B4,0x0000, 0xFBC0,0x87B5,0x0000, 0xFBC0,0x87B6,0x0000, +0xFBC0,0x87B7,0x0000, 0xFBC0,0x87B8,0x0000, 0xFBC0,0x87B9,0x0000, +0xFBC0,0x87BA,0x0000, 0xFBC0,0x87BB,0x0000, 0xFBC0,0x87BC,0x0000, +0xFBC0,0x87BD,0x0000, 0xFBC0,0x87BE,0x0000, 0xFBC0,0x87BF,0x0000, +0xFBC0,0x87C0,0x0000, 0xFBC0,0x87C1,0x0000, 0xFBC0,0x87C2,0x0000, +0xFBC0,0x87C3,0x0000, 0xFBC0,0x87C4,0x0000, 0xFBC0,0x87C5,0x0000, +0xFBC0,0x87C6,0x0000, 0xFBC0,0x87C7,0x0000, 0xFBC0,0x87C8,0x0000, +0xFBC0,0x87C9,0x0000, 0xFBC0,0x87CA,0x0000, 0xFBC0,0x87CB,0x0000, +0xFBC0,0x87CC,0x0000, 0xFBC0,0x87CD,0x0000, 0xFBC0,0x87CE,0x0000, +0xFBC0,0x87CF,0x0000, 0xFBC0,0x87D0,0x0000, 0xFBC0,0x87D1,0x0000, +0xFBC0,0x87D2,0x0000, 0xFBC0,0x87D3,0x0000, 0xFBC0,0x87D4,0x0000, +0xFBC0,0x87D5,0x0000, 0xFBC0,0x87D6,0x0000, 0xFBC0,0x87D7,0x0000, +0xFBC0,0x87D8,0x0000, 0xFBC0,0x87D9,0x0000, 0xFBC0,0x87DA,0x0000, +0xFBC0,0x87DB,0x0000, 0xFBC0,0x87DC,0x0000, 0xFBC0,0x87DD,0x0000, +0xFBC0,0x87DE,0x0000, 0xFBC0,0x87DF,0x0000, 0xFBC0,0x87E0,0x0000, +0xFBC0,0x87E1,0x0000, 0xFBC0,0x87E2,0x0000, 0xFBC0,0x87E3,0x0000, +0xFBC0,0x87E4,0x0000, 0xFBC0,0x87E5,0x0000, 0xFBC0,0x87E6,0x0000, +0xFBC0,0x87E7,0x0000, 0xFBC0,0x87E8,0x0000, 0xFBC0,0x87E9,0x0000, +0xFBC0,0x87EA,0x0000, 0xFBC0,0x87EB,0x0000, 0xFBC0,0x87EC,0x0000, +0xFBC0,0x87ED,0x0000, 0xFBC0,0x87EE,0x0000, 0xFBC0,0x87EF,0x0000, +0xFBC0,0x87F0,0x0000, 0xFBC0,0x87F1,0x0000, 0xFBC0,0x87F2,0x0000, +0xFBC0,0x87F3,0x0000, 0xFBC0,0x87F4,0x0000, 0xFBC0,0x87F5,0x0000, +0xFBC0,0x87F6,0x0000, 0xFBC0,0x87F7,0x0000, 0xFBC0,0x87F8,0x0000, +0xFBC0,0x87F9,0x0000, 0xFBC0,0x87FA,0x0000, 0xFBC0,0x87FB,0x0000, +0xFBC0,0x87FC,0x0000, 0xFBC0,0x87FD,0x0000, 0xFBC0,0x87FE,0x0000, +0xFBC0,0x87FF,0x0000 }; + +uint16 page009data[]= { /* 0900 (3 weights per char) */ +0xFBC0,0x8900,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x155A,0x0000,0x0000, 0x155B,0x0000,0x0000, +0x155C,0x0000,0x0000, 0x155D,0x0000,0x0000, 0x155E,0x0000,0x0000, +0x155F,0x0000,0x0000, 0x1560,0x0000,0x0000, 0x1561,0x0000,0x0000, +0x1563,0x0000,0x0000, 0x1565,0x0000,0x0000, 0x1566,0x0000,0x0000, +0x1567,0x0000,0x0000, 0x1568,0x0000,0x0000, 0x1569,0x0000,0x0000, +0x156A,0x0000,0x0000, 0x156B,0x0000,0x0000, 0x156C,0x0000,0x0000, +0x156D,0x0000,0x0000, 0x156E,0x0000,0x0000, 0x156F,0x0000,0x0000, +0x1570,0x0000,0x0000, 0x1571,0x0000,0x0000, 0x1572,0x0000,0x0000, +0x1573,0x0000,0x0000, 0x1574,0x0000,0x0000, 0x1575,0x0000,0x0000, +0x1576,0x0000,0x0000, 0x1577,0x0000,0x0000, 0x1578,0x0000,0x0000, +0x1579,0x0000,0x0000, 0x157A,0x0000,0x0000, 0x157B,0x0000,0x0000, +0x157C,0x0000,0x0000, 0x157D,0x0000,0x0000, 0x157E,0x0000,0x0000, +0x157F,0x0000,0x0000, 0x1580,0x0000,0x0000, 0x1580,0x0000,0x0000, +0x1581,0x0000,0x0000, 0x1582,0x0000,0x0000, 0x1583,0x0000,0x0000, +0x1584,0x0000,0x0000, 0x1585,0x0000,0x0000, 0x1586,0x0000,0x0000, +0x1587,0x0000,0x0000, 0x1587,0x0000,0x0000, 0x1588,0x0000,0x0000, +0x1589,0x0000,0x0000, 0x1589,0x0000,0x0000, 0x158A,0x0000,0x0000, +0x158B,0x0000,0x0000, 0x158C,0x0000,0x0000, 0x158D,0x0000,0x0000, +0x158E,0x0000,0x0000, 0xFBC0,0x893A,0x0000, 0xFBC0,0x893B,0x0000, +0x0000,0x0000,0x0000, 0x158F,0x0000,0x0000, 0x1590,0x0000,0x0000, +0x1591,0x0000,0x0000, 0x1592,0x0000,0x0000, 0x1593,0x0000,0x0000, +0x1594,0x0000,0x0000, 0x1595,0x0000,0x0000, 0x1596,0x0000,0x0000, +0x1599,0x0000,0x0000, 0x159A,0x0000,0x0000, 0x159B,0x0000,0x0000, +0x159C,0x0000,0x0000, 0x159D,0x0000,0x0000, 0x159E,0x0000,0x0000, +0x159F,0x0000,0x0000, 0x15A0,0x0000,0x0000, 0x15A1,0x0000,0x0000, +0xFBC0,0x894E,0x0000, 0xFBC0,0x894F,0x0000, 0x1559,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8955,0x0000, 0xFBC0,0x8956,0x0000, +0xFBC0,0x8957,0x0000, 0x156D,0x0000,0x0000, 0x156E,0x0000,0x0000, +0x156F,0x0000,0x0000, 0x1574,0x0000,0x0000, 0x1579,0x0000,0x0000, +0x157A,0x0000,0x0000, 0x1582,0x0000,0x0000, 0x1586,0x0000,0x0000, +0x1562,0x0000,0x0000, 0x1564,0x0000,0x0000, 0x1597,0x0000,0x0000, +0x1598,0x0000,0x0000, 0x0268,0x0000,0x0000, 0x0269,0x0000,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0x02FA,0x0000,0x0000, 0xFBC0,0x8971,0x0000, +0xFBC0,0x8972,0x0000, 0xFBC0,0x8973,0x0000, 0xFBC0,0x8974,0x0000, +0xFBC0,0x8975,0x0000, 0xFBC0,0x8976,0x0000, 0xFBC0,0x8977,0x0000, +0xFBC0,0x8978,0x0000, 0xFBC0,0x8979,0x0000, 0xFBC0,0x897A,0x0000, +0xFBC0,0x897B,0x0000, 0xFBC0,0x897C,0x0000, 0xFBC0,0x897D,0x0000, +0xFBC0,0x897E,0x0000, 0xFBC0,0x897F,0x0000, 0xFBC0,0x8980,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x8984,0x0000, 0x15A2,0x0000,0x0000, 0x15A3,0x0000,0x0000, +0x15A4,0x0000,0x0000, 0x15A5,0x0000,0x0000, 0x15A6,0x0000,0x0000, +0x15A7,0x0000,0x0000, 0x15A8,0x0000,0x0000, 0x15AA,0x0000,0x0000, +0xFBC0,0x898D,0x0000, 0xFBC0,0x898E,0x0000, 0x15AC,0x0000,0x0000, +0x15AD,0x0000,0x0000, 0xFBC0,0x8991,0x0000, 0xFBC0,0x8992,0x0000, +0x15AE,0x0000,0x0000, 0x15AF,0x0000,0x0000, 0x15B0,0x0000,0x0000, +0x15B1,0x0000,0x0000, 0x15B2,0x0000,0x0000, 0x15B3,0x0000,0x0000, +0x15B4,0x0000,0x0000, 0x15B5,0x0000,0x0000, 0x15B6,0x0000,0x0000, +0x15B7,0x0000,0x0000, 0x15B8,0x0000,0x0000, 0x15B9,0x0000,0x0000, +0x15BA,0x0000,0x0000, 0x15BB,0x0000,0x0000, 0x15BC,0x0000,0x0000, +0x15BD,0x0000,0x0000, 0x15BE,0x0000,0x0000, 0x15BF,0x0000,0x0000, +0x15C0,0x0000,0x0000, 0x15C1,0x0000,0x0000, 0x15C2,0x0000,0x0000, +0x15C3,0x0000,0x0000, 0xFBC0,0x89A9,0x0000, 0x15C4,0x0000,0x0000, +0x15C5,0x0000,0x0000, 0x15C6,0x0000,0x0000, 0x15C7,0x0000,0x0000, +0x15C8,0x0000,0x0000, 0x15C9,0x0000,0x0000, 0x15CA,0x0000,0x0000, +0xFBC0,0x89B1,0x0000, 0x15CC,0x0000,0x0000, 0xFBC0,0x89B3,0x0000, +0xFBC0,0x89B4,0x0000, 0xFBC0,0x89B5,0x0000, 0x15CE,0x0000,0x0000, +0x15CF,0x0000,0x0000, 0x15D0,0x0000,0x0000, 0x15D1,0x0000,0x0000, +0xFBC0,0x89BA,0x0000, 0xFBC0,0x89BB,0x0000, 0x0000,0x0000,0x0000, +0x15D2,0x0000,0x0000, 0x15D3,0x0000,0x0000, 0x15D4,0x0000,0x0000, +0x15D5,0x0000,0x0000, 0x15D6,0x0000,0x0000, 0x15D7,0x0000,0x0000, +0x15D8,0x0000,0x0000, 0x15D9,0x0000,0x0000, 0xFBC0,0x89C5,0x0000, +0xFBC0,0x89C6,0x0000, 0x15DC,0x0000,0x0000, 0x15DD,0x0000,0x0000, +0xFBC0,0x89C9,0x0000, 0xFBC0,0x89CA,0x0000, 0x15DE,0x0000,0x0000, +0x15DF,0x0000,0x0000, 0x15E0,0x0000,0x0000, 0xFBC0,0x89CE,0x0000, +0xFBC0,0x89CF,0x0000, 0xFBC0,0x89D0,0x0000, 0xFBC0,0x89D1,0x0000, +0xFBC0,0x89D2,0x0000, 0xFBC0,0x89D3,0x0000, 0xFBC0,0x89D4,0x0000, +0xFBC0,0x89D5,0x0000, 0xFBC0,0x89D6,0x0000, 0x15E1,0x0000,0x0000, +0xFBC0,0x89D8,0x0000, 0xFBC0,0x89D9,0x0000, 0xFBC0,0x89DA,0x0000, +0xFBC0,0x89DB,0x0000, 0x15BC,0x0000,0x0000, 0x15BD,0x0000,0x0000, +0xFBC0,0x89DE,0x0000, 0x15C9,0x0000,0x0000, 0x15A9,0x0000,0x0000, +0x15AB,0x0000,0x0000, 0x15DA,0x0000,0x0000, 0x15DB,0x0000,0x0000, +0xFBC0,0x89E4,0x0000, 0xFBC0,0x89E5,0x0000, 0x0E29,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x15CB,0x0000,0x0000, 0x15CD,0x0000,0x0000, 0x0E12,0x0000,0x0000, +0x0E13,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0DC7,0x0000,0x0000, +0x0DC8,0x0000,0x0000, 0x0350,0x0000,0x0000, 0xFBC0,0x89FB,0x0000, +0xFBC0,0x89FC,0x0000, 0xFBC0,0x89FD,0x0000, 0xFBC0,0x89FE,0x0000, +0xFBC0,0x89FF,0x0000 }; + +uint16 page00Adata[]= { /* 0A00 (3 weights per char) */ +0xFBC0,0x8A00,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8A04,0x0000, 0x15E7,0x0000,0x0000, +0x15E8,0x0000,0x0000, 0x15EC,0x0000,0x0000, 0x15ED,0x0000,0x0000, +0x15E4,0x0000,0x0000, 0x15E5,0x0000,0x0000, 0xFBC0,0x8A0B,0x0000, +0xFBC0,0x8A0C,0x0000, 0xFBC0,0x8A0D,0x0000, 0xFBC0,0x8A0E,0x0000, +0x15EE,0x0000,0x0000, 0x15E9,0x0000,0x0000, 0xFBC0,0x8A11,0x0000, +0xFBC0,0x8A12,0x0000, 0x15E6,0x0000,0x0000, 0x15EA,0x0000,0x0000, +0x15F1,0x0000,0x0000, 0x15F2,0x0000,0x0000, 0x15F3,0x0000,0x0000, +0x15F4,0x0000,0x0000, 0x15F5,0x0000,0x0000, 0x15F6,0x0000,0x0000, +0x15F7,0x0000,0x0000, 0x15F8,0x0000,0x0000, 0x15F9,0x0000,0x0000, +0x15FA,0x0000,0x0000, 0x15FB,0x0000,0x0000, 0x15FC,0x0000,0x0000, +0x15FD,0x0000,0x0000, 0x15FE,0x0000,0x0000, 0x15FF,0x0000,0x0000, +0x1600,0x0000,0x0000, 0x1601,0x0000,0x0000, 0x1602,0x0000,0x0000, +0x1603,0x0000,0x0000, 0x1604,0x0000,0x0000, 0xFBC0,0x8A29,0x0000, +0x1605,0x0000,0x0000, 0x1606,0x0000,0x0000, 0x1607,0x0000,0x0000, +0x1608,0x0000,0x0000, 0x1609,0x0000,0x0000, 0x160A,0x0000,0x0000, +0x160B,0x0000,0x0000, 0xFBC0,0x8A31,0x0000, 0x160C,0x0000,0x0000, +0x160C,0x0000,0x0000, 0xFBC0,0x8A34,0x0000, 0x160D,0x0000,0x0000, +0x15EF,0x0000,0x0000, 0xFBC0,0x8A37,0x0000, 0x15EF,0x0000,0x0000, +0x15F0,0x0000,0x0000, 0xFBC0,0x8A3A,0x0000, 0xFBC0,0x8A3B,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8A3D,0x0000, 0x160F,0x0000,0x0000, +0x1610,0x0000,0x0000, 0x1611,0x0000,0x0000, 0x1612,0x0000,0x0000, +0x1613,0x0000,0x0000, 0xFBC0,0x8A43,0x0000, 0xFBC0,0x8A44,0x0000, +0xFBC0,0x8A45,0x0000, 0xFBC0,0x8A46,0x0000, 0x1614,0x0000,0x0000, +0x1615,0x0000,0x0000, 0xFBC0,0x8A49,0x0000, 0xFBC0,0x8A4A,0x0000, +0x1616,0x0000,0x0000, 0x1617,0x0000,0x0000, 0x1618,0x0000,0x0000, +0xFBC0,0x8A4E,0x0000, 0xFBC0,0x8A4F,0x0000, 0xFBC0,0x8A50,0x0000, +0xFBC0,0x8A51,0x0000, 0xFBC0,0x8A52,0x0000, 0xFBC0,0x8A53,0x0000, +0xFBC0,0x8A54,0x0000, 0xFBC0,0x8A55,0x0000, 0xFBC0,0x8A56,0x0000, +0xFBC0,0x8A57,0x0000, 0xFBC0,0x8A58,0x0000, 0x15F2,0x0000,0x0000, +0x15F3,0x0000,0x0000, 0x15F8,0x0000,0x0000, 0x160E,0x0000,0x0000, +0xFBC0,0x8A5D,0x0000, 0x1606,0x0000,0x0000, 0xFBC0,0x8A5F,0x0000, +0xFBC0,0x8A60,0x0000, 0xFBC0,0x8A61,0x0000, 0xFBC0,0x8A62,0x0000, +0xFBC0,0x8A63,0x0000, 0xFBC0,0x8A64,0x0000, 0xFBC0,0x8A65,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x15EB,0x0000,0x0000, 0x15E3,0x0000,0x0000, 0x15E2,0x0000,0x0000, +0xFBC0,0x8A75,0x0000, 0xFBC0,0x8A76,0x0000, 0xFBC0,0x8A77,0x0000, +0xFBC0,0x8A78,0x0000, 0xFBC0,0x8A79,0x0000, 0xFBC0,0x8A7A,0x0000, +0xFBC0,0x8A7B,0x0000, 0xFBC0,0x8A7C,0x0000, 0xFBC0,0x8A7D,0x0000, +0xFBC0,0x8A7E,0x0000, 0xFBC0,0x8A7F,0x0000, 0xFBC0,0x8A80,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x8A84,0x0000, 0x161A,0x0000,0x0000, 0x161B,0x0000,0x0000, +0x161C,0x0000,0x0000, 0x161D,0x0000,0x0000, 0x161E,0x0000,0x0000, +0x161F,0x0000,0x0000, 0x1620,0x0000,0x0000, 0x1622,0x0000,0x0000, +0x1624,0x0000,0x0000, 0xFBC0,0x8A8E,0x0000, 0x1625,0x0000,0x0000, +0x1626,0x0000,0x0000, 0x1627,0x0000,0x0000, 0xFBC0,0x8A92,0x0000, +0x1628,0x0000,0x0000, 0x1629,0x0000,0x0000, 0x162A,0x0000,0x0000, +0x162B,0x0000,0x0000, 0x162C,0x0000,0x0000, 0x162D,0x0000,0x0000, +0x162E,0x0000,0x0000, 0x162F,0x0000,0x0000, 0x1630,0x0000,0x0000, +0x1631,0x0000,0x0000, 0x1632,0x0000,0x0000, 0x1633,0x0000,0x0000, +0x1634,0x0000,0x0000, 0x1635,0x0000,0x0000, 0x1636,0x0000,0x0000, +0x1637,0x0000,0x0000, 0x1638,0x0000,0x0000, 0x1639,0x0000,0x0000, +0x163A,0x0000,0x0000, 0x163B,0x0000,0x0000, 0x163C,0x0000,0x0000, +0x163D,0x0000,0x0000, 0xFBC0,0x8AA9,0x0000, 0x163E,0x0000,0x0000, +0x163F,0x0000,0x0000, 0x1640,0x0000,0x0000, 0x1641,0x0000,0x0000, +0x1642,0x0000,0x0000, 0x1643,0x0000,0x0000, 0x1644,0x0000,0x0000, +0xFBC0,0x8AB1,0x0000, 0x1645,0x0000,0x0000, 0x1646,0x0000,0x0000, +0xFBC0,0x8AB4,0x0000, 0x1647,0x0000,0x0000, 0x1648,0x0000,0x0000, +0x1649,0x0000,0x0000, 0x164A,0x0000,0x0000, 0x164B,0x0000,0x0000, +0xFBC0,0x8ABA,0x0000, 0xFBC0,0x8ABB,0x0000, 0x0000,0x0000,0x0000, +0x164C,0x0000,0x0000, 0x164D,0x0000,0x0000, 0x164E,0x0000,0x0000, +0x164F,0x0000,0x0000, 0x1650,0x0000,0x0000, 0x1651,0x0000,0x0000, +0x1652,0x0000,0x0000, 0x1653,0x0000,0x0000, 0x1656,0x0000,0x0000, +0xFBC0,0x8AC6,0x0000, 0x1657,0x0000,0x0000, 0x1658,0x0000,0x0000, +0x1659,0x0000,0x0000, 0xFBC0,0x8ACA,0x0000, 0x165A,0x0000,0x0000, +0x165B,0x0000,0x0000, 0x165C,0x0000,0x0000, 0xFBC0,0x8ACE,0x0000, +0xFBC0,0x8ACF,0x0000, 0x1619,0x0000,0x0000, 0xFBC0,0x8AD1,0x0000, +0xFBC0,0x8AD2,0x0000, 0xFBC0,0x8AD3,0x0000, 0xFBC0,0x8AD4,0x0000, +0xFBC0,0x8AD5,0x0000, 0xFBC0,0x8AD6,0x0000, 0xFBC0,0x8AD7,0x0000, +0xFBC0,0x8AD8,0x0000, 0xFBC0,0x8AD9,0x0000, 0xFBC0,0x8ADA,0x0000, +0xFBC0,0x8ADB,0x0000, 0xFBC0,0x8ADC,0x0000, 0xFBC0,0x8ADD,0x0000, +0xFBC0,0x8ADE,0x0000, 0xFBC0,0x8ADF,0x0000, 0x1621,0x0000,0x0000, +0x1623,0x0000,0x0000, 0x1654,0x0000,0x0000, 0x1655,0x0000,0x0000, +0xFBC0,0x8AE4,0x0000, 0xFBC0,0x8AE5,0x0000, 0x0E29,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0xFBC0,0x8AF0,0x0000, 0x0E14,0x0000,0x0000, 0xFBC0,0x8AF2,0x0000, +0xFBC0,0x8AF3,0x0000, 0xFBC0,0x8AF4,0x0000, 0xFBC0,0x8AF5,0x0000, +0xFBC0,0x8AF6,0x0000, 0xFBC0,0x8AF7,0x0000, 0xFBC0,0x8AF8,0x0000, +0xFBC0,0x8AF9,0x0000, 0xFBC0,0x8AFA,0x0000, 0xFBC0,0x8AFB,0x0000, +0xFBC0,0x8AFC,0x0000, 0xFBC0,0x8AFD,0x0000, 0xFBC0,0x8AFE,0x0000, +0xFBC0,0x8AFF,0x0000 }; + +uint16 page00Bdata[]= { /* 0B00 (3 weights per char) */ +0xFBC0,0x8B00,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8B04,0x0000, 0x165D,0x0000,0x0000, +0x165E,0x0000,0x0000, 0x165F,0x0000,0x0000, 0x1660,0x0000,0x0000, +0x1661,0x0000,0x0000, 0x1662,0x0000,0x0000, 0x1663,0x0000,0x0000, +0x1665,0x0000,0x0000, 0xFBC0,0x8B0D,0x0000, 0xFBC0,0x8B0E,0x0000, +0x1667,0x0000,0x0000, 0x1668,0x0000,0x0000, 0xFBC0,0x8B11,0x0000, +0xFBC0,0x8B12,0x0000, 0x1669,0x0000,0x0000, 0x166A,0x0000,0x0000, +0x166B,0x0000,0x0000, 0x166C,0x0000,0x0000, 0x166D,0x0000,0x0000, +0x166E,0x0000,0x0000, 0x166F,0x0000,0x0000, 0x1670,0x0000,0x0000, +0x1671,0x0000,0x0000, 0x1672,0x0000,0x0000, 0x1673,0x0000,0x0000, +0x1674,0x0000,0x0000, 0x1675,0x0000,0x0000, 0x1676,0x0000,0x0000, +0x1677,0x0000,0x0000, 0x1678,0x0000,0x0000, 0x1679,0x0000,0x0000, +0x167A,0x0000,0x0000, 0x167B,0x0000,0x0000, 0x167C,0x0000,0x0000, +0x167D,0x0000,0x0000, 0x167E,0x0000,0x0000, 0xFBC0,0x8B29,0x0000, +0x167F,0x0000,0x0000, 0x1680,0x0000,0x0000, 0x1681,0x0000,0x0000, +0x1682,0x0000,0x0000, 0x1683,0x0000,0x0000, 0x1684,0x0000,0x0000, +0x1686,0x0000,0x0000, 0xFBC0,0x8B31,0x0000, 0x1687,0x0000,0x0000, +0x1688,0x0000,0x0000, 0xFBC0,0x8B34,0x0000, 0x1689,0x0000,0x0000, +0x168B,0x0000,0x0000, 0x168C,0x0000,0x0000, 0x168D,0x0000,0x0000, +0x168E,0x0000,0x0000, 0xFBC0,0x8B3A,0x0000, 0xFBC0,0x8B3B,0x0000, +0x0000,0x0000,0x0000, 0x168F,0x0000,0x0000, 0x1690,0x0000,0x0000, +0x1691,0x0000,0x0000, 0x1692,0x0000,0x0000, 0x1693,0x0000,0x0000, +0x1694,0x0000,0x0000, 0x1695,0x0000,0x0000, 0xFBC0,0x8B44,0x0000, +0xFBC0,0x8B45,0x0000, 0xFBC0,0x8B46,0x0000, 0x1696,0x0000,0x0000, +0x1697,0x0000,0x0000, 0xFBC0,0x8B49,0x0000, 0xFBC0,0x8B4A,0x0000, +0x1698,0x0000,0x0000, 0x1699,0x0000,0x0000, 0x169A,0x0000,0x0000, +0xFBC0,0x8B4E,0x0000, 0xFBC0,0x8B4F,0x0000, 0xFBC0,0x8B50,0x0000, +0xFBC0,0x8B51,0x0000, 0xFBC0,0x8B52,0x0000, 0xFBC0,0x8B53,0x0000, +0xFBC0,0x8B54,0x0000, 0xFBC0,0x8B55,0x0000, 0x169B,0x0000,0x0000, +0x169C,0x0000,0x0000, 0xFBC0,0x8B58,0x0000, 0xFBC0,0x8B59,0x0000, +0xFBC0,0x8B5A,0x0000, 0xFBC0,0x8B5B,0x0000, 0x1677,0x0000,0x0000, +0x1678,0x0000,0x0000, 0xFBC0,0x8B5E,0x0000, 0x1685,0x0000,0x0000, +0x1664,0x0000,0x0000, 0x1666,0x0000,0x0000, 0xFBC0,0x8B62,0x0000, +0xFBC0,0x8B63,0x0000, 0xFBC0,0x8B64,0x0000, 0xFBC0,0x8B65,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0x0351,0x0000,0x0000, 0x168A,0x0000,0x0000, +0xFBC0,0x8B72,0x0000, 0xFBC0,0x8B73,0x0000, 0xFBC0,0x8B74,0x0000, +0xFBC0,0x8B75,0x0000, 0xFBC0,0x8B76,0x0000, 0xFBC0,0x8B77,0x0000, +0xFBC0,0x8B78,0x0000, 0xFBC0,0x8B79,0x0000, 0xFBC0,0x8B7A,0x0000, +0xFBC0,0x8B7B,0x0000, 0xFBC0,0x8B7C,0x0000, 0xFBC0,0x8B7D,0x0000, +0xFBC0,0x8B7E,0x0000, 0xFBC0,0x8B7F,0x0000, 0xFBC0,0x8B80,0x0000, +0xFBC0,0x8B81,0x0000, 0x0000,0x0000,0x0000, 0x169D,0x0000,0x0000, +0xFBC0,0x8B84,0x0000, 0x169E,0x0000,0x0000, 0x169F,0x0000,0x0000, +0x16A0,0x0000,0x0000, 0x16A1,0x0000,0x0000, 0x16A2,0x0000,0x0000, +0x16A3,0x0000,0x0000, 0xFBC0,0x8B8B,0x0000, 0xFBC0,0x8B8C,0x0000, +0xFBC0,0x8B8D,0x0000, 0x16A4,0x0000,0x0000, 0x16A5,0x0000,0x0000, +0x16A6,0x0000,0x0000, 0xFBC0,0x8B91,0x0000, 0x16A7,0x0000,0x0000, +0x16A8,0x0000,0x0000, 0x16A9,0x0000,0x0000, 0x16AA,0x0000,0x0000, +0xFBC0,0x8B96,0x0000, 0xFBC0,0x8B97,0x0000, 0xFBC0,0x8B98,0x0000, +0x16AB,0x0000,0x0000, 0x16AC,0x0000,0x0000, 0xFBC0,0x8B9B,0x0000, +0x16AD,0x0000,0x0000, 0xFBC0,0x8B9D,0x0000, 0x16AE,0x0000,0x0000, +0x16AF,0x0000,0x0000, 0xFBC0,0x8BA0,0x0000, 0xFBC0,0x8BA1,0x0000, +0xFBC0,0x8BA2,0x0000, 0x16B0,0x0000,0x0000, 0x16B1,0x0000,0x0000, +0xFBC0,0x8BA5,0x0000, 0xFBC0,0x8BA6,0x0000, 0xFBC0,0x8BA7,0x0000, +0x16B2,0x0000,0x0000, 0x16B3,0x0000,0x0000, 0x16B4,0x0000,0x0000, +0xFBC0,0x8BAB,0x0000, 0xFBC0,0x8BAC,0x0000, 0xFBC0,0x8BAD,0x0000, +0x16B5,0x0000,0x0000, 0x16B6,0x0000,0x0000, 0x16B7,0x0000,0x0000, +0x16B8,0x0000,0x0000, 0x16B9,0x0000,0x0000, 0x16BA,0x0000,0x0000, +0x16BB,0x0000,0x0000, 0x16BC,0x0000,0x0000, 0xFBC0,0x8BB6,0x0000, +0x16BD,0x0000,0x0000, 0x16BE,0x0000,0x0000, 0x16BF,0x0000,0x0000, +0xFBC0,0x8BBA,0x0000, 0xFBC0,0x8BBB,0x0000, 0xFBC0,0x8BBC,0x0000, +0xFBC0,0x8BBD,0x0000, 0x16C0,0x0000,0x0000, 0x16C1,0x0000,0x0000, +0x16C2,0x0000,0x0000, 0x16C3,0x0000,0x0000, 0x16C4,0x0000,0x0000, +0xFBC0,0x8BC3,0x0000, 0xFBC0,0x8BC4,0x0000, 0xFBC0,0x8BC5,0x0000, +0x16C5,0x0000,0x0000, 0x16C6,0x0000,0x0000, 0x16C7,0x0000,0x0000, +0xFBC0,0x8BC9,0x0000, 0x16C8,0x0000,0x0000, 0x16C9,0x0000,0x0000, +0x16CA,0x0000,0x0000, 0x16CB,0x0000,0x0000, 0xFBC0,0x8BCE,0x0000, +0xFBC0,0x8BCF,0x0000, 0xFBC0,0x8BD0,0x0000, 0xFBC0,0x8BD1,0x0000, +0xFBC0,0x8BD2,0x0000, 0xFBC0,0x8BD3,0x0000, 0xFBC0,0x8BD4,0x0000, +0xFBC0,0x8BD5,0x0000, 0xFBC0,0x8BD6,0x0000, 0x16CC,0x0000,0x0000, +0xFBC0,0x8BD8,0x0000, 0xFBC0,0x8BD9,0x0000, 0xFBC0,0x8BDA,0x0000, +0xFBC0,0x8BDB,0x0000, 0xFBC0,0x8BDC,0x0000, 0xFBC0,0x8BDD,0x0000, +0xFBC0,0x8BDE,0x0000, 0xFBC0,0x8BDF,0x0000, 0xFBC0,0x8BE0,0x0000, +0xFBC0,0x8BE1,0x0000, 0xFBC0,0x8BE2,0x0000, 0xFBC0,0x8BE3,0x0000, +0xFBC0,0x8BE4,0x0000, 0xFBC0,0x8BE5,0x0000, 0xFBC0,0x8BE6,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x0DC9,0x0000,0x0000, 0x0DCA,0x0000,0x0000, 0x0DCB,0x0000,0x0000, +0x0352,0x0000,0x0000, 0x0353,0x0000,0x0000, 0x0354,0x0000,0x0000, +0x0355,0x0000,0x0000, 0x0356,0x0000,0x0000, 0x0357,0x0000,0x0000, +0x0E15,0x0000,0x0000, 0x0358,0x0000,0x0000, 0xFBC0,0x8BFB,0x0000, +0xFBC0,0x8BFC,0x0000, 0xFBC0,0x8BFD,0x0000, 0xFBC0,0x8BFE,0x0000, +0xFBC0,0x8BFF,0x0000 }; + +uint16 page00Cdata[]= { /* 0C00 (3 weights per char) */ +0xFBC0,0x8C00,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8C04,0x0000, 0x16CD,0x0000,0x0000, +0x16CE,0x0000,0x0000, 0x16CF,0x0000,0x0000, 0x16D0,0x0000,0x0000, +0x16D1,0x0000,0x0000, 0x16D2,0x0000,0x0000, 0x16D3,0x0000,0x0000, +0x16D5,0x0000,0x0000, 0xFBC0,0x8C0D,0x0000, 0x16D7,0x0000,0x0000, +0x16D8,0x0000,0x0000, 0x16D9,0x0000,0x0000, 0xFBC0,0x8C11,0x0000, +0x16DA,0x0000,0x0000, 0x16DB,0x0000,0x0000, 0x16DC,0x0000,0x0000, +0x16DD,0x0000,0x0000, 0x16DE,0x0000,0x0000, 0x16DF,0x0000,0x0000, +0x16E0,0x0000,0x0000, 0x16E1,0x0000,0x0000, 0x16E2,0x0000,0x0000, +0x16E3,0x0000,0x0000, 0x16E4,0x0000,0x0000, 0x16E5,0x0000,0x0000, +0x16E6,0x0000,0x0000, 0x16E7,0x0000,0x0000, 0x16E8,0x0000,0x0000, +0x16E9,0x0000,0x0000, 0x16EA,0x0000,0x0000, 0x16EB,0x0000,0x0000, +0x16EC,0x0000,0x0000, 0x16ED,0x0000,0x0000, 0x16EE,0x0000,0x0000, +0x16EF,0x0000,0x0000, 0x16F0,0x0000,0x0000, 0xFBC0,0x8C29,0x0000, +0x16F1,0x0000,0x0000, 0x16F2,0x0000,0x0000, 0x16F3,0x0000,0x0000, +0x16F4,0x0000,0x0000, 0x16F5,0x0000,0x0000, 0x16F6,0x0000,0x0000, +0x16F7,0x0000,0x0000, 0x16F8,0x0000,0x0000, 0x16F9,0x0000,0x0000, +0x16FA,0x0000,0x0000, 0xFBC0,0x8C34,0x0000, 0x16FB,0x0000,0x0000, +0x16FC,0x0000,0x0000, 0x16FD,0x0000,0x0000, 0x16FE,0x0000,0x0000, +0x16FF,0x0000,0x0000, 0xFBC0,0x8C3A,0x0000, 0xFBC0,0x8C3B,0x0000, +0xFBC0,0x8C3C,0x0000, 0xFBC0,0x8C3D,0x0000, 0x1700,0x0000,0x0000, +0x1701,0x0000,0x0000, 0x1702,0x0000,0x0000, 0x1703,0x0000,0x0000, +0x1704,0x0000,0x0000, 0x1705,0x0000,0x0000, 0x1706,0x0000,0x0000, +0xFBC0,0x8C45,0x0000, 0x1707,0x0000,0x0000, 0x1708,0x0000,0x0000, +0x1709,0x0000,0x0000, 0xFBC0,0x8C49,0x0000, 0x170A,0x0000,0x0000, +0x170B,0x0000,0x0000, 0x170C,0x0000,0x0000, 0x170D,0x0000,0x0000, +0xFBC0,0x8C4E,0x0000, 0xFBC0,0x8C4F,0x0000, 0xFBC0,0x8C50,0x0000, +0xFBC0,0x8C51,0x0000, 0xFBC0,0x8C52,0x0000, 0xFBC0,0x8C53,0x0000, +0xFBC0,0x8C54,0x0000, 0x170E,0x0000,0x0000, 0x170F,0x0000,0x0000, +0xFBC0,0x8C57,0x0000, 0xFBC0,0x8C58,0x0000, 0xFBC0,0x8C59,0x0000, +0xFBC0,0x8C5A,0x0000, 0xFBC0,0x8C5B,0x0000, 0xFBC0,0x8C5C,0x0000, +0xFBC0,0x8C5D,0x0000, 0xFBC0,0x8C5E,0x0000, 0xFBC0,0x8C5F,0x0000, +0x16D4,0x0000,0x0000, 0x16D6,0x0000,0x0000, 0xFBC0,0x8C62,0x0000, +0xFBC0,0x8C63,0x0000, 0xFBC0,0x8C64,0x0000, 0xFBC0,0x8C65,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0xFBC0,0x8C70,0x0000, 0xFBC0,0x8C71,0x0000, +0xFBC0,0x8C72,0x0000, 0xFBC0,0x8C73,0x0000, 0xFBC0,0x8C74,0x0000, +0xFBC0,0x8C75,0x0000, 0xFBC0,0x8C76,0x0000, 0xFBC0,0x8C77,0x0000, +0xFBC0,0x8C78,0x0000, 0xFBC0,0x8C79,0x0000, 0xFBC0,0x8C7A,0x0000, +0xFBC0,0x8C7B,0x0000, 0xFBC0,0x8C7C,0x0000, 0xFBC0,0x8C7D,0x0000, +0xFBC0,0x8C7E,0x0000, 0xFBC0,0x8C7F,0x0000, 0xFBC0,0x8C80,0x0000, +0xFBC0,0x8C81,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x8C84,0x0000, 0x1710,0x0000,0x0000, 0x1711,0x0000,0x0000, +0x1712,0x0000,0x0000, 0x1713,0x0000,0x0000, 0x1714,0x0000,0x0000, +0x1715,0x0000,0x0000, 0x1716,0x0000,0x0000, 0x1718,0x0000,0x0000, +0xFBC0,0x8C8D,0x0000, 0x171A,0x0000,0x0000, 0x171B,0x0000,0x0000, +0x171C,0x0000,0x0000, 0xFBC0,0x8C91,0x0000, 0x171D,0x0000,0x0000, +0x171E,0x0000,0x0000, 0x171F,0x0000,0x0000, 0x1720,0x0000,0x0000, +0x1721,0x0000,0x0000, 0x1722,0x0000,0x0000, 0x1723,0x0000,0x0000, +0x1724,0x0000,0x0000, 0x1725,0x0000,0x0000, 0x1726,0x0000,0x0000, +0x1727,0x0000,0x0000, 0x1728,0x0000,0x0000, 0x1729,0x0000,0x0000, +0x172A,0x0000,0x0000, 0x172B,0x0000,0x0000, 0x172C,0x0000,0x0000, +0x172D,0x0000,0x0000, 0x172E,0x0000,0x0000, 0x172F,0x0000,0x0000, +0x1730,0x0000,0x0000, 0x1731,0x0000,0x0000, 0x1732,0x0000,0x0000, +0x1733,0x0000,0x0000, 0xFBC0,0x8CA9,0x0000, 0x1734,0x0000,0x0000, +0x1735,0x0000,0x0000, 0x1736,0x0000,0x0000, 0x1737,0x0000,0x0000, +0x1738,0x0000,0x0000, 0x1739,0x0000,0x0000, 0x173A,0x0000,0x0000, +0x173B,0x0000,0x0000, 0x173C,0x0000,0x0000, 0x1743,0x0000,0x0000, +0xFBC0,0x8CB4,0x0000, 0x173D,0x0000,0x0000, 0x173E,0x0000,0x0000, +0x173F,0x0000,0x0000, 0x1740,0x0000,0x0000, 0x1741,0x0000,0x0000, +0xFBC0,0x8CBA,0x0000, 0xFBC0,0x8CBB,0x0000, 0x0000,0x0000,0x0000, +0x1742,0x0000,0x0000, 0x1745,0x0000,0x0000, 0x1746,0x0000,0x0000, +0x1747,0x0000,0x0000, 0x1748,0x0000,0x0000, 0x1749,0x0000,0x0000, +0x174A,0x0000,0x0000, 0x174B,0x0000,0x0000, 0xFBC0,0x8CC5,0x0000, +0x174C,0x0000,0x0000, 0x174D,0x0000,0x0000, 0x174E,0x0000,0x0000, +0xFBC0,0x8CC9,0x0000, 0x174F,0x0000,0x0000, 0x1750,0x0000,0x0000, +0x1751,0x0000,0x0000, 0x1752,0x0000,0x0000, 0xFBC0,0x8CCE,0x0000, +0xFBC0,0x8CCF,0x0000, 0xFBC0,0x8CD0,0x0000, 0xFBC0,0x8CD1,0x0000, +0xFBC0,0x8CD2,0x0000, 0xFBC0,0x8CD3,0x0000, 0xFBC0,0x8CD4,0x0000, +0x1753,0x0000,0x0000, 0x1754,0x0000,0x0000, 0xFBC0,0x8CD7,0x0000, +0xFBC0,0x8CD8,0x0000, 0xFBC0,0x8CD9,0x0000, 0xFBC0,0x8CDA,0x0000, +0xFBC0,0x8CDB,0x0000, 0xFBC0,0x8CDC,0x0000, 0xFBC0,0x8CDD,0x0000, +0x1744,0x0000,0x0000, 0xFBC0,0x8CDF,0x0000, 0x1717,0x0000,0x0000, +0x1719,0x0000,0x0000, 0xFBC0,0x8CE2,0x0000, 0xFBC0,0x8CE3,0x0000, +0xFBC0,0x8CE4,0x0000, 0xFBC0,0x8CE5,0x0000, 0x0E29,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0xFBC0,0x8CF0,0x0000, 0xFBC0,0x8CF1,0x0000, 0xFBC0,0x8CF2,0x0000, +0xFBC0,0x8CF3,0x0000, 0xFBC0,0x8CF4,0x0000, 0xFBC0,0x8CF5,0x0000, +0xFBC0,0x8CF6,0x0000, 0xFBC0,0x8CF7,0x0000, 0xFBC0,0x8CF8,0x0000, +0xFBC0,0x8CF9,0x0000, 0xFBC0,0x8CFA,0x0000, 0xFBC0,0x8CFB,0x0000, +0xFBC0,0x8CFC,0x0000, 0xFBC0,0x8CFD,0x0000, 0xFBC0,0x8CFE,0x0000, +0xFBC0,0x8CFF,0x0000 }; + +uint16 page00Ddata[]= { /* 0D00 (3 weights per char) */ +0xFBC0,0x8D00,0x0000, 0xFBC0,0x8D01,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC0,0x8D04,0x0000, 0x1755,0x0000,0x0000, +0x1756,0x0000,0x0000, 0x1757,0x0000,0x0000, 0x1758,0x0000,0x0000, +0x1759,0x0000,0x0000, 0x175A,0x0000,0x0000, 0x175B,0x0000,0x0000, +0x175D,0x0000,0x0000, 0xFBC0,0x8D0D,0x0000, 0x175F,0x0000,0x0000, +0x1760,0x0000,0x0000, 0x1761,0x0000,0x0000, 0xFBC0,0x8D11,0x0000, +0x1762,0x0000,0x0000, 0x1763,0x0000,0x0000, 0x1764,0x0000,0x0000, +0x1765,0x0000,0x0000, 0x1766,0x0000,0x0000, 0x1767,0x0000,0x0000, +0x1768,0x0000,0x0000, 0x1769,0x0000,0x0000, 0x176A,0x0000,0x0000, +0x176B,0x0000,0x0000, 0x176C,0x0000,0x0000, 0x176D,0x0000,0x0000, +0x176E,0x0000,0x0000, 0x176F,0x0000,0x0000, 0x1770,0x0000,0x0000, +0x1771,0x0000,0x0000, 0x1772,0x0000,0x0000, 0x1773,0x0000,0x0000, +0x1774,0x0000,0x0000, 0x1775,0x0000,0x0000, 0x1776,0x0000,0x0000, +0x1777,0x0000,0x0000, 0x1778,0x0000,0x0000, 0xFBC0,0x8D29,0x0000, +0x1779,0x0000,0x0000, 0x177A,0x0000,0x0000, 0x177B,0x0000,0x0000, +0x177C,0x0000,0x0000, 0x177D,0x0000,0x0000, 0x177E,0x0000,0x0000, +0x177F,0x0000,0x0000, 0x1780,0x0000,0x0000, 0x1781,0x0000,0x0000, +0x1782,0x0000,0x0000, 0x1783,0x0000,0x0000, 0x1784,0x0000,0x0000, +0x1785,0x0000,0x0000, 0x1786,0x0000,0x0000, 0x1787,0x0000,0x0000, +0x1788,0x0000,0x0000, 0xFBC0,0x8D3A,0x0000, 0xFBC0,0x8D3B,0x0000, +0xFBC0,0x8D3C,0x0000, 0xFBC0,0x8D3D,0x0000, 0x1789,0x0000,0x0000, +0x178A,0x0000,0x0000, 0x178B,0x0000,0x0000, 0x178C,0x0000,0x0000, +0x178D,0x0000,0x0000, 0x178E,0x0000,0x0000, 0xFBC0,0x8D44,0x0000, +0xFBC0,0x8D45,0x0000, 0x178F,0x0000,0x0000, 0x1790,0x0000,0x0000, +0x1791,0x0000,0x0000, 0xFBC0,0x8D49,0x0000, 0x1792,0x0000,0x0000, +0x1793,0x0000,0x0000, 0x1794,0x0000,0x0000, 0x1795,0x0000,0x0000, +0xFBC0,0x8D4E,0x0000, 0xFBC0,0x8D4F,0x0000, 0xFBC0,0x8D50,0x0000, +0xFBC0,0x8D51,0x0000, 0xFBC0,0x8D52,0x0000, 0xFBC0,0x8D53,0x0000, +0xFBC0,0x8D54,0x0000, 0xFBC0,0x8D55,0x0000, 0xFBC0,0x8D56,0x0000, +0x1796,0x0000,0x0000, 0xFBC0,0x8D58,0x0000, 0xFBC0,0x8D59,0x0000, +0xFBC0,0x8D5A,0x0000, 0xFBC0,0x8D5B,0x0000, 0xFBC0,0x8D5C,0x0000, +0xFBC0,0x8D5D,0x0000, 0xFBC0,0x8D5E,0x0000, 0xFBC0,0x8D5F,0x0000, +0x175C,0x0000,0x0000, 0x175E,0x0000,0x0000, 0xFBC0,0x8D62,0x0000, +0xFBC0,0x8D63,0x0000, 0xFBC0,0x8D64,0x0000, 0xFBC0,0x8D65,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0xFBC0,0x8D70,0x0000, 0xFBC0,0x8D71,0x0000, +0xFBC0,0x8D72,0x0000, 0xFBC0,0x8D73,0x0000, 0xFBC0,0x8D74,0x0000, +0xFBC0,0x8D75,0x0000, 0xFBC0,0x8D76,0x0000, 0xFBC0,0x8D77,0x0000, +0xFBC0,0x8D78,0x0000, 0xFBC0,0x8D79,0x0000, 0xFBC0,0x8D7A,0x0000, +0xFBC0,0x8D7B,0x0000, 0xFBC0,0x8D7C,0x0000, 0xFBC0,0x8D7D,0x0000, +0xFBC0,0x8D7E,0x0000, 0xFBC0,0x8D7F,0x0000, 0xFBC0,0x8D80,0x0000, +0xFBC0,0x8D81,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x8D84,0x0000, 0x1797,0x0000,0x0000, 0x1798,0x0000,0x0000, +0x1799,0x0000,0x0000, 0x179A,0x0000,0x0000, 0x179B,0x0000,0x0000, +0x179C,0x0000,0x0000, 0x179D,0x0000,0x0000, 0x179E,0x0000,0x0000, +0x179F,0x0000,0x0000, 0x17A0,0x0000,0x0000, 0x17A1,0x0000,0x0000, +0x17A2,0x0000,0x0000, 0x17A3,0x0000,0x0000, 0x17A4,0x0000,0x0000, +0x17A5,0x0000,0x0000, 0x17A6,0x0000,0x0000, 0x17A7,0x0000,0x0000, +0x17A8,0x0000,0x0000, 0xFBC0,0x8D97,0x0000, 0xFBC0,0x8D98,0x0000, +0xFBC0,0x8D99,0x0000, 0x17A9,0x0000,0x0000, 0x17AA,0x0000,0x0000, +0x17AB,0x0000,0x0000, 0x17AC,0x0000,0x0000, 0x17AD,0x0000,0x0000, +0x17AE,0x0000,0x0000, 0x17AF,0x0000,0x0000, 0x17B0,0x0000,0x0000, +0x17B1,0x0000,0x0000, 0x17B2,0x0000,0x0000, 0x17B3,0x0000,0x0000, +0x17B4,0x0000,0x0000, 0x17B5,0x0000,0x0000, 0x17B6,0x0000,0x0000, +0x17B7,0x0000,0x0000, 0x17B8,0x0000,0x0000, 0x17B9,0x0000,0x0000, +0x17BA,0x0000,0x0000, 0x17BB,0x0000,0x0000, 0x17BC,0x0000,0x0000, +0x17BD,0x0000,0x0000, 0x17BE,0x0000,0x0000, 0x17BF,0x0000,0x0000, +0x17C0,0x0000,0x0000, 0xFBC0,0x8DB2,0x0000, 0x17C1,0x0000,0x0000, +0x17C2,0x0000,0x0000, 0x17C3,0x0000,0x0000, 0x17C4,0x0000,0x0000, +0x17C5,0x0000,0x0000, 0x17C6,0x0000,0x0000, 0x17C7,0x0000,0x0000, +0x17C8,0x0000,0x0000, 0x17C9,0x0000,0x0000, 0xFBC0,0x8DBC,0x0000, +0x17CA,0x0000,0x0000, 0xFBC0,0x8DBE,0x0000, 0xFBC0,0x8DBF,0x0000, +0x17CB,0x0000,0x0000, 0x17CC,0x0000,0x0000, 0x17CD,0x0000,0x0000, +0x17CE,0x0000,0x0000, 0x17CF,0x0000,0x0000, 0x17D0,0x0000,0x0000, +0x17D1,0x0000,0x0000, 0xFBC0,0x8DC7,0x0000, 0xFBC0,0x8DC8,0x0000, +0xFBC0,0x8DC9,0x0000, 0x17D2,0x0000,0x0000, 0xFBC0,0x8DCB,0x0000, +0xFBC0,0x8DCC,0x0000, 0xFBC0,0x8DCD,0x0000, 0xFBC0,0x8DCE,0x0000, +0x17D3,0x0000,0x0000, 0x17D4,0x0000,0x0000, 0x17D5,0x0000,0x0000, +0x17D6,0x0000,0x0000, 0x17D7,0x0000,0x0000, 0x17D8,0x0000,0x0000, +0xFBC0,0x8DD5,0x0000, 0x17D9,0x0000,0x0000, 0xFBC0,0x8DD7,0x0000, +0x17DA,0x0000,0x0000, 0x17DB,0x0000,0x0000, 0x17DC,0x0000,0x0000, +0x17DD,0x0000,0x0000, 0x17DE,0x0000,0x0000, 0x17DF,0x0000,0x0000, +0x17E0,0x0000,0x0000, 0x17E1,0x0000,0x0000, 0xFBC0,0x8DE0,0x0000, +0xFBC0,0x8DE1,0x0000, 0xFBC0,0x8DE2,0x0000, 0xFBC0,0x8DE3,0x0000, +0xFBC0,0x8DE4,0x0000, 0xFBC0,0x8DE5,0x0000, 0xFBC0,0x8DE6,0x0000, +0xFBC0,0x8DE7,0x0000, 0xFBC0,0x8DE8,0x0000, 0xFBC0,0x8DE9,0x0000, +0xFBC0,0x8DEA,0x0000, 0xFBC0,0x8DEB,0x0000, 0xFBC0,0x8DEC,0x0000, +0xFBC0,0x8DED,0x0000, 0xFBC0,0x8DEE,0x0000, 0xFBC0,0x8DEF,0x0000, +0xFBC0,0x8DF0,0x0000, 0xFBC0,0x8DF1,0x0000, 0x17E2,0x0000,0x0000, +0x17E3,0x0000,0x0000, 0x02FB,0x0000,0x0000, 0xFBC0,0x8DF5,0x0000, +0xFBC0,0x8DF6,0x0000, 0xFBC0,0x8DF7,0x0000, 0xFBC0,0x8DF8,0x0000, +0xFBC0,0x8DF9,0x0000, 0xFBC0,0x8DFA,0x0000, 0xFBC0,0x8DFB,0x0000, +0xFBC0,0x8DFC,0x0000, 0xFBC0,0x8DFD,0x0000, 0xFBC0,0x8DFE,0x0000, +0xFBC0,0x8DFF,0x0000 }; + +uint16 page00Edata[]= { /* 0E00 (3 weights per char) */ +0xFBC0,0x8E00,0x0000, 0x17E4,0x0000,0x0000, 0x17E5,0x0000,0x0000, +0x17E6,0x0000,0x0000, 0x17E7,0x0000,0x0000, 0x17E8,0x0000,0x0000, +0x17E9,0x0000,0x0000, 0x17EA,0x0000,0x0000, 0x17EB,0x0000,0x0000, +0x17EC,0x0000,0x0000, 0x17ED,0x0000,0x0000, 0x17EE,0x0000,0x0000, +0x17EF,0x0000,0x0000, 0x17F0,0x0000,0x0000, 0x17F1,0x0000,0x0000, +0x17F2,0x0000,0x0000, 0x17F3,0x0000,0x0000, 0x17F4,0x0000,0x0000, +0x17F5,0x0000,0x0000, 0x17F6,0x0000,0x0000, 0x17F7,0x0000,0x0000, +0x17F8,0x0000,0x0000, 0x17F9,0x0000,0x0000, 0x17FA,0x0000,0x0000, +0x17FB,0x0000,0x0000, 0x17FC,0x0000,0x0000, 0x17FD,0x0000,0x0000, +0x17FE,0x0000,0x0000, 0x17FF,0x0000,0x0000, 0x1800,0x0000,0x0000, +0x1801,0x0000,0x0000, 0x1802,0x0000,0x0000, 0x1803,0x0000,0x0000, +0x1804,0x0000,0x0000, 0x1805,0x0000,0x0000, 0x1806,0x0000,0x0000, +0x1807,0x0000,0x0000, 0x1808,0x0000,0x0000, 0x1809,0x0000,0x0000, +0x180A,0x0000,0x0000, 0x180B,0x0000,0x0000, 0x180C,0x0000,0x0000, +0x180D,0x0000,0x0000, 0x180E,0x0000,0x0000, 0x180F,0x0000,0x0000, +0x1810,0x0000,0x0000, 0x1811,0x0000,0x0000, 0x1812,0x0000,0x0000, +0x1813,0x0000,0x0000, 0x1814,0x0000,0x0000, 0x1815,0x0000,0x0000, +0x1816,0x0000,0x0000, 0x1817,0x0000,0x0000, 0x1818,0x0000,0x0000, +0x1819,0x0000,0x0000, 0x181A,0x0000,0x0000, 0x181B,0x0000,0x0000, +0x181C,0x0000,0x0000, 0x181D,0x0000,0x0000, 0xFBC0,0x8E3B,0x0000, +0xFBC0,0x8E3C,0x0000, 0xFBC0,0x8E3D,0x0000, 0xFBC0,0x8E3E,0x0000, +0x0E16,0x0000,0x0000, 0x181E,0x0000,0x0000, 0x181F,0x0000,0x0000, +0x1820,0x0000,0x0000, 0x1821,0x0000,0x0000, 0x1822,0x0000,0x0000, +0x1823,0x0000,0x0000, 0x0E03,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x1824,0x0000,0x0000, 0x1825,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0359,0x0000,0x0000, 0x0E29,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x02FC,0x0000,0x0000, 0x02FD,0x0000,0x0000, 0xFBC0,0x8E5C,0x0000, +0xFBC0,0x8E5D,0x0000, 0xFBC0,0x8E5E,0x0000, 0xFBC0,0x8E5F,0x0000, +0xFBC0,0x8E60,0x0000, 0xFBC0,0x8E61,0x0000, 0xFBC0,0x8E62,0x0000, +0xFBC0,0x8E63,0x0000, 0xFBC0,0x8E64,0x0000, 0xFBC0,0x8E65,0x0000, +0xFBC0,0x8E66,0x0000, 0xFBC0,0x8E67,0x0000, 0xFBC0,0x8E68,0x0000, +0xFBC0,0x8E69,0x0000, 0xFBC0,0x8E6A,0x0000, 0xFBC0,0x8E6B,0x0000, +0xFBC0,0x8E6C,0x0000, 0xFBC0,0x8E6D,0x0000, 0xFBC0,0x8E6E,0x0000, +0xFBC0,0x8E6F,0x0000, 0xFBC0,0x8E70,0x0000, 0xFBC0,0x8E71,0x0000, +0xFBC0,0x8E72,0x0000, 0xFBC0,0x8E73,0x0000, 0xFBC0,0x8E74,0x0000, +0xFBC0,0x8E75,0x0000, 0xFBC0,0x8E76,0x0000, 0xFBC0,0x8E77,0x0000, +0xFBC0,0x8E78,0x0000, 0xFBC0,0x8E79,0x0000, 0xFBC0,0x8E7A,0x0000, +0xFBC0,0x8E7B,0x0000, 0xFBC0,0x8E7C,0x0000, 0xFBC0,0x8E7D,0x0000, +0xFBC0,0x8E7E,0x0000, 0xFBC0,0x8E7F,0x0000, 0xFBC0,0x8E80,0x0000, +0x1826,0x0000,0x0000, 0x1827,0x0000,0x0000, 0xFBC0,0x8E83,0x0000, +0x1828,0x0000,0x0000, 0xFBC0,0x8E85,0x0000, 0xFBC0,0x8E86,0x0000, +0x1829,0x0000,0x0000, 0x182A,0x0000,0x0000, 0xFBC0,0x8E89,0x0000, +0x182B,0x0000,0x0000, 0xFBC0,0x8E8B,0x0000, 0xFBC0,0x8E8C,0x0000, +0x182C,0x0000,0x0000, 0xFBC0,0x8E8E,0x0000, 0xFBC0,0x8E8F,0x0000, +0xFBC0,0x8E90,0x0000, 0xFBC0,0x8E91,0x0000, 0xFBC0,0x8E92,0x0000, +0xFBC0,0x8E93,0x0000, 0x182D,0x0000,0x0000, 0x182E,0x0000,0x0000, +0x182F,0x0000,0x0000, 0x1830,0x0000,0x0000, 0xFBC0,0x8E98,0x0000, +0x1831,0x0000,0x0000, 0x1832,0x0000,0x0000, 0x1833,0x0000,0x0000, +0x1834,0x0000,0x0000, 0x1835,0x0000,0x0000, 0x1836,0x0000,0x0000, +0x1837,0x0000,0x0000, 0xFBC0,0x8EA0,0x0000, 0x1838,0x0000,0x0000, +0x1839,0x0000,0x0000, 0x183A,0x0000,0x0000, 0xFBC0,0x8EA4,0x0000, +0x183B,0x0000,0x0000, 0xFBC0,0x8EA6,0x0000, 0x183C,0x0000,0x0000, +0xFBC0,0x8EA8,0x0000, 0xFBC0,0x8EA9,0x0000, 0x183D,0x0000,0x0000, +0x183E,0x0000,0x0000, 0xFBC0,0x8EAC,0x0000, 0x183F,0x0000,0x0000, +0x1840,0x0000,0x0000, 0x1841,0x0000,0x0000, 0x1842,0x0000,0x0000, +0x1843,0x0000,0x0000, 0x1844,0x0000,0x0000, 0x1845,0x0000,0x0000, +0x1846,0x0000,0x0000, 0x1847,0x0000,0x0000, 0x1848,0x0000,0x0000, +0x1849,0x0000,0x0000, 0x184A,0x0000,0x0000, 0x184B,0x0000,0x0000, +0xFBC0,0x8EBA,0x0000, 0x184C,0x0000,0x0000, 0x184D,0x0000,0x0000, +0x184E,0x0000,0x0000, 0xFBC0,0x8EBE,0x0000, 0xFBC0,0x8EBF,0x0000, +0x184F,0x0000,0x0000, 0x1850,0x0000,0x0000, 0x1851,0x0000,0x0000, +0x1852,0x0000,0x0000, 0x1853,0x0000,0x0000, 0xFBC0,0x8EC5,0x0000, +0x0E04,0x0000,0x0000, 0xFBC0,0x8EC7,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x1854,0x0000,0x0000, 0x1855,0x0000,0x0000, 0xFBC0,0x8ECE,0x0000, +0xFBC0,0x8ECF,0x0000, 0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, +0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, +0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, +0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, 0xFBC0,0x8EDA,0x0000, +0xFBC0,0x8EDB,0x0000, 0x183E,0x1831,0x0000, 0x183E,0x1838,0x0000, +0xFBC0,0x8EDE,0x0000, 0xFBC0,0x8EDF,0x0000, 0xFBC0,0x8EE0,0x0000, +0xFBC0,0x8EE1,0x0000, 0xFBC0,0x8EE2,0x0000, 0xFBC0,0x8EE3,0x0000, +0xFBC0,0x8EE4,0x0000, 0xFBC0,0x8EE5,0x0000, 0xFBC0,0x8EE6,0x0000, +0xFBC0,0x8EE7,0x0000, 0xFBC0,0x8EE8,0x0000, 0xFBC0,0x8EE9,0x0000, +0xFBC0,0x8EEA,0x0000, 0xFBC0,0x8EEB,0x0000, 0xFBC0,0x8EEC,0x0000, +0xFBC0,0x8EED,0x0000, 0xFBC0,0x8EEE,0x0000, 0xFBC0,0x8EEF,0x0000, +0xFBC0,0x8EF0,0x0000, 0xFBC0,0x8EF1,0x0000, 0xFBC0,0x8EF2,0x0000, +0xFBC0,0x8EF3,0x0000, 0xFBC0,0x8EF4,0x0000, 0xFBC0,0x8EF5,0x0000, +0xFBC0,0x8EF6,0x0000, 0xFBC0,0x8EF7,0x0000, 0xFBC0,0x8EF8,0x0000, +0xFBC0,0x8EF9,0x0000, 0xFBC0,0x8EFA,0x0000, 0xFBC0,0x8EFB,0x0000, +0xFBC0,0x8EFC,0x0000, 0xFBC0,0x8EFD,0x0000, 0xFBC0,0x8EFE,0x0000, +0xFBC0,0x8EFF,0x0000 }; + +uint16 page00Fdata[]= { /* 0F00 (3 weights per char) */ +0x189A,0x18AD,0x0000, 0x035A,0x0000,0x0000, 0x035B,0x0000,0x0000, +0x035C,0x0000,0x0000, 0x02FE,0x0000,0x0000, 0x02FF,0x0000,0x0000, +0x0300,0x0000,0x0000, 0x0301,0x0000,0x0000, 0x0302,0x0000,0x0000, +0x0303,0x0000,0x0000, 0x0304,0x0000,0x0000, 0x0305,0x0000,0x0000, +0x0305,0x0000,0x0000, 0x0306,0x0000,0x0000, 0x0307,0x0000,0x0000, +0x0308,0x0000,0x0000, 0x0309,0x0000,0x0000, 0x030A,0x0000,0x0000, +0x030B,0x0000,0x0000, 0x035D,0x0000,0x0000, 0x024C,0x0000,0x0000, +0x035E,0x0000,0x0000, 0x035F,0x0000,0x0000, 0x0360,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0361,0x0000,0x0000, +0x0362,0x0000,0x0000, 0x0363,0x0000,0x0000, 0x0364,0x0000,0x0000, +0x0365,0x0000,0x0000, 0x0366,0x0000,0x0000, 0x0E29,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x0E29,0x0000,0x0000, 0x0367,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0368,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0369,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x028E,0x0000,0x0000, 0x028F,0x0000,0x0000, +0x0290,0x0000,0x0000, 0x0291,0x0000,0x0000, 0x036A,0x0000,0x0000, +0x036B,0x0000,0x0000, 0x1856,0x0000,0x0000, 0x1858,0x0000,0x0000, +0x185A,0x0000,0x0000, 0x185A,0x1899,0x0000, 0x185C,0x0000,0x0000, +0x185E,0x0000,0x0000, 0x1860,0x0000,0x0000, 0x1862,0x0000,0x0000, +0xFBC0,0x8F48,0x0000, 0x1864,0x0000,0x0000, 0x1866,0x0000,0x0000, +0x1868,0x0000,0x0000, 0x186A,0x0000,0x0000, 0x186A,0x1899,0x0000, +0x186C,0x0000,0x0000, 0x186E,0x0000,0x0000, 0x1870,0x0000,0x0000, +0x1872,0x0000,0x0000, 0x1872,0x1899,0x0000, 0x1874,0x0000,0x0000, +0x1876,0x0000,0x0000, 0x1878,0x0000,0x0000, 0x187A,0x0000,0x0000, +0x187A,0x1899,0x0000, 0x187C,0x0000,0x0000, 0x187E,0x0000,0x0000, +0x1880,0x0000,0x0000, 0x1882,0x0000,0x0000, 0x1882,0x1899,0x0000, +0x1884,0x0000,0x0000, 0x1886,0x0000,0x0000, 0x1888,0x0000,0x0000, +0x188A,0x0000,0x0000, 0x188C,0x0000,0x0000, 0x188E,0x0000,0x0000, +0x1890,0x0000,0x0000, 0x1892,0x0000,0x0000, 0x1894,0x0000,0x0000, +0x1896,0x0000,0x0000, 0x1898,0x0000,0x0000, 0x189A,0x0000,0x0000, +0x1856,0x1895,0x0000, 0x188E,0x0000,0x0000, 0xFBC0,0x8F6B,0x0000, +0xFBC0,0x8F6C,0x0000, 0xFBC0,0x8F6D,0x0000, 0xFBC0,0x8F6E,0x0000, +0xFBC0,0x8F6F,0x0000, 0xFBC0,0x8F70,0x0000, 0x18A0,0x0000,0x0000, +0x18A1,0x0000,0x0000, 0x18A2,0x0000,0x0000, 0x18A5,0x0000,0x0000, +0x18A6,0x0000,0x0000, 0x18A7,0x0000,0x0000, 0x18A8,0x0000,0x0000, +0x18A9,0x0000,0x0000, 0x18AA,0x0000,0x0000, 0x18AB,0x0000,0x0000, +0x18AC,0x0000,0x0000, 0x18AD,0x0000,0x0000, 0x18AE,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x18A3,0x0000,0x0000, +0x18A4,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x18AF,0x0000,0x0000, 0x030C,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x189C,0x0000,0x0000, 0x189D,0x0000,0x0000, +0x189E,0x0000,0x0000, 0x189F,0x0000,0x0000, 0xFBC0,0x8F8C,0x0000, +0xFBC0,0x8F8D,0x0000, 0xFBC0,0x8F8E,0x0000, 0xFBC0,0x8F8F,0x0000, +0x1857,0x0000,0x0000, 0x1859,0x0000,0x0000, 0x185B,0x0000,0x0000, +0x185B,0x1899,0x0000, 0x185D,0x0000,0x0000, 0x185F,0x0000,0x0000, +0x1861,0x0000,0x0000, 0x1863,0x0000,0x0000, 0xFBC0,0x8F98,0x0000, +0x1865,0x0000,0x0000, 0x1867,0x0000,0x0000, 0x1869,0x0000,0x0000, +0x186B,0x0000,0x0000, 0x186B,0x1899,0x0000, 0x186D,0x0000,0x0000, +0x186F,0x0000,0x0000, 0x1871,0x0000,0x0000, 0x1873,0x0000,0x0000, +0x1873,0x1899,0x0000, 0x1875,0x0000,0x0000, 0x1877,0x0000,0x0000, +0x1879,0x0000,0x0000, 0x187B,0x0000,0x0000, 0x187B,0x1899,0x0000, +0x187D,0x0000,0x0000, 0x187F,0x0000,0x0000, 0x1881,0x0000,0x0000, +0x1883,0x0000,0x0000, 0x1883,0x1899,0x0000, 0x1885,0x0000,0x0000, +0x1887,0x0000,0x0000, 0x1889,0x0000,0x0000, 0x188B,0x0000,0x0000, +0x188D,0x0000,0x0000, 0x188F,0x0000,0x0000, 0x1891,0x0000,0x0000, +0x1893,0x0000,0x0000, 0x1895,0x0000,0x0000, 0x1897,0x0000,0x0000, +0x1899,0x0000,0x0000, 0x189B,0x0000,0x0000, 0x1857,0x1895,0x0000, +0x1885,0x0000,0x0000, 0x188D,0x0000,0x0000, 0x188F,0x0000,0x0000, +0xFBC0,0x8FBD,0x0000, 0x036C,0x0000,0x0000, 0x036D,0x0000,0x0000, +0x036E,0x0000,0x0000, 0x036F,0x0000,0x0000, 0x0370,0x0000,0x0000, +0x0371,0x0000,0x0000, 0x0372,0x0000,0x0000, 0x0373,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0374,0x0000,0x0000, 0x0375,0x0000,0x0000, +0x0376,0x0000,0x0000, 0x0377,0x0000,0x0000, 0x0378,0x0000,0x0000, +0x0379,0x0000,0x0000, 0xFBC0,0x8FCD,0x0000, 0xFBC0,0x8FCE,0x0000, +0x037A,0x0000,0x0000, 0xFBC0,0x8FD0,0x0000, 0xFBC0,0x8FD1,0x0000, +0xFBC0,0x8FD2,0x0000, 0xFBC0,0x8FD3,0x0000, 0xFBC0,0x8FD4,0x0000, +0xFBC0,0x8FD5,0x0000, 0xFBC0,0x8FD6,0x0000, 0xFBC0,0x8FD7,0x0000, +0xFBC0,0x8FD8,0x0000, 0xFBC0,0x8FD9,0x0000, 0xFBC0,0x8FDA,0x0000, +0xFBC0,0x8FDB,0x0000, 0xFBC0,0x8FDC,0x0000, 0xFBC0,0x8FDD,0x0000, +0xFBC0,0x8FDE,0x0000, 0xFBC0,0x8FDF,0x0000, 0xFBC0,0x8FE0,0x0000, +0xFBC0,0x8FE1,0x0000, 0xFBC0,0x8FE2,0x0000, 0xFBC0,0x8FE3,0x0000, +0xFBC0,0x8FE4,0x0000, 0xFBC0,0x8FE5,0x0000, 0xFBC0,0x8FE6,0x0000, +0xFBC0,0x8FE7,0x0000, 0xFBC0,0x8FE8,0x0000, 0xFBC0,0x8FE9,0x0000, +0xFBC0,0x8FEA,0x0000, 0xFBC0,0x8FEB,0x0000, 0xFBC0,0x8FEC,0x0000, +0xFBC0,0x8FED,0x0000, 0xFBC0,0x8FEE,0x0000, 0xFBC0,0x8FEF,0x0000, +0xFBC0,0x8FF0,0x0000, 0xFBC0,0x8FF1,0x0000, 0xFBC0,0x8FF2,0x0000, +0xFBC0,0x8FF3,0x0000, 0xFBC0,0x8FF4,0x0000, 0xFBC0,0x8FF5,0x0000, +0xFBC0,0x8FF6,0x0000, 0xFBC0,0x8FF7,0x0000, 0xFBC0,0x8FF8,0x0000, +0xFBC0,0x8FF9,0x0000, 0xFBC0,0x8FFA,0x0000, 0xFBC0,0x8FFB,0x0000, +0xFBC0,0x8FFC,0x0000, 0xFBC0,0x8FFD,0x0000, 0xFBC0,0x8FFE,0x0000, +0xFBC0,0x8FFF,0x0000 }; + +uint16 page010data[]= { /* 1000 (3 weights per char) */ +0x1931,0x0000,0x0000, 0x1932,0x0000,0x0000, 0x1933,0x0000,0x0000, +0x1934,0x0000,0x0000, 0x1935,0x0000,0x0000, 0x1936,0x0000,0x0000, +0x1937,0x0000,0x0000, 0x1938,0x0000,0x0000, 0x1939,0x0000,0x0000, +0x193A,0x0000,0x0000, 0x193B,0x0000,0x0000, 0x193C,0x0000,0x0000, +0x193D,0x0000,0x0000, 0x193E,0x0000,0x0000, 0x193F,0x0000,0x0000, +0x1940,0x0000,0x0000, 0x1941,0x0000,0x0000, 0x1942,0x0000,0x0000, +0x1943,0x0000,0x0000, 0x1944,0x0000,0x0000, 0x1945,0x0000,0x0000, +0x1946,0x0000,0x0000, 0x1947,0x0000,0x0000, 0x1948,0x0000,0x0000, +0x1949,0x0000,0x0000, 0x194A,0x0000,0x0000, 0x194B,0x0000,0x0000, +0x194C,0x0000,0x0000, 0x194D,0x0000,0x0000, 0x194E,0x0000,0x0000, +0x1951,0x0000,0x0000, 0x1952,0x0000,0x0000, 0x1953,0x0000,0x0000, +0x1954,0x0000,0x0000, 0xFBC0,0x9022,0x0000, 0x1955,0x0000,0x0000, +0x1956,0x0000,0x0000, 0x1957,0x0000,0x0000, 0x1958,0x0000,0x0000, +0x1959,0x0000,0x0000, 0xFBC0,0x9028,0x0000, 0x195A,0x0000,0x0000, +0x195B,0x0000,0x0000, 0xFBC0,0x902B,0x0000, 0x1960,0x0000,0x0000, +0x1961,0x0000,0x0000, 0x1962,0x0000,0x0000, 0x1963,0x0000,0x0000, +0x1964,0x0000,0x0000, 0x1965,0x0000,0x0000, 0x1966,0x0000,0x0000, +0xFBC0,0x9033,0x0000, 0xFBC0,0x9034,0x0000, 0xFBC0,0x9035,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x196B,0x0000,0x0000, 0xFBC0,0x903A,0x0000, 0xFBC0,0x903B,0x0000, +0xFBC0,0x903C,0x0000, 0xFBC0,0x903D,0x0000, 0xFBC0,0x903E,0x0000, +0xFBC0,0x903F,0x0000, 0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, +0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, +0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, +0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, 0x026C,0x0000,0x0000, +0x026D,0x0000,0x0000, 0x030E,0x0000,0x0000, 0x030F,0x0000,0x0000, +0x0310,0x0000,0x0000, 0x0311,0x0000,0x0000, 0x194F,0x0000,0x0000, +0x1950,0x0000,0x0000, 0x195C,0x0000,0x0000, 0x195D,0x0000,0x0000, +0x195E,0x0000,0x0000, 0x195F,0x0000,0x0000, 0x1967,0x0000,0x0000, +0x1968,0x0000,0x0000, 0x1969,0x0000,0x0000, 0x196A,0x0000,0x0000, +0xFBC0,0x905A,0x0000, 0xFBC0,0x905B,0x0000, 0xFBC0,0x905C,0x0000, +0xFBC0,0x905D,0x0000, 0xFBC0,0x905E,0x0000, 0xFBC0,0x905F,0x0000, +0xFBC0,0x9060,0x0000, 0xFBC0,0x9061,0x0000, 0xFBC0,0x9062,0x0000, +0xFBC0,0x9063,0x0000, 0xFBC0,0x9064,0x0000, 0xFBC0,0x9065,0x0000, +0xFBC0,0x9066,0x0000, 0xFBC0,0x9067,0x0000, 0xFBC0,0x9068,0x0000, +0xFBC0,0x9069,0x0000, 0xFBC0,0x906A,0x0000, 0xFBC0,0x906B,0x0000, +0xFBC0,0x906C,0x0000, 0xFBC0,0x906D,0x0000, 0xFBC0,0x906E,0x0000, +0xFBC0,0x906F,0x0000, 0xFBC0,0x9070,0x0000, 0xFBC0,0x9071,0x0000, +0xFBC0,0x9072,0x0000, 0xFBC0,0x9073,0x0000, 0xFBC0,0x9074,0x0000, +0xFBC0,0x9075,0x0000, 0xFBC0,0x9076,0x0000, 0xFBC0,0x9077,0x0000, +0xFBC0,0x9078,0x0000, 0xFBC0,0x9079,0x0000, 0xFBC0,0x907A,0x0000, +0xFBC0,0x907B,0x0000, 0xFBC0,0x907C,0x0000, 0xFBC0,0x907D,0x0000, +0xFBC0,0x907E,0x0000, 0xFBC0,0x907F,0x0000, 0xFBC0,0x9080,0x0000, +0xFBC0,0x9081,0x0000, 0xFBC0,0x9082,0x0000, 0xFBC0,0x9083,0x0000, +0xFBC0,0x9084,0x0000, 0xFBC0,0x9085,0x0000, 0xFBC0,0x9086,0x0000, +0xFBC0,0x9087,0x0000, 0xFBC0,0x9088,0x0000, 0xFBC0,0x9089,0x0000, +0xFBC0,0x908A,0x0000, 0xFBC0,0x908B,0x0000, 0xFBC0,0x908C,0x0000, +0xFBC0,0x908D,0x0000, 0xFBC0,0x908E,0x0000, 0xFBC0,0x908F,0x0000, +0xFBC0,0x9090,0x0000, 0xFBC0,0x9091,0x0000, 0xFBC0,0x9092,0x0000, +0xFBC0,0x9093,0x0000, 0xFBC0,0x9094,0x0000, 0xFBC0,0x9095,0x0000, +0xFBC0,0x9096,0x0000, 0xFBC0,0x9097,0x0000, 0xFBC0,0x9098,0x0000, +0xFBC0,0x9099,0x0000, 0xFBC0,0x909A,0x0000, 0xFBC0,0x909B,0x0000, +0xFBC0,0x909C,0x0000, 0xFBC0,0x909D,0x0000, 0xFBC0,0x909E,0x0000, +0xFBC0,0x909F,0x0000, 0x12E1,0x0000,0x0000, 0x12E2,0x0000,0x0000, +0x12E3,0x0000,0x0000, 0x12E4,0x0000,0x0000, 0x12E5,0x0000,0x0000, +0x12E6,0x0000,0x0000, 0x12E7,0x0000,0x0000, 0x12E9,0x0000,0x0000, +0x12EA,0x0000,0x0000, 0x12EB,0x0000,0x0000, 0x12EC,0x0000,0x0000, +0x12ED,0x0000,0x0000, 0x12EE,0x0000,0x0000, 0x12F0,0x0000,0x0000, +0x12F1,0x0000,0x0000, 0x12F2,0x0000,0x0000, 0x12F3,0x0000,0x0000, +0x12F4,0x0000,0x0000, 0x12F5,0x0000,0x0000, 0x12F7,0x0000,0x0000, +0x12F8,0x0000,0x0000, 0x12F9,0x0000,0x0000, 0x12FA,0x0000,0x0000, +0x12FB,0x0000,0x0000, 0x12FC,0x0000,0x0000, 0x12FD,0x0000,0x0000, +0x12FE,0x0000,0x0000, 0x12FF,0x0000,0x0000, 0x1300,0x0000,0x0000, +0x1301,0x0000,0x0000, 0x1302,0x0000,0x0000, 0x1304,0x0000,0x0000, +0x1305,0x0000,0x0000, 0x12E8,0x0000,0x0000, 0x12EF,0x0000,0x0000, +0x12F6,0x0000,0x0000, 0x1303,0x0000,0x0000, 0x1306,0x0000,0x0000, +0xFBC0,0x90C6,0x0000, 0xFBC0,0x90C7,0x0000, 0xFBC0,0x90C8,0x0000, +0xFBC0,0x90C9,0x0000, 0xFBC0,0x90CA,0x0000, 0xFBC0,0x90CB,0x0000, +0xFBC0,0x90CC,0x0000, 0xFBC0,0x90CD,0x0000, 0xFBC0,0x90CE,0x0000, +0xFBC0,0x90CF,0x0000, 0x12E1,0x0000,0x0000, 0x12E2,0x0000,0x0000, +0x12E3,0x0000,0x0000, 0x12E4,0x0000,0x0000, 0x12E5,0x0000,0x0000, +0x12E6,0x0000,0x0000, 0x12E7,0x0000,0x0000, 0x12E9,0x0000,0x0000, +0x12EA,0x0000,0x0000, 0x12EB,0x0000,0x0000, 0x12EC,0x0000,0x0000, +0x12ED,0x0000,0x0000, 0x12EE,0x0000,0x0000, 0x12F0,0x0000,0x0000, +0x12F1,0x0000,0x0000, 0x12F2,0x0000,0x0000, 0x12F3,0x0000,0x0000, +0x12F4,0x0000,0x0000, 0x12F5,0x0000,0x0000, 0x12F7,0x0000,0x0000, +0x12F8,0x0000,0x0000, 0x12F9,0x0000,0x0000, 0x12FA,0x0000,0x0000, +0x12FB,0x0000,0x0000, 0x12FC,0x0000,0x0000, 0x12FD,0x0000,0x0000, +0x12FE,0x0000,0x0000, 0x12FF,0x0000,0x0000, 0x1300,0x0000,0x0000, +0x1301,0x0000,0x0000, 0x1302,0x0000,0x0000, 0x1304,0x0000,0x0000, +0x1305,0x0000,0x0000, 0x12E8,0x0000,0x0000, 0x12EF,0x0000,0x0000, +0x12F6,0x0000,0x0000, 0x1303,0x0000,0x0000, 0x1306,0x0000,0x0000, +0x1307,0x0000,0x0000, 0x1308,0x0000,0x0000, 0x1309,0x0000,0x0000, +0xFBC0,0x90F9,0x0000, 0xFBC0,0x90FA,0x0000, 0x0271,0x0000,0x0000, +0xFBC0,0x90FC,0x0000, 0xFBC0,0x90FD,0x0000, 0xFBC0,0x90FE,0x0000, +0xFBC0,0x90FF,0x0000 }; + +uint16 page011data[]= { /* 1100 (3 weights per char) */ +0x1D62,0x0000,0x0000, 0x1D63,0x0000,0x0000, 0x1D64,0x0000,0x0000, +0x1D65,0x0000,0x0000, 0x1D66,0x0000,0x0000, 0x1D67,0x0000,0x0000, +0x1D68,0x0000,0x0000, 0x1D69,0x0000,0x0000, 0x1D6A,0x0000,0x0000, +0x1D6B,0x0000,0x0000, 0x1D6C,0x0000,0x0000, 0x1D6D,0x0000,0x0000, +0x1D6E,0x0000,0x0000, 0x1D6F,0x0000,0x0000, 0x1D70,0x0000,0x0000, +0x1D71,0x0000,0x0000, 0x1D72,0x0000,0x0000, 0x1D73,0x0000,0x0000, +0x1D74,0x0000,0x0000, 0x1D75,0x0000,0x0000, 0x1D76,0x0000,0x0000, +0x1D77,0x0000,0x0000, 0x1D78,0x0000,0x0000, 0x1D79,0x0000,0x0000, +0x1D7A,0x0000,0x0000, 0x1D7B,0x0000,0x0000, 0x1D7C,0x0000,0x0000, +0x1D7D,0x0000,0x0000, 0x1D7E,0x0000,0x0000, 0x1D7F,0x0000,0x0000, +0x1D80,0x0000,0x0000, 0x1D81,0x0000,0x0000, 0x1D82,0x0000,0x0000, +0x1D83,0x0000,0x0000, 0x1D84,0x0000,0x0000, 0x1D85,0x0000,0x0000, +0x1D86,0x0000,0x0000, 0x1D87,0x0000,0x0000, 0x1D88,0x0000,0x0000, +0x1D89,0x0000,0x0000, 0x1D8A,0x0000,0x0000, 0x1D8B,0x0000,0x0000, +0x1D8C,0x0000,0x0000, 0x1D8D,0x0000,0x0000, 0x1D8E,0x0000,0x0000, +0x1D8F,0x0000,0x0000, 0x1D90,0x0000,0x0000, 0x1D91,0x0000,0x0000, +0x1D92,0x0000,0x0000, 0x1D93,0x0000,0x0000, 0x1D94,0x0000,0x0000, +0x1D95,0x0000,0x0000, 0x1D96,0x0000,0x0000, 0x1D97,0x0000,0x0000, +0x1D98,0x0000,0x0000, 0x1D99,0x0000,0x0000, 0x1D9A,0x0000,0x0000, +0x1D9B,0x0000,0x0000, 0x1D9C,0x0000,0x0000, 0x1D9D,0x0000,0x0000, +0x1D9E,0x0000,0x0000, 0x1D9F,0x0000,0x0000, 0x1DA0,0x0000,0x0000, +0x1DA1,0x0000,0x0000, 0x1DA2,0x0000,0x0000, 0x1DA3,0x0000,0x0000, +0x1DA4,0x0000,0x0000, 0x1DA5,0x0000,0x0000, 0x1DA6,0x0000,0x0000, +0x1DA7,0x0000,0x0000, 0x1DA8,0x0000,0x0000, 0x1DA9,0x0000,0x0000, +0x1DAA,0x0000,0x0000, 0x1DAB,0x0000,0x0000, 0x1DAC,0x0000,0x0000, +0x1DAD,0x0000,0x0000, 0x1DAE,0x0000,0x0000, 0x1DAF,0x0000,0x0000, +0x1DB0,0x0000,0x0000, 0x1DB1,0x0000,0x0000, 0x1DB2,0x0000,0x0000, +0x1DB3,0x0000,0x0000, 0x1DB4,0x0000,0x0000, 0x1DB5,0x0000,0x0000, +0x1DB6,0x0000,0x0000, 0x1DB7,0x0000,0x0000, 0x1DB8,0x0000,0x0000, +0x1DB9,0x0000,0x0000, 0x1DBA,0x0000,0x0000, 0x1DBB,0x0000,0x0000, +0xFBC0,0x915A,0x0000, 0xFBC0,0x915B,0x0000, 0xFBC0,0x915C,0x0000, +0xFBC0,0x915D,0x0000, 0xFBC0,0x915E,0x0000, 0x1DBC,0x0000,0x0000, +0x1DBD,0x0000,0x0000, 0x1DBE,0x0000,0x0000, 0x1DBF,0x0000,0x0000, +0x1DC0,0x0000,0x0000, 0x1DC1,0x0000,0x0000, 0x1DC2,0x0000,0x0000, +0x1DC3,0x0000,0x0000, 0x1DC4,0x0000,0x0000, 0x1DC5,0x0000,0x0000, +0x1DC6,0x0000,0x0000, 0x1DC7,0x0000,0x0000, 0x1DC8,0x0000,0x0000, +0x1DC9,0x0000,0x0000, 0x1DCA,0x0000,0x0000, 0x1DCB,0x0000,0x0000, +0x1DCC,0x0000,0x0000, 0x1DCD,0x0000,0x0000, 0x1DCE,0x0000,0x0000, +0x1DCF,0x0000,0x0000, 0x1DD0,0x0000,0x0000, 0x1DD1,0x0000,0x0000, +0x1DD2,0x0000,0x0000, 0x1DD3,0x0000,0x0000, 0x1DD4,0x0000,0x0000, +0x1DD5,0x0000,0x0000, 0x1DD6,0x0000,0x0000, 0x1DD7,0x0000,0x0000, +0x1DD8,0x0000,0x0000, 0x1DD9,0x0000,0x0000, 0x1DDA,0x0000,0x0000, +0x1DDB,0x0000,0x0000, 0x1DDC,0x0000,0x0000, 0x1DDD,0x0000,0x0000, +0x1DDE,0x0000,0x0000, 0x1DDF,0x0000,0x0000, 0x1DE0,0x0000,0x0000, +0x1DE1,0x0000,0x0000, 0x1DE2,0x0000,0x0000, 0x1DE3,0x0000,0x0000, +0x1DE4,0x0000,0x0000, 0x1DE5,0x0000,0x0000, 0x1DE6,0x0000,0x0000, +0x1DE7,0x0000,0x0000, 0x1DE8,0x0000,0x0000, 0x1DE9,0x0000,0x0000, +0x1DEA,0x0000,0x0000, 0x1DEB,0x0000,0x0000, 0x1DEC,0x0000,0x0000, +0x1DED,0x0000,0x0000, 0x1DEE,0x0000,0x0000, 0x1DEF,0x0000,0x0000, +0x1DF0,0x0000,0x0000, 0x1DF1,0x0000,0x0000, 0x1DF2,0x0000,0x0000, +0x1DF3,0x0000,0x0000, 0x1DF4,0x0000,0x0000, 0x1DF5,0x0000,0x0000, +0x1DF6,0x0000,0x0000, 0x1DF7,0x0000,0x0000, 0x1DF8,0x0000,0x0000, +0x1DF9,0x0000,0x0000, 0x1DFA,0x0000,0x0000, 0x1DFB,0x0000,0x0000, +0x1DFC,0x0000,0x0000, 0x1DFD,0x0000,0x0000, 0x1DFE,0x0000,0x0000, +0x1DFF,0x0000,0x0000, 0xFBC0,0x91A3,0x0000, 0xFBC0,0x91A4,0x0000, +0xFBC0,0x91A5,0x0000, 0xFBC0,0x91A6,0x0000, 0xFBC0,0x91A7,0x0000, +0x1E00,0x0000,0x0000, 0x1E01,0x0000,0x0000, 0x1E02,0x0000,0x0000, +0x1E03,0x0000,0x0000, 0x1E04,0x0000,0x0000, 0x1E05,0x0000,0x0000, +0x1E06,0x0000,0x0000, 0x1E07,0x0000,0x0000, 0x1E08,0x0000,0x0000, +0x1E09,0x0000,0x0000, 0x1E0A,0x0000,0x0000, 0x1E0B,0x0000,0x0000, +0x1E0C,0x0000,0x0000, 0x1E0D,0x0000,0x0000, 0x1E0E,0x0000,0x0000, +0x1E0F,0x0000,0x0000, 0x1E10,0x0000,0x0000, 0x1E11,0x0000,0x0000, +0x1E12,0x0000,0x0000, 0x1E13,0x0000,0x0000, 0x1E14,0x0000,0x0000, +0x1E15,0x0000,0x0000, 0x1E16,0x0000,0x0000, 0x1E17,0x0000,0x0000, +0x1E18,0x0000,0x0000, 0x1E19,0x0000,0x0000, 0x1E1A,0x0000,0x0000, +0x1E1B,0x0000,0x0000, 0x1E1C,0x0000,0x0000, 0x1E1D,0x0000,0x0000, +0x1E1E,0x0000,0x0000, 0x1E1F,0x0000,0x0000, 0x1E20,0x0000,0x0000, +0x1E21,0x0000,0x0000, 0x1E22,0x0000,0x0000, 0x1E23,0x0000,0x0000, +0x1E24,0x0000,0x0000, 0x1E25,0x0000,0x0000, 0x1E26,0x0000,0x0000, +0x1E27,0x0000,0x0000, 0x1E28,0x0000,0x0000, 0x1E29,0x0000,0x0000, +0x1E2A,0x0000,0x0000, 0x1E2B,0x0000,0x0000, 0x1E2C,0x0000,0x0000, +0x1E2D,0x0000,0x0000, 0x1E2E,0x0000,0x0000, 0x1E2F,0x0000,0x0000, +0x1E30,0x0000,0x0000, 0x1E31,0x0000,0x0000, 0x1E32,0x0000,0x0000, +0x1E33,0x0000,0x0000, 0x1E34,0x0000,0x0000, 0x1E35,0x0000,0x0000, +0x1E36,0x0000,0x0000, 0x1E37,0x0000,0x0000, 0x1E38,0x0000,0x0000, +0x1E39,0x0000,0x0000, 0x1E3A,0x0000,0x0000, 0x1E3B,0x0000,0x0000, +0x1E3C,0x0000,0x0000, 0x1E3D,0x0000,0x0000, 0x1E3E,0x0000,0x0000, +0x1E3F,0x0000,0x0000, 0x1E40,0x0000,0x0000, 0x1E41,0x0000,0x0000, +0x1E42,0x0000,0x0000, 0x1E43,0x0000,0x0000, 0x1E44,0x0000,0x0000, +0x1E45,0x0000,0x0000, 0x1E46,0x0000,0x0000, 0x1E47,0x0000,0x0000, +0x1E48,0x0000,0x0000, 0x1E49,0x0000,0x0000, 0x1E4A,0x0000,0x0000, +0x1E4B,0x0000,0x0000, 0x1E4C,0x0000,0x0000, 0x1E4D,0x0000,0x0000, +0x1E4E,0x0000,0x0000, 0x1E4F,0x0000,0x0000, 0x1E50,0x0000,0x0000, +0x1E51,0x0000,0x0000, 0xFBC0,0x91FA,0x0000, 0xFBC0,0x91FB,0x0000, +0xFBC0,0x91FC,0x0000, 0xFBC0,0x91FD,0x0000, 0xFBC0,0x91FE,0x0000, +0xFBC0,0x91FF,0x0000 }; + +uint16 page012data[]= { /* 1200 (3 weights per char) */ +0x141C,0x0000,0x0000, 0x141D,0x0000,0x0000, 0x141E,0x0000,0x0000, +0x141F,0x0000,0x0000, 0x1420,0x0000,0x0000, 0x1421,0x0000,0x0000, +0x1422,0x0000,0x0000, 0xFBC0,0x9207,0x0000, 0x1423,0x0000,0x0000, +0x1424,0x0000,0x0000, 0x1425,0x0000,0x0000, 0x1426,0x0000,0x0000, +0x1427,0x0000,0x0000, 0x1428,0x0000,0x0000, 0x1429,0x0000,0x0000, +0x142A,0x0000,0x0000, 0x142B,0x0000,0x0000, 0x142C,0x0000,0x0000, +0x142D,0x0000,0x0000, 0x142E,0x0000,0x0000, 0x142F,0x0000,0x0000, +0x1430,0x0000,0x0000, 0x1431,0x0000,0x0000, 0x1432,0x0000,0x0000, +0x1433,0x0000,0x0000, 0x1434,0x0000,0x0000, 0x1435,0x0000,0x0000, +0x1436,0x0000,0x0000, 0x1437,0x0000,0x0000, 0x1438,0x0000,0x0000, +0x1439,0x0000,0x0000, 0x143A,0x0000,0x0000, 0x143B,0x0000,0x0000, +0x143C,0x0000,0x0000, 0x143D,0x0000,0x0000, 0x143E,0x0000,0x0000, +0x143F,0x0000,0x0000, 0x1440,0x0000,0x0000, 0x1441,0x0000,0x0000, +0x1442,0x0000,0x0000, 0x1443,0x0000,0x0000, 0x1444,0x0000,0x0000, +0x1445,0x0000,0x0000, 0x1446,0x0000,0x0000, 0x1447,0x0000,0x0000, +0x1448,0x0000,0x0000, 0x1449,0x0000,0x0000, 0x144A,0x0000,0x0000, +0x144B,0x0000,0x0000, 0x144C,0x0000,0x0000, 0x144D,0x0000,0x0000, +0x144E,0x0000,0x0000, 0x144F,0x0000,0x0000, 0x1450,0x0000,0x0000, +0x1451,0x0000,0x0000, 0x1452,0x0000,0x0000, 0x1453,0x0000,0x0000, +0x1454,0x0000,0x0000, 0x1455,0x0000,0x0000, 0x1456,0x0000,0x0000, +0x1457,0x0000,0x0000, 0x1458,0x0000,0x0000, 0x1459,0x0000,0x0000, +0x145A,0x0000,0x0000, 0x145B,0x0000,0x0000, 0x145C,0x0000,0x0000, +0x145D,0x0000,0x0000, 0x145E,0x0000,0x0000, 0x145F,0x0000,0x0000, +0x1460,0x0000,0x0000, 0x1461,0x0000,0x0000, 0xFBC0,0x9247,0x0000, +0x1462,0x0000,0x0000, 0xFBC0,0x9249,0x0000, 0x1463,0x0000,0x0000, +0x1464,0x0000,0x0000, 0x1465,0x0000,0x0000, 0x1466,0x0000,0x0000, +0xFBC0,0x924E,0x0000, 0xFBC0,0x924F,0x0000, 0x1467,0x0000,0x0000, +0x1468,0x0000,0x0000, 0x1469,0x0000,0x0000, 0x146A,0x0000,0x0000, +0x146B,0x0000,0x0000, 0x146C,0x0000,0x0000, 0x146D,0x0000,0x0000, +0xFBC0,0x9257,0x0000, 0x146E,0x0000,0x0000, 0xFBC0,0x9259,0x0000, +0x146F,0x0000,0x0000, 0x1470,0x0000,0x0000, 0x1471,0x0000,0x0000, +0x1472,0x0000,0x0000, 0xFBC0,0x925E,0x0000, 0xFBC0,0x925F,0x0000, +0x1473,0x0000,0x0000, 0x1474,0x0000,0x0000, 0x1475,0x0000,0x0000, +0x1476,0x0000,0x0000, 0x1477,0x0000,0x0000, 0x1478,0x0000,0x0000, +0x1479,0x0000,0x0000, 0x147A,0x0000,0x0000, 0x147B,0x0000,0x0000, +0x147C,0x0000,0x0000, 0x147D,0x0000,0x0000, 0x147E,0x0000,0x0000, +0x147F,0x0000,0x0000, 0x1480,0x0000,0x0000, 0x1481,0x0000,0x0000, +0x1482,0x0000,0x0000, 0x1483,0x0000,0x0000, 0x1484,0x0000,0x0000, +0x1485,0x0000,0x0000, 0x1486,0x0000,0x0000, 0x1487,0x0000,0x0000, +0x1488,0x0000,0x0000, 0x1489,0x0000,0x0000, 0x148A,0x0000,0x0000, +0x148B,0x0000,0x0000, 0x148C,0x0000,0x0000, 0x148D,0x0000,0x0000, +0x148E,0x0000,0x0000, 0x148F,0x0000,0x0000, 0x1490,0x0000,0x0000, +0x1491,0x0000,0x0000, 0x1492,0x0000,0x0000, 0x1493,0x0000,0x0000, +0x1494,0x0000,0x0000, 0x1495,0x0000,0x0000, 0x1496,0x0000,0x0000, +0x1497,0x0000,0x0000, 0x1498,0x0000,0x0000, 0x1499,0x0000,0x0000, +0xFBC0,0x9287,0x0000, 0x149A,0x0000,0x0000, 0xFBC0,0x9289,0x0000, +0x149B,0x0000,0x0000, 0x149C,0x0000,0x0000, 0x149D,0x0000,0x0000, +0x149E,0x0000,0x0000, 0xFBC0,0x928E,0x0000, 0xFBC0,0x928F,0x0000, +0x149F,0x0000,0x0000, 0x14A0,0x0000,0x0000, 0x14A1,0x0000,0x0000, +0x14A2,0x0000,0x0000, 0x14A3,0x0000,0x0000, 0x14A4,0x0000,0x0000, +0x14A5,0x0000,0x0000, 0x14A6,0x0000,0x0000, 0x14A7,0x0000,0x0000, +0x14A8,0x0000,0x0000, 0x14A9,0x0000,0x0000, 0x14AA,0x0000,0x0000, +0x14AB,0x0000,0x0000, 0x14AC,0x0000,0x0000, 0x14AD,0x0000,0x0000, +0x14AE,0x0000,0x0000, 0x14AF,0x0000,0x0000, 0x14B0,0x0000,0x0000, +0x14B1,0x0000,0x0000, 0x14B2,0x0000,0x0000, 0x14B3,0x0000,0x0000, +0x14B4,0x0000,0x0000, 0x14B5,0x0000,0x0000, 0x14B6,0x0000,0x0000, +0x14B7,0x0000,0x0000, 0x14B8,0x0000,0x0000, 0x14B9,0x0000,0x0000, +0x14BA,0x0000,0x0000, 0x14BB,0x0000,0x0000, 0x14BC,0x0000,0x0000, +0x14BD,0x0000,0x0000, 0xFBC0,0x92AF,0x0000, 0x14BE,0x0000,0x0000, +0xFBC0,0x92B1,0x0000, 0x14BF,0x0000,0x0000, 0x14C0,0x0000,0x0000, +0x14C1,0x0000,0x0000, 0x14C2,0x0000,0x0000, 0xFBC0,0x92B6,0x0000, +0xFBC0,0x92B7,0x0000, 0x14C3,0x0000,0x0000, 0x14C4,0x0000,0x0000, +0x14C5,0x0000,0x0000, 0x14C6,0x0000,0x0000, 0x14C7,0x0000,0x0000, +0x14C8,0x0000,0x0000, 0x14C9,0x0000,0x0000, 0xFBC0,0x92BF,0x0000, +0x14CA,0x0000,0x0000, 0xFBC0,0x92C1,0x0000, 0x14CB,0x0000,0x0000, +0x14CC,0x0000,0x0000, 0x14CD,0x0000,0x0000, 0x14CE,0x0000,0x0000, +0xFBC0,0x92C6,0x0000, 0xFBC0,0x92C7,0x0000, 0x14CF,0x0000,0x0000, +0x14D0,0x0000,0x0000, 0x14D1,0x0000,0x0000, 0x14D2,0x0000,0x0000, +0x14D3,0x0000,0x0000, 0x14D4,0x0000,0x0000, 0x14D5,0x0000,0x0000, +0xFBC0,0x92CF,0x0000, 0x14D6,0x0000,0x0000, 0x14D7,0x0000,0x0000, +0x14D8,0x0000,0x0000, 0x14D9,0x0000,0x0000, 0x14DA,0x0000,0x0000, +0x14DB,0x0000,0x0000, 0x14DC,0x0000,0x0000, 0xFBC0,0x92D7,0x0000, +0x14DD,0x0000,0x0000, 0x14DE,0x0000,0x0000, 0x14DF,0x0000,0x0000, +0x14E0,0x0000,0x0000, 0x14E1,0x0000,0x0000, 0x14E2,0x0000,0x0000, +0x14E3,0x0000,0x0000, 0x14E4,0x0000,0x0000, 0x14E5,0x0000,0x0000, +0x14E6,0x0000,0x0000, 0x14E7,0x0000,0x0000, 0x14E8,0x0000,0x0000, +0x14E9,0x0000,0x0000, 0x14EA,0x0000,0x0000, 0x14EB,0x0000,0x0000, +0x14EC,0x0000,0x0000, 0x14ED,0x0000,0x0000, 0x14EE,0x0000,0x0000, +0x14EF,0x0000,0x0000, 0x14F0,0x0000,0x0000, 0x14F1,0x0000,0x0000, +0x14F2,0x0000,0x0000, 0x14F3,0x0000,0x0000, 0xFBC0,0x92EF,0x0000, +0x14F4,0x0000,0x0000, 0x14F5,0x0000,0x0000, 0x14F6,0x0000,0x0000, +0x14F7,0x0000,0x0000, 0x14F8,0x0000,0x0000, 0x14F9,0x0000,0x0000, +0x14FA,0x0000,0x0000, 0x14FB,0x0000,0x0000, 0x14FC,0x0000,0x0000, +0x14FD,0x0000,0x0000, 0x14FE,0x0000,0x0000, 0x14FF,0x0000,0x0000, +0x1500,0x0000,0x0000, 0x1501,0x0000,0x0000, 0x1502,0x0000,0x0000, +0x1503,0x0000,0x0000 }; + +uint16 page013data[]= { /* 1300 (3 weights per char) */ +0x1504,0x0000,0x0000, 0x1505,0x0000,0x0000, 0x1506,0x0000,0x0000, +0x1507,0x0000,0x0000, 0x1508,0x0000,0x0000, 0x1509,0x0000,0x0000, +0x150A,0x0000,0x0000, 0x150B,0x0000,0x0000, 0x150C,0x0000,0x0000, +0x150D,0x0000,0x0000, 0x150E,0x0000,0x0000, 0x150F,0x0000,0x0000, +0x1510,0x0000,0x0000, 0x1511,0x0000,0x0000, 0x1512,0x0000,0x0000, +0xFBC0,0x930F,0x0000, 0x1513,0x0000,0x0000, 0xFBC0,0x9311,0x0000, +0x1514,0x0000,0x0000, 0x1515,0x0000,0x0000, 0x1516,0x0000,0x0000, +0x1517,0x0000,0x0000, 0xFBC0,0x9316,0x0000, 0xFBC0,0x9317,0x0000, +0x1518,0x0000,0x0000, 0x1519,0x0000,0x0000, 0x151A,0x0000,0x0000, +0x151B,0x0000,0x0000, 0x151C,0x0000,0x0000, 0x151D,0x0000,0x0000, +0x151E,0x0000,0x0000, 0xFBC0,0x931F,0x0000, 0x151F,0x0000,0x0000, +0x1520,0x0000,0x0000, 0x1521,0x0000,0x0000, 0x1522,0x0000,0x0000, +0x1523,0x0000,0x0000, 0x1524,0x0000,0x0000, 0x1525,0x0000,0x0000, +0x1526,0x0000,0x0000, 0x1527,0x0000,0x0000, 0x1528,0x0000,0x0000, +0x1529,0x0000,0x0000, 0x152A,0x0000,0x0000, 0x152B,0x0000,0x0000, +0x152C,0x0000,0x0000, 0x152D,0x0000,0x0000, 0x152E,0x0000,0x0000, +0x152F,0x0000,0x0000, 0x1530,0x0000,0x0000, 0x1531,0x0000,0x0000, +0x1532,0x0000,0x0000, 0x1533,0x0000,0x0000, 0x1534,0x0000,0x0000, +0x1535,0x0000,0x0000, 0x1536,0x0000,0x0000, 0x1537,0x0000,0x0000, +0x1538,0x0000,0x0000, 0x1539,0x0000,0x0000, 0x153A,0x0000,0x0000, +0x153B,0x0000,0x0000, 0x153C,0x0000,0x0000, 0x153D,0x0000,0x0000, +0x153E,0x0000,0x0000, 0x153F,0x0000,0x0000, 0x1540,0x0000,0x0000, +0x1541,0x0000,0x0000, 0x1542,0x0000,0x0000, 0x1543,0x0000,0x0000, +0x1544,0x0000,0x0000, 0x1545,0x0000,0x0000, 0xFBC0,0x9347,0x0000, +0x1546,0x0000,0x0000, 0x1547,0x0000,0x0000, 0x1548,0x0000,0x0000, +0x1549,0x0000,0x0000, 0x154A,0x0000,0x0000, 0x154B,0x0000,0x0000, +0x154C,0x0000,0x0000, 0x154D,0x0000,0x0000, 0x154E,0x0000,0x0000, +0x154F,0x0000,0x0000, 0x1550,0x0000,0x0000, 0x1551,0x0000,0x0000, +0x1552,0x0000,0x0000, 0x1553,0x0000,0x0000, 0x1554,0x0000,0x0000, +0x1555,0x0000,0x0000, 0x1556,0x0000,0x0000, 0x1557,0x0000,0x0000, +0x1558,0x0000,0x0000, 0xFBC0,0x935B,0x0000, 0xFBC0,0x935C,0x0000, +0xFBC0,0x935D,0x0000, 0xFBC0,0x935E,0x0000, 0xFBC0,0x935F,0x0000, +0xFBC0,0x9360,0x0000, 0x0245,0x0000,0x0000, 0x0262,0x0000,0x0000, +0x0246,0x0000,0x0000, 0x0247,0x0000,0x0000, 0x0248,0x0000,0x0000, +0x0249,0x0000,0x0000, 0x025A,0x0000,0x0000, 0x0272,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x0DCC,0x0000,0x0000, 0x0DCD,0x0000,0x0000, 0x0DCE,0x0000,0x0000, +0x0DCF,0x0000,0x0000, 0x0DD0,0x0000,0x0000, 0x0DD1,0x0000,0x0000, +0x0DD2,0x0000,0x0000, 0x0DD3,0x0000,0x0000, 0x0DD4,0x0000,0x0000, +0x0DD5,0x0000,0x0000, 0x0DD6,0x0000,0x0000, 0xFBC0,0x937D,0x0000, +0xFBC0,0x937E,0x0000, 0xFBC0,0x937F,0x0000, 0xFBC0,0x9380,0x0000, +0xFBC0,0x9381,0x0000, 0xFBC0,0x9382,0x0000, 0xFBC0,0x9383,0x0000, +0xFBC0,0x9384,0x0000, 0xFBC0,0x9385,0x0000, 0xFBC0,0x9386,0x0000, +0xFBC0,0x9387,0x0000, 0xFBC0,0x9388,0x0000, 0xFBC0,0x9389,0x0000, +0xFBC0,0x938A,0x0000, 0xFBC0,0x938B,0x0000, 0xFBC0,0x938C,0x0000, +0xFBC0,0x938D,0x0000, 0xFBC0,0x938E,0x0000, 0xFBC0,0x938F,0x0000, +0xFBC0,0x9390,0x0000, 0xFBC0,0x9391,0x0000, 0xFBC0,0x9392,0x0000, +0xFBC0,0x9393,0x0000, 0xFBC0,0x9394,0x0000, 0xFBC0,0x9395,0x0000, +0xFBC0,0x9396,0x0000, 0xFBC0,0x9397,0x0000, 0xFBC0,0x9398,0x0000, +0xFBC0,0x9399,0x0000, 0xFBC0,0x939A,0x0000, 0xFBC0,0x939B,0x0000, +0xFBC0,0x939C,0x0000, 0xFBC0,0x939D,0x0000, 0xFBC0,0x939E,0x0000, +0xFBC0,0x939F,0x0000, 0x1A59,0x0000,0x0000, 0x1A5A,0x0000,0x0000, +0x1A5B,0x0000,0x0000, 0x1A5C,0x0000,0x0000, 0x1A5D,0x0000,0x0000, +0x1A5E,0x0000,0x0000, 0x1A5F,0x0000,0x0000, 0x1A60,0x0000,0x0000, +0x1A61,0x0000,0x0000, 0x1A62,0x0000,0x0000, 0x1A63,0x0000,0x0000, +0x1A64,0x0000,0x0000, 0x1A65,0x0000,0x0000, 0x1A66,0x0000,0x0000, +0x1A67,0x0000,0x0000, 0x1A68,0x0000,0x0000, 0x1A69,0x0000,0x0000, +0x1A6A,0x0000,0x0000, 0x1A6B,0x0000,0x0000, 0x1A6C,0x0000,0x0000, +0x1A6D,0x0000,0x0000, 0x1A6E,0x0000,0x0000, 0x1A6F,0x0000,0x0000, +0x1A70,0x0000,0x0000, 0x1A71,0x0000,0x0000, 0x1A72,0x0000,0x0000, +0x1A73,0x0000,0x0000, 0x1A74,0x0000,0x0000, 0x1A75,0x0000,0x0000, +0x1A76,0x0000,0x0000, 0x1A77,0x0000,0x0000, 0x1A78,0x0000,0x0000, +0x1A79,0x0000,0x0000, 0x1A7A,0x0000,0x0000, 0x1A7B,0x0000,0x0000, +0x1A7C,0x0000,0x0000, 0x1A7D,0x0000,0x0000, 0x1A7E,0x0000,0x0000, +0x1A7F,0x0000,0x0000, 0x1A80,0x0000,0x0000, 0x1A81,0x0000,0x0000, +0x1A82,0x0000,0x0000, 0x1A83,0x0000,0x0000, 0x1A84,0x0000,0x0000, +0x1A85,0x0000,0x0000, 0x1A86,0x0000,0x0000, 0x1A87,0x0000,0x0000, +0x1A88,0x0000,0x0000, 0x1A89,0x0000,0x0000, 0x1A8A,0x0000,0x0000, +0x1A8B,0x0000,0x0000, 0x1A8C,0x0000,0x0000, 0x1A8D,0x0000,0x0000, +0x1A8E,0x0000,0x0000, 0x1A8F,0x0000,0x0000, 0x1A90,0x0000,0x0000, +0x1A91,0x0000,0x0000, 0x1A92,0x0000,0x0000, 0x1A93,0x0000,0x0000, +0x1A94,0x0000,0x0000, 0x1A95,0x0000,0x0000, 0x1A96,0x0000,0x0000, +0x1A97,0x0000,0x0000, 0x1A98,0x0000,0x0000, 0x1A99,0x0000,0x0000, +0x1A9A,0x0000,0x0000, 0x1A9B,0x0000,0x0000, 0x1A9C,0x0000,0x0000, +0x1A9D,0x0000,0x0000, 0x1A9E,0x0000,0x0000, 0x1A9F,0x0000,0x0000, +0x1AA0,0x0000,0x0000, 0x1AA1,0x0000,0x0000, 0x1AA2,0x0000,0x0000, +0x1AA3,0x0000,0x0000, 0x1AA4,0x0000,0x0000, 0x1AA5,0x0000,0x0000, +0x1AA6,0x0000,0x0000, 0x1AA7,0x0000,0x0000, 0x1AA8,0x0000,0x0000, +0x1AA9,0x0000,0x0000, 0x1AAA,0x0000,0x0000, 0x1AAB,0x0000,0x0000, +0x1AAC,0x0000,0x0000, 0x1AAD,0x0000,0x0000, 0xFBC0,0x93F5,0x0000, +0xFBC0,0x93F6,0x0000, 0xFBC0,0x93F7,0x0000, 0xFBC0,0x93F8,0x0000, +0xFBC0,0x93F9,0x0000, 0xFBC0,0x93FA,0x0000, 0xFBC0,0x93FB,0x0000, +0xFBC0,0x93FC,0x0000, 0xFBC0,0x93FD,0x0000, 0xFBC0,0x93FE,0x0000, +0xFBC0,0x93FF,0x0000 }; + +uint16 page014data[]= { /* 1400 (3 weights per char) */ +0xFBC0,0x9400,0x0000, 0x1AAE,0x0000,0x0000, 0x1AAF,0x0000,0x0000, +0x1AB0,0x0000,0x0000, 0x1AB1,0x0000,0x0000, 0x1AB2,0x0000,0x0000, +0x1AB3,0x0000,0x0000, 0x1AB4,0x0000,0x0000, 0x1AB5,0x0000,0x0000, +0x1AB6,0x0000,0x0000, 0x1AB7,0x0000,0x0000, 0x1AB8,0x0000,0x0000, +0x1AB9,0x0000,0x0000, 0x1ABA,0x0000,0x0000, 0x1ABB,0x0000,0x0000, +0x1ABC,0x0000,0x0000, 0x1ABD,0x0000,0x0000, 0x1ABE,0x0000,0x0000, +0x1ABF,0x0000,0x0000, 0x1AC0,0x0000,0x0000, 0x1AC1,0x0000,0x0000, +0x1AC2,0x0000,0x0000, 0x1AC3,0x0000,0x0000, 0x1AC4,0x0000,0x0000, +0x1AC5,0x0000,0x0000, 0x1AC6,0x0000,0x0000, 0x1AC7,0x0000,0x0000, +0x1AC8,0x0000,0x0000, 0x1AC9,0x0000,0x0000, 0x1ACA,0x0000,0x0000, +0x1ACB,0x0000,0x0000, 0x1ACC,0x0000,0x0000, 0x1ACD,0x0000,0x0000, +0x1ACE,0x0000,0x0000, 0x1ACF,0x0000,0x0000, 0x1AD0,0x0000,0x0000, +0x1AD1,0x0000,0x0000, 0x1AD2,0x0000,0x0000, 0x1AD3,0x0000,0x0000, +0x1AD4,0x0000,0x0000, 0x1AD5,0x0000,0x0000, 0x1AD6,0x0000,0x0000, +0x1AD7,0x0000,0x0000, 0x1AD8,0x0000,0x0000, 0x1AD9,0x0000,0x0000, +0x1ADA,0x0000,0x0000, 0x1ADB,0x0000,0x0000, 0x1ADC,0x0000,0x0000, +0x1ADD,0x0000,0x0000, 0x1ADE,0x0000,0x0000, 0x1ADF,0x0000,0x0000, +0x1AE0,0x0000,0x0000, 0x1AE1,0x0000,0x0000, 0x1AE2,0x0000,0x0000, +0x1AE3,0x0000,0x0000, 0x1AE4,0x0000,0x0000, 0x1AE5,0x0000,0x0000, +0x1AE6,0x0000,0x0000, 0x1AE7,0x0000,0x0000, 0x1AE8,0x0000,0x0000, +0x1AE9,0x0000,0x0000, 0x1AEA,0x0000,0x0000, 0x1AEB,0x0000,0x0000, +0x1AEC,0x0000,0x0000, 0x1AED,0x0000,0x0000, 0x1AEE,0x0000,0x0000, +0x1AEF,0x0000,0x0000, 0x1AF0,0x0000,0x0000, 0x1AF1,0x0000,0x0000, +0x1AF2,0x0000,0x0000, 0x1AF3,0x0000,0x0000, 0x1AF4,0x0000,0x0000, +0x1AF5,0x0000,0x0000, 0x1AF6,0x0000,0x0000, 0x1AF7,0x0000,0x0000, +0x1AF8,0x0000,0x0000, 0x1AF9,0x0000,0x0000, 0x1AFA,0x0000,0x0000, +0x1AFB,0x0000,0x0000, 0x1AFC,0x0000,0x0000, 0x1AFD,0x0000,0x0000, +0x1AFE,0x0000,0x0000, 0x1AFF,0x0000,0x0000, 0x1B00,0x0000,0x0000, +0x1B01,0x0000,0x0000, 0x1B02,0x0000,0x0000, 0x1B03,0x0000,0x0000, +0x1B04,0x0000,0x0000, 0x1B05,0x0000,0x0000, 0x1B06,0x0000,0x0000, +0x1B07,0x0000,0x0000, 0x1B08,0x0000,0x0000, 0x1B09,0x0000,0x0000, +0x1B0A,0x0000,0x0000, 0x1B0B,0x0000,0x0000, 0x1B0C,0x0000,0x0000, +0x1B0D,0x0000,0x0000, 0x1B0E,0x0000,0x0000, 0x1B0F,0x0000,0x0000, +0x1B10,0x0000,0x0000, 0x1B11,0x0000,0x0000, 0x1B12,0x0000,0x0000, +0x1B13,0x0000,0x0000, 0x1B14,0x0000,0x0000, 0x1B15,0x0000,0x0000, +0x1B16,0x0000,0x0000, 0x1B17,0x0000,0x0000, 0x1B18,0x0000,0x0000, +0x1B19,0x0000,0x0000, 0x1B1A,0x0000,0x0000, 0x1B1B,0x0000,0x0000, +0x1B1C,0x0000,0x0000, 0x1B1D,0x0000,0x0000, 0x1B1E,0x0000,0x0000, +0x1B1F,0x0000,0x0000, 0x1B20,0x0000,0x0000, 0x1B21,0x0000,0x0000, +0x1B22,0x0000,0x0000, 0x1B23,0x0000,0x0000, 0x1B24,0x0000,0x0000, +0x1B25,0x0000,0x0000, 0x1B26,0x0000,0x0000, 0x1B27,0x0000,0x0000, +0x1B28,0x0000,0x0000, 0x1B29,0x0000,0x0000, 0x1B2A,0x0000,0x0000, +0x1B2B,0x0000,0x0000, 0x1B2C,0x0000,0x0000, 0x1B2D,0x0000,0x0000, +0x1B2E,0x0000,0x0000, 0x1B2F,0x0000,0x0000, 0x1B30,0x0000,0x0000, +0x1B31,0x0000,0x0000, 0x1B32,0x0000,0x0000, 0x1B33,0x0000,0x0000, +0x1B34,0x0000,0x0000, 0x1B35,0x0000,0x0000, 0x1B36,0x0000,0x0000, +0x1B37,0x0000,0x0000, 0x1B38,0x0000,0x0000, 0x1B39,0x0000,0x0000, +0x1B3A,0x0000,0x0000, 0x1B3B,0x0000,0x0000, 0x1B3C,0x0000,0x0000, +0x1B3D,0x0000,0x0000, 0x1B3E,0x0000,0x0000, 0x1B3F,0x0000,0x0000, +0x1B40,0x0000,0x0000, 0x1B41,0x0000,0x0000, 0x1B42,0x0000,0x0000, +0x1B43,0x0000,0x0000, 0x1B44,0x0000,0x0000, 0x1B45,0x0000,0x0000, +0x1B46,0x0000,0x0000, 0x1B47,0x0000,0x0000, 0x1B48,0x0000,0x0000, +0x1B49,0x0000,0x0000, 0x1B4A,0x0000,0x0000, 0x1B4B,0x0000,0x0000, +0x1B4C,0x0000,0x0000, 0x1B4D,0x0000,0x0000, 0x1B4E,0x0000,0x0000, +0x1B4F,0x0000,0x0000, 0x1B50,0x0000,0x0000, 0x1B51,0x0000,0x0000, +0x1B52,0x0000,0x0000, 0x1B53,0x0000,0x0000, 0x1B54,0x0000,0x0000, +0x1B55,0x0000,0x0000, 0x1B56,0x0000,0x0000, 0x1B57,0x0000,0x0000, +0x1B58,0x0000,0x0000, 0x1B59,0x0000,0x0000, 0x1B5A,0x0000,0x0000, +0x1B5B,0x0000,0x0000, 0x1B5C,0x0000,0x0000, 0x1B5D,0x0000,0x0000, +0x1B5E,0x0000,0x0000, 0x1B5F,0x0000,0x0000, 0x1B60,0x0000,0x0000, +0x1B61,0x0000,0x0000, 0x1B62,0x0000,0x0000, 0x1B63,0x0000,0x0000, +0x1B64,0x0000,0x0000, 0x1B65,0x0000,0x0000, 0x1B66,0x0000,0x0000, +0x1B67,0x0000,0x0000, 0x1B68,0x0000,0x0000, 0x1B69,0x0000,0x0000, +0x1B6A,0x0000,0x0000, 0x1B6B,0x0000,0x0000, 0x1B6C,0x0000,0x0000, +0x1B6D,0x0000,0x0000, 0x1B6E,0x0000,0x0000, 0x1B6F,0x0000,0x0000, +0x1B70,0x0000,0x0000, 0x1B71,0x0000,0x0000, 0x1B72,0x0000,0x0000, +0x1B73,0x0000,0x0000, 0x1B74,0x0000,0x0000, 0x1B75,0x0000,0x0000, +0x1B76,0x0000,0x0000, 0x1B77,0x0000,0x0000, 0x1B78,0x0000,0x0000, +0x1B79,0x0000,0x0000, 0x1B7A,0x0000,0x0000, 0x1B7B,0x0000,0x0000, +0x1B7C,0x0000,0x0000, 0x1B7D,0x0000,0x0000, 0x1B7E,0x0000,0x0000, +0x1B7F,0x0000,0x0000, 0x1B80,0x0000,0x0000, 0x1B81,0x0000,0x0000, +0x1B82,0x0000,0x0000, 0x1B83,0x0000,0x0000, 0x1B84,0x0000,0x0000, +0x1B85,0x0000,0x0000, 0x1B86,0x0000,0x0000, 0x1B87,0x0000,0x0000, +0x1B88,0x0000,0x0000, 0x1B89,0x0000,0x0000, 0x1B8A,0x0000,0x0000, +0x1B8B,0x0000,0x0000, 0x1B8C,0x0000,0x0000, 0x1B8D,0x0000,0x0000, +0x1B8E,0x0000,0x0000, 0x1B8F,0x0000,0x0000, 0x1B90,0x0000,0x0000, +0x1B91,0x0000,0x0000, 0x1B92,0x0000,0x0000, 0x1B93,0x0000,0x0000, +0x1B94,0x0000,0x0000, 0x1B95,0x0000,0x0000, 0x1B96,0x0000,0x0000, +0x1B97,0x0000,0x0000, 0x1B98,0x0000,0x0000, 0x1B99,0x0000,0x0000, +0x1B9A,0x0000,0x0000, 0x1B9B,0x0000,0x0000, 0x1B9C,0x0000,0x0000, +0x1B9D,0x0000,0x0000, 0x1B9E,0x0000,0x0000, 0x1B9F,0x0000,0x0000, +0x1BA0,0x0000,0x0000, 0x1BA1,0x0000,0x0000, 0x1BA2,0x0000,0x0000, +0x1BA3,0x0000,0x0000, 0x1BA4,0x0000,0x0000, 0x1BA5,0x0000,0x0000, +0x1BA6,0x0000,0x0000, 0x1BA7,0x0000,0x0000, 0x1BA8,0x0000,0x0000, +0x1BA9,0x0000,0x0000, 0x1BAA,0x0000,0x0000, 0x1BAB,0x0000,0x0000, +0x1BAC,0x0000,0x0000 }; + +uint16 page015data[]= { /* 1500 (2 weights per char) */ +0x1BAD,0x0000, 0x1BAE,0x0000, 0x1BAF,0x0000, 0x1BB0,0x0000, +0x1BB1,0x0000, 0x1BB2,0x0000, 0x1BB3,0x0000, 0x1BB4,0x0000, +0x1BB5,0x0000, 0x1BB6,0x0000, 0x1BB7,0x0000, 0x1BB8,0x0000, +0x1BB9,0x0000, 0x1BBA,0x0000, 0x1BBB,0x0000, 0x1BBC,0x0000, +0x1BBD,0x0000, 0x1BBE,0x0000, 0x1BBF,0x0000, 0x1BC0,0x0000, +0x1BC1,0x0000, 0x1BC2,0x0000, 0x1BC3,0x0000, 0x1BC4,0x0000, +0x1BC5,0x0000, 0x1BC6,0x0000, 0x1BC7,0x0000, 0x1BC8,0x0000, +0x1BC9,0x0000, 0x1BCA,0x0000, 0x1BCB,0x0000, 0x1BCC,0x0000, +0x1BCD,0x0000, 0x1BCE,0x0000, 0x1BCF,0x0000, 0x1BD0,0x0000, +0x1BD1,0x0000, 0x1BD2,0x0000, 0x1BD3,0x0000, 0x1BD4,0x0000, +0x1BD5,0x0000, 0x1BD6,0x0000, 0x1BD7,0x0000, 0x1BD8,0x0000, +0x1BD9,0x0000, 0x1BDA,0x0000, 0x1BDB,0x0000, 0x1BDC,0x0000, +0x1BDD,0x0000, 0x1BDE,0x0000, 0x1BDF,0x0000, 0x1BE0,0x0000, +0x1BE1,0x0000, 0x1BE2,0x0000, 0x1BE3,0x0000, 0x1BE4,0x0000, +0x1BE5,0x0000, 0x1BE6,0x0000, 0x1BE7,0x0000, 0x1BE8,0x0000, +0x1BE9,0x0000, 0x1BEA,0x0000, 0x1BEB,0x0000, 0x1BEC,0x0000, +0x1BED,0x0000, 0x1BEE,0x0000, 0x1BEF,0x0000, 0x1BF0,0x0000, +0x1BF1,0x0000, 0x1BF2,0x0000, 0x1BF3,0x0000, 0x1BF4,0x0000, +0x1BF5,0x0000, 0x1BF6,0x0000, 0x1BF7,0x0000, 0x1BF8,0x0000, +0x1BF9,0x0000, 0x1BFA,0x0000, 0x1BFB,0x0000, 0x1BFC,0x0000, +0x1BFD,0x0000, 0x1BFE,0x0000, 0x1BFF,0x0000, 0x1C00,0x0000, +0x1C01,0x0000, 0x1C02,0x0000, 0x1C03,0x0000, 0x1C04,0x0000, +0x1C05,0x0000, 0x1C06,0x0000, 0x1C07,0x0000, 0x1C08,0x0000, +0x1C09,0x0000, 0x1C0A,0x0000, 0x1C0B,0x0000, 0x1C0C,0x0000, +0x1C0D,0x0000, 0x1C0E,0x0000, 0x1C0F,0x0000, 0x1C10,0x0000, +0x1C11,0x0000, 0x1C12,0x0000, 0x1C13,0x0000, 0x1C14,0x0000, +0x1C15,0x0000, 0x1C16,0x0000, 0x1C17,0x0000, 0x1C18,0x0000, +0x1C19,0x0000, 0x1C1A,0x0000, 0x1C1B,0x0000, 0x1C1C,0x0000, +0x1C1D,0x0000, 0x1C1E,0x0000, 0x1C1F,0x0000, 0x1C20,0x0000, +0x1C21,0x0000, 0x1C22,0x0000, 0x1C23,0x0000, 0x1C24,0x0000, +0x1C25,0x0000, 0x1C26,0x0000, 0x1C27,0x0000, 0x1C28,0x0000, +0x1C5B,0x0000, 0x1C29,0x0000, 0x1C2B,0x0000, 0x1C2C,0x0000, +0x1C2D,0x0000, 0x1C2E,0x0000, 0x1C2F,0x0000, 0x1C30,0x0000, +0x1C31,0x0000, 0x1C32,0x0000, 0x1C33,0x0000, 0x1C34,0x0000, +0x1C35,0x0000, 0x1C36,0x0000, 0x1C37,0x0000, 0x1C38,0x0000, +0x1C39,0x0000, 0x1C3A,0x0000, 0x1C3C,0x0000, 0x1C3D,0x0000, +0x1C3E,0x0000, 0x1C3F,0x0000, 0x1C40,0x0000, 0x1C41,0x0000, +0x1C42,0x0000, 0x1C43,0x0000, 0x1C4A,0x0000, 0x1C4B,0x0000, +0x1C4C,0x0000, 0x1C4D,0x0000, 0x1C4E,0x0000, 0x1C4F,0x0000, +0x1C50,0x0000, 0x1C51,0x0000, 0x1C52,0x0000, 0x1C53,0x0000, +0x1C54,0x0000, 0x1C55,0x0000, 0x1C56,0x0000, 0x1C57,0x0000, +0x1C58,0x0000, 0x1C59,0x0000, 0x1C5A,0x0000, 0x1C5C,0x0000, +0x1C5D,0x0000, 0x1C5E,0x0000, 0x1C5F,0x0000, 0x1C60,0x0000, +0x1C61,0x0000, 0x1C62,0x0000, 0x1C63,0x0000, 0x1C64,0x0000, +0x1C65,0x0000, 0x1C66,0x0000, 0x1C67,0x0000, 0x1C68,0x0000, +0x1C69,0x0000, 0x1C6A,0x0000, 0x1C6B,0x0000, 0x1C6C,0x0000, +0x1C6D,0x0000, 0x1C6E,0x0000, 0x1C6F,0x0000, 0x1C70,0x0000, +0x1C71,0x0000, 0x1C72,0x0000, 0x1C73,0x0000, 0x1C74,0x0000, +0x1C75,0x0000, 0x1C76,0x0000, 0x1C77,0x0000, 0x1C78,0x0000, +0x1C79,0x0000, 0x1C7A,0x0000, 0x1C7B,0x0000, 0x1C7C,0x0000, +0x1C7D,0x0000, 0x1C7E,0x0000, 0x1C7F,0x0000, 0x1C80,0x0000, +0x1C81,0x0000, 0x1C82,0x0000, 0x1C83,0x0000, 0x1C84,0x0000, +0x1C85,0x0000, 0x1C86,0x0000, 0x1C87,0x0000, 0x1C88,0x0000, +0x1C89,0x0000, 0x1C8A,0x0000, 0x1C8B,0x0000, 0x1C8C,0x0000, +0x1C8D,0x0000, 0x1C8E,0x0000, 0x1C8F,0x0000, 0x1C90,0x0000, +0x1C91,0x0000, 0x1C92,0x0000, 0x1C93,0x0000, 0x1C94,0x0000, +0x1C95,0x0000, 0x1C96,0x0000, 0x1C97,0x0000, 0x1C98,0x0000, +0x1C99,0x0000, 0x1C9A,0x0000, 0x1C9B,0x0000, 0x1C9C,0x0000, +0x1C9D,0x0000, 0x1C9E,0x0000, 0x1C9F,0x0000, 0x1CA0,0x0000, +0x1CA1,0x0000, 0x1CA2,0x0000, 0x1CA3,0x0000, 0x1CA4,0x0000, +0x1CA5,0x0000, 0x1CA6,0x0000, 0x1CA7,0x0000, 0x1CA8,0x0000, +0x1CA9,0x0000, 0x1CAA,0x0000, 0x1CAB,0x0000, 0x1CAC,0x0000, +0x1CAD,0x0000, 0x1CAE,0x0000, 0x1CAF,0x0000, 0x1CB0,0x0000, +0x1CB1,0x0000, 0x1CB2,0x0000, 0x1CB3,0x0000, 0x1CB4,0x0000 +}; + +uint16 page016data[]= { /* 1600 (3 weights per char) */ +0x1CB5,0x0000,0x0000, 0x1CB6,0x0000,0x0000, 0x1CB7,0x0000,0x0000, +0x1CB8,0x0000,0x0000, 0x1CB9,0x0000,0x0000, 0x1CBA,0x0000,0x0000, +0x1CBB,0x0000,0x0000, 0x1CBC,0x0000,0x0000, 0x1CBD,0x0000,0x0000, +0x1CBE,0x0000,0x0000, 0x1CBF,0x0000,0x0000, 0x1CC0,0x0000,0x0000, +0x1CC1,0x0000,0x0000, 0x1CC2,0x0000,0x0000, 0x1CC3,0x0000,0x0000, +0x1CC4,0x0000,0x0000, 0x1CC5,0x0000,0x0000, 0x1CC6,0x0000,0x0000, +0x1CC7,0x0000,0x0000, 0x1CC8,0x0000,0x0000, 0x1CC9,0x0000,0x0000, +0x1CCA,0x0000,0x0000, 0x1CCB,0x0000,0x0000, 0x1CCC,0x0000,0x0000, +0x1CCD,0x0000,0x0000, 0x1CCE,0x0000,0x0000, 0x1CCF,0x0000,0x0000, +0x1CD0,0x0000,0x0000, 0x1CD1,0x0000,0x0000, 0x1CD2,0x0000,0x0000, +0x1CD3,0x0000,0x0000, 0x1CD4,0x0000,0x0000, 0x1CD5,0x0000,0x0000, +0x1CD6,0x0000,0x0000, 0x1CD7,0x0000,0x0000, 0x1CD8,0x0000,0x0000, +0x1CD9,0x0000,0x0000, 0x1CDA,0x0000,0x0000, 0x1CDB,0x0000,0x0000, +0x1CDC,0x0000,0x0000, 0x1CDD,0x0000,0x0000, 0x1CDE,0x0000,0x0000, +0x1CDF,0x0000,0x0000, 0x1CE0,0x0000,0x0000, 0x1CE1,0x0000,0x0000, +0x1CE2,0x0000,0x0000, 0x1CE3,0x0000,0x0000, 0x1CE4,0x0000,0x0000, +0x1CE5,0x0000,0x0000, 0x1CE6,0x0000,0x0000, 0x1CE7,0x0000,0x0000, +0x1CE8,0x0000,0x0000, 0x1CE9,0x0000,0x0000, 0x1CEA,0x0000,0x0000, +0x1CEB,0x0000,0x0000, 0x1CEC,0x0000,0x0000, 0x1CED,0x0000,0x0000, +0x1CEE,0x0000,0x0000, 0x1CEF,0x0000,0x0000, 0x1CF0,0x0000,0x0000, +0x1CF1,0x0000,0x0000, 0x1CF2,0x0000,0x0000, 0x1CF3,0x0000,0x0000, +0x1CF4,0x0000,0x0000, 0x1CF5,0x0000,0x0000, 0x1CF6,0x0000,0x0000, +0x1CF7,0x0000,0x0000, 0x1CF8,0x0000,0x0000, 0x1CF9,0x0000,0x0000, +0x1CFA,0x0000,0x0000, 0x1CFB,0x0000,0x0000, 0x1CFC,0x0000,0x0000, +0x1CFD,0x0000,0x0000, 0x1CFE,0x0000,0x0000, 0x1CFF,0x0000,0x0000, +0x1D00,0x0000,0x0000, 0x1D01,0x0000,0x0000, 0x1D02,0x0000,0x0000, +0x1D03,0x0000,0x0000, 0x1D04,0x0000,0x0000, 0x1D05,0x0000,0x0000, +0x1D06,0x0000,0x0000, 0x1D07,0x0000,0x0000, 0x1D08,0x0000,0x0000, +0x1D09,0x0000,0x0000, 0x1D0A,0x0000,0x0000, 0x1D0B,0x0000,0x0000, +0x1D0C,0x0000,0x0000, 0x1D0D,0x0000,0x0000, 0x1D0E,0x0000,0x0000, +0x1D0F,0x0000,0x0000, 0x1D10,0x0000,0x0000, 0x1D11,0x0000,0x0000, +0x1D12,0x0000,0x0000, 0x1D13,0x0000,0x0000, 0x1D14,0x0000,0x0000, +0x1D15,0x0000,0x0000, 0x1D16,0x0000,0x0000, 0x1D17,0x0000,0x0000, +0x1D18,0x0000,0x0000, 0x1D19,0x0000,0x0000, 0x1D1A,0x0000,0x0000, +0x1D1B,0x0000,0x0000, 0x1D1C,0x0000,0x0000, 0x1D1D,0x0000,0x0000, +0x1D1E,0x0000,0x0000, 0x1D1F,0x0000,0x0000, 0x1D20,0x0000,0x0000, +0x1D21,0x0000,0x0000, 0x0316,0x0000,0x0000, 0x0265,0x0000,0x0000, +0x1C2A,0x0000,0x0000, 0x1C3B,0x0000,0x0000, 0x1C44,0x0000,0x0000, +0x1C45,0x0000,0x0000, 0x1C46,0x0000,0x0000, 0x1C47,0x0000,0x0000, +0x1C48,0x0000,0x0000, 0x1C49,0x0000,0x0000, 0xFBC0,0x9677,0x0000, +0xFBC0,0x9678,0x0000, 0xFBC0,0x9679,0x0000, 0xFBC0,0x967A,0x0000, +0xFBC0,0x967B,0x0000, 0xFBC0,0x967C,0x0000, 0xFBC0,0x967D,0x0000, +0xFBC0,0x967E,0x0000, 0xFBC0,0x967F,0x0000, 0x020A,0x0000,0x0000, +0x1D22,0x0000,0x0000, 0x1D23,0x0000,0x0000, 0x1D24,0x0000,0x0000, +0x1D25,0x0000,0x0000, 0x1D26,0x0000,0x0000, 0x1D27,0x0000,0x0000, +0x1D28,0x0000,0x0000, 0x1D29,0x0000,0x0000, 0x1D2A,0x0000,0x0000, +0x1D2B,0x0000,0x0000, 0x1D2C,0x0000,0x0000, 0x1D2D,0x0000,0x0000, +0x1D2E,0x0000,0x0000, 0x1D2F,0x0000,0x0000, 0x1D30,0x0000,0x0000, +0x1D31,0x0000,0x0000, 0x1D32,0x0000,0x0000, 0x1D33,0x0000,0x0000, +0x1D34,0x0000,0x0000, 0x1D35,0x0000,0x0000, 0x1D36,0x0000,0x0000, +0x1D37,0x0000,0x0000, 0x1D38,0x0000,0x0000, 0x1D39,0x0000,0x0000, +0x1D3A,0x0000,0x0000, 0x1D3B,0x0000,0x0000, 0x0292,0x0000,0x0000, +0x0293,0x0000,0x0000, 0xFBC0,0x969D,0x0000, 0xFBC0,0x969E,0x0000, +0xFBC0,0x969F,0x0000, 0x1D3C,0x0000,0x0000, 0x1D3C,0x0000,0x0000, +0x1D3D,0x0000,0x0000, 0x1D59,0x0000,0x0000, 0x1D3D,0x0000,0x0000, +0x1D3D,0x0000,0x0000, 0x1D3E,0x0000,0x0000, 0x1D3E,0x0000,0x0000, +0x1D3F,0x0000,0x0000, 0x1D3F,0x0000,0x0000, 0x1D57,0x0000,0x0000, +0x1D58,0x0000,0x0000, 0x1D3F,0x0000,0x0000, 0x1D3F,0x0000,0x0000, +0x1D3F,0x0000,0x0000, 0x1D40,0x0000,0x0000, 0x1D41,0x0000,0x0000, +0x1D42,0x0000,0x0000, 0x1D43,0x0000,0x0000, 0x1D43,0x0000,0x0000, +0x1D43,0x0000,0x0000, 0x1D43,0x0000,0x0000, 0x1D43,0x0000,0x0000, +0x1D44,0x0000,0x0000, 0x1D5C,0x0000,0x0000, 0x1D45,0x0000,0x0000, +0x1D46,0x0000,0x0000, 0x1D46,0x0000,0x0000, 0x1D46,0x0000,0x0000, +0x1D46,0x0000,0x0000, 0x1D47,0x0000,0x0000, 0x1D47,0x0000,0x0000, +0x1D47,0x0000,0x0000, 0x1D48,0x0000,0x0000, 0x1D48,0x0000,0x0000, +0x1D49,0x0000,0x0000, 0x1D49,0x0000,0x0000, 0x1D4A,0x0000,0x0000, +0x1D4A,0x0000,0x0000, 0x1D4B,0x0000,0x0000, 0x1D4C,0x0000,0x0000, +0x1D4D,0x0000,0x0000, 0x1D4E,0x0000,0x0000, 0x1D4E,0x0000,0x0000, +0x1D4E,0x0000,0x0000, 0x1D4E,0x0000,0x0000, 0x1D4E,0x0000,0x0000, +0x1D4F,0x0000,0x0000, 0x1D4F,0x0000,0x0000, 0x1D4F,0x0000,0x0000, +0x1D50,0x0000,0x0000, 0x1D50,0x0000,0x0000, 0x1D50,0x0000,0x0000, +0x1D4C,0x0000,0x0000, 0x1D51,0x0000,0x0000, 0x1D52,0x0000,0x0000, +0x1D52,0x0000,0x0000, 0x1D52,0x0000,0x0000, 0x1D53,0x0000,0x0000, +0x1D53,0x0000,0x0000, 0x1D54,0x0000,0x0000, 0x1D54,0x0000,0x0000, +0x1D55,0x0000,0x0000, 0x1D56,0x0000,0x0000, 0x1D5A,0x0000,0x0000, +0x1D5E,0x0000,0x0000, 0x1D5F,0x0000,0x0000, 0x1D5B,0x0000,0x0000, +0x1D5D,0x0000,0x0000, 0x1D60,0x0000,0x0000, 0x1D61,0x0000,0x0000, +0x1D61,0x0000,0x0000, 0x1D61,0x0000,0x0000, 0x1D45,0x0000,0x0000, +0x1D4E,0x0000,0x0000, 0x024E,0x0000,0x0000, 0x024F,0x0000,0x0000, +0x0250,0x0000,0x0000, 0x1D4A,0x1D53,0x0000, 0x1D52,0x1D52,0x0000, +0x1D3E,0x1D3E,0x0000, 0xFBC0,0x96F1,0x0000, 0xFBC0,0x96F2,0x0000, +0xFBC0,0x96F3,0x0000, 0xFBC0,0x96F4,0x0000, 0xFBC0,0x96F5,0x0000, +0xFBC0,0x96F6,0x0000, 0xFBC0,0x96F7,0x0000, 0xFBC0,0x96F8,0x0000, +0xFBC0,0x96F9,0x0000, 0xFBC0,0x96FA,0x0000, 0xFBC0,0x96FB,0x0000, +0xFBC0,0x96FC,0x0000, 0xFBC0,0x96FD,0x0000, 0xFBC0,0x96FE,0x0000, +0xFBC0,0x96FF,0x0000 }; + +uint16 page017data[]= { /* 1700 (3 weights per char) */ +0x18E2,0x0000,0x0000, 0x18E3,0x0000,0x0000, 0x18E4,0x0000,0x0000, +0x18E5,0x0000,0x0000, 0x18E6,0x0000,0x0000, 0x18E7,0x0000,0x0000, +0x18E8,0x0000,0x0000, 0x18E9,0x0000,0x0000, 0x18EA,0x0000,0x0000, +0x18EB,0x0000,0x0000, 0x18EC,0x0000,0x0000, 0x18ED,0x0000,0x0000, +0x18EE,0x0000,0x0000, 0xFBC0,0x970D,0x0000, 0x18EF,0x0000,0x0000, +0x18F0,0x0000,0x0000, 0x18F1,0x0000,0x0000, 0x18F2,0x0000,0x0000, +0x18F3,0x0000,0x0000, 0x18F4,0x0000,0x0000, 0x18F5,0x0000,0x0000, +0xFBC0,0x9715,0x0000, 0xFBC0,0x9716,0x0000, 0xFBC0,0x9717,0x0000, +0xFBC0,0x9718,0x0000, 0xFBC0,0x9719,0x0000, 0xFBC0,0x971A,0x0000, +0xFBC0,0x971B,0x0000, 0xFBC0,0x971C,0x0000, 0xFBC0,0x971D,0x0000, +0xFBC0,0x971E,0x0000, 0xFBC0,0x971F,0x0000, 0x18F6,0x0000,0x0000, +0x18F7,0x0000,0x0000, 0x18F8,0x0000,0x0000, 0x18F9,0x0000,0x0000, +0x18FA,0x0000,0x0000, 0x18FB,0x0000,0x0000, 0x18FC,0x0000,0x0000, +0x18FD,0x0000,0x0000, 0x18FE,0x0000,0x0000, 0x18FF,0x0000,0x0000, +0x1900,0x0000,0x0000, 0x1901,0x0000,0x0000, 0x1902,0x0000,0x0000, +0x1903,0x0000,0x0000, 0x1904,0x0000,0x0000, 0x1905,0x0000,0x0000, +0x1906,0x0000,0x0000, 0x1907,0x0000,0x0000, 0x1908,0x0000,0x0000, +0x1909,0x0000,0x0000, 0x190A,0x0000,0x0000, 0x026A,0x0000,0x0000, +0x026B,0x0000,0x0000, 0xFBC0,0x9737,0x0000, 0xFBC0,0x9738,0x0000, +0xFBC0,0x9739,0x0000, 0xFBC0,0x973A,0x0000, 0xFBC0,0x973B,0x0000, +0xFBC0,0x973C,0x0000, 0xFBC0,0x973D,0x0000, 0xFBC0,0x973E,0x0000, +0xFBC0,0x973F,0x0000, 0x190B,0x0000,0x0000, 0x190C,0x0000,0x0000, +0x190D,0x0000,0x0000, 0x190E,0x0000,0x0000, 0x190F,0x0000,0x0000, +0x1910,0x0000,0x0000, 0x1911,0x0000,0x0000, 0x1912,0x0000,0x0000, +0x1913,0x0000,0x0000, 0x1914,0x0000,0x0000, 0x1915,0x0000,0x0000, +0x1916,0x0000,0x0000, 0x1917,0x0000,0x0000, 0x1918,0x0000,0x0000, +0x1919,0x0000,0x0000, 0x191A,0x0000,0x0000, 0x191B,0x0000,0x0000, +0x191C,0x0000,0x0000, 0x191D,0x0000,0x0000, 0x191E,0x0000,0x0000, +0xFBC0,0x9754,0x0000, 0xFBC0,0x9755,0x0000, 0xFBC0,0x9756,0x0000, +0xFBC0,0x9757,0x0000, 0xFBC0,0x9758,0x0000, 0xFBC0,0x9759,0x0000, +0xFBC0,0x975A,0x0000, 0xFBC0,0x975B,0x0000, 0xFBC0,0x975C,0x0000, +0xFBC0,0x975D,0x0000, 0xFBC0,0x975E,0x0000, 0xFBC0,0x975F,0x0000, +0x191F,0x0000,0x0000, 0x1920,0x0000,0x0000, 0x1921,0x0000,0x0000, +0x1922,0x0000,0x0000, 0x1923,0x0000,0x0000, 0x1924,0x0000,0x0000, +0x1925,0x0000,0x0000, 0x1926,0x0000,0x0000, 0x1927,0x0000,0x0000, +0x1928,0x0000,0x0000, 0x1929,0x0000,0x0000, 0x192A,0x0000,0x0000, +0x192B,0x0000,0x0000, 0xFBC0,0x976D,0x0000, 0x192C,0x0000,0x0000, +0x192D,0x0000,0x0000, 0x192E,0x0000,0x0000, 0xFBC0,0x9771,0x0000, +0x192F,0x0000,0x0000, 0x1930,0x0000,0x0000, 0xFBC0,0x9774,0x0000, +0xFBC0,0x9775,0x0000, 0xFBC0,0x9776,0x0000, 0xFBC0,0x9777,0x0000, +0xFBC0,0x9778,0x0000, 0xFBC0,0x9779,0x0000, 0xFBC0,0x977A,0x0000, +0xFBC0,0x977B,0x0000, 0xFBC0,0x977C,0x0000, 0xFBC0,0x977D,0x0000, +0xFBC0,0x977E,0x0000, 0xFBC0,0x977F,0x0000, 0x196C,0x0000,0x0000, +0x196D,0x0000,0x0000, 0x196E,0x0000,0x0000, 0x196F,0x0000,0x0000, +0x1970,0x0000,0x0000, 0x1971,0x0000,0x0000, 0x1972,0x0000,0x0000, +0x1973,0x0000,0x0000, 0x1974,0x0000,0x0000, 0x1975,0x0000,0x0000, +0x1976,0x0000,0x0000, 0x1977,0x0000,0x0000, 0x1978,0x0000,0x0000, +0x1979,0x0000,0x0000, 0x197A,0x0000,0x0000, 0x197B,0x0000,0x0000, +0x197C,0x0000,0x0000, 0x197D,0x0000,0x0000, 0x197E,0x0000,0x0000, +0x197F,0x0000,0x0000, 0x1980,0x0000,0x0000, 0x1981,0x0000,0x0000, +0x1982,0x0000,0x0000, 0x1983,0x0000,0x0000, 0x1984,0x0000,0x0000, +0x1985,0x0000,0x0000, 0x1986,0x0000,0x0000, 0x1987,0x0000,0x0000, +0x1988,0x0000,0x0000, 0x1989,0x0000,0x0000, 0x198A,0x0000,0x0000, +0x198B,0x0000,0x0000, 0x198C,0x0000,0x0000, 0x198D,0x0000,0x0000, +0x198E,0x0000,0x0000, 0x1990,0x0000,0x0000, 0x1991,0x0000,0x0000, +0x1992,0x0000,0x0000, 0x1993,0x0000,0x0000, 0x1994,0x0000,0x0000, +0x1995,0x0000,0x0000, 0x1996,0x0000,0x0000, 0x1997,0x0000,0x0000, +0x1998,0x0000,0x0000, 0x1999,0x0000,0x0000, 0x199A,0x0000,0x0000, +0x199B,0x0000,0x0000, 0x199C,0x0000,0x0000, 0x199D,0x0000,0x0000, +0x199E,0x0000,0x0000, 0x199F,0x0000,0x0000, 0x19A0,0x0000,0x0000, +0x19A1,0x0000,0x0000, 0x19A2,0x0000,0x0000, 0x19A3,0x0000,0x0000, +0x19A4,0x0000,0x0000, 0x19A5,0x0000,0x0000, 0x19A6,0x0000,0x0000, +0x19A7,0x0000,0x0000, 0x19A8,0x0000,0x0000, 0x19A9,0x0000,0x0000, +0x19AA,0x0000,0x0000, 0x19AB,0x0000,0x0000, 0x19AC,0x0000,0x0000, +0x19AD,0x0000,0x0000, 0x19AE,0x0000,0x0000, 0x19AF,0x0000,0x0000, +0x19B0,0x0000,0x0000, 0x19B1,0x0000,0x0000, 0x19B2,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x19B3,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x026E,0x0000,0x0000, +0x026F,0x0000,0x0000, 0x024D,0x0000,0x0000, 0x0312,0x0000,0x0000, +0x0313,0x0000,0x0000, 0x0314,0x0000,0x0000, 0x0315,0x0000,0x0000, +0x0E17,0x0000,0x0000, 0x198F,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x97DE,0x0000, 0xFBC0,0x97DF,0x0000, 0x0E29,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0xFBC0,0x97EA,0x0000, 0xFBC0,0x97EB,0x0000, 0xFBC0,0x97EC,0x0000, +0xFBC0,0x97ED,0x0000, 0xFBC0,0x97EE,0x0000, 0xFBC0,0x97EF,0x0000, +0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0xFBC0,0x97FA,0x0000, 0xFBC0,0x97FB,0x0000, +0xFBC0,0x97FC,0x0000, 0xFBC0,0x97FD,0x0000, 0xFBC0,0x97FE,0x0000, +0xFBC0,0x97FF,0x0000 }; + +uint16 page018data[]= { /* 1800 (3 weights per char) */ +0x02F8,0x0000,0x0000, 0x025E,0x0000,0x0000, 0x0235,0x0000,0x0000, +0x0263,0x0000,0x0000, 0x024A,0x0000,0x0000, 0x024B,0x0000,0x0000, +0x0223,0x0000,0x0000, 0x0224,0x0000,0x0000, 0x0236,0x0000,0x0000, +0x0264,0x0000,0x0000, 0x02F9,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x980F,0x0000, 0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, +0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, +0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, +0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, 0xFBC0,0x981A,0x0000, +0xFBC0,0x981B,0x0000, 0xFBC0,0x981C,0x0000, 0xFBC0,0x981D,0x0000, +0xFBC0,0x981E,0x0000, 0xFBC0,0x981F,0x0000, 0x19DF,0x0000,0x0000, +0x19E1,0x0000,0x0000, 0x19E4,0x0000,0x0000, 0x19EA,0x0000,0x0000, +0x19EC,0x0000,0x0000, 0x19EF,0x0000,0x0000, 0x19F1,0x0000,0x0000, +0x19F4,0x0000,0x0000, 0x19F5,0x0000,0x0000, 0x19F6,0x0000,0x0000, +0x19FB,0x0000,0x0000, 0x19FD,0x0000,0x0000, 0x1A00,0x0000,0x0000, +0x1A02,0x0000,0x0000, 0x1A07,0x0000,0x0000, 0x1A09,0x0000,0x0000, +0x1A0A,0x0000,0x0000, 0x1A0B,0x0000,0x0000, 0x1A12,0x0000,0x0000, +0x1A15,0x0000,0x0000, 0x1A18,0x0000,0x0000, 0x1A1D,0x0000,0x0000, +0x1A21,0x0000,0x0000, 0x1A24,0x0000,0x0000, 0x1A26,0x0000,0x0000, +0x1A28,0x0000,0x0000, 0x1A2B,0x0000,0x0000, 0x1A30,0x0000,0x0000, +0x1A31,0x0000,0x0000, 0x1A34,0x0000,0x0000, 0x1A38,0x0000,0x0000, +0x1A3B,0x0000,0x0000, 0x1A3C,0x0000,0x0000, 0x1A3D,0x0000,0x0000, +0x1A3E,0x0000,0x0000, 0x19DE,0x0000,0x0000, 0x19E2,0x0000,0x0000, +0x19E5,0x0000,0x0000, 0x19EB,0x0000,0x0000, 0x19ED,0x0000,0x0000, +0x19F0,0x0000,0x0000, 0x19F2,0x0000,0x0000, 0x19F7,0x0000,0x0000, +0x19FC,0x0000,0x0000, 0x19FE,0x0000,0x0000, 0x1A01,0x0000,0x0000, +0x1A03,0x0000,0x0000, 0x1A08,0x0000,0x0000, 0x1A13,0x0000,0x0000, +0x1A16,0x0000,0x0000, 0x1A19,0x0000,0x0000, 0x1A1E,0x0000,0x0000, +0x1A32,0x0000,0x0000, 0x1A22,0x0000,0x0000, 0x1A27,0x0000,0x0000, +0x1A2C,0x0000,0x0000, 0x1A36,0x0000,0x0000, 0x1A39,0x0000,0x0000, +0x1A3F,0x0000,0x0000, 0x1A40,0x0000,0x0000, 0x1A1B,0x0000,0x0000, +0x19E3,0x0000,0x0000, 0x19E6,0x0000,0x0000, 0x19E9,0x0000,0x0000, +0x19F3,0x0000,0x0000, 0x19EE,0x0000,0x0000, 0x19F8,0x0000,0x0000, +0x1A2D,0x0000,0x0000, 0x1A04,0x0000,0x0000, 0x1A06,0x0000,0x0000, +0x19FF,0x0000,0x0000, 0x1A0C,0x0000,0x0000, 0x1A14,0x0000,0x0000, +0x1A17,0x0000,0x0000, 0x1A1F,0x0000,0x0000, 0x1A29,0x0000,0x0000, +0x1A37,0x0000,0x0000, 0x1A3A,0x0000,0x0000, 0x1A33,0x0000,0x0000, +0x1A35,0x0000,0x0000, 0x1A41,0x0000,0x0000, 0x1A1A,0x0000,0x0000, +0x1A23,0x0000,0x0000, 0x19E7,0x0000,0x0000, 0x1A2E,0x0000,0x0000, +0x1A25,0x0000,0x0000, 0x1A2A,0x0000,0x0000, 0x1A20,0x0000,0x0000, +0xFBC0,0x9878,0x0000, 0xFBC0,0x9879,0x0000, 0xFBC0,0x987A,0x0000, +0xFBC0,0x987B,0x0000, 0xFBC0,0x987C,0x0000, 0xFBC0,0x987D,0x0000, +0xFBC0,0x987E,0x0000, 0xFBC0,0x987F,0x0000, 0x19D7,0x0000,0x0000, +0x19D8,0x0000,0x0000, 0x19D9,0x0000,0x0000, 0x19DA,0x0000,0x0000, +0x19DB,0x0000,0x0000, 0x19DC,0x0000,0x0000, 0x19DD,0x0000,0x0000, +0x19E0,0x0000,0x0000, 0x19E8,0x0000,0x0000, 0x1A2F,0x0000,0x0000, +0x19F9,0x0000,0x0000, 0x1A1C,0x0000,0x0000, 0x1A42,0x0000,0x0000, +0x1A44,0x0000,0x0000, 0x1A45,0x0000,0x0000, 0x1A47,0x0000,0x0000, +0x1A48,0x0000,0x0000, 0x1A4B,0x0000,0x0000, 0x1A4D,0x0000,0x0000, +0x1A4E,0x0000,0x0000, 0x1A50,0x0000,0x0000, 0x1A52,0x0000,0x0000, +0x1A54,0x0000,0x0000, 0x1A55,0x0000,0x0000, 0x1A49,0x0000,0x0000, +0x1A53,0x0000,0x0000, 0x1A05,0x0000,0x0000, 0x19FA,0x0000,0x0000, +0x1A0D,0x0000,0x0000, 0x1A0E,0x0000,0x0000, 0x1A43,0x0000,0x0000, +0x1A46,0x0000,0x0000, 0x1A4A,0x0000,0x0000, 0x1A4C,0x0000,0x0000, +0x1A0F,0x0000,0x0000, 0x1A51,0x0000,0x0000, 0x1A10,0x0000,0x0000, +0x1A11,0x0000,0x0000, 0x1A56,0x0000,0x0000, 0x1A57,0x0000,0x0000, +0x1A4F,0x0000,0x0000, 0x1A58,0x0000,0x0000, 0xFBC0,0x98AA,0x0000, +0xFBC0,0x98AB,0x0000, 0xFBC0,0x98AC,0x0000, 0xFBC0,0x98AD,0x0000, +0xFBC0,0x98AE,0x0000, 0xFBC0,0x98AF,0x0000, 0xFBC0,0x98B0,0x0000, +0xFBC0,0x98B1,0x0000, 0xFBC0,0x98B2,0x0000, 0xFBC0,0x98B3,0x0000, +0xFBC0,0x98B4,0x0000, 0xFBC0,0x98B5,0x0000, 0xFBC0,0x98B6,0x0000, +0xFBC0,0x98B7,0x0000, 0xFBC0,0x98B8,0x0000, 0xFBC0,0x98B9,0x0000, +0xFBC0,0x98BA,0x0000, 0xFBC0,0x98BB,0x0000, 0xFBC0,0x98BC,0x0000, +0xFBC0,0x98BD,0x0000, 0xFBC0,0x98BE,0x0000, 0xFBC0,0x98BF,0x0000, +0xFBC0,0x98C0,0x0000, 0xFBC0,0x98C1,0x0000, 0xFBC0,0x98C2,0x0000, +0xFBC0,0x98C3,0x0000, 0xFBC0,0x98C4,0x0000, 0xFBC0,0x98C5,0x0000, +0xFBC0,0x98C6,0x0000, 0xFBC0,0x98C7,0x0000, 0xFBC0,0x98C8,0x0000, +0xFBC0,0x98C9,0x0000, 0xFBC0,0x98CA,0x0000, 0xFBC0,0x98CB,0x0000, +0xFBC0,0x98CC,0x0000, 0xFBC0,0x98CD,0x0000, 0xFBC0,0x98CE,0x0000, +0xFBC0,0x98CF,0x0000, 0xFBC0,0x98D0,0x0000, 0xFBC0,0x98D1,0x0000, +0xFBC0,0x98D2,0x0000, 0xFBC0,0x98D3,0x0000, 0xFBC0,0x98D4,0x0000, +0xFBC0,0x98D5,0x0000, 0xFBC0,0x98D6,0x0000, 0xFBC0,0x98D7,0x0000, +0xFBC0,0x98D8,0x0000, 0xFBC0,0x98D9,0x0000, 0xFBC0,0x98DA,0x0000, +0xFBC0,0x98DB,0x0000, 0xFBC0,0x98DC,0x0000, 0xFBC0,0x98DD,0x0000, +0xFBC0,0x98DE,0x0000, 0xFBC0,0x98DF,0x0000, 0xFBC0,0x98E0,0x0000, +0xFBC0,0x98E1,0x0000, 0xFBC0,0x98E2,0x0000, 0xFBC0,0x98E3,0x0000, +0xFBC0,0x98E4,0x0000, 0xFBC0,0x98E5,0x0000, 0xFBC0,0x98E6,0x0000, +0xFBC0,0x98E7,0x0000, 0xFBC0,0x98E8,0x0000, 0xFBC0,0x98E9,0x0000, +0xFBC0,0x98EA,0x0000, 0xFBC0,0x98EB,0x0000, 0xFBC0,0x98EC,0x0000, +0xFBC0,0x98ED,0x0000, 0xFBC0,0x98EE,0x0000, 0xFBC0,0x98EF,0x0000, +0xFBC0,0x98F0,0x0000, 0xFBC0,0x98F1,0x0000, 0xFBC0,0x98F2,0x0000, +0xFBC0,0x98F3,0x0000, 0xFBC0,0x98F4,0x0000, 0xFBC0,0x98F5,0x0000, +0xFBC0,0x98F6,0x0000, 0xFBC0,0x98F7,0x0000, 0xFBC0,0x98F8,0x0000, +0xFBC0,0x98F9,0x0000, 0xFBC0,0x98FA,0x0000, 0xFBC0,0x98FB,0x0000, +0xFBC0,0x98FC,0x0000, 0xFBC0,0x98FD,0x0000, 0xFBC0,0x98FE,0x0000, +0xFBC0,0x98FF,0x0000 }; + +uint16 page019data[]= { /* 1900 (3 weights per char) */ +0x18B0,0x0000,0x0000, 0x18B1,0x0000,0x0000, 0x18B2,0x0000,0x0000, +0x18B3,0x0000,0x0000, 0x18B4,0x0000,0x0000, 0x18B5,0x0000,0x0000, +0x18B6,0x0000,0x0000, 0x18B7,0x0000,0x0000, 0x18B8,0x0000,0x0000, +0x18B9,0x0000,0x0000, 0x18BA,0x0000,0x0000, 0x18BB,0x0000,0x0000, +0x18BC,0x0000,0x0000, 0x18BD,0x0000,0x0000, 0x18BE,0x0000,0x0000, +0x18BF,0x0000,0x0000, 0x18C0,0x0000,0x0000, 0x18C1,0x0000,0x0000, +0x18C2,0x0000,0x0000, 0x18C3,0x0000,0x0000, 0x18C4,0x0000,0x0000, +0x18C5,0x0000,0x0000, 0x18C6,0x0000,0x0000, 0x18C7,0x0000,0x0000, +0x18C8,0x0000,0x0000, 0x18C9,0x0000,0x0000, 0x18CA,0x0000,0x0000, +0x18CB,0x0000,0x0000, 0x18CC,0x0000,0x0000, 0xFBC0,0x991D,0x0000, +0xFBC0,0x991E,0x0000, 0xFBC0,0x991F,0x0000, 0x18CD,0x0000,0x0000, +0x18CE,0x0000,0x0000, 0x18CF,0x0000,0x0000, 0x18D0,0x0000,0x0000, +0x18D1,0x0000,0x0000, 0x18D2,0x0000,0x0000, 0x18D3,0x0000,0x0000, +0x18D4,0x0000,0x0000, 0x18D5,0x0000,0x0000, 0x18D6,0x0000,0x0000, +0x18D7,0x0000,0x0000, 0x18D8,0x0000,0x0000, 0xFBC0,0x992C,0x0000, +0xFBC0,0x992D,0x0000, 0xFBC0,0x992E,0x0000, 0xFBC0,0x992F,0x0000, +0x18D9,0x0000,0x0000, 0x18DA,0x0000,0x0000, 0x18DB,0x0000,0x0000, +0x18DC,0x0000,0x0000, 0x18DD,0x0000,0x0000, 0x18DE,0x0000,0x0000, +0x18DF,0x0000,0x0000, 0x18E0,0x0000,0x0000, 0x18E1,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC0,0x993C,0x0000, 0xFBC0,0x993D,0x0000, 0xFBC0,0x993E,0x0000, +0xFBC0,0x993F,0x0000, 0x030D,0x0000,0x0000, 0xFBC0,0x9941,0x0000, +0xFBC0,0x9942,0x0000, 0xFBC0,0x9943,0x0000, 0x0254,0x0000,0x0000, +0x025B,0x0000,0x0000, 0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, +0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, +0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, +0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, 0x19B4,0x0000,0x0000, +0x19B5,0x0000,0x0000, 0x19B6,0x0000,0x0000, 0x19B7,0x0000,0x0000, +0x19B8,0x0000,0x0000, 0x19B9,0x0000,0x0000, 0x19BA,0x0000,0x0000, +0x19BB,0x0000,0x0000, 0x19BC,0x0000,0x0000, 0x19BD,0x0000,0x0000, +0x19BE,0x0000,0x0000, 0x19BF,0x0000,0x0000, 0x19C0,0x0000,0x0000, +0x19C1,0x0000,0x0000, 0x19C2,0x0000,0x0000, 0x19C3,0x0000,0x0000, +0x19C4,0x0000,0x0000, 0x19C5,0x0000,0x0000, 0x19C6,0x0000,0x0000, +0x19C7,0x0000,0x0000, 0x19C8,0x0000,0x0000, 0x19C9,0x0000,0x0000, +0x19CA,0x0000,0x0000, 0x19CB,0x0000,0x0000, 0x19CC,0x0000,0x0000, +0x19CD,0x0000,0x0000, 0x19CE,0x0000,0x0000, 0x19CF,0x0000,0x0000, +0x19D0,0x0000,0x0000, 0x19D1,0x0000,0x0000, 0xFBC0,0x996E,0x0000, +0xFBC0,0x996F,0x0000, 0x19D2,0x0000,0x0000, 0x19D3,0x0000,0x0000, +0x19D4,0x0000,0x0000, 0x19D5,0x0000,0x0000, 0x19D6,0x0000,0x0000, +0xFBC0,0x9975,0x0000, 0xFBC0,0x9976,0x0000, 0xFBC0,0x9977,0x0000, +0xFBC0,0x9978,0x0000, 0xFBC0,0x9979,0x0000, 0xFBC0,0x997A,0x0000, +0xFBC0,0x997B,0x0000, 0xFBC0,0x997C,0x0000, 0xFBC0,0x997D,0x0000, +0xFBC0,0x997E,0x0000, 0xFBC0,0x997F,0x0000, 0xFBC0,0x9980,0x0000, +0xFBC0,0x9981,0x0000, 0xFBC0,0x9982,0x0000, 0xFBC0,0x9983,0x0000, +0xFBC0,0x9984,0x0000, 0xFBC0,0x9985,0x0000, 0xFBC0,0x9986,0x0000, +0xFBC0,0x9987,0x0000, 0xFBC0,0x9988,0x0000, 0xFBC0,0x9989,0x0000, +0xFBC0,0x998A,0x0000, 0xFBC0,0x998B,0x0000, 0xFBC0,0x998C,0x0000, +0xFBC0,0x998D,0x0000, 0xFBC0,0x998E,0x0000, 0xFBC0,0x998F,0x0000, +0xFBC0,0x9990,0x0000, 0xFBC0,0x9991,0x0000, 0xFBC0,0x9992,0x0000, +0xFBC0,0x9993,0x0000, 0xFBC0,0x9994,0x0000, 0xFBC0,0x9995,0x0000, +0xFBC0,0x9996,0x0000, 0xFBC0,0x9997,0x0000, 0xFBC0,0x9998,0x0000, +0xFBC0,0x9999,0x0000, 0xFBC0,0x999A,0x0000, 0xFBC0,0x999B,0x0000, +0xFBC0,0x999C,0x0000, 0xFBC0,0x999D,0x0000, 0xFBC0,0x999E,0x0000, +0xFBC0,0x999F,0x0000, 0xFBC0,0x99A0,0x0000, 0xFBC0,0x99A1,0x0000, +0xFBC0,0x99A2,0x0000, 0xFBC0,0x99A3,0x0000, 0xFBC0,0x99A4,0x0000, +0xFBC0,0x99A5,0x0000, 0xFBC0,0x99A6,0x0000, 0xFBC0,0x99A7,0x0000, +0xFBC0,0x99A8,0x0000, 0xFBC0,0x99A9,0x0000, 0xFBC0,0x99AA,0x0000, +0xFBC0,0x99AB,0x0000, 0xFBC0,0x99AC,0x0000, 0xFBC0,0x99AD,0x0000, +0xFBC0,0x99AE,0x0000, 0xFBC0,0x99AF,0x0000, 0xFBC0,0x99B0,0x0000, +0xFBC0,0x99B1,0x0000, 0xFBC0,0x99B2,0x0000, 0xFBC0,0x99B3,0x0000, +0xFBC0,0x99B4,0x0000, 0xFBC0,0x99B5,0x0000, 0xFBC0,0x99B6,0x0000, +0xFBC0,0x99B7,0x0000, 0xFBC0,0x99B8,0x0000, 0xFBC0,0x99B9,0x0000, +0xFBC0,0x99BA,0x0000, 0xFBC0,0x99BB,0x0000, 0xFBC0,0x99BC,0x0000, +0xFBC0,0x99BD,0x0000, 0xFBC0,0x99BE,0x0000, 0xFBC0,0x99BF,0x0000, +0xFBC0,0x99C0,0x0000, 0xFBC0,0x99C1,0x0000, 0xFBC0,0x99C2,0x0000, +0xFBC0,0x99C3,0x0000, 0xFBC0,0x99C4,0x0000, 0xFBC0,0x99C5,0x0000, +0xFBC0,0x99C6,0x0000, 0xFBC0,0x99C7,0x0000, 0xFBC0,0x99C8,0x0000, +0xFBC0,0x99C9,0x0000, 0xFBC0,0x99CA,0x0000, 0xFBC0,0x99CB,0x0000, +0xFBC0,0x99CC,0x0000, 0xFBC0,0x99CD,0x0000, 0xFBC0,0x99CE,0x0000, +0xFBC0,0x99CF,0x0000, 0xFBC0,0x99D0,0x0000, 0xFBC0,0x99D1,0x0000, +0xFBC0,0x99D2,0x0000, 0xFBC0,0x99D3,0x0000, 0xFBC0,0x99D4,0x0000, +0xFBC0,0x99D5,0x0000, 0xFBC0,0x99D6,0x0000, 0xFBC0,0x99D7,0x0000, +0xFBC0,0x99D8,0x0000, 0xFBC0,0x99D9,0x0000, 0xFBC0,0x99DA,0x0000, +0xFBC0,0x99DB,0x0000, 0xFBC0,0x99DC,0x0000, 0xFBC0,0x99DD,0x0000, +0xFBC0,0x99DE,0x0000, 0xFBC0,0x99DF,0x0000, 0x037B,0x0000,0x0000, +0x037C,0x0000,0x0000, 0x037D,0x0000,0x0000, 0x037E,0x0000,0x0000, +0x037F,0x0000,0x0000, 0x0380,0x0000,0x0000, 0x0381,0x0000,0x0000, +0x0382,0x0000,0x0000, 0x0383,0x0000,0x0000, 0x0384,0x0000,0x0000, +0x0385,0x0000,0x0000, 0x0386,0x0000,0x0000, 0x0387,0x0000,0x0000, +0x0388,0x0000,0x0000, 0x0389,0x0000,0x0000, 0x038A,0x0000,0x0000, +0x038B,0x0000,0x0000, 0x038C,0x0000,0x0000, 0x038D,0x0000,0x0000, +0x038E,0x0000,0x0000, 0x038F,0x0000,0x0000, 0x0390,0x0000,0x0000, +0x0391,0x0000,0x0000, 0x0392,0x0000,0x0000, 0x0393,0x0000,0x0000, +0x0394,0x0000,0x0000, 0x0395,0x0000,0x0000, 0x0396,0x0000,0x0000, +0x0397,0x0000,0x0000, 0x0398,0x0000,0x0000, 0x0399,0x0000,0x0000, +0x039A,0x0000,0x0000 }; + +uint16 page01Ddata[]= { /* 1D00 (3 weights per char) */ +0x0E37,0x0000,0x0000, 0x0E3C,0x0000,0x0000, 0x0E3D,0x0000,0x0000, +0x0E57,0x0000,0x0000, 0x0E64,0x0000,0x0000, 0x0E71,0x0000,0x0000, +0x0E8A,0x0000,0x0000, 0x0E8F,0x0000,0x0000, 0x0EA8,0x0000,0x0000, +0x0F07,0x0000,0x0000, 0x0F14,0x0000,0x0000, 0x0F25,0x0000,0x0000, +0x0F3A,0x0000,0x0000, 0x0F5F,0x0000,0x0000, 0x0F6D,0x0000,0x0000, +0x0F86,0x0000,0x0000, 0x0F96,0x0000,0x0000, 0x0F87,0x0000,0x0000, +0x0F97,0x0000,0x0000, 0x0F91,0x0000,0x0000, 0x0F8C,0x0000,0x0000, +0x0FA6,0x0000,0x0000, 0x0F98,0x0000,0x0000, 0x0F99,0x0000,0x0000, +0x0FAB,0x0000,0x0000, 0x0FC8,0x0000,0x0000, 0x0FCD,0x0000,0x0000, +0x1006,0x0000,0x0000, 0x1023,0x0000,0x0000, 0x1024,0x0000,0x0000, +0x1025,0x0000,0x0000, 0x103B,0x0000,0x0000, 0x1048,0x0000,0x0000, +0x1055,0x0000,0x0000, 0x106E,0x0000,0x0000, 0x1083,0x0000,0x0000, +0x10BA,0x0000,0x0000, 0x10BB,0x0000,0x0000, 0x10EB,0x0000,0x0000, +0x10F7,0x0000,0x0000, 0x10FD,0x0000,0x0000, 0x1101,0x0000,0x0000, +0x1108,0x0000,0x0000, 0x11B4,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E38,0x0000,0x0000, 0x0E4A,0x0000,0x0000, 0x0E56,0x0000,0x0000, +0x0E6D,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E90,0x0000,0x0000, +0x0EC1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0F10,0x0000,0x0000, 0x0F21,0x0000,0x0000, 0x0F2E,0x0000,0x0000, +0x0F5B,0x0000,0x0000, 0x0F64,0x0000,0x0000, 0x0F6C,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0FA2,0x0000,0x0000, 0x0FA7,0x0000,0x0000, +0x0FC0,0x0000,0x0000, 0x1002,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x1051,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E3E,0x0000,0x0000, +0x0E42,0x0000,0x0000, 0x0E3D,0x0000,0x0000, 0x0E4A,0x0000,0x0000, +0x0E6D,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E94,0x0000,0x0000, +0x0E98,0x0000,0x0000, 0x0EA8,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0F07,0x0000,0x0000, 0x0F21,0x0000,0x0000, 0x0F5B,0x0000,0x0000, +0x0F7E,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F92,0x0000,0x0000, +0x0F98,0x0000,0x0000, 0x0F99,0x0000,0x0000, 0x0FA7,0x0000,0x0000, +0x1002,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x1024,0x0000,0x0000, +0x1037,0x0000,0x0000, 0x1044,0x0000,0x0000, 0x10BB,0x0000,0x0000, +0x10E9,0x0000,0x0000, 0x10EA,0x0000,0x0000, 0x10EC,0x0000,0x0000, +0x1105,0x0000,0x0000, 0x1106,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0FC0,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x1044,0x0000,0x0000, +0x10E9,0x0000,0x0000, 0x10EA,0x0000,0x0000, 0x1100,0x0000,0x0000, +0x1105,0x0000,0x0000, 0x1106,0x0000,0x0000, 0x1026,0x0000,0x0000, +0xFBC0,0x9D6C,0x0000, 0xFBC0,0x9D6D,0x0000, 0xFBC0,0x9D6E,0x0000, +0xFBC0,0x9D6F,0x0000, 0xFBC0,0x9D70,0x0000, 0xFBC0,0x9D71,0x0000, +0xFBC0,0x9D72,0x0000, 0xFBC0,0x9D73,0x0000, 0xFBC0,0x9D74,0x0000, +0xFBC0,0x9D75,0x0000, 0xFBC0,0x9D76,0x0000, 0xFBC0,0x9D77,0x0000, +0xFBC0,0x9D78,0x0000, 0xFBC0,0x9D79,0x0000, 0xFBC0,0x9D7A,0x0000, +0xFBC0,0x9D7B,0x0000, 0xFBC0,0x9D7C,0x0000, 0xFBC0,0x9D7D,0x0000, +0xFBC0,0x9D7E,0x0000, 0xFBC0,0x9D7F,0x0000, 0xFBC0,0x9D80,0x0000, +0xFBC0,0x9D81,0x0000, 0xFBC0,0x9D82,0x0000, 0xFBC0,0x9D83,0x0000, +0xFBC0,0x9D84,0x0000, 0xFBC0,0x9D85,0x0000, 0xFBC0,0x9D86,0x0000, +0xFBC0,0x9D87,0x0000, 0xFBC0,0x9D88,0x0000, 0xFBC0,0x9D89,0x0000, +0xFBC0,0x9D8A,0x0000, 0xFBC0,0x9D8B,0x0000, 0xFBC0,0x9D8C,0x0000, +0xFBC0,0x9D8D,0x0000, 0xFBC0,0x9D8E,0x0000, 0xFBC0,0x9D8F,0x0000, +0xFBC0,0x9D90,0x0000, 0xFBC0,0x9D91,0x0000, 0xFBC0,0x9D92,0x0000, +0xFBC0,0x9D93,0x0000, 0xFBC0,0x9D94,0x0000, 0xFBC0,0x9D95,0x0000, +0xFBC0,0x9D96,0x0000, 0xFBC0,0x9D97,0x0000, 0xFBC0,0x9D98,0x0000, +0xFBC0,0x9D99,0x0000, 0xFBC0,0x9D9A,0x0000, 0xFBC0,0x9D9B,0x0000, +0xFBC0,0x9D9C,0x0000, 0xFBC0,0x9D9D,0x0000, 0xFBC0,0x9D9E,0x0000, +0xFBC0,0x9D9F,0x0000, 0xFBC0,0x9DA0,0x0000, 0xFBC0,0x9DA1,0x0000, +0xFBC0,0x9DA2,0x0000, 0xFBC0,0x9DA3,0x0000, 0xFBC0,0x9DA4,0x0000, +0xFBC0,0x9DA5,0x0000, 0xFBC0,0x9DA6,0x0000, 0xFBC0,0x9DA7,0x0000, +0xFBC0,0x9DA8,0x0000, 0xFBC0,0x9DA9,0x0000, 0xFBC0,0x9DAA,0x0000, +0xFBC0,0x9DAB,0x0000, 0xFBC0,0x9DAC,0x0000, 0xFBC0,0x9DAD,0x0000, +0xFBC0,0x9DAE,0x0000, 0xFBC0,0x9DAF,0x0000, 0xFBC0,0x9DB0,0x0000, +0xFBC0,0x9DB1,0x0000, 0xFBC0,0x9DB2,0x0000, 0xFBC0,0x9DB3,0x0000, +0xFBC0,0x9DB4,0x0000, 0xFBC0,0x9DB5,0x0000, 0xFBC0,0x9DB6,0x0000, +0xFBC0,0x9DB7,0x0000, 0xFBC0,0x9DB8,0x0000, 0xFBC0,0x9DB9,0x0000, +0xFBC0,0x9DBA,0x0000, 0xFBC0,0x9DBB,0x0000, 0xFBC0,0x9DBC,0x0000, +0xFBC0,0x9DBD,0x0000, 0xFBC0,0x9DBE,0x0000, 0xFBC0,0x9DBF,0x0000, +0xFBC0,0x9DC0,0x0000, 0xFBC0,0x9DC1,0x0000, 0xFBC0,0x9DC2,0x0000, +0xFBC0,0x9DC3,0x0000, 0xFBC0,0x9DC4,0x0000, 0xFBC0,0x9DC5,0x0000, +0xFBC0,0x9DC6,0x0000, 0xFBC0,0x9DC7,0x0000, 0xFBC0,0x9DC8,0x0000, +0xFBC0,0x9DC9,0x0000, 0xFBC0,0x9DCA,0x0000, 0xFBC0,0x9DCB,0x0000, +0xFBC0,0x9DCC,0x0000, 0xFBC0,0x9DCD,0x0000, 0xFBC0,0x9DCE,0x0000, +0xFBC0,0x9DCF,0x0000, 0xFBC0,0x9DD0,0x0000, 0xFBC0,0x9DD1,0x0000, +0xFBC0,0x9DD2,0x0000, 0xFBC0,0x9DD3,0x0000, 0xFBC0,0x9DD4,0x0000, +0xFBC0,0x9DD5,0x0000, 0xFBC0,0x9DD6,0x0000, 0xFBC0,0x9DD7,0x0000, +0xFBC0,0x9DD8,0x0000, 0xFBC0,0x9DD9,0x0000, 0xFBC0,0x9DDA,0x0000, +0xFBC0,0x9DDB,0x0000, 0xFBC0,0x9DDC,0x0000, 0xFBC0,0x9DDD,0x0000, +0xFBC0,0x9DDE,0x0000, 0xFBC0,0x9DDF,0x0000, 0xFBC0,0x9DE0,0x0000, +0xFBC0,0x9DE1,0x0000, 0xFBC0,0x9DE2,0x0000, 0xFBC0,0x9DE3,0x0000, +0xFBC0,0x9DE4,0x0000, 0xFBC0,0x9DE5,0x0000, 0xFBC0,0x9DE6,0x0000, +0xFBC0,0x9DE7,0x0000, 0xFBC0,0x9DE8,0x0000, 0xFBC0,0x9DE9,0x0000, +0xFBC0,0x9DEA,0x0000, 0xFBC0,0x9DEB,0x0000, 0xFBC0,0x9DEC,0x0000, +0xFBC0,0x9DED,0x0000, 0xFBC0,0x9DEE,0x0000, 0xFBC0,0x9DEF,0x0000, +0xFBC0,0x9DF0,0x0000, 0xFBC0,0x9DF1,0x0000, 0xFBC0,0x9DF2,0x0000, +0xFBC0,0x9DF3,0x0000, 0xFBC0,0x9DF4,0x0000, 0xFBC0,0x9DF5,0x0000, +0xFBC0,0x9DF6,0x0000, 0xFBC0,0x9DF7,0x0000, 0xFBC0,0x9DF8,0x0000, +0xFBC0,0x9DF9,0x0000, 0xFBC0,0x9DFA,0x0000, 0xFBC0,0x9DFB,0x0000, +0xFBC0,0x9DFC,0x0000, 0xFBC0,0x9DFD,0x0000, 0xFBC0,0x9DFE,0x0000, +0xFBC0,0x9DFF,0x0000 }; + +uint16 page01Edata[]= { /* 1E00 (3 weights per char) */ +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E4A,0x0000,0x0000, +0x0E4A,0x0000,0x0000, 0x0E4A,0x0000,0x0000, 0x0E4A,0x0000,0x0000, +0x0E4A,0x0000,0x0000, 0x0E4A,0x0000,0x0000, 0x0E60,0x0000,0x0000, +0x0E60,0x0000,0x0000, 0x0E6D,0x0000,0x0000, 0x0E6D,0x0000,0x0000, +0x0E6D,0x0000,0x0000, 0x0E6D,0x0000,0x0000, 0x0E6D,0x0000,0x0000, +0x0E6D,0x0000,0x0000, 0x0E6D,0x0000,0x0000, 0x0E6D,0x0000,0x0000, +0x0E6D,0x0000,0x0000, 0x0E6D,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0EB9,0x0000,0x0000, 0x0EB9,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0EC1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, +0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, +0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, +0x0EE1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0F21,0x0000,0x0000, 0x0F21,0x0000,0x0000, 0x0F21,0x0000,0x0000, +0x0F21,0x0000,0x0000, 0x0F21,0x0000,0x0000, 0x0F21,0x0000,0x0000, +0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, +0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, +0x0F2E,0x0000,0x0000, 0x0F2E,0x0000,0x0000, 0x0F5B,0x0000,0x0000, +0x0F5B,0x0000,0x0000, 0x0F5B,0x0000,0x0000, 0x0F5B,0x0000,0x0000, +0x0F5B,0x0000,0x0000, 0x0F5B,0x0000,0x0000, 0x0F64,0x0000,0x0000, +0x0F64,0x0000,0x0000, 0x0F64,0x0000,0x0000, 0x0F64,0x0000,0x0000, +0x0F64,0x0000,0x0000, 0x0F64,0x0000,0x0000, 0x0F64,0x0000,0x0000, +0x0F64,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0FA7,0x0000,0x0000, 0x0FA7,0x0000,0x0000, 0x0FA7,0x0000,0x0000, +0x0FA7,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, 0x0FEA,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x1002,0x0000,0x0000, 0x1002,0x0000,0x0000, +0x1002,0x0000,0x0000, 0x1002,0x0000,0x0000, 0x1002,0x0000,0x0000, +0x1002,0x0000,0x0000, 0x1002,0x0000,0x0000, 0x1002,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x1044,0x0000,0x0000, 0x1044,0x0000,0x0000, +0x1044,0x0000,0x0000, 0x1044,0x0000,0x0000, 0x1051,0x0000,0x0000, +0x1051,0x0000,0x0000, 0x1051,0x0000,0x0000, 0x1051,0x0000,0x0000, +0x1051,0x0000,0x0000, 0x1051,0x0000,0x0000, 0x1051,0x0000,0x0000, +0x1051,0x0000,0x0000, 0x1051,0x0000,0x0000, 0x1051,0x0000,0x0000, +0x105A,0x0000,0x0000, 0x105A,0x0000,0x0000, 0x105A,0x0000,0x0000, +0x105A,0x0000,0x0000, 0x105E,0x0000,0x0000, 0x105E,0x0000,0x0000, +0x106A,0x0000,0x0000, 0x106A,0x0000,0x0000, 0x106A,0x0000,0x0000, +0x106A,0x0000,0x0000, 0x106A,0x0000,0x0000, 0x106A,0x0000,0x0000, +0x0EE1,0x0000,0x0000, 0x1002,0x0000,0x0000, 0x1051,0x0000,0x0000, +0x105E,0x0000,0x0000, 0x0E33,0x10B3,0x0000, 0x0FEA,0x0000,0x0000, +0xFBC0,0x9E9C,0x0000, 0xFBC0,0x9E9D,0x0000, 0xFBC0,0x9E9E,0x0000, +0xFBC0,0x9E9F,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x101F,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x105E,0x0000,0x0000, +0x105E,0x0000,0x0000, 0x105E,0x0000,0x0000, 0x105E,0x0000,0x0000, +0x105E,0x0000,0x0000, 0x105E,0x0000,0x0000, 0x105E,0x0000,0x0000, +0x105E,0x0000,0x0000, 0xFBC0,0x9EFA,0x0000, 0xFBC0,0x9EFB,0x0000, +0xFBC0,0x9EFC,0x0000, 0xFBC0,0x9EFD,0x0000, 0xFBC0,0x9EFE,0x0000, +0xFBC0,0x9EFF,0x0000 }; + +uint16 page01Fdata[]= { /* 1F00 (3 weights per char) */ +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, +0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, +0x10ED,0x0000,0x0000, 0xFBC0,0x9F16,0x0000, 0xFBC0,0x9F17,0x0000, +0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, +0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, +0xFBC0,0x9F1E,0x0000, 0xFBC0,0x9F1F,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, +0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, +0x10FB,0x0000,0x0000, 0xFBC0,0x9F46,0x0000, 0xFBC0,0x9F47,0x0000, +0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, +0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, +0xFBC0,0x9F4E,0x0000, 0xFBC0,0x9F4F,0x0000, 0x1104,0x0000,0x0000, +0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, +0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, +0x1104,0x0000,0x0000, 0xFBC0,0x9F58,0x0000, 0x1104,0x0000,0x0000, +0xFBC0,0x9F5A,0x0000, 0x1104,0x0000,0x0000, 0xFBC0,0x9F5C,0x0000, +0x1104,0x0000,0x0000, 0xFBC0,0x9F5E,0x0000, 0x1104,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10ED,0x0000,0x0000, 0x10ED,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10FB,0x0000,0x0000, 0x10FB,0x0000,0x0000, 0x1104,0x0000,0x0000, +0x1104,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0xFBC0,0x9F7E,0x0000, 0xFBC0,0x9F7F,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0xFBC0,0x9FB5,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, 0x10E8,0x0000,0x0000, +0x0217,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x0217,0x0000,0x0000, +0x021D,0x0000,0x0000, 0x0214,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0xFBC0,0x9FC5,0x0000, +0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10ED,0x0000,0x0000, +0x10ED,0x0000,0x0000, 0x10F1,0x0000,0x0000, 0x10F1,0x0000,0x0000, +0x10F1,0x0000,0x0000, 0x0217,0x0000,0x0000, 0x0217,0x0000,0x0000, +0x0217,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0xFBC0,0x9FD4,0x0000, +0xFBC0,0x9FD5,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, 0x10F3,0x0000,0x0000, +0x10F3,0x0000,0x0000, 0xFBC0,0x9FDC,0x0000, 0x0218,0x0000,0x0000, +0x0218,0x0000,0x0000, 0x0218,0x0000,0x0000, 0x1104,0x0000,0x0000, +0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, +0x1100,0x0000,0x0000, 0x1100,0x0000,0x0000, 0x1104,0x0000,0x0000, +0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, +0x1104,0x0000,0x0000, 0x1104,0x0000,0x0000, 0x1100,0x0000,0x0000, +0x0214,0x0000,0x0000, 0x0214,0x0000,0x0000, 0x020C,0x0000,0x0000, +0xFBC0,0x9FF0,0x0000, 0xFBC0,0x9FF1,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0xFBC0,0x9FF5,0x0000, +0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x10FB,0x0000,0x0000, +0x10FB,0x0000,0x0000, 0x1109,0x0000,0x0000, 0x1109,0x0000,0x0000, +0x1109,0x0000,0x0000, 0x020D,0x0000,0x0000, 0x0218,0x0000,0x0000, +0xFBC0,0x9FFF,0x0000 }; + +uint16 page020data[]= { /* 2000 (5 weights per char) */ +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0225,0x0000,0x0000,0x0000,0x0000, +0x0225,0x0000,0x0000,0x0000,0x0000, +0x0226,0x0000,0x0000,0x0000,0x0000, +0x0227,0x0000,0x0000,0x0000,0x0000, +0x0228,0x0000,0x0000,0x0000,0x0000, +0x0229,0x0000,0x0000,0x0000,0x0000, +0x0432,0x0000,0x0000,0x0000,0x0000, +0x021C,0x0000,0x0000,0x0000,0x0000, +0x0278,0x0000,0x0000,0x0000,0x0000, +0x0279,0x0000,0x0000,0x0000,0x0000, +0x027A,0x0000,0x0000,0x0000,0x0000, +0x027B,0x0000,0x0000,0x0000,0x0000, +0x027F,0x0000,0x0000,0x0000,0x0000, +0x0280,0x0000,0x0000,0x0000,0x0000, +0x0281,0x0000,0x0000,0x0000,0x0000, +0x0282,0x0000,0x0000,0x0000,0x0000, +0x02D8,0x0000,0x0000,0x0000,0x0000, +0x02D9,0x0000,0x0000,0x0000,0x0000, +0x02DA,0x0000,0x0000,0x0000,0x0000, +0x02DB,0x0000,0x0000,0x0000,0x0000, +0x025D,0x0000,0x0000,0x0000,0x0000, +0x025D,0x025D,0x0000,0x0000,0x0000, +0x025D,0x025D,0x025D,0x0000,0x0000, +0x02DC,0x0000,0x0000,0x0000,0x0000, +0x0207,0x0000,0x0000,0x0000,0x0000, +0x0208,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x02D5,0x0000,0x0000,0x0000,0x0000, +0x02D6,0x0000,0x0000,0x0000,0x0000, +0x02E0,0x0000,0x0000,0x0000,0x0000, +0x02E0,0x02E0,0x0000,0x0000,0x0000, +0x02E0,0x02E0,0x02E0,0x0000,0x0000, +0x02E1,0x0000,0x0000,0x0000,0x0000, +0x02E1,0x02E1,0x0000,0x0000,0x0000, +0x02E1,0x02E1,0x02E1,0x0000,0x0000, +0x02E4,0x0000,0x0000,0x0000,0x0000, +0x027C,0x0000,0x0000,0x0000,0x0000, +0x027D,0x0000,0x0000,0x0000,0x0000, +0x02E5,0x0000,0x0000,0x0000,0x0000, +0x0251,0x0251,0x0000,0x0000,0x0000, +0x025C,0x0000,0x0000,0x0000,0x0000, +0x0211,0x0000,0x0000,0x0000,0x0000, +0x02E6,0x0000,0x0000,0x0000,0x0000, +0x02E8,0x0000,0x0000,0x0000,0x0000, +0x02EA,0x0000,0x0000,0x0000,0x0000, +0x02EB,0x0000,0x0000,0x0000,0x0000, +0x02DD,0x0000,0x0000,0x0000,0x0000, +0x02CD,0x0000,0x0000,0x0000,0x0000, +0x0294,0x0000,0x0000,0x0000,0x0000, +0x0295,0x0000,0x0000,0x0000,0x0000, +0x0255,0x0255,0x0000,0x0000,0x0000, +0x0255,0x0251,0x0000,0x0000,0x0000, +0x0251,0x0255,0x0000,0x0000,0x0000, +0x02D1,0x0000,0x0000,0x0000,0x0000, +0x02C4,0x0000,0x0000,0x0000,0x0000, +0x02DE,0x0000,0x0000,0x0000,0x0000, +0x02DF,0x0000,0x0000,0x0000,0x0000, +0x02C9,0x0000,0x0000,0x0000,0x0000, +0x023C,0x0000,0x0000,0x0000,0x0000, +0x02E9,0x0000,0x0000,0x0000,0x0000, +0x02CA,0x0000,0x0000,0x0000,0x0000, +0x02D7,0x0000,0x0000,0x0000,0x0000, +0x022A,0x0000,0x0000,0x0000,0x0000, +0x02E7,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA055,0x0000,0x0000,0x0000, +0xFBC0,0xA056,0x0000,0x0000,0x0000, +0x02E0,0x02E0,0x02E0,0x02E0,0x0000, +0xFBC0,0xA058,0x0000,0x0000,0x0000, +0xFBC0,0xA059,0x0000,0x0000,0x0000, +0xFBC0,0xA05A,0x0000,0x0000,0x0000, +0xFBC0,0xA05B,0x0000,0x0000,0x0000, +0xFBC0,0xA05C,0x0000,0x0000,0x0000, +0xFBC0,0xA05D,0x0000,0x0000,0x0000, +0xFBC0,0xA05E,0x0000,0x0000,0x0000, +0x0209,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA064,0x0000,0x0000,0x0000, +0xFBC0,0xA065,0x0000,0x0000,0x0000, +0xFBC0,0xA066,0x0000,0x0000,0x0000, +0xFBC0,0xA067,0x0000,0x0000,0x0000, +0xFBC0,0xA068,0x0000,0x0000,0x0000, +0xFBC0,0xA069,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E29,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA072,0x0000,0x0000,0x0000, +0xFBC0,0xA073,0x0000,0x0000,0x0000, +0x0E2D,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0x0000,0x0000,0x0000,0x0000, +0x0E2F,0x0000,0x0000,0x0000,0x0000, +0x0E30,0x0000,0x0000,0x0000,0x0000, +0x0E31,0x0000,0x0000,0x0000,0x0000, +0x0E32,0x0000,0x0000,0x0000,0x0000, +0x0428,0x0000,0x0000,0x0000,0x0000, +0x0434,0x0000,0x0000,0x0000,0x0000, +0x042D,0x0000,0x0000,0x0000,0x0000, +0x0288,0x0000,0x0000,0x0000,0x0000, +0x0289,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0000,0x0000,0x0000,0x0000, +0x0E29,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0x0000,0x0000,0x0000,0x0000, +0x0E2F,0x0000,0x0000,0x0000,0x0000, +0x0E30,0x0000,0x0000,0x0000,0x0000, +0x0E31,0x0000,0x0000,0x0000,0x0000, +0x0E32,0x0000,0x0000,0x0000,0x0000, +0x0428,0x0000,0x0000,0x0000,0x0000, +0x0434,0x0000,0x0000,0x0000,0x0000, +0x042D,0x0000,0x0000,0x0000,0x0000, +0x0288,0x0000,0x0000,0x0000,0x0000, +0x0289,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA08F,0x0000,0x0000,0x0000, +0xFBC0,0xA090,0x0000,0x0000,0x0000, +0xFBC0,0xA091,0x0000,0x0000,0x0000, +0xFBC0,0xA092,0x0000,0x0000,0x0000, +0xFBC0,0xA093,0x0000,0x0000,0x0000, +0xFBC0,0xA094,0x0000,0x0000,0x0000, +0xFBC0,0xA095,0x0000,0x0000,0x0000, +0xFBC0,0xA096,0x0000,0x0000,0x0000, +0xFBC0,0xA097,0x0000,0x0000,0x0000, +0xFBC0,0xA098,0x0000,0x0000,0x0000, +0xFBC0,0xA099,0x0000,0x0000,0x0000, +0xFBC0,0xA09A,0x0000,0x0000,0x0000, +0xFBC0,0xA09B,0x0000,0x0000,0x0000, +0xFBC0,0xA09C,0x0000,0x0000,0x0000, +0xFBC0,0xA09D,0x0000,0x0000,0x0000, +0xFBC0,0xA09E,0x0000,0x0000,0x0000, +0xFBC0,0xA09F,0x0000,0x0000,0x0000, +0x0E18,0x0000,0x0000,0x0000,0x0000, +0x0E19,0x0000,0x0000,0x0000,0x0000, +0x0E1A,0x0000,0x0000,0x0000,0x0000, +0x0E1B,0x0000,0x0000,0x0000,0x0000, +0x0E1C,0x0000,0x0000,0x0000,0x0000, +0x0E1D,0x0000,0x0000,0x0000,0x0000, +0x0E1E,0x0000,0x0000,0x0000,0x0000, +0x0E1F,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0FEA,0x0000,0x0000,0x0000, +0x0E20,0x0000,0x0000,0x0000,0x0000, +0x0E21,0x0000,0x0000,0x0000,0x0000, +0x0E22,0x0000,0x0000,0x0000,0x0000, +0x0E23,0x0000,0x0000,0x0000,0x0000, +0x0E24,0x0000,0x0000,0x0000,0x0000, +0x0E25,0x0000,0x0000,0x0000,0x0000, +0x0E26,0x0000,0x0000,0x0000,0x0000, +0x0E27,0x0000,0x0000,0x0000,0x0000, +0x0E28,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA0B2,0x0000,0x0000,0x0000, +0xFBC0,0xA0B3,0x0000,0x0000,0x0000, +0xFBC0,0xA0B4,0x0000,0x0000,0x0000, +0xFBC0,0xA0B5,0x0000,0x0000,0x0000, +0xFBC0,0xA0B6,0x0000,0x0000,0x0000, +0xFBC0,0xA0B7,0x0000,0x0000,0x0000, +0xFBC0,0xA0B8,0x0000,0x0000,0x0000, +0xFBC0,0xA0B9,0x0000,0x0000,0x0000, +0xFBC0,0xA0BA,0x0000,0x0000,0x0000, +0xFBC0,0xA0BB,0x0000,0x0000,0x0000, +0xFBC0,0xA0BC,0x0000,0x0000,0x0000, +0xFBC0,0xA0BD,0x0000,0x0000,0x0000, +0xFBC0,0xA0BE,0x0000,0x0000,0x0000, +0xFBC0,0xA0BF,0x0000,0x0000,0x0000, +0xFBC0,0xA0C0,0x0000,0x0000,0x0000, +0xFBC0,0xA0C1,0x0000,0x0000,0x0000, +0xFBC0,0xA0C2,0x0000,0x0000,0x0000, +0xFBC0,0xA0C3,0x0000,0x0000,0x0000, +0xFBC0,0xA0C4,0x0000,0x0000,0x0000, +0xFBC0,0xA0C5,0x0000,0x0000,0x0000, +0xFBC0,0xA0C6,0x0000,0x0000,0x0000, +0xFBC0,0xA0C7,0x0000,0x0000,0x0000, +0xFBC0,0xA0C8,0x0000,0x0000,0x0000, +0xFBC0,0xA0C9,0x0000,0x0000,0x0000, +0xFBC0,0xA0CA,0x0000,0x0000,0x0000, +0xFBC0,0xA0CB,0x0000,0x0000,0x0000, +0xFBC0,0xA0CC,0x0000,0x0000,0x0000, +0xFBC0,0xA0CD,0x0000,0x0000,0x0000, +0xFBC0,0xA0CE,0x0000,0x0000,0x0000, +0xFBC0,0xA0CF,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA0EB,0x0000,0x0000,0x0000, +0xFBC0,0xA0EC,0x0000,0x0000,0x0000, +0xFBC0,0xA0ED,0x0000,0x0000,0x0000, +0xFBC0,0xA0EE,0x0000,0x0000,0x0000, +0xFBC0,0xA0EF,0x0000,0x0000,0x0000, +0xFBC0,0xA0F0,0x0000,0x0000,0x0000, +0xFBC0,0xA0F1,0x0000,0x0000,0x0000, +0xFBC0,0xA0F2,0x0000,0x0000,0x0000, +0xFBC0,0xA0F3,0x0000,0x0000,0x0000, +0xFBC0,0xA0F4,0x0000,0x0000,0x0000, +0xFBC0,0xA0F5,0x0000,0x0000,0x0000, +0xFBC0,0xA0F6,0x0000,0x0000,0x0000, +0xFBC0,0xA0F7,0x0000,0x0000,0x0000, +0xFBC0,0xA0F8,0x0000,0x0000,0x0000, +0xFBC0,0xA0F9,0x0000,0x0000,0x0000, +0xFBC0,0xA0FA,0x0000,0x0000,0x0000, +0xFBC0,0xA0FB,0x0000,0x0000,0x0000, +0xFBC0,0xA0FC,0x0000,0x0000,0x0000, +0xFBC0,0xA0FD,0x0000,0x0000,0x0000, +0xFBC0,0xA0FE,0x0000,0x0000,0x0000, +0xFBC0,0xA0FF,0x0000,0x0000,0x0000 +}; + +uint16 page021data[]= { /* 2100 (5 weights per char) */ +0x0E33,0x02CC,0x0E60,0x0000,0x0000, +0x0E33,0x02CC,0x0FEA,0x0000,0x0000, +0x0E60,0x0000,0x0000,0x0000,0x0000, +0x034A,0x0E60,0x0000,0x0000,0x0000, +0x039B,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x02CC,0x0F82,0x0000,0x0000, +0x0E60,0x02CC,0x101F,0x0000,0x0000, +0x0E98,0x0000,0x0000,0x0000,0x0000, +0x039C,0x0000,0x0000,0x0000,0x0000, +0x034A,0x0EB9,0x0000,0x0000,0x0000, +0x0EC1,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000,0x0000, +0x0EED,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000,0x0000, +0x039D,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0F82,0x0000,0x0000,0x0000, +0x039E,0x0000,0x0000,0x0000,0x0000, +0x039F,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0000,0x0000,0x0000,0x0000, +0x0FB4,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000,0x0000, +0x03A0,0x0000,0x0000,0x0000,0x0000, +0x03A1,0x0000,0x0000,0x0000,0x0000, +0x0FEA,0x0F5B,0x0000,0x0000,0x0000, +0x1002,0x0E8B,0x0F2E,0x0000,0x0000, +0x1002,0x0F5B,0x0000,0x0000,0x0000, +0x03A2,0x0000,0x0000,0x0000,0x0000, +0x106A,0x0000,0x0000,0x0000,0x0000, +0x03A3,0x0000,0x0000,0x0000,0x0000, +0x1109,0x0000,0x0000,0x0000,0x0000, +0x03A4,0x0000,0x0000,0x0000,0x0000, +0x106A,0x0000,0x0000,0x0000,0x0000, +0x03A5,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0000,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000,0x0000, +0x0E4A,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0000,0x0000,0x0000,0x0000, +0x03A6,0x0000,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000,0x0000, +0x0EB9,0x0000,0x0000,0x0000,0x0000, +0x03A7,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0000,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000,0x0000, +0x1331,0x0000,0x0000,0x0000,0x0000, +0x1332,0x0000,0x0000,0x0000,0x0000, +0x1333,0x0000,0x0000,0x0000,0x0000, +0x1334,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x03A8,0x0000,0x0000,0x0000,0x0000, +0x0EB9,0x0E33,0x105A,0x0000,0x0000, +0xFBC0,0xA13C,0x0000,0x0000,0x0000, +0x10EA,0x0000,0x0000,0x0000,0x0000, +0x10EA,0x0000,0x0000,0x0000,0x0000, +0x10FC,0x0000,0x0000,0x0000,0x0000, +0x0427,0x0000,0x0000,0x0000,0x0000, +0x03A9,0x0000,0x0000,0x0000,0x0000, +0x03AA,0x0000,0x0000,0x0000,0x0000, +0x03AB,0x0000,0x0000,0x0000,0x0000, +0x03AC,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x0F10,0x0000,0x0000,0x0000,0x0000, +0x03AD,0x0000,0x0000,0x0000,0x0000, +0x02D0,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA14C,0x0000,0x0000,0x0000, +0xFBC0,0xA14D,0x0000,0x0000,0x0000, +0xFBC0,0xA14E,0x0000,0x0000,0x0000, +0xFBC0,0xA14F,0x0000,0x0000,0x0000, +0xFBC0,0xA150,0x0000,0x0000,0x0000, +0xFBC0,0xA151,0x0000,0x0000,0x0000, +0xFBC0,0xA152,0x0000,0x0000,0x0000, +0x0E2A,0x02CD,0x0E2C,0x0000,0x0000, +0x0E2B,0x02CD,0x0E2C,0x0000,0x0000, +0x0E2A,0x02CD,0x0E2E,0x0000,0x0000, +0x0E2B,0x02CD,0x0E2E,0x0000,0x0000, +0x0E2C,0x02CD,0x0E2E,0x0000,0x0000, +0x0E2D,0x02CD,0x0E2E,0x0000,0x0000, +0x0E2A,0x02CD,0x0E2F,0x0000,0x0000, +0x0E2E,0x02CD,0x0E2F,0x0000,0x0000, +0x0E2A,0x02CD,0x0E31,0x0000,0x0000, +0x0E2C,0x02CD,0x0E31,0x0000,0x0000, +0x0E2E,0x02CD,0x0E31,0x0000,0x0000, +0x0E30,0x02CD,0x0E31,0x0000,0x0000, +0x0E2A,0x02CD,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0EFB,0x0000,0x0000,0x0000, +0x0EFB,0x0EFB,0x0EFB,0x0000,0x0000, +0x0EFB,0x1044,0x0000,0x0000,0x0000, +0x1044,0x0000,0x0000,0x0000,0x0000, +0x1044,0x0EFB,0x0000,0x0000,0x0000, +0x1044,0x0EFB,0x0EFB,0x0000,0x0000, +0x1044,0x0EFB,0x0EFB,0x0EFB,0x0000, +0x0EFB,0x105A,0x0000,0x0000,0x0000, +0x105A,0x0000,0x0000,0x0000,0x0000, +0x105A,0x0EFB,0x0000,0x0000,0x0000, +0x105A,0x0EFB,0x0EFB,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0EFB,0x0000,0x0000,0x0000, +0x0EFB,0x0EFB,0x0EFB,0x0000,0x0000, +0x0EFB,0x1044,0x0000,0x0000,0x0000, +0x1044,0x0000,0x0000,0x0000,0x0000, +0x1044,0x0EFB,0x0000,0x0000,0x0000, +0x1044,0x0EFB,0x0EFB,0x0000,0x0000, +0x1044,0x0EFB,0x0EFB,0x0EFB,0x0000, +0x0EFB,0x105A,0x0000,0x0000,0x0000, +0x105A,0x0000,0x0000,0x0000,0x0000, +0x105A,0x0EFB,0x0000,0x0000,0x0000, +0x105A,0x0EFB,0x0EFB,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0000,0x0000,0x0000,0x0000, +0x0DD7,0x0000,0x0000,0x0000,0x0000, +0x0DD8,0x0000,0x0000,0x0000,0x0000, +0x0DD9,0x0000,0x0000,0x0000,0x0000, +0x0DDA,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA184,0x0000,0x0000,0x0000, +0xFBC0,0xA185,0x0000,0x0000,0x0000, +0xFBC0,0xA186,0x0000,0x0000,0x0000, +0xFBC0,0xA187,0x0000,0x0000,0x0000, +0xFBC0,0xA188,0x0000,0x0000,0x0000, +0xFBC0,0xA189,0x0000,0x0000,0x0000, +0xFBC0,0xA18A,0x0000,0x0000,0x0000, +0xFBC0,0xA18B,0x0000,0x0000,0x0000, +0xFBC0,0xA18C,0x0000,0x0000,0x0000, +0xFBC0,0xA18D,0x0000,0x0000,0x0000, +0xFBC0,0xA18E,0x0000,0x0000,0x0000, +0xFBC0,0xA18F,0x0000,0x0000,0x0000, +0x03AE,0x0000,0x0000,0x0000,0x0000, +0x03B0,0x0000,0x0000,0x0000,0x0000, +0x03AF,0x0000,0x0000,0x0000,0x0000, +0x03B1,0x0000,0x0000,0x0000,0x0000, +0x03B2,0x0000,0x0000,0x0000,0x0000, +0x03B3,0x0000,0x0000,0x0000,0x0000, +0x03B4,0x0000,0x0000,0x0000,0x0000, +0x03B5,0x0000,0x0000,0x0000,0x0000, +0x03B6,0x0000,0x0000,0x0000,0x0000, +0x03B7,0x0000,0x0000,0x0000,0x0000, +0x03AE,0x0000,0x0000,0x0000,0x0000, +0x03AF,0x0000,0x0000,0x0000,0x0000, +0x03B8,0x0000,0x0000,0x0000,0x0000, +0x03B9,0x0000,0x0000,0x0000,0x0000, +0x03BA,0x0000,0x0000,0x0000,0x0000, +0x03BB,0x0000,0x0000,0x0000,0x0000, +0x03BC,0x0000,0x0000,0x0000,0x0000, +0x03BD,0x0000,0x0000,0x0000,0x0000, +0x03BE,0x0000,0x0000,0x0000,0x0000, +0x03BF,0x0000,0x0000,0x0000,0x0000, +0x03C0,0x0000,0x0000,0x0000,0x0000, +0x03C1,0x0000,0x0000,0x0000,0x0000, +0x03C2,0x0000,0x0000,0x0000,0x0000, +0x03C3,0x0000,0x0000,0x0000,0x0000, +0x03C4,0x0000,0x0000,0x0000,0x0000, +0x03C5,0x0000,0x0000,0x0000,0x0000, +0x03C6,0x0000,0x0000,0x0000,0x0000, +0x03C7,0x0000,0x0000,0x0000,0x0000, +0x03C8,0x0000,0x0000,0x0000,0x0000, +0x03C9,0x0000,0x0000,0x0000,0x0000, +0x03B2,0x0000,0x0000,0x0000,0x0000, +0x03CA,0x0000,0x0000,0x0000,0x0000, +0x03CB,0x0000,0x0000,0x0000,0x0000, +0x03CC,0x0000,0x0000,0x0000,0x0000, +0x03CD,0x0000,0x0000,0x0000,0x0000, +0x03CE,0x0000,0x0000,0x0000,0x0000, +0x03CF,0x0000,0x0000,0x0000,0x0000, +0x03D0,0x0000,0x0000,0x0000,0x0000, +0x03D1,0x0000,0x0000,0x0000,0x0000, +0x03D2,0x0000,0x0000,0x0000,0x0000, +0x03D3,0x0000,0x0000,0x0000,0x0000, +0x03D4,0x0000,0x0000,0x0000,0x0000, +0x03D5,0x0000,0x0000,0x0000,0x0000, +0x03D6,0x0000,0x0000,0x0000,0x0000, +0x03D7,0x0000,0x0000,0x0000,0x0000, +0x03D8,0x0000,0x0000,0x0000,0x0000, +0x03D9,0x0000,0x0000,0x0000,0x0000, +0x03DA,0x0000,0x0000,0x0000,0x0000, +0x03DB,0x0000,0x0000,0x0000,0x0000, +0x03DC,0x0000,0x0000,0x0000,0x0000, +0x03DD,0x0000,0x0000,0x0000,0x0000, +0x03DE,0x0000,0x0000,0x0000,0x0000, +0x03DF,0x0000,0x0000,0x0000,0x0000, +0x03E0,0x0000,0x0000,0x0000,0x0000, +0x03E1,0x0000,0x0000,0x0000,0x0000, +0x03E2,0x0000,0x0000,0x0000,0x0000, +0x03E3,0x0000,0x0000,0x0000,0x0000, +0x03E4,0x0000,0x0000,0x0000,0x0000, +0x03E5,0x0000,0x0000,0x0000,0x0000, +0x03E6,0x0000,0x0000,0x0000,0x0000, +0x03E7,0x0000,0x0000,0x0000,0x0000, +0x03E8,0x0000,0x0000,0x0000,0x0000, +0x03EC,0x0000,0x0000,0x0000,0x0000, +0x03EA,0x0000,0x0000,0x0000,0x0000, +0x03E8,0x0000,0x0000,0x0000,0x0000, +0x03E9,0x0000,0x0000,0x0000,0x0000, +0x03EA,0x0000,0x0000,0x0000,0x0000, +0x03EB,0x0000,0x0000,0x0000,0x0000, +0x03EC,0x0000,0x0000,0x0000,0x0000, +0x03ED,0x0000,0x0000,0x0000,0x0000, +0x03EE,0x0000,0x0000,0x0000,0x0000, +0x03EF,0x0000,0x0000,0x0000,0x0000, +0x03F0,0x0000,0x0000,0x0000,0x0000, +0x03F1,0x0000,0x0000,0x0000,0x0000, +0x03F2,0x0000,0x0000,0x0000,0x0000, +0x03F3,0x0000,0x0000,0x0000,0x0000, +0x03F4,0x0000,0x0000,0x0000,0x0000, +0x03F5,0x0000,0x0000,0x0000,0x0000, +0x03F6,0x0000,0x0000,0x0000,0x0000, +0x03F7,0x0000,0x0000,0x0000,0x0000, +0x03F8,0x0000,0x0000,0x0000,0x0000, +0x03F9,0x0000,0x0000,0x0000,0x0000, +0x03FA,0x0000,0x0000,0x0000,0x0000, +0x03FB,0x0000,0x0000,0x0000,0x0000, +0x03FC,0x0000,0x0000,0x0000,0x0000, +0x03FD,0x0000,0x0000,0x0000,0x0000, +0x03FE,0x0000,0x0000,0x0000,0x0000, +0x03FF,0x0000,0x0000,0x0000,0x0000, +0x0400,0x0000,0x0000,0x0000,0x0000, +0x0401,0x0000,0x0000,0x0000,0x0000, +0x0402,0x0000,0x0000,0x0000,0x0000, +0x0403,0x0000,0x0000,0x0000,0x0000, +0x0404,0x0000,0x0000,0x0000,0x0000, +0x0405,0x0000,0x0000,0x0000,0x0000, +0x0406,0x0000,0x0000,0x0000,0x0000, +0x0407,0x0000,0x0000,0x0000,0x0000, +0x0408,0x0000,0x0000,0x0000,0x0000, +0x0409,0x0000,0x0000,0x0000,0x0000, +0x040A,0x0000,0x0000,0x0000,0x0000, +0x040B,0x0000,0x0000,0x0000,0x0000, +0x040C,0x0000,0x0000,0x0000,0x0000, +0x040D,0x0000,0x0000,0x0000,0x0000, +0x040E,0x0000,0x0000,0x0000,0x0000, +0x040F,0x0000,0x0000,0x0000,0x0000, +0x0410,0x0000,0x0000,0x0000,0x0000, +0x0411,0x0000,0x0000,0x0000,0x0000, +0x0412,0x0000,0x0000,0x0000,0x0000, +0x0413,0x0000,0x0000,0x0000,0x0000, +0x0414,0x0000,0x0000,0x0000,0x0000, +0x0415,0x0000,0x0000,0x0000,0x0000, +0x0416,0x0000,0x0000,0x0000,0x0000, +0x0417,0x0000,0x0000,0x0000,0x0000 +}; + +uint16 page022data[]= { /* 2200 (4 weights per char) */ +0x0418,0x0000,0x0000,0x0000, 0x0419,0x0000,0x0000,0x0000, +0x041A,0x0000,0x0000,0x0000, 0x041B,0x0000,0x0000,0x0000, +0x041B,0x0000,0x0000,0x0000, 0x041C,0x0000,0x0000,0x0000, +0x041D,0x0000,0x0000,0x0000, 0x041E,0x0000,0x0000,0x0000, +0x041F,0x0000,0x0000,0x0000, 0x041F,0x0000,0x0000,0x0000, +0x0420,0x0000,0x0000,0x0000, 0x0421,0x0000,0x0000,0x0000, +0x0421,0x0000,0x0000,0x0000, 0x0422,0x0000,0x0000,0x0000, +0x0424,0x0000,0x0000,0x0000, 0x0425,0x0000,0x0000,0x0000, +0x0426,0x0000,0x0000,0x0000, 0x0427,0x0000,0x0000,0x0000, +0x0434,0x0000,0x0000,0x0000, 0x0435,0x0000,0x0000,0x0000, +0x0436,0x0000,0x0000,0x0000, 0x0437,0x0000,0x0000,0x0000, +0x0438,0x0000,0x0000,0x0000, 0x0439,0x0000,0x0000,0x0000, +0x043A,0x0000,0x0000,0x0000, 0x043B,0x0000,0x0000,0x0000, +0x043C,0x0000,0x0000,0x0000, 0x043D,0x0000,0x0000,0x0000, +0x043E,0x0000,0x0000,0x0000, 0x043F,0x0000,0x0000,0x0000, +0x0440,0x0000,0x0000,0x0000, 0x0441,0x0000,0x0000,0x0000, +0x0442,0x0000,0x0000,0x0000, 0x0443,0x0000,0x0000,0x0000, +0x0444,0x0000,0x0000,0x0000, 0x0445,0x0000,0x0000,0x0000, +0x0445,0x0000,0x0000,0x0000, 0x0446,0x0000,0x0000,0x0000, +0x0446,0x0000,0x0000,0x0000, 0x0447,0x0000,0x0000,0x0000, +0x0448,0x0000,0x0000,0x0000, 0x0449,0x0000,0x0000,0x0000, +0x044A,0x0000,0x0000,0x0000, 0x044B,0x0000,0x0000,0x0000, +0x044B,0x044B,0x0000,0x0000, 0x044B,0x044B,0x044B,0x0000, +0x044C,0x0000,0x0000,0x0000, 0x044C,0x044C,0x0000,0x0000, +0x044C,0x044C,0x044C,0x0000, 0x044D,0x0000,0x0000,0x0000, +0x044E,0x0000,0x0000,0x0000, 0x044F,0x0000,0x0000,0x0000, +0x0450,0x0000,0x0000,0x0000, 0x0451,0x0000,0x0000,0x0000, +0x0452,0x0000,0x0000,0x0000, 0x0453,0x0000,0x0000,0x0000, +0x0454,0x0000,0x0000,0x0000, 0x0455,0x0000,0x0000,0x0000, +0x0456,0x0000,0x0000,0x0000, 0x0457,0x0000,0x0000,0x0000, +0x0458,0x0000,0x0000,0x0000, 0x0459,0x0000,0x0000,0x0000, +0x045A,0x0000,0x0000,0x0000, 0x045B,0x0000,0x0000,0x0000, +0x045C,0x0000,0x0000,0x0000, 0x0458,0x0000,0x0000,0x0000, +0x045D,0x0000,0x0000,0x0000, 0x045E,0x0000,0x0000,0x0000, +0x045E,0x0000,0x0000,0x0000, 0x045F,0x0000,0x0000,0x0000, +0x0460,0x0000,0x0000,0x0000, 0x045F,0x0000,0x0000,0x0000, +0x0461,0x0000,0x0000,0x0000, 0x0461,0x0000,0x0000,0x0000, +0x0462,0x0000,0x0000,0x0000, 0x0463,0x0000,0x0000,0x0000, +0x0464,0x0000,0x0000,0x0000, 0x0465,0x0000,0x0000,0x0000, +0x0466,0x0000,0x0000,0x0000, 0x0467,0x0000,0x0000,0x0000, +0x0468,0x0000,0x0000,0x0000, 0x0469,0x0000,0x0000,0x0000, +0x046A,0x0000,0x0000,0x0000, 0x046B,0x0000,0x0000,0x0000, +0x046C,0x0000,0x0000,0x0000, 0x046D,0x0000,0x0000,0x0000, +0x046E,0x0000,0x0000,0x0000, 0x046F,0x0000,0x0000,0x0000, +0x0470,0x0000,0x0000,0x0000, 0x0471,0x0000,0x0000,0x0000, +0x0472,0x0000,0x0000,0x0000, 0x0473,0x0000,0x0000,0x0000, +0x0474,0x0000,0x0000,0x0000, 0x0475,0x0000,0x0000,0x0000, +0x0476,0x0000,0x0000,0x0000, 0x0477,0x0000,0x0000,0x0000, +0x042D,0x0000,0x0000,0x0000, 0x0478,0x0000,0x0000,0x0000, +0x0478,0x0000,0x0000,0x0000, 0x0479,0x0000,0x0000,0x0000, +0x047A,0x0000,0x0000,0x0000, 0x047B,0x0000,0x0000,0x0000, +0x047C,0x0000,0x0000,0x0000, 0x047D,0x0000,0x0000,0x0000, +0x047E,0x0000,0x0000,0x0000, 0x047F,0x0000,0x0000,0x0000, +0x0480,0x0000,0x0000,0x0000, 0x0481,0x0000,0x0000,0x0000, +0x0482,0x0000,0x0000,0x0000, 0x0465,0x0000,0x0000,0x0000, +0x042C,0x0000,0x0000,0x0000, 0x042E,0x0000,0x0000,0x0000, +0x047A,0x0000,0x0000,0x0000, 0x047B,0x0000,0x0000,0x0000, +0x0483,0x0000,0x0000,0x0000, 0x0484,0x0000,0x0000,0x0000, +0x0483,0x0000,0x0000,0x0000, 0x0484,0x0000,0x0000,0x0000, +0x0485,0x0000,0x0000,0x0000, 0x0486,0x0000,0x0000,0x0000, +0x0485,0x0000,0x0000,0x0000, 0x0486,0x0000,0x0000,0x0000, +0x0487,0x0000,0x0000,0x0000, 0x0488,0x0000,0x0000,0x0000, +0x0489,0x0000,0x0000,0x0000, 0x048A,0x0000,0x0000,0x0000, +0x048B,0x0000,0x0000,0x0000, 0x048C,0x0000,0x0000,0x0000, +0x0487,0x0000,0x0000,0x0000, 0x0488,0x0000,0x0000,0x0000, +0x048D,0x0000,0x0000,0x0000, 0x048E,0x0000,0x0000,0x0000, +0x048D,0x0000,0x0000,0x0000, 0x048E,0x0000,0x0000,0x0000, +0x048F,0x0000,0x0000,0x0000, 0x0490,0x0000,0x0000,0x0000, +0x048F,0x0000,0x0000,0x0000, 0x0490,0x0000,0x0000,0x0000, +0x0491,0x0000,0x0000,0x0000, 0x0492,0x0000,0x0000,0x0000, +0x0493,0x0000,0x0000,0x0000, 0x0494,0x0000,0x0000,0x0000, +0x0495,0x0000,0x0000,0x0000, 0x0496,0x0000,0x0000,0x0000, +0x0497,0x0000,0x0000,0x0000, 0x0498,0x0000,0x0000,0x0000, +0x0499,0x0000,0x0000,0x0000, 0x049A,0x0000,0x0000,0x0000, +0x049B,0x0000,0x0000,0x0000, 0x049C,0x0000,0x0000,0x0000, +0x049D,0x0000,0x0000,0x0000, 0x049E,0x0000,0x0000,0x0000, +0x049F,0x0000,0x0000,0x0000, 0x04A0,0x0000,0x0000,0x0000, +0x04A1,0x0000,0x0000,0x0000, 0x04A2,0x0000,0x0000,0x0000, +0x04A3,0x0000,0x0000,0x0000, 0x04A4,0x0000,0x0000,0x0000, +0x04A5,0x0000,0x0000,0x0000, 0x04A6,0x0000,0x0000,0x0000, +0x04A7,0x0000,0x0000,0x0000, 0x04A8,0x0000,0x0000,0x0000, +0x04A9,0x0000,0x0000,0x0000, 0x04AA,0x0000,0x0000,0x0000, +0x04AB,0x0000,0x0000,0x0000, 0x04AC,0x0000,0x0000,0x0000, +0x04AD,0x0000,0x0000,0x0000, 0x04AE,0x0000,0x0000,0x0000, +0x04AF,0x0000,0x0000,0x0000, 0x04B0,0x0000,0x0000,0x0000, +0x04B1,0x0000,0x0000,0x0000, 0x04B2,0x0000,0x0000,0x0000, +0x04A9,0x0000,0x0000,0x0000, 0x04AF,0x0000,0x0000,0x0000, +0x04B0,0x0000,0x0000,0x0000, 0x04B2,0x0000,0x0000,0x0000, +0x04B3,0x0000,0x0000,0x0000, 0x04B4,0x0000,0x0000,0x0000, +0x04B5,0x0000,0x0000,0x0000, 0x04B6,0x0000,0x0000,0x0000, +0x04B7,0x0000,0x0000,0x0000, 0x04B8,0x0000,0x0000,0x0000, +0x04B9,0x0000,0x0000,0x0000, 0x04BA,0x0000,0x0000,0x0000, +0x04BB,0x0000,0x0000,0x0000, 0x04BC,0x0000,0x0000,0x0000, +0x04BD,0x0000,0x0000,0x0000, 0x04BE,0x0000,0x0000,0x0000, +0x04BF,0x0000,0x0000,0x0000, 0x04C0,0x0000,0x0000,0x0000, +0x04C1,0x0000,0x0000,0x0000, 0x04C2,0x0000,0x0000,0x0000, +0x04C3,0x0000,0x0000,0x0000, 0x04C4,0x0000,0x0000,0x0000, +0x04C5,0x0000,0x0000,0x0000, 0x04C6,0x0000,0x0000,0x0000, +0x04C7,0x0000,0x0000,0x0000, 0x04C8,0x0000,0x0000,0x0000, +0x04C9,0x0000,0x0000,0x0000, 0x04CA,0x0000,0x0000,0x0000, +0x04CB,0x0000,0x0000,0x0000, 0x04CC,0x0000,0x0000,0x0000, +0x04CD,0x0000,0x0000,0x0000, 0x04CE,0x0000,0x0000,0x0000, +0x04CF,0x0000,0x0000,0x0000, 0x04D0,0x0000,0x0000,0x0000, +0x04D1,0x0000,0x0000,0x0000, 0x04D2,0x0000,0x0000,0x0000, +0x04D3,0x0000,0x0000,0x0000, 0x04D4,0x0000,0x0000,0x0000, +0x04D5,0x0000,0x0000,0x0000, 0x04D6,0x0000,0x0000,0x0000, +0x04D7,0x0000,0x0000,0x0000, 0x04D8,0x0000,0x0000,0x0000, +0x04D9,0x0000,0x0000,0x0000, 0x04DA,0x0000,0x0000,0x0000, +0x04DB,0x0000,0x0000,0x0000, 0x04DC,0x0000,0x0000,0x0000, +0x04DD,0x0000,0x0000,0x0000, 0x04DE,0x0000,0x0000,0x0000, +0x04DF,0x0000,0x0000,0x0000, 0x04E0,0x0000,0x0000,0x0000, +0x04E1,0x0000,0x0000,0x0000, 0x04E2,0x0000,0x0000,0x0000, +0x0489,0x0000,0x0000,0x0000, 0x048A,0x0000,0x0000,0x0000, +0x0498,0x0000,0x0000,0x0000, 0x0499,0x0000,0x0000,0x0000, +0x04E3,0x0000,0x0000,0x0000, 0x04E4,0x0000,0x0000,0x0000, +0x04E5,0x0000,0x0000,0x0000, 0x04E6,0x0000,0x0000,0x0000, +0x04E7,0x0000,0x0000,0x0000, 0x04E8,0x0000,0x0000,0x0000, +0x04B5,0x0000,0x0000,0x0000, 0x04B6,0x0000,0x0000,0x0000, +0x04B7,0x0000,0x0000,0x0000, 0x04B8,0x0000,0x0000,0x0000, +0x04E9,0x0000,0x0000,0x0000, 0x04EA,0x0000,0x0000,0x0000, +0x04EB,0x0000,0x0000,0x0000, 0x04EC,0x0000,0x0000,0x0000, +0x04ED,0x0000,0x0000,0x0000, 0x04EE,0x0000,0x0000,0x0000, +0x04EF,0x0000,0x0000,0x0000, 0x04F0,0x0000,0x0000,0x0000, +0x04F1,0x0000,0x0000,0x0000, 0x04F2,0x0000,0x0000,0x0000, +0x04F3,0x0000,0x0000,0x0000, 0x04F4,0x0000,0x0000,0x0000, +0x04F5,0x0000,0x0000,0x0000, 0x04F6,0x0000,0x0000,0x0000, +0x04F7,0x0000,0x0000,0x0000, 0x04F8,0x0000,0x0000,0x0000, +0x04F9,0x0000,0x0000,0x0000, 0x04FA,0x0000,0x0000,0x0000 +}; + +uint16 page023data[]= { /* 2300 (3 weights per char) */ +0x04FB,0x0000,0x0000, 0x04FC,0x0000,0x0000, 0x04FD,0x0000,0x0000, +0x04FE,0x0000,0x0000, 0x04FF,0x0000,0x0000, 0x0500,0x0000,0x0000, +0x0501,0x0000,0x0000, 0x0502,0x0000,0x0000, 0x0503,0x0000,0x0000, +0x0504,0x0000,0x0000, 0x0505,0x0000,0x0000, 0x0506,0x0000,0x0000, +0x0507,0x0000,0x0000, 0x0508,0x0000,0x0000, 0x0509,0x0000,0x0000, +0x050A,0x0000,0x0000, 0x050B,0x0000,0x0000, 0x050C,0x0000,0x0000, +0x050D,0x0000,0x0000, 0x050E,0x0000,0x0000, 0x050F,0x0000,0x0000, +0x0510,0x0000,0x0000, 0x0511,0x0000,0x0000, 0x0512,0x0000,0x0000, +0x0513,0x0000,0x0000, 0x0514,0x0000,0x0000, 0x0515,0x0000,0x0000, +0x0516,0x0000,0x0000, 0x0517,0x0000,0x0000, 0x0518,0x0000,0x0000, +0x0519,0x0000,0x0000, 0x051A,0x0000,0x0000, 0x051B,0x0000,0x0000, +0x051C,0x0000,0x0000, 0x051D,0x0000,0x0000, 0x051E,0x0000,0x0000, +0x051F,0x0000,0x0000, 0x0520,0x0000,0x0000, 0x0521,0x0000,0x0000, +0x0522,0x0000,0x0000, 0x0523,0x0000,0x0000, 0x02AE,0x0000,0x0000, +0x02AF,0x0000,0x0000, 0x0524,0x0000,0x0000, 0x0525,0x0000,0x0000, +0x0526,0x0000,0x0000, 0x0527,0x0000,0x0000, 0x0528,0x0000,0x0000, +0x0529,0x0000,0x0000, 0x052A,0x0000,0x0000, 0x052B,0x0000,0x0000, +0x052C,0x0000,0x0000, 0x052D,0x0000,0x0000, 0x052E,0x0000,0x0000, +0x052F,0x0000,0x0000, 0x0530,0x0000,0x0000, 0x0531,0x0000,0x0000, +0x0532,0x0000,0x0000, 0x0533,0x0000,0x0000, 0x0534,0x0000,0x0000, +0x0535,0x0000,0x0000, 0x0536,0x0000,0x0000, 0x0537,0x0000,0x0000, +0x0538,0x0000,0x0000, 0x0539,0x0000,0x0000, 0x053A,0x0000,0x0000, +0x053B,0x0000,0x0000, 0x053C,0x0000,0x0000, 0x053D,0x0000,0x0000, +0x053E,0x0000,0x0000, 0x053F,0x0000,0x0000, 0x0540,0x0000,0x0000, +0x0541,0x0000,0x0000, 0x0542,0x0000,0x0000, 0x0543,0x0000,0x0000, +0x0544,0x0000,0x0000, 0x0545,0x0000,0x0000, 0x0546,0x0000,0x0000, +0x0547,0x0000,0x0000, 0x0548,0x0000,0x0000, 0x0549,0x0000,0x0000, +0x054A,0x0000,0x0000, 0x054B,0x0000,0x0000, 0x054C,0x0000,0x0000, +0x054D,0x0000,0x0000, 0x054E,0x0000,0x0000, 0x054F,0x0000,0x0000, +0x0550,0x0000,0x0000, 0x0551,0x0000,0x0000, 0x0552,0x0000,0x0000, +0x0553,0x0000,0x0000, 0x0554,0x0000,0x0000, 0x0555,0x0000,0x0000, +0x0556,0x0000,0x0000, 0x0557,0x0000,0x0000, 0x0558,0x0000,0x0000, +0x0559,0x0000,0x0000, 0x055A,0x0000,0x0000, 0x055B,0x0000,0x0000, +0x055C,0x0000,0x0000, 0x055D,0x0000,0x0000, 0x055E,0x0000,0x0000, +0x055F,0x0000,0x0000, 0x0560,0x0000,0x0000, 0x0561,0x0000,0x0000, +0x0562,0x0000,0x0000, 0x0563,0x0000,0x0000, 0x0564,0x0000,0x0000, +0x0565,0x0000,0x0000, 0x0566,0x0000,0x0000, 0x0567,0x0000,0x0000, +0x0568,0x0000,0x0000, 0x0569,0x0000,0x0000, 0x056A,0x0000,0x0000, +0x056B,0x0000,0x0000, 0x056C,0x0000,0x0000, 0x056D,0x0000,0x0000, +0x056E,0x0000,0x0000, 0x056F,0x0000,0x0000, 0x0570,0x0000,0x0000, +0x0571,0x0000,0x0000, 0x0572,0x0000,0x0000, 0x0573,0x0000,0x0000, +0x0574,0x0000,0x0000, 0x0575,0x0000,0x0000, 0x0576,0x0000,0x0000, +0x0577,0x0000,0x0000, 0x0578,0x0000,0x0000, 0x0579,0x0000,0x0000, +0x057A,0x0000,0x0000, 0x057B,0x0000,0x0000, 0x057C,0x0000,0x0000, +0x057D,0x0000,0x0000, 0x057E,0x0000,0x0000, 0x057F,0x0000,0x0000, +0x0580,0x0000,0x0000, 0x0581,0x0000,0x0000, 0x0582,0x0000,0x0000, +0x0583,0x0000,0x0000, 0x0584,0x0000,0x0000, 0x0585,0x0000,0x0000, +0x0586,0x0000,0x0000, 0x0587,0x0000,0x0000, 0x0588,0x0000,0x0000, +0x0589,0x0000,0x0000, 0x058A,0x0000,0x0000, 0x058B,0x0000,0x0000, +0x058C,0x0000,0x0000, 0x058D,0x0000,0x0000, 0x058E,0x0000,0x0000, +0x058F,0x0000,0x0000, 0x0590,0x0000,0x0000, 0x0591,0x0000,0x0000, +0x0592,0x0000,0x0000, 0x0593,0x0000,0x0000, 0x0594,0x0000,0x0000, +0x0595,0x0000,0x0000, 0x0596,0x0000,0x0000, 0x0597,0x0000,0x0000, +0x0598,0x0000,0x0000, 0x0599,0x0000,0x0000, 0x059A,0x0000,0x0000, +0x059B,0x0000,0x0000, 0x059C,0x0000,0x0000, 0x059D,0x0000,0x0000, +0x059E,0x0000,0x0000, 0x059F,0x0000,0x0000, 0x05A0,0x0000,0x0000, +0x05A1,0x0000,0x0000, 0x05A2,0x0000,0x0000, 0x05A3,0x0000,0x0000, +0x05A4,0x0000,0x0000, 0x05A5,0x0000,0x0000, 0x05A6,0x0000,0x0000, +0x05A7,0x0000,0x0000, 0x05A8,0x0000,0x0000, 0x05A9,0x0000,0x0000, +0x05AA,0x0000,0x0000, 0x05AB,0x0000,0x0000, 0x05AC,0x0000,0x0000, +0x05AD,0x0000,0x0000, 0x05AE,0x0000,0x0000, 0x05AF,0x0000,0x0000, +0x05B0,0x0000,0x0000, 0x05B1,0x0000,0x0000, 0x05B2,0x0000,0x0000, +0x05B3,0x0000,0x0000, 0x05B4,0x0000,0x0000, 0x05B5,0x0000,0x0000, +0x05B6,0x0000,0x0000, 0x05B7,0x0000,0x0000, 0x05B8,0x0000,0x0000, +0x05B9,0x0000,0x0000, 0x05BA,0x0000,0x0000, 0x05BB,0x0000,0x0000, +0x05BC,0x0000,0x0000, 0x05BD,0x0000,0x0000, 0x05BE,0x0000,0x0000, +0x05BF,0x0000,0x0000, 0x05C0,0x0000,0x0000, 0x05C1,0x0000,0x0000, +0x05C2,0x0000,0x0000, 0x05C3,0x0000,0x0000, 0x05C4,0x0000,0x0000, +0x05C5,0x0000,0x0000, 0x05C6,0x0000,0x0000, 0x05C7,0x0000,0x0000, +0x05C8,0x0000,0x0000, 0x05C9,0x0000,0x0000, 0xFBC0,0xA3D1,0x0000, +0xFBC0,0xA3D2,0x0000, 0xFBC0,0xA3D3,0x0000, 0xFBC0,0xA3D4,0x0000, +0xFBC0,0xA3D5,0x0000, 0xFBC0,0xA3D6,0x0000, 0xFBC0,0xA3D7,0x0000, +0xFBC0,0xA3D8,0x0000, 0xFBC0,0xA3D9,0x0000, 0xFBC0,0xA3DA,0x0000, +0xFBC0,0xA3DB,0x0000, 0xFBC0,0xA3DC,0x0000, 0xFBC0,0xA3DD,0x0000, +0xFBC0,0xA3DE,0x0000, 0xFBC0,0xA3DF,0x0000, 0xFBC0,0xA3E0,0x0000, +0xFBC0,0xA3E1,0x0000, 0xFBC0,0xA3E2,0x0000, 0xFBC0,0xA3E3,0x0000, +0xFBC0,0xA3E4,0x0000, 0xFBC0,0xA3E5,0x0000, 0xFBC0,0xA3E6,0x0000, +0xFBC0,0xA3E7,0x0000, 0xFBC0,0xA3E8,0x0000, 0xFBC0,0xA3E9,0x0000, +0xFBC0,0xA3EA,0x0000, 0xFBC0,0xA3EB,0x0000, 0xFBC0,0xA3EC,0x0000, +0xFBC0,0xA3ED,0x0000, 0xFBC0,0xA3EE,0x0000, 0xFBC0,0xA3EF,0x0000, +0xFBC0,0xA3F0,0x0000, 0xFBC0,0xA3F1,0x0000, 0xFBC0,0xA3F2,0x0000, +0xFBC0,0xA3F3,0x0000, 0xFBC0,0xA3F4,0x0000, 0xFBC0,0xA3F5,0x0000, +0xFBC0,0xA3F6,0x0000, 0xFBC0,0xA3F7,0x0000, 0xFBC0,0xA3F8,0x0000, +0xFBC0,0xA3F9,0x0000, 0xFBC0,0xA3FA,0x0000, 0xFBC0,0xA3FB,0x0000, +0xFBC0,0xA3FC,0x0000, 0xFBC0,0xA3FD,0x0000, 0xFBC0,0xA3FE,0x0000, +0xFBC0,0xA3FF,0x0000 }; + +uint16 page024data[]= { /* 2400 (5 weights per char) */ +0x05CA,0x0000,0x0000,0x0000,0x0000, +0x05CB,0x0000,0x0000,0x0000,0x0000, +0x05CC,0x0000,0x0000,0x0000,0x0000, +0x05CD,0x0000,0x0000,0x0000,0x0000, +0x05CE,0x0000,0x0000,0x0000,0x0000, +0x05CF,0x0000,0x0000,0x0000,0x0000, +0x05D0,0x0000,0x0000,0x0000,0x0000, +0x05D1,0x0000,0x0000,0x0000,0x0000, +0x05D2,0x0000,0x0000,0x0000,0x0000, +0x05D3,0x0000,0x0000,0x0000,0x0000, +0x05D4,0x0000,0x0000,0x0000,0x0000, +0x05D5,0x0000,0x0000,0x0000,0x0000, +0x05D6,0x0000,0x0000,0x0000,0x0000, +0x05D7,0x0000,0x0000,0x0000,0x0000, +0x05D8,0x0000,0x0000,0x0000,0x0000, +0x05D9,0x0000,0x0000,0x0000,0x0000, +0x05DA,0x0000,0x0000,0x0000,0x0000, +0x05DB,0x0000,0x0000,0x0000,0x0000, +0x05DC,0x0000,0x0000,0x0000,0x0000, +0x05DD,0x0000,0x0000,0x0000,0x0000, +0x05DE,0x0000,0x0000,0x0000,0x0000, +0x05DF,0x0000,0x0000,0x0000,0x0000, +0x05E0,0x0000,0x0000,0x0000,0x0000, +0x05E1,0x0000,0x0000,0x0000,0x0000, +0x05E2,0x0000,0x0000,0x0000,0x0000, +0x05E3,0x0000,0x0000,0x0000,0x0000, +0x05E4,0x0000,0x0000,0x0000,0x0000, +0x05E5,0x0000,0x0000,0x0000,0x0000, +0x05E6,0x0000,0x0000,0x0000,0x0000, +0x05E7,0x0000,0x0000,0x0000,0x0000, +0x05E8,0x0000,0x0000,0x0000,0x0000, +0x05E9,0x0000,0x0000,0x0000,0x0000, +0x05EA,0x0000,0x0000,0x0000,0x0000, +0x05EB,0x0000,0x0000,0x0000,0x0000, +0x05EC,0x0000,0x0000,0x0000,0x0000, +0x05ED,0x0000,0x0000,0x0000,0x0000, +0x05EE,0x0000,0x0000,0x0000,0x0000, +0x05EF,0x0000,0x0000,0x0000,0x0000, +0x05F0,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA427,0x0000,0x0000,0x0000, +0xFBC0,0xA428,0x0000,0x0000,0x0000, +0xFBC0,0xA429,0x0000,0x0000,0x0000, +0xFBC0,0xA42A,0x0000,0x0000,0x0000, +0xFBC0,0xA42B,0x0000,0x0000,0x0000, +0xFBC0,0xA42C,0x0000,0x0000,0x0000, +0xFBC0,0xA42D,0x0000,0x0000,0x0000, +0xFBC0,0xA42E,0x0000,0x0000,0x0000, +0xFBC0,0xA42F,0x0000,0x0000,0x0000, +0xFBC0,0xA430,0x0000,0x0000,0x0000, +0xFBC0,0xA431,0x0000,0x0000,0x0000, +0xFBC0,0xA432,0x0000,0x0000,0x0000, +0xFBC0,0xA433,0x0000,0x0000,0x0000, +0xFBC0,0xA434,0x0000,0x0000,0x0000, +0xFBC0,0xA435,0x0000,0x0000,0x0000, +0xFBC0,0xA436,0x0000,0x0000,0x0000, +0xFBC0,0xA437,0x0000,0x0000,0x0000, +0xFBC0,0xA438,0x0000,0x0000,0x0000, +0xFBC0,0xA439,0x0000,0x0000,0x0000, +0xFBC0,0xA43A,0x0000,0x0000,0x0000, +0xFBC0,0xA43B,0x0000,0x0000,0x0000, +0xFBC0,0xA43C,0x0000,0x0000,0x0000, +0xFBC0,0xA43D,0x0000,0x0000,0x0000, +0xFBC0,0xA43E,0x0000,0x0000,0x0000, +0xFBC0,0xA43F,0x0000,0x0000,0x0000, +0x05F1,0x0000,0x0000,0x0000,0x0000, +0x05F2,0x0000,0x0000,0x0000,0x0000, +0x05F3,0x0000,0x0000,0x0000,0x0000, +0x05F4,0x0000,0x0000,0x0000,0x0000, +0x05F5,0x0000,0x0000,0x0000,0x0000, +0x05F6,0x0000,0x0000,0x0000,0x0000, +0x05F7,0x0000,0x0000,0x0000,0x0000, +0x05F8,0x0000,0x0000,0x0000,0x0000, +0x05F9,0x0000,0x0000,0x0000,0x0000, +0x05FA,0x0000,0x0000,0x0000,0x0000, +0x05FB,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xA44B,0x0000,0x0000,0x0000, +0xFBC0,0xA44C,0x0000,0x0000,0x0000, +0xFBC0,0xA44D,0x0000,0x0000,0x0000, +0xFBC0,0xA44E,0x0000,0x0000,0x0000, +0xFBC0,0xA44F,0x0000,0x0000,0x0000, +0xFBC0,0xA450,0x0000,0x0000,0x0000, +0xFBC0,0xA451,0x0000,0x0000,0x0000, +0xFBC0,0xA452,0x0000,0x0000,0x0000, +0xFBC0,0xA453,0x0000,0x0000,0x0000, +0xFBC0,0xA454,0x0000,0x0000,0x0000, +0xFBC0,0xA455,0x0000,0x0000,0x0000, +0xFBC0,0xA456,0x0000,0x0000,0x0000, +0xFBC0,0xA457,0x0000,0x0000,0x0000, +0xFBC0,0xA458,0x0000,0x0000,0x0000, +0xFBC0,0xA459,0x0000,0x0000,0x0000, +0xFBC0,0xA45A,0x0000,0x0000,0x0000, +0xFBC0,0xA45B,0x0000,0x0000,0x0000, +0xFBC0,0xA45C,0x0000,0x0000,0x0000, +0xFBC0,0xA45D,0x0000,0x0000,0x0000, +0xFBC0,0xA45E,0x0000,0x0000,0x0000, +0xFBC0,0xA45F,0x0000,0x0000,0x0000, +0x0E2A,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0x0000,0x0000,0x0000,0x0000, +0x0E2F,0x0000,0x0000,0x0000,0x0000, +0x0E30,0x0000,0x0000,0x0000,0x0000, +0x0E31,0x0000,0x0000,0x0000,0x0000, +0x0E32,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E29,0x0000,0x0000,0x0000, +0x0E2A,0x0E2A,0x0000,0x0000,0x0000, +0x0E2A,0x0E2B,0x0000,0x0000,0x0000, +0x0E2A,0x0E2C,0x0000,0x0000,0x0000, +0x0E2A,0x0E2D,0x0000,0x0000,0x0000, +0x0E2A,0x0E2E,0x0000,0x0000,0x0000, +0x0E2A,0x0E2F,0x0000,0x0000,0x0000, +0x0E2A,0x0E30,0x0000,0x0000,0x0000, +0x0E2A,0x0E31,0x0000,0x0000,0x0000, +0x0E2A,0x0E32,0x0000,0x0000,0x0000, +0x0E2B,0x0E29,0x0000,0x0000,0x0000, +0x0288,0x0E2A,0x0289,0x0000,0x0000, +0x0288,0x0E2B,0x0289,0x0000,0x0000, +0x0288,0x0E2C,0x0289,0x0000,0x0000, +0x0288,0x0E2D,0x0289,0x0000,0x0000, +0x0288,0x0E2E,0x0289,0x0000,0x0000, +0x0288,0x0E2F,0x0289,0x0000,0x0000, +0x0288,0x0E30,0x0289,0x0000,0x0000, +0x0288,0x0E31,0x0289,0x0000,0x0000, +0x0288,0x0E32,0x0289,0x0000,0x0000, +0x0288,0x0E2A,0x0E29,0x0289,0x0000, +0x0288,0x0E2A,0x0E2A,0x0289,0x0000, +0x0288,0x0E2A,0x0E2B,0x0289,0x0000, +0x0288,0x0E2A,0x0E2C,0x0289,0x0000, +0x0288,0x0E2A,0x0E2D,0x0289,0x0000, +0x0288,0x0E2A,0x0E2E,0x0289,0x0000, +0x0288,0x0E2A,0x0E2F,0x0289,0x0000, +0x0288,0x0E2A,0x0E30,0x0289,0x0000, +0x0288,0x0E2A,0x0E31,0x0289,0x0000, +0x0288,0x0E2A,0x0E32,0x0289,0x0000, +0x0288,0x0E2B,0x0E29,0x0289,0x0000, +0x0E2A,0x025D,0x0000,0x0000,0x0000, +0x0E2B,0x025D,0x0000,0x0000,0x0000, +0x0E2C,0x025D,0x0000,0x0000,0x0000, +0x0E2D,0x025D,0x0000,0x0000,0x0000, +0x0E2E,0x025D,0x0000,0x0000,0x0000, +0x0E2F,0x025D,0x0000,0x0000,0x0000, +0x0E30,0x025D,0x0000,0x0000,0x0000, +0x0E31,0x025D,0x0000,0x0000,0x0000, +0x0E32,0x025D,0x0000,0x0000,0x0000, +0x0E2A,0x0E29,0x025D,0x0000,0x0000, +0x0E2A,0x0E2A,0x025D,0x0000,0x0000, +0x0E2A,0x0E2B,0x025D,0x0000,0x0000, +0x0E2A,0x0E2C,0x025D,0x0000,0x0000, +0x0E2A,0x0E2D,0x025D,0x0000,0x0000, +0x0E2A,0x0E2E,0x025D,0x0000,0x0000, +0x0E2A,0x0E2F,0x025D,0x0000,0x0000, +0x0E2A,0x0E30,0x025D,0x0000,0x0000, +0x0E2A,0x0E31,0x025D,0x0000,0x0000, +0x0E2A,0x0E32,0x025D,0x0000,0x0000, +0x0E2B,0x0E29,0x025D,0x0000,0x0000, +0x0288,0x0E33,0x0289,0x0000,0x0000, +0x0288,0x0E4A,0x0289,0x0000,0x0000, +0x0288,0x0E60,0x0289,0x0000,0x0000, +0x0288,0x0E6D,0x0289,0x0000,0x0000, +0x0288,0x0E8B,0x0289,0x0000,0x0000, +0x0288,0x0EB9,0x0289,0x0000,0x0000, +0x0288,0x0EC1,0x0289,0x0000,0x0000, +0x0288,0x0EE1,0x0289,0x0000,0x0000, +0x0288,0x0EFB,0x0289,0x0000,0x0000, +0x0288,0x0F10,0x0289,0x0000,0x0000, +0x0288,0x0F21,0x0289,0x0000,0x0000, +0x0288,0x0F2E,0x0289,0x0000,0x0000, +0x0288,0x0F5B,0x0289,0x0000,0x0000, +0x0288,0x0F64,0x0289,0x0000,0x0000, +0x0288,0x0F82,0x0289,0x0000,0x0000, +0x0288,0x0FA7,0x0289,0x0000,0x0000, +0x0288,0x0FB4,0x0289,0x0000,0x0000, +0x0288,0x0FC0,0x0289,0x0000,0x0000, +0x0288,0x0FEA,0x0289,0x0000,0x0000, +0x0288,0x1002,0x0289,0x0000,0x0000, +0x0288,0x101F,0x0289,0x0000,0x0000, +0x0288,0x1044,0x0289,0x0000,0x0000, +0x0288,0x1051,0x0289,0x0000,0x0000, +0x0288,0x105A,0x0289,0x0000,0x0000, +0x0288,0x105E,0x0289,0x0000,0x0000, +0x0288,0x106A,0x0289,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000,0x0000, +0x0E4A,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000,0x0000, +0x0EB9,0x0000,0x0000,0x0000,0x0000, +0x0EC1,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x0F10,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0000,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0000,0x0000,0x0000,0x0000, +0x0FB4,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000,0x0000, +0x0FEA,0x0000,0x0000,0x0000,0x0000, +0x1002,0x0000,0x0000,0x0000,0x0000, +0x101F,0x0000,0x0000,0x0000,0x0000, +0x1044,0x0000,0x0000,0x0000,0x0000, +0x1051,0x0000,0x0000,0x0000,0x0000, +0x105A,0x0000,0x0000,0x0000,0x0000, +0x105E,0x0000,0x0000,0x0000,0x0000, +0x106A,0x0000,0x0000,0x0000,0x0000, +0x0E33,0x0000,0x0000,0x0000,0x0000, +0x0E4A,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0000,0x0000,0x0000,0x0000, +0x0E8B,0x0000,0x0000,0x0000,0x0000, +0x0EB9,0x0000,0x0000,0x0000,0x0000, +0x0EC1,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0000,0x0000,0x0000,0x0000, +0x0F10,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0000,0x0000,0x0000,0x0000, +0x0F82,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0000,0x0000,0x0000,0x0000, +0x0FB4,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0000,0x0000,0x0000,0x0000, +0x0FEA,0x0000,0x0000,0x0000,0x0000, +0x1002,0x0000,0x0000,0x0000,0x0000, +0x101F,0x0000,0x0000,0x0000,0x0000, +0x1044,0x0000,0x0000,0x0000,0x0000, +0x1051,0x0000,0x0000,0x0000,0x0000, +0x105A,0x0000,0x0000,0x0000,0x0000, +0x105E,0x0000,0x0000,0x0000,0x0000, +0x106A,0x0000,0x0000,0x0000,0x0000, +0x0E29,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2A,0x0000,0x0000,0x0000, +0x0E2A,0x0E2B,0x0000,0x0000,0x0000, +0x0E2A,0x0E2C,0x0000,0x0000,0x0000, +0x0E2A,0x0E2D,0x0000,0x0000,0x0000, +0x0E2A,0x0E2E,0x0000,0x0000,0x0000, +0x0E2A,0x0E2F,0x0000,0x0000,0x0000, +0x0E2A,0x0E30,0x0000,0x0000,0x0000, +0x0E2A,0x0E31,0x0000,0x0000,0x0000, +0x0E2A,0x0E32,0x0000,0x0000,0x0000, +0x0E2B,0x0E29,0x0000,0x0000,0x0000, +0x0E2A,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0x0000,0x0000,0x0000,0x0000, +0x0E2F,0x0000,0x0000,0x0000,0x0000, +0x0E30,0x0000,0x0000,0x0000,0x0000, +0x0E31,0x0000,0x0000,0x0000,0x0000, +0x0E32,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E29,0x0000,0x0000,0x0000, +0x0E29,0x0000,0x0000,0x0000,0x0000 +}; + +uint16 page025data[]= { /* 2500 (2 weights per char) */ +0x05FC,0x0000, 0x05FD,0x0000, 0x05FE,0x0000, 0x05FF,0x0000, +0x0600,0x0000, 0x0601,0x0000, 0x0602,0x0000, 0x0603,0x0000, +0x0604,0x0000, 0x0605,0x0000, 0x0606,0x0000, 0x0607,0x0000, +0x0608,0x0000, 0x0609,0x0000, 0x060A,0x0000, 0x060B,0x0000, +0x060C,0x0000, 0x060D,0x0000, 0x060E,0x0000, 0x060F,0x0000, +0x0610,0x0000, 0x0611,0x0000, 0x0612,0x0000, 0x0613,0x0000, +0x0614,0x0000, 0x0615,0x0000, 0x0616,0x0000, 0x0617,0x0000, +0x0618,0x0000, 0x0619,0x0000, 0x061A,0x0000, 0x061B,0x0000, +0x061C,0x0000, 0x061D,0x0000, 0x061E,0x0000, 0x061F,0x0000, +0x0620,0x0000, 0x0621,0x0000, 0x0622,0x0000, 0x0623,0x0000, +0x0624,0x0000, 0x0625,0x0000, 0x0626,0x0000, 0x0627,0x0000, +0x0628,0x0000, 0x0629,0x0000, 0x062A,0x0000, 0x062B,0x0000, +0x062C,0x0000, 0x062D,0x0000, 0x062E,0x0000, 0x062F,0x0000, +0x0630,0x0000, 0x0631,0x0000, 0x0632,0x0000, 0x0633,0x0000, +0x0634,0x0000, 0x0635,0x0000, 0x0636,0x0000, 0x0637,0x0000, +0x0638,0x0000, 0x0639,0x0000, 0x063A,0x0000, 0x063B,0x0000, +0x063C,0x0000, 0x063D,0x0000, 0x063E,0x0000, 0x063F,0x0000, +0x0640,0x0000, 0x0641,0x0000, 0x0642,0x0000, 0x0643,0x0000, +0x0644,0x0000, 0x0645,0x0000, 0x0646,0x0000, 0x0647,0x0000, +0x0648,0x0000, 0x0649,0x0000, 0x064A,0x0000, 0x064B,0x0000, +0x064C,0x0000, 0x064D,0x0000, 0x064E,0x0000, 0x064F,0x0000, +0x0650,0x0000, 0x0651,0x0000, 0x0652,0x0000, 0x0653,0x0000, +0x0654,0x0000, 0x0655,0x0000, 0x0656,0x0000, 0x0657,0x0000, +0x0658,0x0000, 0x0659,0x0000, 0x065A,0x0000, 0x065B,0x0000, +0x065C,0x0000, 0x065D,0x0000, 0x065E,0x0000, 0x065F,0x0000, +0x0660,0x0000, 0x0661,0x0000, 0x0662,0x0000, 0x0663,0x0000, +0x0664,0x0000, 0x0665,0x0000, 0x0666,0x0000, 0x0667,0x0000, +0x0668,0x0000, 0x0669,0x0000, 0x066A,0x0000, 0x066B,0x0000, +0x066C,0x0000, 0x066D,0x0000, 0x066E,0x0000, 0x066F,0x0000, +0x0670,0x0000, 0x0671,0x0000, 0x0672,0x0000, 0x0673,0x0000, +0x0674,0x0000, 0x0675,0x0000, 0x0676,0x0000, 0x0677,0x0000, +0x0678,0x0000, 0x0679,0x0000, 0x067A,0x0000, 0x067B,0x0000, +0x067C,0x0000, 0x067D,0x0000, 0x067E,0x0000, 0x067F,0x0000, +0x0680,0x0000, 0x0681,0x0000, 0x0682,0x0000, 0x0683,0x0000, +0x0684,0x0000, 0x0685,0x0000, 0x0686,0x0000, 0x0687,0x0000, +0x0688,0x0000, 0x0689,0x0000, 0x068A,0x0000, 0x068B,0x0000, +0x068C,0x0000, 0x068D,0x0000, 0x068E,0x0000, 0x068F,0x0000, +0x0690,0x0000, 0x0691,0x0000, 0x0692,0x0000, 0x0693,0x0000, +0x0694,0x0000, 0x0695,0x0000, 0x0696,0x0000, 0x0697,0x0000, +0x0698,0x0000, 0x0699,0x0000, 0x069A,0x0000, 0x069B,0x0000, +0x069C,0x0000, 0x069D,0x0000, 0x069E,0x0000, 0x069F,0x0000, +0x06A0,0x0000, 0x06A1,0x0000, 0x06A2,0x0000, 0x06A3,0x0000, +0x06A4,0x0000, 0x06A5,0x0000, 0x06A6,0x0000, 0x06A7,0x0000, +0x06A8,0x0000, 0x06A9,0x0000, 0x06AA,0x0000, 0x06AB,0x0000, +0x06AC,0x0000, 0x06AD,0x0000, 0x06AE,0x0000, 0x06AF,0x0000, +0x06B0,0x0000, 0x06B1,0x0000, 0x06B2,0x0000, 0x06B3,0x0000, +0x06B4,0x0000, 0x06B5,0x0000, 0x06B6,0x0000, 0x06B7,0x0000, +0x06B8,0x0000, 0x06B9,0x0000, 0x06BA,0x0000, 0x06BB,0x0000, +0x06BC,0x0000, 0x06BD,0x0000, 0x06BE,0x0000, 0x06BF,0x0000, +0x06C0,0x0000, 0x06C1,0x0000, 0x06C2,0x0000, 0x06C3,0x0000, +0x06C4,0x0000, 0x06C5,0x0000, 0x06C6,0x0000, 0x06C7,0x0000, +0x06C8,0x0000, 0x06C9,0x0000, 0x06CA,0x0000, 0x06CB,0x0000, +0x06CC,0x0000, 0x06CD,0x0000, 0x06CE,0x0000, 0x06CF,0x0000, +0x06D0,0x0000, 0x06D1,0x0000, 0x06D2,0x0000, 0x06D3,0x0000, +0x06D4,0x0000, 0x06D5,0x0000, 0x06D6,0x0000, 0x06D7,0x0000, +0x06D8,0x0000, 0x06D9,0x0000, 0x06DA,0x0000, 0x06DB,0x0000, +0x06DC,0x0000, 0x06DD,0x0000, 0x06DE,0x0000, 0x06DF,0x0000, +0x06E0,0x0000, 0x06E1,0x0000, 0x06E2,0x0000, 0x06E3,0x0000, +0x06E4,0x0000, 0x06E5,0x0000, 0x06E6,0x0000, 0x06E7,0x0000, +0x06E8,0x0000, 0x06E9,0x0000, 0x06EA,0x0000, 0x06EB,0x0000, +0x06EC,0x0000, 0x06ED,0x0000, 0x06EE,0x0000, 0x06EF,0x0000, +0x06F0,0x0000, 0x06F1,0x0000, 0x06F2,0x0000, 0x06F3,0x0000, +0x06F4,0x0000, 0x06F5,0x0000, 0x06F6,0x0000, 0x06F7,0x0000, +0x06F8,0x0000, 0x06F9,0x0000, 0x06FA,0x0000, 0x06FB,0x0000 +}; + +uint16 page026data[]= { /* 2600 (3 weights per char) */ +0x06FC,0x0000,0x0000, 0x06FD,0x0000,0x0000, 0x06FE,0x0000,0x0000, +0x06FF,0x0000,0x0000, 0x0700,0x0000,0x0000, 0x0701,0x0000,0x0000, +0x0702,0x0000,0x0000, 0x0703,0x0000,0x0000, 0x0704,0x0000,0x0000, +0x0705,0x0000,0x0000, 0x0706,0x0000,0x0000, 0x0707,0x0000,0x0000, +0x0708,0x0000,0x0000, 0x0709,0x0000,0x0000, 0x070A,0x0000,0x0000, +0x070B,0x0000,0x0000, 0x070C,0x0000,0x0000, 0x070D,0x0000,0x0000, +0x070E,0x0000,0x0000, 0x070F,0x0000,0x0000, 0x0710,0x0000,0x0000, +0x0711,0x0000,0x0000, 0x0712,0x0000,0x0000, 0x0713,0x0000,0x0000, +0xFBC0,0xA618,0x0000, 0x0714,0x0000,0x0000, 0x0715,0x0000,0x0000, +0x0716,0x0000,0x0000, 0x0717,0x0000,0x0000, 0x0718,0x0000,0x0000, +0x0719,0x0000,0x0000, 0x071A,0x0000,0x0000, 0x071B,0x0000,0x0000, +0x071C,0x0000,0x0000, 0x071D,0x0000,0x0000, 0x071E,0x0000,0x0000, +0x071F,0x0000,0x0000, 0x0720,0x0000,0x0000, 0x0721,0x0000,0x0000, +0x0722,0x0000,0x0000, 0x0723,0x0000,0x0000, 0x0724,0x0000,0x0000, +0x0725,0x0000,0x0000, 0x0726,0x0000,0x0000, 0x0727,0x0000,0x0000, +0x0728,0x0000,0x0000, 0x0729,0x0000,0x0000, 0x072A,0x0000,0x0000, +0x0B2F,0x0000,0x0000, 0x0B30,0x0000,0x0000, 0x0B31,0x0000,0x0000, +0x0B32,0x0000,0x0000, 0x0B33,0x0000,0x0000, 0x0B34,0x0000,0x0000, +0x0B35,0x0000,0x0000, 0x0B36,0x0000,0x0000, 0x072B,0x0000,0x0000, +0x072C,0x0000,0x0000, 0x072D,0x0000,0x0000, 0x072E,0x0000,0x0000, +0x072F,0x0000,0x0000, 0x0730,0x0000,0x0000, 0x0731,0x0000,0x0000, +0x0732,0x0000,0x0000, 0x0733,0x0000,0x0000, 0x0734,0x0000,0x0000, +0x0735,0x0000,0x0000, 0x0736,0x0000,0x0000, 0x0737,0x0000,0x0000, +0x0738,0x0000,0x0000, 0x0739,0x0000,0x0000, 0x073A,0x0000,0x0000, +0x073B,0x0000,0x0000, 0x073C,0x0000,0x0000, 0x073D,0x0000,0x0000, +0x073E,0x0000,0x0000, 0x073F,0x0000,0x0000, 0x0740,0x0000,0x0000, +0x0741,0x0000,0x0000, 0x0742,0x0000,0x0000, 0x0743,0x0000,0x0000, +0x0744,0x0000,0x0000, 0x0745,0x0000,0x0000, 0x0746,0x0000,0x0000, +0x0747,0x0000,0x0000, 0x0748,0x0000,0x0000, 0x0749,0x0000,0x0000, +0x074A,0x0000,0x0000, 0x074B,0x0000,0x0000, 0x074C,0x0000,0x0000, +0x074D,0x0000,0x0000, 0x074E,0x0000,0x0000, 0x074F,0x0000,0x0000, +0x0750,0x0000,0x0000, 0x0751,0x0000,0x0000, 0x0752,0x0000,0x0000, +0x0753,0x0000,0x0000, 0x0754,0x0000,0x0000, 0x0755,0x0000,0x0000, +0x0756,0x0000,0x0000, 0x0757,0x0000,0x0000, 0x0758,0x0000,0x0000, +0x0759,0x0000,0x0000, 0x075A,0x0000,0x0000, 0x075B,0x0000,0x0000, +0x075C,0x0000,0x0000, 0x075D,0x0000,0x0000, 0x075E,0x0000,0x0000, +0x075F,0x0000,0x0000, 0x0D2B,0x0000,0x0000, 0x0D2C,0x0000,0x0000, +0x0D2D,0x0000,0x0000, 0x0760,0x0000,0x0000, 0x0761,0x0000,0x0000, +0x0762,0x0000,0x0000, 0x0763,0x0000,0x0000, 0x0764,0x0000,0x0000, +0x0765,0x0000,0x0000, 0x0766,0x0000,0x0000, 0x0767,0x0000,0x0000, +0x0768,0x0000,0x0000, 0x0769,0x0000,0x0000, 0x076A,0x0000,0x0000, +0x076B,0x0000,0x0000, 0x076C,0x0000,0x0000, 0x076D,0x0000,0x0000, +0xFBC0,0xA67E,0x0000, 0xFBC0,0xA67F,0x0000, 0x076E,0x0000,0x0000, +0x076F,0x0000,0x0000, 0x0770,0x0000,0x0000, 0x0771,0x0000,0x0000, +0x0772,0x0000,0x0000, 0x0773,0x0000,0x0000, 0x0774,0x0000,0x0000, +0x0775,0x0000,0x0000, 0x0776,0x0000,0x0000, 0x0777,0x0000,0x0000, +0x0B29,0x0000,0x0000, 0x0B2A,0x0000,0x0000, 0x0B2B,0x0000,0x0000, +0x0B2C,0x0000,0x0000, 0x0B2D,0x0000,0x0000, 0x0B2E,0x0000,0x0000, +0x0778,0x0000,0x0000, 0x0779,0x0000,0x0000, 0xFBC0,0xA692,0x0000, +0xFBC0,0xA693,0x0000, 0xFBC0,0xA694,0x0000, 0xFBC0,0xA695,0x0000, +0xFBC0,0xA696,0x0000, 0xFBC0,0xA697,0x0000, 0xFBC0,0xA698,0x0000, +0xFBC0,0xA699,0x0000, 0xFBC0,0xA69A,0x0000, 0xFBC0,0xA69B,0x0000, +0xFBC0,0xA69C,0x0000, 0xFBC0,0xA69D,0x0000, 0xFBC0,0xA69E,0x0000, +0xFBC0,0xA69F,0x0000, 0x077A,0x0000,0x0000, 0x077B,0x0000,0x0000, +0xFBC0,0xA6A2,0x0000, 0xFBC0,0xA6A3,0x0000, 0xFBC0,0xA6A4,0x0000, +0xFBC0,0xA6A5,0x0000, 0xFBC0,0xA6A6,0x0000, 0xFBC0,0xA6A7,0x0000, +0xFBC0,0xA6A8,0x0000, 0xFBC0,0xA6A9,0x0000, 0xFBC0,0xA6AA,0x0000, +0xFBC0,0xA6AB,0x0000, 0xFBC0,0xA6AC,0x0000, 0xFBC0,0xA6AD,0x0000, +0xFBC0,0xA6AE,0x0000, 0xFBC0,0xA6AF,0x0000, 0xFBC0,0xA6B0,0x0000, +0xFBC0,0xA6B1,0x0000, 0xFBC0,0xA6B2,0x0000, 0xFBC0,0xA6B3,0x0000, +0xFBC0,0xA6B4,0x0000, 0xFBC0,0xA6B5,0x0000, 0xFBC0,0xA6B6,0x0000, +0xFBC0,0xA6B7,0x0000, 0xFBC0,0xA6B8,0x0000, 0xFBC0,0xA6B9,0x0000, +0xFBC0,0xA6BA,0x0000, 0xFBC0,0xA6BB,0x0000, 0xFBC0,0xA6BC,0x0000, +0xFBC0,0xA6BD,0x0000, 0xFBC0,0xA6BE,0x0000, 0xFBC0,0xA6BF,0x0000, +0xFBC0,0xA6C0,0x0000, 0xFBC0,0xA6C1,0x0000, 0xFBC0,0xA6C2,0x0000, +0xFBC0,0xA6C3,0x0000, 0xFBC0,0xA6C4,0x0000, 0xFBC0,0xA6C5,0x0000, +0xFBC0,0xA6C6,0x0000, 0xFBC0,0xA6C7,0x0000, 0xFBC0,0xA6C8,0x0000, +0xFBC0,0xA6C9,0x0000, 0xFBC0,0xA6CA,0x0000, 0xFBC0,0xA6CB,0x0000, +0xFBC0,0xA6CC,0x0000, 0xFBC0,0xA6CD,0x0000, 0xFBC0,0xA6CE,0x0000, +0xFBC0,0xA6CF,0x0000, 0xFBC0,0xA6D0,0x0000, 0xFBC0,0xA6D1,0x0000, +0xFBC0,0xA6D2,0x0000, 0xFBC0,0xA6D3,0x0000, 0xFBC0,0xA6D4,0x0000, +0xFBC0,0xA6D5,0x0000, 0xFBC0,0xA6D6,0x0000, 0xFBC0,0xA6D7,0x0000, +0xFBC0,0xA6D8,0x0000, 0xFBC0,0xA6D9,0x0000, 0xFBC0,0xA6DA,0x0000, +0xFBC0,0xA6DB,0x0000, 0xFBC0,0xA6DC,0x0000, 0xFBC0,0xA6DD,0x0000, +0xFBC0,0xA6DE,0x0000, 0xFBC0,0xA6DF,0x0000, 0xFBC0,0xA6E0,0x0000, +0xFBC0,0xA6E1,0x0000, 0xFBC0,0xA6E2,0x0000, 0xFBC0,0xA6E3,0x0000, +0xFBC0,0xA6E4,0x0000, 0xFBC0,0xA6E5,0x0000, 0xFBC0,0xA6E6,0x0000, +0xFBC0,0xA6E7,0x0000, 0xFBC0,0xA6E8,0x0000, 0xFBC0,0xA6E9,0x0000, +0xFBC0,0xA6EA,0x0000, 0xFBC0,0xA6EB,0x0000, 0xFBC0,0xA6EC,0x0000, +0xFBC0,0xA6ED,0x0000, 0xFBC0,0xA6EE,0x0000, 0xFBC0,0xA6EF,0x0000, +0xFBC0,0xA6F0,0x0000, 0xFBC0,0xA6F1,0x0000, 0xFBC0,0xA6F2,0x0000, +0xFBC0,0xA6F3,0x0000, 0xFBC0,0xA6F4,0x0000, 0xFBC0,0xA6F5,0x0000, +0xFBC0,0xA6F6,0x0000, 0xFBC0,0xA6F7,0x0000, 0xFBC0,0xA6F8,0x0000, +0xFBC0,0xA6F9,0x0000, 0xFBC0,0xA6FA,0x0000, 0xFBC0,0xA6FB,0x0000, +0xFBC0,0xA6FC,0x0000, 0xFBC0,0xA6FD,0x0000, 0xFBC0,0xA6FE,0x0000, +0xFBC0,0xA6FF,0x0000 }; + +uint16 page027data[]= { /* 2700 (3 weights per char) */ +0xFBC0,0xA700,0x0000, 0x077C,0x0000,0x0000, 0x077D,0x0000,0x0000, +0x077E,0x0000,0x0000, 0x077F,0x0000,0x0000, 0xFBC0,0xA705,0x0000, +0x0780,0x0000,0x0000, 0x0781,0x0000,0x0000, 0x0782,0x0000,0x0000, +0x0783,0x0000,0x0000, 0xFBC0,0xA70A,0x0000, 0xFBC0,0xA70B,0x0000, +0x0784,0x0000,0x0000, 0x0785,0x0000,0x0000, 0x0786,0x0000,0x0000, +0x0787,0x0000,0x0000, 0x0788,0x0000,0x0000, 0x0789,0x0000,0x0000, +0x078A,0x0000,0x0000, 0x078B,0x0000,0x0000, 0x078C,0x0000,0x0000, +0x078D,0x0000,0x0000, 0x078E,0x0000,0x0000, 0x078F,0x0000,0x0000, +0x0790,0x0000,0x0000, 0x0791,0x0000,0x0000, 0x0792,0x0000,0x0000, +0x0793,0x0000,0x0000, 0x0794,0x0000,0x0000, 0x0795,0x0000,0x0000, +0x0796,0x0000,0x0000, 0x0797,0x0000,0x0000, 0x0798,0x0000,0x0000, +0x0799,0x0000,0x0000, 0x079A,0x0000,0x0000, 0x079B,0x0000,0x0000, +0x079C,0x0000,0x0000, 0x079D,0x0000,0x0000, 0x079E,0x0000,0x0000, +0x079F,0x0000,0x0000, 0xFBC0,0xA728,0x0000, 0x07A0,0x0000,0x0000, +0x07A1,0x0000,0x0000, 0x07A2,0x0000,0x0000, 0x07A3,0x0000,0x0000, +0x07A4,0x0000,0x0000, 0x07A5,0x0000,0x0000, 0x07A6,0x0000,0x0000, +0x07A7,0x0000,0x0000, 0x07A8,0x0000,0x0000, 0x07A9,0x0000,0x0000, +0x07AA,0x0000,0x0000, 0x07AB,0x0000,0x0000, 0x07AC,0x0000,0x0000, +0x07AD,0x0000,0x0000, 0x07AE,0x0000,0x0000, 0x07AF,0x0000,0x0000, +0x07B0,0x0000,0x0000, 0x07B1,0x0000,0x0000, 0x07B2,0x0000,0x0000, +0x07B3,0x0000,0x0000, 0x07B4,0x0000,0x0000, 0x07B5,0x0000,0x0000, +0x07B6,0x0000,0x0000, 0x07B7,0x0000,0x0000, 0x07B8,0x0000,0x0000, +0x07B9,0x0000,0x0000, 0x07BA,0x0000,0x0000, 0x07BB,0x0000,0x0000, +0x07BC,0x0000,0x0000, 0x07BD,0x0000,0x0000, 0x07BE,0x0000,0x0000, +0x07BF,0x0000,0x0000, 0x07C0,0x0000,0x0000, 0x07C1,0x0000,0x0000, +0x07C2,0x0000,0x0000, 0xFBC0,0xA74C,0x0000, 0x07C3,0x0000,0x0000, +0xFBC0,0xA74E,0x0000, 0x07C4,0x0000,0x0000, 0x07C5,0x0000,0x0000, +0x07C6,0x0000,0x0000, 0x07C7,0x0000,0x0000, 0xFBC0,0xA753,0x0000, +0xFBC0,0xA754,0x0000, 0xFBC0,0xA755,0x0000, 0x07C8,0x0000,0x0000, +0xFBC0,0xA757,0x0000, 0x07C9,0x0000,0x0000, 0x07CA,0x0000,0x0000, +0x07CB,0x0000,0x0000, 0x07CC,0x0000,0x0000, 0x07CD,0x0000,0x0000, +0x07CE,0x0000,0x0000, 0x07CF,0x0000,0x0000, 0xFBC0,0xA75F,0x0000, +0xFBC0,0xA760,0x0000, 0x07D0,0x0000,0x0000, 0x07D1,0x0000,0x0000, +0x07D2,0x0000,0x0000, 0x07D3,0x0000,0x0000, 0x07D4,0x0000,0x0000, +0x07D5,0x0000,0x0000, 0x07D6,0x0000,0x0000, 0x07D7,0x0000,0x0000, +0x07D8,0x0000,0x0000, 0x07D9,0x0000,0x0000, 0x07DA,0x0000,0x0000, +0x07DB,0x0000,0x0000, 0x07DC,0x0000,0x0000, 0x07DD,0x0000,0x0000, +0x07DE,0x0000,0x0000, 0x07DF,0x0000,0x0000, 0x07E0,0x0000,0x0000, +0x07E1,0x0000,0x0000, 0x07E2,0x0000,0x0000, 0x07E3,0x0000,0x0000, +0x07E4,0x0000,0x0000, 0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, +0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, +0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, +0x0E32,0x0000,0x0000, 0x0E2A,0x0E29,0x0000, 0x0E2A,0x0000,0x0000, +0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, +0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, +0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, 0x0E2A,0x0E29,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x0E2A,0x0E29,0x0000, 0x07E5,0x0000,0x0000, 0xFBC0,0xA795,0x0000, +0xFBC0,0xA796,0x0000, 0xFBC0,0xA797,0x0000, 0x07E6,0x0000,0x0000, +0x07E7,0x0000,0x0000, 0x07E8,0x0000,0x0000, 0x07E9,0x0000,0x0000, +0x07EA,0x0000,0x0000, 0x07EB,0x0000,0x0000, 0x07EC,0x0000,0x0000, +0x07ED,0x0000,0x0000, 0x07EE,0x0000,0x0000, 0x07EF,0x0000,0x0000, +0x07F0,0x0000,0x0000, 0x07F1,0x0000,0x0000, 0x07F2,0x0000,0x0000, +0x07F3,0x0000,0x0000, 0x07F4,0x0000,0x0000, 0x07F5,0x0000,0x0000, +0x07F6,0x0000,0x0000, 0x07F7,0x0000,0x0000, 0x07F8,0x0000,0x0000, +0x07F9,0x0000,0x0000, 0x07FA,0x0000,0x0000, 0x07FB,0x0000,0x0000, +0x07FC,0x0000,0x0000, 0x07FD,0x0000,0x0000, 0xFBC0,0xA7B0,0x0000, +0x07FE,0x0000,0x0000, 0x07FF,0x0000,0x0000, 0x0800,0x0000,0x0000, +0x0801,0x0000,0x0000, 0x0802,0x0000,0x0000, 0x0803,0x0000,0x0000, +0x0804,0x0000,0x0000, 0x0805,0x0000,0x0000, 0x0806,0x0000,0x0000, +0x0807,0x0000,0x0000, 0x0808,0x0000,0x0000, 0x0809,0x0000,0x0000, +0x080A,0x0000,0x0000, 0x080B,0x0000,0x0000, 0xFBC0,0xA7BF,0x0000, +0xFBC0,0xA7C0,0x0000, 0xFBC0,0xA7C1,0x0000, 0xFBC0,0xA7C2,0x0000, +0xFBC0,0xA7C3,0x0000, 0xFBC0,0xA7C4,0x0000, 0xFBC0,0xA7C5,0x0000, +0xFBC0,0xA7C6,0x0000, 0xFBC0,0xA7C7,0x0000, 0xFBC0,0xA7C8,0x0000, +0xFBC0,0xA7C9,0x0000, 0xFBC0,0xA7CA,0x0000, 0xFBC0,0xA7CB,0x0000, +0xFBC0,0xA7CC,0x0000, 0xFBC0,0xA7CD,0x0000, 0xFBC0,0xA7CE,0x0000, +0xFBC0,0xA7CF,0x0000, 0x080C,0x0000,0x0000, 0x080D,0x0000,0x0000, +0x080E,0x0000,0x0000, 0x080F,0x0000,0x0000, 0x0810,0x0000,0x0000, +0x0811,0x0000,0x0000, 0x0812,0x0000,0x0000, 0x0813,0x0000,0x0000, +0x0814,0x0000,0x0000, 0x0815,0x0000,0x0000, 0x0816,0x0000,0x0000, +0x0817,0x0000,0x0000, 0x0818,0x0000,0x0000, 0x0819,0x0000,0x0000, +0x081A,0x0000,0x0000, 0x081B,0x0000,0x0000, 0x081C,0x0000,0x0000, +0x081D,0x0000,0x0000, 0x081E,0x0000,0x0000, 0x081F,0x0000,0x0000, +0x0820,0x0000,0x0000, 0x0821,0x0000,0x0000, 0x0822,0x0000,0x0000, +0x0823,0x0000,0x0000, 0x0824,0x0000,0x0000, 0x0825,0x0000,0x0000, +0x0826,0x0000,0x0000, 0x0827,0x0000,0x0000, 0xFBC0,0xA7EC,0x0000, +0xFBC0,0xA7ED,0x0000, 0xFBC0,0xA7EE,0x0000, 0xFBC0,0xA7EF,0x0000, +0x0828,0x0000,0x0000, 0x0829,0x0000,0x0000, 0x082A,0x0000,0x0000, +0x082B,0x0000,0x0000, 0x082C,0x0000,0x0000, 0x082D,0x0000,0x0000, +0x082E,0x0000,0x0000, 0x082F,0x0000,0x0000, 0x0830,0x0000,0x0000, +0x0831,0x0000,0x0000, 0x0832,0x0000,0x0000, 0x0833,0x0000,0x0000, +0x0834,0x0000,0x0000, 0x0835,0x0000,0x0000, 0x0836,0x0000,0x0000, +0x0837,0x0000,0x0000 }; + +uint16 page028data[]= { /* 2800 (2 weights per char) */ +0x0A29,0x0000, 0x0A2A,0x0000, 0x0A2B,0x0000, 0x0A2C,0x0000, +0x0A2D,0x0000, 0x0A2E,0x0000, 0x0A2F,0x0000, 0x0A30,0x0000, +0x0A31,0x0000, 0x0A32,0x0000, 0x0A33,0x0000, 0x0A34,0x0000, +0x0A35,0x0000, 0x0A36,0x0000, 0x0A37,0x0000, 0x0A38,0x0000, +0x0A39,0x0000, 0x0A3A,0x0000, 0x0A3B,0x0000, 0x0A3C,0x0000, +0x0A3D,0x0000, 0x0A3E,0x0000, 0x0A3F,0x0000, 0x0A40,0x0000, +0x0A41,0x0000, 0x0A42,0x0000, 0x0A43,0x0000, 0x0A44,0x0000, +0x0A45,0x0000, 0x0A46,0x0000, 0x0A47,0x0000, 0x0A48,0x0000, +0x0A49,0x0000, 0x0A4A,0x0000, 0x0A4B,0x0000, 0x0A4C,0x0000, +0x0A4D,0x0000, 0x0A4E,0x0000, 0x0A4F,0x0000, 0x0A50,0x0000, +0x0A51,0x0000, 0x0A52,0x0000, 0x0A53,0x0000, 0x0A54,0x0000, +0x0A55,0x0000, 0x0A56,0x0000, 0x0A57,0x0000, 0x0A58,0x0000, +0x0A59,0x0000, 0x0A5A,0x0000, 0x0A5B,0x0000, 0x0A5C,0x0000, +0x0A5D,0x0000, 0x0A5E,0x0000, 0x0A5F,0x0000, 0x0A60,0x0000, +0x0A61,0x0000, 0x0A62,0x0000, 0x0A63,0x0000, 0x0A64,0x0000, +0x0A65,0x0000, 0x0A66,0x0000, 0x0A67,0x0000, 0x0A68,0x0000, +0x0A69,0x0000, 0x0A6A,0x0000, 0x0A6B,0x0000, 0x0A6C,0x0000, +0x0A6D,0x0000, 0x0A6E,0x0000, 0x0A6F,0x0000, 0x0A70,0x0000, +0x0A71,0x0000, 0x0A72,0x0000, 0x0A73,0x0000, 0x0A74,0x0000, +0x0A75,0x0000, 0x0A76,0x0000, 0x0A77,0x0000, 0x0A78,0x0000, +0x0A79,0x0000, 0x0A7A,0x0000, 0x0A7B,0x0000, 0x0A7C,0x0000, +0x0A7D,0x0000, 0x0A7E,0x0000, 0x0A7F,0x0000, 0x0A80,0x0000, +0x0A81,0x0000, 0x0A82,0x0000, 0x0A83,0x0000, 0x0A84,0x0000, +0x0A85,0x0000, 0x0A86,0x0000, 0x0A87,0x0000, 0x0A88,0x0000, +0x0A89,0x0000, 0x0A8A,0x0000, 0x0A8B,0x0000, 0x0A8C,0x0000, +0x0A8D,0x0000, 0x0A8E,0x0000, 0x0A8F,0x0000, 0x0A90,0x0000, +0x0A91,0x0000, 0x0A92,0x0000, 0x0A93,0x0000, 0x0A94,0x0000, +0x0A95,0x0000, 0x0A96,0x0000, 0x0A97,0x0000, 0x0A98,0x0000, +0x0A99,0x0000, 0x0A9A,0x0000, 0x0A9B,0x0000, 0x0A9C,0x0000, +0x0A9D,0x0000, 0x0A9E,0x0000, 0x0A9F,0x0000, 0x0AA0,0x0000, +0x0AA1,0x0000, 0x0AA2,0x0000, 0x0AA3,0x0000, 0x0AA4,0x0000, +0x0AA5,0x0000, 0x0AA6,0x0000, 0x0AA7,0x0000, 0x0AA8,0x0000, +0x0AA9,0x0000, 0x0AAA,0x0000, 0x0AAB,0x0000, 0x0AAC,0x0000, +0x0AAD,0x0000, 0x0AAE,0x0000, 0x0AAF,0x0000, 0x0AB0,0x0000, +0x0AB1,0x0000, 0x0AB2,0x0000, 0x0AB3,0x0000, 0x0AB4,0x0000, +0x0AB5,0x0000, 0x0AB6,0x0000, 0x0AB7,0x0000, 0x0AB8,0x0000, +0x0AB9,0x0000, 0x0ABA,0x0000, 0x0ABB,0x0000, 0x0ABC,0x0000, +0x0ABD,0x0000, 0x0ABE,0x0000, 0x0ABF,0x0000, 0x0AC0,0x0000, +0x0AC1,0x0000, 0x0AC2,0x0000, 0x0AC3,0x0000, 0x0AC4,0x0000, +0x0AC5,0x0000, 0x0AC6,0x0000, 0x0AC7,0x0000, 0x0AC8,0x0000, +0x0AC9,0x0000, 0x0ACA,0x0000, 0x0ACB,0x0000, 0x0ACC,0x0000, +0x0ACD,0x0000, 0x0ACE,0x0000, 0x0ACF,0x0000, 0x0AD0,0x0000, +0x0AD1,0x0000, 0x0AD2,0x0000, 0x0AD3,0x0000, 0x0AD4,0x0000, +0x0AD5,0x0000, 0x0AD6,0x0000, 0x0AD7,0x0000, 0x0AD8,0x0000, +0x0AD9,0x0000, 0x0ADA,0x0000, 0x0ADB,0x0000, 0x0ADC,0x0000, +0x0ADD,0x0000, 0x0ADE,0x0000, 0x0ADF,0x0000, 0x0AE0,0x0000, +0x0AE1,0x0000, 0x0AE2,0x0000, 0x0AE3,0x0000, 0x0AE4,0x0000, +0x0AE5,0x0000, 0x0AE6,0x0000, 0x0AE7,0x0000, 0x0AE8,0x0000, +0x0AE9,0x0000, 0x0AEA,0x0000, 0x0AEB,0x0000, 0x0AEC,0x0000, +0x0AED,0x0000, 0x0AEE,0x0000, 0x0AEF,0x0000, 0x0AF0,0x0000, +0x0AF1,0x0000, 0x0AF2,0x0000, 0x0AF3,0x0000, 0x0AF4,0x0000, +0x0AF5,0x0000, 0x0AF6,0x0000, 0x0AF7,0x0000, 0x0AF8,0x0000, +0x0AF9,0x0000, 0x0AFA,0x0000, 0x0AFB,0x0000, 0x0AFC,0x0000, +0x0AFD,0x0000, 0x0AFE,0x0000, 0x0AFF,0x0000, 0x0B00,0x0000, +0x0B01,0x0000, 0x0B02,0x0000, 0x0B03,0x0000, 0x0B04,0x0000, +0x0B05,0x0000, 0x0B06,0x0000, 0x0B07,0x0000, 0x0B08,0x0000, +0x0B09,0x0000, 0x0B0A,0x0000, 0x0B0B,0x0000, 0x0B0C,0x0000, +0x0B0D,0x0000, 0x0B0E,0x0000, 0x0B0F,0x0000, 0x0B10,0x0000, +0x0B11,0x0000, 0x0B12,0x0000, 0x0B13,0x0000, 0x0B14,0x0000, +0x0B15,0x0000, 0x0B16,0x0000, 0x0B17,0x0000, 0x0B18,0x0000, +0x0B19,0x0000, 0x0B1A,0x0000, 0x0B1B,0x0000, 0x0B1C,0x0000, +0x0B1D,0x0000, 0x0B1E,0x0000, 0x0B1F,0x0000, 0x0B20,0x0000, +0x0B21,0x0000, 0x0B22,0x0000, 0x0B23,0x0000, 0x0B24,0x0000, +0x0B25,0x0000, 0x0B26,0x0000, 0x0B27,0x0000, 0x0B28,0x0000 +}; + +uint16 page029data[]= { /* 2900 (2 weights per char) */ +0x0838,0x0000, 0x0839,0x0000, 0x083A,0x0000, 0x083B,0x0000, +0x083C,0x0000, 0x083D,0x0000, 0x083E,0x0000, 0x083F,0x0000, +0x0840,0x0000, 0x0841,0x0000, 0x0842,0x0000, 0x0843,0x0000, +0x0844,0x0000, 0x0845,0x0000, 0x0846,0x0000, 0x0847,0x0000, +0x0848,0x0000, 0x0849,0x0000, 0x084A,0x0000, 0x084B,0x0000, +0x084C,0x0000, 0x084D,0x0000, 0x084E,0x0000, 0x084F,0x0000, +0x0850,0x0000, 0x0851,0x0000, 0x0852,0x0000, 0x0853,0x0000, +0x0854,0x0000, 0x0855,0x0000, 0x0856,0x0000, 0x0857,0x0000, +0x0858,0x0000, 0x0859,0x0000, 0x085A,0x0000, 0x085B,0x0000, +0x085C,0x0000, 0x085D,0x0000, 0x085E,0x0000, 0x085F,0x0000, +0x0860,0x0000, 0x0861,0x0000, 0x0862,0x0000, 0x0863,0x0000, +0x0864,0x0000, 0x0865,0x0000, 0x0866,0x0000, 0x0867,0x0000, +0x0868,0x0000, 0x0869,0x0000, 0x086A,0x0000, 0x086B,0x0000, +0x086C,0x0000, 0x086D,0x0000, 0x086E,0x0000, 0x086F,0x0000, +0x0870,0x0000, 0x0871,0x0000, 0x0872,0x0000, 0x0873,0x0000, +0x0874,0x0000, 0x0875,0x0000, 0x0876,0x0000, 0x0877,0x0000, +0x0878,0x0000, 0x0879,0x0000, 0x087A,0x0000, 0x087B,0x0000, +0x087C,0x0000, 0x087D,0x0000, 0x087E,0x0000, 0x087F,0x0000, +0x0880,0x0000, 0x0881,0x0000, 0x0882,0x0000, 0x0883,0x0000, +0x0884,0x0000, 0x0885,0x0000, 0x0886,0x0000, 0x0887,0x0000, +0x0888,0x0000, 0x0889,0x0000, 0x088A,0x0000, 0x088B,0x0000, +0x088C,0x0000, 0x088D,0x0000, 0x088E,0x0000, 0x088F,0x0000, +0x0890,0x0000, 0x0891,0x0000, 0x0892,0x0000, 0x0893,0x0000, +0x0894,0x0000, 0x0895,0x0000, 0x0896,0x0000, 0x0897,0x0000, +0x0898,0x0000, 0x0899,0x0000, 0x089A,0x0000, 0x089B,0x0000, +0x089C,0x0000, 0x089D,0x0000, 0x089E,0x0000, 0x089F,0x0000, +0x08A0,0x0000, 0x08A1,0x0000, 0x08A2,0x0000, 0x08A3,0x0000, +0x08A4,0x0000, 0x08A5,0x0000, 0x08A6,0x0000, 0x08A7,0x0000, +0x08A8,0x0000, 0x08A9,0x0000, 0x08AA,0x0000, 0x08AB,0x0000, +0x08AC,0x0000, 0x08AD,0x0000, 0x08AE,0x0000, 0x08AF,0x0000, +0x08B0,0x0000, 0x08B1,0x0000, 0x08B2,0x0000, 0x08B3,0x0000, +0x08B4,0x0000, 0x08B5,0x0000, 0x08B6,0x0000, 0x08B7,0x0000, +0x08B8,0x0000, 0x08B9,0x0000, 0x08BA,0x0000, 0x0298,0x0000, +0x0299,0x0000, 0x029A,0x0000, 0x029B,0x0000, 0x029C,0x0000, +0x029D,0x0000, 0x029E,0x0000, 0x029F,0x0000, 0x02A0,0x0000, +0x02A1,0x0000, 0x02A2,0x0000, 0x02A3,0x0000, 0x02A4,0x0000, +0x02A5,0x0000, 0x02A6,0x0000, 0x02A7,0x0000, 0x02A8,0x0000, +0x02A9,0x0000, 0x02AA,0x0000, 0x02AB,0x0000, 0x02AC,0x0000, +0x02AD,0x0000, 0x08BB,0x0000, 0x08BC,0x0000, 0x08BD,0x0000, +0x08BE,0x0000, 0x08BF,0x0000, 0x08C0,0x0000, 0x08C1,0x0000, +0x08C2,0x0000, 0x08C3,0x0000, 0x08C4,0x0000, 0x08C5,0x0000, +0x08C6,0x0000, 0x08C7,0x0000, 0x08C8,0x0000, 0x08C9,0x0000, +0x08CA,0x0000, 0x08CB,0x0000, 0x08CC,0x0000, 0x08CD,0x0000, +0x08CE,0x0000, 0x08CF,0x0000, 0x08D0,0x0000, 0x08D1,0x0000, +0x08D2,0x0000, 0x08D3,0x0000, 0x08D4,0x0000, 0x08D5,0x0000, +0x08D6,0x0000, 0x08D7,0x0000, 0x08D8,0x0000, 0x08D9,0x0000, +0x08DA,0x0000, 0x08DB,0x0000, 0x08DC,0x0000, 0x08DD,0x0000, +0x08DE,0x0000, 0x08DF,0x0000, 0x08E0,0x0000, 0x08E1,0x0000, +0x08E2,0x0000, 0x08E3,0x0000, 0x08E4,0x0000, 0x08E5,0x0000, +0x08E6,0x0000, 0x08E7,0x0000, 0x08E8,0x0000, 0x08E9,0x0000, +0x08EA,0x0000, 0x08EB,0x0000, 0x08EC,0x0000, 0x08ED,0x0000, +0x08EE,0x0000, 0x08EF,0x0000, 0x08F0,0x0000, 0x08F1,0x0000, +0x08F2,0x0000, 0x08F3,0x0000, 0x08F4,0x0000, 0x08F5,0x0000, +0x08F6,0x0000, 0x08F7,0x0000, 0x08F8,0x0000, 0x08F9,0x0000, +0x08FA,0x0000, 0x08FB,0x0000, 0x08FC,0x0000, 0x08FD,0x0000, +0x08FE,0x0000, 0x08FF,0x0000, 0x0900,0x0000, 0x0901,0x0000, +0x0902,0x0000, 0x0903,0x0000, 0x0904,0x0000, 0x0905,0x0000, +0x0906,0x0000, 0x0907,0x0000, 0x0908,0x0000, 0x0909,0x0000, +0x090A,0x0000, 0x090B,0x0000, 0x090C,0x0000, 0x090D,0x0000, +0x090E,0x0000, 0x090F,0x0000, 0x0910,0x0000, 0x0911,0x0000, +0x0912,0x0000, 0x0913,0x0000, 0x0914,0x0000, 0x0915,0x0000, +0x0916,0x0000, 0x0917,0x0000, 0x0918,0x0000, 0x0919,0x0000, +0x091A,0x0000, 0x091B,0x0000, 0x091C,0x0000, 0x091D,0x0000, +0x0296,0x0000, 0x0297,0x0000, 0x091E,0x0000, 0x091F,0x0000 +}; + +uint16 page02Adata[]= { /* 2A00 (5 weights per char) */ +0x0920,0x0000,0x0000,0x0000,0x0000, +0x0921,0x0000,0x0000,0x0000,0x0000, +0x0922,0x0000,0x0000,0x0000,0x0000, +0x0923,0x0000,0x0000,0x0000,0x0000, +0x0924,0x0000,0x0000,0x0000,0x0000, +0x0925,0x0000,0x0000,0x0000,0x0000, +0x0926,0x0000,0x0000,0x0000,0x0000, +0x0927,0x0000,0x0000,0x0000,0x0000, +0x0928,0x0000,0x0000,0x0000,0x0000, +0x0929,0x0000,0x0000,0x0000,0x0000, +0x092A,0x0000,0x0000,0x0000,0x0000, +0x092B,0x0000,0x0000,0x0000,0x0000, +0x044B,0x044B,0x044B,0x044B,0x0000, +0x092C,0x0000,0x0000,0x0000,0x0000, +0x092D,0x0000,0x0000,0x0000,0x0000, +0x092E,0x0000,0x0000,0x0000,0x0000, +0x092F,0x0000,0x0000,0x0000,0x0000, +0x0930,0x0000,0x0000,0x0000,0x0000, +0x0931,0x0000,0x0000,0x0000,0x0000, +0x0932,0x0000,0x0000,0x0000,0x0000, +0x0933,0x0000,0x0000,0x0000,0x0000, +0x0934,0x0000,0x0000,0x0000,0x0000, +0x0935,0x0000,0x0000,0x0000,0x0000, +0x0936,0x0000,0x0000,0x0000,0x0000, +0x0937,0x0000,0x0000,0x0000,0x0000, +0x0938,0x0000,0x0000,0x0000,0x0000, +0x0939,0x0000,0x0000,0x0000,0x0000, +0x093A,0x0000,0x0000,0x0000,0x0000, +0x093B,0x0000,0x0000,0x0000,0x0000, +0x093C,0x0000,0x0000,0x0000,0x0000, +0x093D,0x0000,0x0000,0x0000,0x0000, +0x093E,0x0000,0x0000,0x0000,0x0000, +0x093F,0x0000,0x0000,0x0000,0x0000, +0x0940,0x0000,0x0000,0x0000,0x0000, +0x0941,0x0000,0x0000,0x0000,0x0000, +0x0942,0x0000,0x0000,0x0000,0x0000, +0x0943,0x0000,0x0000,0x0000,0x0000, +0x0944,0x0000,0x0000,0x0000,0x0000, +0x0945,0x0000,0x0000,0x0000,0x0000, +0x0946,0x0000,0x0000,0x0000,0x0000, +0x0947,0x0000,0x0000,0x0000,0x0000, +0x0948,0x0000,0x0000,0x0000,0x0000, +0x0949,0x0000,0x0000,0x0000,0x0000, +0x094A,0x0000,0x0000,0x0000,0x0000, +0x094B,0x0000,0x0000,0x0000,0x0000, +0x094C,0x0000,0x0000,0x0000,0x0000, +0x094D,0x0000,0x0000,0x0000,0x0000, +0x094E,0x0000,0x0000,0x0000,0x0000, +0x094F,0x0000,0x0000,0x0000,0x0000, +0x0950,0x0000,0x0000,0x0000,0x0000, +0x0951,0x0000,0x0000,0x0000,0x0000, +0x0952,0x0000,0x0000,0x0000,0x0000, +0x0953,0x0000,0x0000,0x0000,0x0000, +0x0954,0x0000,0x0000,0x0000,0x0000, +0x0955,0x0000,0x0000,0x0000,0x0000, +0x0956,0x0000,0x0000,0x0000,0x0000, +0x0957,0x0000,0x0000,0x0000,0x0000, +0x0958,0x0000,0x0000,0x0000,0x0000, +0x0959,0x0000,0x0000,0x0000,0x0000, +0x095A,0x0000,0x0000,0x0000,0x0000, +0x095B,0x0000,0x0000,0x0000,0x0000, +0x095C,0x0000,0x0000,0x0000,0x0000, +0x095D,0x0000,0x0000,0x0000,0x0000, +0x095E,0x0000,0x0000,0x0000,0x0000, +0x095F,0x0000,0x0000,0x0000,0x0000, +0x0960,0x0000,0x0000,0x0000,0x0000, +0x0961,0x0000,0x0000,0x0000,0x0000, +0x0962,0x0000,0x0000,0x0000,0x0000, +0x0963,0x0000,0x0000,0x0000,0x0000, +0x0964,0x0000,0x0000,0x0000,0x0000, +0x0965,0x0000,0x0000,0x0000,0x0000, +0x0966,0x0000,0x0000,0x0000,0x0000, +0x0967,0x0000,0x0000,0x0000,0x0000, +0x0968,0x0000,0x0000,0x0000,0x0000, +0x0969,0x0000,0x0000,0x0000,0x0000, +0x096A,0x0000,0x0000,0x0000,0x0000, +0x096B,0x0000,0x0000,0x0000,0x0000, +0x096C,0x0000,0x0000,0x0000,0x0000, +0x096D,0x0000,0x0000,0x0000,0x0000, +0x096E,0x0000,0x0000,0x0000,0x0000, +0x096F,0x0000,0x0000,0x0000,0x0000, +0x0970,0x0000,0x0000,0x0000,0x0000, +0x0971,0x0000,0x0000,0x0000,0x0000, +0x0972,0x0000,0x0000,0x0000,0x0000, +0x0973,0x0000,0x0000,0x0000,0x0000, +0x0974,0x0000,0x0000,0x0000,0x0000, +0x0975,0x0000,0x0000,0x0000,0x0000, +0x0976,0x0000,0x0000,0x0000,0x0000, +0x0977,0x0000,0x0000,0x0000,0x0000, +0x0978,0x0000,0x0000,0x0000,0x0000, +0x0979,0x0000,0x0000,0x0000,0x0000, +0x097A,0x0000,0x0000,0x0000,0x0000, +0x097B,0x0000,0x0000,0x0000,0x0000, +0x097C,0x0000,0x0000,0x0000,0x0000, +0x097D,0x0000,0x0000,0x0000,0x0000, +0x097E,0x0000,0x0000,0x0000,0x0000, +0x097F,0x0000,0x0000,0x0000,0x0000, +0x0980,0x0000,0x0000,0x0000,0x0000, +0x0981,0x0000,0x0000,0x0000,0x0000, +0x0982,0x0000,0x0000,0x0000,0x0000, +0x0983,0x0000,0x0000,0x0000,0x0000, +0x0984,0x0000,0x0000,0x0000,0x0000, +0x0985,0x0000,0x0000,0x0000,0x0000, +0x0986,0x0000,0x0000,0x0000,0x0000, +0x0987,0x0000,0x0000,0x0000,0x0000, +0x0988,0x0000,0x0000,0x0000,0x0000, +0x0989,0x0000,0x0000,0x0000,0x0000, +0x098A,0x0000,0x0000,0x0000,0x0000, +0x098B,0x0000,0x0000,0x0000,0x0000, +0x098C,0x0000,0x0000,0x0000,0x0000, +0x098D,0x0000,0x0000,0x0000,0x0000, +0x098E,0x0000,0x0000,0x0000,0x0000, +0x098F,0x0000,0x0000,0x0000,0x0000, +0x0990,0x0000,0x0000,0x0000,0x0000, +0x0991,0x0000,0x0000,0x0000,0x0000, +0x0992,0x0000,0x0000,0x0000,0x0000, +0x023D,0x023D,0x042D,0x0000,0x0000, +0x042D,0x042D,0x0000,0x0000,0x0000, +0x042D,0x042D,0x042D,0x0000,0x0000, +0x0993,0x0000,0x0000,0x0000,0x0000, +0x0994,0x0000,0x0000,0x0000,0x0000, +0x0995,0x0000,0x0000,0x0000,0x0000, +0x0996,0x0000,0x0000,0x0000,0x0000, +0x0997,0x0000,0x0000,0x0000,0x0000, +0x0998,0x0000,0x0000,0x0000,0x0000, +0x0999,0x0000,0x0000,0x0000,0x0000, +0x099A,0x0000,0x0000,0x0000,0x0000, +0x099B,0x0000,0x0000,0x0000,0x0000, +0x099C,0x0000,0x0000,0x0000,0x0000, +0x099D,0x0000,0x0000,0x0000,0x0000, +0x099E,0x0000,0x0000,0x0000,0x0000, +0x099F,0x0000,0x0000,0x0000,0x0000, +0x09A0,0x0000,0x0000,0x0000,0x0000, +0x09A1,0x0000,0x0000,0x0000,0x0000, +0x09A2,0x0000,0x0000,0x0000,0x0000, +0x09A3,0x0000,0x0000,0x0000,0x0000, +0x09A4,0x0000,0x0000,0x0000,0x0000, +0x09A5,0x0000,0x0000,0x0000,0x0000, +0x09A6,0x0000,0x0000,0x0000,0x0000, +0x09A7,0x0000,0x0000,0x0000,0x0000, +0x09A8,0x0000,0x0000,0x0000,0x0000, +0x09A9,0x0000,0x0000,0x0000,0x0000, +0x09AA,0x0000,0x0000,0x0000,0x0000, +0x09AB,0x0000,0x0000,0x0000,0x0000, +0x09AC,0x0000,0x0000,0x0000,0x0000, +0x09AD,0x0000,0x0000,0x0000,0x0000, +0x09AE,0x0000,0x0000,0x0000,0x0000, +0x09AF,0x0000,0x0000,0x0000,0x0000, +0x09B0,0x0000,0x0000,0x0000,0x0000, +0x09B1,0x0000,0x0000,0x0000,0x0000, +0x09B2,0x0000,0x0000,0x0000,0x0000, +0x09B3,0x0000,0x0000,0x0000,0x0000, +0x09B4,0x0000,0x0000,0x0000,0x0000, +0x09B5,0x0000,0x0000,0x0000,0x0000, +0x09B6,0x0000,0x0000,0x0000,0x0000, +0x09B7,0x0000,0x0000,0x0000,0x0000, +0x09B8,0x0000,0x0000,0x0000,0x0000, +0x09B9,0x0000,0x0000,0x0000,0x0000, +0x09BA,0x0000,0x0000,0x0000,0x0000, +0x09BB,0x0000,0x0000,0x0000,0x0000, +0x09BC,0x0000,0x0000,0x0000,0x0000, +0x09BD,0x0000,0x0000,0x0000,0x0000, +0x09BE,0x0000,0x0000,0x0000,0x0000, +0x09BF,0x0000,0x0000,0x0000,0x0000, +0x09C0,0x0000,0x0000,0x0000,0x0000, +0x09C1,0x0000,0x0000,0x0000,0x0000, +0x09C2,0x0000,0x0000,0x0000,0x0000, +0x09C3,0x0000,0x0000,0x0000,0x0000, +0x09C4,0x0000,0x0000,0x0000,0x0000, +0x09C5,0x0000,0x0000,0x0000,0x0000, +0x09C6,0x0000,0x0000,0x0000,0x0000, +0x09C7,0x0000,0x0000,0x0000,0x0000, +0x09C8,0x0000,0x0000,0x0000,0x0000, +0x09C9,0x0000,0x0000,0x0000,0x0000, +0x09CA,0x0000,0x0000,0x0000,0x0000, +0x09CB,0x0000,0x0000,0x0000,0x0000, +0x09CC,0x0000,0x0000,0x0000,0x0000, +0x09CD,0x0000,0x0000,0x0000,0x0000, +0x09CE,0x0000,0x0000,0x0000,0x0000, +0x09CF,0x0000,0x0000,0x0000,0x0000, +0x09D0,0x0000,0x0000,0x0000,0x0000, +0x09D1,0x0000,0x0000,0x0000,0x0000, +0x09D2,0x0000,0x0000,0x0000,0x0000, +0x09D3,0x0000,0x0000,0x0000,0x0000, +0x09D4,0x0000,0x0000,0x0000,0x0000, +0x09D5,0x0000,0x0000,0x0000,0x0000, +0x09D6,0x0000,0x0000,0x0000,0x0000, +0x09D7,0x0000,0x0000,0x0000,0x0000, +0x09D8,0x0000,0x0000,0x0000,0x0000, +0x09D9,0x0000,0x0000,0x0000,0x0000, +0x09DA,0x0000,0x0000,0x0000,0x0000, +0x09DB,0x0000,0x0000,0x0000,0x0000, +0x09DC,0x0000,0x0000,0x0000,0x0000, +0x09DD,0x0000,0x0000,0x0000,0x0000, +0x09DE,0x0000,0x0000,0x0000,0x0000, +0x09DF,0x0000,0x0000,0x0000,0x0000, +0x09E0,0x0000,0x0000,0x0000,0x0000, +0x09E1,0x0000,0x0000,0x0000,0x0000, +0x09E2,0x0000,0x0000,0x0000,0x0000, +0x09E3,0x0000,0x0000,0x0000,0x0000, +0x09E4,0x0000,0x0000,0x0000,0x0000, +0x09E5,0x0000,0x0000,0x0000,0x0000, +0x09E6,0x0000,0x0000,0x0000,0x0000, +0x09E7,0x0000,0x0000,0x0000,0x0000, +0x09E8,0x0000,0x0000,0x0000,0x0000, +0x09E9,0x0000,0x0000,0x0000,0x0000, +0x09EA,0x0000,0x0000,0x0000,0x0000, +0x09EB,0x0000,0x0000,0x0000,0x0000, +0x09EC,0x0000,0x0000,0x0000,0x0000, +0x09ED,0x0000,0x0000,0x0000,0x0000, +0x09EE,0x0000,0x0000,0x0000,0x0000, +0x09EF,0x0000,0x0000,0x0000,0x0000, +0x09F0,0x0000,0x0000,0x0000,0x0000, +0x09F1,0x0000,0x0000,0x0000,0x0000, +0x09F2,0x0000,0x0000,0x0000,0x0000, +0x09F3,0x0000,0x0000,0x0000,0x0000, +0x09F4,0x0000,0x0000,0x0000,0x0000, +0x09F5,0x0000,0x0000,0x0000,0x0000, +0x09F6,0x0000,0x0000,0x0000,0x0000, +0x09F7,0x0000,0x0000,0x0000,0x0000, +0x09F8,0x0000,0x0000,0x0000,0x0000, +0x09F8,0x0000,0x0000,0x0000,0x0000, +0x09F9,0x0000,0x0000,0x0000,0x0000, +0x09FA,0x0000,0x0000,0x0000,0x0000, +0x09FB,0x0000,0x0000,0x0000,0x0000, +0x09FC,0x0000,0x0000,0x0000,0x0000, +0x09FD,0x0000,0x0000,0x0000,0x0000, +0x09FE,0x0000,0x0000,0x0000,0x0000, +0x09FF,0x0000,0x0000,0x0000,0x0000, +0x0A00,0x0000,0x0000,0x0000,0x0000, +0x0A01,0x0000,0x0000,0x0000,0x0000, +0x0A02,0x0000,0x0000,0x0000,0x0000, +0x0A03,0x0000,0x0000,0x0000,0x0000, +0x0A04,0x0000,0x0000,0x0000,0x0000, +0x0A05,0x0000,0x0000,0x0000,0x0000, +0x0A06,0x0000,0x0000,0x0000,0x0000, +0x0A07,0x0000,0x0000,0x0000,0x0000, +0x0A08,0x0000,0x0000,0x0000,0x0000, +0x0A09,0x0000,0x0000,0x0000,0x0000, +0x0A0A,0x0000,0x0000,0x0000,0x0000, +0x0A0B,0x0000,0x0000,0x0000,0x0000, +0x0A0C,0x0000,0x0000,0x0000,0x0000, +0x0A0D,0x0000,0x0000,0x0000,0x0000, +0x0A0E,0x0000,0x0000,0x0000,0x0000, +0x0A0F,0x0000,0x0000,0x0000,0x0000, +0x0A10,0x0000,0x0000,0x0000,0x0000, +0x0A11,0x0000,0x0000,0x0000,0x0000, +0x0A12,0x0000,0x0000,0x0000,0x0000, +0x0A13,0x0000,0x0000,0x0000,0x0000, +0x0A14,0x0000,0x0000,0x0000,0x0000, +0x0A15,0x0000,0x0000,0x0000,0x0000, +0x0A16,0x0000,0x0000,0x0000,0x0000, +0x0A17,0x0000,0x0000,0x0000,0x0000, +0x0A18,0x0000,0x0000,0x0000,0x0000, +0x0A19,0x0000,0x0000,0x0000,0x0000, +0x0A1A,0x0000,0x0000,0x0000,0x0000 +}; + +uint16 page02Bdata[]= { /* 2B00 (3 weights per char) */ +0x0A1B,0x0000,0x0000, 0x0A1C,0x0000,0x0000, 0x0A1D,0x0000,0x0000, +0x0A1E,0x0000,0x0000, 0x0A1F,0x0000,0x0000, 0x0A20,0x0000,0x0000, +0x0A21,0x0000,0x0000, 0x0A22,0x0000,0x0000, 0x0A23,0x0000,0x0000, +0x0A24,0x0000,0x0000, 0x0A25,0x0000,0x0000, 0x0A26,0x0000,0x0000, +0x0A27,0x0000,0x0000, 0x0A28,0x0000,0x0000, 0xFBC0,0xAB0E,0x0000, +0xFBC0,0xAB0F,0x0000, 0xFBC0,0xAB10,0x0000, 0xFBC0,0xAB11,0x0000, +0xFBC0,0xAB12,0x0000, 0xFBC0,0xAB13,0x0000, 0xFBC0,0xAB14,0x0000, +0xFBC0,0xAB15,0x0000, 0xFBC0,0xAB16,0x0000, 0xFBC0,0xAB17,0x0000, +0xFBC0,0xAB18,0x0000, 0xFBC0,0xAB19,0x0000, 0xFBC0,0xAB1A,0x0000, +0xFBC0,0xAB1B,0x0000, 0xFBC0,0xAB1C,0x0000, 0xFBC0,0xAB1D,0x0000, +0xFBC0,0xAB1E,0x0000, 0xFBC0,0xAB1F,0x0000, 0xFBC0,0xAB20,0x0000, +0xFBC0,0xAB21,0x0000, 0xFBC0,0xAB22,0x0000, 0xFBC0,0xAB23,0x0000, +0xFBC0,0xAB24,0x0000, 0xFBC0,0xAB25,0x0000, 0xFBC0,0xAB26,0x0000, +0xFBC0,0xAB27,0x0000, 0xFBC0,0xAB28,0x0000, 0xFBC0,0xAB29,0x0000, +0xFBC0,0xAB2A,0x0000, 0xFBC0,0xAB2B,0x0000, 0xFBC0,0xAB2C,0x0000, +0xFBC0,0xAB2D,0x0000, 0xFBC0,0xAB2E,0x0000, 0xFBC0,0xAB2F,0x0000, +0xFBC0,0xAB30,0x0000, 0xFBC0,0xAB31,0x0000, 0xFBC0,0xAB32,0x0000, +0xFBC0,0xAB33,0x0000, 0xFBC0,0xAB34,0x0000, 0xFBC0,0xAB35,0x0000, +0xFBC0,0xAB36,0x0000, 0xFBC0,0xAB37,0x0000, 0xFBC0,0xAB38,0x0000, +0xFBC0,0xAB39,0x0000, 0xFBC0,0xAB3A,0x0000, 0xFBC0,0xAB3B,0x0000, +0xFBC0,0xAB3C,0x0000, 0xFBC0,0xAB3D,0x0000, 0xFBC0,0xAB3E,0x0000, +0xFBC0,0xAB3F,0x0000, 0xFBC0,0xAB40,0x0000, 0xFBC0,0xAB41,0x0000, +0xFBC0,0xAB42,0x0000, 0xFBC0,0xAB43,0x0000, 0xFBC0,0xAB44,0x0000, +0xFBC0,0xAB45,0x0000, 0xFBC0,0xAB46,0x0000, 0xFBC0,0xAB47,0x0000, +0xFBC0,0xAB48,0x0000, 0xFBC0,0xAB49,0x0000, 0xFBC0,0xAB4A,0x0000, +0xFBC0,0xAB4B,0x0000, 0xFBC0,0xAB4C,0x0000, 0xFBC0,0xAB4D,0x0000, +0xFBC0,0xAB4E,0x0000, 0xFBC0,0xAB4F,0x0000, 0xFBC0,0xAB50,0x0000, +0xFBC0,0xAB51,0x0000, 0xFBC0,0xAB52,0x0000, 0xFBC0,0xAB53,0x0000, +0xFBC0,0xAB54,0x0000, 0xFBC0,0xAB55,0x0000, 0xFBC0,0xAB56,0x0000, +0xFBC0,0xAB57,0x0000, 0xFBC0,0xAB58,0x0000, 0xFBC0,0xAB59,0x0000, +0xFBC0,0xAB5A,0x0000, 0xFBC0,0xAB5B,0x0000, 0xFBC0,0xAB5C,0x0000, +0xFBC0,0xAB5D,0x0000, 0xFBC0,0xAB5E,0x0000, 0xFBC0,0xAB5F,0x0000, +0xFBC0,0xAB60,0x0000, 0xFBC0,0xAB61,0x0000, 0xFBC0,0xAB62,0x0000, +0xFBC0,0xAB63,0x0000, 0xFBC0,0xAB64,0x0000, 0xFBC0,0xAB65,0x0000, +0xFBC0,0xAB66,0x0000, 0xFBC0,0xAB67,0x0000, 0xFBC0,0xAB68,0x0000, +0xFBC0,0xAB69,0x0000, 0xFBC0,0xAB6A,0x0000, 0xFBC0,0xAB6B,0x0000, +0xFBC0,0xAB6C,0x0000, 0xFBC0,0xAB6D,0x0000, 0xFBC0,0xAB6E,0x0000, +0xFBC0,0xAB6F,0x0000, 0xFBC0,0xAB70,0x0000, 0xFBC0,0xAB71,0x0000, +0xFBC0,0xAB72,0x0000, 0xFBC0,0xAB73,0x0000, 0xFBC0,0xAB74,0x0000, +0xFBC0,0xAB75,0x0000, 0xFBC0,0xAB76,0x0000, 0xFBC0,0xAB77,0x0000, +0xFBC0,0xAB78,0x0000, 0xFBC0,0xAB79,0x0000, 0xFBC0,0xAB7A,0x0000, +0xFBC0,0xAB7B,0x0000, 0xFBC0,0xAB7C,0x0000, 0xFBC0,0xAB7D,0x0000, +0xFBC0,0xAB7E,0x0000, 0xFBC0,0xAB7F,0x0000, 0xFBC0,0xAB80,0x0000, +0xFBC0,0xAB81,0x0000, 0xFBC0,0xAB82,0x0000, 0xFBC0,0xAB83,0x0000, +0xFBC0,0xAB84,0x0000, 0xFBC0,0xAB85,0x0000, 0xFBC0,0xAB86,0x0000, +0xFBC0,0xAB87,0x0000, 0xFBC0,0xAB88,0x0000, 0xFBC0,0xAB89,0x0000, +0xFBC0,0xAB8A,0x0000, 0xFBC0,0xAB8B,0x0000, 0xFBC0,0xAB8C,0x0000, +0xFBC0,0xAB8D,0x0000, 0xFBC0,0xAB8E,0x0000, 0xFBC0,0xAB8F,0x0000, +0xFBC0,0xAB90,0x0000, 0xFBC0,0xAB91,0x0000, 0xFBC0,0xAB92,0x0000, +0xFBC0,0xAB93,0x0000, 0xFBC0,0xAB94,0x0000, 0xFBC0,0xAB95,0x0000, +0xFBC0,0xAB96,0x0000, 0xFBC0,0xAB97,0x0000, 0xFBC0,0xAB98,0x0000, +0xFBC0,0xAB99,0x0000, 0xFBC0,0xAB9A,0x0000, 0xFBC0,0xAB9B,0x0000, +0xFBC0,0xAB9C,0x0000, 0xFBC0,0xAB9D,0x0000, 0xFBC0,0xAB9E,0x0000, +0xFBC0,0xAB9F,0x0000, 0xFBC0,0xABA0,0x0000, 0xFBC0,0xABA1,0x0000, +0xFBC0,0xABA2,0x0000, 0xFBC0,0xABA3,0x0000, 0xFBC0,0xABA4,0x0000, +0xFBC0,0xABA5,0x0000, 0xFBC0,0xABA6,0x0000, 0xFBC0,0xABA7,0x0000, +0xFBC0,0xABA8,0x0000, 0xFBC0,0xABA9,0x0000, 0xFBC0,0xABAA,0x0000, +0xFBC0,0xABAB,0x0000, 0xFBC0,0xABAC,0x0000, 0xFBC0,0xABAD,0x0000, +0xFBC0,0xABAE,0x0000, 0xFBC0,0xABAF,0x0000, 0xFBC0,0xABB0,0x0000, +0xFBC0,0xABB1,0x0000, 0xFBC0,0xABB2,0x0000, 0xFBC0,0xABB3,0x0000, +0xFBC0,0xABB4,0x0000, 0xFBC0,0xABB5,0x0000, 0xFBC0,0xABB6,0x0000, +0xFBC0,0xABB7,0x0000, 0xFBC0,0xABB8,0x0000, 0xFBC0,0xABB9,0x0000, +0xFBC0,0xABBA,0x0000, 0xFBC0,0xABBB,0x0000, 0xFBC0,0xABBC,0x0000, +0xFBC0,0xABBD,0x0000, 0xFBC0,0xABBE,0x0000, 0xFBC0,0xABBF,0x0000, +0xFBC0,0xABC0,0x0000, 0xFBC0,0xABC1,0x0000, 0xFBC0,0xABC2,0x0000, +0xFBC0,0xABC3,0x0000, 0xFBC0,0xABC4,0x0000, 0xFBC0,0xABC5,0x0000, +0xFBC0,0xABC6,0x0000, 0xFBC0,0xABC7,0x0000, 0xFBC0,0xABC8,0x0000, +0xFBC0,0xABC9,0x0000, 0xFBC0,0xABCA,0x0000, 0xFBC0,0xABCB,0x0000, +0xFBC0,0xABCC,0x0000, 0xFBC0,0xABCD,0x0000, 0xFBC0,0xABCE,0x0000, +0xFBC0,0xABCF,0x0000, 0xFBC0,0xABD0,0x0000, 0xFBC0,0xABD1,0x0000, +0xFBC0,0xABD2,0x0000, 0xFBC0,0xABD3,0x0000, 0xFBC0,0xABD4,0x0000, +0xFBC0,0xABD5,0x0000, 0xFBC0,0xABD6,0x0000, 0xFBC0,0xABD7,0x0000, +0xFBC0,0xABD8,0x0000, 0xFBC0,0xABD9,0x0000, 0xFBC0,0xABDA,0x0000, +0xFBC0,0xABDB,0x0000, 0xFBC0,0xABDC,0x0000, 0xFBC0,0xABDD,0x0000, +0xFBC0,0xABDE,0x0000, 0xFBC0,0xABDF,0x0000, 0xFBC0,0xABE0,0x0000, +0xFBC0,0xABE1,0x0000, 0xFBC0,0xABE2,0x0000, 0xFBC0,0xABE3,0x0000, +0xFBC0,0xABE4,0x0000, 0xFBC0,0xABE5,0x0000, 0xFBC0,0xABE6,0x0000, +0xFBC0,0xABE7,0x0000, 0xFBC0,0xABE8,0x0000, 0xFBC0,0xABE9,0x0000, +0xFBC0,0xABEA,0x0000, 0xFBC0,0xABEB,0x0000, 0xFBC0,0xABEC,0x0000, +0xFBC0,0xABED,0x0000, 0xFBC0,0xABEE,0x0000, 0xFBC0,0xABEF,0x0000, +0xFBC0,0xABF0,0x0000, 0xFBC0,0xABF1,0x0000, 0xFBC0,0xABF2,0x0000, +0xFBC0,0xABF3,0x0000, 0xFBC0,0xABF4,0x0000, 0xFBC0,0xABF5,0x0000, +0xFBC0,0xABF6,0x0000, 0xFBC0,0xABF7,0x0000, 0xFBC0,0xABF8,0x0000, +0xFBC0,0xABF9,0x0000, 0xFBC0,0xABFA,0x0000, 0xFBC0,0xABFB,0x0000, +0xFBC0,0xABFC,0x0000, 0xFBC0,0xABFD,0x0000, 0xFBC0,0xABFE,0x0000, +0xFBC0,0xABFF,0x0000 }; + +uint16 page02Edata[]= { /* 2E00 (3 weights per char) */ +0xFBC0,0xAE00,0x0000, 0xFBC0,0xAE01,0x0000, 0xFBC0,0xAE02,0x0000, +0xFBC0,0xAE03,0x0000, 0xFBC0,0xAE04,0x0000, 0xFBC0,0xAE05,0x0000, +0xFBC0,0xAE06,0x0000, 0xFBC0,0xAE07,0x0000, 0xFBC0,0xAE08,0x0000, +0xFBC0,0xAE09,0x0000, 0xFBC0,0xAE0A,0x0000, 0xFBC0,0xAE0B,0x0000, +0xFBC0,0xAE0C,0x0000, 0xFBC0,0xAE0D,0x0000, 0xFBC0,0xAE0E,0x0000, +0xFBC0,0xAE0F,0x0000, 0xFBC0,0xAE10,0x0000, 0xFBC0,0xAE11,0x0000, +0xFBC0,0xAE12,0x0000, 0xFBC0,0xAE13,0x0000, 0xFBC0,0xAE14,0x0000, +0xFBC0,0xAE15,0x0000, 0xFBC0,0xAE16,0x0000, 0xFBC0,0xAE17,0x0000, +0xFBC0,0xAE18,0x0000, 0xFBC0,0xAE19,0x0000, 0xFBC0,0xAE1A,0x0000, +0xFBC0,0xAE1B,0x0000, 0xFBC0,0xAE1C,0x0000, 0xFBC0,0xAE1D,0x0000, +0xFBC0,0xAE1E,0x0000, 0xFBC0,0xAE1F,0x0000, 0xFBC0,0xAE20,0x0000, +0xFBC0,0xAE21,0x0000, 0xFBC0,0xAE22,0x0000, 0xFBC0,0xAE23,0x0000, +0xFBC0,0xAE24,0x0000, 0xFBC0,0xAE25,0x0000, 0xFBC0,0xAE26,0x0000, +0xFBC0,0xAE27,0x0000, 0xFBC0,0xAE28,0x0000, 0xFBC0,0xAE29,0x0000, +0xFBC0,0xAE2A,0x0000, 0xFBC0,0xAE2B,0x0000, 0xFBC0,0xAE2C,0x0000, +0xFBC0,0xAE2D,0x0000, 0xFBC0,0xAE2E,0x0000, 0xFBC0,0xAE2F,0x0000, +0xFBC0,0xAE30,0x0000, 0xFBC0,0xAE31,0x0000, 0xFBC0,0xAE32,0x0000, +0xFBC0,0xAE33,0x0000, 0xFBC0,0xAE34,0x0000, 0xFBC0,0xAE35,0x0000, +0xFBC0,0xAE36,0x0000, 0xFBC0,0xAE37,0x0000, 0xFBC0,0xAE38,0x0000, +0xFBC0,0xAE39,0x0000, 0xFBC0,0xAE3A,0x0000, 0xFBC0,0xAE3B,0x0000, +0xFBC0,0xAE3C,0x0000, 0xFBC0,0xAE3D,0x0000, 0xFBC0,0xAE3E,0x0000, +0xFBC0,0xAE3F,0x0000, 0xFBC0,0xAE40,0x0000, 0xFBC0,0xAE41,0x0000, +0xFBC0,0xAE42,0x0000, 0xFBC0,0xAE43,0x0000, 0xFBC0,0xAE44,0x0000, +0xFBC0,0xAE45,0x0000, 0xFBC0,0xAE46,0x0000, 0xFBC0,0xAE47,0x0000, +0xFBC0,0xAE48,0x0000, 0xFBC0,0xAE49,0x0000, 0xFBC0,0xAE4A,0x0000, +0xFBC0,0xAE4B,0x0000, 0xFBC0,0xAE4C,0x0000, 0xFBC0,0xAE4D,0x0000, +0xFBC0,0xAE4E,0x0000, 0xFBC0,0xAE4F,0x0000, 0xFBC0,0xAE50,0x0000, +0xFBC0,0xAE51,0x0000, 0xFBC0,0xAE52,0x0000, 0xFBC0,0xAE53,0x0000, +0xFBC0,0xAE54,0x0000, 0xFBC0,0xAE55,0x0000, 0xFBC0,0xAE56,0x0000, +0xFBC0,0xAE57,0x0000, 0xFBC0,0xAE58,0x0000, 0xFBC0,0xAE59,0x0000, +0xFBC0,0xAE5A,0x0000, 0xFBC0,0xAE5B,0x0000, 0xFBC0,0xAE5C,0x0000, +0xFBC0,0xAE5D,0x0000, 0xFBC0,0xAE5E,0x0000, 0xFBC0,0xAE5F,0x0000, +0xFBC0,0xAE60,0x0000, 0xFBC0,0xAE61,0x0000, 0xFBC0,0xAE62,0x0000, +0xFBC0,0xAE63,0x0000, 0xFBC0,0xAE64,0x0000, 0xFBC0,0xAE65,0x0000, +0xFBC0,0xAE66,0x0000, 0xFBC0,0xAE67,0x0000, 0xFBC0,0xAE68,0x0000, +0xFBC0,0xAE69,0x0000, 0xFBC0,0xAE6A,0x0000, 0xFBC0,0xAE6B,0x0000, +0xFBC0,0xAE6C,0x0000, 0xFBC0,0xAE6D,0x0000, 0xFBC0,0xAE6E,0x0000, +0xFBC0,0xAE6F,0x0000, 0xFBC0,0xAE70,0x0000, 0xFBC0,0xAE71,0x0000, +0xFBC0,0xAE72,0x0000, 0xFBC0,0xAE73,0x0000, 0xFBC0,0xAE74,0x0000, +0xFBC0,0xAE75,0x0000, 0xFBC0,0xAE76,0x0000, 0xFBC0,0xAE77,0x0000, +0xFBC0,0xAE78,0x0000, 0xFBC0,0xAE79,0x0000, 0xFBC0,0xAE7A,0x0000, +0xFBC0,0xAE7B,0x0000, 0xFBC0,0xAE7C,0x0000, 0xFBC0,0xAE7D,0x0000, +0xFBC0,0xAE7E,0x0000, 0xFBC0,0xAE7F,0x0000, 0xFB40,0xCE36,0x0000, +0xFB40,0xD382,0x0000, 0xFB40,0xCE5B,0x0000, 0xFB40,0xCE5A,0x0000, +0xFB40,0xCE59,0x0000, 0xFB40,0xCEBB,0x0000, 0xFB40,0xD182,0x0000, +0xFB40,0xD1E0,0x0000, 0xFB40,0xD200,0x0000, 0xFB40,0xD202,0x0000, +0xFB40,0xD35C,0x0000, 0xFB40,0xD369,0x0000, 0xFB40,0xDC0F,0x0000, +0xFB40,0xDC0F,0x0000, 0xFB40,0xDC22,0x0000, 0xFB40,0xDC23,0x0000, +0xFB40,0xDC22,0x0000, 0xFB40,0xDC23,0x0000, 0xFB40,0xDDF3,0x0000, +0xFB40,0xDE7A,0x0000, 0xFB40,0xDF51,0x0000, 0xFB40,0xDF50,0x0000, +0xFB40,0xDFC4,0x0000, 0xFB40,0xDFC3,0x0000, 0xFB40,0xE24C,0x0000, +0xFB40,0xE535,0x0000, 0xFBC0,0xAE9A,0x0000, 0xFB40,0xE5E1,0x0000, +0xFB40,0xE5E5,0x0000, 0xFB40,0xE708,0x0000, 0xFB40,0xEB7A,0x0000, +0xFB40,0xEBCD,0x0000, 0xFB40,0xEC11,0x0000, 0xFB40,0xEC35,0x0000, +0xFB40,0xEC3A,0x0000, 0xFB40,0xF06C,0x0000, 0xFB40,0xF22B,0x0000, +0xFB40,0xF22B,0x0000, 0xFB40,0xCE2C,0x0000, 0xFB40,0xF25B,0x0000, +0xFB40,0xF2AD,0x0000, 0xFB40,0xF38B,0x0000, 0xFB40,0xF58B,0x0000, +0xFB40,0xF6EE,0x0000, 0xFB40,0xF93A,0x0000, 0xFB40,0xF93B,0x0000, +0xFB40,0xFAF9,0x0000, 0xFB40,0xFCF9,0x0000, 0xFB40,0xFE9F,0x0000, +0xFB40,0xFF53,0x0000, 0xFB40,0xFF52,0x0000, 0xFB40,0xFF53,0x0000, +0xFB40,0xFF53,0x0000, 0xFB40,0xFF52,0x0000, 0xFB40,0xFF8A,0x0000, +0xFB40,0xFF8A,0x0000, 0xFB40,0xFF8B,0x0000, 0xFB41,0x8002,0x0000, +0xFB41,0x8080,0x0000, 0xFB41,0x807F,0x0000, 0xFB41,0x8089,0x0000, +0xFB41,0x81FC,0x0000, 0xFB41,0x8279,0x0000, 0xFB41,0x8279,0x0000, +0xFB41,0x8279,0x0000, 0xFB41,0x864E,0x0000, 0xFB41,0x8864,0x0000, +0xFB41,0x8980,0x0000, 0xFB41,0x897F,0x0000, 0xFB41,0x89C1,0x0000, +0xFB41,0x89D2,0x0000, 0xFB41,0x89D2,0x0000, 0xFB41,0x8BA0,0x0000, +0xFB41,0x8D1D,0x0000, 0xFB41,0x8DB3,0x0000, 0xFB41,0x8F66,0x0000, +0xFB41,0x8FB6,0x0000, 0xFB41,0x8FB6,0x0000, 0xFB41,0x8FB6,0x0000, +0xFB41,0x9091,0x0000, 0xFB41,0x9485,0x0000, 0xFB41,0x9577,0x0000, +0xFB41,0x9578,0x0000, 0xFB41,0x957F,0x0000, 0xFB41,0x95E8,0x0000, +0xFB41,0x961C,0x0000, 0xFB41,0x961D,0x0000, 0xFB41,0x96E8,0x0000, +0xFB41,0x9752,0x0000, 0xFB41,0x97E6,0x0000, 0xFB41,0x9875,0x0000, +0xFB41,0x98CE,0x0000, 0xFB41,0x98DE,0x0000, 0xFB41,0x98DF,0x0000, +0xFB41,0x98E0,0x0000, 0xFB41,0x98E0,0x0000, 0xFB41,0x9963,0x0000, +0xFB41,0x9996,0x0000, 0xFB41,0x9A6C,0x0000, 0xFB41,0x9AA8,0x0000, +0xFB41,0x9B3C,0x0000, 0xFB41,0x9C7C,0x0000, 0xFB41,0x9E1F,0x0000, +0xFB41,0x9E75,0x0000, 0xFB41,0x9EA6,0x0000, 0xFB41,0x9EC4,0x0000, +0xFB41,0x9EFE,0x0000, 0xFB41,0x9F4A,0x0000, 0xFB41,0x9F50,0x0000, +0xFB41,0x9F52,0x0000, 0xFB41,0x9F7F,0x0000, 0xFB41,0x9F8D,0x0000, +0xFB41,0x9F99,0x0000, 0xFB41,0x9F9C,0x0000, 0xFB41,0x9F9C,0x0000, +0xFB41,0x9F9F,0x0000, 0xFBC0,0xAEF4,0x0000, 0xFBC0,0xAEF5,0x0000, +0xFBC0,0xAEF6,0x0000, 0xFBC0,0xAEF7,0x0000, 0xFBC0,0xAEF8,0x0000, +0xFBC0,0xAEF9,0x0000, 0xFBC0,0xAEFA,0x0000, 0xFBC0,0xAEFB,0x0000, +0xFBC0,0xAEFC,0x0000, 0xFBC0,0xAEFD,0x0000, 0xFBC0,0xAEFE,0x0000, +0xFBC0,0xAEFF,0x0000 }; + +uint16 page02Fdata[]= { /* 2F00 (3 weights per char) */ +0xFB40,0xCE00,0x0000, 0xFB40,0xCE28,0x0000, 0xFB40,0xCE36,0x0000, +0xFB40,0xCE3F,0x0000, 0xFB40,0xCE59,0x0000, 0xFB40,0xCE85,0x0000, +0xFB40,0xCE8C,0x0000, 0xFB40,0xCEA0,0x0000, 0xFB40,0xCEBA,0x0000, +0xFB40,0xD13F,0x0000, 0xFB40,0xD165,0x0000, 0xFB40,0xD16B,0x0000, +0xFB40,0xD182,0x0000, 0xFB40,0xD196,0x0000, 0xFB40,0xD1AB,0x0000, +0xFB40,0xD1E0,0x0000, 0xFB40,0xD1F5,0x0000, 0xFB40,0xD200,0x0000, +0xFB40,0xD29B,0x0000, 0xFB40,0xD2F9,0x0000, 0xFB40,0xD315,0x0000, +0xFB40,0xD31A,0x0000, 0xFB40,0xD338,0x0000, 0xFB40,0xD341,0x0000, +0xFB40,0xD35C,0x0000, 0xFB40,0xD369,0x0000, 0xFB40,0xD382,0x0000, +0xFB40,0xD3B6,0x0000, 0xFB40,0xD3C8,0x0000, 0xFB40,0xD3E3,0x0000, +0xFB40,0xD6D7,0x0000, 0xFB40,0xD71F,0x0000, 0xFB40,0xD8EB,0x0000, +0xFB40,0xD902,0x0000, 0xFB40,0xD90A,0x0000, 0xFB40,0xD915,0x0000, +0xFB40,0xD927,0x0000, 0xFB40,0xD973,0x0000, 0xFB40,0xDB50,0x0000, +0xFB40,0xDB80,0x0000, 0xFB40,0xDBF8,0x0000, 0xFB40,0xDC0F,0x0000, +0xFB40,0xDC22,0x0000, 0xFB40,0xDC38,0x0000, 0xFB40,0xDC6E,0x0000, +0xFB40,0xDC71,0x0000, 0xFB40,0xDDDB,0x0000, 0xFB40,0xDDE5,0x0000, +0xFB40,0xDDF1,0x0000, 0xFB40,0xDDFE,0x0000, 0xFB40,0xDE72,0x0000, +0xFB40,0xDE7A,0x0000, 0xFB40,0xDE7F,0x0000, 0xFB40,0xDEF4,0x0000, +0xFB40,0xDEFE,0x0000, 0xFB40,0xDF0B,0x0000, 0xFB40,0xDF13,0x0000, +0xFB40,0xDF50,0x0000, 0xFB40,0xDF61,0x0000, 0xFB40,0xDF73,0x0000, +0xFB40,0xDFC3,0x0000, 0xFB40,0xE208,0x0000, 0xFB40,0xE236,0x0000, +0xFB40,0xE24B,0x0000, 0xFB40,0xE52F,0x0000, 0xFB40,0xE534,0x0000, +0xFB40,0xE587,0x0000, 0xFB40,0xE597,0x0000, 0xFB40,0xE5A4,0x0000, +0xFB40,0xE5B9,0x0000, 0xFB40,0xE5E0,0x0000, 0xFB40,0xE5E5,0x0000, +0xFB40,0xE6F0,0x0000, 0xFB40,0xE708,0x0000, 0xFB40,0xE728,0x0000, +0xFB40,0xEB20,0x0000, 0xFB40,0xEB62,0x0000, 0xFB40,0xEB79,0x0000, +0xFB40,0xEBB3,0x0000, 0xFB40,0xEBCB,0x0000, 0xFB40,0xEBD4,0x0000, +0xFB40,0xEBDB,0x0000, 0xFB40,0xEC0F,0x0000, 0xFB40,0xEC14,0x0000, +0xFB40,0xEC34,0x0000, 0xFB40,0xF06B,0x0000, 0xFB40,0xF22A,0x0000, +0xFB40,0xF236,0x0000, 0xFB40,0xF23B,0x0000, 0xFB40,0xF23F,0x0000, +0xFB40,0xF247,0x0000, 0xFB40,0xF259,0x0000, 0xFB40,0xF25B,0x0000, +0xFB40,0xF2AC,0x0000, 0xFB40,0xF384,0x0000, 0xFB40,0xF389,0x0000, +0xFB40,0xF4DC,0x0000, 0xFB40,0xF4E6,0x0000, 0xFB40,0xF518,0x0000, +0xFB40,0xF51F,0x0000, 0xFB40,0xF528,0x0000, 0xFB40,0xF530,0x0000, +0xFB40,0xF58B,0x0000, 0xFB40,0xF592,0x0000, 0xFB40,0xF676,0x0000, +0xFB40,0xF67D,0x0000, 0xFB40,0xF6AE,0x0000, 0xFB40,0xF6BF,0x0000, +0xFB40,0xF6EE,0x0000, 0xFB40,0xF7DB,0x0000, 0xFB40,0xF7E2,0x0000, +0xFB40,0xF7F3,0x0000, 0xFB40,0xF93A,0x0000, 0xFB40,0xF9B8,0x0000, +0xFB40,0xF9BE,0x0000, 0xFB40,0xFA74,0x0000, 0xFB40,0xFACB,0x0000, +0xFB40,0xFAF9,0x0000, 0xFB40,0xFC73,0x0000, 0xFB40,0xFCF8,0x0000, +0xFB40,0xFF36,0x0000, 0xFB40,0xFF51,0x0000, 0xFB40,0xFF8A,0x0000, +0xFB40,0xFFBD,0x0000, 0xFB41,0x8001,0x0000, 0xFB41,0x800C,0x0000, +0xFB41,0x8012,0x0000, 0xFB41,0x8033,0x0000, 0xFB41,0x807F,0x0000, +0xFB41,0x8089,0x0000, 0xFB41,0x81E3,0x0000, 0xFB41,0x81EA,0x0000, +0xFB41,0x81F3,0x0000, 0xFB41,0x81FC,0x0000, 0xFB41,0x820C,0x0000, +0xFB41,0x821B,0x0000, 0xFB41,0x821F,0x0000, 0xFB41,0x826E,0x0000, +0xFB41,0x8272,0x0000, 0xFB41,0x8278,0x0000, 0xFB41,0x864D,0x0000, +0xFB41,0x866B,0x0000, 0xFB41,0x8840,0x0000, 0xFB41,0x884C,0x0000, +0xFB41,0x8863,0x0000, 0xFB41,0x897E,0x0000, 0xFB41,0x898B,0x0000, +0xFB41,0x89D2,0x0000, 0xFB41,0x8A00,0x0000, 0xFB41,0x8C37,0x0000, +0xFB41,0x8C46,0x0000, 0xFB41,0x8C55,0x0000, 0xFB41,0x8C78,0x0000, +0xFB41,0x8C9D,0x0000, 0xFB41,0x8D64,0x0000, 0xFB41,0x8D70,0x0000, +0xFB41,0x8DB3,0x0000, 0xFB41,0x8EAB,0x0000, 0xFB41,0x8ECA,0x0000, +0xFB41,0x8F9B,0x0000, 0xFB41,0x8FB0,0x0000, 0xFB41,0x8FB5,0x0000, +0xFB41,0x9091,0x0000, 0xFB41,0x9149,0x0000, 0xFB41,0x91C6,0x0000, +0xFB41,0x91CC,0x0000, 0xFB41,0x91D1,0x0000, 0xFB41,0x9577,0x0000, +0xFB41,0x9580,0x0000, 0xFB41,0x961C,0x0000, 0xFB41,0x96B6,0x0000, +0xFB41,0x96B9,0x0000, 0xFB41,0x96E8,0x0000, 0xFB41,0x9751,0x0000, +0xFB41,0x975E,0x0000, 0xFB41,0x9762,0x0000, 0xFB41,0x9769,0x0000, +0xFB41,0x97CB,0x0000, 0xFB41,0x97ED,0x0000, 0xFB41,0x97F3,0x0000, +0xFB41,0x9801,0x0000, 0xFB41,0x98A8,0x0000, 0xFB41,0x98DB,0x0000, +0xFB41,0x98DF,0x0000, 0xFB41,0x9996,0x0000, 0xFB41,0x9999,0x0000, +0xFB41,0x99AC,0x0000, 0xFB41,0x9AA8,0x0000, 0xFB41,0x9AD8,0x0000, +0xFB41,0x9ADF,0x0000, 0xFB41,0x9B25,0x0000, 0xFB41,0x9B2F,0x0000, +0xFB41,0x9B32,0x0000, 0xFB41,0x9B3C,0x0000, 0xFB41,0x9B5A,0x0000, +0xFB41,0x9CE5,0x0000, 0xFB41,0x9E75,0x0000, 0xFB41,0x9E7F,0x0000, +0xFB41,0x9EA5,0x0000, 0xFB41,0x9EBB,0x0000, 0xFB41,0x9EC3,0x0000, +0xFB41,0x9ECD,0x0000, 0xFB41,0x9ED1,0x0000, 0xFB41,0x9EF9,0x0000, +0xFB41,0x9EFD,0x0000, 0xFB41,0x9F0E,0x0000, 0xFB41,0x9F13,0x0000, +0xFB41,0x9F20,0x0000, 0xFB41,0x9F3B,0x0000, 0xFB41,0x9F4A,0x0000, +0xFB41,0x9F52,0x0000, 0xFB41,0x9F8D,0x0000, 0xFB41,0x9F9C,0x0000, +0xFB41,0x9FA0,0x0000, 0xFBC0,0xAFD6,0x0000, 0xFBC0,0xAFD7,0x0000, +0xFBC0,0xAFD8,0x0000, 0xFBC0,0xAFD9,0x0000, 0xFBC0,0xAFDA,0x0000, +0xFBC0,0xAFDB,0x0000, 0xFBC0,0xAFDC,0x0000, 0xFBC0,0xAFDD,0x0000, +0xFBC0,0xAFDE,0x0000, 0xFBC0,0xAFDF,0x0000, 0xFBC0,0xAFE0,0x0000, +0xFBC0,0xAFE1,0x0000, 0xFBC0,0xAFE2,0x0000, 0xFBC0,0xAFE3,0x0000, +0xFBC0,0xAFE4,0x0000, 0xFBC0,0xAFE5,0x0000, 0xFBC0,0xAFE6,0x0000, +0xFBC0,0xAFE7,0x0000, 0xFBC0,0xAFE8,0x0000, 0xFBC0,0xAFE9,0x0000, +0xFBC0,0xAFEA,0x0000, 0xFBC0,0xAFEB,0x0000, 0xFBC0,0xAFEC,0x0000, +0xFBC0,0xAFED,0x0000, 0xFBC0,0xAFEE,0x0000, 0xFBC0,0xAFEF,0x0000, +0x0DAF,0x0000,0x0000, 0x0DB0,0x0000,0x0000, 0x0DB1,0x0000,0x0000, +0x0DB2,0x0000,0x0000, 0x0DB3,0x0000,0x0000, 0x0DB4,0x0000,0x0000, +0x0DB5,0x0000,0x0000, 0x0DB6,0x0000,0x0000, 0x0DB7,0x0000,0x0000, +0x0DB8,0x0000,0x0000, 0x0DB9,0x0000,0x0000, 0x0DBA,0x0000,0x0000, +0xFBC0,0xAFFC,0x0000, 0xFBC0,0xAFFD,0x0000, 0xFBC0,0xAFFE,0x0000, +0xFBC0,0xAFFF,0x0000 }; + +uint16 page030data[]= { /* 3000 (3 weights per char) */ +0x0209,0x0000,0x0000, 0x0237,0x0000,0x0000, 0x0266,0x0000,0x0000, +0x02E2,0x0000,0x0000, 0x0DBB,0x0000,0x0000, 0x0E05,0x0000,0x0000, +0x1E5D,0x1E73,0x0000, 0x0E29,0x0000,0x0000, 0x02AE,0x0000,0x0000, +0x02AF,0x0000,0x0000, 0x02B0,0x0000,0x0000, 0x02B1,0x0000,0x0000, +0x02B2,0x0000,0x0000, 0x02B3,0x0000,0x0000, 0x02B4,0x0000,0x0000, +0x02B5,0x0000,0x0000, 0x02B6,0x0000,0x0000, 0x02B7,0x0000,0x0000, +0x0DBC,0x0000,0x0000, 0x0DBD,0x0000,0x0000, 0x02B8,0x0000,0x0000, +0x02B9,0x0000,0x0000, 0x02BA,0x0000,0x0000, 0x02BB,0x0000,0x0000, +0x02BC,0x0000,0x0000, 0x02BD,0x0000,0x0000, 0x02BE,0x0000,0x0000, +0x02BF,0x0000,0x0000, 0x022B,0x0000,0x0000, 0x0283,0x0000,0x0000, +0x0284,0x0000,0x0000, 0x0285,0x0000,0x0000, 0x0DBE,0x0000,0x0000, +0x0E2A,0x0000,0x0000, 0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, +0x0E2D,0x0000,0x0000, 0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, +0x0E30,0x0000,0x0000, 0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x022C,0x0000,0x0000, 0x0E07,0x0000,0x0000, 0x0E07,0x0000,0x0000, +0x0E08,0x0000,0x0000, 0x0E08,0x0000,0x0000, 0x0E09,0x0000,0x0000, +0x0DBC,0x0000,0x0000, 0x0DBF,0x0000,0x0000, 0xFB40,0xD341,0x0000, +0xFB40,0xD344,0x0000, 0xFB40,0xD345,0x0000, 0x0E06,0x0000,0x0000, +0x1E70,0x1E5E,0x0000, 0x02E3,0x0000,0x0000, 0x0DC0,0x0000,0x0000, +0x0DC1,0x0000,0x0000, 0xFBC0,0xB040,0x0000, 0x1E52,0x0000,0x0000, +0x1E52,0x0000,0x0000, 0x1E53,0x0000,0x0000, 0x1E53,0x0000,0x0000, +0x1E54,0x0000,0x0000, 0x1E54,0x0000,0x0000, 0x1E55,0x0000,0x0000, +0x1E55,0x0000,0x0000, 0x1E56,0x0000,0x0000, 0x1E56,0x0000,0x0000, +0x1E57,0x0000,0x0000, 0x1E57,0x0000,0x0000, 0x1E58,0x0000,0x0000, +0x1E58,0x0000,0x0000, 0x1E59,0x0000,0x0000, 0x1E59,0x0000,0x0000, +0x1E5A,0x0000,0x0000, 0x1E5A,0x0000,0x0000, 0x1E5B,0x0000,0x0000, +0x1E5B,0x0000,0x0000, 0x1E5C,0x0000,0x0000, 0x1E5C,0x0000,0x0000, +0x1E5D,0x0000,0x0000, 0x1E5D,0x0000,0x0000, 0x1E5E,0x0000,0x0000, +0x1E5E,0x0000,0x0000, 0x1E5F,0x0000,0x0000, 0x1E5F,0x0000,0x0000, +0x1E60,0x0000,0x0000, 0x1E60,0x0000,0x0000, 0x1E61,0x0000,0x0000, +0x1E61,0x0000,0x0000, 0x1E62,0x0000,0x0000, 0x1E62,0x0000,0x0000, +0x1E63,0x0000,0x0000, 0x1E63,0x0000,0x0000, 0x1E63,0x0000,0x0000, +0x1E64,0x0000,0x0000, 0x1E64,0x0000,0x0000, 0x1E65,0x0000,0x0000, +0x1E65,0x0000,0x0000, 0x1E66,0x0000,0x0000, 0x1E67,0x0000,0x0000, +0x1E68,0x0000,0x0000, 0x1E69,0x0000,0x0000, 0x1E6A,0x0000,0x0000, +0x1E6B,0x0000,0x0000, 0x1E6B,0x0000,0x0000, 0x1E6B,0x0000,0x0000, +0x1E6C,0x0000,0x0000, 0x1E6C,0x0000,0x0000, 0x1E6C,0x0000,0x0000, +0x1E6D,0x0000,0x0000, 0x1E6D,0x0000,0x0000, 0x1E6D,0x0000,0x0000, +0x1E6E,0x0000,0x0000, 0x1E6E,0x0000,0x0000, 0x1E6E,0x0000,0x0000, +0x1E6F,0x0000,0x0000, 0x1E6F,0x0000,0x0000, 0x1E6F,0x0000,0x0000, +0x1E70,0x0000,0x0000, 0x1E71,0x0000,0x0000, 0x1E72,0x0000,0x0000, +0x1E73,0x0000,0x0000, 0x1E74,0x0000,0x0000, 0x1E75,0x0000,0x0000, +0x1E75,0x0000,0x0000, 0x1E76,0x0000,0x0000, 0x1E76,0x0000,0x0000, +0x1E77,0x0000,0x0000, 0x1E77,0x0000,0x0000, 0x1E78,0x0000,0x0000, +0x1E79,0x0000,0x0000, 0x1E7A,0x0000,0x0000, 0x1E7B,0x0000,0x0000, +0x1E7C,0x0000,0x0000, 0x1E7D,0x0000,0x0000, 0x1E7D,0x0000,0x0000, +0x1E7E,0x0000,0x0000, 0x1E7F,0x0000,0x0000, 0x1E80,0x0000,0x0000, +0x1E81,0x0000,0x0000, 0x1E54,0x0000,0x0000, 0x1E57,0x0000,0x0000, +0x1E5A,0x0000,0x0000, 0xFBC0,0xB097,0x0000, 0xFBC0,0xB098,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x021E,0x0000,0x0000, +0x021F,0x0000,0x0000, 0x0E0A,0x0000,0x0000, 0x0E0A,0x0000,0x0000, +0x1E77,0x1E79,0x0000, 0x022D,0x0000,0x0000, 0x1E52,0x0000,0x0000, +0x1E52,0x0000,0x0000, 0x1E53,0x0000,0x0000, 0x1E53,0x0000,0x0000, +0x1E54,0x0000,0x0000, 0x1E54,0x0000,0x0000, 0x1E55,0x0000,0x0000, +0x1E55,0x0000,0x0000, 0x1E56,0x0000,0x0000, 0x1E56,0x0000,0x0000, +0x1E57,0x0000,0x0000, 0x1E57,0x0000,0x0000, 0x1E58,0x0000,0x0000, +0x1E58,0x0000,0x0000, 0x1E59,0x0000,0x0000, 0x1E59,0x0000,0x0000, +0x1E5A,0x0000,0x0000, 0x1E5A,0x0000,0x0000, 0x1E5B,0x0000,0x0000, +0x1E5B,0x0000,0x0000, 0x1E5C,0x0000,0x0000, 0x1E5C,0x0000,0x0000, +0x1E5D,0x0000,0x0000, 0x1E5D,0x0000,0x0000, 0x1E5E,0x0000,0x0000, +0x1E5E,0x0000,0x0000, 0x1E5F,0x0000,0x0000, 0x1E5F,0x0000,0x0000, +0x1E60,0x0000,0x0000, 0x1E60,0x0000,0x0000, 0x1E61,0x0000,0x0000, +0x1E61,0x0000,0x0000, 0x1E62,0x0000,0x0000, 0x1E62,0x0000,0x0000, +0x1E63,0x0000,0x0000, 0x1E63,0x0000,0x0000, 0x1E63,0x0000,0x0000, +0x1E64,0x0000,0x0000, 0x1E64,0x0000,0x0000, 0x1E65,0x0000,0x0000, +0x1E65,0x0000,0x0000, 0x1E66,0x0000,0x0000, 0x1E67,0x0000,0x0000, +0x1E68,0x0000,0x0000, 0x1E69,0x0000,0x0000, 0x1E6A,0x0000,0x0000, +0x1E6B,0x0000,0x0000, 0x1E6B,0x0000,0x0000, 0x1E6B,0x0000,0x0000, +0x1E6C,0x0000,0x0000, 0x1E6C,0x0000,0x0000, 0x1E6C,0x0000,0x0000, +0x1E6D,0x0000,0x0000, 0x1E6D,0x0000,0x0000, 0x1E6D,0x0000,0x0000, +0x1E6E,0x0000,0x0000, 0x1E6E,0x0000,0x0000, 0x1E6E,0x0000,0x0000, +0x1E6F,0x0000,0x0000, 0x1E6F,0x0000,0x0000, 0x1E6F,0x0000,0x0000, +0x1E70,0x0000,0x0000, 0x1E71,0x0000,0x0000, 0x1E72,0x0000,0x0000, +0x1E73,0x0000,0x0000, 0x1E74,0x0000,0x0000, 0x1E75,0x0000,0x0000, +0x1E75,0x0000,0x0000, 0x1E76,0x0000,0x0000, 0x1E76,0x0000,0x0000, +0x1E77,0x0000,0x0000, 0x1E77,0x0000,0x0000, 0x1E78,0x0000,0x0000, +0x1E79,0x0000,0x0000, 0x1E7A,0x0000,0x0000, 0x1E7B,0x0000,0x0000, +0x1E7C,0x0000,0x0000, 0x1E7D,0x0000,0x0000, 0x1E7D,0x0000,0x0000, +0x1E7E,0x0000,0x0000, 0x1E7F,0x0000,0x0000, 0x1E80,0x0000,0x0000, +0x1E81,0x0000,0x0000, 0x1E54,0x0000,0x0000, 0x1E57,0x0000,0x0000, +0x1E5A,0x0000,0x0000, 0x1E7D,0x0000,0x0000, 0x1E7E,0x0000,0x0000, +0x1E7F,0x0000,0x0000, 0x1E80,0x0000,0x0000, 0x022E,0x0000,0x0000, +0x0E0B,0x0000,0x0000, 0x0E0C,0x0000,0x0000, 0x0E0C,0x0000,0x0000, +0x1E5B,0x1E65,0x0000 }; + +uint16 page031data[]= { /* 3100 (3 weights per char) */ +0xFBC0,0xB100,0x0000, 0xFBC0,0xB101,0x0000, 0xFBC0,0xB102,0x0000, +0xFBC0,0xB103,0x0000, 0xFBC0,0xB104,0x0000, 0x1E82,0x0000,0x0000, +0x1E83,0x0000,0x0000, 0x1E84,0x0000,0x0000, 0x1E85,0x0000,0x0000, +0x1E87,0x0000,0x0000, 0x1E88,0x0000,0x0000, 0x1E89,0x0000,0x0000, +0x1E8A,0x0000,0x0000, 0x1E8B,0x0000,0x0000, 0x1E8C,0x0000,0x0000, +0x1E8F,0x0000,0x0000, 0x1E90,0x0000,0x0000, 0x1E91,0x0000,0x0000, +0x1E92,0x0000,0x0000, 0x1E94,0x0000,0x0000, 0x1E95,0x0000,0x0000, +0x1E96,0x0000,0x0000, 0x1E97,0x0000,0x0000, 0x1E98,0x0000,0x0000, +0x1E99,0x0000,0x0000, 0x1E9A,0x0000,0x0000, 0x1E9B,0x0000,0x0000, +0x1E9C,0x0000,0x0000, 0x1E9E,0x0000,0x0000, 0x1E9F,0x0000,0x0000, +0x1EA1,0x0000,0x0000, 0x1EA2,0x0000,0x0000, 0x1EA3,0x0000,0x0000, +0x1EA4,0x0000,0x0000, 0x1EA5,0x0000,0x0000, 0x1EA6,0x0000,0x0000, +0x1EA7,0x0000,0x0000, 0x1EA9,0x0000,0x0000, 0x1EAD,0x0000,0x0000, +0x1EAE,0x0000,0x0000, 0x1EAF,0x0000,0x0000, 0x1EB0,0x0000,0x0000, +0x1E86,0x0000,0x0000, 0x1E8D,0x0000,0x0000, 0x1E93,0x0000,0x0000, +0xFBC0,0xB12D,0x0000, 0xFBC0,0xB12E,0x0000, 0xFBC0,0xB12F,0x0000, +0xFBC0,0xB130,0x0000, 0x1D62,0x0000,0x0000, 0x1D63,0x0000,0x0000, +0x1E02,0x0000,0x0000, 0x1D64,0x0000,0x0000, 0x1E04,0x0000,0x0000, +0x1E05,0x0000,0x0000, 0x1D65,0x0000,0x0000, 0x1D66,0x0000,0x0000, +0x1D67,0x0000,0x0000, 0x1E08,0x0000,0x0000, 0x1E09,0x0000,0x0000, +0x1E0A,0x0000,0x0000, 0x1E0B,0x0000,0x0000, 0x1E0C,0x0000,0x0000, +0x1E0D,0x0000,0x0000, 0x1D7C,0x0000,0x0000, 0x1D68,0x0000,0x0000, +0x1D69,0x0000,0x0000, 0x1D6A,0x0000,0x0000, 0x1D83,0x0000,0x0000, +0x1D6B,0x0000,0x0000, 0x1D6C,0x0000,0x0000, 0x1D6D,0x0000,0x0000, +0x1D6E,0x0000,0x0000, 0x1D6F,0x0000,0x0000, 0x1D70,0x0000,0x0000, +0x1D71,0x0000,0x0000, 0x1D72,0x0000,0x0000, 0x1D73,0x0000,0x0000, +0x1D74,0x0000,0x0000, 0x1DBE,0x0000,0x0000, 0x1DBF,0x0000,0x0000, +0x1DC0,0x0000,0x0000, 0x1DC1,0x0000,0x0000, 0x1DC2,0x0000,0x0000, +0x1DC3,0x0000,0x0000, 0x1DC4,0x0000,0x0000, 0x1DC5,0x0000,0x0000, +0x1DC6,0x0000,0x0000, 0x1DC7,0x0000,0x0000, 0x1DC8,0x0000,0x0000, +0x1DC9,0x0000,0x0000, 0x1DCA,0x0000,0x0000, 0x1DCB,0x0000,0x0000, +0x1DCC,0x0000,0x0000, 0x1DCD,0x0000,0x0000, 0x1DCE,0x0000,0x0000, +0x1DCF,0x0000,0x0000, 0x1DD0,0x0000,0x0000, 0x1DD1,0x0000,0x0000, +0x1DD2,0x0000,0x0000, 0x1DBD,0x0000,0x0000, 0x1D76,0x0000,0x0000, +0x1D77,0x0000,0x0000, 0x1E1F,0x0000,0x0000, 0x1E20,0x0000,0x0000, +0x1E24,0x0000,0x0000, 0x1E26,0x0000,0x0000, 0x1E2B,0x0000,0x0000, +0x1E2F,0x0000,0x0000, 0x1E31,0x0000,0x0000, 0x1D7E,0x0000,0x0000, +0x1E35,0x0000,0x0000, 0x1E37,0x0000,0x0000, 0x1D7F,0x0000,0x0000, +0x1D80,0x0000,0x0000, 0x1D82,0x0000,0x0000, 0x1D84,0x0000,0x0000, +0x1D85,0x0000,0x0000, 0x1D89,0x0000,0x0000, 0x1D8B,0x0000,0x0000, +0x1D8D,0x0000,0x0000, 0x1D8E,0x0000,0x0000, 0x1D8F,0x0000,0x0000, +0x1D90,0x0000,0x0000, 0x1D91,0x0000,0x0000, 0x1D94,0x0000,0x0000, +0x1D98,0x0000,0x0000, 0x1DA2,0x0000,0x0000, 0x1DA9,0x0000,0x0000, +0x1DAE,0x0000,0x0000, 0x1E49,0x0000,0x0000, 0x1E4A,0x0000,0x0000, +0x1DB9,0x0000,0x0000, 0x1DBA,0x0000,0x0000, 0x1DBB,0x0000,0x0000, +0x1DE1,0x0000,0x0000, 0x1DE2,0x0000,0x0000, 0x1DE5,0x0000,0x0000, +0x1DEE,0x0000,0x0000, 0x1DEF,0x0000,0x0000, 0x1DF1,0x0000,0x0000, +0x1DFB,0x0000,0x0000, 0x1DFE,0x0000,0x0000, 0xFBC0,0xB18F,0x0000, +0x0DC2,0x0000,0x0000, 0x0DC3,0x0000,0x0000, 0xFB40,0xCE00,0x0000, +0xFB40,0xCE8C,0x0000, 0xFB40,0xCE09,0x0000, 0xFB40,0xD6DB,0x0000, +0xFB40,0xCE0A,0x0000, 0xFB40,0xCE2D,0x0000, 0xFB40,0xCE0B,0x0000, +0xFB40,0xF532,0x0000, 0xFB40,0xCE59,0x0000, 0xFB40,0xCE19,0x0000, +0xFB40,0xCE01,0x0000, 0xFB40,0xD929,0x0000, 0xFB40,0xD730,0x0000, +0xFB40,0xCEBA,0x0000, 0x1E82,0x0000,0x0000, 0x1E98,0x0000,0x0000, +0x1E90,0x0000,0x0000, 0x1E8B,0x0000,0x0000, 0x1EA0,0x0000,0x0000, +0x1EA0,0x0000,0x0000, 0x1E9D,0x0000,0x0000, 0x1E9C,0x0000,0x0000, +0x1EAF,0x0000,0x0000, 0x1E9B,0x0000,0x0000, 0x1EAE,0x0000,0x0000, +0x1EAF,0x0000,0x0000, 0x1EAC,0x0000,0x0000, 0x1E8E,0x0000,0x0000, +0x1EA1,0x0000,0x0000, 0x1EA3,0x0000,0x0000, 0x1EAA,0x0000,0x0000, +0x1EAB,0x0000,0x0000, 0x1EA8,0x0000,0x0000, 0x1EAE,0x0000,0x0000, +0x1E83,0x0000,0x0000, 0x1E88,0x0000,0x0000, 0x1E8C,0x0000,0x0000, +0x1E8F,0x0000,0x0000, 0xFBC0,0xB1B8,0x0000, 0xFBC0,0xB1B9,0x0000, +0xFBC0,0xB1BA,0x0000, 0xFBC0,0xB1BB,0x0000, 0xFBC0,0xB1BC,0x0000, +0xFBC0,0xB1BD,0x0000, 0xFBC0,0xB1BE,0x0000, 0xFBC0,0xB1BF,0x0000, +0xFBC0,0xB1C0,0x0000, 0xFBC0,0xB1C1,0x0000, 0xFBC0,0xB1C2,0x0000, +0xFBC0,0xB1C3,0x0000, 0xFBC0,0xB1C4,0x0000, 0xFBC0,0xB1C5,0x0000, +0xFBC0,0xB1C6,0x0000, 0xFBC0,0xB1C7,0x0000, 0xFBC0,0xB1C8,0x0000, +0xFBC0,0xB1C9,0x0000, 0xFBC0,0xB1CA,0x0000, 0xFBC0,0xB1CB,0x0000, +0xFBC0,0xB1CC,0x0000, 0xFBC0,0xB1CD,0x0000, 0xFBC0,0xB1CE,0x0000, +0xFBC0,0xB1CF,0x0000, 0xFBC0,0xB1D0,0x0000, 0xFBC0,0xB1D1,0x0000, +0xFBC0,0xB1D2,0x0000, 0xFBC0,0xB1D3,0x0000, 0xFBC0,0xB1D4,0x0000, +0xFBC0,0xB1D5,0x0000, 0xFBC0,0xB1D6,0x0000, 0xFBC0,0xB1D7,0x0000, +0xFBC0,0xB1D8,0x0000, 0xFBC0,0xB1D9,0x0000, 0xFBC0,0xB1DA,0x0000, +0xFBC0,0xB1DB,0x0000, 0xFBC0,0xB1DC,0x0000, 0xFBC0,0xB1DD,0x0000, +0xFBC0,0xB1DE,0x0000, 0xFBC0,0xB1DF,0x0000, 0xFBC0,0xB1E0,0x0000, +0xFBC0,0xB1E1,0x0000, 0xFBC0,0xB1E2,0x0000, 0xFBC0,0xB1E3,0x0000, +0xFBC0,0xB1E4,0x0000, 0xFBC0,0xB1E5,0x0000, 0xFBC0,0xB1E6,0x0000, +0xFBC0,0xB1E7,0x0000, 0xFBC0,0xB1E8,0x0000, 0xFBC0,0xB1E9,0x0000, +0xFBC0,0xB1EA,0x0000, 0xFBC0,0xB1EB,0x0000, 0xFBC0,0xB1EC,0x0000, +0xFBC0,0xB1ED,0x0000, 0xFBC0,0xB1EE,0x0000, 0xFBC0,0xB1EF,0x0000, +0x1E59,0x0000,0x0000, 0x1E5D,0x0000,0x0000, 0x1E5E,0x0000,0x0000, +0x1E65,0x0000,0x0000, 0x1E68,0x0000,0x0000, 0x1E6B,0x0000,0x0000, +0x1E6C,0x0000,0x0000, 0x1E6D,0x0000,0x0000, 0x1E6E,0x0000,0x0000, +0x1E6F,0x0000,0x0000, 0x1E72,0x0000,0x0000, 0x1E78,0x0000,0x0000, +0x1E79,0x0000,0x0000, 0x1E7A,0x0000,0x0000, 0x1E7B,0x0000,0x0000, +0x1E7C,0x0000,0x0000 }; + +uint16 page032data[]= { /* 3200 (8 weights per char) */ +0x0288,0x1D62,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D64,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D65,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D67,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D68,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D69,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6B,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6D,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6E,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D70,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D71,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D72,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D73,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D74,0x0289,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D62,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D64,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D65,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D67,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D68,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D69,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6B,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6D,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6E,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D70,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D71,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D72,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D73,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D74,0x1DBE,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6E,0x1DCB,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0x1D6D,0x1DC6,0x1D6E,0x1DC2,0x1E03,0x0289,0x0000, +0x0288,0x1D6D,0x1DC6,0x1D74,0x1DCB,0x0289,0x0000,0x0000, +0xFBC0,0xB21F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCE00,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCE8C,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCE09,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD6DB,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCE94,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD16D,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCE03,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD16B,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCE5D,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD341,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xE708,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xF06B,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xEC34,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xE728,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB41,0x91D1,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD71F,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xE5E5,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xE82A,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xE709,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xF93E,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD40D,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xF279,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB41,0x8CA1,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xF95D,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD2B4,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCEE3,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD47C,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xDB66,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xF6E3,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCF01,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB41,0x8CC7,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xD354,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xF96D,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB40,0xCF11,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB41,0x81EA,0x0289,0x0000,0x0000,0x0000,0x0000, +0x0288,0xFB41,0x81F3,0x0289,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB244,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB245,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB246,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB247,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB248,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB249,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB24A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB24B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB24C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB24D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB24E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB24F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x1002,0x0E8B,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E30,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E32,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E29,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E2A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E2D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D62,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D64,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D67,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D68,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D69,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D6B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D6D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D6E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D70,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D71,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D72,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D73,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D74,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D62,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D64,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D65,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D67,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D68,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D69,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D6B,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D6D,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D6E,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D70,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D71,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D72,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D73,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D74,0x1DBE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1D70,0x1DBE,0x1E0F,0x1D62,0x1DC6,0x0000,0x0000,0x0000, +0x1D6E,0x1DCB,0x1D6D,0x1DD1,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB27E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0DC4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE8C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE09,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD6DB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE94,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD16D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE03,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD16B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE5D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD341,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xF06B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xEC34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE728,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB41,0x91D1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD71F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE82A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE709,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xF93E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD40D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xF279,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB41,0x8CA1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xF95D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD2B4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xF9D8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xF537,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD973,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB41,0x9069,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD12A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD370,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xECE8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB41,0x9805,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCF11,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD199,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xEB63,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE0A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE2D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCE0B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xDDE6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD3F3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD33B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xDB97,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xDB66,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xF6E3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xCF01,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB41,0x8CC7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD354,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD91C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E2F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E30,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E32,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E29,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E2A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E2D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E2F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E30,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0x0E32,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0x0E29,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2F,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E30,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E31,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E32,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E29,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2A,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2B,0xFB40,0xE708,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0EC1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E8B,0x0FC0,0x0EC1,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E8B,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x1002,0x0E6D,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E52,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E53,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E54,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E55,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E56,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E57,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E59,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E60,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E61,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E62,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E63,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E64,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E66,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E67,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E68,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E69,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E70,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E71,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E72,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E73,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E74,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E75,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E76,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E77,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E78,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E79,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E80,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC0,0xB2FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +uint16 page033data[]= { /* 3300 (9 weights per char) */ +0x1E52,0x1E6B,0x0E0B,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E52,0x1E7A,0x1E6D,0x1E52,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E52,0x1E81,0x1E6E,0x1E52,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E52,0x0E0B,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E53,0x1E67,0x1E81,0x1E59,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E53,0x1E81,0x1E62,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E54,0x1E56,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E55,0x1E5E,0x1E59,0x0E0B,0x1E65,0x0000,0x0000,0x0000,0x0000, +0x1E55,0x0E0B,0x1E57,0x0E0B,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E56,0x1E81,0x1E5E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E56,0x0E0B,0x1E72,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E57,0x1E53,0x1E79,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E57,0x1E78,0x1E63,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E57,0x1E7C,0x1E79,0x0E0B,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E57,0x1E7C,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E57,0x1E81,0x1E70,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x1E57,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x1E67,0x0E0B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x1E76,0x1E79,0x0E0B,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x1E7A,0x1E61,0x0E0B,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x1E7C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x1E7C,0x1E59,0x1E78,0x1E72,0x0000,0x0000,0x0000,0x0000, +0x1E58,0x1E7C,0x1E73,0x0E0B,0x1E65,0x1E7A,0x0000,0x0000,0x0000, +0x1E58,0x1E7C,0x1E7D,0x1E63,0x1E65,0x0000,0x0000,0x0000,0x0000, +0x1E59,0x1E78,0x1E72,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E59,0x1E78,0x1E72,0x1E65,0x1E81,0x0000,0x0000,0x0000,0x0000, +0x1E59,0x1E7A,0x1E5F,0x1E53,0x1E7C,0x0000,0x0000,0x0000,0x0000, +0x1E59,0x1E7C,0x0E0B,0x1E69,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5A,0x0E0B,0x1E5E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5B,0x1E7A,0x1E66,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5B,0x0E0B,0x1E6F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5C,0x1E53,0x1E59,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5C,0x1E81,0x1E62,0x0E0B,0x1E72,0x0000,0x0000,0x0000,0x0000, +0x1E5D,0x1E79,0x1E81,0x1E59,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5F,0x1E81,0x1E62,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E5F,0x1E81,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E61,0x0E0B,0x1E5E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E64,0x1E5D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E65,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E65,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E66,0x1E6A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6A,0x1E63,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6B,0x1E53,0x1E63,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6B,0x0E0B,0x1E5F,0x1E81,0x1E65,0x0000,0x0000,0x0000,0x0000, +0x1E6B,0x0E0B,0x1E63,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6B,0x0E0B,0x1E7B,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6C,0x1E52,0x1E5E,0x1E65,0x1E7A,0x0000,0x0000,0x0000,0x0000, +0x1E6C,0x1E59,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6C,0x1E5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6C,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6D,0x1E52,0x1E78,0x1E63,0x1E65,0x0000,0x0000,0x0000,0x0000, +0x1E6D,0x1E53,0x0E0B,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6D,0x1E63,0x1E5D,0x1E55,0x1E7A,0x0000,0x0000,0x0000,0x0000, +0x1E6D,0x1E78,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x1E59,0x1E61,0x0E0B,0x1E7A,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x1E60,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x1E67,0x1E6C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x1E7A,0x1E63,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x1E81,0x1E5E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x0E0B,0x1E5D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6E,0x0E0B,0x1E61,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6F,0x1E53,0x1E81,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6F,0x1E7A,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6F,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6F,0x1E81,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6F,0x0E0B,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E6F,0x0E0B,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E70,0x1E53,0x1E59,0x1E7C,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E70,0x1E53,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E70,0x1E63,0x1E6B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E70,0x1E7A,0x1E59,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E70,0x1E81,0x1E5D,0x1E77,0x1E81,0x0000,0x0000,0x0000,0x0000, +0x1E71,0x1E59,0x1E7C,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E71,0x1E79,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E71,0x1E79,0x1E6B,0x0E0B,0x1E7A,0x0000,0x0000,0x0000,0x0000, +0x1E73,0x1E57,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E73,0x1E57,0x1E65,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E73,0x0E0B,0x1E65,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E75,0x0E0B,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E75,0x0E0B,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E76,0x1E52,0x1E81,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E79,0x1E63,0x1E65,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E79,0x1E78,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7A,0x1E6C,0x0E0B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7A,0x0E0B,0x1E6D,0x1E7A,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7B,0x1E72,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1E7B,0x1E81,0x1E65,0x1E5A,0x1E81,0x0000,0x0000,0x0000,0x0000, +0x1E7D,0x1E63,0x1E65,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E29,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2F,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E30,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E31,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E32,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E29,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2A,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2B,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2C,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2D,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2E,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2F,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E30,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E31,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E32,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E29,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2A,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2B,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2C,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2D,0xFB40,0xF0B9,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0FA7,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E33,0x101F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E4A,0x0E33,0x0FC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F82,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0E60,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0F5B,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0F5B,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x101F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xDE73,0xFB40,0xE210,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE62D,0xFB40,0xD48C,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xD927,0xFB40,0xEB63,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE60E,0xFB40,0xECBB,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFB40,0xE82A,0xFB40,0xDF0F,0xFB40,0xCF1A,0xFB40,0xF93E,0x0000, +0x0FA7,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0E4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0E4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EC1,0x0E4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0E33,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0E60,0x0E33,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0EB9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0EB9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x0EB9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x0EC1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0EC1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0EC1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x106A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0EE1,0x106A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0EE1,0x106A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EC1,0x0EE1,0x106A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1002,0x0EE1,0x106A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EB9,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0F5B,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0F5B,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0F5B,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0F5B,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0F5B,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0F5B,0x0E2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0437,0x0FEA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0437,0x0FEA,0x0E2B,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0FA7,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0FA7,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EC1,0x0FA7,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0E33,0x0E6D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0E33,0x0E6D,0x0437,0x0FEA,0x0000,0x0000,0x0000,0x0000, +0x0FC0,0x0E33,0x0E6D,0x0437,0x0FEA,0x0E2B,0x0000,0x0000,0x0000, +0x0FA7,0x0FEA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x0FEA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x0FEA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0FEA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x1051,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F64,0x1051,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x10F8,0x1051,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x1051,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x1051,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x1051,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x1109,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x1109,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E33,0x025D,0x0F5B,0x025D,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E4A,0x0FB4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0E60,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0E6D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0437,0x0F21,0x0EC1,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E60,0x0F82,0x025D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E6D,0x0E4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EC1,0x105E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0E33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EE1,0x0FA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EFB,0x0F64,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0F21,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F21,0x1002,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x0F64,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x0F82,0x0EC1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F2E,0x105A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0E4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0EFB,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0F5B,0x0F82,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0EE1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x025D,0x0F5B,0x025D,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0FA7,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FA7,0x0FC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FEA,0x0FC0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0FEA,0x1044,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1051,0x0E4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1044,0x0437,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E33,0x0437,0x0F5B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2D,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2E,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2F,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E30,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E31,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E32,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E29,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2A,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2B,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2C,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2D,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2E,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E2F,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E30,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E31,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2A,0x0E32,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E29,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2A,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2B,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2C,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2D,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2E,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E2F,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E30,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E31,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2B,0x0E32,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E29,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0E2C,0x0E2A,0xFB40,0xE5E5,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0EC1,0x0E33,0x0F2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +uint16 page04Ddata[]= { /* 4D00 (3 weights per char) */ +0xFB80,0xCD00,0x0000, 0xFB80,0xCD01,0x0000, 0xFB80,0xCD02,0x0000, +0xFB80,0xCD03,0x0000, 0xFB80,0xCD04,0x0000, 0xFB80,0xCD05,0x0000, +0xFB80,0xCD06,0x0000, 0xFB80,0xCD07,0x0000, 0xFB80,0xCD08,0x0000, +0xFB80,0xCD09,0x0000, 0xFB80,0xCD0A,0x0000, 0xFB80,0xCD0B,0x0000, +0xFB80,0xCD0C,0x0000, 0xFB80,0xCD0D,0x0000, 0xFB80,0xCD0E,0x0000, +0xFB80,0xCD0F,0x0000, 0xFB80,0xCD10,0x0000, 0xFB80,0xCD11,0x0000, +0xFB80,0xCD12,0x0000, 0xFB80,0xCD13,0x0000, 0xFB80,0xCD14,0x0000, +0xFB80,0xCD15,0x0000, 0xFB80,0xCD16,0x0000, 0xFB80,0xCD17,0x0000, +0xFB80,0xCD18,0x0000, 0xFB80,0xCD19,0x0000, 0xFB80,0xCD1A,0x0000, +0xFB80,0xCD1B,0x0000, 0xFB80,0xCD1C,0x0000, 0xFB80,0xCD1D,0x0000, +0xFB80,0xCD1E,0x0000, 0xFB80,0xCD1F,0x0000, 0xFB80,0xCD20,0x0000, +0xFB80,0xCD21,0x0000, 0xFB80,0xCD22,0x0000, 0xFB80,0xCD23,0x0000, +0xFB80,0xCD24,0x0000, 0xFB80,0xCD25,0x0000, 0xFB80,0xCD26,0x0000, +0xFB80,0xCD27,0x0000, 0xFB80,0xCD28,0x0000, 0xFB80,0xCD29,0x0000, +0xFB80,0xCD2A,0x0000, 0xFB80,0xCD2B,0x0000, 0xFB80,0xCD2C,0x0000, +0xFB80,0xCD2D,0x0000, 0xFB80,0xCD2E,0x0000, 0xFB80,0xCD2F,0x0000, +0xFB80,0xCD30,0x0000, 0xFB80,0xCD31,0x0000, 0xFB80,0xCD32,0x0000, +0xFB80,0xCD33,0x0000, 0xFB80,0xCD34,0x0000, 0xFB80,0xCD35,0x0000, +0xFB80,0xCD36,0x0000, 0xFB80,0xCD37,0x0000, 0xFB80,0xCD38,0x0000, +0xFB80,0xCD39,0x0000, 0xFB80,0xCD3A,0x0000, 0xFB80,0xCD3B,0x0000, +0xFB80,0xCD3C,0x0000, 0xFB80,0xCD3D,0x0000, 0xFB80,0xCD3E,0x0000, +0xFB80,0xCD3F,0x0000, 0xFB80,0xCD40,0x0000, 0xFB80,0xCD41,0x0000, +0xFB80,0xCD42,0x0000, 0xFB80,0xCD43,0x0000, 0xFB80,0xCD44,0x0000, +0xFB80,0xCD45,0x0000, 0xFB80,0xCD46,0x0000, 0xFB80,0xCD47,0x0000, +0xFB80,0xCD48,0x0000, 0xFB80,0xCD49,0x0000, 0xFB80,0xCD4A,0x0000, +0xFB80,0xCD4B,0x0000, 0xFB80,0xCD4C,0x0000, 0xFB80,0xCD4D,0x0000, +0xFB80,0xCD4E,0x0000, 0xFB80,0xCD4F,0x0000, 0xFB80,0xCD50,0x0000, +0xFB80,0xCD51,0x0000, 0xFB80,0xCD52,0x0000, 0xFB80,0xCD53,0x0000, +0xFB80,0xCD54,0x0000, 0xFB80,0xCD55,0x0000, 0xFB80,0xCD56,0x0000, +0xFB80,0xCD57,0x0000, 0xFB80,0xCD58,0x0000, 0xFB80,0xCD59,0x0000, +0xFB80,0xCD5A,0x0000, 0xFB80,0xCD5B,0x0000, 0xFB80,0xCD5C,0x0000, +0xFB80,0xCD5D,0x0000, 0xFB80,0xCD5E,0x0000, 0xFB80,0xCD5F,0x0000, +0xFB80,0xCD60,0x0000, 0xFB80,0xCD61,0x0000, 0xFB80,0xCD62,0x0000, +0xFB80,0xCD63,0x0000, 0xFB80,0xCD64,0x0000, 0xFB80,0xCD65,0x0000, +0xFB80,0xCD66,0x0000, 0xFB80,0xCD67,0x0000, 0xFB80,0xCD68,0x0000, +0xFB80,0xCD69,0x0000, 0xFB80,0xCD6A,0x0000, 0xFB80,0xCD6B,0x0000, +0xFB80,0xCD6C,0x0000, 0xFB80,0xCD6D,0x0000, 0xFB80,0xCD6E,0x0000, +0xFB80,0xCD6F,0x0000, 0xFB80,0xCD70,0x0000, 0xFB80,0xCD71,0x0000, +0xFB80,0xCD72,0x0000, 0xFB80,0xCD73,0x0000, 0xFB80,0xCD74,0x0000, +0xFB80,0xCD75,0x0000, 0xFB80,0xCD76,0x0000, 0xFB80,0xCD77,0x0000, +0xFB80,0xCD78,0x0000, 0xFB80,0xCD79,0x0000, 0xFB80,0xCD7A,0x0000, +0xFB80,0xCD7B,0x0000, 0xFB80,0xCD7C,0x0000, 0xFB80,0xCD7D,0x0000, +0xFB80,0xCD7E,0x0000, 0xFB80,0xCD7F,0x0000, 0xFB80,0xCD80,0x0000, +0xFB80,0xCD81,0x0000, 0xFB80,0xCD82,0x0000, 0xFB80,0xCD83,0x0000, +0xFB80,0xCD84,0x0000, 0xFB80,0xCD85,0x0000, 0xFB80,0xCD86,0x0000, +0xFB80,0xCD87,0x0000, 0xFB80,0xCD88,0x0000, 0xFB80,0xCD89,0x0000, +0xFB80,0xCD8A,0x0000, 0xFB80,0xCD8B,0x0000, 0xFB80,0xCD8C,0x0000, +0xFB80,0xCD8D,0x0000, 0xFB80,0xCD8E,0x0000, 0xFB80,0xCD8F,0x0000, +0xFB80,0xCD90,0x0000, 0xFB80,0xCD91,0x0000, 0xFB80,0xCD92,0x0000, +0xFB80,0xCD93,0x0000, 0xFB80,0xCD94,0x0000, 0xFB80,0xCD95,0x0000, +0xFB80,0xCD96,0x0000, 0xFB80,0xCD97,0x0000, 0xFB80,0xCD98,0x0000, +0xFB80,0xCD99,0x0000, 0xFB80,0xCD9A,0x0000, 0xFB80,0xCD9B,0x0000, +0xFB80,0xCD9C,0x0000, 0xFB80,0xCD9D,0x0000, 0xFB80,0xCD9E,0x0000, +0xFB80,0xCD9F,0x0000, 0xFB80,0xCDA0,0x0000, 0xFB80,0xCDA1,0x0000, +0xFB80,0xCDA2,0x0000, 0xFB80,0xCDA3,0x0000, 0xFB80,0xCDA4,0x0000, +0xFB80,0xCDA5,0x0000, 0xFB80,0xCDA6,0x0000, 0xFB80,0xCDA7,0x0000, +0xFB80,0xCDA8,0x0000, 0xFB80,0xCDA9,0x0000, 0xFB80,0xCDAA,0x0000, +0xFB80,0xCDAB,0x0000, 0xFB80,0xCDAC,0x0000, 0xFB80,0xCDAD,0x0000, +0xFB80,0xCDAE,0x0000, 0xFB80,0xCDAF,0x0000, 0xFB80,0xCDB0,0x0000, +0xFB80,0xCDB1,0x0000, 0xFB80,0xCDB2,0x0000, 0xFB80,0xCDB3,0x0000, +0xFB80,0xCDB4,0x0000, 0xFB80,0xCDB5,0x0000, 0xFBC0,0xCDB6,0x0000, +0xFBC0,0xCDB7,0x0000, 0xFBC0,0xCDB8,0x0000, 0xFBC0,0xCDB9,0x0000, +0xFBC0,0xCDBA,0x0000, 0xFBC0,0xCDBB,0x0000, 0xFBC0,0xCDBC,0x0000, +0xFBC0,0xCDBD,0x0000, 0xFBC0,0xCDBE,0x0000, 0xFBC0,0xCDBF,0x0000, +0x0B37,0x0000,0x0000, 0x0B38,0x0000,0x0000, 0x0B39,0x0000,0x0000, +0x0B3A,0x0000,0x0000, 0x0B3B,0x0000,0x0000, 0x0B3C,0x0000,0x0000, +0x0B3D,0x0000,0x0000, 0x0B3E,0x0000,0x0000, 0x0B3F,0x0000,0x0000, +0x0B40,0x0000,0x0000, 0x0B41,0x0000,0x0000, 0x0B42,0x0000,0x0000, +0x0B43,0x0000,0x0000, 0x0B44,0x0000,0x0000, 0x0B45,0x0000,0x0000, +0x0B46,0x0000,0x0000, 0x0B47,0x0000,0x0000, 0x0B48,0x0000,0x0000, +0x0B49,0x0000,0x0000, 0x0B4A,0x0000,0x0000, 0x0B4B,0x0000,0x0000, +0x0B4C,0x0000,0x0000, 0x0B4D,0x0000,0x0000, 0x0B4E,0x0000,0x0000, +0x0B4F,0x0000,0x0000, 0x0B50,0x0000,0x0000, 0x0B51,0x0000,0x0000, +0x0B52,0x0000,0x0000, 0x0B53,0x0000,0x0000, 0x0B54,0x0000,0x0000, +0x0B55,0x0000,0x0000, 0x0B56,0x0000,0x0000, 0x0B57,0x0000,0x0000, +0x0B58,0x0000,0x0000, 0x0B59,0x0000,0x0000, 0x0B5A,0x0000,0x0000, +0x0B5B,0x0000,0x0000, 0x0B5C,0x0000,0x0000, 0x0B5D,0x0000,0x0000, +0x0B5E,0x0000,0x0000, 0x0B5F,0x0000,0x0000, 0x0B60,0x0000,0x0000, +0x0B61,0x0000,0x0000, 0x0B62,0x0000,0x0000, 0x0B63,0x0000,0x0000, +0x0B64,0x0000,0x0000, 0x0B65,0x0000,0x0000, 0x0B66,0x0000,0x0000, +0x0B67,0x0000,0x0000, 0x0B68,0x0000,0x0000, 0x0B69,0x0000,0x0000, +0x0B6A,0x0000,0x0000, 0x0B6B,0x0000,0x0000, 0x0B6C,0x0000,0x0000, +0x0B6D,0x0000,0x0000, 0x0B6E,0x0000,0x0000, 0x0B6F,0x0000,0x0000, +0x0B70,0x0000,0x0000, 0x0B71,0x0000,0x0000, 0x0B72,0x0000,0x0000, +0x0B73,0x0000,0x0000, 0x0B74,0x0000,0x0000, 0x0B75,0x0000,0x0000, +0x0B76,0x0000,0x0000 }; + +uint16 page0A0data[]= { /* A000 (2 weights per char) */ +0x1EB1,0x0000, 0x1EB2,0x0000, 0x1EB3,0x0000, 0x1EB4,0x0000, +0x1EB5,0x0000, 0x1EB6,0x0000, 0x1EB7,0x0000, 0x1EB8,0x0000, +0x1EB9,0x0000, 0x1EBA,0x0000, 0x1EBB,0x0000, 0x1EBC,0x0000, +0x1EBD,0x0000, 0x1EBE,0x0000, 0x1EBF,0x0000, 0x1EC0,0x0000, +0x1EC1,0x0000, 0x1EC2,0x0000, 0x1EC3,0x0000, 0x1EC4,0x0000, +0x1EC5,0x0000, 0x1EC6,0x0000, 0x1EC7,0x0000, 0x1EC8,0x0000, +0x1EC9,0x0000, 0x1ECA,0x0000, 0x1ECB,0x0000, 0x1ECC,0x0000, +0x1ECD,0x0000, 0x1ECE,0x0000, 0x1ECF,0x0000, 0x1ED0,0x0000, +0x1ED1,0x0000, 0x1ED2,0x0000, 0x1ED3,0x0000, 0x1ED4,0x0000, +0x1ED5,0x0000, 0x1ED6,0x0000, 0x1ED7,0x0000, 0x1ED8,0x0000, +0x1ED9,0x0000, 0x1EDA,0x0000, 0x1EDB,0x0000, 0x1EDC,0x0000, +0x1EDD,0x0000, 0x1EDE,0x0000, 0x1EDF,0x0000, 0x1EE0,0x0000, +0x1EE1,0x0000, 0x1EE2,0x0000, 0x1EE3,0x0000, 0x1EE4,0x0000, +0x1EE5,0x0000, 0x1EE6,0x0000, 0x1EE7,0x0000, 0x1EE8,0x0000, +0x1EE9,0x0000, 0x1EEA,0x0000, 0x1EEB,0x0000, 0x1EEC,0x0000, +0x1EED,0x0000, 0x1EEE,0x0000, 0x1EEF,0x0000, 0x1EF0,0x0000, +0x1EF1,0x0000, 0x1EF2,0x0000, 0x1EF3,0x0000, 0x1EF4,0x0000, +0x1EF5,0x0000, 0x1EF6,0x0000, 0x1EF7,0x0000, 0x1EF8,0x0000, +0x1EF9,0x0000, 0x1EFA,0x0000, 0x1EFB,0x0000, 0x1EFC,0x0000, +0x1EFD,0x0000, 0x1EFE,0x0000, 0x1EFF,0x0000, 0x1F00,0x0000, +0x1F01,0x0000, 0x1F02,0x0000, 0x1F03,0x0000, 0x1F04,0x0000, +0x1F05,0x0000, 0x1F06,0x0000, 0x1F07,0x0000, 0x1F08,0x0000, +0x1F09,0x0000, 0x1F0A,0x0000, 0x1F0B,0x0000, 0x1F0C,0x0000, +0x1F0D,0x0000, 0x1F0E,0x0000, 0x1F0F,0x0000, 0x1F10,0x0000, +0x1F11,0x0000, 0x1F12,0x0000, 0x1F13,0x0000, 0x1F14,0x0000, +0x1F15,0x0000, 0x1F16,0x0000, 0x1F17,0x0000, 0x1F18,0x0000, +0x1F19,0x0000, 0x1F1A,0x0000, 0x1F1B,0x0000, 0x1F1C,0x0000, +0x1F1D,0x0000, 0x1F1E,0x0000, 0x1F1F,0x0000, 0x1F20,0x0000, +0x1F21,0x0000, 0x1F22,0x0000, 0x1F23,0x0000, 0x1F24,0x0000, +0x1F25,0x0000, 0x1F26,0x0000, 0x1F27,0x0000, 0x1F28,0x0000, +0x1F29,0x0000, 0x1F2A,0x0000, 0x1F2B,0x0000, 0x1F2C,0x0000, +0x1F2D,0x0000, 0x1F2E,0x0000, 0x1F2F,0x0000, 0x1F30,0x0000, +0x1F31,0x0000, 0x1F32,0x0000, 0x1F33,0x0000, 0x1F34,0x0000, +0x1F35,0x0000, 0x1F36,0x0000, 0x1F37,0x0000, 0x1F38,0x0000, +0x1F39,0x0000, 0x1F3A,0x0000, 0x1F3B,0x0000, 0x1F3C,0x0000, +0x1F3D,0x0000, 0x1F3E,0x0000, 0x1F3F,0x0000, 0x1F40,0x0000, +0x1F41,0x0000, 0x1F42,0x0000, 0x1F43,0x0000, 0x1F44,0x0000, +0x1F45,0x0000, 0x1F46,0x0000, 0x1F47,0x0000, 0x1F48,0x0000, +0x1F49,0x0000, 0x1F4A,0x0000, 0x1F4B,0x0000, 0x1F4C,0x0000, +0x1F4D,0x0000, 0x1F4E,0x0000, 0x1F4F,0x0000, 0x1F50,0x0000, +0x1F51,0x0000, 0x1F52,0x0000, 0x1F53,0x0000, 0x1F54,0x0000, +0x1F55,0x0000, 0x1F56,0x0000, 0x1F57,0x0000, 0x1F58,0x0000, +0x1F59,0x0000, 0x1F5A,0x0000, 0x1F5B,0x0000, 0x1F5C,0x0000, +0x1F5D,0x0000, 0x1F5E,0x0000, 0x1F5F,0x0000, 0x1F60,0x0000, +0x1F61,0x0000, 0x1F62,0x0000, 0x1F63,0x0000, 0x1F64,0x0000, +0x1F65,0x0000, 0x1F66,0x0000, 0x1F67,0x0000, 0x1F68,0x0000, +0x1F69,0x0000, 0x1F6A,0x0000, 0x1F6B,0x0000, 0x1F6C,0x0000, +0x1F6D,0x0000, 0x1F6E,0x0000, 0x1F6F,0x0000, 0x1F70,0x0000, +0x1F71,0x0000, 0x1F72,0x0000, 0x1F73,0x0000, 0x1F74,0x0000, +0x1F75,0x0000, 0x1F76,0x0000, 0x1F77,0x0000, 0x1F78,0x0000, +0x1F79,0x0000, 0x1F7A,0x0000, 0x1F7B,0x0000, 0x1F7C,0x0000, +0x1F7D,0x0000, 0x1F7E,0x0000, 0x1F7F,0x0000, 0x1F80,0x0000, +0x1F81,0x0000, 0x1F82,0x0000, 0x1F83,0x0000, 0x1F84,0x0000, +0x1F85,0x0000, 0x1F86,0x0000, 0x1F87,0x0000, 0x1F88,0x0000, +0x1F89,0x0000, 0x1F8A,0x0000, 0x1F8B,0x0000, 0x1F8C,0x0000, +0x1F8D,0x0000, 0x1F8E,0x0000, 0x1F8F,0x0000, 0x1F90,0x0000, +0x1F91,0x0000, 0x1F92,0x0000, 0x1F93,0x0000, 0x1F94,0x0000, +0x1F95,0x0000, 0x1F96,0x0000, 0x1F97,0x0000, 0x1F98,0x0000, +0x1F99,0x0000, 0x1F9A,0x0000, 0x1F9B,0x0000, 0x1F9C,0x0000, +0x1F9D,0x0000, 0x1F9E,0x0000, 0x1F9F,0x0000, 0x1FA0,0x0000, +0x1FA1,0x0000, 0x1FA2,0x0000, 0x1FA3,0x0000, 0x1FA4,0x0000, +0x1FA5,0x0000, 0x1FA6,0x0000, 0x1FA7,0x0000, 0x1FA8,0x0000, +0x1FA9,0x0000, 0x1FAA,0x0000, 0x1FAB,0x0000, 0x1FAC,0x0000, +0x1FAD,0x0000, 0x1FAE,0x0000, 0x1FAF,0x0000, 0x1FB0,0x0000 +}; + +uint16 page0A1data[]= { /* A100 (2 weights per char) */ +0x1FB1,0x0000, 0x1FB2,0x0000, 0x1FB3,0x0000, 0x1FB4,0x0000, +0x1FB5,0x0000, 0x1FB6,0x0000, 0x1FB7,0x0000, 0x1FB8,0x0000, +0x1FB9,0x0000, 0x1FBA,0x0000, 0x1FBB,0x0000, 0x1FBC,0x0000, +0x1FBD,0x0000, 0x1FBE,0x0000, 0x1FBF,0x0000, 0x1FC0,0x0000, +0x1FC1,0x0000, 0x1FC2,0x0000, 0x1FC3,0x0000, 0x1FC4,0x0000, +0x1FC5,0x0000, 0x1FC6,0x0000, 0x1FC7,0x0000, 0x1FC8,0x0000, +0x1FC9,0x0000, 0x1FCA,0x0000, 0x1FCB,0x0000, 0x1FCC,0x0000, +0x1FCD,0x0000, 0x1FCE,0x0000, 0x1FCF,0x0000, 0x1FD0,0x0000, +0x1FD1,0x0000, 0x1FD2,0x0000, 0x1FD3,0x0000, 0x1FD4,0x0000, +0x1FD5,0x0000, 0x1FD6,0x0000, 0x1FD7,0x0000, 0x1FD8,0x0000, +0x1FD9,0x0000, 0x1FDA,0x0000, 0x1FDB,0x0000, 0x1FDC,0x0000, +0x1FDD,0x0000, 0x1FDE,0x0000, 0x1FDF,0x0000, 0x1FE0,0x0000, +0x1FE1,0x0000, 0x1FE2,0x0000, 0x1FE3,0x0000, 0x1FE4,0x0000, +0x1FE5,0x0000, 0x1FE6,0x0000, 0x1FE7,0x0000, 0x1FE8,0x0000, +0x1FE9,0x0000, 0x1FEA,0x0000, 0x1FEB,0x0000, 0x1FEC,0x0000, +0x1FED,0x0000, 0x1FEE,0x0000, 0x1FEF,0x0000, 0x1FF0,0x0000, +0x1FF1,0x0000, 0x1FF2,0x0000, 0x1FF3,0x0000, 0x1FF4,0x0000, +0x1FF5,0x0000, 0x1FF6,0x0000, 0x1FF7,0x0000, 0x1FF8,0x0000, +0x1FF9,0x0000, 0x1FFA,0x0000, 0x1FFB,0x0000, 0x1FFC,0x0000, +0x1FFD,0x0000, 0x1FFE,0x0000, 0x1FFF,0x0000, 0x2000,0x0000, +0x2001,0x0000, 0x2002,0x0000, 0x2003,0x0000, 0x2004,0x0000, +0x2005,0x0000, 0x2006,0x0000, 0x2007,0x0000, 0x2008,0x0000, +0x2009,0x0000, 0x200A,0x0000, 0x200B,0x0000, 0x200C,0x0000, +0x200D,0x0000, 0x200E,0x0000, 0x200F,0x0000, 0x2010,0x0000, +0x2011,0x0000, 0x2012,0x0000, 0x2013,0x0000, 0x2014,0x0000, +0x2015,0x0000, 0x2016,0x0000, 0x2017,0x0000, 0x2018,0x0000, +0x2019,0x0000, 0x201A,0x0000, 0x201B,0x0000, 0x201C,0x0000, +0x201D,0x0000, 0x201E,0x0000, 0x201F,0x0000, 0x2020,0x0000, +0x2021,0x0000, 0x2022,0x0000, 0x2023,0x0000, 0x2024,0x0000, +0x2025,0x0000, 0x2026,0x0000, 0x2027,0x0000, 0x2028,0x0000, +0x2029,0x0000, 0x202A,0x0000, 0x202B,0x0000, 0x202C,0x0000, +0x202D,0x0000, 0x202E,0x0000, 0x202F,0x0000, 0x2030,0x0000, +0x2031,0x0000, 0x2032,0x0000, 0x2033,0x0000, 0x2034,0x0000, +0x2035,0x0000, 0x2036,0x0000, 0x2037,0x0000, 0x2038,0x0000, +0x2039,0x0000, 0x203A,0x0000, 0x203B,0x0000, 0x203C,0x0000, +0x203D,0x0000, 0x203E,0x0000, 0x203F,0x0000, 0x2040,0x0000, +0x2041,0x0000, 0x2042,0x0000, 0x2043,0x0000, 0x2044,0x0000, +0x2045,0x0000, 0x2046,0x0000, 0x2047,0x0000, 0x2048,0x0000, +0x2049,0x0000, 0x204A,0x0000, 0x204B,0x0000, 0x204C,0x0000, +0x204D,0x0000, 0x204E,0x0000, 0x204F,0x0000, 0x2050,0x0000, +0x2051,0x0000, 0x2052,0x0000, 0x2053,0x0000, 0x2054,0x0000, +0x2055,0x0000, 0x2056,0x0000, 0x2057,0x0000, 0x2058,0x0000, +0x2059,0x0000, 0x205A,0x0000, 0x205B,0x0000, 0x205C,0x0000, +0x205D,0x0000, 0x205E,0x0000, 0x205F,0x0000, 0x2060,0x0000, +0x2061,0x0000, 0x2062,0x0000, 0x2063,0x0000, 0x2064,0x0000, +0x2065,0x0000, 0x2066,0x0000, 0x2067,0x0000, 0x2068,0x0000, +0x2069,0x0000, 0x206A,0x0000, 0x206B,0x0000, 0x206C,0x0000, +0x206D,0x0000, 0x206E,0x0000, 0x206F,0x0000, 0x2070,0x0000, +0x2071,0x0000, 0x2072,0x0000, 0x2073,0x0000, 0x2074,0x0000, +0x2075,0x0000, 0x2076,0x0000, 0x2077,0x0000, 0x2078,0x0000, +0x2079,0x0000, 0x207A,0x0000, 0x207B,0x0000, 0x207C,0x0000, +0x207D,0x0000, 0x207E,0x0000, 0x207F,0x0000, 0x2080,0x0000, +0x2081,0x0000, 0x2082,0x0000, 0x2083,0x0000, 0x2084,0x0000, +0x2085,0x0000, 0x2086,0x0000, 0x2087,0x0000, 0x2088,0x0000, +0x2089,0x0000, 0x208A,0x0000, 0x208B,0x0000, 0x208C,0x0000, +0x208D,0x0000, 0x208E,0x0000, 0x208F,0x0000, 0x2090,0x0000, +0x2091,0x0000, 0x2092,0x0000, 0x2093,0x0000, 0x2094,0x0000, +0x2095,0x0000, 0x2096,0x0000, 0x2097,0x0000, 0x2098,0x0000, +0x2099,0x0000, 0x209A,0x0000, 0x209B,0x0000, 0x209C,0x0000, +0x209D,0x0000, 0x209E,0x0000, 0x209F,0x0000, 0x20A0,0x0000, +0x20A1,0x0000, 0x20A2,0x0000, 0x20A3,0x0000, 0x20A4,0x0000, +0x20A5,0x0000, 0x20A6,0x0000, 0x20A7,0x0000, 0x20A8,0x0000, +0x20A9,0x0000, 0x20AA,0x0000, 0x20AB,0x0000, 0x20AC,0x0000, +0x20AD,0x0000, 0x20AE,0x0000, 0x20AF,0x0000, 0x20B0,0x0000 +}; + +uint16 page0A2data[]= { /* A200 (2 weights per char) */ +0x20B1,0x0000, 0x20B2,0x0000, 0x20B3,0x0000, 0x20B4,0x0000, +0x20B5,0x0000, 0x20B6,0x0000, 0x20B7,0x0000, 0x20B8,0x0000, +0x20B9,0x0000, 0x20BA,0x0000, 0x20BB,0x0000, 0x20BC,0x0000, +0x20BD,0x0000, 0x20BE,0x0000, 0x20BF,0x0000, 0x20C0,0x0000, +0x20C1,0x0000, 0x20C2,0x0000, 0x20C3,0x0000, 0x20C4,0x0000, +0x20C5,0x0000, 0x20C6,0x0000, 0x20C7,0x0000, 0x20C8,0x0000, +0x20C9,0x0000, 0x20CA,0x0000, 0x20CB,0x0000, 0x20CC,0x0000, +0x20CD,0x0000, 0x20CE,0x0000, 0x20CF,0x0000, 0x20D0,0x0000, +0x20D1,0x0000, 0x20D2,0x0000, 0x20D3,0x0000, 0x20D4,0x0000, +0x20D5,0x0000, 0x20D6,0x0000, 0x20D7,0x0000, 0x20D8,0x0000, +0x20D9,0x0000, 0x20DA,0x0000, 0x20DB,0x0000, 0x20DC,0x0000, +0x20DD,0x0000, 0x20DE,0x0000, 0x20DF,0x0000, 0x20E0,0x0000, +0x20E1,0x0000, 0x20E2,0x0000, 0x20E3,0x0000, 0x20E4,0x0000, +0x20E5,0x0000, 0x20E6,0x0000, 0x20E7,0x0000, 0x20E8,0x0000, +0x20E9,0x0000, 0x20EA,0x0000, 0x20EB,0x0000, 0x20EC,0x0000, +0x20ED,0x0000, 0x20EE,0x0000, 0x20EF,0x0000, 0x20F0,0x0000, +0x20F1,0x0000, 0x20F2,0x0000, 0x20F3,0x0000, 0x20F4,0x0000, +0x20F5,0x0000, 0x20F6,0x0000, 0x20F7,0x0000, 0x20F8,0x0000, +0x20F9,0x0000, 0x20FA,0x0000, 0x20FB,0x0000, 0x20FC,0x0000, +0x20FD,0x0000, 0x20FE,0x0000, 0x20FF,0x0000, 0x2100,0x0000, +0x2101,0x0000, 0x2102,0x0000, 0x2103,0x0000, 0x2104,0x0000, +0x2105,0x0000, 0x2106,0x0000, 0x2107,0x0000, 0x2108,0x0000, +0x2109,0x0000, 0x210A,0x0000, 0x210B,0x0000, 0x210C,0x0000, +0x210D,0x0000, 0x210E,0x0000, 0x210F,0x0000, 0x2110,0x0000, +0x2111,0x0000, 0x2112,0x0000, 0x2113,0x0000, 0x2114,0x0000, +0x2115,0x0000, 0x2116,0x0000, 0x2117,0x0000, 0x2118,0x0000, +0x2119,0x0000, 0x211A,0x0000, 0x211B,0x0000, 0x211C,0x0000, +0x211D,0x0000, 0x211E,0x0000, 0x211F,0x0000, 0x2120,0x0000, +0x2121,0x0000, 0x2122,0x0000, 0x2123,0x0000, 0x2124,0x0000, +0x2125,0x0000, 0x2126,0x0000, 0x2127,0x0000, 0x2128,0x0000, +0x2129,0x0000, 0x212A,0x0000, 0x212B,0x0000, 0x212C,0x0000, +0x212D,0x0000, 0x212E,0x0000, 0x212F,0x0000, 0x2130,0x0000, +0x2131,0x0000, 0x2132,0x0000, 0x2133,0x0000, 0x2134,0x0000, +0x2135,0x0000, 0x2136,0x0000, 0x2137,0x0000, 0x2138,0x0000, +0x2139,0x0000, 0x213A,0x0000, 0x213B,0x0000, 0x213C,0x0000, +0x213D,0x0000, 0x213E,0x0000, 0x213F,0x0000, 0x2140,0x0000, +0x2141,0x0000, 0x2142,0x0000, 0x2143,0x0000, 0x2144,0x0000, +0x2145,0x0000, 0x2146,0x0000, 0x2147,0x0000, 0x2148,0x0000, +0x2149,0x0000, 0x214A,0x0000, 0x214B,0x0000, 0x214C,0x0000, +0x214D,0x0000, 0x214E,0x0000, 0x214F,0x0000, 0x2150,0x0000, +0x2151,0x0000, 0x2152,0x0000, 0x2153,0x0000, 0x2154,0x0000, +0x2155,0x0000, 0x2156,0x0000, 0x2157,0x0000, 0x2158,0x0000, +0x2159,0x0000, 0x215A,0x0000, 0x215B,0x0000, 0x215C,0x0000, +0x215D,0x0000, 0x215E,0x0000, 0x215F,0x0000, 0x2160,0x0000, +0x2161,0x0000, 0x2162,0x0000, 0x2163,0x0000, 0x2164,0x0000, +0x2165,0x0000, 0x2166,0x0000, 0x2167,0x0000, 0x2168,0x0000, +0x2169,0x0000, 0x216A,0x0000, 0x216B,0x0000, 0x216C,0x0000, +0x216D,0x0000, 0x216E,0x0000, 0x216F,0x0000, 0x2170,0x0000, +0x2171,0x0000, 0x2172,0x0000, 0x2173,0x0000, 0x2174,0x0000, +0x2175,0x0000, 0x2176,0x0000, 0x2177,0x0000, 0x2178,0x0000, +0x2179,0x0000, 0x217A,0x0000, 0x217B,0x0000, 0x217C,0x0000, +0x217D,0x0000, 0x217E,0x0000, 0x217F,0x0000, 0x2180,0x0000, +0x2181,0x0000, 0x2182,0x0000, 0x2183,0x0000, 0x2184,0x0000, +0x2185,0x0000, 0x2186,0x0000, 0x2187,0x0000, 0x2188,0x0000, +0x2189,0x0000, 0x218A,0x0000, 0x218B,0x0000, 0x218C,0x0000, +0x218D,0x0000, 0x218E,0x0000, 0x218F,0x0000, 0x2190,0x0000, +0x2191,0x0000, 0x2192,0x0000, 0x2193,0x0000, 0x2194,0x0000, +0x2195,0x0000, 0x2196,0x0000, 0x2197,0x0000, 0x2198,0x0000, +0x2199,0x0000, 0x219A,0x0000, 0x219B,0x0000, 0x219C,0x0000, +0x219D,0x0000, 0x219E,0x0000, 0x219F,0x0000, 0x21A0,0x0000, +0x21A1,0x0000, 0x21A2,0x0000, 0x21A3,0x0000, 0x21A4,0x0000, +0x21A5,0x0000, 0x21A6,0x0000, 0x21A7,0x0000, 0x21A8,0x0000, +0x21A9,0x0000, 0x21AA,0x0000, 0x21AB,0x0000, 0x21AC,0x0000, +0x21AD,0x0000, 0x21AE,0x0000, 0x21AF,0x0000, 0x21B0,0x0000 +}; + +uint16 page0A3data[]= { /* A300 (2 weights per char) */ +0x21B1,0x0000, 0x21B2,0x0000, 0x21B3,0x0000, 0x21B4,0x0000, +0x21B5,0x0000, 0x21B6,0x0000, 0x21B7,0x0000, 0x21B8,0x0000, +0x21B9,0x0000, 0x21BA,0x0000, 0x21BB,0x0000, 0x21BC,0x0000, +0x21BD,0x0000, 0x21BE,0x0000, 0x21BF,0x0000, 0x21C0,0x0000, +0x21C1,0x0000, 0x21C2,0x0000, 0x21C3,0x0000, 0x21C4,0x0000, +0x21C5,0x0000, 0x21C6,0x0000, 0x21C7,0x0000, 0x21C8,0x0000, +0x21C9,0x0000, 0x21CA,0x0000, 0x21CB,0x0000, 0x21CC,0x0000, +0x21CD,0x0000, 0x21CE,0x0000, 0x21CF,0x0000, 0x21D0,0x0000, +0x21D1,0x0000, 0x21D2,0x0000, 0x21D3,0x0000, 0x21D4,0x0000, +0x21D5,0x0000, 0x21D6,0x0000, 0x21D7,0x0000, 0x21D8,0x0000, +0x21D9,0x0000, 0x21DA,0x0000, 0x21DB,0x0000, 0x21DC,0x0000, +0x21DD,0x0000, 0x21DE,0x0000, 0x21DF,0x0000, 0x21E0,0x0000, +0x21E1,0x0000, 0x21E2,0x0000, 0x21E3,0x0000, 0x21E4,0x0000, +0x21E5,0x0000, 0x21E6,0x0000, 0x21E7,0x0000, 0x21E8,0x0000, +0x21E9,0x0000, 0x21EA,0x0000, 0x21EB,0x0000, 0x21EC,0x0000, +0x21ED,0x0000, 0x21EE,0x0000, 0x21EF,0x0000, 0x21F0,0x0000, +0x21F1,0x0000, 0x21F2,0x0000, 0x21F3,0x0000, 0x21F4,0x0000, +0x21F5,0x0000, 0x21F6,0x0000, 0x21F7,0x0000, 0x21F8,0x0000, +0x21F9,0x0000, 0x21FA,0x0000, 0x21FB,0x0000, 0x21FC,0x0000, +0x21FD,0x0000, 0x21FE,0x0000, 0x21FF,0x0000, 0x2200,0x0000, +0x2201,0x0000, 0x2202,0x0000, 0x2203,0x0000, 0x2204,0x0000, +0x2205,0x0000, 0x2206,0x0000, 0x2207,0x0000, 0x2208,0x0000, +0x2209,0x0000, 0x220A,0x0000, 0x220B,0x0000, 0x220C,0x0000, +0x220D,0x0000, 0x220E,0x0000, 0x220F,0x0000, 0x2210,0x0000, +0x2211,0x0000, 0x2212,0x0000, 0x2213,0x0000, 0x2214,0x0000, +0x2215,0x0000, 0x2216,0x0000, 0x2217,0x0000, 0x2218,0x0000, +0x2219,0x0000, 0x221A,0x0000, 0x221B,0x0000, 0x221C,0x0000, +0x221D,0x0000, 0x221E,0x0000, 0x221F,0x0000, 0x2220,0x0000, +0x2221,0x0000, 0x2222,0x0000, 0x2223,0x0000, 0x2224,0x0000, +0x2225,0x0000, 0x2226,0x0000, 0x2227,0x0000, 0x2228,0x0000, +0x2229,0x0000, 0x222A,0x0000, 0x222B,0x0000, 0x222C,0x0000, +0x222D,0x0000, 0x222E,0x0000, 0x222F,0x0000, 0x2230,0x0000, +0x2231,0x0000, 0x2232,0x0000, 0x2233,0x0000, 0x2234,0x0000, +0x2235,0x0000, 0x2236,0x0000, 0x2237,0x0000, 0x2238,0x0000, +0x2239,0x0000, 0x223A,0x0000, 0x223B,0x0000, 0x223C,0x0000, +0x223D,0x0000, 0x223E,0x0000, 0x223F,0x0000, 0x2240,0x0000, +0x2241,0x0000, 0x2242,0x0000, 0x2243,0x0000, 0x2244,0x0000, +0x2245,0x0000, 0x2246,0x0000, 0x2247,0x0000, 0x2248,0x0000, +0x2249,0x0000, 0x224A,0x0000, 0x224B,0x0000, 0x224C,0x0000, +0x224D,0x0000, 0x224E,0x0000, 0x224F,0x0000, 0x2250,0x0000, +0x2251,0x0000, 0x2252,0x0000, 0x2253,0x0000, 0x2254,0x0000, +0x2255,0x0000, 0x2256,0x0000, 0x2257,0x0000, 0x2258,0x0000, +0x2259,0x0000, 0x225A,0x0000, 0x225B,0x0000, 0x225C,0x0000, +0x225D,0x0000, 0x225E,0x0000, 0x225F,0x0000, 0x2260,0x0000, +0x2261,0x0000, 0x2262,0x0000, 0x2263,0x0000, 0x2264,0x0000, +0x2265,0x0000, 0x2266,0x0000, 0x2267,0x0000, 0x2268,0x0000, +0x2269,0x0000, 0x226A,0x0000, 0x226B,0x0000, 0x226C,0x0000, +0x226D,0x0000, 0x226E,0x0000, 0x226F,0x0000, 0x2270,0x0000, +0x2271,0x0000, 0x2272,0x0000, 0x2273,0x0000, 0x2274,0x0000, +0x2275,0x0000, 0x2276,0x0000, 0x2277,0x0000, 0x2278,0x0000, +0x2279,0x0000, 0x227A,0x0000, 0x227B,0x0000, 0x227C,0x0000, +0x227D,0x0000, 0x227E,0x0000, 0x227F,0x0000, 0x2280,0x0000, +0x2281,0x0000, 0x2282,0x0000, 0x2283,0x0000, 0x2284,0x0000, +0x2285,0x0000, 0x2286,0x0000, 0x2287,0x0000, 0x2288,0x0000, +0x2289,0x0000, 0x228A,0x0000, 0x228B,0x0000, 0x228C,0x0000, +0x228D,0x0000, 0x228E,0x0000, 0x228F,0x0000, 0x2290,0x0000, +0x2291,0x0000, 0x2292,0x0000, 0x2293,0x0000, 0x2294,0x0000, +0x2295,0x0000, 0x2296,0x0000, 0x2297,0x0000, 0x2298,0x0000, +0x2299,0x0000, 0x229A,0x0000, 0x229B,0x0000, 0x229C,0x0000, +0x229D,0x0000, 0x229E,0x0000, 0x229F,0x0000, 0x22A0,0x0000, +0x22A1,0x0000, 0x22A2,0x0000, 0x22A3,0x0000, 0x22A4,0x0000, +0x22A5,0x0000, 0x22A6,0x0000, 0x22A7,0x0000, 0x22A8,0x0000, +0x22A9,0x0000, 0x22AA,0x0000, 0x22AB,0x0000, 0x22AC,0x0000, +0x22AD,0x0000, 0x22AE,0x0000, 0x22AF,0x0000, 0x22B0,0x0000 +}; + +uint16 page0A4data[]= { /* A400 (3 weights per char) */ +0x22B1,0x0000,0x0000, 0x22B2,0x0000,0x0000, 0x22B3,0x0000,0x0000, +0x22B4,0x0000,0x0000, 0x22B5,0x0000,0x0000, 0x22B6,0x0000,0x0000, +0x22B7,0x0000,0x0000, 0x22B8,0x0000,0x0000, 0x22B9,0x0000,0x0000, +0x22BA,0x0000,0x0000, 0x22BB,0x0000,0x0000, 0x22BC,0x0000,0x0000, +0x22BD,0x0000,0x0000, 0x22BE,0x0000,0x0000, 0x22BF,0x0000,0x0000, +0x22C0,0x0000,0x0000, 0x22C1,0x0000,0x0000, 0x22C2,0x0000,0x0000, +0x22C3,0x0000,0x0000, 0x22C4,0x0000,0x0000, 0x22C5,0x0000,0x0000, +0x22C6,0x0000,0x0000, 0x22C7,0x0000,0x0000, 0x22C8,0x0000,0x0000, +0x22C9,0x0000,0x0000, 0x22CA,0x0000,0x0000, 0x22CB,0x0000,0x0000, +0x22CC,0x0000,0x0000, 0x22CD,0x0000,0x0000, 0x22CE,0x0000,0x0000, +0x22CF,0x0000,0x0000, 0x22D0,0x0000,0x0000, 0x22D1,0x0000,0x0000, +0x22D2,0x0000,0x0000, 0x22D3,0x0000,0x0000, 0x22D4,0x0000,0x0000, +0x22D5,0x0000,0x0000, 0x22D6,0x0000,0x0000, 0x22D7,0x0000,0x0000, +0x22D8,0x0000,0x0000, 0x22D9,0x0000,0x0000, 0x22DA,0x0000,0x0000, +0x22DB,0x0000,0x0000, 0x22DC,0x0000,0x0000, 0x22DD,0x0000,0x0000, +0x22DE,0x0000,0x0000, 0x22DF,0x0000,0x0000, 0x22E0,0x0000,0x0000, +0x22E1,0x0000,0x0000, 0x22E2,0x0000,0x0000, 0x22E3,0x0000,0x0000, +0x22E4,0x0000,0x0000, 0x22E5,0x0000,0x0000, 0x22E6,0x0000,0x0000, +0x22E7,0x0000,0x0000, 0x22E8,0x0000,0x0000, 0x22E9,0x0000,0x0000, +0x22EA,0x0000,0x0000, 0x22EB,0x0000,0x0000, 0x22EC,0x0000,0x0000, +0x22ED,0x0000,0x0000, 0x22EE,0x0000,0x0000, 0x22EF,0x0000,0x0000, +0x22F0,0x0000,0x0000, 0x22F1,0x0000,0x0000, 0x22F2,0x0000,0x0000, +0x22F3,0x0000,0x0000, 0x22F4,0x0000,0x0000, 0x22F5,0x0000,0x0000, +0x22F6,0x0000,0x0000, 0x22F7,0x0000,0x0000, 0x22F8,0x0000,0x0000, +0x22F9,0x0000,0x0000, 0x22FA,0x0000,0x0000, 0x22FB,0x0000,0x0000, +0x22FC,0x0000,0x0000, 0x22FD,0x0000,0x0000, 0x22FE,0x0000,0x0000, +0x22FF,0x0000,0x0000, 0x2300,0x0000,0x0000, 0x2301,0x0000,0x0000, +0x2302,0x0000,0x0000, 0x2303,0x0000,0x0000, 0x2304,0x0000,0x0000, +0x2305,0x0000,0x0000, 0x2306,0x0000,0x0000, 0x2307,0x0000,0x0000, +0x2308,0x0000,0x0000, 0x2309,0x0000,0x0000, 0x230A,0x0000,0x0000, +0x230B,0x0000,0x0000, 0x230C,0x0000,0x0000, 0x230D,0x0000,0x0000, +0x230E,0x0000,0x0000, 0x230F,0x0000,0x0000, 0x2310,0x0000,0x0000, +0x2311,0x0000,0x0000, 0x2312,0x0000,0x0000, 0x2313,0x0000,0x0000, +0x2314,0x0000,0x0000, 0x2315,0x0000,0x0000, 0x2316,0x0000,0x0000, +0x2317,0x0000,0x0000, 0x2318,0x0000,0x0000, 0x2319,0x0000,0x0000, +0x231A,0x0000,0x0000, 0x231B,0x0000,0x0000, 0x231C,0x0000,0x0000, +0x231D,0x0000,0x0000, 0x231E,0x0000,0x0000, 0x231F,0x0000,0x0000, +0x2320,0x0000,0x0000, 0x2321,0x0000,0x0000, 0x2322,0x0000,0x0000, +0x2323,0x0000,0x0000, 0x2324,0x0000,0x0000, 0x2325,0x0000,0x0000, +0x2326,0x0000,0x0000, 0x2327,0x0000,0x0000, 0x2328,0x0000,0x0000, +0x2329,0x0000,0x0000, 0x232A,0x0000,0x0000, 0x232B,0x0000,0x0000, +0x232C,0x0000,0x0000, 0x232D,0x0000,0x0000, 0x232E,0x0000,0x0000, +0x232F,0x0000,0x0000, 0x2330,0x0000,0x0000, 0x2331,0x0000,0x0000, +0x2332,0x0000,0x0000, 0x2333,0x0000,0x0000, 0x2334,0x0000,0x0000, +0x2335,0x0000,0x0000, 0x2336,0x0000,0x0000, 0x2337,0x0000,0x0000, +0x2338,0x0000,0x0000, 0x2339,0x0000,0x0000, 0x233A,0x0000,0x0000, +0x233B,0x0000,0x0000, 0x233C,0x0000,0x0000, 0x233D,0x0000,0x0000, +0xFBC1,0xA48D,0x0000, 0xFBC1,0xA48E,0x0000, 0xFBC1,0xA48F,0x0000, +0x0BCE,0x0000,0x0000, 0x0BCF,0x0000,0x0000, 0x0BD0,0x0000,0x0000, +0x0BD1,0x0000,0x0000, 0x0BD2,0x0000,0x0000, 0x0BD3,0x0000,0x0000, +0x0BD4,0x0000,0x0000, 0x0BD5,0x0000,0x0000, 0x0BD6,0x0000,0x0000, +0x0BD7,0x0000,0x0000, 0x0BD8,0x0000,0x0000, 0x0BD9,0x0000,0x0000, +0x0BDA,0x0000,0x0000, 0x0BDB,0x0000,0x0000, 0x0BDC,0x0000,0x0000, +0x0BDD,0x0000,0x0000, 0x0BDE,0x0000,0x0000, 0x0BDF,0x0000,0x0000, +0x0BE0,0x0000,0x0000, 0x0BE1,0x0000,0x0000, 0x0BE2,0x0000,0x0000, +0x0BE3,0x0000,0x0000, 0x0BE4,0x0000,0x0000, 0x0BE5,0x0000,0x0000, +0x0BE6,0x0000,0x0000, 0x0BE7,0x0000,0x0000, 0x0BE8,0x0000,0x0000, +0x0BE9,0x0000,0x0000, 0x0BEA,0x0000,0x0000, 0x0BEB,0x0000,0x0000, +0x0BEC,0x0000,0x0000, 0x0BED,0x0000,0x0000, 0x0BEE,0x0000,0x0000, +0x0BEF,0x0000,0x0000, 0x0BF0,0x0000,0x0000, 0x0BF1,0x0000,0x0000, +0x0BF2,0x0000,0x0000, 0x0BF3,0x0000,0x0000, 0x0BF4,0x0000,0x0000, +0x0BF5,0x0000,0x0000, 0x0BF6,0x0000,0x0000, 0x0BF7,0x0000,0x0000, +0x0BF8,0x0000,0x0000, 0x0BF9,0x0000,0x0000, 0x0BFA,0x0000,0x0000, +0x0BFB,0x0000,0x0000, 0x0BFC,0x0000,0x0000, 0x0BFD,0x0000,0x0000, +0x0BFE,0x0000,0x0000, 0x0BFF,0x0000,0x0000, 0x0C00,0x0000,0x0000, +0x0C01,0x0000,0x0000, 0x0C02,0x0000,0x0000, 0x0C03,0x0000,0x0000, +0x0C04,0x0000,0x0000, 0xFBC1,0xA4C7,0x0000, 0xFBC1,0xA4C8,0x0000, +0xFBC1,0xA4C9,0x0000, 0xFBC1,0xA4CA,0x0000, 0xFBC1,0xA4CB,0x0000, +0xFBC1,0xA4CC,0x0000, 0xFBC1,0xA4CD,0x0000, 0xFBC1,0xA4CE,0x0000, +0xFBC1,0xA4CF,0x0000, 0xFBC1,0xA4D0,0x0000, 0xFBC1,0xA4D1,0x0000, +0xFBC1,0xA4D2,0x0000, 0xFBC1,0xA4D3,0x0000, 0xFBC1,0xA4D4,0x0000, +0xFBC1,0xA4D5,0x0000, 0xFBC1,0xA4D6,0x0000, 0xFBC1,0xA4D7,0x0000, +0xFBC1,0xA4D8,0x0000, 0xFBC1,0xA4D9,0x0000, 0xFBC1,0xA4DA,0x0000, +0xFBC1,0xA4DB,0x0000, 0xFBC1,0xA4DC,0x0000, 0xFBC1,0xA4DD,0x0000, +0xFBC1,0xA4DE,0x0000, 0xFBC1,0xA4DF,0x0000, 0xFBC1,0xA4E0,0x0000, +0xFBC1,0xA4E1,0x0000, 0xFBC1,0xA4E2,0x0000, 0xFBC1,0xA4E3,0x0000, +0xFBC1,0xA4E4,0x0000, 0xFBC1,0xA4E5,0x0000, 0xFBC1,0xA4E6,0x0000, +0xFBC1,0xA4E7,0x0000, 0xFBC1,0xA4E8,0x0000, 0xFBC1,0xA4E9,0x0000, +0xFBC1,0xA4EA,0x0000, 0xFBC1,0xA4EB,0x0000, 0xFBC1,0xA4EC,0x0000, +0xFBC1,0xA4ED,0x0000, 0xFBC1,0xA4EE,0x0000, 0xFBC1,0xA4EF,0x0000, +0xFBC1,0xA4F0,0x0000, 0xFBC1,0xA4F1,0x0000, 0xFBC1,0xA4F2,0x0000, +0xFBC1,0xA4F3,0x0000, 0xFBC1,0xA4F4,0x0000, 0xFBC1,0xA4F5,0x0000, +0xFBC1,0xA4F6,0x0000, 0xFBC1,0xA4F7,0x0000, 0xFBC1,0xA4F8,0x0000, +0xFBC1,0xA4F9,0x0000, 0xFBC1,0xA4FA,0x0000, 0xFBC1,0xA4FB,0x0000, +0xFBC1,0xA4FC,0x0000, 0xFBC1,0xA4FD,0x0000, 0xFBC1,0xA4FE,0x0000, +0xFBC1,0xA4FF,0x0000 }; + +uint16 page0F9data[]= { /* F900 (3 weights per char) */ +0xFB41,0x8C48,0x0000, 0xFB40,0xE6F4,0x0000, 0xFB41,0x8ECA,0x0000, +0xFB41,0x8CC8,0x0000, 0xFB40,0xEED1,0x0000, 0xFB40,0xCE32,0x0000, +0xFB40,0xD3E5,0x0000, 0xFB41,0x9F9C,0x0000, 0xFB41,0x9F9C,0x0000, +0xFB40,0xD951,0x0000, 0xFB41,0x91D1,0x0000, 0xFB40,0xD587,0x0000, +0xFB40,0xD948,0x0000, 0xFB40,0xE1F6,0x0000, 0xFB40,0xF669,0x0000, +0xFB40,0xFF85,0x0000, 0xFB41,0x863F,0x0000, 0xFB41,0x87BA,0x0000, +0xFB41,0x88F8,0x0000, 0xFB41,0x908F,0x0000, 0xFB40,0xEA02,0x0000, +0xFB40,0xED1B,0x0000, 0xFB40,0xF0D9,0x0000, 0xFB40,0xF3DE,0x0000, +0xFB41,0x843D,0x0000, 0xFB41,0x916A,0x0000, 0xFB41,0x99F1,0x0000, +0xFB40,0xCE82,0x0000, 0xFB40,0xD375,0x0000, 0xFB40,0xEB04,0x0000, +0xFB40,0xF21B,0x0000, 0xFB41,0x862D,0x0000, 0xFB41,0x9E1E,0x0000, +0xFB40,0xDD50,0x0000, 0xFB40,0xEFEB,0x0000, 0xFB41,0x85CD,0x0000, +0xFB41,0x8964,0x0000, 0xFB40,0xE2C9,0x0000, 0xFB41,0x81D8,0x0000, +0xFB41,0x881F,0x0000, 0xFB40,0xDECA,0x0000, 0xFB40,0xE717,0x0000, +0xFB40,0xED6A,0x0000, 0xFB40,0xF2FC,0x0000, 0xFB41,0x90CE,0x0000, +0xFB40,0xCF86,0x0000, 0xFB40,0xD1B7,0x0000, 0xFB40,0xD2DE,0x0000, +0xFB40,0xE4C4,0x0000, 0xFB40,0xEAD3,0x0000, 0xFB40,0xF210,0x0000, +0xFB40,0xF6E7,0x0000, 0xFB41,0x8001,0x0000, 0xFB41,0x8606,0x0000, +0xFB41,0x865C,0x0000, 0xFB41,0x8DEF,0x0000, 0xFB41,0x9732,0x0000, +0xFB41,0x9B6F,0x0000, 0xFB41,0x9DFA,0x0000, 0xFB40,0xF88C,0x0000, +0xFB40,0xF97F,0x0000, 0xFB40,0xFDA0,0x0000, 0xFB41,0x83C9,0x0000, +0xFB41,0x9304,0x0000, 0xFB41,0x9E7F,0x0000, 0xFB41,0x8AD6,0x0000, +0xFB40,0xD8DF,0x0000, 0xFB40,0xDF04,0x0000, 0xFB40,0xFC60,0x0000, +0xFB41,0x807E,0x0000, 0xFB40,0xF262,0x0000, 0xFB40,0xF8CA,0x0000, +0xFB41,0x8CC2,0x0000, 0xFB41,0x96F7,0x0000, 0xFB40,0xD8D8,0x0000, +0xFB40,0xDC62,0x0000, 0xFB40,0xEA13,0x0000, 0xFB40,0xEDDA,0x0000, +0xFB40,0xEF0F,0x0000, 0xFB40,0xFD2F,0x0000, 0xFB40,0xFE37,0x0000, +0xFB41,0x964B,0x0000, 0xFB40,0xD2D2,0x0000, 0xFB41,0x808B,0x0000, +0xFB40,0xD1DC,0x0000, 0xFB40,0xD1CC,0x0000, 0xFB40,0xFA1C,0x0000, +0xFB40,0xFDBE,0x0000, 0xFB41,0x83F1,0x0000, 0xFB41,0x9675,0x0000, +0xFB41,0x8B80,0x0000, 0xFB40,0xE2CF,0x0000, 0xFB40,0xEA02,0x0000, +0xFB41,0x8AFE,0x0000, 0xFB40,0xCE39,0x0000, 0xFB40,0xDBE7,0x0000, +0xFB40,0xE012,0x0000, 0xFB40,0xF387,0x0000, 0xFB40,0xF570,0x0000, +0xFB40,0xD317,0x0000, 0xFB40,0xF8FB,0x0000, 0xFB40,0xCFBF,0x0000, +0xFB40,0xDFA9,0x0000, 0xFB40,0xCE0D,0x0000, 0xFB40,0xECCC,0x0000, +0xFB40,0xE578,0x0000, 0xFB40,0xFD22,0x0000, 0xFB40,0xD3C3,0x0000, +0xFB40,0xD85E,0x0000, 0xFB40,0xF701,0x0000, 0xFB41,0x8449,0x0000, +0xFB41,0x8AAA,0x0000, 0xFB40,0xEBBA,0x0000, 0xFB41,0x8FB0,0x0000, +0xFB40,0xEC88,0x0000, 0xFB40,0xE2FE,0x0000, 0xFB41,0x82E5,0x0000, +0xFB40,0xE3A0,0x0000, 0xFB40,0xF565,0x0000, 0xFB40,0xCEAE,0x0000, +0xFB40,0xD169,0x0000, 0xFB40,0xD1C9,0x0000, 0xFB40,0xE881,0x0000, +0xFB40,0xFCE7,0x0000, 0xFB41,0x826F,0x0000, 0xFB41,0x8AD2,0x0000, +0xFB41,0x91CF,0x0000, 0xFB40,0xD2F5,0x0000, 0xFB40,0xD442,0x0000, +0xFB40,0xD973,0x0000, 0xFB40,0xDEEC,0x0000, 0xFB40,0xE5C5,0x0000, +0xFB40,0xEFFE,0x0000, 0xFB40,0xF92A,0x0000, 0xFB41,0x95AD,0x0000, +0xFB41,0x9A6A,0x0000, 0xFB41,0x9E97,0x0000, 0xFB41,0x9ECE,0x0000, +0xFB40,0xD29B,0x0000, 0xFB40,0xE6C6,0x0000, 0xFB40,0xEB77,0x0000, +0xFB41,0x8F62,0x0000, 0xFB40,0xDE74,0x0000, 0xFB40,0xE190,0x0000, +0xFB40,0xE200,0x0000, 0xFB40,0xE49A,0x0000, 0xFB40,0xEF23,0x0000, +0xFB40,0xF149,0x0000, 0xFB40,0xF489,0x0000, 0xFB40,0xF9CA,0x0000, +0xFB40,0xFDF4,0x0000, 0xFB41,0x806F,0x0000, 0xFB41,0x8F26,0x0000, +0xFB41,0x84EE,0x0000, 0xFB41,0x9023,0x0000, 0xFB41,0x934A,0x0000, +0xFB40,0xD217,0x0000, 0xFB40,0xD2A3,0x0000, 0xFB40,0xD4BD,0x0000, +0xFB40,0xF0C8,0x0000, 0xFB41,0x88C2,0x0000, 0xFB41,0x8AAA,0x0000, +0xFB40,0xDEC9,0x0000, 0xFB40,0xDFF5,0x0000, 0xFB40,0xE37B,0x0000, +0xFB40,0xEBAE,0x0000, 0xFB40,0xFC3E,0x0000, 0xFB40,0xF375,0x0000, +0xFB40,0xCEE4,0x0000, 0xFB40,0xD6F9,0x0000, 0xFB40,0xDBE7,0x0000, +0xFB40,0xDDBA,0x0000, 0xFB40,0xE01C,0x0000, 0xFB40,0xF3B2,0x0000, +0xFB40,0xF469,0x0000, 0xFB40,0xFF9A,0x0000, 0xFB41,0x8046,0x0000, +0xFB41,0x9234,0x0000, 0xFB41,0x96F6,0x0000, 0xFB41,0x9748,0x0000, +0xFB41,0x9818,0x0000, 0xFB40,0xCF8B,0x0000, 0xFB40,0xF9AE,0x0000, +0xFB41,0x91B4,0x0000, 0xFB41,0x96B8,0x0000, 0xFB40,0xE0E1,0x0000, +0xFB40,0xCE86,0x0000, 0xFB40,0xD0DA,0x0000, 0xFB40,0xDBEE,0x0000, +0xFB40,0xDC3F,0x0000, 0xFB40,0xE599,0x0000, 0xFB40,0xEA02,0x0000, +0xFB40,0xF1CE,0x0000, 0xFB40,0xF642,0x0000, 0xFB41,0x84FC,0x0000, +0xFB41,0x907C,0x0000, 0xFB41,0x9F8D,0x0000, 0xFB40,0xE688,0x0000, +0xFB41,0x962E,0x0000, 0xFB40,0xD289,0x0000, 0xFB40,0xE77B,0x0000, +0xFB40,0xE7F3,0x0000, 0xFB40,0xED41,0x0000, 0xFB40,0xEE9C,0x0000, +0xFB40,0xF409,0x0000, 0xFB40,0xF559,0x0000, 0xFB40,0xF86B,0x0000, +0xFB40,0xFD10,0x0000, 0xFB41,0x985E,0x0000, 0xFB40,0xD16D,0x0000, +0xFB40,0xE22E,0x0000, 0xFB41,0x9678,0x0000, 0xFB40,0xD02B,0x0000, +0xFB40,0xDD19,0x0000, 0xFB40,0xEDEA,0x0000, 0xFB41,0x8F2A,0x0000, +0xFB40,0xDF8B,0x0000, 0xFB40,0xE144,0x0000, 0xFB40,0xE817,0x0000, +0xFB40,0xF387,0x0000, 0xFB41,0x9686,0x0000, 0xFB40,0xD229,0x0000, +0xFB40,0xD40F,0x0000, 0xFB40,0xDC65,0x0000, 0xFB40,0xE613,0x0000, +0xFB40,0xE74E,0x0000, 0xFB40,0xE8A8,0x0000, 0xFB40,0xECE5,0x0000, +0xFB40,0xF406,0x0000, 0xFB40,0xF5E2,0x0000, 0xFB40,0xFF79,0x0000, +0xFB41,0x88CF,0x0000, 0xFB41,0x88E1,0x0000, 0xFB41,0x91CC,0x0000, +0xFB41,0x96E2,0x0000, 0xFB40,0xD33F,0x0000, 0xFB40,0xEEBA,0x0000, +0xFB40,0xD41D,0x0000, 0xFB40,0xF1D0,0x0000, 0xFB40,0xF498,0x0000, +0xFB41,0x85FA,0x0000, 0xFB41,0x96A3,0x0000, 0xFB41,0x9C57,0x0000, +0xFB41,0x9E9F,0x0000, 0xFB40,0xE797,0x0000, 0xFB40,0xEDCB,0x0000, +0xFB41,0x81E8,0x0000, 0xFB40,0xFACB,0x0000, 0xFB40,0xFB20,0x0000, +0xFB40,0xFC92,0x0000, 0xFB40,0xF2C0,0x0000, 0xFB40,0xF099,0x0000, +0xFB41,0x8B58,0x0000, 0xFB40,0xCEC0,0x0000, 0xFB41,0x8336,0x0000, +0xFB40,0xD23A,0x0000 }; + +uint16 page0FAdata[]= { /* FA00 (3 weights per char) */ +0xFB40,0xD207,0x0000, 0xFB40,0xDEA6,0x0000, 0xFB40,0xE2D3,0x0000, +0xFB40,0xFCD6,0x0000, 0xFB40,0xDB85,0x0000, 0xFB40,0xED1E,0x0000, +0xFB40,0xE6B4,0x0000, 0xFB41,0x8F3B,0x0000, 0xFB41,0x884C,0x0000, +0xFB41,0x964D,0x0000, 0xFB41,0x898B,0x0000, 0xFB40,0xDED3,0x0000, +0xFB40,0xD140,0x0000, 0xFB40,0xD5C0,0x0000, 0xFB41,0xFA0E,0x0000, +0xFB41,0xFA0F,0x0000, 0xFB40,0xD85A,0x0000, 0xFB41,0xFA11,0x0000, +0xFB40,0xE674,0x0000, 0xFB41,0xFA13,0x0000, 0xFB41,0xFA14,0x0000, +0xFB40,0xD1DE,0x0000, 0xFB40,0xF32A,0x0000, 0xFB40,0xF6CA,0x0000, +0xFB40,0xF93C,0x0000, 0xFB40,0xF95E,0x0000, 0xFB40,0xF965,0x0000, +0xFB40,0xF98F,0x0000, 0xFB41,0x9756,0x0000, 0xFB40,0xFCBE,0x0000, +0xFB40,0xFFBD,0x0000, 0xFB41,0xFA1F,0x0000, 0xFB41,0x8612,0x0000, +0xFB41,0xFA21,0x0000, 0xFB41,0x8AF8,0x0000, 0xFB41,0xFA23,0x0000, +0xFB41,0xFA24,0x0000, 0xFB41,0x9038,0x0000, 0xFB41,0x90FD,0x0000, +0xFB41,0xFA27,0x0000, 0xFB41,0xFA28,0x0000, 0xFB41,0xFA29,0x0000, +0xFB41,0x98EF,0x0000, 0xFB41,0x98FC,0x0000, 0xFB41,0x9928,0x0000, +0xFB41,0x9DB4,0x0000, 0xFBC1,0xFA2E,0x0000, 0xFBC1,0xFA2F,0x0000, +0xFB40,0xCFAE,0x0000, 0xFB40,0xD0E7,0x0000, 0xFB40,0xD14D,0x0000, +0xFB40,0xD2C9,0x0000, 0xFB40,0xD2E4,0x0000, 0xFB40,0xD351,0x0000, +0xFB40,0xD59D,0x0000, 0xFB40,0xD606,0x0000, 0xFB40,0xD668,0x0000, +0xFB40,0xD840,0x0000, 0xFB40,0xD8A8,0x0000, 0xFB40,0xDC64,0x0000, +0xFB40,0xDC6E,0x0000, 0xFB40,0xE094,0x0000, 0xFB40,0xE168,0x0000, +0xFB40,0xE18E,0x0000, 0xFB40,0xE1F2,0x0000, 0xFB40,0xE54F,0x0000, +0xFB40,0xE5E2,0x0000, 0xFB40,0xE691,0x0000, 0xFB40,0xE885,0x0000, +0xFB40,0xED77,0x0000, 0xFB40,0xEE1A,0x0000, 0xFB40,0xEF22,0x0000, +0xFB40,0xF16E,0x0000, 0xFB40,0xF22B,0x0000, 0xFB40,0xF422,0x0000, +0xFB40,0xF891,0x0000, 0xFB40,0xF93E,0x0000, 0xFB40,0xF949,0x0000, +0xFB40,0xF948,0x0000, 0xFB40,0xF950,0x0000, 0xFB40,0xF956,0x0000, +0xFB40,0xF95D,0x0000, 0xFB40,0xF98D,0x0000, 0xFB40,0xF98E,0x0000, +0xFB40,0xFA40,0x0000, 0xFB40,0xFA81,0x0000, 0xFB40,0xFBC0,0x0000, +0xFB40,0xFDF4,0x0000, 0xFB40,0xFE09,0x0000, 0xFB40,0xFE41,0x0000, +0xFB40,0xFF72,0x0000, 0xFB41,0x8005,0x0000, 0xFB41,0x81ED,0x0000, +0xFB41,0x8279,0x0000, 0xFB41,0x8279,0x0000, 0xFB41,0x8457,0x0000, +0xFB41,0x8910,0x0000, 0xFB41,0x8996,0x0000, 0xFB41,0x8B01,0x0000, +0xFB41,0x8B39,0x0000, 0xFB41,0x8CD3,0x0000, 0xFB41,0x8D08,0x0000, +0xFB41,0x8FB6,0x0000, 0xFB41,0x9038,0x0000, 0xFB41,0x96E3,0x0000, +0xFB41,0x97FF,0x0000, 0xFB41,0x983B,0x0000, 0xFBC1,0xFA6B,0x0000, +0xFBC1,0xFA6C,0x0000, 0xFBC1,0xFA6D,0x0000, 0xFBC1,0xFA6E,0x0000, +0xFBC1,0xFA6F,0x0000, 0xFBC1,0xFA70,0x0000, 0xFBC1,0xFA71,0x0000, +0xFBC1,0xFA72,0x0000, 0xFBC1,0xFA73,0x0000, 0xFBC1,0xFA74,0x0000, +0xFBC1,0xFA75,0x0000, 0xFBC1,0xFA76,0x0000, 0xFBC1,0xFA77,0x0000, +0xFBC1,0xFA78,0x0000, 0xFBC1,0xFA79,0x0000, 0xFBC1,0xFA7A,0x0000, +0xFBC1,0xFA7B,0x0000, 0xFBC1,0xFA7C,0x0000, 0xFBC1,0xFA7D,0x0000, +0xFBC1,0xFA7E,0x0000, 0xFBC1,0xFA7F,0x0000, 0xFBC1,0xFA80,0x0000, +0xFBC1,0xFA81,0x0000, 0xFBC1,0xFA82,0x0000, 0xFBC1,0xFA83,0x0000, +0xFBC1,0xFA84,0x0000, 0xFBC1,0xFA85,0x0000, 0xFBC1,0xFA86,0x0000, +0xFBC1,0xFA87,0x0000, 0xFBC1,0xFA88,0x0000, 0xFBC1,0xFA89,0x0000, +0xFBC1,0xFA8A,0x0000, 0xFBC1,0xFA8B,0x0000, 0xFBC1,0xFA8C,0x0000, +0xFBC1,0xFA8D,0x0000, 0xFBC1,0xFA8E,0x0000, 0xFBC1,0xFA8F,0x0000, +0xFBC1,0xFA90,0x0000, 0xFBC1,0xFA91,0x0000, 0xFBC1,0xFA92,0x0000, +0xFBC1,0xFA93,0x0000, 0xFBC1,0xFA94,0x0000, 0xFBC1,0xFA95,0x0000, +0xFBC1,0xFA96,0x0000, 0xFBC1,0xFA97,0x0000, 0xFBC1,0xFA98,0x0000, +0xFBC1,0xFA99,0x0000, 0xFBC1,0xFA9A,0x0000, 0xFBC1,0xFA9B,0x0000, +0xFBC1,0xFA9C,0x0000, 0xFBC1,0xFA9D,0x0000, 0xFBC1,0xFA9E,0x0000, +0xFBC1,0xFA9F,0x0000, 0xFBC1,0xFAA0,0x0000, 0xFBC1,0xFAA1,0x0000, +0xFBC1,0xFAA2,0x0000, 0xFBC1,0xFAA3,0x0000, 0xFBC1,0xFAA4,0x0000, +0xFBC1,0xFAA5,0x0000, 0xFBC1,0xFAA6,0x0000, 0xFBC1,0xFAA7,0x0000, +0xFBC1,0xFAA8,0x0000, 0xFBC1,0xFAA9,0x0000, 0xFBC1,0xFAAA,0x0000, +0xFBC1,0xFAAB,0x0000, 0xFBC1,0xFAAC,0x0000, 0xFBC1,0xFAAD,0x0000, +0xFBC1,0xFAAE,0x0000, 0xFBC1,0xFAAF,0x0000, 0xFBC1,0xFAB0,0x0000, +0xFBC1,0xFAB1,0x0000, 0xFBC1,0xFAB2,0x0000, 0xFBC1,0xFAB3,0x0000, +0xFBC1,0xFAB4,0x0000, 0xFBC1,0xFAB5,0x0000, 0xFBC1,0xFAB6,0x0000, +0xFBC1,0xFAB7,0x0000, 0xFBC1,0xFAB8,0x0000, 0xFBC1,0xFAB9,0x0000, +0xFBC1,0xFABA,0x0000, 0xFBC1,0xFABB,0x0000, 0xFBC1,0xFABC,0x0000, +0xFBC1,0xFABD,0x0000, 0xFBC1,0xFABE,0x0000, 0xFBC1,0xFABF,0x0000, +0xFBC1,0xFAC0,0x0000, 0xFBC1,0xFAC1,0x0000, 0xFBC1,0xFAC2,0x0000, +0xFBC1,0xFAC3,0x0000, 0xFBC1,0xFAC4,0x0000, 0xFBC1,0xFAC5,0x0000, +0xFBC1,0xFAC6,0x0000, 0xFBC1,0xFAC7,0x0000, 0xFBC1,0xFAC8,0x0000, +0xFBC1,0xFAC9,0x0000, 0xFBC1,0xFACA,0x0000, 0xFBC1,0xFACB,0x0000, +0xFBC1,0xFACC,0x0000, 0xFBC1,0xFACD,0x0000, 0xFBC1,0xFACE,0x0000, +0xFBC1,0xFACF,0x0000, 0xFBC1,0xFAD0,0x0000, 0xFBC1,0xFAD1,0x0000, +0xFBC1,0xFAD2,0x0000, 0xFBC1,0xFAD3,0x0000, 0xFBC1,0xFAD4,0x0000, +0xFBC1,0xFAD5,0x0000, 0xFBC1,0xFAD6,0x0000, 0xFBC1,0xFAD7,0x0000, +0xFBC1,0xFAD8,0x0000, 0xFBC1,0xFAD9,0x0000, 0xFBC1,0xFADA,0x0000, +0xFBC1,0xFADB,0x0000, 0xFBC1,0xFADC,0x0000, 0xFBC1,0xFADD,0x0000, +0xFBC1,0xFADE,0x0000, 0xFBC1,0xFADF,0x0000, 0xFBC1,0xFAE0,0x0000, +0xFBC1,0xFAE1,0x0000, 0xFBC1,0xFAE2,0x0000, 0xFBC1,0xFAE3,0x0000, +0xFBC1,0xFAE4,0x0000, 0xFBC1,0xFAE5,0x0000, 0xFBC1,0xFAE6,0x0000, +0xFBC1,0xFAE7,0x0000, 0xFBC1,0xFAE8,0x0000, 0xFBC1,0xFAE9,0x0000, +0xFBC1,0xFAEA,0x0000, 0xFBC1,0xFAEB,0x0000, 0xFBC1,0xFAEC,0x0000, +0xFBC1,0xFAED,0x0000, 0xFBC1,0xFAEE,0x0000, 0xFBC1,0xFAEF,0x0000, +0xFBC1,0xFAF0,0x0000, 0xFBC1,0xFAF1,0x0000, 0xFBC1,0xFAF2,0x0000, +0xFBC1,0xFAF3,0x0000, 0xFBC1,0xFAF4,0x0000, 0xFBC1,0xFAF5,0x0000, +0xFBC1,0xFAF6,0x0000, 0xFBC1,0xFAF7,0x0000, 0xFBC1,0xFAF8,0x0000, +0xFBC1,0xFAF9,0x0000, 0xFBC1,0xFAFA,0x0000, 0xFBC1,0xFAFB,0x0000, +0xFBC1,0xFAFC,0x0000, 0xFBC1,0xFAFD,0x0000, 0xFBC1,0xFAFE,0x0000, +0xFBC1,0xFAFF,0x0000 }; + +uint16 page0FBdata[]= { /* FB00 (4 weights per char) */ +0x0EB9,0x0EB9,0x0000,0x0000, 0x0EB9,0x0EFB,0x0000,0x0000, +0x0EB9,0x0F2E,0x0000,0x0000, 0x0EB9,0x0EB9,0x0EFB,0x0000, +0x0EB9,0x0EB9,0x0F2E,0x0000, 0x0FEA,0x1002,0x0000,0x0000, +0x0FEA,0x1002,0x0000,0x0000, 0xFBC1,0xFB07,0x0000,0x0000, +0xFBC1,0xFB08,0x0000,0x0000, 0xFBC1,0xFB09,0x0000,0x0000, +0xFBC1,0xFB0A,0x0000,0x0000, 0xFBC1,0xFB0B,0x0000,0x0000, +0xFBC1,0xFB0C,0x0000,0x0000, 0xFBC1,0xFB0D,0x0000,0x0000, +0xFBC1,0xFB0E,0x0000,0x0000, 0xFBC1,0xFB0F,0x0000,0x0000, +0xFBC1,0xFB10,0x0000,0x0000, 0xFBC1,0xFB11,0x0000,0x0000, +0xFBC1,0xFB12,0x0000,0x0000, 0x131D,0x131F,0x0000,0x0000, +0x131D,0x130E,0x0000,0x0000, 0x131D,0x1314,0x0000,0x0000, +0x1327,0x131F,0x0000,0x0000, 0x131D,0x1316,0x0000,0x0000, +0xFBC1,0xFB18,0x0000,0x0000, 0xFBC1,0xFB19,0x0000,0x0000, +0xFBC1,0xFB1A,0x0000,0x0000, 0xFBC1,0xFB1B,0x0000,0x0000, +0xFBC1,0xFB1C,0x0000,0x0000, 0x133A,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000, 0x133A,0x133A,0x0000,0x0000, +0x1340,0x0000,0x0000,0x0000, 0x1331,0x0000,0x0000,0x0000, +0x1334,0x0000,0x0000,0x0000, 0x1335,0x0000,0x0000,0x0000, +0x133B,0x0000,0x0000,0x0000, 0x133C,0x0000,0x0000,0x0000, +0x133D,0x0000,0x0000,0x0000, 0x1344,0x0000,0x0000,0x0000, +0x1346,0x0000,0x0000,0x0000, 0x0428,0x0000,0x0000,0x0000, +0x1345,0x0000,0x0000,0x0000, 0x1345,0x0000,0x0000,0x0000, +0x1345,0x0000,0x0000,0x0000, 0x1345,0x0000,0x0000,0x0000, +0x1331,0x0000,0x0000,0x0000, 0x1331,0x0000,0x0000,0x0000, +0x1331,0x0000,0x0000,0x0000, 0x1332,0x0000,0x0000,0x0000, +0x1333,0x0000,0x0000,0x0000, 0x1334,0x0000,0x0000,0x0000, +0x1335,0x0000,0x0000,0x0000, 0x1336,0x0000,0x0000,0x0000, +0x1337,0x0000,0x0000,0x0000, 0xFBC1,0xFB37,0x0000,0x0000, +0x1339,0x0000,0x0000,0x0000, 0x133A,0x0000,0x0000,0x0000, +0x133B,0x0000,0x0000,0x0000, 0x133B,0x0000,0x0000,0x0000, +0x133C,0x0000,0x0000,0x0000, 0xFBC1,0xFB3D,0x0000,0x0000, +0x133D,0x0000,0x0000,0x0000, 0xFBC1,0xFB3F,0x0000,0x0000, +0x133E,0x0000,0x0000,0x0000, 0x133F,0x0000,0x0000,0x0000, +0xFBC1,0xFB42,0x0000,0x0000, 0x1341,0x0000,0x0000,0x0000, +0x1341,0x0000,0x0000,0x0000, 0xFBC1,0xFB45,0x0000,0x0000, +0x1342,0x0000,0x0000,0x0000, 0x1343,0x0000,0x0000,0x0000, +0x1344,0x0000,0x0000,0x0000, 0x1345,0x0000,0x0000,0x0000, +0x1346,0x0000,0x0000,0x0000, 0x1336,0x0000,0x0000,0x0000, +0x1332,0x0000,0x0000,0x0000, 0x133B,0x0000,0x0000,0x0000, +0x1341,0x0000,0x0000,0x0000, 0x1331,0x133C,0x0000,0x0000, +0x134B,0x0000,0x0000,0x0000, 0x134B,0x0000,0x0000,0x0000, +0x1353,0x0000,0x0000,0x0000, 0x1353,0x0000,0x0000,0x0000, +0x1353,0x0000,0x0000,0x0000, 0x1353,0x0000,0x0000,0x0000, +0x1354,0x0000,0x0000,0x0000, 0x1354,0x0000,0x0000,0x0000, +0x1354,0x0000,0x0000,0x0000, 0x1354,0x0000,0x0000,0x0000, +0x1355,0x0000,0x0000,0x0000, 0x1355,0x0000,0x0000,0x0000, +0x1355,0x0000,0x0000,0x0000, 0x1355,0x0000,0x0000,0x0000, +0x135A,0x0000,0x0000,0x0000, 0x135A,0x0000,0x0000,0x0000, +0x135A,0x0000,0x0000,0x0000, 0x135A,0x0000,0x0000,0x0000, +0x135D,0x0000,0x0000,0x0000, 0x135D,0x0000,0x0000,0x0000, +0x135D,0x0000,0x0000,0x0000, 0x135D,0x0000,0x0000,0x0000, +0x1359,0x0000,0x0000,0x0000, 0x1359,0x0000,0x0000,0x0000, +0x1359,0x0000,0x0000,0x0000, 0x1359,0x0000,0x0000,0x0000, +0x1397,0x0000,0x0000,0x0000, 0x1397,0x0000,0x0000,0x0000, +0x1397,0x0000,0x0000,0x0000, 0x1397,0x0000,0x0000,0x0000, +0x1399,0x0000,0x0000,0x0000, 0x1399,0x0000,0x0000,0x0000, +0x1399,0x0000,0x0000,0x0000, 0x1399,0x0000,0x0000,0x0000, +0x1360,0x0000,0x0000,0x0000, 0x1360,0x0000,0x0000,0x0000, +0x1360,0x0000,0x0000,0x0000, 0x1360,0x0000,0x0000,0x0000, +0x135F,0x0000,0x0000,0x0000, 0x135F,0x0000,0x0000,0x0000, +0x135F,0x0000,0x0000,0x0000, 0x135F,0x0000,0x0000,0x0000, +0x1361,0x0000,0x0000,0x0000, 0x1361,0x0000,0x0000,0x0000, +0x1361,0x0000,0x0000,0x0000, 0x1361,0x0000,0x0000,0x0000, +0x1363,0x0000,0x0000,0x0000, 0x1363,0x0000,0x0000,0x0000, +0x1363,0x0000,0x0000,0x0000, 0x1363,0x0000,0x0000,0x0000, +0x1370,0x0000,0x0000,0x0000, 0x1370,0x0000,0x0000,0x0000, +0x136F,0x0000,0x0000,0x0000, 0x136F,0x0000,0x0000,0x0000, +0x1371,0x0000,0x0000,0x0000, 0x1371,0x0000,0x0000,0x0000, +0x136B,0x0000,0x0000,0x0000, 0x136B,0x0000,0x0000,0x0000, +0x137E,0x0000,0x0000,0x0000, 0x137E,0x0000,0x0000,0x0000, +0x1377,0x0000,0x0000,0x0000, 0x1377,0x0000,0x0000,0x0000, +0x139F,0x0000,0x0000,0x0000, 0x139F,0x0000,0x0000,0x0000, +0x139F,0x0000,0x0000,0x0000, 0x139F,0x0000,0x0000,0x0000, +0x13A5,0x0000,0x0000,0x0000, 0x13A5,0x0000,0x0000,0x0000, +0x13A5,0x0000,0x0000,0x0000, 0x13A5,0x0000,0x0000,0x0000, +0x13A9,0x0000,0x0000,0x0000, 0x13A9,0x0000,0x0000,0x0000, +0x13A9,0x0000,0x0000,0x0000, 0x13A9,0x0000,0x0000,0x0000, +0x13A7,0x0000,0x0000,0x0000, 0x13A7,0x0000,0x0000,0x0000, +0x13A7,0x0000,0x0000,0x0000, 0x13A7,0x0000,0x0000,0x0000, +0x13B2,0x0000,0x0000,0x0000, 0x13B2,0x0000,0x0000,0x0000, +0x13B3,0x0000,0x0000,0x0000, 0x13B3,0x0000,0x0000,0x0000, +0x13B3,0x0000,0x0000,0x0000, 0x13B3,0x0000,0x0000,0x0000, +0x13BC,0x0000,0x0000,0x0000, 0x13BC,0x0000,0x0000,0x0000, +0x13B9,0x0000,0x0000,0x0000, 0x13B9,0x0000,0x0000,0x0000, +0x13B9,0x0000,0x0000,0x0000, 0x13B9,0x0000,0x0000,0x0000, +0x13B8,0x0000,0x0000,0x0000, 0x13B8,0x0000,0x0000,0x0000, +0x13B8,0x0000,0x0000,0x0000, 0x13B8,0x0000,0x0000,0x0000, +0x13CE,0x0000,0x0000,0x0000, 0x13CE,0x0000,0x0000,0x0000, +0x13CE,0x0000,0x0000,0x0000, 0x13CE,0x0000,0x0000,0x0000, +0xFBC1,0xFBB2,0x0000,0x0000, 0xFBC1,0xFBB3,0x0000,0x0000, +0xFBC1,0xFBB4,0x0000,0x0000, 0xFBC1,0xFBB5,0x0000,0x0000, +0xFBC1,0xFBB6,0x0000,0x0000, 0xFBC1,0xFBB7,0x0000,0x0000, +0xFBC1,0xFBB8,0x0000,0x0000, 0xFBC1,0xFBB9,0x0000,0x0000, +0xFBC1,0xFBBA,0x0000,0x0000, 0xFBC1,0xFBBB,0x0000,0x0000, +0xFBC1,0xFBBC,0x0000,0x0000, 0xFBC1,0xFBBD,0x0000,0x0000, +0xFBC1,0xFBBE,0x0000,0x0000, 0xFBC1,0xFBBF,0x0000,0x0000, +0xFBC1,0xFBC0,0x0000,0x0000, 0xFBC1,0xFBC1,0x0000,0x0000, +0xFBC1,0xFBC2,0x0000,0x0000, 0xFBC1,0xFBC3,0x0000,0x0000, +0xFBC1,0xFBC4,0x0000,0x0000, 0xFBC1,0xFBC5,0x0000,0x0000, +0xFBC1,0xFBC6,0x0000,0x0000, 0xFBC1,0xFBC7,0x0000,0x0000, +0xFBC1,0xFBC8,0x0000,0x0000, 0xFBC1,0xFBC9,0x0000,0x0000, +0xFBC1,0xFBCA,0x0000,0x0000, 0xFBC1,0xFBCB,0x0000,0x0000, +0xFBC1,0xFBCC,0x0000,0x0000, 0xFBC1,0xFBCD,0x0000,0x0000, +0xFBC1,0xFBCE,0x0000,0x0000, 0xFBC1,0xFBCF,0x0000,0x0000, +0xFBC1,0xFBD0,0x0000,0x0000, 0xFBC1,0xFBD1,0x0000,0x0000, +0xFBC1,0xFBD2,0x0000,0x0000, 0x13A3,0x0000,0x0000,0x0000, +0x13A3,0x0000,0x0000,0x0000, 0x13A3,0x0000,0x0000,0x0000, +0x13A3,0x0000,0x0000,0x0000, 0x13C1,0x0000,0x0000,0x0000, +0x13C1,0x0000,0x0000,0x0000, 0x13C0,0x0000,0x0000,0x0000, +0x13C0,0x0000,0x0000,0x0000, 0x13C2,0x0000,0x0000,0x0000, +0x13C2,0x0000,0x0000,0x0000, 0x13C1,0x1347,0x0000,0x0000, +0x13C5,0x0000,0x0000,0x0000, 0x13C5,0x0000,0x0000,0x0000, +0x13BF,0x0000,0x0000,0x0000, 0x13BF,0x0000,0x0000,0x0000, +0x13C3,0x0000,0x0000,0x0000, 0x13C3,0x0000,0x0000,0x0000, +0x13CC,0x0000,0x0000,0x0000, 0x13CC,0x0000,0x0000,0x0000, +0x13CC,0x0000,0x0000,0x0000, 0x13CC,0x0000,0x0000,0x0000, +0x13C7,0x0000,0x0000,0x0000, 0x13C7,0x0000,0x0000,0x0000, +0x134F,0x1350,0x0000,0x0000, 0x134F,0x1350,0x0000,0x0000, +0x134F,0x13BC,0x0000,0x0000, 0x134F,0x13BC,0x0000,0x0000, +0x134F,0x13BD,0x0000,0x0000, 0x134F,0x13BD,0x0000,0x0000, +0x134F,0x13C1,0x0000,0x0000, 0x134F,0x13C1,0x0000,0x0000, +0x134F,0x13C0,0x0000,0x0000, 0x134F,0x13C0,0x0000,0x0000, +0x134F,0x13C2,0x0000,0x0000, 0x134F,0x13C2,0x0000,0x0000, +0x134F,0x13CC,0x0000,0x0000, 0x134F,0x13CC,0x0000,0x0000, +0x134F,0x13CC,0x0000,0x0000, 0x134F,0x13C7,0x0000,0x0000, +0x134F,0x13C7,0x0000,0x0000, 0x134F,0x13C7,0x0000,0x0000, +0x13C9,0x0000,0x0000,0x0000, 0x13C9,0x0000,0x0000,0x0000, +0x13C9,0x0000,0x0000,0x0000, 0x13C9,0x0000,0x0000,0x0000 +}; + +uint16 page0FCdata[]= { /* FC00 (3 weights per char) */ +0x134F,0x135E,0x0000, 0x134F,0x1364,0x0000, 0x134F,0x13B0,0x0000, +0x134F,0x13C7,0x0000, 0x134F,0x13C8,0x0000, 0x1352,0x135E,0x0000, +0x1352,0x1364,0x0000, 0x1352,0x1365,0x0000, 0x1352,0x13B0,0x0000, +0x1352,0x13C7,0x0000, 0x1352,0x13C8,0x0000, 0x1357,0x135E,0x0000, +0x1357,0x1364,0x0000, 0x1357,0x1365,0x0000, 0x1357,0x13B0,0x0000, +0x1357,0x13C7,0x0000, 0x1357,0x13C8,0x0000, 0x1358,0x135E,0x0000, +0x1358,0x13B0,0x0000, 0x1358,0x13C7,0x0000, 0x1358,0x13C8,0x0000, +0x135E,0x1364,0x0000, 0x135E,0x13B0,0x0000, 0x1364,0x135E,0x0000, +0x1364,0x13B0,0x0000, 0x1365,0x135E,0x0000, 0x1365,0x1364,0x0000, +0x1365,0x13B0,0x0000, 0x1381,0x135E,0x0000, 0x1381,0x1364,0x0000, +0x1381,0x1365,0x0000, 0x1381,0x13B0,0x0000, 0x1387,0x1364,0x0000, +0x1387,0x13B0,0x0000, 0x1388,0x135E,0x0000, 0x1388,0x1364,0x0000, +0x1388,0x1365,0x0000, 0x1388,0x13B0,0x0000, 0x138C,0x1364,0x0000, +0x138C,0x13B0,0x0000, 0x138D,0x13B0,0x0000, 0x138F,0x135E,0x0000, +0x138F,0x13B0,0x0000, 0x1390,0x135E,0x0000, 0x1390,0x13B0,0x0000, +0x1393,0x135E,0x0000, 0x1393,0x1364,0x0000, 0x1393,0x1365,0x0000, +0x1393,0x13B0,0x0000, 0x1393,0x13C7,0x0000, 0x1393,0x13C8,0x0000, +0x139B,0x1364,0x0000, 0x139B,0x13B0,0x0000, 0x139B,0x13C7,0x0000, +0x139B,0x13C8,0x0000, 0x139E,0x1350,0x0000, 0x139E,0x135E,0x0000, +0x139E,0x1364,0x0000, 0x139E,0x1365,0x0000, 0x139E,0x13AB,0x0000, +0x139E,0x13B0,0x0000, 0x139E,0x13C7,0x0000, 0x139E,0x13C8,0x0000, +0x13AB,0x135E,0x0000, 0x13AB,0x1364,0x0000, 0x13AB,0x1365,0x0000, +0x13AB,0x13B0,0x0000, 0x13AB,0x13C7,0x0000, 0x13AB,0x13C8,0x0000, +0x13B0,0x135E,0x0000, 0x13B0,0x1364,0x0000, 0x13B0,0x1365,0x0000, +0x13B0,0x13B0,0x0000, 0x13B0,0x13C7,0x0000, 0x13B0,0x13C8,0x0000, +0x13B1,0x135E,0x0000, 0x13B1,0x1364,0x0000, 0x13B1,0x1365,0x0000, +0x13B1,0x13B0,0x0000, 0x13B1,0x13C7,0x0000, 0x13B1,0x13C8,0x0000, +0x13B7,0x135E,0x0000, 0x13B7,0x13B0,0x0000, 0x13B7,0x13C7,0x0000, +0x13B7,0x13C8,0x0000, 0x13C8,0x135E,0x0000, 0x13C8,0x1364,0x0000, +0x13C8,0x1365,0x0000, 0x13C8,0x13B0,0x0000, 0x13C8,0x13C7,0x0000, +0x13C8,0x13C8,0x0000, 0x136A,0x0000,0x0000, 0x1375,0x0000,0x0000, +0x13C7,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x134F,0x1375,0x0000, 0x134F,0x1376,0x0000, +0x134F,0x13B0,0x0000, 0x134F,0x13B1,0x0000, 0x134F,0x13C7,0x0000, +0x134F,0x13C8,0x0000, 0x1352,0x1375,0x0000, 0x1352,0x1376,0x0000, +0x1352,0x13B0,0x0000, 0x1352,0x13B1,0x0000, 0x1352,0x13C7,0x0000, +0x1352,0x13C8,0x0000, 0x1357,0x1375,0x0000, 0x1357,0x1376,0x0000, +0x1357,0x13B0,0x0000, 0x1357,0x13B1,0x0000, 0x1357,0x13C7,0x0000, +0x1357,0x13C8,0x0000, 0x1358,0x1375,0x0000, 0x1358,0x1376,0x0000, +0x1358,0x13B0,0x0000, 0x1358,0x13B1,0x0000, 0x1358,0x13C7,0x0000, +0x1358,0x13C8,0x0000, 0x1393,0x13C7,0x0000, 0x1393,0x13C8,0x0000, +0x139B,0x13C7,0x0000, 0x139B,0x13C8,0x0000, 0x139E,0x1350,0x0000, +0x139E,0x13AB,0x0000, 0x139E,0x13B0,0x0000, 0x139E,0x13C7,0x0000, +0x139E,0x13C8,0x0000, 0x13AB,0x13B0,0x0000, 0x13AB,0x13C7,0x0000, +0x13AB,0x13C8,0x0000, 0x13B0,0x1350,0x0000, 0x13B0,0x13B0,0x0000, +0x13B1,0x1375,0x0000, 0x13B1,0x1376,0x0000, 0x13B1,0x13B0,0x0000, +0x13B1,0x13B1,0x0000, 0x13B1,0x13C7,0x0000, 0x13B1,0x13C8,0x0000, +0x13C7,0x0000,0x0000, 0x13C8,0x1375,0x0000, 0x13C8,0x1376,0x0000, +0x13C8,0x13B0,0x0000, 0x13C8,0x13B1,0x0000, 0x13C8,0x13C7,0x0000, +0x13C8,0x13C8,0x0000, 0x134F,0x135E,0x0000, 0x134F,0x1364,0x0000, +0x134F,0x1365,0x0000, 0x134F,0x13B0,0x0000, 0x134F,0x13B7,0x0000, +0x1352,0x135E,0x0000, 0x1352,0x1364,0x0000, 0x1352,0x1365,0x0000, +0x1352,0x13B0,0x0000, 0x1352,0x13B7,0x0000, 0x1357,0x135E,0x0000, +0x1357,0x1364,0x0000, 0x1357,0x1365,0x0000, 0x1357,0x13B0,0x0000, +0x1357,0x13B7,0x0000, 0x1358,0x13B0,0x0000, 0x135E,0x1364,0x0000, +0x135E,0x13B0,0x0000, 0x1364,0x135E,0x0000, 0x1364,0x13B0,0x0000, +0x1365,0x135E,0x0000, 0x1365,0x13B0,0x0000, 0x1381,0x135E,0x0000, +0x1381,0x1364,0x0000, 0x1381,0x1365,0x0000, 0x1381,0x13B0,0x0000, +0x1387,0x1364,0x0000, 0x1387,0x1365,0x0000, 0x1387,0x13B0,0x0000, +0x1388,0x135E,0x0000, 0x1388,0x1364,0x0000, 0x1388,0x1365,0x0000, +0x1388,0x13B0,0x0000, 0x138C,0x1364,0x0000, 0x138D,0x13B0,0x0000, +0x138F,0x135E,0x0000, 0x138F,0x13B0,0x0000, 0x1390,0x135E,0x0000, +0x1390,0x13B0,0x0000, 0x1393,0x135E,0x0000, 0x1393,0x1364,0x0000, +0x1393,0x1365,0x0000, 0x1393,0x13B0,0x0000, 0x139B,0x1364,0x0000, +0x139B,0x13B0,0x0000, 0x139E,0x135E,0x0000, 0x139E,0x1364,0x0000, +0x139E,0x1365,0x0000, 0x139E,0x13AB,0x0000, 0x139E,0x13B0,0x0000, +0x13AB,0x135E,0x0000, 0x13AB,0x1364,0x0000, 0x13AB,0x1365,0x0000, +0x13AB,0x13B0,0x0000, 0x13AB,0x13B7,0x0000, 0x13B0,0x135E,0x0000, +0x13B0,0x1364,0x0000, 0x13B0,0x1365,0x0000, 0x13B0,0x13B0,0x0000, +0x13B1,0x135E,0x0000, 0x13B1,0x1364,0x0000, 0x13B1,0x1365,0x0000, +0x13B1,0x13B0,0x0000, 0x13B1,0x13B7,0x0000, 0x13B7,0x135E,0x0000, +0x13B7,0x13B0,0x0000, 0x13B7,0x0000,0x0000, 0x13C8,0x135E,0x0000, +0x13C8,0x1364,0x0000, 0x13C8,0x1365,0x0000, 0x13C8,0x13B0,0x0000, +0x13C8,0x13B7,0x0000, 0x134F,0x13B0,0x0000, 0x134F,0x13B7,0x0000, +0x1352,0x13B0,0x0000, 0x1352,0x13B7,0x0000, 0x1357,0x13B0,0x0000, +0x1357,0x13B7,0x0000, 0x1358,0x13B0,0x0000, 0x1358,0x13B7,0x0000, +0x1381,0x13B0,0x0000, 0x1381,0x13B7,0x0000, 0x1382,0x13B0,0x0000, +0x1382,0x13B7,0x0000, 0x139E,0x13AB,0x0000, 0x139E,0x13B0,0x0000, +0x13AB,0x13B0,0x0000, 0x13B1,0x13B0,0x0000, 0x13B1,0x13B7,0x0000, +0x13C8,0x13B0,0x0000, 0x13C8,0x13B7,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x138C,0x13C7,0x0000, +0x138C,0x13C8,0x0000, 0x138F,0x13C7,0x0000, 0x138F,0x13C8,0x0000, +0x1390,0x13C7,0x0000, 0x1390,0x13C8,0x0000, 0x1381,0x13C7,0x0000, +0x1381,0x13C8,0x0000, 0x1382,0x13C7,0x0000, 0x1382,0x13C8,0x0000, +0x1364,0x13C7,0x0000 }; + +uint16 page0FDdata[]= { /* FD00 (9 weights per char) */ +0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1365,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1365,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1390,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1390,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1364,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1365,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1365,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13B7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138D,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1350,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1350,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x02C0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x02C1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD40,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD41,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD42,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD43,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD44,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD46,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD47,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD48,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD49,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD4B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD4C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD4D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD4E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD4F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x1364,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x1364,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x1364,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x13B0,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x13B0,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1364,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1364,0x13B0,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x1364,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x135E,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x135E,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13B0,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x1364,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x1364,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1364,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1364,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B0,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B0,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x1364,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138C,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x13B0,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1390,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1390,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1390,0x13B0,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1393,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1393,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139B,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139B,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x1364,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x1364,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x135E,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x135E,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x1364,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x1364,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x135E,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x1365,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x1365,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD90,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFD91,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x135E,0x1365,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B7,0x13B0,0x135E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B7,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x1364,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x1364,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x135E,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x13B0,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13C8,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13C8,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1352,0x1365,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x135E,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x1365,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x1365,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1357,0x13B0,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x1364,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13B0,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x1365,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1382,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1388,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13C8,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13C8,0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13C8,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139B,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139B,0x13B0,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x1364,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139E,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x135E,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x1365,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139E,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13AB,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x135E,0x1364,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1364,0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1393,0x13B0,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1352,0x1364,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139E,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x135E,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13B0,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1381,0x1365,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B1,0x135E,0x13C8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDC8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDC9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDCA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDCB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDCC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDCD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDCE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDCF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDD9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDDA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDDB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDDC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDDD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDDE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDDF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDE9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDEA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDEB,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDEC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDED,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDEE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDEF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13AB,0x13CE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x139B,0x13AB,0x13CE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1350,0x13AB,0x13AB,0x13B7,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1350,0x139E,0x1352,0x1375,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13B0,0x1364,0x13B0,0x1369,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13AB,0x138F,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1375,0x1381,0x13BD,0x13AB,0x0000,0x0000,0x0000,0x0000,0x0000, +0x138F,0x13AB,0x13C8,0x13B7,0x0000,0x0000,0x0000,0x0000,0x0000, +0x13BD,0x1381,0x13AB,0x13B0,0x0000,0x0000,0x0000,0x0000,0x0000, +0x1387,0x13AB,0x13C7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDFA,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x135E,0x13AB,0x0209,0x135E,0x13AB,0x1350,0x13AB,0x13B7,0x0000, +0x1375,0x13C9,0x1350,0x13AB,0x0000,0x0000,0x0000,0x0000,0x0000, +0x034F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDFE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0xFBC1,0xFDFF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + +uint16 page0FEdata[]= { /* FE00 (3 weights per char) */ +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0xFBC1,0xFE10,0x0000, 0xFBC1,0xFE11,0x0000, +0xFBC1,0xFE12,0x0000, 0xFBC1,0xFE13,0x0000, 0xFBC1,0xFE14,0x0000, +0xFBC1,0xFE15,0x0000, 0xFBC1,0xFE16,0x0000, 0xFBC1,0xFE17,0x0000, +0xFBC1,0xFE18,0x0000, 0xFBC1,0xFE19,0x0000, 0xFBC1,0xFE1A,0x0000, +0xFBC1,0xFE1B,0x0000, 0xFBC1,0xFE1C,0x0000, 0xFBC1,0xFE1D,0x0000, +0xFBC1,0xFE1E,0x0000, 0xFBC1,0xFE1F,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC1,0xFE24,0x0000, 0xFBC1,0xFE25,0x0000, 0xFBC1,0xFE26,0x0000, +0xFBC1,0xFE27,0x0000, 0xFBC1,0xFE28,0x0000, 0xFBC1,0xFE29,0x0000, +0xFBC1,0xFE2A,0x0000, 0xFBC1,0xFE2B,0x0000, 0xFBC1,0xFE2C,0x0000, +0xFBC1,0xFE2D,0x0000, 0xFBC1,0xFE2E,0x0000, 0xFBC1,0xFE2F,0x0000, +0x025D,0x025D,0x0000, 0x0228,0x0000,0x0000, 0x0227,0x0000,0x0000, +0x021B,0x0000,0x0000, 0x021B,0x0000,0x0000, 0x0288,0x0000,0x0000, +0x0289,0x0000,0x0000, 0x028C,0x0000,0x0000, 0x028D,0x0000,0x0000, +0x02B8,0x0000,0x0000, 0x02B9,0x0000,0x0000, 0x02B6,0x0000,0x0000, +0x02B7,0x0000,0x0000, 0x02B0,0x0000,0x0000, 0x02B1,0x0000,0x0000, +0x02AE,0x0000,0x0000, 0x02AF,0x0000,0x0000, 0x02B2,0x0000,0x0000, +0x02B3,0x0000,0x0000, 0x02B4,0x0000,0x0000, 0x02B5,0x0000,0x0000, +0x0238,0x0000,0x0000, 0x0239,0x0000,0x0000, 0x028A,0x0000,0x0000, +0x028B,0x0000,0x0000, 0x0211,0x0000,0x0000, 0x0211,0x0000,0x0000, +0x0211,0x0000,0x0000, 0x0211,0x0000,0x0000, 0x021B,0x0000,0x0000, +0x021B,0x0000,0x0000, 0x021B,0x0000,0x0000, 0x022F,0x0000,0x0000, +0x0237,0x0000,0x0000, 0x025D,0x0000,0x0000, 0xFBC1,0xFE53,0x0000, +0x023A,0x0000,0x0000, 0x023D,0x0000,0x0000, 0x0255,0x0000,0x0000, +0x0251,0x0000,0x0000, 0x0228,0x0000,0x0000, 0x0288,0x0000,0x0000, +0x0289,0x0000,0x0000, 0x028C,0x0000,0x0000, 0x028D,0x0000,0x0000, +0x02B8,0x0000,0x0000, 0x02B9,0x0000,0x0000, 0x02D2,0x0000,0x0000, +0x02CF,0x0000,0x0000, 0x02C8,0x0000,0x0000, 0x0428,0x0000,0x0000, +0x0221,0x0000,0x0000, 0x042C,0x0000,0x0000, 0x042E,0x0000,0x0000, +0x042D,0x0000,0x0000, 0xFBC1,0xFE67,0x0000, 0x02CE,0x0000,0x0000, +0x0E0F,0x0000,0x0000, 0x02D3,0x0000,0x0000, 0x02C7,0x0000,0x0000, +0xFBC1,0xFE6C,0x0000, 0xFBC1,0xFE6D,0x0000, 0xFBC1,0xFE6E,0x0000, +0xFBC1,0xFE6F,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0xFBC1,0xFE75,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x1347,0x0000,0x0000, +0x1348,0x0000,0x0000, 0x1348,0x0000,0x0000, 0x1349,0x0000,0x0000, +0x1349,0x0000,0x0000, 0x134C,0x0000,0x0000, 0x134C,0x0000,0x0000, +0x134D,0x0000,0x0000, 0x134D,0x0000,0x0000, 0x134F,0x0000,0x0000, +0x134F,0x0000,0x0000, 0x134F,0x0000,0x0000, 0x134F,0x0000,0x0000, +0x1350,0x0000,0x0000, 0x1350,0x0000,0x0000, 0x1352,0x0000,0x0000, +0x1352,0x0000,0x0000, 0x1352,0x0000,0x0000, 0x1352,0x0000,0x0000, +0x1356,0x0000,0x0000, 0x1356,0x0000,0x0000, 0x1357,0x0000,0x0000, +0x1357,0x0000,0x0000, 0x1357,0x0000,0x0000, 0x1357,0x0000,0x0000, +0x1358,0x0000,0x0000, 0x1358,0x0000,0x0000, 0x1358,0x0000,0x0000, +0x1358,0x0000,0x0000, 0x135E,0x0000,0x0000, 0x135E,0x0000,0x0000, +0x135E,0x0000,0x0000, 0x135E,0x0000,0x0000, 0x1364,0x0000,0x0000, +0x1364,0x0000,0x0000, 0x1364,0x0000,0x0000, 0x1364,0x0000,0x0000, +0x1365,0x0000,0x0000, 0x1365,0x0000,0x0000, 0x1365,0x0000,0x0000, +0x1365,0x0000,0x0000, 0x1369,0x0000,0x0000, 0x1369,0x0000,0x0000, +0x136A,0x0000,0x0000, 0x136A,0x0000,0x0000, 0x1375,0x0000,0x0000, +0x1375,0x0000,0x0000, 0x1376,0x0000,0x0000, 0x1376,0x0000,0x0000, +0x1381,0x0000,0x0000, 0x1381,0x0000,0x0000, 0x1381,0x0000,0x0000, +0x1381,0x0000,0x0000, 0x1382,0x0000,0x0000, 0x1382,0x0000,0x0000, +0x1382,0x0000,0x0000, 0x1382,0x0000,0x0000, 0x1387,0x0000,0x0000, +0x1387,0x0000,0x0000, 0x1387,0x0000,0x0000, 0x1387,0x0000,0x0000, +0x1388,0x0000,0x0000, 0x1388,0x0000,0x0000, 0x1388,0x0000,0x0000, +0x1388,0x0000,0x0000, 0x138C,0x0000,0x0000, 0x138C,0x0000,0x0000, +0x138C,0x0000,0x0000, 0x138C,0x0000,0x0000, 0x138D,0x0000,0x0000, +0x138D,0x0000,0x0000, 0x138D,0x0000,0x0000, 0x138D,0x0000,0x0000, +0x138F,0x0000,0x0000, 0x138F,0x0000,0x0000, 0x138F,0x0000,0x0000, +0x138F,0x0000,0x0000, 0x1390,0x0000,0x0000, 0x1390,0x0000,0x0000, +0x1390,0x0000,0x0000, 0x1390,0x0000,0x0000, 0x1393,0x0000,0x0000, +0x1393,0x0000,0x0000, 0x1393,0x0000,0x0000, 0x1393,0x0000,0x0000, +0x139B,0x0000,0x0000, 0x139B,0x0000,0x0000, 0x139B,0x0000,0x0000, +0x139B,0x0000,0x0000, 0x139E,0x0000,0x0000, 0x139E,0x0000,0x0000, +0x139E,0x0000,0x0000, 0x139E,0x0000,0x0000, 0x13AB,0x0000,0x0000, +0x13AB,0x0000,0x0000, 0x13AB,0x0000,0x0000, 0x13AB,0x0000,0x0000, +0x13B0,0x0000,0x0000, 0x13B0,0x0000,0x0000, 0x13B0,0x0000,0x0000, +0x13B0,0x0000,0x0000, 0x13B1,0x0000,0x0000, 0x13B1,0x0000,0x0000, +0x13B1,0x0000,0x0000, 0x13B1,0x0000,0x0000, 0x13B7,0x0000,0x0000, +0x13B7,0x0000,0x0000, 0x13B7,0x0000,0x0000, 0x13B7,0x0000,0x0000, +0x13BD,0x0000,0x0000, 0x13BD,0x0000,0x0000, 0x13C7,0x0000,0x0000, +0x13C7,0x0000,0x0000, 0x13C8,0x0000,0x0000, 0x13C8,0x0000,0x0000, +0x13C8,0x0000,0x0000, 0x13C8,0x0000,0x0000, 0x13AB,0x1348,0x0000, +0x13AB,0x1348,0x0000, 0x13AB,0x1349,0x0000, 0x13AB,0x1349,0x0000, +0x13AB,0x134D,0x0000, 0x13AB,0x134D,0x0000, 0x13AB,0x1350,0x0000, +0x13AB,0x1350,0x0000, 0xFBC1,0xFEFD,0x0000, 0xFBC1,0xFEFE,0x0000, +0x0000,0x0000,0x0000 }; + +uint16 page0FFdata[]= { /* FF00 (3 weights per char) */ +0xFBC1,0xFF00,0x0000, 0x0251,0x0000,0x0000, 0x027E,0x0000,0x0000, +0x02D2,0x0000,0x0000, 0x0E0F,0x0000,0x0000, 0x02D3,0x0000,0x0000, +0x02CF,0x0000,0x0000, 0x0277,0x0000,0x0000, 0x0288,0x0000,0x0000, +0x0289,0x0000,0x0000, 0x02C8,0x0000,0x0000, 0x0428,0x0000,0x0000, +0x022F,0x0000,0x0000, 0x0221,0x0000,0x0000, 0x025D,0x0000,0x0000, +0x02CC,0x0000,0x0000, 0x0E29,0x0000,0x0000, 0x0E2A,0x0000,0x0000, +0x0E2B,0x0000,0x0000, 0x0E2C,0x0000,0x0000, 0x0E2D,0x0000,0x0000, +0x0E2E,0x0000,0x0000, 0x0E2F,0x0000,0x0000, 0x0E30,0x0000,0x0000, +0x0E31,0x0000,0x0000, 0x0E32,0x0000,0x0000, 0x023D,0x0000,0x0000, +0x023A,0x0000,0x0000, 0x042C,0x0000,0x0000, 0x042D,0x0000,0x0000, +0x042E,0x0000,0x0000, 0x0255,0x0000,0x0000, 0x02C7,0x0000,0x0000, +0x0E33,0x0000,0x0000, 0x0E4A,0x0000,0x0000, 0x0E60,0x0000,0x0000, +0x0E6D,0x0000,0x0000, 0x0E8B,0x0000,0x0000, 0x0EB9,0x0000,0x0000, +0x0EC1,0x0000,0x0000, 0x0EE1,0x0000,0x0000, 0x0EFB,0x0000,0x0000, +0x0F10,0x0000,0x0000, 0x0F21,0x0000,0x0000, 0x0F2E,0x0000,0x0000, +0x0F5B,0x0000,0x0000, 0x0F64,0x0000,0x0000, 0x0F82,0x0000,0x0000, +0x0FA7,0x0000,0x0000, 0x0FB4,0x0000,0x0000, 0x0FC0,0x0000,0x0000, +0x0FEA,0x0000,0x0000, 0x1002,0x0000,0x0000, 0x101F,0x0000,0x0000, +0x1044,0x0000,0x0000, 0x1051,0x0000,0x0000, 0x105A,0x0000,0x0000, +0x105E,0x0000,0x0000, 0x106A,0x0000,0x0000, 0x028A,0x0000,0x0000, +0x02CE,0x0000,0x0000, 0x028B,0x0000,0x0000, 0x020F,0x0000,0x0000, +0x021B,0x0000,0x0000, 0x020C,0x0000,0x0000, 0x0E33,0x0000,0x0000, +0x0E4A,0x0000,0x0000, 0x0E60,0x0000,0x0000, 0x0E6D,0x0000,0x0000, +0x0E8B,0x0000,0x0000, 0x0EB9,0x0000,0x0000, 0x0EC1,0x0000,0x0000, +0x0EE1,0x0000,0x0000, 0x0EFB,0x0000,0x0000, 0x0F10,0x0000,0x0000, +0x0F21,0x0000,0x0000, 0x0F2E,0x0000,0x0000, 0x0F5B,0x0000,0x0000, +0x0F64,0x0000,0x0000, 0x0F82,0x0000,0x0000, 0x0FA7,0x0000,0x0000, +0x0FB4,0x0000,0x0000, 0x0FC0,0x0000,0x0000, 0x0FEA,0x0000,0x0000, +0x1002,0x0000,0x0000, 0x101F,0x0000,0x0000, 0x1044,0x0000,0x0000, +0x1051,0x0000,0x0000, 0x105A,0x0000,0x0000, 0x105E,0x0000,0x0000, +0x106A,0x0000,0x0000, 0x028C,0x0000,0x0000, 0x0430,0x0000,0x0000, +0x028D,0x0000,0x0000, 0x0433,0x0000,0x0000, 0x029A,0x0000,0x0000, +0x029B,0x0000,0x0000, 0x0266,0x0000,0x0000, 0x02B2,0x0000,0x0000, +0x02B3,0x0000,0x0000, 0x0237,0x0000,0x0000, 0x022E,0x0000,0x0000, +0x1E80,0x0000,0x0000, 0x1E52,0x0000,0x0000, 0x1E53,0x0000,0x0000, +0x1E54,0x0000,0x0000, 0x1E55,0x0000,0x0000, 0x1E56,0x0000,0x0000, +0x1E75,0x0000,0x0000, 0x1E76,0x0000,0x0000, 0x1E77,0x0000,0x0000, +0x1E63,0x0000,0x0000, 0x0E0B,0x0000,0x0000, 0x1E52,0x0000,0x0000, +0x1E53,0x0000,0x0000, 0x1E54,0x0000,0x0000, 0x1E55,0x0000,0x0000, +0x1E56,0x0000,0x0000, 0x1E57,0x0000,0x0000, 0x1E58,0x0000,0x0000, +0x1E59,0x0000,0x0000, 0x1E5A,0x0000,0x0000, 0x1E5B,0x0000,0x0000, +0x1E5C,0x0000,0x0000, 0x1E5D,0x0000,0x0000, 0x1E5E,0x0000,0x0000, +0x1E5F,0x0000,0x0000, 0x1E60,0x0000,0x0000, 0x1E61,0x0000,0x0000, +0x1E62,0x0000,0x0000, 0x1E63,0x0000,0x0000, 0x1E64,0x0000,0x0000, +0x1E65,0x0000,0x0000, 0x1E66,0x0000,0x0000, 0x1E67,0x0000,0x0000, +0x1E68,0x0000,0x0000, 0x1E69,0x0000,0x0000, 0x1E6A,0x0000,0x0000, +0x1E6B,0x0000,0x0000, 0x1E6C,0x0000,0x0000, 0x1E6D,0x0000,0x0000, +0x1E6E,0x0000,0x0000, 0x1E6F,0x0000,0x0000, 0x1E70,0x0000,0x0000, +0x1E71,0x0000,0x0000, 0x1E72,0x0000,0x0000, 0x1E73,0x0000,0x0000, +0x1E74,0x0000,0x0000, 0x1E75,0x0000,0x0000, 0x1E76,0x0000,0x0000, +0x1E77,0x0000,0x0000, 0x1E78,0x0000,0x0000, 0x1E79,0x0000,0x0000, +0x1E7A,0x0000,0x0000, 0x1E7B,0x0000,0x0000, 0x1E7C,0x0000,0x0000, +0x1E7D,0x0000,0x0000, 0x1E81,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000, 0x1DBD,0x0000,0x0000, 0x1D62,0x0000,0x0000, +0x1D63,0x0000,0x0000, 0x1E02,0x0000,0x0000, 0x1D64,0x0000,0x0000, +0x1E04,0x0000,0x0000, 0x1E05,0x0000,0x0000, 0x1D65,0x0000,0x0000, +0x1D66,0x0000,0x0000, 0x1D67,0x0000,0x0000, 0x1E08,0x0000,0x0000, +0x1E09,0x0000,0x0000, 0x1E0A,0x0000,0x0000, 0x1E0B,0x0000,0x0000, +0x1E0C,0x0000,0x0000, 0x1E0D,0x0000,0x0000, 0x1D7C,0x0000,0x0000, +0x1D68,0x0000,0x0000, 0x1D69,0x0000,0x0000, 0x1D6A,0x0000,0x0000, +0x1D83,0x0000,0x0000, 0x1D6B,0x0000,0x0000, 0x1D6C,0x0000,0x0000, +0x1D6D,0x0000,0x0000, 0x1D6E,0x0000,0x0000, 0x1D6F,0x0000,0x0000, +0x1D70,0x0000,0x0000, 0x1D71,0x0000,0x0000, 0x1D72,0x0000,0x0000, +0x1D73,0x0000,0x0000, 0x1D74,0x0000,0x0000, 0xFBC1,0xFFBF,0x0000, +0xFBC1,0xFFC0,0x0000, 0xFBC1,0xFFC1,0x0000, 0x1DBE,0x0000,0x0000, +0x1DBF,0x0000,0x0000, 0x1DC0,0x0000,0x0000, 0x1DC1,0x0000,0x0000, +0x1DC2,0x0000,0x0000, 0x1DC3,0x0000,0x0000, 0xFBC1,0xFFC8,0x0000, +0xFBC1,0xFFC9,0x0000, 0x1DC4,0x0000,0x0000, 0x1DC5,0x0000,0x0000, +0x1DC6,0x0000,0x0000, 0x1DC7,0x0000,0x0000, 0x1DC8,0x0000,0x0000, +0x1DC9,0x0000,0x0000, 0xFBC1,0xFFD0,0x0000, 0xFBC1,0xFFD1,0x0000, +0x1DCA,0x0000,0x0000, 0x1DCB,0x0000,0x0000, 0x1DCC,0x0000,0x0000, +0x1DCD,0x0000,0x0000, 0x1DCE,0x0000,0x0000, 0x1DCF,0x0000,0x0000, +0xFBC1,0xFFD8,0x0000, 0xFBC1,0xFFD9,0x0000, 0x1DD0,0x0000,0x0000, +0x1DD1,0x0000,0x0000, 0x1DD2,0x0000,0x0000, 0xFBC1,0xFFDD,0x0000, +0xFBC1,0xFFDE,0x0000, 0xFBC1,0xFFDF,0x0000, 0x0E0E,0x0000,0x0000, +0x0E10,0x0000,0x0000, 0x042F,0x0000,0x0000, 0x0210,0x0000,0x0000, +0x0431,0x0000,0x0000, 0x0E11,0x0000,0x0000, 0x0E20,0x0000,0x0000, +0xFBC1,0xFFE7,0x0000, 0x05FE,0x0000,0x0000, 0x03AE,0x0000,0x0000, +0x03B0,0x0000,0x0000, 0x03AF,0x0000,0x0000, 0x03B1,0x0000,0x0000, +0x069C,0x0000,0x0000, 0x06C7,0x0000,0x0000, 0xFBC1,0xFFEF,0x0000, +0xFBC1,0xFFF0,0x0000, 0xFBC1,0xFFF1,0x0000, 0xFBC1,0xFFF2,0x0000, +0xFBC1,0xFFF3,0x0000, 0xFBC1,0xFFF4,0x0000, 0xFBC1,0xFFF5,0x0000, +0xFBC1,0xFFF6,0x0000, 0xFBC1,0xFFF7,0x0000, 0xFBC1,0xFFF8,0x0000, +0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000, +0x0DC5,0x0000,0x0000, 0x0DC6,0x0000,0x0000, 0xFBC1,0xFFFE,0x0000, +0xFBC1,0xFFFF,0x0000 }; + +uchar uca_length[256]={ +4,3,3,4,3,3,3,3,0,3,3,3,3,3,3,3, +3,3,3,3,3,2,3,3,3,3,0,0,0,3,3,3, +5,5,4,3,5,2,3,3,2,2,5,3,0,0,3,3, +3,3,8,9,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,2,2,2,3,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,3,3,4,3,9,3,3 +}; +uint16 *uca_weight[256]={ +page000data,page001data,page002data,page003data, +page004data,page005data,page006data,page007data, +NULL ,page009data,page00Adata,page00Bdata, +page00Cdata,page00Ddata,page00Edata,page00Fdata, +page010data,page011data,page012data,page013data, +page014data,page015data,page016data,page017data, +page018data,page019data,NULL ,NULL , +NULL ,page01Ddata,page01Edata,page01Fdata, +page020data,page021data,page022data,page023data, +page024data,page025data,page026data,page027data, +page028data,page029data,page02Adata,page02Bdata, +NULL ,NULL ,page02Edata,page02Fdata, +page030data,page031data,page032data,page033data, +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,page04Ddata,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +page0A0data,page0A1data,page0A2data,page0A3data, +page0A4data,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,NULL ,NULL ,NULL , +NULL ,page0F9data,page0FAdata,page0FBdata, +page0FCdata,page0FDdata,page0FEdata,page0FFdata +}; + +/* + Some sources treat LETTER A WITH DIARESIS (00E4,00C4) + secondary greater than LETTER AE (00E6,00C6). + http://www.evertype.com/alphabets/icelandic.pdf + http://developer.mimer.com/collations/charts/icelandic.htm + + Other sources do not provide any special rules + for LETTER A WITH DIARESIS: + http://www.omniglot.com/writing/icelandic.htm + http://en.wikipedia.org/wiki/Icelandic_alphabet + http://oss.software.ibm.com/icu/charts/collation/is.html + + Let's go the first way. +*/ + +static const char icelandic[]= + "& A < \\u00E1 <<< \\u00C1 " + "& D < \\u00F0 <<< \\u00D0 " + "& E < \\u00E9 <<< \\u00C9 " + "& I < \\u00ED <<< \\u00CD " + "& O < \\u00F3 <<< \\u00D3 " + "& U < \\u00FA <<< \\u00DA " + "& Y < \\u00FD <<< \\u00DD " + "& Z < \\u00FE <<< \\u00DE " + "< \\u00E6 <<< \\u00C6 << \\u00E4 <<< \\u00C4 " + "< \\u00F6 <<< \\u00D6 << \\u00F8 <<< \\u00D8 " + "< \\u00E5 <<< \\u00C5 "; + +/* + Some sources treat I and Y primary different. + Other sources treat I and Y the same on primary level. + We'll go the first way. +*/ + +static const char latvian[]= + "& C < \\u010D <<< \\u010C " + "& G < \\u0123 <<< \\u0122 " + "& I < \\u0079 <<< \\u0059 " + "& K < \\u0137 <<< \\u0136 " + "& L < \\u013C <<< \\u013B " + "& N < \\u0146 <<< \\u0145 " + "& R < \\u0157 <<< \\u0156 " + "& S < \\u0161 <<< \\u0160 " + "& Z < \\u017E <<< \\u017D "; + + +static const char romanian[]= + "& A < \\u0103 <<< \\u0102 < \\u00E2 <<< \\u00C2 " + "& I < \\u00EE <<< \\u00CE " + "& S < \\u0219 <<< \\u0218 << \\u015F <<< \\u015E " + "& T < \\u021B <<< \\u021A << \\u0163 <<< \\u0162 "; + +static const char slovenian[]= + "& C < \\u010D <<< \\u010C " + "& S < \\u0161 <<< \\u0160 " + "& Z < \\u017E <<< \\u017D "; + + +static const char polish[]= + "& A < \\u0105 <<< \\u0104 " + "& C < \\u0107 <<< \\u0106 " + "& E < \\u0119 <<< \\u0118 " + "& L < \\u0142 <<< \\u0141 " + "& N < \\u0144 <<< \\u0143 " + "& O < \\u00F3 <<< \\u00D3 " + "& S < \\u015B <<< \\u015A " + "& Z < \\u017A <<< \\u0179 < \\u017C <<< \\u017B"; + +static const char estonian[]= + "& S < \\u0161 <<< \\u0160 " + " < \\u007A <<< \\u005A " + " < \\u017E <<< \\u017D " + "& W < \\u00F5 <<< \\u00D5 " + "< \\u00E4 <<< \\u00C4 " + "< \\u00F6 <<< \\u00D6 " + "< \\u00FC <<< \\u00DC "; + +static const char spanish[]= "& N < \\u00F1 <<< \\u00D1 "; + +/* + Some sources treat V and W as similar on primary level. + We'll treat V and W as different on primary level. +*/ + +static const char swedish[]= + "& Y <<\\u00FC <<< \\u00DC " + "& Z < \\u00E5 <<< \\u00C5 " + "< \\u00E4 <<< \\u00C4 << \\u00E6 <<< \\u00C6 " + "< \\u00F6 <<< \\u00D6 << \\u00F8 <<< \\u00D8 "; + +static const char turkish[]= + "& C < \\u00E7 <<< \\u00C7 " + "& G < \\u011F <<< \\u011E " + "& H < \\u0131 <<< \\u0049 " + "& O < \\u00F6 <<< \\u00D6 " + "& S < \\u015F <<< \\u015E " + "& U < \\u00FC <<< \\u00DC "; + + +static const char czech[]= + "& C < \\u010D <<< \\u010C " + "& H < ch <<< Ch <<< CH" + "& R < \\u0159 <<< \\u0158" + "& S < \\u0161 <<< \\u0160" + "& Z < \\u017E <<< \\u017D"; + +static const char danish[]= /* Also good for Norwegian */ + "& Y << \\u00FC <<< \\u00DC << \\u0171 <<< \\u0170" + "& Z < \\u00E6 <<< \\u00C6 << \\u00E4 <<< \\u00C4" + " < \\u00F8 <<< \\u00D8 << \\u00F6 <<< \\u00D6 << \\u0151 <<< \\u0150" + " < \\u00E5 <<< \\u00C5 << aa <<< Aa <<< AA"; + +static const char lithuanian[]= + "& C << ch <<< Ch <<< CH< \\u010D <<< \\u010C" + "& E << \\u0119 <<< \\u0118 << \\u0117 <<< \\u0116" + "& I << y <<< Y" + "& S < \\u0161 <<< \\u0160" + "& Z < \\u017E <<< \\u017D"; + +static const char slovak[]= + "& A < \\u00E4 <<< \\u00C4" + "& C < \\u010D <<< \\u010C" + "& H < ch <<< Ch <<< CH" + "& O < \\u00F4 <<< \\u00D4" + "& S < \\u0161 <<< \\u0160" + "& Z < \\u017E <<< \\u017D"; + +static const char spanish2[]= /* Also good for Asturian and Galician */ + "&C < ch <<< Ch <<< CH" + "&L < ll <<< Ll <<< LL" + "&N < \\u00F1 <<< \\u00D1"; + +static const char roman[]= /* i.e. Classical Latin */ + "& I << j <<< J " + "& V << u <<< U "; + +/* + Persian collation support was provided by + Jody McIntyre + + To: internals@lists.mysql.com + Subject: Persian UTF8 collation support + Date: 17.08.2004 + + Contraction is not implemented. Some implementations do perform + contraction but others do not, and it is able to sort all my test + strings correctly. + + Jody. +*/ +static const char persian[]= + "& \\u066D < \\u064E < \\uFE76 < \\uFE77 < \\u0650 < \\uFE7A < \\uFE7B" + " < \\u064F < \\uFE78 < \\uFE79 < \\u064B < \\uFE70 < \\uFE71" + " < \\u064D < \\uFE74 < \\u064C < \\uFE72" + "& \\uFE7F < \\u0653 < \\u0654 < \\u0655 < \\u0670" + "& \\u0669 < \\u0622 < \\u0627 < \\u0671 < \\u0621 < \\u0623 < \\u0625" + " < \\u0624 < \\u0626" + "& \\u0642 < \\u06A9 < \\u0643" + "& \\u0648 < \\u0647 < \\u0629 < \\u06C0 < \\u06CC < \\u0649 < \\u064A" + "& \\uFE80 < \\uFE81 < \\uFE82 < \\uFE8D < \\uFE8E < \\uFB50 < \\uFB51" + " < \\uFE80 < \\uFE83 < \\uFE84 < \\uFE87 < \\uFE88 < \\uFE85" + " < \\uFE86 < \\u0689 < \\u068A" + "& \\uFEAE < \\uFDFC" + "& \\uFED8 < \\uFB8E < \\uFB8F < \\uFB90 < \\uFB91 < \\uFED9 < \\uFEDA" + " < \\uFEDB < \\uFEDC" + "& \\uFEEE < \\uFEE9 < \\uFEEA < \\uFEEB < \\uFEEC < \\uFE93 < \\uFE94" + " < \\uFBA4 < \\uFBA5 < \\uFBFC < \\uFBFD < \\uFBFE < \\uFBFF" + " < \\uFEEF < \\uFEF0 < \\uFEF1 < \\uFEF2 < \\uFEF3 < \\uFEF4" + " < \\uFEF5 < \\uFEF6 < \\uFEF7 < \\uFEF8 < \\uFEF9 < \\uFEFA" + " < \\uFEFB < \\uFEFC"; + +/* + Esperanto tailoring. + Contributed by Bertilo Wennergren + September 1, 2005 +*/ +static const char esperanto[]= + "& C < \\u0109 <<< \\u0108" + "& G < \\u011D <<< \\u011C" + "& H < \\u0125 <<< \\u0124" + "& J < \\u0135 <<< \\u0134" + "& S < \\u015d <<< \\u015c" + "& U < \\u016d <<< \\u016c"; + +/* + A simplified version of Hungarian, without consonant contractions. +*/ +static const char hungarian[]= + "&O < \\u00F6 <<< \\u00D6 << \\u0151 <<< \\u0150" + "&U < \\u00FC <<< \\u00DC << \\u0171 <<< \\u0170"; + +/* + SCCII Part 1 : Collation Sequence (SLS1134) + 2006/11/24 + Harshula Jayasuriya + Language Technology Research Lab, University of Colombo / ICTA +*/ +#if 0 +static const char sinhala[]= + "& \\u0D96 < \\u0D82 < \\u0D83" + "& \\u0DA5 < \\u0DA4" + "& \\u0DD8 < \\u0DF2 < \\u0DDF < \\u0DF3" + "& \\u0DDE < \\u0DCA"; +#else +static const char sinhala[]= + "& \\u0D96 < \\u0D82 < \\u0D83 < \\u0D9A < \\u0D9B < \\u0D9C < \\u0D9D" + "< \\u0D9E < \\u0D9F < \\u0DA0 < \\u0DA1 < \\u0DA2 < \\u0DA3" + "< \\u0DA5 < \\u0DA4 < \\u0DA6" + "< \\u0DA7 < \\u0DA8 < \\u0DA9 < \\u0DAA < \\u0DAB < \\u0DAC" + "< \\u0DAD < \\u0DAE < \\u0DAF < \\u0DB0 < \\u0DB1" + "< \\u0DB3 < \\u0DB4 < \\u0DB5 < \\u0DB6 < \\u0DB7 < \\u0DB8" + "< \\u0DB9 < \\u0DBA < \\u0DBB < \\u0DBD < \\u0DC0 < \\u0DC1" + "< \\u0DC2 < \\u0DC3 < \\u0DC4 < \\u0DC5 < \\u0DC6" + "< \\u0DCF" + "< \\u0DD0 < \\u0DD1 < \\u0DD2 < \\u0DD3 < \\u0DD4 < \\u0DD6" + "< \\u0DD8 < \\u0DF2 < \\u0DDF < \\u0DF3 < \\u0DD9 < \\u0DDA" + "< \\u0DDB < \\u0DDC < \\u0DDD < \\u0DDE < \\u0DCA"; +#endif + + +/* + Unicode Collation Algorithm: + Collation element (weight) scanner, + for consequent scan of collations + weights from a string. +*/ +typedef struct my_uca_scanner_st +{ + const uint16 *wbeg; /* Beginning of the current weight string */ + const uchar *sbeg; /* Beginning of the input string */ + const uchar *send; /* End of the input string */ + uchar *uca_length; + uint16 **uca_weight; + uint16 *contractions; + uint16 implicit[2]; + int page; + int code; + CHARSET_INFO *cs; +} my_uca_scanner; + +/* + Charset dependent scanner part, to optimize + some character sets. +*/ +typedef struct my_uca_scanner_handler_st +{ + void (*init)(my_uca_scanner *scanner, CHARSET_INFO *cs, + const uchar *str, size_t length); + int (*next)(my_uca_scanner *scanner); +} my_uca_scanner_handler; + +static uint16 nochar[]= {0,0}; + + +#ifdef HAVE_CHARSET_ucs2 +/* + Initialize collation weight scanner + + SYNOPSIS: + my_uca_scanner_init() + scanner Pointer to an initialized scanner structure + cs Character set + collation information + str Beginning of the string + length Length of the string. + + NOTES: + Optimized for UCS2 + + RETURN + N/A +*/ + +static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner, + CHARSET_INFO *cs __attribute__((unused)), + const uchar *str, size_t length) +{ + scanner->wbeg= nochar; + if (length) + { + scanner->sbeg= str; + scanner->send= str + length - 2; + scanner->uca_length= cs->sort_order; + scanner->uca_weight= cs->sort_order_big; + scanner->contractions= cs->contractions; + return; + } + + /* + Sometimes this function is called with + str=NULL and length=0, which should be + considered as an empty string. + + The above initialization is unsafe for such cases, + because scanner->send is initialized to (NULL-2), which is 0xFFFFFFFE. + Then we fall into an endless loop in my_uca_scanner_next_ucs2(). + + Do special initialization for the case when length=0. + Initialize scanner->sbeg to an address greater than scanner->send. + Next call of my_uca_scanner_next_ucs2() will correctly return with -1. + */ + scanner->sbeg= (uchar*) &nochar[1]; + scanner->send= (uchar*) &nochar[0]; +} + + +/* + Read next collation element (weight), i.e. converts + a stream of characters into a stream of their weights. + + SYNOPSIS: + my_uca_scanner_next() + scanner Address of a previously initialized scanner strucuture + + NOTES: + Optimized for UCS2 + + Checks if the current character's weight string has been fully scanned, + if no, then returns the next weight for this character, + else scans the next character and returns its first weight. + + Each character can have number weights from 0 to 8. + + Some characters do not have weights at all, 0 weights. + It means they are ignored during comparison. + + Examples: + 1. 0x0001 START OF HEADING, has no weights, ignored, does + not produce any weights. + 2. 0x0061 LATIN SMALL LETTER A, has one weight. + 0x0E33 will be returned + 3. 0x00DF LATIN SMALL LETTER SHARP S, aka SZ ligature, + has two weights. It will return 0x0FEA twice for two + consequent calls. + 4. 0x247D PATENTHESIZED NUMBER TEN, has four weights, + this function will return these numbers in four + consequent calls: 0x0288, 0x0E2A, 0x0E29, 0x0289 + 5. A string consisting of the above characters: + 0x0001 0x0061 0x00DF 0x247D + will return the following weights, one weight per call: + 0x0E33 0x0FEA 0x0FEA 0x0288, 0x0E2A, 0x0E29, 0x0289 + + RETURN + Next weight, a number between 0x0000 and 0xFFFF + Or -1 on error (END-OF-STRING or ILLEGAL MULTIBYTE SEQUENCE) +*/ + +static int my_uca_scanner_next_ucs2(my_uca_scanner *scanner) +{ + + /* + Check if the weights for the previous character have been + already fully scanned. If yes, then get the next character and + initialize wbeg and wlength to its weight string. + */ + + if (scanner->wbeg[0]) + return *scanner->wbeg++; + + do + { + uint16 **ucaw= scanner->uca_weight; + uchar *ucal= scanner->uca_length; + + if (scanner->sbeg > scanner->send) + return -1; + + scanner->page= (uchar)scanner->sbeg[0]; + scanner->code= (uchar)scanner->sbeg[1]; + scanner->sbeg+= 2; + + if (scanner->contractions && (scanner->sbeg <= scanner->send)) + { + int cweight; + + if (!scanner->page && !scanner->sbeg[0] && + (scanner->sbeg[1] > 0x40) && (scanner->sbeg[1] < 0x80) && + (scanner->code > 0x40) && (scanner->code < 0x80) && + (cweight= scanner->contractions[(scanner->code-0x40)*0x40+scanner->sbeg[1]-0x40])) + { + scanner->implicit[0]= 0; + scanner->wbeg= scanner->implicit; + scanner->sbeg+=2; + return cweight; + } + } + + if (!ucaw[scanner->page]) + goto implicit; + scanner->wbeg= ucaw[scanner->page] + scanner->code * ucal[scanner->page]; + } while (!scanner->wbeg[0]); + + return *scanner->wbeg++; + +implicit: + + scanner->code= (scanner->page << 8) + scanner->code; + scanner->implicit[0]= (scanner->code & 0x7FFF) | 0x8000; + scanner->implicit[1]= 0; + scanner->wbeg= scanner->implicit; + + scanner->page= scanner->page >> 7; + + if (scanner->code >= 0x3400 && scanner->code <= 0x4DB5) + scanner->page+= 0xFB80; + else if (scanner->code >= 0x4E00 && scanner->code <= 0x9FA5) + scanner->page+= 0xFB40; + else + scanner->page+= 0xFBC0; + + return scanner->page; +} + +static my_uca_scanner_handler my_ucs2_uca_scanner_handler= +{ + my_uca_scanner_init_ucs2, + my_uca_scanner_next_ucs2 +}; + +#endif + + +/* + The same two functions for any character set +*/ +static void my_uca_scanner_init_any(my_uca_scanner *scanner, + CHARSET_INFO *cs __attribute__((unused)), + const uchar *str, size_t length) +{ + /* Note, no needs to initialize scanner->wbeg */ + scanner->sbeg= str; + scanner->send= str + length; + scanner->wbeg= nochar; + scanner->uca_length= cs->sort_order; + scanner->uca_weight= cs->sort_order_big; + scanner->contractions= cs->contractions; + scanner->cs= cs; +} + +static int my_uca_scanner_next_any(my_uca_scanner *scanner) +{ + + /* + Check if the weights for the previous character have been + already fully scanned. If yes, then get the next character and + initialize wbeg and wlength to its weight string. + */ + + if (scanner->wbeg[0]) + return *scanner->wbeg++; + + do + { + uint16 **ucaw= scanner->uca_weight; + uchar *ucal= scanner->uca_length; + my_wc_t wc; + int mb_len; + + if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, + scanner->sbeg, + scanner->send)) <= 0)) + return -1; + + scanner->sbeg+= mb_len; + if (wc > 0xFFFF) + { + /* Return 0xFFFD as weight for all characters outside BMP */ + scanner->wbeg= nochar; + return 0xFFFD; + } + else + { + scanner->page= wc >> 8; + scanner->code= wc & 0xFF; + } + + if (scanner->contractions && !scanner->page && + (scanner->code > 0x40) && (scanner->code < 0x80)) + { + uint page1, code1, cweight; + + if (((mb_len= scanner->cs->cset->mb_wc(scanner->cs, &wc, + scanner->sbeg, + scanner->send)) >=0) && + (!(page1= (wc >> 8))) && + ((code1= (wc & 0xFF)) > 0x40) && + (code1 < 0x80) && + (cweight= scanner->contractions[(scanner->code-0x40)*0x40 + code1-0x40])) + { + scanner->implicit[0]= 0; + scanner->wbeg= scanner->implicit; + scanner->sbeg+= mb_len; + return cweight; + } + } + + if (!ucaw[scanner->page]) + goto implicit; + scanner->wbeg= ucaw[scanner->page] + scanner->code * ucal[scanner->page]; + } while (!scanner->wbeg[0]); + + return *scanner->wbeg++; + +implicit: + + scanner->code= (scanner->page << 8) + scanner->code; + scanner->implicit[0]= (scanner->code & 0x7FFF) | 0x8000; + scanner->implicit[1]= 0; + scanner->wbeg= scanner->implicit; + + scanner->page= scanner->page >> 7; + + if (scanner->code >= 0x3400 && scanner->code <= 0x4DB5) + scanner->page+= 0xFB80; + else if (scanner->code >= 0x4E00 && scanner->code <= 0x9FA5) + scanner->page+= 0xFB40; + else + scanner->page+= 0xFBC0; + + return scanner->page; +} + + +static my_uca_scanner_handler my_any_uca_scanner_handler= +{ + my_uca_scanner_init_any, + my_uca_scanner_next_any +}; + +/* + Compares two strings according to the collation + + SYNOPSIS: + my_strnncoll_uca() + cs Character set information + s First string + slen First string length + t Second string + tlen Seconf string length + + NOTES: + Initializes two weight scanners and gets weights + corresponding to two strings in a loop. If weights are not + the same at some step then returns their difference. + + In the while() comparison these situations are possible: + 1. (s_res>0) and (t_res>0) and (s_res == t_res) + Weights are the same so far, continue comparison + 2. (s_res>0) and (t_res>0) and (s_res!=t_res) + A difference has been found, return. + 3. (s_res>0) and (t_res<0) + We have reached the end of the second string, or found + an illegal multibyte sequence in the second string. + Return a positive number, i.e. the first string is bigger. + 4. (s_res<0) and (t_res>0) + We have reached the end of the first string, or found + an illegal multibyte sequence in the first string. + Return a negative number, i.e. the second string is bigger. + 5. (s_res<0) and (t_res<0) + Both scanners returned -1. It means we have riched + the end-of-string of illegal-sequence in both strings + at the same time. Return 0, strings are equal. + + RETURN + Difference between two strings, according to the collation: + 0 - means strings are equal + negative number - means the first string is smaller + positive number - means the first string is bigger +*/ + +static int my_strnncoll_uca(CHARSET_INFO *cs, + my_uca_scanner_handler *scanner_handler, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + my_uca_scanner sscanner; + my_uca_scanner tscanner; + int s_res; + int t_res; + + scanner_handler->init(&sscanner, cs, s, slen); + scanner_handler->init(&tscanner, cs, t, tlen); + + do + { + s_res= scanner_handler->next(&sscanner); + t_res= scanner_handler->next(&tscanner); + } while ( s_res == t_res && s_res >0); + + return (t_is_prefix && t_res < 0) ? 0 : (s_res - t_res); +} + +/* + Compares two strings according to the collation, + ignoring trailing spaces. + + SYNOPSIS: + my_strnncollsp_uca() + cs Character set information + s First string + slen First string length + t Second string + tlen Seconf string length + diff_if_only_endspace_difference + Set to 1 if the strings should be regarded as different + if they only difference in end space + + NOTES: + Works exactly the same with my_strnncoll_uca(), + but ignores trailing spaces. + + In the while() comparison these situations are possible: + 1. (s_res>0) and (t_res>0) and (s_res == t_res) + Weights are the same so far, continue comparison + 2. (s_res>0) and (t_res>0) and (s_res!=t_res) + A difference has been found, return. + 3. (s_res>0) and (t_res<0) + We have reached the end of the second string, or found + an illegal multibyte sequence in the second string. + Compare the first string to an infinite array of + space characters until difference is found, or until + the end of the first string. + 4. (s_res<0) and (t_res>0) + We have reached the end of the first string, or found + an illegal multibyte sequence in the first string. + Compare the second string to an infinite array of + space characters until difference is found or until + the end of the second steing. + 5. (s_res<0) and (t_res<0) + Both scanners returned -1. It means we have riched + the end-of-string of illegal-sequence in both strings + at the same time. Return 0, strings are equal. + + RETURN + Difference between two strings, according to the collation: + 0 - means strings are equal + negative number - means the first string is smaller + positive number - means the first string is bigger +*/ + +static int my_strnncollsp_uca(CHARSET_INFO *cs, + my_uca_scanner_handler *scanner_handler, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + my_uca_scanner sscanner, tscanner; + int s_res, t_res; + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= 0; +#endif + + scanner_handler->init(&sscanner, cs, s, slen); + scanner_handler->init(&tscanner, cs, t, tlen); + + do + { + s_res= scanner_handler->next(&sscanner); + t_res= scanner_handler->next(&tscanner); + } while ( s_res == t_res && s_res >0); + + if (s_res > 0 && t_res < 0) + { + /* Calculate weight for SPACE character */ + t_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]]; + + /* compare the first string to spaces */ + do + { + if (s_res != t_res) + return (s_res - t_res); + s_res= scanner_handler->next(&sscanner); + } while (s_res > 0); + return diff_if_only_endspace_difference ? 1 : 0; + } + + if (s_res < 0 && t_res > 0) + { + /* Calculate weight for SPACE character */ + s_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]]; + + /* compare the second string to spaces */ + do + { + if (s_res != t_res) + return (s_res - t_res); + t_res= scanner_handler->next(&tscanner); + } while (t_res > 0); + return diff_if_only_endspace_difference ? -1 : 0; + } + + return ( s_res - t_res ); +} + +/* + Calculates hash value for the given string, + according to the collation, and ignoring trailing spaces. + + SYNOPSIS: + my_hash_sort_uca() + cs Character set information + s String + slen String's length + n1 First hash parameter + n2 Second hash parameter + + NOTES: + Scans consequently weights and updates + hash parameters n1 and n2. In a case insensitive collation, + upper and lower case of the same letter will return the same + weight sequence, and thus will produce the same hash values + in n1 and n2. + + RETURN + N/A +*/ + +static void my_hash_sort_uca(CHARSET_INFO *cs, + my_uca_scanner_handler *scanner_handler, + const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + int s_res; + my_uca_scanner scanner; + + slen= cs->cset->lengthsp(cs, (char*) s, slen); + scanner_handler->init(&scanner, cs, s, slen); + + while ((s_res= scanner_handler->next(&scanner)) >0) + { + n1[0]^= (((n1[0] & 63)+n2[0])*(s_res >> 8))+ (n1[0] << 8); + n2[0]+=3; + n1[0]^= (((n1[0] & 63)+n2[0])*(s_res & 0xFF))+ (n1[0] << 8); + n2[0]+=3; + } +} + + +/* + For the given string creates its "binary image", suitable + to be used in binary comparison, i.e. in memcmp(). + + SYNOPSIS: + my_strnxfrm_uca() + cs Character set information + dst Where to write the image + dstlen Space available for the image, in bytes + src The source string + srclen Length of the source string, in bytes + + NOTES: + In a loop, scans weights from the source string and writes + them into the binary image. In a case insensitive collation, + upper and lower cases of the same letter will produce the + same image subsequences. When we have reached the end-of-string + or found an illegal multibyte sequence, the loop stops. + + It is impossible to restore the original string using its + binary image. + + Binary images are used for bulk comparison purposes, + e.g. in ORDER BY, when it is more efficient to create + a binary image and use it instead of weight scanner + for the original strings for every comparison. + + RETURN + Number of bytes that have been written into the binary image. +*/ + +static size_t my_strnxfrm_uca(CHARSET_INFO *cs, + my_uca_scanner_handler *scanner_handler, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + uchar *d0= dst; + uchar *de= dst + dstlen; + int s_res; + my_uca_scanner scanner; + scanner_handler->init(&scanner, cs, src, srclen); + + for (; dst < de && nweights && + (s_res= scanner_handler->next(&scanner)) > 0 ; nweights--) + { + *dst++= s_res >> 8; + if (dst < de) + *dst++= s_res & 0xFF; + } + + if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + uint space_count= min((uint) (de - dst) / 2, nweights); + s_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]]; + for (; space_count ; space_count--) + { + *dst++= s_res >> 8; + *dst++= s_res & 0xFF; + } + } + my_strxfrm_desc_and_reverse(d0, dst, flags, 0); + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de) + { + s_res= cs->sort_order_big[0][0x20 * cs->sort_order[0]]; + for ( ; dst < de; ) + { + *dst++= s_res >> 8; + if (dst < de) + *dst++= s_res & 0xFF; + } + } + return dst - d0; +} + + + +/* + This function compares if two characters are the same. + The sign +1 or -1 does not matter. The only + important thing is that the result is 0 or not 0. + This fact allows us to use memcmp() safely, on both + little-endian and big-endian machines. +*/ + +static int my_uca_charcmp(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2) +{ + size_t page1= wc1 >> MY_UCA_PSHIFT; + size_t page2= wc2 >> MY_UCA_PSHIFT; + uchar *ucal= cs->sort_order; + uint16 **ucaw= cs->sort_order_big; + size_t length1= ucal[page1]; + size_t length2= ucal[page2]; + uint16 *weight1= ucaw[page1] + (wc1 & MY_UCA_CMASK) * ucal[page1]; + uint16 *weight2= ucaw[page2] + (wc2 & MY_UCA_CMASK) * ucal[page2]; + + if (!weight1 || !weight2) + return wc1 != wc2; + + if (length1 > length2) + return memcmp((const void*)weight1, (const void*)weight2, length2*2) ? + 1: weight1[length2]; + + if (length1 < length2) + return memcmp((const void*)weight1, (const void*)weight2, length1*2) ? + 1 : weight2[length1]; + + return memcmp((const void*)weight1, (const void*)weight2, length1*2); +} + +/* +** Compare string against string with wildcard +** 0 if matched +** -1 if not matched with wildcard +** 1 if matched with wildcard +*/ + +static +int my_wildcmp_uca(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + int result= -1; /* Not found, using wildcards */ + my_wc_t s_wc, w_wc; + int scan; + int (*mb_wc)(struct charset_info_st *, my_wc_t *, + const uchar *, const uchar *); + mb_wc= cs->cset->mb_wc; + + while (wildstr != wildend) + { + while (1) + { + my_bool escaped= 0; + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + + if (w_wc == (my_wc_t)w_many) + { + result= 1; /* Found an anchor char */ + break; + } + + wildstr+= scan; + if (w_wc == (my_wc_t)escape) + { + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + wildstr+= scan; + escaped= 1; + } + + if ((scan= mb_wc(cs, &s_wc, (const uchar*)str, + (const uchar*)str_end)) <= 0) + return 1; + str+= scan; + + if (!escaped && w_wc == (my_wc_t)w_one) + { + result= 1; /* Found an anchor char */ + } + else + { + if (my_uca_charcmp(cs,s_wc,w_wc)) + return 1; + } + if (wildstr == wildend) + return (str != str_end); /* Match if both are at end */ + } + + + if (w_wc == (my_wc_t)w_many) + { /* Found w_many */ + + /* Remove any '%' and '_' from the wild search string */ + for ( ; wildstr != wildend ; ) + { + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + + if (w_wc == (my_wc_t)w_many) + { + wildstr+= scan; + continue; + } + + if (w_wc == (my_wc_t)w_one) + { + wildstr+= scan; + if ((scan= mb_wc(cs, &s_wc, (const uchar*)str, + (const uchar*)str_end)) <= 0) + return 1; + str+= scan; + continue; + } + break; /* Not a wild character */ + } + + if (wildstr == wildend) + return 0; /* Ok if w_many is last */ + + if (str == str_end) + return -1; + + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + + if (w_wc == (my_wc_t)escape) + { + wildstr+= scan; + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + } + + while (1) + { + /* Skip until the first character from wildstr is found */ + while (str != str_end) + { + if ((scan= mb_wc(cs, &s_wc, (const uchar*)str, + (const uchar*)str_end)) <= 0) + return 1; + + if (!my_uca_charcmp(cs,s_wc,w_wc)) + break; + str+= scan; + } + if (str == str_end) + return -1; + + result= my_wildcmp_uca(cs, str, str_end, wildstr, wildend, + escape, w_one, w_many); + + if (result <= 0) + return result; + + str+= scan; + } + } + } + return (str != str_end ? 1 : 0); +} + + +/* + Collation language is implemented according to + subset of ICU Collation Customization (tailorings): + http://icu.sourceforge.net/userguide/Collate_Customization.html + + Collation language elements: + Delimiters: + space - skipped + + := A-Z | a-z | \uXXXX + + Shift command: + := & - reset at this letter. + + Diff command: + := < - Identifies a primary difference. + := << - Identifies a secondary difference. + := <<< - Idenfifies a tertiary difference. + + + Collation rules: + := { } + + := + | + | + | + + := [ ] + + An example, Polish collation: + + &A < \u0105 <<< \u0104 + &C < \u0107 <<< \u0106 + &E < \u0119 <<< \u0118 + &L < \u0142 <<< \u0141 + &N < \u0144 <<< \u0143 + &O < \u00F3 <<< \u00D3 + &S < \u015B <<< \u015A + &Z < \u017A <<< \u017B +*/ + + +typedef enum my_coll_lexem_num_en +{ + MY_COLL_LEXEM_EOF = 0, + MY_COLL_LEXEM_DIFF = 1, + MY_COLL_LEXEM_SHIFT = 4, + MY_COLL_LEXEM_CHAR = 5, + MY_COLL_LEXEM_ERROR = 6 +} my_coll_lexem_num; + + +typedef struct my_coll_lexem_st +{ + const char *beg; + const char *end; + const char *prev; + int diff; + int code; +} MY_COLL_LEXEM; + + +/* + Initialize collation rule lexical anilizer + + SYNOPSIS + my_coll_lexem_init + lexem Lex analizer to init + str Const string to parse + str_end End of the string + USAGE + + RETURN VALUES + N/A +*/ + +static void my_coll_lexem_init(MY_COLL_LEXEM *lexem, + const char *str, const char *str_end) +{ + lexem->beg= str; + lexem->prev= str; + lexem->end= str_end; + lexem->diff= 0; + lexem->code= 0; +} + + +/* + Print collation customization expression parse error, with context. + + SYNOPSIS + my_coll_lexem_print_error + lexem Lex analizer to take context from + errstr sting to write error to + errsize errstr size + txt error message + USAGE + + RETURN VALUES + N/A +*/ + +static void my_coll_lexem_print_error(MY_COLL_LEXEM *lexem, + char *errstr, size_t errsize, + const char *txt) +{ + char tail[30]; + size_t len= lexem->end - lexem->prev; + strmake (tail, lexem->prev, (size_t) min(len, sizeof(tail)-1)); + errstr[errsize-1]= '\0'; + my_snprintf(errstr,errsize-1,"%s at '%s'", txt, tail); +} + + +/* + Convert a hex digit into its numeric value + + SYNOPSIS + ch2x + ch hex digit to convert + USAGE + + RETURN VALUES + an integer value in the range 0..15 + -1 on error +*/ + +static int ch2x(int ch) +{ + if (ch >= '0' && ch <= '9') + return ch - '0'; + + if (ch >= 'a' && ch <= 'f') + return 10 + ch - 'a'; + + if (ch >= 'A' && ch <= 'F') + return 10 + ch - 'A'; + + return -1; +} + + +/* + Collation language lexical parser: + Scans the next lexem. + + SYNOPSIS + my_coll_lexem_next + lexem Lex analizer, previously initialized by + my_coll_lexem_init. + USAGE + Call this function in a loop + + RETURN VALUES + Lexem number: eof, diff, shift, char or error. +*/ + +static my_coll_lexem_num my_coll_lexem_next(MY_COLL_LEXEM *lexem) +{ + const char *beg; + my_coll_lexem_num rc; + + for (beg= lexem->beg ; beg < lexem->end ; beg++) + { + if (*beg == ' ' || *beg == '\t' || *beg == '\r' || *beg == '\n') + continue; + + if (*beg == '&') + { + beg++; + rc= MY_COLL_LEXEM_SHIFT; + goto ex; + } + + if (beg[0] == '=') + { + beg++; + rc= MY_COLL_LEXEM_DIFF; + goto ex; + } + + if (beg[0] == '<') + { + for (beg++, lexem->diff= 1; + (beg < lexem->end) && + (*beg == '<') && (lexem->diff<3); + beg++, lexem->diff++); + rc= MY_COLL_LEXEM_DIFF; + goto ex; + } + + if ((*beg >= 'a' && *beg <= 'z') || (*beg >= 'A' && *beg <= 'Z')) + { + lexem->code= *beg++; + rc= MY_COLL_LEXEM_CHAR; + goto ex; + } + + if ((*beg == '\\') && (beg+2 < lexem->end) && (beg[1] == 'u')) + { + int ch; + + beg+= 2; + lexem->code= 0; + while ((beg < lexem->end) && ((ch= ch2x(beg[0])) >= 0)) + { + lexem->code= (lexem->code << 4) + ch; + beg++; + } + rc= MY_COLL_LEXEM_CHAR; + goto ex; + } + + rc= MY_COLL_LEXEM_ERROR; + goto ex; + } + rc= MY_COLL_LEXEM_EOF; + +ex: + lexem->prev= lexem->beg; + lexem->beg= beg; + return rc; +} + + +/* + Collation rule item +*/ + +typedef struct my_coll_rule_item_st +{ + uint base; /* Base character */ + uint curr[2]; /* Current character */ + int diff[3]; /* Primary, Secondary and Tertiary difference */ +} MY_COLL_RULE; + + +/* + Collation language syntax parser. + Uses lexical parser. + + SYNOPSIS + my_coll_rule_parse + rule Collation rule list to load to. + str A string containin collation language expression. + str_end End of the string. + USAGE + + RETURN VALUES + A positive number means the number of rules loaded. + -1 means ERROR, e.g. too many items, syntax error, etc. +*/ + +static int my_coll_rule_parse(MY_COLL_RULE *rule, size_t mitems, + const char *str, const char *str_end, + char *errstr, size_t errsize) +{ + MY_COLL_LEXEM lexem; + my_coll_lexem_num lexnum; + my_coll_lexem_num prevlexnum= MY_COLL_LEXEM_ERROR; + MY_COLL_RULE item; + int state= 0; + size_t nitems= 0; + + /* Init all variables */ + errstr[0]= '\0'; + bzero(&item, sizeof(item)); + my_coll_lexem_init(&lexem, str, str_end); + + while ((lexnum= my_coll_lexem_next(&lexem))) + { + if (lexnum == MY_COLL_LEXEM_ERROR) + { + my_coll_lexem_print_error(&lexem,errstr,errsize-1,"Unknown character"); + return -1; + } + + switch (state) { + case 0: + if (lexnum != MY_COLL_LEXEM_SHIFT) + { + my_coll_lexem_print_error(&lexem,errstr,errsize-1,"& expected"); + return -1; + } + prevlexnum= lexnum; + state= 2; + continue; + + case 1: + if (lexnum != MY_COLL_LEXEM_SHIFT && lexnum != MY_COLL_LEXEM_DIFF) + { + my_coll_lexem_print_error(&lexem,errstr,errsize-1,"& or < expected"); + return -1; + } + prevlexnum= lexnum; + state= 2; + continue; + + case 2: + if (lexnum != MY_COLL_LEXEM_CHAR) + { + my_coll_lexem_print_error(&lexem,errstr,errsize-1,"character expected"); + return -1; + } + + if (prevlexnum == MY_COLL_LEXEM_SHIFT) + { + item.base= lexem.code; + item.diff[0]= 0; + item.diff[1]= 0; + item.diff[2]= 0; + } + else if (prevlexnum == MY_COLL_LEXEM_DIFF) + { + MY_COLL_LEXEM savlex; + savlex= lexem; + item.curr[0]= lexem.code; + if ((lexnum= my_coll_lexem_next(&lexem)) == MY_COLL_LEXEM_CHAR) + { + item.curr[1]= lexem.code; + } + else + { + item.curr[1]= 0; + lexem=savlex; /* Restore previous parser state */ + } + if (lexem.diff == 3) + { + item.diff[2]++; + } + else if (lexem.diff == 2) + { + item.diff[1]++; + item.diff[2]= 0; + } + else if (lexem.diff == 1) + { + item.diff[0]++; + item.diff[1]= 0; + item.diff[2]= 0; + } + else if (lexem.diff == 0) + { + item.diff[0]= item.diff[1]= item.diff[2]= 0; + } + if (nitems >= mitems) + { + my_coll_lexem_print_error(&lexem,errstr,errsize-1,"Too many rules"); + return -1; + } + rule[nitems++]= item; + } + else + { + my_coll_lexem_print_error(&lexem,errstr,errsize-1,"Should never happen"); + return -1; + } + state= 1; + continue; + } + } + return (int) nitems; +} + +#define MY_MAX_COLL_RULE 128 + +/* + This function copies an UCS2 collation from + the default Unicode Collation Algorithm (UCA) + weights applying tailorings, i.e. a set of + alternative weights for some characters. + + The default UCA weights are stored in uca_weight/uca_length. + They consist of 256 pages, 256 character each. + + If a page is not overwritten by tailoring rules, + it is copies as is from UCA as is. + + If a page contains some overwritten characters, it is + allocated. Untouched characters are copied from the + default weights. +*/ + +static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) +{ + MY_COLL_RULE rule[MY_MAX_COLL_RULE]; + char errstr[128]; + uchar *newlengths; + uint16 **newweights; + const uchar *deflengths= uca_length; + uint16 **defweights= uca_weight; + int rc, i; + int ncontractions= 0; + + if (!cs->tailoring) + return 1; + + /* Parse ICU Collation Customization expression */ + if ((rc= my_coll_rule_parse(rule, MY_MAX_COLL_RULE, + cs->tailoring, + cs->tailoring + strlen(cs->tailoring), + errstr, sizeof(errstr))) < 0) + { + /* + TODO: add error message reporting. + printf("Error: %d '%s'\n", rc, errstr); + */ + return 1; + } + + if (!(newweights= (uint16**) (*alloc)(256*sizeof(uint16*)))) + return 1; + bzero(newweights, 256*sizeof(uint16*)); + + if (!(newlengths= (uchar*) (*alloc)(256))) + return 1; + + memcpy(newlengths, deflengths, 256); + + /* + Calculate maximum lenghts for the pages + which will be overwritten. + */ + for (i=0; i < rc; i++) + { + if (!rule[i].curr[1]) /* If not a contraction */ + { + uint pageb= (rule[i].base >> 8) & 0xFF; + uint pagec= (rule[i].curr[0] >> 8) & 0xFF; + + if (newlengths[pagec] < deflengths[pageb]) + newlengths[pagec]= deflengths[pageb]; + } + else + ncontractions++; + } + + for (i=0; i < rc; i++) + { + uint pageb= (rule[i].base >> 8) & 0xFF; + uint pagec= (rule[i].curr[0] >> 8) & 0xFF; + uint chb, chc; + + if (rule[i].curr[1]) /* Skip contraction */ + continue; + + if (!newweights[pagec]) + { + /* Alloc new page and copy the default UCA weights */ + uint size= 256*newlengths[pagec]*sizeof(uint16); + + if (!(newweights[pagec]= (uint16*) (*alloc)(size))) + return 1; + bzero((void*) newweights[pagec], size); + + for (chc=0 ; chc < 256; chc++) + { + memcpy(newweights[pagec] + chc*newlengths[pagec], + defweights[pagec] + chc*deflengths[pagec], + deflengths[pagec]*sizeof(uint16)); + } + } + + /* + Aply the alternative rule: + shift to the base character and primary difference. + */ + chc= rule[i].curr[0] & 0xFF; + chb= rule[i].base & 0xFF; + memcpy(newweights[pagec] + chc*newlengths[pagec], + defweights[pageb] + chb*deflengths[pageb], + deflengths[pageb]*sizeof(uint16)); + /* Apply primary difference */ + newweights[pagec][chc*newlengths[pagec]]+= rule[i].diff[0]; + } + + /* Copy non-overwritten pages from the default UCA weights */ + for (i= 0; i < 256 ; i++) + { + if (!newweights[i]) + newweights[i]= defweights[i]; + } + + cs->sort_order= newlengths; + cs->sort_order_big= newweights; + cs->contractions= NULL; + + /* Now process contractions */ + if (ncontractions) + { + /* + 8K for weights for basic latin letter pairs, + plus 256 bytes for "is contraction part" flags. + */ + uint size= 0x40*0x40*sizeof(uint16) + 256; + char *contraction_flags; + if (!(cs->contractions= (uint16*) (*alloc)(size))) + return 1; + bzero((void*)cs->contractions, size); + contraction_flags= ((char*) cs->contractions) + 0x40*0x40; + for (i=0; i < rc; i++) + { + if (rule[i].curr[1]) + { + uint pageb= (rule[i].base >> 8) & 0xFF; + uint chb= rule[i].base & 0xFF; + uint16 *offsb= defweights[pageb] + chb*deflengths[pageb]; + uint offsc; + + if (offsb[1] || + rule[i].curr[0] < 0x40 || rule[i].curr[0] > 0x7f || + rule[i].curr[1] < 0x40 || rule[i].curr[1] > 0x7f) + { + /* + TODO: add error reporting; + We support only basic latin letters contractions at this point. + Also, We don't support contractions with weight longer than one. + Otherwise, we'd need much more memory. + */ + return 1; + } + offsc= (rule[i].curr[0]-0x40)*0x40+(rule[i].curr[1]-0x40); + + /* Copy base weight applying primary difference */ + cs->contractions[offsc]= offsb[0] + rule[i].diff[0]; + /* Mark both letters as "is contraction part */ + contraction_flags[rule[i].curr[0]]= 1; + contraction_flags[rule[i].curr[1]]= 1; + } + } + } + return 0; +} + + +/* + Universal CHARSET_INFO compatible wrappers + for the above internal functions. + Should work for any character set. +*/ + +static my_bool my_coll_init_uca(CHARSET_INFO *cs, void *(*alloc)(size_t)) +{ + cs->pad_char= ' '; + return create_tailoring(cs, alloc); +} + +static int my_strnncoll_any_uca(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + return my_strnncoll_uca(cs, &my_any_uca_scanner_handler, + s, slen, t, tlen, t_is_prefix); +} + +static int my_strnncollsp_any_uca(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + return my_strnncollsp_uca(cs, &my_any_uca_scanner_handler, + s, slen, t, tlen, + diff_if_only_endspace_difference); +} + +static void my_hash_sort_any_uca(CHARSET_INFO *cs, + const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + my_hash_sort_uca(cs, &my_any_uca_scanner_handler, s, slen, n1, n2); +} + +static size_t my_strnxfrm_any_uca(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + return my_strnxfrm_uca(cs, &my_any_uca_scanner_handler, + dst, dstlen, nweights, src, srclen, flags); +} + + +#ifdef HAVE_CHARSET_ucs2 +/* + UCS2 optimized CHARSET_INFO compatible wrappers. +*/ +static int my_strnncoll_ucs2_uca(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + return my_strnncoll_uca(cs, &my_ucs2_uca_scanner_handler, + s, slen, t, tlen, t_is_prefix); +} + +static int my_strnncollsp_ucs2_uca(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + return my_strnncollsp_uca(cs, &my_ucs2_uca_scanner_handler, + s, slen, t, tlen, + diff_if_only_endspace_difference); +} + +static void my_hash_sort_ucs2_uca(CHARSET_INFO *cs, + const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + my_hash_sort_uca(cs, &my_ucs2_uca_scanner_handler, s, slen, n1, n2); +} + +static size_t my_strnxfrm_ucs2_uca(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + return my_strnxfrm_uca(cs, &my_ucs2_uca_scanner_handler, + dst, dstlen, nweights, src, srclen, flags); +} + +MY_COLLATION_HANDLER my_collation_ucs2_uca_handler = +{ + my_coll_init_uca, /* init */ + my_strnncoll_ucs2_uca, + my_strnncollsp_ucs2_uca, + my_strnxfrm_ucs2_uca, + my_strnxfrmlen_simple, + my_like_range_ucs2, + my_wildcmp_uca, + NULL, + my_instr_mb, + my_hash_sort_ucs2_uca, + my_propagate_complex +}; + +CHARSET_INFO my_charset_ucs2_unicode_ci= +{ + 128,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_unicode_ci", /* name */ + "", /* comment */ + "", /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + uca_length, /* sort_order */ + NULL, /* contractions */ + uca_weight, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_icelandic_uca_ci= +{ + 129,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_icelandic_ci", /* name */ + "", /* comment */ + icelandic, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_latvian_uca_ci= +{ + 130,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_latvian_ci", /* name */ + "", /* comment */ + latvian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_romanian_uca_ci= +{ + 131,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_romanian_ci", /* name */ + "", /* comment */ + romanian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_slovenian_uca_ci= +{ + 132,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_slovenian_ci", /* name */ + "", /* comment */ + slovenian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_polish_uca_ci= +{ + 133,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_polish_ci", /* name */ + "", /* comment */ + polish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_estonian_uca_ci= +{ + 134,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_estonian_ci", /* name */ + "", /* comment */ + estonian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_spanish_uca_ci= +{ + 135,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_spanish_ci", /* name */ + "", /* comment */ + spanish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_swedish_uca_ci= +{ + 136,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_swedish_ci", /* name */ + "", /* comment */ + swedish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_turkish_uca_ci= +{ + 137,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_turkish_ci", /* name */ + "", /* comment */ + turkish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_turkish, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_czech_uca_ci= +{ + 138,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_czech_ci", /* name */ + "", /* comment */ + czech, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + + +CHARSET_INFO my_charset_ucs2_danish_uca_ci= +{ + 139,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_danish_ci", /* name */ + "", /* comment */ + danish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci= +{ + 140,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_lithuanian_ci",/* name */ + "", /* comment */ + lithuanian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_slovak_uca_ci= +{ + 141,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_slovak_ci", /* name */ + "", /* comment */ + slovak, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + +CHARSET_INFO my_charset_ucs2_spanish2_uca_ci= +{ + 142,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_spanish2_ci", /* name */ + "", /* comment */ + spanish2, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + + +CHARSET_INFO my_charset_ucs2_roman_uca_ci= +{ + 143,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_roman_ci", /* name */ + "", /* comment */ + roman, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + + +CHARSET_INFO my_charset_ucs2_persian_uca_ci= +{ + 144,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_persian_ci", /* name */ + "", /* comment */ + persian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + + +CHARSET_INFO my_charset_ucs2_esperanto_uca_ci= +{ + 145,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_esperanto_ci", /* name */ + "", /* comment */ + esperanto, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + + +CHARSET_INFO my_charset_ucs2_hungarian_uca_ci= +{ + 146,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* csname */ + "ucs2_hungarian_ci", /* name */ + "", /* comment */ + hungarian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + + +CHARSET_INFO my_charset_ucs2_sinhala_uca_ci= +{ + 147,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + "ucs2", /* csname */ + "ucs2_sinhala_ci", /* name */ + "", /* comment */ + sinhala, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_uca_handler +}; + + +#endif + + +#if defined(HAVE_CHARSET_utf8mb3) || defined(HAVE_CHARSET_utf8mb4) +/* + We consider bytes with code more than 127 as a letter. + This garantees that word boundaries work fine with regular + expressions. Note, there is no need to mark byte 255 as a + letter, it is illegal byte in UTF8. +*/ +static uchar ctype_utf8[]= +{ + 0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16, + 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, + 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0 +}; + + +MY_COLLATION_HANDLER my_collation_any_uca_handler = +{ + my_coll_init_uca, /* init */ + my_strnncoll_any_uca, + my_strnncollsp_any_uca, + my_strnxfrm_any_uca, + my_strnxfrmlen_simple, + my_like_range_mb, + my_wildcmp_uca, + NULL, + my_instr_mb, + my_hash_sort_any_uca, + my_propagate_complex +}; + +#endif /* HAVE_CHARSET_utf8mb3 || HAVE_CHARSET_utf8mb4 */ + + +#ifdef HAVE_CHARSET_utf8mb3 + +extern MY_CHARSET_HANDLER my_charset_utf8mb3_handler; + +CHARSET_INFO my_charset_utf8mb3_unicode_ci= +{ + 192,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_unicode_ci",/* name */ + "", /* comment */ + "", /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + uca_length, /* sort_order */ + NULL, /* contractions */ + uca_weight, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + + +CHARSET_INFO my_charset_utf8mb3_icelandic_uca_ci= +{ + 193,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_icelandic_ci",/* name */ + "", /* comment */ + icelandic, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_latvian_uca_ci= +{ + 194,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_latvian_ci", /* name */ + "", /* comment */ + latvian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_romanian_uca_ci= +{ + 195,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_romanian_ci",/* name */ + "", /* comment */ + romanian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_slovenian_uca_ci= +{ + 196,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_slovenian_ci",/* name */ + "", /* comment */ + slovenian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_dort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_polish_uca_ci= +{ + 197,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_polish_ci", /* name */ + "", /* comment */ + polish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_estonian_uca_ci= +{ + 198,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_estonian_ci", /* name */ + "", /* comment */ + estonian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_spanish_uca_ci= +{ + 199,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_spanish_ci", /* name */ + "", /* comment */ + spanish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_swedish_uca_ci= +{ + 200,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_swedish_ci", /* name */ + "", /* comment */ + swedish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_turkish_uca_ci= +{ + 201,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_turkish_ci", /* name */ + "", /* comment */ + turkish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_turkish, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_czech_uca_ci= +{ + 202,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_czech_ci", /* name */ + "", /* comment */ + czech, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + + +CHARSET_INFO my_charset_utf8mb3_danish_uca_ci= +{ + 203,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_danish_ci", /* name */ + "", /* comment */ + danish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_lithuanian_uca_ci= +{ + 204,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_lithuanian_ci",/* name */ + "", /* comment */ + lithuanian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_slovak_uca_ci= +{ + 205,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_slovak_ci", /* name */ + "", /* comment */ + slovak, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_spanish2_uca_ci= +{ + 206,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_spanish2_ci", /* name */ + "", /* comment */ + spanish2, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_roman_uca_ci= +{ + 207,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_roman_ci", /* name */ + "", /* comment */ + roman, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_persian_uca_ci= +{ + 208,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_persian_ci", /* name */ + "", /* comment */ + persian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_esperanto_uca_ci= +{ + 209,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_esperanto_ci",/* name */ + "", /* comment */ + esperanto, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_hungarian_uca_ci= +{ + 210,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* csname */ + MY_UTF8MB3 "_hungarian_ci",/* name */ + "", /* comment */ + hungarian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb3_sinhala_uca_ci= +{ + 211,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB3, /* cs name */ + MY_UTF8MB3 "_sinhala_ci",/* name */ + "", /* comment */ + sinhala, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 3, /* mbminlen */ + 3, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_any_uca_handler +}; + +#endif /* HAVE_CHARSET_utf8mb3 */ + + +#ifdef HAVE_CHARSET_utf8mb4 + +extern MY_CHARSET_HANDLER my_charset_utf8mb4_handler; + +CHARSET_INFO my_charset_utf8mb4_unicode_ci= +{ + 224,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_unicode_ci",/* name */ + "", /* comment */ + "", /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + uca_length, /* sort_order */ + NULL, /* contractions */ + uca_weight, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + + +CHARSET_INFO my_charset_utf8mb4_icelandic_uca_ci= +{ + 225,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_icelandic_ci",/* name */ + "", /* comment */ + icelandic, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_latvian_uca_ci= +{ + 226,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_latvian_ci", /* name */ + "", /* comment */ + latvian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_romanian_uca_ci= +{ + 227,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_romanian_ci", /* name */ + "", /* comment */ + romanian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_slovenian_uca_ci= +{ + 228,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_slovenian_ci",/* name */ + "", /* comment */ + slovenian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_polish_uca_ci= +{ + 229,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_polish_ci", /* name */ + "", /* comment */ + polish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_estonian_uca_ci= +{ + 230,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_estonian_ci", /* name */ + "", /* comment */ + estonian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_spanish_uca_ci= +{ + 231,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_spanish_ci", /* name */ + "", /* comment */ + spanish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_swedish_uca_ci= +{ + 232,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_swedish_ci", /* name */ + "", /* comment */ + swedish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_turkish_uca_ci= +{ + 233,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_turkish_ci", /* name */ + "", /* comment */ + turkish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_turkish, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 2, /* caseup_multiply */ + 2, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_czech_uca_ci= +{ + 234,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_czech_ci", /* name */ + "", /* comment */ + czech, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + + +CHARSET_INFO my_charset_utf8mb4_danish_uca_ci= +{ + 235,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_danish_ci", /* name */ + "", /* comment */ + danish, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_lithuanian_uca_ci= +{ + 236,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_lithuanian_ci",/* name */ + "", /* comment */ + lithuanian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_slovak_uca_ci= +{ + 237,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_slovak_ci", /* name */ + "", /* comment */ + slovak, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_spanish2_uca_ci= +{ + 238,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_spanish2_ci", /* name */ + "", /* comment */ + spanish2, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_roman_uca_ci= +{ + 239,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_roman_ci", /* name */ + "", /* comment */ + roman, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_persian_uca_ci= +{ + 240,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_persian_ci", /* name */ + "", /* comment */ + persian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_esperanto_uca_ci= +{ + 241,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_esperanto_ci",/* name */ + "", /* comment */ + esperanto, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_hungarian_uca_ci= +{ + 242,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_hungarian_ci",/* name */ + "", /* comment */ + hungarian, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +CHARSET_INFO my_charset_utf8mb4_sinhala_uca_ci= +{ + 243,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE, + MY_UTF8MB4, /* csname */ + MY_UTF8MB4 "_sinhala_ci",/* name */ + "", /* comment */ + sinhala, /* tailoring */ + ctype_utf8, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_any_uca_handler +}; + +#endif /* HAVE_CHARSET_utf8mb4 */ + + +#ifdef HAVE_CHARSET_utf32 + +MY_COLLATION_HANDLER my_collation_utf32_uca_handler = +{ + my_coll_init_uca, /* init */ + my_strnncoll_any_uca, + my_strnncollsp_any_uca, + my_strnxfrm_any_uca, + my_strnxfrmlen_simple, + my_like_range_utf32, + my_wildcmp_uca, + NULL, + my_instr_mb, + my_hash_sort_any_uca, + my_propagate_complex +}; + +extern MY_CHARSET_HANDLER my_charset_utf32_handler; + +CHARSET_INFO my_charset_utf32_unicode_ci= +{ + 160,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_unicode_ci", /* name */ + "", /* comment */ + "", /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + uca_length, /* sort_order */ + NULL, /* contractions */ + uca_weight, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + + +CHARSET_INFO my_charset_utf32_icelandic_uca_ci= +{ + 161,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_icelandic_ci",/* name */ + "", /* comment */ + icelandic, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_latvian_uca_ci= +{ + 162,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_latvian_ci", /* name */ + "", /* comment */ + latvian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_romanian_uca_ci= +{ + 163,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_romanian_ci", /* name */ + "", /* comment */ + romanian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_slovenian_uca_ci= +{ + 164,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_slovenian_ci",/* name */ + "", /* comment */ + slovenian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_polish_uca_ci= +{ + 165,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_polish_ci", /* name */ + "", /* comment */ + polish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_estonian_uca_ci= +{ + 166,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_estonian_ci", /* name */ + "", /* comment */ + estonian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_spanish_uca_ci= +{ + 167,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_spanish_ci", /* name */ + "", /* comment */ + spanish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_swedish_uca_ci= +{ + 168,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_swedish_ci", /* name */ + "", /* comment */ + swedish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_turkish_uca_ci= +{ + 169,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_turkish_ci", /* name */ + "", /* comment */ + turkish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_turkish, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_czech_uca_ci= +{ + 170,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_czech_ci", /* name */ + "", /* comment */ + czech, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + + +CHARSET_INFO my_charset_utf32_danish_uca_ci= +{ + 171,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_danish_ci", /* name */ + "", /* comment */ + danish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_lithuanian_uca_ci= +{ + 172,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_lithuanian_ci",/* name */ + "", /* comment */ + lithuanian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_slovak_uca_ci= +{ + 173,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_slovak_ci", /* name */ + "", /* comment */ + slovak, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_spanish2_uca_ci= +{ + 174,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_spanish2_ci", /* name */ + "", /* comment */ + spanish2, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_roman_uca_ci= +{ + 175,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_roman_ci", /* name */ + "", /* comment */ + roman, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_persian_uca_ci= +{ + 176,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_persian_ci", /* name */ + "", /* comment */ + persian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_esperanto_uca_ci= +{ + 177,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_esperanto_ci",/* name */ + "", /* comment */ + esperanto, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_hungarian_uca_ci= +{ + 178,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_hungarian_ci",/* name */ + "", /* comment */ + hungarian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +CHARSET_INFO my_charset_utf32_sinhala_uca_ci= +{ + 179,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* csname */ + "utf32_sinhala_ci", /* name */ + "", /* comment */ + sinhala, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_uca_handler +}; + +#endif /* HAVE_CHARSET_utf32 */ + + +#ifdef HAVE_CHARSET_utf16 + + +MY_COLLATION_HANDLER my_collation_utf16_uca_handler = +{ + my_coll_init_uca, /* init */ + my_strnncoll_any_uca, + my_strnncollsp_any_uca, + my_strnxfrm_any_uca, + my_strnxfrmlen_simple, + my_like_range_utf16, + my_wildcmp_uca, + NULL, + my_instr_mb, + my_hash_sort_any_uca, + my_propagate_complex +}; + +extern MY_CHARSET_HANDLER my_charset_utf16_handler; + +CHARSET_INFO my_charset_utf16_unicode_ci= +{ + 101,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* csname */ + "utf16_unicode_ci", /* name */ + "", /* comment */ + "", /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + uca_length, /* sort_order */ + NULL, /* contractions */ + uca_weight, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + + +CHARSET_INFO my_charset_utf16_icelandic_uca_ci= +{ + 102,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* csname */ + "utf16_icelandic_ci",/* name */ + "", /* comment */ + icelandic, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_latvian_uca_ci= +{ + 103,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_latvian_ci", /* name */ + "", /* comment */ + latvian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_romanian_uca_ci= +{ + 104,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_romanian_ci", /* name */ + "", /* comment */ + romanian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_slovenian_uca_ci= +{ + 105,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_slovenian_ci",/* name */ + "", /* comment */ + slovenian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_polish_uca_ci= +{ + 106,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_polish_ci", /* name */ + "", /* comment */ + polish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_estonian_uca_ci= +{ + 107,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_estonian_ci", /* name */ + "", /* comment */ + estonian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_spanish_uca_ci= +{ + 108,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_spanish_ci", /* name */ + "", /* comment */ + spanish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_swedish_uca_ci= +{ + 109,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_swedish_ci", /* name */ + "", /* comment */ + swedish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_turkish_uca_ci= +{ + 110,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_turkish_ci", /* name */ + "", /* comment */ + turkish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_turkish, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_czech_uca_ci= +{ + 111,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_czech_ci", /* name */ + "", /* comment */ + czech, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + + +CHARSET_INFO my_charset_utf16_danish_uca_ci= +{ + 112,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_danish_ci", /* name */ + "", /* comment */ + danish, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_lithuanian_uca_ci= +{ + 113,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_lithuanian_ci",/* name */ + "", /* comment */ + lithuanian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_slovak_uca_ci= +{ + 114,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_slovak_ci", /* name */ + "", /* comment */ + slovak, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_spanish2_uca_ci= +{ + 115,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_spanish2_ci",/* name */ + "", /* comment */ + spanish2, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_roman_uca_ci= +{ + 116,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_roman_ci", /* name */ + "", /* comment */ + roman, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_persian_uca_ci= +{ + 117,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_persian_ci", /* name */ + "", /* comment */ + persian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_esperanto_uca_ci= +{ + 118,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_esperanto_ci",/* name */ + "", /* comment */ + esperanto, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_hungarian_uca_ci= +{ + 119,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_hungarian_ci",/* name */ + "", /* comment */ + hungarian, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +CHARSET_INFO my_charset_utf16_sinhala_uca_ci= +{ + 120,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_sinhala_ci",/* name */ + "", /* comment */ + sinhala, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default,/* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 8, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 9, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_uca_handler +}; + +#endif /* HAVE_CHARSET_utf16 */ + + +#endif /* HAVE_UCA_COLLATIONS */ diff --git a/externals/mysql/strings/ctype-ucs2.c b/externals/mysql/strings/ctype-ucs2.c new file mode 100644 index 0000000..3f1495c --- /dev/null +++ b/externals/mysql/strings/ctype-ucs2.c @@ -0,0 +1,3592 @@ +/* Copyright (C) 2000 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* UCS2 support. Written by Alexander Barkov */ + +#include +#include +#include "m_string.h" +#include "m_ctype.h" +#include +#include + + +#ifndef EILSEQ +#define EILSEQ ENOENT +#endif + +#undef ULONGLONG_MAX +#define ULONGLONG_MAX ~0ULL +#define MAX_NEGATIVE_NUMBER 0x8000000000000000ULL +#define INIT_CNT 9 +#define LFACTOR 1000000000ULL +#define LFACTOR1 10000000000ULL +#define LFACTOR2 100000000000ULL + +static unsigned long lfactor[9]= +{ + 1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L, 100000000L +}; + + +#define REPLACEMENT_CHAR 0xFFFD; + + +#if defined(HAVE_CHARSET_utf16) || defined(HAVE_CHARSET_ucs2) +#define HAVE_CHARSET_mb2 +#endif + + +#if defined(HAVE_CHARSET_mb2) || defined(HAVE_CHARSET_utf32) +#define HAVE_CHARSET_mb2_or_mb4 +#endif + + +#ifdef HAVE_CHARSET_mb2_or_mb4 +static inline int +my_bincmp(const uchar *s, const uchar *se, + const uchar *t, const uchar *te) +{ + int slen= (int) (se - s), tlen= (int) (te - t); + int len= min(slen, tlen); + int cmp= memcmp(s, t, len); + return cmp ? cmp : slen - tlen; +} + + +static size_t +my_caseup_str_mb2_or_mb4(CHARSET_INFO * cs __attribute__((unused)), + char * s __attribute__((unused))) +{ + DBUG_ASSERT(0); + return 0; +} + + +static size_t +my_casedn_str_mb2_or_mb4(CHARSET_INFO *cs __attribute__((unused)), + char * s __attribute__((unused))) +{ + DBUG_ASSERT(0); + return 0; +} + + +static int +my_strcasecmp_mb2_or_mb4(CHARSET_INFO *cs __attribute__((unused)), + const char *s __attribute__((unused)), + const char *t __attribute__((unused))) +{ + DBUG_ASSERT(0); + return 0; +} + + +static long +my_strntol_mb2_or_mb4(CHARSET_INFO *cs, + const char *nptr, size_t l, int base, + char **endptr, int *err) +{ + int negative= 0; + int overflow; + int cnv; + my_wc_t wc; + register unsigned int cutlim; + register uint32 cutoff; + register uint32 res; + register const uchar *s= (const uchar*) nptr; + register const uchar *e= (const uchar*) nptr+l; + const uchar *save; + + *err= 0; + do + { + if ((cnv= cs->cset->mb_wc(cs, &wc, s, e))>0) + { + switch (wc) + { + case ' ' : break; + case '\t': break; + case '-' : negative= !negative; break; + case '+' : break; + default : goto bs; + } + } + else /* No more characters or bad multibyte sequence */ + { + if (endptr != NULL ) + *endptr= (char*) s; + err[0]= (cnv==MY_CS_ILSEQ) ? EILSEQ : EDOM; + return 0; + } + s+= cnv; + } while (1); + +bs: + +#ifdef NOT_USED + if (base <= 0 || base == 1 || base > 36) + base = 10; +#endif + + overflow= 0; + res= 0; + save= s; + cutoff= ((uint32)~0L) / (uint32) base; + cutlim= (uint) (((uint32)~0L) % (uint32) base); + + do { + if ((cnv= cs->cset->mb_wc(cs, &wc, s, e)) > 0) + { + s+= cnv; + if (wc >= '0' && wc <= '9') + wc-= '0'; + else if (wc >= 'A' && wc <= 'Z') + wc= wc - 'A' + 10; + else if (wc >= 'a' && wc <= 'z') + wc= wc - 'a' + 10; + else + break; + if ((int)wc >= base) + break; + if (res > cutoff || (res == cutoff && wc > cutlim)) + overflow= 1; + else + { + res*= (uint32) base; + res+= wc; + } + } + else if (cnv == MY_CS_ILSEQ) + { + if (endptr !=NULL ) + *endptr = (char*) s; + err[0]= EILSEQ; + return 0; + } + else + { + /* No more characters */ + break; + } + } while(1); + + if (endptr != NULL) + *endptr = (char *) s; + + if (s == save) + { + err[0]= EDOM; + return 0L; + } + + if (negative) + { + if (res > (uint32) INT_MIN32) + overflow= 1; + } + else if (res > INT_MAX32) + overflow= 1; + + if (overflow) + { + err[0]= ERANGE; + return negative ? INT_MIN32 : INT_MAX32; + } + + return (negative ? -((long) res) : (long) res); +} + + +static ulong +my_strntoul_mb2_or_mb4(CHARSET_INFO *cs, + const char *nptr, size_t l, int base, + char **endptr, int *err) +{ + int negative= 0; + int overflow; + int cnv; + my_wc_t wc; + register unsigned int cutlim; + register uint32 cutoff; + register uint32 res; + register const uchar *s= (const uchar*) nptr; + register const uchar *e= (const uchar*) nptr + l; + const uchar *save; + + *err= 0; + do + { + if ((cnv= cs->cset->mb_wc(cs, &wc, s, e)) > 0) + { + switch (wc) + { + case ' ' : break; + case '\t': break; + case '-' : negative= !negative; break; + case '+' : break; + default : goto bs; + } + } + else /* No more characters or bad multibyte sequence */ + { + if (endptr !=NULL ) + *endptr= (char*)s; + err[0]= (cnv == MY_CS_ILSEQ) ? EILSEQ : EDOM; + return 0; + } + s+= cnv; + } while (1); + +bs: + +#ifdef NOT_USED + if (base <= 0 || base == 1 || base > 36) + base = 10; +#endif + + overflow= 0; + res= 0; + save= s; + cutoff= ((uint32)~0L) / (uint32) base; + cutlim= (uint) (((uint32)~0L) % (uint32) base); + + do + { + if ((cnv= cs->cset->mb_wc(cs, &wc, s, e)) > 0) + { + s+= cnv; + if (wc >= '0' && wc <= '9') + wc-= '0'; + else if (wc >= 'A' && wc <= 'Z') + wc= wc - 'A' + 10; + else if (wc >= 'a' && wc <= 'z') + wc= wc - 'a' + 10; + else + break; + if ((int) wc >= base) + break; + if (res > cutoff || (res == cutoff && wc > cutlim)) + overflow = 1; + else + { + res*= (uint32) base; + res+= wc; + } + } + else if (cnv == MY_CS_ILSEQ) + { + if (endptr != NULL ) + *endptr= (char*)s; + err[0]= EILSEQ; + return 0; + } + else + { + /* No more characters */ + break; + } + } while(1); + + if (endptr != NULL) + *endptr= (char *) s; + + if (s == save) + { + err[0]= EDOM; + return 0L; + } + + if (overflow) + { + err[0]= (ERANGE); + return (~(uint32) 0); + } + + return (negative ? -((long) res) : (long) res); +} + + +static longlong +my_strntoll_mb2_or_mb4(CHARSET_INFO *cs, + const char *nptr, size_t l, int base, + char **endptr, int *err) +{ + int negative=0; + int overflow; + int cnv; + my_wc_t wc; + register ulonglong cutoff; + register unsigned int cutlim; + register ulonglong res; + register const uchar *s= (const uchar*) nptr; + register const uchar *e= (const uchar*) nptr+l; + const uchar *save; + + *err= 0; + do + { + if ((cnv=cs->cset->mb_wc(cs,&wc,s,e))>0) + { + switch (wc) + { + case ' ' : break; + case '\t': break; + case '-' : negative= !negative; break; + case '+' : break; + default : goto bs; + } + } + else /* No more characters or bad multibyte sequence */ + { + if (endptr !=NULL ) + *endptr = (char*)s; + err[0] = (cnv==MY_CS_ILSEQ) ? EILSEQ : EDOM; + return 0; + } + s+=cnv; + } while (1); + +bs: + +#ifdef NOT_USED + if (base <= 0 || base == 1 || base > 36) + base = 10; +#endif + + overflow = 0; + res = 0; + save = s; + cutoff = (~(ulonglong) 0) / (unsigned long int) base; + cutlim = (uint) ((~(ulonglong) 0) % (unsigned long int) base); + + do { + if ((cnv=cs->cset->mb_wc(cs,&wc,s,e))>0) + { + s+=cnv; + if ( wc>='0' && wc<='9') + wc -= '0'; + else if ( wc>='A' && wc<='Z') + wc = wc - 'A' + 10; + else if ( wc>='a' && wc<='z') + wc = wc - 'a' + 10; + else + break; + if ((int)wc >= base) + break; + if (res > cutoff || (res == cutoff && wc > cutlim)) + overflow = 1; + else + { + res *= (ulonglong) base; + res += wc; + } + } + else if (cnv==MY_CS_ILSEQ) + { + if (endptr !=NULL ) + *endptr = (char*)s; + err[0]=EILSEQ; + return 0; + } + else + { + /* No more characters */ + break; + } + } while(1); + + if (endptr != NULL) + *endptr = (char *) s; + + if (s == save) + { + err[0]=EDOM; + return 0L; + } + + if (negative) + { + if (res > (ulonglong) LONGLONG_MIN) + overflow = 1; + } + else if (res > (ulonglong) LONGLONG_MAX) + overflow = 1; + + if (overflow) + { + err[0]=ERANGE; + return negative ? LONGLONG_MIN : LONGLONG_MAX; + } + + return (negative ? -((longlong)res) : (longlong)res); +} + + +static ulonglong +my_strntoull_mb2_or_mb4(CHARSET_INFO *cs, + const char *nptr, size_t l, int base, + char **endptr, int *err) +{ + int negative= 0; + int overflow; + int cnv; + my_wc_t wc; + register ulonglong cutoff; + register unsigned int cutlim; + register ulonglong res; + register const uchar *s= (const uchar*) nptr; + register const uchar *e= (const uchar*) nptr + l; + const uchar *save; + + *err= 0; + do + { + if ((cnv= cs->cset->mb_wc(cs,&wc,s,e)) > 0) + { + switch (wc) + { + case ' ' : break; + case '\t': break; + case '-' : negative= !negative; break; + case '+' : break; + default : goto bs; + } + } + else /* No more characters or bad multibyte sequence */ + { + if (endptr !=NULL ) + *endptr = (char*)s; + err[0]= (cnv==MY_CS_ILSEQ) ? EILSEQ : EDOM; + return 0; + } + s+=cnv; + } while (1); + +bs: + +#ifdef NOT_USED + if (base <= 0 || base == 1 || base > 36) + base = 10; +#endif + + overflow = 0; + res = 0; + save = s; + cutoff = (~(ulonglong) 0) / (unsigned long int) base; + cutlim = (uint) ((~(ulonglong) 0) % (unsigned long int) base); + + do + { + if ((cnv=cs->cset->mb_wc(cs,&wc,s,e))>0) + { + s+=cnv; + if ( wc>='0' && wc<='9') + wc -= '0'; + else if ( wc>='A' && wc<='Z') + wc = wc - 'A' + 10; + else if ( wc>='a' && wc<='z') + wc = wc - 'a' + 10; + else + break; + if ((int)wc >= base) + break; + if (res > cutoff || (res == cutoff && wc > cutlim)) + overflow = 1; + else + { + res *= (ulonglong) base; + res += wc; + } + } + else if (cnv==MY_CS_ILSEQ) + { + if (endptr !=NULL ) + *endptr = (char*)s; + err[0]= EILSEQ; + return 0; + } + else + { + /* No more characters */ + break; + } + } while(1); + + if (endptr != NULL) + *endptr = (char *) s; + + if (s == save) + { + err[0]= EDOM; + return 0L; + } + + if (overflow) + { + err[0]= ERANGE; + return (~(ulonglong) 0); + } + + return (negative ? -((longlong) res) : (longlong) res); +} + + +static double +my_strntod_mb2_or_mb4(CHARSET_INFO *cs, + char *nptr, size_t length, + char **endptr, int *err) +{ + char buf[256]; + double res; + register char *b= buf; + register const uchar *s= (const uchar*) nptr; + const uchar *end; + my_wc_t wc; + int cnv; + + *err= 0; + /* Cut too long strings */ + if (length >= sizeof(buf)) + length= sizeof(buf) - 1; + end= s + length; + + while ((cnv= cs->cset->mb_wc(cs,&wc,s,end)) > 0) + { + s+= cnv; + if (wc > (int) (uchar) 'e' || !wc) + break; /* Can't be part of double */ + *b++= (char) wc; + } + + *endptr= b; + res= my_strtod(buf, endptr, err); + *endptr= nptr + cs->mbminlen * (size_t) (*endptr - buf); + return res; +} + + +static ulonglong +my_strntoull10rnd_mb2_or_mb4(CHARSET_INFO *cs, + const char *nptr, size_t length, + int unsign_fl, + char **endptr, int *err) +{ + char buf[256], *b= buf; + ulonglong res; + const uchar *end, *s= (const uchar*) nptr; + my_wc_t wc; + int cnv; + + /* Cut too long strings */ + if (length >= sizeof(buf)) + length= sizeof(buf)-1; + end= s + length; + + while ((cnv= cs->cset->mb_wc(cs,&wc,s,end)) > 0) + { + s+= cnv; + if (wc > (int) (uchar) 'e' || !wc) + break; /* Can't be a number part */ + *b++= (char) wc; + } + + res= my_strntoull10rnd_8bit(cs, buf, b - buf, unsign_fl, endptr, err); + *endptr= (char*) nptr + cs->mbminlen * (size_t) (*endptr - buf); + return res; +} + + +/* + This is a fast version optimized for the case of radix 10 / -10 +*/ + +static size_t +my_l10tostr_mb2_or_mb4(CHARSET_INFO *cs, + char *dst, size_t len, int radix, long int val) +{ + char buffer[66]; + register char *p, *db, *de; + long int new_val; + int sl= 0; + unsigned long int uval = (unsigned long int) val; + + p= &buffer[sizeof(buffer) - 1]; + *p= '\0'; + + if (radix < 0) + { + if (val < 0) + { + sl= 1; + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval = (unsigned long int)0 - uval; + } + } + + new_val = (long) (uval / 10); + *--p = '0'+ (char) (uval - (unsigned long) new_val * 10); + val= new_val; + + while (val != 0) + { + new_val= val / 10; + *--p= '0' + (char) (val - new_val * 10); + val= new_val; + } + + if (sl) + { + *--p= '-'; + } + + for ( db= dst, de= dst + len ; (dst < de) && *p ; p++) + { + int cnvres= cs->cset->wc_mb(cs,(my_wc_t)p[0],(uchar*) dst, (uchar*) de); + if (cnvres > 0) + dst+= cnvres; + else + break; + } + return (int) (dst - db); +} + + +static size_t +my_ll10tostr_mb2_or_mb4(CHARSET_INFO *cs, + char *dst, size_t len, int radix, longlong val) +{ + char buffer[65]; + register char *p, *db, *de; + long long_val; + int sl= 0; + ulonglong uval= (ulonglong) val; + + if (radix < 0) + { + if (val < 0) + { + sl= 1; + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval = (ulonglong)0 - uval; + } + } + + p= &buffer[sizeof(buffer)-1]; + *p='\0'; + + if (uval == 0) + { + *--p= '0'; + goto cnv; + } + + while (uval > (ulonglong) LONG_MAX) + { + ulonglong quo= uval/(uint) 10; + uint rem= (uint) (uval- quo* (uint) 10); + *--p= '0' + rem; + uval= quo; + } + + long_val= (long) uval; + while (long_val != 0) + { + long quo= long_val/10; + *--p= (char) ('0' + (long_val - quo*10)); + long_val= quo; + } + +cnv: + if (sl) + { + *--p= '-'; + } + + for ( db= dst, de= dst + len ; (dst < de) && *p ; p++) + { + int cnvres= cs->cset->wc_mb(cs, (my_wc_t) p[0], (uchar*) dst, (uchar*) de); + if (cnvres > 0) + dst+= cnvres; + else + break; + } + return (int) (dst -db); +} + +#endif + + +#ifdef HAVE_CHARSET_mb2 +static longlong +my_strtoll10_mb2(CHARSET_INFO *cs __attribute__((unused)), + const char *nptr, char **endptr, int *error) +{ + const char *s, *end, *start, *n_end, *true_end; + uchar c; + unsigned long i, j, k; + ulonglong li; + int negative; + ulong cutoff, cutoff2, cutoff3; + + s= nptr; + /* If fixed length string */ + if (endptr) + { + /* Make sure string length is even */ + end= s + ((*endptr - s) / 2) * 2; + while (s < end && !s[0] && (s[1] == ' ' || s[1] == '\t')) + s+= 2; + if (s == end) + goto no_conv; + } + else + { + /* We don't support null terminated strings in UCS2 */ + goto no_conv; + } + + /* Check for a sign. */ + negative= 0; + if (!s[0] && s[1] == '-') + { + *error= -1; /* Mark as negative number */ + negative= 1; + s+= 2; + if (s == end) + goto no_conv; + cutoff= MAX_NEGATIVE_NUMBER / LFACTOR2; + cutoff2= (MAX_NEGATIVE_NUMBER % LFACTOR2) / 100; + cutoff3= MAX_NEGATIVE_NUMBER % 100; + } + else + { + *error= 0; + if (!s[0] && s[1] == '+') + { + s+= 2; + if (s == end) + goto no_conv; + } + cutoff= ULONGLONG_MAX / LFACTOR2; + cutoff2= ULONGLONG_MAX % LFACTOR2 / 100; + cutoff3= ULONGLONG_MAX % 100; + } + + /* Handle case where we have a lot of pre-zero */ + if (!s[0] && s[1] == '0') + { + i= 0; + do + { + s+= 2; + if (s == end) + goto end_i; /* Return 0 */ + } + while (!s[0] && s[1] == '0'); + n_end= s + 2 * INIT_CNT; + } + else + { + /* Read first digit to check that it's a valid number */ + if (s[0] || (c= (s[1]-'0')) > 9) + goto no_conv; + i= c; + s+= 2; + n_end= s + 2 * (INIT_CNT-1); + } + + /* Handle first 9 digits and store them in i */ + if (n_end > end) + n_end= end; + for (; s != n_end ; s+= 2) + { + if (s[0] || (c= (s[1]-'0')) > 9) + goto end_i; + i= i*10+c; + } + if (s == end) + goto end_i; + + /* Handle next 9 digits and store them in j */ + j= 0; + start= s; /* Used to know how much to shift i */ + n_end= true_end= s + 2 * INIT_CNT; + if (n_end > end) + n_end= end; + do + { + if (s[0] || (c= (s[1]-'0')) > 9) + goto end_i_and_j; + j= j*10+c; + s+= 2; + } while (s != n_end); + if (s == end) + { + if (s != true_end) + goto end_i_and_j; + goto end3; + } + if (s[0] || (c= (s[1]-'0')) > 9) + goto end3; + + /* Handle the next 1 or 2 digits and store them in k */ + k=c; + s+= 2; + if (s == end || s[0] || (c= (s[1]-'0')) > 9) + goto end4; + k= k*10+c; + s+= 2; + *endptr= (char*) s; + + /* number string should have ended here */ + if (s != end && !s[0] && (c= (s[1]-'0')) <= 9) + goto overflow; + + /* Check that we didn't get an overflow with the last digit */ + if (i > cutoff || (i == cutoff && ((j > cutoff2 || j == cutoff2) && + k > cutoff3))) + goto overflow; + li=i*LFACTOR2+ (ulonglong) j*100 + k; + return (longlong) li; + +overflow: /* *endptr is set here */ + *error= MY_ERRNO_ERANGE; + return negative ? LONGLONG_MIN : (longlong) ULONGLONG_MAX; + +end_i: + *endptr= (char*) s; + return (negative ? ((longlong) -(long) i) : (longlong) i); + +end_i_and_j: + li= (ulonglong) i * lfactor[(size_t) (s-start) / 2] + j; + *endptr= (char*) s; + return (negative ? -((longlong) li) : (longlong) li); + +end3: + li=(ulonglong) i*LFACTOR+ (ulonglong) j; + *endptr= (char*) s; + return (negative ? -((longlong) li) : (longlong) li); + +end4: + li=(ulonglong) i*LFACTOR1+ (ulonglong) j * 10 + k; + *endptr= (char*) s; + if (negative) + { + if (li > MAX_NEGATIVE_NUMBER) + goto overflow; + return -((longlong) li); + } + return (longlong) li; + +no_conv: + /* There was no number to convert. */ + *error= MY_ERRNO_EDOM; + *endptr= (char *) nptr; + return 0; +} + + +static size_t +my_scan_mb2(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *end, int sequence_type) +{ + const char *str0= str; + end--; /* for easier loop condition, because of two bytes per character */ + + switch (sequence_type) + { + case MY_SEQ_SPACES: + for ( ; str < end; str+= 2) + { + if (str[0] != '\0' || str[1] != ' ') + break; + } + return (size_t) (str - str0); + default: + return 0; + } +} + + +static void +my_fill_mb2(CHARSET_INFO *cs __attribute__((unused)), + char *s, size_t l, int fill) +{ + for ( ; l >= 2; s[0]= 0, s[1]= fill, s+= 2, l-= 2); +} + + +static int +my_vsnprintf_mb2(char *dst, size_t n, const char* fmt, va_list ap) +{ + char *start=dst, *end= dst + n - 1; + for (; *fmt ; fmt++) + { + if (fmt[0] != '%') + { + if (dst == end) /* End of buffer */ + break; + + *dst++='\0'; + *dst++= *fmt; /* Copy ordinary char */ + continue; + } + + fmt++; + + /* Skip if max size is used (to be compatible with printf) */ + while ( (*fmt >= '0' && *fmt <= '9') || *fmt == '.' || *fmt == '-') + fmt++; + + if (*fmt == 'l') + fmt++; + + if (*fmt == 's') /* String parameter */ + { + char *par= va_arg(ap, char *); + size_t plen; + size_t left_len= (size_t)(end-dst); + if (!par) + par= (char*) "(null)"; + plen= strlen(par); + if (left_len <= plen * 2) + plen = left_len / 2 - 1; + + for ( ; plen ; plen--, dst+=2, par++) + { + dst[0]= '\0'; + dst[1]= par[0]; + } + continue; + } + else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ + { + int iarg; + char nbuf[16]; + char *pbuf= nbuf; + + if ((size_t) (end - dst) < 32) + break; + iarg= va_arg(ap, int); + if (*fmt == 'd') + int10_to_str((long) iarg, nbuf, -10); + else + int10_to_str((long) (uint) iarg, nbuf,10); + + for (; pbuf[0]; pbuf++) + { + *dst++= '\0'; + *dst++= *pbuf; + } + continue; + } + + /* We come here on '%%', unknown code or too long parameter */ + if (dst == end) + break; + *dst++= '\0'; + *dst++= '%'; /* % used as % or unknown code */ + } + + DBUG_ASSERT(dst <= end); + *dst='\0'; /* End of errmessage */ + return (size_t) (dst - start); +} + + +static size_t +my_snprintf_mb2(CHARSET_INFO *cs __attribute__((unused)), + char* to, size_t n, const char* fmt, ...) +{ + va_list args; + va_start(args,fmt); + return my_vsnprintf_mb2(to, n, fmt, args); +} + + +static size_t +my_lengthsp_mb2(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) +{ + const char *end= ptr + length; + while (end > ptr + 1 && end[-1] == ' ' && end[-2] == '\0') + end-= 2; + return (size_t) (end - ptr); +} + +#endif + + +#ifdef HAVE_CHARSET_utf16 + +/* + D800..DB7F - Non-provate surrogate high (896 pages) + DB80..DBFF - Private surrogate high (128 pages) + DC00..DFFF - Surrogate low (1024 codes in a page) +*/ + +#define MY_UTF16_HIGH_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xD8) +#define MY_UTF16_LOW_HEAD(x) ((((uchar) (x)) & 0xFC) == 0xDC) +#define MY_UTF16_SURROGATE(x) (((x) & 0xF800) == 0xD800) + +static int +my_utf16_uni(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e) +{ + if (s + 2 > e) + return MY_CS_TOOSMALL2; + + /* + High bytes: 0xD[89AB] = B'110110??' + Low bytes: 0xD[CDEF] = B'110111??' + Surrogate mask: 0xFC = B'11111100' + */ + + if (MY_UTF16_HIGH_HEAD(*s)) /* Surrogate head */ + { + if (s + 4 > e) + return MY_CS_TOOSMALL4; + + if (!MY_UTF16_LOW_HEAD(s[2])) /* Broken surrigate pair */ + return MY_CS_ILSEQ; + + /* + s[0]= 110110?? (<< 18) + s[1]= ???????? (<< 10) + s[2]= 110111?? (<< 8) + s[3]= ???????? (<< 0) + */ + + *pwc= ((s[0] & 3) << 18) + (s[1] << 10) + + ((s[2] & 3) << 8) + s[3] + 0x10000; + + return 4; + } + + if (MY_UTF16_LOW_HEAD(*s)) /* Low surrogate part without high part */ + return MY_CS_ILSEQ; + + *pwc= (s[0] << 8) + s[1]; + return 2; +} + + +static int +my_uni_utf16(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + if (wc <= 0xFFFF) + { + if (s + 2 > e) + return MY_CS_TOOSMALL2; + if (MY_UTF16_SURROGATE(wc)) + return MY_CS_ILUNI; + *s++= (uchar) (wc >> 8); + *s= (uchar) (wc & 0xFF); + return 2; + } + + if (wc <= 0x10FFFF) + { + if (s + 4 > e) + return MY_CS_TOOSMALL4; + *s++= (uchar) ((wc-= 0x10000) >> 18) | 0xD8; + *s++= (uchar) (wc >> 10) & 0xFF; + *s++= (uchar) ((wc >> 8) & 3) | 0xDC; + *s= (uchar) wc & 0xFF; + return 4; + } + + return MY_CS_ILUNI; +} + + +static inline void +my_tolower_utf16(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256 && uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].tolower; +} + + +static inline void +my_toupper_utf16(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256 && uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].toupper; +} + + +static inline void +my_tosort_utf16(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256) + { + if (uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].sort; + } + else + { + *wc= REPLACEMENT_CHAR; + } +} + + +static size_t +my_caseup_utf16(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + my_wc_t wc; + int res; + char *srcend= src + srclen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src == dst && srclen == dstlen); + + while ((src < srcend) && + (res= my_utf16_uni(cs, &wc, (uchar *)src, (uchar*) srcend)) > 0) + { + my_toupper_utf16(uni_plane, &wc); + if (res != my_uni_utf16(cs, wc, (uchar*) src, (uchar*) srcend)) + break; + src+= res; + } + return srclen; +} + + +static void +my_hash_sort_utf16(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + my_wc_t wc; + int res; + const uchar *e= s+slen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + + while (e > s + 1 && e[-1] == ' ' && e[-2] == '\0') + e-= 2; + + while ((s < e) && (res= my_utf16_uni(cs, &wc, (uchar *)s, (uchar*)e)) > 0) + { + my_tosort_utf16(uni_plane, &wc); + n1[0]^= (((n1[0] & 63) + n2[0]) * (wc & 0xFF)) + (n1[0] << 8); + n2[0]+= 3; + n1[0]^= (((n1[0] & 63) + n2[0]) * (wc >> 8)) + (n1[0] << 8); + n2[0]+= 3; + s+= res; + } +} + + +static size_t +my_casedn_utf16(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + my_wc_t wc; + int res; + char *srcend= src + srclen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src == dst && srclen == dstlen); + + while ((src < srcend) && + (res= my_utf16_uni(cs, &wc, (uchar*) src, (uchar*) srcend)) > 0) + { + my_tolower_utf16(uni_plane, &wc); + if (res != my_uni_utf16(cs, wc, (uchar*) src, (uchar*) srcend)) + break; + src+= res; + } + return srclen; +} + + +static int +my_strnncoll_utf16(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + int s_res, t_res; + my_wc_t s_wc,t_wc; + const uchar *se= s + slen; + const uchar *te= t + tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + while (s < se && t < te) + { + s_res= my_utf16_uni(cs, &s_wc, s, se); + t_res= my_utf16_uni(cs, &t_wc, t, te); + + if (s_res <= 0 || t_res <= 0) + { + /* Incorrect string, compare by char value */ + return my_bincmp(s, se, t, te); + } + + my_tosort_utf16(uni_plane, &s_wc); + my_tosort_utf16(uni_plane, &t_wc); + + if (s_wc != t_wc) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); +} + + +/** + Compare strings, discarding end space + + If one string is shorter as the other, then we space extend the other + so that the strings have equal length. + + This will ensure that the following things hold: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + @param cs Character set pinter. + @param a First string to compare. + @param a_length Length of 'a'. + @param b Second string to compare. + @param b_length Length of 'b'. + + IMPLEMENTATION + + @return Comparison result. + @retval Negative number, if a less than b. + @retval 0, if a is equal to b + @retval Positive number, if a > b +*/ + +static int +my_strnncollsp_utf16(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + int res; + my_wc_t s_wc, t_wc; + const uchar *se= s + slen, *te= t + tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + DBUG_ASSERT((slen % 2) == 0); + DBUG_ASSERT((tlen % 2) == 0); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= FALSE; +#endif + + while (s < se && t < te) + { + int s_res= my_utf16_uni(cs, &s_wc, s, se); + int t_res= my_utf16_uni(cs, &t_wc, t, te); + + if (s_res <= 0 || t_res <= 0) + { + /* Incorrect string, compare bytewise */ + return my_bincmp(s, se, t, te); + } + + my_tosort_utf16(uni_plane, &s_wc); + my_tosort_utf16(uni_plane, &t_wc); + + if (s_wc != t_wc) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + + slen= (size_t) (se - s); + tlen= (size_t) (te - t); + res= 0; + + if (slen != tlen) + { + int s_res, swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 's' is bigger */ + if (slen < tlen) + { + slen= tlen; + s= t; + se= te; + swap= -1; + res= -res; + } + + for ( ; s < se; s+= s_res) + { + if ((s_res= my_utf16_uni(cs, &s_wc, s, se)) < 0) + { + DBUG_ASSERT(0); + return 0; + } + if (s_wc != ' ') + return (s_wc < ' ') ? -swap : swap; + } + } + return res; +} + + +static uint +my_ismbchar_utf16(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused))) +{ + if (b + 2 > e) + return 0; + + if (MY_UTF16_HIGH_HEAD(*b)) + { + return (b + 4 <= e) && MY_UTF16_LOW_HEAD(b[2]) ? 4 : 0; + } + + if (MY_UTF16_LOW_HEAD(*b)) + return 0; + + return 2; +} + + +static uint +my_mbcharlen_utf16(CHARSET_INFO *cs __attribute__((unused)), + uint c __attribute__((unused))) +{ + return MY_UTF16_HIGH_HEAD(c) ? 4 : 2; +} + + +static size_t +my_numchars_utf16(CHARSET_INFO *cs, + const char *b, const char *e) +{ + size_t nchars= 0; + for ( ; ; nchars++) + { + size_t charlen= my_ismbchar_utf16(cs, b, e); + if (!charlen) + break; + b+= charlen; + } + return nchars; +} + + +static size_t +my_charpos_utf16(CHARSET_INFO *cs, + const char *b, const char *e, size_t pos) +{ + const char *b0= b; + uint charlen; + + for ( ; pos; b+= charlen, pos--) + { + if (!(charlen= my_ismbchar(cs, b, e))) + return (e + 2 - b0); /* Error, return pos outside the string */ + } + return (size_t) (pos ? (e + 2 - b0) : (b - b0)); +} + + +static size_t +my_well_formed_len_utf16(CHARSET_INFO *cs, + const char *b, const char *e, + size_t nchars, int *error) +{ + const char *b0= b; + uint charlen; + *error= 0; + + for ( ; nchars; b+= charlen, nchars--) + { + if (!(charlen= my_ismbchar(cs, b, e))) + { + *error= b < e ? 1 : 0; + break; + } + } + return (size_t) (b - b0); +} + + +static int +my_wildcmp_utf16_ci(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + return my_wildcmp_unicode(cs, str, str_end, wildstr, wildend, + escape, w_one, w_many, uni_plane); +} + + +static int +my_wildcmp_utf16_bin(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + return my_wildcmp_unicode(cs, str, str_end, wildstr, wildend, + escape, w_one, w_many, NULL); +} + + +static int +my_strnncoll_utf16_bin(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + int s_res,t_res; + my_wc_t s_wc,t_wc; + const uchar *se=s+slen; + const uchar *te=t+tlen; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + while ( s < se && t < te ) + { + s_res= my_utf16_uni(cs,&s_wc, s, se); + t_res= my_utf16_uni(cs,&t_wc, t, te); + + if (s_res <= 0 || t_res <= 0) + { + /* Incorrect string, compare by char value */ + return my_bincmp(s, se, t, te); + } + if (s_wc != t_wc) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); +} + + +static int +my_strnncollsp_utf16_bin(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + int res; + my_wc_t s_wc, t_wc; + const uchar *se= s + slen, *te= t + tlen; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + DBUG_ASSERT((slen % 2) == 0); + DBUG_ASSERT((tlen % 2) == 0); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= FALSE; +#endif + + while (s < se && t < te) + { + int s_res= my_utf16_uni(cs, &s_wc, s, se); + int t_res= my_utf16_uni(cs, &t_wc, t, te); + + if (s_res <= 0 || t_res <= 0) + { + /* Incorrect string, compare bytewise */ + return my_bincmp(s, se, t, te); + } + + if (s_wc != t_wc) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + + slen= (size_t) (se - s); + tlen= (size_t) (te - t); + res= 0; + + if (slen != tlen) + { + int s_res, swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 's' is bigger */ + if (slen < tlen) + { + slen= tlen; + s= t; + se= te; + swap= -1; + res= -res; + } + + for ( ; s < se; s+= s_res) + { + if ((s_res= my_utf16_uni(cs, &s_wc, s, se)) < 0) + { + DBUG_ASSERT(0); + return 0; + } + if (s_wc != ' ') + return (s_wc < ' ') ? -swap : swap; + } + } + return res; +} + + +static void +my_hash_sort_utf16_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2) +{ + const uchar *pos = key; + + key+= len; + + while (key > pos + 1 && key[-1] == ' ' && key[-2] == '\0') + key-= 2; + + for (; pos < (uchar*) key ; pos++) + { + nr1[0]^= (ulong) ((((uint) nr1[0] & 63) + nr2[0]) * + ((uint)*pos)) + (nr1[0] << 8); + nr2[0]+= 3; + } +} + + +/** + Calculate min_str and max_str that ranges a LIKE string. + + @param ptr Pointer to LIKE pattern. + @param ptr_length Length of LIKE pattern. + @param escape Escape character in LIKE. (Normally '\'). + All escape characters should be removed + from min_str and max_str. + @param res_length Length of min_str and max_str. + @param min_str Smallest case sensitive string that ranges LIKE. + Should be space padded to res_length. + @param max_str Largest case sensitive string that ranges LIKE. + Normally padded with the biggest character sort value. + + @return Optimization status. + @retval FALSE if LIKE pattern can be optimized + @rerval TRUE if LIKE can't be optimized. +*/ + +my_bool +my_like_range_utf16(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) +{ + const char *end=ptr+ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + size_t charlen= res_length / cs->mbmaxlen; + + for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0 + ; ptr+=2, charlen--) + { + if (ptr[0] == '\0' && ptr[1] == escape && ptr + 1 < end) + { + ptr+=2; /* Skip escape */ + *min_str++= *max_str++ = ptr[0]; + *min_str++= *max_str++ = ptr[1]; + continue; + } + if (ptr[0] == '\0' && ptr[1] == w_one) /* '_' in SQL */ + { + *min_str++= (char) (cs->min_sort_char >> 8); + *min_str++= (char) (cs->min_sort_char & 255); + *max_str++= (char) (cs->max_sort_char >> 8); + *max_str++= (char) (cs->max_sort_char & 255); + continue; + } + if (ptr[0] == '\0' && ptr[1] == w_many) /* '%' in SQL */ + { + /* + Calculate length of keys: + 'a\0\0... is the smallest possible string when we have space expand + a\ff\ff... is the biggest possible string + */ + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + do { + *min_str++ = 0; + *min_str++ = 0; + *max_str++ = (char) (cs->max_sort_char >> 8); + *max_str++ = (char) (cs->max_sort_char & 255); + } while (min_str + 1 < min_end); + return FALSE; + } + *min_str++= *max_str++ = ptr[0]; + *min_str++= *max_str++ = ptr[1]; + } + + /* Temporary fix for handling w_one at end of string (key compression) */ + { + char *tmp; + for (tmp= min_str ; tmp-1 > min_org && tmp[-1] == '\0' && tmp[-2]=='\0';) + { + *--tmp=' '; + *--tmp='\0'; + } + } + + *min_length= *max_length = (size_t) (min_str - min_org); + while (min_str + 1 < min_end) + { + *min_str++ = *max_str++ = '\0'; + *min_str++ = *max_str++ = ' '; /* Because if key compression */ + } + return FALSE; +} + + +static MY_COLLATION_HANDLER my_collation_utf16_general_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf16, + my_strnncollsp_utf16, + my_strnxfrm_unicode, + my_strnxfrmlen_simple, + my_like_range_utf16, + my_wildcmp_utf16_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_utf16_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf16_bin, + my_strnncollsp_utf16_bin, + my_strnxfrm_unicode, + my_strnxfrmlen_simple, + my_like_range_utf16, + my_wildcmp_utf16_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf16_bin, + my_propagate_simple +}; + + +MY_CHARSET_HANDLER my_charset_utf16_handler= +{ + NULL, /* init */ + my_ismbchar_utf16, /* ismbchar */ + my_mbcharlen_utf16, /* mbcharlen */ + my_numchars_utf16, + my_charpos_utf16, + my_well_formed_len_utf16, + my_lengthsp_mb2, + my_numcells_mb, + my_utf16_uni, /* mb_wc */ + my_uni_utf16, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_mb2_or_mb4, + my_casedn_str_mb2_or_mb4, + my_caseup_utf16, + my_casedn_utf16, + my_snprintf_mb2, + my_l10tostr_mb2_or_mb4, + my_ll10tostr_mb2_or_mb4, + my_fill_mb2, + my_strntol_mb2_or_mb4, + my_strntoul_mb2_or_mb4, + my_strntoll_mb2_or_mb4, + my_strntoull_mb2_or_mb4, + my_strntod_mb2_or_mb4, + my_strtoll10_mb2, + my_strntoull10rnd_mb2_or_mb4, + my_scan_mb2 +}; + + +CHARSET_INFO my_charset_utf16_general_ci= +{ + 54,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_general_ci", /* name */ + "UTF-16 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_general_ci_handler +}; + + +CHARSET_INFO my_charset_utf16_bin= +{ + 55,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE|MY_CS_NONASCII, + "utf16", /* cs name */ + "utf16_bin", /* name */ + "UTF-16 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf16_handler, + &my_collation_utf16_bin_handler +}; + +#endif /* HAVE_CHARSET_utf16 */ + + +#ifdef HAVE_CHARSET_utf32 + +static int +my_utf32_uni(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e) +{ + if (s + 4 > e) + return MY_CS_TOOSMALL4; + *pwc= (s[0] << 24) + (s[1] << 16) + (s[2] << 8) + (s[3]); + return 4; +} + + +static int +my_uni_utf32(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + if (s + 4 > e) + return MY_CS_TOOSMALL4; + + s[0]= (uchar) (wc >> 24); + s[1]= (uchar) (wc >> 16) & 0xFF; + s[2]= (uchar) (wc >> 8) & 0xFF; + s[3]= (uchar) wc & 0xFF; + return 4; +} + + +static inline void +my_tolower_utf32(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256 && uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].tolower; +} + + +static inline void +my_toupper_utf32(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256 && uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].toupper; +} + + +static inline void +my_tosort_utf32(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256) + { + if (uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].sort; + } + else + { + *wc= REPLACEMENT_CHAR; + } +} + + +static size_t +my_caseup_utf32(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + my_wc_t wc; + int res; + char *srcend= src + srclen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src == dst && srclen == dstlen); + + while ((src < srcend) && + (res= my_utf32_uni(cs, &wc, (uchar *)src, (uchar*) srcend)) > 0) + { + my_toupper_utf32(uni_plane, &wc); + if (res != my_uni_utf32(cs, wc, (uchar*) src, (uchar*) srcend)) + break; + src+= res; + } + return srclen; +} + + +static inline void +my_hash_add(ulong *n1, ulong *n2, uint ch) +{ + n1[0]^= (((n1[0] & 63) + n2[0]) * (ch)) + (n1[0] << 8); + n2[0]+= 3; +} + + +static void +my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + my_wc_t wc; + int res; + const uchar *e= s + slen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + + /* Skip trailing spaces */ + while (e > s + 3 && e[-1] == ' ' && !e[-2] && !e[-3] && !e[-4]) + e-= 4; + + while ((res= my_utf32_uni(cs, &wc, (uchar*) s, (uchar*) e)) > 0) + { + my_tosort_utf32(uni_plane, &wc); + my_hash_add(n1, n2, (uint) (wc >> 24)); + my_hash_add(n1, n2, (uint) (wc >> 16) & 0xFF); + my_hash_add(n1, n2, (uint) (wc >> 8) & 0xFF); + my_hash_add(n1, n2, (uint) (wc & 0xFF)); + s+= res; + } +} + + +static size_t +my_casedn_utf32(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + my_wc_t wc; + int res; + char *srcend= src + srclen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src == dst && srclen == dstlen); + + while ((res= my_utf32_uni(cs, &wc, (uchar*) src, (uchar*) srcend)) > 0) + { + my_tolower_utf32(uni_plane,&wc); + if (res != my_uni_utf32(cs, wc, (uchar*) src, (uchar*) srcend)) + break; + src+= res; + } + return srclen; +} + + +static int +my_strnncoll_utf32(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + my_wc_t s_wc,t_wc; + const uchar *se= s + slen; + const uchar *te= t + tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + while (s < se && t < te) + { + int s_res= my_utf32_uni(cs, &s_wc, s, se); + int t_res= my_utf32_uni(cs, &t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0) + { + /* Incorrect string, compare by char value */ + return my_bincmp(s, se, t, te); + } + + my_tosort_utf32(uni_plane, &s_wc); + my_tosort_utf32(uni_plane, &t_wc); + + if (s_wc != t_wc) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); +} + + +/** + Compare strings, discarding end space + + If one string is shorter as the other, then we space extend the other + so that the strings have equal length. + + This will ensure that the following things hold: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + @param cs Character set pinter. + @param a First string to compare. + @param a_length Length of 'a'. + @param b Second string to compare. + @param b_length Length of 'b'. + + IMPLEMENTATION + + @return Comparison result. + @retval Negative number, if a less than b. + @retval 0, if a is equal to b + @retval Positive number, if a > b +*/ + + +static int +my_strnncollsp_utf32(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + int res; + my_wc_t s_wc, t_wc; + const uchar *se= s + slen, *te= t + tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + DBUG_ASSERT((slen % 4) == 0); + DBUG_ASSERT((tlen % 4) == 0); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= FALSE; +#endif + + while ( s < se && t < te ) + { + int s_res= my_utf32_uni(cs, &s_wc, s, se); + int t_res= my_utf32_uni(cs, &t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare bytewise */ + return my_bincmp(s, se, t, te); + } + + my_tosort_utf32(uni_plane, &s_wc); + my_tosort_utf32(uni_plane, &t_wc); + + if ( s_wc != t_wc ) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + + slen= (size_t) (se - s); + tlen= (size_t) (te - t); + res= 0; + + if (slen != tlen) + { + int s_res, swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 's' is bigger */ + if (slen < tlen) + { + slen= tlen; + s= t; + se= te; + swap= -1; + res= -res; + } + + for ( ; s < se; s+= s_res) + { + if ((s_res= my_utf32_uni(cs, &s_wc, s, se)) < 0) + { + DBUG_ASSERT(0); + return 0; + } + if (s_wc != ' ') + return (s_wc < ' ') ? -swap : swap; + } + } + return res; +} + + +static size_t +my_strnxfrmlen_utf32(CHARSET_INFO *cs __attribute__((unused)), size_t len) +{ + return len / 2; +} + + +static void +my_fill_utf32_for_strxfrm(CHARSET_INFO *cs __attribute__((unused)), + char *s, size_t slen, int fill) +{ + DBUG_ASSERT(fill <= 0xFFFF); + + for ( ; slen > 1; slen-= 2) + { + *s++= fill >> 8; + *s++= fill & 0xFF; + } + if (slen) + *s= 0x00; +} + + +size_t +my_strxfrm_pad_desc_and_reverse_utf32(CHARSET_INFO *cs, + uchar *str, uchar *frmend, uchar *strend, + uint nweights, uint flags, uint level) +{ + if (nweights && frmend < strend && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + uint fill_length= min((uint) (strend - frmend), nweights * 2); + my_fill_utf32_for_strxfrm(cs, (char*) frmend, fill_length, cs->pad_char); + frmend+= fill_length; + } + my_strxfrm_desc_and_reverse(str, frmend, flags, level); + return frmend - str; +} + + +static uint +my_ismbchar_utf32(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused))) +{ + return 4; +} + + +static uint +my_mbcharlen_utf32(CHARSET_INFO *cs __attribute__((unused)) , + uint c __attribute__((unused))) +{ + return 4; +} + + +static int +my_vsnprintf_utf32(char *dst, size_t n, const char* fmt, va_list ap) +{ + char *start= dst, *end= dst + n; + DBUG_ASSERT((n % 4) == 0); + for (; *fmt ; fmt++) + { + if (fmt[0] != '%') + { + if (dst >= end) /* End of buffer */ + break; + + *dst++= '\0'; + *dst++= '\0'; + *dst++= '\0'; + *dst++= *fmt; /* Copy ordinary char */ + continue; + } + + fmt++; + + /* Skip if max size is used (to be compatible with printf) */ + while ( (*fmt>='0' && *fmt<='9') || *fmt == '.' || *fmt == '-') + fmt++; + + if (*fmt == 'l') + fmt++; + + if (*fmt == 's') /* String parameter */ + { + reg2 char *par= va_arg(ap, char *); + size_t plen; + size_t left_len= (size_t)(end - dst); + if (!par) par= (char*)"(null)"; + plen= strlen(par); + if (left_len <= plen*4) + plen= left_len / 4 - 1; + + for ( ; plen ; plen--, dst+= 4, par++) + { + dst[0]= '\0'; + dst[1]= '\0'; + dst[2]= '\0'; + dst[3]= par[0]; + } + continue; + } + else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */ + { + register int iarg; + char nbuf[16]; + char *pbuf= nbuf; + + if ((size_t) (end - dst) < 64) + break; + iarg= va_arg(ap, int); + if (*fmt == 'd') + int10_to_str((long) iarg, nbuf, -10); + else + int10_to_str((long) (uint) iarg,nbuf,10); + + for (; pbuf[0]; pbuf++) + { + *dst++= '\0'; + *dst++= '\0'; + *dst++= '\0'; + *dst++= *pbuf; + } + continue; + } + + /* We come here on '%%', unknown code or too long parameter */ + if (dst == end) + break; + *dst++= '\0'; + *dst++= '\0'; + *dst++= '\0'; + *dst++= '%'; /* % used as % or unknown code */ + } + + DBUG_ASSERT(dst < end); + *dst++= '\0'; + *dst++= '\0'; + *dst++= '\0'; + *dst++= '\0'; /* End of errmessage */ + return (size_t) (dst - start - 4); +} + + +static size_t +my_snprintf_utf32(CHARSET_INFO *cs __attribute__((unused)), + char* to, size_t n, const char* fmt, ...) +{ + va_list args; + va_start(args,fmt); + return my_vsnprintf_utf32(to, n, fmt, args); +} + + +static longlong +my_strtoll10_utf32(CHARSET_INFO *cs __attribute__((unused)), + const char *nptr, char **endptr, int *error) +{ + const char *s, *end, *start, *n_end, *true_end; + uchar c; + unsigned long i, j, k; + ulonglong li; + int negative; + ulong cutoff, cutoff2, cutoff3; + + s= nptr; + /* If fixed length string */ + if (endptr) + { + /* Make sure string length is even */ + end= s + ((*endptr - s) / 4) * 4; + while (s < end && !s[0] && !s[1] && !s[2] && + (s[3] == ' ' || s[3] == '\t')) + s+= 4; + if (s == end) + goto no_conv; + } + else + { + /* We don't support null terminated strings in UCS2 */ + goto no_conv; + } + + /* Check for a sign. */ + negative= 0; + if (!s[0] && !s[1] && !s[2] && s[3] == '-') + { + *error= -1; /* Mark as negative number */ + negative= 1; + s+= 4; + if (s == end) + goto no_conv; + cutoff= MAX_NEGATIVE_NUMBER / LFACTOR2; + cutoff2= (MAX_NEGATIVE_NUMBER % LFACTOR2) / 100; + cutoff3= MAX_NEGATIVE_NUMBER % 100; + } + else + { + *error= 0; + if (!s[0] && !s[1] && !s[2] && s[3] == '+') + { + s+= 4; + if (s == end) + goto no_conv; + } + cutoff= ULONGLONG_MAX / LFACTOR2; + cutoff2= ULONGLONG_MAX % LFACTOR2 / 100; + cutoff3= ULONGLONG_MAX % 100; + } + + /* Handle case where we have a lot of pre-zero */ + if (!s[0] && !s[1] && !s[2] && s[3] == '0') + { + i= 0; + do + { + s+= 4; + if (s == end) + goto end_i; /* Return 0 */ + } + while (!s[0] && !s[1] && !s[2] && s[3] == '0'); + n_end= s + 4 * INIT_CNT; + } + else + { + /* Read first digit to check that it's a valid number */ + if (s[0] || s[1] || s[2] || (c= (s[3]-'0')) > 9) + goto no_conv; + i= c; + s+= 4; + n_end= s + 4 * (INIT_CNT-1); + } + + /* Handle first 9 digits and store them in i */ + if (n_end > end) + n_end= end; + for (; s != n_end ; s+= 4) + { + if (s[0] || s[1] || s[2] || (c= (s[3] - '0')) > 9) + goto end_i; + i= i * 10 + c; + } + if (s == end) + goto end_i; + + /* Handle next 9 digits and store them in j */ + j= 0; + start= s; /* Used to know how much to shift i */ + n_end= true_end= s + 4 * INIT_CNT; + if (n_end > end) + n_end= end; + do + { + if (s[0] || s[1] || s[2] || (c= (s[3] - '0')) > 9) + goto end_i_and_j; + j= j * 10 + c; + s+= 4; + } while (s != n_end); + if (s == end) + { + if (s != true_end) + goto end_i_and_j; + goto end3; + } + if (s[0] || s[1] || s[2] || (c= (s[3] - '0')) > 9) + goto end3; + + /* Handle the next 1 or 2 digits and store them in k */ + k=c; + s+= 4; + if (s == end || s[0] || s[1] || s[2] || (c= (s[3]-'0')) > 9) + goto end4; + k= k * 10 + c; + s+= 2; + *endptr= (char*) s; + + /* number string should have ended here */ + if (s != end && !s[0] && !s[1] && !s[2] && (c= (s[3] - '0')) <= 9) + goto overflow; + + /* Check that we didn't get an overflow with the last digit */ + if (i > cutoff || (i == cutoff && ((j > cutoff2 || j == cutoff2) && + k > cutoff3))) + goto overflow; + li= i * LFACTOR2+ (ulonglong) j * 100 + k; + return (longlong) li; + +overflow: /* *endptr is set here */ + *error= MY_ERRNO_ERANGE; + return negative ? LONGLONG_MIN : (longlong) ULONGLONG_MAX; + +end_i: + *endptr= (char*) s; + return (negative ? ((longlong) -(long) i) : (longlong) i); + +end_i_and_j: + li= (ulonglong) i * lfactor[(size_t) (s-start) / 4] + j; + *endptr= (char*) s; + return (negative ? -((longlong) li) : (longlong) li); + +end3: + li= (ulonglong) i*LFACTOR+ (ulonglong) j; + *endptr= (char*) s; + return (negative ? -((longlong) li) : (longlong) li); + +end4: + li= (ulonglong) i*LFACTOR1+ (ulonglong) j * 10 + k; + *endptr= (char*) s; + if (negative) + { + if (li > MAX_NEGATIVE_NUMBER) + goto overflow; + return -((longlong) li); + } + return (longlong) li; + +no_conv: + /* There was no number to convert. */ + *error= MY_ERRNO_EDOM; + *endptr= (char *) nptr; + return 0; +} + + +static size_t +my_numchars_utf32(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) +{ + return (size_t) (e - b) / 4; +} + + +static size_t +my_charpos_utf32(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, size_t pos) +{ + size_t string_length= (size_t) (e - b); + return pos * 4 > string_length ? string_length + 4 : pos * 4; +} + + +static size_t +my_well_formed_len_utf32(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t nchars, int *error) +{ + /* Ensure string length is divisible by 4 */ + const char *b0= b; + size_t length= e - b; + DBUG_ASSERT((length % 4) == 0); + *error= 0; + nchars*= 4; + if (length > nchars) + { + length= nchars; + e= b + nchars; + } + for (; b < e; b+= 4) + { + /* Don't accept characters greater than U+10FFFF */ + if (b[0] || (uchar) b[1] > 0x10) + { + *error= 1; + return b - b0; + } + } + return length; +} + + +static +void my_fill_utf32(CHARSET_INFO *cs, + char *s, size_t slen, int fill) +{ + char buf[10]; + uint buflen; + char *e= s + slen; + + DBUG_ASSERT((slen % 4) == 0); + + buflen= cs->cset->wc_mb(cs, (my_wc_t) fill, (uchar*) buf, + (uchar*) buf + sizeof(buf)); + DBUG_ASSERT(buflen == 4); + while (s < e) + { + memcpy(s, buf, 4); + s+= 4; + } +} + + +static size_t +my_lengthsp_utf32(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t length) +{ + const char *end= ptr + length; + DBUG_ASSERT((length % 4) == 0); + while (end > ptr + 3 && end[-1] == ' ' && !end[-2] && !end[-3] && !end[-4]) + end-= 4; + return (size_t) (end - ptr); +} + + +static int +my_wildcmp_utf32_ci(CHARSET_INFO *cs, + const char *str, const char *str_end, + const char *wildstr, const char *wildend, + int escape, int w_one, int w_many) +{ + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + return my_wildcmp_unicode(cs, str, str_end, wildstr, wildend, + escape, w_one, w_many, uni_plane); +} + + +static int +my_wildcmp_utf32_bin(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + return my_wildcmp_unicode(cs, str, str_end, wildstr, wildend, + escape, w_one, w_many, NULL); +} + + +static int +my_strnncoll_utf32_bin(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + my_wc_t s_wc, t_wc; + const uchar *se= s + slen; + const uchar *te= t + tlen; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + while (s < se && t < te) + { + int s_res= my_utf32_uni(cs, &s_wc, s, se); + int t_res= my_utf32_uni(cs, &t_wc, t, te); + + if (s_res <= 0 || t_res <= 0) + { + /* Incorrect string, compare by char value */ + return my_bincmp(s, se, t, te); + } + if (s_wc != t_wc) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + return (int) (t_is_prefix ? (t-te) : ((se - s) - (te - t))); +} + + +static inline my_wc_t +my_utf32_get(const uchar *s) +{ + return + ((my_wc_t) s[0] << 24) + + ((my_wc_t) s[1] << 16) + + ((my_wc_t) s[2] << 8) + + s[3]; +} + + +static int +my_strnncollsp_utf32_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) +{ + const uchar *se, *te; + size_t minlen; + + DBUG_ASSERT((slen % 4) == 0); + DBUG_ASSERT((tlen % 4) == 0); + + se= s + slen; + te= t + tlen; + + for (minlen= min(slen, tlen); minlen; minlen-= 4) + { + my_wc_t s_wc= my_utf32_get(s); + my_wc_t t_wc= my_utf32_get(t); + if (s_wc != t_wc) + return s_wc > t_wc ? 1 : -1; + + s+= 4; + t+= 4; + } + + if (slen != tlen) + { + int swap= 1; + if (slen < tlen) + { + s= t; + se= te; + swap= -1; + } + + for ( ; s < se ; s+= 4) + { + my_wc_t s_wc= my_utf32_get(s); + if (s_wc != ' ') + return (s_wc < ' ') ? -swap : swap; + } + } + return 0; +} + + +/** + Calculate min_str and max_str that ranges a LIKE string. + + @param ptr Pointer to LIKE pattern. + @param ptr_length Length of LIKE pattern. + @param escape Escape character in LIKE. (Normally '\'). + All escape characters should be removed + from min_str and max_str. + @param res_length Length of min_str and max_str. + @param min_str Smallest case sensitive string that ranges LIKE. + Should be space padded to res_length. + @param max_str Largest case sensitive string that ranges LIKE. + Normally padded with the biggest character sort value. + + @return Optimization status. + @retval FALSE if LIKE pattern can be optimized + @rerval TRUE if LIKE can't be optimized. +*/ + +my_bool +my_like_range_utf32(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) +{ + const char *end= ptr + ptr_length; + char *min_org= min_str; + char *min_end= min_str + res_length; + char *max_end= max_str + res_length; + size_t charlen= res_length / cs->mbmaxlen; + + DBUG_ASSERT((res_length % 4) == 0); + + for ( ; charlen > 0; ptr+= 4, charlen--) + { + my_wc_t wc; + int res; + if ((res= my_utf32_uni(cs, &wc, ptr, end)) < 0) + { + my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char); + my_fill_utf32(cs, max_str, min_end - min_str, cs->max_sort_char); + /* min_length and max_legnth are not important */ + return TRUE; + } + + if (wc == (my_wc_t) escape) + { + ptr+= 4; /* Skip escape */ + if ((res= my_utf32_uni(cs, &wc, ptr, end)) < 0) + { + my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char); + my_fill_utf32(cs, max_str, max_end - min_str, cs->max_sort_char); + /* min_length and max_length are not important */ + return TRUE; + } + if (my_uni_utf32(cs, wc, min_str, min_end) != 4 || + my_uni_utf32(cs, wc, max_str, max_end) != 4) + goto pad_set_lengths; + *min_str++= 4; + *max_str++= 4; + continue; + } + + if (wc == (my_wc_t) w_one) + { + if (my_uni_utf32(cs, cs->min_sort_char, min_str, min_end) != 4 || + my_uni_utf32(cs, cs->max_sort_char, max_str, max_end) != 4) + goto pad_set_lengths; + min_str+= 4; + max_str+= 4; + continue; + } + + if (wc == (my_wc_t) w_many) + { + /* + Calculate length of keys: + 'a\0\0... is the smallest possible string when we have space expand + a\ff\ff... is the biggest possible string + */ + *min_length= ((cs->state & MY_CS_BINSORT) ? + (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + goto pad_min_max; + } + + /* Normal character */ + if (my_uni_utf32(cs, wc, min_str, min_end) != 4 || + my_uni_utf32(cs, wc, max_str, max_end) != 4) + goto pad_set_lengths; + min_str+= 4; + max_str+= 4; + } + +pad_set_lengths: + *min_length= *max_length= (size_t) (min_str - min_org); + +pad_min_max: + my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char); + my_fill_utf32(cs, max_str, max_end - max_str, cs->max_sort_char); + return FALSE; +} + + +static size_t +my_scan_utf32(CHARSET_INFO *cs, + const char *str, const char *end, int sequence_type) +{ + const char *str0= str; + + switch (sequence_type) + { + case MY_SEQ_SPACES: + for ( ; str < end; ) + { + my_wc_t wc; + int res= my_utf32_uni(cs, &wc, str, end); + if (res < 0 || wc != ' ') + break; + str+= res; + } + return (size_t) (str - str0); + default: + return 0; + } +} + + +static MY_COLLATION_HANDLER my_collation_utf32_general_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf32, + my_strnncollsp_utf32, + my_strnxfrm_unicode, + my_strnxfrmlen_utf32, + my_like_range_utf32, + my_wildcmp_utf32_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf32, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_utf32_bin_handler = +{ + NULL, /* init */ + my_strnncoll_utf32_bin, + my_strnncollsp_utf32_bin, + my_strnxfrm_unicode, + my_strnxfrmlen_utf32, + my_like_range_utf32, + my_wildcmp_utf32_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_utf32, + my_propagate_simple +}; + + +MY_CHARSET_HANDLER my_charset_utf32_handler= +{ + NULL, /* init */ + my_ismbchar_utf32, + my_mbcharlen_utf32, + my_numchars_utf32, + my_charpos_utf32, + my_well_formed_len_utf32, + my_lengthsp_utf32, + my_numcells_mb, + my_utf32_uni, + my_uni_utf32, + my_mb_ctype_mb, + my_caseup_str_mb2_or_mb4, + my_casedn_str_mb2_or_mb4, + my_caseup_utf32, + my_casedn_utf32, + my_snprintf_utf32, + my_l10tostr_mb2_or_mb4, + my_ll10tostr_mb2_or_mb4, + my_fill_utf32, + my_strntol_mb2_or_mb4, + my_strntoul_mb2_or_mb4, + my_strntoll_mb2_or_mb4, + my_strntoull_mb2_or_mb4, + my_strntod_mb2_or_mb4, + my_strtoll10_utf32, + my_strntoull10rnd_mb2_or_mb4, + my_scan_utf32 +}; + + +CHARSET_INFO my_charset_utf32_general_ci= +{ + 60,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* cs name */ + "utf32_general_ci", /* name */ + "UTF-32 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_general_ci_handler +}; + + +CHARSET_INFO my_charset_utf32_bin= +{ + 61,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE|MY_CS_NONASCII, + "utf32", /* cs name */ + "utf32_bin", /* name */ + "UTF-32 Unicode", /* comment */ + NULL, /* tailoring */ + NULL, /* ctype */ + NULL, /* to_lower */ + NULL, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 4, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf32_handler, + &my_collation_utf32_bin_handler +}; + + +#endif /* HAVE_CHARSET_utf32 */ + + +#ifdef HAVE_CHARSET_ucs2 + +static uchar ctype_ucs2[] = { + 0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16, + 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, + 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static uchar to_lower_ucs2[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95, + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + +static uchar to_upper_ucs2[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + + +static int my_ucs2_uni(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t * pwc, const uchar *s, const uchar *e) +{ + if (s+2 > e) /* Need 2 characters */ + return MY_CS_TOOSMALL2; + + *pwc= ((uchar)s[0]) * 256 + ((uchar)s[1]); + return 2; +} + +static int my_uni_ucs2(CHARSET_INFO *cs __attribute__((unused)) , + my_wc_t wc, uchar *r, uchar *e) +{ + if ( r+2 > e ) + return MY_CS_TOOSMALL2; + + r[0]= (uchar) (wc >> 8); + r[1]= (uchar) (wc & 0xFF); + return 2; +} + + +static size_t my_caseup_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + my_wc_t wc; + int res; + char *srcend= src + srclen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src == dst && srclen == dstlen); + + while ((src < srcend) && + (res= my_ucs2_uni(cs, &wc, (uchar *)src, (uchar*) srcend)) > 0) + { + int plane= (wc>>8) & 0xFF; + wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc; + if (res != my_uni_ucs2(cs, wc, (uchar*) src, (uchar*) srcend)) + break; + src+= res; + } + return srclen; +} + + +static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + my_wc_t wc; + int res; + const uchar *e=s+slen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + + while (e > s+1 && e[-1] == ' ' && e[-2] == '\0') + e-= 2; + + while ((s < e) && (res=my_ucs2_uni(cs,&wc, (uchar *)s, (uchar*)e)) >0) + { + int plane = (wc>>8) & 0xFF; + wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].sort : wc; + n1[0]^= (((n1[0] & 63)+n2[0])*(wc & 0xFF))+ (n1[0] << 8); + n2[0]+=3; + n1[0]^= (((n1[0] & 63)+n2[0])*(wc >> 8))+ (n1[0] << 8); + n2[0]+=3; + s+=res; + } +} + + +static size_t my_casedn_ucs2(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst __attribute__((unused)), + size_t dstlen __attribute__((unused))) +{ + my_wc_t wc; + int res; + char *srcend= src + srclen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src == dst && srclen == dstlen); + + while ((src < srcend) && + (res= my_ucs2_uni(cs, &wc, (uchar*) src, (uchar*) srcend)) > 0) + { + int plane= (wc>>8) & 0xFF; + wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc; + if (res != my_uni_ucs2(cs, wc, (uchar*) src, (uchar*) srcend)) + break; + src+= res; + } + return srclen; +} + + +static int my_strnncoll_ucs2(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + int s_res,t_res; + my_wc_t s_wc,t_wc; + const uchar *se=s+slen; + const uchar *te=t+tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + + while ( s < se && t < te ) + { + int plane; + s_res=my_ucs2_uni(cs,&s_wc, s, se); + t_res=my_ucs2_uni(cs,&t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare by char value */ + return ((int)s[0]-(int)t[0]); + } + + plane=(s_wc>>8) & 0xFF; + s_wc = uni_plane[plane] ? uni_plane[plane][s_wc & 0xFF].sort : s_wc; + plane=(t_wc>>8) & 0xFF; + t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; + if ( s_wc != t_wc ) + { + return s_wc > t_wc ? 1 : -1; + } + + s+=s_res; + t+=t_res; + } + return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); +} + + +/** + Compare strings, discarding end space + + If one string is shorter as the other, then we space extend the other + so that the strings have equal length. + + This will ensure that the following things hold: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + @param cs Character set pinter. + @param a First string to compare. + @param a_length Length of 'a'. + @param b Second string to compare. + @param b_length Length of 'b'. + + IMPLEMENTATION + + @return Comparison result. + @retval Negative number, if a less than b. + @retval 0, if a is equal to b + @retval Positive number, if a > b +*/ + +static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) +{ + const uchar *se, *te; + size_t minlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + + /* extra safety to make sure the lengths are even numbers */ + slen&= ~1; + tlen&= ~1; + + se= s + slen; + te= t + tlen; + + for (minlen= min(slen, tlen); minlen; minlen-= 2) + { + int s_wc = uni_plane[s[0]] ? (int) uni_plane[s[0]][s[1]].sort : + (((int) s[0]) << 8) + (int) s[1]; + + int t_wc = uni_plane[t[0]] ? (int) uni_plane[t[0]][t[1]].sort : + (((int) t[0]) << 8) + (int) t[1]; + if ( s_wc != t_wc ) + return s_wc > t_wc ? 1 : -1; + + s+= 2; + t+= 2; + } + + if (slen != tlen) + { + int swap= 1; + if (slen < tlen) + { + s= t; + se= te; + swap= -1; + } + + for ( ; s < se ; s+= 2) + { + if (s[0] || s[1] != ' ') + return (s[0] == 0 && s[1] < ' ') ? -swap : swap; + } + } + return 0; +} + + +static uint my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b __attribute__((unused)), + const char *e __attribute__((unused))) +{ + return 2; +} + + +static uint my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) , + uint c __attribute__((unused))) +{ + return 2; +} + + +static +size_t my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e) +{ + return (size_t) (e-b)/2; +} + + +static +size_t my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, size_t pos) +{ + size_t string_length= (size_t) (e - b); + return pos > string_length ? string_length + 2 : pos * 2; +} + + +static +size_t my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, const char *e, + size_t nchars, int *error) +{ + /* Ensure string length is dividable with 2 */ + size_t nbytes= ((size_t) (e-b)) & ~(size_t) 1; + *error= 0; + nchars*= 2; + return min(nbytes, nchars); +} + + +static +int my_wildcmp_ucs2_ci(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend, + escape,w_one,w_many,uni_plane); +} + + +static +int my_wildcmp_ucs2_bin(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend, + escape,w_one,w_many,NULL); +} + + +static +int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + int s_res,t_res; + my_wc_t s_wc,t_wc; + const uchar *se=s+slen; + const uchar *te=t+tlen; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + while ( s < se && t < te ) + { + s_res=my_ucs2_uni(cs,&s_wc, s, se); + t_res=my_ucs2_uni(cs,&t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare by char value */ + return ((int)s[0]-(int)t[0]); + } + if ( s_wc != t_wc ) + { + return s_wc > t_wc ? 1 : -1; + } + + s+=s_res; + t+=t_res; + } + return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); +} + +static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) +{ + const uchar *se, *te; + size_t minlen; + + /* extra safety to make sure the lengths are even numbers */ + slen= (slen >> 1) << 1; + tlen= (tlen >> 1) << 1; + + se= s + slen; + te= t + tlen; + + for (minlen= min(slen, tlen); minlen; minlen-= 2) + { + int s_wc= s[0] * 256 + s[1]; + int t_wc= t[0] * 256 + t[1]; + if ( s_wc != t_wc ) + return s_wc > t_wc ? 1 : -1; + + s+= 2; + t+= 2; + } + + if (slen != tlen) + { + int swap= 1; + if (slen < tlen) + { + s= t; + se= te; + swap= -1; + } + + for ( ; s < se ; s+= 2) + { + if (s[0] || s[1] != ' ') + return (s[0] == 0 && s[1] < ' ') ? -swap : swap; + } + } + return 0; +} + + +static +void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), + const uchar *key, size_t len,ulong *nr1, ulong *nr2) +{ + const uchar *pos = key; + + key+= len; + + while (key > pos+1 && key[-1] == ' ' && key[-2] == '\0') + key-= 2; + + for (; pos < (uchar*) key ; pos++) + { + nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * + ((uint)*pos)) + (nr1[0] << 8); + nr2[0]+=3; + } +} + + +/** + Calculate min_str and max_str that ranges a LIKE string. + + @param ptr Pointer to LIKE pattern. + @param ptr_length Length of LIKE pattern. + @param escape Escape character in LIKE. (Normally '\'). + All escape characters should be removed + from min_str and max_str. + @param res_length Length of min_str and max_str. + @param min_str Smallest case sensitive string that ranges LIKE. + Should be space padded to res_length. + @param max_str Largest case sensitive string that ranges LIKE. + Normally padded with the biggest character sort value. + + @return Optimization status. + @retval FALSE if LIKE pattern can be optimized + @rerval TRUE if LIKE can't be optimized. +*/ + +my_bool my_like_range_ucs2(CHARSET_INFO *cs, + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str,char *max_str, + size_t *min_length,size_t *max_length) +{ + const char *end=ptr+ptr_length; + char *min_org=min_str; + char *min_end=min_str+res_length; + size_t charlen= res_length / cs->mbmaxlen; + const char *contraction_flags= cs->contractions ? + ((const char*) cs->contractions) + 0x40*0x40 : NULL; + + for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0 + ; ptr+=2, charlen--) + { + if (ptr[0] == '\0' && ptr[1] == escape && ptr + 1 < end) + { + ptr+=2; /* Skip escape */ + *min_str++= *max_str++ = ptr[0]; + *min_str++= *max_str++ = ptr[1]; + continue; + } + if (ptr[0] == '\0' && ptr[1] == w_one) /* '_' in SQL */ + { + *min_str++= (char) (cs->min_sort_char >> 8); + *min_str++= (char) (cs->min_sort_char & 255); + *max_str++= (char) (cs->max_sort_char >> 8); + *max_str++= (char) (cs->max_sort_char & 255); + continue; + } + if (ptr[0] == '\0' && ptr[1] == w_many) /* '%' in SQL */ + { +fill_max_and_min: + /* + Calculate length of keys: + 'a\0\0... is the smallest possible string when we have space expand + a\ff\ff... is the biggest possible string + */ + *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : + res_length); + *max_length= res_length; + do { + *min_str++ = 0; + *min_str++ = 0; + *max_str++ = (char) (cs->max_sort_char >> 8); + *max_str++ = (char) (cs->max_sort_char & 255); + } while (min_str + 1 < min_end); + return FALSE; + } + + if (contraction_flags && ptr + 3 < end && + ptr[0] == '\0' && contraction_flags[(uchar) ptr[1]]) + { + /* Contraction head found */ + if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many)) + { + /* Contraction head followed by a wildcard, quit */ + goto fill_max_and_min; + } + + /* + Check if the second letter can be contraction part, + and if two letters really produce a contraction. + */ + if (ptr[2] == '\0' && contraction_flags[(uchar) ptr[3]] && + cs->contractions[(ptr[1]-0x40)*0x40 + ptr[3] - 0x40]) + { + /* Contraction found */ + if (charlen == 1 || min_str + 2 >= min_end) + { + /* Full contraction doesn't fit, quit */ + goto fill_max_and_min; + } + + /* Put contraction head */ + *min_str++= *max_str++= *ptr++; + *min_str++= *max_str++= *ptr++; + charlen--; + } + } + /* Put contraction tail, or a single character */ + *min_str++= *max_str++ = ptr[0]; + *min_str++= *max_str++ = ptr[1]; + } + + /* Temporary fix for handling w_one at end of string (key compression) */ + { + char *tmp; + for (tmp= min_str ; tmp-1 > min_org && tmp[-1] == '\0' && tmp[-2]=='\0';) + { + *--tmp=' '; + *--tmp='\0'; + } + } + + *min_length= *max_length = (size_t) (min_str - min_org); + while (min_str + 1 < min_end) + { + *min_str++ = *max_str++ = '\0'; + *min_str++ = *max_str++ = ' '; /* Because if key compression */ + } + return FALSE; +} + + +static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler = +{ + NULL, /* init */ + my_strnncoll_ucs2, + my_strnncollsp_ucs2, + my_strnxfrm_unicode, + my_strnxfrmlen_simple, + my_like_range_ucs2, + my_wildcmp_ucs2_ci, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_ucs2, + my_propagate_simple +}; + + +static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler = +{ + NULL, /* init */ + my_strnncoll_ucs2_bin, + my_strnncollsp_ucs2_bin, + my_strnxfrm_unicode, + my_strnxfrmlen_simple, + my_like_range_ucs2, + my_wildcmp_ucs2_bin, + my_strcasecmp_mb2_or_mb4, + my_instr_mb, + my_hash_sort_ucs2_bin, + my_propagate_simple +}; + + +MY_CHARSET_HANDLER my_charset_ucs2_handler= +{ + NULL, /* init */ + my_ismbchar_ucs2, /* ismbchar */ + my_mbcharlen_ucs2, /* mbcharlen */ + my_numchars_ucs2, + my_charpos_ucs2, + my_well_formed_len_ucs2, + my_lengthsp_mb2, + my_numcells_mb, + my_ucs2_uni, /* mb_wc */ + my_uni_ucs2, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_mb2_or_mb4, + my_casedn_str_mb2_or_mb4, + my_caseup_ucs2, + my_casedn_ucs2, + my_snprintf_mb2, + my_l10tostr_mb2_or_mb4, + my_ll10tostr_mb2_or_mb4, + my_fill_mb2, + my_strntol_mb2_or_mb4, + my_strntoul_mb2_or_mb4, + my_strntoll_mb2_or_mb4, + my_strntoull_mb2_or_mb4, + my_strntod_mb2_or_mb4, + my_strtoll10_mb2, + my_strntoull10rnd_mb2_or_mb4, + my_scan_mb2 +}; + + +CHARSET_INFO my_charset_ucs2_general_ci= +{ + 35,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_general_ci", /* name */ + "UCS-2 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_ucs2, /* ctype */ + to_lower_ucs2, /* to_lower */ + to_upper_ucs2, /* to_upper */ + to_upper_ucs2, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_general_ci_handler +}; + +CHARSET_INFO my_charset_ucs2_bin= +{ + 90,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE|MY_CS_NONASCII, + "ucs2", /* cs name */ + "ucs2_bin", /* name */ + "UCS-2 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_ucs2, /* ctype */ + to_lower_ucs2, /* to_lower */ + to_upper_ucs2, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 2, /* mbminlen */ + 2, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_ucs2_handler, + &my_collation_ucs2_bin_handler +}; + + +#endif /* HAVE_CHARSET_ucs2 */ diff --git a/externals/mysql/strings/ctype-ujis.c b/externals/mysql/strings/ctype-ujis.c new file mode 100644 index 0000000..bdcc3f8 --- /dev/null +++ b/externals/mysql/strings/ctype-ujis.c @@ -0,0 +1,8616 @@ +/* Copyright (C) 2002 MySQL AB & tommy@valley.ne.jp. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* This file is for Japanese EUC charset, and created by tommy@valley.ne.jp. + */ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. mbmaxlen_ujis=3 + */ + +#include +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_ujis + + +static uchar NEAR ctype_ujis[257] = +{ + 0, /* For standard library */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* NUL ^A - ^G */ + 0040, 0050, 0050, 0050, 0050, 0050, 0040, 0040, /* ^H - ^O */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^P - ^W */ + 0040, 0040, 0040, 0040, 0040, 0040, 0040, 0040, /* ^X - ^Z ^[ ^\ ^] ^^ ^_ */ + 0110, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* SPC ! " # $ % ^ ' */ + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, /* ( ) * + , - . / */ + 0204, 0204, 0204, 0204, 0204, 0204, 0204, 0204, /* 0 1 2 3 4 5 6 7 */ + 0204, 0204, 0020, 0020, 0020, 0020, 0020, 0020, /* 8 9 : ; < = > ? */ + 0020, 0201, 0201, 0201, 0201, 0201, 0201, 0001, /* @ A B C D E F G */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* H I J K L M N O */ + 0001, 0001, 0001, 0001, 0001, 0001, 0001, 0001, /* P Q R S T U V W */ + 0001, 0001, 0001, 0020, 0020, 0020, 0020, 0020, /* X Y Z [ \ ] ^ _ */ + 0020, 0202, 0202, 0202, 0202, 0202, 0202, 0002, /* ` a b c d e f g */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* h i j k l m n o */ + 0002, 0002, 0002, 0002, 0002, 0002, 0002, 0002, /* p q r s t u v w */ + 0002, 0002, 0002, 0020, 0020, 0020, 0020, 0040, /* x y z { | } + DEL */ + 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, + 0000, 0000, 0000, 0000, 0000, 0000, 0020, 0020, + 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, + 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, + 0000, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0020, + 0020, 0020, 0020, 0020, 0020, 0020, 0020, 0000, +}; + +static uchar NEAR to_lower_ujis[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '[', '\\', ']', '^', '_', + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR to_upper_ujis[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375',(uchar) '\376',(uchar) '\377' +}; + +static uchar NEAR sort_order_ujis[]= +{ + '\000','\001','\002','\003','\004','\005','\006','\007', + '\010','\011','\012','\013','\014','\015','\016','\017', + '\020','\021','\022','\023','\024','\025','\026','\027', + '\030','\031','\032','\033','\034','\035','\036','\037', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + (uchar) '\200',(uchar) '\201',(uchar) '\202',(uchar) '\203',(uchar) '\204',(uchar) '\205',(uchar) '\206',(uchar) '\207', + (uchar) '\210',(uchar) '\211',(uchar) '\212',(uchar) '\213',(uchar) '\214',(uchar) '\215',(uchar) '\216',(uchar) '\217', + (uchar) '\220',(uchar) '\221',(uchar) '\222',(uchar) '\223',(uchar) '\224',(uchar) '\225',(uchar) '\226',(uchar) '\227', + (uchar) '\230',(uchar) '\231',(uchar) '\232',(uchar) '\233',(uchar) '\234',(uchar) '\235',(uchar) '\236',(uchar) '\237', + (uchar) '\240',(uchar) '\241',(uchar) '\242',(uchar) '\243',(uchar) '\244',(uchar) '\245',(uchar) '\246',(uchar) '\247', + (uchar) '\250',(uchar) '\251',(uchar) '\252',(uchar) '\253',(uchar) '\254',(uchar) '\255',(uchar) '\256',(uchar) '\257', + (uchar) '\260',(uchar) '\261',(uchar) '\262',(uchar) '\263',(uchar) '\264',(uchar) '\265',(uchar) '\266',(uchar) '\267', + (uchar) '\270',(uchar) '\271',(uchar) '\272',(uchar) '\273',(uchar) '\274',(uchar) '\275',(uchar) '\276',(uchar) '\277', + (uchar) '\300',(uchar) '\301',(uchar) '\302',(uchar) '\303',(uchar) '\304',(uchar) '\305',(uchar) '\306',(uchar) '\307', + (uchar) '\310',(uchar) '\311',(uchar) '\312',(uchar) '\313',(uchar) '\314',(uchar) '\315',(uchar) '\316',(uchar) '\317', + (uchar) '\320',(uchar) '\321',(uchar) '\322',(uchar) '\323',(uchar) '\324',(uchar) '\325',(uchar) '\326',(uchar) '\327', + (uchar) '\330',(uchar) '\331',(uchar) '\332',(uchar) '\333',(uchar) '\334',(uchar) '\335',(uchar) '\336',(uchar) '\337', + (uchar) '\340',(uchar) '\341',(uchar) '\342',(uchar) '\343',(uchar) '\344',(uchar) '\345',(uchar) '\346',(uchar) '\347', + (uchar) '\350',(uchar) '\351',(uchar) '\352',(uchar) '\353',(uchar) '\354',(uchar) '\355',(uchar) '\356',(uchar) '\357', + (uchar) '\360',(uchar) '\361',(uchar) '\362',(uchar) '\363',(uchar) '\364',(uchar) '\365',(uchar) '\366',(uchar) '\367', + (uchar) '\370',(uchar) '\371',(uchar) '\372',(uchar) '\373',(uchar) '\374',(uchar) '\375', (uchar) (uchar) '\376', (uchar) '\377' +}; + + +#define isujis(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xfe)) +#define iskata(c) ((0xa1<=((c)&0xff) && ((c)&0xff)<=0xdf)) +#define isujis_ss2(c) (((c)&0xff) == 0x8e) +#define isujis_ss3(c) (((c)&0xff) == 0x8f) + + +static uint ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)), + const char* p, const char *e) +{ + return ((*(uchar*)(p)<0x80)? 0:\ + isujis(*(p)) && (e)-(p)>1 && isujis(*((p)+1))? 2:\ + isujis_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\ + isujis_ss3(*(p)) && (e)-(p)>2 && isujis(*((p)+1)) && isujis(*((p)+2))? 3:\ + 0); +} + +static uint mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c) +{ + return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 1); +} + + +static uint16 tab_jisx0201_uni[256]={ + 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x00A5,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x203E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67, +0xFF68,0xFF69,0xFF6A,0xFF6B,0xFF6C,0xFF6D,0xFF6E,0xFF6F, +0xFF70,0xFF71,0xFF72,0xFF73,0xFF74,0xFF75,0xFF76,0xFF77, +0xFF78,0xFF79,0xFF7A,0xFF7B,0xFF7C,0xFF7D,0xFF7E,0xFF7F, +0xFF80,0xFF81,0xFF82,0xFF83,0xFF84,0xFF85,0xFF86,0xFF87, +0xFF88,0xFF89,0xFF8A,0xFF8B,0xFF8C,0xFF8D,0xFF8E,0xFF8F, +0xFF90,0xFF91,0xFF92,0xFF93,0xFF94,0xFF95,0xFF96,0xFF97, +0xFF98,0xFF99,0xFF9A,0xFF9B,0xFF9C,0xFF9D,0xFF9E,0xFF9F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + + +static int +my_mb_wc_jisx0201(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *wc,const uchar *s, + const uchar *e __attribute__((unused))) +{ + wc[0]=tab_jisx0201_uni[*s]; + return (!wc[0] && s[0]) ? -1 : 1; +} + + +static int +my_wc_mb_jisx0201(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, + uchar *e __attribute__((unused))) +{ + + if ((int) wc <= 0x7D) + { + *s = (uchar) wc; + return (wc == 0x5C) ? MY_CS_ILUNI : 1; + } + + if (wc >= 0xFF61 && wc <= 0xFF9F) + { + *s = (uchar) (wc - 0xFEC0); + return 1; + } + + return MY_CS_ILUNI; +} + + +/* page 0 0x2121-0x217E */ +static uint16 tab_jisx0208_uni0[]={ +0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B, +0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E, +0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD, +0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0x005C, +0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C, +0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B, +0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E, +0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7,0x00F7, +0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234, +0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04, +0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7, +0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7}; + +/* page 1 0x2221-0x227E */ +static uint16 tab_jisx0208_uni1[]={ +0x25C6,0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B, +0x3012,0x2192,0x2190,0x2191,0x2193,0x3013, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A, +0x2229, 0, 0, 0, 0, 0, 0, 0, + 0,0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x2220,0x22A5,0x2312,0x2202,0x2207, +0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x2235, +0x222B,0x222C, 0, 0, 0, 0, 0, 0, + 0,0x212B,0x2030,0x266F,0x266D,0x266A,0x2020,0x2021, +0x00B6, 0, 0, 0, 0,0x25EF}; + +/* page 2 0x2330-0x237A */ +static uint16 tab_jisx0208_uni2[]={ +0xFF10,0xFF11,0xFF12,0xFF13,0xFF14,0xFF15,0xFF16,0xFF17, +0xFF18,0xFF19, 0, 0, 0, 0, 0, 0, + 0,0xFF21,0xFF22,0xFF23,0xFF24,0xFF25,0xFF26,0xFF27, +0xFF28,0xFF29,0xFF2A,0xFF2B,0xFF2C,0xFF2D,0xFF2E,0xFF2F, +0xFF30,0xFF31,0xFF32,0xFF33,0xFF34,0xFF35,0xFF36,0xFF37, +0xFF38,0xFF39,0xFF3A, 0, 0, 0, 0, 0, + 0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47, +0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F, +0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57, +0xFF58,0xFF59,0xFF5A}; + +/* page 3 0x2421-0x2473 */ +static uint16 tab_jisx0208_uni3[]={ +0x3041,0x3042,0x3043,0x3044,0x3045,0x3046,0x3047,0x3048, +0x3049,0x304A,0x304B,0x304C,0x304D,0x304E,0x304F,0x3050, +0x3051,0x3052,0x3053,0x3054,0x3055,0x3056,0x3057,0x3058, +0x3059,0x305A,0x305B,0x305C,0x305D,0x305E,0x305F,0x3060, +0x3061,0x3062,0x3063,0x3064,0x3065,0x3066,0x3067,0x3068, +0x3069,0x306A,0x306B,0x306C,0x306D,0x306E,0x306F,0x3070, +0x3071,0x3072,0x3073,0x3074,0x3075,0x3076,0x3077,0x3078, +0x3079,0x307A,0x307B,0x307C,0x307D,0x307E,0x307F,0x3080, +0x3081,0x3082,0x3083,0x3084,0x3085,0x3086,0x3087,0x3088, +0x3089,0x308A,0x308B,0x308C,0x308D,0x308E,0x308F,0x3090, +0x3091,0x3092,0x3093}; + +/* page 4 0x2521-0x2576 */ +static uint16 tab_jisx0208_uni4[]={ +0x30A1,0x30A2,0x30A3,0x30A4,0x30A5,0x30A6,0x30A7,0x30A8, +0x30A9,0x30AA,0x30AB,0x30AC,0x30AD,0x30AE,0x30AF,0x30B0, +0x30B1,0x30B2,0x30B3,0x30B4,0x30B5,0x30B6,0x30B7,0x30B8, +0x30B9,0x30BA,0x30BB,0x30BC,0x30BD,0x30BE,0x30BF,0x30C0, +0x30C1,0x30C2,0x30C3,0x30C4,0x30C5,0x30C6,0x30C7,0x30C8, +0x30C9,0x30CA,0x30CB,0x30CC,0x30CD,0x30CE,0x30CF,0x30D0, +0x30D1,0x30D2,0x30D3,0x30D4,0x30D5,0x30D6,0x30D7,0x30D8, +0x30D9,0x30DA,0x30DB,0x30DC,0x30DD,0x30DE,0x30DF,0x30E0, +0x30E1,0x30E2,0x30E3,0x30E4,0x30E5,0x30E6,0x30E7,0x30E8, +0x30E9,0x30EA,0x30EB,0x30EC,0x30ED,0x30EE,0x30EF,0x30F0, +0x30F1,0x30F2,0x30F3,0x30F4,0x30F5,0x30F6}; + +/* page 5 0x2621-0x2658 */ +static uint16 tab_jisx0208_uni5[]={ +0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398, +0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,0x03A0, +0x03A1,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,0x03A8,0x03A9, + 0, 0, 0, 0, 0, 0, 0, 0, +0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,0x03B8, +0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,0x03C0, +0x03C1,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8,0x03C9 +}; + +/* page 6 0x2721-0x2771 */ +static uint16 tab_jisx0208_uni6[]={ +0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0401,0x0416, +0x0417,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E, +0x041F,0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426, +0x0427,0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E, +0x042F, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0451,0x0436, +0x0437,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E, +0x043F,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446, +0x0447,0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E, +0x044F}; + +/* page 7 0x2821-0x2840 */ +static uint16 tab_jisx0208_uni7[]={ +0x2500,0x2502,0x250C,0x2510,0x2518,0x2514,0x251C,0x252C, +0x2524,0x2534,0x253C,0x2501,0x2503,0x250F,0x2513,0x251B, +0x2517,0x2523,0x2533,0x252B,0x253B,0x254B,0x2520,0x252F, +0x2528,0x2537,0x253F,0x251D,0x2530,0x2525,0x2538,0x2542 +}; + +/* page 8 0x3021-0x307E */ +static uint16 tab_jisx0208_uni8[]={ +0x4E9C,0x5516,0x5A03,0x963F,0x54C0,0x611B,0x6328,0x59F6, +0x9022,0x8475,0x831C,0x7A50,0x60AA,0x63E1,0x6E25,0x65ED, +0x8466,0x82A6,0x9BF5,0x6893,0x5727,0x65A1,0x6271,0x5B9B, +0x59D0,0x867B,0x98F4,0x7D62,0x7DBE,0x9B8E,0x6216,0x7C9F, +0x88B7,0x5B89,0x5EB5,0x6309,0x6697,0x6848,0x95C7,0x978D, +0x674F,0x4EE5,0x4F0A,0x4F4D,0x4F9D,0x5049,0x56F2,0x5937, +0x59D4,0x5A01,0x5C09,0x60DF,0x610F,0x6170,0x6613,0x6905, +0x70BA,0x754F,0x7570,0x79FB,0x7DAD,0x7DEF,0x80C3,0x840E, +0x8863,0x8B02,0x9055,0x907A,0x533B,0x4E95,0x4EA5,0x57DF, +0x80B2,0x90C1,0x78EF,0x4E00,0x58F1,0x6EA2,0x9038,0x7A32, +0x8328,0x828B,0x9C2F,0x5141,0x5370,0x54BD,0x54E1,0x56E0, +0x59FB,0x5F15,0x98F2,0x6DEB,0x80E4,0x852D}; + +/* page 9 0x3121-0x317E */ +static uint16 tab_jisx0208_uni9[]={ +0x9662,0x9670,0x96A0,0x97FB,0x540B,0x53F3,0x5B87,0x70CF, +0x7FBD,0x8FC2,0x96E8,0x536F,0x9D5C,0x7ABA,0x4E11,0x7893, +0x81FC,0x6E26,0x5618,0x5504,0x6B1D,0x851A,0x9C3B,0x59E5, +0x53A9,0x6D66,0x74DC,0x958F,0x5642,0x4E91,0x904B,0x96F2, +0x834F,0x990C,0x53E1,0x55B6,0x5B30,0x5F71,0x6620,0x66F3, +0x6804,0x6C38,0x6CF3,0x6D29,0x745B,0x76C8,0x7A4E,0x9834, +0x82F1,0x885B,0x8A60,0x92ED,0x6DB2,0x75AB,0x76CA,0x99C5, +0x60A6,0x8B01,0x8D8A,0x95B2,0x698E,0x53AD,0x5186,0x5712, +0x5830,0x5944,0x5BB4,0x5EF6,0x6028,0x63A9,0x63F4,0x6CBF, +0x6F14,0x708E,0x7114,0x7159,0x71D5,0x733F,0x7E01,0x8276, +0x82D1,0x8597,0x9060,0x925B,0x9D1B,0x5869,0x65BC,0x6C5A, +0x7525,0x51F9,0x592E,0x5965,0x5F80,0x5FDC}; + +/* page 10 0x3221-0x327E */ +static uint16 tab_jisx0208_uni10[]={ +0x62BC,0x65FA,0x6A2A,0x6B27,0x6BB4,0x738B,0x7FC1,0x8956, +0x9D2C,0x9D0E,0x9EC4,0x5CA1,0x6C96,0x837B,0x5104,0x5C4B, +0x61B6,0x81C6,0x6876,0x7261,0x4E59,0x4FFA,0x5378,0x6069, +0x6E29,0x7A4F,0x97F3,0x4E0B,0x5316,0x4EEE,0x4F55,0x4F3D, +0x4FA1,0x4F73,0x52A0,0x53EF,0x5609,0x590F,0x5AC1,0x5BB6, +0x5BE1,0x79D1,0x6687,0x679C,0x67B6,0x6B4C,0x6CB3,0x706B, +0x73C2,0x798D,0x79BE,0x7A3C,0x7B87,0x82B1,0x82DB,0x8304, +0x8377,0x83EF,0x83D3,0x8766,0x8AB2,0x5629,0x8CA8,0x8FE6, +0x904E,0x971E,0x868A,0x4FC4,0x5CE8,0x6211,0x7259,0x753B, +0x81E5,0x82BD,0x86FE,0x8CC0,0x96C5,0x9913,0x99D5,0x4ECB, +0x4F1A,0x89E3,0x56DE,0x584A,0x58CA,0x5EFB,0x5FEB,0x602A, +0x6094,0x6062,0x61D0,0x6212,0x62D0,0x6539}; + +/* page 11 0x3321-0x337E */ +static uint16 tab_jisx0208_uni11[]={ +0x9B41,0x6666,0x68B0,0x6D77,0x7070,0x754C,0x7686,0x7D75, +0x82A5,0x87F9,0x958B,0x968E,0x8C9D,0x51F1,0x52BE,0x5916, +0x54B3,0x5BB3,0x5D16,0x6168,0x6982,0x6DAF,0x788D,0x84CB, +0x8857,0x8A72,0x93A7,0x9AB8,0x6D6C,0x99A8,0x86D9,0x57A3, +0x67FF,0x86CE,0x920E,0x5283,0x5687,0x5404,0x5ED3,0x62E1, +0x64B9,0x683C,0x6838,0x6BBB,0x7372,0x78BA,0x7A6B,0x899A, +0x89D2,0x8D6B,0x8F03,0x90ED,0x95A3,0x9694,0x9769,0x5B66, +0x5CB3,0x697D,0x984D,0x984E,0x639B,0x7B20,0x6A2B,0x6A7F, +0x68B6,0x9C0D,0x6F5F,0x5272,0x559D,0x6070,0x62EC,0x6D3B, +0x6E07,0x6ED1,0x845B,0x8910,0x8F44,0x4E14,0x9C39,0x53F6, +0x691B,0x6A3A,0x9784,0x682A,0x515C,0x7AC3,0x84B2,0x91DC, +0x938C,0x565B,0x9D28,0x6822,0x8305,0x8431}; + +/* page 12 0x3421-0x347E */ +static uint16 tab_jisx0208_uni12[]={ +0x7CA5,0x5208,0x82C5,0x74E6,0x4E7E,0x4F83,0x51A0,0x5BD2, +0x520A,0x52D8,0x52E7,0x5DFB,0x559A,0x582A,0x59E6,0x5B8C, +0x5B98,0x5BDB,0x5E72,0x5E79,0x60A3,0x611F,0x6163,0x61BE, +0x63DB,0x6562,0x67D1,0x6853,0x68FA,0x6B3E,0x6B53,0x6C57, +0x6F22,0x6F97,0x6F45,0x74B0,0x7518,0x76E3,0x770B,0x7AFF, +0x7BA1,0x7C21,0x7DE9,0x7F36,0x7FF0,0x809D,0x8266,0x839E, +0x89B3,0x8ACC,0x8CAB,0x9084,0x9451,0x9593,0x9591,0x95A2, +0x9665,0x97D3,0x9928,0x8218,0x4E38,0x542B,0x5CB8,0x5DCC, +0x73A9,0x764C,0x773C,0x5CA9,0x7FEB,0x8D0B,0x96C1,0x9811, +0x9854,0x9858,0x4F01,0x4F0E,0x5371,0x559C,0x5668,0x57FA, +0x5947,0x5B09,0x5BC4,0x5C90,0x5E0C,0x5E7E,0x5FCC,0x63EE, +0x673A,0x65D7,0x65E2,0x671F,0x68CB,0x68C4}; + +/* page 13 0x3521-0x357E */ +static uint16 tab_jisx0208_uni13[]={ +0x6A5F,0x5E30,0x6BC5,0x6C17,0x6C7D,0x757F,0x7948,0x5B63, +0x7A00,0x7D00,0x5FBD,0x898F,0x8A18,0x8CB4,0x8D77,0x8ECC, +0x8F1D,0x98E2,0x9A0E,0x9B3C,0x4E80,0x507D,0x5100,0x5993, +0x5B9C,0x622F,0x6280,0x64EC,0x6B3A,0x72A0,0x7591,0x7947, +0x7FA9,0x87FB,0x8ABC,0x8B70,0x63AC,0x83CA,0x97A0,0x5409, +0x5403,0x55AB,0x6854,0x6A58,0x8A70,0x7827,0x6775,0x9ECD, +0x5374,0x5BA2,0x811A,0x8650,0x9006,0x4E18,0x4E45,0x4EC7, +0x4F11,0x53CA,0x5438,0x5BAE,0x5F13,0x6025,0x6551,0x673D, +0x6C42,0x6C72,0x6CE3,0x7078,0x7403,0x7A76,0x7AAE,0x7B08, +0x7D1A,0x7CFE,0x7D66,0x65E7,0x725B,0x53BB,0x5C45,0x5DE8, +0x62D2,0x62E0,0x6319,0x6E20,0x865A,0x8A31,0x8DDD,0x92F8, +0x6F01,0x79A6,0x9B5A,0x4EA8,0x4EAB,0x4EAC}; + +/* page 14 0x3621-0x367E */ +static uint16 tab_jisx0208_uni14[]={ +0x4F9B,0x4FA0,0x50D1,0x5147,0x7AF6,0x5171,0x51F6,0x5354, +0x5321,0x537F,0x53EB,0x55AC,0x5883,0x5CE1,0x5F37,0x5F4A, +0x602F,0x6050,0x606D,0x631F,0x6559,0x6A4B,0x6CC1,0x72C2, +0x72ED,0x77EF,0x80F8,0x8105,0x8208,0x854E,0x90F7,0x93E1, +0x97FF,0x9957,0x9A5A,0x4EF0,0x51DD,0x5C2D,0x6681,0x696D, +0x5C40,0x66F2,0x6975,0x7389,0x6850,0x7C81,0x50C5,0x52E4, +0x5747,0x5DFE,0x9326,0x65A4,0x6B23,0x6B3D,0x7434,0x7981, +0x79BD,0x7B4B,0x7DCA,0x82B9,0x83CC,0x887F,0x895F,0x8B39, +0x8FD1,0x91D1,0x541F,0x9280,0x4E5D,0x5036,0x53E5,0x533A, +0x72D7,0x7396,0x77E9,0x82E6,0x8EAF,0x99C6,0x99C8,0x99D2, +0x5177,0x611A,0x865E,0x55B0,0x7A7A,0x5076,0x5BD3,0x9047, +0x9685,0x4E32,0x6ADB,0x91E7,0x5C51,0x5C48}; + +/* page 15 0x3721-0x377E */ +static uint16 tab_jisx0208_uni15[]={ +0x6398,0x7A9F,0x6C93,0x9774,0x8F61,0x7AAA,0x718A,0x9688, +0x7C82,0x6817,0x7E70,0x6851,0x936C,0x52F2,0x541B,0x85AB, +0x8A13,0x7FA4,0x8ECD,0x90E1,0x5366,0x8888,0x7941,0x4FC2, +0x50BE,0x5211,0x5144,0x5553,0x572D,0x73EA,0x578B,0x5951, +0x5F62,0x5F84,0x6075,0x6176,0x6167,0x61A9,0x63B2,0x643A, +0x656C,0x666F,0x6842,0x6E13,0x7566,0x7A3D,0x7CFB,0x7D4C, +0x7D99,0x7E4B,0x7F6B,0x830E,0x834A,0x86CD,0x8A08,0x8A63, +0x8B66,0x8EFD,0x981A,0x9D8F,0x82B8,0x8FCE,0x9BE8,0x5287, +0x621F,0x6483,0x6FC0,0x9699,0x6841,0x5091,0x6B20,0x6C7A, +0x6F54,0x7A74,0x7D50,0x8840,0x8A23,0x6708,0x4EF6,0x5039, +0x5026,0x5065,0x517C,0x5238,0x5263,0x55A7,0x570F,0x5805, +0x5ACC,0x5EFA,0x61B2,0x61F8,0x62F3,0x6372}; + +/* page 16 0x3821-0x387E */ +static uint16 tab_jisx0208_uni16[]={ +0x691C,0x6A29,0x727D,0x72AC,0x732E,0x7814,0x786F,0x7D79, +0x770C,0x80A9,0x898B,0x8B19,0x8CE2,0x8ED2,0x9063,0x9375, +0x967A,0x9855,0x9A13,0x9E78,0x5143,0x539F,0x53B3,0x5E7B, +0x5F26,0x6E1B,0x6E90,0x7384,0x73FE,0x7D43,0x8237,0x8A00, +0x8AFA,0x9650,0x4E4E,0x500B,0x53E4,0x547C,0x56FA,0x59D1, +0x5B64,0x5DF1,0x5EAB,0x5F27,0x6238,0x6545,0x67AF,0x6E56, +0x72D0,0x7CCA,0x88B4,0x80A1,0x80E1,0x83F0,0x864E,0x8A87, +0x8DE8,0x9237,0x96C7,0x9867,0x9F13,0x4E94,0x4E92,0x4F0D, +0x5348,0x5449,0x543E,0x5A2F,0x5F8C,0x5FA1,0x609F,0x68A7, +0x6A8E,0x745A,0x7881,0x8A9E,0x8AA4,0x8B77,0x9190,0x4E5E, +0x9BC9,0x4EA4,0x4F7C,0x4FAF,0x5019,0x5016,0x5149,0x516C, +0x529F,0x52B9,0x52FE,0x539A,0x53E3,0x5411}; + +/* page 17 0x3921-0x397E */ +static uint16 tab_jisx0208_uni17[]={ +0x540E,0x5589,0x5751,0x57A2,0x597D,0x5B54,0x5B5D,0x5B8F, +0x5DE5,0x5DE7,0x5DF7,0x5E78,0x5E83,0x5E9A,0x5EB7,0x5F18, +0x6052,0x614C,0x6297,0x62D8,0x63A7,0x653B,0x6602,0x6643, +0x66F4,0x676D,0x6821,0x6897,0x69CB,0x6C5F,0x6D2A,0x6D69, +0x6E2F,0x6E9D,0x7532,0x7687,0x786C,0x7A3F,0x7CE0,0x7D05, +0x7D18,0x7D5E,0x7DB1,0x8015,0x8003,0x80AF,0x80B1,0x8154, +0x818F,0x822A,0x8352,0x884C,0x8861,0x8B1B,0x8CA2,0x8CFC, +0x90CA,0x9175,0x9271,0x783F,0x92FC,0x95A4,0x964D,0x9805, +0x9999,0x9AD8,0x9D3B,0x525B,0x52AB,0x53F7,0x5408,0x58D5, +0x62F7,0x6FE0,0x8C6A,0x8F5F,0x9EB9,0x514B,0x523B,0x544A, +0x56FD,0x7A40,0x9177,0x9D60,0x9ED2,0x7344,0x6F09,0x8170, +0x7511,0x5FFD,0x60DA,0x9AA8,0x72DB,0x8FBC}; + +/* page 18 0x3A21-0x3A7E */ +static uint16 tab_jisx0208_uni18[]={ +0x6B64,0x9803,0x4ECA,0x56F0,0x5764,0x58BE,0x5A5A,0x6068, +0x61C7,0x660F,0x6606,0x6839,0x68B1,0x6DF7,0x75D5,0x7D3A, +0x826E,0x9B42,0x4E9B,0x4F50,0x53C9,0x5506,0x5D6F,0x5DE6, +0x5DEE,0x67FB,0x6C99,0x7473,0x7802,0x8A50,0x9396,0x88DF, +0x5750,0x5EA7,0x632B,0x50B5,0x50AC,0x518D,0x6700,0x54C9, +0x585E,0x59BB,0x5BB0,0x5F69,0x624D,0x63A1,0x683D,0x6B73, +0x6E08,0x707D,0x91C7,0x7280,0x7815,0x7826,0x796D,0x658E, +0x7D30,0x83DC,0x88C1,0x8F09,0x969B,0x5264,0x5728,0x6750, +0x7F6A,0x8CA1,0x51B4,0x5742,0x962A,0x583A,0x698A,0x80B4, +0x54B2,0x5D0E,0x57FC,0x7895,0x9DFA,0x4F5C,0x524A,0x548B, +0x643E,0x6628,0x6714,0x67F5,0x7A84,0x7B56,0x7D22,0x932F, +0x685C,0x9BAD,0x7B39,0x5319,0x518A,0x5237}; + +/* page 19 0x3B21-0x3B7E */ +static uint16 tab_jisx0208_uni19[]={ +0x5BDF,0x62F6,0x64AE,0x64E6,0x672D,0x6BBA,0x85A9,0x96D1, +0x7690,0x9BD6,0x634C,0x9306,0x9BAB,0x76BF,0x6652,0x4E09, +0x5098,0x53C2,0x5C71,0x60E8,0x6492,0x6563,0x685F,0x71E6, +0x73CA,0x7523,0x7B97,0x7E82,0x8695,0x8B83,0x8CDB,0x9178, +0x9910,0x65AC,0x66AB,0x6B8B,0x4ED5,0x4ED4,0x4F3A,0x4F7F, +0x523A,0x53F8,0x53F2,0x55E3,0x56DB,0x58EB,0x59CB,0x59C9, +0x59FF,0x5B50,0x5C4D,0x5E02,0x5E2B,0x5FD7,0x601D,0x6307, +0x652F,0x5B5C,0x65AF,0x65BD,0x65E8,0x679D,0x6B62,0x6B7B, +0x6C0F,0x7345,0x7949,0x79C1,0x7CF8,0x7D19,0x7D2B,0x80A2, +0x8102,0x81F3,0x8996,0x8A5E,0x8A69,0x8A66,0x8A8C,0x8AEE, +0x8CC7,0x8CDC,0x96CC,0x98FC,0x6B6F,0x4E8B,0x4F3C,0x4F8D, +0x5150,0x5B57,0x5BFA,0x6148,0x6301,0x6642}; + +/* page 20 0x3C21-0x3C7E */ +static uint16 tab_jisx0208_uni20[]={ +0x6B21,0x6ECB,0x6CBB,0x723E,0x74BD,0x75D4,0x78C1,0x793A, +0x800C,0x8033,0x81EA,0x8494,0x8F9E,0x6C50,0x9E7F,0x5F0F, +0x8B58,0x9D2B,0x7AFA,0x8EF8,0x5B8D,0x96EB,0x4E03,0x53F1, +0x57F7,0x5931,0x5AC9,0x5BA4,0x6089,0x6E7F,0x6F06,0x75BE, +0x8CEA,0x5B9F,0x8500,0x7BE0,0x5072,0x67F4,0x829D,0x5C61, +0x854A,0x7E1E,0x820E,0x5199,0x5C04,0x6368,0x8D66,0x659C, +0x716E,0x793E,0x7D17,0x8005,0x8B1D,0x8ECA,0x906E,0x86C7, +0x90AA,0x501F,0x52FA,0x5C3A,0x6753,0x707C,0x7235,0x914C, +0x91C8,0x932B,0x82E5,0x5BC2,0x5F31,0x60F9,0x4E3B,0x53D6, +0x5B88,0x624B,0x6731,0x6B8A,0x72E9,0x73E0,0x7A2E,0x816B, +0x8DA3,0x9152,0x9996,0x5112,0x53D7,0x546A,0x5BFF,0x6388, +0x6A39,0x7DAC,0x9700,0x56DA,0x53CE,0x5468}; + +/* page 21 0x3D21-0x3D7E */ +static uint16 tab_jisx0208_uni21[]={ +0x5B97,0x5C31,0x5DDE,0x4FEE,0x6101,0x62FE,0x6D32,0x79C0, +0x79CB,0x7D42,0x7E4D,0x7FD2,0x81ED,0x821F,0x8490,0x8846, +0x8972,0x8B90,0x8E74,0x8F2F,0x9031,0x914B,0x916C,0x96C6, +0x919C,0x4EC0,0x4F4F,0x5145,0x5341,0x5F93,0x620E,0x67D4, +0x6C41,0x6E0B,0x7363,0x7E26,0x91CD,0x9283,0x53D4,0x5919, +0x5BBF,0x6DD1,0x795D,0x7E2E,0x7C9B,0x587E,0x719F,0x51FA, +0x8853,0x8FF0,0x4FCA,0x5CFB,0x6625,0x77AC,0x7AE3,0x821C, +0x99FF,0x51C6,0x5FAA,0x65EC,0x696F,0x6B89,0x6DF3,0x6E96, +0x6F64,0x76FE,0x7D14,0x5DE1,0x9075,0x9187,0x9806,0x51E6, +0x521D,0x6240,0x6691,0x66D9,0x6E1A,0x5EB6,0x7DD2,0x7F72, +0x66F8,0x85AF,0x85F7,0x8AF8,0x52A9,0x53D9,0x5973,0x5E8F, +0x5F90,0x6055,0x92E4,0x9664,0x50B7,0x511F}; + +/* page 22 0x3E21-0x3E7E */ +static uint16 tab_jisx0208_uni22[]={ +0x52DD,0x5320,0x5347,0x53EC,0x54E8,0x5546,0x5531,0x5617, +0x5968,0x59BE,0x5A3C,0x5BB5,0x5C06,0x5C0F,0x5C11,0x5C1A, +0x5E84,0x5E8A,0x5EE0,0x5F70,0x627F,0x6284,0x62DB,0x638C, +0x6377,0x6607,0x660C,0x662D,0x6676,0x677E,0x68A2,0x6A1F, +0x6A35,0x6CBC,0x6D88,0x6E09,0x6E58,0x713C,0x7126,0x7167, +0x75C7,0x7701,0x785D,0x7901,0x7965,0x79F0,0x7AE0,0x7B11, +0x7CA7,0x7D39,0x8096,0x83D6,0x848B,0x8549,0x885D,0x88F3, +0x8A1F,0x8A3C,0x8A54,0x8A73,0x8C61,0x8CDE,0x91A4,0x9266, +0x937E,0x9418,0x969C,0x9798,0x4E0A,0x4E08,0x4E1E,0x4E57, +0x5197,0x5270,0x57CE,0x5834,0x58CC,0x5B22,0x5E38,0x60C5, +0x64FE,0x6761,0x6756,0x6D44,0x72B6,0x7573,0x7A63,0x84B8, +0x8B72,0x91B8,0x9320,0x5631,0x57F4,0x98FE}; + +/* page 23 0x3F21-0x3F7E */ +static uint16 tab_jisx0208_uni23[]={ +0x62ED,0x690D,0x6B96,0x71ED,0x7E54,0x8077,0x8272,0x89E6, +0x98DF,0x8755,0x8FB1,0x5C3B,0x4F38,0x4FE1,0x4FB5,0x5507, +0x5A20,0x5BDD,0x5BE9,0x5FC3,0x614E,0x632F,0x65B0,0x664B, +0x68EE,0x699B,0x6D78,0x6DF1,0x7533,0x75B9,0x771F,0x795E, +0x79E6,0x7D33,0x81E3,0x82AF,0x85AA,0x89AA,0x8A3A,0x8EAB, +0x8F9B,0x9032,0x91DD,0x9707,0x4EBA,0x4EC1,0x5203,0x5875, +0x58EC,0x5C0B,0x751A,0x5C3D,0x814E,0x8A0A,0x8FC5,0x9663, +0x976D,0x7B25,0x8ACF,0x9808,0x9162,0x56F3,0x53A8,0x9017, +0x5439,0x5782,0x5E25,0x63A8,0x6C34,0x708A,0x7761,0x7C8B, +0x7FE0,0x8870,0x9042,0x9154,0x9310,0x9318,0x968F,0x745E, +0x9AC4,0x5D07,0x5D69,0x6570,0x67A2,0x8DA8,0x96DB,0x636E, +0x6749,0x6919,0x83C5,0x9817,0x96C0,0x88FE}; + +/* page 24 0x4021-0x407E */ +static uint16 tab_jisx0208_uni24[]={ +0x6F84,0x647A,0x5BF8,0x4E16,0x702C,0x755D,0x662F,0x51C4, +0x5236,0x52E2,0x59D3,0x5F81,0x6027,0x6210,0x653F,0x6574, +0x661F,0x6674,0x68F2,0x6816,0x6B63,0x6E05,0x7272,0x751F, +0x76DB,0x7CBE,0x8056,0x58F0,0x88FD,0x897F,0x8AA0,0x8A93, +0x8ACB,0x901D,0x9192,0x9752,0x9759,0x6589,0x7A0E,0x8106, +0x96BB,0x5E2D,0x60DC,0x621A,0x65A5,0x6614,0x6790,0x77F3, +0x7A4D,0x7C4D,0x7E3E,0x810A,0x8CAC,0x8D64,0x8DE1,0x8E5F, +0x78A9,0x5207,0x62D9,0x63A5,0x6442,0x6298,0x8A2D,0x7A83, +0x7BC0,0x8AAC,0x96EA,0x7D76,0x820C,0x8749,0x4ED9,0x5148, +0x5343,0x5360,0x5BA3,0x5C02,0x5C16,0x5DDD,0x6226,0x6247, +0x64B0,0x6813,0x6834,0x6CC9,0x6D45,0x6D17,0x67D3,0x6F5C, +0x714E,0x717D,0x65CB,0x7A7F,0x7BAD,0x7DDA}; + +/* page 25 0x4121-0x417E */ +static uint16 tab_jisx0208_uni25[]={ +0x7E4A,0x7FA8,0x817A,0x821B,0x8239,0x85A6,0x8A6E,0x8CCE, +0x8DF5,0x9078,0x9077,0x92AD,0x9291,0x9583,0x9BAE,0x524D, +0x5584,0x6F38,0x7136,0x5168,0x7985,0x7E55,0x81B3,0x7CCE, +0x564C,0x5851,0x5CA8,0x63AA,0x66FE,0x66FD,0x695A,0x72D9, +0x758F,0x758E,0x790E,0x7956,0x79DF,0x7C97,0x7D20,0x7D44, +0x8607,0x8A34,0x963B,0x9061,0x9F20,0x50E7,0x5275,0x53CC, +0x53E2,0x5009,0x55AA,0x58EE,0x594F,0x723D,0x5B8B,0x5C64, +0x531D,0x60E3,0x60F3,0x635C,0x6383,0x633F,0x63BB,0x64CD, +0x65E9,0x66F9,0x5DE3,0x69CD,0x69FD,0x6F15,0x71E5,0x4E89, +0x75E9,0x76F8,0x7A93,0x7CDF,0x7DCF,0x7D9C,0x8061,0x8349, +0x8358,0x846C,0x84BC,0x85FB,0x88C5,0x8D70,0x9001,0x906D, +0x9397,0x971C,0x9A12,0x50CF,0x5897,0x618E}; + +/* page 26 0x4221-0x427E */ +static uint16 tab_jisx0208_uni26[]={ +0x81D3,0x8535,0x8D08,0x9020,0x4FC3,0x5074,0x5247,0x5373, +0x606F,0x6349,0x675F,0x6E2C,0x8DB3,0x901F,0x4FD7,0x5C5E, +0x8CCA,0x65CF,0x7D9A,0x5352,0x8896,0x5176,0x63C3,0x5B58, +0x5B6B,0x5C0A,0x640D,0x6751,0x905C,0x4ED6,0x591A,0x592A, +0x6C70,0x8A51,0x553E,0x5815,0x59A5,0x60F0,0x6253,0x67C1, +0x8235,0x6955,0x9640,0x99C4,0x9A28,0x4F53,0x5806,0x5BFE, +0x8010,0x5CB1,0x5E2F,0x5F85,0x6020,0x614B,0x6234,0x66FF, +0x6CF0,0x6EDE,0x80CE,0x817F,0x82D4,0x888B,0x8CB8,0x9000, +0x902E,0x968A,0x9EDB,0x9BDB,0x4EE3,0x53F0,0x5927,0x7B2C, +0x918D,0x984C,0x9DF9,0x6EDD,0x7027,0x5353,0x5544,0x5B85, +0x6258,0x629E,0x62D3,0x6CA2,0x6FEF,0x7422,0x8A17,0x9438, +0x6FC1,0x8AFE,0x8338,0x51E7,0x86F8,0x53EA}; + +/* page 27 0x4321-0x437E */ +static uint16 tab_jisx0208_uni27[]={ +0x53E9,0x4F46,0x9054,0x8FB0,0x596A,0x8131,0x5DFD,0x7AEA, +0x8FBF,0x68DA,0x8C37,0x72F8,0x9C48,0x6A3D,0x8AB0,0x4E39, +0x5358,0x5606,0x5766,0x62C5,0x63A2,0x65E6,0x6B4E,0x6DE1, +0x6E5B,0x70AD,0x77ED,0x7AEF,0x7BAA,0x7DBB,0x803D,0x80C6, +0x86CB,0x8A95,0x935B,0x56E3,0x58C7,0x5F3E,0x65AD,0x6696, +0x6A80,0x6BB5,0x7537,0x8AC7,0x5024,0x77E5,0x5730,0x5F1B, +0x6065,0x667A,0x6C60,0x75F4,0x7A1A,0x7F6E,0x81F4,0x8718, +0x9045,0x99B3,0x7BC9,0x755C,0x7AF9,0x7B51,0x84C4,0x9010, +0x79E9,0x7A92,0x8336,0x5AE1,0x7740,0x4E2D,0x4EF2,0x5B99, +0x5FE0,0x62BD,0x663C,0x67F1,0x6CE8,0x866B,0x8877,0x8A3B, +0x914E,0x92F3,0x99D0,0x6A17,0x7026,0x732A,0x82E7,0x8457, +0x8CAF,0x4E01,0x5146,0x51CB,0x558B,0x5BF5}; + +/* page 28 0x4421-0x447E */ +static uint16 tab_jisx0208_uni28[]={ +0x5E16,0x5E33,0x5E81,0x5F14,0x5F35,0x5F6B,0x5FB4,0x61F2, +0x6311,0x66A2,0x671D,0x6F6E,0x7252,0x753A,0x773A,0x8074, +0x8139,0x8178,0x8776,0x8ABF,0x8ADC,0x8D85,0x8DF3,0x929A, +0x9577,0x9802,0x9CE5,0x52C5,0x6357,0x76F4,0x6715,0x6C88, +0x73CD,0x8CC3,0x93AE,0x9673,0x6D25,0x589C,0x690E,0x69CC, +0x8FFD,0x939A,0x75DB,0x901A,0x585A,0x6802,0x63B4,0x69FB, +0x4F43,0x6F2C,0x67D8,0x8FBB,0x8526,0x7DB4,0x9354,0x693F, +0x6F70,0x576A,0x58F7,0x5B2C,0x7D2C,0x722A,0x540A,0x91E3, +0x9DB4,0x4EAD,0x4F4E,0x505C,0x5075,0x5243,0x8C9E,0x5448, +0x5824,0x5B9A,0x5E1D,0x5E95,0x5EAD,0x5EF7,0x5F1F,0x608C, +0x62B5,0x633A,0x63D0,0x68AF,0x6C40,0x7887,0x798E,0x7A0B, +0x7DE0,0x8247,0x8A02,0x8AE6,0x8E44,0x9013}; + +/* page 29 0x4521-0x457E */ +static uint16 tab_jisx0208_uni29[]={ +0x90B8,0x912D,0x91D8,0x9F0E,0x6CE5,0x6458,0x64E2,0x6575, +0x6EF4,0x7684,0x7B1B,0x9069,0x93D1,0x6EBA,0x54F2,0x5FB9, +0x64A4,0x8F4D,0x8FED,0x9244,0x5178,0x586B,0x5929,0x5C55, +0x5E97,0x6DFB,0x7E8F,0x751C,0x8CBC,0x8EE2,0x985B,0x70B9, +0x4F1D,0x6BBF,0x6FB1,0x7530,0x96FB,0x514E,0x5410,0x5835, +0x5857,0x59AC,0x5C60,0x5F92,0x6597,0x675C,0x6E21,0x767B, +0x83DF,0x8CED,0x9014,0x90FD,0x934D,0x7825,0x783A,0x52AA, +0x5EA6,0x571F,0x5974,0x6012,0x5012,0x515A,0x51AC,0x51CD, +0x5200,0x5510,0x5854,0x5858,0x5957,0x5B95,0x5CF6,0x5D8B, +0x60BC,0x6295,0x642D,0x6771,0x6843,0x68BC,0x68DF,0x76D7, +0x6DD8,0x6E6F,0x6D9B,0x706F,0x71C8,0x5F53,0x75D8,0x7977, +0x7B49,0x7B54,0x7B52,0x7CD6,0x7D71,0x5230}; + +/* page 30 0x4621-0x467E */ +static uint16 tab_jisx0208_uni30[]={ +0x8463,0x8569,0x85E4,0x8A0E,0x8B04,0x8C46,0x8E0F,0x9003, +0x900F,0x9419,0x9676,0x982D,0x9A30,0x95D8,0x50CD,0x52D5, +0x540C,0x5802,0x5C0E,0x61A7,0x649E,0x6D1E,0x77B3,0x7AE5, +0x80F4,0x8404,0x9053,0x9285,0x5CE0,0x9D07,0x533F,0x5F97, +0x5FB3,0x6D9C,0x7279,0x7763,0x79BF,0x7BE4,0x6BD2,0x72EC, +0x8AAD,0x6803,0x6A61,0x51F8,0x7A81,0x6934,0x5C4A,0x9CF6, +0x82EB,0x5BC5,0x9149,0x701E,0x5678,0x5C6F,0x60C7,0x6566, +0x6C8C,0x8C5A,0x9041,0x9813,0x5451,0x66C7,0x920D,0x5948, +0x90A3,0x5185,0x4E4D,0x51EA,0x8599,0x8B0E,0x7058,0x637A, +0x934B,0x6962,0x99B4,0x7E04,0x7577,0x5357,0x6960,0x8EDF, +0x96E3,0x6C5D,0x4E8C,0x5C3C,0x5F10,0x8FE9,0x5302,0x8CD1, +0x8089,0x8679,0x5EFF,0x65E5,0x4E73,0x5165}; + +/* page 31 0x4721-0x477E */ +static uint16 tab_jisx0208_uni31[]={ +0x5982,0x5C3F,0x97EE,0x4EFB,0x598A,0x5FCD,0x8A8D,0x6FE1, +0x79B0,0x7962,0x5BE7,0x8471,0x732B,0x71B1,0x5E74,0x5FF5, +0x637B,0x649A,0x71C3,0x7C98,0x4E43,0x5EFC,0x4E4B,0x57DC, +0x56A2,0x60A9,0x6FC3,0x7D0D,0x80FD,0x8133,0x81BF,0x8FB2, +0x8997,0x86A4,0x5DF4,0x628A,0x64AD,0x8987,0x6777,0x6CE2, +0x6D3E,0x7436,0x7834,0x5A46,0x7F75,0x82AD,0x99AC,0x4FF3, +0x5EC3,0x62DD,0x6392,0x6557,0x676F,0x76C3,0x724C,0x80CC, +0x80BA,0x8F29,0x914D,0x500D,0x57F9,0x5A92,0x6885,0x6973, +0x7164,0x72FD,0x8CB7,0x58F2,0x8CE0,0x966A,0x9019,0x877F, +0x79E4,0x77E7,0x8429,0x4F2F,0x5265,0x535A,0x62CD,0x67CF, +0x6CCA,0x767D,0x7B94,0x7C95,0x8236,0x8584,0x8FEB,0x66DD, +0x6F20,0x7206,0x7E1B,0x83AB,0x99C1,0x9EA6}; + +/* page 32 0x4821-0x487E */ +static uint16 tab_jisx0208_uni32[]={ +0x51FD,0x7BB1,0x7872,0x7BB8,0x8087,0x7B48,0x6AE8,0x5E61, +0x808C,0x7551,0x7560,0x516B,0x9262,0x6E8C,0x767A,0x9197, +0x9AEA,0x4F10,0x7F70,0x629C,0x7B4F,0x95A5,0x9CE9,0x567A, +0x5859,0x86E4,0x96BC,0x4F34,0x5224,0x534A,0x53CD,0x53DB, +0x5E06,0x642C,0x6591,0x677F,0x6C3E,0x6C4E,0x7248,0x72AF, +0x73ED,0x7554,0x7E41,0x822C,0x85E9,0x8CA9,0x7BC4,0x91C6, +0x7169,0x9812,0x98EF,0x633D,0x6669,0x756A,0x76E4,0x78D0, +0x8543,0x86EE,0x532A,0x5351,0x5426,0x5983,0x5E87,0x5F7C, +0x60B2,0x6249,0x6279,0x62AB,0x6590,0x6BD4,0x6CCC,0x75B2, +0x76AE,0x7891,0x79D8,0x7DCB,0x7F77,0x80A5,0x88AB,0x8AB9, +0x8CBB,0x907F,0x975E,0x98DB,0x6A0B,0x7C38,0x5099,0x5C3E, +0x5FAE,0x6787,0x6BD8,0x7435,0x7709,0x7F8E}; + +/* page 33 0x4921-0x497E */ +static uint16 tab_jisx0208_uni33[]={ +0x9F3B,0x67CA,0x7A17,0x5339,0x758B,0x9AED,0x5F66,0x819D, +0x83F1,0x8098,0x5F3C,0x5FC5,0x7562,0x7B46,0x903C,0x6867, +0x59EB,0x5A9B,0x7D10,0x767E,0x8B2C,0x4FF5,0x5F6A,0x6A19, +0x6C37,0x6F02,0x74E2,0x7968,0x8868,0x8A55,0x8C79,0x5EDF, +0x63CF,0x75C5,0x79D2,0x82D7,0x9328,0x92F2,0x849C,0x86ED, +0x9C2D,0x54C1,0x5F6C,0x658C,0x6D5C,0x7015,0x8CA7,0x8CD3, +0x983B,0x654F,0x74F6,0x4E0D,0x4ED8,0x57E0,0x592B,0x5A66, +0x5BCC,0x51A8,0x5E03,0x5E9C,0x6016,0x6276,0x6577,0x65A7, +0x666E,0x6D6E,0x7236,0x7B26,0x8150,0x819A,0x8299,0x8B5C, +0x8CA0,0x8CE6,0x8D74,0x961C,0x9644,0x4FAE,0x64AB,0x6B66, +0x821E,0x8461,0x856A,0x90E8,0x5C01,0x6953,0x98A8,0x847A, +0x8557,0x4F0F,0x526F,0x5FA9,0x5E45,0x670D}; + +/* page 34 0x4A21-0x4A7E */ +static uint16 tab_jisx0208_uni34[]={ +0x798F,0x8179,0x8907,0x8986,0x6DF5,0x5F17,0x6255,0x6CB8, +0x4ECF,0x7269,0x9B92,0x5206,0x543B,0x5674,0x58B3,0x61A4, +0x626E,0x711A,0x596E,0x7C89,0x7CDE,0x7D1B,0x96F0,0x6587, +0x805E,0x4E19,0x4F75,0x5175,0x5840,0x5E63,0x5E73,0x5F0A, +0x67C4,0x4E26,0x853D,0x9589,0x965B,0x7C73,0x9801,0x50FB, +0x58C1,0x7656,0x78A7,0x5225,0x77A5,0x8511,0x7B86,0x504F, +0x5909,0x7247,0x7BC7,0x7DE8,0x8FBA,0x8FD4,0x904D,0x4FBF, +0x52C9,0x5A29,0x5F01,0x97AD,0x4FDD,0x8217,0x92EA,0x5703, +0x6355,0x6B69,0x752B,0x88DC,0x8F14,0x7A42,0x52DF,0x5893, +0x6155,0x620A,0x66AE,0x6BCD,0x7C3F,0x83E9,0x5023,0x4FF8, +0x5305,0x5446,0x5831,0x5949,0x5B9D,0x5CF0,0x5CEF,0x5D29, +0x5E96,0x62B1,0x6367,0x653E,0x65B9,0x670B}; + +/* page 35 0x4B21-0x4B7E */ +static uint16 tab_jisx0208_uni35[]={ +0x6CD5,0x6CE1,0x70F9,0x7832,0x7E2B,0x80DE,0x82B3,0x840C, +0x84EC,0x8702,0x8912,0x8A2A,0x8C4A,0x90A6,0x92D2,0x98FD, +0x9CF3,0x9D6C,0x4E4F,0x4EA1,0x508D,0x5256,0x574A,0x59A8, +0x5E3D,0x5FD8,0x5FD9,0x623F,0x66B4,0x671B,0x67D0,0x68D2, +0x5192,0x7D21,0x80AA,0x81A8,0x8B00,0x8C8C,0x8CBF,0x927E, +0x9632,0x5420,0x982C,0x5317,0x50D5,0x535C,0x58A8,0x64B2, +0x6734,0x7267,0x7766,0x7A46,0x91E6,0x52C3,0x6CA1,0x6B86, +0x5800,0x5E4C,0x5954,0x672C,0x7FFB,0x51E1,0x76C6,0x6469, +0x78E8,0x9B54,0x9EBB,0x57CB,0x59B9,0x6627,0x679A,0x6BCE, +0x54E9,0x69D9,0x5E55,0x819C,0x6795,0x9BAA,0x67FE,0x9C52, +0x685D,0x4EA6,0x4FE3,0x53C8,0x62B9,0x672B,0x6CAB,0x8FC4, +0x4FAD,0x7E6D,0x9EBF,0x4E07,0x6162,0x6E80}; + +/* page 36 0x4C21-0x4C7E */ +static uint16 tab_jisx0208_uni36[]={ +0x6F2B,0x8513,0x5473,0x672A,0x9B45,0x5DF3,0x7B95,0x5CAC, +0x5BC6,0x871C,0x6E4A,0x84D1,0x7A14,0x8108,0x5999,0x7C8D, +0x6C11,0x7720,0x52D9,0x5922,0x7121,0x725F,0x77DB,0x9727, +0x9D61,0x690B,0x5A7F,0x5A18,0x51A5,0x540D,0x547D,0x660E, +0x76DF,0x8FF7,0x9298,0x9CF4,0x59EA,0x725D,0x6EC5,0x514D, +0x68C9,0x7DBF,0x7DEC,0x9762,0x9EBA,0x6478,0x6A21,0x8302, +0x5984,0x5B5F,0x6BDB,0x731B,0x76F2,0x7DB2,0x8017,0x8499, +0x5132,0x6728,0x9ED9,0x76EE,0x6762,0x52FF,0x9905,0x5C24, +0x623B,0x7C7E,0x8CB0,0x554F,0x60B6,0x7D0B,0x9580,0x5301, +0x4E5F,0x51B6,0x591C,0x723A,0x8036,0x91CE,0x5F25,0x77E2, +0x5384,0x5F79,0x7D04,0x85AC,0x8A33,0x8E8D,0x9756,0x67F3, +0x85AE,0x9453,0x6109,0x6108,0x6CB9,0x7652}; + +/* page 37 0x4D21-0x4D7E */ +static uint16 tab_jisx0208_uni37[]={ +0x8AED,0x8F38,0x552F,0x4F51,0x512A,0x52C7,0x53CB,0x5BA5, +0x5E7D,0x60A0,0x6182,0x63D6,0x6709,0x67DA,0x6E67,0x6D8C, +0x7336,0x7337,0x7531,0x7950,0x88D5,0x8A98,0x904A,0x9091, +0x90F5,0x96C4,0x878D,0x5915,0x4E88,0x4F59,0x4E0E,0x8A89, +0x8F3F,0x9810,0x50AD,0x5E7C,0x5996,0x5BB9,0x5EB8,0x63DA, +0x63FA,0x64C1,0x66DC,0x694A,0x69D8,0x6D0B,0x6EB6,0x7194, +0x7528,0x7AAF,0x7F8A,0x8000,0x8449,0x84C9,0x8981,0x8B21, +0x8E0A,0x9065,0x967D,0x990A,0x617E,0x6291,0x6B32,0x6C83, +0x6D74,0x7FCC,0x7FFC,0x6DC0,0x7F85,0x87BA,0x88F8,0x6765, +0x83B1,0x983C,0x96F7,0x6D1B,0x7D61,0x843D,0x916A,0x4E71, +0x5375,0x5D50,0x6B04,0x6FEB,0x85CD,0x862D,0x89A7,0x5229, +0x540F,0x5C65,0x674E,0x68A8,0x7406,0x7483}; + +/* page 38 0x4E21-0x4E7E */ +static uint16 tab_jisx0208_uni38[]={ +0x75E2,0x88CF,0x88E1,0x91CC,0x96E2,0x9678,0x5F8B,0x7387, +0x7ACB,0x844E,0x63A0,0x7565,0x5289,0x6D41,0x6E9C,0x7409, +0x7559,0x786B,0x7C92,0x9686,0x7ADC,0x9F8D,0x4FB6,0x616E, +0x65C5,0x865C,0x4E86,0x4EAE,0x50DA,0x4E21,0x51CC,0x5BEE, +0x6599,0x6881,0x6DBC,0x731F,0x7642,0x77AD,0x7A1C,0x7CE7, +0x826F,0x8AD2,0x907C,0x91CF,0x9675,0x9818,0x529B,0x7DD1, +0x502B,0x5398,0x6797,0x6DCB,0x71D0,0x7433,0x81E8,0x8F2A, +0x96A3,0x9C57,0x9E9F,0x7460,0x5841,0x6D99,0x7D2F,0x985E, +0x4EE4,0x4F36,0x4F8B,0x51B7,0x52B1,0x5DBA,0x601C,0x73B2, +0x793C,0x82D3,0x9234,0x96B7,0x96F6,0x970A,0x9E97,0x9F62, +0x66A6,0x6B74,0x5217,0x52A3,0x70C8,0x88C2,0x5EC9,0x604B, +0x6190,0x6F23,0x7149,0x7C3E,0x7DF4,0x806F}; + +/* page 39 0x4F21-0x4F53 */ +static uint16 tab_jisx0208_uni39[]={ +0x84EE,0x9023,0x932C,0x5442,0x9B6F,0x6AD3,0x7089,0x8CC2, +0x8DEF,0x9732,0x52B4,0x5A41,0x5ECA,0x5F04,0x6717,0x697C, +0x6994,0x6D6A,0x6F0F,0x7262,0x72FC,0x7BED,0x8001,0x807E, +0x874B,0x90CE,0x516D,0x9E93,0x7984,0x808B,0x9332,0x8AD6, +0x502D,0x548C,0x8A71,0x6B6A,0x8CC4,0x8107,0x60D1,0x67A0, +0x9DF2,0x4E99,0x4E98,0x9C10,0x8A6B,0x85C1,0x8568,0x6900, +0x6E7E,0x7897,0x8155}; + +/* page 40 0x5021-0x507E */ +static uint16 tab_jisx0208_uni40[]={ +0x5F0C,0x4E10,0x4E15,0x4E2A,0x4E31,0x4E36,0x4E3C,0x4E3F, +0x4E42,0x4E56,0x4E58,0x4E82,0x4E85,0x8C6B,0x4E8A,0x8212, +0x5F0D,0x4E8E,0x4E9E,0x4E9F,0x4EA0,0x4EA2,0x4EB0,0x4EB3, +0x4EB6,0x4ECE,0x4ECD,0x4EC4,0x4EC6,0x4EC2,0x4ED7,0x4EDE, +0x4EED,0x4EDF,0x4EF7,0x4F09,0x4F5A,0x4F30,0x4F5B,0x4F5D, +0x4F57,0x4F47,0x4F76,0x4F88,0x4F8F,0x4F98,0x4F7B,0x4F69, +0x4F70,0x4F91,0x4F6F,0x4F86,0x4F96,0x5118,0x4FD4,0x4FDF, +0x4FCE,0x4FD8,0x4FDB,0x4FD1,0x4FDA,0x4FD0,0x4FE4,0x4FE5, +0x501A,0x5028,0x5014,0x502A,0x5025,0x5005,0x4F1C,0x4FF6, +0x5021,0x5029,0x502C,0x4FFE,0x4FEF,0x5011,0x5006,0x5043, +0x5047,0x6703,0x5055,0x5050,0x5048,0x505A,0x5056,0x506C, +0x5078,0x5080,0x509A,0x5085,0x50B4,0x50B2}; + +/* page 41 0x5121-0x517E */ +static uint16 tab_jisx0208_uni41[]={ +0x50C9,0x50CA,0x50B3,0x50C2,0x50D6,0x50DE,0x50E5,0x50ED, +0x50E3,0x50EE,0x50F9,0x50F5,0x5109,0x5101,0x5102,0x5116, +0x5115,0x5114,0x511A,0x5121,0x513A,0x5137,0x513C,0x513B, +0x513F,0x5140,0x5152,0x514C,0x5154,0x5162,0x7AF8,0x5169, +0x516A,0x516E,0x5180,0x5182,0x56D8,0x518C,0x5189,0x518F, +0x5191,0x5193,0x5195,0x5196,0x51A4,0x51A6,0x51A2,0x51A9, +0x51AA,0x51AB,0x51B3,0x51B1,0x51B2,0x51B0,0x51B5,0x51BD, +0x51C5,0x51C9,0x51DB,0x51E0,0x8655,0x51E9,0x51ED,0x51F0, +0x51F5,0x51FE,0x5204,0x520B,0x5214,0x520E,0x5227,0x522A, +0x522E,0x5233,0x5239,0x524F,0x5244,0x524B,0x524C,0x525E, +0x5254,0x526A,0x5274,0x5269,0x5273,0x527F,0x527D,0x528D, +0x5294,0x5292,0x5271,0x5288,0x5291,0x8FA8}; + +/* page 42 0x5221-0x527E */ +static uint16 tab_jisx0208_uni42[]={ +0x8FA7,0x52AC,0x52AD,0x52BC,0x52B5,0x52C1,0x52CD,0x52D7, +0x52DE,0x52E3,0x52E6,0x98ED,0x52E0,0x52F3,0x52F5,0x52F8, +0x52F9,0x5306,0x5308,0x7538,0x530D,0x5310,0x530F,0x5315, +0x531A,0x5323,0x532F,0x5331,0x5333,0x5338,0x5340,0x5346, +0x5345,0x4E17,0x5349,0x534D,0x51D6,0x535E,0x5369,0x536E, +0x5918,0x537B,0x5377,0x5382,0x5396,0x53A0,0x53A6,0x53A5, +0x53AE,0x53B0,0x53B6,0x53C3,0x7C12,0x96D9,0x53DF,0x66FC, +0x71EE,0x53EE,0x53E8,0x53ED,0x53FA,0x5401,0x543D,0x5440, +0x542C,0x542D,0x543C,0x542E,0x5436,0x5429,0x541D,0x544E, +0x548F,0x5475,0x548E,0x545F,0x5471,0x5477,0x5470,0x5492, +0x547B,0x5480,0x5476,0x5484,0x5490,0x5486,0x54C7,0x54A2, +0x54B8,0x54A5,0x54AC,0x54C4,0x54C8,0x54A8}; + +/* page 43 0x5321-0x537E */ +static uint16 tab_jisx0208_uni43[]={ +0x54AB,0x54C2,0x54A4,0x54BE,0x54BC,0x54D8,0x54E5,0x54E6, +0x550F,0x5514,0x54FD,0x54EE,0x54ED,0x54FA,0x54E2,0x5539, +0x5540,0x5563,0x554C,0x552E,0x555C,0x5545,0x5556,0x5557, +0x5538,0x5533,0x555D,0x5599,0x5580,0x54AF,0x558A,0x559F, +0x557B,0x557E,0x5598,0x559E,0x55AE,0x557C,0x5583,0x55A9, +0x5587,0x55A8,0x55DA,0x55C5,0x55DF,0x55C4,0x55DC,0x55E4, +0x55D4,0x5614,0x55F7,0x5616,0x55FE,0x55FD,0x561B,0x55F9, +0x564E,0x5650,0x71DF,0x5634,0x5636,0x5632,0x5638,0x566B, +0x5664,0x562F,0x566C,0x566A,0x5686,0x5680,0x568A,0x56A0, +0x5694,0x568F,0x56A5,0x56AE,0x56B6,0x56B4,0x56C2,0x56BC, +0x56C1,0x56C3,0x56C0,0x56C8,0x56CE,0x56D1,0x56D3,0x56D7, +0x56EE,0x56F9,0x5700,0x56FF,0x5704,0x5709}; + +/* page 44 0x5421-0x547E */ +static uint16 tab_jisx0208_uni44[]={ +0x5708,0x570B,0x570D,0x5713,0x5718,0x5716,0x55C7,0x571C, +0x5726,0x5737,0x5738,0x574E,0x573B,0x5740,0x574F,0x5769, +0x57C0,0x5788,0x5761,0x577F,0x5789,0x5793,0x57A0,0x57B3, +0x57A4,0x57AA,0x57B0,0x57C3,0x57C6,0x57D4,0x57D2,0x57D3, +0x580A,0x57D6,0x57E3,0x580B,0x5819,0x581D,0x5872,0x5821, +0x5862,0x584B,0x5870,0x6BC0,0x5852,0x583D,0x5879,0x5885, +0x58B9,0x589F,0x58AB,0x58BA,0x58DE,0x58BB,0x58B8,0x58AE, +0x58C5,0x58D3,0x58D1,0x58D7,0x58D9,0x58D8,0x58E5,0x58DC, +0x58E4,0x58DF,0x58EF,0x58FA,0x58F9,0x58FB,0x58FC,0x58FD, +0x5902,0x590A,0x5910,0x591B,0x68A6,0x5925,0x592C,0x592D, +0x5932,0x5938,0x593E,0x7AD2,0x5955,0x5950,0x594E,0x595A, +0x5958,0x5962,0x5960,0x5967,0x596C,0x5969}; + +/* page 45 0x5521-0x557E */ +static uint16 tab_jisx0208_uni45[]={ +0x5978,0x5981,0x599D,0x4F5E,0x4FAB,0x59A3,0x59B2,0x59C6, +0x59E8,0x59DC,0x598D,0x59D9,0x59DA,0x5A25,0x5A1F,0x5A11, +0x5A1C,0x5A09,0x5A1A,0x5A40,0x5A6C,0x5A49,0x5A35,0x5A36, +0x5A62,0x5A6A,0x5A9A,0x5ABC,0x5ABE,0x5ACB,0x5AC2,0x5ABD, +0x5AE3,0x5AD7,0x5AE6,0x5AE9,0x5AD6,0x5AFA,0x5AFB,0x5B0C, +0x5B0B,0x5B16,0x5B32,0x5AD0,0x5B2A,0x5B36,0x5B3E,0x5B43, +0x5B45,0x5B40,0x5B51,0x5B55,0x5B5A,0x5B5B,0x5B65,0x5B69, +0x5B70,0x5B73,0x5B75,0x5B78,0x6588,0x5B7A,0x5B80,0x5B83, +0x5BA6,0x5BB8,0x5BC3,0x5BC7,0x5BC9,0x5BD4,0x5BD0,0x5BE4, +0x5BE6,0x5BE2,0x5BDE,0x5BE5,0x5BEB,0x5BF0,0x5BF6,0x5BF3, +0x5C05,0x5C07,0x5C08,0x5C0D,0x5C13,0x5C20,0x5C22,0x5C28, +0x5C38,0x5C39,0x5C41,0x5C46,0x5C4E,0x5C53}; + +/* page 46 0x5621-0x567E */ +static uint16 tab_jisx0208_uni46[]={ +0x5C50,0x5C4F,0x5B71,0x5C6C,0x5C6E,0x4E62,0x5C76,0x5C79, +0x5C8C,0x5C91,0x5C94,0x599B,0x5CAB,0x5CBB,0x5CB6,0x5CBC, +0x5CB7,0x5CC5,0x5CBE,0x5CC7,0x5CD9,0x5CE9,0x5CFD,0x5CFA, +0x5CED,0x5D8C,0x5CEA,0x5D0B,0x5D15,0x5D17,0x5D5C,0x5D1F, +0x5D1B,0x5D11,0x5D14,0x5D22,0x5D1A,0x5D19,0x5D18,0x5D4C, +0x5D52,0x5D4E,0x5D4B,0x5D6C,0x5D73,0x5D76,0x5D87,0x5D84, +0x5D82,0x5DA2,0x5D9D,0x5DAC,0x5DAE,0x5DBD,0x5D90,0x5DB7, +0x5DBC,0x5DC9,0x5DCD,0x5DD3,0x5DD2,0x5DD6,0x5DDB,0x5DEB, +0x5DF2,0x5DF5,0x5E0B,0x5E1A,0x5E19,0x5E11,0x5E1B,0x5E36, +0x5E37,0x5E44,0x5E43,0x5E40,0x5E4E,0x5E57,0x5E54,0x5E5F, +0x5E62,0x5E64,0x5E47,0x5E75,0x5E76,0x5E7A,0x9EBC,0x5E7F, +0x5EA0,0x5EC1,0x5EC2,0x5EC8,0x5ED0,0x5ECF}; + +/* page 47 0x5721-0x577E */ +static uint16 tab_jisx0208_uni47[]={ +0x5ED6,0x5EE3,0x5EDD,0x5EDA,0x5EDB,0x5EE2,0x5EE1,0x5EE8, +0x5EE9,0x5EEC,0x5EF1,0x5EF3,0x5EF0,0x5EF4,0x5EF8,0x5EFE, +0x5F03,0x5F09,0x5F5D,0x5F5C,0x5F0B,0x5F11,0x5F16,0x5F29, +0x5F2D,0x5F38,0x5F41,0x5F48,0x5F4C,0x5F4E,0x5F2F,0x5F51, +0x5F56,0x5F57,0x5F59,0x5F61,0x5F6D,0x5F73,0x5F77,0x5F83, +0x5F82,0x5F7F,0x5F8A,0x5F88,0x5F91,0x5F87,0x5F9E,0x5F99, +0x5F98,0x5FA0,0x5FA8,0x5FAD,0x5FBC,0x5FD6,0x5FFB,0x5FE4, +0x5FF8,0x5FF1,0x5FDD,0x60B3,0x5FFF,0x6021,0x6060,0x6019, +0x6010,0x6029,0x600E,0x6031,0x601B,0x6015,0x602B,0x6026, +0x600F,0x603A,0x605A,0x6041,0x606A,0x6077,0x605F,0x604A, +0x6046,0x604D,0x6063,0x6043,0x6064,0x6042,0x606C,0x606B, +0x6059,0x6081,0x608D,0x60E7,0x6083,0x609A}; + +/* page 48 0x5821-0x587E */ +static uint16 tab_jisx0208_uni48[]={ +0x6084,0x609B,0x6096,0x6097,0x6092,0x60A7,0x608B,0x60E1, +0x60B8,0x60E0,0x60D3,0x60B4,0x5FF0,0x60BD,0x60C6,0x60B5, +0x60D8,0x614D,0x6115,0x6106,0x60F6,0x60F7,0x6100,0x60F4, +0x60FA,0x6103,0x6121,0x60FB,0x60F1,0x610D,0x610E,0x6147, +0x613E,0x6128,0x6127,0x614A,0x613F,0x613C,0x612C,0x6134, +0x613D,0x6142,0x6144,0x6173,0x6177,0x6158,0x6159,0x615A, +0x616B,0x6174,0x616F,0x6165,0x6171,0x615F,0x615D,0x6153, +0x6175,0x6199,0x6196,0x6187,0x61AC,0x6194,0x619A,0x618A, +0x6191,0x61AB,0x61AE,0x61CC,0x61CA,0x61C9,0x61F7,0x61C8, +0x61C3,0x61C6,0x61BA,0x61CB,0x7F79,0x61CD,0x61E6,0x61E3, +0x61F6,0x61FA,0x61F4,0x61FF,0x61FD,0x61FC,0x61FE,0x6200, +0x6208,0x6209,0x620D,0x620C,0x6214,0x621B}; + +/* page 49 0x5921-0x597E */ +static uint16 tab_jisx0208_uni49[]={ +0x621E,0x6221,0x622A,0x622E,0x6230,0x6232,0x6233,0x6241, +0x624E,0x625E,0x6263,0x625B,0x6260,0x6268,0x627C,0x6282, +0x6289,0x627E,0x6292,0x6293,0x6296,0x62D4,0x6283,0x6294, +0x62D7,0x62D1,0x62BB,0x62CF,0x62FF,0x62C6,0x64D4,0x62C8, +0x62DC,0x62CC,0x62CA,0x62C2,0x62C7,0x629B,0x62C9,0x630C, +0x62EE,0x62F1,0x6327,0x6302,0x6308,0x62EF,0x62F5,0x6350, +0x633E,0x634D,0x641C,0x634F,0x6396,0x638E,0x6380,0x63AB, +0x6376,0x63A3,0x638F,0x6389,0x639F,0x63B5,0x636B,0x6369, +0x63BE,0x63E9,0x63C0,0x63C6,0x63E3,0x63C9,0x63D2,0x63F6, +0x63C4,0x6416,0x6434,0x6406,0x6413,0x6426,0x6436,0x651D, +0x6417,0x6428,0x640F,0x6467,0x646F,0x6476,0x644E,0x652A, +0x6495,0x6493,0x64A5,0x64A9,0x6488,0x64BC}; + +/* page 50 0x5A21-0x5A7E */ +static uint16 tab_jisx0208_uni50[]={ +0x64DA,0x64D2,0x64C5,0x64C7,0x64BB,0x64D8,0x64C2,0x64F1, +0x64E7,0x8209,0x64E0,0x64E1,0x62AC,0x64E3,0x64EF,0x652C, +0x64F6,0x64F4,0x64F2,0x64FA,0x6500,0x64FD,0x6518,0x651C, +0x6505,0x6524,0x6523,0x652B,0x6534,0x6535,0x6537,0x6536, +0x6538,0x754B,0x6548,0x6556,0x6555,0x654D,0x6558,0x655E, +0x655D,0x6572,0x6578,0x6582,0x6583,0x8B8A,0x659B,0x659F, +0x65AB,0x65B7,0x65C3,0x65C6,0x65C1,0x65C4,0x65CC,0x65D2, +0x65DB,0x65D9,0x65E0,0x65E1,0x65F1,0x6772,0x660A,0x6603, +0x65FB,0x6773,0x6635,0x6636,0x6634,0x661C,0x664F,0x6644, +0x6649,0x6641,0x665E,0x665D,0x6664,0x6667,0x6668,0x665F, +0x6662,0x6670,0x6683,0x6688,0x668E,0x6689,0x6684,0x6698, +0x669D,0x66C1,0x66B9,0x66C9,0x66BE,0x66BC}; + +/* page 51 0x5B21-0x5B7E */ +static uint16 tab_jisx0208_uni51[]={ +0x66C4,0x66B8,0x66D6,0x66DA,0x66E0,0x663F,0x66E6,0x66E9, +0x66F0,0x66F5,0x66F7,0x670F,0x6716,0x671E,0x6726,0x6727, +0x9738,0x672E,0x673F,0x6736,0x6741,0x6738,0x6737,0x6746, +0x675E,0x6760,0x6759,0x6763,0x6764,0x6789,0x6770,0x67A9, +0x677C,0x676A,0x678C,0x678B,0x67A6,0x67A1,0x6785,0x67B7, +0x67EF,0x67B4,0x67EC,0x67B3,0x67E9,0x67B8,0x67E4,0x67DE, +0x67DD,0x67E2,0x67EE,0x67B9,0x67CE,0x67C6,0x67E7,0x6A9C, +0x681E,0x6846,0x6829,0x6840,0x684D,0x6832,0x684E,0x68B3, +0x682B,0x6859,0x6863,0x6877,0x687F,0x689F,0x688F,0x68AD, +0x6894,0x689D,0x689B,0x6883,0x6AAE,0x68B9,0x6874,0x68B5, +0x68A0,0x68BA,0x690F,0x688D,0x687E,0x6901,0x68CA,0x6908, +0x68D8,0x6922,0x6926,0x68E1,0x690C,0x68CD}; + +/* page 52 0x5C21-0x5C7E */ +static uint16 tab_jisx0208_uni52[]={ +0x68D4,0x68E7,0x68D5,0x6936,0x6912,0x6904,0x68D7,0x68E3, +0x6925,0x68F9,0x68E0,0x68EF,0x6928,0x692A,0x691A,0x6923, +0x6921,0x68C6,0x6979,0x6977,0x695C,0x6978,0x696B,0x6954, +0x697E,0x696E,0x6939,0x6974,0x693D,0x6959,0x6930,0x6961, +0x695E,0x695D,0x6981,0x696A,0x69B2,0x69AE,0x69D0,0x69BF, +0x69C1,0x69D3,0x69BE,0x69CE,0x5BE8,0x69CA,0x69DD,0x69BB, +0x69C3,0x69A7,0x6A2E,0x6991,0x69A0,0x699C,0x6995,0x69B4, +0x69DE,0x69E8,0x6A02,0x6A1B,0x69FF,0x6B0A,0x69F9,0x69F2, +0x69E7,0x6A05,0x69B1,0x6A1E,0x69ED,0x6A14,0x69EB,0x6A0A, +0x6A12,0x6AC1,0x6A23,0x6A13,0x6A44,0x6A0C,0x6A72,0x6A36, +0x6A78,0x6A47,0x6A62,0x6A59,0x6A66,0x6A48,0x6A38,0x6A22, +0x6A90,0x6A8D,0x6AA0,0x6A84,0x6AA2,0x6AA3}; + +/* page 53 0x5D21-0x5D7E */ +static uint16 tab_jisx0208_uni53[]={ +0x6A97,0x8617,0x6ABB,0x6AC3,0x6AC2,0x6AB8,0x6AB3,0x6AAC, +0x6ADE,0x6AD1,0x6ADF,0x6AAA,0x6ADA,0x6AEA,0x6AFB,0x6B05, +0x8616,0x6AFA,0x6B12,0x6B16,0x9B31,0x6B1F,0x6B38,0x6B37, +0x76DC,0x6B39,0x98EE,0x6B47,0x6B43,0x6B49,0x6B50,0x6B59, +0x6B54,0x6B5B,0x6B5F,0x6B61,0x6B78,0x6B79,0x6B7F,0x6B80, +0x6B84,0x6B83,0x6B8D,0x6B98,0x6B95,0x6B9E,0x6BA4,0x6BAA, +0x6BAB,0x6BAF,0x6BB2,0x6BB1,0x6BB3,0x6BB7,0x6BBC,0x6BC6, +0x6BCB,0x6BD3,0x6BDF,0x6BEC,0x6BEB,0x6BF3,0x6BEF,0x9EBE, +0x6C08,0x6C13,0x6C14,0x6C1B,0x6C24,0x6C23,0x6C5E,0x6C55, +0x6C62,0x6C6A,0x6C82,0x6C8D,0x6C9A,0x6C81,0x6C9B,0x6C7E, +0x6C68,0x6C73,0x6C92,0x6C90,0x6CC4,0x6CF1,0x6CD3,0x6CBD, +0x6CD7,0x6CC5,0x6CDD,0x6CAE,0x6CB1,0x6CBE}; + +/* page 54 0x5E21-0x5E7E */ +static uint16 tab_jisx0208_uni54[]={ +0x6CBA,0x6CDB,0x6CEF,0x6CD9,0x6CEA,0x6D1F,0x884D,0x6D36, +0x6D2B,0x6D3D,0x6D38,0x6D19,0x6D35,0x6D33,0x6D12,0x6D0C, +0x6D63,0x6D93,0x6D64,0x6D5A,0x6D79,0x6D59,0x6D8E,0x6D95, +0x6FE4,0x6D85,0x6DF9,0x6E15,0x6E0A,0x6DB5,0x6DC7,0x6DE6, +0x6DB8,0x6DC6,0x6DEC,0x6DDE,0x6DCC,0x6DE8,0x6DD2,0x6DC5, +0x6DFA,0x6DD9,0x6DE4,0x6DD5,0x6DEA,0x6DEE,0x6E2D,0x6E6E, +0x6E2E,0x6E19,0x6E72,0x6E5F,0x6E3E,0x6E23,0x6E6B,0x6E2B, +0x6E76,0x6E4D,0x6E1F,0x6E43,0x6E3A,0x6E4E,0x6E24,0x6EFF, +0x6E1D,0x6E38,0x6E82,0x6EAA,0x6E98,0x6EC9,0x6EB7,0x6ED3, +0x6EBD,0x6EAF,0x6EC4,0x6EB2,0x6ED4,0x6ED5,0x6E8F,0x6EA5, +0x6EC2,0x6E9F,0x6F41,0x6F11,0x704C,0x6EEC,0x6EF8,0x6EFE, +0x6F3F,0x6EF2,0x6F31,0x6EEF,0x6F32,0x6ECC}; + +/* page 55 0x5F21-0x5F7E */ +static uint16 tab_jisx0208_uni55[]={ +0x6F3E,0x6F13,0x6EF7,0x6F86,0x6F7A,0x6F78,0x6F81,0x6F80, +0x6F6F,0x6F5B,0x6FF3,0x6F6D,0x6F82,0x6F7C,0x6F58,0x6F8E, +0x6F91,0x6FC2,0x6F66,0x6FB3,0x6FA3,0x6FA1,0x6FA4,0x6FB9, +0x6FC6,0x6FAA,0x6FDF,0x6FD5,0x6FEC,0x6FD4,0x6FD8,0x6FF1, +0x6FEE,0x6FDB,0x7009,0x700B,0x6FFA,0x7011,0x7001,0x700F, +0x6FFE,0x701B,0x701A,0x6F74,0x701D,0x7018,0x701F,0x7030, +0x703E,0x7032,0x7051,0x7063,0x7099,0x7092,0x70AF,0x70F1, +0x70AC,0x70B8,0x70B3,0x70AE,0x70DF,0x70CB,0x70DD,0x70D9, +0x7109,0x70FD,0x711C,0x7119,0x7165,0x7155,0x7188,0x7166, +0x7162,0x714C,0x7156,0x716C,0x718F,0x71FB,0x7184,0x7195, +0x71A8,0x71AC,0x71D7,0x71B9,0x71BE,0x71D2,0x71C9,0x71D4, +0x71CE,0x71E0,0x71EC,0x71E7,0x71F5,0x71FC}; + +/* page 56 0x6021-0x607E */ +static uint16 tab_jisx0208_uni56[]={ +0x71F9,0x71FF,0x720D,0x7210,0x721B,0x7228,0x722D,0x722C, +0x7230,0x7232,0x723B,0x723C,0x723F,0x7240,0x7246,0x724B, +0x7258,0x7274,0x727E,0x7282,0x7281,0x7287,0x7292,0x7296, +0x72A2,0x72A7,0x72B9,0x72B2,0x72C3,0x72C6,0x72C4,0x72CE, +0x72D2,0x72E2,0x72E0,0x72E1,0x72F9,0x72F7,0x500F,0x7317, +0x730A,0x731C,0x7316,0x731D,0x7334,0x732F,0x7329,0x7325, +0x733E,0x734E,0x734F,0x9ED8,0x7357,0x736A,0x7368,0x7370, +0x7378,0x7375,0x737B,0x737A,0x73C8,0x73B3,0x73CE,0x73BB, +0x73C0,0x73E5,0x73EE,0x73DE,0x74A2,0x7405,0x746F,0x7425, +0x73F8,0x7432,0x743A,0x7455,0x743F,0x745F,0x7459,0x7441, +0x745C,0x7469,0x7470,0x7463,0x746A,0x7476,0x747E,0x748B, +0x749E,0x74A7,0x74CA,0x74CF,0x74D4,0x73F1}; + +/* page 57 0x6121-0x617E */ +static uint16 tab_jisx0208_uni57[]={ +0x74E0,0x74E3,0x74E7,0x74E9,0x74EE,0x74F2,0x74F0,0x74F1, +0x74F8,0x74F7,0x7504,0x7503,0x7505,0x750C,0x750E,0x750D, +0x7515,0x7513,0x751E,0x7526,0x752C,0x753C,0x7544,0x754D, +0x754A,0x7549,0x755B,0x7546,0x755A,0x7569,0x7564,0x7567, +0x756B,0x756D,0x7578,0x7576,0x7586,0x7587,0x7574,0x758A, +0x7589,0x7582,0x7594,0x759A,0x759D,0x75A5,0x75A3,0x75C2, +0x75B3,0x75C3,0x75B5,0x75BD,0x75B8,0x75BC,0x75B1,0x75CD, +0x75CA,0x75D2,0x75D9,0x75E3,0x75DE,0x75FE,0x75FF,0x75FC, +0x7601,0x75F0,0x75FA,0x75F2,0x75F3,0x760B,0x760D,0x7609, +0x761F,0x7627,0x7620,0x7621,0x7622,0x7624,0x7634,0x7630, +0x763B,0x7647,0x7648,0x7646,0x765C,0x7658,0x7661,0x7662, +0x7668,0x7669,0x766A,0x7667,0x766C,0x7670}; + +/* page 58 0x6221-0x627E */ +static uint16 tab_jisx0208_uni58[]={ +0x7672,0x7676,0x7678,0x767C,0x7680,0x7683,0x7688,0x768B, +0x768E,0x7696,0x7693,0x7699,0x769A,0x76B0,0x76B4,0x76B8, +0x76B9,0x76BA,0x76C2,0x76CD,0x76D6,0x76D2,0x76DE,0x76E1, +0x76E5,0x76E7,0x76EA,0x862F,0x76FB,0x7708,0x7707,0x7704, +0x7729,0x7724,0x771E,0x7725,0x7726,0x771B,0x7737,0x7738, +0x7747,0x775A,0x7768,0x776B,0x775B,0x7765,0x777F,0x777E, +0x7779,0x778E,0x778B,0x7791,0x77A0,0x779E,0x77B0,0x77B6, +0x77B9,0x77BF,0x77BC,0x77BD,0x77BB,0x77C7,0x77CD,0x77D7, +0x77DA,0x77DC,0x77E3,0x77EE,0x77FC,0x780C,0x7812,0x7926, +0x7820,0x792A,0x7845,0x788E,0x7874,0x7886,0x787C,0x789A, +0x788C,0x78A3,0x78B5,0x78AA,0x78AF,0x78D1,0x78C6,0x78CB, +0x78D4,0x78BE,0x78BC,0x78C5,0x78CA,0x78EC}; + +/* page 59 0x6321-0x637E */ +static uint16 tab_jisx0208_uni59[]={ +0x78E7,0x78DA,0x78FD,0x78F4,0x7907,0x7912,0x7911,0x7919, +0x792C,0x792B,0x7940,0x7960,0x7957,0x795F,0x795A,0x7955, +0x7953,0x797A,0x797F,0x798A,0x799D,0x79A7,0x9F4B,0x79AA, +0x79AE,0x79B3,0x79B9,0x79BA,0x79C9,0x79D5,0x79E7,0x79EC, +0x79E1,0x79E3,0x7A08,0x7A0D,0x7A18,0x7A19,0x7A20,0x7A1F, +0x7980,0x7A31,0x7A3B,0x7A3E,0x7A37,0x7A43,0x7A57,0x7A49, +0x7A61,0x7A62,0x7A69,0x9F9D,0x7A70,0x7A79,0x7A7D,0x7A88, +0x7A97,0x7A95,0x7A98,0x7A96,0x7AA9,0x7AC8,0x7AB0,0x7AB6, +0x7AC5,0x7AC4,0x7ABF,0x9083,0x7AC7,0x7ACA,0x7ACD,0x7ACF, +0x7AD5,0x7AD3,0x7AD9,0x7ADA,0x7ADD,0x7AE1,0x7AE2,0x7AE6, +0x7AED,0x7AF0,0x7B02,0x7B0F,0x7B0A,0x7B06,0x7B33,0x7B18, +0x7B19,0x7B1E,0x7B35,0x7B28,0x7B36,0x7B50}; + +/* page 60 0x6421-0x647E */ +static uint16 tab_jisx0208_uni60[]={ +0x7B7A,0x7B04,0x7B4D,0x7B0B,0x7B4C,0x7B45,0x7B75,0x7B65, +0x7B74,0x7B67,0x7B70,0x7B71,0x7B6C,0x7B6E,0x7B9D,0x7B98, +0x7B9F,0x7B8D,0x7B9C,0x7B9A,0x7B8B,0x7B92,0x7B8F,0x7B5D, +0x7B99,0x7BCB,0x7BC1,0x7BCC,0x7BCF,0x7BB4,0x7BC6,0x7BDD, +0x7BE9,0x7C11,0x7C14,0x7BE6,0x7BE5,0x7C60,0x7C00,0x7C07, +0x7C13,0x7BF3,0x7BF7,0x7C17,0x7C0D,0x7BF6,0x7C23,0x7C27, +0x7C2A,0x7C1F,0x7C37,0x7C2B,0x7C3D,0x7C4C,0x7C43,0x7C54, +0x7C4F,0x7C40,0x7C50,0x7C58,0x7C5F,0x7C64,0x7C56,0x7C65, +0x7C6C,0x7C75,0x7C83,0x7C90,0x7CA4,0x7CAD,0x7CA2,0x7CAB, +0x7CA1,0x7CA8,0x7CB3,0x7CB2,0x7CB1,0x7CAE,0x7CB9,0x7CBD, +0x7CC0,0x7CC5,0x7CC2,0x7CD8,0x7CD2,0x7CDC,0x7CE2,0x9B3B, +0x7CEF,0x7CF2,0x7CF4,0x7CF6,0x7CFA,0x7D06}; + +/* page 61 0x6521-0x657E */ +static uint16 tab_jisx0208_uni61[]={ +0x7D02,0x7D1C,0x7D15,0x7D0A,0x7D45,0x7D4B,0x7D2E,0x7D32, +0x7D3F,0x7D35,0x7D46,0x7D73,0x7D56,0x7D4E,0x7D72,0x7D68, +0x7D6E,0x7D4F,0x7D63,0x7D93,0x7D89,0x7D5B,0x7D8F,0x7D7D, +0x7D9B,0x7DBA,0x7DAE,0x7DA3,0x7DB5,0x7DC7,0x7DBD,0x7DAB, +0x7E3D,0x7DA2,0x7DAF,0x7DDC,0x7DB8,0x7D9F,0x7DB0,0x7DD8, +0x7DDD,0x7DE4,0x7DDE,0x7DFB,0x7DF2,0x7DE1,0x7E05,0x7E0A, +0x7E23,0x7E21,0x7E12,0x7E31,0x7E1F,0x7E09,0x7E0B,0x7E22, +0x7E46,0x7E66,0x7E3B,0x7E35,0x7E39,0x7E43,0x7E37,0x7E32, +0x7E3A,0x7E67,0x7E5D,0x7E56,0x7E5E,0x7E59,0x7E5A,0x7E79, +0x7E6A,0x7E69,0x7E7C,0x7E7B,0x7E83,0x7DD5,0x7E7D,0x8FAE, +0x7E7F,0x7E88,0x7E89,0x7E8C,0x7E92,0x7E90,0x7E93,0x7E94, +0x7E96,0x7E8E,0x7E9B,0x7E9C,0x7F38,0x7F3A}; + +/* page 62 0x6621-0x667E */ +static uint16 tab_jisx0208_uni62[]={ +0x7F45,0x7F4C,0x7F4D,0x7F4E,0x7F50,0x7F51,0x7F55,0x7F54, +0x7F58,0x7F5F,0x7F60,0x7F68,0x7F69,0x7F67,0x7F78,0x7F82, +0x7F86,0x7F83,0x7F88,0x7F87,0x7F8C,0x7F94,0x7F9E,0x7F9D, +0x7F9A,0x7FA3,0x7FAF,0x7FB2,0x7FB9,0x7FAE,0x7FB6,0x7FB8, +0x8B71,0x7FC5,0x7FC6,0x7FCA,0x7FD5,0x7FD4,0x7FE1,0x7FE6, +0x7FE9,0x7FF3,0x7FF9,0x98DC,0x8006,0x8004,0x800B,0x8012, +0x8018,0x8019,0x801C,0x8021,0x8028,0x803F,0x803B,0x804A, +0x8046,0x8052,0x8058,0x805A,0x805F,0x8062,0x8068,0x8073, +0x8072,0x8070,0x8076,0x8079,0x807D,0x807F,0x8084,0x8086, +0x8085,0x809B,0x8093,0x809A,0x80AD,0x5190,0x80AC,0x80DB, +0x80E5,0x80D9,0x80DD,0x80C4,0x80DA,0x80D6,0x8109,0x80EF, +0x80F1,0x811B,0x8129,0x8123,0x812F,0x814B}; + +/* page 63 0x6721-0x677E */ +static uint16 tab_jisx0208_uni63[]={ +0x968B,0x8146,0x813E,0x8153,0x8151,0x80FC,0x8171,0x816E, +0x8165,0x8166,0x8174,0x8183,0x8188,0x818A,0x8180,0x8182, +0x81A0,0x8195,0x81A4,0x81A3,0x815F,0x8193,0x81A9,0x81B0, +0x81B5,0x81BE,0x81B8,0x81BD,0x81C0,0x81C2,0x81BA,0x81C9, +0x81CD,0x81D1,0x81D9,0x81D8,0x81C8,0x81DA,0x81DF,0x81E0, +0x81E7,0x81FA,0x81FB,0x81FE,0x8201,0x8202,0x8205,0x8207, +0x820A,0x820D,0x8210,0x8216,0x8229,0x822B,0x8238,0x8233, +0x8240,0x8259,0x8258,0x825D,0x825A,0x825F,0x8264,0x8262, +0x8268,0x826A,0x826B,0x822E,0x8271,0x8277,0x8278,0x827E, +0x828D,0x8292,0x82AB,0x829F,0x82BB,0x82AC,0x82E1,0x82E3, +0x82DF,0x82D2,0x82F4,0x82F3,0x82FA,0x8393,0x8303,0x82FB, +0x82F9,0x82DE,0x8306,0x82DC,0x8309,0x82D9}; + +/* page 64 0x6821-0x687E */ +static uint16 tab_jisx0208_uni64[]={ +0x8335,0x8334,0x8316,0x8332,0x8331,0x8340,0x8339,0x8350, +0x8345,0x832F,0x832B,0x8317,0x8318,0x8385,0x839A,0x83AA, +0x839F,0x83A2,0x8396,0x8323,0x838E,0x8387,0x838A,0x837C, +0x83B5,0x8373,0x8375,0x83A0,0x8389,0x83A8,0x83F4,0x8413, +0x83EB,0x83CE,0x83FD,0x8403,0x83D8,0x840B,0x83C1,0x83F7, +0x8407,0x83E0,0x83F2,0x840D,0x8422,0x8420,0x83BD,0x8438, +0x8506,0x83FB,0x846D,0x842A,0x843C,0x855A,0x8484,0x8477, +0x846B,0x84AD,0x846E,0x8482,0x8469,0x8446,0x842C,0x846F, +0x8479,0x8435,0x84CA,0x8462,0x84B9,0x84BF,0x849F,0x84D9, +0x84CD,0x84BB,0x84DA,0x84D0,0x84C1,0x84C6,0x84D6,0x84A1, +0x8521,0x84FF,0x84F4,0x8517,0x8518,0x852C,0x851F,0x8515, +0x8514,0x84FC,0x8540,0x8563,0x8558,0x8548}; + +/* page 65 0x6921-0x697E */ +static uint16 tab_jisx0208_uni65[]={ +0x8541,0x8602,0x854B,0x8555,0x8580,0x85A4,0x8588,0x8591, +0x858A,0x85A8,0x856D,0x8594,0x859B,0x85EA,0x8587,0x859C, +0x8577,0x857E,0x8590,0x85C9,0x85BA,0x85CF,0x85B9,0x85D0, +0x85D5,0x85DD,0x85E5,0x85DC,0x85F9,0x860A,0x8613,0x860B, +0x85FE,0x85FA,0x8606,0x8622,0x861A,0x8630,0x863F,0x864D, +0x4E55,0x8654,0x865F,0x8667,0x8671,0x8693,0x86A3,0x86A9, +0x86AA,0x868B,0x868C,0x86B6,0x86AF,0x86C4,0x86C6,0x86B0, +0x86C9,0x8823,0x86AB,0x86D4,0x86DE,0x86E9,0x86EC,0x86DF, +0x86DB,0x86EF,0x8712,0x8706,0x8708,0x8700,0x8703,0x86FB, +0x8711,0x8709,0x870D,0x86F9,0x870A,0x8734,0x873F,0x8737, +0x873B,0x8725,0x8729,0x871A,0x8760,0x875F,0x8778,0x874C, +0x874E,0x8774,0x8757,0x8768,0x876E,0x8759}; + +/* page 66 0x6A21-0x6A7E */ +static uint16 tab_jisx0208_uni66[]={ +0x8753,0x8763,0x876A,0x8805,0x87A2,0x879F,0x8782,0x87AF, +0x87CB,0x87BD,0x87C0,0x87D0,0x96D6,0x87AB,0x87C4,0x87B3, +0x87C7,0x87C6,0x87BB,0x87EF,0x87F2,0x87E0,0x880F,0x880D, +0x87FE,0x87F6,0x87F7,0x880E,0x87D2,0x8811,0x8816,0x8815, +0x8822,0x8821,0x8831,0x8836,0x8839,0x8827,0x883B,0x8844, +0x8842,0x8852,0x8859,0x885E,0x8862,0x886B,0x8881,0x887E, +0x889E,0x8875,0x887D,0x88B5,0x8872,0x8882,0x8897,0x8892, +0x88AE,0x8899,0x88A2,0x888D,0x88A4,0x88B0,0x88BF,0x88B1, +0x88C3,0x88C4,0x88D4,0x88D8,0x88D9,0x88DD,0x88F9,0x8902, +0x88FC,0x88F4,0x88E8,0x88F2,0x8904,0x890C,0x890A,0x8913, +0x8943,0x891E,0x8925,0x892A,0x892B,0x8941,0x8944,0x893B, +0x8936,0x8938,0x894C,0x891D,0x8960,0x895E}; + +/* page 67 0x6B21-0x6B7E */ +static uint16 tab_jisx0208_uni67[]={ +0x8966,0x8964,0x896D,0x896A,0x896F,0x8974,0x8977,0x897E, +0x8983,0x8988,0x898A,0x8993,0x8998,0x89A1,0x89A9,0x89A6, +0x89AC,0x89AF,0x89B2,0x89BA,0x89BD,0x89BF,0x89C0,0x89DA, +0x89DC,0x89DD,0x89E7,0x89F4,0x89F8,0x8A03,0x8A16,0x8A10, +0x8A0C,0x8A1B,0x8A1D,0x8A25,0x8A36,0x8A41,0x8A5B,0x8A52, +0x8A46,0x8A48,0x8A7C,0x8A6D,0x8A6C,0x8A62,0x8A85,0x8A82, +0x8A84,0x8AA8,0x8AA1,0x8A91,0x8AA5,0x8AA6,0x8A9A,0x8AA3, +0x8AC4,0x8ACD,0x8AC2,0x8ADA,0x8AEB,0x8AF3,0x8AE7,0x8AE4, +0x8AF1,0x8B14,0x8AE0,0x8AE2,0x8AF7,0x8ADE,0x8ADB,0x8B0C, +0x8B07,0x8B1A,0x8AE1,0x8B16,0x8B10,0x8B17,0x8B20,0x8B33, +0x97AB,0x8B26,0x8B2B,0x8B3E,0x8B28,0x8B41,0x8B4C,0x8B4F, +0x8B4E,0x8B49,0x8B56,0x8B5B,0x8B5A,0x8B6B}; + +/* page 68 0x6C21-0x6C7E */ +static uint16 tab_jisx0208_uni68[]={ +0x8B5F,0x8B6C,0x8B6F,0x8B74,0x8B7D,0x8B80,0x8B8C,0x8B8E, +0x8B92,0x8B93,0x8B96,0x8B99,0x8B9A,0x8C3A,0x8C41,0x8C3F, +0x8C48,0x8C4C,0x8C4E,0x8C50,0x8C55,0x8C62,0x8C6C,0x8C78, +0x8C7A,0x8C82,0x8C89,0x8C85,0x8C8A,0x8C8D,0x8C8E,0x8C94, +0x8C7C,0x8C98,0x621D,0x8CAD,0x8CAA,0x8CBD,0x8CB2,0x8CB3, +0x8CAE,0x8CB6,0x8CC8,0x8CC1,0x8CE4,0x8CE3,0x8CDA,0x8CFD, +0x8CFA,0x8CFB,0x8D04,0x8D05,0x8D0A,0x8D07,0x8D0F,0x8D0D, +0x8D10,0x9F4E,0x8D13,0x8CCD,0x8D14,0x8D16,0x8D67,0x8D6D, +0x8D71,0x8D73,0x8D81,0x8D99,0x8DC2,0x8DBE,0x8DBA,0x8DCF, +0x8DDA,0x8DD6,0x8DCC,0x8DDB,0x8DCB,0x8DEA,0x8DEB,0x8DDF, +0x8DE3,0x8DFC,0x8E08,0x8E09,0x8DFF,0x8E1D,0x8E1E,0x8E10, +0x8E1F,0x8E42,0x8E35,0x8E30,0x8E34,0x8E4A}; + +/* page 69 0x6D21-0x6D7E */ +static uint16 tab_jisx0208_uni69[]={ +0x8E47,0x8E49,0x8E4C,0x8E50,0x8E48,0x8E59,0x8E64,0x8E60, +0x8E2A,0x8E63,0x8E55,0x8E76,0x8E72,0x8E7C,0x8E81,0x8E87, +0x8E85,0x8E84,0x8E8B,0x8E8A,0x8E93,0x8E91,0x8E94,0x8E99, +0x8EAA,0x8EA1,0x8EAC,0x8EB0,0x8EC6,0x8EB1,0x8EBE,0x8EC5, +0x8EC8,0x8ECB,0x8EDB,0x8EE3,0x8EFC,0x8EFB,0x8EEB,0x8EFE, +0x8F0A,0x8F05,0x8F15,0x8F12,0x8F19,0x8F13,0x8F1C,0x8F1F, +0x8F1B,0x8F0C,0x8F26,0x8F33,0x8F3B,0x8F39,0x8F45,0x8F42, +0x8F3E,0x8F4C,0x8F49,0x8F46,0x8F4E,0x8F57,0x8F5C,0x8F62, +0x8F63,0x8F64,0x8F9C,0x8F9F,0x8FA3,0x8FAD,0x8FAF,0x8FB7, +0x8FDA,0x8FE5,0x8FE2,0x8FEA,0x8FEF,0x9087,0x8FF4,0x9005, +0x8FF9,0x8FFA,0x9011,0x9015,0x9021,0x900D,0x901E,0x9016, +0x900B,0x9027,0x9036,0x9035,0x9039,0x8FF8}; + +/* page 70 0x6E21-0x6E7E */ +static uint16 tab_jisx0208_uni70[]={ +0x904F,0x9050,0x9051,0x9052,0x900E,0x9049,0x903E,0x9056, +0x9058,0x905E,0x9068,0x906F,0x9076,0x96A8,0x9072,0x9082, +0x907D,0x9081,0x9080,0x908A,0x9089,0x908F,0x90A8,0x90AF, +0x90B1,0x90B5,0x90E2,0x90E4,0x6248,0x90DB,0x9102,0x9112, +0x9119,0x9132,0x9130,0x914A,0x9156,0x9158,0x9163,0x9165, +0x9169,0x9173,0x9172,0x918B,0x9189,0x9182,0x91A2,0x91AB, +0x91AF,0x91AA,0x91B5,0x91B4,0x91BA,0x91C0,0x91C1,0x91C9, +0x91CB,0x91D0,0x91D6,0x91DF,0x91E1,0x91DB,0x91FC,0x91F5, +0x91F6,0x921E,0x91FF,0x9214,0x922C,0x9215,0x9211,0x925E, +0x9257,0x9245,0x9249,0x9264,0x9248,0x9295,0x923F,0x924B, +0x9250,0x929C,0x9296,0x9293,0x929B,0x925A,0x92CF,0x92B9, +0x92B7,0x92E9,0x930F,0x92FA,0x9344,0x932E}; + +/* page 71 0x6F21-0x6F7E */ +static uint16 tab_jisx0208_uni71[]={ +0x9319,0x9322,0x931A,0x9323,0x933A,0x9335,0x933B,0x935C, +0x9360,0x937C,0x936E,0x9356,0x93B0,0x93AC,0x93AD,0x9394, +0x93B9,0x93D6,0x93D7,0x93E8,0x93E5,0x93D8,0x93C3,0x93DD, +0x93D0,0x93C8,0x93E4,0x941A,0x9414,0x9413,0x9403,0x9407, +0x9410,0x9436,0x942B,0x9435,0x9421,0x943A,0x9441,0x9452, +0x9444,0x945B,0x9460,0x9462,0x945E,0x946A,0x9229,0x9470, +0x9475,0x9477,0x947D,0x945A,0x947C,0x947E,0x9481,0x947F, +0x9582,0x9587,0x958A,0x9594,0x9596,0x9598,0x9599,0x95A0, +0x95A8,0x95A7,0x95AD,0x95BC,0x95BB,0x95B9,0x95BE,0x95CA, +0x6FF6,0x95C3,0x95CD,0x95CC,0x95D5,0x95D4,0x95D6,0x95DC, +0x95E1,0x95E5,0x95E2,0x9621,0x9628,0x962E,0x962F,0x9642, +0x964C,0x964F,0x964B,0x9677,0x965C,0x965E}; + +/* page 72 0x7021-0x707E */ +static uint16 tab_jisx0208_uni72[]={ +0x965D,0x965F,0x9666,0x9672,0x966C,0x968D,0x9698,0x9695, +0x9697,0x96AA,0x96A7,0x96B1,0x96B2,0x96B0,0x96B4,0x96B6, +0x96B8,0x96B9,0x96CE,0x96CB,0x96C9,0x96CD,0x894D,0x96DC, +0x970D,0x96D5,0x96F9,0x9704,0x9706,0x9708,0x9713,0x970E, +0x9711,0x970F,0x9716,0x9719,0x9724,0x972A,0x9730,0x9739, +0x973D,0x973E,0x9744,0x9746,0x9748,0x9742,0x9749,0x975C, +0x9760,0x9764,0x9766,0x9768,0x52D2,0x976B,0x9771,0x9779, +0x9785,0x977C,0x9781,0x977A,0x9786,0x978B,0x978F,0x9790, +0x979C,0x97A8,0x97A6,0x97A3,0x97B3,0x97B4,0x97C3,0x97C6, +0x97C8,0x97CB,0x97DC,0x97ED,0x9F4F,0x97F2,0x7ADF,0x97F6, +0x97F5,0x980F,0x980C,0x9838,0x9824,0x9821,0x9837,0x983D, +0x9846,0x984F,0x984B,0x986B,0x986F,0x9870}; + +/* page 73 0x7121-0x717E */ +static uint16 tab_jisx0208_uni73[]={ +0x9871,0x9874,0x9873,0x98AA,0x98AF,0x98B1,0x98B6,0x98C4, +0x98C3,0x98C6,0x98E9,0x98EB,0x9903,0x9909,0x9912,0x9914, +0x9918,0x9921,0x991D,0x991E,0x9924,0x9920,0x992C,0x992E, +0x993D,0x993E,0x9942,0x9949,0x9945,0x9950,0x994B,0x9951, +0x9952,0x994C,0x9955,0x9997,0x9998,0x99A5,0x99AD,0x99AE, +0x99BC,0x99DF,0x99DB,0x99DD,0x99D8,0x99D1,0x99ED,0x99EE, +0x99F1,0x99F2,0x99FB,0x99F8,0x9A01,0x9A0F,0x9A05,0x99E2, +0x9A19,0x9A2B,0x9A37,0x9A45,0x9A42,0x9A40,0x9A43,0x9A3E, +0x9A55,0x9A4D,0x9A5B,0x9A57,0x9A5F,0x9A62,0x9A65,0x9A64, +0x9A69,0x9A6B,0x9A6A,0x9AAD,0x9AB0,0x9ABC,0x9AC0,0x9ACF, +0x9AD1,0x9AD3,0x9AD4,0x9ADE,0x9ADF,0x9AE2,0x9AE3,0x9AE6, +0x9AEF,0x9AEB,0x9AEE,0x9AF4,0x9AF1,0x9AF7}; + +/* page 74 0x7221-0x727E */ +static uint16 tab_jisx0208_uni74[]={ +0x9AFB,0x9B06,0x9B18,0x9B1A,0x9B1F,0x9B22,0x9B23,0x9B25, +0x9B27,0x9B28,0x9B29,0x9B2A,0x9B2E,0x9B2F,0x9B32,0x9B44, +0x9B43,0x9B4F,0x9B4D,0x9B4E,0x9B51,0x9B58,0x9B74,0x9B93, +0x9B83,0x9B91,0x9B96,0x9B97,0x9B9F,0x9BA0,0x9BA8,0x9BB4, +0x9BC0,0x9BCA,0x9BB9,0x9BC6,0x9BCF,0x9BD1,0x9BD2,0x9BE3, +0x9BE2,0x9BE4,0x9BD4,0x9BE1,0x9C3A,0x9BF2,0x9BF1,0x9BF0, +0x9C15,0x9C14,0x9C09,0x9C13,0x9C0C,0x9C06,0x9C08,0x9C12, +0x9C0A,0x9C04,0x9C2E,0x9C1B,0x9C25,0x9C24,0x9C21,0x9C30, +0x9C47,0x9C32,0x9C46,0x9C3E,0x9C5A,0x9C60,0x9C67,0x9C76, +0x9C78,0x9CE7,0x9CEC,0x9CF0,0x9D09,0x9D08,0x9CEB,0x9D03, +0x9D06,0x9D2A,0x9D26,0x9DAF,0x9D23,0x9D1F,0x9D44,0x9D15, +0x9D12,0x9D41,0x9D3F,0x9D3E,0x9D46,0x9D48}; + +/* page 75 0x7321-0x737E */ +static uint16 tab_jisx0208_uni75[]={ +0x9D5D,0x9D5E,0x9D64,0x9D51,0x9D50,0x9D59,0x9D72,0x9D89, +0x9D87,0x9DAB,0x9D6F,0x9D7A,0x9D9A,0x9DA4,0x9DA9,0x9DB2, +0x9DC4,0x9DC1,0x9DBB,0x9DB8,0x9DBA,0x9DC6,0x9DCF,0x9DC2, +0x9DD9,0x9DD3,0x9DF8,0x9DE6,0x9DED,0x9DEF,0x9DFD,0x9E1A, +0x9E1B,0x9E1E,0x9E75,0x9E79,0x9E7D,0x9E81,0x9E88,0x9E8B, +0x9E8C,0x9E92,0x9E95,0x9E91,0x9E9D,0x9EA5,0x9EA9,0x9EB8, +0x9EAA,0x9EAD,0x9761,0x9ECC,0x9ECE,0x9ECF,0x9ED0,0x9ED4, +0x9EDC,0x9EDE,0x9EDD,0x9EE0,0x9EE5,0x9EE8,0x9EEF,0x9EF4, +0x9EF6,0x9EF7,0x9EF9,0x9EFB,0x9EFC,0x9EFD,0x9F07,0x9F08, +0x76B7,0x9F15,0x9F21,0x9F2C,0x9F3E,0x9F4A,0x9F52,0x9F54, +0x9F63,0x9F5F,0x9F60,0x9F61,0x9F66,0x9F67,0x9F6C,0x9F6A, +0x9F77,0x9F72,0x9F76,0x9F95,0x9F9C,0x9FA0}; + +/* page 76 0x7421-0x7426 */ +static uint16 tab_jisx0208_uni76[]={ +0x582F,0x69C7,0x9059,0x7464,0x51DC,0x7199}; + +static int +my_jisx0208_uni_onechar(int code){ + if ((code>=0x2121)&&(code<=0x217E)) + return(tab_jisx0208_uni0[code-0x2121]); + if ((code>=0x2221)&&(code<=0x227E)) + return(tab_jisx0208_uni1[code-0x2221]); + if ((code>=0x2330)&&(code<=0x237A)) + return(tab_jisx0208_uni2[code-0x2330]); + if ((code>=0x2421)&&(code<=0x2473)) + return(tab_jisx0208_uni3[code-0x2421]); + if ((code>=0x2521)&&(code<=0x2576)) + return(tab_jisx0208_uni4[code-0x2521]); + if ((code>=0x2621)&&(code<=0x2658)) + return(tab_jisx0208_uni5[code-0x2621]); + if ((code>=0x2721)&&(code<=0x2771)) + return(tab_jisx0208_uni6[code-0x2721]); + if ((code>=0x2821)&&(code<=0x2840)) + return(tab_jisx0208_uni7[code-0x2821]); + if ((code>=0x3021)&&(code<=0x307E)) + return(tab_jisx0208_uni8[code-0x3021]); + if ((code>=0x3121)&&(code<=0x317E)) + return(tab_jisx0208_uni9[code-0x3121]); + if ((code>=0x3221)&&(code<=0x327E)) + return(tab_jisx0208_uni10[code-0x3221]); + if ((code>=0x3321)&&(code<=0x337E)) + return(tab_jisx0208_uni11[code-0x3321]); + if ((code>=0x3421)&&(code<=0x347E)) + return(tab_jisx0208_uni12[code-0x3421]); + if ((code>=0x3521)&&(code<=0x357E)) + return(tab_jisx0208_uni13[code-0x3521]); + if ((code>=0x3621)&&(code<=0x367E)) + return(tab_jisx0208_uni14[code-0x3621]); + if ((code>=0x3721)&&(code<=0x377E)) + return(tab_jisx0208_uni15[code-0x3721]); + if ((code>=0x3821)&&(code<=0x387E)) + return(tab_jisx0208_uni16[code-0x3821]); + if ((code>=0x3921)&&(code<=0x397E)) + return(tab_jisx0208_uni17[code-0x3921]); + if ((code>=0x3A21)&&(code<=0x3A7E)) + return(tab_jisx0208_uni18[code-0x3A21]); + if ((code>=0x3B21)&&(code<=0x3B7E)) + return(tab_jisx0208_uni19[code-0x3B21]); + if ((code>=0x3C21)&&(code<=0x3C7E)) + return(tab_jisx0208_uni20[code-0x3C21]); + if ((code>=0x3D21)&&(code<=0x3D7E)) + return(tab_jisx0208_uni21[code-0x3D21]); + if ((code>=0x3E21)&&(code<=0x3E7E)) + return(tab_jisx0208_uni22[code-0x3E21]); + if ((code>=0x3F21)&&(code<=0x3F7E)) + return(tab_jisx0208_uni23[code-0x3F21]); + if ((code>=0x4021)&&(code<=0x407E)) + return(tab_jisx0208_uni24[code-0x4021]); + if ((code>=0x4121)&&(code<=0x417E)) + return(tab_jisx0208_uni25[code-0x4121]); + if ((code>=0x4221)&&(code<=0x427E)) + return(tab_jisx0208_uni26[code-0x4221]); + if ((code>=0x4321)&&(code<=0x437E)) + return(tab_jisx0208_uni27[code-0x4321]); + if ((code>=0x4421)&&(code<=0x447E)) + return(tab_jisx0208_uni28[code-0x4421]); + if ((code>=0x4521)&&(code<=0x457E)) + return(tab_jisx0208_uni29[code-0x4521]); + if ((code>=0x4621)&&(code<=0x467E)) + return(tab_jisx0208_uni30[code-0x4621]); + if ((code>=0x4721)&&(code<=0x477E)) + return(tab_jisx0208_uni31[code-0x4721]); + if ((code>=0x4821)&&(code<=0x487E)) + return(tab_jisx0208_uni32[code-0x4821]); + if ((code>=0x4921)&&(code<=0x497E)) + return(tab_jisx0208_uni33[code-0x4921]); + if ((code>=0x4A21)&&(code<=0x4A7E)) + return(tab_jisx0208_uni34[code-0x4A21]); + if ((code>=0x4B21)&&(code<=0x4B7E)) + return(tab_jisx0208_uni35[code-0x4B21]); + if ((code>=0x4C21)&&(code<=0x4C7E)) + return(tab_jisx0208_uni36[code-0x4C21]); + if ((code>=0x4D21)&&(code<=0x4D7E)) + return(tab_jisx0208_uni37[code-0x4D21]); + if ((code>=0x4E21)&&(code<=0x4E7E)) + return(tab_jisx0208_uni38[code-0x4E21]); + if ((code>=0x4F21)&&(code<=0x4F53)) + return(tab_jisx0208_uni39[code-0x4F21]); + if ((code>=0x5021)&&(code<=0x507E)) + return(tab_jisx0208_uni40[code-0x5021]); + if ((code>=0x5121)&&(code<=0x517E)) + return(tab_jisx0208_uni41[code-0x5121]); + if ((code>=0x5221)&&(code<=0x527E)) + return(tab_jisx0208_uni42[code-0x5221]); + if ((code>=0x5321)&&(code<=0x537E)) + return(tab_jisx0208_uni43[code-0x5321]); + if ((code>=0x5421)&&(code<=0x547E)) + return(tab_jisx0208_uni44[code-0x5421]); + if ((code>=0x5521)&&(code<=0x557E)) + return(tab_jisx0208_uni45[code-0x5521]); + if ((code>=0x5621)&&(code<=0x567E)) + return(tab_jisx0208_uni46[code-0x5621]); + if ((code>=0x5721)&&(code<=0x577E)) + return(tab_jisx0208_uni47[code-0x5721]); + if ((code>=0x5821)&&(code<=0x587E)) + return(tab_jisx0208_uni48[code-0x5821]); + if ((code>=0x5921)&&(code<=0x597E)) + return(tab_jisx0208_uni49[code-0x5921]); + if ((code>=0x5A21)&&(code<=0x5A7E)) + return(tab_jisx0208_uni50[code-0x5A21]); + if ((code>=0x5B21)&&(code<=0x5B7E)) + return(tab_jisx0208_uni51[code-0x5B21]); + if ((code>=0x5C21)&&(code<=0x5C7E)) + return(tab_jisx0208_uni52[code-0x5C21]); + if ((code>=0x5D21)&&(code<=0x5D7E)) + return(tab_jisx0208_uni53[code-0x5D21]); + if ((code>=0x5E21)&&(code<=0x5E7E)) + return(tab_jisx0208_uni54[code-0x5E21]); + if ((code>=0x5F21)&&(code<=0x5F7E)) + return(tab_jisx0208_uni55[code-0x5F21]); + if ((code>=0x6021)&&(code<=0x607E)) + return(tab_jisx0208_uni56[code-0x6021]); + if ((code>=0x6121)&&(code<=0x617E)) + return(tab_jisx0208_uni57[code-0x6121]); + if ((code>=0x6221)&&(code<=0x627E)) + return(tab_jisx0208_uni58[code-0x6221]); + if ((code>=0x6321)&&(code<=0x637E)) + return(tab_jisx0208_uni59[code-0x6321]); + if ((code>=0x6421)&&(code<=0x647E)) + return(tab_jisx0208_uni60[code-0x6421]); + if ((code>=0x6521)&&(code<=0x657E)) + return(tab_jisx0208_uni61[code-0x6521]); + if ((code>=0x6621)&&(code<=0x667E)) + return(tab_jisx0208_uni62[code-0x6621]); + if ((code>=0x6721)&&(code<=0x677E)) + return(tab_jisx0208_uni63[code-0x6721]); + if ((code>=0x6821)&&(code<=0x687E)) + return(tab_jisx0208_uni64[code-0x6821]); + if ((code>=0x6921)&&(code<=0x697E)) + return(tab_jisx0208_uni65[code-0x6921]); + if ((code>=0x6A21)&&(code<=0x6A7E)) + return(tab_jisx0208_uni66[code-0x6A21]); + if ((code>=0x6B21)&&(code<=0x6B7E)) + return(tab_jisx0208_uni67[code-0x6B21]); + if ((code>=0x6C21)&&(code<=0x6C7E)) + return(tab_jisx0208_uni68[code-0x6C21]); + if ((code>=0x6D21)&&(code<=0x6D7E)) + return(tab_jisx0208_uni69[code-0x6D21]); + if ((code>=0x6E21)&&(code<=0x6E7E)) + return(tab_jisx0208_uni70[code-0x6E21]); + if ((code>=0x6F21)&&(code<=0x6F7E)) + return(tab_jisx0208_uni71[code-0x6F21]); + if ((code>=0x7021)&&(code<=0x707E)) + return(tab_jisx0208_uni72[code-0x7021]); + if ((code>=0x7121)&&(code<=0x717E)) + return(tab_jisx0208_uni73[code-0x7121]); + if ((code>=0x7221)&&(code<=0x727E)) + return(tab_jisx0208_uni74[code-0x7221]); + if ((code>=0x7321)&&(code<=0x737E)) + return(tab_jisx0208_uni75[code-0x7321]); + if ((code>=0x7421)&&(code<=0x7426)) + return(tab_jisx0208_uni76[code-0x7421]); + return(0); +} + + +/* page 0 0x005C-0x005C */ +static uint16 tab_uni_jisx02080[]={ +0x2140}; + +/* page 1 0x00A2-0x00B6 */ +static uint16 tab_uni_jisx02081[]={ +0x2171,0x2172, 0, 0, 0,0x2178,0x212F, 0, + 0, 0,0x224C, 0, 0, 0,0x216B,0x215E, + 0, 0,0x212D, 0,0x2279}; + +/* page 2 0x00D7-0x00D7 */ +static uint16 tab_uni_jisx02082[]={ +0x215F}; + +/* page 3 0x00F7-0x00F7 */ +static uint16 tab_uni_jisx02083[]={ +0x2160}; + +/* page 4 0x0391-0x03C9 */ +static uint16 tab_uni_jisx02084[]={ +0x2621,0x2622,0x2623,0x2624,0x2625,0x2626,0x2627,0x2628, +0x2629,0x262A,0x262B,0x262C,0x262D,0x262E,0x262F,0x2630, +0x2631, 0,0x2632,0x2633,0x2634,0x2635,0x2636,0x2637, +0x2638, 0, 0, 0, 0, 0, 0, 0, +0x2641,0x2642,0x2643,0x2644,0x2645,0x2646,0x2647,0x2648, +0x2649,0x264A,0x264B,0x264C,0x264D,0x264E,0x264F,0x2650, +0x2651, 0,0x2652,0x2653,0x2654,0x2655,0x2656,0x2657, +0x2658}; + +/* page 5 0x0401-0x0451 */ +static uint16 tab_uni_jisx02085[]={ +0x2727, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x2721, +0x2722,0x2723,0x2724,0x2725,0x2726,0x2728,0x2729,0x272A, +0x272B,0x272C,0x272D,0x272E,0x272F,0x2730,0x2731,0x2732, +0x2733,0x2734,0x2735,0x2736,0x2737,0x2738,0x2739,0x273A, +0x273B,0x273C,0x273D,0x273E,0x273F,0x2740,0x2741,0x2751, +0x2752,0x2753,0x2754,0x2755,0x2756,0x2758,0x2759,0x275A, +0x275B,0x275C,0x275D,0x275E,0x275F,0x2760,0x2761,0x2762, +0x2763,0x2764,0x2765,0x2766,0x2767,0x2768,0x2769,0x276A, +0x276B,0x276C,0x276D,0x276E,0x276F,0x2770,0x2771, 0, +0x2757}; + +/* page 6 0x2010-0x203B */ +static uint16 tab_uni_jisx02086[]={ +0x213E, 0, 0, 0, 0,0x213D,0x2142, 0, +0x2146,0x2147, 0, 0,0x2148,0x2149, 0, 0, +0x2277,0x2278, 0, 0, 0,0x2145,0x2144, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2273, 0,0x216C,0x216D, 0, 0, 0, 0, + 0, 0, 0,0x2228}; + +/* page 7 0x2103-0x2103 */ +static uint16 tab_uni_jisx02087[]={ +0x216E}; + +/* page 8 0x212B-0x212B */ +static uint16 tab_uni_jisx02088[]={ +0x2272}; + +/* page 9 0x2190-0x2193 */ +static uint16 tab_uni_jisx02089[]={ +0x222B,0x222C,0x222A,0x222D}; + +/* page 10 0x21D2-0x21D4 */ +static uint16 tab_uni_jisx020810[]={ +0x224D, 0,0x224E}; + +/* page 11 0x2200-0x223D */ +static uint16 tab_uni_jisx020811[]={ +0x224F, 0,0x225F,0x2250, 0, 0, 0,0x2260, +0x223A, 0, 0,0x223B, 0, 0, 0, 0, + 0, 0,0x215D, 0, 0, 0, 0, 0, + 0, 0,0x2265, 0, 0,0x2267,0x2167, 0, +0x225C, 0, 0, 0, 0, 0, 0,0x224A, +0x224B,0x2241,0x2240,0x2269,0x226A, 0, 0, 0, + 0, 0, 0, 0,0x2168,0x2268, 0, 0, + 0, 0, 0, 0, 0,0x2266}; + +/* page 12 0x2252-0x226B */ +static uint16 tab_uni_jisx020812[]={ +0x2262, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x2162,0x2261, + 0, 0, 0, 0,0x2165,0x2166, 0, 0, +0x2263,0x2264}; + +/* page 13 0x2282-0x2287 */ +static uint16 tab_uni_jisx020813[]={ +0x223E,0x223F, 0, 0,0x223C,0x223D}; + +/* page 14 0x22A5-0x22A5 */ +static uint16 tab_uni_jisx020814[]={ +0x225D}; + +/* page 15 0x2312-0x2312 */ +static uint16 tab_uni_jisx020815[]={ +0x225E}; + +/* page 16 0x2500-0x254B */ +static uint16 tab_uni_jisx020816[]={ +0x2821,0x282C,0x2822,0x282D, 0, 0, 0, 0, + 0, 0, 0, 0,0x2823, 0, 0,0x282E, +0x2824, 0, 0,0x282F,0x2826, 0, 0,0x2831, +0x2825, 0, 0,0x2830,0x2827,0x283C, 0, 0, +0x2837, 0, 0,0x2832,0x2829,0x283E, 0, 0, +0x2839, 0, 0,0x2834,0x2828, 0, 0,0x2838, +0x283D, 0, 0,0x2833,0x282A, 0, 0,0x283A, +0x283F, 0, 0,0x2835,0x282B, 0, 0,0x283B, + 0, 0,0x2840, 0, 0, 0, 0, 0, + 0, 0, 0,0x2836}; + +/* page 17 0x25A0-0x25CF */ +static uint16 tab_uni_jisx020817[]={ +0x2223,0x2222, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x2225,0x2224, 0, 0, 0, 0, + 0, 0, 0, 0,0x2227,0x2226, 0, 0, + 0, 0, 0, 0, 0, 0,0x2221,0x217E, + 0, 0, 0,0x217B, 0, 0,0x217D,0x217C +}; + +/* page 18 0x25EF-0x25EF */ +static uint16 tab_uni_jisx020818[]={ +0x227E}; + +/* page 19 0x2605-0x2606 */ +static uint16 tab_uni_jisx020819[]={ +0x217A,0x2179}; + +/* page 20 0x2640-0x2642 */ +static uint16 tab_uni_jisx020820[]={ +0x216A, 0,0x2169}; + +/* page 21 0x266A-0x266F */ +static uint16 tab_uni_jisx020821[]={ +0x2276, 0, 0,0x2275, 0,0x2274}; + +/* page 22 0x3000-0x301C */ +static uint16 tab_uni_jisx020822[]={ +0x2121,0x2122,0x2123,0x2137, 0,0x2139,0x213A,0x213B, +0x2152,0x2153,0x2154,0x2155,0x2156,0x2157,0x2158,0x2159, +0x215A,0x215B,0x2229,0x222E,0x214C,0x214D, 0, 0, + 0, 0, 0, 0,0x2141}; + +/* page 23 0x3041-0x30FE */ +static uint16 tab_uni_jisx020823[]={ +0x2421,0x2422,0x2423,0x2424,0x2425,0x2426,0x2427,0x2428, +0x2429,0x242A,0x242B,0x242C,0x242D,0x242E,0x242F,0x2430, +0x2431,0x2432,0x2433,0x2434,0x2435,0x2436,0x2437,0x2438, +0x2439,0x243A,0x243B,0x243C,0x243D,0x243E,0x243F,0x2440, +0x2441,0x2442,0x2443,0x2444,0x2445,0x2446,0x2447,0x2448, +0x2449,0x244A,0x244B,0x244C,0x244D,0x244E,0x244F,0x2450, +0x2451,0x2452,0x2453,0x2454,0x2455,0x2456,0x2457,0x2458, +0x2459,0x245A,0x245B,0x245C,0x245D,0x245E,0x245F,0x2460, +0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468, +0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470, +0x2471,0x2472,0x2473, 0, 0, 0, 0, 0, + 0, 0,0x212B,0x212C,0x2135,0x2136, 0, 0, +0x2521,0x2522,0x2523,0x2524,0x2525,0x2526,0x2527,0x2528, +0x2529,0x252A,0x252B,0x252C,0x252D,0x252E,0x252F,0x2530, +0x2531,0x2532,0x2533,0x2534,0x2535,0x2536,0x2537,0x2538, +0x2539,0x253A,0x253B,0x253C,0x253D,0x253E,0x253F,0x2540, +0x2541,0x2542,0x2543,0x2544,0x2545,0x2546,0x2547,0x2548, +0x2549,0x254A,0x254B,0x254C,0x254D,0x254E,0x254F,0x2550, +0x2551,0x2552,0x2553,0x2554,0x2555,0x2556,0x2557,0x2558, +0x2559,0x255A,0x255B,0x255C,0x255D,0x255E,0x255F,0x2560, +0x2561,0x2562,0x2563,0x2564,0x2565,0x2566,0x2567,0x2568, +0x2569,0x256A,0x256B,0x256C,0x256D,0x256E,0x256F,0x2570, +0x2571,0x2572,0x2573,0x2574,0x2575,0x2576, 0, 0, + 0, 0,0x2126,0x213C,0x2133,0x2134}; + +/* page 24 0x4E00-0x5516 */ +static uint16 tab_uni_jisx020824[]={ +0x306C,0x437A, 0,0x3C37, 0, 0, 0,0x4B7C, +0x3E66,0x3B30,0x3E65,0x323C, 0,0x4954,0x4D3F, 0, +0x5022,0x312F, 0, 0,0x336E,0x5023,0x4024,0x5242, +0x3556,0x4A3A, 0, 0, 0, 0,0x3E67, 0, + 0,0x4E3E, 0, 0, 0, 0,0x4A42, 0, + 0, 0,0x5024, 0, 0,0x4366, 0, 0, + 0,0x5025,0x367A, 0, 0, 0,0x5026, 0, +0x345D,0x4330, 0,0x3C67,0x5027, 0, 0,0x5028, + 0, 0,0x5029,0x4735, 0,0x3557, 0, 0, + 0, 0, 0,0x4737, 0,0x4663,0x3843,0x4B33, + 0, 0, 0, 0, 0,0x6949,0x502A,0x3E68, +0x502B,0x3235, 0, 0, 0,0x3665,0x3870,0x4C69, + 0, 0,0x5626, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4D70, 0,0x467D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3425, 0, +0x3535, 0,0x502C, 0, 0,0x502D,0x4E3B, 0, +0x4D3D,0x4168,0x502F,0x3B76,0x4673, 0,0x5032, 0, + 0,0x313E,0x385F, 0,0x385E,0x3066, 0, 0, +0x4F4B,0x4F4A, 0,0x3A33,0x3021, 0,0x5033,0x5034, +0x5035,0x4B34,0x5036, 0,0x3872,0x3067,0x4B72, 0, +0x357C, 0, 0,0x357D,0x357E,0x4462,0x4E3C, 0, +0x5037, 0, 0,0x5038, 0, 0,0x5039, 0, + 0, 0,0x3F4D, 0, 0, 0, 0, 0, +0x3D3A,0x3F4E,0x503E, 0,0x503C, 0,0x503D,0x3558, + 0, 0,0x3A23,0x3270, 0,0x503B,0x503A,0x4A29, + 0, 0, 0, 0,0x3B46,0x3B45,0x423E,0x503F, +0x4955,0x4067, 0, 0, 0,0x2138,0x5040,0x5042, + 0, 0, 0,0x4265,0x4E61,0x304A, 0, 0, + 0, 0, 0, 0, 0,0x5041,0x323E, 0, +0x3644, 0,0x4367, 0, 0, 0,0x376F,0x5043, + 0, 0, 0,0x4724, 0, 0, 0, 0, + 0,0x346B, 0, 0, 0, 0, 0, 0, + 0,0x5044,0x304B, 0, 0,0x3860,0x346C,0x497A, +0x4832,0x3559, 0, 0, 0, 0, 0, 0, + 0, 0,0x3271, 0,0x5067,0x4541, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x476C, +0x5046, 0, 0, 0,0x483C, 0,0x4E62, 0, +0x3F2D, 0,0x3B47, 0,0x3B77,0x3240, 0, 0, + 0, 0, 0,0x4451, 0, 0,0x4322,0x504A, + 0, 0, 0, 0, 0,0x304C,0x4463,0x3D3B, +0x3A34,0x4D24, 0,0x424E, 0,0x323F, 0,0x5049, + 0,0x4D3E,0x5045,0x5047,0x3A6E,0x5048,0x5524, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5050, 0, 0, 0, 0, 0,0x5053, +0x5051, 0, 0,0x3242, 0,0x4A3B,0x504B, 0, + 0, 0, 0,0x504F,0x3873, 0, 0,0x3B48, + 0, 0, 0,0x3426, 0, 0,0x5054, 0, +0x504C, 0, 0,0x4E63, 0,0x3B78, 0,0x504D, + 0,0x5052, 0, 0, 0, 0,0x5055, 0, +0x504E, 0, 0,0x3621, 0,0x304D, 0, 0, +0x3622,0x3241, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5525, 0,0x4B79,0x496E,0x3874, + 0, 0, 0, 0, 0,0x3F2F,0x4E37, 0, + 0, 0, 0, 0, 0, 0, 0,0x4A58, + 0, 0,0x3738,0x4225,0x3264, 0, 0, 0, + 0, 0,0x3D53, 0, 0, 0,0x5059, 0, +0x505E,0x505C, 0, 0,0x5057, 0, 0,0x422F, +0x505A, 0,0x505D,0x505B, 0,0x4A5D, 0,0x5058, + 0,0x3F2E, 0,0x4B73,0x505F,0x5060, 0, 0, + 0, 0, 0, 0, 0, 0,0x3D24,0x506D, + 0, 0, 0,0x4750, 0,0x4936,0x5068, 0, +0x4A70, 0,0x3236, 0, 0, 0,0x506C, 0, + 0, 0, 0, 0, 0,0x5066,0x506F, 0, + 0,0x4152, 0,0x3844, 0,0x475C, 0,0x6047, + 0,0x506E,0x455D, 0,0x5063, 0,0x3876, 0, + 0,0x3875,0x5061, 0, 0, 0, 0,0x3C5A, + 0,0x5069, 0,0x4A6F,0x434D,0x5065,0x3771, 0, +0x5062,0x506A,0x5064,0x4E51,0x506B,0x4F41, 0, 0, + 0, 0, 0, 0, 0, 0,0x3666, 0, + 0,0x3770, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5070, 0, 0, 0,0x5071, +0x5075,0x304E, 0, 0, 0, 0, 0,0x4A50, +0x5074, 0, 0, 0, 0,0x5073,0x5077, 0, + 0, 0,0x5076, 0,0x4464, 0, 0, 0, + 0, 0, 0, 0, 0,0x3772, 0, 0, + 0, 0, 0, 0,0x5078, 0, 0, 0, + 0, 0,0x3C45, 0,0x4226,0x4465,0x3676, 0, +0x5079, 0, 0, 0, 0,0x3536, 0, 0, +0x507A, 0, 0, 0, 0,0x507C, 0, 0, + 0, 0, 0, 0, 0,0x4B35, 0, 0, + 0,0x3766, 0, 0, 0, 0, 0, 0, +0x3B31,0x4877,0x507B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3A45,0x4D43, 0, 0, + 0, 0,0x507E,0x5123,0x507D,0x3A44, 0,0x3D7D, + 0, 0, 0, 0, 0, 0,0x3739, 0, + 0, 0,0x5124, 0, 0,0x364F, 0, 0, + 0,0x5121,0x5122, 0, 0,0x462F, 0,0x417C, + 0,0x3623, 0, 0, 0,0x4B4D,0x5125, 0, + 0, 0,0x4E3D, 0, 0, 0,0x5126, 0, + 0, 0, 0,0x5129, 0,0x5127, 0,0x414E, + 0, 0, 0, 0, 0,0x5128,0x512A, 0, + 0, 0, 0, 0, 0,0x512C, 0, 0, + 0,0x512B, 0,0x4A48, 0, 0, 0, 0, +0x3537,0x512E,0x512F, 0,0x322F, 0, 0, 0, + 0,0x512D, 0, 0, 0, 0, 0, 0, + 0, 0,0x3C74, 0,0x5132,0x5131,0x5130, 0, +0x5056, 0,0x5133, 0, 0, 0, 0,0x3D7E, + 0,0x5134, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D25, 0, 0, 0, 0, 0, + 0, 0,0x4C59, 0, 0, 0, 0,0x5136, + 0, 0,0x5135,0x5138,0x5137, 0, 0,0x5139, +0x513A,0x3074, 0,0x3835,0x373B,0x3D3C,0x437B,0x3624, +0x4068,0x3877, 0,0x396E,0x513C,0x4C48,0x4546, 0, +0x3B79, 0,0x513B, 0,0x513D, 0, 0, 0, + 0, 0,0x455E, 0,0x3375, 0, 0, 0, + 0, 0,0x513E, 0, 0,0x467E, 0, 0, +0x4134,0x5140,0x5141,0x482C,0x3878,0x4F3B,0x5142, 0, + 0,0x3626, 0, 0, 0,0x4A3C,0x4236,0x3671, +0x4535, 0, 0, 0,0x3773, 0, 0, 0, +0x5143, 0,0x5144, 0, 0,0x4662,0x315F, 0, + 0,0x5147,0x3A7D, 0,0x5146,0x3A46, 0,0x5148, +0x666E,0x5149,0x4B41,0x514A, 0,0x514B,0x514C,0x3E69, + 0,0x3C4C, 0, 0, 0, 0, 0, 0, +0x3427, 0,0x514F, 0,0x514D,0x4C3D,0x514E, 0, +0x495A,0x5150,0x5151,0x5152,0x455F, 0, 0, 0, +0x5156,0x5154,0x5155,0x5153,0x3A63,0x5157,0x4C6A,0x4E64, + 0, 0, 0, 0, 0,0x5158, 0, 0, + 0, 0, 0, 0,0x4028,0x5159,0x3D5A, 0, + 0,0x515A, 0,0x437C,0x4E3F,0x4560, 0, 0, + 0, 0, 0, 0, 0, 0,0x5245, 0, + 0, 0, 0,0x515B,0x7425,0x3645, 0, 0, +0x515C,0x4B5E, 0, 0, 0, 0,0x3D68,0x427C, + 0,0x515E,0x4664, 0, 0,0x515F, 0, 0, +0x5160,0x332E, 0, 0, 0,0x5161,0x3627, 0, +0x464C,0x317A,0x3D50, 0, 0,0x4821,0x5162, 0, +0x4561, 0, 0,0x3F4F,0x5163, 0,0x4A2C,0x405A, +0x3422, 0,0x3429,0x5164, 0, 0,0x5166, 0, + 0,0x373A, 0, 0,0x5165, 0, 0,0x4E73, + 0, 0, 0, 0, 0,0x3D69, 0, 0, + 0, 0, 0, 0,0x483D,0x4A4C, 0,0x5167, + 0,0x4D78,0x5168, 0, 0, 0,0x5169, 0, +0x457E, 0, 0,0x516A, 0, 0,0x4029,0x3A7E, +0x3774,0x516B,0x3B49,0x396F, 0, 0, 0, 0, + 0, 0, 0,0x4466,0x516D, 0, 0,0x4227, + 0, 0,0x3A6F,0x516E,0x516F,0x4130, 0,0x516C, + 0, 0, 0, 0,0x5171, 0,0x4B36, 0, + 0, 0, 0,0x3964, 0, 0,0x5170, 0, + 0, 0, 0,0x3775,0x3A5E,0x476D, 0, 0, + 0,0x5174,0x5172, 0, 0, 0, 0,0x497B, +0x3E6A,0x517B,0x3364,0x5175,0x5173,0x414F, 0, 0, + 0, 0, 0, 0, 0,0x5177, 0,0x5176, + 0, 0, 0,0x3344, 0, 0, 0,0x3760, +0x517C,0x4E2D, 0, 0, 0,0x5178, 0, 0, + 0,0x517D,0x517A, 0,0x5179, 0, 0, 0, + 0, 0, 0,0x4E4F, 0, 0, 0,0x3879, +0x3243, 0, 0,0x4E74, 0, 0, 0, 0, + 0,0x3D75,0x4558,0x3965,0x5222,0x5223, 0, 0, + 0,0x4E65, 0, 0,0x4F2B,0x5225, 0, 0, + 0,0x387A, 0, 0,0x5224, 0,0x332F, 0, + 0,0x5226, 0,0x4B56, 0,0x443C, 0,0x4D26, + 0,0x4A59, 0, 0, 0,0x5227, 0, 0, + 0, 0,0x7055, 0, 0,0x4630, 0,0x5228, +0x342A,0x4C33, 0, 0, 0,0x3E21,0x5229,0x4A67, +0x522D, 0,0x402A,0x522A,0x3650, 0,0x522B,0x342B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x372E,0x522E, 0,0x522F, 0, 0, +0x5230,0x5231,0x3C5B, 0, 0, 0,0x387B,0x4C5E, + 0,0x4C68,0x4677, 0, 0,0x4A71,0x5232, 0, +0x5233, 0, 0, 0, 0,0x5235, 0,0x5237, +0x5236, 0, 0, 0, 0,0x5238,0x323D,0x4B4C, + 0,0x3A7C,0x5239, 0, 0,0x4159, 0, 0, +0x3E22,0x3629, 0,0x523A, 0, 0, 0, 0, + 0, 0,0x485B, 0, 0, 0, 0,0x523B, + 0,0x523C, 0,0x523D, 0, 0, 0, 0, +0x523E,0x4924,0x3668,0x3065, 0, 0, 0,0x463F, +0x523F,0x3D3D, 0,0x4069, 0,0x5241,0x5240,0x3E23, +0x3861,0x5243,0x483E, 0, 0,0x5244, 0, 0, + 0,0x485C,0x4234,0x426E,0x3628, 0, 0,0x466E, +0x4331, 0,0x476E, 0,0x4B4E, 0,0x5246, 0, +0x406A, 0, 0, 0, 0, 0,0x3735, 0, + 0,0x5247, 0, 0, 0, 0,0x5248,0x312C, +0x3075,0x346D, 0,0x4228,0x3551,0x4D71, 0,0x524B, +0x3237, 0, 0,0x524A, 0, 0, 0,0x362A, + 0, 0,0x524C, 0,0x4C71, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x524D, 0, +0x4E52, 0,0x387C, 0, 0, 0, 0,0x3836, +0x524E, 0, 0, 0, 0,0x5250,0x524F, 0, +0x3F5F,0x3139, 0, 0, 0,0x315E,0x5251, 0, +0x5252, 0, 0,0x3837, 0, 0,0x5253, 0, + 0, 0, 0,0x356E, 0, 0, 0, 0, + 0, 0,0x3B32,0x5254, 0, 0, 0, 0, +0x4B74,0x3A35,0x355A,0x4D27,0x4150,0x483F,0x3C7D, 0, + 0, 0, 0, 0,0x3D47, 0,0x3C68,0x3C75, + 0,0x3D76, 0,0x4840, 0, 0, 0,0x5257, + 0,0x3143,0x4151,0x387D,0x3845,0x3667, 0, 0, +0x525B,0x4321,0x427E,0x362B,0x3E24,0x525C,0x525A,0x3244, +0x4266,0x3C38,0x3B4B,0x3126, 0, 0,0x3370,0x3966, +0x3B4A, 0,0x525D, 0, 0, 0, 0, 0, + 0,0x525E, 0,0x3549,0x3346, 0, 0, 0, +0x3967,0x3548,0x445F,0x3125,0x4631,0x4C3E,0x3921,0x4D79, +0x4547,0x387E, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x372F, 0,0x5267, 0,0x3663, +0x4B4A, 0, 0, 0, 0, 0,0x485D, 0, + 0,0x5266, 0,0x345E,0x5261,0x5262,0x5264, 0, + 0, 0, 0, 0, 0, 0,0x5265, 0, +0x355B,0x3F61, 0,0x4A2D,0x5263,0x525F,0x3863, 0, +0x5260, 0,0x4F24, 0, 0, 0,0x4A72, 0, +0x4468,0x3862,0x3970, 0, 0, 0,0x5268, 0, + 0,0x465D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x526C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3C7E, 0,0x3C76, 0, 0, 0, 0, 0, +0x526F,0x526D, 0,0x4C23, 0,0x526A,0x5273,0x526E, + 0, 0, 0,0x5271,0x3846,0x4C3F, 0, 0, +0x5272, 0, 0, 0,0x5274, 0,0x5276, 0, + 0, 0, 0,0x3A70,0x4F42, 0,0x526B,0x5269, +0x5275, 0,0x5270, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5278, 0,0x5323,0x527A, 0, 0, +0x527E, 0, 0,0x5321,0x527B, 0, 0,0x533E, + 0, 0,0x3A69,0x3331, 0, 0, 0, 0, +0x5279, 0, 0, 0,0x5325,0x3076,0x5324, 0, +0x3025,0x494A,0x5322, 0,0x527C, 0, 0,0x5277, +0x527D,0x3A48, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5326, 0, 0, 0, 0, 0, 0, 0, + 0,0x3077,0x532F, 0, 0,0x5327,0x5328, 0, +0x3E25,0x4B69, 0, 0, 0,0x532D,0x532C, 0, + 0, 0,0x452F, 0, 0, 0, 0, 0, + 0, 0,0x532E, 0, 0,0x532B, 0, 0, + 0, 0, 0, 0,0x3134, 0,0x3A36,0x3F30, + 0, 0, 0, 0, 0, 0, 0,0x5329, +0x4562, 0, 0, 0,0x532A, 0,0x3022}; + +/* page 25 0x552E-0x5563 */ +static uint16 tab_uni_jisx020825[]={ +0x5334,0x4D23, 0,0x3E27, 0,0x533A, 0, 0, + 0, 0,0x5339,0x5330, 0, 0, 0, 0, +0x4243, 0,0x5331, 0, 0, 0,0x426F,0x5336, +0x3E26, 0, 0, 0, 0, 0,0x5333, 0, + 0,0x4C64, 0, 0, 0,0x373C, 0, 0, +0x5337,0x5338, 0, 0, 0, 0,0x5335,0x533B, + 0, 0, 0, 0, 0,0x5332}; + +/* page 26 0x557B-0x576A */ +static uint16 tab_uni_jisx020826[]={ +0x5341,0x5346, 0,0x5342, 0,0x533D, 0, 0, +0x5347,0x4131, 0, 0,0x5349, 0,0x3922,0x533F, +0x437D, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5343,0x533C,0x342D, + 0,0x346E,0x3365,0x5344,0x5340, 0, 0, 0, + 0, 0, 0, 0,0x3776,0x534A,0x5348,0x4153, +0x354A,0x362C, 0,0x5345, 0,0x3674, 0, 0, + 0, 0, 0,0x3144, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x534E,0x534C, 0,0x5427, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5351, 0, 0, 0, 0, 0,0x534B, + 0,0x534F, 0, 0,0x534D, 0, 0, 0, +0x3B4C,0x5350, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5353, 0,0x5358, 0, + 0, 0,0x5356,0x5355, 0, 0, 0, 0, + 0, 0, 0,0x4332, 0, 0,0x3245, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5352, 0,0x5354,0x3E28,0x3133, 0, 0, +0x5357, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x325E, 0, + 0, 0, 0, 0,0x5362, 0,0x3E7C,0x535E, + 0,0x535C, 0,0x535D, 0,0x535F, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x313D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4139, 0,0x5359, 0,0x535A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x337A, 0, 0, 0, 0, 0, 0, 0, + 0,0x5361, 0, 0, 0,0x346F, 0,0x5364, +0x5360,0x5363, 0, 0, 0, 0, 0, 0, + 0,0x4A2E, 0, 0, 0,0x4655, 0,0x4838, + 0, 0, 0, 0, 0,0x5366, 0, 0, + 0, 0, 0,0x5365,0x3345, 0, 0,0x5367, + 0, 0, 0, 0,0x536A, 0, 0, 0, + 0,0x5369, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5368, 0,0x4739, + 0, 0,0x536B, 0, 0, 0, 0, 0, + 0, 0, 0,0x536C, 0, 0, 0, 0, + 0,0x536E, 0,0x536D, 0, 0, 0, 0, + 0,0x5370, 0, 0, 0,0x5373,0x5371,0x536F, +0x5372, 0, 0, 0, 0,0x5374, 0, 0, + 0, 0, 0,0x5375, 0, 0,0x5376, 0, +0x5377, 0, 0, 0,0x5378,0x5145, 0,0x3C7C, +0x3B4D, 0, 0,0x3273, 0,0x3078, 0, 0, +0x4344, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5379, 0,0x3A24, 0,0x304F, +0x3F5E, 0, 0, 0, 0, 0,0x537A,0x3847, + 0, 0,0x3971, 0,0x537C,0x537B, 0, 0, +0x4A60,0x537D, 0, 0, 0,0x5421,0x537E, 0, +0x5422, 0,0x5423, 0,0x3777, 0, 0,0x3160, +0x5424, 0, 0,0x5426, 0,0x5425, 0, 0, + 0,0x5428, 0, 0,0x455A, 0, 0, 0, + 0, 0, 0,0x5429,0x3035,0x3A5F, 0, 0, + 0, 0,0x373D, 0, 0,0x434F, 0, 0, + 0, 0, 0, 0,0x542A,0x542B, 0, 0, +0x542D, 0, 0, 0, 0,0x542E, 0,0x3A64, + 0, 0, 0, 0,0x3651, 0, 0,0x4B37, + 0, 0, 0,0x542C,0x542F,0x3A41,0x3923, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5433, 0, + 0,0x3A25, 0,0x4333, 0, 0,0x5430,0x445A +}; + +/* page 27 0x577F-0x5A9B */ +static uint16 tab_uni_jisx020827[]={ +0x5434, 0, 0,0x3F62, 0, 0, 0, 0, + 0,0x5432,0x5435, 0,0x373F, 0, 0, 0, + 0, 0, 0, 0,0x5436, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5437, 0,0x3924,0x3340,0x5439, 0, 0, + 0, 0, 0,0x543A, 0, 0, 0, 0, + 0,0x543B, 0, 0,0x5438, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5431, 0, 0,0x543C, 0, 0,0x543D, + 0, 0, 0, 0,0x4B64, 0, 0,0x3E6B, + 0, 0, 0,0x543F,0x5440,0x543E, 0,0x5442, + 0, 0, 0, 0, 0,0x4738, 0, 0, +0x3068,0x4956, 0, 0,0x5443, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3E7D, 0, 0, +0x3C39, 0,0x475D,0x3470, 0,0x3A6B, 0, 0, + 0,0x4B59, 0,0x4632, 0, 0,0x3778,0x424F, + 0, 0, 0,0x5441,0x5444, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4244, 0, + 0, 0,0x5445, 0, 0, 0,0x5446, 0, + 0, 0,0x5448, 0, 0,0x4469, 0, 0, + 0, 0, 0,0x342E, 0, 0, 0, 0, +0x7421,0x3161,0x4A73, 0, 0,0x3E6C,0x4548, 0, + 0, 0, 0,0x3A66, 0, 0,0x544E, 0, + 0,0x4A3D,0x4E5D, 0, 0, 0, 0, 0, + 0, 0, 0,0x3274,0x544A, 0, 0, 0, + 0, 0,0x413A,0x544D, 0,0x4563, 0, 0, +0x4549,0x4564,0x4839,0x444D, 0, 0, 0,0x3A49, + 0, 0, 0,0x5449, 0, 0, 0, 0, + 0, 0,0x3176, 0,0x4536, 0, 0, 0, + 0,0x544B, 0,0x5447, 0, 0,0x3F50, 0, + 0, 0,0x544F, 0, 0, 0, 0,0x3D4E, + 0, 0, 0, 0,0x362D, 0,0x5450, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4A68, 0, 0, 0, +0x417D, 0, 0, 0, 0,0x4446, 0, 0, +0x5452, 0, 0, 0, 0, 0, 0, 0, + 0,0x4B4F, 0, 0,0x5453, 0, 0,0x5458, + 0, 0, 0, 0,0x4A2F, 0, 0, 0, + 0,0x5457,0x5451,0x5454,0x5456, 0, 0,0x3A26, + 0, 0,0x4A49, 0, 0, 0,0x5459, 0, +0x4345, 0, 0,0x3275, 0,0x3E6D, 0, 0, + 0, 0,0x545B, 0,0x545A, 0,0x3968, 0, +0x545C,0x545E,0x545D, 0, 0,0x5460, 0,0x5455, +0x5462, 0, 0, 0, 0,0x5461,0x545F, 0, + 0, 0, 0, 0,0x3B4E,0x3F51, 0,0x4154, +0x5463,0x403C,0x306D,0x4764, 0, 0, 0, 0, +0x445B, 0,0x5465,0x5464,0x5466,0x5467,0x5468, 0, + 0, 0, 0,0x5469, 0, 0, 0, 0, + 0, 0,0x4A51,0x546A, 0, 0, 0, 0, +0x3246,0x546B, 0, 0, 0, 0,0x4D3C,0x3330, + 0,0x5249,0x3D48,0x423F,0x546C,0x4C6B, 0, 0, + 0, 0, 0,0x4C34, 0, 0,0x546E, 0, +0x4267, 0,0x4537,0x4240,0x4957,0x546F,0x5470,0x317B, + 0, 0,0x3C3A,0x5471, 0, 0, 0, 0, +0x3050,0x5472, 0, 0, 0, 0, 0,0x5473, + 0, 0, 0, 0, 0,0x3162, 0, 0, +0x3471,0x4660,0x4A74, 0, 0, 0, 0,0x5477, +0x4155,0x5476,0x3740, 0, 0,0x4B5B,0x5475, 0, +0x4565,0x5479, 0,0x5478, 0, 0, 0, 0, + 0,0x547B, 0,0x547A, 0, 0,0x317C, 0, +0x547C,0x3E29,0x547E,0x4325, 0,0x547D, 0,0x4A33, + 0, 0, 0, 0,0x3D77,0x455B, 0, 0, + 0,0x5521, 0, 0, 0, 0,0x3925, 0, + 0, 0,0x5522,0x4721,0x485E,0x4C51, 0, 0, + 0, 0, 0,0x4725, 0, 0,0x552B, 0, + 0, 0, 0, 0,0x3538, 0, 0,0x4D45, + 0, 0,0x4C2F, 0,0x562C, 0,0x5523, 0, + 0, 0, 0, 0,0x5526, 0,0x4245, 0, + 0,0x4B38, 0, 0, 0,0x454A, 0, 0, + 0, 0, 0,0x5527, 0, 0, 0, 0, + 0, 0,0x4B65, 0,0x3A4A, 0, 0,0x3E2A, + 0, 0, 0, 0, 0, 0, 0,0x5528, + 0, 0,0x3B50, 0,0x3B4F, 0, 0, 0, + 0,0x3039,0x3848, 0,0x402B,0x3051, 0, 0, + 0, 0,0x552C,0x552D, 0,0x552A, 0, 0, + 0, 0, 0, 0, 0, 0,0x3138,0x342F, + 0,0x5529, 0,0x4C45,0x4931, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3028, + 0, 0, 0, 0,0x3079, 0, 0, 0, +0x3B51, 0,0x3052, 0,0x3023, 0, 0, 0, + 0, 0,0x5532, 0, 0, 0, 0, 0, + 0, 0,0x5530, 0, 0, 0, 0, 0, + 0,0x4C3C, 0,0x5533, 0,0x5531, 0, 0, +0x552F,0x3F31, 0, 0, 0, 0,0x552E, 0, + 0, 0,0x4A5A, 0, 0, 0, 0, 0, +0x3864, 0, 0, 0, 0, 0,0x5537,0x5538, + 0, 0, 0, 0, 0,0x3E2B, 0, 0, + 0,0x5534,0x4F2C, 0, 0, 0, 0,0x474C, + 0, 0,0x5536, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3A27, 0, 0, 0, 0, + 0, 0, 0,0x5539, 0, 0, 0,0x4958, + 0, 0, 0,0x553A, 0,0x5535, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4C3B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x475E, 0, 0, 0, 0, + 0, 0, 0,0x553B,0x4932}; + +/* page 28 0x5ABC-0x5D29 */ +static uint16 tab_uni_jisx020828[]={ +0x553C,0x5540,0x553D, 0, 0,0x3247,0x553F, 0, + 0, 0, 0, 0, 0,0x3C3B, 0,0x553E, +0x3779, 0, 0, 0,0x554C, 0, 0, 0, + 0, 0,0x5545,0x5542, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4364, 0,0x5541, + 0, 0,0x5543, 0, 0,0x5544, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5546,0x5547, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3472, 0,0x5549, +0x5548, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x554A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3E6E, 0, + 0, 0, 0, 0, 0, 0,0x554D, 0, +0x445C, 0, 0, 0,0x3145, 0,0x554B, 0, + 0, 0,0x554E, 0, 0, 0, 0, 0, + 0, 0,0x554F, 0,0x5552, 0, 0,0x5550, + 0,0x5551, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3B52,0x5553, 0, 0, +0x3926,0x5554, 0,0x3B7A,0x4238, 0,0x5555,0x5556, +0x3B5A,0x3927, 0,0x4C52, 0, 0, 0,0x3528, +0x3849,0x5557,0x3358, 0, 0,0x5558, 0,0x4239, + 0, 0, 0, 0,0x5559,0x5623, 0,0x555A, + 0,0x555B, 0, 0,0x555C, 0,0x555E, 0, + 0, 0, 0, 0,0x555F, 0, 0,0x5560, + 0,0x4270, 0,0x3127,0x3C69,0x3042, 0,0x4157, +0x3430,0x3C35, 0,0x3928, 0, 0, 0, 0, + 0,0x4566, 0,0x3D21,0x3431,0x4368,0x446A,0x3038, +0x3539,0x4A75, 0,0x3C42, 0, 0,0x3552,0x406B, +0x3C3C,0x4D28,0x5561, 0, 0, 0, 0, 0, + 0, 0,0x355C, 0,0x3A4B, 0, 0,0x3332, +0x3163,0x3E2C,0x3248, 0,0x5562,0x4D46, 0, 0, + 0, 0, 0,0x3D49, 0, 0,0x3C64,0x5563, +0x3473,0x4652,0x4C29,0x5564, 0,0x5565, 0, 0, +0x4959, 0, 0, 0,0x5567, 0,0x3428,0x3677, +0x5566, 0, 0, 0, 0, 0, 0,0x3432, + 0,0x3F32,0x556B,0x3B21, 0,0x3249,0x556A, 0, +0x5568,0x556C,0x5569,0x472B,0x5C4D,0x3F33, 0,0x556D, + 0, 0,0x4E40, 0,0x556E, 0, 0,0x5570, + 0,0x437E,0x556F, 0,0x4023, 0,0x3B7B, 0, + 0, 0,0x4250,0x3C77, 0,0x4975,0x406C, 0, +0x3C4D,0x5571,0x3E2D,0x5572,0x5573,0x3053,0x423A,0x3F52, + 0,0x5574,0x4633,0x3E2E, 0,0x3E2F, 0,0x5575, + 0, 0,0x406D, 0, 0, 0,0x3E30, 0, + 0, 0, 0, 0,0x5576, 0,0x5577, 0, +0x4C60, 0, 0, 0,0x5578, 0, 0, 0, + 0,0x3646, 0, 0, 0,0x3D22, 0, 0, + 0, 0, 0, 0,0x5579,0x557A,0x3C5C,0x3F2C, +0x4674,0x3F54,0x4878,0x4722,0x3649,0x557B, 0, 0, + 0,0x356F,0x557C, 0,0x367E, 0,0x464F,0x3230, + 0,0x3B53,0x557D,0x5622,0x5621,0x367D, 0,0x557E, + 0,0x4538, 0, 0, 0, 0, 0, 0, + 0, 0,0x4230, 0,0x454B,0x3C48, 0, 0, +0x4158,0x4D7A, 0, 0, 0, 0, 0, 0, +0x5624, 0,0x5625,0x4656, 0,0x3B33, 0, 0, + 0, 0,0x5627, 0, 0,0x5628, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5629, 0, 0, 0,0x3474,0x562A, 0, 0, +0x562B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x322C, 0, 0, + 0, 0, 0, 0,0x413B,0x3464, 0,0x562D, +0x4C28, 0, 0, 0, 0,0x4252, 0,0x3359, + 0, 0,0x562F,0x5631,0x345F, 0, 0,0x562E, +0x5630, 0,0x5633, 0, 0, 0, 0, 0, + 0,0x5632, 0,0x5634, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5635, 0, 0, + 0, 0, 0, 0,0x463D,0x362E, 0, 0, + 0, 0, 0, 0,0x3265,0x5636,0x563B, 0, + 0,0x5639, 0,0x4A77,0x4A76, 0, 0, 0, + 0, 0,0x4567, 0, 0, 0,0x5638,0x3D54, + 0,0x5637, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F72, 0, 0, 0,0x563C, + 0, 0,0x3A6A, 0, 0,0x5642, 0, 0, +0x5643,0x563D,0x3333,0x563E,0x5647,0x5646,0x5645,0x5641, + 0, 0, 0,0x5640, 0, 0,0x5644, 0, + 0, 0, 0, 0, 0,0x4A78}; + +/* page 29 0x5D4B-0x6BF3 */ +static uint16 tab_uni_jisx020829[]={ +0x564B,0x5648, 0,0x564A, 0,0x4D72, 0,0x5649, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x563F, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3F73, 0, + 0,0x564C, 0, 0,0x3A37, 0, 0, 0, +0x564D, 0, 0,0x564E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5651, + 0,0x5650, 0, 0,0x564F, 0, 0, 0, +0x4568,0x563A, 0, 0, 0,0x5657, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5653, 0, 0, 0, 0,0x5652, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5654, 0,0x5655, 0, 0, 0, 0, + 0, 0, 0, 0,0x5658, 0, 0,0x4E66, + 0,0x5659,0x5656, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x565A, 0, + 0,0x3460,0x565B, 0, 0, 0, 0,0x565D, +0x565C, 0, 0,0x565E, 0, 0, 0, 0, +0x565F, 0,0x406E,0x3D23, 0, 0,0x3D64, 0, +0x4163, 0,0x3929,0x3A38,0x392A,0x3570, 0, 0, +0x5660, 0, 0,0x3A39, 0, 0,0x384A,0x5661, +0x4C26,0x4743,0x5662, 0,0x392B, 0, 0, 0, +0x342C, 0,0x4327,0x3652, 0, 0, 0,0x3B54, +0x495B, 0, 0,0x4841, 0, 0, 0, 0, +0x5663,0x3475, 0, 0, 0, 0,0x5666, 0, + 0, 0, 0,0x4421, 0, 0,0x5665,0x5664, +0x5667, 0,0x446B, 0, 0, 0, 0, 0, + 0, 0,0x3F63, 0, 0, 0, 0, 0, +0x3B55, 0,0x404A, 0,0x4253,0x3522, 0, 0, +0x4422, 0, 0,0x5668,0x5669,0x3E6F, 0, 0, + 0, 0,0x4B39, 0, 0,0x566C, 0, 0, +0x566B,0x566A,0x497D, 0,0x5673, 0, 0, 0, + 0,0x4B5A, 0,0x566D, 0, 0, 0, 0, + 0,0x566F,0x4B6B, 0,0x566E, 0, 0, 0, + 0, 0, 0, 0,0x5670, 0,0x4828,0x5671, +0x4A3E,0x5672, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3433, +0x4A3F,0x472F,0x5674,0x5675, 0,0x392C,0x3434,0x5676, +0x3838,0x4D44,0x4D29,0x3476,0x5678, 0,0x4423, 0, +0x392D,0x3E31, 0, 0,0x485F, 0, 0,0x3E32, + 0, 0, 0, 0,0x3D78, 0, 0, 0, + 0, 0,0x446C,0x4A79,0x4539, 0, 0,0x392E, + 0,0x495C, 0, 0, 0,0x5679, 0, 0, + 0, 0, 0,0x4559,0x3A42, 0, 0, 0, +0x384B, 0,0x446D, 0, 0, 0, 0, 0, + 0, 0,0x3043,0x3D6E,0x392F,0x4D47, 0, 0, + 0, 0, 0, 0, 0, 0,0x567A,0x567B, +0x4751, 0, 0, 0, 0,0x567C,0x4E77,0x4F2D, + 0, 0, 0, 0,0x567E,0x567D, 0, 0, +0x3347, 0, 0,0x5721, 0, 0, 0,0x5724, +0x5725, 0,0x5723, 0,0x4940,0x3E33,0x5727,0x5726, +0x5722, 0, 0, 0, 0,0x5728,0x5729, 0, + 0,0x572A, 0, 0, 0,0x572D,0x572B, 0, +0x572C,0x572E, 0,0x3164,0x446E,0x572F, 0,0x377A, +0x3276,0x4736, 0,0x5730,0x467B, 0,0x4A5B, 0, +0x5731,0x4F2E, 0, 0, 0, 0,0x5732,0x4A40, +0x5735,0x5021,0x5031, 0,0x3C30,0x4675,0x5736, 0, +0x355D,0x4424,0x307A,0x5737,0x4A26,0x3930, 0, 0, +0x4350, 0, 0, 0,0x446F, 0, 0, 0, + 0, 0,0x4C6F,0x3839,0x384C, 0,0x5738, 0, + 0, 0,0x5739, 0,0x573F, 0,0x3C65, 0, + 0, 0,0x4425, 0,0x362F,0x573A, 0, 0, + 0,0x492B, 0,0x4346, 0, 0,0x573B, 0, + 0, 0, 0, 0, 0,0x573C, 0,0x3630, + 0,0x573D, 0,0x573E, 0, 0,0x5740, 0, +0x4576, 0, 0,0x5741,0x5742, 0,0x5743, 0, + 0,0x5734,0x5733, 0, 0, 0,0x5744,0x3741, + 0, 0, 0,0x4927, 0, 0,0x3A4C,0x4937, +0x4426,0x494B,0x5745, 0, 0,0x3E34,0x3146, 0, +0x5746, 0, 0, 0,0x5747, 0,0x4C72, 0, + 0,0x4860, 0, 0,0x574A,0x317D,0x402C,0x5749, +0x5748,0x3742,0x4254, 0,0x574E,0x574C, 0,0x574B, +0x4E27,0x3865, 0, 0, 0,0x3D79,0x574D,0x454C, +0x3D3E, 0, 0, 0,0x4640,0x5751,0x5750, 0, + 0, 0, 0,0x574F, 0,0x5752,0x3866, 0, + 0, 0, 0, 0, 0,0x5753,0x497C,0x3D5B, + 0, 0,0x5754,0x4879, 0, 0, 0, 0, +0x4641,0x4427, 0, 0, 0, 0,0x4530, 0, + 0,0x5755,0x352B, 0, 0, 0, 0, 0, +0x3F34, 0,0x492C, 0, 0, 0, 0, 0, + 0,0x3477,0x4726, 0, 0, 0, 0, 0, + 0, 0, 0,0x5756,0x3B56,0x4B3A,0x4B3B, 0, + 0,0x317E,0x575B, 0, 0,0x4369, 0, 0, + 0,0x5758, 0, 0, 0, 0, 0, 0, +0x3277, 0, 0, 0, 0,0x582D,0x575A, 0, + 0, 0,0x4730, 0, 0,0x5759, 0, 0, +0x5757, 0,0x397A, 0,0x575D, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5763,0x5769,0x5761, 0,0x455C, + 0, 0,0x5766,0x495D, 0, 0,0x5760, 0, +0x5765,0x4E67,0x3B57, 0, 0,0x4255,0x575E, 0, + 0, 0,0x355E,0x5768,0x402D,0x3165,0x5762,0x3278, +0x5767, 0, 0, 0,0x3631, 0,0x5764, 0, + 0, 0, 0, 0, 0, 0, 0,0x576A, + 0, 0, 0, 0, 0, 0,0x576C,0x5776, +0x5774, 0, 0,0x5771, 0, 0, 0,0x5770, +0x4E78, 0,0x5772, 0, 0,0x3632, 0,0x3931, + 0, 0,0x3D7A, 0, 0, 0,0x5779,0x576B, + 0, 0, 0, 0,0x576F,0x575F, 0,0x327A, +0x5773,0x5775,0x4351, 0, 0,0x3A28,0x3238,0x576D, +0x5778,0x5777,0x3633, 0,0x4229,0x3366, 0, 0, + 0, 0,0x3743, 0,0x576E, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x577A, 0, +0x577D,0x5821, 0, 0, 0, 0,0x3C3D, 0, +0x5827,0x4470,0x577B, 0, 0, 0, 0,0x5825, + 0,0x3279, 0,0x5823,0x5824, 0, 0,0x577E, +0x5822, 0, 0, 0,0x3867,0x4D2A, 0, 0, +0x3435, 0, 0,0x3159,0x5826, 0,0x473A,0x302D, + 0, 0, 0, 0, 0, 0, 0,0x4861, +0x575C,0x582C,0x5830,0x4C65, 0,0x5829, 0, 0, + 0,0x4569,0x582E, 0, 0, 0, 0, 0, + 0, 0,0x3E70,0x582F,0x4657, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4F47, 0, +0x582B, 0, 0, 0, 0,0x5831, 0,0x397B, + 0,0x404B, 0, 0,0x3054,0x582A,0x5828, 0, +0x415A, 0, 0, 0,0x577C,0x3B34, 0, 0, + 0, 0, 0, 0, 0,0x4246,0x583D, 0, +0x415B,0x5838, 0,0x5835,0x5836, 0,0x3C66,0x5839, +0x583C, 0, 0, 0, 0,0x5837,0x3D25, 0, +0x583A, 0, 0,0x5834, 0,0x4C7C,0x4C7B, 0, + 0, 0,0x583E,0x583F,0x3055, 0, 0, 0, + 0, 0,0x5833, 0, 0, 0, 0,0x3672, +0x3026, 0, 0, 0,0x3436, 0,0x583B, 0, + 0, 0, 0, 0,0x5843,0x5842, 0, 0, + 0,0x5847, 0, 0, 0, 0, 0, 0, + 0,0x5848, 0, 0, 0, 0, 0, 0, + 0,0x5846,0x5849,0x5841,0x5845, 0, 0,0x584A, + 0,0x584B, 0, 0,0x5840,0x3B7C, 0,0x5844, +0x4256,0x3932,0x5832,0x3F35, 0, 0, 0, 0, +0x5858, 0,0x4A69, 0, 0,0x584E,0x584F,0x5850, + 0, 0,0x5857, 0,0x5856, 0, 0,0x4B7D, +0x3437, 0,0x5854, 0,0x3745,0x3334, 0, 0, +0x5851, 0, 0,0x4E38,0x5853,0x3056,0x5855, 0, +0x584C,0x5852,0x5859,0x3744,0x584D, 0, 0, 0, + 0, 0, 0,0x4D5D, 0, 0, 0,0x4D2B, + 0, 0, 0, 0,0x585C, 0, 0,0x5860, + 0, 0, 0,0x417E, 0,0x4E79,0x5861, 0, + 0,0x585E, 0,0x585B, 0, 0,0x585A,0x585F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4A30, 0, 0,0x4634, 0,0x3746, 0, +0x5862,0x585D, 0,0x5863, 0, 0, 0,0x377B, + 0, 0, 0,0x3231, 0, 0, 0,0x586B, + 0, 0, 0,0x3438, 0, 0, 0, 0, +0x5869, 0, 0,0x586A,0x3A29,0x5868,0x5866,0x5865, +0x586C,0x5864,0x586E, 0, 0,0x327B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5870, 0, 0,0x586F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4428, + 0,0x5873, 0,0x5871,0x5867,0x377C, 0,0x5872, + 0,0x5876,0x5875,0x5877,0x5874,0x5878, 0, 0, + 0, 0, 0, 0, 0,0x5879,0x587A,0x4A6A, + 0,0x587C,0x587B,0x3D3F, 0,0x402E,0x3266,0x327C, + 0,0x587D, 0,0x303F, 0, 0, 0,0x404C, +0x587E, 0,0x6C43,0x5921,0x3761, 0,0x5922, 0, + 0, 0, 0,0x406F, 0, 0, 0,0x5923, + 0, 0, 0,0x5924,0x353A,0x5925, 0,0x5926, +0x5927,0x4257, 0, 0, 0,0x384D, 0, 0, +0x4C61, 0, 0, 0,0x4B3C,0x3D6A,0x5928, 0, + 0, 0, 0, 0,0x4070,0x6E3D,0x4862, 0, +0x3C6A, 0,0x3A4D,0x5929, 0, 0, 0, 0, +0x4247, 0,0x4A27, 0, 0,0x4271, 0, 0, +0x592C, 0, 0,0x592A, 0,0x592D, 0, 0, +0x592B, 0, 0, 0, 0,0x592E, 0, 0, + 0, 0, 0,0x4A31, 0, 0,0x3037, 0, + 0, 0, 0,0x495E, 0, 0,0x4863, 0, + 0,0x592F, 0,0x5932,0x3E35,0x353B, 0,0x5930, +0x5937,0x3E36, 0, 0, 0, 0,0x5931,0x4744, + 0, 0, 0, 0, 0, 0,0x4D5E,0x5933, +0x5934,0x5938,0x456A,0x5935,0x3933,0x405E, 0, 0, +0x5946,0x4834, 0,0x4272, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4864,0x5A2D, 0, 0, 0, 0,0x4A7A, 0, + 0, 0,0x4471, 0, 0, 0,0x4B75, 0, +0x593B,0x3221,0x436A, 0, 0, 0, 0,0x5944, + 0, 0,0x4334,0x593E,0x5945,0x5940,0x5947,0x5943, + 0,0x5942,0x476F, 0,0x593C,0x327D,0x593A,0x3571, +0x4273,0x5936, 0, 0,0x5939,0x3934,0x405B, 0, +0x3E37,0x5941,0x4752, 0, 0,0x3572,0x3348, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3367,0x3F21,0x5949,0x594E, 0,0x594A, 0, +0x377D, 0,0x594F,0x3B22,0x3969, 0, 0, 0, + 0, 0, 0,0x3D26,0x593D, 0,0x3B7D,0x594C, + 0, 0, 0, 0,0x3B58,0x594D,0x3044, 0, + 0,0x5948, 0, 0, 0, 0,0x4429, 0, + 0, 0, 0, 0, 0, 0,0x3573, 0, + 0, 0, 0, 0,0x3634, 0, 0, 0, + 0, 0, 0, 0,0x594B,0x3027, 0, 0, +0x3A43, 0, 0, 0,0x3F36, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4472, + 0, 0,0x4854,0x5951,0x415E, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x422A, 0, + 0,0x3B2B,0x5952, 0,0x5954,0x5950, 0, 0, + 0, 0,0x4A61, 0,0x443D, 0, 0, 0, + 0,0x415C, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4A7B,0x3C4E,0x5960, 0, +0x595F, 0, 0,0x3F78, 0, 0, 0,0x377E, + 0, 0, 0,0x5959,0x3E39, 0, 0,0x4668, +0x4731, 0, 0, 0, 0,0x5957, 0, 0, +0x415D, 0, 0, 0, 0,0x3C78,0x595C, 0, + 0,0x3E38, 0,0x5956,0x595B, 0, 0,0x4753, + 0, 0, 0,0x5955, 0,0x3721, 0, 0, +0x335D, 0, 0, 0,0x595D,0x4E2B,0x3A4E,0x4335, +0x595A, 0,0x405C, 0,0x3935,0x3F64,0x3166,0x413C, +0x5958,0x3545, 0, 0, 0, 0, 0,0x3747, + 0,0x444F,0x595E, 0, 0, 0, 0, 0, +0x415F, 0, 0,0x5961, 0,0x5963, 0, 0, +0x4237,0x5969, 0,0x5964, 0, 0,0x5966, 0, + 0, 0, 0, 0,0x4941,0x4473, 0,0x5967, + 0, 0, 0,0x4D2C, 0, 0, 0,0x4D48, +0x3439, 0, 0, 0, 0, 0,0x302E, 0, +0x5965, 0, 0, 0, 0, 0,0x5962, 0, + 0, 0, 0,0x3478, 0, 0, 0, 0, + 0,0x3167, 0,0x5968, 0, 0, 0,0x4D49, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x596C, 0, 0, 0, 0, + 0, 0,0x423B, 0,0x5973, 0, 0, 0, +0x596D, 0, 0,0x596A,0x5971, 0, 0, 0, + 0,0x5953, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x596E, 0,0x5972, 0, 0, + 0,0x4842,0x456B, 0, 0, 0, 0, 0, + 0,0x596B, 0,0x596F, 0, 0, 0,0x3748, + 0, 0, 0,0x3A71, 0, 0, 0,0x405D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5977, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4526, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5974, 0,0x4B60, 0, + 0, 0, 0, 0,0x5975, 0, 0, 0, + 0, 0, 0,0x5976, 0,0x4C4E, 0,0x4022, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3762, 0, 0, 0, 0,0x597D, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3B35, +0x597A, 0,0x5979, 0, 0, 0, 0,0x4732, + 0, 0, 0,0x4635, 0, 0, 0, 0, + 0,0x4531,0x597B, 0, 0, 0,0x597C, 0, +0x496F, 0,0x4745,0x3B23, 0,0x4071, 0,0x4B50, + 0, 0, 0, 0, 0, 0,0x3349, 0, +0x5A25,0x597E, 0, 0, 0, 0,0x4D4A,0x5A27, + 0, 0,0x5A23, 0,0x5A24, 0, 0, 0, + 0, 0,0x4160, 0, 0, 0, 0,0x5A22, + 0,0x593F, 0, 0, 0,0x5A26, 0,0x5A21, + 0, 0, 0, 0, 0,0x5A2B,0x5A2C,0x4527, +0x5A2E, 0, 0,0x3B24,0x5A29, 0, 0, 0, + 0,0x353C, 0, 0,0x5A2F, 0,0x5A28,0x5A33, + 0,0x5A32, 0,0x5A31, 0, 0, 0,0x5A34, + 0, 0,0x5A36,0x3E71, 0,0x5A35, 0, 0, + 0, 0,0x5A39, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5A37, 0, 0, + 0,0x5A38,0x5970, 0, 0, 0, 0, 0, +0x5A3B,0x5A3A, 0, 0, 0, 0, 0,0x5978, +0x5A3C,0x5A30, 0, 0,0x3B59, 0, 0, 0, + 0,0x5A3D,0x5A3E,0x5A40,0x5A3F,0x5A41,0x327E, 0, +0x3936, 0, 0,0x4A7C,0x402F, 0, 0, 0, + 0, 0,0x384E, 0, 0,0x5A43, 0, 0, + 0, 0,0x5A46, 0,0x4952, 0,0x355F, 0, + 0, 0,0x5A45,0x5A44,0x4754,0x5A47,0x3635, 0, + 0, 0,0x5A49,0x5A48, 0, 0, 0,0x343A, +0x3B36, 0, 0,0x4658, 0, 0, 0, 0, + 0,0x3749, 0, 0, 0,0x3F74, 0,0x5A4A, + 0,0x4030,0x4528, 0,0x495F,0x5A4B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5A4C, +0x5A4D, 0, 0, 0,0x4A38,0x555D,0x4046, 0, + 0,0x494C, 0,0x3A58, 0,0x4865,0x4843, 0, + 0, 0, 0, 0,0x454D, 0,0x4E41, 0, +0x5A4F,0x3C50, 0, 0,0x5A50, 0,0x3036, 0, + 0,0x3654,0x404D, 0,0x4960, 0, 0, 0, +0x5A51,0x3B42,0x4347, 0,0x3B5B,0x3F37, 0, 0, + 0, 0, 0, 0,0x5A52, 0,0x4A7D, 0, + 0,0x3177,0x3B5C, 0, 0, 0,0x5A55, 0, +0x5A53,0x5A56,0x4E39,0x5A54, 0, 0, 0, 0, +0x407B,0x5A57, 0, 0,0x4232, 0, 0,0x5A58, + 0, 0, 0, 0,0x347A, 0,0x5A5A, 0, +0x5A59, 0, 0, 0, 0,0x5A5B,0x5A5C,0x347B, + 0, 0,0x467C,0x4336,0x356C,0x3B5D,0x4161, 0, + 0,0x3D5C,0x3030, 0, 0, 0,0x5A5D, 0, + 0, 0, 0, 0, 0, 0, 0,0x3222, +0x5A61, 0, 0, 0, 0, 0, 0,0x3937, +0x5A60, 0, 0,0x3A2B,0x3E3A, 0, 0,0x5A5F, + 0,0x3E3B, 0,0x4C40,0x3A2A, 0, 0, 0, +0x3057,0x404E, 0, 0, 0, 0, 0, 0, + 0,0x5A66, 0, 0,0x4031,0x3147, 0, 0, + 0, 0,0x3D55, 0,0x4B66,0x3A72, 0, 0, + 0, 0,0x3E3C, 0,0x4027, 0, 0, 0, + 0,0x5A65,0x5A63,0x5A64, 0, 0, 0, 0, + 0,0x436B, 0, 0,0x5B26, 0,0x5A6A,0x3B7E, +0x3938,0x5A68, 0, 0, 0, 0,0x5A69, 0, +0x3F38, 0, 0, 0,0x5A67, 0, 0,0x3B2F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5A6C,0x5A6B,0x5A70, 0, 0,0x5A71, + 0,0x5A6D, 0,0x3322,0x5A6E,0x5A6F,0x4855, 0, + 0, 0, 0,0x4961,0x374A,0x5A72, 0, 0, + 0,0x4032, 0,0x3E3D, 0, 0, 0,0x4352, + 0, 0, 0, 0, 0, 0,0x3647, 0, +0x5A73,0x5A77, 0, 0,0x324B,0x5A74,0x5A76, 0, + 0, 0, 0,0x5A75, 0, 0,0x3D6B, 0, + 0, 0, 0,0x4348,0x3045,0x5A78, 0, 0, + 0, 0,0x5A79, 0, 0, 0, 0,0x442A, + 0, 0, 0,0x4E71, 0, 0, 0, 0, +0x3B43, 0, 0,0x4A6B, 0, 0, 0, 0, + 0,0x4B3D, 0, 0, 0,0x5B22,0x5A7B, 0, + 0,0x5A7E, 0,0x5A7D, 0, 0,0x5A7A, 0, + 0,0x5B21, 0, 0,0x465E, 0,0x5A7C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5B23, 0, 0,0x3D6C,0x5B24, + 0,0x4D4B,0x4778, 0, 0,0x5B25, 0, 0, + 0, 0, 0,0x5B27, 0, 0,0x5B28, 0, + 0, 0, 0, 0, 0,0x5B29, 0,0x364A, +0x3148,0x3939,0x5B2A, 0,0x5B2B,0x3D71,0x4162, 0, + 0,0x5258,0x413E,0x413D,0x4258,0x3A47, 0, 0, +0x5072, 0, 0, 0, 0,0x376E,0x4D2D, 0, +0x4A7E, 0,0x497E, 0,0x5B2C, 0, 0, 0, + 0,0x3A73,0x443F,0x5B2D,0x4F2F, 0, 0, 0, +0x4B3E, 0,0x442B,0x5B2E,0x347C, 0, 0, 0, + 0, 0, 0,0x5B2F,0x5B30,0x4C5A, 0,0x4C24, +0x4B76,0x4B5C,0x3B25,0x5B32, 0, 0,0x3C6B, 0, + 0,0x4B51, 0,0x5B34,0x5B37,0x5B36, 0,0x3479, + 0, 0,0x3560, 0,0x5B33, 0,0x5B35, 0, + 0, 0, 0,0x5B38, 0, 0,0x3F79, 0, + 0, 0, 0,0x4D7B,0x3049,0x3A60,0x423C, 0, +0x3C5D, 0, 0,0x3E73, 0, 0,0x5B3B, 0, + 0,0x454E, 0,0x5B39,0x422B,0x5B3A,0x3E72,0x4C5D, +0x5B3C,0x5B3D,0x4D68, 0, 0, 0, 0,0x5B42, + 0, 0,0x393A, 0,0x4755,0x5B3F,0x456C,0x5A5E, +0x5A62, 0,0x354F, 0,0x4747, 0, 0, 0, + 0,0x5B41, 0,0x3E3E,0x4844, 0, 0, 0, + 0, 0,0x5B47, 0,0x487A, 0,0x5B3E, 0, +0x5B44,0x5B43, 0, 0, 0,0x404F, 0, 0, + 0, 0,0x4B6D, 0,0x4E53, 0, 0,0x4B67, + 0,0x324C,0x3B5E, 0, 0,0x4F48,0x5B46,0x3F75, + 0, 0, 0,0x5B45, 0, 0,0x5B40, 0, + 0, 0, 0, 0,0x384F, 0, 0, 0, +0x5B4C,0x5B4A, 0,0x324D,0x5B48,0x5B4E,0x5B54, 0, + 0, 0, 0, 0, 0, 0,0x4248, 0, + 0,0x4A41, 0,0x5B56, 0, 0, 0,0x4922, + 0, 0, 0,0x5B55,0x4770,0x4B3F,0x343B, 0, +0x4077,0x3D40, 0, 0, 0,0x4453, 0,0x4D2E, + 0, 0,0x5B51,0x5B50, 0, 0, 0,0x5B52, + 0,0x5B4F, 0, 0,0x5B57, 0,0x5B4D, 0, + 0,0x5B4B, 0,0x5B53,0x5B49, 0,0x436C, 0, +0x4C78,0x3C46,0x3A74, 0, 0, 0, 0, 0, +0x3A3A, 0, 0,0x4B6F,0x3341, 0, 0,0x444E, +0x464A,0x3149, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4072, 0, 0,0x4034,0x372A, 0, 0, 0, + 0, 0, 0,0x5B59, 0, 0,0x393B,0x337C, + 0, 0, 0, 0, 0, 0,0x5B5B,0x3374, +0x5B61, 0, 0, 0, 0, 0, 0,0x5B5E, + 0,0x4073, 0, 0, 0,0x334B,0x3A2C, 0, + 0,0x334A,0x3A4F, 0, 0,0x5B5C,0x3765,0x374B, +0x456D, 0, 0,0x5B5A, 0,0x3046, 0, 0, + 0, 0,0x5B5D,0x5B5F, 0,0x364D,0x372C, 0, +0x343C,0x354B, 0, 0, 0, 0,0x5B62, 0, + 0,0x3A79,0x4B71, 0,0x3B37, 0, 0, 0, +0x5B63, 0, 0, 0,0x4930, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B6F, 0,0x3233,0x5B64, 0, 0, 0, + 0, 0, 0,0x5B75,0x5B65, 0,0x4E42, 0, +0x5B6C, 0,0x475F, 0, 0, 0, 0, 0, + 0, 0,0x5B74, 0,0x5B67, 0, 0, 0, +0x3034,0x5B69, 0, 0,0x393C, 0, 0, 0, +0x5B6B, 0,0x5B6A, 0,0x5B66,0x5B71, 0,0x3E3F, + 0, 0, 0,0x546D,0x3868,0x4D7C, 0, 0, + 0, 0,0x5B68, 0,0x4474,0x3323,0x3A2D, 0, +0x5B60, 0,0x5B70,0x3361, 0, 0,0x5B6E,0x5B72, + 0,0x456E, 0, 0, 0, 0, 0, 0, + 0,0x347E, 0,0x5C32, 0, 0,0x4C49,0x5B77, +0x347D, 0,0x5B7E, 0, 0, 0, 0,0x4B40, + 0,0x5C21,0x5C23, 0,0x5C27,0x5B79, 0,0x432A, + 0, 0, 0, 0,0x456F,0x5C2B,0x5B7C, 0, +0x5C28, 0, 0, 0,0x5C22, 0, 0, 0, + 0, 0, 0,0x3F39,0x5C2C, 0, 0,0x4033, + 0, 0, 0, 0, 0, 0,0x5C2A,0x343D, + 0, 0, 0, 0, 0,0x4F50,0x5B76, 0, + 0,0x5C26,0x3058, 0, 0,0x5B78, 0, 0, +0x4C3A,0x5B7D,0x3F22,0x4447,0x5B73, 0, 0,0x5C25, + 0, 0, 0, 0, 0, 0,0x3F7A,0x5C2F, +0x3371,0x3821, 0, 0, 0, 0,0x5C31,0x5B7A, +0x5C30, 0,0x5C29,0x5B7B, 0,0x5C2D, 0,0x5C2E, + 0, 0, 0, 0, 0,0x5C3F, 0, 0, + 0,0x464E, 0,0x5C24, 0, 0,0x5C3B, 0, + 0, 0,0x5C3D, 0,0x4458, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4D4C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4976,0x5C38,0x424A, 0, 0, 0,0x5C3E,0x413F, + 0,0x5C35,0x5C42,0x5C41, 0,0x466F,0x5C40,0x466A, + 0, 0, 0, 0, 0, 0, 0,0x5C44, +0x5C37, 0,0x3648,0x5C3A,0x3D5D, 0, 0, 0, +0x4760,0x5C3C,0x364B, 0,0x5C34,0x5C36,0x5C33, 0, + 0,0x4F30,0x335A,0x5C39, 0, 0,0x5C43,0x3335, + 0, 0, 0, 0, 0, 0, 0,0x3A67, + 0, 0, 0,0x315D, 0, 0,0x5C54, 0, + 0,0x4F31,0x5C57, 0, 0, 0, 0, 0, +0x3F3A,0x5C56, 0, 0, 0,0x5C55, 0, 0, + 0, 0, 0, 0,0x5C52, 0, 0, 0, + 0, 0, 0,0x5C46, 0, 0,0x5C63,0x5C45, + 0,0x5C58, 0, 0, 0, 0, 0, 0, +0x5C50, 0, 0,0x5C4B,0x5C48, 0,0x5C49, 0, +0x5C51, 0, 0, 0,0x7422, 0, 0,0x5C4E, +0x393D,0x4448,0x4164,0x5C4C, 0,0x5C47, 0, 0, +0x5C4A, 0, 0, 0, 0,0x4D4D,0x4B6A, 0, + 0, 0,0x5C4F,0x5C59, 0, 0, 0, 0, + 0, 0, 0, 0,0x5C61,0x5C5A, 0, 0, +0x5C67, 0,0x5C65, 0, 0, 0, 0,0x5C60, + 0, 0, 0, 0, 0, 0,0x5C5F, 0, +0x4450, 0,0x4165, 0,0x5C5D, 0, 0,0x5C5B, + 0, 0,0x5C62, 0, 0, 0, 0,0x5C68, +0x4875,0x5C6E, 0, 0, 0, 0, 0,0x5C69, +0x5C6C,0x5C66, 0, 0,0x4374, 0,0x4938, 0, +0x5C5C, 0, 0,0x5C64,0x3E40, 0,0x4C4F,0x5C78, +0x5C6B, 0, 0, 0, 0, 0,0x3822,0x3223, +0x335F, 0, 0,0x5C53, 0, 0, 0, 0, + 0, 0,0x3E41,0x5C70, 0,0x5C77,0x3C79,0x3372, + 0, 0,0x432E, 0, 0, 0, 0, 0, + 0,0x5C6D, 0, 0,0x5C72,0x5C76, 0, 0, +0x3636, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x354C,0x5C74, 0, + 0, 0, 0, 0,0x3521, 0,0x464B,0x5C73, + 0, 0, 0,0x5C75, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5C6F, + 0, 0, 0, 0, 0,0x5C71, 0, 0, + 0, 0, 0, 0,0x3360,0x4349, 0, 0, + 0,0x5C7C, 0, 0, 0, 0, 0, 0, + 0, 0,0x5C7A,0x3869, 0,0x5C79, 0, 0, + 0, 0, 0, 0,0x5D21, 0, 0, 0, + 0,0x5B58, 0, 0, 0,0x5C7B, 0,0x5C7D, +0x5C7E, 0, 0, 0, 0, 0, 0,0x5D2C, + 0,0x5D28, 0,0x5B6D, 0, 0, 0, 0, +0x5D27, 0, 0, 0, 0,0x5D26, 0, 0, +0x5D23, 0, 0, 0, 0, 0,0x5C6A,0x5D25, +0x5D24, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5D2A, 0, +0x4F26, 0, 0, 0, 0, 0, 0,0x5D2D, +0x367B, 0, 0,0x5D29,0x5D2B, 0, 0, 0, + 0, 0, 0, 0, 0,0x4827, 0,0x5D2E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5D32, +0x5D2F, 0, 0, 0, 0, 0, 0, 0, + 0,0x4D73,0x5D30, 0, 0, 0, 0,0x5C5E, + 0, 0, 0, 0, 0, 0, 0,0x5D33, + 0, 0, 0,0x5D34, 0, 0, 0, 0, + 0, 0,0x3135, 0,0x5D36,0x3767,0x3C21, 0, +0x3655, 0, 0, 0,0x3224, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4D5F, + 0, 0, 0, 0,0x5D38,0x5D37,0x5D3A,0x353D, + 0, 0,0x3656,0x343E, 0, 0, 0, 0, +0x5D3D, 0, 0, 0,0x5D3C, 0,0x5D3E, 0, + 0,0x324E, 0,0x4337, 0,0x5D3F, 0, 0, +0x343F,0x5D41, 0, 0, 0, 0,0x5D40, 0, +0x5D42, 0, 0, 0,0x5D43, 0,0x5D44,0x3B5F, +0x4035,0x3A21, 0,0x4970, 0, 0,0x4A62,0x4F44, + 0, 0, 0, 0,0x3B75, 0, 0, 0, +0x3A50,0x4E72, 0, 0, 0,0x5D45,0x5D46, 0, +0x3B60, 0, 0, 0,0x5D47,0x5D48, 0, 0, +0x5D4A,0x5D49, 0,0x4B58, 0, 0,0x3D5E,0x3C6C, +0x3B44, 0,0x5D4B, 0, 0, 0, 0, 0, + 0, 0,0x5D4D,0x3F23, 0,0x5D4C, 0, 0, + 0, 0, 0,0x5D4E, 0, 0, 0, 0, + 0,0x5D4F, 0, 0, 0, 0, 0,0x5D50, +0x5D51, 0, 0, 0,0x5D52, 0,0x5D54,0x5D53, +0x5D55,0x3225,0x434A, 0,0x5D56, 0, 0,0x3B26, +0x334C,0x5D57, 0, 0,0x4542,0x544C, 0, 0, + 0, 0,0x3523,0x5D58, 0, 0, 0, 0, +0x5D59, 0,0x4A6C,0x4B68, 0, 0, 0,0x4647, +0x5D5A,0x4866, 0, 0, 0,0x487B, 0, 0, +0x4C53, 0, 0, 0,0x5D5B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5D5D,0x5D5C, 0, 0,0x5D5F, 0, 0, 0, +0x5D5E}; + +/* page 30 0x6C08-0x6CF3 */ +static uint16 tab_uni_jisx020830[]={ +0x5D61, 0, 0, 0, 0, 0, 0,0x3B61, + 0,0x4C31, 0,0x5D62,0x5D63, 0, 0,0x3524, + 0, 0, 0,0x5D64, 0, 0, 0, 0, + 0, 0, 0,0x5D66,0x5D65, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3F65, 0, 0,0x4939, +0x314A, 0, 0, 0, 0, 0,0x4845, 0, +0x4475,0x3D41,0x3561, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4846, 0, +0x3C2E, 0, 0, 0, 0,0x5D68, 0,0x3440, + 0, 0,0x3178, 0, 0,0x4672,0x5D67,0x393E, +0x4353, 0,0x5D69, 0, 0, 0, 0, 0, +0x5D71, 0,0x5D6A, 0, 0, 0, 0, 0, +0x4241, 0,0x3562,0x5D72, 0, 0, 0, 0, + 0, 0,0x3768, 0, 0,0x3525,0x5D70, 0, + 0,0x5D6E,0x5D6B,0x4D60, 0, 0, 0, 0, +0x4440, 0, 0, 0,0x4659,0x5D6C, 0, 0, +0x5D74, 0,0x5D73,0x3723, 0, 0,0x322D, 0, + 0,0x3A3B,0x5D6D,0x5D6F, 0, 0, 0, 0, + 0,0x4B57,0x4274, 0, 0, 0, 0, 0, + 0, 0, 0,0x4B77, 0, 0,0x5D7C, 0, + 0,0x5D7D, 0,0x324F, 0, 0, 0, 0, +0x4A28,0x4C7D,0x5E21,0x3C23,0x3E42,0x5D78,0x5D7E,0x3168, + 0,0x3637, 0, 0,0x5D75,0x5D7A, 0, 0, + 0,0x4074,0x4771, 0,0x4867, 0, 0, 0, + 0, 0, 0,0x5D77, 0,0x4B21, 0,0x5D79, + 0,0x5E24, 0,0x5E22, 0,0x5D7B, 0, 0, + 0,0x4B22,0x4748,0x3563, 0,0x4525, 0, 0, +0x436D, 0,0x5E25, 0, 0, 0, 0,0x5E23, +0x4259,0x5D76, 0,0x314B}; + +/* page 31 0x6D0B-0x7409 */ +static uint16 tab_uni_jisx020831[]={ +0x4D4E,0x5E30, 0, 0, 0, 0, 0,0x5E2F, + 0, 0, 0, 0,0x4076, 0,0x5E2C, 0, +0x4D6C, 0, 0,0x4636,0x5E26, 0, 0, 0, + 0, 0,0x4445, 0, 0, 0,0x314C,0x393F, +0x5E29, 0, 0, 0, 0, 0, 0,0x3D27, +0x5E2E, 0,0x5E2D,0x5E28, 0,0x5E2B, 0, 0, +0x3368, 0,0x5E2A,0x4749, 0, 0,0x4E2E, 0, + 0,0x3E74,0x4075, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5E36,0x5E34, + 0,0x494D, 0, 0, 0, 0, 0, 0, +0x5E31,0x5E33, 0,0x313A, 0, 0,0x3940,0x4F32, + 0,0x333D, 0,0x4962, 0, 0, 0, 0, + 0,0x4D61, 0, 0,0x3324,0x3F3B,0x5E35, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5E3A, 0, 0,0x3E43, 0, 0, + 0,0x4D30, 0,0x5E37, 0, 0, 0, 0, +0x5E32, 0,0x5E38, 0, 0, 0,0x4E5E, 0, +0x4573,0x4642, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3336, 0, 0,0x3155, + 0, 0,0x5E3E, 0, 0,0x5E41, 0, 0, + 0,0x4E43, 0, 0, 0,0x4D64, 0, 0, + 0, 0,0x5E48,0x5E42,0x5E3F, 0, 0, 0, +0x4E54,0x5E45, 0, 0, 0, 0,0x3D4A,0x5E47, + 0, 0,0x5E4C, 0, 0,0x4571,0x5E4A, 0, + 0, 0, 0,0x5E44, 0, 0,0x4338, 0, + 0,0x5E4B, 0,0x5E40, 0,0x5E46, 0,0x5E4D, +0x307C,0x5E43, 0,0x5E4E, 0, 0,0x3F3C, 0, +0x3D5F, 0,0x4A25, 0,0x3A2E, 0,0x5E3B,0x5E49, +0x453A, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4036, 0,0x3369,0x3A51,0x3E44,0x5E3D, +0x3D42, 0, 0, 0, 0, 0, 0, 0, +0x374C, 0,0x5E3C, 0, 0, 0,0x5E52,0x3D6D, +0x383A, 0,0x5E61, 0,0x5E5B,0x3574,0x454F, 0, +0x5E56,0x5E5F,0x302F,0x3132, 0, 0,0x3239, 0, +0x5E58,0x422C,0x5E4F,0x5E51,0x3941, 0, 0, 0, + 0, 0, 0, 0, 0,0x5E62, 0,0x5E5D, + 0, 0, 0,0x5E55, 0, 0, 0, 0, +0x5E5C, 0, 0, 0, 0, 0, 0,0x4C2B, + 0, 0,0x5E5A,0x5E5E, 0, 0, 0, 0, + 0, 0, 0,0x3850, 0,0x3E45, 0, 0, +0x4339, 0, 0, 0,0x5E54, 0, 0, 0, + 0, 0, 0, 0,0x4D2F, 0, 0, 0, +0x5E57, 0, 0,0x5E50,0x4572, 0, 0,0x5E53, + 0, 0, 0,0x5E59, 0, 0, 0, 0, + 0, 0, 0,0x4F51,0x3C3E,0x4B7E, 0,0x5E63, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x482E, 0, 0,0x5E6F,0x383B, 0, 0, + 0, 0, 0,0x3D60, 0,0x5E65, 0, 0, + 0,0x4E2F,0x3942, 0,0x5E72, 0, 0,0x306E, + 0, 0,0x5E70, 0, 0, 0, 0,0x5E64, + 0, 0, 0, 0,0x5E6A, 0, 0,0x5E6C, + 0, 0, 0,0x4D4F,0x5E67, 0, 0,0x452E, + 0, 0,0x5E69, 0, 0, 0, 0,0x5E71, + 0,0x5E6B,0x4C47, 0, 0, 0,0x5E66, 0, +0x3C22,0x5E7E, 0, 0, 0, 0,0x336A, 0, +0x5E68,0x5E6D,0x5E6E, 0, 0, 0, 0, 0, + 0, 0,0x426C,0x425A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E76, 0, 0,0x5E7C, 0, 0,0x5E7A, + 0,0x4529, 0, 0,0x5F23,0x5E77, 0, 0, + 0, 0, 0,0x5E78,0x5E60, 0,0x3579,0x493A, + 0, 0, 0,0x3C3F, 0, 0,0x3977, 0, + 0, 0, 0, 0,0x4F33, 0,0x5E74, 0, +0x5F22,0x3169,0x4166, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4779, 0,0x3441, +0x4E7A, 0, 0, 0, 0, 0, 0, 0, +0x4C21,0x4452, 0, 0, 0, 0,0x5E7B,0x5E7D, + 0, 0, 0, 0, 0,0x4132, 0, 0, + 0, 0, 0,0x5F21,0x5E79, 0,0x5E73, 0, + 0, 0,0x3443, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3769, 0, 0, 0,0x5F2F, 0, 0, +0x5F2A,0x4078, 0, 0,0x3363, 0, 0, 0, + 0,0x3D61, 0,0x5F33, 0, 0, 0, 0, + 0, 0,0x5F2C,0x442C,0x5F29,0x4459, 0, 0, + 0,0x5F4C, 0, 0, 0,0x5F26, 0,0x5F25, + 0,0x5F2E, 0, 0, 0,0x5F28,0x5F27,0x5F2D, + 0,0x4021, 0,0x5F24, 0, 0, 0, 0, + 0, 0, 0,0x5F30, 0, 0,0x5F31, 0, + 0, 0, 0, 0,0x3442, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F36, 0, +0x5F35,0x5F37, 0, 0, 0, 0, 0,0x5F3A, + 0, 0, 0, 0, 0, 0,0x4543, 0, +0x5F34, 0, 0, 0, 0, 0,0x5F38, 0, + 0, 0, 0, 0, 0,0x3763,0x4279,0x5F32, +0x473B, 0, 0,0x5F39, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F3E,0x5F3C, 0, 0,0x5F3F, 0, 0, +0x5F42, 0, 0, 0,0x5F3B,0x396A,0x4728, 0, + 0,0x5E39, 0, 0, 0, 0, 0, 0, +0x4D74,0x5F3D, 0,0x5F41,0x4275, 0,0x5F40, 0, +0x5F2B, 0, 0,0x6F69, 0, 0, 0,0x5F45, + 0, 0, 0,0x5F49, 0, 0,0x5F47, 0, + 0, 0, 0, 0, 0, 0,0x5F43, 0, +0x5F44, 0, 0, 0,0x5F48, 0,0x5F46, 0, + 0, 0,0x494E, 0, 0,0x5F4E, 0,0x5F4B, +0x5F4A, 0,0x5F4D,0x4654,0x5F4F, 0, 0, 0, + 0, 0, 0,0x4375,0x426D, 0, 0, 0, + 0,0x4025, 0, 0, 0,0x5F50, 0,0x5F52, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5F51, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E75, 0, 0, 0, 0,0x5F53, 0, + 0, 0, 0, 0, 0,0x4667, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F54, 0, 0, 0, 0, 0, 0, 0, +0x3250, 0, 0, 0,0x4574,0x3325, 0, 0, + 0, 0, 0, 0, 0,0x3564, 0, 0, + 0,0x3C5E,0x3A52, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4F27,0x3F66, + 0, 0, 0,0x316A, 0, 0, 0,0x5F56, + 0, 0, 0, 0, 0, 0,0x5F55, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F59,0x433A,0x5F5C,0x5F57, 0, 0, 0, +0x5F5B, 0, 0, 0, 0,0x5F5A,0x4540,0x3059, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4E75, 0, 0, +0x5F5E, 0, 0, 0,0x3128, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F60, 0, + 0, 0,0x5F5F, 0,0x5F5D, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F58, 0, + 0, 0, 0, 0, 0, 0,0x4B23, 0, + 0, 0,0x5F62, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5F61, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x316B, 0, 0, 0, 0,0x5F64,0x4A32, + 0,0x5F63, 0, 0, 0, 0,0x4C35, 0, + 0, 0, 0,0x3E47, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4133, 0, 0, 0, 0, + 0,0x3E46, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4E7B, 0, + 0,0x5F6A, 0,0x4079, 0, 0, 0, 0, + 0, 0,0x5F66,0x5F6B, 0, 0,0x316C, 0, + 0, 0, 0, 0, 0, 0, 0,0x5F69, + 0,0x4761,0x5F65,0x5F68,0x3E48, 0,0x4851, 0, + 0,0x5F6C, 0,0x3C51, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x407A, 0, 0, 0, 0, 0, + 0,0x5F6F, 0, 0, 0,0x5F67, 0,0x3727, + 0, 0, 0, 0,0x5F6D, 0, 0, 0, + 0,0x4D50,0x5F70, 0, 0, 0,0x7426, 0, + 0, 0, 0, 0,0x3D4F, 0, 0, 0, + 0, 0, 0, 0, 0,0x5F71, 0, 0, + 0,0x5F72, 0, 0, 0, 0,0x472E, 0, + 0, 0, 0, 0, 0, 0,0x5F74, 0, + 0, 0, 0,0x5F75, 0, 0, 0, 0, +0x4733, 0, 0, 0, 0,0x4575,0x5F77, 0, + 0, 0, 0,0x5F79, 0,0x4E55, 0,0x5F76, + 0,0x5F78,0x316D, 0,0x5F73, 0, 0, 0, + 0, 0, 0, 0,0x535B,0x5F7A, 0, 0, + 0, 0,0x4167,0x3B38,0x5F7C, 0, 0, 0, + 0,0x5F7B,0x3F24,0x5259, 0, 0, 0, 0, + 0, 0,0x5F7D, 0, 0, 0,0x6021, 0, +0x5F6E,0x5F7E, 0, 0,0x6022, 0, 0, 0, + 0, 0, 0,0x477A, 0, 0, 0, 0, + 0, 0,0x6023, 0, 0,0x6024, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6025, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6026, 0,0x445E, + 0,0x6028,0x6027, 0, 0,0x6029, 0,0x602A, + 0, 0,0x3C5F,0x4963, 0, 0, 0,0x4C6C, +0x602B,0x602C,0x4156,0x3C24,0x602D,0x602E, 0, 0, + 0, 0, 0,0x602F,0x4A52,0x4847, 0, 0, +0x6030,0x4757, 0, 0, 0, 0, 0,0x442D, + 0, 0, 0, 0, 0,0x6031,0x3267, 0, +0x356D, 0,0x4C46, 0,0x4C36, 0,0x3234,0x4F34, + 0, 0, 0, 0,0x4B52, 0,0x4A2A, 0, + 0, 0, 0, 0, 0, 0, 0,0x4037, + 0,0x6032, 0, 0, 0, 0,0x4643, 0, + 0, 0,0x3823,0x6033, 0,0x3A54,0x6035,0x6034, + 0, 0, 0, 0,0x6036, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6037, + 0, 0, 0,0x6038, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x353E, 0,0x6039, + 0, 0, 0, 0,0x603A, 0, 0, 0, + 0,0x3824, 0, 0,0x4848, 0, 0,0x603C, + 0, 0, 0,0x3E75, 0, 0,0x603B, 0, + 0, 0, 0, 0, 0, 0, 0,0x3638, +0x603D,0x603F, 0,0x603E, 0, 0, 0, 0, + 0, 0, 0,0x6040, 0,0x3851, 0,0x6041, + 0, 0, 0, 0,0x3669, 0,0x4140, 0, +0x397D, 0, 0, 0, 0,0x6043,0x6044,0x6042, + 0, 0, 0, 0, 0, 0,0x3C6D, 0, + 0,0x4648,0x3639, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6046,0x432C,0x6045, 0, + 0,0x4F35,0x4762, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6049, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x604B,0x6048, 0, 0, 0, +0x4C54,0x604A,0x604C, 0,0x4E44, 0, 0, 0, + 0, 0,0x6050, 0, 0, 0,0x604F,0x4376, +0x472D, 0, 0,0x3825,0x604E, 0, 0, 0, + 0,0x604D, 0,0x4D31,0x4D32, 0, 0, 0, + 0, 0, 0,0x6051,0x316E, 0, 0, 0, + 0,0x3976,0x3B62, 0, 0, 0, 0, 0, + 0, 0, 0,0x6052,0x6053, 0, 0, 0, + 0, 0, 0, 0,0x6055, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3D43, 0, 0, 0, 0,0x6057, 0,0x6056, + 0, 0, 0, 0, 0,0x6058, 0,0x334D, + 0, 0,0x605A, 0, 0,0x6059, 0,0x605C, +0x605B, 0, 0, 0, 0, 0, 0, 0, + 0,0x383C, 0, 0,0x4E28, 0,0x364C, 0, +0x3226, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x366A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3461, 0, + 0, 0, 0, 0, 0, 0, 0,0x4E68, +0x605E, 0, 0, 0, 0, 0, 0, 0, +0x6060, 0, 0, 0, 0,0x6061, 0,0x3251, + 0, 0, 0, 0, 0,0x605D, 0,0x3B39, + 0, 0,0x4441,0x605F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6064, 0,0x3C6E, 0, 0, + 0, 0,0x6062, 0, 0, 0, 0,0x373E, + 0, 0,0x4849,0x6063, 0, 0,0x607E, 0, + 0, 0, 0, 0, 0,0x6069, 0, 0, + 0, 0, 0,0x383D, 0, 0, 0, 0, +0x3565, 0,0x6066,0x4D7D, 0, 0,0x4E30}; + +/* page 32 0x7422-0x7845 */ +static uint16 tab_uni_jisx020832[]={ +0x4276, 0, 0,0x6068, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x606A,0x4E56,0x3657,0x487C,0x474A, 0, 0, 0, +0x606B, 0, 0, 0, 0,0x606D, 0,0x6070, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x606C, 0, 0, 0,0x606F, +0x386A,0x314D,0x6071, 0,0x3F70,0x606E,0x4E5C, 0, + 0,0x6074,0x7424, 0, 0, 0, 0,0x6072, +0x6075, 0, 0, 0, 0,0x6067,0x6073, 0, + 0,0x3A3C, 0, 0,0x6076, 0, 0, 0, + 0, 0, 0, 0,0x6077, 0, 0, 0, + 0,0x4D7E, 0, 0, 0, 0, 0, 0, + 0,0x6078, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6079, 0, 0, 0, +0x6065, 0, 0, 0, 0,0x607A, 0, 0, + 0, 0, 0, 0, 0, 0,0x3444, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3C25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x607B, 0, 0, 0, 0,0x607C, 0, 0, + 0, 0,0x607D, 0, 0, 0, 0, 0, + 0, 0,0x313B, 0, 0, 0,0x6121, 0, +0x493B,0x6122, 0, 0,0x3424,0x6123, 0,0x6124, + 0, 0, 0, 0,0x6125, 0,0x6127,0x6128, +0x6126, 0, 0, 0,0x4953,0x612A,0x6129, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x612C,0x612B,0x612D, 0, 0, 0, 0, + 0, 0,0x612E,0x6130,0x612F, 0, 0,0x3979, + 0,0x6132, 0,0x6131, 0, 0,0x3445, 0, +0x3F53, 0,0x453C, 0,0x6133,0x4038, 0, 0, + 0,0x3B3A, 0,0x3179,0x6134, 0,0x4D51, 0, + 0,0x4A63,0x6135, 0, 0, 0,0x4544,0x4D33, +0x3943,0x3F3D, 0, 0, 0,0x434B,0x5234, 0, +0x442E,0x3268,0x6136, 0, 0, 0, 0, 0, + 0, 0,0x6137, 0,0x613C, 0, 0,0x613A, +0x6139,0x5A42,0x3326,0x6138, 0,0x305A, 0,0x482A, + 0, 0,0x484A, 0, 0, 0, 0,0x4E31, +0x613D,0x613B,0x435C,0x4026, 0, 0,0x482B, 0, +0x492D, 0,0x613F,0x4E2C,0x374D,0x6140, 0,0x613E, +0x4856,0x6141, 0,0x6142, 0, 0,0x305B, 0, + 0,0x3E76,0x6147, 0,0x6144,0x466D,0x6143, 0, + 0, 0, 0, 0, 0,0x3526, 0, 0, +0x614A, 0, 0, 0,0x6145,0x6146, 0,0x6149, +0x6148,0x4925, 0, 0,0x4142,0x4141, 0,0x353F, + 0, 0,0x614B, 0, 0, 0, 0, 0, +0x614C, 0, 0,0x614D, 0, 0, 0, 0, + 0,0x614F, 0,0x614E, 0, 0, 0, 0, + 0,0x3156, 0, 0, 0, 0, 0,0x6157, +0x4868,0x6151, 0,0x6153, 0, 0,0x6155,0x3F3E, + 0, 0,0x6156,0x6154,0x3C40, 0, 0, 0, +0x6150,0x6152, 0,0x4942, 0,0x3E49, 0, 0, +0x6159, 0, 0,0x6158, 0, 0, 0, 0, +0x615A, 0,0x3C26,0x3A2F, 0, 0,0x4577,0x615B, + 0,0x444B, 0, 0,0x615D, 0, 0, 0, +0x4E21,0x615C, 0, 0, 0, 0, 0,0x4169, + 0, 0, 0, 0, 0, 0,0x6162, 0, +0x6164,0x6165,0x4354, 0, 0, 0, 0, 0, +0x6163, 0,0x6160, 0,0x615E,0x615F, 0,0x6161, + 0, 0, 0, 0, 0, 0, 0,0x6168, + 0,0x6166, 0,0x6167, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6169,0x616B,0x616C, +0x616D, 0,0x616E, 0, 0,0x616A, 0, 0, + 0, 0, 0, 0, 0, 0,0x6170, 0, + 0, 0,0x616F, 0, 0, 0, 0, 0, + 0,0x6171, 0, 0, 0, 0, 0, 0, +0x4E45, 0, 0, 0,0x6174,0x6172,0x6173, 0, + 0, 0,0x3462, 0, 0, 0, 0, 0, +0x4C7E, 0, 0, 0,0x4A4A, 0,0x6176, 0, + 0, 0,0x6175, 0, 0, 0, 0,0x6177, +0x6178, 0, 0, 0, 0,0x617C,0x6179,0x617A, +0x617B, 0,0x617D, 0, 0, 0,0x617E, 0, +0x6221, 0, 0, 0,0x6222, 0,0x6223, 0, +0x482F,0x4550,0x6224,0x4772,0x4934, 0,0x6225, 0, + 0,0x6226,0x452A, 0,0x3327,0x3944,0x6227, 0, + 0,0x6228, 0, 0,0x6229, 0,0x3B29, 0, + 0,0x622B, 0, 0,0x622A, 0, 0,0x622C, +0x622D, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4869, 0,0x622E, 0, + 0, 0,0x622F, 0, 0,0x7369,0x6230,0x6231, +0x6232, 0, 0, 0, 0,0x3B2E, 0, 0, +0x6233,0x4756, 0, 0,0x4B5F, 0,0x314E, 0, +0x3157, 0, 0,0x6234, 0, 0, 0, 0, +0x6236, 0, 0, 0,0x6235,0x4570, 0, 0, + 0,0x4039,0x5D39, 0,0x6237,0x4C41, 0,0x6238, + 0,0x3446,0x4857,0x6239, 0,0x623A, 0, 0, +0x623B, 0, 0, 0,0x4C5C, 0, 0, 0, +0x4C55, 0,0x443E, 0, 0, 0,0x416A, 0, + 0,0x623D, 0, 0,0x3D62, 0, 0,0x3E4A, + 0, 0,0x6240, 0, 0,0x623F,0x623E,0x487D, + 0,0x3447,0x3829, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6246, 0, 0,0x6243,0x3F3F,0x4C32, 0, + 0, 0,0x6242,0x6244,0x6245, 0, 0,0x6241, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6247,0x6248, 0, +0x442F, 0,0x3463, 0, 0, 0,0x4365, 0, + 0, 0, 0, 0, 0,0x6249, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x624A,0x624D, 0, 0, 0, 0, 0,0x3F67, + 0,0x4644, 0,0x624E,0x4B53, 0,0x624B, 0, + 0,0x624C, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6251, + 0, 0, 0, 0,0x6250,0x624F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6253, 0, 0,0x6252, 0, 0,0x6254, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6256, 0,0x6255, 0, + 0, 0, 0,0x4A4D, 0, 0, 0, 0, + 0, 0,0x3D56,0x4E46, 0, 0,0x6257, 0, + 0,0x4637, 0, 0,0x6258, 0, 0,0x6259, + 0,0x625D,0x625B,0x625C, 0,0x625A, 0, 0, + 0, 0, 0, 0, 0,0x625E, 0, 0, + 0, 0, 0,0x625F, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6260, 0, 0, +0x6261,0x4C37,0x6262, 0, 0, 0, 0, 0, +0x4C70,0x6263, 0,0x434E, 0,0x476A, 0,0x366B, + 0, 0, 0,0x433B,0x6264,0x363A, 0, 0, + 0,0x4050, 0, 0, 0, 0, 0, 0, + 0, 0,0x6265, 0, 0, 0, 0, 0, +0x3A3D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6266, 0, 0, 0, 0, 0, +0x6267, 0,0x3826,0x3A55, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6269, 0, + 0, 0, 0,0x4556,0x3A56,0x354E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4B24, 0,0x474B, 0, 0, 0, 0, 0, +0x4557, 0, 0, 0, 0,0x395C, 0, 0, + 0, 0, 0,0x626B}; + +/* page 33 0x785D-0x7E9C */ +static uint16 tab_uni_jisx020833[]={ +0x3E4B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4E32,0x3945, + 0, 0,0x3827, 0, 0,0x4823, 0,0x626D, + 0, 0, 0, 0, 0, 0, 0,0x626F, + 0, 0, 0, 0,0x386B, 0, 0, 0, + 0,0x626E,0x4476, 0, 0, 0, 0,0x6271, +0x3337,0x626C, 0, 0,0x486A, 0,0x3130, 0, +0x3A6C, 0,0x4F52, 0, 0,0x6270, 0, 0, + 0, 0, 0, 0, 0, 0,0x6272, 0, + 0, 0,0x4A4B, 0,0x4059,0x6274, 0, 0, + 0, 0,0x6275, 0, 0, 0, 0, 0, +0x6273, 0, 0, 0, 0,0x334E, 0,0x627B, + 0,0x627A, 0, 0,0x3C27, 0, 0, 0, +0x627C,0x6277, 0, 0, 0,0x627D,0x6278, 0, + 0, 0, 0,0x4858,0x6276, 0, 0,0x6279, + 0, 0, 0, 0, 0,0x6322, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6321,0x4B61, 0, 0, 0,0x627E, + 0, 0,0x306B, 0, 0, 0, 0,0x6324, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6323, 0, 0, 0,0x3E4C, 0, 0, 0, + 0, 0,0x6325, 0, 0, 0, 0, 0, + 0,0x4143, 0, 0,0x6327,0x6326, 0, 0, + 0, 0, 0, 0,0x6328, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6268, 0, 0, 0,0x626A,0x632A,0x6329, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3C28, 0,0x4E69, + 0,0x3C52, 0,0x632B,0x3737, 0, 0, 0, + 0, 0,0x3540,0x3527,0x3B63, 0, 0, 0, + 0, 0, 0,0x4D34, 0, 0,0x6331, 0, +0x6330,0x4144,0x632D, 0, 0,0x632F, 0, 0, +0x3D4B,0x3F40,0x632E,0x632C, 0,0x472A, 0, 0, +0x3E4D, 0, 0,0x493C, 0, 0, 0, 0, +0x3A57, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4578, 0, 0,0x6332, 0, 0, + 0, 0,0x6333,0x6349,0x3658, 0, 0,0x4F3D, +0x4135, 0, 0, 0, 0,0x6334, 0, 0, +0x3252,0x4477,0x4A21, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6335, 0, 0, 0, 0, 0, 0, 0, + 0,0x357A,0x6336, 0, 0,0x6338, 0, 0, + 0,0x6339, 0,0x4729, 0, 0,0x633A, 0, + 0, 0, 0, 0,0x633B,0x633C, 0, 0, +0x3659,0x3253,0x4645,0x3D28,0x3B64, 0, 0, 0, + 0, 0, 0, 0,0x633D, 0,0x3D29, 0, + 0, 0, 0, 0,0x324A,0x4943, 0, 0, +0x633E, 0, 0,0x486B, 0, 0, 0, 0, + 0, 0,0x4145, 0,0x6341, 0,0x6342,0x4769, + 0,0x3F41,0x633F, 0,0x4361, 0, 0,0x6340, + 0, 0, 0,0x3E4E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x305C, 0, + 0, 0, 0,0x3529, 0, 0, 0, 0, + 0, 0, 0,0x6343, 0, 0,0x4478, 0, +0x6344,0x4047, 0, 0, 0, 0, 0,0x4C2D, + 0, 0,0x4923,0x6345,0x6346,0x4355, 0,0x4E47, + 0, 0,0x6348,0x6347, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3C6F, 0, 0,0x634A,0x3070, 0, 0, + 0, 0,0x634D, 0, 0, 0,0x634B,0x3254, +0x374E,0x634C,0x3946,0x3972, 0,0x4A66,0x634E, 0, + 0,0x4B54, 0, 0,0x6350, 0, 0, 0, +0x4051,0x314F,0x323A,0x302C, 0, 0, 0, 0, + 0, 0,0x634F, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6351,0x6352,0x3E77, 0, + 0, 0, 0, 0,0x6353, 0,0x334F, 0, + 0, 0, 0,0x6355, 0, 0, 0,0x376A, + 0,0x3566, 0, 0,0x6356,0x3675, 0, 0, +0x6357, 0,0x407C, 0,0x464D, 0,0x4060,0x3A75, + 0, 0, 0,0x6358, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4362,0x416B, 0, +0x635A,0x635C,0x6359,0x635B, 0, 0, 0, 0, + 0, 0,0x3722, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x635D,0x3726, 0, 0, + 0,0x3567,0x4D52,0x635F, 0, 0, 0, 0, + 0,0x6360, 0, 0, 0,0x312E, 0, 0, + 0, 0,0x6363, 0, 0, 0,0x3376,0x6362, +0x6361, 0,0x6365,0x635E, 0,0x6366,0x4E29, 0, +0x6367, 0,0x6368, 0, 0,0x5474,0x636A, 0, +0x6369, 0, 0, 0,0x636B,0x636C, 0,0x4E35, +0x636D, 0,0x706F,0x3E4F,0x636E,0x636F,0x3D57, 0, +0x4638,0x6370, 0, 0, 0,0x4328, 0, 0, +0x6371, 0,0x433C,0x6372, 0, 0, 0, 0, + 0,0x3625, 0,0x513F,0x435D,0x3C33, 0, 0, + 0, 0,0x3448, 0, 0,0x6373, 0,0x6422, + 0,0x6376, 0,0x3568, 0,0x6375,0x6424, 0, + 0, 0,0x6374, 0,0x3E50, 0, 0, 0, + 0, 0, 0,0x6378,0x6379, 0,0x452B, 0, + 0,0x637A, 0,0x335E, 0, 0, 0, 0, +0x3F5A,0x4964, 0,0x637C, 0, 0, 0,0x4268, + 0, 0, 0, 0, 0, 0,0x6377, 0, +0x637B,0x637D, 0, 0,0x3A7B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6426,0x492E, 0,0x4826,0x4579, 0,0x365A,0x6425, +0x6423, 0,0x4835,0x637E,0x435E,0x457B, 0,0x457A, + 0,0x3A76, 0, 0, 0, 0, 0, 0, +0x6438, 0, 0, 0, 0, 0, 0, 0, +0x6428, 0,0x642A, 0, 0, 0, 0,0x642D, + 0,0x642E, 0,0x642B,0x642C, 0, 0,0x6429, +0x6427, 0, 0, 0, 0,0x6421, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4A4F,0x3255, 0, 0, 0,0x6435, 0, +0x6432, 0,0x6437, 0, 0,0x6436, 0,0x4773, +0x4C27, 0,0x3B3B,0x6430,0x6439,0x6434, 0,0x6433, +0x642F, 0,0x6431, 0,0x3449, 0, 0, 0, + 0, 0, 0, 0, 0,0x433D, 0, 0, +0x407D, 0, 0, 0,0x4822, 0, 0,0x643E, + 0, 0, 0,0x4824, 0, 0, 0, 0, + 0, 0, 0,0x4061,0x643B, 0, 0,0x484F, + 0,0x643F,0x4A53, 0,0x435B, 0,0x643A,0x643C, + 0, 0,0x643D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6440, 0, 0,0x3C44, 0, 0, 0,0x4646, +0x6445,0x6444, 0, 0,0x6441, 0, 0, 0, +0x4F36, 0, 0, 0, 0, 0,0x644A, 0, + 0,0x644E,0x644B, 0, 0, 0, 0, 0, + 0, 0, 0,0x6447, 0, 0, 0, 0, + 0, 0,0x6448, 0, 0, 0, 0, 0, +0x644D, 0, 0, 0,0x6442,0x5255,0x6449,0x6443, + 0, 0,0x644C, 0, 0, 0, 0, 0, + 0, 0,0x6452, 0,0x344A, 0,0x644F, 0, + 0, 0,0x6450, 0, 0,0x6451,0x6454, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6453,0x4876, 0, 0, 0, 0, +0x6455,0x4E7C,0x4A6D,0x645A, 0, 0,0x6457, 0, + 0, 0, 0, 0, 0, 0, 0,0x6456, +0x4052, 0,0x6459,0x645B, 0, 0, 0,0x6458, + 0,0x645F, 0,0x645C, 0, 0, 0, 0, + 0, 0,0x645D,0x6446, 0, 0, 0,0x645E, +0x6460, 0, 0, 0, 0, 0, 0,0x6461, + 0, 0, 0, 0, 0, 0,0x4A46, 0, +0x6462, 0, 0, 0, 0, 0, 0, 0, + 0,0x4C62, 0, 0,0x364E,0x3729,0x6463, 0, + 0, 0, 0, 0,0x4A34, 0,0x3F68, 0, +0x4C30, 0, 0,0x6464, 0,0x4E33, 0, 0, +0x4774, 0,0x4146,0x4734, 0, 0,0x3D4D, 0, + 0, 0,0x3040, 0,0x6469,0x6467, 0,0x6465, +0x3421, 0,0x3E51,0x646A, 0, 0,0x6468, 0, +0x6466,0x646E, 0, 0,0x646D,0x646C,0x646B, 0, + 0, 0, 0, 0,0x646F, 0, 0, 0, +0x6470,0x403A, 0,0x6471, 0,0x6473, 0, 0, +0x6472, 0, 0, 0, 0,0x3852, 0, 0, + 0,0x4138, 0, 0, 0,0x6475, 0, 0, + 0,0x457C, 0,0x6474, 0, 0, 0,0x6476, + 0,0x4A35,0x416C,0x3947, 0,0x6477, 0, 0, + 0, 0,0x4E48, 0, 0, 0, 0, 0, + 0, 0,0x6479, 0, 0,0x647A, 0,0x647B, + 0,0x647C, 0,0x3B65, 0,0x647D,0x374F, 0, + 0,0x356A, 0,0x352A, 0,0x6521, 0,0x4C73, +0x3948,0x647E, 0, 0, 0,0x6524,0x4C66, 0, +0x473C, 0, 0,0x4933, 0, 0, 0,0x3D63, +0x6523, 0,0x3C53,0x3949,0x3B66,0x3569,0x4A36,0x6522, + 0, 0, 0,0x4147,0x4B42,0x3A77, 0, 0, + 0, 0, 0, 0, 0, 0,0x3B67,0x445D, + 0,0x6527,0x4E5F,0x3A59, 0,0x6528,0x3F42, 0, +0x652A, 0, 0, 0,0x3E52,0x3A30, 0, 0, + 0, 0,0x6529, 0, 0,0x3D2A,0x383E,0x4148, +0x6525,0x652B, 0, 0, 0, 0,0x6526,0x3750, + 0,0x652E,0x6532,0x376B, 0, 0, 0, 0, + 0,0x652D, 0, 0, 0, 0,0x6536, 0, + 0,0x394A, 0, 0,0x4D6D,0x303C,0x6533, 0, + 0,0x356B, 0,0x6530, 0, 0, 0, 0, + 0,0x6531, 0, 0,0x457D,0x652F,0x652C, 0, +0x3328,0x4064, 0, 0,0x3828, 0, 0, 0, +0x6538, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6535, 0, 0, 0, + 0, 0,0x6537, 0, 0, 0,0x6534, 0, + 0, 0, 0, 0,0x3751,0x4233,0x6539,0x416E, + 0, 0,0x6546, 0, 0,0x6542,0x653C, 0, + 0, 0, 0, 0, 0, 0,0x6540,0x3C7A, +0x305D,0x653B,0x6543,0x6547,0x394B,0x4C56, 0,0x4456, +0x653D, 0, 0,0x6545, 0,0x653A,0x433E, 0, +0x653F,0x303D,0x4C4A, 0, 0, 0, 0, 0, + 0, 0,0x653E, 0, 0,0x365B,0x486C, 0, + 0, 0,0x416D, 0,0x4E50,0x3D6F, 0, 0, +0x656E, 0, 0,0x6548, 0,0x407E, 0,0x6544, +0x6549,0x654B, 0,0x4479,0x654E, 0, 0,0x654A, + 0, 0, 0,0x4A54,0x344B, 0, 0,0x4C4B, + 0, 0,0x305E, 0, 0,0x654D, 0,0x4E7D, + 0, 0, 0, 0, 0, 0,0x654C, 0, + 0, 0, 0, 0,0x316F, 0, 0,0x466C, +0x654F, 0, 0, 0,0x6556,0x6550,0x6557, 0, + 0, 0, 0, 0, 0,0x6553, 0, 0, + 0, 0, 0, 0, 0, 0,0x477B, 0, + 0,0x3C4A,0x6555, 0,0x6552,0x6558,0x6551, 0, + 0,0x3D44, 0, 0, 0, 0,0x4B25, 0, + 0,0x3D4C, 0, 0,0x6554,0x6560, 0, 0, +0x655C, 0,0x655F, 0,0x655D,0x6561,0x655B, 0, +0x6541,0x4053, 0, 0,0x484B, 0,0x655E, 0, + 0,0x6559, 0, 0, 0,0x4121,0x3752, 0, +0x3D2B, 0, 0, 0, 0, 0, 0,0x3F25, +0x4136,0x6564, 0, 0,0x6566,0x6567, 0, 0, +0x6563,0x6565, 0, 0, 0, 0, 0, 0, + 0,0x655A,0x6562, 0,0x656A,0x6569, 0, 0, +0x4B7A, 0, 0,0x372B, 0, 0, 0, 0, + 0, 0, 0, 0,0x6568, 0,0x656C,0x656B, +0x656F, 0,0x6571, 0, 0,0x3B3C,0x656D, 0, + 0, 0, 0,0x6572,0x6573, 0, 0,0x6574, + 0,0x657A,0x453B,0x6576, 0,0x6575,0x6577,0x6578, + 0,0x6579, 0, 0, 0, 0,0x657B,0x657C +}; + +/* page 34 0x7F36-0x8358 */ +static uint16 tab_uni_jisx020834[]={ +0x344C, 0,0x657D, 0,0x657E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6621, + 0, 0, 0, 0, 0, 0,0x6622,0x6623, +0x6624, 0,0x6625,0x6626, 0, 0,0x6628,0x6627, + 0, 0,0x6629, 0, 0, 0, 0, 0, + 0,0x662A,0x662B, 0, 0, 0, 0, 0, + 0,0x662E,0x662C,0x662D,0x3A61,0x3753, 0, 0, +0x4356, 0,0x4833, 0,0x3D70, 0, 0,0x474D, + 0,0x486D,0x662F,0x586D, 0, 0, 0, 0, + 0, 0, 0, 0,0x6630,0x6632, 0,0x4D65, +0x6631,0x6634,0x6633, 0,0x4D53, 0,0x6635, 0, +0x487E, 0, 0, 0, 0, 0,0x6636, 0, + 0, 0, 0, 0,0x6639, 0, 0,0x6638, +0x6637, 0, 0, 0, 0,0x663A,0x3732, 0, + 0, 0,0x4122,0x3541, 0, 0, 0, 0, +0x663E,0x663B, 0, 0,0x663C, 0, 0, 0, +0x663F, 0,0x6640,0x663D, 0, 0, 0,0x3129, + 0, 0, 0,0x3227, 0, 0, 0,0x6642, +0x6643, 0, 0, 0,0x6644, 0,0x4D62, 0, + 0, 0, 0, 0,0x3D2C, 0,0x6646,0x6645, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3F69,0x6647, 0, 0, 0, 0, +0x6648, 0, 0,0x6649, 0,0x3465, 0, 0, + 0, 0,0x344D, 0, 0,0x664A, 0, 0, + 0, 0, 0,0x664B, 0,0x4B5D,0x4D63, 0, + 0, 0,0x4D54,0x4F37, 0,0x394D,0x664E,0x3C54, +0x664D, 0, 0, 0, 0,0x664F,0x3C29, 0, + 0, 0,0x4251, 0,0x6650, 0, 0,0x394C, + 0,0x4C57,0x6651,0x6652, 0, 0,0x6653, 0, + 0, 0, 0,0x6654, 0, 0, 0, 0, + 0, 0,0x6655, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3C2A, 0, 0, +0x4C6D, 0, 0, 0, 0,0x6657, 0,0x433F, + 0,0x6656, 0, 0, 0, 0, 0, 0, +0x6659, 0, 0, 0,0x6658, 0, 0, 0, + 0, 0, 0, 0,0x665A, 0, 0, 0, +0x403B, 0,0x665B, 0,0x665C, 0, 0, 0, +0x4A39,0x665D, 0,0x416F,0x665E, 0, 0, 0, + 0, 0,0x665F, 0, 0, 0, 0, 0, + 0,0x4E7E,0x6662, 0,0x6661,0x6660,0x4430, 0, +0x6663,0x3F26, 0,0x6664, 0, 0, 0,0x6665, +0x4F38,0x6666, 0, 0, 0, 0,0x6667,0x6669, +0x6668,0x4825, 0,0x4679, 0,0x4F3E,0x4829, 0, + 0, 0, 0, 0, 0,0x666B, 0, 0, +0x3E53, 0,0x492A, 0,0x666C,0x666A, 0,0x344E, + 0, 0, 0,0x3854,0x3B68, 0, 0,0x486E, + 0, 0, 0,0x382A,0x4B43, 0,0x666F,0x666D, + 0,0x394E, 0,0x394F,0x3069, 0,0x3A68, 0, + 0, 0, 0, 0,0x4759, 0, 0, 0, + 0, 0, 0, 0, 0,0x305F,0x6674, 0, +0x4340, 0, 0, 0, 0, 0,0x4758, 0, +0x425B, 0, 0, 0, 0, 0, 0, 0, +0x6676, 0, 0,0x6672,0x6675,0x6670, 0,0x6673, +0x4B26, 0, 0,0x3855, 0, 0,0x307D,0x6671, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6678, 0,0x6679, 0, 0,0x4639, 0, + 0, 0,0x363B, 0, 0, 0,0x6726,0x473D, + 0, 0, 0, 0,0x3B69, 0, 0,0x363C, +0x4048,0x4F46,0x4C2E,0x6677,0x4054, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3553,0x667A, 0, 0, + 0, 0, 0, 0, 0,0x667C, 0, 0, + 0, 0, 0,0x667B, 0, 0, 0, 0, + 0,0x667D, 0,0x4326, 0,0x473E, 0, 0, + 0, 0, 0,0x4431, 0, 0, 0, 0, +0x6723, 0, 0, 0, 0, 0, 0, 0, +0x6722, 0, 0, 0, 0,0x667E, 0, 0, +0x3F55, 0,0x4965,0x6725, 0,0x6724,0x3950,0x4F53, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6735, 0, 0, 0, 0, 0,0x6729, +0x672A, 0, 0, 0, 0,0x3C70, 0, 0, +0x6728, 0,0x3978,0x6727, 0, 0,0x672B, 0, + 0, 0,0x4432,0x4A22,0x4123, 0, 0, 0, + 0,0x425C,0x672F, 0,0x6730,0x672C, 0, 0, + 0, 0,0x672D, 0,0x672E, 0, 0, 0, + 0,0x3951, 0, 0, 0,0x6736, 0,0x6732, + 0, 0, 0, 0,0x4966, 0,0x4B6C,0x4928, + 0, 0,0x6731, 0, 0,0x6734,0x6733, 0, + 0, 0,0x4B44,0x6737, 0, 0, 0, 0, + 0, 0,0x6738, 0, 0,0x4137, 0,0x6739, + 0, 0,0x673B, 0,0x673F, 0, 0,0x673C, +0x673A,0x473F,0x673D, 0,0x673E, 0, 0, 0, +0x3232, 0,0x6745,0x6740, 0, 0, 0,0x6741, + 0, 0, 0,0x6742, 0,0x4221, 0, 0, + 0, 0,0x6744,0x6743,0x6746, 0, 0, 0, + 0,0x6747,0x6748, 0, 0,0x3F43, 0,0x3269, + 0,0x6749,0x4E57, 0,0x3C2B, 0, 0,0x3D2D, + 0, 0, 0, 0, 0,0x3B6A,0x4357, 0, + 0, 0, 0, 0,0x674A,0x674B,0x3131, 0, +0x674C, 0, 0,0x674D,0x674E, 0, 0,0x674F, + 0,0x6750,0x363D,0x5A2A,0x6751, 0,0x4065,0x6752, +0x3C4B, 0,0x6753, 0,0x5030, 0, 0, 0, +0x6754,0x4A5E,0x345C, 0, 0,0x4124,0x3D58, 0, +0x4971,0x3D2E, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6755,0x3952,0x6756,0x484C, 0, +0x6764, 0, 0, 0, 0,0x6758, 0,0x4249, +0x4775,0x383F,0x6757,0x4125, 0, 0, 0, 0, + 0, 0,0x6759, 0, 0, 0, 0, 0, + 0,0x447A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x675B,0x675A,0x675D, 0, 0,0x675C, + 0,0x675E, 0, 0,0x6760, 0,0x675F, 0, +0x344F, 0,0x6761, 0,0x6762,0x6763, 0, 0, +0x3A31,0x4E49, 0,0x6765,0x3F27, 0, 0, 0, +0x3170,0x6766,0x6767, 0, 0, 0, 0, 0, +0x6768, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3072, 0,0x6769, + 0, 0, 0, 0,0x676A, 0, 0, 0, + 0, 0, 0,0x4967, 0, 0, 0,0x3C47, + 0,0x676C, 0, 0, 0, 0, 0,0x3329, +0x3032, 0, 0, 0, 0,0x676B,0x676E,0x474E, + 0,0x3F44, 0,0x3256, 0,0x4B27, 0, 0, + 0, 0,0x375D,0x365C, 0,0x676D, 0,0x326A, + 0, 0, 0, 0, 0, 0, 0,0x3423, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3171,0x6772,0x4E6A,0x425D, 0, + 0,0x4944, 0,0x677E, 0,0x3257,0x677C, 0, +0x677A,0x6771, 0,0x676F, 0,0x6770, 0,0x3C63, +0x366C,0x4377, 0, 0, 0,0x4651, 0, 0, + 0, 0, 0,0x3151, 0,0x6774,0x6773, 0, + 0, 0, 0,0x6779,0x6775,0x6778, 0, 0, + 0, 0, 0, 0,0x4C50,0x6777,0x3258,0x337D, +0x677B, 0, 0,0x677D, 0, 0, 0, 0, +0x3754, 0, 0, 0, 0, 0, 0, 0, +0x6823,0x682C,0x682D, 0, 0, 0,0x302B, 0, + 0, 0, 0, 0, 0,0x6834, 0, 0, + 0, 0,0x3071, 0, 0,0x682B, 0, 0, + 0,0x682A, 0,0x6825,0x6824, 0,0x6822,0x6821, +0x4363, 0,0x427B,0x6827, 0, 0, 0, 0, + 0, 0,0x6826, 0, 0, 0, 0,0x6829, + 0, 0, 0,0x4170,0x3755, 0, 0, 0, + 0,0x3141,0x6828, 0,0x3953, 0, 0, 0, + 0, 0,0x4171}; + +/* page 35 0x8373-0x8B9A */ +static uint16 tab_uni_jisx020835[]={ +0x683A, 0,0x683B, 0,0x3259, 0, 0, 0, +0x322E,0x6838, 0, 0, 0, 0, 0, 0, + 0, 0,0x682E, 0,0x6836, 0,0x683D,0x6837, + 0, 0, 0,0x6835, 0, 0, 0, 0, +0x6776, 0, 0,0x6833, 0, 0, 0,0x682F, + 0, 0, 0,0x3450,0x6831,0x683C, 0,0x6832, + 0, 0, 0, 0, 0,0x683E, 0,0x6830, +0x477C, 0, 0, 0, 0, 0,0x4D69, 0, + 0, 0,0x6839, 0, 0, 0, 0, 0, + 0, 0,0x684F, 0, 0, 0,0x6847, 0, + 0, 0,0x3F7B, 0, 0, 0, 0,0x3546, + 0,0x365D, 0,0x6842, 0, 0, 0, 0, +0x325B, 0, 0,0x3E54, 0,0x6845, 0, 0, + 0,0x3A5A, 0, 0,0x4551,0x684A, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A6E, 0, +0x6841, 0, 0, 0,0x325A,0x3856,0x4929,0x684B, + 0,0x683F, 0, 0,0x6848, 0, 0, 0, +0x6852, 0,0x6843, 0, 0, 0, 0, 0, +0x6844,0x463A, 0, 0,0x6849, 0, 0, 0, +0x6846,0x4B28,0x684C,0x3060, 0, 0, 0, 0, +0x6840, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x684E, 0,0x684D, + 0, 0, 0, 0, 0, 0,0x476B,0x6854, + 0,0x685F, 0, 0, 0, 0,0x337E, 0, + 0, 0,0x6862, 0, 0,0x6850, 0, 0, + 0,0x6855,0x4D6E, 0, 0, 0, 0, 0, + 0, 0, 0,0x685E, 0, 0,0x4D55, 0, + 0, 0, 0,0x4E2A, 0, 0, 0, 0, + 0, 0, 0, 0,0x4378, 0, 0, 0, +0x336B, 0, 0, 0, 0, 0,0x4972,0x6864, +0x4621, 0, 0,0x3031, 0, 0,0x685D, 0, +0x6859,0x4172,0x6853,0x685B,0x6860, 0,0x472C, 0, + 0, 0,0x302A, 0,0x6858, 0,0x6861,0x4978, + 0, 0, 0, 0, 0, 0, 0,0x685C, + 0,0x6857, 0, 0, 0, 0, 0, 0, +0x3E55, 0, 0, 0, 0,0x3D2F, 0, 0, + 0,0x3C2C, 0, 0, 0, 0,0x4C58, 0, + 0,0x4947, 0, 0,0x6867, 0,0x6870, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x685A, 0, 0, 0, 0,0x3377, + 0, 0, 0, 0, 0,0x3E78,0x6865, 0, +0x686A,0x4173, 0, 0,0x6866, 0,0x686D, 0, + 0,0x435F, 0,0x686E, 0, 0,0x4D56,0x6863, +0x3338, 0,0x6869, 0, 0,0x686C,0x4C2C, 0, + 0, 0, 0,0x686F, 0, 0,0x6868,0x686B, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4B29, 0,0x4F21, 0, 0, 0, 0, + 0,0x6873, 0, 0, 0, 0, 0, 0, + 0,0x687A, 0, 0,0x6872,0x3C43, 0, 0, + 0, 0, 0,0x6851, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A4E, 0, +0x4C22,0x6879,0x6878, 0,0x6874,0x6875, 0,0x3136, + 0, 0, 0, 0,0x6877, 0,0x6871, 0, + 0, 0, 0,0x4455, 0, 0, 0, 0, + 0,0x6876,0x307E, 0, 0, 0, 0, 0, + 0, 0,0x4222, 0, 0, 0, 0, 0, + 0, 0,0x4A43, 0, 0,0x687B,0x6921, 0, +0x4859, 0, 0, 0, 0,0x687E,0x3E56,0x3C49, +0x6923, 0, 0,0x363E, 0, 0, 0, 0, + 0, 0,0x6924, 0,0x4979,0x687D, 0,0x6856, + 0, 0, 0, 0, 0, 0, 0, 0, +0x687C, 0, 0, 0, 0,0x4F4F,0x4622,0x4973, + 0, 0,0x692B, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6931, 0, 0, 0, + 0, 0, 0,0x6932, 0,0x6925, 0, 0, + 0,0x4776, 0, 0,0x692F,0x6927, 0,0x6929, + 0, 0, 0, 0, 0,0x6933,0x6928, 0, + 0,0x692C, 0, 0,0x3172, 0,0x4665, 0, +0x692D,0x6930, 0, 0, 0, 0, 0, 0, + 0,0x6926, 0,0x4126, 0,0x692A,0x3B27,0x3F45, +0x3730,0x4C74, 0,0x4C79,0x3D72, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6937,0x6935, + 0, 0, 0, 0, 0, 0,0x4F4E, 0, + 0, 0, 0, 0, 0, 0,0x6934, 0, + 0, 0,0x4D75, 0,0x6936,0x6938, 0, 0, + 0, 0,0x6939, 0, 0, 0, 0, 0, + 0,0x693C,0x693A, 0, 0, 0, 0, 0, + 0,0x4623,0x693B, 0, 0, 0,0x484D,0x692E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3D73, 0,0x693D,0x6942, +0x4174, 0, 0,0x6941, 0, 0, 0,0x6922, + 0, 0, 0,0x6943,0x4149, 0, 0,0x693E, +0x6940, 0, 0, 0, 0, 0, 0, 0, +0x693F, 0, 0,0x5D31,0x5D22, 0, 0,0x6945, + 0, 0, 0, 0, 0, 0, 0,0x6944, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D76, 0,0x623C,0x6946, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6947, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6948,0x3857, 0,0x3554, 0, 0, + 0,0x694A,0x515D, 0, 0, 0, 0,0x3575, + 0,0x4E3A, 0,0x3673,0x694B, 0, 0, 0, + 0, 0, 0, 0,0x694C, 0, 0, 0, +0x436E, 0, 0, 0, 0, 0,0x694D, 0, + 0, 0, 0, 0, 0, 0,0x467A, 0, +0x303A, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3263, +0x6952,0x6953, 0, 0, 0, 0, 0, 0, +0x694E, 0,0x3B3D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x694F,0x4742, 0, 0, 0, 0,0x6950,0x6951, +0x695B, 0, 0, 0,0x6955,0x6958, 0, 0, + 0, 0, 0,0x6954, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6956, 0,0x6957,0x3C58, 0,0x6959, 0, +0x4341, 0,0x3756,0x3342, 0, 0, 0, 0, + 0,0x695C, 0, 0, 0, 0,0x333F, 0, +0x6961, 0, 0,0x695D,0x6960, 0, 0, 0, + 0,0x483A, 0, 0, 0, 0,0x695E, 0, + 0,0x695F,0x4948,0x485A,0x6962, 0, 0, 0, + 0, 0, 0, 0, 0,0x427D,0x696C, 0, +0x6968, 0, 0,0x326B, 0,0x6966, 0,0x4B2A, +0x6967, 0, 0,0x6964, 0,0x6965,0x696A,0x696D, + 0, 0,0x696B, 0, 0, 0,0x6969,0x6963, + 0, 0, 0, 0, 0,0x4358, 0,0x6974, + 0,0x4C2A, 0, 0, 0, 0, 0, 0, + 0, 0,0x6972, 0, 0, 0,0x6973, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x696E, 0, 0,0x6970, 0, 0, 0, +0x6971, 0, 0, 0,0x696F, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4066, 0, +0x4F39,0x6978, 0,0x6979, 0, 0, 0, 0, +0x6A21, 0,0x3F2A, 0,0x697B, 0,0x697E, 0, + 0, 0, 0, 0,0x6976,0x6975, 0, 0, +0x6A22, 0, 0,0x325C, 0,0x697C, 0,0x6A23, + 0, 0, 0,0x697D, 0, 0, 0, 0, + 0,0x697A, 0,0x4433, 0,0x6977, 0, 0, + 0, 0, 0, 0,0x4768, 0, 0,0x6A27, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D3B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6A26, 0, 0,0x6A25, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6A2E, 0, 0, 0,0x6A28, 0, 0, 0, +0x6A30, 0, 0, 0, 0, 0, 0,0x4D66, +0x6A33, 0,0x6A2A, 0, 0,0x6A2B, 0, 0, + 0,0x6A2F, 0,0x6A32,0x6A31, 0, 0, 0, +0x6A29, 0, 0, 0, 0,0x6A2C, 0,0x6A3D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6A36, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6A34, 0, 0,0x6A35, + 0, 0, 0,0x6A3A,0x6A3B, 0,0x332A, 0, +0x3542, 0, 0,0x6A39, 0, 0, 0, 0, + 0, 0,0x6A24, 0, 0, 0, 0, 0, + 0, 0,0x6A38,0x6A3C,0x6A37, 0,0x6A3E, 0, + 0, 0,0x6A40,0x6A3F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A42,0x6A41, +0x695A, 0, 0, 0,0x6A46, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A43, 0, + 0, 0, 0,0x6A44, 0, 0,0x6A45, 0, +0x6A47, 0, 0, 0, 0,0x376C, 0,0x6A49, + 0,0x6A48, 0,0x3D30, 0, 0, 0, 0, + 0,0x3954,0x5E27, 0, 0, 0, 0,0x6A4A, +0x3D51, 0, 0, 0,0x3339, 0,0x6A4B, 0, +0x3152, 0,0x3E57,0x6A4C, 0, 0,0x3955,0x6A4D, +0x3061, 0, 0, 0, 0,0x493D, 0, 0, +0x6A4E, 0, 0, 0, 0,0x3F6A, 0,0x6A55, + 0, 0,0x6A52, 0,0x436F, 0, 0, 0, + 0, 0,0x6A53,0x6A50,0x365E, 0,0x6A4F,0x6A56, + 0, 0, 0, 0, 0,0x3736, 0, 0, +0x425E, 0,0x6A5C, 0, 0, 0, 0,0x6A58, + 0, 0, 0,0x4235,0x6A57, 0,0x6A5A, 0, + 0, 0, 0,0x6A51, 0, 0, 0,0x6A5B, + 0,0x6A5D, 0, 0, 0, 0, 0, 0, +0x486F, 0, 0,0x6A59, 0,0x6A5E,0x6A60, 0, + 0,0x3853,0x6A54, 0,0x3041, 0, 0, 0, + 0, 0, 0, 0,0x6A5F, 0,0x3A5B,0x4E76, +0x6A61,0x6A62,0x4175, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4E22, 0, 0, 0, + 0,0x6A63,0x4D35, 0, 0,0x6A64,0x6A65, 0, + 0,0x4A64,0x6A66, 0,0x3A40, 0,0x4E23, 0, + 0, 0, 0, 0, 0,0x6A6B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6A6C, +0x3E58,0x6A6A, 0, 0, 0,0x4D67,0x6A67, 0, + 0,0x6A69,0x403D,0x3F7E, 0, 0, 0,0x6A68, + 0,0x6A6D, 0, 0,0x4A23, 0, 0,0x6A6F, + 0,0x6A6E, 0, 0, 0,0x336C, 0,0x4B2B, +0x6A70, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6A7C,0x6A72, 0, 0, 0, 0, + 0, 0,0x6A73, 0, 0, 0, 0,0x6A74, +0x6A75, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6A79, 0,0x6A7A, 0, 0, +0x6A78, 0, 0, 0, 0, 0,0x6A76, 0, +0x6A71,0x6A77, 0, 0, 0, 0, 0, 0, + 0,0x6A7B,0x7037, 0, 0, 0, 0, 0, + 0, 0, 0,0x3228, 0, 0, 0, 0, + 0, 0, 0,0x6A7E,0x365F,0x6A7D, 0, 0, + 0,0x6B22, 0,0x6B21, 0, 0, 0,0x6B24, + 0, 0,0x6B23, 0,0x6B25, 0, 0,0x3D31, + 0,0x6B26, 0, 0,0x6B27, 0, 0, 0, + 0, 0, 0,0x6B28,0x403E, 0,0x4D57, 0, +0x6B29, 0, 0,0x4A24,0x4746,0x6B2A, 0,0x6B2B, +0x382B, 0, 0, 0,0x352C, 0, 0, 0, +0x6B2C, 0, 0,0x3B6B,0x4741,0x6B2D, 0,0x3350, + 0, 0, 0, 0, 0, 0,0x6B2E, 0, + 0, 0, 0,0x6B30,0x4D77, 0,0x6B2F,0x3F46, + 0,0x6B31, 0, 0,0x6B32, 0, 0,0x6B33, +0x3451, 0, 0, 0, 0, 0, 0,0x6B34, + 0, 0,0x6B35, 0,0x6B36,0x6B37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3351, + 0, 0, 0, 0, 0, 0, 0,0x6B38, + 0,0x6B39,0x6B3A, 0, 0, 0, 0, 0, +0x3272, 0, 0,0x3F28,0x6B3B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B3C, 0, 0, 0,0x6B3D, 0, 0, + 0, 0, 0, 0, 0,0x3840, 0,0x447B, +0x6B3E, 0, 0, 0, 0,0x3757, 0,0x3F56, + 0,0x6B41, 0,0x4624, 0,0x6B40, 0, 0, +0x3731, 0, 0,0x6B3F,0x4277,0x352D, 0, 0, +0x6B42, 0,0x6B43, 0,0x3E59, 0, 0, 0, +0x376D, 0,0x6B44, 0, 0, 0, 0,0x4B2C, + 0, 0,0x405F, 0, 0, 0,0x3576, 0, +0x4C75,0x414A, 0,0x6B45, 0, 0, 0,0x3F47, +0x4370,0x3E5A, 0, 0, 0, 0,0x6B46, 0, + 0, 0, 0,0x6B49, 0,0x6B4A, 0, 0, + 0, 0, 0, 0, 0,0x3A3E,0x4242,0x6B48, + 0,0x3E5B,0x493E, 0, 0, 0, 0, 0, +0x6B47, 0, 0,0x3B6C, 0,0x3153, 0,0x6B4E, +0x3758, 0, 0,0x3B6E, 0, 0,0x3B6D, 0, +0x4F4D,0x6B4D,0x6B4C,0x4127, 0,0x354D,0x4F43,0x333A, +0x3E5C, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B4B, 0, 0, 0, 0, 0,0x6B50, + 0,0x6B51,0x6B4F, 0,0x3858, 0,0x4D40, 0, + 0,0x3B6F,0x4727, 0, 0, 0,0x6B54, 0, +0x4040, 0,0x4342, 0, 0,0x4D36, 0,0x6B57, + 0, 0, 0,0x386C, 0,0x403F,0x6B53, 0, +0x6B58,0x386D,0x6B55,0x6B56, 0,0x6B52, 0, 0, + 0,0x4062,0x4649, 0, 0,0x432F, 0,0x325D, + 0, 0, 0, 0, 0, 0,0x4870, 0, + 0,0x3543, 0, 0,0x4434, 0, 0,0x6B5B, + 0,0x6B59, 0, 0,0x434C, 0, 0, 0, +0x4041,0x3452,0x6B5A, 0,0x3F5B, 0, 0,0x4E4A, + 0, 0, 0,0x4F40, 0, 0, 0,0x6B5C, +0x6B67,0x4435, 0,0x6B66, 0,0x6B63,0x6B6B,0x6B64, + 0,0x6B60, 0,0x447C,0x6B5F, 0, 0, 0, +0x6B5D, 0,0x4D21,0x3B70, 0, 0,0x6B61, 0, +0x6B5E, 0, 0, 0,0x6B65,0x3D74, 0,0x3841, + 0, 0, 0,0x427A, 0,0x4B45,0x315A,0x3062, + 0,0x4625, 0, 0,0x6B69, 0, 0, 0, + 0,0x6B68, 0,0x4666, 0,0x6B6D, 0, 0, + 0,0x6B62, 0,0x6B6C,0x6B6E, 0,0x382C,0x6B6A, +0x3956, 0,0x3C55, 0, 0,0x6B6F,0x4D58, 0, + 0, 0, 0,0x6B72, 0,0x6B75, 0, 0, +0x6B73,0x4935, 0, 0, 0, 0, 0, 0, +0x6B70, 0, 0, 0, 0, 0,0x3660, 0, + 0, 0, 0,0x6B74, 0, 0,0x6B76, 0, + 0, 0, 0, 0, 0, 0,0x6B7A, 0, + 0,0x6B77, 0,0x6B79,0x6B78, 0, 0, 0, + 0, 0, 0,0x6B7B, 0,0x3C31, 0,0x6B7D, +0x6B7C,0x4968, 0, 0,0x6C21, 0, 0, 0, + 0, 0, 0,0x3759, 0, 0, 0, 0, +0x6B7E,0x6C22, 0, 0,0x6C23,0x3544,0x6641,0x3E79, + 0,0x6C24, 0, 0,0x386E, 0, 0, 0, + 0, 0,0x6C25, 0, 0,0x6C26, 0, 0, +0x3B3E, 0, 0, 0, 0, 0, 0,0x5A4E, + 0,0x6C27, 0,0x6C28, 0,0x3D32, 0,0x6C29, +0x6C2A, 0, 0,0x6C2B, 0, 0,0x6C2C,0x6C2D +}; + +/* page 36 0x8C37-0x8D16 */ +static uint16 tab_uni_jisx020836[]={ +0x432B, 0, 0,0x6C2E, 0, 0, 0, 0, +0x6C30, 0,0x6C2F, 0, 0, 0, 0,0x4626, + 0,0x6C31, 0,0x4B2D, 0,0x6C32, 0,0x6C33, + 0,0x6C34, 0, 0, 0, 0,0x6C35, 0, + 0, 0, 0,0x465A, 0, 0, 0, 0, + 0, 0,0x3E5D,0x6C36, 0, 0, 0, 0, + 0, 0, 0,0x396B,0x502E,0x6C37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6C38,0x493F,0x6C39, 0,0x6C41, 0, 0, + 0, 0, 0,0x6C3A, 0, 0,0x6C3C, 0, + 0, 0,0x6C3B,0x6C3D, 0,0x4B46,0x6C3E,0x6C3F, + 0, 0, 0, 0, 0,0x6C40, 0, 0, + 0,0x6C42, 0, 0, 0, 0,0x332D,0x4467, + 0,0x4969,0x3A62,0x3957, 0, 0, 0, 0, +0x494F,0x325F,0x484E,0x6C45,0x3453,0x4055,0x6C44,0x6C49, +0x4379,0x4C63, 0,0x6C47,0x6C48,0x352E, 0,0x6C4A, +0x4763,0x425F, 0, 0,0x4871,0x453D,0x6C46, 0, +0x4B47,0x326C,0x6C4C,0x4F28,0x4442,0x4F45, 0, 0, +0x3B71,0x6C4B, 0,0x4231, 0, 0,0x6C5C,0x4128, + 0, 0,0x4678, 0,0x4950, 0, 0, 0, + 0, 0, 0,0x6C4F,0x3B3F,0x3B72, 0,0x3E5E, + 0,0x4765, 0,0x382D,0x6C4E,0x6C4D, 0,0x496A, + 0, 0, 0,0x3C41, 0, 0,0x4552, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C51,0x6C52,0x3958,0x6C50, 0, + 0, 0, 0, 0, 0,0x6C53,0x6C54, 0, +0x6C56,0x4223, 0,0x6C55,0x3466, 0,0x6C58, 0, +0x6C57,0x6C59, 0, 0,0x6C5B,0x6C5D, 0,0x6C5E +}; + +/* page 37 0x8D64-0x8F64 */ +static uint16 tab_uni_jisx020837[]={ +0x4056, 0,0x3C4F,0x6C5F, 0, 0, 0,0x3352, + 0,0x6C60, 0, 0,0x4176,0x6C61, 0,0x6C62, +0x496B, 0, 0,0x352F, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C63, 0, 0, + 0,0x4436, 0, 0, 0, 0,0x315B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C64, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C71, + 0, 0, 0, 0,0x3F76, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x422D, + 0, 0, 0, 0, 0, 0,0x6C67, 0, + 0, 0,0x6C66, 0, 0, 0,0x6C65, 0, + 0, 0, 0, 0, 0, 0, 0,0x6C6D, +0x6C6B, 0, 0,0x6C68, 0, 0, 0, 0, + 0, 0,0x6C6A, 0, 0, 0,0x6C69,0x6C6C, + 0,0x3577, 0,0x6C70, 0,0x4057, 0,0x6C71, + 0, 0, 0, 0,0x3859, 0,0x6C6E,0x6C6F, + 0, 0, 0,0x4F29, 0, 0, 0,0x4437, + 0,0x4129, 0, 0, 0, 0, 0, 0, +0x6C72, 0, 0,0x6C75, 0, 0, 0, 0, + 0, 0, 0, 0,0x6C73,0x6C74,0x4D59, 0, + 0, 0, 0,0x4627,0x6C78, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6C76,0x6C77,0x6C79, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D29, 0, + 0, 0, 0, 0,0x6C7C, 0, 0, 0, +0x6C7D,0x6C7B, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6C7A, 0, +0x447D, 0, 0,0x6D21,0x6D25,0x6D22,0x6C7E, 0, +0x6D23, 0, 0, 0,0x6D24, 0, 0, 0, + 0,0x6D2B, 0, 0, 0,0x6D26, 0, 0, + 0, 0, 0,0x4058,0x6D28, 0, 0,0x6D2A, +0x6D27, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D2D, 0, +0x3D33, 0,0x6D2C, 0, 0, 0, 0, 0, +0x6D2E, 0, 0, 0, 0,0x6D2F, 0, 0, +0x6D32,0x6D31, 0,0x6D30, 0, 0,0x6D34,0x6D33, + 0,0x4C76, 0, 0, 0,0x6D36, 0,0x6D35, +0x6D37, 0, 0, 0, 0,0x6D38, 0, 0, + 0, 0, 0, 0, 0,0x6D3A, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D39,0x3F48, +0x6D3B, 0, 0,0x366D,0x6D3C,0x6D3E, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6D3F, 0, 0, 0, 0, 0, + 0,0x6D40,0x6D3D, 0,0x6D41, 0,0x3C56,0x6D42, +0x3530,0x3733, 0, 0, 0, 0,0x382E, 0, + 0, 0, 0, 0, 0, 0, 0,0x6D43, + 0, 0, 0,0x4670, 0, 0,0x453E,0x6D44, + 0, 0, 0, 0, 0, 0, 0,0x6D47, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3C34, 0, 0,0x6D46, +0x6D45,0x375A,0x6D48, 0, 0, 0, 0,0x3353, + 0,0x6D4A, 0, 0, 0,0x3A5C,0x6D49, 0, +0x6D52, 0, 0, 0, 0, 0,0x6D4C,0x6D4E, +0x4A65,0x6D4B, 0, 0, 0,0x6D4D, 0,0x6D51, +0x6D4F,0x3531, 0,0x6D50, 0, 0, 0, 0, + 0, 0,0x6D53, 0, 0,0x475A,0x4E58, 0, + 0, 0, 0,0x3D34, 0, 0, 0,0x6D54, + 0, 0, 0, 0,0x4D22,0x6D56, 0,0x6D55, + 0, 0,0x6D59,0x4D41, 0, 0,0x6D58, 0, +0x336D,0x6D57,0x6D5C, 0, 0,0x6D5B, 0, 0, +0x6D5A,0x4532,0x6D5D, 0, 0, 0, 0, 0, + 0, 0, 0,0x6D5E, 0, 0, 0, 0, +0x6D5F, 0, 0,0x396C, 0,0x3725,0x6D60,0x6D61, +0x6D62}; + +/* page 38 0x8F9B-0x9132 */ +static uint16 tab_uni_jisx020838[]={ +0x3F49,0x6D63, 0,0x3C2D,0x6D64, 0, 0, 0, +0x6D65, 0, 0, 0,0x5221,0x517E, 0, 0, + 0, 0,0x6D66,0x6570,0x6D67,0x4324,0x3F2B,0x4740, + 0, 0, 0, 0,0x6D68, 0, 0,0x4A55, +0x4454,0x397E, 0, 0,0x4329, 0, 0,0x312A, + 0,0x4B78,0x3F57, 0, 0, 0, 0, 0, + 0, 0, 0,0x375E, 0, 0,0x3661, 0, + 0,0x4A56, 0, 0, 0, 0, 0,0x6D69, + 0, 0, 0, 0, 0, 0, 0,0x6D6B, + 0, 0,0x6D6A,0x3260, 0, 0,0x4676,0x6D6C, +0x4777, 0,0x4533, 0,0x6D6D,0x3D52, 0, 0, + 0,0x6D6F, 0, 0,0x4C42,0x6D7E,0x6D71,0x6D72, + 0, 0,0x4449, 0, 0,0x4260,0x4177, 0, +0x4628, 0,0x6D70,0x3555, 0, 0, 0, 0, +0x6D79, 0,0x6D76,0x6E25,0x4629,0x4360,0x6D73, 0, +0x447E,0x4553,0x6D74,0x6D78,0x3F60, 0,0x4767,0x444C, + 0, 0,0x4042,0x6D77,0x422E,0x4224,0x6D75,0x3029, +0x4F22, 0, 0, 0,0x6D7A, 0, 0, 0, + 0, 0, 0,0x4261, 0, 0,0x3D35,0x3F4A, + 0, 0,0x6D7C,0x6D7B, 0,0x306F,0x6D7D, 0, + 0,0x492F, 0,0x6E27, 0, 0,0x465B,0x3F6B, + 0, 0,0x4359, 0,0x3678, 0,0x6E26,0x4D37, +0x313F, 0,0x4A57,0x3261,0x6E21,0x6E22,0x6E23,0x6E24, +0x463B,0x4323,0x3063,0x6E28, 0,0x6E29,0x7423, 0, + 0,0x423D, 0,0x6E2A, 0,0x3173,0x414C, 0, +0x382F, 0,0x4D5A, 0, 0,0x6E2B,0x452C, 0, + 0, 0,0x4178,0x3C57,0x6E2C, 0, 0,0x6E2F, + 0, 0,0x3D65,0x6E2D,0x412B,0x412A, 0,0x3064, + 0,0x4E4B,0x6E31, 0,0x4872,0x6E33,0x6E32,0x6E30, +0x6364,0x3454, 0, 0,0x6D6E, 0,0x6E35,0x6E34, + 0, 0, 0, 0,0x6E36, 0,0x4D38, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4661, 0, 0,0x4B2E, 0,0x6E37, 0,0x3C59, + 0, 0, 0, 0,0x6E38, 0,0x6E39, 0, + 0, 0,0x6E3A, 0, 0,0x4521, 0, 0, + 0, 0, 0, 0, 0, 0,0x306A, 0, + 0, 0, 0, 0, 0, 0, 0,0x3959, + 0, 0, 0,0x4F3A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6E3E, 0, 0, 0, 0, 0,0x3734,0x6E3B, + 0,0x6E3C, 0, 0, 0,0x4974, 0, 0, + 0, 0,0x3354, 0, 0, 0, 0, 0, + 0, 0,0x4D39, 0,0x363F, 0, 0, 0, + 0, 0,0x4554, 0, 0, 0, 0,0x6E3F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x6E40, + 0, 0, 0, 0, 0, 0,0x6E41, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4522, 0, 0,0x6E43, 0,0x6E42 +}; + +/* page 39 0x9149-0x92B9 */ +static uint16 tab_uni_jisx020839[]={ +0x4653,0x6E44,0x3D36,0x3C60,0x475B,0x4371, 0, 0, + 0,0x3C72, 0,0x3F6C, 0,0x6E45, 0,0x6E46, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3F5D,0x6E47, 0,0x6E48, 0, 0, 0, +0x6E49,0x4D6F, 0,0x3D37, 0, 0, 0, 0, + 0,0x6E4B,0x6E4A, 0,0x395A, 0,0x3973,0x3B40, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6E4E, 0, 0, 0, 0,0x3D66, 0, +0x6E4D, 0,0x6E4C, 0,0x4269, 0, 0,0x386F, + 0,0x4043, 0, 0, 0, 0,0x4830, 0, + 0, 0, 0,0x3D39, 0, 0, 0, 0, + 0,0x6E4F, 0,0x3E5F, 0, 0, 0, 0, + 0,0x6E52,0x6E50, 0, 0, 0,0x6E51, 0, + 0, 0, 0,0x6E54,0x6E53, 0, 0,0x3E7A, + 0,0x6E55, 0, 0, 0, 0, 0,0x6E56, +0x6E57, 0, 0, 0, 0,0x4850,0x3A53,0x3C61, +0x6E58, 0,0x6E59,0x4E24,0x3D45,0x4C6E,0x4E4C,0x6E5A, +0x3662, 0, 0, 0, 0,0x6E5B, 0,0x4523, + 0, 0,0x6E5E,0x3378,0x3F4B, 0,0x6E5C, 0, +0x6E5D, 0,0x4460, 0, 0,0x4B55,0x367C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6E60,0x6E61, 0, 0, + 0, 0, 0,0x6E5F, 0, 0,0x6E63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x465F,0x3343, 0, 0, +0x6E67, 0, 0,0x6E64,0x6E66, 0, 0, 0, + 0, 0, 0, 0, 0,0x6E62, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6F4F, 0, 0,0x6E65, 0, 0, 0, 0, + 0, 0, 0,0x4E6B, 0, 0,0x385A, 0, + 0, 0, 0, 0, 0, 0,0x6E6F, 0, + 0, 0, 0,0x4534,0x6E6A, 0, 0,0x6E6D, +0x6E6B, 0,0x6E70, 0, 0, 0, 0,0x6E71, + 0, 0, 0, 0, 0, 0,0x6E69, 0, + 0,0x6E76,0x3174, 0, 0,0x6E68, 0, 0, + 0,0x482D, 0,0x6E6C, 0,0x3E60, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x395B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4B48, 0,0x3664, + 0, 0,0x3D46, 0,0x463C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x412D, 0,0x6E74, 0,0x6E6E,0x6E73, 0,0x4C43, + 0,0x4438,0x6E75,0x6E72, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x412C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6E79, 0, +0x6E78}; + +/* page 40 0x92CF-0x93E8 */ +static uint16 tab_uni_jisx020840[]={ +0x6E77, 0, 0,0x4B2F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3D7B, 0, 0, + 0, 0,0x6E7A,0x4A5F, 0, 0,0x3154, 0, + 0, 0, 0,0x4946,0x4372, 0, 0, 0, + 0,0x3578, 0,0x6E7C, 0,0x395D, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3B2C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6E7B,0x3F6D, 0, 0, 0, 0, 0, 0, + 0,0x3F6E,0x6F21,0x6F23, 0, 0, 0, 0, + 0,0x3E7B, 0,0x6F22,0x6F24, 0, 0,0x3653, + 0,0x4945, 0, 0,0x3C62,0x4F23, 0,0x6E7E, +0x3A78, 0, 0,0x4F3F, 0, 0,0x6F26, 0, + 0, 0, 0,0x6F25,0x6F27, 0, 0, 0, + 0, 0, 0, 0, 0,0x6E7D, 0, 0, + 0, 0, 0, 0,0x4669, 0,0x4555, 0, + 0, 0, 0, 0, 0,0x4457, 0,0x6F2C, + 0, 0, 0, 0,0x4343,0x6F28, 0, 0, + 0,0x6F29, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x372D, 0,0x6F2B, + 0, 0, 0, 0, 0, 0,0x3830, 0, + 0, 0, 0, 0, 0,0x6F2A, 0,0x3E61, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3379, 0, 0, + 0, 0, 0, 0, 0,0x6F30, 0,0x3A3F, +0x4179, 0, 0,0x444A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x333B, 0, 0, 0, 0,0x6F2E,0x6F2F,0x4443, + 0,0x6F2D, 0, 0, 0, 0, 0, 0, + 0, 0,0x6F31, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6F37, 0, 0, 0, + 0,0x6F3A, 0, 0, 0, 0, 0, 0, + 0,0x6F39,0x452D, 0, 0, 0, 0,0x6F32, +0x6F33,0x6F36, 0, 0, 0, 0,0x6F38, 0, + 0, 0,0x3640, 0, 0,0x6F3B,0x6F35, 0, + 0,0x6F34}; + +/* page 41 0x9403-0x9481 */ +static uint16 tab_uni_jisx020841[]={ +0x6F3F, 0, 0, 0,0x6F40, 0, 0, 0, + 0, 0, 0, 0, 0,0x6F41, 0, 0, +0x6F3E,0x6F3D, 0, 0, 0,0x3E62,0x462A,0x6F3C, + 0, 0, 0, 0, 0, 0,0x6F45, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6F43, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6F44,0x6F42, 0,0x4278, 0,0x6F46, + 0, 0, 0, 0, 0, 0,0x6F47, 0, + 0,0x6F49, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3455,0x6F48, +0x4C7A, 0, 0, 0, 0, 0, 0,0x6F54, +0x6F4A, 0, 0,0x6F4D, 0,0x6F4B, 0,0x6F4C, + 0, 0, 0, 0, 0, 0, 0,0x6F4E, + 0, 0, 0, 0, 0,0x6F50, 0, 0, + 0, 0,0x6F51, 0,0x6F52, 0, 0, 0, + 0,0x6F55,0x6F53,0x6F56,0x6F58, 0,0x6F57}; + +/* page 42 0x9577-0x95E5 */ +static uint16 tab_uni_jisx020842[]={ +0x4439, 0, 0, 0, 0, 0, 0, 0, + 0,0x4C67, 0,0x6F59,0x412E, 0, 0, 0, +0x6F5A, 0,0x4A44,0x6F5B,0x332B, 0, 0, 0, +0x313C, 0,0x3457, 0,0x3456,0x6F5C, 0,0x6F5D, + 0,0x6F5E,0x6F5F, 0, 0, 0, 0, 0, + 0,0x6F60, 0,0x3458,0x3355,0x395E,0x4836, 0, +0x6F62,0x6F61, 0, 0, 0, 0,0x6F63, 0, + 0, 0, 0,0x315C, 0, 0, 0, 0, + 0, 0,0x6F66, 0,0x6F65,0x6F64, 0,0x6F67, + 0, 0, 0, 0,0x6F6A, 0, 0, 0, +0x3047, 0, 0,0x6F68, 0,0x6F6C,0x6F6B, 0, + 0, 0, 0, 0, 0,0x6F6E,0x6F6D,0x6F6F, + 0,0x462E, 0, 0, 0,0x6F70, 0, 0, + 0, 0,0x6F71,0x6F73, 0, 0,0x6F72}; + +/* page 43 0x961C-0x9874 */ +static uint16 tab_uni_jisx020843[]={ +0x496C, 0, 0, 0, 0,0x6F74, 0, 0, + 0, 0, 0, 0,0x6F75, 0,0x3A65, 0, + 0, 0,0x6F76,0x6F77, 0, 0,0x4B49, 0, + 0, 0, 0, 0, 0, 0, 0,0x414B, + 0, 0, 0,0x3024,0x424B, 0,0x6F78, 0, +0x496D, 0, 0, 0, 0, 0, 0,0x6F7B, +0x6F79,0x395F, 0,0x6F7A,0x3842, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4A45, +0x6F7D,0x7021,0x6F7E,0x7022, 0, 0,0x3121,0x3F58, +0x3D7C,0x3459,0x7023, 0, 0, 0,0x4766, 0, +0x7025, 0, 0, 0,0x3122, 0,0x7024,0x4444, + 0,0x4E4D,0x462B,0x6F7C,0x4E26, 0,0x3831, 0, + 0,0x4D5B, 0, 0, 0, 0, 0, 0, + 0,0x3679,0x4E34, 0,0x3728, 0,0x4262,0x6721, + 0,0x7026,0x332C,0x3F6F, 0, 0, 0, 0, +0x3356,0x7028, 0,0x7029,0x7027,0x3764, 0,0x3A5D, +0x3E63, 0, 0, 0,0x3123, 0, 0,0x4E59, + 0, 0, 0,0x702B,0x6E2E, 0,0x702A, 0, + 0, 0, 0, 0,0x702E,0x702C,0x702D, 0, +0x702F, 0,0x7030,0x4E6C,0x7031,0x7032, 0,0x4049, +0x483B, 0, 0, 0,0x3F7D,0x3467, 0, 0, +0x4D3A,0x326D,0x3D38,0x385B, 0,0x7035, 0,0x7034, +0x3B73,0x7036,0x7033, 0, 0,0x3B28, 0, 0, + 0,0x703A,0x6A2D, 0, 0,0x5256, 0,0x3F77, +0x7038, 0, 0, 0, 0, 0,0x4E25,0x4671, + 0, 0, 0, 0,0x312B, 0,0x4063,0x3C36, + 0, 0, 0, 0,0x4A37, 0,0x3140, 0, + 0, 0,0x4E6D,0x4D6B, 0,0x703B, 0,0x4545, + 0, 0, 0, 0,0x3C7B, 0, 0, 0, +0x703C, 0,0x703D,0x3F4C,0x703E, 0,0x4E6E, 0, + 0,0x7039,0x7040,0x7042, 0,0x7041, 0,0x703F, + 0, 0,0x7043, 0, 0,0x7044, 0, 0, +0x417A, 0,0x3262, 0, 0, 0, 0, 0, +0x7045, 0, 0,0x4C38, 0, 0,0x7046, 0, + 0, 0, 0, 0,0x7047, 0,0x4F2A, 0, + 0, 0, 0, 0,0x5B31,0x7048, 0, 0, + 0,0x7049,0x704A, 0, 0, 0,0x704E, 0, +0x704B, 0,0x704C, 0,0x704D,0x704F, 0, 0, + 0, 0, 0, 0, 0, 0,0x4044, 0, + 0, 0,0x4C77, 0, 0,0x4045, 0, 0, +0x7050, 0,0x4873, 0,0x7051,0x7353,0x4C4C, 0, +0x7052, 0,0x7053, 0,0x7054,0x3357, 0,0x7056, + 0,0x3F59, 0, 0, 0,0x7057, 0, 0, +0x3724, 0, 0, 0, 0,0x7058,0x705C, 0, +0x705A, 0, 0, 0, 0,0x705B, 0, 0, +0x3373,0x7059,0x705D, 0, 0, 0, 0,0x705E, + 0,0x3048, 0,0x705F,0x7060, 0, 0, 0, + 0, 0, 0, 0,0x3E64, 0, 0, 0, +0x7061, 0, 0, 0,0x3547, 0, 0,0x7064, + 0, 0,0x7063, 0,0x7062, 0, 0,0x6B71, + 0,0x4A5C, 0, 0, 0, 0, 0,0x7065, +0x7066, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7067, + 0, 0,0x7068, 0,0x7069, 0, 0,0x706A, + 0, 0, 0, 0, 0, 0, 0,0x345A, + 0, 0, 0, 0, 0, 0, 0, 0, +0x706B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x706C,0x4723, 0, 0, 0,0x706E,0x323B, + 0,0x7071,0x7070, 0, 0, 0, 0,0x3124, + 0, 0, 0,0x3641, 0,0x4A47,0x443A,0x3A22, + 0,0x3960,0x3D67, 0,0x3F5C, 0, 0, 0, +0x7073, 0, 0,0x7072,0x4D42,0x3468,0x4852,0x465C, + 0, 0, 0,0x3F7C,0x4E4E, 0,0x375B, 0, + 0, 0, 0, 0, 0,0x7076, 0, 0, +0x7075, 0, 0, 0, 0, 0, 0, 0, +0x4B4B,0x462C, 0, 0, 0, 0, 0, 0, +0x3150, 0, 0,0x7077,0x7074, 0, 0,0x4951, +0x4D6A,0x7078, 0, 0, 0, 0, 0, 0, + 0, 0,0x7079, 0, 0, 0, 0,0x707B, +0x426A,0x335B,0x335C,0x707A, 0, 0, 0, 0, +0x3469,0x3832, 0, 0,0x346A, 0, 0,0x453F, + 0, 0,0x4E60, 0, 0, 0, 0, 0, + 0, 0, 0,0x385C, 0, 0, 0,0x707C, + 0, 0, 0,0x707D,0x707E,0x7121, 0,0x7123, +0x7122}; + +/* page 44 0x98A8-0x98C6 */ +static uint16 tab_uni_jisx020844[]={ +0x4977, 0,0x7124, 0, 0, 0, 0,0x7125, + 0,0x7126, 0, 0, 0, 0,0x7127, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x7129,0x7128, 0,0x712A}; + +/* page 45 0x98DB-0x9957 */ +static uint16 tab_uni_jisx020845[]={ +0x4874,0x664C, 0, 0,0x3F29, 0, 0,0x3532, + 0, 0, 0, 0, 0, 0,0x712B, 0, +0x712C, 0,0x522C,0x5D3B,0x4853, 0, 0,0x307B, + 0,0x303B, 0, 0, 0, 0, 0, 0, + 0,0x3B74,0x4B30,0x3E7E, 0, 0, 0, 0, +0x712D, 0,0x4C5F, 0, 0, 0,0x712E,0x4D5C, + 0,0x3142, 0, 0, 0,0x3B41, 0,0x712F, +0x326E,0x7130, 0, 0, 0,0x7131, 0, 0, + 0, 0,0x7133,0x7134, 0,0x7136,0x7132, 0, + 0,0x7135, 0, 0, 0,0x345B, 0, 0, + 0,0x7137, 0,0x7138, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7139,0x713A, 0, 0, 0,0x713B, + 0, 0,0x713D, 0, 0, 0,0x713C, 0, +0x713F,0x7142, 0, 0, 0,0x713E,0x7140,0x7141, + 0, 0,0x7143, 0,0x3642}; + +/* page 46 0x9996-0x9A6B */ +static uint16 tab_uni_jisx020846[]={ +0x3C73,0x7144,0x7145,0x3961, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7146, + 0, 0,0x333E, 0, 0, 0,0x474F,0x7147, +0x7148, 0, 0, 0, 0,0x435A,0x466B, 0, + 0, 0, 0, 0, 0, 0,0x7149, 0, + 0, 0, 0,0x477D, 0, 0,0x424C,0x3158, +0x366E, 0,0x366F, 0, 0, 0, 0, 0, + 0, 0,0x4373,0x714E,0x3670, 0, 0,0x326F, + 0, 0,0x714D, 0, 0,0x714B, 0,0x714C, + 0,0x714A, 0, 0,0x7158, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x714F, +0x7150, 0, 0,0x7151,0x7152, 0, 0, 0, + 0, 0,0x7154, 0, 0,0x7153, 0, 0, + 0,0x3D59, 0,0x7155, 0, 0, 0,0x7157, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3533,0x7156, 0, 0,0x417B,0x3833, 0, 0, + 0, 0, 0,0x7159, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x424D, 0, 0,0x715A, 0, 0, + 0, 0,0x462D, 0, 0, 0, 0, 0, + 0,0x715B, 0, 0, 0, 0, 0, 0, +0x7160, 0,0x715E, 0,0x715D,0x715F, 0,0x715C, + 0, 0, 0, 0, 0, 0, 0,0x7162, + 0, 0, 0, 0, 0, 0, 0,0x7161, + 0,0x7164, 0, 0,0x3643,0x7163, 0, 0, + 0,0x7165, 0, 0,0x7166, 0,0x7168,0x7167, + 0, 0, 0,0x7169,0x716B,0x716A}; + +/* page 47 0x9AA8-0x9B5A */ +static uint16 tab_uni_jisx020847[]={ +0x397C, 0, 0, 0, 0,0x716C, 0, 0, +0x716D, 0, 0, 0, 0, 0, 0, 0, +0x333C, 0, 0, 0,0x716E, 0, 0, 0, +0x716F, 0, 0, 0,0x3F71, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7170, + 0,0x7171, 0,0x7172,0x7173, 0, 0, 0, +0x3962, 0, 0, 0, 0, 0,0x7174,0x7175, + 0, 0,0x7176,0x7177, 0, 0,0x7178, 0, + 0, 0,0x4831,0x717A, 0,0x4926,0x717B,0x7179, + 0,0x717D, 0, 0,0x717C, 0, 0,0x717E, + 0, 0, 0,0x7221, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7222, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x7223, 0,0x7224, 0, 0, 0, 0,0x7225, + 0, 0,0x7226,0x7227, 0,0x7228, 0,0x7229, +0x722A,0x722B,0x722C, 0, 0, 0,0x722D,0x722E, + 0,0x5D35,0x722F, 0, 0, 0, 0, 0, + 0, 0, 0,0x6478,0x3534, 0, 0, 0, + 0,0x3321,0x3A32,0x7231,0x7230,0x4C25, 0, 0, + 0, 0, 0, 0, 0,0x7233,0x7234,0x7232, + 0,0x7235, 0, 0,0x4B62, 0, 0, 0, +0x7236, 0,0x357B}; + +/* page 48 0x9B6F-0x9C78 */ +static uint16 tab_uni_jisx020848[]={ +0x4F25, 0, 0, 0, 0,0x7237, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x7239, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x303E, + 0, 0,0x723A,0x4A2B,0x7238, 0, 0,0x723B, +0x723C, 0, 0, 0, 0, 0, 0, 0, +0x723D,0x723E, 0, 0, 0, 0, 0, 0, + 0,0x723F, 0,0x4B6E,0x3B2D, 0,0x3A7A,0x412F, + 0, 0, 0, 0, 0,0x7240, 0, 0, + 0, 0,0x7243, 0, 0, 0, 0, 0, + 0,0x7241, 0, 0, 0, 0, 0,0x7244, + 0, 0,0x3871,0x7242, 0, 0, 0, 0, +0x7245, 0,0x7246,0x7247, 0,0x724B, 0,0x3B2A, + 0, 0, 0, 0,0x4264, 0, 0, 0, + 0, 0,0x724C,0x7249,0x7248,0x724A, 0, 0, + 0,0x375F, 0, 0, 0, 0, 0, 0, + 0,0x7250,0x724F,0x724E, 0, 0,0x3033, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x725A, 0,0x7256, + 0,0x7257,0x7253,0x7259, 0,0x7255,0x3362, 0, + 0,0x4F4C, 0,0x7258,0x7254,0x7252,0x7251, 0, + 0, 0, 0, 0,0x725C, 0, 0, 0, + 0, 0,0x725F, 0, 0,0x725E,0x725D, 0, + 0, 0, 0, 0, 0, 0,0x4949,0x725B, +0x3073,0x7260, 0,0x7262, 0, 0, 0, 0, + 0, 0,0x336F,0x724D,0x3137, 0, 0,0x7264, + 0, 0, 0, 0, 0, 0, 0,0x7263, +0x7261,0x432D, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4B70, 0, 0, 0, 0, +0x4E5A, 0, 0,0x7265, 0, 0, 0, 0, + 0,0x7266, 0, 0, 0, 0, 0, 0, +0x7267, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x7268, + 0,0x7269}; + +/* page 49 0x9CE5-0x9DFD */ +static uint16 tab_uni_jisx020849[]={ +0x443B, 0,0x726A, 0,0x4837, 0,0x726F,0x726B, + 0, 0, 0,0x726C, 0, 0,0x4B31,0x4C44, + 0,0x4650, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x7270, 0, + 0,0x7271,0x463E,0x726E,0x726D, 0, 0, 0, + 0,0x322A, 0, 0, 0,0x7279, 0, 0, +0x7278, 0, 0, 0, 0, 0,0x3175, 0, + 0, 0,0x7276, 0, 0, 0,0x7275, 0, + 0,0x7273, 0,0x337B, 0,0x7272,0x3C32,0x3229, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3963, 0, + 0,0x727C,0x727B, 0,0x727A, 0, 0,0x7277, + 0,0x727D, 0,0x727E, 0, 0, 0, 0, + 0, 0, 0,0x7325,0x7324, 0, 0, 0, + 0, 0, 0, 0,0x7326, 0, 0,0x312D, +0x7321,0x7322, 0,0x3974,0x4C39, 0, 0,0x7323, + 0, 0, 0, 0, 0, 0, 0,0x4B32, + 0, 0,0x732B, 0, 0,0x7327, 0, 0, + 0, 0, 0, 0, 0,0x732C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7329, 0,0x7328, 0, 0, 0, + 0, 0,0x375C, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x732D, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x732E, + 0, 0, 0, 0,0x732F, 0,0x732A, 0, + 0, 0,0x7274, 0, 0,0x7330, 0,0x4461, + 0, 0, 0,0x7334, 0,0x7335,0x7333, 0, + 0, 0, 0, 0,0x7332,0x7338, 0,0x7331, + 0,0x7336, 0, 0, 0, 0, 0, 0, + 0, 0,0x7337, 0, 0, 0,0x733A, 0, + 0, 0, 0, 0,0x7339, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x733C, 0, 0, 0, 0, 0, 0, +0x733D, 0,0x733E, 0, 0,0x4F49, 0, 0, + 0, 0, 0,0x733B,0x426B,0x3A6D, 0, 0, +0x733F}; + +/* page 50 0x9E1A-0x9E1E */ +static uint16 tab_uni_jisx020850[]={ +0x7340,0x7341, 0, 0,0x7342}; + +/* page 51 0x9E75-0x9F77 */ +static uint16 tab_uni_jisx020851[]={ +0x7343, 0, 0,0x3834,0x7344, 0, 0, 0, +0x7345, 0,0x3C2F, 0,0x7346, 0, 0, 0, + 0, 0, 0,0x7347, 0, 0,0x7348,0x7349, + 0, 0, 0, 0,0x734C,0x734A,0x4F3C, 0, +0x734B, 0,0x4E6F, 0, 0, 0, 0, 0, +0x734D, 0,0x4E5B, 0, 0, 0, 0, 0, +0x734E,0x477E, 0, 0,0x734F,0x7351, 0, 0, +0x7352, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x7350,0x396D,0x4C4D,0x4B63,0x5677, + 0,0x5D60,0x4B7B, 0, 0, 0, 0,0x322B, + 0, 0, 0, 0, 0, 0, 0,0x7354, +0x3550,0x7355,0x7356,0x7357, 0,0x3975, 0,0x7358, + 0, 0, 0,0x6054,0x4C5B, 0,0x4263,0x7359, +0x735B,0x735A, 0,0x735C, 0, 0, 0, 0, +0x735D, 0, 0,0x735E, 0, 0, 0, 0, + 0, 0,0x735F, 0, 0, 0, 0,0x7360, + 0,0x7361,0x7362, 0,0x7363, 0,0x7364,0x7365, +0x7366, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7367,0x7368, 0, 0, 0, 0, + 0,0x4524, 0, 0, 0, 0,0x385D, 0, +0x736A, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x414D,0x736B, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x736C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4921, 0, + 0,0x736D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x736E,0x6337, 0, + 0,0x6C5A,0x706D, 0, 0,0x736F, 0,0x7370, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x7372,0x7373,0x7374,0x4E70,0x7371, 0, + 0,0x7375,0x7376, 0, 0,0x7378, 0,0x7377, + 0, 0, 0, 0, 0,0x737A, 0, 0, + 0,0x737B,0x7379}; + +/* page 52 0x9F8D-0x9FA0 */ +static uint16 tab_uni_jisx020852[]={ +0x4E36, 0, 0, 0, 0, 0, 0, 0, +0x737C, 0, 0, 0, 0, 0, 0,0x737D, +0x6354, 0, 0,0x737E}; + +/* page 53 0xFF01-0xFF5D */ +static uint16 tab_uni_jisx020853[]={ +0x212A, 0,0x2174,0x2170,0x2173,0x2175, 0,0x214A, +0x214B,0x2176,0x215C,0x2124, 0,0x2125,0x213F,0x2330, +0x2331,0x2332,0x2333,0x2334,0x2335,0x2336,0x2337,0x2338, +0x2339,0x2127,0x2128,0x2163,0x2161,0x2164,0x2129,0x2177, +0x2341,0x2342,0x2343,0x2344,0x2345,0x2346,0x2347,0x2348, +0x2349,0x234A,0x234B,0x234C,0x234D,0x234E,0x234F,0x2350, +0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,0x2358, +0x2359,0x235A,0x214E, 0,0x214F,0x2130,0x2132,0x212E, +0x2361,0x2362,0x2363,0x2364,0x2365,0x2366,0x2367,0x2368, +0x2369,0x236A,0x236B,0x236C,0x236D,0x236E,0x236F,0x2370, +0x2371,0x2372,0x2373,0x2374,0x2375,0x2376,0x2377,0x2378, +0x2379,0x237A,0x2150,0x2143,0x2151}; + +/* page 54 0xFFE3-0xFFE5 */ +static uint16 tab_uni_jisx020854[]={ +0x2131, 0,0x216F}; + +static int +my_uni_jisx0208_onechar(int code){ + if ((code>=0x005C)&&(code<=0x005C)) + return(tab_uni_jisx02080[code-0x005C]); + if ((code>=0x00A2)&&(code<=0x00B6)) + return(tab_uni_jisx02081[code-0x00A2]); + if ((code>=0x00D7)&&(code<=0x00D7)) + return(tab_uni_jisx02082[code-0x00D7]); + if ((code>=0x00F7)&&(code<=0x00F7)) + return(tab_uni_jisx02083[code-0x00F7]); + if ((code>=0x0391)&&(code<=0x03C9)) + return(tab_uni_jisx02084[code-0x0391]); + if ((code>=0x0401)&&(code<=0x0451)) + return(tab_uni_jisx02085[code-0x0401]); + if ((code>=0x2010)&&(code<=0x203B)) + return(tab_uni_jisx02086[code-0x2010]); + if ((code>=0x2103)&&(code<=0x2103)) + return(tab_uni_jisx02087[code-0x2103]); + if ((code>=0x212B)&&(code<=0x212B)) + return(tab_uni_jisx02088[code-0x212B]); + if ((code>=0x2190)&&(code<=0x2193)) + return(tab_uni_jisx02089[code-0x2190]); + if ((code>=0x21D2)&&(code<=0x21D4)) + return(tab_uni_jisx020810[code-0x21D2]); + if ((code>=0x2200)&&(code<=0x223D)) + return(tab_uni_jisx020811[code-0x2200]); + if ((code>=0x2252)&&(code<=0x226B)) + return(tab_uni_jisx020812[code-0x2252]); + if ((code>=0x2282)&&(code<=0x2287)) + return(tab_uni_jisx020813[code-0x2282]); + if ((code>=0x22A5)&&(code<=0x22A5)) + return(tab_uni_jisx020814[code-0x22A5]); + if ((code>=0x2312)&&(code<=0x2312)) + return(tab_uni_jisx020815[code-0x2312]); + if ((code>=0x2500)&&(code<=0x254B)) + return(tab_uni_jisx020816[code-0x2500]); + if ((code>=0x25A0)&&(code<=0x25CF)) + return(tab_uni_jisx020817[code-0x25A0]); + if ((code>=0x25EF)&&(code<=0x25EF)) + return(tab_uni_jisx020818[code-0x25EF]); + if ((code>=0x2605)&&(code<=0x2606)) + return(tab_uni_jisx020819[code-0x2605]); + if ((code>=0x2640)&&(code<=0x2642)) + return(tab_uni_jisx020820[code-0x2640]); + if ((code>=0x266A)&&(code<=0x266F)) + return(tab_uni_jisx020821[code-0x266A]); + if ((code>=0x3000)&&(code<=0x301C)) + return(tab_uni_jisx020822[code-0x3000]); + if ((code>=0x3041)&&(code<=0x30FE)) + return(tab_uni_jisx020823[code-0x3041]); + if ((code>=0x4E00)&&(code<=0x5516)) + return(tab_uni_jisx020824[code-0x4E00]); + if ((code>=0x552E)&&(code<=0x5563)) + return(tab_uni_jisx020825[code-0x552E]); + if ((code>=0x557B)&&(code<=0x576A)) + return(tab_uni_jisx020826[code-0x557B]); + if ((code>=0x577F)&&(code<=0x5A9B)) + return(tab_uni_jisx020827[code-0x577F]); + if ((code>=0x5ABC)&&(code<=0x5D29)) + return(tab_uni_jisx020828[code-0x5ABC]); + if ((code>=0x5D4B)&&(code<=0x6BF3)) + return(tab_uni_jisx020829[code-0x5D4B]); + if ((code>=0x6C08)&&(code<=0x6CF3)) + return(tab_uni_jisx020830[code-0x6C08]); + if ((code>=0x6D0B)&&(code<=0x7409)) + return(tab_uni_jisx020831[code-0x6D0B]); + if ((code>=0x7422)&&(code<=0x7845)) + return(tab_uni_jisx020832[code-0x7422]); + if ((code>=0x785D)&&(code<=0x7E9C)) + return(tab_uni_jisx020833[code-0x785D]); + if ((code>=0x7F36)&&(code<=0x8358)) + return(tab_uni_jisx020834[code-0x7F36]); + if ((code>=0x8373)&&(code<=0x8B9A)) + return(tab_uni_jisx020835[code-0x8373]); + if ((code>=0x8C37)&&(code<=0x8D16)) + return(tab_uni_jisx020836[code-0x8C37]); + if ((code>=0x8D64)&&(code<=0x8F64)) + return(tab_uni_jisx020837[code-0x8D64]); + if ((code>=0x8F9B)&&(code<=0x9132)) + return(tab_uni_jisx020838[code-0x8F9B]); + if ((code>=0x9149)&&(code<=0x92B9)) + return(tab_uni_jisx020839[code-0x9149]); + if ((code>=0x92CF)&&(code<=0x93E8)) + return(tab_uni_jisx020840[code-0x92CF]); + if ((code>=0x9403)&&(code<=0x9481)) + return(tab_uni_jisx020841[code-0x9403]); + if ((code>=0x9577)&&(code<=0x95E5)) + return(tab_uni_jisx020842[code-0x9577]); + if ((code>=0x961C)&&(code<=0x9874)) + return(tab_uni_jisx020843[code-0x961C]); + if ((code>=0x98A8)&&(code<=0x98C6)) + return(tab_uni_jisx020844[code-0x98A8]); + if ((code>=0x98DB)&&(code<=0x9957)) + return(tab_uni_jisx020845[code-0x98DB]); + if ((code>=0x9996)&&(code<=0x9A6B)) + return(tab_uni_jisx020846[code-0x9996]); + if ((code>=0x9AA8)&&(code<=0x9B5A)) + return(tab_uni_jisx020847[code-0x9AA8]); + if ((code>=0x9B6F)&&(code<=0x9C78)) + return(tab_uni_jisx020848[code-0x9B6F]); + if ((code>=0x9CE5)&&(code<=0x9DFD)) + return(tab_uni_jisx020849[code-0x9CE5]); + if ((code>=0x9E1A)&&(code<=0x9E1E)) + return(tab_uni_jisx020850[code-0x9E1A]); + if ((code>=0x9E75)&&(code<=0x9F77)) + return(tab_uni_jisx020851[code-0x9E75]); + if ((code>=0x9F8D)&&(code<=0x9FA0)) + return(tab_uni_jisx020852[code-0x9F8D]); + if ((code>=0xFF01)&&(code<=0xFF5D)) + return(tab_uni_jisx020853[code-0xFF01]); + if ((code>=0xFFE3)&&(code<=0xFFE5)) + return(tab_uni_jisx020854[code-0xFFE3]); + return(0); +} + + + +/* page 0 0x007E-0x007E */ +static uint16 tab_uni_jisx02120[]={ +0x2237}; + +/* page 1 0x00A1-0x017E */ +static uint16 tab_uni_jisx02121[]={ +0x2242, 0, 0,0x2270, 0,0x2243, 0, 0, +0x226D,0x226C, 0, 0, 0,0x226E,0x2234, 0, + 0, 0, 0, 0, 0, 0, 0,0x2231, + 0,0x226B, 0, 0, 0, 0,0x2244,0x2A22, +0x2A21,0x2A24,0x2A2A,0x2A23,0x2A29,0x2921,0x2A2E,0x2A32, +0x2A31,0x2A34,0x2A33,0x2A40,0x2A3F,0x2A42,0x2A41, 0, +0x2A50,0x2A52,0x2A51,0x2A54,0x2A58,0x2A53, 0,0x292C, +0x2A63,0x2A62,0x2A65,0x2A64,0x2A72,0x2930,0x294E,0x2B22, +0x2B21,0x2B24,0x2B2A,0x2B23,0x2B29,0x2941,0x2B2E,0x2B32, +0x2B31,0x2B34,0x2B33,0x2B40,0x2B3F,0x2B42,0x2B41,0x2943, +0x2B50,0x2B52,0x2B51,0x2B54,0x2B58,0x2B53, 0,0x294C, +0x2B63,0x2B62,0x2B65,0x2B64,0x2B72,0x2950,0x2B73,0x2A27, +0x2B27,0x2A25,0x2B25,0x2A28,0x2B28,0x2A2B,0x2B2B,0x2A2C, +0x2B2C,0x2A2F,0x2B2F,0x2A2D,0x2B2D,0x2A30,0x2B30,0x2922, +0x2942,0x2A37,0x2B37, 0, 0,0x2A36,0x2B36,0x2A38, +0x2B38,0x2A35,0x2B35,0x2A3A,0x2B3A,0x2A3B,0x2B3B,0x2A3D, +0x2B3D,0x2A3C, 0,0x2A3E,0x2B3E,0x2924,0x2944,0x2A47, +0x2B47,0x2A45,0x2B45, 0, 0,0x2A46,0x2B46,0x2A44, +0x2945,0x2926,0x2946,0x2A48,0x2B48,0x2A49,0x2B49,0x2947, +0x2A4A,0x2B4A,0x2A4C,0x2B4C,0x2A4B,0x2B4B,0x2929,0x2949, +0x2928,0x2948,0x2A4D,0x2B4D,0x2A4F,0x2B4F,0x2A4E,0x2B4E, +0x294A,0x292B,0x294B,0x2A57,0x2B57, 0, 0,0x2A56, +0x2B56,0x292D,0x294D,0x2A59,0x2B59,0x2A5B,0x2B5B,0x2A5A, +0x2B5A,0x2A5C,0x2B5C,0x2A5D,0x2B5D,0x2A5F,0x2B5F,0x2A5E, +0x2B5E,0x2A61,0x2B61,0x2A60,0x2B60,0x292F,0x294F,0x2A6C, +0x2B6C,0x2A69,0x2B69,0x2A66,0x2B66,0x2A6B,0x2B6B,0x2A68, +0x2B68,0x2A6A,0x2B6A,0x2A71,0x2B71,0x2A74,0x2B74,0x2A73, +0x2A75,0x2B75,0x2A77,0x2B77,0x2A76,0x2B76}; + +/* page 2 0x01CD-0x01DC */ +static uint16 tab_uni_jisx02122[]={ +0x2A26,0x2B26,0x2A43,0x2B43,0x2A55,0x2B55,0x2A67,0x2B67, +0x2A70,0x2B70,0x2A6D,0x2B6D,0x2A6F,0x2B6F,0x2A6E,0x2B6E +}; + +/* page 3 0x01F5-0x01F5 */ +static uint16 tab_uni_jisx02123[]={ +0x2B39}; + +/* page 4 0x02C7-0x02DD */ +static uint16 tab_uni_jisx02124[]={ +0x2230, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x222F,0x2232,0x2236,0x2235, 0,0x2233}; + +/* page 5 0x0384-0x0390 */ +static uint16 tab_uni_jisx02125[]={ +0x2238,0x2239,0x2661, 0,0x2662,0x2663,0x2664, 0, +0x2667, 0,0x2669,0x266C,0x2676}; + +/* page 6 0x03AA-0x03CE */ +static uint16 tab_uni_jisx02126[]={ +0x2665,0x266A,0x2671,0x2672,0x2673,0x2674,0x267B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x2678, 0, 0, 0, 0, 0, 0, 0, +0x2675,0x267A,0x2677,0x2679,0x267C}; + +/* page 7 0x0402-0x040F */ +static uint16 tab_uni_jisx02127[]={ +0x2742,0x2743,0x2744,0x2745,0x2746,0x2747,0x2748,0x2749, +0x274A,0x274B,0x274C, 0,0x274D,0x274E}; + +/* page 8 0x0452-0x045F */ +static uint16 tab_uni_jisx02128[]={ +0x2772,0x2773,0x2774,0x2775,0x2776,0x2777,0x2778,0x2779, +0x277A,0x277B,0x277C, 0,0x277D,0x277E}; + +/* page 9 0x2116-0x2122 */ +static uint16 tab_uni_jisx02129[]={ +0x2271, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x226F}; + +/* page 10 0x4E02-0x4F19 */ +static uint16 tab_uni_jisx021210[]={ +0x3021, 0,0x3022,0x3023, 0, 0, 0, 0, + 0, 0,0x3024, 0, 0, 0, 0, 0, +0x3025, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3026, 0, 0, + 0,0x3027,0x3028, 0, 0, 0,0x3029, 0, + 0,0x302A, 0, 0,0x302B,0x302C,0x302D, 0, + 0, 0, 0,0x302E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x302F,0x3030, + 0, 0,0x3031, 0, 0,0x3032, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3033, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3034, 0,0x3035, 0, 0, 0, 0, 0, + 0,0x3036, 0, 0, 0, 0,0x3037,0x3038, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3039,0x303A, 0, 0, 0,0x303B, + 0, 0, 0, 0, 0,0x303C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x303D, 0, 0, 0, 0, + 0, 0, 0, 0,0x303E,0x303F, 0, 0, + 0, 0, 0,0x3040, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3041, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3042, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3043, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3044, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3045,0x3046, 0, 0, 0, 0,0x3047,0x3048, +0x3049, 0, 0, 0, 0, 0,0x304A, 0, + 0, 0, 0, 0, 0,0x304B, 0,0x304C, + 0,0x304D, 0,0x304E, 0, 0, 0, 0, + 0, 0, 0,0x304F,0x3050,0x3051,0x3052, 0, +0x3053,0x3054, 0, 0, 0, 0,0x3055, 0, + 0,0x3056,0x3057, 0, 0, 0, 0, 0, +0x3058, 0, 0,0x3059,0x305A,0x305B, 0,0x305C +}; + +/* page 11 0x4F2E-0x5166 */ +static uint16 tab_uni_jisx021211[]={ +0x305D, 0, 0,0x305E, 0,0x3060, 0,0x3061, + 0,0x3062, 0,0x3063, 0,0x3064, 0, 0, +0x3065, 0,0x3066, 0,0x3067, 0, 0, 0, + 0, 0,0x3068,0x3069, 0,0x306A,0x306B, 0, + 0, 0, 0, 0,0x306C, 0,0x306D, 0, +0x306E, 0,0x306F, 0, 0, 0, 0, 0, + 0,0x3070,0x305F, 0, 0,0x3071, 0, 0, + 0, 0, 0, 0,0x3072, 0,0x3073, 0, +0x3074, 0, 0,0x3075, 0, 0, 0, 0, + 0,0x3076,0x3077,0x3078,0x3079, 0, 0,0x307A, +0x307B, 0, 0,0x307C,0x307D, 0,0x307E,0x3121, + 0, 0, 0,0x3122,0x3123, 0,0x3124, 0, +0x3125, 0,0x3126, 0,0x3127,0x3128,0x3129, 0, + 0,0x312A, 0,0x312B,0x312C, 0, 0, 0, +0x312D,0x312E, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x312F, 0, 0, 0, + 0,0x3130, 0,0x3131, 0,0x3132,0x3133,0x3134, +0x3135, 0,0x3136,0x3137, 0, 0, 0,0x3138, +0x3139, 0,0x313A,0x313B, 0,0x313C,0x313D,0x313E, + 0,0x313F, 0, 0,0x3140, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3141, 0, + 0, 0,0x3142, 0,0x3143, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3144, 0,0x3145, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3146,0x3147, + 0,0x3148,0x3149,0x314A, 0, 0,0x314B, 0, + 0,0x314C, 0, 0,0x314D, 0,0x314E, 0, +0x314F, 0,0x3150, 0, 0,0x3151, 0, 0, + 0,0x3152,0x3153, 0, 0,0x3154,0x3155,0x3156, +0x3157, 0, 0, 0,0x3158, 0, 0, 0, + 0,0x3159, 0, 0, 0, 0, 0, 0, +0x315A, 0,0x315B, 0,0x315C,0x315D, 0,0x315E, + 0, 0, 0, 0, 0,0x3176, 0, 0, + 0, 0,0x315F,0x3160,0x3161, 0, 0,0x3162, +0x3163, 0, 0, 0,0x3164, 0,0x3165, 0, +0x3166, 0, 0,0x3167,0x3168,0x3169, 0, 0, + 0,0x316A, 0,0x316B, 0, 0, 0, 0, + 0,0x316C,0x316D, 0,0x316E,0x316F, 0, 0, +0x3170,0x3171, 0, 0,0x3172, 0, 0,0x3173, + 0, 0,0x3174,0x3175, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3177, 0,0x3178,0x3179, 0, +0x317A, 0, 0, 0,0x317B, 0, 0, 0, +0x317C,0x317D,0x317E, 0,0x3221,0x3222,0x3223, 0, +0x3224, 0, 0, 0, 0,0x3225,0x3226, 0, +0x3227,0x3228,0x3229,0x322A,0x322B, 0, 0, 0, + 0, 0, 0, 0,0x322C, 0, 0, 0, + 0,0x322D,0x322E, 0, 0, 0, 0, 0, + 0, 0, 0,0x322F,0x3230, 0, 0,0x3231, + 0, 0,0x3232, 0, 0,0x3233,0x3234, 0, + 0,0x3235, 0, 0, 0, 0,0x3236, 0, +0x3237, 0,0x3238, 0, 0,0x3239,0x323A, 0, + 0, 0,0x323B, 0, 0, 0,0x323C,0x323D, + 0,0x323E, 0, 0,0x323F, 0,0x3240, 0, +0x3241, 0,0x3242,0x3243, 0, 0, 0, 0, + 0,0x3244, 0,0x3245,0x3251, 0, 0, 0, +0x3246, 0, 0, 0,0x3247, 0, 0, 0, +0x3248, 0, 0, 0, 0,0x3249, 0, 0, +0x324A,0x324B,0x324C, 0, 0,0x324D,0x324E,0x324F, +0x3250, 0,0x3252, 0, 0, 0, 0, 0, + 0,0x3253, 0,0x3254, 0,0x3255,0x3256,0x3257, +0x3258, 0, 0, 0, 0,0x3259, 0, 0, + 0,0x325A,0x325B, 0, 0, 0,0x325C,0x325D, + 0,0x325E, 0,0x325F, 0,0x3260,0x3261,0x3262, + 0, 0,0x3263,0x3264, 0, 0, 0, 0, + 0, 0, 0, 0,0x3265, 0, 0, 0, + 0, 0, 0, 0,0x3266, 0, 0, 0, + 0,0x3267, 0, 0, 0,0x3268, 0,0x3269, + 0,0x326A,0x326B, 0, 0, 0, 0, 0, + 0,0x326C, 0, 0, 0, 0,0x326D, 0, +0x326E}; + +/* page 12 0x517E-0x5515 */ +static uint16 tab_uni_jisx021212[]={ +0x326F, 0, 0, 0, 0,0x3270,0x3271, 0, + 0, 0, 0, 0, 0,0x3272, 0, 0, +0x3273, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3274, 0, 0, 0, 0,0x3275, + 0, 0, 0,0x3276, 0,0x3277, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3278, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3279, 0,0x327A, 0,0x327B, 0, +0x327C,0x327D, 0, 0,0x327E, 0, 0, 0, + 0, 0,0x3321, 0, 0, 0, 0, 0, + 0,0x3322, 0,0x3323,0x3324,0x3325, 0,0x3326, + 0, 0,0x3327, 0, 0, 0, 0, 0, +0x3328, 0, 0, 0,0x3329, 0, 0,0x332A, + 0, 0, 0, 0, 0, 0, 0, 0, +0x332B, 0, 0, 0,0x332C,0x332D,0x332E, 0, + 0,0x332F, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3330,0x3331, 0, 0,0x3332, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3333,0x3334, 0,0x3335, +0x3336, 0,0x3337, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3338, 0, 0, 0, + 0, 0,0x3339, 0, 0, 0, 0, 0, + 0, 0, 0,0x333A,0x333B, 0, 0,0x333C, + 0, 0, 0, 0, 0, 0,0x333D, 0, + 0, 0, 0, 0, 0, 0, 0,0x333E, + 0, 0, 0,0x333F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3340, + 0,0x3341,0x3342, 0,0x3343, 0,0x3344, 0, + 0,0x3345,0x3346,0x3347, 0, 0, 0, 0, +0x3348, 0, 0, 0, 0, 0, 0, 0, +0x3349, 0, 0, 0, 0, 0, 0, 0, + 0,0x334A,0x334B,0x334C, 0, 0, 0, 0, + 0, 0,0x334D, 0,0x334E, 0, 0,0x334F, + 0, 0, 0, 0,0x3350, 0,0x3351, 0, + 0, 0, 0, 0, 0,0x3352, 0,0x3353, +0x3354,0x3355,0x3356, 0,0x3357, 0,0x3358, 0, + 0, 0, 0, 0, 0, 0,0x3359,0x335A, +0x335B,0x335C, 0, 0, 0, 0, 0, 0, + 0,0x335D,0x335E, 0, 0, 0, 0, 0, +0x335F,0x3360,0x3361, 0,0x3362,0x3363, 0,0x3364, + 0, 0,0x3365, 0, 0, 0,0x3366, 0, +0x3367, 0,0x3368, 0, 0, 0,0x3369, 0, + 0,0x336A, 0,0x336B, 0, 0,0x336C, 0, +0x336D, 0, 0, 0, 0,0x336E,0x336F, 0, + 0, 0, 0,0x3370, 0, 0, 0,0x3371, + 0, 0,0x3372,0x3373,0x3374, 0,0x3375, 0, + 0, 0,0x3376,0x3377, 0, 0,0x3378, 0, +0x3379,0x337A, 0, 0, 0, 0, 0, 0, + 0, 0,0x337B, 0, 0,0x337C, 0, 0, + 0, 0, 0, 0,0x337D,0x337E,0x3421, 0, + 0, 0, 0,0x3422, 0,0x3423, 0, 0, + 0, 0,0x3424, 0, 0,0x3425,0x3426, 0, +0x3427,0x3428, 0, 0, 0, 0, 0,0x3429, + 0,0x342A,0x342B,0x342C, 0,0x342D,0x342E,0x342F, + 0, 0,0x3430, 0,0x3431, 0, 0,0x3432, + 0, 0, 0, 0, 0, 0,0x3433,0x3434, +0x3435, 0, 0, 0,0x3436, 0, 0, 0, + 0, 0, 0, 0, 0,0x3438,0x3437, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3439, 0,0x343A, 0, 0, + 0, 0, 0,0x343B, 0,0x343C, 0,0x343D, + 0, 0, 0, 0, 0, 0,0x343E,0x343F, + 0, 0, 0, 0,0x3440, 0, 0, 0, + 0, 0, 0,0x3441, 0, 0, 0, 0, +0x3442, 0, 0, 0, 0,0x3443, 0, 0, + 0,0x3444,0x3445, 0, 0, 0, 0, 0, +0x3446, 0, 0, 0, 0,0x3447,0x3448, 0, + 0, 0, 0,0x3449, 0, 0, 0,0x344A, + 0, 0, 0,0x344B, 0, 0,0x344C, 0, + 0, 0, 0, 0,0x344D,0x344E, 0, 0, + 0,0x344F, 0, 0,0x3450, 0,0x3451,0x3452, + 0,0x3453,0x3454, 0,0x3455, 0, 0,0x3456, + 0, 0,0x3457, 0, 0, 0, 0,0x3458, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3459, 0, 0,0x345A,0x345B, 0,0x345C, + 0, 0, 0, 0,0x345D, 0, 0,0x345E, +0x345F, 0,0x3460, 0, 0, 0, 0, 0, +0x3461,0x3462, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3463, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3464, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3465, 0, 0, + 0, 0, 0, 0,0x3466, 0, 0, 0, + 0, 0, 0,0x3467, 0, 0, 0, 0, + 0,0x3468,0x3469, 0,0x346A, 0, 0, 0, + 0,0x346B, 0,0x346C, 0, 0,0x346D,0x346E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x346F,0x3470, 0, + 0,0x3471, 0, 0, 0, 0, 0,0x3472, + 0,0x3473, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3474, 0, 0, 0,0x3475, 0,0x3476, 0, +0x3477,0x3478, 0,0x3479, 0,0x347A, 0,0x347B, +0x347C, 0, 0, 0, 0, 0,0x347D, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x347E, 0,0x3521, 0,0x3522, 0,0x3523, + 0, 0,0x3524,0x3525, 0, 0, 0,0x3526, + 0, 0, 0,0x3527, 0, 0, 0,0x3528, +0x3529, 0, 0, 0, 0, 0,0x352A, 0, + 0,0x352B, 0,0x352C, 0, 0, 0, 0, +0x352D,0x352E, 0,0x352F,0x3530, 0, 0,0x3531, +0x3532, 0, 0,0x3533, 0, 0, 0, 0, + 0,0x3534, 0,0x3535,0x3536,0x3537, 0, 0, + 0,0x3538, 0, 0, 0, 0, 0, 0, +0x3539, 0, 0, 0,0x353A, 0, 0,0x353B, +0x353C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x353D, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x353E, 0,0x353F, 0, + 0,0x3540, 0, 0, 0, 0, 0, 0, +0x3541, 0, 0, 0, 0, 0,0x3542, 0, +0x3543,0x3544,0x3545,0x3546, 0, 0, 0,0x3547, + 0, 0,0x3548,0x3549, 0, 0,0x354A,0x354B, +0x354C, 0, 0, 0, 0, 0, 0,0x354D +}; + +/* page 13 0x552A-0x5566 */ +static uint16 tab_uni_jisx021213[]={ +0x354E,0x354F, 0, 0, 0, 0, 0, 0, +0x3550, 0, 0,0x3551,0x3552, 0, 0, 0, + 0,0x3553,0x3554,0x3555, 0, 0, 0,0x3556, + 0, 0, 0, 0, 0,0x3557, 0,0x3558, +0x3559, 0, 0,0x355A, 0, 0,0x355B,0x355C, + 0, 0, 0, 0, 0, 0,0x355D, 0, +0x355E,0x355F, 0, 0,0x3560, 0,0x3561,0x3562, + 0, 0,0x3563, 0,0x3564}; + +/* page 14 0x557F-0x5C36 */ +static uint16 tab_uni_jisx021214[]={ +0x3565, 0,0x3566,0x3567, 0, 0, 0,0x3568, + 0,0x3569, 0, 0, 0, 0, 0,0x356A, +0x356B, 0,0x356C,0x356D,0x356E,0x356F, 0, 0, +0x3570, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3571,0x3572, 0, 0, + 0, 0, 0, 0, 0, 0,0x3573, 0, + 0, 0, 0,0x3574, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3575, 0,0x3576, 0,0x3577, 0, 0,0x3578, + 0, 0,0x3579, 0,0x357A,0x357B, 0,0x357C, + 0, 0,0x357D,0x357E,0x3621, 0, 0, 0, +0x3622,0x3623, 0, 0,0x3624, 0, 0,0x3625, + 0, 0, 0,0x3626, 0, 0, 0, 0, + 0, 0,0x3627, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3628, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3629, 0, 0, 0, 0, 0,0x362A, 0, + 0,0x362B, 0,0x362C, 0, 0,0x362D,0x362E, +0x362F,0x3630,0x3631,0x3632, 0, 0, 0, 0, + 0, 0,0x3633, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3634, 0, 0, + 0,0x3635, 0, 0,0x3636, 0,0x3637, 0, +0x3638, 0,0x3639, 0,0x363A,0x363B,0x363C, 0, +0x363D,0x363E,0x363F, 0,0x3640,0x3641, 0,0x3642, + 0, 0,0x3643, 0,0x3644, 0,0x3645, 0, +0x3646, 0, 0, 0, 0,0x3647, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3648, + 0,0x3649,0x364A,0x364B,0x364C, 0, 0,0x364D, + 0, 0,0x364E, 0, 0, 0,0x364F, 0, +0x3650, 0,0x3651,0x3652, 0, 0,0x3653, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3654,0x3655, 0, + 0,0x3656, 0, 0,0x3657,0x3658, 0, 0, + 0, 0, 0, 0, 0, 0,0x3659, 0, + 0, 0,0x365A,0x365B, 0, 0,0x365C,0x365D, +0x365E, 0, 0, 0, 0, 0, 0,0x365F, +0x3660,0x3661,0x3662, 0,0x3663,0x3664,0x3665, 0, + 0, 0,0x3666, 0,0x3667, 0, 0, 0, +0x3668, 0, 0, 0, 0, 0, 0,0x3669, + 0, 0, 0, 0, 0, 0,0x366A, 0, + 0, 0,0x366B,0x366C,0x366D,0x3670,0x3671, 0, +0x366E,0x366F, 0, 0, 0, 0, 0, 0, + 0, 0,0x3672, 0, 0,0x3673,0x3674, 0, +0x3675, 0,0x3676, 0, 0,0x3677,0x3678,0x3679, +0x367A,0x367B, 0, 0,0x367D, 0,0x367E, 0, + 0, 0,0x367C, 0, 0, 0, 0,0x3721, +0x3722, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3723,0x3724, 0, 0, 0, 0, +0x3725, 0, 0,0x3726, 0,0x3727, 0, 0, + 0, 0,0x3728, 0, 0, 0,0x3729, 0, + 0, 0, 0,0x372A,0x372B, 0,0x372C, 0, + 0,0x372D, 0,0x372E,0x372F,0x3730,0x3731, 0, + 0, 0,0x3732,0x3733, 0,0x3734, 0,0x3735, +0x3736, 0, 0, 0,0x3737,0x3738, 0, 0, + 0, 0, 0, 0, 0, 0,0x3739,0x373A, +0x373B, 0, 0, 0, 0, 0,0x373C,0x373D, + 0, 0, 0, 0, 0,0x373E,0x373F, 0, + 0, 0, 0,0x3740, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3741, 0, 0,0x3742, 0, +0x3743,0x3744, 0, 0,0x3745, 0,0x3746,0x3747, +0x3748,0x3749,0x374A, 0,0x374B,0x374C,0x374D, 0, +0x374E, 0,0x374F,0x3750,0x3751,0x3752, 0,0x3753, + 0, 0,0x3754, 0,0x3755, 0, 0, 0, + 0, 0, 0, 0, 0,0x3756, 0, 0, + 0, 0, 0, 0, 0,0x3757,0x3760, 0, +0x3758, 0,0x3759,0x375A, 0,0x375B,0x375C,0x375D, +0x375E, 0,0x375F, 0, 0, 0, 0, 0, +0x3761,0x3762,0x3763, 0, 0,0x3764, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3765, 0, 0, 0, 0,0x3766, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3767,0x3768, 0, 0, 0,0x3769, 0, 0, +0x376A, 0, 0, 0, 0, 0,0x376B, 0, + 0, 0, 0, 0, 0, 0,0x376C,0x376D, + 0, 0,0x377E, 0, 0,0x376E, 0,0x376F, +0x3770, 0,0x3771, 0, 0, 0,0x3772, 0, + 0,0x3773, 0, 0, 0, 0,0x3774,0x3775, + 0,0x3776, 0, 0, 0, 0,0x3777,0x3778, +0x3779, 0, 0, 0,0x377A,0x377B, 0, 0, + 0,0x377C,0x377D, 0, 0,0x3821,0x3822, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3823, 0, 0,0x3824, +0x3825,0x3826, 0, 0, 0, 0, 0,0x3827, +0x3828, 0, 0, 0, 0, 0,0x3829, 0, + 0, 0, 0,0x382A, 0, 0, 0, 0, + 0, 0,0x382B, 0, 0, 0, 0, 0, +0x382C, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x382D, 0, 0,0x382E,0x382F, 0, +0x3830,0x3831, 0, 0, 0, 0,0x3832, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3833, 0,0x3834, 0, 0,0x3835, 0, 0, +0x3836,0x3837, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3838, 0, 0, 0,0x3839, 0, 0, +0x383A,0x383B,0x383C, 0, 0, 0, 0, 0, +0x383D,0x383E,0x383F,0x3840, 0,0x3841,0x3842, 0, +0x3843,0x3844, 0, 0, 0,0x3845, 0,0x3846, + 0, 0, 0, 0, 0, 0,0x3847, 0, + 0,0x3848,0x3849,0x384A, 0, 0, 0,0x384B, + 0, 0,0x384C, 0, 0, 0, 0, 0, + 0, 0,0x384D,0x384E, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3850, 0, 0, + 0, 0, 0,0x3851, 0,0x384F, 0, 0, + 0,0x3852, 0, 0, 0, 0,0x3853,0x3854, + 0,0x3855, 0,0x3856, 0,0x3857, 0,0x3858, + 0, 0, 0,0x3859, 0, 0,0x385A, 0, + 0, 0,0x385B,0x385C, 0, 0, 0, 0, + 0, 0,0x385D, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x385E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x385F,0x3860, + 0, 0, 0, 0,0x3861,0x3862, 0, 0, + 0, 0, 0,0x3863,0x3864,0x3865, 0, 0, + 0, 0, 0, 0, 0, 0,0x3867, 0, + 0, 0,0x3868, 0,0x3869,0x386A, 0, 0, + 0,0x386B, 0, 0, 0, 0, 0, 0, +0x386C,0x386D, 0, 0,0x386E, 0,0x386F,0x3870, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3871, 0, 0, 0,0x3872, 0, 0,0x3873, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3874,0x3875, 0, 0, 0, + 0, 0,0x3876, 0,0x3877, 0,0x3878,0x3879, +0x387A, 0,0x387B, 0,0x387C, 0, 0, 0, + 0, 0, 0, 0,0x387D, 0,0x387E, 0, +0x3921, 0, 0,0x3922, 0, 0,0x3923,0x3924, + 0, 0,0x3925, 0,0x3926,0x3927, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3928,0x3929, 0,0x392A, + 0, 0, 0,0x392B, 0, 0,0x392C, 0, +0x392D, 0, 0, 0, 0, 0, 0, 0, +0x392E, 0, 0, 0, 0,0x392F, 0, 0, +0x3930, 0, 0, 0, 0, 0,0x3931,0x3932, +0x3933,0x3934, 0, 0,0x3935, 0, 0, 0, +0x3936, 0, 0,0x3937, 0,0x3938, 0, 0, + 0, 0,0x3939, 0,0x393A,0x393B, 0, 0, + 0,0x393C, 0,0x393D, 0, 0,0x393E, 0, + 0, 0, 0,0x393F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3940,0x3941, +0x3942, 0, 0, 0,0x3943,0x3944, 0, 0, +0x3945, 0, 0, 0, 0, 0, 0,0x3946, +0x3947, 0,0x3948,0x3949, 0,0x394A, 0, 0, +0x394B, 0, 0, 0, 0, 0, 0, 0, + 0,0x394C, 0, 0, 0,0x394D, 0, 0, + 0, 0, 0, 0, 0,0x394E,0x394F,0x3950, + 0, 0, 0,0x3951,0x3952, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3953, + 0, 0, 0, 0,0x3954,0x3955, 0, 0, +0x3956,0x3957, 0,0x3958, 0, 0,0x3959, 0, + 0,0x395A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x395B,0x395C, 0, +0x395D,0x395E, 0, 0, 0,0x395F, 0, 0, + 0,0x3960, 0, 0, 0, 0,0x3961, 0, + 0, 0, 0, 0, 0, 0, 0,0x3962, + 0, 0, 0, 0,0x3963, 0,0x3964, 0, +0x3965, 0, 0, 0, 0, 0,0x3966, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3967, 0, 0,0x3968,0x3969, 0, 0,0x396A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x396B, 0, 0, 0, + 0,0x396C, 0, 0,0x396D, 0, 0,0x396E, + 0, 0,0x396F, 0, 0,0x3970, 0,0x3971, +0x3972,0x3973, 0,0x3974, 0, 0, 0, 0, +0x3975, 0, 0, 0, 0,0x3976, 0, 0, + 0, 0,0x3977,0x3978,0x3979, 0,0x397A, 0, + 0,0x397B, 0,0x397C,0x397D, 0, 0, 0, +0x397E, 0, 0, 0, 0,0x3A21, 0,0x3A22, + 0,0x3A23, 0, 0, 0, 0, 0, 0, +0x3A24, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3A25, 0,0x3A26, 0, 0, + 0,0x3A27, 0, 0, 0, 0,0x3A28, 0, + 0, 0, 0,0x3A29, 0, 0, 0,0x3A2A, + 0, 0, 0, 0, 0, 0,0x3A2B,0x3A2C, + 0, 0, 0, 0, 0, 0,0x3A2D, 0, + 0,0x3A2E,0x3A2F, 0, 0, 0, 0, 0, + 0,0x3A30, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3A31, 0,0x3A33, 0,0x3A34, 0,0x3A35, 0, + 0, 0,0x3A36, 0, 0, 0,0x3A37, 0, + 0, 0, 0, 0, 0, 0,0x3A38, 0, + 0, 0, 0, 0, 0,0x3A32, 0, 0, + 0,0x3A39, 0, 0, 0, 0, 0, 0, + 0, 0,0x3A3A, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3A3B,0x3A3C, 0, 0, + 0, 0, 0,0x3A3D, 0, 0, 0,0x3A3E, + 0, 0, 0, 0, 0, 0, 0,0x3A3F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3A40, 0, 0, 0, 0, 0,0x3A41, +0x3A42, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3A43,0x3A44,0x3A45, +0x3A46, 0,0x3A47, 0, 0,0x3A48, 0,0x3A49, + 0, 0, 0,0x3A4A, 0, 0, 0,0x3A4B, + 0,0x3A4C,0x3A4D, 0,0x3A4E,0x3A4F, 0,0x3A50, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3A51,0x3A52, 0, 0,0x3A53,0x3A54, 0, +0x3A55, 0,0x3A56,0x3A57, 0, 0, 0, 0, +0x3A58, 0, 0,0x3A59, 0,0x3A5A, 0, 0, + 0,0x3A5B,0x3A5C, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3A5D, 0, +0x3A5E, 0, 0, 0, 0, 0, 0,0x3A5F, +0x3A60,0x3A61,0x3A62,0x3A63, 0, 0, 0, 0, + 0,0x3A64, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3A65, 0,0x3A66, 0, 0,0x3A67, 0, 0, + 0, 0, 0, 0, 0, 0,0x3A68, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3A69, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3A6A, 0, 0, 0, 0, 0, 0,0x3A6B, +0x3A6C, 0, 0, 0,0x3A6D, 0, 0,0x3A6E, + 0, 0,0x3A6F, 0,0x3A70,0x3A71, 0,0x3A72, + 0,0x3A73, 0,0x3A74, 0, 0,0x3A75,0x3A76 +}; + +/* page 15 0x5C59-0x5EEB */ +static uint16 tab_uni_jisx021215[]={ +0x3A77,0x3A78, 0,0x3A79, 0, 0, 0, 0, + 0,0x3A7A,0x3A7B, 0, 0, 0,0x3A7C,0x3A7D, +0x3A7E, 0, 0, 0,0x3B21, 0, 0,0x3B22, + 0, 0, 0,0x3B23,0x3B24, 0, 0, 0, + 0,0x3B25,0x3B26,0x3B27,0x3B28, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3B29,0x3B2A, + 0,0x3B2B, 0, 0, 0, 0,0x3B2C, 0, + 0,0x3B2D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3B2E, 0,0x3B2F,0x3B30, + 0,0x3B31,0x3B32, 0, 0,0x3B33, 0, 0, + 0,0x3B34, 0, 0, 0, 0, 0, 0, + 0,0x3B35, 0,0x3B36,0x3B37, 0, 0, 0, + 0,0x3B38, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3B39, 0,0x3B3A, 0, 0, 0, 0, 0, + 0,0x3B3B, 0, 0, 0, 0,0x3B3D, 0, + 0, 0, 0, 0,0x3B3C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3B3E, 0, 0, +0x3B3F,0x3B40, 0,0x3B41, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3B42, 0, 0, 0, 0,0x3B43, 0, 0, + 0, 0, 0, 0,0x3B44, 0, 0, 0, + 0,0x3B45, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3B47,0x3B48, 0,0x3B49,0x3B4A, 0, + 0, 0,0x3B46, 0, 0, 0, 0, 0, +0x3B4B, 0, 0,0x3B4C, 0, 0, 0, 0, +0x3B4D, 0, 0, 0,0x3B4E, 0,0x3B4F, 0, + 0,0x3B50,0x3B51, 0, 0,0x3B52, 0,0x3B53, + 0,0x3B57, 0, 0, 0, 0, 0, 0, +0x3B55, 0, 0, 0,0x3B54, 0, 0, 0, +0x3B56, 0, 0, 0, 0, 0,0x3B58,0x3B59, +0x3B5A,0x3B5B, 0,0x3B5C, 0, 0, 0, 0, + 0,0x3B5D, 0, 0,0x3B5E, 0, 0,0x3B5F, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3B60,0x3B61, 0, 0, 0,0x3B62,0x3B63, 0, +0x3B64, 0,0x3B65, 0, 0, 0, 0,0x3B66, + 0,0x3B67, 0, 0, 0, 0, 0, 0, + 0,0x3B68,0x3B69,0x3B6A,0x3B6B, 0, 0, 0, +0x3B6C, 0,0x3B6D, 0, 0, 0,0x3B6E,0x3B6F, + 0, 0, 0, 0, 0, 0,0x3B70, 0, + 0, 0,0x3B71, 0, 0, 0, 0,0x3B72, + 0,0x6674, 0,0x3B73, 0, 0, 0,0x3B74, +0x3B75, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3B76, 0, 0, 0,0x3B77, 0, + 0, 0,0x3B78, 0, 0,0x3B7A, 0,0x3B79, + 0, 0, 0, 0, 0, 0, 0,0x3B7B, +0x3B7C, 0, 0, 0, 0, 0, 0,0x3B7D, + 0, 0, 0,0x3B7E, 0, 0, 0, 0, +0x3C21, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C22, +0x3C23, 0, 0, 0, 0, 0, 0,0x3C24, + 0, 0, 0, 0, 0, 0,0x3C25, 0, + 0, 0, 0, 0,0x3C26, 0, 0, 0, + 0,0x3C27, 0,0x3C28,0x3C29, 0, 0,0x3C2A, + 0, 0, 0, 0, 0, 0,0x3C2B,0x3C2C, + 0, 0, 0, 0, 0, 0, 0,0x3C2E, + 0, 0, 0, 0, 0,0x3C2D, 0, 0, + 0,0x3C2F, 0, 0,0x3C30, 0, 0, 0, + 0, 0, 0, 0, 0,0x3C31, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3C34, 0,0x3C32, 0, 0, 0, 0,0x3C33, +0x3C35, 0, 0, 0, 0,0x3C36, 0,0x3C37, + 0, 0,0x3C38,0x3C39, 0,0x3C3A, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C3B, + 0,0x3C3C,0x3C3D,0x3C3E,0x3C3F,0x3C40, 0,0x3C41, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C42, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3C43, 0, 0,0x3C44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x3C45, 0,0x3C46,0x3C47, 0, 0,0x3C48, + 0,0x3C49, 0,0x3C4A, 0, 0, 0, 0, +0x3C4B, 0,0x3C4C, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3C4D,0x3C4E,0x3C4F, 0, + 0, 0, 0, 0, 0,0x3C50, 0, 0, + 0, 0,0x3C52,0x3C51, 0,0x3C53, 0, 0, +0x3C54,0x3C55, 0,0x3C56,0x3C57, 0, 0, 0, + 0, 0, 0,0x3C58, 0,0x3C59, 0, 0, + 0, 0, 0, 0,0x3C5A, 0, 0, 0, + 0, 0,0x3C5B}; + +/* page 16 0x5F02-0x6149 */ +static uint16 tab_uni_jisx021216[]={ +0x3C5C, 0, 0, 0,0x3C5D,0x3C5E,0x3C5F, 0, + 0, 0, 0, 0,0x3C60, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3C61, + 0, 0,0x3C62,0x3C63, 0, 0, 0,0x3C64, +0x3C65,0x3C66,0x3C67, 0, 0, 0,0x3C68, 0, + 0,0x3C69,0x3C6A, 0,0x3C6B, 0,0x3C6C, 0, + 0, 0,0x3C6D, 0,0x3C6E, 0, 0, 0, + 0,0x3C6F, 0,0x3C70, 0,0x3C71,0x3C72, 0, + 0, 0,0x3C73,0x3C74, 0,0x3C75, 0, 0, + 0, 0, 0,0x3C76, 0, 0,0x3C77, 0, + 0, 0,0x3C78, 0, 0, 0,0x3C79, 0, + 0,0x3C7A, 0, 0, 0, 0,0x3C7B, 0, + 0,0x3C7C,0x3C7D, 0, 0,0x3C7E, 0, 0, + 0, 0, 0, 0, 0,0x3D21, 0, 0, +0x3D22, 0,0x3D23,0x3D24, 0, 0,0x3D25, 0, +0x3D26, 0, 0,0x3D27,0x3D28, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3D29, + 0, 0, 0,0x3D2A, 0,0x3D2B, 0, 0, + 0, 0, 0, 0,0x3D2C, 0, 0, 0, + 0, 0,0x3D2D,0x3D2E, 0, 0, 0, 0, +0x3D2F, 0,0x3D32, 0, 0,0x3D30, 0, 0, + 0,0x3D31,0x3D33, 0, 0,0x3D34,0x3D35,0x3D36, + 0, 0, 0, 0, 0, 0,0x3D37, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3D38, 0, 0,0x3D39,0x3D3A,0x3D3B, + 0,0x3D3C, 0, 0, 0, 0,0x3D3D,0x3D3E, +0x3D3F,0x3D40,0x3D41, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3D42, 0, 0,0x3D43, +0x3D44, 0, 0, 0, 0, 0,0x3D45,0x3D46, +0x3D47, 0,0x3D48,0x3D49,0x3D4A,0x3D4B, 0, 0, +0x3D4C,0x3D4D, 0, 0,0x3D4E, 0, 0, 0, +0x3D4F, 0,0x3D50, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3D51, 0, 0, +0x3D52, 0, 0,0x3D53, 0, 0, 0, 0, + 0,0x3D54,0x3D55, 0, 0,0x3D56,0x3D57, 0, +0x3D58, 0, 0, 0, 0,0x3D59, 0, 0, + 0, 0,0x3D5A, 0, 0, 0, 0, 0, + 0, 0, 0,0x3D5B, 0, 0, 0, 0, + 0,0x3D5C, 0,0x3D5D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3D5E, 0, + 0, 0, 0, 0, 0,0x3D5F,0x3D60,0x3D61, + 0, 0,0x3D62, 0, 0, 0, 0,0x3D63, + 0, 0,0x3D64, 0,0x3D65,0x3D66, 0, 0, + 0, 0, 0,0x3D67, 0, 0, 0,0x3D68, + 0, 0, 0, 0, 0,0x3D69, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3D6A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3D6B,0x3D6C, 0, 0, +0x3D6D, 0, 0, 0,0x3D6E, 0,0x3D6F, 0, +0x3D70, 0, 0, 0,0x3D71, 0, 0,0x3D72, + 0,0x3D73, 0,0x3D74, 0, 0,0x3D75, 0, + 0, 0, 0,0x3D76,0x3D77, 0, 0, 0, +0x3D78, 0,0x3D79,0x3D7A, 0, 0,0x3D7B, 0, + 0, 0, 0, 0, 0, 0,0x3D7C,0x3D7D, + 0, 0, 0, 0, 0,0x3D7E, 0, 0, + 0,0x3E21, 0, 0,0x3E22, 0, 0, 0, +0x3E23, 0,0x3E24, 0, 0, 0,0x3E25,0x3E26, +0x3E27,0x3E28, 0, 0,0x3E29,0x3E2A, 0, 0, + 0, 0,0x3E2B,0x3E2C, 0, 0, 0,0x3E2D, + 0,0x3E2E, 0,0x3E2F,0x3E30, 0, 0, 0, +0x3E31, 0, 0,0x3E32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3E33, 0, 0,0x3E34, 0, 0,0x3E35, 0, + 0, 0,0x3E36,0x3E37, 0, 0, 0, 0, +0x3E38, 0, 0, 0, 0,0x3E39, 0, 0, +0x3E3A, 0,0x3E3B, 0, 0, 0,0x3E3C,0x3E3D, +0x3E3E,0x3E3F,0x3E40, 0,0x3E41,0x3E42, 0,0x3E43, + 0, 0,0x3E44, 0,0x3E45, 0, 0, 0, +0x3E46, 0, 0, 0, 0, 0, 0, 0, +0x3E47,0x3E48, 0, 0, 0, 0,0x3E49,0x3E4A, + 0, 0, 0,0x3E4B,0x3E4C,0x3E4D, 0,0x3E4E, + 0, 0, 0, 0, 0, 0, 0,0x3E4F, + 0, 0, 0,0x3E50,0x3E51, 0, 0,0x3E52 +}; + +/* page 17 0x615E-0x6290 */ +static uint16 tab_uni_jisx021217[]={ +0x3E53, 0,0x3E54, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x3E55, 0, + 0, 0, 0, 0,0x3E56, 0, 0, 0, + 0, 0,0x3E57, 0, 0,0x3E58,0x3E59, 0, + 0,0x3E5A,0x3E5B,0x3E5C, 0,0x3E5D,0x3E5E, 0, + 0, 0, 0, 0, 0,0x3E5F, 0,0x3E60, + 0, 0, 0, 0,0x3E61,0x3E62, 0, 0, + 0,0x3E63,0x3E64, 0, 0, 0,0x3E65,0x3E66, + 0,0x3E67,0x3E68, 0, 0, 0, 0,0x3E69, + 0, 0,0x3E6A, 0,0x3E6B, 0, 0,0x3E6C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x3E6D,0x3E6E, 0, 0,0x3E6F, 0, + 0, 0,0x3E70,0x3E71,0x3E72, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3E73,0x3E74, 0, 0, 0, 0, 0,0x3E75, + 0, 0, 0, 0, 0, 0,0x3E76,0x3E77, +0x3E78,0x3E79, 0,0x3E7A,0x3E7B, 0, 0,0x3E7E, + 0,0x3E7C, 0,0x3E7D, 0, 0,0x3F21,0x3F22, + 0,0x3F23, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F24, 0,0x3F25,0x3F26, 0, + 0,0x3F27, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3F28, 0,0x3F29, + 0, 0, 0, 0, 0, 0,0x3F2A, 0, + 0, 0,0x3F2B, 0,0x3F2C,0x3F2D, 0, 0, + 0,0x3F2E, 0,0x3F2F, 0,0x3F30, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F31, 0, 0, 0,0x3F32, + 0, 0, 0, 0,0x3F33,0x3F34,0x3F35, 0, +0x3F36, 0, 0, 0, 0, 0,0x3F37, 0, + 0, 0,0x3F38,0x3F39,0x3F3A, 0,0x3F3B, 0, +0x3F3C, 0, 0, 0,0x3F3D, 0,0x3F3E, 0, + 0, 0, 0, 0, 0, 0,0x3F3F, 0, + 0, 0, 0, 0, 0, 0, 0,0x3F40, + 0,0x3F41, 0, 0, 0,0x3F42, 0, 0, + 0, 0, 0, 0,0x3F43, 0, 0,0x3F44, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3F45, +0x3F46,0x3F47,0x3F48}; + +/* page 18 0x62A6-0x679B */ +static uint16 tab_uni_jisx021218[]={ +0x3F49, 0,0x3F4A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x3F4B, 0, 0, +0x3F4C,0x3F4D, 0, 0,0x3F4E, 0, 0, 0, +0x3F4F,0x3F50, 0, 0, 0, 0,0x3F51, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x3F52, 0, 0, 0, 0, 0, 0,0x3F53, +0x3F54, 0, 0, 0,0x3F55, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x3F56, 0, 0, 0, + 0, 0, 0, 0,0x3F57, 0,0x3F58, 0, + 0, 0, 0, 0, 0, 0,0x3F59,0x3F5A, + 0, 0, 0, 0, 0,0x3F5B,0x3F5C, 0, + 0, 0, 0, 0,0x3F5D,0x3F5E, 0,0x3F5F, + 0, 0,0x3F60, 0, 0,0x3F61, 0, 0, +0x3F62, 0,0x3F63, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x3F64,0x3F65, 0, 0,0x3F66, + 0, 0, 0, 0, 0, 0, 0,0x3F67, +0x3F68, 0, 0,0x3F69, 0, 0,0x3F6A, 0, + 0, 0, 0,0x3F6B,0x3F6C,0x3F6D,0x3F6E, 0, +0x3F6F, 0, 0, 0,0x3F70,0x3F71, 0, 0, +0x3F72, 0, 0, 0,0x3F73,0x3F74,0x3F75, 0, + 0, 0,0x3F76, 0, 0,0x3F77, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x3F78, +0x3F79, 0, 0, 0, 0, 0,0x3F7A,0x3F7B, + 0, 0, 0,0x3F7C, 0, 0,0x3F7D,0x3F7E, + 0, 0,0x4021, 0, 0, 0,0x4022,0x4023, + 0,0x4024, 0, 0,0x4025, 0,0x4026, 0, + 0,0x4027, 0, 0,0x4028, 0, 0, 0, + 0, 0,0x4029, 0, 0, 0,0x402A,0x402B, + 0, 0, 0,0x402C,0x402D, 0, 0, 0, +0x402E, 0, 0, 0, 0, 0,0x402F, 0, +0x4030, 0, 0, 0, 0, 0, 0,0x4031, +0x4032,0x4033, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4034, + 0, 0, 0,0x4035, 0, 0, 0,0x4036, + 0, 0,0x4037, 0, 0, 0, 0, 0, +0x4038, 0, 0,0x4039, 0,0x403A,0x403B,0x403C, + 0, 0, 0, 0, 0, 0,0x403D, 0, + 0, 0,0x403E, 0, 0, 0, 0,0x403F, + 0, 0, 0, 0,0x4040, 0,0x4041, 0, + 0, 0, 0, 0,0x4042,0x4043, 0,0x4044, + 0, 0,0x4045,0x4046, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4047,0x4048, 0, 0, 0, + 0, 0,0x4049, 0,0x404A, 0,0x404B, 0, + 0, 0,0x404C, 0, 0, 0, 0, 0, +0x404D, 0,0x404E, 0,0x404F, 0,0x4050,0x4051, + 0, 0, 0,0x4052,0x4053, 0, 0, 0, + 0,0x4054,0x4055, 0, 0, 0, 0,0x4056, + 0, 0, 0, 0, 0, 0, 0,0x4057, + 0,0x4058, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4059, 0, 0, + 0,0x405A, 0,0x405B,0x405C,0x405D,0x405E, 0, + 0, 0, 0, 0,0x405F,0x4060,0x4061,0x4062, + 0,0x4063,0x4064,0x4065, 0,0x4066, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4067, + 0, 0, 0, 0, 0,0x4068,0x4069, 0, + 0, 0, 0, 0, 0,0x406A, 0,0x406B, + 0, 0, 0, 0, 0, 0, 0,0x406C, + 0,0x406D, 0, 0, 0, 0, 0, 0, + 0,0x406E,0x406F,0x4070, 0, 0, 0, 0, + 0, 0,0x4071,0x4072, 0,0x4073, 0,0x4074, + 0,0x4075, 0,0x4076, 0,0x4077, 0, 0, +0x4078, 0,0x4079, 0, 0, 0,0x407A, 0, + 0, 0, 0, 0, 0,0x407B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x407C, +0x407D,0x407E, 0, 0, 0, 0,0x4121, 0, + 0, 0, 0,0x4122,0x4123,0x4124,0x4125, 0, +0x4126, 0,0x4127,0x4128, 0, 0, 0,0x4129, + 0,0x412A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x412B,0x412C, + 0, 0, 0,0x412D,0x412E, 0, 0,0x412F, + 0, 0,0x4130, 0, 0, 0, 0,0x4131, + 0,0x4132, 0, 0, 0,0x4133, 0, 0, + 0,0x4134, 0,0x4135, 0, 0,0x4136, 0, + 0, 0,0x4137,0x4138,0x4139, 0, 0, 0, + 0,0x413A, 0, 0, 0,0x413B,0x413C, 0, +0x413D, 0, 0,0x413E, 0,0x413F, 0, 0, +0x4140,0x4141, 0, 0,0x4142, 0, 0, 0, +0x4143, 0, 0,0x4144, 0, 0, 0, 0, +0x4145, 0, 0,0x4146, 0, 0, 0, 0, + 0, 0, 0, 0,0x4147, 0,0x4148,0x4149, + 0, 0, 0, 0, 0,0x414A, 0, 0, + 0,0x414B, 0,0x414C, 0, 0, 0, 0, + 0, 0,0x414D, 0,0x414E, 0,0x414F, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4150,0x4151, 0, 0, 0, 0, 0, + 0,0x4152, 0, 0, 0,0x4153, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4154, 0, 0,0x4155, + 0, 0, 0,0x4156, 0, 0, 0,0x4157, + 0, 0, 0, 0,0x4158, 0, 0, 0, + 0, 0, 0, 0,0x4159, 0, 0,0x415A, + 0, 0,0x415B, 0, 0, 0, 0,0x415C, + 0, 0,0x415D, 0, 0,0x415E, 0, 0, +0x415F, 0, 0, 0, 0, 0, 0, 0, +0x4160, 0, 0, 0,0x4161,0x4162,0x4163, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4164, 0, 0,0x4165, 0, 0, 0, + 0, 0,0x4166,0x4167, 0, 0, 0, 0, +0x4168, 0,0x4169, 0, 0, 0,0x416A, 0, +0x416B, 0,0x416C, 0, 0, 0, 0, 0, + 0,0x416D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x416E, 0,0x416F, 0,0x4170,0x4171, + 0, 0, 0,0x4172, 0, 0, 0, 0, +0x4173,0x4174,0x4175, 0, 0, 0,0x4176, 0, + 0, 0,0x4177,0x4178, 0, 0, 0,0x4179, + 0, 0, 0,0x417A,0x417B, 0, 0,0x417C, +0x417D, 0, 0, 0, 0, 0, 0,0x417E, +0x4221, 0, 0,0x4222,0x4223,0x4224,0x4225, 0, +0x4226, 0, 0,0x4227,0x4228,0x4229,0x422A, 0, +0x422B, 0,0x422C,0x422D, 0,0x422E, 0, 0, + 0,0x4230, 0,0x422F, 0, 0, 0, 0, + 0, 0,0x4231, 0, 0, 0, 0,0x4232, +0x4233, 0, 0, 0,0x4234, 0,0x4235, 0, +0x4237, 0, 0,0x4236, 0, 0, 0, 0, + 0,0x4238,0x4239,0x423A, 0,0x423B,0x423C, 0, + 0, 0,0x423D,0x423E, 0, 0, 0, 0, + 0, 0, 0, 0,0x4240,0x4241,0x4242, 0, + 0, 0, 0, 0, 0,0x4244, 0,0x4245, + 0,0x4247,0x4248,0x4249, 0,0x424A,0x424C, 0, +0x4243,0x4246,0x424B, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x424D,0x424E,0x424F, + 0, 0,0x4250, 0,0x4251, 0, 0, 0, + 0, 0, 0,0x4252,0x4253,0x4254,0x4255, 0, + 0,0x4256,0x4257, 0, 0, 0,0x4258, 0, + 0, 0, 0, 0, 0, 0, 0,0x4259, + 0, 0, 0,0x425A,0x425B, 0, 0,0x425C, + 0, 0, 0, 0, 0,0x425D, 0, 0, + 0,0x425E,0x425F, 0,0x4260,0x4261, 0, 0, + 0, 0,0x4262, 0, 0, 0,0x4263, 0, +0x4264,0x4265, 0, 0, 0, 0,0x4266, 0, + 0, 0, 0, 0, 0,0x4267, 0, 0, + 0,0x4268, 0, 0, 0, 0, 0, 0, + 0, 0,0x4269, 0, 0,0x426A,0x426B, 0, +0x426C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x426D,0x423F, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x426E, + 0,0x426F, 0, 0, 0, 0, 0, 0, +0x4270, 0, 0, 0, 0,0x4271, 0, 0, + 0, 0, 0,0x4272, 0, 0,0x4273, 0, + 0, 0,0x4274, 0,0x4275, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4276, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4277, 0, 0, 0, 0, 0, 0,0x4278, + 0,0x4279,0x427A, 0, 0, 0,0x427B, 0, + 0, 0, 0, 0, 0, 0,0x427C,0x427D, + 0, 0, 0, 0, 0, 0, 0,0x427E, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4321, 0, 0, 0, 0, 0,0x4322, 0, +0x4323, 0, 0, 0, 0, 0,0x4324, 0, +0x4325, 0, 0, 0, 0,0x4326, 0, 0, + 0, 0, 0,0x4327, 0, 0,0x4328, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4329,0x432A, 0,0x432B, 0,0x432C, 0, 0, +0x432D, 0,0x432E,0x432F, 0,0x4330}; + +/* page 19 0x67B0-0x67F9 */ +static uint16 tab_uni_jisx021219[]={ +0x4331,0x4332,0x4333, 0, 0,0x4334, 0, 0, + 0, 0, 0,0x4335,0x4336,0x4337, 0, 0, +0x4339, 0,0x433A,0x433B, 0,0x433C, 0, 0, +0x433D,0x433E, 0, 0, 0, 0, 0, 0, + 0, 0,0x433F, 0, 0, 0, 0,0x4340, + 0,0x4341, 0, 0,0x4342, 0, 0, 0, + 0,0x4343, 0, 0, 0, 0,0x4344, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4345, 0,0x4346, 0, 0, 0,0x4347,0x4348, + 0,0x4338}; + +/* page 20 0x6814-0x6917 */ +static uint16 tab_uni_jisx021220[]={ +0x434A, 0, 0, 0, 0,0x434B, 0, 0, + 0,0x434C, 0,0x434D, 0, 0, 0, 0, + 0, 0, 0,0x434F,0x434E, 0, 0, 0, +0x4350,0x4351, 0,0x4352,0x4353,0x4354, 0,0x4355, + 0, 0, 0, 0, 0, 0, 0,0x4356, + 0, 0, 0,0x4357, 0, 0, 0, 0, +0x4358,0x4359, 0, 0, 0, 0,0x435A, 0, +0x435B, 0, 0, 0, 0, 0,0x4349, 0, + 0,0x435C, 0,0x435D,0x435E, 0, 0,0x435F, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4360, + 0, 0,0x4361,0x4362,0x4363,0x4364,0x4365, 0, + 0,0x4366, 0, 0, 0,0x4367,0x4368,0x4369, +0x436A, 0, 0, 0, 0, 0,0x436B, 0, +0x436C, 0,0x436D, 0,0x436E, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x436F, 0,0x4370, 0,0x4371, 0, +0x4372, 0, 0, 0, 0,0x4373, 0,0x4374, + 0,0x4375, 0, 0, 0,0x4376,0x4377, 0, + 0, 0,0x4378, 0, 0, 0,0x4379, 0, + 0, 0, 0, 0, 0, 0, 0,0x437A, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x437B, 0, 0,0x437C, 0, 0, 0, +0x437D, 0, 0,0x437E,0x4421,0x4422, 0,0x4423, + 0, 0,0x4424, 0, 0,0x4425, 0, 0, +0x4426,0x4427, 0, 0, 0, 0, 0, 0, + 0,0x4428, 0, 0,0x4429, 0,0x442A,0x442B, +0x442C,0x442D, 0, 0,0x442E,0x442F, 0, 0, + 0,0x4430,0x4431, 0, 0, 0, 0,0x4432, +0x4433,0x4434, 0, 0, 0, 0, 0, 0, + 0, 0,0x4435, 0, 0,0x4436,0x4437, 0, + 0, 0, 0, 0,0x4438,0x4439, 0,0x443A, + 0, 0,0x443B,0x443C}; + +/* page 21 0x6931-0x6D3F */ +static uint16 tab_uni_jisx021221[]={ +0x443D, 0,0x443E, 0,0x443F, 0, 0,0x4440, + 0, 0,0x4441, 0, 0, 0, 0, 0, + 0,0x4442, 0, 0,0x4443, 0, 0, 0, +0x4444, 0, 0, 0, 0,0x4445, 0, 0, + 0, 0, 0, 0, 0, 0,0x4446, 0, + 0, 0,0x4447, 0, 0, 0, 0, 0, + 0, 0,0x4448,0x4449,0x444A,0x444B, 0,0x444C, +0x444D, 0, 0,0x444E, 0, 0, 0,0x444F, +0x4450,0x4451, 0, 0, 0, 0, 0, 0, + 0,0x4452,0x4453, 0, 0, 0,0x4454,0x4455, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4456, 0, 0, 0, + 0,0x4457, 0, 0, 0,0x4458, 0,0x4459, + 0, 0, 0, 0, 0, 0, 0, 0, +0x445A, 0, 0, 0,0x445B,0x445C, 0,0x445D, + 0, 0,0x445E, 0,0x445F, 0,0x4460, 0, + 0, 0, 0, 0, 0, 0,0x4461,0x4462, + 0,0x4463, 0,0x4464, 0, 0, 0, 0, + 0, 0, 0, 0,0x4465, 0, 0,0x4466, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4467, 0, 0, 0, 0,0x4468,0x4469, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x446A, 0, 0,0x446B, 0, 0, 0, + 0, 0, 0, 0, 0,0x446C,0x446D, 0, +0x446E, 0,0x446F, 0,0x4470, 0, 0, 0, + 0, 0, 0, 0, 0,0x4471, 0,0x4472, +0x4473, 0,0x4474, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4475, 0, +0x4476, 0, 0, 0,0x4477, 0, 0, 0, + 0,0x4478, 0, 0,0x4479, 0, 0,0x447A, + 0, 0, 0,0x447B, 0, 0, 0,0x447C, + 0, 0, 0, 0, 0, 0, 0,0x447D, + 0,0x447E, 0,0x4521, 0, 0,0x4522, 0, + 0, 0,0x4523, 0, 0,0x4524,0x4525, 0, + 0, 0, 0, 0,0x4526,0x4527, 0, 0, +0x4528,0x4529, 0, 0, 0,0x452A, 0,0x452B, +0x452C,0x452D, 0, 0,0x452E,0x452F, 0, 0, + 0, 0,0x4530, 0, 0, 0, 0, 0, + 0, 0, 0,0x4531, 0, 0,0x4532, 0, + 0,0x4533, 0, 0, 0, 0, 0, 0, +0x4534, 0,0x4535, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4536, 0, 0, +0x4537, 0,0x4538, 0, 0,0x4539,0x453A, 0, +0x453B, 0,0x453C, 0, 0, 0, 0, 0, +0x453D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x453E, 0,0x453F,0x4540,0x4541, 0, + 0, 0, 0, 0,0x4542, 0, 0, 0, + 0, 0,0x4543, 0, 0, 0,0x4544,0x4545, +0x4546, 0, 0,0x4547, 0, 0, 0, 0, + 0, 0, 0, 0,0x4548,0x4549,0x454A, 0, + 0, 0, 0, 0, 0,0x454B, 0,0x454D, +0x454C, 0, 0,0x454E, 0, 0, 0,0x454F, + 0, 0, 0,0x4550,0x4551,0x4552, 0, 0, + 0, 0, 0,0x4553,0x4554, 0, 0, 0, + 0, 0, 0,0x4555, 0, 0,0x4556, 0, + 0, 0, 0,0x4557, 0, 0, 0,0x4558, +0x4559,0x455A, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x455B,0x455C, 0, 0, 0, + 0,0x455D,0x455E, 0, 0,0x455F,0x4560, 0, +0x4561, 0, 0, 0, 0, 0,0x4562,0x4563, +0x4564, 0, 0, 0, 0, 0,0x4565, 0, + 0, 0,0x4566, 0, 0,0x4567, 0, 0, + 0, 0, 0,0x4568, 0, 0, 0,0x4569, + 0, 0,0x456A,0x456B, 0, 0,0x456C, 0, + 0, 0, 0, 0,0x456D,0x456E, 0, 0, + 0, 0,0x456F, 0, 0, 0,0x4570, 0, + 0, 0, 0, 0, 0,0x4571, 0, 0, + 0,0x4572, 0, 0,0x4573, 0, 0, 0, + 0,0x4574, 0, 0, 0,0x4575, 0,0x4576, + 0, 0, 0, 0,0x4577, 0, 0,0x4578, + 0, 0, 0, 0, 0, 0,0x4579, 0, + 0, 0,0x457A, 0, 0,0x457B, 0,0x457C, + 0, 0, 0, 0,0x457D, 0, 0, 0, + 0, 0, 0, 0,0x457E,0x4621, 0, 0, + 0,0x4622, 0, 0,0x4623, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4624, 0, + 0, 0,0x4625, 0, 0, 0,0x4626,0x4627, + 0,0x4628,0x4629, 0, 0, 0, 0,0x462A, +0x462B, 0, 0,0x462C,0x462D,0x462E, 0,0x462F, + 0, 0, 0, 0, 0, 0, 0,0x4630, +0x4631, 0, 0, 0,0x4632,0x4633, 0, 0, + 0, 0,0x4634,0x4635, 0, 0, 0, 0, +0x4636, 0, 0,0x4637, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4638, 0, 0, + 0,0x4639, 0, 0, 0, 0, 0, 0, +0x463A, 0,0x463B, 0, 0,0x463C,0x463D, 0, + 0, 0, 0, 0, 0,0x463E, 0, 0, +0x463F, 0, 0, 0, 0, 0,0x4640, 0, +0x4641, 0, 0, 0, 0, 0,0x4642, 0, + 0,0x4643, 0,0x4644,0x4645, 0, 0, 0, +0x4646, 0, 0, 0,0x4647,0x4648, 0,0x4649, + 0,0x464A, 0, 0, 0, 0, 0, 0, +0x464B, 0, 0, 0, 0, 0,0x464C, 0, + 0, 0, 0, 0, 0,0x464D,0x464E,0x464F, + 0, 0, 0,0x4650, 0,0x4651, 0, 0, + 0, 0,0x4652, 0,0x4653,0x4654, 0, 0, + 0,0x4655,0x4656, 0, 0, 0,0x4657, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4658,0x4659, 0,0x465A, 0,0x465B, 0, + 0,0x465C, 0,0x465D, 0, 0, 0, 0, +0x465E, 0,0x465F,0x4660, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4736, 0, + 0, 0,0x4661, 0,0x4662, 0,0x4663, 0, + 0, 0, 0,0x4664, 0,0x4665, 0,0x4666, +0x4667, 0,0x4668, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4669,0x466A,0x466B, 0, +0x466C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x466D,0x466E, 0,0x466F,0x4670, + 0, 0, 0,0x4671, 0, 0,0x4672, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4673, + 0,0x4674, 0,0x4675, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4676, 0, 0, 0,0x4677, 0, 0, + 0, 0, 0, 0,0x4678, 0,0x4679,0x467A, +0x467B,0x467C, 0,0x467D, 0,0x467E, 0, 0, + 0,0x4721, 0,0x4722, 0, 0, 0,0x4723, + 0, 0, 0, 0, 0, 0,0x4724, 0, +0x4725, 0,0x4726,0x4727, 0,0x4728, 0, 0, + 0,0x4729, 0,0x472A, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x472B, 0, 0,0x472C, 0, + 0,0x472D, 0, 0, 0,0x472E,0x472F, 0, +0x4730, 0,0x4731, 0, 0, 0, 0, 0, + 0,0x4732, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4733,0x4734,0x4735, + 0, 0, 0, 0, 0,0x4737,0x4738, 0, +0x4739, 0, 0, 0, 0, 0, 0, 0, +0x473A, 0, 0,0x473B, 0, 0,0x473C}; + +/* page 22 0x6D57-0x6E04 */ +static uint16 tab_uni_jisx021222[]={ +0x473D, 0, 0, 0, 0, 0, 0,0x473E, +0x473F, 0,0x4740, 0, 0, 0,0x4741, 0, +0x4742, 0, 0, 0, 0, 0, 0, 0, +0x4743,0x4744, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4745, 0, 0, + 0, 0, 0,0x4746, 0, 0, 0, 0, +0x4747, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4748,0x4749, 0,0x474A, 0,0x474B, +0x474C,0x474D, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x474E, 0,0x474F, 0, 0, + 0, 0, 0, 0, 0,0x4750, 0, 0, +0x4751, 0,0x4752, 0, 0, 0,0x4753, 0, +0x4754, 0, 0, 0, 0,0x4755, 0, 0, + 0,0x4756, 0,0x4757, 0, 0, 0,0x4758, +0x4759, 0, 0, 0, 0, 0, 0,0x475A, + 0, 0, 0, 0,0x475B, 0,0x475C, 0, +0x475D,0x475E, 0,0x475F, 0, 0,0x4760, 0, + 0, 0,0x4761, 0, 0, 0, 0, 0, +0x4762,0x4763, 0, 0, 0,0x4764, 0,0x4765, + 0, 0, 0, 0, 0,0x4766, 0, 0, + 0,0x4767, 0, 0, 0,0x4768}; + +/* page 23 0x6E1E-0x6ECF */ +static uint16 tab_uni_jisx021223[]={ +0x4769, 0, 0, 0,0x476A, 0, 0, 0, + 0,0x476B, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x476C, 0, 0, 0, +0x476D, 0, 0,0x476E, 0,0x476F,0x4770, 0, + 0, 0, 0, 0, 0, 0,0x4771,0x4772, + 0, 0,0x4773,0x4774, 0,0x4775, 0, 0, + 0,0x4776, 0,0x4777,0x4778,0x4779,0x477A, 0, + 0,0x477B, 0, 0, 0, 0,0x477C,0x477D, +0x477E, 0, 0, 0,0x4821,0x4822, 0, 0, + 0, 0,0x4823, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4824, 0, 0, + 0, 0, 0, 0, 0,0x4825, 0,0x4826, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4827, + 0, 0, 0, 0, 0,0x4828, 0, 0, + 0, 0, 0,0x4829, 0, 0, 0, 0, + 0, 0,0x482A, 0, 0, 0, 0, 0, + 0,0x482B, 0, 0, 0, 0, 0,0x482C, +0x482D, 0, 0,0x482E, 0,0x482F, 0, 0, + 0, 0, 0, 0, 0,0x4830, 0, 0, + 0,0x4831,0x4832,0x4833, 0,0x4834, 0, 0, + 0,0x4835,0x4836, 0,0x4837, 0, 0,0x4838, +0x4839,0x483A}; + +/* page 24 0x6EEB-0x70E4 */ +static uint16 tab_uni_jisx021224[]={ +0x483B, 0,0x483C,0x483D, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x483E, 0, +0x483F, 0,0x4840, 0, 0, 0, 0, 0, + 0,0x4841, 0, 0, 0,0x4842, 0,0x4843, + 0,0x4844,0x4845, 0, 0, 0, 0, 0, + 0, 0, 0,0x4846, 0,0x4847, 0,0x4848, +0x4849, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x484A, 0, 0,0x484B,0x484C, + 0, 0,0x4853, 0,0x484D,0x484E, 0, 0, +0x484F, 0, 0,0x4850, 0, 0, 0, 0, +0x4851,0x4852, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4854, 0,0x4855,0x4856, +0x4857, 0, 0, 0,0x4858, 0,0x4859,0x485A, + 0, 0,0x485B,0x485C, 0, 0,0x485D,0x485E, + 0, 0, 0, 0, 0,0x485F, 0, 0, + 0,0x4860, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4861,0x4862, 0, 0, 0, 0, +0x4863, 0, 0, 0,0x4864,0x4865, 0, 0, +0x4866,0x4867,0x4868, 0, 0,0x4869, 0,0x486A, +0x486B,0x486C, 0,0x486D, 0, 0, 0,0x486E, + 0, 0, 0, 0,0x486F,0x4870, 0, 0, + 0, 0,0x4871,0x4872,0x4873,0x4874, 0, 0, + 0, 0, 0,0x4875,0x4876,0x4877, 0, 0, + 0, 0,0x4878,0x4879, 0, 0, 0, 0, + 0,0x487A, 0, 0, 0, 0, 0, 0, + 0, 0,0x487B, 0,0x487C,0x487D, 0,0x487E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4921, + 0, 0, 0,0x4922, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4923,0x4924, 0, + 0, 0, 0, 0, 0,0x4925, 0, 0, + 0, 0,0x4926, 0, 0, 0,0x4927, 0, + 0,0x4928,0x4929, 0, 0,0x492A, 0, 0, + 0, 0,0x492B,0x492C,0x492D, 0, 0, 0, + 0, 0,0x492E, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x492F, 0, 0, 0, + 0, 0, 0, 0, 0,0x4930, 0, 0, +0x4931, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4932, 0, 0, 0, + 0,0x4933, 0, 0,0x4934, 0,0x4935, 0, + 0,0x4936, 0, 0, 0, 0, 0, 0, +0x4937,0x4938, 0, 0, 0,0x4939,0x493A,0x493B, +0x493C, 0, 0,0x4941, 0, 0, 0, 0, + 0,0x493D,0x493E, 0, 0, 0, 0, 0, + 0, 0,0x493F,0x4940, 0, 0, 0, 0, + 0,0x4942,0x4943, 0, 0, 0, 0, 0, + 0,0x4944, 0,0x4945, 0, 0, 0, 0, + 0, 0,0x4946,0x4947, 0, 0, 0, 0, + 0, 0, 0,0x4948, 0, 0,0x4949, 0, + 0, 0,0x494A,0x494B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x494C,0x494D,0x494E,0x494F,0x4950, 0, 0, +0x4951, 0, 0, 0, 0, 0, 0, 0, + 0,0x4952, 0, 0, 0, 0, 0, 0, +0x4953, 0, 0, 0, 0,0x4954,0x4955, 0, + 0,0x4956, 0, 0,0x4957, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4958, + 0, 0, 0, 0, 0, 0,0x4959, 0, +0x495A,0x495B,0x495C,0x495D, 0,0x495E, 0, 0, + 0,0x495F, 0, 0, 0, 0, 0, 0, + 0,0x4960}; + +/* page 25 0x70FA-0x71DC */ +static uint16 tab_uni_jisx021225[]={ +0x4961, 0, 0, 0, 0, 0, 0, 0, + 0,0x4962,0x4963,0x4964,0x4965,0x4966, 0, 0, + 0,0x4967,0x4968, 0, 0,0x4969, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x496A, 0,0x496B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x496C, 0,0x496D, 0,0x496E,0x496F,0x4970, + 0, 0, 0, 0, 0, 0,0x4971, 0, + 0, 0, 0, 0, 0, 0, 0,0x4972, + 0, 0, 0,0x4973,0x4974,0x4975, 0, 0, +0x4976,0x4977, 0, 0, 0, 0,0x4978, 0, +0x4979, 0, 0, 0, 0,0x497A, 0, 0, +0x497B, 0,0x497C, 0,0x497D, 0,0x497E, 0, + 0, 0, 0, 0, 0, 0,0x4A21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4A22, + 0, 0, 0, 0, 0, 0,0x4A23, 0, + 0, 0, 0,0x4A24, 0,0x4A25, 0, 0, + 0, 0,0x4A26, 0, 0, 0, 0, 0, +0x4A27, 0, 0, 0, 0, 0, 0, 0, +0x4A28,0x4A29, 0, 0, 0, 0,0x4A2A, 0, +0x4A2B, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4A2C,0x4A2D, 0, +0x4A2E,0x4A2F, 0, 0, 0, 0, 0, 0, +0x4A30, 0, 0, 0, 0,0x4A31,0x4A32,0x4A33, + 0, 0,0x4A34, 0, 0, 0, 0, 0, + 0,0x4A35,0x4A36, 0, 0, 0, 0, 0, + 0,0x4A37, 0, 0,0x4A38, 0, 0,0x4A39, +0x4A3A, 0,0x4A3B}; + +/* page 26 0x71F8-0x7E9E */ +static uint16 tab_uni_jisx021226[]={ +0x4A3C, 0, 0, 0, 0, 0,0x4A3D, 0, +0x4A3E, 0, 0, 0, 0, 0, 0,0x4A3F, +0x4A40,0x4A41, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4A42, 0, 0, 0,0x4A43, + 0, 0,0x4A44, 0, 0,0x4A45, 0,0x4A46, + 0, 0, 0, 0,0x4A47, 0, 0, 0, + 0, 0, 0,0x4A48, 0, 0, 0,0x4A49, + 0, 0, 0, 0,0x4A4A, 0, 0, 0, +0x4A4B,0x4A4C, 0, 0, 0, 0, 0, 0, + 0,0x4A4D,0x4A4E,0x4A4F, 0,0x4A50, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A51,0x4A52, +0x4A53, 0, 0,0x4A54, 0,0x4A55,0x4A56, 0, + 0, 0,0x4A57, 0,0x4A58, 0,0x4A59, 0, +0x4A5A, 0, 0,0x4A5B, 0, 0, 0, 0, +0x4A5C, 0, 0,0x4A5D, 0, 0,0x4A5E,0x4A5F, + 0,0x4A60, 0, 0, 0, 0, 0,0x4A61, +0x4A62, 0, 0,0x4A63,0x4A64, 0, 0,0x4A65, + 0, 0, 0, 0,0x4A66, 0, 0, 0, + 0,0x4A67, 0, 0, 0,0x4A68,0x4A69, 0, + 0, 0, 0,0x4A6A, 0, 0, 0, 0, + 0, 0, 0,0x4A6B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4A6C, 0, 0, 0, 0,0x4A6D,0x4A6E, 0, + 0,0x4A6F, 0, 0,0x4A70, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x4A71, 0, + 0,0x4A72, 0, 0, 0, 0, 0,0x4A73, + 0,0x4A74, 0, 0,0x4A75, 0, 0, 0, + 0, 0, 0, 0, 0,0x4A76,0x4A77, 0, +0x4A78, 0, 0, 0, 0, 0, 0,0x4A79, + 0, 0, 0, 0, 0,0x4A7A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4A7B,0x4A7C, 0, 0, 0, + 0, 0,0x4A7D,0x4A7E, 0, 0,0x4B21, 0, + 0, 0,0x4B22, 0,0x4B23,0x4B24, 0,0x4B25, + 0, 0, 0,0x4B26, 0,0x4B27, 0, 0, + 0, 0,0x4B28,0x4B29, 0, 0, 0, 0, +0x4B2A,0x4B2B, 0, 0, 0, 0,0x4B2C, 0, + 0, 0,0x4B2D, 0,0x4B2E, 0, 0,0x4B2F, +0x4B30, 0, 0, 0,0x4B31, 0, 0, 0, + 0,0x4B32,0x4B33, 0, 0,0x4B34, 0, 0, + 0, 0,0x4B35,0x4B36, 0,0x4B37, 0, 0, + 0, 0, 0,0x4B38, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4B39, 0, 0, +0x4B3A, 0,0x4B3B, 0, 0, 0,0x4B3C, 0, +0x4B3D, 0, 0, 0, 0,0x4B3E,0x4B3F,0x4B40, +0x4B41, 0, 0, 0, 0, 0,0x4B42,0x4B43, + 0,0x4B44, 0,0x4B45,0x4B46, 0,0x4B47,0x4B48, + 0,0x4B49, 0, 0, 0, 0, 0,0x4B4A, + 0,0x4B4B, 0, 0,0x4B4C, 0, 0, 0, +0x4B4D,0x4B4E, 0,0x4B4F, 0,0x4B50,0x4B51, 0, + 0, 0, 0, 0, 0, 0,0x4B52, 0, +0x4B53, 0, 0,0x4B54, 0,0x4B55, 0,0x4B56, +0x4B57, 0, 0, 0,0x4B58, 0,0x4B59,0x4B5A, +0x4B5B, 0,0x4B5C, 0, 0,0x4B5D,0x4B5E, 0, + 0, 0,0x4B5F,0x4B60, 0,0x4B61, 0, 0, + 0, 0, 0, 0, 0,0x4B62, 0,0x4B63, + 0,0x4B64, 0, 0,0x4B65,0x4B66, 0,0x4B67, + 0, 0, 0, 0, 0,0x4B68,0x4B69, 0, + 0,0x4B6A, 0,0x4B6B,0x4B6C, 0, 0,0x4B6D, + 0, 0,0x4B6E,0x4B6F, 0, 0,0x4B70, 0, + 0,0x4B71, 0, 0, 0,0x4B72, 0, 0, + 0,0x4B73, 0,0x4B74, 0, 0,0x4B75,0x4B76, + 0,0x4B77, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4B78,0x4B79, 0,0x4B7A, + 0,0x4B7B,0x4B7C,0x4B7D, 0,0x4B7E, 0,0x4C21, +0x4C22,0x4C23, 0, 0,0x4C24, 0, 0,0x4C25, + 0, 0,0x4C26, 0, 0, 0, 0, 0, + 0,0x4C27, 0, 0, 0, 0, 0, 0, + 0, 0,0x4C28,0x4C29, 0, 0, 0, 0, + 0, 0, 0, 0,0x4C2A, 0,0x4C2B, 0, +0x4C2C,0x4C2D,0x4C2E,0x4C2F,0x4C30,0x4C31,0x4C32,0x4C33, +0x4C34,0x4C35, 0, 0, 0, 0, 0, 0, + 0,0x4C36, 0, 0, 0, 0, 0, 0, +0x4C37, 0, 0,0x4C38,0x4C39, 0,0x4C3A,0x4C3B, + 0, 0, 0,0x4C3C, 0,0x4C3D, 0, 0, + 0,0x4C3E,0x4C3F, 0, 0, 0, 0,0x4C40, + 0, 0, 0, 0, 0,0x4C41, 0, 0, + 0, 0,0x4C42, 0, 0, 0,0x4C43,0x4C44, +0x4C45, 0, 0,0x4C46, 0,0x4C47,0x4C48, 0, + 0,0x4C49,0x4C4A, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4C4B,0x4C4C, 0, 0, 0,0x4C4D,0x4C4E,0x4C4F, + 0,0x4C50, 0, 0, 0, 0, 0,0x4C51, +0x4C52,0x4C53,0x4C54, 0, 0, 0, 0, 0, +0x4C55,0x4C56,0x4C57, 0,0x4C58, 0, 0,0x4C59, +0x4C5A,0x4C5B, 0,0x4C5C, 0, 0,0x4C5D, 0, +0x4C5E,0x4C5F,0x4C60,0x4C61, 0, 0,0x4C62,0x4C63, + 0,0x4C64,0x4C65, 0, 0,0x4C66, 0, 0, + 0,0x4C67, 0,0x4C68, 0, 0, 0,0x4C69, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4C6A,0x4C6B, 0, 0,0x4C6C, 0, 0, 0, +0x4C6D, 0, 0,0x4C6E, 0, 0, 0, 0, +0x4C6F, 0,0x4C70,0x4C71, 0, 0,0x4C72,0x4C73, + 0, 0, 0, 0,0x4C74, 0, 0, 0, +0x4C75, 0,0x4C76,0x4C77, 0, 0, 0,0x4C78, + 0, 0, 0, 0,0x4C79, 0, 0, 0, + 0, 0,0x4C7A,0x4C7B,0x4C7C, 0, 0,0x4C7D, + 0, 0, 0, 0, 0, 0,0x4C7E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4D21, 0, 0, 0,0x4D22,0x4D23, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4D24,0x4D25, 0, 0,0x4D26, 0, 0,0x4D27, + 0,0x4D28,0x4D29, 0, 0, 0, 0,0x4D2A, + 0, 0, 0, 0, 0, 0,0x4D2B, 0, + 0,0x4D2C, 0, 0, 0,0x4D2D,0x4D2E,0x4D2F, +0x4D30, 0, 0,0x4D31, 0, 0, 0,0x4D32, +0x4D33, 0, 0, 0, 0, 0,0x4D34, 0, +0x4D35, 0,0x4D36, 0, 0, 0, 0,0x4D37, + 0, 0, 0, 0, 0, 0,0x4D38,0x4D39, + 0,0x4D3A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x4D3B, + 0,0x4D3C, 0, 0, 0, 0, 0, 0, + 0,0x4D3D,0x4D3E,0x4D3F,0x4D40,0x4D41,0x4D42, 0, + 0,0x4D43, 0, 0, 0,0x4D44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x4D45, 0,0x4D46,0x4D47, 0,0x4D48, 0, 0, + 0,0x4D49, 0, 0,0x4D4A, 0, 0, 0, + 0, 0,0x4D4B, 0,0x4D4C, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4D4D, 0, 0, 0, + 0, 0,0x4D4E, 0, 0, 0, 0,0x4D4F, +0x4D50,0x4D51, 0, 0,0x4D52, 0,0x4D53, 0, + 0, 0, 0, 0,0x4D54, 0,0x4D55,0x4D56, + 0, 0, 0, 0, 0, 0, 0,0x4D57, + 0, 0, 0, 0,0x4D58, 0, 0,0x4D59, +0x4D5A,0x4D5B, 0, 0,0x4D5C, 0, 0,0x4D5D, + 0, 0, 0, 0,0x4D5E, 0,0x4D5F,0x4D60, + 0,0x4D61, 0, 0, 0, 0, 0, 0, + 0,0x4D62, 0, 0, 0, 0, 0, 0, +0x4D63, 0,0x4D64,0x4D65,0x4D66, 0, 0,0x4D67, +0x4D68, 0,0x4D69, 0,0x4D6A, 0, 0,0x4D6B, + 0, 0,0x4D6C,0x4D6D, 0,0x4D6E,0x4D6F, 0, + 0,0x4D70, 0,0x4D71,0x4D72,0x4D73,0x4D74, 0, + 0, 0, 0,0x4D75, 0,0x4D76,0x4D77, 0, + 0,0x4D78, 0, 0, 0,0x4D79, 0, 0, + 0, 0,0x4D7A,0x4D7B, 0,0x4D7C, 0, 0, +0x4D7D,0x4D7E,0x4E21, 0,0x4E22, 0, 0, 0, +0x4E24,0x4E25, 0,0x4E26,0x4E27,0x4E28, 0, 0, + 0,0x4E29,0x4E23,0x4E2A, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4E2B, 0, 0, + 0,0x4E2C, 0, 0, 0, 0, 0,0x4E2D, + 0, 0, 0, 0,0x4E2E,0x4E2F, 0, 0, + 0, 0, 0, 0, 0,0x4E30,0x4E31,0x4E32, + 0,0x4E33, 0, 0,0x4E34, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x4E35, 0, 0, 0,0x4E36, 0, 0, + 0, 0, 0, 0,0x4E37,0x4E38, 0, 0, + 0, 0, 0, 0, 0,0x4E39, 0, 0, + 0, 0, 0,0x4E3A,0x4E3B,0x4E3C, 0,0x4E3D, +0x4E3E, 0,0x4E3F,0x4E40,0x4E41,0x4E42,0x4E43,0x4E44, +0x4E45, 0,0x4E46, 0, 0,0x4E47, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4E48, 0, 0, + 0,0x4E49, 0, 0, 0,0x4E4A, 0, 0, + 0,0x4E4B, 0,0x4E4C,0x4E4D, 0,0x4E4E, 0, + 0, 0, 0, 0,0x4E4F, 0, 0, 0, + 0,0x4E50, 0, 0, 0, 0, 0, 0, +0x4E51, 0, 0, 0, 0, 0,0x4E52, 0, +0x4E53, 0, 0, 0,0x4E54, 0, 0, 0, +0x4E55,0x4E56, 0, 0, 0, 0,0x4E57, 0, + 0,0x4E58, 0, 0,0x4E59, 0, 0, 0, +0x4E5A, 0, 0, 0, 0, 0,0x4E5B, 0, + 0, 0,0x4E5C, 0, 0, 0,0x4E5D, 0, + 0, 0,0x4E5E, 0,0x4E5F,0x4E60, 0,0x4E61, + 0,0x4E62,0x4E63, 0,0x4E64, 0, 0, 0, + 0, 0,0x4E65, 0, 0, 0, 0, 0, +0x4E66, 0, 0, 0, 0,0x4E67,0x4E68,0x4E69, + 0, 0, 0, 0,0x4E6A,0x4E6B,0x4E6C, 0, + 0,0x4E6D, 0, 0, 0,0x4E6E,0x4E6F, 0, + 0, 0,0x4E70, 0, 0,0x4E71,0x4E72, 0, + 0, 0,0x4E73, 0, 0,0x4E74,0x4E75,0x4E76, + 0, 0,0x4E77, 0, 0, 0,0x4E78,0x4E79, + 0, 0, 0, 0,0x4E7A, 0,0x4E7B,0x4E7C, +0x4E7D, 0,0x4E7E, 0,0x4F21, 0, 0,0x4F22, + 0, 0,0x4F23, 0,0x4F24, 0, 0, 0, +0x4F25, 0,0x4F26,0x4F27,0x4F28, 0, 0, 0, + 0, 0,0x4F29, 0, 0,0x4F2A, 0, 0, +0x4F2B, 0, 0, 0,0x4F2C, 0, 0, 0, + 0, 0, 0, 0,0x4F2D,0x4F2E, 0, 0, + 0, 0, 0, 0,0x4F2F,0x4F30,0x4F31, 0, + 0, 0,0x4F32, 0, 0, 0, 0,0x4F33, + 0, 0,0x4F34, 0, 0, 0, 0,0x4F35, + 0, 0,0x4F36, 0, 0, 0,0x4F37,0x4F38, + 0,0x4F39, 0, 0, 0,0x4F3A, 0, 0, + 0, 0, 0, 0, 0, 0,0x4F3B, 0, + 0, 0, 0,0x4F3C, 0, 0, 0, 0, + 0,0x4F3D, 0, 0, 0, 0, 0, 0, + 0,0x4F3E,0x4F3F, 0, 0,0x4F40, 0, 0, + 0,0x4F41, 0, 0, 0, 0,0x4F42,0x4F43, +0x4F44, 0, 0, 0,0x4F45, 0,0x4F46, 0, + 0, 0,0x4F47, 0,0x4F48, 0, 0, 0, +0x4F49,0x4F4A, 0, 0,0x4F4B, 0, 0, 0, +0x4F4C, 0, 0,0x4F4D, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4F4E,0x4F4F, 0, + 0,0x4F50, 0, 0, 0,0x4F51,0x4F52, 0, + 0,0x4F53, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4F54, 0, 0, + 0,0x4F55,0x4F56,0x4F57, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x4F58,0x4F59, 0, +0x4F5A, 0, 0, 0, 0,0x4F5B, 0,0x4F5C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x4F5D,0x4F5E, 0, 0,0x4F5F, +0x4F60, 0, 0, 0,0x4F61, 0,0x4F62, 0, + 0, 0,0x4F63, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x4F64, 0,0x4F65, 0, +0x4F66,0x4F67, 0,0x4F68,0x4F69, 0, 0, 0, +0x4F6A, 0,0x4F6B, 0, 0, 0,0x4F6C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4F6D, 0, 0, 0,0x4F6E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x4F6F, 0, 0, 0, 0,0x4F70, + 0, 0, 0, 0,0x4F71, 0, 0, 0, +0x4F72, 0, 0, 0, 0,0x4F74,0x4F75,0x4F76, + 0,0x4F73, 0, 0,0x4F77, 0, 0, 0, +0x4F78, 0, 0, 0,0x4F79,0x4F7A, 0, 0, +0x4F7B,0x4F7C,0x4F7D,0x4F7E, 0, 0, 0, 0, + 0, 0, 0,0x5021, 0,0x5022, 0,0x5023, + 0, 0, 0, 0, 0, 0, 0,0x5024, +0x5025,0x5026, 0, 0,0x5027, 0,0x5028, 0, + 0, 0,0x5029,0x502A, 0,0x502B,0x502C, 0, + 0, 0, 0,0x502E, 0, 0, 0,0x502F, +0x5030,0x5031, 0, 0,0x502D, 0,0x5032, 0, + 0, 0,0x5033, 0, 0, 0, 0, 0, + 0, 0,0x5034,0x5035, 0, 0,0x5037,0x5038, + 0, 0,0x5039,0x503A, 0, 0, 0,0x503B, +0x5036, 0, 0, 0, 0, 0,0x503C, 0, + 0, 0, 0, 0,0x503D, 0, 0, 0, +0x503E, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x503F, 0,0x5040, 0,0x5041,0x5042, +0x5043, 0, 0, 0, 0,0x5044, 0,0x5045, + 0,0x5046, 0, 0, 0,0x5047, 0, 0, + 0,0x5048, 0, 0,0x5049,0x504A, 0, 0, + 0, 0, 0,0x504B, 0,0x504C, 0,0x504D, + 0, 0, 0, 0,0x504E,0x504F,0x5050, 0, + 0, 0,0x5051,0x5052, 0, 0, 0,0x5053, + 0,0x5054, 0, 0,0x5055, 0, 0, 0, +0x5056, 0, 0,0x5057,0x5058, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5059, + 0,0x505A, 0,0x505B, 0, 0, 0, 0, + 0, 0,0x505C, 0, 0, 0, 0, 0, + 0,0x505D, 0,0x505E,0x505F, 0,0x5060, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5061,0x5062, 0, 0, 0, + 0,0x5063, 0,0x5064,0x5065,0x5066,0x5067, 0, +0x5068, 0, 0,0x5069,0x506A, 0, 0, 0, + 0,0x506B, 0, 0, 0, 0, 0, 0, +0x506C,0x506D, 0,0x506E, 0, 0, 0,0x506F, + 0,0x5070, 0, 0,0x5071, 0, 0, 0, +0x5072, 0, 0,0x5073, 0, 0, 0, 0, + 0, 0,0x5074, 0,0x5075, 0, 0,0x5076, +0x5077, 0,0x5078, 0, 0, 0, 0,0x5079, + 0, 0, 0, 0,0x507A, 0,0x507B, 0, + 0, 0,0x507C, 0, 0,0x507D,0x507E, 0, +0x5121, 0,0x5122, 0, 0,0x5123, 0, 0, + 0, 0,0x5124,0x5125, 0,0x5126, 0, 0, + 0,0x5127, 0, 0, 0, 0, 0, 0, +0x5128, 0, 0, 0,0x5129, 0, 0, 0, + 0, 0,0x512A,0x512B, 0, 0, 0,0x512C, + 0,0x512D,0x512E, 0,0x512F, 0, 0, 0, + 0,0x5130, 0, 0, 0,0x5131, 0, 0, + 0, 0, 0,0x5132, 0, 0,0x5133, 0, + 0,0x5134, 0, 0, 0, 0, 0,0x5135, + 0, 0, 0,0x5136, 0,0x5137, 0,0x5138, +0x5139, 0, 0, 0,0x513A,0x513B, 0, 0, +0x513C,0x513D,0x513E, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x513F,0x5140, 0,0x5141, +0x5142, 0, 0, 0,0x5143, 0, 0, 0, + 0, 0, 0, 0, 0,0x5144,0x5145, 0, + 0,0x5146, 0, 0,0x5147,0x5148, 0,0x5149, +0x514A, 0, 0, 0, 0,0x514B, 0,0x514C, + 0, 0,0x514D, 0, 0,0x514E, 0, 0, + 0, 0, 0, 0, 0,0x514F, 0, 0, +0x5150, 0, 0, 0, 0, 0,0x5151, 0, +0x5152, 0,0x5153, 0, 0,0x5154,0x5155, 0, + 0, 0,0x5156,0x5157, 0, 0, 0, 0, +0x5158,0x5159, 0, 0,0x515A, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x515B, 0, +0x515C, 0, 0,0x515D, 0, 0, 0, 0, + 0, 0, 0, 0,0x515E, 0, 0, 0, + 0, 0, 0,0x515F, 0,0x5160, 0, 0, + 0,0x5161, 0,0x5162,0x5163, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5164, 0, + 0,0x5165, 0, 0,0x5166, 0,0x5167, 0, + 0,0x5168, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5169, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x516A,0x516B, 0,0x516C,0x516D, 0, 0, 0, + 0,0x516E, 0, 0,0x516F, 0, 0, 0, + 0, 0, 0,0x5170, 0,0x5171,0x5172, 0, + 0, 0, 0, 0, 0, 0, 0,0x5173, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5174, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5175, + 0, 0, 0,0x5176, 0, 0, 0,0x5177, + 0,0x5178,0x5179,0x517A, 0,0x517B,0x517C,0x517D, +0x517E,0x5221, 0, 0,0x5222, 0, 0, 0, + 0, 0, 0, 0, 0,0x5223, 0,0x5224, +0x5225,0x5226, 0, 0, 0, 0, 0,0x5227, + 0, 0, 0, 0, 0, 0,0x5228, 0, + 0, 0, 0, 0, 0,0x5229, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x522A, 0, 0, 0,0x522B, 0,0x522C, 0, + 0,0x522D,0x522E, 0, 0,0x522F, 0,0x5230, + 0, 0,0x5231,0x5232, 0, 0, 0,0x5233, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5234, 0, 0, 0, + 0,0x5235, 0, 0, 0, 0,0x5236, 0, +0x5237,0x5238, 0, 0, 0, 0,0x5239, 0, + 0, 0, 0,0x523A, 0, 0,0x523B, 0, +0x523C, 0, 0, 0, 0,0x523D, 0, 0, + 0, 0, 0, 0,0x523E, 0, 0,0x523F, +0x5240, 0,0x5241, 0, 0,0x5242,0x5243, 0, + 0, 0,0x5244,0x5245,0x5246,0x5247, 0, 0, + 0, 0,0x5248, 0, 0,0x5249, 0, 0, +0x524A, 0,0x524B, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x524C, 0,0x524D,0x524E, + 0,0x524F,0x5250,0x5251, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5252, 0,0x5253, 0, 0, 0, 0, 0, + 0, 0,0x5254, 0,0x5255,0x5256, 0, 0, +0x5257,0x5258,0x5259, 0,0x525A, 0,0x525B, 0, + 0,0x525C,0x525D,0x525E,0x525F, 0,0x5260, 0, + 0,0x5261, 0,0x5262,0x5263, 0,0x5264,0x5265, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5266, 0,0x5267, 0, 0, 0, 0, +0x5268, 0, 0, 0, 0,0x5269,0x526A, 0, +0x526B, 0, 0, 0,0x526C, 0, 0, 0, + 0,0x526D, 0,0x526E,0x526F, 0,0x5270, 0, + 0,0x5271,0x5272, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5273, 0, + 0, 0,0x5274, 0, 0, 0, 0, 0, + 0,0x5276,0x5277,0x5278, 0,0x5275, 0, 0, + 0,0x5279,0x527A,0x527B,0x527C,0x527D,0x527E, 0, + 0,0x5321, 0,0x5322, 0, 0, 0,0x5323, + 0,0x5324, 0, 0, 0,0x5325,0x5326, 0, +0x5327, 0,0x5328, 0, 0, 0, 0, 0, + 0,0x5329, 0, 0,0x532A,0x532B, 0, 0, + 0, 0, 0, 0, 0, 0,0x532C,0x532D, + 0, 0, 0, 0, 0, 0, 0,0x532E, + 0, 0, 0, 0,0x532F, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5330, 0, +0x5331, 0, 0, 0, 0, 0,0x5332, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5333, 0, 0, 0, 0, 0,0x5334,0x5335, + 0, 0,0x5336,0x5337,0x5338, 0, 0,0x5339, + 0, 0, 0, 0,0x533A, 0, 0,0x533B, +0x533C,0x533D, 0, 0, 0,0x533E, 0,0x533F, + 0, 0, 0,0x5340,0x5341,0x5342, 0,0x5343, + 0,0x5344,0x5345, 0, 0,0x5346, 0, 0, + 0, 0, 0, 0, 0, 0,0x5347, 0, + 0,0x5348, 0,0x5349, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x534A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x534B, 0, 0, 0,0x534C, +0x534D,0x534E, 0, 0, 0, 0, 0,0x534F, + 0,0x5350,0x5351,0x5352, 0, 0,0x5353, 0, + 0, 0, 0, 0, 0,0x5354,0x5355, 0, + 0, 0, 0,0x5356, 0, 0,0x5357, 0, + 0, 0,0x5358, 0, 0,0x5359, 0, 0, + 0,0x535A, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x535B,0x535C,0x535D, 0, +0x535E,0x535F, 0, 0, 0, 0, 0,0x5360, +0x5361, 0, 0, 0, 0,0x5362, 0, 0, + 0,0x5363, 0,0x5364, 0, 0, 0,0x5365, + 0,0x5366,0x5367, 0,0x5368,0x5369, 0, 0, + 0, 0, 0, 0, 0,0x536A, 0,0x536B, + 0, 0,0x536C, 0, 0, 0, 0, 0, +0x536D, 0, 0, 0, 0, 0, 0, 0, +0x536E, 0,0x536F,0x5370, 0, 0, 0,0x5371, + 0,0x5372,0x5373,0x5374, 0,0x5375,0x5376, 0, +0x5377, 0, 0,0x5378,0x5379,0x537A, 0, 0, + 0,0x537B, 0, 0, 0, 0,0x537C,0x537D, + 0, 0, 0, 0, 0,0x537E,0x5421, 0, + 0, 0, 0, 0, 0, 0,0x5422,0x5423, + 0, 0,0x5424, 0, 0, 0, 0, 0, + 0, 0, 0,0x5425, 0, 0,0x5426,0x5427, + 0,0x5428, 0, 0, 0, 0, 0, 0, + 0, 0,0x5429,0x542A,0x542B,0x542C,0x542D, 0, + 0, 0, 0, 0,0x542E,0x542F,0x5430, 0, + 0, 0, 0, 0, 0, 0, 0,0x5431, + 0,0x5432, 0, 0, 0, 0, 0, 0, + 0, 0,0x5434, 0, 0,0x5435,0x5436, 0, + 0, 0,0x5437,0x5438, 0,0x5439, 0, 0, + 0,0x543A, 0, 0, 0,0x543B,0x543C, 0, + 0,0x543D,0x543E, 0, 0, 0, 0, 0, +0x5433, 0, 0, 0, 0, 0, 0, 0, +0x543F, 0, 0, 0, 0, 0, 0, 0, +0x5440,0x5441, 0, 0, 0,0x5442, 0,0x5443, + 0, 0, 0, 0,0x5444,0x5445, 0, 0, +0x5446, 0, 0, 0, 0, 0, 0,0x5447, +0x5448, 0, 0, 0,0x5449,0x544A, 0,0x544B, + 0, 0, 0,0x544C, 0, 0,0x544D, 0, + 0, 0, 0, 0, 0, 0, 0,0x544E, + 0, 0, 0, 0,0x544F,0x5450, 0,0x5451, + 0, 0, 0, 0, 0, 0,0x5452, 0, +0x5453, 0,0x5454, 0, 0, 0, 0, 0, +0x5455, 0, 0, 0, 0, 0, 0,0x5456, + 0,0x5457,0x5458, 0, 0,0x5459, 0, 0, + 0, 0, 0,0x545A, 0, 0,0x545B,0x545C, + 0, 0, 0,0x545D, 0, 0, 0, 0, +0x545E, 0, 0, 0, 0, 0,0x545F, 0, + 0,0x5460, 0, 0, 0, 0,0x5461,0x5462, + 0, 0,0x5463, 0, 0,0x5464, 0, 0, + 0,0x5465, 0, 0, 0,0x5466, 0, 0, +0x5467, 0,0x5468, 0, 0,0x5469,0x546A}; + +/* page 27 0x7F3B-0x8044 */ +static uint16 tab_uni_jisx021227[]={ +0x546C,0x546B,0x546D,0x546E,0x546F, 0, 0, 0, +0x5470,0x5471, 0, 0,0x5472, 0, 0, 0, + 0, 0, 0, 0,0x5473, 0, 0,0x5474, +0x5475, 0, 0, 0, 0, 0, 0, 0, +0x5476,0x5477,0x5478, 0, 0, 0,0x5479, 0, +0x547A,0x547B,0x547C,0x547D, 0, 0, 0, 0, + 0, 0,0x547E, 0, 0, 0,0x5521, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5522,0x5523,0x5524,0x5525, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5526, 0,0x5527, 0,0x5528,0x5529,0x552A, 0, + 0, 0, 0,0x552B,0x552C, 0, 0, 0, + 0,0x552D, 0, 0, 0, 0,0x552E,0x552F, + 0, 0, 0,0x5530, 0, 0, 0,0x5531, + 0, 0,0x5532, 0, 0, 0, 0, 0, + 0,0x5533, 0, 0, 0, 0, 0, 0, + 0,0x5534, 0, 0,0x5535,0x5536, 0, 0, +0x5537, 0, 0, 0, 0,0x5538, 0, 0, + 0, 0, 0,0x5539,0x553A, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x553B, 0, 0, 0,0x553C, 0, 0, 0, +0x553D, 0,0x553E, 0, 0,0x553F, 0, 0, + 0,0x5540, 0,0x5541,0x5542, 0, 0,0x5543, + 0, 0, 0, 0, 0, 0, 0,0x5544, + 0, 0,0x5545,0x5546,0x5547, 0, 0, 0, + 0, 0, 0, 0,0x5548,0x5549, 0,0x554A, + 0, 0,0x554B,0x554C,0x554D, 0,0x554E, 0, +0x554F,0x5550, 0,0x5551, 0, 0, 0, 0, + 0, 0,0x5552,0x5553,0x5554,0x5555, 0, 0, + 0,0x5556, 0,0x5557, 0, 0, 0, 0, + 0,0x5558, 0,0x5559, 0,0x555A, 0, 0, + 0,0x555B,0x555C, 0,0x555D, 0,0x555E,0x555F, + 0,0x5560, 0,0x5561, 0,0x5562, 0, 0, + 0,0x5563}; + +/* page 28 0x8060-0x8357 */ +static uint16 tab_uni_jisx021228[]={ +0x5564, 0, 0, 0,0x5565, 0,0x5566, 0, + 0, 0, 0, 0, 0,0x5567, 0, 0, + 0,0x5568, 0, 0, 0,0x5569, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x556A, 0, 0, 0, 0, 0, 0, +0x556B, 0, 0, 0, 0, 0,0x556C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x556D, 0,0x556E, 0, + 0, 0, 0, 0, 0, 0,0x556F,0x5570, + 0, 0, 0,0x5571, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5572,0x5573, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5574, 0, 0, 0, 0,0x5575, 0,0x5576, + 0, 0,0x5577, 0,0x5578,0x5579, 0,0x557A, +0x557B, 0, 0, 0, 0, 0, 0, 0, +0x557C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x557D,0x557E, 0, +0x5621, 0,0x5622,0x5623, 0, 0,0x5624, 0, + 0,0x5625,0x5626, 0, 0, 0,0x5627, 0, + 0, 0, 0,0x5628, 0, 0, 0, 0, + 0, 0, 0,0x5629, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x562A,0x562B, +0x562C, 0, 0, 0,0x562D, 0,0x562E, 0, +0x562F, 0, 0, 0,0x5630, 0, 0,0x5631, + 0, 0, 0, 0,0x5632, 0, 0, 0, +0x5633, 0, 0, 0, 0,0x5634, 0, 0, + 0, 0,0x5635, 0,0x5636, 0, 0, 0, + 0, 0, 0, 0, 0,0x5637, 0,0x5638, + 0, 0,0x5639, 0,0x563A, 0, 0, 0, + 0, 0,0x563B, 0, 0, 0, 0,0x563C, + 0, 0, 0, 0, 0, 0, 0, 0, +0x563D,0x563E, 0, 0, 0, 0, 0,0x563F, +0x5640,0x5641, 0, 0, 0,0x5642, 0,0x5643, + 0, 0, 0, 0, 0, 0, 0,0x5644, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5645, 0, 0,0x5647,0x5648,0x5649, 0, + 0, 0, 0,0x564A, 0, 0,0x564B, 0, +0x5646, 0, 0, 0, 0, 0,0x564C, 0, +0x564D, 0, 0,0x564E, 0, 0,0x564F, 0, + 0, 0,0x5650, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5651, 0, + 0, 0,0x5652, 0,0x5653, 0, 0, 0, + 0, 0, 0,0x5654, 0, 0, 0, 0, + 0, 0, 0,0x5656, 0,0x5657, 0, 0, + 0, 0,0x5658,0x5655, 0, 0,0x5659,0x565A, + 0, 0, 0, 0, 0,0x565B, 0,0x565C, + 0, 0, 0,0x565D, 0,0x565E,0x565F, 0, + 0,0x5660, 0, 0,0x5661, 0, 0, 0, + 0, 0, 0,0x5662,0x5663, 0, 0, 0, +0x5664,0x5665,0x5666, 0, 0,0x5667,0x5668, 0, +0x5669,0x566A, 0, 0, 0,0x566B, 0,0x566C, +0x566D, 0, 0,0x566E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x566F, + 0, 0, 0,0x5670,0x5671, 0, 0, 0, + 0,0x5672,0x5673, 0, 0,0x5674, 0, 0, + 0,0x5675,0x5676, 0, 0, 0, 0, 0, +0x5677, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5678, 0,0x5679, 0, 0, 0, + 0, 0,0x567A, 0, 0, 0, 0, 0, + 0, 0, 0,0x567B,0x567C,0x567D,0x567E, 0, + 0, 0, 0,0x5721, 0, 0,0x5722,0x5723, + 0,0x5724, 0, 0, 0, 0,0x5725, 0, + 0, 0, 0, 0,0x5726, 0, 0, 0, +0x5727, 0, 0,0x5728, 0, 0, 0,0x5729, + 0, 0, 0, 0, 0,0x572A, 0, 0, + 0, 0, 0, 0,0x572B, 0, 0, 0, + 0, 0, 0,0x572C, 0,0x572D, 0,0x572E, +0x572F,0x5730, 0,0x5731,0x5732, 0, 0,0x5733, + 0,0x5734,0x5735, 0, 0, 0,0x5736, 0, + 0,0x5737, 0, 0,0x5738, 0,0x5739, 0, +0x573A, 0,0x573B,0x573C, 0, 0, 0, 0, +0x573D,0x573E, 0,0x573F,0x5740, 0, 0,0x5741, +0x5742,0x5743,0x5744, 0, 0, 0,0x5745, 0, +0x5746, 0,0x5747, 0,0x5748, 0, 0,0x5749, + 0, 0,0x574A, 0,0x574B, 0,0x574C,0x574D, + 0, 0, 0, 0, 0, 0,0x574E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x574F, 0, 0, 0, 0,0x5750, 0, 0, + 0, 0,0x5751, 0, 0, 0, 0, 0, +0x5752, 0,0x5753, 0,0x5754, 0, 0, 0, +0x5755, 0,0x5756, 0, 0,0x5757, 0,0x5758, + 0, 0, 0, 0, 0, 0,0x5759,0x575A, + 0, 0, 0, 0, 0,0x575B,0x575C, 0, +0x575D,0x575E, 0, 0, 0, 0, 0,0x575F, +0x5760, 0,0x5761,0x5762, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5764, 0,0x5765,0x5766,0x5767, + 0,0x5768,0x5769, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x576A,0x576B,0x576C, 0, +0x576D, 0, 0,0x576E, 0, 0, 0,0x576F, + 0, 0,0x5770, 0,0x5771,0x5772, 0, 0, + 0, 0,0x5773,0x5774,0x5775, 0, 0,0x5776, + 0, 0, 0, 0, 0,0x5777,0x5778, 0, + 0,0x5779, 0,0x583E,0x5763,0x577A,0x577B,0x577C +}; + +/* page 29 0x8370-0x8419 */ +static uint16 tab_uni_jisx021229[]={ +0x577D, 0, 0, 0, 0, 0, 0, 0, +0x577E, 0, 0, 0, 0,0x5821, 0,0x5822, +0x5823, 0,0x5824, 0,0x5825, 0,0x5826, 0, + 0, 0, 0, 0, 0,0x5827, 0, 0, + 0, 0,0x5828, 0,0x5829,0x582A, 0, 0, +0x582B,0x582C, 0,0x582D,0x582E,0x582F, 0, 0, + 0, 0, 0, 0, 0, 0,0x5830,0x5831, + 0,0x5832, 0, 0,0x5833,0x584C, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5834,0x5835, +0x5836, 0, 0, 0, 0, 0, 0,0x5837, + 0,0x5838, 0, 0, 0, 0, 0,0x5839, +0x583A,0x583B, 0, 0,0x583C, 0, 0, 0, + 0, 0, 0, 0, 0,0x583D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x583F, 0,0x5840, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x5841, 0, +0x5842,0x5843, 0, 0,0x5844, 0, 0, 0, + 0,0x5845, 0, 0, 0, 0,0x5846, 0, + 0, 0,0x5847, 0, 0, 0, 0,0x5848, + 0,0x5849, 0, 0, 0,0x584A, 0, 0, + 0,0x584B}; + +/* page 30 0x842F-0x8880 */ +static uint16 tab_uni_jisx021230[]={ +0x584D, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x584E, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x584F, 0, +0x5850,0x5851, 0,0x5852, 0, 0,0x5853, 0, +0x5854, 0,0x5855,0x5856, 0, 0, 0,0x5857, + 0,0x5858,0x5859,0x585A, 0,0x585B, 0, 0, + 0,0x585C, 0, 0, 0,0x585D,0x585E, 0, +0x585F, 0, 0,0x5860, 0, 0, 0, 0, + 0,0x5861, 0, 0,0x5862,0x5863, 0,0x5864, + 0,0x5865, 0, 0, 0,0x5866,0x5867, 0, + 0, 0,0x5868, 0, 0, 0,0x5869, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x586A,0x586B, 0,0x586C, 0, + 0, 0, 0, 0, 0, 0, 0,0x586D, + 0, 0, 0, 0, 0, 0, 0,0x586E, + 0,0x586F,0x5870,0x5871, 0, 0, 0, 0, +0x5872, 0,0x5873, 0, 0,0x5874, 0, 0, + 0, 0, 0,0x5875, 0, 0,0x5876,0x5877, + 0,0x5878, 0,0x5879, 0, 0, 0, 0, +0x587A,0x587B, 0, 0, 0,0x587C, 0, 0, +0x587D, 0, 0, 0,0x587E, 0, 0, 0, + 0, 0, 0, 0, 0,0x5921, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5922, 0, 0,0x5923, 0, 0, 0, 0, +0x5924,0x5925,0x5926,0x5927, 0, 0, 0, 0, +0x5928, 0, 0,0x592A,0x592B, 0,0x592C, 0, + 0, 0, 0,0x592D,0x592E, 0, 0, 0, +0x592F, 0, 0, 0, 0,0x5930, 0,0x5931, + 0,0x5932, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x5933, 0,0x5934, + 0, 0, 0,0x5935,0x5936,0x5937,0x5938, 0, +0x5939, 0, 0,0x593A,0x593B, 0, 0, 0, +0x593C, 0, 0,0x5929,0x593D,0x593E, 0,0x593F, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5940, 0, 0, 0, 0, 0, 0,0x5941, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5942,0x5943,0x5944,0x5945,0x5946, 0, 0,0x5947, + 0, 0,0x5948, 0, 0,0x5949,0x594A,0x594B, +0x594C,0x594D,0x594E,0x594F, 0,0x5950, 0, 0, + 0, 0, 0, 0,0x5951, 0, 0, 0, +0x5952, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5953,0x5954,0x5955, 0,0x5956, 0, +0x5957, 0,0x5958, 0, 0, 0,0x5959,0x595A, + 0, 0,0x595B, 0,0x595C,0x595D, 0, 0, +0x595E, 0, 0, 0,0x595F, 0, 0, 0, + 0,0x5960, 0, 0, 0, 0,0x5961, 0, +0x5962,0x5963, 0,0x5964, 0, 0,0x5965, 0, +0x5966, 0, 0, 0, 0, 0,0x5974, 0, + 0, 0, 0, 0, 0,0x5967, 0,0x5968, +0x5969,0x596A, 0, 0, 0,0x596B,0x596C,0x596D, +0x596E, 0, 0,0x596F, 0, 0, 0, 0, +0x5970, 0, 0,0x5971,0x5972, 0, 0,0x5973, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5975, 0,0x5976, 0, 0, 0, 0, +0x5977,0x5978, 0, 0, 0, 0, 0,0x5979, + 0,0x597A, 0, 0, 0, 0,0x597B, 0, + 0, 0, 0, 0,0x597C, 0, 0,0x597D, + 0, 0, 0, 0, 0,0x597E, 0, 0, +0x5A21,0x5A22, 0, 0, 0,0x5A23,0x5A24, 0, + 0, 0, 0, 0, 0, 0,0x5A25,0x5A26, + 0,0x5A27,0x5A28,0x5A29, 0, 0, 0, 0, + 0,0x5A2A,0x5A2B, 0,0x5A2C, 0, 0,0x5A2D, + 0, 0,0x5A2E, 0, 0, 0, 0, 0, +0x5A2F, 0,0x5A30, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5A31, + 0,0x5A32, 0,0x5A33, 0,0x5A34,0x5A35, 0, + 0,0x5A36,0x3866,0x5A37, 0, 0, 0,0x5A38, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5A39,0x5A3A, 0, 0,0x5A3B, +0x5A3C,0x5A3D,0x5A3E, 0, 0, 0,0x5A3F, 0, + 0,0x5A40,0x5A41,0x5A42,0x5A43,0x5A44, 0, 0, + 0, 0,0x5A45, 0, 0,0x5A46, 0, 0, +0x5A47, 0, 0, 0, 0, 0,0x5A48,0x5A49, +0x5A4A, 0, 0,0x5A4B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5A6D, 0, 0, 0, 0,0x5A4C, 0, + 0, 0,0x5A4D, 0, 0, 0, 0,0x5A4E, + 0,0x5A4F, 0,0x5A50, 0,0x5A51, 0, 0, + 0, 0,0x5A52, 0, 0, 0, 0,0x5A53, +0x5A54,0x5A55, 0, 0, 0, 0,0x5A56, 0, + 0, 0,0x5A57, 0,0x5A58,0x5A59,0x5A5A, 0, +0x5A5B,0x5A5C,0x5A5D, 0, 0, 0, 0, 0, +0x5A5E,0x5A5F,0x5A60, 0,0x5A61, 0,0x5A62, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5A63,0x5A64, 0, 0,0x5A65, 0, +0x5A66, 0, 0,0x5A67, 0,0x5A68, 0, 0, + 0,0x5A69, 0, 0,0x5A6A, 0,0x5A6B, 0, +0x5A6C, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5A6E, 0,0x5A6F,0x5A70, 0, + 0, 0, 0, 0, 0,0x5A71,0x5A72, 0, +0x5A73, 0, 0, 0,0x5A74, 0, 0,0x5A75, +0x5A76,0x5A77, 0, 0,0x5A78,0x5A79, 0, 0, + 0, 0,0x5A7A, 0, 0, 0, 0,0x5A7B, +0x5A7C, 0,0x5A7D, 0,0x5A7E, 0, 0, 0, + 0,0x5B21, 0, 0, 0, 0, 0,0x5B22, +0x5B23, 0,0x5B24,0x5B25, 0, 0, 0, 0, + 0, 0,0x5B26,0x5B27, 0,0x5B28,0x5B29,0x5B2A, + 0,0x5B2B, 0, 0,0x5B2C, 0,0x5B2D, 0, + 0, 0, 0, 0, 0, 0,0x5B2E, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B2F, 0, 0, 0, 0,0x5B30, 0, + 0, 0,0x5B31, 0, 0,0x5B32,0x5B33, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5B34, 0,0x5B35,0x5B36, 0, 0, 0, 0, + 0, 0, 0, 0,0x5B37, 0, 0, 0, + 0, 0, 0, 0,0x5B38,0x5B39,0x5B3A,0x5B3B, +0x5B3C,0x5B3D,0x5B3E, 0,0x5B3F,0x5B40, 0, 0, + 0,0x5B41, 0, 0,0x5B42, 0,0x5B43, 0, +0x5B44,0x5B45,0x5B46, 0, 0, 0, 0,0x5B47, + 0,0x5B48, 0, 0,0x5B49, 0, 0, 0, +0x5B4A, 0, 0, 0, 0,0x5B4B,0x5B4C,0x5B4D, + 0, 0,0x5B4E, 0, 0, 0,0x5B4F, 0, + 0, 0, 0, 0, 0, 0, 0,0x5B50, +0x5B51, 0,0x5B52, 0, 0, 0, 0, 0, + 0,0x5B53,0x5B54,0x5B55, 0, 0, 0,0x5B56, + 0, 0, 0, 0, 0, 0,0x5B57,0x5B58, + 0, 0,0x5B59,0x5B5A, 0,0x5B5B, 0, 0, +0x5B5C, 0, 0,0x5B5D,0x5B5E,0x5B5F, 0, 0, + 0, 0, 0,0x5B60,0x5B61, 0,0x5B62, 0, + 0, 0,0x5B63, 0,0x5B64, 0, 0, 0, + 0,0x5B65, 0,0x5B66, 0, 0, 0, 0, +0x5B67, 0,0x5B68, 0,0x5B69, 0, 0,0x5B6A, + 0, 0,0x5B6B,0x5B6C,0x5B6D, 0, 0, 0, + 0,0x5B6E, 0,0x5B70,0x5B71,0x5B72, 0, 0, + 0,0x5B73,0x5B6F,0x5B74,0x5B75,0x5B76, 0,0x5B77, +0x5B78, 0, 0, 0, 0, 0, 0, 0, + 0,0x5B79, 0, 0, 0, 0,0x5B7A,0x5B7B, + 0,0x5B7C, 0,0x5B7D, 0, 0,0x5B7E, 0, + 0, 0, 0,0x5C21, 0,0x5C22, 0, 0, + 0, 0,0x5C23, 0,0x5C24, 0,0x5C25, 0, + 0,0x5C26,0x5C27,0x5C28,0x5C29, 0, 0,0x5C2A, + 0, 0,0x5C2B, 0, 0, 0,0x5C2C,0x5C2D, + 0,0x5C2E, 0,0x5C2F, 0,0x5C30, 0, 0, +0x5C31,0x5C32, 0, 0, 0,0x5C33, 0, 0, + 0, 0,0x5C34, 0, 0, 0, 0, 0, + 0, 0,0x5C35, 0, 0, 0, 0, 0, + 0, 0,0x5C36, 0,0x5C37, 0, 0, 0, + 0,0x5C38}; + +/* page 31 0x8898-0x89BC */ +static uint16 tab_uni_jisx021231[]={ +0x5C39, 0,0x5C3A,0x5C3B,0x5C3C, 0, 0,0x5C3D, +0x5C3E, 0, 0, 0, 0, 0, 0, 0, +0x5C3F, 0,0x5C40, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5C41, 0, 0,0x5C42,0x5C43, 0, +0x5C44, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5C45,0x5C46,0x5C47,0x5C48,0x5C49, 0, + 0,0x5C4A,0x5C4B,0x5C4C, 0, 0, 0, 0, + 0, 0, 0,0x5C4D, 0, 0,0x5C4E, 0, + 0, 0, 0, 0, 0, 0, 0,0x5C4F, + 0, 0, 0, 0, 0, 0, 0,0x5C50, +0x5C51,0x5C52, 0, 0, 0,0x5C53, 0,0x5C54, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5C55, 0, 0, 0, 0,0x5C56, 0, + 0, 0, 0, 0, 0,0x5C57,0x5C58,0x5C59, + 0, 0, 0, 0, 0,0x5C5A,0x5C5B, 0, +0x5C5C,0x5C5D,0x5C5E, 0,0x5C5F, 0, 0, 0, +0x5C60, 0, 0, 0, 0, 0,0x5C61,0x5C62, +0x5C63, 0, 0, 0, 0, 0, 0, 0, +0x5C64,0x5C65,0x5C66, 0, 0,0x5C67, 0, 0, + 0,0x5C68,0x5C69, 0, 0, 0,0x5C6A, 0, +0x5C6B, 0,0x5C6C, 0, 0,0x5C6D,0x5C6E, 0, + 0,0x5C6F, 0, 0, 0, 0, 0,0x5C70, + 0, 0,0x5C71, 0, 0, 0, 0,0x5C72, + 0, 0,0x5C73,0x5C74,0x5C75, 0, 0, 0, + 0,0x5C76,0x5C77,0x5C78, 0, 0, 0, 0, + 0, 0, 0,0x5C79, 0, 0,0x5C7A, 0, +0x5C7B, 0, 0,0x5C7C, 0,0x5C7D, 0, 0, + 0, 0,0x5C7E,0x5D21,0x5D22,0x5D23, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D24, 0, 0, 0,0x5D25, 0, 0, +0x5D26, 0, 0, 0,0x5D27,0x5D28, 0, 0, + 0, 0, 0,0x5D29,0x5D2A, 0, 0,0x5D2B, +0x5D2C, 0, 0, 0, 0,0x5D2D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5D2E, 0, 0, 0,0x5D2F,0x5D30,0x5D31,0x5D32, + 0, 0, 0, 0,0x5D33}; + +/* page 32 0x89D4-0x8B9F */ +static uint16 tab_uni_jisx021232[]={ +0x5D34,0x5D35,0x5D36,0x5D37,0x5D38, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D39, 0, 0, 0,0x5D3A, 0,0x5D3B, + 0,0x5D3C, 0, 0, 0,0x5D3D, 0,0x5D3E, + 0, 0,0x5D3F, 0, 0,0x5D40, 0, 0, + 0,0x5D41, 0,0x5D42, 0, 0, 0, 0, +0x5D43,0x5D44, 0,0x5D45, 0, 0, 0, 0, + 0, 0, 0,0x5D46, 0,0x5D47,0x5D48, 0, +0x5D49,0x5D4A, 0, 0, 0, 0, 0, 0, + 0, 0,0x5D4B, 0,0x5D4C, 0,0x5D4D, 0, +0x5D4E, 0,0x5D4F, 0, 0, 0, 0,0x5D50, +0x5D51, 0, 0,0x5D52, 0, 0, 0, 0, + 0,0x5D53, 0,0x5D54, 0, 0, 0, 0, + 0,0x5D55,0x5D56, 0,0x5D57, 0, 0,0x5D58, + 0,0x5D59, 0,0x5D5A, 0,0x5D5B, 0, 0, + 0,0x5D5C,0x5D5D, 0, 0, 0, 0,0x5D5E, + 0, 0,0x5D5F,0x5D60,0x5D61, 0, 0, 0, +0x5D62,0x5D63, 0, 0, 0,0x5D64, 0, 0, + 0,0x5D65, 0,0x5D66, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5D67,0x5D68,0x5D69, 0,0x5D6A,0x5D6B,0x5D6C, + 0, 0,0x5D6D,0x5D6E,0x5D6F, 0, 0,0x5D70, + 0, 0,0x5D71, 0, 0, 0, 0,0x5D72, + 0, 0, 0,0x5D73,0x5D74, 0,0x5D75, 0, + 0, 0,0x5D76,0x5D77, 0,0x5D78, 0, 0, + 0, 0, 0,0x5D79, 0, 0, 0, 0, + 0, 0, 0,0x5D7A, 0,0x5D7B, 0, 0, + 0, 0,0x5D7C,0x5D7D, 0, 0, 0,0x5D7E, + 0, 0,0x5E21,0x5E22, 0, 0, 0,0x5E23, + 0, 0,0x5E24, 0, 0, 0, 0,0x5E25, + 0, 0,0x5E26, 0,0x5E27,0x5E28,0x5E29, 0, + 0, 0, 0, 0, 0,0x5E2A, 0,0x5E2B, +0x5E2C,0x5E2D, 0,0x5E2E, 0, 0, 0, 0, + 0,0x5E2F, 0,0x5E30, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5E31, 0, 0, 0,0x5E32, 0, 0, 0, +0x5E33,0x5E34,0x5E35, 0, 0, 0, 0, 0, +0x5E36, 0, 0,0x5E37, 0, 0, 0, 0, + 0,0x5E38,0x5E39, 0, 0, 0,0x5E3F,0x5E3A, + 0, 0, 0, 0, 0,0x5E3B, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5E3C, 0,0x5E3D,0x5E3E, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E40, 0, 0,0x5E41, 0, 0, 0, + 0, 0, 0,0x5E42, 0, 0, 0, 0, +0x5E43, 0, 0, 0, 0, 0,0x5E44,0x5E45, +0x5E46,0x5E47,0x5E48, 0,0x5E49, 0, 0, 0, + 0,0x5E4E, 0, 0, 0, 0,0x5E4A,0x5E4B, +0x5E4C, 0, 0, 0, 0,0x5E4D, 0, 0, + 0, 0,0x5E4F, 0, 0, 0, 0,0x5E50, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x5E51, 0, 0, 0, 0, 0, 0, + 0, 0,0x5E52, 0,0x5E53,0x5E54, 0, 0, +0x5E55, 0,0x5E56, 0, 0,0x5E57, 0, 0, +0x5E58,0x5E59, 0, 0, 0, 0, 0,0x5E5A, + 0,0x5E5B, 0,0x5E5C, 0, 0, 0, 0, +0x5E5D,0x5E5E, 0, 0, 0, 0, 0, 0, +0x5E5F, 0,0x5E60,0x5E61}; + +/* page 33 0x8C38-0x8CA4 */ +static uint16 tab_uni_jisx021233[]={ +0x5E62,0x5E63, 0, 0, 0,0x5E64,0x5E65, 0, + 0, 0, 0, 0, 0,0x5E66, 0,0x5E67, + 0,0x5E68, 0,0x5E69, 0, 0, 0,0x5E6A, + 0,0x5E6B, 0,0x5E6C,0x5E6D, 0, 0,0x5E6E, +0x5E6F,0x5E72, 0,0x5E70, 0,0x5E71, 0, 0, + 0, 0, 0,0x5E73,0x5E74, 0,0x5E75, 0, +0x5E76,0x5E77, 0, 0, 0,0x5E78, 0, 0, + 0, 0, 0,0x5E79, 0,0x5E7A,0x5E7B, 0, + 0, 0, 0,0x5E7C, 0, 0,0x5E7D, 0, + 0, 0, 0, 0, 0, 0,0x5E7E,0x5F21, + 0, 0, 0,0x5F22, 0, 0, 0, 0, +0x5F23, 0,0x5F24,0x5F25, 0, 0, 0, 0, + 0,0x5F26, 0,0x5F27,0x5F28, 0, 0, 0, + 0, 0, 0, 0,0x5F29}; + +/* page 34 0x8CB9-0x8D1B */ +static uint16 tab_uni_jisx021234[]={ +0x5F2A,0x5F2B, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x5F2C,0x5F2D, 0, 0, +0x5F2E, 0,0x5F2F, 0, 0, 0,0x5F30, 0, + 0, 0, 0, 0,0x5F32,0x5F31, 0, 0, +0x5F33, 0, 0, 0,0x5F34, 0, 0, 0, +0x5F35, 0, 0, 0, 0, 0, 0,0x5F36, + 0, 0, 0,0x5F37, 0, 0,0x5F38,0x5F39, + 0,0x5F3A, 0, 0,0x5F3B, 0,0x5F3C,0x5F3D, + 0, 0, 0, 0, 0,0x5F3E,0x5F3F, 0, +0x5F40, 0,0x5F41, 0, 0, 0, 0, 0, +0x5F42, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F43, 0, 0, 0, 0,0x5F44, 0, + 0, 0,0x5F45}; + +/* page 35 0x8D65-0x8F65 */ +static uint16 tab_uni_jisx021235[]={ +0x5F46, 0, 0, 0,0x5F47, 0, 0,0x5F48, + 0,0x5F49, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x5F4A, 0, 0,0x5F4B, 0,0x5F4C, + 0, 0, 0,0x5F4D, 0, 0, 0, 0, +0x5F4E, 0, 0,0x5F4F,0x5F50, 0, 0, 0, +0x5F51, 0, 0, 0, 0, 0, 0, 0, + 0,0x5F52,0x5F53,0x5F54, 0, 0, 0, 0, + 0,0x5F55, 0, 0, 0, 0,0x5F56,0x5F57, + 0, 0,0x5F58, 0, 0,0x5F59, 0, 0, +0x5F5A, 0,0x5F5B, 0,0x5F5C, 0,0x5F5D,0x5F6F, + 0, 0, 0,0x5F5E, 0, 0, 0, 0, +0x5F5F,0x5F60,0x5F61,0x5F62, 0,0x5F63, 0, 0, + 0,0x5F64, 0, 0,0x5F65, 0, 0,0x5F66, +0x5F67, 0,0x5F68, 0,0x5F69, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x5F6A, +0x5F6B, 0,0x5F6C, 0, 0, 0, 0,0x5F6D, + 0, 0, 0,0x5F6E,0x5F70,0x5F71, 0,0x5F72, + 0, 0, 0, 0, 0, 0, 0, 0, +0x5F73, 0, 0, 0,0x5F74, 0, 0,0x5F75, +0x5F76,0x5F77, 0, 0, 0, 0,0x5F78, 0, + 0, 0, 0, 0,0x5F79, 0, 0,0x5F7A, + 0,0x5F7B, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x5F7C,0x5F7D,0x5F7E,0x6021, 0, + 0,0x6022,0x6023, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6024, 0,0x6025, 0, + 0,0x6026,0x6027,0x6028,0x6029, 0, 0, 0, +0x602A, 0, 0,0x602B,0x602C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x602D, 0, +0x602E,0x602F,0x6030, 0, 0, 0, 0,0x6031, + 0, 0, 0, 0, 0, 0,0x6032,0x6033, +0x6034,0x6035, 0, 0,0x6036,0x6037, 0, 0, + 0, 0, 0, 0,0x6038, 0, 0,0x6039, +0x603A, 0,0x603B,0x603C,0x603D, 0, 0, 0, + 0, 0, 0, 0,0x603E,0x603F,0x6040, 0, + 0, 0, 0, 0, 0,0x6041,0x6042, 0, + 0, 0, 0, 0,0x6043, 0, 0, 0, + 0, 0, 0,0x6044, 0,0x6045, 0, 0, +0x6046, 0, 0, 0, 0,0x6047,0x6048, 0, +0x6049,0x604A, 0, 0, 0,0x604B, 0, 0, + 0, 0,0x604C, 0,0x604D, 0, 0, 0, +0x604E,0x604F, 0, 0, 0, 0,0x6050, 0, +0x6051, 0, 0, 0, 0,0x6052,0x6053, 0, + 0, 0, 0,0x6054,0x6055, 0,0x6056,0x6057, + 0, 0,0x6058, 0, 0, 0, 0, 0, + 0, 0,0x6059, 0,0x605A, 0, 0,0x605B, + 0, 0, 0, 0, 0, 0, 0,0x605C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x605D, 0, 0, 0, 0, +0x6064,0x605E, 0,0x605F,0x6060, 0, 0, 0, + 0, 0,0x6061, 0,0x6062,0x6063, 0, 0, + 0, 0, 0,0x6065, 0,0x6066, 0, 0, + 0, 0,0x6067,0x6068, 0, 0, 0, 0, + 0, 0,0x6069,0x606A, 0, 0, 0, 0, + 0,0x606B,0x606C,0x606D, 0, 0, 0, 0, + 0,0x606E, 0,0x606F,0x6070, 0,0x6071, 0, +0x6072, 0,0x6073,0x6074, 0, 0, 0,0x6075, +0x6076,0x6077, 0, 0, 0, 0, 0,0x6078, +0x6079,0x607A,0x607B, 0, 0,0x607C, 0, 0, + 0, 0, 0,0x607D,0x607E, 0,0x6121, 0, + 0, 0,0x6122, 0, 0, 0, 0, 0, + 0, 0,0x6123, 0,0x6124,0x6125,0x6126,0x6127, +0x6128, 0, 0,0x6129, 0, 0, 0, 0, +0x612A,0x612B, 0, 0, 0, 0, 0, 0, +0x612C}; + +/* page 36 0x8F9D-0x9484 */ +static uint16 tab_uni_jisx021236[]={ +0x612D, 0, 0,0x612E,0x612F, 0, 0,0x6130, +0x6131,0x6132, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6133,0x6134, 0,0x6135, 0, 0, 0, 0, + 0,0x6136, 0,0x6137,0x6138, 0, 0, 0, + 0,0x6139, 0, 0, 0,0x613A,0x613B, 0, +0x613C, 0, 0,0x613D, 0,0x613E,0x613F, 0, +0x6140, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6141, 0, 0,0x6142,0x6143, + 0, 0, 0,0x6144, 0, 0, 0, 0, + 0,0x6145, 0, 0,0x6146, 0, 0, 0, +0x6147,0x6148, 0, 0, 0, 0,0x6149, 0, + 0,0x614A, 0, 0, 0,0x614B, 0,0x614C, + 0, 0, 0,0x614D, 0, 0, 0,0x614E, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x614F, 0, 0,0x6150, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6151,0x6152,0x6154, 0,0x6155, +0x6156, 0,0x6153, 0, 0, 0,0x6157,0x6158, + 0, 0,0x6159, 0, 0, 0, 0, 0, + 0, 0,0x615A, 0, 0, 0,0x615B,0x615C, + 0, 0, 0, 0, 0, 0, 0,0x615D, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x615E, 0, +0x615F, 0, 0, 0, 0,0x6160, 0, 0, + 0,0x6161,0x6162, 0, 0, 0, 0,0x6163, + 0, 0, 0,0x6164, 0, 0, 0,0x6165, + 0, 0, 0, 0,0x6166, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6167, 0, 0,0x6168, 0, 0,0x6169,0x616A, + 0,0x616B, 0,0x616C, 0, 0, 0, 0, +0x616D, 0,0x616E,0x616F,0x6170, 0,0x6171, 0, + 0, 0, 0,0x6172,0x6173,0x6174, 0, 0, +0x6175, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6176, 0,0x6177,0x6178,0x6179, + 0,0x617A, 0, 0, 0, 0, 0, 0, +0x617B,0x617D, 0, 0, 0, 0,0x617E,0x6221, +0x6222, 0,0x6223,0x6224, 0, 0, 0,0x617C, + 0, 0, 0, 0, 0,0x622D, 0, 0, +0x6225, 0,0x6226,0x6227,0x6228, 0, 0,0x6229, +0x622A, 0,0x622B, 0, 0, 0, 0, 0, +0x622C, 0, 0, 0, 0, 0,0x622F, 0, + 0, 0,0x6230,0x6231, 0, 0, 0,0x6232, + 0,0x622E, 0, 0, 0, 0, 0, 0, + 0,0x6233,0x6234,0x6235, 0, 0, 0,0x6236, +0x6237,0x6238, 0,0x6239, 0, 0, 0, 0, +0x623A, 0, 0,0x623B, 0, 0, 0,0x623C, + 0,0x623D,0x623E,0x623F, 0,0x6240, 0,0x6241, + 0,0x6242, 0,0x6243, 0,0x6245,0x6246, 0, +0x6244, 0,0x6247, 0,0x6248, 0, 0, 0, + 0,0x6249,0x624A, 0,0x624B, 0, 0,0x624C, + 0,0x624D,0x624E, 0,0x624F,0x6250, 0,0x6251, +0x6252, 0, 0, 0, 0, 0,0x6253, 0, + 0, 0,0x6254,0x6255, 0, 0, 0, 0, + 0, 0,0x6256, 0, 0, 0,0x6257, 0, + 0, 0,0x6258, 0,0x6259,0x625A,0x625B, 0, + 0, 0, 0, 0,0x625C, 0, 0,0x625D, + 0, 0,0x625E, 0, 0, 0, 0, 0, +0x625F, 0, 0, 0, 0, 0, 0,0x6260, + 0, 0, 0, 0,0x6261,0x6262,0x6263, 0, + 0, 0, 0, 0,0x6264, 0,0x6265, 0, +0x6266,0x6267, 0, 0, 0,0x6268, 0, 0, + 0,0x6269, 0, 0,0x626A, 0,0x626B,0x626C, +0x626D, 0, 0,0x626E, 0, 0, 0, 0, + 0,0x626F, 0, 0,0x6270, 0, 0, 0, + 0,0x6271, 0,0x6272, 0, 0, 0,0x6273, +0x6274,0x6275, 0,0x6276,0x6277,0x6278,0x6279, 0, + 0,0x627A, 0, 0, 0, 0,0x627B,0x627C, +0x627D, 0,0x627E, 0, 0,0x6321,0x6322, 0, +0x6323, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6324,0x6325, + 0, 0,0x6326, 0,0x6327,0x6328, 0, 0, + 0,0x6329, 0, 0, 0, 0, 0,0x632A, +0x632B, 0, 0, 0,0x632C,0x632D, 0,0x632E, +0x632F,0x6330,0x6331,0x6332,0x6333, 0, 0, 0, + 0, 0,0x6334, 0,0x6335, 0,0x6336, 0, +0x6337, 0, 0,0x6338,0x6339, 0, 0,0x633A, +0x633B,0x633C,0x633D, 0,0x633E,0x633F, 0,0x6340, + 0, 0, 0,0x6341, 0,0x6342,0x6343, 0, + 0,0x6344, 0,0x6345, 0, 0, 0,0x6346, +0x6347, 0, 0, 0, 0, 0,0x6348,0x6349, +0x634A,0x634B, 0,0x634C, 0, 0, 0, 0, + 0,0x634D,0x634E,0x634F, 0, 0,0x6350, 0, +0x6351,0x6352, 0,0x6353,0x6354,0x6355, 0,0x6356, + 0,0x6357, 0,0x6358, 0,0x6359,0x635A, 0, + 0,0x635B,0x635C, 0, 0,0x635D, 0, 0, +0x635E,0x635F,0x6360, 0,0x6361, 0, 0, 0, + 0, 0, 0,0x6362,0x6363, 0, 0,0x6364, +0x6365, 0, 0,0x6366,0x6367, 0, 0, 0, +0x6368, 0,0x6369,0x636A,0x636B, 0, 0, 0, + 0,0x636C,0x636D,0x636E, 0, 0, 0, 0, +0x636F,0x6370,0x6371,0x6372,0x6373, 0,0x6374,0x6375, +0x6376, 0,0x6377, 0, 0, 0, 0, 0, + 0, 0, 0,0x6378,0x6379,0x637A, 0, 0, +0x637B,0x637C, 0, 0, 0,0x637D, 0, 0, + 0, 0,0x637E, 0,0x6421, 0, 0, 0, + 0, 0,0x6422,0x6423, 0, 0, 0,0x6424, +0x6425, 0,0x6426,0x6427, 0, 0,0x6428, 0, + 0, 0,0x6429, 0, 0,0x642A, 0, 0, + 0,0x642B, 0,0x642C, 0,0x642D,0x642E,0x642F, +0x6430, 0,0x6431,0x6432,0x6433,0x6434,0x6435, 0, +0x6436,0x6437,0x6438,0x6439, 0, 0,0x643A,0x643B, +0x643C,0x643D, 0,0x643E, 0, 0,0x643F, 0, +0x6440, 0,0x6441,0x6442,0x6443, 0, 0,0x6444, +0x6445, 0,0x6446,0x6447,0x6448, 0,0x6449, 0, +0x644A, 0,0x644B,0x644C, 0, 0, 0,0x644D, + 0,0x644E, 0,0x644F, 0, 0, 0, 0, + 0, 0, 0, 0,0x6450, 0,0x6451, 0, + 0, 0,0x6452,0x6453, 0,0x6454, 0, 0, + 0, 0, 0,0x6455, 0, 0, 0, 0, +0x6456, 0, 0, 0,0x6457, 0, 0,0x6458, +0x6459, 0, 0, 0, 0, 0, 0,0x645A, +0x645B,0x645C,0x645D, 0,0x645E, 0, 0,0x645F, +0x6460, 0,0x6461, 0,0x6462,0x6463, 0, 0, + 0, 0, 0, 0, 0, 0,0x6464,0x6465, + 0,0x6466,0x6467, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6468,0x6469,0x646A, 0, 0, 0, + 0, 0, 0,0x646B,0x646C,0x646D, 0, 0, +0x646E, 0,0x646F,0x6470, 0,0x6471, 0, 0, + 0,0x6472, 0, 0, 0, 0, 0,0x6473, +0x6474, 0,0x6475, 0,0x6476,0x6477, 0, 0, +0x6478, 0,0x6479,0x647A,0x647B, 0,0x647C,0x647D, + 0,0x647E, 0, 0, 0,0x6521, 0, 0, +0x6522, 0,0x6523,0x6524,0x6525,0x6526, 0, 0, + 0, 0, 0,0x6527, 0,0x6528,0x6529, 0, +0x652A, 0,0x652B, 0, 0,0x652C, 0, 0, +0x652D, 0, 0,0x652E, 0, 0,0x652F, 0, + 0,0x6530, 0, 0,0x6531, 0,0x6532,0x6533, + 0,0x6534, 0,0x6535,0x653B, 0,0x6536, 0, + 0, 0, 0, 0, 0, 0, 0,0x6537, +0x6538,0x6539, 0, 0, 0,0x653A, 0, 0, + 0, 0, 0, 0,0x653C, 0, 0,0x653D, +0x653E,0x653F,0x6540, 0,0x6541,0x6542,0x6543,0x6544, +0x6545, 0, 0, 0, 0, 0,0x6546, 0, + 0, 0, 0, 0,0x6547, 0, 0,0x6548, + 0,0x6549,0x654A, 0, 0,0x654B, 0, 0, + 0,0x654C,0x654D, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x654F,0x6550,0x654E,0x6551,0x6552, 0, +0x6553, 0, 0, 0,0x6554,0x6555, 0,0x6556, + 0, 0, 0,0x6557,0x6558, 0, 0, 0, +0x6559,0x655A,0x655B, 0, 0, 0, 0, 0, +0x655C,0x655D,0x655E, 0, 0, 0, 0, 0, + 0, 0,0x655F, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6560,0x6561, 0,0x6562,0x6563,0x6564,0x6565, + 0, 0, 0, 0, 0, 0,0x6566, 0, +0x6568, 0,0x6567, 0, 0, 0,0x6569, 0, +0x656A, 0, 0,0x656B, 0,0x656C, 0,0x656D, + 0, 0, 0, 0, 0, 0, 0, 0, +0x656E, 0, 0, 0,0x656F, 0, 0,0x6570, + 0, 0,0x6571, 0,0x6572, 0,0x6573, 0, + 0, 0, 0,0x6574, 0, 0,0x6575, 0, +0x6576,0x6577,0x6578, 0,0x6579,0x657A, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x657C,0x657B +}; + +/* page 37 0x9578-0x95E6 */ +static uint16 tab_uni_jisx021237[]={ +0x657D,0x657E, 0, 0, 0, 0,0x6621, 0, + 0, 0, 0, 0,0x6622, 0, 0, 0, +0x6623, 0, 0, 0,0x6624,0x6625,0x6626, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6627,0x6628,0x6629, + 0,0x662A, 0, 0, 0, 0,0x662B, 0, + 0,0x662C, 0,0x662D,0x662E, 0, 0, 0, + 0, 0, 0, 0,0x662F, 0,0x6630, 0, + 0, 0,0x6631, 0, 0,0x6632, 0,0x6633, + 0, 0, 0, 0, 0, 0,0x6634, 0, +0x6635,0x6636, 0,0x6637, 0, 0, 0, 0, +0x6638,0x6639,0x663A,0x663B, 0, 0, 0, 0, + 0,0x663C,0x663D, 0, 0,0x663E,0x663F,0x6640, +0x6641, 0, 0, 0,0x6642, 0,0x6643}; + +/* page 38 0x961D-0x986C */ +static uint16 tab_uni_jisx021238[]={ +0x6644,0x6645, 0, 0, 0,0x6646, 0,0x6647, +0x6648,0x6649, 0, 0, 0, 0, 0,0x664A, + 0, 0, 0, 0,0x664B, 0,0x664C, 0, + 0, 0,0x664D,0x664E,0x664F,0x6650, 0,0x6651, +0x6652, 0, 0, 0,0x6653, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6654, 0,0x6655, + 0,0x6656,0x6657,0x6658, 0, 0, 0, 0, + 0, 0, 0, 0,0x6659, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x665A, 0, 0, 0, 0, 0,0x665B, + 0, 0, 0, 0, 0, 0,0x665C,0x665D, + 0,0x665E,0x665F, 0,0x6660,0x6661,0x6662,0x6663, + 0, 0, 0, 0,0x6664, 0, 0, 0, + 0, 0, 0, 0,0x6665, 0, 0, 0, + 0,0x6666, 0, 0, 0,0x6667, 0, 0, +0x6668, 0,0x6669, 0, 0, 0, 0,0x666A, +0x666B,0x666C, 0, 0,0x666D, 0, 0, 0, + 0,0x666E,0x666F, 0, 0, 0,0x6670, 0, + 0, 0, 0, 0, 0,0x6671, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6672, 0, 0, + 0, 0, 0, 0, 0,0x6673, 0, 0, + 0, 0, 0,0x6675, 0,0x6676, 0, 0, +0x6677,0x6678,0x6679, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x667A, 0, 0, 0, + 0, 0,0x667B, 0,0x667C, 0, 0, 0, + 0, 0, 0, 0, 0,0x667D, 0, 0, + 0, 0, 0, 0, 0,0x667E,0x6721, 0, +0x6722, 0, 0, 0,0x6723, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6724,0x6725, 0, +0x6726, 0, 0, 0,0x6727,0x6728,0x6729, 0, + 0, 0, 0,0x672A, 0, 0, 0, 0, + 0, 0, 0, 0,0x672B, 0,0x672C, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x672D, 0,0x672E, 0, + 0, 0, 0, 0, 0,0x672F, 0, 0, + 0,0x6730,0x6731, 0, 0, 0, 0, 0, +0x6732, 0,0x6733,0x6734, 0,0x6735,0x6736, 0, + 0, 0, 0, 0, 0, 0,0x6737, 0, + 0, 0,0x6738, 0, 0,0x6739, 0, 0, + 0,0x673A, 0, 0, 0, 0,0x673B, 0, + 0,0x673C,0x673D,0x673E, 0, 0,0x673F, 0, +0x6740, 0,0x6741,0x6742, 0, 0, 0, 0, + 0, 0, 0, 0,0x6743, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6744,0x6745,0x6746, 0,0x6747,0x6748, 0, 0, + 0,0x6749,0x674A, 0, 0,0x674B, 0, 0, + 0, 0, 0, 0, 0, 0, 0,0x674C, + 0,0x674D, 0, 0,0x674E,0x674F, 0, 0, +0x6750,0x6751, 0,0x6752,0x6753,0x6754, 0,0x6755, + 0,0x6756,0x6757, 0,0x6758, 0, 0,0x6759, +0x675A, 0,0x675B, 0,0x675C,0x675D, 0,0x675E, +0x675F,0x6760, 0,0x6761,0x6762, 0, 0,0x6763, + 0, 0,0x6764,0x6765,0x6766, 0,0x676A, 0, +0x6767,0x6768, 0,0x6769,0x676B, 0, 0,0x676C, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x676D, 0,0x676E, 0, 0,0x676F, + 0, 0,0x6770,0x6771, 0,0x6772, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,0x6773, 0, 0,0x6774, 0, 0, +0x6776,0x6777, 0, 0, 0, 0, 0,0x6778, + 0,0x6779, 0, 0,0x6775, 0, 0,0x677A, + 0,0x677B, 0,0x677C, 0, 0,0x677D, 0, +0x6828,0x677E, 0, 0, 0, 0,0x6821, 0, + 0,0x6822,0x6823,0x6824, 0,0x6825,0x6826, 0, +0x6827, 0, 0, 0, 0, 0, 0, 0, + 0,0x6829, 0, 0, 0, 0, 0,0x682A, + 0, 0,0x682B, 0, 0,0x682C, 0, 0, + 0, 0, 0, 0,0x682D,0x682E,0x682F, 0, + 0,0x6830,0x6831, 0,0x6832,0x6833, 0, 0, + 0, 0, 0, 0, 0,0x6834,0x6835, 0, +0x6836,0x6837, 0, 0, 0,0x6838, 0,0x6839 +}; + +/* page 39 0x98AB-0x98CC */ +static uint16 tab_uni_jisx021239[]={ +0x683A, 0,0x683B,0x683C, 0,0x683D, 0, 0, + 0,0x683E, 0, 0,0x683F,0x6840, 0,0x6841, +0x6842, 0, 0, 0,0x6843, 0, 0,0x6844, + 0, 0,0x6845, 0, 0,0x6846, 0, 0, + 0,0x6847}; + +/* page 40 0x98E1-0x9960 */ +static uint16 tab_uni_jisx021240[]={ +0x6848, 0,0x6849, 0,0x684A,0x684B,0x684C, 0, + 0,0x684D, 0, 0, 0, 0, 0, 0, + 0, 0,0x684E, 0, 0,0x684F, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6850, 0, 0, 0, 0,0x6851,0x6852, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6853, 0, 0, 0,0x6854,0x6855,0x6856, 0, + 0,0x6857,0x6858,0x6859, 0, 0,0x685A, 0, + 0,0x685B, 0, 0, 0,0x685C,0x685D, 0, + 0, 0,0x685E, 0, 0, 0, 0, 0, +0x685F,0x6860,0x6861,0x6862,0x6863, 0, 0, 0, +0x6864,0x6865,0x6866,0x6867, 0, 0, 0,0x6868, +0x6869, 0, 0, 0, 0,0x686A,0x686B,0x686C, + 0, 0, 0, 0,0x686D,0x686E, 0, 0, + 0, 0, 0,0x686F, 0, 0, 0,0x6870, +0x6871, 0,0x6872,0x6873, 0,0x6874,0x6875,0x6876 +}; + +/* page 41 0x999B-0x9A5D */ +static uint16 tab_uni_jisx021241[]={ +0x6877, 0,0x6878, 0,0x6879, 0, 0, 0, + 0, 0, 0,0x687A, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x687B,0x687C,0x687D, + 0, 0,0x687E, 0, 0, 0,0x6921,0x6922, + 0, 0,0x6923, 0,0x6924, 0, 0, 0, +0x6925, 0, 0, 0, 0, 0,0x6926, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6927,0x6928, 0, 0, 0, 0,0x6929,0x692A, + 0,0x692B, 0,0x692C, 0, 0, 0, 0, + 0, 0, 0, 0,0x692D, 0, 0,0x692E, +0x692F,0x6930, 0, 0, 0,0x6931, 0, 0, + 0,0x6932,0x6933, 0, 0, 0,0x6934, 0, + 0, 0,0x6935,0x6936, 0, 0, 0,0x6937, +0x6938,0x6939, 0, 0, 0, 0, 0, 0, +0x693A,0x693B, 0, 0, 0,0x693C,0x693D, 0, + 0, 0, 0,0x693E, 0, 0, 0, 0, + 0, 0, 0,0x693F, 0,0x6940, 0,0x6941, +0x6942,0x6943, 0, 0,0x6944, 0, 0, 0, + 0, 0,0x6945,0x6946, 0, 0, 0, 0, +0x6947, 0,0x6948,0x6949, 0,0x694A, 0, 0, + 0, 0, 0, 0, 0, 0,0x694C, 0, + 0,0x694D, 0, 0,0x694B, 0, 0,0x694E, +0x694F,0x6950, 0,0x6951, 0, 0,0x6952, 0, + 0,0x6953, 0,0x6954, 0, 0, 0, 0, + 0, 0,0x6955}; + +/* page 42 0x9AAA-0x9C7B */ +static uint16 tab_uni_jisx021242[]={ +0x6956, 0,0x6957, 0,0x6958,0x6959, 0, 0, +0x695A, 0,0x695B,0x695C,0x695D, 0, 0,0x695E, + 0,0x695F, 0, 0,0x6960,0x6961, 0,0x6962, + 0,0x6963, 0, 0,0x6964, 0,0x6965, 0, + 0, 0, 0, 0,0x6966, 0,0x6967, 0, +0x6968, 0, 0,0x6969,0x696A,0x696B, 0, 0, + 0,0x696C,0x696D, 0, 0, 0,0x696E, 0, + 0, 0,0x696F,0x6970, 0,0x6971, 0,0x6972, + 0, 0,0x6973, 0, 0, 0, 0, 0, +0x6974,0x6975, 0,0x6976, 0, 0, 0,0x6977, +0x6978, 0, 0,0x6979, 0,0x697A,0x697B,0x697C, +0x697D,0x697E,0x6A21,0x6A22, 0, 0,0x6A23,0x6A24, + 0,0x6A25,0x6A26,0x6A27,0x6A28, 0,0x6A29, 0, +0x6A2A, 0, 0, 0,0x6A2B, 0, 0,0x6A2C, + 0,0x6A2D,0x6A2E, 0, 0, 0,0x6A2F, 0, + 0, 0, 0, 0,0x6A30, 0, 0, 0, + 0,0x6A31, 0,0x6A32, 0, 0, 0, 0, + 0,0x6A33,0x6A34,0x6A35, 0,0x6A36, 0,0x6A37, +0x6A38, 0, 0,0x6A39, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6A3A, 0, + 0,0x6A3B,0x6A3C, 0, 0, 0, 0, 0, + 0, 0, 0,0x6A3D,0x6A3E,0x6A3F, 0, 0, + 0,0x6A40, 0, 0,0x6A41, 0, 0,0x6A42, + 0,0x6A43, 0,0x6A44,0x6A45, 0,0x6A46, 0, +0x6A47,0x6A48,0x6A49,0x6A4A,0x6A4B, 0, 0, 0, + 0,0x6A4C, 0,0x6A4D, 0,0x6A4E,0x6A4F,0x6A50, + 0, 0, 0, 0, 0,0x6A51,0x6A52, 0, + 0, 0,0x6A53,0x6A54,0x6A55,0x6A56, 0,0x6A57, +0x6A58,0x6A59, 0,0x6A5A, 0,0x6A5B,0x6A5C, 0, + 0, 0,0x6A5D, 0, 0, 0, 0, 0, +0x6A5E, 0, 0,0x6A5F,0x6A60, 0, 0, 0, + 0, 0, 0, 0,0x6A61,0x6A62, 0,0x6A63, + 0, 0,0x6A64, 0, 0, 0,0x6A65,0x6A66, +0x6A67, 0, 0, 0, 0,0x6A68,0x6A69, 0, + 0,0x6A6A,0x6A6B, 0,0x6A6C,0x6A6D, 0,0x6A6E, + 0, 0, 0, 0, 0,0x6A6F,0x6A70, 0, + 0, 0, 0, 0,0x6A71, 0,0x6A72, 0, + 0, 0, 0, 0, 0,0x6A73,0x6A74, 0, + 0, 0, 0,0x6A75, 0,0x6A76, 0, 0, + 0, 0, 0,0x6A77, 0,0x6A78, 0, 0, +0x6A79,0x6A7A, 0, 0, 0,0x6A7B, 0, 0, + 0,0x6A7C, 0, 0, 0,0x6A7D,0x6A7E,0x6B21, +0x6B22, 0, 0,0x6B23, 0,0x6B24,0x6B25, 0, +0x6B26, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B27, 0, 0, 0,0x6B28, 0,0x6B29, + 0, 0, 0, 0,0x6B2A, 0,0x6B2B,0x6B2C, +0x6B2D, 0,0x6B2E, 0,0x6B2F, 0, 0, 0, +0x6B30,0x6B31, 0, 0,0x6B32,0x6B33,0x6B34,0x6B35, +0x6B36, 0, 0, 0, 0, 0, 0,0x6B37, + 0, 0, 0,0x6B38,0x6B39,0x6B3A, 0, 0, + 0, 0, 0,0x6B3B, 0, 0, 0,0x6B3C, + 0,0x6B3D,0x6B3E,0x6B3F, 0, 0, 0,0x6B40, +0x6B41, 0, 0, 0,0x6B42,0x6B43,0x6B44, 0, + 0,0x6B45,0x6B46, 0,0x6B47, 0,0x6B48, 0, + 0,0x6B49,0x6B50,0x6B4A,0x6B4B,0x6B4C, 0, 0, + 0,0x6B4D, 0, 0, 0, 0,0x6B52,0x6B4E, +0x6B4F,0x6B51, 0, 0,0x6B53, 0,0x6B54, 0, +0x6B55, 0, 0,0x6B56, 0,0x6B57, 0, 0, + 0,0x6B58}; + +/* page 43 0x9CE6-0x9E1D */ +static uint16 tab_uni_jisx021243[]={ +0x6B59, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6B5A, 0, 0, 0, + 0,0x6B5B, 0,0x6B5C, 0, 0, 0, 0, + 0, 0, 0, 0,0x6B5E, 0, 0, 0, + 0, 0, 0, 0, 0,0x6B5D, 0, 0, + 0, 0, 0,0x6B5F, 0, 0, 0, 0, + 0,0x6B60,0x6B61, 0, 0, 0,0x6B62,0x6B63, +0x6B64, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B65,0x6B66, 0,0x6B67,0x6B68,0x6B69, 0, + 0, 0, 0, 0,0x6B6A, 0,0x6B6B,0x6B6D, + 0, 0, 0, 0,0x6B6E,0x6B6F, 0,0x6B6C, + 0,0x6B70, 0, 0,0x6B71, 0, 0, 0, + 0, 0, 0, 0, 0,0x6B72,0x6B73, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6B74, 0, 0,0x6B76,0x6B75, 0,0x6B77, + 0, 0, 0,0x6B78,0x6B79,0x6B7A, 0, 0, + 0, 0,0x6B7B, 0, 0, 0, 0, 0, +0x6B7C,0x6B7D, 0, 0, 0,0x6B7E,0x6C21, 0, +0x6C22, 0, 0, 0, 0,0x6C23,0x6C24, 0, +0x6C25, 0, 0, 0,0x6C26, 0, 0,0x6C27, +0x6C28, 0, 0, 0,0x6C29,0x6C2A, 0,0x6C2B, +0x6C2C,0x6C2D,0x6C2E, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C2F, 0, 0, 0, 0, + 0, 0, 0, 0,0x6C30, 0,0x6C31, 0, +0x6C32, 0, 0,0x6C33, 0, 0, 0,0x6C34, + 0, 0, 0,0x6C35, 0, 0,0x6C36, 0, + 0,0x6C37, 0, 0, 0,0x6C38, 0, 0, + 0,0x6C39, 0,0x6C3A,0x6C3B, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6C3C,0x6C3D, +0x6C3E,0x6C3F, 0, 0,0x6C40, 0, 0, 0, +0x6C41,0x6C42,0x6C43, 0, 0, 0, 0,0x6C44, + 0,0x6C45, 0,0x6C46, 0,0x6C47, 0, 0, +0x6C48, 0,0x6C49, 0, 0,0x6C4A,0x6C4B, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x6C4C, 0, 0, 0,0x6C4E, 0, 0, 0, + 0,0x6C4F, 0, 0,0x6C4D, 0, 0, 0, +0x6C50, 0,0x6C51,0x6C52,0x6C53, 0, 0,0x6C54, +0x6C55, 0, 0,0x6C56, 0, 0,0x6C57,0x6C58 +}; + +/* page 44 0x9E7A-0x9FA5 */ +static uint16 tab_uni_jisx021244[]={ +0x6C59,0x6C5A,0x6C5B, 0, 0, 0,0x6C5C, 0, +0x6C5D,0x6C5E,0x6C5F,0x6C60, 0,0x6C61, 0, 0, + 0, 0, 0, 0,0x6C62,0x6C63, 0, 0, + 0, 0, 0, 0,0x6C64, 0,0x6C65, 0, + 0,0x6C66, 0, 0,0x6C67, 0, 0, 0, + 0, 0,0x6C68, 0, 0, 0,0x6C69, 0, + 0, 0,0x6C6A, 0,0x6C6B,0x6C6C,0x6C6D, 0, + 0,0x6C6E,0x6C6F,0x6C70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,0x6C71, 0,0x6C72, 0, + 0,0x6C73, 0, 0, 0, 0, 0, 0, + 0, 0, 0,0x6C74, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6C75, 0, 0, + 0, 0,0x6C76, 0, 0,0x6C77, 0, 0, + 0, 0,0x6C78,0x6C79,0x6C7A, 0,0x6C7B,0x6C7C, +0x6C7D, 0, 0,0x6C7E, 0, 0,0x6D21, 0, + 0, 0, 0, 0, 0,0x6D22, 0, 0, +0x6D23,0x6D24, 0, 0, 0, 0, 0,0x6D25, + 0, 0, 0, 0, 0,0x6D26,0x6D27,0x6D28, +0x6D29, 0,0x6D2A, 0,0x6D2B,0x6D2C, 0,0x6D2D, +0x6D2E,0x6D2F, 0, 0, 0,0x6D30, 0, 0, +0x6D31, 0, 0, 0,0x6D32, 0, 0, 0, +0x6D33,0x6D34, 0, 0, 0,0x6D35, 0,0x6D36, +0x6D37, 0,0x6D38, 0, 0,0x6D39, 0,0x6D3A, +0x6D3B, 0,0x6D3C,0x6D3D, 0,0x6D3E, 0,0x6D3F, + 0,0x6D40,0x6D41,0x6D42,0x6D43,0x6D44, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0,0x6D45, 0,0x6D46,0x6D47,0x6D48,0x6D49, 0, +0x6D4A, 0, 0,0x6D4B,0x6D4C, 0, 0, 0, + 0, 0, 0, 0, 0, 0,0x6D4D,0x6D4E, + 0, 0, 0,0x6D4F,0x6D50,0x6D51,0x6D52,0x6D53, + 0,0x6D54, 0,0x6D55, 0, 0, 0, 0, +0x6D56, 0, 0,0x6D57, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,0x6D58,0x6D59,0x6D5A, +0x6D5B, 0,0x6D5C, 0,0x6D5D,0x6D5E, 0, 0, + 0, 0, 0, 0,0x6D5F, 0, 0,0x6D60, +0x6D61,0x6D62, 0,0x6D63}; + +static int +my_uni_jisx0212_onechar(int code){ + if ((code>=0x007E)&&(code<=0x007E)) + return(tab_uni_jisx02120[code-0x007E]); + if ((code>=0x00A1)&&(code<=0x017E)) + return(tab_uni_jisx02121[code-0x00A1]); + if ((code>=0x01CD)&&(code<=0x01DC)) + return(tab_uni_jisx02122[code-0x01CD]); + if ((code>=0x01F5)&&(code<=0x01F5)) + return(tab_uni_jisx02123[code-0x01F5]); + if ((code>=0x02C7)&&(code<=0x02DD)) + return(tab_uni_jisx02124[code-0x02C7]); + if ((code>=0x0384)&&(code<=0x0390)) + return(tab_uni_jisx02125[code-0x0384]); + if ((code>=0x03AA)&&(code<=0x03CE)) + return(tab_uni_jisx02126[code-0x03AA]); + if ((code>=0x0402)&&(code<=0x040F)) + return(tab_uni_jisx02127[code-0x0402]); + if ((code>=0x0452)&&(code<=0x045F)) + return(tab_uni_jisx02128[code-0x0452]); + if ((code>=0x2116)&&(code<=0x2122)) + return(tab_uni_jisx02129[code-0x2116]); + if ((code>=0x4E02)&&(code<=0x4F19)) + return(tab_uni_jisx021210[code-0x4E02]); + if ((code>=0x4F2E)&&(code<=0x5166)) + return(tab_uni_jisx021211[code-0x4F2E]); + if ((code>=0x517E)&&(code<=0x5515)) + return(tab_uni_jisx021212[code-0x517E]); + if ((code>=0x552A)&&(code<=0x5566)) + return(tab_uni_jisx021213[code-0x552A]); + if ((code>=0x557F)&&(code<=0x5C36)) + return(tab_uni_jisx021214[code-0x557F]); + if ((code>=0x5C59)&&(code<=0x5EEB)) + return(tab_uni_jisx021215[code-0x5C59]); + if ((code>=0x5F02)&&(code<=0x6149)) + return(tab_uni_jisx021216[code-0x5F02]); + if ((code>=0x615E)&&(code<=0x6290)) + return(tab_uni_jisx021217[code-0x615E]); + if ((code>=0x62A6)&&(code<=0x679B)) + return(tab_uni_jisx021218[code-0x62A6]); + if ((code>=0x67B0)&&(code<=0x67F9)) + return(tab_uni_jisx021219[code-0x67B0]); + if ((code>=0x6814)&&(code<=0x6917)) + return(tab_uni_jisx021220[code-0x6814]); + if ((code>=0x6931)&&(code<=0x6D3F)) + return(tab_uni_jisx021221[code-0x6931]); + if ((code>=0x6D57)&&(code<=0x6E04)) + return(tab_uni_jisx021222[code-0x6D57]); + if ((code>=0x6E1E)&&(code<=0x6ECF)) + return(tab_uni_jisx021223[code-0x6E1E]); + if ((code>=0x6EEB)&&(code<=0x70E4)) + return(tab_uni_jisx021224[code-0x6EEB]); + if ((code>=0x70FA)&&(code<=0x71DC)) + return(tab_uni_jisx021225[code-0x70FA]); + if ((code>=0x71F8)&&(code<=0x7E9E)) + return(tab_uni_jisx021226[code-0x71F8]); + if ((code>=0x7F3B)&&(code<=0x8044)) + return(tab_uni_jisx021227[code-0x7F3B]); + if ((code>=0x8060)&&(code<=0x8357)) + return(tab_uni_jisx021228[code-0x8060]); + if ((code>=0x8370)&&(code<=0x8419)) + return(tab_uni_jisx021229[code-0x8370]); + if ((code>=0x842F)&&(code<=0x8880)) + return(tab_uni_jisx021230[code-0x842F]); + if ((code>=0x8898)&&(code<=0x89BC)) + return(tab_uni_jisx021231[code-0x8898]); + if ((code>=0x89D4)&&(code<=0x8B9F)) + return(tab_uni_jisx021232[code-0x89D4]); + if ((code>=0x8C38)&&(code<=0x8CA4)) + return(tab_uni_jisx021233[code-0x8C38]); + if ((code>=0x8CB9)&&(code<=0x8D1B)) + return(tab_uni_jisx021234[code-0x8CB9]); + if ((code>=0x8D65)&&(code<=0x8F65)) + return(tab_uni_jisx021235[code-0x8D65]); + if ((code>=0x8F9D)&&(code<=0x9484)) + return(tab_uni_jisx021236[code-0x8F9D]); + if ((code>=0x9578)&&(code<=0x95E6)) + return(tab_uni_jisx021237[code-0x9578]); + if ((code>=0x961D)&&(code<=0x986C)) + return(tab_uni_jisx021238[code-0x961D]); + if ((code>=0x98AB)&&(code<=0x98CC)) + return(tab_uni_jisx021239[code-0x98AB]); + if ((code>=0x98E1)&&(code<=0x9960)) + return(tab_uni_jisx021240[code-0x98E1]); + if ((code>=0x999B)&&(code<=0x9A5D)) + return(tab_uni_jisx021241[code-0x999B]); + if ((code>=0x9AAA)&&(code<=0x9C7B)) + return(tab_uni_jisx021242[code-0x9AAA]); + if ((code>=0x9CE6)&&(code<=0x9E1D)) + return(tab_uni_jisx021243[code-0x9CE6]); + if ((code>=0x9E7A)&&(code<=0x9FA5)) + return(tab_uni_jisx021244[code-0x9E7A]); + return(0); +} + + +/* page 0 0x222F-0x2244 */ +static uint16 tab_jisx0212_uni0[]={ +0x02D8,0x02C7,0x00B8,0x02D9,0x02DD,0x00AF,0x02DB,0x02DA, +0x007E,0x0384,0x0385, 0, 0, 0, 0, 0, + 0, 0, 0,0x00A1,0x00A6,0x00BF}; + +/* page 1 0x226B-0x2271 */ +static uint16 tab_jisx0212_uni1[]={ +0x00BA,0x00AA,0x00A9,0x00AE,0x2122,0x00A4,0x2116}; + +/* page 2 0x2661-0x267C */ +static uint16 tab_jisx0212_uni2[]={ +0x0386,0x0388,0x0389,0x038A,0x03AA, 0,0x038C, 0, +0x038E,0x03AB, 0,0x038F, 0, 0, 0, 0, +0x03AC,0x03AD,0x03AE,0x03AF,0x03CA,0x0390,0x03CC,0x03C2, +0x03CD,0x03CB,0x03B0,0x03CE}; + +/* page 3 0x2742-0x274E */ +static uint16 tab_jisx0212_uni3[]={ +0x0402,0x0403,0x0404,0x0405,0x0406,0x0407,0x0408,0x0409, +0x040A,0x040B,0x040C,0x040E,0x040F}; + +/* page 4 0x2772-0x277E */ +static uint16 tab_jisx0212_uni4[]={ +0x0452,0x0453,0x0454,0x0455,0x0456,0x0457,0x0458,0x0459, +0x045A,0x045B,0x045C,0x045E,0x045F}; + +/* page 5 0x2921-0x2950 */ +static uint16 tab_jisx0212_uni5[]={ +0x00C6,0x0110, 0,0x0126, 0,0x0132, 0,0x0141, +0x013F, 0,0x014A,0x00D8,0x0152, 0,0x0166,0x00DE, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +0x00E6,0x0111,0x00F0,0x0127,0x0131,0x0133,0x0138,0x0142, +0x0140,0x0149,0x014B,0x00F8,0x0153,0x00DF,0x0167,0x00FE +}; + +/* page 6 0x2A21-0x2A77 */ +static uint16 tab_jisx0212_uni6[]={ +0x00C1,0x00C0,0x00C4,0x00C2,0x0102,0x01CD,0x0100,0x0104, +0x00C5,0x00C3,0x0106,0x0108,0x010C,0x00C7,0x010A,0x010E, +0x00C9,0x00C8,0x00CB,0x00CA,0x011A,0x0116,0x0112,0x0118, + 0,0x011C,0x011E,0x0122,0x0120,0x0124,0x00CD,0x00CC, +0x00CF,0x00CE,0x01CF,0x0130,0x012A,0x012E,0x0128,0x0134, +0x0136,0x0139,0x013D,0x013B,0x0143,0x0147,0x0145,0x00D1, +0x00D3,0x00D2,0x00D6,0x00D4,0x01D1,0x0150,0x014C,0x00D5, +0x0154,0x0158,0x0156,0x015A,0x015C,0x0160,0x015E,0x0164, +0x0162,0x00DA,0x00D9,0x00DC,0x00DB,0x016C,0x01D3,0x0170, +0x016A,0x0172,0x016E,0x0168,0x01D7,0x01DB,0x01D9,0x01D5, +0x0174,0x00DD,0x0178,0x0176,0x0179,0x017D,0x017B}; + +/* page 7 0x2B21-0x2B77 */ +static uint16 tab_jisx0212_uni7[]={ +0x00E1,0x00E0,0x00E4,0x00E2,0x0103,0x01CE,0x0101,0x0105, +0x00E5,0x00E3,0x0107,0x0109,0x010D,0x00E7,0x010B,0x010F, +0x00E9,0x00E8,0x00EB,0x00EA,0x011B,0x0117,0x0113,0x0119, +0x01F5,0x011D,0x011F, 0,0x0121,0x0125,0x00ED,0x00EC, +0x00EF,0x00EE,0x01D0, 0,0x012B,0x012F,0x0129,0x0135, +0x0137,0x013A,0x013E,0x013C,0x0144,0x0148,0x0146,0x00F1, +0x00F3,0x00F2,0x00F6,0x00F4,0x01D2,0x0151,0x014D,0x00F5, +0x0155,0x0159,0x0157,0x015B,0x015D,0x0161,0x015F,0x0165, +0x0163,0x00FA,0x00F9,0x00FC,0x00FB,0x016D,0x01D4,0x0171, +0x016B,0x0173,0x016F,0x0169,0x01D8,0x01DC,0x01DA,0x01D6, +0x0175,0x00FD,0x00FF,0x0177,0x017A,0x017E,0x017C}; + +/* page 8 0x3021-0x307E */ +static uint16 tab_jisx0212_uni8[]={ +0x4E02,0x4E04,0x4E05,0x4E0C,0x4E12,0x4E1F,0x4E23,0x4E24, +0x4E28,0x4E2B,0x4E2E,0x4E2F,0x4E30,0x4E35,0x4E40,0x4E41, +0x4E44,0x4E47,0x4E51,0x4E5A,0x4E5C,0x4E63,0x4E68,0x4E69, +0x4E74,0x4E75,0x4E79,0x4E7F,0x4E8D,0x4E96,0x4E97,0x4E9D, +0x4EAF,0x4EB9,0x4EC3,0x4ED0,0x4EDA,0x4EDB,0x4EE0,0x4EE1, +0x4EE2,0x4EE8,0x4EEF,0x4EF1,0x4EF3,0x4EF5,0x4EFD,0x4EFE, +0x4EFF,0x4F00,0x4F02,0x4F03,0x4F08,0x4F0B,0x4F0C,0x4F12, +0x4F15,0x4F16,0x4F17,0x4F19,0x4F2E,0x4F31,0x4F60,0x4F33, +0x4F35,0x4F37,0x4F39,0x4F3B,0x4F3E,0x4F40,0x4F42,0x4F48, +0x4F49,0x4F4B,0x4F4C,0x4F52,0x4F54,0x4F56,0x4F58,0x4F5F, +0x4F63,0x4F6A,0x4F6C,0x4F6E,0x4F71,0x4F77,0x4F78,0x4F79, +0x4F7A,0x4F7D,0x4F7E,0x4F81,0x4F82,0x4F84}; + +/* page 9 0x3121-0x317E */ +static uint16 tab_jisx0212_uni9[]={ +0x4F85,0x4F89,0x4F8A,0x4F8C,0x4F8E,0x4F90,0x4F92,0x4F93, +0x4F94,0x4F97,0x4F99,0x4F9A,0x4F9E,0x4F9F,0x4FB2,0x4FB7, +0x4FB9,0x4FBB,0x4FBC,0x4FBD,0x4FBE,0x4FC0,0x4FC1,0x4FC5, +0x4FC6,0x4FC8,0x4FC9,0x4FCB,0x4FCC,0x4FCD,0x4FCF,0x4FD2, +0x4FDC,0x4FE0,0x4FE2,0x4FF0,0x4FF2,0x4FFC,0x4FFD,0x4FFF, +0x5000,0x5001,0x5004,0x5007,0x500A,0x500C,0x500E,0x5010, +0x5013,0x5017,0x5018,0x501B,0x501C,0x501D,0x501E,0x5022, +0x5027,0x502E,0x5030,0x5032,0x5033,0x5035,0x5040,0x5041, +0x5042,0x5045,0x5046,0x504A,0x504C,0x504E,0x5051,0x5052, +0x5053,0x5057,0x5059,0x505F,0x5060,0x5062,0x5063,0x5066, +0x5067,0x506A,0x506D,0x5070,0x5071,0x503B,0x5081,0x5083, +0x5084,0x5086,0x508A,0x508E,0x508F,0x5090}; + +/* page 10 0x3221-0x327E */ +static uint16 tab_jisx0212_uni10[]={ +0x5092,0x5093,0x5094,0x5096,0x509B,0x509C,0x509E,0x509F, +0x50A0,0x50A1,0x50A2,0x50AA,0x50AF,0x50B0,0x50B9,0x50BA, +0x50BD,0x50C0,0x50C3,0x50C4,0x50C7,0x50CC,0x50CE,0x50D0, +0x50D3,0x50D4,0x50D8,0x50DC,0x50DD,0x50DF,0x50E2,0x50E4, +0x50E6,0x50E8,0x50E9,0x50EF,0x50F1,0x50F6,0x50FA,0x50FE, +0x5103,0x5106,0x5107,0x5108,0x510B,0x510C,0x510D,0x510E, +0x50F2,0x5110,0x5117,0x5119,0x511B,0x511C,0x511D,0x511E, +0x5123,0x5127,0x5128,0x512C,0x512D,0x512F,0x5131,0x5133, +0x5134,0x5135,0x5138,0x5139,0x5142,0x514A,0x514F,0x5153, +0x5155,0x5157,0x5158,0x515F,0x5164,0x5166,0x517E,0x5183, +0x5184,0x518B,0x518E,0x5198,0x519D,0x51A1,0x51A3,0x51AD, +0x51B8,0x51BA,0x51BC,0x51BE,0x51BF,0x51C2}; + +/* page 11 0x3321-0x337E */ +static uint16 tab_jisx0212_uni11[]={ +0x51C8,0x51CF,0x51D1,0x51D2,0x51D3,0x51D5,0x51D8,0x51DE, +0x51E2,0x51E5,0x51EE,0x51F2,0x51F3,0x51F4,0x51F7,0x5201, +0x5202,0x5205,0x5212,0x5213,0x5215,0x5216,0x5218,0x5222, +0x5228,0x5231,0x5232,0x5235,0x523C,0x5245,0x5249,0x5255, +0x5257,0x5258,0x525A,0x525C,0x525F,0x5260,0x5261,0x5266, +0x526E,0x5277,0x5278,0x5279,0x5280,0x5282,0x5285,0x528A, +0x528C,0x5293,0x5295,0x5296,0x5297,0x5298,0x529A,0x529C, +0x52A4,0x52A5,0x52A6,0x52A7,0x52AF,0x52B0,0x52B6,0x52B7, +0x52B8,0x52BA,0x52BB,0x52BD,0x52C0,0x52C4,0x52C6,0x52C8, +0x52CC,0x52CF,0x52D1,0x52D4,0x52D6,0x52DB,0x52DC,0x52E1, +0x52E5,0x52E8,0x52E9,0x52EA,0x52EC,0x52F0,0x52F1,0x52F4, +0x52F6,0x52F7,0x5300,0x5303,0x530A,0x530B}; + +/* page 12 0x3421-0x347E */ +static uint16 tab_jisx0212_uni12[]={ +0x530C,0x5311,0x5313,0x5318,0x531B,0x531C,0x531E,0x531F, +0x5325,0x5327,0x5328,0x5329,0x532B,0x532C,0x532D,0x5330, +0x5332,0x5335,0x533C,0x533D,0x533E,0x5342,0x534C,0x534B, +0x5359,0x535B,0x5361,0x5363,0x5365,0x536C,0x536D,0x5372, +0x5379,0x537E,0x5383,0x5387,0x5388,0x538E,0x5393,0x5394, +0x5399,0x539D,0x53A1,0x53A4,0x53AA,0x53AB,0x53AF,0x53B2, +0x53B4,0x53B5,0x53B7,0x53B8,0x53BA,0x53BD,0x53C0,0x53C5, +0x53CF,0x53D2,0x53D3,0x53D5,0x53DA,0x53DD,0x53DE,0x53E0, +0x53E6,0x53E7,0x53F5,0x5402,0x5413,0x541A,0x5421,0x5427, +0x5428,0x542A,0x542F,0x5431,0x5434,0x5435,0x5443,0x5444, +0x5447,0x544D,0x544F,0x545E,0x5462,0x5464,0x5466,0x5467, +0x5469,0x546B,0x546D,0x546E,0x5474,0x547F}; + +/* page 13 0x3521-0x357E */ +static uint16 tab_jisx0212_uni13[]={ +0x5481,0x5483,0x5485,0x5488,0x5489,0x548D,0x5491,0x5495, +0x5496,0x549C,0x549F,0x54A1,0x54A6,0x54A7,0x54A9,0x54AA, +0x54AD,0x54AE,0x54B1,0x54B7,0x54B9,0x54BA,0x54BB,0x54BF, +0x54C6,0x54CA,0x54CD,0x54CE,0x54E0,0x54EA,0x54EC,0x54EF, +0x54F6,0x54FC,0x54FE,0x54FF,0x5500,0x5501,0x5505,0x5508, +0x5509,0x550C,0x550D,0x550E,0x5515,0x552A,0x552B,0x5532, +0x5535,0x5536,0x553B,0x553C,0x553D,0x5541,0x5547,0x5549, +0x554A,0x554D,0x5550,0x5551,0x5558,0x555A,0x555B,0x555E, +0x5560,0x5561,0x5564,0x5566,0x557F,0x5581,0x5582,0x5586, +0x5588,0x558E,0x558F,0x5591,0x5592,0x5593,0x5594,0x5597, +0x55A3,0x55A4,0x55AD,0x55B2,0x55BF,0x55C1,0x55C3,0x55C6, +0x55C9,0x55CB,0x55CC,0x55CE,0x55D1,0x55D2}; + +/* page 14 0x3621-0x367E */ +static uint16 tab_jisx0212_uni14[]={ +0x55D3,0x55D7,0x55D8,0x55DB,0x55DE,0x55E2,0x55E9,0x55F6, +0x55FF,0x5605,0x5608,0x560A,0x560D,0x560E,0x560F,0x5610, +0x5611,0x5612,0x5619,0x562C,0x5630,0x5633,0x5635,0x5637, +0x5639,0x563B,0x563C,0x563D,0x563F,0x5640,0x5641,0x5643, +0x5644,0x5646,0x5649,0x564B,0x564D,0x564F,0x5654,0x565E, +0x5660,0x5661,0x5662,0x5663,0x5666,0x5669,0x566D,0x566F, +0x5671,0x5672,0x5675,0x5684,0x5685,0x5688,0x568B,0x568C, +0x5695,0x5699,0x569A,0x569D,0x569E,0x569F,0x56A6,0x56A7, +0x56A8,0x56A9,0x56AB,0x56AC,0x56AD,0x56B1,0x56B3,0x56B7, +0x56BE,0x56C5,0x56C9,0x56CA,0x56CB,0x56CF,0x56D0,0x56CC, +0x56CD,0x56D9,0x56DC,0x56DD,0x56DF,0x56E1,0x56E4,0x56E5, +0x56E6,0x56E7,0x56E8,0x56F1,0x56EB,0x56ED}; + +/* page 15 0x3721-0x377E */ +static uint16 tab_jisx0212_uni15[]={ +0x56F6,0x56F7,0x5701,0x5702,0x5707,0x570A,0x570C,0x5711, +0x5715,0x571A,0x571B,0x571D,0x5720,0x5722,0x5723,0x5724, +0x5725,0x5729,0x572A,0x572C,0x572E,0x572F,0x5733,0x5734, +0x573D,0x573E,0x573F,0x5745,0x5746,0x574C,0x574D,0x5752, +0x5762,0x5765,0x5767,0x5768,0x576B,0x576D,0x576E,0x576F, +0x5770,0x5771,0x5773,0x5774,0x5775,0x5777,0x5779,0x577A, +0x577B,0x577C,0x577E,0x5781,0x5783,0x578C,0x5794,0x5797, +0x5799,0x579A,0x579C,0x579D,0x579E,0x579F,0x57A1,0x5795, +0x57A7,0x57A8,0x57A9,0x57AC,0x57B8,0x57BD,0x57C7,0x57C8, +0x57CC,0x57CF,0x57D5,0x57DD,0x57DE,0x57E4,0x57E6,0x57E7, +0x57E9,0x57ED,0x57F0,0x57F5,0x57F6,0x57F8,0x57FD,0x57FE, +0x57FF,0x5803,0x5804,0x5808,0x5809,0x57E1}; + +/* page 16 0x3821-0x387E */ +static uint16 tab_jisx0212_uni16[]={ +0x580C,0x580D,0x581B,0x581E,0x581F,0x5820,0x5826,0x5827, +0x582D,0x5832,0x5839,0x583F,0x5849,0x584C,0x584D,0x584F, +0x5850,0x5855,0x585F,0x5861,0x5864,0x5867,0x5868,0x5878, +0x587C,0x587F,0x5880,0x5881,0x5887,0x5888,0x5889,0x588A, +0x588C,0x588D,0x588F,0x5890,0x5894,0x5896,0x589D,0x58A0, +0x58A1,0x58A2,0x58A6,0x58A9,0x58B1,0x58B2,0x58C4,0x58BC, +0x58C2,0x58C8,0x58CD,0x58CE,0x58D0,0x58D2,0x58D4,0x58D6, +0x58DA,0x58DD,0x58E1,0x58E2,0x58E9,0x58F3,0x5905,0x5906, +0x590B,0x590C,0x5912,0x5913,0x5914,0x8641,0x591D,0x5921, +0x5923,0x5924,0x5928,0x592F,0x5930,0x5933,0x5935,0x5936, +0x593F,0x5943,0x5946,0x5952,0x5953,0x5959,0x595B,0x595D, +0x595E,0x595F,0x5961,0x5963,0x596B,0x596D}; + +/* page 17 0x3921-0x397E */ +static uint16 tab_jisx0212_uni17[]={ +0x596F,0x5972,0x5975,0x5976,0x5979,0x597B,0x597C,0x598B, +0x598C,0x598E,0x5992,0x5995,0x5997,0x599F,0x59A4,0x59A7, +0x59AD,0x59AE,0x59AF,0x59B0,0x59B3,0x59B7,0x59BA,0x59BC, +0x59C1,0x59C3,0x59C4,0x59C8,0x59CA,0x59CD,0x59D2,0x59DD, +0x59DE,0x59DF,0x59E3,0x59E4,0x59E7,0x59EE,0x59EF,0x59F1, +0x59F2,0x59F4,0x59F7,0x5A00,0x5A04,0x5A0C,0x5A0D,0x5A0E, +0x5A12,0x5A13,0x5A1E,0x5A23,0x5A24,0x5A27,0x5A28,0x5A2A, +0x5A2D,0x5A30,0x5A44,0x5A45,0x5A47,0x5A48,0x5A4C,0x5A50, +0x5A55,0x5A5E,0x5A63,0x5A65,0x5A67,0x5A6D,0x5A77,0x5A7A, +0x5A7B,0x5A7E,0x5A8B,0x5A90,0x5A93,0x5A96,0x5A99,0x5A9C, +0x5A9E,0x5A9F,0x5AA0,0x5AA2,0x5AA7,0x5AAC,0x5AB1,0x5AB2, +0x5AB3,0x5AB5,0x5AB8,0x5ABA,0x5ABB,0x5ABF}; + +/* page 18 0x3A21-0x3A7E */ +static uint16 tab_jisx0212_uni18[]={ +0x5AC4,0x5AC6,0x5AC8,0x5ACF,0x5ADA,0x5ADC,0x5AE0,0x5AE5, +0x5AEA,0x5AEE,0x5AF5,0x5AF6,0x5AFD,0x5B00,0x5B01,0x5B08, +0x5B17,0x5B34,0x5B19,0x5B1B,0x5B1D,0x5B21,0x5B25,0x5B2D, +0x5B38,0x5B41,0x5B4B,0x5B4C,0x5B52,0x5B56,0x5B5E,0x5B68, +0x5B6E,0x5B6F,0x5B7C,0x5B7D,0x5B7E,0x5B7F,0x5B81,0x5B84, +0x5B86,0x5B8A,0x5B8E,0x5B90,0x5B91,0x5B93,0x5B94,0x5B96, +0x5BA8,0x5BA9,0x5BAC,0x5BAD,0x5BAF,0x5BB1,0x5BB2,0x5BB7, +0x5BBA,0x5BBC,0x5BC0,0x5BC1,0x5BCD,0x5BCF,0x5BD6,0x5BD7, +0x5BD8,0x5BD9,0x5BDA,0x5BE0,0x5BEF,0x5BF1,0x5BF4,0x5BFD, +0x5C0C,0x5C17,0x5C1E,0x5C1F,0x5C23,0x5C26,0x5C29,0x5C2B, +0x5C2C,0x5C2E,0x5C30,0x5C32,0x5C35,0x5C36,0x5C59,0x5C5A, +0x5C5C,0x5C62,0x5C63,0x5C67,0x5C68,0x5C69}; + +/* page 19 0x3B21-0x3B7E */ +static uint16 tab_jisx0212_uni19[]={ +0x5C6D,0x5C70,0x5C74,0x5C75,0x5C7A,0x5C7B,0x5C7C,0x5C7D, +0x5C87,0x5C88,0x5C8A,0x5C8F,0x5C92,0x5C9D,0x5C9F,0x5CA0, +0x5CA2,0x5CA3,0x5CA6,0x5CAA,0x5CB2,0x5CB4,0x5CB5,0x5CBA, +0x5CC9,0x5CCB,0x5CD2,0x5CDD,0x5CD7,0x5CEE,0x5CF1,0x5CF2, +0x5CF4,0x5D01,0x5D06,0x5D0D,0x5D12,0x5D2B,0x5D23,0x5D24, +0x5D26,0x5D27,0x5D31,0x5D34,0x5D39,0x5D3D,0x5D3F,0x5D42, +0x5D43,0x5D46,0x5D48,0x5D55,0x5D51,0x5D59,0x5D4A,0x5D5F, +0x5D60,0x5D61,0x5D62,0x5D64,0x5D6A,0x5D6D,0x5D70,0x5D79, +0x5D7A,0x5D7E,0x5D7F,0x5D81,0x5D83,0x5D88,0x5D8A,0x5D92, +0x5D93,0x5D94,0x5D95,0x5D99,0x5D9B,0x5D9F,0x5DA0,0x5DA7, +0x5DAB,0x5DB0,0x5DB4,0x5DB8,0x5DB9,0x5DC3,0x5DC7,0x5DCB, +0x5DD0,0x5DCE,0x5DD8,0x5DD9,0x5DE0,0x5DE4}; + +/* page 20 0x3C21-0x3C7E */ +static uint16 tab_jisx0212_uni20[]={ +0x5DE9,0x5DF8,0x5DF9,0x5E00,0x5E07,0x5E0D,0x5E12,0x5E14, +0x5E15,0x5E18,0x5E1F,0x5E20,0x5E2E,0x5E28,0x5E32,0x5E35, +0x5E3E,0x5E4B,0x5E50,0x5E49,0x5E51,0x5E56,0x5E58,0x5E5B, +0x5E5C,0x5E5E,0x5E68,0x5E6A,0x5E6B,0x5E6C,0x5E6D,0x5E6E, +0x5E70,0x5E80,0x5E8B,0x5E8E,0x5EA2,0x5EA4,0x5EA5,0x5EA8, +0x5EAA,0x5EAC,0x5EB1,0x5EB3,0x5EBD,0x5EBE,0x5EBF,0x5EC6, +0x5ECC,0x5ECB,0x5ECE,0x5ED1,0x5ED2,0x5ED4,0x5ED5,0x5EDC, +0x5EDE,0x5EE5,0x5EEB,0x5F02,0x5F06,0x5F07,0x5F08,0x5F0E, +0x5F19,0x5F1C,0x5F1D,0x5F21,0x5F22,0x5F23,0x5F24,0x5F28, +0x5F2B,0x5F2C,0x5F2E,0x5F30,0x5F34,0x5F36,0x5F3B,0x5F3D, +0x5F3F,0x5F40,0x5F44,0x5F45,0x5F47,0x5F4D,0x5F50,0x5F54, +0x5F58,0x5F5B,0x5F60,0x5F63,0x5F64,0x5F67}; + +/* page 21 0x3D21-0x3D7E */ +static uint16 tab_jisx0212_uni21[]={ +0x5F6F,0x5F72,0x5F74,0x5F75,0x5F78,0x5F7A,0x5F7D,0x5F7E, +0x5F89,0x5F8D,0x5F8F,0x5F96,0x5F9C,0x5F9D,0x5FA2,0x5FA7, +0x5FAB,0x5FA4,0x5FAC,0x5FAF,0x5FB0,0x5FB1,0x5FB8,0x5FC4, +0x5FC7,0x5FC8,0x5FC9,0x5FCB,0x5FD0,0x5FD1,0x5FD2,0x5FD3, +0x5FD4,0x5FDE,0x5FE1,0x5FE2,0x5FE8,0x5FE9,0x5FEA,0x5FEC, +0x5FED,0x5FEE,0x5FEF,0x5FF2,0x5FF3,0x5FF6,0x5FFA,0x5FFC, +0x6007,0x600A,0x600D,0x6013,0x6014,0x6017,0x6018,0x601A, +0x601F,0x6024,0x602D,0x6033,0x6035,0x6040,0x6047,0x6048, +0x6049,0x604C,0x6051,0x6054,0x6056,0x6057,0x605D,0x6061, +0x6067,0x6071,0x607E,0x607F,0x6082,0x6086,0x6088,0x608A, +0x608E,0x6091,0x6093,0x6095,0x6098,0x609D,0x609E,0x60A2, +0x60A4,0x60A5,0x60A8,0x60B0,0x60B1,0x60B7}; + +/* page 22 0x3E21-0x3E7E */ +static uint16 tab_jisx0212_uni22[]={ +0x60BB,0x60BE,0x60C2,0x60C4,0x60C8,0x60C9,0x60CA,0x60CB, +0x60CE,0x60CF,0x60D4,0x60D5,0x60D9,0x60DB,0x60DD,0x60DE, +0x60E2,0x60E5,0x60F2,0x60F5,0x60F8,0x60FC,0x60FD,0x6102, +0x6107,0x610A,0x610C,0x6110,0x6111,0x6112,0x6113,0x6114, +0x6116,0x6117,0x6119,0x611C,0x611E,0x6122,0x612A,0x612B, +0x6130,0x6131,0x6135,0x6136,0x6137,0x6139,0x6141,0x6145, +0x6146,0x6149,0x615E,0x6160,0x616C,0x6172,0x6178,0x617B, +0x617C,0x617F,0x6180,0x6181,0x6183,0x6184,0x618B,0x618D, +0x6192,0x6193,0x6197,0x6198,0x619C,0x619D,0x619F,0x61A0, +0x61A5,0x61A8,0x61AA,0x61AD,0x61B8,0x61B9,0x61BC,0x61C0, +0x61C1,0x61C2,0x61CE,0x61CF,0x61D5,0x61DC,0x61DD,0x61DE, +0x61DF,0x61E1,0x61E2,0x61E7,0x61E9,0x61E5}; + +/* page 23 0x3F21-0x3F7E */ +static uint16 tab_jisx0212_uni23[]={ +0x61EC,0x61ED,0x61EF,0x6201,0x6203,0x6204,0x6207,0x6213, +0x6215,0x621C,0x6220,0x6222,0x6223,0x6227,0x6229,0x622B, +0x6239,0x623D,0x6242,0x6243,0x6244,0x6246,0x624C,0x6250, +0x6251,0x6252,0x6254,0x6256,0x625A,0x625C,0x6264,0x626D, +0x626F,0x6273,0x627A,0x627D,0x628D,0x628E,0x628F,0x6290, +0x62A6,0x62A8,0x62B3,0x62B6,0x62B7,0x62BA,0x62BE,0x62BF, +0x62C4,0x62CE,0x62D5,0x62D6,0x62DA,0x62EA,0x62F2,0x62F4, +0x62FC,0x62FD,0x6303,0x6304,0x630A,0x630B,0x630D,0x6310, +0x6313,0x6316,0x6318,0x6329,0x632A,0x632D,0x6335,0x6336, +0x6339,0x633C,0x6341,0x6342,0x6343,0x6344,0x6346,0x634A, +0x634B,0x634E,0x6352,0x6353,0x6354,0x6358,0x635B,0x6365, +0x6366,0x636C,0x636D,0x6371,0x6374,0x6375}; + +/* page 24 0x4021-0x407E */ +static uint16 tab_jisx0212_uni24[]={ +0x6378,0x637C,0x637D,0x637F,0x6382,0x6384,0x6387,0x638A, +0x6390,0x6394,0x6395,0x6399,0x639A,0x639E,0x63A4,0x63A6, +0x63AD,0x63AE,0x63AF,0x63BD,0x63C1,0x63C5,0x63C8,0x63CE, +0x63D1,0x63D3,0x63D4,0x63D5,0x63DC,0x63E0,0x63E5,0x63EA, +0x63EC,0x63F2,0x63F3,0x63F5,0x63F8,0x63F9,0x6409,0x640A, +0x6410,0x6412,0x6414,0x6418,0x641E,0x6420,0x6422,0x6424, +0x6425,0x6429,0x642A,0x642F,0x6430,0x6435,0x643D,0x643F, +0x644B,0x644F,0x6451,0x6452,0x6453,0x6454,0x645A,0x645B, +0x645C,0x645D,0x645F,0x6460,0x6461,0x6463,0x646D,0x6473, +0x6474,0x647B,0x647D,0x6485,0x6487,0x648F,0x6490,0x6491, +0x6498,0x6499,0x649B,0x649D,0x649F,0x64A1,0x64A3,0x64A6, +0x64A8,0x64AC,0x64B3,0x64BD,0x64BE,0x64BF}; + +/* page 25 0x4121-0x417E */ +static uint16 tab_jisx0212_uni25[]={ +0x64C4,0x64C9,0x64CA,0x64CB,0x64CC,0x64CE,0x64D0,0x64D1, +0x64D5,0x64D7,0x64E4,0x64E5,0x64E9,0x64EA,0x64ED,0x64F0, +0x64F5,0x64F7,0x64FB,0x64FF,0x6501,0x6504,0x6508,0x6509, +0x650A,0x650F,0x6513,0x6514,0x6516,0x6519,0x651B,0x651E, +0x651F,0x6522,0x6526,0x6529,0x652E,0x6531,0x653A,0x653C, +0x653D,0x6543,0x6547,0x6549,0x6550,0x6552,0x6554,0x655F, +0x6560,0x6567,0x656B,0x657A,0x657D,0x6581,0x6585,0x658A, +0x6592,0x6595,0x6598,0x659D,0x65A0,0x65A3,0x65A6,0x65AE, +0x65B2,0x65B3,0x65B4,0x65BF,0x65C2,0x65C8,0x65C9,0x65CE, +0x65D0,0x65D4,0x65D6,0x65D8,0x65DF,0x65F0,0x65F2,0x65F4, +0x65F5,0x65F9,0x65FE,0x65FF,0x6600,0x6604,0x6608,0x6609, +0x660D,0x6611,0x6612,0x6615,0x6616,0x661D}; + +/* page 26 0x4221-0x427E */ +static uint16 tab_jisx0212_uni26[]={ +0x661E,0x6621,0x6622,0x6623,0x6624,0x6626,0x6629,0x662A, +0x662B,0x662C,0x662E,0x6630,0x6631,0x6633,0x6639,0x6637, +0x6640,0x6645,0x6646,0x664A,0x664C,0x6651,0x664E,0x6657, +0x6658,0x6659,0x665B,0x665C,0x6660,0x6661,0x66FB,0x666A, +0x666B,0x666C,0x667E,0x6673,0x6675,0x667F,0x6677,0x6678, +0x6679,0x667B,0x6680,0x667C,0x668B,0x668C,0x668D,0x6690, +0x6692,0x6699,0x669A,0x669B,0x669C,0x669F,0x66A0,0x66A4, +0x66AD,0x66B1,0x66B2,0x66B5,0x66BB,0x66BF,0x66C0,0x66C2, +0x66C3,0x66C8,0x66CC,0x66CE,0x66CF,0x66D4,0x66DB,0x66DF, +0x66E8,0x66EB,0x66EC,0x66EE,0x66FA,0x6705,0x6707,0x670E, +0x6713,0x6719,0x671C,0x6720,0x6722,0x6733,0x673E,0x6745, +0x6747,0x6748,0x674C,0x6754,0x6755,0x675D}; + +/* page 27 0x4321-0x437E */ +static uint16 tab_jisx0212_uni27[]={ +0x6766,0x676C,0x676E,0x6774,0x6776,0x677B,0x6781,0x6784, +0x678E,0x678F,0x6791,0x6793,0x6796,0x6798,0x6799,0x679B, +0x67B0,0x67B1,0x67B2,0x67B5,0x67BB,0x67BC,0x67BD,0x67F9, +0x67C0,0x67C2,0x67C3,0x67C5,0x67C8,0x67C9,0x67D2,0x67D7, +0x67D9,0x67DC,0x67E1,0x67E6,0x67F0,0x67F2,0x67F6,0x67F7, +0x6852,0x6814,0x6819,0x681D,0x681F,0x6828,0x6827,0x682C, +0x682D,0x682F,0x6830,0x6831,0x6833,0x683B,0x683F,0x6844, +0x6845,0x684A,0x684C,0x6855,0x6857,0x6858,0x685B,0x686B, +0x686E,0x686F,0x6870,0x6871,0x6872,0x6875,0x6879,0x687A, +0x687B,0x687C,0x6882,0x6884,0x6886,0x6888,0x6896,0x6898, +0x689A,0x689C,0x68A1,0x68A3,0x68A5,0x68A9,0x68AA,0x68AE, +0x68B2,0x68BB,0x68C5,0x68C8,0x68CC,0x68CF}; + +/* page 28 0x4421-0x447E */ +static uint16 tab_jisx0212_uni28[]={ +0x68D0,0x68D1,0x68D3,0x68D6,0x68D9,0x68DC,0x68DD,0x68E5, +0x68E8,0x68EA,0x68EB,0x68EC,0x68ED,0x68F0,0x68F1,0x68F5, +0x68F6,0x68FB,0x68FC,0x68FD,0x6906,0x6909,0x690A,0x6910, +0x6911,0x6913,0x6916,0x6917,0x6931,0x6933,0x6935,0x6938, +0x693B,0x6942,0x6945,0x6949,0x694E,0x6957,0x695B,0x6963, +0x6964,0x6965,0x6966,0x6968,0x6969,0x696C,0x6970,0x6971, +0x6972,0x697A,0x697B,0x697F,0x6980,0x698D,0x6992,0x6996, +0x6998,0x69A1,0x69A5,0x69A6,0x69A8,0x69AB,0x69AD,0x69AF, +0x69B7,0x69B8,0x69BA,0x69BC,0x69C5,0x69C8,0x69D1,0x69D6, +0x69D7,0x69E2,0x69E5,0x69EE,0x69EF,0x69F1,0x69F3,0x69F5, +0x69FE,0x6A00,0x6A01,0x6A03,0x6A0F,0x6A11,0x6A15,0x6A1A, +0x6A1D,0x6A20,0x6A24,0x6A28,0x6A30,0x6A32}; + +/* page 29 0x4521-0x457E */ +static uint16 tab_jisx0212_uni29[]={ +0x6A34,0x6A37,0x6A3B,0x6A3E,0x6A3F,0x6A45,0x6A46,0x6A49, +0x6A4A,0x6A4E,0x6A50,0x6A51,0x6A52,0x6A55,0x6A56,0x6A5B, +0x6A64,0x6A67,0x6A6A,0x6A71,0x6A73,0x6A7E,0x6A81,0x6A83, +0x6A86,0x6A87,0x6A89,0x6A8B,0x6A91,0x6A9B,0x6A9D,0x6A9E, +0x6A9F,0x6AA5,0x6AAB,0x6AAF,0x6AB0,0x6AB1,0x6AB4,0x6ABD, +0x6ABE,0x6ABF,0x6AC6,0x6AC9,0x6AC8,0x6ACC,0x6AD0,0x6AD4, +0x6AD5,0x6AD6,0x6ADC,0x6ADD,0x6AE4,0x6AE7,0x6AEC,0x6AF0, +0x6AF1,0x6AF2,0x6AFC,0x6AFD,0x6B02,0x6B03,0x6B06,0x6B07, +0x6B09,0x6B0F,0x6B10,0x6B11,0x6B17,0x6B1B,0x6B1E,0x6B24, +0x6B28,0x6B2B,0x6B2C,0x6B2F,0x6B35,0x6B36,0x6B3B,0x6B3F, +0x6B46,0x6B4A,0x6B4D,0x6B52,0x6B56,0x6B58,0x6B5D,0x6B60, +0x6B67,0x6B6B,0x6B6E,0x6B70,0x6B75,0x6B7D}; + +/* page 30 0x4621-0x467E */ +static uint16 tab_jisx0212_uni30[]={ +0x6B7E,0x6B82,0x6B85,0x6B97,0x6B9B,0x6B9F,0x6BA0,0x6BA2, +0x6BA3,0x6BA8,0x6BA9,0x6BAC,0x6BAD,0x6BAE,0x6BB0,0x6BB8, +0x6BB9,0x6BBD,0x6BBE,0x6BC3,0x6BC4,0x6BC9,0x6BCC,0x6BD6, +0x6BDA,0x6BE1,0x6BE3,0x6BE6,0x6BE7,0x6BEE,0x6BF1,0x6BF7, +0x6BF9,0x6BFF,0x6C02,0x6C04,0x6C05,0x6C09,0x6C0D,0x6C0E, +0x6C10,0x6C12,0x6C19,0x6C1F,0x6C26,0x6C27,0x6C28,0x6C2C, +0x6C2E,0x6C33,0x6C35,0x6C36,0x6C3A,0x6C3B,0x6C3F,0x6C4A, +0x6C4B,0x6C4D,0x6C4F,0x6C52,0x6C54,0x6C59,0x6C5B,0x6C5C, +0x6C6B,0x6C6D,0x6C6F,0x6C74,0x6C76,0x6C78,0x6C79,0x6C7B, +0x6C85,0x6C86,0x6C87,0x6C89,0x6C94,0x6C95,0x6C97,0x6C98, +0x6C9C,0x6C9F,0x6CB0,0x6CB2,0x6CB4,0x6CC2,0x6CC6,0x6CCD, +0x6CCF,0x6CD0,0x6CD1,0x6CD2,0x6CD4,0x6CD6}; + +/* page 31 0x4721-0x477E */ +static uint16 tab_jisx0212_uni31[]={ +0x6CDA,0x6CDC,0x6CE0,0x6CE7,0x6CE9,0x6CEB,0x6CEC,0x6CEE, +0x6CF2,0x6CF4,0x6D04,0x6D07,0x6D0A,0x6D0E,0x6D0F,0x6D11, +0x6D13,0x6D1A,0x6D26,0x6D27,0x6D28,0x6C67,0x6D2E,0x6D2F, +0x6D31,0x6D39,0x6D3C,0x6D3F,0x6D57,0x6D5E,0x6D5F,0x6D61, +0x6D65,0x6D67,0x6D6F,0x6D70,0x6D7C,0x6D82,0x6D87,0x6D91, +0x6D92,0x6D94,0x6D96,0x6D97,0x6D98,0x6DAA,0x6DAC,0x6DB4, +0x6DB7,0x6DB9,0x6DBD,0x6DBF,0x6DC4,0x6DC8,0x6DCA,0x6DCE, +0x6DCF,0x6DD6,0x6DDB,0x6DDD,0x6DDF,0x6DE0,0x6DE2,0x6DE5, +0x6DE9,0x6DEF,0x6DF0,0x6DF4,0x6DF6,0x6DFC,0x6E00,0x6E04, +0x6E1E,0x6E22,0x6E27,0x6E32,0x6E36,0x6E39,0x6E3B,0x6E3C, +0x6E44,0x6E45,0x6E48,0x6E49,0x6E4B,0x6E4F,0x6E51,0x6E52, +0x6E53,0x6E54,0x6E57,0x6E5C,0x6E5D,0x6E5E}; + +/* page 32 0x4821-0x487E */ +static uint16 tab_jisx0212_uni32[]={ +0x6E62,0x6E63,0x6E68,0x6E73,0x6E7B,0x6E7D,0x6E8D,0x6E93, +0x6E99,0x6EA0,0x6EA7,0x6EAD,0x6EAE,0x6EB1,0x6EB3,0x6EBB, +0x6EBF,0x6EC0,0x6EC1,0x6EC3,0x6EC7,0x6EC8,0x6ECA,0x6ECD, +0x6ECE,0x6ECF,0x6EEB,0x6EED,0x6EEE,0x6EF9,0x6EFB,0x6EFD, +0x6F04,0x6F08,0x6F0A,0x6F0C,0x6F0D,0x6F16,0x6F18,0x6F1A, +0x6F1B,0x6F26,0x6F29,0x6F2A,0x6F2F,0x6F30,0x6F33,0x6F36, +0x6F3B,0x6F3C,0x6F2D,0x6F4F,0x6F51,0x6F52,0x6F53,0x6F57, +0x6F59,0x6F5A,0x6F5D,0x6F5E,0x6F61,0x6F62,0x6F68,0x6F6C, +0x6F7D,0x6F7E,0x6F83,0x6F87,0x6F88,0x6F8B,0x6F8C,0x6F8D, +0x6F90,0x6F92,0x6F93,0x6F94,0x6F96,0x6F9A,0x6F9F,0x6FA0, +0x6FA5,0x6FA6,0x6FA7,0x6FA8,0x6FAE,0x6FAF,0x6FB0,0x6FB5, +0x6FB6,0x6FBC,0x6FC5,0x6FC7,0x6FC8,0x6FCA}; + +/* page 33 0x4921-0x497E */ +static uint16 tab_jisx0212_uni33[]={ +0x6FDA,0x6FDE,0x6FE8,0x6FE9,0x6FF0,0x6FF5,0x6FF9,0x6FFC, +0x6FFD,0x7000,0x7005,0x7006,0x7007,0x700D,0x7017,0x7020, +0x7023,0x702F,0x7034,0x7037,0x7039,0x703C,0x7043,0x7044, +0x7048,0x7049,0x704A,0x704B,0x7054,0x7055,0x705D,0x705E, +0x704E,0x7064,0x7065,0x706C,0x706E,0x7075,0x7076,0x707E, +0x7081,0x7085,0x7086,0x7094,0x7095,0x7096,0x7097,0x7098, +0x709B,0x70A4,0x70AB,0x70B0,0x70B1,0x70B4,0x70B7,0x70CA, +0x70D1,0x70D3,0x70D4,0x70D5,0x70D6,0x70D8,0x70DC,0x70E4, +0x70FA,0x7103,0x7104,0x7105,0x7106,0x7107,0x710B,0x710C, +0x710F,0x711E,0x7120,0x712B,0x712D,0x712F,0x7130,0x7131, +0x7138,0x7141,0x7145,0x7146,0x7147,0x714A,0x714B,0x7150, +0x7152,0x7157,0x715A,0x715C,0x715E,0x7160}; + +/* page 34 0x4A21-0x4A7E */ +static uint16 tab_jisx0212_uni34[]={ +0x7168,0x7179,0x7180,0x7185,0x7187,0x718C,0x7192,0x719A, +0x719B,0x71A0,0x71A2,0x71AF,0x71B0,0x71B2,0x71B3,0x71BA, +0x71BF,0x71C0,0x71C1,0x71C4,0x71CB,0x71CC,0x71D3,0x71D6, +0x71D9,0x71DA,0x71DC,0x71F8,0x71FE,0x7200,0x7207,0x7208, +0x7209,0x7213,0x7217,0x721A,0x721D,0x721F,0x7224,0x722B, +0x722F,0x7234,0x7238,0x7239,0x7241,0x7242,0x7243,0x7245, +0x724E,0x724F,0x7250,0x7253,0x7255,0x7256,0x725A,0x725C, +0x725E,0x7260,0x7263,0x7268,0x726B,0x726E,0x726F,0x7271, +0x7277,0x7278,0x727B,0x727C,0x727F,0x7284,0x7289,0x728D, +0x728E,0x7293,0x729B,0x72A8,0x72AD,0x72AE,0x72B1,0x72B4, +0x72BE,0x72C1,0x72C7,0x72C9,0x72CC,0x72D5,0x72D6,0x72D8, +0x72DF,0x72E5,0x72F3,0x72F4,0x72FA,0x72FB}; + +/* page 35 0x4B21-0x4B7E */ +static uint16 tab_jisx0212_uni35[]={ +0x72FE,0x7302,0x7304,0x7305,0x7307,0x730B,0x730D,0x7312, +0x7313,0x7318,0x7319,0x731E,0x7322,0x7324,0x7327,0x7328, +0x732C,0x7331,0x7332,0x7335,0x733A,0x733B,0x733D,0x7343, +0x734D,0x7350,0x7352,0x7356,0x7358,0x735D,0x735E,0x735F, +0x7360,0x7366,0x7367,0x7369,0x736B,0x736C,0x736E,0x736F, +0x7371,0x7377,0x7379,0x737C,0x7380,0x7381,0x7383,0x7385, +0x7386,0x738E,0x7390,0x7393,0x7395,0x7397,0x7398,0x739C, +0x739E,0x739F,0x73A0,0x73A2,0x73A5,0x73A6,0x73AA,0x73AB, +0x73AD,0x73B5,0x73B7,0x73B9,0x73BC,0x73BD,0x73BF,0x73C5, +0x73C6,0x73C9,0x73CB,0x73CC,0x73CF,0x73D2,0x73D3,0x73D6, +0x73D9,0x73DD,0x73E1,0x73E3,0x73E6,0x73E7,0x73E9,0x73F4, +0x73F5,0x73F7,0x73F9,0x73FA,0x73FB,0x73FD}; + +/* page 36 0x4C21-0x4C7E */ +static uint16 tab_jisx0212_uni36[]={ +0x73FF,0x7400,0x7401,0x7404,0x7407,0x740A,0x7411,0x741A, +0x741B,0x7424,0x7426,0x7428,0x7429,0x742A,0x742B,0x742C, +0x742D,0x742E,0x742F,0x7430,0x7431,0x7439,0x7440,0x7443, +0x7444,0x7446,0x7447,0x744B,0x744D,0x7451,0x7452,0x7457, +0x745D,0x7462,0x7466,0x7467,0x7468,0x746B,0x746D,0x746E, +0x7471,0x7472,0x7480,0x7481,0x7485,0x7486,0x7487,0x7489, +0x748F,0x7490,0x7491,0x7492,0x7498,0x7499,0x749A,0x749C, +0x749F,0x74A0,0x74A1,0x74A3,0x74A6,0x74A8,0x74A9,0x74AA, +0x74AB,0x74AE,0x74AF,0x74B1,0x74B2,0x74B5,0x74B9,0x74BB, +0x74BF,0x74C8,0x74C9,0x74CC,0x74D0,0x74D3,0x74D8,0x74DA, +0x74DB,0x74DE,0x74DF,0x74E4,0x74E8,0x74EA,0x74EB,0x74EF, +0x74F4,0x74FA,0x74FB,0x74FC,0x74FF,0x7506}; + +/* page 37 0x4D21-0x4D7E */ +static uint16 tab_jisx0212_uni37[]={ +0x7512,0x7516,0x7517,0x7520,0x7521,0x7524,0x7527,0x7529, +0x752A,0x752F,0x7536,0x7539,0x753D,0x753E,0x753F,0x7540, +0x7543,0x7547,0x7548,0x754E,0x7550,0x7552,0x7557,0x755E, +0x755F,0x7561,0x756F,0x7571,0x7579,0x757A,0x757B,0x757C, +0x757D,0x757E,0x7581,0x7585,0x7590,0x7592,0x7593,0x7595, +0x7599,0x759C,0x75A2,0x75A4,0x75B4,0x75BA,0x75BF,0x75C0, +0x75C1,0x75C4,0x75C6,0x75CC,0x75CE,0x75CF,0x75D7,0x75DC, +0x75DF,0x75E0,0x75E1,0x75E4,0x75E7,0x75EC,0x75EE,0x75EF, +0x75F1,0x75F9,0x7600,0x7602,0x7603,0x7604,0x7607,0x7608, +0x760A,0x760C,0x760F,0x7612,0x7613,0x7615,0x7616,0x7619, +0x761B,0x761C,0x761D,0x761E,0x7623,0x7625,0x7626,0x7629, +0x762D,0x7632,0x7633,0x7635,0x7638,0x7639}; + +/* page 38 0x4E21-0x4E7E */ +static uint16 tab_jisx0212_uni38[]={ +0x763A,0x763C,0x764A,0x7640,0x7641,0x7643,0x7644,0x7645, +0x7649,0x764B,0x7655,0x7659,0x765F,0x7664,0x7665,0x766D, +0x766E,0x766F,0x7671,0x7674,0x7681,0x7685,0x768C,0x768D, +0x7695,0x769B,0x769C,0x769D,0x769F,0x76A0,0x76A2,0x76A3, +0x76A4,0x76A5,0x76A6,0x76A7,0x76A8,0x76AA,0x76AD,0x76BD, +0x76C1,0x76C5,0x76C9,0x76CB,0x76CC,0x76CE,0x76D4,0x76D9, +0x76E0,0x76E6,0x76E8,0x76EC,0x76F0,0x76F1,0x76F6,0x76F9, +0x76FC,0x7700,0x7706,0x770A,0x770E,0x7712,0x7714,0x7715, +0x7717,0x7719,0x771A,0x771C,0x7722,0x7728,0x772D,0x772E, +0x772F,0x7734,0x7735,0x7736,0x7739,0x773D,0x773E,0x7742, +0x7745,0x7746,0x774A,0x774D,0x774E,0x774F,0x7752,0x7756, +0x7757,0x775C,0x775E,0x775F,0x7760,0x7762}; + +/* page 39 0x4F21-0x4F7E */ +static uint16 tab_jisx0212_uni39[]={ +0x7764,0x7767,0x776A,0x776C,0x7770,0x7772,0x7773,0x7774, +0x777A,0x777D,0x7780,0x7784,0x778C,0x778D,0x7794,0x7795, +0x7796,0x779A,0x779F,0x77A2,0x77A7,0x77AA,0x77AE,0x77AF, +0x77B1,0x77B5,0x77BE,0x77C3,0x77C9,0x77D1,0x77D2,0x77D5, +0x77D9,0x77DE,0x77DF,0x77E0,0x77E4,0x77E6,0x77EA,0x77EC, +0x77F0,0x77F1,0x77F4,0x77F8,0x77FB,0x7805,0x7806,0x7809, +0x780D,0x780E,0x7811,0x781D,0x7821,0x7822,0x7823,0x782D, +0x782E,0x7830,0x7835,0x7837,0x7843,0x7844,0x7847,0x7848, +0x784C,0x784E,0x7852,0x785C,0x785E,0x7860,0x7861,0x7863, +0x7864,0x7868,0x786A,0x786E,0x787A,0x787E,0x788A,0x788F, +0x7894,0x7898,0x78A1,0x789D,0x789E,0x789F,0x78A4,0x78A8, +0x78AC,0x78AD,0x78B0,0x78B1,0x78B2,0x78B3}; + +/* page 40 0x5021-0x507E */ +static uint16 tab_jisx0212_uni40[]={ +0x78BB,0x78BD,0x78BF,0x78C7,0x78C8,0x78C9,0x78CC,0x78CE, +0x78D2,0x78D3,0x78D5,0x78D6,0x78E4,0x78DB,0x78DF,0x78E0, +0x78E1,0x78E6,0x78EA,0x78F2,0x78F3,0x7900,0x78F6,0x78F7, +0x78FA,0x78FB,0x78FF,0x7906,0x790C,0x7910,0x791A,0x791C, +0x791E,0x791F,0x7920,0x7925,0x7927,0x7929,0x792D,0x7931, +0x7934,0x7935,0x793B,0x793D,0x793F,0x7944,0x7945,0x7946, +0x794A,0x794B,0x794F,0x7951,0x7954,0x7958,0x795B,0x795C, +0x7967,0x7969,0x796B,0x7972,0x7979,0x797B,0x797C,0x797E, +0x798B,0x798C,0x7991,0x7993,0x7994,0x7995,0x7996,0x7998, +0x799B,0x799C,0x79A1,0x79A8,0x79A9,0x79AB,0x79AF,0x79B1, +0x79B4,0x79B8,0x79BB,0x79C2,0x79C4,0x79C7,0x79C8,0x79CA, +0x79CF,0x79D4,0x79D6,0x79DA,0x79DD,0x79DE}; + +/* page 41 0x5121-0x517E */ +static uint16 tab_jisx0212_uni41[]={ +0x79E0,0x79E2,0x79E5,0x79EA,0x79EB,0x79ED,0x79F1,0x79F8, +0x79FC,0x7A02,0x7A03,0x7A07,0x7A09,0x7A0A,0x7A0C,0x7A11, +0x7A15,0x7A1B,0x7A1E,0x7A21,0x7A27,0x7A2B,0x7A2D,0x7A2F, +0x7A30,0x7A34,0x7A35,0x7A38,0x7A39,0x7A3A,0x7A44,0x7A45, +0x7A47,0x7A48,0x7A4C,0x7A55,0x7A56,0x7A59,0x7A5C,0x7A5D, +0x7A5F,0x7A60,0x7A65,0x7A67,0x7A6A,0x7A6D,0x7A75,0x7A78, +0x7A7E,0x7A80,0x7A82,0x7A85,0x7A86,0x7A8A,0x7A8B,0x7A90, +0x7A91,0x7A94,0x7A9E,0x7AA0,0x7AA3,0x7AAC,0x7AB3,0x7AB5, +0x7AB9,0x7ABB,0x7ABC,0x7AC6,0x7AC9,0x7ACC,0x7ACE,0x7AD1, +0x7ADB,0x7AE8,0x7AE9,0x7AEB,0x7AEC,0x7AF1,0x7AF4,0x7AFB, +0x7AFD,0x7AFE,0x7B07,0x7B14,0x7B1F,0x7B23,0x7B27,0x7B29, +0x7B2A,0x7B2B,0x7B2D,0x7B2E,0x7B2F,0x7B30}; + +/* page 42 0x5221-0x527E */ +static uint16 tab_jisx0212_uni42[]={ +0x7B31,0x7B34,0x7B3D,0x7B3F,0x7B40,0x7B41,0x7B47,0x7B4E, +0x7B55,0x7B60,0x7B64,0x7B66,0x7B69,0x7B6A,0x7B6D,0x7B6F, +0x7B72,0x7B73,0x7B77,0x7B84,0x7B89,0x7B8E,0x7B90,0x7B91, +0x7B96,0x7B9B,0x7B9E,0x7BA0,0x7BA5,0x7BAC,0x7BAF,0x7BB0, +0x7BB2,0x7BB5,0x7BB6,0x7BBA,0x7BBB,0x7BBC,0x7BBD,0x7BC2, +0x7BC5,0x7BC8,0x7BCA,0x7BD4,0x7BD6,0x7BD7,0x7BD9,0x7BDA, +0x7BDB,0x7BE8,0x7BEA,0x7BF2,0x7BF4,0x7BF5,0x7BF8,0x7BF9, +0x7BFA,0x7BFC,0x7BFE,0x7C01,0x7C02,0x7C03,0x7C04,0x7C06, +0x7C09,0x7C0B,0x7C0C,0x7C0E,0x7C0F,0x7C19,0x7C1B,0x7C20, +0x7C25,0x7C26,0x7C28,0x7C2C,0x7C31,0x7C33,0x7C34,0x7C36, +0x7C39,0x7C3A,0x7C46,0x7C4A,0x7C55,0x7C51,0x7C52,0x7C53, +0x7C59,0x7C5A,0x7C5B,0x7C5C,0x7C5D,0x7C5E}; + +/* page 43 0x5321-0x537E */ +static uint16 tab_jisx0212_uni43[]={ +0x7C61,0x7C63,0x7C67,0x7C69,0x7C6D,0x7C6E,0x7C70,0x7C72, +0x7C79,0x7C7C,0x7C7D,0x7C86,0x7C87,0x7C8F,0x7C94,0x7C9E, +0x7CA0,0x7CA6,0x7CB0,0x7CB6,0x7CB7,0x7CBA,0x7CBB,0x7CBC, +0x7CBF,0x7CC4,0x7CC7,0x7CC8,0x7CC9,0x7CCD,0x7CCF,0x7CD3, +0x7CD4,0x7CD5,0x7CD7,0x7CD9,0x7CDA,0x7CDD,0x7CE6,0x7CE9, +0x7CEB,0x7CF5,0x7D03,0x7D07,0x7D08,0x7D09,0x7D0F,0x7D11, +0x7D12,0x7D13,0x7D16,0x7D1D,0x7D1E,0x7D23,0x7D26,0x7D2A, +0x7D2D,0x7D31,0x7D3C,0x7D3D,0x7D3E,0x7D40,0x7D41,0x7D47, +0x7D48,0x7D4D,0x7D51,0x7D53,0x7D57,0x7D59,0x7D5A,0x7D5C, +0x7D5D,0x7D65,0x7D67,0x7D6A,0x7D70,0x7D78,0x7D7A,0x7D7B, +0x7D7F,0x7D81,0x7D82,0x7D83,0x7D85,0x7D86,0x7D88,0x7D8B, +0x7D8C,0x7D8D,0x7D91,0x7D96,0x7D97,0x7D9D}; + +/* page 44 0x5421-0x547E */ +static uint16 tab_jisx0212_uni44[]={ +0x7D9E,0x7DA6,0x7DA7,0x7DAA,0x7DB3,0x7DB6,0x7DB7,0x7DB9, +0x7DC2,0x7DC3,0x7DC4,0x7DC5,0x7DC6,0x7DCC,0x7DCD,0x7DCE, +0x7DD7,0x7DD9,0x7E00,0x7DE2,0x7DE5,0x7DE6,0x7DEA,0x7DEB, +0x7DED,0x7DF1,0x7DF5,0x7DF6,0x7DF9,0x7DFA,0x7E08,0x7E10, +0x7E11,0x7E15,0x7E17,0x7E1C,0x7E1D,0x7E20,0x7E27,0x7E28, +0x7E2C,0x7E2D,0x7E2F,0x7E33,0x7E36,0x7E3F,0x7E44,0x7E45, +0x7E47,0x7E4E,0x7E50,0x7E52,0x7E58,0x7E5F,0x7E61,0x7E62, +0x7E65,0x7E6B,0x7E6E,0x7E6F,0x7E73,0x7E78,0x7E7E,0x7E81, +0x7E86,0x7E87,0x7E8A,0x7E8D,0x7E91,0x7E95,0x7E98,0x7E9A, +0x7E9D,0x7E9E,0x7F3C,0x7F3B,0x7F3D,0x7F3E,0x7F3F,0x7F43, +0x7F44,0x7F47,0x7F4F,0x7F52,0x7F53,0x7F5B,0x7F5C,0x7F5D, +0x7F61,0x7F63,0x7F64,0x7F65,0x7F66,0x7F6D}; + +/* page 45 0x5521-0x557E */ +static uint16 tab_jisx0212_uni45[]={ +0x7F71,0x7F7D,0x7F7E,0x7F7F,0x7F80,0x7F8B,0x7F8D,0x7F8F, +0x7F90,0x7F91,0x7F96,0x7F97,0x7F9C,0x7FA1,0x7FA2,0x7FA6, +0x7FAA,0x7FAD,0x7FB4,0x7FBC,0x7FBF,0x7FC0,0x7FC3,0x7FC8, +0x7FCE,0x7FCF,0x7FDB,0x7FDF,0x7FE3,0x7FE5,0x7FE8,0x7FEC, +0x7FEE,0x7FEF,0x7FF2,0x7FFA,0x7FFD,0x7FFE,0x7FFF,0x8007, +0x8008,0x800A,0x800D,0x800E,0x800F,0x8011,0x8013,0x8014, +0x8016,0x801D,0x801E,0x801F,0x8020,0x8024,0x8026,0x802C, +0x802E,0x8030,0x8034,0x8035,0x8037,0x8039,0x803A,0x803C, +0x803E,0x8040,0x8044,0x8060,0x8064,0x8066,0x806D,0x8071, +0x8075,0x8081,0x8088,0x808E,0x809C,0x809E,0x80A6,0x80A7, +0x80AB,0x80B8,0x80B9,0x80C8,0x80CD,0x80CF,0x80D2,0x80D4, +0x80D5,0x80D7,0x80D8,0x80E0,0x80ED,0x80EE}; + +/* page 46 0x5621-0x567E */ +static uint16 tab_jisx0212_uni46[]={ +0x80F0,0x80F2,0x80F3,0x80F6,0x80F9,0x80FA,0x80FE,0x8103, +0x810B,0x8116,0x8117,0x8118,0x811C,0x811E,0x8120,0x8124, +0x8127,0x812C,0x8130,0x8135,0x813A,0x813C,0x8145,0x8147, +0x814A,0x814C,0x8152,0x8157,0x8160,0x8161,0x8167,0x8168, +0x8169,0x816D,0x816F,0x8177,0x8181,0x8190,0x8184,0x8185, +0x8186,0x818B,0x818E,0x8196,0x8198,0x819B,0x819E,0x81A2, +0x81AE,0x81B2,0x81B4,0x81BB,0x81CB,0x81C3,0x81C5,0x81CA, +0x81CE,0x81CF,0x81D5,0x81D7,0x81DB,0x81DD,0x81DE,0x81E1, +0x81E4,0x81EB,0x81EC,0x81F0,0x81F1,0x81F2,0x81F5,0x81F6, +0x81F8,0x81F9,0x81FD,0x81FF,0x8200,0x8203,0x820F,0x8213, +0x8214,0x8219,0x821A,0x821D,0x8221,0x8222,0x8228,0x8232, +0x8234,0x823A,0x8243,0x8244,0x8245,0x8246}; + +/* page 47 0x5721-0x577E */ +static uint16 tab_jisx0212_uni47[]={ +0x824B,0x824E,0x824F,0x8251,0x8256,0x825C,0x8260,0x8263, +0x8267,0x826D,0x8274,0x827B,0x827D,0x827F,0x8280,0x8281, +0x8283,0x8284,0x8287,0x8289,0x828A,0x828E,0x8291,0x8294, +0x8296,0x8298,0x829A,0x829B,0x82A0,0x82A1,0x82A3,0x82A4, +0x82A7,0x82A8,0x82A9,0x82AA,0x82AE,0x82B0,0x82B2,0x82B4, +0x82B7,0x82BA,0x82BC,0x82BE,0x82BF,0x82C6,0x82D0,0x82D5, +0x82DA,0x82E0,0x82E2,0x82E4,0x82E8,0x82EA,0x82ED,0x82EF, +0x82F6,0x82F7,0x82FD,0x82FE,0x8300,0x8301,0x8307,0x8308, +0x830A,0x830B,0x8354,0x831B,0x831D,0x831E,0x831F,0x8321, +0x8322,0x832C,0x832D,0x832E,0x8330,0x8333,0x8337,0x833A, +0x833C,0x833D,0x8342,0x8343,0x8344,0x8347,0x834D,0x834E, +0x8351,0x8355,0x8356,0x8357,0x8370,0x8378}; + +/* page 48 0x5821-0x587E */ +static uint16 tab_jisx0212_uni48[]={ +0x837D,0x837F,0x8380,0x8382,0x8384,0x8386,0x838D,0x8392, +0x8394,0x8395,0x8398,0x8399,0x839B,0x839C,0x839D,0x83A6, +0x83A7,0x83A9,0x83AC,0x83BE,0x83BF,0x83C0,0x83C7,0x83C9, +0x83CF,0x83D0,0x83D1,0x83D4,0x83DD,0x8353,0x83E8,0x83EA, +0x83F6,0x83F8,0x83F9,0x83FC,0x8401,0x8406,0x840A,0x840F, +0x8411,0x8415,0x8419,0x83AD,0x842F,0x8439,0x8445,0x8447, +0x8448,0x844A,0x844D,0x844F,0x8451,0x8452,0x8456,0x8458, +0x8459,0x845A,0x845C,0x8460,0x8464,0x8465,0x8467,0x846A, +0x8470,0x8473,0x8474,0x8476,0x8478,0x847C,0x847D,0x8481, +0x8485,0x8492,0x8493,0x8495,0x849E,0x84A6,0x84A8,0x84A9, +0x84AA,0x84AF,0x84B1,0x84B4,0x84BA,0x84BD,0x84BE,0x84C0, +0x84C2,0x84C7,0x84C8,0x84CC,0x84CF,0x84D3}; + +/* page 49 0x5921-0x597E */ +static uint16 tab_jisx0212_uni49[]={ +0x84DC,0x84E7,0x84EA,0x84EF,0x84F0,0x84F1,0x84F2,0x84F7, +0x8532,0x84FA,0x84FB,0x84FD,0x8502,0x8503,0x8507,0x850C, +0x850E,0x8510,0x851C,0x851E,0x8522,0x8523,0x8524,0x8525, +0x8527,0x852A,0x852B,0x852F,0x8533,0x8534,0x8536,0x853F, +0x8546,0x854F,0x8550,0x8551,0x8552,0x8553,0x8556,0x8559, +0x855C,0x855D,0x855E,0x855F,0x8560,0x8561,0x8562,0x8564, +0x856B,0x856F,0x8579,0x857A,0x857B,0x857D,0x857F,0x8581, +0x8585,0x8586,0x8589,0x858B,0x858C,0x858F,0x8593,0x8598, +0x859D,0x859F,0x85A0,0x85A2,0x85A5,0x85A7,0x85B4,0x85B6, +0x85B7,0x85B8,0x85BC,0x85BD,0x85BE,0x85BF,0x85C2,0x85C7, +0x85CA,0x85CB,0x85CE,0x85AD,0x85D8,0x85DA,0x85DF,0x85E0, +0x85E6,0x85E8,0x85ED,0x85F3,0x85F6,0x85FC}; + +/* page 50 0x5A21-0x5A7E */ +static uint16 tab_jisx0212_uni50[]={ +0x85FF,0x8600,0x8604,0x8605,0x860D,0x860E,0x8610,0x8611, +0x8612,0x8618,0x8619,0x861B,0x861E,0x8621,0x8627,0x8629, +0x8636,0x8638,0x863A,0x863C,0x863D,0x8640,0x8642,0x8646, +0x8652,0x8653,0x8656,0x8657,0x8658,0x8659,0x865D,0x8660, +0x8661,0x8662,0x8663,0x8664,0x8669,0x866C,0x866F,0x8675, +0x8676,0x8677,0x867A,0x868D,0x8691,0x8696,0x8698,0x869A, +0x869C,0x86A1,0x86A6,0x86A7,0x86A8,0x86AD,0x86B1,0x86B3, +0x86B4,0x86B5,0x86B7,0x86B8,0x86B9,0x86BF,0x86C0,0x86C1, +0x86C3,0x86C5,0x86D1,0x86D2,0x86D5,0x86D7,0x86DA,0x86DC, +0x86E0,0x86E3,0x86E5,0x86E7,0x8688,0x86FA,0x86FC,0x86FD, +0x8704,0x8705,0x8707,0x870B,0x870E,0x870F,0x8710,0x8713, +0x8714,0x8719,0x871E,0x871F,0x8721,0x8723}; + +/* page 51 0x5B21-0x5B7E */ +static uint16 tab_jisx0212_uni51[]={ +0x8728,0x872E,0x872F,0x8731,0x8732,0x8739,0x873A,0x873C, +0x873D,0x873E,0x8740,0x8743,0x8745,0x874D,0x8758,0x875D, +0x8761,0x8764,0x8765,0x876F,0x8771,0x8772,0x877B,0x8783, +0x8784,0x8785,0x8786,0x8787,0x8788,0x8789,0x878B,0x878C, +0x8790,0x8793,0x8795,0x8797,0x8798,0x8799,0x879E,0x87A0, +0x87A3,0x87A7,0x87AC,0x87AD,0x87AE,0x87B1,0x87B5,0x87BE, +0x87BF,0x87C1,0x87C8,0x87C9,0x87CA,0x87CE,0x87D5,0x87D6, +0x87D9,0x87DA,0x87DC,0x87DF,0x87E2,0x87E3,0x87E4,0x87EA, +0x87EB,0x87ED,0x87F1,0x87F3,0x87F8,0x87FA,0x87FF,0x8801, +0x8803,0x8806,0x8809,0x880A,0x880B,0x8810,0x8819,0x8812, +0x8813,0x8814,0x8818,0x881A,0x881B,0x881C,0x881E,0x881F, +0x8828,0x882D,0x882E,0x8830,0x8832,0x8835}; + +/* page 52 0x5C21-0x5C7E */ +static uint16 tab_jisx0212_uni52[]={ +0x883A,0x883C,0x8841,0x8843,0x8845,0x8848,0x8849,0x884A, +0x884B,0x884E,0x8851,0x8855,0x8856,0x8858,0x885A,0x885C, +0x885F,0x8860,0x8864,0x8869,0x8871,0x8879,0x887B,0x8880, +0x8898,0x889A,0x889B,0x889C,0x889F,0x88A0,0x88A8,0x88AA, +0x88BA,0x88BD,0x88BE,0x88C0,0x88CA,0x88CB,0x88CC,0x88CD, +0x88CE,0x88D1,0x88D2,0x88D3,0x88DB,0x88DE,0x88E7,0x88EF, +0x88F0,0x88F1,0x88F5,0x88F7,0x8901,0x8906,0x890D,0x890E, +0x890F,0x8915,0x8916,0x8918,0x8919,0x891A,0x891C,0x8920, +0x8926,0x8927,0x8928,0x8930,0x8931,0x8932,0x8935,0x8939, +0x893A,0x893E,0x8940,0x8942,0x8945,0x8946,0x8949,0x894F, +0x8952,0x8957,0x895A,0x895B,0x895C,0x8961,0x8962,0x8963, +0x896B,0x896E,0x8970,0x8973,0x8975,0x897A}; + +/* page 53 0x5D21-0x5D7E */ +static uint16 tab_jisx0212_uni53[]={ +0x897B,0x897C,0x897D,0x8989,0x898D,0x8990,0x8994,0x8995, +0x899B,0x899C,0x899F,0x89A0,0x89A5,0x89B0,0x89B4,0x89B5, +0x89B6,0x89B7,0x89BC,0x89D4,0x89D5,0x89D6,0x89D7,0x89D8, +0x89E5,0x89E9,0x89EB,0x89ED,0x89F1,0x89F3,0x89F6,0x89F9, +0x89FD,0x89FF,0x8A04,0x8A05,0x8A07,0x8A0F,0x8A11,0x8A12, +0x8A14,0x8A15,0x8A1E,0x8A20,0x8A22,0x8A24,0x8A26,0x8A2B, +0x8A2C,0x8A2F,0x8A35,0x8A37,0x8A3D,0x8A3E,0x8A40,0x8A43, +0x8A45,0x8A47,0x8A49,0x8A4D,0x8A4E,0x8A53,0x8A56,0x8A57, +0x8A58,0x8A5C,0x8A5D,0x8A61,0x8A65,0x8A67,0x8A75,0x8A76, +0x8A77,0x8A79,0x8A7A,0x8A7B,0x8A7E,0x8A7F,0x8A80,0x8A83, +0x8A86,0x8A8B,0x8A8F,0x8A90,0x8A92,0x8A96,0x8A97,0x8A99, +0x8A9F,0x8AA7,0x8AA9,0x8AAE,0x8AAF,0x8AB3}; + +/* page 54 0x5E21-0x5E7E */ +static uint16 tab_jisx0212_uni54[]={ +0x8AB6,0x8AB7,0x8ABB,0x8ABE,0x8AC3,0x8AC6,0x8AC8,0x8AC9, +0x8ACA,0x8AD1,0x8AD3,0x8AD4,0x8AD5,0x8AD7,0x8ADD,0x8ADF, +0x8AEC,0x8AF0,0x8AF4,0x8AF5,0x8AF6,0x8AFC,0x8AFF,0x8B05, +0x8B06,0x8B0B,0x8B11,0x8B1C,0x8B1E,0x8B1F,0x8B0A,0x8B2D, +0x8B30,0x8B37,0x8B3C,0x8B42,0x8B43,0x8B44,0x8B45,0x8B46, +0x8B48,0x8B52,0x8B53,0x8B54,0x8B59,0x8B4D,0x8B5E,0x8B63, +0x8B6D,0x8B76,0x8B78,0x8B79,0x8B7C,0x8B7E,0x8B81,0x8B84, +0x8B85,0x8B8B,0x8B8D,0x8B8F,0x8B94,0x8B95,0x8B9C,0x8B9E, +0x8B9F,0x8C38,0x8C39,0x8C3D,0x8C3E,0x8C45,0x8C47,0x8C49, +0x8C4B,0x8C4F,0x8C51,0x8C53,0x8C54,0x8C57,0x8C58,0x8C5B, +0x8C5D,0x8C59,0x8C63,0x8C64,0x8C66,0x8C68,0x8C69,0x8C6D, +0x8C73,0x8C75,0x8C76,0x8C7B,0x8C7E,0x8C86}; + +/* page 55 0x5F21-0x5F7E */ +static uint16 tab_jisx0212_uni55[]={ +0x8C87,0x8C8B,0x8C90,0x8C92,0x8C93,0x8C99,0x8C9B,0x8C9C, +0x8CA4,0x8CB9,0x8CBA,0x8CC5,0x8CC6,0x8CC9,0x8CCB,0x8CCF, +0x8CD6,0x8CD5,0x8CD9,0x8CDD,0x8CE1,0x8CE8,0x8CEC,0x8CEF, +0x8CF0,0x8CF2,0x8CF5,0x8CF7,0x8CF8,0x8CFE,0x8CFF,0x8D01, +0x8D03,0x8D09,0x8D12,0x8D17,0x8D1B,0x8D65,0x8D69,0x8D6C, +0x8D6E,0x8D7F,0x8D82,0x8D84,0x8D88,0x8D8D,0x8D90,0x8D91, +0x8D95,0x8D9E,0x8D9F,0x8DA0,0x8DA6,0x8DAB,0x8DAC,0x8DAF, +0x8DB2,0x8DB5,0x8DB7,0x8DB9,0x8DBB,0x8DC0,0x8DC5,0x8DC6, +0x8DC7,0x8DC8,0x8DCA,0x8DCE,0x8DD1,0x8DD4,0x8DD5,0x8DD7, +0x8DD9,0x8DE4,0x8DE5,0x8DE7,0x8DEC,0x8DF0,0x8DBC,0x8DF1, +0x8DF2,0x8DF4,0x8DFD,0x8E01,0x8E04,0x8E05,0x8E06,0x8E0B, +0x8E11,0x8E14,0x8E16,0x8E20,0x8E21,0x8E22}; + +/* page 56 0x6021-0x607E */ +static uint16 tab_jisx0212_uni56[]={ +0x8E23,0x8E26,0x8E27,0x8E31,0x8E33,0x8E36,0x8E37,0x8E38, +0x8E39,0x8E3D,0x8E40,0x8E41,0x8E4B,0x8E4D,0x8E4E,0x8E4F, +0x8E54,0x8E5B,0x8E5C,0x8E5D,0x8E5E,0x8E61,0x8E62,0x8E69, +0x8E6C,0x8E6D,0x8E6F,0x8E70,0x8E71,0x8E79,0x8E7A,0x8E7B, +0x8E82,0x8E83,0x8E89,0x8E90,0x8E92,0x8E95,0x8E9A,0x8E9B, +0x8E9D,0x8E9E,0x8EA2,0x8EA7,0x8EA9,0x8EAD,0x8EAE,0x8EB3, +0x8EB5,0x8EBA,0x8EBB,0x8EC0,0x8EC1,0x8EC3,0x8EC4,0x8EC7, +0x8ECF,0x8ED1,0x8ED4,0x8EDC,0x8EE8,0x8EEE,0x8EF0,0x8EF1, +0x8EF7,0x8EF9,0x8EFA,0x8EED,0x8F00,0x8F02,0x8F07,0x8F08, +0x8F0F,0x8F10,0x8F16,0x8F17,0x8F18,0x8F1E,0x8F20,0x8F21, +0x8F23,0x8F25,0x8F27,0x8F28,0x8F2C,0x8F2D,0x8F2E,0x8F34, +0x8F35,0x8F36,0x8F37,0x8F3A,0x8F40,0x8F41}; + +/* page 57 0x6121-0x617E */ +static uint16 tab_jisx0212_uni57[]={ +0x8F43,0x8F47,0x8F4F,0x8F51,0x8F52,0x8F53,0x8F54,0x8F55, +0x8F58,0x8F5D,0x8F5E,0x8F65,0x8F9D,0x8FA0,0x8FA1,0x8FA4, +0x8FA5,0x8FA6,0x8FB5,0x8FB6,0x8FB8,0x8FBE,0x8FC0,0x8FC1, +0x8FC6,0x8FCA,0x8FCB,0x8FCD,0x8FD0,0x8FD2,0x8FD3,0x8FD5, +0x8FE0,0x8FE3,0x8FE4,0x8FE8,0x8FEE,0x8FF1,0x8FF5,0x8FF6, +0x8FFB,0x8FFE,0x9002,0x9004,0x9008,0x900C,0x9018,0x901B, +0x9028,0x9029,0x902F,0x902A,0x902C,0x902D,0x9033,0x9034, +0x9037,0x903F,0x9043,0x9044,0x904C,0x905B,0x905D,0x9062, +0x9066,0x9067,0x906C,0x9070,0x9074,0x9079,0x9085,0x9088, +0x908B,0x908C,0x908E,0x9090,0x9095,0x9097,0x9098,0x9099, +0x909B,0x90A0,0x90A1,0x90A2,0x90A5,0x90B0,0x90B2,0x90B3, +0x90B4,0x90B6,0x90BD,0x90CC,0x90BE,0x90C3}; + +/* page 58 0x6221-0x627E */ +static uint16 tab_jisx0212_uni58[]={ +0x90C4,0x90C5,0x90C7,0x90C8,0x90D5,0x90D7,0x90D8,0x90D9, +0x90DC,0x90DD,0x90DF,0x90E5,0x90D2,0x90F6,0x90EB,0x90EF, +0x90F0,0x90F4,0x90FE,0x90FF,0x9100,0x9104,0x9105,0x9106, +0x9108,0x910D,0x9110,0x9114,0x9116,0x9117,0x9118,0x911A, +0x911C,0x911E,0x9120,0x9125,0x9122,0x9123,0x9127,0x9129, +0x912E,0x912F,0x9131,0x9134,0x9136,0x9137,0x9139,0x913A, +0x913C,0x913D,0x9143,0x9147,0x9148,0x914F,0x9153,0x9157, +0x9159,0x915A,0x915B,0x9161,0x9164,0x9167,0x916D,0x9174, +0x9179,0x917A,0x917B,0x9181,0x9183,0x9185,0x9186,0x918A, +0x918E,0x9191,0x9193,0x9194,0x9195,0x9198,0x919E,0x91A1, +0x91A6,0x91A8,0x91AC,0x91AD,0x91AE,0x91B0,0x91B1,0x91B2, +0x91B3,0x91B6,0x91BB,0x91BC,0x91BD,0x91BF}; + +/* page 59 0x6321-0x637E */ +static uint16 tab_jisx0212_uni59[]={ +0x91C2,0x91C3,0x91C5,0x91D3,0x91D4,0x91D7,0x91D9,0x91DA, +0x91DE,0x91E4,0x91E5,0x91E9,0x91EA,0x91EC,0x91ED,0x91EE, +0x91EF,0x91F0,0x91F1,0x91F7,0x91F9,0x91FB,0x91FD,0x9200, +0x9201,0x9204,0x9205,0x9206,0x9207,0x9209,0x920A,0x920C, +0x9210,0x9212,0x9213,0x9216,0x9218,0x921C,0x921D,0x9223, +0x9224,0x9225,0x9226,0x9228,0x922E,0x922F,0x9230,0x9233, +0x9235,0x9236,0x9238,0x9239,0x923A,0x923C,0x923E,0x9240, +0x9242,0x9243,0x9246,0x9247,0x924A,0x924D,0x924E,0x924F, +0x9251,0x9258,0x9259,0x925C,0x925D,0x9260,0x9261,0x9265, +0x9267,0x9268,0x9269,0x926E,0x926F,0x9270,0x9275,0x9276, +0x9277,0x9278,0x9279,0x927B,0x927C,0x927D,0x927F,0x9288, +0x9289,0x928A,0x928D,0x928E,0x9292,0x9297}; + +/* page 60 0x6421-0x647E */ +static uint16 tab_jisx0212_uni60[]={ +0x9299,0x929F,0x92A0,0x92A4,0x92A5,0x92A7,0x92A8,0x92AB, +0x92AF,0x92B2,0x92B6,0x92B8,0x92BA,0x92BB,0x92BC,0x92BD, +0x92BF,0x92C0,0x92C1,0x92C2,0x92C3,0x92C5,0x92C6,0x92C7, +0x92C8,0x92CB,0x92CC,0x92CD,0x92CE,0x92D0,0x92D3,0x92D5, +0x92D7,0x92D8,0x92D9,0x92DC,0x92DD,0x92DF,0x92E0,0x92E1, +0x92E3,0x92E5,0x92E7,0x92E8,0x92EC,0x92EE,0x92F0,0x92F9, +0x92FB,0x92FF,0x9300,0x9302,0x9308,0x930D,0x9311,0x9314, +0x9315,0x931C,0x931D,0x931E,0x931F,0x9321,0x9324,0x9325, +0x9327,0x9329,0x932A,0x9333,0x9334,0x9336,0x9337,0x9347, +0x9348,0x9349,0x9350,0x9351,0x9352,0x9355,0x9357,0x9358, +0x935A,0x935E,0x9364,0x9365,0x9367,0x9369,0x936A,0x936D, +0x936F,0x9370,0x9371,0x9373,0x9374,0x9376}; + +/* page 61 0x6521-0x657E */ +static uint16 tab_jisx0212_uni61[]={ +0x937A,0x937D,0x937F,0x9380,0x9381,0x9382,0x9388,0x938A, +0x938B,0x938D,0x938F,0x9392,0x9395,0x9398,0x939B,0x939E, +0x93A1,0x93A3,0x93A4,0x93A6,0x93A8,0x93AB,0x93B4,0x93B5, +0x93B6,0x93BA,0x93A9,0x93C1,0x93C4,0x93C5,0x93C6,0x93C7, +0x93C9,0x93CA,0x93CB,0x93CC,0x93CD,0x93D3,0x93D9,0x93DC, +0x93DE,0x93DF,0x93E2,0x93E6,0x93E7,0x93F9,0x93F7,0x93F8, +0x93FA,0x93FB,0x93FD,0x9401,0x9402,0x9404,0x9408,0x9409, +0x940D,0x940E,0x940F,0x9415,0x9416,0x9417,0x941F,0x942E, +0x942F,0x9431,0x9432,0x9433,0x9434,0x943B,0x943F,0x943D, +0x9443,0x9445,0x9448,0x944A,0x944C,0x9455,0x9459,0x945C, +0x945F,0x9461,0x9463,0x9468,0x946B,0x946D,0x946E,0x946F, +0x9471,0x9472,0x9484,0x9483,0x9578,0x9579}; + +/* page 62 0x6621-0x667E */ +static uint16 tab_jisx0212_uni62[]={ +0x957E,0x9584,0x9588,0x958C,0x958D,0x958E,0x959D,0x959E, +0x959F,0x95A1,0x95A6,0x95A9,0x95AB,0x95AC,0x95B4,0x95B6, +0x95BA,0x95BD,0x95BF,0x95C6,0x95C8,0x95C9,0x95CB,0x95D0, +0x95D1,0x95D2,0x95D3,0x95D9,0x95DA,0x95DD,0x95DE,0x95DF, +0x95E0,0x95E4,0x95E6,0x961D,0x961E,0x9622,0x9624,0x9625, +0x9626,0x962C,0x9631,0x9633,0x9637,0x9638,0x9639,0x963A, +0x963C,0x963D,0x9641,0x9652,0x9654,0x9656,0x9657,0x9658, +0x9661,0x966E,0x9674,0x967B,0x967C,0x967E,0x967F,0x9681, +0x9682,0x9683,0x9684,0x9689,0x9691,0x9696,0x969A,0x969D, +0x969F,0x96A4,0x96A5,0x96A6,0x96A9,0x96AE,0x96AF,0x96B3, +0x96BA,0x96CA,0x96D2,0x5DB2,0x96D8,0x96DA,0x96DD,0x96DE, +0x96DF,0x96E9,0x96EF,0x96F1,0x96FA,0x9702}; + +/* page 63 0x6721-0x677E */ +static uint16 tab_jisx0212_uni63[]={ +0x9703,0x9705,0x9709,0x971A,0x971B,0x971D,0x9721,0x9722, +0x9723,0x9728,0x9731,0x9733,0x9741,0x9743,0x974A,0x974E, +0x974F,0x9755,0x9757,0x9758,0x975A,0x975B,0x9763,0x9767, +0x976A,0x976E,0x9773,0x9776,0x9777,0x9778,0x977B,0x977D, +0x977F,0x9780,0x9789,0x9795,0x9796,0x9797,0x9799,0x979A, +0x979E,0x979F,0x97A2,0x97AC,0x97AE,0x97B1,0x97B2,0x97B5, +0x97B6,0x97B8,0x97B9,0x97BA,0x97BC,0x97BE,0x97BF,0x97C1, +0x97C4,0x97C5,0x97C7,0x97C9,0x97CA,0x97CC,0x97CD,0x97CE, +0x97D0,0x97D1,0x97D4,0x97D7,0x97D8,0x97D9,0x97DD,0x97DE, +0x97E0,0x97DB,0x97E1,0x97E4,0x97EF,0x97F1,0x97F4,0x97F7, +0x97F8,0x97FA,0x9807,0x980A,0x9819,0x980D,0x980E,0x9814, +0x9816,0x981C,0x981E,0x9820,0x9823,0x9826}; + +/* page 64 0x6821-0x687E */ +static uint16 tab_jisx0212_uni64[]={ +0x982B,0x982E,0x982F,0x9830,0x9832,0x9833,0x9835,0x9825, +0x983E,0x9844,0x9847,0x984A,0x9851,0x9852,0x9853,0x9856, +0x9857,0x9859,0x985A,0x9862,0x9863,0x9865,0x9866,0x986A, +0x986C,0x98AB,0x98AD,0x98AE,0x98B0,0x98B4,0x98B7,0x98B8, +0x98BA,0x98BB,0x98BF,0x98C2,0x98C5,0x98C8,0x98CC,0x98E1, +0x98E3,0x98E5,0x98E6,0x98E7,0x98EA,0x98F3,0x98F6,0x9902, +0x9907,0x9908,0x9911,0x9915,0x9916,0x9917,0x991A,0x991B, +0x991C,0x991F,0x9922,0x9926,0x9927,0x992B,0x9931,0x9932, +0x9933,0x9934,0x9935,0x9939,0x993A,0x993B,0x993C,0x9940, +0x9941,0x9946,0x9947,0x9948,0x994D,0x994E,0x9954,0x9958, +0x9959,0x995B,0x995C,0x995E,0x995F,0x9960,0x999B,0x999D, +0x999F,0x99A6,0x99B0,0x99B1,0x99B2,0x99B5}; + +/* page 65 0x6921-0x697E */ +static uint16 tab_jisx0212_uni65[]={ +0x99B9,0x99BA,0x99BD,0x99BF,0x99C3,0x99C9,0x99D3,0x99D4, +0x99D9,0x99DA,0x99DC,0x99DE,0x99E7,0x99EA,0x99EB,0x99EC, +0x99F0,0x99F4,0x99F5,0x99F9,0x99FD,0x99FE,0x9A02,0x9A03, +0x9A04,0x9A0B,0x9A0C,0x9A10,0x9A11,0x9A16,0x9A1E,0x9A20, +0x9A22,0x9A23,0x9A24,0x9A27,0x9A2D,0x9A2E,0x9A33,0x9A35, +0x9A36,0x9A38,0x9A47,0x9A41,0x9A44,0x9A4A,0x9A4B,0x9A4C, +0x9A4E,0x9A51,0x9A54,0x9A56,0x9A5D,0x9AAA,0x9AAC,0x9AAE, +0x9AAF,0x9AB2,0x9AB4,0x9AB5,0x9AB6,0x9AB9,0x9ABB,0x9ABE, +0x9ABF,0x9AC1,0x9AC3,0x9AC6,0x9AC8,0x9ACE,0x9AD0,0x9AD2, +0x9AD5,0x9AD6,0x9AD7,0x9ADB,0x9ADC,0x9AE0,0x9AE4,0x9AE5, +0x9AE7,0x9AE9,0x9AEC,0x9AF2,0x9AF3,0x9AF5,0x9AF9,0x9AFA, +0x9AFD,0x9AFF,0x9B00,0x9B01,0x9B02,0x9B03}; + +/* page 66 0x6A21-0x6A7E */ +static uint16 tab_jisx0212_uni66[]={ +0x9B04,0x9B05,0x9B08,0x9B09,0x9B0B,0x9B0C,0x9B0D,0x9B0E, +0x9B10,0x9B12,0x9B16,0x9B19,0x9B1B,0x9B1C,0x9B20,0x9B26, +0x9B2B,0x9B2D,0x9B33,0x9B34,0x9B35,0x9B37,0x9B39,0x9B3A, +0x9B3D,0x9B48,0x9B4B,0x9B4C,0x9B55,0x9B56,0x9B57,0x9B5B, +0x9B5E,0x9B61,0x9B63,0x9B65,0x9B66,0x9B68,0x9B6A,0x9B6B, +0x9B6C,0x9B6D,0x9B6E,0x9B73,0x9B75,0x9B77,0x9B78,0x9B79, +0x9B7F,0x9B80,0x9B84,0x9B85,0x9B86,0x9B87,0x9B89,0x9B8A, +0x9B8B,0x9B8D,0x9B8F,0x9B90,0x9B94,0x9B9A,0x9B9D,0x9B9E, +0x9BA6,0x9BA7,0x9BA9,0x9BAC,0x9BB0,0x9BB1,0x9BB2,0x9BB7, +0x9BB8,0x9BBB,0x9BBC,0x9BBE,0x9BBF,0x9BC1,0x9BC7,0x9BC8, +0x9BCE,0x9BD0,0x9BD7,0x9BD8,0x9BDD,0x9BDF,0x9BE5,0x9BE7, +0x9BEA,0x9BEB,0x9BEF,0x9BF3,0x9BF7,0x9BF8}; + +/* page 67 0x6B21-0x6B7E */ +static uint16 tab_jisx0212_uni67[]={ +0x9BF9,0x9BFA,0x9BFD,0x9BFF,0x9C00,0x9C02,0x9C0B,0x9C0F, +0x9C11,0x9C16,0x9C18,0x9C19,0x9C1A,0x9C1C,0x9C1E,0x9C22, +0x9C23,0x9C26,0x9C27,0x9C28,0x9C29,0x9C2A,0x9C31,0x9C35, +0x9C36,0x9C37,0x9C3D,0x9C41,0x9C43,0x9C44,0x9C45,0x9C49, +0x9C4A,0x9C4E,0x9C4F,0x9C50,0x9C53,0x9C54,0x9C56,0x9C58, +0x9C5B,0x9C5D,0x9C5E,0x9C5F,0x9C63,0x9C69,0x9C6A,0x9C5C, +0x9C6B,0x9C68,0x9C6E,0x9C70,0x9C72,0x9C75,0x9C77,0x9C7B, +0x9CE6,0x9CF2,0x9CF7,0x9CF9,0x9D0B,0x9D02,0x9D11,0x9D17, +0x9D18,0x9D1C,0x9D1D,0x9D1E,0x9D2F,0x9D30,0x9D32,0x9D33, +0x9D34,0x9D3A,0x9D3C,0x9D45,0x9D3D,0x9D42,0x9D43,0x9D47, +0x9D4A,0x9D53,0x9D54,0x9D5F,0x9D63,0x9D62,0x9D65,0x9D69, +0x9D6A,0x9D6B,0x9D70,0x9D76,0x9D77,0x9D7B}; + +/* page 68 0x6C21-0x6C7E */ +static uint16 tab_jisx0212_uni68[]={ +0x9D7C,0x9D7E,0x9D83,0x9D84,0x9D86,0x9D8A,0x9D8D,0x9D8E, +0x9D92,0x9D93,0x9D95,0x9D96,0x9D97,0x9D98,0x9DA1,0x9DAA, +0x9DAC,0x9DAE,0x9DB1,0x9DB5,0x9DB9,0x9DBC,0x9DBF,0x9DC3, +0x9DC7,0x9DC9,0x9DCA,0x9DD4,0x9DD5,0x9DD6,0x9DD7,0x9DDA, +0x9DDE,0x9DDF,0x9DE0,0x9DE5,0x9DE7,0x9DE9,0x9DEB,0x9DEE, +0x9DF0,0x9DF3,0x9DF4,0x9DFE,0x9E0A,0x9E02,0x9E07,0x9E0E, +0x9E10,0x9E11,0x9E12,0x9E15,0x9E16,0x9E19,0x9E1C,0x9E1D, +0x9E7A,0x9E7B,0x9E7C,0x9E80,0x9E82,0x9E83,0x9E84,0x9E85, +0x9E87,0x9E8E,0x9E8F,0x9E96,0x9E98,0x9E9B,0x9E9E,0x9EA4, +0x9EA8,0x9EAC,0x9EAE,0x9EAF,0x9EB0,0x9EB3,0x9EB4,0x9EB5, +0x9EC6,0x9EC8,0x9ECB,0x9ED5,0x9EDF,0x9EE4,0x9EE7,0x9EEC, +0x9EED,0x9EEE,0x9EF0,0x9EF1,0x9EF2,0x9EF5}; + +/* page 69 0x6D21-0x6D63 */ +static uint16 tab_jisx0212_uni69[]={ +0x9EF8,0x9EFF,0x9F02,0x9F03,0x9F09,0x9F0F,0x9F10,0x9F11, +0x9F12,0x9F14,0x9F16,0x9F17,0x9F19,0x9F1A,0x9F1B,0x9F1F, +0x9F22,0x9F26,0x9F2A,0x9F2B,0x9F2F,0x9F31,0x9F32,0x9F34, +0x9F37,0x9F39,0x9F3A,0x9F3C,0x9F3D,0x9F3F,0x9F41,0x9F43, +0x9F44,0x9F45,0x9F46,0x9F47,0x9F53,0x9F55,0x9F56,0x9F57, +0x9F58,0x9F5A,0x9F5D,0x9F5E,0x9F68,0x9F69,0x9F6D,0x9F6E, +0x9F6F,0x9F70,0x9F71,0x9F73,0x9F75,0x9F7A,0x9F7D,0x9F8F, +0x9F90,0x9F91,0x9F92,0x9F94,0x9F96,0x9F97,0x9F9E,0x9FA1, +0x9FA2,0x9FA3,0x9FA5}; + +static int +my_jisx0212_uni_onechar(int code){ + if ((code>=0x222F)&&(code<=0x2244)) + return(tab_jisx0212_uni0[code-0x222F]); + if ((code>=0x226B)&&(code<=0x2271)) + return(tab_jisx0212_uni1[code-0x226B]); + if ((code>=0x2661)&&(code<=0x267C)) + return(tab_jisx0212_uni2[code-0x2661]); + if ((code>=0x2742)&&(code<=0x274E)) + return(tab_jisx0212_uni3[code-0x2742]); + if ((code>=0x2772)&&(code<=0x277E)) + return(tab_jisx0212_uni4[code-0x2772]); + if ((code>=0x2921)&&(code<=0x2950)) + return(tab_jisx0212_uni5[code-0x2921]); + if ((code>=0x2A21)&&(code<=0x2A77)) + return(tab_jisx0212_uni6[code-0x2A21]); + if ((code>=0x2B21)&&(code<=0x2B77)) + return(tab_jisx0212_uni7[code-0x2B21]); + if ((code>=0x3021)&&(code<=0x307E)) + return(tab_jisx0212_uni8[code-0x3021]); + if ((code>=0x3121)&&(code<=0x317E)) + return(tab_jisx0212_uni9[code-0x3121]); + if ((code>=0x3221)&&(code<=0x327E)) + return(tab_jisx0212_uni10[code-0x3221]); + if ((code>=0x3321)&&(code<=0x337E)) + return(tab_jisx0212_uni11[code-0x3321]); + if ((code>=0x3421)&&(code<=0x347E)) + return(tab_jisx0212_uni12[code-0x3421]); + if ((code>=0x3521)&&(code<=0x357E)) + return(tab_jisx0212_uni13[code-0x3521]); + if ((code>=0x3621)&&(code<=0x367E)) + return(tab_jisx0212_uni14[code-0x3621]); + if ((code>=0x3721)&&(code<=0x377E)) + return(tab_jisx0212_uni15[code-0x3721]); + if ((code>=0x3821)&&(code<=0x387E)) + return(tab_jisx0212_uni16[code-0x3821]); + if ((code>=0x3921)&&(code<=0x397E)) + return(tab_jisx0212_uni17[code-0x3921]); + if ((code>=0x3A21)&&(code<=0x3A7E)) + return(tab_jisx0212_uni18[code-0x3A21]); + if ((code>=0x3B21)&&(code<=0x3B7E)) + return(tab_jisx0212_uni19[code-0x3B21]); + if ((code>=0x3C21)&&(code<=0x3C7E)) + return(tab_jisx0212_uni20[code-0x3C21]); + if ((code>=0x3D21)&&(code<=0x3D7E)) + return(tab_jisx0212_uni21[code-0x3D21]); + if ((code>=0x3E21)&&(code<=0x3E7E)) + return(tab_jisx0212_uni22[code-0x3E21]); + if ((code>=0x3F21)&&(code<=0x3F7E)) + return(tab_jisx0212_uni23[code-0x3F21]); + if ((code>=0x4021)&&(code<=0x407E)) + return(tab_jisx0212_uni24[code-0x4021]); + if ((code>=0x4121)&&(code<=0x417E)) + return(tab_jisx0212_uni25[code-0x4121]); + if ((code>=0x4221)&&(code<=0x427E)) + return(tab_jisx0212_uni26[code-0x4221]); + if ((code>=0x4321)&&(code<=0x437E)) + return(tab_jisx0212_uni27[code-0x4321]); + if ((code>=0x4421)&&(code<=0x447E)) + return(tab_jisx0212_uni28[code-0x4421]); + if ((code>=0x4521)&&(code<=0x457E)) + return(tab_jisx0212_uni29[code-0x4521]); + if ((code>=0x4621)&&(code<=0x467E)) + return(tab_jisx0212_uni30[code-0x4621]); + if ((code>=0x4721)&&(code<=0x477E)) + return(tab_jisx0212_uni31[code-0x4721]); + if ((code>=0x4821)&&(code<=0x487E)) + return(tab_jisx0212_uni32[code-0x4821]); + if ((code>=0x4921)&&(code<=0x497E)) + return(tab_jisx0212_uni33[code-0x4921]); + if ((code>=0x4A21)&&(code<=0x4A7E)) + return(tab_jisx0212_uni34[code-0x4A21]); + if ((code>=0x4B21)&&(code<=0x4B7E)) + return(tab_jisx0212_uni35[code-0x4B21]); + if ((code>=0x4C21)&&(code<=0x4C7E)) + return(tab_jisx0212_uni36[code-0x4C21]); + if ((code>=0x4D21)&&(code<=0x4D7E)) + return(tab_jisx0212_uni37[code-0x4D21]); + if ((code>=0x4E21)&&(code<=0x4E7E)) + return(tab_jisx0212_uni38[code-0x4E21]); + if ((code>=0x4F21)&&(code<=0x4F7E)) + return(tab_jisx0212_uni39[code-0x4F21]); + if ((code>=0x5021)&&(code<=0x507E)) + return(tab_jisx0212_uni40[code-0x5021]); + if ((code>=0x5121)&&(code<=0x517E)) + return(tab_jisx0212_uni41[code-0x5121]); + if ((code>=0x5221)&&(code<=0x527E)) + return(tab_jisx0212_uni42[code-0x5221]); + if ((code>=0x5321)&&(code<=0x537E)) + return(tab_jisx0212_uni43[code-0x5321]); + if ((code>=0x5421)&&(code<=0x547E)) + return(tab_jisx0212_uni44[code-0x5421]); + if ((code>=0x5521)&&(code<=0x557E)) + return(tab_jisx0212_uni45[code-0x5521]); + if ((code>=0x5621)&&(code<=0x567E)) + return(tab_jisx0212_uni46[code-0x5621]); + if ((code>=0x5721)&&(code<=0x577E)) + return(tab_jisx0212_uni47[code-0x5721]); + if ((code>=0x5821)&&(code<=0x587E)) + return(tab_jisx0212_uni48[code-0x5821]); + if ((code>=0x5921)&&(code<=0x597E)) + return(tab_jisx0212_uni49[code-0x5921]); + if ((code>=0x5A21)&&(code<=0x5A7E)) + return(tab_jisx0212_uni50[code-0x5A21]); + if ((code>=0x5B21)&&(code<=0x5B7E)) + return(tab_jisx0212_uni51[code-0x5B21]); + if ((code>=0x5C21)&&(code<=0x5C7E)) + return(tab_jisx0212_uni52[code-0x5C21]); + if ((code>=0x5D21)&&(code<=0x5D7E)) + return(tab_jisx0212_uni53[code-0x5D21]); + if ((code>=0x5E21)&&(code<=0x5E7E)) + return(tab_jisx0212_uni54[code-0x5E21]); + if ((code>=0x5F21)&&(code<=0x5F7E)) + return(tab_jisx0212_uni55[code-0x5F21]); + if ((code>=0x6021)&&(code<=0x607E)) + return(tab_jisx0212_uni56[code-0x6021]); + if ((code>=0x6121)&&(code<=0x617E)) + return(tab_jisx0212_uni57[code-0x6121]); + if ((code>=0x6221)&&(code<=0x627E)) + return(tab_jisx0212_uni58[code-0x6221]); + if ((code>=0x6321)&&(code<=0x637E)) + return(tab_jisx0212_uni59[code-0x6321]); + if ((code>=0x6421)&&(code<=0x647E)) + return(tab_jisx0212_uni60[code-0x6421]); + if ((code>=0x6521)&&(code<=0x657E)) + return(tab_jisx0212_uni61[code-0x6521]); + if ((code>=0x6621)&&(code<=0x667E)) + return(tab_jisx0212_uni62[code-0x6621]); + if ((code>=0x6721)&&(code<=0x677E)) + return(tab_jisx0212_uni63[code-0x6721]); + if ((code>=0x6821)&&(code<=0x687E)) + return(tab_jisx0212_uni64[code-0x6821]); + if ((code>=0x6921)&&(code<=0x697E)) + return(tab_jisx0212_uni65[code-0x6921]); + if ((code>=0x6A21)&&(code<=0x6A7E)) + return(tab_jisx0212_uni66[code-0x6A21]); + if ((code>=0x6B21)&&(code<=0x6B7E)) + return(tab_jisx0212_uni67[code-0x6B21]); + if ((code>=0x6C21)&&(code<=0x6C7E)) + return(tab_jisx0212_uni68[code-0x6C21]); + if ((code>=0x6D21)&&(code<=0x6D63)) + return(tab_jisx0212_uni69[code-0x6D21]); + return(0); +} + + +/* + EUC-JP encoding subcomponents: + [x00-x7F] # ASCII/JIS-Roman (one-byte/character) + [x8E][xA0-xDF] # half-width katakana (two bytes/char) + [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990 (three bytes/char) + [xA1-xFE][xA1-xFE] # JIS X 0208:1997 (two bytes/char) +*/ + +static +size_t my_well_formed_len_ujis(CHARSET_INFO *cs __attribute__((unused)), + const char *beg, const char *end, + size_t pos, int *error) +{ + const uchar *b= (uchar *) beg; + + for ( *error= 0 ; pos && b < (uchar*) end; pos--, b++) + { + char *chbeg; + uint ch= *b; + + if (ch <= 0x7F) /* one byte */ + continue; + + chbeg= (char *) b++; + if (b >= (uchar *) end) /* need more bytes */ + { + *error= 1; + return (size_t) (chbeg - beg); /* unexpected EOL */ + } + + if (ch == 0x8E) /* [x8E][xA0-xDF] */ + { + if (*b >= 0xA0 && *b <= 0xDF) + continue; + *error= 1; + return (size_t) (chbeg - beg); /* invalid sequence */ + } + + if (ch == 0x8F) /* [x8F][xA1-xFE][xA1-xFE] */ + { + ch= *b++; + if (b >= (uchar*) end) + { + *error= 1; + return (size_t) (chbeg - beg); /* unexpected EOL */ + } + } + + if (ch >= 0xA1 && ch <= 0xFE && + *b >= 0xA1 && *b <= 0xFE) /* [xA1-xFE][xA1-xFE] */ + continue; + *error= 1; + return (size_t) (chbeg - beg); /* invalid sequence */ + } + return (size_t) (b - (uchar *) beg); +} + + +static +size_t my_numcells_eucjp(CHARSET_INFO *cs __attribute__((unused)), + const char *str, const char *str_end) +{ + size_t clen; + const uchar *b= (const uchar *) str; + const uchar *e= (const uchar *) str_end; + + for (clen= 0; b < e; ) + { + if (*b == 0x8E) + { + clen++; + b+= 2; + } + else if (*b == 0x8F) + { + clen+= 2; + b+= 3; + } + else if (*b & 0x80) + { + clen+= 2; + b+= 2; + } + else + { + clen++; + b++; + } + } + return clen; +} + + +static int +my_mb_wc_euc_jp(CHARSET_INFO *cs,my_wc_t *pwc, const uchar *s, const uchar *e) +{ + int c1,c2,c3; + + if (s >= e) + return MY_CS_TOOSMALL; + + c1=s[0]; + + /* Ascii code set */ + if (c1<=0x7F) + { + *pwc=c1; + return 1; + } + + if (s+2>e) + return MY_CS_TOOSMALL2; + + c2=s[1]; + + + /* JIS X 0208 code set */ + if (c1>=0xA1 && c1<=0xFE) + { + if (c2 < 0xA1 || c2 >0xFE) + return MY_CS_ILSEQ; + + if (c1 < 0xF5) + { + pwc[0]=my_jisx0208_uni_onechar( ((c1-0x80) << 8) + (c2-0x80)); + if (!pwc[0]) + return -2; + } + else + { + /* User defined range */ + pwc[0]=0xE000 + 94*(c1-0xF5) +(c2-0xA1); + } + return 2; + } + + /* JIS X 0201 code set (Half Width Tatakana) */ + if (c1==0x8E) + { + int ret; + + if (c2<0xA1 || c2>0xDF) + return MY_CS_ILSEQ; + + ret = my_mb_wc_jisx0201(cs,pwc,s+1,e); + if (ret!=1) + return -2; + return 2; + } + + /* JIS X 0212 code set */ + if (c1==0x8F) + { + if (c2<0xA1 || c2>=0xFF) + return MY_CS_ILSEQ; + + if (s+3>e) + return MY_CS_TOOSMALL3; + + c3=s[2]; + if (c3 < 0xA1 || c3>=0xFF) + return MY_CS_ILSEQ; + + if (c2<0xF5) + { + pwc[0]=my_jisx0212_uni_onechar((c2-0x80)*256 + (c3-0x80)); + if (!pwc[0]) + return -3; + } + else + { + /* User defined range */ + pwc[0]= 0xE3AC + 94*(c2-0xF5) + (c3-0xA1); + } + return 3; + } + + return MY_CS_ILSEQ; +} + + +static int +my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, uchar *s, uchar *e) +{ + uchar c1; + int jp; + + if (s >= e) + return MY_CS_TOOSMALL; + + if ((int) wc < 0x80) + { + *s= (uchar) wc; + return 1; + } + + if ((jp=my_uni_jisx0208_onechar(wc))) + { + if (s+2>e) + return MY_CS_TOOSMALL2; + + jp+=0x8080; + s[0]=jp>>8; + s[1]=jp&0xFF; + return 2; + } + + /* Half width Katakana */ + if (my_wc_mb_jisx0201(c,wc,s,e) == 1) + { + if (s+2>e) + return MY_CS_TOOSMALL2; + s[1]= s[0]; + s[0]= 0x8E; + return 2; + } + + + if ((jp=my_uni_jisx0212_onechar(wc))) + { + if (s+3>e) + return MY_CS_TOOSMALL3; + + jp+=0x8080; + s[0]=0x8F; + s[1]=jp>>8; + s[2]=jp&0xFF; + return 3; + } + + + /* User defined range */ + if (wc>=0xE000 && wc<0xE3AC) + { + if (s+2>e) + return MY_CS_TOOSMALL2; + + c1=((unsigned)(wc-0xE000)/94)+0xF5; + s[0]=c1; + c1=((unsigned)(wc-0xE000)%94)+0xa1; + s[1]=c1; + return 2; + } + + + /* User defined range */ + if (wc>=0xE3AC && wc<0xE758) + { + if (s+3>e) + return MY_CS_TOOSMALL3; + + s[0]=0x8F; + c1=((unsigned)(wc-0xE3AC)/94)+0xF5; + s[1]=c1; + c1=((unsigned)(wc-0xE3AC)%94)+0xa1; + s[2]=c1; + return 3; + } + + return MY_CS_ILUNI; +} + + +static MY_COLLATION_HANDLER my_collation_ci_handler = +{ + NULL, /* init */ + my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple, + my_strnxfrm_mb, /* strnxfrm */ + my_strnxfrmlen_simple, + my_like_range_mb, /* like_range */ + my_wildcmp_mb, /* wildcmp */ + my_strcasecmp_mb, + my_instr_mb, + my_hash_sort_simple, + my_propagate_simple +}; + + +static MY_CHARSET_HANDLER my_charset_handler= +{ + NULL, /* init */ + ismbchar_ujis, + mbcharlen_ujis, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_ujis, + my_lengthsp_8bit, + my_numcells_eucjp, + my_mb_wc_euc_jp, /* mb_wc */ + my_wc_mb_euc_jp, /* wc_mb */ + my_mb_ctype_mb, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + + +CHARSET_INFO my_charset_ujis_japanese_ci= +{ + 12,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY, /* state */ + "ujis", /* cs name */ + "ujis_japanese_ci", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ujis, + to_lower_ujis, + to_upper_ujis, + sort_order_ujis, + NULL, /* sort_order_big*/ + NULL, /* contractions */ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_ci_handler +}; + + +CHARSET_INFO my_charset_ujis_bin= +{ + 91,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "ujis", /* cs name */ + "ujis_bin", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_ujis, + to_lower_ujis, + to_upper_ujis, + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_handler, + &my_collation_mb_bin_handler +}; + + +#endif diff --git a/externals/mysql/strings/ctype-utf8.c b/externals/mysql/strings/ctype-utf8.c new file mode 100644 index 0000000..f412d4e --- /dev/null +++ b/externals/mysql/strings/ctype-utf8.c @@ -0,0 +1,5308 @@ +/* Copyright (C) 2000 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* UTF8 according RFC 2279 */ +/* Written by Alexander Barkov */ + +#include +#include "m_string.h" +#include "m_ctype.h" +#include + +#ifndef EILSEQ +#define EILSEQ ENOENT +#endif + + +#define MY_UTF8MB3_GENERAL_CI MY_UTF8MB3 "_general_ci" +#define MY_UTF8MB3_GENERAL_CS MY_UTF8MB3 "_general_cs" +#define MY_UTF8MB3_BIN MY_UTF8MB3 "_bin" +#define MY_UTF8MB4_GENERAL_CI MY_UTF8MB4 "_general_ci" +#define MY_UTF8MB4_GENERAL_CS MY_UTF8MB4 "_general_cs" +#define MY_UTF8MB4_BIN MY_UTF8MB4 "_bin" + + +#ifdef HAVE_CHARSET_utf8mb3 +#define HAVE_UNIDATA +#endif + +#ifdef HAVE_CHARSET_ucs2 +#define HAVE_UNIDATA +#endif + +#ifdef HAVE_CHARSET_utf8mb4 +#define HAVE_UNIDATA +#endif + +#ifdef HAVE_CHARSET_utf16 +#define HAVE_UNIDATA +#endif + +#ifdef HAVE_CHARSET_utf32 +#define HAVE_UNIDATA +#endif + +#ifdef HAVE_UNIDATA + +#include "my_uctype.h" + +static MY_UNICASE_INFO plane00[]={ + {0x0000,0x0000,0x0000}, {0x0001,0x0001,0x0001}, + {0x0002,0x0002,0x0002}, {0x0003,0x0003,0x0003}, + {0x0004,0x0004,0x0004}, {0x0005,0x0005,0x0005}, + {0x0006,0x0006,0x0006}, {0x0007,0x0007,0x0007}, + {0x0008,0x0008,0x0008}, {0x0009,0x0009,0x0009}, + {0x000A,0x000A,0x000A}, {0x000B,0x000B,0x000B}, + {0x000C,0x000C,0x000C}, {0x000D,0x000D,0x000D}, + {0x000E,0x000E,0x000E}, {0x000F,0x000F,0x000F}, + {0x0010,0x0010,0x0010}, {0x0011,0x0011,0x0011}, + {0x0012,0x0012,0x0012}, {0x0013,0x0013,0x0013}, + {0x0014,0x0014,0x0014}, {0x0015,0x0015,0x0015}, + {0x0016,0x0016,0x0016}, {0x0017,0x0017,0x0017}, + {0x0018,0x0018,0x0018}, {0x0019,0x0019,0x0019}, + {0x001A,0x001A,0x001A}, {0x001B,0x001B,0x001B}, + {0x001C,0x001C,0x001C}, {0x001D,0x001D,0x001D}, + {0x001E,0x001E,0x001E}, {0x001F,0x001F,0x001F}, + {0x0020,0x0020,0x0020}, {0x0021,0x0021,0x0021}, + {0x0022,0x0022,0x0022}, {0x0023,0x0023,0x0023}, + {0x0024,0x0024,0x0024}, {0x0025,0x0025,0x0025}, + {0x0026,0x0026,0x0026}, {0x0027,0x0027,0x0027}, + {0x0028,0x0028,0x0028}, {0x0029,0x0029,0x0029}, + {0x002A,0x002A,0x002A}, {0x002B,0x002B,0x002B}, + {0x002C,0x002C,0x002C}, {0x002D,0x002D,0x002D}, + {0x002E,0x002E,0x002E}, {0x002F,0x002F,0x002F}, + {0x0030,0x0030,0x0030}, {0x0031,0x0031,0x0031}, + {0x0032,0x0032,0x0032}, {0x0033,0x0033,0x0033}, + {0x0034,0x0034,0x0034}, {0x0035,0x0035,0x0035}, + {0x0036,0x0036,0x0036}, {0x0037,0x0037,0x0037}, + {0x0038,0x0038,0x0038}, {0x0039,0x0039,0x0039}, + {0x003A,0x003A,0x003A}, {0x003B,0x003B,0x003B}, + {0x003C,0x003C,0x003C}, {0x003D,0x003D,0x003D}, + {0x003E,0x003E,0x003E}, {0x003F,0x003F,0x003F}, + {0x0040,0x0040,0x0040}, {0x0041,0x0061,0x0041}, + {0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043}, + {0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045}, + {0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047}, + {0x0048,0x0068,0x0048}, {0x0049,0x0069,0x0049}, + {0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B}, + {0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D}, + {0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F}, + {0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051}, + {0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053}, + {0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055}, + {0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057}, + {0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059}, + {0x005A,0x007A,0x005A}, {0x005B,0x005B,0x005B}, + {0x005C,0x005C,0x005C}, {0x005D,0x005D,0x005D}, + {0x005E,0x005E,0x005E}, {0x005F,0x005F,0x005F}, + {0x0060,0x0060,0x0060}, {0x0041,0x0061,0x0041}, + {0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043}, + {0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045}, + {0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047}, + {0x0048,0x0068,0x0048}, {0x0049,0x0069,0x0049}, + {0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B}, + {0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D}, + {0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F}, + {0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051}, + {0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053}, + {0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055}, + {0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057}, + {0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059}, + {0x005A,0x007A,0x005A}, {0x007B,0x007B,0x007B}, + {0x007C,0x007C,0x007C}, {0x007D,0x007D,0x007D}, + {0x007E,0x007E,0x007E}, {0x007F,0x007F,0x007F}, + {0x0080,0x0080,0x0080}, {0x0081,0x0081,0x0081}, + {0x0082,0x0082,0x0082}, {0x0083,0x0083,0x0083}, + {0x0084,0x0084,0x0084}, {0x0085,0x0085,0x0085}, + {0x0086,0x0086,0x0086}, {0x0087,0x0087,0x0087}, + {0x0088,0x0088,0x0088}, {0x0089,0x0089,0x0089}, + {0x008A,0x008A,0x008A}, {0x008B,0x008B,0x008B}, + {0x008C,0x008C,0x008C}, {0x008D,0x008D,0x008D}, + {0x008E,0x008E,0x008E}, {0x008F,0x008F,0x008F}, + {0x0090,0x0090,0x0090}, {0x0091,0x0091,0x0091}, + {0x0092,0x0092,0x0092}, {0x0093,0x0093,0x0093}, + {0x0094,0x0094,0x0094}, {0x0095,0x0095,0x0095}, + {0x0096,0x0096,0x0096}, {0x0097,0x0097,0x0097}, + {0x0098,0x0098,0x0098}, {0x0099,0x0099,0x0099}, + {0x009A,0x009A,0x009A}, {0x009B,0x009B,0x009B}, + {0x009C,0x009C,0x009C}, {0x009D,0x009D,0x009D}, + {0x009E,0x009E,0x009E}, {0x009F,0x009F,0x009F}, + {0x00A0,0x00A0,0x00A0}, {0x00A1,0x00A1,0x00A1}, + {0x00A2,0x00A2,0x00A2}, {0x00A3,0x00A3,0x00A3}, + {0x00A4,0x00A4,0x00A4}, {0x00A5,0x00A5,0x00A5}, + {0x00A6,0x00A6,0x00A6}, {0x00A7,0x00A7,0x00A7}, + {0x00A8,0x00A8,0x00A8}, {0x00A9,0x00A9,0x00A9}, + {0x00AA,0x00AA,0x00AA}, {0x00AB,0x00AB,0x00AB}, + {0x00AC,0x00AC,0x00AC}, {0x00AD,0x00AD,0x00AD}, + {0x00AE,0x00AE,0x00AE}, {0x00AF,0x00AF,0x00AF}, + {0x00B0,0x00B0,0x00B0}, {0x00B1,0x00B1,0x00B1}, + {0x00B2,0x00B2,0x00B2}, {0x00B3,0x00B3,0x00B3}, + {0x00B4,0x00B4,0x00B4}, {0x039C,0x00B5,0x039C}, + {0x00B6,0x00B6,0x00B6}, {0x00B7,0x00B7,0x00B7}, + {0x00B8,0x00B8,0x00B8}, {0x00B9,0x00B9,0x00B9}, + {0x00BA,0x00BA,0x00BA}, {0x00BB,0x00BB,0x00BB}, + {0x00BC,0x00BC,0x00BC}, {0x00BD,0x00BD,0x00BD}, + {0x00BE,0x00BE,0x00BE}, {0x00BF,0x00BF,0x00BF}, + {0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041}, + {0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041}, + {0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041}, + {0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043}, + {0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045}, + {0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045}, + {0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049}, + {0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049}, + {0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E}, + {0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F}, + {0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F}, + {0x00D6,0x00F6,0x004F}, {0x00D7,0x00D7,0x00D7}, + {0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055}, + {0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055}, + {0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059}, + {0x00DE,0x00FE,0x00DE}, {0x00DF,0x00DF,0x0053}, + {0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041}, + {0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041}, + {0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041}, + {0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043}, + {0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045}, + {0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045}, + {0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049}, + {0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049}, + {0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E}, + {0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F}, + {0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F}, + {0x00D6,0x00F6,0x004F}, {0x00F7,0x00F7,0x00F7}, + {0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055}, + {0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055}, + {0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059}, + {0x00DE,0x00FE,0x00DE}, {0x0178,0x00FF,0x0059} +}; + + + +static MY_UNICASE_INFO plane01[]={ + {0x0100,0x0101,0x0041}, {0x0100,0x0101,0x0041}, + {0x0102,0x0103,0x0041}, {0x0102,0x0103,0x0041}, + {0x0104,0x0105,0x0041}, {0x0104,0x0105,0x0041}, + {0x0106,0x0107,0x0043}, {0x0106,0x0107,0x0043}, + {0x0108,0x0109,0x0043}, {0x0108,0x0109,0x0043}, + {0x010A,0x010B,0x0043}, {0x010A,0x010B,0x0043}, + {0x010C,0x010D,0x0043}, {0x010C,0x010D,0x0043}, + {0x010E,0x010F,0x0044}, {0x010E,0x010F,0x0044}, + {0x0110,0x0111,0x0110}, {0x0110,0x0111,0x0110}, + {0x0112,0x0113,0x0045}, {0x0112,0x0113,0x0045}, + {0x0114,0x0115,0x0045}, {0x0114,0x0115,0x0045}, + {0x0116,0x0117,0x0045}, {0x0116,0x0117,0x0045}, + {0x0118,0x0119,0x0045}, {0x0118,0x0119,0x0045}, + {0x011A,0x011B,0x0045}, {0x011A,0x011B,0x0045}, + {0x011C,0x011D,0x0047}, {0x011C,0x011D,0x0047}, + {0x011E,0x011F,0x0047}, {0x011E,0x011F,0x0047}, + {0x0120,0x0121,0x0047}, {0x0120,0x0121,0x0047}, + {0x0122,0x0123,0x0047}, {0x0122,0x0123,0x0047}, + {0x0124,0x0125,0x0048}, {0x0124,0x0125,0x0048}, + {0x0126,0x0127,0x0126}, {0x0126,0x0127,0x0126}, + {0x0128,0x0129,0x0049}, {0x0128,0x0129,0x0049}, + {0x012A,0x012B,0x0049}, {0x012A,0x012B,0x0049}, + {0x012C,0x012D,0x0049}, {0x012C,0x012D,0x0049}, + {0x012E,0x012F,0x0049}, {0x012E,0x012F,0x0049}, + {0x0130,0x0069,0x0049}, {0x0049,0x0131,0x0049}, + {0x0132,0x0133,0x0132}, {0x0132,0x0133,0x0132}, + {0x0134,0x0135,0x004A}, {0x0134,0x0135,0x004A}, + {0x0136,0x0137,0x004B}, {0x0136,0x0137,0x004B}, + {0x0138,0x0138,0x0138}, {0x0139,0x013A,0x004C}, + {0x0139,0x013A,0x004C}, {0x013B,0x013C,0x004C}, + {0x013B,0x013C,0x004C}, {0x013D,0x013E,0x004C}, + {0x013D,0x013E,0x004C}, {0x013F,0x0140,0x013F}, + {0x013F,0x0140,0x013F}, {0x0141,0x0142,0x0141}, + {0x0141,0x0142,0x0141}, {0x0143,0x0144,0x004E}, + {0x0143,0x0144,0x004E}, {0x0145,0x0146,0x004E}, + {0x0145,0x0146,0x004E}, {0x0147,0x0148,0x004E}, + {0x0147,0x0148,0x004E}, {0x0149,0x0149,0x0149}, + {0x014A,0x014B,0x014A}, {0x014A,0x014B,0x014A}, + {0x014C,0x014D,0x004F}, {0x014C,0x014D,0x004F}, + {0x014E,0x014F,0x004F}, {0x014E,0x014F,0x004F}, + {0x0150,0x0151,0x004F}, {0x0150,0x0151,0x004F}, + {0x0152,0x0153,0x0152}, {0x0152,0x0153,0x0152}, + {0x0154,0x0155,0x0052}, {0x0154,0x0155,0x0052}, + {0x0156,0x0157,0x0052}, {0x0156,0x0157,0x0052}, + {0x0158,0x0159,0x0052}, {0x0158,0x0159,0x0052}, + {0x015A,0x015B,0x0053}, {0x015A,0x015B,0x0053}, + {0x015C,0x015D,0x0053}, {0x015C,0x015D,0x0053}, + {0x015E,0x015F,0x0053}, {0x015E,0x015F,0x0053}, + {0x0160,0x0161,0x0053}, {0x0160,0x0161,0x0053}, + {0x0162,0x0163,0x0054}, {0x0162,0x0163,0x0054}, + {0x0164,0x0165,0x0054}, {0x0164,0x0165,0x0054}, + {0x0166,0x0167,0x0166}, {0x0166,0x0167,0x0166}, + {0x0168,0x0169,0x0055}, {0x0168,0x0169,0x0055}, + {0x016A,0x016B,0x0055}, {0x016A,0x016B,0x0055}, + {0x016C,0x016D,0x0055}, {0x016C,0x016D,0x0055}, + {0x016E,0x016F,0x0055}, {0x016E,0x016F,0x0055}, + {0x0170,0x0171,0x0055}, {0x0170,0x0171,0x0055}, + {0x0172,0x0173,0x0055}, {0x0172,0x0173,0x0055}, + {0x0174,0x0175,0x0057}, {0x0174,0x0175,0x0057}, + {0x0176,0x0177,0x0059}, {0x0176,0x0177,0x0059}, + {0x0178,0x00FF,0x0059}, {0x0179,0x017A,0x005A}, + {0x0179,0x017A,0x005A}, {0x017B,0x017C,0x005A}, + {0x017B,0x017C,0x005A}, {0x017D,0x017E,0x005A}, + {0x017D,0x017E,0x005A}, {0x0053,0x017F,0x0053}, + {0x0180,0x0180,0x0180}, {0x0181,0x0253,0x0181}, + {0x0182,0x0183,0x0182}, {0x0182,0x0183,0x0182}, + {0x0184,0x0185,0x0184}, {0x0184,0x0185,0x0184}, + {0x0186,0x0254,0x0186}, {0x0187,0x0188,0x0187}, + {0x0187,0x0188,0x0187}, {0x0189,0x0256,0x0189}, + {0x018A,0x0257,0x018A}, {0x018B,0x018C,0x018B}, + {0x018B,0x018C,0x018B}, {0x018D,0x018D,0x018D}, + {0x018E,0x01DD,0x018E}, {0x018F,0x0259,0x018F}, + {0x0190,0x025B,0x0190}, {0x0191,0x0192,0x0191}, + {0x0191,0x0192,0x0191}, {0x0193,0x0260,0x0193}, + {0x0194,0x0263,0x0194}, {0x01F6,0x0195,0x01F6}, + {0x0196,0x0269,0x0196}, {0x0197,0x0268,0x0197}, + {0x0198,0x0199,0x0198}, {0x0198,0x0199,0x0198}, + {0x019A,0x019A,0x019A}, {0x019B,0x019B,0x019B}, + {0x019C,0x026F,0x019C}, {0x019D,0x0272,0x019D}, + {0x019E,0x019E,0x019E}, {0x019F,0x0275,0x019F}, + {0x01A0,0x01A1,0x004F}, {0x01A0,0x01A1,0x004F}, + {0x01A2,0x01A3,0x01A2}, {0x01A2,0x01A3,0x01A2}, + {0x01A4,0x01A5,0x01A4}, {0x01A4,0x01A5,0x01A4}, + {0x01A6,0x0280,0x01A6}, {0x01A7,0x01A8,0x01A7}, + {0x01A7,0x01A8,0x01A7}, {0x01A9,0x0283,0x01A9}, + {0x01AA,0x01AA,0x01AA}, {0x01AB,0x01AB,0x01AB}, + {0x01AC,0x01AD,0x01AC}, {0x01AC,0x01AD,0x01AC}, + {0x01AE,0x0288,0x01AE}, {0x01AF,0x01B0,0x0055}, + {0x01AF,0x01B0,0x0055}, {0x01B1,0x028A,0x01B1}, + {0x01B2,0x028B,0x01B2}, {0x01B3,0x01B4,0x01B3}, + {0x01B3,0x01B4,0x01B3}, {0x01B5,0x01B6,0x01B5}, + {0x01B5,0x01B6,0x01B5}, {0x01B7,0x0292,0x01B7}, + {0x01B8,0x01B9,0x01B8}, {0x01B8,0x01B9,0x01B8}, + {0x01BA,0x01BA,0x01BA}, {0x01BB,0x01BB,0x01BB}, + {0x01BC,0x01BD,0x01BC}, {0x01BC,0x01BD,0x01BC}, + {0x01BE,0x01BE,0x01BE}, {0x01F7,0x01BF,0x01F7}, + {0x01C0,0x01C0,0x01C0}, {0x01C1,0x01C1,0x01C1}, + {0x01C2,0x01C2,0x01C2}, {0x01C3,0x01C3,0x01C3}, + {0x01C4,0x01C6,0x01C4}, {0x01C4,0x01C6,0x01C4}, + {0x01C4,0x01C6,0x01C4}, {0x01C7,0x01C9,0x01C7}, + {0x01C7,0x01C9,0x01C7}, {0x01C7,0x01C9,0x01C7}, + {0x01CA,0x01CC,0x01CA}, {0x01CA,0x01CC,0x01CA}, + {0x01CA,0x01CC,0x01CA}, {0x01CD,0x01CE,0x0041}, + {0x01CD,0x01CE,0x0041}, {0x01CF,0x01D0,0x0049}, + {0x01CF,0x01D0,0x0049}, {0x01D1,0x01D2,0x004F}, + {0x01D1,0x01D2,0x004F}, {0x01D3,0x01D4,0x0055}, + {0x01D3,0x01D4,0x0055}, {0x01D5,0x01D6,0x0055}, + {0x01D5,0x01D6,0x0055}, {0x01D7,0x01D8,0x0055}, + {0x01D7,0x01D8,0x0055}, {0x01D9,0x01DA,0x0055}, + {0x01D9,0x01DA,0x0055}, {0x01DB,0x01DC,0x0055}, + {0x01DB,0x01DC,0x0055}, {0x018E,0x01DD,0x018E}, + {0x01DE,0x01DF,0x0041}, {0x01DE,0x01DF,0x0041}, + {0x01E0,0x01E1,0x0041}, {0x01E0,0x01E1,0x0041}, + {0x01E2,0x01E3,0x00C6}, {0x01E2,0x01E3,0x00C6}, + {0x01E4,0x01E5,0x01E4}, {0x01E4,0x01E5,0x01E4}, + {0x01E6,0x01E7,0x0047}, {0x01E6,0x01E7,0x0047}, + {0x01E8,0x01E9,0x004B}, {0x01E8,0x01E9,0x004B}, + {0x01EA,0x01EB,0x004F}, {0x01EA,0x01EB,0x004F}, + {0x01EC,0x01ED,0x004F}, {0x01EC,0x01ED,0x004F}, + {0x01EE,0x01EF,0x01B7}, {0x01EE,0x01EF,0x01B7}, + {0x01F0,0x01F0,0x004A}, {0x01F1,0x01F3,0x01F1}, + {0x01F1,0x01F3,0x01F1}, {0x01F1,0x01F3,0x01F1}, + {0x01F4,0x01F5,0x0047}, {0x01F4,0x01F5,0x0047}, + {0x01F6,0x0195,0x01F6}, {0x01F7,0x01BF,0x01F7}, + {0x01F8,0x01F9,0x004E}, {0x01F8,0x01F9,0x004E}, + {0x01FA,0x01FB,0x0041}, {0x01FA,0x01FB,0x0041}, + {0x01FC,0x01FD,0x00C6}, {0x01FC,0x01FD,0x00C6}, + {0x01FE,0x01FF,0x00D8}, {0x01FE,0x01FF,0x00D8} +}; + +static MY_UNICASE_INFO plane02[]={ + {0x0200,0x0201,0x0041}, {0x0200,0x0201,0x0041}, + {0x0202,0x0203,0x0041}, {0x0202,0x0203,0x0041}, + {0x0204,0x0205,0x0045}, {0x0204,0x0205,0x0045}, + {0x0206,0x0207,0x0045}, {0x0206,0x0207,0x0045}, + {0x0208,0x0209,0x0049}, {0x0208,0x0209,0x0049}, + {0x020A,0x020B,0x0049}, {0x020A,0x020B,0x0049}, + {0x020C,0x020D,0x004F}, {0x020C,0x020D,0x004F}, + {0x020E,0x020F,0x004F}, {0x020E,0x020F,0x004F}, + {0x0210,0x0211,0x0052}, {0x0210,0x0211,0x0052}, + {0x0212,0x0213,0x0052}, {0x0212,0x0213,0x0052}, + {0x0214,0x0215,0x0055}, {0x0214,0x0215,0x0055}, + {0x0216,0x0217,0x0055}, {0x0216,0x0217,0x0055}, + {0x0218,0x0219,0x0053}, {0x0218,0x0219,0x0053}, + {0x021A,0x021B,0x0054}, {0x021A,0x021B,0x0054}, + {0x021C,0x021D,0x021C}, {0x021C,0x021D,0x021C}, + {0x021E,0x021F,0x0048}, {0x021E,0x021F,0x0048}, + {0x0220,0x0220,0x0220}, {0x0221,0x0221,0x0221}, + {0x0222,0x0223,0x0222}, {0x0222,0x0223,0x0222}, + {0x0224,0x0225,0x0224}, {0x0224,0x0225,0x0224}, + {0x0226,0x0227,0x0041}, {0x0226,0x0227,0x0041}, + {0x0228,0x0229,0x0045}, {0x0228,0x0229,0x0045}, + {0x022A,0x022B,0x004F}, {0x022A,0x022B,0x004F}, + {0x022C,0x022D,0x004F}, {0x022C,0x022D,0x004F}, + {0x022E,0x022F,0x004F}, {0x022E,0x022F,0x004F}, + {0x0230,0x0231,0x004F}, {0x0230,0x0231,0x004F}, + {0x0232,0x0233,0x0059}, {0x0232,0x0233,0x0059}, + {0x0234,0x0234,0x0234}, {0x0235,0x0235,0x0235}, + {0x0236,0x0236,0x0236}, {0x0237,0x0237,0x0237}, + {0x0238,0x0238,0x0238}, {0x0239,0x0239,0x0239}, + {0x023A,0x023A,0x023A}, {0x023B,0x023B,0x023B}, + {0x023C,0x023C,0x023C}, {0x023D,0x023D,0x023D}, + {0x023E,0x023E,0x023E}, {0x023F,0x023F,0x023F}, + {0x0240,0x0240,0x0240}, {0x0241,0x0241,0x0241}, + {0x0242,0x0242,0x0242}, {0x0243,0x0243,0x0243}, + {0x0244,0x0244,0x0244}, {0x0245,0x0245,0x0245}, + {0x0246,0x0246,0x0246}, {0x0247,0x0247,0x0247}, + {0x0248,0x0248,0x0248}, {0x0249,0x0249,0x0249}, + {0x024A,0x024A,0x024A}, {0x024B,0x024B,0x024B}, + {0x024C,0x024C,0x024C}, {0x024D,0x024D,0x024D}, + {0x024E,0x024E,0x024E}, {0x024F,0x024F,0x024F}, + {0x0250,0x0250,0x0250}, {0x0251,0x0251,0x0251}, + {0x0252,0x0252,0x0252}, {0x0181,0x0253,0x0181}, + {0x0186,0x0254,0x0186}, {0x0255,0x0255,0x0255}, + {0x0189,0x0256,0x0189}, {0x018A,0x0257,0x018A}, + {0x0258,0x0258,0x0258}, {0x018F,0x0259,0x018F}, + {0x025A,0x025A,0x025A}, {0x0190,0x025B,0x0190}, + {0x025C,0x025C,0x025C}, {0x025D,0x025D,0x025D}, + {0x025E,0x025E,0x025E}, {0x025F,0x025F,0x025F}, + {0x0193,0x0260,0x0193}, {0x0261,0x0261,0x0261}, + {0x0262,0x0262,0x0262}, {0x0194,0x0263,0x0194}, + {0x0264,0x0264,0x0264}, {0x0265,0x0265,0x0265}, + {0x0266,0x0266,0x0266}, {0x0267,0x0267,0x0267}, + {0x0197,0x0268,0x0197}, {0x0196,0x0269,0x0196}, + {0x026A,0x026A,0x026A}, {0x026B,0x026B,0x026B}, + {0x026C,0x026C,0x026C}, {0x026D,0x026D,0x026D}, + {0x026E,0x026E,0x026E}, {0x019C,0x026F,0x019C}, + {0x0270,0x0270,0x0270}, {0x0271,0x0271,0x0271}, + {0x019D,0x0272,0x019D}, {0x0273,0x0273,0x0273}, + {0x0274,0x0274,0x0274}, {0x019F,0x0275,0x019F}, + {0x0276,0x0276,0x0276}, {0x0277,0x0277,0x0277}, + {0x0278,0x0278,0x0278}, {0x0279,0x0279,0x0279}, + {0x027A,0x027A,0x027A}, {0x027B,0x027B,0x027B}, + {0x027C,0x027C,0x027C}, {0x027D,0x027D,0x027D}, + {0x027E,0x027E,0x027E}, {0x027F,0x027F,0x027F}, + {0x01A6,0x0280,0x01A6}, {0x0281,0x0281,0x0281}, + {0x0282,0x0282,0x0282}, {0x01A9,0x0283,0x01A9}, + {0x0284,0x0284,0x0284}, {0x0285,0x0285,0x0285}, + {0x0286,0x0286,0x0286}, {0x0287,0x0287,0x0287}, + {0x01AE,0x0288,0x01AE}, {0x0289,0x0289,0x0289}, + {0x01B1,0x028A,0x01B1}, {0x01B2,0x028B,0x01B2}, + {0x028C,0x028C,0x028C}, {0x028D,0x028D,0x028D}, + {0x028E,0x028E,0x028E}, {0x028F,0x028F,0x028F}, + {0x0290,0x0290,0x0290}, {0x0291,0x0291,0x0291}, + {0x01B7,0x0292,0x01B7}, {0x0293,0x0293,0x0293}, + {0x0294,0x0294,0x0294}, {0x0295,0x0295,0x0295}, + {0x0296,0x0296,0x0296}, {0x0297,0x0297,0x0297}, + {0x0298,0x0298,0x0298}, {0x0299,0x0299,0x0299}, + {0x029A,0x029A,0x029A}, {0x029B,0x029B,0x029B}, + {0x029C,0x029C,0x029C}, {0x029D,0x029D,0x029D}, + {0x029E,0x029E,0x029E}, {0x029F,0x029F,0x029F}, + {0x02A0,0x02A0,0x02A0}, {0x02A1,0x02A1,0x02A1}, + {0x02A2,0x02A2,0x02A2}, {0x02A3,0x02A3,0x02A3}, + {0x02A4,0x02A4,0x02A4}, {0x02A5,0x02A5,0x02A5}, + {0x02A6,0x02A6,0x02A6}, {0x02A7,0x02A7,0x02A7}, + {0x02A8,0x02A8,0x02A8}, {0x02A9,0x02A9,0x02A9}, + {0x02AA,0x02AA,0x02AA}, {0x02AB,0x02AB,0x02AB}, + {0x02AC,0x02AC,0x02AC}, {0x02AD,0x02AD,0x02AD}, + {0x02AE,0x02AE,0x02AE}, {0x02AF,0x02AF,0x02AF}, + {0x02B0,0x02B0,0x02B0}, {0x02B1,0x02B1,0x02B1}, + {0x02B2,0x02B2,0x02B2}, {0x02B3,0x02B3,0x02B3}, + {0x02B4,0x02B4,0x02B4}, {0x02B5,0x02B5,0x02B5}, + {0x02B6,0x02B6,0x02B6}, {0x02B7,0x02B7,0x02B7}, + {0x02B8,0x02B8,0x02B8}, {0x02B9,0x02B9,0x02B9}, + {0x02BA,0x02BA,0x02BA}, {0x02BB,0x02BB,0x02BB}, + {0x02BC,0x02BC,0x02BC}, {0x02BD,0x02BD,0x02BD}, + {0x02BE,0x02BE,0x02BE}, {0x02BF,0x02BF,0x02BF}, + {0x02C0,0x02C0,0x02C0}, {0x02C1,0x02C1,0x02C1}, + {0x02C2,0x02C2,0x02C2}, {0x02C3,0x02C3,0x02C3}, + {0x02C4,0x02C4,0x02C4}, {0x02C5,0x02C5,0x02C5}, + {0x02C6,0x02C6,0x02C6}, {0x02C7,0x02C7,0x02C7}, + {0x02C8,0x02C8,0x02C8}, {0x02C9,0x02C9,0x02C9}, + {0x02CA,0x02CA,0x02CA}, {0x02CB,0x02CB,0x02CB}, + {0x02CC,0x02CC,0x02CC}, {0x02CD,0x02CD,0x02CD}, + {0x02CE,0x02CE,0x02CE}, {0x02CF,0x02CF,0x02CF}, + {0x02D0,0x02D0,0x02D0}, {0x02D1,0x02D1,0x02D1}, + {0x02D2,0x02D2,0x02D2}, {0x02D3,0x02D3,0x02D3}, + {0x02D4,0x02D4,0x02D4}, {0x02D5,0x02D5,0x02D5}, + {0x02D6,0x02D6,0x02D6}, {0x02D7,0x02D7,0x02D7}, + {0x02D8,0x02D8,0x02D8}, {0x02D9,0x02D9,0x02D9}, + {0x02DA,0x02DA,0x02DA}, {0x02DB,0x02DB,0x02DB}, + {0x02DC,0x02DC,0x02DC}, {0x02DD,0x02DD,0x02DD}, + {0x02DE,0x02DE,0x02DE}, {0x02DF,0x02DF,0x02DF}, + {0x02E0,0x02E0,0x02E0}, {0x02E1,0x02E1,0x02E1}, + {0x02E2,0x02E2,0x02E2}, {0x02E3,0x02E3,0x02E3}, + {0x02E4,0x02E4,0x02E4}, {0x02E5,0x02E5,0x02E5}, + {0x02E6,0x02E6,0x02E6}, {0x02E7,0x02E7,0x02E7}, + {0x02E8,0x02E8,0x02E8}, {0x02E9,0x02E9,0x02E9}, + {0x02EA,0x02EA,0x02EA}, {0x02EB,0x02EB,0x02EB}, + {0x02EC,0x02EC,0x02EC}, {0x02ED,0x02ED,0x02ED}, + {0x02EE,0x02EE,0x02EE}, {0x02EF,0x02EF,0x02EF}, + {0x02F0,0x02F0,0x02F0}, {0x02F1,0x02F1,0x02F1}, + {0x02F2,0x02F2,0x02F2}, {0x02F3,0x02F3,0x02F3}, + {0x02F4,0x02F4,0x02F4}, {0x02F5,0x02F5,0x02F5}, + {0x02F6,0x02F6,0x02F6}, {0x02F7,0x02F7,0x02F7}, + {0x02F8,0x02F8,0x02F8}, {0x02F9,0x02F9,0x02F9}, + {0x02FA,0x02FA,0x02FA}, {0x02FB,0x02FB,0x02FB}, + {0x02FC,0x02FC,0x02FC}, {0x02FD,0x02FD,0x02FD}, + {0x02FE,0x02FE,0x02FE}, {0x02FF,0x02FF,0x02FF} +}; + +static MY_UNICASE_INFO plane03[]={ + {0x0300,0x0300,0x0300}, {0x0301,0x0301,0x0301}, + {0x0302,0x0302,0x0302}, {0x0303,0x0303,0x0303}, + {0x0304,0x0304,0x0304}, {0x0305,0x0305,0x0305}, + {0x0306,0x0306,0x0306}, {0x0307,0x0307,0x0307}, + {0x0308,0x0308,0x0308}, {0x0309,0x0309,0x0309}, + {0x030A,0x030A,0x030A}, {0x030B,0x030B,0x030B}, + {0x030C,0x030C,0x030C}, {0x030D,0x030D,0x030D}, + {0x030E,0x030E,0x030E}, {0x030F,0x030F,0x030F}, + {0x0310,0x0310,0x0310}, {0x0311,0x0311,0x0311}, + {0x0312,0x0312,0x0312}, {0x0313,0x0313,0x0313}, + {0x0314,0x0314,0x0314}, {0x0315,0x0315,0x0315}, + {0x0316,0x0316,0x0316}, {0x0317,0x0317,0x0317}, + {0x0318,0x0318,0x0318}, {0x0319,0x0319,0x0319}, + {0x031A,0x031A,0x031A}, {0x031B,0x031B,0x031B}, + {0x031C,0x031C,0x031C}, {0x031D,0x031D,0x031D}, + {0x031E,0x031E,0x031E}, {0x031F,0x031F,0x031F}, + {0x0320,0x0320,0x0320}, {0x0321,0x0321,0x0321}, + {0x0322,0x0322,0x0322}, {0x0323,0x0323,0x0323}, + {0x0324,0x0324,0x0324}, {0x0325,0x0325,0x0325}, + {0x0326,0x0326,0x0326}, {0x0327,0x0327,0x0327}, + {0x0328,0x0328,0x0328}, {0x0329,0x0329,0x0329}, + {0x032A,0x032A,0x032A}, {0x032B,0x032B,0x032B}, + {0x032C,0x032C,0x032C}, {0x032D,0x032D,0x032D}, + {0x032E,0x032E,0x032E}, {0x032F,0x032F,0x032F}, + {0x0330,0x0330,0x0330}, {0x0331,0x0331,0x0331}, + {0x0332,0x0332,0x0332}, {0x0333,0x0333,0x0333}, + {0x0334,0x0334,0x0334}, {0x0335,0x0335,0x0335}, + {0x0336,0x0336,0x0336}, {0x0337,0x0337,0x0337}, + {0x0338,0x0338,0x0338}, {0x0339,0x0339,0x0339}, + {0x033A,0x033A,0x033A}, {0x033B,0x033B,0x033B}, + {0x033C,0x033C,0x033C}, {0x033D,0x033D,0x033D}, + {0x033E,0x033E,0x033E}, {0x033F,0x033F,0x033F}, + {0x0340,0x0340,0x0340}, {0x0341,0x0341,0x0341}, + {0x0342,0x0342,0x0342}, {0x0343,0x0343,0x0343}, + {0x0344,0x0344,0x0344}, {0x0399,0x0345,0x0399}, + {0x0346,0x0346,0x0346}, {0x0347,0x0347,0x0347}, + {0x0348,0x0348,0x0348}, {0x0349,0x0349,0x0349}, + {0x034A,0x034A,0x034A}, {0x034B,0x034B,0x034B}, + {0x034C,0x034C,0x034C}, {0x034D,0x034D,0x034D}, + {0x034E,0x034E,0x034E}, {0x034F,0x034F,0x034F}, + {0x0350,0x0350,0x0350}, {0x0351,0x0351,0x0351}, + {0x0352,0x0352,0x0352}, {0x0353,0x0353,0x0353}, + {0x0354,0x0354,0x0354}, {0x0355,0x0355,0x0355}, + {0x0356,0x0356,0x0356}, {0x0357,0x0357,0x0357}, + {0x0358,0x0358,0x0358}, {0x0359,0x0359,0x0359}, + {0x035A,0x035A,0x035A}, {0x035B,0x035B,0x035B}, + {0x035C,0x035C,0x035C}, {0x035D,0x035D,0x035D}, + {0x035E,0x035E,0x035E}, {0x035F,0x035F,0x035F}, + {0x0360,0x0360,0x0360}, {0x0361,0x0361,0x0361}, + {0x0362,0x0362,0x0362}, {0x0363,0x0363,0x0363}, + {0x0364,0x0364,0x0364}, {0x0365,0x0365,0x0365}, + {0x0366,0x0366,0x0366}, {0x0367,0x0367,0x0367}, + {0x0368,0x0368,0x0368}, {0x0369,0x0369,0x0369}, + {0x036A,0x036A,0x036A}, {0x036B,0x036B,0x036B}, + {0x036C,0x036C,0x036C}, {0x036D,0x036D,0x036D}, + {0x036E,0x036E,0x036E}, {0x036F,0x036F,0x036F}, + {0x0370,0x0370,0x0370}, {0x0371,0x0371,0x0371}, + {0x0372,0x0372,0x0372}, {0x0373,0x0373,0x0373}, + {0x0374,0x0374,0x0374}, {0x0375,0x0375,0x0375}, + {0x0376,0x0376,0x0376}, {0x0377,0x0377,0x0377}, + {0x0378,0x0378,0x0378}, {0x0379,0x0379,0x0379}, + {0x037A,0x037A,0x037A}, {0x037B,0x037B,0x037B}, + {0x037C,0x037C,0x037C}, {0x037D,0x037D,0x037D}, + {0x037E,0x037E,0x037E}, {0x037F,0x037F,0x037F}, + {0x0380,0x0380,0x0380}, {0x0381,0x0381,0x0381}, + {0x0382,0x0382,0x0382}, {0x0383,0x0383,0x0383}, + {0x0384,0x0384,0x0384}, {0x0385,0x0385,0x0385}, + {0x0386,0x03AC,0x0391}, {0x0387,0x0387,0x0387}, + {0x0388,0x03AD,0x0395}, {0x0389,0x03AE,0x0397}, + {0x038A,0x03AF,0x0399}, {0x038B,0x038B,0x038B}, + {0x038C,0x03CC,0x039F}, {0x038D,0x038D,0x038D}, + {0x038E,0x03CD,0x03A5}, {0x038F,0x03CE,0x03A9}, + {0x0390,0x0390,0x0399}, {0x0391,0x03B1,0x0391}, + {0x0392,0x03B2,0x0392}, {0x0393,0x03B3,0x0393}, + {0x0394,0x03B4,0x0394}, {0x0395,0x03B5,0x0395}, + {0x0396,0x03B6,0x0396}, {0x0397,0x03B7,0x0397}, + {0x0398,0x03B8,0x0398}, {0x0399,0x03B9,0x0399}, + {0x039A,0x03BA,0x039A}, {0x039B,0x03BB,0x039B}, + {0x039C,0x03BC,0x039C}, {0x039D,0x03BD,0x039D}, + {0x039E,0x03BE,0x039E}, {0x039F,0x03BF,0x039F}, + {0x03A0,0x03C0,0x03A0}, {0x03A1,0x03C1,0x03A1}, + {0x03A2,0x03A2,0x03A2}, {0x03A3,0x03C3,0x03A3}, + {0x03A4,0x03C4,0x03A4}, {0x03A5,0x03C5,0x03A5}, + {0x03A6,0x03C6,0x03A6}, {0x03A7,0x03C7,0x03A7}, + {0x03A8,0x03C8,0x03A8}, {0x03A9,0x03C9,0x03A9}, + {0x03AA,0x03CA,0x0399}, {0x03AB,0x03CB,0x03A5}, + {0x0386,0x03AC,0x0391}, {0x0388,0x03AD,0x0395}, + {0x0389,0x03AE,0x0397}, {0x038A,0x03AF,0x0399}, + {0x03B0,0x03B0,0x03A5}, {0x0391,0x03B1,0x0391}, + {0x0392,0x03B2,0x0392}, {0x0393,0x03B3,0x0393}, + {0x0394,0x03B4,0x0394}, {0x0395,0x03B5,0x0395}, + {0x0396,0x03B6,0x0396}, {0x0397,0x03B7,0x0397}, + {0x0398,0x03B8,0x0398}, {0x0399,0x03B9,0x0399}, + {0x039A,0x03BA,0x039A}, {0x039B,0x03BB,0x039B}, + {0x039C,0x03BC,0x039C}, {0x039D,0x03BD,0x039D}, + {0x039E,0x03BE,0x039E}, {0x039F,0x03BF,0x039F}, + {0x03A0,0x03C0,0x03A0}, {0x03A1,0x03C1,0x03A1}, + {0x03A3,0x03C2,0x03A3}, {0x03A3,0x03C3,0x03A3}, + {0x03A4,0x03C4,0x03A4}, {0x03A5,0x03C5,0x03A5}, + {0x03A6,0x03C6,0x03A6}, {0x03A7,0x03C7,0x03A7}, + {0x03A8,0x03C8,0x03A8}, {0x03A9,0x03C9,0x03A9}, + {0x03AA,0x03CA,0x0399}, {0x03AB,0x03CB,0x03A5}, + {0x038C,0x03CC,0x039F}, {0x038E,0x03CD,0x03A5}, + {0x038F,0x03CE,0x03A9}, {0x03CF,0x03CF,0x03CF}, + {0x0392,0x03D0,0x0392}, {0x0398,0x03D1,0x0398}, + {0x03D2,0x03D2,0x03D2}, {0x03D3,0x03D3,0x03D2}, + {0x03D4,0x03D4,0x03D2}, {0x03A6,0x03D5,0x03A6}, + {0x03A0,0x03D6,0x03A0}, {0x03D7,0x03D7,0x03D7}, + {0x03D8,0x03D8,0x03D8}, {0x03D9,0x03D9,0x03D9}, + {0x03DA,0x03DB,0x03DA}, {0x03DA,0x03DB,0x03DA}, + {0x03DC,0x03DD,0x03DC}, {0x03DC,0x03DD,0x03DC}, + {0x03DE,0x03DF,0x03DE}, {0x03DE,0x03DF,0x03DE}, + {0x03E0,0x03E1,0x03E0}, {0x03E0,0x03E1,0x03E0}, + {0x03E2,0x03E3,0x03E2}, {0x03E2,0x03E3,0x03E2}, + {0x03E4,0x03E5,0x03E4}, {0x03E4,0x03E5,0x03E4}, + {0x03E6,0x03E7,0x03E6}, {0x03E6,0x03E7,0x03E6}, + {0x03E8,0x03E9,0x03E8}, {0x03E8,0x03E9,0x03E8}, + {0x03EA,0x03EB,0x03EA}, {0x03EA,0x03EB,0x03EA}, + {0x03EC,0x03ED,0x03EC}, {0x03EC,0x03ED,0x03EC}, + {0x03EE,0x03EF,0x03EE}, {0x03EE,0x03EF,0x03EE}, + {0x039A,0x03F0,0x039A}, {0x03A1,0x03F1,0x03A1}, + {0x03A3,0x03F2,0x03A3}, {0x03F3,0x03F3,0x03F3}, + {0x03F4,0x03F4,0x03F4}, {0x03F5,0x03F5,0x03F5}, + {0x03F6,0x03F6,0x03F6}, {0x03F7,0x03F7,0x03F7}, + {0x03F8,0x03F8,0x03F8}, {0x03F9,0x03F9,0x03F9}, + {0x03FA,0x03FA,0x03FA}, {0x03FB,0x03FB,0x03FB}, + {0x03FC,0x03FC,0x03FC}, {0x03FD,0x03FD,0x03FD}, + {0x03FE,0x03FE,0x03FE}, {0x03FF,0x03FF,0x03FF} +}; + +static MY_UNICASE_INFO plane04[]={ + {0x0400,0x0450,0x0415}, {0x0401,0x0451,0x0415}, + {0x0402,0x0452,0x0402}, {0x0403,0x0453,0x0413}, + {0x0404,0x0454,0x0404}, {0x0405,0x0455,0x0405}, + {0x0406,0x0456,0x0406}, {0x0407,0x0457,0x0406}, + {0x0408,0x0458,0x0408}, {0x0409,0x0459,0x0409}, + {0x040A,0x045A,0x040A}, {0x040B,0x045B,0x040B}, + {0x040C,0x045C,0x041A}, {0x040D,0x045D,0x0418}, + {0x040E,0x045E,0x0423}, {0x040F,0x045F,0x040F}, + {0x0410,0x0430,0x0410}, {0x0411,0x0431,0x0411}, + {0x0412,0x0432,0x0412}, {0x0413,0x0433,0x0413}, + {0x0414,0x0434,0x0414}, {0x0415,0x0435,0x0415}, + {0x0416,0x0436,0x0416}, {0x0417,0x0437,0x0417}, + {0x0418,0x0438,0x0418}, {0x0419,0x0439,0x0419}, + {0x041A,0x043A,0x041A}, {0x041B,0x043B,0x041B}, + {0x041C,0x043C,0x041C}, {0x041D,0x043D,0x041D}, + {0x041E,0x043E,0x041E}, {0x041F,0x043F,0x041F}, + {0x0420,0x0440,0x0420}, {0x0421,0x0441,0x0421}, + {0x0422,0x0442,0x0422}, {0x0423,0x0443,0x0423}, + {0x0424,0x0444,0x0424}, {0x0425,0x0445,0x0425}, + {0x0426,0x0446,0x0426}, {0x0427,0x0447,0x0427}, + {0x0428,0x0448,0x0428}, {0x0429,0x0449,0x0429}, + {0x042A,0x044A,0x042A}, {0x042B,0x044B,0x042B}, + {0x042C,0x044C,0x042C}, {0x042D,0x044D,0x042D}, + {0x042E,0x044E,0x042E}, {0x042F,0x044F,0x042F}, + {0x0410,0x0430,0x0410}, {0x0411,0x0431,0x0411}, + {0x0412,0x0432,0x0412}, {0x0413,0x0433,0x0413}, + {0x0414,0x0434,0x0414}, {0x0415,0x0435,0x0415}, + {0x0416,0x0436,0x0416}, {0x0417,0x0437,0x0417}, + {0x0418,0x0438,0x0418}, {0x0419,0x0439,0x0419}, + {0x041A,0x043A,0x041A}, {0x041B,0x043B,0x041B}, + {0x041C,0x043C,0x041C}, {0x041D,0x043D,0x041D}, + {0x041E,0x043E,0x041E}, {0x041F,0x043F,0x041F}, + {0x0420,0x0440,0x0420}, {0x0421,0x0441,0x0421}, + {0x0422,0x0442,0x0422}, {0x0423,0x0443,0x0423}, + {0x0424,0x0444,0x0424}, {0x0425,0x0445,0x0425}, + {0x0426,0x0446,0x0426}, {0x0427,0x0447,0x0427}, + {0x0428,0x0448,0x0428}, {0x0429,0x0449,0x0429}, + {0x042A,0x044A,0x042A}, {0x042B,0x044B,0x042B}, + {0x042C,0x044C,0x042C}, {0x042D,0x044D,0x042D}, + {0x042E,0x044E,0x042E}, {0x042F,0x044F,0x042F}, + {0x0400,0x0450,0x0415}, {0x0401,0x0451,0x0415}, + {0x0402,0x0452,0x0402}, {0x0403,0x0453,0x0413}, + {0x0404,0x0454,0x0404}, {0x0405,0x0455,0x0405}, + {0x0406,0x0456,0x0406}, {0x0407,0x0457,0x0406}, + {0x0408,0x0458,0x0408}, {0x0409,0x0459,0x0409}, + {0x040A,0x045A,0x040A}, {0x040B,0x045B,0x040B}, + {0x040C,0x045C,0x041A}, {0x040D,0x045D,0x0418}, + {0x040E,0x045E,0x0423}, {0x040F,0x045F,0x040F}, + {0x0460,0x0461,0x0460}, {0x0460,0x0461,0x0460}, + {0x0462,0x0463,0x0462}, {0x0462,0x0463,0x0462}, + {0x0464,0x0465,0x0464}, {0x0464,0x0465,0x0464}, + {0x0466,0x0467,0x0466}, {0x0466,0x0467,0x0466}, + {0x0468,0x0469,0x0468}, {0x0468,0x0469,0x0468}, + {0x046A,0x046B,0x046A}, {0x046A,0x046B,0x046A}, + {0x046C,0x046D,0x046C}, {0x046C,0x046D,0x046C}, + {0x046E,0x046F,0x046E}, {0x046E,0x046F,0x046E}, + {0x0470,0x0471,0x0470}, {0x0470,0x0471,0x0470}, + {0x0472,0x0473,0x0472}, {0x0472,0x0473,0x0472}, + {0x0474,0x0475,0x0474}, {0x0474,0x0475,0x0474}, + {0x0476,0x0477,0x0474}, {0x0476,0x0477,0x0474}, + {0x0478,0x0479,0x0478}, {0x0478,0x0479,0x0478}, + {0x047A,0x047B,0x047A}, {0x047A,0x047B,0x047A}, + {0x047C,0x047D,0x047C}, {0x047C,0x047D,0x047C}, + {0x047E,0x047F,0x047E}, {0x047E,0x047F,0x047E}, + {0x0480,0x0481,0x0480}, {0x0480,0x0481,0x0480}, + {0x0482,0x0482,0x0482}, {0x0483,0x0483,0x0483}, + {0x0484,0x0484,0x0484}, {0x0485,0x0485,0x0485}, + {0x0486,0x0486,0x0486}, {0x0487,0x0487,0x0487}, + {0x0488,0x0488,0x0488}, {0x0489,0x0489,0x0489}, + {0x048A,0x048A,0x048A}, {0x048B,0x048B,0x048B}, + {0x048C,0x048D,0x048C}, {0x048C,0x048D,0x048C}, + {0x048E,0x048F,0x048E}, {0x048E,0x048F,0x048E}, + {0x0490,0x0491,0x0490}, {0x0490,0x0491,0x0490}, + {0x0492,0x0493,0x0492}, {0x0492,0x0493,0x0492}, + {0x0494,0x0495,0x0494}, {0x0494,0x0495,0x0494}, + {0x0496,0x0497,0x0496}, {0x0496,0x0497,0x0496}, + {0x0498,0x0499,0x0498}, {0x0498,0x0499,0x0498}, + {0x049A,0x049B,0x049A}, {0x049A,0x049B,0x049A}, + {0x049C,0x049D,0x049C}, {0x049C,0x049D,0x049C}, + {0x049E,0x049F,0x049E}, {0x049E,0x049F,0x049E}, + {0x04A0,0x04A1,0x04A0}, {0x04A0,0x04A1,0x04A0}, + {0x04A2,0x04A3,0x04A2}, {0x04A2,0x04A3,0x04A2}, + {0x04A4,0x04A5,0x04A4}, {0x04A4,0x04A5,0x04A4}, + {0x04A6,0x04A7,0x04A6}, {0x04A6,0x04A7,0x04A6}, + {0x04A8,0x04A9,0x04A8}, {0x04A8,0x04A9,0x04A8}, + {0x04AA,0x04AB,0x04AA}, {0x04AA,0x04AB,0x04AA}, + {0x04AC,0x04AD,0x04AC}, {0x04AC,0x04AD,0x04AC}, + {0x04AE,0x04AF,0x04AE}, {0x04AE,0x04AF,0x04AE}, + {0x04B0,0x04B1,0x04B0}, {0x04B0,0x04B1,0x04B0}, + {0x04B2,0x04B3,0x04B2}, {0x04B2,0x04B3,0x04B2}, + {0x04B4,0x04B5,0x04B4}, {0x04B4,0x04B5,0x04B4}, + {0x04B6,0x04B7,0x04B6}, {0x04B6,0x04B7,0x04B6}, + {0x04B8,0x04B9,0x04B8}, {0x04B8,0x04B9,0x04B8}, + {0x04BA,0x04BB,0x04BA}, {0x04BA,0x04BB,0x04BA}, + {0x04BC,0x04BD,0x04BC}, {0x04BC,0x04BD,0x04BC}, + {0x04BE,0x04BF,0x04BE}, {0x04BE,0x04BF,0x04BE}, + {0x04C0,0x04C0,0x04C0}, {0x04C1,0x04C2,0x0416}, + {0x04C1,0x04C2,0x0416}, {0x04C3,0x04C4,0x04C3}, + {0x04C3,0x04C4,0x04C3}, {0x04C5,0x04C5,0x04C5}, + {0x04C6,0x04C6,0x04C6}, {0x04C7,0x04C8,0x04C7}, + {0x04C7,0x04C8,0x04C7}, {0x04C9,0x04C9,0x04C9}, + {0x04CA,0x04CA,0x04CA}, {0x04CB,0x04CC,0x04CB}, + {0x04CB,0x04CC,0x04CB}, {0x04CD,0x04CD,0x04CD}, + {0x04CE,0x04CE,0x04CE}, {0x04CF,0x04CF,0x04CF}, + {0x04D0,0x04D1,0x0410}, {0x04D0,0x04D1,0x0410}, + {0x04D2,0x04D3,0x0410}, {0x04D2,0x04D3,0x0410}, + {0x04D4,0x04D5,0x04D4}, {0x04D4,0x04D5,0x04D4}, + {0x04D6,0x04D7,0x0415}, {0x04D6,0x04D7,0x0415}, + {0x04D8,0x04D9,0x04D8}, {0x04D8,0x04D9,0x04D8}, + {0x04DA,0x04DB,0x04D8}, {0x04DA,0x04DB,0x04D8}, + {0x04DC,0x04DD,0x0416}, {0x04DC,0x04DD,0x0416}, + {0x04DE,0x04DF,0x0417}, {0x04DE,0x04DF,0x0417}, + {0x04E0,0x04E1,0x04E0}, {0x04E0,0x04E1,0x04E0}, + {0x04E2,0x04E3,0x0418}, {0x04E2,0x04E3,0x0418}, + {0x04E4,0x04E5,0x0418}, {0x04E4,0x04E5,0x0418}, + {0x04E6,0x04E7,0x041E}, {0x04E6,0x04E7,0x041E}, + {0x04E8,0x04E9,0x04E8}, {0x04E8,0x04E9,0x04E8}, + {0x04EA,0x04EB,0x04E8}, {0x04EA,0x04EB,0x04E8}, + {0x04EC,0x04ED,0x042D}, {0x04EC,0x04ED,0x042D}, + {0x04EE,0x04EF,0x0423}, {0x04EE,0x04EF,0x0423}, + {0x04F0,0x04F1,0x0423}, {0x04F0,0x04F1,0x0423}, + {0x04F2,0x04F3,0x0423}, {0x04F2,0x04F3,0x0423}, + {0x04F4,0x04F5,0x0427}, {0x04F4,0x04F5,0x0427}, + {0x04F6,0x04F6,0x04F6}, {0x04F7,0x04F7,0x04F7}, + {0x04F8,0x04F9,0x042B}, {0x04F8,0x04F9,0x042B}, + {0x04FA,0x04FA,0x04FA}, {0x04FB,0x04FB,0x04FB}, + {0x04FC,0x04FC,0x04FC}, {0x04FD,0x04FD,0x04FD}, + {0x04FE,0x04FE,0x04FE}, {0x04FF,0x04FF,0x04FF} +}; + +static MY_UNICASE_INFO plane05[]={ + {0x0500,0x0500,0x0500}, {0x0501,0x0501,0x0501}, + {0x0502,0x0502,0x0502}, {0x0503,0x0503,0x0503}, + {0x0504,0x0504,0x0504}, {0x0505,0x0505,0x0505}, + {0x0506,0x0506,0x0506}, {0x0507,0x0507,0x0507}, + {0x0508,0x0508,0x0508}, {0x0509,0x0509,0x0509}, + {0x050A,0x050A,0x050A}, {0x050B,0x050B,0x050B}, + {0x050C,0x050C,0x050C}, {0x050D,0x050D,0x050D}, + {0x050E,0x050E,0x050E}, {0x050F,0x050F,0x050F}, + {0x0510,0x0510,0x0510}, {0x0511,0x0511,0x0511}, + {0x0512,0x0512,0x0512}, {0x0513,0x0513,0x0513}, + {0x0514,0x0514,0x0514}, {0x0515,0x0515,0x0515}, + {0x0516,0x0516,0x0516}, {0x0517,0x0517,0x0517}, + {0x0518,0x0518,0x0518}, {0x0519,0x0519,0x0519}, + {0x051A,0x051A,0x051A}, {0x051B,0x051B,0x051B}, + {0x051C,0x051C,0x051C}, {0x051D,0x051D,0x051D}, + {0x051E,0x051E,0x051E}, {0x051F,0x051F,0x051F}, + {0x0520,0x0520,0x0520}, {0x0521,0x0521,0x0521}, + {0x0522,0x0522,0x0522}, {0x0523,0x0523,0x0523}, + {0x0524,0x0524,0x0524}, {0x0525,0x0525,0x0525}, + {0x0526,0x0526,0x0526}, {0x0527,0x0527,0x0527}, + {0x0528,0x0528,0x0528}, {0x0529,0x0529,0x0529}, + {0x052A,0x052A,0x052A}, {0x052B,0x052B,0x052B}, + {0x052C,0x052C,0x052C}, {0x052D,0x052D,0x052D}, + {0x052E,0x052E,0x052E}, {0x052F,0x052F,0x052F}, + {0x0530,0x0530,0x0530}, {0x0531,0x0561,0x0531}, + {0x0532,0x0562,0x0532}, {0x0533,0x0563,0x0533}, + {0x0534,0x0564,0x0534}, {0x0535,0x0565,0x0535}, + {0x0536,0x0566,0x0536}, {0x0537,0x0567,0x0537}, + {0x0538,0x0568,0x0538}, {0x0539,0x0569,0x0539}, + {0x053A,0x056A,0x053A}, {0x053B,0x056B,0x053B}, + {0x053C,0x056C,0x053C}, {0x053D,0x056D,0x053D}, + {0x053E,0x056E,0x053E}, {0x053F,0x056F,0x053F}, + {0x0540,0x0570,0x0540}, {0x0541,0x0571,0x0541}, + {0x0542,0x0572,0x0542}, {0x0543,0x0573,0x0543}, + {0x0544,0x0574,0x0544}, {0x0545,0x0575,0x0545}, + {0x0546,0x0576,0x0546}, {0x0547,0x0577,0x0547}, + {0x0548,0x0578,0x0548}, {0x0549,0x0579,0x0549}, + {0x054A,0x057A,0x054A}, {0x054B,0x057B,0x054B}, + {0x054C,0x057C,0x054C}, {0x054D,0x057D,0x054D}, + {0x054E,0x057E,0x054E}, {0x054F,0x057F,0x054F}, + {0x0550,0x0580,0x0550}, {0x0551,0x0581,0x0551}, + {0x0552,0x0582,0x0552}, {0x0553,0x0583,0x0553}, + {0x0554,0x0584,0x0554}, {0x0555,0x0585,0x0555}, + {0x0556,0x0586,0x0556}, {0x0557,0x0557,0x0557}, + {0x0558,0x0558,0x0558}, {0x0559,0x0559,0x0559}, + {0x055A,0x055A,0x055A}, {0x055B,0x055B,0x055B}, + {0x055C,0x055C,0x055C}, {0x055D,0x055D,0x055D}, + {0x055E,0x055E,0x055E}, {0x055F,0x055F,0x055F}, + {0x0560,0x0560,0x0560}, {0x0531,0x0561,0x0531}, + {0x0532,0x0562,0x0532}, {0x0533,0x0563,0x0533}, + {0x0534,0x0564,0x0534}, {0x0535,0x0565,0x0535}, + {0x0536,0x0566,0x0536}, {0x0537,0x0567,0x0537}, + {0x0538,0x0568,0x0538}, {0x0539,0x0569,0x0539}, + {0x053A,0x056A,0x053A}, {0x053B,0x056B,0x053B}, + {0x053C,0x056C,0x053C}, {0x053D,0x056D,0x053D}, + {0x053E,0x056E,0x053E}, {0x053F,0x056F,0x053F}, + {0x0540,0x0570,0x0540}, {0x0541,0x0571,0x0541}, + {0x0542,0x0572,0x0542}, {0x0543,0x0573,0x0543}, + {0x0544,0x0574,0x0544}, {0x0545,0x0575,0x0545}, + {0x0546,0x0576,0x0546}, {0x0547,0x0577,0x0547}, + {0x0548,0x0578,0x0548}, {0x0549,0x0579,0x0549}, + {0x054A,0x057A,0x054A}, {0x054B,0x057B,0x054B}, + {0x054C,0x057C,0x054C}, {0x054D,0x057D,0x054D}, + {0x054E,0x057E,0x054E}, {0x054F,0x057F,0x054F}, + {0x0550,0x0580,0x0550}, {0x0551,0x0581,0x0551}, + {0x0552,0x0582,0x0552}, {0x0553,0x0583,0x0553}, + {0x0554,0x0584,0x0554}, {0x0555,0x0585,0x0555}, + {0x0556,0x0586,0x0556}, {0x0587,0x0587,0x0587}, + {0x0588,0x0588,0x0588}, {0x0589,0x0589,0x0589}, + {0x058A,0x058A,0x058A}, {0x058B,0x058B,0x058B}, + {0x058C,0x058C,0x058C}, {0x058D,0x058D,0x058D}, + {0x058E,0x058E,0x058E}, {0x058F,0x058F,0x058F}, + {0x0590,0x0590,0x0590}, {0x0591,0x0591,0x0591}, + {0x0592,0x0592,0x0592}, {0x0593,0x0593,0x0593}, + {0x0594,0x0594,0x0594}, {0x0595,0x0595,0x0595}, + {0x0596,0x0596,0x0596}, {0x0597,0x0597,0x0597}, + {0x0598,0x0598,0x0598}, {0x0599,0x0599,0x0599}, + {0x059A,0x059A,0x059A}, {0x059B,0x059B,0x059B}, + {0x059C,0x059C,0x059C}, {0x059D,0x059D,0x059D}, + {0x059E,0x059E,0x059E}, {0x059F,0x059F,0x059F}, + {0x05A0,0x05A0,0x05A0}, {0x05A1,0x05A1,0x05A1}, + {0x05A2,0x05A2,0x05A2}, {0x05A3,0x05A3,0x05A3}, + {0x05A4,0x05A4,0x05A4}, {0x05A5,0x05A5,0x05A5}, + {0x05A6,0x05A6,0x05A6}, {0x05A7,0x05A7,0x05A7}, + {0x05A8,0x05A8,0x05A8}, {0x05A9,0x05A9,0x05A9}, + {0x05AA,0x05AA,0x05AA}, {0x05AB,0x05AB,0x05AB}, + {0x05AC,0x05AC,0x05AC}, {0x05AD,0x05AD,0x05AD}, + {0x05AE,0x05AE,0x05AE}, {0x05AF,0x05AF,0x05AF}, + {0x05B0,0x05B0,0x05B0}, {0x05B1,0x05B1,0x05B1}, + {0x05B2,0x05B2,0x05B2}, {0x05B3,0x05B3,0x05B3}, + {0x05B4,0x05B4,0x05B4}, {0x05B5,0x05B5,0x05B5}, + {0x05B6,0x05B6,0x05B6}, {0x05B7,0x05B7,0x05B7}, + {0x05B8,0x05B8,0x05B8}, {0x05B9,0x05B9,0x05B9}, + {0x05BA,0x05BA,0x05BA}, {0x05BB,0x05BB,0x05BB}, + {0x05BC,0x05BC,0x05BC}, {0x05BD,0x05BD,0x05BD}, + {0x05BE,0x05BE,0x05BE}, {0x05BF,0x05BF,0x05BF}, + {0x05C0,0x05C0,0x05C0}, {0x05C1,0x05C1,0x05C1}, + {0x05C2,0x05C2,0x05C2}, {0x05C3,0x05C3,0x05C3}, + {0x05C4,0x05C4,0x05C4}, {0x05C5,0x05C5,0x05C5}, + {0x05C6,0x05C6,0x05C6}, {0x05C7,0x05C7,0x05C7}, + {0x05C8,0x05C8,0x05C8}, {0x05C9,0x05C9,0x05C9}, + {0x05CA,0x05CA,0x05CA}, {0x05CB,0x05CB,0x05CB}, + {0x05CC,0x05CC,0x05CC}, {0x05CD,0x05CD,0x05CD}, + {0x05CE,0x05CE,0x05CE}, {0x05CF,0x05CF,0x05CF}, + {0x05D0,0x05D0,0x05D0}, {0x05D1,0x05D1,0x05D1}, + {0x05D2,0x05D2,0x05D2}, {0x05D3,0x05D3,0x05D3}, + {0x05D4,0x05D4,0x05D4}, {0x05D5,0x05D5,0x05D5}, + {0x05D6,0x05D6,0x05D6}, {0x05D7,0x05D7,0x05D7}, + {0x05D8,0x05D8,0x05D8}, {0x05D9,0x05D9,0x05D9}, + {0x05DA,0x05DA,0x05DA}, {0x05DB,0x05DB,0x05DB}, + {0x05DC,0x05DC,0x05DC}, {0x05DD,0x05DD,0x05DD}, + {0x05DE,0x05DE,0x05DE}, {0x05DF,0x05DF,0x05DF}, + {0x05E0,0x05E0,0x05E0}, {0x05E1,0x05E1,0x05E1}, + {0x05E2,0x05E2,0x05E2}, {0x05E3,0x05E3,0x05E3}, + {0x05E4,0x05E4,0x05E4}, {0x05E5,0x05E5,0x05E5}, + {0x05E6,0x05E6,0x05E6}, {0x05E7,0x05E7,0x05E7}, + {0x05E8,0x05E8,0x05E8}, {0x05E9,0x05E9,0x05E9}, + {0x05EA,0x05EA,0x05EA}, {0x05EB,0x05EB,0x05EB}, + {0x05EC,0x05EC,0x05EC}, {0x05ED,0x05ED,0x05ED}, + {0x05EE,0x05EE,0x05EE}, {0x05EF,0x05EF,0x05EF}, + {0x05F0,0x05F0,0x05F0}, {0x05F1,0x05F1,0x05F1}, + {0x05F2,0x05F2,0x05F2}, {0x05F3,0x05F3,0x05F3}, + {0x05F4,0x05F4,0x05F4}, {0x05F5,0x05F5,0x05F5}, + {0x05F6,0x05F6,0x05F6}, {0x05F7,0x05F7,0x05F7}, + {0x05F8,0x05F8,0x05F8}, {0x05F9,0x05F9,0x05F9}, + {0x05FA,0x05FA,0x05FA}, {0x05FB,0x05FB,0x05FB}, + {0x05FC,0x05FC,0x05FC}, {0x05FD,0x05FD,0x05FD}, + {0x05FE,0x05FE,0x05FE}, {0x05FF,0x05FF,0x05FF} +}; + +static MY_UNICASE_INFO plane1E[]={ + {0x1E00,0x1E01,0x0041}, {0x1E00,0x1E01,0x0041}, + {0x1E02,0x1E03,0x0042}, {0x1E02,0x1E03,0x0042}, + {0x1E04,0x1E05,0x0042}, {0x1E04,0x1E05,0x0042}, + {0x1E06,0x1E07,0x0042}, {0x1E06,0x1E07,0x0042}, + {0x1E08,0x1E09,0x0043}, {0x1E08,0x1E09,0x0043}, + {0x1E0A,0x1E0B,0x0044}, {0x1E0A,0x1E0B,0x0044}, + {0x1E0C,0x1E0D,0x0044}, {0x1E0C,0x1E0D,0x0044}, + {0x1E0E,0x1E0F,0x0044}, {0x1E0E,0x1E0F,0x0044}, + {0x1E10,0x1E11,0x0044}, {0x1E10,0x1E11,0x0044}, + {0x1E12,0x1E13,0x0044}, {0x1E12,0x1E13,0x0044}, + {0x1E14,0x1E15,0x0045}, {0x1E14,0x1E15,0x0045}, + {0x1E16,0x1E17,0x0045}, {0x1E16,0x1E17,0x0045}, + {0x1E18,0x1E19,0x0045}, {0x1E18,0x1E19,0x0045}, + {0x1E1A,0x1E1B,0x0045}, {0x1E1A,0x1E1B,0x0045}, + {0x1E1C,0x1E1D,0x0045}, {0x1E1C,0x1E1D,0x0045}, + {0x1E1E,0x1E1F,0x0046}, {0x1E1E,0x1E1F,0x0046}, + {0x1E20,0x1E21,0x0047}, {0x1E20,0x1E21,0x0047}, + {0x1E22,0x1E23,0x0048}, {0x1E22,0x1E23,0x0048}, + {0x1E24,0x1E25,0x0048}, {0x1E24,0x1E25,0x0048}, + {0x1E26,0x1E27,0x0048}, {0x1E26,0x1E27,0x0048}, + {0x1E28,0x1E29,0x0048}, {0x1E28,0x1E29,0x0048}, + {0x1E2A,0x1E2B,0x0048}, {0x1E2A,0x1E2B,0x0048}, + {0x1E2C,0x1E2D,0x0049}, {0x1E2C,0x1E2D,0x0049}, + {0x1E2E,0x1E2F,0x0049}, {0x1E2E,0x1E2F,0x0049}, + {0x1E30,0x1E31,0x004B}, {0x1E30,0x1E31,0x004B}, + {0x1E32,0x1E33,0x004B}, {0x1E32,0x1E33,0x004B}, + {0x1E34,0x1E35,0x004B}, {0x1E34,0x1E35,0x004B}, + {0x1E36,0x1E37,0x004C}, {0x1E36,0x1E37,0x004C}, + {0x1E38,0x1E39,0x004C}, {0x1E38,0x1E39,0x004C}, + {0x1E3A,0x1E3B,0x004C}, {0x1E3A,0x1E3B,0x004C}, + {0x1E3C,0x1E3D,0x004C}, {0x1E3C,0x1E3D,0x004C}, + {0x1E3E,0x1E3F,0x004D}, {0x1E3E,0x1E3F,0x004D}, + {0x1E40,0x1E41,0x004D}, {0x1E40,0x1E41,0x004D}, + {0x1E42,0x1E43,0x004D}, {0x1E42,0x1E43,0x004D}, + {0x1E44,0x1E45,0x004E}, {0x1E44,0x1E45,0x004E}, + {0x1E46,0x1E47,0x004E}, {0x1E46,0x1E47,0x004E}, + {0x1E48,0x1E49,0x004E}, {0x1E48,0x1E49,0x004E}, + {0x1E4A,0x1E4B,0x004E}, {0x1E4A,0x1E4B,0x004E}, + {0x1E4C,0x1E4D,0x004F}, {0x1E4C,0x1E4D,0x004F}, + {0x1E4E,0x1E4F,0x004F}, {0x1E4E,0x1E4F,0x004F}, + {0x1E50,0x1E51,0x004F}, {0x1E50,0x1E51,0x004F}, + {0x1E52,0x1E53,0x004F}, {0x1E52,0x1E53,0x004F}, + {0x1E54,0x1E55,0x0050}, {0x1E54,0x1E55,0x0050}, + {0x1E56,0x1E57,0x0050}, {0x1E56,0x1E57,0x0050}, + {0x1E58,0x1E59,0x0052}, {0x1E58,0x1E59,0x0052}, + {0x1E5A,0x1E5B,0x0052}, {0x1E5A,0x1E5B,0x0052}, + {0x1E5C,0x1E5D,0x0052}, {0x1E5C,0x1E5D,0x0052}, + {0x1E5E,0x1E5F,0x0052}, {0x1E5E,0x1E5F,0x0052}, + {0x1E60,0x1E61,0x0053}, {0x1E60,0x1E61,0x0053}, + {0x1E62,0x1E63,0x0053}, {0x1E62,0x1E63,0x0053}, + {0x1E64,0x1E65,0x0053}, {0x1E64,0x1E65,0x0053}, + {0x1E66,0x1E67,0x0053}, {0x1E66,0x1E67,0x0053}, + {0x1E68,0x1E69,0x0053}, {0x1E68,0x1E69,0x0053}, + {0x1E6A,0x1E6B,0x0054}, {0x1E6A,0x1E6B,0x0054}, + {0x1E6C,0x1E6D,0x0054}, {0x1E6C,0x1E6D,0x0054}, + {0x1E6E,0x1E6F,0x0054}, {0x1E6E,0x1E6F,0x0054}, + {0x1E70,0x1E71,0x0054}, {0x1E70,0x1E71,0x0054}, + {0x1E72,0x1E73,0x0055}, {0x1E72,0x1E73,0x0055}, + {0x1E74,0x1E75,0x0055}, {0x1E74,0x1E75,0x0055}, + {0x1E76,0x1E77,0x0055}, {0x1E76,0x1E77,0x0055}, + {0x1E78,0x1E79,0x0055}, {0x1E78,0x1E79,0x0055}, + {0x1E7A,0x1E7B,0x0055}, {0x1E7A,0x1E7B,0x0055}, + {0x1E7C,0x1E7D,0x0056}, {0x1E7C,0x1E7D,0x0056}, + {0x1E7E,0x1E7F,0x0056}, {0x1E7E,0x1E7F,0x0056}, + {0x1E80,0x1E81,0x0057}, {0x1E80,0x1E81,0x0057}, + {0x1E82,0x1E83,0x0057}, {0x1E82,0x1E83,0x0057}, + {0x1E84,0x1E85,0x0057}, {0x1E84,0x1E85,0x0057}, + {0x1E86,0x1E87,0x0057}, {0x1E86,0x1E87,0x0057}, + {0x1E88,0x1E89,0x0057}, {0x1E88,0x1E89,0x0057}, + {0x1E8A,0x1E8B,0x0058}, {0x1E8A,0x1E8B,0x0058}, + {0x1E8C,0x1E8D,0x0058}, {0x1E8C,0x1E8D,0x0058}, + {0x1E8E,0x1E8F,0x0059}, {0x1E8E,0x1E8F,0x0059}, + {0x1E90,0x1E91,0x005A}, {0x1E90,0x1E91,0x005A}, + {0x1E92,0x1E93,0x005A}, {0x1E92,0x1E93,0x005A}, + {0x1E94,0x1E95,0x005A}, {0x1E94,0x1E95,0x005A}, + {0x1E96,0x1E96,0x0048}, {0x1E97,0x1E97,0x0054}, + {0x1E98,0x1E98,0x0057}, {0x1E99,0x1E99,0x0059}, + {0x1E9A,0x1E9A,0x1E9A}, {0x1E60,0x1E9B,0x0053}, + {0x1E9C,0x1E9C,0x1E9C}, {0x1E9D,0x1E9D,0x1E9D}, + {0x1E9E,0x1E9E,0x1E9E}, {0x1E9F,0x1E9F,0x1E9F}, + {0x1EA0,0x1EA1,0x0041}, {0x1EA0,0x1EA1,0x0041}, + {0x1EA2,0x1EA3,0x0041}, {0x1EA2,0x1EA3,0x0041}, + {0x1EA4,0x1EA5,0x0041}, {0x1EA4,0x1EA5,0x0041}, + {0x1EA6,0x1EA7,0x0041}, {0x1EA6,0x1EA7,0x0041}, + {0x1EA8,0x1EA9,0x0041}, {0x1EA8,0x1EA9,0x0041}, + {0x1EAA,0x1EAB,0x0041}, {0x1EAA,0x1EAB,0x0041}, + {0x1EAC,0x1EAD,0x0041}, {0x1EAC,0x1EAD,0x0041}, + {0x1EAE,0x1EAF,0x0041}, {0x1EAE,0x1EAF,0x0041}, + {0x1EB0,0x1EB1,0x0041}, {0x1EB0,0x1EB1,0x0041}, + {0x1EB2,0x1EB3,0x0041}, {0x1EB2,0x1EB3,0x0041}, + {0x1EB4,0x1EB5,0x0041}, {0x1EB4,0x1EB5,0x0041}, + {0x1EB6,0x1EB7,0x0041}, {0x1EB6,0x1EB7,0x0041}, + {0x1EB8,0x1EB9,0x0045}, {0x1EB8,0x1EB9,0x0045}, + {0x1EBA,0x1EBB,0x0045}, {0x1EBA,0x1EBB,0x0045}, + {0x1EBC,0x1EBD,0x0045}, {0x1EBC,0x1EBD,0x0045}, + {0x1EBE,0x1EBF,0x0045}, {0x1EBE,0x1EBF,0x0045}, + {0x1EC0,0x1EC1,0x0045}, {0x1EC0,0x1EC1,0x0045}, + {0x1EC2,0x1EC3,0x0045}, {0x1EC2,0x1EC3,0x0045}, + {0x1EC4,0x1EC5,0x0045}, {0x1EC4,0x1EC5,0x0045}, + {0x1EC6,0x1EC7,0x0045}, {0x1EC6,0x1EC7,0x0045}, + {0x1EC8,0x1EC9,0x0049}, {0x1EC8,0x1EC9,0x0049}, + {0x1ECA,0x1ECB,0x0049}, {0x1ECA,0x1ECB,0x0049}, + {0x1ECC,0x1ECD,0x004F}, {0x1ECC,0x1ECD,0x004F}, + {0x1ECE,0x1ECF,0x004F}, {0x1ECE,0x1ECF,0x004F}, + {0x1ED0,0x1ED1,0x004F}, {0x1ED0,0x1ED1,0x004F}, + {0x1ED2,0x1ED3,0x004F}, {0x1ED2,0x1ED3,0x004F}, + {0x1ED4,0x1ED5,0x004F}, {0x1ED4,0x1ED5,0x004F}, + {0x1ED6,0x1ED7,0x004F}, {0x1ED6,0x1ED7,0x004F}, + {0x1ED8,0x1ED9,0x004F}, {0x1ED8,0x1ED9,0x004F}, + {0x1EDA,0x1EDB,0x004F}, {0x1EDA,0x1EDB,0x004F}, + {0x1EDC,0x1EDD,0x004F}, {0x1EDC,0x1EDD,0x004F}, + {0x1EDE,0x1EDF,0x004F}, {0x1EDE,0x1EDF,0x004F}, + {0x1EE0,0x1EE1,0x004F}, {0x1EE0,0x1EE1,0x004F}, + {0x1EE2,0x1EE3,0x004F}, {0x1EE2,0x1EE3,0x004F}, + {0x1EE4,0x1EE5,0x0055}, {0x1EE4,0x1EE5,0x0055}, + {0x1EE6,0x1EE7,0x0055}, {0x1EE6,0x1EE7,0x0055}, + {0x1EE8,0x1EE9,0x0055}, {0x1EE8,0x1EE9,0x0055}, + {0x1EEA,0x1EEB,0x0055}, {0x1EEA,0x1EEB,0x0055}, + {0x1EEC,0x1EED,0x0055}, {0x1EEC,0x1EED,0x0055}, + {0x1EEE,0x1EEF,0x0055}, {0x1EEE,0x1EEF,0x0055}, + {0x1EF0,0x1EF1,0x0055}, {0x1EF0,0x1EF1,0x0055}, + {0x1EF2,0x1EF3,0x0059}, {0x1EF2,0x1EF3,0x0059}, + {0x1EF4,0x1EF5,0x0059}, {0x1EF4,0x1EF5,0x0059}, + {0x1EF6,0x1EF7,0x0059}, {0x1EF6,0x1EF7,0x0059}, + {0x1EF8,0x1EF9,0x0059}, {0x1EF8,0x1EF9,0x0059}, + {0x1EFA,0x1EFA,0x1EFA}, {0x1EFB,0x1EFB,0x1EFB}, + {0x1EFC,0x1EFC,0x1EFC}, {0x1EFD,0x1EFD,0x1EFD}, + {0x1EFE,0x1EFE,0x1EFE}, {0x1EFF,0x1EFF,0x1EFF} +}; + +static MY_UNICASE_INFO plane1F[]={ + {0x1F08,0x1F00,0x0391}, {0x1F09,0x1F01,0x0391}, + {0x1F0A,0x1F02,0x0391}, {0x1F0B,0x1F03,0x0391}, + {0x1F0C,0x1F04,0x0391}, {0x1F0D,0x1F05,0x0391}, + {0x1F0E,0x1F06,0x0391}, {0x1F0F,0x1F07,0x0391}, + {0x1F08,0x1F00,0x0391}, {0x1F09,0x1F01,0x0391}, + {0x1F0A,0x1F02,0x0391}, {0x1F0B,0x1F03,0x0391}, + {0x1F0C,0x1F04,0x0391}, {0x1F0D,0x1F05,0x0391}, + {0x1F0E,0x1F06,0x0391}, {0x1F0F,0x1F07,0x0391}, + {0x1F18,0x1F10,0x0395}, {0x1F19,0x1F11,0x0395}, + {0x1F1A,0x1F12,0x0395}, {0x1F1B,0x1F13,0x0395}, + {0x1F1C,0x1F14,0x0395}, {0x1F1D,0x1F15,0x0395}, + {0x1F16,0x1F16,0x1F16}, {0x1F17,0x1F17,0x1F17}, + {0x1F18,0x1F10,0x0395}, {0x1F19,0x1F11,0x0395}, + {0x1F1A,0x1F12,0x0395}, {0x1F1B,0x1F13,0x0395}, + {0x1F1C,0x1F14,0x0395}, {0x1F1D,0x1F15,0x0395}, + {0x1F1E,0x1F1E,0x1F1E}, {0x1F1F,0x1F1F,0x1F1F}, + {0x1F28,0x1F20,0x0397}, {0x1F29,0x1F21,0x0397}, + {0x1F2A,0x1F22,0x0397}, {0x1F2B,0x1F23,0x0397}, + {0x1F2C,0x1F24,0x0397}, {0x1F2D,0x1F25,0x0397}, + {0x1F2E,0x1F26,0x0397}, {0x1F2F,0x1F27,0x0397}, + {0x1F28,0x1F20,0x0397}, {0x1F29,0x1F21,0x0397}, + {0x1F2A,0x1F22,0x0397}, {0x1F2B,0x1F23,0x0397}, + {0x1F2C,0x1F24,0x0397}, {0x1F2D,0x1F25,0x0397}, + {0x1F2E,0x1F26,0x0397}, {0x1F2F,0x1F27,0x0397}, + {0x1F38,0x1F30,0x0399}, {0x1F39,0x1F31,0x0399}, + {0x1F3A,0x1F32,0x0399}, {0x1F3B,0x1F33,0x0399}, + {0x1F3C,0x1F34,0x0399}, {0x1F3D,0x1F35,0x0399}, + {0x1F3E,0x1F36,0x0399}, {0x1F3F,0x1F37,0x0399}, + {0x1F38,0x1F30,0x0399}, {0x1F39,0x1F31,0x0399}, + {0x1F3A,0x1F32,0x0399}, {0x1F3B,0x1F33,0x0399}, + {0x1F3C,0x1F34,0x0399}, {0x1F3D,0x1F35,0x0399}, + {0x1F3E,0x1F36,0x0399}, {0x1F3F,0x1F37,0x0399}, + {0x1F48,0x1F40,0x039F}, {0x1F49,0x1F41,0x039F}, + {0x1F4A,0x1F42,0x039F}, {0x1F4B,0x1F43,0x039F}, + {0x1F4C,0x1F44,0x039F}, {0x1F4D,0x1F45,0x039F}, + {0x1F46,0x1F46,0x1F46}, {0x1F47,0x1F47,0x1F47}, + {0x1F48,0x1F40,0x039F}, {0x1F49,0x1F41,0x039F}, + {0x1F4A,0x1F42,0x039F}, {0x1F4B,0x1F43,0x039F}, + {0x1F4C,0x1F44,0x039F}, {0x1F4D,0x1F45,0x039F}, + {0x1F4E,0x1F4E,0x1F4E}, {0x1F4F,0x1F4F,0x1F4F}, + {0x1F50,0x1F50,0x03A5}, {0x1F59,0x1F51,0x03A5}, + {0x1F52,0x1F52,0x03A5}, {0x1F5B,0x1F53,0x03A5}, + {0x1F54,0x1F54,0x03A5}, {0x1F5D,0x1F55,0x03A5}, + {0x1F56,0x1F56,0x03A5}, {0x1F5F,0x1F57,0x03A5}, + {0x1F58,0x1F58,0x1F58}, {0x1F59,0x1F51,0x03A5}, + {0x1F5A,0x1F5A,0x1F5A}, {0x1F5B,0x1F53,0x03A5}, + {0x1F5C,0x1F5C,0x1F5C}, {0x1F5D,0x1F55,0x03A5}, + {0x1F5E,0x1F5E,0x1F5E}, {0x1F5F,0x1F57,0x03A5}, + {0x1F68,0x1F60,0x03A9}, {0x1F69,0x1F61,0x03A9}, + {0x1F6A,0x1F62,0x03A9}, {0x1F6B,0x1F63,0x03A9}, + {0x1F6C,0x1F64,0x03A9}, {0x1F6D,0x1F65,0x03A9}, + {0x1F6E,0x1F66,0x03A9}, {0x1F6F,0x1F67,0x03A9}, + {0x1F68,0x1F60,0x03A9}, {0x1F69,0x1F61,0x03A9}, + {0x1F6A,0x1F62,0x03A9}, {0x1F6B,0x1F63,0x03A9}, + {0x1F6C,0x1F64,0x03A9}, {0x1F6D,0x1F65,0x03A9}, + {0x1F6E,0x1F66,0x03A9}, {0x1F6F,0x1F67,0x03A9}, + {0x1FBA,0x1F70,0x0391}, {0x1FBB,0x1F71,0x1FBB}, + {0x1FC8,0x1F72,0x0395}, {0x1FC9,0x1F73,0x1FC9}, + {0x1FCA,0x1F74,0x0397}, {0x1FCB,0x1F75,0x1FCB}, + {0x1FDA,0x1F76,0x0399}, {0x1FDB,0x1F77,0x1FDB}, + {0x1FF8,0x1F78,0x039F}, {0x1FF9,0x1F79,0x1FF9}, + {0x1FEA,0x1F7A,0x03A5}, {0x1FEB,0x1F7B,0x1FEB}, + {0x1FFA,0x1F7C,0x03A9}, {0x1FFB,0x1F7D,0x1FFB}, + {0x1F7E,0x1F7E,0x1F7E}, {0x1F7F,0x1F7F,0x1F7F}, + {0x1F88,0x1F80,0x0391}, {0x1F89,0x1F81,0x0391}, + {0x1F8A,0x1F82,0x0391}, {0x1F8B,0x1F83,0x0391}, + {0x1F8C,0x1F84,0x0391}, {0x1F8D,0x1F85,0x0391}, + {0x1F8E,0x1F86,0x0391}, {0x1F8F,0x1F87,0x0391}, + {0x1F88,0x1F80,0x0391}, {0x1F89,0x1F81,0x0391}, + {0x1F8A,0x1F82,0x0391}, {0x1F8B,0x1F83,0x0391}, + {0x1F8C,0x1F84,0x0391}, {0x1F8D,0x1F85,0x0391}, + {0x1F8E,0x1F86,0x0391}, {0x1F8F,0x1F87,0x0391}, + {0x1F98,0x1F90,0x0397}, {0x1F99,0x1F91,0x0397}, + {0x1F9A,0x1F92,0x0397}, {0x1F9B,0x1F93,0x0397}, + {0x1F9C,0x1F94,0x0397}, {0x1F9D,0x1F95,0x0397}, + {0x1F9E,0x1F96,0x0397}, {0x1F9F,0x1F97,0x0397}, + {0x1F98,0x1F90,0x0397}, {0x1F99,0x1F91,0x0397}, + {0x1F9A,0x1F92,0x0397}, {0x1F9B,0x1F93,0x0397}, + {0x1F9C,0x1F94,0x0397}, {0x1F9D,0x1F95,0x0397}, + {0x1F9E,0x1F96,0x0397}, {0x1F9F,0x1F97,0x0397}, + {0x1FA8,0x1FA0,0x03A9}, {0x1FA9,0x1FA1,0x03A9}, + {0x1FAA,0x1FA2,0x03A9}, {0x1FAB,0x1FA3,0x03A9}, + {0x1FAC,0x1FA4,0x03A9}, {0x1FAD,0x1FA5,0x03A9}, + {0x1FAE,0x1FA6,0x03A9}, {0x1FAF,0x1FA7,0x03A9}, + {0x1FA8,0x1FA0,0x03A9}, {0x1FA9,0x1FA1,0x03A9}, + {0x1FAA,0x1FA2,0x03A9}, {0x1FAB,0x1FA3,0x03A9}, + {0x1FAC,0x1FA4,0x03A9}, {0x1FAD,0x1FA5,0x03A9}, + {0x1FAE,0x1FA6,0x03A9}, {0x1FAF,0x1FA7,0x03A9}, + {0x1FB8,0x1FB0,0x0391}, {0x1FB9,0x1FB1,0x0391}, + {0x1FB2,0x1FB2,0x0391}, {0x1FBC,0x1FB3,0x0391}, + {0x1FB4,0x1FB4,0x0391}, {0x1FB5,0x1FB5,0x1FB5}, + {0x1FB6,0x1FB6,0x0391}, {0x1FB7,0x1FB7,0x0391}, + {0x1FB8,0x1FB0,0x0391}, {0x1FB9,0x1FB1,0x0391}, + {0x1FBA,0x1F70,0x0391}, {0x1FBB,0x1F71,0x1FBB}, + {0x1FBC,0x1FB3,0x0391}, {0x1FBD,0x1FBD,0x1FBD}, + {0x0399,0x1FBE,0x0399}, {0x1FBF,0x1FBF,0x1FBF}, + {0x1FC0,0x1FC0,0x1FC0}, {0x1FC1,0x1FC1,0x1FC1}, + {0x1FC2,0x1FC2,0x0397}, {0x1FCC,0x1FC3,0x0397}, + {0x1FC4,0x1FC4,0x0397}, {0x1FC5,0x1FC5,0x1FC5}, + {0x1FC6,0x1FC6,0x0397}, {0x1FC7,0x1FC7,0x0397}, + {0x1FC8,0x1F72,0x0395}, {0x1FC9,0x1F73,0x1FC9}, + {0x1FCA,0x1F74,0x0397}, {0x1FCB,0x1F75,0x1FCB}, + {0x1FCC,0x1FC3,0x0397}, {0x1FCD,0x1FCD,0x1FCD}, + {0x1FCE,0x1FCE,0x1FCE}, {0x1FCF,0x1FCF,0x1FCF}, + {0x1FD8,0x1FD0,0x0399}, {0x1FD9,0x1FD1,0x0399}, + {0x1FD2,0x1FD2,0x0399}, {0x1FD3,0x1FD3,0x1FD3}, + {0x1FD4,0x1FD4,0x1FD4}, {0x1FD5,0x1FD5,0x1FD5}, + {0x1FD6,0x1FD6,0x0399}, {0x1FD7,0x1FD7,0x0399}, + {0x1FD8,0x1FD0,0x0399}, {0x1FD9,0x1FD1,0x0399}, + {0x1FDA,0x1F76,0x0399}, {0x1FDB,0x1F77,0x1FDB}, + {0x1FDC,0x1FDC,0x1FDC}, {0x1FDD,0x1FDD,0x1FDD}, + {0x1FDE,0x1FDE,0x1FDE}, {0x1FDF,0x1FDF,0x1FDF}, + {0x1FE8,0x1FE0,0x03A5}, {0x1FE9,0x1FE1,0x03A5}, + {0x1FE2,0x1FE2,0x03A5}, {0x1FE3,0x1FE3,0x1FE3}, + {0x1FE4,0x1FE4,0x03A1}, {0x1FEC,0x1FE5,0x03A1}, + {0x1FE6,0x1FE6,0x03A5}, {0x1FE7,0x1FE7,0x03A5}, + {0x1FE8,0x1FE0,0x03A5}, {0x1FE9,0x1FE1,0x03A5}, + {0x1FEA,0x1F7A,0x03A5}, {0x1FEB,0x1F7B,0x1FEB}, + {0x1FEC,0x1FE5,0x03A1}, {0x1FED,0x1FED,0x1FED}, + {0x1FEE,0x1FEE,0x1FEE}, {0x1FEF,0x1FEF,0x1FEF}, + {0x1FF0,0x1FF0,0x1FF0}, {0x1FF1,0x1FF1,0x1FF1}, + {0x1FF2,0x1FF2,0x03A9}, {0x1FFC,0x1FF3,0x03A9}, + {0x1FF4,0x1FF4,0x03A9}, {0x1FF5,0x1FF5,0x1FF5}, + {0x1FF6,0x1FF6,0x03A9}, {0x1FF7,0x1FF7,0x03A9}, + {0x1FF8,0x1F78,0x039F}, {0x1FF9,0x1F79,0x1FF9}, + {0x1FFA,0x1F7C,0x03A9}, {0x1FFB,0x1F7D,0x1FFB}, + {0x1FFC,0x1FF3,0x03A9}, {0x1FFD,0x1FFD,0x1FFD}, + {0x1FFE,0x1FFE,0x1FFE}, {0x1FFF,0x1FFF,0x1FFF} +}; + +static MY_UNICASE_INFO plane21[]={ + {0x2100,0x2100,0x2100}, {0x2101,0x2101,0x2101}, + {0x2102,0x2102,0x2102}, {0x2103,0x2103,0x2103}, + {0x2104,0x2104,0x2104}, {0x2105,0x2105,0x2105}, + {0x2106,0x2106,0x2106}, {0x2107,0x2107,0x2107}, + {0x2108,0x2108,0x2108}, {0x2109,0x2109,0x2109}, + {0x210A,0x210A,0x210A}, {0x210B,0x210B,0x210B}, + {0x210C,0x210C,0x210C}, {0x210D,0x210D,0x210D}, + {0x210E,0x210E,0x210E}, {0x210F,0x210F,0x210F}, + {0x2110,0x2110,0x2110}, {0x2111,0x2111,0x2111}, + {0x2112,0x2112,0x2112}, {0x2113,0x2113,0x2113}, + {0x2114,0x2114,0x2114}, {0x2115,0x2115,0x2115}, + {0x2116,0x2116,0x2116}, {0x2117,0x2117,0x2117}, + {0x2118,0x2118,0x2118}, {0x2119,0x2119,0x2119}, + {0x211A,0x211A,0x211A}, {0x211B,0x211B,0x211B}, + {0x211C,0x211C,0x211C}, {0x211D,0x211D,0x211D}, + {0x211E,0x211E,0x211E}, {0x211F,0x211F,0x211F}, + {0x2120,0x2120,0x2120}, {0x2121,0x2121,0x2121}, + {0x2122,0x2122,0x2122}, {0x2123,0x2123,0x2123}, + {0x2124,0x2124,0x2124}, {0x2125,0x2125,0x2125}, + {0x2126,0x03C9,0x2126}, {0x2127,0x2127,0x2127}, + {0x2128,0x2128,0x2128}, {0x2129,0x2129,0x2129}, + {0x212A,0x006B,0x212A}, {0x212B,0x00E5,0x212B}, + {0x212C,0x212C,0x212C}, {0x212D,0x212D,0x212D}, + {0x212E,0x212E,0x212E}, {0x212F,0x212F,0x212F}, + {0x2130,0x2130,0x2130}, {0x2131,0x2131,0x2131}, + {0x2132,0x2132,0x2132}, {0x2133,0x2133,0x2133}, + {0x2134,0x2134,0x2134}, {0x2135,0x2135,0x2135}, + {0x2136,0x2136,0x2136}, {0x2137,0x2137,0x2137}, + {0x2138,0x2138,0x2138}, {0x2139,0x2139,0x2139}, + {0x213A,0x213A,0x213A}, {0x213B,0x213B,0x213B}, + {0x213C,0x213C,0x213C}, {0x213D,0x213D,0x213D}, + {0x213E,0x213E,0x213E}, {0x213F,0x213F,0x213F}, + {0x2140,0x2140,0x2140}, {0x2141,0x2141,0x2141}, + {0x2142,0x2142,0x2142}, {0x2143,0x2143,0x2143}, + {0x2144,0x2144,0x2144}, {0x2145,0x2145,0x2145}, + {0x2146,0x2146,0x2146}, {0x2147,0x2147,0x2147}, + {0x2148,0x2148,0x2148}, {0x2149,0x2149,0x2149}, + {0x214A,0x214A,0x214A}, {0x214B,0x214B,0x214B}, + {0x214C,0x214C,0x214C}, {0x214D,0x214D,0x214D}, + {0x214E,0x214E,0x214E}, {0x214F,0x214F,0x214F}, + {0x2150,0x2150,0x2150}, {0x2151,0x2151,0x2151}, + {0x2152,0x2152,0x2152}, {0x2153,0x2153,0x2153}, + {0x2154,0x2154,0x2154}, {0x2155,0x2155,0x2155}, + {0x2156,0x2156,0x2156}, {0x2157,0x2157,0x2157}, + {0x2158,0x2158,0x2158}, {0x2159,0x2159,0x2159}, + {0x215A,0x215A,0x215A}, {0x215B,0x215B,0x215B}, + {0x215C,0x215C,0x215C}, {0x215D,0x215D,0x215D}, + {0x215E,0x215E,0x215E}, {0x215F,0x215F,0x215F}, + {0x2160,0x2170,0x2160}, {0x2161,0x2171,0x2161}, + {0x2162,0x2172,0x2162}, {0x2163,0x2173,0x2163}, + {0x2164,0x2174,0x2164}, {0x2165,0x2175,0x2165}, + {0x2166,0x2176,0x2166}, {0x2167,0x2177,0x2167}, + {0x2168,0x2178,0x2168}, {0x2169,0x2179,0x2169}, + {0x216A,0x217A,0x216A}, {0x216B,0x217B,0x216B}, + {0x216C,0x217C,0x216C}, {0x216D,0x217D,0x216D}, + {0x216E,0x217E,0x216E}, {0x216F,0x217F,0x216F}, + {0x2160,0x2170,0x2160}, {0x2161,0x2171,0x2161}, + {0x2162,0x2172,0x2162}, {0x2163,0x2173,0x2163}, + {0x2164,0x2174,0x2164}, {0x2165,0x2175,0x2165}, + {0x2166,0x2176,0x2166}, {0x2167,0x2177,0x2167}, + {0x2168,0x2178,0x2168}, {0x2169,0x2179,0x2169}, + {0x216A,0x217A,0x216A}, {0x216B,0x217B,0x216B}, + {0x216C,0x217C,0x216C}, {0x216D,0x217D,0x216D}, + {0x216E,0x217E,0x216E}, {0x216F,0x217F,0x216F}, + {0x2180,0x2180,0x2180}, {0x2181,0x2181,0x2181}, + {0x2182,0x2182,0x2182}, {0x2183,0x2183,0x2183}, + {0x2184,0x2184,0x2184}, {0x2185,0x2185,0x2185}, + {0x2186,0x2186,0x2186}, {0x2187,0x2187,0x2187}, + {0x2188,0x2188,0x2188}, {0x2189,0x2189,0x2189}, + {0x218A,0x218A,0x218A}, {0x218B,0x218B,0x218B}, + {0x218C,0x218C,0x218C}, {0x218D,0x218D,0x218D}, + {0x218E,0x218E,0x218E}, {0x218F,0x218F,0x218F}, + {0x2190,0x2190,0x2190}, {0x2191,0x2191,0x2191}, + {0x2192,0x2192,0x2192}, {0x2193,0x2193,0x2193}, + {0x2194,0x2194,0x2194}, {0x2195,0x2195,0x2195}, + {0x2196,0x2196,0x2196}, {0x2197,0x2197,0x2197}, + {0x2198,0x2198,0x2198}, {0x2199,0x2199,0x2199}, + {0x219A,0x219A,0x219A}, {0x219B,0x219B,0x219B}, + {0x219C,0x219C,0x219C}, {0x219D,0x219D,0x219D}, + {0x219E,0x219E,0x219E}, {0x219F,0x219F,0x219F}, + {0x21A0,0x21A0,0x21A0}, {0x21A1,0x21A1,0x21A1}, + {0x21A2,0x21A2,0x21A2}, {0x21A3,0x21A3,0x21A3}, + {0x21A4,0x21A4,0x21A4}, {0x21A5,0x21A5,0x21A5}, + {0x21A6,0x21A6,0x21A6}, {0x21A7,0x21A7,0x21A7}, + {0x21A8,0x21A8,0x21A8}, {0x21A9,0x21A9,0x21A9}, + {0x21AA,0x21AA,0x21AA}, {0x21AB,0x21AB,0x21AB}, + {0x21AC,0x21AC,0x21AC}, {0x21AD,0x21AD,0x21AD}, + {0x21AE,0x21AE,0x21AE}, {0x21AF,0x21AF,0x21AF}, + {0x21B0,0x21B0,0x21B0}, {0x21B1,0x21B1,0x21B1}, + {0x21B2,0x21B2,0x21B2}, {0x21B3,0x21B3,0x21B3}, + {0x21B4,0x21B4,0x21B4}, {0x21B5,0x21B5,0x21B5}, + {0x21B6,0x21B6,0x21B6}, {0x21B7,0x21B7,0x21B7}, + {0x21B8,0x21B8,0x21B8}, {0x21B9,0x21B9,0x21B9}, + {0x21BA,0x21BA,0x21BA}, {0x21BB,0x21BB,0x21BB}, + {0x21BC,0x21BC,0x21BC}, {0x21BD,0x21BD,0x21BD}, + {0x21BE,0x21BE,0x21BE}, {0x21BF,0x21BF,0x21BF}, + {0x21C0,0x21C0,0x21C0}, {0x21C1,0x21C1,0x21C1}, + {0x21C2,0x21C2,0x21C2}, {0x21C3,0x21C3,0x21C3}, + {0x21C4,0x21C4,0x21C4}, {0x21C5,0x21C5,0x21C5}, + {0x21C6,0x21C6,0x21C6}, {0x21C7,0x21C7,0x21C7}, + {0x21C8,0x21C8,0x21C8}, {0x21C9,0x21C9,0x21C9}, + {0x21CA,0x21CA,0x21CA}, {0x21CB,0x21CB,0x21CB}, + {0x21CC,0x21CC,0x21CC}, {0x21CD,0x21CD,0x21CD}, + {0x21CE,0x21CE,0x21CE}, {0x21CF,0x21CF,0x21CF}, + {0x21D0,0x21D0,0x21D0}, {0x21D1,0x21D1,0x21D1}, + {0x21D2,0x21D2,0x21D2}, {0x21D3,0x21D3,0x21D3}, + {0x21D4,0x21D4,0x21D4}, {0x21D5,0x21D5,0x21D5}, + {0x21D6,0x21D6,0x21D6}, {0x21D7,0x21D7,0x21D7}, + {0x21D8,0x21D8,0x21D8}, {0x21D9,0x21D9,0x21D9}, + {0x21DA,0x21DA,0x21DA}, {0x21DB,0x21DB,0x21DB}, + {0x21DC,0x21DC,0x21DC}, {0x21DD,0x21DD,0x21DD}, + {0x21DE,0x21DE,0x21DE}, {0x21DF,0x21DF,0x21DF}, + {0x21E0,0x21E0,0x21E0}, {0x21E1,0x21E1,0x21E1}, + {0x21E2,0x21E2,0x21E2}, {0x21E3,0x21E3,0x21E3}, + {0x21E4,0x21E4,0x21E4}, {0x21E5,0x21E5,0x21E5}, + {0x21E6,0x21E6,0x21E6}, {0x21E7,0x21E7,0x21E7}, + {0x21E8,0x21E8,0x21E8}, {0x21E9,0x21E9,0x21E9}, + {0x21EA,0x21EA,0x21EA}, {0x21EB,0x21EB,0x21EB}, + {0x21EC,0x21EC,0x21EC}, {0x21ED,0x21ED,0x21ED}, + {0x21EE,0x21EE,0x21EE}, {0x21EF,0x21EF,0x21EF}, + {0x21F0,0x21F0,0x21F0}, {0x21F1,0x21F1,0x21F1}, + {0x21F2,0x21F2,0x21F2}, {0x21F3,0x21F3,0x21F3}, + {0x21F4,0x21F4,0x21F4}, {0x21F5,0x21F5,0x21F5}, + {0x21F6,0x21F6,0x21F6}, {0x21F7,0x21F7,0x21F7}, + {0x21F8,0x21F8,0x21F8}, {0x21F9,0x21F9,0x21F9}, + {0x21FA,0x21FA,0x21FA}, {0x21FB,0x21FB,0x21FB}, + {0x21FC,0x21FC,0x21FC}, {0x21FD,0x21FD,0x21FD}, + {0x21FE,0x21FE,0x21FE}, {0x21FF,0x21FF,0x21FF} +}; + +static MY_UNICASE_INFO plane24[]={ + {0x2400,0x2400,0x2400}, {0x2401,0x2401,0x2401}, + {0x2402,0x2402,0x2402}, {0x2403,0x2403,0x2403}, + {0x2404,0x2404,0x2404}, {0x2405,0x2405,0x2405}, + {0x2406,0x2406,0x2406}, {0x2407,0x2407,0x2407}, + {0x2408,0x2408,0x2408}, {0x2409,0x2409,0x2409}, + {0x240A,0x240A,0x240A}, {0x240B,0x240B,0x240B}, + {0x240C,0x240C,0x240C}, {0x240D,0x240D,0x240D}, + {0x240E,0x240E,0x240E}, {0x240F,0x240F,0x240F}, + {0x2410,0x2410,0x2410}, {0x2411,0x2411,0x2411}, + {0x2412,0x2412,0x2412}, {0x2413,0x2413,0x2413}, + {0x2414,0x2414,0x2414}, {0x2415,0x2415,0x2415}, + {0x2416,0x2416,0x2416}, {0x2417,0x2417,0x2417}, + {0x2418,0x2418,0x2418}, {0x2419,0x2419,0x2419}, + {0x241A,0x241A,0x241A}, {0x241B,0x241B,0x241B}, + {0x241C,0x241C,0x241C}, {0x241D,0x241D,0x241D}, + {0x241E,0x241E,0x241E}, {0x241F,0x241F,0x241F}, + {0x2420,0x2420,0x2420}, {0x2421,0x2421,0x2421}, + {0x2422,0x2422,0x2422}, {0x2423,0x2423,0x2423}, + {0x2424,0x2424,0x2424}, {0x2425,0x2425,0x2425}, + {0x2426,0x2426,0x2426}, {0x2427,0x2427,0x2427}, + {0x2428,0x2428,0x2428}, {0x2429,0x2429,0x2429}, + {0x242A,0x242A,0x242A}, {0x242B,0x242B,0x242B}, + {0x242C,0x242C,0x242C}, {0x242D,0x242D,0x242D}, + {0x242E,0x242E,0x242E}, {0x242F,0x242F,0x242F}, + {0x2430,0x2430,0x2430}, {0x2431,0x2431,0x2431}, + {0x2432,0x2432,0x2432}, {0x2433,0x2433,0x2433}, + {0x2434,0x2434,0x2434}, {0x2435,0x2435,0x2435}, + {0x2436,0x2436,0x2436}, {0x2437,0x2437,0x2437}, + {0x2438,0x2438,0x2438}, {0x2439,0x2439,0x2439}, + {0x243A,0x243A,0x243A}, {0x243B,0x243B,0x243B}, + {0x243C,0x243C,0x243C}, {0x243D,0x243D,0x243D}, + {0x243E,0x243E,0x243E}, {0x243F,0x243F,0x243F}, + {0x2440,0x2440,0x2440}, {0x2441,0x2441,0x2441}, + {0x2442,0x2442,0x2442}, {0x2443,0x2443,0x2443}, + {0x2444,0x2444,0x2444}, {0x2445,0x2445,0x2445}, + {0x2446,0x2446,0x2446}, {0x2447,0x2447,0x2447}, + {0x2448,0x2448,0x2448}, {0x2449,0x2449,0x2449}, + {0x244A,0x244A,0x244A}, {0x244B,0x244B,0x244B}, + {0x244C,0x244C,0x244C}, {0x244D,0x244D,0x244D}, + {0x244E,0x244E,0x244E}, {0x244F,0x244F,0x244F}, + {0x2450,0x2450,0x2450}, {0x2451,0x2451,0x2451}, + {0x2452,0x2452,0x2452}, {0x2453,0x2453,0x2453}, + {0x2454,0x2454,0x2454}, {0x2455,0x2455,0x2455}, + {0x2456,0x2456,0x2456}, {0x2457,0x2457,0x2457}, + {0x2458,0x2458,0x2458}, {0x2459,0x2459,0x2459}, + {0x245A,0x245A,0x245A}, {0x245B,0x245B,0x245B}, + {0x245C,0x245C,0x245C}, {0x245D,0x245D,0x245D}, + {0x245E,0x245E,0x245E}, {0x245F,0x245F,0x245F}, + {0x2460,0x2460,0x2460}, {0x2461,0x2461,0x2461}, + {0x2462,0x2462,0x2462}, {0x2463,0x2463,0x2463}, + {0x2464,0x2464,0x2464}, {0x2465,0x2465,0x2465}, + {0x2466,0x2466,0x2466}, {0x2467,0x2467,0x2467}, + {0x2468,0x2468,0x2468}, {0x2469,0x2469,0x2469}, + {0x246A,0x246A,0x246A}, {0x246B,0x246B,0x246B}, + {0x246C,0x246C,0x246C}, {0x246D,0x246D,0x246D}, + {0x246E,0x246E,0x246E}, {0x246F,0x246F,0x246F}, + {0x2470,0x2470,0x2470}, {0x2471,0x2471,0x2471}, + {0x2472,0x2472,0x2472}, {0x2473,0x2473,0x2473}, + {0x2474,0x2474,0x2474}, {0x2475,0x2475,0x2475}, + {0x2476,0x2476,0x2476}, {0x2477,0x2477,0x2477}, + {0x2478,0x2478,0x2478}, {0x2479,0x2479,0x2479}, + {0x247A,0x247A,0x247A}, {0x247B,0x247B,0x247B}, + {0x247C,0x247C,0x247C}, {0x247D,0x247D,0x247D}, + {0x247E,0x247E,0x247E}, {0x247F,0x247F,0x247F}, + {0x2480,0x2480,0x2480}, {0x2481,0x2481,0x2481}, + {0x2482,0x2482,0x2482}, {0x2483,0x2483,0x2483}, + {0x2484,0x2484,0x2484}, {0x2485,0x2485,0x2485}, + {0x2486,0x2486,0x2486}, {0x2487,0x2487,0x2487}, + {0x2488,0x2488,0x2488}, {0x2489,0x2489,0x2489}, + {0x248A,0x248A,0x248A}, {0x248B,0x248B,0x248B}, + {0x248C,0x248C,0x248C}, {0x248D,0x248D,0x248D}, + {0x248E,0x248E,0x248E}, {0x248F,0x248F,0x248F}, + {0x2490,0x2490,0x2490}, {0x2491,0x2491,0x2491}, + {0x2492,0x2492,0x2492}, {0x2493,0x2493,0x2493}, + {0x2494,0x2494,0x2494}, {0x2495,0x2495,0x2495}, + {0x2496,0x2496,0x2496}, {0x2497,0x2497,0x2497}, + {0x2498,0x2498,0x2498}, {0x2499,0x2499,0x2499}, + {0x249A,0x249A,0x249A}, {0x249B,0x249B,0x249B}, + {0x249C,0x249C,0x249C}, {0x249D,0x249D,0x249D}, + {0x249E,0x249E,0x249E}, {0x249F,0x249F,0x249F}, + {0x24A0,0x24A0,0x24A0}, {0x24A1,0x24A1,0x24A1}, + {0x24A2,0x24A2,0x24A2}, {0x24A3,0x24A3,0x24A3}, + {0x24A4,0x24A4,0x24A4}, {0x24A5,0x24A5,0x24A5}, + {0x24A6,0x24A6,0x24A6}, {0x24A7,0x24A7,0x24A7}, + {0x24A8,0x24A8,0x24A8}, {0x24A9,0x24A9,0x24A9}, + {0x24AA,0x24AA,0x24AA}, {0x24AB,0x24AB,0x24AB}, + {0x24AC,0x24AC,0x24AC}, {0x24AD,0x24AD,0x24AD}, + {0x24AE,0x24AE,0x24AE}, {0x24AF,0x24AF,0x24AF}, + {0x24B0,0x24B0,0x24B0}, {0x24B1,0x24B1,0x24B1}, + {0x24B2,0x24B2,0x24B2}, {0x24B3,0x24B3,0x24B3}, + {0x24B4,0x24B4,0x24B4}, {0x24B5,0x24B5,0x24B5}, + {0x24B6,0x24D0,0x24B6}, {0x24B7,0x24D1,0x24B7}, + {0x24B8,0x24D2,0x24B8}, {0x24B9,0x24D3,0x24B9}, + {0x24BA,0x24D4,0x24BA}, {0x24BB,0x24D5,0x24BB}, + {0x24BC,0x24D6,0x24BC}, {0x24BD,0x24D7,0x24BD}, + {0x24BE,0x24D8,0x24BE}, {0x24BF,0x24D9,0x24BF}, + {0x24C0,0x24DA,0x24C0}, {0x24C1,0x24DB,0x24C1}, + {0x24C2,0x24DC,0x24C2}, {0x24C3,0x24DD,0x24C3}, + {0x24C4,0x24DE,0x24C4}, {0x24C5,0x24DF,0x24C5}, + {0x24C6,0x24E0,0x24C6}, {0x24C7,0x24E1,0x24C7}, + {0x24C8,0x24E2,0x24C8}, {0x24C9,0x24E3,0x24C9}, + {0x24CA,0x24E4,0x24CA}, {0x24CB,0x24E5,0x24CB}, + {0x24CC,0x24E6,0x24CC}, {0x24CD,0x24E7,0x24CD}, + {0x24CE,0x24E8,0x24CE}, {0x24CF,0x24E9,0x24CF}, + {0x24B6,0x24D0,0x24B6}, {0x24B7,0x24D1,0x24B7}, + {0x24B8,0x24D2,0x24B8}, {0x24B9,0x24D3,0x24B9}, + {0x24BA,0x24D4,0x24BA}, {0x24BB,0x24D5,0x24BB}, + {0x24BC,0x24D6,0x24BC}, {0x24BD,0x24D7,0x24BD}, + {0x24BE,0x24D8,0x24BE}, {0x24BF,0x24D9,0x24BF}, + {0x24C0,0x24DA,0x24C0}, {0x24C1,0x24DB,0x24C1}, + {0x24C2,0x24DC,0x24C2}, {0x24C3,0x24DD,0x24C3}, + {0x24C4,0x24DE,0x24C4}, {0x24C5,0x24DF,0x24C5}, + {0x24C6,0x24E0,0x24C6}, {0x24C7,0x24E1,0x24C7}, + {0x24C8,0x24E2,0x24C8}, {0x24C9,0x24E3,0x24C9}, + {0x24CA,0x24E4,0x24CA}, {0x24CB,0x24E5,0x24CB}, + {0x24CC,0x24E6,0x24CC}, {0x24CD,0x24E7,0x24CD}, + {0x24CE,0x24E8,0x24CE}, {0x24CF,0x24E9,0x24CF}, + {0x24EA,0x24EA,0x24EA}, {0x24EB,0x24EB,0x24EB}, + {0x24EC,0x24EC,0x24EC}, {0x24ED,0x24ED,0x24ED}, + {0x24EE,0x24EE,0x24EE}, {0x24EF,0x24EF,0x24EF}, + {0x24F0,0x24F0,0x24F0}, {0x24F1,0x24F1,0x24F1}, + {0x24F2,0x24F2,0x24F2}, {0x24F3,0x24F3,0x24F3}, + {0x24F4,0x24F4,0x24F4}, {0x24F5,0x24F5,0x24F5}, + {0x24F6,0x24F6,0x24F6}, {0x24F7,0x24F7,0x24F7}, + {0x24F8,0x24F8,0x24F8}, {0x24F9,0x24F9,0x24F9}, + {0x24FA,0x24FA,0x24FA}, {0x24FB,0x24FB,0x24FB}, + {0x24FC,0x24FC,0x24FC}, {0x24FD,0x24FD,0x24FD}, + {0x24FE,0x24FE,0x24FE}, {0x24FF,0x24FF,0x24FF} +}; + +static MY_UNICASE_INFO planeFF[]={ + {0xFF00,0xFF00,0xFF00}, {0xFF01,0xFF01,0xFF01}, + {0xFF02,0xFF02,0xFF02}, {0xFF03,0xFF03,0xFF03}, + {0xFF04,0xFF04,0xFF04}, {0xFF05,0xFF05,0xFF05}, + {0xFF06,0xFF06,0xFF06}, {0xFF07,0xFF07,0xFF07}, + {0xFF08,0xFF08,0xFF08}, {0xFF09,0xFF09,0xFF09}, + {0xFF0A,0xFF0A,0xFF0A}, {0xFF0B,0xFF0B,0xFF0B}, + {0xFF0C,0xFF0C,0xFF0C}, {0xFF0D,0xFF0D,0xFF0D}, + {0xFF0E,0xFF0E,0xFF0E}, {0xFF0F,0xFF0F,0xFF0F}, + {0xFF10,0xFF10,0xFF10}, {0xFF11,0xFF11,0xFF11}, + {0xFF12,0xFF12,0xFF12}, {0xFF13,0xFF13,0xFF13}, + {0xFF14,0xFF14,0xFF14}, {0xFF15,0xFF15,0xFF15}, + {0xFF16,0xFF16,0xFF16}, {0xFF17,0xFF17,0xFF17}, + {0xFF18,0xFF18,0xFF18}, {0xFF19,0xFF19,0xFF19}, + {0xFF1A,0xFF1A,0xFF1A}, {0xFF1B,0xFF1B,0xFF1B}, + {0xFF1C,0xFF1C,0xFF1C}, {0xFF1D,0xFF1D,0xFF1D}, + {0xFF1E,0xFF1E,0xFF1E}, {0xFF1F,0xFF1F,0xFF1F}, + {0xFF20,0xFF20,0xFF20}, {0xFF21,0xFF41,0xFF21}, + {0xFF22,0xFF42,0xFF22}, {0xFF23,0xFF43,0xFF23}, + {0xFF24,0xFF44,0xFF24}, {0xFF25,0xFF45,0xFF25}, + {0xFF26,0xFF46,0xFF26}, {0xFF27,0xFF47,0xFF27}, + {0xFF28,0xFF48,0xFF28}, {0xFF29,0xFF49,0xFF29}, + {0xFF2A,0xFF4A,0xFF2A}, {0xFF2B,0xFF4B,0xFF2B}, + {0xFF2C,0xFF4C,0xFF2C}, {0xFF2D,0xFF4D,0xFF2D}, + {0xFF2E,0xFF4E,0xFF2E}, {0xFF2F,0xFF4F,0xFF2F}, + {0xFF30,0xFF50,0xFF30}, {0xFF31,0xFF51,0xFF31}, + {0xFF32,0xFF52,0xFF32}, {0xFF33,0xFF53,0xFF33}, + {0xFF34,0xFF54,0xFF34}, {0xFF35,0xFF55,0xFF35}, + {0xFF36,0xFF56,0xFF36}, {0xFF37,0xFF57,0xFF37}, + {0xFF38,0xFF58,0xFF38}, {0xFF39,0xFF59,0xFF39}, + {0xFF3A,0xFF5A,0xFF3A}, {0xFF3B,0xFF3B,0xFF3B}, + {0xFF3C,0xFF3C,0xFF3C}, {0xFF3D,0xFF3D,0xFF3D}, + {0xFF3E,0xFF3E,0xFF3E}, {0xFF3F,0xFF3F,0xFF3F}, + {0xFF40,0xFF40,0xFF40}, {0xFF21,0xFF41,0xFF21}, + {0xFF22,0xFF42,0xFF22}, {0xFF23,0xFF43,0xFF23}, + {0xFF24,0xFF44,0xFF24}, {0xFF25,0xFF45,0xFF25}, + {0xFF26,0xFF46,0xFF26}, {0xFF27,0xFF47,0xFF27}, + {0xFF28,0xFF48,0xFF28}, {0xFF29,0xFF49,0xFF29}, + {0xFF2A,0xFF4A,0xFF2A}, {0xFF2B,0xFF4B,0xFF2B}, + {0xFF2C,0xFF4C,0xFF2C}, {0xFF2D,0xFF4D,0xFF2D}, + {0xFF2E,0xFF4E,0xFF2E}, {0xFF2F,0xFF4F,0xFF2F}, + {0xFF30,0xFF50,0xFF30}, {0xFF31,0xFF51,0xFF31}, + {0xFF32,0xFF52,0xFF32}, {0xFF33,0xFF53,0xFF33}, + {0xFF34,0xFF54,0xFF34}, {0xFF35,0xFF55,0xFF35}, + {0xFF36,0xFF56,0xFF36}, {0xFF37,0xFF57,0xFF37}, + {0xFF38,0xFF58,0xFF38}, {0xFF39,0xFF59,0xFF39}, + {0xFF3A,0xFF5A,0xFF3A}, {0xFF5B,0xFF5B,0xFF5B}, + {0xFF5C,0xFF5C,0xFF5C}, {0xFF5D,0xFF5D,0xFF5D}, + {0xFF5E,0xFF5E,0xFF5E}, {0xFF5F,0xFF5F,0xFF5F}, + {0xFF60,0xFF60,0xFF60}, {0xFF61,0xFF61,0xFF61}, + {0xFF62,0xFF62,0xFF62}, {0xFF63,0xFF63,0xFF63}, + {0xFF64,0xFF64,0xFF64}, {0xFF65,0xFF65,0xFF65}, + {0xFF66,0xFF66,0xFF66}, {0xFF67,0xFF67,0xFF67}, + {0xFF68,0xFF68,0xFF68}, {0xFF69,0xFF69,0xFF69}, + {0xFF6A,0xFF6A,0xFF6A}, {0xFF6B,0xFF6B,0xFF6B}, + {0xFF6C,0xFF6C,0xFF6C}, {0xFF6D,0xFF6D,0xFF6D}, + {0xFF6E,0xFF6E,0xFF6E}, {0xFF6F,0xFF6F,0xFF6F}, + {0xFF70,0xFF70,0xFF70}, {0xFF71,0xFF71,0xFF71}, + {0xFF72,0xFF72,0xFF72}, {0xFF73,0xFF73,0xFF73}, + {0xFF74,0xFF74,0xFF74}, {0xFF75,0xFF75,0xFF75}, + {0xFF76,0xFF76,0xFF76}, {0xFF77,0xFF77,0xFF77}, + {0xFF78,0xFF78,0xFF78}, {0xFF79,0xFF79,0xFF79}, + {0xFF7A,0xFF7A,0xFF7A}, {0xFF7B,0xFF7B,0xFF7B}, + {0xFF7C,0xFF7C,0xFF7C}, {0xFF7D,0xFF7D,0xFF7D}, + {0xFF7E,0xFF7E,0xFF7E}, {0xFF7F,0xFF7F,0xFF7F}, + {0xFF80,0xFF80,0xFF80}, {0xFF81,0xFF81,0xFF81}, + {0xFF82,0xFF82,0xFF82}, {0xFF83,0xFF83,0xFF83}, + {0xFF84,0xFF84,0xFF84}, {0xFF85,0xFF85,0xFF85}, + {0xFF86,0xFF86,0xFF86}, {0xFF87,0xFF87,0xFF87}, + {0xFF88,0xFF88,0xFF88}, {0xFF89,0xFF89,0xFF89}, + {0xFF8A,0xFF8A,0xFF8A}, {0xFF8B,0xFF8B,0xFF8B}, + {0xFF8C,0xFF8C,0xFF8C}, {0xFF8D,0xFF8D,0xFF8D}, + {0xFF8E,0xFF8E,0xFF8E}, {0xFF8F,0xFF8F,0xFF8F}, + {0xFF90,0xFF90,0xFF90}, {0xFF91,0xFF91,0xFF91}, + {0xFF92,0xFF92,0xFF92}, {0xFF93,0xFF93,0xFF93}, + {0xFF94,0xFF94,0xFF94}, {0xFF95,0xFF95,0xFF95}, + {0xFF96,0xFF96,0xFF96}, {0xFF97,0xFF97,0xFF97}, + {0xFF98,0xFF98,0xFF98}, {0xFF99,0xFF99,0xFF99}, + {0xFF9A,0xFF9A,0xFF9A}, {0xFF9B,0xFF9B,0xFF9B}, + {0xFF9C,0xFF9C,0xFF9C}, {0xFF9D,0xFF9D,0xFF9D}, + {0xFF9E,0xFF9E,0xFF9E}, {0xFF9F,0xFF9F,0xFF9F}, + {0xFFA0,0xFFA0,0xFFA0}, {0xFFA1,0xFFA1,0xFFA1}, + {0xFFA2,0xFFA2,0xFFA2}, {0xFFA3,0xFFA3,0xFFA3}, + {0xFFA4,0xFFA4,0xFFA4}, {0xFFA5,0xFFA5,0xFFA5}, + {0xFFA6,0xFFA6,0xFFA6}, {0xFFA7,0xFFA7,0xFFA7}, + {0xFFA8,0xFFA8,0xFFA8}, {0xFFA9,0xFFA9,0xFFA9}, + {0xFFAA,0xFFAA,0xFFAA}, {0xFFAB,0xFFAB,0xFFAB}, + {0xFFAC,0xFFAC,0xFFAC}, {0xFFAD,0xFFAD,0xFFAD}, + {0xFFAE,0xFFAE,0xFFAE}, {0xFFAF,0xFFAF,0xFFAF}, + {0xFFB0,0xFFB0,0xFFB0}, {0xFFB1,0xFFB1,0xFFB1}, + {0xFFB2,0xFFB2,0xFFB2}, {0xFFB3,0xFFB3,0xFFB3}, + {0xFFB4,0xFFB4,0xFFB4}, {0xFFB5,0xFFB5,0xFFB5}, + {0xFFB6,0xFFB6,0xFFB6}, {0xFFB7,0xFFB7,0xFFB7}, + {0xFFB8,0xFFB8,0xFFB8}, {0xFFB9,0xFFB9,0xFFB9}, + {0xFFBA,0xFFBA,0xFFBA}, {0xFFBB,0xFFBB,0xFFBB}, + {0xFFBC,0xFFBC,0xFFBC}, {0xFFBD,0xFFBD,0xFFBD}, + {0xFFBE,0xFFBE,0xFFBE}, {0xFFBF,0xFFBF,0xFFBF}, + {0xFFC0,0xFFC0,0xFFC0}, {0xFFC1,0xFFC1,0xFFC1}, + {0xFFC2,0xFFC2,0xFFC2}, {0xFFC3,0xFFC3,0xFFC3}, + {0xFFC4,0xFFC4,0xFFC4}, {0xFFC5,0xFFC5,0xFFC5}, + {0xFFC6,0xFFC6,0xFFC6}, {0xFFC7,0xFFC7,0xFFC7}, + {0xFFC8,0xFFC8,0xFFC8}, {0xFFC9,0xFFC9,0xFFC9}, + {0xFFCA,0xFFCA,0xFFCA}, {0xFFCB,0xFFCB,0xFFCB}, + {0xFFCC,0xFFCC,0xFFCC}, {0xFFCD,0xFFCD,0xFFCD}, + {0xFFCE,0xFFCE,0xFFCE}, {0xFFCF,0xFFCF,0xFFCF}, + {0xFFD0,0xFFD0,0xFFD0}, {0xFFD1,0xFFD1,0xFFD1}, + {0xFFD2,0xFFD2,0xFFD2}, {0xFFD3,0xFFD3,0xFFD3}, + {0xFFD4,0xFFD4,0xFFD4}, {0xFFD5,0xFFD5,0xFFD5}, + {0xFFD6,0xFFD6,0xFFD6}, {0xFFD7,0xFFD7,0xFFD7}, + {0xFFD8,0xFFD8,0xFFD8}, {0xFFD9,0xFFD9,0xFFD9}, + {0xFFDA,0xFFDA,0xFFDA}, {0xFFDB,0xFFDB,0xFFDB}, + {0xFFDC,0xFFDC,0xFFDC}, {0xFFDD,0xFFDD,0xFFDD}, + {0xFFDE,0xFFDE,0xFFDE}, {0xFFDF,0xFFDF,0xFFDF}, + {0xFFE0,0xFFE0,0xFFE0}, {0xFFE1,0xFFE1,0xFFE1}, + {0xFFE2,0xFFE2,0xFFE2}, {0xFFE3,0xFFE3,0xFFE3}, + {0xFFE4,0xFFE4,0xFFE4}, {0xFFE5,0xFFE5,0xFFE5}, + {0xFFE6,0xFFE6,0xFFE6}, {0xFFE7,0xFFE7,0xFFE7}, + {0xFFE8,0xFFE8,0xFFE8}, {0xFFE9,0xFFE9,0xFFE9}, + {0xFFEA,0xFFEA,0xFFEA}, {0xFFEB,0xFFEB,0xFFEB}, + {0xFFEC,0xFFEC,0xFFEC}, {0xFFED,0xFFED,0xFFED}, + {0xFFEE,0xFFEE,0xFFEE}, {0xFFEF,0xFFEF,0xFFEF}, + {0xFFF0,0xFFF0,0xFFF0}, {0xFFF1,0xFFF1,0xFFF1}, + {0xFFF2,0xFFF2,0xFFF2}, {0xFFF3,0xFFF3,0xFFF3}, + {0xFFF4,0xFFF4,0xFFF4}, {0xFFF5,0xFFF5,0xFFF5}, + {0xFFF6,0xFFF6,0xFFF6}, {0xFFF7,0xFFF7,0xFFF7}, + {0xFFF8,0xFFF8,0xFFF8}, {0xFFF9,0xFFF9,0xFFF9}, + {0xFFFA,0xFFFA,0xFFFA}, {0xFFFB,0xFFFB,0xFFFB}, + {0xFFFC,0xFFFC,0xFFFC}, {0xFFFD,0xFFFD,0xFFFD}, + {0xFFFE,0xFFFE,0xFFFE}, {0xFFFF,0xFFFF,0xFFFF} +}; + +MY_UNICASE_INFO *my_unicase_default[256]={ + plane00, plane01, plane02, plane03, plane04, plane05, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F, + NULL, plane21, NULL, NULL, plane24, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, planeFF + +}; + + +/* + Turkish lower/upper mapping: + 1. LOWER(0x0049 LATIN CAPITAL LETTER I) -> + 0x0131 LATIN SMALL LETTER DOTLESS I + 2. UPPER(0x0069 LATIN SMALL LETTER I) -> + 0x0130 LATIN CAPITAL LETTER I WITH DOT ABOVE +*/ + +static MY_UNICASE_INFO turk00[]= +{ + {0x0000,0x0000,0x0000}, {0x0001,0x0001,0x0001}, + {0x0002,0x0002,0x0002}, {0x0003,0x0003,0x0003}, + {0x0004,0x0004,0x0004}, {0x0005,0x0005,0x0005}, + {0x0006,0x0006,0x0006}, {0x0007,0x0007,0x0007}, + {0x0008,0x0008,0x0008}, {0x0009,0x0009,0x0009}, + {0x000A,0x000A,0x000A}, {0x000B,0x000B,0x000B}, + {0x000C,0x000C,0x000C}, {0x000D,0x000D,0x000D}, + {0x000E,0x000E,0x000E}, {0x000F,0x000F,0x000F}, + {0x0010,0x0010,0x0010}, {0x0011,0x0011,0x0011}, + {0x0012,0x0012,0x0012}, {0x0013,0x0013,0x0013}, + {0x0014,0x0014,0x0014}, {0x0015,0x0015,0x0015}, + {0x0016,0x0016,0x0016}, {0x0017,0x0017,0x0017}, + {0x0018,0x0018,0x0018}, {0x0019,0x0019,0x0019}, + {0x001A,0x001A,0x001A}, {0x001B,0x001B,0x001B}, + {0x001C,0x001C,0x001C}, {0x001D,0x001D,0x001D}, + {0x001E,0x001E,0x001E}, {0x001F,0x001F,0x001F}, + {0x0020,0x0020,0x0020}, {0x0021,0x0021,0x0021}, + {0x0022,0x0022,0x0022}, {0x0023,0x0023,0x0023}, + {0x0024,0x0024,0x0024}, {0x0025,0x0025,0x0025}, + {0x0026,0x0026,0x0026}, {0x0027,0x0027,0x0027}, + {0x0028,0x0028,0x0028}, {0x0029,0x0029,0x0029}, + {0x002A,0x002A,0x002A}, {0x002B,0x002B,0x002B}, + {0x002C,0x002C,0x002C}, {0x002D,0x002D,0x002D}, + {0x002E,0x002E,0x002E}, {0x002F,0x002F,0x002F}, + {0x0030,0x0030,0x0030}, {0x0031,0x0031,0x0031}, + {0x0032,0x0032,0x0032}, {0x0033,0x0033,0x0033}, + {0x0034,0x0034,0x0034}, {0x0035,0x0035,0x0035}, + {0x0036,0x0036,0x0036}, {0x0037,0x0037,0x0037}, + {0x0038,0x0038,0x0038}, {0x0039,0x0039,0x0039}, + {0x003A,0x003A,0x003A}, {0x003B,0x003B,0x003B}, + {0x003C,0x003C,0x003C}, {0x003D,0x003D,0x003D}, + {0x003E,0x003E,0x003E}, {0x003F,0x003F,0x003F}, + {0x0040,0x0040,0x0040}, {0x0041,0x0061,0x0041}, + {0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043}, + {0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045}, + {0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047}, + {0x0048,0x0068,0x0048}, {0x0049,0x0131,0x0049}, + {0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B}, + {0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D}, + {0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F}, + {0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051}, + {0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053}, + {0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055}, + {0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057}, + {0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059}, + {0x005A,0x007A,0x005A}, {0x005B,0x005B,0x005B}, + {0x005C,0x005C,0x005C}, {0x005D,0x005D,0x005D}, + {0x005E,0x005E,0x005E}, {0x005F,0x005F,0x005F}, + {0x0060,0x0060,0x0060}, {0x0041,0x0061,0x0041}, + {0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043}, + {0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045}, + {0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047}, + {0x0048,0x0068,0x0048}, {0x0130,0x0069,0x0049}, + {0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B}, + {0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D}, + {0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F}, + {0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051}, + {0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053}, + {0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055}, + {0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057}, + {0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059}, + {0x005A,0x007A,0x005A}, {0x007B,0x007B,0x007B}, + {0x007C,0x007C,0x007C}, {0x007D,0x007D,0x007D}, + {0x007E,0x007E,0x007E}, {0x007F,0x007F,0x007F}, + {0x0080,0x0080,0x0080}, {0x0081,0x0081,0x0081}, + {0x0082,0x0082,0x0082}, {0x0083,0x0083,0x0083}, + {0x0084,0x0084,0x0084}, {0x0085,0x0085,0x0085}, + {0x0086,0x0086,0x0086}, {0x0087,0x0087,0x0087}, + {0x0088,0x0088,0x0088}, {0x0089,0x0089,0x0089}, + {0x008A,0x008A,0x008A}, {0x008B,0x008B,0x008B}, + {0x008C,0x008C,0x008C}, {0x008D,0x008D,0x008D}, + {0x008E,0x008E,0x008E}, {0x008F,0x008F,0x008F}, + {0x0090,0x0090,0x0090}, {0x0091,0x0091,0x0091}, + {0x0092,0x0092,0x0092}, {0x0093,0x0093,0x0093}, + {0x0094,0x0094,0x0094}, {0x0095,0x0095,0x0095}, + {0x0096,0x0096,0x0096}, {0x0097,0x0097,0x0097}, + {0x0098,0x0098,0x0098}, {0x0099,0x0099,0x0099}, + {0x009A,0x009A,0x009A}, {0x009B,0x009B,0x009B}, + {0x009C,0x009C,0x009C}, {0x009D,0x009D,0x009D}, + {0x009E,0x009E,0x009E}, {0x009F,0x009F,0x009F}, + {0x00A0,0x00A0,0x00A0}, {0x00A1,0x00A1,0x00A1}, + {0x00A2,0x00A2,0x00A2}, {0x00A3,0x00A3,0x00A3}, + {0x00A4,0x00A4,0x00A4}, {0x00A5,0x00A5,0x00A5}, + {0x00A6,0x00A6,0x00A6}, {0x00A7,0x00A7,0x00A7}, + {0x00A8,0x00A8,0x00A8}, {0x00A9,0x00A9,0x00A9}, + {0x00AA,0x00AA,0x00AA}, {0x00AB,0x00AB,0x00AB}, + {0x00AC,0x00AC,0x00AC}, {0x00AD,0x00AD,0x00AD}, + {0x00AE,0x00AE,0x00AE}, {0x00AF,0x00AF,0x00AF}, + {0x00B0,0x00B0,0x00B0}, {0x00B1,0x00B1,0x00B1}, + {0x00B2,0x00B2,0x00B2}, {0x00B3,0x00B3,0x00B3}, + {0x00B4,0x00B4,0x00B4}, {0x039C,0x00B5,0x039C}, + {0x00B6,0x00B6,0x00B6}, {0x00B7,0x00B7,0x00B7}, + {0x00B8,0x00B8,0x00B8}, {0x00B9,0x00B9,0x00B9}, + {0x00BA,0x00BA,0x00BA}, {0x00BB,0x00BB,0x00BB}, + {0x00BC,0x00BC,0x00BC}, {0x00BD,0x00BD,0x00BD}, + {0x00BE,0x00BE,0x00BE}, {0x00BF,0x00BF,0x00BF}, + {0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041}, + {0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041}, + {0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041}, + {0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043}, + {0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045}, + {0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045}, + {0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049}, + {0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049}, + {0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E}, + {0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F}, + {0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F}, + {0x00D6,0x00F6,0x004F}, {0x00D7,0x00D7,0x00D7}, + {0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055}, + {0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055}, + {0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059}, + {0x00DE,0x00FE,0x00DE}, {0x00DF,0x00DF,0x00DF}, + {0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041}, + {0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041}, + {0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041}, + {0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043}, + {0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045}, + {0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045}, + {0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049}, + {0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049}, + {0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E}, + {0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F}, + {0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F}, + {0x00D6,0x00F6,0x004F}, {0x00F7,0x00F7,0x00F7}, + {0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055}, + {0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055}, + {0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059}, + {0x00DE,0x00FE,0x00DE}, {0x0178,0x00FF,0x0059} +}; + + + +MY_UNICASE_INFO *my_unicase_turkish[256]= +{ + turk00, plane01, plane02, plane03, plane04, plane05, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F, + NULL, plane21, NULL, NULL, plane24, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, planeFF +}; + + + +/** + Compare string against string with wildcard + This function is used for utf8mb3, utf8mb4, ucs2, utf16, utf32 + + @param cs Character set. + @str String. + @str_end End of string. + @wildstr Wildcard pattern. + @wildend End of wildcard pattern. + @escape Escape characters, typically \\. + @w_one "One character", typically _. + @w_many "Many characters", typically %. + + @return Comparison result. + @retval 0 if matched. + @retval -1 if not matched with wildcard. + @retval 1 if matched with wildcard. +*/ + +int my_wildcmp_unicode(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many, + MY_UNICASE_INFO **weights) +{ + int result= -1; /* Not found, using wildcards */ + my_wc_t s_wc, w_wc; + int scan, plane; + int (*mb_wc)(struct charset_info_st *, my_wc_t *, + const uchar *, const uchar *); + mb_wc= cs->cset->mb_wc; + + while (wildstr != wildend) + { + while (1) + { + my_bool escaped= 0; + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + + if (w_wc == (my_wc_t)w_many) + { + result= 1; /* Found an anchor char */ + break; + } + + wildstr+= scan; + if (w_wc == (my_wc_t)escape && wildstr < wildend) + { + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + wildstr+= scan; + escaped= 1; + } + + if ((scan= mb_wc(cs, &s_wc, (const uchar*)str, + (const uchar*)str_end)) <= 0) + return 1; + str+= scan; + + if (!escaped && w_wc == (my_wc_t)w_one) + { + result= 1; /* Found an anchor char */ + } + else + { + if (weights) + { + if (s_wc < 0x10000) + { + plane=(s_wc>>8) & 0xFF; + s_wc = weights[plane] ? weights[plane][s_wc & 0xFF].sort : s_wc; + } + if (w_wc < 0x10000) + { + plane=(w_wc>>8) & 0xFF; + w_wc = weights[plane] ? weights[plane][w_wc & 0xFF].sort : w_wc; + } + } + if (s_wc != w_wc) + return 1; /* No match */ + } + if (wildstr == wildend) + return (str != str_end); /* Match if both are at end */ + } + + + if (w_wc == (my_wc_t)w_many) + { /* Found w_many */ + + /* Remove any '%' and '_' from the wild search string */ + for (; wildstr != wildend ;) + { + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <= 0) + return 1; + + if (w_wc == (my_wc_t)w_many) + { + wildstr+= scan; + continue; + } + + if (w_wc == (my_wc_t)w_one) + { + wildstr+= scan; + if ((scan= mb_wc(cs, &s_wc, (const uchar*)str, + (const uchar*)str_end)) <=0) + return 1; + str+= scan; + continue; + } + break; /* Not a wild character */ + } + + if (wildstr == wildend) + return 0; /* Ok if w_many is last */ + + if (str == str_end) + return -1; + + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <=0) + return 1; + wildstr+= scan; + + if (w_wc == (my_wc_t)escape) + { + if (wildstr < wildend) + { + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <=0) + return 1; + wildstr+= scan; + } + } + + while (1) + { + /* Skip until the first character from wildstr is found */ + while (str != str_end) + { + if ((scan= mb_wc(cs, &s_wc, (const uchar*)str, + (const uchar*)str_end)) <=0) + return 1; + if (weights) + { + plane=(s_wc>>8) & 0xFF; + s_wc = weights[plane] ? weights[plane][s_wc & 0xFF].sort : s_wc; + plane=(w_wc>>8) & 0xFF; + w_wc = weights[plane] ? weights[plane][w_wc & 0xFF].sort : w_wc; + } + + if (s_wc == w_wc) + break; + str+= scan; + } + if (str == str_end) + return -1; + + str+= scan; + result= my_wildcmp_unicode(cs, str, str_end, wildstr, wildend, + escape, w_one, w_many, + weights); + if (result <= 0) + return result; + } + } + } + return (str != str_end ? 1 : 0); +} + + +/** + Pad buffer with weights for space characters. + + @details + This functions fills the buffer pointed by "str" + with weights of space character. Not more than + "nweights" weights are put. If at some iteration + step only a half of weight can fit + (which is possible if buffer length is an odd number) + then a half of this weight is put - this gives + a little bit better ORDER BY result for long strings. + + @str Buffer + @strend End of buffer + @nweights Number of weights + + @return Result length +*/ + +static size_t +my_strxfrm_pad_nweights_unicode(uchar *str, uchar *strend, size_t nweights) +{ + uchar *str0; + DBUG_ASSERT(str && str <= strend); + for (str0= str; str < strend && nweights; nweights--) + { + *str++= 0x00; + if (str < strend) + *str++= 0x20; + } + return str - str0; +} + + +/** + Pad buffer with weights for space characters. + + @details + This functions fills the buffer pointed by "str" + with weights of space character. Putting half of weight + (when buffer length is an odd number) is OK. + + @str Buffer + @strend End of buffer + + @return Result length +*/ + +static size_t +my_strxfrm_pad_unicode(uchar *str, uchar *strend) +{ + uchar *str0= str; + DBUG_ASSERT(str && str <= strend); + for ( ; str < strend ; ) + { + *str++= 0x00; + if (str < strend) + *str++= 0x20; + } + return str - str0; +} + + +#define REPLACEMENT_CHAR 0xFFFD; + + +static inline void +my_tosort_unicode(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256) + { + if (uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].sort; + } + else + { + *wc= REPLACEMENT_CHAR; + } +} + + +size_t +my_strnxfrm_unicode(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar *src, size_t srclen, uint flags) +{ + my_wc_t wc; + int res; + uchar *dst0= dst; + uchar *de= dst + dstlen; + const uchar *se= src + srclen; + MY_UNICASE_INFO **uni_plane= (cs->state & MY_CS_BINSORT) ? + NULL : cs->caseinfo; + LINT_INIT(wc); + DBUG_ASSERT(src); + + for (; dst < de && nweights; nweights--) + { + if ((res= cs->cset->mb_wc(cs, &wc, src, se)) <= 0) + break; + src+= res; + + if (uni_plane) + my_tosort_unicode(uni_plane, &wc); + + *dst++= (uchar) (wc >> 8); + if (dst < de) + *dst++= (uchar) (wc & 0xFF); + } + + if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + dst+= my_strxfrm_pad_nweights_unicode(dst, de, nweights); + + my_strxfrm_desc_and_reverse(dst0, dst, flags, 0); + + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de) + dst+= my_strxfrm_pad_unicode(dst, de); + return dst - dst0; +} + + + +#endif + + +#ifdef HAVE_CHARSET_utf8mb4 + +/* + We consider bytes with code more than 127 as a letter. + This garantees that word boundaries work fine with regular + expressions. Note, there is no need to mark byte 255 as a + letter, it is illegal byte in UTF8. +*/ +static uchar ctype_utf8mb4[]= +{ + 0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16, + 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, + 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0 +}; + + +static uchar to_lower_utf8mb4[]= +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95, + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + + +static uchar to_upper_utf8mb4[]= +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + + +static inline int +bincmp_utf8mb4(const uchar *s, const uchar *se, + const uchar *t, const uchar *te) +{ + int slen= (int) (se - s), tlen= (int) (te - t); + int len= min(slen, tlen); + int cmp= memcmp(s, t, len); + return cmp ? cmp : slen - tlen; +} + + +static int +my_mb_wc_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t * pwc, const uchar *s, const uchar *e) +{ + uchar c; + + if (s >= e) + return MY_CS_TOOSMALL; + + c= s[0]; + if (c < 0x80) + { + *pwc= c; + return 1; + } + else if (c < 0xc2) + return MY_CS_ILSEQ; + else if (c < 0xe0) + { + if (s + 2 > e) /* We need 2 characters */ + return MY_CS_TOOSMALL2; + + if (!((s[1] ^ 0x80) < 0x40)) + return MY_CS_ILSEQ; + + *pwc= ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + return 2; + } + else if (c < 0xf0) + { + if (s + 3 > e) /* We need 3 characters */ + return MY_CS_TOOSMALL3; + + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && + (c >= 0xe1 || s[1] >= 0xa0))) + return MY_CS_ILSEQ; + + *pwc= ((my_wc_t) (c & 0x0f) << 12) | + ((my_wc_t) (s[1] ^ 0x80) << 6) | + (my_wc_t) (s[2] ^ 0x80); + return 3; + } + else if (c < 0xf5) + { + if (s + 4 > e) /* We need 4 characters */ + return MY_CS_TOOSMALL4; + + /* + UTF-8 quick four-byte mask: + 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + Encoding allows to encode U+00010000..U+001FFFFF + + The maximum character defined in the Unicode standard is U+0010FFFF. + Higher characters U+00110000..U+001FFFFF are not used. + + 11110000.10010000.10xxxxxx.10xxxxxx == F0.90.80.80 == U+00010000 (min) + 11110100.10001111.10111111.10111111 == F4.8F.BF.BF == U+0010FFFF (max) + + Valid codes: + [F0][90..BF][80..BF][80..BF] + [F1][80..BF][80..BF][80..BF] + [F2][80..BF][80..BF][80..BF] + [F3][80..BF][80..BF][80..BF] + [F4][80..8F][80..BF][80..BF] + */ + + if (!((s[1] ^ 0x80) < 0x40 && + (s[2] ^ 0x80) < 0x40 && + (s[3] ^ 0x80) < 0x40 && + (c >= 0xf1 || s[1] >= 0x90) && + (c <= 0xf3 || s[1] <= 0x8F))) + return MY_CS_ILSEQ; + *pwc = ((my_wc_t) (c & 0x07) << 18) | + ((my_wc_t) (s[1] ^ 0x80) << 12) | + ((my_wc_t) (s[2] ^ 0x80) << 6) | + (my_wc_t) (s[3] ^ 0x80); + return 4; + } + return MY_CS_ILSEQ; +} + + +/* + The same as above, but without range check + for example, for a null-terminated string +*/ +static int +my_mb_wc_utf8mb4_no_range(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s) +{ + uchar c; + + c= s[0]; + if (c < 0x80) + { + *pwc = c; + return 1; + } + + if (c < 0xc2) + return MY_CS_ILSEQ; + + if (c < 0xe0) + { + if (!((s[1] ^ 0x80) < 0x40)) + return MY_CS_ILSEQ; + + *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + return 2; + } + + if (c < 0xf0) + { + if (!((s[1] ^ 0x80) < 0x40 && + (s[2] ^ 0x80) < 0x40 && + (c >= 0xe1 || s[1] >= 0xa0))) + return MY_CS_ILSEQ; + *pwc= ((my_wc_t) (c & 0x0f) << 12) | + ((my_wc_t) (s[1] ^ 0x80) << 6) | + (my_wc_t) (s[2] ^ 0x80); + + return 3; + } + else if (c < 0xf5) + { + if (!((s[1] ^ 0x80) < 0x40 && + (s[2] ^ 0x80) < 0x40 && + (s[3] ^ 0x80) < 0x40 && + (c >= 0xf1 || s[1] >= 0x90) && + (c <= 0xf3 || s[1] <= 0x8F))) + return MY_CS_ILSEQ; + *pwc = ((my_wc_t) (c & 0x07) << 18) | + ((my_wc_t) (s[1] ^ 0x80) << 12) | + ((my_wc_t) (s[2] ^ 0x80) << 6) | + (my_wc_t) (s[3] ^ 0x80); + return 4; + } + return MY_CS_ILSEQ; +} + + +static int +my_wc_mb_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *r, uchar *e) +{ + int count; + + if (r >= e) + return MY_CS_TOOSMALL; + + if (wc < 0x80) + count= 1; + else if (wc < 0x800) + count= 2; + else if (wc < 0x10000) + count= 3; + else if (wc < 0x200000) + count= 4; + else return MY_CS_ILUNI; + + if (r + count > e) + return MY_CS_TOOSMALLN(count); + + switch (count) { + /* Fall through all cases!!! */ + case 4: r[3] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x10000; + case 3: r[2] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x800; + case 2: r[1] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0xc0; + case 1: r[0] = (uchar) wc; + } + return count; +} + + +/* + The same as above, but without range check. +*/ +static int +my_wc_mb_utf8mb4_no_range(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *r) +{ + int count; + + if (wc < 0x80) + count= 1; + else if (wc < 0x800) + count= 2; + else if (wc < 0x10000) + count= 3; + else if (wc < 0x200000) + count= 4; + else + return MY_CS_ILUNI; + + switch (count) + { + /* Fall through all cases!!! */ + case 4: r[3]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x10000; + case 3: r[2]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x800; + case 2: r[1]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0xc0; + case 1: r[0]= (uchar) wc; + } + return count; +} + + +static inline void +my_tolower_utf8mb4(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256 && uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].tolower; +} + + +static inline void +my_toupper_utf8mb4(MY_UNICASE_INFO **uni_plane, my_wc_t *wc) +{ + int page= *wc >> 8; + if (page < 256 && uni_plane[page]) + *wc= uni_plane[page][*wc & 0xFF].toupper; +} + + +static size_t +my_caseup_utf8mb4(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen) +{ + my_wc_t wc; + int srcres, dstres; + char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src != dst || cs->caseup_multiply == 1); + + while ((src < srcend) && + (srcres= my_mb_wc_utf8mb4(cs, &wc, + (uchar *) src, (uchar*) srcend)) > 0) + { + my_toupper_utf8mb4(uni_plane, &wc); + if ((dstres= my_wc_mb_utf8mb4(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + return (size_t) (dst - dst0); +} + + +static inline void +my_hash_add(ulong *n1, ulong *n2, uint ch) +{ + n1[0]^= (((n1[0] & 63) + n2[0]) * (ch)) + (n1[0] << 8); + n2[0]+= 3; +} + + +static void +my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + my_wc_t wc; + int res; + const uchar *e= s + slen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + + /* + Remove end space. We do this to be able to compare + 'A ' and 'A' as identical + */ + while (e > s && e[-1] == ' ') + e--; + + while ((res= my_mb_wc_utf8mb4(cs, &wc, (uchar*) s, (uchar*) e)) > 0) + { + my_tosort_unicode(uni_plane, &wc); + my_hash_add(n1, n2, (uint) (wc & 0xFF)); + my_hash_add(n1, n2, (uint) (wc >> 8) & 0xFF); + if (wc > 0xFFFF) + { + /* + Put the highest byte only if it is non-zero, + to make hash functions for utf8mb3 and utf8mb4 + compatible for BMP characters. + This is useful to keep order of records in + test results, e.g. for "SHOW GRANTS". + */ + my_hash_add(n1, n2, (uint) (wc >> 16) & 0xFF); + } + s+= res; + } +} + + +static size_t +my_caseup_str_utf8mb4(CHARSET_INFO *cs, char *src) +{ + my_wc_t wc; + int srcres, dstres; + char *dst= src, *dst0= src; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(cs->caseup_multiply == 1); + + while (*src && + (srcres= my_mb_wc_utf8mb4_no_range(cs, &wc, (uchar *) src)) > 0) + { + my_toupper_utf8mb4(uni_plane, &wc); + if ((dstres= my_wc_mb_utf8mb4_no_range(cs, wc, (uchar*) dst)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + *dst= '\0'; + return (size_t) (dst - dst0); +} + + +static size_t +my_casedn_utf8mb4(CHARSET_INFO *cs, + char *src, size_t srclen, + char *dst, size_t dstlen) +{ + my_wc_t wc; + int srcres, dstres; + char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src != dst || cs->casedn_multiply == 1); + + while ((src < srcend) && + (srcres= my_mb_wc_utf8mb4(cs, &wc, + (uchar*) src, (uchar*) srcend)) > 0) + { + my_tolower_utf8mb4(uni_plane, &wc); + if ((dstres= my_wc_mb_utf8mb4(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + return (size_t) (dst - dst0); +} + + +static size_t +my_casedn_str_utf8mb4(CHARSET_INFO *cs, char *src) +{ + my_wc_t wc; + int srcres, dstres; + char *dst= src, *dst0= src; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(cs->casedn_multiply == 1); + + while (*src && + (srcres= my_mb_wc_utf8mb4_no_range(cs, &wc, (uchar *) src)) > 0) + { + my_tolower_utf8mb4(uni_plane, &wc); + if ((dstres= my_wc_mb_utf8mb4_no_range(cs, wc, (uchar*) dst)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + + /* + In rare cases lower string can be shorter than + the original string, for example: + + "U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE" + (which is 0xC4B0 in utf8, i.e. two bytes) + + is converted into + + "U+0069 LATIN SMALL LETTER I" + (which is 0x69 in utf8, i.e. one byte) + + So, we need to put '\0' terminator after converting. + */ + + *dst= '\0'; + return (size_t) (dst - dst0); +} + + +static int +my_strnncoll_utf8mb4(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + my_wc_t s_wc,t_wc; + const uchar *se= s + slen; + const uchar *te= t + tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + while ( s < se && t < te ) + { + int s_res= my_mb_wc_utf8mb4(cs, &s_wc, s, se); + int t_res= my_mb_wc_utf8mb4(cs, &t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare bytewise */ + return bincmp_utf8mb4(s, se, t, te); + } + + my_tosort_unicode(uni_plane, &s_wc); + my_tosort_unicode(uni_plane, &t_wc); + + if ( s_wc != t_wc ) + { + return s_wc > t_wc ? 1 : -1; + } + + s+= s_res; + t+= t_res; + } + return (int) (t_is_prefix ? (t - te) : ((se - s) - (te - t))); +} + + +/** + Compare strings, discarding end space + + If one string is shorter as the other, then we space extend the other + so that the strings have equal length. + + This will ensure that the following things hold: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + @param cs Character set pinter. + @param a First string to compare. + @param a_length Length of 'a'. + @param b Second string to compare. + @param b_length Length of 'b'. + @param diff_if_only_endspace_difference + Set to 1 if the strings should be regarded as different + if they only difference in end space + + @return Comparison result. + @retval Negative number, if a less than b. + @retval 0, if a is equal to b + @retval Positive number, if a > b +*/ + +static int +my_strnncollsp_utf8mb4(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + int res; + my_wc_t s_wc, t_wc; + const uchar *se= s + slen, *te= t + tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= FALSE; +#endif + + while ( s < se && t < te ) + { + int s_res= my_mb_wc_utf8mb4(cs, &s_wc, s, se); + int t_res= my_mb_wc_utf8mb4(cs, &t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare bytewise */ + return bincmp_utf8mb4(s, se, t, te); + } + + my_tosort_unicode(uni_plane, &s_wc); + my_tosort_unicode(uni_plane, &t_wc); + + if ( s_wc != t_wc ) + { + return s_wc > t_wc ? 1 : -1; + } + + s+=s_res; + t+=t_res; + } + + slen= (size_t) (se-s); + tlen= (size_t) (te-t); + res= 0; + + if (slen != tlen) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + if (slen < tlen) + { + slen= tlen; + s= t; + se= te; + swap= -1; + res= -res; + } + /* + This following loop uses the fact that in UTF-8 + all multibyte characters are greater than space, + and all multibyte head characters are greater than + space. It means if we meet a character greater + than space, it always means that the longer string + is greater. So we can reuse the same loop from the + 8bit version, without having to process full multibute + sequences. + */ + for ( ; s < se; s++) + { + if (*s != ' ') + return (*s < ' ') ? -swap : swap; + } + } + return res; +} + + +/** + Compare 0-terminated UTF8 strings. + + @param cs character set handler + @param s First 0-terminated string to compare + @param t Second 0-terminated string to compare + + @return Comparison result. + @retval negative number if s < t + @retval positive number if s > t + @retval 0 is the strings are equal +*/ + +static int +my_strcasecmp_utf8mb4(CHARSET_INFO *cs, const char *s, const char *t) +{ + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + while (s[0] && t[0]) + { + my_wc_t s_wc,t_wc; + + if ((uchar) s[0] < 128) + { + /* + s[0] is between 0 and 127. + It represents a single byte character. + Convert it into weight according to collation. + */ + s_wc= plane00[(uchar) s[0]].tolower; + s++; + } + else + { + int res= my_mb_wc_utf8mb4_no_range(cs, &s_wc, (const uchar*) s); + + /* + In the case of wrong multibyte sequence we will + call strcmp() for byte-to-byte comparison. + */ + if (res <= 0) + return strcmp(s, t); + s+= res; + + my_tolower_utf8mb4(uni_plane, &s_wc); + } + + + /* Do the same for the second string */ + + if ((uchar) t[0] < 128) + { + /* Convert single byte character into weight */ + t_wc= plane00[(uchar) t[0]].tolower; + t++; + } + else + { + int res= my_mb_wc_utf8mb4_no_range(cs, &t_wc, (const uchar*) t); + if (res <= 0) + return strcmp(s, t); + t+= res; + + my_tolower_utf8mb4(uni_plane, &t_wc); + } + + /* Now we have two weights, let's compare them */ + if ( s_wc != t_wc ) + return ((int) s_wc) - ((int) t_wc); + } + return ((int) (uchar) s[0]) - ((int) (uchar) t[0]); +} + + +static int +my_wildcmp_utf8mb4(CHARSET_INFO *cs, + const char *str, const char *strend, + const char *wildstr, const char *wildend, + int escape, int w_one, int w_many) +{ + return my_wildcmp_unicode(cs, str, strend, wildstr, wildend, + escape, w_one, w_many, cs->caseinfo); +} + + +static size_t +my_strnxfrmlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), size_t len) +{ + /* TODO: fix when working on WL "Unicode new version" */ + return (len * 2 + 2) / 4; +} + + +static uint +my_ismbchar_utf8mb4(CHARSET_INFO *cs, const char *b, const char *e) +{ + my_wc_t wc; + int res= my_mb_wc_utf8mb4(cs,&wc, (const uchar*)b, (const uchar*)e); + return (res > 1) ? res : 0; +} + + +static uint +my_mbcharlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), uint c) +{ + if (c < 0x80) + return 1; + if (c < 0xc2) + return 0; /* Illegal mb head */ + if (c < 0xe0) + return 2; + if (c < 0xf0) + return 3; + if (c < 0xf8) + return 4; + return 0; /* Illegal mb head */; +} + + +static MY_COLLATION_HANDLER my_collation_utf8mb4_general_ci_handler= +{ + NULL, /* init */ + my_strnncoll_utf8mb4, + my_strnncollsp_utf8mb4, + my_strnxfrm_unicode, + my_strnxfrmlen_utf8mb4, + my_like_range_mb, + my_wildcmp_utf8mb4, + my_strcasecmp_utf8mb4, + my_instr_mb, + my_hash_sort_utf8mb4, + my_propagate_complex +}; + + +static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler = +{ + NULL, /* init */ + my_strnncoll_mb_bin, + my_strnncollsp_mb_bin, + my_strnxfrm_unicode, + my_strnxfrmlen_utf8mb4, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_bin, + my_propagate_simple +}; + + +MY_CHARSET_HANDLER my_charset_utf8mb4_handler= +{ + NULL, /* init */ + my_ismbchar_utf8mb4, + my_mbcharlen_utf8mb4, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_mb, + my_lengthsp_8bit, + my_numcells_mb, + my_mb_wc_utf8mb4, + my_wc_mb_utf8mb4, + my_mb_ctype_mb, + my_caseup_str_utf8mb4, + my_casedn_str_utf8mb4, + my_caseup_utf8mb4, + my_casedn_utf8mb4, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + + +CHARSET_INFO my_charset_utf8mb4_general_ci= +{ + 45,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */ + MY_UTF8MB4, /* cs name */ + MY_UTF8MB4_GENERAL_CI,/* name */ + "UTF-8 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_utf8mb4, /* ctype */ + to_lower_utf8mb4, /* to_lower */ + to_upper_utf8mb4, /* to_upper */ + to_upper_utf8mb4, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_utf8mb4_general_ci_handler +}; + + +CHARSET_INFO my_charset_utf8mb4_bin= +{ + 46,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE, /* state */ + MY_UTF8MB4, /* cs name */ + MY_UTF8MB4_BIN, /* name */ + "UTF-8 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_utf8mb4, /* ctype */ + to_lower_utf8mb4, /* to_lower */ + to_upper_utf8mb4, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 4, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb4_handler, + &my_collation_utf8mb4_bin_handler +}; + +#endif /* HAVE_CHARSET_utf8mb4 */ + + +#ifdef HAVE_CHARSET_utf8mb3 + +/* + We consider bytes with code more than 127 as a letter. + This garantees that word boundaries work fine with regular + expressions. Note, there is no need to mark byte 255 as a + letter, it is illegal byte in UTF8. +*/ +static uchar ctype_utf8[] = { + 0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16, + 16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16, + 16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0 +}; + +/* The below are taken from usa7 implementation */ + +static uchar to_lower_utf8[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95, + 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + +static uchar to_upper_utf8[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 +}; + +static inline int bincmp(const uchar *s, const uchar *se, + const uchar *t, const uchar *te) +{ + int slen= (int) (se-s), tlen= (int) (te-t); + int len=min(slen,tlen); + int cmp= memcmp(s,t,len); + return cmp ? cmp : slen-tlen; +} + + +static int +my_mb_wc_utf8mb3(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t * pwc, const uchar *s, const uchar *e) +{ + uchar c; + + if (s >= e) + return MY_CS_TOOSMALL; + + c= s[0]; + if (c < 0x80) + { + *pwc = c; + return 1; + } + else if (c < 0xc2) + return MY_CS_ILSEQ; + else if (c < 0xe0) + { + if (s+2 > e) /* We need 2 characters */ + return MY_CS_TOOSMALL2; + + if (!((s[1] ^ 0x80) < 0x40)) + return MY_CS_ILSEQ; + + *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + return 2; + } + else if (c < 0xf0) + { + if (s+3 > e) /* We need 3 characters */ + return MY_CS_TOOSMALL3; + + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && + (c >= 0xe1 || s[1] >= 0xa0))) + return MY_CS_ILSEQ; + + *pwc = ((my_wc_t) (c & 0x0f) << 12) | + ((my_wc_t) (s[1] ^ 0x80) << 6) | + (my_wc_t) (s[2] ^ 0x80); + + return 3; + } +#ifdef UNICODE_32BIT + else if (c < 0xf8 && sizeof(my_wc_t)*8 >= 32) + { + if (s+4 > e) /* We need 4 characters */ + return MY_CS_TOOSMALL4; + + if (!((s[1] ^ 0x80) < 0x40 && + (s[2] ^ 0x80) < 0x40 && + (s[3] ^ 0x80) < 0x40 && + (c >= 0xf1 || s[1] >= 0x90))) + return MY_CS_ILSEQ; + + *pwc = ((my_wc_t) (c & 0x07) << 18) | + ((my_wc_t) (s[1] ^ 0x80) << 12) | + ((my_wc_t) (s[2] ^ 0x80) << 6) | + (my_wc_t) (s[3] ^ 0x80); + + return 4; + } + else if (c < 0xfc && sizeof(my_wc_t)*8 >= 32) + { + if (s+5 >e) /* We need 5 characters */ + return MY_CS_TOOSMALL5; + + if (!((s[1] ^ 0x80) < 0x40 && + (s[2] ^ 0x80) < 0x40 && + (s[3] ^ 0x80) < 0x40 && + (s[4] ^ 0x80) < 0x40 && + (c >= 0xf9 || s[1] >= 0x88))) + return MY_CS_ILSEQ; + + *pwc = ((my_wc_t) (c & 0x03) << 24) | + ((my_wc_t) (s[1] ^ 0x80) << 18) | + ((my_wc_t) (s[2] ^ 0x80) << 12) | + ((my_wc_t) (s[3] ^ 0x80) << 6) | + (my_wc_t) (s[4] ^ 0x80); + return 5; + } + else if (c < 0xfe && sizeof(my_wc_t)*8 >= 32) + { + if ( s+6 >e ) /* We need 6 characters */ + return MY_CS_TOOSMALL6; + + if (!((s[1] ^ 0x80) < 0x40 && + (s[2] ^ 0x80) < 0x40 && + (s[3] ^ 0x80) < 0x40 && + (s[4] ^ 0x80) < 0x40 && + (s[5] ^ 0x80) < 0x40 && + (c >= 0xfd || s[1] >= 0x84))) + return MY_CS_ILSEQ; + + *pwc = ((my_wc_t) (c & 0x01) << 30) + | ((my_wc_t) (s[1] ^ 0x80) << 24) + | ((my_wc_t) (s[2] ^ 0x80) << 18) + | ((my_wc_t) (s[3] ^ 0x80) << 12) + | ((my_wc_t) (s[4] ^ 0x80) << 6) + | (my_wc_t) (s[5] ^ 0x80); + return 6; + } +#endif + return MY_CS_ILSEQ; +} + + +/* + The same as above, but without range check + for example, for a null-terminated string +*/ +static int +my_mb_wc_utf8mb3_no_range(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t * pwc, const uchar *s) +{ + uchar c; + + c= s[0]; + if (c < 0x80) + { + *pwc = c; + return 1; + } + + if (c < 0xc2) + return MY_CS_ILSEQ; + + if (c < 0xe0) + { + if (!((s[1] ^ 0x80) < 0x40)) + return MY_CS_ILSEQ; + + *pwc = ((my_wc_t) (c & 0x1f) << 6) | (my_wc_t) (s[1] ^ 0x80); + return 2; + } + + if (c < 0xf0) + { + if (!((s[1] ^ 0x80) < 0x40 && + (s[2] ^ 0x80) < 0x40 && + (c >= 0xe1 || s[1] >= 0xa0))) + return MY_CS_ILSEQ; + + *pwc= ((my_wc_t) (c & 0x0f) << 12) | + ((my_wc_t) (s[1] ^ 0x80) << 6) | + (my_wc_t) (s[2] ^ 0x80); + + return 3; + } + return MY_CS_ILSEQ; +} + + +static int +my_wc_mb_utf8mb3(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *r, uchar *e) +{ + int count; + + if (r >= e) + return MY_CS_TOOSMALL; + + if (wc < 0x80) + count = 1; + else if (wc < 0x800) + count = 2; + else if (wc < 0x10000) + count = 3; +#ifdef UNICODE_32BIT + else if (wc < 0x200000) + count = 4; + else if (wc < 0x4000000) + count = 5; + else if (wc <= 0x7fffffff) + count = 6; +#endif + else return MY_CS_ILUNI; + + /* + e is a character after the string r, not the last character of it. + Because of it (r+count > e), not (r+count-1 >e ) + */ + if ( r+count > e ) + return MY_CS_TOOSMALLN(count); + + switch (count) { + /* Fall through all cases!!! */ +#ifdef UNICODE_32BIT + case 6: r[5] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x4000000; + case 5: r[4] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x200000; + case 4: r[3] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x10000; +#endif + case 3: r[2] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x800; + case 2: r[1] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0xc0; + case 1: r[0] = (uchar) wc; + } + return count; +} + + +/* + The same as above, but without range check. +*/ +static int +my_wc_mb_utf8mb3_no_range(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *r) +{ + int count; + + if (wc < 0x80) + count= 1; + else if (wc < 0x800) + count= 2; + else if (wc < 0x10000) + count= 3; + else + return MY_CS_ILUNI; + + switch (count) + { + /* Fall through all cases!!! */ + case 3: r[2]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0x800; + case 2: r[1]= (uchar) (0x80 | (wc & 0x3f)); wc= wc >> 6; wc |= 0xc0; + case 1: r[0]= (uchar) wc; + } + return count; +} + + +static size_t +my_caseup_utf8mb3(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen) +{ + my_wc_t wc; + int srcres, dstres; + char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src != dst || cs->caseup_multiply == 1); + + while ((src < srcend) && + (srcres= my_mb_wc_utf8mb3(cs, &wc, + (uchar *) src, (uchar*) srcend)) > 0) + { + int plane= (wc>>8) & 0xFF; + wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc; + if ((dstres= my_wc_mb_utf8mb3(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + return (size_t) (dst - dst0); +} + + +static void +my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen, + ulong *n1, ulong *n2) +{ + my_wc_t wc; + int res; + const uchar *e=s+slen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + + /* + Remove end space. We have to do this to be able to compare + 'A ' and 'A' as identical + */ + while (e > s && e[-1] == ' ') + e--; + + while ((s < e) && (res= my_mb_wc_utf8mb3(cs, &wc, + (uchar *)s, (uchar*)e)) > 0) + { + int plane = (wc>>8) & 0xFF; + wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].sort : wc; + n1[0]^= (((n1[0] & 63)+n2[0])*(wc & 0xFF))+ (n1[0] << 8); + n2[0]+=3; + n1[0]^= (((n1[0] & 63)+n2[0])*(wc >> 8))+ (n1[0] << 8); + n2[0]+=3; + s+=res; + } +} + + +static size_t +my_caseup_str_utf8mb3(CHARSET_INFO *cs, char *src) +{ + my_wc_t wc; + int srcres, dstres; + char *dst= src, *dst0= src; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(cs->caseup_multiply == 1); + + while (*src && + (srcres= my_mb_wc_utf8mb3_no_range(cs, &wc, (uchar *) src)) > 0) + { + int plane= (wc>>8) & 0xFF; + wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc; + if ((dstres= my_wc_mb_utf8mb3_no_range(cs, wc, (uchar*) dst)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + *dst= '\0'; + return (size_t) (dst - dst0); +} + + +static size_t +my_casedn_utf8mb3(CHARSET_INFO *cs, char *src, size_t srclen, + char *dst, size_t dstlen) +{ + my_wc_t wc; + int srcres, dstres; + char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(src != dst || cs->casedn_multiply == 1); + + while ((src < srcend) && + (srcres= my_mb_wc_utf8mb3(cs, &wc, + (uchar*) src, (uchar*)srcend)) > 0) + { + int plane= (wc>>8) & 0xFF; + wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc; + if ((dstres= my_wc_mb_utf8mb3(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + return (size_t) (dst - dst0); +} + + +static size_t +my_casedn_str_utf8mb3(CHARSET_INFO *cs, char *src) +{ + my_wc_t wc; + int srcres, dstres; + char *dst= src, *dst0= src; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + DBUG_ASSERT(cs->casedn_multiply == 1); + + while (*src && + (srcres= my_mb_wc_utf8mb3_no_range(cs, &wc, (uchar *) src)) > 0) + { + int plane= (wc>>8) & 0xFF; + wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc; + if ((dstres= my_wc_mb_utf8mb3_no_range(cs, wc, (uchar*) dst)) <= 0) + break; + src+= srcres; + dst+= dstres; + } + + /* + In rare cases lower string can be shorter than + the original string, for example: + + "U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE" + (which is 0xC4B0 in utf8, i.e. two bytes) + + is converted into + + "U+0069 LATIN SMALL LETTER I" + (which is 0x69 in utf8, i.e. one byte) + + So, we need to put '\0' terminator after converting. + */ + + *dst= '\0'; + return (size_t) (dst - dst0); +} + + +static int +my_strnncoll_utf8mb3(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + int s_res,t_res; + my_wc_t s_wc,t_wc; + const uchar *se=s+slen; + const uchar *te=t+tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + + while ( s < se && t < te ) + { + int plane; + s_res= my_mb_wc_utf8mb3(cs,&s_wc, s, se); + t_res= my_mb_wc_utf8mb3(cs,&t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare bytewise */ + return bincmp(s, se, t, te); + } + + plane=(s_wc>>8) & 0xFF; + s_wc = uni_plane[plane] ? uni_plane[plane][s_wc & 0xFF].sort : s_wc; + plane=(t_wc>>8) & 0xFF; + t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; + if ( s_wc != t_wc ) + { + return s_wc > t_wc ? 1 : -1; + } + + s+=s_res; + t+=t_res; + } + return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); +} + + +/** + Compare strings, discarding end space + + If one string is shorter as the other, then we space extend the other + so that the strings have equal length. + + This will ensure that the following things hold: + + "a" == "a " + "a\0" < "a" + "a\0" < "a " + + @param cs Character set pinter. + @param a First string to compare. + @param a_length Length of 'a'. + @param b Second string to compare. + @param b_length Length of 'b'. + @param diff_if_only_endspace_difference + Set to 1 if the strings should be regarded as different + if they only difference in end space + + @return Comparison result. + @retval Negative number, if a less than b. + @retval 0, if a is equal to b + @retval Positive number, if a > b +*/ + +static int +my_strnncollsp_utf8mb3(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + int s_res, t_res, res; + my_wc_t s_wc,t_wc; + const uchar *se= s+slen, *te= t+tlen; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + LINT_INIT(s_wc); + LINT_INIT(t_wc); + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= FALSE; +#endif + + while ( s < se && t < te ) + { + int plane; + s_res= my_mb_wc_utf8mb3(cs,&s_wc, s, se); + t_res= my_mb_wc_utf8mb3(cs,&t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare bytewise */ + return bincmp(s, se, t, te); + } + + plane=(s_wc>>8) & 0xFF; + s_wc = uni_plane[plane] ? uni_plane[plane][s_wc & 0xFF].sort : s_wc; + plane=(t_wc>>8) & 0xFF; + t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; + if ( s_wc != t_wc ) + { + return s_wc > t_wc ? 1 : -1; + } + + s+=s_res; + t+=t_res; + } + + slen= (size_t) (se-s); + tlen= (size_t) (te-t); + res= 0; + + if (slen != tlen) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + if (slen < tlen) + { + slen= tlen; + s= t; + se= te; + swap= -1; + res= -res; + } + /* + This following loop uses the fact that in UTF-8 + all multibyte characters are greater than space, + and all multibyte head characters are greater than + space. It means if we meet a character greater + than space, it always means that the longer string + is greater. So we can reuse the same loop from the + 8bit version, without having to process full multibute + sequences. + */ + for ( ; s < se; s++) + { + if (*s != ' ') + return (*s < ' ') ? -swap : swap; + } + } + return res; +} + + +/* + Compare 0-terminated UTF8 strings. + + SYNOPSIS + my_strcasecmp_utf8mb3() + cs character set handler + s First 0-terminated string to compare + t Second 0-terminated string to compare + + IMPLEMENTATION + + RETURN + - negative number if s < t + - positive number if s > t + - 0 is the strings are equal +*/ + +static int +my_strcasecmp_utf8mb3(CHARSET_INFO *cs, const char *s, const char *t) +{ + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + while (s[0] && t[0]) + { + my_wc_t s_wc,t_wc; + + if ((uchar) s[0] < 128) + { + /* + s[0] is between 0 and 127. + It represents a single byte character. + Convert it into weight according to collation. + */ + s_wc= plane00[(uchar) s[0]].tolower; + s++; + } + else + { + int plane, res; + + /* + Scan a multibyte character. + + In the future it is worth to write a special version of my_utf8_uni() + for 0-terminated strings which will not take in account length. Now + we call the regular version of my_utf8_uni() with s+3 in the + last argument. s+3 is enough to scan any multibyte sequence. + + Calling the regular version of my_utf8_uni is safe for 0-terminated + strings: we will never lose the end of the string: + If we have 0 character in the middle of a multibyte sequence, + then my_utf8_uni will always return a negative number, so the + loop with finish. + */ + + res= my_mb_wc_utf8mb3(cs, &s_wc, (const uchar*)s, (const uchar*) s + 3); + + /* + In the case of wrong multibyte sequence we will + call strcmp() for byte-to-byte comparison. + */ + if (res <= 0) + return strcmp(s, t); + s+= res; + + /* Convert Unicode code into weight according to collation */ + plane=(s_wc>>8) & 0xFF; + s_wc = uni_plane[plane] ? uni_plane[plane][s_wc & 0xFF].tolower : s_wc; + } + + + /* Do the same for the second string */ + + if ((uchar) t[0] < 128) + { + /* Convert single byte character into weight */ + t_wc= plane00[(uchar) t[0]].tolower; + t++; + } + else + { + int plane; + int res= my_mb_wc_utf8mb3(cs, &t_wc, + (const uchar*)t, (const uchar*) t + 3); + if (res <= 0) + return strcmp(s, t); + t+= res; + + /* Convert code into weight */ + plane=(t_wc>>8) & 0xFF; + t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].tolower : t_wc; + } + + /* Now we have two weights, let's compare them */ + if ( s_wc != t_wc ) + return ((int) s_wc) - ((int) t_wc); + } + return ((int)(uchar)s[0]) - ((int) (uchar) t[0]); +} + + +static int +my_wildcmp_utf8mb3(CHARSET_INFO *cs, + const char *str,const char *str_end, + const char *wildstr,const char *wildend, + int escape, int w_one, int w_many) +{ + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend, + escape,w_one,w_many,uni_plane); +} + + +static size_t +my_strnxfrmlen_utf8mb3(CHARSET_INFO *cs __attribute__((unused)), size_t len) +{ + return (len * 2 + 2) / 3; +} + + +static uint +my_ismbchar_utf8mb3(CHARSET_INFO *cs, const char *b, const char *e) +{ + my_wc_t wc; + int res= my_mb_wc_utf8mb3(cs, &wc, (const uchar*) b, (const uchar*) e); + return (res>1) ? res : 0; +} + + +static uint +my_mbcharlen_utf8mb3(CHARSET_INFO *cs __attribute__((unused)), uint c) +{ + if (c < 0x80) + return 1; + else if (c < 0xc2) + return 0; /* Illegal mb head */ + else if (c < 0xe0) + return 2; + else if (c < 0xf0) + return 3; +#ifdef UNICODE_32BIT + else if (c < 0xf8) + return 4; + else if (c < 0xfc) + return 5; + else if (c < 0xfe) + return 6; +#endif + return 0; /* Illegal mb head */; +} + + +static MY_COLLATION_HANDLER my_collation_utf8mb3_general_ci_handler = +{ + NULL, /* init */ + my_strnncoll_utf8mb3, + my_strnncollsp_utf8mb3, + my_strnxfrm_unicode, + my_strnxfrmlen_utf8mb3, + my_like_range_mb, + my_wildcmp_utf8mb3, + my_strcasecmp_utf8mb3, + my_instr_mb, + my_hash_sort_utf8mb3, + my_propagate_complex +}; + + +static MY_COLLATION_HANDLER my_collation_utf8mb3_bin_handler = +{ + NULL, /* init */ + my_strnncoll_mb_bin, + my_strnncollsp_mb_bin, + my_strnxfrm_unicode, + my_strnxfrmlen_utf8mb3, + my_like_range_mb, + my_wildcmp_mb_bin, + my_strcasecmp_mb_bin, + my_instr_mb, + my_hash_sort_mb_bin, + my_propagate_simple +}; + + +MY_CHARSET_HANDLER my_charset_utf8mb3_handler= +{ + NULL, /* init */ + my_ismbchar_utf8mb3, + my_mbcharlen_utf8mb3, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_mb, + my_lengthsp_8bit, + my_numcells_mb, + my_mb_wc_utf8mb3, + my_wc_mb_utf8mb3, + my_mb_ctype_mb, + my_caseup_str_utf8mb3, + my_casedn_str_utf8mb3, + my_caseup_utf8mb3, + my_casedn_utf8mb3, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + + +CHARSET_INFO my_charset_utf8mb3_general_ci= +{ + 33,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE, /* state */ + MY_UTF8MB3, /* cs name */ + MY_UTF8MB3_GENERAL_CI,/* name */ + "UTF-8 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + to_upper_utf8, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_utf8mb3_general_ci_handler +}; + + +CHARSET_INFO my_charset_utf8mb3_bin= +{ + 83,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_UNICODE, /* state */ + MY_UTF8MB3, /* cs name */ + MY_UTF8MB3_BIN, /* name */ + "UTF-8 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + NULL, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_utf8mb3_bin_handler +}; + +#ifdef HAVE_UTF8_GENERAL_CS + +/* + * These functions bacically do the same as their original, except + * that they return 0 only when two comparing unicode strings are + * strictly the same in case-sensitive way. See "save_diff" local + * variable to what they actually do. + */ + +static int +my_strnncoll_utf8mb3_cs(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool t_is_prefix) +{ + int s_res,t_res; + my_wc_t s_wc,t_wc; + const uchar *se=s+slen; + const uchar *te=t+tlen; + int save_diff = 0; + int diff; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + + while ( s < se && t < te ) + { + int plane; + s_res= my_mb_wc_utf8mb3(cs, &s_wc, s, se); + t_res= my_mb_wc_utf8mb3(cs, &t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + + { + /* Incorrect string, compare by char value */ + return ((int)s[0]-(int)t[0]); + } + + if ( save_diff == 0 ) + { + save_diff = ((int)s_wc) - ((int)t_wc); + } + plane=(s_wc>>8) & 0xFF; + s_wc = uni_plane[plane] ? uni_plane[plane][s_wc & 0xFF].sort : s_wc; + plane=(t_wc>>8) & 0xFF; + t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; + if ( s_wc != t_wc ) + { + return ((int) s_wc) - ((int) t_wc); + } + + s+=s_res; + t+=t_res; + } + diff = ( (se-s) - (te-t) ); + return t_is_prefix ? t-te : ((diff == 0) ? save_diff : diff); +} + +static int +my_strnncollsp_utf8mb3_cs(CHARSET_INFO *cs, + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference) +{ + int s_res, t_res, res; + my_wc_t s_wc, t_wc; + const uchar *se= s + slen; + const uchar *te= t + tlen; + int save_diff= 0; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; + +#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE + diff_if_only_endspace_difference= FALSE; +#endif + + while ( s < se && t < te ) + { + int plane; + s_res= my_mb_wc_utf8mb3(cs, &s_wc, s, se); + t_res= my_mb_wc_utf8mb3(cs, &t_wc, t, te); + + if ( s_res <= 0 || t_res <= 0 ) + { + /* Incorrect string, compare by char value */ + return ((int)s[0]-(int)t[0]); + } + + if ( save_diff == 0 ) + { + save_diff = ((int)s_wc) - ((int)t_wc); + } + plane=(s_wc>>8) & 0xFF; + s_wc = uni_plane[plane] ? uni_plane[plane][s_wc & 0xFF].sort : s_wc; + plane=(t_wc>>8) & 0xFF; + t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; + if ( s_wc != t_wc ) + { + return ((int) s_wc) - ((int) t_wc); + } + + s+=s_res; + t+=t_res; + } + + slen= se-s; + tlen= te-t; + res= 0; + + if (slen != tlen) + { + int swap= 1; + if (diff_if_only_endspace_difference) + res= 1; /* Assume 'a' is bigger */ + if (slen < tlen) + { + slen= tlen; + s= t; + se= te; + swap= -1; + res= -res; + } + /* + This following loop uses the fact that in UTF-8 + all multibyte characters are greater than space, + and all multibyte head characters are greater than + space. It means if we meet a character greater + than space, it always means that the longer string + is greater. So we can reuse the same loop from the + 8bit version, without having to process full multibute + sequences. + */ + for ( ; s < se; s++) + { + if (*s != (uchar) ' ') + return (*s < (uchar) ' ') ? -swap : swap; + } + } + return save_diff; +} + + +static MY_COLLATION_HANDLER my_collation_utf8mb3_general_cs_handler = +{ + NULL, /* init */ + my_strnncoll_utf8mb3_cs, + my_strnncollsp_utf8mb3_cs, + my_strnxfrm_unicode, + my_strnxfrmlen_utf8mb3, + my_like_range_simple, + my_wildcmp_mb, + my_strcasecmp_utf8mb3, + my_instr_mb, + my_hash_sort_utf8mb3, + my_propagate_simple +}; + + +CHARSET_INFO my_charset_utf8mb3_general_cs= +{ + 254,0,0, /* number */ + MY_CS_COMPILED|MY_CS_UNICODE, /* state */ + MY_UTF8MB3, /* cs name */ + MY_UTF8MB3_GENERAL_CS,/* name */ + "UTF-8 Unicode", /* comment */ + NULL, /* tailoring */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + to_upper_utf8, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 3, /* mbmaxlen */ + 0, /* min_sort_char */ + 255, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_utf8mb3_handler, + &my_collation_utf8mb3_general_cs_handler +}; +#endif /* Cybozu Hack */ + + +/* + File system encoding components: + +Code range Pattern Number Used Unused Blocks +----------------------------------------------------------------------------- +00C0..017F [.][0..4][g..z] 5*20= 100 97 3 Latin1 Supplement + Ext A +0370..03FF [.][5..9][g..z] 5*20= 100 88 12 Greek + Coptic +0400..052F [.][g..z][0..6] 20*7= 140 140 137 Cyrillic +0530..058F [.][g..z][7..8] 20*2= 40 38 2 Armenian +2160..217F [.][g..z][9] 20*1= 20 16 4 Number Forms +0180..02AF [.][g..z][a..k] 28*11=220 203 17 Latin Ext B + IPA +1E00..0EFF [.][g..z][l..r] 20*7= 140 136 4 Latin Additional Extended +1F00..1FFF [.][g..z][s..z] 20*8= 160 144 16 Greek Extended +.... .... [.][a..f][g..z] 6*20= 120 0 120 RESERVED +24B6..24E9 [.][@][a..z] 26 26 0 Enclosed Alphanumerics +FF21..FF5A [.][a..z][@] 26 26 0 Full Width forms + +All other characters are encoded using five bytes: + +[.][0..9a..z][0..9a..z][0..9a..z][0..9a..z] + +*/ + + +static uint16 touni[5994]= +{ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00C0, + 0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8, + 0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0, + 0x00D1,0x00D2,0x00D3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00E0, + 0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8, + 0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0, + 0x00F1,0x00F2,0x00F3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00D4, + 0x00D5,0x00D6,0x0000,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC, + 0x00DD,0x00DE,0x0178,0x0100,0x0102,0x0104,0x0106,0x0108, + 0x010A,0x010C,0x010E,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x00F4, + 0x00F5,0x00F6,0x00DF,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC, + 0x00FD,0x00FE,0x00FF,0x0101,0x0103,0x0105,0x0107,0x0109, + 0x010B,0x010D,0x010F,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0110, + 0x0112,0x0114,0x0116,0x0118,0x011A,0x011C,0x011E,0x0120, + 0x0122,0x0124,0x0126,0x0128,0x012A,0x012C,0x012E,0x0000, + 0x0132,0x0134,0x0136,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0111, + 0x0113,0x0115,0x0117,0x0119,0x011B,0x011D,0x011F,0x0121, + 0x0123,0x0125,0x0127,0x0129,0x012B,0x012D,0x012F,0x0131, + 0x0133,0x0135,0x0137,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0139,0x013B,0x013D,0x013F,0x0141,0x0143,0x0145,0x0147, + 0x0000,0x014A,0x014C,0x014E,0x0150,0x0152,0x0154,0x0156, + 0x0158,0x015A,0x015C,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0138, + 0x013A,0x013C,0x013E,0x0140,0x0142,0x0144,0x0146,0x0148, + 0x0149,0x014B,0x014D,0x014F,0x0151,0x0153,0x0155,0x0157, + 0x0159,0x015B,0x015D,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x015E, + 0x0160,0x0162,0x0164,0x0166,0x0168,0x016A,0x016C,0x016E, + 0x0170,0x0172,0x0174,0x0176,0x0179,0x017B,0x017D,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x015F, + 0x0161,0x0163,0x0165,0x0167,0x0169,0x016B,0x016D,0x016F, + 0x0171,0x0173,0x0175,0x0177,0x017A,0x017C,0x017E,0x017F, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0390,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0386, + 0x0388,0x0389,0x038A,0x0000,0x0391,0x0000,0x0393,0x0394, + 0x0395,0x0396,0x0397,0x0000,0x0399,0x0000,0x039B,0x039C, + 0x039D,0x039E,0x039F,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03AC, + 0x03AD,0x03AE,0x03AF,0x03B0,0x03B1,0x03B2,0x03B3,0x03B4, + 0x03B5,0x03B6,0x03B7,0x03B8,0x03B9,0x03BA,0x03BB,0x03BC, + 0x03BD,0x03BE,0x03BF,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x03A1,0x0000,0x0000,0x03A4,0x03A5,0x0000,0x03A7,0x03A8, + 0x03A9,0x03AA,0x03AB,0x038C,0x038E,0x038F,0x0000,0x0392, + 0x0398,0x03D2,0x03D3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03C0, + 0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,0x03C8, + 0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0x0000,0x03D0, + 0x03D1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03D4, + 0x03A6,0x03A0,0x0000,0x0000,0x03DA,0x03DC,0x03DE,0x03E0, + 0x03E2,0x03E4,0x03E6,0x03E8,0x03EA,0x03EC,0x03EE,0x039A, + 0x0000,0x03A3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x03D5,0x03D6,0x03D7,0x03D9,0x03DB,0x03DD,0x03DF,0x03E1, + 0x03E3,0x03E5,0x03E7,0x03E9,0x03EB,0x03ED,0x03EF,0x03F0, + 0x03F1,0x03F2,0x03F3,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x03FD,0x03FE,0x03FF,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x03F5, + 0x03F6,0x03F8,0x03FB,0x03FC,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x24B6,0x24B7,0x24B8,0x24B9,0x24BA,0x24BB,0x24BC, + 0x24BD,0x24BE,0x24BF,0x24C0,0x24C1,0x24C2,0x24C3,0x24C4, + 0x24C5,0x24C6,0x24C7,0x24C8,0x24C9,0x24CA,0x24CB,0x24CC, + 0x24CD,0x24CE,0x24CF,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x24D0,0x24D1,0x24D2,0x24D3,0x24D4,0x24D5,0x24D6, + 0x24D7,0x24D8,0x24D9,0x24DA,0x24DB,0x24DC,0x24DD,0x24DE, + 0x24DF,0x24E0,0x24E1,0x24E2,0x24E3,0x24E4,0x24E5,0x24E6, + 0x24E7,0x24E8,0x24E9,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF21,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF22,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF23,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF24,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF25,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF26,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0410,0x0424,0x0408,0x0478,0x04A6,0x04CD,0x04F4,0x0000, + 0x0544,0x2160,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF27,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01B3,0x01DE,0x0208,0x0230,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E00,0x1E28,0x1E50,0x1E78, + 0x1E60,0x1EBE,0x1EE6,0x1F08,0x1F2A,0x0000,0x1F6C,0x1F88, + 0x1FAC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0411,0x0425,0x0409,0x047A,0x04A8,0x0000,0x04F6,0x0531, + 0x0545,0x2161,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF28,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0182,0x01B5,0x01E0,0x020A,0x0232,0x0000,0x0000, + 0x019D,0x0000,0x0000,0x0000,0x1E02,0x1E2A,0x1E52,0x1E7A, + 0x0000,0x1EC0,0x1EE8,0x1F09,0x1F2B,0x0000,0x1F6D,0x1F89, + 0x1FAD,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0412,0x0426,0x040A,0x047C,0x04AA,0x04D0,0x04F8,0x0532, + 0x0546,0x2162,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF29,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0184,0x01B8,0x01E2,0x020C,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E04,0x1E2C,0x1E54,0x1E7C, + 0x0000,0x1EC2,0x1EEA,0x1F0A,0x1F2C,0x0000,0x1F6E,0x1F8A, + 0x1FAE,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0413,0x0427,0x040B,0x047E,0x04AC,0x04D2,0x0000,0x0533, + 0x0547,0x2163,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0187,0x0000,0x01E4,0x020E,0x0000,0x0000,0x0193, + 0x0000,0x01AE,0x0000,0x0000,0x1E06,0x1E2E,0x1E56,0x1E7E, + 0x0000,0x1EC4,0x1EEC,0x1F0B,0x1F2D,0x0000,0x1F6F,0x1F8B, + 0x1FAF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0414,0x0428,0x040C,0x0480,0x04AE,0x04D4,0x0000,0x0534, + 0x0548,0x2164,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x018B,0x0000,0x01E6,0x0210,0x0000,0x0000,0x0000, + 0x019F,0x0000,0x0000,0x0000,0x1E08,0x1E30,0x1E58,0x1E80, + 0x0000,0x1EC6,0x1EEE,0x1F0C,0x1F2E,0x0000,0x1FBA,0x1F8C, + 0x1FB8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0415,0x0429,0x040D,0x0000,0x04B0,0x04D6,0x0000,0x0535, + 0x0549,0x2165,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x01E8,0x0212,0x0000,0x0000,0x0000, + 0x0000,0x01B1,0x0000,0x0000,0x1E0A,0x1E32,0x1E5A,0x1E82, + 0x1EA0,0x1EC8,0x1EF0,0x1F0D,0x1F2F,0x1F59,0x1FBB,0x1F8D, + 0x1FB9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0416,0x042A,0x040E,0x048A,0x04B2,0x04D8,0x0000,0x0536, + 0x054A,0x2166,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0191,0x0000,0x01EA,0x0214,0x0000,0x0000,0x0194, + 0x0000,0x01B2,0x0000,0x0000,0x1E0C,0x1E34,0x1E5C,0x1E84, + 0x1EA2,0x1ECA,0x1EF2,0x1F0E,0x1F38,0x0000,0x1FC8,0x1F8E, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0417,0x042B,0x040F,0x048C,0x04B4,0x04DA,0x0000,0x0537, + 0x054B,0x2167,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01F6,0x01BC,0x01EC,0x0216,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E0E,0x1E36,0x1E5E,0x1E86, + 0x1EA4,0x1ECC,0x1EF4,0x1F0F,0x1F39,0x1F5B,0x1FC9,0x1F8F, + 0x1FBC,0x1FE8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0418,0x042C,0x0460,0x048E,0x04B6,0x04DC,0x0000,0x0538, + 0x054C,0x2168,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF2F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0198,0x01C4,0x01EE,0x0218,0x023A,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E10,0x1E38,0x0000,0x1E88, + 0x1EA6,0x1ECE,0x1EF6,0x1F18,0x1F3A,0x0000,0x1FCA,0x1F98, + 0x0000,0x1FE9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0419,0x042D,0x0462,0x0490,0x04B8,0x04DE,0x0500,0x0539, + 0x054D,0x2169,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF30,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x023D,0x01C7,0x0000,0x021A,0x023B,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E12,0x1E3A,0x1E62,0x1E8A, + 0x1EA8,0x1ED0,0x1EF8,0x1F19,0x1F3B,0x1F5D,0x1FCB,0x1F99, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041A,0x042E,0x0464,0x0492,0x04BA,0x04E0,0x0502,0x053A, + 0x054E,0x216A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF31,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01CA,0x01F1,0x021C,0x023E,0x0181,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E14,0x1E3C,0x1E64,0x1E8C, + 0x1EAA,0x1ED2,0x0000,0x1F1A,0x1F3C,0x0000,0x1FDA,0x1F9A, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041B,0x042F,0x0466,0x0494,0x04BC,0x04E2,0x0504,0x053B, + 0x054F,0x216B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF32,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0220,0x01CD,0x01F4,0x021E,0x0000,0x0186,0x0197, + 0x0000,0x0000,0x0000,0x0000,0x1E16,0x1E3E,0x1E66,0x1E8E, + 0x1EAC,0x1ED4,0x0000,0x1F1B,0x1F3D,0x1F5F,0x1FDB,0x1F9B, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041C,0x0400,0x0468,0x0496,0x04BE,0x04E4,0x0506,0x053C, + 0x0550,0x216C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF33,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A0,0x01CF,0x01F8,0x0000,0x0000,0x0000,0x0196, + 0x0000,0x0000,0x0000,0x0000,0x1E18,0x1E40,0x1E68,0x1E90, + 0x1EAE,0x1ED6,0x0000,0x1F1C,0x1F3E,0x0000,0x1FF8,0x1F9C, + 0x0000,0x1FEC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041D,0x0401,0x046A,0x0498,0x04C0,0x04E6,0x0508,0x053D, + 0x0551,0x216D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF34,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A2,0x01D1,0x01FA,0x0222,0x0000,0x0189,0x0000, + 0x0000,0x01B7,0x0000,0x0000,0x1E1A,0x1E42,0x1E6A,0x1E92, + 0x1EB0,0x1ED8,0x0000,0x1F1D,0x1F3F,0x0000,0x1FF9,0x1F9D, + 0x1FCC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041E,0x0402,0x046C,0x049A,0x04C1,0x04E8,0x050A,0x053E, + 0x0552,0x216E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF35,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A4,0x01D3,0x01FC,0x0224,0x0000,0x018A,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E1C,0x1E44,0x1E6C,0x1E94, + 0x1EB2,0x1EDA,0x0000,0x0000,0x1F48,0x0000,0x1FEA,0x1F9E, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x041F,0x0403,0x046E,0x049C,0x04C3,0x04EA,0x050C,0x053F, + 0x0553,0x216F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF36,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A7,0x01D5,0x01FE,0x0226,0x0000,0x0000,0x0000, + 0x01A6,0x0241,0x0000,0x0000,0x1E1E,0x1E46,0x1E6E,0x0000, + 0x1EB4,0x1EDC,0x0000,0x0000,0x1F49,0x0000,0x1FEB,0x1F9F, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0420,0x0404,0x0470,0x049E,0x04C5,0x04EC,0x050E,0x0540, + 0x0554,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF37,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01D7,0x0200,0x0228,0x0000,0x018F,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E20,0x1E48,0x1E70,0x0000, + 0x1EB6,0x1EDE,0x0000,0x0000,0x1F4A,0x1F68,0x1FFA,0x1FA8, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0421,0x0405,0x0472,0x04A0,0x04C7,0x04EE,0x0000,0x0541, + 0x0555,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF38,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x01D9,0x0202,0x022A,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E22,0x1E4A,0x1E72,0x0000, + 0x1EB8,0x1EE0,0x0000,0x0000,0x1F4B,0x1F69,0x1FFB,0x1FA9, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0422,0x0406,0x0474,0x04A2,0x04C9,0x04F0,0x0000,0x0542, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF39,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AC,0x01DB,0x0204,0x022C,0x0000,0x0190,0x019C, + 0x01A9,0x0000,0x0000,0x0000,0x1E24,0x1E4C,0x1E74,0x0000, + 0x1EBA,0x1EE2,0x0000,0x1F28,0x1F4C,0x1F6A,0x0000,0x1FAA, + 0x1FD8,0x1FFC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0423,0x0407,0x0476,0x04A4,0x04CB,0x04F2,0x0000,0x0543, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF3A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AF,0x018E,0x0206,0x022E,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x1E26,0x1E4E,0x1E76,0x0000, + 0x1EBC,0x1EE4,0x0000,0x1F29,0x1F4D,0x1F6B,0x0000,0x1FAB, + 0x1FD9,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF41,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF42,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF43,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF44,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF45,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF46,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0430,0x0444,0x0458,0x0479,0x04A7,0x04CE,0x04F5,0x0000, + 0x0574,0x2170,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF47,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0180,0x01B4,0x01DF,0x0209,0x0231,0x0000,0x025D, + 0x0271,0x0285,0x0299,0x02AD,0x1E01,0x1E29,0x1E51,0x1E79, + 0x1E9B,0x1EBF,0x1EE7,0x1F00,0x1F22,0x0000,0x1F64,0x1F80, + 0x1FA4,0x1FD2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0431,0x0445,0x0459,0x047B,0x04A9,0x0000,0x04F7,0x0561, + 0x0575,0x2171,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF48,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0183,0x01B6,0x01E1,0x020B,0x0233,0x0000,0x025E, + 0x0272,0x0286,0x029A,0x02AE,0x1E03,0x1E2B,0x1E53,0x1E7B, + 0x0000,0x1EC1,0x1EE9,0x1F01,0x1F23,0x0000,0x1F65,0x1F81, + 0x1FA5,0x1FD3,0x1FF6,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0432,0x0446,0x045A,0x047D,0x04AB,0x04D1,0x04F9,0x0562, + 0x0576,0x2172,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF49,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0185,0x01B9,0x01E3,0x020D,0x0234,0x0000,0x025F, + 0x0273,0x0287,0x029B,0x02AF,0x1E05,0x1E2D,0x1E55,0x1E7D, + 0x0000,0x1EC3,0x1EEB,0x1F02,0x1F24,0x0000,0x1F66,0x1F82, + 0x1FA6,0x0000,0x1FF7,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0433,0x0447,0x045B,0x047F,0x04AD,0x04D3,0x0000,0x0563, + 0x0577,0x2173,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0188,0x01BA,0x01E5,0x020F,0x0235,0x0000,0x0260, + 0x0274,0x0288,0x029C,0x0000,0x1E07,0x1E2F,0x1E57,0x1E7F, + 0x0000,0x1EC5,0x1EED,0x1F03,0x1F25,0x0000,0x1F67,0x1F83, + 0x1FA7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0434,0x0448,0x045C,0x0481,0x04AF,0x04D5,0x0000,0x0564, + 0x0578,0x2174,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x018C,0x01BB,0x01E7,0x0211,0x0236,0x0000,0x0261, + 0x0275,0x0289,0x029D,0x0000,0x1E09,0x1E31,0x1E59,0x1E81, + 0x0000,0x1EC7,0x1EEF,0x1F04,0x1F26,0x1F50,0x1F70,0x1F84, + 0x1FB0,0x1FD6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0435,0x0449,0x045D,0x0000,0x04B1,0x04D7,0x0000,0x0565, + 0x0579,0x2175,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x018D,0x0000,0x01E9,0x0213,0x0237,0x0000,0x0262, + 0x0276,0x028A,0x029E,0x0000,0x1E0B,0x1E33,0x1E5B,0x1E83, + 0x1EA1,0x1EC9,0x1EF1,0x1F05,0x1F27,0x1F51,0x1F71,0x1F85, + 0x1FB1,0x1FD7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0436,0x044A,0x045E,0x048B,0x04B3,0x04D9,0x0000,0x0566, + 0x057A,0x2176,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0192,0x01BE,0x01EB,0x0215,0x0238,0x0000,0x0263, + 0x0277,0x028B,0x029F,0x0000,0x1E0D,0x1E35,0x1E5D,0x1E85, + 0x1EA3,0x1ECB,0x1EF3,0x1F06,0x1F30,0x1F52,0x1F72,0x1F86, + 0x1FB2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0437,0x044B,0x045F,0x048D,0x04B5,0x04DB,0x0000,0x0567, + 0x057B,0x2177,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0195,0x01BD,0x01ED,0x0217,0x0239,0x0250,0x0264, + 0x0278,0x028C,0x02A0,0x0000,0x1E0F,0x1E37,0x1E5F,0x1E87, + 0x1EA5,0x1ECD,0x1EF5,0x1F07,0x1F31,0x1F53,0x1F73,0x1F87, + 0x1FB3,0x1FE0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0438,0x044C,0x0461,0x048F,0x04B7,0x04DD,0x0000,0x0568, + 0x057C,0x2178,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF4F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0199,0x01C6,0x01EF,0x0219,0x0000,0x0251,0x0265, + 0x0279,0x028D,0x02A1,0x0000,0x1E11,0x1E39,0x1E61,0x1E89, + 0x1EA7,0x1ECF,0x1EF7,0x1F10,0x1F32,0x1F54,0x1F74,0x1F90, + 0x1FB4,0x1FE1,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0439,0x044D,0x0463,0x0491,0x04B9,0x04DF,0x0501,0x0569, + 0x057D,0x2179,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF50,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x019A,0x01C9,0x01F0,0x021B,0x023C,0x0252,0x0266, + 0x027A,0x028E,0x02A2,0x0000,0x1E13,0x1E3B,0x1E63,0x1E8B, + 0x1EA9,0x1ED1,0x1EF9,0x1F11,0x1F33,0x1F55,0x1F75,0x1F91, + 0x0000,0x1FE2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043A,0x044E,0x0465,0x0493,0x04BB,0x04E1,0x0503,0x056A, + 0x057E,0x217A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF51,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x019B,0x01CC,0x01F3,0x021D,0x0000,0x0253,0x0267, + 0x027B,0x028F,0x02A3,0x0000,0x1E15,0x1E3D,0x1E65,0x1E8D, + 0x1EAB,0x1ED3,0x0000,0x1F12,0x1F34,0x1F56,0x1F76,0x1F92, + 0x1FB6,0x1FE3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043B,0x044F,0x0467,0x0495,0x04BD,0x04E3,0x0505,0x056B, + 0x057F,0x217B,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF52,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x019E,0x01CE,0x01F5,0x021F,0x023F,0x0254,0x0268, + 0x027C,0x0290,0x02A4,0x0000,0x1E17,0x1E3F,0x1E67,0x1E8F, + 0x1EAD,0x1ED5,0x0000,0x1F13,0x1F35,0x1F57,0x1F77,0x1F93, + 0x1FB7,0x1FE4,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043C,0x0450,0x0469,0x0497,0x04BF,0x04E5,0x0507,0x056C, + 0x0580,0x217C,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF53,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A1,0x01D0,0x01F9,0x0221,0x0240,0x0255,0x0269, + 0x027D,0x0291,0x02A5,0x0000,0x1E19,0x1E41,0x1E69,0x1E91, + 0x1EAF,0x1ED7,0x0000,0x1F14,0x1F36,0x0000,0x1F78,0x1F94, + 0x1FC2,0x1FE5,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043D,0x0451,0x046B,0x0499,0x0000,0x04E7,0x0509,0x056D, + 0x0581,0x217D,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF54,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A3,0x01D2,0x01FB,0x0223,0x0000,0x0256,0x026A, + 0x027E,0x0292,0x02A6,0x0000,0x1E1B,0x1E43,0x1E6B,0x1E93, + 0x1EB1,0x1ED9,0x0000,0x1F15,0x1F37,0x0000,0x1F79,0x1F95, + 0x1FC3,0x1FE6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043E,0x0452,0x046D,0x049B,0x04C2,0x04E9,0x050B,0x056E, + 0x0582,0x217E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF55,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A5,0x01D4,0x01FD,0x0225,0x0000,0x0257,0x026B, + 0x027F,0x0293,0x02A7,0x0000,0x1E1D,0x1E45,0x1E6D,0x1E95, + 0x1EB3,0x1EDB,0x0000,0x0000,0x1F40,0x0000,0x1F7A,0x1F96, + 0x1FC4,0x1FE7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x043F,0x0453,0x046F,0x049D,0x04C4,0x04EB,0x050D,0x056F, + 0x0583,0x217F,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF56,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01A8,0x01D6,0x01FF,0x0227,0x0000,0x0258,0x026C, + 0x0280,0x0294,0x02A8,0x0000,0x1E1F,0x1E47,0x1E6F,0x1E96, + 0x1EB5,0x1EDD,0x0000,0x0000,0x1F41,0x0000,0x1F7B,0x1F97, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0440,0x0454,0x0471,0x049F,0x04C6,0x04ED,0x050F,0x0570, + 0x0584,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF57,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AA,0x01D8,0x0201,0x0229,0x0000,0x0259,0x026D, + 0x0281,0x0295,0x02A9,0x0000,0x1E21,0x1E49,0x1E71,0x1E97, + 0x1EB7,0x1EDF,0x0000,0x0000,0x1F42,0x1F60,0x1F7C,0x1FA0, + 0x1FC6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0441,0x0455,0x0473,0x04A1,0x04C8,0x04EF,0x0000,0x0571, + 0x0585,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF58,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AB,0x01DA,0x0203,0x022B,0x0000,0x025A,0x026E, + 0x0282,0x0296,0x02AA,0x0000,0x1E23,0x1E4B,0x1E73,0x1E98, + 0x1EB9,0x1EE1,0x0000,0x0000,0x1F43,0x1F61,0x1F7D,0x1FA1, + 0x1FC7,0x1FF2,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0442,0x0456,0x0475,0x04A3,0x04CA,0x04F1,0x0000,0x0572, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF59,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01AD,0x01DC,0x0205,0x022D,0x0000,0x025B,0x026F, + 0x0283,0x0297,0x02AB,0x0000,0x1E25,0x1E4D,0x1E75,0x1E99, + 0x1EBB,0x1EE3,0x0000,0x1F20,0x1F44,0x1F62,0x0000,0x1FA2, + 0x1FD0,0x1FF3,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0443,0x0457,0x0477,0x04A5,0x04CC,0x04F3,0x0000,0x0573, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0xFF5A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x01B0,0x01DD,0x0207,0x022F,0x0000,0x025C,0x0270, + 0x0284,0x0298,0x02AC,0x0000,0x1E27,0x1E4F,0x1E77,0x1E9A, + 0x1EBD,0x1EE5,0x0000,0x1F21,0x1F45,0x1F63,0x0000,0x1FA3, + 0x1FD1,0x1FF4 +}; + + +/* 00C0-05FF */ +static uint16 uni_0C00_05FF[1344]= +{ + 0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E, + 0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026, + 0x0027,0x0028,0x0029,0x002A,0x0067,0x0068,0x0069,0x0000, + 0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x008A, + 0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E, + 0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046, + 0x0047,0x0048,0x0049,0x004A,0x0087,0x0088,0x0089,0x0000, + 0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092, + 0x0073,0x0093,0x0074,0x0094,0x0075,0x0095,0x0076,0x0096, + 0x0077,0x0097,0x0078,0x0098,0x0079,0x0099,0x007A,0x009A, + 0x00B7,0x00D7,0x00B8,0x00D8,0x00B9,0x00D9,0x00BA,0x00DA, + 0x00BB,0x00DB,0x00BC,0x00DC,0x00BD,0x00DD,0x00BE,0x00DE, + 0x00BF,0x00DF,0x00C0,0x00E0,0x00C1,0x00E1,0x00C2,0x00E2, + 0x00C3,0x00E3,0x00C4,0x00E4,0x00C5,0x00E5,0x00C6,0x00E6, + 0x0000,0x00E7,0x00C8,0x00E8,0x00C9,0x00E9,0x00CA,0x00EA, + 0x0127,0x0108,0x0128,0x0109,0x0129,0x010A,0x012A,0x010B, + 0x012B,0x010C,0x012C,0x010D,0x012D,0x010E,0x012E,0x010F, + 0x012F,0x0130,0x0111,0x0131,0x0112,0x0132,0x0113,0x0133, + 0x0114,0x0134,0x0115,0x0135,0x0116,0x0136,0x0117,0x0137, + 0x0118,0x0138,0x0119,0x0139,0x011A,0x013A,0x0157,0x0177, + 0x0158,0x0178,0x0159,0x0179,0x015A,0x017A,0x015B,0x017B, + 0x015C,0x017C,0x015D,0x017D,0x015E,0x017E,0x015F,0x017F, + 0x0160,0x0180,0x0161,0x0181,0x0162,0x0182,0x0163,0x0183, + 0x0072,0x0164,0x0184,0x0165,0x0185,0x0166,0x0186,0x0187, + 0x1161,0x0A86,0x07B1,0x11B1,0x0801,0x1201,0x0AD6,0x0851, + 0x1251,0x0B76,0x0BC6,0x08A1,0x12A1,0x12F1,0x0D52,0x0C66, + 0x0D06,0x0941,0x1341,0x0857,0x0947,0x1391,0x0B27,0x0AD7, + 0x09E1,0x13E1,0x1431,0x1481,0x0D07,0x07B8,0x14D1,0x08A8, + 0x0B21,0x1521,0x0B71,0x1571,0x0BC1,0x15C1,0x0C18,0x0C11, + 0x1611,0x0D08,0x1661,0x16B1,0x0D01,0x1701,0x0859,0x0D51, + 0x1751,0x08F9,0x0949,0x0762,0x1162,0x07B2,0x11B2,0x0B79, + 0x0802,0x1202,0x1252,0x12A2,0x0992,0x1392,0x1342,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x09E2,0x0000,0x13E2,0x0A32, + 0x0000,0x1432,0x0A82,0x0000,0x1482,0x0AD2,0x14D2,0x0B22, + 0x1522,0x0B72,0x1572,0x0BC2,0x15C2,0x0C12,0x1612,0x0C62, + 0x1662,0x0CB2,0x16B2,0x0D02,0x1702,0x1752,0x0763,0x1163, + 0x07B3,0x11B3,0x0803,0x1203,0x0853,0x1253,0x08A3,0x12A3, + 0x08F3,0x12F3,0x0943,0x1343,0x0993,0x1393,0x09E3,0x13E3, + 0x1433,0x0A83,0x0000,0x1483,0x0AD3,0x14D3,0x0991,0x0000, + 0x0B23,0x1523,0x0B73,0x1573,0x0BC3,0x15C3,0x0C13,0x1613, + 0x0C63,0x1663,0x0CB3,0x16B3,0x0D03,0x1703,0x0D53,0x1753, + 0x0764,0x1164,0x07B4,0x11B4,0x0804,0x1204,0x0854,0x1254, + 0x08A4,0x12A4,0x08F4,0x12F4,0x0944,0x1344,0x0994,0x1394, + 0x09E4,0x13E4,0x0A34,0x1434,0x0A84,0x1484,0x0AD4,0x14D4, + 0x0AD1,0x1524,0x0B74,0x1574,0x0BC4,0x15C4,0x0C14,0x1614, + 0x0C64,0x1664,0x0CB4,0x16B4,0x0D04,0x1704,0x0D54,0x1754, + 0x0765,0x1165,0x07B5,0x11B5,0x1205,0x1255,0x12A5,0x12F5, + 0x1345,0x1395,0x09E5,0x0A35,0x1435,0x0A31,0x0A85,0x14D5, + 0x1525,0x0C19,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x1396,0x13E6,0x1436,0x1486,0x14D6,0x1526,0x1576,0x15C6, + 0x1616,0x1666,0x16B6,0x1706,0x1756,0x1167,0x11B7,0x1207, + 0x1257,0x12A7,0x12F7,0x1347,0x1397,0x13E7,0x1437,0x1487, + 0x14D7,0x1527,0x1577,0x15C7,0x1617,0x1667,0x16B7,0x1707, + 0x1757,0x1168,0x11B8,0x1208,0x1258,0x12A8,0x12F8,0x1348, + 0x1398,0x13E8,0x1438,0x1488,0x14D8,0x1528,0x1578,0x15C8, + 0x1618,0x1668,0x16B8,0x1708,0x1758,0x1169,0x11B9,0x1209, + 0x1259,0x12A9,0x12F9,0x1349,0x1399,0x13E9,0x1439,0x1489, + 0x14D9,0x1529,0x1579,0x15C9,0x1619,0x1669,0x16B9,0x1709, + 0x1759,0x116A,0x11BA,0x120A,0x125A,0x12AA,0x12FA,0x134A, + 0x139A,0x13EA,0x143A,0x148A,0x14DA,0x152A,0x157A,0x15CA, + 0x161A,0x166A,0x16BA,0x170A,0x175A,0x116B,0x11BB,0x120B, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01F7,0x0000, + 0x01F8,0x01F9,0x01FA,0x0000,0x0253,0x0000,0x0254,0x0255, + 0x01D9,0x01FC,0x0257,0x01FE,0x01FF,0x0200,0x0201,0x0202, + 0x0258,0x0204,0x02A7,0x0206,0x0207,0x0208,0x0209,0x020A, + 0x0299,0x0248,0x0000,0x02A9,0x024B,0x024C,0x0298,0x024E, + 0x024F,0x0250,0x0251,0x0252,0x0217,0x0218,0x0219,0x021A, + 0x021B,0x021C,0x021D,0x021E,0x021F,0x0220,0x0221,0x0222, + 0x0223,0x0224,0x0225,0x0226,0x0227,0x0228,0x0229,0x022A, + 0x0267,0x0268,0x0269,0x026A,0x026B,0x026C,0x026D,0x026E, + 0x026F,0x0270,0x0271,0x0272,0x0273,0x0274,0x0275,0x0000, + 0x0277,0x0278,0x0259,0x025A,0x0297,0x02B8,0x02B9,0x02BA, + 0x0000,0x02BB,0x029C,0x02BC,0x029D,0x02BD,0x029E,0x02BE, + 0x029F,0x02BF,0x02A0,0x02C0,0x02A1,0x02C1,0x02A2,0x02C2, + 0x02A3,0x02C3,0x02A4,0x02C4,0x02A5,0x02C5,0x02A6,0x02C6, + 0x02C7,0x02C8,0x02C9,0x02CA,0x0000,0x0307,0x0308,0x0000, + 0x0309,0x0000,0x0000,0x030A,0x030B,0x02EC,0x02ED,0x02EE, + 0x0AF1,0x0B41,0x0B91,0x0BE1,0x0C31,0x0C81,0x0CD1,0x0D21, + 0x0732,0x0782,0x07D2,0x0822,0x0872,0x08C2,0x0912,0x0962, + 0x0730,0x0780,0x07D0,0x0820,0x0870,0x08C0,0x0910,0x0960, + 0x09B0,0x0A00,0x0A50,0x0AA0,0x0AF0,0x0B40,0x0B90,0x0BE0, + 0x0C30,0x0C80,0x0CD0,0x0D20,0x0731,0x0781,0x07D1,0x0821, + 0x0871,0x08C1,0x0911,0x0961,0x09B1,0x0A01,0x0A51,0x0AA1, + 0x1130,0x1180,0x11D0,0x1220,0x1270,0x12C0,0x1310,0x1360, + 0x13B0,0x1400,0x1450,0x14A0,0x14F0,0x1540,0x1590,0x15E0, + 0x1630,0x1680,0x16D0,0x1720,0x1131,0x1181,0x11D1,0x1221, + 0x1271,0x12C1,0x1311,0x1361,0x13B1,0x1401,0x1451,0x14A1, + 0x14F1,0x1541,0x1591,0x15E1,0x1631,0x1681,0x16D1,0x1721, + 0x1132,0x1182,0x11D2,0x1222,0x1272,0x12C2,0x1312,0x1362, + 0x09B2,0x13B2,0x0A02,0x1402,0x0A52,0x1452,0x0AA2,0x14A2, + 0x0AF2,0x14F2,0x0B42,0x1542,0x0B92,0x1592,0x0BE2,0x15E2, + 0x0C32,0x1632,0x0C82,0x1682,0x0CD2,0x16D2,0x0D22,0x1722, + 0x0733,0x1133,0x0783,0x1183,0x07D3,0x11D3,0x0823,0x1223, + 0x0873,0x1273,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0913,0x1313,0x0963,0x1363,0x09B3,0x13B3, + 0x0A03,0x1403,0x0A53,0x1453,0x0AA3,0x14A3,0x0AF3,0x14F3, + 0x0B43,0x1543,0x0B93,0x1593,0x0BE3,0x15E3,0x0C33,0x1633, + 0x0C83,0x1683,0x0CD3,0x16D3,0x0D23,0x1723,0x0734,0x1134, + 0x0784,0x1184,0x07D4,0x11D4,0x0824,0x1224,0x0874,0x1274, + 0x08C4,0x12C4,0x0914,0x1314,0x0964,0x1364,0x09B4,0x13B4, + 0x0A04,0x1404,0x0A54,0x1454,0x0AA4,0x14A4,0x0AF4,0x14F4, + 0x0B44,0x0B94,0x1594,0x0BE4,0x15E4,0x0C34,0x1634,0x0C84, + 0x1684,0x0CD4,0x16D4,0x0D24,0x1724,0x0735,0x1135,0x0000, + 0x07D5,0x11D5,0x0825,0x1225,0x0875,0x1275,0x08C5,0x12C5, + 0x0915,0x1315,0x0965,0x1365,0x09B5,0x13B5,0x0A05,0x1405, + 0x0A55,0x1455,0x0AA5,0x14A5,0x0AF5,0x14F5,0x0B45,0x1545, + 0x0B95,0x1595,0x0BE5,0x15E5,0x0C35,0x1635,0x0C85,0x1685, + 0x0CD5,0x16D5,0x0D25,0x1725,0x0736,0x1136,0x0786,0x1186, + 0x07D6,0x11D6,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0A06,0x1406,0x0A56,0x1456,0x0AA6,0x14A6,0x0AF6,0x14F6, + 0x0B46,0x1546,0x0B96,0x1596,0x0BE6,0x15E6,0x0C36,0x1636, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0787,0x07D7,0x0827,0x0877,0x08C7,0x0917,0x0967, + 0x09B7,0x0A07,0x0A57,0x0AA7,0x0AF7,0x0B47,0x0B97,0x0BE7, + 0x0C37,0x0C87,0x0CD7,0x0D27,0x0738,0x0788,0x07D8,0x0828, + 0x0878,0x08C8,0x0918,0x0968,0x09B8,0x0A08,0x0A58,0x0AA8, + 0x0AF8,0x0B48,0x0B98,0x0BE8,0x0C38,0x0C88,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x1187,0x11D7,0x1227,0x1277,0x12C7,0x1317,0x1367, + 0x13B7,0x1407,0x1457,0x14A7,0x14F7,0x1547,0x1597,0x15E7, + 0x1637,0x1687,0x16D7,0x1727,0x1138,0x1188,0x11D8,0x1228, + 0x1278,0x12C8,0x1318,0x1368,0x13B8,0x1408,0x1458,0x14A8, + 0x14F8,0x1548,0x1598,0x15E8,0x1638,0x1688,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + + +/* 1E00-1FFF */ +static uint16 uni_1E00_1FFF[512]= +{ + 0x076C,0x116C,0x07BC,0x11BC,0x080C,0x120C,0x085C,0x125C, + 0x08AC,0x12AC,0x08FC,0x12FC,0x094C,0x134C,0x099C,0x139C, + 0x09EC,0x13EC,0x0A3C,0x143C,0x0A8C,0x148C,0x0ADC,0x14DC, + 0x0B2C,0x152C,0x0B7C,0x157C,0x0BCC,0x15CC,0x0C1C,0x161C, + 0x0C6C,0x166C,0x0CBC,0x16BC,0x0D0C,0x170C,0x0D5C,0x175C, + 0x076D,0x116D,0x07BD,0x11BD,0x080D,0x120D,0x085D,0x125D, + 0x08AD,0x12AD,0x08FD,0x12FD,0x094D,0x134D,0x099D,0x139D, + 0x09ED,0x13ED,0x0A3D,0x143D,0x0A8D,0x148D,0x0ADD,0x14DD, + 0x0B2D,0x152D,0x0B7D,0x157D,0x0BCD,0x15CD,0x0C1D,0x161D, + 0x0C6D,0x166D,0x0CBD,0x16BD,0x0D0D,0x170D,0x0D5D,0x175D, + 0x076E,0x116E,0x07BE,0x11BE,0x080E,0x120E,0x085E,0x125E, + 0x08AE,0x12AE,0x08FE,0x12FE,0x094E,0x134E,0x099E,0x139E, + 0x0770,0x13EE,0x0A3E,0x143E,0x0A8E,0x148E,0x0ADE,0x14DE, + 0x0B2E,0x152E,0x0B7E,0x157E,0x0BCE,0x15CE,0x0C1E,0x161E, + 0x0C6E,0x166E,0x0CBE,0x16BE,0x0D0E,0x170E,0x0D5E,0x175E, + 0x076F,0x116F,0x07BF,0x11BF,0x080F,0x120F,0x085F,0x125F, + 0x08AF,0x12AF,0x08FF,0x12FF,0x094F,0x134F,0x099F,0x139F, + 0x09EF,0x13EF,0x0A3F,0x143F,0x0A8F,0x148F,0x0ADF,0x14DF, + 0x0B2F,0x152F,0x0B7F,0x157F,0x0BCF,0x15CF,0x161F,0x166F, + 0x16BF,0x170F,0x175F,0x1170,0x0000,0x0000,0x0000,0x0000, + 0x0900,0x1300,0x0950,0x1350,0x09A0,0x13A0,0x09F0,0x13F0, + 0x0A40,0x1440,0x0A90,0x1490,0x0AE0,0x14E0,0x0B30,0x1530, + 0x0B80,0x1580,0x0BD0,0x15D0,0x0C20,0x1620,0x0C70,0x1670, + 0x0CC0,0x16C0,0x0D10,0x1710,0x0D60,0x1760,0x0771,0x1171, + 0x07C1,0x11C1,0x0811,0x1211,0x0861,0x1261,0x08B1,0x12B1, + 0x0901,0x1301,0x0951,0x1351,0x09A1,0x13A1,0x09F1,0x13F1, + 0x0A41,0x1441,0x0A91,0x1491,0x0AE1,0x14E1,0x0B31,0x1531, + 0x0B81,0x1581,0x0BD1,0x15D1,0x0C21,0x1621,0x0C71,0x1671, + 0x0CC1,0x16C1,0x0D11,0x1711,0x0D61,0x1761,0x0772,0x1172, + 0x07C2,0x11C2,0x0812,0x1212,0x0862,0x1262,0x08B2,0x12B2, + 0x0902,0x1302,0x0952,0x1352,0x09A2,0x13A2,0x09F2,0x13F2, + 0x0A42,0x1442,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x1173,0x11C3,0x1213,0x1263,0x12B3,0x1303,0x1353,0x13A3, + 0x0773,0x07C3,0x0813,0x0863,0x08B3,0x0903,0x0953,0x09A3, + 0x13F3,0x1443,0x1493,0x14E3,0x1533,0x1583,0x0000,0x0000, + 0x09F3,0x0A43,0x0A93,0x0AE3,0x0B33,0x0B83,0x0000,0x0000, + 0x1713,0x1763,0x1174,0x11C4,0x1214,0x1264,0x12B4,0x1304, + 0x0D13,0x0D63,0x0774,0x07C4,0x0814,0x0864,0x08B4,0x0904, + 0x1354,0x13A4,0x13F4,0x1444,0x1494,0x14E4,0x1534,0x1584, + 0x0954,0x09A4,0x09F4,0x0A44,0x0A94,0x0AE4,0x0B34,0x0B84, + 0x15D4,0x1624,0x1674,0x16C4,0x1714,0x1764,0x0000,0x0000, + 0x0BD4,0x0C24,0x0C74,0x0CC4,0x0D14,0x0D64,0x0000,0x0000, + 0x12B5,0x1305,0x1355,0x13A5,0x13F5,0x1445,0x1495,0x14E5, + 0x0000,0x0905,0x0000,0x09A5,0x0000,0x0A45,0x0000,0x0AE5, + 0x1675,0x16C5,0x1715,0x1765,0x1176,0x11C6,0x1216,0x1266, + 0x0C75,0x0CC5,0x0D15,0x0D65,0x0776,0x07C6,0x0816,0x0866, + 0x12B6,0x1306,0x1356,0x13A6,0x13F6,0x1446,0x1496,0x14E6, + 0x1536,0x1586,0x15D6,0x1626,0x1676,0x16C6,0x0000,0x0000, + 0x1177,0x11C7,0x1217,0x1267,0x12B7,0x1307,0x1357,0x13A7, + 0x0777,0x07C7,0x0817,0x0867,0x08B7,0x0907,0x0957,0x09A7, + 0x13F7,0x1447,0x1497,0x14E7,0x1537,0x1587,0x15D7,0x1627, + 0x09F7,0x0A47,0x0A97,0x0AE7,0x0B37,0x0B87,0x0BD7,0x0C27, + 0x1677,0x16C7,0x1717,0x1767,0x1178,0x11C8,0x1218,0x1268, + 0x0C77,0x0CC7,0x0D17,0x0D67,0x0778,0x07C8,0x0818,0x0868, + 0x12B8,0x1308,0x1358,0x13A8,0x13F8,0x0000,0x1498,0x14E8, + 0x08B8,0x0908,0x08B6,0x0906,0x09A8,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x1538,0x1588,0x15D8,0x0000,0x1678,0x16C8, + 0x0956,0x09A6,0x09F6,0x0A46,0x0B88,0x0000,0x0000,0x0000, + 0x1718,0x1768,0x1179,0x11C9,0x0000,0x0000,0x12B9,0x1309, + 0x0D18,0x0D68,0x0A96,0x0AE6,0x0000,0x0000,0x0000,0x0000, + 0x13A9,0x13F9,0x1449,0x1499,0x14E9,0x1539,0x1589,0x15D9, + 0x09A9,0x09F9,0x0BD6,0x0C26,0x0B39,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x16C9,0x1719,0x0000,0x0000,0x11CA,0x121A, + 0x0B36,0x0B86,0x0C76,0x0CC6,0x0D19,0x0000,0x0000,0x0000 +}; + + +/* 2160-217F */ +static uint16 uni_2160_217F[32]= +{ + 0x0739,0x0789,0x07D9,0x0829,0x0879,0x08C9,0x0919,0x0969, + 0x09B9,0x0A09,0x0A59,0x0AA9,0x0AF9,0x0B49,0x0B99,0x0BE9, + 0x1139,0x1189,0x11D9,0x1229,0x1279,0x12C9,0x1319,0x1369, + 0x13B9,0x1409,0x1459,0x14A9,0x14F9,0x1549,0x1599,0x15E9 +}; + + +/* 24B0-24EF */ +static uint16 uni_24B0_24EF[64]= +{ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0511,0x0512, + 0x0513,0x0514,0x0515,0x0516,0x0517,0x0518,0x0519,0x051A, + 0x051B,0x051C,0x051D,0x051E,0x051F,0x0520,0x0521,0x0522, + 0x0523,0x0524,0x0525,0x0526,0x0527,0x0528,0x0529,0x052A, + 0x0531,0x0532,0x0533,0x0534,0x0535,0x0536,0x0537,0x0538, + 0x0539,0x053A,0x053B,0x053C,0x053D,0x053E,0x053F,0x0540, + 0x0541,0x0542,0x0543,0x0544,0x0545,0x0546,0x0547,0x0548, + 0x0549,0x054A,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + + +/* FF20-FF5F */ +static uint16 uni_FF20_FF5F[64]= +{ + 0x0000,0x0560,0x05B0,0x0600,0x0650,0x06A0,0x06F0,0x0740, + 0x0790,0x07E0,0x0830,0x0880,0x08D0,0x0920,0x0970,0x09C0, + 0x0A10,0x0A60,0x0AB0,0x0B00,0x0B50,0x0BA0,0x0BF0,0x0C40, + 0x0C90,0x0CE0,0x0D30,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0F60,0x0FB0,0x1000,0x1050,0x10A0,0x10F0,0x1140, + 0x1190,0x11E0,0x1230,0x1280,0x12D0,0x1320,0x1370,0x13C0, + 0x1410,0x1460,0x14B0,0x1500,0x1550,0x15A0,0x15F0,0x1640, + 0x1690,0x16E0,0x1730,0x0000,0x0000,0x0000,0x0000,0x0000 +}; + + + + + +/* + Returns + a number 0..15, if a valid HEX digit in lower case, + -1 otherwise. +*/ + +static int hexlo(int x) +{ + static char hex_lo_digit[256]= + { + -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, /* !"#$%&'()*+,-./ */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, /* 0123456789:;<=>? */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* @ABCDEFGHIJKLMNO */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* PQRSTUVWXYZ[\]^_ */ + -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* `abcdefghijklmno */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* pqrstuvwxyz{|}~. */ + -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, /* ................ */ + }; + return hex_lo_digit[(unsigned int) x]; +} + + +/* + Safe characters: + '\0' NULL + A..Z capital letters, + a..z small letters + 0..9 digits + _ underscore +*/ +static char filename_safe_char[128]= +{ + 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* !"#$%&'()*+,-./ */ + 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, /* 0123456789:;<=>? */ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* @ABCDEFGHIJKLMNO */ + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, /* PQRSTUVWXYZ[\]^_ */ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* `abcdefghijklmno */ + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz{|}~. */ +}; + +#define MY_FILENAME_ESCAPE '@' + +static int +my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *pwc, const uchar *s, const uchar *e) +{ + int byte1, byte2; + if (s >= e) + return MY_CS_TOOSMALL; + + if (*s < 128 && filename_safe_char[*s]) + { + *pwc= *s; + return 1; + } + + if (*s != MY_FILENAME_ESCAPE) + return MY_CS_ILSEQ; + + if (s + 3 > e) + return MY_CS_TOOSMALL3; + + byte1= s[1]; + byte2= s[2]; + + if (byte1 >= 0x30 && byte1 <= 0x7F && + byte2 >= 0x30 && byte2 <= 0x7F) + { + int code= (byte1 - 0x30) * 80 + byte2 - 0x30; + if (code < 5994 && touni[code]) + { + *pwc= touni[code]; + return 3; + } + if (byte1 == '@' && byte2 == '@') + { + *pwc= 0; + return 3; + } + } + + if (s + 4 > e) + return MY_CS_TOOSMALL4; + + if ((byte1= hexlo(byte1)) >= 0 && + (byte2= hexlo(byte2)) >= 0) + { + int byte3= hexlo(s[3]); + int byte4= hexlo(s[4]); + if (byte3 >=0 && byte4 >=0) + { + *pwc= (byte1 << 12) + (byte2 << 8) + (byte3 << 4) + byte4; + return 5; + } + } + + return MY_CS_ILSEQ; +} + + +static int +my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, uchar *s, uchar *e) +{ + int code; + char hex[]= "0123456789abcdef"; + if (wc < 128 && filename_safe_char[wc]) + { + *s= (uchar) wc; + return 1; + } + + if (s + 3 > e) + return MY_CS_TOOSMALL3; + + *s++= MY_FILENAME_ESCAPE; + if ((wc >= 0x00C0 && wc <= 0x05FF && (code= uni_0C00_05FF[wc - 0x00C0])) || + (wc >= 0x1E00 && wc <= 0x1FFF && (code= uni_1E00_1FFF[wc - 0x1E00])) || + (wc >= 0x2160 && wc <= 0x217F && (code= uni_2160_217F[wc - 0x2160])) || + (wc >= 0x24B0 && wc <= 0x24EF && (code= uni_24B0_24EF[wc - 0x24B0])) || + (wc >= 0xFF20 && wc <= 0xFF5F && (code= uni_FF20_FF5F[wc - 0xFF20]))) + { + *s++= (code / 80) + 0x30; + *s++= (code % 80) + 0x30; + return 3; + } + + /* Non letter */ + if (s + 5 > e) + return MY_CS_TOOSMALL5; + + *s++= hex[(wc >> 12) & 15]; + *s++= hex[(wc >> 8) & 15]; + *s++= hex[(wc >> 4) & 15]; + *s++= hex[(wc) & 15]; + return 5; +} + + +static MY_COLLATION_HANDLER my_collation_filename_handler = +{ + NULL, /* init */ + my_strnncoll_utf8mb3, + my_strnncollsp_utf8mb3, + my_strnxfrm_unicode, + my_strnxfrmlen_utf8mb3, + my_like_range_mb, + my_wildcmp_utf8mb3, + my_strcasecmp_utf8mb3, + my_instr_mb, + my_hash_sort_utf8mb3, + my_propagate_complex +}; + + +static MY_CHARSET_HANDLER my_charset_filename_handler= +{ + NULL, /* init */ + my_ismbchar_utf8mb3, + my_mbcharlen_utf8mb3, + my_numchars_mb, + my_charpos_mb, + my_well_formed_len_mb, + my_lengthsp_8bit, + my_numcells_mb, + my_mb_wc_filename, + my_wc_mb_filename, + my_mb_ctype_mb, + my_caseup_str_utf8mb3, + my_casedn_str_utf8mb3, + my_caseup_utf8mb3, + my_casedn_utf8mb3, + my_snprintf_8bit, + my_long10_to_str_8bit, + my_longlong10_to_str_8bit, + my_fill_8bit, + my_strntol_8bit, + my_strntoul_8bit, + my_strntoll_8bit, + my_strntoull_8bit, + my_strntod_8bit, + my_strtoll10_8bit, + my_strntoull10rnd_8bit, + my_scan_8bit +}; + + + +CHARSET_INFO my_charset_filename= +{ + 17,0,0, /* number */ + MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM|MY_CS_UNICODE|MY_CS_HIDDEN|MY_CS_NONASCII, + "filename", /* cs name */ + "filename", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_utf8, /* ctype */ + to_lower_utf8, /* to_lower */ + to_upper_utf8, /* to_upper */ + to_upper_utf8, /* sort_order */ + NULL, /* contractions */ + NULL, /* sort_order_big*/ + NULL, /* tab_to_uni */ + NULL, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 1, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 5, /* mbmaxlen */ + 0, /* min_sort_char */ + 0xFFFF, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_compare */ + 1, /* levels_for_order */ + &my_charset_filename_handler, + &my_collation_filename_handler +}; + +#ifdef MY_TEST_UTF8 +#include + +static void test_mb(CHARSET_INFO *cs, uchar *s) +{ + while(*s) + { + if (my_ismbhead_utf8(cs,*s)) + { + uint len=my_mbcharlen_utf8(cs,*s); + while(len--) + { + printf("%c",*s); + s++; + } + printf("\n"); + } + else + { + printf("%c\n",*s); + s++; + } + } +} + +int main() +{ + char str[1024]=" utf8 test проба ПЕРРпо-РУССКĐ"; + CHARSET_INFO *cs; + + test_mb(cs,(uchar*)str); + + printf("orig :'%s'\n",str); + + my_caseup_utf8(cs,str,15); + printf("caseup :'%s'\n",str); + + my_caseup_str_utf8(cs,str); + printf("caseup_str:'%s'\n",str); + + my_casedn_utf8(cs,str,15); + printf("casedn :'%s'\n",str); + + my_casedn_str_utf8(cs,str); + printf("casedn_str:'%s'\n",str); + + return 0; +} + +#endif + +#endif /* HAVE_CHARSET_utf8mb3 */ diff --git a/externals/mysql/strings/ctype-win1250ch.c b/externals/mysql/strings/ctype-win1250ch.c new file mode 100644 index 0000000..f0e4ae7 --- /dev/null +++ b/externals/mysql/strings/ctype-win1250ch.c @@ -0,0 +1,794 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Shared, independent copyright: (C) 2001 Jan Pazdziora. + + Development of this software was supported by Neocortex, s.r.o. + MySQL AB expresses its gratitude to Jan for for giving us this software. + + Bug reports and suggestions are always welcome. + + This file implements the collating sequence for Windows-1250 + character set. It merely extends the binary sorting of US-ASCII + by adding characters with diacritical marks into proper places. + In addition, it sorts 'ch' between 'h' and 'i', and the sorting + is case sensitive, with uppercase being sorted first, in the + second pass. +*/ + +/* + * This comment is parsed by configure to create ctype.c, + * so don't change it unless you know what you are doing. + * + * .configure. strxfrm_multiply_win1250ch=2 + */ + +#include "my_global.h" +#include "m_string.h" +#include "m_ctype.h" + +#ifdef HAVE_CHARSET_cp1250 + + +static uint16 tab_cp1250_uni[256]={ + 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, +0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, +0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, +0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, +0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, +0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, +0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, +0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, +0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, +0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, +0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, +0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, +0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, +0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, +0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, +0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, +0x20AC, 0,0x201A, 0,0x201E,0x2026,0x2020,0x2021, + 0,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179, + 0,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, + 0,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A, +0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7, +0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B, +0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7, +0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C, +0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, +0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, +0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, +0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, +0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, +0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, +0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, +0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 +}; + + +/* 0000-00FD , 254 chars */ +static uchar tab_uni_cp1250_plane00[]={ +0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, +0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, +0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, +0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, +0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, +0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, +0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, +0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0xA0,0x00,0x00,0x00,0xA4,0x00,0xA6,0xA7,0xA8,0xA9,0x00,0xAB,0xAC,0xAD,0xAE,0x00, +0xB0,0xB1,0x00,0x00,0xB4,0xB5,0xB6,0xB7,0xB8,0x00,0x00,0xBB,0x00,0x00,0x00,0x00, +0x00,0xC1,0xC2,0x00,0xC4,0x00,0x00,0xC7,0x00,0xC9,0x00,0xCB,0x00,0xCD,0xCE,0x00, +0x00,0x00,0x00,0xD3,0xD4,0x00,0xD6,0xD7,0x00,0x00,0xDA,0x00,0xDC,0xDD,0x00,0xDF, +0x00,0xE1,0xE2,0x00,0xE4,0x00,0x00,0xE7,0x00,0xE9,0x00,0xEB,0x00,0xED,0xEE,0x00, +0x00,0x00,0x00,0xF3,0xF4,0x00,0xF6,0xF7,0x00,0x00,0xFA,0x00,0xFC,0xFD}; + +/* 0102-017E , 125 chars */ +static uchar tab_uni_cp1250_plane01[]={ +0xC3,0xE3,0xA5,0xB9,0xC6,0xE6,0x00,0x00,0x00,0x00,0xC8,0xE8,0xCF,0xEF,0xD0,0xF0, +0x00,0x00,0x00,0x00,0x00,0x00,0xCA,0xEA,0xCC,0xEC,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC5,0xE5,0x00,0x00,0xBC,0xBE,0x00,0x00,0xA3, +0xB3,0xD1,0xF1,0x00,0x00,0xD2,0xF2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD5,0xF5, +0x00,0x00,0xC0,0xE0,0x00,0x00,0xD8,0xF8,0x8C,0x9C,0x00,0x00,0xAA,0xBA,0x8A,0x9A, +0xDE,0xFE,0x8D,0x9D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD9,0xF9,0xDB,0xFB, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8F,0x9F,0xAF,0xBF,0x8E,0x9E}; + +/* 2013-20AC , 154 chars */ +static uchar tab_uni_cp1250_plane20[]={ +0x96,0x97,0x00,0x00,0x00,0x91,0x92,0x82,0x00,0x93,0x94,0x84,0x00,0x86,0x87,0x95, +0x00,0x00,0x00,0x85,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x89,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x8B,0x9B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80}; + +/* 02C7-02DD , 23 chars */ +static uchar tab_uni_cp1250_plane02[]={ +0xA1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0xA2,0xFF,0x00,0xB2,0x00,0xBD}; + +/* 2122-2122 , 1 chars */ +static uchar tab_uni_cp1250_plane21[]={ +0x99}; + + +static MY_UNI_IDX idx_uni_cp1250[]={ + {0x0000,0x00FD,tab_uni_cp1250_plane00}, + {0x0102,0x017E,tab_uni_cp1250_plane01}, + {0x2013,0x20AC,tab_uni_cp1250_plane20}, + {0x02C7,0x02DD,tab_uni_cp1250_plane02}, + {0x2122,0x2122,tab_uni_cp1250_plane21}, + {0,0,NULL} +}; + + +static uchar NEAR ctype_win1250ch[] = { +0x00, +0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, +0x20, 0x28, 0x28, 0x28, 0x28, 0x28, 0x20, 0x20, +0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, +0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, +0x48, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, +0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, +0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, +0x84, 0x84, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, +0x10, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x10, 0x10, 0x10, 0x10, 0x10, +0x10, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x02, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, +0x02, 0x02, 0x02, 0x10, 0x10, 0x10, 0x10, 0x20, +0x20, 0x20, 0x10, 0x20, 0x10, 0x10, 0x10, 0x10, +0x20, 0x10, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, +0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, +0x20, 0x10, 0x02, 0x10, 0x02, 0x02, 0x02, 0x02, +0x48, 0x10, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, +0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x10, 0x01, +0x10, 0x10, 0x10, 0x02, 0x10, 0x10, 0x10, 0x10, +0x10, 0x02, 0x02, 0x10, 0x01, 0x10, 0x02, 0x02, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x10, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x10 +}; + +static uchar NEAR to_lower_win1250ch[] = { +0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, +0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, +0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, +0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, +0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, +0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, +0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, +0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, +0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, +0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, +0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, +0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, +0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, +0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, +0x88, 0x89, 0x9a, 0x8b, 0x9c, 0x9d, 0x9e, 0x9f, +0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, +0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, +0xa0, 0xa1, 0xa2, 0xb3, 0xa4, 0xb9, 0xa6, 0xdf, +0xa8, 0xa9, 0xba, 0xab, 0xac, 0xad, 0xae, 0xbf, +0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, +0xb8, 0xb9, 0xba, 0xbb, 0xbe, 0xbd, 0xbe, 0xbf, +0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, +0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, +0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, +0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, +0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, +0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, +0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, +0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +static uchar NEAR to_upper_win1250ch[] = { +0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, +0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, +0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, +0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, +0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, +0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, +0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, +0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, +0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, +0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, +0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, +0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, +0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, +0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, +0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, +0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, +0x98, 0x99, 0x8a, 0x9b, 0x8c, 0x8d, 0x8e, 0x8f, +0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, +0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, +0xb0, 0xb1, 0xb2, 0xa3, 0xb4, 0xb5, 0xb6, 0xb7, +0xb8, 0xa5, 0xaa, 0xbb, 0xbc, 0xbd, 0xbc, 0xaf, +0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, +0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, +0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, +0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xa7, +0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, +0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, +0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, +0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff +}; + + + +static uchar NEAR sort_order_win1250ch[] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, +32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, +48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, +64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, +80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, +96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, +112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, +128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, +144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, +160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, +176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, +192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, +208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, +224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, +240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 +}; + +static uchar NEAR _sort_order_win1250ch1[] = { +0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, +0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, +0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, +0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, +/* space ord 32 0x20 */ +0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, +0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, +/* 0 ord 48 0x30 */ +0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, +0x9a, 0x9b, + /* colon ord 58 0x3a */ + 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, +0xa2, + /* A ord 65 0x41 */ + 0xa4, 0xa5, + /* C ord 67 0x43 */ + 0xff, 0xa8, 0xa9, 0xaa, 0xab, +0xac, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, +0xb5, 0xb6, + /* R ord 82 0x52 */ + 0xb7, + /* S ord 83 0x53 */ + 0xb9, 0xbc, 0xbd, 0xbe, 0xbf, +0xc0, 0xc1, 0xc2, + /* [ ord 91 0x5b */ + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, +0xc9, + /* a ord 97 0x61 */ + 0xa4, 0xa5, 0xff, 0xa8, 0xa9, 0xaa, 0xab, +0xac, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, +0xb5, 0xb6, 0xb7, 0xb9, 0xbc, 0xbd, 0xbe, 0xbf, +0xc0, 0xc1, 0xc2, + /* { ord 123 0x7b */ + 0xca, 0xcb, 0xcc, 0xcd, 0x81, +0x81, 0x81, 0xce, 0x81, 0xcf, 0xd0, 0xd1, 0xd2, +0x81, 0xd3, + /* Scaron ord 138 0x8a */ + 0xba, 0xd4, 0xb9, 0xbc, 0xc3, 0xc2, +0x81, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, +0x81, 0xdc, 0xba, 0xdd, 0xb9, 0xbc, 0xc3, 0xc2, +/* nobreakspace ord 160 0xa0 */ +0x82, 0xde, 0xdf, 0xb1, 0xe0, 0xa4, 0xe1, 0xe2, +0xe3, 0xe4, 0xb9, 0xe5, 0xe6, 0xe7, 0xe8, 0xc2, +0xe9, 0xea, 0xeb, 0xb1, 0xed, 0xee, 0x81, 0xef, +/* cedilla ord 183 0xb8 */ +0xf0, 0xa4, 0xb9, 0xf1, 0xb1, 0xf2, 0xb1, 0xc2, +0xb7, 0xa4, 0xa4, 0xa4, 0xa4, 0xb1, 0xa6, 0xa6, +0xa7, 0xa9, 0xa9, 0xa9, 0xa9, 0xae, 0xae, 0xa8, +/* Eth ord 208 0xd0 */ +0xa8, 0xb3, 0xb3, 0xb4, 0xb4, 0xb4, 0xb4, 0xf3, +0xb8, 0xbd, 0xbd, 0xbd, 0xbd, 0xc1, 0xbc, 0xbb, +/* racute ord 224 0xe0 */ +0xb7, 0xa4, 0xa4, 0xa4, 0xa4, 0xb1, 0xa6, 0xa6, +0xa7, 0xa9, 0xa9, 0xa9, 0xa9, 0xae, 0xae, 0xa8, +/* eth ord 240 0xf0 */ +0xa8, 0xb3, 0xb3, 0xb4, 0xb4, 0xb4, 0xb4, 0xf4, +0xb8, 0xbd, 0xbd, 0xbd, 0xbd, 0xc1, 0xbc, 0xf5 +}; + +static uchar NEAR _sort_order_win1250ch2[] = { +0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, +0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, +0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, +0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, +/* space ord 32 0x20 */ +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +/* 0 ord 48 0x30 */ +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, + /* colon ord 58 0x3a */ + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, + /* A ord 65 0x41 */ + 0x01, 0x01, + /* C ord 67 0x43 */ + 0xff, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, + /* R ord 82 0x52 */ + 0x01, + /* S ord 83 0x53 */ + 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, 0x01, 0x01, + /* [ ord 91 0x5b */ + 0x01, 0x01, 0x01, 0x01, 0x01, +0x01, + /* a ord 97 0x61 */ + 0x02, 0x02, 0xff, 0x02, 0x02, 0x02, 0x02, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, +0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, +0x02, 0x02, 0x02, + /* { ord 123 0x7b */ + 0x01, 0x01, 0x01, 0x01, 0x22, +0x23, 0x24, 0x01, 0x25, 0x01, 0x01, 0x01, 0x01, +0x26, 0x01, + /* Scaron ord 138 0x8a */ + 0x01, 0x01, 0x03, 0x03, 0x01, 0x05, +0x27, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, +0x28, 0x01, 0x02, 0x01, 0x04, 0x04, 0x02, 0x06, +/* nobreakspace ord 160 0xa0 */ +0x02, 0x01, 0x01, 0x07, 0x01, 0x11, 0x01, 0x01, +0x01, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x03, +0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x29, 0x01, +/* cedilla ord 184 0xb8 */ +0x01, 0x12, 0x06, 0x01, 0x05, 0x01, 0x06, 0x04, +0x03, 0x03, 0x05, 0x07, 0x09, 0x03, 0x03, 0x05, +0x01, 0x03, 0x09, 0x07, 0x05, 0x03, 0x05, 0x03, +/* Eth ord 208 0xd0 */ +0x05, 0x03, 0x05, 0x03, 0x05, 0x09, 0x07, 0x01, +0x01, 0x05, 0x03, 0x09, 0x07, 0x03, 0x05, 0x01, +/* racute ord 224 0xe0 */ +0x04, 0x04, 0x06, 0x08, 0x0a, 0x04, 0x04, 0x06, +0x02, 0x04, 0x0a, 0x08, 0x06, 0x04, 0x06, 0x04, +/* eth ord 240 0xf0 */ +0x06, 0x04, 0x06, 0x04, 0x06, 0x0a, 0x08, 0x01, +0x02, 0x06, 0x04, 0x0a, 0x08, 0x04, 0x06, 0x01 +}; + +struct wordvalue +{ + const uchar * word; + uchar pass1; + uchar pass2; +}; + +static struct wordvalue doubles[]= +{ + { (uchar*) "ch", 0xad, 0x03 }, + { (uchar*) "c", 0xa6, 0x02 }, + { (uchar*) "Ch", 0xad, 0x02 }, + { (uchar*) "CH", 0xad, 0x01 }, + { (uchar*) "C", 0xa6, 0x01 }, +}; + +/* + ml - a flag indicating whether automatically + switch to the secondary level, + or stop on the primary level +*/ + +#define NEXT_CMP_VALUE(src, p, pass, value, len, ml) \ + while (1) \ + { \ + if (IS_END(p, src, len)) \ + { \ + if (pass == 0 && ml && len > 0) \ + { \ + p= src; \ + pass++; \ + } \ + else \ + { \ + value= 0; \ + break; \ + } \ + } \ + value= (pass == 0) ? \ + _sort_order_win1250ch1[*p] : \ + _sort_order_win1250ch2[*p]; \ + if (value == 0xff) \ + { \ + int i; \ + for (i= 0; i < (int) array_elements(doubles); i++) \ + { \ + const uchar *patt= doubles[i].word; \ + const uchar *q= (const uchar *) p; \ + while (*patt && \ + !IS_END(q, src, len) && \ + (*patt == *q)) \ + { \ + patt++; \ + q++; \ + } \ + if (!(*patt)) \ + { \ + value= (int) ((pass == 0) ? \ + doubles[i].pass1 : \ + doubles[i].pass2); \ + p= (const uchar *) q - 1; \ + break; \ + } \ + } \ + } \ + p++; \ + break; \ + } + +#define IS_END(p, src, len) (((char *)p - (char *)src) >= (len)) + +static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), + const uchar *s1, size_t len1, + const uchar *s2, size_t len2, + my_bool s2_is_prefix) +{ + int v1, v2; + const uchar *p1, * p2; + int pass1 = 0, pass2 = 0; + int diff; + + if (s2_is_prefix && len1 > len2) + len1=len2; + + p1 = s1; p2 = s2; + + do + { + NEXT_CMP_VALUE(s1, p1, pass1, v1, (int)len1, 1); + NEXT_CMP_VALUE(s2, p2, pass2, v2, (int)len2, 1); + if ((diff = v1 - v2)) + return diff; + } while (v1); + return 0; +} + + +/* + Compare strings, ignore trailing spaces +*/ + +static int +my_strnncollsp_win1250ch(CHARSET_INFO * cs __attribute__((unused)), + const uchar *s, size_t slen, + const uchar *t, size_t tlen, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) +{ + int level; + + for (level= 0; level <= 3; level++) + { + const uchar *s1= s; + const uchar *t1= t; + + for (;;) + { + int sval, tval, diff; + NEXT_CMP_VALUE(s, s1, level, sval, (int) slen, 0); + NEXT_CMP_VALUE(t, t1, level, tval, (int) tlen, 0); + if (!sval) + { + sval= level ? _sort_order_win1250ch2[32] : _sort_order_win1250ch1[32]; + for (; tval;) + { + if ((diff= sval - tval)) + return diff; + NEXT_CMP_VALUE(t, t1, level, tval, (int) tlen, 0); + } + break; + } + else if (!tval) + { + tval= level ? _sort_order_win1250ch2[32] : _sort_order_win1250ch1[32]; + for (; sval;) + { + if ((diff= sval - tval)) + return diff; + NEXT_CMP_VALUE(s, s1, level, sval, (int) slen, 0); + } + break; + } + + if ((diff= sval - tval)) + return diff; + } + } + return 0; +} + + +static size_t +my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), + uchar *dst, size_t dstlen, uint nweights_arg, + const uchar *src, size_t srclen, uint flags) +{ + uint level; + uchar *dst0= dst; + uchar *de= dst + dstlen; + + if (!(flags & 0x03)) /* All levels by default */ + flags|= 0x03; + + for (level= 0; level <= 1; level++) + { + if (flags & (1 << level)) + { + uint nweights= nweights_arg; + const uchar *p= src; + int value; + uchar *dstl= dst; + + for (; dst < de && nweights; nweights--) + { + NEXT_CMP_VALUE(src, p, level, value, (int) srclen, 0); + if (!value) + break; + *dst++= value; + } + + if (dst < de && nweights && (flags & MY_STRXFRM_PAD_WITH_SPACE)) + { + uint pad_length= de - dst; + set_if_smaller(pad_length, nweights); + /* [82.01] - weights for space character */ + bfill(dst, pad_length, (int) (level ? 0x01 : 0x82)); + dst+= pad_length; + } + my_strxfrm_desc_and_reverse(dstl, dst, flags, level); + } + } + if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && dst < de) + { + uint fill_length= de - dst; + cs->cset->fill(cs, (char*) dst, fill_length, 0); + dst= de; + } + return dst - dst0; +} + +#undef IS_END + + +static uchar NEAR like_range_prefix_min_win1250ch[]= +{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, + 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, + 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, + 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF +}; + +/* + The letter "C" is a special case: + "CH" is sorted between "H" and "I". + prefix_max for "C" is "I": prefix_max[0x43] == 0x49 + prefix_max for "c" is "i": prefix_max[0x63] == 0x69 + For all other characters: prefix_max[i] == i +*/ + +static uchar NEAR like_range_prefix_max_win1250ch[]= +{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x49, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x69, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, + 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, + 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, + 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF +}; + +#define min_sort_char '\x20' +#define max_sort_char '\xff' + +/* +** Calculate min_str and max_str that ranges a LIKE string. +** Arguments: +** ptr Pointer to LIKE string. +** ptr_length Length of LIKE string. +** escape Escape character in LIKE. (Normally '\'). +** All escape characters should be removed from min_str and max_str +** res_length Length of min_str and max_str. +** min_str Smallest case sensitive string that ranges LIKE. +** Should be space padded to res_length. +** max_str Largest case sensitive string that ranges LIKE. +** Normally padded with the biggest character sort value. +** +** The function should return 0 if ok and 1 if the LIKE string can't be +** optimized ! +*/ + +static my_bool +my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), + const char *ptr, size_t ptr_length, + pbool escape, pbool w_one, pbool w_many, + size_t res_length, + char *min_str, char *max_str, + size_t *min_length, size_t *max_length) +{ + + int only_min_found= 1; + const char *end = ptr + ptr_length; + char *min_org = min_str; + char *min_end = min_str + res_length; + + /* return 1; */ + + for (; ptr != end && min_str != min_end ; ptr++) + { + if (*ptr == escape && ptr+1 != end) + ptr++; /* Skip escape */ + else if (*ptr == w_one || *ptr == w_many) /* '_' or '%' in SQL */ + break; + *min_str= like_range_prefix_min_win1250ch[(uint) (uchar) (*ptr)]; + if (*min_str != min_sort_char) + only_min_found= 0; + min_str++; + *max_str++= like_range_prefix_max_win1250ch[(uint) (uchar) (*ptr)]; + } + + if (cs->state & MY_CS_BINSORT) + *min_length= (size_t) (min_str - min_org); + else + { + /* 'a\0\0... is the smallest possible string */ + *min_length= res_length; + } + /* a\ff\ff... is the biggest possible string */ + *max_length= res_length; + + while (min_str != min_end) + { + *min_str++ = min_sort_char; + *max_str++ = max_sort_char; + } + return (only_min_found); +} + + +static MY_COLLATION_HANDLER my_collation_czech_ci_handler = +{ + NULL, /* init */ + my_strnncoll_win1250ch, + my_strnncollsp_win1250ch, + my_strnxfrm_win1250ch, + my_strnxfrmlen_simple, + my_like_range_win1250ch, + my_wildcmp_8bit, + my_strcasecmp_8bit, + my_instr_simple, + my_hash_sort_simple, + my_propagate_simple +}; + + +CHARSET_INFO my_charset_cp1250_czech_ci = +{ + 34,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_CSSORT, /* state */ + "cp1250", /* cs name */ + "cp1250_czech_cs", /* name */ + "", /* comment */ + NULL, /* tailoring */ + ctype_win1250ch, + to_lower_win1250ch, + to_upper_win1250ch, + sort_order_win1250ch, + NULL, /* contractions */ + NULL, /* sort_order_big*/ + tab_cp1250_uni, /* tab_to_uni */ + idx_uni_cp1250, /* tab_from_uni */ + my_unicase_default, /* caseinfo */ + NULL, /* state_map */ + NULL, /* ident_map */ + 2, /* strxfrm_multiply */ + 1, /* caseup_multiply */ + 1, /* casedn_multiply */ + 1, /* mbminlen */ + 1, /* mbmaxlen */ + 0, /* min_sort_char */ + 0, /* max_sort_char */ + ' ', /* pad char */ + 0, /* escape_with_backslash_is_dangerous */ + 2, /* levels_for_compare */ + 2, /* levels_for_order */ + &my_charset_8bit_handler, + &my_collation_czech_ci_handler +}; + + +#endif /* HAVE_CHARSET_cp1250 */ diff --git a/externals/mysql/strings/ctype.c b/externals/mysql/strings/ctype.c new file mode 100644 index 0000000..fe66860 --- /dev/null +++ b/externals/mysql/strings/ctype.c @@ -0,0 +1,430 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#ifndef SCO +#include +#endif + + +/* + + This files implements routines which parse XML based + character set and collation description files. + + Unicode collations are encoded according to + + Unicode Technical Standard #35 + Locale Data Markup Language (LDML) + http://www.unicode.org/reports/tr35/ + + and converted into ICU string according to + + Collation Customization + http://oss.software.ibm.com/icu/userguide/Collate_Customization.html + +*/ + +static char *mstr(char *str,const char *src,uint l1,uint l2) +{ + l1= l1str; s++) + { + if (!strncmp(attr,s->str,len)) + return s; + } + return NULL; +} + +#define MY_CS_CSDESCR_SIZE 64 +#define MY_CS_TAILORING_SIZE 1024 + +typedef struct my_cs_file_info +{ + char csname[MY_CS_NAME_SIZE]; + char name[MY_CS_NAME_SIZE]; + uchar ctype[MY_CS_CTYPE_TABLE_SIZE]; + uchar to_lower[MY_CS_TO_LOWER_TABLE_SIZE]; + uchar to_upper[MY_CS_TO_UPPER_TABLE_SIZE]; + uchar sort_order[MY_CS_SORT_ORDER_TABLE_SIZE]; + uint16 tab_to_uni[MY_CS_TO_UNI_TABLE_SIZE]; + char comment[MY_CS_CSDESCR_SIZE]; + char tailoring[MY_CS_TAILORING_SIZE]; + size_t tailoring_length; + CHARSET_INFO cs; + int (*add_collation)(CHARSET_INFO *cs); +} MY_CHARSET_LOADER; + + + +static int fill_uchar(uchar *a,uint size,const char *str, uint len) +{ + uint i= 0; + const char *s, *b, *e=str+len; + + for (s=str ; s < e ; i++) + { + for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; + b=s; + for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; + if (s == b || i > size) + break; + a[i]= (uchar) strtoul(b,NULL,16); + } + return 0; +} + +static int fill_uint16(uint16 *a,uint size,const char *str, size_t len) +{ + uint i= 0; + + const char *s, *b, *e=str+len; + for (s=str ; s < e ; i++) + { + for ( ; (s < e) && strchr(" \t\r\n",s[0]); s++) ; + b=s; + for ( ; (s < e) && !strchr(" \t\r\n",s[0]); s++) ; + if (s == b || i > size) + break; + a[i]= (uint16) strtol(b,NULL,16); + } + return 0; +} + + +static int cs_enter(MY_XML_PARSER *st,const char *attr, size_t len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); + + if ( s && (s->state == _CS_CHARSET)) + bzero(&i->cs,sizeof(i->cs)); + + if (s && (s->state == _CS_COLLATION)) + i->tailoring_length= 0; + + return MY_XML_OK; +} + + +static int cs_leave(MY_XML_PARSER *st,const char *attr, size_t len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s= cs_file_sec(attr,len); + int state= s ? s->state : 0; + int rc; + + switch(state){ + case _CS_COLLATION: + rc= i->add_collation ? i->add_collation(&i->cs) : MY_XML_OK; + break; + default: + rc=MY_XML_OK; + } + return rc; +} + + +static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len) +{ + struct my_cs_file_info *i= (struct my_cs_file_info *)st->user_data; + struct my_cs_file_section_st *s; + int state= (int)((s=cs_file_sec(st->attr, strlen(st->attr))) ? s->state : + 0); + + switch (state) { + case _CS_ID: + i->cs.number= strtol(attr,(char**)NULL,10); + break; + case _CS_BINARY_ID: + i->cs.binary_number= strtol(attr,(char**)NULL,10); + break; + case _CS_PRIMARY_ID: + i->cs.primary_number= strtol(attr,(char**)NULL,10); + break; + case _CS_COLNAME: + i->cs.name=mstr(i->name,attr,len,MY_CS_NAME_SIZE-1); + break; + case _CS_CSNAME: + i->cs.csname=mstr(i->csname,attr,len,MY_CS_NAME_SIZE-1); + break; + case _CS_CSDESCRIPT: + i->cs.comment=mstr(i->comment,attr,len,MY_CS_CSDESCR_SIZE-1); + break; + case _CS_FLAG: + if (!strncmp("primary",attr,len)) + i->cs.state|= MY_CS_PRIMARY; + else if (!strncmp("binary",attr,len)) + i->cs.state|= MY_CS_BINSORT; + else if (!strncmp("compiled",attr,len)) + i->cs.state|= MY_CS_COMPILED; + break; + case _CS_UPPERMAP: + fill_uchar(i->to_upper,MY_CS_TO_UPPER_TABLE_SIZE,attr,len); + i->cs.to_upper=i->to_upper; + break; + case _CS_LOWERMAP: + fill_uchar(i->to_lower,MY_CS_TO_LOWER_TABLE_SIZE,attr,len); + i->cs.to_lower=i->to_lower; + break; + case _CS_UNIMAP: + fill_uint16(i->tab_to_uni,MY_CS_TO_UNI_TABLE_SIZE,attr,len); + i->cs.tab_to_uni=i->tab_to_uni; + break; + case _CS_COLLMAP: + fill_uchar(i->sort_order,MY_CS_SORT_ORDER_TABLE_SIZE,attr,len); + i->cs.sort_order=i->sort_order; + break; + case _CS_CTYPEMAP: + fill_uchar(i->ctype,MY_CS_CTYPE_TABLE_SIZE,attr,len); + i->cs.ctype=i->ctype; + break; + case _CS_RESET: + case _CS_DIFF1: + case _CS_DIFF2: + case _CS_DIFF3: + case _CS_IDENTICAL: + { + /* + Convert collation description from + Locale Data Markup Language (LDML) + into ICU Collation Customization expression. + */ + char arg[16]; + const char *cmd[]= {"&","<","<<","<<<","="}; + i->cs.tailoring= i->tailoring; + mstr(arg,attr,len,sizeof(arg)-1); + if (i->tailoring_length + 20 < sizeof(i->tailoring)) + { + char *dst= i->tailoring_length + i->tailoring; + i->tailoring_length+= sprintf(dst," %s %s",cmd[state-_CS_RESET],arg); + } + } + } + return MY_XML_OK; +} + + +my_bool my_parse_charset_xml(const char *buf, size_t len, + int (*add_collation)(CHARSET_INFO *cs)) +{ + MY_XML_PARSER p; + struct my_cs_file_info i; + my_bool rc; + + my_xml_parser_create(&p); + my_xml_set_enter_handler(&p,cs_enter); + my_xml_set_value_handler(&p,cs_value); + my_xml_set_leave_handler(&p,cs_leave); + i.add_collation= add_collation; + my_xml_set_user_data(&p,(void*)&i); + rc= (my_xml_parse(&p,buf,len) == MY_XML_OK) ? FALSE : TRUE; + my_xml_parser_free(&p); + return rc; +} + + +/* + Check repertoire: detect pure ascii strings +*/ +uint +my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length) +{ + const char *strend= str + length; + if (cs->mbminlen == 1) + { + for ( ; str < strend; str++) + { + if (((uchar) *str) > 0x7F) + return MY_REPERTOIRE_UNICODE30; + } + } + else + { + my_wc_t wc; + int chlen; + for (; + (chlen= cs->cset->mb_wc(cs, &wc, (uchar*) str, (uchar*) strend)) > 0; + str+= chlen) + { + if (wc > 0x7F) + return MY_REPERTOIRE_UNICODE30; + } + } + return MY_REPERTOIRE_ASCII; +} + + +/* + Returns repertoire for charset +*/ +uint my_charset_repertoire(CHARSET_INFO *cs) +{ + return cs->state & MY_CS_PUREASCII ? + MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30; +} + + +/* + Detect whether a character set is ASCII compatible. + + Returns TRUE for: + + - all 8bit character sets whose Unicode mapping of 0x7B is '{' + (ignores swe7 which maps 0x7B to "LATIN LETTER A WITH DIAERESIS") + + - all multi-byte character sets having mbminlen == 1 + (ignores ucs2 whose mbminlen is 2) + + TODO: + + When merging to 5.2, this function should be changed + to check a new flag MY_CS_NONASCII, + + return (cs->flag & MY_CS_NONASCII) ? 0 : 1; + + This flag was previously added into 5.2 under terms + of WL#3759 "Optimize identifier conversion in client-server protocol" + especially to mark character sets not compatible with ASCII. + + We won't backport this flag to 5.0 or 5.1. + This function is Ok for 5.0 and 5.1, because we're not going + to introduce new tricky character sets between 5.0 and 5.2. +*/ +my_bool +my_charset_is_ascii_based(CHARSET_INFO *cs) +{ + return + (cs->mbmaxlen == 1 && cs->tab_to_uni && cs->tab_to_uni['{'] == '{') || + (cs->mbminlen == 1 && cs->mbmaxlen > 1); +} + + +/* + Detect if a character set is 8bit, + and it is pure ascii, i.e. doesn't have + characters outside U+0000..U+007F + This functions is shared between "conf_to_src" + and dynamic charsets loader in "mysqld". +*/ +my_bool +my_charset_is_8bit_pure_ascii(CHARSET_INFO *cs) +{ + size_t code; + if (!cs->tab_to_uni) + return 0; + for (code= 0; code < 256; code++) + { + if (cs->tab_to_uni[code] > 0x7F) + return 0; + } + return 1; +} + + +/* + Shared function between conf_to_src and mysys. + Check if a 8bit character set is compatible with + ascii on the range 0x00..0x7F. +*/ +my_bool +my_charset_is_ascii_compatible(CHARSET_INFO *cs) +{ + uint i; + if (!cs->tab_to_uni) + return 1; + for (i= 0; i < 128; i++) + { + if (cs->tab_to_uni[i] != i) + return 0; + } + return 1; +} diff --git a/externals/mysql/strings/decimal.c b/externals/mysql/strings/decimal.c new file mode 100644 index 0000000..df60bac --- /dev/null +++ b/externals/mysql/strings/decimal.c @@ -0,0 +1,3134 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#line 18 "decimal.c" + +/* +======================================================================= + NOTE: this library implements SQL standard "exact numeric" type + and is not at all generic, but rather intentinally crippled to + follow the standard :) +======================================================================= + Quoting the standard + (SQL:2003, Part 2 Foundations, aka ISO/IEC 9075-2:2003) + +4.4.2 Characteristics of numbers, page 27: + + An exact numeric type has a precision P and a scale S. P is a positive + integer that determines the number of significant digits in a + particular radix R, where R is either 2 or 10. S is a non-negative + integer. Every value of an exact numeric type of scale S is of the + form n*10^{-S}, where n is an integer such that ­-R^P <= n <= R^P. + + [...] + + If an assignment of some number would result in a loss of its most + significant digit, an exception condition is raised. If least + significant digits are lost, implementation-defined rounding or + truncating occurs, with no exception condition being raised. + + [...] + + Whenever an exact or approximate numeric value is assigned to an exact + numeric value site, an approximation of its value that preserves + leading significant digits after rounding or truncating is represented + in the declared type of the target. The value is converted to have the + precision and scale of the target. The choice of whether to truncate + or round is implementation-defined. + + [...] + + All numeric values between the smallest and the largest value, + inclusive, in a given exact numeric type have an approximation + obtained by rounding or truncation for that type; it is + implementation-defined which other numeric values have such + approximations. + +5.3 , page 143 + + ::= + [ [ ] ] + | + +6.1 , page 165: + + 19) The of an shall not be greater than + the of the . + + 20) For the s DECIMAL and NUMERIC: + + a) The maximum value of is implementation-defined. + shall not be greater than this value. + b) The maximum value of is implementation-defined. + shall not be greater than this maximum value. + + 21) NUMERIC specifies the data type exact numeric, with the decimal + precision and scale specified by the and . + + 22) DECIMAL specifies the data type exact numeric, with the decimal + scale specified by the and the implementation-defined + decimal precision equal to or greater than the value of the + specified . + +6.26 , page 241: + + 1) If the declared type of both operands of a dyadic arithmetic + operator is exact numeric, then the declared type of the result is + an implementation-defined exact numeric type, with precision and + scale determined as follows: + + a) Let S1 and S2 be the scale of the first and second operands + respectively. + b) The precision of the result of addition and subtraction is + implementation-defined, and the scale is the maximum of S1 and S2. + c) The precision of the result of multiplication is + implementation-defined, and the scale is S1 + S2. + d) The precision and scale of the result of division are + implementation-defined. +*/ + +#include +#include +#include +#include /* for my_alloca */ +#include +#include + +/* + Internally decimal numbers are stored base 10^9 (see DIG_BASE below) + So one variable of type decimal_digit_t is limited: + + 0 < decimal_digit <= DIG_MAX < DIG_BASE + + in the struct st_decimal_t: + + intg is the number of *decimal* digits (NOT number of decimal_digit_t's !) + before the point + frac - number of decimal digits after the point + buf is an array of decimal_digit_t's + len is the length of buf (length of allocated space) in decimal_digit_t's, + not in bytes +*/ +typedef decimal_digit_t dec1; +typedef longlong dec2; + +#define DIG_PER_DEC1 9 +#define DIG_MASK 100000000 +#define DIG_BASE 1000000000 +#define DIG_MAX (DIG_BASE-1) +#define DIG_BASE2 ((dec2)DIG_BASE * (dec2)DIG_BASE) +#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1) +static const dec1 powers10[DIG_PER_DEC1+1]={ + 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; +static const int dig2bytes[DIG_PER_DEC1+1]={0, 1, 1, 2, 2, 3, 3, 4, 4, 4}; +static const dec1 frac_max[DIG_PER_DEC1-1]={ + 900000000, 990000000, 999000000, + 999900000, 999990000, 999999000, + 999999900, 999999990 }; + +#ifdef HAVE_purify +#define sanity(d) DBUG_ASSERT((d)->len > 0) +#else +#define sanity(d) DBUG_ASSERT((d)->len >0 && ((d)->buf[0] | \ + (d)->buf[(d)->len-1] | 1)) +#endif + +#define FIX_INTG_FRAC_ERROR(len, intg1, frac1, error) \ + do \ + { \ + if (unlikely(intg1+frac1 > (len))) \ + { \ + if (unlikely(intg1 > (len))) \ + { \ + intg1=(len); \ + frac1=0; \ + error=E_DEC_OVERFLOW; \ + } \ + else \ + { \ + frac1=(len)-intg1; \ + error=E_DEC_TRUNCATED; \ + } \ + } \ + else \ + error=E_DEC_OK; \ + } while(0) + +#define ADD(to, from1, from2, carry) /* assume carry <= 1 */ \ + do \ + { \ + dec1 a=(from1)+(from2)+(carry); \ + DBUG_ASSERT((carry) <= 1); \ + if (((carry)= a >= DIG_BASE)) /* no division here! */ \ + a-=DIG_BASE; \ + (to)=a; \ + } while(0) + +#define ADD2(to, from1, from2, carry) \ + do \ + { \ + dec2 a=((dec2)(from1))+(from2)+(carry); \ + if (((carry)= a >= DIG_BASE)) \ + a-=DIG_BASE; \ + if (unlikely(a >= DIG_BASE)) \ + { \ + a-=DIG_BASE; \ + carry++; \ + } \ + (to)=(dec1) a; \ + } while(0) + +#define SUB(to, from1, from2, carry) /* to=from1-from2 */ \ + do \ + { \ + dec1 a=(from1)-(from2)-(carry); \ + if (((carry)= a < 0)) \ + a+=DIG_BASE; \ + (to)=a; \ + } while(0) + +#define SUB2(to, from1, from2, carry) /* to=from1-from2 */ \ + do \ + { \ + dec1 a=(from1)-(from2)-(carry); \ + if (((carry)= a < 0)) \ + a+=DIG_BASE; \ + if (unlikely(a < 0)) \ + { \ + a+=DIG_BASE; \ + carry++; \ + } \ + (to)=a; \ + } while(0) + +/* + Get maximum value for given precision and scale + + SYNOPSIS + max_decimal() + precision/scale - see decimal_bin_size() below + to - decimal where where the result will be stored + to->buf and to->len must be set. +*/ + +void max_decimal(int precision, int frac, decimal_t *to) +{ + int intpart; + dec1 *buf= to->buf; + DBUG_ASSERT(precision && precision >= frac); + + to->sign= 0; + if ((intpart= to->intg= (precision - frac))) + { + int firstdigits= intpart % DIG_PER_DEC1; + if (firstdigits) + *buf++= powers10[firstdigits] - 1; /* get 9 99 999 ... */ + for(intpart/= DIG_PER_DEC1; intpart; intpart--) + *buf++= DIG_MAX; + } + + if ((to->frac= frac)) + { + int lastdigits= frac % DIG_PER_DEC1; + for(frac/= DIG_PER_DEC1; frac; frac--) + *buf++= DIG_MAX; + if (lastdigits) + *buf= frac_max[lastdigits - 1]; + } +} + + +static dec1 *remove_leading_zeroes(decimal_t *from, int *intg_result) +{ + int intg= from->intg, i; + dec1 *buf0= from->buf; + i= ((intg - 1) % DIG_PER_DEC1) + 1; + while (intg > 0 && *buf0 == 0) + { + intg-= i; + i= DIG_PER_DEC1; + buf0++; + } + if (intg > 0) + { + for (i= (intg - 1) % DIG_PER_DEC1; *buf0 < powers10[i--]; intg--) ; + DBUG_ASSERT(intg > 0); + } + else + intg=0; + *intg_result= intg; + return buf0; +} + + +/* + Count actual length of fraction part (without ending zeroes) + + SYNOPSIS + decimal_actual_fraction() + from number for processing +*/ + +int decimal_actual_fraction(decimal_t *from) +{ + int frac= from->frac, i; + dec1 *buf0= from->buf + ROUND_UP(from->intg) + ROUND_UP(frac) - 1; + + if (frac == 0) + return 0; + + i= ((frac - 1) % DIG_PER_DEC1 + 1); + while (frac > 0 && *buf0 == 0) + { + frac-= i; + i= DIG_PER_DEC1; + buf0--; + } + if (frac > 0) + { + for (i= DIG_PER_DEC1 - ((frac - 1) % DIG_PER_DEC1); + *buf0 % powers10[i++] == 0; + frac--); + } + return frac; +} + + +/* + Convert decimal to its printable string representation + + SYNOPSIS + decimal2string() + from - value to convert + to - points to buffer where string representation + should be stored + *to_len - in: size of to buffer + out: length of the actually written string + fixed_precision - 0 if representation can be variable length and + fixed_decimals will not be checked in this case. + Put number as with fixed point position with this + number of digits (sign counted and decimal point is + counted) + fixed_decimals - number digits after point. + filler - character to fill gaps in case of fixed_precision > 0 + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW +*/ + +int decimal2string(decimal_t *from, char *to, int *to_len, + int fixed_precision, int fixed_decimals, + char filler) +{ + int len, intg, frac= from->frac, i, intg_len, frac_len, fill; + /* number digits before decimal point */ + int fixed_intg= (fixed_precision ? + (fixed_precision - fixed_decimals) : 0); + int error=E_DEC_OK; + char *s=to; + dec1 *buf, *buf0=from->buf, tmp; + + DBUG_ASSERT(*to_len >= 2+from->sign); + + /* removing leading zeroes */ + buf0= remove_leading_zeroes(from, &intg); + if (unlikely(intg+frac==0)) + { + intg=1; + tmp=0; + buf0=&tmp; + } + + if (!(intg_len= fixed_precision ? fixed_intg : intg)) + intg_len= 1; + frac_len= fixed_precision ? fixed_decimals : frac; + len= from->sign + intg_len + test(frac) + frac_len; + if (fixed_precision) + { + if (frac > fixed_decimals) + { + error= E_DEC_TRUNCATED; + frac= fixed_decimals; + } + if (intg > fixed_intg) + { + error= E_DEC_OVERFLOW; + intg= fixed_intg; + } + } + else if (unlikely(len > --*to_len)) /* reserve one byte for \0 */ + { + int j= len-*to_len; + error= (frac && j <= frac + 1) ? E_DEC_TRUNCATED : E_DEC_OVERFLOW; + if (frac && j >= frac + 1) j--; + if (j > frac) + { + intg-= j-frac; + frac= 0; + } + else + frac-=j; + len= from->sign + intg_len + test(frac) + frac_len; + } + *to_len=len; + s[len]=0; + + if (from->sign) + *s++='-'; + + if (frac) + { + char *s1= s + intg_len; + fill= frac_len - frac; + buf=buf0+ROUND_UP(intg); + *s1++='.'; + for (; frac>0; frac-=DIG_PER_DEC1) + { + dec1 x=*buf++; + for (i=min(frac, DIG_PER_DEC1); i; i--) + { + dec1 y=x/DIG_MASK; + *s1++='0'+(uchar)y; + x-=y*DIG_MASK; + x*=10; + } + } + for(; fill; fill--) + *s1++=filler; + } + + fill= intg_len - intg; + if (intg == 0) + fill--; /* symbol 0 before digital point */ + for(; fill; fill--) + *s++=filler; + if (intg) + { + s+=intg; + for (buf=buf0+ROUND_UP(intg); intg>0; intg-=DIG_PER_DEC1) + { + dec1 x=*--buf; + for (i=min(intg, DIG_PER_DEC1); i; i--) + { + dec1 y=x/10; + *--s='0'+(uchar)(x-y*10); + x=y; + } + } + } + else + *s= '0'; + return error; +} + + +/* + Return bounds of decimal digits in the number + + SYNOPSIS + digits_bounds() + from - decimal number for processing + start_result - index (from 0 ) of first decimal digits will + be written by this address + end_result - index of position just after last decimal digit + be written by this address +*/ + +static void digits_bounds(decimal_t *from, int *start_result, int *end_result) +{ + int start, stop, i; + dec1 *buf_beg= from->buf; + dec1 *end= from->buf + ROUND_UP(from->intg) + ROUND_UP(from->frac); + dec1 *buf_end= end - 1; + + /* find non-zero digit from number begining */ + while (buf_beg < end && *buf_beg == 0) + buf_beg++; + + if (buf_beg >= end) + { + /* it is zero */ + *start_result= *end_result= 0; + return; + } + + /* find non-zero decimal digit from number begining */ + if (buf_beg == from->buf && from->intg) + { + start= DIG_PER_DEC1 - (i= ((from->intg-1) % DIG_PER_DEC1 + 1)); + i--; + } + else + { + i= DIG_PER_DEC1 - 1; + start= (int) ((buf_beg - from->buf) * DIG_PER_DEC1); + } + if (buf_beg < end) + for (; *buf_beg < powers10[i--]; start++) ; + *start_result= start; /* index of first decimal digit (from 0) */ + + /* find non-zero digit at the end */ + while (buf_end > buf_beg && *buf_end == 0) + buf_end--; + /* find non-zero decimal digit from the end */ + if (buf_end == end - 1 && from->frac) + { + stop= (int) (((buf_end - from->buf) * DIG_PER_DEC1 + + (i= ((from->frac - 1) % DIG_PER_DEC1 + 1)))); + i= DIG_PER_DEC1 - i + 1; + } + else + { + stop= (int) ((buf_end - from->buf + 1) * DIG_PER_DEC1); + i= 1; + } + for (; *buf_end % powers10[i++] == 0; stop--); + *end_result= stop; /* index of position after last decimal digit (from 0) */ +} + + +/* + Left shift for alignment of data in buffer + + SYNOPSIS + do_mini_left_shift() + dec pointer to decimal number which have to be shifted + shift number of decimal digits on which it should be shifted + beg/end bounds of decimal digits (see digits_bounds()) + + NOTE + Result fitting in the buffer should be garanted. + 'shift' have to be from 1 to DIG_PER_DEC1-1 (inclusive) +*/ + +void do_mini_left_shift(decimal_t *dec, int shift, int beg, int last) +{ + dec1 *from= dec->buf + ROUND_UP(beg + 1) - 1; + dec1 *end= dec->buf + ROUND_UP(last) - 1; + int c_shift= DIG_PER_DEC1 - shift; + DBUG_ASSERT(from >= dec->buf); + DBUG_ASSERT(end < dec->buf + dec->len); + if (beg % DIG_PER_DEC1 < shift) + *(from - 1)= (*from) / powers10[c_shift]; + for(; from < end; from++) + *from= ((*from % powers10[c_shift]) * powers10[shift] + + (*(from + 1)) / powers10[c_shift]); + *from= (*from % powers10[c_shift]) * powers10[shift]; +} + + +/* + Right shift for alignment of data in buffer + + SYNOPSIS + do_mini_left_shift() + dec pointer to decimal number which have to be shifted + shift number of decimal digits on which it should be shifted + beg/end bounds of decimal digits (see digits_bounds()) + + NOTE + Result fitting in the buffer should be garanted. + 'shift' have to be from 1 to DIG_PER_DEC1-1 (inclusive) +*/ + +void do_mini_right_shift(decimal_t *dec, int shift, int beg, int last) +{ + dec1 *from= dec->buf + ROUND_UP(last) - 1; + dec1 *end= dec->buf + ROUND_UP(beg + 1) - 1; + int c_shift= DIG_PER_DEC1 - shift; + DBUG_ASSERT(from < dec->buf + dec->len); + DBUG_ASSERT(end >= dec->buf); + if (DIG_PER_DEC1 - ((last - 1) % DIG_PER_DEC1 + 1) < shift) + *(from + 1)= (*from % powers10[shift]) * powers10[c_shift]; + for(; from > end; from--) + *from= (*from / powers10[shift] + + (*(from - 1) % powers10[shift]) * powers10[c_shift]); + *from= *from / powers10[shift]; +} + + +/* + Shift of decimal digits in given number (with rounding if it need) + + SYNOPSIS + decimal_shift() + dec number to be shifted + shift number of decimal positions + shift > 0 means shift to left shift + shift < 0 meand right shift + NOTE + In fact it is multipling on 10^shift. + RETURN + E_DEC_OK OK + E_DEC_OVERFLOW operation lead to overflow, number is untoched + E_DEC_TRUNCATED number was rounded to fit into buffer +*/ + +int decimal_shift(decimal_t *dec, int shift) +{ + /* index of first non zero digit (all indexes from 0) */ + int beg; + /* index of position after last decimal digit */ + int end; + /* index of digit position just after point */ + int point= ROUND_UP(dec->intg) * DIG_PER_DEC1; + /* new point position */ + int new_point= point + shift; + /* number of digits in result */ + int digits_int, digits_frac; + /* length of result and new fraction in big digits*/ + int new_len, new_frac_len; + /* return code */ + int err= E_DEC_OK; + int new_front; + + if (shift == 0) + return E_DEC_OK; + + digits_bounds(dec, &beg, &end); + + if (beg == end) + { + decimal_make_zero(dec); + return E_DEC_OK; + } + + digits_int= new_point - beg; + set_if_bigger(digits_int, 0); + digits_frac= end - new_point; + set_if_bigger(digits_frac, 0); + + if ((new_len= ROUND_UP(digits_int) + (new_frac_len= ROUND_UP(digits_frac))) > + dec->len) + { + int lack= new_len - dec->len; + int diff; + + if (new_frac_len < lack) + return E_DEC_OVERFLOW; /* lack more then we have in fraction */ + + /* cat off fraction part to allow new number to fit in our buffer */ + err= E_DEC_TRUNCATED; + new_frac_len-= lack; + diff= digits_frac - (new_frac_len * DIG_PER_DEC1); + /* Make rounding method as parameter? */ + decimal_round(dec, dec, end - point - diff, HALF_UP); + end-= diff; + digits_frac= new_frac_len * DIG_PER_DEC1; + + if (end <= beg) + { + /* + we lost all digits (they will be shifted out of buffer), so we can + just return 0 + */ + decimal_make_zero(dec); + return E_DEC_TRUNCATED; + } + } + + if (shift % DIG_PER_DEC1) + { + int l_mini_shift, r_mini_shift, mini_shift; + int do_left; + /* + Calculate left/right shift to align decimal digits inside our bug + digits correctly + */ + if (shift > 0) + { + l_mini_shift= shift % DIG_PER_DEC1; + r_mini_shift= DIG_PER_DEC1 - l_mini_shift; + /* + It is left shift so prefer left shift, but if we have not place from + left, we have to have it from right, because we checked length of + result + */ + do_left= l_mini_shift <= beg; + DBUG_ASSERT(do_left || (dec->len * DIG_PER_DEC1 - end) >= r_mini_shift); + } + else + { + r_mini_shift= (-shift) % DIG_PER_DEC1; + l_mini_shift= DIG_PER_DEC1 - r_mini_shift; + /* see comment above */ + do_left= !((dec->len * DIG_PER_DEC1 - end) >= r_mini_shift); + DBUG_ASSERT(!do_left || l_mini_shift <= beg); + } + if (do_left) + { + do_mini_left_shift(dec, l_mini_shift, beg, end); + mini_shift=- l_mini_shift; + } + else + { + do_mini_right_shift(dec, r_mini_shift, beg, end); + mini_shift= r_mini_shift; + } + new_point+= mini_shift; + /* + If number is shifted and correctly aligned in buffer we can + finish + */ + if (!(shift+= mini_shift) && (new_point - digits_int) < DIG_PER_DEC1) + { + dec->intg= digits_int; + dec->frac= digits_frac; + return err; /* already shifted as it should be */ + } + beg+= mini_shift; + end+= mini_shift; + } + + /* if new 'decimal front' is in first digit, we do not need move digits */ + if ((new_front= (new_point - digits_int)) >= DIG_PER_DEC1 || + new_front < 0) + { + /* need to move digits */ + int d_shift; + dec1 *to, *barier; + if (new_front > 0) + { + /* move left */ + d_shift= new_front / DIG_PER_DEC1; + to= dec->buf + (ROUND_UP(beg + 1) - 1 - d_shift); + barier= dec->buf + (ROUND_UP(end) - 1 - d_shift); + DBUG_ASSERT(to >= dec->buf); + DBUG_ASSERT(barier + d_shift < dec->buf + dec->len); + for(; to <= barier; to++) + *to= *(to + d_shift); + for(barier+= d_shift; to <= barier; to++) + *to= 0; + d_shift= -d_shift; + } + else + { + /* move right */ + d_shift= (1 - new_front) / DIG_PER_DEC1; + to= dec->buf + ROUND_UP(end) - 1 + d_shift; + barier= dec->buf + ROUND_UP(beg + 1) - 1 + d_shift; + DBUG_ASSERT(to < dec->buf + dec->len); + DBUG_ASSERT(barier - d_shift >= dec->buf); + for(; to >= barier; to--) + *to= *(to - d_shift); + for(barier-= d_shift; to >= barier; to--) + *to= 0; + } + d_shift*= DIG_PER_DEC1; + beg+= d_shift; + end+= d_shift; + new_point+= d_shift; + } + + /* + If there are gaps then fill ren with 0. + + Only one of following 'for' loops will work becouse beg <= end + */ + beg= ROUND_UP(beg + 1) - 1; + end= ROUND_UP(end) - 1; + DBUG_ASSERT(new_point >= 0); + + /* We don't want negative new_point below */ + if (new_point != 0) + new_point= ROUND_UP(new_point) - 1; + + if (new_point > end) + { + do + { + dec->buf[new_point]=0; + } while (--new_point > end); + } + else + { + for (; new_point < beg; new_point++) + dec->buf[new_point]= 0; + } + dec->intg= digits_int; + dec->frac= digits_frac; + return err; +} + + +/* + Convert string to decimal + + SYNOPSIS + internal_str2decl() + from - value to convert. Doesn't have to be \0 terminated! + to - decimal where where the result will be stored + to->buf and to->len must be set. + end - Pointer to pointer to end of string. Will on return be + set to the char after the last used character + fixed - use to->intg, to->frac as limits for input number + + NOTE + to->intg and to->frac can be modified even when fixed=1 + (but only decreased, in this case) + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW/E_DEC_BAD_NUM/E_DEC_OOM + In case of E_DEC_FATAL_ERROR *to is set to decimal zero + (to make error handling easier) +*/ + +int +internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed) +{ + const char *s= from, *s1, *endp, *end_of_string= *end; + int i, intg, frac, error, intg1, frac1; + dec1 x,*buf; + sanity(to); + + error= E_DEC_BAD_NUM; /* In case of bad number */ + while (s < end_of_string && my_isspace(&my_charset_latin1, *s)) + s++; + if (s == end_of_string) + goto fatal_error; + + if ((to->sign= (*s == '-'))) + s++; + else if (*s == '+') + s++; + + s1=s; + while (s < end_of_string && my_isdigit(&my_charset_latin1, *s)) + s++; + intg= (int) (s-s1); + if (s < end_of_string && *s=='.') + { + endp= s+1; + while (endp < end_of_string && my_isdigit(&my_charset_latin1, *endp)) + endp++; + frac= (int) (endp - s - 1); + } + else + { + frac= 0; + endp= s; + } + + *end= (char*) endp; + + if (frac+intg == 0) + goto fatal_error; + + error= 0; + if (fixed) + { + if (frac > to->frac) + { + error=E_DEC_TRUNCATED; + frac=to->frac; + } + if (intg > to->intg) + { + error=E_DEC_OVERFLOW; + intg=to->intg; + } + intg1=ROUND_UP(intg); + frac1=ROUND_UP(frac); + if (intg1+frac1 > to->len) + { + error= E_DEC_OOM; + goto fatal_error; + } + } + else + { + intg1=ROUND_UP(intg); + frac1=ROUND_UP(frac); + FIX_INTG_FRAC_ERROR(to->len, intg1, frac1, error); + if (unlikely(error)) + { + frac=frac1*DIG_PER_DEC1; + if (error == E_DEC_OVERFLOW) + intg=intg1*DIG_PER_DEC1; + } + } + /* Error is guranteed to be set here */ + to->intg=intg; + to->frac=frac; + + buf=to->buf+intg1; + s1=s; + + for (x=0, i=0; intg; intg--) + { + x+= (*--s - '0')*powers10[i]; + + if (unlikely(++i == DIG_PER_DEC1)) + { + *--buf=x; + x=0; + i=0; + } + } + if (i) + *--buf=x; + + buf=to->buf+intg1; + for (x=0, i=0; frac; frac--) + { + x= (*++s1 - '0') + x*10; + + if (unlikely(++i == DIG_PER_DEC1)) + { + *buf++=x; + x=0; + i=0; + } + } + if (i) + *buf=x*powers10[DIG_PER_DEC1-i]; + + /* Handle exponent */ + if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E')) + { + int str_error; + longlong exponent= my_strtoll10(endp+1, (char**) &end_of_string, + &str_error); + + if (end_of_string != endp +1) /* If at least one digit */ + { + *end= (char*) end_of_string; + if (str_error > 0) + { + error= E_DEC_BAD_NUM; + goto fatal_error; + } + if (exponent > INT_MAX/2 || (str_error == 0 && exponent < 0)) + { + error= E_DEC_OVERFLOW; + goto fatal_error; + } + if (exponent < INT_MIN/2 && error != E_DEC_OVERFLOW) + { + error= E_DEC_TRUNCATED; + goto fatal_error; + } + if (error != E_DEC_OVERFLOW) + error= decimal_shift(to, (int) exponent); + } + } + return error; + +fatal_error: + decimal_make_zero(to); + return error; +} + + +/* + Convert decimal to double + + SYNOPSIS + decimal2double() + from - value to convert + to - result will be stored there + + RETURN VALUE + E_DEC_OK/E_DEC_OVERFLOW/E_DEC_TRUNCATED +*/ + +int decimal2double(decimal_t *from, double *to) +{ + char strbuf[FLOATING_POINT_BUFFER], *end; + int len= sizeof(strbuf); + int rc, error; + + rc = decimal2string(from, strbuf, &len, 0, 0, 0); + end= strbuf + len; + + DBUG_PRINT("info", ("interm.: %s", strbuf)); + + *to= my_strtod(strbuf, &end, &error); + + DBUG_PRINT("info", ("result: %f (%lx)", *to, *(ulong *)to)); + + return (rc != E_DEC_OK) ? rc : (error ? E_DEC_OVERFLOW : E_DEC_OK); +} + +/* + Convert double to decimal + + SYNOPSIS + double2decimal() + from - value to convert + to - result will be stored there + + RETURN VALUE + E_DEC_OK/E_DEC_OVERFLOW/E_DEC_TRUNCATED +*/ + +int double2decimal(double from, decimal_t *to) +{ + char buff[FLOATING_POINT_BUFFER], *end; + int res; + DBUG_ENTER("double2decimal"); + end= buff + my_gcvt(from, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL); + res= string2decimal(buff, to, &end); + DBUG_PRINT("exit", ("res: %d", res)); + DBUG_RETURN(res); +} + + +static int ull2dec(ulonglong from, decimal_t *to) +{ + int intg1, error=E_DEC_OK; + ulonglong x=from; + dec1 *buf; + + sanity(to); + + for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE); + if (unlikely(intg1 > to->len)) + { + intg1=to->len; + error=E_DEC_OVERFLOW; + } + to->frac=0; + to->intg=intg1*DIG_PER_DEC1; + + for (buf=to->buf+intg1; intg1; intg1--) + { + ulonglong y=x/DIG_BASE; + *--buf=(dec1)(x-y*DIG_BASE); + x=y; + } + return error; +} + +int ulonglong2decimal(ulonglong from, decimal_t *to) +{ + to->sign=0; + return ull2dec(from, to); +} + +int longlong2decimal(longlong from, decimal_t *to) +{ + if ((to->sign= from < 0)) + return ull2dec(-from, to); + return ull2dec(from, to); +} + +int decimal2ulonglong(decimal_t *from, ulonglong *to) +{ + dec1 *buf=from->buf; + ulonglong x=0; + int intg, frac; + + if (from->sign) + { + *to=0ULL; + return E_DEC_OVERFLOW; + } + + for (intg=from->intg; intg > 0; intg-=DIG_PER_DEC1) + { + ulonglong y=x; + x=x*DIG_BASE + *buf++; + if (unlikely(y > ((ulonglong) ULONGLONG_MAX/DIG_BASE) || x < y)) + { + *to=ULONGLONG_MAX; + return E_DEC_OVERFLOW; + } + } + *to=x; + for (frac=from->frac; unlikely(frac > 0); frac-=DIG_PER_DEC1) + if (*buf++) + return E_DEC_TRUNCATED; + return E_DEC_OK; +} + +int decimal2longlong(decimal_t *from, longlong *to) +{ + dec1 *buf=from->buf; + longlong x=0; + int intg, frac; + + for (intg=from->intg; intg > 0; intg-=DIG_PER_DEC1) + { + longlong y=x; + /* + Attention: trick! + we're calculating -|from| instead of |from| here + because |LONGLONG_MIN| > LONGLONG_MAX + so we can convert -9223372036854775808 correctly + */ + x=x*DIG_BASE - *buf++; + if (unlikely(y < (LONGLONG_MIN/DIG_BASE) || x > y)) + { + /* + the decimal is bigger than any possible integer + return border integer depending on the sign + */ + *to= from->sign ? LONGLONG_MIN : LONGLONG_MAX; + return E_DEC_OVERFLOW; + } + } + /* boundary case: 9223372036854775808 */ + if (unlikely(from->sign==0 && x == LONGLONG_MIN)) + { + *to= LONGLONG_MAX; + return E_DEC_OVERFLOW; + } + + *to=from->sign ? x : -x; + for (frac=from->frac; unlikely(frac > 0); frac-=DIG_PER_DEC1) + if (*buf++) + return E_DEC_TRUNCATED; + return E_DEC_OK; +} + +/* + Convert decimal to its binary fixed-length representation + two representations of the same length can be compared with memcmp + with the correct -1/0/+1 result + + SYNOPSIS + decimal2bin() + from - value to convert + to - points to buffer where string representation should be stored + precision/scale - see decimal_bin_size() below + + NOTE + the buffer is assumed to be of the size decimal_bin_size(precision, scale) + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW + + DESCRIPTION + for storage decimal numbers are converted to the "binary" format. + + This format has the following properties: + 1. length of the binary representation depends on the {precision, scale} + as provided by the caller and NOT on the intg/frac of the decimal to + convert. + 2. binary representations of the same {precision, scale} can be compared + with memcmp - with the same result as decimal_cmp() of the original + decimals (not taking into account possible precision loss during + conversion). + + This binary format is as follows: + 1. First the number is converted to have a requested precision and scale. + 2. Every full DIG_PER_DEC1 digits of intg part are stored in 4 bytes + as is + 3. The first intg % DIG_PER_DEC1 digits are stored in the reduced + number of bytes (enough bytes to store this number of digits - + see dig2bytes) + 4. same for frac - full decimal_digit_t's are stored as is, + the last frac % DIG_PER_DEC1 digits - in the reduced number of bytes. + 5. If the number is negative - every byte is inversed. + 5. The very first bit of the resulting byte array is inverted (because + memcmp compares unsigned bytes, see property 2 above) + + Example: + + 1234567890.1234 + + internally is represented as 3 decimal_digit_t's + + 1 234567890 123400000 + + (assuming we want a binary representation with precision=14, scale=4) + in hex it's + + 00-00-00-01 0D-FB-38-D2 07-5A-EF-40 + + now, middle decimal_digit_t is full - it stores 9 decimal digits. It goes + into binary representation as is: + + + ........... 0D-FB-38-D2 ............ + + First decimal_digit_t has only one decimal digit. We can store one digit in + one byte, no need to waste four: + + 01 0D-FB-38-D2 ............ + + now, last digit. It's 123400000. We can store 1234 in two bytes: + + 01 0D-FB-38-D2 04-D2 + + So, we've packed 12 bytes number in 7 bytes. + And now we invert the highest bit to get the final result: + + 81 0D FB 38 D2 04 D2 + + And for -1234567890.1234 it would be + + 7E F2 04 37 2D FB 2D +*/ +int decimal2bin(decimal_t *from, uchar *to, int precision, int frac) +{ + dec1 mask=from->sign ? -1 : 0, *buf1=from->buf, *stop1; + int error=E_DEC_OK, intg=precision-frac, + isize1, intg1, intg1x, from_intg, + intg0=intg/DIG_PER_DEC1, + frac0=frac/DIG_PER_DEC1, + intg0x=intg-intg0*DIG_PER_DEC1, + frac0x=frac-frac0*DIG_PER_DEC1, + frac1=from->frac/DIG_PER_DEC1, + frac1x=from->frac-frac1*DIG_PER_DEC1, + isize0=intg0*sizeof(dec1)+dig2bytes[intg0x], + fsize0=frac0*sizeof(dec1)+dig2bytes[frac0x], + fsize1=frac1*sizeof(dec1)+dig2bytes[frac1x]; + const int orig_isize0= isize0; + const int orig_fsize0= fsize0; + uchar *orig_to= to; + + buf1= remove_leading_zeroes(from, &from_intg); + + if (unlikely(from_intg+fsize1==0)) + { + mask=0; /* just in case */ + intg=1; + buf1=&mask; + } + + intg1=from_intg/DIG_PER_DEC1; + intg1x=from_intg-intg1*DIG_PER_DEC1; + isize1=intg1*sizeof(dec1)+dig2bytes[intg1x]; + + if (intg < from_intg) + { + buf1+=intg1-intg0+(intg1x>0)-(intg0x>0); + intg1=intg0; intg1x=intg0x; + error=E_DEC_OVERFLOW; + } + else if (isize0 > isize1) + { + while (isize0-- > isize1) + *to++= (char)mask; + } + if (fsize0 < fsize1) + { + frac1=frac0; frac1x=frac0x; + error=E_DEC_TRUNCATED; + } + else if (fsize0 > fsize1 && frac1x) + { + if (frac0 == frac1) + { + frac1x=frac0x; + fsize0= fsize1; + } + else + { + frac1++; + frac1x=0; + } + } + + /* intg1x part */ + if (intg1x) + { + int i=dig2bytes[intg1x]; + dec1 x=(*buf1++ % powers10[intg1x]) ^ mask; + switch (i) + { + case 1: mi_int1store(to, x); break; + case 2: mi_int2store(to, x); break; + case 3: mi_int3store(to, x); break; + case 4: mi_int4store(to, x); break; + default: DBUG_ASSERT(0); + } + to+=i; + } + + /* intg1+frac1 part */ + for (stop1=buf1+intg1+frac1; buf1 < stop1; to+=sizeof(dec1)) + { + dec1 x=*buf1++ ^ mask; + DBUG_ASSERT(sizeof(dec1) == 4); + mi_int4store(to, x); + } + + /* frac1x part */ + if (frac1x) + { + dec1 x; + int i=dig2bytes[frac1x], + lim=(frac1 < frac0 ? DIG_PER_DEC1 : frac0x); + while (frac1x < lim && dig2bytes[frac1x] == i) + frac1x++; + x=(*buf1 / powers10[DIG_PER_DEC1 - frac1x]) ^ mask; + switch (i) + { + case 1: mi_int1store(to, x); break; + case 2: mi_int2store(to, x); break; + case 3: mi_int3store(to, x); break; + case 4: mi_int4store(to, x); break; + default: DBUG_ASSERT(0); + } + to+=i; + } + if (fsize0 > fsize1) + { + uchar *to_end= orig_to + orig_fsize0 + orig_isize0; + + while (fsize0-- > fsize1 && to < to_end) + *to++= (uchar)mask; + } + orig_to[0]^= 0x80; + + /* Check that we have written the whole decimal and nothing more */ + DBUG_ASSERT(to == orig_to + orig_fsize0 + orig_isize0); + return error; +} + +/* + Restores decimal from its binary fixed-length representation + + SYNOPSIS + bin2decimal() + from - value to convert + to - result + precision/scale - see decimal_bin_size() below + + NOTE + see decimal2bin() + the buffer is assumed to be of the size decimal_bin_size(precision, scale) + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW +*/ + +int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale) +{ + int error=E_DEC_OK, intg=precision-scale, + intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, + intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1, + intg1=intg0+(intg0x>0), frac1=frac0+(frac0x>0); + dec1 *buf=to->buf, mask=(*from & 0x80) ? 0 : -1; + const uchar *stop; + uchar *d_copy; + int bin_size= decimal_bin_size(precision, scale); + + sanity(to); + d_copy= (uchar*) my_alloca(bin_size); + memcpy(d_copy, from, bin_size); + d_copy[0]^= 0x80; + from= d_copy; + + FIX_INTG_FRAC_ERROR(to->len, intg1, frac1, error); + if (unlikely(error)) + { + if (intg1 < intg0+(intg0x>0)) + { + from+=dig2bytes[intg0x]+sizeof(dec1)*(intg0-intg1); + frac0=frac0x=intg0x=0; + intg0=intg1; + } + else + { + frac0x=0; + frac0=frac1; + } + } + + to->sign=(mask != 0); + to->intg=intg0*DIG_PER_DEC1+intg0x; + to->frac=frac0*DIG_PER_DEC1+frac0x; + + if (intg0x) + { + int i=dig2bytes[intg0x]; + dec1 x; + LINT_INIT(x); + switch (i) + { + case 1: x=mi_sint1korr(from); break; + case 2: x=mi_sint2korr(from); break; + case 3: x=mi_sint3korr(from); break; + case 4: x=mi_sint4korr(from); break; + default: DBUG_ASSERT(0); + } + from+=i; + *buf=x ^ mask; + if (((ulonglong)*buf) >= (ulonglong) powers10[intg0x+1]) + goto err; + if (buf > to->buf || *buf != 0) + buf++; + else + to->intg-=intg0x; + } + for (stop=from+intg0*sizeof(dec1); from < stop; from+=sizeof(dec1)) + { + DBUG_ASSERT(sizeof(dec1) == 4); + *buf=mi_sint4korr(from) ^ mask; + if (((uint32)*buf) > DIG_MAX) + goto err; + if (buf > to->buf || *buf != 0) + buf++; + else + to->intg-=DIG_PER_DEC1; + } + DBUG_ASSERT(to->intg >=0); + for (stop=from+frac0*sizeof(dec1); from < stop; from+=sizeof(dec1)) + { + DBUG_ASSERT(sizeof(dec1) == 4); + *buf=mi_sint4korr(from) ^ mask; + if (((uint32)*buf) > DIG_MAX) + goto err; + buf++; + } + if (frac0x) + { + int i=dig2bytes[frac0x]; + dec1 x; + LINT_INIT(x); + switch (i) + { + case 1: x=mi_sint1korr(from); break; + case 2: x=mi_sint2korr(from); break; + case 3: x=mi_sint3korr(from); break; + case 4: x=mi_sint4korr(from); break; + default: DBUG_ASSERT(0); + } + *buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x]; + if (((uint32)*buf) > DIG_MAX) + goto err; + buf++; + } + my_afree(d_copy); + return error; + +err: + my_afree(d_copy); + decimal_make_zero(((decimal_t*) to)); + return(E_DEC_BAD_NUM); +} + +/* + Returns the size of array to hold a decimal with given precision and scale + + RETURN VALUE + size in dec1 + (multiply by sizeof(dec1) to get the size if bytes) +*/ + +int decimal_size(int precision, int scale) +{ + DBUG_ASSERT(scale >= 0 && precision > 0 && scale <= precision); + return ROUND_UP(precision-scale)+ROUND_UP(scale); +} + +/* + Returns the size of array to hold a binary representation of a decimal + + RETURN VALUE + size in bytes +*/ + +int decimal_bin_size(int precision, int scale) +{ + int intg=precision-scale, + intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1, + intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1; + + DBUG_ASSERT(scale >= 0 && precision > 0 && scale <= precision); + return intg0*sizeof(dec1)+dig2bytes[intg0x]+ + frac0*sizeof(dec1)+dig2bytes[frac0x]; +} + +/* + Rounds the decimal to "scale" digits + + SYNOPSIS + decimal_round() + from - decimal to round, + to - result buffer. from==to is allowed + scale - to what position to round. can be negative! + mode - round to nearest even or truncate + + NOTES + scale can be negative ! + one TRUNCATED error (line XXX below) isn't treated very logical :( + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED +*/ + +int +decimal_round(decimal_t *from, decimal_t *to, int scale, + decimal_round_mode mode) +{ + int frac0=scale>0 ? ROUND_UP(scale) : scale/DIG_PER_DEC1, + frac1=ROUND_UP(from->frac), round_digit, + intg0=ROUND_UP(from->intg), error=E_DEC_OK, len=to->len, + intg1=ROUND_UP(from->intg + + (((intg0 + frac0)>0) && (from->buf[0] == DIG_MAX))); + dec1 *buf0=from->buf, *buf1=to->buf, x, y, carry=0; + int first_dig; + + sanity(to); + + LINT_INIT(round_digit); + switch (mode) { + case HALF_UP: + case HALF_EVEN: round_digit=5; break; + case CEILING: round_digit= from->sign ? 10 : 0; break; + case FLOOR: round_digit= from->sign ? 0 : 10; break; + case TRUNCATE: round_digit=10; break; + default: DBUG_ASSERT(0); + } + + if (unlikely(frac0+intg0 > len)) + { + frac0=len-intg0; + scale=frac0*DIG_PER_DEC1; + error=E_DEC_TRUNCATED; + } + + if (scale+from->intg < 0) + { + decimal_make_zero(to); + return E_DEC_OK; + } + + if (to != from || intg1>intg0) + { + dec1 *p0= buf0+intg0+max(frac1, frac0); + dec1 *p1= buf1+intg1+max(frac1, frac0); + + while (buf0 < p0) + *(--p1) = *(--p0); + if (unlikely(intg1 > intg0)) + to->buf[0]= 0; + + intg0= intg1; + buf0=to->buf; + buf1=to->buf; + to->sign=from->sign; + to->intg=min(intg0, len)*DIG_PER_DEC1; + } + + if (frac0 > frac1) + { + buf1+=intg0+frac1; + while (frac0-- > frac1) + *buf1++=0; + goto done; + } + + if (scale >= from->frac) + goto done; /* nothing to do */ + + buf0+=intg0+frac0-1; + buf1+=intg0+frac0-1; + if (scale == frac0*DIG_PER_DEC1) + { + int do_inc= FALSE; + DBUG_ASSERT(frac0+intg0 >= 0); + switch (round_digit) { + case 0: + { + dec1 *p0= buf0 + (frac1-frac0); + for (; p0 > buf0; p0--) + { + if (*p0) + { + do_inc= TRUE; + break; + } + } + break; + } + case 5: + { + x= buf0[1]/DIG_MASK; + do_inc= (x>5) || ((x == 5) && + (mode == HALF_UP || (frac0+intg0 > 0 && *buf0 & 1))); + break; + } + default: + break; + } + if (do_inc) + { + if (frac0+intg0>0) + (*buf1)++; + else + *(++buf1)=DIG_BASE; + } + else if (frac0+intg0==0) + { + decimal_make_zero(to); + return E_DEC_OK; + } + } + else + { + /* TODO - fix this code as it won't work for CEILING mode */ + int pos=frac0*DIG_PER_DEC1-scale-1; + DBUG_ASSERT(frac0+intg0 > 0); + x=*buf1 / powers10[pos]; + y=x % 10; + if (y > round_digit || + (round_digit == 5 && y == 5 && (mode == HALF_UP || (x/10) & 1))) + x+=10; + *buf1=powers10[pos]*(x-y); + } + /* + In case we're rounding e.g. 1.5e9 to 2.0e9, the decimal_digit_t's inside + the buffer are as follows. + + Before <1, 5e8> + After <2, 5e8> + + Hence we need to set the 2nd field to 0. + The same holds if we round 1.5e-9 to 2e-9. + */ + if (frac0 < frac1) + { + dec1 *buf= to->buf + ((scale == 0 && intg0 == 0) ? 1 : intg0 + frac0); + dec1 *end= to->buf + len; + + while (buf < end) + *buf++=0; + } + if (*buf1 >= DIG_BASE) + { + carry=1; + *buf1-=DIG_BASE; + while (carry && --buf1 >= to->buf) + ADD(*buf1, *buf1, 0, carry); + if (unlikely(carry)) + { + /* shifting the number to create space for new digit */ + if (frac0+intg0 >= len) + { + frac0--; + scale=frac0*DIG_PER_DEC1; + error=E_DEC_TRUNCATED; /* XXX */ + } + for (buf1=to->buf+intg0+max(frac0,0); buf1 > to->buf; buf1--) + { + buf1[0]=buf1[-1]; + } + *buf1=1; + to->intg++; + } + } + else + { + for (;;) + { + if (likely(*buf1)) + break; + if (buf1-- == to->buf) + { + /* making 'zero' with the proper scale */ + dec1 *p0= to->buf + frac0 + 1; + to->intg=1; + to->frac= max(scale, 0); + to->sign= 0; + for (buf1= to->buf; buf1 1000 case when we need to increase intg */ + first_dig= to->intg % DIG_PER_DEC1; + if (first_dig && (*buf1 >= powers10[first_dig])) + to->intg++; + + if (scale<0) + scale=0; + +done: + to->frac=scale; + return error; +} + +/* + Returns the size of the result of the operation + + SYNOPSIS + decimal_result_size() + from1 - operand of the unary operation or first operand of the + binary operation + from2 - second operand of the binary operation + op - operation. one char '+', '-', '*', '/' are allowed + others may be added later + param - extra param to the operation. unused for '+', '-', '*' + scale increment for '/' + + NOTE + returned valued may be larger than the actual buffer requred + in the operation, as decimal_result_size, by design, operates on + precision/scale values only and not on the actual decimal number + + RETURN VALUE + size of to->buf array in dec1 elements. to get size in bytes + multiply by sizeof(dec1) +*/ + +int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param) +{ + switch (op) { + case '-': + return ROUND_UP(max(from1->intg, from2->intg)) + + ROUND_UP(max(from1->frac, from2->frac)); + case '+': + return ROUND_UP(max(from1->intg, from2->intg)+1) + + ROUND_UP(max(from1->frac, from2->frac)); + case '*': + return ROUND_UP(from1->intg+from2->intg)+ + ROUND_UP(from1->frac)+ROUND_UP(from2->frac); + case '/': + return ROUND_UP(from1->intg+from2->intg+1+from1->frac+from2->frac+param); + default: DBUG_ASSERT(0); + } + return -1; /* shut up the warning */ +} + +static int do_add(decimal_t *from1, decimal_t *from2, decimal_t *to) +{ + int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), + frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac), + frac0=max(frac1, frac2), intg0=max(intg1, intg2), error; + dec1 *buf1, *buf2, *buf0, *stop, *stop2, x, carry; + + sanity(to); + + /* is there a need for extra word because of carry ? */ + x=intg1 > intg2 ? from1->buf[0] : + intg2 > intg1 ? from2->buf[0] : + from1->buf[0] + from2->buf[0] ; + if (unlikely(x > DIG_MAX-1)) /* yes, there is */ + { + intg0++; + to->buf[0]=0; /* safety */ + } + + FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error); + if (unlikely(error == E_DEC_OVERFLOW)) + { + max_decimal(to->len * DIG_PER_DEC1, 0, to); + return error; + } + + buf0=to->buf+intg0+frac0; + + to->sign=from1->sign; + to->frac=max(from1->frac, from2->frac); + to->intg=intg0*DIG_PER_DEC1; + if (unlikely(error)) + { + set_if_smaller(to->frac, frac0*DIG_PER_DEC1); + set_if_smaller(frac1, frac0); + set_if_smaller(frac2, frac0); + set_if_smaller(intg1, intg0); + set_if_smaller(intg2, intg0); + } + + /* part 1 - max(frac) ... min (frac) */ + if (frac1 > frac2) + { + buf1=from1->buf+intg1+frac1; + stop=from1->buf+intg1+frac2; + buf2=from2->buf+intg2+frac2; + stop2=from1->buf+(intg1 > intg2 ? intg1-intg2 : 0); + } + else + { + buf1=from2->buf+intg2+frac2; + stop=from2->buf+intg2+frac1; + buf2=from1->buf+intg1+frac1; + stop2=from2->buf+(intg2 > intg1 ? intg2-intg1 : 0); + } + while (buf1 > stop) + *--buf0=*--buf1; + + /* part 2 - min(frac) ... min(intg) */ + carry=0; + while (buf1 > stop2) + { + ADD(*--buf0, *--buf1, *--buf2, carry); + } + + /* part 3 - min(intg) ... max(intg) */ + buf1= intg1 > intg2 ? ((stop=from1->buf)+intg1-intg2) : + ((stop=from2->buf)+intg2-intg1) ; + while (buf1 > stop) + { + ADD(*--buf0, *--buf1, 0, carry); + } + + if (unlikely(carry)) + *--buf0=1; + DBUG_ASSERT(buf0 == to->buf || buf0 == to->buf+1); + + return error; +} + +/* to=from1-from2. + if to==0, return -1/0/+1 - the result of the comparison */ +static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) +{ + int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), + frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac); + int frac0=max(frac1, frac2), error; + dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2, carry=0; + + /* let carry:=1 if from2 > from1 */ + start1=buf1=from1->buf; stop1=buf1+intg1; + start2=buf2=from2->buf; stop2=buf2+intg2; + if (unlikely(*buf1 == 0)) + { + while (buf1 < stop1 && *buf1 == 0) + buf1++; + start1=buf1; + intg1= (int) (stop1-buf1); + } + if (unlikely(*buf2 == 0)) + { + while (buf2 < stop2 && *buf2 == 0) + buf2++; + start2=buf2; + intg2= (int) (stop2-buf2); + } + if (intg2 > intg1) + carry=1; + else if (intg2 == intg1) + { + dec1 *end1= stop1 + (frac1 - 1); + dec1 *end2= stop2 + (frac2 - 1); + while (unlikely((buf1 <= end1) && (*end1 == 0))) + end1--; + while (unlikely((buf2 <= end2) && (*end2 == 0))) + end2--; + frac1= (int) (end1 - stop1) + 1; + frac2= (int) (end2 - stop2) + 1; + while (buf1 <=end1 && buf2 <= end2 && *buf1 == *buf2) + buf1++, buf2++; + if (buf1 <= end1) + { + if (buf2 <= end2) + carry= *buf2 > *buf1; + else + carry= 0; + } + else + { + if (buf2 <= end2) + carry=1; + else /* short-circuit everything: from1 == from2 */ + { + if (to == 0) /* decimal_cmp() */ + return 0; + decimal_make_zero(to); + return E_DEC_OK; + } + } + } + + if (to == 0) /* decimal_cmp() */ + return carry == from1->sign ? 1 : -1; + + sanity(to); + + to->sign=from1->sign; + + /* ensure that always from1 > from2 (and intg1 >= intg2) */ + if (carry) + { + swap_variables(decimal_t *,from1,from1); + swap_variables(dec1 *,start1, start2); + swap_variables(int,intg1,intg2); + swap_variables(int,frac1,frac2); + to->sign= 1 - to->sign; + } + + FIX_INTG_FRAC_ERROR(to->len, intg1, frac0, error); + buf0=to->buf+intg1+frac0; + + to->frac=max(from1->frac, from2->frac); + to->intg=intg1*DIG_PER_DEC1; + if (unlikely(error)) + { + set_if_smaller(to->frac, frac0*DIG_PER_DEC1); + set_if_smaller(frac1, frac0); + set_if_smaller(frac2, frac0); + set_if_smaller(intg2, intg1); + } + carry=0; + + /* part 1 - max(frac) ... min (frac) */ + if (frac1 > frac2) + { + buf1=start1+intg1+frac1; + stop1=start1+intg1+frac2; + buf2=start2+intg2+frac2; + while (frac0-- > frac1) + *--buf0=0; + while (buf1 > stop1) + *--buf0=*--buf1; + } + else + { + buf1=start1+intg1+frac1; + buf2=start2+intg2+frac2; + stop2=start2+intg2+frac1; + while (frac0-- > frac2) + *--buf0=0; + while (buf2 > stop2) + { + SUB(*--buf0, 0, *--buf2, carry); + } + } + + /* part 2 - min(frac) ... intg2 */ + while (buf2 > start2) + { + SUB(*--buf0, *--buf1, *--buf2, carry); + } + + /* part 3 - intg2 ... intg1 */ + while (carry && buf1 > start1) + { + SUB(*--buf0, *--buf1, 0, carry); + } + + while (buf1 > start1) + *--buf0=*--buf1; + + while (buf0 > to->buf) + *--buf0=0; + + return error; +} + +int decimal_intg(decimal_t *from) +{ + int res; + dec1 *tmp_res; + tmp_res= remove_leading_zeroes(from, &res); + return res; +} + +int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to) +{ + if (likely(from1->sign == from2->sign)) + return do_add(from1, from2, to); + return do_sub(from1, from2, to); +} + +int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to) +{ + if (likely(from1->sign == from2->sign)) + return do_sub(from1, from2, to); + return do_add(from1, from2, to); +} + +int decimal_cmp(decimal_t *from1, decimal_t *from2) +{ + if (likely(from1->sign == from2->sign)) + return do_sub(from1, from2, 0); + return from1->sign > from2->sign ? -1 : 1; +} + +int decimal_is_zero(decimal_t *from) +{ + dec1 *buf1=from->buf, + *end=buf1+ROUND_UP(from->intg)+ROUND_UP(from->frac); + while (buf1 < end) + if (*buf1++) + return 0; + return 1; +} + +/* + multiply two decimals + + SYNOPSIS + decimal_mul() + from1, from2 - factors + to - product + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW; + + NOTES + in this implementation, with sizeof(dec1)=4 we have DIG_PER_DEC1=9, + and 63-digit number will take only 7 dec1 words (basically a 7-digit + "base 999999999" number). Thus there's no need in fast multiplication + algorithms, 7-digit numbers can be multiplied with a naive O(n*n) + method. + + XXX if this library is to be used with huge numbers of thousands of + digits, fast multiplication must be implemented. +*/ +int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to) +{ + int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), + frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac), + intg0=ROUND_UP(from1->intg+from2->intg), + frac0=frac1+frac2, error, i, j, d_to_move; + dec1 *buf1=from1->buf+intg1, *buf2=from2->buf+intg2, *buf0, + *start2, *stop2, *stop1, *start0, carry; + + sanity(to); + + i=intg0; /* save 'ideal' values */ + j=frac0; + FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error); /* bound size */ + to->sign=from1->sign != from2->sign; + to->frac=from1->frac+from2->frac; /* store size in digits */ + to->intg=intg0*DIG_PER_DEC1; + + if (unlikely(error)) + { + set_if_smaller(to->frac, frac0*DIG_PER_DEC1); + set_if_smaller(to->intg, intg0*DIG_PER_DEC1); + if (unlikely(i > intg0)) /* bounded integer-part */ + { + i-=intg0; + j=i >> 1; + intg1-= j; + intg2-=i-j; + frac1=frac2=0; /* frac0 is already 0 here */ + } + else /* bounded fract part */ + { + j-=frac0; + i=j >> 1; + if (frac1 <= frac2) + { + frac1-= i; + frac2-=j-i; + } + else + { + frac2-= i; + frac1-=j-i; + } + } + } + start0=to->buf+intg0+frac0-1; + start2=buf2+frac2-1; + stop1=buf1-intg1; + stop2=buf2-intg2; + + bzero(to->buf, (intg0+frac0)*sizeof(dec1)); + + for (buf1+=frac1-1; buf1 >= stop1; buf1--, start0--) + { + carry=0; + for (buf0=start0, buf2=start2; buf2 >= stop2; buf2--, buf0--) + { + dec1 hi, lo; + dec2 p= ((dec2)*buf1) * ((dec2)*buf2); + hi=(dec1)(p/DIG_BASE); + lo=(dec1)(p-((dec2)hi)*DIG_BASE); + ADD2(*buf0, *buf0, lo, carry); + carry+=hi; + } + if (carry) + { + if (buf0 < to->buf) + return E_DEC_OVERFLOW; + ADD2(*buf0, *buf0, 0, carry); + } + for (buf0--; carry; buf0--) + { + if (buf0 < to->buf) + return E_DEC_OVERFLOW; + ADD(*buf0, *buf0, 0, carry); + } + } + + /* Now we have to check for -0.000 case */ + if (to->sign) + { + dec1 *buf= to->buf; + dec1 *end= to->buf + intg0 + frac0; + DBUG_ASSERT(buf != end); + for (;;) + { + if (*buf) + break; + if (++buf == end) + { + /* We got decimal zero */ + decimal_make_zero(to); + break; + } + } + } + buf1= to->buf; + d_to_move= intg0 + ROUND_UP(to->frac); + while (!*buf1 && (to->intg > DIG_PER_DEC1)) + { + buf1++; + to->intg-= DIG_PER_DEC1; + d_to_move--; + } + if (to->buf < buf1) + { + dec1 *cur_d= to->buf; + for (; d_to_move--; cur_d++, buf1++) + *cur_d= *buf1; + } + return error; +} + +/* + naive division algorithm (Knuth's Algorithm D in 4.3.1) - + it's ok for short numbers + also we're using alloca() to allocate a temporary buffer + + XXX if this library is to be used with huge numbers of thousands of + digits, fast division must be implemented and alloca should be + changed to malloc (or at least fallback to malloc if alloca() fails) + but then, decimal_mul() should be rewritten too :( +*/ +static int do_div_mod(decimal_t *from1, decimal_t *from2, + decimal_t *to, decimal_t *mod, int scale_incr) +{ + int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1, + frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2, + error, i, intg0, frac0, len1, len2, dintg, div_mod=(!mod); + dec1 *buf0, *buf1=from1->buf, *buf2=from2->buf, *tmp1, + *start2, *stop2, *stop1, *stop0, norm2, carry, *start1, dcarry; + dec2 norm_factor, x, guess, y; + + LINT_INIT(error); + + if (mod) + to=mod; + + sanity(to); + + /* removing all the leading zeroes */ + i= ((prec2 - 1) % DIG_PER_DEC1) + 1; + while (prec2 > 0 && *buf2 == 0) + { + prec2-= i; + i= DIG_PER_DEC1; + buf2++; + } + if (prec2 <= 0) /* short-circuit everything: from2 == 0 */ + return E_DEC_DIV_ZERO; + for (i= (prec2 - 1) % DIG_PER_DEC1; *buf2 < powers10[i--]; prec2--) ; + DBUG_ASSERT(prec2 > 0); + + i=((prec1-1) % DIG_PER_DEC1)+1; + while (prec1 > 0 && *buf1 == 0) + { + prec1-=i; + i=DIG_PER_DEC1; + buf1++; + } + if (prec1 <= 0) + { /* short-circuit everything: from1 == 0 */ + decimal_make_zero(to); + return E_DEC_OK; + } + for (i=(prec1-1) % DIG_PER_DEC1; *buf1 < powers10[i--]; prec1--) ; + DBUG_ASSERT(prec1 > 0); + + /* let's fix scale_incr, taking into account frac1,frac2 increase */ + if ((scale_incr-= frac1 - from1->frac + frac2 - from2->frac) < 0) + scale_incr=0; + + dintg=(prec1-frac1)-(prec2-frac2)+(*buf1 >= *buf2); + if (dintg < 0) + { + dintg/=DIG_PER_DEC1; + intg0=0; + } + else + intg0=ROUND_UP(dintg); + if (mod) + { + /* we're calculating N1 % N2. + The result will have + frac=max(frac1, frac2), as for subtraction + intg=intg2 + */ + to->sign=from1->sign; + to->frac=max(from1->frac, from2->frac); + frac0=0; + } + else + { + /* + we're calculating N1/N2. N1 is in the buf1, has prec1 digits + N2 is in the buf2, has prec2 digits. Scales are frac1 and + frac2 accordingly. + Thus, the result will have + frac = ROUND_UP(frac1+frac2+scale_incr) + and + intg = (prec1-frac1) - (prec2-frac2) + 1 + prec = intg+frac + */ + frac0=ROUND_UP(frac1+frac2+scale_incr); + FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error); + to->sign=from1->sign != from2->sign; + to->intg=intg0*DIG_PER_DEC1; + to->frac=frac0*DIG_PER_DEC1; + } + buf0=to->buf; + stop0=buf0+intg0+frac0; + if (likely(div_mod)) + while (dintg++ < 0) + *buf0++=0; + + len1=(i=ROUND_UP(prec1))+ROUND_UP(2*frac2+scale_incr+1) + 1; + set_if_bigger(len1, 3); + if (!(tmp1=(dec1 *)my_alloca(len1*sizeof(dec1)))) + return E_DEC_OOM; + memcpy(tmp1, buf1, i*sizeof(dec1)); + bzero(tmp1+i, (len1-i)*sizeof(dec1)); + + start1=tmp1; + stop1=start1+len1; + start2=buf2; + stop2=buf2+ROUND_UP(prec2)-1; + + /* removing end zeroes */ + while (*stop2 == 0 && stop2 >= start2) + stop2--; + len2= (int) (stop2++ - start2); + + /* + calculating norm2 (normalized *start2) - we need *start2 to be large + (at least > DIG_BASE/2), but unlike Knuth's Alg. D we don't want to + normalize input numbers (as we don't make a copy of the divisor). + Thus we normalize first dec1 of buf2 only, and we'll normalize *start1 + on the fly for the purpose of guesstimation only. + It's also faster, as we're saving on normalization of buf2 + */ + norm_factor=DIG_BASE/(*start2+1); + norm2=(dec1)(norm_factor*start2[0]); + if (likely(len2>0)) + norm2+=(dec1)(norm_factor*start2[1]/DIG_BASE); + + if (*start1 < *start2) + dcarry=*start1++; + else + dcarry=0; + + /* main loop */ + for (; buf0 < stop0; buf0++) + { + /* short-circuit, if possible */ + if (unlikely(dcarry == 0 && *start1 < *start2)) + guess=0; + else + { + /* D3: make a guess */ + x=start1[0]+((dec2)dcarry)*DIG_BASE; + y=start1[1]; + guess=(norm_factor*x+norm_factor*y/DIG_BASE)/norm2; + if (unlikely(guess >= DIG_BASE)) + guess=DIG_BASE-1; + if (likely(len2>0)) + { + /* hmm, this is a suspicious trick - I removed normalization here */ + if (start2[1]*guess > (x-guess*start2[0])*DIG_BASE+y) + guess--; + if (unlikely(start2[1]*guess > (x-guess*start2[0])*DIG_BASE+y)) + guess--; + DBUG_ASSERT(start2[1]*guess <= (x-guess*start2[0])*DIG_BASE+y); + } + + /* D4: multiply and subtract */ + buf2=stop2; + buf1=start1+len2; + DBUG_ASSERT(buf1 < stop1); + for (carry=0; buf2 > start2; buf1--) + { + dec1 hi, lo; + x=guess * (*--buf2); + hi=(dec1)(x/DIG_BASE); + lo=(dec1)(x-((dec2)hi)*DIG_BASE); + SUB2(*buf1, *buf1, lo, carry); + carry+=hi; + } + carry= dcarry < carry; + + /* D5: check the remainder */ + if (unlikely(carry)) + { + /* D6: correct the guess */ + guess--; + buf2=stop2; + buf1=start1+len2; + for (carry=0; buf2 > start2; buf1--) + { + ADD(*buf1, *buf1, *--buf2, carry); + } + } + } + if (likely(div_mod)) + *buf0=(dec1)guess; + dcarry= *start1; + start1++; + } + if (mod) + { + /* + now the result is in tmp1, it has + intg=prec1-frac1 + frac=max(frac1, frac2)=to->frac + */ + if (dcarry) + *--start1=dcarry; + buf0=to->buf; + intg0=(int) (ROUND_UP(prec1-frac1)-(start1-tmp1)); + frac0=ROUND_UP(to->frac); + error=E_DEC_OK; + if (unlikely(frac0==0 && intg0==0)) + { + decimal_make_zero(to); + goto done; + } + if (intg0<=0) + { + if (unlikely(-intg0 >= to->len)) + { + decimal_make_zero(to); + error=E_DEC_TRUNCATED; + goto done; + } + stop1=start1+frac0; + frac0+=intg0; + to->intg=0; + while (intg0++ < 0) + *buf0++=0; + } + else + { + if (unlikely(intg0 > to->len)) + { + frac0=0; + intg0=to->len; + error=E_DEC_OVERFLOW; + goto done; + } + DBUG_ASSERT(intg0 <= ROUND_UP(from2->intg)); + stop1=start1+frac0+intg0; + to->intg=min(intg0*DIG_PER_DEC1, from2->intg); + } + if (unlikely(intg0+frac0 > to->len)) + { + stop1-=frac0+intg0-to->len; + frac0=to->len-intg0; + to->frac=frac0*DIG_PER_DEC1; + error=E_DEC_TRUNCATED; + } + DBUG_ASSERT(buf0 + (stop1 - start1) <= to->buf + to->len); + while (start1 < stop1) + *buf0++=*start1++; + } +done: + my_afree(tmp1); + return error; +} + +/* + division of two decimals + + SYNOPSIS + decimal_div() + from1 - dividend + from2 - divisor + to - quotient + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW/E_DEC_DIV_ZERO; + + NOTES + see do_div_mod() +*/ + +int +decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to, int scale_incr) +{ + return do_div_mod(from1, from2, to, 0, scale_incr); +} + +/* + modulus + + SYNOPSIS + decimal_mod() + from1 - dividend + from2 - divisor + to - modulus + + RETURN VALUE + E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW/E_DEC_DIV_ZERO; + + NOTES + see do_div_mod() + + DESCRIPTION + the modulus R in R = M mod N + + is defined as + + 0 <= |R| < |M| + sign R == sign M + R = M - k*N, where k is integer + + thus, there's no requirement for M or N to be integers +*/ + +int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to) +{ + return do_div_mod(from1, from2, 0, to, 0); +} + +#ifdef MAIN + +int full= 0; +decimal_t a, b, c; +char buf1[100], buf2[100], buf3[100]; + +void dump_decimal(decimal_t *d) +{ + int i; + printf("/* intg=%d, frac=%d, sign=%d, buf[]={", d->intg, d->frac, d->sign); + for (i=0; i < ROUND_UP(d->frac)+ROUND_UP(d->intg)-1; i++) + printf("%09d, ", d->buf[i]); + printf("%09d} */ ", d->buf[i]); +} + + +void check_result_code(int actual, int want) +{ + if (actual != want) + { + printf("\n^^^^^^^^^^^^^ must return %d\n", want); + exit(1); + } +} + + +void print_decimal(decimal_t *d, const char *orig, int actual, int want) +{ + char s[100]; + int slen=sizeof(s); + + if (full) dump_decimal(d); + decimal2string(d, s, &slen, 0, 0, 0); + printf("'%s'", s); + check_result_code(actual, want); + if (orig && strcmp(orig, s)) + { + printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig); + exit(1); + } +} + +void test_d2s() +{ + char s[100]; + int slen, res; + + /***********************************/ + printf("==== decimal2string ====\n"); + a.buf[0]=12345; a.intg=5; a.frac=0; a.sign=0; + slen=sizeof(s); + res=decimal2string(&a, s, &slen, 0, 0, 0); + dump_decimal(&a); printf(" --> res=%d str='%s' len=%d\n", res, s, slen); + + a.buf[1]=987000000; a.frac=3; + slen=sizeof(s); + res=decimal2string(&a, s, &slen, 0, 0, 0); + dump_decimal(&a); printf(" --> res=%d str='%s' len=%d\n", res, s, slen); + + a.sign=1; + slen=sizeof(s); + res=decimal2string(&a, s, &slen, 0, 0, 0); + dump_decimal(&a); printf(" --> res=%d str='%s' len=%d\n", res, s, slen); + + slen=8; + res=decimal2string(&a, s, &slen, 0, 0, 0); + dump_decimal(&a); printf(" --> res=%d str='%s' len=%d\n", res, s, slen); + + slen=5; + res=decimal2string(&a, s, &slen, 0, 0, 0); + dump_decimal(&a); printf(" --> res=%d str='%s' len=%d\n", res, s, slen); + + a.buf[0]=987000000; a.frac=3; a.intg=0; + slen=sizeof(s); + res=decimal2string(&a, s, &slen, 0, 0, 0); + dump_decimal(&a); printf(" --> res=%d str='%s' len=%d\n", res, s, slen); +} + +void test_s2d(const char *s, const char *orig, int ex) +{ + char s1[100], *end; + int res; + sprintf(s1, "'%s'", s); + end= strend(s); + printf("len=%2d %-30s => res=%d ", a.len, s1, + (res= string2decimal(s, &a, &end))); + print_decimal(&a, orig, res, ex); + printf("\n"); +} + +void test_d2f(const char *s, int ex) +{ + char s1[100], *end; + double x; + int res; + + sprintf(s1, "'%s'", s); + end= strend(s); + string2decimal(s, &a, &end); + res=decimal2double(&a, &x); + if (full) dump_decimal(&a); + printf("%-40s => res=%d %.*g\n", s1, res, a.intg+a.frac, x); + check_result_code(res, ex); +} + +void test_d2b2d(const char *str, int p, int s, const char *orig, int ex) +{ + char s1[100], buf[100], *end; + int res, i, size=decimal_bin_size(p, s); + + sprintf(s1, "'%s'", str); + end= strend(str); + string2decimal(str, &a, &end); + res=decimal2bin(&a, buf, p, s); + printf("%-31s {%2d, %2d} => res=%d size=%-2d ", s1, p, s, res, size); + if (full) + { + printf("0x"); + for (i=0; i < size; i++) + printf("%02x", ((uchar *)buf)[i]); + } + res=bin2decimal(buf, &a, p, s); + printf(" => res=%d ", res); + print_decimal(&a, orig, res, ex); + printf("\n"); +} + +void test_f2d(double from, int ex) +{ + int res; + + res=double2decimal(from, &a); + printf("%-40.*f => res=%d ", DBL_DIG-2, from, res); + print_decimal(&a, 0, res, ex); + printf("\n"); +} + +void test_ull2d(ulonglong from, const char *orig, int ex) +{ + char s[100]; + int res; + + res=ulonglong2decimal(from, &a); + longlong10_to_str(from,s,10); + printf("%-40s => res=%d ", s, res); + print_decimal(&a, orig, res, ex); + printf("\n"); +} + +void test_ll2d(longlong from, const char *orig, int ex) +{ + char s[100]; + int res; + + res=longlong2decimal(from, &a); + longlong10_to_str(from,s,-10); + printf("%-40s => res=%d ", s, res); + print_decimal(&a, orig, res, ex); + printf("\n"); +} + +void test_d2ull(const char *s, const char *orig, int ex) +{ + char s1[100], *end; + ulonglong x; + int res; + + end= strend(s); + string2decimal(s, &a, &end); + res=decimal2ulonglong(&a, &x); + if (full) dump_decimal(&a); + longlong10_to_str(x,s1,10); + printf("%-40s => res=%d %s\n", s, res, s1); + check_result_code(res, ex); + if (orig && strcmp(orig, s1)) + { + printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig); + exit(1); + } +} + +void test_d2ll(const char *s, const char *orig, int ex) +{ + char s1[100], *end; + longlong x; + int res; + + end= strend(s); + string2decimal(s, &a, &end); + res=decimal2longlong(&a, &x); + if (full) dump_decimal(&a); + longlong10_to_str(x,s1,-10); + printf("%-40s => res=%d %s\n", s, res, s1); + check_result_code(res, ex); + if (orig && strcmp(orig, s1)) + { + printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig); + exit(1); + } +} + +void test_da(const char *s1, const char *s2, const char *orig, int ex) +{ + char s[100], *end; + int res; + sprintf(s, "'%s' + '%s'", s1, s2); + end= strend(s1); + string2decimal(s1, &a, &end); + end= strend(s2); + string2decimal(s2, &b, &end); + res=decimal_add(&a, &b, &c); + printf("%-40s => res=%d ", s, res); + print_decimal(&c, orig, res, ex); + printf("\n"); +} + +void test_ds(const char *s1, const char *s2, const char *orig, int ex) +{ + char s[100], *end; + int res; + sprintf(s, "'%s' - '%s'", s1, s2); + end= strend(s1); + string2decimal(s1, &a, &end); + end= strend(s2); + string2decimal(s2, &b, &end); + res=decimal_sub(&a, &b, &c); + printf("%-40s => res=%d ", s, res); + print_decimal(&c, orig, res, ex); + printf("\n"); +} + +void test_dc(const char *s1, const char *s2, int orig) +{ + char s[100], *end; + int res; + sprintf(s, "'%s' <=> '%s'", s1, s2); + end= strend(s1); + string2decimal(s1, &a, &end); + end= strend(s2); + string2decimal(s2, &b, &end); + res=decimal_cmp(&a, &b); + printf("%-40s => res=%d\n", s, res); + if (orig != res) + { + printf("\n^^^^^^^^^^^^^ must've been %d\n", orig); + exit(1); + } +} + +void test_dm(const char *s1, const char *s2, const char *orig, int ex) +{ + char s[100], *end; + int res; + sprintf(s, "'%s' * '%s'", s1, s2); + end= strend(s1); + string2decimal(s1, &a, &end); + end= strend(s2); + string2decimal(s2, &b, &end); + res=decimal_mul(&a, &b, &c); + printf("%-40s => res=%d ", s, res); + print_decimal(&c, orig, res, ex); + printf("\n"); +} + +void test_dv(const char *s1, const char *s2, const char *orig, int ex) +{ + char s[100], *end; + int res; + sprintf(s, "'%s' / '%s'", s1, s2); + end= strend(s1); + string2decimal(s1, &a, &end); + end= strend(s2); + string2decimal(s2, &b, &end); + res=decimal_div(&a, &b, &c, 5); + printf("%-40s => res=%d ", s, res); + check_result_code(res, ex); + if (res == E_DEC_DIV_ZERO) + printf("E_DEC_DIV_ZERO"); + else + print_decimal(&c, orig, res, ex); + printf("\n"); +} + +void test_md(const char *s1, const char *s2, const char *orig, int ex) +{ + char s[100], *end; + int res; + sprintf(s, "'%s' %% '%s'", s1, s2); + end= strend(s1); + string2decimal(s1, &a, &end); + end= strend(s2); + string2decimal(s2, &b, &end); + res=decimal_mod(&a, &b, &c); + printf("%-40s => res=%d ", s, res); + check_result_code(res, ex); + if (res == E_DEC_DIV_ZERO) + printf("E_DEC_DIV_ZERO"); + else + print_decimal(&c, orig, res, ex); + printf("\n"); +} + +const char *round_mode[]= +{"TRUNCATE", "HALF_EVEN", "HALF_UP", "CEILING", "FLOOR"}; + +void test_ro(const char *s1, int n, decimal_round_mode mode, const char *orig, + int ex) +{ + char s[100], *end; + int res; + sprintf(s, "'%s', %d, %s", s1, n, round_mode[mode]); + end= strend(s1); + string2decimal(s1, &a, &end); + res=decimal_round(&a, &b, n, mode); + printf("%-40s => res=%d ", s, res); + print_decimal(&b, orig, res, ex); + printf("\n"); +} + + +void test_mx(int precision, int frac, const char *orig) +{ + char s[100]; + sprintf(s, "%d, %d", precision, frac); + max_decimal(precision, frac, &a); + printf("%-40s => ", s); + print_decimal(&a, orig, 0, 0); + printf("\n"); +} + + +void test_pr(const char *s1, int prec, int dec, char filler, const char *orig, + int ex) +{ + char s[100], *end; + char s2[100]; + int slen= sizeof(s2); + int res; + + sprintf(s, filler ? "'%s', %d, %d, '%c'" : "'%s', %d, %d, '\\0'", + s1, prec, dec, filler); + end= strend(s1); + string2decimal(s1, &a, &end); + res= decimal2string(&a, s2, &slen, prec, dec, filler); + printf("%-40s => res=%d '%s'", s, res, s2); + check_result_code(res, ex); + if (orig && strcmp(orig, s2)) + { + printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig); + exit(1); + } + printf("\n"); +} + + +void test_sh(const char *s1, int shift, const char *orig, int ex) +{ + char s[100], *end; + int res; + sprintf(s, "'%s' %s %d", s1, ((shift < 0) ? ">>" : "<<"), abs(shift)); + end= strend(s1); + string2decimal(s1, &a, &end); + res= decimal_shift(&a, shift); + printf("%-40s => res=%d ", s, res); + print_decimal(&a, orig, res, ex); + printf("\n"); +} + + +void test_fr(const char *s1, const char *orig) +{ + char s[100], *end; + sprintf(s, "'%s'", s1); + printf("%-40s => ", s); + end= strend(s1); + string2decimal(s1, &a, &end); + a.frac= decimal_actual_fraction(&a); + print_decimal(&a, orig, 0, 0); + printf("\n"); +} + + +int main() +{ + a.buf=(void*)buf1; + a.len=sizeof(buf1)/sizeof(dec1); + b.buf=(void*)buf2; + b.len=sizeof(buf2)/sizeof(dec1); + c.buf=(void*)buf3; + c.len=sizeof(buf3)/sizeof(dec1); + + if (full) + test_d2s(); + + printf("==== string2decimal ====\n"); + test_s2d("12345", "12345", 0); + test_s2d("12345.", "12345", 0); + test_s2d("123.45", "123.45", 0); + test_s2d("-123.45", "-123.45", 0); + test_s2d(".00012345000098765", "0.00012345000098765", 0); + test_s2d(".12345000098765", "0.12345000098765", 0); + test_s2d("-.000000012345000098765", "-0.000000012345000098765", 0); + test_s2d("1234500009876.5", "1234500009876.5", 0); + a.len=1; + test_s2d("123450000098765", "98765", 2); + test_s2d("123450.000098765", "123450", 1); + a.len=sizeof(buf1)/sizeof(dec1); + test_s2d("123E5", "12300000", 0); + test_s2d("123E-2", "1.23", 0); + + printf("==== decimal2double ====\n"); + test_d2f("12345", 0); + test_d2f("123.45", 0); + test_d2f("-123.45", 0); + test_d2f("0.00012345000098765", 0); + test_d2f("1234500009876.5", 0); + + printf("==== double2decimal ====\n"); + test_f2d(12345, 0); + test_f2d(1.0/3, 0); + test_f2d(-123.45, 0); + test_f2d(0.00012345000098765, 0); + test_f2d(1234500009876.5, 0); + + printf("==== ulonglong2decimal ====\n"); + test_ull2d(12345ULL, "12345", 0); + test_ull2d(0ULL, "0", 0); + test_ull2d(18446744073709551615ULL, "18446744073709551615", 0); + + printf("==== decimal2ulonglong ====\n"); + test_d2ull("12345", "12345", 0); + test_d2ull("0", "0", 0); + test_d2ull("18446744073709551615", "18446744073709551615", 0); + test_d2ull("18446744073709551616", "18446744073", 2); + test_d2ull("-1", "0", 2); + test_d2ull("1.23", "1", 1); + test_d2ull("9999999999999999999999999.000", "9999999999999999", 2); + + printf("==== longlong2decimal ====\n"); + test_ll2d(-12345LL, "-12345", 0); + test_ll2d(-1LL, "-1", 0); + test_ll2d(-9223372036854775807LL, "-9223372036854775807", 0); + test_ll2d(9223372036854775808ULL, "-9223372036854775808", 0); + + printf("==== decimal2longlong ====\n"); + test_d2ll("18446744073709551615", "18446744073", 2); + test_d2ll("-1", "-1", 0); + test_d2ll("-1.23", "-1", 1); + test_d2ll("-9223372036854775807", "-9223372036854775807", 0); + test_d2ll("-9223372036854775808", "-9223372036854775808", 0); + test_d2ll("9223372036854775808", "9223372036854775807", 2); + + printf("==== do_add ====\n"); + test_da(".00012345000098765" ,"123.45", "123.45012345000098765", 0); + test_da(".1" ,".45", "0.55", 0); + test_da("1234500009876.5" ,".00012345000098765", "1234500009876.50012345000098765", 0); + test_da("9999909999999.5" ,".555", "9999910000000.055", 0); + test_da("99999999" ,"1", "100000000", 0); + test_da("989999999" ,"1", "990000000", 0); + test_da("999999999" ,"1", "1000000000", 0); + test_da("12345" ,"123.45", "12468.45", 0); + test_da("-12345" ,"-123.45", "-12468.45", 0); + test_ds("-12345" ,"123.45", "-12468.45", 0); + test_ds("12345" ,"-123.45", "12468.45", 0); + + printf("==== do_sub ====\n"); + test_ds(".00012345000098765", "123.45","-123.44987654999901235", 0); + test_ds("1234500009876.5", ".00012345000098765","1234500009876.49987654999901235", 0); + test_ds("9999900000000.5", ".555","9999899999999.945", 0); + test_ds("1111.5551", "1111.555","0.0001", 0); + test_ds(".555", ".555","0", 0); + test_ds("10000000", "1","9999999", 0); + test_ds("1000001000", ".1","1000000999.9", 0); + test_ds("1000000000", ".1","999999999.9", 0); + test_ds("12345", "123.45","12221.55", 0); + test_ds("-12345", "-123.45","-12221.55", 0); + test_da("-12345", "123.45","-12221.55", 0); + test_da("12345", "-123.45","12221.55", 0); + test_ds("123.45", "12345","-12221.55", 0); + test_ds("-123.45", "-12345","12221.55", 0); + test_da("123.45", "-12345","-12221.55", 0); + test_da("-123.45", "12345","12221.55", 0); + test_da("5", "-6.0","-1.0", 0); + + printf("==== decimal_mul ====\n"); + test_dm("12", "10","120", 0); + test_dm("-123.456", "98765.4321","-12193185.1853376", 0); + test_dm("-123456000000", "98765432100000","-12193185185337600000000000", 0); + test_dm("123456", "987654321","121931851853376", 0); + test_dm("123456", "9876543210","1219318518533760", 0); + test_dm("123", "0.01","1.23", 0); + test_dm("123", "0","0", 0); + + printf("==== decimal_div ====\n"); + test_dv("120", "10","12.000000000", 0); + test_dv("123", "0.01","12300.000000000", 0); + test_dv("120", "100000000000.00000","0.000000001200000000", 0); + test_dv("123", "0","", 4); + test_dv("0", "0", "", 4); + test_dv("-12193185.1853376", "98765.4321","-123.456000000000000000", 0); + test_dv("121931851853376", "987654321","123456.000000000", 0); + test_dv("0", "987","0", 0); + test_dv("1", "3","0.333333333", 0); + test_dv("1.000000000000", "3","0.333333333333333333", 0); + test_dv("1", "1","1.000000000", 0); + test_dv("0.0123456789012345678912345", "9999999999","0.000000000001234567890246913578148141", 0); + test_dv("10.333000000", "12.34500","0.837019036046982584042122316", 0); + test_dv("10.000000000060", "2","5.000000000030000000", 0); + + printf("==== decimal_mod ====\n"); + test_md("234","10","4", 0); + test_md("234.567","10.555","2.357", 0); + test_md("-234.567","10.555","-2.357", 0); + test_md("234.567","-10.555","2.357", 0); + c.buf[1]=0x3ABECA; + test_md("99999999999999999999999999999999999999","3","0", 0); + if (c.buf[1] != 0x3ABECA) + { + printf("%X - overflow\n", c.buf[1]); + exit(1); + } + + printf("==== decimal2bin/bin2decimal ====\n"); + test_d2b2d("-10.55", 4, 2,"-10.55", 0); + test_d2b2d("0.0123456789012345678912345", 30, 25,"0.0123456789012345678912345", 0); + test_d2b2d("12345", 5, 0,"12345", 0); + test_d2b2d("12345", 10, 3,"12345.000", 0); + test_d2b2d("123.45", 10, 3,"123.450", 0); + test_d2b2d("-123.45", 20, 10,"-123.4500000000", 0); + test_d2b2d(".00012345000098765", 15, 14,"0.00012345000098", 0); + test_d2b2d(".00012345000098765", 22, 20,"0.00012345000098765000", 0); + test_d2b2d(".12345000098765", 30, 20,"0.12345000098765000000", 0); + test_d2b2d("-.000000012345000098765", 30, 20,"-0.00000001234500009876", 0); + test_d2b2d("1234500009876.5", 30, 5,"1234500009876.50000", 0); + test_d2b2d("111111111.11", 10, 2,"11111111.11", 0); + test_d2b2d("000000000.01", 7, 3,"0.010", 0); + test_d2b2d("123.4", 10, 2, "123.40", 0); + + + printf("==== decimal_cmp ====\n"); + test_dc("12","13",-1); + test_dc("13","12",1); + test_dc("-10","10",-1); + test_dc("10","-10",1); + test_dc("-12","-13",1); + test_dc("0","12",-1); + test_dc("-10","0",-1); + test_dc("4","4",0); + + printf("==== decimal_round ====\n"); + test_ro("5678.123451",-4,TRUNCATE,"0", 0); + test_ro("5678.123451",-3,TRUNCATE,"5000", 0); + test_ro("5678.123451",-2,TRUNCATE,"5600", 0); + test_ro("5678.123451",-1,TRUNCATE,"5670", 0); + test_ro("5678.123451",0,TRUNCATE,"5678", 0); + test_ro("5678.123451",1,TRUNCATE,"5678.1", 0); + test_ro("5678.123451",2,TRUNCATE,"5678.12", 0); + test_ro("5678.123451",3,TRUNCATE,"5678.123", 0); + test_ro("5678.123451",4,TRUNCATE,"5678.1234", 0); + test_ro("5678.123451",5,TRUNCATE,"5678.12345", 0); + test_ro("5678.123451",6,TRUNCATE,"5678.123451", 0); + test_ro("-5678.123451",-4,TRUNCATE,"0", 0); + memset(buf2, 33, sizeof(buf2)); + test_ro("99999999999999999999999999999999999999",-31,TRUNCATE,"99999990000000000000000000000000000000", 0); + test_ro("15.1",0,HALF_UP,"15", 0); + test_ro("15.5",0,HALF_UP,"16", 0); + test_ro("15.9",0,HALF_UP,"16", 0); + test_ro("-15.1",0,HALF_UP,"-15", 0); + test_ro("-15.5",0,HALF_UP,"-16", 0); + test_ro("-15.9",0,HALF_UP,"-16", 0); + test_ro("15.1",1,HALF_UP,"15.1", 0); + test_ro("-15.1",1,HALF_UP,"-15.1", 0); + test_ro("15.17",1,HALF_UP,"15.2", 0); + test_ro("15.4",-1,HALF_UP,"20", 0); + test_ro("-15.4",-1,HALF_UP,"-20", 0); + test_ro("5.4",-1,HALF_UP,"10", 0); + test_ro(".999", 0, HALF_UP, "1", 0); + memset(buf2, 33, sizeof(buf2)); + test_ro("999999999", -9, HALF_UP, "1000000000", 0); + test_ro("15.1",0,HALF_EVEN,"15", 0); + test_ro("15.5",0,HALF_EVEN,"16", 0); + test_ro("14.5",0,HALF_EVEN,"14", 0); + test_ro("15.9",0,HALF_EVEN,"16", 0); + test_ro("15.1",0,CEILING,"16", 0); + test_ro("-15.1",0,CEILING,"-15", 0); + test_ro("15.1",0,FLOOR,"15", 0); + test_ro("-15.1",0,FLOOR,"-16", 0); + test_ro("999999999999999999999.999", 0, CEILING,"1000000000000000000000", 0); + test_ro("-999999999999999999999.999", 0, FLOOR,"-1000000000000000000000", 0); + + b.buf[0]=DIG_BASE+1; + b.buf++; + test_ro(".3", 0, HALF_UP, "0", 0); + b.buf--; + if (b.buf[0] != DIG_BASE+1) + { + printf("%d - underflow\n", b.buf[0]); + exit(1); + } + + printf("==== max_decimal ====\n"); + test_mx(1,1,"0.9"); + test_mx(1,0,"9"); + test_mx(2,1,"9.9"); + test_mx(4,2,"99.99"); + test_mx(6,3,"999.999"); + test_mx(8,4,"9999.9999"); + test_mx(10,5,"99999.99999"); + test_mx(12,6,"999999.999999"); + test_mx(14,7,"9999999.9999999"); + test_mx(16,8,"99999999.99999999"); + test_mx(18,9,"999999999.999999999"); + test_mx(20,10,"9999999999.9999999999"); + test_mx(20,20,"0.99999999999999999999"); + test_mx(20,0,"99999999999999999999"); + test_mx(40,20,"99999999999999999999.99999999999999999999"); + + printf("==== decimal2string ====\n"); + test_pr("123.123", 0, 0, 0, "123.123", 0); + test_pr("123.123", 7, 3, '0', "123.123", 0); + test_pr("123.123", 9, 3, '0', "00123.123", 0); + test_pr("123.123", 9, 4, '0', "0123.1230", 0); + test_pr("123.123", 9, 5, '0', "123.12300", 0); + test_pr("123.123", 9, 2, '0', "000123.12", 1); + test_pr("123.123", 9, 6, '0', "23.123000", 2); + + printf("==== decimal_shift ====\n"); + test_sh("123.123", 1, "1231.23", 0); + test_sh("123457189.123123456789000", 1, "1234571891.23123456789", 0); + test_sh("123457189.123123456789000", 4, "1234571891231.23456789", 0); + test_sh("123457189.123123456789000", 8, "12345718912312345.6789", 0); + test_sh("123457189.123123456789000", 9, "123457189123123456.789", 0); + test_sh("123457189.123123456789000", 10, "1234571891231234567.89", 0); + test_sh("123457189.123123456789000", 17, "12345718912312345678900000", 0); + test_sh("123457189.123123456789000", 18, "123457189123123456789000000", 0); + test_sh("123457189.123123456789000", 19, "1234571891231234567890000000", 0); + test_sh("123457189.123123456789000", 26, "12345718912312345678900000000000000", 0); + test_sh("123457189.123123456789000", 27, "123457189123123456789000000000000000", 0); + test_sh("123457189.123123456789000", 28, "1234571891231234567890000000000000000", 0); + test_sh("000000000000000000000000123457189.123123456789000", 26, "12345718912312345678900000000000000", 0); + test_sh("00000000123457189.123123456789000", 27, "123457189123123456789000000000000000", 0); + test_sh("00000000000000000123457189.123123456789000", 28, "1234571891231234567890000000000000000", 0); + test_sh("123", 1, "1230", 0); + test_sh("123", 10, "1230000000000", 0); + test_sh(".123", 1, "1.23", 0); + test_sh(".123", 10, "1230000000", 0); + test_sh(".123", 14, "12300000000000", 0); + test_sh("000.000", 1000, "0", 0); + test_sh("000.", 1000, "0", 0); + test_sh(".000", 1000, "0", 0); + test_sh("1", 1000, "1", 2); + test_sh("123.123", -1, "12.3123", 0); + test_sh("123987654321.123456789000", -1, "12398765432.1123456789", 0); + test_sh("123987654321.123456789000", -2, "1239876543.21123456789", 0); + test_sh("123987654321.123456789000", -3, "123987654.321123456789", 0); + test_sh("123987654321.123456789000", -8, "1239.87654321123456789", 0); + test_sh("123987654321.123456789000", -9, "123.987654321123456789", 0); + test_sh("123987654321.123456789000", -10, "12.3987654321123456789", 0); + test_sh("123987654321.123456789000", -11, "1.23987654321123456789", 0); + test_sh("123987654321.123456789000", -12, "0.123987654321123456789", 0); + test_sh("123987654321.123456789000", -13, "0.0123987654321123456789", 0); + test_sh("123987654321.123456789000", -14, "0.00123987654321123456789", 0); + test_sh("00000087654321.123456789000", -14, "0.00000087654321123456789", 0); + a.len= 2; + test_sh("123.123", -2, "1.23123", 0); + test_sh("123.123", -3, "0.123123", 0); + test_sh("123.123", -6, "0.000123123", 0); + test_sh("123.123", -7, "0.0000123123", 0); + test_sh("123.123", -15, "0.000000000000123123", 0); + test_sh("123.123", -16, "0.000000000000012312", 1); + test_sh("123.123", -17, "0.000000000000001231", 1); + test_sh("123.123", -18, "0.000000000000000123", 1); + test_sh("123.123", -19, "0.000000000000000012", 1); + test_sh("123.123", -20, "0.000000000000000001", 1); + test_sh("123.123", -21, "0", 1); + test_sh(".000000000123", -1, "0.0000000000123", 0); + test_sh(".000000000123", -6, "0.000000000000000123", 0); + test_sh(".000000000123", -7, "0.000000000000000012", 1); + test_sh(".000000000123", -8, "0.000000000000000001", 1); + test_sh(".000000000123", -9, "0", 1); + test_sh(".000000000123", 1, "0.00000000123", 0); + test_sh(".000000000123", 8, "0.0123", 0); + test_sh(".000000000123", 9, "0.123", 0); + test_sh(".000000000123", 10, "1.23", 0); + test_sh(".000000000123", 17, "12300000", 0); + test_sh(".000000000123", 18, "123000000", 0); + test_sh(".000000000123", 19, "1230000000", 0); + test_sh(".000000000123", 20, "12300000000", 0); + test_sh(".000000000123", 21, "123000000000", 0); + test_sh(".000000000123", 22, "1230000000000", 0); + test_sh(".000000000123", 23, "12300000000000", 0); + test_sh(".000000000123", 24, "123000000000000", 0); + test_sh(".000000000123", 25, "1230000000000000", 0); + test_sh(".000000000123", 26, "12300000000000000", 0); + test_sh(".000000000123", 27, "123000000000000000", 0); + test_sh(".000000000123", 28, "0.000000000123", 2); + test_sh("123456789.987654321", -1, "12345678.998765432", 1); + test_sh("123456789.987654321", -2, "1234567.899876543", 1); + test_sh("123456789.987654321", -8, "1.234567900", 1); + test_sh("123456789.987654321", -9, "0.123456789987654321", 0); + test_sh("123456789.987654321", -10, "0.012345678998765432", 1); + test_sh("123456789.987654321", -17, "0.000000001234567900", 1); + test_sh("123456789.987654321", -18, "0.000000000123456790", 1); + test_sh("123456789.987654321", -19, "0.000000000012345679", 1); + test_sh("123456789.987654321", -26, "0.000000000000000001", 1); + test_sh("123456789.987654321", -27, "0", 1); + test_sh("123456789.987654321", 1, "1234567900", 1); + test_sh("123456789.987654321", 2, "12345678999", 1); + test_sh("123456789.987654321", 4, "1234567899877", 1); + test_sh("123456789.987654321", 8, "12345678998765432", 1); + test_sh("123456789.987654321", 9, "123456789987654321", 0); + test_sh("123456789.987654321", 10, "123456789.987654321", 2); + test_sh("123456789.987654321", 0, "123456789.987654321", 0); + a.len= sizeof(buf1)/sizeof(dec1); + + printf("==== decimal_actual_fraction ====\n"); + test_fr("1.123456789000000000", "1.123456789"); + test_fr("1.12345678000000000", "1.12345678"); + test_fr("1.1234567000000000", "1.1234567"); + test_fr("1.123456000000000", "1.123456"); + test_fr("1.12345000000000", "1.12345"); + test_fr("1.1234000000000", "1.1234"); + test_fr("1.123000000000", "1.123"); + test_fr("1.12000000000", "1.12"); + test_fr("1.1000000000", "1.1"); + test_fr("1.000000000", "1"); + test_fr("1.0", "1"); + test_fr("10000000000000000000.0", "10000000000000000000"); + + return 0; +} +#endif diff --git a/externals/mysql/strings/do_ctype.c b/externals/mysql/strings/do_ctype.c new file mode 100644 index 0000000..f33ddc5 --- /dev/null +++ b/externals/mysql/strings/do_ctype.c @@ -0,0 +1,198 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Prints case-convert and sort-convert tabell on stdout. This is used to + make _ctype.c easyer */ + +#ifdef DBUG_OFF +#undef DBUG_OFF +#endif + +#include +#include +#include +#include "m_string.h" + +uchar NEAR to_upper[256]; +uchar NEAR to_lower[256],NEAR sort_order[256]; + +static int ascii_output=1; +static string tab_names[]={ "to_lower[]={","to_upper[]={","sort_order[]={" }; +static uchar* tabell[]= {to_lower,to_upper,sort_order}; + +void get_options(),init_case_convert(); + +main(argc,argv) +int argc; +char *argv[]; +{ + int i,j,ch; + DBUG_ENTER ("main"); + DBUG_PROCESS (argv[0]); + + get_options(&argc,&argv); + init_case_convert(); + puts("Tabells for caseconverts and sorttest of characters\n"); + for (i=0 ; i < 3 ; i++) + { + printf("uchar NEAR %s\n",tab_names[i]); + for (j=0 ; j <= 255 ; j++) + { + ch=(int) tabell[i][j]; + if (ascii_output && isprint(ch) && ! (ch & 128)) + { + if (strchr("\\'",(char) ch)) + printf("'\\%c', ",ch); + else + printf("'%c', ",ch); + } + else + printf("'\\%03o',",ch); + if ((j+1 & 7) == 0) + puts(""); + } + puts("};\n"); + } + DBUG_RETURN(0); +} /* main */ + + /* Read options */ + +void get_options(argc,argv) +register int *argc; +register char **argv[]; +{ + int help,version; + char *pos,*progname; + + progname= (*argv)[0]; + help=0; ascii_output=1; + while (--*argc >0 && *(pos = *(++*argv)) == '-' ) + { + while (*++pos) + { + version=0; + switch(*pos) { + case 'n': /* Numeric output */ + ascii_output=0; + break; + case '#': + DBUG_PUSH (++pos); + *(pos--) = '\0'; /* Skippa argument */ + break; + case 'V': + version=1; + case 'I': + case '?': + printf("%s Ver 1.0\n",progname); + if (version) + break; + puts("Output tabells of to_lower[], to_upper[] and sortorder[]\n"); + printf("Usage: %s [-n?I]\n",progname); + puts("Options: -? or -I \"Info\" -n \"numeric output\""); + break; + default: + fprintf(stderr,"illegal option: -%c\n",*pos); + break; + } + } + } + return; +} /* get_options */ + + + /* set up max character for which isupper() and toupper() gives */ + /* right answer. Is usually 127 or 255 */ + +#ifdef USE_INTERNAL_CTYPE +#define MAX_CHAR_OK CHAR_MAX /* All chars is right */ +#else +#define MAX_CHAR_OK 127 /* 7 Bit ascii */ +#endif + + /* Initiate arrays for case-conversation */ + +void init_case_convert() +{ + reg1 int16 i; + reg2 uchar *higher_pos,*lower_pos; + DBUG_ENTER("init_case_convert"); + + for (i=0 ; i <= MAX_CHAR_OK ; i++) + { + to_upper[i]= sort_order[i]= (islower(i) ? toupper(i) : (char) i); + to_lower[i]= (isupper(i) ? tolower(i) : (char) i); + } +#if MAX_CHAR_OK != 255 + for (i--; i++ < 255 ;) + to_upper[i]= sort_order[i]= to_lower[i]= (char) i; +#endif + +#ifdef MSDOS + higher_pos= (uchar *) "\217\216\231\232\220"; /* Extra chars to konv. */ + lower_pos= (uchar *) "\206\204\224\201\202"; +#else +#if defined(HPUX10) && ASCII_BITS_USED == 8 + higher_pos= (uchar *) "\xd0\xd8\xda\xdb\xdc\xd3"; + lower_pos= (uchar *) "\xd4\xcc\xce\xdf\xc9\xd7"; +#else +#ifdef USE_INTERNAL_CTYPE + higher_pos=lower_pos= (uchar* ) ""; /* System converts chars */ +#else +#if defined(DEC_MULTINATIONAL_CHAR) || defined(HP_MULTINATIONAL_CHAR) + higher_pos= (uchar *) "\305\304\326\311\334"; + lower_pos= (uchar *) "\345\344\366\351\374"; +#else + higher_pos= (uchar *) "[]\\@^"; + lower_pos= (uchar *) "{}|`~"; +#endif +#endif /* USE_INTERNAL_CTYPE */ +#endif /* HPUX10 */ +#endif /* MSDOS */ + + while (*higher_pos) + { + to_upper[ *lower_pos ] = sort_order[ *lower_pos ] = (char) *higher_pos; + to_lower[ *higher_pos++ ] = (char) *lower_pos++; + } + + /* sets upp sortorder; higer_pos character (upper and lower) is */ + /* changed to lower_pos character */ + +#ifdef MSDOS + higher_pos= (uchar *) "\217\216\231\232\220"; + lower_pos= (uchar *) "\216\217\231YE"; +#else +#if defined(HPUX10) && ASCII_BITS_USED == 8 + higher_pos= lower_pos= (uchar *) ""; /* Tecknen i r{tt ordning */ +#else +#ifdef USE_ISO_8859_1 /* As in USG5 ICL-386 */ + higher_pos= (uchar *) "\305\304\326\334\311"; + lower_pos= (uchar *) "\304\305\326YE"; +#else + higher_pos= (uchar *) "][\\~`"; /* R{tt ordning p} tecknen */ + lower_pos= (uchar *) "[\\]YE"; /* Ordning enligt ascii */ +#endif /* USE_ISO_8859_1 */ +#endif /* HPUX10 */ +#endif /* MSDOS */ + + while (*higher_pos) + { + sort_order[ *higher_pos ] = + sort_order[(uchar)to_lower[*higher_pos]] = *lower_pos; + higher_pos++; lower_pos++; + } + DBUG_VOID_RETURN; +} /* init_case_convert */ diff --git a/externals/mysql/strings/dtoa.c b/externals/mysql/strings/dtoa.c new file mode 100644 index 0000000..07e6dfc --- /dev/null +++ b/externals/mysql/strings/dtoa.c @@ -0,0 +1,2782 @@ +/* Copyright (C) 2007 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/**************************************************************** + + This file incorporates work covered by the following copyright and + permission notice: + + The author of this software is David M. Gay. + + Copyright (c) 1991, 2000, 2001 by Lucent Technologies. + + Permission to use, copy, modify, and distribute this software for any + purpose without fee is hereby granted, provided that this entire notice + is included in all copies of any software which is or includes a copy + or modification of this software and in all copies of the supporting + documentation for such software. + + THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY + REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + + ***************************************************************/ + +#include /* for EOVERFLOW on Windows */ +#include +#include /* for memcpy and NOT_FIXED_DEC */ + +/** + Appears to suffice to not call malloc() in most cases. + @todo + see if it is possible to get rid of malloc(). + this constant is sufficient to avoid malloc() on all inputs I have tried. +*/ +#define DTOA_BUFF_SIZE (420 * sizeof(void *)) + +/* Magic value returned by dtoa() to indicate overflow */ +#define DTOA_OVERFLOW 9999 + +static double my_strtod_int(const char *, char **, int *, char *, size_t); +static char *dtoa(double, int, int, int *, int *, char **, char *, size_t); +static void dtoa_free(char *, char *, size_t); + +/** + @brief + Converts a given floating point number to a zero-terminated string + representation using the 'f' format. + + @details + This function is a wrapper around dtoa() to do the same as + sprintf(to, "%-.*f", precision, x), though the conversion is usually more + precise. The only difference is in handling [-,+]infinity and nan values, + in which case we print '0\0' to the output string and indicate an overflow. + + @param x the input floating point number. + @param precision the number of digits after the decimal point. + All properties of sprintf() apply: + - if the number of significant digits after the decimal + point is less than precision, the resulting string is + right-padded with zeros + - if the precision is 0, no decimal point appears + - if a decimal point appears, at least one digit appears + before it + @param to pointer to the output buffer. The longest string which + my_fcvt() can return is FLOATING_POINT_BUFFER bytes + (including the terminating '\0'). + @param error if not NULL, points to a location where the status of + conversion is stored upon return. + FALSE successful conversion + TRUE the input number is [-,+]infinity or nan. + The output string in this case is always '0'. + @return number of written characters (excluding terminating '\0') +*/ + +size_t my_fcvt(double x, int precision, char *to, my_bool *error) +{ + int decpt, sign, len, i; + char *res, *src, *end, *dst= to; + char buf[DTOA_BUFF_SIZE]; + DBUG_ASSERT(precision >= 0 && precision < NOT_FIXED_DEC && to != NULL); + + res= dtoa(x, 5, precision, &decpt, &sign, &end, buf, sizeof(buf)); + + if (decpt == DTOA_OVERFLOW) + { + dtoa_free(res, buf, sizeof(buf)); + *to++= '0'; + *to= '\0'; + if (error != NULL) + *error= TRUE; + return 1; + } + + src= res; + len= end - src; + + if (sign) + *dst++= '-'; + + if (decpt <= 0) + { + *dst++= '0'; + *dst++= '.'; + for (i= decpt; i < 0; i++) + *dst++= '0'; + } + + for (i= 1; i <= len; i++) + { + *dst++= *src++; + if (i == decpt && i < len) + *dst++= '.'; + } + while (i++ <= decpt) + *dst++= '0'; + + if (precision > 0) + { + if (len <= decpt) + *dst++= '.'; + + for (i= precision - max(0, (len - decpt)); i > 0; i--) + *dst++= '0'; + } + + *dst= '\0'; + if (error != NULL) + *error= FALSE; + + dtoa_free(res, buf, sizeof(buf)); + + return dst - to; +} + +/** + @brief + Converts a given floating point number to a zero-terminated string + representation with a given field width using the 'e' format + (aka scientific notation) or the 'f' one. + + @details + The format is chosen automatically to provide the most number of significant + digits (and thus, precision) with a given field width. In many cases, the + result is similar to that of sprintf(to, "%g", x) with a few notable + differences: + - the conversion is usually more precise than C library functions. + - there is no 'precision' argument. instead, we specify the number of + characters available for conversion (i.e. a field width). + - the result never exceeds the specified field width. If the field is too + short to contain even a rounded decimal representation, my_gcvt() + indicates overflow and truncates the output string to the specified width. + - float-type arguments are handled differently than double ones. For a + float input number (i.e. when the 'type' argument is MY_GCVT_ARG_FLOAT) + we deliberately limit the precision of conversion by FLT_DIG digits to + avoid garbage past the significant digits. + - unlike sprintf(), in cases where the 'e' format is preferred, we don't + zero-pad the exponent to save space for significant digits. The '+' sign + for a positive exponent does not appear for the same reason. + + @param x the input floating point number. + @param type is either MY_GCVT_ARG_FLOAT or MY_GCVT_ARG_DOUBLE. + Specifies the type of the input number (see notes above). + @param width field width in characters. The minimal field width to + hold any number representation (albeit rounded) is 7 + characters ("-Ne-NNN"). + @param to pointer to the output buffer. The result is always + zero-terminated, and the longest returned string is thus + 'width + 1' bytes. + @param error if not NULL, points to a location where the status of + conversion is stored upon return. + FALSE successful conversion + TRUE the input number is [-,+]infinity or nan. + The output string in this case is always '0'. + @return number of written characters (excluding terminating '\0') + + @todo + Check if it is possible and makes sense to do our own rounding on top of + dtoa() instead of calling dtoa() twice in (rare) cases when the resulting + string representation does not fit in the specified field width and we want + to re-round the input number with fewer significant digits. Examples: + + my_gcvt(-9e-3, ..., 4, ...); + my_gcvt(-9e-3, ..., 2, ...); + my_gcvt(1.87e-3, ..., 4, ...); + my_gcvt(55, ..., 1, ...); + + We do our best to minimize such cases by: + + - passing to dtoa() the field width as the number of significant digits + + - removing the sign of the number early (and decreasing the width before + passing it to dtoa()) + + - choosing the proper format to preserve the most number of significant + digits. +*/ + +size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to, + my_bool *error) +{ + int decpt, sign, len, exp_len; + char *res, *src, *end, *dst= to, *dend= dst + width; + char buf[DTOA_BUFF_SIZE]; + my_bool have_space, force_e_format; + DBUG_ASSERT(width > 0 && to != NULL); + + /* We want to remove '-' from equations early */ + if (x < 0.) + width--; + + res= dtoa(x, 4, type == MY_GCVT_ARG_DOUBLE ? width : min(width, FLT_DIG), + &decpt, &sign, &end, buf, sizeof(buf)); + if (decpt == DTOA_OVERFLOW) + { + dtoa_free(res, buf, sizeof(buf)); + *to++= '0'; + *to= '\0'; + if (error != NULL) + *error= TRUE; + return 1; + } + + if (error != NULL) + *error= FALSE; + + src= res; + len= end - res; + + /* + Number of digits in the exponent from the 'e' conversion. + The sign of the exponent is taken into account separetely, we don't need + to count it here. + */ + exp_len= 1 + (decpt >= 101 || decpt <= -99) + (decpt >= 11 || decpt <= -9); + + /* + Do we have enough space for all digits in the 'f' format? + Let 'len' be the number of significant digits returned by dtoa, + and F be the length of the resulting decimal representation. + Consider the following cases: + 1. decpt <= 0, i.e. we have "0.NNN" => F = len - decpt + 2 + 2. 0 < decpt < len, i.e. we have "NNN.NNN" => F = len + 1 + 3. len <= decpt, i.e. we have "NNN00" => F = decpt + */ + have_space= (decpt <= 0 ? len - decpt + 2 : + decpt > 0 && decpt < len ? len + 1 : + decpt) <= width; + /* + The following is true when no significant digits can be placed with the + specified field width using the 'f' format, and the 'e' format + will not be truncated. + */ + force_e_format= (decpt <= 0 && width <= 2 - decpt && width >= 3 + exp_len); + /* + Assume that we don't have enough space to place all significant digits in + the 'f' format. We have to choose between the 'e' format and the 'f' one + to keep as many significant digits as possible. + Let E and F be the lengths of decimal representaion in the 'e' and 'f' + formats, respectively. We want to use the 'f' format if, and only if F <= E. + Consider the following cases: + 1. decpt <= 0. + F = len - decpt + 2 (see above) + E = len + (len > 1) + 1 + 1 (decpt <= -99) + (decpt <= -9) + 1 + ("N.NNe-MMM") + (F <= E) <=> (len == 1 && decpt >= -1) || (len > 1 && decpt >= -2) + We also need to ensure that if the 'f' format is chosen, + the field width allows us to place at least one significant digit + (i.e. width > 2 - decpt). If not, we prefer the 'e' format. + 2. 0 < decpt < len + F = len + 1 (see above) + E = len + 1 + 1 + ... ("N.NNeMMM") + F is always less than E. + 3. len <= decpt <= width + In this case we have enough space to represent the number in the 'f' + format, so we prefer it with some exceptions. + 4. width < decpt + The number cannot be represented in the 'f' format at all, always use + the 'e' 'one. + */ + if ((have_space || + /* + Not enough space, let's see if the 'f' format provides the most number + of significant digits. + */ + ((decpt <= width && (decpt >= -1 || (decpt == -2 && + (len > 1 || !force_e_format)))) && + !force_e_format)) && + + /* + Use the 'e' format in some cases even if we have enough space for the + 'f' one. See comment for MAX_DECPT_FOR_F_FORMAT. + */ + (!have_space || (decpt >= -MAX_DECPT_FOR_F_FORMAT + 1 && + (decpt <= MAX_DECPT_FOR_F_FORMAT || len > decpt)))) + { + /* 'f' format */ + int i; + + width-= (decpt < len) + (decpt <= 0 ? 1 - decpt : 0); + + /* Do we have to truncate any digits? */ + if (width < len) + { + if (width < decpt) + { + if (error != NULL) + *error= TRUE; + width= decpt; + } + + /* + We want to truncate (len - width) least significant digits after the + decimal point. For this we are calling dtoa with mode=5, passing the + number of significant digits = (len-decpt) - (len-width) = width-decpt + */ + dtoa_free(res, buf, sizeof(buf)); + res= dtoa(x, 5, width - decpt, &decpt, &sign, &end, buf, sizeof(buf)); + src= res; + len= end - res; + } + + if (len == 0) + { + /* Underflow. Just print '0' and exit */ + *dst++= '0'; + goto end; + } + + /* + At this point we are sure we have enough space to put all digits + returned by dtoa + */ + if (sign && dst < dend) + *dst++= '-'; + if (decpt <= 0) + { + if (dst < dend) + *dst++= '0'; + if (len > 0 && dst < dend) + *dst++= '.'; + for (; decpt < 0 && dst < dend; decpt++) + *dst++= '0'; + } + + for (i= 1; i <= len && dst < dend; i++) + { + *dst++= *src++; + if (i == decpt && i < len && dst < dend) + *dst++= '.'; + } + while (i++ <= decpt && dst < dend) + *dst++= '0'; + } + else + { + /* 'e' format */ + int decpt_sign= 0; + + if (--decpt < 0) + { + decpt= -decpt; + width--; + decpt_sign= 1; + } + width-= 1 + exp_len; /* eNNN */ + + if (len > 1) + width--; + + if (width <= 0) + { + /* Overflow */ + if (error != NULL) + *error= TRUE; + width= 0; + } + + /* Do we have to truncate any digits? */ + if (width < len) + { + /* Yes, re-convert with a smaller width */ + dtoa_free(res, buf, sizeof(buf)); + res= dtoa(x, 4, width, &decpt, &sign, &end, buf, sizeof(buf)); + src= res; + len= end - res; + if (--decpt < 0) + decpt= -decpt; + } + /* + At this point we are sure we have enough space to put all digits + returned by dtoa + */ + if (sign && dst < dend) + *dst++= '-'; + if (dst < dend) + *dst++= *src++; + if (len > 1 && dst < dend) + { + *dst++= '.'; + while (src < end && dst < dend) + *dst++= *src++; + } + if (dst < dend) + *dst++= 'e'; + if (decpt_sign && dst < dend) + *dst++= '-'; + + if (decpt >= 100 && dst < dend) + { + *dst++= decpt / 100 + '0'; + decpt%= 100; + if (dst < dend) + *dst++= decpt / 10 + '0'; + } + else if (decpt >= 10 && dst < dend) + *dst++= decpt / 10 + '0'; + if (dst < dend) + *dst++= decpt % 10 + '0'; + + } + +end: + dtoa_free(res, buf, sizeof(buf)); + *dst= '\0'; + + return dst - to; +} + +/** + @brief + Converts string to double (string does not have to be zero-terminated) + + @details + This is a wrapper around dtoa's version of strtod(). + + @param str input string + @param end address of a pointer to the first character after the input + string. Upon return the pointer is set to point to the first + rejected character. + @param error Upon return is set to EOVERFLOW in case of underflow or + overflow. + + @return The resulting double value. In case of underflow, 0.0 is + returned. In case overflow, signed DBL_MAX is returned. +*/ + +double my_strtod(const char *str, char **end, int *error) +{ + char buf[DTOA_BUFF_SIZE]; + double res; + DBUG_ASSERT(str != NULL && end != NULL && *end != NULL && error != NULL); + + res= my_strtod_int(str, end, error, buf, sizeof(buf)); + return (*error == 0) ? res : (res < 0 ? -DBL_MAX : DBL_MAX); +} + + +double my_atof(const char *nptr) +{ + int error; + const char *end= nptr+65535; /* Should be enough */ + return (my_strtod(nptr, (char**) &end, &error)); +} + + +/**************************************************************** + * + * The author of this software is David M. Gay. + * + * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + * + ***************************************************************/ +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +/* + Original copy of the software is located at http://www.netlib.org/fp/dtoa.c + It was adjusted to serve MySQL server needs: + * strtod() was modified to not expect a zero-terminated string. + It now honors 'se' (end of string) argument as the input parameter, + not just as the output one. + * in dtoa(), in case of overflow/underflow/NaN result string now contains "0"; + decpt is set to DTOA_OVERFLOW to indicate overflow. + * support for VAX, IBM mainframe and 16-bit hardware removed + * we always assume that 64-bit integer type is available + * support for Kernigan-Ritchie style headers (pre-ANSI compilers) + removed + * all gcc warnings ironed out + * we always assume multithreaded environment, so we had to change + memory allocation procedures to use stack in most cases; + malloc is used as the last resort. + * pow5mult rewritten to use pre-calculated pow5 list instead of + the one generated on the fly. +*/ + + +/* + On a machine with IEEE extended-precision registers, it is + necessary to specify double-precision (53-bit) rounding precision + before invoking strtod or dtoa. If the machine uses (the equivalent + of) Intel 80x87 arithmetic, the call + _control87(PC_53, MCW_PC); + does this with many compilers. Whether this or another call is + appropriate depends on the compiler; for this to work, it may be + necessary to #include "float.h" or another system-dependent header + file. +*/ + +/* + #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 + and dtoa should round accordingly. + #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 + and Honor_FLT_ROUNDS is not #defined. + + TODO: check if we can get rid of the above two +*/ + +typedef int32 Long; +typedef uint32 ULong; +typedef int64 LLong; +typedef uint64 ULLong; + +typedef union { double d; ULong L[2]; } U; + +#if defined(WORDS_BIGENDIAN) || (defined(__FLOAT_WORD_ORDER) && \ + (__FLOAT_WORD_ORDER == __BIG_ENDIAN)) +#define word0(x) ((U*)&x)->L[0] +#define word1(x) ((U*)&x)->L[1] +#else +#define word0(x) ((U*)&x)->L[1] +#define word1(x) ((U*)&x)->L[0] +#endif + +#define dval(x) ((U*)&x)->d + +/* #define P DBL_MANT_DIG */ +/* Ten_pmax= floor(P*log(2)/log(5)) */ +/* Bletch= (highest power of 2 < DBL_MAX_10_EXP) / 16 */ +/* Quick_max= floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ +/* Int_max= floor(P*log(FLT_RADIX)/log(10) - 1) */ + +#define Exp_shift 20 +#define Exp_shift1 20 +#define Exp_msk1 0x100000 +#define Exp_mask 0x7ff00000 +#define P 53 +#define Bias 1023 +#define Emin (-1022) +#define Exp_1 0x3ff00000 +#define Exp_11 0x3ff00000 +#define Ebits 11 +#define Frac_mask 0xfffff +#define Frac_mask1 0xfffff +#define Ten_pmax 22 +#define Bletch 0x10 +#define Bndry_mask 0xfffff +#define Bndry_mask1 0xfffff +#define LSB 1 +#define Sign_bit 0x80000000 +#define Log2P 1 +#define Tiny1 1 +#define Quick_max 14 +#define Int_max 14 + +#ifndef Flt_Rounds +#ifdef FLT_ROUNDS +#define Flt_Rounds FLT_ROUNDS +#else +#define Flt_Rounds 1 +#endif +#endif /*Flt_Rounds*/ + +#ifdef Honor_FLT_ROUNDS +#define Rounding rounding +#undef Check_FLT_ROUNDS +#define Check_FLT_ROUNDS +#else +#define Rounding Flt_Rounds +#endif + +#define rounded_product(a,b) a*= b +#define rounded_quotient(a,b) a/= b + +#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) +#define Big1 0xffffffff +#define FFFFFFFF 0xffffffffUL + +/* This is tested to be enough for dtoa */ + +#define Kmax 15 + +#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ + 2*sizeof(int) + y->wds*sizeof(ULong)) + +/* Arbitrary-length integer */ + +typedef struct Bigint +{ + union { + ULong *x; /* points right after this Bigint object */ + struct Bigint *next; /* to maintain free lists */ + } p; + int k; /* 2^k = maxwds */ + int maxwds; /* maximum length in 32-bit words */ + int sign; /* not zero if number is negative */ + int wds; /* current length in 32-bit words */ +} Bigint; + + +/* A simple stack-memory based allocator for Bigints */ + +typedef struct Stack_alloc +{ + char *begin; + char *free; + char *end; + /* + Having list of free blocks lets us reduce maximum required amount + of memory from ~4000 bytes to < 1680 (tested on x86). + */ + Bigint *freelist[Kmax+1]; +} Stack_alloc; + + +/* + Try to allocate object on stack, and resort to malloc if all + stack memory is used. Ensure allocated objects to be aligned by the pointer + size in order to not break the alignment rules when storing a pointer to a + Bigint. +*/ + +static Bigint *Balloc(int k, Stack_alloc *alloc) +{ + Bigint *rv; + if (k <= Kmax && alloc->freelist[k]) + { + rv= alloc->freelist[k]; + alloc->freelist[k]= rv->p.next; + } + else + { + int x, len; + + x= 1 << k; + len= MY_ALIGN(sizeof(Bigint) + x * sizeof(ULong), SIZEOF_CHARP); + + if (alloc->free + len <= alloc->end) + { + rv= (Bigint*) alloc->free; + alloc->free+= len; + } + else + rv= (Bigint*) malloc(len); + + rv->k= k; + rv->maxwds= x; + } + rv->sign= rv->wds= 0; + rv->p.x= (ULong*) (rv + 1); + return rv; +} + + +/* + If object was allocated on stack, try putting it to the free + list. Otherwise call free(). +*/ + +static void Bfree(Bigint *v, Stack_alloc *alloc) +{ + char *gptr= (char*) v; /* generic pointer */ + if (gptr < alloc->begin || gptr >= alloc->end) + free(gptr); + else if (v->k <= Kmax) + { + /* + Maintain free lists only for stack objects: this way we don't + have to bother with freeing lists in the end of dtoa; + heap should not be used normally anyway. + */ + v->p.next= alloc->freelist[v->k]; + alloc->freelist[v->k]= v; + } +} + + +/* + This is to place return value of dtoa in: tries to use stack + as well, but passes by free lists management and just aligns len by + the pointer size in order to not break the alignment rules when storing a + pointer to a Bigint. +*/ + +static char *dtoa_alloc(int i, Stack_alloc *alloc) +{ + char *rv; + int aligned_size= MY_ALIGN(i, SIZEOF_CHARP); + if (alloc->free + aligned_size <= alloc->end) + { + rv= alloc->free; + alloc->free+= aligned_size; + } + else + rv= malloc(i); + return rv; +} + + +/* + dtoa_free() must be used to free values s returned by dtoa() + This is the counterpart of dtoa_alloc() +*/ + +static void dtoa_free(char *gptr, char *buf, size_t buf_size) +{ + if (gptr < buf || gptr >= buf + buf_size) + free(gptr); +} + + +/* Bigint arithmetic functions */ + +/* Multiply by m and add a */ + +static Bigint *multadd(Bigint *b, int m, int a, Stack_alloc *alloc) +{ + int i, wds; + ULong *x; + ULLong carry, y; + Bigint *b1; + + wds= b->wds; + x= b->p.x; + i= 0; + carry= a; + do + { + y= *x * (ULLong)m + carry; + carry= y >> 32; + *x++= (ULong)(y & FFFFFFFF); + } + while (++i < wds); + if (carry) + { + if (wds >= b->maxwds) + { + b1= Balloc(b->k+1, alloc); + Bcopy(b1, b); + Bfree(b, alloc); + b= b1; + } + b->p.x[wds++]= (ULong) carry; + b->wds= wds; + } + return b; +} + + +static Bigint *s2b(const char *s, int nd0, int nd, ULong y9, Stack_alloc *alloc) +{ + Bigint *b; + int i, k; + Long x, y; + + x= (nd + 8) / 9; + for (k= 0, y= 1; x > y; y <<= 1, k++) ; + b= Balloc(k, alloc); + b->p.x[0]= y9; + b->wds= 1; + + i= 9; + if (9 < nd0) + { + s+= 9; + do + b= multadd(b, 10, *s++ - '0', alloc); + while (++i < nd0); + s++; + } + else + s+= 10; + for(; i < nd; i++) + b= multadd(b, 10, *s++ - '0', alloc); + return b; +} + + +static int hi0bits(register ULong x) +{ + register int k= 0; + + if (!(x & 0xffff0000)) + { + k= 16; + x<<= 16; + } + if (!(x & 0xff000000)) + { + k+= 8; + x<<= 8; + } + if (!(x & 0xf0000000)) + { + k+= 4; + x<<= 4; + } + if (!(x & 0xc0000000)) + { + k+= 2; + x<<= 2; + } + if (!(x & 0x80000000)) + { + k++; + if (!(x & 0x40000000)) + return 32; + } + return k; +} + + +static int lo0bits(ULong *y) +{ + register int k; + register ULong x= *y; + + if (x & 7) + { + if (x & 1) + return 0; + if (x & 2) + { + *y= x >> 1; + return 1; + } + *y= x >> 2; + return 2; + } + k= 0; + if (!(x & 0xffff)) + { + k= 16; + x>>= 16; + } + if (!(x & 0xff)) + { + k+= 8; + x>>= 8; + } + if (!(x & 0xf)) + { + k+= 4; + x>>= 4; + } + if (!(x & 0x3)) + { + k+= 2; + x>>= 2; + } + if (!(x & 1)) + { + k++; + x>>= 1; + if (!x) + return 32; + } + *y= x; + return k; +} + + +/* Convert integer to Bigint number */ + +static Bigint *i2b(int i, Stack_alloc *alloc) +{ + Bigint *b; + + b= Balloc(1, alloc); + b->p.x[0]= i; + b->wds= 1; + return b; +} + + +/* Multiply two Bigint numbers */ + +static Bigint *mult(Bigint *a, Bigint *b, Stack_alloc *alloc) +{ + Bigint *c; + int k, wa, wb, wc; + ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; + ULong y; + ULLong carry, z; + + if (a->wds < b->wds) + { + c= a; + a= b; + b= c; + } + k= a->k; + wa= a->wds; + wb= b->wds; + wc= wa + wb; + if (wc > a->maxwds) + k++; + c= Balloc(k, alloc); + for (x= c->p.x, xa= x + wc; x < xa; x++) + *x= 0; + xa= a->p.x; + xae= xa + wa; + xb= b->p.x; + xbe= xb + wb; + xc0= c->p.x; + for (; xb < xbe; xc0++) + { + if ((y= *xb++)) + { + x= xa; + xc= xc0; + carry= 0; + do + { + z= *x++ * (ULLong)y + *xc + carry; + carry= z >> 32; + *xc++= (ULong) (z & FFFFFFFF); + } + while (x < xae); + *xc= (ULong) carry; + } + } + for (xc0= c->p.x, xc= xc0 + wc; wc > 0 && !*--xc; --wc) ; + c->wds= wc; + return c; +} + + +/* + Precalculated array of powers of 5: tested to be enough for + vasting majority of dtoa_r cases. +*/ + +static ULong powers5[]= +{ + 625UL, + + 390625UL, + + 2264035265UL, 35UL, + + 2242703233UL, 762134875UL, 1262UL, + + 3211403009UL, 1849224548UL, 3668416493UL, 3913284084UL, 1593091UL, + + 781532673UL, 64985353UL, 253049085UL, 594863151UL, 3553621484UL, + 3288652808UL, 3167596762UL, 2788392729UL, 3911132675UL, 590UL, + + 2553183233UL, 3201533787UL, 3638140786UL, 303378311UL, 1809731782UL, + 3477761648UL, 3583367183UL, 649228654UL, 2915460784UL, 487929380UL, + 1011012442UL, 1677677582UL, 3428152256UL, 1710878487UL, 1438394610UL, + 2161952759UL, 4100910556UL, 1608314830UL, 349175UL +}; + + +static Bigint p5_a[]= +{ + /* { x } - k - maxwds - sign - wds */ + { { powers5 }, 1, 1, 0, 1 }, + { { powers5 + 1 }, 1, 1, 0, 1 }, + { { powers5 + 2 }, 1, 2, 0, 2 }, + { { powers5 + 4 }, 2, 3, 0, 3 }, + { { powers5 + 7 }, 3, 5, 0, 5 }, + { { powers5 + 12 }, 4, 10, 0, 10 }, + { { powers5 + 22 }, 5, 19, 0, 19 } +}; + +#define P5A_MAX (sizeof(p5_a)/sizeof(*p5_a) - 1) + +static Bigint *pow5mult(Bigint *b, int k, Stack_alloc *alloc) +{ + Bigint *b1, *p5, *p51; + int i; + static int p05[3]= { 5, 25, 125 }; + + if ((i= k & 3)) + b= multadd(b, p05[i-1], 0, alloc); + + if (!(k>>= 2)) + return b; + p5= p5_a; + for (;;) + { + if (k & 1) + { + b1= mult(b, p5, alloc); + Bfree(b, alloc); + b= b1; + } + if (!(k>>= 1)) + break; + /* Calculate next power of 5 */ + if (p5 < p5_a + P5A_MAX) + ++p5; + else if (p5 == p5_a + P5A_MAX) + p5= mult(p5, p5, alloc); + else + { + p51= mult(p5, p5, alloc); + Bfree(p5, alloc); + p5= p51; + } + } + return b; +} + + +static Bigint *lshift(Bigint *b, int k, Stack_alloc *alloc) +{ + int i, k1, n, n1; + Bigint *b1; + ULong *x, *x1, *xe, z; + + n= k >> 5; + k1= b->k; + n1= n + b->wds + 1; + for (i= b->maxwds; n1 > i; i<<= 1) + k1++; + b1= Balloc(k1, alloc); + x1= b1->p.x; + for (i= 0; i < n; i++) + *x1++= 0; + x= b->p.x; + xe= x + b->wds; + if (k&= 0x1f) + { + k1= 32 - k; + z= 0; + do + { + *x1++= *x << k | z; + z= *x++ >> k1; + } + while (x < xe); + if ((*x1= z)) + ++n1; + } + else + do + *x1++= *x++; + while (x < xe); + b1->wds= n1 - 1; + Bfree(b, alloc); + return b1; +} + + +static int cmp(Bigint *a, Bigint *b) +{ + ULong *xa, *xa0, *xb, *xb0; + int i, j; + + i= a->wds; + j= b->wds; + if (i-= j) + return i; + xa0= a->p.x; + xa= xa0 + j; + xb0= b->p.x; + xb= xb0 + j; + for (;;) + { + if (*--xa != *--xb) + return *xa < *xb ? -1 : 1; + if (xa <= xa0) + break; + } + return 0; +} + + +static Bigint *diff(Bigint *a, Bigint *b, Stack_alloc *alloc) +{ + Bigint *c; + int i, wa, wb; + ULong *xa, *xae, *xb, *xbe, *xc; + ULLong borrow, y; + + i= cmp(a,b); + if (!i) + { + c= Balloc(0, alloc); + c->wds= 1; + c->p.x[0]= 0; + return c; + } + if (i < 0) + { + c= a; + a= b; + b= c; + i= 1; + } + else + i= 0; + c= Balloc(a->k, alloc); + c->sign= i; + wa= a->wds; + xa= a->p.x; + xae= xa + wa; + wb= b->wds; + xb= b->p.x; + xbe= xb + wb; + xc= c->p.x; + borrow= 0; + do + { + y= (ULLong)*xa++ - *xb++ - borrow; + borrow= y >> 32 & (ULong)1; + *xc++= (ULong) (y & FFFFFFFF); + } + while (xb < xbe); + while (xa < xae) + { + y= *xa++ - borrow; + borrow= y >> 32 & (ULong)1; + *xc++= (ULong) (y & FFFFFFFF); + } + while (!*--xc) + wa--; + c->wds= wa; + return c; +} + + +static double ulp(double x) +{ + register Long L; + double a; + + L= (word0(x) & Exp_mask) - (P - 1)*Exp_msk1; + word0(a) = L; + word1(a) = 0; + return dval(a); +} + + +static double b2d(Bigint *a, int *e) +{ + ULong *xa, *xa0, w, y, z; + int k; + double d; +#define d0 word0(d) +#define d1 word1(d) + + xa0= a->p.x; + xa= xa0 + a->wds; + y= *--xa; + k= hi0bits(y); + *e= 32 - k; + if (k < Ebits) + { + d0= Exp_1 | y >> (Ebits - k); + w= xa > xa0 ? *--xa : 0; + d1= y << ((32-Ebits) + k) | w >> (Ebits - k); + goto ret_d; + } + z= xa > xa0 ? *--xa : 0; + if (k-= Ebits) + { + d0= Exp_1 | y << k | z >> (32 - k); + y= xa > xa0 ? *--xa : 0; + d1= z << k | y >> (32 - k); + } + else + { + d0= Exp_1 | y; + d1= z; + } + ret_d: +#undef d0 +#undef d1 + return dval(d); +} + + +static Bigint *d2b(double d, int *e, int *bits, Stack_alloc *alloc) +{ + Bigint *b; + int de, k; + ULong *x, y, z; + int i; +#define d0 word0(d) +#define d1 word1(d) + + b= Balloc(1, alloc); + x= b->p.x; + + z= d0 & Frac_mask; + d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ + if ((de= (int)(d0 >> Exp_shift))) + z|= Exp_msk1; + if ((y= d1)) + { + if ((k= lo0bits(&y))) + { + x[0]= y | z << (32 - k); + z>>= k; + } + else + x[0]= y; + i= b->wds= (x[1]= z) ? 2 : 1; + } + else + { + k= lo0bits(&z); + x[0]= z; + i= b->wds= 1; + k+= 32; + } + if (de) + { + *e= de - Bias - (P-1) + k; + *bits= P - k; + } + else + { + *e= de - Bias - (P-1) + 1 + k; + *bits= 32*i - hi0bits(x[i-1]); + } + return b; +#undef d0 +#undef d1 +} + + +static double ratio(Bigint *a, Bigint *b) +{ + double da, db; + int k, ka, kb; + + dval(da)= b2d(a, &ka); + dval(db)= b2d(b, &kb); + k= ka - kb + 32*(a->wds - b->wds); + if (k > 0) + word0(da)+= k*Exp_msk1; + else + { + k= -k; + word0(db)+= k*Exp_msk1; + } + return dval(da) / dval(db); +} + +static const double tens[] = +{ + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + 1e20, 1e21, 1e22 +}; + +static const double bigtens[]= { 1e16, 1e32, 1e64, 1e128, 1e256 }; +static const double tinytens[]= +{ 1e-16, 1e-32, 1e-64, 1e-128, + 9007199254740992.*9007199254740992.e-256 /* = 2^106 * 1e-53 */ +}; +/* + The factor of 2^53 in tinytens[4] helps us avoid setting the underflow + flag unnecessarily. It leads to a song and dance at the end of strtod. +*/ +#define Scale_Bit 0x10 +#define n_bigtens 5 + +/* + strtod for IEEE--arithmetic machines. + + This strtod returns a nearest machine number to the input decimal + string (or sets errno to EOVERFLOW). Ties are broken by the IEEE round-even + rule. + + Inspired loosely by William D. Clinger's paper "How to Read Floating + Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. + + Modifications: + + 1. We only require IEEE (not IEEE double-extended). + 2. We get by with floating-point arithmetic in a case that + Clinger missed -- when we're computing d * 10^n + for a small integer d and the integer n is not too + much larger than 22 (the maximum integer k for which + we can represent 10^k exactly), we may be able to + compute (d*10^k) * 10^(e-k) with just one roundoff. + 3. Rather than a bit-at-a-time adjustment of the binary + result in the hard case, we use floating-point + arithmetic to determine the adjustment to within + one bit; only in really hard cases do we need to + compute a second residual. + 4. Because of 3., we don't need a large table of powers of 10 + for ten-to-e (just some small tables, e.g. of 10^k + for 0 <= k <= 22). +*/ + +static double my_strtod_int(const char *s00, char **se, int *error, char *buf, size_t buf_size) +{ + int scale; + int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, + e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; + const char *s, *s0, *s1, *end = *se; + double aadj, aadj1, adj, rv, rv0; + Long L; + ULong y, z; + Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; +#ifdef SET_INEXACT + int inexact, oldinexact; +#endif +#ifdef Honor_FLT_ROUNDS + int rounding; +#endif + Stack_alloc alloc; + LINT_INIT(c); + + *error= 0; + + alloc.begin= alloc.free= buf; + alloc.end= buf + buf_size; + memset(alloc.freelist, 0, sizeof(alloc.freelist)); + + sign= nz0= nz= 0; + dval(rv)= 0.; + for (s= s00; s < end; s++) + switch (*s) { + case '-': + sign= 1; + /* no break */ + case '+': + s++; + goto break2; + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case ' ': + continue; + default: + goto break2; + } + break2: + if (s >= end) + goto ret0; + + if (*s == '0') + { + nz0= 1; + while (++s < end && *s == '0') ; + if (s >= end) + goto ret; + } + s0= s; + y= z= 0; + for (nd= nf= 0; s < end && (c= *s) >= '0' && c <= '9'; nd++, s++) + if (nd < 9) + y= 10*y + c - '0'; + else if (nd < 16) + z= 10*z + c - '0'; + nd0= nd; + if (s < end - 1 && c == '.') + { + c= *++s; + if (!nd) + { + for (; s < end && c == '0'; c= *++s) + nz++; + if (s < end && c > '0' && c <= '9') + { + s0= s; + nf+= nz; + nz= 0; + goto have_dig; + } + goto dig_done; + } + for (; s < end && c >= '0' && c <= '9'; c = *++s) + { + have_dig: + nz++; + if (c-= '0') + { + nf+= nz; + for (i= 1; i < nz; i++) + if (nd++ < 9) + y*= 10; + else if (nd <= DBL_DIG + 1) + z*= 10; + if (nd++ < 9) + y= 10*y + c; + else if (nd <= DBL_DIG + 1) + z= 10*z + c; + nz= 0; + } + } + } + dig_done: + e= 0; + if (s < end && (c == 'e' || c == 'E')) + { + if (!nd && !nz && !nz0) + goto ret0; + s00= s; + esign= 0; + if (++s < end) + switch (c= *s) { + case '-': + esign= 1; + case '+': + c= *++s; + } + if (s < end && c >= '0' && c <= '9') + { + while (s < end && c == '0') + c= *++s; + if (s < end && c > '0' && c <= '9') { + L= c - '0'; + s1= s; + while (++s < end && (c= *s) >= '0' && c <= '9') + L= 10*L + c - '0'; + if (s - s1 > 8 || L > 19999) + /* Avoid confusion from exponents + * so large that e might overflow. + */ + e= 19999; /* safe for 16 bit ints */ + else + e= (int)L; + if (esign) + e= -e; + } + else + e= 0; + } + else + s= s00; + } + if (!nd) + { + if (!nz && !nz0) + { + ret0: + s= s00; + sign= 0; + } + goto ret; + } + e1= e -= nf; + + /* + Now we have nd0 digits, starting at s0, followed by a + decimal point, followed by nd-nd0 digits. The number we're + after is the integer represented by those digits times + 10**e + */ + + if (!nd0) + nd0= nd; + k= nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; + dval(rv)= y; + if (k > 9) + { +#ifdef SET_INEXACT + if (k > DBL_DIG) + oldinexact = get_inexact(); +#endif + dval(rv)= tens[k - 9] * dval(rv) + z; + } + bd0= 0; + if (nd <= DBL_DIG +#ifndef Honor_FLT_ROUNDS + && Flt_Rounds == 1 +#endif + ) + { + if (!e) + goto ret; + if (e > 0) + { + if (e <= Ten_pmax) + { +#ifdef Honor_FLT_ROUNDS + /* round correctly FLT_ROUNDS = 2 or 3 */ + if (sign) + { + rv= -rv; + sign= 0; + } +#endif + /* rv = */ rounded_product(dval(rv), tens[e]); + goto ret; + } + i= DBL_DIG - nd; + if (e <= Ten_pmax + i) + { + /* + A fancier test would sometimes let us do + this for larger i values. + */ +#ifdef Honor_FLT_ROUNDS + /* round correctly FLT_ROUNDS = 2 or 3 */ + if (sign) + { + rv= -rv; + sign= 0; + } +#endif + e-= i; + dval(rv)*= tens[i]; + /* rv = */ rounded_product(dval(rv), tens[e]); + goto ret; + } + } +#ifndef Inaccurate_Divide + else if (e >= -Ten_pmax) + { +#ifdef Honor_FLT_ROUNDS + /* round correctly FLT_ROUNDS = 2 or 3 */ + if (sign) + { + rv= -rv; + sign= 0; + } +#endif + /* rv = */ rounded_quotient(dval(rv), tens[-e]); + goto ret; + } +#endif + } + e1+= nd - k; + +#ifdef SET_INEXACT + inexact= 1; + if (k <= DBL_DIG) + oldinexact= get_inexact(); +#endif + scale= 0; +#ifdef Honor_FLT_ROUNDS + if ((rounding= Flt_Rounds) >= 2) + { + if (sign) + rounding= rounding == 2 ? 0 : 2; + else + if (rounding != 2) + rounding= 0; + } +#endif + + /* Get starting approximation = rv * 10**e1 */ + + if (e1 > 0) + { + if ((i= e1 & 15)) + dval(rv)*= tens[i]; + if (e1&= ~15) + { + if (e1 > DBL_MAX_10_EXP) + { + ovfl: + *error= EOVERFLOW; + /* Can't trust HUGE_VAL */ +#ifdef Honor_FLT_ROUNDS + switch (rounding) + { + case 0: /* toward 0 */ + case 3: /* toward -infinity */ + word0(rv)= Big0; + word1(rv)= Big1; + break; + default: + word0(rv)= Exp_mask; + word1(rv)= 0; + } +#else /*Honor_FLT_ROUNDS*/ + word0(rv)= Exp_mask; + word1(rv)= 0; +#endif /*Honor_FLT_ROUNDS*/ +#ifdef SET_INEXACT + /* set overflow bit */ + dval(rv0)= 1e300; + dval(rv0)*= dval(rv0); +#endif + if (bd0) + goto retfree; + goto ret; + } + e1>>= 4; + for(j= 0; e1 > 1; j++, e1>>= 1) + if (e1 & 1) + dval(rv)*= bigtens[j]; + /* The last multiplication could overflow. */ + word0(rv)-= P*Exp_msk1; + dval(rv)*= bigtens[j]; + if ((z= word0(rv) & Exp_mask) > Exp_msk1 * (DBL_MAX_EXP + Bias - P)) + goto ovfl; + if (z > Exp_msk1 * (DBL_MAX_EXP + Bias - 1 - P)) + { + /* set to largest number (Can't trust DBL_MAX) */ + word0(rv)= Big0; + word1(rv)= Big1; + } + else + word0(rv)+= P*Exp_msk1; + } + } + else if (e1 < 0) + { + e1= -e1; + if ((i= e1 & 15)) + dval(rv)/= tens[i]; + if ((e1>>= 4)) + { + if (e1 >= 1 << n_bigtens) + goto undfl; + if (e1 & Scale_Bit) + scale= 2 * P; + for(j= 0; e1 > 0; j++, e1>>= 1) + if (e1 & 1) + dval(rv)*= tinytens[j]; + if (scale && (j = 2 * P + 1 - ((word0(rv) & Exp_mask) >> Exp_shift)) > 0) + { + /* scaled rv is denormal; zap j low bits */ + if (j >= 32) + { + word1(rv)= 0; + if (j >= 53) + word0(rv)= (P + 2) * Exp_msk1; + else + word0(rv)&= 0xffffffff << (j - 32); + } + else + word1(rv)&= 0xffffffff << j; + } + if (!dval(rv)) + { + undfl: + dval(rv)= 0.; + if (bd0) + goto retfree; + goto ret; + } + } + } + + /* Now the hard part -- adjusting rv to the correct value.*/ + + /* Put digits into bd: true value = bd * 10^e */ + + bd0= s2b(s0, nd0, nd, y, &alloc); + + for(;;) + { + bd= Balloc(bd0->k, &alloc); + Bcopy(bd, bd0); + bb= d2b(dval(rv), &bbe, &bbbits, &alloc); /* rv = bb * 2^bbe */ + bs= i2b(1, &alloc); + + if (e >= 0) + { + bb2= bb5= 0; + bd2= bd5= e; + } + else + { + bb2= bb5= -e; + bd2= bd5= 0; + } + if (bbe >= 0) + bb2+= bbe; + else + bd2-= bbe; + bs2= bb2; +#ifdef Honor_FLT_ROUNDS + if (rounding != 1) + bs2++; +#endif + j= bbe - scale; + i= j + bbbits - 1; /* logb(rv) */ + if (i < Emin) /* denormal */ + j+= P - Emin; + else + j= P + 1 - bbbits; + bb2+= j; + bd2+= j; + bd2+= scale; + i= bb2 < bd2 ? bb2 : bd2; + if (i > bs2) + i= bs2; + if (i > 0) + { + bb2-= i; + bd2-= i; + bs2-= i; + } + if (bb5 > 0) + { + bs= pow5mult(bs, bb5, &alloc); + bb1= mult(bs, bb, &alloc); + Bfree(bb, &alloc); + bb= bb1; + } + if (bb2 > 0) + bb= lshift(bb, bb2, &alloc); + if (bd5 > 0) + bd= pow5mult(bd, bd5, &alloc); + if (bd2 > 0) + bd= lshift(bd, bd2, &alloc); + if (bs2 > 0) + bs= lshift(bs, bs2, &alloc); + delta= diff(bb, bd, &alloc); + dsign= delta->sign; + delta->sign= 0; + i= cmp(delta, bs); +#ifdef Honor_FLT_ROUNDS + if (rounding != 1) + { + if (i < 0) + { + /* Error is less than an ulp */ + if (!delta->x[0] && delta->wds <= 1) + { + /* exact */ +#ifdef SET_INEXACT + inexact= 0; +#endif + break; + } + if (rounding) + { + if (dsign) + { + adj= 1.; + goto apply_adj; + } + } + else if (!dsign) + { + adj= -1.; + if (!word1(rv) && !(word0(rv) & Frac_mask)) + { + y= word0(rv) & Exp_mask; + if (!scale || y > 2*P*Exp_msk1) + { + delta= lshift(delta,Log2P); + if (cmp(delta, bs) <= 0) + adj= -0.5; + } + } + apply_adj: + if (scale && (y= word0(rv) & Exp_mask) <= 2 * P * Exp_msk1) + word0(adj)+= (2 * P + 1) * Exp_msk1 - y; + dval(rv)+= adj * ulp(dval(rv)); + } + break; + } + adj= ratio(delta, bs); + if (adj < 1.) + adj= 1.; + if (adj <= 0x7ffffffe) + { + /* adj = rounding ? ceil(adj) : floor(adj); */ + y= adj; + if (y != adj) + { + if (!((rounding >> 1) ^ dsign)) + y++; + adj= y; + } + } + if (scale && (y= word0(rv) & Exp_mask) <= 2 * P * Exp_msk1) + word0(adj)+= (2 * P + 1) * Exp_msk1 - y; + adj*= ulp(dval(rv)); + if (dsign) + dval(rv)+= adj; + else + dval(rv)-= adj; + goto cont; + } +#endif /*Honor_FLT_ROUNDS*/ + + if (i < 0) + { + /* + Error is less than half an ulp -- check for special case of mantissa + a power of two. + */ + if (dsign || word1(rv) || word0(rv) & Bndry_mask || + (word0(rv) & Exp_mask) <= (2 * P + 1) * Exp_msk1) + { +#ifdef SET_INEXACT + if (!delta->x[0] && delta->wds <= 1) + inexact= 0; +#endif + break; + } + if (!delta->p.x[0] && delta->wds <= 1) + { + /* exact result */ +#ifdef SET_INEXACT + inexact= 0; +#endif + break; + } + delta= lshift(delta, Log2P, &alloc); + if (cmp(delta, bs) > 0) + goto drop_down; + break; + } + if (i == 0) + { + /* exactly half-way between */ + if (dsign) + { + if ((word0(rv) & Bndry_mask1) == Bndry_mask1 && + word1(rv) == + ((scale && (y = word0(rv) & Exp_mask) <= 2 * P * Exp_msk1) ? + (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) : + 0xffffffff)) + { + /*boundary case -- increment exponent*/ + word0(rv)= (word0(rv) & Exp_mask) + Exp_msk1; + word1(rv) = 0; + dsign = 0; + break; + } + } + else if (!(word0(rv) & Bndry_mask) && !word1(rv)) + { + drop_down: + /* boundary case -- decrement exponent */ + if (scale) + { + L= word0(rv) & Exp_mask; + if (L <= (2 *P + 1) * Exp_msk1) + { + if (L > (P + 2) * Exp_msk1) + /* round even ==> accept rv */ + break; + /* rv = smallest denormal */ + goto undfl; + } + } + L= (word0(rv) & Exp_mask) - Exp_msk1; + word0(rv)= L | Bndry_mask1; + word1(rv)= 0xffffffff; + break; + } + if (!(word1(rv) & LSB)) + break; + if (dsign) + dval(rv)+= ulp(dval(rv)); + else + { + dval(rv)-= ulp(dval(rv)); + if (!dval(rv)) + goto undfl; + } + dsign= 1 - dsign; + break; + } + if ((aadj= ratio(delta, bs)) <= 2.) + { + if (dsign) + aadj= aadj1= 1.; + else if (word1(rv) || word0(rv) & Bndry_mask) + { + if (word1(rv) == Tiny1 && !word0(rv)) + goto undfl; + aadj= 1.; + aadj1= -1.; + } + else + { + /* special case -- power of FLT_RADIX to be rounded down... */ + if (aadj < 2. / FLT_RADIX) + aadj= 1. / FLT_RADIX; + else + aadj*= 0.5; + aadj1= -aadj; + } + } + else + { + aadj*= 0.5; + aadj1= dsign ? aadj : -aadj; +#ifdef Check_FLT_ROUNDS + switch (Rounding) + { + case 2: /* towards +infinity */ + aadj1-= 0.5; + break; + case 0: /* towards 0 */ + case 3: /* towards -infinity */ + aadj1+= 0.5; + } +#else + if (Flt_Rounds == 0) + aadj1+= 0.5; +#endif /*Check_FLT_ROUNDS*/ + } + y= word0(rv) & Exp_mask; + + /* Check for overflow */ + + if (y == Exp_msk1 * (DBL_MAX_EXP + Bias - 1)) + { + dval(rv0)= dval(rv); + word0(rv)-= P * Exp_msk1; + adj= aadj1 * ulp(dval(rv)); + dval(rv)+= adj; + if ((word0(rv) & Exp_mask) >= Exp_msk1 * (DBL_MAX_EXP + Bias - P)) + { + if (word0(rv0) == Big0 && word1(rv0) == Big1) + goto ovfl; + word0(rv)= Big0; + word1(rv)= Big1; + goto cont; + } + else + word0(rv)+= P * Exp_msk1; + } + else + { + if (scale && y <= 2 * P * Exp_msk1) + { + if (aadj <= 0x7fffffff) + { + if ((z= (ULong) aadj) <= 0) + z= 1; + aadj= z; + aadj1= dsign ? aadj : -aadj; + } + word0(aadj1)+= (2 * P + 1) * Exp_msk1 - y; + } + adj = aadj1 * ulp(dval(rv)); + dval(rv) += adj; + } + z= word0(rv) & Exp_mask; +#ifndef SET_INEXACT + if (!scale) + if (y == z) + { + /* Can we stop now? */ + L= (Long)aadj; + aadj-= L; + /* The tolerances below are conservative. */ + if (dsign || word1(rv) || word0(rv) & Bndry_mask) + { + if (aadj < .4999999 || aadj > .5000001) + break; + } + else if (aadj < .4999999 / FLT_RADIX) + break; + } +#endif + cont: + Bfree(bb, &alloc); + Bfree(bd, &alloc); + Bfree(bs, &alloc); + Bfree(delta, &alloc); + } +#ifdef SET_INEXACT + if (inexact) + { + if (!oldinexact) + { + word0(rv0)= Exp_1 + (70 << Exp_shift); + word1(rv0)= 0; + dval(rv0)+= 1.; + } + } + else if (!oldinexact) + clear_inexact(); +#endif + if (scale) + { + word0(rv0)= Exp_1 - 2 * P * Exp_msk1; + word1(rv0)= 0; + dval(rv)*= dval(rv0); + } +#ifdef SET_INEXACT + if (inexact && !(word0(rv) & Exp_mask)) + { + /* set underflow bit */ + dval(rv0)= 1e-300; + dval(rv0)*= dval(rv0); + } +#endif + retfree: + Bfree(bb, &alloc); + Bfree(bd, &alloc); + Bfree(bs, &alloc); + Bfree(bd0, &alloc); + Bfree(delta, &alloc); + ret: + *se= (char *)s; + return sign ? -dval(rv) : dval(rv); +} + + +static int quorem(Bigint *b, Bigint *S) +{ + int n; + ULong *bx, *bxe, q, *sx, *sxe; + ULLong borrow, carry, y, ys; + + n= S->wds; + if (b->wds < n) + return 0; + sx= S->p.x; + sxe= sx + --n; + bx= b->p.x; + bxe= bx + n; + q= *bxe / (*sxe + 1); /* ensure q <= true quotient */ + if (q) + { + borrow= 0; + carry= 0; + do + { + ys= *sx++ * (ULLong)q + carry; + carry= ys >> 32; + y= *bx - (ys & FFFFFFFF) - borrow; + borrow= y >> 32 & (ULong)1; + *bx++= (ULong) (y & FFFFFFFF); + } + while (sx <= sxe); + if (!*bxe) + { + bx= b->p.x; + while (--bxe > bx && !*bxe) + --n; + b->wds= n; + } + } + if (cmp(b, S) >= 0) + { + q++; + borrow= 0; + carry= 0; + bx= b->p.x; + sx= S->p.x; + do + { + ys= *sx++ + carry; + carry= ys >> 32; + y= *bx - (ys & FFFFFFFF) - borrow; + borrow= y >> 32 & (ULong)1; + *bx++= (ULong) (y & FFFFFFFF); + } + while (sx <= sxe); + bx= b->p.x; + bxe= bx + n; + if (!*bxe) + { + while (--bxe > bx && !*bxe) + --n; + b->wds= n; + } + } + return q; +} + + +/* + dtoa for IEEE arithmetic (dmg): convert double to ASCII string. + + Inspired by "How to Print Floating-Point Numbers Accurately" by + Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. + + Modifications: + 1. Rather than iterating, we use a simple numeric overestimate + to determine k= floor(log10(d)). We scale relevant + quantities using O(log2(k)) rather than O(k) multiplications. + 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't + try to generate digits strictly left to right. Instead, we + compute with fewer bits and propagate the carry if necessary + when rounding the final digit up. This is often faster. + 3. Under the assumption that input will be rounded nearest, + mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. + That is, we allow equality in stopping tests when the + round-nearest rule will give the same floating-point value + as would satisfaction of the stopping test with strict + inequality. + 4. We remove common factors of powers of 2 from relevant + quantities. + 5. When converting floating-point integers less than 1e16, + we use floating-point arithmetic rather than resorting + to multiple-precision integers. + 6. When asked to produce fewer than 15 digits, we first try + to get by with floating-point arithmetic; we resort to + multiple-precision integer arithmetic only if we cannot + guarantee that the floating-point calculation has given + the correctly rounded result. For k requested digits and + "uniformly" distributed input, the probability is + something like 10^(k-15) that we must resort to the Long + calculation. + */ + +static char *dtoa(double d, int mode, int ndigits, int *decpt, int *sign, + char **rve, char *buf, size_t buf_size) +{ + /* + Arguments ndigits, decpt, sign are similar to those + of ecvt and fcvt; trailing zeros are suppressed from + the returned string. If not null, *rve is set to point + to the end of the return value. If d is +-Infinity or NaN, + then *decpt is set to DTOA_OVERFLOW. + + mode: + 0 ==> shortest string that yields d when read in + and rounded to nearest. + 1 ==> like 0, but with Steele & White stopping rule; + e.g. with IEEE P754 arithmetic , mode 0 gives + 1e23 whereas mode 1 gives 9.999999999999999e22. + 2 ==> max(1,ndigits) significant digits. This gives a + return value similar to that of ecvt, except + that trailing zeros are suppressed. + 3 ==> through ndigits past the decimal point. This + gives a return value similar to that from fcvt, + except that trailing zeros are suppressed, and + ndigits can be negative. + 4,5 ==> similar to 2 and 3, respectively, but (in + round-nearest mode) with the tests of mode 0 to + possibly return a shorter string that rounds to d. + With IEEE arithmetic and compilation with + -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same + as modes 2 and 3 when FLT_ROUNDS != 1. + 6-9 ==> Debugging modes similar to mode - 4: don't try + fast floating-point estimate (if applicable). + + Values of mode other than 0-9 are treated as mode 0. + + Sufficient space is allocated to the return value + to hold the suppressed trailing zeros. + */ + + int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, + j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, + spec_case, try_quick; + Long L; + int denorm; + ULong x; + Bigint *b, *b1, *delta, *mlo, *mhi, *S; + double d2, ds, eps; + char *s, *s0; +#ifdef Honor_FLT_ROUNDS + int rounding; +#endif + Stack_alloc alloc; + LINT_INIT(ilim); + LINT_INIT(ilim1); + + alloc.begin= alloc.free= buf; + alloc.end= buf + buf_size; + memset(alloc.freelist, 0, sizeof(alloc.freelist)); + + if (word0(d) & Sign_bit) + { + /* set sign for everything, including 0's and NaNs */ + *sign= 1; + word0(d) &= ~Sign_bit; /* clear sign bit */ + } + else + *sign= 0; + + /* If infinity, set decpt to DTOA_OVERFLOW, if 0 set it to 1 */ + if (((word0(d) & Exp_mask) == Exp_mask && (*decpt= DTOA_OVERFLOW)) || + (!dval(d) && (*decpt= 1))) + { + /* Infinity, NaN, 0 */ + char *res= (char*) dtoa_alloc(2, &alloc); + res[0]= '0'; + res[1]= '\0'; + if (rve) + *rve= res + 1; + return res; + } + +#ifdef Honor_FLT_ROUNDS + if ((rounding= Flt_Rounds) >= 2) + { + if (*sign) + rounding= rounding == 2 ? 0 : 2; + else + if (rounding != 2) + rounding= 0; + } +#endif + + b= d2b(dval(d), &be, &bbits, &alloc); + if ((i= (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) + { + dval(d2)= dval(d); + word0(d2) &= Frac_mask1; + word0(d2) |= Exp_11; + + /* + log(x) ~=~ log(1.5) + (x-1.5)/1.5 + log10(x) = log(x) / log(10) + ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) + log10(d)= (i-Bias)*log(2)/log(10) + log10(d2) + + This suggests computing an approximation k to log10(d) by + + k= (i - Bias)*0.301029995663981 + + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); + + We want k to be too large rather than too small. + The error in the first-order Taylor series approximation + is in our favor, so we just round up the constant enough + to compensate for any error in the multiplication of + (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, + and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, + adding 1e-13 to the constant term more than suffices. + Hence we adjust the constant term to 0.1760912590558. + (We could get a more accurate k by invoking log10, + but this is probably not worthwhile.) + */ + + i-= Bias; + denorm= 0; + } + else + { + /* d is denormalized */ + + i= bbits + be + (Bias + (P-1) - 1); + x= i > 32 ? word0(d) << (64 - i) | word1(d) >> (i - 32) + : word1(d) << (32 - i); + dval(d2)= x; + word0(d2)-= 31*Exp_msk1; /* adjust exponent */ + i-= (Bias + (P-1) - 1) + 1; + denorm= 1; + } + ds= (dval(d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + k= (int)ds; + if (ds < 0. && ds != k) + k--; /* want k= floor(ds) */ + k_check= 1; + if (k >= 0 && k <= Ten_pmax) + { + if (dval(d) < tens[k]) + k--; + k_check= 0; + } + j= bbits - i - 1; + if (j >= 0) + { + b2= 0; + s2= j; + } + else + { + b2= -j; + s2= 0; + } + if (k >= 0) + { + b5= 0; + s5= k; + s2+= k; + } + else + { + b2-= k; + b5= -k; + s5= 0; + } + if (mode < 0 || mode > 9) + mode= 0; + +#ifdef Check_FLT_ROUNDS + try_quick= Rounding == 1; +#else + try_quick= 1; +#endif + + if (mode > 5) + { + mode-= 4; + try_quick= 0; + } + leftright= 1; + switch (mode) { + case 0: + case 1: + ilim= ilim1= -1; + i= 18; + ndigits= 0; + break; + case 2: + leftright= 0; + /* no break */ + case 4: + if (ndigits <= 0) + ndigits= 1; + ilim= ilim1= i= ndigits; + break; + case 3: + leftright= 0; + /* no break */ + case 5: + i= ndigits + k + 1; + ilim= i; + ilim1= i - 1; + if (i <= 0) + i= 1; + } + s= s0= dtoa_alloc(i, &alloc); + +#ifdef Honor_FLT_ROUNDS + if (mode > 1 && rounding != 1) + leftright= 0; +#endif + + if (ilim >= 0 && ilim <= Quick_max && try_quick) + { + /* Try to get by with floating-point arithmetic. */ + i= 0; + dval(d2)= dval(d); + k0= k; + ilim0= ilim; + ieps= 2; /* conservative */ + if (k > 0) + { + ds= tens[k&0xf]; + j= k >> 4; + if (j & Bletch) + { + /* prevent overflows */ + j&= Bletch - 1; + dval(d)/= bigtens[n_bigtens-1]; + ieps++; + } + for (; j; j>>= 1, i++) + { + if (j & 1) + { + ieps++; + ds*= bigtens[i]; + } + } + dval(d)/= ds; + } + else if ((j1= -k)) + { + dval(d)*= tens[j1 & 0xf]; + for (j= j1 >> 4; j; j>>= 1, i++) + { + if (j & 1) + { + ieps++; + dval(d)*= bigtens[i]; + } + } + } + if (k_check && dval(d) < 1. && ilim > 0) + { + if (ilim1 <= 0) + goto fast_failed; + ilim= ilim1; + k--; + dval(d)*= 10.; + ieps++; + } + dval(eps)= ieps*dval(d) + 7.; + word0(eps)-= (P-1)*Exp_msk1; + if (ilim == 0) + { + S= mhi= 0; + dval(d)-= 5.; + if (dval(d) > dval(eps)) + goto one_digit; + if (dval(d) < -dval(eps)) + goto no_digits; + goto fast_failed; + } + if (leftright) + { + /* Use Steele & White method of only generating digits needed. */ + dval(eps)= 0.5/tens[ilim-1] - dval(eps); + for (i= 0;;) + { + L= (Long) dval(d); + dval(d)-= L; + *s++= '0' + (int)L; + if (dval(d) < dval(eps)) + goto ret1; + if (1. - dval(d) < dval(eps)) + goto bump_up; + if (++i >= ilim) + break; + dval(eps)*= 10.; + dval(d)*= 10.; + } + } + else + { + /* Generate ilim digits, then fix them up. */ + dval(eps)*= tens[ilim-1]; + for (i= 1;; i++, dval(d)*= 10.) + { + L= (Long)(dval(d)); + if (!(dval(d)-= L)) + ilim= i; + *s++= '0' + (int)L; + if (i == ilim) + { + if (dval(d) > 0.5 + dval(eps)) + goto bump_up; + else if (dval(d) < 0.5 - dval(eps)) + { + while (*--s == '0'); + s++; + goto ret1; + } + break; + } + } + } + fast_failed: + s= s0; + dval(d)= dval(d2); + k= k0; + ilim= ilim0; + } + + /* Do we have a "small" integer? */ + + if (be >= 0 && k <= Int_max) + { + /* Yes. */ + ds= tens[k]; + if (ndigits < 0 && ilim <= 0) + { + S= mhi= 0; + if (ilim < 0 || dval(d) <= 5*ds) + goto no_digits; + goto one_digit; + } + for (i= 1;; i++, dval(d)*= 10.) + { + L= (Long)(dval(d) / ds); + dval(d)-= L*ds; +#ifdef Check_FLT_ROUNDS + /* If FLT_ROUNDS == 2, L will usually be high by 1 */ + if (dval(d) < 0) + { + L--; + dval(d)+= ds; + } +#endif + *s++= '0' + (int)L; + if (!dval(d)) + { + break; + } + if (i == ilim) + { +#ifdef Honor_FLT_ROUNDS + if (mode > 1) + { + switch (rounding) { + case 0: goto ret1; + case 2: goto bump_up; + } + } +#endif + dval(d)+= dval(d); + if (dval(d) > ds || (dval(d) == ds && L & 1)) + { +bump_up: + while (*--s == '9') + if (s == s0) + { + k++; + *s= '0'; + break; + } + ++*s++; + } + break; + } + } + goto ret1; + } + + m2= b2; + m5= b5; + mhi= mlo= 0; + if (leftright) + { + i = denorm ? be + (Bias + (P-1) - 1 + 1) : 1 + P - bbits; + b2+= i; + s2+= i; + mhi= i2b(1, &alloc); + } + if (m2 > 0 && s2 > 0) + { + i= m2 < s2 ? m2 : s2; + b2-= i; + m2-= i; + s2-= i; + } + if (b5 > 0) + { + if (leftright) + { + if (m5 > 0) + { + mhi= pow5mult(mhi, m5, &alloc); + b1= mult(mhi, b, &alloc); + Bfree(b, &alloc); + b= b1; + } + if ((j= b5 - m5)) + b= pow5mult(b, j, &alloc); + } + else + b= pow5mult(b, b5, &alloc); + } + S= i2b(1, &alloc); + if (s5 > 0) + S= pow5mult(S, s5, &alloc); + + /* Check for special case that d is a normalized power of 2. */ + + spec_case= 0; + if ((mode < 2 || leftright) +#ifdef Honor_FLT_ROUNDS + && rounding == 1 +#endif + ) + { + if (!word1(d) && !(word0(d) & Bndry_mask) && + word0(d) & (Exp_mask & ~Exp_msk1) + ) + { + /* The special case */ + b2+= Log2P; + s2+= Log2P; + spec_case= 1; + } + } + + /* + Arrange for convenient computation of quotients: + shift left if necessary so divisor has 4 leading 0 bits. + + Perhaps we should just compute leading 28 bits of S once + a nd for all and pass them and a shift to quorem, so it + can do shifts and ors to compute the numerator for q. + */ + if ((i= ((s5 ? 32 - hi0bits(S->p.x[S->wds-1]) : 1) + s2) & 0x1f)) + i= 32 - i; + if (i > 4) + { + i-= 4; + b2+= i; + m2+= i; + s2+= i; + } + else if (i < 4) + { + i+= 28; + b2+= i; + m2+= i; + s2+= i; + } + if (b2 > 0) + b= lshift(b, b2, &alloc); + if (s2 > 0) + S= lshift(S, s2, &alloc); + if (k_check) + { + if (cmp(b,S) < 0) + { + k--; + /* we botched the k estimate */ + b= multadd(b, 10, 0, &alloc); + if (leftright) + mhi= multadd(mhi, 10, 0, &alloc); + ilim= ilim1; + } + } + if (ilim <= 0 && (mode == 3 || mode == 5)) + { + if (ilim < 0 || cmp(b,S= multadd(S,5,0, &alloc)) <= 0) + { + /* no digits, fcvt style */ +no_digits: + k= -1 - ndigits; + goto ret; + } +one_digit: + *s++= '1'; + k++; + goto ret; + } + if (leftright) + { + if (m2 > 0) + mhi= lshift(mhi, m2, &alloc); + + /* + Compute mlo -- check for special case that d is a normalized power of 2. + */ + + mlo= mhi; + if (spec_case) + { + mhi= Balloc(mhi->k, &alloc); + Bcopy(mhi, mlo); + mhi= lshift(mhi, Log2P, &alloc); + } + + for (i= 1;;i++) + { + dig= quorem(b,S) + '0'; + /* Do we yet have the shortest decimal string that will round to d? */ + j= cmp(b, mlo); + delta= diff(S, mhi, &alloc); + j1= delta->sign ? 1 : cmp(b, delta); + Bfree(delta, &alloc); + if (j1 == 0 && mode != 1 && !(word1(d) & 1) +#ifdef Honor_FLT_ROUNDS + && rounding >= 1 +#endif + ) + { + if (dig == '9') + goto round_9_up; + if (j > 0) + dig++; + *s++= dig; + goto ret; + } + if (j < 0 || (j == 0 && mode != 1 && !(word1(d) & 1))) + { + if (!b->p.x[0] && b->wds <= 1) + { + goto accept_dig; + } +#ifdef Honor_FLT_ROUNDS + if (mode > 1) + switch (rounding) { + case 0: goto accept_dig; + case 2: goto keep_dig; + } +#endif /*Honor_FLT_ROUNDS*/ + if (j1 > 0) + { + b= lshift(b, 1, &alloc); + j1= cmp(b, S); + if ((j1 > 0 || (j1 == 0 && dig & 1)) + && dig++ == '9') + goto round_9_up; + } +accept_dig: + *s++= dig; + goto ret; + } + if (j1 > 0) + { +#ifdef Honor_FLT_ROUNDS + if (!rounding) + goto accept_dig; +#endif + if (dig == '9') + { /* possible if i == 1 */ +round_9_up: + *s++= '9'; + goto roundoff; + } + *s++= dig + 1; + goto ret; + } +#ifdef Honor_FLT_ROUNDS +keep_dig: +#endif + *s++= dig; + if (i == ilim) + break; + b= multadd(b, 10, 0, &alloc); + if (mlo == mhi) + mlo= mhi= multadd(mhi, 10, 0, &alloc); + else + { + mlo= multadd(mlo, 10, 0, &alloc); + mhi= multadd(mhi, 10, 0, &alloc); + } + } + } + else + for (i= 1;; i++) + { + *s++= dig= quorem(b,S) + '0'; + if (!b->p.x[0] && b->wds <= 1) + { + goto ret; + } + if (i >= ilim) + break; + b= multadd(b, 10, 0, &alloc); + } + + /* Round off last digit */ + +#ifdef Honor_FLT_ROUNDS + switch (rounding) { + case 0: goto trimzeros; + case 2: goto roundoff; + } +#endif + b= lshift(b, 1, &alloc); + j= cmp(b, S); + if (j > 0 || (j == 0 && dig & 1)) + { +roundoff: + while (*--s == '9') + if (s == s0) + { + k++; + *s++= '1'; + goto ret; + } + ++*s++; + } + else + { +#ifdef Honor_FLT_ROUNDS +trimzeros: +#endif + while (*--s == '0'); + s++; + } +ret: + Bfree(S, &alloc); + if (mhi) + { + if (mlo && mlo != mhi) + Bfree(mlo, &alloc); + Bfree(mhi, &alloc); + } +ret1: + Bfree(b, &alloc); + *s= 0; + *decpt= k + 1; + if (rve) + *rve= s; + return s0; +} diff --git a/externals/mysql/strings/dump_map.c b/externals/mysql/strings/dump_map.c new file mode 100644 index 0000000..e2b8b7d --- /dev/null +++ b/externals/mysql/strings/dump_map.c @@ -0,0 +1,89 @@ +/* Copyright (C) 2003-2004 MySQL AB + + 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; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include +#include + +static void print_short_array(unsigned short *a, size_t width) +{ + int i; + printf("{\n"); + for (i=0; i<=0xFF; i++) + { + const char *fmt= (width==4) ? "0x%04X" : "0x%02X"; + printf(fmt,(int)a[i]); + printf("%s%s",i<0xFF?",":"",(i+1) % 8 ? "" :"\n"); + } + printf("};\n"); + +} + + + +int main(void) +{ + char str[160]; + unsigned short touni[256]; + unsigned short fromuni[65536]; + unsigned short fromstat[256]; + int i; + + bzero((void*)touni,sizeof(touni)); + bzero((void*)fromuni,sizeof(fromuni)); + bzero((void*)fromstat,sizeof(fromstat)); + + while (fgets(str,sizeof(str),stdin)) + { + unsigned int c,u; + + if ((str[0]=='#') || (2!=sscanf(str,"%x%x",&c,&u))) + continue; + if (c>0xFF || u>0xFFFF) + continue; + + touni[c]= u; + fromuni[u]= c; + } + + printf("unsigned short cs_to_uni[256]="); + print_short_array(touni, 4); + + for (i=0;i<=0xFF;i++) + { + fromstat[touni[i]>>8]++; + } + + for (i=0;i<=256;i++) + { + if (fromstat[i]) + { + printf("unsigned char pl%02X[256]=",i); + print_short_array(fromuni+i*256, 2); + } + } + + printf("unsigned short *uni_to_cs[256]={\n"); + for (i=0;i<=255;i++) + { + if (fromstat[i]) + printf("pl%02X",i); + else + printf("NULL"); + printf("%s%s",i<255?",":"",((i+1) % 8) ? "":"\n"); + } + printf("};\n"); + + return 0; +} diff --git a/externals/mysql/strings/int2str.c b/externals/mysql/strings/int2str.c new file mode 100644 index 0000000..fba98aa --- /dev/null +++ b/externals/mysql/strings/int2str.c @@ -0,0 +1,164 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include "m_string.h" + +/* + _dig_vec arrays are public because they are used in several outer places. +*/ +char NEAR _dig_vec_upper[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +char NEAR _dig_vec_lower[] = + "0123456789abcdefghijklmnopqrstuvwxyz"; + + +/* + Convert integer to its string representation in given scale of notation. + + SYNOPSIS + int2str() + val - value to convert + dst - points to buffer where string representation should be stored + radix - radix of scale of notation + upcase - set to 1 if we should use upper-case digits + + DESCRIPTION + Converts the (long) integer value to its character form and moves it to + the destination buffer followed by a terminating NUL. + If radix is -2..-36, val is taken to be SIGNED, if radix is 2..36, val is + taken to be UNSIGNED. That is, val is signed if and only if radix is. + All other radixes treated as bad and nothing will be changed in this case. + + For conversion to decimal representation (radix is -10 or 10) one can use + optimized int10_to_str() function. + + RETURN VALUE + Pointer to ending NUL character or NullS if radix is bad. +*/ + +char * +int2str(register long int val, register char *dst, register int radix, + int upcase) +{ + char buffer[65]; + register char *p; + long int new_val; + char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower; + ulong uval= (ulong) val; + + if (radix < 0) + { + if (radix < -36 || radix > -2) + return NullS; + if (val < 0) + { + *dst++ = '-'; + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval = (ulong)0 - uval; + } + radix = -radix; + } + else if (radix > 36 || radix < 2) + return NullS; + + /* + The slightly contorted code which follows is due to the fact that + few machines directly support unsigned long / and %. Certainly + the VAX C compiler generates a subroutine call. In the interests + of efficiency (hollow laugh) I let this happen for the first digit + only; after that "val" will be in range so that signed integer + division will do. Sorry 'bout that. CHECK THE CODE PRODUCED BY + YOUR C COMPILER. The first % and / should be unsigned, the second + % and / signed, but C compilers tend to be extraordinarily + sensitive to minor details of style. This works on a VAX, that's + all I claim for it. + */ + p = &buffer[sizeof(buffer)-1]; + *p = '\0'; + new_val= uval / (ulong) radix; + *--p = dig_vec[(uchar) (uval- (ulong) new_val*(ulong) radix)]; + val = new_val; +#ifdef HAVE_LDIV + while (val != 0) + { + ldiv_t res; + res=ldiv(val,radix); + *--p = dig_vec[res.rem]; + val= res.quot; + } +#else + while (val != 0) + { + new_val=val/radix; + *--p = dig_vec[(uchar) (val-new_val*radix)]; + val= new_val; + } +#endif + while ((*dst++ = *p++) != 0) ; + return dst-1; +} + + +/* + Converts integer to its string representation in decimal notation. + + SYNOPSIS + int10_to_str() + val - value to convert + dst - points to buffer where string representation should be stored + radix - flag that shows whenever val should be taken as signed or not + + DESCRIPTION + This is version of int2str() function which is optimized for normal case + of radix 10/-10. It takes only sign of radix parameter into account and + not its absolute value. + + RETURN VALUE + Pointer to ending NUL character. +*/ + +char *int10_to_str(long int val,char *dst,int radix) +{ + char buffer[65]; + register char *p; + long int new_val; + unsigned long int uval = (unsigned long int) val; + + if (radix < 0) /* -10 */ + { + if (val < 0) + { + *dst++ = '-'; + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval = (unsigned long int)0 - uval; + } + } + + p = &buffer[sizeof(buffer)-1]; + *p = '\0'; + new_val= (long) (uval / 10); + *--p = '0'+ (char) (uval - (unsigned long) new_val * 10); + val = new_val; + + while (val != 0) + { + new_val=val/10; + *--p = '0' + (char) (val-new_val*10); + val= new_val; + } + while ((*dst++ = *p++) != 0) ; + return dst-1; +} diff --git a/externals/mysql/strings/is_prefix.c b/externals/mysql/strings/is_prefix.c new file mode 100644 index 0000000..451cd46 --- /dev/null +++ b/externals/mysql/strings/is_prefix.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : is_prefix.c + Author : Michael Widenius + Defines: is_prefix() + + is_prefix(s, t) returns 1 if s starts with t. + A empty t is allways a prefix. +*/ + +#include +#include "m_string.h" + +int is_prefix(register const char *s, register const char *t) +{ + while (*t) + if (*s++ != *t++) return 0; + return 1; /* WRONG */ +} diff --git a/externals/mysql/strings/latin2.def b/externals/mysql/strings/latin2.def new file mode 100644 index 0000000..159d018 --- /dev/null +++ b/externals/mysql/strings/latin2.def @@ -0,0 +1,478 @@ +; Character code definition file for latin2 languages (for use with cset) +; it's written for Czech, but may be used generally; works +; minimum for Slovenian alphabet too (or at least I hope so) +; +; Written by Jaromir Dolecek +; +; Notes of defined sorting order: +; Upper/Lower case is ignored +; All characters with the accents are sorted after appropriate +; character without accent in order: +; Xacute, Xring , Xcaron, Xslash, Xcedilla, Xogonek, Xcircumflex, +; Xbreve, Xhungarumlaut, Xdieresis, Xdotaccent +; +latin2 +*** +NUL 0 C +SOH C +STX C +ETX C +EOT C +ENQ C +ACK C +BEL C +BS C +HT CS +LF CS +VT CS +FF CS +CR CS +SO C +SI C +DLE C +DC1 C +DC2 C +DC3 C +DC4 C +NAK C +SYN C +ETB C +CAN C +EM C +SUB C +ESC C +FS C +GS C +RS C +US C +/space BS +/exclam P +/quotedbl P +/numbersign P +/dollar P +/percent P +/ampersand P +/quoteright P +/parenleft P +/parenright P +/asterisk P +/plus P +/comma P +/minus P +/period P +/slash P +/zero NX +/one NX +/two NX +/three NX +/four NX +/five NX +/six NX +/seven NX +/eight NX +/nine NX +/colon P +/semicolon P +/less P +/equal P +/greater P +/question P +/at P +/A UX +/B UX +/C UX +/D UX +/E UX +/F UX +/G U +/H U +/I U +/J U +/K U +/L U +/M U +/N U +/O U +/P U +/Q U +/R U +/S U +/T U +/U U +/V U +/W U +/X U +/Y U +/Z U +/bracketleft P +/backslash P +/bracketright P +/asciicircum P +/underscore P +/quoteleft P +/a LX +/b LX +/c LX +/d LX +/e LX +/f LX +/g L +/h L +/i L +/j L +/k L +/l L +/m L +/n L +/o L +/p L +/q L +/r L +/s L +/t L +/u L +/v L +/w L +/x L +/y L +/z L +/braceleft P +/bar P +/braceright P +/tilde P +NUL_ C +SOH_ C +STX_ C +ETX_ C +EOT_ C +ENQ_ C +ACK_ C +BEL_ C +BS_ C +HT_ CS +LF_ CS +VT_ CS +FF_ CS +CR_ CS +SO_ C +SI_ C +DLE_ C +DC1_ C +DC2_ C +DC3_ C +DC4_ C +NAK_ C +SYN_ C +ETB_ C +CAN_ C +EM_ C +SUB_ C +ESC_ C +FS_ C +GS_ C +RS_ C +US_ C +/space_ SB +/Aogonek U +/breve P +/Lslash U +/currency P +/Lcaron U +/Sacute U +/dieresis P +/Scaron 169 U +/Scedilla U +/Tcaron U +/Zacute U +/hyphen P +/Zcaron U +/Zdotaccent U +/degree P +/aogonek L +/ogonek P +/lslash L +/acute P +/lcaron L +/sacute L +/caron P +/cedilla P +/scaron L +/scedilla L +/tcaron L +/zacute L +/hungarumlaut P +/zcaron L +/zdotaccent L +/Racute U +/Aacute U +/Acircumflex U +/Abreve U +/Adieresis U +/Lacute U +/Cacute U +/Ccedilla U +/Ccaron U +/Eacute U +/Eogonek U +/Edieresis U +/Ecaron U +/Iacute U +/Icircumflex U +/Dcaron U +/Eth P +/Nacute U +/Ncaron U +/Oacute U +/Ocircumflex U +/Ohungarumlaut U +/Odieresis U +/multiply P +/Rcaron U +/Uring U +/Uacute U +/Uhungarumlaut U +/Udieresis U +/Yacute U +/Tcedilla U +/germandbls P +/racute L +/aacute L +/acircumflex L +/abreve L +/adieresis L +/lacute L +/cacute L +/ccedilla L +/ccaron L +/eacute L +/eogonek L +/edieresis L +/ecaron L +/iacute L +/icircumflex L +/dcaron L +/dbar L +/nacute L +/ncaron L +/oacute L +/ocircumflex L +/ohungarumlaut L +/odieresis L +/divide P +/rcaron L +/uring L +/uacute L +/uhungarumlaut L +/udieresis L +/yacute L +/tcedilla L +/dotaccent P +*** +/A /a +/B /b +/C /c +/D /d +/E /e +/F /f +/G /g +/H /h +/I /i +/J /j +/K /k +/L /l +/M /m +/N /n +/O /o +/P /p +/Q /q +/R /r +/S /s +/T /t +/U /u +/V /v +/W /w +/X /x +/Y /y +/Z /z +/Aogonek /aogonek +/Lslash /lslash +/Lcaron /lcaron +/Sacute /sacute +/Scaron /scaron +/Scedilla /scedilla +/Tcaron /tcaron +/Zacute /zacute +/Zcaron /zcaron +/Zdotaccent /zdotaccent +/Racute /racute +/Aacute /aacute +/Acircumflex /acircumflex +/Abreve /abreve +/Adieresis /adieresis +/Lacute /lacute +/Cacute /cacute +/Ccedilla /ccedilla +/Ccaron /ccaron +/Eacute /eacute +/Eogonek /eogonek +/Edieresis /edieresis +/Ecaron /ecaron +/Iacute /iacute +/Icircumflex /icircumflex +/Dcaron /dcaron +/Nacute /nacute +/Ncaron /ncaron +/Oacute /oacute +/Ocircumflex /ocircumflex +/Ohungarumlaut /ohungarumlaut +/Odieresis /odieresis +/Rcaron /rcaron +/Uring /uring +/Uacute /uacute +/Uhungarumlaut /uhungarumlaut +/Udieresis /udieresis +/Yacute /yacute +/Tcedilla /tcedilla +*** +NUL NUL_ +SOH SOH_ +STX STX_ +ETX ETX_ +EOT EOT_ +ENQ ENQ_ +ACK ACK_ +BEL BEL_ +BS BS_ +HT HT_ +LF LF_ +VT VT_ +FF FF_ +CR CR_ +SO SO_ +SI SI_ +DLE DLE_ +DC1 DC1_ +DC2 DC2_ +DC3 DC3_ +DC4 DC4_ +NAK NAK_ +SYN SYN_ +ETB ETB_ +CAN CAN_ +EM EM_ +SUB SUB_ +ESC ESC_ +FS FS_ +GS GS_ +RS RS_ +US US_ +/space +/exclam +/quotedbl +/numbersign +/dollar +/percent +/ampersand +/quoteright +/parenleft +/parenright +/asterisk +/plus +/comma +/minus +/period +/slash +/zero +/one +/two +/three +/four +/five +/six +/seven +/eight +/nine +/colon +/semicolon +/less +/equal +/greater +/question +/at +/A /a +/Aogonek /aogonek +/Aacute /aacute +/Acircumflex /acircumflex +/Abreve /abreve +/Adieresis /adieresis +/B /b +/C /c +/Cacute /cacute +/Ccaron /ccaron +/Ccedilla /ccedilla +/D /d +/Dcaron /dcaron +/E /e +/Eacute /eacute +/Ecaron /ecaron +/Eogonek /eogonek +/Edieresis /edieresis +/F /f +/G /g +/H /h +/I /i +/Icircumflex +/icircumflex +/Iacute /iacute +/J /j +/K /k +/L /l +/Lslash /lslash +/Lcaron /lcaron +/Lacute /lacute +/M /m +/N /n +/Nacute /nacute +/Ncaron /ncaron +/O /o +/Oacute /oacute +/Ocircumflex /ocircumflex +/Ohungarumlaut /ohungarumlaut +/Odieresis /odieresis +/P /p +/Q /q +/R /r +/Racute /racute +/Rcaron /rcaron +/S /s +/Sacute /sacute +/Scaron /scaron +/Scedilla /scedilla +/T /t +/Tcaron /tcaron +/Tcedilla /tcedilla +/U /u +/Uacute /uacute +/Uring /uring +/Uhungarumlaut /uhungarumlaut +/Udieresis /udieresis +/V /v +/W /w +/X /x +/Y /y +/Yacute /yacute +/Z /z +/Zacute /zacute +/Zcaron /zcaron +/Zdotaccent /zdotaccent +/bracketleft +/backslash +/bracketright +/asciicircum +/underscore +/quoteleft +/braceleft +/bar +/braceright +/tilde +*** diff --git a/externals/mysql/strings/llstr.c b/externals/mysql/strings/llstr.c new file mode 100644 index 0000000..643cf36 --- /dev/null +++ b/externals/mysql/strings/llstr.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Defines: llstr(); + + llstr(value, buff); + + This function saves a longlong value in a buffer and returns the pointer to + the buffer. This is useful when trying to portable print longlong + variables with printf() as there is no usable printf() standard one can use. +*/ + + +#include +#include "m_string.h" + +char *llstr(longlong value,char *buff) +{ + longlong10_to_str(value,buff,-10); + return buff; +} + +char *ullstr(longlong value,char *buff) +{ + longlong10_to_str(value,buff,10); + return buff; +} diff --git a/externals/mysql/strings/longlong2str.c b/externals/mysql/strings/longlong2str.c new file mode 100644 index 0000000..641ae09 --- /dev/null +++ b/externals/mysql/strings/longlong2str.c @@ -0,0 +1,143 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Defines: longlong2str(); + + longlong2str(dst, radix, val) + converts the (longlong) integer "val" to character form and moves it to + the destination string "dst" followed by a terminating NUL. The + result is normally a pointer to this NUL character, but if the radix + is dud the result will be NullS and nothing will be changed. + + If radix is -2..-36, val is taken to be SIGNED. + If radix is 2.. 36, val is taken to be UNSIGNED. + That is, val is signed if and only if radix is. You will normally + use radix -10 only through itoa and ltoa, for radix 2, 8, or 16 + unsigned is what you generally want. + + _dig_vec is public just in case someone has a use for it. + The definitions of itoa and ltoa are actually macros in m_string.h, + but this is where the code is. + + Note: The standard itoa() returns a pointer to the argument, when int2str + returns the pointer to the end-null. + itoa assumes that 10 -base numbers are allways signed and other arn't. +*/ + +#include +#include "m_string.h" + +#ifndef ll2str + +/* + This assumes that longlong multiplication is faster than longlong division. +*/ + +char *ll2str(longlong val,char *dst,int radix, int upcase) +{ + char buffer[65]; + register char *p; + long long_val; + char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower; + ulonglong uval= (ulonglong) val; + + if (radix < 0) + { + if (radix < -36 || radix > -2) return (char*) 0; + if (val < 0) { + *dst++ = '-'; + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval = (ulonglong)0 - uval; + } + radix = -radix; + } + else + { + if (radix > 36 || radix < 2) return (char*) 0; + } + if (uval == 0) + { + *dst++='0'; + *dst='\0'; + return dst; + } + p = &buffer[sizeof(buffer)-1]; + *p = '\0'; + + while (uval > (ulonglong) LONG_MAX) + { + ulonglong quo= uval/(uint) radix; + uint rem= (uint) (uval- quo* (uint) radix); + *--p= dig_vec[rem]; + uval= quo; + } + long_val= (long) uval; + while (long_val != 0) + { + long quo= long_val/radix; + *--p= dig_vec[(uchar) (long_val - quo*radix)]; + long_val= quo; + } + while ((*dst++ = *p++) != 0) ; + return dst-1; +} +#endif + +#ifndef longlong10_to_str +char *longlong10_to_str(longlong val,char *dst,int radix) +{ + char buffer[65]; + register char *p; + long long_val; + ulonglong uval= (ulonglong) val; + + if (radix < 0) + { + if (val < 0) + { + *dst++ = '-'; + /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */ + uval = (ulonglong)0 - uval; + } + } + + if (uval == 0) + { + *dst++='0'; + *dst='\0'; + return dst; + } + p = &buffer[sizeof(buffer)-1]; + *p = '\0'; + + while (uval > (ulonglong) LONG_MAX) + { + ulonglong quo= uval/(uint) 10; + uint rem= (uint) (uval- quo* (uint) 10); + *--p = _dig_vec_upper[rem]; + uval= quo; + } + long_val= (long) uval; + while (long_val != 0) + { + long quo= long_val/10; + *--p = _dig_vec_upper[(uchar) (long_val - quo*10)]; + long_val= quo; + } + while ((*dst++ = *p++) != 0) ; + return dst-1; +} +#endif diff --git a/externals/mysql/strings/longlong2str_asm.c b/externals/mysql/strings/longlong2str_asm.c new file mode 100644 index 0000000..9a2b86b --- /dev/null +++ b/externals/mysql/strings/longlong2str_asm.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Wrapper for longlong2str.s + + We need this because the assembler code can't access the local variable + _dig_vector in a portable manner. +*/ + +#include +#include "m_string.h" + +extern char *longlong2str_with_dig_vector(longlong val,char *dst,int radix, + const char *dig_vector); + +char *ll2str(longlong val,char *dst,int radix, int upcase) +{ + return longlong2str_with_dig_vector(val, dst, radix, + upcase?_dig_vec_upper:_dig_vec_lower); +} diff --git a/externals/mysql/strings/my_strchr.c b/externals/mysql/strings/my_strchr.c new file mode 100644 index 0000000..6724bf3 --- /dev/null +++ b/externals/mysql/strings/my_strchr.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2005 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + my_strchr(cs, str, end, c) returns a pointer to the first place in + str where c (1-byte character) occurs, or NULL if c does not occur + in str. This function is multi-byte safe. + TODO: should be moved to CHARSET_INFO if it's going to be called + frequently. +*/ + +#include +#include "m_string.h" +#include "m_ctype.h" + + +char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end, + pchar c) +{ + uint mbl; + while (str < end) + { + mbl= my_mbcharlen(cs, *(uchar *)str); + if (mbl < 2) + { + if (*str == c) + return((char *)str); + str++; + } + else + str+= mbl; + } + return(0); +} + diff --git a/externals/mysql/strings/my_strtoll10.c b/externals/mysql/strings/my_strtoll10.c new file mode 100644 index 0000000..8dba51e --- /dev/null +++ b/externals/mysql/strings/my_strtoll10.c @@ -0,0 +1,247 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include /* Needed for MY_ERRNO_ERANGE */ +#include + +#undef ULONGLONG_MAX +/* + Needed under MetroWerks Compiler, since MetroWerks compiler does not + properly handle a constant expression containing a mod operator +*/ +#if defined(__NETWARE__) && defined(__MWERKS__) +static ulonglong ulonglong_max= ~(ulonglong) 0; +#define ULONGLONG_MAX ulonglong_max +#else +#define ULONGLONG_MAX (~(ulonglong) 0) +#endif /* __NETWARE__ && __MWERKS__ */ +#define MAX_NEGATIVE_NUMBER ((ulonglong) 0x8000000000000000LL) +#define INIT_CNT 9 +#define LFACTOR 1000000000ULL +#define LFACTOR1 10000000000ULL +#define LFACTOR2 100000000000ULL + +static unsigned long lfactor[9]= +{ + 1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L, 100000000L +}; + +/* + Convert a string to an to unsigned long long integer value + + SYNOPSYS + my_strtoll10() + nptr in pointer to the string to be converted + endptr in/out pointer to the end of the string/ + pointer to the stop character + error out returned error code + + DESCRIPTION + This function takes the decimal representation of integer number + from string nptr and converts it to an signed or unsigned + long long integer value. + Space characters and tab are ignored. + A sign character might precede the digit characters. The number + may have any number of pre-zero digits. + + The function stops reading the string nptr at the first character + that is not a decimal digit. If endptr is not NULL then the function + will not read characters after *endptr. + + RETURN VALUES + Value of string as a signed/unsigned longlong integer + + if no error and endptr != NULL, it will be set to point at the character + after the number + + The error parameter contains information how things went: + -1 Number was an ok negative number + 0 ok + ERANGE If the the value of the converted number exceeded the + maximum negative/unsigned long long integer. + In this case the return value is ~0 if value was + positive and LONGLONG_MIN if value was negative. + EDOM If the string didn't contain any digits. In this case + the return value is 0. + + If endptr is not NULL the function will store the end pointer to + the stop character here. +*/ + + +longlong my_strtoll10(const char *nptr, char **endptr, int *error) +{ + const char *s, *end, *start, *n_end, *true_end; + char *dummy; + uchar c; + unsigned long i, j, k; + ulonglong li; + int negative; + ulong cutoff, cutoff2, cutoff3; + + s= nptr; + /* If fixed length string */ + if (endptr) + { + end= *endptr; + while (s != end && (*s == ' ' || *s == '\t')) + s++; + if (s == end) + goto no_conv; + } + else + { + endptr= &dummy; /* Easier end test */ + while (*s == ' ' || *s == '\t') + s++; + if (!*s) + goto no_conv; + /* This number must be big to guard against a lot of pre-zeros */ + end= s+65535; /* Can't be longer than this */ + } + + /* Check for a sign. */ + negative= 0; + if (*s == '-') + { + *error= -1; /* Mark as negative number */ + negative= 1; + if (++s == end) + goto no_conv; + cutoff= MAX_NEGATIVE_NUMBER / LFACTOR2; + cutoff2= (MAX_NEGATIVE_NUMBER % LFACTOR2) / 100; + cutoff3= MAX_NEGATIVE_NUMBER % 100; + } + else + { + *error= 0; + if (*s == '+') + { + if (++s == end) + goto no_conv; + } + cutoff= ULONGLONG_MAX / LFACTOR2; + cutoff2= ULONGLONG_MAX % LFACTOR2 / 100; + cutoff3= ULONGLONG_MAX % 100; + } + + /* Handle case where we have a lot of pre-zero */ + if (*s == '0') + { + i= 0; + do + { + if (++s == end) + goto end_i; /* Return 0 */ + } + while (*s == '0'); + n_end= s+ INIT_CNT; + } + else + { + /* Read first digit to check that it's a valid number */ + if ((c= (*s-'0')) > 9) + goto no_conv; + i= c; + n_end= ++s+ INIT_CNT-1; + } + + /* Handle first 9 digits and store them in i */ + if (n_end > end) + n_end= end; + for (; s != n_end ; s++) + { + if ((c= (*s-'0')) > 9) + goto end_i; + i= i*10+c; + } + if (s == end) + goto end_i; + + /* Handle next 9 digits and store them in j */ + j= 0; + start= s; /* Used to know how much to shift i */ + n_end= true_end= s + INIT_CNT; + if (n_end > end) + n_end= end; + do + { + if ((c= (*s-'0')) > 9) + goto end_i_and_j; + j= j*10+c; + } while (++s != n_end); + if (s == end) + { + if (s != true_end) + goto end_i_and_j; + goto end3; + } + if ((c= (*s-'0')) > 9) + goto end3; + + /* Handle the next 1 or 2 digits and store them in k */ + k=c; + if (++s == end || (c= (*s-'0')) > 9) + goto end4; + k= k*10+c; + *endptr= (char*) ++s; + + /* number string should have ended here */ + if (s != end && (c= (*s-'0')) <= 9) + goto overflow; + + /* Check that we didn't get an overflow with the last digit */ + if (i > cutoff || (i == cutoff && ((j > cutoff2 || j == cutoff2) && + k > cutoff3))) + goto overflow; + li=i*LFACTOR2+ (ulonglong) j*100 + k; + return (longlong) li; + +overflow: /* *endptr is set here */ + *error= MY_ERRNO_ERANGE; + return negative ? LONGLONG_MIN : (longlong) ULONGLONG_MAX; + +end_i: + *endptr= (char*) s; + return (negative ? ((longlong) -(long) i) : (longlong) i); + +end_i_and_j: + li= (ulonglong) i * lfactor[(uint) (s-start)] + j; + *endptr= (char*) s; + return (negative ? -((longlong) li) : (longlong) li); + +end3: + li=(ulonglong) i*LFACTOR+ (ulonglong) j; + *endptr= (char*) s; + return (negative ? -((longlong) li) : (longlong) li); + +end4: + li=(ulonglong) i*LFACTOR1+ (ulonglong) j * 10 + k; + *endptr= (char*) s; + if (negative) + { + if (li > MAX_NEGATIVE_NUMBER) + goto overflow; + return -((longlong) li); + } + return (longlong) li; + +no_conv: + /* There was no number to convert. */ + *error= MY_ERRNO_EDOM; + *endptr= (char *) nptr; + return 0; +} diff --git a/externals/mysql/strings/my_vsnprintf.c b/externals/mysql/strings/my_vsnprintf.c new file mode 100644 index 0000000..ade5325 --- /dev/null +++ b/externals/mysql/strings/my_vsnprintf.c @@ -0,0 +1,252 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include +#include +#include + +/* + Limited snprintf() implementations + + exported to plugins as a service, see the detailed documentation + around my_snprintf_service_st +*/ + +size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) +{ + char *start=to, *end=to+n-1; + size_t length, width; + uint pre_zero, have_longlong; + + for (; *fmt ; fmt++) + { + if (*fmt != '%') + { + if (to == end) /* End of buffer */ + break; + *to++= *fmt; /* Copy ordinary char */ + continue; + } + fmt++; /* skip '%' */ + /* Read max fill size (only used with %d and %u) */ + if (*fmt == '-') + fmt++; + length= width= 0; + pre_zero= have_longlong= 0; + if (*fmt == '*') + { + fmt++; + length= va_arg(ap, int); + } + else + for (; my_isdigit(&my_charset_latin1, *fmt); fmt++) + { + length= length * 10 + (uint)(*fmt - '0'); + if (!length) + pre_zero= 1; /* first digit was 0 */ + } + if (*fmt == '.') + { + fmt++; + if (*fmt == '*') + { + fmt++; + width= va_arg(ap, int); + } + else + { + for (; my_isdigit(&my_charset_latin1, *fmt); fmt++) + width= width * 10 + (uint)(*fmt - '0'); + } + } + else + width= SIZE_T_MAX; + if (*fmt == 'l') + { + fmt++; + if (*fmt != 'l') + have_longlong= (sizeof(long) == sizeof(longlong)); + else + { + fmt++; + have_longlong= 1; + } + } + else if (*fmt == 'z') + { + fmt++; + have_longlong= (sizeof(size_t) == sizeof(longlong)); + } + if (*fmt == 's') /* String parameter */ + { + reg2 char *par= va_arg(ap, char *); + size_t plen, left_len= (size_t) (end - to) + 1; + if (!par) + par = (char*) "(null)"; + plen= strnlen(par, width); + if (left_len <= plen) + plen = left_len - 1; + to= strnmov(to,par,plen); + continue; + } + else if (*fmt == 'b') /* Buffer parameter */ + { + char *par = va_arg(ap, char *); + DBUG_ASSERT(to <= end); + if (to + width + 1 > end) + width= end - to - 1; /* sign doesn't matter */ + memmove(to, par, width); + to+= width; + continue; + } + else if (*fmt == 'f' || *fmt == 'g') + { + double d= va_arg(ap, double); + if (width == SIZE_T_MAX) + width= FLT_DIG; /* width not set, use default */ + else if (width >= NOT_FIXED_DEC) + width= NOT_FIXED_DEC - 1; /* max.precision for my_fcvt() */ + width= min(width, (size_t)(end-to) - 1); + + if (*fmt == 'f') + to+= my_fcvt(d, (int)width , to, NULL); + else + to+= my_gcvt(d, MY_GCVT_ARG_DOUBLE, (int) width , to, NULL); + } + else if (*fmt == 'd' || *fmt == 'u' || *fmt == 'x' || *fmt == 'X' || + *fmt == 'p') + { + /* Integer parameter */ + longlong larg; + size_t res_length, to_length; + char *store_start= to, *store_end; + char buff[32]; + if (*fmt == 'p') + { + have_longlong= (sizeof(void *) == sizeof(longlong)); + } + + if ((to_length= (size_t) (end-to)) < 16 || length) + store_start= buff; + if (have_longlong) + larg = va_arg(ap,longlong); + else if (*fmt == 'd') + larg = va_arg(ap, int); + else + larg= va_arg(ap, uint); + if (*fmt == 'd') + store_end= longlong10_to_str(larg, store_start, -10); + else if (*fmt == 'u') + store_end= longlong10_to_str(larg, store_start, 10); + else if (*fmt == 'p') + { + store_start[0]= '0'; + store_start[1]= 'x'; + store_end= ll2str(larg, store_start + 2, 16, 0); + } + else + { + DBUG_ASSERT(*fmt == 'X' || *fmt =='x'); + store_end= ll2str(larg, store_start, 16, (*fmt == 'X')); + } + + if ((res_length= (size_t) (store_end - store_start)) > to_length) + break; /* num doesn't fit in output */ + /* If %#d syntax was used, we have to pre-zero/pre-space the string */ + if (store_start == buff) + { + length= min(length, to_length); + if (res_length < length) + { + size_t diff= (length- res_length); + bfill(to, diff, pre_zero ? '0' : ' '); + to+= diff; + } + bmove(to, store_start, res_length); + } + to+= res_length; + continue; + } + else if (*fmt == 'c') /* Character parameter */ + { + register int larg; + if (to == end) + break; + larg = va_arg(ap, int); + *to++= (char) larg; + continue; + } + + /* We come here on '%%', unknown code or too long parameter */ + if (to == end) + break; + *to++='%'; /* % used as % or unknown code */ + } + DBUG_ASSERT(to <= end); + *to='\0'; /* End of errmessage */ + return (size_t) (to - start); +} + + +size_t my_snprintf(char* to, size_t n, const char* fmt, ...) +{ + size_t result; + va_list args; + va_start(args,fmt); + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; +} + +#ifdef MAIN +#define OVERRUN_SENTRY 250 +static void my_printf(const char * fmt, ...) +{ + char buf[33]; + int n; + va_list ar; + va_start(ar, fmt); + buf[sizeof(buf)-1]=OVERRUN_SENTRY; + n = my_vsnprintf(buf, sizeof(buf)-1,fmt, ar); + printf(buf); + printf("n=%d, strlen=%d\n", n, strlen(buf)); + if ((uchar) buf[sizeof(buf)-1] != OVERRUN_SENTRY) + { + fprintf(stderr, "Buffer overrun\n"); + abort(); + } + va_end(ar); +} + + +int main() +{ + + my_printf("Hello\n"); + my_printf("Hello int, %d\n", 1); + my_printf("Hello string '%s'\n", "I am a string"); + my_printf("Hello hack hack hack hack hack hack hack %d\n", 1); + my_printf("Hello %d hack %d\n", 1, 4); + my_printf("Hello %d hack hack hack hack hack %d\n", 1, 4); + my_printf("Hello '%s' hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n", "hack"); + my_printf("Hello hhhhhhhhhhhhhh %d sssssssssssssss\n", 1); + my_printf("Hello %u\n", 1); + my_printf("Hex: %lx '%6lx'\n", 32, 65); + my_printf("conn %ld to: '%-.64s' user: '%-.32s' host:\ + `%-.64s' (%-.64s)", 1, 0,0,0,0); + return 0; +} +#endif diff --git a/externals/mysql/strings/r_strinstr.c b/externals/mysql/strings/r_strinstr.c new file mode 100644 index 0000000..fb1e0c5 --- /dev/null +++ b/externals/mysql/strings/r_strinstr.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Author : David + strintstr(src, from, pat) looks for an instance of pat in src + backwards from pos from. pat is not a regex(3) pattern, it is a literal + string which must be matched exactly. + The result 0 if the pattern was not found else it is the start char of + the pattern counted from the begining of the string. +*/ + +#include +#include "m_string.h" + +size_t r_strinstr(reg1 const char * str, size_t from, reg4 const char * search) +{ + reg2 const char *i, *j; + size_t len = strlen(search); + /* pointer to the last char of buff */ + const char * start = str + from - 1; + /* pointer to the last char of search */ + const char * search_end = search + len - 1; + + skip: + while (start >= str) /* Cant be != because the first char */ + { + if (*start-- == *search_end) + { + i = start; j = search_end - 1; + while (j >= search && start > str) + if (*i-- != *j--) + goto skip; + return (size_t) ((start - len) - str + 3); + } + } + return (0); +} diff --git a/externals/mysql/strings/str2int.c b/externals/mysql/strings/str2int.c new file mode 100644 index 0000000..c4a4c07 --- /dev/null +++ b/externals/mysql/strings/str2int.c @@ -0,0 +1,201 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + str2int(src, radix, lower, upper, &val) + converts the string pointed to by src to an integer and stores it in + val. It skips leading spaces and tabs (but not newlines, formfeeds, + backspaces), then it accepts an optional sign and a sequence of digits + in the specified radix. The result should satisfy lower <= *val <= upper. + The result is a pointer to the first character after the number; + trailing spaces will NOT be skipped. + + If an error is detected, the result will be NullS, the value put + in val will be 0, and errno will be set to + EDOM if there are no digits + ERANGE if the result would overflow or otherwise fail to lie + within the specified bounds. + Check that the bounds are right for your machine. + This looks amazingly complicated for what you probably thought was an + easy task. Coping with integer overflow and the asymmetric range of + twos complement machines is anything but easy. + + So that users of atoi and atol can check whether an error occured, + I have taken a wholly unprecedented step: errno is CLEARED if this + call has no problems. +*/ + +#include +#include "m_string.h" +#include "m_ctype.h" +#include "my_sys.h" /* defines errno */ +#include + +#define char_val(X) (X >= '0' && X <= '9' ? X-'0' :\ + X >= 'A' && X <= 'Z' ? X-'A'+10 :\ + X >= 'a' && X <= 'z' ? X-'a'+10 :\ + '\177') + +char *str2int(register const char *src, register int radix, long int lower, + long int upper, long int *val) +{ + int sign; /* is number negative (+1) or positive (-1) */ + int n; /* number of digits yet to be converted */ + long limit; /* "largest" possible valid input */ + long scale; /* the amount to multiply next digit by */ + long sofar; /* the running value */ + register int d; /* (negative of) next digit */ + char *start; + int digits[32]; /* Room for numbers */ + + /* Make sure *val is sensible in case of error */ + + *val = 0; + + /* Check that the radix is in the range 2..36 */ + +#ifndef DBUG_OFF + if (radix < 2 || radix > 36) { + errno=EDOM; + return NullS; + } +#endif + + /* The basic problem is: how do we handle the conversion of + a number without resorting to machine-specific code to + check for overflow? Obviously, we have to ensure that + no calculation can overflow. We are guaranteed that the + "lower" and "upper" arguments are valid machine integers. + On sign-and-magnitude, twos-complement, and ones-complement + machines all, if +|n| is representable, so is -|n|, but on + twos complement machines the converse is not true. So the + "maximum" representable number has a negative representative. + Limit is set to min(-|lower|,-|upper|); this is the "largest" + number we are concerned with. */ + + /* Calculate Limit using Scale as a scratch variable */ + + if ((limit = lower) > 0) limit = -limit; + if ((scale = upper) > 0) scale = -scale; + if (scale < limit) limit = scale; + + /* Skip leading spaces and check for a sign. + Note: because on a 2s complement machine MinLong is a valid + integer but |MinLong| is not, we have to keep the current + converted value (and the scale!) as *negative* numbers, + so the sign is the opposite of what you might expect. + */ + while (my_isspace(&my_charset_latin1,*src)) src++; + sign = -1; + if (*src == '+') src++; else + if (*src == '-') src++, sign = 1; + + /* Skip leading zeros so that we never compute a power of radix + in scale that we won't have a need for. Otherwise sticking + enough 0s in front of a number could cause the multiplication + to overflow when it neededn't. + */ + start=(char*) src; + while (*src == '0') src++; + + /* Move over the remaining digits. We have to convert from left + to left in order to avoid overflow. Answer is after last digit. + */ + + for (n = 0; (digits[n]=char_val(*src)) < radix && n < 20; n++,src++) ; + + /* Check that there is at least one digit */ + + if (start == src) { + errno=EDOM; + return NullS; + } + + /* The invariant we want to maintain is that src is just + to the right of n digits, we've converted k digits to + sofar, scale = -radix**k, and scale < sofar < 0. Now + if the final number is to be within the original + Limit, we must have (to the left)*scale+sofar >= Limit, + or (to the left)*scale >= Limit-sofar, i.e. the digits + to the left of src must form an integer <= (Limit-sofar)/(scale). + In particular, this is true of the next digit. In our + incremental calculation of Limit, + + IT IS VITAL that (-|N|)/(-|D|) = |N|/|D| + */ + + for (sofar = 0, scale = -1; --n >= 1;) + { + if ((long) -(d=digits[n]) < limit) { + errno=ERANGE; + return NullS; + } + limit = (limit+d)/radix, sofar += d*scale; scale *= radix; + } + if (n == 0) + { + if ((long) -(d=digits[n]) < limit) /* get last digit */ + { + errno=ERANGE; + return NullS; + } + sofar+=d*scale; + } + + /* Now it might still happen that sofar = -32768 or its equivalent, + so we can't just multiply by the sign and check that the result + is in the range lower..upper. All of this caution is a right + pain in the neck. If only there were a standard routine which + says generate thus and such a signal on integer overflow... + But not enough machines can do it *SIGH*. + */ + if (sign < 0) + { + if (sofar < -LONG_MAX || (sofar= -sofar) > upper) + { + errno=ERANGE; + return NullS; + } + } + else if (sofar < lower) + { + errno=ERANGE; + return NullS; + } + *val = sofar; + errno=0; /* indicate that all went well */ + return (char*) src; +} + + /* Theese are so slow compared with ordinary, optimized atoi */ + +#ifdef WANT_OUR_ATOI + +int atoi(const char *src) +{ + long val; + str2int(src, 10, (long) INT_MIN, (long) INT_MAX, &val); + return (int) val; +} + + +long atol(const char *src) +{ + long val; + str2int(src, 10, LONG_MIN, LONG_MAX, &val); + return val; +} + +#endif /* WANT_OUR_ATOI */ diff --git a/externals/mysql/strings/str_alloc.c b/externals/mysql/strings/str_alloc.c new file mode 100644 index 0000000..615ad1b --- /dev/null +++ b/externals/mysql/strings/str_alloc.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#include + +static void *my_str_malloc_default(size_t size) +{ + void *ret= malloc(size); + if (!ret) + exit(1); + return ret; +} + +static void my_str_free_default(void *ptr) +{ + free(ptr); +} + +void *(*my_str_malloc)(size_t)= &my_str_malloc_default; +void (*my_str_free)(void *)= &my_str_free_default; diff --git a/externals/mysql/strings/str_test.c b/externals/mysql/strings/str_test.c new file mode 100644 index 0000000..e435819 --- /dev/null +++ b/externals/mysql/strings/str_test.c @@ -0,0 +1,277 @@ +/* Copyright (C) 2000-2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Test of all stringfunktions that is coded in assembler */ + +#include +#include +#include "m_string.h" + +#define F_LEN 8 +#define F_CHAR 'A' +#define F_FILL 'B' +#define T_LEN 15 +#define T_CHAR 'D' +#define T_FILL 'E' +#define F_PREFILL '0' +#define T_PREFILL '1' + +static char from_buff[100],to_buff[100]; +static char * from, *to; +static int errors,tests; +static int test_strarg(const char *name,...); +static void init_strings (void); /* Init from and to */ +void test_arg (const char *message,long func_value,long value); +int compare_buff(const char *message,char * b1,char * b2,int length, + pchar fill, pchar prefill); + +static int my_test(int a) +{ + return a ? 1 : 0; +} + +int main(void) +{ + static char v1[]="Monty",v2[]="on",v3[]="Montys",v4[]="ty",v5[]="gr", + v6[]="hohohoo",v7[]="hohoo",v8[]="hohooo",v9[]="t", + cont[]="qwet"; + errors=tests=0; + init_strings(); + + test_arg("bcmp(from,to,5)",(long) my_test(bcmp(from,to,5)),1L); + test_arg("bcmp(from,from,5)",(long) bcmp(from,from,5),0L); + + test_arg("bcmp(from,to,0)",(long) bcmp(from,to,0),0L); + test_arg("strend(from)",(long) strend(from),(long) from+F_LEN); + test_arg("strchr(v1,'M')",(long) strchr(v1,'M'),(long) v1); + test_arg("strchr(v1,'y')",(long) strchr(v1,'y'),(long) v1+4); + test_arg("strchr(v1,'x')",(long) strchr(v1,'x'),0L); + test_arg("strcont(v1,cont)",(long) strcont(v1,cont),(long) v1+3); + test_arg("strcont(v1,v2)",(long) strcont(v1,v2),(long) v1+1); + test_arg("strcont(v1,v5)",(long) strcont(v1,v5),0L); + test_arg("is_prefix(v3,v1)",(long) is_prefix(v3,v1),1L); + test_arg("is_prefix(v1,v3)",(long) is_prefix(v1,v3),0L); + test_arg("is_prefix(v3,v4)",(long) is_prefix(v3,v4),0L); + test_arg("strstr(v1,v1)",(long) strstr(v1,v1),(long) v1); + test_arg("strstr(v1,v2)",(long) strstr(v1,v2),(long) v1+1); + test_arg("strstr(v1,v4)",(long) strstr(v1,v4),(long) v1+3); + test_arg("strstr(v6,v7)",(long) strstr(v6,v7),(long) v6+2); + test_arg("strstr(v1,v9)",(long) strstr(v1,v9),(long) v1+3); + test_arg("strstr(v1,v3)",(long) strstr(v1,v3),0L); + test_arg("strstr(v1,v5)",(long) strstr(v1,v5),0L); + test_arg("strstr(v6,v8)",(long) strstr(v6,v8),0L); + + test_arg("strinstr(v1,v4)",(long) strinstr(v1,v4),4L); + test_arg("strinstr(v1,v5)",(long) strinstr(v1,v5),0L); + test_arg("strlen(from)",(long) strlen(from),(long) F_LEN); + test_arg("strlen(\"\")",(long) strlen(""),0L); +#ifdef HAVE_STRNLEN + test_arg("strnlen(from,3)",(long) strnlen(from,3),3L); + test_arg("strnlen(from,0)",(long) strnlen(from,0),0L); + test_arg("strnlen(from,1000)",(long) strnlen(from,1000),(long) F_LEN); +#endif + + test_strarg("bfill(to,4,' ')",(bfill(to,4,' '),0L),INT_MAX32,4,' ',0,0); + test_strarg("bfill(from,0,' ')",(bfill(from,0,' '),0L),INT_MAX32,0,0); + test_strarg("bzero(to,3)",(bzero(to,3),0L),INT_MAX32,3,0,0,0); + test_strarg("bzero(to,0)",(bzero(to,0),0L),INT_MAX32,0,0); + test_strarg("bmove(to,from,4)",(bmove(to,from,4),0L),INT_MAX32,4,F_CHAR, + 0,0); + test_strarg("bmove(to,from,0)",(bmove(to,from,0),0L),INT_MAX32,0,0); + test_strarg("bmove_upp(to+6,from+6,3)",(bmove_upp(to+6,from+6,3),0L),INT_MAX32, + 3,T_CHAR,3,F_CHAR,0,0); + test_strarg("bmove_upp(to,from,0)",(bmove_upp(to,from,0),0L),INT_MAX32,0,0); + test_strarg("bmove_align(to,from,8)",(bmove_align(to,from,8),0L),INT_MAX32, + 8,F_CHAR,0,0); + test_strarg("strappend(to,3,' ')",(strappend(to,3,' '),0L),INT_MAX32, + 3,T_CHAR,1,0,T_LEN-4,T_CHAR,1,0,0,0); + test_strarg("strappend(to,T_LEN+5,' ')",(strappend(to,T_LEN+5,' '),0L),INT_MAX32, + T_LEN,T_CHAR,5,' ',1,0,0,0); + test_strarg("strcat(to,from)",strcat(to,from),to,T_LEN,T_CHAR, + F_LEN,F_CHAR,1,0,0,0); + test_strarg("strcat(to,\"\")",strcat(to,""),INT_MAX32,0,0); + test_strarg("strfill(to,4,' ')",strfill(to,4,' '),to+4,4,' ',1,0,0,0); + test_strarg("strfill(from,0,' ')",strfill(from,0,' '),from,0,1,0,0); + test_strarg("strmake(to,from,4)",strmake(to,from,4),to+4,4,F_CHAR, + 1,0,0,0); + test_strarg("strmake(to,from,0)",strmake(to,from,0),to+0,1,0,0,0); + test_strarg("strmov(to,from)",strmov(to,from),to+F_LEN,F_LEN,F_CHAR,0,0); + test_strarg("strmov(to,\"\")",strmov(to,""),to,1,0,0,0); + test_strarg("strnmov(to,from,2)",strnmov(to,from,2),to+2,2,F_CHAR,0,0); + test_strarg("strnmov(to,from,F_LEN+5)",strnmov(to,from,F_LEN+5),to+F_LEN, + F_LEN,F_CHAR,1,0,0,0); + test_strarg("strnmov(to,\"\",2)",strnmov(to,"",2),to,1,0,0,0); + test_strarg("strxmov(to,from,\"!!\",NullS)",strxmov(to,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0); + test_strarg("strxmov(to,NullS)",strxmov(to,NullS),to,1,0,0,0); + test_strarg("strxmov(to,from,from,from,from,from,'!!',from,NullS)",strxmov(to,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0); + + test_strarg("strxnmov(to,100,from,\"!!\",NullS)",strxnmov(to,100,from,"!!",NullS),to+F_LEN+2,F_LEN,F_CHAR,2,'!',0,0,0); + test_strarg("strxnmov(to,2,NullS)",strxnmov(to,2,NullS),to,1,0,0,0); + test_strarg("strxnmov(to,100,from,from,from,from,from,'!!',from,NullS)",strxnmov(to,100,from,from,from,from,from,"!!",from,NullS),to+F_LEN*6+2,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,F_LEN,F_CHAR,2,'!',F_LEN,F_CHAR,1,0,0,0); + test_strarg("strxnmov(to,2,\"!!!\",NullS)",strxnmov(to,2,"!!!",NullS),to+2,2,'!',0,0,0); + test_strarg("strxnmov(to,2,\"!!\",NullS)",strxnmov(to,2,"!!","xx",NullS),to+2,2,'!',0,0,0); + test_strarg("strxnmov(to,2,\"!\",\"x\",\"y\",NullS)",strxnmov(to,2,"!","x","y",NullS),to+2,1,'!',1,'x',0,0,0); + + test_strarg("bchange(to,2,from,4,6)",(bchange(to,2,from,4,6),0L),INT_MAX32, + 4,F_CHAR,2,T_CHAR,0,0); + + printf("tests: %d errors: %d\n",tests,errors); + if (errors) + fputs("--- Some functions doesn't work!! Fix them\n",stderr); + return(errors > 0); +} /* main */ + + + /* Init strings */ + +void init_strings(void) +{ + reg1 int i; + reg2 char *pos; + + from=from_buff+3; to=to_buff+3; + + pos=from_buff; *pos++= F_FILL; *pos++=F_FILL; *pos++=F_PREFILL; + for (i=0 ; i < F_LEN ; i++) + *pos++=F_CHAR; + *pos++=0; + for (i=0; i<50 ; i++) + *pos++= F_FILL; + + pos=to_buff; *pos++= T_FILL; *pos++=T_FILL; *pos++=T_PREFILL; + for (i=0 ; i < T_LEN ; i++) + *pos++=T_CHAR; + *pos++=0; + for (i=0; i<50 ; i++) + *pos++= T_FILL; +} /* init_strings */ + + + /* Test that function return rigth value */ + +void test_arg(const char *message, long int func_value, long int value) +{ + tests++; + printf("testing '%s'\n",message); + if (func_value != value) + { + printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value); + errors++; + } +} /* test_arg */ + + /* Test function return value and from and to arrays */ + +static int test_strarg(const char *message,...) +{ + long func_value,value; + int error,length; + char chr,cmp_buff[100],*pos,*pos2; + va_list pvar; + + tests++; + va_start(pvar,message); + func_value=va_arg(pvar,long); + value=va_arg(pvar,long); + + printf("testing '%s'\n",message); + if (func_value != value && value != INT_MAX32) + { + printf("func: '%s' = %ld Should be: %ld\n",message,func_value,value); + errors++; + } + pos= cmp_buff; + while ((length = va_arg(pvar, int)) != 0) + { + chr= (char) (va_arg(pvar, int)); + while (length--) + *pos++=chr; + } + pos2=to+ (int)(pos-cmp_buff); + while (pos <= cmp_buff+T_LEN) + *pos++= *pos2++; + if (compare_buff(message,to,cmp_buff,(int) (pos-cmp_buff),T_FILL,T_PREFILL)) + { + init_strings(); + va_end(pvar); + return 1; + } + + pos= cmp_buff; + while ((length = va_arg(pvar, int)) != 0) + { + chr= (char) (va_arg(pvar, int)); + while (length--) + *pos++=chr; + } + pos2=from+ (int)(pos-cmp_buff); + while (pos <= cmp_buff+F_LEN) + *pos++= *pos2++; + error=compare_buff(message,from,cmp_buff,(int) (pos-cmp_buff),F_FILL,F_PREFILL); + init_strings(); + va_end(pvar); + return (error != 0); +} /* test_strarg */ + + + /* test if function made right value */ + +int compare_buff(const char *message, char * b1, char * b2, int length, + pchar fill, pchar prefill) +{ + int i,error=0; + + if (bcmp(b1,b2,length)) + { + errors++; + printf("func: '%s' Buffers differ\nIs: ",message); + for (i=0 ; i +#include "m_string.h" + + +void strappend(register char *s, size_t len, pchar fill) +{ + register char *endpos; + + endpos = s+len; + while (*s++); + s--; + while (s +#include "m_string.h" + +#if defined(MC68000) && defined(DS90) + +char *strcend(const char *s, pchar c) +{ +asm(" movl 4(a7),a0 "); +asm(" movl 8(a7),d1 "); +asm(".L2: movb (a0)+,d0 "); +asm(" cmpb d0,d1 "); +asm(" beq .L1 "); +asm(" tstb d0 "); +asm(" bne .L2 "); +asm(".L1: movl a0,d0 "); +asm(" subql #1,d0 "); +} + +#else + +char *strcend(register const char *s, register pchar c) +{ + for (;;) + { + if (*s == (char) c) return (char*) s; + if (!*s++) return (char*) s-1; + } +} + +#endif diff --git a/externals/mysql/strings/strcont.c b/externals/mysql/strings/strcont.c new file mode 100644 index 0000000..5a518a3 --- /dev/null +++ b/externals/mysql/strings/strcont.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : strcont.c + Author : Monty + Updated: 1988.07.27 + Defines: strcont() + + strcont(str, set) if str contanies any character in the string set. + The result is the position of the first found character in str, or NullS + if there isn't anything found. + +*/ + +#include +#include "m_string.h" + +char * strcont(reg1 const char *str,reg2 const char *set) +{ + reg3 char * start = (char *) set; + + while (*str) + { + while (*set) + { + if (*set++ == *str) + return ((char*) str); + } + set=start; str++; + } + return (NullS); +} /* strcont */ diff --git a/externals/mysql/strings/strend.c b/externals/mysql/strings/strend.c new file mode 100644 index 0000000..4dadf06 --- /dev/null +++ b/externals/mysql/strings/strend.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* File : strend.c + Author : Richard A. O'Keefe. + Updated: 23 April 1984 + Defines: strend() + + strend(s) returns a character pointer to the NUL which ends s. That + is, strend(s)-s == strlen(s). This is useful for adding things at + the end of strings. It is redundant, because strchr(s,'\0') could + be used instead, but this is clearer and faster. + Beware: the asm version works only if strlen(s) < 65535. +*/ + +#include +#include "m_string.h" + +#if VaxAsm + +char *strend(s) +const char *s; +{ + asm("locc $0,$65535,*4(ap)"); + asm("movl r1,r0"); +} + +#else /* ~VaxAsm */ + +char *strend(register const char *s) +{ + while (*s++); + return (char*) (s-1); +} + +#endif /* VaxAsm */ diff --git a/externals/mysql/strings/strfill.c b/externals/mysql/strings/strfill.c new file mode 100644 index 0000000..4b1fe67 --- /dev/null +++ b/externals/mysql/strings/strfill.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : strfill.c + Author : Monty + Updated: 1987.04.16 + Defines: strfill() + + strfill(dest, len, fill) makes a string of fill-characters. The result + string is of length == len. The des+len character is allways set to NULL. + strfill() returns pointer to dest+len; +*/ + +#include +#include "m_string.h" + +char * strfill(char *s, size_t len, pchar fill) +{ + while (len--) *s++ = fill; + *(s) = '\0'; + return(s); +} /* strfill */ diff --git a/externals/mysql/strings/strings-not-used.h b/externals/mysql/strings/strings-not-used.h new file mode 100644 index 0000000..3efaa8a --- /dev/null +++ b/externals/mysql/strings/strings-not-used.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : strings.h + Author : Richard A. O'Keefe. + Updated: 1 June 1984 + Purpose: Header file for the "string(3C)" package. + + All the routines in this package are the original work of + R.A.O'Keefe. Any resemblance between them and any routines in + licensed software is due entirely to these routines having been + written using the "man 3 string" UNIX manual page, or in some cases + the "man 1 sort" manual page as a specification. See the READ-ME to + find the conditions under which these routines may be used & copied. +*/ + +#ifndef NullS + +#include /* Define standar vars */ +#include "m_string.h" + +#define NUL '\0' +#define _AlphabetSize 256 + +#endif /* NullS */ diff --git a/externals/mysql/strings/strinstr.c b/externals/mysql/strings/strinstr.c new file mode 100644 index 0000000..dce498d --- /dev/null +++ b/externals/mysql/strings/strinstr.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : strinstr.c + Author : Monty & David + Updated: 1986.12.08 + Defines: strinstr() + + strinstr(src, pat) looks for an instance of pat in src. pat is not a + regex(3) pattern, it is a literal string which must be matched exactly. + The result 0 if the pattern was not found else it is the start char of + the pattern counted from the beginning of the string, where the first + char is 1. +*/ + +#include +#include "m_string.h" + +size_t strinstr(reg1 const char *str,reg4 const char *search) +{ + reg2 const char *i, *j; + const char *start= str; + + skip: + while (*str != '\0') + { + if (*str++ == *search) + { + i= str; j= search+1; + while (*j) + if (*i++ != *j++) goto skip; + return ((size_t) (str - start)); + } + } + return (0); +} diff --git a/externals/mysql/strings/strmake.c b/externals/mysql/strings/strmake.c new file mode 100644 index 0000000..903a1b8 --- /dev/null +++ b/externals/mysql/strings/strmake.c @@ -0,0 +1,66 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : strmake.c + Author : Michael Widenius + Updated: 20 Jul 1984 + Defines: strmake() + + strmake(dst,src,length) moves length characters, or until end, of src to + dst and appends a closing NUL to dst. + Note that if strlen(src) >= length then dst[length] will be set to \0 + strmake() returns pointer to closing null +*/ + +#include +#include "m_string.h" + +char *strmake(register char *dst, register const char *src, size_t length) +{ + while (length--) + { + if (! (*dst++ = *src++)) + { +#ifdef EXTRA_DEBUG + /* + 'length' is the maximum length of the string; the buffer needs + to be one character larger to accommodate the terminating + '\0'. This is easy to get wrong, so we make sure we write to + the entire length of the buffer to identify incorrect + buffer-sizes. We only initialism the "unused" part of the + buffer here, a) for efficiency, and b) because dst==src is + allowed, so initializing the entire buffer would overwrite the + source-string. Also, we write a character rather than '\0' as + this makes spotting these problems in the results easier. + + If we are using purify/valgrind, we only set one character at + end to be able to detect also wrong accesses after the end of + dst. + */ + if (length) + { +#ifdef HAVE_purify + dst[length-1]= 'Z'; +#else + bfill(dst, length-1, (int) 'Z'); +#endif /* HAVE_purify */ + } +#endif /* EXTRA_DEBUG */ + return dst-1; + } + } + *dst=0; + return dst; +} diff --git a/externals/mysql/strings/strmov.c b/externals/mysql/strings/strmov.c new file mode 100644 index 0000000..1393411 --- /dev/null +++ b/externals/mysql/strings/strmov.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + strmov(dst, src) moves all the characters of src (including the + closing NUL) to dst, and returns a pointer to the new closing NUL in + dst. The similar UNIX routine strcpy returns the old value of dst, + which I have never found useful. strmov(strmov(dst,a),b) moves a//b + into dst, which seems useful. +*/ + +#include +#include "m_string.h" + +#ifdef BAD_STRING_COMPILER +#undef strmov +#define strmov strmov_overlapp +#endif + +#ifndef strmov + +#if !defined(MC68000) && !defined(DS90) + +char *strmov(register char *dst, register const char *src) +{ + while ((*dst++ = *src++)) ; + return dst-1; +} + +#else + +char *strmov(dst, src) + char *dst, *src; +{ + asm(" movl 4(a7),a1 "); + asm(" movl 8(a7),a0 "); + asm(".L4: movb (a0)+,(a1)+ "); + asm(" jne .L4 "); + asm(" movl a1,d0 "); + asm(" subql #1,d0 "); +} + +#endif + +#endif /* strmov */ diff --git a/externals/mysql/strings/strnlen.c b/externals/mysql/strings/strnlen.c new file mode 100644 index 0000000..826cd5a --- /dev/null +++ b/externals/mysql/strings/strnlen.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : strnlen.c + Author : Michael Widenius + Updated: 20 April 1984 + Defines: strnlen. + strnlen(s, len) returns the length of s or len if s is longer than len. +*/ + +#include +#include "m_string.h" + +#ifndef HAVE_STRNLEN + +size_t strnlen(register const char *s, register size_t maxlen) +{ + const char *end= (const char *)memchr(s, '\0', maxlen); + return end ? (size_t) (end - s) : maxlen; +} + +#endif diff --git a/externals/mysql/strings/strnmov.c b/externals/mysql/strings/strnmov.c new file mode 100644 index 0000000..7e26877 --- /dev/null +++ b/externals/mysql/strings/strnmov.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + strnmov(dst,src,length) moves length characters, or until end, of src to + dst and appends a closing NUL to dst if src is shorter than length. + The result is a pointer to the first NUL in dst, or is dst+n if dst was + truncated. +*/ + +#include +#include "m_string.h" + +char *strnmov(register char *dst, register const char *src, size_t n) +{ + while (n-- != 0) { + if (!(*dst++ = *src++)) { + return (char*) dst-1; + } + } + return dst; +} diff --git a/externals/mysql/strings/strstr.c b/externals/mysql/strings/strstr.c new file mode 100644 index 0000000..a5b50d1 --- /dev/null +++ b/externals/mysql/strings/strstr.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* File : strstr.c + Author : Monty + Updated: 1986.11.24 + Defines: strstr() + + strstr(src, pat) looks for an instance of pat in src. pat is not a + regex(3) pattern, it is a literal string which must be matched exactly. + The result is a pointer to the first character of the located instance, + or NullS if pat does not occur in src. + +*/ + +#include +#include "m_string.h" + +#ifndef HAVE_STRSTR + +char *strstr(register const char *str,const char *search) +{ + register char *i,*j; + register char first= *search; + +skip: + while (*str != '\0') { + if (*str++ == first) { + i=(char*) str; j=(char*) search+1; + while (*j) + if (*i++ != *j++) goto skip; + return ((char*) str-1); + } + } + return ((char*) 0); +} /* strstr */ + +#endif diff --git a/externals/mysql/strings/strto.c b/externals/mysql/strings/strto.c new file mode 100644 index 0000000..fcb0d80 --- /dev/null +++ b/externals/mysql/strings/strto.c @@ -0,0 +1,209 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + strtol,strtoul,strtoll,strtoull + convert string to long, unsigned long, long long or unsigned long long. + strtoxx(char *src,char **ptr,int base) + converts the string pointed to by src to an long of appropriate long and + returnes it. It skips leading spaces and tabs (but not newlines, formfeeds, + backspaces), then it accepts an optional sign and a sequence of digits + in the specified radix. + If the value of ptr is not (char **)NULL, a pointer to the character + terminating the scan is returned in the location pointed to by ptr. + Trailing spaces will NOT be skipped. + + If an error is detected, the result will be LONG_MIN, 0 or LONG_MAX, + (or LONGLONG..) and errno will be set to + EDOM if there are no digits + ERANGE if the result would overflow. + the ptr will be set to src. + This file is based on the strtol from the the GNU C Library. + it can be compiled with the UNSIGNED and/or LONGLONG flag set +*/ + + +#if !defined(_global_h) || !defined(_m_string_h) +# error Calling file must include 'my_global.h' and 'm_string.h' + /* see 'strtoll.c' and 'strtoull.c' for the reasons */ +#endif + +#include "m_ctype.h" +#include "my_sys.h" /* defines errno */ +#include + +#undef strtoull +#undef strtoll +#undef strtoul +#undef strtol +#ifdef USE_LONGLONG +#define UTYPE_MAX (~(ulonglong) 0) +#define TYPE_MIN LONGLONG_MIN +#define TYPE_MAX LONGLONG_MAX +#define longtype longlong +#define ulongtype ulonglong +#ifdef USE_UNSIGNED +#define function ulongtype strtoull +#else +#define function longtype strtoll +#endif +#else +#define UTYPE_MAX (ulong) ~0L +#define TYPE_MIN LONG_MIN +#define TYPE_MAX LONG_MAX +#define longtype long +#define ulongtype unsigned long +#ifdef USE_UNSIGNED +#define function ulongtype strtoul +#else +#define function longtype strtol +#endif +#endif + + +/* Convert NPTR to an `unsigned long int' or `long int' in base BASE. + If BASE is 0 the base is determined by the presence of a leading + zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal. + If BASE is < 2 or > 36, it is reset to 10. + If ENDPTR is not NULL, a pointer to the character after the last + one converted is stored in *ENDPTR. */ + + +function (const char *nptr,char **endptr,int base) +{ + int negative; + register ulongtype cutoff; + register unsigned int cutlim; + register ulongtype i; + register const char *s; + register uchar c; + const char *save; + int overflow; + + if (base < 0 || base == 1 || base > 36) + base = 10; + + s = nptr; + + /* Skip white space. */ + while (my_isspace(&my_charset_latin1, *s)) + ++s; + if (*s == '\0') + { + goto noconv; + } + + /* Check for a sign. */ + negative= 0; + if (*s == '-') + { + negative = 1; + ++s; + } + else if (*s == '+') + { + ++s; + } + + + if (base == 16 && s[0] == '0' && my_toupper (&my_charset_latin1, s[1]) == 'X') + s += 2; + + /* If BASE is zero, figure it out ourselves. */ + if (base == 0) + { + if (*s == '0') + { + if (my_toupper (&my_charset_latin1, s[1]) == 'X') + { + s += 2; + base = 16; + } + else + base = 8; + } + else + base = 10; + } + + /* Save the pointer so we can check later if anything happened. */ + save = s; + + cutoff = UTYPE_MAX / (unsigned long int) base; + cutlim = (uint) (UTYPE_MAX % (unsigned long int) base); + + overflow = 0; + i = 0; + for (c = *s; c != '\0'; c = *++s) + { + if (my_isdigit (&my_charset_latin1, c)) + c -= '0'; + else if (my_isalpha (&my_charset_latin1, c)) + c = my_toupper (&my_charset_latin1, c) - 'A' + 10; + else + break; + if (c >= base) + break; + /* Check for overflow. */ + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + i *= (ulongtype) base; + i += c; + } + } + + /* Check if anything actually happened. */ + if (s == save) + goto noconv; + + /* Store in ENDPTR the address of one character + past the last character we converted. */ + if (endptr != NULL) + *endptr = (char *) s; + +#ifndef USE_UNSIGNED + /* Check for a value that is within the range of + `unsigned long int', but outside the range of `long int'. */ + if (negative) + { + if (i > (ulongtype) TYPE_MIN) + overflow = 1; + } + else if (i > (ulongtype) TYPE_MAX) + overflow = 1; +#endif + + if (overflow) + { + my_errno=ERANGE; +#ifdef USE_UNSIGNED + return UTYPE_MAX; +#else + return negative ? TYPE_MIN : TYPE_MAX; +#endif + } + + /* Return the result of the appropriate sign. */ + return (negative ? -((longtype) i) : (longtype) i); + +noconv: + /* There was no number to convert. */ + my_errno=EDOM; + if (endptr != NULL) + *endptr = (char *) nptr; + return 0L; +} diff --git a/externals/mysql/strings/strtol.c b/externals/mysql/strings/strtol.c new file mode 100644 index 0000000..42476b0 --- /dev/null +++ b/externals/mysql/strings/strtol.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This implements strtol() if needed */ + +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + */ +#include +#include + +#if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__) +#include "strto.c" +#endif diff --git a/externals/mysql/strings/strtoll.c b/externals/mysql/strings/strtoll.c new file mode 100644 index 0000000..cfb6fbd --- /dev/null +++ b/externals/mysql/strings/strtoll.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This implements strtoll() if needed */ + + +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + This solves a problem on Tru64 where the C99 compiler has a prototype + for 'strtoll()' but no implementation, see "6.1 New C99 library functions" + in file '/usr/share/doclib/cc.dtk/release_notes.txt'. + */ +#include +#include + +#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG) +#define USE_LONGLONG +#include "strto.c" +#endif diff --git a/externals/mysql/strings/strtoul.c b/externals/mysql/strings/strtoul.c new file mode 100644 index 0000000..3e2b51b --- /dev/null +++ b/externals/mysql/strings/strtoul.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This implements strtol() if needed */ + +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + */ +#include +#include + +#if !defined(MSDOS) && !defined(HAVE_STRTOUL) +#define USE_UNSIGNED +#include "strto.c" +#endif diff --git a/externals/mysql/strings/strtoull.c b/externals/mysql/strings/strtoull.c new file mode 100644 index 0000000..94bf690 --- /dev/null +++ b/externals/mysql/strings/strtoull.c @@ -0,0 +1,34 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* This implements strtoull() if needed */ + + +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + This solves a problem on Tru64 where the C99 compiler has a prototype + for 'strtoull()' but no implementation, see "6.1 New C99 library functions" + in file '/usr/share/doclib/cc.dtk/release_notes.txt'. + */ +#include +#include + +#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG) +#define USE_UNSIGNED +#define USE_LONGLONG +#include "strto.c" +#endif diff --git a/externals/mysql/strings/strxmov.c b/externals/mysql/strings/strxmov.c new file mode 100644 index 0000000..9dd2c93 --- /dev/null +++ b/externals/mysql/strings/strxmov.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* File : strxmov.c + Author : Richard A. O'Keefe. + Updated: 25 may 1984 + Defines: strxmov() + + strxmov(dst, src1, ..., srcn, NullS) + moves the concatenation of src1,...,srcn to dst, terminates it + with a NUL character, and returns a pointer to the terminating NUL. + It is just like strmov except that it concatenates multiple sources. + Beware: the last argument should be the null character pointer. + Take VERY great care not to omit it! Also be careful to use NullS + and NOT to use 0, as on some machines 0 is not the same size as a + character pointer, or not the same bit pattern as NullS. +*/ + +#include +#include "m_string.h" +#include + +char *strxmov(char *dst,const char *src, ...) +{ + va_list pvar; + + va_start(pvar,src); + while (src != NullS) { + while ((*dst++ = *src++)) ; + dst--; + src = va_arg(pvar, char *); + } + va_end(pvar); + *dst = 0; /* there might have been no sources! */ + return dst; +} diff --git a/externals/mysql/strings/strxnmov.c b/externals/mysql/strings/strxnmov.c new file mode 100644 index 0000000..16469be --- /dev/null +++ b/externals/mysql/strings/strxnmov.c @@ -0,0 +1,63 @@ +/* Copyright (C) 2002 MySQL AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; version 2 + of the License. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* File : strxnmov.c + Author : Richard A. O'Keefe. + Updated: 2 June 1984 + Defines: strxnmov() + + strxnmov(dst, len, src1, ..., srcn, NullS) + moves the first len characters of the concatenation of src1,...,srcn + to dst and add a closing NUL character. + It is just like strnmov except that it concatenates multiple sources. + Beware: the last argument should be the null character pointer. + Take VERY great care not to omit it! Also be careful to use NullS + and NOT to use 0, as on some machines 0 is not the same size as a + character pointer, or not the same bit pattern as NullS. + + NOTE + strxnmov is like strnmov in that it moves up to len + characters; dst will be padded on the right with one '\0' character. + if total-string-length >= length then dst[length] will be set to \0 +*/ + +#include +#include "m_string.h" +#include + +char *strxnmov(char *dst, size_t len, const char *src, ...) +{ + va_list pvar; + char *end_of_dst=dst+len; + + va_start(pvar,src); + while (src != NullS) + { + do + { + if (dst == end_of_dst) + goto end; + } + while ((*dst++ = *src++)); + dst--; + src = va_arg(pvar, char *); + } +end: + *dst=0; + va_end(pvar); + return dst; +} diff --git a/externals/mysql/strings/t_ctype.h b/externals/mysql/strings/t_ctype.h new file mode 100644 index 0000000..af4f3eb --- /dev/null +++ b/externals/mysql/strings/t_ctype.h @@ -0,0 +1,258 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved. + Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved. + Permission to use, copy, modify, distribute and sell this software + and its documentation for any purpose is hereby granted without fee, + provided that the above copyright notice appear in all copies. + Smaphan Raruenrom and Pruet Boonma makes no representations about + the suitability of this software for any purpose. It is provided + "as is" without express or implied warranty. +*/ + +/* + LC_COLLATE category + Level information +*/ + +#ifndef _t_ctype_h +#define _t_ctype_h + +typedef unsigned char tchar; + +#define TOT_LEVELS 5 +#define LAST_LEVEL 4 /* TOT_LEVELS - 1 */ + +#define IGNORE 0 + + +/* level 1 symbols & order */ +enum l1_symbols { + L1_08 = TOT_LEVELS, + L1_18, + L1_28, + L1_38, + L1_48, + L1_58, + L1_68, + L1_78, + L1_88, + L1_98, + L1_A8, + L1_B8, + L1_C8, + L1_D8, + L1_E8, + L1_F8, + L1_G8, + L1_H8, + L1_I8, + L1_J8, + L1_K8, + L1_L8, + L1_M8, + L1_N8, + L1_O8, + L1_P8, + L1_Q8, + L1_R8, + L1_S8, + L1_T8, + L1_U8, + L1_V8, + L1_W8, + L1_X8, + L1_Y8, + L1_Z8, + L1_KO_KAI, + L1_KHO_KHAI, + L1_KHO_KHUAT, + L1_KHO_KHWAI, + L1_KHO_KHON, + L1_KHO_RAKHANG, + L1_NGO_NGU, + L1_CHO_CHAN, + L1_CHO_CHING, + L1_CHO_CHANG, + L1_SO_SO, + L1_CHO_CHOE, + L1_YO_YING, + L1_DO_CHADA, + L1_TO_PATAK, + L1_THO_THAN, + L1_THO_NANGMONTHO, + L1_THO_PHUTHAO, + L1_NO_NEN, + L1_DO_DEK, + L1_TO_TAO, + L1_THO_THUNG, + L1_THO_THAHAN, + L1_THO_THONG, + L1_NO_NU, + L1_BO_BAIMAI, + L1_PO_PLA, + L1_PHO_PHUNG, + L1_FO_FA, + L1_PHO_PHAN, + L1_FO_FAN, + L1_PHO_SAMPHAO, + L1_MO_MA, + L1_YO_YAK, + L1_RO_RUA, + L1_RU, + L1_LO_LING, + L1_LU, + L1_WO_WAEN, + L1_SO_SALA, + L1_SO_RUSI, + L1_SO_SUA, + L1_HO_HIP, + L1_LO_CHULA, + L1_O_ANG, + L1_HO_NOKHUK, + L1_NKHIT, + L1_SARA_A, + L1_MAI_HAN_AKAT, + L1_SARA_AA, + L1_SARA_AM, + L1_SARA_I, + L1_SARA_II, + L1_SARA_UE, + L1_SARA_UEE, + L1_SARA_U, + L1_SARA_UU, + L1_SARA_E, + L1_SARA_AE, + L1_SARA_O, + L1_SARA_AI_MAIMUAN, + L1_SARA_AI_MAIMALAI +}; + +/* level 2 symbols & order */ +enum l2_symbols { + L2_BLANK = TOT_LEVELS, + L2_THAII, + L2_YAMAK, + L2_PINTHU, + L2_GARAN, + L2_TYKHU, + L2_TONE1, + L2_TONE2, + L2_TONE3, + L2_TONE4 +}; + +/* level 3 symbols & order */ +enum l3_symbols { + L3_BLANK = TOT_LEVELS, + L3_SPACE, + L3_NB_SACE, + L3_LOW_LINE, + L3_HYPHEN, + L3_COMMA, + L3_SEMICOLON, + L3_COLON, + L3_EXCLAMATION, + L3_QUESTION, + L3_SOLIDUS, + L3_FULL_STOP, + L3_PAIYAN_NOI, + L3_MAI_YAMOK, + L3_GRAVE, + L3_CIRCUMFLEX, + L3_TILDE, + L3_APOSTROPHE, + L3_QUOTATION, + L3_L_PARANTHESIS, + L3_L_BRACKET, + L3_L_BRACE, + L3_R_BRACE, + L3_R_BRACKET, + L3_R_PARENTHESIS, + L3_AT, + L3_BAHT, + L3_DOLLAR, + L3_FONGMAN, + L3_ANGKHANKHU, + L3_KHOMUT, + L3_ASTERISK, + L3_BK_SOLIDUS, + L3_AMPERSAND, + L3_NUMBER, + L3_PERCENT, + L3_PLUS, + L3_LESS_THAN, + L3_EQUAL, + L3_GREATER_THAN, + L3_V_LINE +}; + +/* level 4 symbols & order */ +enum l4_symbols { + L4_BLANK = TOT_LEVELS, + L4_MIN, + L4_CAP, + L4_EXT +}; + +enum level_symbols { + L_UPRUPR = TOT_LEVELS, + L_UPPER, + L_MIDDLE, + L_LOWER +}; + +#define _is(c) (t_ctype[(c)][LAST_LEVEL]) +#define _level 8 +#define _consnt 16 +#define _ldvowel 32 +#define _fllwvowel 64 +#define _uprvowel 128 +#define _lwrvowel 256 +#define _tone 512 +#define _diacrt1 1024 +#define _diacrt2 2048 +#define _combine 4096 +#define _stone 8192 +#define _tdig 16384 +#define _rearvowel (_fllwvowel | _uprvowel | _lwrvowel) +#define _diacrt (_diacrt1 | _diacrt2) +#define levelof(c) ( _is(c) & _level ) +#define isthai(c) ( (c) >= 128 ) +#define istalpha(c) ( _is(c) & (_consnt|_ldvowel|_rearvowel|\ + _tone|_diacrt1|_diacrt2) ) +#define isconsnt(c) ( _is(c) & _consnt ) +#define isldvowel(c) ( _is(c) & _ldvowel ) +#define isfllwvowel(c) ( _is(c) & _fllwvowel ) +#define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) ) +#define isuprvowel(c) ( _is(c) & _uprvowel ) +#define islwrvowel(c) ( _is(c) & _lwrvowel ) +#define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel)) +#define isrearvowel(c) ( _is(c) & _rearvowel ) +#define isvowel(c) ( _is(c) & (_ldvowel|_rearvowel) ) +#define istone(c) ( _is(c) & _tone ) +#define isunldable(c) ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) ) +#define iscombinable(c) ( _is(c) & _combine ) +#define istdigit(c) ( _is(c) & _tdig ) +#define isstone(c) ( _is(c) & _stone ) +#define isdiacrt1(c) ( _is(c) & _diacrt1) +#define isdiacrt2(c) ( _is(c) & _diacrt2) +#define isdiacrt(c) ( _is(c) & _diacrt) + +/* Function prototype called by sql/field.cc */ +void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length); + +#endif diff --git a/externals/mysql/strings/uca-dump.c b/externals/mysql/strings/uca-dump.c new file mode 100644 index 0000000..774e940 --- /dev/null +++ b/externals/mysql/strings/uca-dump.c @@ -0,0 +1,332 @@ +/* Copyright (C) 2004 MySQL AB + + 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; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include +#include +#include + +typedef unsigned char uchar; +typedef unsigned short uint16; + +struct uca_item_st +{ + uchar num; + uint16 weight[4][9]; +}; + +#if 0 +#define MY_UCA_NPAGES 1024 +#define MY_UCA_NCHARS 64 +#define MY_UCA_CMASK 63 +#define MY_UCA_PSHIFT 6 +#else +#define MY_UCA_NPAGES 256 +#define MY_UCA_NCHARS 256 +#define MY_UCA_CMASK 255 +#define MY_UCA_PSHIFT 8 +#endif + +static char *pname[]= {"", "2", "3"}; + +int main(int ac, char **av) +{ + char str[256]; + char *weights[64]; + struct uca_item_st uca[64*1024]; + size_t code, w; + int pageloaded[MY_UCA_NPAGES]; + + bzero(uca, sizeof(uca)); + bzero(pageloaded, sizeof(pageloaded)); + + while (fgets(str,sizeof(str),stdin)) + { + char *comment; + char *weight; + char *s; + size_t codenum; + + code= strtol(str,NULL,16); + + if (str[0]=='#' || (code > 0xFFFF)) + continue; + if ((comment=strchr(str,'#'))) + { + *comment++= '\0'; + for ( ; *comment==' ' ; comment++); + }else + continue; + + if ((weight=strchr(str,';'))) + { + *weight++= '\0'; + for ( ; *weight==' ' ; weight++); + } + else + continue; + + codenum= 0; + s= strtok(str, " \t"); + while (s) + { + s= strtok(NULL, " \t"); + codenum++; + } + + if (codenum>1) + { + /* Multi-character weight, + i.e. contraction. + Not supported yet. + */ + continue; + } + + uca[code].num= 0; + s= strtok(weight, " []"); + while (s) + { + weights[uca[code].num]= s; + s= strtok(NULL, " []"); + uca[code].num++; + } + + for (w=0; w < uca[code].num; w++) + { + size_t partnum; + + partnum= 0; + s= weights[w]; + while (*s) + { + char *endptr; + size_t part; + part= strtol(s+1,&endptr,16); + uca[code].weight[partnum][w]= part; + s= endptr; + partnum++; + } + } + /* Mark that a character from this page was loaded */ + pageloaded[code >> MY_UCA_PSHIFT]++; + } + + + + /* Now set implicit weights */ + for (code=0; code <= 0xFFFF; code++) + { + size_t base, aaaa, bbbb; + + if (uca[code].num) + continue; + + /* + 3400; + 4DB5; + 4E00; + 9FA5; + */ + + if (code >= 0x3400 && code <= 0x4DB5) + base= 0xFB80; + else if (code >= 0x4E00 && code <= 0x9FA5) + base= 0xFB40; + else + base= 0xFBC0; + + aaaa= base + (code >> 15); + bbbb= (code & 0x7FFF) | 0x8000; + uca[code].weight[0][0]= aaaa; + uca[code].weight[0][1]= bbbb; + + uca[code].weight[1][0]= 0x0020; + uca[code].weight[1][1]= 0x0000; + + uca[code].weight[2][0]= 0x0002; + uca[code].weight[2][1]= 0x0000; + + uca[code].weight[3][0]= 0x0001; + uca[code].weight[3][2]= 0x0000; + + uca[code].num= 2; + } + + printf("#include \"my_uca.h\"\n"); + + printf("#define MY_UCA_NPAGES %d\n",MY_UCA_NPAGES); + printf("#define MY_UCA_NCHARS %d\n",MY_UCA_NCHARS); + printf("#define MY_UCA_CMASK %d\n",MY_UCA_CMASK); + printf("#define MY_UCA_PSHIFT %d\n",MY_UCA_PSHIFT); + + for (w=0; w<3; w++) + { + size_t page; + int pagemaxlen[MY_UCA_NPAGES]; + + for (page=0; page < MY_UCA_NPAGES; page++) + { + size_t offs; + size_t maxnum= 0; + size_t nchars= 0; + size_t mchars; + size_t ndefs= 0; + + pagemaxlen[page]= 0; + + /* + Skip this page if no weights were loaded + */ + + if (!pageloaded[page]) + continue; + + /* + Calculate maximum weight + length for this page + */ + + for (offs=0; offs < MY_UCA_NCHARS; offs++) + { + size_t i, num; + + code= page*MY_UCA_NCHARS+offs; + + /* Calculate only non-zero weights */ + for (num=0, i=0; i < uca[code].num; i++) + if (uca[code].weight[w][i]) + num++; + + maxnum= maxnum < num ? num : maxnum; + + /* Check if default weight */ + if (w == 1 && num == 1) + { + /* 0020 0000 ... */ + if (uca[code].weight[w][0] == 0x0020) + ndefs++; + } + else if (w == 2 && num == 1) + { + /* 0002 0000 ... */ + if (uca[code].weight[w][0] == 0x0002) + ndefs++; + } + } + maxnum++; + + /* + If the page have only default weights + then no needs to dump it, skip. + */ + if (ndefs == MY_UCA_NCHARS) + { + continue; + } + switch (maxnum) + { + case 0: mchars= 8; break; + case 1: mchars= 8; break; + case 2: mchars= 8; break; + case 3: mchars= 9; break; + case 4: mchars= 8; break; + default: mchars= uca[code].num; + } + + pagemaxlen[page]= maxnum; + + + /* + Now print this page + */ + + + printf("uint16 page%03Xdata%s[]= { /* %04X (%d weights per char) */\n", + page, pname[w], page*MY_UCA_NCHARS, maxnum); + + for (offs=0; offs < MY_UCA_NCHARS; offs++) + { + uint16 weight[8]; + size_t num, i; + + code= page*MY_UCA_NCHARS+offs; + + bzero(weight,sizeof(weight)); + + /* Copy non-zero weights */ + for (num=0, i=0; i < uca[code].num; i++) + { + if (uca[code].weight[w][i]) + { + weight[num]= uca[code].weight[w][i]; + num++; + } + } + + for (i=0; i < maxnum; i++) + { + /* + Invert weights for secondary level to + sort upper case letters before their + lower case counter part. + */ + int tmp= weight[i]; + if (w == 2 && tmp) + tmp= (int)(0x20 - weight[i]); + + + printf("0x%04X", tmp); + if ((offs+1 != MY_UCA_NCHARS) || (i+1!=maxnum)) + printf(","); + nchars++; + } + if (nchars >=mchars) + { + printf("\n"); + nchars=0; + } + else + { + printf(" "); + } + } + printf("};\n\n"); + } + + printf("uchar uca_length%s[%d]={\n", pname[w], MY_UCA_NPAGES); + for (page=0; page < MY_UCA_NPAGES; page++) + { + printf("%d%s%s",pagemaxlen[page],page +#include +#include +*/ +#include +#include +#include +#include "m_ctype.h" + + +typedef struct my_ctype_name_st +{ + const char *name; + int val; +} MY_CTYPE_NAME_ST; + + +static MY_CTYPE_NAME_ST my_ctype_name[]= +{ + {"Lu", _MY_U}, /* Letter, Uppercase */ + {"Ll", _MY_L}, /* Letter, Lowercase */ + {"Lt", _MY_U}, /* Letter, Titlecase */ + {"Lm", _MY_L}, /* Letter, Modifier */ + {"Lo", _MY_L}, /* Letter, other */ + + {"Nd", _MY_NMR}, /* Number, Decimal Digit */ + {"Nl", _MY_NMR|_MY_U|_MY_L}, /* Number, Letter */ + {"No", _MY_NMR|_MY_PNT}, /* Number, Other */ + + {"Mn", _MY_L|_MY_PNT}, /* Mark, Nonspacing */ + {"Mc", _MY_L|_MY_PNT}, /* Mark, Spacing Combining */ + {"Me", _MY_L|_MY_PNT}, /* Mark, Enclosing */ + + {"Pc", _MY_PNT}, /* Punctuation, Connector */ + {"Pd", _MY_PNT}, /* Punctuation, Dash */ + {"Ps", _MY_PNT}, /* Punctuation, Open */ + {"Pe", _MY_PNT}, /* Punctuation, Close */ + {"Pi", _MY_PNT}, /* Punctuation, Initial quote */ + {"Pf", _MY_PNT}, /* Punctuation, Final quote */ + {"Po", _MY_PNT}, /* Punctuation, Other */ + + {"Sm", _MY_PNT}, /* Symbol, Math */ + {"Sc", _MY_PNT}, /* Symbol, Currency */ + {"Sk", _MY_PNT}, /* Symbol, Modifier */ + {"So", _MY_PNT}, /* Symbol, Other */ + + {"Zs", _MY_SPC}, /* Separator, Space */ + {"Zl", _MY_SPC}, /* Separator, Line */ + {"Zp", _MY_SPC}, /* Separator, Paragraph */ + + {"Cc", _MY_CTR}, /* Other, Control */ + {"Cf", _MY_CTR}, /* Other, Format */ + {"Cs", _MY_CTR}, /* Other, Surrogate */ + {"Co", _MY_CTR}, /* Other, Private Use */ + {"Cn", _MY_CTR}, /* Other, Not Assigned */ + {NULL, 0} +}; + + +static int +ctypestr2num(const char *tok) +{ + MY_CTYPE_NAME_ST *p; + for (p= my_ctype_name; p->name; p++) + { + if (!strncasecmp(p->name, tok, 2)) + return p->val; + } + return 0; +} + + +int main(int ac, char ** av) +{ + char str[1024]; + unsigned char ctypea[64*1024]; + size_t i; + size_t plane; + MY_UNI_CTYPE uctype[256]; + FILE *f= stdin; + + if (ac > 1 && av[1] && !(f= fopen(av[1],"r"))) + { + fprintf(stderr, "Can't open file %s\n", av[1]); + exit(1); + } + bzero(&ctypea,sizeof(ctypea)); + bzero(&uctype, sizeof(uctype)); + + printf("/*\n"); + printf(" Unicode ctype data\n"); + printf(" Generated from %s\n", av[1] ? av[1] : "stdin"); + printf("*/\n"); + + while(fgets(str, sizeof(str), f)) + { + size_t n= 0, code= 0; + char *s,*e; + int ctype= 0; + + for(s= str; s; ) + { + char *end; + char tok[1024]=""; + e=strchr(s,';'); + if(e) + { + strncpy(tok,s,(unsigned int)(e-s)); + tok[e-s]=0; + } + else + { + strcpy(tok,s); + } + + end=tok+strlen(tok); + + switch(n) + { + case 0: code= strtol(tok,&end,16);break; + case 2: ctype= ctypestr2num(tok);break; + } + + n++; + if(e) s=e+1; + else s=e; + } + if(code<=0xFFFF) + { + ctypea[code]= ctype; + } + } + + /* Fill digits */ + for (i= '0'; i <= '9'; i++) + ctypea[i]= _MY_NMR; + + for (i= 'a'; i <= 'z'; i++) + ctypea[i]|= _MY_X; + for (i= 'A'; i <= 'Z'; i++) + ctypea[i]|= _MY_X; + + + /* Fill ideographs */ + + /* CJK Ideographs Extension A (U+3400 - U+4DB5) */ + for(i=0x3400;i<=0x4DB5;i++) + { + ctypea[i]= _MY_L | _MY_U; + } + + /* CJK Ideographs (U+4E00 - U+9FA5) */ + for(i=0x4E00;i<=0x9FA5;i++){ + ctypea[i]= _MY_L | _MY_U; + } + + /* Hangul Syllables (U+AC00 - U+D7A3) */ + for(i=0xAC00;i<=0xD7A3;i++) + { + ctypea[i]= _MY_L | _MY_U; + } + + + /* Calc plane parameters */ + for(plane=0;plane<256;plane++) + { + size_t character; + uctype[plane].ctype= ctypea+plane*256; + + uctype[plane].pctype= uctype[plane].ctype[0]; + for(character=1;character<256;character++) + { + if (uctype[plane].ctype[character] != uctype[plane].pctype) + { + uctype[plane].pctype= 0; /* Mixed plane */ + break; + } + } + if (character==256) /* All the same, no needs to dump whole plane */ + uctype[plane].ctype= NULL; + } + + /* Dump mixed planes */ + for(plane=0;plane<256;plane++) + { + if(uctype[plane].ctype) + { + int charnum=0; + int num=0; + + printf("static unsigned char uctype_page%02X[256]=\n{\n",plane); + + for(charnum=0;charnum<256;charnum++) + { + int cod; + + cod=(plane<<8)+charnum; + printf(" %2d%s",uctype[plane].ctype[charnum],charnum<255?",":""); + + num++; + if(num==16) + { + printf("\n"); + num=0; + } + } + printf("};\n\n"); + } + } + + + /* Dump plane index */ + printf("MY_UNI_CTYPE my_uni_ctype[256]={\n"); + for(plane=0;plane<256;plane++) + { + char plane_name[128]="NULL"; + if(uctype[plane].ctype){ + sprintf(plane_name,"uctype_page%02X",plane); + } + printf("\t{%d,%s}%s\n",uctype[plane].pctype,plane_name,plane<255?",":""); + } + printf("};\n"); + + return 0; +} diff --git a/externals/mysql/strings/utr11-dump.c b/externals/mysql/strings/utr11-dump.c new file mode 100644 index 0000000..a15f630 --- /dev/null +++ b/externals/mysql/strings/utr11-dump.c @@ -0,0 +1,127 @@ +/* Copyright (C) 2004 MySQL AB + + 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; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include +#include +#include + + +/* + Dump an EastAsianWidth.txt file. + See http://www.unicode.org/reports/tr11/ for details. + Character types: + F - Full width = 1 + H - Half width = 0 + W - Wide = 1 + Na - Narrow = 0 + A - Ambiguous = 0 + N - Neutral = 0 +*/ + + +int main(int ac, char **av) +{ + char str[128]; + int errors= 0; + int plane[0x10000]; + int page[256]; + int i; + + memset(plane, 0, sizeof(plane)); + memset(page, 0, sizeof(page)); + + while (fgets(str, sizeof(str), stdin)) + { + int code1, code2, width; + char *end; + + if (str[0] == '#') + continue; + code1= strtol(str, &end, 16); + if (code1 < 0 || code1 > 0xFFFF) + continue; + if (end[0] == ';') /* One character */ + { + code2= code1; + } + else if (end[0] == '.' && end[1] == '.') /* Range */ + { + end+= 2; + code2= strtol(end, &end, 16); + if (code2 < 0 || code2 > 0xFFFF) + continue; + if (end[0] != ';') + { + errors++; + fprintf(stderr, "error: %s", str); + continue; + } + } + else + { + errors++; + fprintf(stderr, "error: %s", str); + continue; + } + + end++; + width= (end[0] == 'F' || end[0] == 'W') ? 1 : 0; + + for ( ; code1 <= code2; code1++) + { + plane[code1]= width; + } + } + + if (errors) + return 1; + + for (i=0; i < 256; i++) + { + int j; + int *p= plane + 256 * i; + page[i]= 0; + for (j=0; j < 256; j++) + { + page[i]+= p[j]; + } + if (page[i] != 0 && page[i] != 256) + { + printf("static char pg%02X[256]=\n{\n", i); + for (j=0; j < 256; j++) + { + printf("%d%s%s", p[j], j < 255 ? "," : "", (j + 1) % 32 ? "" : "\n"); + } + printf("};\n\n"); + } + } + + printf("static struct {int page; char *p;} utr11_data[256]=\n{\n"); + for (i=0; i < 256; i++) + { + if (page[i] == 0 || page[i] == 256) + { + int width= (page[i] == 256) ? 1 : 0; + printf("{%d,NULL}", width); + } + else + { + printf("{0,pg%02X}", i); + } + printf("%s%s", i < 255 ? "," : "", (i+1) % 8 ? "" : "\n"); + } + printf("};\n"); + return 0; +} diff --git a/externals/mysql/strings/xml.c b/externals/mysql/strings/xml.c new file mode 100644 index 0000000..1b697ec --- /dev/null +++ b/externals/mysql/strings/xml.c @@ -0,0 +1,496 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "my_global.h" +#include "m_string.h" +#include "my_xml.h" + + +#define MY_XML_UNKNOWN 'U' +#define MY_XML_EOF 'E' +#define MY_XML_STRING 'S' +#define MY_XML_IDENT 'I' +#define MY_XML_EQ '=' +#define MY_XML_LT '<' +#define MY_XML_GT '>' +#define MY_XML_SLASH '/' +#define MY_XML_COMMENT 'C' +#define MY_XML_TEXT 'T' +#define MY_XML_QUESTION '?' +#define MY_XML_EXCLAM '!' +#define MY_XML_CDATA 'D' + +typedef struct xml_attr_st +{ + const char *beg; + const char *end; +} MY_XML_ATTR; + + +/* + XML ctype: +*/ +#define MY_XML_ID0 0x01 /* Identifier initial character */ +#define MY_XML_ID1 0x02 /* Identifier medial character */ +#define MY_XML_SPC 0x08 /* Spacing character */ + + +/* + http://www.w3.org/TR/REC-xml/ + [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | + CombiningChar | Extender + [5] Name ::= (Letter | '_' | ':') (NameChar)* +*/ + +static char my_xml_ctype[256]= +{ +/*00*/ 0,0,0,0,0,0,0,0,0,8,8,0,0,8,0,0, +/*10*/ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +/*20*/ 8,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0, /* !"#$%&'()*+,-./ */ +/*30*/ 2,2,2,2,2,2,2,2,2,2,3,0,0,0,0,0, /* 0123456789:;<=>? */ +/*40*/ 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, /* @ABCDEFGHIJKLMNO */ +/*50*/ 3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,3, /* PQRSTUVWXYZ[\]^_ */ +/*60*/ 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, /* `abcdefghijklmno */ +/*70*/ 3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0, /* pqrstuvwxyz{|}~ */ +/*80*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*90*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*A0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*B0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*C0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*D0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*E0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +/*F0*/ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 +}; + +#define my_xml_is_space(c) (my_xml_ctype[(uchar) (c)] & MY_XML_SPC) +#define my_xml_is_id0(c) (my_xml_ctype[(uchar) (c)] & MY_XML_ID0) +#define my_xml_is_id1(c) (my_xml_ctype[(uchar) (c)] & MY_XML_ID1) + + +static const char *lex2str(int lex) +{ + switch(lex) + { + case MY_XML_EOF: return "END-OF-INPUT"; + case MY_XML_STRING: return "STRING"; + case MY_XML_IDENT: return "IDENT"; + case MY_XML_CDATA: return "CDATA"; + case MY_XML_EQ: return "'='"; + case MY_XML_LT: return "'<'"; + case MY_XML_GT: return "'>'"; + case MY_XML_SLASH: return "'/'"; + case MY_XML_COMMENT: return "COMMENT"; + case MY_XML_TEXT: return "TEXT"; + case MY_XML_QUESTION: return "'?'"; + case MY_XML_EXCLAM: return "'!'"; + } + return "unknown token"; +} + +static void my_xml_norm_text(MY_XML_ATTR *a) +{ + for ( ; (a->beg < a->end) && my_xml_is_space(a->beg[0]) ; a->beg++ ); + for ( ; (a->beg < a->end) && my_xml_is_space(a->end[-1]) ; a->end-- ); +} + + +static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) +{ + int lex; + + for (; ( p->cur < p->end) && my_xml_is_space(p->cur[0]) ; p->cur++); + + if (p->cur >= p->end) + { + a->beg=p->end; + a->end=p->end; + lex=MY_XML_EOF; + goto ret; + } + + a->beg=p->cur; + a->end=p->cur; + + if ((p->end - p->cur > 3) && !bcmp(p->cur,"", 3); p->cur++) + {} + if (!bcmp(p->cur, "-->", 3)) + p->cur+=3; + a->end=p->cur; + lex=MY_XML_COMMENT; + } + else if (!bcmp(p->cur, "cur+= 9; + for (; p->cur < p->end - 2 ; p->cur++) + { + if (p->cur[0] == ']' && p->cur[1] == ']' && p->cur[2] == '>') + { + p->cur+= 3; + a->end= p->cur; + break; + } + } + lex= MY_XML_CDATA; + } + else if (strchr("?=/<>!",p->cur[0])) + { + p->cur++; + a->end=p->cur; + lex=a->beg[0]; + } + else if ( (p->cur[0] == '"') || (p->cur[0] == '\'') ) + { + p->cur++; + for (; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++) + {} + a->end=p->cur; + if (a->beg[0] == p->cur[0])p->cur++; + a->beg++; + if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION)) + my_xml_norm_text(a); + lex=MY_XML_STRING; + } + else if (my_xml_is_id0(p->cur[0])) + { + p->cur++; + while (p->cur < p->end && my_xml_is_id1(p->cur[0])) + p->cur++; + a->end=p->cur; + my_xml_norm_text(a); + lex=MY_XML_IDENT; + } + else + lex= MY_XML_UNKNOWN; + +#if 0 + printf("LEX=%s[%d]\n",lex2str(lex),a->end-a->beg); +#endif + +ret: + return lex; +} + + +static int my_xml_value(MY_XML_PARSER *st, const char *str, size_t len) +{ + return (st->value) ? (st->value)(st,str,len) : MY_XML_OK; +} + + +static int my_xml_enter(MY_XML_PARSER *st, const char *str, size_t len) +{ + if ((size_t) (st->attrend-st->attr+len+1) > sizeof(st->attr)) + { + sprintf(st->errstr,"To deep XML"); + return MY_XML_ERROR; + } + if (st->attrend > st->attr) + { + st->attrend[0]= '/'; + st->attrend++; + } + memcpy(st->attrend,str,len); + st->attrend+=len; + st->attrend[0]='\0'; + if (st->flags & MY_XML_FLAG_RELATIVE_NAMES) + return st->enter ? st->enter(st, str, len) : MY_XML_OK; + else + return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK; +} + + +static void mstr(char *s,const char *src,size_t l1, size_t l2) +{ + l1 = l1attrend; (e>p->attr) && (e[0] != '/') ; e--); + glen = (size_t) ((e[0] == '/') ? (p->attrend-e-1) : p->attrend-e); + + if (str && (slen != glen)) + { + mstr(s,str,sizeof(s)-1,slen); + if (glen) + { + mstr(g,e+1,sizeof(g)-1,glen), + sprintf(p->errstr,"'' unexpected ('' wanted)",s,g); + } + else + sprintf(p->errstr,"'' unexpected (END-OF-INPUT wanted)", s); + return MY_XML_ERROR; + } + + if (p->flags & MY_XML_FLAG_RELATIVE_NAMES) + rc= p->leave_xml ? p->leave_xml(p, str, slen) : MY_XML_OK; + else + rc= (p->leave_xml ? p->leave_xml(p,p->attr,p->attrend-p->attr) : + MY_XML_OK); + + *e='\0'; + p->attrend=e; + + return rc; +} + + +int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len) +{ + p->attrend=p->attr; + p->beg=str; + p->cur=str; + p->end=str+len; + + while ( p->cur < p->end ) + { + MY_XML_ATTR a; + if (p->cur[0] == '<') + { + int lex; + int question=0; + int exclam=0; + + lex=my_xml_scan(p,&a); + + if (MY_XML_COMMENT == lex) + continue; + + if (lex == MY_XML_CDATA) + { + a.beg+= 9; + a.end-= 3; + my_xml_value(p, a.beg, (size_t) (a.end-a.beg)); + continue; + } + + lex=my_xml_scan(p,&a); + + if (MY_XML_SLASH == lex) + { + if (MY_XML_IDENT != (lex=my_xml_scan(p,&a))) + { + sprintf(p->errstr,"%s unexpected (ident wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg))) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + goto gt; + } + + if (MY_XML_EXCLAM == lex) + { + lex=my_xml_scan(p,&a); + exclam=1; + } + else if (MY_XML_QUESTION == lex) + { + lex=my_xml_scan(p,&a); + question=1; + } + + if (MY_XML_IDENT == lex) + { + p->current_node_type= MY_XML_NODE_TAG; + if (MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"%s unexpected (ident or '/' wanted)", + lex2str(lex)); + return MY_XML_ERROR; + } + + while ((MY_XML_IDENT == (lex=my_xml_scan(p,&a))) || + ((MY_XML_STRING == lex && exclam))) + { + MY_XML_ATTR b; + if (MY_XML_EQ == (lex=my_xml_scan(p,&b))) + { + lex=my_xml_scan(p,&b); + if ( (lex == MY_XML_IDENT) || (lex == MY_XML_STRING) ) + { + p->current_node_type= MY_XML_NODE_ATTR; + if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || + (MY_XML_OK != my_xml_value(p,b.beg,(size_t) (b.end-b.beg))) || + (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) + return MY_XML_ERROR; + } + else + { + sprintf(p->errstr,"%s unexpected (ident or string wanted)", + lex2str(lex)); + return MY_XML_ERROR; + } + } + else if (MY_XML_IDENT == lex) + { + p->current_node_type= MY_XML_NODE_ATTR; + if ((MY_XML_OK != my_xml_enter(p,a.beg,(size_t) (a.end-a.beg))) || + (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))) + return MY_XML_ERROR; + } + else if ((MY_XML_STRING == lex) && exclam) + { + /* + We are in , e.g. + + + Just skip "SystemLiteral" and "PublicidLiteral" + */ + } + else + break; + } + + if (lex == MY_XML_SLASH) + { + if (MY_XML_OK != my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + +gt: + if (question) + { + if (lex != MY_XML_QUESTION) + { + sprintf(p->errstr,"%s unexpected ('?' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + if (MY_XML_OK != my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + lex=my_xml_scan(p,&a); + } + + if (exclam) + { + if (MY_XML_OK != my_xml_leave(p,NULL,0)) + return MY_XML_ERROR; + } + + if (lex != MY_XML_GT) + { + sprintf(p->errstr,"%s unexpected ('>' wanted)",lex2str(lex)); + return MY_XML_ERROR; + } + } + else + { + a.beg=p->cur; + for ( ; (p->cur < p->end) && (p->cur[0] != '<') ; p->cur++); + a.end=p->cur; + + if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION)) + my_xml_norm_text(&a); + if (a.beg != a.end) + { + my_xml_value(p,a.beg,(size_t) (a.end-a.beg)); + } + } + } + + if (p->attr[0]) + { + sprintf(p->errstr,"unexpected END-OF-INPUT"); + return MY_XML_ERROR; + } + return MY_XML_OK; +} + + +void my_xml_parser_create(MY_XML_PARSER *p) +{ + bzero((void*)p,sizeof(p[0])); +} + + +void my_xml_parser_free(MY_XML_PARSER *p __attribute__((unused))) +{ +} + + +void my_xml_set_value_handler(MY_XML_PARSER *p, + int (*action)(MY_XML_PARSER *p, const char *s, + size_t l)) +{ + p->value=action; +} + +void my_xml_set_enter_handler(MY_XML_PARSER *p, + int (*action)(MY_XML_PARSER *p, const char *s, + size_t l)) +{ + p->enter=action; +} + + +void my_xml_set_leave_handler(MY_XML_PARSER *p, + int (*action)(MY_XML_PARSER *p, const char *s, + size_t l)) +{ + p->leave_xml=action; +} + + +void my_xml_set_user_data(MY_XML_PARSER *p, void *user_data) +{ + p->user_data=user_data; +} + + +const char *my_xml_error_string(MY_XML_PARSER *p) +{ + return p->errstr; +} + + +size_t my_xml_error_pos(MY_XML_PARSER *p) +{ + const char *beg=p->beg; + const char *s; + for ( s=p->beg ; scur; s++) + { + if (s[0] == '\n') + beg=s; + } + return (size_t) (p->cur-beg); +} + +uint my_xml_error_lineno(MY_XML_PARSER *p) +{ + uint res=0; + const char *s; + for (s=p->beg ; scur; s++) + { + if (s[0] == '\n') + res++; + } + return res; +} diff --git a/externals/mysql/t_ctype.h b/externals/mysql/t_ctype.h new file mode 100644 index 0000000..1560001 --- /dev/null +++ b/externals/mysql/t_ctype.h @@ -0,0 +1,254 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved. + Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved. + Permission to use, copy, modify, distribute and sell this software + and its documentation for any purpose is hereby granted without fee, + provided that the above copyright notice appear in all copies. + Smaphan Raruenrom and Pruet Boonma makes no representations about + the suitability of this software for any purpose. It is provided + "as is" without express or implied warranty. +*/ + +/* LC_COLLATE category + Level information */ + +#ifndef _t_ctype_h +#define _t_ctype_h + +#define TOT_LEVELS 5 +#define LAST_LEVEL 4 /* TOT_LEVELS - 1 */ + +#define IGNORE 0 + + +/* level 1 symbols & order */ +enum l1_symbols { + L1_08 = TOT_LEVELS, + L1_18, + L1_28, + L1_38, + L1_48, + L1_58, + L1_68, + L1_78, + L1_88, + L1_98, + L1_A8, + L1_B8, + L1_C8, + L1_D8, + L1_E8, + L1_F8, + L1_G8, + L1_H8, + L1_I8, + L1_J8, + L1_K8, + L1_L8, + L1_M8, + L1_N8, + L1_O8, + L1_P8, + L1_Q8, + L1_R8, + L1_S8, + L1_T8, + L1_U8, + L1_V8, + L1_W8, + L1_X8, + L1_Y8, + L1_Z8, + L1_KO_KAI, + L1_KHO_KHAI, + L1_KHO_KHUAT, + L1_KHO_KHWAI, + L1_KHO_KHON, + L1_KHO_RAKHANG, + L1_NGO_NGU, + L1_CHO_CHAN, + L1_CHO_CHING, + L1_CHO_CHANG, + L1_SO_SO, + L1_CHO_CHOE, + L1_YO_YING, + L1_DO_CHADA, + L1_TO_PATAK, + L1_THO_THAN, + L1_THO_NANGMONTHO, + L1_THO_PHUTHAO, + L1_NO_NEN, + L1_DO_DEK, + L1_TO_TAO, + L1_THO_THUNG, + L1_THO_THAHAN, + L1_THO_THONG, + L1_NO_NU, + L1_BO_BAIMAI, + L1_PO_PLA, + L1_PHO_PHUNG, + L1_FO_FA, + L1_PHO_PHAN, + L1_FO_FAN, + L1_PHO_SAMPHAO, + L1_MO_MA, + L1_YO_YAK, + L1_RO_RUA, + L1_RU, + L1_LO_LING, + L1_LU, + L1_WO_WAEN, + L1_SO_SALA, + L1_SO_RUSI, + L1_SO_SUA, + L1_HO_HIP, + L1_LO_CHULA, + L1_O_ANG, + L1_HO_NOKHUK, + L1_NKHIT, + L1_SARA_A, + L1_MAI_HAN_AKAT, + L1_SARA_AA, + L1_SARA_AM, + L1_SARA_I, + L1_SARA_II, + L1_SARA_UE, + L1_SARA_UEE, + L1_SARA_U, + L1_SARA_UU, + L1_SARA_E, + L1_SARA_AE, + L1_SARA_O, + L1_SARA_AI_MAIMUAN, + L1_SARA_AI_MAIMALAI +}; + +/* level 2 symbols & order */ +enum l2_symbols { + L2_BLANK = TOT_LEVELS, + L2_THAII, + L2_YAMAK, + L2_PINTHU, + L2_GARAN, + L2_TYKHU, + L2_TONE1, + L2_TONE2, + L2_TONE3, + L2_TONE4 +}; + +/* level 3 symbols & order */ +enum l3_symbols { + L3_BLANK = TOT_LEVELS, + L3_SPACE, + L3_NB_SACE, + L3_LOW_LINE, + L3_HYPHEN, + L3_COMMA, + L3_SEMICOLON, + L3_COLON, + L3_EXCLAMATION, + L3_QUESTION, + L3_SOLIDUS, + L3_FULL_STOP, + L3_PAIYAN_NOI, + L3_MAI_YAMOK, + L3_GRAVE, + L3_CIRCUMFLEX, + L3_TILDE, + L3_APOSTROPHE, + L3_QUOTATION, + L3_L_PARANTHESIS, + L3_L_BRACKET, + L3_L_BRACE, + L3_R_BRACE, + L3_R_BRACKET, + L3_R_PARENTHESIS, + L3_AT, + L3_BAHT, + L3_DOLLAR, + L3_FONGMAN, + L3_ANGKHANKHU, + L3_KHOMUT, + L3_ASTERISK, + L3_BK_SOLIDUS, + L3_AMPERSAND, + L3_NUMBER, + L3_PERCENT, + L3_PLUS, + L3_LESS_THAN, + L3_EQUAL, + L3_GREATER_THAN, + L3_V_LINE +}; + +/* level 4 symbols & order */ +enum l4_symbols { + L4_BLANK = TOT_LEVELS, + L4_MIN, + L4_CAP, + L4_EXT +}; + +enum level_symbols { + L_UPRUPR = TOT_LEVELS, + L_UPPER, + L_MIDDLE, + L_LOWER +}; + +#define _is(c) (t_ctype[(c)][LAST_LEVEL]) +#define _level 8 +#define _consnt 16 +#define _ldvowel 32 +#define _fllwvowel 64 +#define _uprvowel 128 +#define _lwrvowel 256 +#define _tone 512 +#define _diacrt1 1024 +#define _diacrt2 2048 +#define _combine 4096 +#define _stone 8192 +#define _tdig 16384 +#define _rearvowel (_fllwvowel | _uprvowel | _lwrvowel) +#define _diacrt (_diacrt1 | _diacrt2) +#define levelof(c) ( _is(c) & _level ) +#define isthai(c) ( (c) >= 128 ) +#define istalpha(c) ( _is(c) & (_consnt|_ldvowel|_rearvowel|\ + _tone|_diacrt1|_diacrt2) ) +#define isconsnt(c) ( _is(c) & _consnt ) +#define isldvowel(c) ( _is(c) & _ldvowel ) +#define isfllwvowel(c) ( _is(c) & _fllwvowel ) +#define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) ) +#define isuprvowel(c) ( _is(c) & _uprvowel ) +#define islwrvowel(c) ( _is(c) & _lwrvowel ) +#define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel)) +#define isrearvowel(c) ( _is(c) & _rearvowel ) +#define isvowel(c) ( _is(c) & (_ldvowel|_rearvowel) ) +#define istone(c) ( _is(c) & _tone ) +#define isunldable(c) ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) ) +#define iscombinable(c) ( _is(c) & _combine ) +#define istdigit(c) ( _is(c) & _tdig ) +#define isstone(c) ( _is(c) & _stone ) +#define isdiacrt1(c) ( _is(c) & _diacrt1) +#define isdiacrt2(c) ( _is(c) & _diacrt2) +#define isdiacrt(c) ( _is(c) & _diacrt) + +/* Function prototype called by sql/field.cc */ +void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length); + +#endif diff --git a/externals/mysql/thr_alarm.h b/externals/mysql/thr_alarm.h new file mode 100644 index 0000000..fb90603 --- /dev/null +++ b/externals/mysql/thr_alarm.h @@ -0,0 +1,110 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Prototypes when using thr_alarm library functions */ + +#ifndef _thr_alarm_h +#define _thr_alarm_h +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef USE_ALARM_THREAD +#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */ +#endif +#ifdef HAVE_rts_threads +#undef USE_ONE_SIGNAL_HAND +#define USE_ALARM_THREAD +#define THR_SERVER_ALARM SIGUSR1 +#else +#define THR_SERVER_ALARM SIGALRM +#endif + +typedef struct st_alarm_info +{ + ulong next_alarm_time; + uint active_alarms; + uint max_used_alarms; +} ALARM_INFO; + +void thr_alarm_info(ALARM_INFO *info); + +#if defined(DONT_USE_THR_ALARM) || !defined(THREAD) + +#define USE_ALARM_THREAD +#undef USE_ONE_SIGNAL_HAND + +typedef my_bool thr_alarm_t; +typedef my_bool ALARM; + +#define thr_alarm_init(A) (*(A))=0 +#define thr_alarm_in_use(A) (*(A) != 0) +#define thr_end_alarm(A) +#define thr_alarm(A,B,C) ((*(A)=1)-1) +/* The following should maybe be (*(A)) */ +#define thr_got_alarm(A) 0 +#define init_thr_alarm(A) +#define thr_alarm_kill(A) +#define resize_thr_alarm(N) +#define end_thr_alarm(A) + +#else +#if defined(__WIN__) +typedef struct st_thr_alarm_entry +{ + rf_SetTimer crono; +} thr_alarm_entry; + +#else /* System with posix threads */ + +typedef int thr_alarm_entry; + +#define thr_got_alarm(thr_alarm) (**(thr_alarm)) + +#endif /* __WIN__ */ + +typedef thr_alarm_entry* thr_alarm_t; + +typedef struct st_alarm { + ulong expire_time; + thr_alarm_entry alarmed; /* set when alarm is due */ + pthread_t thread; + my_thread_id thread_id; + my_bool malloced; +} ALARM; + +extern uint thr_client_alarm; +extern pthread_t alarm_thread; + +#define thr_alarm_init(A) (*(A))=0 +#define thr_alarm_in_use(A) (*(A)!= 0) +void init_thr_alarm(uint max_alarm); +void resize_thr_alarm(uint max_alarms); +my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff); +void thr_alarm_kill(my_thread_id thread_id); +void thr_end_alarm(thr_alarm_t *alarmed); +void end_thr_alarm(my_bool free_structures); +sig_handler process_alarm(int); +#ifndef thr_got_alarm +my_bool thr_got_alarm(thr_alarm_t *alrm); +#endif + + +#endif /* DONT_USE_THR_ALARM */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _thr_alarm_h */ diff --git a/externals/mysql/thr_lock.h b/externals/mysql/thr_lock.h new file mode 100644 index 0000000..38f0478 --- /dev/null +++ b/externals/mysql/thr_lock.h @@ -0,0 +1,181 @@ +/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* For use with thr_lock:s */ + +#ifndef _thr_lock_h +#define _thr_lock_h +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +struct st_thr_lock; +extern ulong locks_immediate,locks_waited ; + +/** + Lock types are used to request a lock on a table. Changes in this enumeration + might affect transactional locks as well. + Important: if a new lock type is added, a matching lock description + must be added to sql_test.cc's lock_descriptions array. + @see set_handler_table_locks + @see read_lock_type_for_table +*/ +enum thr_lock_type { TL_IGNORE=-1, + TL_UNLOCK, /* UNLOCK ANY LOCK */ + /* + Parser only! At open_tables() becomes TL_READ or + TL_READ_NO_INSERT depending on the binary log format + (SBR/RBR) and on the table category (log table). + Used for tables that are read by statements which + modify tables. + */ + TL_READ_DEFAULT, + TL_READ, /* Read lock */ + TL_READ_WITH_SHARED_LOCKS, + /* High prior. than TL_WRITE. Allow concurrent insert */ + TL_READ_HIGH_PRIORITY, + /* READ, Don't allow concurrent insert */ + TL_READ_NO_INSERT, + /* + Write lock, but allow other threads to read / write. + Used by BDB tables in MySQL to mark that someone is + reading/writing to the table. + */ + TL_WRITE_ALLOW_WRITE, + /* + Write lock, but allow other threads to read. + Used by ALTER TABLE in MySQL to allow readers + to use the table until ALTER TABLE is finished. + */ + TL_WRITE_ALLOW_READ, + /* + WRITE lock used by concurrent insert. Will allow + READ, if one could use concurrent insert on table. + */ + TL_WRITE_CONCURRENT_INSERT, + /* Write used by INSERT DELAYED. Allows READ locks */ + TL_WRITE_DELAYED, + /* + parser only! Late bound low_priority flag. + At open_tables() becomes thd->update_lock_default. + */ + TL_WRITE_DEFAULT, + /* WRITE lock that has lower priority than TL_READ */ + TL_WRITE_LOW_PRIORITY, + /* Normal WRITE lock */ + TL_WRITE, + /* Abort new lock request with an error */ + TL_WRITE_ONLY}; + +enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1, + THR_LOCK_WAIT_TIMEOUT= 2, THR_LOCK_DEADLOCK= 3 }; + + +extern ulong max_write_lock_count; +extern ulong table_lock_wait_timeout; +extern my_bool thr_lock_inited; +extern enum thr_lock_type thr_upgraded_concurrent_insert_lock; + +/* + A description of the thread which owns the lock. The address + of an instance of this structure is used to uniquely identify the thread. +*/ + +typedef struct st_thr_lock_info +{ + pthread_t thread; + my_thread_id thread_id; + ulong n_cursors; +} THR_LOCK_INFO; + +/* + Lock owner identifier. Globally identifies the lock owner within the + thread and among all the threads. The address of an instance of this + structure is used as id. +*/ + +typedef struct st_thr_lock_owner +{ + THR_LOCK_INFO *info; +} THR_LOCK_OWNER; + + +typedef struct st_thr_lock_data { + THR_LOCK_OWNER *owner; + struct st_thr_lock_data *next,**prev; + struct st_thr_lock *lock; + pthread_cond_t *cond; + enum thr_lock_type type; + void *status_param; /* Param to status functions */ + void *debug_print_param; +} THR_LOCK_DATA; + +struct st_lock_list { + THR_LOCK_DATA *data,**last; +}; + +typedef struct st_thr_lock { + LIST list; + pthread_mutex_t mutex; + struct st_lock_list read_wait; + struct st_lock_list read; + struct st_lock_list write_wait; + struct st_lock_list write; + /* write_lock_count is incremented for write locks and reset on read locks */ + ulong write_lock_count; + uint read_no_write_count; + void (*get_status)(void*, my_bool); /* When one gets a lock */ + void (*copy_status)(void*,void*); + void (*update_status)(void*); /* Before release of write */ + void (*restore_status)(void*); /* Before release of read */ + my_bool (*check_status)(void *); + my_bool allow_multiple_concurrent_insert; +} THR_LOCK; + + +extern LIST *thr_lock_thread_list; +extern pthread_mutex_t THR_LOCK_lock; + +my_bool init_thr_lock(void); /* Must be called once/thread */ +#define thr_lock_owner_init(owner, info_arg) (owner)->info= (info_arg) +void thr_lock_info_init(THR_LOCK_INFO *info); +void thr_lock_init(THR_LOCK *lock); +void thr_lock_delete(THR_LOCK *lock); +void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, + void *status_param); +enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data, + THR_LOCK_OWNER *owner, + enum thr_lock_type lock_type); +void thr_unlock(THR_LOCK_DATA *data); +enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data, + uint count, THR_LOCK_OWNER *owner); +void thr_multi_unlock(THR_LOCK_DATA **data,uint count); +void +thr_lock_merge_status(THR_LOCK_DATA **data, uint count); +void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock); +my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread); +void thr_print_locks(void); /* For debugging */ +my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data, + enum thr_lock_type new_lock_type); +void thr_downgrade_write_lock(THR_LOCK_DATA *data, + enum thr_lock_type new_lock_type); +my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data); +#ifdef __cplusplus +} +#endif +#endif /* _thr_lock_h */ diff --git a/externals/mysql/typelib.h b/externals/mysql/typelib.h new file mode 100644 index 0000000..46106d1 --- /dev/null +++ b/externals/mysql/typelib.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + +#ifndef _typelib_h +#define _typelib_h + +#include "my_alloc.h" + +typedef struct st_typelib { /* Different types saved here */ + unsigned int count; /* How many types */ + const char *name; /* Name of typelib */ + const char **type_names; + unsigned int *type_lengths; +} TYPELIB; + +extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); +extern int find_type_or_exit(const char *x, TYPELIB *typelib, + const char *option); +extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name); +extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); +extern const char *get_type(TYPELIB *typelib,unsigned int nr); +extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); + +extern TYPELIB sql_protocol_typelib; + +#endif /* _typelib_h */ diff --git a/externals/mysql/vio/test-ssl.c b/externals/mysql/vio/test-ssl.c new file mode 100644 index 0000000..855dc5f --- /dev/null +++ b/externals/mysql/vio/test-ssl.c @@ -0,0 +1,149 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#if defined(HAVE_OPENSSL) && !defined(__NETWARE__) +#include +#include +#include +#include "mysql.h" +#include "errmsg.h" +#include +#include +#include +#include + +const char *VER="0.2"; + + +#ifndef DBUG_OFF +const char *default_dbug_option="d:t:O,-"; +#endif + +void +fatal_error( const char* r) +{ + perror(r); + exit(0); +} + +void +print_usage() +{ + printf("viossl-test: testing SSL virtual IO. Usage:\n"); + printf("viossl-test server-key server-cert client-key client-cert [CAfile] [CApath]\n"); +} + + +int +main(int argc, char** argv) +{ + char* server_key = 0, *server_cert = 0; + char* client_key = 0, *client_cert = 0; + char* ca_file = 0, *ca_path = 0; + char* cipher=0; + int child_pid,sv[2]; + my_bool unused; + struct st_VioSSLFd* ssl_acceptor= 0; + struct st_VioSSLFd* ssl_connector= 0; + Vio* client_vio=0, *server_vio=0; + MY_INIT(argv[0]); + DBUG_PROCESS(argv[0]); + DBUG_PUSH(default_dbug_option); + + if (argc<5) + { + print_usage(); + return 1; + } + + server_key = argv[1]; + server_cert = argv[2]; + client_key = argv[3]; + client_cert = argv[4]; + if (argc>5) + ca_file = argv[5]; + if (argc>6) + ca_path = argv[6]; + printf("Server key/cert : %s/%s\n", server_key, server_cert); + printf("Client key/cert : %s/%s\n", client_key, client_cert); + if (ca_file!=0) + printf("CAfile : %s\n", ca_file); + if (ca_path!=0) + printf("CApath : %s\n", ca_path); + + + if (socketpair(PF_UNIX, SOCK_STREAM, IPPROTO_IP, sv)==-1) + fatal_error("socketpair"); + + ssl_acceptor = new_VioSSLAcceptorFd(server_key, server_cert, ca_file, + ca_path, cipher); + ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file, + ca_path, cipher); + + client_vio = (struct st_vio*)my_malloc(sizeof(struct st_vio),MYF(0)); + client_vio->sd = sv[0]; + client_vio->vioblocking(client_vio, 0, &unused); + sslconnect(ssl_connector,client_vio,60L); + server_vio = (struct st_vio*)my_malloc(sizeof(struct st_vio),MYF(0)); + server_vio->sd = sv[1]; + server_vio->vioblocking(client_vio, 0, &unused); + sslaccept(ssl_acceptor,server_vio,60L); + + printf("Socketpair: %d , %d\n", client_vio->sd, server_vio->sd); + + child_pid = fork(); + if (child_pid==-1) { + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + fatal_error("fork"); + } + if (child_pid==0) + { + /* child, therefore, client */ + char xbuf[100]; + int r = vio_read(client_vio,xbuf, sizeof(xbuf)); + if (r<=0) { + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + fatal_error("client:SSL_read"); + } + xbuf[r] = 0; + printf("client:got %s\n", xbuf); + my_free((uchar*)client_vio,MYF(0)); + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + } + else + { + const char* s = "Huhuhuh"; + int r = vio_write(server_vio,(uchar*)s, strlen(s)); + if (r<=0) { + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + fatal_error("server:SSL_write"); + } + my_free((uchar*)server_vio,MYF(0)); + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + } + return 0; +} +#else /* HAVE_OPENSSL */ + +int main() { +return 0; +} +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/vio/test-sslclient.c b/externals/mysql/vio/test-sslclient.c new file mode 100644 index 0000000..e1b8461 --- /dev/null +++ b/externals/mysql/vio/test-sslclient.c @@ -0,0 +1,101 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#ifdef HAVE_OPENSSL +#include +#include +#include +#include "mysql.h" +#include "errmsg.h" +#include +#include +#include +#include + +const char *VER="0.2"; + + +#ifndef DBUG_OFF +const char *default_dbug_option="d:t:O,-"; +#endif + +void +fatal_error( const char* r) +{ + perror(r); + exit(0); +} + +int +main( int argc __attribute__((unused)), + char** argv) +{ + char client_key[] = "../SSL/client-key.pem", client_cert[] = "../SSL/client-cert.pem"; + char ca_file[] = "../SSL/cacert.pem", *ca_path = 0, *cipher=0; + struct st_VioSSLFd* ssl_connector= 0; + struct sockaddr_in sa; + Vio* client_vio=0; + int err; + char xbuf[100]="Ohohhhhoh1234"; + MY_INIT(argv[0]); + DBUG_PROCESS(argv[0]); + DBUG_PUSH(default_dbug_option); + + printf("Client key/cert : %s/%s\n", client_key, client_cert); + if (ca_file!=0) + printf("CAfile : %s\n", ca_file); + if (ca_path!=0) + printf("CApath : %s\n", ca_path); + + ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file, ca_path, cipher); + if(!ssl_connector) { + fatal_error("client:new_VioSSLConnectorFd failed"); + } + + /* ----------------------------------------------- */ + /* Create a socket and connect to server using normal socket calls. */ + + client_vio = vio_new(socket (AF_INET, SOCK_STREAM, 0), VIO_TYPE_TCPIP, TRUE); + + memset (&sa, '\0', sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr.s_addr = inet_addr ("127.0.0.1"); /* Server IP */ + sa.sin_port = htons (1111); /* Server Port number */ + + err = connect(client_vio->sd, (struct sockaddr*) &sa, + sizeof(sa)); + + /* ----------------------------------------------- */ + /* Now we have TCP conncetion. Start SSL negotiation. */ + read(client_vio->sd,xbuf, sizeof(xbuf)); + sslconnect(ssl_connector,client_vio,60L); + err = vio_read(client_vio,xbuf, sizeof(xbuf)); + if (err<=0) { + my_free((uchar*)ssl_connector,MYF(0)); + fatal_error("client:SSL_read"); + } + xbuf[err] = 0; + printf("client:got %s\n", xbuf); + my_free((uchar*)client_vio,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + return 0; +} +#else /* HAVE_OPENSSL */ + +int main() { +return 0; +} +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/vio/test-sslserver.c b/externals/mysql/vio/test-sslserver.c new file mode 100644 index 0000000..8877dd3 --- /dev/null +++ b/externals/mysql/vio/test-sslserver.c @@ -0,0 +1,155 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#ifdef HAVE_OPENSSL +#include +#include +#include +#include "mysql.h" +#include "errmsg.h" +#include +#include +#include +#include + +const char *VER="0.2"; + + +#ifndef DBUG_OFF +const char *default_dbug_option="d:t:O,-"; +#endif + +#if 0 +static void +fatal_error( const char* r) +{ + perror(r); + exit(0); +} +#endif + +typedef struct { + int sd; + struct st_VioSSLFd* ssl_acceptor; +} TH_ARGS; + +static void +do_ssl_stuff( TH_ARGS* args) +{ + const char* s = "Huhuhuhuuu"; + Vio* server_vio; + int err; + DBUG_ENTER("do_ssl_stuff"); + + server_vio = vio_new(args->sd, VIO_TYPE_TCPIP, TRUE); + + /* ----------------------------------------------- */ + /* TCP connection is ready. Do server side SSL. */ + + err = write(server_vio->sd,(uchar*)s, strlen(s)); + sslaccept(args->ssl_acceptor,server_vio,60L); + err = server_vio->write(server_vio,(uchar*)s, strlen(s)); + DBUG_VOID_RETURN; +} + +static void* +client_thread( void* arg) +{ + my_thread_init(); + do_ssl_stuff((TH_ARGS*)arg); + return 0; +} + +int +main(int argc __attribute__((unused)), char** argv) +{ + char server_key[] = "../SSL/server-key.pem", + server_cert[] = "../SSL/server-cert.pem"; + char ca_file[] = "../SSL/cacert.pem", + *ca_path = 0, + *cipher = 0; + struct st_VioSSLFd* ssl_acceptor; + pthread_t th; + TH_ARGS th_args; + + + struct sockaddr_in sa_serv; + struct sockaddr_in sa_cli; + int listen_sd; + int err; + socklen_t client_len; + int reuseaddr = 1; /* better testing, uh? */ + + MY_INIT(argv[0]); + DBUG_PROCESS(argv[0]); + DBUG_PUSH(default_dbug_option); + + printf("Server key/cert : %s/%s\n", server_key, server_cert); + if (ca_file!=0) + + printf("CAfile : %s\n", ca_file); + if (ca_path!=0) + printf("CApath : %s\n", ca_path); + + th_args.ssl_acceptor = ssl_acceptor = new_VioSSLAcceptorFd(server_key, server_cert, ca_file, ca_path,cipher); + + /* ----------------------------------------------- */ + /* Prepare TCP socket for receiving connections */ + + listen_sd = socket (AF_INET, SOCK_STREAM, 0); + setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(&reuseaddr)); + + memset (&sa_serv, '\0', sizeof(sa_serv)); + sa_serv.sin_family = AF_INET; + sa_serv.sin_addr.s_addr = INADDR_ANY; + sa_serv.sin_port = htons (1111); /* Server Port number */ + + err = bind(listen_sd, (struct sockaddr*) &sa_serv, + sizeof (sa_serv)); + + /* Receive a TCP connection. */ + + err = listen (listen_sd, 5); + client_len = sizeof(sa_cli); + th_args.sd = accept (listen_sd, (struct sockaddr*) &sa_cli, &client_len); + close (listen_sd); + + printf ("Connection from %lx, port %x\n", + (long)sa_cli.sin_addr.s_addr, sa_cli.sin_port); + + /* ----------------------------------------------- */ + /* TCP connection is ready. Do server side SSL. */ + + err = pthread_create(&th, NULL, client_thread, (void*)&th_args); + DBUG_PRINT("info", ("pthread_create: %d", err)); + pthread_join(th, NULL); + +#if 0 + if (err<=0) { + my_free((uchar*)ssl_acceptor,MYF(0)); + fatal_error("server:SSL_write"); + } +#endif /* 0 */ + + my_free((uchar*)ssl_acceptor,MYF(0)); + return 0; +} +#else /* HAVE_OPENSSL */ + +int main() { +return 0; +} +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/vio/vio.c b/externals/mysql/vio/vio.c new file mode 100644 index 0000000..cc5f629 --- /dev/null +++ b/externals/mysql/vio/vio.c @@ -0,0 +1,242 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Note that we can't have assertion on file descriptors; The reason for + this is that during mysql shutdown, another thread can close a file + we are working on. In this case we should just return read errors from + the file descriptior. +*/ + +#include "vio_priv.h" + +/* + * Helper to fill most of the Vio* with defaults. + */ + +static void vio_init(Vio* vio, enum enum_vio_type type, + my_socket sd, HANDLE hPipe, uint flags) +{ + DBUG_ENTER("vio_init"); + DBUG_PRINT("enter", ("type: %d sd: %d flags: %d", type, sd, flags)); + +#ifndef HAVE_VIO_READ_BUFF + flags&= ~VIO_BUFFERED_READ; +#endif + bzero((char*) vio, sizeof(*vio)); + vio->type = type; + vio->sd = sd; + vio->hPipe = hPipe; + vio->localhost= flags & VIO_LOCALHOST; + if ((flags & VIO_BUFFERED_READ) && + !(vio->read_buffer= (char*)my_malloc(VIO_READ_BUFFER_SIZE, MYF(MY_WME)))) + flags&= ~VIO_BUFFERED_READ; +#ifdef __WIN__ + if (type == VIO_TYPE_NAMEDPIPE) + { + vio->viodelete =vio_delete; + vio->vioerrno =vio_errno; + vio->read =vio_read_pipe; + vio->write =vio_write_pipe; + vio->fastsend =vio_fastsend; + vio->viokeepalive =vio_keepalive; + vio->should_retry =vio_should_retry; + vio->was_interrupted=vio_was_interrupted; + vio->vioclose =vio_close_pipe; + vio->peer_addr =vio_peer_addr; + vio->vioblocking =vio_blocking; + vio->is_blocking =vio_is_blocking; + vio->timeout =vio_ignore_timeout; + } + else /* default is VIO_TYPE_TCPIP */ +#endif +#ifdef HAVE_SMEM + if (type == VIO_TYPE_SHARED_MEMORY) + { + vio->viodelete =vio_delete; + vio->vioerrno =vio_errno; + vio->read =vio_read_shared_memory; + vio->write =vio_write_shared_memory; + vio->fastsend =vio_fastsend; + vio->viokeepalive =vio_keepalive; + vio->should_retry =vio_should_retry; + vio->was_interrupted=vio_was_interrupted; + vio->vioclose =vio_close_shared_memory; + vio->peer_addr =vio_peer_addr; + vio->vioblocking =vio_blocking; + vio->is_blocking =vio_is_blocking; + vio->timeout =vio_ignore_timeout; + } + else +#endif +#ifdef HAVE_OPENSSL + if (type == VIO_TYPE_SSL) + { + vio->viodelete =vio_ssl_delete; + vio->vioerrno =vio_errno; + vio->read =vio_ssl_read; + vio->write =vio_ssl_write; + vio->fastsend =vio_fastsend; + vio->viokeepalive =vio_keepalive; + vio->should_retry =vio_should_retry; + vio->was_interrupted=vio_was_interrupted; + vio->vioclose =vio_ssl_close; + vio->peer_addr =vio_peer_addr; + vio->vioblocking =vio_ssl_blocking; + vio->is_blocking =vio_is_blocking; + vio->timeout =vio_timeout; + } + else /* default is VIO_TYPE_TCPIP */ +#endif /* HAVE_OPENSSL */ + { + vio->viodelete =vio_delete; + vio->vioerrno =vio_errno; + vio->read= (flags & VIO_BUFFERED_READ) ? vio_read_buff : vio_read; + vio->write =vio_write; + vio->fastsend =vio_fastsend; + vio->viokeepalive =vio_keepalive; + vio->should_retry =vio_should_retry; + vio->was_interrupted=vio_was_interrupted; + vio->vioclose =vio_close; + vio->peer_addr =vio_peer_addr; + vio->vioblocking =vio_blocking; + vio->is_blocking =vio_is_blocking; + vio->timeout =vio_timeout; + } + DBUG_VOID_RETURN; +} + + +/* Reset initialized VIO to use with another transport type */ + +void vio_reset(Vio* vio, enum enum_vio_type type, + my_socket sd, HANDLE hPipe, uint flags) +{ + my_free(vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR)); + vio_init(vio, type, sd, hPipe, flags); +} + + +/* Open the socket or TCP/IP connection and read the fnctl() status */ + +Vio *vio_new(my_socket sd, enum enum_vio_type type, uint flags) +{ + Vio *vio; + DBUG_ENTER("vio_new"); + DBUG_PRINT("enter", ("sd: %d", sd)); + if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME)))) + { + vio_init(vio, type, sd, 0, flags); + sprintf(vio->desc, + (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"), + vio->sd); +#if !defined(__WIN__) +#if !defined(NO_FCNTL_NONBLOCK) + /* + We call fcntl() to set the flags and then immediately read them back + to make sure that we and the system are in agreement on the state of + things. + + An example of why we need to do this is FreeBSD (and apparently some + other BSD-derived systems, like Mac OS X), where the system sometimes + reports that the socket is set for non-blocking when it really will + block. + */ + fcntl(sd, F_SETFL, 0); + vio->fcntl_mode= fcntl(sd, F_GETFL); +#elif defined(HAVE_SYS_IOCTL_H) /* hpux */ + /* Non blocking sockets doesn't work good on HPUX 11.0 */ + (void) ioctl(sd,FIOSNBIO,0); + vio->fcntl_mode &= ~O_NONBLOCK; +#endif +#else /* !defined(__WIN__) */ + { + /* set to blocking mode by default */ + ulong arg=0, r; + r = ioctlsocket(sd,FIONBIO,(void*) &arg); + vio->fcntl_mode &= ~O_NONBLOCK; + } +#endif + } + DBUG_RETURN(vio); +} + + +#ifdef __WIN__ + +Vio *vio_new_win32pipe(HANDLE hPipe) +{ + Vio *vio; + DBUG_ENTER("vio_new_handle"); + if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME)))) + { + vio_init(vio, VIO_TYPE_NAMEDPIPE, 0, hPipe, VIO_LOCALHOST); + strmov(vio->desc, "named pipe"); + } + DBUG_RETURN(vio); +} + +#ifdef HAVE_SMEM +Vio *vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_map, + HANDLE event_server_wrote, HANDLE event_server_read, + HANDLE event_client_wrote, HANDLE event_client_read, + HANDLE event_conn_closed) +{ + Vio *vio; + DBUG_ENTER("vio_new_win32shared_memory"); + if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME)))) + { + vio_init(vio, VIO_TYPE_SHARED_MEMORY, 0, 0, VIO_LOCALHOST); + vio->handle_file_map= handle_file_map; + vio->handle_map= handle_map; + vio->event_server_wrote= event_server_wrote; + vio->event_server_read= event_server_read; + vio->event_client_wrote= event_client_wrote; + vio->event_client_read= event_client_read; + vio->event_conn_closed= event_conn_closed; + vio->shared_memory_remain= 0; + vio->shared_memory_pos= handle_map; + vio->net= net; + strmov(vio->desc, "shared memory"); + } + DBUG_RETURN(vio); +} +#endif +#endif + + +void vio_delete(Vio* vio) +{ + if (!vio) + return; /* It must be safe to delete null pointers. */ + + if (vio->type != VIO_CLOSED) + vio->vioclose(vio); + my_free((uchar*) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free((uchar*) vio,MYF(0)); +} + + +/* + Cleanup memory allocated by vio or the + components below it when application finish + +*/ +void vio_end(void) +{ +#ifdef HAVE_YASSL + yaSSL_CleanUp(); +#endif +} diff --git a/externals/mysql/vio/vio_priv.h b/externals/mysql/vio/vio_priv.h new file mode 100644 index 0000000..54c18dd --- /dev/null +++ b/externals/mysql/vio/vio_priv.h @@ -0,0 +1,46 @@ +/* Copyright (C) 2003 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* Structures and functions private to the vio package */ + +#define DONT_MAP_VIO +#include +#include +#include +#include +#include + +#ifndef __WIN__ +#include +#include +#endif + + +void vio_ignore_timeout(Vio *vio, uint which, uint timeout); +void vio_timeout(Vio *vio,uint which, uint timeout); + +#ifdef HAVE_OPENSSL +#include "my_net.h" /* needed because of struct in_addr */ + +size_t vio_ssl_read(Vio *vio,uchar* buf, size_t size); +size_t vio_ssl_write(Vio *vio,const uchar* buf, size_t size); + +/* When the workday is over... */ +int vio_ssl_close(Vio *vio); +void vio_ssl_delete(Vio *vio); + +int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode); + +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/vio/viosocket.c b/externals/mysql/vio/viosocket.c new file mode 100644 index 0000000..e823f25 --- /dev/null +++ b/externals/mysql/vio/viosocket.c @@ -0,0 +1,714 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Note that we can't have assertion on file descriptors; The reason for + this is that during mysql shutdown, another thread can close a file + we are working on. In this case we should just return read errors from + the file descriptior. +*/ + +#include "vio_priv.h" + +int vio_errno(Vio *vio __attribute__((unused))) +{ + return socket_errno; /* On Win32 this mapped to WSAGetLastError() */ +} + + +size_t vio_read(Vio * vio, uchar* buf, size_t size) +{ + size_t r; + DBUG_ENTER("vio_read"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %u", vio->sd, buf, + (uint) size)); + + /* Ensure nobody uses vio_read_buff and vio_read simultaneously */ + DBUG_ASSERT(vio->read_end == vio->read_pos); +#ifdef __WIN__ + r = recv(vio->sd, buf, size,0); +#else + errno=0; /* For linux */ + r = read(vio->sd, buf, size); +#endif /* __WIN__ */ +#ifndef DBUG_OFF + if (r == (size_t) -1) + { + DBUG_PRINT("vio_error", ("Got error %d during read",errno)); + } +#endif /* DBUG_OFF */ + DBUG_PRINT("exit", ("%ld", (long) r)); + DBUG_RETURN(r); +} + + +/* + Buffered read: if average read size is small it may + reduce number of syscalls. +*/ + +size_t vio_read_buff(Vio *vio, uchar* buf, size_t size) +{ + size_t rc; +#define VIO_UNBUFFERED_READ_MIN_SIZE 2048 + DBUG_ENTER("vio_read_buff"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %u", vio->sd, buf, + (uint) size)); + + if (vio->read_pos < vio->read_end) + { + rc= min((size_t) (vio->read_end - vio->read_pos), size); + memcpy(buf, vio->read_pos, rc); + vio->read_pos+= rc; + /* + Do not try to read from the socket now even if rc < size: + vio_read can return -1 due to an error or non-blocking mode, and + the safest way to handle it is to move to a separate branch. + */ + } + else if (size < VIO_UNBUFFERED_READ_MIN_SIZE) + { + rc= vio_read(vio, (uchar*) vio->read_buffer, VIO_READ_BUFFER_SIZE); + if (rc != 0 && rc != (size_t) -1) + { + if (rc > size) + { + vio->read_pos= vio->read_buffer + size; + vio->read_end= vio->read_buffer + rc; + rc= size; + } + memcpy(buf, vio->read_buffer, rc); + } + } + else + rc= vio_read(vio, buf, size); + DBUG_RETURN(rc); +#undef VIO_UNBUFFERED_READ_MIN_SIZE +} + + +size_t vio_write(Vio * vio, const uchar* buf, size_t size) +{ + size_t r; + DBUG_ENTER("vio_write"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %u", vio->sd, buf, + (uint) size)); +#ifdef __WIN__ + r = send(vio->sd, buf, size,0); +#else + r = write(vio->sd, buf, size); +#endif /* __WIN__ */ +#ifndef DBUG_OFF + if (r == (size_t) -1) + { + DBUG_PRINT("vio_error", ("Got error on write: %d",socket_errno)); + } +#endif /* DBUG_OFF */ + DBUG_PRINT("exit", ("%u", (uint) r)); + DBUG_RETURN(r); +} + +int vio_blocking(Vio * vio __attribute__((unused)), my_bool set_blocking_mode, + my_bool *old_mode) +{ + int r=0; + DBUG_ENTER("vio_blocking"); + + *old_mode= test(!(vio->fcntl_mode & O_NONBLOCK)); + DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d", + (int) set_blocking_mode, (int) *old_mode)); + +#if !defined(__WIN__) +#if !defined(NO_FCNTL_NONBLOCK) + if (vio->sd >= 0) + { + int old_fcntl=vio->fcntl_mode; + if (set_blocking_mode) + vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */ + else + vio->fcntl_mode |= O_NONBLOCK; /* set bit */ + if (old_fcntl != vio->fcntl_mode) + { + r= fcntl(vio->sd, F_SETFL, vio->fcntl_mode); + if (r == -1) + { + DBUG_PRINT("info", ("fcntl failed, errno %d", errno)); + vio->fcntl_mode= old_fcntl; + } + } + } +#else + r= set_blocking_mode ? 0 : 1; +#endif /* !defined(NO_FCNTL_NONBLOCK) */ +#else /* !defined(__WIN__) */ + if (vio->type != VIO_TYPE_NAMEDPIPE && vio->type != VIO_TYPE_SHARED_MEMORY) + { + ulong arg; + int old_fcntl=vio->fcntl_mode; + if (set_blocking_mode) + { + arg = 0; + vio->fcntl_mode &= ~O_NONBLOCK; /* clear bit */ + } + else + { + arg = 1; + vio->fcntl_mode |= O_NONBLOCK; /* set bit */ + } + if (old_fcntl != vio->fcntl_mode) + r = ioctlsocket(vio->sd,FIONBIO,(void*) &arg); + } + else + r= test(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode; +#endif /* !defined(__WIN__) */ + DBUG_PRINT("exit", ("%d", r)); + DBUG_RETURN(r); +} + +my_bool +vio_is_blocking(Vio * vio) +{ + my_bool r; + DBUG_ENTER("vio_is_blocking"); + r = !(vio->fcntl_mode & O_NONBLOCK); + DBUG_PRINT("exit", ("%d", (int) r)); + DBUG_RETURN(r); +} + + +int vio_fastsend(Vio * vio __attribute__((unused))) +{ + int r=0; + DBUG_ENTER("vio_fastsend"); + +#if defined(IPTOS_THROUGHPUT) + { + int tos = IPTOS_THROUGHPUT; + r= setsockopt(vio->sd, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof(tos)); + } +#endif /* IPTOS_THROUGHPUT */ + if (!r) + { +#ifdef __WIN__ + BOOL nodelay= 1; +#else + int nodelay = 1; +#endif + + r= setsockopt(vio->sd, IPPROTO_TCP, TCP_NODELAY, + IF_WIN(const char*, void*) &nodelay, + sizeof(nodelay)); + + } + if (r) + { + DBUG_PRINT("warning", ("Couldn't set socket option for fast send")); + r= -1; + } + DBUG_PRINT("exit", ("%d", r)); + DBUG_RETURN(r); +} + +int vio_keepalive(Vio* vio, my_bool set_keep_alive) +{ + int r=0; + uint opt = 0; + DBUG_ENTER("vio_keepalive"); + DBUG_PRINT("enter", ("sd: %d set_keep_alive: %d", vio->sd, (int) + set_keep_alive)); + if (vio->type != VIO_TYPE_NAMEDPIPE) + { + if (set_keep_alive) + opt = 1; + r = setsockopt(vio->sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt, + sizeof(opt)); + } + DBUG_RETURN(r); +} + + +my_bool +vio_should_retry(Vio * vio __attribute__((unused))) +{ + int en = socket_errno; + return (en == SOCKET_EAGAIN || en == SOCKET_EINTR || + en == SOCKET_EWOULDBLOCK); +} + + +my_bool +vio_was_interrupted(Vio *vio __attribute__((unused))) +{ + int en= socket_errno; + return (en == SOCKET_EAGAIN || en == SOCKET_EINTR || + en == SOCKET_EWOULDBLOCK || en == SOCKET_ETIMEDOUT); +} + + +int vio_close(Vio * vio) +{ + int r=0; + DBUG_ENTER("vio_close"); +#ifdef _WIN32 + if (vio->type == VIO_TYPE_NAMEDPIPE) + { +#ifdef MYSQL_SERVER + CancelIo(vio->hPipe); + DisconnectNamedPipe(vio->hPipe); +#endif + r=CloseHandle(vio->hPipe); + } + else +#endif /* _WIN32 */ + if (vio->type != VIO_CLOSED) + { + DBUG_ASSERT(vio->sd >= 0); + if (shutdown(vio->sd, SHUT_RDWR)) + r= -1; + if (closesocket(vio->sd)) + r= -1; + } + if (r) + { + DBUG_PRINT("vio_error", ("close() failed, error: %d",socket_errno)); + /* FIXME: error handling (not critical for MySQL) */ + } + vio->type= VIO_CLOSED; + vio->sd= -1; + DBUG_RETURN(r); +} + + +const char *vio_description(Vio * vio) +{ + return vio->desc; +} + +enum enum_vio_type vio_type(Vio* vio) +{ + return vio->type; +} + +my_socket vio_fd(Vio* vio) +{ + return vio->sd; +} + +my_bool vio_peer_addr(Vio *vio, char *buf, uint16 *port, size_t buflen) +{ + DBUG_ENTER("vio_peer_addr"); + DBUG_PRINT("enter", ("sd: %d", vio->sd)); + + if (vio->localhost) + { + strmov(buf, "127.0.0.1"); + *port= 0; + } + else + { + int error; + char port_buf[NI_MAXSERV]; + socklen_t addrLen = sizeof(vio->remote); + if (getpeername(vio->sd, (struct sockaddr *) (&vio->remote), + &addrLen) != 0) + { + DBUG_PRINT("exit", ("getpeername gave error: %d", socket_errno)); + DBUG_RETURN(1); + } + vio->addrLen= (int)addrLen; + + if ((error= getnameinfo((struct sockaddr *)(&vio->remote), + addrLen, + buf, buflen, + port_buf, NI_MAXSERV, NI_NUMERICHOST|NI_NUMERICSERV))) + { + DBUG_PRINT("exit", ("getnameinfo gave error: %s", + gai_strerror(error))); + DBUG_RETURN(1); + } + + *port= (uint16)strtol(port_buf, (char **)NULL, 10); + + /* + A lot of users do not have IPv6 loopback resolving to localhost + correctly setup. Should this exist? No. If we do not do it though + we will be getting a lot of support questions from users who + have bad setups. This code should be removed by say... 2012. + -Brian + */ + if (!memcmp(buf, "::ffff:127.0.0.1", sizeof("::ffff:127.0.0.1"))) + strmov(buf, "127.0.0.1"); + } + DBUG_PRINT("exit", ("addr: %s", buf)); + DBUG_RETURN(0); +} + + +/* Return 0 if there is data to be read */ + +my_bool vio_poll_read(Vio *vio,uint timeout) +{ +#ifdef __WIN__ + int res; + my_socket fd= vio->sd; + fd_set readfds, errorfds; + struct timeval tm; + DBUG_ENTER("vio_poll"); + tm.tv_sec= timeout; + tm.tv_usec= 0; + FD_ZERO(&readfds); + FD_ZERO(&errorfds); + FD_SET(fd, &readfds); + FD_SET(fd, &errorfds); + /* The first argument is ignored on Windows, so a conversion to int is OK */ + if ((res= select((int) fd, &readfds, NULL, &errorfds, &tm) <= 0)) + { + DBUG_RETURN(res < 0 ? 0 : 1); + } + res= FD_ISSET(fd, &readfds) || FD_ISSET(fd, &errorfds); + DBUG_RETURN(!res); +#elif defined(HAVE_POLL) + struct pollfd fds; + int res; + DBUG_ENTER("vio_poll"); + fds.fd=vio->sd; + fds.events=POLLIN; + fds.revents=0; + if ((res=poll(&fds,1,(int) timeout*1000)) <= 0) + { + DBUG_RETURN(res < 0 ? 0 : 1); /* Don't return 1 on errors */ + } + DBUG_RETURN(fds.revents & (POLLIN | POLLERR | POLLHUP) ? 0 : 1); +#else + return 0; +#endif +} + + +my_bool vio_peek_read(Vio *vio, uint *bytes) +{ +#ifdef __WIN__ + int len; + if (ioctlsocket(vio->sd, FIONREAD, &len)) + return TRUE; + *bytes= len; + return FALSE; +#elif FIONREAD_IN_SYS_IOCTL + int len; + if (ioctl(vio->sd, FIONREAD, &len) < 0) + return TRUE; + *bytes= len; + return FALSE; +#else + char buf[1024]; + ssize_t res= recv(vio->sd, &buf, sizeof(buf), MSG_PEEK); + if (res < 0) + return TRUE; + *bytes= res; + return FALSE; +#endif +} + +void vio_timeout(Vio *vio, uint which, uint timeout) +{ +#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) + int r; + DBUG_ENTER("vio_timeout"); + + { +#ifdef __WIN__ + /* Windows expects time in milliseconds as int */ + int wait_timeout= (int) timeout * 1000; +#else + /* POSIX specifies time as struct timeval. */ + struct timeval wait_timeout; + wait_timeout.tv_sec= timeout; + wait_timeout.tv_usec= 0; +#endif + + r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO, + IF_WIN(const char*, const void*)&wait_timeout, + sizeof(wait_timeout)); + + } + +#ifndef DBUG_OFF + if (r != 0) + DBUG_PRINT("error", ("setsockopt failed: %d, errno: %d", r, socket_errno)); +#endif + + DBUG_VOID_RETURN; +#else +/* + Platforms not suporting setting of socket timeout should either use + thr_alarm or just run without read/write timeout(s) +*/ +#endif +} + + +#ifdef __WIN__ +size_t vio_read_pipe(Vio * vio, uchar* buf, size_t size) +{ + DWORD length; + DBUG_ENTER("vio_read_pipe"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %u", vio->sd, buf, + (uint) size)); + + if (!ReadFile(vio->hPipe, buf, size, &length, NULL)) + DBUG_RETURN(-1); + + DBUG_PRINT("exit", ("%d", length)); + DBUG_RETURN((size_t) length); +} + + +size_t vio_write_pipe(Vio * vio, const uchar* buf, size_t size) +{ + DWORD length; + DBUG_ENTER("vio_write_pipe"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %u", vio->sd, buf, + (uint) size)); + + if (!WriteFile(vio->hPipe, (char*) buf, size, &length, NULL)) + DBUG_RETURN(-1); + + DBUG_PRINT("exit", ("%d", length)); + DBUG_RETURN((size_t) length); +} + +int vio_close_pipe(Vio * vio) +{ + int r; + DBUG_ENTER("vio_close_pipe"); +#ifdef MYSQL_SERVER + CancelIo(vio->hPipe); + DisconnectNamedPipe(vio->hPipe); +#endif + r=CloseHandle(vio->hPipe); + if (r) + { + DBUG_PRINT("vio_error", ("close() failed, error: %d",GetLastError())); + /* FIXME: error handling (not critical for MySQL) */ + } + vio->type= VIO_CLOSED; + vio->sd= -1; + DBUG_RETURN(r); +} + + +void vio_ignore_timeout(Vio *vio __attribute__((unused)), + uint which __attribute__((unused)), + uint timeout __attribute__((unused))) +{ +} + + +#ifdef HAVE_SMEM + +size_t vio_read_shared_memory(Vio * vio, uchar* buf, size_t size) +{ + size_t length; + size_t remain_local; + char *current_postion; + HANDLE events[2]; + + DBUG_ENTER("vio_read_shared_memory"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %d", vio->sd, buf, + size)); + + remain_local = size; + current_postion=buf; + + events[0]= vio->event_server_wrote; + events[1]= vio->event_conn_closed; + + do + { + if (vio->shared_memory_remain == 0) + { + /* + WaitForMultipleObjects can return next values: + WAIT_OBJECT_0+0 - event from vio->event_server_wrote + WAIT_OBJECT_0+1 - event from vio->event_conn_closed. We can't read + anything + WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything + */ + if (WaitForMultipleObjects(array_elements(events), events, FALSE, + vio->net->read_timeout*1000) != WAIT_OBJECT_0) + { + DBUG_RETURN(-1); + }; + + vio->shared_memory_pos = vio->handle_map; + vio->shared_memory_remain = uint4korr((ulong*)vio->shared_memory_pos); + vio->shared_memory_pos+=4; + } + + length = size; + + if (vio->shared_memory_remain < length) + length = vio->shared_memory_remain; + if (length > remain_local) + length = remain_local; + + memcpy(current_postion,vio->shared_memory_pos,length); + + vio->shared_memory_remain-=length; + vio->shared_memory_pos+=length; + current_postion+=length; + remain_local-=length; + + if (!vio->shared_memory_remain) + { + if (!SetEvent(vio->event_client_read)) + DBUG_RETURN(-1); + } + } while (remain_local); + length = size; + + DBUG_PRINT("exit", ("%lu", (ulong) length)); + DBUG_RETURN(length); +} + + +size_t vio_write_shared_memory(Vio * vio, const uchar* buf, size_t size) +{ + size_t length, remain, sz; + HANDLE pos; + const uchar *current_postion; + HANDLE events[2]; + + DBUG_ENTER("vio_write_shared_memory"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %d", vio->sd, buf, + size)); + + remain = size; + current_postion = buf; + + events[0]= vio->event_server_read; + events[1]= vio->event_conn_closed; + + while (remain != 0) + { + if (WaitForMultipleObjects(array_elements(events), events, FALSE, + vio->net->write_timeout*1000) != WAIT_OBJECT_0) + { + DBUG_RETURN((size_t) -1); + } + + sz= (remain > shared_memory_buffer_length ? shared_memory_buffer_length : + remain); + + int4store(vio->handle_map,sz); + pos = vio->handle_map + 4; + memcpy(pos,current_postion,sz); + remain-=sz; + current_postion+=sz; + if (!SetEvent(vio->event_client_wrote)) + DBUG_RETURN((size_t) -1); + } + length = size; + + DBUG_PRINT("exit", ("%lu", (ulong) length)); + DBUG_RETURN(length); +} + + +/** + Close shared memory and DBUG_PRINT any errors that happen on closing. + @return Zero if all closing functions succeed, and nonzero otherwise. +*/ +int vio_close_shared_memory(Vio * vio) +{ + int error_count= 0; + DBUG_ENTER("vio_close_shared_memory"); + if (vio->type != VIO_CLOSED) + { + /* + Set event_conn_closed for notification of both client and server that + connection is closed + */ + SetEvent(vio->event_conn_closed); + /* + Close all handlers. UnmapViewOfFile and CloseHandle return non-zero + result if they are success. + */ + if (UnmapViewOfFile(vio->handle_map) == 0) + { + error_count++; + DBUG_PRINT("vio_error", ("UnmapViewOfFile() failed")); + } + if (CloseHandle(vio->event_server_wrote) == 0) + { + error_count++; + DBUG_PRINT("vio_error", ("CloseHandle(vio->esw) failed")); + } + if (CloseHandle(vio->event_server_read) == 0) + { + error_count++; + DBUG_PRINT("vio_error", ("CloseHandle(vio->esr) failed")); + } + if (CloseHandle(vio->event_client_wrote) == 0) + { + error_count++; + DBUG_PRINT("vio_error", ("CloseHandle(vio->ecw) failed")); + } + if (CloseHandle(vio->event_client_read) == 0) + { + error_count++; + DBUG_PRINT("vio_error", ("CloseHandle(vio->ecr) failed")); + } + if (CloseHandle(vio->handle_file_map) == 0) + { + error_count++; + DBUG_PRINT("vio_error", ("CloseHandle(vio->hfm) failed")); + } + if (CloseHandle(vio->event_conn_closed) == 0) + { + error_count++; + DBUG_PRINT("vio_error", ("CloseHandle(vio->ecc) failed")); + } + } + vio->type= VIO_CLOSED; + vio->sd= -1; + DBUG_RETURN(error_count); +} +#endif /* HAVE_SMEM */ +#endif /* __WIN__ */ + + +/** + Number of bytes in the read buffer. + + @return number of bytes in the read buffer or < 0 if error. +*/ + +ssize_t vio_pending(Vio *vio) +{ +#ifdef HAVE_OPENSSL + SSL *ssl= (SSL*) vio->ssl_arg; +#endif + + if (vio->read_pos < vio->read_end) + return vio->read_end - vio->read_pos; + +#ifdef HAVE_OPENSSL + if (ssl) + return SSL_pending(ssl); +#endif + + return 0; +} diff --git a/externals/mysql/vio/viossl.c b/externals/mysql/vio/viossl.c new file mode 100644 index 0000000..9cbd740 --- /dev/null +++ b/externals/mysql/vio/viossl.c @@ -0,0 +1,279 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Note that we can't have assertion on file descriptors; The reason for + this is that during mysql shutdown, another thread can close a file + we are working on. In this case we should just return read errors from + the file descriptior. +*/ + +#include "vio_priv.h" + +#ifdef HAVE_OPENSSL + +#ifdef __NETWARE__ + +/* yaSSL already uses BSD sockets */ +#ifndef HAVE_YASSL + +/* + The default OpenSSL implementation on NetWare uses WinSock. + This code allows us to use the BSD sockets. +*/ + +static int SSL_set_fd_bsd(SSL *s, int fd) +{ + int result= -1; + BIO_METHOD *BIO_s_bsdsocket(); + BIO *bio; + + if ((bio= BIO_new(BIO_s_bsdsocket()))) + { + result= BIO_set_fd(bio, fd, BIO_NOCLOSE); + SSL_set_bio(s, bio, bio); + } + return result; +} + +#define SSL_set_fd(A, B) SSL_set_fd_bsd((A), (B)) + +#endif /* HAVE_YASSL */ +#endif /* __NETWARE__ */ + + +static void +report_errors(SSL* ssl) +{ + unsigned long l; + const char *file; + const char *data; + int line, flags; +#ifndef DBUG_OFF + char buf[512]; +#endif + + DBUG_ENTER("report_errors"); + + while ((l= ERR_get_error_line_data(&file,&line,&data,&flags))) + { + DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf), + file,line,(flags&ERR_TXT_STRING)?data:"")) ; + } + + if (ssl) + DBUG_PRINT("error", ("error: %s", + ERR_error_string(SSL_get_error(ssl, l), buf))); + + DBUG_PRINT("info", ("socket_errno: %d", socket_errno)); + DBUG_VOID_RETURN; +} + + +size_t vio_ssl_read(Vio *vio, uchar* buf, size_t size) +{ + size_t r; + DBUG_ENTER("vio_ssl_read"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %u ssl: %p", + vio->sd, buf, (uint) size, vio->ssl_arg)); + + r= SSL_read((SSL*) vio->ssl_arg, buf, size); +#ifndef DBUG_OFF + if (r == (size_t) -1) + report_errors((SSL*) vio->ssl_arg); +#endif + DBUG_PRINT("exit", ("%u", (uint) r)); + DBUG_RETURN(r); +} + + +size_t vio_ssl_write(Vio *vio, const uchar* buf, size_t size) +{ + size_t r; + DBUG_ENTER("vio_ssl_write"); + DBUG_PRINT("enter", ("sd: %d buf: %p size: %u", vio->sd, + buf, (uint) size)); + + r= SSL_write((SSL*) vio->ssl_arg, buf, size); +#ifndef DBUG_OFF + if (r == (size_t) -1) + report_errors((SSL*) vio->ssl_arg); +#endif + DBUG_PRINT("exit", ("%u", (uint) r)); + DBUG_RETURN(r); +} + + +int vio_ssl_close(Vio *vio) +{ + int r= 0; + SSL *ssl= (SSL*)vio->ssl_arg; + DBUG_ENTER("vio_ssl_close"); + + if (ssl) + { + /* + THE SSL standard says that SSL sockets must send and receive a close_notify + alert on socket shutdown to avoid truncation attacks. However, this can + cause problems since we often hold a lock during shutdown and this IO can + take an unbounded amount of time to complete. Since our packets are self + describing with length, we aren't vunerable to these attacks. Therefore, + we just shutdown by closing the socket (quiet shutdown). + */ + SSL_set_quiet_shutdown(ssl, 1); + + switch ((r= SSL_shutdown(ssl))) { + case 1: + /* Shutdown successful */ + break; + case 0: + /* + Shutdown not yet finished - since the socket is going to + be closed there is no need to call SSL_shutdown() a second + time to wait for the other side to respond + */ + break; + default: /* Shutdown failed */ + DBUG_PRINT("vio_error", ("SSL_shutdown() failed, error: %d", + SSL_get_error(ssl, r))); + break; + } + } + DBUG_RETURN(vio_close(vio)); +} + + +void vio_ssl_delete(Vio *vio) +{ + if (!vio) + return; /* It must be safe to delete null pointer */ + + if (vio->type == VIO_TYPE_SSL) + vio_ssl_close(vio); /* Still open, close connection first */ + + if (vio->ssl_arg) + { + SSL_free((SSL*) vio->ssl_arg); + vio->ssl_arg= 0; + } + + vio_delete(vio); +} + +#ifndef EMBEDDED_LIBRARY +static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout, + int (*connect_accept_func)(SSL*)) +{ + SSL *ssl; + my_bool unused; + my_bool was_blocking; + + DBUG_ENTER("ssl_do"); + DBUG_PRINT("enter", ("ptr: %p, sd: %d ctx: %p", + ptr, vio->sd, ptr->ssl_context)); + + /* Set socket to blocking if not already set */ + vio_blocking(vio, 1, &was_blocking); + + if (!(ssl= SSL_new(ptr->ssl_context))) + { + DBUG_PRINT("error", ("SSL_new failure")); + report_errors(ssl); + vio_blocking(vio, was_blocking, &unused); + DBUG_RETURN(1); + } + DBUG_PRINT("info", ("ssl: %p timeout: %ld", ssl, timeout)); + SSL_clear(ssl); + SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout); + SSL_set_fd(ssl, vio->sd); + + if (connect_accept_func(ssl) < 1) + { + DBUG_PRINT("error", ("SSL_connect/accept failure")); + report_errors(ssl); + SSL_free(ssl); + vio_blocking(vio, was_blocking, &unused); + DBUG_RETURN(1); + } + + /* + Connection succeeded. Install new function handlers, + change type, set sd to the fd used when connecting + and set pointer to the SSL structure + */ + vio_reset(vio, VIO_TYPE_SSL, SSL_get_fd(ssl), 0, 0); + vio->ssl_arg= (void*)ssl; + +#ifndef DBUG_OFF + { + /* Print some info about the peer */ + X509 *cert; + char buf[512]; + + DBUG_PRINT("info",("SSL connection succeeded")); + DBUG_PRINT("info",("Using cipher: '%s'" , SSL_get_cipher_name(ssl))); + + if ((cert= SSL_get_peer_certificate (ssl))) + { + DBUG_PRINT("info",("Peer certificate:")); + X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf)); + DBUG_PRINT("info",("\t subject: '%s'", buf)); + X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)); + DBUG_PRINT("info",("\t issuer: '%s'", buf)); + X509_free(cert); + } + else + DBUG_PRINT("info",("Peer does not have certificate.")); + + if (SSL_get_shared_ciphers(ssl, buf, sizeof(buf))) + { + DBUG_PRINT("info",("shared_ciphers: '%s'", buf)); + } + else + DBUG_PRINT("info",("no shared ciphers!")); + } +#endif + + DBUG_RETURN(0); +} + + +int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout) +{ + DBUG_ENTER("sslaccept"); + DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept)); +} + + +int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout) +{ + DBUG_ENTER("sslconnect"); + DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect)); +} +#endif /*EMBEDDED_LIBRARY*/ + +int vio_ssl_blocking(Vio *vio __attribute__((unused)), + my_bool set_blocking_mode, + my_bool *old_mode) +{ + /* Mode is always blocking */ + *old_mode= 1; + /* Return error if we try to change to non_blocking mode */ + return (set_blocking_mode ? 0 : 1); +} + + + +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/vio/viosslfactories.c b/externals/mysql/vio/viosslfactories.c new file mode 100644 index 0000000..95dbd73 --- /dev/null +++ b/externals/mysql/vio/viosslfactories.c @@ -0,0 +1,385 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "vio_priv.h" + +#ifdef HAVE_OPENSSL + +static my_bool ssl_algorithms_added = FALSE; +static my_bool ssl_error_strings_loaded= FALSE; +static int verify_depth = 0; + +static unsigned char dh512_p[]= +{ + 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75, + 0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F, + 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,0x57,0x46,0x50,0xD3, + 0x69,0x99,0xDB,0x29,0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12, + 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,0xD8,0x00,0x3E,0x7C, + 0x47,0x74,0xE8,0x33, +}; + +static unsigned char dh512_g[]={ + 0x02, +}; + +static DH *get_dh512(void) +{ + DH *dh; + if ((dh=DH_new())) + { + dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL); + dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL); + if (! dh->p || ! dh->g) + { + DH_free(dh); + dh=0; + } + } + return(dh); +} + + +static void +report_errors() +{ + unsigned long l; + const char* file; + const char* data; + int line,flags; + + DBUG_ENTER("report_errors"); + + while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0) + { +#ifndef DBUG_OFF /* Avoid warning */ + char buf[200]; + DBUG_PRINT("error", ("OpenSSL: %s:%s:%d:%s\n", ERR_error_string(l,buf), + file,line,(flags & ERR_TXT_STRING) ? data : "")) ; +#endif + } + DBUG_VOID_RETURN; +} + + +static int +vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file) +{ + DBUG_ENTER("vio_set_cert_stuff"); + DBUG_PRINT("enter", ("ctx: %p cert_file: %s key_file: %s", + ctx, cert_file, key_file)); + if (cert_file) + { + if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) + { + DBUG_PRINT("error",("unable to get certificate from '%s'", cert_file)); + DBUG_EXECUTE("error", ERR_print_errors_fp(DBUG_FILE);); + fprintf(stderr, "SSL error: Unable to get certificate from '%s'\n", + cert_file); + fflush(stderr); + DBUG_RETURN(1); + } + + if (!key_file) + key_file= cert_file; + + if (SSL_CTX_use_PrivateKey_file(ctx, key_file, SSL_FILETYPE_PEM) <= 0) + { + DBUG_PRINT("error", ("unable to get private key from '%s'", key_file)); + DBUG_EXECUTE("error", ERR_print_errors_fp(DBUG_FILE);); + fprintf(stderr, "SSL error: Unable to get private key from '%s'\n", + key_file); + fflush(stderr); + DBUG_RETURN(1); + } + + /* + If we are using DSA, we can copy the parameters from the private key + Now we know that a key and cert have been set against the SSL context + */ + if (!SSL_CTX_check_private_key(ctx)) + { + DBUG_PRINT("error", + ("Private key does not match the certificate public key")); + DBUG_EXECUTE("error", ERR_print_errors_fp(DBUG_FILE);); + fprintf(stderr, + "SSL error: " + "Private key does not match the certificate public key\n"); + fflush(stderr); + DBUG_RETURN(1); + } + } + DBUG_RETURN(0); +} + + +static int +vio_verify_callback(int ok, X509_STORE_CTX *ctx) +{ + char buf[256]; + X509 *err_cert; + + DBUG_ENTER("vio_verify_callback"); + DBUG_PRINT("enter", ("ok: %d ctx: %p", ok, ctx)); + + err_cert= X509_STORE_CTX_get_current_cert(ctx); + X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf)); + DBUG_PRINT("info", ("cert: %s", buf)); + if (!ok) + { + int err, depth; + err= X509_STORE_CTX_get_error(ctx); + depth= X509_STORE_CTX_get_error_depth(ctx); + + DBUG_PRINT("error",("verify error: %d '%s'",err, + X509_verify_cert_error_string(err))); + /* + Approve cert if depth is greater then "verify_depth", currently + verify_depth is always 0 and there is no way to increase it. + */ + if (verify_depth >= depth) + ok= 1; + } + switch (ctx->error) + { + case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: + X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256); + DBUG_PRINT("info",("issuer= %s\n", buf)); + break; + case X509_V_ERR_CERT_NOT_YET_VALID: + case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: + DBUG_PRINT("error", ("notBefore")); + /*ASN1_TIME_print_fp(stderr,X509_get_notBefore(ctx->current_cert));*/ + break; + case X509_V_ERR_CERT_HAS_EXPIRED: + case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: + DBUG_PRINT("error", ("notAfter error")); + /*ASN1_TIME_print_fp(stderr,X509_get_notAfter(ctx->current_cert));*/ + break; + } + DBUG_PRINT("exit", ("%d", ok)); + DBUG_RETURN(ok); +} + + +#ifdef __NETWARE__ + +/* NetWare SSL cleanup */ +void netware_ssl_cleanup() +{ + /* free memory from SSL_library_init() */ + EVP_cleanup(); + +/* OpenSSL NetWare port specific functions */ +#ifndef HAVE_YASSL + + /* free global X509 method */ + X509_STORE_method_cleanup(); + + /* free the thread_hash error table */ + ERR_free_state_table(); +#endif +} + + +/* NetWare SSL initialization */ +static void netware_ssl_init() +{ + /* cleanup OpenSSL library */ + NXVmRegisterExitHandler(netware_ssl_cleanup, NULL); +} + +#endif /* __NETWARE__ */ + + +static void check_ssl_init() +{ + if (!ssl_algorithms_added) + { + ssl_algorithms_added= TRUE; + SSL_library_init(); + OpenSSL_add_all_algorithms(); + + } + +#ifdef __NETWARE__ + netware_ssl_init(); +#endif + + if (!ssl_error_strings_loaded) + { + ssl_error_strings_loaded= TRUE; + SSL_load_error_strings(); + } +} + +#ifndef EMBEDDED_LIBRARY +/************************ VioSSLFd **********************************/ +static struct st_VioSSLFd * +new_VioSSLFd(const char *key_file, const char *cert_file, + const char *ca_file, const char *ca_path, + const char *cipher, SSL_METHOD *method) +{ + DH *dh; + struct st_VioSSLFd *ssl_fd; + DBUG_ENTER("new_VioSSLFd"); + DBUG_PRINT("enter", + ("key_file: '%s' cert_file: '%s' ca_file: '%s' ca_path: '%s' " + "cipher: '%s'", + key_file ? key_file : "NULL", + cert_file ? cert_file : "NULL", + ca_file ? ca_file : "NULL", + ca_path ? ca_path : "NULL", + cipher ? cipher : "NULL")); + + check_ssl_init(); + + if (!(ssl_fd= ((struct st_VioSSLFd*) + my_malloc(sizeof(struct st_VioSSLFd),MYF(0))))) + DBUG_RETURN(0); + + if (!(ssl_fd->ssl_context= SSL_CTX_new(method))) + { + DBUG_PRINT("error", ("SSL_CTX_new failed")); + report_errors(); + my_free((void*)ssl_fd,MYF(0)); + DBUG_RETURN(0); + } + + /* + Set the ciphers that can be used + NOTE: SSL_CTX_set_cipher_list will return 0 if + none of the provided ciphers could be selected + */ + if (cipher && + SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher) == 0) + { + DBUG_PRINT("error", ("failed to set ciphers to use")); + report_errors(); + SSL_CTX_free(ssl_fd->ssl_context); + my_free((void*)ssl_fd,MYF(0)); + DBUG_RETURN(0); + } + + /* Load certs from the trusted ca */ + if (SSL_CTX_load_verify_locations(ssl_fd->ssl_context, ca_file, ca_path) == 0) + { + DBUG_PRINT("warning", ("SSL_CTX_load_verify_locations failed")); + if (SSL_CTX_set_default_verify_paths(ssl_fd->ssl_context) == 0) + { + DBUG_PRINT("error", ("SSL_CTX_set_default_verify_paths failed")); + report_errors(); + SSL_CTX_free(ssl_fd->ssl_context); + my_free((void*)ssl_fd,MYF(0)); + DBUG_RETURN(0); + } + } + + if (vio_set_cert_stuff(ssl_fd->ssl_context, cert_file, key_file)) + { + DBUG_PRINT("error", ("vio_set_cert_stuff failed")); + report_errors(); + SSL_CTX_free(ssl_fd->ssl_context); + my_free((void*)ssl_fd,MYF(0)); + DBUG_RETURN(0); + } + + /* DH stuff */ + dh=get_dh512(); + SSL_CTX_set_tmp_dh(ssl_fd->ssl_context, dh); + DH_free(dh); + + DBUG_PRINT("exit", ("OK 1")); + + DBUG_RETURN(ssl_fd); +} + + +/************************ VioSSLConnectorFd **********************************/ +struct st_VioSSLFd * +new_VioSSLConnectorFd(const char *key_file, const char *cert_file, + const char *ca_file, const char *ca_path, + const char *cipher) +{ + struct st_VioSSLFd *ssl_fd; + int verify= SSL_VERIFY_PEER; + + /* + Turn off verification of servers certificate if both + ca_file and ca_path is set to NULL + */ + if (ca_file == 0 && ca_path == 0) + verify= SSL_VERIFY_NONE; + + if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file, + ca_path, cipher, TLSv1_client_method()))) + { + return 0; + } + + /* Init the VioSSLFd as a "connector" ie. the client side */ + + /* + The verify_callback function is used to control the behaviour + when the SSL_VERIFY_PEER flag is set. + */ + SSL_CTX_set_verify(ssl_fd->ssl_context, verify, vio_verify_callback); + + return ssl_fd; +} + + +/************************ VioSSLAcceptorFd **********************************/ +struct st_VioSSLFd * +new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, + const char *ca_file, const char *ca_path, + const char *cipher) +{ + struct st_VioSSLFd *ssl_fd; + int verify= SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE; + if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file, + ca_path, cipher, TLSv1_server_method()))) + { + return 0; + } + /* Init the the VioSSLFd as a "acceptor" ie. the server side */ + + /* Set max number of cached sessions, returns the previous size */ + SSL_CTX_sess_set_cache_size(ssl_fd->ssl_context, 128); + + /* + The verify_callback function is used to control the behaviour + when the SSL_VERIFY_PEER flag is set. + */ + SSL_CTX_set_verify(ssl_fd->ssl_context, verify, vio_verify_callback); + + /* + Set session_id - an identifier for this server session + Use the ssl_fd pointer + */ + SSL_CTX_set_session_id_context(ssl_fd->ssl_context, + (const unsigned char *)ssl_fd, + sizeof(ssl_fd)); + + return ssl_fd; +} + +void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd) +{ + SSL_CTX_free(fd->ssl_context); + my_free((uchar*) fd, MYF(0)); +} +#endif /*EMBEDDED_LIBRARY*/ +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/vio/viotest-ssl.c b/externals/mysql/vio/viotest-ssl.c new file mode 100644 index 0000000..b8abbac --- /dev/null +++ b/externals/mysql/vio/viotest-ssl.c @@ -0,0 +1,151 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include +#ifdef HAVE_OPENSSL +#include +#include +#include +#include "mysql.h" +#include "errmsg.h" +#include +#include +#include +#include + +const char *VER="0.2"; + + +#ifndef DBUG_OFF +const char *default_dbug_option="d:t:O,/tmp/viotest-ssl.trace"; +#endif + +void +fatal_error(const char *r) +{ + perror(r); + exit(0); +} + +void +print_usage() +{ + printf("viossl-test: testing SSL virtual IO. Usage:\n"); + printf("viossl-test server-key server-cert client-key client-cert [CAfile] [CApath]\n"); +} + + +int main(int argc, char **argv) +{ + char* server_key = 0; + char* server_cert = 0; + char* client_key = 0; + char* client_cert = 0; + char* ca_file = 0; + char* ca_path = 0; + int child_pid,sv[2]; + struct st_VioSSLAcceptorFd* ssl_acceptor=0; + struct st_VioSSLConnectorFd* ssl_connector=0; + Vio* client_vio=0; + Vio* server_vio=0; + MY_INIT(argv[0]); + DBUG_PROCESS(argv[0]); + DBUG_PUSH(default_dbug_option); + + if (argc<5) + { + print_usage(); + return 1; + } + + server_key = argv[1]; + server_cert = argv[2]; + client_key = argv[3]; + client_cert = argv[4]; + if (argc>5) + ca_file = argv[5]; + if (argc>6) + ca_path = argv[6]; + printf("Server key/cert : %s/%s\n", server_key, server_cert); + printf("Client key/cert : %s/%s\n", client_key, client_cert); + if (ca_file!=0) + printf("CAfile : %s\n", ca_file); + if (ca_path!=0) + printf("CApath : %s\n", ca_path); + + + if (socketpair(PF_UNIX, SOCK_STREAM, IPPROTO_IP, sv)==-1) + fatal_error("socketpair"); + + ssl_acceptor = new_VioSSLAcceptorFd(server_key, server_cert, ca_file, + ca_path); + ssl_connector = new_VioSSLConnectorFd(client_key, client_cert, ca_file, + ca_path); + + client_vio = (Vio*)my_malloc(sizeof(struct st_vio),MYF(0)); + client_vio->sd = sv[0]; + sslconnect(ssl_connector,client_vio); + server_vio = (Vio*)my_malloc(sizeof(struct st_vio),MYF(0)); + server_vio->sd = sv[1]; + sslaccept(ssl_acceptor,server_vio); + + printf("Socketpair: %d , %d\n", client_vio->sd, server_vio->sd); + + child_pid = fork(); + if (child_pid==-1) + { + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + fatal_error("fork"); + } + if (child_pid==0) + { + /* child, therefore, client */ + char xbuf[100]; + int r = vio_ssl_read(client_vio,xbuf, sizeof(xbuf)); + if (r<=0) { + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + fatal_error("client:SSL_read"); + } + xbuf[r] = 0; + printf("client:got %s\n", xbuf); + my_free((uchar*)client_vio,MYF(0)); + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + sleep(1); + } + else + { + const char* s = "Huhuhuh"; + int r = vio_ssl_write(server_vio,(uchar*)s, strlen(s)); + if (r<=0) { + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + fatal_error("server:SSL_write"); + } + my_free((uchar*)server_vio,MYF(0)); + my_free((uchar*)ssl_acceptor,MYF(0)); + my_free((uchar*)ssl_connector,MYF(0)); + sleep(1); + } + return 0; +} +#else /* HAVE_OPENSSL */ + +int main() { +return 0; +} +#endif /* HAVE_OPENSSL */ diff --git a/externals/mysql/vio/viotest-sslconnect.cc b/externals/mysql/vio/viotest-sslconnect.cc new file mode 100644 index 0000000..89e1a6e --- /dev/null +++ b/externals/mysql/vio/viotest-sslconnect.cc @@ -0,0 +1,80 @@ + +/* +** Virtual I/O library +** Written by Andrei Errapart +*/ + +#include "all.h" + +#include +#include +#include +#include +#include + + +void +fatal_error( const char* r) +{ + perror(r); + exit(0); +} + +void +print_usage() +{ + printf("viotest-sslconnect: testing SSL virtual IO. Usage:\n"); + printf("viotest-sslconnect key cert\n"); +} + +int +main( int argc, + char** argv) +{ + char* key = 0; + char* cert = 0; + + if (argc<3) + { + print_usage(); + return 1; + } + + char ip[4] = {127, 0, 0, 1}; + unsigned long addr = (unsigned long) + ((unsigned long)ip[0]<<24L)| + ((unsigned long)ip[1]<<16L)| + ((unsigned long)ip[2]<< 8L)| + ((unsigned long)ip[3]); + int fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + if (fd<0) + fatal_error("socket"); + struct sockaddr_in sa; + sa.sin_family = AF_INET; + sa.sin_port=htons(4433); + sa.sin_addr.s_addr=htonl(addr); + int sa_size = sizeof sa; + if (connect(fd, reinterpret_cast(&sa), sa_size)==-1) + fatal_error("connect"); + key = argv[1]; + cert = argv[2]; + printf("Key : %s\n", key); + printf("Cert : %s\n", cert); + + VIO_NS::VioSSLConnectorFd* ssl_connector = new VIO_NS::VioSSLConnectorFd(cert, key,0,0); + + VIO_NS::VioSSL* vio = ssl_connector->connect(fd); + + char xbuf[100]; + int r = vio->read(xbuf, sizeof(xbuf)); + if (r<=0) { + delete ssl_connector; + delete vio; + fatal_error("client:SSL_read"); + } + xbuf[r] = 0; + printf("client:got %s\n", xbuf); + delete vio; + delete ssl_connector; + return 0; +} diff --git a/externals/mysql/vio/viotest.cc b/externals/mysql/vio/viotest.cc new file mode 100644 index 0000000..490a9ca --- /dev/null +++ b/externals/mysql/vio/viotest.cc @@ -0,0 +1,47 @@ +/* +** Virtual I/O library +** Written by Andrei Errapart +*/ + +#include "all.h" + +#include +#include +#include + +#include + +VIO_NS_USING; + +int +main( int argc, + char** argv) +{ + VioFd* fs = 0; + VioSocket* ss = 0; + int fd = -1; + char* hh = "hshshsh\n"; + + DBUG_ENTER("main"); + DBUG_PROCESS(argv[0]); + DBUG_PUSH("d:t"); + + fd = open("/dev/tty", O_WRONLY); + if (fd<0) + { + perror("open"); + return 1; + } + fs = new VioFd(fd); + ss = new VioSocket(fd); + if (fs->write(hh,strlen(hh)) < 0) + perror("write"); + ss->write(hh,strlen(hh)); + printf("peer_name:%s\n", ss->peer_name()); + printf("cipher_description:%s\n", ss->cipher_description()); + delete fs; + delete ss; + + DBUG_RETURN(0); +} + diff --git a/externals/mysql/violite.h b/externals/mysql/violite.h new file mode 100644 index 0000000..2720047 --- /dev/null +++ b/externals/mysql/violite.h @@ -0,0 +1,222 @@ +/* Copyright (C) 2000 MySQL AB + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Vio Lite. + * Purpose: include file for Vio that will work with C and C++ + */ + +#ifndef vio_violite_h_ +#define vio_violite_h_ + +#include "my_net.h" /* needed because of struct in_addr */ + + +/* Simple vio interface in C; The functions are implemented in violite.c */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +enum enum_vio_type +{ + VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE, + VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY +}; + + +#define VIO_LOCALHOST 1 /* a localhost connection */ +#define VIO_BUFFERED_READ 2 /* use buffered read */ +#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */ + +Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); +#ifdef __WIN__ +Vio* vio_new_win32pipe(HANDLE hPipe); +Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, + HANDLE handle_map, + HANDLE event_server_wrote, + HANDLE event_server_read, + HANDLE event_client_wrote, + HANDLE event_client_read, + HANDLE event_conn_closed); +size_t vio_read_pipe(Vio *vio, uchar * buf, size_t size); +size_t vio_write_pipe(Vio *vio, const uchar * buf, size_t size); +int vio_close_pipe(Vio * vio); +#else +#define HANDLE void * +#endif /* __WIN__ */ + +void vio_delete(Vio* vio); +int vio_close(Vio* vio); +void vio_reset(Vio* vio, enum enum_vio_type type, + my_socket sd, HANDLE hPipe, uint flags); +size_t vio_read(Vio *vio, uchar * buf, size_t size); +size_t vio_read_buff(Vio *vio, uchar * buf, size_t size); +size_t vio_write(Vio *vio, const uchar * buf, size_t size); +int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode); +my_bool vio_is_blocking(Vio *vio); +/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */ +int vio_fastsend(Vio *vio); +/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */ +int vio_keepalive(Vio *vio, my_bool onoff); +/* Whenever we should retry the last read/write operation. */ +my_bool vio_should_retry(Vio *vio); +/* Check that operation was timed out */ +my_bool vio_was_interrupted(Vio *vio); +/* Short text description of the socket for those, who are curious.. */ +const char* vio_description(Vio *vio); +/* Return the type of the connection */ +enum enum_vio_type vio_type(Vio* vio); +/* Return last error number */ +int vio_errno(Vio*vio); +/* Get socket number */ +my_socket vio_fd(Vio*vio); +/* Remote peer's address and name in text form */ +my_bool vio_peer_addr(Vio *vio, char *buf, uint16 *port, size_t buflen); +my_bool vio_poll_read(Vio *vio,uint timeout); +my_bool vio_peek_read(Vio *vio, uint *bytes); +ssize_t vio_pending(Vio *vio); + +#ifdef HAVE_OPENSSL +#include +#if OPENSSL_VERSION_NUMBER < 0x0090700f +#define DES_cblock des_cblock +#define DES_key_schedule des_key_schedule +#define DES_set_key_unchecked(k,ks) des_set_key_unchecked((k),*(ks)) +#define DES_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e) des_ede3_cbc_encrypt((i),(o),(l),*(k1),*(k2),*(k3),(iv),(e)) +#endif + +#define HEADER_DES_LOCL_H dummy_something +#define YASSL_MYSQL_COMPATIBLE +#ifndef YASSL_PREFIX +#define YASSL_PREFIX +#endif +/* Set yaSSL to use same type as MySQL do for socket handles */ +typedef my_socket YASSL_SOCKET_T; +#define YASSL_SOCKET_T_DEFINED +#include +#include + +#ifndef EMBEDDED_LIBRARY + +struct st_VioSSLFd +{ + SSL_CTX *ssl_context; +}; + +int sslaccept(struct st_VioSSLFd*, Vio *, long timeout); +int sslconnect(struct st_VioSSLFd*, Vio *, long timeout); + +struct st_VioSSLFd +*new_VioSSLConnectorFd(const char *key_file, const char *cert_file, + const char *ca_file, const char *ca_path, + const char *cipher); +struct st_VioSSLFd +*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, + const char *ca_file,const char *ca_path, + const char *cipher); +void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd); +#endif /* ! EMBEDDED_LIBRARY */ +#endif /* HAVE_OPENSSL */ + +#ifdef HAVE_SMEM +size_t vio_read_shared_memory(Vio *vio, uchar * buf, size_t size); +size_t vio_write_shared_memory(Vio *vio, const uchar * buf, size_t size); +int vio_close_shared_memory(Vio * vio); +#endif + +void vio_end(void); + +#ifdef __cplusplus +} +#endif + +#if !defined(DONT_MAP_VIO) +#define vio_delete(vio) (vio)->viodelete(vio) +#define vio_errno(vio) (vio)->vioerrno(vio) +#define vio_read(vio, buf, size) ((vio)->read)(vio,buf,size) +#define vio_write(vio, buf, size) ((vio)->write)(vio, buf, size) +#define vio_blocking(vio, set_blocking_mode, old_mode)\ + (vio)->vioblocking(vio, set_blocking_mode, old_mode) +#define vio_is_blocking(vio) (vio)->is_blocking(vio) +#define vio_fastsend(vio) (vio)->fastsend(vio) +#define vio_keepalive(vio, set_keep_alive) (vio)->viokeepalive(vio, set_keep_alive) +#define vio_should_retry(vio) (vio)->should_retry(vio) +#define vio_was_interrupted(vio) (vio)->was_interrupted(vio) +#define vio_close(vio) ((vio)->vioclose)(vio) +#define vio_peer_addr(vio, buf, prt, buflen) (vio)->peer_addr(vio, buf, prt, buflen) +#define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds) +#endif /* !defined(DONT_MAP_VIO) */ + +/* This enumerator is used in parser - should be always visible */ +enum SSL_type +{ + SSL_TYPE_NOT_SPECIFIED= -1, + SSL_TYPE_NONE, + SSL_TYPE_ANY, + SSL_TYPE_X509, + SSL_TYPE_SPECIFIED +}; + + +/* HFTODO - hide this if we don't want client in embedded server */ +/* This structure is for every connection on both sides */ +struct st_vio +{ + my_socket sd; /* my_socket - real or imaginary */ + HANDLE hPipe; + my_bool localhost; /* Are we from localhost? */ + int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */ + struct sockaddr_storage local; /* Local internet address */ + struct sockaddr_storage remote; /* Remote internet address */ + int addrLen; /* Length of remote address */ + enum enum_vio_type type; /* Type of connection */ + char desc[30]; /* String description */ + char *read_buffer; /* buffer for vio_read_buff */ + char *read_pos; /* start of unfetched data in the + read buffer */ + char *read_end; /* end of unfetched data */ + /* function pointers. They are similar for socket/SSL/whatever */ + void (*viodelete)(Vio*); + int (*vioerrno)(Vio*); + size_t (*read)(Vio*, uchar *, size_t); + size_t (*write)(Vio*, const uchar *, size_t); + int (*vioblocking)(Vio*, my_bool, my_bool *); + my_bool (*is_blocking)(Vio*); + int (*viokeepalive)(Vio*, my_bool); + int (*fastsend)(Vio*); + my_bool (*peer_addr)(Vio*, char *, uint16*, size_t); + void (*in_addr)(Vio*, struct sockaddr_storage*); + my_bool (*should_retry)(Vio*); + my_bool (*was_interrupted)(Vio*); + int (*vioclose)(Vio*); + void (*timeout)(Vio*, unsigned int which, unsigned int timeout); +#ifdef HAVE_OPENSSL + void *ssl_arg; +#endif +#ifdef HAVE_SMEM + HANDLE handle_file_map; + char *handle_map; + HANDLE event_server_wrote; + HANDLE event_server_read; + HANDLE event_client_wrote; + HANDLE event_client_read; + HANDLE event_conn_closed; + size_t shared_memory_remain; + char *shared_memory_pos; + NET *net; +#endif /* HAVE_SMEM */ +}; +#endif /* vio_violite_h_ */ diff --git a/externals/mysql/waiting_threads.h b/externals/mysql/waiting_threads.h new file mode 100644 index 0000000..1e58052 --- /dev/null +++ b/externals/mysql/waiting_threads.h @@ -0,0 +1,130 @@ +/* Copyright (C) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. + + 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; version 2 of the License. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef _waiting_threads_h +#define _waiting_threads_h + +#include +#include + +#include + +C_MODE_START + +typedef struct st_wt_resource_id WT_RESOURCE_ID; +typedef struct st_wt_resource WT_RESOURCE; + +typedef struct st_wt_resource_type { + my_bool (*compare)(const void *a, const void *b); + const void *(*make_key)(const WT_RESOURCE_ID *id, uint *len); /* not used */ +} WT_RESOURCE_TYPE; + +struct st_wt_resource_id { + ulonglong value; + const WT_RESOURCE_TYPE *type; +}; +/* the below differs from sizeof(WT_RESOURCE_ID) by the amount of padding */ +#define sizeof_WT_RESOURCE_ID (sizeof(ulonglong)+sizeof(void*)) + +#define WT_WAIT_STATS 24 +#define WT_CYCLE_STATS 32 +extern ulonglong wt_wait_table[WT_WAIT_STATS]; +extern uint32 wt_wait_stats[WT_WAIT_STATS+1]; +extern uint32 wt_cycle_stats[2][WT_CYCLE_STATS+1]; +extern uint32 wt_success_stats; + +typedef struct st_wt_thd { + /* + XXX + there's no protection (mutex) against concurrent access of the + dynarray below. it is assumed that a caller will have it anyway + (not to protect this array but to protect its own - caller's - + data structures), and we'll get it for free. A caller needs to + ensure that a blocker won't release a resource before a blocked + thread starts waiting, which is usually done with a mutex. + + If the above assumption is wrong, we'll need to add a mutex here. + */ + DYNAMIC_ARRAY my_resources; + /* + 'waiting_for' is modified under waiting_for->lock, and only by thd itself + 'waiting_for' is read lock-free (using pinning protocol), but a thd object + can read its own 'waiting_for' without any locks or tricks. + */ + WT_RESOURCE *waiting_for; + LF_PINS *pins; + + /* pointers to values */ + const ulong *timeout_short; + const ulong *deadlock_search_depth_short; + const ulong *timeout_long; + const ulong *deadlock_search_depth_long; + + /* + weight relates to the desirability of a transaction being killed if it's + part of a deadlock. In a deadlock situation transactions with lower weights + are killed first. + + Examples of using the weight to implement different selection strategies: + + 1. Latest + Keep all weights equal. + 2. Random + Assight weights at random. + (variant: modify a weight randomly before every lock request) + 3. Youngest + Set weight to -NOW() + 4. Minimum locks + count locks granted in your lock manager, store the value as a weight + 5. Minimum work + depends on the definition of "work". For example, store the number + of rows modifies in this transaction (or a length of REDO log for a + transaction) as a weight. + + It is only statistically relevant and is not protected by any locks. + */ + ulong volatile weight; + /* + 'killed' is indirectly protected by waiting_for->lock because + a killed thread needs to clear its 'waiting_for' and thus needs a lock. + That is a thread needs an exclusive lock to read 'killed' reliably. + But other threads may change 'killed' from 0 to 1, a shared + lock is enough for that. + */ + my_bool killed; +#ifndef DBUG_OFF + const char *name; +#endif +} WT_THD; + +#define WT_TIMEOUT ETIMEDOUT +#define WT_OK 0 +#define WT_DEADLOCK -1 +#define WT_DEPTH_EXCEEDED -2 +#define WT_FREE_TO_GO -3 + +void wt_init(void); +void wt_end(void); +void wt_thd_lazy_init(WT_THD *, const ulong *, const ulong *, const ulong *, const ulong *); +void wt_thd_destroy(WT_THD *); +int wt_thd_will_wait_for(WT_THD *, WT_THD *, const WT_RESOURCE_ID *); +int wt_thd_cond_timedwait(WT_THD *, pthread_mutex_t *); +void wt_thd_release(WT_THD *, const WT_RESOURCE_ID *); +#define wt_thd_release_all(THD) wt_thd_release((THD), 0) +my_bool wt_resource_id_memcmp(const void *, const void *); + +C_MODE_END + +#endif diff --git a/externals/mysql/win/VC90/libmysql.vcproj b/externals/mysql/win/VC90/libmysql.vcproj new file mode 100644 index 0000000..4534e1a --- /dev/null +++ b/externals/mysql/win/VC90/libmysql.vcproj @@ -0,0 +1,11143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/externals/mysql/win/libmysql.sln b/externals/mysql/win/libmysql.sln new file mode 100644 index 0000000..7d0f29b --- /dev/null +++ b/externals/mysql/win/libmysql.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmysql", "VC90\libmysql.vcproj", "{4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Debug|Win32.ActiveCfg = Debug|Win32 + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Debug|Win32.Build.0 = Debug|Win32 + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Debug|x64.ActiveCfg = Debug|x64 + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Debug|x64.Build.0 = Debug|x64 + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Release|Win32.ActiveCfg = Release|Win32 + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Release|Win32.Build.0 = Release|Win32 + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Release|x64.ActiveCfg = Release|x64 + {4FBE4FC1-22DE-41A0-9AEB-CFD00EBAC7E5}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/mysql/wqueue.h b/externals/mysql/wqueue.h new file mode 100644 index 0000000..658f3d6 --- /dev/null +++ b/externals/mysql/wqueue.h @@ -0,0 +1,27 @@ + +#ifndef _wqueue_h +#define _wqueue_h + +#include +#include + +/* info about requests in a waiting queue */ +typedef struct st_pagecache_wqueue +{ + struct st_my_thread_var *last_thread; /* circular list of waiting + threads */ +} WQUEUE; + +#ifdef THREAD +void wqueue_link_into_queue(WQUEUE *wqueue, struct st_my_thread_var *thread); +void wqueue_unlink_from_queue(WQUEUE *wqueue, struct st_my_thread_var *thread); +void wqueue_add_to_queue(WQUEUE *wqueue, struct st_my_thread_var *thread); +void wqueue_add_and_wait(WQUEUE *wqueue, + struct st_my_thread_var *thread, + pthread_mutex_t *lock); +void wqueue_release_queue(WQUEUE *wqueue); +void wqueue_release_one_locktype_from_queue(WQUEUE *wqueue); + +#endif + +#endif diff --git a/externals/openssl/aes.h b/externals/openssl/aes.h new file mode 100644 index 0000000..450f2b4 --- /dev/null +++ b/externals/openssl/aes.h @@ -0,0 +1,148 @@ +/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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 HEADER_AES_H +#define HEADER_AES_H + +#include + +#ifdef OPENSSL_NO_AES +#error AES is disabled. +#endif + +#define AES_ENCRYPT 1 +#define AES_DECRYPT 0 + +/* Because array size can't be a const in C, the following two are macros. + Both sizes are in bytes. */ +#define AES_MAXNR 14 +#define AES_BLOCK_SIZE 16 + +#ifdef OPENSSL_FIPS +#define FIPS_AES_SIZE_T int +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* This should be a hidden type, but EVP requires that the size be known */ +struct aes_key_st { +#ifdef AES_LONG + unsigned long rd_key[4 *(AES_MAXNR + 1)]; +#else + unsigned int rd_key[4 *(AES_MAXNR + 1)]; +#endif + int rounds; +}; +typedef struct aes_key_st AES_KEY; + +const char *AES_options(void); + +int AES_set_encrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); +int AES_set_decrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); + +void AES_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); +void AES_decrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); + +void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key, const int enc); +void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, const int enc); +void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, + const int nbits,const AES_KEY *key, + unsigned char *ivec,const int enc); +void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num); +void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + unsigned char ivec[AES_BLOCK_SIZE], + unsigned char ecount_buf[AES_BLOCK_SIZE], + unsigned int *num); + +/* For IGE, see also http://www.links.org/files/openssl-ige.pdf */ +/* NB: the IV is _two_ blocks long */ +void AES_ige_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, const int enc); +/* NB: the IV is _four_ blocks long */ +void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, + const unsigned long length, const AES_KEY *key, + const AES_KEY *key2, const unsigned char *ivec, + const int enc); + +int AES_wrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); +int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); + +#ifdef __cplusplus +} +#endif + +#endif /* !HEADER_AES_H */ diff --git a/externals/openssl/asn1.h b/externals/openssl/asn1.h new file mode 100644 index 0000000..e338522 --- /dev/null +++ b/externals/openssl/asn1.h @@ -0,0 +1,1329 @@ +/* crypto/asn1/asn1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_H +#define HEADER_ASN1_H + +#include +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#include + +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define V_ASN1_UNIVERSAL 0x00 +#define V_ASN1_APPLICATION 0x40 +#define V_ASN1_CONTEXT_SPECIFIC 0x80 +#define V_ASN1_PRIVATE 0xc0 + +#define V_ASN1_CONSTRUCTED 0x20 +#define V_ASN1_PRIMITIVE_TAG 0x1f +#define V_ASN1_PRIMATIVE_TAG 0x1f + +#define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ +#define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ +#define V_ASN1_ANY -4 /* used in ASN1 template code */ + +#define V_ASN1_NEG 0x100 /* negative flag */ + +#define V_ASN1_UNDEF -1 +#define V_ASN1_EOC 0 +#define V_ASN1_BOOLEAN 1 /**/ +#define V_ASN1_INTEGER 2 +#define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +#define V_ASN1_BIT_STRING 3 +#define V_ASN1_OCTET_STRING 4 +#define V_ASN1_NULL 5 +#define V_ASN1_OBJECT 6 +#define V_ASN1_OBJECT_DESCRIPTOR 7 +#define V_ASN1_EXTERNAL 8 +#define V_ASN1_REAL 9 +#define V_ASN1_ENUMERATED 10 +#define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) +#define V_ASN1_UTF8STRING 12 +#define V_ASN1_SEQUENCE 16 +#define V_ASN1_SET 17 +#define V_ASN1_NUMERICSTRING 18 /**/ +#define V_ASN1_PRINTABLESTRING 19 +#define V_ASN1_T61STRING 20 +#define V_ASN1_TELETEXSTRING 20 /* alias */ +#define V_ASN1_VIDEOTEXSTRING 21 /**/ +#define V_ASN1_IA5STRING 22 +#define V_ASN1_UTCTIME 23 +#define V_ASN1_GENERALIZEDTIME 24 /**/ +#define V_ASN1_GRAPHICSTRING 25 /**/ +#define V_ASN1_ISO64STRING 26 /**/ +#define V_ASN1_VISIBLESTRING 26 /* alias */ +#define V_ASN1_GENERALSTRING 27 /**/ +#define V_ASN1_UNIVERSALSTRING 28 /**/ +#define V_ASN1_BMPSTRING 30 + +/* For use with d2i_ASN1_type_bytes() */ +#define B_ASN1_NUMERICSTRING 0x0001 +#define B_ASN1_PRINTABLESTRING 0x0002 +#define B_ASN1_T61STRING 0x0004 +#define B_ASN1_TELETEXSTRING 0x0004 +#define B_ASN1_VIDEOTEXSTRING 0x0008 +#define B_ASN1_IA5STRING 0x0010 +#define B_ASN1_GRAPHICSTRING 0x0020 +#define B_ASN1_ISO64STRING 0x0040 +#define B_ASN1_VISIBLESTRING 0x0040 +#define B_ASN1_GENERALSTRING 0x0080 +#define B_ASN1_UNIVERSALSTRING 0x0100 +#define B_ASN1_OCTET_STRING 0x0200 +#define B_ASN1_BIT_STRING 0x0400 +#define B_ASN1_BMPSTRING 0x0800 +#define B_ASN1_UNKNOWN 0x1000 +#define B_ASN1_UTF8STRING 0x2000 +#define B_ASN1_UTCTIME 0x4000 +#define B_ASN1_GENERALIZEDTIME 0x8000 +#define B_ASN1_SEQUENCE 0x10000 + +/* For use with ASN1_mbstring_copy() */ +#define MBSTRING_FLAG 0x1000 +#define MBSTRING_UTF8 (MBSTRING_FLAG) +#define MBSTRING_ASC (MBSTRING_FLAG|1) +#define MBSTRING_BMP (MBSTRING_FLAG|2) +#define MBSTRING_UNIV (MBSTRING_FLAG|4) + +#define SMIME_OLDMIME 0x400 +#define SMIME_CRLFEOL 0x800 +#define SMIME_STREAM 0x1000 + +struct X509_algor_st; +DECLARE_STACK_OF(X509_ALGOR) + +#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ +#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ + +/* We MUST make sure that, except for constness, asn1_ctx_st and + asn1_const_ctx are exactly the same. Fortunately, as soon as + the old ASN1 parsing macros are gone, we can throw this away + as well... */ +typedef struct asn1_ctx_st + { + unsigned char *p;/* work char pointer */ + int eos; /* end of sequence read for indefinite encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + unsigned char *max; /* largest value of p allowed */ + unsigned char *q;/* temporary variable */ + unsigned char **pp;/* variable */ + int line; /* used in error processing */ + } ASN1_CTX; + +typedef struct asn1_const_ctx_st + { + const unsigned char *p;/* work char pointer */ + int eos; /* end of sequence read for indefinite encoding */ + int error; /* error code to use when returning an error */ + int inf; /* constructed if 0x20, indefinite is 0x21 */ + int tag; /* tag from last 'get object' */ + int xclass; /* class from last 'get object' */ + long slen; /* length of last 'get object' */ + const unsigned char *max; /* largest value of p allowed */ + const unsigned char *q;/* temporary variable */ + const unsigned char **pp;/* variable */ + int line; /* used in error processing */ + } ASN1_const_CTX; + +/* These are used internally in the ASN1_OBJECT to keep track of + * whether the names and data need to be free()ed */ +#define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ +#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ +#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ +#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ +typedef struct asn1_object_st + { + const char *sn,*ln; + int nid; + int length; + unsigned char *data; + int flags; /* Should we free this one */ + } ASN1_OBJECT; + +#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ +/* This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should + * be inserted in the memory buffer + */ +#define ASN1_STRING_FLAG_NDEF 0x010 + +/* This flag is used by the CMS code to indicate that a string is not + * complete and is a place holder for content when it had all been + * accessed. The flag will be reset when content has been written to it. + */ +#define ASN1_STRING_FLAG_CONT 0x020 + +/* This is the base type that holds just about everything :-) */ +typedef struct asn1_string_st + { + int length; + int type; + unsigned char *data; + /* The value of the following field depends on the type being + * held. It is mostly being used for BIT_STRING so if the + * input data has a non-zero 'unused bits' value, it will be + * handled correctly */ + long flags; + } ASN1_STRING; + +/* ASN1_ENCODING structure: this is used to save the received + * encoding of an ASN1 type. This is useful to get round + * problems with invalid encodings which can break signatures. + */ + +typedef struct ASN1_ENCODING_st + { + unsigned char *enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ + } ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +#define ASN1_LONG_UNDEF 0x7fffffffL + +#define STABLE_FLAGS_MALLOC 0x01 +#define STABLE_NO_MASK 0x02 +#define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) +#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) + +typedef struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +} ASN1_STRING_TABLE; + +DECLARE_STACK_OF(ASN1_STRING_TABLE) + +/* size limits: this stuff is taken straight from RFC2459 */ + +#define ub_name 32768 +#define ub_common_name 64 +#define ub_locality_name 128 +#define ub_state_name 128 +#define ub_organization_name 64 +#define ub_organization_unit_name 64 +#define ub_title 64 +#define ub_email_address 128 + +/* Declarations for template structures: for full definitions + * see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro in in asn1t.h */ + +#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) + +#define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) + +#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(itname) + +#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(const type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(name) + +#define DECLARE_ASN1_NDEF_FUNCTION(name) \ + int i2d_##name##_NDEF(name *a, unsigned char **out); + +#define DECLARE_ASN1_FUNCTIONS_const(name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) + +#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + type *name##_new(void); \ + void name##_free(type *a); + +#define D2I_OF(type) type *(*)(type **,const unsigned char **,long) +#define I2D_OF(type) int (*)(type *,unsigned char **) +#define I2D_OF_const(type) int (*)(const type *,unsigned char **) + +#define CHECKED_D2I_OF(type, d2i) \ + ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) +#define CHECKED_I2D_OF(type, i2d) \ + ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) +#define CHECKED_NEW_OF(type, xnew) \ + ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) +#define CHECKED_PTR_OF(type, p) \ + ((void*) (1 ? p : (type*)0)) +#define CHECKED_PPTR_OF(type, p) \ + ((void**) (1 ? p : (type**)0)) + +#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) +#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) +#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) + +TYPEDEF_D2I2D_OF(void); + +/* The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM ASN1_ITEM_EXP; + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (&(iptr##_it)) + +#define ASN1_ITEM_rptr(ref) (&(ref##_it)) + +#define DECLARE_ASN1_ITEM(name) \ + OPENSSL_EXTERN const ASN1_ITEM name##_it; + +#else + +/* Platforms that can't easily handle shared global variables are declared + * as functions returning ASN1_ITEM pointers. + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM * ASN1_ITEM_EXP(void); + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +#define ASN1_ITEM_ptr(iptr) (iptr()) + +/* Macro to include ASN1_ITEM pointer from base type */ +#define ASN1_ITEM_ref(iptr) (iptr##_it) + +#define ASN1_ITEM_rptr(ref) (ref##_it()) + +#define DECLARE_ASN1_ITEM(name) \ + const ASN1_ITEM * name##_it(void); + +#endif + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* These determine which characters to escape: + * RFC2253 special characters, control characters and + * MSB set characters + */ + +#define ASN1_STRFLGS_ESC_2253 1 +#define ASN1_STRFLGS_ESC_CTRL 2 +#define ASN1_STRFLGS_ESC_MSB 4 + + +/* This flag determines how we do escaping: normally + * RC2253 backslash only, set this to use backslash and + * quote. + */ + +#define ASN1_STRFLGS_ESC_QUOTE 8 + + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +#define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +#define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +#define CHARTYPE_LAST_ESC_2253 0x40 + +/* NB the internal flags are safely reused below by flags + * handled at the top level. + */ + +/* If this is set we convert all character strings + * to UTF8 first + */ + +#define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* If this is set we don't attempt to interpret content: + * just assume all strings are 1 byte per character. This + * will produce some pretty odd looking output! + */ + +#define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +#define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* This determines which strings to display and which to + * 'dump' (hex dump of content octets or DER encoding). We can + * only dump non character strings or everything. If we + * don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to + * the usual escaping options. + */ + +#define ASN1_STRFLGS_DUMP_ALL 0x80 +#define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* These determine what 'dumping' does, we can dump the + * content octets or the DER encoding: both use the + * RFC2253 #XXXXX notation. + */ + +#define ASN1_STRFLGS_DUMP_DER 0x200 + +/* All the string flags consistent with RFC2253, + * escaping control characters isn't essential in + * RFC2253 but it is advisable anyway. + */ + +#define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ + ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + ASN1_STRFLGS_UTF8_CONVERT | \ + ASN1_STRFLGS_DUMP_UNKNOWN | \ + ASN1_STRFLGS_DUMP_DER) + +DECLARE_STACK_OF(ASN1_INTEGER) +DECLARE_ASN1_SET_OF(ASN1_INTEGER) + +DECLARE_STACK_OF(ASN1_GENERALSTRING) + +typedef struct asn1_type_st + { + int type; + union { + char *ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING * asn1_string; + ASN1_OBJECT * object; + ASN1_INTEGER * integer; + ASN1_ENUMERATED * enumerated; + ASN1_BIT_STRING * bit_string; + ASN1_OCTET_STRING * octet_string; + ASN1_PRINTABLESTRING * printablestring; + ASN1_T61STRING * t61string; + ASN1_IA5STRING * ia5string; + ASN1_GENERALSTRING * generalstring; + ASN1_BMPSTRING * bmpstring; + ASN1_UNIVERSALSTRING * universalstring; + ASN1_UTCTIME * utctime; + ASN1_GENERALIZEDTIME * generalizedtime; + ASN1_VISIBLESTRING * visiblestring; + ASN1_UTF8STRING * utf8string; + /* set and sequence are left complete and still + * contain the set or sequence bytes */ + ASN1_STRING * set; + ASN1_STRING * sequence; + ASN1_VALUE * asn1_value; + } value; + } ASN1_TYPE; + +DECLARE_STACK_OF(ASN1_TYPE) +DECLARE_ASN1_SET_OF(ASN1_TYPE) + +typedef struct asn1_method_st + { + i2d_of_void *i2d; + d2i_of_void *d2i; + void *(*create)(void); + void (*destroy)(void *); + } ASN1_METHOD; + +/* This is used when parsing some Netscape objects */ +typedef struct asn1_header_st + { + ASN1_OCTET_STRING *header; + void *data; + ASN1_METHOD *meth; + } ASN1_HEADER; + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char *lname; + const char *sname; +} BIT_STRING_BITNAME; + + +#define M_ASN1_STRING_length(x) ((x)->length) +#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) +#define M_ASN1_STRING_type(x) ((x)->type) +#define M_ASN1_STRING_data(x) ((x)->data) + +/* Macros for string operations */ +#define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ + ASN1_STRING_type_new(V_ASN1_BIT_STRING) +#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ + ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) +#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) + +#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ + ASN1_STRING_type_new(V_ASN1_INTEGER) +#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) + +#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ + ASN1_STRING_type_new(V_ASN1_ENUMERATED) +#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) + +#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ + ASN1_STRING_type_new(V_ASN1_OCTET_STRING) +#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ + ASN1_STRING_dup((ASN1_STRING *)a) +#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ + (ASN1_STRING *)a,(ASN1_STRING *)b) +#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c) +#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b) +#define M_i2d_ASN1_OCTET_STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ + V_ASN1_UNIVERSAL) + +#define B_ASN1_TIME \ + B_ASN1_UTCTIME | \ + B_ASN1_GENERALIZEDTIME + +#define B_ASN1_PRINTABLE \ + B_ASN1_NUMERICSTRING| \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_T61STRING| \ + B_ASN1_IA5STRING| \ + B_ASN1_BIT_STRING| \ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING|\ + B_ASN1_SEQUENCE|\ + B_ASN1_UNKNOWN + +#define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_TELETEXSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_UTF8STRING + +#define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING| \ + B_ASN1_VISIBLESTRING| \ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING + +#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLE(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_PRINTABLE) + +#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DIRECTORYSTRING(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_DIRECTORYSTRING) + +#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ + pp,a->type,V_ASN1_UNIVERSAL) +#define M_d2i_DISPLAYTEXT(a,pp,l) \ + d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \ + B_ASN1_DISPLAYTEXT) + +#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\ + ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) +#define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \ + (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING) + +#define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\ + ASN1_STRING_type_new(V_ASN1_T61STRING) +#define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_T61STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_T61STRING(a,pp,l) \ + (ASN1_T61STRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING) + +#define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\ + ASN1_STRING_type_new(V_ASN1_IA5STRING) +#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_IA5STRING_dup(a) \ + (ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a) +#define M_i2d_ASN1_IA5STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_IA5STRING(a,pp,l) \ + (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\ + B_ASN1_IA5STRING) + +#define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\ + ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a) + +#define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\ + ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) +#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\ + (ASN1_STRING *)a) + +#define M_ASN1_TIME_new() (ASN1_TIME *)\ + ASN1_STRING_type_new(V_ASN1_UTCTIME) +#define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a) + +#define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\ + ASN1_STRING_type_new(V_ASN1_GENERALSTRING) +#define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_GENERALSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_GENERALSTRING(a,pp,l) \ + (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING) + +#define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\ + ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) +#define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \ + (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING) + +#define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\ + ASN1_STRING_type_new(V_ASN1_BMPSTRING) +#define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_BMPSTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_BMPSTRING(a,pp,l) \ + (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING) + +#define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\ + ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) +#define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_VISIBLESTRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \ + (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING) + +#define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\ + ASN1_STRING_type_new(V_ASN1_UTF8STRING) +#define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) +#define M_i2d_ASN1_UTF8STRING(a,pp) \ + i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\ + V_ASN1_UNIVERSAL) +#define M_d2i_ASN1_UTF8STRING(a,pp,l) \ + (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ + ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) + + /* for the is_set parameter to i2d_ASN1_SET */ +#define IS_SEQUENCE 0 +#define IS_SET 1 + +DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + +int ASN1_TYPE_get(ASN1_TYPE *a); +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); +int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); + +ASN1_OBJECT * ASN1_OBJECT_new(void ); +void ASN1_OBJECT_free(ASN1_OBJECT *a); +int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); +ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, + long length); +ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, + long length); + +DECLARE_ASN1_ITEM(ASN1_OBJECT) + +DECLARE_STACK_OF(ASN1_OBJECT) +DECLARE_ASN1_SET_OF(ASN1_OBJECT) + +ASN1_STRING * ASN1_STRING_new(void); +void ASN1_STRING_free(ASN1_STRING *a); +ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a); +ASN1_STRING * ASN1_STRING_type_new(int type ); +int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b); + /* Since this is used to store all sorts of things, via macros, for now, make + its data void * */ +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); +int ASN1_STRING_length(ASN1_STRING *x); +void ASN1_STRING_length_set(ASN1_STRING *x, int n); +int ASN1_STRING_type(ASN1_STRING *x); +unsigned char * ASN1_STRING_data(ASN1_STRING *x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); +ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, + long length); +int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, + int length ); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); + +#ifndef OPENSSL_NO_BIO +int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, + BIT_STRING_BITNAME *tbl, int indent); +#endif +int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); +int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, + BIT_STRING_BITNAME *tbl); + +int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); +int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); +ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, + long length); +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, + long length); +ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x); +int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +int ASN1_UTCTIME_check(ASN1_UTCTIME *a); +ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); +#if 0 +time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s); +#endif + +int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a); +int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b); +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +int UTF8_putc(unsigned char *str, int len, unsigned long value); + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) +DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); +int ASN1_TIME_check(ASN1_TIME *t); +ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); + +int i2d_ASN1_SET(STACK *a, unsigned char **pp, + i2d_of_void *i2d, int ex_tag, int ex_class, int is_set); +STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length, + d2i_of_void *d2i, void (*free_func)(void *), + int ex_tag, int ex_class); + +#ifndef OPENSSL_NO_BIO +int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); +int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); +int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); +int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); +int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); +int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); +int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); +#endif +int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); + +int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, + const char *sn, const char *ln); + +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +long ASN1_INTEGER_get(ASN1_INTEGER *a); +ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai); +BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn); + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); +BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +int ASN1_PRINTABLE_type(const unsigned char *s, int max); + +int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); +ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, + long length, int Ptag, int Pclass); +unsigned long ASN1_tag2bit(int tag); +/* type is one or more of the B_ASN1_ values. */ +ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, + long length,int type); + +/* PARSING */ +int asn1_Finish(ASN1_CTX *c); +int asn1_const_Finish(ASN1_const_CTX *c); + +/* SPECIALS */ +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p,long len); +int ASN1_const_check_infinite_end(const unsigned char **p,long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int xclass); +int ASN1_put_eoc(unsigned char **pp); +int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); + +#define ASN1_dup_of(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(type, x))) + +#define ASN1_dup_of_const(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(const type, x))) + +void *ASN1_item_dup(const ASN1_ITEM *it, void *x); + +/* ASN1 alloc/free macros for when a type is only used internally */ + +#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) +#define M_ASN1_free_of(x, type) \ + ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) + +#ifndef OPENSSL_NO_FP_API +void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); + +#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); +int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x); + +#define ASN1_i2d_fp_of(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +#define ASN1_i2d_fp_of_const(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); +int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); +#endif + +int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); + +#ifndef OPENSSL_NO_BIO +void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x); + +#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); +int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); + +#define ASN1_i2d_bio_of(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +#define ASN1_i2d_bio_of_const(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); +int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); +int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); +int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); +int ASN1_STRING_print(BIO *bp,ASN1_STRING *v); +int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); +int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); +int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); +#endif +const char *ASN1_tag2str(int tag); + +/* Used to load and write netscape format cert/key */ +int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp); +ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length); +ASN1_HEADER *ASN1_HEADER_new(void ); +void ASN1_HEADER_free(ASN1_HEADER *a); + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); + +/* Not used that much at this point, except for the first two */ +ASN1_METHOD *X509_asn1_meth(void); +ASN1_METHOD *RSAPrivateKey_asn1_meth(void); +ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void); +ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void); + +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, + unsigned char *data, int len); +int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, + unsigned char *data, int max_len); +int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, + unsigned char *data, int len); +int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, + unsigned char *data, int max_len); + +STACK *ASN1_seq_unpack(const unsigned char *buf, int len, + d2i_of_void *d2i, void (*free_func)(void *)); +unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d, + unsigned char **buf, int *len ); +void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); +void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); +ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, + ASN1_OCTET_STRING **oct); + +#define ASN1_pack_string_of(type,obj,i2d,oct) \ + (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \ + CHECKED_I2D_OF(type, i2d), \ + oct)) + +ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); + +void ASN1_STRING_set_default_mask(unsigned long mask); +int ASN1_STRING_set_default_mask_asc(char *p); +unsigned long ASN1_STRING_get_default_mask(void); +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask); +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask, + long minsize, long maxsize); + +ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, + const unsigned char *in, int inlen, int inform, int nid); +ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); +int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); +void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); +ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); +int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); +int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); + +void ASN1_add_oid_module(void); + +ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); +ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); + +typedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int flags, + const ASN1_ITEM *it); + +int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, + int ctype_nid, int econt_nid, + STACK_OF(X509_ALGOR) *mdalgs, + asn1_output_data_fn *data_fn, + const ASN1_ITEM *it); +ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ASN1_strings(void); + +/* Error codes for the ASN1 functions. */ + +/* Function codes. */ +#define ASN1_F_A2D_ASN1_OBJECT 100 +#define ASN1_F_A2I_ASN1_ENUMERATED 101 +#define ASN1_F_A2I_ASN1_INTEGER 102 +#define ASN1_F_A2I_ASN1_STRING 103 +#define ASN1_F_APPEND_EXP 176 +#define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 +#define ASN1_F_ASN1_CB 177 +#define ASN1_F_ASN1_CHECK_TLEN 104 +#define ASN1_F_ASN1_COLLATE_PRIMITIVE 105 +#define ASN1_F_ASN1_COLLECT 106 +#define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 +#define ASN1_F_ASN1_D2I_FP 109 +#define ASN1_F_ASN1_D2I_READ_BIO 107 +#define ASN1_F_ASN1_DIGEST 184 +#define ASN1_F_ASN1_DO_ADB 110 +#define ASN1_F_ASN1_DUP 111 +#define ASN1_F_ASN1_ENUMERATED_SET 112 +#define ASN1_F_ASN1_ENUMERATED_TO_BN 113 +#define ASN1_F_ASN1_EX_C2I 204 +#define ASN1_F_ASN1_FIND_END 190 +#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185 +#define ASN1_F_ASN1_GENERATE_V3 178 +#define ASN1_F_ASN1_GET_OBJECT 114 +#define ASN1_F_ASN1_HEADER_NEW 115 +#define ASN1_F_ASN1_I2D_BIO 116 +#define ASN1_F_ASN1_I2D_FP 117 +#define ASN1_F_ASN1_INTEGER_SET 118 +#define ASN1_F_ASN1_INTEGER_TO_BN 119 +#define ASN1_F_ASN1_ITEM_D2I_FP 206 +#define ASN1_F_ASN1_ITEM_DUP 191 +#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121 +#define ASN1_F_ASN1_ITEM_EX_D2I 120 +#define ASN1_F_ASN1_ITEM_I2D_BIO 192 +#define ASN1_F_ASN1_ITEM_I2D_FP 193 +#define ASN1_F_ASN1_ITEM_PACK 198 +#define ASN1_F_ASN1_ITEM_SIGN 195 +#define ASN1_F_ASN1_ITEM_UNPACK 199 +#define ASN1_F_ASN1_ITEM_VERIFY 197 +#define ASN1_F_ASN1_MBSTRING_NCOPY 122 +#define ASN1_F_ASN1_OBJECT_NEW 123 +#define ASN1_F_ASN1_OUTPUT_DATA 207 +#define ASN1_F_ASN1_PACK_STRING 124 +#define ASN1_F_ASN1_PCTX_NEW 205 +#define ASN1_F_ASN1_PKCS5_PBE_SET 125 +#define ASN1_F_ASN1_SEQ_PACK 126 +#define ASN1_F_ASN1_SEQ_UNPACK 127 +#define ASN1_F_ASN1_SIGN 128 +#define ASN1_F_ASN1_STR2TYPE 179 +#define ASN1_F_ASN1_STRING_SET 186 +#define ASN1_F_ASN1_STRING_TABLE_ADD 129 +#define ASN1_F_ASN1_STRING_TYPE_NEW 130 +#define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 +#define ASN1_F_ASN1_TEMPLATE_NEW 133 +#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 +#define ASN1_F_ASN1_TIME_SET 175 +#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 +#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 +#define ASN1_F_ASN1_UNPACK_STRING 136 +#define ASN1_F_ASN1_UTCTIME_SET 187 +#define ASN1_F_ASN1_VERIFY 137 +#define ASN1_F_B64_READ_ASN1 208 +#define ASN1_F_B64_WRITE_ASN1 209 +#define ASN1_F_BITSTR_CB 180 +#define ASN1_F_BN_TO_ASN1_ENUMERATED 138 +#define ASN1_F_BN_TO_ASN1_INTEGER 139 +#define ASN1_F_C2I_ASN1_BIT_STRING 189 +#define ASN1_F_C2I_ASN1_INTEGER 194 +#define ASN1_F_C2I_ASN1_OBJECT 196 +#define ASN1_F_COLLECT_DATA 140 +#define ASN1_F_D2I_ASN1_BIT_STRING 141 +#define ASN1_F_D2I_ASN1_BOOLEAN 142 +#define ASN1_F_D2I_ASN1_BYTES 143 +#define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144 +#define ASN1_F_D2I_ASN1_HEADER 145 +#define ASN1_F_D2I_ASN1_INTEGER 146 +#define ASN1_F_D2I_ASN1_OBJECT 147 +#define ASN1_F_D2I_ASN1_SET 148 +#define ASN1_F_D2I_ASN1_TYPE_BYTES 149 +#define ASN1_F_D2I_ASN1_UINTEGER 150 +#define ASN1_F_D2I_ASN1_UTCTIME 151 +#define ASN1_F_D2I_NETSCAPE_RSA 152 +#define ASN1_F_D2I_NETSCAPE_RSA_2 153 +#define ASN1_F_D2I_PRIVATEKEY 154 +#define ASN1_F_D2I_PUBLICKEY 155 +#define ASN1_F_D2I_RSA_NET 200 +#define ASN1_F_D2I_RSA_NET_2 201 +#define ASN1_F_D2I_X509 156 +#define ASN1_F_D2I_X509_CINF 157 +#define ASN1_F_D2I_X509_PKEY 159 +#define ASN1_F_I2D_ASN1_SET 188 +#define ASN1_F_I2D_ASN1_TIME 160 +#define ASN1_F_I2D_DSA_PUBKEY 161 +#define ASN1_F_I2D_EC_PUBKEY 181 +#define ASN1_F_I2D_PRIVATEKEY 163 +#define ASN1_F_I2D_PUBLICKEY 164 +#define ASN1_F_I2D_RSA_NET 162 +#define ASN1_F_I2D_RSA_PUBKEY 165 +#define ASN1_F_LONG_C2I 166 +#define ASN1_F_OID_MODULE_INIT 174 +#define ASN1_F_PARSE_TAGGING 182 +#define ASN1_F_PKCS5_PBE2_SET 167 +#define ASN1_F_PKCS5_PBE_SET 202 +#define ASN1_F_SMIME_READ_ASN1 210 +#define ASN1_F_SMIME_TEXT 211 +#define ASN1_F_X509_CINF_NEW 168 +#define ASN1_F_X509_CRL_ADD0_REVOKED 169 +#define ASN1_F_X509_INFO_NEW 170 +#define ASN1_F_X509_NAME_ENCODE 203 +#define ASN1_F_X509_NAME_EX_D2I 158 +#define ASN1_F_X509_NAME_EX_NEW 171 +#define ASN1_F_X509_NEW 172 +#define ASN1_F_X509_PKEY_NEW 173 + +/* Reason codes. */ +#define ASN1_R_ADDING_OBJECT 171 +#define ASN1_R_ASN1_PARSE_ERROR 198 +#define ASN1_R_ASN1_SIG_PARSE_ERROR 199 +#define ASN1_R_AUX_ERROR 100 +#define ASN1_R_BAD_CLASS 101 +#define ASN1_R_BAD_OBJECT_HEADER 102 +#define ASN1_R_BAD_PASSWORD_READ 103 +#define ASN1_R_BAD_TAG 104 +#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 210 +#define ASN1_R_BN_LIB 105 +#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +#define ASN1_R_BUFFER_TOO_SMALL 107 +#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 +#define ASN1_R_DATA_IS_WRONG 109 +#define ASN1_R_DECODE_ERROR 110 +#define ASN1_R_DECODING_ERROR 111 +#define ASN1_R_DEPTH_EXCEEDED 174 +#define ASN1_R_ENCODE_ERROR 112 +#define ASN1_R_ERROR_GETTING_TIME 173 +#define ASN1_R_ERROR_LOADING_SECTION 172 +#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113 +#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 +#define ASN1_R_EXPECTING_AN_INTEGER 115 +#define ASN1_R_EXPECTING_AN_OBJECT 116 +#define ASN1_R_EXPECTING_A_BOOLEAN 117 +#define ASN1_R_EXPECTING_A_TIME 118 +#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 +#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 +#define ASN1_R_FIELD_MISSING 121 +#define ASN1_R_FIRST_NUM_TOO_LARGE 122 +#define ASN1_R_HEADER_TOO_LONG 123 +#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 +#define ASN1_R_ILLEGAL_BOOLEAN 176 +#define ASN1_R_ILLEGAL_CHARACTERS 124 +#define ASN1_R_ILLEGAL_FORMAT 177 +#define ASN1_R_ILLEGAL_HEX 178 +#define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 +#define ASN1_R_ILLEGAL_INTEGER 180 +#define ASN1_R_ILLEGAL_NESTED_TAGGING 181 +#define ASN1_R_ILLEGAL_NULL 125 +#define ASN1_R_ILLEGAL_NULL_VALUE 182 +#define ASN1_R_ILLEGAL_OBJECT 183 +#define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 +#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 +#define ASN1_R_ILLEGAL_TAGGED_ANY 127 +#define ASN1_R_ILLEGAL_TIME_VALUE 184 +#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 +#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 +#define ASN1_R_INVALID_BMPSTRING_LENGTH 129 +#define ASN1_R_INVALID_DIGIT 130 +#define ASN1_R_INVALID_MIME_TYPE 200 +#define ASN1_R_INVALID_MODIFIER 186 +#define ASN1_R_INVALID_NUMBER 187 +#define ASN1_R_INVALID_SEPARATOR 131 +#define ASN1_R_INVALID_TIME_FORMAT 132 +#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 +#define ASN1_R_INVALID_UTF8STRING 134 +#define ASN1_R_IV_TOO_LARGE 135 +#define ASN1_R_LENGTH_ERROR 136 +#define ASN1_R_LIST_ERROR 188 +#define ASN1_R_MIME_NO_CONTENT_TYPE 201 +#define ASN1_R_MIME_PARSE_ERROR 202 +#define ASN1_R_MIME_SIG_PARSE_ERROR 203 +#define ASN1_R_MISSING_EOC 137 +#define ASN1_R_MISSING_SECOND_NUMBER 138 +#define ASN1_R_MISSING_VALUE 189 +#define ASN1_R_MSTRING_NOT_UNIVERSAL 139 +#define ASN1_R_MSTRING_WRONG_TAG 140 +#define ASN1_R_NESTED_ASN1_STRING 197 +#define ASN1_R_NON_HEX_CHARACTERS 141 +#define ASN1_R_NOT_ASCII_FORMAT 190 +#define ASN1_R_NOT_ENOUGH_DATA 142 +#define ASN1_R_NO_CONTENT_TYPE 204 +#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 +#define ASN1_R_NO_MULTIPART_BODY_FAILURE 205 +#define ASN1_R_NO_MULTIPART_BOUNDARY 206 +#define ASN1_R_NO_SIG_CONTENT_TYPE 207 +#define ASN1_R_NULL_IS_WRONG_LENGTH 144 +#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 +#define ASN1_R_ODD_NUMBER_OF_CHARS 145 +#define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146 +#define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 +#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 +#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 +#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 +#define ASN1_R_SHORT_LINE 150 +#define ASN1_R_SIG_INVALID_MIME_TYPE 208 +#define ASN1_R_STREAMING_NOT_SUPPORTED 209 +#define ASN1_R_STRING_TOO_LONG 151 +#define ASN1_R_STRING_TOO_SHORT 152 +#define ASN1_R_TAG_VALUE_TOO_HIGH 153 +#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 +#define ASN1_R_TIME_NOT_ASCII_FORMAT 193 +#define ASN1_R_TOO_LONG 155 +#define ASN1_R_TYPE_NOT_CONSTRUCTED 156 +#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157 +#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158 +#define ASN1_R_UNEXPECTED_EOC 159 +#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 211 +#define ASN1_R_UNKNOWN_FORMAT 160 +#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 +#define ASN1_R_UNKNOWN_OBJECT_TYPE 162 +#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 +#define ASN1_R_UNKNOWN_TAG 194 +#define ASN1_R_UNKOWN_FORMAT 195 +#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 +#define ASN1_R_UNSUPPORTED_CIPHER 165 +#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166 +#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 +#define ASN1_R_UNSUPPORTED_TYPE 196 +#define ASN1_R_WRONG_TAG 168 +#define ASN1_R_WRONG_TYPE 169 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/asn1_mac.h b/externals/openssl/asn1_mac.h new file mode 100644 index 0000000..c7b79ec --- /dev/null +++ b/externals/openssl/asn1_mac.h @@ -0,0 +1,572 @@ +/* crypto/asn1/asn1_mac.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ASN1_MAC_H +#define HEADER_ASN1_MAC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ASN1_MAC_ERR_LIB +#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 +#endif + +#define ASN1_MAC_H_err(f,r,line) \ + ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) + +#define M_ASN1_D2I_vars(a,type,func) \ + ASN1_const_CTX c; \ + type ret=NULL; \ + \ + c.pp=(const unsigned char **)pp; \ + c.q= *(const unsigned char **)pp; \ + c.error=ERR_R_NESTED_ASN1_ERROR; \ + if ((a == NULL) || ((*a) == NULL)) \ + { if ((ret=(type)func()) == NULL) \ + { c.line=__LINE__; goto err; } } \ + else ret=(*a); + +#define M_ASN1_D2I_Init() \ + c.p= *(const unsigned char **)pp; \ + c.max=(length == 0)?0:(c.p+length); + +#define M_ASN1_D2I_Finish_2(a) \ + if (!asn1_const_Finish(&c)) \ + { c.line=__LINE__; goto err; } \ + *(const unsigned char **)pp=c.p; \ + if (a != NULL) (*a)=ret; \ + return(ret); + +#define M_ASN1_D2I_Finish(a,func,e) \ + M_ASN1_D2I_Finish_2(a); \ +err:\ + ASN1_MAC_H_err((e),c.error,c.line); \ + asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \ + if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ + return(NULL) + +#define M_ASN1_D2I_start_sequence() \ + if (!asn1_GetSequence(&c,&length)) \ + { c.line=__LINE__; goto err; } +/* Begin reading ASN1 without a surrounding sequence */ +#define M_ASN1_D2I_begin() \ + c.slen = length; + +/* End reading ASN1 with no check on length */ +#define M_ASN1_D2I_Finish_nolen(a, func, e) \ + *pp=c.p; \ + if (a != NULL) (*a)=ret; \ + return(ret); \ +err:\ + ASN1_MAC_H_err((e),c.error,c.line); \ + asn1_add_error(*pp,(int)(c.q- *pp)); \ + if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \ + return(NULL) + +#define M_ASN1_D2I_end_sequence() \ + (((c.inf&1) == 0)?(c.slen <= 0): \ + (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen))) + +/* Don't use this with d2i_ASN1_BOOLEAN() */ +#define M_ASN1_D2I_get(b, func) \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +/* Don't use this with d2i_ASN1_BOOLEAN() */ +#define M_ASN1_D2I_get_x(type,b,func) \ + c.q=c.p; \ + if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +/* use this instead () */ +#define M_ASN1_D2I_get_int(b,func) \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) < 0) \ + {c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_opt(b,func,type) \ + if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \ + == (V_ASN1_UNIVERSAL|(type)))) \ + { \ + M_ASN1_D2I_get(b,func); \ + } + +#define M_ASN1_D2I_get_imp(b,func, type) \ + M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) == NULL) \ + {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \ + c.slen-=(c.p-c.q);\ + M_ASN1_next_prev=_tmp; + +#define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \ + if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \ + (V_ASN1_CONTEXT_SPECIFIC|(tag)))) \ + { \ + unsigned char _tmp = M_ASN1_next; \ + M_ASN1_D2I_get_imp(b,func, type);\ + } + +#define M_ASN1_D2I_get_set(r,func,free_func) \ + M_ASN1_D2I_get_imp_set(r,func,free_func, \ + V_ASN1_SET,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_type(type,r,func,free_func) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \ + V_ASN1_SET,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_set_opt(r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ + { M_ASN1_D2I_get_set(r,func,free_func); } + +#define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SET)))\ + { M_ASN1_D2I_get_set_type(type,r,func,free_func); } + +#define M_ASN1_I2D_len_SET_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_len_SET(a,f); + +#define M_ASN1_I2D_put_SET_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SET(a,f); + +#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a,f); + +#define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE_type(type,a,f); + +#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \ + if ((c.slen != 0) && \ + (M_ASN1_next == \ + (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ + { \ + M_ASN1_D2I_get_imp_set(b,func,free_func,\ + tag,V_ASN1_CONTEXT_SPECIFIC); \ + } + +#define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \ + if ((c.slen != 0) && \ + (M_ASN1_next == \ + (V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\ + { \ + M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\ + tag,V_ASN1_CONTEXT_SPECIFIC); \ + } + +#define M_ASN1_D2I_get_seq(r,func,free_func) \ + M_ASN1_D2I_get_imp_set(r,func,free_func,\ + V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); + +#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ + V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL) + +#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ + { M_ASN1_D2I_get_seq(r,func,free_func); } + +#define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \ + if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \ + V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\ + { M_ASN1_D2I_get_seq_type(type,r,func,free_func); } + +#define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \ + M_ASN1_D2I_get_imp_set(r,func,free_func,\ + x,V_ASN1_CONTEXT_SPECIFIC); + +#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \ + M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\ + x,V_ASN1_CONTEXT_SPECIFIC); + +#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\ + (void (*)())free_func,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\ + free_func,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_set_strings(r,func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \ + { c.line=__LINE__; goto err; } \ + c.slen-=(c.p-c.q); + +#define M_ASN1_D2I_get_EXP_opt(r,func,tag) \ + if ((c.slen != 0L) && (M_ASN1_next == \ + (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ + { \ + int Tinf,Ttag,Tclass; \ + long Tlen; \ + \ + c.q=c.p; \ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (func(&(r),&c.p,Tlen) == NULL) \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } + +#define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \ + if ((c.slen != 0) && (M_ASN1_next == \ + (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ + { \ + int Tinf,Ttag,Tclass; \ + long Tlen; \ + \ + c.q=c.p; \ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \ + (void (*)())free_func, \ + b,V_ASN1_UNIVERSAL) == NULL) \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } + +#define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \ + if ((c.slen != 0) && (M_ASN1_next == \ + (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ + { \ + int Tinf,Ttag,Tclass; \ + long Tlen; \ + \ + c.q=c.p; \ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ + c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \ + free_func,b,V_ASN1_UNIVERSAL) == NULL) \ + { c.line=__LINE__; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ + c.line=__LINE__; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } + +/* New macros */ +#define M_ASN1_New_Malloc(ret,type) \ + if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \ + { c.line=__LINE__; goto err2; } + +#define M_ASN1_New(arg,func) \ + if (((arg)=func()) == NULL) return(NULL) + +#define M_ASN1_New_Error(a) \ +/* err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \ + return(NULL);*/ \ + err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \ + return(NULL) + + +/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately, + some macros that use ASN1_const_CTX still insist on writing in the input + stream. ARGH! ARGH! ARGH! Let's get rid of this macro package. + Please? -- Richard Levitte */ +#define M_ASN1_next (*((unsigned char *)(c.p))) +#define M_ASN1_next_prev (*((unsigned char *)(c.q))) + +/*************************************************/ + +#define M_ASN1_I2D_vars(a) int r=0,ret=0; \ + unsigned char *p; \ + if (a == NULL) return(0) + +/* Length Macros */ +#define M_ASN1_I2D_len(a,f) ret+=f(a,NULL) +#define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f) + +#define M_ASN1_I2D_len_SET(a,f) \ + ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET); + +#define M_ASN1_I2D_len_SET_type(type,a,f) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \ + V_ASN1_UNIVERSAL,IS_SET); + +#define M_ASN1_I2D_len_SEQUENCE(a,f) \ + ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \ + V_ASN1_UNIVERSAL,IS_SEQUENCE) + +#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_len_SEQUENCE(a,f); + +#define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + M_ASN1_I2D_len_SEQUENCE_type(type,a,f); + +#define M_ASN1_I2D_len_IMP_SET(a,f,x) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); + +#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC,IS_SET); + +#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); + +#define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \ + if (a != NULL)\ + { \ + v=f(a,NULL); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0))\ + { \ + v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0))\ + { \ + v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0))\ + { \ + v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \ + V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ + ret+=ASN1_object_size(1,v,mtag); \ + } + +/* Put Macros */ +#define M_ASN1_I2D_put(a,f) f(a,&p) + +#define M_ASN1_I2D_put_IMP_opt(a,f,t) \ + if (a != NULL) \ + { \ + unsigned char *q=p; \ + f(a,&p); \ + *q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\ + } + +#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\ + V_ASN1_UNIVERSAL,IS_SET) +#define M_ASN1_I2D_put_SET_type(type,a,f) \ + i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET) +#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ + V_ASN1_CONTEXT_SPECIFIC,IS_SET) +#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \ + i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET) +#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\ + V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\ + V_ASN1_UNIVERSAL,IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \ + i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE) + +#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + M_ASN1_I2D_put_SEQUENCE(a,f); + +#define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); } + +#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SET); } + +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); } + +#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { i2d_ASN1_SET_OF_##type(a,&p,f,x, \ + V_ASN1_CONTEXT_SPECIFIC, \ + IS_SEQUENCE); } + +#define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \ + if (a != NULL) \ + { \ + ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \ + f(a,&p); \ + } + +#define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \ + if ((a != NULL) && (sk_##type##_num(a) != 0)) \ + { \ + ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \ + i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \ + IS_SEQUENCE); \ + } + +#define M_ASN1_I2D_seq_total() \ + r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \ + if (pp == NULL) return(r); \ + p= *pp; \ + ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL) + +#define M_ASN1_I2D_INF_seq_start(tag,ctx) \ + *(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \ + *(p++)=0x80 + +#define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00 + +#define M_ASN1_I2D_finish() *pp=p; \ + return(r); + +int asn1_GetSequence(ASN1_const_CTX *c, long *length); +void asn1_add_error(const unsigned char *address,int offset); +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/externals/openssl/asn1t.h b/externals/openssl/asn1t.h new file mode 100644 index 0000000..ac14f94 --- /dev/null +++ b/externals/openssl/asn1t.h @@ -0,0 +1,893 @@ +/* asn1t.h */ +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ASN1T_H +#define HEADER_ASN1T_H + +#include +#include +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) + + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) \ + OPENSSL_GLOBAL const ASN1_ITEM itname##_it = { + +#define ASN1_ITEM_end(itname) \ + }; + +#else + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr())) + + +/* Macros for start and end of ASN1_ITEM definition */ + +#define ASN1_ITEM_start(itname) \ + const ASN1_ITEM * itname##_it(void) \ + { \ + static const ASN1_ITEM local_it = { + +#define ASN1_ITEM_end(itname) \ + }; \ + return &local_it; \ + } + +#endif + + +/* Macros to aid ASN1 template writing */ + +#define ASN1_ITEM_TEMPLATE(tname) \ + static const ASN1_TEMPLATE tname##_item_tt + +#define ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) + + +/* This is a ASN1 type which just embeds a template */ + +/* This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +#define ASN1_SEQUENCE(tname) \ + static const ASN1_TEMPLATE tname##_seq_tt[] + +#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +#define ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +#define ASN1_NDEF_SEQUENCE(tname) \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ + ASN1_SEQUENCE_cb(tname, cb) + +#define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_BROKEN_SEQUENCE(tname) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_ref(tname, cb, lck) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ + ASN1_SEQUENCE(tname) + +#define ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) + +#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) + +#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +#define ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + + +/* This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +#define ASN1_CHOICE(tname) \ + static const ASN1_TEMPLATE tname##_ch_tt[] + +#define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_CHOICE(tname) + +#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +#define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) + +#define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +#define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ + (flags), (tag), 0,\ + #name, ASN1_ITEM_ref(type) } + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ + (flags), (tag), offsetof(stname, field),\ + #field, ASN1_ITEM_ref(type) } + +/* used when the structure is combined with the parent */ + +#define ASN1_EX_COMBINE(flags, tag, type) { \ + (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) } + +/* implicit and explicit helper macros */ + +#define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type) + +#define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION +#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +#else +#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } +#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } +#endif +/* Plain simple type */ +#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) + +/* OPTIONAL simple type */ +#define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +#define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) + +/* IMPLICIT tagged OPTIONAL simple type */ +#define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* Same as above but EXPLICIT */ + +#define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) +#define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) + +/* SEQUENCE OF type */ +#define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +#define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +#define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +#define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +/* EXPLICIT using indefinite length constructed form */ +#define ASN1_NDEF_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +#define ASN1_ADB(name) \ + static const ASN1_ADB_TABLE name##_adbtbl[] + +#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ + ;\ + static const ASN1_ADB name##_adb = {\ + flags,\ + offsetof(name, field),\ + app_table,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + } + +#else + +#define ASN1_ADB_END(name, flags, field, app_table, def, none) \ + ;\ + static const ASN1_ITEM *name##_adb(void) \ + { \ + static const ASN1_ADB internal_adb = \ + {\ + flags,\ + offsetof(name, field),\ + app_table,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + }; \ + return (const ASN1_ITEM *) &internal_adb; \ + } \ + void dummy_function(void) + +#endif + +#define ADB_ENTRY(val, template) {val, template} + +#define ASN1_ADB_TEMPLATE(name) \ + static const ASN1_TEMPLATE name##_tt + +/* This is the ASN1 template structure that defines + * a wrapper round the actual type. It determines the + * actual position of the field in the value structure, + * various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { +unsigned long flags; /* Various flags */ +long tag; /* tag, not used if no tagging */ +unsigned long offset; /* Offset of this field in structure */ +#ifndef NO_ASN1_FIELD_NAMES +const char *field_name; /* Field name */ +#endif +ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +#define ASN1_TEMPLATE_item(t) (t->item_ptr) +#define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + STACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */ + const ASN1_ADB_TABLE *tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +#define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +#define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +#define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* Special case: this refers to a SET OF that + * will be sorted into DER order when encoded *and* + * the corresponding STACK will be modified to match + * the new order. + */ +#define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +#define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* These flags mean the tag should be taken from the + * tag field. If EXPLICIT then the underlying type + * is used for the inner tag. + */ + +/* IMPLICIT tagging */ +#define ASN1_TFLG_IMPTAG (0x1 << 3) + + +/* EXPLICIT tagging, inner tag from underlying type */ +#define ASN1_TFLG_EXPTAG (0x2 << 3) + +#define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +#define ASN1_TFLG_IMPLICIT ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT + +/* context specific EXPLICIT */ +#define ASN1_TFLG_EXPLICIT ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT + +/* If tagging is in force these determine the + * type of tag to use. Otherwise the tag is + * determined by the underlying type. These + * values reflect the actual octet format. + */ + +/* Universal tag */ +#define ASN1_TFLG_UNIVERSAL (0x0<<6) +/* Application tag */ +#define ASN1_TFLG_APPLICATION (0x1<<6) +/* Context specific tag */ +#define ASN1_TFLG_CONTEXT (0x2<<6) +/* Private tag */ +#define ASN1_TFLG_PRIVATE (0x3<<6) + +#define ASN1_TFLG_TAG_CLASS (0x3<<6) + +/* These are for ANY DEFINED BY type. In this case + * the 'item' field points to an ASN1_ADB structure + * which contains a table of values to decode the + * relevant type + */ + +#define ASN1_TFLG_ADB_MASK (0x3<<8) + +#define ASN1_TFLG_ADB_OID (0x1<<8) + +#define ASN1_TFLG_ADB_INT (0x1<<9) + +/* This flag means a parent structure is passed + * instead of the field: this is useful is a + * SEQUENCE is being combined with a CHOICE for + * example. Since this means the structure and + * item name will differ we need to use the + * ASN1_CHOICE_END_name() macro for example. + */ + +#define ASN1_TFLG_COMBINE (0x1<<10) + +/* This flag when present in a SEQUENCE OF, SET OF + * or EXPLICIT causes indefinite length constructed + * encoding to be used if required. + */ + +#define ASN1_TFLG_NDEF (0x1<<11) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { +char itype; /* The item type, primitive, SEQUENCE, CHOICE or extern */ +long utype; /* underlying type */ +const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains the contents */ +long tcount; /* Number of templates if SEQUENCE or CHOICE */ +const void *funcs; /* functions that handle this type */ +long size; /* Structure size (usually)*/ +#ifndef NO_ASN1_FIELD_NAMES +const char *sname; /* Structure name */ +#endif +}; + +/* These are values for the itype field and + * determine how the type is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application + * specific functions. + * + * For COMPAT types the funcs field gives a + * set of functions that handle this type, this + * supports the old d2i, i2d convention. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +#define ASN1_ITYPE_PRIMITIVE 0x0 + +#define ASN1_ITYPE_SEQUENCE 0x1 + +#define ASN1_ITYPE_CHOICE 0x2 + +#define ASN1_ITYPE_COMPAT 0x3 + +#define ASN1_ITYPE_EXTERN 0x4 + +#define ASN1_ITYPE_MSTRING 0x5 + +#define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* Cache for ASN1 tag and length, so we + * don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st{ + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ + +typedef ASN1_VALUE * ASN1_new_func(void); +typedef void ASN1_free_func(ASN1_VALUE *a); +typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length); +typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in); + +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, + int tag, int aclass, char opt, ASN1_TLC *ctx); + +typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); +typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); + +typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); + +typedef struct ASN1_COMPAT_FUNCS_st { + ASN1_new_func *asn1_new; + ASN1_free_func *asn1_free; + ASN1_d2i_func *asn1_d2i; + ASN1_i2d_func *asn1_i2d; +} ASN1_COMPAT_FUNCS; + +typedef struct ASN1_EXTERN_FUNCS_st { + void *app_data; + ASN1_ex_new_func *asn1_ex_new; + ASN1_ex_free_func *asn1_ex_free; + ASN1_ex_free_func *asn1_ex_clear; + ASN1_ex_d2i *asn1_ex_d2i; + ASN1_ex_i2d *asn1_ex_i2d; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void *app_data; + unsigned long flags; + ASN1_ex_new_func *prim_new; + ASN1_ex_free_func *prim_free; + ASN1_ex_free_func *prim_clear; + ASN1_primitive_c2i *prim_c2i; + ASN1_primitive_i2c *prim_i2c; +} ASN1_PRIMITIVE_FUNCS; + +/* This is the ASN1_AUX structure: it handles various + * miscellaneous requirements. For example the use of + * reference counts and an informational callback. + * + * The "informational callback" is called at various + * points during the ASN1 encoding and decoding. It can + * be used to provide minor customisation of the structures + * used. This is most useful where the supplied routines + * *almost* do the right thing but need some extra help + * at a few points. If the callback returns zero then + * it is assumed a fatal error has occurred and the + * main operation should be abandoned. + * + * If major changes in the default behaviour are required + * then an external type is more appropriate. + */ + +typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it); + +typedef struct ASN1_AUX_st { + void *app_data; + int flags; + int ref_offset; /* Offset of reference value */ + int ref_lock; /* Lock type to use */ + ASN1_aux_cb *asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ +} ASN1_AUX; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +#define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +#define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +#define ASN1_AFLG_BROKEN 4 + +/* operation values for asn1_cb */ + +#define ASN1_OP_NEW_PRE 0 +#define ASN1_OP_NEW_POST 1 +#define ASN1_OP_FREE_PRE 2 +#define ASN1_OP_FREE_POST 3 +#define ASN1_OP_D2I_PRE 4 +#define ASN1_OP_D2I_POST 5 +#define ASN1_OP_I2D_PRE 6 +#define ASN1_OP_I2D_POST 7 + +/* Macro to implement a primitive type */ +#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +#define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement an ASN1_ITEM in terms of old style funcs */ + +#define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE) + +#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \ + static const ASN1_COMPAT_FUNCS sname##_ff = { \ + (ASN1_new_func *)sname##_new, \ + (ASN1_free_func *)sname##_free, \ + (ASN1_d2i_func *)d2i_##sname, \ + (ASN1_i2d_func *)i2d_##sname, \ + }; \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_COMPAT, \ + tag, \ + NULL, \ + 0, \ + &sname##_ff, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_EXTERN, \ + tag, \ + NULL, \ + 0, \ + &fptrs, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +#define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ + { \ + return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ + } + +/* This includes evil casts to remove const: they will go away when full + * ASN1 constification is done. + */ +#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname * stname##_dup(stname *x) \ + { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ + IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) + +#define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) + +DECLARE_STACK_OF(ASN1_VALUE) + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); +int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it); + +void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt); +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, + int tag, int aclass, char opt, ASN1_TLC *ctx); + +int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); +int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt); +void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it); + +int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); +int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); + +int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it); + +ASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); + +const ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr); + +int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it); + +void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it); +void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it); +int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/bio.h b/externals/openssl/bio.h new file mode 100644 index 0000000..cecb6a7 --- /dev/null +++ b/externals/openssl/bio.h @@ -0,0 +1,776 @@ +/* crypto/bio/bio.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BIO_H +#define HEADER_BIO_H + +#include + +#ifndef OPENSSL_NO_FP_API +# include +#endif +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These are the 'types' of BIOs */ +#define BIO_TYPE_NONE 0 +#define BIO_TYPE_MEM (1|0x0400) +#define BIO_TYPE_FILE (2|0x0400) + +#define BIO_TYPE_FD (4|0x0400|0x0100) +#define BIO_TYPE_SOCKET (5|0x0400|0x0100) +#define BIO_TYPE_NULL (6|0x0400) +#define BIO_TYPE_SSL (7|0x0200) +#define BIO_TYPE_MD (8|0x0200) /* passive filter */ +#define BIO_TYPE_BUFFER (9|0x0200) /* filter */ +#define BIO_TYPE_CIPHER (10|0x0200) /* filter */ +#define BIO_TYPE_BASE64 (11|0x0200) /* filter */ +#define BIO_TYPE_CONNECT (12|0x0400|0x0100) /* socket - connect */ +#define BIO_TYPE_ACCEPT (13|0x0400|0x0100) /* socket for accept */ +#define BIO_TYPE_PROXY_CLIENT (14|0x0200) /* client proxy BIO */ +#define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */ +#define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */ +#define BIO_TYPE_NULL_FILTER (17|0x0200) +#define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ +#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ +#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ +#define BIO_TYPE_DGRAM (21|0x0400|0x0100) +#define BIO_TYPE_COMP (23|0x0200) /* filter */ + +#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +#define BIO_TYPE_FILTER 0x0200 +#define BIO_TYPE_SOURCE_SINK 0x0400 + +/* BIO_FILENAME_READ|BIO_CLOSE to open or close on free. + * BIO_set_fp(in,stdin,BIO_NOCLOSE); */ +#define BIO_NOCLOSE 0x00 +#define BIO_CLOSE 0x01 + +/* These are used in the following macros and are passed to + * BIO_ctrl() */ +#define BIO_CTRL_RESET 1 /* opt - rewind/zero etc */ +#define BIO_CTRL_EOF 2 /* opt - are we at the eof */ +#define BIO_CTRL_INFO 3 /* opt - extra tit-bits */ +#define BIO_CTRL_SET 4 /* man - set the 'IO' type */ +#define BIO_CTRL_GET 5 /* man - get the 'IO' type */ +#define BIO_CTRL_PUSH 6 /* opt - internal, used to signify change */ +#define BIO_CTRL_POP 7 /* opt - internal, used to signify change */ +#define BIO_CTRL_GET_CLOSE 8 /* man - set the 'close' on free */ +#define BIO_CTRL_SET_CLOSE 9 /* man - set the 'close' on free */ +#define BIO_CTRL_PENDING 10 /* opt - is their more data buffered */ +#define BIO_CTRL_FLUSH 11 /* opt - 'flush' buffered output */ +#define BIO_CTRL_DUP 12 /* man - extra stuff for 'duped' BIO */ +#define BIO_CTRL_WPENDING 13 /* opt - number of bytes still to write */ +/* callback is int cb(BIO *bio,state,ret); */ +#define BIO_CTRL_SET_CALLBACK 14 /* opt - set callback function */ +#define BIO_CTRL_GET_CALLBACK 15 /* opt - set callback function */ + +#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */ + +/* dgram BIO stuff */ +#define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ +#define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally + * connected socket to be + * passed in */ +#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ +#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ + +#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ +#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ + +/* #ifdef IP_MTU_DISCOVER */ +#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ +/* #endif */ + +#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */ +#define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */ +#define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for + * MTU. want to use this + * if asking the kernel + * fails */ + +#define BIO_CTRL_DGRAM_MTU_EXCEEDED 43 /* check whether the MTU + * was exceed in the + * previous write + * operation */ + +#define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */ + + +/* modifiers */ +#define BIO_FP_READ 0x02 +#define BIO_FP_WRITE 0x04 +#define BIO_FP_APPEND 0x08 +#define BIO_FP_TEXT 0x10 + +#define BIO_FLAGS_READ 0x01 +#define BIO_FLAGS_WRITE 0x02 +#define BIO_FLAGS_IO_SPECIAL 0x04 +#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) +#define BIO_FLAGS_SHOULD_RETRY 0x08 +#ifndef BIO_FLAGS_UPLINK +/* "UPLINK" flag denotes file descriptors provided by application. + It defaults to 0, as most platforms don't require UPLINK interface. */ +#define BIO_FLAGS_UPLINK 0 +#endif + +/* Used in BIO_gethostbyname() */ +#define BIO_GHBN_CTRL_HITS 1 +#define BIO_GHBN_CTRL_MISSES 2 +#define BIO_GHBN_CTRL_CACHE_SIZE 3 +#define BIO_GHBN_CTRL_GET_ENTRY 4 +#define BIO_GHBN_CTRL_FLUSH 5 + +/* Mostly used in the SSL BIO */ +/* Not used anymore + * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10 + * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20 + * #define BIO_FLAGS_PROTOCOL_STARTUP 0x40 + */ + +#define BIO_FLAGS_BASE64_NO_NL 0x100 + +/* This is used with memory BIOs: it means we shouldn't free up or change the + * data in any way. + */ +#define BIO_FLAGS_MEM_RDONLY 0x200 + +typedef struct bio_st BIO; + +void BIO_set_flags(BIO *b, int flags); +int BIO_test_flags(const BIO *b, int flags); +void BIO_clear_flags(BIO *b, int flags); + +#define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) +#define BIO_set_retry_special(b) \ + BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_read(b) \ + BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) +#define BIO_set_retry_write(b) \ + BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) + +/* These are normally used internally in BIOs */ +#define BIO_clear_retry_flags(b) \ + BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) +#define BIO_get_retry_flags(b) \ + BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) + +/* These should be used by the application to tell why we should retry */ +#define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) +#define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) +#define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) +#define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) +#define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) + +/* The next three are used in conjunction with the + * BIO_should_io_special() condition. After this returns true, + * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO + * stack and return the 'reason' for the special and the offending BIO. + * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ +/* Returned from the SSL bio when the certificate retrieval code had an error */ +#define BIO_RR_SSL_X509_LOOKUP 0x01 +/* Returned from the connect BIO when a connect would have blocked */ +#define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +#define BIO_RR_ACCEPT 0x03 + +/* These are passed by the BIO callback */ +#define BIO_CB_FREE 0x01 +#define BIO_CB_READ 0x02 +#define BIO_CB_WRITE 0x03 +#define BIO_CB_PUTS 0x04 +#define BIO_CB_GETS 0x05 +#define BIO_CB_CTRL 0x06 + +/* The callback is called before and after the underling operation, + * The BIO_CB_RETURN flag indicates if it is after the call */ +#define BIO_CB_RETURN 0x80 +#define BIO_CB_return(a) ((a)|BIO_CB_RETURN)) +#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) +#define BIO_cb_post(a) ((a)&BIO_CB_RETURN) + +long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long); +void BIO_set_callback(BIO *b, + long (*callback)(struct bio_st *,int,const char *,int, long,long)); +char *BIO_get_callback_arg(const BIO *b); +void BIO_set_callback_arg(BIO *b, char *arg); + +const char * BIO_method_name(const BIO *b); +int BIO_method_type(const BIO *b); + +typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); + +#ifndef OPENSSL_SYS_WIN16 +typedef struct bio_method_st + { + int type; + const char *name; + int (*bwrite)(BIO *, const char *, int); + int (*bread)(BIO *, char *, int); + int (*bputs)(BIO *, const char *); + int (*bgets)(BIO *, char *, int); + long (*ctrl)(BIO *, int, long, void *); + int (*create)(BIO *); + int (*destroy)(BIO *); + long (*callback_ctrl)(BIO *, int, bio_info_cb *); + } BIO_METHOD; +#else +typedef struct bio_method_st + { + int type; + const char *name; + int (_far *bwrite)(); + int (_far *bread)(); + int (_far *bputs)(); + int (_far *bgets)(); + long (_far *ctrl)(); + int (_far *create)(); + int (_far *destroy)(); + long (_far *callback_ctrl)(); + } BIO_METHOD; +#endif + +struct bio_st + { + BIO_METHOD *method; + /* bio, mode, argp, argi, argl, ret */ + long (*callback)(struct bio_st *,int,const char *,int, long,long); + char *cb_arg; /* first argument for the callback */ + + int init; + int shutdown; + int flags; /* extra storage */ + int retry_reason; + int num; + void *ptr; + struct bio_st *next_bio; /* used by filter BIOs */ + struct bio_st *prev_bio; /* used by filter BIOs */ + int references; + unsigned long num_read; + unsigned long num_write; + + CRYPTO_EX_DATA ex_data; + }; + +DECLARE_STACK_OF(BIO) + +typedef struct bio_f_buffer_ctx_struct + { + /* BIO *bio; */ /* this is now in the BIO struct */ + int ibuf_size; /* how big is the input buffer */ + int obuf_size; /* how big is the output buffer */ + + char *ibuf; /* the char array */ + int ibuf_len; /* how many bytes are in it */ + int ibuf_off; /* write/read offset */ + + char *obuf; /* the char array */ + int obuf_len; /* how many bytes are in it */ + int obuf_off; /* write/read offset */ + } BIO_F_BUFFER_CTX; + +/* connect BIO stuff */ +#define BIO_CONN_S_BEFORE 1 +#define BIO_CONN_S_GET_IP 2 +#define BIO_CONN_S_GET_PORT 3 +#define BIO_CONN_S_CREATE_SOCKET 4 +#define BIO_CONN_S_CONNECT 5 +#define BIO_CONN_S_OK 6 +#define BIO_CONN_S_BLOCKED_CONNECT 7 +#define BIO_CONN_S_NBIO 8 +/*#define BIO_CONN_get_param_hostname BIO_ctrl */ + +#define BIO_C_SET_CONNECT 100 +#define BIO_C_DO_STATE_MACHINE 101 +#define BIO_C_SET_NBIO 102 +#define BIO_C_SET_PROXY_PARAM 103 +#define BIO_C_SET_FD 104 +#define BIO_C_GET_FD 105 +#define BIO_C_SET_FILE_PTR 106 +#define BIO_C_GET_FILE_PTR 107 +#define BIO_C_SET_FILENAME 108 +#define BIO_C_SET_SSL 109 +#define BIO_C_GET_SSL 110 +#define BIO_C_SET_MD 111 +#define BIO_C_GET_MD 112 +#define BIO_C_GET_CIPHER_STATUS 113 +#define BIO_C_SET_BUF_MEM 114 +#define BIO_C_GET_BUF_MEM_PTR 115 +#define BIO_C_GET_BUFF_NUM_LINES 116 +#define BIO_C_SET_BUFF_SIZE 117 +#define BIO_C_SET_ACCEPT 118 +#define BIO_C_SSL_MODE 119 +#define BIO_C_GET_MD_CTX 120 +#define BIO_C_GET_PROXY_PARAM 121 +#define BIO_C_SET_BUFF_READ_DATA 122 /* data to read first */ +#define BIO_C_GET_CONNECT 123 +#define BIO_C_GET_ACCEPT 124 +#define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +#define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +#define BIO_C_FILE_SEEK 128 +#define BIO_C_GET_CIPHER_CTX 129 +#define BIO_C_SET_BUF_MEM_EOF_RETURN 130/*return end of input value*/ +#define BIO_C_SET_BIND_MODE 131 +#define BIO_C_GET_BIND_MODE 132 +#define BIO_C_FILE_TELL 133 +#define BIO_C_GET_SOCKS 134 +#define BIO_C_SET_SOCKS 135 + +#define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ +#define BIO_C_GET_WRITE_BUF_SIZE 137 +#define BIO_C_MAKE_BIO_PAIR 138 +#define BIO_C_DESTROY_BIO_PAIR 139 +#define BIO_C_GET_WRITE_GUARANTEE 140 +#define BIO_C_GET_READ_REQUEST 141 +#define BIO_C_SHUTDOWN_WR 142 +#define BIO_C_NREAD0 143 +#define BIO_C_NREAD 144 +#define BIO_C_NWRITE0 145 +#define BIO_C_NWRITE 146 +#define BIO_C_RESET_READ_REQUEST 147 +#define BIO_C_SET_MD_CTX 148 + + +#define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) +#define BIO_get_app_data(s) BIO_get_ex_data(s,0) + +/* BIO_s_connect() and BIO_s_socks4a_connect() */ +#define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) +#define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) +#define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) +#define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) +#define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) +#define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) +#define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) +#define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3) + + +#define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) + +/* BIO_s_accept_socket() */ +#define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) +#define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) +/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ +#define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) +#define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) + +#define BIO_BIND_NORMAL 0 +#define BIO_BIND_REUSEADDR_IF_UNUSED 1 +#define BIO_BIND_REUSEADDR 2 +#define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) +#define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) + +#define BIO_do_connect(b) BIO_do_handshake(b) +#define BIO_do_accept(b) BIO_do_handshake(b) +#define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) + +/* BIO_s_proxy_client() */ +#define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url)) +#define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p)) +/* BIO_set_nbio(b,n) */ +#define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s)) +/* BIO *BIO_get_filter_bio(BIO *bio); */ +#define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)())) +#define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk) +#define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool) + +#define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp) +#define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p)) +#define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url)) +#define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL) + +#define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) +#define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) + +#define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp) +#define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp) + +#define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) +#define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) + +/* name is cast to lose const, but might be better to route through a function + so we can do it safely */ +#ifdef CONST_STRICT +/* If you are wondering why this isn't defined, its because CONST_STRICT is + * purely a compile-time kludge to allow const to be checked. + */ +int BIO_read_filename(BIO *b,const char *name); +#else +#define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ,(char *)name) +#endif +#define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_WRITE,name) +#define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_APPEND,name) +#define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) + +/* WARNING WARNING, this ups the reference count on the read bio of the + * SSL structure. This is because the ssl read BIO is now pointed to by + * the next_bio field in the bio. So when you free the BIO, make sure + * you are doing a BIO_free_all() to catch the underlying BIO. */ +#define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) +#define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) +#define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) +#define BIO_set_ssl_renegotiate_bytes(b,num) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); +#define BIO_get_num_renegotiates(b) \ + BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL); +#define BIO_set_ssl_renegotiate_timeout(b,seconds) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); + +/* defined in evp.h */ +/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */ + +#define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp) +#define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm) +#define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp) +#define BIO_set_mem_eof_return(b,v) \ + BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) + +/* For the BIO_f_buffer() type */ +#define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) +#define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) +#define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) +#define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) +#define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) + +/* Don't use the next one unless you know what you are doing :-) */ +#define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) + +#define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) +#define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) +#define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) +#define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) +#define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) +#define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) +/* ...pending macros have inappropriate return type */ +size_t BIO_ctrl_pending(BIO *b); +size_t BIO_ctrl_wpending(BIO *b); +#define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) +#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ + cbp) +#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) + +/* For the BIO_f_buffer() type */ +#define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) + +/* For BIO_s_bio() */ +#define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) +#define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) +#define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) +#define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) +#define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) +/* macros with inappropriate type -- but ...pending macros use int too: */ +#define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) +#define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) +size_t BIO_ctrl_get_write_guarantee(BIO *b); +size_t BIO_ctrl_get_read_request(BIO *b); +int BIO_ctrl_reset_read_request(BIO *b); + +/* ctrl macros for dgram */ +#define BIO_ctrl_dgram_connect(b,peer) \ + (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer) +#define BIO_ctrl_set_connected(b, state, peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer) +#define BIO_dgram_recv_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) +#define BIO_dgram_send_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) +#define BIO_dgram_set_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer) + +/* These two aren't currently implemented */ +/* int BIO_get_ex_num(BIO *bio); */ +/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ +int BIO_set_ex_data(BIO *bio,int idx,void *data); +void *BIO_get_ex_data(BIO *bio,int idx); +int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +unsigned long BIO_number_read(BIO *bio); +unsigned long BIO_number_written(BIO *bio); + +# ifndef OPENSSL_NO_FP_API +# if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL) +BIO_METHOD *BIO_s_file_internal(void); +BIO *BIO_new_file_internal(char *filename, char *mode); +BIO *BIO_new_fp_internal(FILE *stream, int close_flag); +# define BIO_s_file BIO_s_file_internal +# define BIO_new_file BIO_new_file_internal +# define BIO_new_fp BIO_new_fp_internal +# else /* FP_API */ +BIO_METHOD *BIO_s_file(void ); +BIO *BIO_new_file(const char *filename, const char *mode); +BIO *BIO_new_fp(FILE *stream, int close_flag); +# define BIO_s_file_internal BIO_s_file +# define BIO_new_file_internal BIO_new_file +# define BIO_new_fp_internal BIO_s_file +# endif /* FP_API */ +# endif +BIO * BIO_new(BIO_METHOD *type); +int BIO_set(BIO *a,BIO_METHOD *type); +int BIO_free(BIO *a); +void BIO_vfree(BIO *a); +int BIO_read(BIO *b, void *data, int len); +int BIO_gets(BIO *bp,char *buf, int size); +int BIO_write(BIO *b, const void *data, int len); +int BIO_puts(BIO *bp,const char *buf); +int BIO_indent(BIO *b,int indent,int max); +long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); +long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); +char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); +long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); +BIO * BIO_push(BIO *b,BIO *append); +BIO * BIO_pop(BIO *b); +void BIO_free_all(BIO *a); +BIO * BIO_find_type(BIO *b,int bio_type); +BIO * BIO_next(BIO *b); +BIO * BIO_get_retry_BIO(BIO *bio, int *reason); +int BIO_get_retry_reason(BIO *bio); +BIO * BIO_dup_chain(BIO *in); + +int BIO_nread0(BIO *bio, char **buf); +int BIO_nread(BIO *bio, char **buf, int num); +int BIO_nwrite0(BIO *bio, char **buf); +int BIO_nwrite(BIO *bio, char **buf, int num); + +#ifndef OPENSSL_SYS_WIN16 +long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, + long argl,long ret); +#else +long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, + long argl,long ret); +#endif + +BIO_METHOD *BIO_s_mem(void); +BIO *BIO_new_mem_buf(void *buf, int len); +BIO_METHOD *BIO_s_socket(void); +BIO_METHOD *BIO_s_connect(void); +BIO_METHOD *BIO_s_accept(void); +BIO_METHOD *BIO_s_fd(void); +#ifndef OPENSSL_SYS_OS2 +BIO_METHOD *BIO_s_log(void); +#endif +BIO_METHOD *BIO_s_bio(void); +BIO_METHOD *BIO_s_null(void); +BIO_METHOD *BIO_f_null(void); +BIO_METHOD *BIO_f_buffer(void); +#ifdef OPENSSL_SYS_VMS +BIO_METHOD *BIO_f_linebuffer(void); +#endif +BIO_METHOD *BIO_f_nbio_test(void); +#ifndef OPENSSL_NO_DGRAM +BIO_METHOD *BIO_s_datagram(void); +#endif + +/* BIO_METHOD *BIO_f_ber(void); */ + +int BIO_sock_should_retry(int i); +int BIO_sock_non_fatal_error(int error); +int BIO_dgram_non_fatal_error(int error); + +int BIO_fd_should_retry(int i); +int BIO_fd_non_fatal_error(int error); +int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), + void *u, const char *s, int len); +int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), + void *u, const char *s, int len, int indent); +int BIO_dump(BIO *b,const char *bytes,int len); +int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); +#ifndef OPENSSL_NO_FP_API +int BIO_dump_fp(FILE *fp, const char *s, int len); +int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); +#endif +struct hostent *BIO_gethostbyname(const char *name); +/* We might want a thread-safe interface too: + * struct hostent *BIO_gethostbyname_r(const char *name, + * struct hostent *result, void *buffer, size_t buflen); + * or something similar (caller allocates a struct hostent, + * pointed to by "result", and additional buffer space for the various + * substructures; if the buffer does not suffice, NULL is returned + * and an appropriate error code is set). + */ +int BIO_sock_error(int sock); +int BIO_socket_ioctl(int fd, long type, void *arg); +int BIO_socket_nbio(int fd,int mode); +int BIO_get_port(const char *str, unsigned short *port_ptr); +int BIO_get_host_ip(const char *str, unsigned char *ip); +int BIO_get_accept_socket(char *host_port,int mode); +int BIO_accept(int sock,char **ip_port); +int BIO_sock_init(void ); +void BIO_sock_cleanup(void); +int BIO_set_tcp_ndelay(int sock,int turn_on); + +BIO *BIO_new_socket(int sock, int close_flag); +BIO *BIO_new_dgram(int fd, int close_flag); +BIO *BIO_new_fd(int fd, int close_flag); +BIO *BIO_new_connect(char *host_port); +BIO *BIO_new_accept(char *host_port); + +int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, + BIO **bio2, size_t writebuf2); +/* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. + * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. + * Size 0 uses default value. + */ + +void BIO_copy_next_retry(BIO *b); + +/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/ + +#ifdef __GNUC__ +# define __bio_h__attr__ __attribute__ +#else +# define __bio_h__attr__(x) +#endif +int BIO_printf(BIO *bio, const char *format, ...) + __bio_h__attr__((__format__(__printf__,2,3))); +int BIO_vprintf(BIO *bio, const char *format, va_list args) + __bio_h__attr__((__format__(__printf__,2,0))); +int BIO_snprintf(char *buf, size_t n, const char *format, ...) + __bio_h__attr__((__format__(__printf__,3,4))); +int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) + __bio_h__attr__((__format__(__printf__,3,0))); +#undef __bio_h__attr__ + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BIO_strings(void); + +/* Error codes for the BIO functions. */ + +/* Function codes. */ +#define BIO_F_ACPT_STATE 100 +#define BIO_F_BIO_ACCEPT 101 +#define BIO_F_BIO_BER_GET_HEADER 102 +#define BIO_F_BIO_CALLBACK_CTRL 131 +#define BIO_F_BIO_CTRL 103 +#define BIO_F_BIO_GETHOSTBYNAME 120 +#define BIO_F_BIO_GETS 104 +#define BIO_F_BIO_GET_ACCEPT_SOCKET 105 +#define BIO_F_BIO_GET_HOST_IP 106 +#define BIO_F_BIO_GET_PORT 107 +#define BIO_F_BIO_MAKE_PAIR 121 +#define BIO_F_BIO_NEW 108 +#define BIO_F_BIO_NEW_FILE 109 +#define BIO_F_BIO_NEW_MEM_BUF 126 +#define BIO_F_BIO_NREAD 123 +#define BIO_F_BIO_NREAD0 124 +#define BIO_F_BIO_NWRITE 125 +#define BIO_F_BIO_NWRITE0 122 +#define BIO_F_BIO_PUTS 110 +#define BIO_F_BIO_READ 111 +#define BIO_F_BIO_SOCK_INIT 112 +#define BIO_F_BIO_WRITE 113 +#define BIO_F_BUFFER_CTRL 114 +#define BIO_F_CONN_CTRL 127 +#define BIO_F_CONN_STATE 115 +#define BIO_F_FILE_CTRL 116 +#define BIO_F_FILE_READ 130 +#define BIO_F_LINEBUFFER_CTRL 129 +#define BIO_F_MEM_READ 128 +#define BIO_F_MEM_WRITE 117 +#define BIO_F_SSL_NEW 118 +#define BIO_F_WSASTARTUP 119 + +/* Reason codes. */ +#define BIO_R_ACCEPT_ERROR 100 +#define BIO_R_BAD_FOPEN_MODE 101 +#define BIO_R_BAD_HOSTNAME_LOOKUP 102 +#define BIO_R_BROKEN_PIPE 124 +#define BIO_R_CONNECT_ERROR 103 +#define BIO_R_EOF_ON_MEMORY_BIO 127 +#define BIO_R_ERROR_SETTING_NBIO 104 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105 +#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106 +#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +#define BIO_R_INVALID_ARGUMENT 125 +#define BIO_R_INVALID_IP_ADDRESS 108 +#define BIO_R_IN_USE 123 +#define BIO_R_KEEPALIVE 109 +#define BIO_R_NBIO_CONNECT_ERROR 110 +#define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 +#define BIO_R_NO_HOSTNAME_SPECIFIED 112 +#define BIO_R_NO_PORT_DEFINED 113 +#define BIO_R_NO_PORT_SPECIFIED 114 +#define BIO_R_NO_SUCH_FILE 128 +#define BIO_R_NULL_PARAMETER 115 +#define BIO_R_TAG_MISMATCH 116 +#define BIO_R_UNABLE_TO_BIND_SOCKET 117 +#define BIO_R_UNABLE_TO_CREATE_SOCKET 118 +#define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 +#define BIO_R_UNINITIALIZED 120 +#define BIO_R_UNSUPPORTED_METHOD 121 +#define BIO_R_WRITE_TO_READ_ONLY_BIO 126 +#define BIO_R_WSASTARTUP 122 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/blowfish.h b/externals/openssl/blowfish.h new file mode 100644 index 0000000..d24ffcc --- /dev/null +++ b/externals/openssl/blowfish.h @@ -0,0 +1,129 @@ +/* crypto/bf/blowfish.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BLOWFISH_H +#define HEADER_BLOWFISH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_BF +#error BF is disabled. +#endif + +#define BF_ENCRYPT 1 +#define BF_DECRYPT 0 + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! BF_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! BF_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) +#define BF_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define BF_LONG unsigned long +#define BF_LONG_LOG2 3 +/* + * _CRAY note. I could declare short, but I have no idea what impact + * does it have on performance on none-T3E machines. I could declare + * int, but at least on C90 sizeof(int) can be chosen at compile time. + * So I've chosen long... + * + */ +#else +#define BF_LONG unsigned int +#endif + +#define BF_ROUNDS 16 +#define BF_BLOCK 8 + +typedef struct bf_key_st + { + BF_LONG P[BF_ROUNDS+2]; + BF_LONG S[4*256]; + } BF_KEY; + +#ifdef OPENSSL_FIPS +void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data); +#endif +void BF_set_key(BF_KEY *key, int len, const unsigned char *data); + +void BF_encrypt(BF_LONG *data,const BF_KEY *key); +void BF_decrypt(BF_LONG *data,const BF_KEY *key); + +void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, + const BF_KEY *key, int enc); +void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + const BF_KEY *schedule, unsigned char *ivec, int enc); +void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, + const BF_KEY *schedule, unsigned char *ivec, int *num, int enc); +void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, + const BF_KEY *schedule, unsigned char *ivec, int *num); +const char *BF_options(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/bn.h b/externals/openssl/bn.h new file mode 100644 index 0000000..f1719a5 --- /dev/null +++ b/externals/openssl/bn.h @@ -0,0 +1,855 @@ +/* crypto/bn/bn.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the Eric Young open source + * license provided above. + * + * The binary polynomial arithmetic software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. + * + */ + +#ifndef HEADER_BN_H +#define HEADER_BN_H + +#include +#ifndef OPENSSL_NO_FP_API +#include /* FILE */ +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These preprocessor symbols control various aspects of the bignum headers and + * library code. They're not defined by any "normal" configuration, as they are + * intended for development and testing purposes. NB: defining all three can be + * useful for debugging application code as well as openssl itself. + * + * BN_DEBUG - turn on various debugging alterations to the bignum code + * BN_DEBUG_RAND - uses random poisoning of unused words to trip up + * mismanagement of bignum internals. You must also define BN_DEBUG. + */ +/* #define BN_DEBUG */ +/* #define BN_DEBUG_RAND */ + +#define BN_MUL_COMBA +#define BN_SQR_COMBA +#define BN_RECURSION + +/* This next option uses the C libraries (2 word)/(1 word) function. + * If it is not defined, I use my C version (which is slower). + * The reason for this flag is that when the particular C compiler + * library routine is used, and the library is linked with a different + * compiler, the library is missing. This mostly happens when the + * library is built with gcc and then linked using normal cc. This would + * be a common occurrence because gcc normally produces code that is + * 2 times faster than system compilers for the big number stuff. + * For machines with only one compiler (or shared libraries), this should + * be on. Again this in only really a problem on machines + * using "long long's", are 32bit, and are not using my assembler code. */ +#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \ + defined(OPENSSL_SYS_WIN32) || defined(linux) +# ifndef BN_DIV2W +# define BN_DIV2W +# endif +#endif + +/* assuming long is 64bit - this is the DEC Alpha + * unsigned long long is only 64 bits :-(, don't define + * BN_LLONG for the DEC Alpha */ +#ifdef SIXTY_FOUR_BIT_LONG +#define BN_ULLONG unsigned long long +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK (0xffffffffffffffffffffffffffffffffLL) +#define BN_MASK2 (0xffffffffffffffffL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000L) +#define BN_MASK2h1 (0xffffffff80000000L) +#define BN_TBIT (0x8000000000000000L) +#define BN_DEC_CONV (10000000000000000000UL) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%019lu" +#define BN_DEC_NUM 19 +#endif + +/* This is where the long long data type is 64 bits, but long is 32. + * For machines where there are 64bit registers, this is the mode to use. + * IRIX, on R4000 and above should use this mode, along with the relevant + * assembler code :-). Do NOT define BN_LLONG. + */ +#ifdef SIXTY_FOUR_BIT +#undef BN_LLONG +#undef BN_ULLONG +#define BN_ULONG unsigned long long +#define BN_LONG long long +#define BN_BITS 128 +#define BN_BYTES 8 +#define BN_BITS2 64 +#define BN_BITS4 32 +#define BN_MASK2 (0xffffffffffffffffLL) +#define BN_MASK2l (0xffffffffL) +#define BN_MASK2h (0xffffffff00000000LL) +#define BN_MASK2h1 (0xffffffff80000000LL) +#define BN_TBIT (0x8000000000000000LL) +#define BN_DEC_CONV (10000000000000000000ULL) +#define BN_DEC_FMT1 "%llu" +#define BN_DEC_FMT2 "%019llu" +#define BN_DEC_NUM 19 +#endif + +#ifdef THIRTY_TWO_BIT +#ifdef BN_LLONG +# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__) +# define BN_ULLONG unsigned __int64 +# else +# define BN_ULLONG unsigned long long +# endif +#endif +#define BN_ULONG unsigned long +#define BN_LONG long +#define BN_BITS 64 +#define BN_BYTES 4 +#define BN_BITS2 32 +#define BN_BITS4 16 +#ifdef OPENSSL_SYS_WIN32 +/* VC++ doesn't like the LL suffix */ +#define BN_MASK (0xffffffffffffffffL) +#else +#define BN_MASK (0xffffffffffffffffLL) +#endif +#define BN_MASK2 (0xffffffffL) +#define BN_MASK2l (0xffff) +#define BN_MASK2h1 (0xffff8000L) +#define BN_MASK2h (0xffff0000L) +#define BN_TBIT (0x80000000L) +#define BN_DEC_CONV (1000000000L) +#define BN_DEC_FMT1 "%lu" +#define BN_DEC_FMT2 "%09lu" +#define BN_DEC_NUM 9 +#endif + +#ifdef SIXTEEN_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned long +#define BN_ULONG unsigned short +#define BN_LONG short +#define BN_BITS 32 +#define BN_BYTES 2 +#define BN_BITS2 16 +#define BN_BITS4 8 +#define BN_MASK (0xffffffff) +#define BN_MASK2 (0xffff) +#define BN_MASK2l (0xff) +#define BN_MASK2h1 (0xff80) +#define BN_MASK2h (0xff00) +#define BN_TBIT (0x8000) +#define BN_DEC_CONV (100000) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%05u" +#define BN_DEC_NUM 5 +#endif + +#ifdef EIGHT_BIT +#ifndef BN_DIV2W +#define BN_DIV2W +#endif +#define BN_ULLONG unsigned short +#define BN_ULONG unsigned char +#define BN_LONG char +#define BN_BITS 16 +#define BN_BYTES 1 +#define BN_BITS2 8 +#define BN_BITS4 4 +#define BN_MASK (0xffff) +#define BN_MASK2 (0xff) +#define BN_MASK2l (0xf) +#define BN_MASK2h1 (0xf8) +#define BN_MASK2h (0xf0) +#define BN_TBIT (0x80) +#define BN_DEC_CONV (100) +#define BN_DEC_FMT1 "%u" +#define BN_DEC_FMT2 "%02u" +#define BN_DEC_NUM 2 +#endif + +#define BN_DEFAULT_BITS 1280 + +#define BN_FLG_MALLOCED 0x01 +#define BN_FLG_STATIC_DATA 0x02 +#define BN_FLG_CONSTTIME 0x04 /* avoid leaking exponent information through timing, + * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, + * BN_div() will call BN_div_no_branch, + * BN_mod_inverse() will call BN_mod_inverse_no_branch. + */ + +#ifndef OPENSSL_NO_DEPRECATED +#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME /* deprecated name for the flag */ + /* avoid leaking exponent information through timings + * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */ +#endif + +#ifndef OPENSSL_NO_DEPRECATED +#define BN_FLG_FREE 0x8000 /* used for debuging */ +#endif +#define BN_set_flags(b,n) ((b)->flags|=(n)) +#define BN_get_flags(b,n) ((b)->flags&(n)) + +/* get a clone of a BIGNUM with changed flags, for *temporary* use only + * (the two BIGNUMs cannot not be used in parallel!) */ +#define BN_with_flags(dest,b,n) ((dest)->d=(b)->d, \ + (dest)->top=(b)->top, \ + (dest)->dmax=(b)->dmax, \ + (dest)->neg=(b)->neg, \ + (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \ + | ((b)->flags & ~BN_FLG_MALLOCED) \ + | BN_FLG_STATIC_DATA \ + | (n))) + +/* Already declared in ossl_typ.h */ +#if 0 +typedef struct bignum_st BIGNUM; +/* Used for temp variables (declaration hidden in bn_lcl.h) */ +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; +#endif + +struct bignum_st + { + BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ + int top; /* Index of last used d +1. */ + /* The next are internal book keeping for bn_expand. */ + int dmax; /* Size of the d array. */ + int neg; /* one if the number is negative */ + int flags; + }; + +/* Used for montgomery multiplication */ +struct bn_mont_ctx_st + { + int ri; /* number of bits in R */ + BIGNUM RR; /* used to convert to montgomery form */ + BIGNUM N; /* The modulus */ + BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 + * (Ni is only stored for bignum algorithm) */ +#if 0 + /* OpenSSL 0.9.9 preview: */ + BN_ULONG n0[2];/* least significant word(s) of Ni */ +#else + BN_ULONG n0; /* least significant word of Ni */ +#endif + int flags; + }; + +/* Used for reciprocal division/mod functions + * It cannot be shared between threads + */ +struct bn_recp_ctx_st + { + BIGNUM N; /* the divisor */ + BIGNUM Nr; /* the reciprocal */ + int num_bits; + int shift; + int flags; + }; + +/* Used for slow "generation" functions. */ +struct bn_gencb_st + { + unsigned int ver; /* To handle binary (in)compatibility */ + void *arg; /* callback-specific data */ + union + { + /* if(ver==1) - handles old style callbacks */ + void (*cb_1)(int, int, void *); + /* if(ver==2) - new callback style */ + int (*cb_2)(int, int, BN_GENCB *); + } cb; + }; +/* Wrapper function to make using BN_GENCB easier, */ +int BN_GENCB_call(BN_GENCB *cb, int a, int b); +/* Macro to populate a BN_GENCB structure with an "old"-style callback */ +#define BN_GENCB_set_old(gencb, callback, cb_arg) { \ + BN_GENCB *tmp_gencb = (gencb); \ + tmp_gencb->ver = 1; \ + tmp_gencb->arg = (cb_arg); \ + tmp_gencb->cb.cb_1 = (callback); } +/* Macro to populate a BN_GENCB structure with a "new"-style callback */ +#define BN_GENCB_set(gencb, callback, cb_arg) { \ + BN_GENCB *tmp_gencb = (gencb); \ + tmp_gencb->ver = 2; \ + tmp_gencb->arg = (cb_arg); \ + tmp_gencb->cb.cb_2 = (callback); } + +#define BN_prime_checks 0 /* default: select number of iterations + based on the size of the number */ + +/* number of Miller-Rabin iterations for an error rate of less than 2^-80 + * for random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook + * of Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996]; + * original paper: Damgaard, Landrock, Pomerance: Average case error estimates + * for the strong probable prime test. -- Math. Comp. 61 (1993) 177-194) */ +#define BN_prime_checks_for_size(b) ((b) >= 1300 ? 2 : \ + (b) >= 850 ? 3 : \ + (b) >= 650 ? 4 : \ + (b) >= 550 ? 5 : \ + (b) >= 450 ? 6 : \ + (b) >= 400 ? 7 : \ + (b) >= 350 ? 8 : \ + (b) >= 300 ? 9 : \ + (b) >= 250 ? 12 : \ + (b) >= 200 ? 15 : \ + (b) >= 150 ? 18 : \ + /* b >= 100 */ 27) + +#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) + +/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */ +#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \ + (((w) == 0) && ((a)->top == 0))) +#define BN_is_zero(a) ((a)->top == 0) +#define BN_is_one(a) (BN_abs_is_word((a),1) && !(a)->neg) +#define BN_is_word(a,w) (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg)) +#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1)) + +#define BN_one(a) (BN_set_word((a),1)) +#define BN_zero_ex(a) \ + do { \ + BIGNUM *_tmp_bn = (a); \ + _tmp_bn->top = 0; \ + _tmp_bn->neg = 0; \ + } while(0) +#ifdef OPENSSL_NO_DEPRECATED +#define BN_zero(a) BN_zero_ex(a) +#else +#define BN_zero(a) (BN_set_word((a),0)) +#endif + +const BIGNUM *BN_value_one(void); +char * BN_options(void); +BN_CTX *BN_CTX_new(void); +#ifndef OPENSSL_NO_DEPRECATED +void BN_CTX_init(BN_CTX *c); +#endif +void BN_CTX_free(BN_CTX *c); +void BN_CTX_start(BN_CTX *ctx); +BIGNUM *BN_CTX_get(BN_CTX *ctx); +void BN_CTX_end(BN_CTX *ctx); +int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_num_bits(const BIGNUM *a); +int BN_num_bits_word(BN_ULONG); +BIGNUM *BN_new(void); +void BN_init(BIGNUM *); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); +void BN_swap(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret); +int BN_bn2bin(const BIGNUM *a, unsigned char *to); +BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret); +int BN_bn2mpi(const BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx); +/** BN_set_negative sets sign of a BIGNUM + * \param b pointer to the BIGNUM object + * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise + */ +void BN_set_negative(BIGNUM *b, int n); +/** BN_is_negative returns 1 if the BIGNUM is negative + * \param a pointer to the BIGNUM object + * \return 1 if a < 0 and 0 otherwise + */ +#define BN_is_negative(a) ((a)->neg != 0) + +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx); +#define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) +int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); +int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); +int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m); +int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m, BN_CTX *ctx); +int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); +int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); + +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(const BIGNUM *a); + +int BN_cmp(const BIGNUM *a, const BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(const BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, const BIGNUM *a); +int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx); + +int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m,BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont); +int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, + const BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m, + BN_CTX *ctx,BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m,BN_CTX *ctx); + +int BN_mask_bits(BIGNUM *a,int n); +#ifndef OPENSSL_NO_FP_API +int BN_print_fp(FILE *fp, const BIGNUM *a); +#endif +#ifdef HEADER_BIO_H +int BN_print(BIO *fp, const BIGNUM *a); +#else +int BN_print(void *fp, const BIGNUM *a); +#endif +int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, const BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *BN_dup(const BIGNUM *a); +int BN_ucmp(const BIGNUM *a, const BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char * BN_bn2hex(const BIGNUM *a); +char * BN_bn2dec(const BIGNUM *a); +int BN_hex2bn(BIGNUM **a, const char *str); +int BN_dec2bn(BIGNUM **a, const char *str); +int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); +int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */ +BIGNUM *BN_mod_inverse(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); +BIGNUM *BN_mod_sqrt(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); + +/* Deprecated versions */ +#ifndef OPENSSL_NO_DEPRECATED +BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe, + const BIGNUM *add, const BIGNUM *rem, + void (*callback)(int,int,void *),void *cb_arg); +int BN_is_prime(const BIGNUM *p,int nchecks, + void (*callback)(int,int,void *), + BN_CTX *ctx,void *cb_arg); +int BN_is_prime_fasttest(const BIGNUM *p,int nchecks, + void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg, + int do_trial_division); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* Newer versions */ +int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add, + const BIGNUM *rem, BN_GENCB *cb); +int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb); +int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, + int do_trial_division, BN_GENCB *cb); + +int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); + +int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, + const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2, + const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb); +int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, + BIGNUM *Xp1, BIGNUM *Xp2, + const BIGNUM *Xp, + const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb); + +BN_MONT_CTX *BN_MONT_CTX_new(void ); +void BN_MONT_CTX_init(BN_MONT_CTX *ctx); +int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b, + BN_MONT_CTX *mont, BN_CTX *ctx); +#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\ + (r),(a),&((mont)->RR),(mont),(ctx)) +int BN_from_montgomery(BIGNUM *r,const BIGNUM *a, + BN_MONT_CTX *mont, BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx); +BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from); +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, + const BIGNUM *mod, BN_CTX *ctx); + +/* BN_BLINDING flags */ +#define BN_BLINDING_NO_UPDATE 0x00000001 +#define BN_BLINDING_NO_RECREATE 0x00000002 + +BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); +int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); +unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); +void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); +unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); +void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); +BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, + const BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx, + int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), + BN_MONT_CTX *m_ctx); + +#ifndef OPENSSL_NO_DEPRECATED +void BN_set_params(int mul,int high,int low,int mont); +int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ +#endif + +void BN_RECP_CTX_init(BN_RECP_CTX *recp); +BN_RECP_CTX *BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX *recp); +int BN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx); +int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, + BN_RECP_CTX *recp,BN_CTX *ctx); +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, + BN_RECP_CTX *recp, BN_CTX *ctx); + +/* Functions for arithmetic over binary polynomials represented by BIGNUMs. + * + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is + * ignored. + * + * Note that input arguments are not const so that their bit arrays can + * be expanded to the appropriate size if needed. + */ + +int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/ +#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) +int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/ +int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */ +int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); /* r = (a * a) mod p */ +int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, + BN_CTX *ctx); /* r = (1 / b) mod p */ +int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */ +int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */ +int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); /* r = sqrt(a) mod p */ +int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); /* r^2 + r = a mod p */ +#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) +/* Some functions allow for representation of the irreducible polynomials + * as an unsigned int[], say p. The irreducible f(t) is then of the form: + * t^p[0] + t^p[1] + ... + t^p[k] + * where m = p[0] > p[1] > ... > p[k] = 0. + */ +int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]); + /* r = a mod p */ +int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */ +int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], + BN_CTX *ctx); /* r = (a * a) mod p */ +int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[], + BN_CTX *ctx); /* r = (1 / b) mod p */ +int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */ +int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */ +int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, + const unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */ +int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, + const unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */ +int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max); +int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a); + +/* faster mod functions for the 'NIST primes' + * 0 <= a < p^2 */ +int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +const BIGNUM *BN_get0_nist_prime_192(void); +const BIGNUM *BN_get0_nist_prime_224(void); +const BIGNUM *BN_get0_nist_prime_256(void); +const BIGNUM *BN_get0_nist_prime_384(void); +const BIGNUM *BN_get0_nist_prime_521(void); + +/* library internal functions */ + +#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ + (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) +#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) +BIGNUM *bn_expand2(BIGNUM *a, int words); +#ifndef OPENSSL_NO_DEPRECATED +BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ +#endif + +/* Bignum consistency macros + * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from + * bignum data after direct manipulations on the data. There is also an + * "internal" macro, bn_check_top(), for verifying that there are no leading + * zeroes. Unfortunately, some auditing is required due to the fact that + * bn_fix_top() has become an overabused duct-tape because bignum data is + * occasionally passed around in an inconsistent state. So the following + * changes have been made to sort this out; + * - bn_fix_top()s implementation has been moved to bn_correct_top() + * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and + * bn_check_top() is as before. + * - if BN_DEBUG *is* defined; + * - bn_check_top() tries to pollute unused words even if the bignum 'top' is + * consistent. (ed: only if BN_DEBUG_RAND is defined) + * - bn_fix_top() maps to bn_check_top() rather than "fixing" anything. + * The idea is to have debug builds flag up inconsistent bignums when they + * occur. If that occurs in a bn_fix_top(), we examine the code in question; if + * the use of bn_fix_top() was appropriate (ie. it follows directly after code + * that manipulates the bignum) it is converted to bn_correct_top(), and if it + * was not appropriate, we convert it permanently to bn_check_top() and track + * down the cause of the bug. Eventually, no internal code should be using the + * bn_fix_top() macro. External applications and libraries should try this with + * their own code too, both in terms of building against the openssl headers + * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it + * defined. This not only improves external code, it provides more test + * coverage for openssl's own code. + */ + +#ifdef BN_DEBUG + +/* We only need assert() when debugging */ +#include + +#ifdef BN_DEBUG_RAND +/* To avoid "make update" cvs wars due to BN_DEBUG, use some tricks */ +#ifndef RAND_pseudo_bytes +int RAND_pseudo_bytes(unsigned char *buf,int num); +#define BN_DEBUG_TRIX +#endif +#define bn_pollute(a) \ + do { \ + const BIGNUM *_bnum1 = (a); \ + if(_bnum1->top < _bnum1->dmax) { \ + unsigned char _tmp_char; \ + /* We cast away const without the compiler knowing, any \ + * *genuinely* constant variables that aren't mutable \ + * wouldn't be constructed with top!=dmax. */ \ + BN_ULONG *_not_const; \ + memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \ + RAND_pseudo_bytes(&_tmp_char, 1); \ + memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \ + (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \ + } \ + } while(0) +#ifdef BN_DEBUG_TRIX +#undef RAND_pseudo_bytes +#endif +#else +#define bn_pollute(a) +#endif +#define bn_check_top(a) \ + do { \ + const BIGNUM *_bnum2 = (a); \ + if (_bnum2 != NULL) { \ + assert((_bnum2->top == 0) || \ + (_bnum2->d[_bnum2->top - 1] != 0)); \ + bn_pollute(_bnum2); \ + } \ + } while(0) + +#define bn_fix_top(a) bn_check_top(a) + +#else /* !BN_DEBUG */ + +#define bn_pollute(a) +#define bn_check_top(a) +#define bn_fix_top(a) bn_correct_top(a) + +#endif + +#define bn_correct_top(a) \ + { \ + BN_ULONG *ftl; \ + if ((a)->top > 0) \ + { \ + for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \ + if (*(ftl--)) break; \ + } \ + bn_pollute(a); \ + } + +BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num); +BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); +BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num); +BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num); + +/* Primes from RFC 2409 */ +BIGNUM *get_rfc2409_prime_768(BIGNUM *bn); +BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn); + +/* Primes from RFC 3526 */ +BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn); +BIGNUM *get_rfc3526_prime_2048(BIGNUM *bn); +BIGNUM *get_rfc3526_prime_3072(BIGNUM *bn); +BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn); +BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn); +BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn); + +int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BN_strings(void); + +/* Error codes for the BN functions. */ + +/* Function codes. */ +#define BN_F_BNRAND 127 +#define BN_F_BN_BLINDING_CONVERT_EX 100 +#define BN_F_BN_BLINDING_CREATE_PARAM 128 +#define BN_F_BN_BLINDING_INVERT_EX 101 +#define BN_F_BN_BLINDING_NEW 102 +#define BN_F_BN_BLINDING_UPDATE 103 +#define BN_F_BN_BN2DEC 104 +#define BN_F_BN_BN2HEX 105 +#define BN_F_BN_CTX_GET 116 +#define BN_F_BN_CTX_NEW 106 +#define BN_F_BN_CTX_START 129 +#define BN_F_BN_DIV 107 +#define BN_F_BN_DIV_NO_BRANCH 138 +#define BN_F_BN_DIV_RECP 130 +#define BN_F_BN_EXP 123 +#define BN_F_BN_EXPAND2 108 +#define BN_F_BN_EXPAND_INTERNAL 120 +#define BN_F_BN_GF2M_MOD 131 +#define BN_F_BN_GF2M_MOD_EXP 132 +#define BN_F_BN_GF2M_MOD_MUL 133 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135 +#define BN_F_BN_GF2M_MOD_SQR 136 +#define BN_F_BN_GF2M_MOD_SQRT 137 +#define BN_F_BN_MOD_EXP2_MONT 118 +#define BN_F_BN_MOD_EXP_MONT 109 +#define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124 +#define BN_F_BN_MOD_EXP_MONT_WORD 117 +#define BN_F_BN_MOD_EXP_RECP 125 +#define BN_F_BN_MOD_EXP_SIMPLE 126 +#define BN_F_BN_MOD_INVERSE 110 +#define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 +#define BN_F_BN_MOD_LSHIFT_QUICK 119 +#define BN_F_BN_MOD_MUL_RECIPROCAL 111 +#define BN_F_BN_MOD_SQRT 121 +#define BN_F_BN_MPI2BN 112 +#define BN_F_BN_NEW 113 +#define BN_F_BN_RAND 114 +#define BN_F_BN_RAND_RANGE 122 +#define BN_F_BN_USUB 115 + +/* Reason codes. */ +#define BN_R_ARG2_LT_ARG3 100 +#define BN_R_BAD_RECIPROCAL 101 +#define BN_R_BIGNUM_TOO_LONG 114 +#define BN_R_CALLED_WITH_EVEN_MODULUS 102 +#define BN_R_DIV_BY_ZERO 103 +#define BN_R_ENCODING_ERROR 104 +#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +#define BN_R_INPUT_NOT_REDUCED 110 +#define BN_R_INVALID_LENGTH 106 +#define BN_R_INVALID_RANGE 115 +#define BN_R_NOT_A_SQUARE 111 +#define BN_R_NOT_INITIALIZED 107 +#define BN_R_NO_INVERSE 108 +#define BN_R_NO_SOLUTION 116 +#define BN_R_P_IS_NOT_PRIME 112 +#define BN_R_TOO_MANY_ITERATIONS 113 +#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/buffer.h b/externals/openssl/buffer.h new file mode 100644 index 0000000..669bc5e --- /dev/null +++ b/externals/openssl/buffer.h @@ -0,0 +1,119 @@ +/* crypto/buffer/buffer.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BUFFER_H +#define HEADER_BUFFER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if !defined(NO_SYS_TYPES_H) +#include +#endif + +/* Already declared in ossl_typ.h */ +/* typedef struct buf_mem_st BUF_MEM; */ + +struct buf_mem_st + { + int length; /* current number of bytes */ + char *data; + int max; /* size of buffer */ + }; + +BUF_MEM *BUF_MEM_new(void); +void BUF_MEM_free(BUF_MEM *a); +int BUF_MEM_grow(BUF_MEM *str, int len); +int BUF_MEM_grow_clean(BUF_MEM *str, int len); +char * BUF_strdup(const char *str); +char * BUF_strndup(const char *str, size_t siz); +void * BUF_memdup(const void *data, size_t siz); + +/* safe string functions */ +size_t BUF_strlcpy(char *dst,const char *src,size_t siz); +size_t BUF_strlcat(char *dst,const char *src,size_t siz); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_BUF_strings(void); + +/* Error codes for the BUF functions. */ + +/* Function codes. */ +#define BUF_F_BUF_MEMDUP 103 +#define BUF_F_BUF_MEM_GROW 100 +#define BUF_F_BUF_MEM_GROW_CLEAN 105 +#define BUF_F_BUF_MEM_NEW 101 +#define BUF_F_BUF_STRDUP 102 +#define BUF_F_BUF_STRNDUP 104 + +/* Reason codes. */ + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/cast.h b/externals/openssl/cast.h new file mode 100644 index 0000000..1faf580 --- /dev/null +++ b/externals/openssl/cast.h @@ -0,0 +1,107 @@ +/* crypto/cast/cast.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CAST_H +#define HEADER_CAST_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef OPENSSL_NO_CAST +#error CAST is disabled. +#endif + +#define CAST_ENCRYPT 1 +#define CAST_DECRYPT 0 + +#define CAST_LONG unsigned long + +#define CAST_BLOCK 8 +#define CAST_KEY_LENGTH 16 + +typedef struct cast_key_st + { + CAST_LONG data[32]; + int short_key; /* Use reduced rounds for short key */ + } CAST_KEY; + +#ifdef OPENSSL_FIPS +void private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); +#endif +void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); +void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key, + int enc); +void CAST_encrypt(CAST_LONG *data,CAST_KEY *key); +void CAST_decrypt(CAST_LONG *data,CAST_KEY *key); +void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + CAST_KEY *ks, unsigned char *iv, int enc); +void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, CAST_KEY *schedule, unsigned char *ivec, + int *num, int enc); +void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, CAST_KEY *schedule, unsigned char *ivec, + int *num); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/comp.h b/externals/openssl/comp.h new file mode 100644 index 0000000..4b405c7 --- /dev/null +++ b/externals/openssl/comp.h @@ -0,0 +1,80 @@ + +#ifndef HEADER_COMP_H +#define HEADER_COMP_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct comp_ctx_st COMP_CTX; + +typedef struct comp_method_st + { + int type; /* NID for compression library */ + const char *name; /* A text string to identify the library */ + int (*init)(COMP_CTX *ctx); + void (*finish)(COMP_CTX *ctx); + int (*compress)(COMP_CTX *ctx, + unsigned char *out, unsigned int olen, + unsigned char *in, unsigned int ilen); + int (*expand)(COMP_CTX *ctx, + unsigned char *out, unsigned int olen, + unsigned char *in, unsigned int ilen); + /* The following two do NOTHING, but are kept for backward compatibility */ + long (*ctrl)(void); + long (*callback_ctrl)(void); + } COMP_METHOD; + +struct comp_ctx_st + { + COMP_METHOD *meth; + unsigned long compress_in; + unsigned long compress_out; + unsigned long expand_in; + unsigned long expand_out; + + CRYPTO_EX_DATA ex_data; + }; + + +COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); +void COMP_CTX_free(COMP_CTX *ctx); +int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +COMP_METHOD *COMP_rle(void ); +COMP_METHOD *COMP_zlib(void ); +void COMP_zlib_cleanup(void); + +#ifdef HEADER_BIO_H +#ifdef ZLIB +BIO_METHOD *BIO_f_zlib(void); +#endif +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_COMP_strings(void); + +/* Error codes for the COMP functions. */ + +/* Function codes. */ +#define COMP_F_BIO_ZLIB_FLUSH 99 +#define COMP_F_BIO_ZLIB_NEW 100 +#define COMP_F_BIO_ZLIB_READ 101 +#define COMP_F_BIO_ZLIB_WRITE 102 + +/* Reason codes. */ +#define COMP_R_ZLIB_DEFLATE_ERROR 99 +#define COMP_R_ZLIB_INFLATE_ERROR 100 +#define COMP_R_ZLIB_NOT_SUPPORTED 101 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/conf.h b/externals/openssl/conf.h new file mode 100644 index 0000000..8aa06bc --- /dev/null +++ b/externals/openssl/conf.h @@ -0,0 +1,254 @@ +/* crypto/conf/conf.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CONF_H +#define HEADER_CONF_H + +#include +#include +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct + { + char *section; + char *name; + char *value; + } CONF_VALUE; + +DECLARE_STACK_OF(CONF_VALUE) +DECLARE_STACK_OF(CONF_MODULE) +DECLARE_STACK_OF(CONF_IMODULE) + +struct conf_st; +struct conf_method_st; +typedef struct conf_method_st CONF_METHOD; + +struct conf_method_st + { + const char *name; + CONF *(*create)(CONF_METHOD *meth); + int (*init)(CONF *conf); + int (*destroy)(CONF *conf); + int (*destroy_data)(CONF *conf); + int (*load_bio)(CONF *conf, BIO *bp, long *eline); + int (*dump)(const CONF *conf, BIO *bp); + int (*is_number)(const CONF *conf, char c); + int (*to_int)(const CONF *conf, char c); + int (*load)(CONF *conf, const char *name, long *eline); + }; + +/* Module definitions */ + +typedef struct conf_imodule_st CONF_IMODULE; +typedef struct conf_module_st CONF_MODULE; + +/* DSO module function typedefs */ +typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf); +typedef void conf_finish_func(CONF_IMODULE *md); + +#define CONF_MFLAGS_IGNORE_ERRORS 0x1 +#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 +#define CONF_MFLAGS_SILENT 0x4 +#define CONF_MFLAGS_NO_DSO 0x8 +#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +#define CONF_MFLAGS_DEFAULT_SECTION 0x20 + +int CONF_set_default_method(CONF_METHOD *meth); +void CONF_set_nconf(CONF *conf,LHASH *hash); +LHASH *CONF_load(LHASH *conf,const char *file,long *eline); +#ifndef OPENSSL_NO_FP_API +LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline); +#endif +LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section); +char *CONF_get_string(LHASH *conf,const char *group,const char *name); +long CONF_get_number(LHASH *conf,const char *group,const char *name); +void CONF_free(LHASH *conf); +int CONF_dump_fp(LHASH *conf, FILE *out); +int CONF_dump_bio(LHASH *conf, BIO *out); + +void OPENSSL_config(const char *config_name); +void OPENSSL_no_config(void); + +/* New conf code. The semantics are different from the functions above. + If that wasn't the case, the above functions would have been replaced */ + +struct conf_st + { + CONF_METHOD *meth; + void *meth_data; + LHASH *data; + }; + +CONF *NCONF_new(CONF_METHOD *meth); +CONF_METHOD *NCONF_default(void); +CONF_METHOD *NCONF_WIN32(void); +#if 0 /* Just to give you an idea of what I have in mind */ +CONF_METHOD *NCONF_XML(void); +#endif +void NCONF_free(CONF *conf); +void NCONF_free_data(CONF *conf); + +int NCONF_load(CONF *conf,const char *file,long *eline); +#ifndef OPENSSL_NO_FP_API +int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); +#endif +int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); +char *NCONF_get_string(const CONF *conf,const char *group,const char *name); +int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, + long *result); +int NCONF_dump_fp(const CONF *conf, FILE *out); +int NCONF_dump_bio(const CONF *conf, BIO *out); + +#if 0 /* The following function has no error checking, + and should therefore be avoided */ +long NCONF_get_number(CONF *conf,char *group,char *name); +#else +#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) +#endif + +/* Module functions */ + +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); +void CONF_modules_unload(int all); +void CONF_modules_finish(void); +void CONF_modules_free(void); +int CONF_module_add(const char *name, conf_init_func *ifunc, + conf_finish_func *ffunc); + +const char *CONF_imodule_get_name(const CONF_IMODULE *md); +const char *CONF_imodule_get_value(const CONF_IMODULE *md); +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); +void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); +void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); +void *CONF_module_get_usr_data(CONF_MODULE *pmod); +void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); + +char *CONF_get1_default_config_file(void); + +int CONF_parse_list(const char *list, int sep, int nospc, + int (*list_cb)(const char *elem, int len, void *usr), void *arg); + +void OPENSSL_load_builtin_modules(void); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_CONF_strings(void); + +/* Error codes for the CONF functions. */ + +/* Function codes. */ +#define CONF_F_CONF_DUMP_FP 104 +#define CONF_F_CONF_LOAD 100 +#define CONF_F_CONF_LOAD_BIO 102 +#define CONF_F_CONF_LOAD_FP 103 +#define CONF_F_CONF_MODULES_LOAD 116 +#define CONF_F_DEF_LOAD 120 +#define CONF_F_DEF_LOAD_BIO 121 +#define CONF_F_MODULE_INIT 115 +#define CONF_F_MODULE_LOAD_DSO 117 +#define CONF_F_MODULE_RUN 118 +#define CONF_F_NCONF_DUMP_BIO 105 +#define CONF_F_NCONF_DUMP_FP 106 +#define CONF_F_NCONF_GET_NUMBER 107 +#define CONF_F_NCONF_GET_NUMBER_E 112 +#define CONF_F_NCONF_GET_SECTION 108 +#define CONF_F_NCONF_GET_STRING 109 +#define CONF_F_NCONF_LOAD 113 +#define CONF_F_NCONF_LOAD_BIO 110 +#define CONF_F_NCONF_LOAD_FP 114 +#define CONF_F_NCONF_NEW 111 +#define CONF_F_STR_COPY 101 + +/* Reason codes. */ +#define CONF_R_ERROR_LOADING_DSO 110 +#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +#define CONF_R_MISSING_EQUAL_SIGN 101 +#define CONF_R_MISSING_FINISH_FUNCTION 111 +#define CONF_R_MISSING_INIT_FUNCTION 112 +#define CONF_R_MODULE_INITIALIZATION_ERROR 109 +#define CONF_R_NO_CLOSE_BRACE 102 +#define CONF_R_NO_CONF 105 +#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 +#define CONF_R_NO_SECTION 107 +#define CONF_R_NO_SUCH_FILE 114 +#define CONF_R_NO_VALUE 108 +#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +#define CONF_R_UNKNOWN_MODULE_NAME 113 +#define CONF_R_VARIABLE_HAS_NO_VALUE 104 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/conf_api.h b/externals/openssl/conf_api.h new file mode 100644 index 0000000..ffe5ccd --- /dev/null +++ b/externals/openssl/conf_api.h @@ -0,0 +1,90 @@ +/* conf_api.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CONF_API_H +#define HEADER_CONF_API_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Up until OpenSSL 0.9.5a, this was new_section */ +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was get_section */ +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section); + +int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); +char *_CONF_get_string(const CONF *conf, const char *section, + const char *name); +long _CONF_get_number(const CONF *conf, const char *section, const char *name); + +int _CONF_new_data(CONF *conf); +void _CONF_free_data(CONF *conf); + +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/externals/openssl/crypto.h b/externals/openssl/crypto.h new file mode 100644 index 0000000..0e4fb07 --- /dev/null +++ b/externals/openssl/crypto.h @@ -0,0 +1,619 @@ +/* crypto/crypto.h */ +/* ==================================================================== + * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_CRYPTO_H +#define HEADER_CRYPTO_H + +#include + +#include + +#ifndef OPENSSL_NO_FP_API +#include +#endif + +#include +#include +#include +#include + +#ifdef CHARSET_EBCDIC +#include +#endif + +/* Resolve problems on some operating systems with symbol names that clash + one way or another */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Backward compatibility to SSLeay */ +/* This is more to be used to check the correct DLL is being used + * in the MS world. */ +#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +#define SSLEAY_VERSION 0 +/* #define SSLEAY_OPTIONS 1 no longer supported */ +#define SSLEAY_CFLAGS 2 +#define SSLEAY_BUILT_ON 3 +#define SSLEAY_PLATFORM 4 +#define SSLEAY_DIR 5 + +/* Already declared in ossl_typ.h */ +#if 0 +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; +/* Called when a new object is created */ +typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +/* Called when an object is free()ed */ +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +/* Called when we need to dup an object */ +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, + int idx, long argl, void *argp); +#endif + +/* A generic structure to pass assorted data in a expandable way */ +typedef struct openssl_item_st + { + int code; + void *value; /* Not used for flag attributes */ + size_t value_size; /* Max size of value for output, length for input */ + size_t *value_length; /* Returned length of value for output */ + } OPENSSL_ITEM; + + +/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock + * names in cryptlib.c + */ + +#define CRYPTO_LOCK_ERR 1 +#define CRYPTO_LOCK_EX_DATA 2 +#define CRYPTO_LOCK_X509 3 +#define CRYPTO_LOCK_X509_INFO 4 +#define CRYPTO_LOCK_X509_PKEY 5 +#define CRYPTO_LOCK_X509_CRL 6 +#define CRYPTO_LOCK_X509_REQ 7 +#define CRYPTO_LOCK_DSA 8 +#define CRYPTO_LOCK_RSA 9 +#define CRYPTO_LOCK_EVP_PKEY 10 +#define CRYPTO_LOCK_X509_STORE 11 +#define CRYPTO_LOCK_SSL_CTX 12 +#define CRYPTO_LOCK_SSL_CERT 13 +#define CRYPTO_LOCK_SSL_SESSION 14 +#define CRYPTO_LOCK_SSL_SESS_CERT 15 +#define CRYPTO_LOCK_SSL 16 +#define CRYPTO_LOCK_SSL_METHOD 17 +#define CRYPTO_LOCK_RAND 18 +#define CRYPTO_LOCK_RAND2 19 +#define CRYPTO_LOCK_MALLOC 20 +#define CRYPTO_LOCK_BIO 21 +#define CRYPTO_LOCK_GETHOSTBYNAME 22 +#define CRYPTO_LOCK_GETSERVBYNAME 23 +#define CRYPTO_LOCK_READDIR 24 +#define CRYPTO_LOCK_RSA_BLINDING 25 +#define CRYPTO_LOCK_DH 26 +#define CRYPTO_LOCK_MALLOC2 27 +#define CRYPTO_LOCK_DSO 28 +#define CRYPTO_LOCK_DYNLOCK 29 +#define CRYPTO_LOCK_ENGINE 30 +#define CRYPTO_LOCK_UI 31 +#define CRYPTO_LOCK_ECDSA 32 +#define CRYPTO_LOCK_EC 33 +#define CRYPTO_LOCK_ECDH 34 +#define CRYPTO_LOCK_BN 35 +#define CRYPTO_LOCK_EC_PRE_COMP 36 +#define CRYPTO_LOCK_STORE 37 +#define CRYPTO_LOCK_COMP 38 +#ifndef OPENSSL_FIPS +#define CRYPTO_NUM_LOCKS 39 +#else +#define CRYPTO_LOCK_FIPS 39 +#define CRYPTO_LOCK_FIPS2 40 +#define CRYPTO_NUM_LOCKS 41 +#endif + +#define CRYPTO_LOCK 1 +#define CRYPTO_UNLOCK 2 +#define CRYPTO_READ 4 +#define CRYPTO_WRITE 8 + +#ifndef OPENSSL_NO_LOCKING +#ifndef CRYPTO_w_lock +#define CRYPTO_w_lock(type) \ + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) +#define CRYPTO_w_unlock(type) \ + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) +#define CRYPTO_r_lock(type) \ + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) +#define CRYPTO_r_unlock(type) \ + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) +#define CRYPTO_add(addr,amount,type) \ + CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) +#endif +#else +#define CRYPTO_w_lock(a) +#define CRYPTO_w_unlock(a) +#define CRYPTO_r_lock(a) +#define CRYPTO_r_unlock(a) +#define CRYPTO_add(a,b,c) ((*(a))+=(b)) +#endif + +/* Some applications as well as some parts of OpenSSL need to allocate + and deallocate locks in a dynamic fashion. The following typedef + makes this possible in a type-safe manner. */ +/* struct CRYPTO_dynlock_value has to be defined by the application. */ +typedef struct + { + int references; + struct CRYPTO_dynlock_value *data; + } CRYPTO_dynlock; + + +/* The following can be used to detect memory leaks in the SSLeay library. + * It used, it turns on malloc checking */ + +#define CRYPTO_MEM_CHECK_OFF 0x0 /* an enume */ +#define CRYPTO_MEM_CHECK_ON 0x1 /* a bit */ +#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* a bit */ +#define CRYPTO_MEM_CHECK_DISABLE 0x3 /* an enume */ + +/* The following are bit values to turn on or off options connected to the + * malloc checking functionality */ + +/* Adds time to the memory checking information */ +#define V_CRYPTO_MDEBUG_TIME 0x1 /* a bit */ +/* Adds thread number to the memory checking information */ +#define V_CRYPTO_MDEBUG_THREAD 0x2 /* a bit */ + +#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD) + + +/* predec of the BIO type */ +typedef struct bio_st BIO_dummy; + +struct crypto_ex_data_st + { + STACK *sk; + int dummy; /* gcc is screwing up this data structure :-( */ + }; + +/* This stuff is basically class callback functions + * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */ + +typedef struct crypto_ex_data_func_st + { + long argl; /* Arbitary long */ + void *argp; /* Arbitary void * */ + CRYPTO_EX_new *new_func; + CRYPTO_EX_free *free_func; + CRYPTO_EX_dup *dup_func; + } CRYPTO_EX_DATA_FUNCS; + +DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) + +/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA + * entry. + */ + +#define CRYPTO_EX_INDEX_BIO 0 +#define CRYPTO_EX_INDEX_SSL 1 +#define CRYPTO_EX_INDEX_SSL_CTX 2 +#define CRYPTO_EX_INDEX_SSL_SESSION 3 +#define CRYPTO_EX_INDEX_X509_STORE 4 +#define CRYPTO_EX_INDEX_X509_STORE_CTX 5 +#define CRYPTO_EX_INDEX_RSA 6 +#define CRYPTO_EX_INDEX_DSA 7 +#define CRYPTO_EX_INDEX_DH 8 +#define CRYPTO_EX_INDEX_ENGINE 9 +#define CRYPTO_EX_INDEX_X509 10 +#define CRYPTO_EX_INDEX_UI 11 +#define CRYPTO_EX_INDEX_ECDSA 12 +#define CRYPTO_EX_INDEX_ECDH 13 +#define CRYPTO_EX_INDEX_COMP 14 +#define CRYPTO_EX_INDEX_STORE 15 + +/* Dynamically assigned indexes start from this value (don't use directly, use + * via CRYPTO_ex_data_new_class). */ +#define CRYPTO_EX_INDEX_USER 100 + + +/* This is the default callbacks, but we can have others as well: + * this is needed in Win32 where the application malloc and the + * library malloc may not be the same. + */ +#define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\ + malloc, realloc, free) + +#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD +# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */ +# define CRYPTO_MDEBUG +# endif +#endif + +/* Set standard debugging functions (not done by default + * unless CRYPTO_MDEBUG is defined) */ +void CRYPTO_malloc_debug_init(void); + +int CRYPTO_mem_ctrl(int mode); +int CRYPTO_is_mem_check_on(void); + +/* for applications */ +#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) +#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF) + +/* for library-internal use */ +#define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE) +#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) +#define is_MemCheck_on() CRYPTO_is_mem_check_on() + +#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) +#define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__) +#define OPENSSL_realloc(addr,num) \ + CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) +#define OPENSSL_realloc_clean(addr,old_num,num) \ + CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__) +#define OPENSSL_remalloc(addr,num) \ + CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__) +#define OPENSSL_freeFunc CRYPTO_free +#define OPENSSL_free(addr) CRYPTO_free(addr) + +#define OPENSSL_malloc_locked(num) \ + CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) +#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) + + +const char *SSLeay_version(int type); +unsigned long SSLeay(void); + +int OPENSSL_issetugid(void); + +/* An opaque type representing an implementation of "ex_data" support */ +typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL; +/* Return an opaque pointer to the current "ex_data" implementation */ +const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void); +/* Sets the "ex_data" implementation to be used (if it's not too late) */ +int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i); +/* Get a new "ex_data" class, and return the corresponding "class_index" */ +int CRYPTO_ex_data_new_class(void); +/* Within a given class, get/register a new index */ +int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, + CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +/* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given + * class (invokes whatever per-class callbacks are applicable) */ +int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, + CRYPTO_EX_DATA *from); +void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +/* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index + * (relative to the class type involved) */ +int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); +void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx); +/* This function cleans up all "ex_data" state. It mustn't be called under + * potential race-conditions. */ +void CRYPTO_cleanup_all_ex_data(void); + +int CRYPTO_get_new_lockid(char *name); + +int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */ +void CRYPTO_lock(int mode, int type,const char *file,int line); +void CRYPTO_set_locking_callback(void (*func)(int mode,int type, + const char *file,int line)); +void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file, + int line); +void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, + const char *file, int line)); +int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, + const char *file,int line); +void CRYPTO_set_id_callback(unsigned long (*func)(void)); +unsigned long (*CRYPTO_get_id_callback(void))(void); +unsigned long CRYPTO_thread_id(void); +const char *CRYPTO_get_lock_name(int type); +int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, + int line); + +void int_CRYPTO_set_do_dynlock_callback( + void (*do_dynlock_cb)(int mode, int type, const char *file, int line)); + +int CRYPTO_get_new_dynlockid(void); +void CRYPTO_destroy_dynlockid(int i); +struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); +void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line)); +void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)); +void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line)); +struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line); +void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line); +void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line); + +/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- + * call the latter last if you need different functions */ +int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *)); +int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *)); +int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int), + void *(*r)(void *,size_t,const char *,int), + void (*f)(void *)); +int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int), + void (*free_func)(void *)); +int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), + void (*r)(void *,void *,int,const char *,int,int), + void (*f)(void *,int), + void (*so)(long), + long (*go)(void)); +void CRYPTO_set_mem_info_functions( + int (*push_info_fn)(const char *info, const char *file, int line), + int (*pop_info_fn)(void), + int (*remove_all_info_fn)(void)); +void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *)); +void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)); +void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int), + void *(**r)(void *, size_t,const char *,int), + void (**f)(void *)); +void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int), + void (**f)(void *)); +void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), + void (**r)(void *,void *,int,const char *,int,int), + void (**f)(void *,int), + void (**so)(long), + long (**go)(void)); + +void *CRYPTO_malloc_locked(int num, const char *file, int line); +void CRYPTO_free_locked(void *); +void *CRYPTO_malloc(int num, const char *file, int line); +char *CRYPTO_strdup(const char *str, const char *file, int line); +void CRYPTO_free(void *); +void *CRYPTO_realloc(void *addr,int num, const char *file, int line); +void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, + int line); +void *CRYPTO_remalloc(void *addr,int num, const char *file, int line); + +void OPENSSL_cleanse(void *ptr, size_t len); + +void CRYPTO_set_mem_debug_options(long bits); +long CRYPTO_get_mem_debug_options(void); + +#define CRYPTO_push_info(info) \ + CRYPTO_push_info_(info, __FILE__, __LINE__); +int CRYPTO_push_info_(const char *info, const char *file, int line); +int CRYPTO_pop_info(void); +int CRYPTO_remove_all_info(void); + + +/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro; + * used as default in CRYPTO_MDEBUG compilations): */ +/* The last argument has the following significance: + * + * 0: called before the actual memory allocation has taken place + * 1: called after the actual memory allocation has taken place + */ +void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p); +void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p); +void CRYPTO_dbg_free(void *addr,int before_p); +/* Tell the debugging code about options. By default, the following values + * apply: + * + * 0: Clear all options. + * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option. + * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option. + * V_CRYPTO_MDEBUG_ALL (3): 1 + 2 + */ +void CRYPTO_dbg_set_options(long bits); +long CRYPTO_dbg_get_options(void); + +int CRYPTO_dbg_push_info(const char *info, const char *file, int line); +int CRYPTO_dbg_pop_info(void); +int CRYPTO_dbg_remove_all_info(void); + +#ifndef OPENSSL_NO_FP_API +void CRYPTO_mem_leaks_fp(FILE *); +#endif +void CRYPTO_mem_leaks(struct bio_st *bio); +/* unsigned long order, char *file, int line, int num_bytes, char *addr */ +typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *); +void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); + +/* die if we have to */ +void OpenSSLDie(const char *file,int line,const char *assertion); +#define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) + +unsigned long *OPENSSL_ia32cap_loc(void); +#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) +int OPENSSL_isservice(void); + +#ifdef OPENSSL_FIPS +#define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \ + alg " previous FIPS forbidden algorithm error ignored"); + +#define FIPS_BAD_ABORT(alg) OpenSSLDie(__FILE__, __LINE__, \ + #alg " Algorithm forbidden in FIPS mode"); + +#ifdef OPENSSL_FIPS_STRICT +#define FIPS_BAD_ALGORITHM(alg) FIPS_BAD_ABORT(alg) +#else +#define FIPS_BAD_ALGORITHM(alg) \ + { \ + FIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); \ + ERR_add_error_data(2, "Algorithm=", #alg); \ + return 0; \ + } +#endif + +/* Low level digest API blocking macro */ + +#define FIPS_NON_FIPS_MD_Init(alg) \ + int alg##_Init(alg##_CTX *c) \ + { \ + if (FIPS_mode()) \ + FIPS_BAD_ALGORITHM(alg) \ + return private_##alg##_Init(c); \ + } \ + int private_##alg##_Init(alg##_CTX *c) + +/* For ciphers the API often varies from cipher to cipher and each needs to + * be treated as a special case. Variable key length ciphers (Blowfish, RC4, + * CAST) however are very similar and can use a blocking macro. + */ + +#define FIPS_NON_FIPS_VCIPHER_Init(alg) \ + void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) \ + { \ + if (FIPS_mode()) \ + FIPS_BAD_ABORT(alg) \ + private_##alg##_set_key(key, len, data); \ + } \ + void private_##alg##_set_key(alg##_KEY *key, int len, \ + const unsigned char *data) + +#else + +#define FIPS_NON_FIPS_VCIPHER_Init(alg) \ + void alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) + +#define FIPS_NON_FIPS_MD_Init(alg) \ + int alg##_Init(alg##_CTX *c) + +#endif /* def OPENSSL_FIPS */ + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_CRYPTO_strings(void); + +#define OPENSSL_HAVE_INIT 1 +void OPENSSL_init(void); + +/* Error codes for the CRYPTO functions. */ + +/* Function codes. */ +#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 +#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 +#define CRYPTO_F_CRYPTO_SET_EX_DATA 102 +#define CRYPTO_F_DEF_ADD_INDEX 104 +#define CRYPTO_F_DEF_GET_CLASS 105 +#define CRYPTO_F_INT_DUP_EX_DATA 106 +#define CRYPTO_F_INT_FREE_EX_DATA 107 +#define CRYPTO_F_INT_NEW_EX_DATA 108 + +/* Reason codes. */ +#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/des.h b/externals/openssl/des.h new file mode 100644 index 0000000..92b6663 --- /dev/null +++ b/externals/openssl/des.h @@ -0,0 +1,245 @@ +/* crypto/des/des.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_NEW_DES_H +#define HEADER_NEW_DES_H + +#include /* OPENSSL_EXTERN, OPENSSL_NO_DES, + DES_LONG (via openssl/opensslconf.h */ + +#ifdef OPENSSL_NO_DES +#error DES is disabled. +#endif + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned char DES_cblock[8]; +typedef /* const */ unsigned char const_DES_cblock[8]; +/* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * + * and const_DES_cblock * are incompatible pointer types. */ + +typedef struct DES_ks + { + union + { + DES_cblock cblock; + /* make sure things are correct size on machines with + * 8 byte longs */ + DES_LONG deslong[2]; + } ks[16]; + } DES_key_schedule; + +#ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT +# ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT +# define OPENSSL_ENABLE_OLD_DES_SUPPORT +# endif +#endif + +#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT +# include +#endif + +#define DES_KEY_SZ (sizeof(DES_cblock)) +#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) + +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define DES_CBC_MODE 0 +#define DES_PCBC_MODE 1 + +#define DES_ecb2_encrypt(i,o,k1,k2,e) \ + DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +#define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +#define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +#define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +OPENSSL_DECLARE_GLOBAL(int,DES_check_key); /* defaults to false */ +#define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) +OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */ +#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode) + +const char *DES_options(void); +void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks1,DES_key_schedule *ks2, + DES_key_schedule *ks3, int enc); +DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output, + long length,DES_key_schedule *schedule, + const_DES_cblock *ivec); +/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ +void DES_cbc_encrypt(const unsigned char *input,unsigned char *output, + long length,DES_key_schedule *schedule,DES_cblock *ivec, + int enc); +void DES_ncbc_encrypt(const unsigned char *input,unsigned char *output, + long length,DES_key_schedule *schedule,DES_cblock *ivec, + int enc); +void DES_xcbc_encrypt(const unsigned char *input,unsigned char *output, + long length,DES_key_schedule *schedule,DES_cblock *ivec, + const_DES_cblock *inw,const_DES_cblock *outw,int enc); +void DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits, + long length,DES_key_schedule *schedule,DES_cblock *ivec, + int enc); +void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output, + DES_key_schedule *ks,int enc); + +/* This is the DES encryption function that gets called by just about + every other DES routine in the library. You should not use this + function except to implement 'modes' of DES. I say this because the + functions that call this routine do the conversion from 'char *' to + long, and this needs to be done to make sure 'non-aligned' memory + access do not occur. The characters are loaded 'little endian'. + Data is a pointer to 2 unsigned long's and ks is the + DES_key_schedule to use. enc, is non zero specifies encryption, + zero if decryption. */ +void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc); + +/* This functions is the same as DES_encrypt1() except that the DES + initial permutation (IP) and final permutation (FP) have been left + out. As for DES_encrypt1(), you should not use this function. + It is used by the routines in the library that implement triple DES. + IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same + as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */ +void DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc); + +void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, + long length, + DES_key_schedule *ks1,DES_key_schedule *ks2, + DES_key_schedule *ks3,DES_cblock *ivec,int enc); +void DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out, + long length, + DES_key_schedule *ks1,DES_key_schedule *ks2, + DES_key_schedule *ks3, + DES_cblock *ivec1,DES_cblock *ivec2, + int enc); +void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out, + long length,DES_key_schedule *ks1, + DES_key_schedule *ks2,DES_key_schedule *ks3, + DES_cblock *ivec,int *num,int enc); +void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out, + int numbits,long length,DES_key_schedule *ks1, + DES_key_schedule *ks2,DES_key_schedule *ks3, + DES_cblock *ivec,int enc); +void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out, + long length,DES_key_schedule *ks1, + DES_key_schedule *ks2,DES_key_schedule *ks3, + DES_cblock *ivec,int *num); +#if 0 +void DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white, + DES_cblock *out_white); +#endif + +int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched, + DES_cblock *iv); +int DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched, + DES_cblock *iv); +char *DES_fcrypt(const char *buf,const char *salt, char *ret); +char *DES_crypt(const char *buf,const char *salt); +void DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits, + long length,DES_key_schedule *schedule,DES_cblock *ivec); +void DES_pcbc_encrypt(const unsigned char *input,unsigned char *output, + long length,DES_key_schedule *schedule,DES_cblock *ivec, + int enc); +DES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[], + long length,int out_count,DES_cblock *seed); +int DES_random_key(DES_cblock *ret); +void DES_set_odd_parity(DES_cblock *key); +int DES_check_key_parity(const_DES_cblock *key); +int DES_is_weak_key(const_DES_cblock *key); +/* DES_set_key (= set_key = DES_key_sched = key_sched) calls + * DES_set_key_checked if global variable DES_check_key is set, + * DES_set_key_unchecked otherwise. */ +int DES_set_key(const_DES_cblock *key,DES_key_schedule *schedule); +int DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule); +int DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule); +void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule); +void DES_string_to_key(const char *str,DES_cblock *key); +void DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2); +void DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length, + DES_key_schedule *schedule,DES_cblock *ivec,int *num, + int enc); +void DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length, + DES_key_schedule *schedule,DES_cblock *ivec,int *num); + +int DES_read_password(DES_cblock *key, const char *prompt, int verify); +int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt, + int verify); + +#define DES_fixup_key_parity DES_set_odd_parity + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/des_old.h b/externals/openssl/des_old.h new file mode 100644 index 0000000..2b2c372 --- /dev/null +++ b/externals/openssl/des_old.h @@ -0,0 +1,446 @@ +/* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * The function names in here are deprecated and are only present to + * provide an interface compatible with openssl 0.9.6 and older as + * well as libdes. OpenSSL now provides functions where "des_" has + * been replaced with "DES_" in the names, to make it possible to + * make incompatible changes that are needed for C type security and + * other stuff. + * + * This include files has two compatibility modes: + * + * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API + * that is compatible with libdes and SSLeay. + * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an + * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. + * + * Note that these modes break earlier snapshots of OpenSSL, where + * libdes compatibility was the only available mode or (later on) the + * prefered compatibility mode. However, after much consideration + * (and more or less violent discussions with external parties), it + * was concluded that OpenSSL should be compatible with earlier versions + * of itself before anything else. Also, in all honesty, libdes is + * an old beast that shouldn't really be used any more. + * + * Please consider starting to use the DES_ functions rather than the + * des_ ones. The des_ functions will disappear completely before + * OpenSSL 1.0! + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2001. + */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DES_H +#define HEADER_DES_H + +#include /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ + +#ifdef OPENSSL_NO_DES +#error DES is disabled. +#endif + +#ifndef HEADER_NEW_DES_H +#error You must include des.h, not des_old.h directly. +#endif + +#ifdef _KERBEROS_DES_H +#error replaces . +#endif + +#include + +#ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _ +#undef _ +#endif + +typedef unsigned char _ossl_old_des_cblock[8]; +typedef struct _ossl_old_des_ks_struct + { + union { + _ossl_old_des_cblock _; + /* make sure things are correct size on machines with + * 8 byte longs */ + DES_LONG pad[2]; + } ks; + } _ossl_old_des_key_schedule[16]; + +#ifndef OPENSSL_DES_LIBDES_COMPATIBILITY +#define des_cblock DES_cblock +#define const_des_cblock const_DES_cblock +#define des_key_schedule DES_key_schedule +#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ + DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) +#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ + DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) +#define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ + DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) +#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ + DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) +#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ + DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) +#define des_options()\ + DES_options() +#define des_cbc_cksum(i,o,l,k,iv)\ + DES_cbc_cksum((i),(o),(l),&(k),(iv)) +#define des_cbc_encrypt(i,o,l,k,iv,e)\ + DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) +#define des_ncbc_encrypt(i,o,l,k,iv,e)\ + DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) +#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ + DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) +#define des_cfb_encrypt(i,o,n,l,k,iv,e)\ + DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) +#define des_ecb_encrypt(i,o,k,e)\ + DES_ecb_encrypt((i),(o),&(k),(e)) +#define des_encrypt1(d,k,e)\ + DES_encrypt1((d),&(k),(e)) +#define des_encrypt2(d,k,e)\ + DES_encrypt2((d),&(k),(e)) +#define des_encrypt3(d,k1,k2,k3)\ + DES_encrypt3((d),&(k1),&(k2),&(k3)) +#define des_decrypt3(d,k1,k2,k3)\ + DES_decrypt3((d),&(k1),&(k2),&(k3)) +#define des_xwhite_in2out(k,i,o)\ + DES_xwhite_in2out((k),(i),(o)) +#define des_enc_read(f,b,l,k,iv)\ + DES_enc_read((f),(b),(l),&(k),(iv)) +#define des_enc_write(f,b,l,k,iv)\ + DES_enc_write((f),(b),(l),&(k),(iv)) +#define des_fcrypt(b,s,r)\ + DES_fcrypt((b),(s),(r)) +#if 0 +#define des_crypt(b,s)\ + DES_crypt((b),(s)) +#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) +#define crypt(b,s)\ + DES_crypt((b),(s)) +#endif +#endif +#define des_ofb_encrypt(i,o,n,l,k,iv)\ + DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) +#define des_pcbc_encrypt(i,o,l,k,iv,e)\ + DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) +#define des_quad_cksum(i,o,l,c,s)\ + DES_quad_cksum((i),(o),(l),(c),(s)) +#define des_random_seed(k)\ + _ossl_096_des_random_seed((k)) +#define des_random_key(r)\ + DES_random_key((r)) +#define des_read_password(k,p,v) \ + DES_read_password((k),(p),(v)) +#define des_read_2passwords(k1,k2,p,v) \ + DES_read_2passwords((k1),(k2),(p),(v)) +#define des_set_odd_parity(k)\ + DES_set_odd_parity((k)) +#define des_check_key_parity(k)\ + DES_check_key_parity((k)) +#define des_is_weak_key(k)\ + DES_is_weak_key((k)) +#define des_set_key(k,ks)\ + DES_set_key((k),&(ks)) +#define des_key_sched(k,ks)\ + DES_key_sched((k),&(ks)) +#define des_set_key_checked(k,ks)\ + DES_set_key_checked((k),&(ks)) +#define des_set_key_unchecked(k,ks)\ + DES_set_key_unchecked((k),&(ks)) +#define des_string_to_key(s,k)\ + DES_string_to_key((s),(k)) +#define des_string_to_2keys(s,k1,k2)\ + DES_string_to_2keys((s),(k1),(k2)) +#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ + DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) +#define des_ofb64_encrypt(i,o,l,ks,iv,n)\ + DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) + + +#define des_ecb2_encrypt(i,o,k1,k2,e) \ + des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +#define des_check_key DES_check_key +#define des_rw_mode DES_rw_mode +#else /* libdes compatibility */ +/* Map all symbol names to _ossl_old_des_* form, so we avoid all + clashes with libdes */ +#define des_cblock _ossl_old_des_cblock +#define des_key_schedule _ossl_old_des_key_schedule +#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ + _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) +#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ + _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) +#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ + _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) +#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ + _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) +#define des_options()\ + _ossl_old_des_options() +#define des_cbc_cksum(i,o,l,k,iv)\ + _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) +#define des_cbc_encrypt(i,o,l,k,iv,e)\ + _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) +#define des_ncbc_encrypt(i,o,l,k,iv,e)\ + _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) +#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ + _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) +#define des_cfb_encrypt(i,o,n,l,k,iv,e)\ + _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) +#define des_ecb_encrypt(i,o,k,e)\ + _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) +#define des_encrypt(d,k,e)\ + _ossl_old_des_encrypt((d),(k),(e)) +#define des_encrypt2(d,k,e)\ + _ossl_old_des_encrypt2((d),(k),(e)) +#define des_encrypt3(d,k1,k2,k3)\ + _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) +#define des_decrypt3(d,k1,k2,k3)\ + _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) +#define des_xwhite_in2out(k,i,o)\ + _ossl_old_des_xwhite_in2out((k),(i),(o)) +#define des_enc_read(f,b,l,k,iv)\ + _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) +#define des_enc_write(f,b,l,k,iv)\ + _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) +#define des_fcrypt(b,s,r)\ + _ossl_old_des_fcrypt((b),(s),(r)) +#define des_crypt(b,s)\ + _ossl_old_des_crypt((b),(s)) +#if 0 +#define crypt(b,s)\ + _ossl_old_crypt((b),(s)) +#endif +#define des_ofb_encrypt(i,o,n,l,k,iv)\ + _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) +#define des_pcbc_encrypt(i,o,l,k,iv,e)\ + _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) +#define des_quad_cksum(i,o,l,c,s)\ + _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) +#define des_random_seed(k)\ + _ossl_old_des_random_seed((k)) +#define des_random_key(r)\ + _ossl_old_des_random_key((r)) +#define des_read_password(k,p,v) \ + _ossl_old_des_read_password((k),(p),(v)) +#define des_read_2passwords(k1,k2,p,v) \ + _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) +#define des_set_odd_parity(k)\ + _ossl_old_des_set_odd_parity((k)) +#define des_is_weak_key(k)\ + _ossl_old_des_is_weak_key((k)) +#define des_set_key(k,ks)\ + _ossl_old_des_set_key((k),(ks)) +#define des_key_sched(k,ks)\ + _ossl_old_des_key_sched((k),(ks)) +#define des_string_to_key(s,k)\ + _ossl_old_des_string_to_key((s),(k)) +#define des_string_to_2keys(s,k1,k2)\ + _ossl_old_des_string_to_2keys((s),(k1),(k2)) +#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ + _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) +#define des_ofb64_encrypt(i,o,l,ks,iv,n)\ + _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) + + +#define des_ecb2_encrypt(i,o,k1,k2,e) \ + des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +#define des_check_key DES_check_key +#define des_rw_mode DES_rw_mode +#endif + +const char *_ossl_old_des_options(void); +void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, + _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, int enc); +DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, + long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); +void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, + _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); +void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, + _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); +void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, + _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec, + _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc); +void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, + long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); +void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, + _ossl_old_des_key_schedule ks,int enc); +void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); +void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); +void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); +void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, + _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); +void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, + long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc); +void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, + long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc); +void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, + long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, + _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num); +#if 0 +void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), + _ossl_old_des_cblock (*out_white)); +#endif + +int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, + _ossl_old_des_cblock *iv); +int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, + _ossl_old_des_cblock *iv); +char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret); +char *_ossl_old_des_crypt(const char *buf,const char *salt); +#if !defined(PERL5) && !defined(NeXT) +char *_ossl_old_crypt(const char *buf,const char *salt); +#endif +void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, + int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); +void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, + _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); +DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, + long length,int out_count,_ossl_old_des_cblock *seed); +void _ossl_old_des_random_seed(_ossl_old_des_cblock key); +void _ossl_old_des_random_key(_ossl_old_des_cblock ret); +int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify); +int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2, + const char *prompt,int verify); +void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key); +int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key); +int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); +int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); +void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key); +void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2); +void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc); +void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num); + +void _ossl_096_des_random_seed(des_cblock *key); + +/* The following definitions provide compatibility with the MIT Kerberos + * library. The _ossl_old_des_key_schedule structure is not binary compatible. */ + +#define _KERBEROS_DES_H + +#define KRBDES_ENCRYPT DES_ENCRYPT +#define KRBDES_DECRYPT DES_DECRYPT + +#ifdef KERBEROS +# define ENCRYPT DES_ENCRYPT +# define DECRYPT DES_DECRYPT +#endif + +#ifndef NCOMPAT +# define C_Block des_cblock +# define Key_schedule des_key_schedule +# define KEY_SZ DES_KEY_SZ +# define string_to_key des_string_to_key +# define read_pw_string des_read_pw_string +# define random_key des_random_key +# define pcbc_encrypt des_pcbc_encrypt +# define set_key des_set_key +# define key_sched des_key_sched +# define ecb_encrypt des_ecb_encrypt +# define cbc_encrypt des_cbc_encrypt +# define ncbc_encrypt des_ncbc_encrypt +# define xcbc_encrypt des_xcbc_encrypt +# define cbc_cksum des_cbc_cksum +# define quad_cksum des_quad_cksum +# define check_parity des_check_key_parity +#endif + +#define des_fixup_key_parity DES_fixup_key_parity + +#ifdef __cplusplus +} +#endif + +/* for DES_read_pw_string et al */ +#include + +#endif diff --git a/externals/openssl/dh.h b/externals/openssl/dh.h new file mode 100644 index 0000000..10475ac --- /dev/null +++ b/externals/openssl/dh.h @@ -0,0 +1,245 @@ +/* crypto/dh/dh.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_DH_H +#define HEADER_DH_H + +#include + +#ifdef OPENSSL_NO_DH +#error DH is disabled. +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifndef OPENSSL_DH_MAX_MODULUS_BITS +# define OPENSSL_DH_MAX_MODULUS_BITS 10000 +#endif + +#define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 + +#define DH_FLAG_CACHE_MONT_P 0x01 +#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct dh_st DH; */ +/* typedef struct dh_method DH_METHOD; */ + +struct dh_method + { + const char *name; + /* Methods here */ + int (*generate_key)(DH *dh); + int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh); + int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a, + const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); /* Can be null */ + + int (*init)(DH *dh); + int (*finish)(DH *dh); + int flags; + char *app_data; + /* If this is non-NULL, it will be used to generate parameters */ + int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb); + }; + +struct dh_st + { + /* This first argument is used to pick up errors when + * a DH is passed instead of a EVP_PKEY */ + int pad; + int version; + BIGNUM *p; + BIGNUM *g; + long length; /* optional */ + BIGNUM *pub_key; /* g^x */ + BIGNUM *priv_key; /* x */ + + int flags; + BN_MONT_CTX *method_mont_p; + /* Place holders if we want to do X9.42 DH */ + BIGNUM *q; + BIGNUM *j; + unsigned char *seed; + int seedlen; + BIGNUM *counter; + + int references; + CRYPTO_EX_DATA ex_data; + const DH_METHOD *meth; + ENGINE *engine; + }; + +#define DH_GENERATOR_2 2 +/* #define DH_GENERATOR_3 3 */ +#define DH_GENERATOR_5 5 + +/* DH_check error codes */ +#define DH_CHECK_P_NOT_PRIME 0x01 +#define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +#define DH_UNABLE_TO_CHECK_GENERATOR 0x04 +#define DH_NOT_SUITABLE_GENERATOR 0x08 + +/* DH_check_pub_key error codes */ +#define DH_CHECK_PUBKEY_TOO_SMALL 0x01 +#define DH_CHECK_PUBKEY_TOO_LARGE 0x02 + +/* primes p where (p-1)/2 is prime too are called "safe"; we define + this for backward compatibility: */ +#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME + +#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x) +#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) +#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ + (unsigned char *)(x)) +#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) +#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) + +const DH_METHOD *DH_OpenSSL(void); + +#ifdef OPENSSL_FIPS +DH * FIPS_dh_new(void); +void FIPS_dh_free(DH *dh); +#endif + +void DH_set_default_method(const DH_METHOD *meth); +const DH_METHOD *DH_get_default_method(void); +int DH_set_method(DH *dh, const DH_METHOD *meth); +DH *DH_new_method(ENGINE *engine); + +DH * DH_new(void); +void DH_free(DH *dh); +int DH_up_ref(DH *dh); +int DH_size(const DH *dh); +int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int DH_set_ex_data(DH *d, int idx, void *arg); +void *DH_get_ex_data(DH *d, int idx); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +DH * DH_generate_parameters(int prime_len,int generator, + void (*callback)(int,int,void *),void *cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb); + +int DH_check(const DH *dh,int *codes); +int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes); +int DH_generate_key(DH *dh); +int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh); +DH * d2i_DHparams(DH **a,const unsigned char **pp, long length); +int i2d_DHparams(const DH *a,unsigned char **pp); +#ifndef OPENSSL_NO_FP_API +int DHparams_print_fp(FILE *fp, const DH *x); +#endif +#ifndef OPENSSL_NO_BIO +int DHparams_print(BIO *bp, const DH *x); +#else +int DHparams_print(char *bp, const DH *x); +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DH_strings(void); + +/* Error codes for the DH functions. */ + +/* Function codes. */ +#define DH_F_COMPUTE_KEY 102 +#define DH_F_DHPARAMS_PRINT 100 +#define DH_F_DHPARAMS_PRINT_FP 101 +#define DH_F_DH_BUILTIN_GENPARAMS 106 +#define DH_F_DH_COMPUTE_KEY 107 +#define DH_F_DH_GENERATE_KEY 108 +#define DH_F_DH_GENERATE_PARAMETERS 109 +#define DH_F_DH_NEW_METHOD 105 +#define DH_F_GENERATE_KEY 103 +#define DH_F_GENERATE_PARAMETERS 104 + +/* Reason codes. */ +#define DH_R_BAD_GENERATOR 101 +#define DH_R_INVALID_PUBKEY 102 +#define DH_R_KEY_SIZE_TOO_SMALL 104 +#define DH_R_MODULUS_TOO_LARGE 103 +#define DH_R_NO_PRIVATE_VALUE 100 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/dsa.h b/externals/openssl/dsa.h new file mode 100644 index 0000000..702c50d --- /dev/null +++ b/externals/openssl/dsa.h @@ -0,0 +1,324 @@ +/* crypto/dsa/dsa.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* + * The DSS routines are based on patches supplied by + * Steven Schoch . He basically did the + * work and I have just tweaked them a little to fit into my + * stylistic vision for SSLeay :-) */ + +#ifndef HEADER_DSA_H +#define HEADER_DSA_H + +#include + +#ifdef OPENSSL_NO_DSA +#error DSA is disabled. +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#ifndef OPENSSL_NO_DEPRECATED +#include +#ifndef OPENSSL_NO_DH +# include +#endif +#endif + +#ifndef OPENSSL_DSA_MAX_MODULUS_BITS +# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 +#endif + +#define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 + +#define DSA_FLAG_CACHE_MONT_P 0x01 +#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ + +/* If this flag is set the DSA method is FIPS compliant and can be used + * in FIPS mode. This is set in the validated module method. If an + * application sets this flag in its own methods it is its reposibility + * to ensure the result is compliant. + */ + +#define DSA_FLAG_FIPS_METHOD 0x0400 + +/* If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define DSA_FLAG_NON_FIPS_ALLOW 0x0400 + +#ifdef OPENSSL_FIPS +#define FIPS_DSA_SIZE_T int +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct dsa_st DSA; */ +/* typedef struct dsa_method DSA_METHOD; */ + +typedef struct DSA_SIG_st + { + BIGNUM *r; + BIGNUM *s; + } DSA_SIG; + +struct dsa_method + { + const char *name; + DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); + int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, + BIGNUM **rp); + int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, + DSA_SIG *sig, DSA *dsa); + int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, + BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *in_mont); + int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); /* Can be null */ + int (*init)(DSA *dsa); + int (*finish)(DSA *dsa); + int flags; + char *app_data; + /* If this is non-NULL, it is used to generate DSA parameters */ + int (*dsa_paramgen)(DSA *dsa, int bits, + unsigned char *seed, int seed_len, + int *counter_ret, unsigned long *h_ret, + BN_GENCB *cb); + /* If this is non-NULL, it is used to generate DSA keys */ + int (*dsa_keygen)(DSA *dsa); + }; + +struct dsa_st + { + /* This first variable is used to pick up errors where + * a DSA is passed instead of of a EVP_PKEY */ + int pad; + long version; + int write_params; + BIGNUM *p; + BIGNUM *q; /* == 20 */ + BIGNUM *g; + + BIGNUM *pub_key; /* y public key */ + BIGNUM *priv_key; /* x private key */ + + BIGNUM *kinv; /* Signing pre-calc */ + BIGNUM *r; /* Signing pre-calc */ + + int flags; + /* Normally used to cache montgomery values */ + BN_MONT_CTX *method_mont_p; + int references; + CRYPTO_EX_DATA ex_data; + const DSA_METHOD *meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE *engine; + }; + +#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x) +#define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ + (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) +#define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ + (unsigned char *)(x)) +#define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) +#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) + + +DSA_SIG * DSA_SIG_new(void); +void DSA_SIG_free(DSA_SIG *a); +int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); +DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); + +DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); +int DSA_do_verify(const unsigned char *dgst,int dgst_len, + DSA_SIG *sig,DSA *dsa); + +const DSA_METHOD *DSA_OpenSSL(void); + +void DSA_set_default_method(const DSA_METHOD *); +const DSA_METHOD *DSA_get_default_method(void); +int DSA_set_method(DSA *dsa, const DSA_METHOD *); + +#ifdef OPENSSL_FIPS +DSA * FIPS_dsa_new(void); +void FIPS_dsa_free (DSA *r); +#endif + +DSA * DSA_new(void); +DSA * DSA_new_method(ENGINE *engine); +void DSA_free (DSA *r); +/* "up" the DSA object's reference count */ +int DSA_up_ref(DSA *r); +int DSA_size(const DSA *); + /* next 4 return -1 on error */ +int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); +int DSA_sign(int type,const unsigned char *dgst,int dlen, + unsigned char *sig, unsigned int *siglen, DSA *dsa); +int DSA_verify(int type,const unsigned char *dgst,int dgst_len, + const unsigned char *sigbuf, int siglen, DSA *dsa); +int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int DSA_set_ex_data(DSA *d, int idx, void *arg); +void *DSA_get_ex_data(DSA *d, int idx); + +DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); +DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); +DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +DSA * DSA_generate_parameters(int bits, + unsigned char *seed,int seed_len, + int *counter_ret, unsigned long *h_ret,void + (*callback)(int, int, void *),void *cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int DSA_generate_parameters_ex(DSA *dsa, int bits, + unsigned char *seed,int seed_len, + int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); + +int DSA_generate_key(DSA *a); +int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); +int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); +int i2d_DSAparams(const DSA *a,unsigned char **pp); + +#ifndef OPENSSL_NO_BIO +int DSAparams_print(BIO *bp, const DSA *x); +int DSA_print(BIO *bp, const DSA *x, int off); +#endif +#ifndef OPENSSL_NO_FP_API +int DSAparams_print_fp(FILE *fp, const DSA *x); +int DSA_print_fp(FILE *bp, const DSA *x, int off); +#endif + +#define DSS_prime_checks 50 +/* Primality test according to FIPS PUB 186[-1], Appendix 2.1: + * 50 rounds of Rabin-Miller */ +#define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +#ifndef OPENSSL_NO_DH +/* Convert DSA structure (key or just parameters) into DH structure + * (be careful to avoid small subgroup attacks when using this!) */ +DH *DSA_dup_DH(const DSA *r); +#endif + +#ifdef OPENSSL_FIPS +int FIPS_dsa_sig_encode(unsigned char *out, DSA_SIG *sig); +int FIPS_dsa_sig_decode(DSA_SIG *sig, const unsigned char *in, int inlen); +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DSA_strings(void); + +/* Error codes for the DSA functions. */ + +/* Function codes. */ +#define DSA_F_D2I_DSA_SIG 110 +#define DSA_F_DSAPARAMS_PRINT 100 +#define DSA_F_DSAPARAMS_PRINT_FP 101 +#define DSA_F_DSA_BUILTIN_KEYGEN 119 +#define DSA_F_DSA_BUILTIN_PARAMGEN 118 +#define DSA_F_DSA_DO_SIGN 112 +#define DSA_F_DSA_DO_VERIFY 113 +#define DSA_F_DSA_GENERATE_PARAMETERS 117 +#define DSA_F_DSA_NEW_METHOD 103 +#define DSA_F_DSA_PRINT 104 +#define DSA_F_DSA_PRINT_FP 105 +#define DSA_F_DSA_SET_DEFAULT_METHOD 115 +#define DSA_F_DSA_SET_METHOD 116 +#define DSA_F_DSA_SIGN 106 +#define DSA_F_DSA_SIGN_SETUP 107 +#define DSA_F_DSA_SIG_NEW 109 +#define DSA_F_DSA_VERIFY 108 +#define DSA_F_I2D_DSA_SIG 111 +#define DSA_F_SIG_CB 114 + +/* Reason codes. */ +#define DSA_R_BAD_Q_VALUE 102 +#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 +#define DSA_R_KEY_SIZE_TOO_SMALL 106 +#define DSA_R_MISSING_PARAMETERS 101 +#define DSA_R_MODULUS_TOO_LARGE 103 +#define DSA_R_NON_FIPS_METHOD 104 +#define DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 105 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/dso.h b/externals/openssl/dso.h new file mode 100644 index 0000000..08730ce --- /dev/null +++ b/externals/openssl/dso.h @@ -0,0 +1,369 @@ +/* dso.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DSO_H +#define HEADER_DSO_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These values are used as commands to DSO_ctrl() */ +#define DSO_CTRL_GET_FLAGS 1 +#define DSO_CTRL_SET_FLAGS 2 +#define DSO_CTRL_OR_FLAGS 3 + +/* By default, DSO_load() will translate the provided filename into a form + * typical for the platform (more specifically the DSO_METHOD) using the + * dso_name_converter function of the method. Eg. win32 will transform "blah" + * into "blah.dll", and dlfcn will transform it into "libblah.so". The + * behaviour can be overriden by setting the name_converter callback in the DSO + * object (using DSO_set_name_converter()). This callback could even utilise + * the DSO_METHOD's converter too if it only wants to override behaviour for + * one or two possible DSO methods. However, the following flag can be set in a + * DSO to prevent *any* native name-translation at all - eg. if the caller has + * prompted the user for a path to a driver library so the filename should be + * interpreted as-is. */ +#define DSO_FLAG_NO_NAME_TRANSLATION 0x01 +/* An extra flag to give if only the extension should be added as + * translation. This is obviously only of importance on Unix and + * other operating systems where the translation also may prefix + * the name with something, like 'lib', and ignored everywhere else. + * This flag is also ignored if DSO_FLAG_NO_NAME_TRANSLATION is used + * at the same time. */ +#define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY 0x02 + +/* The following flag controls the translation of symbol names to upper + * case. This is currently only being implemented for OpenVMS. + */ +#define DSO_FLAG_UPCASE_SYMBOL 0x10 + +/* This flag loads the library with public symbols. + * Meaning: The exported symbols of this library are public + * to all libraries loaded after this library. + * At the moment only implemented in unix. + */ +#define DSO_FLAG_GLOBAL_SYMBOLS 0x20 + + +typedef void (*DSO_FUNC_TYPE)(void); + +typedef struct dso_st DSO; + +/* The function prototype used for method functions (or caller-provided + * callbacks) that transform filenames. They are passed a DSO structure pointer + * (or NULL if they are to be used independantly of a DSO object) and a + * filename to transform. They should either return NULL (if there is an error + * condition) or a newly allocated string containing the transformed form that + * the caller will need to free with OPENSSL_free() when done. */ +typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); +/* The function prototype used for method functions (or caller-provided + * callbacks) that merge two file specifications. They are passed a + * DSO structure pointer (or NULL if they are to be used independantly of + * a DSO object) and two file specifications to merge. They should + * either return NULL (if there is an error condition) or a newly allocated + * string containing the result of merging that the caller will need + * to free with OPENSSL_free() when done. + * Here, merging means that bits and pieces are taken from each of the + * file specifications and added together in whatever fashion that is + * sensible for the DSO method in question. The only rule that really + * applies is that if the two specification contain pieces of the same + * type, the copy from the first string takes priority. One could see + * it as the first specification is the one given by the user and the + * second being a bunch of defaults to add on if they're missing in the + * first. */ +typedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *); + +typedef struct dso_meth_st + { + const char *name; + /* Loads a shared library, NB: new DSO_METHODs must ensure that a + * successful load populates the loaded_filename field, and likewise a + * successful unload OPENSSL_frees and NULLs it out. */ + int (*dso_load)(DSO *dso); + /* Unloads a shared library */ + int (*dso_unload)(DSO *dso); + /* Binds a variable */ + void *(*dso_bind_var)(DSO *dso, const char *symname); + /* Binds a function - assumes a return type of DSO_FUNC_TYPE. + * This should be cast to the real function prototype by the + * caller. Platforms that don't have compatible representations + * for different prototypes (this is possible within ANSI C) + * are highly unlikely to have shared libraries at all, let + * alone a DSO_METHOD implemented for them. */ + DSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname); + +/* I don't think this would actually be used in any circumstances. */ +#if 0 + /* Unbinds a variable */ + int (*dso_unbind_var)(DSO *dso, char *symname, void *symptr); + /* Unbinds a function */ + int (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); +#endif + /* The generic (yuck) "ctrl()" function. NB: Negative return + * values (rather than zero) indicate errors. */ + long (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg); + /* The default DSO_METHOD-specific function for converting filenames to + * a canonical native form. */ + DSO_NAME_CONVERTER_FUNC dso_name_converter; + /* The default DSO_METHOD-specific function for converting filenames to + * a canonical native form. */ + DSO_MERGER_FUNC dso_merger; + + /* [De]Initialisation handlers. */ + int (*init)(DSO *dso); + int (*finish)(DSO *dso); + } DSO_METHOD; + +/**********************************************************************/ +/* The low-level handle type used to refer to a loaded shared library */ + +struct dso_st + { + DSO_METHOD *meth; + /* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS + * doesn't use anything but will need to cache the filename + * for use in the dso_bind handler. All in all, let each + * method control its own destiny. "Handles" and such go in + * a STACK. */ + STACK *meth_data; + int references; + int flags; + /* For use by applications etc ... use this for your bits'n'pieces, + * don't touch meth_data! */ + CRYPTO_EX_DATA ex_data; + /* If this callback function pointer is set to non-NULL, then it will + * be used in DSO_load() in place of meth->dso_name_converter. NB: This + * should normally set using DSO_set_name_converter(). */ + DSO_NAME_CONVERTER_FUNC name_converter; + /* If this callback function pointer is set to non-NULL, then it will + * be used in DSO_load() in place of meth->dso_merger. NB: This + * should normally set using DSO_set_merger(). */ + DSO_MERGER_FUNC merger; + /* This is populated with (a copy of) the platform-independant + * filename used for this DSO. */ + char *filename; + /* This is populated with (a copy of) the translated filename by which + * the DSO was actually loaded. It is NULL iff the DSO is not currently + * loaded. NB: This is here because the filename translation process + * may involve a callback being invoked more than once not only to + * convert to a platform-specific form, but also to try different + * filenames in the process of trying to perform a load. As such, this + * variable can be used to indicate (a) whether this DSO structure + * corresponds to a loaded library or not, and (b) the filename with + * which it was actually loaded. */ + char *loaded_filename; + }; + + +DSO * DSO_new(void); +DSO * DSO_new_method(DSO_METHOD *method); +int DSO_free(DSO *dso); +int DSO_flags(DSO *dso); +int DSO_up_ref(DSO *dso); +long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg); + +/* This function sets the DSO's name_converter callback. If it is non-NULL, + * then it will be used instead of the associated DSO_METHOD's function. If + * oldcb is non-NULL then it is set to the function pointer value being + * replaced. Return value is non-zero for success. */ +int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb, + DSO_NAME_CONVERTER_FUNC *oldcb); +/* These functions can be used to get/set the platform-independant filename + * used for a DSO. NB: set will fail if the DSO is already loaded. */ +const char *DSO_get_filename(DSO *dso); +int DSO_set_filename(DSO *dso, const char *filename); +/* This function will invoke the DSO's name_converter callback to translate a + * filename, or if the callback isn't set it will instead use the DSO_METHOD's + * converter. If "filename" is NULL, the "filename" in the DSO itself will be + * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is + * simply duplicated. NB: This function is usually called from within a + * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that + * caller-created DSO_METHODs can do the same thing. A non-NULL return value + * will need to be OPENSSL_free()'d. */ +char *DSO_convert_filename(DSO *dso, const char *filename); +/* This function will invoke the DSO's merger callback to merge two file + * specifications, or if the callback isn't set it will instead use the + * DSO_METHOD's merger. A non-NULL return value will need to be + * OPENSSL_free()'d. */ +char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); +/* If the DSO is currently loaded, this returns the filename that it was loaded + * under, otherwise it returns NULL. So it is also useful as a test as to + * whether the DSO is currently loaded. NB: This will not necessarily return + * the same value as DSO_convert_filename(dso, dso->filename), because the + * DSO_METHOD's load function may have tried a variety of filenames (with + * and/or without the aid of the converters) before settling on the one it + * actually loaded. */ +const char *DSO_get_loaded_filename(DSO *dso); + +void DSO_set_default_method(DSO_METHOD *meth); +DSO_METHOD *DSO_get_default_method(void); +DSO_METHOD *DSO_get_method(DSO *dso); +DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth); + +/* The all-singing all-dancing load function, you normally pass NULL + * for the first and third parameters. Use DSO_up and DSO_free for + * subsequent reference count handling. Any flags passed in will be set + * in the constructed DSO after its init() function but before the + * load operation. If 'dso' is non-NULL, 'flags' is ignored. */ +DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags); + +/* This function binds to a variable inside a shared library. */ +void *DSO_bind_var(DSO *dso, const char *symname); + +/* This function binds to a function inside a shared library. */ +DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); + +/* This method is the default, but will beg, borrow, or steal whatever + * method should be the default on any particular platform (including + * DSO_METH_null() if necessary). */ +DSO_METHOD *DSO_METHOD_openssl(void); + +/* This method is defined for all platforms - if a platform has no + * DSO support then this will be the only method! */ +DSO_METHOD *DSO_METHOD_null(void); + +/* If DSO_DLFCN is defined, the standard dlfcn.h-style functions + * (dlopen, dlclose, dlsym, etc) will be used and incorporated into + * this method. If not, this method will return NULL. */ +DSO_METHOD *DSO_METHOD_dlfcn(void); + +/* If DSO_DL is defined, the standard dl.h-style functions (shl_load, + * shl_unload, shl_findsym, etc) will be used and incorporated into + * this method. If not, this method will return NULL. */ +DSO_METHOD *DSO_METHOD_dl(void); + +/* If WIN32 is defined, use DLLs. If not, return NULL. */ +DSO_METHOD *DSO_METHOD_win32(void); + +/* If VMS is defined, use shared images. If not, return NULL. */ +DSO_METHOD *DSO_METHOD_vms(void); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_DSO_strings(void); + +/* Error codes for the DSO functions. */ + +/* Function codes. */ +#define DSO_F_DLFCN_BIND_FUNC 100 +#define DSO_F_DLFCN_BIND_VAR 101 +#define DSO_F_DLFCN_LOAD 102 +#define DSO_F_DLFCN_MERGER 130 +#define DSO_F_DLFCN_NAME_CONVERTER 123 +#define DSO_F_DLFCN_UNLOAD 103 +#define DSO_F_DL_BIND_FUNC 104 +#define DSO_F_DL_BIND_VAR 105 +#define DSO_F_DL_LOAD 106 +#define DSO_F_DL_MERGER 131 +#define DSO_F_DL_NAME_CONVERTER 124 +#define DSO_F_DL_UNLOAD 107 +#define DSO_F_DSO_BIND_FUNC 108 +#define DSO_F_DSO_BIND_VAR 109 +#define DSO_F_DSO_CONVERT_FILENAME 126 +#define DSO_F_DSO_CTRL 110 +#define DSO_F_DSO_FREE 111 +#define DSO_F_DSO_GET_FILENAME 127 +#define DSO_F_DSO_GET_LOADED_FILENAME 128 +#define DSO_F_DSO_LOAD 112 +#define DSO_F_DSO_MERGE 132 +#define DSO_F_DSO_NEW_METHOD 113 +#define DSO_F_DSO_SET_FILENAME 129 +#define DSO_F_DSO_SET_NAME_CONVERTER 122 +#define DSO_F_DSO_UP_REF 114 +#define DSO_F_VMS_BIND_SYM 115 +#define DSO_F_VMS_LOAD 116 +#define DSO_F_VMS_MERGER 133 +#define DSO_F_VMS_UNLOAD 117 +#define DSO_F_WIN32_BIND_FUNC 118 +#define DSO_F_WIN32_BIND_VAR 119 +#define DSO_F_WIN32_JOINER 135 +#define DSO_F_WIN32_LOAD 120 +#define DSO_F_WIN32_MERGER 134 +#define DSO_F_WIN32_NAME_CONVERTER 125 +#define DSO_F_WIN32_SPLITTER 136 +#define DSO_F_WIN32_UNLOAD 121 + +/* Reason codes. */ +#define DSO_R_CTRL_FAILED 100 +#define DSO_R_DSO_ALREADY_LOADED 110 +#define DSO_R_EMPTY_FILE_STRUCTURE 113 +#define DSO_R_FAILURE 114 +#define DSO_R_FILENAME_TOO_BIG 101 +#define DSO_R_FINISH_FAILED 102 +#define DSO_R_INCORRECT_FILE_SYNTAX 115 +#define DSO_R_LOAD_FAILED 103 +#define DSO_R_NAME_TRANSLATION_FAILED 109 +#define DSO_R_NO_FILENAME 111 +#define DSO_R_NO_FILE_SPECIFICATION 116 +#define DSO_R_NULL_HANDLE 104 +#define DSO_R_SET_FILENAME_FAILED 112 +#define DSO_R_STACK_ERROR 105 +#define DSO_R_SYM_FAILURE 106 +#define DSO_R_UNLOAD_FAILED 107 +#define DSO_R_UNSUPPORTED 108 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/dtls1.h b/externals/openssl/dtls1.h new file mode 100644 index 0000000..f159d37 --- /dev/null +++ b/externals/openssl/dtls1.h @@ -0,0 +1,218 @@ +/* ssl/dtls1.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_DTLS1_H +#define HEADER_DTLS1_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define DTLS1_VERSION 0xFEFF +#define DTLS1_BAD_VER 0x0100 + +#if 0 +/* this alert description is not specified anywhere... */ +#define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110 +#endif + +/* lengths of messages */ +#define DTLS1_COOKIE_LENGTH 32 + +#define DTLS1_RT_HEADER_LENGTH 13 + +#define DTLS1_HM_HEADER_LENGTH 12 + +#define DTLS1_HM_BAD_FRAGMENT -2 +#define DTLS1_HM_FRAGMENT_RETRY -3 + +#define DTLS1_CCS_HEADER_LENGTH 1 + +#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE +#define DTLS1_AL_HEADER_LENGTH 7 +#else +#define DTLS1_AL_HEADER_LENGTH 2 +#endif + + +typedef struct dtls1_bitmap_st + { + PQ_64BIT map; + unsigned long length; /* sizeof the bitmap in bits */ + PQ_64BIT max_seq_num; /* max record number seen so far */ + } DTLS1_BITMAP; + +struct hm_header_st + { + unsigned char type; + unsigned long msg_len; + unsigned short seq; + unsigned long frag_off; + unsigned long frag_len; + unsigned int is_ccs; + }; + +struct ccs_header_st + { + unsigned char type; + unsigned short seq; + }; + +struct dtls1_timeout_st + { + /* Number of read timeouts so far */ + unsigned int read_timeouts; + + /* Number of write timeouts so far */ + unsigned int write_timeouts; + + /* Number of alerts received so far */ + unsigned int num_alerts; + }; + +typedef struct record_pqueue_st + { + unsigned short epoch; + pqueue q; + } record_pqueue; + +typedef struct hm_fragment_st + { + struct hm_header_st msg_header; + unsigned char *fragment; + } hm_fragment; + +typedef struct dtls1_state_st + { + unsigned int send_cookie; + unsigned char cookie[DTLS1_COOKIE_LENGTH]; + unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH]; + unsigned int cookie_len; + + /* + * The current data and handshake epoch. This is initially + * undefined, and starts at zero once the initial handshake is + * completed + */ + unsigned short r_epoch; + unsigned short w_epoch; + + /* records being received in the current epoch */ + DTLS1_BITMAP bitmap; + + /* renegotiation starts a new set of sequence numbers */ + DTLS1_BITMAP next_bitmap; + + /* handshake message numbers */ + unsigned short handshake_write_seq; + unsigned short next_handshake_write_seq; + + unsigned short handshake_read_seq; + + /* Received handshake records (processed and unprocessed) */ + record_pqueue unprocessed_rcds; + record_pqueue processed_rcds; + + /* Buffered handshake messages */ + pqueue buffered_messages; + + /* Buffered (sent) handshake records */ + pqueue sent_messages; + + unsigned int mtu; /* max wire packet size */ + + struct hm_header_st w_msg_hdr; + struct hm_header_st r_msg_hdr; + + struct dtls1_timeout_st timeout; + + /* storage for Alert/Handshake protocol data received but not + * yet processed by ssl3_read_bytes: */ + unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH]; + unsigned int alert_fragment_len; + unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH]; + unsigned int handshake_fragment_len; + + unsigned int retransmitting; + + } DTLS1_STATE; + +typedef struct dtls1_record_data_st + { + unsigned char *packet; + unsigned int packet_length; + SSL3_BUFFER rbuf; + SSL3_RECORD rrec; + } DTLS1_RECORD_DATA; + + +/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */ +#define DTLS1_TMO_READ_COUNT 2 +#define DTLS1_TMO_WRITE_COUNT 2 + +#define DTLS1_TMO_ALERT_COUNT 12 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/e_os2.h b/externals/openssl/e_os2.h new file mode 100644 index 0000000..100265e --- /dev/null +++ b/externals/openssl/e_os2.h @@ -0,0 +1,280 @@ +/* e_os2.h */ +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include + +#ifndef HEADER_E_OS2_H +#define HEADER_E_OS2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * Detect operating systems. This probably needs completing. + * The result is that at least one OPENSSL_SYS_os macro should be defined. + * However, if none is defined, Unix is assumed. + **/ + +#define OPENSSL_SYS_UNIX + +/* ----------------------- Macintosh, before MacOS X ----------------------- */ +#if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_MACINTOSH_CLASSIC +#endif + +/* ----------------------- NetWare ----------------------------------------- */ +#if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_NETWARE +#endif + +/* ---------------------- Microsoft operating systems ---------------------- */ + +/* Note that MSDOS actually denotes 32-bit environments running on top of + MS-DOS, such as DJGPP one. */ +#if defined(OPENSSL_SYSNAME_MSDOS) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_MSDOS +#endif + +/* For 32 bit environment, there seems to be the CygWin environment and then + all the others that try to do the same thing Microsoft does... */ +#if defined(OPENSSL_SYSNAME_UWIN) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32_UWIN +#else +# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32_CYGWIN +# else +# if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32 +# endif +# if defined(OPENSSL_SYSNAME_WINNT) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINNT +# endif +# if defined(OPENSSL_SYSNAME_WINCE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINCE +# endif +# endif +#endif + +/* Anything that tries to look like Microsoft is "Windows" */ +#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_SYS_MSDOS +# define OPENSSL_SYS_MSDOS +# endif +#endif + +/* DLL settings. This part is a bit tough, because it's up to the application + implementor how he or she will link the application, so it requires some + macro to be used. */ +#ifdef OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_OPT_WINDLL +# if defined(_WINDLL) /* This is used when building OpenSSL to indicate that + DLL linkage should be used */ +# define OPENSSL_OPT_WINDLL +# endif +# endif +#endif + +/* -------------------------------- OpenVMS -------------------------------- */ +#if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_VMS +# if defined(__DECC) +# define OPENSSL_SYS_VMS_DECC +# elif defined(__DECCXX) +# define OPENSSL_SYS_VMS_DECC +# define OPENSSL_SYS_VMS_DECCXX +# else +# define OPENSSL_SYS_VMS_NODECC +# endif +#endif + +/* --------------------------------- OS/2 ---------------------------------- */ +#if defined(__EMX__) || defined(__OS2__) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_OS2 +#endif + +/* --------------------------------- Unix ---------------------------------- */ +#ifdef OPENSSL_SYS_UNIX +# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX) +# define OPENSSL_SYS_LINUX +# endif +# ifdef OPENSSL_SYSNAME_MPE +# define OPENSSL_SYS_MPE +# endif +# ifdef OPENSSL_SYSNAME_SNI +# define OPENSSL_SYS_SNI +# endif +# ifdef OPENSSL_SYSNAME_ULTRASPARC +# define OPENSSL_SYS_ULTRASPARC +# endif +# ifdef OPENSSL_SYSNAME_NEWS4 +# define OPENSSL_SYS_NEWS4 +# endif +# ifdef OPENSSL_SYSNAME_MACOSX +# define OPENSSL_SYS_MACOSX +# endif +# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY +# define OPENSSL_SYS_MACOSX_RHAPSODY +# define OPENSSL_SYS_MACOSX +# endif +# ifdef OPENSSL_SYSNAME_SUNOS +# define OPENSSL_SYS_SUNOS +#endif +# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY) +# define OPENSSL_SYS_CRAY +# endif +# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX) +# define OPENSSL_SYS_AIX +# endif +#endif + +/* --------------------------------- VOS ----------------------------------- */ +#ifdef OPENSSL_SYSNAME_VOS +# define OPENSSL_SYS_VOS +#endif + +/* ------------------------------- VxWorks --------------------------------- */ +#ifdef OPENSSL_SYSNAME_VXWORKS +# define OPENSSL_SYS_VXWORKS +#endif + +/** + * That's it for OS-specific stuff + *****************************************************************************/ + + +/* Specials for I/O an exit */ +#ifdef OPENSSL_SYS_MSDOS +# define OPENSSL_UNISTD_IO +# define OPENSSL_DECLARE_EXIT extern void exit(int); +#else +# define OPENSSL_UNISTD_IO OPENSSL_UNISTD +# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ +#endif + +/* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare + certain global symbols that, with some compilers under VMS, have to be + defined and declared explicitely with globaldef and globalref. + Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare + DLL exports and imports for compilers under Win32. These are a little + more complicated to use. Basically, for any library that exports some + global variables, the following code must be present in the header file + that declares them, before OPENSSL_EXTERN is used: + + #ifdef SOME_BUILD_FLAG_MACRO + # undef OPENSSL_EXTERN + # define OPENSSL_EXTERN OPENSSL_EXPORT + #endif + + The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL + have some generally sensible values, and for OPENSSL_EXTERN to have the + value OPENSSL_IMPORT. +*/ + +#if defined(OPENSSL_SYS_VMS_NODECC) +# define OPENSSL_EXPORT globalref +# define OPENSSL_IMPORT globalref +# define OPENSSL_GLOBAL globaldef +#elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) +# define OPENSSL_EXPORT extern __declspec(dllexport) +# define OPENSSL_IMPORT extern __declspec(dllimport) +# define OPENSSL_GLOBAL +#else +# define OPENSSL_EXPORT extern +# define OPENSSL_IMPORT extern +# define OPENSSL_GLOBAL +#endif +#define OPENSSL_EXTERN OPENSSL_IMPORT + +/* Macros to allow global variables to be reached through function calls when + required (if a shared library version requvres it, for example. + The way it's done allows definitions like this: + + // in foobar.c + OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0; + // in foobar.h + OPENSSL_DECLARE_GLOBAL(int,foobar); + #define foobar OPENSSL_GLOBAL_REF(foobar) +*/ +#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define OPENSSL_IMPLEMENT_GLOBAL(type,name) \ + extern type _hide_##name; \ + type *_shadow_##name(void) { return &_hide_##name; } \ + static type _hide_##name +# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) +# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) +#else +# define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name +# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name +# define OPENSSL_GLOBAL_REF(name) _shadow_##name +#endif + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/ebcdic.h b/externals/openssl/ebcdic.h new file mode 100644 index 0000000..e970f12 --- /dev/null +++ b/externals/openssl/ebcdic.h @@ -0,0 +1,20 @@ +/* crypto/ebcdic.h */ + +#ifndef HEADER_EBCDIC_H +#define HEADER_EBCDIC_H + +#include + +/* Avoid name clashes with other applications */ +#define os_toascii _openssl_os_toascii +#define os_toebcdic _openssl_os_toebcdic +#define ebcdic2ascii _openssl_ebcdic2ascii +#define ascii2ebcdic _openssl_ascii2ebcdic + +extern const unsigned char os_toascii[256]; +extern const unsigned char os_toebcdic[256]; +void *ebcdic2ascii(void *dest, const void *srce, size_t count); +void *ascii2ebcdic(void *dest, const void *srce, size_t count); + +#endif + diff --git a/externals/openssl/ec.h b/externals/openssl/ec.h new file mode 100644 index 0000000..8bc2a23 --- /dev/null +++ b/externals/openssl/ec.h @@ -0,0 +1,526 @@ +/* crypto/ec/ec.h */ +/* + * Originally written by Bodo Moeller for the OpenSSL project. + */ +/* ==================================================================== + * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * The elliptic curve binary polynomial software is originally written by + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. + * + */ + +#ifndef HEADER_EC_H +#define HEADER_EC_H + +#include + +#ifdef OPENSSL_NO_EC +#error EC is disabled. +#endif + +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#elif defined(__SUNPRO_C) +# if __SUNPRO_C >= 0x520 +# pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) +# endif +#endif + + +#ifndef OPENSSL_ECC_MAX_FIELD_BITS +# define OPENSSL_ECC_MAX_FIELD_BITS 661 +#endif + +typedef enum { + /* values as defined in X9.62 (ECDSA) and elsewhere */ + POINT_CONVERSION_COMPRESSED = 2, + POINT_CONVERSION_UNCOMPRESSED = 4, + POINT_CONVERSION_HYBRID = 6 +} point_conversion_form_t; + + +typedef struct ec_method_st EC_METHOD; + +typedef struct ec_group_st + /* + EC_METHOD *meth; + -- field definition + -- curve coefficients + -- optional generator with associated information (order, cofactor) + -- optional extra data (precomputed table for fast computation of multiples of generator) + -- ASN1 stuff + */ + EC_GROUP; + +typedef struct ec_point_st EC_POINT; + + +/* EC_METHODs for curves over GF(p). + * EC_GFp_simple_method provides the basis for the optimized methods. + */ +const EC_METHOD *EC_GFp_simple_method(void); +const EC_METHOD *EC_GFp_mont_method(void); +const EC_METHOD *EC_GFp_nist_method(void); + +/* EC_METHOD for curves over GF(2^m). + */ +const EC_METHOD *EC_GF2m_simple_method(void); + + +EC_GROUP *EC_GROUP_new(const EC_METHOD *); +void EC_GROUP_free(EC_GROUP *); +void EC_GROUP_clear_free(EC_GROUP *); +int EC_GROUP_copy(EC_GROUP *, const EC_GROUP *); +EC_GROUP *EC_GROUP_dup(const EC_GROUP *); + +const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *); +int EC_METHOD_get_field_type(const EC_METHOD *); + +int EC_GROUP_set_generator(EC_GROUP *, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor); +const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *); +int EC_GROUP_get_order(const EC_GROUP *, BIGNUM *order, BN_CTX *); +int EC_GROUP_get_cofactor(const EC_GROUP *, BIGNUM *cofactor, BN_CTX *); + +void EC_GROUP_set_curve_name(EC_GROUP *, int nid); +int EC_GROUP_get_curve_name(const EC_GROUP *); + +void EC_GROUP_set_asn1_flag(EC_GROUP *, int flag); +int EC_GROUP_get_asn1_flag(const EC_GROUP *); + +void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t); +point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); + +unsigned char *EC_GROUP_get0_seed(const EC_GROUP *); +size_t EC_GROUP_get_seed_len(const EC_GROUP *); +size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); + +int EC_GROUP_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); +int EC_GROUP_get_curve_GFp(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); +int EC_GROUP_set_curve_GF2m(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); +int EC_GROUP_get_curve_GF2m(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); + +/* returns the number of bits needed to represent a field element */ +int EC_GROUP_get_degree(const EC_GROUP *); + +/* EC_GROUP_check() returns 1 if 'group' defines a valid group, 0 otherwise */ +int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); +/* EC_GROUP_check_discriminant() returns 1 if the discriminant of the + * elliptic curve is not zero, 0 otherwise */ +int EC_GROUP_check_discriminant(const EC_GROUP *, BN_CTX *); + +/* EC_GROUP_cmp() returns 0 if both groups are equal and 1 otherwise */ +int EC_GROUP_cmp(const EC_GROUP *, const EC_GROUP *, BN_CTX *); + +/* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() + * after choosing an appropriate EC_METHOD */ +EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); +EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); + +/* EC_GROUP_new_by_curve_name() creates a EC_GROUP structure + * specified by a curve name (in form of a NID) */ +EC_GROUP *EC_GROUP_new_by_curve_name(int nid); +/* handling of internal curves */ +typedef struct { + int nid; + const char *comment; + } EC_builtin_curve; +/* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number + * of all available curves or zero if a error occurred. + * In case r ist not zero nitems EC_builtin_curve structures + * are filled with the data of the first nitems internal groups */ +size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); + + +/* EC_POINT functions */ + +EC_POINT *EC_POINT_new(const EC_GROUP *); +void EC_POINT_free(EC_POINT *); +void EC_POINT_clear_free(EC_POINT *); +int EC_POINT_copy(EC_POINT *, const EC_POINT *); +EC_POINT *EC_POINT_dup(const EC_POINT *, const EC_GROUP *); + +const EC_METHOD *EC_POINT_method_of(const EC_POINT *); + +int EC_POINT_set_to_infinity(const EC_GROUP *, EC_POINT *); +int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *, + const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *); +int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *, const EC_POINT *, + BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *); +int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *, EC_POINT *, + const BIGNUM *x, const BIGNUM *y, BN_CTX *); +int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *, const EC_POINT *, + BIGNUM *x, BIGNUM *y, BN_CTX *); +int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *, EC_POINT *, + const BIGNUM *x, int y_bit, BN_CTX *); + +int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *, EC_POINT *, + const BIGNUM *x, const BIGNUM *y, BN_CTX *); +int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *, const EC_POINT *, + BIGNUM *x, BIGNUM *y, BN_CTX *); +int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *, EC_POINT *, + const BIGNUM *x, int y_bit, BN_CTX *); + +size_t EC_POINT_point2oct(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form, + unsigned char *buf, size_t len, BN_CTX *); +int EC_POINT_oct2point(const EC_GROUP *, EC_POINT *, + const unsigned char *buf, size_t len, BN_CTX *); + +/* other interfaces to point2oct/oct2point: */ +BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BIGNUM *, BN_CTX *); +EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, + EC_POINT *, BN_CTX *); +char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BN_CTX *); +EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, + EC_POINT *, BN_CTX *); + +int EC_POINT_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *); +int EC_POINT_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *); +int EC_POINT_invert(const EC_GROUP *, EC_POINT *, BN_CTX *); + +int EC_POINT_is_at_infinity(const EC_GROUP *, const EC_POINT *); +int EC_POINT_is_on_curve(const EC_GROUP *, const EC_POINT *, BN_CTX *); +int EC_POINT_cmp(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, BN_CTX *); + +int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *); +int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *); + + +int EC_POINTs_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, size_t num, const EC_POINT *[], const BIGNUM *[], BN_CTX *); +int EC_POINT_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, const EC_POINT *, const BIGNUM *, BN_CTX *); + +/* EC_GROUP_precompute_mult() stores multiples of generator for faster point multiplication */ +int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *); +/* EC_GROUP_have_precompute_mult() reports whether such precomputation has been done */ +int EC_GROUP_have_precompute_mult(const EC_GROUP *); + + + +/* ASN1 stuff */ + +/* EC_GROUP_get_basis_type() returns the NID of the basis type + * used to represent the field elements */ +int EC_GROUP_get_basis_type(const EC_GROUP *); +int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); +int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, + unsigned int *k2, unsigned int *k3); + +#define OPENSSL_EC_NAMED_CURVE 0x001 + +typedef struct ecpk_parameters_st ECPKPARAMETERS; + +EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); +int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); + +#define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) +#define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) +#define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ + (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) +#define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ + (unsigned char *)(x)) + +#ifndef OPENSSL_NO_BIO +int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); +#endif +#ifndef OPENSSL_NO_FP_API +int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); +#endif + +/* the EC_KEY stuff */ +typedef struct ec_key_st EC_KEY; + +/* some values for the encoding_flag */ +#define EC_PKEY_NO_PARAMETERS 0x001 +#define EC_PKEY_NO_PUBKEY 0x002 + +EC_KEY *EC_KEY_new(void); +EC_KEY *EC_KEY_new_by_curve_name(int nid); +void EC_KEY_free(EC_KEY *); +EC_KEY *EC_KEY_copy(EC_KEY *, const EC_KEY *); +EC_KEY *EC_KEY_dup(const EC_KEY *); + +int EC_KEY_up_ref(EC_KEY *); + +const EC_GROUP *EC_KEY_get0_group(const EC_KEY *); +int EC_KEY_set_group(EC_KEY *, const EC_GROUP *); +const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *); +int EC_KEY_set_private_key(EC_KEY *, const BIGNUM *); +const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *); +int EC_KEY_set_public_key(EC_KEY *, const EC_POINT *); +unsigned EC_KEY_get_enc_flags(const EC_KEY *); +void EC_KEY_set_enc_flags(EC_KEY *, unsigned int); +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *); +void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t); +/* functions to set/get method specific data */ +void *EC_KEY_get_key_method_data(EC_KEY *, + void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); +void EC_KEY_insert_key_method_data(EC_KEY *, void *data, + void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); +/* wrapper functions for the underlying EC_GROUP object */ +void EC_KEY_set_asn1_flag(EC_KEY *, int); +int EC_KEY_precompute_mult(EC_KEY *, BN_CTX *ctx); + +/* EC_KEY_generate_key() creates a ec private (public) key */ +int EC_KEY_generate_key(EC_KEY *); +/* EC_KEY_check_key() */ +int EC_KEY_check_key(const EC_KEY *); + +/* de- and encoding functions for SEC1 ECPrivateKey */ +EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len); +int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out); +/* de- and encoding functions for EC parameters */ +EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len); +int i2d_ECParameters(EC_KEY *a, unsigned char **out); +/* de- and encoding functions for EC public key + * (octet string, not DER -- hence 'o2i' and 'i2o') */ +EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len); +int i2o_ECPublicKey(EC_KEY *a, unsigned char **out); + +#ifndef OPENSSL_NO_BIO +int ECParameters_print(BIO *bp, const EC_KEY *x); +int EC_KEY_print(BIO *bp, const EC_KEY *x, int off); +#endif +#ifndef OPENSSL_NO_FP_API +int ECParameters_print_fp(FILE *fp, const EC_KEY *x); +int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off); +#endif + +#define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) + +#ifndef __cplusplus +#if defined(__SUNPRO_C) +# if __SUNPRO_C >= 0x520 +# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) +# endif +# endif +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_EC_strings(void); + +/* Error codes for the EC functions. */ + +/* Function codes. */ +#define EC_F_COMPUTE_WNAF 143 +#define EC_F_D2I_ECPARAMETERS 144 +#define EC_F_D2I_ECPKPARAMETERS 145 +#define EC_F_D2I_ECPRIVATEKEY 146 +#define EC_F_ECPARAMETERS_PRINT 147 +#define EC_F_ECPARAMETERS_PRINT_FP 148 +#define EC_F_ECPKPARAMETERS_PRINT 149 +#define EC_F_ECPKPARAMETERS_PRINT_FP 150 +#define EC_F_ECP_NIST_MOD_192 203 +#define EC_F_ECP_NIST_MOD_224 204 +#define EC_F_ECP_NIST_MOD_256 205 +#define EC_F_ECP_NIST_MOD_521 206 +#define EC_F_EC_ASN1_GROUP2CURVE 153 +#define EC_F_EC_ASN1_GROUP2FIELDID 154 +#define EC_F_EC_ASN1_GROUP2PARAMETERS 155 +#define EC_F_EC_ASN1_GROUP2PKPARAMETERS 156 +#define EC_F_EC_ASN1_PARAMETERS2GROUP 157 +#define EC_F_EC_ASN1_PKPARAMETERS2GROUP 158 +#define EC_F_EC_EX_DATA_SET_DATA 211 +#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208 +#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 +#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195 +#define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 +#define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 +#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 +#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 +#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 +#define EC_F_EC_GFP_MONT_FIELD_DECODE 133 +#define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 +#define EC_F_EC_GFP_MONT_FIELD_MUL 131 +#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209 +#define EC_F_EC_GFP_MONT_FIELD_SQR 132 +#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 +#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135 +#define EC_F_EC_GFP_NIST_FIELD_MUL 200 +#define EC_F_EC_GFP_NIST_FIELD_SQR 201 +#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 +#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP 100 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR 101 +#define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 +#define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 +#define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 +#define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129 +#define EC_F_EC_GROUP_CHECK 170 +#define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 +#define EC_F_EC_GROUP_COPY 106 +#define EC_F_EC_GROUP_GET0_GENERATOR 139 +#define EC_F_EC_GROUP_GET_COFACTOR 140 +#define EC_F_EC_GROUP_GET_CURVE_GF2M 172 +#define EC_F_EC_GROUP_GET_CURVE_GFP 130 +#define EC_F_EC_GROUP_GET_DEGREE 173 +#define EC_F_EC_GROUP_GET_ORDER 141 +#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193 +#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194 +#define EC_F_EC_GROUP_NEW 108 +#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174 +#define EC_F_EC_GROUP_NEW_FROM_DATA 175 +#define EC_F_EC_GROUP_PRECOMPUTE_MULT 142 +#define EC_F_EC_GROUP_SET_CURVE_GF2M 176 +#define EC_F_EC_GROUP_SET_CURVE_GFP 109 +#define EC_F_EC_GROUP_SET_EXTRA_DATA 110 +#define EC_F_EC_GROUP_SET_GENERATOR 111 +#define EC_F_EC_KEY_CHECK_KEY 177 +#define EC_F_EC_KEY_COPY 178 +#define EC_F_EC_KEY_GENERATE_KEY 179 +#define EC_F_EC_KEY_NEW 182 +#define EC_F_EC_KEY_PRINT 180 +#define EC_F_EC_KEY_PRINT_FP 181 +#define EC_F_EC_POINTS_MAKE_AFFINE 136 +#define EC_F_EC_POINTS_MUL 138 +#define EC_F_EC_POINT_ADD 112 +#define EC_F_EC_POINT_CMP 113 +#define EC_F_EC_POINT_COPY 114 +#define EC_F_EC_POINT_DBL 115 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 +#define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 +#define EC_F_EC_POINT_INVERT 210 +#define EC_F_EC_POINT_IS_AT_INFINITY 118 +#define EC_F_EC_POINT_IS_ON_CURVE 119 +#define EC_F_EC_POINT_MAKE_AFFINE 120 +#define EC_F_EC_POINT_MUL 184 +#define EC_F_EC_POINT_NEW 121 +#define EC_F_EC_POINT_OCT2POINT 122 +#define EC_F_EC_POINT_POINT2OCT 123 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 +#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 +#define EC_F_EC_POINT_SET_TO_INFINITY 127 +#define EC_F_EC_PRE_COMP_DUP 207 +#define EC_F_EC_PRE_COMP_NEW 196 +#define EC_F_EC_WNAF_MUL 187 +#define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 +#define EC_F_I2D_ECPARAMETERS 190 +#define EC_F_I2D_ECPKPARAMETERS 191 +#define EC_F_I2D_ECPRIVATEKEY 192 +#define EC_F_I2O_ECPUBLICKEY 151 +#define EC_F_O2I_ECPUBLICKEY 152 + +/* Reason codes. */ +#define EC_R_ASN1_ERROR 115 +#define EC_R_ASN1_UNKNOWN_FIELD 116 +#define EC_R_BUFFER_TOO_SMALL 100 +#define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 +#define EC_R_DISCRIMINANT_IS_ZERO 118 +#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 +#define EC_R_FIELD_TOO_LARGE 138 +#define EC_R_GROUP2PKPARAMETERS_FAILURE 120 +#define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 +#define EC_R_INCOMPATIBLE_OBJECTS 101 +#define EC_R_INVALID_ARGUMENT 112 +#define EC_R_INVALID_COMPRESSED_POINT 110 +#define EC_R_INVALID_COMPRESSION_BIT 109 +#define EC_R_INVALID_ENCODING 102 +#define EC_R_INVALID_FIELD 103 +#define EC_R_INVALID_FORM 104 +#define EC_R_INVALID_GROUP_ORDER 122 +#define EC_R_INVALID_PENTANOMIAL_BASIS 132 +#define EC_R_INVALID_PRIVATE_KEY 123 +#define EC_R_INVALID_TRINOMIAL_BASIS 137 +#define EC_R_MISSING_PARAMETERS 124 +#define EC_R_MISSING_PRIVATE_KEY 125 +#define EC_R_NOT_A_NIST_PRIME 135 +#define EC_R_NOT_A_SUPPORTED_NIST_PRIME 136 +#define EC_R_NOT_IMPLEMENTED 126 +#define EC_R_NOT_INITIALIZED 111 +#define EC_R_NO_FIELD_MOD 133 +#define EC_R_PASSED_NULL_PARAMETER 134 +#define EC_R_PKPARAMETERS2GROUP_FAILURE 127 +#define EC_R_POINT_AT_INFINITY 106 +#define EC_R_POINT_IS_NOT_ON_CURVE 107 +#define EC_R_SLOT_FULL 108 +#define EC_R_UNDEFINED_GENERATOR 113 +#define EC_R_UNDEFINED_ORDER 128 +#define EC_R_UNKNOWN_GROUP 129 +#define EC_R_UNKNOWN_ORDER 114 +#define EC_R_UNSUPPORTED_FIELD 131 +#define EC_R_WRONG_ORDER 130 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/ecdh.h b/externals/openssl/ecdh.h new file mode 100644 index 0000000..ee07aa0 --- /dev/null +++ b/externals/openssl/ecdh.h @@ -0,0 +1,124 @@ +/* crypto/ecdh/ecdh.h */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * The Elliptic Curve Public-Key Crypto Library (ECC Code) included + * herein is developed by SUN MICROSYSTEMS, INC., and is contributed + * to the OpenSSL project. + * + * The ECC Code is licensed pursuant to the OpenSSL open source + * license provided below. + * + * The ECDH software is originally written by Douglas Stebila of + * Sun Microsystems Laboratories. + * + */ +/* ==================================================================== + * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ECDH_H +#define HEADER_ECDH_H + +#include + +#ifdef OPENSSL_NO_ECDH +#error ECDH is disabled. +#endif + +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +const ECDH_METHOD *ECDH_OpenSSL(void); + +void ECDH_set_default_method(const ECDH_METHOD *); +const ECDH_METHOD *ECDH_get_default_method(void); +int ECDH_set_method(EC_KEY *, const ECDH_METHOD *); + +int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, + void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)); + +int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new + *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg); +void *ECDH_get_ex_data(EC_KEY *d, int idx); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ECDH_strings(void); + +/* Error codes for the ECDH functions. */ + +/* Function codes. */ +#define ECDH_F_ECDH_COMPUTE_KEY 100 +#define ECDH_F_ECDH_DATA_NEW_METHOD 101 + +/* Reason codes. */ +#define ECDH_R_KDF_FAILED 102 +#define ECDH_R_NO_PRIVATE_VALUE 100 +#define ECDH_R_POINT_ARITHMETIC_FAILURE 101 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/ecdsa.h b/externals/openssl/ecdsa.h new file mode 100644 index 0000000..1f85df7 --- /dev/null +++ b/externals/openssl/ecdsa.h @@ -0,0 +1,272 @@ +/* crypto/ecdsa/ecdsa.h */ +/** + * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions + * \author Written by Nils Larsch for the OpenSSL project + */ +/* ==================================================================== + * Copyright (c) 2000-2003 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_ECDSA_H +#define HEADER_ECDSA_H + +#include + +#ifdef OPENSSL_NO_ECDSA +#error ECDSA is disabled. +#endif + +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ECDSA_SIG_st + { + BIGNUM *r; + BIGNUM *s; + } ECDSA_SIG; + +/** ECDSA_SIG *ECDSA_SIG_new(void) + * allocates and initialize a ECDSA_SIG structure + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_SIG_new(void); + +/** ECDSA_SIG_free + * frees a ECDSA_SIG structure + * \param a pointer to the ECDSA_SIG structure + */ +void ECDSA_SIG_free(ECDSA_SIG *a); + +/** i2d_ECDSA_SIG + * DER encode content of ECDSA_SIG object (note: this function modifies *pp + * (*pp += length of the DER encoded signature)). + * \param a pointer to the ECDSA_SIG object + * \param pp pointer to a unsigned char pointer for the output or NULL + * \return the length of the DER encoded ECDSA_SIG object or 0 + */ +int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp); + +/** d2i_ECDSA_SIG + * decodes a DER encoded ECDSA signature (note: this function changes *pp + * (*pp += len)). + * \param v pointer to ECDSA_SIG pointer (may be NULL) + * \param pp buffer with the DER encoded signature + * \param len bufferlength + * \return pointer to the decoded ECDSA_SIG structure (or NULL) + */ +ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **v, const unsigned char **pp, long len); + +/** ECDSA_do_sign + * computes the ECDSA signature of the given hash value using + * the supplied private key and returns the created signature. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param eckey pointer to the EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL + */ +ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey); + +/** ECDSA_do_sign_ex + * computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param kinv optional pointer to a pre-computed inverse k + * \param rp optional pointer to the pre-computed rp value (see + * ECDSA_sign_setup + * \param eckey pointer to the EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL + */ +ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, + const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); + +/** ECDSA_do_verify + * verifies that the supplied signature is a valid ECDSA + * signature of the supplied hash value using the supplied public key. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param sig pointer to the ECDSA_SIG structure + * \param eckey pointer to the EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error + */ +int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, + const ECDSA_SIG *sig, EC_KEY* eckey); + +const ECDSA_METHOD *ECDSA_OpenSSL(void); + +/** ECDSA_set_default_method + * sets the default ECDSA method + * \param meth the new default ECDSA_METHOD + */ +void ECDSA_set_default_method(const ECDSA_METHOD *meth); + +/** ECDSA_get_default_method + * returns the default ECDSA method + * \return pointer to ECDSA_METHOD structure containing the default method + */ +const ECDSA_METHOD *ECDSA_get_default_method(void); + +/** ECDSA_set_method + * sets method to be used for the ECDSA operations + * \param eckey pointer to the EC_KEY object + * \param meth pointer to the new method + * \return 1 on success and 0 otherwise + */ +int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth); + +/** ECDSA_size + * returns the maximum length of the DER encoded signature + * \param eckey pointer to a EC_KEY object + * \return numbers of bytes required for the DER encoded signature + */ +int ECDSA_size(const EC_KEY *eckey); + +/** ECDSA_sign_setup + * precompute parts of the signing operation. + * \param eckey pointer to the EC_KEY object containing a private EC key + * \param ctx pointer to a BN_CTX object (may be NULL) + * \param kinv pointer to a BIGNUM pointer for the inverse of k + * \param rp pointer to a BIGNUM pointer for x coordinate of k * generator + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, + BIGNUM **rp); + +/** ECDSA_sign + * computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig buffer to hold the DER encoded signature + * \param siglen pointer to the length of the returned signature + * \param eckey pointer to the EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); + + +/** ECDSA_sign_ex + * computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig buffer to hold the DER encoded signature + * \param siglen pointer to the length of the returned signature + * \param kinv optional pointer to a pre-computed inverse k + * \param rp optional pointer to the pre-computed rp value (see + * ECDSA_sign_setup + * \param eckey pointer to the EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, + const BIGNUM *rp, EC_KEY *eckey); + +/** ECDSA_verify + * verifies that the given signature is valid ECDSA signature + * of the supplied hash value using the specified public key. + * \param type this parameter is ignored + * \param dgst pointer to the hash value + * \param dgstlen length of the hash value + * \param sig pointer to the DER encoded signature + * \param siglen length of the DER encoded signature + * \param eckey pointer to the EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error + */ +int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, + const unsigned char *sig, int siglen, EC_KEY *eckey); + +/* the standard ex_data functions */ +int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new + *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg); +void *ECDSA_get_ex_data(EC_KEY *d, int idx); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ECDSA_strings(void); + +/* Error codes for the ECDSA functions. */ + +/* Function codes. */ +#define ECDSA_F_ECDSA_DATA_NEW_METHOD 100 +#define ECDSA_F_ECDSA_DO_SIGN 101 +#define ECDSA_F_ECDSA_DO_VERIFY 102 +#define ECDSA_F_ECDSA_SIGN_SETUP 103 + +/* Reason codes. */ +#define ECDSA_R_BAD_SIGNATURE 100 +#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 101 +#define ECDSA_R_ERR_EC_LIB 102 +#define ECDSA_R_MISSING_PARAMETERS 103 +#define ECDSA_R_NEED_NEW_SETUP_VALUES 106 +#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104 +#define ECDSA_R_SIGNATURE_MALLOC_FAILED 105 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/engine.h b/externals/openssl/engine.h new file mode 100644 index 0000000..f503595 --- /dev/null +++ b/externals/openssl/engine.h @@ -0,0 +1,801 @@ +/* openssl/engine.h */ +/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_ENGINE_H +#define HEADER_ENGINE_H + +#include + +#ifdef OPENSSL_NO_ENGINE +#error ENGINE is disabled. +#endif + +#ifndef OPENSSL_NO_DEPRECATED +#include +#ifndef OPENSSL_NO_RSA +#include +#endif +#ifndef OPENSSL_NO_DSA +#include +#endif +#ifndef OPENSSL_NO_DH +#include +#endif +#ifndef OPENSSL_NO_ECDH +#include +#endif +#ifndef OPENSSL_NO_ECDSA +#include +#endif +#include +#include +#include +#include +#endif + +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These flags are used to control combinations of algorithm (methods) + * by bitwise "OR"ing. */ +#define ENGINE_METHOD_RSA (unsigned int)0x0001 +#define ENGINE_METHOD_DSA (unsigned int)0x0002 +#define ENGINE_METHOD_DH (unsigned int)0x0004 +#define ENGINE_METHOD_RAND (unsigned int)0x0008 +#define ENGINE_METHOD_ECDH (unsigned int)0x0010 +#define ENGINE_METHOD_ECDSA (unsigned int)0x0020 +#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 +#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 +#define ENGINE_METHOD_STORE (unsigned int)0x0100 +/* Obvious all-or-nothing cases. */ +#define ENGINE_METHOD_ALL (unsigned int)0xFFFF +#define ENGINE_METHOD_NONE (unsigned int)0x0000 + +/* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used + * internally to control registration of ENGINE implementations, and can be set + * by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to + * initialise registered ENGINEs if they are not already initialised. */ +#define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 + +/* ENGINE flags that can be set by ENGINE_set_flags(). */ +/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ /* Not used */ + +/* This flag is for ENGINEs that wish to handle the various 'CMD'-related + * control commands on their own. Without this flag, ENGINE_ctrl() handles these + * control commands on behalf of the ENGINE using their "cmd_defns" data. */ +#define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 + +/* This flag is for ENGINEs who return new duplicate structures when found via + * "ENGINE_by_id()". When an ENGINE must store state (eg. if ENGINE_ctrl() + * commands are called in sequence as part of some stateful process like + * key-generation setup and execution), it can set this flag - then each attempt + * to obtain the ENGINE will result in it being copied into a new structure. + * Normally, ENGINEs don't declare this flag so ENGINE_by_id() just increments + * the existing ENGINE's structural reference count. */ +#define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 + +/* ENGINEs can support their own command types, and these flags are used in + * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input each + * command expects. Currently only numeric and string input is supported. If a + * control command supports none of the _NUMERIC, _STRING, or _NO_INPUT options, + * then it is regarded as an "internal" control command - and not for use in + * config setting situations. As such, they're not available to the + * ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() access. Changes to + * this list of 'command types' should be reflected carefully in + * ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */ + +/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ +#define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 +/* accepts string input (cast from 'void*' to 'const char *', 4th parameter to + * ENGINE_ctrl) */ +#define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 +/* Indicates that the control command takes *no* input. Ie. the control command + * is unparameterised. */ +#define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 +/* Indicates that the control command is internal. This control command won't + * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() + * function. */ +#define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 + +/* NB: These 3 control commands are deprecated and should not be used. ENGINEs + * relying on these commands should compile conditional support for + * compatibility (eg. if these symbols are defined) but should also migrate the + * same functionality to their own ENGINE-specific control functions that can be + * "discovered" by calling applications. The fact these control commands + * wouldn't be "executable" (ie. usable by text-based config) doesn't change the + * fact that application code can find and use them without requiring per-ENGINE + * hacking. */ + +/* These flags are used to tell the ctrl function what should be done. + * All command numbers are shared between all engines, even if some don't + * make sense to some engines. In such a case, they do nothing but return + * the error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */ +#define ENGINE_CTRL_SET_LOGSTREAM 1 +#define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 +#define ENGINE_CTRL_HUP 3 /* Close and reinitialise any + handles/connections etc. */ +#define ENGINE_CTRL_SET_USER_INTERFACE 4 /* Alternative to callback */ +#define ENGINE_CTRL_SET_CALLBACK_DATA 5 /* User-specific data, used + when calling the password + callback and the user + interface */ +#define ENGINE_CTRL_LOAD_CONFIGURATION 6 /* Load a configuration, given + a string that represents a + file name or so */ +#define ENGINE_CTRL_LOAD_SECTION 7 /* Load data from a given + section in the already loaded + configuration */ + +/* These control commands allow an application to deal with an arbitrary engine + * in a dynamic way. Warn: Negative return values indicate errors FOR THESE + * COMMANDS because zero is used to indicate 'end-of-list'. Other commands, + * including ENGINE-specific command types, return zero for an error. + * + * An ENGINE can choose to implement these ctrl functions, and can internally + * manage things however it chooses - it does so by setting the + * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise the + * ENGINE_ctrl() code handles this on the ENGINE's behalf using the cmd_defns + * data (set using ENGINE_set_cmd_defns()). This means an ENGINE's ctrl() + * handler need only implement its own commands - the above "meta" commands will + * be taken care of. */ + +/* Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", then + * all the remaining control commands will return failure, so it is worth + * checking this first if the caller is trying to "discover" the engine's + * capabilities and doesn't want errors generated unnecessarily. */ +#define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 +/* Returns a positive command number for the first command supported by the + * engine. Returns zero if no ctrl commands are supported. */ +#define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 +/* The 'long' argument specifies a command implemented by the engine, and the + * return value is the next command supported, or zero if there are no more. */ +#define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 +/* The 'void*' argument is a command name (cast from 'const char *'), and the + * return value is the command that corresponds to it. */ +#define ENGINE_CTRL_GET_CMD_FROM_NAME 13 +/* The next two allow a command to be converted into its corresponding string + * form. In each case, the 'long' argument supplies the command. In the NAME_LEN + * case, the return value is the length of the command name (not counting a + * trailing EOL). In the NAME case, the 'void*' argument must be a string buffer + * large enough, and it will be populated with the name of the command (WITH a + * trailing EOL). */ +#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 +#define ENGINE_CTRL_GET_NAME_FROM_CMD 15 +/* The next two are similar but give a "short description" of a command. */ +#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 +#define ENGINE_CTRL_GET_DESC_FROM_CMD 17 +/* With this command, the return value is the OR'd combination of + * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given + * engine-specific ctrl command expects. */ +#define ENGINE_CTRL_GET_CMD_FLAGS 18 + +/* ENGINE implementations should start the numbering of their own control + * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */ +#define ENGINE_CMD_BASE 200 + +/* NB: These 2 nCipher "chil" control commands are deprecated, and their + * functionality is now available through ENGINE-specific control commands + * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 + * commands should be migrated to the more general command handling before these + * are removed. */ + +/* Flags specific to the nCipher "chil" engine */ +#define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 + /* Depending on the value of the (long)i argument, this sets or + * unsets the SimpleForkCheck flag in the CHIL API to enable or + * disable checking and workarounds for applications that fork(). + */ +#define ENGINE_CTRL_CHIL_NO_LOCKING 101 + /* This prevents the initialisation function from providing mutex + * callbacks to the nCipher library. */ + +/* If an ENGINE supports its own specific control commands and wishes the + * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its + * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries + * to ENGINE_set_cmd_defns(). It should also implement a ctrl() handler that + * supports the stated commands (ie. the "cmd_num" entries as described by the + * array). NB: The array must be ordered in increasing order of cmd_num. + * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set + * to zero and/or cmd_name set to NULL. */ +typedef struct ENGINE_CMD_DEFN_st + { + unsigned int cmd_num; /* The command number */ + const char *cmd_name; /* The command name itself */ + const char *cmd_desc; /* A short description of the command */ + unsigned int cmd_flags; /* The input the command expects */ + } ENGINE_CMD_DEFN; + +/* Generic function pointer */ +typedef int (*ENGINE_GEN_FUNC_PTR)(void); +/* Generic function pointer taking no arguments */ +typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *); +/* Specific control function pointer */ +typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void)); +/* Generic load_key function pointer */ +typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, + UI_METHOD *ui_method, void *callback_data); +typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl, + STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, + STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); +/* These callback types are for an ENGINE's handler for cipher and digest logic. + * These handlers have these prototypes; + * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); + * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); + * Looking at how to implement these handlers in the case of cipher support, if + * the framework wants the EVP_CIPHER for 'nid', it will call; + * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) + * If the framework wants a list of supported 'nid's, it will call; + * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) + */ +/* Returns to a pointer to the array of supported cipher 'nid's. If the second + * parameter is non-NULL it is set to the size of the returned array. */ +typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int); +typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int); + +/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE + * structures where the pointers have a "structural reference". This means that + * their reference is to allowed access to the structure but it does not imply + * that the structure is functional. To simply increment or decrement the + * structural reference count, use ENGINE_by_id and ENGINE_free. NB: This is not + * required when iterating using ENGINE_get_next as it will automatically + * decrement the structural reference count of the "current" ENGINE and + * increment the structural reference count of the ENGINE it returns (unless it + * is NULL). */ + +/* Get the first/last "ENGINE" type available. */ +ENGINE *ENGINE_get_first(void); +ENGINE *ENGINE_get_last(void); +/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ +ENGINE *ENGINE_get_next(ENGINE *e); +ENGINE *ENGINE_get_prev(ENGINE *e); +/* Add another "ENGINE" type into the array. */ +int ENGINE_add(ENGINE *e); +/* Remove an existing "ENGINE" type from the array. */ +int ENGINE_remove(ENGINE *e); +/* Retrieve an engine from the list by its unique "id" value. */ +ENGINE *ENGINE_by_id(const char *id); +/* Add all the built-in engines. */ +void ENGINE_load_openssl(void); +void ENGINE_load_dynamic(void); +#ifndef OPENSSL_NO_STATIC_ENGINE +void ENGINE_load_4758cca(void); +void ENGINE_load_aep(void); +void ENGINE_load_atalla(void); +void ENGINE_load_chil(void); +void ENGINE_load_cswift(void); +#ifndef OPENSSL_NO_GMP +void ENGINE_load_gmp(void); +#endif +void ENGINE_load_nuron(void); +void ENGINE_load_sureware(void); +void ENGINE_load_ubsec(void); +#endif +void ENGINE_load_cryptodev(void); +void ENGINE_load_padlock(void); +void ENGINE_load_builtin_engines(void); +#ifndef OPENSSL_NO_CAPIENG +void ENGINE_load_capi(void); +#endif + +/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation + * "registry" handling. */ +unsigned int ENGINE_get_table_flags(void); +void ENGINE_set_table_flags(unsigned int flags); + +/* Manage registration of ENGINEs per "table". For each type, there are 3 + * functions; + * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) + * ENGINE_unregister_***(e) - unregister the implementation from 'e' + * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list + * Cleanup is automatically registered from each table when required, so + * ENGINE_cleanup() will reverse any "register" operations. */ + +int ENGINE_register_RSA(ENGINE *e); +void ENGINE_unregister_RSA(ENGINE *e); +void ENGINE_register_all_RSA(void); + +int ENGINE_register_DSA(ENGINE *e); +void ENGINE_unregister_DSA(ENGINE *e); +void ENGINE_register_all_DSA(void); + +int ENGINE_register_ECDH(ENGINE *e); +void ENGINE_unregister_ECDH(ENGINE *e); +void ENGINE_register_all_ECDH(void); + +int ENGINE_register_ECDSA(ENGINE *e); +void ENGINE_unregister_ECDSA(ENGINE *e); +void ENGINE_register_all_ECDSA(void); + +int ENGINE_register_DH(ENGINE *e); +void ENGINE_unregister_DH(ENGINE *e); +void ENGINE_register_all_DH(void); + +int ENGINE_register_RAND(ENGINE *e); +void ENGINE_unregister_RAND(ENGINE *e); +void ENGINE_register_all_RAND(void); + +int ENGINE_register_STORE(ENGINE *e); +void ENGINE_unregister_STORE(ENGINE *e); +void ENGINE_register_all_STORE(void); + +int ENGINE_register_ciphers(ENGINE *e); +void ENGINE_unregister_ciphers(ENGINE *e); +void ENGINE_register_all_ciphers(void); + +int ENGINE_register_digests(ENGINE *e); +void ENGINE_unregister_digests(ENGINE *e); +void ENGINE_register_all_digests(void); + +/* These functions register all support from the above categories. Note, use of + * these functions can result in static linkage of code your application may not + * need. If you only need a subset of functionality, consider using more + * selective initialisation. */ +int ENGINE_register_complete(ENGINE *e); +int ENGINE_register_all_complete(void); + +/* Send parametrised control commands to the engine. The possibilities to send + * down an integer, a pointer to data or a function pointer are provided. Any of + * the parameters may or may not be NULL, depending on the command number. In + * actuality, this function only requires a structural (rather than functional) + * reference to an engine, but many control commands may require the engine be + * functional. The caller should be aware of trying commands that require an + * operational ENGINE, and only use functional references in such situations. */ +int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)); + +/* This function tests if an ENGINE-specific command is usable as a "setting". + * Eg. in an application's config file that gets processed through + * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to + * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */ +int ENGINE_cmd_is_executable(ENGINE *e, int cmd); + +/* This function works like ENGINE_ctrl() with the exception of taking a + * command name instead of a command number, and can handle optional commands. + * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to + * use the cmd_name and cmd_optional. */ +int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, + long i, void *p, void (*f)(void), int cmd_optional); + +/* This function passes a command-name and argument to an ENGINE. The cmd_name + * is converted to a command number and the control command is called using + * 'arg' as an argument (unless the ENGINE doesn't support such a command, in + * which case no control command is called). The command is checked for input + * flags, and if necessary the argument will be converted to a numeric value. If + * cmd_optional is non-zero, then if the ENGINE doesn't support the given + * cmd_name the return value will be success anyway. This function is intended + * for applications to use so that users (or config files) can supply + * engine-specific config data to the ENGINE at run-time to control behaviour of + * specific engines. As such, it shouldn't be used for calling ENGINE_ctrl() + * functions that return data, deal with binary data, or that are otherwise + * supposed to be used directly through ENGINE_ctrl() in application code. Any + * "return" data from an ENGINE_ctrl() operation in this function will be lost - + * the return value is interpreted as failure if the return value is zero, + * success otherwise, and this function returns a boolean value as a result. In + * other words, vendors of 'ENGINE'-enabled devices should write ENGINE + * implementations with parameterisations that work in this scheme, so that + * compliant ENGINE-based applications can work consistently with the same + * configuration for the same ENGINE-enabled devices, across applications. */ +int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, + int cmd_optional); + +/* These functions are useful for manufacturing new ENGINE structures. They + * don't address reference counting at all - one uses them to populate an ENGINE + * structure with personalised implementations of things prior to using it + * directly or adding it to the builtin ENGINE list in OpenSSL. These are also + * here so that the ENGINE structure doesn't have to be exposed and break binary + * compatibility! */ +ENGINE *ENGINE_new(void); +int ENGINE_free(ENGINE *e); +int ENGINE_up_ref(ENGINE *e); +int ENGINE_set_id(ENGINE *e, const char *id); +int ENGINE_set_name(ENGINE *e, const char *name); +int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); +int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); +int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth); +int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth); +int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); +int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); +int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth); +int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); +int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); +int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); +int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); +int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); +int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); +int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, + ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); +int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); +int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); +int ENGINE_set_flags(ENGINE *e, int flags); +int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); +/* These functions allow control over any per-structure ENGINE data. */ +int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); +void *ENGINE_get_ex_data(const ENGINE *e, int idx); + +/* This function cleans up anything that needs it. Eg. the ENGINE_add() function + * automatically ensures the list cleanup function is registered to be called + * from ENGINE_cleanup(). Similarly, all ENGINE_register_*** functions ensure + * ENGINE_cleanup() will clean up after them. */ +void ENGINE_cleanup(void); + +/* These return values from within the ENGINE structure. These can be useful + * with functional references as well as structural references - it depends + * which you obtained. Using the result for functional purposes if you only + * obtained a structural reference may be problematic! */ +const char *ENGINE_get_id(const ENGINE *e); +const char *ENGINE_get_name(const ENGINE *e); +const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); +const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); +const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); +const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); +const DH_METHOD *ENGINE_get_DH(const ENGINE *e); +const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); +const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); +ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); +ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); +ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); +ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); +const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); +const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); +const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); +int ENGINE_get_flags(const ENGINE *e); + +/* FUNCTIONAL functions. These functions deal with ENGINE structures + * that have (or will) be initialised for use. Broadly speaking, the + * structural functions are useful for iterating the list of available + * engine types, creating new engine types, and other "list" operations. + * These functions actually deal with ENGINEs that are to be used. As + * such these functions can fail (if applicable) when particular + * engines are unavailable - eg. if a hardware accelerator is not + * attached or not functioning correctly. Each ENGINE has 2 reference + * counts; structural and functional. Every time a functional reference + * is obtained or released, a corresponding structural reference is + * automatically obtained or released too. */ + +/* Initialise a engine type for use (or up its reference count if it's + * already in use). This will fail if the engine is not currently + * operational and cannot initialise. */ +int ENGINE_init(ENGINE *e); +/* Free a functional reference to a engine type. This does not require + * a corresponding call to ENGINE_free as it also releases a structural + * reference. */ +int ENGINE_finish(ENGINE *e); + +/* The following functions handle keys that are stored in some secondary + * location, handled by the engine. The storage may be on a card or + * whatever. */ +EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, + STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, + STACK_OF(X509) **pother, + UI_METHOD *ui_method, void *callback_data); + +/* This returns a pointer for the current ENGINE structure that + * is (by default) performing any RSA operations. The value returned + * is an incremented reference, so it should be free'd (ENGINE_finish) + * before it is discarded. */ +ENGINE *ENGINE_get_default_RSA(void); +/* Same for the other "methods" */ +ENGINE *ENGINE_get_default_DSA(void); +ENGINE *ENGINE_get_default_ECDH(void); +ENGINE *ENGINE_get_default_ECDSA(void); +ENGINE *ENGINE_get_default_DH(void); +ENGINE *ENGINE_get_default_RAND(void); +/* These functions can be used to get a functional reference to perform + * ciphering or digesting corresponding to "nid". */ +ENGINE *ENGINE_get_cipher_engine(int nid); +ENGINE *ENGINE_get_digest_engine(int nid); + +/* This sets a new default ENGINE structure for performing RSA + * operations. If the result is non-zero (success) then the ENGINE + * structure will have had its reference count up'd so the caller + * should still free their own reference 'e'. */ +int ENGINE_set_default_RSA(ENGINE *e); +int ENGINE_set_default_string(ENGINE *e, const char *def_list); +/* Same for the other "methods" */ +int ENGINE_set_default_DSA(ENGINE *e); +int ENGINE_set_default_ECDH(ENGINE *e); +int ENGINE_set_default_ECDSA(ENGINE *e); +int ENGINE_set_default_DH(ENGINE *e); +int ENGINE_set_default_RAND(ENGINE *e); +int ENGINE_set_default_ciphers(ENGINE *e); +int ENGINE_set_default_digests(ENGINE *e); + +/* The combination "set" - the flags are bitwise "OR"d from the + * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" + * function, this function can result in unnecessary static linkage. If your + * application requires only specific functionality, consider using more + * selective functions. */ +int ENGINE_set_default(ENGINE *e, unsigned int flags); + +void ENGINE_add_conf_module(void); + +/* Deprecated functions ... */ +/* int ENGINE_clear_defaults(void); */ + +/**************************/ +/* DYNAMIC ENGINE SUPPORT */ +/**************************/ + +/* Binary/behaviour compatibility levels */ +#define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000 +/* Binary versions older than this are too old for us (whether we're a loader or + * a loadee) */ +#define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000 + +/* When compiling an ENGINE entirely as an external shared library, loadable by + * the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' structure + * type provides the calling application's (or library's) error functionality + * and memory management function pointers to the loaded library. These should + * be used/set in the loaded library code so that the loading application's + * 'state' will be used/changed in all operations. The 'static_state' pointer + * allows the loaded library to know if it shares the same static data as the + * calling application (or library), and thus whether these callbacks need to be + * set or not. */ +typedef void *(*dyn_MEM_malloc_cb)(size_t); +typedef void *(*dyn_MEM_realloc_cb)(void *, size_t); +typedef void (*dyn_MEM_free_cb)(void *); +typedef struct st_dynamic_MEM_fns { + dyn_MEM_malloc_cb malloc_cb; + dyn_MEM_realloc_cb realloc_cb; + dyn_MEM_free_cb free_cb; + } dynamic_MEM_fns; +/* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use + * these types so we (and any other dependant code) can simplify a bit?? */ +typedef void (*dyn_lock_locking_cb)(int,int,const char *,int); +typedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int); +typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)( + const char *,int); +typedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *, + const char *,int); +typedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *, + const char *,int); +typedef struct st_dynamic_LOCK_fns { + dyn_lock_locking_cb lock_locking_cb; + dyn_lock_add_lock_cb lock_add_lock_cb; + dyn_dynlock_create_cb dynlock_create_cb; + dyn_dynlock_lock_cb dynlock_lock_cb; + dyn_dynlock_destroy_cb dynlock_destroy_cb; + } dynamic_LOCK_fns; +/* The top-level structure */ +typedef struct st_dynamic_fns { + void *static_state; + const ERR_FNS *err_fns; + const CRYPTO_EX_DATA_IMPL *ex_data_fns; + dynamic_MEM_fns mem_fns; + dynamic_LOCK_fns lock_fns; + } dynamic_fns; + +/* The version checking function should be of this prototype. NB: The + * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code. + * If this function returns zero, it indicates a (potential) version + * incompatibility and the loaded library doesn't believe it can proceed. + * Otherwise, the returned value is the (latest) version supported by the + * loading library. The loader may still decide that the loaded code's version + * is unsatisfactory and could veto the load. The function is expected to + * be implemented with the symbol name "v_check", and a default implementation + * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */ +typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); +#define IMPLEMENT_DYNAMIC_CHECK_FN() \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ + if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ + return 0; } + +/* This function is passed the ENGINE structure to initialise with its own + * function and command settings. It should not adjust the structural or + * functional reference counts. If this function returns zero, (a) the load will + * be aborted, (b) the previous ENGINE state will be memcpy'd back onto the + * structure, and (c) the shared library will be unloaded. So implementations + * should do their own internal cleanup in failure circumstances otherwise they + * could leak. The 'id' parameter, if non-NULL, represents the ENGINE id that + * the loader is looking for. If this is NULL, the shared library can choose to + * return failure or to initialise a 'default' ENGINE. If non-NULL, the shared + * library must initialise only an ENGINE matching the passed 'id'. The function + * is expected to be implemented with the symbol name "bind_engine". A standard + * implementation can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where + * the parameter 'fn' is a callback function that populates the ENGINE structure + * and returns an int value (zero for failure). 'fn' should have prototype; + * [static] int fn(ENGINE *e, const char *id); */ +typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, + const dynamic_fns *fns); +#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ + if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ + if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ + fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \ + return 0; \ + CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ + CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ + CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ + CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ + CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ + if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \ + return 0; \ + if(!ERR_set_implementation(fns->err_fns)) return 0; \ + skip_cbs: \ + if(!fn(e,id)) return 0; \ + return 1; } + +/* If the loading application (or library) and the loaded ENGINE library share + * the same static data (eg. they're both dynamically linked to the same + * libcrypto.so) we need a way to avoid trying to set system callbacks - this + * would fail, and for the same reason that it's unnecessary to try. If the + * loaded ENGINE has (or gets from through the loader) its own copy of the + * libcrypto static data, we will need to set the callbacks. The easiest way to + * detect this is to have a function that returns a pointer to some static data + * and let the loading application and loaded ENGINE compare their respective + * values. */ +void *ENGINE_get_static_state(void); + +#if defined(__OpenBSD__) || defined(__FreeBSD__) +void ENGINE_setup_bsd_cryptodev(void); +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_ENGINE_strings(void); + +/* Error codes for the ENGINE functions. */ + +/* Function codes. */ +#define ENGINE_F_DYNAMIC_CTRL 180 +#define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 +#define ENGINE_F_DYNAMIC_LOAD 182 +#define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 +#define ENGINE_F_ENGINE_ADD 105 +#define ENGINE_F_ENGINE_BY_ID 106 +#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 +#define ENGINE_F_ENGINE_CTRL 142 +#define ENGINE_F_ENGINE_CTRL_CMD 178 +#define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 +#define ENGINE_F_ENGINE_FINISH 107 +#define ENGINE_F_ENGINE_FREE_UTIL 108 +#define ENGINE_F_ENGINE_GET_CIPHER 185 +#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 +#define ENGINE_F_ENGINE_GET_DIGEST 186 +#define ENGINE_F_ENGINE_GET_NEXT 115 +#define ENGINE_F_ENGINE_GET_PREV 116 +#define ENGINE_F_ENGINE_INIT 119 +#define ENGINE_F_ENGINE_LIST_ADD 120 +#define ENGINE_F_ENGINE_LIST_REMOVE 121 +#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 +#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 +#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 192 +#define ENGINE_F_ENGINE_NEW 122 +#define ENGINE_F_ENGINE_REMOVE 123 +#define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 +#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE 126 +#define ENGINE_F_ENGINE_SET_ID 129 +#define ENGINE_F_ENGINE_SET_NAME 130 +#define ENGINE_F_ENGINE_TABLE_REGISTER 184 +#define ENGINE_F_ENGINE_UNLOAD_KEY 152 +#define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 +#define ENGINE_F_ENGINE_UP_REF 190 +#define ENGINE_F_INT_CTRL_HELPER 172 +#define ENGINE_F_INT_ENGINE_CONFIGURE 188 +#define ENGINE_F_INT_ENGINE_MODULE_INIT 187 +#define ENGINE_F_LOG_MESSAGE 141 + +/* Reason codes. */ +#define ENGINE_R_ALREADY_LOADED 100 +#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 +#define ENGINE_R_CMD_NOT_EXECUTABLE 134 +#define ENGINE_R_COMMAND_TAKES_INPUT 135 +#define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 +#define ENGINE_R_CONFLICTING_ENGINE_ID 103 +#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 +#define ENGINE_R_DH_NOT_IMPLEMENTED 139 +#define ENGINE_R_DSA_NOT_IMPLEMENTED 140 +#define ENGINE_R_DSO_FAILURE 104 +#define ENGINE_R_DSO_NOT_FOUND 132 +#define ENGINE_R_ENGINES_SECTION_ERROR 148 +#define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 +#define ENGINE_R_ENGINE_SECTION_ERROR 149 +#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 +#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 +#define ENGINE_R_FINISH_FAILED 106 +#define ENGINE_R_GET_HANDLE_FAILED 107 +#define ENGINE_R_ID_OR_NAME_MISSING 108 +#define ENGINE_R_INIT_FAILED 109 +#define ENGINE_R_INTERNAL_LIST_ERROR 110 +#define ENGINE_R_INVALID_ARGUMENT 143 +#define ENGINE_R_INVALID_CMD_NAME 137 +#define ENGINE_R_INVALID_CMD_NUMBER 138 +#define ENGINE_R_INVALID_INIT_VALUE 151 +#define ENGINE_R_INVALID_STRING 150 +#define ENGINE_R_NOT_INITIALISED 117 +#define ENGINE_R_NOT_LOADED 112 +#define ENGINE_R_NO_CONTROL_FUNCTION 120 +#define ENGINE_R_NO_INDEX 144 +#define ENGINE_R_NO_LOAD_FUNCTION 125 +#define ENGINE_R_NO_REFERENCE 130 +#define ENGINE_R_NO_SUCH_ENGINE 116 +#define ENGINE_R_NO_UNLOAD_FUNCTION 126 +#define ENGINE_R_PROVIDE_PARAMETERS 113 +#define ENGINE_R_RSA_NOT_IMPLEMENTED 141 +#define ENGINE_R_UNIMPLEMENTED_CIPHER 146 +#define ENGINE_R_UNIMPLEMENTED_DIGEST 147 +#define ENGINE_R_VERSION_INCOMPATIBILITY 145 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/err.h b/externals/openssl/err.h new file mode 100644 index 0000000..dcac415 --- /dev/null +++ b/externals/openssl/err.h @@ -0,0 +1,330 @@ +/* crypto/err/err.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ERR_H +#define HEADER_ERR_H + +#include + +#ifndef OPENSSL_NO_FP_API +#include +#include +#endif + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_LHASH +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef OPENSSL_NO_ERR +#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) +#else +#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) +#endif + +#include + +#define ERR_TXT_MALLOCED 0x01 +#define ERR_TXT_STRING 0x02 + +#define ERR_FLAG_MARK 0x01 + +#define ERR_NUM_ERRORS 16 +typedef struct err_state_st + { + unsigned long pid; + int err_flags[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char *err_data[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + const char *err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + int top,bottom; + } ERR_STATE; + +/* library */ +#define ERR_LIB_NONE 1 +#define ERR_LIB_SYS 2 +#define ERR_LIB_BN 3 +#define ERR_LIB_RSA 4 +#define ERR_LIB_DH 5 +#define ERR_LIB_EVP 6 +#define ERR_LIB_BUF 7 +#define ERR_LIB_OBJ 8 +#define ERR_LIB_PEM 9 +#define ERR_LIB_DSA 10 +#define ERR_LIB_X509 11 +/* #define ERR_LIB_METH 12 */ +#define ERR_LIB_ASN1 13 +#define ERR_LIB_CONF 14 +#define ERR_LIB_CRYPTO 15 +#define ERR_LIB_EC 16 +#define ERR_LIB_SSL 20 +/* #define ERR_LIB_SSL23 21 */ +/* #define ERR_LIB_SSL2 22 */ +/* #define ERR_LIB_SSL3 23 */ +/* #define ERR_LIB_RSAREF 30 */ +/* #define ERR_LIB_PROXY 31 */ +#define ERR_LIB_BIO 32 +#define ERR_LIB_PKCS7 33 +#define ERR_LIB_X509V3 34 +#define ERR_LIB_PKCS12 35 +#define ERR_LIB_RAND 36 +#define ERR_LIB_DSO 37 +#define ERR_LIB_ENGINE 38 +#define ERR_LIB_OCSP 39 +#define ERR_LIB_UI 40 +#define ERR_LIB_COMP 41 +#define ERR_LIB_ECDSA 42 +#define ERR_LIB_ECDH 43 +#define ERR_LIB_STORE 44 +#define ERR_LIB_FIPS 45 +#define ERR_LIB_CMS 46 +#define ERR_LIB_JPAKE 47 + +#define ERR_LIB_USER 128 + +#define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__) +#define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__) +#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__) +#define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__) +#define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__) +#define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__) +#define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__) +#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__) +#define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__) +#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__) +#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__) +#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__) +#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__) +#define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__) +#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__) +#define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__) +#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__) +#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__) +#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__) +#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__) +#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__) +#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__) +#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) +#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) +#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) +#define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__) +#define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__) +#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__) +#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__) +#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__) +#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__) + +/* Borland C seems too stupid to be able to shift and do longs in + * the pre-processor :-( */ +#define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)*0x1000000)| \ + ((((unsigned long)f)&0xfffL)*0x1000)| \ + ((((unsigned long)r)&0xfffL))) +#define ERR_GET_LIB(l) (int)((((unsigned long)l)>>24L)&0xffL) +#define ERR_GET_FUNC(l) (int)((((unsigned long)l)>>12L)&0xfffL) +#define ERR_GET_REASON(l) (int)((l)&0xfffL) +#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL) + + +/* OS functions */ +#define SYS_F_FOPEN 1 +#define SYS_F_CONNECT 2 +#define SYS_F_GETSERVBYNAME 3 +#define SYS_F_SOCKET 4 +#define SYS_F_IOCTLSOCKET 5 +#define SYS_F_BIND 6 +#define SYS_F_LISTEN 7 +#define SYS_F_ACCEPT 8 +#define SYS_F_WSASTARTUP 9 /* Winsock stuff */ +#define SYS_F_OPENDIR 10 +#define SYS_F_FREAD 11 + + +/* reasons */ +#define ERR_R_SYS_LIB ERR_LIB_SYS /* 2 */ +#define ERR_R_BN_LIB ERR_LIB_BN /* 3 */ +#define ERR_R_RSA_LIB ERR_LIB_RSA /* 4 */ +#define ERR_R_DH_LIB ERR_LIB_DH /* 5 */ +#define ERR_R_EVP_LIB ERR_LIB_EVP /* 6 */ +#define ERR_R_BUF_LIB ERR_LIB_BUF /* 7 */ +#define ERR_R_OBJ_LIB ERR_LIB_OBJ /* 8 */ +#define ERR_R_PEM_LIB ERR_LIB_PEM /* 9 */ +#define ERR_R_DSA_LIB ERR_LIB_DSA /* 10 */ +#define ERR_R_X509_LIB ERR_LIB_X509 /* 11 */ +#define ERR_R_ASN1_LIB ERR_LIB_ASN1 /* 13 */ +#define ERR_R_CONF_LIB ERR_LIB_CONF /* 14 */ +#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO /* 15 */ +#define ERR_R_EC_LIB ERR_LIB_EC /* 16 */ +#define ERR_R_SSL_LIB ERR_LIB_SSL /* 20 */ +#define ERR_R_BIO_LIB ERR_LIB_BIO /* 32 */ +#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 /* 33 */ +#define ERR_R_X509V3_LIB ERR_LIB_X509V3 /* 34 */ +#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 /* 35 */ +#define ERR_R_RAND_LIB ERR_LIB_RAND /* 36 */ +#define ERR_R_DSO_LIB ERR_LIB_DSO /* 37 */ +#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE /* 38 */ +#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */ +#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */ +#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */ +#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */ +#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */ +#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */ + +#define ERR_R_NESTED_ASN1_ERROR 58 +#define ERR_R_BAD_ASN1_OBJECT_HEADER 59 +#define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60 +#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61 +#define ERR_R_ASN1_LENGTH_MISMATCH 62 +#define ERR_R_MISSING_ASN1_EOS 63 + +/* fatal error */ +#define ERR_R_FATAL 64 +#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) +#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) +#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) +#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) +#define ERR_R_DISABLED (5|ERR_R_FATAL) + +/* 99 is the maximum possible ERR_R_... code, higher values + * are reserved for the individual libraries */ + + +typedef struct ERR_string_data_st + { + unsigned long error; + const char *string; + } ERR_STRING_DATA; + +void ERR_put_error(int lib, int func,int reason,const char *file,int line); +void ERR_set_error_data(char *data,int flags); + +unsigned long ERR_get_error(void); +unsigned long ERR_get_error_line(const char **file,int *line); +unsigned long ERR_get_error_line_data(const char **file,int *line, + const char **data, int *flags); +unsigned long ERR_peek_error(void); +unsigned long ERR_peek_error_line(const char **file,int *line); +unsigned long ERR_peek_error_line_data(const char **file,int *line, + const char **data,int *flags); +unsigned long ERR_peek_last_error(void); +unsigned long ERR_peek_last_error_line(const char **file,int *line); +unsigned long ERR_peek_last_error_line_data(const char **file,int *line, + const char **data,int *flags); +void ERR_clear_error(void ); +char *ERR_error_string(unsigned long e,char *buf); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +const char *ERR_lib_error_string(unsigned long e); +const char *ERR_func_error_string(unsigned long e); +const char *ERR_reason_error_string(unsigned long e); +void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), + void *u); +#ifndef OPENSSL_NO_FP_API +void ERR_print_errors_fp(FILE *fp); +#endif +#ifndef OPENSSL_NO_BIO +void ERR_print_errors(BIO *bp); +void ERR_add_error_data(int num, ...); +#endif +void ERR_load_strings(int lib,ERR_STRING_DATA str[]); +void ERR_unload_strings(int lib,ERR_STRING_DATA str[]); +void ERR_load_ERR_strings(void); +void ERR_load_crypto_strings(void); +void ERR_free_strings(void); + +void ERR_remove_state(unsigned long pid); /* if zero we look it up */ +ERR_STATE *ERR_get_state(void); + +#ifndef OPENSSL_NO_LHASH +LHASH *ERR_get_string_table(void); +LHASH *ERR_get_err_state_table(void); +void ERR_release_err_state_table(LHASH **hash); +#endif + +int ERR_get_next_error_library(void); + +int ERR_set_mark(void); +int ERR_pop_to_mark(void); + +#ifdef OPENSSL_FIPS +void int_ERR_set_state_func(ERR_STATE *(*get_func)(void), + void (*remove_func)(unsigned long pid)); +void int_ERR_lib_init(void); +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct st_ERR_FNS ERR_FNS; */ +/* An application can use this function and provide the return value to loaded + * modules that should use the application's ERR state/functionality */ +const ERR_FNS *ERR_get_implementation(void); +/* A loaded module should call this function prior to any ERR operations using + * the application's "ERR_FNS". */ +int ERR_set_implementation(const ERR_FNS *fns); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/evp.h b/externals/openssl/evp.h new file mode 100644 index 0000000..79c0971 --- /dev/null +++ b/externals/openssl/evp.h @@ -0,0 +1,1059 @@ +/* crypto/evp/evp.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_ENVELOPE_H +#define HEADER_ENVELOPE_H + +#ifdef OPENSSL_ALGORITHM_DEFINES +# include +#else +# define OPENSSL_ALGORITHM_DEFINES +# include +# undef OPENSSL_ALGORITHM_DEFINES +#endif + +#include + +#include + +#ifndef OPENSSL_NO_BIO +#include +#endif + +#ifdef OPENSSL_FIPS +#include +#endif + +/* +#define EVP_RC2_KEY_SIZE 16 +#define EVP_RC4_KEY_SIZE 16 +#define EVP_BLOWFISH_KEY_SIZE 16 +#define EVP_CAST5_KEY_SIZE 16 +#define EVP_RC5_32_12_16_KEY_SIZE 16 +*/ +#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */ +#define EVP_MAX_KEY_LENGTH 32 +#define EVP_MAX_IV_LENGTH 16 +#define EVP_MAX_BLOCK_LENGTH 32 + +#define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +#define PKCS5_DEFAULT_ITER 2048 + +#include + +#define EVP_PK_RSA 0x0001 +#define EVP_PK_DSA 0x0002 +#define EVP_PK_DH 0x0004 +#define EVP_PK_EC 0x0008 +#define EVP_PKT_SIGN 0x0010 +#define EVP_PKT_ENC 0x0020 +#define EVP_PKT_EXCH 0x0040 +#define EVP_PKS_RSA 0x0100 +#define EVP_PKS_DSA 0x0200 +#define EVP_PKS_EC 0x0400 +#define EVP_PKT_EXP 0x1000 /* <= 512 bit key */ + +#define EVP_PKEY_NONE NID_undef +#define EVP_PKEY_RSA NID_rsaEncryption +#define EVP_PKEY_RSA2 NID_rsa +#define EVP_PKEY_DSA NID_dsa +#define EVP_PKEY_DSA1 NID_dsa_2 +#define EVP_PKEY_DSA2 NID_dsaWithSHA +#define EVP_PKEY_DSA3 NID_dsaWithSHA1 +#define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 +#define EVP_PKEY_DH NID_dhKeyAgreement +#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey + +#ifdef __cplusplus +extern "C" { +#endif + +/* Type needs to be a bit field + * Sub-type needs to be for variations on the method, as in, can it do + * arbitrary encryption.... */ +struct evp_pkey_st + { + int type; + int save_type; + int references; + union { + char *ptr; +#ifndef OPENSSL_NO_RSA + struct rsa_st *rsa; /* RSA */ +#endif +#ifndef OPENSSL_NO_DSA + struct dsa_st *dsa; /* DSA */ +#endif +#ifndef OPENSSL_NO_DH + struct dh_st *dh; /* DH */ +#endif +#ifndef OPENSSL_NO_EC + struct ec_key_st *ec; /* ECC */ +#endif + } pkey; + int save_parameters; + STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ + } /* EVP_PKEY */; + +#define EVP_PKEY_MO_SIGN 0x0001 +#define EVP_PKEY_MO_VERIFY 0x0002 +#define EVP_PKEY_MO_ENCRYPT 0x0004 +#define EVP_PKEY_MO_DECRYPT 0x0008 + +#if 0 +/* This structure is required to tie the message digest and signing together. + * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or + * oid, md and pkey. + * This is required because for various smart-card perform the digest and + * signing/verification on-board. To handle this case, the specific + * EVP_MD and EVP_PKEY_METHODs need to be closely associated. + * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it. + * This can either be software or a token to provide the required low level + * routines. + */ +typedef struct evp_pkey_md_st + { + int oid; + EVP_MD *md; + EVP_PKEY_METHOD *pkey; + } EVP_PKEY_MD; + +#define EVP_rsa_md2() \ + EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_md2()) +#define EVP_rsa_md5() \ + EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_md5()) +#define EVP_rsa_sha0() \ + EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_sha()) +#define EVP_rsa_sha1() \ + EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ + EVP_rsa_pkcs1(),EVP_sha1()) +#define EVP_rsa_ripemd160() \ + EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ + EVP_rsa_pkcs1(),EVP_ripemd160()) +#define EVP_rsa_mdc2() \ + EVP_PKEY_MD_add(NID_mdc2WithRSA,\ + EVP_rsa_octet_string(),EVP_mdc2()) +#define EVP_dsa_sha() \ + EVP_PKEY_MD_add(NID_dsaWithSHA,\ + EVP_dsa(),EVP_sha()) +#define EVP_dsa_sha1() \ + EVP_PKEY_MD_add(NID_dsaWithSHA1,\ + EVP_dsa(),EVP_sha1()) + +typedef struct evp_pkey_method_st + { + char *name; + int flags; + int type; /* RSA, DSA, an SSLeay specific constant */ + int oid; /* For the pub-key type */ + int encrypt_oid; /* pub/priv key encryption */ + + int (*sign)(); + int (*verify)(); + struct { + int (*set)(); /* get and/or set the underlying type */ + int (*get)(); + int (*encrypt)(); + int (*decrypt)(); + int (*i2d)(); + int (*d2i)(); + int (*dup)(); + } pub,priv; + int (*set_asn1_parameters)(); + int (*get_asn1_parameters)(); + } EVP_PKEY_METHOD; +#endif + +#ifndef EVP_MD +struct env_md_st + { + int type; + int pkey_type; + int md_size; + unsigned long flags; + int (*init)(EVP_MD_CTX *ctx); + int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); + int (*final)(EVP_MD_CTX *ctx,unsigned char *md); + int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from); + int (*cleanup)(EVP_MD_CTX *ctx); + + /* FIXME: prototype these some day */ + int (*sign)(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, void *key); + int (*verify)(int type, const unsigned char *m, unsigned int m_length, + const unsigned char *sigbuf, unsigned int siglen, + void *key); + int required_pkey_type[5]; /*EVP_PKEY_xxx */ + int block_size; + int ctx_size; /* how big does the ctx->md_data need to be */ + } /* EVP_MD */; + +typedef int evp_sign_method(int type,const unsigned char *m, + unsigned int m_length,unsigned char *sigret, + unsigned int *siglen, void *key); +typedef int evp_verify_method(int type,const unsigned char *m, + unsigned int m_length,const unsigned char *sigbuf, + unsigned int siglen, void *key); + +typedef struct + { + EVP_MD_CTX *mctx; + void *key; + } EVP_MD_SVCTX; + +#define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single + * block */ + +#define EVP_MD_FLAG_FIPS 0x0400 /* Note if suitable for use in FIPS mode */ + +#define EVP_MD_FLAG_SVCTX 0x0800 /* pass EVP_MD_SVCTX to sign/verify */ + +#define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} + +#ifndef OPENSSL_NO_DSA +#define EVP_PKEY_DSA_method (evp_sign_method *)DSA_sign, \ + (evp_verify_method *)DSA_verify, \ + {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \ + EVP_PKEY_DSA4,0} +#else +#define EVP_PKEY_DSA_method EVP_PKEY_NULL_method +#endif + +#ifndef OPENSSL_NO_ECDSA +#define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ + (evp_verify_method *)ECDSA_verify, \ + {EVP_PKEY_EC,0,0,0} +#else +#define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method +#endif + +#ifndef OPENSSL_NO_RSA +#define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \ + (evp_verify_method *)RSA_verify, \ + {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} +#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \ + (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \ + (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \ + {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} +#else +#define EVP_PKEY_RSA_method EVP_PKEY_NULL_method +#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method +#endif + +#endif /* !EVP_MD */ + +struct env_md_ctx_st + { + const EVP_MD *digest; + ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ + unsigned long flags; + void *md_data; + } /* EVP_MD_CTX */; + +/* values for EVP_MD_CTX flags */ + +#define EVP_MD_CTX_FLAG_ONESHOT 0x0001 /* digest update will be called + * once only */ +#define EVP_MD_CTX_FLAG_CLEANED 0x0002 /* context has already been + * cleaned */ +#define EVP_MD_CTX_FLAG_REUSE 0x0004 /* Don't free up ctx->md_data + * in EVP_MD_CTX_cleanup */ +#define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008 /* Allow use of non FIPS digest + * in FIPS mode */ + +#define EVP_MD_CTX_FLAG_PAD_MASK 0xF0 /* RSA mode to use */ +#define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00 /* PKCS#1 v1.5 mode */ +#define EVP_MD_CTX_FLAG_PAD_X931 0x10 /* X9.31 mode */ +#define EVP_MD_CTX_FLAG_PAD_PSS 0x20 /* PSS mode */ +#define M_EVP_MD_CTX_FLAG_PSS_SALT(ctx) \ + ((ctx->flags>>16) &0xFFFF) /* seed length */ +#define EVP_MD_CTX_FLAG_PSS_MDLEN 0xFFFF /* salt len same as digest */ +#define EVP_MD_CTX_FLAG_PSS_MREC 0xFFFE /* salt max or auto recovered */ + +struct evp_cipher_st + { + int nid; + int block_size; + int key_len; /* Default value for variable length ciphers */ + int iv_len; + unsigned long flags; /* Various flags */ + int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, + const unsigned char *iv, int enc); /* init key */ + int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, + const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */ + int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ + int ctx_size; /* how big ctx->cipher_data needs to be */ + int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ + int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ + int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ + void *app_data; /* Application data */ + } /* EVP_CIPHER */; + +/* Values for cipher flags */ + +/* Modes for ciphers */ + +#define EVP_CIPH_STREAM_CIPHER 0x0 +#define EVP_CIPH_ECB_MODE 0x1 +#define EVP_CIPH_CBC_MODE 0x2 +#define EVP_CIPH_CFB_MODE 0x3 +#define EVP_CIPH_OFB_MODE 0x4 +#define EVP_CIPH_MODE 0x7 +/* Set if variable length cipher */ +#define EVP_CIPH_VARIABLE_LENGTH 0x8 +/* Set if the iv handling should be done by the cipher itself */ +#define EVP_CIPH_CUSTOM_IV 0x10 +/* Set if the cipher's init() function should be called if key is NULL */ +#define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +#define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +#define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* Don't use standard block padding */ +#define EVP_CIPH_NO_PADDING 0x100 +/* cipher handles random key generation */ +#define EVP_CIPH_RAND_KEY 0x200 +/* Note if suitable for use in FIPS mode */ +#define EVP_CIPH_FLAG_FIPS 0x400 +/* Allow non FIPS cipher in FIPS mode */ +#define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x800 +/* Allow use default ASN1 get/set iv */ +#define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 +/* Buffer length in bits not bytes: CFB1 mode only */ +#define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 + +/* ctrl() values */ + +#define EVP_CTRL_INIT 0x0 +#define EVP_CTRL_SET_KEY_LENGTH 0x1 +#define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +#define EVP_CTRL_GET_RC5_ROUNDS 0x4 +#define EVP_CTRL_SET_RC5_ROUNDS 0x5 +#define EVP_CTRL_RAND_KEY 0x6 + +typedef struct evp_cipher_info_st + { + const EVP_CIPHER *cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; + } EVP_CIPHER_INFO; + +struct evp_cipher_ctx_st + { + const EVP_CIPHER *cipher; + ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ + int encrypt; /* encrypt or decrypt */ + int buf_len; /* number we have left */ + + unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ + unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ + unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */ + int num; /* used by cfb/ofb mode */ + + void *app_data; /* application stuff */ + int key_len; /* May change for variable length cipher */ + unsigned long flags; /* Various flags */ + void *cipher_data; /* per EVP data */ + int final_used; + int block_mask; + unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ + } /* EVP_CIPHER_CTX */; + +typedef struct evp_Encode_Ctx_st + { + int num; /* number saved in a partial encode/decode */ + int length; /* The length is either the output line length + * (in input bytes) or the shortest input line + * length that is ok. Once decoding begins, + * the length is adjusted up each time a longer + * line is decoded */ + unsigned char enc_data[80]; /* data to encode */ + int line_num; /* number read on current line */ + int expect_nl; + } EVP_ENCODE_CTX; + +/* Password based encryption function */ +typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); + +#ifndef OPENSSL_NO_RSA +#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ + (char *)(rsa)) +#endif + +#ifndef OPENSSL_NO_DSA +#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ + (char *)(dsa)) +#endif + +#ifndef OPENSSL_NO_DH +#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ + (char *)(dh)) +#endif + +#ifndef OPENSSL_NO_EC +#define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ + (char *)(eckey)) +#endif + +/* Add some extra combinations */ +#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) +#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) +#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) +#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) + +/* Macros to reduce FIPS dependencies: do NOT use in applications */ +#define M_EVP_MD_size(e) ((e)->md_size) +#define M_EVP_MD_block_size(e) ((e)->block_size) +#define M_EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) +#define M_EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs)) +#define M_EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs)) +#define M_EVP_MD_type(e) ((e)->type) +#define M_EVP_MD_CTX_type(e) M_EVP_MD_type(M_EVP_MD_CTX_md(e)) +#define M_EVP_MD_CTX_md(e) ((e)->digest) + +#define M_EVP_CIPHER_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs)) + +int EVP_MD_type(const EVP_MD *md); +#define EVP_MD_nid(e) EVP_MD_type(e) +#define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) +int EVP_MD_pkey_type(const EVP_MD *md); +int EVP_MD_size(const EVP_MD *md); +int EVP_MD_block_size(const EVP_MD *md); + +const EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx); +#define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) +#define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) +#define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) + +int EVP_CIPHER_nid(const EVP_CIPHER *cipher); +#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) +int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); +int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); +int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); +unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); +#define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) + +const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); +void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); +#define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) +unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); +#define EVP_CIPHER_CTX_mode(e) (EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE) + +#define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) +#define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) + +#define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +#define EVP_SignInit(a,b) EVP_DigestInit(a,b) +#define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +#define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +#define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) +#define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +#define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) +#define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) + +#ifdef CONST_STRICT +void BIO_set_md(BIO *,const EVP_MD *md); +#else +# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) +#endif +#define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) +#define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) +#define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp) +#define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) +#define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) + +int EVP_Cipher(EVP_CIPHER_CTX *c, + unsigned char *out, + const unsigned char *in, + unsigned int inl); + +#define EVP_add_cipher_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) +#define EVP_add_digest_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) +#define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); +#define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); + +void EVP_MD_CTX_init(EVP_MD_CTX *ctx); +int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); +EVP_MD_CTX *EVP_MD_CTX_create(void); +void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); +int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); +void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); +void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); +int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags); +int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); +int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, + size_t cnt); +int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); +int EVP_Digest(const void *data, size_t count, + unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl); + +int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in); +int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); +int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); + +int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); +void EVP_set_pw_prompt(const char *prompt); +char * EVP_get_pw_prompt(void); + +int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, + const unsigned char *salt, const unsigned char *data, + int datal, int count, unsigned char *key,unsigned char *iv); + +void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); +void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); +int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx,int flags); + +int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, const unsigned char *iv); +int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); +int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, const unsigned char *iv); +int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); +int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); + +int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, + const unsigned char *key,const unsigned char *iv, + int enc); +int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key,const unsigned char *iv, + int enc); +int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); +int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); + +int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, + EVP_PKEY *pkey); + +int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, + unsigned int siglen,EVP_PKEY *pkey); + +int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, + const unsigned char *ek, int ekl, const unsigned char *iv, + EVP_PKEY *priv); +int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + unsigned char **ek, int *ekl, unsigned char *iv, + EVP_PKEY **pubk, int npubk); +int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); + +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); +void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, + const unsigned char *in,int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); +int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); + +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, + const unsigned char *in, int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned + char *out, int *outl); +int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); + +void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); +int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); +EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); +void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a); +int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); +int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); +int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); + +#ifndef OPENSSL_NO_BIO +BIO_METHOD *BIO_f_md(void); +BIO_METHOD *BIO_f_base64(void); +BIO_METHOD *BIO_f_cipher(void); +BIO_METHOD *BIO_f_reliable(void); +void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k, + const unsigned char *i, int enc); +#endif + +const EVP_MD *EVP_md_null(void); +#ifndef OPENSSL_NO_MD2 +const EVP_MD *EVP_md2(void); +#endif +#ifndef OPENSSL_NO_MD4 +const EVP_MD *EVP_md4(void); +#endif +#ifndef OPENSSL_NO_MD5 +const EVP_MD *EVP_md5(void); +#endif +#ifndef OPENSSL_NO_SHA +const EVP_MD *EVP_sha(void); +const EVP_MD *EVP_sha1(void); +const EVP_MD *EVP_dss(void); +const EVP_MD *EVP_dss1(void); +const EVP_MD *EVP_ecdsa(void); +#endif +#ifndef OPENSSL_NO_SHA256 +const EVP_MD *EVP_sha224(void); +const EVP_MD *EVP_sha256(void); +#endif +#ifndef OPENSSL_NO_SHA512 +const EVP_MD *EVP_sha384(void); +const EVP_MD *EVP_sha512(void); +#endif +#ifndef OPENSSL_NO_MDC2 +const EVP_MD *EVP_mdc2(void); +#endif +#ifndef OPENSSL_NO_RIPEMD +const EVP_MD *EVP_ripemd160(void); +#endif +const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ +#ifndef OPENSSL_NO_DES +const EVP_CIPHER *EVP_des_ecb(void); +const EVP_CIPHER *EVP_des_ede(void); +const EVP_CIPHER *EVP_des_ede3(void); +const EVP_CIPHER *EVP_des_ede_ecb(void); +const EVP_CIPHER *EVP_des_ede3_ecb(void); +const EVP_CIPHER *EVP_des_cfb64(void); +# define EVP_des_cfb EVP_des_cfb64 +const EVP_CIPHER *EVP_des_cfb1(void); +const EVP_CIPHER *EVP_des_cfb8(void); +const EVP_CIPHER *EVP_des_ede_cfb64(void); +# define EVP_des_ede_cfb EVP_des_ede_cfb64 +#if 0 +const EVP_CIPHER *EVP_des_ede_cfb1(void); +const EVP_CIPHER *EVP_des_ede_cfb8(void); +#endif +const EVP_CIPHER *EVP_des_ede3_cfb64(void); +# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb1(void); +const EVP_CIPHER *EVP_des_ede3_cfb8(void); +const EVP_CIPHER *EVP_des_ofb(void); +const EVP_CIPHER *EVP_des_ede_ofb(void); +const EVP_CIPHER *EVP_des_ede3_ofb(void); +const EVP_CIPHER *EVP_des_cbc(void); +const EVP_CIPHER *EVP_des_ede_cbc(void); +const EVP_CIPHER *EVP_des_ede3_cbc(void); +const EVP_CIPHER *EVP_desx_cbc(void); +/* This should now be supported through the dev_crypto ENGINE. But also, why are + * rc4 and md5 declarations made here inside a "NO_DES" precompiler branch? */ +#if 0 +# ifdef OPENSSL_OPENBSD_DEV_CRYPTO +const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void); +const EVP_CIPHER *EVP_dev_crypto_rc4(void); +const EVP_MD *EVP_dev_crypto_md5(void); +# endif +#endif +#endif +#ifndef OPENSSL_NO_RC4 +const EVP_CIPHER *EVP_rc4(void); +const EVP_CIPHER *EVP_rc4_40(void); +#endif +#ifndef OPENSSL_NO_IDEA +const EVP_CIPHER *EVP_idea_ecb(void); +const EVP_CIPHER *EVP_idea_cfb64(void); +# define EVP_idea_cfb EVP_idea_cfb64 +const EVP_CIPHER *EVP_idea_ofb(void); +const EVP_CIPHER *EVP_idea_cbc(void); +#endif +#ifndef OPENSSL_NO_RC2 +const EVP_CIPHER *EVP_rc2_ecb(void); +const EVP_CIPHER *EVP_rc2_cbc(void); +const EVP_CIPHER *EVP_rc2_40_cbc(void); +const EVP_CIPHER *EVP_rc2_64_cbc(void); +const EVP_CIPHER *EVP_rc2_cfb64(void); +# define EVP_rc2_cfb EVP_rc2_cfb64 +const EVP_CIPHER *EVP_rc2_ofb(void); +#endif +#ifndef OPENSSL_NO_BF +const EVP_CIPHER *EVP_bf_ecb(void); +const EVP_CIPHER *EVP_bf_cbc(void); +const EVP_CIPHER *EVP_bf_cfb64(void); +# define EVP_bf_cfb EVP_bf_cfb64 +const EVP_CIPHER *EVP_bf_ofb(void); +#endif +#ifndef OPENSSL_NO_CAST +const EVP_CIPHER *EVP_cast5_ecb(void); +const EVP_CIPHER *EVP_cast5_cbc(void); +const EVP_CIPHER *EVP_cast5_cfb64(void); +# define EVP_cast5_cfb EVP_cast5_cfb64 +const EVP_CIPHER *EVP_cast5_ofb(void); +#endif +#ifndef OPENSSL_NO_RC5 +const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); +const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); +const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); +# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 +const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); +#endif +#ifndef OPENSSL_NO_AES +const EVP_CIPHER *EVP_aes_128_ecb(void); +const EVP_CIPHER *EVP_aes_128_cbc(void); +const EVP_CIPHER *EVP_aes_128_cfb1(void); +const EVP_CIPHER *EVP_aes_128_cfb8(void); +const EVP_CIPHER *EVP_aes_128_cfb128(void); +# define EVP_aes_128_cfb EVP_aes_128_cfb128 +const EVP_CIPHER *EVP_aes_128_ofb(void); +#if 0 +const EVP_CIPHER *EVP_aes_128_ctr(void); +#endif +const EVP_CIPHER *EVP_aes_192_ecb(void); +const EVP_CIPHER *EVP_aes_192_cbc(void); +const EVP_CIPHER *EVP_aes_192_cfb1(void); +const EVP_CIPHER *EVP_aes_192_cfb8(void); +const EVP_CIPHER *EVP_aes_192_cfb128(void); +# define EVP_aes_192_cfb EVP_aes_192_cfb128 +const EVP_CIPHER *EVP_aes_192_ofb(void); +#if 0 +const EVP_CIPHER *EVP_aes_192_ctr(void); +#endif +const EVP_CIPHER *EVP_aes_256_ecb(void); +const EVP_CIPHER *EVP_aes_256_cbc(void); +const EVP_CIPHER *EVP_aes_256_cfb1(void); +const EVP_CIPHER *EVP_aes_256_cfb8(void); +const EVP_CIPHER *EVP_aes_256_cfb128(void); +# define EVP_aes_256_cfb EVP_aes_256_cfb128 +const EVP_CIPHER *EVP_aes_256_ofb(void); +#if 0 +const EVP_CIPHER *EVP_aes_256_ctr(void); +#endif +#endif +#ifndef OPENSSL_NO_CAMELLIA +const EVP_CIPHER *EVP_camellia_128_ecb(void); +const EVP_CIPHER *EVP_camellia_128_cbc(void); +const EVP_CIPHER *EVP_camellia_128_cfb1(void); +const EVP_CIPHER *EVP_camellia_128_cfb8(void); +const EVP_CIPHER *EVP_camellia_128_cfb128(void); +# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 +const EVP_CIPHER *EVP_camellia_128_ofb(void); +const EVP_CIPHER *EVP_camellia_192_ecb(void); +const EVP_CIPHER *EVP_camellia_192_cbc(void); +const EVP_CIPHER *EVP_camellia_192_cfb1(void); +const EVP_CIPHER *EVP_camellia_192_cfb8(void); +const EVP_CIPHER *EVP_camellia_192_cfb128(void); +# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 +const EVP_CIPHER *EVP_camellia_192_ofb(void); +const EVP_CIPHER *EVP_camellia_256_ecb(void); +const EVP_CIPHER *EVP_camellia_256_cbc(void); +const EVP_CIPHER *EVP_camellia_256_cfb1(void); +const EVP_CIPHER *EVP_camellia_256_cfb8(void); +const EVP_CIPHER *EVP_camellia_256_cfb128(void); +# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 +const EVP_CIPHER *EVP_camellia_256_ofb(void); +#endif + +#ifndef OPENSSL_NO_SEED +const EVP_CIPHER *EVP_seed_ecb(void); +const EVP_CIPHER *EVP_seed_cbc(void); +const EVP_CIPHER *EVP_seed_cfb128(void); +# define EVP_seed_cfb EVP_seed_cfb128 +const EVP_CIPHER *EVP_seed_ofb(void); +#endif + +void OPENSSL_add_all_algorithms_noconf(void); +void OPENSSL_add_all_algorithms_conf(void); + +#ifdef OPENSSL_LOAD_CONF +#define OpenSSL_add_all_algorithms() \ + OPENSSL_add_all_algorithms_conf() +#else +#define OpenSSL_add_all_algorithms() \ + OPENSSL_add_all_algorithms_noconf() +#endif + +void OpenSSL_add_all_ciphers(void); +void OpenSSL_add_all_digests(void); +#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms() +#define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers() +#define SSLeay_add_all_digests() OpenSSL_add_all_digests() + +int EVP_add_cipher(const EVP_CIPHER *cipher); +int EVP_add_digest(const EVP_MD *digest); + +const EVP_CIPHER *EVP_get_cipherbyname(const char *name); +const EVP_MD *EVP_get_digestbyname(const char *name); +void EVP_cleanup(void); + +int EVP_PKEY_decrypt(unsigned char *dec_key, + const unsigned char *enc_key,int enc_key_len, + EVP_PKEY *private_key); +int EVP_PKEY_encrypt(unsigned char *enc_key, + const unsigned char *key,int key_len, + EVP_PKEY *pub_key); +int EVP_PKEY_type(int type); +int EVP_PKEY_bits(EVP_PKEY *pkey); +int EVP_PKEY_size(EVP_PKEY *pkey); +int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key); + +#ifndef OPENSSL_NO_RSA +struct rsa_st; +int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key); +struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); +#endif +#ifndef OPENSSL_NO_DSA +struct dsa_st; +int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key); +struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); +#endif +#ifndef OPENSSL_NO_DH +struct dh_st; +int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key); +struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); +#endif +#ifndef OPENSSL_NO_EC +struct ec_key_st; +int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key); +struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); +#endif + +EVP_PKEY * EVP_PKEY_new(void); +void EVP_PKEY_free(EVP_PKEY *pkey); + +EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); + +EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp, + long length); +EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); + +int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); +int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); +int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); +int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_CIPHER_type(const EVP_CIPHER *ctx); + +/* calls methods */ +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* These are used by EVP_CIPHER methods */ +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); + +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out); +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); +int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, + EVP_PBE_KEYGEN *keygen); +void EVP_PBE_cleanup(void); + +#ifdef OPENSSL_FIPS +#ifndef OPENSSL_NO_ENGINE +void int_EVP_MD_set_engine_callbacks( + int (*eng_md_init)(ENGINE *impl), + int (*eng_md_fin)(ENGINE *impl), + int (*eng_md_evp) + (EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl)); +void int_EVP_MD_init_engine_callbacks(void); +void int_EVP_CIPHER_set_engine_callbacks( + int (*eng_ciph_fin)(ENGINE *impl), + int (*eng_ciph_evp) + (EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl)); +void int_EVP_CIPHER_init_engine_callbacks(void); +#endif +#endif + +void EVP_add_alg_module(void); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_EVP_strings(void); + +/* Error codes for the EVP functions. */ + +/* Function codes. */ +#define EVP_F_AES_INIT_KEY 133 +#define EVP_F_ALG_MODULE_INIT 138 +#define EVP_F_CAMELLIA_INIT_KEY 159 +#define EVP_F_D2I_PKEY 100 +#define EVP_F_DO_EVP_ENC_ENGINE 140 +#define EVP_F_DO_EVP_ENC_ENGINE_FULL 141 +#define EVP_F_DO_EVP_MD_ENGINE 139 +#define EVP_F_DO_EVP_MD_ENGINE_FULL 142 +#define EVP_F_DSAPKEY2PKCS8 134 +#define EVP_F_DSA_PKEY2PKCS8 135 +#define EVP_F_ECDSA_PKEY2PKCS8 129 +#define EVP_F_ECKEY_PKEY2PKCS8 132 +#define EVP_F_EVP_CIPHERINIT 137 +#define EVP_F_EVP_CIPHERINIT_EX 123 +#define EVP_F_EVP_CIPHER_CTX_CTRL 124 +#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 +#define EVP_F_EVP_DECRYPTFINAL_EX 101 +#define EVP_F_EVP_DIGESTINIT 136 +#define EVP_F_EVP_DIGESTINIT_EX 128 +#define EVP_F_EVP_ENCRYPTFINAL_EX 127 +#define EVP_F_EVP_MD_CTX_COPY_EX 110 +#define EVP_F_EVP_OPENINIT 102 +#define EVP_F_EVP_PBE_ALG_ADD 115 +#define EVP_F_EVP_PBE_CIPHERINIT 116 +#define EVP_F_EVP_PKCS82PKEY 111 +#define EVP_F_EVP_PKEY2PKCS8_BROKEN 113 +#define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +#define EVP_F_EVP_PKEY_DECRYPT 104 +#define EVP_F_EVP_PKEY_ENCRYPT 105 +#define EVP_F_EVP_PKEY_GET1_DH 119 +#define EVP_F_EVP_PKEY_GET1_DSA 120 +#define EVP_F_EVP_PKEY_GET1_ECDSA 130 +#define EVP_F_EVP_PKEY_GET1_EC_KEY 131 +#define EVP_F_EVP_PKEY_GET1_RSA 121 +#define EVP_F_EVP_PKEY_NEW 106 +#define EVP_F_EVP_RIJNDAEL 126 +#define EVP_F_EVP_SIGNFINAL 107 +#define EVP_F_EVP_VERIFYFINAL 108 +#define EVP_F_PKCS5_PBE_KEYIVGEN 117 +#define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 +#define EVP_F_PKCS8_SET_BROKEN 112 +#define EVP_F_RC2_MAGIC_TO_METH 109 +#define EVP_F_RC5_CTRL 125 + +/* Reason codes. */ +#define EVP_R_AES_KEY_SETUP_FAILED 143 +#define EVP_R_ASN1_LIB 140 +#define EVP_R_BAD_BLOCK_LENGTH 136 +#define EVP_R_BAD_DECRYPT 100 +#define EVP_R_BAD_KEY_LENGTH 137 +#define EVP_R_BN_DECODE_ERROR 112 +#define EVP_R_BN_PUBKEY_ERROR 113 +#define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 +#define EVP_R_CIPHER_PARAMETER_ERROR 122 +#define EVP_R_CTRL_NOT_IMPLEMENTED 132 +#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 +#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 +#define EVP_R_DECODE_ERROR 114 +#define EVP_R_DIFFERENT_KEY_TYPES 101 +#define EVP_R_DISABLED_FOR_FIPS 144 +#define EVP_R_ENCODE_ERROR 115 +#define EVP_R_ERROR_LOADING_SECTION 145 +#define EVP_R_ERROR_SETTING_FIPS_MODE 146 +#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 +#define EVP_R_EXPECTING_AN_RSA_KEY 127 +#define EVP_R_EXPECTING_A_DH_KEY 128 +#define EVP_R_EXPECTING_A_DSA_KEY 129 +#define EVP_R_EXPECTING_A_ECDSA_KEY 141 +#define EVP_R_EXPECTING_A_EC_KEY 142 +#define EVP_R_FIPS_MODE_NOT_SUPPORTED 147 +#define EVP_R_INITIALIZATION_ERROR 134 +#define EVP_R_INPUT_NOT_INITIALIZED 111 +#define EVP_R_INVALID_FIPS_MODE 148 +#define EVP_R_INVALID_KEY_LENGTH 130 +#define EVP_R_IV_TOO_LARGE 102 +#define EVP_R_KEYGEN_FAILURE 120 +#define EVP_R_MISSING_PARAMETERS 103 +#define EVP_R_NO_CIPHER_SET 131 +#define EVP_R_NO_DIGEST_SET 139 +#define EVP_R_NO_DSA_PARAMETERS 116 +#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 +#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 +#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 +#define EVP_R_PUBLIC_KEY_NOT_RSA 106 +#define EVP_R_UNKNOWN_OPTION 149 +#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 +#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 +#define EVP_R_UNSUPPORTED_CIPHER 107 +#define EVP_R_UNSUPPORTED_KEYLENGTH 123 +#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +#define EVP_R_UNSUPPORTED_KEY_SIZE 108 +#define EVP_R_UNSUPPORTED_PRF 125 +#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +#define EVP_R_UNSUPPORTED_SALT_TYPE 126 +#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 +#define EVP_R_SEED_KEY_SETUP_FAILED 162 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/hmac.h b/externals/openssl/hmac.h new file mode 100644 index 0000000..fc38ffb --- /dev/null +++ b/externals/openssl/hmac.h @@ -0,0 +1,109 @@ +/* crypto/hmac/hmac.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +#ifndef HEADER_HMAC_H +#define HEADER_HMAC_H + +#include + +#ifdef OPENSSL_NO_HMAC +#error HMAC is disabled. +#endif + +#include + +#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct hmac_ctx_st + { + const EVP_MD *md; + EVP_MD_CTX md_ctx; + EVP_MD_CTX i_ctx; + EVP_MD_CTX o_ctx; + unsigned int key_length; + unsigned char key[HMAC_MAX_MD_CBLOCK]; + } HMAC_CTX; + +#define HMAC_size(e) (EVP_MD_size((e)->md)) + + +void HMAC_CTX_init(HMAC_CTX *ctx); +void HMAC_CTX_cleanup(HMAC_CTX *ctx); + +#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ + +void HMAC_Init(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md); /* deprecated */ +void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md, ENGINE *impl); +void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); +void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); +unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, + const unsigned char *d, size_t n, unsigned char *md, + unsigned int *md_len); + +void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/idea.h b/externals/openssl/idea.h new file mode 100644 index 0000000..a137d4c --- /dev/null +++ b/externals/openssl/idea.h @@ -0,0 +1,103 @@ +/* crypto/idea/idea.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_IDEA_H +#define HEADER_IDEA_H + +#include /* IDEA_INT, OPENSSL_NO_IDEA */ + +#ifdef OPENSSL_NO_IDEA +#error IDEA is disabled. +#endif + +#define IDEA_ENCRYPT 1 +#define IDEA_DECRYPT 0 + +#define IDEA_BLOCK 8 +#define IDEA_KEY_LENGTH 16 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct idea_key_st + { + IDEA_INT data[9][6]; + } IDEA_KEY_SCHEDULE; + +const char *idea_options(void); +void idea_ecb_encrypt(const unsigned char *in, unsigned char *out, + IDEA_KEY_SCHEDULE *ks); +#ifdef OPENSSL_FIPS +void private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); +#endif +void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); +void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); +void idea_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc); +void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num,int enc); +void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num); +void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/krb5_asn.h b/externals/openssl/krb5_asn.h new file mode 100644 index 0000000..66c0629 --- /dev/null +++ b/externals/openssl/krb5_asn.h @@ -0,0 +1,257 @@ +/* krb5_asn.h */ +/* Written by Vern Staats for the OpenSSL project, +** using ocsp/{*.h,*asn*.c} as a starting point +*/ + +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_KRB5_ASN_H +#define HEADER_KRB5_ASN_H + +/* +#include +*/ +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ASN.1 from Kerberos RFC 1510 +*/ + +/* EncryptedData ::= SEQUENCE { +** etype[0] INTEGER, -- EncryptionType +** kvno[1] INTEGER OPTIONAL, +** cipher[2] OCTET STRING -- ciphertext +** } +*/ +typedef struct krb5_encdata_st + { + ASN1_INTEGER *etype; + ASN1_INTEGER *kvno; + ASN1_OCTET_STRING *cipher; + } KRB5_ENCDATA; + +DECLARE_STACK_OF(KRB5_ENCDATA) + +/* PrincipalName ::= SEQUENCE { +** name-type[0] INTEGER, +** name-string[1] SEQUENCE OF GeneralString +** } +*/ +typedef struct krb5_princname_st + { + ASN1_INTEGER *nametype; + STACK_OF(ASN1_GENERALSTRING) *namestring; + } KRB5_PRINCNAME; + +DECLARE_STACK_OF(KRB5_PRINCNAME) + + +/* Ticket ::= [APPLICATION 1] SEQUENCE { +** tkt-vno[0] INTEGER, +** realm[1] Realm, +** sname[2] PrincipalName, +** enc-part[3] EncryptedData +** } +*/ +typedef struct krb5_tktbody_st + { + ASN1_INTEGER *tktvno; + ASN1_GENERALSTRING *realm; + KRB5_PRINCNAME *sname; + KRB5_ENCDATA *encdata; + } KRB5_TKTBODY; + +typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET; +DECLARE_STACK_OF(KRB5_TKTBODY) + + +/* AP-REQ ::= [APPLICATION 14] SEQUENCE { +** pvno[0] INTEGER, +** msg-type[1] INTEGER, +** ap-options[2] APOptions, +** ticket[3] Ticket, +** authenticator[4] EncryptedData +** } +** +** APOptions ::= BIT STRING { +** reserved(0), use-session-key(1), mutual-required(2) } +*/ +typedef struct krb5_ap_req_st + { + ASN1_INTEGER *pvno; + ASN1_INTEGER *msgtype; + ASN1_BIT_STRING *apoptions; + KRB5_TICKET *ticket; + KRB5_ENCDATA *authenticator; + } KRB5_APREQBODY; + +typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ; +DECLARE_STACK_OF(KRB5_APREQBODY) + + +/* Authenticator Stuff */ + + +/* Checksum ::= SEQUENCE { +** cksumtype[0] INTEGER, +** checksum[1] OCTET STRING +** } +*/ +typedef struct krb5_checksum_st + { + ASN1_INTEGER *ctype; + ASN1_OCTET_STRING *checksum; + } KRB5_CHECKSUM; + +DECLARE_STACK_OF(KRB5_CHECKSUM) + + +/* EncryptionKey ::= SEQUENCE { +** keytype[0] INTEGER, +** keyvalue[1] OCTET STRING +** } +*/ +typedef struct krb5_encryptionkey_st + { + ASN1_INTEGER *ktype; + ASN1_OCTET_STRING *keyvalue; + } KRB5_ENCKEY; + +DECLARE_STACK_OF(KRB5_ENCKEY) + + +/* AuthorizationData ::= SEQUENCE OF SEQUENCE { +** ad-type[0] INTEGER, +** ad-data[1] OCTET STRING +** } +*/ +typedef struct krb5_authorization_st + { + ASN1_INTEGER *adtype; + ASN1_OCTET_STRING *addata; + } KRB5_AUTHDATA; + +DECLARE_STACK_OF(KRB5_AUTHDATA) + + +/* -- Unencrypted authenticator +** Authenticator ::= [APPLICATION 2] SEQUENCE { +** authenticator-vno[0] INTEGER, +** crealm[1] Realm, +** cname[2] PrincipalName, +** cksum[3] Checksum OPTIONAL, +** cusec[4] INTEGER, +** ctime[5] KerberosTime, +** subkey[6] EncryptionKey OPTIONAL, +** seq-number[7] INTEGER OPTIONAL, +** authorization-data[8] AuthorizationData OPTIONAL +** } +*/ +typedef struct krb5_authenticator_st + { + ASN1_INTEGER *avno; + ASN1_GENERALSTRING *crealm; + KRB5_PRINCNAME *cname; + KRB5_CHECKSUM *cksum; + ASN1_INTEGER *cusec; + ASN1_GENERALIZEDTIME *ctime; + KRB5_ENCKEY *subkey; + ASN1_INTEGER *seqnum; + KRB5_AUTHDATA *authorization; + } KRB5_AUTHENTBODY; + +typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT; +DECLARE_STACK_OF(KRB5_AUTHENTBODY) + + +/* DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) = +** type *name##_new(void); +** void name##_free(type *a); +** DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) = +** DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) = +** type *d2i_##name(type **a, const unsigned char **in, long len); +** int i2d_##name(type *a, unsigned char **out); +** DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it +*/ + +DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA) +DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME) +DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_TICKET) +DECLARE_ASN1_FUNCTIONS(KRB5_APREQ) + +DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM) +DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY) +DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT) + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ + +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/externals/openssl/kssl.h b/externals/openssl/kssl.h new file mode 100644 index 0000000..e920e1c --- /dev/null +++ b/externals/openssl/kssl.h @@ -0,0 +1,180 @@ +/* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */ +/* Written by Vern Staats for the OpenSSL project 2000. + * project 2000. + */ +/* ==================================================================== + * Copyright (c) 2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* +** 19990701 VRS Started. +*/ + +#ifndef KSSL_H +#define KSSL_H + +#include + +#ifndef OPENSSL_NO_KRB5 + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Depending on which KRB5 implementation used, some types from +** the other may be missing. Resolve that here and now +*/ +#ifdef KRB5_HEIMDAL +typedef unsigned char krb5_octet; +#define FAR +#else + +#ifndef FAR +#define FAR +#endif + +#endif + +/* Uncomment this to debug kssl problems or +** to trace usage of the Kerberos session key +** +** #define KSSL_DEBUG +*/ + +#ifndef KRB5SVC +#define KRB5SVC "host" +#endif + +#ifndef KRB5KEYTAB +#define KRB5KEYTAB "/etc/krb5.keytab" +#endif + +#ifndef KRB5SENDAUTH +#define KRB5SENDAUTH 1 +#endif + +#ifndef KRB5CHECKAUTH +#define KRB5CHECKAUTH 1 +#endif + +#ifndef KSSL_CLOCKSKEW +#define KSSL_CLOCKSKEW 300; +#endif + +#define KSSL_ERR_MAX 255 +typedef struct kssl_err_st { + int reason; + char text[KSSL_ERR_MAX+1]; + } KSSL_ERR; + + +/* Context for passing +** (1) Kerberos session key to SSL, and +** (2) Config data between application and SSL lib +*/ +typedef struct kssl_ctx_st + { + /* used by: disposition: */ + char *service_name; /* C,S default ok (kssl) */ + char *service_host; /* C input, REQUIRED */ + char *client_princ; /* S output from krb5 ticket */ + char *keytab_file; /* S NULL (/etc/krb5.keytab) */ + char *cred_cache; /* C NULL (default) */ + krb5_enctype enctype; + int length; + krb5_octet FAR *key; + } KSSL_CTX; + +#define KSSL_CLIENT 1 +#define KSSL_SERVER 2 +#define KSSL_SERVICE 3 +#define KSSL_KEYTAB 4 + +#define KSSL_CTX_OK 0 +#define KSSL_CTX_ERR 1 +#define KSSL_NOMEM 2 + +/* Public (for use by applications that use OpenSSL with Kerberos 5 support */ +krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text); +KSSL_CTX *kssl_ctx_new(void); +KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx); +void kssl_ctx_show(KSSL_CTX *kssl_ctx); +krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which, + krb5_data *realm, krb5_data *entity, int nentities); +krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp, + krb5_data *authenp, KSSL_ERR *kssl_err); +krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata, + krb5_ticket_times *ttimes, KSSL_ERR *kssl_err); +krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session); +void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text); +void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data); +krb5_error_code kssl_build_principal_2(krb5_context context, + krb5_principal *princ, int rlen, const char *realm, + int slen, const char *svc, int hlen, const char *host); +krb5_error_code kssl_validate_times(krb5_timestamp atime, + krb5_ticket_times *ttimes); +krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp, + krb5_timestamp *atimep, KSSL_ERR *kssl_err); +unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn); + +#ifdef __cplusplus +} +#endif +#endif /* OPENSSL_NO_KRB5 */ +#endif /* KSSL_H */ + diff --git a/externals/openssl/lhash.h b/externals/openssl/lhash.h new file mode 100644 index 0000000..9ae674e --- /dev/null +++ b/externals/openssl/lhash.h @@ -0,0 +1,201 @@ +/* crypto/lhash/lhash.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Header for dynamic hash table routines + * Author - Eric Young + */ + +#ifndef HEADER_LHASH_H +#define HEADER_LHASH_H + +#include +#ifndef OPENSSL_NO_FP_API +#include +#endif + +#ifndef OPENSSL_NO_BIO +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lhash_node_st + { + void *data; + struct lhash_node_st *next; +#ifndef OPENSSL_NO_HASH_COMP + unsigned long hash; +#endif + } LHASH_NODE; + +typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *); +typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *); +typedef void (*LHASH_DOALL_FN_TYPE)(void *); +typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *); + +/* Macros for declaring and implementing type-safe wrappers for LHASH callbacks. + * This way, callbacks can be provided to LHASH structures without function + * pointer casting and the macro-defined callbacks provide per-variable casting + * before deferring to the underlying type-specific callbacks. NB: It is + * possible to place a "static" in front of both the DECLARE and IMPLEMENT + * macros if the functions are strictly internal. */ + +/* First: "hash" functions */ +#define DECLARE_LHASH_HASH_FN(f_name,o_type) \ + unsigned long f_name##_LHASH_HASH(const void *); +#define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \ + unsigned long f_name##_LHASH_HASH(const void *arg) { \ + o_type a = (o_type)arg; \ + return f_name(a); } +#define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH + +/* Second: "compare" functions */ +#define DECLARE_LHASH_COMP_FN(f_name,o_type) \ + int f_name##_LHASH_COMP(const void *, const void *); +#define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \ + int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \ + o_type a = (o_type)arg1; \ + o_type b = (o_type)arg2; \ + return f_name(a,b); } +#define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP + +/* Third: "doall" functions */ +#define DECLARE_LHASH_DOALL_FN(f_name,o_type) \ + void f_name##_LHASH_DOALL(void *); +#define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \ + void f_name##_LHASH_DOALL(void *arg) { \ + o_type a = (o_type)arg; \ + f_name(a); } +#define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL + +/* Fourth: "doall_arg" functions */ +#define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ + void f_name##_LHASH_DOALL_ARG(void *, void *); +#define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ + void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ + o_type a = (o_type)arg1; \ + a_type b = (a_type)arg2; \ + f_name(a,b); } +#define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG + +typedef struct lhash_st + { + LHASH_NODE **b; + LHASH_COMP_FN_TYPE comp; + LHASH_HASH_FN_TYPE hash; + unsigned int num_nodes; + unsigned int num_alloc_nodes; + unsigned int p; + unsigned int pmax; + unsigned long up_load; /* load times 256 */ + unsigned long down_load; /* load times 256 */ + unsigned long num_items; + + unsigned long num_expands; + unsigned long num_expand_reallocs; + unsigned long num_contracts; + unsigned long num_contract_reallocs; + unsigned long num_hash_calls; + unsigned long num_comp_calls; + unsigned long num_insert; + unsigned long num_replace; + unsigned long num_delete; + unsigned long num_no_delete; + unsigned long num_retrieve; + unsigned long num_retrieve_miss; + unsigned long num_hash_comps; + + int error; + } LHASH; + +#define LH_LOAD_MULT 256 + +/* Indicates a malloc() error in the last call, this is only bad + * in lh_insert(). */ +#define lh_error(lh) ((lh)->error) + +LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c); +void lh_free(LHASH *lh); +void *lh_insert(LHASH *lh, void *data); +void *lh_delete(LHASH *lh, const void *data); +void *lh_retrieve(LHASH *lh, const void *data); +void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func); +void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg); +unsigned long lh_strhash(const char *c); +unsigned long lh_num_items(const LHASH *lh); + +#ifndef OPENSSL_NO_FP_API +void lh_stats(const LHASH *lh, FILE *out); +void lh_node_stats(const LHASH *lh, FILE *out); +void lh_node_usage_stats(const LHASH *lh, FILE *out); +#endif + +#ifndef OPENSSL_NO_BIO +void lh_stats_bio(const LHASH *lh, BIO *out); +void lh_node_stats_bio(const LHASH *lh, BIO *out); +void lh_node_usage_stats_bio(const LHASH *lh, BIO *out); +#endif +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/externals/openssl/md2.h b/externals/openssl/md2.h new file mode 100644 index 0000000..d59c9f2 --- /dev/null +++ b/externals/openssl/md2.h @@ -0,0 +1,95 @@ +/* crypto/md/md2.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MD2_H +#define HEADER_MD2_H + +#include /* OPENSSL_NO_MD2, MD2_INT */ +#ifdef OPENSSL_NO_MD2 +#error MD2 is disabled. +#endif +#include + +#define MD2_DIGEST_LENGTH 16 +#define MD2_BLOCK 16 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct MD2state_st + { + unsigned int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; + } MD2_CTX; + +const char *MD2_options(void); +#ifdef OPENSSL_FIPS +int private_MD2_Init(MD2_CTX *c); +#endif +int MD2_Init(MD2_CTX *c); +int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); +int MD2_Final(unsigned char *md, MD2_CTX *c); +unsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/md4.h b/externals/openssl/md4.h new file mode 100644 index 0000000..ba1fe4a --- /dev/null +++ b/externals/openssl/md4.h @@ -0,0 +1,120 @@ +/* crypto/md4/md4.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MD4_H +#define HEADER_MD4_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_MD4 +#error MD4 is disabled. +#endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! MD4_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) +#define MD4_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define MD4_LONG unsigned long +#define MD4_LONG_LOG2 3 +/* + * _CRAY note. I could declare short, but I have no idea what impact + * does it have on performance on none-T3E machines. I could declare + * int, but at least on C90 sizeof(int) can be chosen at compile time. + * So I've chosen long... + * + */ +#else +#define MD4_LONG unsigned int +#endif + +#define MD4_CBLOCK 64 +#define MD4_LBLOCK (MD4_CBLOCK/4) +#define MD4_DIGEST_LENGTH 16 + +typedef struct MD4state_st + { + MD4_LONG A,B,C,D; + MD4_LONG Nl,Nh; + MD4_LONG data[MD4_LBLOCK]; + unsigned int num; + } MD4_CTX; + +#ifdef OPENSSL_FIPS +int private_MD4_Init(MD4_CTX *c); +#endif +int MD4_Init(MD4_CTX *c); +int MD4_Update(MD4_CTX *c, const void *data, size_t len); +int MD4_Final(unsigned char *md, MD4_CTX *c); +unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); +void MD4_Transform(MD4_CTX *c, const unsigned char *b); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/md5.h b/externals/openssl/md5.h new file mode 100644 index 0000000..0761f84 --- /dev/null +++ b/externals/openssl/md5.h @@ -0,0 +1,120 @@ +/* crypto/md5/md5.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MD5_H +#define HEADER_MD5_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_MD5 +#error MD5 is disabled. +#endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! MD5_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) +#define MD5_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define MD5_LONG unsigned long +#define MD5_LONG_LOG2 3 +/* + * _CRAY note. I could declare short, but I have no idea what impact + * does it have on performance on none-T3E machines. I could declare + * int, but at least on C90 sizeof(int) can be chosen at compile time. + * So I've chosen long... + * + */ +#else +#define MD5_LONG unsigned int +#endif + +#define MD5_CBLOCK 64 +#define MD5_LBLOCK (MD5_CBLOCK/4) +#define MD5_DIGEST_LENGTH 16 + +typedef struct MD5state_st + { + MD5_LONG A,B,C,D; + MD5_LONG Nl,Nh; + MD5_LONG data[MD5_LBLOCK]; + unsigned int num; + } MD5_CTX; + +#ifdef OPENSSL_FIPS +int private_MD5_Init(MD5_CTX *c); +#endif +int MD5_Init(MD5_CTX *c); +int MD5_Update(MD5_CTX *c, const void *data, size_t len); +int MD5_Final(unsigned char *md, MD5_CTX *c); +unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); +void MD5_Transform(MD5_CTX *c, const unsigned char *b); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/obj_mac.h b/externals/openssl/obj_mac.h new file mode 100644 index 0000000..ad5f7cf --- /dev/null +++ b/externals/openssl/obj_mac.h @@ -0,0 +1,3775 @@ +/* crypto/objects/obj_mac.h */ + +/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the + * following command: + * perl objects.pl objects.txt obj_mac.num obj_mac.h + */ + +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso,2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso,3L + +#define SN_hmac_md5 "HMAC-MD5" +#define LN_hmac_md5 "hmac-md5" +#define NID_hmac_md5 780 +#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L + +#define SN_hmac_sha1 "HMAC-SHA1" +#define LN_hmac_sha1 "hmac-sha1" +#define NID_hmac_sha1 781 +#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization,132L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations,43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap,13L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types,55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body,840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US,10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57,4L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm,1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm,3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L + +#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" +#define NID_ecdsa_with_Recommended 791 +#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L + +#define SN_ecdsa_with_Specified "ecdsa-with-Specified" +#define NID_ecdsa_with_Specified 792 +#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L + +#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" +#define NID_ecdsa_with_SHA224 793 +#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L + +#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" +#define NID_ecdsa_with_SHA256 794 +#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L + +#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" +#define NID_ecdsa_with_SHA384 795 +#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L + +#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" +#define NID_ecdsa_with_SHA512 796 +#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L + +#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" +#define LN_id_PasswordBasedMAC "password based MAC" +#define NID_id_PasswordBasedMAC 782 +#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L + +#define SN_id_DHBasedMac "id-DHBasedMac" +#define LN_id_DHBasedMac "Diffie-Hellman based MAC" +#define NID_id_DHBasedMac 783 +#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US,113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs,1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs,5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5,12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5,14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9,16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME,0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME,1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME,2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME,3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME,4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME,5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME,6L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L + +#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" +#define NID_id_smime_ct_compressedData 786 +#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L + +#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" +#define NID_id_ct_asciiTextWithCRLF 787 +#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9,20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9,21L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L + +#define SN_LocalKeySet "LocalKeySet" +#define LN_LocalKeySet "Microsoft Local Key set" +#define NID_LocalKeySet 856 +#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L + +#define OBJ_certTypes OBJ_pkcs9,22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes,1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes,2L + +#define OBJ_crlTypes OBJ_pkcs9,23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes,1L + +#define OBJ_pkcs12 OBJ_pkcs,12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds,1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds,3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds,4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds,5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi,2L,4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithMD5 "hmacWithMD5" +#define NID_hmacWithMD5 797 +#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +#define LN_hmacWithSHA224 "hmacWithSHA224" +#define NID_hmacWithSHA224 798 +#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L + +#define LN_hmacWithSHA256 "hmacWithSHA256" +#define NID_hmacWithSHA256 799 +#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L + +#define LN_hmacWithSHA384 "hmacWithSHA384" +#define NID_hmacWithSHA384 800 +#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L + +#define LN_hmacWithSHA512 "hmacWithSHA512" +#define NID_hmacWithSHA512 801 +#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcardlogin" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft Universal Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix,0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix,2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix,4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix,5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix,6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix,7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix,8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix,9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix,10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix,11L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix,12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix,21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe,2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe,3L + +#define SN_ac_auditEntity "ac-auditEntity" +#define NID_ac_auditEntity 287 +#define OBJ_ac_auditEntity OBJ_id_pe,4L + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe,5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe,6L + +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" +#define NID_sbgp_ipAddrBlock 290 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L + +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" +#define NID_sbgp_autonomousSysNum 291 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L + +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" +#define NID_sbgp_routerIdentifier 292 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe,10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe,11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe,14L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt,1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt,2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt,3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp,5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp,6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp,7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp,10L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it,1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it,6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it,12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it,13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it,15L + +#define SN_id_it_suppLangTags "id-it-suppLangTags" +#define NID_id_it_suppLangTags 784 +#define OBJ_id_it_suppLangTags OBJ_id_it,16L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip,1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip,2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg,1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg,2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg,4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc,2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc,15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on,1L + +#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" +#define LN_id_on_permanentIdentifier "Permanent Identifier" +#define NID_id_on_permanentIdentifier 858 +#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda,3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca,4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca,5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca,6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct,1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct,2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl,2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad,3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad,4L + +#define SN_caRepository "caRepository" +#define LN_caRepository "CA Repository" +#define NID_caRepository 785 +#define OBJ_caRepository OBJ_id_ad,5L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm,11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm,17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509,9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509,17L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509,44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509,45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509,65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509,72L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500,8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms,1L,1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms,3L,101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500,29L + +#define SN_subject_directory_attributes "subjectDirectoryAttributes" +#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" +#define NID_subject_directory_attributes 769 +#define OBJ_subject_directory_attributes OBJ_id_ce,9L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_issuing_distribution_point "issuingDistributionPoint" +#define LN_issuing_distribution_point "X509v3 Issuing Distrubution Point" +#define NID_issuing_distribution_point 770 +#define OBJ_issuing_distribution_point OBJ_id_ce,28L + +#define SN_certificate_issuer "certificateIssuer" +#define LN_certificate_issuer "X509v3 Certificate Issuer" +#define NID_certificate_issuer 771 +#define OBJ_certificate_issuer OBJ_id_ce,29L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce,30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies,0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce,33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce,36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37L + +#define SN_freshest_crl "freshestCRL" +#define LN_freshest_crl "X509v3 Freshest CRL" +#define NID_freshest_crl 857 +#define OBJ_freshest_crl OBJ_id_ce,46L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce,55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce,56L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso,3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org,6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod,1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet,1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet,2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet,3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet,4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet,5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet,6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet,7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private,1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises,1466L,344L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail,1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L + +#define SN_rle_compression "RLE" +#define LN_rle_compression "run length compression" +#define NID_rle_compression 124 +#define OBJ_rle_compression 1L,1L,1L,1L,666L,1L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression OBJ_id_smime_alg,8L + +#define OBJ_csor 2L,16L,840L,1L,101L,3L + +#define OBJ_nistAlgorithms OBJ_csor,4L + +#define OBJ_aes OBJ_nistAlgorithms,1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes,1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes,2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes,3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes,4L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes,21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes,22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes,23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes,24L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes,41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes,42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes,43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes,44L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define SN_id_aes128_wrap "id-aes128-wrap" +#define NID_id_aes128_wrap 788 +#define OBJ_id_aes128_wrap OBJ_aes,5L + +#define SN_id_aes192_wrap "id-aes192-wrap" +#define NID_id_aes192_wrap 789 +#define OBJ_id_aes192_wrap OBJ_aes,25L + +#define SN_id_aes256_wrap "id-aes256-wrap" +#define NID_id_aes256_wrap 790 +#define OBJ_id_aes256_wrap OBJ_aes,45L + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs,1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs,2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs,3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs,4L + +#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA224 "dsa_with_SHA224" +#define NID_dsa_with_SHA224 802 +#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L + +#define SN_dsa_with_SHA256 "dsa_with_SHA256" +#define NID_dsa_with_SHA256 803 +#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce,23L + +#define OBJ_holdInstruction OBJ_X9_57,2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction,1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t,9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data,2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss,19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl,100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot,1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot,3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot,4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot,10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass,3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass,4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass,5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass,6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass,7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass,9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass,13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass,15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass,21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType,1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType,4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType,6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType,7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType,8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType,9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType,10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType,12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType,13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType,14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType,15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType,21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType,22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType,25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType,26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType,28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType,29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType,30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType,37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType,38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType,40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType,46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType,48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType,49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType,53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType,54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType,55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType,56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations,42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set,0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set,1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set,3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set,5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set,7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set,8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype,0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype,1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype,2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype,3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype,4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype,5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype,7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype,12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype,13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype,14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype,20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype,28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype,31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype,34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype,37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype,38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype,45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype,47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype,64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype,70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype,79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt,1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt,3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt,4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt,5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt,7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt,8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy,0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt,1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt,2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt,4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt,5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt,6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt,9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt,10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr,0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr,2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr,3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand,30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand,35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand,4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand,5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand,6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi,3L,10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + +#define SN_whirlpool "whirlpool" +#define NID_whirlpool 804 +#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L + +#define SN_cryptopro "cryptopro" +#define NID_cryptopro 805 +#define OBJ_cryptopro OBJ_member_body,643L,2L,2L + +#define SN_cryptocom "cryptocom" +#define NID_cryptocom 806 +#define OBJ_cryptocom OBJ_member_body,643L,2L,9L + +#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" +#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" +#define NID_id_GostR3411_94_with_GostR3410_2001 807 +#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L + +#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" +#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" +#define NID_id_GostR3411_94_with_GostR3410_94 808 +#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L + +#define SN_id_GostR3411_94 "md_gost94" +#define LN_id_GostR3411_94 "GOST R 34.11-94" +#define NID_id_GostR3411_94 809 +#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L + +#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" +#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" +#define NID_id_HMACGostR3411_94 810 +#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L + +#define SN_id_GostR3410_2001 "gost2001" +#define LN_id_GostR3410_2001 "GOST R 34.10-2001" +#define NID_id_GostR3410_2001 811 +#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L + +#define SN_id_GostR3410_94 "gost94" +#define LN_id_GostR3410_94 "GOST R 34.10-94" +#define NID_id_GostR3410_94 812 +#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L + +#define SN_id_Gost28147_89 "gost89" +#define LN_id_Gost28147_89 "GOST 28147-89" +#define NID_id_Gost28147_89 813 +#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L + +#define SN_gost89_cnt "gost89-cnt" +#define NID_gost89_cnt 814 + +#define SN_id_Gost28147_89_MAC "gost-mac" +#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" +#define NID_id_Gost28147_89_MAC 815 +#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L + +#define SN_id_GostR3411_94_prf "prf-gostr3411-94" +#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" +#define NID_id_GostR3411_94_prf 816 +#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L + +#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" +#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" +#define NID_id_GostR3410_2001DH 817 +#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L + +#define SN_id_GostR3410_94DH "id-GostR3410-94DH" +#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" +#define NID_id_GostR3410_94DH 818 +#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L + +#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" +#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 +#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L + +#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" +#define NID_id_Gost28147_89_None_KeyMeshing 820 +#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L + +#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" +#define NID_id_GostR3411_94_TestParamSet 821 +#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L + +#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" +#define NID_id_GostR3411_94_CryptoProParamSet 822 +#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L + +#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" +#define NID_id_Gost28147_89_TestParamSet 823 +#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L + +#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 +#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L + +#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 +#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L + +#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 +#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L + +#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 +#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L + +#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 +#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L + +#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" +#define NID_id_GostR3410_94_TestParamSet 831 +#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L + +#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 +#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L + +#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 +#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L + +#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 +#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L + +#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 +#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L + +#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 +#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L + +#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 +#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L + +#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 +#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L + +#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" +#define NID_id_GostR3410_2001_TestParamSet 839 +#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L + +#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 +#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L + +#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 +#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L + +#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 +#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L + +#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 +#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L + +#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 +#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L + +#define SN_id_GostR3410_94_a "id-GostR3410-94-a" +#define NID_id_GostR3410_94_a 845 +#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L + +#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" +#define NID_id_GostR3410_94_aBis 846 +#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L + +#define SN_id_GostR3410_94_b "id-GostR3410-94-b" +#define NID_id_GostR3410_94_b 847 +#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L + +#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" +#define NID_id_GostR3410_94_bBis 848 +#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L + +#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" +#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" +#define NID_id_Gost28147_89_cc 849 +#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L + +#define SN_id_GostR3410_94_cc "gost94cc" +#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" +#define NID_id_GostR3410_94_cc 850 +#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L + +#define SN_id_GostR3410_2001_cc "gost2001cc" +#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" +#define NID_id_GostR3410_2001_cc 851 +#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L + +#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L + +#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" +#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" +#define NID_id_GostR3410_2001_ParamSet_cc 854 +#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L + +#define SN_camellia_128_cbc "CAMELLIA-128-CBC" +#define LN_camellia_128_cbc "camellia-128-cbc" +#define NID_camellia_128_cbc 751 +#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L + +#define SN_camellia_192_cbc "CAMELLIA-192-CBC" +#define LN_camellia_192_cbc "camellia-192-cbc" +#define NID_camellia_192_cbc 752 +#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L + +#define SN_camellia_256_cbc "CAMELLIA-256-CBC" +#define LN_camellia_256_cbc "camellia-256-cbc" +#define NID_camellia_256_cbc 753 +#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L + +#define OBJ_ntt_ds 0L,3L,4401L,5L + +#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L + +#define SN_camellia_128_ecb "CAMELLIA-128-ECB" +#define LN_camellia_128_ecb "camellia-128-ecb" +#define NID_camellia_128_ecb 754 +#define OBJ_camellia_128_ecb OBJ_camellia,1L + +#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" +#define LN_camellia_128_ofb128 "camellia-128-ofb" +#define NID_camellia_128_ofb128 766 +#define OBJ_camellia_128_ofb128 OBJ_camellia,3L + +#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" +#define LN_camellia_128_cfb128 "camellia-128-cfb" +#define NID_camellia_128_cfb128 757 +#define OBJ_camellia_128_cfb128 OBJ_camellia,4L + +#define SN_camellia_192_ecb "CAMELLIA-192-ECB" +#define LN_camellia_192_ecb "camellia-192-ecb" +#define NID_camellia_192_ecb 755 +#define OBJ_camellia_192_ecb OBJ_camellia,21L + +#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" +#define LN_camellia_192_ofb128 "camellia-192-ofb" +#define NID_camellia_192_ofb128 767 +#define OBJ_camellia_192_ofb128 OBJ_camellia,23L + +#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" +#define LN_camellia_192_cfb128 "camellia-192-cfb" +#define NID_camellia_192_cfb128 758 +#define OBJ_camellia_192_cfb128 OBJ_camellia,24L + +#define SN_camellia_256_ecb "CAMELLIA-256-ECB" +#define LN_camellia_256_ecb "camellia-256-ecb" +#define NID_camellia_256_ecb 756 +#define OBJ_camellia_256_ecb OBJ_camellia,41L + +#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" +#define LN_camellia_256_ofb128 "camellia-256-ofb" +#define NID_camellia_256_ofb128 768 +#define OBJ_camellia_256_ofb128 OBJ_camellia,43L + +#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" +#define LN_camellia_256_cfb128 "camellia-256-cfb" +#define NID_camellia_256_cfb128 759 +#define OBJ_camellia_256_cfb128 OBJ_camellia,44L + +#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" +#define LN_camellia_128_cfb1 "camellia-128-cfb1" +#define NID_camellia_128_cfb1 760 + +#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" +#define LN_camellia_192_cfb1 "camellia-192-cfb1" +#define NID_camellia_192_cfb1 761 + +#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" +#define LN_camellia_256_cfb1 "camellia-256-cfb1" +#define NID_camellia_256_cfb1 762 + +#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" +#define LN_camellia_128_cfb8 "camellia-128-cfb8" +#define NID_camellia_128_cfb8 763 + +#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" +#define LN_camellia_192_cfb8 "camellia-192-cfb8" +#define NID_camellia_192_cfb8 764 + +#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" +#define LN_camellia_256_cfb8 "camellia-256-cfb8" +#define NID_camellia_256_cfb8 765 + +#define SN_kisa "KISA" +#define LN_kisa "kisa" +#define NID_kisa 773 +#define OBJ_kisa OBJ_member_body,410L,200004L + +#define SN_seed_ecb "SEED-ECB" +#define LN_seed_ecb "seed-ecb" +#define NID_seed_ecb 776 +#define OBJ_seed_ecb OBJ_kisa,1L,3L + +#define SN_seed_cbc "SEED-CBC" +#define LN_seed_cbc "seed-cbc" +#define NID_seed_cbc 777 +#define OBJ_seed_cbc OBJ_kisa,1L,4L + +#define SN_seed_cfb128 "SEED-CFB" +#define LN_seed_cfb128 "seed-cfb" +#define NID_seed_cfb128 779 +#define OBJ_seed_cfb128 OBJ_kisa,1L,5L + +#define SN_seed_ofb128 "SEED-OFB" +#define LN_seed_ofb128 "seed-ofb" +#define NID_seed_ofb128 778 +#define OBJ_seed_ofb128 OBJ_kisa,1L,6L + +#define SN_hmac "HMAC" +#define LN_hmac "hmac" +#define NID_hmac 855 + diff --git a/externals/openssl/objects.h b/externals/openssl/objects.h new file mode 100644 index 0000000..b44abc3 --- /dev/null +++ b/externals/openssl/objects.h @@ -0,0 +1,1050 @@ +/* crypto/objects/objects.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_OBJECTS_H +#define HEADER_OBJECTS_H + +#define USE_OBJ_MAC + +#ifdef USE_OBJ_MAC +#include +#else +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_Algorithm "Algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 38 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define LN_rsadsi "rsadsi" +#define NID_rsadsi 1 +#define OBJ_rsadsi 1L,2L,840L,113549L + +#define LN_pkcs "pkcs" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs,1L,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs,1L,2L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs,1L,4L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs,5L,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs,5L,3L + +#define LN_X500 "X500" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define LN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +/* Postal Address? PA */ + +/* should be "ST" (rfc1327) but MS uses 'S' */ +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500,8L,1L,1L + +#define LN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define LN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +/* IV + num */ +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +/* IV */ +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ede "DES-EDE" +#define LN_des_ede "des-ede" +#define NID_des_ede 32 +/* ?? */ +#define OBJ_des_ede OBJ_algorithm,17L + +#define SN_des_ede3 "DES-EDE3" +#define LN_des_ede3 "des-ede3" +#define NID_des_ede3 33 + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define LN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define SN_pkcs9_emailAddress "Email" +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +/* I'm not sure about the object ID */ +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L +/* 28 Jun 1996 - eay */ +/* #define OBJ_sha1 1L,3L,14L,2L,26L,05L <- wrong */ + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs,1L,5L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +/* proposed by microsoft to RSA */ +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L + +/* proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now + * defined explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something + * completely different. + */ +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs,5L,12L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */ +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce 2L,5L,29L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 2L,5L,8L,3L,101L +/* An alternative? 1L,3L,14L,3L,2L,19L */ + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2withRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA 2L,5L,8L,3L,100L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_givenName "G" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define SN_surname "S" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define SN_initials "I" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define SN_uniqueIdentifier "UID" +#define LN_uniqueIdentifier "uniqueIdentifier" +#define NID_uniqueIdentifier 102 +#define OBJ_uniqueIdentifier OBJ_X509,45L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_serialNumber "SN" +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_title "T" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define SN_description "D" +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +/* CAST5 is CAST-128, I'm just sticking with the documentation */ +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc 1L,2L,840L,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC 1L,2L,840L,113533L,7L,66L,12L + +/* This is one sun will soon be using :-( + * id-dsa-with-sha1 ID ::= { + * iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 } + */ +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 1L,2L,840L,10040L,4L,3L + +#define NID_md5_sha1 114 +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa 1L,2L,840L,10040L,4L,1L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +/* The name should actually be rsaSignatureWithripemd160, but I'm going + * to continue using the convention I'm using with the other ciphers */ +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +/* Taken from rfc2040 + * RC5_CBC_Parameters ::= SEQUENCE { + * version INTEGER (v1_0(16)), + * rounds INTEGER (8..127), + * blockSizeInBits INTEGER (64, 128), + * iv OCTET STRING OPTIONAL + * } + */ +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_rle_compression "RLE" +#define LN_rle_compression "run length compression" +#define NID_rle_compression 124 +#define OBJ_rle_compression 1L,1L,1L,1L,666L,1L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression 1L,1L,1L,1L,666L,2L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +/* PKIX extended key usage OIDs */ + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +/* Additional extended key usage OIDs: Microsoft */ + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +/* Additional usage: Netscape */ + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +/* PKCS12 and related OBJECT IDENTIFIERS */ + +#define OBJ_pkcs12 OBJ_pkcs,12L +#define OBJ_pkcs12_pbeids OBJ_pkcs12, 1 + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12, 10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1, 1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds, 1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds, 3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds, 4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds, 5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds, 6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9, 20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9, 21L + +#define OBJ_certTypes OBJ_pkcs9, 22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes, 1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes, 2L + +#define OBJ_crlTypes OBJ_pkcs9, 23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes, 1L + +/* PKCS#5 v2 OIDs */ + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs,5L,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs,5L,14L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +/* Policy Qualifier Ids */ + +#define LN_id_qt_cps "Policy Qualifier CPS" +#define SN_id_qt_cps "id-qt-cps" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_pkix,2L,1L + +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define SN_id_qt_unotice "id-qt-unotice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_pkix,2L,2L + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs,5L,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs,5L,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs,5L,10L + +/* Extension request OIDs */ + +#define LN_ms_ext_req "Microsoft Extension Request" +#define SN_ms_ext_req "msExtReq" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define LN_ext_req "Extension Request" +#define SN_ext_req "extReq" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L +#endif /* USE_OBJ_MAC */ + +#include +#include + +#define OBJ_NAME_TYPE_UNDEF 0x00 +#define OBJ_NAME_TYPE_MD_METH 0x01 +#define OBJ_NAME_TYPE_CIPHER_METH 0x02 +#define OBJ_NAME_TYPE_PKEY_METH 0x03 +#define OBJ_NAME_TYPE_COMP_METH 0x04 +#define OBJ_NAME_TYPE_NUM 0x05 + +#define OBJ_NAME_ALIAS 0x8000 + +#define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 +#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct obj_name_st + { + int type; + int alias; + const char *name; + const char *data; + } OBJ_NAME; + +#define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) + + +int OBJ_NAME_init(void); +int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *), + int (*cmp_func)(const char *, const char *), + void (*free_func)(const char *, int, const char *)); +const char *OBJ_NAME_get(const char *name,int type); +int OBJ_NAME_add(const char *name,int type,const char *data); +int OBJ_NAME_remove(const char *name,int type); +void OBJ_NAME_cleanup(int type); /* -1 for everything */ +void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg), + void *arg); +void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), + void *arg); + +ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o); +ASN1_OBJECT * OBJ_nid2obj(int n); +const char * OBJ_nid2ln(int n); +const char * OBJ_nid2sn(int n); +int OBJ_obj2nid(const ASN1_OBJECT *o); +ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_txt2nid(const char *s); +int OBJ_ln2nid(const char *s); +int OBJ_sn2nid(const char *s); +int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); +const char * OBJ_bsearch(const char *key,const char *base,int num,int size, + int (*cmp)(const void *, const void *)); +const char * OBJ_bsearch_ex(const char *key,const char *base,int num, + int size, int (*cmp)(const void *, const void *), int flags); + +int OBJ_new_nid(int num); +int OBJ_add_object(const ASN1_OBJECT *obj); +int OBJ_create(const char *oid,const char *sn,const char *ln); +void OBJ_cleanup(void ); +int OBJ_create_objects(BIO *in); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_OBJ_strings(void); + +/* Error codes for the OBJ functions. */ + +/* Function codes. */ +#define OBJ_F_OBJ_ADD_OBJECT 105 +#define OBJ_F_OBJ_CREATE 100 +#define OBJ_F_OBJ_DUP 101 +#define OBJ_F_OBJ_NAME_NEW_INDEX 106 +#define OBJ_F_OBJ_NID2LN 102 +#define OBJ_F_OBJ_NID2OBJ 103 +#define OBJ_F_OBJ_NID2SN 104 + +/* Reason codes. */ +#define OBJ_R_MALLOC_FAILURE 100 +#define OBJ_R_UNKNOWN_NID 101 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/ocsp.h b/externals/openssl/ocsp.h new file mode 100644 index 0000000..a0577a7 --- /dev/null +++ b/externals/openssl/ocsp.h @@ -0,0 +1,623 @@ +/* ocsp.h */ +/* Written by Tom Titchener for the OpenSSL + * project. */ + +/* History: + This file was transfered to Richard Levitte from CertCo by Kathy + Weinhold in mid-spring 2000 to be included in OpenSSL or released + as a patch kit. */ + +/* ==================================================================== + * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_OCSP_H +#define HEADER_OCSP_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Various flags and values */ + +#define OCSP_DEFAULT_NONCE_LENGTH 16 + +#define OCSP_NOCERTS 0x1 +#define OCSP_NOINTERN 0x2 +#define OCSP_NOSIGS 0x4 +#define OCSP_NOCHAIN 0x8 +#define OCSP_NOVERIFY 0x10 +#define OCSP_NOEXPLICIT 0x20 +#define OCSP_NOCASIGN 0x40 +#define OCSP_NODELEGATED 0x80 +#define OCSP_NOCHECKS 0x100 +#define OCSP_TRUSTOTHER 0x200 +#define OCSP_RESPID_KEY 0x400 +#define OCSP_NOTIME 0x800 + +/* CertID ::= SEQUENCE { + * hashAlgorithm AlgorithmIdentifier, + * issuerNameHash OCTET STRING, -- Hash of Issuer's DN + * issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields) + * serialNumber CertificateSerialNumber } + */ +typedef struct ocsp_cert_id_st + { + X509_ALGOR *hashAlgorithm; + ASN1_OCTET_STRING *issuerNameHash; + ASN1_OCTET_STRING *issuerKeyHash; + ASN1_INTEGER *serialNumber; + } OCSP_CERTID; + +DECLARE_STACK_OF(OCSP_CERTID) + +/* Request ::= SEQUENCE { + * reqCert CertID, + * singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_one_request_st + { + OCSP_CERTID *reqCert; + STACK_OF(X509_EXTENSION) *singleRequestExtensions; + } OCSP_ONEREQ; + +DECLARE_STACK_OF(OCSP_ONEREQ) +DECLARE_ASN1_SET_OF(OCSP_ONEREQ) + + +/* TBSRequest ::= SEQUENCE { + * version [0] EXPLICIT Version DEFAULT v1, + * requestorName [1] EXPLICIT GeneralName OPTIONAL, + * requestList SEQUENCE OF Request, + * requestExtensions [2] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_req_info_st + { + ASN1_INTEGER *version; + GENERAL_NAME *requestorName; + STACK_OF(OCSP_ONEREQ) *requestList; + STACK_OF(X509_EXTENSION) *requestExtensions; + } OCSP_REQINFO; + +/* Signature ::= SEQUENCE { + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING, + * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } + */ +typedef struct ocsp_signature_st + { + X509_ALGOR *signatureAlgorithm; + ASN1_BIT_STRING *signature; + STACK_OF(X509) *certs; + } OCSP_SIGNATURE; + +/* OCSPRequest ::= SEQUENCE { + * tbsRequest TBSRequest, + * optionalSignature [0] EXPLICIT Signature OPTIONAL } + */ +typedef struct ocsp_request_st + { + OCSP_REQINFO *tbsRequest; + OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */ + } OCSP_REQUEST; + +/* OCSPResponseStatus ::= ENUMERATED { + * successful (0), --Response has valid confirmations + * malformedRequest (1), --Illegal confirmation request + * internalError (2), --Internal error in issuer + * tryLater (3), --Try again later + * --(4) is not used + * sigRequired (5), --Must sign the request + * unauthorized (6) --Request unauthorized + * } + */ +#define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 +#define OCSP_RESPONSE_STATUS_INTERNALERROR 2 +#define OCSP_RESPONSE_STATUS_TRYLATER 3 +#define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 +#define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 + +/* ResponseBytes ::= SEQUENCE { + * responseType OBJECT IDENTIFIER, + * response OCTET STRING } + */ +typedef struct ocsp_resp_bytes_st + { + ASN1_OBJECT *responseType; + ASN1_OCTET_STRING *response; + } OCSP_RESPBYTES; + +/* OCSPResponse ::= SEQUENCE { + * responseStatus OCSPResponseStatus, + * responseBytes [0] EXPLICIT ResponseBytes OPTIONAL } + */ +struct ocsp_response_st + { + ASN1_ENUMERATED *responseStatus; + OCSP_RESPBYTES *responseBytes; + }; + +/* ResponderID ::= CHOICE { + * byName [1] Name, + * byKey [2] KeyHash } + */ +#define V_OCSP_RESPID_NAME 0 +#define V_OCSP_RESPID_KEY 1 +struct ocsp_responder_id_st + { + int type; + union { + X509_NAME* byName; + ASN1_OCTET_STRING *byKey; + } value; + }; + +DECLARE_STACK_OF(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) + +/* KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key + * --(excluding the tag and length fields) + */ + +/* RevokedInfo ::= SEQUENCE { + * revocationTime GeneralizedTime, + * revocationReason [0] EXPLICIT CRLReason OPTIONAL } + */ +typedef struct ocsp_revoked_info_st + { + ASN1_GENERALIZEDTIME *revocationTime; + ASN1_ENUMERATED *revocationReason; + } OCSP_REVOKEDINFO; + +/* CertStatus ::= CHOICE { + * good [0] IMPLICIT NULL, + * revoked [1] IMPLICIT RevokedInfo, + * unknown [2] IMPLICIT UnknownInfo } + */ +#define V_OCSP_CERTSTATUS_GOOD 0 +#define V_OCSP_CERTSTATUS_REVOKED 1 +#define V_OCSP_CERTSTATUS_UNKNOWN 2 +typedef struct ocsp_cert_status_st + { + int type; + union { + ASN1_NULL *good; + OCSP_REVOKEDINFO *revoked; + ASN1_NULL *unknown; + } value; + } OCSP_CERTSTATUS; + +/* SingleResponse ::= SEQUENCE { + * certID CertID, + * certStatus CertStatus, + * thisUpdate GeneralizedTime, + * nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL, + * singleExtensions [1] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_single_response_st + { + OCSP_CERTID *certId; + OCSP_CERTSTATUS *certStatus; + ASN1_GENERALIZEDTIME *thisUpdate; + ASN1_GENERALIZEDTIME *nextUpdate; + STACK_OF(X509_EXTENSION) *singleExtensions; + } OCSP_SINGLERESP; + +DECLARE_STACK_OF(OCSP_SINGLERESP) +DECLARE_ASN1_SET_OF(OCSP_SINGLERESP) + +/* ResponseData ::= SEQUENCE { + * version [0] EXPLICIT Version DEFAULT v1, + * responderID ResponderID, + * producedAt GeneralizedTime, + * responses SEQUENCE OF SingleResponse, + * responseExtensions [1] EXPLICIT Extensions OPTIONAL } + */ +typedef struct ocsp_response_data_st + { + ASN1_INTEGER *version; + OCSP_RESPID *responderId; + ASN1_GENERALIZEDTIME *producedAt; + STACK_OF(OCSP_SINGLERESP) *responses; + STACK_OF(X509_EXTENSION) *responseExtensions; + } OCSP_RESPDATA; + +/* BasicOCSPResponse ::= SEQUENCE { + * tbsResponseData ResponseData, + * signatureAlgorithm AlgorithmIdentifier, + * signature BIT STRING, + * certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL } + */ + /* Note 1: + The value for "signature" is specified in the OCSP rfc2560 as follows: + "The value for the signature SHALL be computed on the hash of the DER + encoding ResponseData." This means that you must hash the DER-encoded + tbsResponseData, and then run it through a crypto-signing function, which + will (at least w/RSA) do a hash-'n'-private-encrypt operation. This seems + a bit odd, but that's the spec. Also note that the data structures do not + leave anywhere to independently specify the algorithm used for the initial + hash. So, we look at the signature-specification algorithm, and try to do + something intelligent. -- Kathy Weinhold, CertCo */ + /* Note 2: + It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open + for interpretation. I've done tests against another responder, and found + that it doesn't do the double hashing that the RFC seems to say one + should. Therefore, all relevant functions take a flag saying which + variant should be used. -- Richard Levitte, OpenSSL team and CeloCom */ +typedef struct ocsp_basic_response_st + { + OCSP_RESPDATA *tbsResponseData; + X509_ALGOR *signatureAlgorithm; + ASN1_BIT_STRING *signature; + STACK_OF(X509) *certs; + } OCSP_BASICRESP; + +/* + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * removeFromCRL (8) } + */ +#define OCSP_REVOKED_STATUS_NOSTATUS -1 +#define OCSP_REVOKED_STATUS_UNSPECIFIED 0 +#define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 +#define OCSP_REVOKED_STATUS_CACOMPROMISE 2 +#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 +#define OCSP_REVOKED_STATUS_SUPERSEDED 4 +#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 +#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 +#define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 + +/* CrlID ::= SEQUENCE { + * crlUrl [0] EXPLICIT IA5String OPTIONAL, + * crlNum [1] EXPLICIT INTEGER OPTIONAL, + * crlTime [2] EXPLICIT GeneralizedTime OPTIONAL } + */ +typedef struct ocsp_crl_id_st + { + ASN1_IA5STRING *crlUrl; + ASN1_INTEGER *crlNum; + ASN1_GENERALIZEDTIME *crlTime; + } OCSP_CRLID; + +/* ServiceLocator ::= SEQUENCE { + * issuer Name, + * locator AuthorityInfoAccessSyntax OPTIONAL } + */ +typedef struct ocsp_service_locator_st + { + X509_NAME* issuer; + STACK_OF(ACCESS_DESCRIPTION) *locator; + } OCSP_SERVICELOC; + +#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" +#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" + +#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) + +#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) + +#define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL) + +#define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\ + (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL) + +#define PEM_write_bio_OCSP_REQUEST(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ + bp,(char *)o, NULL,NULL,0,NULL,NULL) + +#define PEM_write_bio_OCSP_RESPONSE(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ + bp,(char *)o, NULL,NULL,0,NULL,NULL) + +#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) + +#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) + +#define OCSP_REQUEST_sign(o,pkey,md) \ + ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\ + o->optionalSignature->signatureAlgorithm,NULL,\ + o->optionalSignature->signature,o->tbsRequest,pkey,md) + +#define OCSP_BASICRESP_sign(o,pkey,md,d) \ + ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\ + o->signature,o->tbsResponseData,pkey,md) + +#define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\ + a->optionalSignature->signatureAlgorithm,\ + a->optionalSignature->signature,a->tbsRequest,r) + +#define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\ + a->signatureAlgorithm,a->signature,a->tbsResponseData,r) + +#define ASN1_BIT_STRING_digest(data,type,md,len) \ + ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) + +#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid) + +#define OCSP_CERTSTATUS_dup(cs)\ + (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ + (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) + +OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req); +OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, + int maxline); +int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); +void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); + +OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer); + +OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, + X509_NAME *issuerName, + ASN1_BIT_STRING* issuerKey, + ASN1_INTEGER *serialNumber); + +OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); + +int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); +int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); +int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); +int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); + +int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); +int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); + +int OCSP_request_sign(OCSP_REQUEST *req, + X509 *signer, + EVP_PKEY *key, + const EVP_MD *dgst, + STACK_OF(X509) *certs, + unsigned long flags); + +int OCSP_response_status(OCSP_RESPONSE *resp); +OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); + +int OCSP_resp_count(OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); +int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); +int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, + int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, + ASN1_GENERALIZEDTIME *nextupd, + long sec, long maxsec); + +int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, unsigned long flags); + +int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pssl); + +int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b); +int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b); + +int OCSP_request_onereq_count(OCSP_REQUEST *req); +OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); +OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); +int OCSP_request_is_signed(OCSP_REQUEST *req); +OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, + OCSP_CERTID *cid, + int status, int reason, + ASN1_TIME *revtime, + ASN1_TIME *thisupd, ASN1_TIME *nextupd); +int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); +int OCSP_basic_sign(OCSP_BASICRESP *brsp, + X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); + +ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, + void *data, STACK_OF(ASN1_OBJECT) *sk); +#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \ + ASN1_STRING_encode(s, CHECKED_I2D_OF(type, i2d), data, sk) + +X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim); + +X509_EXTENSION *OCSP_accept_responses_new(char **oids); + +X509_EXTENSION *OCSP_archive_cutoff_new(char* tim); + +X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls); + +int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); +int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); +int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); +X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); +X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); +void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx); +int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); + +int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); +int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); +int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); +X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); +X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); +void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); +int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); + +int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); +int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); +int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos); +X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); +X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); +void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx); +int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); + +int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); +int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); +int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos); +int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos); +X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); +X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); +void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx); +int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); + +DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) +DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) +DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) +DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) +DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) +DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) +DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) + +char *OCSP_response_status_str(long s); +char *OCSP_cert_status_str(long s); +char *OCSP_crl_reason_str(long s); + +int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags); +int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags); + +int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, + X509_STORE *st, unsigned long flags); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_OCSP_strings(void); + +/* Error codes for the OCSP functions. */ + +/* Function codes. */ +#define OCSP_F_ASN1_STRING_ENCODE 100 +#define OCSP_F_D2I_OCSP_NONCE 102 +#define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 +#define OCSP_F_OCSP_BASIC_SIGN 104 +#define OCSP_F_OCSP_BASIC_VERIFY 105 +#define OCSP_F_OCSP_CERT_ID_NEW 101 +#define OCSP_F_OCSP_CHECK_DELEGATED 106 +#define OCSP_F_OCSP_CHECK_IDS 107 +#define OCSP_F_OCSP_CHECK_ISSUER 108 +#define OCSP_F_OCSP_CHECK_VALIDITY 115 +#define OCSP_F_OCSP_MATCH_ISSUERID 109 +#define OCSP_F_OCSP_PARSE_URL 114 +#define OCSP_F_OCSP_REQUEST_SIGN 110 +#define OCSP_F_OCSP_REQUEST_VERIFY 116 +#define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 +#define OCSP_F_OCSP_SENDREQ_BIO 112 +#define OCSP_F_PARSE_HTTP_LINE1 117 +#define OCSP_F_REQUEST_VERIFY 113 + +/* Reason codes. */ +#define OCSP_R_BAD_DATA 100 +#define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 +#define OCSP_R_DIGEST_ERR 102 +#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 +#define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 +#define OCSP_R_ERROR_PARSING_URL 121 +#define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 +#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 +#define OCSP_R_NOT_BASIC_RESPONSE 104 +#define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 +#define OCSP_R_NO_CONTENT 106 +#define OCSP_R_NO_PUBLIC_KEY 107 +#define OCSP_R_NO_RESPONSE_DATA 108 +#define OCSP_R_NO_REVOKED_TIME 109 +#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 +#define OCSP_R_REQUEST_NOT_SIGNED 128 +#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 +#define OCSP_R_ROOT_CA_NOT_TRUSTED 112 +#define OCSP_R_SERVER_READ_ERROR 113 +#define OCSP_R_SERVER_RESPONSE_ERROR 114 +#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 +#define OCSP_R_SERVER_WRITE_ERROR 116 +#define OCSP_R_SIGNATURE_FAILURE 117 +#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 +#define OCSP_R_STATUS_EXPIRED 125 +#define OCSP_R_STATUS_NOT_YET_VALID 126 +#define OCSP_R_STATUS_TOO_OLD 127 +#define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 +#define OCSP_R_UNKNOWN_NID 120 +#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/opensslconf.h b/externals/openssl/opensslconf.h new file mode 100644 index 0000000..2d571c8 --- /dev/null +++ b/externals/openssl/opensslconf.h @@ -0,0 +1,259 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_SYSNAME_WIN32 +# define OPENSSL_SYSNAME_WIN32 +#endif +#ifndef OPENSSL_DOING_MAKEDEPEND + + +#ifndef OPENSSL_NO_CAMELLIA +# define OPENSSL_NO_CAMELLIA +#endif +#ifndef OPENSSL_NO_CAPIENG +# define OPENSSL_NO_CAPIENG +#endif +#ifndef OPENSSL_NO_CMS +# define OPENSSL_NO_CMS +#endif +#ifndef OPENSSL_NO_GMP +# define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_JPAKE +# define OPENSSL_NO_JPAKE +#endif +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_MDC2 +# define OPENSSL_NO_MDC2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RFC3779 +# define OPENSSL_NO_RFC3779 +#endif +#ifndef OPENSSL_NO_SEED +# define OPENSSL_NO_SEED +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA) +# define NO_CAMELLIA +# endif +# if defined(OPENSSL_NO_CAPIENG) && !defined(NO_CAPIENG) +# define NO_CAPIENG +# endif +# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS) +# define NO_CMS +# endif +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +# define NO_GMP +# endif +# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) +# define NO_JPAKE +# endif +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2) +# define NO_MDC2 +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) +# define NO_RFC3779 +# endif +# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED) +# define NO_SEED +# endif +#endif + +/* crypto/opensslconf.h.in */ + +#ifdef OPENSSL_DOING_MAKEDEPEND + +/* Include any symbols here that have to be explicitly set to enable a feature + * that should be visible to makedepend. + * + * [Our "make depend" doesn't actually look at this, we use actual build settings + * instead; we want to make it easy to remove subdirectories with disabled algorithms.] + */ + +#ifndef OPENSSL_FIPS +#define OPENSSL_FIPS +#endif + +#endif + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR "g:/openssl/lib/engines" +#define OPENSSLDIR "g:/openssl/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION +#define OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#undef RC4_CHUNK +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned long +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#define BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +/* The prime number generation stuff may not work when + * EIGHT_BIT but I don't care since I've only used this mode + * for debuging the bignum libraries */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#undef SIXTEEN_BIT +#undef EIGHT_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#define RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#undef DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ diff --git a/externals/openssl/opensslv.h b/externals/openssl/opensslv.h new file mode 100644 index 0000000..c6207f7 --- /dev/null +++ b/externals/openssl/opensslv.h @@ -0,0 +1,89 @@ +#ifndef HEADER_OPENSSLV_H +#define HEADER_OPENSSLV_H + +/* Numeric release version identifier: + * MNNFFPPS: major minor fix patch status + * The status nibble has one of the values 0 for development, 1 to e for betas + * 1 to 14, and f for release. The patch level is exactly that. + * For example: + * 0.9.3-dev 0x00903000 + * 0.9.3-beta1 0x00903001 + * 0.9.3-beta2-dev 0x00903002 + * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) + * 0.9.3 0x0090300f + * 0.9.3a 0x0090301f + * 0.9.4 0x0090400f + * 1.2.3z 0x102031af + * + * For continuity reasons (because 0.9.5 is already out, and is coded + * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level + * part is slightly different, by setting the highest bit. This means + * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start + * with 0x0090600S... + * + * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) + * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for + * major minor fix final patch/beta) + */ +#define OPENSSL_VERSION_NUMBER 0x009080bfL +#ifdef OPENSSL_FIPS +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8k-fips 25 Mar 2009" +#else +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8k 25 Mar 2009" +#endif +#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT + + +/* The macros below are to be used for shared library (.so, .dll, ...) + * versioning. That kind of versioning works a bit differently between + * operating systems. The most usual scheme is to set a major and a minor + * number, and have the runtime loader check that the major number is equal + * to what it was at application link time, while the minor number has to + * be greater or equal to what it was at application link time. With this + * scheme, the version number is usually part of the file name, like this: + * + * libcrypto.so.0.9 + * + * Some unixen also make a softlink with the major verson number only: + * + * libcrypto.so.0 + * + * On Tru64 and IRIX 6.x it works a little bit differently. There, the + * shared library version is stored in the file, and is actually a series + * of versions, separated by colons. The rightmost version present in the + * library when linking an application is stored in the application to be + * matched at run time. When the application is run, a check is done to + * see if the library version stored in the application matches any of the + * versions in the version string of the library itself. + * This version string can be constructed in any way, depending on what + * kind of matching is desired. However, to implement the same scheme as + * the one used in the other unixen, all compatible versions, from lowest + * to highest, should be part of the string. Consecutive builds would + * give the following versions strings: + * + * 3.0 + * 3.0:3.1 + * 3.0:3.1:3.2 + * 4.0 + * 4.0:4.1 + * + * Notice how version 4 is completely incompatible with version, and + * therefore give the breach you can see. + * + * There may be other schemes as well that I haven't yet discovered. + * + * So, here's the way it works here: first of all, the library version + * number doesn't need at all to match the overall OpenSSL version. + * However, it's nice and more understandable if it actually does. + * The current library version is stored in the macro SHLIB_VERSION_NUMBER, + * which is just a piece of text in the format "M.m.e" (Major, minor, edit). + * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, + * we need to keep a history of version numbers, which is done in the + * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and + * should only keep the versions that are binary compatible with the current. + */ +#define SHLIB_VERSION_HISTORY "" +#define SHLIB_VERSION_NUMBER "0.9.8" + + +#endif /* HEADER_OPENSSLV_H */ diff --git a/externals/openssl/ossl_typ.h b/externals/openssl/ossl_typ.h new file mode 100644 index 0000000..0e7a380 --- /dev/null +++ b/externals/openssl/ossl_typ.h @@ -0,0 +1,183 @@ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_OPENSSL_TYPES_H +#define HEADER_OPENSSL_TYPES_H + +#include + +#ifdef NO_ASN1_TYPEDEFS +#define ASN1_INTEGER ASN1_STRING +#define ASN1_ENUMERATED ASN1_STRING +#define ASN1_BIT_STRING ASN1_STRING +#define ASN1_OCTET_STRING ASN1_STRING +#define ASN1_PRINTABLESTRING ASN1_STRING +#define ASN1_T61STRING ASN1_STRING +#define ASN1_IA5STRING ASN1_STRING +#define ASN1_UTCTIME ASN1_STRING +#define ASN1_GENERALIZEDTIME ASN1_STRING +#define ASN1_TIME ASN1_STRING +#define ASN1_GENERALSTRING ASN1_STRING +#define ASN1_UNIVERSALSTRING ASN1_STRING +#define ASN1_BMPSTRING ASN1_STRING +#define ASN1_VISIBLESTRING ASN1_STRING +#define ASN1_UTF8STRING ASN1_STRING +#define ASN1_BOOLEAN int +#define ASN1_NULL int +#else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +#endif + +#ifdef OPENSSL_SYS_WIN32 +#undef X509_NAME +#undef X509_EXTENSIONS +#undef X509_CERT_PAIR +#undef PKCS7_ISSUER_AND_SERIAL +#undef OCSP_REQUEST +#undef OCSP_RESPONSE +#endif + +#ifdef BIGNUM +#undef BIGNUM +#endif +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; + +typedef struct buf_mem_st BUF_MEM; + +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct env_md_st EVP_MD; +typedef struct env_md_ctx_st EVP_MD_CTX; +typedef struct evp_pkey_st EVP_PKEY; + +typedef struct dh_st DH; +typedef struct dh_method DH_METHOD; + +typedef struct dsa_st DSA; +typedef struct dsa_method DSA_METHOD; + +typedef struct rsa_st RSA; +typedef struct rsa_meth_st RSA_METHOD; + +typedef struct rand_meth_st RAND_METHOD; + +typedef struct ecdh_method ECDH_METHOD; +typedef struct ecdsa_method ECDSA_METHOD; + +typedef struct x509_st X509; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct X509_name_st X509_NAME; +typedef struct x509_store_st X509_STORE; +typedef struct x509_store_ctx_st X509_STORE_CTX; +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; + +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct conf_st CONF; + +typedef struct store_st STORE; +typedef struct store_method_st STORE_METHOD; + +typedef struct ui_st UI; +typedef struct ui_method_st UI_METHOD; + +typedef struct st_ERR_FNS ERR_FNS; + +typedef struct engine_st ENGINE; + +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; + + /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ +#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ +#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; +/* Callback types for crypto.h */ +typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, + int idx, long argl, void *argp); + +typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; +typedef struct ocsp_response_st OCSP_RESPONSE; +typedef struct ocsp_responder_id_st OCSP_RESPID; + +#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/externals/openssl/pem.h b/externals/openssl/pem.h new file mode 100644 index 0000000..6c193f1 --- /dev/null +++ b/externals/openssl/pem.h @@ -0,0 +1,782 @@ +/* crypto/pem/pem.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_PEM_H +#define HEADER_PEM_H + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_STACK +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PEM_BUFSIZE 1024 + +#define PEM_OBJ_UNDEF 0 +#define PEM_OBJ_X509 1 +#define PEM_OBJ_X509_REQ 2 +#define PEM_OBJ_CRL 3 +#define PEM_OBJ_SSL_SESSION 4 +#define PEM_OBJ_PRIV_KEY 10 +#define PEM_OBJ_PRIV_RSA 11 +#define PEM_OBJ_PRIV_DSA 12 +#define PEM_OBJ_PRIV_DH 13 +#define PEM_OBJ_PUB_RSA 14 +#define PEM_OBJ_PUB_DSA 15 +#define PEM_OBJ_PUB_DH 16 +#define PEM_OBJ_DHPARAMS 17 +#define PEM_OBJ_DSAPARAMS 18 +#define PEM_OBJ_PRIV_RSA_PUBLIC 19 +#define PEM_OBJ_PRIV_ECDSA 20 +#define PEM_OBJ_PUB_ECDSA 21 +#define PEM_OBJ_ECPARAMETERS 22 + +#define PEM_ERROR 30 +#define PEM_DEK_DES_CBC 40 +#define PEM_DEK_IDEA_CBC 45 +#define PEM_DEK_DES_EDE 50 +#define PEM_DEK_DES_ECB 60 +#define PEM_DEK_RSA 70 +#define PEM_DEK_RSA_MD2 80 +#define PEM_DEK_RSA_MD5 90 + +#define PEM_MD_MD2 NID_md2 +#define PEM_MD_MD5 NID_md5 +#define PEM_MD_SHA NID_sha +#define PEM_MD_MD2_RSA NID_md2WithRSAEncryption +#define PEM_MD_MD5_RSA NID_md5WithRSAEncryption +#define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption + +#define PEM_STRING_X509_OLD "X509 CERTIFICATE" +#define PEM_STRING_X509 "CERTIFICATE" +#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR" +#define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +#define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +#define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +#define PEM_STRING_X509_CRL "X509 CRL" +#define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +#define PEM_STRING_PUBLIC "PUBLIC KEY" +#define PEM_STRING_RSA "RSA PRIVATE KEY" +#define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +#define PEM_STRING_DSA "DSA PRIVATE KEY" +#define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +#define PEM_STRING_PKCS7 "PKCS7" +#define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" +#define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +#define PEM_STRING_PKCS8INF "PRIVATE KEY" +#define PEM_STRING_DHPARAMS "DH PARAMETERS" +#define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +#define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +#define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" +#define PEM_STRING_CMS "CMS" + + /* Note that this structure is initialised by PEM_SealInit and cleaned up + by PEM_SealFinal (at least for now) */ +typedef struct PEM_Encode_Seal_st + { + EVP_ENCODE_CTX encode; + EVP_MD_CTX md; + EVP_CIPHER_CTX cipher; + } PEM_ENCODE_SEAL_CTX; + +/* enc_type is one off */ +#define PEM_TYPE_ENCRYPTED 10 +#define PEM_TYPE_MIC_ONLY 20 +#define PEM_TYPE_MIC_CLEAR 30 +#define PEM_TYPE_CLEAR 40 + +typedef struct pem_recip_st + { + char *name; + X509_NAME *dn; + + int cipher; + int key_enc; + /* char iv[8]; unused and wrong size */ + } PEM_USER; + +typedef struct pem_ctx_st + { + int type; /* what type of object */ + + struct { + int version; + int mode; + } proc_type; + + char *domain; + + struct { + int cipher; + /* unused, and wrong size + unsigned char iv[8]; */ + } DEK_info; + + PEM_USER *originator; + + int num_recipient; + PEM_USER **recipient; + +#ifndef OPENSSL_NO_STACK + STACK *x509_chain; /* certificate chain */ +#else + char *x509_chain; /* certificate chain */ +#endif + EVP_MD *md; /* signature type */ + + int md_enc; /* is the md encrypted or not? */ + int md_len; /* length of md_data */ + char *md_data; /* message digest, could be pkey encrypted */ + + EVP_CIPHER *dec; /* date encryption cipher */ + int key_len; /* key length */ + unsigned char *key; /* key */ + /* unused, and wrong size + unsigned char iv[8]; */ + + + int data_enc; /* is the data encrypted */ + int data_len; + unsigned char *data; + } PEM_CTX; + +/* These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: + * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...) + */ + +#ifdef OPENSSL_NO_FP_API + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ + +#else + +#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ +type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ +{ \ + return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \ + str, fp, \ + CHECKED_PPTR_OF(type, x), \ + cb, u); \ +} + +#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x) \ +{ \ + return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \ + str, fp, \ + CHECKED_PTR_OF(type, x), \ + NULL, NULL, 0, NULL, NULL); \ +} + +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, const type *x) \ +{ \ + return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \ + str, fp, \ + CHECKED_PTR_OF(const type, x), \ + NULL, NULL, 0, NULL, NULL); \ +} + +#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \ + str, fp, \ + CHECKED_PTR_OF(type, x), \ + enc, kstr, klen, cb, u); \ + } + +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \ + str, fp, \ + CHECKED_PTR_OF(const type, x), \ + enc, kstr, klen, cb, u); \ + } + +#endif + +#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ +type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ +{ \ + return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \ + str, bp, \ + CHECKED_PPTR_OF(type, x), \ + cb, u); \ +} + +#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x) \ +{ \ + return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \ + str, bp, \ + CHECKED_PTR_OF(type, x), \ + NULL, NULL, 0, NULL, NULL); \ +} + +#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, const type *x) \ +{ \ + return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \ + str, bp, \ + CHECKED_PTR_OF(const type, x), \ + NULL, NULL, 0, NULL, NULL); \ +} + +#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \ + str, bp, \ + CHECKED_PTR_OF(type, x), \ + enc, kstr, klen, cb, u); \ + } + +#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \ + str, bp, \ + CHECKED_PTR_OF(const type, x), \ + enc, kstr, klen, cb, u); \ + } + +#define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) + +#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_NO_FP_API) + +#define DECLARE_PEM_read_fp(name, type) /**/ +#define DECLARE_PEM_write_fp(name, type) /**/ +#define DECLARE_PEM_write_fp_const(name, type) /**/ +#define DECLARE_PEM_write_cb_fp(name, type) /**/ + +#else + +#define DECLARE_PEM_read_fp(name, type) \ + type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); + +#define DECLARE_PEM_write_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x); + +#define DECLARE_PEM_write_fp_const(name, type) \ + int PEM_write_##name(FILE *fp, const type *x); + +#define DECLARE_PEM_write_cb_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +#endif + +#ifndef OPENSSL_NO_BIO +#define DECLARE_PEM_read_bio(name, type) \ + type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); + +#define DECLARE_PEM_write_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x); + +#define DECLARE_PEM_write_bio_const(name, type) \ + int PEM_write_bio_##name(BIO *bp, const type *x); + +#define DECLARE_PEM_write_cb_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +#else + +#define DECLARE_PEM_read_bio(name, type) /**/ +#define DECLARE_PEM_write_bio(name, type) /**/ +#define DECLARE_PEM_write_bio_const(name, type) /**/ +#define DECLARE_PEM_write_cb_bio(name, type) /**/ + +#endif + +#define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_bio(name, type) \ + DECLARE_PEM_write_fp(name, type) + +#define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_bio_const(name, type) \ + DECLARE_PEM_write_fp_const(name, type) + +#define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_bio(name, type) \ + DECLARE_PEM_write_cb_fp(name, type) + +#define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_bio(name, type) \ + DECLARE_PEM_read_fp(name, type) + +#define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write(name, type) + +#define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_const(name, type) + +#define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_cb(name, type) + +#ifdef SSLEAY_MACROS + +#define PEM_write_SSL_SESSION(fp,x) \ + PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_X509(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ + NULL,NULL,0,NULL,NULL) +#define PEM_write_X509_CRL(fp,x) \ + PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ + fp,(char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ + (char *)x,enc,kstr,klen,cb,u) +#define PEM_write_RSAPublicKey(fp,x) \ + PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ + PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL) +#define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ + (char *)x,enc,kstr,klen,cb,u) +#define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_PKCS7(fp,x) \ + PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_DHparams(fp,x) \ + PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ + (char *)x,NULL,NULL,0,NULL,NULL) + +#define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \ + PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ + PEM_STRING_X509,fp, \ + (char *)x, NULL,NULL,0,NULL,NULL) + +#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u) +#define PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \ + (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u) +#define PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u) +#define PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u) +#define PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u) +#define PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u) +#define PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u) +#define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u) +#define PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u) +#define PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u) + +#define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \ + (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \ + (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\ + (char **)x,cb,u) + +#define PEM_write_bio_X509(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ + (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ + NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_X509_CRL(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ + bp,(char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_bio_RSAPublicKey(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ + PEM_STRING_RSA_PUBLIC,\ + bp,(char *)x,NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ + PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ + (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ + bp,(char *)x,enc,kstr,klen,cb,u) +#define PEM_write_bio_PKCS7(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ + (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_DHparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ + bp,(char *)x,NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_DSAparams(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ + PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL) + +#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \ + PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ + PEM_STRING_X509,bp, \ + (char *)x, NULL,NULL,0,NULL,NULL) + +#define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u) +#define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u) +#define PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u) +#define PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u) +#define PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u) +#define PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u) +#define PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u) + +#define PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u) +#define PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u) +#define PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u) + +#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \ + (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\ + (char **)x,cb,u) + +#endif + +#if 1 +/* "userdata": new with OpenSSL 0.9.4 */ +typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); +#else +/* OpenSSL 0.9.3, 0.9.3a */ +typedef int pem_password_cb(char *buf, int size, int rwflag); +#endif + +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, + pem_password_cb *callback,void *u); + +#ifndef OPENSSL_NO_BIO +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data, + long len); +int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, + pem_password_cb *cb, void *u); +void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, + void **x, pem_password_cb *cb, void *u); + +#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \ + ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \ + name, bp, \ + CHECKED_PPTR_OF(type, x), \ + cb, u)) + +int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x, + const EVP_CIPHER *enc,unsigned char *kstr,int klen, + pem_password_cb *cb, void *u); + +#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \ + (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \ + name, bp, \ + CHECKED_PTR_OF(type, x), \ + enc, kstr, klen, cb, u)) + +STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); +int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, + unsigned char *kstr, int klen, pem_password_cb *cd, void *u); +#endif + +#ifndef OPENSSL_SYS_WIN16 +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data,long *len); +int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); +void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, + char *x,const EVP_CIPHER *enc,unsigned char *kstr, + int klen,pem_password_cb *callback, void *u); +STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +#endif + +int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, + EVP_MD *md_type, unsigned char **ek, int *ekl, + unsigned char *iv, EVP_PKEY **pubk, int npubk); +void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl, + unsigned char *in, int inl); +int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl, + unsigned char *out, int *outl, EVP_PKEY *priv); + +void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +int PEM_def_callback(char *buf, int num, int w, void *key); +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, const char *type, int len, char *str); + +#ifndef SSLEAY_MACROS + +#include + +DECLARE_PEM_rw(X509, X509) + +DECLARE_PEM_rw(X509_AUX, X509) + +DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR) + +DECLARE_PEM_rw(X509_REQ, X509_REQ) +DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) + +DECLARE_PEM_rw(X509_CRL, X509_CRL) + +DECLARE_PEM_rw(PKCS7, PKCS7) + +DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) + +DECLARE_PEM_rw(PKCS8, X509_SIG) + +DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) + +#ifndef OPENSSL_NO_RSA + +DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) + +DECLARE_PEM_rw_const(RSAPublicKey, RSA) +DECLARE_PEM_rw(RSA_PUBKEY, RSA) + +#endif + +#ifndef OPENSSL_NO_DSA + +DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) + +DECLARE_PEM_rw(DSA_PUBKEY, DSA) + +DECLARE_PEM_rw_const(DSAparams, DSA) + +#endif + +#ifndef OPENSSL_NO_EC +DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) +DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) +DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) +#endif + +#ifndef OPENSSL_NO_DH + +DECLARE_PEM_rw_const(DHparams, DH) + +#endif + +DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) + +DECLARE_PEM_rw(PUBKEY, EVP_PKEY) + +int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, + char *, int, pem_password_cb *, void *); +int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); + +int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); + +EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u); + +int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, + char *kstr,int klen, pem_password_cb *cd, void *u); + +#endif /* SSLEAY_MACROS */ + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PEM_strings(void); + +/* Error codes for the PEM functions. */ + +/* Function codes. */ +#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 +#define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 +#define PEM_F_DO_PK8PKEY 126 +#define PEM_F_DO_PK8PKEY_FP 125 +#define PEM_F_LOAD_IV 101 +#define PEM_F_PEM_ASN1_READ 102 +#define PEM_F_PEM_ASN1_READ_BIO 103 +#define PEM_F_PEM_ASN1_WRITE 104 +#define PEM_F_PEM_ASN1_WRITE_BIO 105 +#define PEM_F_PEM_DEF_CALLBACK 100 +#define PEM_F_PEM_DO_HEADER 106 +#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 +#define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +#define PEM_F_PEM_PK8PKEY 119 +#define PEM_F_PEM_READ 108 +#define PEM_F_PEM_READ_BIO 109 +#define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 +#define PEM_F_PEM_READ_PRIVATEKEY 124 +#define PEM_F_PEM_SEALFINAL 110 +#define PEM_F_PEM_SEALINIT 111 +#define PEM_F_PEM_SIGNFINAL 112 +#define PEM_F_PEM_WRITE 113 +#define PEM_F_PEM_WRITE_BIO 114 +#define PEM_F_PEM_X509_INFO_READ 115 +#define PEM_F_PEM_X509_INFO_READ_BIO 116 +#define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* Reason codes. */ +#define PEM_R_BAD_BASE64_DECODE 100 +#define PEM_R_BAD_DECRYPT 101 +#define PEM_R_BAD_END_LINE 102 +#define PEM_R_BAD_IV_CHARS 103 +#define PEM_R_BAD_PASSWORD_READ 104 +#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 +#define PEM_R_NOT_DEK_INFO 105 +#define PEM_R_NOT_ENCRYPTED 106 +#define PEM_R_NOT_PROC_TYPE 107 +#define PEM_R_NO_START_LINE 108 +#define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +#define PEM_R_PUBLIC_KEY_NO_RSA 110 +#define PEM_R_READ_KEY 111 +#define PEM_R_SHORT_HEADER 112 +#define PEM_R_UNSUPPORTED_CIPHER 113 +#define PEM_R_UNSUPPORTED_ENCRYPTION 114 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/pem2.h b/externals/openssl/pem2.h new file mode 100644 index 0000000..893030e --- /dev/null +++ b/externals/openssl/pem2.h @@ -0,0 +1,71 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +/* + * This header only exists to break a circular dependency between pem and err + * Ben 30 Jan 1999. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HEADER_PEM_H +void ERR_load_PEM_strings(void); +#endif + +#ifdef __cplusplus +} +#endif + diff --git a/externals/openssl/pkcs12.h b/externals/openssl/pkcs12.h new file mode 100644 index 0000000..4bee605 --- /dev/null +++ b/externals/openssl/pkcs12.h @@ -0,0 +1,333 @@ +/* pkcs12.h */ +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_PKCS12_H +#define HEADER_PKCS12_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define PKCS12_KEY_ID 1 +#define PKCS12_IV_ID 2 +#define PKCS12_MAC_ID 3 + +/* Default iteration count */ +#ifndef PKCS12_DEFAULT_ITER +#define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER +#endif + +#define PKCS12_MAC_KEY_LENGTH 20 + +#define PKCS12_SALT_LEN 8 + +/* Uncomment out next line for unicode password and names, otherwise ASCII */ + +/*#define PBE_UNICODE*/ + +#ifdef PBE_UNICODE +#define PKCS12_key_gen PKCS12_key_gen_uni +#define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni +#else +#define PKCS12_key_gen PKCS12_key_gen_asc +#define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc +#endif + +/* MS key usage constants */ + +#define KEY_EX 0x10 +#define KEY_SIG 0x80 + +typedef struct { +X509_SIG *dinfo; +ASN1_OCTET_STRING *salt; +ASN1_INTEGER *iter; /* defaults to 1 */ +} PKCS12_MAC_DATA; + +typedef struct { +ASN1_INTEGER *version; +PKCS12_MAC_DATA *mac; +PKCS7 *authsafes; +} PKCS12; + +PREDECLARE_STACK_OF(PKCS12_SAFEBAG) + +typedef struct { +ASN1_OBJECT *type; +union { + struct pkcs12_bag_st *bag; /* secret, crl and certbag */ + struct pkcs8_priv_key_info_st *keybag; /* keybag */ + X509_SIG *shkeybag; /* shrouded key bag */ + STACK_OF(PKCS12_SAFEBAG) *safes; + ASN1_TYPE *other; +}value; +STACK_OF(X509_ATTRIBUTE) *attrib; +} PKCS12_SAFEBAG; + +DECLARE_STACK_OF(PKCS12_SAFEBAG) +DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG) +DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) + +typedef struct pkcs12_bag_st { +ASN1_OBJECT *type; +union { + ASN1_OCTET_STRING *x509cert; + ASN1_OCTET_STRING *x509crl; + ASN1_OCTET_STRING *octet; + ASN1_IA5STRING *sdsicert; + ASN1_TYPE *other; /* Secret or other bag */ +}value; +} PKCS12_BAGS; + +#define PKCS12_ERROR 0 +#define PKCS12_OK 1 + +/* Compatibility macros */ + +#define M_PKCS12_x5092certbag PKCS12_x5092certbag +#define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag + +#define M_PKCS12_certbag2x509 PKCS12_certbag2x509 +#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl + +#define M_PKCS12_unpack_p7data PKCS12_unpack_p7data +#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes +#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes +#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata + +#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey +#define M_PKCS8_decrypt PKCS8_decrypt + +#define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type) +#define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type) +#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type + +#define PKCS12_get_attr(bag, attr_nid) \ + PKCS12_get_attr_gen(bag->attrib, attr_nid) + +#define PKCS8_get_attr(p8, attr_nid) \ + PKCS12_get_attr_gen(p8->attributes, attr_nid) + +#define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0) + + +PKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509); +PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl); +X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag); +X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag); + +PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1, + int nid2); +PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8); +PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen); +PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass, + int passlen); +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8); +PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass, + int passlen, unsigned char *salt, + int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8); +PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); +PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + STACK_OF(PKCS12_SAFEBAG) *bags); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen); + +int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); +STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12); + +int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen); +int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name, + int namelen); +int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); +ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid); +char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); +unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, + int passlen, unsigned char *in, int inlen, + unsigned char **data, int *datalen, int en_de); +void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf); +ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, + void *obj, int zbuf); +PKCS12 *PKCS12_init(int mode); +int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type); +int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type, + int en_de); +int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *mac, unsigned int *maclen); +int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); +int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + const EVP_MD *md_type); +int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, + int saltlen, const EVP_MD *md_type); +unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen); +char *uni2asc(unsigned char *uni, int unilen); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + +DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) +DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) + +void PKCS12_PBE_add(void); +int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, + STACK_OF(X509) **ca); +PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, + STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter, + int mac_iter, int keytype); + +PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); +PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key, + int key_usage, int iter, + int key_nid, char *pass); +int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, + int safe_nid, int iter, char *pass); +PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); + +int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); +int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); +PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); +PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); +int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PKCS12_strings(void); + +/* Error codes for the PKCS12 functions. */ + +/* Function codes. */ +#define PKCS12_F_PARSE_BAG 129 +#define PKCS12_F_PARSE_BAGS 103 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102 +#define PKCS12_F_PKCS12_ADD_LOCALKEYID 104 +#define PKCS12_F_PKCS12_CREATE 105 +#define PKCS12_F_PKCS12_GEN_MAC 107 +#define PKCS12_F_PKCS12_INIT 109 +#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 +#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 +#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 +#define PKCS12_F_PKCS12_KEY_GEN_ASC 110 +#define PKCS12_F_PKCS12_KEY_GEN_UNI 111 +#define PKCS12_F_PKCS12_MAKE_KEYBAG 112 +#define PKCS12_F_PKCS12_MAKE_SHKEYBAG 113 +#define PKCS12_F_PKCS12_NEWPASS 128 +#define PKCS12_F_PKCS12_PACK_P7DATA 114 +#define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 +#define PKCS12_F_PKCS12_PARSE 118 +#define PKCS12_F_PKCS12_PBE_CRYPT 119 +#define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 +#define PKCS12_F_PKCS12_SETUP_MAC 122 +#define PKCS12_F_PKCS12_SET_MAC 123 +#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 +#define PKCS12_F_PKCS12_UNPACK_P7DATA 131 +#define PKCS12_F_PKCS12_VERIFY_MAC 126 +#define PKCS12_F_PKCS8_ADD_KEYUSAGE 124 +#define PKCS12_F_PKCS8_ENCRYPT 125 + +/* Reason codes. */ +#define PKCS12_R_CANT_PACK_STRUCTURE 100 +#define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 +#define PKCS12_R_DECODE_ERROR 101 +#define PKCS12_R_ENCODE_ERROR 102 +#define PKCS12_R_ENCRYPT_ERROR 103 +#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 +#define PKCS12_R_INVALID_NULL_ARGUMENT 104 +#define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 +#define PKCS12_R_IV_GEN_ERROR 106 +#define PKCS12_R_KEY_GEN_ERROR 107 +#define PKCS12_R_MAC_ABSENT 108 +#define PKCS12_R_MAC_GENERATION_ERROR 109 +#define PKCS12_R_MAC_SETUP_ERROR 110 +#define PKCS12_R_MAC_STRING_SET_ERROR 111 +#define PKCS12_R_MAC_VERIFY_ERROR 112 +#define PKCS12_R_MAC_VERIFY_FAILURE 113 +#define PKCS12_R_PARSE_ERROR 114 +#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 +#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 +#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 +#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 +#define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/pkcs7.h b/externals/openssl/pkcs7.h new file mode 100644 index 0000000..457cfdd --- /dev/null +++ b/externals/openssl/pkcs7.h @@ -0,0 +1,465 @@ +/* crypto/pkcs7/pkcs7.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_PKCS7_H +#define HEADER_PKCS7_H + +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_SYS_WIN32 +/* Under Win32 thes are defined in wincrypt.h */ +#undef PKCS7_ISSUER_AND_SERIAL +#undef PKCS7_SIGNER_INFO +#endif + +/* +Encryption_ID DES-CBC +Digest_ID MD5 +Digest_Encryption_ID rsaEncryption +Key_Encryption_ID rsaEncryption +*/ + +typedef struct pkcs7_issuer_and_serial_st + { + X509_NAME *issuer; + ASN1_INTEGER *serial; + } PKCS7_ISSUER_AND_SERIAL; + +typedef struct pkcs7_signer_info_st + { + ASN1_INTEGER *version; /* version 1 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *digest_alg; + STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ + X509_ALGOR *digest_enc_alg; + ASN1_OCTET_STRING *enc_digest; + STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ + + /* The private key to sign with */ + EVP_PKEY *pkey; + } PKCS7_SIGNER_INFO; + +DECLARE_STACK_OF(PKCS7_SIGNER_INFO) +DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) + +typedef struct pkcs7_recip_info_st + { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *key_enc_algor; + ASN1_OCTET_STRING *enc_key; + X509 *cert; /* get the pub-key from this */ + } PKCS7_RECIP_INFO; + +DECLARE_STACK_OF(PKCS7_RECIP_INFO) +DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) + +typedef struct pkcs7_signed_st + { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + + struct pkcs7_st *contents; + } PKCS7_SIGNED; +/* The above structure is very very similar to PKCS7_SIGN_ENVELOPE. + * How about merging the two */ + +typedef struct pkcs7_enc_content_st + { + ASN1_OBJECT *content_type; + X509_ALGOR *algorithm; + ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ + const EVP_CIPHER *cipher; + } PKCS7_ENC_CONTENT; + +typedef struct pkcs7_enveloped_st + { + ASN1_INTEGER *version; /* version 0 */ + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + PKCS7_ENC_CONTENT *enc_data; + } PKCS7_ENVELOPE; + +typedef struct pkcs7_signedandenveloped_st + { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + + PKCS7_ENC_CONTENT *enc_data; + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + } PKCS7_SIGN_ENVELOPE; + +typedef struct pkcs7_digest_st + { + ASN1_INTEGER *version; /* version 0 */ + X509_ALGOR *md; /* md used */ + struct pkcs7_st *contents; + ASN1_OCTET_STRING *digest; + } PKCS7_DIGEST; + +typedef struct pkcs7_encrypted_st + { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ENC_CONTENT *enc_data; + } PKCS7_ENCRYPT; + +typedef struct pkcs7_st + { + /* The following is non NULL if it contains ASN1 encoding of + * this structure */ + unsigned char *asn1; + long length; + +#define PKCS7_S_HEADER 0 +#define PKCS7_S_BODY 1 +#define PKCS7_S_TAIL 2 + int state; /* used during processing */ + + int detached; + + ASN1_OBJECT *type; + /* content as defined by the type */ + /* all encryption/message digests are applied to the 'contents', + * leaving out the 'type' field. */ + union { + char *ptr; + + /* NID_pkcs7_data */ + ASN1_OCTET_STRING *data; + + /* NID_pkcs7_signed */ + PKCS7_SIGNED *sign; + + /* NID_pkcs7_enveloped */ + PKCS7_ENVELOPE *enveloped; + + /* NID_pkcs7_signedAndEnveloped */ + PKCS7_SIGN_ENVELOPE *signed_and_enveloped; + + /* NID_pkcs7_digest */ + PKCS7_DIGEST *digest; + + /* NID_pkcs7_encrypted */ + PKCS7_ENCRYPT *encrypted; + + /* Anything else */ + ASN1_TYPE *other; + } d; + } PKCS7; + +DECLARE_STACK_OF(PKCS7) +DECLARE_ASN1_SET_OF(PKCS7) +DECLARE_PKCS12_STACK_OF(PKCS7) + +#define PKCS7_OP_SET_DETACHED_SIGNATURE 1 +#define PKCS7_OP_GET_DETACHED_SIGNATURE 2 + +#define PKCS7_get_signed_attributes(si) ((si)->auth_attr) +#define PKCS7_get_attributes(si) ((si)->unauth_attr) + +#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) +#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) +#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) +#define PKCS7_type_is_signedAndEnveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) +#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) + +#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) + +#define PKCS7_set_detached(p,v) \ + PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) +#define PKCS7_get_detached(p) \ + PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) + +#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) + +#ifdef SSLEAY_MACROS +#ifndef PKCS7_ISSUER_AND_SERIAL_digest +#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ + (char *)data,md,len) +#endif +#endif + +/* S/MIME related flags */ + +#define PKCS7_TEXT 0x1 +#define PKCS7_NOCERTS 0x2 +#define PKCS7_NOSIGS 0x4 +#define PKCS7_NOCHAIN 0x8 +#define PKCS7_NOINTERN 0x10 +#define PKCS7_NOVERIFY 0x20 +#define PKCS7_DETACHED 0x40 +#define PKCS7_BINARY 0x80 +#define PKCS7_NOATTR 0x100 +#define PKCS7_NOSMIMECAP 0x200 +#define PKCS7_NOOLDMIMETYPE 0x400 +#define PKCS7_CRLFEOL 0x800 +#define PKCS7_STREAM 0x1000 +#define PKCS7_NOCRL 0x2000 + +/* Flags: for compatibility with older code */ + +#define SMIME_TEXT PKCS7_TEXT +#define SMIME_NOCERTS PKCS7_NOCERTS +#define SMIME_NOSIGS PKCS7_NOSIGS +#define SMIME_NOCHAIN PKCS7_NOCHAIN +#define SMIME_NOINTERN PKCS7_NOINTERN +#define SMIME_NOVERIFY PKCS7_NOVERIFY +#define SMIME_DETACHED PKCS7_DETACHED +#define SMIME_BINARY PKCS7_BINARY +#define SMIME_NOATTR PKCS7_NOATTR + +DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) + +#ifndef SSLEAY_MACROS +int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type, + unsigned char *md,unsigned int *len); +#ifndef OPENSSL_NO_FP_API +PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7); +int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7); +#endif +PKCS7 *PKCS7_dup(PKCS7 *p7); +PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7); +int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7); +#endif + +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) +DECLARE_ASN1_FUNCTIONS(PKCS7) + +DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) +DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) + +DECLARE_ASN1_NDEF_FUNCTION(PKCS7) + +long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); + +int PKCS7_set_type(PKCS7 *p7, int type); +int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); +int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); +int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, + const EVP_MD *dgst); +int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); +int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); +int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); +int PKCS7_content_new(PKCS7 *p7, int nid); +int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, + BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, + X509 *x509); + +BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); +int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); +BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); + + +PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, + EVP_PKEY *pkey, const EVP_MD *dgst); +X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); +STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); + +PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); +int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); +int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); +int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); + +PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); +ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type, + void *data); +int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, + void *value); +ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); +ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); +int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk); + + +PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags); +int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, + BIO *indata, BIO *out, int flags); +STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags); +PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, + int flags); +int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags); + +int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, + STACK_OF(X509_ALGOR) *cap); +STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); +int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); + +int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); +PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); +int SMIME_crlf_copy(BIO *in, BIO *out, int flags); +int SMIME_text(BIO *in, BIO *out); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_PKCS7_strings(void); + +/* Error codes for the PKCS7 functions. */ + +/* Function codes. */ +#define PKCS7_F_B64_READ_PKCS7 120 +#define PKCS7_F_B64_WRITE_PKCS7 121 +#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 +#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +#define PKCS7_F_PKCS7_ADD_CRL 101 +#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +#define PKCS7_F_PKCS7_ADD_SIGNER 103 +#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 +#define PKCS7_F_PKCS7_CTRL 104 +#define PKCS7_F_PKCS7_DATADECODE 112 +#define PKCS7_F_PKCS7_DATAFINAL 128 +#define PKCS7_F_PKCS7_DATAINIT 105 +#define PKCS7_F_PKCS7_DATASIGN 106 +#define PKCS7_F_PKCS7_DATAVERIFY 107 +#define PKCS7_F_PKCS7_DECRYPT 114 +#define PKCS7_F_PKCS7_ENCRYPT 115 +#define PKCS7_F_PKCS7_FIND_DIGEST 127 +#define PKCS7_F_PKCS7_GET0_SIGNERS 124 +#define PKCS7_F_PKCS7_SET_CIPHER 108 +#define PKCS7_F_PKCS7_SET_CONTENT 109 +#define PKCS7_F_PKCS7_SET_DIGEST 126 +#define PKCS7_F_PKCS7_SET_TYPE 110 +#define PKCS7_F_PKCS7_SIGN 116 +#define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 +#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 +#define PKCS7_F_PKCS7_VERIFY 117 +#define PKCS7_F_SMIME_READ_PKCS7 122 +#define PKCS7_F_SMIME_TEXT 123 + +/* Reason codes. */ +#define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 +#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 +#define PKCS7_R_CIPHER_NOT_INITIALIZED 116 +#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 +#define PKCS7_R_DECODE_ERROR 130 +#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100 +#define PKCS7_R_DECRYPT_ERROR 119 +#define PKCS7_R_DIGEST_FAILURE 101 +#define PKCS7_R_ERROR_ADDING_RECIPIENT 120 +#define PKCS7_R_ERROR_SETTING_CIPHER 121 +#define PKCS7_R_INVALID_MIME_TYPE 131 +#define PKCS7_R_INVALID_NULL_POINTER 143 +#define PKCS7_R_MIME_NO_CONTENT_TYPE 132 +#define PKCS7_R_MIME_PARSE_ERROR 133 +#define PKCS7_R_MIME_SIG_PARSE_ERROR 134 +#define PKCS7_R_MISSING_CERIPEND_INFO 103 +#define PKCS7_R_NO_CONTENT 122 +#define PKCS7_R_NO_CONTENT_TYPE 135 +#define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136 +#define PKCS7_R_NO_MULTIPART_BOUNDARY 137 +#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 +#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY 146 +#define PKCS7_R_NO_SIGNATURES_ON_DATA 123 +#define PKCS7_R_NO_SIGNERS 142 +#define PKCS7_R_NO_SIG_CONTENT_TYPE 138 +#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 +#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 +#define PKCS7_R_PKCS7_DATAFINAL 126 +#define PKCS7_R_PKCS7_DATAFINAL_ERROR 125 +#define PKCS7_R_PKCS7_DATASIGN 145 +#define PKCS7_R_PKCS7_PARSE_ERROR 139 +#define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140 +#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 +#define PKCS7_R_SIGNATURE_FAILURE 105 +#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 +#define PKCS7_R_SIG_INVALID_MIME_TYPE 141 +#define PKCS7_R_SMIME_TEXT_ERROR 129 +#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 +#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 +#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 +#define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 +#define PKCS7_R_UNKNOWN_OPERATION 110 +#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 +#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 +#define PKCS7_R_WRONG_CONTENT_TYPE 113 +#define PKCS7_R_WRONG_PKCS7_TYPE 114 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/pq_compat.h b/externals/openssl/pq_compat.h new file mode 100644 index 0000000..7b2c327 --- /dev/null +++ b/externals/openssl/pq_compat.h @@ -0,0 +1,152 @@ +/* crypto/pqueue/pqueue_compat.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_PQ_COMPAT_H +#define HEADER_PQ_COMPAT_H + +#include +#include + +/* + * The purpose of this header file is for supporting 64-bit integer + * manipulation on 32-bit (and lower) machines. Currently the only + * such environment is VMS, Utrix and those with smaller default integer + * sizes than 32 bits. For all such environment, we fall back to using + * BIGNUM. We may need to fine tune the conditions for systems that + * are incorrectly configured. + * + * The only clients of this code are (1) pqueue for priority, and + * (2) DTLS, for sequence number manipulation. + */ + +#if (defined(THIRTY_TWO_BIT) && !defined(BN_LLONG)) || defined(SIXTEEN_BIT) || defined(EIGHT_BIT) + +#define PQ_64BIT_IS_INTEGER 0 +#define PQ_64BIT_IS_BIGNUM 1 + +#define PQ_64BIT BIGNUM +#define PQ_64BIT_CTX BN_CTX + +#define pq_64bit_init(x) BN_init(x) +#define pq_64bit_free(x) BN_free(x) + +#define pq_64bit_ctx_new(ctx) BN_CTX_new() +#define pq_64bit_ctx_free(x) BN_CTX_free(x) + +#define pq_64bit_assign(x, y) BN_copy(x, y) +#define pq_64bit_assign_word(x, y) BN_set_word(x, y) +#define pq_64bit_gt(x, y) BN_ucmp(x, y) >= 1 ? 1 : 0 +#define pq_64bit_eq(x, y) BN_ucmp(x, y) == 0 ? 1 : 0 +#define pq_64bit_add_word(x, w) BN_add_word(x, w) +#define pq_64bit_sub(r, x, y) BN_sub(r, x, y) +#define pq_64bit_sub_word(x, w) BN_sub_word(x, w) +#define pq_64bit_mod(r, x, n, ctx) BN_mod(r, x, n, ctx) + +#define pq_64bit_bin2num(bn, bytes, len) BN_bin2bn(bytes, len, bn) +#define pq_64bit_num2bin(bn, bytes) BN_bn2bin(bn, bytes) +#define pq_64bit_get_word(x) BN_get_word(x) +#define pq_64bit_is_bit_set(x, offset) BN_is_bit_set(x, offset) +#define pq_64bit_lshift(r, x, shift) BN_lshift(r, x, shift) +#define pq_64bit_set_bit(x, num) BN_set_bit(x, num) +#define pq_64bit_get_length(x) BN_num_bits((x)) + +#else + +#define PQ_64BIT_IS_INTEGER 1 +#define PQ_64BIT_IS_BIGNUM 0 + +#if defined(SIXTY_FOUR_BIT) +#define PQ_64BIT BN_ULONG +#define PQ_64BIT_PRINT "%lld" +#elif defined(SIXTY_FOUR_BIT_LONG) +#define PQ_64BIT BN_ULONG +#define PQ_64BIT_PRINT "%ld" +#elif defined(THIRTY_TWO_BIT) +#define PQ_64BIT BN_ULLONG +#define PQ_64BIT_PRINT "%lld" +#endif + +#define PQ_64BIT_CTX void + +#define pq_64bit_init(x) +#define pq_64bit_free(x) +#define pq_64bit_ctx_new(ctx) (ctx) +#define pq_64bit_ctx_free(x) + +#define pq_64bit_assign(x, y) (*(x) = *(y)) +#define pq_64bit_assign_word(x, y) (*(x) = y) +#define pq_64bit_gt(x, y) (*(x) > *(y)) +#define pq_64bit_eq(x, y) (*(x) == *(y)) +#define pq_64bit_add_word(x, w) (*(x) = (*(x) + (w))) +#define pq_64bit_sub(r, x, y) (*(r) = (*(x) - *(y))) +#define pq_64bit_sub_word(x, w) (*(x) = (*(x) - (w))) +#define pq_64bit_mod(r, x, n, ctx) + +#define pq_64bit_bin2num(num, bytes, len) bytes_to_long_long(bytes, num) +#define pq_64bit_num2bin(num, bytes) long_long_to_bytes(num, bytes) +#define pq_64bit_get_word(x) *(x) +#define pq_64bit_lshift(r, x, shift) (*(r) = (*(x) << (shift))) +#define pq_64bit_set_bit(x, num) do { \ + PQ_64BIT mask = 1; \ + mask = mask << (num); \ + *(x) |= mask; \ + } while(0) +#endif /* OPENSSL_SYS_VMS */ + +#endif diff --git a/externals/openssl/pqueue.h b/externals/openssl/pqueue.h new file mode 100644 index 0000000..cc6b001 --- /dev/null +++ b/externals/openssl/pqueue.h @@ -0,0 +1,96 @@ +/* crypto/pqueue/pqueue.h */ +/* + * DTLS implementation written by Nagendra Modadugu + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. + */ +/* ==================================================================== + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_PQUEUE_H +#define HEADER_PQUEUE_H + +#include +#include +#include + +#include + +typedef struct _pqueue *pqueue; + +typedef struct _pitem + { + PQ_64BIT priority; + void *data; + struct _pitem *next; + } pitem; + +typedef struct _pitem *piterator; + +pitem *pitem_new(PQ_64BIT priority, void *data); +void pitem_free(pitem *item); + +pqueue pqueue_new(void); +void pqueue_free(pqueue pq); + +pitem *pqueue_insert(pqueue pq, pitem *item); +pitem *pqueue_peek(pqueue pq); +pitem *pqueue_pop(pqueue pq); +pitem *pqueue_find(pqueue pq, PQ_64BIT priority); +pitem *pqueue_iterator(pqueue pq); +pitem *pqueue_next(piterator *iter); + +void pqueue_print(pqueue pq); + +#endif /* ! HEADER_PQUEUE_H */ + diff --git a/externals/openssl/rand.h b/externals/openssl/rand.h new file mode 100644 index 0000000..ea89153 --- /dev/null +++ b/externals/openssl/rand.h @@ -0,0 +1,167 @@ +/* crypto/rand/rand.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RAND_H +#define HEADER_RAND_H + +#include +#include +#include + +#if defined(OPENSSL_SYS_WINDOWS) +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(OPENSSL_FIPS) +#define FIPS_RAND_SIZE_T int +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct rand_meth_st RAND_METHOD; */ + +struct rand_meth_st + { + void (*seed)(const void *buf, int num); + int (*bytes)(unsigned char *buf, int num); + void (*cleanup)(void); + void (*add)(const void *buf, int num, double entropy); + int (*pseudorand)(unsigned char *buf, int num); + int (*status)(void); + }; + +#ifdef BN_DEBUG +extern int rand_predictable; +#endif + +int RAND_set_rand_method(const RAND_METHOD *meth); +const RAND_METHOD *RAND_get_rand_method(void); +#ifndef OPENSSL_NO_ENGINE +int RAND_set_rand_engine(ENGINE *engine); +#endif +RAND_METHOD *RAND_SSLeay(void); +void RAND_cleanup(void ); +int RAND_bytes(unsigned char *buf,int num); +int RAND_pseudo_bytes(unsigned char *buf,int num); +void RAND_seed(const void *buf,int num); +void RAND_add(const void *buf,int num,double entropy); +int RAND_load_file(const char *file,long max_bytes); +int RAND_write_file(const char *file); +const char *RAND_file_name(char *file,size_t num); +int RAND_status(void); +int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); +int RAND_egd(const char *path); +int RAND_egd_bytes(const char *path,int bytes); +int RAND_poll(void); +#ifndef OPENSSL_NO_ENGINE +#ifdef OPENSSL_FIPS +void int_RAND_init_engine_callbacks(void); +void int_RAND_set_callbacks( + int (*set_rand_func)(const RAND_METHOD *meth, + const RAND_METHOD **pmeth), + const RAND_METHOD *(*get_rand_func)(const RAND_METHOD **pmeth)); +#endif +#endif + +#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) + +void RAND_screen(void); +int RAND_event(UINT, WPARAM, LPARAM); + +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_RAND_strings(void); + +/* Error codes for the RAND functions. */ + +/* Function codes. */ +#define RAND_F_ENG_RAND_GET_RAND_METHOD 108 +#define RAND_F_FIPS_RAND 103 +#define RAND_F_FIPS_RAND_BYTES 102 +#define RAND_F_FIPS_RAND_GET_RAND_METHOD 109 +#define RAND_F_FIPS_RAND_SET_DT 106 +#define RAND_F_FIPS_SET_DT 104 +#define RAND_F_FIPS_SET_PRNG_SEED 107 +#define RAND_F_FIPS_SET_TEST_MODE 105 +#define RAND_F_RAND_GET_RAND_METHOD 101 +#define RAND_F_SSLEAY_RAND_BYTES 100 + +/* Reason codes. */ +#define RAND_R_NON_FIPS_METHOD 105 +#define RAND_R_NOT_IN_TEST_MODE 106 +#define RAND_R_NO_KEY_SET 107 +#define RAND_R_PRNG_ASKING_FOR_TOO_MUCH 101 +#define RAND_R_PRNG_ERROR 108 +#define RAND_R_PRNG_KEYED 109 +#define RAND_R_PRNG_NOT_REKEYED 102 +#define RAND_R_PRNG_NOT_RESEEDED 103 +#define RAND_R_PRNG_NOT_SEEDED 100 +#define RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY 110 +#define RAND_R_PRNG_STUCK 104 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/rc2.h b/externals/openssl/rc2.h new file mode 100644 index 0000000..e542ec9 --- /dev/null +++ b/externals/openssl/rc2.h @@ -0,0 +1,103 @@ +/* crypto/rc2/rc2.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RC2_H +#define HEADER_RC2_H + +#include /* OPENSSL_NO_RC2, RC2_INT */ +#ifdef OPENSSL_NO_RC2 +#error RC2 is disabled. +#endif + +#define RC2_ENCRYPT 1 +#define RC2_DECRYPT 0 + +#define RC2_BLOCK 8 +#define RC2_KEY_LENGTH 16 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rc2_key_st + { + RC2_INT data[64]; + } RC2_KEY; + +#ifdef OPENSSL_FIPS +void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); +#endif +void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); +void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, + int enc); +void RC2_encrypt(unsigned long *data,RC2_KEY *key); +void RC2_decrypt(unsigned long *data,RC2_KEY *key); +void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, int enc); +void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num, int enc); +void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/rc4.h b/externals/openssl/rc4.h new file mode 100644 index 0000000..2d8620d --- /dev/null +++ b/externals/openssl/rc4.h @@ -0,0 +1,90 @@ +/* crypto/rc4/rc4.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RC4_H +#define HEADER_RC4_H + +#include /* OPENSSL_NO_RC4, RC4_INT */ +#ifdef OPENSSL_NO_RC4 +#error RC4 is disabled. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rc4_key_st + { + RC4_INT x,y; + RC4_INT data[256]; + } RC4_KEY; + + +const char *RC4_options(void); +#ifdef OPENSSL_FIPS +void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); +#endif +void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); +void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, + unsigned char *outdata); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/ripemd.h b/externals/openssl/ripemd.h new file mode 100644 index 0000000..3b6d043 --- /dev/null +++ b/externals/openssl/ripemd.h @@ -0,0 +1,106 @@ +/* crypto/ripemd/ripemd.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RIPEMD_H +#define HEADER_RIPEMD_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_RIPEMD +#error RIPEMD is disabled. +#endif + +#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) +#define RIPEMD160_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define RIPEMD160_LONG unsigned long +#define RIPEMD160_LONG_LOG2 3 +#else +#define RIPEMD160_LONG unsigned int +#endif + +#define RIPEMD160_CBLOCK 64 +#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) +#define RIPEMD160_DIGEST_LENGTH 20 + +typedef struct RIPEMD160state_st + { + RIPEMD160_LONG A,B,C,D,E; + RIPEMD160_LONG Nl,Nh; + RIPEMD160_LONG data[RIPEMD160_LBLOCK]; + unsigned int num; + } RIPEMD160_CTX; +#ifdef OPENSSL_FIPS +int private_RIPEMD160_Init(RIPEMD160_CTX *c); +#endif +int RIPEMD160_Init(RIPEMD160_CTX *c); +int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); +int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); +unsigned char *RIPEMD160(const unsigned char *d, size_t n, + unsigned char *md); +void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/rsa.h b/externals/openssl/rsa.h new file mode 100644 index 0000000..5bb932a --- /dev/null +++ b/externals/openssl/rsa.h @@ -0,0 +1,496 @@ +/* crypto/rsa/rsa.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_RSA_H +#define HEADER_RSA_H + +#include + +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif + +#ifdef OPENSSL_NO_RSA +#error RSA is disabled. +#endif + +/* If this flag is set the RSA method is FIPS compliant and can be used + * in FIPS mode. This is set in the validated module method. If an + * application sets this flag in its own methods it is its reposibility + * to ensure the result is compliant. + */ + +#define RSA_FLAG_FIPS_METHOD 0x0400 + +/* If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +#define RSA_FLAG_NON_FIPS_ALLOW 0x0400 + +#ifdef OPENSSL_FIPS +#define FIPS_RSA_SIZE_T int +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Declared already in ossl_typ.h */ +/* typedef struct rsa_st RSA; */ +/* typedef struct rsa_meth_st RSA_METHOD; */ + +struct rsa_meth_st + { + const char *name; + int (*rsa_pub_enc)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_pub_dec)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_priv_enc)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_priv_dec)(int flen,const unsigned char *from, + unsigned char *to, + RSA *rsa,int padding); + int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */ + int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *m_ctx); /* Can be null */ + int (*init)(RSA *rsa); /* called at new */ + int (*finish)(RSA *rsa); /* called at free */ + int flags; /* RSA_METHOD_FLAG_* things */ + char *app_data; /* may be needed! */ +/* New sign and verify functions: some libraries don't allow arbitrary data + * to be signed/verified: this allows them to be used. Note: for this to work + * the RSA_public_decrypt() and RSA_private_encrypt() should *NOT* be used + * RSA_sign(), RSA_verify() should be used instead. Note: for backwards + * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER + * option is set in 'flags'. + */ + int (*rsa_sign)(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, const RSA *rsa); + int (*rsa_verify)(int dtype, + const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, const RSA *rsa); +/* If this callback is NULL, the builtin software RSA key-gen will be used. This + * is for behavioural compatibility whilst the code gets rewired, but one day + * it would be nice to assume there are no such things as "builtin software" + * implementations. */ + int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); + }; + +struct rsa_st + { + /* The first parameter is used to pickup errors where + * this is passed instead of aEVP_PKEY, it is set to 0 */ + int pad; + long version; + const RSA_METHOD *meth; + /* functional reference if 'meth' is ENGINE-provided */ + ENGINE *engine; + BIGNUM *n; + BIGNUM *e; + BIGNUM *d; + BIGNUM *p; + BIGNUM *q; + BIGNUM *dmp1; + BIGNUM *dmq1; + BIGNUM *iqmp; + /* be careful using this if the RSA structure is shared */ + CRYPTO_EX_DATA ex_data; + int references; + int flags; + + /* Used to cache montgomery values */ + BN_MONT_CTX *_method_mod_n; + BN_MONT_CTX *_method_mod_p; + BN_MONT_CTX *_method_mod_q; + + /* all BIGNUM values are actually in the following data, if it is not + * NULL */ + char *bignum_data; + BN_BLINDING *blinding; + BN_BLINDING *mt_blinding; + }; + +#ifndef OPENSSL_RSA_MAX_MODULUS_BITS +# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 +#endif + +#define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 + +#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS +# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 +#endif +#ifndef OPENSSL_RSA_MAX_PUBEXP_BITS +# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 /* exponent limit enforced for "large" modulus only */ +#endif + +#define RSA_3 0x3L +#define RSA_F4 0x10001L + +#define RSA_METHOD_FLAG_NO_CHECK 0x0001 /* don't check pub/private match */ + +#define RSA_FLAG_CACHE_PUBLIC 0x0002 +#define RSA_FLAG_CACHE_PRIVATE 0x0004 +#define RSA_FLAG_BLINDING 0x0008 +#define RSA_FLAG_THREAD_SAFE 0x0010 +/* This flag means the private key operations will be handled by rsa_mod_exp + * and that they do not depend on the private key components being present: + * for example a key stored in external hardware. Without this flag bn_mod_exp + * gets called when private key components are absent. + */ +#define RSA_FLAG_EXT_PKEY 0x0020 + +/* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions. + */ +#define RSA_FLAG_SIGN_VER 0x0040 + +#define RSA_FLAG_NO_BLINDING 0x0080 /* new with 0.9.6j and 0.9.7b; the built-in + * RSA implementation now uses blinding by + * default (ignoring RSA_FLAG_BLINDING), + * but other engines might not need it + */ +#define RSA_FLAG_NO_CONSTTIME 0x0100 /* new with 0.9.8f; the built-in RSA + * implementation now uses constant time + * operations by default in private key operations, + * e.g., constant time modular exponentiation, + * modular inverse without leaking branches, + * division without leaking branches. This + * flag disables these constant time + * operations and results in faster RSA + * private key operations. + */ +#ifndef OPENSSL_NO_DEPRECATED +#define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME /* deprecated name for the flag*/ + /* new with 0.9.7h; the built-in RSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ +#endif + + +#define RSA_PKCS1_PADDING 1 +#define RSA_SSLV23_PADDING 2 +#define RSA_NO_PADDING 3 +#define RSA_PKCS1_OAEP_PADDING 4 +#define RSA_X931_PADDING 5 + +#define RSA_PKCS1_PADDING_SIZE 11 + +#define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) +#define RSA_get_app_data(s) RSA_get_ex_data(s,0) + +RSA * RSA_new(void); +RSA * RSA_new_method(ENGINE *engine); +int RSA_size(const RSA *); + +/* Deprecated version */ +#ifndef OPENSSL_NO_DEPRECATED +RSA * RSA_generate_key(int bits, unsigned long e,void + (*callback)(int,int,void *),void *cb_arg); +#endif /* !defined(OPENSSL_NO_DEPRECATED) */ + +/* New version */ +int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); +int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2, + const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp, + const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq, + const BIGNUM *e, BN_GENCB *cb); +int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb); + +int RSA_check_key(const RSA *); + /* next 4 return -1 on error */ +int RSA_public_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +int RSA_private_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +int RSA_public_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +int RSA_private_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa,int padding); +void RSA_free (RSA *r); +/* "up" the RSA object's reference count */ +int RSA_up_ref(RSA *r); + +int RSA_flags(const RSA *r); + +#ifdef OPENSSL_FIPS +RSA *FIPS_rsa_new(void); +void FIPS_rsa_free(RSA *r); +#endif + +void RSA_set_default_method(const RSA_METHOD *meth); +const RSA_METHOD *RSA_get_default_method(void); +const RSA_METHOD *RSA_get_method(const RSA *rsa); +int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); + +/* This function needs the memory locking malloc callbacks to be installed */ +int RSA_memory_lock(RSA *r); + +/* these are the actual SSLeay RSA functions */ +const RSA_METHOD *RSA_PKCS1_SSLeay(void); + +const RSA_METHOD *RSA_null_method(void); + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) + +#ifndef OPENSSL_NO_FP_API +int RSA_print_fp(FILE *fp, const RSA *r,int offset); +#endif + +#ifndef OPENSSL_NO_BIO +int RSA_print(BIO *bp, const RSA *r,int offset); +#endif + +#ifndef OPENSSL_NO_RC4 +int i2d_RSA_NET(const RSA *a, unsigned char **pp, + int (*cb)(char *buf, int len, const char *prompt, int verify), + int sgckey); +RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, + int (*cb)(char *buf, int len, const char *prompt, int verify), + int sgckey); + +int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, + int (*cb)(char *buf, int len, const char *prompt, + int verify)); +RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, + int (*cb)(char *buf, int len, const char *prompt, + int verify)); +#endif + +/* The following 2 functions sign and verify a X509_SIG ASN1 object + * inside PKCS#1 padded RSA encryption */ +int RSA_sign(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, RSA *rsa); +int RSA_verify(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, RSA *rsa); + +/* The following 2 function sign and verify a ASN1_OCTET_STRING + * object inside PKCS#1 padded RSA encryption */ +int RSA_sign_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, RSA *rsa); +int RSA_verify_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, RSA *rsa); + +int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); +void RSA_blinding_off(RSA *rsa); +BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); + +int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int PKCS1_MGF1(unsigned char *mask, long len, + const unsigned char *seed, long seedlen, const EVP_MD *dgst); +int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen, + const unsigned char *f,int fl, + const unsigned char *p,int pl); +int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len, + const unsigned char *p,int pl); +int RSA_padding_add_SSLv23(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_SSLv23(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_padding_add_none(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_none(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_padding_add_X931(unsigned char *to,int tlen, + const unsigned char *f,int fl); +int RSA_padding_check_X931(unsigned char *to,int tlen, + const unsigned char *f,int fl,int rsa_len); +int RSA_X931_hash_id(int nid); + +int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const unsigned char *EM, int sLen); +int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, + const EVP_MD *Hash, int sLen); + +int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int RSA_set_ex_data(RSA *r,int idx,void *arg); +void *RSA_get_ex_data(const RSA *r, int idx); + +RSA *RSAPublicKey_dup(RSA *rsa); +RSA *RSAPrivateKey_dup(RSA *rsa); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_RSA_strings(void); + +/* Error codes for the RSA functions. */ + +/* Function codes. */ +#define RSA_F_FIPS_RSA_SIGN 140 +#define RSA_F_FIPS_RSA_VERIFY 141 +#define RSA_F_MEMORY_LOCK 100 +#define RSA_F_RSA_BUILTIN_KEYGEN 129 +#define RSA_F_RSA_CHECK_KEY 123 +#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 +#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102 +#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103 +#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104 +#define RSA_F_RSA_GENERATE_KEY 105 +#define RSA_F_RSA_MEMORY_LOCK 130 +#define RSA_F_RSA_NEW_METHOD 106 +#define RSA_F_RSA_NULL 124 +#define RSA_F_RSA_NULL_MOD_EXP 131 +#define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 +#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 +#define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 +#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 +#define RSA_F_RSA_PADDING_ADD_NONE 107 +#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 +#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 +#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 +#define RSA_F_RSA_PADDING_ADD_SSLV23 110 +#define RSA_F_RSA_PADDING_ADD_X931 127 +#define RSA_F_RSA_PADDING_CHECK_NONE 111 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 +#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 +#define RSA_F_RSA_PADDING_CHECK_SSLV23 114 +#define RSA_F_RSA_PADDING_CHECK_X931 128 +#define RSA_F_RSA_PRINT 115 +#define RSA_F_RSA_PRINT_FP 116 +#define RSA_F_RSA_PRIVATE_ENCRYPT 137 +#define RSA_F_RSA_PUBLIC_DECRYPT 138 +#define RSA_F_RSA_SETUP_BLINDING 136 +#define RSA_F_RSA_SET_DEFAULT_METHOD 139 +#define RSA_F_RSA_SET_METHOD 142 +#define RSA_F_RSA_SIGN 117 +#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 +#define RSA_F_RSA_VERIFY 119 +#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 +#define RSA_F_RSA_VERIFY_PKCS1_PSS 126 + +/* Reason codes. */ +#define RSA_R_ALGORITHM_MISMATCH 100 +#define RSA_R_BAD_E_VALUE 101 +#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +#define RSA_R_BAD_PAD_BYTE_COUNT 103 +#define RSA_R_BAD_SIGNATURE 104 +#define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +#define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +#define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +#define RSA_R_DATA_TOO_LARGE 109 +#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 +#define RSA_R_DATA_TOO_SMALL 111 +#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 +#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 +#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 +#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 +#define RSA_R_FIRST_OCTET_INVALID 133 +#define RSA_R_INVALID_HEADER 137 +#define RSA_R_INVALID_MESSAGE_LENGTH 131 +#define RSA_R_INVALID_PADDING 138 +#define RSA_R_INVALID_TRAILER 139 +#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 +#define RSA_R_KEY_SIZE_TOO_SMALL 120 +#define RSA_R_LAST_OCTET_INVALID 134 +#define RSA_R_MODULUS_TOO_LARGE 105 +#define RSA_R_NON_FIPS_METHOD 141 +#define RSA_R_NO_PUBLIC_EXPONENT 140 +#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 +#define RSA_R_OAEP_DECODING_ERROR 121 +#define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE 142 +#define RSA_R_PADDING_CHECK_FAILED 114 +#define RSA_R_P_NOT_PRIME 128 +#define RSA_R_Q_NOT_PRIME 129 +#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 +#define RSA_R_SLEN_CHECK_FAILED 136 +#define RSA_R_SLEN_RECOVERY_FAILED 135 +#define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +#define RSA_R_UNKNOWN_PADDING_TYPE 118 +#define RSA_R_WRONG_SIGNATURE_LENGTH 119 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/safestack.h b/externals/openssl/safestack.h new file mode 100644 index 0000000..40b1790 --- /dev/null +++ b/externals/openssl/safestack.h @@ -0,0 +1,2030 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_SAFESTACK_H +#define HEADER_SAFESTACK_H + +#include + +#ifdef DEBUG_SAFESTACK + +#ifndef CHECKED_PTR_OF +#define CHECKED_PTR_OF(type, p) \ + ((void*) (1 ? p : (type*)0)) +#endif + +#define CHECKED_SK_FREE_FUNC(type, p) \ + ((void (*)(void *)) ((1 ? p : (void (*)(type *))0))) + +#define CHECKED_SK_CMP_FUNC(type, p) \ + ((int (*)(const char * const *, const char * const *)) \ + ((1 ? p : (int (*)(const type * const *, const type * const *))0))) + +#define STACK_OF(type) struct stack_st_##type +#define PREDECLARE_STACK_OF(type) STACK_OF(type); + +#define DECLARE_STACK_OF(type) \ +STACK_OF(type) \ + { \ + STACK stack; \ + }; + +#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/ + +/* SKM_sk_... stack macros are internal to safestack.h: + * never use them directly, use sk__... instead */ +#define SKM_sk_new(type, cmp) \ + ((STACK_OF(type) *)sk_new(CHECKED_SK_CMP_FUNC(type, cmp))) +#define SKM_sk_new_null(type) \ + ((STACK_OF(type) *)sk_new_null()) +#define SKM_sk_free(type, st) \ + sk_free(CHECKED_PTR_OF(STACK_OF(type), st)) +#define SKM_sk_num(type, st) \ + sk_num(CHECKED_PTR_OF(STACK_OF(type), st)) +#define SKM_sk_value(type, st,i) \ + ((type *)sk_value(CHECKED_PTR_OF(STACK_OF(type), st), i)) +#define SKM_sk_set(type, st,i,val) \ + sk_set(CHECKED_PTR_OF(STACK_OF(type), st), i, CHECKED_PTR_OF(type, val)) +#define SKM_sk_zero(type, st) \ + sk_zero(CHECKED_PTR_OF(STACK_OF(type), st)) +#define SKM_sk_push(type, st,val) \ + sk_push(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val)) +#define SKM_sk_unshift(type, st,val) \ + sk_unshift(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val)) +#define SKM_sk_find(type, st,val) \ + sk_find(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val)) +#define SKM_sk_delete(type, st,i) \ + (type *)sk_delete(CHECKED_PTR_OF(STACK_OF(type), st), i) +#define SKM_sk_delete_ptr(type, st,ptr) \ + (type *)sk_delete_ptr(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, ptr)) +#define SKM_sk_insert(type, st,val,i) \ + sk_insert(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val), i) +#define SKM_sk_set_cmp_func(type, st,cmp) \ + ((int (*)(const type * const *,const type * const *)) \ + sk_set_cmp_func(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_CMP_FUNC(type, cmp))) +#define SKM_sk_dup(type, st) \ + (STACK_OF(type) *)sk_dup(CHECKED_PTR_OF(STACK_OF(type), st)) +#define SKM_sk_pop_free(type, st,free_func) \ + sk_pop_free(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_FREE_FUNC(type, free_func)) +#define SKM_sk_shift(type, st) \ + (type *)sk_shift(CHECKED_PTR_OF(STACK_OF(type), st)) +#define SKM_sk_pop(type, st) \ + (type *)sk_pop(CHECKED_PTR_OF(STACK_OF(type), st)) +#define SKM_sk_sort(type, st) \ + sk_sort(CHECKED_PTR_OF(STACK_OF(type), st)) +#define SKM_sk_is_sorted(type, st) \ + sk_is_sorted(CHECKED_PTR_OF(STACK_OF(type), st)) + +#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + (STACK_OF(type) *)d2i_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), \ + pp, length, \ + CHECKED_D2I_OF(type, d2i_func), \ + CHECKED_SK_FREE_FUNC(type, free_func), \ + ex_tag, ex_class) + +#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ + i2d_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), pp, \ + CHECKED_I2D_OF(type, i2d_func), \ + ex_tag, ex_class, is_set) + +#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ + ASN1_seq_pack(CHECKED_PTR_OF(STACK_OF(type), st), \ + CHECKED_I2D_OF(type, i2d_func), buf, len) + +#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ + (STACK_OF(type) *)ASN1_seq_unpack(buf, len, CHECKED_D2I_OF(type, d2i_func), CHECKED_SK_FREE_FUNC(type, free_func)) + +#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ + (STACK_OF(type) *)PKCS12_decrypt_d2i(algor, \ + CHECKED_D2I_OF(type, d2i_func), \ + CHECKED_SK_FREE_FUNC(type, free_func), \ + pass, passlen, oct, seq) + +#else + +#define STACK_OF(type) STACK +#define PREDECLARE_STACK_OF(type) /* nada */ +#define DECLARE_STACK_OF(type) /* nada */ +#define IMPLEMENT_STACK_OF(type) /* nada */ + +#define SKM_sk_new(type, cmp) \ + sk_new((int (*)(const char * const *, const char * const *))(cmp)) +#define SKM_sk_new_null(type) \ + sk_new_null() +#define SKM_sk_free(type, st) \ + sk_free(st) +#define SKM_sk_num(type, st) \ + sk_num(st) +#define SKM_sk_value(type, st,i) \ + ((type *)sk_value(st, i)) +#define SKM_sk_set(type, st,i,val) \ + ((type *)sk_set(st, i,(char *)val)) +#define SKM_sk_zero(type, st) \ + sk_zero(st) +#define SKM_sk_push(type, st,val) \ + sk_push(st, (char *)val) +#define SKM_sk_unshift(type, st,val) \ + sk_unshift(st, (char *)val) +#define SKM_sk_find(type, st,val) \ + sk_find(st, (char *)val) +#define SKM_sk_delete(type, st,i) \ + ((type *)sk_delete(st, i)) +#define SKM_sk_delete_ptr(type, st,ptr) \ + ((type *)sk_delete_ptr(st,(char *)ptr)) +#define SKM_sk_insert(type, st,val,i) \ + sk_insert(st, (char *)val, i) +#define SKM_sk_set_cmp_func(type, st,cmp) \ + ((int (*)(const type * const *,const type * const *)) \ + sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp))) +#define SKM_sk_dup(type, st) \ + sk_dup(st) +#define SKM_sk_pop_free(type, st,free_func) \ + sk_pop_free(st, (void (*)(void *))free_func) +#define SKM_sk_shift(type, st) \ + ((type *)sk_shift(st)) +#define SKM_sk_pop(type, st) \ + ((type *)sk_pop(st)) +#define SKM_sk_sort(type, st) \ + sk_sort(st) +#define SKM_sk_is_sorted(type, st) \ + sk_is_sorted(st) + +#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + d2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,long))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class) +#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ + i2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_class,is_set) + +#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ + ASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len) +#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ + ASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d2i_func, (void(*)(void *))free_func) + +#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ + ((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq)) + +#endif + +/* This block of defines is updated by util/mkstack.pl, please do not touch! */ +#define sk_ACCESS_DESCRIPTION_new(st) SKM_sk_new(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION) +#define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_value(st, i) SKM_sk_value(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_set(st, i, val) SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val)) +#define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_find_ex(st, val) SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr)) +#define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i)) +#define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp)) +#define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st) +#define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func)) +#define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st)) + +#define sk_ASIdOrRange_new(st) SKM_sk_new(ASIdOrRange, (st)) +#define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange) +#define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st)) +#define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st)) +#define sk_ASIdOrRange_value(st, i) SKM_sk_value(ASIdOrRange, (st), (i)) +#define sk_ASIdOrRange_set(st, i, val) SKM_sk_set(ASIdOrRange, (st), (i), (val)) +#define sk_ASIdOrRange_zero(st) SKM_sk_zero(ASIdOrRange, (st)) +#define sk_ASIdOrRange_push(st, val) SKM_sk_push(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_unshift(st, val) SKM_sk_unshift(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_find(st, val) SKM_sk_find(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_find_ex(st, val) SKM_sk_find_ex(ASIdOrRange, (st), (val)) +#define sk_ASIdOrRange_delete(st, i) SKM_sk_delete(ASIdOrRange, (st), (i)) +#define sk_ASIdOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASIdOrRange, (st), (ptr)) +#define sk_ASIdOrRange_insert(st, val, i) SKM_sk_insert(ASIdOrRange, (st), (val), (i)) +#define sk_ASIdOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASIdOrRange, (st), (cmp)) +#define sk_ASIdOrRange_dup(st) SKM_sk_dup(ASIdOrRange, st) +#define sk_ASIdOrRange_pop_free(st, free_func) SKM_sk_pop_free(ASIdOrRange, (st), (free_func)) +#define sk_ASIdOrRange_shift(st) SKM_sk_shift(ASIdOrRange, (st)) +#define sk_ASIdOrRange_pop(st) SKM_sk_pop(ASIdOrRange, (st)) +#define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st)) +#define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st)) + +#define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING) +#define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_value(st, i) SKM_sk_value(ASN1_GENERALSTRING, (st), (i)) +#define sk_ASN1_GENERALSTRING_set(st, i, val) SKM_sk_set(ASN1_GENERALSTRING, (st), (i), (val)) +#define sk_ASN1_GENERALSTRING_zero(st) SKM_sk_zero(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_push(st, val) SKM_sk_push(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_unshift(st, val) SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_find(st, val) SKM_sk_find(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_find_ex(st, val) SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val)) +#define sk_ASN1_GENERALSTRING_delete(st, i) SKM_sk_delete(ASN1_GENERALSTRING, (st), (i)) +#define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr)) +#define sk_ASN1_GENERALSTRING_insert(st, val, i) SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i)) +#define sk_ASN1_GENERALSTRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_GENERALSTRING, (st), (cmp)) +#define sk_ASN1_GENERALSTRING_dup(st) SKM_sk_dup(ASN1_GENERALSTRING, st) +#define sk_ASN1_GENERALSTRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_GENERALSTRING, (st), (free_func)) +#define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st)) +#define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st)) + +#define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) +#define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_set(st, i, val) SKM_sk_set(ASN1_INTEGER, (st), (i), (val)) +#define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_find_ex(st, val) SKM_sk_find_ex(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr)) +#define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i)) +#define sk_ASN1_INTEGER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp)) +#define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st) +#define sk_ASN1_INTEGER_pop_free(st, free_func) SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func)) +#define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st)) + +#define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) +#define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val)) +#define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr)) +#define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i)) +#define sk_ASN1_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp)) +#define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st) +#define sk_ASN1_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func)) +#define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st)) + +#define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) +#define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_value(st, i) SKM_sk_value(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_set(st, i, val) SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val)) +#define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_find_ex(st, val) SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr)) +#define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i)) +#define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp)) +#define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st) +#define sk_ASN1_STRING_TABLE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func)) +#define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st)) + +#define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) +#define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val)) +#define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr)) +#define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i)) +#define sk_ASN1_TYPE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp)) +#define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st) +#define sk_ASN1_TYPE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_TYPE, (st), (free_func)) +#define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st)) + +#define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE) +#define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_value(st, i) SKM_sk_value(ASN1_VALUE, (st), (i)) +#define sk_ASN1_VALUE_set(st, i, val) SKM_sk_set(ASN1_VALUE, (st), (i), (val)) +#define sk_ASN1_VALUE_zero(st) SKM_sk_zero(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val)) +#define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i)) +#define sk_ASN1_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr)) +#define sk_ASN1_VALUE_insert(st, val, i) SKM_sk_insert(ASN1_VALUE, (st), (val), (i)) +#define sk_ASN1_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_VALUE, (st), (cmp)) +#define sk_ASN1_VALUE_dup(st) SKM_sk_dup(ASN1_VALUE, st) +#define sk_ASN1_VALUE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_VALUE, (st), (free_func)) +#define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st)) +#define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st)) + +#define sk_BIO_new(st) SKM_sk_new(BIO, (st)) +#define sk_BIO_new_null() SKM_sk_new_null(BIO) +#define sk_BIO_free(st) SKM_sk_free(BIO, (st)) +#define sk_BIO_num(st) SKM_sk_num(BIO, (st)) +#define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i)) +#define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val)) +#define sk_BIO_zero(st) SKM_sk_zero(BIO, (st)) +#define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val)) +#define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val)) +#define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val)) +#define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val)) +#define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i)) +#define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr)) +#define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i)) +#define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp)) +#define sk_BIO_dup(st) SKM_sk_dup(BIO, st) +#define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func)) +#define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) +#define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) +#define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) +#define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st)) + +#define sk_CMS_CertificateChoices_new(st) SKM_sk_new(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_CertificateChoices) +#define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_value(st, i) SKM_sk_value(CMS_CertificateChoices, (st), (i)) +#define sk_CMS_CertificateChoices_set(st, i, val) SKM_sk_set(CMS_CertificateChoices, (st), (i), (val)) +#define sk_CMS_CertificateChoices_zero(st) SKM_sk_zero(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_push(st, val) SKM_sk_push(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_unshift(st, val) SKM_sk_unshift(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_find(st, val) SKM_sk_find(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_find_ex(st, val) SKM_sk_find_ex(CMS_CertificateChoices, (st), (val)) +#define sk_CMS_CertificateChoices_delete(st, i) SKM_sk_delete(CMS_CertificateChoices, (st), (i)) +#define sk_CMS_CertificateChoices_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_CertificateChoices, (st), (ptr)) +#define sk_CMS_CertificateChoices_insert(st, val, i) SKM_sk_insert(CMS_CertificateChoices, (st), (val), (i)) +#define sk_CMS_CertificateChoices_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_CertificateChoices, (st), (cmp)) +#define sk_CMS_CertificateChoices_dup(st) SKM_sk_dup(CMS_CertificateChoices, st) +#define sk_CMS_CertificateChoices_pop_free(st, free_func) SKM_sk_pop_free(CMS_CertificateChoices, (st), (free_func)) +#define sk_CMS_CertificateChoices_shift(st) SKM_sk_shift(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_pop(st) SKM_sk_pop(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoices, (st)) +#define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_CertificateChoices, (st)) + +#define sk_CMS_RecipientInfo_new(st) SKM_sk_new(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo) +#define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_value(st, i) SKM_sk_value(CMS_RecipientInfo, (st), (i)) +#define sk_CMS_RecipientInfo_set(st, i, val) SKM_sk_set(CMS_RecipientInfo, (st), (i), (val)) +#define sk_CMS_RecipientInfo_zero(st) SKM_sk_zero(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_push(st, val) SKM_sk_push(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_unshift(st, val) SKM_sk_unshift(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_find(st, val) SKM_sk_find(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_find_ex(st, val) SKM_sk_find_ex(CMS_RecipientInfo, (st), (val)) +#define sk_CMS_RecipientInfo_delete(st, i) SKM_sk_delete(CMS_RecipientInfo, (st), (i)) +#define sk_CMS_RecipientInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RecipientInfo, (st), (ptr)) +#define sk_CMS_RecipientInfo_insert(st, val, i) SKM_sk_insert(CMS_RecipientInfo, (st), (val), (i)) +#define sk_CMS_RecipientInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RecipientInfo, (st), (cmp)) +#define sk_CMS_RecipientInfo_dup(st) SKM_sk_dup(CMS_RecipientInfo, st) +#define sk_CMS_RecipientInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_RecipientInfo, (st), (free_func)) +#define sk_CMS_RecipientInfo_shift(st) SKM_sk_shift(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_pop(st) SKM_sk_pop(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st)) +#define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientInfo, (st)) + +#define sk_CMS_RevocationInfoChoice_new(st) SKM_sk_new(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_RevocationInfoChoice) +#define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_value(st, i) SKM_sk_value(CMS_RevocationInfoChoice, (st), (i)) +#define sk_CMS_RevocationInfoChoice_set(st, i, val) SKM_sk_set(CMS_RevocationInfoChoice, (st), (i), (val)) +#define sk_CMS_RevocationInfoChoice_zero(st) SKM_sk_zero(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_push(st, val) SKM_sk_push(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_unshift(st, val) SKM_sk_unshift(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_find(st, val) SKM_sk_find(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_find_ex(st, val) SKM_sk_find_ex(CMS_RevocationInfoChoice, (st), (val)) +#define sk_CMS_RevocationInfoChoice_delete(st, i) SKM_sk_delete(CMS_RevocationInfoChoice, (st), (i)) +#define sk_CMS_RevocationInfoChoice_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RevocationInfoChoice, (st), (ptr)) +#define sk_CMS_RevocationInfoChoice_insert(st, val, i) SKM_sk_insert(CMS_RevocationInfoChoice, (st), (val), (i)) +#define sk_CMS_RevocationInfoChoice_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RevocationInfoChoice, (st), (cmp)) +#define sk_CMS_RevocationInfoChoice_dup(st) SKM_sk_dup(CMS_RevocationInfoChoice, st) +#define sk_CMS_RevocationInfoChoice_pop_free(st, free_func) SKM_sk_pop_free(CMS_RevocationInfoChoice, (st), (free_func)) +#define sk_CMS_RevocationInfoChoice_shift(st) SKM_sk_shift(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_pop(st) SKM_sk_pop(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInfoChoice, (st)) +#define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st)) + +#define sk_CMS_SignerInfo_new(st) SKM_sk_new(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo) +#define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_value(st, i) SKM_sk_value(CMS_SignerInfo, (st), (i)) +#define sk_CMS_SignerInfo_set(st, i, val) SKM_sk_set(CMS_SignerInfo, (st), (i), (val)) +#define sk_CMS_SignerInfo_zero(st) SKM_sk_zero(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_push(st, val) SKM_sk_push(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_unshift(st, val) SKM_sk_unshift(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_find(st, val) SKM_sk_find(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_find_ex(st, val) SKM_sk_find_ex(CMS_SignerInfo, (st), (val)) +#define sk_CMS_SignerInfo_delete(st, i) SKM_sk_delete(CMS_SignerInfo, (st), (i)) +#define sk_CMS_SignerInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_SignerInfo, (st), (ptr)) +#define sk_CMS_SignerInfo_insert(st, val, i) SKM_sk_insert(CMS_SignerInfo, (st), (val), (i)) +#define sk_CMS_SignerInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_SignerInfo, (st), (cmp)) +#define sk_CMS_SignerInfo_dup(st) SKM_sk_dup(CMS_SignerInfo, st) +#define sk_CMS_SignerInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_SignerInfo, (st), (free_func)) +#define sk_CMS_SignerInfo_shift(st) SKM_sk_shift(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_pop(st) SKM_sk_pop(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st)) +#define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st)) + +#define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE) +#define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_value(st, i) SKM_sk_value(CONF_IMODULE, (st), (i)) +#define sk_CONF_IMODULE_set(st, i, val) SKM_sk_set(CONF_IMODULE, (st), (i), (val)) +#define sk_CONF_IMODULE_zero(st) SKM_sk_zero(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_unshift(st, val) SKM_sk_unshift(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_find_ex(st, val) SKM_sk_find_ex(CONF_IMODULE, (st), (val)) +#define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i)) +#define sk_CONF_IMODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr)) +#define sk_CONF_IMODULE_insert(st, val, i) SKM_sk_insert(CONF_IMODULE, (st), (val), (i)) +#define sk_CONF_IMODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_IMODULE, (st), (cmp)) +#define sk_CONF_IMODULE_dup(st) SKM_sk_dup(CONF_IMODULE, st) +#define sk_CONF_IMODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_IMODULE, (st), (free_func)) +#define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st)) +#define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st)) + +#define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st)) +#define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE) +#define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st)) +#define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st)) +#define sk_CONF_MODULE_value(st, i) SKM_sk_value(CONF_MODULE, (st), (i)) +#define sk_CONF_MODULE_set(st, i, val) SKM_sk_set(CONF_MODULE, (st), (i), (val)) +#define sk_CONF_MODULE_zero(st) SKM_sk_zero(CONF_MODULE, (st)) +#define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val)) +#define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i)) +#define sk_CONF_MODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr)) +#define sk_CONF_MODULE_insert(st, val, i) SKM_sk_insert(CONF_MODULE, (st), (val), (i)) +#define sk_CONF_MODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_MODULE, (st), (cmp)) +#define sk_CONF_MODULE_dup(st) SKM_sk_dup(CONF_MODULE, st) +#define sk_CONF_MODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_MODULE, (st), (free_func)) +#define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st)) +#define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st)) +#define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st)) +#define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st)) + +#define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) +#define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) +#define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st)) +#define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st)) +#define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val)) +#define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st)) +#define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr)) +#define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i)) +#define sk_CONF_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp)) +#define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st) +#define sk_CONF_VALUE_pop_free(st, free_func) SKM_sk_pop_free(CONF_VALUE, (st), (free_func)) +#define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) +#define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) +#define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) +#define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st)) + +#define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) +#define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr)) +#define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp)) +#define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st) +#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func)) +#define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st)) + +#define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) +#define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_set(st, i, val) SKM_sk_set(CRYPTO_dynlock, (st), (i), (val)) +#define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_find_ex(st, val) SKM_sk_find_ex(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr)) +#define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i)) +#define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp)) +#define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st) +#define sk_CRYPTO_dynlock_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func)) +#define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st)) + +#define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) +#define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) +#define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st)) +#define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st)) +#define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val)) +#define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st)) +#define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr)) +#define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i)) +#define sk_DIST_POINT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp)) +#define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st) +#define sk_DIST_POINT_pop_free(st, free_func) SKM_sk_pop_free(DIST_POINT, (st), (free_func)) +#define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) +#define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) +#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) +#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st)) + +#define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st)) +#define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE) +#define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st)) +#define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st)) +#define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i)) +#define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val)) +#define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st)) +#define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val)) +#define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val)) +#define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val)) +#define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val)) +#define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i)) +#define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr)) +#define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i)) +#define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp)) +#define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st) +#define sk_ENGINE_pop_free(st, free_func) SKM_sk_pop_free(ENGINE, (st), (free_func)) +#define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st)) +#define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st)) +#define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st)) +#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st)) + +#define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM) +#define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_value(st, i) SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i)) +#define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val)) +#define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val)) +#define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i)) +#define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr)) +#define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i)) +#define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp)) +#define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st) +#define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func)) +#define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st)) +#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st)) + +#define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) +#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_set(st, i, val) SKM_sk_set(GENERAL_NAME, (st), (i), (val)) +#define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr)) +#define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i)) +#define sk_GENERAL_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp)) +#define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st) +#define sk_GENERAL_NAME_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAME, (st), (free_func)) +#define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st)) + +#define sk_GENERAL_NAMES_new(st) SKM_sk_new(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES) +#define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_value(st, i) SKM_sk_value(GENERAL_NAMES, (st), (i)) +#define sk_GENERAL_NAMES_set(st, i, val) SKM_sk_set(GENERAL_NAMES, (st), (i), (val)) +#define sk_GENERAL_NAMES_zero(st) SKM_sk_zero(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_push(st, val) SKM_sk_push(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_unshift(st, val) SKM_sk_unshift(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_find(st, val) SKM_sk_find(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAMES, (st), (val)) +#define sk_GENERAL_NAMES_delete(st, i) SKM_sk_delete(GENERAL_NAMES, (st), (i)) +#define sk_GENERAL_NAMES_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAMES, (st), (ptr)) +#define sk_GENERAL_NAMES_insert(st, val, i) SKM_sk_insert(GENERAL_NAMES, (st), (val), (i)) +#define sk_GENERAL_NAMES_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAMES, (st), (cmp)) +#define sk_GENERAL_NAMES_dup(st) SKM_sk_dup(GENERAL_NAMES, st) +#define sk_GENERAL_NAMES_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAMES, (st), (free_func)) +#define sk_GENERAL_NAMES_shift(st) SKM_sk_shift(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_pop(st) SKM_sk_pop(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st)) +#define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st)) + +#define sk_GENERAL_SUBTREE_new(st) SKM_sk_new(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE) +#define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i)) +#define sk_GENERAL_SUBTREE_set(st, i, val) SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val)) +#define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_push(st, val) SKM_sk_push(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_unshift(st, val) SKM_sk_unshift(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_find(st, val) SKM_sk_find(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_find_ex(st, val) SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val)) +#define sk_GENERAL_SUBTREE_delete(st, i) SKM_sk_delete(GENERAL_SUBTREE, (st), (i)) +#define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr)) +#define sk_GENERAL_SUBTREE_insert(st, val, i) SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i)) +#define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp)) +#define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st) +#define sk_GENERAL_SUBTREE_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func)) +#define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st)) +#define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st)) + +#define sk_IPAddressFamily_new(st) SKM_sk_new(IPAddressFamily, (st)) +#define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily) +#define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st)) +#define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st)) +#define sk_IPAddressFamily_value(st, i) SKM_sk_value(IPAddressFamily, (st), (i)) +#define sk_IPAddressFamily_set(st, i, val) SKM_sk_set(IPAddressFamily, (st), (i), (val)) +#define sk_IPAddressFamily_zero(st) SKM_sk_zero(IPAddressFamily, (st)) +#define sk_IPAddressFamily_push(st, val) SKM_sk_push(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_unshift(st, val) SKM_sk_unshift(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_find(st, val) SKM_sk_find(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_find_ex(st, val) SKM_sk_find_ex(IPAddressFamily, (st), (val)) +#define sk_IPAddressFamily_delete(st, i) SKM_sk_delete(IPAddressFamily, (st), (i)) +#define sk_IPAddressFamily_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressFamily, (st), (ptr)) +#define sk_IPAddressFamily_insert(st, val, i) SKM_sk_insert(IPAddressFamily, (st), (val), (i)) +#define sk_IPAddressFamily_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressFamily, (st), (cmp)) +#define sk_IPAddressFamily_dup(st) SKM_sk_dup(IPAddressFamily, st) +#define sk_IPAddressFamily_pop_free(st, free_func) SKM_sk_pop_free(IPAddressFamily, (st), (free_func)) +#define sk_IPAddressFamily_shift(st) SKM_sk_shift(IPAddressFamily, (st)) +#define sk_IPAddressFamily_pop(st) SKM_sk_pop(IPAddressFamily, (st)) +#define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st)) +#define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st)) + +#define sk_IPAddressOrRange_new(st) SKM_sk_new(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange) +#define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_value(st, i) SKM_sk_value(IPAddressOrRange, (st), (i)) +#define sk_IPAddressOrRange_set(st, i, val) SKM_sk_set(IPAddressOrRange, (st), (i), (val)) +#define sk_IPAddressOrRange_zero(st) SKM_sk_zero(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_push(st, val) SKM_sk_push(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_unshift(st, val) SKM_sk_unshift(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_find(st, val) SKM_sk_find(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_find_ex(st, val) SKM_sk_find_ex(IPAddressOrRange, (st), (val)) +#define sk_IPAddressOrRange_delete(st, i) SKM_sk_delete(IPAddressOrRange, (st), (i)) +#define sk_IPAddressOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressOrRange, (st), (ptr)) +#define sk_IPAddressOrRange_insert(st, val, i) SKM_sk_insert(IPAddressOrRange, (st), (val), (i)) +#define sk_IPAddressOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressOrRange, (st), (cmp)) +#define sk_IPAddressOrRange_dup(st) SKM_sk_dup(IPAddressOrRange, st) +#define sk_IPAddressOrRange_pop_free(st, free_func) SKM_sk_pop_free(IPAddressOrRange, (st), (free_func)) +#define sk_IPAddressOrRange_shift(st) SKM_sk_shift(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_pop(st) SKM_sk_pop(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st)) +#define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st)) + +#define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY) +#define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_value(st, i) SKM_sk_value(KRB5_APREQBODY, (st), (i)) +#define sk_KRB5_APREQBODY_set(st, i, val) SKM_sk_set(KRB5_APREQBODY, (st), (i), (val)) +#define sk_KRB5_APREQBODY_zero(st) SKM_sk_zero(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_unshift(st, val) SKM_sk_unshift(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_APREQBODY, (st), (val)) +#define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i)) +#define sk_KRB5_APREQBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr)) +#define sk_KRB5_APREQBODY_insert(st, val, i) SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i)) +#define sk_KRB5_APREQBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_APREQBODY, (st), (cmp)) +#define sk_KRB5_APREQBODY_dup(st) SKM_sk_dup(KRB5_APREQBODY, st) +#define sk_KRB5_APREQBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_APREQBODY, (st), (free_func)) +#define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st)) +#define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st)) + +#define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA) +#define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_value(st, i) SKM_sk_value(KRB5_AUTHDATA, (st), (i)) +#define sk_KRB5_AUTHDATA_set(st, i, val) SKM_sk_set(KRB5_AUTHDATA, (st), (i), (val)) +#define sk_KRB5_AUTHDATA_zero(st) SKM_sk_zero(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_unshift(st, val) SKM_sk_unshift(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val)) +#define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i)) +#define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr)) +#define sk_KRB5_AUTHDATA_insert(st, val, i) SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i)) +#define sk_KRB5_AUTHDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHDATA, (st), (cmp)) +#define sk_KRB5_AUTHDATA_dup(st) SKM_sk_dup(KRB5_AUTHDATA, st) +#define sk_KRB5_AUTHDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHDATA, (st), (free_func)) +#define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st)) +#define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st)) + +#define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY) +#define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_value(st, i) SKM_sk_value(KRB5_AUTHENTBODY, (st), (i)) +#define sk_KRB5_AUTHENTBODY_set(st, i, val) SKM_sk_set(KRB5_AUTHENTBODY, (st), (i), (val)) +#define sk_KRB5_AUTHENTBODY_zero(st) SKM_sk_zero(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_push(st, val) SKM_sk_push(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_unshift(st, val) SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_find(st, val) SKM_sk_find(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val)) +#define sk_KRB5_AUTHENTBODY_delete(st, i) SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i)) +#define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr)) +#define sk_KRB5_AUTHENTBODY_insert(st, val, i) SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i)) +#define sk_KRB5_AUTHENTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHENTBODY, (st), (cmp)) +#define sk_KRB5_AUTHENTBODY_dup(st) SKM_sk_dup(KRB5_AUTHENTBODY, st) +#define sk_KRB5_AUTHENTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHENTBODY, (st), (free_func)) +#define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st)) +#define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st)) + +#define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM) +#define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_value(st, i) SKM_sk_value(KRB5_CHECKSUM, (st), (i)) +#define sk_KRB5_CHECKSUM_set(st, i, val) SKM_sk_set(KRB5_CHECKSUM, (st), (i), (val)) +#define sk_KRB5_CHECKSUM_zero(st) SKM_sk_zero(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_unshift(st, val) SKM_sk_unshift(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_find_ex(st, val) SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val)) +#define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i)) +#define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr)) +#define sk_KRB5_CHECKSUM_insert(st, val, i) SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i)) +#define sk_KRB5_CHECKSUM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_CHECKSUM, (st), (cmp)) +#define sk_KRB5_CHECKSUM_dup(st) SKM_sk_dup(KRB5_CHECKSUM, st) +#define sk_KRB5_CHECKSUM_pop_free(st, free_func) SKM_sk_pop_free(KRB5_CHECKSUM, (st), (free_func)) +#define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st)) +#define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st)) + +#define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA) +#define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_value(st, i) SKM_sk_value(KRB5_ENCDATA, (st), (i)) +#define sk_KRB5_ENCDATA_set(st, i, val) SKM_sk_set(KRB5_ENCDATA, (st), (i), (val)) +#define sk_KRB5_ENCDATA_zero(st) SKM_sk_zero(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_unshift(st, val) SKM_sk_unshift(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCDATA, (st), (val)) +#define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i)) +#define sk_KRB5_ENCDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr)) +#define sk_KRB5_ENCDATA_insert(st, val, i) SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i)) +#define sk_KRB5_ENCDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCDATA, (st), (cmp)) +#define sk_KRB5_ENCDATA_dup(st) SKM_sk_dup(KRB5_ENCDATA, st) +#define sk_KRB5_ENCDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCDATA, (st), (free_func)) +#define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st)) +#define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st)) + +#define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY) +#define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_value(st, i) SKM_sk_value(KRB5_ENCKEY, (st), (i)) +#define sk_KRB5_ENCKEY_set(st, i, val) SKM_sk_set(KRB5_ENCKEY, (st), (i), (val)) +#define sk_KRB5_ENCKEY_zero(st) SKM_sk_zero(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val)) +#define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i)) +#define sk_KRB5_ENCKEY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr)) +#define sk_KRB5_ENCKEY_insert(st, val, i) SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i)) +#define sk_KRB5_ENCKEY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCKEY, (st), (cmp)) +#define sk_KRB5_ENCKEY_dup(st) SKM_sk_dup(KRB5_ENCKEY, st) +#define sk_KRB5_ENCKEY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCKEY, (st), (free_func)) +#define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st)) +#define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st)) + +#define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME) +#define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_value(st, i) SKM_sk_value(KRB5_PRINCNAME, (st), (i)) +#define sk_KRB5_PRINCNAME_set(st, i, val) SKM_sk_set(KRB5_PRINCNAME, (st), (i), (val)) +#define sk_KRB5_PRINCNAME_zero(st) SKM_sk_zero(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_unshift(st, val) SKM_sk_unshift(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_find_ex(st, val) SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val)) +#define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i)) +#define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr)) +#define sk_KRB5_PRINCNAME_insert(st, val, i) SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i)) +#define sk_KRB5_PRINCNAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_PRINCNAME, (st), (cmp)) +#define sk_KRB5_PRINCNAME_dup(st) SKM_sk_dup(KRB5_PRINCNAME, st) +#define sk_KRB5_PRINCNAME_pop_free(st, free_func) SKM_sk_pop_free(KRB5_PRINCNAME, (st), (free_func)) +#define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st)) +#define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st)) + +#define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY) +#define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_value(st, i) SKM_sk_value(KRB5_TKTBODY, (st), (i)) +#define sk_KRB5_TKTBODY_set(st, i, val) SKM_sk_set(KRB5_TKTBODY, (st), (i), (val)) +#define sk_KRB5_TKTBODY_zero(st) SKM_sk_zero(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_unshift(st, val) SKM_sk_unshift(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_TKTBODY, (st), (val)) +#define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i)) +#define sk_KRB5_TKTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr)) +#define sk_KRB5_TKTBODY_insert(st, val, i) SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i)) +#define sk_KRB5_TKTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_TKTBODY, (st), (cmp)) +#define sk_KRB5_TKTBODY_dup(st) SKM_sk_dup(KRB5_TKTBODY, st) +#define sk_KRB5_TKTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_TKTBODY, (st), (free_func)) +#define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st)) +#define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st)) + +#define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) +#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) +#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) +#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) +#define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val)) +#define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st)) +#define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr)) +#define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i)) +#define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp)) +#define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st) +#define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func)) +#define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) +#define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) +#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) +#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) + +#define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) +#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) +#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) +#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) +#define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val)) +#define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st)) +#define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr)) +#define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i)) +#define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp)) +#define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st) +#define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func)) +#define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) +#define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) +#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) +#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st)) + +#define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) +#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) +#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) +#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) +#define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val)) +#define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st)) +#define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr)) +#define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i)) +#define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp)) +#define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st) +#define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func)) +#define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) +#define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) +#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) +#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) + +#define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) +#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) +#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) +#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) +#define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val)) +#define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st)) +#define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr)) +#define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i)) +#define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp)) +#define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st) +#define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func)) +#define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) +#define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) +#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) +#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st)) + +#define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) +#define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val)) +#define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr)) +#define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i)) +#define sk_NAME_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp)) +#define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st) +#define sk_NAME_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(NAME_FUNCS, (st), (free_func)) +#define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st)) + +#define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID) +#define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_value(st, i) SKM_sk_value(OCSP_CERTID, (st), (i)) +#define sk_OCSP_CERTID_set(st, i, val) SKM_sk_set(OCSP_CERTID, (st), (i), (val)) +#define sk_OCSP_CERTID_zero(st) SKM_sk_zero(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val)) +#define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i)) +#define sk_OCSP_CERTID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr)) +#define sk_OCSP_CERTID_insert(st, val, i) SKM_sk_insert(OCSP_CERTID, (st), (val), (i)) +#define sk_OCSP_CERTID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_CERTID, (st), (cmp)) +#define sk_OCSP_CERTID_dup(st) SKM_sk_dup(OCSP_CERTID, st) +#define sk_OCSP_CERTID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_CERTID, (st), (free_func)) +#define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st)) +#define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st)) + +#define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ) +#define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_value(st, i) SKM_sk_value(OCSP_ONEREQ, (st), (i)) +#define sk_OCSP_ONEREQ_set(st, i, val) SKM_sk_set(OCSP_ONEREQ, (st), (i), (val)) +#define sk_OCSP_ONEREQ_zero(st) SKM_sk_zero(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val)) +#define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i)) +#define sk_OCSP_ONEREQ_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr)) +#define sk_OCSP_ONEREQ_insert(st, val, i) SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i)) +#define sk_OCSP_ONEREQ_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_ONEREQ, (st), (cmp)) +#define sk_OCSP_ONEREQ_dup(st) SKM_sk_dup(OCSP_ONEREQ, st) +#define sk_OCSP_ONEREQ_pop_free(st, free_func) SKM_sk_pop_free(OCSP_ONEREQ, (st), (free_func)) +#define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st)) +#define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st)) + +#define sk_OCSP_RESPID_new(st) SKM_sk_new(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID) +#define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_value(st, i) SKM_sk_value(OCSP_RESPID, (st), (i)) +#define sk_OCSP_RESPID_set(st, i, val) SKM_sk_set(OCSP_RESPID, (st), (i), (val)) +#define sk_OCSP_RESPID_zero(st) SKM_sk_zero(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_push(st, val) SKM_sk_push(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_unshift(st, val) SKM_sk_unshift(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_find(st, val) SKM_sk_find(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_find_ex(st, val) SKM_sk_find_ex(OCSP_RESPID, (st), (val)) +#define sk_OCSP_RESPID_delete(st, i) SKM_sk_delete(OCSP_RESPID, (st), (i)) +#define sk_OCSP_RESPID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_RESPID, (st), (ptr)) +#define sk_OCSP_RESPID_insert(st, val, i) SKM_sk_insert(OCSP_RESPID, (st), (val), (i)) +#define sk_OCSP_RESPID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_RESPID, (st), (cmp)) +#define sk_OCSP_RESPID_dup(st) SKM_sk_dup(OCSP_RESPID, st) +#define sk_OCSP_RESPID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_RESPID, (st), (free_func)) +#define sk_OCSP_RESPID_shift(st) SKM_sk_shift(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_pop(st) SKM_sk_pop(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st)) +#define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st)) + +#define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP) +#define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_value(st, i) SKM_sk_value(OCSP_SINGLERESP, (st), (i)) +#define sk_OCSP_SINGLERESP_set(st, i, val) SKM_sk_set(OCSP_SINGLERESP, (st), (i), (val)) +#define sk_OCSP_SINGLERESP_zero(st) SKM_sk_zero(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_push(st, val) SKM_sk_push(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_unshift(st, val) SKM_sk_unshift(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_find(st, val) SKM_sk_find(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_find_ex(st, val) SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val)) +#define sk_OCSP_SINGLERESP_delete(st, i) SKM_sk_delete(OCSP_SINGLERESP, (st), (i)) +#define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr)) +#define sk_OCSP_SINGLERESP_insert(st, val, i) SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i)) +#define sk_OCSP_SINGLERESP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_SINGLERESP, (st), (cmp)) +#define sk_OCSP_SINGLERESP_dup(st) SKM_sk_dup(OCSP_SINGLERESP, st) +#define sk_OCSP_SINGLERESP_pop_free(st, free_func) SKM_sk_pop_free(OCSP_SINGLERESP, (st), (free_func)) +#define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st)) +#define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st)) + +#define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) +#define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_set(st, i, val) SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val)) +#define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_find_ex(st, val) SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr)) +#define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i)) +#define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp)) +#define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st) +#define sk_PKCS12_SAFEBAG_pop_free(st, free_func) SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func)) +#define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st)) + +#define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) +#define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) +#define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st)) +#define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st)) +#define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i)) +#define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val)) +#define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st)) +#define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val)) +#define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val)) +#define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val)) +#define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val)) +#define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i)) +#define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr)) +#define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i)) +#define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp)) +#define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st) +#define sk_PKCS7_pop_free(st, free_func) SKM_sk_pop_free(PKCS7, (st), (free_func)) +#define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) +#define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) +#define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) +#define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st)) + +#define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) +#define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_value(st, i) SKM_sk_value(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_set(st, i, val) SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val)) +#define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr)) +#define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i)) +#define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp)) +#define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st) +#define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func)) +#define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st)) + +#define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) +#define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_value(st, i) SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_set(st, i, val) SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val)) +#define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr)) +#define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i)) +#define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp)) +#define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st) +#define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func)) +#define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st)) + +#define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) +#define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) +#define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st)) +#define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st)) +#define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val)) +#define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st)) +#define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr)) +#define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i)) +#define sk_POLICYINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp)) +#define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st) +#define sk_POLICYINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYINFO, (st), (free_func)) +#define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) +#define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) +#define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) +#define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st)) + +#define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) +#define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_set(st, i, val) SKM_sk_set(POLICYQUALINFO, (st), (i), (val)) +#define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_find_ex(st, val) SKM_sk_find_ex(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr)) +#define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i)) +#define sk_POLICYQUALINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp)) +#define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st) +#define sk_POLICYQUALINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func)) +#define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st)) + +#define sk_POLICY_MAPPING_new(st) SKM_sk_new(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING) +#define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i)) +#define sk_POLICY_MAPPING_set(st, i, val) SKM_sk_set(POLICY_MAPPING, (st), (i), (val)) +#define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_unshift(st, val) SKM_sk_unshift(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_find_ex(st, val) SKM_sk_find_ex(POLICY_MAPPING, (st), (val)) +#define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i)) +#define sk_POLICY_MAPPING_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr)) +#define sk_POLICY_MAPPING_insert(st, val, i) SKM_sk_insert(POLICY_MAPPING, (st), (val), (i)) +#define sk_POLICY_MAPPING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp)) +#define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st) +#define sk_POLICY_MAPPING_pop_free(st, free_func) SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func)) +#define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st)) +#define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st)) + +#define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) +#define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val)) +#define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr)) +#define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i)) +#define sk_SSL_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp)) +#define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st) +#define sk_SSL_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(SSL_CIPHER, (st), (free_func)) +#define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st)) + +#define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) +#define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) +#define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st)) +#define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st)) +#define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val)) +#define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st)) +#define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr)) +#define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i)) +#define sk_SSL_COMP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp)) +#define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st) +#define sk_SSL_COMP_pop_free(st, free_func) SKM_sk_pop_free(SSL_COMP, (st), (free_func)) +#define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) +#define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) +#define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) +#define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st)) + +#define sk_STORE_OBJECT_new(st) SKM_sk_new(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT) +#define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i)) +#define sk_STORE_OBJECT_set(st, i, val) SKM_sk_set(STORE_OBJECT, (st), (i), (val)) +#define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_unshift(st, val) SKM_sk_unshift(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_find_ex(st, val) SKM_sk_find_ex(STORE_OBJECT, (st), (val)) +#define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i)) +#define sk_STORE_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr)) +#define sk_STORE_OBJECT_insert(st, val, i) SKM_sk_insert(STORE_OBJECT, (st), (val), (i)) +#define sk_STORE_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp)) +#define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st) +#define sk_STORE_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(STORE_OBJECT, (st), (free_func)) +#define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) +#define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) + +#define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) +#define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) +#define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) +#define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) +#define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i)) +#define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val)) +#define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st)) +#define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val)) +#define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val)) +#define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val)) +#define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val)) +#define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i)) +#define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr)) +#define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i)) +#define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp)) +#define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st) +#define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func)) +#define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) +#define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) +#define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) +#define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) + +#define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st)) +#define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) +#define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) +#define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st)) +#define sk_UI_STRING_value(st, i) SKM_sk_value(UI_STRING, (st), (i)) +#define sk_UI_STRING_set(st, i, val) SKM_sk_set(UI_STRING, (st), (i), (val)) +#define sk_UI_STRING_zero(st) SKM_sk_zero(UI_STRING, (st)) +#define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val)) +#define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val)) +#define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val)) +#define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val)) +#define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i)) +#define sk_UI_STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(UI_STRING, (st), (ptr)) +#define sk_UI_STRING_insert(st, val, i) SKM_sk_insert(UI_STRING, (st), (val), (i)) +#define sk_UI_STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(UI_STRING, (st), (cmp)) +#define sk_UI_STRING_dup(st) SKM_sk_dup(UI_STRING, st) +#define sk_UI_STRING_pop_free(st, free_func) SKM_sk_pop_free(UI_STRING, (st), (free_func)) +#define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st)) +#define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st)) +#define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st)) +#define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st)) + +#define sk_X509_new(st) SKM_sk_new(X509, (st)) +#define sk_X509_new_null() SKM_sk_new_null(X509) +#define sk_X509_free(st) SKM_sk_free(X509, (st)) +#define sk_X509_num(st) SKM_sk_num(X509, (st)) +#define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i)) +#define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val)) +#define sk_X509_zero(st) SKM_sk_zero(X509, (st)) +#define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val)) +#define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val)) +#define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val)) +#define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val)) +#define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i)) +#define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr)) +#define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i)) +#define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp)) +#define sk_X509_dup(st) SKM_sk_dup(X509, st) +#define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func)) +#define sk_X509_shift(st) SKM_sk_shift(X509, (st)) +#define sk_X509_pop(st) SKM_sk_pop(X509, (st)) +#define sk_X509_sort(st) SKM_sk_sort(X509, (st)) +#define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st)) + +#define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) +#define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_value(st, i) SKM_sk_value(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_set(st, i, val) SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val)) +#define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_find_ex(st, val) SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr)) +#define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i)) +#define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp)) +#define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st) +#define sk_X509V3_EXT_METHOD_pop_free(st, free_func) SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func)) +#define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st)) + +#define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) +#define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) +#define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st)) +#define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st)) +#define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val)) +#define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st)) +#define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr)) +#define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i)) +#define sk_X509_ALGOR_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp)) +#define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st) +#define sk_X509_ALGOR_pop_free(st, free_func) SKM_sk_pop_free(X509_ALGOR, (st), (free_func)) +#define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) +#define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) +#define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) +#define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st)) + +#define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) +#define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_set(st, i, val) SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val)) +#define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_find_ex(st, val) SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr)) +#define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i)) +#define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp)) +#define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st) +#define sk_X509_ATTRIBUTE_pop_free(st, free_func) SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func)) +#define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st)) + +#define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) +#define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) +#define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st)) +#define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st)) +#define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i)) +#define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val)) +#define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st)) +#define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val)) +#define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val)) +#define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val)) +#define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val)) +#define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i)) +#define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr)) +#define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i)) +#define sk_X509_CRL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_CRL, (st), (cmp)) +#define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st) +#define sk_X509_CRL_pop_free(st, free_func) SKM_sk_pop_free(X509_CRL, (st), (free_func)) +#define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) +#define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) +#define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) +#define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st)) + +#define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) +#define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_set(st, i, val) SKM_sk_set(X509_EXTENSION, (st), (i), (val)) +#define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_find_ex(st, val) SKM_sk_find_ex(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr)) +#define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i)) +#define sk_X509_EXTENSION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp)) +#define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st) +#define sk_X509_EXTENSION_pop_free(st, free_func) SKM_sk_pop_free(X509_EXTENSION, (st), (free_func)) +#define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st)) + +#define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) +#define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) +#define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st)) +#define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st)) +#define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i)) +#define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val)) +#define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st)) +#define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val)) +#define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val)) +#define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val)) +#define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val)) +#define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i)) +#define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr)) +#define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i)) +#define sk_X509_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_INFO, (st), (cmp)) +#define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st) +#define sk_X509_INFO_pop_free(st, free_func) SKM_sk_pop_free(X509_INFO, (st), (free_func)) +#define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) +#define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) +#define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) +#define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st)) + +#define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) +#define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val)) +#define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr)) +#define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i)) +#define sk_X509_LOOKUP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp)) +#define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st) +#define sk_X509_LOOKUP_pop_free(st, free_func) SKM_sk_pop_free(X509_LOOKUP, (st), (free_func)) +#define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st)) + +#define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) +#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) +#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) +#define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st)) +#define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i)) +#define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val)) +#define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st)) +#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val)) +#define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val)) +#define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val)) +#define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val)) +#define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i)) +#define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr)) +#define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i)) +#define sk_X509_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME, (st), (cmp)) +#define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st) +#define sk_X509_NAME_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME, (st), (free_func)) +#define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) +#define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) +#define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) +#define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st)) + +#define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) +#define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val)) +#define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr)) +#define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i)) +#define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp)) +#define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st) +#define sk_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func)) +#define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st)) + +#define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st)) +#define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT) +#define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st)) +#define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st)) +#define sk_X509_OBJECT_value(st, i) SKM_sk_value(X509_OBJECT, (st), (i)) +#define sk_X509_OBJECT_set(st, i, val) SKM_sk_set(X509_OBJECT, (st), (i), (val)) +#define sk_X509_OBJECT_zero(st) SKM_sk_zero(X509_OBJECT, (st)) +#define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val)) +#define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i)) +#define sk_X509_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr)) +#define sk_X509_OBJECT_insert(st, val, i) SKM_sk_insert(X509_OBJECT, (st), (val), (i)) +#define sk_X509_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_OBJECT, (st), (cmp)) +#define sk_X509_OBJECT_dup(st) SKM_sk_dup(X509_OBJECT, st) +#define sk_X509_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(X509_OBJECT, (st), (free_func)) +#define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st)) +#define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st)) +#define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st)) +#define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st)) + +#define sk_X509_POLICY_DATA_new(st) SKM_sk_new(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA) +#define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_value(st, i) SKM_sk_value(X509_POLICY_DATA, (st), (i)) +#define sk_X509_POLICY_DATA_set(st, i, val) SKM_sk_set(X509_POLICY_DATA, (st), (i), (val)) +#define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_push(st, val) SKM_sk_push(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_unshift(st, val) SKM_sk_unshift(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_find(st, val) SKM_sk_find(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_DATA, (st), (val)) +#define sk_X509_POLICY_DATA_delete(st, i) SKM_sk_delete(X509_POLICY_DATA, (st), (i)) +#define sk_X509_POLICY_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr)) +#define sk_X509_POLICY_DATA_insert(st, val, i) SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i)) +#define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp)) +#define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st) +#define sk_X509_POLICY_DATA_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func)) +#define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st)) +#define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st)) + +#define sk_X509_POLICY_NODE_new(st) SKM_sk_new(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE) +#define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_value(st, i) SKM_sk_value(X509_POLICY_NODE, (st), (i)) +#define sk_X509_POLICY_NODE_set(st, i, val) SKM_sk_set(X509_POLICY_NODE, (st), (i), (val)) +#define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_push(st, val) SKM_sk_push(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_unshift(st, val) SKM_sk_unshift(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_find(st, val) SKM_sk_find(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_NODE, (st), (val)) +#define sk_X509_POLICY_NODE_delete(st, i) SKM_sk_delete(X509_POLICY_NODE, (st), (i)) +#define sk_X509_POLICY_NODE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr)) +#define sk_X509_POLICY_NODE_insert(st, val, i) SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i)) +#define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp)) +#define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st) +#define sk_X509_POLICY_NODE_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func)) +#define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st)) +#define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st)) + +#define sk_X509_POLICY_REF_new(st) SKM_sk_new(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_new_null() SKM_sk_new_null(X509_POLICY_REF) +#define sk_X509_POLICY_REF_free(st) SKM_sk_free(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_num(st) SKM_sk_num(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_value(st, i) SKM_sk_value(X509_POLICY_REF, (st), (i)) +#define sk_X509_POLICY_REF_set(st, i, val) SKM_sk_set(X509_POLICY_REF, (st), (i), (val)) +#define sk_X509_POLICY_REF_zero(st) SKM_sk_zero(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_push(st, val) SKM_sk_push(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_unshift(st, val) SKM_sk_unshift(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_find(st, val) SKM_sk_find(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_REF, (st), (val)) +#define sk_X509_POLICY_REF_delete(st, i) SKM_sk_delete(X509_POLICY_REF, (st), (i)) +#define sk_X509_POLICY_REF_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_REF, (st), (ptr)) +#define sk_X509_POLICY_REF_insert(st, val, i) SKM_sk_insert(X509_POLICY_REF, (st), (val), (i)) +#define sk_X509_POLICY_REF_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_REF, (st), (cmp)) +#define sk_X509_POLICY_REF_dup(st) SKM_sk_dup(X509_POLICY_REF, st) +#define sk_X509_POLICY_REF_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_REF, (st), (free_func)) +#define sk_X509_POLICY_REF_shift(st) SKM_sk_shift(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_pop(st) SKM_sk_pop(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_sort(st) SKM_sk_sort(X509_POLICY_REF, (st)) +#define sk_X509_POLICY_REF_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_REF, (st)) + +#define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) +#define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_set(st, i, val) SKM_sk_set(X509_PURPOSE, (st), (i), (val)) +#define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_find_ex(st, val) SKM_sk_find_ex(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr)) +#define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i)) +#define sk_X509_PURPOSE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp)) +#define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st) +#define sk_X509_PURPOSE_pop_free(st, free_func) SKM_sk_pop_free(X509_PURPOSE, (st), (free_func)) +#define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st)) + +#define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) +#define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) +#define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st)) +#define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st)) +#define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_set(st, i, val) SKM_sk_set(X509_REVOKED, (st), (i), (val)) +#define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st)) +#define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_find_ex(st, val) SKM_sk_find_ex(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr)) +#define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i)) +#define sk_X509_REVOKED_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp)) +#define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st) +#define sk_X509_REVOKED_pop_free(st, free_func) SKM_sk_pop_free(X509_REVOKED, (st), (free_func)) +#define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) +#define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) +#define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) +#define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st)) + +#define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) +#define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) +#define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st)) +#define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st)) +#define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val)) +#define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st)) +#define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr)) +#define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i)) +#define sk_X509_TRUST_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp)) +#define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st) +#define sk_X509_TRUST_pop_free(st, free_func) SKM_sk_pop_free(X509_TRUST, (st), (free_func)) +#define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) +#define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) +#define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) +#define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st)) + +#define sk_X509_VERIFY_PARAM_new(st) SKM_sk_new(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM) +#define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_value(st, i) SKM_sk_value(X509_VERIFY_PARAM, (st), (i)) +#define sk_X509_VERIFY_PARAM_set(st, i, val) SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val)) +#define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_push(st, val) SKM_sk_push(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_unshift(st, val) SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_find(st, val) SKM_sk_find(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_find_ex(st, val) SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val)) +#define sk_X509_VERIFY_PARAM_delete(st, i) SKM_sk_delete(X509_VERIFY_PARAM, (st), (i)) +#define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr)) +#define sk_X509_VERIFY_PARAM_insert(st, val, i) SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i)) +#define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp)) +#define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st) +#define sk_X509_VERIFY_PARAM_pop_free(st, free_func) SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func)) +#define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st)) +#define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st)) + +#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_ASN1_INTEGER(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_INTEGER(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_ASN1_OBJECT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_OBJECT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_ASN1_TYPE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_OCSP_ONEREQ(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_OCSP_ONEREQ(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS7(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_POLICYINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_POLICYQUALINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_POLICYQUALINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_SXNETID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_ALGOR(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_CRL(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_EXTENSION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_EXTENSION(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func)) + +#define d2i_ASN1_SET_OF_X509_REVOKED(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ + SKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) +#define i2d_ASN1_SET_OF_X509_REVOKED(st, pp, i2d_func, ex_tag, ex_class, is_set) \ + SKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) +#define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \ + SKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len)) +#define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \ + SKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func)) + +#define PKCS12_decrypt_d2i_PKCS12_SAFEBAG(algor, d2i_func, free_func, pass, passlen, oct, seq) \ + SKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) + +#define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \ + SKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) +/* End of util/mkstack.pl block, you may now edit :-) */ + +#endif /* !defined HEADER_SAFESTACK_H */ diff --git a/externals/openssl/sha.h b/externals/openssl/sha.h new file mode 100644 index 0000000..47a2c29 --- /dev/null +++ b/externals/openssl/sha.h @@ -0,0 +1,203 @@ +/* crypto/sha/sha.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SHA_H +#define HEADER_SHA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) +#error SHA is disabled. +#endif + +#if defined(OPENSSL_FIPS) +#define FIPS_SHA_SIZE_T size_t +#endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! SHA_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) +#define SHA_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define SHA_LONG unsigned long +#define SHA_LONG_LOG2 3 +#else +#define SHA_LONG unsigned int +#endif + +#define SHA_LBLOCK 16 +#define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a + * contiguous array of 32 bit + * wide big-endian values. */ +#define SHA_LAST_BLOCK (SHA_CBLOCK-8) +#define SHA_DIGEST_LENGTH 20 + +typedef struct SHAstate_st + { + SHA_LONG h0,h1,h2,h3,h4; + SHA_LONG Nl,Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num; + } SHA_CTX; + +#ifndef OPENSSL_NO_SHA0 +#ifdef OPENSSL_FIPS +int private_SHA_Init(SHA_CTX *c); +#endif +int SHA_Init(SHA_CTX *c); +int SHA_Update(SHA_CTX *c, const void *data, size_t len); +int SHA_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md); +void SHA_Transform(SHA_CTX *c, const unsigned char *data); +#endif +#ifndef OPENSSL_NO_SHA1 +int SHA1_Init(SHA_CTX *c); +int SHA1_Update(SHA_CTX *c, const void *data, size_t len); +int SHA1_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); +void SHA1_Transform(SHA_CTX *c, const unsigned char *data); +#endif + +#define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a + * contiguous array of 32 bit + * wide big-endian values. */ +#define SHA224_DIGEST_LENGTH 28 +#define SHA256_DIGEST_LENGTH 32 + +typedef struct SHA256state_st + { + SHA_LONG h[8]; + SHA_LONG Nl,Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num,md_len; + } SHA256_CTX; + +#ifndef OPENSSL_NO_SHA256 +int SHA224_Init(SHA256_CTX *c); +int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA224_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md); +int SHA256_Init(SHA256_CTX *c); +int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA256_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md); +void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); +#endif + +#define SHA384_DIGEST_LENGTH 48 +#define SHA512_DIGEST_LENGTH 64 + +#ifndef OPENSSL_NO_SHA512 +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +#define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. */ +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +#define SHA_LONG64 unsigned __int64 +#define U64(C) C##UI64 +#elif defined(__arch64__) +#define SHA_LONG64 unsigned long +#define U64(C) C##UL +#else +#define SHA_LONG64 unsigned long long +#define U64(C) C##ULL +#endif + +typedef struct SHA512state_st + { + SHA_LONG64 h[8]; + SHA_LONG64 Nl,Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num,md_len; + } SHA512_CTX; +#endif + +#ifndef OPENSSL_NO_SHA512 +int SHA384_Init(SHA512_CTX *c); +int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA384_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md); +int SHA512_Init(SHA512_CTX *c); +int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA512_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md); +void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/openssl/ssl.h b/externals/openssl/ssl.h new file mode 100644 index 0000000..ff8a128 --- /dev/null +++ b/externals/openssl/ssl.h @@ -0,0 +1,2075 @@ +/* ssl/ssl.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_SSL_H +#define HEADER_SSL_H + +#include + +#ifndef OPENSSL_NO_COMP +#include +#endif +#ifndef OPENSSL_NO_BIO +#include +#endif +#ifndef OPENSSL_NO_DEPRECATED +#ifndef OPENSSL_NO_X509 +#include +#endif +#include +#include +#include +#endif +#include +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* SSLeay version number for ASN.1 encoding of the session information */ +/* Version 0 - initial version + * Version 1 - added the optional peer certificate + */ +#define SSL_SESSION_ASN1_VERSION 0x0001 + +/* text strings for the ciphers */ +#define SSL_TXT_NULL_WITH_MD5 SSL2_TXT_NULL_WITH_MD5 +#define SSL_TXT_RC4_128_WITH_MD5 SSL2_TXT_RC4_128_WITH_MD5 +#define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 +#define SSL_TXT_RC2_128_CBC_WITH_MD5 SSL2_TXT_RC2_128_CBC_WITH_MD5 +#define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 +#define SSL_TXT_IDEA_128_CBC_WITH_MD5 SSL2_TXT_IDEA_128_CBC_WITH_MD5 +#define SSL_TXT_DES_64_CBC_WITH_MD5 SSL2_TXT_DES_64_CBC_WITH_MD5 +#define SSL_TXT_DES_64_CBC_WITH_SHA SSL2_TXT_DES_64_CBC_WITH_SHA +#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 +#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA + +/* VRS Additional Kerberos5 entries + */ +#define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA +#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA +#define SSL_TXT_KRB5_RC4_128_SHA SSL3_TXT_KRB5_RC4_128_SHA +#define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA +#define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 +#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 +#define SSL_TXT_KRB5_RC4_128_MD5 SSL3_TXT_KRB5_RC4_128_MD5 +#define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 + +#define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA +#define SSL_TXT_KRB5_RC2_40_CBC_SHA SSL3_TXT_KRB5_RC2_40_CBC_SHA +#define SSL_TXT_KRB5_RC4_40_SHA SSL3_TXT_KRB5_RC4_40_SHA +#define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 +#define SSL_TXT_KRB5_RC2_40_CBC_MD5 SSL3_TXT_KRB5_RC2_40_CBC_MD5 +#define SSL_TXT_KRB5_RC4_40_MD5 SSL3_TXT_KRB5_RC4_40_MD5 + +#define SSL_TXT_KRB5_DES_40_CBC_SHA SSL3_TXT_KRB5_DES_40_CBC_SHA +#define SSL_TXT_KRB5_DES_40_CBC_MD5 SSL3_TXT_KRB5_DES_40_CBC_MD5 +#define SSL_TXT_KRB5_DES_64_CBC_SHA SSL3_TXT_KRB5_DES_64_CBC_SHA +#define SSL_TXT_KRB5_DES_64_CBC_MD5 SSL3_TXT_KRB5_DES_64_CBC_MD5 +#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA +#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5 +#define SSL_MAX_KRB5_PRINCIPAL_LENGTH 256 + +#define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +#define SSL_MAX_SID_CTX_LENGTH 32 + +#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) +#define SSL_MAX_KEY_ARG_LENGTH 8 +#define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* These are used to specify which ciphers to use and not to use */ +#define SSL_TXT_LOW "LOW" +#define SSL_TXT_MEDIUM "MEDIUM" +#define SSL_TXT_HIGH "HIGH" +#define SSL_TXT_FIPS "FIPS" +#define SSL_TXT_kFZA "kFZA" +#define SSL_TXT_aFZA "aFZA" +#define SSL_TXT_eFZA "eFZA" +#define SSL_TXT_FZA "FZA" + +#define SSL_TXT_aNULL "aNULL" +#define SSL_TXT_eNULL "eNULL" +#define SSL_TXT_NULL "NULL" + +#define SSL_TXT_kKRB5 "kKRB5" +#define SSL_TXT_aKRB5 "aKRB5" +#define SSL_TXT_KRB5 "KRB5" + +#define SSL_TXT_kRSA "kRSA" +#define SSL_TXT_kDHr "kDHr" +#define SSL_TXT_kDHd "kDHd" +#define SSL_TXT_kEDH "kEDH" +#define SSL_TXT_aRSA "aRSA" +#define SSL_TXT_aDSS "aDSS" +#define SSL_TXT_aDH "aDH" +#define SSL_TXT_DSS "DSS" +#define SSL_TXT_DH "DH" +#define SSL_TXT_EDH "EDH" +#define SSL_TXT_ADH "ADH" +#define SSL_TXT_RSA "RSA" +#define SSL_TXT_DES "DES" +#define SSL_TXT_3DES "3DES" +#define SSL_TXT_RC4 "RC4" +#define SSL_TXT_RC2 "RC2" +#define SSL_TXT_IDEA "IDEA" +#define SSL_TXT_SEED "SEED" +#define SSL_TXT_AES "AES" +#define SSL_TXT_CAMELLIA "CAMELLIA" +#define SSL_TXT_MD5 "MD5" +#define SSL_TXT_SHA1 "SHA1" +#define SSL_TXT_SHA "SHA" +#define SSL_TXT_EXP "EXP" +#define SSL_TXT_EXPORT "EXPORT" +#define SSL_TXT_EXP40 "EXPORT40" +#define SSL_TXT_EXP56 "EXPORT56" +#define SSL_TXT_SSLV2 "SSLv2" +#define SSL_TXT_SSLV3 "SSLv3" +#define SSL_TXT_TLSV1 "TLSv1" +#define SSL_TXT_ALL "ALL" +#define SSL_TXT_ECC "ECCdraft" /* ECC ciphersuites are not yet official */ + +/* + * COMPLEMENTOF* definitions. These identifiers are used to (de-select) + * ciphers normally not being used. + * Example: "RC4" will activate all ciphers using RC4 including ciphers + * without authentication, which would normally disabled by DEFAULT (due + * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" + * will make sure that it is also disabled in the specific selection. + * COMPLEMENTOF* identifiers are portable between version, as adjustments + * to the default cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed + * for DEFAULT. + */ +#define SSL_TXT_CMPALL "COMPLEMENTOFALL" +#define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* The following cipher list is used by default. + * It also is substituted when an application-defined cipher list string + * starts with 'DEFAULT'. */ +#define SSL_DEFAULT_CIPHER_LIST "AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH" /* low priority for RC4 */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +#define SSL_SENT_SHUTDOWN 1 +#define SSL_RECEIVED_SHUTDOWN 2 + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2) +#define OPENSSL_NO_SSL2 +#endif + +#define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +#define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +/* This is needed to stop compilers complaining about the + * 'struct ssl_st *' function parameters used to prototype callbacks + * in SSL_CTX. */ +typedef struct ssl_st *ssl_crock_st; + +/* used to hold info on the particular ciphers used */ +typedef struct ssl_cipher_st + { + int valid; + const char *name; /* text name */ + unsigned long id; /* id, 4 bytes, first is version */ + unsigned long algorithms; /* what ciphers are used */ + unsigned long algo_strength; /* strength and export flags */ + unsigned long algorithm2; /* Extra flags */ + int strength_bits; /* Number of bits really used */ + int alg_bits; /* Number of bits for algorithm */ + unsigned long mask; /* used for matching */ + unsigned long mask_strength; /* also used for matching */ + } SSL_CIPHER; + +DECLARE_STACK_OF(SSL_CIPHER) + +/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */ +typedef struct ssl_method_st + { + int version; + int (*ssl_new)(SSL *s); + void (*ssl_clear)(SSL *s); + void (*ssl_free)(SSL *s); + int (*ssl_accept)(SSL *s); + int (*ssl_connect)(SSL *s); + int (*ssl_read)(SSL *s,void *buf,int len); + int (*ssl_peek)(SSL *s,void *buf,int len); + int (*ssl_write)(SSL *s,const void *buf,int len); + int (*ssl_shutdown)(SSL *s); + int (*ssl_renegotiate)(SSL *s); + int (*ssl_renegotiate_check)(SSL *s); + long (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long + max, int *ok); + int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len, + int peek); + int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len); + int (*ssl_dispatch_alert)(SSL *s); + long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg); + long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg); + SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr); + int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr); + int (*ssl_pending)(const SSL *s); + int (*num_ciphers)(void); + SSL_CIPHER *(*get_cipher)(unsigned ncipher); + struct ssl_method_st *(*get_ssl_method)(int version); + long (*get_timeout)(void); + struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */ + int (*ssl_version)(void); + long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void)); + long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void)); + } SSL_METHOD; + +/* Lets make this into an ASN.1 type structure as follows + * SSL_SESSION_ID ::= SEQUENCE { + * version INTEGER, -- structure version number + * SSLversion INTEGER, -- SSL version number + * Cipher OCTET_STRING, -- the 3 byte cipher ID + * Session_ID OCTET_STRING, -- the Session ID + * Master_key OCTET_STRING, -- the master key + * KRB5_principal OCTET_STRING -- optional Kerberos principal + * Key_Arg [ 0 ] IMPLICIT OCTET_STRING, -- the optional Key argument + * Time [ 1 ] EXPLICIT INTEGER, -- optional Start Time + * Timeout [ 2 ] EXPLICIT INTEGER, -- optional Timeout ins seconds + * Peer [ 3 ] EXPLICIT X509, -- optional Peer Certificate + * Session_ID_context [ 4 ] EXPLICIT OCTET_STRING, -- the Session ID context + * Verify_result [ 5 ] EXPLICIT INTEGER -- X509_V_... code for `Peer' + * Compression [6] IMPLICIT ASN1_OBJECT -- compression OID XXXXX + * } + * Look in ssl/ssl_asn1.c for more details + * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-). + */ +typedef struct ssl_session_st + { + int ssl_version; /* what ssl version session info is + * being kept in here? */ + + /* only really used in SSLv2 */ + unsigned int key_arg_length; + unsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH]; + int master_key_length; + unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH]; + /* session_id - valid? */ + unsigned int session_id_length; + unsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH]; + /* this is used to determine whether the session is being reused in + * the appropriate context. It is up to the application to set this, + * via SSL_new */ + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + +#ifndef OPENSSL_NO_KRB5 + unsigned int krb5_client_princ_len; + unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH]; +#endif /* OPENSSL_NO_KRB5 */ + + int not_resumable; + + /* The cert is the certificate used to establish this connection */ + struct sess_cert_st /* SESS_CERT */ *sess_cert; + + /* This is the cert for the other end. + * On clients, it will be the same as sess_cert->peer_key->x509 + * (the latter is not enough as sess_cert is not retained + * in the external representation of sessions, see ssl_asn1.c). */ + X509 *peer; + /* when app_verify_callback accepts a session where the peer's certificate + * is not ok, we must remember the error for session reuse: */ + long verify_result; /* only for servers */ + + int references; + long timeout; + long time; + + int compress_meth; /* Need to lookup the method */ + + SSL_CIPHER *cipher; + unsigned long cipher_id; /* when ASN.1 loaded, this + * needs to be used to load + * the 'cipher' structure */ + + STACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */ + + CRYPTO_EX_DATA ex_data; /* application specific data */ + + /* These are used to make removal of session-ids more + * efficient and to implement a maximum cache size. */ + struct ssl_session_st *prev,*next; +#ifndef OPENSSL_NO_TLSEXT + char *tlsext_hostname; + /* RFC4507 info */ + unsigned char *tlsext_tick; /* Session ticket */ + size_t tlsext_ticklen; /* Session ticket length */ + long tlsext_tick_lifetime_hint; /* Session lifetime hint in seconds */ +#endif + } SSL_SESSION; + + +#define SSL_OP_MICROSOFT_SESS_ID_BUG 0x00000001L +#define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x00000002L +#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L +#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L +#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L +#define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x00000040L /* no effect since 0.9.7h and 0.9.8b */ +#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L +#define SSL_OP_TLS_D5_BUG 0x00000100L +#define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L + +/* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added + * in OpenSSL 0.9.6d. Usually (depending on the application protocol) + * the workaround is not needed. Unfortunately some broken SSL/TLS + * implementations cannot handle it at all, which is why we include + * it in SSL_OP_ALL. */ +#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800L /* added in 0.9.6e */ + +/* SSL_OP_ALL: various bug workarounds that should be rather harmless. + * This used to be 0x000FFFFFL before 0.9.7. */ +#define SSL_OP_ALL 0x00000FFFL + +/* DTLS options */ +#define SSL_OP_NO_QUERY_MTU 0x00001000L +/* Turn on Cookie Exchange (on relevant for servers) */ +#define SSL_OP_COOKIE_EXCHANGE 0x00002000L +/* Don't use RFC4507 ticket extension */ +#define SSL_OP_NO_TICKET 0x00004000L + +/* As server, disallow session resumption on renegotiation */ +#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L +/* If set, always create a new key when using tmp_ecdh parameters */ +#define SSL_OP_SINGLE_ECDH_USE 0x00080000L +/* If set, always create a new key when using tmp_dh parameters */ +#define SSL_OP_SINGLE_DH_USE 0x00100000L +/* Set to always use the tmp_rsa key when doing RSA operations, + * even when this violates protocol specs */ +#define SSL_OP_EPHEMERAL_RSA 0x00200000L +/* Set on servers to choose the cipher according to the server's + * preferences */ +#define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000L +/* If set, a server will allow a client to issue a SSLv3.0 version number + * as latest version supported in the premaster secret, even when TLSv1.0 + * (version 3.1) was announced in the client hello. Normally this is + * forbidden to prevent version rollback attacks. */ +#define SSL_OP_TLS_ROLLBACK_BUG 0x00800000L + +#define SSL_OP_NO_SSLv2 0x01000000L +#define SSL_OP_NO_SSLv3 0x02000000L +#define SSL_OP_NO_TLSv1 0x04000000L + +/* The next flag deliberately changes the ciphertest, this is a check + * for the PKCS#1 attack */ +#define SSL_OP_PKCS1_CHECK_1 0x08000000L +#define SSL_OP_PKCS1_CHECK_2 0x10000000L +#define SSL_OP_NETSCAPE_CA_DN_BUG 0x20000000L +#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x40000000L + + +/* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success + * when just a single record has been written): */ +#define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001L +/* Make it possible to retry SSL_write() with changed buffer location + * (buffer contents must stay the same!); this is not the default to avoid + * the misconception that non-blocking SSL_write() behaves like + * non-blocking write(): */ +#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L +/* Never bother the application with retries if the transport + * is blocking: */ +#define SSL_MODE_AUTO_RETRY 0x00000004L +/* Don't attempt to automatically build certificate chain */ +#define SSL_MODE_NO_AUTO_CHAIN 0x00000008L + + +/* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, + * they cannot be used to clear bits. */ + +#define SSL_CTX_set_options(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL) +#define SSL_CTX_get_options(ctx) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL) +#define SSL_set_options(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL) +#define SSL_get_options(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL) + +#define SSL_CTX_set_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) +#define SSL_CTX_get_mode(ctx) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) +#define SSL_set_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) +#define SSL_get_mode(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) +#define SSL_set_mtu(ssl, mtu) \ + SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) + + +void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); +void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); +#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) +#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) + + + +#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) +#define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */ +#else +#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */ +#endif + +#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) + +/* This callback type is used inside SSL_CTX, SSL, and in the functions that set + * them. It is used to override the generation of SSL/TLS session IDs in a + * server. Return value should be zero on an error, non-zero to proceed. Also, + * callbacks should themselves check if the id they generate is unique otherwise + * the SSL handshake will fail with an error - callbacks can do this using the + * 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) + * The length value passed in is set at the maximum size the session ID can be. + * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback + * can alter this length to be less if desired, but under SSLv2 session IDs are + * supposed to be fixed at 16 bytes so the id will be padded after the callback + * returns in this case. It is also an error for the callback to set the size to + * zero. */ +typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, + unsigned int *id_len); + +typedef struct ssl_comp_st + { + int id; + const char *name; +#ifndef OPENSSL_NO_COMP + COMP_METHOD *method; +#else + char *method; +#endif + } SSL_COMP; + +DECLARE_STACK_OF(SSL_COMP) + +struct ssl_ctx_st + { + SSL_METHOD *method; + + STACK_OF(SSL_CIPHER) *cipher_list; + /* same as above but sorted for lookup */ + STACK_OF(SSL_CIPHER) *cipher_list_by_id; + + struct x509_store_st /* X509_STORE */ *cert_store; + struct lhash_st /* LHASH */ *sessions; /* a set of SSL_SESSIONs */ + /* Most session-ids that will be cached, default is + * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */ + unsigned long session_cache_size; + struct ssl_session_st *session_cache_head; + struct ssl_session_st *session_cache_tail; + + /* This can have one of 2 values, ored together, + * SSL_SESS_CACHE_CLIENT, + * SSL_SESS_CACHE_SERVER, + * Default is SSL_SESSION_CACHE_SERVER, which means only + * SSL_accept which cache SSL_SESSIONS. */ + int session_cache_mode; + + /* If timeout is not 0, it is the default timeout value set + * when SSL_new() is called. This has been put in to make + * life easier to set things up */ + long session_timeout; + + /* If this callback is not null, it will be called each + * time a session id is added to the cache. If this function + * returns 1, it means that the callback will do a + * SSL_SESSION_free() when it has finished using it. Otherwise, + * on 0, it means the callback has finished with it. + * If remove_session_cb is not null, it will be called when + * a session-id is removed from the cache. After the call, + * OpenSSL will SSL_SESSION_free() it. */ + int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess); + void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess); + SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, + unsigned char *data,int len,int *copy); + + struct + { + int sess_connect; /* SSL new conn - started */ + int sess_connect_renegotiate;/* SSL reneg - requested */ + int sess_connect_good; /* SSL new conne/reneg - finished */ + int sess_accept; /* SSL new accept - started */ + int sess_accept_renegotiate;/* SSL reneg - requested */ + int sess_accept_good; /* SSL accept/reneg - finished */ + int sess_miss; /* session lookup misses */ + int sess_timeout; /* reuse attempt on timeouted session */ + int sess_cache_full; /* session removed due to full cache */ + int sess_hit; /* session reuse actually done */ + int sess_cb_hit; /* session-id that was not + * in the cache was + * passed back via the callback. This + * indicates that the application is + * supplying session-id's from other + * processes - spooky :-) */ + } stats; + + int references; + + /* if defined, these override the X509_verify_cert() calls */ + int (*app_verify_callback)(X509_STORE_CTX *, void *); + void *app_verify_arg; + /* before OpenSSL 0.9.7, 'app_verify_arg' was ignored + * ('app_verify_callback' was called with just one argument) */ + + /* Default password callback. */ + pem_password_cb *default_passwd_callback; + + /* Default password callback user data. */ + void *default_passwd_callback_userdata; + + /* get client cert callback */ + int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); + + /* cookie generate callback */ + int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, + unsigned int *cookie_len); + + /* verify cookie callback */ + int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, + unsigned int cookie_len); + + CRYPTO_EX_DATA ex_data; + + const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */ + const EVP_MD *md5; /* For SSLv3/TLSv1 'ssl3-md5' */ + const EVP_MD *sha1; /* For SSLv3/TLSv1 'ssl3->sha1' */ + + STACK_OF(X509) *extra_certs; + STACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */ + + + /* Default values used when no per-SSL value is defined follow */ + + void (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */ + + /* what we put in client cert requests */ + STACK_OF(X509_NAME) *client_CA; + + + /* Default values to use in SSL structures follow (these are copied by SSL_new) */ + + unsigned long options; + unsigned long mode; + long max_cert_list; + + struct cert_st /* CERT */ *cert; + int read_ahead; + + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); + void *msg_callback_arg; + + int verify_mode; + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */ + + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + + X509_VERIFY_PARAM *param; + +#if 0 + int purpose; /* Purpose setting */ + int trust; /* Trust setting */ +#endif + + int quiet_shutdown; + +#ifndef OPENSSL_ENGINE + /* Engine to pass requests for client certs to + */ + ENGINE *client_cert_engine; +#endif + +#ifndef OPENSSL_NO_TLSEXT + /* TLS extensions servername callback */ + int (*tlsext_servername_callback)(SSL*, int *, void *); + void *tlsext_servername_arg; + /* RFC 4507 session ticket keys */ + unsigned char tlsext_tick_key_name[16]; + unsigned char tlsext_tick_hmac_key[16]; + unsigned char tlsext_tick_aes_key[16]; + /* Callback to support customisation of ticket key setting */ + int (*tlsext_ticket_key_cb)(SSL *ssl, + unsigned char *name, unsigned char *iv, + EVP_CIPHER_CTX *ectx, + HMAC_CTX *hctx, int enc); + + /* certificate status request info */ + /* Callback for status request */ + int (*tlsext_status_cb)(SSL *ssl, void *arg); + void *tlsext_status_arg; +#endif + + }; + +#define SSL_SESS_CACHE_OFF 0x0000 +#define SSL_SESS_CACHE_CLIENT 0x0001 +#define SSL_SESS_CACHE_SERVER 0x0002 +#define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) +#define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ +#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +#define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +#define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) + + struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx); +#define SSL_CTX_sess_number(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) +#define SSL_CTX_sess_connect(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) +#define SSL_CTX_sess_connect_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) +#define SSL_CTX_sess_connect_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) +#define SSL_CTX_sess_accept(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) +#define SSL_CTX_sess_accept_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) +#define SSL_CTX_sess_accept_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) +#define SSL_CTX_sess_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) +#define SSL_CTX_sess_cb_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) +#define SSL_CTX_sess_misses(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) +#define SSL_CTX_sess_timeouts(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) +#define SSL_CTX_sess_cache_full(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) + +void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess)); +int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess); +void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess)); +void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess); +void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,int len,int *copy)); +SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *Data, int len, int *copy); +void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,int type,int val)); +void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl,int type,int val); +void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); +int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); +#ifndef OPENSSL_NO_ENGINE +int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); +#endif +void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)); +void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len)); + +#define SSL_NOTHING 1 +#define SSL_WRITING 2 +#define SSL_READING 3 +#define SSL_X509_LOOKUP 4 + +/* These will only be used when doing non-blocking IO */ +#define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +#define SSL_want_read(s) (SSL_want(s) == SSL_READING) +#define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +#define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) + +struct ssl_st + { + /* protocol version + * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION) + */ + int version; + int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */ + + SSL_METHOD *method; /* SSLv3 */ + + /* There are 2 BIO's even though they are normally both the + * same. This is so data can be read and written to different + * handlers */ + +#ifndef OPENSSL_NO_BIO + BIO *rbio; /* used by SSL_read */ + BIO *wbio; /* used by SSL_write */ + BIO *bbio; /* used during session-id reuse to concatenate + * messages */ +#else + char *rbio; /* used by SSL_read */ + char *wbio; /* used by SSL_write */ + char *bbio; +#endif + /* This holds a variable that indicates what we were doing + * when a 0 or -1 is returned. This is needed for + * non-blocking IO so we know what request needs re-doing when + * in SSL_accept or SSL_connect */ + int rwstate; + + /* true when we are actually in SSL_accept() or SSL_connect() */ + int in_handshake; + int (*handshake_func)(SSL *); + + /* Imagine that here's a boolean member "init" that is + * switched as soon as SSL_set_{accept/connect}_state + * is called for the first time, so that "state" and + * "handshake_func" are properly initialized. But as + * handshake_func is == 0 until then, we use this + * test instead of an "init" member. + */ + + int server; /* are we the server side? - mostly used by SSL_clear*/ + + int new_session;/* 1 if we are to use a new session. + * 2 if we are a server and are inside a handshake + * (i.e. not just sending a HelloRequest) + * NB: For servers, the 'new' session may actually be a previously + * cached session or even the previous session unless + * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */ + int quiet_shutdown;/* don't send shutdown packets */ + int shutdown; /* we have shut things down, 0x01 sent, 0x02 + * for received */ + int state; /* where we are */ + int rstate; /* where we are when reading */ + + BUF_MEM *init_buf; /* buffer used during init */ + void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */ + int init_num; /* amount read/written */ + int init_off; /* amount read/written */ + + /* used internally to point at a raw packet */ + unsigned char *packet; + unsigned int packet_length; + + struct ssl2_state_st *s2; /* SSLv2 variables */ + struct ssl3_state_st *s3; /* SSLv3 variables */ + struct dtls1_state_st *d1; /* DTLSv1 variables */ + + int read_ahead; /* Read as many input bytes as possible + * (for non-blocking reads) */ + + /* callback that allows applications to peek at protocol messages */ + void (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); + void *msg_callback_arg; + + int hit; /* reusing a previous session */ + + X509_VERIFY_PARAM *param; + +#if 0 + int purpose; /* Purpose setting */ + int trust; /* Trust setting */ +#endif + + /* crypto */ + STACK_OF(SSL_CIPHER) *cipher_list; + STACK_OF(SSL_CIPHER) *cipher_list_by_id; + + /* These are the ones being used, the ones in SSL_SESSION are + * the ones to be 'copied' into these ones */ + + EVP_CIPHER_CTX *enc_read_ctx; /* cryptographic state */ + const EVP_MD *read_hash; /* used for mac generation */ +#ifndef OPENSSL_NO_COMP + COMP_CTX *expand; /* uncompress */ +#else + char *expand; +#endif + + EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ + const EVP_MD *write_hash; /* used for mac generation */ +#ifndef OPENSSL_NO_COMP + COMP_CTX *compress; /* compression */ +#else + char *compress; +#endif + + /* session info */ + + /* client cert? */ + /* This is used to hold the server certificate used */ + struct cert_st /* CERT */ *cert; + + /* the session_id_context is used to ensure sessions are only reused + * in the appropriate context */ + unsigned int sid_ctx_length; + unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH]; + + /* This can also be in the session once a session is established */ + SSL_SESSION *session; + + /* Default generate session ID callback. */ + GEN_SESSION_CB generate_session_id; + + /* Used in SSL2 and SSL3 */ + int verify_mode; /* 0 don't care about verify failure. + * 1 fail if verify fails */ + int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */ + + void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */ + + int error; /* error bytes to be written */ + int error_code; /* actual code */ + +#ifndef OPENSSL_NO_KRB5 + KSSL_CTX *kssl_ctx; /* Kerberos 5 context */ +#endif /* OPENSSL_NO_KRB5 */ + + SSL_CTX *ctx; + /* set this flag to 1 and a sleep(1) is put into all SSL_read() + * and SSL_write() calls, good for nbio debuging :-) */ + int debug; + + /* extra application data */ + long verify_result; + CRYPTO_EX_DATA ex_data; + + /* for server side, keep the list of CA_dn we can use */ + STACK_OF(X509_NAME) *client_CA; + + int references; + unsigned long options; /* protocol behaviour */ + unsigned long mode; /* API behaviour */ + long max_cert_list; + int first_packet; + int client_version; /* what was passed, used for + * SSLv3/TLS rollback check */ +#ifndef OPENSSL_NO_TLSEXT + /* TLS extension debug callback */ + void (*tlsext_debug_cb)(SSL *s, int client_server, int type, + unsigned char *data, int len, + void *arg); + void *tlsext_debug_arg; + char *tlsext_hostname; + int servername_done; /* no further mod of servername + 0 : call the servername extension callback. + 1 : prepare 2, allow last ack just after in server callback. + 2 : don't call servername callback, no ack in server hello + */ + /* certificate status request info */ + /* Status type or -1 if no status type */ + int tlsext_status_type; + /* Expect OCSP CertificateStatus message */ + int tlsext_status_expected; + /* OCSP status request only */ + STACK_OF(OCSP_RESPID) *tlsext_ocsp_ids; + X509_EXTENSIONS *tlsext_ocsp_exts; + /* OCSP response received or to be sent */ + unsigned char *tlsext_ocsp_resp; + int tlsext_ocsp_resplen; + + /* RFC4507 session ticket expected to be received or sent */ + int tlsext_ticket_expected; + SSL_CTX * initial_ctx; /* initial ctx, used to store sessions */ +#define session_ctx initial_ctx +#else +#define session_ctx ctx +#endif + }; + +#ifdef __cplusplus +} +#endif + +#include +#include +#include /* This is mostly sslv3 with a few tweaks */ +#include /* Datagram TLS */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* compatibility */ +#define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)arg)) +#define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) +#define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0,(char *)a)) +#define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) +#define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) +#define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0,(char *)arg)) + +/* The following are the possible values for ssl->state are are + * used to indicate where we are up to in the SSL connection establishment. + * The macros that follow are about the only things you should need to use + * and even then, only when using non-blocking IO. + * It can also be useful to work out where you were when the connection + * failed */ + +#define SSL_ST_CONNECT 0x1000 +#define SSL_ST_ACCEPT 0x2000 +#define SSL_ST_MASK 0x0FFF +#define SSL_ST_INIT (SSL_ST_CONNECT|SSL_ST_ACCEPT) +#define SSL_ST_BEFORE 0x4000 +#define SSL_ST_OK 0x03 +#define SSL_ST_RENEGOTIATE (0x04|SSL_ST_INIT) + +#define SSL_CB_LOOP 0x01 +#define SSL_CB_EXIT 0x02 +#define SSL_CB_READ 0x04 +#define SSL_CB_WRITE 0x08 +#define SSL_CB_ALERT 0x4000 /* used in callback */ +#define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) +#define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) +#define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) +#define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) +#define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) +#define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) +#define SSL_CB_HANDSHAKE_START 0x10 +#define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +#define SSL_get_state(a) SSL_state(a) +#define SSL_is_init_finished(a) (SSL_state(a) == SSL_ST_OK) +#define SSL_in_init(a) (SSL_state(a)&SSL_ST_INIT) +#define SSL_in_before(a) (SSL_state(a)&SSL_ST_BEFORE) +#define SSL_in_connect_init(a) (SSL_state(a)&SSL_ST_CONNECT) +#define SSL_in_accept_init(a) (SSL_state(a)&SSL_ST_ACCEPT) + +/* The following 2 states are kept in ssl->rstate when reads fail, + * you should not need these */ +#define SSL_ST_READ_HEADER 0xF0 +#define SSL_ST_READ_BODY 0xF1 +#define SSL_ST_READ_DONE 0xF2 + +/* Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. */ +size_t SSL_get_finished(const SSL *s, void *buf, size_t count); +size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); + +/* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options + * are 'ored' with SSL_VERIFY_PEER if they are desired */ +#define SSL_VERIFY_NONE 0x00 +#define SSL_VERIFY_PEER 0x01 +#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +#define SSL_VERIFY_CLIENT_ONCE 0x04 + +#define OpenSSL_add_ssl_algorithms() SSL_library_init() +#define SSLeay_add_ssl_algorithms() SSL_library_init() + +/* this is for backward compatibility */ +#if 0 /* NEW_SSLEAY */ +#define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c) +#define SSL_set_pref_cipher(c,n) SSL_set_cipher_list(c,n) +#define SSL_add_session(a,b) SSL_CTX_add_session((a),(b)) +#define SSL_remove_session(a,b) SSL_CTX_remove_session((a),(b)) +#define SSL_flush_sessions(a,b) SSL_CTX_flush_sessions((a),(b)) +#endif +/* More backward compatibility */ +#define SSL_get_cipher(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_cipher_bits(s,np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) +#define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +#define SSL_get_cipher_name(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +#define SSL_get_time(a) SSL_SESSION_get_time(a) +#define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) +#define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +#define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) + +#if 1 /*SSLEAY_MACROS*/ +#define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) +#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) +#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \ + (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u) +#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) PEM_ASN1_read_bio_of(SSL_SESSION,d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,cb,u) +#define PEM_write_SSL_SESSION(fp,x) \ + PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ + PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL) +#define PEM_write_bio_SSL_SESSION(bp,x) \ + PEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,NULL,NULL,0,NULL,NULL) +#endif + +#define SSL_AD_REASON_OFFSET 1000 +/* These alert types are for SSLv3 and TLSv1 */ +#define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +#define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE /* fatal */ +#define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC /* fatal */ +#define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +#define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +#define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE/* fatal */ +#define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE/* fatal */ +#define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE /* Not for TLS */ +#define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +#define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +#define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +#define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +#define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +#define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER /* fatal */ +#define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA /* fatal */ +#define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED /* fatal */ +#define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR /* fatal */ +#define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +#define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION/* fatal */ +#define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION /* fatal */ +#define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY/* fatal */ +#define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR /* fatal */ +#define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +#define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION +#define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION +#define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE +#define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME +#define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE + +#define SSL_ERROR_NONE 0 +#define SSL_ERROR_SSL 1 +#define SSL_ERROR_WANT_READ 2 +#define SSL_ERROR_WANT_WRITE 3 +#define SSL_ERROR_WANT_X509_LOOKUP 4 +#define SSL_ERROR_SYSCALL 5 /* look at error stack/return value/errno */ +#define SSL_ERROR_ZERO_RETURN 6 +#define SSL_ERROR_WANT_CONNECT 7 +#define SSL_ERROR_WANT_ACCEPT 8 + +#define SSL_CTRL_NEED_TMP_RSA 1 +#define SSL_CTRL_SET_TMP_RSA 2 +#define SSL_CTRL_SET_TMP_DH 3 +#define SSL_CTRL_SET_TMP_ECDH 4 +#define SSL_CTRL_SET_TMP_RSA_CB 5 +#define SSL_CTRL_SET_TMP_DH_CB 6 +#define SSL_CTRL_SET_TMP_ECDH_CB 7 + +#define SSL_CTRL_GET_SESSION_REUSED 8 +#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 +#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 +#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +#define SSL_CTRL_GET_FLAGS 13 +#define SSL_CTRL_EXTRA_CHAIN_CERT 14 + +#define SSL_CTRL_SET_MSG_CALLBACK 15 +#define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 + +/* only applies to datagram connections */ +#define SSL_CTRL_SET_MTU 17 +/* Stats */ +#define SSL_CTRL_SESS_NUMBER 20 +#define SSL_CTRL_SESS_CONNECT 21 +#define SSL_CTRL_SESS_CONNECT_GOOD 22 +#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 +#define SSL_CTRL_SESS_ACCEPT 24 +#define SSL_CTRL_SESS_ACCEPT_GOOD 25 +#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 +#define SSL_CTRL_SESS_HIT 27 +#define SSL_CTRL_SESS_CB_HIT 28 +#define SSL_CTRL_SESS_MISSES 29 +#define SSL_CTRL_SESS_TIMEOUTS 30 +#define SSL_CTRL_SESS_CACHE_FULL 31 +#define SSL_CTRL_OPTIONS 32 +#define SSL_CTRL_MODE 33 + +#define SSL_CTRL_GET_READ_AHEAD 40 +#define SSL_CTRL_SET_READ_AHEAD 41 +#define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +#define SSL_CTRL_GET_SESS_CACHE_SIZE 43 +#define SSL_CTRL_SET_SESS_CACHE_MODE 44 +#define SSL_CTRL_GET_SESS_CACHE_MODE 45 + +#define SSL_CTRL_GET_MAX_CERT_LIST 50 +#define SSL_CTRL_SET_MAX_CERT_LIST 51 + +/* see tls1.h for macros based on these */ +#ifndef OPENSSL_NO_TLSEXT +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 +#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 +#define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +#define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 +#define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 +#define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 +#define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 + +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 +#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 +#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 + +#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 +#endif + +#define SSL_session_reused(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL) +#define SSL_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) +#define SSL_clear_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) +#define SSL_total_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) + +#define SSL_CTX_need_tmp_RSA(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL) +#define SSL_CTX_set_tmp_rsa(ctx,rsa) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) +#define SSL_CTX_set_tmp_dh(ctx,dh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh) +#define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) + +#define SSL_need_tmp_RSA(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL) +#define SSL_set_tmp_rsa(ssl,rsa) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa) +#define SSL_set_tmp_dh(ssl,dh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh) +#define SSL_set_tmp_ecdh(ssl,ecdh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh) + +#define SSL_CTX_add_extra_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509) + +#ifndef OPENSSL_NO_BIO +BIO_METHOD *BIO_f_ssl(void); +BIO *BIO_new_ssl(SSL_CTX *ctx,int client); +BIO *BIO_new_ssl_connect(SSL_CTX *ctx); +BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); +int BIO_ssl_copy_session_id(BIO *to,BIO *from); +void BIO_ssl_shutdown(BIO *ssl_bio); + +#endif + +int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str); +SSL_CTX *SSL_CTX_new(SSL_METHOD *meth); +void SSL_CTX_free(SSL_CTX *); +long SSL_CTX_set_timeout(SSL_CTX *ctx,long t); +long SSL_CTX_get_timeout(const SSL_CTX *ctx); +X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); +void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *); +int SSL_want(const SSL *s); +int SSL_clear(SSL *s); + +void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm); + +SSL_CIPHER *SSL_get_current_cipher(const SSL *s); +int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits); +char * SSL_CIPHER_get_version(const SSL_CIPHER *c); +const char * SSL_CIPHER_get_name(const SSL_CIPHER *c); + +int SSL_get_fd(const SSL *s); +int SSL_get_rfd(const SSL *s); +int SSL_get_wfd(const SSL *s); +const char * SSL_get_cipher_list(const SSL *s,int n); +char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len); +int SSL_get_read_ahead(const SSL * s); +int SSL_pending(const SSL *s); +#ifndef OPENSSL_NO_SOCK +int SSL_set_fd(SSL *s, int fd); +int SSL_set_rfd(SSL *s, int fd); +int SSL_set_wfd(SSL *s, int fd); +#endif +#ifndef OPENSSL_NO_BIO +void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio); +BIO * SSL_get_rbio(const SSL *s); +BIO * SSL_get_wbio(const SSL *s); +#endif +int SSL_set_cipher_list(SSL *s, const char *str); +void SSL_set_read_ahead(SSL *s, int yes); +int SSL_get_verify_mode(const SSL *s); +int SSL_get_verify_depth(const SSL *s); +int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *); +void SSL_set_verify(SSL *s, int mode, + int (*callback)(int ok,X509_STORE_CTX *ctx)); +void SSL_set_verify_depth(SSL *s, int depth); +#ifndef OPENSSL_NO_RSA +int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); +#endif +int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); +int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); +int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len); +int SSL_use_certificate(SSL *ssl, X509 *x); +int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); + +#ifndef OPENSSL_NO_STDIO +int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); +int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); +int SSL_use_certificate_file(SSL *ssl, const char *file, int type); +int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type); +int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type); +int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type); +int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */ +STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); +int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *file); +#ifndef OPENSSL_SYS_VMS +#ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */ +int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *dir); +#endif +#endif + +#endif + +void SSL_load_error_strings(void ); +const char *SSL_state_string(const SSL *s); +const char *SSL_rstate_string(const SSL *s); +const char *SSL_state_string_long(const SSL *s); +const char *SSL_rstate_string_long(const SSL *s); +long SSL_SESSION_get_time(const SSL_SESSION *s); +long SSL_SESSION_set_time(SSL_SESSION *s, long t); +long SSL_SESSION_get_timeout(const SSL_SESSION *s); +long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +void SSL_copy_session_id(SSL *to,const SSL *from); + +SSL_SESSION *SSL_SESSION_new(void); +unsigned long SSL_SESSION_hash(const SSL_SESSION *a); +int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b); +const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len); +#ifndef OPENSSL_NO_FP_API +int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses); +#endif +#ifndef OPENSSL_NO_BIO +int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses); +#endif +void SSL_SESSION_free(SSL_SESSION *ses); +int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp); +int SSL_set_session(SSL *to, SSL_SESSION *session); +int SSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c); +int SSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c); +int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB); +int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB); +int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, + unsigned int id_len); +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp, + long length); + +#ifdef HEADER_X509_H +X509 * SSL_get_peer_certificate(const SSL *s); +#endif + +STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); + +int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); +int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); +int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *); +void SSL_CTX_set_verify(SSL_CTX *ctx,int mode, + int (*callback)(int, X509_STORE_CTX *)); +void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); +void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg); +#ifndef OPENSSL_NO_RSA +int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); +#endif +int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len); +int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); +int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx, + const unsigned char *d, long len); +int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); +int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d); + +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); + +int SSL_CTX_check_private_key(const SSL_CTX *ctx); +int SSL_check_private_key(const SSL *ctx); + +int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +SSL * SSL_new(SSL_CTX *ctx); +int SSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +int SSL_CTX_set_purpose(SSL_CTX *s, int purpose); +int SSL_set_purpose(SSL *s, int purpose); +int SSL_CTX_set_trust(SSL_CTX *s, int trust); +int SSL_set_trust(SSL *s, int trust); + +void SSL_free(SSL *ssl); +int SSL_accept(SSL *ssl); +int SSL_connect(SSL *ssl); +int SSL_read(SSL *ssl,void *buf,int num); +int SSL_peek(SSL *ssl,void *buf,int num); +int SSL_write(SSL *ssl,const void *buf,int num); +long SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg); +long SSL_callback_ctrl(SSL *, int, void (*)(void)); +long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg); +long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); + +int SSL_get_error(const SSL *s,int ret_code); +const char *SSL_get_version(const SSL *s); + +/* This sets the 'default' SSL version that SSL_new() will create */ +int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth); + +SSL_METHOD *SSLv2_method(void); /* SSLv2 */ +SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */ +SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */ + +SSL_METHOD *SSLv3_method(void); /* SSLv3 */ +SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */ +SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */ + +SSL_METHOD *SSLv23_method(void); /* SSLv3 but can rollback to v2 */ +SSL_METHOD *SSLv23_server_method(void); /* SSLv3 but can rollback to v2 */ +SSL_METHOD *SSLv23_client_method(void); /* SSLv3 but can rollback to v2 */ + +SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ +SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ +SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ + +SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */ +SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */ +SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */ + +STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); + +int SSL_do_handshake(SSL *s); +int SSL_renegotiate(SSL *s); +int SSL_renegotiate_pending(SSL *s); +int SSL_shutdown(SSL *s); + +SSL_METHOD *SSL_get_ssl_method(SSL *s); +int SSL_set_ssl_method(SSL *s,SSL_METHOD *method); +const char *SSL_alert_type_string_long(int value); +const char *SSL_alert_type_string(int value); +const char *SSL_alert_desc_string_long(int value); +const char *SSL_alert_desc_string(int value); + +void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); +STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); +int SSL_add_client_CA(SSL *ssl,X509 *x); +int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x); + +void SSL_set_connect_state(SSL *s); +void SSL_set_accept_state(SSL *s); + +long SSL_get_default_timeout(const SSL *s); + +int SSL_library_init(void ); + +char *SSL_CIPHER_description(SSL_CIPHER *,char *buf,int size); +STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk); + +SSL *SSL_dup(SSL *ssl); + +X509 *SSL_get_certificate(const SSL *ssl); +/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl); + +void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode); +int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); +void SSL_set_quiet_shutdown(SSL *ssl,int mode); +int SSL_get_quiet_shutdown(const SSL *ssl); +void SSL_set_shutdown(SSL *ssl,int mode); +int SSL_get_shutdown(const SSL *ssl); +int SSL_version(const SSL *ssl); +int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); +int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, + const char *CApath); +#define SSL_get0_session SSL_get_session /* just peek at pointer */ +SSL_SESSION *SSL_get_session(const SSL *ssl); +SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ +SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); +SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx); +void SSL_set_info_callback(SSL *ssl, + void (*cb)(const SSL *ssl,int type,int val)); +void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val); +int SSL_state(const SSL *ssl); + +void SSL_set_verify_result(SSL *ssl,long v); +long SSL_get_verify_result(const SSL *ssl); + +int SSL_set_ex_data(SSL *ssl,int idx,void *data); +void *SSL_get_ex_data(const SSL *ssl,int idx); +int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); + +int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data); +void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx); +int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); + +int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data); +void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx); +int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); + +int SSL_get_ex_data_X509_STORE_CTX_idx(void ); + +#define SSL_CTX_sess_set_cache_size(ctx,t) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) +#define SSL_CTX_sess_get_cache_size(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) +#define SSL_CTX_set_session_cache_mode(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) +#define SSL_CTX_get_session_cache_mode(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) + +#define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) +#define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) +#define SSL_CTX_get_read_ahead(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) +#define SSL_CTX_set_read_ahead(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) +#define SSL_CTX_get_max_cert_list(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +#define SSL_CTX_set_max_cert_list(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) +#define SSL_get_max_cert_list(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +#define SSL_set_max_cert_list(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) + + /* NB: the keylength is only applicable when is_export is true */ +#ifndef OPENSSL_NO_RSA +void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, + RSA *(*cb)(SSL *ssl,int is_export, + int keylength)); + +void SSL_set_tmp_rsa_callback(SSL *ssl, + RSA *(*cb)(SSL *ssl,int is_export, + int keylength)); +#endif +#ifndef OPENSSL_NO_DH +void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, + DH *(*dh)(SSL *ssl,int is_export, + int keylength)); +void SSL_set_tmp_dh_callback(SSL *ssl, + DH *(*dh)(SSL *ssl,int is_export, + int keylength)); +#endif +#ifndef OPENSSL_NO_ECDH +void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx, + EC_KEY *(*ecdh)(SSL *ssl,int is_export, + int keylength)); +void SSL_set_tmp_ecdh_callback(SSL *ssl, + EC_KEY *(*ecdh)(SSL *ssl,int is_export, + int keylength)); +#endif + +#ifndef OPENSSL_NO_COMP +const COMP_METHOD *SSL_get_current_compression(SSL *s); +const COMP_METHOD *SSL_get_current_expansion(SSL *s); +const char *SSL_COMP_get_name(const COMP_METHOD *comp); +STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); +int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm); +#else +const void *SSL_get_current_compression(SSL *s); +const void *SSL_get_current_expansion(SSL *s); +const char *SSL_COMP_get_name(const void *comp); +void *SSL_COMP_get_compression_methods(void); +int SSL_COMP_add_compression_method(int id,void *cm); +#endif + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_SSL_strings(void); + +/* Error codes for the SSL functions. */ + +/* Function codes. */ +#define SSL_F_CLIENT_CERTIFICATE 100 +#define SSL_F_CLIENT_FINISHED 167 +#define SSL_F_CLIENT_HELLO 101 +#define SSL_F_CLIENT_MASTER_KEY 102 +#define SSL_F_D2I_SSL_SESSION 103 +#define SSL_F_DO_DTLS1_WRITE 245 +#define SSL_F_DO_SSL3_WRITE 104 +#define SSL_F_DTLS1_ACCEPT 246 +#define SSL_F_DTLS1_BUFFER_RECORD 247 +#define SSL_F_DTLS1_CLIENT_HELLO 248 +#define SSL_F_DTLS1_CONNECT 249 +#define SSL_F_DTLS1_ENC 250 +#define SSL_F_DTLS1_GET_HELLO_VERIFY 251 +#define SSL_F_DTLS1_GET_MESSAGE 252 +#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT 253 +#define SSL_F_DTLS1_GET_RECORD 254 +#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN 255 +#define SSL_F_DTLS1_PREPROCESS_FRAGMENT 277 +#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE 256 +#define SSL_F_DTLS1_PROCESS_RECORD 257 +#define SSL_F_DTLS1_READ_BYTES 258 +#define SSL_F_DTLS1_READ_FAILED 259 +#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST 260 +#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE 261 +#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE 262 +#define SSL_F_DTLS1_SEND_CLIENT_VERIFY 263 +#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST 264 +#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE 265 +#define SSL_F_DTLS1_SEND_SERVER_HELLO 266 +#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE 267 +#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 +#define SSL_F_GET_CLIENT_FINISHED 105 +#define SSL_F_GET_CLIENT_HELLO 106 +#define SSL_F_GET_CLIENT_MASTER_KEY 107 +#define SSL_F_GET_SERVER_FINISHED 108 +#define SSL_F_GET_SERVER_HELLO 109 +#define SSL_F_GET_SERVER_VERIFY 110 +#define SSL_F_I2D_SSL_SESSION 111 +#define SSL_F_READ_N 112 +#define SSL_F_REQUEST_CERTIFICATE 113 +#define SSL_F_SERVER_FINISH 239 +#define SSL_F_SERVER_HELLO 114 +#define SSL_F_SERVER_VERIFY 240 +#define SSL_F_SSL23_ACCEPT 115 +#define SSL_F_SSL23_CLIENT_HELLO 116 +#define SSL_F_SSL23_CONNECT 117 +#define SSL_F_SSL23_GET_CLIENT_HELLO 118 +#define SSL_F_SSL23_GET_SERVER_HELLO 119 +#define SSL_F_SSL23_PEEK 237 +#define SSL_F_SSL23_READ 120 +#define SSL_F_SSL23_WRITE 121 +#define SSL_F_SSL2_ACCEPT 122 +#define SSL_F_SSL2_CONNECT 123 +#define SSL_F_SSL2_ENC_INIT 124 +#define SSL_F_SSL2_GENERATE_KEY_MATERIAL 241 +#define SSL_F_SSL2_PEEK 234 +#define SSL_F_SSL2_READ 125 +#define SSL_F_SSL2_READ_INTERNAL 236 +#define SSL_F_SSL2_SET_CERTIFICATE 126 +#define SSL_F_SSL2_WRITE 127 +#define SSL_F_SSL3_ACCEPT 128 +#define SSL_F_SSL3_CALLBACK_CTRL 233 +#define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 +#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 +#define SSL_F_SSL3_CLIENT_HELLO 131 +#define SSL_F_SSL3_CONNECT 132 +#define SSL_F_SSL3_CTRL 213 +#define SSL_F_SSL3_CTX_CTRL 133 +#define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 279 +#define SSL_F_SSL3_ENC 134 +#define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 +#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST 135 +#define SSL_F_SSL3_GET_CERT_STATUS 288 +#define SSL_F_SSL3_GET_CERT_VERIFY 136 +#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE 137 +#define SSL_F_SSL3_GET_CLIENT_HELLO 138 +#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE 139 +#define SSL_F_SSL3_GET_FINISHED 140 +#define SSL_F_SSL3_GET_KEY_EXCHANGE 141 +#define SSL_F_SSL3_GET_MESSAGE 142 +#define SSL_F_SSL3_GET_NEW_SESSION_TICKET 283 +#define SSL_F_SSL3_GET_RECORD 143 +#define SSL_F_SSL3_GET_SERVER_CERTIFICATE 144 +#define SSL_F_SSL3_GET_SERVER_DONE 145 +#define SSL_F_SSL3_GET_SERVER_HELLO 146 +#define SSL_F_SSL3_NEW_SESSION_TICKET 284 +#define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 +#define SSL_F_SSL3_PEEK 235 +#define SSL_F_SSL3_READ_BYTES 148 +#define SSL_F_SSL3_READ_N 149 +#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST 150 +#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE 151 +#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE 152 +#define SSL_F_SSL3_SEND_CLIENT_VERIFY 153 +#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE 154 +#define SSL_F_SSL3_SEND_SERVER_HELLO 242 +#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE 155 +#define SSL_F_SSL3_SETUP_BUFFERS 156 +#define SSL_F_SSL3_SETUP_KEY_BLOCK 157 +#define SSL_F_SSL3_WRITE_BYTES 158 +#define SSL_F_SSL3_WRITE_PENDING 159 +#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 272 +#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 +#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 +#define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 273 +#define SSL_F_SSL_BAD_METHOD 160 +#define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 +#define SSL_F_SSL_CERT_DUP 221 +#define SSL_F_SSL_CERT_INST 222 +#define SSL_F_SSL_CERT_INSTANTIATE 214 +#define SSL_F_SSL_CERT_NEW 162 +#define SSL_F_SSL_CHECK_PRIVATE_KEY 163 +#define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 274 +#define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 +#define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 +#define SSL_F_SSL_CLEAR 164 +#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 +#define SSL_F_SSL_CREATE_CIPHER_LIST 166 +#define SSL_F_SSL_CTRL 232 +#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 +#define SSL_F_SSL_CTX_NEW 169 +#define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 +#define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 278 +#define SSL_F_SSL_CTX_SET_PURPOSE 226 +#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 +#define SSL_F_SSL_CTX_SET_SSL_VERSION 170 +#define SSL_F_SSL_CTX_SET_TRUST 229 +#define SSL_F_SSL_CTX_USE_CERTIFICATE 171 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE 220 +#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 +#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 +#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 +#define SSL_F_SSL_DO_HANDSHAKE 180 +#define SSL_F_SSL_GET_NEW_SESSION 181 +#define SSL_F_SSL_GET_PREV_SESSION 217 +#define SSL_F_SSL_GET_SERVER_SEND_CERT 182 +#define SSL_F_SSL_GET_SIGN_PKEY 183 +#define SSL_F_SSL_INIT_WBIO_BUFFER 184 +#define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 +#define SSL_F_SSL_NEW 186 +#define SSL_F_SSL_PEEK 270 +#define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT 275 +#define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT 276 +#define SSL_F_SSL_READ 223 +#define SSL_F_SSL_RSA_PRIVATE_DECRYPT 187 +#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 188 +#define SSL_F_SSL_SESSION_NEW 189 +#define SSL_F_SSL_SESSION_PRINT_FP 190 +#define SSL_F_SSL_SESS_CERT_NEW 225 +#define SSL_F_SSL_SET_CERT 191 +#define SSL_F_SSL_SET_CIPHER_LIST 271 +#define SSL_F_SSL_SET_FD 192 +#define SSL_F_SSL_SET_PKEY 193 +#define SSL_F_SSL_SET_PURPOSE 227 +#define SSL_F_SSL_SET_RFD 194 +#define SSL_F_SSL_SET_SESSION 195 +#define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 +#define SSL_F_SSL_SET_TRUST 228 +#define SSL_F_SSL_SET_WFD 196 +#define SSL_F_SSL_SHUTDOWN 224 +#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243 +#define SSL_F_SSL_UNDEFINED_FUNCTION 197 +#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 +#define SSL_F_SSL_USE_CERTIFICATE 198 +#define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 +#define SSL_F_SSL_USE_CERTIFICATE_FILE 200 +#define SSL_F_SSL_USE_PRIVATEKEY 201 +#define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 +#define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 +#define SSL_F_SSL_USE_RSAPRIVATEKEY 204 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 +#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 +#define SSL_F_SSL_VERIFY_CERT_CHAIN 207 +#define SSL_F_SSL_WRITE 208 +#define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 +#define SSL_F_TLS1_ENC 210 +#define SSL_F_TLS1_SETUP_KEY_BLOCK 211 +#define SSL_F_WRITE_PENDING 212 + +/* Reason codes. */ +#define SSL_R_APP_DATA_IN_HANDSHAKE 100 +#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 +#define SSL_R_BAD_ALERT_RECORD 101 +#define SSL_R_BAD_AUTHENTICATION_TYPE 102 +#define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +#define SSL_R_BAD_CHECKSUM 104 +#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +#define SSL_R_BAD_DECOMPRESSION 107 +#define SSL_R_BAD_DH_G_LENGTH 108 +#define SSL_R_BAD_DH_PUB_KEY_LENGTH 109 +#define SSL_R_BAD_DH_P_LENGTH 110 +#define SSL_R_BAD_DIGEST_LENGTH 111 +#define SSL_R_BAD_DSA_SIGNATURE 112 +#define SSL_R_BAD_ECC_CERT 304 +#define SSL_R_BAD_ECDSA_SIGNATURE 305 +#define SSL_R_BAD_ECPOINT 306 +#define SSL_R_BAD_HELLO_REQUEST 105 +#define SSL_R_BAD_LENGTH 271 +#define SSL_R_BAD_MAC_DECODE 113 +#define SSL_R_BAD_MESSAGE_TYPE 114 +#define SSL_R_BAD_PACKET_LENGTH 115 +#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +#define SSL_R_BAD_RESPONSE_ARGUMENT 117 +#define SSL_R_BAD_RSA_DECRYPT 118 +#define SSL_R_BAD_RSA_ENCRYPT 119 +#define SSL_R_BAD_RSA_E_LENGTH 120 +#define SSL_R_BAD_RSA_MODULUS_LENGTH 121 +#define SSL_R_BAD_RSA_SIGNATURE 122 +#define SSL_R_BAD_SIGNATURE 123 +#define SSL_R_BAD_SSL_FILETYPE 124 +#define SSL_R_BAD_SSL_SESSION_ID_LENGTH 125 +#define SSL_R_BAD_STATE 126 +#define SSL_R_BAD_WRITE_RETRY 127 +#define SSL_R_BIO_NOT_SET 128 +#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +#define SSL_R_BN_LIB 130 +#define SSL_R_CA_DN_LENGTH_MISMATCH 131 +#define SSL_R_CA_DN_TOO_LONG 132 +#define SSL_R_CCS_RECEIVED_EARLY 133 +#define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +#define SSL_R_CERT_LENGTH_MISMATCH 135 +#define SSL_R_CHALLENGE_IS_DIFFERENT 136 +#define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 +#define SSL_R_CIPHER_TABLE_SRC_ERROR 139 +#define SSL_R_CLIENTHELLO_TLSEXT 157 +#define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +#define SSL_R_COMPRESSION_FAILURE 141 +#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 +#define SSL_R_COMPRESSION_LIBRARY_ERROR 142 +#define SSL_R_CONNECTION_ID_IS_DIFFERENT 143 +#define SSL_R_CONNECTION_TYPE_NOT_SET 144 +#define SSL_R_COOKIE_MISMATCH 308 +#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 +#define SSL_R_DATA_LENGTH_TOO_LONG 146 +#define SSL_R_DECRYPTION_FAILED 147 +#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 +#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 +#define SSL_R_DIGEST_CHECK_FAILED 149 +#define SSL_R_DUPLICATE_COMPRESSION_ID 309 +#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER 310 +#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 +#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 282 +#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 +#define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 +#define SSL_R_EXTRA_DATA_IN_MESSAGE 153 +#define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 +#define SSL_R_HTTPS_PROXY_REQUEST 155 +#define SSL_R_HTTP_REQUEST 156 +#define SSL_R_ILLEGAL_PADDING 283 +#define SSL_R_INVALID_CHALLENGE_LENGTH 158 +#define SSL_R_INVALID_COMMAND 280 +#define SSL_R_INVALID_PURPOSE 278 +#define SSL_R_INVALID_STATUS_RESPONSE 316 +#define SSL_R_INVALID_TICKET_KEYS_LENGTH 275 +#define SSL_R_INVALID_TRUST 279 +#define SSL_R_KEY_ARG_TOO_LONG 284 +#define SSL_R_KRB5 285 +#define SSL_R_KRB5_C_CC_PRINC 286 +#define SSL_R_KRB5_C_GET_CRED 287 +#define SSL_R_KRB5_C_INIT 288 +#define SSL_R_KRB5_C_MK_REQ 289 +#define SSL_R_KRB5_S_BAD_TICKET 290 +#define SSL_R_KRB5_S_INIT 291 +#define SSL_R_KRB5_S_RD_REQ 292 +#define SSL_R_KRB5_S_TKT_EXPIRED 293 +#define SSL_R_KRB5_S_TKT_NYV 294 +#define SSL_R_KRB5_S_TKT_SKEW 295 +#define SSL_R_LENGTH_MISMATCH 159 +#define SSL_R_LENGTH_TOO_SHORT 160 +#define SSL_R_LIBRARY_BUG 274 +#define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 +#define SSL_R_MESSAGE_TOO_LONG 296 +#define SSL_R_MISSING_DH_DSA_CERT 162 +#define SSL_R_MISSING_DH_KEY 163 +#define SSL_R_MISSING_DH_RSA_CERT 164 +#define SSL_R_MISSING_DSA_SIGNING_CERT 165 +#define SSL_R_MISSING_EXPORT_TMP_DH_KEY 166 +#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY 167 +#define SSL_R_MISSING_RSA_CERTIFICATE 168 +#define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 +#define SSL_R_MISSING_RSA_SIGNING_CERT 170 +#define SSL_R_MISSING_TMP_DH_KEY 171 +#define SSL_R_MISSING_TMP_ECDH_KEY 311 +#define SSL_R_MISSING_TMP_RSA_KEY 172 +#define SSL_R_MISSING_TMP_RSA_PKEY 173 +#define SSL_R_MISSING_VERIFY_MESSAGE 174 +#define SSL_R_NON_SSLV2_INITIAL_PACKET 175 +#define SSL_R_NO_CERTIFICATES_RETURNED 176 +#define SSL_R_NO_CERTIFICATE_ASSIGNED 177 +#define SSL_R_NO_CERTIFICATE_RETURNED 178 +#define SSL_R_NO_CERTIFICATE_SET 179 +#define SSL_R_NO_CERTIFICATE_SPECIFIED 180 +#define SSL_R_NO_CIPHERS_AVAILABLE 181 +#define SSL_R_NO_CIPHERS_PASSED 182 +#define SSL_R_NO_CIPHERS_SPECIFIED 183 +#define SSL_R_NO_CIPHER_LIST 184 +#define SSL_R_NO_CIPHER_MATCH 185 +#define SSL_R_NO_CLIENT_CERT_METHOD 317 +#define SSL_R_NO_CLIENT_CERT_RECEIVED 186 +#define SSL_R_NO_COMPRESSION_SPECIFIED 187 +#define SSL_R_NO_METHOD_SPECIFIED 188 +#define SSL_R_NO_PRIVATEKEY 189 +#define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +#define SSL_R_NO_PROTOCOLS_AVAILABLE 191 +#define SSL_R_NO_PUBLICKEY 192 +#define SSL_R_NO_SHARED_CIPHER 193 +#define SSL_R_NO_VERIFY_CALLBACK 194 +#define SSL_R_NULL_SSL_CTX 195 +#define SSL_R_NULL_SSL_METHOD_PASSED 196 +#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 +#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 297 +#define SSL_R_PACKET_LENGTH_TOO_LONG 198 +#define SSL_R_PARSE_TLSEXT 223 +#define SSL_R_PATH_TOO_LONG 270 +#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 +#define SSL_R_PEER_ERROR 200 +#define SSL_R_PEER_ERROR_CERTIFICATE 201 +#define SSL_R_PEER_ERROR_NO_CERTIFICATE 202 +#define SSL_R_PEER_ERROR_NO_CIPHER 203 +#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 204 +#define SSL_R_PRE_MAC_LENGTH_TOO_LONG 205 +#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS 206 +#define SSL_R_PROTOCOL_IS_SHUTDOWN 207 +#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR 208 +#define SSL_R_PUBLIC_KEY_IS_NOT_RSA 209 +#define SSL_R_PUBLIC_KEY_NOT_RSA 210 +#define SSL_R_READ_BIO_NOT_SET 211 +#define SSL_R_READ_TIMEOUT_EXPIRED 312 +#define SSL_R_READ_WRONG_PACKET_TYPE 212 +#define SSL_R_RECORD_LENGTH_MISMATCH 213 +#define SSL_R_RECORD_TOO_LARGE 214 +#define SSL_R_RECORD_TOO_SMALL 298 +#define SSL_R_REQUIRED_CIPHER_MISSING 215 +#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 216 +#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 217 +#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO 218 +#define SSL_R_SERVERHELLO_TLSEXT 224 +#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 +#define SSL_R_SHORT_READ 219 +#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 +#define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221 +#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 299 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME 225 +#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 226 +#define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 +#define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222 +#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 +#define SSL_R_SSL_HANDSHAKE_FAILURE 229 +#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 +#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 +#define SSL_R_SSL_SESSION_ID_CONFLICT 302 +#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 +#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231 +#define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +#define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +#define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +#define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER 232 +#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 227 +#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 +#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 +#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 +#define SSL_R_UNABLE_TO_DECODE_DH_CERTS 236 +#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS 313 +#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 237 +#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS 238 +#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 +#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +#define SSL_R_UNABLE_TO_FIND_SSL_METHOD 240 +#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES 241 +#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 +#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 +#define SSL_R_UNEXPECTED_MESSAGE 244 +#define SSL_R_UNEXPECTED_RECORD 245 +#define SSL_R_UNINITIALIZED 276 +#define SSL_R_UNKNOWN_ALERT_TYPE 246 +#define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 +#define SSL_R_UNKNOWN_CIPHER_RETURNED 248 +#define SSL_R_UNKNOWN_CIPHER_TYPE 249 +#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +#define SSL_R_UNKNOWN_PKEY_TYPE 251 +#define SSL_R_UNKNOWN_PROTOCOL 252 +#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE 253 +#define SSL_R_UNKNOWN_SSL_VERSION 254 +#define SSL_R_UNKNOWN_STATE 255 +#define SSL_R_UNSUPPORTED_CIPHER 256 +#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 +#define SSL_R_UNSUPPORTED_PROTOCOL 258 +#define SSL_R_UNSUPPORTED_SSL_VERSION 259 +#define SSL_R_UNSUPPORTED_STATUS_TYPE 329 +#define SSL_R_WRITE_BIO_NOT_SET 260 +#define SSL_R_WRONG_CIPHER_RETURNED 261 +#define SSL_R_WRONG_MESSAGE_TYPE 262 +#define SSL_R_WRONG_NUMBER_OF_KEY_BITS 263 +#define SSL_R_WRONG_SIGNATURE_LENGTH 264 +#define SSL_R_WRONG_SIGNATURE_SIZE 265 +#define SSL_R_WRONG_SSL_VERSION 266 +#define SSL_R_WRONG_VERSION_NUMBER 267 +#define SSL_R_X509_LIB 268 +#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/ssl2.h b/externals/openssl/ssl2.h new file mode 100644 index 0000000..52c166e --- /dev/null +++ b/externals/openssl/ssl2.h @@ -0,0 +1,269 @@ +/* ssl/ssl2.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL2_H +#define HEADER_SSL2_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Protocol Version Codes */ +#define SSL2_VERSION 0x0002 +#define SSL2_VERSION_MAJOR 0x00 +#define SSL2_VERSION_MINOR 0x02 +/* #define SSL2_CLIENT_VERSION 0x0002 */ +/* #define SSL2_SERVER_VERSION 0x0002 */ + +/* Protocol Message Codes */ +#define SSL2_MT_ERROR 0 +#define SSL2_MT_CLIENT_HELLO 1 +#define SSL2_MT_CLIENT_MASTER_KEY 2 +#define SSL2_MT_CLIENT_FINISHED 3 +#define SSL2_MT_SERVER_HELLO 4 +#define SSL2_MT_SERVER_VERIFY 5 +#define SSL2_MT_SERVER_FINISHED 6 +#define SSL2_MT_REQUEST_CERTIFICATE 7 +#define SSL2_MT_CLIENT_CERTIFICATE 8 + +/* Error Message Codes */ +#define SSL2_PE_UNDEFINED_ERROR 0x0000 +#define SSL2_PE_NO_CIPHER 0x0001 +#define SSL2_PE_NO_CERTIFICATE 0x0002 +#define SSL2_PE_BAD_CERTIFICATE 0x0004 +#define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006 + +/* Cipher Kind Values */ +#define SSL2_CK_NULL_WITH_MD5 0x02000000 /* v3 */ +#define SSL2_CK_RC4_128_WITH_MD5 0x02010080 +#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080 +#define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080 +#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080 +#define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080 +#define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040 +#define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140 /* v3 */ +#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0 +#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */ +#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */ + +#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */ +#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */ + +#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1" +#define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5" +#define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5" +#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5" +#define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5" +#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5" +#define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5" +#define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5" +#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA" +#define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5" + +#define SSL2_TXT_NULL "NULL" + +/* Flags for the SSL_CIPHER.algorithm2 field */ +#define SSL2_CF_5_BYTE_ENC 0x01 +#define SSL2_CF_8_BYTE_ENC 0x02 + +/* Certificate Type Codes */ +#define SSL2_CT_X509_CERTIFICATE 0x01 + +/* Authentication Type Code */ +#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01 + +#define SSL2_MAX_SSL_SESSION_ID_LENGTH 32 + +/* Upper/Lower Bounds */ +#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256 +#ifdef OPENSSL_SYS_MPE +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 29998u +#else +#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */ +#endif +#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */ + +#define SSL2_CHALLENGE_LENGTH 16 +/*#define SSL2_CHALLENGE_LENGTH 32 */ +#define SSL2_MIN_CHALLENGE_LENGTH 16 +#define SSL2_MAX_CHALLENGE_LENGTH 32 +#define SSL2_CONNECTION_ID_LENGTH 16 +#define SSL2_MAX_CONNECTION_ID_LENGTH 16 +#define SSL2_SSL_SESSION_ID_LENGTH 16 +#define SSL2_MAX_CERT_CHALLENGE_LENGTH 32 +#define SSL2_MIN_CERT_CHALLENGE_LENGTH 16 +#define SSL2_MAX_KEY_MATERIAL_LENGTH 24 + +#ifndef HEADER_SSL_LOCL_H +#define CERT char +#endif + +typedef struct ssl2_state_st + { + int three_byte_header; + int clear_text; /* clear text */ + int escape; /* not used in SSLv2 */ + int ssl2_rollback; /* used if SSLv23 rolled back to SSLv2 */ + + /* non-blocking io info, used to make sure the same + * args were passwd */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; + const unsigned char *wpend_buf; + + int wpend_off; /* offset to data to write */ + int wpend_len; /* number of bytes passwd to write */ + int wpend_ret; /* number of bytes to return to caller */ + + /* buffer raw data */ + int rbuf_left; + int rbuf_offs; + unsigned char *rbuf; + unsigned char *wbuf; + + unsigned char *write_ptr;/* used to point to the start due to + * 2/3 byte header. */ + + unsigned int padding; + unsigned int rlength; /* passed to ssl2_enc */ + int ract_data_length; /* Set when things are encrypted. */ + unsigned int wlength; /* passed to ssl2_enc */ + int wact_data_length; /* Set when things are decrypted. */ + unsigned char *ract_data; + unsigned char *wact_data; + unsigned char *mac_data; + + unsigned char *read_key; + unsigned char *write_key; + + /* Stuff specifically to do with this SSL session */ + unsigned int challenge_length; + unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH]; + unsigned int conn_id_length; + unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH]; + unsigned int key_material_length; + unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2]; + + unsigned long read_sequence; + unsigned long write_sequence; + + struct { + unsigned int conn_id_length; + unsigned int cert_type; + unsigned int cert_length; + unsigned int csl; + unsigned int clear; + unsigned int enc; + unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH]; + unsigned int cipher_spec_length; + unsigned int session_id_length; + unsigned int clen; + unsigned int rlen; + } tmp; + } SSL2_STATE; + +/* SSLv2 */ +/* client */ +#define SSL2_ST_SEND_CLIENT_HELLO_A (0x10|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_HELLO_B (0x11|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_A (0x20|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_HELLO_B (0x21|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A (0x30|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B (0x31|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_A (0x40|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_FINISHED_B (0x41|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A (0x50|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B (0x51|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C (0x52|SSL_ST_CONNECT) +#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D (0x53|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_A (0x60|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_VERIFY_B (0x61|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_A (0x70|SSL_ST_CONNECT) +#define SSL2_ST_GET_SERVER_FINISHED_B (0x71|SSL_ST_CONNECT) +#define SSL2_ST_CLIENT_START_ENCRYPTION (0x80|SSL_ST_CONNECT) +#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90|SSL_ST_CONNECT) +/* server */ +#define SSL2_ST_GET_CLIENT_HELLO_A (0x10|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_B (0x11|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_HELLO_C (0x12|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_A (0x20|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_HELLO_B (0x21|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_A (0x30|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_MASTER_KEY_B (0x31|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_A (0x40|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_B (0x41|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_VERIFY_C (0x42|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_A (0x50|SSL_ST_ACCEPT) +#define SSL2_ST_GET_CLIENT_FINISHED_B (0x51|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_A (0x60|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_SERVER_FINISHED_B (0x61|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A (0x70|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B (0x71|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C (0x72|SSL_ST_ACCEPT) +#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D (0x73|SSL_ST_ACCEPT) +#define SSL2_ST_SERVER_START_ENCRYPTION (0x80|SSL_ST_ACCEPT) +#define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90|SSL_ST_ACCEPT) + +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/externals/openssl/ssl23.h b/externals/openssl/ssl23.h new file mode 100644 index 0000000..67bd8e9 --- /dev/null +++ b/externals/openssl/ssl23.h @@ -0,0 +1,84 @@ +/* ssl/ssl23.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SSL23_H +#define HEADER_SSL23_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*client */ +/* write to server */ +#define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) +#define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) +/* read from server */ +#define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) +#define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) + +/* server */ +/* read from client */ +#define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) +#define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) + +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/externals/openssl/ssl3.h b/externals/openssl/ssl3.h new file mode 100644 index 0000000..4b1e2e9 --- /dev/null +++ b/externals/openssl/ssl3.h @@ -0,0 +1,565 @@ +/* ssl/ssl3.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECC cipher suite support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_SSL3_H +#define HEADER_SSL3_H + +#ifndef OPENSSL_NO_COMP +#include +#endif +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SSL3_CK_RSA_NULL_MD5 0x03000001 +#define SSL3_CK_RSA_NULL_SHA 0x03000002 +#define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +#define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +#define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +#define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +#define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +#define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +#define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011 +#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012 +#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013 +#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014 +#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015 +#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016 + +#define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +#define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +#define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +#define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +#define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C +#define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D +#if 0 /* Because it clashes with KRB5, is never used any more, and is safe + to remove according to David Hopwood + of the ietf-tls list */ +#define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E +#endif + +/* VRS Additional Kerberos5 entries + */ +#define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E +#define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F +#define SSL3_CK_KRB5_RC4_128_SHA 0x03000020 +#define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021 +#define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022 +#define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023 +#define SSL3_CK_KRB5_RC4_128_MD5 0x03000024 +#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025 + +#define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026 +#define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027 +#define SSL3_CK_KRB5_RC4_40_SHA 0x03000028 +#define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029 +#define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A +#define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B + +#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +#define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +#define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +#define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +#define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +#define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +#define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +#define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA" +#define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA" +#define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA" + +#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA" +#define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA" +#define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA" +#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA" +#define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5" +#define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5" +#define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5" +#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5" + +#define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA" +#define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA" +#define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA" +#define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5" +#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5" +#define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5" + +#define SSL3_SSL_SESSION_ID_LENGTH 32 +#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +#define SSL3_MASTER_SECRET_SIZE 48 +#define SSL3_RANDOM_SIZE 32 +#define SSL3_SESSION_ID_SIZE 32 +#define SSL3_RT_HEADER_LENGTH 5 + +/* Due to MS stuffing up, this can change.... */ +#if defined(OPENSSL_SYS_WIN16) || \ + (defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)) +#define SSL3_RT_MAX_EXTRA (14000) +#else +#define SSL3_RT_MAX_EXTRA (16384) +#endif + +#define SSL3_RT_MAX_PLAIN_LENGTH 16384 +#ifdef OPENSSL_NO_COMP +#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH +#else +#define SSL3_RT_MAX_COMPRESSED_LENGTH (1024+SSL3_RT_MAX_PLAIN_LENGTH) +#endif +#define SSL3_RT_MAX_ENCRYPTED_LENGTH (1024+SSL3_RT_MAX_COMPRESSED_LENGTH) +#define SSL3_RT_MAX_PACKET_SIZE (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) +#define SSL3_RT_MAX_DATA_SIZE (1024*1024) + +#define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +#define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +#define SSL3_VERSION 0x0300 +#define SSL3_VERSION_MAJOR 0x03 +#define SSL3_VERSION_MINOR 0x00 + +#define SSL3_RT_CHANGE_CIPHER_SPEC 20 +#define SSL3_RT_ALERT 21 +#define SSL3_RT_HANDSHAKE 22 +#define SSL3_RT_APPLICATION_DATA 23 + +#define SSL3_AL_WARNING 1 +#define SSL3_AL_FATAL 2 + +#define SSL3_AD_CLOSE_NOTIFY 0 +#define SSL3_AD_UNEXPECTED_MESSAGE 10 /* fatal */ +#define SSL3_AD_BAD_RECORD_MAC 20 /* fatal */ +#define SSL3_AD_DECOMPRESSION_FAILURE 30 /* fatal */ +#define SSL3_AD_HANDSHAKE_FAILURE 40 /* fatal */ +#define SSL3_AD_NO_CERTIFICATE 41 +#define SSL3_AD_BAD_CERTIFICATE 42 +#define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +#define SSL3_AD_CERTIFICATE_REVOKED 44 +#define SSL3_AD_CERTIFICATE_EXPIRED 45 +#define SSL3_AD_CERTIFICATE_UNKNOWN 46 +#define SSL3_AD_ILLEGAL_PARAMETER 47 /* fatal */ + +typedef struct ssl3_record_st + { +/*r */ int type; /* type of record */ +/*rw*/ unsigned int length; /* How many bytes available */ +/*r */ unsigned int off; /* read/write offset into 'buf' */ +/*rw*/ unsigned char *data; /* pointer to the record data */ +/*rw*/ unsigned char *input; /* where the decode bytes are */ +/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */ +/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */ +/*r */ PQ_64BIT seq_num; /* sequence number, needed by DTLS1 */ + } SSL3_RECORD; + +typedef struct ssl3_buffer_st + { + unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes, + * see ssl3_setup_buffers() */ + size_t len; /* buffer size */ + int offset; /* where to 'copy from' */ + int left; /* how many bytes left */ + } SSL3_BUFFER; + +#define SSL3_CT_RSA_SIGN 1 +#define SSL3_CT_DSS_SIGN 2 +#define SSL3_CT_RSA_FIXED_DH 3 +#define SSL3_CT_DSS_FIXED_DH 4 +#define SSL3_CT_RSA_EPHEMERAL_DH 5 +#define SSL3_CT_DSS_EPHEMERAL_DH 6 +#define SSL3_CT_FORTEZZA_DMS 20 +/* SSL3_CT_NUMBER is used to size arrays and it must be large + * enough to contain all of the cert types defined either for + * SSLv3 and TLSv1. + */ +#define SSL3_CT_NUMBER 7 + + +#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 +#define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002 +#define SSL3_FLAGS_POP_BUFFER 0x0004 +#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008 + +typedef struct ssl3_state_st + { + long flags; + int delay_buf_pop_ret; + + unsigned char read_sequence[8]; + unsigned char read_mac_secret[EVP_MAX_MD_SIZE]; + unsigned char write_sequence[8]; + unsigned char write_mac_secret[EVP_MAX_MD_SIZE]; + + unsigned char server_random[SSL3_RANDOM_SIZE]; + unsigned char client_random[SSL3_RANDOM_SIZE]; + + /* flags for countermeasure against known-IV weakness */ + int need_empty_fragments; + int empty_fragment_done; + + SSL3_BUFFER rbuf; /* read IO goes into here */ + SSL3_BUFFER wbuf; /* write IO goes into here */ + + SSL3_RECORD rrec; /* each decoded record goes in here */ + SSL3_RECORD wrec; /* goes out from here */ + + /* storage for Alert/Handshake protocol data received but not + * yet processed by ssl3_read_bytes: */ + unsigned char alert_fragment[2]; + unsigned int alert_fragment_len; + unsigned char handshake_fragment[4]; + unsigned int handshake_fragment_len; + + /* partial write - check the numbers match */ + unsigned int wnum; /* number of bytes sent so far */ + int wpend_tot; /* number bytes written */ + int wpend_type; + int wpend_ret; /* number of bytes submitted */ + const unsigned char *wpend_buf; + + /* used during startup, digest all incoming/outgoing packets */ + EVP_MD_CTX finish_dgst1; + EVP_MD_CTX finish_dgst2; + + /* this is set whenerver we see a change_cipher_spec message + * come in when we are not looking for one */ + int change_cipher_spec; + + int warn_alert; + int fatal_alert; + /* we allow one fatal and one warning alert to be outstanding, + * send close alert via the warning alert */ + int alert_dispatch; + unsigned char send_alert[2]; + + /* This flag is set when we should renegotiate ASAP, basically when + * there is no more data in the read or write buffers */ + int renegotiate; + int total_renegotiations; + int num_renegotiations; + + int in_read_app_data; + + struct { + /* actually only needs to be 16+20 */ + unsigned char cert_verify_md[EVP_MAX_MD_SIZE*2]; + + /* actually only need to be 16+20 for SSLv3 and 12 for TLS */ + unsigned char finish_md[EVP_MAX_MD_SIZE*2]; + int finish_md_len; + unsigned char peer_finish_md[EVP_MAX_MD_SIZE*2]; + int peer_finish_md_len; + + unsigned long message_size; + int message_type; + + /* used to hold the new cipher we are going to use */ + SSL_CIPHER *new_cipher; +#ifndef OPENSSL_NO_DH + DH *dh; +#endif + +#ifndef OPENSSL_NO_ECDH + EC_KEY *ecdh; /* holds short lived ECDH key */ +#endif + + /* used when SSL_ST_FLUSH_DATA is entered */ + int next_state; + + int reuse_message; + + /* used for certificate requests */ + int cert_req; + int ctype_num; + char ctype[SSL3_CT_NUMBER]; + STACK_OF(X509_NAME) *ca_names; + + int use_rsa_tmp; + + int key_block_length; + unsigned char *key_block; + + const EVP_CIPHER *new_sym_enc; + const EVP_MD *new_hash; +#ifndef OPENSSL_NO_COMP + const SSL_COMP *new_compression; +#else + char *new_compression; +#endif + int cert_request; + } tmp; + + } SSL3_STATE; + + +/* SSLv3 */ +/*client */ +/* extra state */ +#define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT) +/* write to server */ +#define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT) +#define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_SRVR_HELLO_A (0x120|SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_HELLO_B (0x121|SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT) +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_A (0x130|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_B (0x131|SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_A (0x140|SSL_ST_CONNECT) +#define SSL3_ST_CR_KEY_EXCH_B (0x141|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_A (0x150|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_REQ_B (0x151|SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_A (0x160|SSL_ST_CONNECT) +#define SSL3_ST_CR_SRVR_DONE_B (0x161|SSL_ST_CONNECT) +/* write to server */ +#define SSL3_ST_CW_CERT_A (0x170|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_B (0x171|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_C (0x172|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_D (0x173|SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_A (0x180|SSL_ST_CONNECT) +#define SSL3_ST_CW_KEY_EXCH_B (0x181|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_A (0x190|SSL_ST_CONNECT) +#define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT) +#define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT) +#define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT) +#define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT) +/* read from server */ +#define SSL3_ST_CR_CHANGE_A (0x1C0|SSL_ST_CONNECT) +#define SSL3_ST_CR_CHANGE_B (0x1C1|SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_A (0x1D0|SSL_ST_CONNECT) +#define SSL3_ST_CR_FINISHED_B (0x1D1|SSL_ST_CONNECT) +#define SSL3_ST_CR_SESSION_TICKET_A (0x1E0|SSL_ST_CONNECT) +#define SSL3_ST_CR_SESSION_TICKET_B (0x1E1|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_STATUS_A (0x1F0|SSL_ST_CONNECT) +#define SSL3_ST_CR_CERT_STATUS_B (0x1F1|SSL_ST_CONNECT) + +/* server */ +/* extra state */ +#define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT) +/* read from client */ +/* Do not change the number values, they do matter */ +#define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_B (0x111|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CLNT_HELLO_C (0x112|SSL_ST_ACCEPT) +/* write to client */ +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT) +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_A (0x120|SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_B (0x121|SSL_ST_ACCEPT) +#define SSL3_ST_SW_HELLO_REQ_C (0x122|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_A (0x130|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_HELLO_B (0x131|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_A (0x140|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_B (0x141|SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_A (0x150|SSL_ST_ACCEPT) +#define SSL3_ST_SW_KEY_EXCH_B (0x151|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_A (0x160|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_REQ_B (0x161|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_A (0x170|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SRVR_DONE_B (0x171|SSL_ST_ACCEPT) +/* read from client */ +#define SSL3_ST_SR_CERT_A (0x180|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_B (0x181|SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_A (0x190|SSL_ST_ACCEPT) +#define SSL3_ST_SR_KEY_EXCH_B (0x191|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_A (0x1A0|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT) +#define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT) +#define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT) +#define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT) +/* write to client */ +#define SSL3_ST_SW_CHANGE_A (0x1D0|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CHANGE_B (0x1D1|SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_A (0x1E0|SSL_ST_ACCEPT) +#define SSL3_ST_SW_FINISHED_B (0x1E1|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SESSION_TICKET_A (0x1F0|SSL_ST_ACCEPT) +#define SSL3_ST_SW_SESSION_TICKET_B (0x1F1|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_STATUS_A (0x200|SSL_ST_ACCEPT) +#define SSL3_ST_SW_CERT_STATUS_B (0x201|SSL_ST_ACCEPT) + +#define SSL3_MT_HELLO_REQUEST 0 +#define SSL3_MT_CLIENT_HELLO 1 +#define SSL3_MT_SERVER_HELLO 2 +#define SSL3_MT_NEWSESSION_TICKET 4 +#define SSL3_MT_CERTIFICATE 11 +#define SSL3_MT_SERVER_KEY_EXCHANGE 12 +#define SSL3_MT_CERTIFICATE_REQUEST 13 +#define SSL3_MT_SERVER_DONE 14 +#define SSL3_MT_CERTIFICATE_VERIFY 15 +#define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +#define SSL3_MT_FINISHED 20 +#define SSL3_MT_CERTIFICATE_STATUS 22 +#define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + + +#define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +#define SSL3_CC_READ 0x01 +#define SSL3_CC_WRITE 0x02 +#define SSL3_CC_CLIENT 0x10 +#define SSL3_CC_SERVER 0x20 +#define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) +#define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) +#define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/stack.h b/externals/openssl/stack.h new file mode 100644 index 0000000..51d14d5 --- /dev/null +++ b/externals/openssl/stack.h @@ -0,0 +1,110 @@ +/* crypto/stack/stack.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_STACK_H +#define HEADER_STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct stack_st + { + int num; + char **data; + int sorted; + + int num_alloc; + int (*comp)(const char * const *, const char * const *); + } STACK; + +#define M_sk_num(sk) ((sk) ? (sk)->num:-1) +#define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) + +int sk_num(const STACK *); +char *sk_value(const STACK *, int); + +char *sk_set(STACK *, int, char *); + +STACK *sk_new(int (*cmp)(const char * const *, const char * const *)); +STACK *sk_new_null(void); +void sk_free(STACK *); +void sk_pop_free(STACK *st, void (*func)(void *)); +int sk_insert(STACK *sk,char *data,int where); +char *sk_delete(STACK *st,int loc); +char *sk_delete_ptr(STACK *st, char *p); +int sk_find(STACK *st,char *data); +int sk_find_ex(STACK *st,char *data); +int sk_push(STACK *st,char *data); +int sk_unshift(STACK *st,char *data); +char *sk_shift(STACK *st); +char *sk_pop(STACK *st); +void sk_zero(STACK *st); +int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *, + const char * const *))) + (const char * const *, const char * const *); +STACK *sk_dup(STACK *st); +void sk_sort(STACK *st); +int sk_is_sorted(const STACK *st); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/externals/openssl/store.h b/externals/openssl/store.h new file mode 100644 index 0000000..25f3608 --- /dev/null +++ b/externals/openssl/store.h @@ -0,0 +1,555 @@ +/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2003. + */ +/* ==================================================================== + * Copyright (c) 2003 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_STORE_H +#define HEADER_STORE_H + +#include +#ifndef OPENSSL_NO_DEPRECATED +#include +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Already defined in ossl_typ.h */ +/* typedef struct store_st STORE; */ +/* typedef struct store_method_st STORE_METHOD; */ + + +/* All the following functions return 0, a negative number or NULL on error. + When everything is fine, they return a positive value or a non-NULL + pointer, all depending on their purpose. */ + +/* Creators and destructor. */ +STORE *STORE_new_method(const STORE_METHOD *method); +STORE *STORE_new_engine(ENGINE *engine); +void STORE_free(STORE *ui); + + +/* Give a user interface parametrised control commands. This can be used to + send down an integer, a data pointer or a function pointer, as well as + be used to get information from a STORE. */ +int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)); + +/* A control to set the directory with keys and certificates. Used by the + built-in directory level method. */ +#define STORE_CTRL_SET_DIRECTORY 0x0001 +/* A control to set a file to load. Used by the built-in file level method. */ +#define STORE_CTRL_SET_FILE 0x0002 +/* A control to set a configuration file to load. Can be used by any method + that wishes to load a configuration file. */ +#define STORE_CTRL_SET_CONF_FILE 0x0003 +/* A control to set a the section of the loaded configuration file. Can be + used by any method that wishes to load a configuration file. */ +#define STORE_CTRL_SET_CONF_SECTION 0x0004 + + +/* Some methods may use extra data */ +#define STORE_set_app_data(s,arg) STORE_set_ex_data(s,0,arg) +#define STORE_get_app_data(s) STORE_get_ex_data(s,0) +int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int STORE_set_ex_data(STORE *r,int idx,void *arg); +void *STORE_get_ex_data(STORE *r, int idx); + +/* Use specific methods instead of the built-in one */ +const STORE_METHOD *STORE_get_method(STORE *store); +const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth); + +/* The standard OpenSSL methods. */ +/* This is the in-memory method. It does everything except revoking and updating, + and is of course volatile. It's used by other methods that have an in-memory + cache. */ +const STORE_METHOD *STORE_Memory(void); +#if 0 /* Not yet implemented */ +/* This is the directory store. It does everything except revoking and updating, + and uses STORE_Memory() to cache things in memory. */ +const STORE_METHOD *STORE_Directory(void); +/* This is the file store. It does everything except revoking and updating, + and uses STORE_Memory() to cache things in memory. Certificates are added + to it with the store operation, and it will only get cached certificates. */ +const STORE_METHOD *STORE_File(void); +#endif + +/* Store functions take a type code for the type of data they should store + or fetch */ +typedef enum STORE_object_types + { + STORE_OBJECT_TYPE_X509_CERTIFICATE= 0x01, /* X509 * */ + STORE_OBJECT_TYPE_X509_CRL= 0x02, /* X509_CRL * */ + STORE_OBJECT_TYPE_PRIVATE_KEY= 0x03, /* EVP_PKEY * */ + STORE_OBJECT_TYPE_PUBLIC_KEY= 0x04, /* EVP_PKEY * */ + STORE_OBJECT_TYPE_NUMBER= 0x05, /* BIGNUM * */ + STORE_OBJECT_TYPE_ARBITRARY= 0x06, /* BUF_MEM * */ + STORE_OBJECT_TYPE_NUM= 0x06 /* The amount of known + object types */ + } STORE_OBJECT_TYPES; +/* List of text strings corresponding to the object types. */ +extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1]; + +/* Some store functions take a parameter list. Those parameters come with + one of the following codes. The comments following the codes below indicate + what type the value should be a pointer to. */ +typedef enum STORE_params + { + STORE_PARAM_EVP_TYPE= 0x01, /* int */ + STORE_PARAM_BITS= 0x02, /* size_t */ + STORE_PARAM_KEY_PARAMETERS= 0x03, /* ??? */ + STORE_PARAM_KEY_NO_PARAMETERS= 0x04, /* N/A */ + STORE_PARAM_AUTH_PASSPHRASE= 0x05, /* char * */ + STORE_PARAM_AUTH_KRB5_TICKET= 0x06, /* void * */ + STORE_PARAM_TYPE_NUM= 0x06 /* The amount of known + parameter types */ + } STORE_PARAM_TYPES; +/* Parameter value sizes. -1 means unknown, anything else is the required size. */ +extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1]; + +/* Store functions take attribute lists. Those attributes come with codes. + The comments following the codes below indicate what type the value should + be a pointer to. */ +typedef enum STORE_attribs + { + STORE_ATTR_END= 0x00, + STORE_ATTR_FRIENDLYNAME= 0x01, /* C string */ + STORE_ATTR_KEYID= 0x02, /* 160 bit string (SHA1) */ + STORE_ATTR_ISSUERKEYID= 0x03, /* 160 bit string (SHA1) */ + STORE_ATTR_SUBJECTKEYID= 0x04, /* 160 bit string (SHA1) */ + STORE_ATTR_ISSUERSERIALHASH= 0x05, /* 160 bit string (SHA1) */ + STORE_ATTR_ISSUER= 0x06, /* X509_NAME * */ + STORE_ATTR_SERIAL= 0x07, /* BIGNUM * */ + STORE_ATTR_SUBJECT= 0x08, /* X509_NAME * */ + STORE_ATTR_CERTHASH= 0x09, /* 160 bit string (SHA1) */ + STORE_ATTR_EMAIL= 0x0a, /* C string */ + STORE_ATTR_FILENAME= 0x0b, /* C string */ + STORE_ATTR_TYPE_NUM= 0x0b, /* The amount of known + attribute types */ + STORE_ATTR_OR= 0xff /* This is a special + separator, which + expresses the OR + operation. */ + } STORE_ATTR_TYPES; +/* Attribute value sizes. -1 means unknown, anything else is the required size. */ +extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1]; + +typedef enum STORE_certificate_status + { + STORE_X509_VALID= 0x00, + STORE_X509_EXPIRED= 0x01, + STORE_X509_SUSPENDED= 0x02, + STORE_X509_REVOKED= 0x03 + } STORE_CERTIFICATE_STATUS; + +/* Engine store functions will return a structure that contains all the necessary + * information, including revokation status for certificates. This is really not + * needed for application authors, as the ENGINE framework functions will extract + * the OpenSSL-specific information when at all possible. However, for engine + * authors, it's crucial to know this structure. */ +typedef struct STORE_OBJECT_st + { + STORE_OBJECT_TYPES type; + union + { + struct + { + STORE_CERTIFICATE_STATUS status; + X509 *certificate; + } x509; + X509_CRL *crl; + EVP_PKEY *key; + BIGNUM *number; + BUF_MEM *arbitrary; + } data; + } STORE_OBJECT; +DECLARE_STACK_OF(STORE_OBJECT) +STORE_OBJECT *STORE_OBJECT_new(void); +void STORE_OBJECT_free(STORE_OBJECT *data); + + + +/* The following functions handle the storage. They return 0, a negative number + or NULL on error, anything else on success. */ +X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +X509 *STORE_list_certificate_next(STORE *e, void *handle); +int STORE_list_certificate_end(STORE *e, void *handle); +int STORE_list_certificate_endp(STORE *e, void *handle); +EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_private_key(STORE *e, EVP_PKEY *data, + OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle); +int STORE_list_private_key_end(STORE *e, void *handle); +int STORE_list_private_key_endp(STORE *e, void *handle); +EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle); +int STORE_list_public_key_end(STORE *e, void *handle); +int STORE_list_public_key_endp(STORE *e, void *handle); +X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +X509_CRL *STORE_list_crl_next(STORE *e, void *handle); +int STORE_list_crl_end(STORE *e, void *handle); +int STORE_list_crl_endp(STORE *e, void *handle); +int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[], + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); +int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[], + OPENSSL_ITEM parameters[]); + + +/* Create and manipulate methods */ +STORE_METHOD *STORE_create_method(char *name); +void STORE_destroy_method(STORE_METHOD *store_method); + +/* These callback types are use for store handlers */ +typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *); +typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *); +typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle); +typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle); +typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); +typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void)); + +int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f); +int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f); +int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f); +int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f); +int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f); +int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f); +int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f); +int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f); +int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f); +int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f); +int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f); +int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); +int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); +int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); +int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f); + +STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm); +STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm); +STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm); +STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm); +STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm); +STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm); +STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm); +STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm); +STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm); +STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm); +STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm); +STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm); +STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm); +STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm); +STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm); + +/* Method helper structures and functions. */ + +/* This structure is the result of parsing through the information in a list + of OPENSSL_ITEMs. It stores all the necessary information in a structured + way.*/ +typedef struct STORE_attr_info_st STORE_ATTR_INFO; + +/* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO. + Note that we do this in the list form, since the list of OPENSSL_ITEMs can + come in blocks separated with STORE_ATTR_OR. Note that the value returned + by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */ +void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes); +STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle); +int STORE_parse_attrs_end(void *handle); +int STORE_parse_attrs_endp(void *handle); + +/* Creator and destructor */ +STORE_ATTR_INFO *STORE_ATTR_INFO_new(void); +int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs); + +/* Manipulators */ +char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); +unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs, + STORE_ATTR_TYPES code); +X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); +BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); +int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + char *cstr, size_t cstr_size); +int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + unsigned char *sha1str, size_t sha1str_size); +int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + X509_NAME *dn); +int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + BIGNUM *number); +int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + char *cstr, size_t cstr_size); +int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + unsigned char *sha1str, size_t sha1str_size); +int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + X509_NAME *dn); +int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, + BIGNUM *number); + +/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values + in each contained attribute. */ +int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); +/* Check if the set of attributes in a is within the range of attributes + set in b. */ +int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); +/* Check if the set of attributes in a are also set in b. */ +int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); +/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */ +int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_STORE_strings(void); + +/* Error codes for the STORE functions. */ + +/* Function codes. */ +#define STORE_F_MEM_DELETE 134 +#define STORE_F_MEM_GENERATE 135 +#define STORE_F_MEM_LIST_END 168 +#define STORE_F_MEM_LIST_NEXT 136 +#define STORE_F_MEM_LIST_START 137 +#define STORE_F_MEM_MODIFY 169 +#define STORE_F_MEM_STORE 138 +#define STORE_F_STORE_ATTR_INFO_GET0_CSTR 139 +#define STORE_F_STORE_ATTR_INFO_GET0_DN 140 +#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER 141 +#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR 142 +#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR 143 +#define STORE_F_STORE_ATTR_INFO_MODIFY_DN 144 +#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER 145 +#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR 146 +#define STORE_F_STORE_ATTR_INFO_SET_CSTR 147 +#define STORE_F_STORE_ATTR_INFO_SET_DN 148 +#define STORE_F_STORE_ATTR_INFO_SET_NUMBER 149 +#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR 150 +#define STORE_F_STORE_CERTIFICATE 170 +#define STORE_F_STORE_CTRL 161 +#define STORE_F_STORE_DELETE_ARBITRARY 158 +#define STORE_F_STORE_DELETE_CERTIFICATE 102 +#define STORE_F_STORE_DELETE_CRL 103 +#define STORE_F_STORE_DELETE_NUMBER 104 +#define STORE_F_STORE_DELETE_PRIVATE_KEY 105 +#define STORE_F_STORE_DELETE_PUBLIC_KEY 106 +#define STORE_F_STORE_GENERATE_CRL 107 +#define STORE_F_STORE_GENERATE_KEY 108 +#define STORE_F_STORE_GET_ARBITRARY 159 +#define STORE_F_STORE_GET_CERTIFICATE 109 +#define STORE_F_STORE_GET_CRL 110 +#define STORE_F_STORE_GET_NUMBER 111 +#define STORE_F_STORE_GET_PRIVATE_KEY 112 +#define STORE_F_STORE_GET_PUBLIC_KEY 113 +#define STORE_F_STORE_LIST_CERTIFICATE_END 114 +#define STORE_F_STORE_LIST_CERTIFICATE_ENDP 153 +#define STORE_F_STORE_LIST_CERTIFICATE_NEXT 115 +#define STORE_F_STORE_LIST_CERTIFICATE_START 116 +#define STORE_F_STORE_LIST_CRL_END 117 +#define STORE_F_STORE_LIST_CRL_ENDP 154 +#define STORE_F_STORE_LIST_CRL_NEXT 118 +#define STORE_F_STORE_LIST_CRL_START 119 +#define STORE_F_STORE_LIST_PRIVATE_KEY_END 120 +#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP 155 +#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT 121 +#define STORE_F_STORE_LIST_PRIVATE_KEY_START 122 +#define STORE_F_STORE_LIST_PUBLIC_KEY_END 123 +#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP 156 +#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT 124 +#define STORE_F_STORE_LIST_PUBLIC_KEY_START 125 +#define STORE_F_STORE_MODIFY_ARBITRARY 162 +#define STORE_F_STORE_MODIFY_CERTIFICATE 163 +#define STORE_F_STORE_MODIFY_CRL 164 +#define STORE_F_STORE_MODIFY_NUMBER 165 +#define STORE_F_STORE_MODIFY_PRIVATE_KEY 166 +#define STORE_F_STORE_MODIFY_PUBLIC_KEY 167 +#define STORE_F_STORE_NEW_ENGINE 133 +#define STORE_F_STORE_NEW_METHOD 132 +#define STORE_F_STORE_PARSE_ATTRS_END 151 +#define STORE_F_STORE_PARSE_ATTRS_ENDP 172 +#define STORE_F_STORE_PARSE_ATTRS_NEXT 152 +#define STORE_F_STORE_PARSE_ATTRS_START 171 +#define STORE_F_STORE_REVOKE_CERTIFICATE 129 +#define STORE_F_STORE_REVOKE_PRIVATE_KEY 130 +#define STORE_F_STORE_REVOKE_PUBLIC_KEY 131 +#define STORE_F_STORE_STORE_ARBITRARY 157 +#define STORE_F_STORE_STORE_CERTIFICATE 100 +#define STORE_F_STORE_STORE_CRL 101 +#define STORE_F_STORE_STORE_NUMBER 126 +#define STORE_F_STORE_STORE_PRIVATE_KEY 127 +#define STORE_F_STORE_STORE_PUBLIC_KEY 128 + +/* Reason codes. */ +#define STORE_R_ALREADY_HAS_A_VALUE 127 +#define STORE_R_FAILED_DELETING_ARBITRARY 132 +#define STORE_R_FAILED_DELETING_CERTIFICATE 100 +#define STORE_R_FAILED_DELETING_KEY 101 +#define STORE_R_FAILED_DELETING_NUMBER 102 +#define STORE_R_FAILED_GENERATING_CRL 103 +#define STORE_R_FAILED_GENERATING_KEY 104 +#define STORE_R_FAILED_GETTING_ARBITRARY 133 +#define STORE_R_FAILED_GETTING_CERTIFICATE 105 +#define STORE_R_FAILED_GETTING_KEY 106 +#define STORE_R_FAILED_GETTING_NUMBER 107 +#define STORE_R_FAILED_LISTING_CERTIFICATES 108 +#define STORE_R_FAILED_LISTING_KEYS 109 +#define STORE_R_FAILED_MODIFYING_ARBITRARY 138 +#define STORE_R_FAILED_MODIFYING_CERTIFICATE 139 +#define STORE_R_FAILED_MODIFYING_CRL 140 +#define STORE_R_FAILED_MODIFYING_NUMBER 141 +#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY 142 +#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY 143 +#define STORE_R_FAILED_REVOKING_CERTIFICATE 110 +#define STORE_R_FAILED_REVOKING_KEY 111 +#define STORE_R_FAILED_STORING_ARBITRARY 134 +#define STORE_R_FAILED_STORING_CERTIFICATE 112 +#define STORE_R_FAILED_STORING_KEY 113 +#define STORE_R_FAILED_STORING_NUMBER 114 +#define STORE_R_NOT_IMPLEMENTED 128 +#define STORE_R_NO_CONTROL_FUNCTION 144 +#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION 135 +#define STORE_R_NO_DELETE_NUMBER_FUNCTION 115 +#define STORE_R_NO_DELETE_OBJECT_FUNCTION 116 +#define STORE_R_NO_GENERATE_CRL_FUNCTION 117 +#define STORE_R_NO_GENERATE_OBJECT_FUNCTION 118 +#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION 136 +#define STORE_R_NO_GET_OBJECT_FUNCTION 119 +#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION 120 +#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION 131 +#define STORE_R_NO_LIST_OBJECT_END_FUNCTION 121 +#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION 122 +#define STORE_R_NO_LIST_OBJECT_START_FUNCTION 123 +#define STORE_R_NO_MODIFY_OBJECT_FUNCTION 145 +#define STORE_R_NO_REVOKE_OBJECT_FUNCTION 124 +#define STORE_R_NO_STORE 129 +#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION 137 +#define STORE_R_NO_STORE_OBJECT_FUNCTION 125 +#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION 126 +#define STORE_R_NO_VALUE 130 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/symhacks.h b/externals/openssl/symhacks.h new file mode 100644 index 0000000..8728e61 --- /dev/null +++ b/externals/openssl/symhacks.h @@ -0,0 +1,409 @@ +/* ==================================================================== + * Copyright (c) 1999 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_SYMHACKS_H +#define HEADER_SYMHACKS_H + +#include + +/* Hacks to solve the problem with linkers incapable of handling very long + symbol names. In the case of VMS, the limit is 31 characters on VMS for + VAX. */ +#ifdef OPENSSL_SYS_VMS + +/* Hack a long name in crypto/cryptlib.c */ +#undef int_CRYPTO_set_do_dynlock_callback +#define int_CRYPTO_set_do_dynlock_callback int_CRYPTO_set_do_dynlock_cb + +/* Hack a long name in crypto/ex_data.c */ +#undef CRYPTO_get_ex_data_implementation +#define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl +#undef CRYPTO_set_ex_data_implementation +#define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl + +/* Hack a long name in crypto/asn1/a_mbstr.c */ +#undef ASN1_STRING_set_default_mask_asc +#define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc + +#if 0 /* No longer needed, since safestack macro magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ +#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO +#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF +#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO +#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF +#endif + +#if 0 /* No longer needed, since safestack macro magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */ +#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO +#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF +#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO +#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF +#endif + +#if 0 /* No longer needed, since safestack macro magic does the job */ +/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */ +#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION +#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC +#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION +#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC +#endif + +/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */ +#undef PEM_read_NETSCAPE_CERT_SEQUENCE +#define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ +#undef PEM_write_NETSCAPE_CERT_SEQUENCE +#define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ +#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ +#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ +#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE +#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ + +/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */ +#undef PEM_read_PKCS8_PRIV_KEY_INFO +#define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO +#undef PEM_write_PKCS8_PRIV_KEY_INFO +#define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO +#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO +#define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO +#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO +#define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO +#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO +#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO + +/* Hack other PEM names */ +#undef PEM_write_bio_PKCS8PrivateKey_nid +#define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid + +/* Hack some long X509 names */ +#undef X509_REVOKED_get_ext_by_critical +#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic +#undef X509_policy_tree_get0_user_policies +#define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies +#undef X509_policy_node_get0_qualifiers +#define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers +#undef X509_STORE_CTX_get_explicit_policy +#define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy + +/* Hack some long CRYPTO names */ +#undef CRYPTO_set_dynlock_destroy_callback +#define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb +#undef CRYPTO_set_dynlock_create_callback +#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb +#undef CRYPTO_set_dynlock_lock_callback +#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb +#undef CRYPTO_get_dynlock_lock_callback +#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb +#undef CRYPTO_get_dynlock_destroy_callback +#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb +#undef CRYPTO_get_dynlock_create_callback +#define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb +#undef CRYPTO_set_locked_mem_ex_functions +#define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs +#undef CRYPTO_get_locked_mem_ex_functions +#define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs + +/* Hack some long SSL names */ +#undef SSL_CTX_set_default_verify_paths +#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths +#undef SSL_get_ex_data_X509_STORE_CTX_idx +#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx +#undef SSL_add_file_cert_subjects_to_stack +#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk +#undef SSL_add_dir_cert_subjects_to_stack +#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk +#undef SSL_CTX_use_certificate_chain_file +#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file +#undef SSL_CTX_set_cert_verify_callback +#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb +#undef SSL_CTX_set_default_passwd_cb_userdata +#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud +#undef SSL_COMP_get_compression_methods +#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods + +/* Hack some long ENGINE names */ +#undef ENGINE_get_default_BN_mod_exp_crt +#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt +#undef ENGINE_set_default_BN_mod_exp_crt +#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt +#undef ENGINE_set_load_privkey_function +#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn +#undef ENGINE_get_load_privkey_function +#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn +#undef ENGINE_set_load_ssl_client_cert_function +#define ENGINE_set_load_ssl_client_cert_function \ + ENGINE_set_ld_ssl_clnt_cert_fn +#undef ENGINE_get_ssl_client_cert_function +#define ENGINE_get_ssl_client_cert_function ENGINE_get_ssl_client_cert_fn + +/* Hack some long OCSP names */ +#undef OCSP_REQUEST_get_ext_by_critical +#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit +#undef OCSP_BASICRESP_get_ext_by_critical +#define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit +#undef OCSP_SINGLERESP_get_ext_by_critical +#define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit + +/* Hack some long DES names */ +#undef _ossl_old_des_ede3_cfb64_encrypt +#define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt +#undef _ossl_old_des_ede3_ofb64_encrypt +#define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt + +/* Hack some long EVP names */ +#undef OPENSSL_add_all_algorithms_noconf +#define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf +#undef OPENSSL_add_all_algorithms_conf +#define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf + +/* Hack some long EC names */ +#undef EC_GROUP_set_point_conversion_form +#define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form +#undef EC_GROUP_get_point_conversion_form +#define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form +#undef EC_GROUP_clear_free_all_extra_data +#define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data +#undef EC_POINT_set_Jprojective_coordinates_GFp +#define EC_POINT_set_Jprojective_coordinates_GFp \ + EC_POINT_set_Jproj_coords_GFp +#undef EC_POINT_get_Jprojective_coordinates_GFp +#define EC_POINT_get_Jprojective_coordinates_GFp \ + EC_POINT_get_Jproj_coords_GFp +#undef EC_POINT_set_affine_coordinates_GFp +#define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp +#undef EC_POINT_get_affine_coordinates_GFp +#define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp +#undef EC_POINT_set_compressed_coordinates_GFp +#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp +#undef EC_POINT_set_affine_coordinates_GF2m +#define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m +#undef EC_POINT_get_affine_coordinates_GF2m +#define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m +#undef EC_POINT_set_compressed_coordinates_GF2m +#define EC_POINT_set_compressed_coordinates_GF2m \ + EC_POINT_set_compr_coords_GF2m +#undef ec_GF2m_simple_group_clear_finish +#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish +#undef ec_GF2m_simple_group_check_discriminant +#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim +#undef ec_GF2m_simple_point_clear_finish +#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish +#undef ec_GF2m_simple_point_set_to_infinity +#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf +#undef ec_GF2m_simple_points_make_affine +#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine +#undef ec_GF2m_simple_point_set_affine_coordinates +#define ec_GF2m_simple_point_set_affine_coordinates \ + ec_GF2m_smp_pt_set_af_coords +#undef ec_GF2m_simple_point_get_affine_coordinates +#define ec_GF2m_simple_point_get_affine_coordinates \ + ec_GF2m_smp_pt_get_af_coords +#undef ec_GF2m_simple_set_compressed_coordinates +#define ec_GF2m_simple_set_compressed_coordinates \ + ec_GF2m_smp_set_compr_coords +#undef ec_GFp_simple_group_set_curve_GFp +#define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp +#undef ec_GFp_simple_group_get_curve_GFp +#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp +#undef ec_GFp_simple_group_clear_finish +#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish +#undef ec_GFp_simple_group_set_generator +#define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator +#undef ec_GFp_simple_group_get0_generator +#define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator +#undef ec_GFp_simple_group_get_cofactor +#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor +#undef ec_GFp_simple_point_clear_finish +#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish +#undef ec_GFp_simple_point_set_to_infinity +#define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf +#undef ec_GFp_simple_points_make_affine +#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine +#undef ec_GFp_simple_group_get_curve_GFp +#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp +#undef ec_GFp_simple_set_Jprojective_coordinates_GFp +#define ec_GFp_simple_set_Jprojective_coordinates_GFp \ + ec_GFp_smp_set_Jproj_coords_GFp +#undef ec_GFp_simple_get_Jprojective_coordinates_GFp +#define ec_GFp_simple_get_Jprojective_coordinates_GFp \ + ec_GFp_smp_get_Jproj_coords_GFp +#undef ec_GFp_simple_point_set_affine_coordinates_GFp +#define ec_GFp_simple_point_set_affine_coordinates_GFp \ + ec_GFp_smp_pt_set_af_coords_GFp +#undef ec_GFp_simple_point_get_affine_coordinates_GFp +#define ec_GFp_simple_point_get_affine_coordinates_GFp \ + ec_GFp_smp_pt_get_af_coords_GFp +#undef ec_GFp_simple_set_compressed_coordinates_GFp +#define ec_GFp_simple_set_compressed_coordinates_GFp \ + ec_GFp_smp_set_compr_coords_GFp +#undef ec_GFp_simple_point_set_affine_coordinates +#define ec_GFp_simple_point_set_affine_coordinates \ + ec_GFp_smp_pt_set_af_coords +#undef ec_GFp_simple_point_get_affine_coordinates +#define ec_GFp_simple_point_get_affine_coordinates \ + ec_GFp_smp_pt_get_af_coords +#undef ec_GFp_simple_set_compressed_coordinates +#define ec_GFp_simple_set_compressed_coordinates \ + ec_GFp_smp_set_compr_coords +#undef ec_GFp_simple_group_check_discriminant +#define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim + +/* Hack som long STORE names */ +#undef STORE_method_set_initialise_function +#define STORE_method_set_initialise_function STORE_meth_set_initialise_fn +#undef STORE_method_set_cleanup_function +#define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn +#undef STORE_method_set_generate_function +#define STORE_method_set_generate_function STORE_meth_set_generate_fn +#undef STORE_method_set_modify_function +#define STORE_method_set_modify_function STORE_meth_set_modify_fn +#undef STORE_method_set_revoke_function +#define STORE_method_set_revoke_function STORE_meth_set_revoke_fn +#undef STORE_method_set_delete_function +#define STORE_method_set_delete_function STORE_meth_set_delete_fn +#undef STORE_method_set_list_start_function +#define STORE_method_set_list_start_function STORE_meth_set_list_start_fn +#undef STORE_method_set_list_next_function +#define STORE_method_set_list_next_function STORE_meth_set_list_next_fn +#undef STORE_method_set_list_end_function +#define STORE_method_set_list_end_function STORE_meth_set_list_end_fn +#undef STORE_method_set_update_store_function +#define STORE_method_set_update_store_function STORE_meth_set_update_store_fn +#undef STORE_method_set_lock_store_function +#define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn +#undef STORE_method_set_unlock_store_function +#define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn +#undef STORE_method_get_initialise_function +#define STORE_method_get_initialise_function STORE_meth_get_initialise_fn +#undef STORE_method_get_cleanup_function +#define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn +#undef STORE_method_get_generate_function +#define STORE_method_get_generate_function STORE_meth_get_generate_fn +#undef STORE_method_get_modify_function +#define STORE_method_get_modify_function STORE_meth_get_modify_fn +#undef STORE_method_get_revoke_function +#define STORE_method_get_revoke_function STORE_meth_get_revoke_fn +#undef STORE_method_get_delete_function +#define STORE_method_get_delete_function STORE_meth_get_delete_fn +#undef STORE_method_get_list_start_function +#define STORE_method_get_list_start_function STORE_meth_get_list_start_fn +#undef STORE_method_get_list_next_function +#define STORE_method_get_list_next_function STORE_meth_get_list_next_fn +#undef STORE_method_get_list_end_function +#define STORE_method_get_list_end_function STORE_meth_get_list_end_fn +#undef STORE_method_get_update_store_function +#define STORE_method_get_update_store_function STORE_meth_get_update_store_fn +#undef STORE_method_get_lock_store_function +#define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn +#undef STORE_method_get_unlock_store_function +#define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn + +/* Hack some long CMS names */ +#undef CMS_RecipientInfo_ktri_get0_algs +#define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs +#undef CMS_RecipientInfo_ktri_get0_signer_id +#define CMS_RecipientInfo_ktri_get0_signer_id CMS_RecipInfo_ktri_get0_sigr_id +#undef CMS_OtherRevocationInfoFormat_it +#define CMS_OtherRevocationInfoFormat_it CMS_OtherRevocInfoFormat_it +#undef CMS_KeyAgreeRecipientIdentifier_it +#define CMS_KeyAgreeRecipientIdentifier_it CMS_KeyAgreeRecipIdentifier_it +#undef CMS_OriginatorIdentifierOrKey_it +#define CMS_OriginatorIdentifierOrKey_it CMS_OriginatorIdOrKey_it +#undef cms_SignerIdentifier_get0_signer_id +#define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id + +#endif /* defined OPENSSL_SYS_VMS */ + + +/* Case insensiteve linking causes problems.... */ +#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) +#undef ERR_load_CRYPTO_strings +#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings +#undef OCSP_crlID_new +#define OCSP_crlID_new OCSP_crlID2_new + +#undef d2i_ECPARAMETERS +#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS +#undef i2d_ECPARAMETERS +#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS +#undef d2i_ECPKPARAMETERS +#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS +#undef i2d_ECPKPARAMETERS +#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS + +/* These functions do not seem to exist! However, I'm paranoid... + Original command in x509v3.h: + These functions are being redefined in another directory, + and clash when the linker is case-insensitive, so let's + hide them a little, by giving them an extra 'o' at the + beginning of the name... */ +#undef X509v3_cleanup_extensions +#define X509v3_cleanup_extensions oX509v3_cleanup_extensions +#undef X509v3_add_extension +#define X509v3_add_extension oX509v3_add_extension +#undef X509v3_add_netscape_extensions +#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions +#undef X509v3_add_standard_extensions +#define X509v3_add_standard_extensions oX509v3_add_standard_extensions + + +#endif + + +#endif /* ! defined HEADER_VMS_IDHACKS_H */ +/* This one clashes with CMS_data_create */ +#undef cms_Data_create +#define cms_Data_create priv_cms_Data_create diff --git a/externals/openssl/tls1.h b/externals/openssl/tls1.h new file mode 100644 index 0000000..2d1d293 --- /dev/null +++ b/externals/openssl/tls1.h @@ -0,0 +1,407 @@ +/* ssl/tls1.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * + * Portions of the attached software ("Contribution") are developed by + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. + * + * The Contribution is licensed pursuant to the OpenSSL open source + * license provided above. + * + * ECC cipher suite support in OpenSSL originally written by + * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories. + * + */ + +#ifndef HEADER_TLS1_H +#define HEADER_TLS1_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES 0 + +#define TLS1_VERSION 0x0301 +#define TLS1_VERSION_MAJOR 0x03 +#define TLS1_VERSION_MINOR 0x01 + +#define TLS1_AD_DECRYPTION_FAILED 21 +#define TLS1_AD_RECORD_OVERFLOW 22 +#define TLS1_AD_UNKNOWN_CA 48 /* fatal */ +#define TLS1_AD_ACCESS_DENIED 49 /* fatal */ +#define TLS1_AD_DECODE_ERROR 50 /* fatal */ +#define TLS1_AD_DECRYPT_ERROR 51 +#define TLS1_AD_EXPORT_RESTRICTION 60 /* fatal */ +#define TLS1_AD_PROTOCOL_VERSION 70 /* fatal */ +#define TLS1_AD_INSUFFICIENT_SECURITY 71 /* fatal */ +#define TLS1_AD_INTERNAL_ERROR 80 /* fatal */ +#define TLS1_AD_USER_CANCELLED 90 +#define TLS1_AD_NO_RENEGOTIATION 100 +/* codes 110-114 are from RFC3546 */ +#define TLS1_AD_UNSUPPORTED_EXTENSION 110 +#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 +#define TLS1_AD_UNRECOGNIZED_NAME 112 +#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 +#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 +#define TLS1_AD_UNKNOWN_PSK_IDENTITY 115 /* fatal */ + +/* ExtensionType values from RFC 3546 */ +#define TLSEXT_TYPE_server_name 0 +#define TLSEXT_TYPE_max_fragment_length 1 +#define TLSEXT_TYPE_client_certificate_url 2 +#define TLSEXT_TYPE_trusted_ca_keys 3 +#define TLSEXT_TYPE_truncated_hmac 4 +#define TLSEXT_TYPE_status_request 5 +#define TLSEXT_TYPE_elliptic_curves 10 +#define TLSEXT_TYPE_ec_point_formats 11 +#define TLSEXT_TYPE_session_ticket 35 + +/* NameType value from RFC 3546 */ +#define TLSEXT_NAMETYPE_host_name 0 +/* status request value from RFC 3546 */ +#define TLSEXT_STATUSTYPE_ocsp 1 + +#ifndef OPENSSL_NO_TLSEXT + +#define TLSEXT_MAXLEN_host_name 255 + +const char *SSL_get_servername(const SSL *s, const int type) ; +int SSL_get_servername_type(const SSL *s) ; + +#define SSL_set_tlsext_host_name(s,name) \ +SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name) + +#define SSL_set_tlsext_debug_callback(ssl, cb) \ +SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,(void (*)(void))cb) + +#define SSL_set_tlsext_debug_arg(ssl, arg) \ +SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0, (void *)arg) + +#define SSL_set_tlsext_status_type(ssl, type) \ +SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type, NULL) + +#define SSL_get_tlsext_status_exts(ssl, arg) \ +SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg) + +#define SSL_set_tlsext_status_exts(ssl, arg) \ +SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg) + +#define SSL_get_tlsext_status_ids(ssl, arg) \ +SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg) + +#define SSL_set_tlsext_status_ids(ssl, arg) \ +SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg) + +#define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ +SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0, (void *)arg) + +#define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ +SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen, (void *)arg) + +#define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ +SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,(void (*)(void))cb) + +#define SSL_TLSEXT_ERR_OK 0 +#define SSL_TLSEXT_ERR_ALERT_WARNING 1 +#define SSL_TLSEXT_ERR_ALERT_FATAL 2 +#define SSL_TLSEXT_ERR_NOACK 3 + +#define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ +SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0, (void *)arg) + +#define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_GET_TLXEXT_TICKET_KEYS,(keylen),(keys)) +#define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_SET_TLXEXT_TICKET_KEYS,(keylen),(keys)) + +#define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ +SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,(void (*)(void))cb) + +#define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ +SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0, (void *)arg) + +#define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ +SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb) + +#endif + +/* Additional TLS ciphersuites from draft-ietf-tls-56-bit-ciphersuites-00.txt + * (available if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see + * s3_lib.c). We actually treat them like SSL 3.0 ciphers, which we probably + * shouldn't. */ +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5 0x03000060 +#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 0x03000061 +#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA 0x03000062 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x03000063 +#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA 0x03000064 +#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA 0x03000065 +#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA 0x03000066 + +/* AES ciphersuites from RFC3268 */ + +#define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +#define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +#define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +#define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 + +#define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +#define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +#define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +#define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 +#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 + +#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 +#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 +#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 +#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 +#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 +#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 +#define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 +#define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 +#define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 +#define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A +#define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B + +/* ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in draft 13 */ +#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 +#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 +#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 + +#define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 +#define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 +#define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A + +#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B +#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C +#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D +#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E +#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F + +#define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 +#define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 +#define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 + +#define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 +#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 +#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 +#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 +#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 + +/* XXX + * Inconsistency alert: + * The OpenSSL names of ciphers with ephemeral DH here include the string + * "DHE", while elsewhere it has always been "EDH". + * (The alias for the list of all such ciphers also is "EDH".) + * The specifications speak of "EDH"; maybe we should allow both forms + * for everything. */ +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5 "EXP1024-RC4-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5 "EXP1024-RC2-CBC-MD5" +#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DES-CBC-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA "EXP1024-DHE-DSS-DES-CBC-SHA" +#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA "EXP1024-RC4-SHA" +#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA "EXP1024-DHE-DSS-RC4-SHA" +#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +/* AES ciphersuites from RFC3268 */ +#define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +#define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +#define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +#define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001) */ +#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" + +#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" + +#define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" + +#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" +#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" + +/* Camellia ciphersuites from RFC4132 */ +#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" + +#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" +#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" +#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" +#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" + +/* SEED ciphersuites from RFC4162 */ +#define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" +#define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" +#define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" +#define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" +#define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" +#define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" + +#define TLS_CT_RSA_SIGN 1 +#define TLS_CT_DSS_SIGN 2 +#define TLS_CT_RSA_FIXED_DH 3 +#define TLS_CT_DSS_FIXED_DH 4 +#define TLS_CT_ECDSA_SIGN 64 +#define TLS_CT_RSA_FIXED_ECDH 65 +#define TLS_CT_ECDSA_FIXED_ECDH 66 +#define TLS_CT_NUMBER 7 + +#define TLS1_FINISH_MAC_LENGTH 12 + +#define TLS_MD_MAX_CONST_SIZE 20 +#define TLS_MD_CLIENT_FINISH_CONST "client finished" +#define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +#define TLS_MD_SERVER_FINISH_CONST "server finished" +#define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +#define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_KEY_EXPANSION_CONST "key expansion" +#define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +#define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" +#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +#define TLS_MD_IV_BLOCK_CONST "IV block" +#define TLS_MD_IV_BLOCK_CONST_SIZE 8 +#define TLS_MD_MASTER_SECRET_CONST "master secret" +#define TLS_MD_MASTER_SECRET_CONST_SIZE 13 + +#ifdef CHARSET_EBCDIC +#undef TLS_MD_CLIENT_FINISH_CONST +#define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*client finished*/ +#undef TLS_MD_SERVER_FINISH_CONST +#define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*server finished*/ +#undef TLS_MD_SERVER_WRITE_KEY_CONST +#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/ +#undef TLS_MD_KEY_EXPANSION_CONST +#define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" /*key expansion*/ +#undef TLS_MD_CLIENT_WRITE_KEY_CONST +#define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*client write key*/ +#undef TLS_MD_SERVER_WRITE_KEY_CONST +#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/ +#undef TLS_MD_IV_BLOCK_CONST +#define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" /*IV block*/ +#undef TLS_MD_MASTER_SECRET_CONST +#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" /*master secret*/ +#endif + +#ifdef __cplusplus +} +#endif +#endif + + + diff --git a/externals/openssl/tmdiff.h b/externals/openssl/tmdiff.h new file mode 100644 index 0000000..0409edb --- /dev/null +++ b/externals/openssl/tmdiff.h @@ -0,0 +1,94 @@ +/* crypto/tmdiff.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Header for dynamic hash table routines + * Author - Eric Young + */ +/* ... erm yeah, "dynamic hash tables" you say? + * + * And what would dynamic hash tables have to do with any of this code *now*? + * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused + * file that I doubt compiles any more. speed.c is the only thing that could + * use this (and it has nothing to do with hash tables), yet it instead has its + * own duplication of all this stuff and looks, if anything, more complete. See + * the corresponding note in apps/speed.c. + * The Bemused - Geoff + */ + +#ifndef HEADER_TMDIFF_H +#define HEADER_TMDIFF_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ms_tm MS_TM; + +MS_TM *ms_time_new(void ); +void ms_time_free(MS_TM *a); +void ms_time_get(MS_TM *a); +double ms_time_diff(MS_TM *start, MS_TM *end); +int ms_time_cmp(const MS_TM *ap, const MS_TM *bp); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/externals/openssl/txt_db.h b/externals/openssl/txt_db.h new file mode 100644 index 0000000..e78ba87 --- /dev/null +++ b/externals/openssl/txt_db.h @@ -0,0 +1,110 @@ +/* crypto/txt_db/txt_db.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_TXT_DB_H +#define HEADER_TXT_DB_H + +#include +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include + +#define DB_ERROR_OK 0 +#define DB_ERROR_MALLOC 1 +#define DB_ERROR_INDEX_CLASH 2 +#define DB_ERROR_INDEX_OUT_OF_RANGE 3 +#define DB_ERROR_NO_INDEX 4 +#define DB_ERROR_INSERT_INDEX_CLASH 5 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct txt_db_st + { + int num_fields; + STACK /* char ** */ *data; + LHASH **index; + int (**qual)(char **); + long error; + long arg1; + long arg2; + char **arg_row; + } TXT_DB; + +#ifndef OPENSSL_NO_BIO +TXT_DB *TXT_DB_read(BIO *in, int num); +long TXT_DB_write(BIO *out, TXT_DB *db); +#else +TXT_DB *TXT_DB_read(char *in, int num); +long TXT_DB_write(char *out, TXT_DB *db); +#endif +int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **), + LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); +void TXT_DB_free(TXT_DB *db); +char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value); +int TXT_DB_insert(TXT_DB *db,char **value); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/externals/openssl/ui.h b/externals/openssl/ui.h new file mode 100644 index 0000000..3a2f29e --- /dev/null +++ b/externals/openssl/ui.h @@ -0,0 +1,382 @@ +/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2001. + */ +/* ==================================================================== + * Copyright (c) 2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_UI_H +#define HEADER_UI_H + +#ifndef OPENSSL_NO_DEPRECATED +#include +#endif +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Declared already in ossl_typ.h */ +/* typedef struct ui_st UI; */ +/* typedef struct ui_method_st UI_METHOD; */ + + +/* All the following functions return -1 or NULL on error and in some cases + (UI_process()) -2 if interrupted or in some other way cancelled. + When everything is fine, they return 0, a positive value or a non-NULL + pointer, all depending on their purpose. */ + +/* Creators and destructor. */ +UI *UI_new(void); +UI *UI_new_method(const UI_METHOD *method); +void UI_free(UI *ui); + +/* The following functions are used to add strings to be printed and prompt + strings to prompt for data. The names are UI_{add,dup}__string + and UI_{add,dup}_input_boolean. + + UI_{add,dup}__string have the following meanings: + add add a text or prompt string. The pointers given to these + functions are used verbatim, no copying is done. + dup make a copy of the text or prompt string, then add the copy + to the collection of strings in the user interface. + + The function is a name for the functionality that the given + string shall be used for. It can be one of: + input use the string as data prompt. + verify use the string as verification prompt. This + is used to verify a previous input. + info use the string for informational output. + error use the string for error output. + Honestly, there's currently no difference between info and error for the + moment. + + UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", + and are typically used when one wants to prompt for a yes/no response. + + + All of the functions in this group take a UI and a prompt string. + The string input and verify addition functions also take a flag argument, + a buffer for the result to end up with, a minimum input size and a maximum + input size (the result buffer MUST be large enough to be able to contain + the maximum number of characters). Additionally, the verify addition + functions takes another buffer to compare the result against. + The boolean input functions take an action description string (which should + be safe to ignore if the expected user action is obvious, for example with + a dialog box with an OK button and a Cancel button), a string of acceptable + characters to mean OK and to mean Cancel. The two last strings are checked + to make sure they don't have common characters. Additionally, the same + flag argument as for the string input is taken, as well as a result buffer. + The result buffer is required to be at least one byte long. Depending on + the answer, the first character from the OK or the Cancel character strings + will be stored in the first byte of the result buffer. No NUL will be + added, so the result is *not* a string. + + On success, the all return an index of the added information. That index + is usefull when retrieving results with UI_get0_result(). */ +int UI_add_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_dup_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_add_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, const char *test_buf); +int UI_dup_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, const char *test_buf); +int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_add_info_string(UI *ui, const char *text); +int UI_dup_info_string(UI *ui, const char *text); +int UI_add_error_string(UI *ui, const char *text); +int UI_dup_error_string(UI *ui, const char *text); + +/* These are the possible flags. They can be or'ed together. */ +/* Use to have echoing of input */ +#define UI_INPUT_FLAG_ECHO 0x01 +/* Use a default password. Where that password is found is completely + up to the application, it might for example be in the user data set + with UI_add_user_data(). It is not recommended to have more than + one input in each UI being marked with this flag, or the application + might get confused. */ +#define UI_INPUT_FLAG_DEFAULT_PWD 0x02 + +/* The user of these routines may want to define flags of their own. The core + UI won't look at those, but will pass them on to the method routines. They + must use higher bits so they don't get confused with the UI bits above. + UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good + example of use is this: + + #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) + +*/ +#define UI_INPUT_FLAG_USER_BASE 16 + + +/* The following function helps construct a prompt. object_desc is a + textual short description of the object, for example "pass phrase", + and object_name is the name of the object (might be a card name or + a file name. + The returned string shall always be allocated on the heap with + OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). + + If the ui_method doesn't contain a pointer to a user-defined prompt + constructor, a default string is built, looking like this: + + "Enter {object_desc} for {object_name}:" + + So, if object_desc has the value "pass phrase" and object_name has + the value "foo.key", the resulting string is: + + "Enter pass phrase for foo.key:" +*/ +char *UI_construct_prompt(UI *ui_method, + const char *object_desc, const char *object_name); + + +/* The following function is used to store a pointer to user-specific data. + Any previous such pointer will be returned and replaced. + + For callback purposes, this function makes a lot more sense than using + ex_data, since the latter requires that different parts of OpenSSL or + applications share the same ex_data index. + + Note that the UI_OpenSSL() method completely ignores the user data. + Other methods may not, however. */ +void *UI_add_user_data(UI *ui, void *user_data); +/* We need a user data retrieving function as well. */ +void *UI_get0_user_data(UI *ui); + +/* Return the result associated with a prompt given with the index i. */ +const char *UI_get0_result(UI *ui, int i); + +/* When all strings have been added, process the whole thing. */ +int UI_process(UI *ui); + +/* Give a user interface parametrised control commands. This can be used to + send down an integer, a data pointer or a function pointer, as well as + be used to get information from a UI. */ +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void)); + +/* The commands */ +/* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the + OpenSSL error stack before printing any info or added error messages and + before any prompting. */ +#define UI_CTRL_PRINT_ERRORS 1 +/* Check if a UI_process() is possible to do again with the same instance of + a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 + if not. */ +#define UI_CTRL_IS_REDOABLE 2 + + +/* Some methods may use extra data */ +#define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) +#define UI_get_app_data(s) UI_get_ex_data(s,0) +int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int UI_set_ex_data(UI *r,int idx,void *arg); +void *UI_get_ex_data(UI *r, int idx); + +/* Use specific methods instead of the built-in one */ +void UI_set_default_method(const UI_METHOD *meth); +const UI_METHOD *UI_get_default_method(void); +const UI_METHOD *UI_get_method(UI *ui); +const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); + +/* The method with all the built-in thingies */ +UI_METHOD *UI_OpenSSL(void); + + +/* ---------- For method writers ---------- */ +/* A method contains a number of functions that implement the low level + of the User Interface. The functions are: + + an opener This function starts a session, maybe by opening + a channel to a tty, or by opening a window. + a writer This function is called to write a given string, + maybe to the tty, maybe as a field label in a + window. + a flusher This function is called to flush everything that + has been output so far. It can be used to actually + display a dialog box after it has been built. + a reader This function is called to read a given prompt, + maybe from the tty, maybe from a field in a + window. Note that it's called wth all string + structures, not only the prompt ones, so it must + check such things itself. + a closer This function closes the session, maybe by closing + the channel to the tty, or closing the window. + + All these functions are expected to return: + + 0 on error. + 1 on success. + -1 on out-of-band events, for example if some prompting has + been canceled (by pressing Ctrl-C, for example). This is + only checked when returned by the flusher or the reader. + + The way this is used, the opener is first called, then the writer for all + strings, then the flusher, then the reader for all strings and finally the + closer. Note that if you want to prompt from a terminal or other command + line interface, the best is to have the reader also write the prompts + instead of having the writer do it. If you want to prompt from a dialog + box, the writer can be used to build up the contents of the box, and the + flusher to actually display the box and run the event loop until all data + has been given, after which the reader only grabs the given data and puts + them back into the UI strings. + + All method functions take a UI as argument. Additionally, the writer and + the reader take a UI_STRING. +*/ + +/* The UI_STRING type is the data structure that contains all the needed info + about a string or a prompt, including test data for a verification prompt. +*/ +DECLARE_STACK_OF(UI_STRING) +typedef struct ui_string_st UI_STRING; + +/* The different types of strings that are currently supported. + This is only needed by method authors. */ +enum UI_string_types + { + UIT_NONE=0, + UIT_PROMPT, /* Prompt for a string */ + UIT_VERIFY, /* Prompt for a string and verify */ + UIT_BOOLEAN, /* Prompt for a yes/no response */ + UIT_INFO, /* Send info to the user */ + UIT_ERROR /* Send an error message to the user */ + }; + +/* Create and manipulate methods */ +UI_METHOD *UI_create_method(char *name); +void UI_destroy_method(UI_METHOD *ui_method); +int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui)); +int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis)); +int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui)); +int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis)); +int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui)); +int (*UI_method_get_opener(UI_METHOD *method))(UI*); +int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*); +int (*UI_method_get_flusher(UI_METHOD *method))(UI*); +int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); +int (*UI_method_get_closer(UI_METHOD *method))(UI*); + +/* The following functions are helpers for method writers to access relevant + data from a UI_STRING. */ + +/* Return type of the UI_STRING */ +enum UI_string_types UI_get_string_type(UI_STRING *uis); +/* Return input flags of the UI_STRING */ +int UI_get_input_flags(UI_STRING *uis); +/* Return the actual string to output (the prompt, info or error) */ +const char *UI_get0_output_string(UI_STRING *uis); +/* Return the optional action string to output (the boolean promtp instruction) */ +const char *UI_get0_action_string(UI_STRING *uis); +/* Return the result of a prompt */ +const char *UI_get0_result_string(UI_STRING *uis); +/* Return the string to test the result against. Only useful with verifies. */ +const char *UI_get0_test_string(UI_STRING *uis); +/* Return the required minimum size of the result */ +int UI_get_result_minsize(UI_STRING *uis); +/* Return the required maximum size of the result */ +int UI_get_result_maxsize(UI_STRING *uis); +/* Set the result of a UI_STRING. */ +int UI_set_result(UI *ui, UI_STRING *uis, const char *result); + + +/* A couple of popular utility functions */ +int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify); +int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); + + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_UI_strings(void); + +/* Error codes for the UI functions. */ + +/* Function codes. */ +#define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 +#define UI_F_GENERAL_ALLOCATE_PROMPT 109 +#define UI_F_GENERAL_ALLOCATE_STRING 100 +#define UI_F_UI_CTRL 111 +#define UI_F_UI_DUP_ERROR_STRING 101 +#define UI_F_UI_DUP_INFO_STRING 102 +#define UI_F_UI_DUP_INPUT_BOOLEAN 110 +#define UI_F_UI_DUP_INPUT_STRING 103 +#define UI_F_UI_DUP_VERIFY_STRING 106 +#define UI_F_UI_GET0_RESULT 107 +#define UI_F_UI_NEW_METHOD 104 +#define UI_F_UI_SET_RESULT 105 + +/* Reason codes. */ +#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 +#define UI_R_INDEX_TOO_LARGE 102 +#define UI_R_INDEX_TOO_SMALL 103 +#define UI_R_NO_RESULT_BUFFER 105 +#define UI_R_RESULT_TOO_LARGE 100 +#define UI_R_RESULT_TOO_SMALL 101 +#define UI_R_UNKNOWN_CONTROL_COMMAND 106 + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/ui_compat.h b/externals/openssl/ui_compat.h new file mode 100644 index 0000000..4687853 --- /dev/null +++ b/externals/openssl/ui_compat.h @@ -0,0 +1,84 @@ +/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL + * project 2001. + */ +/* ==================================================================== + * Copyright (c) 2001 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#ifndef HEADER_UI_COMPAT_H +#define HEADER_UI_COMPAT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* The following functions were previously part of the DES section, + and are provided here for backward compatibility reasons. */ + +#define des_read_pw_string(b,l,p,v) \ + _ossl_old_des_read_pw_string((b),(l),(p),(v)) +#define des_read_pw(b,bf,s,p,v) \ + _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) + +int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify); +int _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/externals/openssl/x509.h b/externals/openssl/x509.h new file mode 100644 index 0000000..e71b525 --- /dev/null +++ b/externals/openssl/x509.h @@ -0,0 +1,1355 @@ +/* crypto/x509/x509.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ +/* ==================================================================== + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + * ECDH support in OpenSSL originally developed by + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. + */ + +#ifndef HEADER_X509_H +#define HEADER_X509_H + +#include +#include +#ifndef OPENSSL_NO_BUFFER +#include +#endif +#ifndef OPENSSL_NO_EVP +#include +#endif +#ifndef OPENSSL_NO_BIO +#include +#endif +#include +#include +#include + +#ifndef OPENSSL_NO_EC +#include +#endif + +#ifndef OPENSSL_NO_ECDSA +#include +#endif + +#ifndef OPENSSL_NO_ECDH +#include +#endif + +#ifndef OPENSSL_NO_DEPRECATED +#ifndef OPENSSL_NO_RSA +#include +#endif +#ifndef OPENSSL_NO_DSA +#include +#endif +#ifndef OPENSSL_NO_DH +#include +#endif +#endif + +#ifndef OPENSSL_NO_SHA +#include +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_SYS_WIN32 +/* Under Win32 these are defined in wincrypt.h */ +#undef X509_NAME +#undef X509_CERT_PAIR +#endif + +#define X509_FILETYPE_PEM 1 +#define X509_FILETYPE_ASN1 2 +#define X509_FILETYPE_DEFAULT 3 + +#define X509v3_KU_DIGITAL_SIGNATURE 0x0080 +#define X509v3_KU_NON_REPUDIATION 0x0040 +#define X509v3_KU_KEY_ENCIPHERMENT 0x0020 +#define X509v3_KU_DATA_ENCIPHERMENT 0x0010 +#define X509v3_KU_KEY_AGREEMENT 0x0008 +#define X509v3_KU_KEY_CERT_SIGN 0x0004 +#define X509v3_KU_CRL_SIGN 0x0002 +#define X509v3_KU_ENCIPHER_ONLY 0x0001 +#define X509v3_KU_DECIPHER_ONLY 0x8000 +#define X509v3_KU_UNDEF 0xffff + +typedef struct X509_objects_st + { + int nid; + int (*a2i)(void); + int (*i2a)(void); + } X509_OBJECTS; + +struct X509_algor_st + { + ASN1_OBJECT *algorithm; + ASN1_TYPE *parameter; + } /* X509_ALGOR */; + +DECLARE_ASN1_SET_OF(X509_ALGOR) + +typedef STACK_OF(X509_ALGOR) X509_ALGORS; + +typedef struct X509_val_st + { + ASN1_TIME *notBefore; + ASN1_TIME *notAfter; + } X509_VAL; + +typedef struct X509_pubkey_st + { + X509_ALGOR *algor; + ASN1_BIT_STRING *public_key; + EVP_PKEY *pkey; + } X509_PUBKEY; + +typedef struct X509_sig_st + { + X509_ALGOR *algor; + ASN1_OCTET_STRING *digest; + } X509_SIG; + +typedef struct X509_name_entry_st + { + ASN1_OBJECT *object; + ASN1_STRING *value; + int set; + int size; /* temp variable */ + } X509_NAME_ENTRY; + +DECLARE_STACK_OF(X509_NAME_ENTRY) +DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) + +/* we always keep X509_NAMEs in 2 forms. */ +struct X509_name_st + { + STACK_OF(X509_NAME_ENTRY) *entries; + int modified; /* true if 'bytes' needs to be built */ +#ifndef OPENSSL_NO_BUFFER + BUF_MEM *bytes; +#else + char *bytes; +#endif + unsigned long hash; /* Keep the hash around for lookups */ + } /* X509_NAME */; + +DECLARE_STACK_OF(X509_NAME) + +#define X509_EX_V_NETSCAPE_HACK 0x8000 +#define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st + { + ASN1_OBJECT *object; + ASN1_BOOLEAN critical; + ASN1_OCTET_STRING *value; + } X509_EXTENSION; + +typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; + +DECLARE_STACK_OF(X509_EXTENSION) +DECLARE_ASN1_SET_OF(X509_EXTENSION) + +/* a sequence of these are used */ +typedef struct x509_attributes_st + { + ASN1_OBJECT *object; + int single; /* 0 for a set, 1 for a single item (which is wrong) */ + union { + char *ptr; +/* 0 */ STACK_OF(ASN1_TYPE) *set; +/* 1 */ ASN1_TYPE *single; + } value; + } X509_ATTRIBUTE; + +DECLARE_STACK_OF(X509_ATTRIBUTE) +DECLARE_ASN1_SET_OF(X509_ATTRIBUTE) + + +typedef struct X509_req_info_st + { + ASN1_ENCODING enc; + ASN1_INTEGER *version; + X509_NAME *subject; + X509_PUBKEY *pubkey; + /* d=2 hl=2 l= 0 cons: cont: 00 */ + STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ + } X509_REQ_INFO; + +typedef struct X509_req_st + { + X509_REQ_INFO *req_info; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + int references; + } X509_REQ; + +typedef struct x509_cinf_st + { + ASN1_INTEGER *version; /* [ 0 ] default of v1 */ + ASN1_INTEGER *serialNumber; + X509_ALGOR *signature; + X509_NAME *issuer; + X509_VAL *validity; + X509_NAME *subject; + X509_PUBKEY *key; + ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ + ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ + STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ + } X509_CINF; + +/* This stuff is certificate "auxiliary info" + * it contains details which are useful in certificate + * stores and databases. When used this is tagged onto + * the end of the certificate itself + */ + +typedef struct x509_cert_aux_st + { + STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ + STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ + ASN1_UTF8STRING *alias; /* "friendly name" */ + ASN1_OCTET_STRING *keyid; /* key id of private key */ + STACK_OF(X509_ALGOR) *other; /* other unspecified info */ + } X509_CERT_AUX; + +struct x509_st + { + X509_CINF *cert_info; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + int valid; + int references; + char *name; + CRYPTO_EX_DATA ex_data; + /* These contain copies of various extension values */ + long ex_pathlen; + long ex_pcpathlen; + unsigned long ex_flags; + unsigned long ex_kusage; + unsigned long ex_xkusage; + unsigned long ex_nscert; + ASN1_OCTET_STRING *skid; + struct AUTHORITY_KEYID_st *akid; + X509_POLICY_CACHE *policy_cache; +#ifndef OPENSSL_NO_RFC3779 + STACK_OF(IPAddressFamily) *rfc3779_addr; + struct ASIdentifiers_st *rfc3779_asid; +#endif +#ifndef OPENSSL_NO_SHA + unsigned char sha1_hash[SHA_DIGEST_LENGTH]; +#endif + X509_CERT_AUX *aux; + } /* X509 */; + +DECLARE_STACK_OF(X509) +DECLARE_ASN1_SET_OF(X509) + +/* This is used for a table of trust checking functions */ + +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust)(struct x509_trust_st *, X509 *, int); + char *name; + int arg1; + void *arg2; +} X509_TRUST; + +DECLARE_STACK_OF(X509_TRUST) + +typedef struct x509_cert_pair_st { + X509 *forward; + X509 *reverse; +} X509_CERT_PAIR; + +/* standard trust ids */ + +#define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */ + +#define X509_TRUST_COMPAT 1 +#define X509_TRUST_SSL_CLIENT 2 +#define X509_TRUST_SSL_SERVER 3 +#define X509_TRUST_EMAIL 4 +#define X509_TRUST_OBJECT_SIGN 5 +#define X509_TRUST_OCSP_SIGN 6 +#define X509_TRUST_OCSP_REQUEST 7 + +/* Keep these up to date! */ +#define X509_TRUST_MIN 1 +#define X509_TRUST_MAX 7 + + +/* trust_flags values */ +#define X509_TRUST_DYNAMIC 1 +#define X509_TRUST_DYNAMIC_NAME 2 + +/* check_trust return codes */ + +#define X509_TRUST_TRUSTED 1 +#define X509_TRUST_REJECTED 2 +#define X509_TRUST_UNTRUSTED 3 + +/* Flags for X509_print_ex() */ + +#define X509_FLAG_COMPAT 0 +#define X509_FLAG_NO_HEADER 1L +#define X509_FLAG_NO_VERSION (1L << 1) +#define X509_FLAG_NO_SERIAL (1L << 2) +#define X509_FLAG_NO_SIGNAME (1L << 3) +#define X509_FLAG_NO_ISSUER (1L << 4) +#define X509_FLAG_NO_VALIDITY (1L << 5) +#define X509_FLAG_NO_SUBJECT (1L << 6) +#define X509_FLAG_NO_PUBKEY (1L << 7) +#define X509_FLAG_NO_EXTENSIONS (1L << 8) +#define X509_FLAG_NO_SIGDUMP (1L << 9) +#define X509_FLAG_NO_AUX (1L << 10) +#define X509_FLAG_NO_ATTRIBUTES (1L << 11) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +#define XN_FLAG_SEP_MASK (0xf << 16) + +#define XN_FLAG_COMPAT 0 /* Traditional SSLeay: use old X509_NAME_print */ +#define XN_FLAG_SEP_COMMA_PLUS (1 << 16) /* RFC2253 ,+ */ +#define XN_FLAG_SEP_CPLUS_SPC (2 << 16) /* ,+ spaced: more readable */ +#define XN_FLAG_SEP_SPLUS_SPC (3 << 16) /* ;+ spaced */ +#define XN_FLAG_SEP_MULTILINE (4 << 16) /* One line per field */ + +#define XN_FLAG_DN_REV (1 << 20) /* Reverse DN order */ + +/* How the field name is shown */ + +#define XN_FLAG_FN_MASK (0x3 << 21) + +#define XN_FLAG_FN_SN 0 /* Object short name */ +#define XN_FLAG_FN_LN (1 << 21) /* Object long name */ +#define XN_FLAG_FN_OID (2 << 21) /* Always use OIDs */ +#define XN_FLAG_FN_NONE (3 << 21) /* No field names */ + +#define XN_FLAG_SPC_EQ (1 << 23) /* Put spaces round '=' */ + +/* This determines if we dump fields we don't recognise: + * RFC2253 requires this. + */ + +#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +#define XN_FLAG_FN_ALIGN (1 << 25) /* Align field names to 20 characters */ + +/* Complete set of RFC2253 flags */ + +#define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ + XN_FLAG_SEP_COMMA_PLUS | \ + XN_FLAG_DN_REV | \ + XN_FLAG_FN_SN | \ + XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +#define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ + ASN1_STRFLGS_ESC_QUOTE | \ + XN_FLAG_SEP_CPLUS_SPC | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_SN) + +/* readable multiline form */ + +#define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + XN_FLAG_SEP_MULTILINE | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_LN | \ + XN_FLAG_FN_ALIGN) + +typedef struct X509_revoked_st + { + ASN1_INTEGER *serialNumber; + ASN1_TIME *revocationDate; + STACK_OF(X509_EXTENSION) /* optional */ *extensions; + int sequence; /* load sequence */ + } X509_REVOKED; + +DECLARE_STACK_OF(X509_REVOKED) +DECLARE_ASN1_SET_OF(X509_REVOKED) + +typedef struct X509_crl_info_st + { + ASN1_INTEGER *version; + X509_ALGOR *sig_alg; + X509_NAME *issuer; + ASN1_TIME *lastUpdate; + ASN1_TIME *nextUpdate; + STACK_OF(X509_REVOKED) *revoked; + STACK_OF(X509_EXTENSION) /* [0] */ *extensions; + ASN1_ENCODING enc; + } X509_CRL_INFO; + +struct X509_crl_st + { + /* actual signature */ + X509_CRL_INFO *crl; + X509_ALGOR *sig_alg; + ASN1_BIT_STRING *signature; + int references; + } /* X509_CRL */; + +DECLARE_STACK_OF(X509_CRL) +DECLARE_ASN1_SET_OF(X509_CRL) + +typedef struct private_key_st + { + int version; + /* The PKCS#8 data types */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + + /* When decrypted, the following will not be NULL */ + EVP_PKEY *dec_pkey; + + /* used to encrypt and decrypt */ + int key_length; + char *key_data; + int key_free; /* true if we should auto free key_data */ + + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; + + int references; + } X509_PKEY; + +#ifndef OPENSSL_NO_EVP +typedef struct X509_info_st + { + X509 *x509; + X509_CRL *crl; + X509_PKEY *x_pkey; + + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char *enc_data; + + int references; + } X509_INFO; + +DECLARE_STACK_OF(X509_INFO) +#endif + +/* The next 2 structures and their 8 routines were sent to me by + * Pat Richard and are used to manipulate + * Netscapes spki structures - useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st + { + X509_PUBKEY *pubkey; + ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ + } NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st + { + NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ + X509_ALGOR *sig_algor; + ASN1_BIT_STRING *signature; + } NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence + { + ASN1_OBJECT *type; + STACK_OF(X509) *certs; + } NETSCAPE_CERT_SEQUENCE; + +/* Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { +ASN1_OCTET_STRING *salt; +ASN1_INTEGER *iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { +X509_ALGOR *keyfunc; +X509_ALGOR *encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { +ASN1_TYPE *salt; /* Usually OCTET STRING but could be anything */ +ASN1_INTEGER *iter; +ASN1_INTEGER *keylength; +X509_ALGOR *prf; +} PBKDF2PARAM; + + +/* PKCS#8 private key info structure */ + +typedef struct pkcs8_priv_key_info_st + { + int broken; /* Flag for various broken formats */ +#define PKCS8_OK 0 +#define PKCS8_NO_OCTET 1 +#define PKCS8_EMBEDDED_PARAM 2 +#define PKCS8_NS_DB 3 + ASN1_INTEGER *version; + X509_ALGOR *pkeyalg; + ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ + STACK_OF(X509_ATTRIBUTE) *attributes; + } PKCS8_PRIV_KEY_INFO; + +#ifdef __cplusplus +} +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef SSLEAY_MACROS +#define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\ + a->signature,(char *)a->cert_info,r) +#define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \ + a->sig_alg,a->signature,(char *)a->req_info,r) +#define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \ + a->sig_alg, a->signature,(char *)a->crl,r) + +#define X509_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \ + x->sig_alg, x->signature, (char *)x->cert_info,pkey,md) +#define X509_REQ_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \ + x->signature, (char *)x->req_info,pkey,md) +#define X509_CRL_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \ + x->signature, (char *)x->crl,pkey,md) +#define NETSCAPE_SPKI_sign(x,pkey,md) \ + ASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \ + x->signature, (char *)x->spkac,pkey,md) + +#define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \ + (char *(*)())d2i_X509,(char *)x509) +#define X509_ATTRIBUTE_dup(xa) (X509_ATTRIBUTE *)ASN1_dup(\ + (int (*)())i2d_X509_ATTRIBUTE, \ + (char *(*)())d2i_X509_ATTRIBUTE,(char *)xa) +#define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \ + (int (*)())i2d_X509_EXTENSION, \ + (char *(*)())d2i_X509_EXTENSION,(char *)ex) +#define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \ + (char *(*)())d2i_X509, (fp),(unsigned char **)(x509)) +#define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509) +#define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \ + (char *(*)())d2i_X509, (bp),(unsigned char **)(x509)) +#define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x509) + +#define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \ + (char *(*)())d2i_X509_CRL,(char *)crl) +#define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \ + X509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\ + (unsigned char **)(crl)) +#define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\ + (unsigned char *)crl) +#define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \ + X509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\ + (unsigned char **)(crl)) +#define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\ + (unsigned char *)crl) + +#define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \ + (char *(*)())d2i_PKCS7,(char *)p7) +#define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \ + PKCS7_new,(char *(*)())d2i_PKCS7, (fp),\ + (unsigned char **)(p7)) +#define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\ + (unsigned char *)p7) +#define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \ + PKCS7_new,(char *(*)())d2i_PKCS7, (bp),\ + (unsigned char **)(p7)) +#define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\ + (unsigned char *)p7) + +#define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \ + (char *(*)())d2i_X509_REQ,(char *)req) +#define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\ + X509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\ + (unsigned char **)(req)) +#define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\ + (unsigned char *)req) +#define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\ + X509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\ + (unsigned char **)(req)) +#define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\ + (unsigned char *)req) + +#define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey, \ + (char *(*)())d2i_RSAPublicKey,(char *)rsa) +#define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKey, \ + (char *(*)())d2i_RSAPrivateKey,(char *)rsa) + +#define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \ + (unsigned char *)rsa) +#define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \ + (unsigned char *)rsa) + +#define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \ + (unsigned char *)rsa) +#define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\ + RSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \ + (unsigned char **)(rsa)) +#define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \ + (unsigned char *)rsa) + +#define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\ + DSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \ + (unsigned char **)(dsa)) +#define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \ + (unsigned char *)dsa) +#define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\ + DSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \ + (unsigned char **)(dsa)) +#define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \ + (unsigned char *)dsa) + +#define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\ + EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \ + (unsigned char **)(ecdsa)) +#define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \ + (unsigned char *)ecdsa) +#define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)())\ + EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \ + (unsigned char **)(ecdsa)) +#define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \ + (unsigned char *)ecdsa) + +#define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\ + (char *(*)())d2i_X509_ALGOR,(char *)xn) + +#define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \ + (char *(*)())d2i_X509_NAME,(char *)xn) +#define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \ + (int (*)())i2d_X509_NAME_ENTRY, \ + (char *(*)())d2i_X509_NAME_ENTRY,\ + (char *)ne) + +#define X509_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len) +#define X509_NAME_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len) +#ifndef PKCS7_ISSUER_AND_SERIAL_digest +#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \ + ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\ + (char *)data,md,len) +#endif +#endif + +#define X509_EXT_PACK_UNKNOWN 1 +#define X509_EXT_PACK_STRING 2 + +#define X509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version) +/* #define X509_get_serialNumber(x) ((x)->cert_info->serialNumber) */ +#define X509_get_notBefore(x) ((x)->cert_info->validity->notBefore) +#define X509_get_notAfter(x) ((x)->cert_info->validity->notAfter) +#define X509_extract_key(x) X509_get_pubkey(x) /*****/ +#define X509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version) +#define X509_REQ_get_subject_name(x) ((x)->req_info->subject) +#define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +#define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) +#define X509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm)) + +#define X509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version) +#define X509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate) +#define X509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate) +#define X509_CRL_get_issuer(x) ((x)->crl->issuer) +#define X509_CRL_get_REVOKED(x) ((x)->crl->revoked) + +/* This one is only used so that a binary form can output, as in + * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */ +#define X509_get_X509_PUBKEY(x) ((x)->cert_info->key) + + +const char *X509_verify_cert_error_string(long n); + +#ifndef SSLEAY_MACROS +#ifndef OPENSSL_NO_EVP +int X509_verify(X509 *a, EVP_PKEY *r); + +int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); +int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); + +NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len); +char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); +EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); +int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); + +int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); + +int X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig); + +int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); + +int X509_pubkey_digest(const X509 *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_digest(const X509 *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type, + unsigned char *md, unsigned int *len); +#endif + +#ifndef OPENSSL_NO_FP_API +X509 *d2i_X509_fp(FILE *fp, X509 **x509); +int i2d_X509_fp(FILE *fp,X509 *x509); +X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl); +int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl); +X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req); +int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req); +#ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa); +int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); +RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); +int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); +RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa); +int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa); +#endif +#ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); +int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); +DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); +int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); +#endif +#ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); +int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); +int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); +#endif +X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); +int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); +int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); +int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); +#endif + +#ifndef OPENSSL_NO_BIO +X509 *d2i_X509_bio(BIO *bp,X509 **x509); +int i2d_X509_bio(BIO *bp,X509 *x509); +X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl); +int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl); +X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req); +int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req); +#ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa); +int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); +RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); +int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); +RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa); +int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa); +#endif +#ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); +int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); +DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); +int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); +#endif +#ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); +int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); +int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); +#endif +X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8); +int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); +int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); +int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); +#endif + +X509 *X509_dup(X509 *x509); +X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); +X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); +X509_CRL *X509_CRL_dup(X509_CRL *crl); +X509_REQ *X509_REQ_dup(X509_REQ *req); +X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); +int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval); +void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval, + X509_ALGOR *algor); + +X509_NAME *X509_NAME_dup(X509_NAME *xn); +X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); + +#endif /* !SSLEAY_MACROS */ + +int X509_cmp_time(ASN1_TIME *s, time_t *t); +int X509_cmp_current_time(ASN1_TIME *s); +ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); +ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); + +const char * X509_get_default_cert_area(void ); +const char * X509_get_default_cert_dir(void ); +const char * X509_get_default_cert_file(void ); +const char * X509_get_default_cert_dir_env(void ); +const char * X509_get_default_cert_file_env(void ); +const char * X509_get_default_private_dir(void ); + +X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); +EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); +int X509_get_pubkey_parameters(EVP_PKEY *pkey, + STACK_OF(X509) *chain); +int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp); +EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp, + long length); +#ifndef OPENSSL_NO_RSA +int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp); +RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp, + long length); +#endif +#ifndef OPENSSL_NO_DSA +int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp); +DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp, + long length); +#endif +#ifndef OPENSSL_NO_EC +int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); +EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, + long length); +#endif + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +int X509_NAME_set(X509_NAME **xn, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) + +DECLARE_ASN1_FUNCTIONS(X509) +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR) + +int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int X509_set_ex_data(X509 *r, int idx, void *arg); +void *X509_get_ex_data(X509 *r, int idx); +int i2d_X509_AUX(X509 *a,unsigned char **pp); +X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length); + +int X509_alias_set1(X509 *x, unsigned char *name, int len); +int X509_keyid_set1(X509 *x, unsigned char *id, int len); +unsigned char * X509_alias_get0(X509 *x, int *len); +unsigned char * X509_keyid_get0(X509 *x, int *len); +int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int); +int X509_TRUST_set(int *t, int trust); +int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); +int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj); +void X509_trust_clear(X509 *x); +void X509_reject_clear(X509 *x); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) + +int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); + +X509_PKEY * X509_PKEY_new(void ); +void X509_PKEY_free(X509_PKEY *a); +int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp); +X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +#ifndef OPENSSL_NO_EVP +X509_INFO * X509_INFO_new(void); +void X509_INFO_free(X509_INFO *a); +char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); + +int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey); + +int ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data, + unsigned char *md,unsigned int *len); + +int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + char *data,EVP_PKEY *pkey, const EVP_MD *type); + +int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data, + unsigned char *md,unsigned int *len); + +int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey); + +int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, + ASN1_BIT_STRING *signature, + void *data, EVP_PKEY *pkey, const EVP_MD *type); +#endif + +int X509_set_version(X509 *x,long version); +int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); +ASN1_INTEGER * X509_get_serialNumber(X509 *x); +int X509_set_issuer_name(X509 *x, X509_NAME *name); +X509_NAME * X509_get_issuer_name(X509 *a); +int X509_set_subject_name(X509 *x, X509_NAME *name); +X509_NAME * X509_get_subject_name(X509 *a); +int X509_set_notBefore(X509 *x, ASN1_TIME *tm); +int X509_set_notAfter(X509 *x, ASN1_TIME *tm); +int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); +EVP_PKEY * X509_get_pubkey(X509 *x); +ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x); +int X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */); + +int X509_REQ_set_version(X509_REQ *x,long version); +int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name); +int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); +EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); +int X509_REQ_extension_nid(int nid); +int * X509_REQ_get_extension_nids(void); +void X509_REQ_set_extension_nids(int *nids); +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); +int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, + int nid); +int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); +int X509_REQ_get_attr_count(const X509_REQ *req); +int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, + int lastpos); +int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_NID(X509_REQ *req, + int nid, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_txt(X509_REQ *req, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_CRL_set_version(X509_CRL *x, long version); +int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); +int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm); +int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm); +int X509_CRL_sort(X509_CRL *crl); + +int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); +int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); + +int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey); + +int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); + +int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_and_serial_hash(X509 *a); + +int X509_issuer_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_name_hash(X509 *a); + +int X509_subject_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_subject_name_hash(X509 *x); + +int X509_cmp(const X509 *a, const X509 *b); +int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); +unsigned long X509_NAME_hash(X509_NAME *x); + +int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); +#ifndef OPENSSL_NO_FP_API +int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag); +int X509_print_fp(FILE *bp,X509 *x); +int X509_CRL_print_fp(FILE *bp,X509_CRL *x); +int X509_REQ_print_fp(FILE *bp,X509_REQ *req); +int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags); +#endif + +#ifndef OPENSSL_NO_BIO +int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); +int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags); +int X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag); +int X509_print(BIO *bp,X509 *x); +int X509_ocspid_print(BIO *bp,X509 *x); +int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent); +int X509_CRL_print(BIO *bp,X509_CRL *x); +int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag); +int X509_REQ_print(BIO *bp,X509_REQ *req); +#endif + +int X509_NAME_entry_count(X509_NAME *name); +int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, + char *buf,int len); +int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, + char *buf,int len); + +/* NOTE: you should be passsing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. */ +int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); +int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, + int lastpos); +X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); +X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); +int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, + int loc, int set); +int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, + unsigned char *bytes, int len, int loc, int set); +int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, + unsigned char *bytes, int len, int loc, int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, + const char *field, int type, const unsigned char *bytes, int len); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, + int type,unsigned char *bytes, int len); +int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, + const unsigned char *bytes, int len, int loc, int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, + ASN1_OBJECT *obj, int type,const unsigned char *bytes, + int len); +int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, + ASN1_OBJECT *obj); +int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, + const unsigned char *bytes, int len); +ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne); +ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne); + +int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); +int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, + int nid, int lastpos); +int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, + ASN1_OBJECT *obj,int lastpos); +int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, + int crit, int lastpos); +X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); +X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); +STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, + X509_EXTENSION *ex, int loc); + +int X509_get_ext_count(X509 *x); +int X509_get_ext_by_NID(X509 *x, int nid, int lastpos); +int X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos); +int X509_get_ext_by_critical(X509 *x, int crit, int lastpos); +X509_EXTENSION *X509_get_ext(X509 *x, int loc); +X509_EXTENSION *X509_delete_ext(X509 *x, int loc); +int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); +void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); +int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_CRL_get_ext_count(X509_CRL *x); +int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); +int X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos); +int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos); +X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); +X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); +int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); +void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); +int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_REVOKED_get_ext_count(X509_REVOKED *x); +int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); +int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos); +int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos); +X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); +X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); +int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); +void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); +int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, + unsigned long flags); + +X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, + int nid, int crit, ASN1_OCTET_STRING *data); +X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, + ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data); +int X509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj); +int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); +int X509_EXTENSION_set_data(X509_EXTENSION *ex, + ASN1_OCTET_STRING *data); +ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex); +ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); +int X509_EXTENSION_get_critical(X509_EXTENSION *ex); + +int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); +int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, + int lastpos); +int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); +X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, + X509_ATTRIBUTE *attr); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, + int nid, int type, + const unsigned char *bytes, int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, + const char *attrname, int type, + const unsigned char *bytes, int len); +void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, + ASN1_OBJECT *obj, int lastpos, int type); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, + int atrtype, const void *data, int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, + const ASN1_OBJECT *obj, int atrtype, const void *data, int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, + const char *atrname, int type, const unsigned char *bytes, int len); +int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); +int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len); +void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, + int atrtype, void *data); +int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr); +ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); +ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); + +int EVP_PKEY_get_attr_count(const EVP_PKEY *key); +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, + int lastpos); +int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); +X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); +int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); +int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, + int nid, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_verify_cert(X509_STORE_CTX *ctx); + +/* lookup a cert from a X509 STACK */ +X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name, + ASN1_INTEGER *serial); +X509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) + +X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen); + +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); +PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); + +int X509_check_trust(X509 *x, int id, int flags); +int X509_TRUST_get_count(void); +X509_TRUST * X509_TRUST_get0(int idx); +int X509_TRUST_get_by_id(int id); +int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), + char *name, int arg1, void *arg2); +void X509_TRUST_cleanup(void); +int X509_TRUST_get_flags(X509_TRUST *xp); +char *X509_TRUST_get0_name(X509_TRUST *xp); +int X509_TRUST_get_trust(X509_TRUST *xp); + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_X509_strings(void); + +/* Error codes for the X509 functions. */ + +/* Function codes. */ +#define X509_F_ADD_CERT_DIR 100 +#define X509_F_BY_FILE_CTRL 101 +#define X509_F_CHECK_POLICY 145 +#define X509_F_DIR_CTRL 102 +#define X509_F_GET_CERT_BY_SUBJECT 103 +#define X509_F_NETSCAPE_SPKI_B64_DECODE 129 +#define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 +#define X509_F_X509AT_ADD1_ATTR 135 +#define X509_F_X509V3_ADD_EXT 104 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 +#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 +#define X509_F_X509_ATTRIBUTE_GET0_DATA 139 +#define X509_F_X509_ATTRIBUTE_SET1_DATA 138 +#define X509_F_X509_CHECK_PRIVATE_KEY 128 +#define X509_F_X509_CRL_PRINT_FP 147 +#define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +#define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +#define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +#define X509_F_X509_LOAD_CERT_CRL_FILE 132 +#define X509_F_X509_LOAD_CERT_FILE 111 +#define X509_F_X509_LOAD_CRL_FILE 112 +#define X509_F_X509_NAME_ADD_ENTRY 113 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 +#define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +#define X509_F_X509_NAME_ONELINE 116 +#define X509_F_X509_NAME_PRINT 117 +#define X509_F_X509_PRINT_EX_FP 118 +#define X509_F_X509_PUBKEY_GET 119 +#define X509_F_X509_PUBKEY_SET 120 +#define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 +#define X509_F_X509_REQ_PRINT_EX 121 +#define X509_F_X509_REQ_PRINT_FP 122 +#define X509_F_X509_REQ_TO_X509 123 +#define X509_F_X509_STORE_ADD_CERT 124 +#define X509_F_X509_STORE_ADD_CRL 125 +#define X509_F_X509_STORE_CTX_GET1_ISSUER 146 +#define X509_F_X509_STORE_CTX_INIT 143 +#define X509_F_X509_STORE_CTX_NEW 142 +#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 +#define X509_F_X509_TO_X509_REQ 126 +#define X509_F_X509_TRUST_ADD 133 +#define X509_F_X509_TRUST_SET 141 +#define X509_F_X509_VERIFY_CERT 127 + +/* Reason codes. */ +#define X509_R_BAD_X509_FILETYPE 100 +#define X509_R_BASE64_DECODE_ERROR 118 +#define X509_R_CANT_CHECK_DH_KEY 114 +#define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +#define X509_R_ERR_ASN1_LIB 102 +#define X509_R_INVALID_DIRECTORY 113 +#define X509_R_INVALID_FIELD_NAME 119 +#define X509_R_INVALID_TRUST 123 +#define X509_R_KEY_TYPE_MISMATCH 115 +#define X509_R_KEY_VALUES_MISMATCH 116 +#define X509_R_LOADING_CERT_DIR 103 +#define X509_R_LOADING_DEFAULTS 104 +#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +#define X509_R_SHOULD_RETRY 106 +#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +#define X509_R_UNKNOWN_KEY_TYPE 117 +#define X509_R_UNKNOWN_NID 109 +#define X509_R_UNKNOWN_PURPOSE_ID 121 +#define X509_R_UNKNOWN_TRUST_ID 120 +#define X509_R_UNSUPPORTED_ALGORITHM 111 +#define X509_R_WRONG_LOOKUP_TYPE 112 +#define X509_R_WRONG_TYPE 122 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/openssl/x509_vfy.h b/externals/openssl/x509_vfy.h new file mode 100644 index 0000000..053920a --- /dev/null +++ b/externals/openssl/x509_vfy.h @@ -0,0 +1,532 @@ +/* crypto/x509/x509_vfy.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_X509_H +#include +/* openssl/x509.h ends up #include-ing this file at about the only + * appropriate moment. */ +#endif + +#ifndef HEADER_X509_VFY_H +#define HEADER_X509_VFY_H + +#include +#ifndef OPENSSL_NO_LHASH +#include +#endif +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Outer object */ +typedef struct x509_hash_dir_st + { + int num_dirs; + char **dirs; + int *dirs_type; + int num_dirs_alloced; + } X509_HASH_DIR_CTX; + +typedef struct x509_file_st + { + int num_paths; /* number of paths to files or directories */ + int num_alloced; + char **paths; /* the list of paths or directories */ + int *path_type; + } X509_CERT_FILE_CTX; + +/*******************************/ +/* +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#define X509_LU_X509 1 +#define X509_LU_CRL 2 +#define X509_LU_PKEY 3 + +typedef struct x509_object_st + { + /* one of the above types */ + int type; + union { + char *ptr; + X509 *x509; + X509_CRL *crl; + EVP_PKEY *pkey; + } data; + } X509_OBJECT; + +typedef struct x509_lookup_st X509_LOOKUP; + +DECLARE_STACK_OF(X509_LOOKUP) +DECLARE_STACK_OF(X509_OBJECT) + +/* This is a static that defines the function interface */ +typedef struct x509_lookup_method_st + { + const char *name; + int (*new_item)(X509_LOOKUP *ctx); + void (*free)(X509_LOOKUP *ctx); + int (*init)(X509_LOOKUP *ctx); + int (*shutdown)(X509_LOOKUP *ctx); + int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl, + char **ret); + int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name, + X509_OBJECT *ret); + int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name, + ASN1_INTEGER *serial,X509_OBJECT *ret); + int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type, + unsigned char *bytes,int len, + X509_OBJECT *ret); + int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len, + X509_OBJECT *ret); + } X509_LOOKUP_METHOD; + +/* This structure hold all parameters associated with a verify operation + * by including an X509_VERIFY_PARAM structure in related structures the + * parameters used can be customized + */ + +typedef struct X509_VERIFY_PARAM_st + { + char *name; + time_t check_time; /* Time to use */ + unsigned long inh_flags; /* Inheritance flags */ + unsigned long flags; /* Various verify flags */ + int purpose; /* purpose to check untrusted certificates */ + int trust; /* trust setting to check */ + int depth; /* Verify depth */ + STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */ + } X509_VERIFY_PARAM; + +DECLARE_STACK_OF(X509_VERIFY_PARAM) + +/* This is used to hold everything. It is used for all certificate + * validation. Once we have a certificate chain, the 'verify' + * function is then called to actually check the cert chain. */ +struct x509_store_st + { + /* The following is a cache of trusted certs */ + int cache; /* if true, stash any hits */ + STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */ + + /* These are external lookup methods */ + STACK_OF(X509_LOOKUP) *get_cert_methods; + + X509_VERIFY_PARAM *param; + + /* Callbacks for various operations */ + int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ + int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ + int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ + int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ + int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */ + int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ + int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ + int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ + int (*cleanup)(X509_STORE_CTX *ctx); + + CRYPTO_EX_DATA ex_data; + int references; + } /* X509_STORE */; + +int X509_STORE_set_depth(X509_STORE *store, int depth); + +#define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func)) +#define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) + +/* This is the functions plus an instance of the local variables. */ +struct x509_lookup_st + { + int init; /* have we been started */ + int skip; /* don't use us. */ + X509_LOOKUP_METHOD *method; /* the functions */ + char *method_data; /* method data */ + + X509_STORE *store_ctx; /* who owns us */ + } /* X509_LOOKUP */; + +/* This is a used when verifying cert chains. Since the + * gathering of the cert chain can take some time (and have to be + * 'retried', this needs to be kept and passed around. */ +struct x509_store_ctx_st /* X509_STORE_CTX */ + { + X509_STORE *ctx; + int current_method; /* used when looking up certs */ + + /* The following are set by the caller */ + X509 *cert; /* The cert to check */ + STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ + STACK_OF(X509_CRL) *crls; /* set of CRLs passed in */ + + X509_VERIFY_PARAM *param; + void *other_ctx; /* Other info for use with get_issuer() */ + + /* Callbacks for various operations */ + int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ + int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ + int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ + int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ + int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */ + int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ + int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ + int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ + int (*check_policy)(X509_STORE_CTX *ctx); + int (*cleanup)(X509_STORE_CTX *ctx); + + /* The following is built up */ + int valid; /* if 0, rebuild chain */ + int last_untrusted; /* index of last untrusted cert */ + STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */ + X509_POLICY_TREE *tree; /* Valid policy tree */ + + int explicit_policy; /* Require explicit policy value */ + + /* When something goes wrong, this is why */ + int error_depth; + int error; + X509 *current_cert; + X509 *current_issuer; /* cert currently being tested as valid issuer */ + X509_CRL *current_crl; /* current CRL */ + + CRYPTO_EX_DATA ex_data; + } /* X509_STORE_CTX */; + +void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + +#define X509_STORE_CTX_set_app_data(ctx,data) \ + X509_STORE_CTX_set_ex_data(ctx,0,data) +#define X509_STORE_CTX_get_app_data(ctx) \ + X509_STORE_CTX_get_ex_data(ctx,0) + +#define X509_L_FILE_LOAD 1 +#define X509_L_ADD_DIR 2 + +#define X509_LOOKUP_load_file(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) + +#define X509_LOOKUP_add_dir(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) + +#define X509_V_OK 0 +/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */ + +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +#define X509_V_ERR_UNABLE_TO_GET_CRL 3 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +#define X509_V_ERR_CERT_NOT_YET_VALID 9 +#define X509_V_ERR_CERT_HAS_EXPIRED 10 +#define X509_V_ERR_CRL_NOT_YET_VALID 11 +#define X509_V_ERR_CRL_HAS_EXPIRED 12 +#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +#define X509_V_ERR_OUT_OF_MEM 17 +#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +#define X509_V_ERR_CERT_REVOKED 23 +#define X509_V_ERR_INVALID_CA 24 +#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +#define X509_V_ERR_INVALID_PURPOSE 26 +#define X509_V_ERR_CERT_UNTRUSTED 27 +#define X509_V_ERR_CERT_REJECTED 28 +/* These are 'informational' when looking for issuer cert */ +#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +#define X509_V_ERR_AKID_SKID_MISMATCH 30 +#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 + +#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +#define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +#define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +#define X509_V_ERR_INVALID_NON_CA 37 +#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 + +#define X509_V_ERR_INVALID_EXTENSION 41 +#define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +#define X509_V_ERR_NO_EXPLICIT_POLICY 43 + +#define X509_V_ERR_UNNESTED_RESOURCE 44 + +/* The application is not happy */ +#define X509_V_ERR_APPLICATION_VERIFICATION 50 + +/* Certificate verify flags */ + +/* Send issuer+subject checks to verify_cb */ +#define X509_V_FLAG_CB_ISSUER_CHECK 0x1 +/* Use check time instead of current time */ +#define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +#define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +#define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +#define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +#define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +#define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +#define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +#define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +#define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +#define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +#define X509_V_FLAG_NOTIFY_POLICY 0x800 + +#define X509_VP_FLAG_DEFAULT 0x1 +#define X509_VP_FLAG_OVERWRITE 0x2 +#define X509_VP_FLAG_RESET_FLAGS 0x4 +#define X509_VP_FLAG_LOCKED 0x8 +#define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ + | X509_V_FLAG_EXPLICIT_POLICY \ + | X509_V_FLAG_INHIBIT_ANY \ + | X509_V_FLAG_INHIBIT_MAP) + +int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x); +void X509_OBJECT_up_ref_count(X509_OBJECT *a); +void X509_OBJECT_free_contents(X509_OBJECT *a); +X509_STORE *X509_STORE_new(void ); +void X509_STORE_free(X509_STORE *v); + +int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); +int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); +int X509_STORE_set_trust(X509_STORE *ctx, int trust); +int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); + +X509_STORE_CTX *X509_STORE_CTX_new(void); + +int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); + +void X509_STORE_CTX_free(X509_STORE_CTX *ctx); +int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, + X509 *x509, STACK_OF(X509) *chain); +void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + +X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); + +X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD *X509_LOOKUP_file(void); + +int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); +int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); + +int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name, + X509_OBJECT *ret); + +int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); + +#ifndef OPENSSL_NO_STDIO +int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); +#endif + + +X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); +void X509_LOOKUP_free(X509_LOOKUP *ctx); +int X509_LOOKUP_init(X509_LOOKUP *ctx); +int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name, + X509_OBJECT *ret); +int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name, + ASN1_INTEGER *serial, X509_OBJECT *ret); +int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type, + unsigned char *bytes, int len, X509_OBJECT *ret); +int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, + int len, X509_OBJECT *ret); +int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); + +#ifndef OPENSSL_NO_STDIO +int X509_STORE_load_locations (X509_STORE *ctx, + const char *file, const char *dir); +int X509_STORE_set_default_paths(X509_STORE *ctx); +#endif + +int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data); +void * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx); +int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); +X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); +void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk); +void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk); +int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); +int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); +int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, + int purpose, int trust); +void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); +void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, + time_t t); +void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, + int (*verify_cb)(int, X509_STORE_CTX *)); + +X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); + +X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); +int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); + +/* X509_VERIFY_PARAM functions */ + +X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); +int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); +int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, + ASN1_OBJECT *policy); +int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); +void X509_VERIFY_PARAM_table_cleanup(void); + +int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, + STACK_OF(X509) *certs, + STACK_OF(ASN1_OBJECT) *policy_oids, + unsigned int flags); + +void X509_policy_tree_free(X509_POLICY_TREE *tree); + +int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); +X509_POLICY_LEVEL * + X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i); + +STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree); + +STACK_OF(X509_POLICY_NODE) * + X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree); + +int X509_policy_level_node_count(X509_POLICY_LEVEL *level); + +X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i); + +const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); + +STACK_OF(POLICYQUALINFO) * + X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node); +const X509_POLICY_NODE * + X509_policy_node_get0_parent(const X509_POLICY_NODE *node); + +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/externals/openssl/x509v3.h b/externals/openssl/x509v3.h new file mode 100644 index 0000000..9ef83da --- /dev/null +++ b/externals/openssl/x509v3.h @@ -0,0 +1,922 @@ +/* x509v3.h */ +/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL + * project 1999. + */ +/* ==================================================================== + * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED 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 OpenSSL PROJECT OR + * ITS 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. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ +#ifndef HEADER_X509V3_H +#define HEADER_X509V3_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void * (*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE)(void *); +typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long); +typedef int (*X509V3_EXT_I2D)(void *, unsigned char **); +typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist); +typedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values); +typedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext); +typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); +typedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO *out, int indent); +typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str); + +/* V3 extension structure */ + +struct v3_ext_method { +int ext_nid; +int ext_flags; +/* If this is set the following four fields are ignored */ +ASN1_ITEM_EXP *it; +/* Old style ASN1 calls */ +X509V3_EXT_NEW ext_new; +X509V3_EXT_FREE ext_free; +X509V3_EXT_D2I d2i; +X509V3_EXT_I2D i2d; + +/* The following pair is used for string extensions */ +X509V3_EXT_I2S i2s; +X509V3_EXT_S2I s2i; + +/* The following pair is used for multi-valued extensions */ +X509V3_EXT_I2V i2v; +X509V3_EXT_V2I v2i; + +/* The following are used for raw extensions */ +X509V3_EXT_I2R i2r; +X509V3_EXT_R2I r2i; + +void *usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { +char * (*get_string)(void *db, char *section, char *value); +STACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section); +void (*free_string)(void *db, char * string); +void (*free_section)(void *db, STACK_OF(CONF_VALUE) *section); +} X509V3_CONF_METHOD; + +/* Context specific info */ +struct v3_ext_ctx { +#define CTX_TEST 0x1 +int flags; +X509 *issuer_cert; +X509 *subject_cert; +X509_REQ *subject_req; +X509_CRL *crl; +X509V3_CONF_METHOD *db_meth; +void *db; +/* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +DECLARE_STACK_OF(X509V3_EXT_METHOD) + +/* ext_flags values */ +#define X509V3_EXT_DYNAMIC 0x1 +#define X509V3_EXT_CTX_DEP 0x2 +#define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { +int ca; +ASN1_INTEGER *pathlen; +} BASIC_CONSTRAINTS; + + +typedef struct PKEY_USAGE_PERIOD_st { +ASN1_GENERALIZEDTIME *notBefore; +ASN1_GENERALIZEDTIME *notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { +ASN1_OBJECT *type_id; +ASN1_TYPE *value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING *nameAssigner; + ASN1_STRING *partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { + +#define GEN_OTHERNAME 0 +#define GEN_EMAIL 1 +#define GEN_DNS 2 +#define GEN_X400 3 +#define GEN_DIRNAME 4 +#define GEN_EDIPARTY 5 +#define GEN_URI 6 +#define GEN_IPADD 7 +#define GEN_RID 8 + +int type; +union { + char *ptr; + OTHERNAME *otherName; /* otherName */ + ASN1_IA5STRING *rfc822Name; + ASN1_IA5STRING *dNSName; + ASN1_TYPE *x400Address; + X509_NAME *directoryName; + EDIPARTYNAME *ediPartyName; + ASN1_IA5STRING *uniformResourceIdentifier; + ASN1_OCTET_STRING *iPAddress; + ASN1_OBJECT *registeredID; + + /* Old names */ + ASN1_OCTET_STRING *ip; /* iPAddress */ + X509_NAME *dirn; /* dirn */ + ASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */ + ASN1_OBJECT *rid; /* registeredID */ + ASN1_TYPE *other; /* x400Address */ +} d; +} GENERAL_NAME; + +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT *method; + GENERAL_NAME *location; +} ACCESS_DESCRIPTION; + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; + +DECLARE_STACK_OF(GENERAL_NAME) +DECLARE_ASN1_SET_OF(GENERAL_NAME) + +DECLARE_STACK_OF(ACCESS_DESCRIPTION) +DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) + +typedef struct DIST_POINT_NAME_st { +int type; +union { + GENERAL_NAMES *fullname; + STACK_OF(X509_NAME_ENTRY) *relativename; +} name; +} DIST_POINT_NAME; + +typedef struct DIST_POINT_st { +DIST_POINT_NAME *distpoint; +ASN1_BIT_STRING *reasons; +GENERAL_NAMES *CRLissuer; +} DIST_POINT; + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +DECLARE_STACK_OF(DIST_POINT) +DECLARE_ASN1_SET_OF(DIST_POINT) + +typedef struct AUTHORITY_KEYID_st { +ASN1_OCTET_STRING *keyid; +GENERAL_NAMES *issuer; +ASN1_INTEGER *serial; +} AUTHORITY_KEYID; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER *zone; + ASN1_OCTET_STRING *user; +} SXNETID; + +DECLARE_STACK_OF(SXNETID) +DECLARE_ASN1_SET_OF(SXNETID) + +typedef struct SXNET_st { + ASN1_INTEGER *version; + STACK_OF(SXNETID) *ids; +} SXNET; + +typedef struct NOTICEREF_st { + ASN1_STRING *organization; + STACK_OF(ASN1_INTEGER) *noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF *noticeref; + ASN1_STRING *exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT *pqualid; + union { + ASN1_IA5STRING *cpsuri; + USERNOTICE *usernotice; + ASN1_TYPE *other; + } d; +} POLICYQUALINFO; + +DECLARE_STACK_OF(POLICYQUALINFO) +DECLARE_ASN1_SET_OF(POLICYQUALINFO) + +typedef struct POLICYINFO_st { + ASN1_OBJECT *policyid; + STACK_OF(POLICYQUALINFO) *qualifiers; +} POLICYINFO; + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +DECLARE_STACK_OF(POLICYINFO) +DECLARE_ASN1_SET_OF(POLICYINFO) + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT *issuerDomainPolicy; + ASN1_OBJECT *subjectDomainPolicy; +} POLICY_MAPPING; + +DECLARE_STACK_OF(POLICY_MAPPING) + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME *base; + ASN1_INTEGER *minimum; + ASN1_INTEGER *maximum; +} GENERAL_SUBTREE; + +DECLARE_STACK_OF(GENERAL_SUBTREE) + +typedef struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; +} NAME_CONSTRAINTS; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER *requireExplicitPolicy; + ASN1_INTEGER *inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st + { + ASN1_OBJECT *policyLanguage; + ASN1_OCTET_STRING *policy; + } PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st + { + ASN1_INTEGER *pcPathLengthConstraint; + PROXY_POLICY *proxyPolicy; + } PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + + +#define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ +",name:", val->name, ",value:", val->value); + +#define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +#define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +#define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ + 0,0,0,0, \ + 0,0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ + NULL, NULL, \ + table} + +#define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ + 0,0,0,0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ + 0,0,0,0, \ + NULL} + +#define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + + +/* X509_PURPOSE stuff */ + +#define EXFLAG_BCONS 0x1 +#define EXFLAG_KUSAGE 0x2 +#define EXFLAG_XKUSAGE 0x4 +#define EXFLAG_NSCERT 0x8 + +#define EXFLAG_CA 0x10 +/* Really self issued not necessarily self signed */ +#define EXFLAG_SI 0x20 +#define EXFLAG_SS 0x20 +#define EXFLAG_V1 0x40 +#define EXFLAG_INVALID 0x80 +#define EXFLAG_SET 0x100 +#define EXFLAG_CRITICAL 0x200 +#define EXFLAG_PROXY 0x400 + +#define EXFLAG_INVALID_POLICY 0x800 + +#define KU_DIGITAL_SIGNATURE 0x0080 +#define KU_NON_REPUDIATION 0x0040 +#define KU_KEY_ENCIPHERMENT 0x0020 +#define KU_DATA_ENCIPHERMENT 0x0010 +#define KU_KEY_AGREEMENT 0x0008 +#define KU_KEY_CERT_SIGN 0x0004 +#define KU_CRL_SIGN 0x0002 +#define KU_ENCIPHER_ONLY 0x0001 +#define KU_DECIPHER_ONLY 0x8000 + +#define NS_SSL_CLIENT 0x80 +#define NS_SSL_SERVER 0x40 +#define NS_SMIME 0x20 +#define NS_OBJSIGN 0x10 +#define NS_SSL_CA 0x04 +#define NS_SMIME_CA 0x02 +#define NS_OBJSIGN_CA 0x01 +#define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) + +#define XKU_SSL_SERVER 0x1 +#define XKU_SSL_CLIENT 0x2 +#define XKU_SMIME 0x4 +#define XKU_CODE_SIGN 0x8 +#define XKU_SGC 0x10 +#define XKU_OCSP_SIGN 0x20 +#define XKU_TIMESTAMP 0x40 +#define XKU_DVCS 0x80 + +#define X509_PURPOSE_DYNAMIC 0x1 +#define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose)(const struct x509_purpose_st *, + const X509 *, int); + char *name; + char *sname; + void *usr_data; +} X509_PURPOSE; + +#define X509_PURPOSE_SSL_CLIENT 1 +#define X509_PURPOSE_SSL_SERVER 2 +#define X509_PURPOSE_NS_SSL_SERVER 3 +#define X509_PURPOSE_SMIME_SIGN 4 +#define X509_PURPOSE_SMIME_ENCRYPT 5 +#define X509_PURPOSE_CRL_SIGN 6 +#define X509_PURPOSE_ANY 7 +#define X509_PURPOSE_OCSP_HELPER 8 + +#define X509_PURPOSE_MIN 1 +#define X509_PURPOSE_MAX 8 + +/* Flags for X509V3_EXT_print() */ + +#define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +#define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +#define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +#define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +#define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +#define X509V3_ADD_OP_MASK 0xfL +#define X509V3_ADD_DEFAULT 0L +#define X509V3_ADD_APPEND 1L +#define X509V3_ADD_REPLACE 2L +#define X509V3_ADD_REPLACE_EXISTING 3L +#define X509V3_ADD_KEEP_EXISTING 4L +#define X509V3_ADD_DELETE 5L +#define X509V3_ADD_SILENT 0x10 + +DECLARE_STACK_OF(X509_PURPOSE) + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); +int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); +int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); + +ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone); +ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); +ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) + + +ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); +STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + ASN1_BIT_STRING *bits, + STACK_OF(CONF_VALUE) *extlist); + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret); +int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, + GENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist); +GENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) + +char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5); +ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a); + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +#ifdef HEADER_CONF_H +GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, + CONF_VALUE *cnf); +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc); +void X509V3_conf_free(CONF_VALUE *val); + +X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value); +X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value); +int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk); +int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert); +int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); + +X509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_nid, char *value); +X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, char *value); +int X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509 *cert); +int X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl); + +int X509V3_add_value_bool_nf(char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool); +int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint); +void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); +void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash); +#endif + +char * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section); +STACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section); +void X509V3_string_free(X509V3_CTX *ctx, char *str); +void X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); +void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, + X509_REQ *req, X509_CRL *crl, int flags); + +int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_uchar(const char *name, const unsigned char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_bool(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint, + STACK_OF(CONF_VALUE) **extlist); +char * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint); +ASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value); +char * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); +char * i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint); +int X509V3_EXT_add(X509V3_EXT_METHOD *ext); +int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); +int X509V3_EXT_add_alias(int nid_to, int nid_from); +void X509V3_EXT_cleanup(void); + +X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); +X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); +int X509V3_add_standard_extensions(void); +STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); +void *X509V3_EXT_d2i(X509_EXTENSION *ext); +void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx); + + +X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); +int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags); + +char *hex_to_string(unsigned char *buffer, long len); +unsigned char *string_to_hex(char *str, long *len); +int name_cmp(const char *name, const char *cmp); + +void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); +int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent); +int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); + +int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent); + +int X509_check_ca(X509 *x); +int X509_check_purpose(X509 *x, int id, int ca); +int X509_supported_extension(X509_EXTENSION *ex); +int X509_PURPOSE_set(int *p, int purpose); +int X509_check_issued(X509 *issuer, X509 *subject); +int X509_PURPOSE_get_count(void); +X509_PURPOSE * X509_PURPOSE_get0(int idx); +int X509_PURPOSE_get_by_sname(char *sname); +int X509_PURPOSE_get_by_id(int id); +int X509_PURPOSE_add(int id, int trust, int flags, + int (*ck)(const X509_PURPOSE *, const X509 *, int), + char *name, char *sname, void *arg); +char *X509_PURPOSE_get0_name(X509_PURPOSE *xp); +char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp); +int X509_PURPOSE_get_trust(X509_PURPOSE *xp); +void X509_PURPOSE_cleanup(void); +int X509_PURPOSE_get_id(X509_PURPOSE *); + +STACK *X509_get1_email(X509 *x); +STACK *X509_REQ_get1_email(X509_REQ *x); +void X509_email_free(STACK *sk); +STACK *X509_get1_ocsp(X509 *x); + +ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); +ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); +int a2i_ipadd(unsigned char *ipout, const char *ipasc); +int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk, + unsigned long chtype); + +void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); + +#ifndef OPENSSL_NO_RFC3779 + +typedef struct ASRange_st { + ASN1_INTEGER *min, *max; +} ASRange; + +#define ASIdOrRange_id 0 +#define ASIdOrRange_range 1 + +typedef struct ASIdOrRange_st { + int type; + union { + ASN1_INTEGER *id; + ASRange *range; + } u; +} ASIdOrRange; + +typedef STACK_OF(ASIdOrRange) ASIdOrRanges; +DECLARE_STACK_OF(ASIdOrRange) + +#define ASIdentifierChoice_inherit 0 +#define ASIdentifierChoice_asIdsOrRanges 1 + +typedef struct ASIdentifierChoice_st { + int type; + union { + ASN1_NULL *inherit; + ASIdOrRanges *asIdsOrRanges; + } u; +} ASIdentifierChoice; + +typedef struct ASIdentifiers_st { + ASIdentifierChoice *asnum, *rdi; +} ASIdentifiers; + +DECLARE_ASN1_FUNCTIONS(ASRange) +DECLARE_ASN1_FUNCTIONS(ASIdOrRange) +DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) +DECLARE_ASN1_FUNCTIONS(ASIdentifiers) + + +typedef struct IPAddressRange_st { + ASN1_BIT_STRING *min, *max; +} IPAddressRange; + +#define IPAddressOrRange_addressPrefix 0 +#define IPAddressOrRange_addressRange 1 + +typedef struct IPAddressOrRange_st { + int type; + union { + ASN1_BIT_STRING *addressPrefix; + IPAddressRange *addressRange; + } u; +} IPAddressOrRange; + +typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; +DECLARE_STACK_OF(IPAddressOrRange) + +#define IPAddressChoice_inherit 0 +#define IPAddressChoice_addressesOrRanges 1 + +typedef struct IPAddressChoice_st { + int type; + union { + ASN1_NULL *inherit; + IPAddressOrRanges *addressesOrRanges; + } u; +} IPAddressChoice; + +typedef struct IPAddressFamily_st { + ASN1_OCTET_STRING *addressFamily; + IPAddressChoice *ipAddressChoice; +} IPAddressFamily; + +typedef STACK_OF(IPAddressFamily) IPAddrBlocks; +DECLARE_STACK_OF(IPAddressFamily) + +DECLARE_ASN1_FUNCTIONS(IPAddressRange) +DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) +DECLARE_ASN1_FUNCTIONS(IPAddressChoice) +DECLARE_ASN1_FUNCTIONS(IPAddressFamily) + +/* + * API tag for elements of the ASIdentifer SEQUENCE. + */ +#define V3_ASID_ASNUM 0 +#define V3_ASID_RDI 1 + +/* + * AFI values, assigned by IANA. It'd be nice to make the AFI + * handling code totally generic, but there are too many little things + * that would need to be defined for other address families for it to + * be worth the trouble. + */ +#define IANA_AFI_IPV4 1 +#define IANA_AFI_IPV6 2 + +/* + * Utilities to construct and extract values from RFC3779 extensions, + * since some of the encodings (particularly for IP address prefixes + * and ranges) are a bit tedious to work with directly. + */ +int v3_asid_add_inherit(ASIdentifiers *asid, int which); +int v3_asid_add_id_or_range(ASIdentifiers *asid, int which, + ASN1_INTEGER *min, ASN1_INTEGER *max); +int v3_addr_add_inherit(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi); +int v3_addr_add_prefix(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *a, const int prefixlen); +int v3_addr_add_range(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *min, unsigned char *max); +unsigned v3_addr_get_afi(const IPAddressFamily *f); +int v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, + unsigned char *min, unsigned char *max, + const int length); + +/* + * Canonical forms. + */ +int v3_asid_is_canonical(ASIdentifiers *asid); +int v3_addr_is_canonical(IPAddrBlocks *addr); +int v3_asid_canonize(ASIdentifiers *asid); +int v3_addr_canonize(IPAddrBlocks *addr); + +/* + * Tests for inheritance and containment. + */ +int v3_asid_inherits(ASIdentifiers *asid); +int v3_addr_inherits(IPAddrBlocks *addr); +int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); +int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); + +/* + * Check whether RFC 3779 extensions nest properly in chains. + */ +int v3_asid_validate_path(X509_STORE_CTX *); +int v3_addr_validate_path(X509_STORE_CTX *); +int v3_asid_validate_resource_set(STACK_OF(X509) *chain, + ASIdentifiers *ext, + int allow_inheritance); +int v3_addr_validate_resource_set(STACK_OF(X509) *chain, + IPAddrBlocks *ext, + int allow_inheritance); + +#endif /* OPENSSL_NO_RFC3779 */ + +/* BEGIN ERROR CODES */ +/* The following lines are auto generated by the script mkerr.pl. Any changes + * made after this point may be overwritten when the script is next run. + */ +void ERR_load_X509V3_strings(void); + +/* Error codes for the X509V3 functions. */ + +/* Function codes. */ +#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 156 +#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 157 +#define X509V3_F_COPY_EMAIL 122 +#define X509V3_F_COPY_ISSUER 123 +#define X509V3_F_DO_DIRNAME 144 +#define X509V3_F_DO_EXT_CONF 124 +#define X509V3_F_DO_EXT_I2D 135 +#define X509V3_F_DO_EXT_NCONF 151 +#define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148 +#define X509V3_F_HEX_TO_STRING 111 +#define X509V3_F_I2S_ASN1_ENUMERATED 121 +#define X509V3_F_I2S_ASN1_IA5STRING 149 +#define X509V3_F_I2S_ASN1_INTEGER 120 +#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 +#define X509V3_F_NOTICE_SECTION 132 +#define X509V3_F_NREF_NOS 133 +#define X509V3_F_POLICY_SECTION 131 +#define X509V3_F_PROCESS_PCI_VALUE 150 +#define X509V3_F_R2I_CERTPOL 130 +#define X509V3_F_R2I_PCI 155 +#define X509V3_F_S2I_ASN1_IA5STRING 100 +#define X509V3_F_S2I_ASN1_INTEGER 108 +#define X509V3_F_S2I_ASN1_OCTET_STRING 112 +#define X509V3_F_S2I_ASN1_SKEY_ID 114 +#define X509V3_F_S2I_SKEY_ID 115 +#define X509V3_F_STRING_TO_HEX 113 +#define X509V3_F_SXNET_ADD_ID_ASC 125 +#define X509V3_F_SXNET_ADD_ID_INTEGER 126 +#define X509V3_F_SXNET_ADD_ID_ULONG 127 +#define X509V3_F_SXNET_GET_ID_ASC 128 +#define X509V3_F_SXNET_GET_ID_ULONG 129 +#define X509V3_F_V2I_ASIDENTIFIERS 158 +#define X509V3_F_V2I_ASN1_BIT_STRING 101 +#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 +#define X509V3_F_V2I_AUTHORITY_KEYID 119 +#define X509V3_F_V2I_BASIC_CONSTRAINTS 102 +#define X509V3_F_V2I_CRLD 134 +#define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 +#define X509V3_F_V2I_GENERAL_NAMES 118 +#define X509V3_F_V2I_GENERAL_NAME_EX 117 +#define X509V3_F_V2I_IPADDRBLOCKS 159 +#define X509V3_F_V2I_ISSUER_ALT 153 +#define X509V3_F_V2I_NAME_CONSTRAINTS 147 +#define X509V3_F_V2I_POLICY_CONSTRAINTS 146 +#define X509V3_F_V2I_POLICY_MAPPINGS 145 +#define X509V3_F_V2I_SUBJECT_ALT 154 +#define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL 160 +#define X509V3_F_V3_GENERIC_EXTENSION 116 +#define X509V3_F_X509V3_ADD1_I2D 140 +#define X509V3_F_X509V3_ADD_VALUE 105 +#define X509V3_F_X509V3_EXT_ADD 104 +#define X509V3_F_X509V3_EXT_ADD_ALIAS 106 +#define X509V3_F_X509V3_EXT_CONF 107 +#define X509V3_F_X509V3_EXT_I2D 136 +#define X509V3_F_X509V3_EXT_NCONF 152 +#define X509V3_F_X509V3_GET_SECTION 142 +#define X509V3_F_X509V3_GET_STRING 143 +#define X509V3_F_X509V3_GET_VALUE_BOOL 110 +#define X509V3_F_X509V3_PARSE_LIST 109 +#define X509V3_F_X509_PURPOSE_ADD 137 +#define X509V3_F_X509_PURPOSE_SET 141 + +/* Reason codes. */ +#define X509V3_R_BAD_IP_ADDRESS 118 +#define X509V3_R_BAD_OBJECT 119 +#define X509V3_R_BN_DEC2BN_ERROR 100 +#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 +#define X509V3_R_DIRNAME_ERROR 149 +#define X509V3_R_DUPLICATE_ZONE_ID 133 +#define X509V3_R_ERROR_CONVERTING_ZONE 131 +#define X509V3_R_ERROR_CREATING_EXTENSION 144 +#define X509V3_R_ERROR_IN_EXTENSION 128 +#define X509V3_R_EXPECTED_A_SECTION_NAME 137 +#define X509V3_R_EXTENSION_EXISTS 145 +#define X509V3_R_EXTENSION_NAME_ERROR 115 +#define X509V3_R_EXTENSION_NOT_FOUND 102 +#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 +#define X509V3_R_EXTENSION_VALUE_ERROR 116 +#define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 +#define X509V3_R_ILLEGAL_HEX_DIGIT 113 +#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 +#define X509V3_R_INVALID_ASNUMBER 160 +#define X509V3_R_INVALID_ASRANGE 161 +#define X509V3_R_INVALID_BOOLEAN_STRING 104 +#define X509V3_R_INVALID_EXTENSION_STRING 105 +#define X509V3_R_INVALID_INHERITANCE 162 +#define X509V3_R_INVALID_IPADDRESS 163 +#define X509V3_R_INVALID_NAME 106 +#define X509V3_R_INVALID_NULL_ARGUMENT 107 +#define X509V3_R_INVALID_NULL_NAME 108 +#define X509V3_R_INVALID_NULL_VALUE 109 +#define X509V3_R_INVALID_NUMBER 140 +#define X509V3_R_INVALID_NUMBERS 141 +#define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 +#define X509V3_R_INVALID_OPTION 138 +#define X509V3_R_INVALID_POLICY_IDENTIFIER 134 +#define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 +#define X509V3_R_INVALID_PURPOSE 146 +#define X509V3_R_INVALID_SAFI 164 +#define X509V3_R_INVALID_SECTION 135 +#define X509V3_R_INVALID_SYNTAX 143 +#define X509V3_R_ISSUER_DECODE_ERROR 126 +#define X509V3_R_MISSING_VALUE 124 +#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 +#define X509V3_R_NO_CONFIG_DATABASE 136 +#define X509V3_R_NO_ISSUER_CERTIFICATE 121 +#define X509V3_R_NO_ISSUER_DETAILS 127 +#define X509V3_R_NO_POLICY_IDENTIFIER 139 +#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 +#define X509V3_R_NO_PUBLIC_KEY 114 +#define X509V3_R_NO_SUBJECT_DETAILS 125 +#define X509V3_R_ODD_NUMBER_OF_DIGITS 112 +#define X509V3_R_OPERATION_NOT_DEFINED 148 +#define X509V3_R_OTHERNAME_ERROR 147 +#define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 155 +#define X509V3_R_POLICY_PATH_LENGTH 156 +#define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 157 +#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158 +#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 +#define X509V3_R_SECTION_NOT_FOUND 150 +#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 +#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 +#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 +#define X509V3_R_UNKNOWN_EXTENSION 129 +#define X509V3_R_UNKNOWN_EXTENSION_NAME 130 +#define X509V3_R_UNKNOWN_OPTION 120 +#define X509V3_R_UNSUPPORTED_OPTION 117 +#define X509V3_R_USER_TOO_LONG 132 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/externals/sockets/Base64.cpp b/externals/sockets/Base64.cpp new file mode 100644 index 0000000..f7f12f5 --- /dev/null +++ b/externals/sockets/Base64.cpp @@ -0,0 +1,262 @@ +/** \file Base64.cpp + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Base64.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +const char *Base64::bstr = + "ABCDEFGHIJKLMNOPQ" + "RSTUVWXYZabcdefgh" + "ijklmnopqrstuvwxy" + "z0123456789+/"; + +const char Base64::rstr[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, + 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0}; + +Base64::Base64() +{ +} + +void Base64::encode(FILE *fil, std::string& output, bool add_crlf) +{ + size_t remain; + size_t i = 0; + size_t o = 0; + char input[4]; + + output = ""; + remain = fread(input,1,3,fil); + while (remain > 0) + { + if (add_crlf && o && o % 76 == 0) + output += "\n"; + switch (remain) + { + case 1: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) ]; + output += "=="; + break; + case 2: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; + output += "="; + break; + default: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; + output += bstr[ (input[i + 2] & 0x3f) ]; + } + o += 4; + // + remain = fread(input,1,3,fil); + } +} + +void Base64::encode(const std::string& str_in, std::string& str_out, bool add_crlf) +{ + encode(str_in.c_str(), str_in.size(), str_out, add_crlf); +} + +void Base64::encode(const char* input,size_t l,std::string& output, bool add_crlf) +{ + size_t i = 0; + size_t o = 0; + + output = ""; + while (i < l) + { + size_t remain = l - i; + if (add_crlf && o && o % 76 == 0) + output += "\n"; + switch (remain) + { + case 1: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) ]; + output += "=="; + break; + case 2: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; + output += "="; + break; + default: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; + output += bstr[ (input[i + 2] & 0x3f) ]; + } + o += 4; + i += 3; + } +} + +void Base64::encode(const unsigned char* input,size_t l,std::string& output,bool add_crlf) +{ + size_t i = 0; + size_t o = 0; + + output = ""; + while (i < l) + { + size_t remain = l - i; + if (add_crlf && o && o % 76 == 0) + output += "\n"; + switch (remain) + { + case 1: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) ]; + output += "=="; + break; + case 2: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) ]; + output += "="; + break; + default: + output += bstr[ ((input[i] >> 2) & 0x3f) ]; + output += bstr[ ((input[i] << 4) & 0x30) + ((input[i + 1] >> 4) & 0x0f) ]; + output += bstr[ ((input[i + 1] << 2) & 0x3c) + ((input[i + 2] >> 6) & 0x03) ]; + output += bstr[ (input[i + 2] & 0x3f) ]; + } + o += 4; + i += 3; + } +} + +void Base64::decode(const std::string& input,std::string& output) +{ + size_t i = 0; + size_t l = input.size(); + + output = ""; + while (i < l) + { + while (i < l && (input[i] == 13 || input[i] == 10)) + i++; + if (i < l) + { + char b1 = (char)((rstr[(int)input[i]] << 2 & 0xfc) + + (rstr[(int)input[i + 1]] >> 4 & 0x03)); + output += b1; + if (input[i + 2] != '=') + { + char b2 = (char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + + (rstr[(int)input[i + 2]] >> 2 & 0x0f)); + output += b2; + } + if (input[i + 3] != '=') + { + char b3 = (char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + + rstr[(int)input[i + 3]]); + output += b3; + } + i += 4; + } + } +} + +void Base64::decode(const std::string& input, unsigned char *output, size_t& sz) +{ + size_t i = 0; + size_t l = input.size(); + size_t j = 0; + + while (i < l) + { + while (i < l && (input[i] == 13 || input[i] == 10)) + i++; + if (i < l) + { + unsigned char b1 = (unsigned char)((rstr[(int)input[i]] << 2 & 0xfc) + + (rstr[(int)input[i + 1]] >> 4 & 0x03)); + if (output) + { + output[j] = b1; + } + j++; + if (input[i + 2] != '=') + { + unsigned char b2 = (unsigned char)((rstr[(int)input[i + 1]] << 4 & 0xf0) + + (rstr[(int)input[i + 2]] >> 2 & 0x0f)); + if (output) + { + output[j] = b2; + } + j++; + } + if (input[i + 3] != '=') + { + unsigned char b3 = (unsigned char)((rstr[(int)input[i + 2]] << 6 & 0xc0) + + rstr[(int)input[i + 3]]); + if (output) + { + output[j] = b3; + } + j++; + } + i += 4; + } + } + sz = j; +} + +size_t Base64::decode_length(const std::string& str64) +{ + if (str64.empty() || str64.size() % 4) + return 0; + size_t l = 3 * (str64.size() / 4 - 1) + 1; + if (str64[str64.size() - 2] != '=') + l++; + if (str64[str64.size() - 1] != '=') + l++; + return l; +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/CMakeLists.txt b/externals/sockets/CMakeLists.txt new file mode 100644 index 0000000..a175677 --- /dev/null +++ b/externals/sockets/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +file(GLOB sources *.cpp) + +set(trinitysockets_STAT_SRCS + ${sources} +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +add_library(trinitysockets STATIC ${trinitysockets_STAT_SRCS}) diff --git a/externals/sockets/Exception.cpp b/externals/sockets/Exception.cpp new file mode 100644 index 0000000..4d79aee --- /dev/null +++ b/externals/sockets/Exception.cpp @@ -0,0 +1,45 @@ +/** + ** \file Exception.cpp + ** \date 2007-09-28 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifdef _MSC_VER +#pragma warning(disable:4786) +#endif +#include "Exception.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +Exception::Exception(const std::string& description) : m_description(description) +{ +} + +const std::string Exception::ToString() const +{ + return m_description; +} + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif + + diff --git a/externals/sockets/Ipv4Address.cpp b/externals/sockets/Ipv4Address.cpp new file mode 100644 index 0000000..0393503 --- /dev/null +++ b/externals/sockets/Ipv4Address.cpp @@ -0,0 +1,192 @@ +/** + ** \file Ipv4Address.cpp + ** \date 2006-09-21 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Ipv4Address.h" +#include "Utility.h" +#include "Parse.h" +#ifndef _WIN32 +#include +#endif + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +Ipv4Address::Ipv4Address(port_t port) : m_valid(true) +{ + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); +} + +Ipv4Address::Ipv4Address(ipaddr_t a,port_t port) : m_valid(true) +{ + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); + memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); +} + +Ipv4Address::Ipv4Address(struct in_addr& a,port_t port) : m_valid(true) +{ + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); + m_addr.sin_addr = a; +} + +Ipv4Address::Ipv4Address(const std::string& host,port_t port) : m_valid(false) +{ + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin_family = AF_INET; + m_addr.sin_port = htons( port ); + { + ipaddr_t a; + if (Utility::u2ip(host, a)) + { + memcpy(&m_addr.sin_addr, &a, sizeof(struct in_addr)); + m_valid = true; + } + } +} + +Ipv4Address::Ipv4Address(struct sockaddr_in& sa) +{ + m_addr = sa; + m_valid = sa.sin_family == AF_INET; +} + +Ipv4Address::~Ipv4Address() +{ +} + +Ipv4Address::operator struct sockaddr *() +{ + return (struct sockaddr *)&m_addr; +} + +Ipv4Address::operator socklen_t() +{ + return sizeof(struct sockaddr_in); +} + +void Ipv4Address::SetPort(port_t port) +{ + m_addr.sin_port = htons( port ); +} + +port_t Ipv4Address::GetPort() +{ + return ntohs( m_addr.sin_port ); +} + +bool Ipv4Address::Resolve(const std::string& hostname,struct in_addr& a) +{ + struct sockaddr_in sa; + memset(&a, 0, sizeof(a)); + if (Utility::isipv4(hostname)) + { + if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) + return false; + a = sa.sin_addr; + return true; + } + if (!Utility::u2ip(hostname, sa)) + return false; + a = sa.sin_addr; + return true; +} + +bool Ipv4Address::Reverse(struct in_addr& a,std::string& name) +{ + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr = a; + return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); +} + +std::string Ipv4Address::Convert(bool include_port) +{ + if (include_port) + return Convert(m_addr.sin_addr) + ":" + Utility::l2string(GetPort()); + return Convert(m_addr.sin_addr); +} + +std::string Ipv4Address::Convert(struct in_addr& a) +{ + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr = a; + std::string name; + Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); + return name; +} + +void Ipv4Address::SetAddress(struct sockaddr *sa) +{ + memcpy(&m_addr, sa, sizeof(struct sockaddr_in)); +} + +int Ipv4Address::GetFamily() +{ + return m_addr.sin_family; +} + +bool Ipv4Address::IsValid() +{ + return m_valid; +} + +bool Ipv4Address::operator==(SocketAddress& a) +{ + if (a.GetFamily() != GetFamily()) + return false; + if ((socklen_t)a != sizeof(m_addr)) + return false; + struct sockaddr *sa = a; + struct sockaddr_in *p = (struct sockaddr_in *)sa; + if (p -> sin_port != m_addr.sin_port) + return false; + if (memcmp(&p -> sin_addr, &m_addr.sin_addr, 4)) + return false; + return true; +} + +std::auto_ptr Ipv4Address::GetCopy() +{ + return std::auto_ptr(new Ipv4Address(m_addr)); +} + +std::string Ipv4Address::Reverse() +{ + std::string tmp; + Reverse(m_addr.sin_addr, tmp); + return tmp; +} + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif + + diff --git a/externals/sockets/Ipv6Address.cpp b/externals/sockets/Ipv6Address.cpp new file mode 100644 index 0000000..3208b50 --- /dev/null +++ b/externals/sockets/Ipv6Address.cpp @@ -0,0 +1,247 @@ +/** + ** \file Ipv6Address.cpp + ** \date 2006-09-21 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Ipv6Address.h" +#ifdef ENABLE_IPV6 + +#include "Utility.h" +#include "Parse.h" +#ifndef _WIN32 +#include +#endif +#ifdef IPPROTO_IPV6 + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +Ipv6Address::Ipv6Address(port_t port) : m_valid(true) +{ + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin6_family = AF_INET6; + m_addr.sin6_port = htons( port ); +} + +Ipv6Address::Ipv6Address(struct in6_addr& a,port_t port) : m_valid(true) +{ + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin6_family = AF_INET6; + m_addr.sin6_port = htons( port ); + m_addr.sin6_addr = a; +} + +Ipv6Address::Ipv6Address(const std::string& host,port_t port) : m_valid(false) +{ + memset(&m_addr, 0, sizeof(m_addr)); + m_addr.sin6_family = AF_INET6; + m_addr.sin6_port = htons( port ); + { + struct in6_addr a; + if (Utility::u2ip(host, a)) + { + m_addr.sin6_addr = a; + m_valid = true; + } + } +} + +Ipv6Address::Ipv6Address(struct sockaddr_in6& sa) +{ + m_addr = sa; + m_valid = sa.sin6_family == AF_INET6; +} + +Ipv6Address::~Ipv6Address() +{ +} + +Ipv6Address::operator struct sockaddr *() +{ + return (struct sockaddr *)&m_addr; +} + +Ipv6Address::operator socklen_t() +{ + return sizeof(struct sockaddr_in6); +} + +void Ipv6Address::SetPort(port_t port) +{ + m_addr.sin6_port = htons( port ); +} + +port_t Ipv6Address::GetPort() +{ + return ntohs( m_addr.sin6_port ); +} + +bool Ipv6Address::Resolve(const std::string& hostname,struct in6_addr& a) +{ + struct sockaddr_in6 sa; + memset(&a, 0, sizeof(a)); + if (Utility::isipv6(hostname)) + { + if (!Utility::u2ip(hostname, sa, AI_NUMERICHOST)) + return false; + a = sa.sin6_addr; + return true; + } + if (!Utility::u2ip(hostname, sa)) + return false; + a = sa.sin6_addr; + return true; +} + +bool Ipv6Address::Reverse(struct in6_addr& a,std::string& name) +{ + struct sockaddr_in6 sa; + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; + sa.sin6_addr = a; + return Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name); +} + +std::string Ipv6Address::Convert(bool include_port) +{ + if (include_port) + return Convert(m_addr.sin6_addr) + ":" + Utility::l2string(GetPort()); + return Convert(m_addr.sin6_addr); +} + +std::string Ipv6Address::Convert(struct in6_addr& a,bool mixed) +{ + char slask[100]; // l2ip temporary + *slask = 0; + unsigned int prev = 0; + bool skipped = false; + bool ok_to_skip = true; + if (mixed) + { + unsigned short x; + unsigned short addr16[8]; + memcpy(addr16, &a, sizeof(addr16)); + for (size_t i = 0; i < 6; i++) + { + x = ntohs(addr16[i]); + if (*slask && (x || !ok_to_skip || prev)) + strcat(slask,":"); + if (x || !ok_to_skip) + { + sprintf(slask + strlen(slask),"%x", x); + if (x && skipped) + ok_to_skip = false; + } + else + { + skipped = true; + } + prev = x; + } + x = ntohs(addr16[6]); + sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); + x = ntohs(addr16[7]); + sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); + } + else + { + struct sockaddr_in6 sa; + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; + sa.sin6_addr = a; + std::string name; + Utility::reverse((struct sockaddr *)&sa, sizeof(sa), name, NI_NUMERICHOST); + return name; + } + return slask; +} + +void Ipv6Address::SetAddress(struct sockaddr *sa) +{ + memcpy(&m_addr, sa, sizeof(struct sockaddr_in6)); +} + +int Ipv6Address::GetFamily() +{ + return m_addr.sin6_family; +} + +void Ipv6Address::SetFlowinfo(uint32_t x) +{ + m_addr.sin6_flowinfo = x; +} + +uint32_t Ipv6Address::GetFlowinfo() +{ + return m_addr.sin6_flowinfo; +} + +#ifndef _WIN32 +void Ipv6Address::SetScopeId(uint32_t x) +{ + m_addr.sin6_scope_id = x; +} + +uint32_t Ipv6Address::GetScopeId() +{ + return m_addr.sin6_scope_id; +} +#endif + +bool Ipv6Address::IsValid() +{ + return m_valid; +} + +bool Ipv6Address::operator==(SocketAddress& a) +{ + if (a.GetFamily() != GetFamily()) + return false; + if ((socklen_t)a != sizeof(m_addr)) + return false; + struct sockaddr *sa = a; + struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; + if (p -> sin6_port != m_addr.sin6_port) + return false; + if (memcmp(&p -> sin6_addr, &m_addr.sin6_addr, sizeof(struct in6_addr))) + return false; + return true; +} + +std::auto_ptr Ipv6Address::GetCopy() +{ + return std::auto_ptr(new Ipv6Address(m_addr)); +} + +std::string Ipv6Address::Reverse() +{ + std::string tmp; + Reverse(m_addr.sin6_addr, tmp); + return tmp; +} + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif +#endif // IPPROTO_IPV6 +#endif // ENABLE_IPV6 + + diff --git a/externals/sockets/Lock.cpp b/externals/sockets/Lock.cpp new file mode 100644 index 0000000..b75664c --- /dev/null +++ b/externals/sockets/Lock.cpp @@ -0,0 +1,52 @@ +/** \file Lock.cpp + ** \date 2005-08-22 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2005,2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Mutex.h" +#include "Lock.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +Lock::Lock(Mutex& m) : m_mutex(m) +{ + m_mutex.Lock(); +} + +Lock::~Lock() +{ + m_mutex.Unlock(); +} + + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/Makefile b/externals/sockets/Makefile new file mode 100644 index 0000000..80faf67 --- /dev/null +++ b/externals/sockets/Makefile @@ -0,0 +1,136 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.6 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canoncical targets will work. +.SUFFIXES: + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/trinity/dev/trinitycore/externals/sockets + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/trinity/dev/trinitycore/externals/sockets + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/trinity/dev/trinitycore/externals/sockets/CMakeFiles /home/trinity/dev/trinitycore/externals/sockets/CMakeFiles/progress.make + $(MAKE) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/trinity/dev/trinitycore/externals/sockets/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named trinitysockets + +# Build rule for target. +trinitysockets: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 trinitysockets +.PHONY : trinitysockets + +# fast build rule for target. +trinitysockets/fast: + $(MAKE) -f CMakeFiles/trinitysockets.dir/build.make CMakeFiles/trinitysockets.dir/build +.PHONY : trinitysockets/fast + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... rebuild_cache" + @echo "... trinitysockets" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/externals/sockets/Mutex.cpp b/externals/sockets/Mutex.cpp new file mode 100644 index 0000000..681e85c --- /dev/null +++ b/externals/sockets/Mutex.cpp @@ -0,0 +1,77 @@ +/** \file Mutex.cpp + ** \date 2004-10-30 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Mutex.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +Mutex::Mutex() +{ +#ifdef _WIN32 + m_mutex = ::CreateMutex(NULL, FALSE, NULL); +#else + pthread_mutex_init(&m_mutex, NULL); +#endif +} + +Mutex::~Mutex() +{ +#ifdef _WIN32 + ::CloseHandle(m_mutex); +#else + pthread_mutex_destroy(&m_mutex); +#endif +} + +void Mutex::Lock() +{ +#ifdef _WIN32 + /*DWORD d =*/ WaitForSingleObject(m_mutex, INFINITE); + /// \todo check 'd' for result +#else + pthread_mutex_lock(&m_mutex); +#endif +} + +void Mutex::Unlock() +{ +#ifdef _WIN32 + ::ReleaseMutex(m_mutex); +#else + pthread_mutex_unlock(&m_mutex); +#endif +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/Parse.cpp b/externals/sockets/Parse.cpp new file mode 100644 index 0000000..2967859 --- /dev/null +++ b/externals/sockets/Parse.cpp @@ -0,0 +1,318 @@ +/** \file Parse.cpp - parse a string + ** + ** Written: 1999-Feb-10 grymse@alhem.net + **/ + +/* +Copyright (C) 1999-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include +#include + +#include "Parse.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/* implementation of class Parse */ + +Parse::Parse() +:pa_the_str("") +,pa_splits("") +,pa_ord("") +,pa_the_ptr(0) +,pa_breakchar(0) +,pa_enable(0) +,pa_disable(0) +,pa_nospace(0) +,pa_quote(false) +{ +} + +Parse::Parse(const std::string&s) +:pa_the_str(s) +,pa_splits("") +,pa_ord("") +,pa_the_ptr(0) +,pa_breakchar(0) +,pa_enable(0) +,pa_disable(0) +,pa_nospace(0) +,pa_quote(false) +{ +} + +Parse::Parse(const std::string&s,const std::string&sp) +:pa_the_str(s) +,pa_splits(sp) +,pa_ord("") +,pa_the_ptr(0) +,pa_breakchar(0) +,pa_enable(0) +,pa_disable(0) +,pa_nospace(0) +,pa_quote(false) +{ +} + +Parse::Parse(const std::string&s,const std::string&sp,short /*nospace*/) +:pa_the_str(s) +,pa_splits(sp) +,pa_ord("") +,pa_the_ptr(0) +,pa_breakchar(0) +,pa_enable(0) +,pa_disable(0) +,pa_nospace(1) +,pa_quote(false) +{ +} + +Parse::~Parse() +{ +} + +#define C ((pa_the_ptr l(h); + + if (l.Bind("127.0.0.1", m_port)) + { + return; + } + h.Add(&l); + + m_ready = true; + while (!m_quit && IsRunning() ) + { + h.Select(0, 500000); + } + SetRunning(false); +} + +void ResolvServer::Quit() +{ + m_quit = true; +} + +bool ResolvServer::Ready() +{ + return m_ready; +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // ENABLE_RESOLVER + + diff --git a/externals/sockets/ResolvSocket.cpp b/externals/sockets/ResolvSocket.cpp new file mode 100644 index 0000000..636de27 --- /dev/null +++ b/externals/sockets/ResolvSocket.cpp @@ -0,0 +1,426 @@ +/** \file ResolvSocket.cpp + ** \date 2005-03-24 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifdef _WIN32 +#ifdef _MSC_VER +#pragma warning(disable:4786) +#pragma warning(disable:4503) +#endif +#else +#include +#endif +#include "ResolvSocket.h" +#ifdef ENABLE_RESOLVER +#include "Utility.h" +#include "Parse.h" +#include "ISocketHandler.h" +#include "Lock.h" +#include "Mutex.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +//#ifdef _DEBUG +//#define DEB(x) x +//#else +#define DEB(x) +//#endif + +// static +ResolvSocket::cache_t ResolvSocket::m_cache; +ResolvSocket::timeout_t ResolvSocket::m_cache_to; +Mutex ResolvSocket::m_cache_mutex; + +ResolvSocket::ResolvSocket(ISocketHandler& h) +:TcpSocket(h) +,m_bServer(false) +,m_parent(NULL) +#ifdef ENABLE_IPV6 +,m_resolve_ipv6(false) +#endif +,m_cached(false) +{ + SetLineProtocol(); +} + +ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, const std::string& host, port_t port, bool ipv6) +:TcpSocket(h) +,m_bServer(false) +,m_parent(parent) +,m_resolv_host(host) +,m_resolv_port(port) +#ifdef ENABLE_IPV6 +,m_resolve_ipv6(ipv6) +#endif +,m_cached(false) +{ + SetLineProtocol(); +} + +ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, ipaddr_t a) +:TcpSocket(h) +,m_bServer(false) +,m_parent(parent) +,m_resolv_port(0) +,m_resolv_address(a) +#ifdef ENABLE_IPV6 +,m_resolve_ipv6(false) +#endif +,m_cached(false) +{ + SetLineProtocol(); +} + +#ifdef ENABLE_IPV6 +ResolvSocket::ResolvSocket(ISocketHandler& h, Socket *parent, in6_addr& a) +:TcpSocket(h) +,m_bServer(false) +,m_parent(parent) +,m_resolv_port(0) +,m_resolve_ipv6(true) +,m_resolv_address6(a) +,m_cached(false) +{ + SetLineProtocol(); +} +#endif + +ResolvSocket::~ResolvSocket() +{ +} + +void ResolvSocket::OnLine(const std::string& line) +{ + Parse pa(line, ":"); + if (m_bServer) + { + m_query = pa.getword(); + m_data = pa.getrest(); +DEB( fprintf(stderr, " *** ResolvSocket server; query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) + // %! check cache + { + Lock lock(m_cache_mutex); + if (m_cache[m_query].find(m_data) != m_cache[m_query].end()) + { + if (time(NULL) - m_cache_to[m_query][m_data] < 3600) // ttl + { + std::string result = m_cache[m_query][m_data]; +DEB(fprintf(stderr, " *** Returning cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), result.c_str());) + Send("Cached\n"); + if (!result.size()) /* failed */ + { + Send("Failed\n\n"); + SetCloseAndDelete(); + return; + } + else + if (m_query == "gethostbyname") + { + Send("A: " + result + "\n\n"); + SetCloseAndDelete(); + return; + } + else +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (m_query == "gethostbyname2") + { + Send("AAAA: " + result + "\n\n"); + SetCloseAndDelete(); + return; + } + else +#endif +#endif + if (m_query == "gethostbyaddr") + { + Send("Name: " + result + "\n\n"); + SetCloseAndDelete(); + return; + } + } + } + } + if (!Detach()) // detach failed? + { + SetCloseAndDelete(); + } + return; + } + std::string key = pa.getword(); + std::string value = pa.getrest(); +DEB( fprintf(stderr, " *** ResolvSocket response; %s: %s\n", key.c_str(), value.c_str());) + + if (key == "Cached") + { + m_cached = true; + } + else + if (key == "Failed" && m_parent) + { +DEB( fprintf(stderr, " ************ Resolve failed\n");) + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + m_parent -> OnResolveFailed(m_resolv_id); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); +DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } + else + if (key == "Name" && !m_resolv_host.size() && m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + m_parent -> OnReverseResolved(m_resolv_id, value); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); +DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } + else + if (key == "A" && m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + ipaddr_t l; + Utility::u2ip(value, l); // ip2ipaddr_t + m_parent -> OnResolved(m_resolv_id, l, m_resolv_port); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); +DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; // always use first ip in case there are several + } +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + else + if (key == "AAAA" && m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + in6_addr a; + Utility::u2ip(value, a); + m_parent -> OnResolved(m_resolv_id, a, m_resolv_port); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); +DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } +#endif +#endif +} + +void ResolvSocket::OnDetached() +{ +DEB( fprintf(stderr, " *** ResolvSocket::OnDetached(); query=%s, data=%s\n", m_query.c_str(), m_data.c_str());) + if (m_query == "gethostbyname") + { + struct sockaddr_in sa; + if (Utility::u2ip(m_data, sa)) + { + std::string ip; + Utility::l2ip(sa.sin_addr, ip); + Send("A: " + ip + "\n"); + } + else + { + Send("Failed\n"); + } + Send("\n"); + } + else +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (m_query == "gethostbyname2") + { + struct sockaddr_in6 sa; + if (Utility::u2ip(m_data, sa)) + { + std::string ip; + Utility::l2ip(sa.sin6_addr, ip); + Send("AAAA: " + ip + "\n"); + } + else + { + Send("Failed\n"); + } + Send("\n"); + } + else +#endif +#endif + if (m_query == "gethostbyaddr") + { + if (Utility::isipv4( m_data )) + { + struct sockaddr_in sa; + if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) + { + Send("Failed: convert to sockaddr_in failed\n"); + } + else + { + std::string name; + if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) + { + Send("Failed: ipv4 reverse lookup of " + m_data + "\n"); + } + else + { + Send("Name: " + name + "\n"); + } + } + } + else +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (Utility::isipv6( m_data )) + { + struct sockaddr_in6 sa; + if (!Utility::u2ip(m_data, sa, AI_NUMERICHOST)) + { + Send("Failed: convert to sockaddr_in6 failed\n"); + } + else + { + std::string name; + if (!Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), name)) + { + Send("Failed: ipv6 reverse lookup of " + m_data + "\n"); + } + else + { + Send("Name: " + name + "\n"); + } + } + } + else +#endif +#endif + { + Send("Failed: malformed address\n"); + } + Send("\n"); + } + else + { + std::string msg = "Unknown query type: " + m_query; + Handler().LogError(this, "OnDetached", 0, msg); + Send("Unknown\n\n"); + } + SetCloseAndDelete(); +} + +void ResolvSocket::OnConnect() +{ + if (!m_resolv_host.empty()) + { +#ifdef ENABLE_IPV6 + std::string msg = (m_resolve_ipv6 ? "gethostbyname2 " : "gethostbyname ") + m_resolv_host + "\n"; + m_query = m_resolve_ipv6 ? "gethostbyname2" : "gethostbyname"; +#else + std::string msg = "gethostbyname " + m_resolv_host + "\n"; + m_query = "gethostbyname"; +#endif + m_data = m_resolv_host; + Send( msg ); + return; + } +#ifdef ENABLE_IPV6 + if (m_resolve_ipv6) + { + std::string tmp; + Utility::l2ip(m_resolv_address6, tmp); + m_query = "gethostbyaddr"; + m_data = tmp; + std::string msg = "gethostbyaddr " + tmp + "\n"; + Send( msg ); + } +#endif + std::string tmp; + Utility::l2ip(m_resolv_address, tmp); + m_query = "gethostbyaddr"; + m_data = tmp; + std::string msg = "gethostbyaddr " + tmp + "\n"; + Send( msg ); +} + +void ResolvSocket::OnDelete() +{ + if (m_parent) + { + if (Handler().Resolving(m_parent) || Handler().Valid(m_parent)) + { + m_parent -> OnResolveFailed(m_resolv_id); + } + // update cache + if (!m_cached) + { + Lock lock(m_cache_mutex); + std::string value; +DEB(fprintf(stderr, " *** Update cache for [%s][%s] = '%s'\n", m_query.c_str(), m_data.c_str(), value.c_str());) + m_cache[m_query][m_data] = value; + m_cache_to[m_query][m_data] = time(NULL); + } + m_parent = NULL; + } +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // ENABLE_RESOLVER + + diff --git a/externals/sockets/Socket.cpp b/externals/sockets/Socket.cpp new file mode 100644 index 0000000..f53cd27 --- /dev/null +++ b/externals/sockets/Socket.cpp @@ -0,0 +1,1726 @@ +/** \file Socket.cpp + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Socket.h" +#ifdef _WIN32 +#ifdef _MSC_VER +#pragma warning(disable:4786) +#endif +#include +#else +#include +#include +#endif +#include +#include + +#include "ISocketHandler.h" +#include "Utility.h" + +#include "SocketAddress.h" +#include "SocketHandler.h" +#ifdef ENABLE_EXCEPTIONS +#include "Exception.h" +#endif +#include "Ipv4Address.h" + +//#ifdef _DEBUG +//#define DEB(x) x; fflush(stderr); +//#else +#define DEB(x) +//#endif + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +// statics +#ifdef _WIN32 +WSAInitializer Socket::m_winsock_init; +#endif + +Socket::Socket(ISocketHandler& h) +//:m_flags(0) +:m_handler(h) +,m_socket( INVALID_SOCKET ) +,m_bDel(false) +,m_bClose(false) +,m_tCreate(time(NULL)) +,m_parent(NULL) +,m_b_disable_read(false) +,m_connected(false) +,m_b_erased_by_handler(false) +,m_tClose(0) +,m_client_remote_address(NULL) +,m_remote_address(NULL) +,m_traffic_monitor(NULL) +,m_bLost(false) +#ifdef HAVE_OPENSSL +,m_b_enable_ssl(false) +,m_b_ssl(false) +,m_b_ssl_server(false) +#endif +#ifdef ENABLE_IPV6 +,m_ipv6(false) +#endif +#ifdef ENABLE_POOL +,m_socket_type(0) +,m_bClient(false) +,m_bRetain(false) +#endif +#ifdef ENABLE_SOCKS4 +,m_bSocks4(false) +,m_socks4_host(h.GetSocks4Host()) +,m_socks4_port(h.GetSocks4Port()) +,m_socks4_userid(h.GetSocks4Userid()) +#endif +#ifdef ENABLE_DETACH +,m_detach(false) +,m_detached(false) +,m_pThread(NULL) +,m_slave_handler(NULL) +#endif +{ +} + +Socket::~Socket() +{ + Handler().Remove(this); + if (m_socket != INVALID_SOCKET +#ifdef ENABLE_POOL + && !m_bRetain +#endif + ) + { + Close(); + } +} + +void Socket::Init() +{ +} + +void Socket::OnRead() +{ +} + +void Socket::OnWrite() +{ +} + +void Socket::OnException() +{ + // %! exception doesn't always mean something bad happened, this code should be reworked + // errno valid here? + int err = SoError(); + Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); + SetCloseAndDelete(); +} + +void Socket::OnDelete() +{ +} + +void Socket::OnConnect() +{ +} + +void Socket::OnAccept() +{ +} + +int Socket::Close() +{ + if (m_socket == INVALID_SOCKET) // this could happen + { + Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); + return 0; + } + int n; + if ((n = closesocket(m_socket)) == -1) + { + // failed... + Handler().LogError(this, "close", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + Handler().Set(m_socket, false, false, false); // remove from fd_set's + Handler().AddList(m_socket, LIST_CALLONCONNECT, false); +#ifdef ENABLE_DETACH + Handler().AddList(m_socket, LIST_DETACH, false); +#endif + Handler().AddList(m_socket, LIST_TIMEOUT, false); + Handler().AddList(m_socket, LIST_RETRY, false); + Handler().AddList(m_socket, LIST_CLOSE, false); + m_socket = INVALID_SOCKET; + return n; +} + +SOCKET Socket::CreateSocket(int af,int type, const std::string& protocol) +{ + struct protoent *p = NULL; + SOCKET s; + +#ifdef ENABLE_POOL + m_socket_type = type; + m_socket_protocol = protocol; +#endif + if (!protocol.empty()) + { + p = getprotobyname( protocol.c_str() ); + if (!p) + { + Handler().LogError(this, "getprotobyname", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); +#ifdef ENABLE_EXCEPTIONS + throw Exception(std::string("getprotobyname() failed: ") + StrError(Errno)); +#endif + return INVALID_SOCKET; + } + } + int protno = p ? p -> p_proto : 0; + + s = socket(af, type, protno); + if (s == INVALID_SOCKET) + { + Handler().LogError(this, "socket", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); +#ifdef ENABLE_EXCEPTIONS + throw Exception(std::string("socket() failed: ") + StrError(Errno)); +#endif + return INVALID_SOCKET; + } + Attach(s); + OnOptions(af, type, protno, s); + Attach(INVALID_SOCKET); + return s; +} + +void Socket::Attach(SOCKET s) +{ + m_socket = s; +} + +SOCKET Socket::GetSocket() +{ + return m_socket; +} + +void Socket::SetDeleteByHandler(bool x) +{ + m_bDel = x; +} + +bool Socket::DeleteByHandler() +{ + return m_bDel; +} + +void Socket::SetCloseAndDelete(bool x) +{ + if (x != m_bClose) + { + Handler().AddList(m_socket, LIST_CLOSE, x); + m_bClose = x; + if (x) + { + m_tClose = time(NULL); + } + } +} + +bool Socket::CloseAndDelete() +{ + return m_bClose; +} + +void Socket::SetRemoteAddress(SocketAddress& ad) //struct sockaddr* sa, socklen_t l) +{ + m_remote_address = ad.GetCopy(); +} + +std::auto_ptr Socket::GetRemoteSocketAddress() +{ + return m_remote_address -> GetCopy(); +} + +ISocketHandler& Socket::Handler() const +{ +#ifdef ENABLE_DETACH + if (IsDetached()) + return *m_slave_handler; +#endif + return m_handler; +} + +ISocketHandler& Socket::MasterHandler() const +{ + return m_handler; +} + +ipaddr_t Socket::GetRemoteIP4() +{ + ipaddr_t l = 0; +#ifdef ENABLE_IPV6 + if (m_ipv6) + { + Handler().LogError(this, "GetRemoteIP4", 0, "get ipv4 address for ipv6 socket", LOG_LEVEL_WARNING); + } +#endif + if (m_remote_address.get() != NULL) + { + struct sockaddr *p = *m_remote_address; + struct sockaddr_in *sa = (struct sockaddr_in *)p; + memcpy(&l, &sa -> sin_addr, sizeof(struct in_addr)); + } + return l; +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +struct in6_addr Socket::GetRemoteIP6() +{ + if (!m_ipv6) + { + Handler().LogError(this, "GetRemoteIP6", 0, "get ipv6 address for ipv4 socket", LOG_LEVEL_WARNING); + } + struct sockaddr_in6 fail; + if (m_remote_address.get() != NULL) + { + struct sockaddr *p = *m_remote_address; + memcpy(&fail, p, sizeof(struct sockaddr_in6)); + } + else + { + memset(&fail, 0, sizeof(struct sockaddr_in6)); + } + return fail.sin6_addr; +} +#endif +#endif + +port_t Socket::GetRemotePort() +{ + if (!m_remote_address.get()) + { + return 0; + } + return m_remote_address -> GetPort(); +} + +std::string Socket::GetRemoteAddress() +{ + if (!m_remote_address.get()) + { + return ""; + } + return m_remote_address -> Convert(false); +} + +std::string Socket::GetRemoteHostname() +{ + if (!m_remote_address.get()) + { + return ""; + } + return m_remote_address -> Reverse(); +} + +bool Socket::SetNonblocking(bool bNb) +{ +#ifdef _WIN32 + unsigned long l = bNb ? 1 : 0; + int n = ioctlsocket(m_socket, FIONBIO, &l); + if (n != 0) + { + Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); + return false; + } + return true; +#else + if (bNb) + { + if (fcntl(m_socket, F_SETFL, O_NONBLOCK) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + else + { + if (fcntl(m_socket, F_SETFL, 0) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + return true; +#endif +} + +bool Socket::SetNonblocking(bool bNb, SOCKET s) +{ +#ifdef _WIN32 + unsigned long l = bNb ? 1 : 0; + int n = ioctlsocket(s, FIONBIO, &l); + if (n != 0) + { + Handler().LogError(this, "ioctlsocket(FIONBIO)", Errno, ""); + return false; + } + return true; +#else + if (bNb) + { + if (fcntl(s, F_SETFL, O_NONBLOCK) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, O_NONBLOCK)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + else + { + if (fcntl(s, F_SETFL, 0) == -1) + { + Handler().LogError(this, "fcntl(F_SETFL, 0)", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return false; + } + } + return true; +#endif +} + +void Socket::Set(bool bRead, bool bWrite, bool bException) +{ + Handler().Set(m_socket, bRead, bWrite, bException); +} + +bool Socket::Ready() +{ + if (m_socket != INVALID_SOCKET && !CloseAndDelete()) + return true; + return false; +} + +void Socket::OnLine(const std::string& ) +{ +} + +void Socket::OnConnectFailed() +{ +} + +Socket *Socket::GetParent() +{ + return m_parent; +} + +void Socket::SetParent(Socket *x) +{ + m_parent = x; +} + +port_t Socket::GetPort() +{ + Handler().LogError(this, "GetPort", 0, "GetPort only implemented for ListenSocket", LOG_LEVEL_WARNING); + return 0; +} + +bool Socket::OnConnectRetry() +{ + return true; +} + +#ifdef ENABLE_RECONNECT +void Socket::OnReconnect() +{ +} +#endif + +time_t Socket::Uptime() +{ + return time(NULL) - m_tCreate; +} + +#ifdef ENABLE_IPV6 +void Socket::SetIpv6(bool x) +{ + m_ipv6 = x; +} + +bool Socket::IsIpv6() +{ + return m_ipv6; +} +#endif + +void Socket::DisableRead(bool x) +{ + m_b_disable_read = x; +} + +bool Socket::IsDisableRead() +{ + return m_b_disable_read; +} + +void Socket::SendBuf(const char *,size_t,int) +{ +} + +void Socket::Send(const std::string&,int) +{ +} + +void Socket::SetConnected(bool x) +{ + m_connected = x; +} + +bool Socket::IsConnected() +{ + return m_connected; +} + +void Socket::OnDisconnect() +{ +} + +void Socket::SetLost() +{ + m_bLost = true; +} + +bool Socket::Lost() +{ + return m_bLost; +} + +void Socket::SetErasedByHandler(bool x) +{ + m_b_erased_by_handler = x; +} + +bool Socket::ErasedByHandler() +{ + return m_b_erased_by_handler; +} + +time_t Socket::TimeSinceClose() +{ + return time(NULL) - m_tClose; +} + +void Socket::SetClientRemoteAddress(SocketAddress& ad) +{ + if (!ad.IsValid()) + { + Handler().LogError(this, "SetClientRemoteAddress", 0, "remote address not valid", LOG_LEVEL_ERROR); + } + m_client_remote_address = ad.GetCopy(); +} + +std::auto_ptr Socket::GetClientRemoteAddress() +{ + if (!m_client_remote_address.get()) + { + Handler().LogError(this, "GetClientRemoteAddress", 0, "remote address not yet set", LOG_LEVEL_ERROR); + } + return m_client_remote_address -> GetCopy(); +} + +uint64_t Socket::GetBytesSent(bool) +{ + return 0; +} + +uint64_t Socket::GetBytesReceived(bool) +{ + return 0; +} + +#ifdef HAVE_OPENSSL +void Socket::OnSSLConnect() +{ +} + +void Socket::OnSSLAccept() +{ +} + +bool Socket::SSLNegotiate() +{ + return false; +} + +bool Socket::IsSSL() +{ + return m_b_enable_ssl; +} + +void Socket::EnableSSL(bool x) +{ + m_b_enable_ssl = x; +} + +bool Socket::IsSSLNegotiate() +{ + return m_b_ssl; +} + +void Socket::SetSSLNegotiate(bool x) +{ + m_b_ssl = x; +} + +bool Socket::IsSSLServer() +{ + return m_b_ssl_server; +} + +void Socket::SetSSLServer(bool x) +{ + m_b_ssl_server = x; +} + +void Socket::OnSSLConnectFailed() +{ +} + +void Socket::OnSSLAcceptFailed() +{ +} +#endif // HAVE_OPENSSL + +#ifdef ENABLE_POOL +void Socket::CopyConnection(Socket *sock) +{ + Attach( sock -> GetSocket() ); +#ifdef ENABLE_IPV6 + SetIpv6( sock -> IsIpv6() ); +#endif + SetSocketType( sock -> GetSocketType() ); + SetSocketProtocol( sock -> GetSocketProtocol() ); + + SetClientRemoteAddress( *sock -> GetClientRemoteAddress() ); + SetRemoteAddress( *sock -> GetRemoteSocketAddress() ); +} + +void Socket::SetIsClient() +{ + m_bClient = true; +} + +void Socket::SetSocketType(int x) +{ + m_socket_type = x; +} + +int Socket::GetSocketType() +{ + return m_socket_type; +} + +void Socket::SetSocketProtocol(const std::string& x) +{ + m_socket_protocol = x; +} + +const std::string& Socket::GetSocketProtocol() +{ + return m_socket_protocol; +} + +void Socket::SetRetain() +{ + if (m_bClient) m_bRetain = true; +} + +bool Socket::Retain() +{ + return m_bRetain; +} + +#endif // ENABLE_POOL + +#ifdef ENABLE_SOCKS4 +void Socket::OnSocks4Connect() +{ + Handler().LogError(this, "OnSocks4Connect", 0, "Use with TcpSocket only"); +} + +void Socket::OnSocks4ConnectFailed() +{ + Handler().LogError(this, "OnSocks4ConnectFailed", 0, "Use with TcpSocket only"); +} + +bool Socket::OnSocks4Read() +{ + Handler().LogError(this, "OnSocks4Read", 0, "Use with TcpSocket only"); + return true; +} + +void Socket::SetSocks4Host(const std::string& host) +{ + Utility::u2ip(host, m_socks4_host); +} + +bool Socket::Socks4() +{ + return m_bSocks4; +} + +void Socket::SetSocks4(bool x) +{ + m_bSocks4 = x; +} + +void Socket::SetSocks4Host(ipaddr_t a) +{ + m_socks4_host = a; +} + +void Socket::SetSocks4Port(port_t p) +{ + m_socks4_port = p; +} + +void Socket::SetSocks4Userid(const std::string& x) +{ + m_socks4_userid = x; +} + +ipaddr_t Socket::GetSocks4Host() +{ + return m_socks4_host; +} + +port_t Socket::GetSocks4Port() +{ + return m_socks4_port; +} + +const std::string& Socket::GetSocks4Userid() +{ + return m_socks4_userid; +} +#endif // ENABLE_SOCKS4 + +#ifdef ENABLE_DETACH +bool Socket::Detach() +{ + if (!DeleteByHandler()) + return false; + if (m_pThread) + return false; + if (m_detached) + return false; + SetDetach(); + return true; +} + +void Socket::DetachSocket() +{ + SetDetached(); + m_pThread = new SocketThread(this); + m_pThread -> SetRelease(true); +} + +void Socket::OnDetached() +{ +} + +void Socket::SetDetach(bool x) +{ + Handler().AddList(m_socket, LIST_DETACH, x); + m_detach = x; +} + +bool Socket::IsDetach() +{ + return m_detach; +} + +void Socket::SetDetached(bool x) +{ + m_detached = x; +} + +const bool Socket::IsDetached() const +{ + return m_detached; +} + +void Socket::SetSlaveHandler(ISocketHandler *p) +{ + m_slave_handler = p; +} + +Socket::SocketThread::SocketThread(Socket *p) +:Thread(false) +,m_socket(p) +{ + // Creator will release +} + +Socket::SocketThread::~SocketThread() +{ + if (IsRunning()) + { + SetRelease(true); + SetRunning(false); +#ifdef _WIN32 + Sleep(1000); +#else + sleep(1); +#endif + } +} + +void Socket::SocketThread::Run() +{ + SocketHandler h; + h.SetSlave(); + h.Add(m_socket); + m_socket -> SetSlaveHandler(&h); + m_socket -> OnDetached(); + while (h.GetCount() && IsRunning()) + { + h.Select(0, 500000); + } + // m_socket now deleted oops + // yeah oops m_socket delete its socket thread, that means this + // so Socket will no longer delete its socket thread, instead we do this: + SetDeleteOnExit(); +} +#endif // ENABLE_DETACH + +#ifdef ENABLE_RESOLVER +int Socket::Resolve(const std::string& host,port_t port) +{ + return Handler().Resolve(this, host, port); +} + +#ifdef ENABLE_IPV6 +int Socket::Resolve6(const std::string& host,port_t port) +{ + return Handler().Resolve6(this, host, port); +} +#endif + +int Socket::Resolve(ipaddr_t a) +{ + return Handler().Resolve(this, a); +} + +#ifdef ENABLE_IPV6 +int Socket::Resolve(in6_addr& a) +{ + return Handler().Resolve(this, a); +} +#endif + +void Socket::OnResolved(int,ipaddr_t,port_t) +{ +} + +#ifdef ENABLE_IPV6 +void Socket::OnResolved(int,in6_addr&,port_t) +{ +} +#endif + +void Socket::OnReverseResolved(int,const std::string&) +{ +} + +void Socket::OnResolveFailed(int) +{ +} +#endif // ENABLE_RESOLVER + +/* IP options */ + +bool Socket::SetIpOptions(const void *p, socklen_t len) +{ +#ifdef IP_OPTIONS + if (setsockopt(GetSocket(), IPPROTO_IP, IP_OPTIONS, (char *)p, len) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_OPTIONS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_OPTIONS", LOG_LEVEL_INFO); + return false; +#endif +} + +#ifdef IP_PKTINFO +bool Socket::SetIpPktinfo(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_PKTINFO, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_PKTINFO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef IP_RECVTOS +bool Socket::SetIpRecvTOS(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTOS, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef IP_RECVTTL +bool Socket::SetIpRecvTTL(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVTTL, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVTTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef IP_RECVOPTS +bool Socket::SetIpRecvopts(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVOPTS, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef IP_RETOPTS +bool Socket::SetIpRetopts(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RETOPTS, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RETOPTS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +bool Socket::SetIpTOS(unsigned char tos) +{ +#ifdef IP_TOS + if (setsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(tos)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); + return false; +#endif +} + +unsigned char Socket::IpTOS() +{ + unsigned char tos = 0; +#ifdef IP_TOS + socklen_t len = sizeof(tos); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_TOS, (char *)&tos, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TOS)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "ip option not available", 0, "IP_TOS", LOG_LEVEL_INFO); +#endif + return tos; +} + +bool Socket::SetIpTTL(int ttl) +{ +#ifdef IP_TTL + if (setsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, sizeof(ttl)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); + return false; +#endif +} + +int Socket::IpTTL() +{ + int ttl = 0; +#ifdef IP_TTL + socklen_t len = sizeof(ttl); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_TTL, (char *)&ttl, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "ip option not available", 0, "IP_TTL", LOG_LEVEL_INFO); +#endif + return ttl; +} + +bool Socket::SetIpHdrincl(bool x) +{ +#ifdef IP_HDRINCL + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_HDRINCL, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_HDRINCL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_HDRINCL", LOG_LEVEL_INFO); + return false; +#endif +} + +#ifdef IP_RECVERR +bool Socket::SetIpRecverr(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_RECVERR, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_RECVERR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef IP_MTU_DISCOVER +bool Socket::SetIpMtudiscover(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_MTU_DISCOVER, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MTU_DISCOVER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef IP_MTU +int Socket::IpMtu() +{ + int mtu = 0; + socklen_t len = sizeof(mtu); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_MTU, (char *)&mtu, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MTU)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } + return mtu; +} +#endif + +#ifdef IP_ROUTER_ALERT +bool Socket::SetIpRouterAlert(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_ROUTER_ALERT, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ROUTER_ALERT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +bool Socket::SetIpMulticastTTL(int ttl) +{ +#ifdef IP_MULTICAST_TTL + if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(ttl)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); + return false; +#endif +} + +int Socket::IpMulticastTTL() +{ + int ttl = 0; +#ifdef IP_MULTICAST_TTL + socklen_t len = sizeof(ttl); + if (getsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ttl, &len) == -1) + { + Handler().LogError(this, "getsockopt(IPPROTO_IP, IP_MULTICAST_TTL)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_TTL", LOG_LEVEL_INFO); +#endif + return ttl; +} + +bool Socket::SetMulticastLoop(bool x) +{ +#ifdef IP_MULTICAST_LOOP + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_MULTICAST_LOOP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_MULTICAST_LOOP", LOG_LEVEL_INFO); + return false; +#endif +} + +#ifdef LINUX +bool Socket::IpAddMembership(struct ip_mreqn& ref) +{ +#ifdef IP_ADD_MEMBERSHIP + if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); + return false; +#endif +} +#endif + +bool Socket::IpAddMembership(struct ip_mreq& ref) +{ +#ifdef IP_ADD_MEMBERSHIP + if (setsockopt(GetSocket(), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_ADD_MEMBERSHIP", LOG_LEVEL_INFO); + return false; +#endif +} + +#ifdef LINUX +bool Socket::IpDropMembership(struct ip_mreqn& ref) +{ +#ifdef IP_DROP_MEMBERSHIP + if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreqn)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); + return false; +#endif +} +#endif + +bool Socket::IpDropMembership(struct ip_mreq& ref) +{ +#ifdef IP_DROP_MEMBERSHIP + if (setsockopt(GetSocket(), IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&ref, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_IP, IP_DROP_MEMBERSHIP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "ip option not available", 0, "IP_DROP_MEMBERSHIP", LOG_LEVEL_INFO); + return false; +#endif +} + +/* SOCKET options */ + +bool Socket::SetSoReuseaddr(bool x) +{ +#ifdef SO_REUSEADDR + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_REUSEADDR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_REUSEADDR", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoKeepalive(bool x) +{ +#ifdef SO_KEEPALIVE + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_KEEPALIVE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_KEEPALIVE", LOG_LEVEL_INFO); + return false; +#endif +} + +#ifdef SO_NOSIGPIPE +bool Socket::SetSoNosigpipe(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_NOSIGPIPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +bool Socket::SoAcceptconn() +{ + int value = 0; +#ifdef SO_ACCEPTCONN + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_ACCEPTCONN, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ACCEPTCONN)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "socket option not available", 0, "SO_ACCEPTCONN", LOG_LEVEL_INFO); +#endif + return value ? true : false; +} + +#ifdef SO_BSDCOMPAT +bool Socket::SetSoBsdcompat(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BSDCOMPAT, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BSDCOMPAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef SO_BINDTODEVICE +bool Socket::SetSoBindtodevice(const std::string& intf) +{ + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BINDTODEVICE, (char *)intf.c_str(), intf.size()) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BINDTODEVICE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +bool Socket::SetSoBroadcast(bool x) +{ +#ifdef SO_BROADCAST + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_BROADCAST)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_BROADCAST", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoDebug(bool x) +{ +#ifdef SO_DEBUG + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_DEBUG, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DEBUG)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_DEBUG", LOG_LEVEL_INFO); + return false; +#endif +} + +int Socket::SoError() +{ + int value = 0; +#ifdef SO_ERROR + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_ERROR, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_ERROR)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "socket option not available", 0, "SO_ERROR", LOG_LEVEL_INFO); +#endif + return value; +} + +bool Socket::SetSoDontroute(bool x) +{ +#ifdef SO_DONTROUTE + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_DONTROUTE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_DONTROUTE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_DONTROUTE", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoLinger(int onoff, int linger) +{ +#ifdef SO_LINGER + struct linger stl; + stl.l_onoff = onoff; + stl.l_linger = linger; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_LINGER, (char *)&stl, sizeof(stl)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_LINGER)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_LINGER", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoOobinline(bool x) +{ +#ifdef SO_OOBINLINE + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_OOBINLINE, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_OOBINLINE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_OOBINLINE", LOG_LEVEL_INFO); + return false; +#endif +} + +#ifdef SO_PASSCRED +bool Socket::SetSoPasscred(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_PASSCRED, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PASSCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef SO_PEERCRED +bool Socket::SoPeercred(struct ucred& ucr) +{ + if (setsockopt(GetSocket(), SOL_SOCKET, SO_PEERCRED, (char *)&ucr, sizeof(ucr)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PEERCRED)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef SO_PRIORITY +bool Socket::SetSoPriority(int x) +{ + if (setsockopt(GetSocket(), SOL_SOCKET, SO_PRIORITY, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_PRIORITY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +bool Socket::SetSoRcvlowat(int x) +{ +#ifdef SO_RCVLOWAT + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVLOWAT, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_RCVLOWAT", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoSndlowat(int x) +{ +#ifdef SO_SNDLOWAT + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDLOWAT, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDLOWAT)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_SNDLOWAT", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoRcvtimeo(struct timeval& tv) +{ +#ifdef SO_RCVTIMEO + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_RCVTIMEO", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoSndtimeo(struct timeval& tv) +{ +#ifdef SO_SNDTIMEO + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDTIMEO)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_SNDTIMEO", LOG_LEVEL_INFO); + return false; +#endif +} + +bool Socket::SetSoRcvbuf(int x) +{ +#ifdef SO_RCVBUF + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); + return false; +#endif +} + +int Socket::SoRcvbuf() +{ + int value = 0; +#ifdef SO_RCVBUF + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUF, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_RCVBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "socket option not available", 0, "SO_RCVBUF", LOG_LEVEL_INFO); +#endif + return value; +} + +#ifdef SO_RCVBUFFORCE +bool Socket::SetSoRcvbufforce(int x) +{ + if (setsockopt(GetSocket(), SOL_SOCKET, SO_RCVBUFFORCE, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_RCVBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +bool Socket::SetSoSndbuf(int x) +{ +#ifdef SO_SNDBUF + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); + return false; +#endif +} + +int Socket::SoSndbuf() +{ + int value = 0; +#ifdef SO_SNDBUF + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUF, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_SNDBUF)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "socket option not available", 0, "SO_SNDBUF", LOG_LEVEL_INFO); +#endif + return value; +} + +#ifdef SO_SNDBUFFORCE +bool Socket::SetSoSndbufforce(int x) +{ + if (setsockopt(GetSocket(), SOL_SOCKET, SO_SNDBUFFORCE, (char *)&x, sizeof(x)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_SNDBUFFORCE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +#ifdef SO_TIMESTAMP +bool Socket::SetSoTimestamp(bool x) +{ + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_SOCKET, SO_TIMESTAMP, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(SOL_SOCKET, SO_TIMESTAMP)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +} +#endif + +int Socket::SoType() +{ + int value = 0; +#ifdef SO_TYPE + socklen_t len = sizeof(value); + if (getsockopt(GetSocket(), SOL_SOCKET, SO_TYPE, (char *)&value, &len) == -1) + { + Handler().LogError(this, "getsockopt(SOL_SOCKET, SO_TYPE)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + } +#else + Handler().LogError(this, "socket option not available", 0, "SO_TYPE", LOG_LEVEL_INFO); +#endif + return value; +} + +#ifdef ENABLE_TRIGGERS +void Socket::Subscribe(int id) +{ + Handler().Subscribe(id, this); +} + +void Socket::Unsubscribe(int id) +{ + Handler().Unsubscribe(id, this); +} + +void Socket::OnTrigger(int, const TriggerData&) +{ +} + +void Socket::OnCancelled(int) +{ +} +#endif + +void Socket::SetTimeout(time_t secs) +{ + if (!secs) + { + Handler().AddList(m_socket, LIST_TIMEOUT, false); + return; + } + Handler().AddList(m_socket, LIST_TIMEOUT, true); + m_timeout_start = time(NULL); + m_timeout_limit = secs; +} + +void Socket::OnTimeout() +{ +} + +void Socket::OnConnectTimeout() +{ +} + +bool Socket::Timeout(time_t tnow) +{ + if (tnow - m_timeout_start > m_timeout_limit) + return true; + return false; +} + +/** Returns local port number for bound socket file descriptor. */ +port_t Socket::GetSockPort() +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in6); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + return ntohs(sa.sin6_port); + } +#endif +#endif + struct sockaddr_in sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + return ntohs(sa.sin_port); +} + +/** Returns local ipv4 address for bound socket file descriptor. */ +ipaddr_t Socket::GetSockIP4() +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + return 0; + } +#endif +#endif + struct sockaddr_in sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + ipaddr_t a; + memcpy(&a, &sa.sin_addr, 4); + return a; +} + +/** Returns local ipv4 address as text for bound socket file descriptor. */ +std::string Socket::GetSockAddress() +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + return ""; + } +#endif +#endif + struct sockaddr_in sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + Ipv4Address addr( sa ); + return addr.Convert(); +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +/** Returns local ipv6 address for bound socket file descriptor. */ +struct in6_addr Socket::GetSockIP6() +{ + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in6); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + return sa.sin6_addr; + } + struct in6_addr a; + memset(&a, 0, sizeof(a)); + return a; +} + +/** Returns local ipv6 address as text for bound socket file descriptor. */ +std::string Socket::GetSockAddress6() +{ + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sockaddr_length = sizeof(struct sockaddr_in6); + if (getsockname(GetSocket(), (struct sockaddr *)&sa, (socklen_t*)&sockaddr_length) == -1) + memset(&sa, 0, sizeof(sa)); + Ipv6Address addr( sa ); + return addr.Convert(); + } + return ""; +} +#endif +#endif + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/SocketHandler.cpp b/externals/sockets/SocketHandler.cpp new file mode 100644 index 0000000..acf71fb --- /dev/null +++ b/externals/sockets/SocketHandler.cpp @@ -0,0 +1,1377 @@ +/** \file SocketHandler.cpp + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifdef _WIN32 +#ifdef _MSC_VER +#pragma warning(disable:4786) +#endif +#endif +#include +#include +#include +#include + +#include "SocketHandler.h" +#include "UdpSocket.h" +#include "ResolvSocket.h" +#include "ResolvServer.h" +#include "TcpSocket.h" +#include "Mutex.h" +#include "Utility.h" +#include "SocketAddress.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +//#ifdef _DEBUG +//#define DEB(x) x; fflush(stderr); +//#else +#define DEB(x) +//#endif + +SocketHandler::SocketHandler(StdLog *p) +:m_stdlog(p) +,m_mutex(m_mutex) +,m_b_use_mutex(false) +,m_maxsock(0) +,m_preverror(-1) +,m_errcnt(0) +,m_tlast(0) +#ifdef ENABLE_SOCKS4 +,m_socks4_host(0) +,m_socks4_port(0) +,m_bTryDirect(false) +#endif +#ifdef ENABLE_RESOLVER +,m_resolv_id(0) +,m_resolver(NULL) +#endif +#ifdef ENABLE_POOL +,m_b_enable_pool(false) +#endif +#ifdef ENABLE_TRIGGERS +,m_next_trigger_id(0) +#endif +#ifdef ENABLE_DETACH +,m_slave(false) +#endif +{ + FD_ZERO(&m_rfds); + FD_ZERO(&m_wfds); + FD_ZERO(&m_efds); +} + +SocketHandler::SocketHandler(Mutex& mutex,StdLog *p) +:m_stdlog(p) +,m_mutex(mutex) +,m_b_use_mutex(true) +,m_maxsock(0) +,m_preverror(-1) +,m_errcnt(0) +,m_tlast(0) +#ifdef ENABLE_SOCKS4 +,m_socks4_host(0) +,m_socks4_port(0) +,m_bTryDirect(false) +#endif +#ifdef ENABLE_RESOLVER +,m_resolv_id(0) +,m_resolver(NULL) +#endif +#ifdef ENABLE_POOL +,m_b_enable_pool(false) +#endif +#ifdef ENABLE_TRIGGERS +,m_next_trigger_id(0) +#endif +#ifdef ENABLE_DETACH +,m_slave(false) +#endif +{ + m_mutex.Lock(); + FD_ZERO(&m_rfds); + FD_ZERO(&m_wfds); + FD_ZERO(&m_efds); +} + +SocketHandler::~SocketHandler() +{ +#ifdef ENABLE_RESOLVER + if (m_resolver) + { + m_resolver -> Quit(); + } +#endif + { + while (m_sockets.size()) + { +DEB( fprintf(stderr, "Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) + socket_m::iterator it = m_sockets.begin(); + Socket *p = it -> second; + if (p) + { +DEB( fprintf(stderr, " fd %d\n", p -> GetSocket());) + p -> Close(); +DEB( fprintf(stderr, " fd closed %d\n", p -> GetSocket());) +// p -> OnDelete(); // hey, I turn this back on. what's the worst that could happen??!! + // MinionSocket breaks, calling MinderHandler methods in OnDelete - + // MinderHandler is already gone when that happens... + + // only delete socket when controlled + // ie master sockethandler can delete non-detached sockets + // and a slave sockethandler can only delete a detach socket + if (p -> DeleteByHandler() +#ifdef ENABLE_DETACH + && !(m_slave ^ p -> IsDetached()) +#endif + ) + { + p -> SetErasedByHandler(); + delete p; + } + m_sockets.erase(it); + } + else + { + m_sockets.erase(it); + } +DEB( fprintf(stderr, "next\n");) + } +DEB( fprintf(stderr, "/Emptying sockets list in SocketHandler destructor, %d instances\n", (int)m_sockets.size());) + } +#ifdef ENABLE_RESOLVER + if (m_resolver) + { + delete m_resolver; + } +#endif + if (m_b_use_mutex) + { + m_mutex.Unlock(); + } +} + +Mutex& SocketHandler::GetMutex() const +{ + return m_mutex; +} + +#ifdef ENABLE_DETACH +void SocketHandler::SetSlave(bool x) +{ + m_slave = x; +} + +bool SocketHandler::IsSlave() +{ + return m_slave; +} +#endif + +void SocketHandler::RegStdLog(StdLog *log) +{ + m_stdlog = log; +} + +void SocketHandler::LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t) +{ + if (m_stdlog) + { + m_stdlog -> error(this, p, user_text, err, sys_err, t); + } +} + +void SocketHandler::Add(Socket *p) +{ + if (p -> GetSocket() == INVALID_SOCKET) + { + LogError(p, "Add", -1, "Invalid socket", LOG_LEVEL_WARNING); + if (p -> CloseAndDelete()) + { + m_delete.push_back(p); + } + return; + } + if (m_add.find(p -> GetSocket()) != m_add.end()) + { + LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in add queue", LOG_LEVEL_FATAL); + m_delete.push_back(p); + return; + } + m_add[p -> GetSocket()] = p; +} + +void SocketHandler::Get(SOCKET s,bool& r,bool& w,bool& e) +{ + if (s >= 0) + { + r = FD_ISSET(s, &m_rfds) ? true : false; + w = FD_ISSET(s, &m_wfds) ? true : false; + e = FD_ISSET(s, &m_efds) ? true : false; + } +} + +void SocketHandler::Set(SOCKET s,bool bRead,bool bWrite,bool bException) +{ +DEB( fprintf(stderr, "Set(%d, %s, %s, %s)\n", s, bRead ? "true" : "false", bWrite ? "true" : "false", bException ? "true" : "false");) + if (s >= 0) + { + if (bRead) + { + if (!FD_ISSET(s, &m_rfds)) + { + FD_SET(s, &m_rfds); + } + } + else + { + FD_CLR(s, &m_rfds); + } + if (bWrite) + { + if (!FD_ISSET(s, &m_wfds)) + { + FD_SET(s, &m_wfds); + } + } + else + { + FD_CLR(s, &m_wfds); + } + if (bException) + { + if (!FD_ISSET(s, &m_efds)) + { + FD_SET(s, &m_efds); + } + } + else + { + FD_CLR(s, &m_efds); + } + } +} + +int SocketHandler::Select(long sec,long usec) +{ + struct timeval tv; + tv.tv_sec = sec; + tv.tv_usec = usec; + return Select(&tv); +} + +int SocketHandler::Select() +{ + if (!m_fds_callonconnect.empty() || +#ifdef ENABLE_DETACH + (!m_slave && !m_fds_detach.empty()) || +#endif + !m_fds_timeout.empty() || + !m_fds_retry.empty() || + !m_fds_close.empty() || + !m_fds_erase.empty()) + { + return Select(0, 200000); + } + return Select(NULL); +} + +int SocketHandler::Select(struct timeval *tsel) +{ + size_t ignore = 0; + while (m_add.size() > ignore) + { + if (m_sockets.size() >= FD_SETSIZE) + { + LogError(NULL, "Select", (int)m_sockets.size(), "FD_SETSIZE reached", LOG_LEVEL_WARNING); + break; + } + socket_m::iterator it = m_add.begin(); + SOCKET s = it -> first; + Socket *p = it -> second; +DEB( fprintf(stderr, "Trying to add fd %d, m_add.size() %d, ignore %d\n", (int)s, (int)m_add.size(), (int)ignore);) + // + if (m_sockets.find(p -> GetSocket()) != m_sockets.end()) + { + LogError(p, "Add", (int)p -> GetSocket(), "Attempt to add socket already in controlled queue", LOG_LEVEL_FATAL); + // %! it's a dup, don't add to delete queue, just ignore it + m_delete.push_back(p); + m_add.erase(it); +// ignore++; + continue; + } + if (!p -> CloseAndDelete()) + { + StreamSocket *scp = dynamic_cast(p); + if (scp && scp -> Connecting()) // 'Open' called before adding socket + { + Set(s,false,true); + } + else + { + TcpSocket *tcp = dynamic_cast(p); + bool bWrite = tcp ? tcp -> GetOutputLength() != 0 : false; + if (p -> IsDisableRead()) + { + Set(s, false, bWrite); + } + else + { + Set(s, true, bWrite); + } + } + m_maxsock = (s > m_maxsock) ? s : m_maxsock; + } + else + { + LogError(p, "Add", (int)p -> GetSocket(), "Trying to add socket with SetCloseAndDelete() true", LOG_LEVEL_WARNING); + } + // only add to m_fds (process fd_set events) if + // slave handler and detached/detaching socket + // master handler and non-detached socket +#ifdef ENABLE_DETACH + if (!(m_slave ^ p -> IsDetach())) +#endif + { + m_fds.push_back(s); + } + m_sockets[s] = p; + // + m_add.erase(it); + } +#ifdef MACOSX + fd_set rfds; + fd_set wfds; + fd_set efds; + FD_COPY(&m_rfds, &rfds); + FD_COPY(&m_wfds, &wfds); + FD_COPY(&m_efds, &efds); +#else + fd_set rfds = m_rfds; + fd_set wfds = m_wfds; + fd_set efds = m_efds; +#endif + int n; + if (m_b_use_mutex) + { + m_mutex.Unlock(); + n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); + m_mutex.Lock(); + } + else + { + n = select( (int)(m_maxsock + 1),&rfds,&wfds,&efds,tsel); + } + if (n == -1) + { + /* + EBADF An invalid file descriptor was given in one of the sets. + EINTR A non blocked signal was caught. + EINVAL n is negative. Or struct timeval contains bad time values (<0). + ENOMEM select was unable to allocate memory for internal tables. + */ + if (Errno != m_preverror || m_errcnt++ % 10000 == 0) + { + LogError(NULL, "select", Errno, StrError(Errno)); +DEB( fprintf(stderr, "m_maxsock: %d\n", m_maxsock); + fprintf(stderr, "%s\n", Errno == EINVAL ? "EINVAL" : + Errno == EINTR ? "EINTR" : + Errno == EBADF ? "EBADF" : + Errno == ENOMEM ? "ENOMEM" : ""); + // test bad fd + for (SOCKET i = 0; i <= m_maxsock; i++) + { + bool t = false; + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + if (FD_ISSET(i, &m_rfds)) + { + FD_SET(i, &rfds); + t = true; + } + if (FD_ISSET(i, &m_wfds)) + { + FD_SET(i, &wfds); + t = true; + } + if (FD_ISSET(i, &m_efds)) + { + FD_SET(i, &efds); + t = true; + } + if (t && m_sockets.find(i) == m_sockets.end()) + { + fprintf(stderr, "Bad fd in fd_set: %d\n", i); + } + } +) // DEB + m_preverror = Errno; + } + /// \todo rebuild fd_set's from active sockets list (m_sockets) here + } + else + if (!n) + { + m_preverror = -1; + } + else + if (n > 0) + { + for (socket_v::iterator it2 = m_fds.begin(); it2 != m_fds.end() && n; it2++) + { + SOCKET i = *it2; + if (FD_ISSET(i, &rfds)) + { + socket_m::iterator itmp = m_sockets.find(i); + if (itmp != m_sockets.end()) // found + { + Socket *p = itmp -> second; + // new SSL negotiate method +#ifdef HAVE_OPENSSL + if (p -> IsSSLNegotiate()) + { + p -> SSLNegotiate(); + } + else +#endif + { + p -> OnRead(); + } + } + else + { + LogError(NULL, "GetSocket/handler/1", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + n--; + } + if (FD_ISSET(i, &wfds)) + { + socket_m::iterator itmp = m_sockets.find(i); + if (itmp != m_sockets.end()) // found + { + Socket *p = itmp -> second; + // new SSL negotiate method +#ifdef HAVE_OPENSSL + if (p -> IsSSLNegotiate()) + { + p -> SSLNegotiate(); + } + else +#endif + { + p -> OnWrite(); + } + } + else + { + LogError(NULL, "GetSocket/handler/2", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + n--; + } + if (FD_ISSET(i, &efds)) + { + socket_m::iterator itmp = m_sockets.find(i); + if (itmp != m_sockets.end()) // found + { + Socket *p = itmp -> second; + p -> OnException(); + } + else + { + LogError(NULL, "GetSocket/handler/3", (int)i, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + n--; + } + } // m_fds loop + m_preverror = -1; + } // if (n > 0) + + // check CallOnConnect - EVENT + if (!m_fds_callonconnect.empty()) + { + socket_v tmp = m_fds_callonconnect; + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/4", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + if (p) + { +// if (p -> CallOnConnect() && p -> Ready() ) + { + p -> SetConnected(); // moved here from inside if (tcp) check below +#ifdef HAVE_OPENSSL + if (p -> IsSSL()) // SSL Enabled socket + p -> OnSSLConnect(); + else +#endif +#ifdef ENABLE_SOCKS4 + if (p -> Socks4()) + p -> OnSocks4Connect(); + else +#endif + { + TcpSocket *tcp = dynamic_cast(p); + if (tcp) + { + if (tcp -> GetOutputLength()) + { + p -> OnWrite(); + } + } +#ifdef ENABLE_RECONNECT + if (tcp && tcp -> IsReconnect()) + p -> OnReconnect(); + else +#endif + { +// LogError(p, "Calling OnConnect", 0, "Because CallOnConnect", LOG_LEVEL_INFO); + p -> OnConnect(); + } + } +// p -> SetCallOnConnect( false ); + AddList(p -> GetSocket(), LIST_CALLONCONNECT, false); + } + } + } + } +#ifdef ENABLE_DETACH + // check detach of socket if master handler - EVENT + if (!m_slave && !m_fds_detach.empty()) + { + // %! why not using tmp list here??!? + for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/5", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + if (p) + { +// if (p -> IsDetach()) + { + Set(p -> GetSocket(), false, false, false); + // After DetachSocket(), all calls to Handler() will return a reference + // to the new slave SocketHandler running in the new thread. + p -> DetachSocket(); + // Adding the file descriptor to m_fds_erase will now also remove the + // socket from the detach queue - tnx knightmad + m_fds_erase.push_back(p -> GetSocket()); + } + } + } + } +#endif + // check Connecting - connection timeout - conditional event + if (m_fds_timeout.size()) + { + time_t tnow = time(NULL); + if (tnow != m_tlast) + { + socket_v tmp = m_fds_timeout; +DEB( fprintf(stderr, "Checking %d socket(s) for timeout\n", tmp.size());) + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + itmp = m_add.find(*it); + if (itmp != m_add.end()) + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/6", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + } + if (p) + { + if (p -> Timeout(tnow)) + { + StreamSocket *scp = dynamic_cast(p); + if (scp && scp -> Connecting()) + p -> OnConnectTimeout(); + else + p -> OnTimeout(); + p -> SetTimeout(0); + } + } + } + m_tlast = tnow; + } // tnow != tlast + } + // check retry client connect - EVENT + if (!m_fds_retry.empty()) + { + socket_v tmp = m_fds_retry; + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/7", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + if (p) + { +// if (p -> RetryClientConnect()) + { + TcpSocket *tcp = dynamic_cast(p); + SOCKET nn = *it; //(*it3).first; + tcp -> SetRetryClientConnect(false); +DEB( fprintf(stderr, "Close() before retry client connect\n");) + p -> Close(); // removes from m_fds_retry + std::auto_ptr ad = p -> GetClientRemoteAddress(); + if (ad.get()) + { + tcp -> Open(*ad); + } + else + { + LogError(p, "RetryClientConnect", 0, "no address", LOG_LEVEL_ERROR); + } + Add(p); + m_fds_erase.push_back(nn); + } + } + } + } + // check close and delete - conditional event + if (!m_fds_close.empty()) + { + socket_v tmp = m_fds_close; +DEB( fprintf(stderr, "m_fds_close.size() == %d\n", (int)m_fds_close.size());) + for (socket_v::iterator it = tmp.begin(); it != tmp.end(); it++) + { + Socket *p = NULL; + { + socket_m::iterator itmp = m_sockets.find(*it); + if (itmp != m_sockets.end()) // found + { + p = itmp -> second; + } + else + { + itmp = m_add.find(*it); + if (itmp != m_add.end()) + { + p = itmp -> second; + } + else + { + LogError(NULL, "GetSocket/handler/8", (int)*it, "Did not find expected socket using file descriptor", LOG_LEVEL_WARNING); + } + } + } + if (p) + { +// if (p -> CloseAndDelete() ) + { + TcpSocket *tcp = dynamic_cast(p); + // new graceful tcp - flush and close timeout 5s + if (tcp && p -> IsConnected() && tcp -> GetFlushBeforeClose() && +#ifdef HAVE_OPENSSL + !tcp -> IsSSL() && +#endif + p -> TimeSinceClose() < 5) + { +DEB( fprintf(stderr, " close(1)\n");) + if (tcp -> GetOutputLength()) + { + LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Sending all data before closing", LOG_LEVEL_INFO); + } + else // shutdown write when output buffer is empty + if (!(tcp -> GetShutdown() & SHUT_WR)) + { + SOCKET nn = *it; + if (nn != INVALID_SOCKET && shutdown(nn, SHUT_WR) == -1) + { + LogError(p, "graceful shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + tcp -> SetShutdown(SHUT_WR); + } + } + else +#ifdef ENABLE_RECONNECT + if (tcp && p -> IsConnected() && tcp -> Reconnect()) + { + SOCKET nn = *it; //(*it3).first; +DEB( fprintf(stderr, " close(2) fd %d\n", nn);) + p -> SetCloseAndDelete(false); + tcp -> SetIsReconnect(); + p -> SetConnected(false); +DEB( fprintf(stderr, "Close() before reconnect\n");) + p -> Close(); // dispose of old file descriptor (Open creates a new) + p -> OnDisconnect(); + std::auto_ptr ad = p -> GetClientRemoteAddress(); + if (ad.get()) + { + tcp -> Open(*ad); + } + else + { + LogError(p, "Reconnect", 0, "no address", LOG_LEVEL_ERROR); + } + tcp -> ResetConnectionRetries(); + Add(p); + m_fds_erase.push_back(nn); + } + else +#endif + { + SOCKET nn = *it; //(*it3).first; +DEB( fprintf(stderr, " close(3) fd %d GetSocket() %d\n", nn, p -> GetSocket());) + if (tcp && p -> IsConnected() && tcp -> GetOutputLength()) + { + LogError(p, "Closing", (int)tcp -> GetOutputLength(), "Closing socket while data still left to send", LOG_LEVEL_WARNING); + } +#ifdef ENABLE_POOL + if (p -> Retain() && !p -> Lost()) + { + PoolSocket *p2 = new PoolSocket(*this, p); + p2 -> SetDeleteByHandler(); + Add(p2); + // + p -> SetCloseAndDelete(false); // added - remove from m_fds_close + } + else +#endif // ENABLE_POOL + { + Set(p -> GetSocket(),false,false,false); +DEB( fprintf(stderr, "Close() before OnDelete\n");) + p -> Close(); + } + p -> OnDelete(); + if (p -> DeleteByHandler()) + { + p -> SetErasedByHandler(); + } + m_fds_erase.push_back(nn); + } + } + } + } + } + + // check erased sockets + bool check_max_fd = false; + while (!m_fds_erase.empty()) + { + socket_v::iterator it = m_fds_erase.begin(); + SOCKET nn = *it; +#ifdef ENABLE_DETACH + { + for (socket_v::iterator it = m_fds_detach.begin(); it != m_fds_detach.end(); it++) + { + if (*it == nn) + { + m_fds_detach.erase(it); + break; + } + } + } +#endif + { + for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) + { + if (*it == nn) + { + m_fds.erase(it); + break; + } + } + } + { + socket_m::iterator it = m_sockets.find(nn); + if (it != m_sockets.end()) + { + Socket *p = it -> second; + /* Sometimes a SocketThread class can finish its run before the master + sockethandler gets here. In that case, the SocketThread has set the + 'ErasedByHandler' flag on the socket which will make us end up with a + double delete on the socket instance. + The fix is to make sure that the master sockethandler only can delete + non-detached sockets, and a slave sockethandler only can delete + detach sockets. */ + if (p -> ErasedByHandler() +#ifdef ENABLE_DETACH + && !(m_slave ^ p -> IsDetached()) +#endif + ) + { +#ifdef ENABLE_TRIGGERS + bool again = false; + do + { + again = false; + for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) + { + int id = it -> first; + Socket *src = it -> second; + if (src == p) + { + for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) + { + Socket *dst = it -> first; + if (Valid(dst)) + { + dst -> OnCancelled(id); + } + } + m_trigger_src.erase(m_trigger_src.find(id)); + m_trigger_dst.erase(m_trigger_dst.find(id)); + again = true; + break; + } + } + } while (again); +#endif + delete p; + } + m_sockets.erase(it); + } + } + m_fds_erase.erase(it); + check_max_fd = true; + } + // calculate max file descriptor for select() call + if (check_max_fd) + { + m_maxsock = 0; + for (socket_v::iterator it = m_fds.begin(); it != m_fds.end(); it++) + { + SOCKET s = *it; + m_maxsock = s > m_maxsock ? s : m_maxsock; + } + } + // remove Add's that fizzed + while (!m_delete.empty()) + { + std::list::iterator it = m_delete.begin(); + Socket *p = *it; + p -> OnDelete(); + m_delete.erase(it); + if (p -> DeleteByHandler() +#ifdef ENABLE_DETACH + && !(m_slave ^ p -> IsDetached()) +#endif + ) + { + p -> SetErasedByHandler(); +#ifdef ENABLE_TRIGGERS + bool again = false; + do + { + again = false; + for (std::map::iterator it = m_trigger_src.begin(); it != m_trigger_src.end(); it++) + { + int id = it -> first; + Socket *src = it -> second; + if (src == p) + { + for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) + { + Socket *dst = it -> first; + if (Valid(dst)) + { + dst -> OnCancelled(id); + } + } + m_trigger_src.erase(m_trigger_src.find(id)); + m_trigger_dst.erase(m_trigger_dst.find(id)); + again = true; + break; + } + } + } while (again); +#endif + delete p; + } + } + return n; +} + +#ifdef ENABLE_RESOLVER +bool SocketHandler::Resolving(Socket *p0) +{ + std::map::iterator it = m_resolve_q.find(p0); + return it != m_resolve_q.end(); +} +#endif + +bool SocketHandler::Valid(Socket *p0) +{ + for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) + { + Socket *p = it -> second; + if (p0 == p) + return true; + } + return false; +} + +bool SocketHandler::OkToAccept(Socket *) +{ + return true; +} + +size_t SocketHandler::GetCount() +{ +/* +printf(" m_sockets : %d\n", m_sockets.size()); +printf(" m_add : %d\n", m_add.size()); +printf(" m_delete : %d\n", m_delete.size()); +*/ + return m_sockets.size() + m_add.size() + m_delete.size(); +} + +#ifdef ENABLE_SOCKS4 +void SocketHandler::SetSocks4Host(ipaddr_t a) +{ + m_socks4_host = a; +} + +void SocketHandler::SetSocks4Host(const std::string& host) +{ + Utility::u2ip(host, m_socks4_host); +} + +void SocketHandler::SetSocks4Port(port_t port) +{ + m_socks4_port = port; +} + +void SocketHandler::SetSocks4Userid(const std::string& id) +{ + m_socks4_userid = id; +} +#endif + +#ifdef ENABLE_RESOLVER +int SocketHandler::Resolve(Socket *p,const std::string& host,port_t port) +{ + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, host, port); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; +DEB( fprintf(stderr, " *** Resolve '%s:%d' id#%d m_resolve_q size: %d p: %p\n", host.c_str(), port, resolv -> GetId(), m_resolve_q.size(), p);) + return resolv -> GetId(); +} + +#ifdef ENABLE_IPV6 +int SocketHandler::Resolve6(Socket *p,const std::string& host,port_t port) +{ + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, host, port, true); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; + return resolv -> GetId(); +} +#endif + +int SocketHandler::Resolve(Socket *p,ipaddr_t a) +{ + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, a); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; + return resolv -> GetId(); +} + +#ifdef ENABLE_IPV6 +int SocketHandler::Resolve(Socket *p,in6_addr& a) +{ + // check cache + ResolvSocket *resolv = new ResolvSocket(*this, p, a); + resolv -> SetId(++m_resolv_id); + resolv -> SetDeleteByHandler(); + ipaddr_t local; + Utility::u2ip("127.0.0.1", local); + if (!resolv -> Open(local, m_resolver_port)) + { + LogError(resolv, "Resolve", -1, "Can't connect to local resolve server", LOG_LEVEL_FATAL); + } + Add(resolv); + m_resolve_q[p] = true; + return resolv -> GetId(); +} +#endif + +void SocketHandler::EnableResolver(port_t port) +{ + if (!m_resolver) + { + m_resolver_port = port; + m_resolver = new ResolvServer(port); + } +} + +bool SocketHandler::ResolverReady() +{ + return m_resolver ? m_resolver -> Ready() : false; +} +#endif // ENABLE_RESOLVER + +#ifdef ENABLE_SOCKS4 +void SocketHandler::SetSocks4TryDirect(bool x) +{ + m_bTryDirect = x; +} + +ipaddr_t SocketHandler::GetSocks4Host() +{ + return m_socks4_host; +} + +port_t SocketHandler::GetSocks4Port() +{ + return m_socks4_port; +} + +const std::string& SocketHandler::GetSocks4Userid() +{ + return m_socks4_userid; +} + +bool SocketHandler::Socks4TryDirect() +{ + return m_bTryDirect; +} +#endif + +#ifdef ENABLE_RESOLVER +bool SocketHandler::ResolverEnabled() +{ + return m_resolver ? true : false; +} + +port_t SocketHandler::GetResolverPort() +{ + return m_resolver_port; +} +#endif // ENABLE_RESOLVER + +#ifdef ENABLE_POOL +ISocketHandler::PoolSocket *SocketHandler::FindConnection(int type,const std::string& protocol,SocketAddress& ad) +{ + for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end() && !m_sockets.empty(); it++) + { + PoolSocket *pools = dynamic_cast(it -> second); + if (pools) + { + if (pools -> GetSocketType() == type && + pools -> GetSocketProtocol() == protocol && +// %! pools -> GetClientRemoteAddress() && + *pools -> GetClientRemoteAddress() == ad) + { + m_sockets.erase(it); + pools -> SetRetain(); // avoid Close in Socket destructor + return pools; // Caller is responsible that this socket is deleted + } + } + } + return NULL; +} + +void SocketHandler::EnablePool(bool x) +{ + m_b_enable_pool = x; +} + +bool SocketHandler::PoolEnabled() +{ + return m_b_enable_pool; +} +#endif + +void SocketHandler::Remove(Socket *p) +{ +#ifdef ENABLE_RESOLVER + std::map::iterator it4 = m_resolve_q.find(p); + if (it4 != m_resolve_q.end()) + m_resolve_q.erase(it4); +#endif + if (p -> ErasedByHandler()) + { + return; + } + for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++) + { + if (it -> second == p) + { + LogError(p, "Remove", -1, "Socket destructor called while still in use", LOG_LEVEL_WARNING); + m_sockets.erase(it); + return; + } + } + for (socket_m::iterator it2 = m_add.begin(); it2 != m_add.end(); it2++) + { + if ((*it2).second == p) + { + LogError(p, "Remove", -2, "Socket destructor called while still in use", LOG_LEVEL_WARNING); + m_add.erase(it2); + return; + } + } + for (std::list::iterator it3 = m_delete.begin(); it3 != m_delete.end(); it3++) + { + if (*it3 == p) + { + LogError(p, "Remove", -3, "Socket destructor called while still in use", LOG_LEVEL_WARNING); + m_delete.erase(it3); + return; + } + } +} + +void SocketHandler::CheckSanity() +{ + CheckList(m_fds, "active sockets"); // active sockets + CheckList(m_fds_erase, "sockets to be erased"); // should always be empty anyway + CheckList(m_fds_callonconnect, "checklist CallOnConnect"); +#ifdef ENABLE_DETACH + CheckList(m_fds_detach, "checklist Detach"); +#endif + CheckList(m_fds_timeout, "checklist Timeout"); + CheckList(m_fds_retry, "checklist retry client connect"); + CheckList(m_fds_close, "checklist close and delete"); +} + +void SocketHandler::CheckList(socket_v& ref,const std::string& listname) +{ + for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) + { + SOCKET s = *it; + if (m_sockets.find(s) != m_sockets.end()) + continue; + if (m_add.find(s) != m_add.end()) + continue; + bool found = false; + for (std::list::iterator it = m_delete.begin(); it != m_delete.end(); it++) + { + Socket *p = *it; + if (p -> GetSocket() == s) + { + found = true; + break; + } + } + if (!found) + { + fprintf(stderr, "CheckList failed for \"%s\": fd %d\n", listname.c_str(), s); + } + } +} + +void SocketHandler::AddList(SOCKET s,list_t which_one,bool add) +{ + if (s == INVALID_SOCKET) + { +DEB( fprintf(stderr, "AddList: invalid_socket\n");) + return; + } + socket_v& ref = + (which_one == LIST_CALLONCONNECT) ? m_fds_callonconnect : +#ifdef ENABLE_DETACH + (which_one == LIST_DETACH) ? m_fds_detach : +#endif + (which_one == LIST_TIMEOUT) ? m_fds_timeout : + (which_one == LIST_RETRY) ? m_fds_retry : + (which_one == LIST_CLOSE) ? m_fds_close : m_fds_close; + if (add) + { +#ifdef ENABLE_DETACH +DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : + (which_one == LIST_DETACH) ? "Detach" : + (which_one == LIST_TIMEOUT) ? "Timeout" : + (which_one == LIST_RETRY) ? "Retry" : + (which_one == LIST_CLOSE) ? "Close" : "", + add ? "Add" : "Remove");) +#else +DEB( fprintf(stderr, "AddList; %5d: %s: %s\n", s, (which_one == LIST_CALLONCONNECT) ? "CallOnConnect" : + (which_one == LIST_TIMEOUT) ? "Timeout" : + (which_one == LIST_RETRY) ? "Retry" : + (which_one == LIST_CLOSE) ? "Close" : "", + add ? "Add" : "Remove");) +#endif + } + if (add) + { + for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) + { + if (*it == s) // already there + { + return; + } + } + ref.push_back(s); + return; + } + // remove + for (socket_v::iterator it = ref.begin(); it != ref.end(); it++) + { + if (*it == s) + { + ref.erase(it); + break; + } + } +//DEB( fprintf(stderr, "/AddList\n");) +} + +#ifdef ENABLE_TRIGGERS +int SocketHandler::TriggerID(Socket *src) +{ + int id = m_next_trigger_id++; + m_trigger_src[id] = src; + return id; +} + +bool SocketHandler::Subscribe(int id, Socket *dst) +{ + if (m_trigger_src.find(id) != m_trigger_src.end()) + { + std::map::iterator it = m_trigger_dst[id].find(dst); + if (it != m_trigger_dst[id].end()) + { + m_trigger_dst[id][dst] = true; + return true; + } + LogError(dst, "Subscribe", id, "Already subscribed", LOG_LEVEL_INFO); + return false; + } + LogError(dst, "Subscribe", id, "Trigger id not found", LOG_LEVEL_INFO); + return false; +} + +bool SocketHandler::Unsubscribe(int id, Socket *dst) +{ + if (m_trigger_src.find(id) != m_trigger_src.end()) + { + std::map::iterator it = m_trigger_dst[id].find(dst); + if (it != m_trigger_dst[id].end()) + { + m_trigger_dst[id].erase(it); + return true; + } + LogError(dst, "Unsubscribe", id, "Not subscribed", LOG_LEVEL_INFO); + return false; + } + LogError(dst, "Unsubscribe", id, "Trigger id not found", LOG_LEVEL_INFO); + return false; +} + +void SocketHandler::Trigger(int id, Socket::TriggerData& data, bool erase) +{ + if (m_trigger_src.find(id) != m_trigger_src.end()) + { + data.SetSource( m_trigger_src[id] ); + for (std::map::iterator it = m_trigger_dst[id].begin(); it != m_trigger_dst[id].end(); it++) + { + Socket *dst = it -> first; + if (Valid(dst)) + { + dst -> OnTrigger(id, data); + } + } + if (erase) + { + m_trigger_src.erase(m_trigger_src.find(id)); + m_trigger_dst.erase(m_trigger_dst.find(id)); + } + } + else + { + LogError(NULL, "Trigger", id, "Trigger id not found", LOG_LEVEL_INFO); + } +} +#endif // ENABLE_TRIGGERS + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/StdoutLog.cpp b/externals/sockets/StdoutLog.cpp new file mode 100644 index 0000000..e745a6d --- /dev/null +++ b/externals/sockets/StdoutLog.cpp @@ -0,0 +1,98 @@ +/** \file StdoutLog.cpp + ** \date 2004-06-01 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include + +#ifdef _MSC_VER +#pragma warning(disable:4786) +#endif + +#include + +#include "ISocketHandler.h" +#include "Socket.h" +#include "StdoutLog.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + + +void StdoutLog::error(ISocketHandler *,Socket *sock,const std::string& call,int err,const std::string& sys_err,loglevel_t lvl) +{ + time_t t = time(NULL); + struct tm tp; +#ifdef _WIN32 + memcpy(&tp, localtime(&t), sizeof(tp)); +#else + localtime_r(&t, &tp); +#endif + std::string level; + + switch (lvl) + { + case LOG_LEVEL_WARNING: + level = "Warning"; + break; + case LOG_LEVEL_ERROR: + level = "Error"; + break; + case LOG_LEVEL_FATAL: + level = "Fatal"; + break; + case LOG_LEVEL_INFO: + level = "Info"; + break; + } + if (sock) + { + printf("%d-%02d-%02d %02d:%02d:%02d :: fd %d :: %s: %d %s (%s)\n", + tp.tm_year + 1900, + tp.tm_mon + 1, + tp.tm_mday, + tp.tm_hour,tp.tm_min,tp.tm_sec, + sock -> GetSocket(), + call.c_str(),err,sys_err.c_str(),level.c_str()); + } + else + { + printf("%d-%02d-%02d %02d:%02d:%02d :: %s: %d %s (%s)\n", + tp.tm_year + 1900, + tp.tm_mon + 1, + tp.tm_mday, + tp.tm_hour,tp.tm_min,tp.tm_sec, + call.c_str(),err,sys_err.c_str(),level.c_str()); + } +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/StreamSocket.cpp b/externals/sockets/StreamSocket.cpp new file mode 100644 index 0000000..009abad --- /dev/null +++ b/externals/sockets/StreamSocket.cpp @@ -0,0 +1,145 @@ +#include "StreamSocket.h" +#include "ISocketHandler.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +StreamSocket::StreamSocket(ISocketHandler& h) : Socket(h) +,m_bConnecting(false) +,m_connect_timeout(5) +,m_flush_before_close(true) +,m_connection_retry(0) +,m_retries(0) +,m_call_on_connect(false) +,m_b_retry_connect(false) +,m_line_protocol(false) +,m_shutdown(0) +{ +} + +StreamSocket::~StreamSocket() +{ +} + +void StreamSocket::SetConnecting(bool x) +{ + if (x != m_bConnecting) + { + m_bConnecting = x; + if (x) + { + SetTimeout( GetConnectTimeout() ); + } + else + { + SetTimeout( 0 ); + } + } +} + +bool StreamSocket::Connecting() +{ + return m_bConnecting; +} + +bool StreamSocket::Ready() +{ + if (GetSocket() != INVALID_SOCKET && !Connecting() && !CloseAndDelete()) + return true; + return false; +} + +void StreamSocket::SetConnectTimeout(int x) +{ + m_connect_timeout = x; +} + +int StreamSocket::GetConnectTimeout() +{ + return m_connect_timeout; +} + +void StreamSocket::SetFlushBeforeClose(bool x) +{ + m_flush_before_close = x; +} + +bool StreamSocket::GetFlushBeforeClose() +{ + return m_flush_before_close; +} + +int StreamSocket::GetConnectionRetry() +{ + return m_connection_retry; +} + +void StreamSocket::SetConnectionRetry(int x) +{ + m_connection_retry = x; +} + +int StreamSocket::GetConnectionRetries() +{ + return m_retries; +} + +void StreamSocket::IncreaseConnectionRetries() +{ + m_retries++; +} + +void StreamSocket::ResetConnectionRetries() +{ + m_retries = 0; +} + +void StreamSocket::SetCallOnConnect(bool x) +{ + Handler().AddList(GetSocket(), LIST_CALLONCONNECT, x); + m_call_on_connect = x; +} + +bool StreamSocket::CallOnConnect() +{ + return m_call_on_connect; +} + +void StreamSocket::SetRetryClientConnect(bool x) +{ + Handler().AddList(GetSocket(), LIST_RETRY, x); + m_b_retry_connect = x; +} + +bool StreamSocket::RetryClientConnect() +{ + return m_b_retry_connect; +} + +void StreamSocket::SetLineProtocol(bool x) +{ + m_line_protocol = x; +} + +bool StreamSocket::LineProtocol() +{ + return m_line_protocol; +} + +void StreamSocket::SetShutdown(int x) +{ + m_shutdown = x; +} + +int StreamSocket::GetShutdown() +{ + return m_shutdown; +} + + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif + + diff --git a/externals/sockets/TcpSocket.cpp b/externals/sockets/TcpSocket.cpp new file mode 100644 index 0000000..5f067b5 --- /dev/null +++ b/externals/sockets/TcpSocket.cpp @@ -0,0 +1,1681 @@ +/** \file TcpSocket.cpp + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifdef _WIN32 +#ifdef _MSC_VER +#pragma warning(disable:4786) +#endif +#include +#else +#include +#endif +#include "ISocketHandler.h" +#include +#include +#include +#include +#ifdef HAVE_OPENSSL +#include +#include +#endif +#include +#include + +#include "TcpSocket.h" +#include "Utility.h" +#include "Ipv4Address.h" +#include "Ipv6Address.h" +#include "Mutex.h" +#include "IFile.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +//#ifdef _DEBUG +//#define DEB(x) x +//#else +#define DEB(x) +//#endif + +// statics +#ifdef HAVE_OPENSSL +SSLInitializer TcpSocket::m_ssl_init; +#endif + +// thanks, q +#ifdef _MSC_VER +#pragma warning(disable:4355) +#endif +TcpSocket::TcpSocket(ISocketHandler& h) : StreamSocket(h) +,ibuf(TCP_BUFSIZE_READ) +,m_b_input_buffer_disabled(false) +,m_bytes_sent(0) +,m_bytes_received(0) +,m_skip_c(false) +#ifdef SOCKETS_DYNAMIC_TEMP +,m_buf(new char[TCP_BUFSIZE_READ + 1]) +#endif +,m_obuf_top(NULL) +,m_transfer_limit(0) +,m_output_length(0) +#ifdef HAVE_OPENSSL +,m_ssl_ctx(NULL) +,m_ssl(NULL) +,m_sbio(NULL) +#endif +#ifdef ENABLE_SOCKS4 +,m_socks4_state(0) +#endif +#ifdef ENABLE_RESOLVER +,m_resolver_id(0) +#endif +#ifdef ENABLE_RECONNECT +,m_b_reconnect(false) +,m_b_is_reconnect(false) +#endif +{ +} +#ifdef _MSC_VER +#pragma warning(default:4355) +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4355) +#endif +TcpSocket::TcpSocket(ISocketHandler& h,size_t isize,size_t osize) : StreamSocket(h) +,ibuf(isize) +,m_b_input_buffer_disabled(false) +,m_bytes_sent(0) +,m_bytes_received(0) +,m_skip_c(false) +#ifdef SOCKETS_DYNAMIC_TEMP +,m_buf(new char[TCP_BUFSIZE_READ + 1]) +#endif +,m_obuf_top(NULL) +,m_transfer_limit(0) +,m_output_length(0) +#ifdef HAVE_OPENSSL +,m_ssl_ctx(NULL) +,m_ssl(NULL) +,m_sbio(NULL) +#endif +#ifdef ENABLE_SOCKS4 +,m_socks4_state(0) +#endif +#ifdef ENABLE_RESOLVER +,m_resolver_id(0) +#endif +#ifdef ENABLE_RECONNECT +,m_b_reconnect(false) +,m_b_is_reconnect(false) +#endif +{ +} +#ifdef _MSC_VER +#pragma warning(default:4355) +#endif + +TcpSocket::~TcpSocket() +{ +#ifdef SOCKETS_DYNAMIC_TEMP + delete[] m_buf; +#endif + // %! empty m_obuf + while (m_obuf.size()) + { + output_l::iterator it = m_obuf.begin(); + OUTPUT *p = *it; + delete p; + m_obuf.erase(it); + } +#ifdef HAVE_OPENSSL + if (m_ssl) + { + SSL_free(m_ssl); + } +#endif +} + +bool TcpSocket::Open(ipaddr_t ip,port_t port,bool skip_socks) +{ + Ipv4Address ad(ip, port); + Ipv4Address local; + return Open(ad, local, skip_socks); +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +bool TcpSocket::Open(in6_addr ip,port_t port,bool skip_socks) +{ + Ipv6Address ad(ip, port); + return Open(ad, skip_socks); +} +#endif +#endif + +bool TcpSocket::Open(SocketAddress& ad,bool skip_socks) +{ + Ipv4Address bind_ad("0.0.0.0", 0); + return Open(ad, bind_ad, skip_socks); +} + +bool TcpSocket::Open(SocketAddress& ad,SocketAddress& bind_ad,bool skip_socks) +{ + if (!ad.IsValid()) + { + Handler().LogError(this, "Open", 0, "Invalid SocketAddress", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + return false; + } + if (Handler().GetCount() >= FD_SETSIZE) + { + Handler().LogError(this, "Open", 0, "no space left in fd_set", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + return false; + } + SetConnecting(false); +#ifdef ENABLE_SOCKS4 + SetSocks4(false); +#endif + // check for pooling +#ifdef ENABLE_POOL + if (Handler().PoolEnabled()) + { + ISocketHandler::PoolSocket *pools = Handler().FindConnection(SOCK_STREAM, "tcp", ad); + if (pools) + { + CopyConnection( pools ); + delete pools; + + SetIsClient(); + SetCallOnConnect(); // ISocketHandler must call OnConnect + Handler().LogError(this, "SetCallOnConnect", 0, "Found pooled connection", LOG_LEVEL_INFO); + return true; + } + } +#endif + // if not, create new connection + SOCKET s = CreateSocket(ad.GetFamily(), SOCK_STREAM, "tcp"); + if (s == INVALID_SOCKET) + { + return false; + } + // socket must be nonblocking for async connect + if (!SetNonblocking(true, s)) + { + SetCloseAndDelete(); + closesocket(s); + return false; + } +#ifdef ENABLE_POOL + SetIsClient(); // client because we connect +#endif + SetClientRemoteAddress(ad); + int n = 0; + if (bind_ad.GetPort() != 0) + { + bind(s, bind_ad, bind_ad); + } +#ifdef ENABLE_SOCKS4 + if (!skip_socks && GetSocks4Host() && GetSocks4Port()) + { + Ipv4Address sa(GetSocks4Host(), GetSocks4Port()); + { + std::string sockshost; + Utility::l2ip(GetSocks4Host(), sockshost); + Handler().LogError(this, "Open", 0, "Connecting to socks4 server @ " + sockshost + ":" + + Utility::l2string(GetSocks4Port()), LOG_LEVEL_INFO); + } + SetSocks4(); + n = connect(s, sa, sa); + SetRemoteAddress(sa); + } + else +#endif + { + n = connect(s, ad, ad); + SetRemoteAddress(ad); + } + if (n == -1) + { + // check error code that means a connect is in progress +#ifdef _WIN32 + if (Errno == WSAEWOULDBLOCK) +#else + if (Errno == EINPROGRESS) +#endif + { + Attach(s); + SetConnecting( true ); // this flag will control fd_set's + } + else +#ifdef ENABLE_SOCKS4 + if (Socks4() && Handler().Socks4TryDirect() ) // retry + { + closesocket(s); + return Open(ad, true); + } + else +#endif +#ifdef ENABLE_RECONNECT + if (Reconnect()) + { + Handler().LogError(this, "connect: failed, reconnect pending", Errno, StrError(Errno), LOG_LEVEL_INFO); + Attach(s); + SetConnecting( true ); // this flag will control fd_set's + } + else +#endif + { + Handler().LogError(this, "connect: failed", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); + closesocket(s); + return false; + } + } + else + { + Attach(s); + SetCallOnConnect(); // ISocketHandler must call OnConnect + } + + // 'true' means connected or connecting(not yet connected) + // 'false' means something failed + return true; //!Connecting(); +} + +bool TcpSocket::Open(const std::string &host,port_t port) +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { +#ifdef ENABLE_RESOLVER + if (!Handler().ResolverEnabled() || Utility::isipv6(host) ) + { +#endif + in6_addr a; + if (!Utility::u2ip(host, a)) + { + SetCloseAndDelete(); + return false; + } + Ipv6Address ad(a, port); + Ipv6Address local; + return Open(ad, local); +#ifdef ENABLE_RESOLVER + } + m_resolver_id = Resolve6(host, port); + return true; +#endif + } +#endif +#endif +#ifdef ENABLE_RESOLVER + if (!Handler().ResolverEnabled() || Utility::isipv4(host) ) + { +#endif + ipaddr_t l; + if (!Utility::u2ip(host,l)) + { + SetCloseAndDelete(); + return false; + } + Ipv4Address ad(l, port); + Ipv4Address local; + return Open(ad, local); +#ifdef ENABLE_RESOLVER + } + // resolve using async resolver thread + m_resolver_id = Resolve(host, port); + return true; +#endif +} + +#ifdef ENABLE_RESOLVER +void TcpSocket::OnResolved(int id,ipaddr_t a,port_t port) +{ +DEB( fprintf(stderr, "TcpSocket::OnResolved id %d addr %x port %d\n", id, a, port);) + if (id == m_resolver_id) + { + if (a && port) + { + Ipv4Address ad(a, port); + Ipv4Address local; + if (Open(ad, local)) + { + if (!Handler().Valid(this)) + { + Handler().Add(this); + } + } + } + else + { + Handler().LogError(this, "OnResolved", 0, "Resolver failed", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } + } + else + { + Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } +} + +#ifdef ENABLE_IPV6 +void TcpSocket::OnResolved(int id,in6_addr& a,port_t port) +{ + if (id == m_resolver_id) + { + Ipv6Address ad(a, port); + if (ad.IsValid()) + { + Ipv6Address local; + if (Open(ad, local)) + { + if (!Handler().Valid(this)) + { + Handler().Add(this); + } + } + } + } + else + { + Handler().LogError(this, "OnResolved", id, "Resolver returned wrong job id", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } +} +#endif +#endif + +void TcpSocket::OnRead() +{ + int n = 0; +#ifdef SOCKETS_DYNAMIC_TEMP + char *buf = m_buf; +#else + char buf[TCP_BUFSIZE_READ]; +#endif +#ifdef HAVE_OPENSSL + if (IsSSL()) + { + if (!Ready()) + return; + n = SSL_read(m_ssl, buf, TCP_BUFSIZE_READ); + if (n == -1) + { + n = SSL_get_error(m_ssl, n); + switch (n) + { + case SSL_ERROR_NONE: + case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_WRITE: + break; + case SSL_ERROR_ZERO_RETURN: +DEB( fprintf(stderr, "SSL_read() returns zero - closing socket\n");) + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + break; + default: +DEB( fprintf(stderr, "SSL read problem, errcode = %d\n",n);) + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + } + return; + } + else + if (!n) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + SetShutdown(SHUT_WR); + return; + } + else + if (n > 0 && n <= TCP_BUFSIZE_READ) + { + m_bytes_received += n; + if (GetTrafficMonitor()) + { + GetTrafficMonitor() -> fwrite(buf, 1, n); + } + if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) + { + Handler().LogError(this, "OnRead(ssl)", 0, "ibuf overflow", LOG_LEVEL_WARNING); + } + } + else + { + Handler().LogError(this, "OnRead(ssl)", n, "abnormal value from SSL_read", LOG_LEVEL_ERROR); + } + } + else +#endif // HAVE_OPENSSL + { + n = recv(GetSocket(), buf, TCP_BUFSIZE_READ, MSG_NOSIGNAL); + if (n == -1) + { + Handler().LogError(this, "read", Errno, StrError(Errno), LOG_LEVEL_FATAL); + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + return; + } + else + if (!n) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + SetShutdown(SHUT_WR); + return; + } + else + if (n > 0 && n <= TCP_BUFSIZE_READ) + { + m_bytes_received += n; + if (GetTrafficMonitor()) + { + GetTrafficMonitor() -> fwrite(buf, 1, n); + } + if (!m_b_input_buffer_disabled && !ibuf.Write(buf,n)) + { + Handler().LogError(this, "OnRead", 0, "ibuf overflow", LOG_LEVEL_WARNING); + } + } + else + { + Handler().LogError(this, "OnRead", n, "abnormal value from recv", LOG_LEVEL_ERROR); + } + } + // + OnRead( buf, n ); +} + +void TcpSocket::OnRead( char *buf, size_t n ) +{ + // unbuffered + if (n > 0 && n <= TCP_BUFSIZE_READ) + { + if (LineProtocol()) + { + buf[n] = 0; + size_t i = 0; + if (m_skip_c && (buf[i] == 13 || buf[i] == 10) && buf[i] != m_c) + { + m_skip_c = false; + i++; + } + size_t x = i; + for (; i < n && LineProtocol(); i++) + { + while ((buf[i] == 13 || buf[i] == 10) && LineProtocol()) + { + char c = buf[i]; + buf[i] = 0; + if (buf[x]) + { + m_line += (buf + x); + } + OnLine( m_line ); + i++; + m_skip_c = true; + m_c = c; + if (i < n && (buf[i] == 13 || buf[i] == 10) && buf[i] != c) + { + m_skip_c = false; + i++; + } + x = i; + m_line = ""; + } + if (!LineProtocol()) + { + break; + } + } + if (!LineProtocol()) + { + if (i < n) + { + OnRawData(buf + i, n - i); + } + } + else + if (buf[x]) + { + m_line += (buf + x); + } + } + else + { + OnRawData(buf, n); + } + } + if (m_b_input_buffer_disabled) + { + return; + } + // further processing: socks4 +#ifdef ENABLE_SOCKS4 + if (Socks4()) + { + bool need_more = false; + while (GetInputLength() && !need_more && !CloseAndDelete()) + { + need_more = OnSocks4Read(); + } + } +#endif +} + +void TcpSocket::OnWriteComplete() +{ +} + +void TcpSocket::OnWrite() +{ + if (Connecting()) + { + int err = SoError(); + + // don't reset connecting flag on error here, we want the OnConnectFailed timeout later on + if (!err) // ok + { + Set(!IsDisableRead(), false); + SetConnecting(false); + SetCallOnConnect(); + return; + } + Handler().LogError(this, "tcp: connect failed", err, StrError(err), LOG_LEVEL_FATAL); + Set(false, false); // no more monitoring because connection failed + + // failed +#ifdef ENABLE_SOCKS4 + if (Socks4()) + { + // %! leave 'Connecting' flag set? + OnSocks4ConnectFailed(); + return; + } +#endif + if (GetConnectionRetry() == -1 || + (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) + { + // even though the connection failed at once, only retry after + // the connection timeout. + // should we even try to connect again, when CheckConnect returns + // false it's because of a connection error - not a timeout... + return; + } + SetConnecting(false); + SetCloseAndDelete( true ); + /// \todo state reason why connect failed + OnConnectFailed(); + return; + } + // try send next block in buffer + // if full block is sent, repeat + // if all blocks are sent, reset m_wfds + + bool repeat = false; + size_t sz = m_transfer_limit ? GetOutputLength() : 0; + do + { + output_l::iterator it = m_obuf.begin(); + OUTPUT *p = *it; + repeat = false; + int n = TryWrite(p -> Buf(), p -> Len()); + if (n > 0) + { + size_t left = p -> Remove(n); + m_output_length -= n; + if (!left) + { + delete p; + m_obuf.erase(it); + if (!m_obuf.size()) + { + m_obuf_top = NULL; + OnWriteComplete(); + } + else + { + repeat = true; + } + } + } + } while (repeat); + + if (m_transfer_limit && sz > m_transfer_limit && GetOutputLength() < m_transfer_limit) + { + OnTransferLimit(); + } + + // check output buffer set, set/reset m_wfds accordingly + { + bool br; + bool bw; + bool bx; + Handler().Get(GetSocket(), br, bw, bx); + if (m_obuf.size()) + Set(br, true); + else + Set(br, false); + } +} + +int TcpSocket::TryWrite(const char *buf, size_t len) +{ + int n = 0; +#ifdef HAVE_OPENSSL + if (IsSSL()) + { + n = SSL_write(m_ssl, buf, (int)len); + if (n == -1) + { + int errnr = SSL_get_error(m_ssl, n); + if ( errnr != SSL_ERROR_WANT_READ && errnr != SSL_ERROR_WANT_WRITE ) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + const char *errbuf = ERR_error_string(errnr, NULL); + Handler().LogError(this, "OnWrite/SSL_write", errnr, errbuf, LOG_LEVEL_FATAL); + } + return 0; + } + else + if (!n) + { + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); +DEB( int errnr = SSL_get_error(m_ssl, n); + const char *errbuf = ERR_error_string(errnr, NULL); + fprintf(stderr, "SSL_write() returns 0: %d : %s\n",errnr, errbuf);) + } + } + else +#endif // HAVE_OPENSSL + { + n = send(GetSocket(), buf, (int)len, MSG_NOSIGNAL); + if (n == -1) + { + // normal error codes: + // WSAEWOULDBLOCK + // EAGAIN or EWOULDBLOCK +#ifdef _WIN32 + if (Errno != WSAEWOULDBLOCK) +#else + if (Errno != EWOULDBLOCK) +#endif + { + Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_FATAL); + OnDisconnect(); + SetCloseAndDelete(true); + SetFlushBeforeClose(false); + SetLost(); + } + return 0; + } + } + if (n > 0) + { + m_bytes_sent += n; + if (GetTrafficMonitor()) + { + GetTrafficMonitor() -> fwrite(buf, 1, n); + } + } + return n; +} + +void TcpSocket::Buffer(const char *buf, size_t len) +{ + size_t ptr = 0; + m_output_length += len; + while (ptr < len) + { + // buf/len => pbuf/sz + size_t space = 0; + if (m_obuf_top && (space = m_obuf_top -> Space()) > 0) + { + const char *pbuf = buf + ptr; + size_t sz = len - ptr; + if (space >= sz) + { + m_obuf_top -> Add(pbuf, sz); + ptr += sz; + } + else + { + m_obuf_top -> Add(pbuf, space); + ptr += space; + } + } + else + { + m_obuf_top = new OUTPUT; + m_obuf.push_back( m_obuf_top ); + } + } +} + +void TcpSocket::Send(const std::string &str,int i) +{ + SendBuf(str.c_str(),str.size(),i); +} + +void TcpSocket::SendBuf(const char *buf,size_t len,int) +{ + if (!Ready() && !Connecting()) + { + Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-ready socket" ); // warning + if (GetSocket() == INVALID_SOCKET) + Handler().LogError(this, "SendBuf", 0, " * GetSocket() == INVALID_SOCKET", LOG_LEVEL_INFO); + if (Connecting()) + Handler().LogError(this, "SendBuf", 0, " * Connecting()", LOG_LEVEL_INFO); + if (CloseAndDelete()) + Handler().LogError(this, "SendBuf", 0, " * CloseAndDelete()", LOG_LEVEL_INFO); + return; + } + if (!IsConnected()) + { + Handler().LogError(this, "SendBuf", -1, "Attempt to write to a non-connected socket, will be sent on connect" ); // warning + Buffer(buf, len); + return; + } + if (m_obuf_top) + { + Buffer(buf, len); + return; + } + int n = TryWrite(buf, len); + if (n >= 0 && n < (int)len) + { + Buffer(buf + n, len - n); + } + // if ( data in buffer || !IsConnected ) + // { + // add to buffer + // } + // else + // try_send + // if any data is unsent, buffer it and set m_wfds + + // check output buffer set, set/reset m_wfds accordingly + { + bool br; + bool bw; + bool bx; + Handler().Get(GetSocket(), br, bw, bx); + if (m_obuf.size()) + Set(br, true); + else + Set(br, false); + } +} + +void TcpSocket::OnLine(const std::string& ) +{ +} + +#ifdef _MSC_VER +#pragma warning(disable:4355) +#endif +TcpSocket::TcpSocket(const TcpSocket& s) +:StreamSocket(s) +,ibuf(0) +{ +} +#ifdef _MSC_VER +#pragma warning(default:4355) +#endif + +#ifdef ENABLE_SOCKS4 +void TcpSocket::OnSocks4Connect() +{ + char request[1000]; + memset(request, 0, sizeof(request)); + request[0] = 4; // socks v4 + request[1] = 1; // command code: CONNECT + { + std::auto_ptr ad = GetClientRemoteAddress(); + if (ad.get()) + { + struct sockaddr *p0 = (struct sockaddr *)*ad; + struct sockaddr_in *p = (struct sockaddr_in *)p0; + if (p -> sin_family == AF_INET) + { + memcpy(request + 2, &p -> sin_port, 2); // nwbo is ok here + memcpy(request + 4, &p -> sin_addr, sizeof(struct in_addr)); + } + else + { + /// \todo warn + } + } + else + { + /// \todo warn + } + } + strcpy(request + 8, GetSocks4Userid().c_str()); + size_t length = GetSocks4Userid().size() + 8 + 1; + SendBuf(request, length); + m_socks4_state = 0; +} + +void TcpSocket::OnSocks4ConnectFailed() +{ + Handler().LogError(this,"OnSocks4ConnectFailed",0,"connection to socks4 server failed, trying direct connection",LOG_LEVEL_WARNING); + if (!Handler().Socks4TryDirect()) + { + SetConnecting(false); + SetCloseAndDelete(); + OnConnectFailed(); // just in case + } + else + { + SetRetryClientConnect(); + } +} + +bool TcpSocket::OnSocks4Read() +{ + switch (m_socks4_state) + { + case 0: + ibuf.Read(&m_socks4_vn, 1); + m_socks4_state = 1; + break; + case 1: + ibuf.Read(&m_socks4_cd, 1); + m_socks4_state = 2; + break; + case 2: + if (GetInputLength() > 1) + { + ibuf.Read( (char *)&m_socks4_dstport, 2); + m_socks4_state = 3; + } + else + { + return true; + } + break; + case 3: + if (GetInputLength() > 3) + { + ibuf.Read( (char *)&m_socks4_dstip, 4); + SetSocks4(false); + + switch (m_socks4_cd) + { + case 90: + OnConnect(); + Handler().LogError(this, "OnSocks4Read", 0, "Connection established", LOG_LEVEL_INFO); + break; + case 91: + case 92: + case 93: + Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server reports connect failed",LOG_LEVEL_FATAL); + SetConnecting(false); + SetCloseAndDelete(); + OnConnectFailed(); + break; + default: + Handler().LogError(this,"OnSocks4Read",m_socks4_cd,"socks4 server unrecognized response",LOG_LEVEL_FATAL); + SetCloseAndDelete(); + break; + } + } + else + { + return true; + } + break; + } + return false; +} +#endif + +void TcpSocket::Sendf(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + char slask[5000]; // vsprintf / vsnprintf temporary +#ifdef _WIN32 + vsprintf(slask, format, ap); +#else + vsnprintf(slask, 5000, format, ap); +#endif + va_end(ap); + Send( slask ); +} + +#ifdef HAVE_OPENSSL +void TcpSocket::OnSSLConnect() +{ + SetNonblocking(true); + { + if (m_ssl_ctx) + { +DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) + SetCloseAndDelete(true); + return; + } + InitSSLClient(); + } + if (m_ssl_ctx) + { + /* Connect the SSL socket */ + m_ssl = SSL_new(m_ssl_ctx); + if (!m_ssl) + { +DEB( fprintf(stderr, " m_ssl is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); + m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); + if (!m_sbio) + { +DEB( fprintf(stderr, " m_sbio is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_bio(m_ssl, m_sbio, m_sbio); + if (!SSLNegotiate()) + { + SetSSLNegotiate(); + } + } + else + { + SetCloseAndDelete(); + } +} + +void TcpSocket::OnSSLAccept() +{ + SetNonblocking(true); + { + if (m_ssl_ctx) + { +DEB( fprintf(stderr, "SSL Context already initialized - closing socket\n");) + SetCloseAndDelete(true); + return; + } + InitSSLServer(); + SetSSLServer(); + } + if (m_ssl_ctx) + { + m_ssl = SSL_new(m_ssl_ctx); + if (!m_ssl) + { +DEB( fprintf(stderr, " m_ssl is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY); + m_sbio = BIO_new_socket((int)GetSocket(), BIO_NOCLOSE); + if (!m_sbio) + { +DEB( fprintf(stderr, " m_sbio is NULL\n");) + SetCloseAndDelete(true); + return; + } + SSL_set_bio(m_ssl, m_sbio, m_sbio); +// if (!SSLNegotiate()) + { + SetSSLNegotiate(); + } + } +} + +bool TcpSocket::SSLNegotiate() +{ + if (!IsSSLServer()) // client + { + int r = SSL_connect(m_ssl); + if (r > 0) + { + SetSSLNegotiate(false); + /// \todo: resurrect certificate check... client +// CheckCertificateChain( "");//ServerHOST); + SetNonblocking(false); + // + { + SetConnected(); + if (GetOutputLength()) + { + OnWrite(); + } + } +#ifdef ENABLE_RECONNECT + if (IsReconnect()) + OnReconnect(); + else +#endif + { + OnConnect(); + } + Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection established", LOG_LEVEL_INFO); + return true; + } + else + if (!r) + { + Handler().LogError(this, "SSLNegotiate/SSL_connect", 0, "Connection failed", LOG_LEVEL_INFO); + SetSSLNegotiate(false); + SetCloseAndDelete(); + OnSSLConnectFailed(); + } + else + { + r = SSL_get_error(m_ssl, r); + if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) + { + Handler().LogError(this, "SSLNegotiate/SSL_connect", -1, "Connection failed", LOG_LEVEL_INFO); +DEB( fprintf(stderr, "SSL_connect() failed - closing socket, return code: %d\n",r);) + SetSSLNegotiate(false); + SetCloseAndDelete(true); + OnSSLConnectFailed(); + } + } + } + else // server + { + int r = SSL_accept(m_ssl); + if (r > 0) + { + SetSSLNegotiate(false); + /// \todo: resurrect certificate check... server +// CheckCertificateChain( "");//ClientHOST); + SetNonblocking(false); + // + { + SetConnected(); + if (GetOutputLength()) + { + OnWrite(); + } + } + OnAccept(); + Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection established", LOG_LEVEL_INFO); + return true; + } + else + if (!r) + { + Handler().LogError(this, "SSLNegotiate/SSL_accept", 0, "Connection failed", LOG_LEVEL_INFO); + SetSSLNegotiate(false); + SetCloseAndDelete(); + OnSSLAcceptFailed(); + } + else + { + r = SSL_get_error(m_ssl, r); + if (r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) + { + Handler().LogError(this, "SSLNegotiate/SSL_accept", -1, "Connection failed", LOG_LEVEL_INFO); +DEB( fprintf(stderr, "SSL_accept() failed - closing socket, return code: %d\n",r);) + SetSSLNegotiate(false); + SetCloseAndDelete(true); + OnSSLAcceptFailed(); + } + } + } + return false; +} + +void TcpSocket::InitSSLClient() +{ + InitializeContext("", SSLv23_method()); +} + +void TcpSocket::InitSSLServer() +{ + Handler().LogError(this, "InitSSLServer", 0, "You MUST implement your own InitSSLServer method", LOG_LEVEL_FATAL); + SetCloseAndDelete(); +} + +void TcpSocket::InitializeContext(const std::string& context, SSL_METHOD *meth_in) +{ + /* Create our context*/ + static std::map client_contexts; + if (client_contexts.find(context) == client_contexts.end()) + { + SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); + m_ssl_ctx = client_contexts[context] = SSL_CTX_new(meth); + SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); + } + else + { + m_ssl_ctx = client_contexts[context]; + } +} + +void TcpSocket::InitializeContext(const std::string& context,const std::string& keyfile,const std::string& password,SSL_METHOD *meth_in) +{ + /* Create our context*/ + static std::map server_contexts; + if (server_contexts.find(context) == server_contexts.end()) + { + SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); + m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); + SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); + // session id + if (!context.empty()) + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); + else + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); + } + else + { + m_ssl_ctx = server_contexts[context]; + } + + /* Load our keys and certificates*/ + if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); + } + + m_password = password; + SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); + SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); + if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); + } +} + +void TcpSocket::InitializeContext(const std::string& context,const std::string& certfile,const std::string& keyfile,const std::string& password,SSL_METHOD *meth_in) +{ + /* Create our context*/ + static std::map server_contexts; + if (server_contexts.find(context) == server_contexts.end()) + { + SSL_METHOD *meth = meth_in ? meth_in : SSLv3_method(); + m_ssl_ctx = server_contexts[context] = SSL_CTX_new(meth); + SSL_CTX_set_mode(m_ssl_ctx, SSL_MODE_AUTO_RETRY); + // session id + if (context.size()) + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)context.c_str(), (unsigned int)context.size()); + else + SSL_CTX_set_session_id_context(m_ssl_ctx, (const unsigned char *)"--empty--", 9); + } + else + { + m_ssl_ctx = server_contexts[context]; + } + + /* Load our keys and certificates*/ + if (!(SSL_CTX_use_certificate_file(m_ssl_ctx, certfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read certificate file " + keyfile, LOG_LEVEL_FATAL); + } + + m_password = password; + SSL_CTX_set_default_passwd_cb(m_ssl_ctx, SSL_password_cb); + SSL_CTX_set_default_passwd_cb_userdata(m_ssl_ctx, this); + if (!(SSL_CTX_use_PrivateKey_file(m_ssl_ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) + { + Handler().LogError(this, "TcpSocket InitializeContext", 0, "Couldn't read private key file " + keyfile, LOG_LEVEL_FATAL); + } +} + +int TcpSocket::SSL_password_cb(char *buf,int num,int rwflag,void *userdata) +{ + Socket *p0 = static_cast(userdata); + TcpSocket *p = dynamic_cast(p0); + std::string pw = p ? p -> GetPassword() : ""; + if ( (size_t)num < pw.size() + 1) + { + return 0; + } + strcpy(buf,pw.c_str()); + return (int)pw.size(); +} +#endif // HAVE_OPENSSL + +int TcpSocket::Close() +{ + if (GetSocket() == INVALID_SOCKET) // this could happen + { + Handler().LogError(this, "Socket::Close", 0, "file descriptor invalid", LOG_LEVEL_WARNING); + return 0; + } + int n; + SetNonblocking(true); + if (!Lost() && IsConnected() && !(GetShutdown() & SHUT_WR)) + { + if (shutdown(GetSocket(), SHUT_WR) == -1) + { + // failed... + Handler().LogError(this, "shutdown", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + } + // + char tmp[1000]; + if (!Lost() && (n = recv(GetSocket(),tmp,1000,0)) >= 0) + { + if (n) + { + Handler().LogError(this, "read() after shutdown", n, "bytes read", LOG_LEVEL_WARNING); + } + } +#ifdef HAVE_OPENSSL + if (IsSSL() && m_ssl) + SSL_shutdown(m_ssl); + if (m_ssl) + { + SSL_free(m_ssl); + m_ssl = NULL; + } +#endif + return Socket::Close(); +} + +#ifdef HAVE_OPENSSL +SSL_CTX *TcpSocket::GetSslContext() +{ + if (!m_ssl_ctx) + Handler().LogError(this, "GetSslContext", 0, "SSL Context is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); + return m_ssl_ctx; +} + +SSL *TcpSocket::GetSsl() +{ + if (!m_ssl) + Handler().LogError(this, "GetSsl", 0, "SSL is NULL; check InitSSLServer/InitSSLClient", LOG_LEVEL_WARNING); + return m_ssl; +} +#endif + +#ifdef ENABLE_RECONNECT +void TcpSocket::SetReconnect(bool x) +{ + m_b_reconnect = x; +} +#endif + +void TcpSocket::OnRawData(const char *buf_in,size_t len) +{ +} + +size_t TcpSocket::GetInputLength() +{ + return ibuf.GetLength(); +} + +size_t TcpSocket::GetOutputLength() +{ + return m_output_length; +} + +uint64_t TcpSocket::GetBytesReceived(bool clear) +{ + uint64_t z = m_bytes_received; + if (clear) + m_bytes_received = 0; + return z; +} + +uint64_t TcpSocket::GetBytesSent(bool clear) +{ + uint64_t z = m_bytes_sent; + if (clear) + m_bytes_sent = 0; + return z; +} + +#ifdef ENABLE_RECONNECT +bool TcpSocket::Reconnect() +{ + return m_b_reconnect; +} + +void TcpSocket::SetIsReconnect(bool x) +{ + m_b_is_reconnect = x; +} + +bool TcpSocket::IsReconnect() +{ + return m_b_is_reconnect; +} +#endif + +#ifdef HAVE_OPENSSL +const std::string& TcpSocket::GetPassword() +{ + return m_password; +} +#endif + +void TcpSocket::DisableInputBuffer(bool x) +{ + m_b_input_buffer_disabled = x; +} + +void TcpSocket::OnOptions(int family,int type,int protocol,SOCKET s) +{ +DEB( fprintf(stderr, "Socket::OnOptions()\n");) +#ifdef SO_NOSIGPIPE + SetSoNosigpipe(true); +#endif + SetSoReuseaddr(true); + SetSoKeepalive(true); +} + +void TcpSocket::SetLineProtocol(bool x) +{ + StreamSocket::SetLineProtocol(x); + DisableInputBuffer(x); +} + +bool TcpSocket::SetTcpNodelay(bool x) +{ +#ifdef TCP_NODELAY + int optval = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_TCP, TCP_NODELAY, (char *)&optval, sizeof(optval)) == -1) + { + Handler().LogError(this, "setsockopt(IPPROTO_TCP, TCP_NODELAY)", Errno, StrError(Errno), LOG_LEVEL_FATAL); + return false; + } + return true; +#else + Handler().LogError(this, "socket option not available", 0, "TCP_NODELAY", LOG_LEVEL_INFO); + return false; +#endif +} + +TcpSocket::CircularBuffer::CircularBuffer(size_t size) +:buf(new char[2 * size]) +,m_max(size) +,m_q(0) +,m_b(0) +,m_t(0) +,m_count(0) +{ +} + +TcpSocket::CircularBuffer::~CircularBuffer() +{ + delete[] buf; +} + +bool TcpSocket::CircularBuffer::Write(const char *s,size_t l) +{ + if (m_q + l > m_max) + { + return false; // overflow + } + m_count += (unsigned long)l; + if (m_t + l > m_max) // block crosses circular border + { + size_t l1 = m_max - m_t; // size left until circular border crossing + // always copy full block to buffer(buf) + top pointer(m_t) + // because we have doubled the buffer size for performance reasons + memcpy(buf + m_t, s, l); + memcpy(buf, s + l1, l - l1); + m_t = l - l1; + m_q += l; + } + else + { + memcpy(buf + m_t, s, l); + memcpy(buf + m_max + m_t, s, l); + m_t += l; + if (m_t >= m_max) + m_t -= m_max; + m_q += l; + } + return true; +} + +bool TcpSocket::CircularBuffer::Read(char *s,size_t l) +{ + if (l > m_q) + { + return false; // not enough chars + } + if (m_b + l > m_max) // block crosses circular border + { + size_t l1 = m_max - m_b; + if (s) + { + memcpy(s, buf + m_b, l1); + memcpy(s + l1, buf, l - l1); + } + m_b = l - l1; + m_q -= l; + } + else + { + if (s) + { + memcpy(s, buf + m_b, l); + } + m_b += l; + if (m_b >= m_max) + m_b -= m_max; + m_q -= l; + } + if (!m_q) + { + m_b = m_t = 0; + } + return true; +} + +bool TcpSocket::CircularBuffer::SoftRead(char *s, size_t l) +{ + if (l > m_q) + { + return false; + } + if (m_b + l > m_max) // block crosses circular border + { + size_t l1 = m_max - m_b; + if (s) + { + memcpy(s, buf + m_b, l1); + memcpy(s + l1, buf, l - l1); + } + } + else + { + if (s) + { + memcpy(s, buf + m_b, l); + } + } + return true; +} + +bool TcpSocket::CircularBuffer::Remove(size_t l) +{ + return Read(NULL, l); +} + +size_t TcpSocket::CircularBuffer::GetLength() +{ + return m_q; +} + +const char *TcpSocket::CircularBuffer::GetStart() +{ + return buf + m_b; +} + +size_t TcpSocket::CircularBuffer::GetL() +{ + return (m_b + m_q > m_max) ? m_max - m_b : m_q; +} + +size_t TcpSocket::CircularBuffer::Space() +{ + return m_max - m_q; +} + +unsigned long TcpSocket::CircularBuffer::ByteCounter(bool clear) +{ + if (clear) + { + unsigned long x = m_count; + m_count = 0; + return x; + } + return m_count; +} + +std::string TcpSocket::CircularBuffer::ReadString(size_t l) +{ + char *sz = new char[l + 1]; + if (!Read(sz, l)) // failed, debug printout in Read() method + { + delete[] sz; + return ""; + } + sz[l] = 0; + std::string tmp = sz; + delete[] sz; + return tmp; +} + +void TcpSocket::OnConnectTimeout() +{ + Handler().LogError(this, "connect", -1, "connect timeout", LOG_LEVEL_FATAL); +#ifdef ENABLE_SOCKS4 + if (Socks4()) + { + OnSocks4ConnectFailed(); + // retry direct connection + } + else +#endif + if (GetConnectionRetry() == -1 || + (GetConnectionRetry() && GetConnectionRetries() < GetConnectionRetry()) ) + { + IncreaseConnectionRetries(); + // ask socket via OnConnectRetry callback if we should continue trying + if (OnConnectRetry()) + { + SetRetryClientConnect(); + } + else + { + SetCloseAndDelete( true ); + /// \todo state reason why connect failed + OnConnectFailed(); + } + } + else + { + SetCloseAndDelete(true); + /// \todo state reason why connect failed + OnConnectFailed(); + } + // + SetConnecting(false); +} + +#ifdef _WIN32 +void TcpSocket::OnException() +{ + if (Connecting()) + { +#ifdef ENABLE_SOCKS4 + if (Socks4()) + OnSocks4ConnectFailed(); + else +#endif + if (GetConnectionRetry() == -1 || + (GetConnectionRetry() && + GetConnectionRetries() < GetConnectionRetry() )) + { + // even though the connection failed at once, only retry after + // the connection timeout + // should we even try to connect again, when CheckConnect returns + // false it's because of a connection error - not a timeout... + } + else + { + SetConnecting(false); // tnx snibbe + SetCloseAndDelete(); + OnConnectFailed(); + } + return; + } + // %! exception doesn't always mean something bad happened, this code should be reworked + // errno valid here? + int err = SoError(); + Handler().LogError(this, "exception on select", err, StrError(err), LOG_LEVEL_FATAL); + SetCloseAndDelete(); +} +#endif // _WIN32 + +int TcpSocket::Protocol() +{ + return IPPROTO_TCP; +} + +void TcpSocket::SetTransferLimit(size_t sz) +{ + m_transfer_limit = sz; +} + +void TcpSocket::OnTransferLimit() +{ +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/Thread.cpp b/externals/sockets/Thread.cpp new file mode 100644 index 0000000..773e9f2 --- /dev/null +++ b/externals/sockets/Thread.cpp @@ -0,0 +1,154 @@ +/** \file Thread.cpp + ** \date 2004-10-30 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include +#ifdef _WIN32 +#include +#include "socket_include.h" +#else +#include +#endif + +#include "Thread.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +Thread::Thread(bool release) +:m_thread(0) +,m_running(true) +,m_release(false) +,m_b_delete_on_exit(false) +,m_b_destructor(false) +{ +#ifdef _WIN32 +// m_thread = ::CreateThread(NULL, 0, StartThread, this, 0, &m_dwThreadId); + m_thread = (HANDLE)_beginthreadex(NULL, 0, &StartThread, this, 0, &m_dwThreadId); +#else + pthread_attr_t attr; + + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); + if (pthread_create(&m_thread,&attr, StartThread,this) == -1) + { + perror("Thread: create failed"); + SetRunning(false); + } +// pthread_attr_destroy(&attr); +#endif + m_release = release; +} + +Thread::~Thread() +{ + m_b_destructor = true; + if (m_running) + { + SetRelease(true); + SetRunning(false); +#ifdef _WIN32 + Sleep(1000); +#else + sleep(1); +#endif + } +#ifdef _WIN32 + if (m_thread) + ::CloseHandle(m_thread); +#endif +} + +threadfunc_t STDPREFIX Thread::StartThread(threadparam_t zz) +{ + Thread *p = (Thread *)zz; + + while (p -> m_running && !p -> m_release) + { +#ifdef _WIN32 + Sleep(1000); +#else + sleep(1); +#endif + } + if (p -> m_running) + { + p -> Run(); + } + p -> SetRunning(false); // if return + if (p -> DeleteOnExit() && !p -> IsDestructor()) + { + delete p; + } +#ifdef _WIN32 + _endthreadex(0); +#endif + return (threadfunc_t)NULL; +} + +bool Thread::IsRunning() +{ + return m_running; +} + +void Thread::SetRunning(bool x) +{ + m_running = x; +} + +bool Thread::IsReleased() +{ + return m_release; +} + +void Thread::SetRelease(bool x) +{ + m_release = x; +} + +bool Thread::DeleteOnExit() +{ + return m_b_delete_on_exit; +} + +void Thread::SetDeleteOnExit(bool x) +{ + m_b_delete_on_exit = x; +} + +bool Thread::IsDestructor() +{ + return m_b_destructor; +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/UdpSocket.cpp b/externals/sockets/UdpSocket.cpp new file mode 100644 index 0000000..a3d393c --- /dev/null +++ b/externals/sockets/UdpSocket.cpp @@ -0,0 +1,810 @@ +/** \file UdpSocket.cpp + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifdef _WIN32 +#ifdef _MSC_VER +#pragma warning(disable:4786) +#endif +#include +#else +#include +#endif + +#include "ISocketHandler.h" +#include "UdpSocket.h" +#include "Utility.h" +#include "Ipv4Address.h" +#include "Ipv6Address.h" +#ifdef ENABLE_EXCEPTIONS +#include "Exception.h" +#endif +// include this to see strange sights +//#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +UdpSocket::UdpSocket(ISocketHandler& h, int ibufsz, bool ipv6, int retries) : Socket(h) +, m_ibuf(new char[ibufsz]) +, m_ibufsz(ibufsz) +, m_bind_ok(false) +, m_port(0) +, m_last_size_written(-1) +, m_retries(retries) +, m_b_read_ts(false) +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + SetIpv6(ipv6); +#endif +#endif +} + +UdpSocket::~UdpSocket() +{ + Close(); + delete[] m_ibuf; +} + +int UdpSocket::Bind(port_t &port, int range) +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(port); + return Bind(ad, range); + } +#endif +#endif + Ipv4Address ad(port); + return Bind(ad, range); +} + +int UdpSocket::Bind(const std::string& intf, port_t &port, int range) +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, range); + } + SetCloseAndDelete(); + return -1; + } +#endif +#endif + Ipv4Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, range); + } + SetCloseAndDelete(); + return -1; +} + +int UdpSocket::Bind(ipaddr_t a, port_t &port, int range) +{ + Ipv4Address ad(a, port); + return Bind(ad, range); +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +int UdpSocket::Bind(in6_addr a, port_t &port, int range) +{ + Ipv6Address ad(a, port); + return Bind(ad, range); +} +#endif +#endif + +int UdpSocket::Bind(SocketAddress& ad, int range) +{ + if (GetSocket() == INVALID_SOCKET) + { + Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); + } + if (GetSocket() != INVALID_SOCKET) + { + SetNonblocking(true); + int n = bind(GetSocket(), ad, ad); + int tries = range; + while (n == -1 && tries--) + { + ad.SetPort(ad.GetPort() + 1); + n = bind(GetSocket(), ad, ad); + } + if (n == -1) + { + Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); +#ifdef ENABLE_EXCEPTIONS + throw Exception("bind() failed for UdpSocket, port:range: " + Utility::l2string(ad.GetPort()) + ":" + Utility::l2string(range)); +#endif + return -1; + } + m_bind_ok = true; + m_port = ad.GetPort(); + return 0; + } + return -1; +} + +/** if you wish to use Send, first Open a connection */ +bool UdpSocket::Open(ipaddr_t l, port_t port) +{ + Ipv4Address ad(l, port); + return Open(ad); +} + +bool UdpSocket::Open(const std::string& host, port_t port) +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(host, port); + if (ad.IsValid()) + { + return Open(ad); + } + return false; + } +#endif +#endif + Ipv4Address ad(host, port); + if (ad.IsValid()) + { + return Open(ad); + } + return false; +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +bool UdpSocket::Open(struct in6_addr& a, port_t port) +{ + Ipv6Address ad(a, port); + return Open(ad); +} +#endif +#endif + +bool UdpSocket::Open(SocketAddress& ad) +{ + if (GetSocket() == INVALID_SOCKET) + { + Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); + } + if (GetSocket() != INVALID_SOCKET) + { + SetNonblocking(true); + if (connect(GetSocket(), ad, ad) == -1) + { + Handler().LogError(this, "connect", Errno, StrError(Errno), LOG_LEVEL_FATAL); + SetCloseAndDelete(); + return false; + } + SetConnected(); + return true; + } + return false; +} + +void UdpSocket::CreateConnection() +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + if (GetSocket() == INVALID_SOCKET) + { + SOCKET s = CreateSocket(AF_INET6, SOCK_DGRAM, "udp"); + if (s == INVALID_SOCKET) + { + return; + } + SetNonblocking(true, s); + Attach(s); + } + return; + } +#endif +#endif + if (GetSocket() == INVALID_SOCKET) + { + SOCKET s = CreateSocket(AF_INET, SOCK_DGRAM, "udp"); + if (s == INVALID_SOCKET) + { + return; + } + SetNonblocking(true, s); + Attach(s); + } +} + +/** send to specified address */ +void UdpSocket::SendToBuf(const std::string& h, port_t p, const char *data, int len, int flags) +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(h, p); + if (ad.IsValid()) + { + SendToBuf(ad, data, len, flags); + } + return; + } +#endif +#endif + Ipv4Address ad(h, p); + if (ad.IsValid()) + { + SendToBuf(ad, data, len, flags); + } +} + +/** send to specified address */ +void UdpSocket::SendToBuf(ipaddr_t a, port_t p, const char *data, int len, int flags) +{ + Ipv4Address ad(a, p); + SendToBuf(ad, data, len, flags); +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +void UdpSocket::SendToBuf(in6_addr a, port_t p, const char *data, int len, int flags) +{ + Ipv6Address ad(a, p); + SendToBuf(ad, data, len, flags); +} +#endif +#endif + +void UdpSocket::SendToBuf(SocketAddress& ad, const char *data, int len, int flags) +{ + if (GetSocket() == INVALID_SOCKET) + { + Attach(CreateSocket(ad.GetFamily(), SOCK_DGRAM, "udp")); + } + if (GetSocket() != INVALID_SOCKET) + { + SetNonblocking(true); + if ((m_last_size_written = sendto(GetSocket(), data, len, flags, ad, ad)) == -1) + { + Handler().LogError(this, "sendto", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + } +} + +void UdpSocket::SendTo(const std::string& a, port_t p, const std::string& str, int flags) +{ + SendToBuf(a, p, str.c_str(), (int)str.size(), flags); +} + +void UdpSocket::SendTo(ipaddr_t a, port_t p, const std::string& str, int flags) +{ + SendToBuf(a, p, str.c_str(), (int)str.size(), flags); +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +void UdpSocket::SendTo(in6_addr a, port_t p, const std::string& str, int flags) +{ + SendToBuf(a, p, str.c_str(), (int)str.size(), flags); +} +#endif +#endif + +void UdpSocket::SendTo(SocketAddress& ad, const std::string& str, int flags) +{ + SendToBuf(ad, str.c_str(), (int)str.size(), flags); +} + +/** send to connected address */ +void UdpSocket::SendBuf(const char *data, size_t len, int flags) +{ + if (!IsConnected()) + { + Handler().LogError(this, "SendBuf", 0, "not connected", LOG_LEVEL_ERROR); + return; + } + if ((m_last_size_written = send(GetSocket(), data, (int)len, flags)) == -1) + { + Handler().LogError(this, "send", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } +} + +void UdpSocket::Send(const std::string& str, int flags) +{ + SendBuf(str.c_str(), (int)str.size(), flags); +} + +#if defined(LINUX) || defined(MACOSX) +int UdpSocket::ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts) +{ + struct msghdr msg; + struct iovec vec[1]; + union { + struct cmsghdr cm; +#ifdef MACOSX +#ifdef __DARWIN_UNIX03 +#define ALIGNBYTES __DARWIN_ALIGNBYTES +#endif +#define myALIGN(p) (((unsigned int)(p) + ALIGNBYTES) &~ ALIGNBYTES) +#define myCMSG_SPACE(l) (myALIGN(sizeof(struct cmsghdr)) + myALIGN(l)) + char data[ myCMSG_SPACE(sizeof(struct timeval)) ]; +#else + char data[ CMSG_SPACE(sizeof(struct timeval)) ]; +#endif + } cmsg_un; + struct cmsghdr *cmsg; + struct timeval *tv; + + vec[0].iov_base = ioBuf; + vec[0].iov_len = inBufSize; + + memset(&msg, 0, sizeof(msg)); + memset(from, 0, fromlen); + memset(ioBuf, 0, inBufSize); + memset(&cmsg_un, 0, sizeof(cmsg_un)); + + msg.msg_name = (caddr_t)from; + msg.msg_namelen = fromlen; + msg.msg_iov = vec; + msg.msg_iovlen = 1; + msg.msg_control = cmsg_un.data; + msg.msg_controllen = sizeof(cmsg_un.data); + msg.msg_flags = 0; + + // Original version - for reference only + //int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + + int n = recvmsg(GetSocket(), &msg, MSG_DONTWAIT); + + // now ioBuf will contain the data, as if we used recvfrom + + // Now get the time + if(n != -1 && msg.msg_controllen >= sizeof(struct cmsghdr) && !(msg.msg_flags & MSG_CTRUNC)) + { + tv = 0; + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) + { + if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) + { + tv = (struct timeval *)CMSG_DATA(cmsg); + } + } + if (tv) + { + memcpy(ts, tv, sizeof(struct timeval)); + } + } + // The address is in network order, but that's OK right now + return n; +} +#endif + +void UdpSocket::OnRead() +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + struct sockaddr_in6 sa; + socklen_t sa_len = sizeof(sa); + if (m_b_read_ts) + { + struct timeval ts; + Utility::GetTime(&ts); +#if !defined(LINUX) && !defined(MACOSX) + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); +#else + int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); +#endif + if (n > 0) + { + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); + } + else + if (n == -1) + { +#ifdef _WIN32 + if (Errno != WSAEWOULDBLOCK) +#else + if (Errno != EWOULDBLOCK) +#endif + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + return; + } + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + int q = m_retries; // receive max 10 at one cycle + while (n > 0) + { + if (sa_len != sizeof(sa)) + { + Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); + } + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); + if (!q--) + break; + // + n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + } + if (n == -1) + { +#ifdef _WIN32 + if (Errno != WSAEWOULDBLOCK) +#else + if (Errno != EWOULDBLOCK) +#endif + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + return; + } +#endif +#endif + struct sockaddr_in sa; + socklen_t sa_len = sizeof(sa); + if (m_b_read_ts) + { + struct timeval ts; + Utility::GetTime(&ts); +#if !defined(LINUX) && !defined(MACOSX) + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); +#else + int n = ReadTS(m_ibuf, m_ibufsz, (struct sockaddr *)&sa, sa_len, &ts); +#endif + if (n > 0) + { + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len, &ts); + } + else + if (n == -1) + { +#ifdef _WIN32 + if (Errno != WSAEWOULDBLOCK) +#else + if (Errno != EWOULDBLOCK) +#endif + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } + return; + } + int n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + int q = m_retries; + while (n > 0) + { + if (sa_len != sizeof(sa)) + { + Handler().LogError(this, "recvfrom", 0, "unexpected address struct size", LOG_LEVEL_WARNING); + } + this -> OnRawData(m_ibuf, n, (struct sockaddr *)&sa, sa_len); + if (!q--) + break; + // + n = recvfrom(GetSocket(), m_ibuf, m_ibufsz, 0, (struct sockaddr *)&sa, &sa_len); + } + if (n == -1) + { +#ifdef _WIN32 + if (Errno != WSAEWOULDBLOCK) +#else + if (Errno != EWOULDBLOCK) +#endif + Handler().LogError(this, "recvfrom", Errno, StrError(Errno), LOG_LEVEL_ERROR); + } +} + +void UdpSocket::SetBroadcast(bool b) +{ + int one = 1; + int zero = 0; + + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (b) + { + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof(one)) == -1) + { + Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } + else + { + if (setsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *) &zero, sizeof(zero)) == -1) + { + Handler().LogError(this, "SetBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } +} + +bool UdpSocket::IsBroadcast() +{ + int is_broadcast = 0; + socklen_t size; + + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (getsockopt(GetSocket(), SOL_SOCKET, SO_BROADCAST, (char *)&is_broadcast, &size) == -1) + { + Handler().LogError(this, "IsBroadcast", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return is_broadcast != 0; +} + +void UdpSocket::SetMulticastTTL(int ttl) +{ + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } +} + +int UdpSocket::GetMulticastTTL() +{ + int ttl = 0; + socklen_t size = sizeof(int); + + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_TTL, (char *)&ttl, &size) == -1) + { + Handler().LogError(this, "GetMulticastTTL", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return ttl; +} + +void UdpSocket::SetMulticastLoop(bool x) +{ + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + int val = x ? 1 : 0; + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return; + } +#endif +#endif + int val = x ? 1 : 0; + if (setsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&val, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } +} + +bool UdpSocket::IsMulticastLoop() +{ + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + int is_loop = 0; + socklen_t size = sizeof(int); + if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) + { + Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return is_loop ? true : false; + } +#endif +#endif + int is_loop = 0; + socklen_t size = sizeof(int); + if (getsockopt(GetSocket(), SOL_IP, IP_MULTICAST_LOOP, (char *)&is_loop, &size) == -1) + { + Handler().LogError(this, "IsMulticastLoop", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return is_loop ? true : false; +} + +void UdpSocket::AddMulticastMembership(const std::string& group, const std::string& local_if, int if_index) +{ + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + struct ipv6_mreq x; + struct in6_addr addr; + if (Utility::u2ip( group, addr )) + { + x.ipv6mr_multiaddr = addr; + x.ipv6mr_interface = if_index; + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) + { + Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } + return; + } +#endif +#endif + struct ip_mreq x; // ip_mreqn + ipaddr_t addr; + if (Utility::u2ip( group, addr )) + { + memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); + Utility::u2ip( local_if, addr); + memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); +// x.imr_ifindex = if_index; + if (setsockopt(GetSocket(), SOL_IP, IP_ADD_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "AddMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } +} + +void UdpSocket::DropMulticastMembership(const std::string& group, const std::string& local_if, int if_index) +{ + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + struct ipv6_mreq x; + struct in6_addr addr; + if (Utility::u2ip( group, addr )) + { + x.ipv6mr_multiaddr = addr; + x.ipv6mr_interface = if_index; + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ipv6_mreq)) == -1) + { + Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } + return; + } +#endif +#endif + struct ip_mreq x; // ip_mreqn + ipaddr_t addr; + if (Utility::u2ip( group, addr )) + { + memcpy(&x.imr_multiaddr.s_addr, &addr, sizeof(addr)); + Utility::u2ip( local_if, addr); + memcpy(&x.imr_interface.s_addr, &addr, sizeof(addr)); +// x.imr_ifindex = if_index; + if (setsockopt(GetSocket(), SOL_IP, IP_DROP_MEMBERSHIP, (char *)&x, sizeof(struct ip_mreq)) == -1) + { + Handler().LogError(this, "DropMulticastMembership", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + } +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +void UdpSocket::SetMulticastHops(int hops) +{ + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (!IsIpv6()) + { + Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); + return; + } + if (setsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, sizeof(int)) == -1) + { + Handler().LogError(this, "SetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } +} + +int UdpSocket::GetMulticastHops() +{ + if (GetSocket() == INVALID_SOCKET) + { + CreateConnection(); + } + if (!IsIpv6()) + { + Handler().LogError(this, "SetMulticastHops", 0, "Ipv6 only", LOG_LEVEL_ERROR); + return -1; + } + int hops = 0; + socklen_t size = sizeof(int); + if (getsockopt(GetSocket(), IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&hops, &size) == -1) + { + Handler().LogError(this, "GetMulticastHops", Errno, StrError(Errno), LOG_LEVEL_WARNING); + } + return hops; +} +#endif // IPPROTO_IPV6 +#endif + +bool UdpSocket::IsBound() +{ + return m_bind_ok; +} + +void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len) +{ +} + +void UdpSocket::OnRawData(const char *buf, size_t len, struct sockaddr *sa, socklen_t sa_len, struct timeval *ts) +{ +} + +port_t UdpSocket::GetPort() +{ + return m_port; +} + +int UdpSocket::GetLastSizeWritten() +{ + return m_last_size_written; +} + +void UdpSocket::SetTimestamp(bool x) +{ + m_b_read_ts = x; +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/Utility.cpp b/externals/sockets/Utility.cpp new file mode 100644 index 0000000..7c093fc --- /dev/null +++ b/externals/sockets/Utility.cpp @@ -0,0 +1,960 @@ +/** \file Utility.cpp + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Utility.h" +#include "Parse.h" +#include "Ipv4Address.h" +#include "Ipv6Address.h" +#include "Base64.h" +#include +#ifdef _WIN32 +#include +#else +#include +#include +#endif +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +// defines for the random number generator +#define TWIST_IA 397 +#define TWIST_IB (TWIST_LEN - TWIST_IA) +#define UMASK 0x80000000 +#define LMASK 0x7FFFFFFF +#define MATRIX_A 0x9908B0DF +#define TWIST(b,i,j) ((b)[i] & UMASK) | ((b)[j] & LMASK) +#define MAGIC_TWIST(s) (((s) & 1) * MATRIX_A) + +// statics +std::string Utility::m_host; +bool Utility::m_local_resolved = false; +ipaddr_t Utility::m_ip = 0; +std::string Utility::m_addr; +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +struct in6_addr Utility::m_local_ip6; +std::string Utility::m_local_addr6; +#endif +#endif + +std::string Utility::base64(const std::string& str_in) +{ + std::string str; + Base64 m_b; + m_b.encode(str_in, str, false); // , false == do not add cr/lf + return str; +} + +std::string Utility::base64d(const std::string& str_in) +{ + std::string str; + Base64 m_b; + m_b.decode(str_in, str); + return str; +} + +std::string Utility::l2string(long l) +{ + std::string str; + char tmp[100]; + sprintf(tmp,"%ld",l); + str = tmp; + return str; +} + +std::string Utility::bigint2string(uint64_t l) +{ + std::string str; + uint64_t tmp = l; + while (tmp) + { + uint64_t a = tmp % 10; + str = (char)(a + 48) + str; + tmp /= 10; + } + if (str.empty()) + { + str = "0"; + } + return str; +} + +uint64_t Utility::atoi64(const std::string& str) +{ + uint64_t l = 0; + for (size_t i = 0; i < str.size(); i++) + { + l = l * 10 + str[i] - 48; + } + return l; +} + +unsigned int Utility::hex2unsigned(const std::string& str) +{ + unsigned int r = 0; + for (size_t i = 0; i < str.size(); i++) + { + r = r * 16 + str[i] - 48 - ((str[i] >= 'A') ? 7 : 0) - ((str[i] >= 'a') ? 32 : 0); + } + return r; +} + +/* +* Encode string per RFC1738 URL encoding rules +* tnx rstaveley +*/ +std::string Utility::rfc1738_encode(const std::string& src) +{ +static char hex[] = "0123456789ABCDEF"; + std::string dst; + for (size_t i = 0; i < src.size(); i++) + { + if (isalnum(src[i])) + { + dst += src[i]; + } + else + if (src[i] == ' ') + { + dst += '+'; + } + else + { + unsigned char c = static_cast(src[i]); + dst += '%'; + dst += hex[c / 16]; + dst += hex[c % 16]; + } + } + return dst; +} // rfc1738_encode + +/* +* Decode string per RFC1738 URL encoding rules +* tnx rstaveley +*/ +std::string Utility::rfc1738_decode(const std::string& src) +{ + std::string dst; + for (size_t i = 0; i < src.size(); i++) + { + if (src[i] == '%' && isxdigit(src[i + 1]) && isxdigit(src[i + 2])) + { + char c1 = src[++i]; + char c2 = src[++i]; + c1 = c1 - 48 - ((c1 >= 'A') ? 7 : 0) - ((c1 >= 'a') ? 32 : 0); + c2 = c2 - 48 - ((c2 >= 'A') ? 7 : 0) - ((c2 >= 'a') ? 32 : 0); + dst += (char)(c1 * 16 + c2); + } + else + if (src[i] == '+') + { + dst += ' '; + } + else + { + dst += src[i]; + } + } + return dst; +} // rfc1738_decode + +bool Utility::isipv4(const std::string& str) +{ + int dots = 0; + // %! ignore :port? + for (size_t i = 0; i < str.size(); i++) + { + if (str[i] == '.') + dots++; + else + if (!isdigit(str[i])) + return false; + } + if (dots != 3) + return false; + return true; +} + +bool Utility::isipv6(const std::string& str) +{ + size_t qc = 0; + size_t qd = 0; + for (size_t i = 0; i < str.size(); i++) + { + qc += (str[i] == ':') ? 1 : 0; + qd += (str[i] == '.') ? 1 : 0; + } + if (qc > 7) + { + return false; + } + if (qd && qd != 3) + { + return false; + } + Parse pa(str,":."); + std::string tmp = pa.getword(); + while (!tmp.empty()) + { + if (tmp.size() > 4) + { + return false; + } + for (size_t i = 0; i < tmp.size(); i++) + { + if (tmp[i] < '0' || (tmp[i] > '9' && tmp[i] < 'A') || + (tmp[i] > 'F' && tmp[i] < 'a') || tmp[i] > 'f') + { + return false; + } + } + // + tmp = pa.getword(); + } + return true; +} + +bool Utility::u2ip(const std::string& str, ipaddr_t& l) +{ + struct sockaddr_in sa; + bool r = Utility::u2ip(str, sa); + memcpy(&l, &sa.sin_addr, sizeof(l)); + return r; +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +bool Utility::u2ip(const std::string& str, struct in6_addr& l) +{ + struct sockaddr_in6 sa; + bool r = Utility::u2ip(str, sa); + l = sa.sin6_addr; + return r; +} +#endif +#endif + +void Utility::l2ip(const ipaddr_t ip, std::string& str) +{ + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + memcpy(&sa.sin_addr, &ip, sizeof(sa.sin_addr)); + Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); +} + +void Utility::l2ip(const in_addr& ip, std::string& str) +{ + struct sockaddr_in sa; + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; + sa.sin_addr = ip; + Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +void Utility::l2ip(const struct in6_addr& ip, std::string& str,bool mixed) +{ + char slask[100]; // l2ip temporary + *slask = 0; + unsigned int prev = 0; + bool skipped = false; + bool ok_to_skip = true; + if (mixed) + { + unsigned short x; + unsigned short addr16[8]; + memcpy(addr16, &ip, sizeof(addr16)); + for (size_t i = 0; i < 6; i++) + { + x = ntohs(addr16[i]); + if (*slask && (x || !ok_to_skip || prev)) + strcat(slask,":"); + if (x || !ok_to_skip) + { + sprintf(slask + strlen(slask),"%x", x); + if (x && skipped) + ok_to_skip = false; + } + else + { + skipped = true; + } + prev = x; + } + x = ntohs(addr16[6]); + sprintf(slask + strlen(slask),":%u.%u",x / 256,x & 255); + x = ntohs(addr16[7]); + sprintf(slask + strlen(slask),".%u.%u",x / 256,x & 255); + } + else + { + struct sockaddr_in6 sa; + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; + sa.sin6_addr = ip; + Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST); + return; + } + str = slask; +} + +int Utility::in6_addr_compare(in6_addr a,in6_addr b) +{ + for (size_t i = 0; i < 16; i++) + { + if (a.s6_addr[i] < b.s6_addr[i]) + return -1; + if (a.s6_addr[i] > b.s6_addr[i]) + return 1; + } + return 0; +} +#endif +#endif + +void Utility::ResolveLocal() +{ + char h[256]; + + // get local hostname and translate into ip-address + *h = 0; + gethostname(h,255); + { + if (Utility::u2ip(h, m_ip)) + { + Utility::l2ip(m_ip, m_addr); + } + } +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + memset(&m_local_ip6, 0, sizeof(m_local_ip6)); + { + if (Utility::u2ip(h, m_local_ip6)) + { + Utility::l2ip(m_local_ip6, m_local_addr6); + } + } +#endif +#endif + m_host = h; + m_local_resolved = true; +} + +const std::string& Utility::GetLocalHostname() +{ + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_host; +} + +ipaddr_t Utility::GetLocalIP() +{ + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_ip; +} + +const std::string& Utility::GetLocalAddress() +{ + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_addr; +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +const struct in6_addr& Utility::GetLocalIP6() +{ + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_local_ip6; +} + +const std::string& Utility::GetLocalAddress6() +{ + if (!m_local_resolved) + { + ResolveLocal(); + } + return m_local_addr6; +} +#endif +#endif + +void Utility::SetEnv(const std::string& var,const std::string& value) +{ +#if (defined(SOLARIS8) || defined(SOLARIS)) + { + static std::map vmap; + if (vmap.find(var) != vmap.end()) + { + delete[] vmap[var]; + } + vmap[var] = new char[var.size() + 1 + value.size() + 1]; + sprintf(vmap[var], "%s=%s", var.c_str(), value.c_str()); + putenv( vmap[var] ); + } +#elif defined _WIN32 + { + std::string slask = var + "=" + value; + _putenv( (char *)slask.c_str()); + } +#else + setenv(var.c_str(), value.c_str(), 1); +#endif +} + +std::string Utility::Sa2String(struct sockaddr *sa) +{ +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (sa -> sa_family == AF_INET6) + { + struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; + std::string tmp; + Utility::l2ip(sa6 -> sin6_addr, tmp); + return tmp + ":" + Utility::l2string(ntohs(sa6 -> sin6_port)); + } +#endif +#endif + if (sa -> sa_family == AF_INET) + { + struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; + ipaddr_t a; + memcpy(&a, &sa4 -> sin_addr, 4); + std::string tmp; + Utility::l2ip(a, tmp); + return tmp + ":" + Utility::l2string(ntohs(sa4 -> sin_port)); + } + return ""; +} + +void Utility::GetTime(struct timeval *p) +{ +#ifdef _WIN32 + FILETIME ft; // Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC). + GetSystemTimeAsFileTime(&ft); + uint64_t tt; + memcpy(&tt, &ft, sizeof(tt)); + tt /= 10; // make it usecs + p->tv_sec = (long)tt / 1000000; + p->tv_usec = (long)tt % 1000000; +#else + gettimeofday(p, NULL); +#endif +} + +std::auto_ptr Utility::CreateAddress(struct sockaddr *sa,socklen_t sa_len) +{ + switch (sa -> sa_family) + { + case AF_INET: + if (sa_len == sizeof(struct sockaddr_in)) + { + struct sockaddr_in *p = (struct sockaddr_in *)sa; + return std::auto_ptr(new Ipv4Address(*p)); + } + break; +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + case AF_INET6: + if (sa_len == sizeof(struct sockaddr_in6)) + { + struct sockaddr_in6 *p = (struct sockaddr_in6 *)sa; + return std::auto_ptr(new Ipv6Address(*p)); + } + break; +#endif +#endif + } + return std::auto_ptr(NULL); +} + +bool Utility::u2ip(const std::string& host, struct sockaddr_in& sa, int ai_flags) +{ + memset(&sa, 0, sizeof(sa)); + sa.sin_family = AF_INET; +#ifdef NO_GETADDRINFO + if ((ai_flags & AI_NUMERICHOST) != 0 || isipv4(host)) + { + Parse pa((char *)host.c_str(), "."); + union { + struct { + unsigned char b1; + unsigned char b2; + unsigned char b3; + unsigned char b4; + } a; + ipaddr_t l; + } u; + u.a.b1 = static_cast(pa.getvalue()); + u.a.b2 = static_cast(pa.getvalue()); + u.a.b3 = static_cast(pa.getvalue()); + u.a.b4 = static_cast(pa.getvalue()); + memcpy(&sa.sin_addr, &u.l, sizeof(sa.sin_addr)); + return true; + } +#ifndef LINUX + struct hostent *he = gethostbyname( host.c_str() ); + if (!he) + { + return false; + } + memcpy(&sa.sin_addr, he -> h_addr, sizeof(sa.sin_addr)); +#else + struct hostent he; + struct hostent *result = NULL; + int myerrno = 0; + char buf[2000]; + int n = gethostbyname_r(host.c_str(), &he, buf, sizeof(buf), &result, &myerrno); + if (n || !result) + { + return false; + } + if (he.h_addr_list && he.h_addr_list[0]) + memcpy(&sa.sin_addr, he.h_addr, 4); + else + return false; +#endif + return true; +#else + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + // AI_NUMERICHOST + // AI_CANONNAME + // AI_PASSIVE - server + // AI_ADDRCONFIG + // AI_V4MAPPED + // AI_ALL + // AI_NUMERICSERV + hints.ai_flags = ai_flags; + hints.ai_family = AF_INET; + hints.ai_socktype = 0; + hints.ai_protocol = 0; + struct addrinfo *res; + if (Utility::isipv4(host)) + hints.ai_flags |= AI_NUMERICHOST; + int n = getaddrinfo(host.c_str(), NULL, &hints, &res); + if (!n) + { + std::vector vec; + struct addrinfo *ai = res; + while (ai) + { + if (ai -> ai_addrlen == sizeof(sa)) + vec.push_back( ai ); + ai = ai -> ai_next; + } + if (vec.empty()) + return false; + ai = vec[Utility::Rnd() % vec.size()]; + { + memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); + } + freeaddrinfo(res); + return true; + } + std::string error = "Error: "; +#ifndef __CYGWIN__ + error += gai_strerror(n); +#endif + return false; +#endif // NO_GETADDRINFO +} + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 +bool Utility::u2ip(const std::string& host, struct sockaddr_in6& sa, int ai_flags) +{ + memset(&sa, 0, sizeof(sa)); + sa.sin6_family = AF_INET6; +#ifdef NO_GETADDRINFO + if ((ai_flags & AI_NUMERICHOST) != 0 || isipv6(host)) + { + std::list vec; + size_t x = 0; + for (size_t i = 0; i <= host.size(); i++) + { + if (i == host.size() || host[i] == ':') + { + std::string s = host.substr(x, i - x); + // + if (strstr(s.c_str(),".")) // x.x.x.x + { + Parse pa(s,"."); + char slask[100]; // u2ip temporary hex2string conversion + unsigned long b0 = static_cast(pa.getvalue()); + unsigned long b1 = static_cast(pa.getvalue()); + unsigned long b2 = static_cast(pa.getvalue()); + unsigned long b3 = static_cast(pa.getvalue()); + sprintf(slask,"%lx",b0 * 256 + b1); + vec.push_back(slask); + sprintf(slask,"%lx",b2 * 256 + b3); + vec.push_back(slask); + } + else + { + vec.push_back(s); + } + // + x = i + 1; + } + } + size_t sz = vec.size(); // number of byte pairs + size_t i = 0; // index in in6_addr.in6_u.u6_addr16[] ( 0 .. 7 ) + unsigned short addr16[8]; + for (std::list::iterator it = vec.begin(); it != vec.end(); it++) + { + std::string bytepair = *it; + if (!bytepair.empty()) + { + addr16[i++] = htons(Utility::hex2unsigned(bytepair)); + } + else + { + addr16[i++] = 0; + while (sz++ < 8) + { + addr16[i++] = 0; + } + } + } + memcpy(&sa.sin6_addr, addr16, sizeof(addr16)); + return true; + } +#ifdef SOLARIS + int errnum = 0; + struct hostent *he = getipnodebyname( host.c_str(), AF_INET6, 0, &errnum ); +#else + struct hostent *he = gethostbyname2( host.c_str(), AF_INET6 ); +#endif + if (!he) + { + return false; + } + memcpy(&sa.sin6_addr,he -> h_addr_list[0],he -> h_length); +#ifdef SOLARIS + free(he); +#endif + return true; +#else + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = ai_flags; + hints.ai_family = AF_INET6; + hints.ai_socktype = 0; + hints.ai_protocol = 0; + struct addrinfo *res; + if (Utility::isipv6(host)) + hints.ai_flags |= AI_NUMERICHOST; + int n = getaddrinfo(host.c_str(), NULL, &hints, &res); + if (!n) + { + std::vector vec; + struct addrinfo *ai = res; + while (ai) + { + if (ai -> ai_addrlen == sizeof(sa)) + vec.push_back( ai ); + ai = ai -> ai_next; + } + if (vec.empty()) + return false; + ai = vec[Utility::Rnd() % vec.size()]; + { + memcpy(&sa, ai -> ai_addr, ai -> ai_addrlen); + } + freeaddrinfo(res); + return true; + } + std::string error = "Error: "; +#ifndef __CYGWIN__ + error += gai_strerror(n); +#endif + return false; +#endif // NO_GETADDRINFO +} +#endif // IPPROTO_IPV6 +#endif // ENABLE_IPV6 + +bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, int flags) +{ + std::string service; + return Utility::reverse(sa, sa_len, hostname, service, flags); +} + +bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags) +{ + hostname = ""; + service = ""; +#ifdef NO_GETADDRINFO + switch (sa -> sa_family) + { + case AF_INET: + if (flags & NI_NUMERICHOST) + { + union { + struct { + unsigned char b1; + unsigned char b2; + unsigned char b3; + unsigned char b4; + } a; + ipaddr_t l; + } u; + struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; + memcpy(&u.l, &sa_in -> sin_addr, sizeof(u.l)); + char tmp[100]; + sprintf(tmp, "%u.%u.%u.%u", u.a.b1, u.a.b2, u.a.b3, u.a.b4); + hostname = tmp; + return true; + } + else + { + struct sockaddr_in *sa_in = (struct sockaddr_in *)sa; + struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin_addr, sizeof(sa_in -> sin_addr), AF_INET); + if (h) + { + hostname = h -> h_name; + return true; + } + } + break; +#ifdef ENABLE_IPV6 + case AF_INET6: + if (flags & NI_NUMERICHOST) + { + char slask[100]; // l2ip temporary + *slask = 0; + unsigned int prev = 0; + bool skipped = false; + bool ok_to_skip = true; + { + unsigned short addr16[8]; + struct sockaddr_in6 *sa_in6 = (struct sockaddr_in6 *)sa; + memcpy(addr16, &sa_in6 -> sin6_addr, sizeof(addr16)); + for (size_t i = 0; i < 8; i++) + { + unsigned short x = ntohs(addr16[i]); + if (*slask && (x || !ok_to_skip || prev)) + strcat(slask,":"); + if (x || !ok_to_skip) + { + sprintf(slask + strlen(slask),"%x", x); + if (x && skipped) + ok_to_skip = false; + } + else + { + skipped = true; + } + prev = x; + } + } + if (!*slask) + strcpy(slask, "::"); + hostname = slask; + return true; + } + else + { + // %! TODO: ipv6 reverse lookup + struct sockaddr_in6 *sa_in = (struct sockaddr_in6 *)sa; + struct hostent *h = gethostbyaddr( (const char *)&sa_in -> sin6_addr, sizeof(sa_in -> sin6_addr), AF_INET6); + if (h) + { + hostname = h -> h_name; + return true; + } + } + break; +#endif + } + return false; +#else + char host[NI_MAXHOST]; + char serv[NI_MAXSERV]; + // NI_NOFQDN + // NI_NUMERICHOST + // NI_NAMEREQD + // NI_NUMERICSERV + // NI_DGRAM + int n = getnameinfo(sa, sa_len, host, sizeof(host), serv, sizeof(serv), flags); + if (n) + { + // EAI_AGAIN + // EAI_BADFLAGS + // EAI_FAIL + // EAI_FAMILY + // EAI_MEMORY + // EAI_NONAME + // EAI_OVERFLOW + // EAI_SYSTEM + return false; + } + hostname = host; + service = serv; + return true; +#endif // NO_GETADDRINFO +} + +bool Utility::u2service(const std::string& name, int& service, int ai_flags) +{ +#ifdef NO_GETADDRINFO + // %! + return false; +#else + struct addrinfo hints; + service = 0; + memset(&hints, 0, sizeof(hints)); + // AI_NUMERICHOST + // AI_CANONNAME + // AI_PASSIVE - server + // AI_ADDRCONFIG + // AI_V4MAPPED + // AI_ALL + // AI_NUMERICSERV + hints.ai_flags = ai_flags; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = 0; + hints.ai_protocol = 0; + struct addrinfo *res; + int n = getaddrinfo(NULL, name.c_str(), &hints, &res); + if (!n) + { + service = res -> ai_protocol; + freeaddrinfo(res); + return true; + } + return false; +#endif // NO_GETADDRINFO +} + +unsigned long Utility::ThreadID() +{ +#ifdef _WIN32 + return GetCurrentThreadId(); +#else + return (unsigned long)pthread_self(); +#endif +} + +std::string Utility::ToLower(const std::string& str) +{ + std::string r; + for (size_t i = 0; i < str.size(); i++) + { + if (str[i] >= 'A' && str[i] <= 'Z') + r += str[i] | 32; + else + r += str[i]; + } + return r; +} + +std::string Utility::ToUpper(const std::string& str) +{ + std::string r; + for (size_t i = 0; i < str.size(); i++) + { + if (str[i] >= 'a' && str[i] <= 'z') + r += (char)(str[i] - 32); + else + r += str[i]; + } + return r; +} + +std::string Utility::ToString(double d) +{ + char tmp[100]; + sprintf(tmp, "%f", d); + return tmp; +} + +unsigned long Utility::Rnd() +{ +static Utility::Rng generator( (unsigned long)time(NULL) ); + return generator.Get(); +} + +Utility::Rng::Rng(unsigned long seed) : m_value( 0 ) +{ + m_tmp[0]= seed & 0xffffffffUL; + for (int i = 1; i < TWIST_LEN; i++) + { + m_tmp[i] = (1812433253UL * (m_tmp[i - 1] ^ (m_tmp[i - 1] >> 30)) + i); + } +} + +unsigned long Utility::Rng::Get() +{ + unsigned long val = m_tmp[m_value]; + ++m_value; + if (m_value == TWIST_LEN) + { + for (int i = 0; i < TWIST_IB; ++i) + { + unsigned long s = TWIST(m_tmp, i, i + 1); + m_tmp[i] = m_tmp[i + TWIST_IA] ^ (s >> 1) ^ MAGIC_TWIST(s); + } + { + for (int i = 0; i < TWIST_LEN - 1; ++i) + { + unsigned long s = TWIST(m_tmp, i, i + 1); + m_tmp[i] = m_tmp[i - TWIST_IB] ^ (s >> 1) ^ MAGIC_TWIST(s); + } + } + unsigned long s = TWIST(m_tmp, TWIST_LEN - 1, 0); + m_tmp[TWIST_LEN - 1] = m_tmp[TWIST_IA - 1] ^ (s >> 1) ^ MAGIC_TWIST(s); + + m_value = 0; + } + return val; +} + +#ifdef SOCKETS_NAMESPACE +} +#endif + + diff --git a/externals/sockets/include/Base64.h b/externals/sockets/include/Base64.h new file mode 100644 index 0000000..d4323aa --- /dev/null +++ b/externals/sockets/include/Base64.h @@ -0,0 +1,77 @@ +/** \file Base64.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Base64_H +#define _SOCKETS_Base64_H + +#include "sockets-config.h" +#ifdef _MSC_VER +#pragma warning(disable:4514) +#endif + +#include +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** \defgroup util Utilities */ + +/** Base64 encode/decode. + \ingroup util */ +class Base64 +{ +public: + Base64(); + + void encode(FILE *, std::string& , bool add_crlf = true); + void encode(const std::string&, std::string& , bool add_crlf = true); + void encode(const char *, size_t, std::string& , bool add_crlf = true); + void encode(const unsigned char *, size_t, std::string& , bool add_crlf = true); + + void decode(const std::string&, std::string& ); + void decode(const std::string&, unsigned char *, size_t&); + + size_t decode_length(const std::string& ); + +private: + Base64(const Base64& ) {} + Base64& operator=(const Base64& ) { return *this; } +static const char *bstr; +static const char rstr[128]; +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_Base64_H + + diff --git a/externals/sockets/include/Exception.h b/externals/sockets/include/Exception.h new file mode 100644 index 0000000..bb881b2 --- /dev/null +++ b/externals/sockets/include/Exception.h @@ -0,0 +1,55 @@ +/** + ** \file Exception.h + ** \date 2007-09-28 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _Sockets_Exception_H +#define _Sockets_Exception_H + +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +class Exception +{ +public: + Exception(const std::string& description); + virtual ~Exception() {} + + virtual const std::string ToString() const; + + Exception(const Exception& ) {} // copy constructor + + Exception& operator=(const Exception& ) { return *this; } // assignment operator + +private: + std::string m_description; + +}; + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif + +#endif // _Sockets_Exception_H + + diff --git a/externals/sockets/include/File.h b/externals/sockets/include/File.h new file mode 100644 index 0000000..ed322ef --- /dev/null +++ b/externals/sockets/include/File.h @@ -0,0 +1,82 @@ +/** \file File.h + ** \date 2005-04-25 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_File_H +#define _SOCKETS_File_H + +#include "sockets-config.h" +#include "IFile.h" +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** IFile implementation of a disk file. + \ingroup file */ +class File : public IFile +{ +public: + File(); + ~File(); + + bool fopen(const std::string&, const std::string&); + void fclose(); + + size_t fread(char *, size_t, size_t) const; + size_t fwrite(const char *, size_t, size_t); + + char *fgets(char *, int) const; + void fprintf(const char *format, ...); + + off_t size() const; + bool eof() const; + + void reset_read() const; + void reset_write(); + +private: + File(const File& ) {} // copy constructor + File& operator=(const File& ) { return *this; } // assignment operator + + std::string m_path; + std::string m_mode; + FILE *m_fil; + mutable long m_rptr; + long m_wptr; +}; + + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_File_H + + diff --git a/externals/sockets/include/IFile.h b/externals/sockets/include/IFile.h new file mode 100644 index 0000000..657c8a4 --- /dev/null +++ b/externals/sockets/include/IFile.h @@ -0,0 +1,71 @@ +/** \file IFile.h + ** \date 2005-04-25 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_IFile_H +#define _SOCKETS_IFile_H + +#include "sockets-config.h" +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** \defgroup file File handling */ +/** Pure virtual file I/O interface. + \ingroup file */ +class IFile +{ +public: + virtual ~IFile() {} + + virtual bool fopen(const std::string&, const std::string&) = 0; + virtual void fclose() = 0; + + virtual size_t fread(char *, size_t, size_t) const = 0; + virtual size_t fwrite(const char *, size_t, size_t) = 0; + + virtual char *fgets(char *, int) const = 0; + virtual void fprintf(const char *format, ...) = 0; + + virtual off_t size() const = 0; + virtual bool eof() const = 0; + + virtual void reset_read() const = 0; + virtual void reset_write() = 0; + +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_IFile_H + + diff --git a/externals/sockets/include/ISocketHandler.h b/externals/sockets/include/ISocketHandler.h new file mode 100644 index 0000000..940783c --- /dev/null +++ b/externals/sockets/include/ISocketHandler.h @@ -0,0 +1,231 @@ +/** \file ISocketHandler.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_ISocketHandler_H +#define _SOCKETS_ISocketHandler_H +#include "sockets-config.h" + +#include + +#include "socket_include.h" +#include "Socket.h" +#include "StdLog.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +typedef enum { + LIST_CALLONCONNECT = 0, +#ifdef ENABLE_DETACH + LIST_DETACH, +#endif + LIST_TIMEOUT, + LIST_RETRY, + LIST_CLOSE +} list_t; + +class SocketAddress; +class Mutex; + +/** Socket container class, event generator. + \ingroup basic */ +class ISocketHandler +{ + friend class Socket; + +public: + /** Connection pool class for internal use by the ISocketHandler. + \ingroup internal */ +#ifdef ENABLE_POOL + class PoolSocket : public Socket + { + public: + PoolSocket(ISocketHandler& h,Socket *src) : Socket(h) { + CopyConnection( src ); + SetIsClient(); + } + + void OnRead() { + Handler().LogError(this, "OnRead", 0, "data on hibernating socket", LOG_LEVEL_FATAL); + SetCloseAndDelete(); + } + void OnOptions(int,int,int,SOCKET) {} + + }; +#endif + +public: + virtual ~ISocketHandler() {} + + /** Get mutex reference for threadsafe operations. */ + virtual Mutex& GetMutex() const = 0; + + /** Register StdLog object for error callback. + \param log Pointer to log class */ + virtual void RegStdLog(StdLog *log) = 0; + + /** Log error to log class for print out / storage. */ + virtual void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING) = 0; + + // ------------------------------------------------------------------------- + // Socket stuff + // ------------------------------------------------------------------------- + /** Add socket instance to socket map. Removal is always automatic. */ + virtual void Add(Socket *) = 0; +private: + /** Remove socket from socket map, used by Socket class. */ + virtual void Remove(Socket *) = 0; +public: + /** Get status of read/write/exception file descriptor set for a socket. */ + virtual void Get(SOCKET s,bool& r,bool& w,bool& e) = 0; + /** Set read/write/exception file descriptor sets (fd_set). */ + virtual void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true) = 0; + + /** Wait for events, generate callbacks. */ + virtual int Select(long sec,long usec) = 0; + /** This method will not return until an event has been detected. */ + virtual int Select() = 0; + /** Wait for events, generate callbacks. */ + virtual int Select(struct timeval *tsel) = 0; + + /** Check that a socket really is handled by this socket handler. */ + virtual bool Valid(Socket *) = 0; + /** Return number of sockets handled by this handler. */ + virtual size_t GetCount() = 0; + + /** Override and return false to deny all incoming connections. + \param p ListenSocket class pointer (use GetPort to identify which one) */ + virtual bool OkToAccept(Socket *p) = 0; + + /** Called by Socket when a socket changes state. */ + virtual void AddList(SOCKET s,list_t which_one,bool add) = 0; + + // ------------------------------------------------------------------------- + // Connection pool + // ------------------------------------------------------------------------- +#ifdef ENABLE_POOL + /** Find available open connection (used by connection pool). */ + virtual ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&) = 0; + /** Enable connection pool (by default disabled). */ + virtual void EnablePool(bool = true) = 0; + /** Check pool status. + \return true if connection pool is enabled */ + virtual bool PoolEnabled() = 0; +#endif // ENABLE_POOL + + // ------------------------------------------------------------------------- + // Socks4 + // ------------------------------------------------------------------------- +#ifdef ENABLE_SOCKS4 + /** Set socks4 server ip that all new tcp sockets should use. */ + virtual void SetSocks4Host(ipaddr_t) = 0; + /** Set socks4 server hostname that all new tcp sockets should use. */ + virtual void SetSocks4Host(const std::string& ) = 0; + /** Set socks4 server port number that all new tcp sockets should use. */ + virtual void SetSocks4Port(port_t) = 0; + /** Set optional socks4 userid. */ + virtual void SetSocks4Userid(const std::string& ) = 0; + /** If connection to socks4 server fails, immediately try direct connection to final host. */ + virtual void SetSocks4TryDirect(bool = true) = 0; + /** Get socks4 server ip. + \return socks4 server ip */ + virtual ipaddr_t GetSocks4Host() = 0; + /** Get socks4 port number. + \return socks4 port number */ + virtual port_t GetSocks4Port() = 0; + /** Get socks4 userid (optional). + \return socks4 userid */ + virtual const std::string& GetSocks4Userid() = 0; + /** Check status of socks4 try direct flag. + \return true if direct connection should be tried if connection to socks4 server fails */ + virtual bool Socks4TryDirect() = 0; +#endif // ENABLE_SOCKS4 + + // ------------------------------------------------------------------------- + // DNS resolve server + // ------------------------------------------------------------------------- +#ifdef ENABLE_RESOLVER + /** Enable asynchronous DNS. + \param port Listen port of asynchronous dns server */ + virtual void EnableResolver(port_t = 16667) = 0; + /** Check resolver status. + \return true if resolver is enabled */ + virtual bool ResolverEnabled() = 0; + /** Queue a dns request. + \param host Hostname to be resolved + \param port Port number will be echoed in Socket::OnResolved callback */ + virtual int Resolve(Socket *,const std::string& host,port_t port) = 0; +#ifdef ENABLE_IPV6 + virtual int Resolve6(Socket *,const std::string& host,port_t port) = 0; +#endif + /** Do a reverse dns lookup. */ + virtual int Resolve(Socket *,ipaddr_t a) = 0; +#ifdef ENABLE_IPV6 + virtual int Resolve(Socket *,in6_addr& a) = 0; +#endif + /** Get listen port of asynchronous dns server. */ + virtual port_t GetResolverPort() = 0; + /** Resolver thread ready for queries. */ + virtual bool ResolverReady() = 0; + /** Returns true if socket waiting for a resolve event. */ + virtual bool Resolving(Socket *) = 0; +#endif // ENABLE_RESOLVER + +#ifdef ENABLE_TRIGGERS + /** Fetch unique trigger id. */ + virtual int TriggerID(Socket *src) = 0; + /** Subscribe socket to trigger id. */ + virtual bool Subscribe(int id, Socket *dst) = 0; + /** Unsubscribe socket from trigger id. */ + virtual bool Unsubscribe(int id, Socket *dst) = 0; + /** Execute OnTrigger for subscribed sockets. + \param id Trigger ID + \param data Data passed from source to destination + \param erase Empty trigger id source and destination maps if 'true', + Leave them in place if 'false' - if a trigger should be called many times */ + virtual void Trigger(int id, Socket::TriggerData& data, bool erase = true) = 0; +#endif // ENABLE_TRIGGERS + +#ifdef ENABLE_DETACH + /** Indicates that the handler runs under SocketThread. */ + virtual void SetSlave(bool x = true) = 0; + /** Indicates that the handler runs under SocketThread. */ + virtual bool IsSlave() = 0; +#endif // ENABLE_DETACH + +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_ISocketHandler_H + + diff --git a/externals/sockets/include/Ipv4Address.h b/externals/sockets/include/Ipv4Address.h new file mode 100644 index 0000000..71d9252 --- /dev/null +++ b/externals/sockets/include/Ipv4Address.h @@ -0,0 +1,95 @@ +/** + ** \file Ipv4Address.h + ** \date 2006-09-21 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Ipv4Address_H +#define _SOCKETS_Ipv4Address_H + +#include "sockets-config.h" +#include "SocketAddress.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/* Ipv4 address implementation. + \ingroup basic */ +class Ipv4Address : public SocketAddress +{ +public: + /** Create empty Ipv4 address structure. + \param port Port number */ + Ipv4Address(port_t port = 0); + /** Create Ipv4 address structure. + \param a Socket address in network byte order (as returned by Utility::u2ip) + \param port Port number in host byte order */ + Ipv4Address(ipaddr_t a,port_t port); + /** Create Ipv4 address structure. + \param a Socket address in network byte order + \param port Port number in host byte order */ + Ipv4Address(struct in_addr& a,port_t port); + /** Create Ipv4 address structure. + \param host Hostname to be resolved + \param port Port number in host byte order */ + Ipv4Address(const std::string& host,port_t port); + Ipv4Address(struct sockaddr_in&); + ~Ipv4Address(); + + // SocketAddress implementation + + operator struct sockaddr *(); + operator socklen_t(); + bool operator==(SocketAddress&); + + void SetPort(port_t port); + port_t GetPort(); + + void SetAddress(struct sockaddr *sa); + int GetFamily(); + + bool IsValid(); + std::auto_ptr GetCopy(); + + /** Convert address struct to text. */ + std::string Convert(bool include_port = false); + std::string Reverse(); + + /** Resolve hostname. */ +static bool Resolve(const std::string& hostname,struct in_addr& a); + /** Reverse resolve (IP to hostname). */ +static bool Reverse(struct in_addr& a,std::string& name); + /** Convert address struct to text. */ +static std::string Convert(struct in_addr& a); + +private: + Ipv4Address(const Ipv4Address& ) {} // copy constructor + Ipv4Address& operator=(const Ipv4Address& ) { return *this; } // assignment operator + struct sockaddr_in m_addr; + bool m_valid; +}; + + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif +#endif // _SOCKETS_Ipv4Address_H + + diff --git a/externals/sockets/include/Ipv6Address.h b/externals/sockets/include/Ipv6Address.h new file mode 100644 index 0000000..20c68d8 --- /dev/null +++ b/externals/sockets/include/Ipv6Address.h @@ -0,0 +1,105 @@ +/** + ** \file Ipv6Address.h + ** \date 2006-09-21 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Ipv6Address_H +#define _SOCKETS_Ipv6Address_H +#include "sockets-config.h" +#ifdef ENABLE_IPV6 + +#include "SocketAddress.h" +#ifdef IPPROTO_IPV6 +#if defined( _WIN32) && !defined(__CYGWIN__) +typedef unsigned __int32 uint32_t; +#endif + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** Ipv6 address implementation. + \ingroup basic */ +class Ipv6Address : public SocketAddress +{ +public: + /** Create empty Ipv6 address structure. + \param port Port number */ + Ipv6Address(port_t port = 0); + /** Create Ipv6 address structure. + \param a Socket address in network byte order + \param port Port number in host byte order */ + Ipv6Address(struct in6_addr& a,port_t port); + /** Create Ipv6 address structure. + \param host Hostname to be resolved + \param port Port number in host byte order */ + Ipv6Address(const std::string& host,port_t port); + Ipv6Address(struct sockaddr_in6&); + ~Ipv6Address(); + + // SocketAddress implementation + + operator struct sockaddr *(); + operator socklen_t(); + bool operator==(SocketAddress&); + + void SetPort(port_t port); + port_t GetPort(); + + void SetAddress(struct sockaddr *sa); + int GetFamily(); + + bool IsValid(); + std::auto_ptr GetCopy(); + + /** Convert address struct to text. */ + std::string Convert(bool include_port = false); + std::string Reverse(); + + /** Resolve hostname. */ +static bool Resolve(const std::string& hostname,struct in6_addr& a); + /** Reverse resolve (IP to hostname). */ +static bool Reverse(struct in6_addr& a,std::string& name); + /** Convert address struct to text. */ +static std::string Convert(struct in6_addr& a,bool mixed = false); + + void SetFlowinfo(uint32_t); + uint32_t GetFlowinfo(); +#ifndef _WIN32 + void SetScopeId(uint32_t); + uint32_t GetScopeId(); +#endif + +private: + Ipv6Address(const Ipv6Address& ) {} // copy constructor + Ipv6Address& operator=(const Ipv6Address& ) { return *this; } // assignment operator + struct sockaddr_in6 m_addr; + bool m_valid; +}; + + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif +#endif // IPPROTO_IPV6 +#endif // ENABLE_IPV6 +#endif // _SOCKETS_Ipv6Address_H + + diff --git a/externals/sockets/include/ListenSocket.h b/externals/sockets/include/ListenSocket.h new file mode 100644 index 0000000..8934a80 --- /dev/null +++ b/externals/sockets/include/ListenSocket.h @@ -0,0 +1,418 @@ +/** \file ListenSocket.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_ListenSocket_H +#define _SOCKETS_ListenSocket_H +#include "sockets-config.h" + +#ifdef _WIN32 +#include +#else +#include +#endif + +#include "ISocketHandler.h" +#include "Socket.h" +#include "Utility.h" +#include "SctpSocket.h" +#include "Ipv4Address.h" +#include "Ipv6Address.h" +#ifdef ENABLE_EXCEPTIONS +#include "Exception.h" +#endif + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** Binds incoming port number to new Socket class X. + \ingroup basic */ +template +class ListenSocket : public Socket +{ +public: + /** Constructor. + \param h ISocketHandler reference + \param use_creator Optional use of creator (default true) */ + ListenSocket(ISocketHandler& h,bool use_creator = true) : Socket(h), m_depth(0), m_creator(NULL) + ,m_bHasCreate(false) + { + if (use_creator) + { + m_creator = new X(h); + Socket *tmp = m_creator -> Create(); + if (tmp && dynamic_cast(tmp)) + { + m_bHasCreate = true; + } + if (tmp) + { + delete tmp; + } + } + } + ~ListenSocket() { + if (m_creator) + { + delete m_creator; + } + } + + /** Close file descriptor. */ + int Close() { + if (GetSocket() != INVALID_SOCKET) + { + closesocket(GetSocket()); + } + return 0; + } + + /** Bind and listen to any interface. + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(port_t port,int depth = 20) { +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(port); + return Bind(ad, depth); + } + else +#endif +#endif + { + Ipv4Address ad(port); + return Bind(ad, depth); + } + } + + int Bind(SocketAddress& ad,int depth) { +#ifdef USE_SCTP + if (dynamic_cast(m_creator)) + { + return Bind(ad, "sctp", depth); + } +#endif + return Bind(ad, "tcp", depth); + } + + /** Bind and listen to any interface, with optional protocol. + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(port_t port,const std::string& protocol,int depth = 20) { +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(port); + return Bind(ad, protocol, depth); + } + else +#endif +#endif + { + Ipv4Address ad(port); + return Bind(ad, protocol, depth); + } + } + + /** Bind and listen to specific interface. + \param intf Interface hostname + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(const std::string& intf,port_t port,int depth = 20) { +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + else +#endif +#endif + { + Ipv4Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + } + + /** Bind and listen to specific interface. + \param intf Interface hostname + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(const std::string& intf,port_t port,const std::string& protocol,int depth = 20) { +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (IsIpv6()) + { + Ipv6Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, protocol, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + else +#endif +#endif + { + Ipv4Address ad(intf, port); + if (ad.IsValid()) + { + return Bind(ad, protocol, depth); + } + Handler().LogError(this, "Bind", 0, "name resolution of interface name failed", LOG_LEVEL_FATAL); + return -1; + } + } + + /** Bind and listen to ipv4 interface. + \param a Ipv4 interface address + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(ipaddr_t a,port_t port,int depth = 20) { + Ipv4Address ad(a, port); +#ifdef USE_SCTP + if (dynamic_cast(m_creator)) + { + return Bind(ad, "sctp", depth); + } +#endif + return Bind(ad, "tcp", depth); + } + /** Bind and listen to ipv4 interface. + \param a Ipv4 interface address + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(ipaddr_t a,port_t port,const std::string& protocol,int depth) { + Ipv4Address ad(a, port); + return Bind(ad, protocol, depth); + } + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Bind and listen to ipv6 interface. + \param a Ipv6 interface address + \param port Port (0 is random) + \param depth Listen queue depth */ + int Bind(in6_addr a,port_t port,int depth = 20) { + Ipv6Address ad(a, port); +#ifdef USE_SCTP + if (dynamic_cast(m_creator)) + { + return Bind(ad, "sctp", depth); + } +#endif + return Bind(ad, "tcp", depth); + } + /** Bind and listen to ipv6 interface. + \param a Ipv6 interface address + \param port Port (0 is random) + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(in6_addr a,port_t port,const std::string& protocol,int depth) { + Ipv6Address ad(a, port); + return Bind(ad, protocol, depth); + } +#endif +#endif + + /** Bind and listen to network interface. + \param ad Interface address + \param protocol Network protocol + \param depth Listen queue depth */ + int Bind(SocketAddress& ad,const std::string& protocol,int depth) { + SOCKET s; + if ( (s = CreateSocket(ad.GetFamily(), SOCK_STREAM, protocol)) == INVALID_SOCKET) + { + return -1; + } + if (bind(s, ad, ad) == -1) + { + Handler().LogError(this, "bind", Errno, StrError(Errno), LOG_LEVEL_FATAL); + closesocket(s); +#ifdef ENABLE_EXCEPTIONS + throw Exception("bind() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); +#endif + return -1; + } + if (listen(s, depth) == -1) + { + Handler().LogError(this, "listen", Errno, StrError(Errno), LOG_LEVEL_FATAL); + closesocket(s); +#ifdef ENABLE_EXCEPTIONS + throw Exception("listen() failed for port " + Utility::l2string(ad.GetPort()) + ": " + StrError(Errno)); +#endif + return -1; + } + m_depth = depth; + Attach(s); + return 0; + } + + /** Return assigned port number. */ + port_t GetPort() + { + return GetSockPort(); + } + + /** Return listen queue depth. */ + int GetDepth() + { + return m_depth; + } + + /** OnRead on a ListenSocket receives an incoming connection. */ + void OnRead() + { + struct sockaddr sa; + socklen_t sa_len = sizeof(struct sockaddr); + SOCKET a_s = accept(GetSocket(), &sa, &sa_len); + + if (a_s == INVALID_SOCKET) + { + Handler().LogError(this, "accept", Errno, StrError(Errno), LOG_LEVEL_ERROR); + return; + } + if (!Handler().OkToAccept(this)) + { + Handler().LogError(this, "accept", -1, "Not OK to accept", LOG_LEVEL_WARNING); + closesocket(a_s); + return; + } + if (Handler().GetCount() >= FD_SETSIZE) + { + Handler().LogError(this, "accept", (int)Handler().GetCount(), "ISocketHandler fd_set limit reached", LOG_LEVEL_FATAL); + closesocket(a_s); + return; + } + Socket *tmp = m_bHasCreate ? m_creator -> Create() : new X(Handler()); +#ifdef ENABLE_IPV6 + tmp -> SetIpv6( IsIpv6() ); +#endif + tmp -> SetParent(this); + tmp -> Attach(a_s); + tmp -> SetNonblocking(true); + { +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + if (sa_len == sizeof(struct sockaddr_in6)) + { + struct sockaddr_in6 *p = (struct sockaddr_in6 *)&sa; + if (p -> sin6_family == AF_INET6) + { + Ipv6Address ad(p -> sin6_addr,ntohs(p -> sin6_port)); + ad.SetFlowinfo(p -> sin6_flowinfo); +#ifndef _WIN32 + ad.SetScopeId(p -> sin6_scope_id); +#endif + tmp -> SetRemoteAddress(ad); + } + } +#endif +#endif + if (sa_len == sizeof(struct sockaddr_in)) + { + struct sockaddr_in *p = (struct sockaddr_in *)&sa; + if (p -> sin_family == AF_INET) + { + Ipv4Address ad(p -> sin_addr,ntohs(p -> sin_port)); + tmp -> SetRemoteAddress(ad); + } + } + } + tmp -> SetConnected(true); + tmp -> Init(); + tmp -> SetDeleteByHandler(true); + Handler().Add(tmp); +#ifdef HAVE_OPENSSL + if (tmp -> IsSSL()) // SSL Enabled socket + { + // %! OnSSLAccept calls SSLNegotiate that can finish in this one call. + // %! If that happens and negotiation fails, the 'tmp' instance is + // %! still added to the list of active sockets in the sockethandler. + // %! See bugfix for this in SocketHandler::Select - don't Set rwx + // %! flags if CloseAndDelete() flag is true. + // %! An even better fugbix (see TcpSocket::OnSSLAccept) now avoids + // %! the Add problem altogether, so ignore the above. + // %! (OnSSLAccept does no longer call SSLNegotiate().) + tmp -> OnSSLAccept(); + } + else +#endif + { + tmp -> OnAccept(); + } + } + + /** Please don't use this method. + "accept()" is handled automatically in the OnRead() method. */ + virtual SOCKET Accept(SOCKET socket, struct sockaddr *saptr, socklen_t *lenptr) + { + return accept(socket, saptr, lenptr); + } + + bool HasCreator() { return m_bHasCreate; } + + void OnOptions(int,int,int,SOCKET) { + SetSoReuseaddr(true); + } + +protected: + ListenSocket(const ListenSocket& s) : Socket(s) {} +private: + ListenSocket& operator=(const ListenSocket& ) { return *this; } + int m_depth; + X *m_creator; + bool m_bHasCreate; +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_ListenSocket_H + + diff --git a/externals/sockets/include/Lock.h b/externals/sockets/include/Lock.h new file mode 100644 index 0000000..f3bb927 --- /dev/null +++ b/externals/sockets/include/Lock.h @@ -0,0 +1,58 @@ +/** \file Lock.h + ** \date 2005-08-22 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2005,2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Lock_H +#define _SOCKETS_Lock_H + +#include "sockets-config.h" +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +class Mutex; + +/** Mutex encapsulation class. + \ingroup threading */ +class Lock +{ +public: + Lock(Mutex&); + ~Lock(); + +private: + Mutex& m_mutex; +}; + + +#ifdef SOCKETS_NAMESPACE +} +#endif +#endif // _SOCKETS_Lock_H + + diff --git a/externals/sockets/include/Mutex.h b/externals/sockets/include/Mutex.h new file mode 100644 index 0000000..e42a57c --- /dev/null +++ b/externals/sockets/include/Mutex.h @@ -0,0 +1,68 @@ +/** \file Mutex.h + ** \date 2004-10-30 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Mutex_H +#define _SOCKETS_Mutex_H + +#include "sockets-config.h" +#ifndef _WIN32 +#include +#else +#include +#endif + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** Mutex container class, used by Lock. + \ingroup threading */ +class Mutex +{ + friend class Lock; +public: + Mutex(); + ~Mutex(); + + void Lock(); + void Unlock(); +private: +#ifdef _WIN32 + HANDLE m_mutex; +#else + pthread_mutex_t m_mutex; +#endif +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif +#endif // _SOCKETS_Mutex_H + + diff --git a/externals/sockets/include/Parse.h b/externals/sockets/include/Parse.h new file mode 100644 index 0000000..52bd932 --- /dev/null +++ b/externals/sockets/include/Parse.h @@ -0,0 +1,100 @@ +/** \file Parse.h - parse a string + ** + ** Written: 1999-Feb-10 grymse@alhem.net + **/ + +/* +Copyright (C) 1999-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _SOCKETS_Parse_H +#define _SOCKETS_Parse_H + +#include "sockets-config.h" +#ifdef _MSC_VER +#pragma warning(disable:4514) +#endif + +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/***************************************************/ +/* interface of class Parse */ + +/** Splits a string whatever way you want. + \ingroup util */ +class Parse +{ +public: + Parse(); + Parse(const std::string&); + Parse(const std::string&,const std::string&); + Parse(const std::string&,const std::string&,short); + ~Parse(); + short issplit(const char); + void getsplit(); + void getsplit(std::string&); + std::string getword(); + void getword(std::string&); + void getword(std::string&,std::string&,int); + std::string getrest(); + void getrest(std::string&); + long getvalue(); + void setbreak(const char); + int getwordlen(); + int getrestlen(); + void enablebreak(const char c) { + pa_enable = c; + } + void disablebreak(const char c) { + pa_disable = c; + } + void getline(); + void getline(std::string&); + size_t getptr() { return pa_the_ptr; } + void EnableQuote(bool b) { pa_quote = b; } + +private: + std::string pa_the_str; + std::string pa_splits; + std::string pa_ord; + size_t pa_the_ptr; + char pa_breakchar; + char pa_enable; + char pa_disable; + short pa_nospace; + bool pa_quote; +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_Parse_H + + diff --git a/externals/sockets/include/ResolvServer.h b/externals/sockets/include/ResolvServer.h new file mode 100644 index 0000000..409c9b7 --- /dev/null +++ b/externals/sockets/include/ResolvServer.h @@ -0,0 +1,72 @@ +/** \file ResolvServer.h + ** \date 2005-03-24 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_ResolvServer_H +#define _SOCKETS_ResolvServer_H +#include "sockets-config.h" +#ifdef ENABLE_RESOLVER +#include "socket_include.h" +#include "Thread.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** \defgroup async Asynchronous DNS */ +/** Async DNS resolver thread. + \ingroup async */ +class ResolvServer : public Thread +{ +public: + ResolvServer(port_t); + ~ResolvServer(); + + void Run(); + void Quit(); + + bool Ready(); + +private: + ResolvServer(const ResolvServer& ) {} // copy constructor + ResolvServer& operator=(const ResolvServer& ) { return *this; } // assignment operator + + bool m_quit; + port_t m_port; + bool m_ready; +}; + + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // ENABLE_RESOLVER +#endif // _SOCKETS_ResolvServer_H + + diff --git a/externals/sockets/include/ResolvSocket.h b/externals/sockets/include/ResolvSocket.h new file mode 100644 index 0000000..6074373 --- /dev/null +++ b/externals/sockets/include/ResolvSocket.h @@ -0,0 +1,105 @@ +/** \file ResolvSocket.h + ** \date 2005-03-24 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_ResolvSocket_H +#define _SOCKETS_ResolvSocket_H +#include "sockets-config.h" +#ifdef ENABLE_RESOLVER +#include "TcpSocket.h" +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +class Mutex; + +/** Async DNS resolver socket. + \ingroup async */ +class ResolvSocket : public TcpSocket +{ + typedef std::map > cache_t; /* host, result */ + typedef std::map > timeout_t; /* host, time */ + +public: + ResolvSocket(ISocketHandler&); + ResolvSocket(ISocketHandler&, Socket *parent, const std::string& host, port_t port, bool ipv6 = false); + ResolvSocket(ISocketHandler&, Socket *parent, ipaddr_t); +#ifdef ENABLE_IPV6 + ResolvSocket(ISocketHandler&, Socket *parent, in6_addr&); +#endif + ~ResolvSocket(); + + void OnAccept() { m_bServer = true; } + void OnLine(const std::string& line); + void OnDetached(); + void OnDelete(); + + void SetId(int x) { m_resolv_id = x; } + int GetId() { return m_resolv_id; } + + void OnConnect(); + +#ifdef ENABLE_IPV6 + void SetResolveIpv6(bool x = true) { m_resolve_ipv6 = x; } +#endif + +private: + ResolvSocket(const ResolvSocket& s) : TcpSocket(s) {} // copy constructor + ResolvSocket& operator=(const ResolvSocket& ) { return *this; } // assignment operator + + std::string m_query; + std::string m_data; + bool m_bServer; + Socket *m_parent; + int m_resolv_id; + std::string m_resolv_host; + port_t m_resolv_port; + ipaddr_t m_resolv_address; +#ifdef ENABLE_IPV6 + bool m_resolve_ipv6; + in6_addr m_resolv_address6; +#endif + static cache_t m_cache; + static timeout_t m_cache_to; + static Mutex m_cache_mutex; + bool m_cached; +}; + + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // ENABLE_RESOLVER +#endif // _SOCKETS_ResolvSocket_H + + diff --git a/externals/sockets/include/SctpSocket.h b/externals/sockets/include/SctpSocket.h new file mode 100644 index 0000000..ed507fb --- /dev/null +++ b/externals/sockets/include/SctpSocket.h @@ -0,0 +1,108 @@ +/** + ** \file SctpSocket.h + ** \date 2006-09-04 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_SctpSocket_H +#define _SOCKETS_SctpSocket_H +#include "sockets-config.h" + +#include "StreamSocket.h" +#ifdef USE_SCTP +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +#define SCTP_BUFSIZE_READ 16400 + +class SocketAddress; + +class SctpSocket : public StreamSocket +{ +public: + /** SctpSocket constructor. + \param h Owner + \param type SCTP_STREAM or SCTP_SEQPACKET */ + SctpSocket(ISocketHandler& h,int type); + ~SctpSocket(); + + /** bind() */ + int Bind(const std::string&,port_t); + int Bind(SocketAddress&); + /** sctp_bindx() */ + int AddAddress(const std::string&,port_t); + int AddAddress(SocketAddress&); + /** sctp_bindx() */ + int RemoveAddress(const std::string&,port_t); + int RemoveAddress(SocketAddress&); + + /** connect() */ + int Open(const std::string&,port_t); + int Open(SocketAddress&); + + /** Connect timeout callback. */ + void OnConnectTimeout(); +#ifdef _WIN32 + /** Connection failed reported as exception on win32 */ + void OnException(); +#endif + +#ifndef SOLARIS + /** sctp_connectx() */ + int AddConnection(const std::string&,port_t); + int AddConnection(SocketAddress&); +#endif + + /** Get peer addresses of an association. */ + int getpaddrs(sctp_assoc_t id,std::list&); + /** Get all bound addresses of an association. */ + int getladdrs(sctp_assoc_t id,std::list&); + + /** sctp_peeloff */ + int PeelOff(sctp_assoc_t id); + + /** recvmsg callback */ + virtual void OnReceiveMessage(const char *buf,size_t sz,struct sockaddr *sa,socklen_t sa_len,struct sctp_sndrcvinfo *sinfo,int msg_flags) = 0; + + void OnOptions(int,int,int,SOCKET) {} + + virtual int Protocol(); + +protected: + SctpSocket(const SctpSocket& s) : StreamSocket(s) {} + void OnRead(); + void OnWrite(); + +private: + SctpSocket& operator=(const SctpSocket& s) { return *this; } + int m_type; ///< SCTP_STREAM or SCTP_SEQPACKET + char *m_buf; ///< Temporary receive buffer +}; + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE +#endif + +#endif // USE_SCTP +#endif // _SOCKETS_SctpSocket_H + + diff --git a/externals/sockets/include/Socket.h b/externals/sockets/include/Socket.h new file mode 100644 index 0000000..23a806b --- /dev/null +++ b/externals/sockets/include/Socket.h @@ -0,0 +1,735 @@ +/** \file Socket.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This software is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Socket_H +#define _SOCKETS_Socket_H +#include "sockets-config.h" + +#include +#include +#include +#ifdef HAVE_OPENSSL +#include +#endif + +#include "socket_include.h" +#include +#include "SocketAddress.h" +#include "Thread.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +class ISocketHandler; +class SocketAddress; +class IFile; + +/** \defgroup basic Basic sockets */ +/** Socket base class. + \ingroup basic */ +class Socket +{ + friend class ISocketHandler; +#ifdef ENABLE_DETACH + /** Detached socket run thread. + \ingroup internal */ + class SocketThread : public Thread + { + public: + SocketThread(Socket *p); + ~SocketThread(); + + void Run(); + + private: + Socket *GetSocket() const { return m_socket; } + SocketThread(const SocketThread& s) : m_socket(s.GetSocket()) {} + SocketThread& operator=(const SocketThread& ) { return *this; } + Socket *m_socket; + }; +#endif // ENABLE_DETACH + +#ifdef ENABLE_TRIGGERS +public: + /** Data pass class from source to destination. */ + class TriggerData + { + public: + TriggerData() : m_src(NULL) {} + virtual ~TriggerData() {} + + Socket *GetSource() const { return m_src; } + void SetSource(Socket *x) { m_src = x; } + + private: + Socket *m_src; + }; +#endif // ENABLE_TRIGGERS + + /** Socket mode flags. */ +/* + enum { + // Socket + SOCK_DEL = 0x01, ///< Delete by handler flag + SOCK_CLOSE = 0x02, ///< Close and delete flag + SOCK_DISABLE_READ = 0x04, ///< Disable checking for read events + SOCK_CONNECTED = 0x08, ///< Socket is connected (tcp/udp) + + SOCK_ERASED_BY_HANDLER = 0x10, ///< Set by handler before delete + // HAVE_OPENSSL + SOCK_ENABLE_SSL = 0x20, ///< Enable SSL for this TcpSocket + SOCK_SSL = 0x40, ///< ssl negotiation mode (TcpSocket) + SOCK_SSL_SERVER = 0x80, ///< True if this is an incoming ssl TcpSocket connection + + // ENABLE_IPV6 + SOCK_IPV6 = 0x0100, ///< This is an ipv6 socket if this one is true + // ENABLE_POOL + SOCK_CLIENT = 0x0200, ///< only client connections are pooled + SOCK_RETAIN = 0x0400, ///< keep connection on close + SOCK_LOST = 0x0800, ///< connection lost + + // ENABLE_SOCKS4 + SOCK_SOCKS4 = 0x1000, ///< socks4 negotiation mode (TcpSocket) + // ENABLE_DETACH + SOCK_DETACH = 0x2000, ///< Socket ordered to detach flag + SOCK_DETACHED = 0x4000, ///< Socket has been detached + // StreamSocket + STREAMSOCK_CONNECTING = 0x8000, ///< Flag indicating connection in progress + + STREAMSOCK_FLUSH_BEFORE_CLOSE = 0x010000L, ///< Send all data before closing (default true) + STREAMSOCK_CALL_ON_CONNECT = 0x020000L, ///< OnConnect will be called next ISocketHandler cycle if true + STREAMSOCK_RETRY_CONNECT = 0x040000L, ///< Try another connection attempt next ISocketHandler cycle + STREAMSOCK_LINE_PROTOCOL = 0x080000L, ///< Line protocol mode flag + + }; +*/ + +public: + /** "Default" constructor */ + Socket(ISocketHandler&); + + virtual ~Socket(); + + /** Socket class instantiation method. Used when a "non-standard" constructor + * needs to be used for the socket class. Note: the socket class still needs + * the "default" constructor with one ISocketHandler& as input parameter. + */ + virtual Socket *Create() { return NULL; } + + /** Returns reference to sockethandler that owns the socket. + If the socket is detached, this is a reference to the slave sockethandler. + */ + ISocketHandler& Handler() const; + + /** Returns reference to sockethandler that owns the socket. + This one always returns the reference to the original sockethandler, + even if the socket is detached. + */ + ISocketHandler& MasterHandler() const; + + /** Called by ListenSocket after accept but before socket is added to handler. + * CTcpSocket uses this to create its ICrypt member variable. + * The ICrypt member variable is created by a virtual method, therefore + * it can't be called directly from the CTcpSocket constructor. + * Also used to determine if incoming HTTP connection is normal (port 80) + * or ssl (port 443). + */ + virtual void Init(); + + /** Create a socket file descriptor. + \param af Address family AF_INET / AF_INET6 / ... + \param type SOCK_STREAM / SOCK_DGRAM / ... + \param protocol "tcp" / "udp" / ... */ + SOCKET CreateSocket(int af,int type,const std::string& protocol = ""); + + /** Assign this socket a file descriptor created + by a call to socket() or otherwise. */ + void Attach(SOCKET s); + + /** Return file descriptor assigned to this socket. */ + SOCKET GetSocket(); + + /** Close connection immediately - internal use. + \sa SetCloseAndDelete */ + virtual int Close(); + + /** Add file descriptor to sockethandler fd_set's. */ + void Set(bool bRead,bool bWrite,bool bException = true); + + /** Returns true when socket file descriptor is valid + and socket is not about to be closed. */ + virtual bool Ready(); + + /** Returns pointer to ListenSocket that created this instance + * on an incoming connection. */ + Socket *GetParent(); + + /** Used by ListenSocket to set parent pointer of newly created + * socket instance. */ + void SetParent(Socket *); + + /** Get listening port from ListenSocket<>. */ + virtual port_t GetPort(); + + /** Set socket non-block operation. */ + bool SetNonblocking(bool); + + /** Set socket non-block operation. */ + bool SetNonblocking(bool, SOCKET); + + /** Total lifetime of instance. */ + time_t Uptime(); + + /** Set address/port of last connect() call. */ + void SetClientRemoteAddress(SocketAddress&); + + /** Get address/port of last connect() call. */ + std::auto_ptr GetClientRemoteAddress(); + + /** Common interface for SendBuf used by Tcp and Udp sockets. */ + virtual void SendBuf(const char *,size_t,int = 0); + + /** Common interface for Send used by Tcp and Udp sockets. */ + virtual void Send(const std::string&,int = 0); + + /** Outgoing traffic counter. */ + virtual uint64_t GetBytesSent(bool clear = false); + + /** Incoming traffic counter. */ + virtual uint64_t GetBytesReceived(bool clear = false); + + // LIST_TIMEOUT + + /** Enable timeout control. 0=disable timeout check. */ + void SetTimeout(time_t secs); + + /** Check timeout. \return true if time limit reached */ + bool Timeout(time_t tnow); + + /** Used by ListenSocket. ipv4 and ipv6 */ + void SetRemoteAddress(SocketAddress&); + + /** \name Event callbacks */ + //@{ + + /** Called when there is something to be read from the file descriptor. */ + virtual void OnRead(); + /** Called when there is room for another write on the file descriptor. */ + virtual void OnWrite(); + /** Called on socket exception. */ + virtual void OnException(); + /** Called before a socket class is deleted by the ISocketHandler. */ + virtual void OnDelete(); + /** Called when a connection has completed. */ + virtual void OnConnect(); + /** Called when an incoming connection has been completed. */ + virtual void OnAccept(); + /** Called when a complete line has been read and the socket is in + * line protocol mode. */ + virtual void OnLine(const std::string& ); + /** Called on connect timeout (5s). */ + virtual void OnConnectFailed(); + /** Called when a client socket is created, to set socket options. + \param family AF_INET, AF_INET6, etc + \param type SOCK_STREAM, SOCK_DGRAM, etc + \param protocol Protocol number (tcp, udp, sctp, etc) + \param s Socket file descriptor + */ + virtual void OnOptions(int family,int type,int protocol,SOCKET s) = 0; + /** Connection retry callback - return false to abort connection attempts */ + virtual bool OnConnectRetry(); +#ifdef ENABLE_RECONNECT + /** a reconnect has been made */ + virtual void OnReconnect(); +#endif + /** TcpSocket: When a disconnect has been detected (recv/SSL_read returns 0 bytes). */ + virtual void OnDisconnect(); + /** Timeout callback. */ + virtual void OnTimeout(); + /** Connection timeout. */ + virtual void OnConnectTimeout(); + //@} + + /** \name Socket mode flags, set/reset */ + //@{ + /** Set delete by handler true when you want the sockethandler to + delete the socket instance after use. */ + void SetDeleteByHandler(bool = true); + /** Check delete by handler flag. + \return true if this instance should be deleted by the sockethandler */ + bool DeleteByHandler(); + + // LIST_CLOSE - conditional event queue + + /** Set close and delete to terminate the connection. */ + void SetCloseAndDelete(bool = true); + /** Check close and delete flag. + \return true if this socket should be closed and the instance removed */ + bool CloseAndDelete(); + + /** Return number of seconds since socket was ordered to close. \sa SetCloseAndDelete */ + time_t TimeSinceClose(); + + /** Ignore read events for an output only socket. */ + void DisableRead(bool x = true); + /** Check ignore read events flag. + \return true if read events should be ignored */ + bool IsDisableRead(); + + /** Set connected status. */ + void SetConnected(bool = true); + /** Check connected status. + \return true if connected */ + bool IsConnected(); + + /** Connection lost - error while reading/writing from a socket - TcpSocket only. */ + void SetLost(); + /** Check connection lost status flag, used by TcpSocket only. + \return true if there was an error while r/w causing the socket to close */ + bool Lost(); + + /** Set flag indicating the socket is being actively deleted by the sockethandler. */ + void SetErasedByHandler(bool x = true); + /** Get value of flag indicating socket is deleted by sockethandler. */ + bool ErasedByHandler(); + + //@} + + /** \name Information about remote connection */ + //@{ + /** Returns address of remote end. */ + std::auto_ptr GetRemoteSocketAddress(); + /** Returns address of remote end: ipv4. */ + ipaddr_t GetRemoteIP4(); +#ifdef ENABLE_IPV6 + /** Returns address of remote end: ipv6. */ +#ifdef IPPROTO_IPV6 + struct in6_addr GetRemoteIP6(); +#endif +#endif + /** Returns remote port number: ipv4 and ipv6. */ + port_t GetRemotePort(); + /** Returns remote ip as string? ipv4 and ipv6. */ + std::string GetRemoteAddress(); + /** ipv4 and ipv6(not implemented) */ + std::string GetRemoteHostname(); + //@} + + /** Returns local port number for bound socket file descriptor. */ + port_t GetSockPort(); + /** Returns local ipv4 address for bound socket file descriptor. */ + ipaddr_t GetSockIP4(); + /** Returns local ipv4 address as text for bound socket file descriptor. */ + std::string GetSockAddress(); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Returns local ipv6 address for bound socket file descriptor. */ + struct in6_addr GetSockIP6(); + /** Returns local ipv6 address as text for bound socket file descriptor. */ + std::string GetSockAddress6(); +#endif +#endif + // -------------------------------------------------------------------------- + /** @name IP options + When an ip or socket option is available on all of the operating systems + I'm testing on (linux 2.4.x, _win32, macosx, solaris9 intel) they are not + checked with an #ifdef below. + This might cause a compile error on other operating systems. */ + // -------------------------------------------------------------------------- + + // IP options + //@{ + + bool SetIpOptions(const void *p, socklen_t len); + bool SetIpTOS(unsigned char tos); + unsigned char IpTOS(); + bool SetIpTTL(int ttl); + int IpTTL(); + bool SetIpHdrincl(bool x = true); + bool SetIpMulticastTTL(int); + int IpMulticastTTL(); + bool SetMulticastLoop(bool x = true); + bool IpAddMembership(struct ip_mreq&); + bool IpDropMembership(struct ip_mreq&); + +#ifdef IP_PKTINFO + bool SetIpPktinfo(bool x = true); +#endif +#ifdef IP_RECVTOS + bool SetIpRecvTOS(bool x = true); +#endif +#ifdef IP_RECVTTL + bool SetIpRecvTTL(bool x = true); +#endif +#ifdef IP_RECVOPTS + bool SetIpRecvopts(bool x = true); +#endif +#ifdef IP_RETOPTS + bool SetIpRetopts(bool x = true); +#endif +#ifdef IP_RECVERR + bool SetIpRecverr(bool x = true); +#endif +#ifdef IP_MTU_DISCOVER + bool SetIpMtudiscover(bool x = true); +#endif +#ifdef IP_MTU + int IpMtu(); +#endif +#ifdef IP_ROUTER_ALERT + bool SetIpRouterAlert(bool x = true); +#endif +#ifdef LINUX + bool IpAddMembership(struct ip_mreqn&); +#endif +#ifdef LINUX + bool IpDropMembership(struct ip_mreqn&); +#endif + //@} + + // SOCKET options + /** @name Socket Options */ + //@{ + + bool SoAcceptconn(); + bool SetSoBroadcast(bool x = true); + bool SetSoDebug(bool x = true); + int SoError(); + bool SetSoDontroute(bool x = true); + bool SetSoLinger(int onoff, int linger); + bool SetSoOobinline(bool x = true); + bool SetSoRcvlowat(int); + bool SetSoSndlowat(int); + bool SetSoRcvtimeo(struct timeval&); + bool SetSoSndtimeo(struct timeval&); + bool SetSoRcvbuf(int); + int SoRcvbuf(); + bool SetSoSndbuf(int); + int SoSndbuf(); + int SoType(); + bool SetSoReuseaddr(bool x = true); + bool SetSoKeepalive(bool x = true); + +#ifdef SO_BSDCOMPAT + bool SetSoBsdcompat(bool x = true); +#endif +#ifdef SO_BINDTODEVICE + bool SetSoBindtodevice(const std::string& intf); +#endif +#ifdef SO_PASSCRED + bool SetSoPasscred(bool x = true); +#endif +#ifdef SO_PEERCRED + bool SoPeercred(struct ucred& ); +#endif +#ifdef SO_PRIORITY + bool SetSoPriority(int); +#endif +#ifdef SO_RCVBUFFORCE + bool SetSoRcvbufforce(int); +#endif +#ifdef SO_SNDBUFFORCE + bool SetSoSndbufforce(int); +#endif +#ifdef SO_TIMESTAMP + bool SetSoTimestamp(bool x = true); +#endif +#ifdef SO_NOSIGPIPE + bool SetSoNosigpipe(bool x = true); +#endif + //@} + + // TCP options in TcpSocket.h/TcpSocket.cpp + +#ifdef HAVE_OPENSSL + /** @name SSL Support */ + //@{ + /** SSL client/server support - internal use. \sa TcpSocket */ + virtual void OnSSLConnect(); + /** SSL client/server support - internal use. \sa TcpSocket */ + virtual void OnSSLAccept(); + /** SSL negotiation failed for client connect. */ + virtual void OnSSLConnectFailed(); + /** SSL negotiation failed for server accept. */ + virtual void OnSSLAcceptFailed(); + /** new SSL support */ + virtual bool SSLNegotiate(); + /** Check if SSL is Enabled for this TcpSocket. + \return true if this is a TcpSocket with SSL enabled */ + bool IsSSL(); + /** Enable SSL operation for a TcpSocket. */ + void EnableSSL(bool x = true); + /** Still negotiating ssl connection. + \return true if ssl negotiating is still in progress */ + bool IsSSLNegotiate(); + /** Set flag indicating ssl handshaking still in progress. */ + void SetSSLNegotiate(bool x = true); + /** OnAccept called with SSL Enabled. + \return true if this is a TcpSocket with an incoming SSL connection */ + bool IsSSLServer(); + /** Set flag indicating that this is a TcpSocket with incoming SSL connection. */ + void SetSSLServer(bool x = true); + /** SSL; Get pointer to ssl context structure. */ + virtual SSL_CTX *GetSslContext() { return NULL; } + /** SSL; Get pointer to ssl structure. */ + virtual SSL *GetSsl() { return NULL; } + //@} +#endif // HAVE_OPENSSL + +#ifdef ENABLE_IPV6 + /** Enable ipv6 for this socket. */ + void SetIpv6(bool x = true); + /** Check ipv6 socket. + \return true if this is an ipv6 socket */ + bool IsIpv6(); +#endif + +#ifdef ENABLE_POOL + /** @name Connection Pool */ + //@{ + /** Client = connecting TcpSocket. */ + void SetIsClient(); + /** Socket type from socket() call. */ + void SetSocketType(int x); + /** Socket type from socket() call. */ + int GetSocketType(); + /** Protocol type from socket() call. */ + void SetSocketProtocol(const std::string& x); + /** Protocol type from socket() call. */ + const std::string& GetSocketProtocol(); + /** Instruct a client socket to stay open in the connection pool after use. + If you have connected to a server using tcp, you can call SetRetain + to leave the connection open after your socket instance has been deleted. + The next connection you make to the same server will reuse the already + opened connection, if it is still available. + */ + void SetRetain(); + /** Check retain flag. + \return true if the socket should be moved to connection pool after use */ + bool Retain(); + /** Copy connection parameters from sock. */ + void CopyConnection(Socket *sock); + //@} +#endif // ENABLE_POOL + +#ifdef ENABLE_SOCKS4 + /** \name Socks4 support */ + //@{ + /** Socks4 client support internal use. \sa TcpSocket */ + virtual void OnSocks4Connect(); + /** Socks4 client support internal use. \sa TcpSocket */ + virtual void OnSocks4ConnectFailed(); + /** Socks4 client support internal use. \sa TcpSocket */ + virtual bool OnSocks4Read(); + /** Called when the last write caused the tcp output buffer to + * become empty. */ + /** socket still in socks4 negotiation mode */ + bool Socks4(); + /** Set flag indicating Socks4 handshaking in progress */ + void SetSocks4(bool x = true); + + /** Set socks4 server host address to use */ + void SetSocks4Host(ipaddr_t a); + /** Set socks4 server hostname to use. */ + void SetSocks4Host(const std::string& ); + /** Socks4 server port to use. */ + void SetSocks4Port(port_t p); + /** Provide a socks4 userid if required by the socks4 server. */ + void SetSocks4Userid(const std::string& x); + /** Get the ip address of socks4 server to use. + \return socks4 server host address */ + ipaddr_t GetSocks4Host(); + /** Get the socks4 server port to use. + \return socks4 server port */ + port_t GetSocks4Port(); + /** Get socks4 userid. + \return Socks4 userid */ + const std::string& GetSocks4Userid(); + //@} +#endif // ENABLE_SOCKS4 + +#ifdef ENABLE_RESOLVER + /** \name Asynchronous Resolver */ + //@{ + /** Request an asynchronous dns resolution. + \param host hostname to be resolved + \param port port number passed along for the ride + \return Resolve ID */ + int Resolve(const std::string& host,port_t port = 0); +#ifdef ENABLE_IPV6 + int Resolve6(const std::string& host, port_t port = 0); +#endif + /** Callback returning a resolved address. + \param id Resolve ID from Resolve call + \param a resolved ip address + \param port port number passed to Resolve */ + virtual void OnResolved(int id,ipaddr_t a,port_t port); +#ifdef ENABLE_IPV6 + virtual void OnResolved(int id,in6_addr& a,port_t port); +#endif + /** Request asynchronous reverse dns lookup. + \param a in_addr to be translated */ + int Resolve(ipaddr_t a); +#ifdef ENABLE_IPV6 + int Resolve(in6_addr& a); +#endif + /** Callback returning reverse resolve results. + \param id Resolve ID + \param name Resolved hostname */ + virtual void OnReverseResolved(int id,const std::string& name); + /** Callback indicating failed dns lookup. + \param id Resolve ID */ + virtual void OnResolveFailed(int id); + //@} +#endif // ENABLE_RESOLVER + +#ifdef ENABLE_DETACH + /** \name Thread Support */ + //@{ + /** Callback fires when a new socket thread has started and this + socket is ready for operation again. + \sa ResolvSocket */ + virtual void OnDetached(); + + // LIST_DETACH + + /** Internal use. */ + void SetDetach(bool x = true); + /** Check detach flag. + \return true if the socket should detach to its own thread */ + bool IsDetach(); + + /** Internal use. */ + void SetDetached(bool x = true); + /** Check detached flag. + \return true if the socket runs in its own thread. */ + const bool IsDetached() const; + /** Order this socket to start its own thread and call OnDetached + when ready for operation. */ + bool Detach(); + /** Store the slave sockethandler pointer. */ + void SetSlaveHandler(ISocketHandler *); + /** Create new thread for this socket to run detached in. */ + void DetachSocket(); + //@} +#endif // ENABLE_DETACH + + /** Write traffic to an IFile. Socket will not delete this object. */ + void SetTrafficMonitor(IFile *p) { m_traffic_monitor = p; } + +#ifdef ENABLE_TRIGGERS + /** \name Triggers */ + //@{ + /** Subscribe to trigger id. */ + void Subscribe(int id); + /** Unsubscribe from trigger id. */ + void Unsubscribe(int id); + /** Trigger callback, with data passed from source to destination. */ + virtual void OnTrigger(int id, const TriggerData& data); + /** Trigger cancelled because source has been deleted (as in delete). */ + virtual void OnCancelled(int id); + //@} +#endif + +protected: + /** default constructor not available */ + Socket() : m_handler(m_handler) {} + /** copy constructor not available */ + Socket(const Socket& s) : m_handler(s.m_handler) {} + + /** assignment operator not available. */ + Socket& operator=(const Socket& ) { return *this; } + + /** All traffic will be written to this IFile, if set. */ + IFile *GetTrafficMonitor() { return m_traffic_monitor; } + +// unsigned long m_flags; ///< boolean flags, replacing old 'bool' members + +private: + ISocketHandler& m_handler; ///< Reference of ISocketHandler in control of this socket + SOCKET m_socket; ///< File descriptor + bool m_bDel; ///< Delete by handler flag + bool m_bClose; ///< Close and delete flag + time_t m_tCreate; ///< Time in seconds when this socket was created + Socket *m_parent; ///< Pointer to ListenSocket class, valid for incoming sockets + bool m_b_disable_read; ///< Disable checking for read events + bool m_connected; ///< Socket is connected (tcp/udp) + bool m_b_erased_by_handler; ///< Set by handler before delete + time_t m_tClose; ///< Time in seconds when ordered to close + std::auto_ptr m_client_remote_address; ///< Address of last connect() + std::auto_ptr m_remote_address; ///< Remote end address + IFile *m_traffic_monitor; + time_t m_timeout_start; ///< Set by SetTimeout + time_t m_timeout_limit; ///< Defined by SetTimeout + bool m_bLost; ///< connection lost + +#ifdef _WIN32 +static WSAInitializer m_winsock_init; ///< Winsock initialization singleton class +#endif + +#ifdef HAVE_OPENSSL + bool m_b_enable_ssl; ///< Enable SSL for this TcpSocket + bool m_b_ssl; ///< ssl negotiation mode (TcpSocket) + bool m_b_ssl_server; ///< True if this is an incoming ssl TcpSocket connection +#endif + +#ifdef ENABLE_IPV6 + bool m_ipv6; ///< This is an ipv6 socket if this one is true +#endif + +#ifdef ENABLE_POOL + int m_socket_type; ///< Type of socket, from socket() call + std::string m_socket_protocol; ///< Protocol, from socket() call + bool m_bClient; ///< only client connections are pooled + bool m_bRetain; ///< keep connection on close +#endif + +#ifdef ENABLE_SOCKS4 + bool m_bSocks4; ///< socks4 negotiation mode (TcpSocket) + ipaddr_t m_socks4_host; ///< socks4 server address + port_t m_socks4_port; ///< socks4 server port number + std::string m_socks4_userid; ///< socks4 server usedid +#endif + +#ifdef ENABLE_DETACH + bool m_detach; ///< Socket ordered to detach flag + bool m_detached; ///< Socket has been detached + SocketThread *m_pThread; ///< Detach socket thread class pointer + ISocketHandler *m_slave_handler; ///< Actual sockethandler while detached +#endif +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_Socket_H + + diff --git a/externals/sockets/include/SocketAddress.h b/externals/sockets/include/SocketAddress.h new file mode 100644 index 0000000..abdbbfd --- /dev/null +++ b/externals/sockets/include/SocketAddress.h @@ -0,0 +1,93 @@ +/** + ** \file SocketAddress.h + ** \date 2006-09-21 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_SocketAddress_H +#define _SOCKETS_SocketAddress_H + +#include "sockets-config.h" +#include +#include +#include "socket_include.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** + This class and its subclasses is intended to be used as replacement + for the internal data type 'ipaddr_t' and various implementations of + IPv6 addressing found throughout the library. + 'ipaddr_t' is an IPv4 address in network byte order. + 'port_t' is the portnumber in host byte order. + 'struct in6_addr' is an IPv6 address. + 'struct in_addr' is an IPv4 address. + \ingroup basic +*/ +class SocketAddress +{ +public: + virtual ~SocketAddress() {} + + /** Get a pointer to the address struct. */ + virtual operator struct sockaddr *() = 0; + + /** Get length of address struct. */ + virtual operator socklen_t() = 0; + + /** Compare two addresses. */ + virtual bool operator==(SocketAddress&) = 0; + + /** Set port number. + \param port Port number in host byte order */ + virtual void SetPort(port_t port) = 0; + + /** Get port number. + \return Port number in host byte order. */ + virtual port_t GetPort() = 0; + + /** Set socket address. + \param sa Pointer to either 'struct sockaddr_in' or 'struct sockaddr_in6'. */ + virtual void SetAddress(struct sockaddr *sa) = 0; + + /** Convert address to text. */ + virtual std::string Convert(bool include_port) = 0; + + /** Reverse lookup of address. */ + virtual std::string Reverse() = 0; + + /** Get address family. */ + virtual int GetFamily() = 0; + + /** Address structure is valid. */ + virtual bool IsValid() = 0; + + /** Get a copy of this SocketAddress object. */ + virtual std::auto_ptr GetCopy() = 0; +}; + + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif +#endif // _SOCKETS_SocketAddress_H + + diff --git a/externals/sockets/include/SocketHandler.h b/externals/sockets/include/SocketHandler.h new file mode 100644 index 0000000..5598ec4 --- /dev/null +++ b/externals/sockets/include/SocketHandler.h @@ -0,0 +1,265 @@ +/** \file SocketHandler.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_SocketHandler_H +#define _SOCKETS_SocketHandler_H + +#include "sockets-config.h" +#include +#include + +#include "socket_include.h" +#include "ISocketHandler.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +class Socket; +#ifdef ENABLE_RESOLVER +class ResolvServer; +#endif +class Mutex; + +/** Socket container class, event generator. + \ingroup basic */ +class SocketHandler : public ISocketHandler +{ +protected: + /** Map type for holding file descriptors/socket object pointers. */ + typedef std::map socket_m; + +public: + /** SocketHandler constructor. + \param log Optional log class pointer */ + SocketHandler(StdLog *log = NULL); + + /** SocketHandler threadsafe constructor. + \param mutex Externally declared mutex variable + \param log Optional log class pointer */ + SocketHandler(Mutex& mutex,StdLog *log = NULL); + + ~SocketHandler(); + + /** Get mutex reference for threadsafe operations. */ + Mutex& GetMutex() const; + + /** Register StdLog object for error callback. + \param log Pointer to log class */ + void RegStdLog(StdLog *log); + + /** Log error to log class for print out / storage. */ + void LogError(Socket *p,const std::string& user_text,int err,const std::string& sys_err,loglevel_t t = LOG_LEVEL_WARNING); + + /** Add socket instance to socket map. Removal is always automatic. */ + void Add(Socket *); + + /** Get status of read/write/exception file descriptor set for a socket. */ + void Get(SOCKET s,bool& r,bool& w,bool& e); + + /** Set read/write/exception file descriptor sets (fd_set). */ + void Set(SOCKET s,bool bRead,bool bWrite,bool bException = true); + + /** Wait for events, generate callbacks. */ + int Select(long sec,long usec); + + /** This method will not return until an event has been detected. */ + int Select(); + + /** Wait for events, generate callbacks. */ + int Select(struct timeval *tsel); + + /** Check that a socket really is handled by this socket handler. */ + bool Valid(Socket *); + + /** Return number of sockets handled by this handler. */ + size_t GetCount(); + + /** Override and return false to deny all incoming connections. + \param p ListenSocket class pointer (use GetPort to identify which one) */ + bool OkToAccept(Socket *p); + + /** Called by Socket when a socket changes state. */ + void AddList(SOCKET s,list_t which_one,bool add); + + // Connection pool +#ifdef ENABLE_POOL + /** Find available open connection (used by connection pool). */ + ISocketHandler::PoolSocket *FindConnection(int type,const std::string& protocol,SocketAddress&); + /** Enable connection pool (by default disabled). */ + void EnablePool(bool x = true); + /** Check pool status. + \return true if connection pool is enabled */ + bool PoolEnabled(); +#endif // ENABLE_POOL + + // Socks4 +#ifdef ENABLE_SOCKS4 + /** Set socks4 server ip that all new tcp sockets should use. */ + void SetSocks4Host(ipaddr_t); + /** Set socks4 server hostname that all new tcp sockets should use. */ + void SetSocks4Host(const std::string& ); + /** Set socks4 server port number that all new tcp sockets should use. */ + void SetSocks4Port(port_t); + /** Set optional socks4 userid. */ + void SetSocks4Userid(const std::string& ); + /** If connection to socks4 server fails, immediately try direct connection to final host. */ + void SetSocks4TryDirect(bool x = true); + /** Get socks4 server ip. + \return socks4 server ip */ + ipaddr_t GetSocks4Host(); + /** Get socks4 port number. + \return socks4 port number */ + port_t GetSocks4Port(); + /** Get socks4 userid (optional). + \return socks4 userid */ + const std::string& GetSocks4Userid(); + /** Check status of socks4 try direct flag. + \return true if direct connection should be tried if connection to socks4 server fails */ + bool Socks4TryDirect(); +#endif // ENABLE_SOCKS4 + + // DNS resolve server +#ifdef ENABLE_RESOLVER + /** Enable asynchronous DNS. + \param port Listen port of asynchronous dns server */ + void EnableResolver(port_t port = 16667); + /** Check resolver status. + \return true if resolver is enabled */ + bool ResolverEnabled(); + /** Queue a dns request. + \param host Hostname to be resolved + \param port Port number will be echoed in Socket::OnResolved callback */ + int Resolve(Socket *,const std::string& host,port_t port); +#ifdef ENABLE_IPV6 + int Resolve6(Socket *,const std::string& host,port_t port); +#endif + /** Do a reverse dns lookup. */ + int Resolve(Socket *,ipaddr_t a); +#ifdef ENABLE_IPV6 + int Resolve(Socket *,in6_addr& a); +#endif + /** Get listen port of asynchronous dns server. */ + port_t GetResolverPort(); + /** Resolver thread ready for queries. */ + bool ResolverReady(); + /** Returns true if the socket is waiting for a resolve event. */ + bool Resolving(Socket *); +#endif // ENABLE_RESOLVER + +#ifdef ENABLE_TRIGGERS + /** Fetch unique trigger id. */ + int TriggerID(Socket *src); + /** Subscribe socket to trigger id. */ + bool Subscribe(int id, Socket *dst); + /** Unsubscribe socket from trigger id. */ + bool Unsubscribe(int id, Socket *dst); + /** Execute OnTrigger for subscribed sockets. + \param id Trigger ID + \param data Data passed from source to destination + \param erase Empty trigger id source and destination maps if 'true', + Leave them in place if 'false' - if a trigger should be called many times */ + void Trigger(int id, Socket::TriggerData& data, bool erase = true); +#endif // ENABLE_TRIGGERS + +#ifdef ENABLE_DETACH + /** Indicates that the handler runs under SocketThread. */ + void SetSlave(bool x = true); + /** Indicates that the handler runs under SocketThread. */ + bool IsSlave(); +#endif + + /** Sanity check of those accursed lists. */ + void CheckSanity(); + +protected: + socket_m m_sockets; ///< Active sockets map + socket_m m_add; ///< Sockets to be added to sockets map + std::list m_delete; ///< Sockets to be deleted (failed when Add) + +protected: + StdLog *m_stdlog; ///< Registered log class, or NULL + Mutex& m_mutex; ///< Thread safety mutex + bool m_b_use_mutex; ///< Mutex correctly initialized + +private: + void CheckList(socket_v&,const std::string&); ///< Used by CheckSanity + /** Remove socket from socket map, used by Socket class. */ + void Remove(Socket *); + SOCKET m_maxsock; ///< Highest file descriptor + 1 in active sockets list + fd_set m_rfds; ///< file descriptor set monitored for read events + fd_set m_wfds; ///< file descriptor set monitored for write events + fd_set m_efds; ///< file descriptor set monitored for exceptions + int m_preverror; ///< debug select() error + int m_errcnt; ///< debug select() error + time_t m_tlast; ///< timeout control + + // state lists + socket_v m_fds; ///< Active file descriptor list + socket_v m_fds_erase; ///< File descriptors that are to be erased from m_sockets + socket_v m_fds_callonconnect; ///< checklist CallOnConnect +#ifdef ENABLE_DETACH + socket_v m_fds_detach; ///< checklist Detach +#endif + socket_v m_fds_timeout; ///< checklist timeout + socket_v m_fds_retry; ///< checklist retry client connect + socket_v m_fds_close; ///< checklist close and delete + +#ifdef ENABLE_SOCKS4 + ipaddr_t m_socks4_host; ///< Socks4 server host ip + port_t m_socks4_port; ///< Socks4 server port number + std::string m_socks4_userid; ///< Socks4 userid + bool m_bTryDirect; ///< Try direct connection if socks4 server fails +#endif +#ifdef ENABLE_RESOLVER + int m_resolv_id; ///< Resolver id counter + ResolvServer *m_resolver; ///< Resolver thread pointer + port_t m_resolver_port; ///< Resolver listen port + std::map m_resolve_q; ///< resolve queue +#endif +#ifdef ENABLE_POOL + bool m_b_enable_pool; ///< Connection pool enabled if true +#endif +#ifdef ENABLE_TRIGGERS + int m_next_trigger_id; ///< Unique trigger id counter + std::map m_trigger_src; ///< mapping trigger id to source socket + std::map > m_trigger_dst; ///< mapping trigger id to destination sockets +#endif +#ifdef ENABLE_DETACH + bool m_slave; ///< Indicates that this is a ISocketHandler run in SocketThread +#endif +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_SocketHandler_H + + diff --git a/externals/sockets/include/StdLog.h b/externals/sockets/include/StdLog.h new file mode 100644 index 0000000..3ff68d6 --- /dev/null +++ b/externals/sockets/include/StdLog.h @@ -0,0 +1,73 @@ +/** \file StdLog.h + ** \date 2004-06-01 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_StdLog_H +#define _SOCKETS_StdLog_H + +#include "sockets-config.h" +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** error level enum. */ +typedef enum +{ + LOG_LEVEL_WARNING = 0, + LOG_LEVEL_ERROR, + LOG_LEVEL_FATAL, + LOG_LEVEL_INFO +} loglevel_t; + +class ISocketHandler; +class Socket; + +/** \defgroup logging Log help classes */ +/** Log class interface. + \ingroup logging */ +class StdLog +{ +public: + virtual ~StdLog() {} + + virtual void error(ISocketHandler *,Socket *, + const std::string& user_text, + int err, + const std::string& sys_err, + loglevel_t = LOG_LEVEL_WARNING) = 0; +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_StdLog_H + + diff --git a/externals/sockets/include/StdoutLog.h b/externals/sockets/include/StdoutLog.h new file mode 100644 index 0000000..aeb25b3 --- /dev/null +++ b/externals/sockets/include/StdoutLog.h @@ -0,0 +1,55 @@ +/** \file StdoutLog.h + ** \date 2004-06-01 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_StdoutLog_H +#define _SOCKETS_StdoutLog_H + +#include "sockets-config.h" +#include "StdLog.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** StdLog implementation, logs to stdout. + \ingroup logging */ +class StdoutLog : public StdLog +{ +public: + void error(ISocketHandler *,Socket *,const std::string& call,int err,const std::string& sys_err,loglevel_t); +}; + + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_StdoutLog_H + + diff --git a/externals/sockets/include/StreamSocket.h b/externals/sockets/include/StreamSocket.h new file mode 100644 index 0000000..bcce10f --- /dev/null +++ b/externals/sockets/include/StreamSocket.h @@ -0,0 +1,124 @@ +#ifndef _StreamSocket_H +#define _StreamSocket_H + +#include "Socket.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** SOCK_STREAM Socket base class. + \ingroup basic */ +class StreamSocket : public Socket +{ +public: + StreamSocket(ISocketHandler& ); + ~StreamSocket(); + + /** Socket should Check Connect on next write event from select(). */ + void SetConnecting(bool = true); + + /** Check connecting flag. + \return true if the socket is still trying to connect */ + bool Connecting(); + + /** Returns true when socket file descriptor is valid, + socket connection is established, and socket is not about to + be closed. */ + bool Ready(); + + /** Set timeout to use for connection attempt. + \param x Timeout in seconds */ + void SetConnectTimeout(int x); + + /** Return number of seconds to wait for a connection. + \return Connection timeout (seconds) */ + int GetConnectTimeout(); + + /** Set flush before close to make a tcp socket completely empty its + output buffer before closing the connection. */ + void SetFlushBeforeClose(bool = true); + + /** Check flush before status. + \return true if the socket should send all data before closing */ + bool GetFlushBeforeClose(); + + /** Define number of connection retries (tcp only). + n = 0 - no retry + n > 0 - number of retries + n = -1 - unlimited retries */ + void SetConnectionRetry(int n); + + /** Get number of maximum connection retries (tcp only). */ + int GetConnectionRetry(); + + /** Increase number of actual connection retries (tcp only). */ + void IncreaseConnectionRetries(); + + /** Get number of actual connection retries (tcp only). */ + int GetConnectionRetries(); + + /** Reset actual connection retries (tcp only). */ + void ResetConnectionRetries(); + + // LIST_CALLONCONNECT + + /** Instruct socket to call OnConnect callback next sockethandler cycle. */ + void SetCallOnConnect(bool x = true); + + /** Check call on connect flag. + \return true if OnConnect() should be called a.s.a.p */ + bool CallOnConnect(); + + // LIST_RETRY + + /** Set flag to initiate a connection attempt after a connection timeout. */ + void SetRetryClientConnect(bool x = true); + + /** Check if a connection attempt should be made. + \return true when another attempt should be made */ + bool RetryClientConnect(); + + /** Called after OnRead if socket is in line protocol mode. + \sa SetLineProtocol */ + /** Enable the OnLine callback. Do not create your own OnRead + * callback when using this. */ + virtual void SetLineProtocol(bool = true); + + /** Check line protocol mode. + \return true if socket is in line protocol mode */ + bool LineProtocol(); + + /** Set shutdown status. */ + void SetShutdown(int); + + /** Get shutdown status. */ + int GetShutdown(); + + /** Returns IPPROTO_TCP or IPPROTO_SCTP */ + virtual int Protocol() = 0; + +protected: + StreamSocket(const StreamSocket& ) {} // copy constructor + +private: + StreamSocket& operator=(const StreamSocket& ) { return *this; } // assignment operator + + bool m_bConnecting; ///< Flag indicating connection in progress + int m_connect_timeout; ///< Connection timeout (seconds) + bool m_flush_before_close; ///< Send all data before closing (default true) + int m_connection_retry; ///< Maximum connection retries (tcp) + int m_retries; ///< Actual number of connection retries (tcp) + bool m_call_on_connect; ///< OnConnect will be called next ISocketHandler cycle if true + bool m_b_retry_connect; ///< Try another connection attempt next ISocketHandler cycle + bool m_line_protocol; ///< Line protocol mode flag + int m_shutdown; ///< Shutdown status +}; + +#ifdef SOCKETS_NAMESPACE +} // namespace SOCKETS_NAMESPACE { +#endif + +#endif // _StreamSocket_H + + diff --git a/externals/sockets/include/TcpSocket.h b/externals/sockets/include/TcpSocket.h new file mode 100644 index 0000000..de1be8b --- /dev/null +++ b/externals/sockets/include/TcpSocket.h @@ -0,0 +1,356 @@ +/** \file TcpSocket.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_TcpSocket_H +#define _SOCKETS_TcpSocket_H +#include "sockets-config.h" +#include "StreamSocket.h" +#ifdef HAVE_OPENSSL +#include +#include "SSLInitializer.h" +#endif + +#include + +#define TCP_BUFSIZE_READ 16400 +#define TCP_OUTPUT_CAPACITY 1024000 + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +class SocketAddress; + +/** Socket implementation for TCP. + \ingroup basic */ +class TcpSocket : public StreamSocket +{ + /** \defgroup internal Internal utility */ +protected: + /** Buffer class containing one read/write circular buffer. + \ingroup internal */ + class CircularBuffer + { + public: + CircularBuffer(size_t size); + ~CircularBuffer(); + + /** append l bytes from p to buffer */ + bool Write(const char *p,size_t l); + /** copy l bytes from buffer to dest */ + bool Read(char *dest,size_t l); + /** copy l bytes from buffer to dest, dont touch buffer pointers */ + bool SoftRead(char *dest, size_t l); + /** skip l bytes from buffer */ + bool Remove(size_t l); + /** read l bytes from buffer, returns as string. */ + std::string ReadString(size_t l); + + /** total buffer length */ + size_t GetLength(); + /** pointer to circular buffer beginning */ + const char *GetStart(); + /** return number of bytes from circular buffer beginning to buffer physical end */ + size_t GetL(); + /** return free space in buffer, number of bytes until buffer overrun */ + size_t Space(); + + /** return total number of bytes written to this buffer, ever */ + unsigned long ByteCounter(bool clear = false); + + private: + CircularBuffer(const CircularBuffer& /*s*/) {} + CircularBuffer& operator=(const CircularBuffer& ) { return *this; } + char *buf; + size_t m_max; + size_t m_q; + size_t m_b; + size_t m_t; + unsigned long m_count; + }; + /** Output buffer struct. + \ingroup internal */ + struct OUTPUT { + OUTPUT() : _b(0), _t(0), _q(0) {} + OUTPUT(const char *buf, size_t len) : _b(0), _t(len), _q(len) { + memcpy(_buf, buf, len); + } + size_t Space() { + return TCP_OUTPUT_CAPACITY - _t; + } + void Add(const char *buf, size_t len) { + memcpy(_buf + _t, buf, len); + _t += len; + _q += len; + } + size_t Remove(size_t len) { + _b += len; + _q -= len; + return _q; + } + const char *Buf() { + return _buf + _b; + } + size_t Len() { + return _q; + } + size_t _b; + size_t _t; + size_t _q; + char _buf[TCP_OUTPUT_CAPACITY]; + }; + typedef std::list output_l; + +public: + /** Constructor with standard values on input/output buffers. */ + TcpSocket(ISocketHandler& ); + /** Constructor with custom values for i/o buffer. + \param h ISocketHandler reference + \param isize Input buffer size + \param osize Output buffer size */ + TcpSocket(ISocketHandler& h,size_t isize,size_t osize); + ~TcpSocket(); + + /** Open a connection to a remote server. + If you want your socket to connect to a server, + always call Open before Add'ing a socket to the sockethandler. + If not, the connection attempt will not be monitored by the + socket handler... + \param ip IP address + \param port Port number + \param skip_socks Do not use socks4 even if configured */ + bool Open(ipaddr_t ip,port_t port,bool skip_socks = false); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Open connection. + \param ip Ipv6 address + \param port Port number + \param skip_socks Do not use socks4 even if configured */ + bool Open(in6_addr ip,port_t port,bool skip_socks = false); +#endif +#endif + bool Open(SocketAddress&,bool skip_socks = false); + bool Open(SocketAddress&,SocketAddress& bind_address,bool skip_socks = false); + /** Open connection. + \param host Hostname + \param port Port number */ + bool Open(const std::string &host,port_t port); + + /** Connect timeout callback. */ + void OnConnectTimeout(); +#ifdef _WIN32 + /** Connection failed reported as exception on win32 */ + void OnException(); +#endif + + /** Close file descriptor - internal use only. + \sa SetCloseAndDelete */ + int Close(); + + /** Send a string. + \param s String to send + \param f Dummy flags -- not used */ + void Send(const std::string &s,int f = 0); + /** Send string using printf formatting. */ + void Sendf(const char *format, ...); + /** Send buffer of bytes. + \param buf Buffer pointer + \param len Length of data + \param f Dummy flags -- not used */ + void SendBuf(const char *buf,size_t len,int f = 0); + /** This callback is executed after a successful read from the socket. + \param buf Pointer to the data + \param len Length of the data */ + virtual void OnRawData(const char *buf,size_t len); + + /** Called when output buffer has been sent. + Note: Will only be called IF the output buffer has been used. + Send's that was successful without needing the output buffer + will not generate a call to this method. */ + virtual void OnWriteComplete(); + /** Number of bytes in input buffer. */ + size_t GetInputLength(); + /** Number of bytes in output buffer. */ + size_t GetOutputLength(); + + /** Callback fires when a socket in line protocol has read one full line. + \param line Line read */ + void OnLine(const std::string& line); + /** Get counter of number of bytes received. */ + uint64_t GetBytesReceived(bool clear = false); + /** Get counter of number of bytes sent. */ + uint64_t GetBytesSent(bool clear = false); + + /** Socks4 specific callback. */ + void OnSocks4Connect(); + /** Socks4 specific callback. */ + void OnSocks4ConnectFailed(); + /** Socks4 specific callback. + \return 'need_more' */ + bool OnSocks4Read(); + +#ifdef ENABLE_RESOLVER + /** Callback executed when resolver thread has finished a resolve request. */ + void OnResolved(int id,ipaddr_t a,port_t port); +#ifdef ENABLE_IPV6 + void OnResolved(int id,in6_addr& a,port_t port); +#endif +#endif +#ifdef HAVE_OPENSSL + /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ + void OnSSLConnect(); + /** Callback for 'New' ssl support - replaces SSLSocket. Internal use. */ + void OnSSLAccept(); + /** This method must be implemented to initialize + the ssl context for an outgoing connection. */ + virtual void InitSSLClient(); + /** This method must be implemented to initialize + the ssl context for an incoming connection. */ + virtual void InitSSLServer(); +#endif + +#ifdef ENABLE_RECONNECT + /** Flag that says a broken connection will try to reconnect. */ + void SetReconnect(bool = true); + /** Check reconnect on lost connection flag status. */ + bool Reconnect(); + /** Flag to determine if a reconnect is in progress. */ + void SetIsReconnect(bool x = true); + /** Socket is reconnecting. */ + bool IsReconnect(); +#endif + + void DisableInputBuffer(bool = true); + + void OnOptions(int,int,int,SOCKET); + + void SetLineProtocol(bool = true); + + // TCP options + bool SetTcpNodelay(bool = true); + + virtual int Protocol(); + + /** Trigger limit for callback OnTransferLimit. */ + void SetTransferLimit(size_t sz); + /** This callback fires when the output buffer drops below the value + set by SetTransferLimit. Default: 0 (disabled). */ + virtual void OnTransferLimit(); + +protected: + TcpSocket(const TcpSocket& ); + void OnRead(); + void OnRead( char *buf, size_t n ); + void OnWrite(); +#ifdef HAVE_OPENSSL + /** SSL; Initialize ssl context for a client socket. + \param meth_in SSL method */ + void InitializeContext(const std::string& context, SSL_METHOD *meth_in = NULL); + /** SSL; Initialize ssl context for a server socket. + \param keyfile Combined private key/certificate file + \param password Password for private key + \param meth_in SSL method */ + void InitializeContext(const std::string& context, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); + /** SSL; Initialize ssl context for a server socket. + \param certfile Separate certificate file + \param keyfile Combined private key/certificate file + \param password Password for private key + \param meth_in SSL method */ + void InitializeContext(const std::string& context, const std::string& certfile, const std::string& keyfile, const std::string& password, SSL_METHOD *meth_in = NULL); + /** SSL; Password callback method. */ +static int SSL_password_cb(char *buf,int num,int rwflag,void *userdata); + /** SSL; Get pointer to ssl context structure. */ + virtual SSL_CTX *GetSslContext(); + /** SSL; Get pointer to ssl structure. */ + virtual SSL *GetSsl(); + /** ssl; still negotiating connection. */ + bool SSLNegotiate(); + /** SSL; Get ssl password. */ + const std::string& GetPassword(); +#endif + + CircularBuffer ibuf; ///< Circular input buffer + +private: + TcpSocket& operator=(const TcpSocket& ) { return *this; } + + /** the actual send() */ + int TryWrite(const char *buf, size_t len); + /** add data to output buffer top */ + void Buffer(const char *buf, size_t len); + + // + bool m_b_input_buffer_disabled; + uint64_t m_bytes_sent; + uint64_t m_bytes_received; + bool m_skip_c; ///< Skip second char of CRLF or LFCR sequence in OnRead + char m_c; ///< First char in CRLF or LFCR sequence + std::string m_line; ///< Current line in line protocol mode +#ifdef SOCKETS_DYNAMIC_TEMP + char *m_buf; ///< temporary read buffer +#endif + output_l m_obuf; ///< output buffer + OUTPUT *m_obuf_top; ///< output buffer on top + size_t m_transfer_limit; + size_t m_output_length; + +#ifdef HAVE_OPENSSL +static SSLInitializer m_ssl_init; + SSL_CTX *m_ssl_ctx; ///< ssl context + SSL *m_ssl; ///< ssl 'socket' + BIO *m_sbio; ///< ssl bio + std::string m_password; ///< ssl password +#endif + +#ifdef ENABLE_SOCKS4 + int m_socks4_state; ///< socks4 support + char m_socks4_vn; ///< socks4 support, temporary variable + char m_socks4_cd; ///< socks4 support, temporary variable + unsigned short m_socks4_dstport; ///< socks4 support + unsigned long m_socks4_dstip; ///< socks4 support +#endif + +#ifdef ENABLE_RESOLVER + int m_resolver_id; ///< Resolver id (if any) for current Open call +#endif + +#ifdef ENABLE_RECONNECT + bool m_b_reconnect; ///< Reconnect on lost connection flag + bool m_b_is_reconnect; ///< Trying to reconnect +#endif + +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_TcpSocket_H + + diff --git a/externals/sockets/include/Thread.h b/externals/sockets/include/Thread.h new file mode 100644 index 0000000..efb766e --- /dev/null +++ b/externals/sockets/include/Thread.h @@ -0,0 +1,100 @@ +/** \file Thread.h + ** \date 2004-10-30 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Thread_H +#define _SOCKETS_Thread_H + +#include "sockets-config.h" +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +#ifdef _WIN32 +// to be +//typedef DWORD threadfunc_t; +//typedef LPVOID threadparam_t; +//#define STDPREFIX WINAPI +typedef unsigned threadfunc_t; +typedef void * threadparam_t; +#define STDPREFIX __stdcall +#else +#include + +typedef void * threadfunc_t; +typedef void * threadparam_t; +#define STDPREFIX +#endif + +/** \defgroup threading Threading */ +/** Thread base class. +The Thread class is used by the resolver (ResolvServer) and running a detached socket (SocketThread). +When you know some processing will take a long time and will freeze up a socket, there is always the +possibility to call Detach() on that socket before starting the processing. +When the OnDetached() callback is later called the processing can continue, now in its own thread. + \ingroup threading */ +class Thread +{ +public: + Thread(bool release = true); + virtual ~Thread(); + + static threadfunc_t STDPREFIX StartThread(threadparam_t); + + virtual void Run() = 0; + + bool IsRunning(); + void SetRunning(bool x); + bool IsReleased(); + void SetRelease(bool x); + bool DeleteOnExit(); + void SetDeleteOnExit(bool x = true); + bool IsDestructor(); + +private: + Thread(const Thread& ) {} + Thread& operator=(const Thread& ) { return *this; } +#ifdef _WIN32 + HANDLE m_thread; + unsigned m_dwThreadId; +#else + pthread_t m_thread; +#endif + bool m_running; + bool m_release; + bool m_b_delete_on_exit; + bool m_b_destructor; +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_Thread_H + + diff --git a/externals/sockets/include/UdpSocket.h b/externals/sockets/include/UdpSocket.h new file mode 100644 index 0000000..3b06c69 --- /dev/null +++ b/externals/sockets/include/UdpSocket.h @@ -0,0 +1,215 @@ +/** \file UdpSocket.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_UdpSocket_H +#define _SOCKETS_UdpSocket_H + +#include "sockets-config.h" +#include "Socket.h" + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +/** Socket implementation for UDP. + \ingroup basic */ +class UdpSocket : public Socket +{ +public: + /** Constructor. + \param h ISocketHandler reference + \param ibufsz Maximum size of receive message (extra bytes will be truncated) + \param ipv6 'true' if this is an ipv6 socket */ + UdpSocket(ISocketHandler& h,int ibufsz = 16384,bool ipv6 = false, int retries = 0); + ~UdpSocket(); + + /** Called when incoming data has been received. + \param buf Pointer to data + \param len Length of data + \param sa Pointer to sockaddr struct of sender + \param sa_len Length of sockaddr struct */ + virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len); + + /** Called when incoming data has been received and read timestamp is enabled. + \param buf Pointer to data + \param len Length of data + \param sa Pointer to sockaddr struct of sender + \param sa_len Length of sockaddr struct + \param ts Timestamp from message */ + virtual void OnRawData(const char *buf,size_t len,struct sockaddr *sa,socklen_t sa_len,struct timeval *ts); + + /** To receive incoming data, call Bind to setup an incoming port. + \param port Incoming port number + \param range Port range to try if ports already in use + \return 0 if bind succeeded */ + int Bind(port_t& port,int range = 1); + /** To receive data on a specific interface:port, use this. + \param intf Interface ip/hostname + \param port Port number + \param range Port range + \return 0 if bind succeeded */ + int Bind(const std::string& intf,port_t& port,int range = 1); + /** To receive data on a specific interface:port, use this. + \param a Ip address + \param port Port number + \param range Port range + \return 0 if bind succeeded */ + int Bind(ipaddr_t a,port_t& port,int range = 1); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** To receive data on a specific interface:port, use this. + \param a Ipv6 address + \param port Port number + \param range Port range + \return 0 if bind succeeded */ + int Bind(in6_addr a,port_t& port,int range = 1); +#endif +#endif + /** To receive data on a specific interface:port, use this. + \param ad Socket address + \param range Port range + \return 0 if bind succeeded */ + int Bind(SocketAddress& ad,int range = 1); + + /** Define remote host. + \param l Address of remote host + \param port Port of remote host + \return true if successful */ + bool Open(ipaddr_t l,port_t port); + /** Define remote host. + \param host Hostname + \param port Port number + \return true if successful */ + bool Open(const std::string& host,port_t port); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Define remote host. + \param a Address of remote host, ipv6 + \param port Port of remote host + \return true if successful */ + bool Open(struct in6_addr& a,port_t port); +#endif +#endif + /** Define remote host. + \param ad Socket address + \return true if successful */ + bool Open(SocketAddress& ad); + + /** Send to specified host */ + void SendToBuf(const std::string& ,port_t,const char *data,int len,int flags = 0); + /** Send to specified address */ + void SendToBuf(ipaddr_t,port_t,const char *data,int len,int flags = 0); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Send to specified ipv6 address */ + void SendToBuf(in6_addr,port_t,const char *data,int len,int flags = 0); +#endif +#endif + /** Send to specified socket address */ + void SendToBuf(SocketAddress& ad,const char *data,int len,int flags = 0); + + /** Send string to specified host */ + void SendTo(const std::string&,port_t,const std::string&,int flags = 0); + /** Send string to specified address */ + void SendTo(ipaddr_t,port_t,const std::string&,int flags = 0); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Send string to specified ipv6 address */ + void SendTo(in6_addr,port_t,const std::string&,int flags = 0); +#endif +#endif + /** Send string to specified socket address */ + void SendTo(SocketAddress& ad,const std::string&,int flags = 0); + + /** Send to connected address */ + void SendBuf(const char *data,size_t,int flags = 0); + /** Send string to connected address. */ + void Send(const std::string& ,int flags = 0); + + /** Set broadcast */ + void SetBroadcast(bool b = true); + /** Check broadcast flag. + \return true broadcast is enabled. */ + bool IsBroadcast(); + + /** multicast */ + void SetMulticastTTL(int ttl = 1); + int GetMulticastTTL(); + void SetMulticastLoop(bool = true); + bool IsMulticastLoop(); + void AddMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); + void DropMulticastMembership(const std::string& group,const std::string& intf = "0.0.0.0",int if_index = 0); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** multicast, ipv6 only */ + void SetMulticastHops(int = -1); + /** multicast, ipv6 only */ + int GetMulticastHops(); +#endif +#endif + /** Returns true if Bind succeeded. */ + bool IsBound(); + /** Return Bind port number */ + port_t GetPort(); + + void OnOptions(int,int,int,SOCKET) {} + + int GetLastSizeWritten(); + + /** Also read timestamp information from incoming message */ + void SetTimestamp(bool = true); + +protected: + UdpSocket(const UdpSocket& s) : Socket(s) {} + void OnRead(); +#if defined(LINUX) || defined(MACOSX) + /** This method emulates socket recvfrom, but uses messages so we can get the timestamp */ + int ReadTS(char *ioBuf, int inBufSize, struct sockaddr *from, socklen_t fromlen, struct timeval *ts); +#endif + +private: + UdpSocket& operator=(const UdpSocket& ) { return *this; } + /** create before using sendto methods */ + void CreateConnection(); + char *m_ibuf; ///< Input buffer + int m_ibufsz; ///< Size of input buffer + bool m_bind_ok; ///< Bind completed successfully + port_t m_port; ///< Bind port number + int m_last_size_written; + int m_retries; + bool m_b_read_ts; +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_UdpSocket_H + + diff --git a/externals/sockets/include/Utility.h b/externals/sockets/include/Utility.h new file mode 100644 index 0000000..724a94e --- /dev/null +++ b/externals/sockets/include/Utility.h @@ -0,0 +1,186 @@ +/** \file Utility.h + ** \date 2004-02-13 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_Utility_H +#define _SOCKETS_Utility_H + +#include "sockets-config.h" +#include +#include +#include +#include "socket_include.h" +#include +#include + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +#define TWIST_LEN 624 + +class SocketAddress; + +/** Conversion utilities. + \ingroup util */ +class Utility +{ + /** + The Mersenne Twister + http://www.math.keio.ac.jp/~matumoto/emt.html + */ + class Rng { + public: + Rng(unsigned long seed); + + unsigned long Get(); + + private: + int m_value; + unsigned long m_tmp[TWIST_LEN]; + }; + class ncmap_compare { + public: + bool operator()(const std::string& x, const std::string& y) const { + return strcasecmp(x.c_str(), y.c_str()) < 0; + } + }; +public: + template class ncmap : public std::map { + public: + ncmap() {} + }; +public: + static std::string base64(const std::string& str_in); + static std::string base64d(const std::string& str_in); + static std::string l2string(long l); + static std::string bigint2string(uint64_t l); + static uint64_t atoi64(const std::string& str); + static unsigned int hex2unsigned(const std::string& str); + static std::string rfc1738_encode(const std::string& src); + static std::string rfc1738_decode(const std::string& src); + + /** Checks whether a string is a valid ipv4/ipv6 ip number. */ + static bool isipv4(const std::string&); + /** Checks whether a string is a valid ipv4/ipv6 ip number. */ + static bool isipv6(const std::string&); + + /** Hostname to ip resolution ipv4, not asynchronous. */ + static bool u2ip(const std::string&, ipaddr_t&); + static bool u2ip(const std::string&, struct sockaddr_in& sa, int ai_flags = 0); + +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Hostname to ip resolution ipv6, not asynchronous. */ + static bool u2ip(const std::string&, struct in6_addr&); + static bool u2ip(const std::string&, struct sockaddr_in6& sa, int ai_flags = 0); +#endif +#endif + + /** Reverse lookup of address to hostname */ + static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string&, int flags = 0); + static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags = 0); + + static bool u2service(const std::string& name, int& service, int ai_flags = 0); + + /** Convert binary ip address to string: ipv4. */ + static void l2ip(const ipaddr_t,std::string& ); + static void l2ip(const in_addr&,std::string& ); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Convert binary ip address to string: ipv6. */ + static void l2ip(const struct in6_addr&,std::string& ,bool mixed = false); + + /** ipv6 address compare. */ + static int in6_addr_compare(in6_addr,in6_addr); +#endif +#endif + /** ResolveLocal (hostname) - call once before calling any GetLocal method. */ + static void ResolveLocal(); + /** Returns local hostname, ResolveLocal must be called once before using. + \sa ResolveLocal */ + static const std::string& GetLocalHostname(); + /** Returns local ip, ResolveLocal must be called once before using. + \sa ResolveLocal */ + static ipaddr_t GetLocalIP(); + /** Returns local ip number as string. + \sa ResolveLocal */ + static const std::string& GetLocalAddress(); +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + /** Returns local ipv6 ip. + \sa ResolveLocal */ + static const struct in6_addr& GetLocalIP6(); + /** Returns local ipv6 address. + \sa ResolveLocal */ + static const std::string& GetLocalAddress6(); +#endif +#endif + /** Set environment variable. + \param var Name of variable to set + \param value Value */ + static void SetEnv(const std::string& var,const std::string& value); + /** Convert sockaddr struct to human readable string. + \param sa Ptr to sockaddr struct */ + static std::string Sa2String(struct sockaddr *sa); + + /** Get current time in sec/microseconds. */ + static void GetTime(struct timeval *); + + static std::auto_ptr CreateAddress(struct sockaddr *,socklen_t); + + static unsigned long ThreadID(); + + static std::string ToLower(const std::string& str); + static std::string ToUpper(const std::string& str); + + static std::string ToString(double d); + + /** Returns a random 32-bit integer */ + static unsigned long Rnd(); + +private: + static std::string m_host; ///< local hostname + static ipaddr_t m_ip; ///< local ip address + static std::string m_addr; ///< local ip address in string format +#ifdef ENABLE_IPV6 +#ifdef IPPROTO_IPV6 + static struct in6_addr m_local_ip6; ///< local ipv6 address +#endif + static std::string m_local_addr6; ///< local ipv6 address in string format +#endif + static bool m_local_resolved; ///< ResolveLocal has been called if true +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // _SOCKETS_Utility_H + + diff --git a/externals/sockets/include/socket_include.h b/externals/sockets/include/socket_include.h new file mode 100644 index 0000000..89855a5 --- /dev/null +++ b/externals/sockets/include/socket_include.h @@ -0,0 +1,290 @@ +/** \file socket_include.h + ** \date 2005-04-12 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_socket_include_H +#define _SOCKETS_socket_include_H +#include "sockets-config.h" + +#ifdef _MSC_VER +#pragma warning(disable:4514) +#endif + +// common defines affecting library and applications using library + +/* Define SOCKETS_DYNAMIC_TEMP to use dynamically allocated buffers + in read operations - helps on ECOS */ +#define SOCKETS_DYNAMIC_TEMP + +// platform specific stuff +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif +#include + +// int64 +#ifdef _WIN32 +typedef unsigned __int64 uint64_t; +#else +#include +#ifdef SOLARIS +# include +#else +# include +#endif +#endif + +#ifndef _WIN32 +// ---------------------------------------- +// common unix includes / defines +#include +#include +#include +#include +#include +#include +//#include + +// all typedefs in this file will be declared outside the sockets namespace, +// because some os's will already have one or more of the type defined. +typedef int SOCKET; +#define Errno errno +#define StrError strerror + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +// WIN32 adapt +#define closesocket close +#define INVALID_SOCKET -1 +#define SOCKET_ERROR -1 + +#ifndef INADDR_NONE +#define INADDR_NONE ((unsigned long) -1) +#endif // INADDR_NONE + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif // !_WIN32 + +// ---------------------------------------- +// Generic +#ifndef SOL_IP +#define SOL_IP IPPROTO_IP +#endif + +// ---------------------------------------- +// OS specific adaptions + +#ifdef SOLARIS +// ---------------------------------------- +// Solaris +typedef unsigned short port_t; +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif +// no defs + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#define s6_addr16 _S6_un._S6_u8 +#define MSG_NOSIGNAL 0 + +#elif defined __FreeBSD__ +// ---------------------------------------- +// FreeBSD +# if __FreeBSD_version >= 400014 +# define s6_addr16 __u6_addr.__u6_addr16 +# if !defined(MSG_NOSIGNAL) +# define MSG_NOSIGNAL 0 +# endif +# include +typedef in_addr_t ipaddr_t; +typedef in_port_t port_t; +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif +// no defs + +#ifdef SOCKETS_NAMESPACE +} +#endif + +# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +# else +# error FreeBSD versions prior to 400014 does not support ipv6 +# endif + +#elif defined (__NetBSD__) || defined (__OpenBSD__) +# if !defined(MSG_NOSIGNAL) +# define MSG_NOSIGNAL 0 +# endif +# include +typedef in_addr_t ipaddr_t; +typedef in_port_t port_t; +#elif defined MACOSX +// ---------------------------------------- +// Mac OS X +#include +#ifdef __DARWIN_UNIX03 +typedef unsigned short port_t; +#else +#include +#endif // __DARWIN_UNIX03 +typedef unsigned long ipaddr_t; +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif +// no defs + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#define s6_addr16 __u6_addr.__u6_addr16 +#define MSG_NOSIGNAL 0 // oops - thanks Derek +#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP + +#elif defined _WIN32 +// ---------------------------------------- +// Win32 +#ifdef _MSC_VER +#pragma comment(lib, "wsock32.lib") +#endif +#define strcasecmp _stricmp + +typedef unsigned long ipaddr_t; +typedef unsigned short port_t; +typedef int socklen_t; +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif +// no defs + +#ifdef SOCKETS_NAMESPACE +} +#endif + +// 1.8.6: define FD_SETSIZE to something bigger than 64 if there are a lot of +// simultaneous connections (must be done before including winsock.h) +#define FD_SETSIZE 1024 + +// windows 2000 with ipv6 preview installed: +// http://msdn.microsoft.com/downloads/sdks/platform/tpipv6.asp +// see the FAQ on how to install +#define WIN32_LEAN_AND_MEAN +#include +#include +#if _MSC_VER < 1200 +#ifndef __CYGWIN__ +#ifdef ENABLE_IPV6 +#include // For IPv6 Tech Preview. +#endif +#endif +#endif // _MSC_VER < 1200 + +#define MSG_NOSIGNAL 0 +//#define SHUT_RDWR 2 +#define SHUT_WR 1 + +#define Errno WSAGetLastError() +const char *StrError(int x); + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + +// class WSAInitializer is a part of the Socket class (on win32) +// as a static instance - so whenever an application uses a Socket, +// winsock is initialized +class WSAInitializer // Winsock Initializer +{ +public: + WSAInitializer() { + if (WSAStartup(0x101,&m_wsadata)) + { + exit(-1); + } + } + ~WSAInitializer() { + WSACleanup(); + } +private: + WSADATA m_wsadata; +}; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#else +// ---------------------------------------- +// LINUX +typedef unsigned long ipaddr_t; +typedef unsigned short port_t; +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif +// no defs + +#ifdef SOCKETS_NAMESPACE +} +#endif + +#endif + +#ifdef SOCKETS_NAMESPACE +namespace SOCKETS_NAMESPACE { +#endif + /** List type containing file descriptors. */ + typedef std::list socket_v; + +#ifdef SOCKETS_NAMESPACE +} +#endif + +// getaddrinfo / getnameinfo replacements +#ifdef NO_GETADDRINFO +#ifndef AI_NUMERICHOST +#define AI_NUMERICHOST 1 +#endif +#ifndef NI_NUMERICHOST +#define NI_NUMERICHOST 1 +#endif +#endif + +#endif // _SOCKETS_socket_include_H + + diff --git a/externals/sockets/include/sockets-config.h b/externals/sockets/include/sockets-config.h new file mode 100644 index 0000000..1c8dc43 --- /dev/null +++ b/externals/sockets/include/sockets-config.h @@ -0,0 +1,90 @@ +/** + ** \file sockets-config.h + ** \date 2007-04-14 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2007 Anders Hedstrom + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _SOCKETS_CONFIG_H +#define _SOCKETS_CONFIG_H + +#ifndef _RUN_DP +/* First undefine symbols if already defined. */ +#undef HAVE_OPENSSL +#undef ENABLE_IPV6 +#undef USE_SCTP +#undef NO_GETADDRINFO +#undef ENABLE_POOL +#undef ENABLE_SOCKS4 +#undef ENABLE_RESOLVER +#undef ENABLE_RECONNECT +#undef ENABLE_DETACH +#undef ENABLE_TRIGGERS +#undef ENABLE_EXCEPTIONS +#endif // _RUN_DP + +// define MACOSX for internal socket library checks +#if defined(__APPLE__) && defined(__MACH__) && !defined(MACOSX) +#define MACOSX +#endif + +/* OpenSSL support. */ +//#define HAVE_OPENSSL + +/* Ipv6 support. */ +//#define ENABLE_IPV6 + +/* SCTP support. */ +//#define USE_SCTP + +/* Define NO_GETADDRINFO if your operating system does not support + the "getaddrinfo" and "getnameinfo" function calls. */ +#define NO_GETADDRINFO + +/* Connection pool support. */ +#define ENABLE_POOL + +/* Socks4 client support. */ +//#define ENABLE_SOCKS4 + +/* Asynchronous resolver. */ +#define ENABLE_RESOLVER + +/* Enable TCP reconnect on lost connection. + Socket::OnReconnect + Socket::OnDisconnect +*/ +#define ENABLE_RECONNECT + +/* Enable socket thread detach functionality. */ +#define ENABLE_DETACH + +/* Enable socket to socket triggers. Not yet in use. */ +//#define ENABLE_TRIGGERS + +/* Enabled exceptions. */ +//#define ENABLE_EXCEPTIONS + +/* Resolver uses the detach function so either enable both or disable both. */ +#ifndef ENABLE_DETACH +#undef ENABLE_RESOLVER +#endif + +#endif // _SOCKETS_CONFIG_H + + diff --git a/externals/sockets/network_kist.txt b/externals/sockets/network_kist.txt new file mode 100644 index 0000000..f6597bf --- /dev/null +++ b/externals/sockets/network_kist.txt @@ -0,0 +1,20 @@ +The following are the only .cpp files used from the new network library (v2.2.8) This file is just for future reference. + +Base64.cpp +Exception.cpp +Ipv4Address.cpp +Ipv6Address.cpp +Lock.cpp +Mutex.cpp +Parse.cpp +ResolvServer.cpp +ResolvSocket.cpp +Socket.cpp +SocketHandler.cpp +socket_include.cpp +StdoutLog.cpp +StreamSocket.cpp +TcpSocket.cpp +Thread.cpp +UdpSocket.cpp +Utility.cpp diff --git a/externals/sockets/socket_include.cpp b/externals/sockets/socket_include.cpp new file mode 100644 index 0000000..290602c --- /dev/null +++ b/externals/sockets/socket_include.cpp @@ -0,0 +1,89 @@ +/** \file socket_include.cpp + ** \date 2004-11-28 + ** \author grymse@alhem.net +**/ +/* +Copyright (C) 2004-2007 Anders Hedstrom + +This library is made available under the terms of the GNU GPL. + +If you would like to use this library in a closed-source application, +a separate license agreement is available. For information about +the closed-source license agreement for the C++ sockets library, +please visit http://www.alhem.net/Sockets/license.html and/or +email license@alhem.net. + +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include + +// only to be included in win32 projects +const char *StrError(int x) +{ +static char tmp[100]; + switch (x) + { + case 10004: return "Interrupted function call."; + case 10013: return "Permission denied."; + case 10014: return "Bad address."; + case 10022: return "Invalid argument."; + case 10024: return "Too many open files."; + case 10035: return "Resource temporarily unavailable."; + case 10036: return "Operation now in progress."; + case 10037: return "Operation already in progress."; + case 10038: return "Socket operation on nonsocket."; + case 10039: return "Destination address required."; + case 10040: return "Message too long."; + case 10041: return "Protocol wrong type for socket."; + case 10042: return "Bad protocol option."; + case 10043: return "Protocol not supported."; + case 10044: return "Socket type not supported."; + case 10045: return "Operation not supported."; + case 10046: return "Protocol family not supported."; + case 10047: return "Address family not supported by protocol family."; + case 10048: return "Address already in use."; + case 10049: return "Cannot assign requested address."; + case 10050: return "Network is down."; + case 10051: return "Network is unreachable."; + case 10052: return "Network dropped connection on reset."; + case 10053: return "Software caused connection abort."; + case 10054: return "Connection reset by peer."; + case 10055: return "No buffer space available."; + case 10056: return "Socket is already connected."; + case 10057: return "Socket is not connected."; + case 10058: return "Cannot send after socket shutdown."; + case 10060: return "Connection timed out."; + case 10061: return "Connection refused."; + case 10064: return "Host is down."; + case 10065: return "No route to host."; + case 10067: return "Too many processes."; + case 10091: return "Network subsystem is unavailable."; + case 10092: return "Winsock.dll version out of range."; + case 10093: return "Successful WSAStartup not yet performed."; + case 10101: return "Graceful shutdown in progress."; + case 10109: return "Class type not found."; + case 11001: return "Host not found."; + case 11002: return "Nonauthoritative host not found."; + case 11003: return "This is a nonrecoverable error."; + case 11004: return "Valid name, no data record of requested type."; + + default: + break; + } + sprintf(tmp, "Winsock error code: %d", x); + return tmp; +} + + diff --git a/externals/sockets/win/VC90/sockets.vcproj b/externals/sockets/win/VC90/sockets.vcproj new file mode 100644 index 0000000..3660ebe --- /dev/null +++ b/externals/sockets/win/VC90/sockets.vcproj @@ -0,0 +1,497 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/externals/sockets/win/sockets.sln b/externals/sockets/win/sockets.sln new file mode 100644 index 0000000..3ae708e --- /dev/null +++ b/externals/sockets/win/sockets.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "VC90\sockets.vcproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.ActiveCfg = Debug|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.Build.0 = Debug|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|x64.ActiveCfg = Debug|x64 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|x64.Build.0 = Debug|x64 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.ActiveCfg = Release|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.Build.0 = Release|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|x64.ActiveCfg = Release|x64 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/utf8cpp/utf8.h b/externals/utf8cpp/utf8.h new file mode 100644 index 0000000..82b13f5 --- /dev/null +++ b/externals/utf8cpp/utf8.h @@ -0,0 +1,34 @@ +// Copyright 2006 Nemanja Trifunovic + +/* +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +*/ + + +#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 +#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 + +#include "utf8/checked.h" +#include "utf8/unchecked.h" + +#endif // header guard diff --git a/externals/utf8cpp/utf8/checked.h b/externals/utf8cpp/utf8/checked.h new file mode 100644 index 0000000..a1d2035 --- /dev/null +++ b/externals/utf8cpp/utf8/checked.h @@ -0,0 +1,323 @@ +// Copyright 2006 Nemanja Trifunovic + +/* +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +*/ + + +#ifndef UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 +#define UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 + +#include "core.h" +#include + +namespace utf8 +{ + // Base for the exceptions that may be thrown from the library + class exception : public std::exception { + }; + + // Exceptions that may be thrown from the library functions. + class invalid_code_point : public exception { + uint32_t cp; + public: + invalid_code_point(uint32_t cp) : cp(cp) {} + virtual const char* what() const throw() { return "Invalid code point"; } + uint32_t code_point() const {return cp;} + }; + + class invalid_utf8 : public exception { + uint8_t u8; + public: + invalid_utf8 (uint8_t u) : u8(u) {} + virtual const char* what() const throw() { return "Invalid UTF-8"; } + uint8_t utf8_octet() const {return u8;} + }; + + class invalid_utf16 : public exception { + uint16_t u16; + public: + invalid_utf16 (uint16_t u) : u16(u) {} + virtual const char* what() const throw() { return "Invalid UTF-16"; } + uint16_t utf16_word() const {return u16;} + }; + + class not_enough_room : public exception { + public: + virtual const char* what() const throw() { return "Not enough space"; } + }; + + /// The library API - functions intended to be called by the users + + template + output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement) + { + while (start != end) { + octet_iterator sequence_start = start; + internal::utf_error err_code = internal::validate_next(start, end); + switch (err_code) { + case internal::UTF8_OK : + for (octet_iterator it = sequence_start; it != start; ++it) + *out++ = *it; + break; + case internal::NOT_ENOUGH_ROOM: + throw not_enough_room(); + case internal::INVALID_LEAD: + append (replacement, out); + ++start; + break; + case internal::INCOMPLETE_SEQUENCE: + case internal::OVERLONG_SEQUENCE: + case internal::INVALID_CODE_POINT: + append (replacement, out); + ++start; + // just one replacement mark for the sequence + while (internal::is_trail(*start) && start != end) + ++start; + break; + } + } + return out; + } + + template + inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out) + { + static const uint32_t replacement_marker = internal::mask16(0xfffd); + return replace_invalid(start, end, out, replacement_marker); + } + + template + octet_iterator append(uint32_t cp, octet_iterator result) + { + if (!internal::is_code_point_valid(cp)) + throw invalid_code_point(cp); + + if (cp < 0x80) // one octet + *(result++) = static_cast(cp); + else if (cp < 0x800) { // two octets + *(result++) = static_cast((cp >> 6) | 0xc0); + *(result++) = static_cast((cp & 0x3f) | 0x80); + } + else if (cp < 0x10000) { // three octets + *(result++) = static_cast((cp >> 12) | 0xe0); + *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); + *(result++) = static_cast((cp & 0x3f) | 0x80); + } + else { // four octets + *(result++) = static_cast((cp >> 18) | 0xf0); + *(result++) = static_cast(((cp >> 12) & 0x3f) | 0x80); + *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); + *(result++) = static_cast((cp & 0x3f) | 0x80); + } + return result; + } + + template + uint32_t next(octet_iterator& it, octet_iterator end) + { + uint32_t cp = 0; + internal::utf_error err_code = internal::validate_next(it, end, &cp); + switch (err_code) { + case internal::UTF8_OK : + break; + case internal::NOT_ENOUGH_ROOM : + throw not_enough_room(); + case internal::INVALID_LEAD : + case internal::INCOMPLETE_SEQUENCE : + case internal::OVERLONG_SEQUENCE : + throw invalid_utf8(*it); + case internal::INVALID_CODE_POINT : + throw invalid_code_point(cp); + } + return cp; + } + + template + uint32_t peek_next(octet_iterator it, octet_iterator end) + { + return next(it, end); + } + + template + uint32_t prior(octet_iterator& it, octet_iterator start) + { + octet_iterator end = it; + while (internal::is_trail(*(--it))) + if (it < start) + throw invalid_utf8(*it); // error - no lead byte in the sequence + octet_iterator temp = it; + return next(temp, end); + } + + /// Deprecated in versions that include "prior" + template + uint32_t previous(octet_iterator& it, octet_iterator pass_start) + { + octet_iterator end = it; + while (internal::is_trail(*(--it))) + if (it == pass_start) + throw invalid_utf8(*it); // error - no lead byte in the sequence + octet_iterator temp = it; + return next(temp, end); + } + + template + void advance (octet_iterator& it, distance_type n, octet_iterator end) + { + for (distance_type i = 0; i < n; ++i) + next(it, end); + } + + template + typename std::iterator_traits::difference_type + distance (octet_iterator first, octet_iterator last) + { + typename std::iterator_traits::difference_type dist; + for (dist = 0; first < last; ++dist) + next(first, last); + return dist; + } + + template + octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) + { + while (start != end) { + uint32_t cp = internal::mask16(*start++); + // Take care of surrogate pairs first + if (internal::is_lead_surrogate(cp)) { + if (start != end) { + uint32_t trail_surrogate = internal::mask16(*start++); + if (internal::is_trail_surrogate(trail_surrogate)) + cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; + else + throw invalid_utf16(static_cast(trail_surrogate)); + } + else + throw invalid_utf16(static_cast(cp)); + + } + // Lone trail surrogate + else if (internal::is_trail_surrogate(cp)) + throw invalid_utf16(static_cast(cp)); + + result = append(cp, result); + } + return result; + } + + template + u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) + { + while (start != end) { + uint32_t cp = next(start, end); + if (cp > 0xffff) { //make a surrogate pair + *result++ = static_cast((cp >> 10) + internal::LEAD_OFFSET); + *result++ = static_cast((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); + } + else + *result++ = static_cast(cp); + } + return result; + } + + template + octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) + { + while (start != end) + result = append(*(start++), result); + + return result; + } + + template + u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) + { + while (start != end) + (*result++) = next(start, end); + + return result; + } + + // The iterator class + template + class iterator : public std::iterator { + octet_iterator it; + octet_iterator range_start; + octet_iterator range_end; + public: + iterator () {}; + explicit iterator (const octet_iterator& octet_it, + const octet_iterator& range_start, + const octet_iterator& range_end) : + it(octet_it), range_start(range_start), range_end(range_end) + { + if (it < range_start || it > range_end) + throw std::out_of_range("Invalid utf-8 iterator position"); + } + // the default "big three" are OK + octet_iterator base () const { return it; } + uint32_t operator * () const + { + octet_iterator temp = it; + return next(temp, range_end); + } + bool operator == (const iterator& rhs) const + { + if (range_start != rhs.range_start || range_end != rhs.range_end) + throw std::logic_error("Comparing utf-8 iterators defined with different ranges"); + return (it == rhs.it); + } + bool operator != (const iterator& rhs) const + { + return !(operator == (rhs)); + } + iterator& operator ++ () + { + next(it, range_end); + return *this; + } + iterator operator ++ (int) + { + iterator temp = *this; + next(it, range_end); + return temp; + } + iterator& operator -- () + { + prior(it, range_start); + return *this; + } + iterator operator -- (int) + { + iterator temp = *this; + prior(it, range_start); + return temp; + } + }; // class iterator + +} // namespace utf8 + +#endif //header guard + + diff --git a/externals/utf8cpp/utf8/core.h b/externals/utf8cpp/utf8/core.h new file mode 100644 index 0000000..ec709f1 --- /dev/null +++ b/externals/utf8cpp/utf8/core.h @@ -0,0 +1,358 @@ +// Copyright 2006 Nemanja Trifunovic + +/* +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +*/ + + +#ifndef UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 +#define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 + +#include + +namespace utf8 +{ + // The typedefs for 8-bit, 16-bit and 32-bit unsigned integers + // You may need to change them to match your system. + // These typedefs have the same names as ones from cstdint, or boost/cstdint + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + +// Helper code - not intended to be directly called by the library users. May be changed at any time +namespace internal +{ + // Unicode constants + // Leading (high) surrogates: 0xd800 - 0xdbff + // Trailing (low) surrogates: 0xdc00 - 0xdfff + const uint16_t LEAD_SURROGATE_MIN = 0xd800u; + const uint16_t LEAD_SURROGATE_MAX = 0xdbffu; + const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u; + const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu; + const uint16_t LEAD_OFFSET = LEAD_SURROGATE_MIN - (0x10000 >> 10); + const uint32_t SURROGATE_OFFSET = 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN; + + // Maximum valid value for a Unicode code point + const uint32_t CODE_POINT_MAX = 0x0010ffffu; + + template + inline uint8_t mask8(octet_type oc) + { + return static_cast(0xff & oc); + } + template + inline uint16_t mask16(u16_type oc) + { + return static_cast(0xffff & oc); + } + template + inline bool is_trail(octet_type oc) + { + return ((mask8(oc) >> 6) == 0x2); + } + + template + inline bool is_lead_surrogate(u16 cp) + { + return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX); + } + + template + inline bool is_trail_surrogate(u16 cp) + { + return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); + } + + template + inline bool is_surrogate(u16 cp) + { + return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX); + } + + template + inline bool is_code_point_valid(u32 cp) + { + return (cp <= CODE_POINT_MAX && !is_surrogate(cp) && cp != 0xfffe && cp != 0xffff); + } + + template + inline typename std::iterator_traits::difference_type + sequence_length(octet_iterator lead_it) + { + uint8_t lead = mask8(*lead_it); + if (lead < 0x80) + return 1; + else if ((lead >> 5) == 0x6) + return 2; + else if ((lead >> 4) == 0xe) + return 3; + else if ((lead >> 3) == 0x1e) + return 4; + else + return 0; + } + + template + inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length) + { + if (cp < 0x80) { + if (length != 1) + return true; + } + else if (cp < 0x800) { + if (length != 2) + return true; + } + else if (cp < 0x10000) { + if (length != 3) + return true; + } + + return false; + } + + enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT}; + + /// get_sequence_x functions decode utf-8 sequences of the length x + + template + utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t* code_point) + { + if (it != end) { + if (code_point) + *code_point = mask8(*it); + return UTF8_OK; + } + return NOT_ENOUGH_ROOM; + } + + template + utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t* code_point) + { + utf_error ret_code = NOT_ENOUGH_ROOM; + + if (it != end) { + uint32_t cp = mask8(*it); + if (++it != end) { + if (is_trail(*it)) { + cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); + + if (code_point) + *code_point = cp; + ret_code = UTF8_OK; + } + else + ret_code = INCOMPLETE_SEQUENCE; + } + else + ret_code = NOT_ENOUGH_ROOM; + } + + return ret_code; + } + + template + utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t* code_point) + { + utf_error ret_code = NOT_ENOUGH_ROOM; + + if (it != end) { + uint32_t cp = mask8(*it); + if (++it != end) { + if (is_trail(*it)) { + cp = ((cp << 12) & 0xffff) + ((mask8(*it) << 6) & 0xfff); + if (++it != end) { + if (is_trail(*it)) { + cp += (*it) & 0x3f; + + if (code_point) + *code_point = cp; + ret_code = UTF8_OK; + } + else + ret_code = INCOMPLETE_SEQUENCE; + } + else + ret_code = NOT_ENOUGH_ROOM; + } + else + ret_code = INCOMPLETE_SEQUENCE; + } + else + ret_code = NOT_ENOUGH_ROOM; + } + + return ret_code; + } + + template + utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t* code_point) + { + utf_error ret_code = NOT_ENOUGH_ROOM; + + if (it != end) { + uint32_t cp = mask8(*it); + if (++it != end) { + if (is_trail(*it)) { + cp = ((cp << 18) & 0x1fffff) + ((mask8(*it) << 12) & 0x3ffff); + if (++it != end) { + if (is_trail(*it)) { + cp += (mask8(*it) << 6) & 0xfff; + if (++it != end) { + if (is_trail(*it)) { + cp += (*it) & 0x3f; + + if (code_point) + *code_point = cp; + ret_code = UTF8_OK; + } + else + ret_code = INCOMPLETE_SEQUENCE; + } + else + ret_code = NOT_ENOUGH_ROOM; + } + else + ret_code = INCOMPLETE_SEQUENCE; + } + else + ret_code = NOT_ENOUGH_ROOM; + } + else + ret_code = INCOMPLETE_SEQUENCE; + } + else + ret_code = NOT_ENOUGH_ROOM; + } + + return ret_code; + } + + template + utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t* code_point) + { + // Save the original value of it so we can go back in case of failure + // Of course, it does not make much sense with i.e. stream iterators + octet_iterator original_it = it; + + uint32_t cp = 0; + // Determine the sequence length based on the lead octet + typedef typename std::iterator_traits::difference_type octet_difference_type; + octet_difference_type length = sequence_length(it); + if (length == 0) + return INVALID_LEAD; + + // Now that we have a valid sequence length, get trail octets and calculate the code point + utf_error err = UTF8_OK; + switch (length) { + case 1: + err = get_sequence_1(it, end, &cp); + break; + case 2: + err = get_sequence_2(it, end, &cp); + break; + case 3: + err = get_sequence_3(it, end, &cp); + break; + case 4: + err = get_sequence_4(it, end, &cp); + break; + } + + if (err == UTF8_OK) { + // Decoding succeeded. Now, security checks... + if (is_code_point_valid(cp)) { + if (!is_overlong_sequence(cp, length)){ + // Passed! Return here. + if (code_point) + *code_point = cp; + ++it; + return UTF8_OK; + } + else + err = OVERLONG_SEQUENCE; + } + else + err = INVALID_CODE_POINT; + } + + // Failure branch - restore the original value of the iterator + it = original_it; + return err; + } + + template + inline utf_error validate_next(octet_iterator& it, octet_iterator end) { + return validate_next(it, end, 0); + } + +} // namespace internal + + /// The library API - functions intended to be called by the users + + // Byte order mark + const uint8_t bom[] = {0xef, 0xbb, 0xbf}; + + template + octet_iterator find_invalid(octet_iterator start, octet_iterator end) + { + octet_iterator result = start; + while (result != end) { + internal::utf_error err_code = internal::validate_next(result, end); + if (err_code != internal::UTF8_OK) + return result; + } + return result; + } + + template + inline bool is_valid(octet_iterator start, octet_iterator end) + { + return (find_invalid(start, end) == end); + } + + template + inline bool starts_with_bom (octet_iterator it, octet_iterator end) + { + return ( + ((it != end) && (internal::mask8(*it++)) == bom[0]) && + ((it != end) && (internal::mask8(*it++)) == bom[1]) && + ((it != end) && (internal::mask8(*it)) == bom[2]) + ); + } + + //Deprecated in release 2.3 + template + inline bool is_bom (octet_iterator it) + { + return ( + (internal::mask8(*it++)) == bom[0] && + (internal::mask8(*it++)) == bom[1] && + (internal::mask8(*it)) == bom[2] + ); + } +} // namespace utf8 + +#endif // header guard + + diff --git a/externals/utf8cpp/utf8/unchecked.h b/externals/utf8cpp/utf8/unchecked.h new file mode 100644 index 0000000..2f3eb4d --- /dev/null +++ b/externals/utf8cpp/utf8/unchecked.h @@ -0,0 +1,228 @@ +// Copyright 2006 Nemanja Trifunovic + +/* +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +*/ + + +#ifndef UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 +#define UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 + +#include "core.h" + +namespace utf8 +{ + namespace unchecked + { + template + octet_iterator append(uint32_t cp, octet_iterator result) + { + if (cp < 0x80) // one octet + *(result++) = static_cast(cp); + else if (cp < 0x800) { // two octets + *(result++) = static_cast((cp >> 6) | 0xc0); + *(result++) = static_cast((cp & 0x3f) | 0x80); + } + else if (cp < 0x10000) { // three octets + *(result++) = static_cast((cp >> 12) | 0xe0); + *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); + *(result++) = static_cast((cp & 0x3f) | 0x80); + } + else { // four octets + *(result++) = static_cast((cp >> 18) | 0xf0); + *(result++) = static_cast(((cp >> 12) & 0x3f)| 0x80); + *(result++) = static_cast(((cp >> 6) & 0x3f) | 0x80); + *(result++) = static_cast((cp & 0x3f) | 0x80); + } + return result; + } + + template + uint32_t next(octet_iterator& it) + { + uint32_t cp = internal::mask8(*it); + typename std::iterator_traits::difference_type length = utf8::internal::sequence_length(it); + switch (length) { + case 1: + break; + case 2: + it++; + cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); + break; + case 3: + ++it; + cp = ((cp << 12) & 0xffff) + ((internal::mask8(*it) << 6) & 0xfff); + ++it; + cp += (*it) & 0x3f; + break; + case 4: + ++it; + cp = ((cp << 18) & 0x1fffff) + ((internal::mask8(*it) << 12) & 0x3ffff); + ++it; + cp += (internal::mask8(*it) << 6) & 0xfff; + ++it; + cp += (*it) & 0x3f; + break; + } + ++it; + return cp; + } + + template + uint32_t peek_next(octet_iterator it) + { + return next(it); + } + + template + uint32_t prior(octet_iterator& it) + { + while (internal::is_trail(*(--it))) ; + octet_iterator temp = it; + return next(temp); + } + + // Deprecated in versions that include prior, but only for the sake of consistency (see utf8::previous) + template + inline uint32_t previous(octet_iterator& it) + { + return prior(it); + } + + template + void advance (octet_iterator& it, distance_type n) + { + for (distance_type i = 0; i < n; ++i) + next(it); + } + + template + typename std::iterator_traits::difference_type + distance (octet_iterator first, octet_iterator last) + { + typename std::iterator_traits::difference_type dist; + for (dist = 0; first < last; ++dist) + next(first); + return dist; + } + + template + octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) + { + while (start != end) { + uint32_t cp = internal::mask16(*start++); + // Take care of surrogate pairs first + if (internal::is_lead_surrogate(cp)) { + uint32_t trail_surrogate = internal::mask16(*start++); + cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; + } + result = append(cp, result); + } + return result; + } + + template + u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) + { + while (start < end) { + uint32_t cp = next(start); + if (cp > 0xffff) { //make a surrogate pair + *result++ = static_cast((cp >> 10) + internal::LEAD_OFFSET); + *result++ = static_cast((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); + } + else + *result++ = static_cast(cp); + } + return result; + } + + template + octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) + { + while (start != end) + result = append(*(start++), result); + + return result; + } + + template + u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) + { + while (start < end) + (*result++) = next(start); + + return result; + } + + // The iterator class + template + class iterator : public std::iterator { + octet_iterator it; + public: + iterator () {}; + explicit iterator (const octet_iterator& octet_it): it(octet_it) {} + // the default "big three" are OK + octet_iterator base () const { return it; } + uint32_t operator * () const + { + octet_iterator temp = it; + return next(temp); + } + bool operator == (const iterator& rhs) const + { + return (it == rhs.it); + } + bool operator != (const iterator& rhs) const + { + return !(operator == (rhs)); + } + iterator& operator ++ () + { + std::advance(it, internal::sequence_length(it)); + return *this; + } + iterator operator ++ (int) + { + iterator temp = *this; + std::advance(it, internal::sequence_length(it)); + return temp; + } + iterator& operator -- () + { + prior(it); + return *this; + } + iterator operator -- (int) + { + iterator temp = *this; + prior(it); + return temp; + } + }; // class iterator + + } // namespace utf8::unchecked +} // namespace utf8 + + +#endif // header guard + diff --git a/externals/vld/vld.h b/externals/vld/vld.h new file mode 100644 index 0000000..72bebd8 --- /dev/null +++ b/externals/vld/vld.h @@ -0,0 +1,105 @@ +//////////////////////////////////////////////////////////////////////////////// +// $Id: vld.h,v 1.27 2006/11/12 18:09:20 dmouldin Exp $ +// +// Visual Leak Detector (Version 1.9d) - Import Library Header +// Copyright (c) 2006 Dan Moulding +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// +// See COPYING.txt for the full terms of the GNU Lesser General Public License. +// +//////////////////////////////////////////////////////////////////////////////// + +//#pragma once +#ifndef _VLD_H_ +#define _VLD_H_ + +#ifdef _DEBUG + +#pragma comment(lib, "vld.lib") + +// Force a symbolic reference to the global VisualLeakDetector class object from +// the DLL. This enusres that the DLL is loaded and linked with the program, +// even if no code otherwise imports any of the DLL's exports. +#pragma comment(linker, "/include:__imp_?vld@@3VVisualLeakDetector@@A") + +//////////////////////////////////////////////////////////////////////////////// +// +// Visual Leak Detector APIs +// + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// VLDDisable - Disables Visual Leak Detector's memory leak detection at +// runtime. If memory leak detection is already disabled, then calling this +// function has no effect. +// +// Note: In multithreaded programs, this function operates on a per-thread +// basis. In other words, if you call this function from one thread, then +// memory leak detection is only disabled for that thread. If memory leak +// detection is enabled for other threads, then it will remain enabled for +// those other threads. It was designed to work this way to insulate you, +// the programmer, from having to ensure thread synchronization when calling +// VLDEnable() and VLDDisable(). Without this, calling these two functions +// unsychronized could result in unpredictable and unintended behavior. +// But this also means that if you want to disable memory leak detection +// process-wide, then you need to call this function from every thread in +// the process. +// +// Return Value: +// +// None. +// + +__declspec(dllimport) void VLDDisable (); + +// VLDEnable - Enables Visual Leak Detector's memory leak detection at runtime. +// If memory leak detection is already enabled, which it is by default, then +// calling this function has no effect. +// +// Note: In multithreaded programs, this function operates on a per-thread +// basis. In other words, if you call this function from one thread, then +// memory leak detection is only enabled for that thread. If memory leak +// detection is disabled for other threads, then it will remain disabled for +// those other threads. It was designed to work this way to insulate you, +// the programmer, from having to ensure thread synchronization when calling +// VLDEnable() and VLDDisable(). Without this, calling these two functions +// unsychronized could result in unpredictable and unintended behavior. +// But this also means that if you want to enable memory leak detection +// process-wide, then you need to call this function from every thread in +// the process. +// +// Return Value: +// +// None. +// + +__declspec(dllimport) void VLDEnable (); + +#ifdef __cplusplus +} +#endif // __cplusplus + +#else // !_DEBUG + +#define VLDEnable() +#define VLDDisable() + +#endif // _DEBUG + +#endif // _VLD_H_ + diff --git a/externals/zlib/CMakeLists.txt b/externals/zlib/CMakeLists.txt new file mode 100644 index 0000000..e53fae3 --- /dev/null +++ b/externals/zlib/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + +SET(zlib_STAT_SRCS + adler32.c + compress.c + crc32.c + deflate.c + example.c + infback.c + inffast.c + inflate.c + inftrees.c + trees.c + uncompr.c + zutil.c +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_library(zlib STATIC ${zlib_STAT_SRCS}) diff --git a/externals/zlib/adler32.c b/externals/zlib/adler32.c new file mode 100644 index 0000000..65ad6a5 --- /dev/null +++ b/externals/zlib/adler32.c @@ -0,0 +1,169 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2007 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#define local static + +local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); + +#define BASE 65521UL /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +/* use NO_DIVIDE if your processor does not do division in hardware */ +#ifdef NO_DIVIDE +# define MOD(a) \ + do { \ + if (a >= (BASE << 16)) a -= (BASE << 16); \ + if (a >= (BASE << 15)) a -= (BASE << 15); \ + if (a >= (BASE << 14)) a -= (BASE << 14); \ + if (a >= (BASE << 13)) a -= (BASE << 13); \ + if (a >= (BASE << 12)) a -= (BASE << 12); \ + if (a >= (BASE << 11)) a -= (BASE << 11); \ + if (a >= (BASE << 10)) a -= (BASE << 10); \ + if (a >= (BASE << 9)) a -= (BASE << 9); \ + if (a >= (BASE << 8)) a -= (BASE << 8); \ + if (a >= (BASE << 7)) a -= (BASE << 7); \ + if (a >= (BASE << 6)) a -= (BASE << 6); \ + if (a >= (BASE << 5)) a -= (BASE << 5); \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +# define MOD4(a) \ + do { \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +# define MOD4(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (len == 1) { + adler += buf[0]; + if (adler >= BASE) + adler -= BASE; + sum2 += adler; + if (sum2 >= BASE) + sum2 -= BASE; + return adler | (sum2 << 16); + } + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (buf == Z_NULL) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (len < 16) { + while (len--) { + adler += *buf++; + sum2 += adler; + } + if (adler >= BASE) + adler -= BASE; + MOD4(sum2); /* only added so many BASE's */ + return adler | (sum2 << 16); + } + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; + n = NMAX / 16; /* NMAX is divisible by 16 */ + do { + DO16(buf); /* 16 sums unrolled */ + buf += 16; + } while (--n); + MOD(adler); + MOD(sum2); + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + if (len) { /* avoid modulos if none remaining */ + while (len >= 16) { + len -= 16; + DO16(buf); + buf += 16; + } + while (len--) { + adler += *buf++; + sum2 += adler; + } + MOD(adler); + MOD(sum2); + } + + /* return recombined sums */ + return adler | (sum2 << 16); +} + +/* ========================================================================= */ +local uLong adler32_combine_(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + unsigned long sum1; + unsigned long sum2; + unsigned rem; + + /* the derivation of this formula is left as an exercise for the reader */ + rem = (unsigned)(len2 % BASE); + sum1 = adler1 & 0xffff; + sum2 = rem * sum1; + MOD(sum2); + sum1 += (adler2 & 0xffff) + BASE - 1; + sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; + if (sum1 >= BASE) sum1 -= BASE; + if (sum1 >= BASE) sum1 -= BASE; + if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 >= BASE) sum2 -= BASE; + return sum1 | (sum2 << 16); +} + +/* ========================================================================= */ +uLong ZEXPORT adler32_combine(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} + +uLong ZEXPORT adler32_combine64(adler1, adler2, len2) + uLong adler1; + uLong adler2; + z_off64_t len2; +{ + return adler32_combine_(adler1, adler2, len2); +} diff --git a/externals/zlib/compress.c b/externals/zlib/compress.c new file mode 100644 index 0000000..ea4dfbe --- /dev/null +++ b/externals/zlib/compress.c @@ -0,0 +1,80 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2005 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13; +} diff --git a/externals/zlib/crc32.c b/externals/zlib/crc32.c new file mode 100644 index 0000000..91be372 --- /dev/null +++ b/externals/zlib/crc32.c @@ -0,0 +1,442 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2006, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results in about a + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifndef NOBYFOUR +# ifdef STDC /* need ANSI C limits.h to determine sizes */ +# include +# define BYFOUR +# if (UINT_MAX == 0xffffffffUL) + typedef unsigned int u4; +# else +# if (ULONG_MAX == 0xffffffffUL) + typedef unsigned long u4; +# else +# if (USHRT_MAX == 0xffffffffUL) + typedef unsigned short u4; +# else +# undef BYFOUR /* can't find a four-byte integer type! */ +# endif +# endif +# endif +# endif /* STDC */ +#endif /* !NOBYFOUR */ + +/* Definitions for doing the crc four data bytes at a time. */ +#ifdef BYFOUR +# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ + (((w)&0xff00)<<8)+(((w)&0xff)<<24)) + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +/* Local functions for crc concatenation */ +local unsigned long gf2_matrix_times OF((unsigned long *mat, + unsigned long vec)); +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); +local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); + + +#ifdef DYNAMIC_CRC_TABLE + +local volatile int crc_table_empty = 1; +local unsigned long FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const unsigned long FAR *)); +#endif /* MAKECRCH */ +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + unsigned long c; + int n, k; + unsigned long poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static volatile int first = 1; /* flag to limit concurrent making */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* See if another task is already doing this (not thread-safe, but better + than nothing -- significantly reduces duration of vulnerability in + case the advice about DYNAMIC_CRC_TABLE is ignored) */ + if (first) { + first = 0; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0UL; + for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + poly |= 1UL << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (unsigned long)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, + and then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = REV(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = REV(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + } + else { /* not first */ + /* wait for the other guy to finish (not efficient, but rare) */ + while (crc_table_empty) + ; + } + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const unsigned long FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const unsigned long FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const unsigned long FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const unsigned long FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + u4 endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return crc32_little(crc, buf, len); + else + return crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = (u4)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = REV((u4)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(REV(c)); +} + +#endif /* BYFOUR */ + +#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ + +/* ========================================================================= */ +local unsigned long gf2_matrix_times(mat, vec) + unsigned long *mat; + unsigned long vec; +{ + unsigned long sum; + + sum = 0; + while (vec) { + if (vec & 1) + sum ^= *mat; + vec >>= 1; + mat++; + } + return sum; +} + +/* ========================================================================= */ +local void gf2_matrix_square(square, mat) + unsigned long *square; + unsigned long *mat; +{ + int n; + + for (n = 0; n < GF2_DIM; n++) + square[n] = gf2_matrix_times(mat, mat[n]); +} + +/* ========================================================================= */ +local uLong crc32_combine_(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + int n; + unsigned long row; + unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ + unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ + + /* degenerate case (also disallow negative lengths) */ + if (len2 <= 0) + return crc1; + + /* put operator for one zero bit in odd */ + odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ + row = 1; + for (n = 1; n < GF2_DIM; n++) { + odd[n] = row; + row <<= 1; + } + + /* put operator for two zero bits in even */ + gf2_matrix_square(even, odd); + + /* put operator for four zero bits in odd */ + gf2_matrix_square(odd, even); + + /* apply len2 zeros to crc1 (first square will put the operator for one + zero byte, eight zero bits, in even) */ + do { + /* apply zeros operator for this bit of len2 */ + gf2_matrix_square(even, odd); + if (len2 & 1) + crc1 = gf2_matrix_times(even, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + if (len2 == 0) + break; + + /* another iteration of the loop with odd and even swapped */ + gf2_matrix_square(odd, even); + if (len2 & 1) + crc1 = gf2_matrix_times(odd, crc1); + len2 >>= 1; + + /* if no more bits set, then done */ + } while (len2 != 0); + + /* return combined crc */ + crc1 ^= crc2; + return crc1; +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} + +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ + return crc32_combine_(crc1, crc2, len2); +} diff --git a/externals/zlib/crc32.h b/externals/zlib/crc32.h new file mode 100644 index 0000000..8053b61 --- /dev/null +++ b/externals/zlib/crc32.h @@ -0,0 +1,441 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/externals/zlib/deflate.c b/externals/zlib/deflate.c new file mode 100644 index 0000000..5c4022f --- /dev/null +++ b/externals/zlib/deflate.c @@ -0,0 +1,1834 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in http://www.ietf.org/rfc/rfc1951.txt + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id$ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST +local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif +local block_state deflate_rle OF((deflate_state *s, int flush)); +local block_state deflate_huff OF((deflate_state *s, int flush)); +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +#ifndef NO_DUMMY_DECL +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->wrap = wrap; + s->gzhead = Z_NULL; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->high_water = 0; /* nothing written to s->window yet */ + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt length = dictLength; + uInt n; + IPos hash_head = 0; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || + strm->state->wrap == 2 || + (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + return Z_STREAM_ERROR; + + s = strm->state; + if (s->wrap) + strm->adler = adler32(strm->adler, dictionary, dictLength); + + if (length < MIN_MATCH) return Z_OK; + if (length > s->w_size) { + length = s->w_size; + dictionary += dictLength - length; /* use the tail of the dictionary */ + } + zmemcpy(s->window, dictionary, length); + s->strstart = length; + s->block_start = (long)length; + + /* Insert all strings in the hash table (except for the last two bytes). + * s->lookahead stays null, so s->ins_h will be recomputed at the next + * call of fill_window. + */ + s->ins_h = s->window[0]; + UPDATE_HASH(s, s->ins_h, s->window[1]); + for (n = 0; n <= length - MIN_MATCH; n++) { + INSERT_STRING(s, n, hash_head); + } + if (hash_head) hash_head = 0; /* to make compiler happy */ + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ + } + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + lm_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateSetHeader (strm, head) + z_streamp strm; + gz_headerp head; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (strm->state->wrap != 2) return Z_STREAM_ERROR; + strm->state->gzhead = head; + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + strm->state->bi_valid = bits; + strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if ((strategy != s->strategy || func != configuration_table[level].func) && + strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_BLOCK); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= */ +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) + z_streamp strm; + int good_length; + int max_lazy; + int nice_length; + int max_chain; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + s->good_match = good_length; + s->max_lazy_match = max_lazy; + s->nice_match = nice_length; + s->max_chain_length = max_chain; + return Z_OK; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds for + * every combination of windowBits and memLevel. But even the conservative + * upper bound of about 14% expansion does not seem onerous for output buffer + * allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong complen, wraplen; + Bytef *str; + + /* conservative upper bound for compressed data */ + complen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + + /* if can't get parameters, return conservative bound plus zlib wrapper */ + if (strm == Z_NULL || strm->state == Z_NULL) + return complen + 6; + + /* compute wrapper length */ + s = strm->state; + switch (s->wrap) { + case 0: /* raw deflate */ + wraplen = 0; + break; + case 1: /* zlib wrapper */ + wraplen = 6 + (s->strstart ? 4 : 0); + break; + case 2: /* gzip wrapper */ + wraplen = 18; + if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ + if (s->gzhead->extra != Z_NULL) + wraplen += 2 + s->gzhead->extra_len; + str = s->gzhead->name; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + str = s->gzhead->comment; + if (str != Z_NULL) + do { + wraplen++; + } while (*str++); + if (s->gzhead->hcrc) + wraplen += 2; + } + break; + default: /* for compiler happiness */ + wraplen = 6; + } + + /* if not default parameters, return conservative bound */ + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return complen + wraplen; + + /* default settings: return tight bound for that case */ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + + (sourceLen >> 25) + 13 - 6 + wraplen; +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len = strm->state->pending; + + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, strm->state->pending_out, len); + strm->next_out += len; + strm->state->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + strm->state->pending -= len; + if (strm->state->pending == 0) { + strm->state->pending_out = strm->state->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_BLOCK || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the header */ + if (s->status == INIT_STATE) { +#ifdef GZIP + if (s->wrap == 2) { + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == Z_NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s->status = BUSY_STATE; + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != Z_NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; + } + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + } + } +#ifdef GZIP + if (s->status == EXTRA_STATE) { + if (s->gzhead->extra != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + + while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) + break; + } + put_byte(s, s->gzhead->extra[s->gzindex]); + s->gzindex++; + } + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (s->gzindex == s->gzhead->extra_len) { + s->gzindex = 0; + s->status = NAME_STATE; + } + } + else + s->status = NAME_STATE; + } + if (s->status == NAME_STATE) { + if (s->gzhead->name != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->name[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) { + s->gzindex = 0; + s->status = COMMENT_STATE; + } + } + else + s->status = COMMENT_STATE; + } + if (s->status == COMMENT_STATE) { + if (s->gzhead->comment != Z_NULL) { + uInt beg = s->pending; /* start of bytes to update crc */ + int val; + + do { + if (s->pending == s->pending_buf_size) { + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + flush_pending(strm); + beg = s->pending; + if (s->pending == s->pending_buf_size) { + val = 1; + break; + } + } + val = s->gzhead->comment[s->gzindex++]; + put_byte(s, val); + } while (val != 0); + if (s->gzhead->hcrc && s->pending > beg) + strm->adler = crc32(strm->adler, s->pending_buf + beg, + s->pending - beg); + if (val == 0) + s->status = HCRC_STATE; + } + else + s->status = HCRC_STATE; + } + if (s->status == HCRC_STATE) { + if (s->gzhead->hcrc) { + if (s->pending + 2 > s->pending_buf_size) + flush_pending(strm); + if (s->pending + 2 <= s->pending_buf_size) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + } + } + else + s->status = BUSY_STATE; + } +#endif + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && flush <= old_flush && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : + (s->strategy == Z_RLE ? deflate_rle(s, flush) : + (*(configuration_table[s->level].func))(s, flush)); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + if (s->lookahead == 0) { + s->strstart = 0; + s->block_start = 0L; + } + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->wrap <= 0) return Z_STREAM_END; + + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && + status != EXTRA_STATE && + status != NAME_STATE && + status != COMMENT_STATE && + status != HCRC_STATE && + status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + zmemcpy(dest, source, sizeof(z_stream)); + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + zmemcpy(ds, ss, sizeof(deflate_state)); + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif /* MAXSEG_64K */ +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, strm->next_in, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, strm->next_in, len); + } +#endif + zmemcpy(buf, strm->next_in, len); + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifndef FASTEST +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +#endif +} + +#ifndef FASTEST +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} +#endif /* ASMV */ + +#else /* FASTEST */ + +/* --------------------------------------------------------------------------- + * Optimized version for FASTEST only + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; +} + +#endif /* FASTEST */ + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif /* DEBUG */ + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) return; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead >= MIN_MATCH) { + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ + if (s->high_water < s->window_size) { + ulg curr = s->strstart + (ulg)(s->lookahead); + ulg init; + + if (s->high_water < curr) { + /* Previous high water mark below current data -- zero WIN_INIT + * bytes or up to end of window, whichever is less. + */ + init = s->window_size - curr; + if (init > WIN_INIT) + init = WIN_INIT; + zmemzero(s->window + curr, (unsigned)init); + s->high_water = curr + init; + } + else if (s->high_water < (ulg)curr + WIN_INIT) { + /* High water mark at or above current data, but below current data + * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up + * to end of window, whichever is less. + */ + init = (ulg)curr + WIN_INIT - s->high_water; + if (init > s->window_size - s->high_water) + init = s->window_size - s->high_water; + zmemzero(s->window + s->high_water, (unsigned)init); + s->high_water += init; + } + } +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, last) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (last)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, last) { \ + FLUSH_BLOCK_ONLY(s, last); \ + if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +#ifndef FASTEST +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = NIL; + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s->match_length = longest_match (s, hash_head); + /* longest_match() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif /* FASTEST */ + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +local block_state deflate_rle(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + uInt prev; /* byte at distance one to match */ + Bytef *scan, *strend; /* scan goes up to strend for length of run */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest encodable run. + */ + if (s->lookahead < MAX_MATCH) { + fill_window(s); + if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s->match_length = 0; + if (s->lookahead >= MIN_MATCH && s->strstart > 0) { + scan = s->window + s->strstart - 1; + prev = *scan; + if (prev == *++scan && prev == *++scan && prev == *++scan) { + strend = s->window + s->strstart + MAX_MATCH; + do { + } while (prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + prev == *++scan && prev == *++scan && + scan < strend); + s->match_length = MAX_MATCH - (int)(strend - scan); + if (s->match_length > s->lookahead) + s->match_length = s->lookahead; + } + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->strstart - 1, s->match_length); + + _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + s->strstart += s->match_length; + s->match_length = 0; + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +local block_state deflate_huff(s, flush) + deflate_state *s; + int flush; +{ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s->lookahead == 0) { + fill_window(s); + if (s->lookahead == 0) { + if (flush == Z_NO_FLUSH) + return need_more; + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s->match_length = 0; + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} diff --git a/externals/zlib/deflate.h b/externals/zlib/deflate.h new file mode 100644 index 0000000..cbf0d1e --- /dev/null +++ b/externals/zlib/deflate.h @@ -0,0 +1,342 @@ +/* deflate.h -- internal compression state + * Copyright (C) 1995-2010 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef DEFLATE_H +#define DEFLATE_H + +#include "zutil.h" + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define INIT_STATE 42 +#define EXTRA_STATE 69 +#define NAME_STATE 73 +#define COMMENT_STATE 91 +#define HCRC_STATE 103 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + uInt pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + gz_headerp gzhead; /* gzip header information to write */ + uInt gzindex; /* where in extra, name, or comment */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to supress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + int last_eob_len; /* bit length of EOB code for last block */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + ulg high_water; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + +#define WIN_INIT MAX_MATCH +/* Number of bytes after end of data in window to initialize in order to avoid + memory checker errors from longest match routines */ + + /* in trees.c */ +void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); +int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); +void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); +void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, + ulg stored_len, int last)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch ZLIB_INTERNAL _length_code[]; + extern uch ZLIB_INTERNAL _dist_code[]; +#else + extern const uch ZLIB_INTERNAL _length_code[]; + extern const uch ZLIB_INTERNAL _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif /* DEFLATE_H */ diff --git a/externals/zlib/example.c b/externals/zlib/example.c new file mode 100644 index 0000000..604736f --- /dev/null +++ b/externals/zlib/example.c @@ -0,0 +1,565 @@ +/* example.c -- usage example of the zlib compression library + * Copyright (C) 1995-2006 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zlib.h" +#include + +#ifdef STDC +# include +# include +#endif + +#if defined(VMS) || defined(RISCOS) +# define TESTFILE "foo-gz" +#else +# define TESTFILE "foo.gz" +#endif + +#define CHECK_ERR(err, msg) { \ + if (err != Z_OK) { \ + fprintf(stderr, "%s error: %d\n", msg, err); \ + exit(1); \ + } \ +} + +const char hello[] = "hello, hello!"; +/* "hello world" would be more standard, but the repeated "hello" + * stresses the compression code better, sorry... + */ + +const char dictionary[] = "hello"; +uLong dictId; /* Adler32 value of the dictionary */ + +void test_compress OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_gzio OF((const char *fname, + Byte *uncompr, uLong uncomprLen)); +void test_deflate OF((Byte *compr, uLong comprLen)); +void test_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_deflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_large_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_flush OF((Byte *compr, uLong *comprLen)); +void test_sync OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +void test_dict_deflate OF((Byte *compr, uLong comprLen)); +void test_dict_inflate OF((Byte *compr, uLong comprLen, + Byte *uncompr, uLong uncomprLen)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Test compress() and uncompress() + */ +void test_compress(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + uLong len = (uLong)strlen(hello)+1; + + err = compress(compr, &comprLen, (const Bytef*)hello, len); + CHECK_ERR(err, "compress"); + + strcpy((char*)uncompr, "garbage"); + + err = uncompress(uncompr, &uncomprLen, compr, comprLen); + CHECK_ERR(err, "uncompress"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad uncompress\n"); + exit(1); + } else { + printf("uncompress(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test read/write of .gz files + */ +void test_gzio(fname, uncompr, uncomprLen) + const char *fname; /* compressed file name */ + Byte *uncompr; + uLong uncomprLen; +{ +#ifdef NO_GZCOMPRESS + fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); +#else + int err; + int len = (int)strlen(hello)+1; + gzFile file; + z_off_t pos; + + file = gzopen(fname, "wb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + gzputc(file, 'h'); + if (gzputs(file, "ello") != 4) { + fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); + exit(1); + } + if (gzprintf(file, ", %s!", "hello") != 8) { + fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); + exit(1); + } + gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ + gzclose(file); + + file = gzopen(fname, "rb"); + if (file == NULL) { + fprintf(stderr, "gzopen error\n"); + exit(1); + } + strcpy((char*)uncompr, "garbage"); + + if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { + fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); + exit(1); + } else { + printf("gzread(): %s\n", (char*)uncompr); + } + + pos = gzseek(file, -8L, SEEK_CUR); + if (pos != 6 || gztell(file) != pos) { + fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", + (long)pos, (long)gztell(file)); + exit(1); + } + + if (gzgetc(file) != ' ') { + fprintf(stderr, "gzgetc error\n"); + exit(1); + } + + if (gzungetc(' ', file) != ' ') { + fprintf(stderr, "gzungetc error\n"); + exit(1); + } + + gzgets(file, (char*)uncompr, (int)uncomprLen); + if (strlen((char*)uncompr) != 7) { /* " hello!" */ + fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); + exit(1); + } + if (strcmp((char*)uncompr, hello + 6)) { + fprintf(stderr, "bad gzgets after gzseek\n"); + exit(1); + } else { + printf("gzgets() after gzseek: %s\n", (char*)uncompr); + } + + gzclose(file); +#endif +} + +/* =========================================================================== + * Test deflate() with small buffers + */ +void test_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uLong len = (uLong)strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + + while (c_stream.total_in != len && c_stream.total_out < comprLen) { + c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + } + /* Finish the stream, still forcing small buffers: */ + for (;;) { + c_stream.avail_out = 1; + err = deflate(&c_stream, Z_FINISH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "deflate"); + } + + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with small buffers + */ +void test_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 0; + d_stream.next_out = uncompr; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { + d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate\n"); + exit(1); + } else { + printf("inflate(): %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Test deflate() with large buffers and dynamic change of compression level + */ +void test_large_deflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_SPEED); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + /* At this point, uncompr is still mostly zeroes, so it should compress + * very well: + */ + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + if (c_stream.avail_in != 0) { + fprintf(stderr, "deflate not greedy\n"); + exit(1); + } + + /* Feed in already compressed data and switch to no compression: */ + deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); + c_stream.next_in = compr; + c_stream.avail_in = (uInt)comprLen/2; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + /* Switch back to compressing mode: */ + deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); + c_stream.next_in = uncompr; + c_stream.avail_in = (uInt)uncomprLen; + err = deflate(&c_stream, Z_NO_FLUSH); + CHECK_ERR(err, "deflate"); + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with large buffers + */ +void test_large_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + for (;;) { + d_stream.next_out = uncompr; /* discard the output */ + d_stream.avail_out = (uInt)uncomprLen; + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + CHECK_ERR(err, "large inflate"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (d_stream.total_out != 2*uncomprLen + comprLen/2) { + fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); + exit(1); + } else { + printf("large_inflate(): OK\n"); + } +} + +/* =========================================================================== + * Test deflate() with full flush + */ +void test_flush(compr, comprLen) + Byte *compr; + uLong *comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + uInt len = (uInt)strlen(hello)+1; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + c_stream.next_in = (Bytef*)hello; + c_stream.next_out = compr; + c_stream.avail_in = 3; + c_stream.avail_out = (uInt)*comprLen; + err = deflate(&c_stream, Z_FULL_FLUSH); + CHECK_ERR(err, "deflate"); + + compr[3]++; /* force an error in first compressed block */ + c_stream.avail_in = len - 3; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + CHECK_ERR(err, "deflate"); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); + + *comprLen = c_stream.total_out; +} + +/* =========================================================================== + * Test inflateSync() + */ +void test_sync(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = 2; /* just read the zlib header */ + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + inflate(&d_stream, Z_NO_FLUSH); + CHECK_ERR(err, "inflate"); + + d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ + err = inflateSync(&d_stream); /* but skip the damaged part */ + CHECK_ERR(err, "inflateSync"); + + err = inflate(&d_stream, Z_FINISH); + if (err != Z_DATA_ERROR) { + fprintf(stderr, "inflate should report DATA_ERROR\n"); + /* Because of incorrect adler32 */ + exit(1); + } + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + printf("after inflateSync(): hel%s\n", (char *)uncompr); +} + +/* =========================================================================== + * Test deflate() with preset dictionary + */ +void test_dict_deflate(compr, comprLen) + Byte *compr; + uLong comprLen; +{ + z_stream c_stream; /* compression stream */ + int err; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + err = deflateInit(&c_stream, Z_BEST_COMPRESSION); + CHECK_ERR(err, "deflateInit"); + + err = deflateSetDictionary(&c_stream, + (const Bytef*)dictionary, sizeof(dictionary)); + CHECK_ERR(err, "deflateSetDictionary"); + + dictId = c_stream.adler; + c_stream.next_out = compr; + c_stream.avail_out = (uInt)comprLen; + + c_stream.next_in = (Bytef*)hello; + c_stream.avail_in = (uInt)strlen(hello)+1; + + err = deflate(&c_stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, "deflate should report Z_STREAM_END\n"); + exit(1); + } + err = deflateEnd(&c_stream); + CHECK_ERR(err, "deflateEnd"); +} + +/* =========================================================================== + * Test inflate() with a preset dictionary + */ +void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) + Byte *compr, *uncompr; + uLong comprLen, uncomprLen; +{ + int err; + z_stream d_stream; /* decompression stream */ + + strcpy((char*)uncompr, "garbage"); + + d_stream.zalloc = (alloc_func)0; + d_stream.zfree = (free_func)0; + d_stream.opaque = (voidpf)0; + + d_stream.next_in = compr; + d_stream.avail_in = (uInt)comprLen; + + err = inflateInit(&d_stream); + CHECK_ERR(err, "inflateInit"); + + d_stream.next_out = uncompr; + d_stream.avail_out = (uInt)uncomprLen; + + for (;;) { + err = inflate(&d_stream, Z_NO_FLUSH); + if (err == Z_STREAM_END) break; + if (err == Z_NEED_DICT) { + if (d_stream.adler != dictId) { + fprintf(stderr, "unexpected dictionary"); + exit(1); + } + err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, + sizeof(dictionary)); + } + CHECK_ERR(err, "inflate with dict"); + } + + err = inflateEnd(&d_stream); + CHECK_ERR(err, "inflateEnd"); + + if (strcmp((char*)uncompr, hello)) { + fprintf(stderr, "bad inflate with dict\n"); + exit(1); + } else { + printf("inflate with dictionary: %s\n", (char *)uncompr); + } +} + +/* =========================================================================== + * Usage: example [output.gz [input.gz]] + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + Byte *compr, *uncompr; + uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ + uLong uncomprLen = comprLen; + static const char* myVersion = ZLIB_VERSION; + + if (zlibVersion()[0] != myVersion[0]) { + fprintf(stderr, "incompatible zlib version\n"); + exit(1); + + } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { + fprintf(stderr, "warning: different zlib version\n"); + } + + printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", + ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); + + compr = (Byte*)calloc((uInt)comprLen, 1); + uncompr = (Byte*)calloc((uInt)uncomprLen, 1); + /* compr and uncompr are cleared to avoid reading uninitialized + * data and to ensure that uncompr compresses well. + */ + if (compr == Z_NULL || uncompr == Z_NULL) { + printf("out of memory\n"); + exit(1); + } + test_compress(compr, comprLen, uncompr, uncomprLen); + + test_gzio((argc > 1 ? argv[1] : TESTFILE), + uncompr, uncomprLen); + + test_deflate(compr, comprLen); + test_inflate(compr, comprLen, uncompr, uncomprLen); + + test_large_deflate(compr, comprLen, uncompr, uncomprLen); + test_large_inflate(compr, comprLen, uncompr, uncomprLen); + + test_flush(compr, &comprLen); + test_sync(compr, comprLen, uncompr, uncomprLen); + comprLen = uncomprLen; + + test_dict_deflate(compr, comprLen); + test_dict_inflate(compr, comprLen, uncompr, uncomprLen); + + free(compr); + free(uncompr); + + return 0; +} diff --git a/externals/zlib/gzclose.c b/externals/zlib/gzclose.c new file mode 100644 index 0000000..caeb99a --- /dev/null +++ b/externals/zlib/gzclose.c @@ -0,0 +1,25 @@ +/* gzclose.c -- zlib gzclose() function + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* gzclose() is in a separate file so that it is linked in only if it is used. + That way the other gzclose functions can be used instead to avoid linking in + unneeded compression or decompression routines. */ +int ZEXPORT gzclose(file) + gzFile file; +{ +#ifndef NO_GZCOMPRESS + gz_statep state; + + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); +#else + return gzclose_r(file); +#endif +} diff --git a/externals/zlib/gzguts.h b/externals/zlib/gzguts.h new file mode 100644 index 0000000..0f8fb79 --- /dev/null +++ b/externals/zlib/gzguts.h @@ -0,0 +1,132 @@ +/* gzguts.h -- zlib internal header definitions for gz* operations + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef _LARGEFILE64_SOURCE +# ifndef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# endif +# ifdef _FILE_OFFSET_BITS +# undef _FILE_OFFSET_BITS +# endif +#endif + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include +#include "zlib.h" +#ifdef STDC +# include +# include +# include +#endif +#include + +#ifdef NO_DEFLATE /* for compatibility with old definition */ +# define NO_GZCOMPRESS +#endif + +#ifdef _MSC_VER +# include +# define vsnprintf _vsnprintf +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +/* gz* functions always use library allocation functions */ +#ifndef STDC + extern voidp malloc OF((uInt size)); + extern void free OF((voidpf ptr)); +#endif + +/* get errno and strerror definition */ +#if defined UNDER_CE +# include +# define zstrerror() gz_strwinerror((DWORD)GetLastError()) +#else +# ifdef STDC +# include +# define zstrerror() strerror(errno) +# else +# define zstrerror() "stdio error (consult errno)" +# endif +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); +#endif + +/* default i/o buffer size -- double this for output when reading */ +#define GZBUFSIZE 8192 + +/* gzip modes, also provide a little integrity check on the passed structure */ +#define GZ_NONE 0 +#define GZ_READ 7247 +#define GZ_WRITE 31153 +#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ + +/* values for gz_state how */ +#define LOOK 0 /* look for a gzip header */ +#define COPY 1 /* copy input directly */ +#define GZIP 2 /* decompress a gzip stream */ + +/* internal gzip file state data structure */ +typedef struct { + /* used for both reading and writing */ + int mode; /* see gzip modes above */ + int fd; /* file descriptor */ + char *path; /* path or fd for error messages */ + z_off64_t pos; /* current position in uncompressed data */ + unsigned size; /* buffer size, zero if not allocated yet */ + unsigned want; /* requested buffer size, default is GZBUFSIZE */ + unsigned char *in; /* input buffer */ + unsigned char *out; /* output buffer (double-sized when reading) */ + unsigned char *next; /* next output data to deliver or write */ + /* just for reading */ + unsigned have; /* amount of output data unused at next */ + int eof; /* true if end of input file reached */ + z_off64_t start; /* where the gzip data started, for rewinding */ + z_off64_t raw; /* where the raw data started, for seeking */ + int how; /* 0: get header, 1: copy, 2: decompress */ + int direct; /* true if last read direct, false if gzip */ + /* just for writing */ + int level; /* compression level */ + int strategy; /* compression strategy */ + /* seek request */ + z_off64_t skip; /* amount to skip (already rewound if backwards) */ + int seek; /* true if seek request pending */ + /* error information */ + int err; /* error code */ + char *msg; /* error message */ + /* zlib inflate or deflate stream */ + z_stream strm; /* stream structure in-place (not a pointer) */ +} gz_state; +typedef gz_state FAR *gz_statep; + +/* shared functions */ +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +#if defined UNDER_CE +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +#endif + +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t + value -- needed when comparing unsigned to z_off64_t, which is signed + (possible z_off64_t types off_t, off64_t, and long are all signed) */ +#ifdef INT_MAX +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) +#else +unsigned ZLIB_INTERNAL gz_intmax OF((void)); +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) +#endif diff --git a/externals/zlib/gzlib.c b/externals/zlib/gzlib.c new file mode 100644 index 0000000..603e60e --- /dev/null +++ b/externals/zlib/gzlib.c @@ -0,0 +1,537 @@ +/* gzlib.c -- zlib functions common to reading and writing gzip files + * Copyright (C) 2004, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define LSEEK lseek64 +#else +# define LSEEK lseek +#endif + +/* Local functions */ +local void gz_reset OF((gz_statep)); +local gzFile gz_open OF((const char *, int, const char *)); + +#if defined UNDER_CE + +/* Map the Windows error number in ERROR to a locale-dependent error message + string and return a pointer to it. Typically, the values for ERROR come + from GetLastError. + + The string pointed to shall not be modified by the application, but may be + overwritten by a subsequent call to gz_strwinerror + + The gz_strwinerror function does not change the current setting of + GetLastError. */ +char ZLIB_INTERNAL *gz_strwinerror (error) + DWORD error; +{ + static char buf[1024]; + + wchar_t *msgbuf; + DWORD lasterr = GetLastError(); + DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, /* Default language */ + (LPVOID)&msgbuf, + 0, + NULL); + if (chars != 0) { + /* If there is an \r\n appended, zap it. */ + if (chars >= 2 + && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { + chars -= 2; + msgbuf[chars] = 0; + } + + if (chars > sizeof (buf) - 1) { + chars = sizeof (buf) - 1; + msgbuf[chars] = 0; + } + + wcstombs(buf, msgbuf, chars + 1); + LocalFree(msgbuf); + } + else { + sprintf(buf, "unknown win32 error (%ld)", error); + } + + SetLastError(lasterr); + return buf; +} + +#endif /* UNDER_CE */ + +/* Reset gzip file state */ +local void gz_reset(state) + gz_statep state; +{ + if (state->mode == GZ_READ) { /* for reading ... */ + state->have = 0; /* no output data available */ + state->eof = 0; /* not at end of file */ + state->how = LOOK; /* look for gzip header */ + state->direct = 1; /* default for empty file */ + } + state->seek = 0; /* no seek request pending */ + gz_error(state, Z_OK, NULL); /* clear error */ + state->pos = 0; /* no uncompressed data yet */ + state->strm.avail_in = 0; /* no input data yet */ +} + +/* Open a gzip file either by name or file descriptor. */ +local gzFile gz_open(path, fd, mode) + const char *path; + int fd; + const char *mode; +{ + gz_statep state; + + /* allocate gzFile structure to return */ + state = malloc(sizeof(gz_state)); + if (state == NULL) + return NULL; + state->size = 0; /* no buffers allocated yet */ + state->want = GZBUFSIZE; /* requested buffer size */ + state->msg = NULL; /* no error message yet */ + + /* interpret mode */ + state->mode = GZ_NONE; + state->level = Z_DEFAULT_COMPRESSION; + state->strategy = Z_DEFAULT_STRATEGY; + while (*mode) { + if (*mode >= '0' && *mode <= '9') + state->level = *mode - '0'; + else + switch (*mode) { + case 'r': + state->mode = GZ_READ; + break; +#ifndef NO_GZCOMPRESS + case 'w': + state->mode = GZ_WRITE; + break; + case 'a': + state->mode = GZ_APPEND; + break; +#endif + case '+': /* can't read and write at the same time */ + free(state); + return NULL; + case 'b': /* ignore -- will request binary anyway */ + break; + case 'f': + state->strategy = Z_FILTERED; + break; + case 'h': + state->strategy = Z_HUFFMAN_ONLY; + break; + case 'R': + state->strategy = Z_RLE; + break; + case 'F': + state->strategy = Z_FIXED; + default: /* could consider as an error, but just ignore */ + ; + } + mode++; + } + + /* must provide an "r", "w", or "a" */ + if (state->mode == GZ_NONE) { + free(state); + return NULL; + } + + /* save the path name for error messages */ + state->path = malloc(strlen(path) + 1); + if (state->path == NULL) { + free(state); + return NULL; + } + strcpy(state->path, path); + + /* open the file with the appropriate mode (or just use fd) */ + state->fd = fd != -1 ? fd : + open(path, +#ifdef O_LARGEFILE + O_LARGEFILE | +#endif +#ifdef O_BINARY + O_BINARY | +#endif + (state->mode == GZ_READ ? + O_RDONLY : + (O_WRONLY | O_CREAT | ( + state->mode == GZ_WRITE ? + O_TRUNC : + O_APPEND))), + 0666); + if (state->fd == -1) { + free(state->path); + free(state); + return NULL; + } + if (state->mode == GZ_APPEND) + state->mode = GZ_WRITE; /* simplify later checks */ + + /* save the current position for rewinding (only if reading) */ + if (state->mode == GZ_READ) { + state->start = LSEEK(state->fd, 0, SEEK_CUR); + if (state->start == -1) state->start = 0; + } + + /* initialize stream */ + gz_reset(state); + + /* return stream */ + return (gzFile)state; +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzopen64(path, mode) + const char *path; + const char *mode; +{ + return gz_open(path, -1, mode); +} + +/* -- see zlib.h -- */ +gzFile ZEXPORT gzdopen(fd, mode) + int fd; + const char *mode; +{ + char *path; /* identifier for error messages */ + gzFile gz; + + if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) + return NULL; + sprintf(path, "", fd); /* for debugging */ + gz = gz_open(path, fd, mode); + free(path); + return gz; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzbuffer(file, size) + gzFile file; + unsigned size; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* make sure we haven't already allocated memory */ + if (state->size != 0) + return -1; + + /* check and set requested size */ + if (size == 0) + return -1; + state->want = size; + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzrewind(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* back up and start over */ + if (LSEEK(state->fd, state->start, SEEK_SET) == -1) + return -1; + gz_reset(state); + return 0; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzseek64(file, offset, whence) + gzFile file; + z_off64_t offset; + int whence; +{ + unsigned n; + z_off64_t ret; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* check that there's no error */ + if (state->err != Z_OK) + return -1; + + /* can only seek from start or relative to current position */ + if (whence != SEEK_SET && whence != SEEK_CUR) + return -1; + + /* normalize offset to a SEEK_CUR specification */ + if (whence == SEEK_SET) + offset -= state->pos; + else if (state->seek) + offset += state->skip; + state->seek = 0; + + /* if within raw area while reading, just go there */ + if (state->mode == GZ_READ && state->how == COPY && + state->pos + offset >= state->raw) { + ret = LSEEK(state->fd, offset - state->have, SEEK_CUR); + if (ret == -1) + return -1; + state->have = 0; + state->eof = 0; + state->seek = 0; + gz_error(state, Z_OK, NULL); + state->strm.avail_in = 0; + state->pos += offset; + return state->pos; + } + + /* calculate skip amount, rewinding if needed for back seek when reading */ + if (offset < 0) { + if (state->mode != GZ_READ) /* writing -- can't go backwards */ + return -1; + offset += state->pos; + if (offset < 0) /* before start of file! */ + return -1; + if (gzrewind(file) == -1) /* rewind, then skip to offset */ + return -1; + } + + /* if reading, skip what's in output buffer (one less gzgetc() check) */ + if (state->mode == GZ_READ) { + n = GT_OFF(state->have) || (z_off64_t)state->have > offset ? + (unsigned)offset : state->have; + state->have -= n; + state->next += n; + state->pos += n; + offset -= n; + } + + /* request skip (if not zero) */ + if (offset) { + state->seek = 1; + state->skip = offset; + } + return state->pos + offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzseek(file, offset, whence) + gzFile file; + z_off_t offset; + int whence; +{ + z_off64_t ret; + + ret = gzseek64(file, (z_off64_t)offset, whence); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gztell64(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* return position */ + return state->pos + (state->seek ? state->skip : 0); +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gztell(file) + gzFile file; +{ + z_off64_t ret; + + ret = gztell64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +z_off64_t ZEXPORT gzoffset64(file) + gzFile file; +{ + z_off64_t offset; + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return -1; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return -1; + + /* compute and return effective offset in file */ + offset = LSEEK(state->fd, 0, SEEK_CUR); + if (offset == -1) + return -1; + if (state->mode == GZ_READ) /* reading */ + offset -= state->strm.avail_in; /* don't count buffered input */ + return offset; +} + +/* -- see zlib.h -- */ +z_off_t ZEXPORT gzoffset(file) + gzFile file; +{ + z_off64_t ret; + + ret = gzoffset64(file); + return ret == (z_off_t)ret ? (z_off_t)ret : -1; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzeof(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return 0; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return 0; + + /* return end-of-file state */ + return state->mode == GZ_READ ? + (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0; +} + +/* -- see zlib.h -- */ +const char * ZEXPORT gzerror(file, errnum) + gzFile file; + int *errnum; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return NULL; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return NULL; + + /* return error information */ + if (errnum != NULL) + *errnum = state->err; + return state->msg == NULL ? "" : state->msg; +} + +/* -- see zlib.h -- */ +void ZEXPORT gzclearerr(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure and check integrity */ + if (file == NULL) + return; + state = (gz_statep)file; + if (state->mode != GZ_READ && state->mode != GZ_WRITE) + return; + + /* clear error and end-of-file */ + if (state->mode == GZ_READ) + state->eof = 0; + gz_error(state, Z_OK, NULL); +} + +/* Create an error message in allocated memory and set state->err and + state->msg accordingly. Free any previous error message already there. Do + not try to free or allocate space if the error is Z_MEM_ERROR (out of + memory). Simply save the error message as a static string. If there is an + allocation failure constructing the error message, then convert the error to + out of memory. */ +void ZLIB_INTERNAL gz_error(state, err, msg) + gz_statep state; + int err; + const char *msg; +{ + /* free previously allocated message and clear */ + if (state->msg != NULL) { + if (state->err != Z_MEM_ERROR) + free(state->msg); + state->msg = NULL; + } + + /* set error code, and if no message, then done */ + state->err = err; + if (msg == NULL) + return; + + /* for an out of memory error, save as static string */ + if (err == Z_MEM_ERROR) { + state->msg = (char *)msg; + return; + } + + /* construct error message with path */ + if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { + state->err = Z_MEM_ERROR; + state->msg = (char *)"out of memory"; + return; + } + strcpy(state->msg, state->path); + strcat(state->msg, ": "); + strcat(state->msg, msg); + return; +} + +#ifndef INT_MAX +/* portably return maximum value for an int (when limits.h presumed not + available) -- we need to do this to cover cases where 2's complement not + used, since C standard permits 1's complement and sign-bit representations, + otherwise we could just use ((unsigned)-1) >> 1 */ +unsigned ZLIB_INTERNAL gz_intmax() +{ + unsigned p, q; + + p = 1; + do { + q = p; + p <<= 1; + p++; + } while (p > q); + return q >> 1; +} +#endif diff --git a/externals/zlib/gzread.c b/externals/zlib/gzread.c new file mode 100644 index 0000000..548201a --- /dev/null +++ b/externals/zlib/gzread.c @@ -0,0 +1,653 @@ +/* gzread.c -- zlib functions for reading gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); +local int gz_avail OF((gz_statep)); +local int gz_next4 OF((gz_statep, unsigned long *)); +local int gz_head OF((gz_statep)); +local int gz_decomp OF((gz_statep)); +local int gz_make OF((gz_statep)); +local int gz_skip OF((gz_statep, z_off64_t)); + +/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from + state->fd, and update state->eof, state->err, and state->msg as appropriate. + This function needs to loop on read(), since read() is not guaranteed to + read the number of bytes requested, depending on the type of descriptor. */ +local int gz_load(state, buf, len, have) + gz_statep state; + unsigned char *buf; + unsigned len; + unsigned *have; +{ + int ret; + + *have = 0; + do { + ret = read(state->fd, buf + *have, len - *have); + if (ret <= 0) + break; + *have += ret; + } while (*have < len); + if (ret < 0) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (ret == 0) + state->eof = 1; + return 0; +} + +/* Load up input buffer and set eof flag if last data loaded -- return -1 on + error, 0 otherwise. Note that the eof flag is set when the end of the input + file is reached, even though there may be unused data in the buffer. Once + that data has been used, no more attempts will be made to read the file. + gz_avail() assumes that strm->avail_in == 0. */ +local int gz_avail(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->err != Z_OK) + return -1; + if (state->eof == 0) { + if (gz_load(state, state->in, state->size, + (unsigned *)&(strm->avail_in)) == -1) + return -1; + strm->next_in = state->in; + } + return 0; +} + +/* Get next byte from input, or -1 if end or error. */ +#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \ + (strm->avail_in == 0 ? -1 : \ + (strm->avail_in--, *(strm->next_in)++))) + +/* Get a four-byte little-endian integer and return 0 on success and the value + in *ret. Otherwise -1 is returned and *ret is not modified. */ +local int gz_next4(state, ret) + gz_statep state; + unsigned long *ret; +{ + int ch; + unsigned long val; + z_streamp strm = &(state->strm); + + val = NEXT(); + val += (unsigned)NEXT() << 8; + val += (unsigned long)NEXT() << 16; + ch = NEXT(); + if (ch == -1) + return -1; + val += (unsigned long)ch << 24; + *ret = val; + return 0; +} + +/* Look for gzip header, set up for inflate or copy. state->have must be zero. + If this is the first time in, allocate required memory. state->how will be + left unchanged if there is no more input data available, will be set to COPY + if there is no gzip header and direct copying will be performed, or it will + be set to GZIP for decompression, and the gzip header will be skipped so + that the next available input data is the raw deflate stream. If direct + copying, then leftover input data from the input buffer will be copied to + the output buffer. In that case, all further file reads will be directly to + either the output buffer or a user buffer. If decompressing, the inflate + state and the check value will be initialized. gz_head() will return 0 on + success or -1 on failure. Failures may include read errors or gzip header + errors. */ +local int gz_head(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + int flags; + unsigned len; + + /* allocate read buffers and inflate memory */ + if (state->size == 0) { + /* allocate buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want << 1); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + state->size = state->want; + + /* allocate inflate memory */ + state->strm.zalloc = Z_NULL; + state->strm.zfree = Z_NULL; + state->strm.opaque = Z_NULL; + state->strm.avail_in = 0; + state->strm.next_in = Z_NULL; + if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */ + free(state->out); + free(state->in); + state->size = 0; + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + } + + /* get some data in the input buffer */ + if (strm->avail_in == 0) { + if (gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) + return 0; + } + + /* look for the gzip magic header bytes 31 and 139 */ + if (strm->next_in[0] == 31) { + strm->avail_in--; + strm->next_in++; + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in && strm->next_in[0] == 139) { + /* we have a gzip header, woo hoo! */ + strm->avail_in--; + strm->next_in++; + + /* skip rest of header */ + if (NEXT() != 8) { /* compression method */ + gz_error(state, Z_DATA_ERROR, "unknown compression method"); + return -1; + } + flags = NEXT(); + if (flags & 0xe0) { /* reserved flag bits */ + gz_error(state, Z_DATA_ERROR, "unknown header flags set"); + return -1; + } + NEXT(); /* modification time */ + NEXT(); + NEXT(); + NEXT(); + NEXT(); /* extra flags */ + NEXT(); /* operating system */ + if (flags & 4) { /* extra field */ + len = (unsigned)NEXT(); + len += (unsigned)NEXT() << 8; + while (len--) + if (NEXT() < 0) + break; + } + if (flags & 8) /* file name */ + while (NEXT() > 0) + ; + if (flags & 16) /* comment */ + while (NEXT() > 0) + ; + if (flags & 2) { /* header crc */ + NEXT(); + NEXT(); + } + /* an unexpected end of file is not checked for here -- it will be + noticed on the first request for uncompressed data */ + + /* set up for decompression */ + inflateReset(strm); + strm->adler = crc32(0L, Z_NULL, 0); + state->how = GZIP; + state->direct = 0; + return 0; + } + else { + /* not a gzip file -- save first byte (31) and fall to raw i/o */ + state->out[0] = 31; + state->have = 1; + } + } + + /* doing raw i/o, save start of raw data for seeking, copy any leftover + input to output -- this assumes that the output buffer is larger than + the input buffer, which also assures space for gzungetc() */ + state->raw = state->pos; + state->next = state->out; + if (strm->avail_in) { + memcpy(state->next + state->have, strm->next_in, strm->avail_in); + state->have += strm->avail_in; + strm->avail_in = 0; + } + state->how = COPY; + state->direct = 1; + return 0; +} + +/* Decompress from input to the provided next_out and avail_out in the state. + If the end of the compressed data is reached, then verify the gzip trailer + check value and length (modulo 2^32). state->have and state->next are set + to point to the just decompressed data, and the crc is updated. If the + trailer is verified, state->how is reset to LOOK to look for the next gzip + stream or raw data, once state->have is depleted. Returns 0 on success, -1 + on failure. Failures may include invalid compressed data or a failed gzip + trailer verification. */ +local int gz_decomp(state) + gz_statep state; +{ + int ret; + unsigned had; + unsigned long crc, len; + z_streamp strm = &(state->strm); + + /* fill output buffer up to end of deflate stream */ + had = strm->avail_out; + do { + /* get more input for inflate() */ + if (strm->avail_in == 0 && gz_avail(state) == -1) + return -1; + if (strm->avail_in == 0) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + + /* decompress and handle errors */ + ret = inflate(strm, Z_NO_FLUSH); + if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { + gz_error(state, Z_STREAM_ERROR, + "internal error: inflate stream corrupt"); + return -1; + } + if (ret == Z_MEM_ERROR) { + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ + gz_error(state, Z_DATA_ERROR, + strm->msg == NULL ? "compressed data error" : strm->msg); + return -1; + } + } while (strm->avail_out && ret != Z_STREAM_END); + + /* update available output and crc check value */ + state->have = had - strm->avail_out; + state->next = strm->next_out - state->have; + strm->adler = crc32(strm->adler, state->next, state->have); + + /* check gzip trailer if at end of deflate stream */ + if (ret == Z_STREAM_END) { + if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) { + gz_error(state, Z_DATA_ERROR, "unexpected end of file"); + return -1; + } + if (crc != strm->adler) { + gz_error(state, Z_DATA_ERROR, "incorrect data check"); + return -1; + } + if (len != (strm->total_out & 0xffffffffL)) { + gz_error(state, Z_DATA_ERROR, "incorrect length check"); + return -1; + } + state->how = LOOK; /* ready for next stream, once have is 0 (leave + state->direct unchanged to remember how) */ + } + + /* good decompression */ + return 0; +} + +/* Make data and put in the output buffer. Assumes that state->have == 0. + Data is either copied from the input file or decompressed from the input + file depending on state->how. If state->how is LOOK, then a gzip header is + looked for (and skipped if found) to determine wither to copy or decompress. + Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY + or GZIP unless the end of the input file has been reached and all data has + been processed. */ +local int gz_make(state) + gz_statep state; +{ + z_streamp strm = &(state->strm); + + if (state->how == LOOK) { /* look for gzip header */ + if (gz_head(state) == -1) + return -1; + if (state->have) /* got some data from gz_head() */ + return 0; + } + if (state->how == COPY) { /* straight copy */ + if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1) + return -1; + state->next = state->out; + } + else if (state->how == GZIP) { /* decompress */ + strm->avail_out = state->size << 1; + strm->next_out = state->out; + if (gz_decomp(state) == -1) + return -1; + } + return 0; +} + +/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ +local int gz_skip(state, len) + gz_statep state; + z_off64_t len; +{ + unsigned n; + + /* skip over len bytes or reach end-of-file, whichever comes first */ + while (len) + /* skip over whatever is in output buffer */ + if (state->have) { + n = GT_OFF(state->have) || (z_off64_t)state->have > len ? + (unsigned)len : state->have; + state->have -= n; + state->next += n; + state->pos += n; + len -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && state->strm.avail_in == 0) + break; + + /* need more data to skip -- load up output buffer */ + else { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzread(file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + unsigned got, n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return -1; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* get len bytes to buf, or less than len if at the end */ + got = 0; + do { + /* first just try copying data from the output buffer */ + if (state->have) { + n = state->have > len ? len : state->have; + memcpy(buf, state->next, n); + state->next += n; + state->have -= n; + } + + /* output buffer empty -- return if we're at the end of the input */ + else if (state->eof && strm->avail_in == 0) + break; + + /* need output data -- for small len or new stream load up our output + buffer */ + else if (state->how == LOOK || len < (state->size << 1)) { + /* get more output, looking for header if required */ + if (gz_make(state) == -1) + return -1; + continue; /* no progress yet -- go back to memcpy() above */ + /* the copy above assures that we will leave with space in the + output buffer, allowing at least one gzungetc() to succeed */ + } + + /* large len -- read directly into user buffer */ + else if (state->how == COPY) { /* read directly */ + if (gz_load(state, buf, len, &n) == -1) + return -1; + } + + /* large len -- decompress directly into user buffer */ + else { /* state->how == GZIP */ + strm->avail_out = len; + strm->next_out = buf; + if (gz_decomp(state) == -1) + return -1; + n = state->have; + state->have = 0; + } + + /* update progress */ + len -= n; + buf = (char *)buf + n; + got += n; + state->pos += n; + } while (len); + + /* return number of bytes read into user buffer (will fit in int) */ + return (int)got; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzgetc(file) + gzFile file; +{ + int ret; + unsigned char buf[1]; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* try output buffer (no need to check for skip request) */ + if (state->have) { + state->have--; + state->pos++; + return *(state->next)++; + } + + /* nothing there -- try gzread() */ + ret = gzread(file, buf, 1); + return ret < 1 ? -1 : buf[0]; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzungetc(c, file) + int c; + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return -1; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return -1; + } + + /* can't push EOF */ + if (c < 0) + return -1; + + /* if output buffer empty, put byte at end (allows more pushing) */ + if (state->have == 0) { + state->have = 1; + state->next = state->out + (state->size << 1) - 1; + state->next[0] = c; + state->pos--; + return c; + } + + /* if no room, give up (must have already done a gzungetc()) */ + if (state->have == (state->size << 1)) { + gz_error(state, Z_BUF_ERROR, "out of room to push characters"); + return -1; + } + + /* slide output data if needed and insert byte before existing data */ + if (state->next == state->out) { + unsigned char *src = state->out + state->have; + unsigned char *dest = state->out + (state->size << 1); + while (src > state->out) + *--dest = *--src; + state->next = dest; + } + state->have++; + state->next--; + state->next[0] = c; + state->pos--; + return c; +} + +/* -- see zlib.h -- */ +char * ZEXPORT gzgets(file, buf, len) + gzFile file; + char *buf; + int len; +{ + unsigned left, n; + char *str; + unsigned char *eol; + gz_statep state; + + /* check parameters and get internal structure */ + if (file == NULL || buf == NULL || len < 1) + return NULL; + state = (gz_statep)file; + + /* check that we're reading and that there's no error */ + if (state->mode != GZ_READ || state->err != Z_OK) + return NULL; + + /* process a skip request */ + if (state->seek) { + state->seek = 0; + if (gz_skip(state, state->skip) == -1) + return NULL; + } + + /* copy output bytes up to new line or len - 1, whichever comes first -- + append a terminating zero to the string (we don't check for a zero in + the contents, let the user worry about that) */ + str = buf; + left = (unsigned)len - 1; + if (left) do { + /* assure that something is in the output buffer */ + if (state->have == 0) { + if (gz_make(state) == -1) + return NULL; /* error */ + if (state->have == 0) { /* end of file */ + if (buf == str) /* got bupkus */ + return NULL; + break; /* got something -- return it */ + } + } + + /* look for end-of-line in current output buffer */ + n = state->have > left ? left : state->have; + eol = memchr(state->next, '\n', n); + if (eol != NULL) + n = (unsigned)(eol - state->next) + 1; + + /* copy through end-of-line, or remainder if not found */ + memcpy(buf, state->next, n); + state->have -= n; + state->next += n; + state->pos += n; + left -= n; + buf += n; + } while (left && eol == NULL); + + /* found end-of-line or out of space -- terminate string and return it */ + buf[0] = 0; + return str; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzdirect(file) + gzFile file; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return 0; + + /* if the state is not known, but we can find out, then do so (this is + mainly for right after a gzopen() or gzdopen()) */ + if (state->how == LOOK && state->have == 0) + (void)gz_head(state); + + /* return 1 if reading direct, 0 if decompressing a gzip stream */ + return state->direct; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_r(file) + gzFile file; +{ + int ret; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're reading */ + if (state->mode != GZ_READ) + return Z_STREAM_ERROR; + + /* free memory and close file */ + if (state->size) { + inflateEnd(&(state->strm)); + free(state->out); + free(state->in); + } + gz_error(state, Z_OK, NULL); + free(state->path); + ret = close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/externals/zlib/gzwrite.c b/externals/zlib/gzwrite.c new file mode 100644 index 0000000..e8defc6 --- /dev/null +++ b/externals/zlib/gzwrite.c @@ -0,0 +1,531 @@ +/* gzwrite.c -- zlib functions for writing gzip files + * Copyright (C) 2004, 2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "gzguts.h" + +/* Local functions */ +local int gz_init OF((gz_statep)); +local int gz_comp OF((gz_statep, int)); +local int gz_zero OF((gz_statep, z_off64_t)); + +/* Initialize state for writing a gzip file. Mark initialization by setting + state->size to non-zero. Return -1 on failure or 0 on success. */ +local int gz_init(state) + gz_statep state; +{ + int ret; + z_streamp strm = &(state->strm); + + /* allocate input and output buffers */ + state->in = malloc(state->want); + state->out = malloc(state->want); + if (state->in == NULL || state->out == NULL) { + if (state->out != NULL) + free(state->out); + if (state->in != NULL) + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* allocate deflate memory, set up for gzip compression */ + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; + strm->opaque = Z_NULL; + ret = deflateInit2(strm, state->level, Z_DEFLATED, + 15 + 16, 8, state->strategy); + if (ret != Z_OK) { + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* mark state as initialized */ + state->size = state->want; + + /* initialize write buffer */ + strm->avail_out = state->size; + strm->next_out = state->out; + state->next = strm->next_out; + return 0; +} + +/* Compress whatever is at avail_in and next_in and write to the output file. + Return -1 if there is an error writing to the output file, otherwise 0. + flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, + then the deflate() state is reset to start a new gzip stream. */ +local int gz_comp(state, flush) + gz_statep state; + int flush; +{ + int ret, got; + unsigned have; + z_streamp strm = &(state->strm); + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return -1; + + /* run deflate() on provided input until it produces no more output */ + ret = Z_OK; + do { + /* write out current buffer contents if full, or if flushing, but if + doing Z_FINISH then don't write until we get to Z_STREAM_END */ + if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && + (flush != Z_FINISH || ret == Z_STREAM_END))) { + have = (unsigned)(strm->next_out - state->next); + if (have && ((got = write(state->fd, state->next, have)) < 0 || + (unsigned)got != have)) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + if (strm->avail_out == 0) { + strm->avail_out = state->size; + strm->next_out = state->out; + } + state->next = strm->next_out; + } + + /* compress */ + have = strm->avail_out; + ret = deflate(strm, flush); + if (ret == Z_STREAM_ERROR) { + gz_error(state, Z_STREAM_ERROR, + "internal error: deflate stream corrupt"); + return -1; + } + have -= strm->avail_out; + } while (have); + + /* if that completed a deflate stream, allow another to start */ + if (flush == Z_FINISH) + deflateReset(strm); + + /* all done, no errors */ + return 0; +} + +/* Compress len zeros to output. Return -1 on error, 0 on success. */ +local int gz_zero(state, len) + gz_statep state; + z_off64_t len; +{ + int first; + unsigned n; + z_streamp strm = &(state->strm); + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + + /* compress len zeros (len guaranteed > 0) */ + first = 1; + while (len) { + n = GT_OFF(state->size) || (z_off64_t)state->size > len ? + (unsigned)len : state->size; + if (first) { + memset(state->in, 0, n); + first = 0; + } + strm->avail_in = n; + strm->next_in = state->in; + state->pos += n; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return -1; + len -= n; + } + return 0; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzwrite(file, buf, len) + gzFile file; + voidpc buf; + unsigned len; +{ + unsigned put = len; + unsigned n; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids the flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + return 0; + } + + /* if len is zero, avoid unnecessary operations */ + if (len == 0) + return 0; + + /* allocate memory if this is the first time through */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* for small len, copy to input buffer, otherwise compress directly */ + if (len < state->size) { + /* copy to input buffer, compress when full */ + do { + if (strm->avail_in == 0) + strm->next_in = state->in; + n = state->size - strm->avail_in; + if (n > len) + n = len; + memcpy(strm->next_in + strm->avail_in, buf, n); + strm->avail_in += n; + state->pos += n; + buf = (char *)buf + n; + len -= n; + if (len && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } while (len); + } + else { + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* directly compress user buffer to file */ + strm->avail_in = len; + strm->next_in = (voidp)buf; + state->pos += len; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + } + + /* input was all buffered or compressed (put will fit in int) */ + return (int)put; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputc(file, c) + gzFile file; + int c; +{ + unsigned char buf[1]; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return -1; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* try writing to input buffer for speed (state->size == 0 if buffer not + initialized) */ + if (strm->avail_in < state->size) { + if (strm->avail_in == 0) + strm->next_in = state->in; + strm->next_in[strm->avail_in++] = c; + state->pos++; + return c; + } + + /* no room in buffer or not initialized, use gz_write() */ + buf[0] = c; + if (gzwrite(file, buf, 1) != 1) + return -1; + return c; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzputs(file, str) + gzFile file; + const char *str; +{ + int ret; + unsigned len; + + /* write string */ + len = (unsigned)strlen(str); + ret = gzwrite(file, str, len); + return ret == 0 && len != 0 ? -1 : ret; +} + +#ifdef STDC +#include + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) +{ + int size, len; + gz_statep state; + z_streamp strm; + va_list va; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; + va_start(va, format); +#ifdef NO_vsnprintf +# ifdef HAS_vsprintf_void + (void)vsprintf(state->in, format, va); + va_end(va); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = vsprintf(state->in, format, va); + va_end(va); +# endif +#else +# ifdef HAS_vsnprintf_void + (void)vsnprintf(state->in, size, format, va); + va_end(va); + len = strlen(state->in); +# else + len = vsnprintf((char *)(state->in), size, format, va); + va_end(va); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#else /* !STDC */ + +/* -- see zlib.h -- */ +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + gzFile file; + const char *format; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ + int size, len; + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* make sure we have some buffer space */ + if (state->size == 0 && gz_init(state) == -1) + return 0; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return 0; + } + + /* consume whatever's left in the input buffer */ + if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + + /* do the printf() into the input buffer, put length in len */ + size = (int)(state->size); + state->in[size - 1] = 0; +#ifdef NO_snprintf +# ifdef HAS_sprintf_void + sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + for (len = 0; len < size; len++) + if (state->in[len] == 0) break; +# else + len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#else +# ifdef HAS_snprintf_void + snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(state->in); +# else + len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#endif + + /* check that printf() results fit in buffer */ + if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + return 0; + + /* update buffer and position, defer compression until needed */ + strm->avail_in = (unsigned)len; + strm->next_in = state->in; + state->pos += len; + return len; +} + +#endif + +/* -- see zlib.h -- */ +int ZEXPORT gzflush(file, flush) + gzFile file; + int flush; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* check flush parameter */ + if (flush < 0 || flush > Z_FINISH) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* compress remaining data with requested flush */ + gz_comp(state, flush); + return state->err; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzsetparams(file, level, strategy) + gzFile file; + int level; + int strategy; +{ + gz_statep state; + z_streamp strm; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + strm = &(state->strm); + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return Z_STREAM_ERROR; + + /* if no change is requested, then do nothing */ + if (level == state->level && strategy == state->strategy) + return Z_OK; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + if (gz_zero(state, state->skip) == -1) + return -1; + } + + /* change compression parameters for subsequent input */ + if (state->size) { + /* flush previous input with previous parameters before changing */ + if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) + return state->err; + deflateParams(strm, level, strategy); + } + state->level = level; + state->strategy = strategy; + return Z_OK; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzclose_w(file) + gzFile file; +{ + int ret = 0; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return Z_STREAM_ERROR; + state = (gz_statep)file; + + /* check that we're writing */ + if (state->mode != GZ_WRITE) + return Z_STREAM_ERROR; + + /* check for seek request */ + if (state->seek) { + state->seek = 0; + ret += gz_zero(state, state->skip); + } + + /* flush, free memory, and close file */ + ret += gz_comp(state, Z_FINISH); + (void)deflateEnd(&(state->strm)); + free(state->out); + free(state->in); + gz_error(state, Z_OK, NULL); + free(state->path); + ret += close(state->fd); + free(state); + return ret ? Z_ERRNO : Z_OK; +} diff --git a/externals/zlib/infback.c b/externals/zlib/infback.c new file mode 100644 index 0000000..af3a8c9 --- /dev/null +++ b/externals/zlib/infback.c @@ -0,0 +1,632 @@ +/* infback.c -- inflate using a call-back interface + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + This code is largely copied from inflate.c. Normally either infback.o or + inflate.o would be linked into an application--not both. The interface + with inffast.c is retained so that optimized assembler-coded versions of + inflate_fast() can be used with either inflate.c or infback.c. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); + +/* + strm provides memory allocation functions in zalloc and zfree, or + Z_NULL to use the library memory allocation functions. + + windowBits is in the range 8..15, and window is a user-supplied + window and output buffer that is 2**windowBits bytes. + */ +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) +z_streamp strm; +int windowBits; +unsigned char FAR *window; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL || window == Z_NULL || + windowBits < 8 || windowBits > 15) + return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *)ZALLOC(strm, 1, + sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->dmax = 32768U; + state->wbits = windowBits; + state->wsize = 1U << windowBits; + state->window = window; + state->wnext = 0; + state->whave = 0; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +/* Macros for inflateBack(): */ + +/* Load returned state from inflate_fast() */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Set state from registers for inflate_fast() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Assure that some input is available. If input is requested, but denied, + then return a Z_BUF_ERROR from inflateBack(). */ +#define PULL() \ + do { \ + if (have == 0) { \ + have = in(in_desc, &next); \ + if (have == 0) { \ + next = Z_NULL; \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflateBack() + with an error if there is no input available. */ +#define PULLBYTE() \ + do { \ + PULL(); \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflateBack() with + an error. */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Assure that some output space is available, by writing out the window + if it's full. If the write fails, return from inflateBack() with a + Z_BUF_ERROR. */ +#define ROOM() \ + do { \ + if (left == 0) { \ + put = state->window; \ + left = state->wsize; \ + state->whave = left; \ + if (out(out_desc, put, left)) { \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* + strm provides the memory allocation functions and window buffer on input, + and provides information on the unused input on return. For Z_DATA_ERROR + returns, strm will also provide an error message. + + in() and out() are the call-back input and output functions. When + inflateBack() needs more input, it calls in(). When inflateBack() has + filled the window with output, or when it completes with data in the + window, it calls out() to write out the data. The application must not + change the provided input until in() is called again or inflateBack() + returns. The application must not change the window/output buffer until + inflateBack() returns. + + in() and out() are called with a descriptor parameter provided in the + inflateBack() call. This parameter can be a structure that provides the + information required to do the read or write, as well as accumulated + information on the input and output such as totals and check values. + + in() should return zero on failure. out() should return non-zero on + failure. If either in() or out() fails, than inflateBack() returns a + Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it + was in() or out() that caused in the error. Otherwise, inflateBack() + returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format + error, or Z_MEM_ERROR if it could not allocate memory for the state. + inflateBack() can also return Z_STREAM_ERROR if the input parameters + are not correct, i.e. strm is Z_NULL or the state was not initialized. + */ +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) +z_streamp strm; +in_func in; +void FAR *in_desc; +out_func out; +void FAR *out_desc; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + /* Check that the strm exists and that the state was initialized */ + if (strm == Z_NULL || strm->state == Z_NULL) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* Reset the state */ + strm->msg = Z_NULL; + state->mode = TYPE; + state->last = 0; + state->whave = 0; + next = strm->next_in; + have = next != Z_NULL ? strm->avail_in : 0; + hold = 0; + bits = 0; + put = state->window; + left = state->wsize; + + /* Inflate until end of block marked as last */ + for (;;) + switch (state->mode) { + case TYPE: + /* determine and dispatch block type */ + if (state->last) { + BYTEBITS(); + state->mode = DONE; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + + case STORED: + /* get and verify stored block length */ + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + + /* copy stored block from input to output */ + while (state->length != 0) { + copy = state->length; + PULL(); + ROOM(); + if (copy > have) copy = have; + if (copy > left) copy = left; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + + case TABLE: + /* get dynamic table entries descriptor */ + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + + /* get code length code lengths (not a typo) */ + state->have = 0; + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + + /* get length and distance code code lengths */ + state->have = 0; + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = (unsigned)(state->lens[state->have - 1]); + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { + RESTORE(); + if (state->whave < state->wsize) + state->whave = state->wsize - left; + inflate_fast(strm, state->wsize); + LOAD(); + break; + } + + /* get a literal, length, or end-of-block code */ + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + state->length = (unsigned)here.val; + + /* process literal */ + if (here.op == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + ROOM(); + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + } + + /* process end of block */ + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + + /* invalid code */ + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + + /* length code -- get extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + + /* get distance code */ + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(here.bits); + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + + /* get distance extra bits, if any */ + state->extra = (unsigned)(here.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->wsize - (state->whave < state->wsize ? + left : 0)) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + + /* copy match from window to output */ + do { + ROOM(); + copy = state->wsize - state->offset; + if (copy < left) { + from = put + copy; + copy = left - copy; + } + else { + from = put - state->offset; + copy = left; + } + if (copy > state->length) copy = state->length; + state->length -= copy; + left -= copy; + do { + *put++ = *from++; + } while (--copy); + } while (state->length != 0); + break; + + case DONE: + /* inflate stream terminated properly -- write leftover output */ + ret = Z_STREAM_END; + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left)) + ret = Z_BUF_ERROR; + } + goto inf_leave; + + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + + default: /* can't happen, but makes compilers happy */ + ret = Z_STREAM_ERROR; + goto inf_leave; + } + + /* Return unused input */ + inf_leave: + strm->next_in = next; + strm->avail_in = have; + return ret; +} + +int ZEXPORT inflateBackEnd(strm) +z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} diff --git a/externals/zlib/inffast.c b/externals/zlib/inffast.c new file mode 100644 index 0000000..2f1d60b --- /dev/null +++ b/externals/zlib/inffast.c @@ -0,0 +1,340 @@ +/* inffast.c -- fast decoding + * Copyright (C) 1995-2008, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifndef ASMINF + +/* Allow machine dependent optimization for post-increment or pre-increment. + Based on testing to date, + Pre-increment preferred for: + - PowerPC G3 (Adler) + - MIPS R5000 (Randers-Pehrson) + Post-increment preferred for: + - none + No measurable difference: + - Pentium III (Anderson) + - M68060 (Nikl) + */ +#ifdef POSTINC +# define OFF 0 +# define PUP(a) *(a)++ +#else +# define OFF 1 +# define PUP(a) *++(a) +#endif + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state->mode == LEN + strm->avail_in >= 6 + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 + + On return, state->mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm->avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +void ZLIB_INTERNAL inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ +{ + struct inflate_state FAR *state; + unsigned char FAR *in; /* local strm->next_in */ + unsigned char FAR *last; /* while in < last, enough input available */ + unsigned char FAR *out; /* local strm->next_out */ + unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ + unsigned char FAR *end; /* while out < end, enough space available */ +#ifdef INFLATE_STRICT + unsigned dmax; /* maximum distance from zlib header */ +#endif + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ + unsigned long hold; /* local strm->hold */ + unsigned bits; /* local strm->bits */ + code const FAR *lcode; /* local strm->lencode */ + code const FAR *dcode; /* local strm->distcode */ + unsigned lmask; /* mask for first level of length codes */ + unsigned dmask; /* mask for first level of distance codes */ + code here; /* retrieved table entry */ + unsigned op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + unsigned len; /* match length, unused bytes */ + unsigned dist; /* match distance */ + unsigned char FAR *from; /* where to copy match from */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; + in = strm->next_in - OFF; + last = in + (strm->avail_in - 5); + out = strm->next_out - OFF; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); +#ifdef INFLATE_STRICT + dmax = state->dmax; +#endif + wsize = state->wsize; + whave = state->whave; + wnext = state->wnext; + window = state->window; + hold = state->hold; + bits = state->bits; + lcode = state->lencode; + dcode = state->distcode; + lmask = (1U << state->lenbits) - 1; + dmask = (1U << state->distbits) - 1; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + do { + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = lcode[hold & lmask]; + dolen: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op == 0) { /* literal */ + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + PUP(out) = (unsigned char)(here.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + here = dcode[hold & dmask]; + dodist: + op = (unsigned)(here.bits); + hold >>= op; + bits -= op; + op = (unsigned)(here.op); + if (op & 16) { /* distance base */ + dist = (unsigned)(here.val); + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + } + dist += (unsigned)hold & ((1U << op) - 1); +#ifdef INFLATE_STRICT + if (dist > dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + hold >>= op; + bits -= op; + Tracevv((stderr, "inflate: distance %u\n", dist)); + op = (unsigned)(out - beg); /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state->sane) { + strm->msg = + (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + if (len <= op - whave) { + do { + PUP(out) = 0; + } while (--len); + continue; + } + len -= op - whave; + do { + PUP(out) = 0; + } while (--op > whave); + if (op == 0) { + from = out - dist; + do { + PUP(out) = PUP(from); + } while (--len); + continue; + } +#endif + } + from = window - OFF; + if (wnext == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = window - OFF; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } while (len > 2); + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + } + else if ((op & 64) == 0) { /* 2nd level distance code */ + here = dcode[here.val + (hold & ((1U << op) - 1))]; + goto dodist; + } + else { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + } + else if ((op & 64) == 0) { /* 2nd level length code */ + here = lcode[here.val + (hold & ((1U << op) - 1))]; + goto dolen; + } + else if (op & 32) { /* end-of-block */ + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + else { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + } while (in < last && out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + in -= len; + bits -= len << 3; + hold &= (1U << bits) - 1; + + /* update state and return */ + strm->next_in = in + OFF; + strm->next_out = out + OFF; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); + state->hold = hold; + state->bits = bits; + return; +} + +/* + inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): + - Using bit fields for code structure + - Different op definition to avoid & for extra bits (do & for table bits) + - Three separate decoding do-loops for direct, window, and wnext == 0 + - Special case for distance > 1 copies to do overlapped load and store copy + - Explicit branch predictions (based on measured branch probabilities) + - Deferring match copy and interspersed it with decoding subsequent codes + - Swapping literal/length else + - Swapping window/direct else + - Larger unrolled copy loops (three is about right) + - Moving len -= 3 statement into middle of loop + */ + +#endif /* !ASMINF */ diff --git a/externals/zlib/inffast.h b/externals/zlib/inffast.h new file mode 100644 index 0000000..e5c1aa4 --- /dev/null +++ b/externals/zlib/inffast.h @@ -0,0 +1,11 @@ +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/externals/zlib/inffixed.h b/externals/zlib/inffixed.h new file mode 100644 index 0000000..75ed4b5 --- /dev/null +++ b/externals/zlib/inffixed.h @@ -0,0 +1,94 @@ + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. It + is part of the implementation of the compression library and + is subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/externals/zlib/inflate.c b/externals/zlib/inflate.c new file mode 100644 index 0000000..a8431ab --- /dev/null +++ b/externals/zlib/inflate.c @@ -0,0 +1,1480 @@ +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common wnext == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + strm->adler = 1; /* to support ill-conceived Java test suite */ + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->dmax = 32768U; + state->head = Z_NULL; + state->wsize = 0; + state->whave = 0; + state->wnext = 0; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + state->sane = 1; + state->back = -1; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflateReset2(strm, windowBits) +z_streamp strm; +int windowBits; +{ + int wrap; + struct inflate_state FAR *state; + + /* get the state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) + windowBits &= 15; +#endif + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) + return Z_STREAM_ERROR; + if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { + ZFREE(strm, state->window); + state->window = Z_NULL; + } + + /* update state and reset the rest of it */ + state->wrap = wrap; + state->wbits = (unsigned)windowBits; + return inflateReset(strm); +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ + int ret; + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL) return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *) + ZALLOC(strm, 1, sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state FAR *)state; + state->window = Z_NULL; + ret = inflateReset2(strm, windowBits); + if (ret != Z_OK) { + ZFREE(strm, state); + strm->state = Z_NULL; + } + return ret; +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +int ZEXPORT inflatePrime(strm, bits, value) +z_streamp strm; +int bits; +int value; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (bits < 0) { + state->hold = 0; + state->bits = 0; + return Z_OK; + } + if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + value &= (1L << bits) - 1; + state->hold += value << state->bits; + state->bits += bits; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +#ifdef MAKEFIXED +#include + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, + state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->wnext = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->wnext = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->wnext; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->wnext = copy; + state->whave = state->wsize; + } + else { + state->wnext += dist; + if (state->wnext == state->wsize) state->wnext = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Restore state from registers in inflate() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflate(). */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Reverse the bytes in a 32-bit value */ +#define REVERSE(q) \ + ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned in, out; /* save starting available input and output */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code here; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (state->head != Z_NULL) + state->head->done = -1; + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + len = BITS(4) + 8; + if (state->wbits == 0) + state->wbits = len; + else if (len > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + state->dmax = 1U << len; + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->head != Z_NULL) + state->head->text = (int)((hold >> 8) & 1); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->head != Z_NULL) + state->head->time = hold; + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->head != Z_NULL) { + state->head->xflags = (int)(hold & 0xff); + state->head->os = (int)(hold >> 8); + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->head != Z_NULL) + state->head->extra_len = (unsigned)hold; + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->head != Z_NULL && + state->head->extra != Z_NULL) { + len = state->head->extra_len - state->length; + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); + } + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->length = 0; + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->name != Z_NULL && + state->length < state->head->name_max) + state->head->name[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + if (state->head != Z_NULL && + state->head->comment != Z_NULL && + state->length < state->head->comm_max) + state->head->comment[state->length++] = len; + } while (len && copy < have); + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + if (state->head != Z_NULL) { + state->head->hcrc = (int)((state->flags >> 9) & 1); + state->head->done = 1; + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = REVERSE(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN_; /* decode codes */ + if (flush == Z_TREES) { + DROPBITS(2); + goto inf_leave; + } + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + case STORED: + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + state->mode = COPY_; + if (flush == Z_TREES) goto inf_leave; + case COPY_: + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + while (state->have < state->nlen + state->ndist) { + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.val < 16) { + NEEDBITS(here.bits); + DROPBITS(here.bits); + state->lens[state->have++] = here.val; + } + else { + if (here.val == 16) { + NEEDBITS(here.bits + 2); + DROPBITS(here.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = state->lens[state->have - 1]; + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (here.val == 17) { + NEEDBITS(here.bits + 3); + DROPBITS(here.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(here.bits + 7); + DROPBITS(here.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* handle error breaks in while */ + if (state->mode == BAD) break; + + /* check for end-of-block code (better have one) */ + if (state->lens[256] == 0) { + strm->msg = (char *)"invalid code -- missing end-of-block"; + state->mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN_; + if (flush == Z_TREES) goto inf_leave; + case LEN_: + state->mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + if (state->mode == TYPE) + state->back = -1; + break; + } + state->back = 0; + for (;;) { + here = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if (here.op && (here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + state->length = (unsigned)here.val; + if ((int)(here.op) == 0) { + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", here.val)); + state->mode = LIT; + break; + } + if (here.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->back = -1; + state->mode = TYPE; + break; + } + if (here.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(here.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->was = state->length; + state->mode = DIST; + case DIST: + for (;;) { + here = state->distcode[BITS(state->distbits)]; + if ((unsigned)(here.bits) <= bits) break; + PULLBYTE(); + } + if ((here.op & 0xf0) == 0) { + last = here; + for (;;) { + here = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + here.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + state->back += last.bits; + } + DROPBITS(here.bits); + state->back += here.bits; + if (here.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)here.val; + state->extra = (unsigned)(here.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + state->back += state->extra; + } +#ifdef INFLATE_STRICT + if (state->offset > state->dmax) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#endif + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->whave) { + if (state->sane) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + Trace((stderr, "inflate.c too far\n")); + copy -= state->whave; + if (copy > state->length) copy = state->length; + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = 0; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; +#endif + } + if (copy > state->wnext) { + copy -= state->wnext; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->wnext - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + REVERSE(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0) + + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long id; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->wrap != 0 && state->mode != DICT) + return Z_STREAM_ERROR; + + /* check for correct dictionary id */ + if (state->mode == DICT) { + id = adler32(0L, Z_NULL, 0); + id = adler32(id, dictionary, dictLength); + if (id != state->check) + return Z_DATA_ERROR; + } + + /* copy dictionary to window */ + if (updatewindow(strm, strm->avail_out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + if (dictLength > state->wsize) { + zmemcpy(state->window, dictionary + dictLength - state->wsize, + state->wsize); + state->whave = state->wsize; + } + else { + zmemcpy(state->window + state->wsize - dictLength, dictionary, + dictLength); + state->whave = dictLength; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +int ZEXPORT inflateGetHeader(strm, head) +z_streamp strm; +gz_headerp head; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; + + /* save header structure */ + state->head = head; + head->done = 0; + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + unsigned long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + unsigned wsize; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + zmemcpy(dest, source, sizeof(z_stream)); + zmemcpy(copy, state, sizeof(struct inflate_state)); + if (state->lencode >= state->codes && + state->lencode <= state->codes + ENOUGH - 1) { + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + } + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) { + wsize = 1U << state->wbits; + zmemcpy(window, state->window, wsize); + } + copy->window = window; + dest->state = (struct internal_state FAR *)copy; + return Z_OK; +} + +int ZEXPORT inflateUndermine(strm, subvert) +z_streamp strm; +int subvert; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + state->sane = !subvert; +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + return Z_OK; +#else + state->sane = 1; + return Z_DATA_ERROR; +#endif +} + +long ZEXPORT inflateMark(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + state = (struct inflate_state FAR *)strm->state; + return ((long)(state->back) << 16) + + (state->mode == COPY ? state->length : + (state->mode == MATCH ? state->was - state->length : 0)); +} diff --git a/externals/zlib/inflate.h b/externals/zlib/inflate.h new file mode 100644 index 0000000..95f4986 --- /dev/null +++ b/externals/zlib/inflate.h @@ -0,0 +1,122 @@ +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2009 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY_, /* i/o: same as COPY below, but only first time in */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN_, /* i: same as LEN below, but only first time in */ + LEN, /* i: waiting for length/lit/eob code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ + LENGTH, /* i: waiting for 32-bit length (gzip) */ + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to BAD or MEM on error -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) or (raw) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> + HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + (raw) -> TYPEDO + Read deflate blocks: + TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK + STORED -> COPY_ -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN_ + LEN_ -> LEN + Read deflate codes in fixed or dynamic block: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 10K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + gz_headerp head; /* where to save gzip header information */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned wnext; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ + int sane; /* if false, allow invalid distance too far */ + int back; /* bits back of last unprocessed length/lit */ + unsigned was; /* initial length of match */ +}; diff --git a/externals/zlib/inftrees.c b/externals/zlib/inftrees.c new file mode 100644 index 0000000..11e9c52 --- /dev/null +++ b/externals/zlib/inftrees.c @@ -0,0 +1,330 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.5 Copyright 1995-2010 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code here; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) { /* no symbols to code at all */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)1; + here.val = (unsigned short)0; + *(*table)++ = here; /* make a table to force an error */ + *(*table)++ = here; + *bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || max != 1)) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + here.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + here.op = (unsigned char)0; + here.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + here.op = (unsigned char)(extra[work[sym]]); + here.val = base[work[sym]]; + } + else { + here.op = (unsigned char)(32 + 64); /* end of block */ + here.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + next[(huff >> drop) + fill] = here; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if ((type == LENS && used >= ENOUGH_LENS) || + (type == DISTS && used >= ENOUGH_DISTS)) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* + Fill in rest of table for incomplete codes. This loop is similar to the + loop above in incrementing huff for table indices. It is assumed that + len is equal to curr + drop, so there is no loop needed to increment + through high index bits. When the current sub-table is filled, the loop + drops back to the root table to fill in any remaining entries there. + */ + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)(len - drop); + here.val = (unsigned short)0; + while (huff != 0) { + /* when done with sub-table, drop back to root table */ + if (drop != 0 && (huff & mask) != low) { + drop = 0; + len = root; + next = *table; + here.bits = (unsigned char)len; + } + + /* put invalid code marker in table */ + next[huff >> drop] = here; + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/externals/zlib/inftrees.h b/externals/zlib/inftrees.h new file mode 100644 index 0000000..baa53a0 --- /dev/null +++ b/externals/zlib/inftrees.h @@ -0,0 +1,62 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2005, 2010 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of the dynamic table. The maximum number of code structures is + 1444, which is the sum of 852 for literal/length codes and 592 for distance + codes. These values were found by exhaustive searches using the program + examples/enough.c found in the zlib distribtution. The arguments to that + program are the number of symbols, the initial root table size, and the + maximum bit length of a code. "enough 286 9 15" for literal/length codes + returns returns 852, and "enough 30 6 15" for distance codes returns 592. + The initial root table size (9 or 6) is found in the fifth argument of the + inflate_table() calls in inflate.c and infback.c. If the root table size is + changed, then these maximum sizes would be need to be recalculated and + updated. */ +#define ENOUGH_LENS 852 +#define ENOUGH_DISTS 592 +#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) + +/* Type of code to build for inflate_table() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/externals/zlib/minigzip.c b/externals/zlib/minigzip.c new file mode 100644 index 0000000..9825ccc --- /dev/null +++ b/externals/zlib/minigzip.c @@ -0,0 +1,440 @@ +/* minigzip.c -- simulate gzip using the zlib compression library + * Copyright (C) 1995-2006, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * minigzip is a minimal implementation of the gzip utility. This is + * only an example of using zlib and isn't meant to replace the + * full-featured gzip. No attempt is made to deal with file systems + * limiting names to 14 or 8+3 characters, etc... Error checking is + * very limited. So use minigzip only for testing; use gzip for the + * real thing. On MSDOS, use only on file names without extension + * or in pipe mode. + */ + +/* @(#) $Id$ */ + +#include "zlib.h" +#include + +#ifdef STDC +# include +# include +#endif + +#ifdef USE_MMAP +# include +# include +# include +#endif + +#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) +# include +# include +# ifdef UNDER_CE +# include +# endif +# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) +#else +# define SET_BINARY_MODE(file) +#endif + +#ifdef VMS +# define unlink delete +# define GZ_SUFFIX "-gz" +#endif +#ifdef RISCOS +# define unlink remove +# define GZ_SUFFIX "-gz" +# define fileno(file) file->__file +#endif +#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fileno */ +#endif + +#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) +#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ + extern int unlink OF((const char *)); +#endif +#endif + +#if defined(UNDER_CE) +# include +# define perror(s) pwinerror(s) + +/* Map the Windows error number in ERROR to a locale-dependent error + message string and return a pointer to it. Typically, the values + for ERROR come from GetLastError. + + The string pointed to shall not be modified by the application, + but may be overwritten by a subsequent call to strwinerror + + The strwinerror function does not change the current setting + of GetLastError. */ + +static char *strwinerror (error) + DWORD error; +{ + static char buf[1024]; + + wchar_t *msgbuf; + DWORD lasterr = GetLastError(); + DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, + error, + 0, /* Default language */ + (LPVOID)&msgbuf, + 0, + NULL); + if (chars != 0) { + /* If there is an \r\n appended, zap it. */ + if (chars >= 2 + && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { + chars -= 2; + msgbuf[chars] = 0; + } + + if (chars > sizeof (buf) - 1) { + chars = sizeof (buf) - 1; + msgbuf[chars] = 0; + } + + wcstombs(buf, msgbuf, chars + 1); + LocalFree(msgbuf); + } + else { + sprintf(buf, "unknown win32 error (%ld)", error); + } + + SetLastError(lasterr); + return buf; +} + +static void pwinerror (s) + const char *s; +{ + if (s && *s) + fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ())); + else + fprintf(stderr, "%s\n", strwinerror(GetLastError ())); +} + +#endif /* UNDER_CE */ + +#ifndef GZ_SUFFIX +# define GZ_SUFFIX ".gz" +#endif +#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) + +#define BUFLEN 16384 +#define MAX_NAME_LEN 1024 + +#ifdef MAXSEG_64K +# define local static + /* Needed for systems with limitation on stack size. */ +#else +# define local +#endif + +char *prog; + +void error OF((const char *msg)); +void gz_compress OF((FILE *in, gzFile out)); +#ifdef USE_MMAP +int gz_compress_mmap OF((FILE *in, gzFile out)); +#endif +void gz_uncompress OF((gzFile in, FILE *out)); +void file_compress OF((char *file, char *mode)); +void file_uncompress OF((char *file)); +int main OF((int argc, char *argv[])); + +/* =========================================================================== + * Display error message and exit + */ +void error(msg) + const char *msg; +{ + fprintf(stderr, "%s: %s\n", prog, msg); + exit(1); +} + +/* =========================================================================== + * Compress input to output then close both files. + */ + +void gz_compress(in, out) + FILE *in; + gzFile out; +{ + local char buf[BUFLEN]; + int len; + int err; + +#ifdef USE_MMAP + /* Try first compressing with mmap. If mmap fails (minigzip used in a + * pipe), use the normal fread loop. + */ + if (gz_compress_mmap(in, out) == Z_OK) return; +#endif + for (;;) { + len = (int)fread(buf, 1, sizeof(buf), in); + if (ferror(in)) { + perror("fread"); + exit(1); + } + if (len == 0) break; + + if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); + } + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); +} + +#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ + +/* Try compressing the input file at once using mmap. Return Z_OK if + * if success, Z_ERRNO otherwise. + */ +int gz_compress_mmap(in, out) + FILE *in; + gzFile out; +{ + int len; + int err; + int ifd = fileno(in); + caddr_t buf; /* mmap'ed buffer for the entire input file */ + off_t buf_len; /* length of the input file */ + struct stat sb; + + /* Determine the size of the file, needed for mmap: */ + if (fstat(ifd, &sb) < 0) return Z_ERRNO; + buf_len = sb.st_size; + if (buf_len <= 0) return Z_ERRNO; + + /* Now do the actual mmap: */ + buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); + if (buf == (caddr_t)(-1)) return Z_ERRNO; + + /* Compress the whole file at once: */ + len = gzwrite(out, (char *)buf, (unsigned)buf_len); + + if (len != (int)buf_len) error(gzerror(out, &err)); + + munmap(buf, buf_len); + fclose(in); + if (gzclose(out) != Z_OK) error("failed gzclose"); + return Z_OK; +} +#endif /* USE_MMAP */ + +/* =========================================================================== + * Uncompress input to output then close both files. + */ +void gz_uncompress(in, out) + gzFile in; + FILE *out; +{ + local char buf[BUFLEN]; + int len; + int err; + + for (;;) { + len = gzread(in, buf, sizeof(buf)); + if (len < 0) error (gzerror(in, &err)); + if (len == 0) break; + + if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { + error("failed fwrite"); + } + } + if (fclose(out)) error("failed fclose"); + + if (gzclose(in) != Z_OK) error("failed gzclose"); +} + + +/* =========================================================================== + * Compress the given file: create a corresponding .gz file and remove the + * original. + */ +void file_compress(file, mode) + char *file; + char *mode; +{ + local char outfile[MAX_NAME_LEN]; + FILE *in; + gzFile out; + + if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { + fprintf(stderr, "%s: filename too long\n", prog); + exit(1); + } + + strcpy(outfile, file); + strcat(outfile, GZ_SUFFIX); + + in = fopen(file, "rb"); + if (in == NULL) { + perror(file); + exit(1); + } + out = gzopen(outfile, mode); + if (out == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); + exit(1); + } + gz_compress(in, out); + + unlink(file); +} + + +/* =========================================================================== + * Uncompress the given file and remove the original. + */ +void file_uncompress(file) + char *file; +{ + local char buf[MAX_NAME_LEN]; + char *infile, *outfile; + FILE *out; + gzFile in; + size_t len = strlen(file); + + if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { + fprintf(stderr, "%s: filename too long\n", prog); + exit(1); + } + + strcpy(buf, file); + + if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { + infile = file; + outfile = buf; + outfile[len-3] = '\0'; + } else { + outfile = file; + infile = buf; + strcat(infile, GZ_SUFFIX); + } + in = gzopen(infile, "rb"); + if (in == NULL) { + fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); + exit(1); + } + out = fopen(outfile, "wb"); + if (out == NULL) { + perror(file); + exit(1); + } + + gz_uncompress(in, out); + + unlink(infile); +} + + +/* =========================================================================== + * Usage: minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...] + * -c : write to standard output + * -d : decompress + * -f : compress with Z_FILTERED + * -h : compress with Z_HUFFMAN_ONLY + * -r : compress with Z_RLE + * -1 to -9 : compression level + */ + +int main(argc, argv) + int argc; + char *argv[]; +{ + int copyout = 0; + int uncompr = 0; + gzFile file; + char *bname, outmode[20]; + + strcpy(outmode, "wb6 "); + + prog = argv[0]; + bname = strrchr(argv[0], '/'); + if (bname) + bname++; + else + bname = argv[0]; + argc--, argv++; + + if (!strcmp(bname, "gunzip")) + uncompr = 1; + else if (!strcmp(bname, "zcat")) + copyout = uncompr = 1; + + while (argc > 0) { + if (strcmp(*argv, "-c") == 0) + copyout = 1; + else if (strcmp(*argv, "-d") == 0) + uncompr = 1; + else if (strcmp(*argv, "-f") == 0) + outmode[3] = 'f'; + else if (strcmp(*argv, "-h") == 0) + outmode[3] = 'h'; + else if (strcmp(*argv, "-r") == 0) + outmode[3] = 'R'; + else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && + (*argv)[2] == 0) + outmode[2] = (*argv)[1]; + else + break; + argc--, argv++; + } + if (outmode[3] == ' ') + outmode[3] = 0; + if (argc == 0) { + SET_BINARY_MODE(stdin); + SET_BINARY_MODE(stdout); + if (uncompr) { + file = gzdopen(fileno(stdin), "rb"); + if (file == NULL) error("can't gzdopen stdin"); + gz_uncompress(file, stdout); + } else { + file = gzdopen(fileno(stdout), outmode); + if (file == NULL) error("can't gzdopen stdout"); + gz_compress(stdin, file); + } + } else { + if (copyout) { + SET_BINARY_MODE(stdout); + } + do { + if (uncompr) { + if (copyout) { + file = gzopen(*argv, "rb"); + if (file == NULL) + fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); + else + gz_uncompress(file, stdout); + } else { + file_uncompress(*argv); + } + } else { + if (copyout) { + FILE * in = fopen(*argv, "rb"); + + if (in == NULL) { + perror(*argv); + } else { + file = gzdopen(fileno(stdout), outmode); + if (file == NULL) error("can't gzdopen stdout"); + + gz_compress(in, file); + } + + } else { + file_compress(*argv, outmode); + } + } + } while (argv++, --argc); + } + return 0; +} diff --git a/externals/zlib/trees.c b/externals/zlib/trees.c new file mode 100644 index 0000000..56e9bb1 --- /dev/null +++ b/externals/zlib/trees.c @@ -0,0 +1,1244 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2010 Jean-loup Gailly + * detect_data_type() function provided freely by Cosmin Truta, 2006 + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id$ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +#define Buf_size (8 * 2*sizeof(char)) +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local int detect_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (ush)value << s->bi_valid; + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= (ush)value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (ush)val << s->bi_valid;\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (ush)(value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ +#ifdef NO_INIT_GLOBAL_POINTERS + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; +#endif + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, + "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void ZLIB_INTERNAL _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->last_eob_len = 8; /* enough lookahead for inflate */ +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if ((unsigned) tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + * The current inflate code requires 9 bits of lookahead. If the + * last two codes for the previous block (real code plus EOB) were coded + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode + * the last real code. In this case we send two empty static blocks instead + * of one. (There are no problems if the previous block is stored or fixed.) + * To simplify the code, we assume the worst case of last real code encoded + * on one bit only. + */ +void ZLIB_INTERNAL _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); + /* Of the 10 bits for the empty block, we have already sent + * (10 - bi_valid) bits. The lookahead for the last real code (before + * the EOB of the previous block) was thus at least one plus the length + * of the EOB plus what we have just sent of the empty static block. + */ + if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; +#endif + bi_flush(s); + } + s->last_eob_len = 7; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int last; /* one if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is binary or text */ + if (s->strm->data_type == Z_UNKNOWN) + s->strm->data_type = detect_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+last, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+last, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int ZLIB_INTERNAL _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); + s->last_eob_len = ltree[END_BLOCK].Len; +} + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +local int detect_data_type(s) + deflate_state *s; +{ + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + unsigned long black_mask = 0xf3ffc07fUL; + int n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>= 1) + if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + return Z_BINARY; + + /* Check for textual ("white-listed") bytes. */ + if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 + || s->dyn_ltree[13].Freq != 0) + return Z_TEXT; + for (n = 32; n < LITERALS; n++) + if (s->dyn_ltree[n].Freq != 0) + return Z_TEXT; + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + s->last_eob_len = 8; /* enough lookahead for inflate */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/externals/zlib/trees.h b/externals/zlib/trees.h new file mode 100644 index 0000000..d35639d --- /dev/null +++ b/externals/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/externals/zlib/uncompr.c b/externals/zlib/uncompr.c new file mode 100644 index 0000000..ad98be3 --- /dev/null +++ b/externals/zlib/uncompr.c @@ -0,0 +1,59 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/externals/zlib/win/VC90/zlib.vcproj b/externals/zlib/win/VC90/zlib.vcproj new file mode 100644 index 0000000..8ffe816 --- /dev/null +++ b/externals/zlib/win/VC90/zlib.vcproj @@ -0,0 +1,406 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/externals/zlib/win/zlib.sln b/externals/zlib/win/zlib.sln new file mode 100644 index 0000000..d1246b0 --- /dev/null +++ b/externals/zlib/win/zlib.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "VC90\zlib.vcproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.ActiveCfg = Debug|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.Build.0 = Debug|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|x64.ActiveCfg = Debug|x64 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|x64.Build.0 = Debug|x64 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.ActiveCfg = Release|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.Build.0 = Release|Win32 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|x64.ActiveCfg = Release|x64 + {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/externals/zlib/zconf.h b/externals/zlib/zconf.h new file mode 100644 index 0000000..02ce56c --- /dev/null +++ b/externals/zlib/zconf.h @@ -0,0 +1,428 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# define uncompress z_uncompress +# define zError z_zError +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# define gzFile z_gzFile +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef STDC +# include /* for off_t */ +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +# define z_off64_t off64_t +#else +# define z_off64_t z_off_t +#endif + +#if defined(__OS400__) +# define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/externals/zlib/zlib.h b/externals/zlib/zlib.h new file mode 100644 index 0000000..bfbba83 --- /dev/null +++ b/externals/zlib/zlib.h @@ -0,0 +1,1613 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.5, April 19th, 2010 + + Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.5" +#define ZLIB_VERNUM 0x1250 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 5 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all the uncompressed data. (The size + of the uncompressed data may have been saved by the compressor for this + purpose.) The next operation on this stream must be inflateEnd to deallocate + the decompression state. The use of Z_FINISH is never required, but can be + used to inform inflate that a faster approach may be used for the single + inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK or Z_TREES is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any call + of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. The + stream will keep the same compression level and any other attributes that + may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression level is changed, the input available so far is + compressed with the old level (and may be flushed); the new level will take + effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to be + compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if + strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called + immediately after inflateInit2() or inflateReset() and before any call of + inflate() to set the dictionary. The application must insure that the + dictionary that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been + found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the + success case, the application may save the current current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above or -1 << 16 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the normal + behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef voidp gzFile; /* opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) Also "a" + can be used instead of "w" to request that the gzip stream that will be + written be appended to the file. "+" will result in an error, since reading + and writing to the same gzip file is not supported. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Two buffers are allocated, either both of the specified size when + writing, or one of the specified size and the other twice that size when + reading. A larger buffer size of, for example, 64K or 128K bytes will + noticeably increase the speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file was not in gzip format, gzread copies the given number of + bytes into the buffer. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream, or failing that, reading the rest + of the input file directly without decompression. The entire input file + will be read if gzread is called until it returns less than the requested + len. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or 0 in case of error. The number of + uncompressed bytes written is limited to 8191, or one less than the buffer + size given to gzbuffer(). The caller should assure that this limit is not + exceeded. If it is exceeded, then gzprintf() will return an error (0) with + nothing written. In this case, there may also be a buffer overflow with + unpredictable consequences, which is possible only if zlib was compiled with + the insecure functions sprintf() or vsprintf() because the secure snprintf() + or vsnprintf() functions were not available. This can be determined using + zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatented gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. This state can change from + false to true while reading the input file if the end of a gzip stream is + reached, but is followed by data that is not another gzip stream. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the for the crc. Pre- and post-conditioning (one's + complement) is performed within this function so it shouldn't be done by the + application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# ifdef _LARGEFILE64_SOURCE + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +/* hack for buggy compilers */ +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; +#endif + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/externals/zlib/zutil.c b/externals/zlib/zutil.c new file mode 100644 index 0000000..898ed34 --- /dev/null +++ b/externals/zlib/zutil.c @@ -0,0 +1,318 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#include "zutil.h" + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +const char * const z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch ((int)(sizeof(uInt))) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch ((int)(sizeof(uLong))) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch ((int)(sizeof(voidpf))) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch ((int)(sizeof(z_off_t))) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1L << 16; +#endif +#ifdef NO_GZIP + flags += 1L << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1L << 20; +#endif +#ifdef FASTEST + flags += 1L << 21; +#endif +#ifdef STDC +# ifdef NO_vsnprintf + flags += 1L << 25; +# ifdef HAS_vsprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1L << 26; +# endif +# endif +#else + flags += 1L << 24; +# ifdef NO_snprintf + flags += 1L << 25; +# ifdef HAS_sprintf_void + flags += 1L << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1L << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int ZLIB_INTERNAL z_verbose = verbose; + +void ZLIB_INTERNAL z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* The Microsoft C Run-Time Library for Windows CE doesn't have + * errno. We define it as a global variable to simplify porting. + * Its value is always 0 and should not be used. + */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void ZLIB_INTERNAL zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int ZLIB_INTERNAL zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void ZLIB_INTERNAL zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void ZLIB_INTERNAL zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ diff --git a/externals/zlib/zutil.h b/externals/zlib/zutil.h new file mode 100644 index 0000000..258fa88 --- /dev/null +++ b/externals/zlib/zutil.h @@ -0,0 +1,274 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2010 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include "zlib.h" + +#ifdef STDC +# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) +# include +# endif +# include +# include +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# ifdef M_I86 +# include +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + +#if defined(__BORLANDC__) + #pragma warn -8004 + #pragma warn -8008 + #pragma warn -8066 +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# define vsnprintf _vsnprintf +# endif +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif +#ifdef VMS +# define NO_vsnprintf +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); +void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* ZUTIL_H */ diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt new file mode 100644 index 0000000..a56ba35 --- /dev/null +++ b/sql/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(updates) +add_subdirectory(scripts) +add_subdirectory(base) +add_subdirectory(create) + +########### install files ############### + +FILE(GLOB _SQL *.sql) + +install(FILES ${_SQL} DESTINATION share/trinity/sql) diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql new file mode 100644 index 0000000..459b3fa --- /dev/null +++ b/sql/base/auth_database.sql @@ -0,0 +1,254 @@ +-- MySQL dump 10.11 +-- +-- Host: localhost Database: realmd +-- ------------------------------------------------------ +-- Server version 5.0.45-Debian_1ubuntu3.1-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `account_access` +-- + +DROP TABLE IF EXISTS `account_access`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `account_access` ( + `id` int(11) unsigned NOT NULL, + `gmlevel` tinyint(3) unsigned NOT NULL, + `RealmID` int(11) NOT NULL default '-1', + PRIMARY KEY (`id`,`RealmID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `account_access` +-- + +LOCK TABLES `account_access` WRITE; +/*!40000 ALTER TABLE `account_access` DISABLE KEYS */; +/*!40000 ALTER TABLE `account_access` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `account` +-- + +DROP TABLE IF EXISTS `account`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `account` ( + `id` int(11) unsigned NOT NULL auto_increment COMMENT 'Identifier', + `username` varchar(32) NOT NULL default '', + `sha_pass_hash` varchar(40) NOT NULL default '', + `sessionkey` longtext, + `v` longtext, + `s` longtext, + `email` text, + `joindate` timestamp NOT NULL default CURRENT_TIMESTAMP, + `last_ip` varchar(30) NOT NULL default '127.0.0.1', + `failed_logins` int(11) unsigned NOT NULL default '0', + `locked` tinyint(3) unsigned NOT NULL default '0', + `last_login` timestamp NOT NULL default '0000-00-00 00:00:00', + `online` tinyint(4) NOT NULL default '0', + `expansion` tinyint(3) unsigned NOT NULL default '2', + `mutetime` bigint(40) unsigned NOT NULL default '0', + `locale` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_username` (`username`) +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci ROW_FORMAT=DYNAMIC COMMENT='Account System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `account` +-- + +LOCK TABLES `account` WRITE; +/*!40000 ALTER TABLE `account` DISABLE KEYS */; +/*!40000 ALTER TABLE `account` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `account_banned` +-- + +DROP TABLE IF EXISTS `account_banned`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `account_banned` ( + `id` int(11) NOT NULL default '0' COMMENT 'Account id', + `bandate` bigint(40) NOT NULL default '0', + `unbandate` bigint(40) NOT NULL default '0', + `bannedby` varchar(50) NOT NULL, + `banreason` varchar(255) NOT NULL, + `active` tinyint(4) NOT NULL default '1', + PRIMARY KEY (`id`,`bandate`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Ban List'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `account_banned` +-- + +LOCK TABLES `account_banned` WRITE; +/*!40000 ALTER TABLE `account_banned` DISABLE KEYS */; +/*!40000 ALTER TABLE `account_banned` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ip_banned` +-- + +DROP TABLE IF EXISTS `ip_banned`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ip_banned` ( + `ip` varchar(32) NOT NULL default '127.0.0.1', + `bandate` bigint(40) NOT NULL, + `unbandate` bigint(40) NOT NULL, + `bannedby` varchar(50) NOT NULL default '[Console]', + `banreason` varchar(255) NOT NULL default 'no reason', + PRIMARY KEY (`ip`,`bandate`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Banned IPs'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `ip_banned` +-- + +LOCK TABLES `ip_banned` WRITE; +/*!40000 ALTER TABLE `ip_banned` DISABLE KEYS */; +/*!40000 ALTER TABLE `ip_banned` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `logs` +-- + +DROP TABLE IF EXISTS `logs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `logs` ( + `time` int(14) NOT NULL, + `realm` int(4) NOT NULL, + `type` int(4) NOT NULL, + `string` text +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `logs` +-- + +LOCK TABLES `logs` WRITE; +/*!40000 ALTER TABLE `logs` DISABLE KEYS */; +/*!40000 ALTER TABLE `logs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `realmcharacters` +-- + +DROP TABLE IF EXISTS `realmcharacters`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `realmcharacters` ( + `realmid` int(11) unsigned NOT NULL default '0', + `acctid` bigint(20) unsigned NOT NULL, + `numchars` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`realmid`,`acctid`), + KEY (acctid) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm Character Tracker'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `realmcharacters` +-- + +LOCK TABLES `realmcharacters` WRITE; +/*!40000 ALTER TABLE `realmcharacters` DISABLE KEYS */; +/*!40000 ALTER TABLE `realmcharacters` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `realmlist` +-- + +DROP TABLE IF EXISTS `realmlist`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `realmlist` ( + `id` int(11) unsigned NOT NULL auto_increment, + `name` varchar(32) NOT NULL default '', + `address` varchar(32) NOT NULL default '127.0.0.1', + `port` int(11) NOT NULL default '8085', + `icon` tinyint(3) unsigned NOT NULL default '0', + `color` tinyint(3) unsigned NOT NULL default '2', + `timezone` tinyint(3) unsigned NOT NULL default '0', + `allowedSecurityLevel` tinyint(3) unsigned NOT NULL default '0', + `population` float unsigned NOT NULL default '0', + `gamebuild` int(11) unsigned NOT NULL default '12340', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_name` (`name`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Realm System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `realmlist` +-- + +LOCK TABLES `realmlist` WRITE; +/*!40000 ALTER TABLE `realmlist` DISABLE KEYS */; +INSERT INTO `realmlist` (`id`,`name`,`address`,`port`,`icon`,`color`,`timezone`,`allowedSecurityLevel`,`population`,`gamebuild`) VALUES +(1,'Trinity','127.0.0.1',8085,1,0,1,0,0,12340); +/*!40000 ALTER TABLE `realmlist` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `uptime` +-- + +DROP TABLE IF EXISTS `uptime`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `uptime` ( + `realmid` int(11) unsigned NOT NULL, + `starttime` bigint(20) unsigned NOT NULL default '0', + `startstring` varchar(64) NOT NULL default '', + `uptime` bigint(20) unsigned NOT NULL default '0', + `maxplayers` smallint(5) unsigned NOT NULL default '0', + `revision` VARCHAR(255) NOT NULL DEFAULT 'Trinitycore', + PRIMARY KEY (`realmid`,`starttime`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `uptime` +-- + +LOCK TABLES `uptime` WRITE; +/*!40000 ALTER TABLE `uptime` DISABLE KEYS */; +/*!40000 ALTER TABLE `uptime` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2008-01-10 11:37:06 + +-- Updated on 2010-01-29 23:21:45 GMT+1 diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql new file mode 100644 index 0000000..6ec8cd9 --- /dev/null +++ b/sql/base/characters_database.sql @@ -0,0 +1,1991 @@ +-- MySQL dump 10.11 +-- +-- Host: localhost Database: characters +-- ------------------------------------------------------ +-- Server version 5.0.45-Debian_1ubuntu3.1-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `account_data` +-- + +DROP TABLE IF EXISTS `account_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `account_data` ( + `account` int(11) unsigned NOT NULL default '0', + `type` int(11) unsigned NOT NULL default '0', + `time` bigint(11) unsigned NOT NULL default '0', + `data` longblob NOT NULL, + PRIMARY KEY (`account`,`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `account_data` +-- + +LOCK TABLES `account_data` WRITE; +/*!40000 ALTER TABLE `account_data` DISABLE KEYS */; +/*!40000 ALTER TABLE `account_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `addons` +-- + +DROP TABLE IF EXISTS `addons`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `addons` ( + `name` varchar(120) NOT NULL default '', + `crc` int(32) unsigned NOT NULL default '0', + PRIMARY KEY (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Addons'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `addons` +-- + +LOCK TABLES `addons` WRITE; +/*!40000 ALTER TABLE `addons` DISABLE KEYS */; +/*!40000 ALTER TABLE `addons` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `arena_team` +-- + +DROP TABLE IF EXISTS `arena_team`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `arena_team` ( + `arenateamid` int(10) unsigned NOT NULL default '0', + `name` char(255) NOT NULL, + `captainguid` int(10) unsigned NOT NULL default '0', + `type` tinyint(3) unsigned NOT NULL default '0', + `BackgroundColor` int(10) unsigned NOT NULL default '0', + `EmblemStyle` int(10) unsigned NOT NULL default '0', + `EmblemColor` int(10) unsigned NOT NULL default '0', + `BorderStyle` int(10) unsigned NOT NULL default '0', + `BorderColor` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`arenateamid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `arena_team` +-- + +LOCK TABLES `arena_team` WRITE; +/*!40000 ALTER TABLE `arena_team` DISABLE KEYS */; +/*!40000 ALTER TABLE `arena_team` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `arena_team_member` +-- + +DROP TABLE IF EXISTS `arena_team_member`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `arena_team_member` ( + `arenateamid` int(10) unsigned NOT NULL default '0', + `guid` int(10) unsigned NOT NULL default '0', + `played_week` int(10) unsigned NOT NULL default '0', + `wons_week` int(10) unsigned NOT NULL default '0', + `played_season` int(10) unsigned NOT NULL default '0', + `wons_season` int(10) unsigned NOT NULL default '0', + `personal_rating` int(10) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`arenateamid`,`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `arena_team_member` +-- + +LOCK TABLES `arena_team_member` WRITE; +/*!40000 ALTER TABLE `arena_team_member` DISABLE KEYS */; +/*!40000 ALTER TABLE `arena_team_member` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `arena_team_stats` +-- + +DROP TABLE IF EXISTS `arena_team_stats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `arena_team_stats` ( + `arenateamid` int(10) unsigned NOT NULL default '0', + `rating` int(10) unsigned NOT NULL default '0', + `games` int(10) unsigned NOT NULL default '0', + `wins` int(10) unsigned NOT NULL default '0', + `played` int(10) unsigned NOT NULL default '0', + `wins2` int(10) unsigned NOT NULL default '0', + `rank` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`arenateamid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `arena_team_stats` +-- + +LOCK TABLES `arena_team_stats` WRITE; +/*!40000 ALTER TABLE `arena_team_stats` DISABLE KEYS */; +/*!40000 ALTER TABLE `arena_team_stats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `auctionhouse` +-- + +DROP TABLE IF EXISTS `auctionhouse`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `auctionhouse` ( + `id` int(11) unsigned NOT NULL default '0', + `auctioneerguid` int(11) unsigned NOT NULL default '0', + `itemguid` int(11) unsigned NOT NULL default '0', + `item_template` int(11) unsigned NOT NULL default '0' COMMENT 'Item Identifier', + `itemowner` int(11) unsigned NOT NULL default '0', + `buyoutprice` int(11) NOT NULL default '0', + `time` bigint(40) NOT NULL default '0', + `buyguid` int(11) unsigned NOT NULL default '0', + `lastbid` int(11) NOT NULL default '0', + `startbid` int(11) NOT NULL default '0', + `deposit` int(11) NOT NULL default '0', + PRIMARY KEY (`id`), + UNIQUE KEY `item_guid` (`itemguid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `auctionhouse` +-- + +LOCK TABLES `auctionhouse` WRITE; +/*!40000 ALTER TABLE `auctionhouse` DISABLE KEYS */; +/*!40000 ALTER TABLE `auctionhouse` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `auctionhousebot` +-- + +DROP TABLE IF EXISTS `auctionhousebot`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `auctionhousebot` ( + `auctionhouse` int(11) NOT NULL default '0' COMMENT 'mapID of the auctionhouse.', + `name` char(25) default NULL COMMENT 'Text name of the auctionhouse.', + `minitems` int(11) default '0' COMMENT 'This is the minimum number of items you want to keep in the auction house. a 0 here will make it the same as the maximum.', + `maxitems` int(11) default '0' COMMENT 'This is the number of items you want to keep in the auction house.', + `percentgreytradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Grey Trade Goods auction items', + `percentwhitetradegoods` int(11) default '27' COMMENT 'Sets the percentage of the White Trade Goods auction items', + `percentgreentradegoods` int(11) default '12' COMMENT 'Sets the percentage of the Green Trade Goods auction items', + `percentbluetradegoods` int(11) default '10' COMMENT 'Sets the percentage of the Blue Trade Goods auction items', + `percentpurpletradegoods` int(11) default '1' COMMENT 'Sets the percentage of the Purple Trade Goods auction items', + `percentorangetradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Orange Trade Goods auction items', + `percentyellowtradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Yellow Trade Goods auction items', + `percentgreyitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Grey auction items', + `percentwhiteitems` int(11) default '10' COMMENT 'Sets the percentage of the non trade White auction items', + `percentgreenitems` int(11) default '30' COMMENT 'Sets the percentage of the non trade Green auction items', + `percentblueitems` int(11) default '8' COMMENT 'Sets the percentage of the non trade Blue auction items', + `percentpurpleitems` int(11) default '2' COMMENT 'Sets the percentage of the non trade Purple auction items', + `percentorangeitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Orange auction items', + `percentyellowitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Yellow auction items', + `minpricegrey` int(11) default '100' COMMENT 'Minimum price of Grey items (percentage).', + `maxpricegrey` int(11) default '150' COMMENT 'Maximum price of Grey items (percentage).', + `minpricewhite` int(11) default '150' COMMENT 'Minimum price of White items (percentage).', + `maxpricewhite` int(11) default '250' COMMENT 'Maximum price of White items (percentage).', + `minpricegreen` int(11) default '800' COMMENT 'Minimum price of Green items (percentage).', + `maxpricegreen` int(11) default '1400' COMMENT 'Maximum price of Green items (percentage).', + `minpriceblue` int(11) default '1250' COMMENT 'Minimum price of Blue items (percentage).', + `maxpriceblue` int(11) default '1750' COMMENT 'Maximum price of Blue items (percentage).', + `minpricepurple` int(11) default '2250' COMMENT 'Minimum price of Purple items (percentage).', + `maxpricepurple` int(11) default '4550' COMMENT 'Maximum price of Purple items (percentage).', + `minpriceorange` int(11) default '3250' COMMENT 'Minimum price of Orange items (percentage).', + `maxpriceorange` int(11) default '5550' COMMENT 'Maximum price of Orange items (percentage).', + `minpriceyellow` int(11) default '5250' COMMENT 'Minimum price of Yellow items (percentage).', + `maxpriceyellow` int(11) default '6550' COMMENT 'Maximum price of Yellow items (percentage).', + `minbidpricegrey` int(11) default '70' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 70', + `maxbidpricegrey` int(11) default '100' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 100', + `minbidpricewhite` int(11) default '70' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 70', + `maxbidpricewhite` int(11) default '100' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 100', + `minbidpricegreen` int(11) default '80' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 80', + `maxbidpricegreen` int(11) default '100' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 100', + `minbidpriceblue` int(11) default '75' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 75', + `maxbidpriceblue` int(11) default '100' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 100', + `minbidpricepurple` int(11) default '80' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 80', + `maxbidpricepurple` int(11) default '100' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 100', + `minbidpriceorange` int(11) default '80' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 80', + `maxbidpriceorange` int(11) default '100' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 100', + `minbidpriceyellow` int(11) default '80' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 80', + `maxbidpriceyellow` int(11) default '100' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 100', + `maxstackgrey` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackwhite` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackgreen` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackblue` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackpurple` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackorange` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackyellow` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `buyerpricegrey` int(11) default '1' COMMENT 'Multiplier to vendorprice when buying grey items from auctionhouse', + `buyerpricewhite` int(11) default '3' COMMENT 'Multiplier to vendorprice when buying white items from auctionhouse', + `buyerpricegreen` int(11) default '5' COMMENT 'Multiplier to vendorprice when buying green items from auctionhouse', + `buyerpriceblue` int(11) default '12' COMMENT 'Multiplier to vendorprice when buying blue items from auctionhouse', + `buyerpricepurple` int(11) default '15' COMMENT 'Multiplier to vendorprice when buying purple items from auctionhouse', + `buyerpriceorange` int(11) default '20' COMMENT 'Multiplier to vendorprice when buying orange items from auctionhouse', + `buyerpriceyellow` int(11) default '22' COMMENT 'Multiplier to vendorprice when buying yellow items from auctionhouse', + `buyerbiddinginterval` int(11) default '1' COMMENT 'Interval how frequently AHB bids on each AH. Time in minutes', + `buyerbidsperinterval` int(11) default '1' COMMENT 'number of bids to put in per bidding interval', + PRIMARY KEY (`auctionhouse`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `auctionhousebot` +-- + +INSERT INTO `auctionhousebot`(`auctionhouse`,`name`,`minitems`,`maxitems`,`percentgreytradegoods`,`percentwhitetradegoods`,`percentgreentradegoods`,`percentbluetradegoods`,`percentpurpletradegoods`,`percentorangetradegoods`,`percentyellowtradegoods`,`percentgreyitems`,`percentwhiteitems`,`percentgreenitems`,`percentblueitems`,`percentpurpleitems`,`percentorangeitems`,`percentyellowitems`,`minpricegrey`,`maxpricegrey`,`minpricewhite`,`maxpricewhite`,`minpricegreen`,`maxpricegreen`,`minpriceblue`,`maxpriceblue`,`minpricepurple`,`maxpricepurple`,`minpriceorange`,`maxpriceorange`,`minpriceyellow`,`maxpriceyellow`,`minbidpricegrey`,`maxbidpricegrey`,`minbidpricewhite`,`maxbidpricewhite`,`minbidpricegreen`,`maxbidpricegreen`,`minbidpriceblue`,`maxbidpriceblue`,`minbidpricepurple`,`maxbidpricepurple`,`minbidpriceorange`,`maxbidpriceorange`,`minbidpriceyellow`,`maxbidpriceyellow`,`maxstackgrey`,`maxstackwhite`,`maxstackgreen`,`maxstackblue`,`maxstackpurple`,`maxstackorange`,`maxstackyellow`,`buyerpricegrey`,`buyerpricewhite`,`buyerpricegreen`,`buyerpriceblue`,`buyerpricepurple`,`buyerpriceorange`,`buyerpriceyellow`,`buyerbiddinginterval`,`buyerbidsperinterval`) VALUES +(2,'Alliance',0,0,0,27,12,10,1,0,0,0,10,30,8,2,0,0,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1), +(6,'Horde',0,0,0,27,12,10,1,0,0,0,10,30,8,2,0,0,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1), +(7,'Neutral',0,0,0,27,12,10,1,0,0,0,10,30,8,2,0,0,100,150,150,250,800,1400,1250,1750,2250,4550,3250,5550,5250,6550,70,100,70,100,80,100,75,100,80,100,80,100,80,100,0,0,3,2,1,1,1,1,3,5,12,15,20,22,1,1); + +-- +-- Table structure for table `bugreport` +-- + +DROP TABLE IF EXISTS `bugreport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bugreport` ( + `id` int(11) NOT NULL auto_increment COMMENT 'Identifier', + `type` longtext NOT NULL default '', + `content` longtext NOT NULL default '', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Debug System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `bugreport` +-- + +LOCK TABLES `bugreport` WRITE; +/*!40000 ALTER TABLE `bugreport` DISABLE KEYS */; +/*!40000 ALTER TABLE `bugreport` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `channels` +-- + +DROP TABLE IF EXISTS `channels`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `channels` ( + `m_name` text NOT NULL, + `m_team` int(10) unsigned NOT NULL, + `m_announce` tinyint(1) unsigned NOT NULL default '0', + `m_moderate` tinyint(1) unsigned NOT NULL default '0', + `m_public` tinyint(1) unsigned NOT NULL default '1', + `m_password` text, + `BannedList` longtext, + PRIMARY KEY (`m_name`(10),`m_team`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Channel System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `channels` +-- + +LOCK TABLES `channels` WRITE; +/*!40000 ALTER TABLE `channels` DISABLE KEYS */; +/*!40000 ALTER TABLE `channels` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `characters` +-- + +DROP TABLE IF EXISTS `characters`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `characters` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `account` int(11) unsigned NOT NULL default '0' COMMENT 'Account Identifier', + `name` varchar(12) NOT NULL default '', + `race` tinyint(3) unsigned NOT NULL default '0', + `class` tinyint(3) unsigned NOT NULL default '0', + `gender` TINYINT UNSIGNED NOT NULL default '0', + `level` TINYINT UNSIGNED NOT NULL default '0', + `xp` INT UNSIGNED NOT NULL default '0', + `money` INT UNSIGNED NOT NULL default '0', + `playerBytes` INT UNSIGNED NOT NULL default '0', + `playerBytes2` INT UNSIGNED NOT NULL default '0', + `playerFlags` INT UNSIGNED NOT NULL default '0', + `position_x` float NOT NULL default '0', + `position_y` float NOT NULL default '0', + `position_z` float NOT NULL default '0', + `map` int(11) unsigned NOT NULL default '0' COMMENT 'Map Identifier', + `instance_id` int(11) unsigned NOT NULL default '0', + `dungeon_difficulty` tinyint(1) unsigned NOT NULL default '0', + `orientation` float NOT NULL default '0', + `taximask` longtext, + `online` tinyint(3) unsigned NOT NULL default '0', + `cinematic` tinyint(3) unsigned NOT NULL default '0', + `totaltime` int(11) unsigned NOT NULL default '0', + `leveltime` int(11) unsigned NOT NULL default '0', + `logout_time` bigint(20) unsigned NOT NULL default '0', + `is_logout_resting` tinyint(3) unsigned NOT NULL default '0', + `rest_bonus` float NOT NULL default '0', + `resettalents_cost` int(11) unsigned NOT NULL default '0', + `resettalents_time` bigint(20) unsigned NOT NULL default '0', + `trans_x` float NOT NULL default '0', + `trans_y` float NOT NULL default '0', + `trans_z` float NOT NULL default '0', + `trans_o` float NOT NULL default '0', + `transguid` bigint(20) unsigned NOT NULL default '0', + `extra_flags` int(11) unsigned NOT NULL default '0', + `stable_slots` tinyint(1) unsigned NOT NULL default '0', + `at_login` int(11) unsigned NOT NULL default '0', + `zone` int(11) unsigned NOT NULL default '0', + `death_expire_time` bigint(20) unsigned NOT NULL default '0', + `taxi_path` text, + `arenaPoints` int(10) unsigned NOT NULL default'0', + `totalHonorPoints` int(10) unsigned NOT NULL default'0', + `todayHonorPoints` int(10) unsigned NOT NULL default'0', + `yesterdayHonorPoints` int(10) unsigned NOT NULL default'0', + `totalKills` int(10) unsigned NOT NULL default'0', + `todayKills` smallint(5) unsigned NOT NULL default'0', + `yesterdayKills` smallint(5) unsigned NOT NULL default'0', + `chosenTitle` int(10) unsigned NOT NULL default'0', + `knownCurrencies` bigint(20) unsigned NOT NULL default'0', + `watchedFaction` bigint(10) unsigned NOT NULL default'0', + `drunk` smallint(5) unsigned NOT NULL default'0', + `health` int(10) unsigned NOT NULL default'0', + `power1` int(10) unsigned NOT NULL default'0', + `power2` int(10) unsigned NOT NULL default'0', + `power3` int(10) unsigned NOT NULL default'0', + `power4` int(10) unsigned NOT NULL default'0', + `power5` int(10) unsigned NOT NULL default'0', + `power6` int(10) unsigned NOT NULL default'0', + `power7` int(10) unsigned NOT NULL default'0', + `latency` int(11) unsigned NOT NULL default '0', + `speccount` tinyint(3) unsigned NOT NULL default 1, + `activespec` tinyint(3) unsigned NOT NULL default 0, + `exploredZones` longtext, + `equipmentCache` longtext, + `ammoId` int(10) UNSIGNED NOT NULL default '0', + `knownTitles` longtext, + `actionBars` tinyint(3) UNSIGNED NOT NULL default '0', + PRIMARY KEY (`guid`), + KEY `idx_account` (`account`), + KEY `idx_online` (`online`), + KEY `idx_name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `characters` +-- + +LOCK TABLES `characters` WRITE; +/*!40000 ALTER TABLE `characters` DISABLE KEYS */; +/*!40000 ALTER TABLE `characters` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_account_data` +-- + +DROP TABLE IF EXISTS `character_account_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_account_data` ( + `guid` int(11) unsigned NOT NULL default '0', + `type` int(11) unsigned NOT NULL default '0', + `time` bigint(11) unsigned NOT NULL default '0', + `data` longblob NOT NULL, + PRIMARY KEY (`guid`,`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_account_data` +-- + +LOCK TABLES `character_account_data` WRITE; +/*!40000 ALTER TABLE `character_account_data` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_account_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_achievement` +-- + +DROP TABLE IF EXISTS `character_achievement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_achievement` ( + `guid` int(11) unsigned NOT NULL, + `achievement` int(11) unsigned NOT NULL, + `date` bigint(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`achievement`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_achievement` +-- + +LOCK TABLES `character_achievement` WRITE; +/*!40000 ALTER TABLE `character_achievement` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_achievement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_achievement_progress` +-- + +DROP TABLE IF EXISTS `character_achievement_progress`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_achievement_progress` ( + `guid` int(11) unsigned NOT NULL, + `criteria` int(11) unsigned NOT NULL, + `counter` int(11) unsigned NOT NULL, + `date` bigint(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`criteria`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_achievement_progress` +-- + +LOCK TABLES `character_achievement_progress` WRITE; +/*!40000 ALTER TABLE `character_achievement_progress` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_achievement_progress` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_action` +-- + +DROP TABLE IF EXISTS `character_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_action` ( + `guid` int(11) unsigned NOT NULL default '0', + `spec` tinyint(3) unsigned NOT NULL default '0', + `button` tinyint(3) unsigned NOT NULL default '0', + `action` int(11) unsigned NOT NULL default '0', + `type` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`spec`,`button`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_action` +-- + +LOCK TABLES `character_action` WRITE; +/*!40000 ALTER TABLE `character_action` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_aura` +-- + +DROP TABLE IF EXISTS `character_aura`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_aura` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `caster_guid` bigint(20) unsigned NOT NULL default '0' COMMENT 'Full Global Unique Identifier', + `spell` int(11) unsigned NOT NULL default '0', + `effect_mask` tinyint(3) unsigned NOT NULL default '0', + `recalculate_mask` tinyint(3) unsigned NOT NULL default '0', + `stackcount` tinyint(3) unsigned NOT NULL default '1', + `amount0` int(11) NOT NULL default '0', + `amount1` int(11) NOT NULL default '0', + `amount2` int(11) NOT NULL default '0', + `base_amount0` int(11) NOT NULL default '0', + `base_amount1` int(11) NOT NULL default '0', + `base_amount2` int(11) NOT NULL default '0', + `maxduration` int(11) NOT NULL default '0', + `remaintime` int(11) NOT NULL default '0', + `remaincharges` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`caster_guid`,`spell`,`effect_mask`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_aura` +-- + +LOCK TABLES `character_aura` WRITE; +/*!40000 ALTER TABLE `character_aura` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_aura` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_battleground_data` +-- + +DROP TABLE IF EXISTS `character_battleground_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_battleground_data` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `instance_id` int(11) unsigned NOT NULL default '0', + `team` int(11) unsigned NOT NULL default '0', + `join_x` float NOT NULL default '0', + `join_y` float NOT NULL default '0', + `join_z` float NOT NULL default '0', + `join_o` float NOT NULL default '0', + `join_map` int(11) NOT NULL default '0', + `taxi_start` int(11) NOT NULL default '0', + `taxi_end` int(11) NOT NULL default '0', + `mount_spell` int(11) NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_battleground_data` +-- + +LOCK TABLES `character_battleground_data` WRITE; +/*!40000 ALTER TABLE `character_battleground_data` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_battleground_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_battleground_random` +-- + +DROP TABLE IF EXISTS `character_battleground_random`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_battleground_random` ( + `guid` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_battleground_random` +-- + +LOCK TABLES `character_battleground_random` WRITE; +/*!40000 ALTER TABLE `character_battleground_random` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_battleground_random` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_declinedname` +-- + +DROP TABLE IF EXISTS `character_declinedname`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_declinedname` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `genitive` varchar(15) NOT NULL default '', + `dative` varchar(15) NOT NULL default '', + `accusative` varchar(15) NOT NULL default '', + `instrumental` varchar(15) NOT NULL default '', + `prepositional` varchar(15) NOT NULL default '', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_declinedname` +-- + +LOCK TABLES `character_declinedname` WRITE; +/*!40000 ALTER TABLE `character_declinedname` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_declinedname` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_equipmentsets` +-- + +DROP TABLE IF EXISTS `character_equipmentsets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_equipmentsets` ( + `guid` int(11) NOT NULL default '0', + `setguid` bigint(20) NOT NULL auto_increment, + `setindex` tinyint(4) NOT NULL default '0', + `name` varchar(100) NOT NULL, + `iconname` varchar(100) NOT NULL, + `item0` int(11) NOT NULL default '0', + `item1` int(11) NOT NULL default '0', + `item2` int(11) NOT NULL default '0', + `item3` int(11) NOT NULL default '0', + `item4` int(11) NOT NULL default '0', + `item5` int(11) NOT NULL default '0', + `item6` int(11) NOT NULL default '0', + `item7` int(11) NOT NULL default '0', + `item8` int(11) NOT NULL default '0', + `item9` int(11) NOT NULL default '0', + `item10` int(11) NOT NULL default '0', + `item11` int(11) NOT NULL default '0', + `item12` int(11) NOT NULL default '0', + `item13` int(11) NOT NULL default '0', + `item14` int(11) NOT NULL default '0', + `item15` int(11) NOT NULL default '0', + `item16` int(11) NOT NULL default '0', + `item17` int(11) NOT NULL default '0', + `item18` int(11) NOT NULL default '0', + PRIMARY KEY (`setguid`), + UNIQUE KEY `idx_set` (`guid`,`setguid`,`setindex`), + INDEX `Idx_setindex` (`setindex`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_equipmentsets` +-- + +LOCK TABLES `character_equipmentsets` WRITE; +/*!40000 ALTER TABLE `character_equipmentsets` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_equipmentsets` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_gifts` +-- + +DROP TABLE IF EXISTS `character_gifts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_gifts` ( + `guid` int(20) unsigned NOT NULL default '0', + `item_guid` int(11) unsigned NOT NULL default '0', + `entry` int(20) unsigned NOT NULL default '0', + `flags` int(20) unsigned NOT NULL default '0', + PRIMARY KEY (`item_guid`), + KEY `idx_guid` (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_gifts` +-- + +LOCK TABLES `character_gifts` WRITE; +/*!40000 ALTER TABLE `character_gifts` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_gifts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_glyphs` +-- + +DROP TABLE IF EXISTS `character_glyphs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_glyphs` ( + `guid` int(11) unsigned NOT NULL, + `spec` tinyint(3) unsigned NOT NULL DEFAULT '0', + `glyph1` int(11) unsigned NOT NULL DEFAULT '0', + `glyph2` int(11) unsigned DEFAULT '0', + `glyph3` int(11) unsigned DEFAULT '0', + `glyph4` int(11) unsigned DEFAULT '0', + `glyph5` int(11) unsigned DEFAULT '0', + `glyph6` int(11) unsigned DEFAULT '0', + PRIMARY KEY (`guid`,`spec`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_glyphs` +-- + +LOCK TABLES `character_glyphs` WRITE; +/*!40000 ALTER TABLE `character_glyphs` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_glyphs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_homebind` +-- + +DROP TABLE IF EXISTS `character_homebind`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_homebind` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `map` int(11) unsigned NOT NULL default '0' COMMENT 'Map Identifier', + `zone` int(11) unsigned NOT NULL default '0' COMMENT 'Zone Identifier', + `position_x` float NOT NULL default '0', + `position_y` float NOT NULL default '0', + `position_z` float NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_homebind` +-- + +LOCK TABLES `character_homebind` WRITE; +/*!40000 ALTER TABLE `character_homebind` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_homebind` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_instance` +-- + +DROP TABLE IF EXISTS `character_instance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_instance` ( + `guid` int(11) unsigned NOT NULL default '0', + `instance` int(11) unsigned NOT NULL default '0', + `permanent` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`instance`), + KEY `instance` (`instance`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_instance` +-- + +LOCK TABLES `character_instance` WRITE; +/*!40000 ALTER TABLE `character_instance` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_instance` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_inventory` +-- + +DROP TABLE IF EXISTS `character_inventory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_inventory` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `bag` int(11) unsigned NOT NULL default '0', + `slot` tinyint(3) unsigned NOT NULL default '0', + `item` int(11) unsigned NOT NULL default '0' COMMENT 'Item Global Unique Identifier', + `item_template` int(11) unsigned NOT NULL default '0' COMMENT 'Item Identifier', + PRIMARY KEY (`item`), + KEY `idx_guid` (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_inventory` +-- + +LOCK TABLES `character_inventory` WRITE; +/*!40000 ALTER TABLE `character_inventory` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_inventory` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_pet` +-- + +DROP TABLE IF EXISTS `character_pet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_pet` ( + `id` int(11) unsigned NOT NULL default '0', + `entry` int(11) unsigned NOT NULL default '0', + `owner` int(11) unsigned NOT NULL default '0', + `modelid` int(11) unsigned default '0', + `CreatedBySpell` int(11) unsigned NOT NULL default '0', + `PetType` tinyint(3) unsigned NOT NULL default '0', + `level` int(11) unsigned NOT NULL default '1', + `exp` int(11) unsigned NOT NULL default '0', + `Reactstate` tinyint(1) unsigned NOT NULL default '0', + `name` varchar(100) default 'Pet', + `renamed` tinyint(1) unsigned NOT NULL default '0', + `slot` int(11) unsigned NOT NULL default '0', + `curhealth` int(11) unsigned NOT NULL default '1', + `curmana` int(11) unsigned NOT NULL default '0', + `curhappiness` int(11) unsigned NOT NULL default '0', + `savetime` bigint(20) unsigned NOT NULL default '0', + `resettalents_cost` int(11) unsigned NOT NULL default '0', + `resettalents_time` bigint(20) unsigned NOT NULL default '0', + `abdata` longtext, + PRIMARY KEY (`id`), + KEY `owner` (`owner`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Pet System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_pet` +-- + +LOCK TABLES `character_pet` WRITE; +/*!40000 ALTER TABLE `character_pet` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_pet` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_pet_declinedname` +-- + +DROP TABLE IF EXISTS `character_pet_declinedname`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_pet_declinedname` ( + `id` int(11) unsigned NOT NULL default '0', + `owner` int(11) unsigned NOT NULL default '0', + `genitive` varchar(12) NOT NULL default '', + `dative` varchar(12) NOT NULL default '', + `accusative` varchar(12) NOT NULL default '', + `instrumental` varchar(12) NOT NULL default '', + `prepositional` varchar(12) NOT NULL default '', + PRIMARY KEY (`id`), + KEY owner_key (`owner`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_pet_declinedname` +-- + +LOCK TABLES `character_pet_declinedname` WRITE; +/*!40000 ALTER TABLE `character_pet_declinedname` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_pet_declinedname` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_queststatus` +-- + +DROP TABLE IF EXISTS `character_queststatus`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_queststatus` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier', + `status` int(11) unsigned NOT NULL default '0', + `rewarded` tinyint(1) unsigned NOT NULL default '0', + `explored` tinyint(1) unsigned NOT NULL default '0', + `timer` bigint(20) unsigned NOT NULL default '0', + `mobcount1` int(11) unsigned NOT NULL default '0', + `mobcount2` int(11) unsigned NOT NULL default '0', + `mobcount3` int(11) unsigned NOT NULL default '0', + `mobcount4` int(11) unsigned NOT NULL default '0', + `itemcount1` int(11) unsigned NOT NULL default '0', + `itemcount2` int(11) unsigned NOT NULL default '0', + `itemcount3` int(11) unsigned NOT NULL default '0', + `itemcount4` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`quest`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_queststatus` +-- + +LOCK TABLES `character_queststatus` WRITE; +/*!40000 ALTER TABLE `character_queststatus` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_queststatus` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_queststatus_daily` +-- + +DROP TABLE IF EXISTS `character_queststatus_daily`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_queststatus_daily` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier', + `time` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`quest`), + KEY `idx_guid` (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_queststatus_daily` +-- + +LOCK TABLES `character_queststatus_daily` WRITE; +/*!40000 ALTER TABLE `character_queststatus_daily` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_queststatus_daily` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_queststatus_weekly` +-- + +DROP TABLE IF EXISTS `character_queststatus_weekly`; +CREATE TABLE `character_queststatus_weekly` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier', + PRIMARY KEY (`guid`,`quest`), + KEY `idx_guid` (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; + +-- +-- Dumping data for table `character_queststatus_weekly` +-- + +LOCK TABLES `character_queststatus_weekly` WRITE; +/*!40000 ALTER TABLE `character_queststatus_weekly` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_queststatus_weekly` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_reputation` +-- + +DROP TABLE IF EXISTS `character_reputation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_reputation` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `faction` int(11) unsigned NOT NULL default '0', + `standing` int(11) NOT NULL default '0', + `flags` int(11) NOT NULL default '0', + PRIMARY KEY (`guid`,`faction`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_reputation` +-- + +LOCK TABLES `character_reputation` WRITE; +/*!40000 ALTER TABLE `character_reputation` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_reputation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_skills` +-- + +DROP TABLE IF EXISTS `character_skills`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_skills` ( + `guid` int(11) unsigned NOT NULL COMMENT 'Global Unique Identifier', + `skill` mediumint(9) unsigned NOT NULL, + `value` mediumint(9) unsigned NOT NULL, + `max` mediumint(9) unsigned NOT NULL, + PRIMARY KEY (`guid`,`skill`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_skills` +-- + +LOCK TABLES `character_skills` WRITE; +/*!40000 ALTER TABLE `character_skills` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_skills` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_social` +-- + +DROP TABLE IF EXISTS `character_social`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_social` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Character Global Unique Identifier', + `friend` int(11) unsigned NOT NULL default '0' COMMENT 'Friend Global Unique Identifier', + `flags` tinyint(1) unsigned NOT NULL default '0' COMMENT 'Friend Flags', + `note` varchar(48) NOT NULL DEFAULT '' COMMENT 'Friend Note', + PRIMARY KEY (`guid`,`friend`,`flags`), + KEY `guid` (`guid`), + KEY `friend` (`friend`), + KEY `guid_flags` (`guid`,`flags`), + KEY `friend_flags` (`friend`,`flags`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_social` +-- + +LOCK TABLES `character_social` WRITE; +/*!40000 ALTER TABLE `character_social` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_social` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_spell` +-- + +DROP TABLE IF EXISTS `character_spell`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_spell` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `spell` int(11) unsigned NOT NULL default '0' COMMENT 'Spell Identifier', + `active` tinyint(3) unsigned NOT NULL default '1', + `disabled` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`spell`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_spell` +-- + +LOCK TABLES `character_spell` WRITE; +/*!40000 ALTER TABLE `character_spell` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_spell` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_spell_cooldown` +-- + +DROP TABLE IF EXISTS `character_spell_cooldown`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_spell_cooldown` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier, Low part', + `spell` int(11) unsigned NOT NULL default '0' COMMENT 'Spell Identifier', + `item` int(11) unsigned NOT NULL default '0' COMMENT 'Item Identifier', + `time` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`spell`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_spell_cooldown` +-- + +LOCK TABLES `character_spell_cooldown` WRITE; +/*!40000 ALTER TABLE `character_spell_cooldown` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_spell_cooldown` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_stats` +-- + +DROP TABLE IF EXISTS `character_stats`; +CREATE TABLE `character_stats` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier, Low part', + `maxhealth` int(10) UNSIGNED NOT NULL default '0', + `maxpower1` int(10) UNSIGNED NOT NULL default '0', + `maxpower2` int(10) UNSIGNED NOT NULL default '0', + `maxpower3` int(10) UNSIGNED NOT NULL default '0', + `maxpower4` int(10) UNSIGNED NOT NULL default '0', + `maxpower5` int(10) UNSIGNED NOT NULL default '0', + `maxpower6` int(10) UNSIGNED NOT NULL default '0', + `maxpower7` int(10) UNSIGNED NOT NULL default '0', + `strength` int(10) UNSIGNED NOT NULL default '0', + `agility` int(10) UNSIGNED NOT NULL default '0', + `stamina` int(10) UNSIGNED NOT NULL default '0', + `intellect` int(10) UNSIGNED NOT NULL default '0', + `spirit` int(10) UNSIGNED NOT NULL default '0', + `armor` int(10) UNSIGNED NOT NULL default '0', + `resHoly` int(10) UNSIGNED NOT NULL default '0', + `resFire` int(10) UNSIGNED NOT NULL default '0', + `resNature` int(10) UNSIGNED NOT NULL default '0', + `resFrost` int(10) UNSIGNED NOT NULL default '0', + `resShadow` int(10) UNSIGNED NOT NULL default '0', + `resArcane` int(10) UNSIGNED NOT NULL default '0', + `blockPct` float UNSIGNED NOT NULL default '0', + `dodgePct` float UNSIGNED NOT NULL default '0', + `parryPct` float UNSIGNED NOT NULL default '0', + `critPct` float UNSIGNED NOT NULL default '0', + `rangedCritPct` float UNSIGNED NOT NULL default '0', + `spellCritPct` float UNSIGNED NOT NULL default '0', + `attackPower` int(10) UNSIGNED NOT NULL default '0', + `rangedAttackPower` int(10) UNSIGNED NOT NULL default '0', + `spellPower` int(10) UNSIGNED NOT NULL default '0', + + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `character_stats` +-- + +LOCK TABLES `character_stats` WRITE; +/*!40000 ALTER TABLE `character_stats` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_stats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_talent` +-- + +DROP TABLE IF EXISTS `character_talent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_talent` ( + `guid` int(11) unsigned NOT NULL, + `spell` int(11) unsigned NOT NULL, + `spec` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`,`spell`,`spec`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_talent` +-- + +LOCK TABLES `character_talent` WRITE; +/*!40000 ALTER TABLE `character_talent` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_talent` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `character_tutorial` +-- + +DROP TABLE IF EXISTS `character_tutorial`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `character_tutorial` ( + `account` bigint(20) unsigned NOT NULL auto_increment COMMENT 'Account Identifier', + `realmid` int(11) unsigned NOT NULL default '0' COMMENT 'Realm Identifier', + `tut0` int(11) unsigned NOT NULL default '0', + `tut1` int(11) unsigned NOT NULL default '0', + `tut2` int(11) unsigned NOT NULL default '0', + `tut3` int(11) unsigned NOT NULL default '0', + `tut4` int(11) unsigned NOT NULL default '0', + `tut5` int(11) unsigned NOT NULL default '0', + `tut6` int(11) unsigned NOT NULL default '0', + `tut7` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`account`,`realmid`), + KEY acc_key (`account`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `character_tutorial` +-- + +LOCK TABLES `character_tutorial` WRITE; +/*!40000 ALTER TABLE `character_tutorial` DISABLE KEYS */; +/*!40000 ALTER TABLE `character_tutorial` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `corpse` +-- + +DROP TABLE IF EXISTS `corpse`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `corpse` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `player` int(11) unsigned NOT NULL default '0' COMMENT 'Character Global Unique Identifier', + `position_x` float NOT NULL default '0', + `position_y` float NOT NULL default '0', + `position_z` float NOT NULL default '0', + `orientation` float NOT NULL default '0', + `zone` int(11) unsigned NOT NULL default '38' COMMENT 'Zone Identifier', + `map` int(11) unsigned NOT NULL default '0' COMMENT 'Map Identifier', + `phaseMask` smallint(5) unsigned NOT NULL default '1', + `data` longtext, + `time` bigint(20) unsigned NOT NULL default '0', + `corpse_type` tinyint(3) unsigned NOT NULL default '0', + `instance` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`), + KEY `idx_type` (`corpse_type`), + KEY `instance` (`instance`), + INDEX `Idx_player`(`player`), + INDEX `Idx_time`(`time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Death System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `corpse` +-- + +LOCK TABLES `corpse` WRITE; +/*!40000 ALTER TABLE `corpse` DISABLE KEYS */; +/*!40000 ALTER TABLE `corpse` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_condition_save` +-- + +DROP TABLE IF EXISTS `game_event_condition_save`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_condition_save` ( + `event_id` mediumint(8) unsigned NOT NULL, + `condition_id` mediumint(8) unsigned NOT NULL default '0', + `done` float default '0', + PRIMARY KEY (`event_id`,`condition_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_condition_save` +-- + +LOCK TABLES `game_event_condition_save` WRITE; +/*!40000 ALTER TABLE `game_event_condition_save` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_condition_save` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_save` +-- + +DROP TABLE IF EXISTS `game_event_save`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_save` ( + `event_id` mediumint(8) unsigned NOT NULL, + `state` tinyint(3) unsigned NOT NULL default '1', + `next_start` timestamp NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`event_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_save` +-- + +LOCK TABLES `game_event_save` WRITE; +/*!40000 ALTER TABLE `game_event_save` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_save` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gm_tickets` +-- + +DROP TABLE IF EXISTS `gm_tickets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gm_tickets` ( + `guid` int(10) NOT NULL auto_increment, + `playerGuid` int(11) unsigned NOT NULL default '0', + `name` varchar(15) NOT NULL, + `message` text NOT NULL, + `createtime` int(10) NOT NULL default '0', + `map` int NOT NULL DEFAULT '0', + `posX` float NOT NULL DEFAULT '0', + `posY` float NOT NULL DEFAULT '0', + `posZ` float NOT NULL DEFAULT '0', + `timestamp` int(10) NOT NULL default '0', + `closed` int(10) NOT NULL default '0', + `assignedto` int(10) NOT NULL default '0', + `comment` text NOT NULL, + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gm_tickets` +-- + +LOCK TABLES `gm_tickets` WRITE; +/*!40000 ALTER TABLE `gm_tickets` DISABLE KEYS */; +/*!40000 ALTER TABLE `gm_tickets` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `group_instance` +-- + +DROP TABLE IF EXISTS `group_instance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_instance` ( + `guid` int(11) unsigned NOT NULL default '0', + `instance` int(11) unsigned NOT NULL default '0', + `permanent` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`instance`), + KEY `instance` (`instance`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `group_instance` +-- + +LOCK TABLES `group_instance` WRITE; +/*!40000 ALTER TABLE `group_instance` DISABLE KEYS */; +/*!40000 ALTER TABLE `group_instance` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `group_member` +-- + +DROP TABLE IF EXISTS `group_member`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `group_member` ( + `guid` int(11) unsigned NOT NULL, + `memberGuid` int(11) unsigned NOT NULL, + `memberFlags` tinyint(2) unsigned NOT NULL, + `subgroup` smallint(6) unsigned NOT NULL, + PRIMARY KEY (`memberGuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Groups'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `group_member` +-- + +LOCK TABLES `group_member` WRITE; +/*!40000 ALTER TABLE `group_member` DISABLE KEYS */; +/*!40000 ALTER TABLE `group_member` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `groups` +-- + +DROP TABLE IF EXISTS `groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `groups` ( + `guid` int(11) unsigned NOT NULL, + `leaderGuid` int(11) unsigned NOT NULL, + `lootMethod` tinyint(4) unsigned NOT NULL, + `looterGuid` int(11) unsigned NOT NULL, + `lootThreshold` tinyint(4) unsigned NOT NULL, + `icon1` int(11) unsigned NOT NULL, + `icon2` int(11) unsigned NOT NULL, + `icon3` int(11) unsigned NOT NULL, + `icon4` int(11) unsigned NOT NULL, + `icon5` int(11) unsigned NOT NULL, + `icon6` int(11) unsigned NOT NULL, + `icon7` int(11) unsigned NOT NULL, + `icon8` int(11) unsigned NOT NULL, + `groupType` mediumint(8) unsigned NOT NULL, + `difficulty` tinyint(3) unsigned NOT NULL default '0', + `raiddifficulty` int(11) UNSIGNED NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Groups'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `groups` +-- + +LOCK TABLES `groups` WRITE; +/*!40000 ALTER TABLE `groups` DISABLE KEYS */; +/*!40000 ALTER TABLE `groups` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild` +-- + +DROP TABLE IF EXISTS `guild`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild` ( + `guildid` int(6) unsigned NOT NULL default '0', + `name` varchar(255) NOT NULL default '', + `leaderguid` int(6) unsigned NOT NULL default '0', + `EmblemStyle` int(5) NOT NULL default '0', + `EmblemColor` int(5) NOT NULL default '0', + `BorderStyle` int(5) NOT NULL default '0', + `BorderColor` int(5) NOT NULL default '0', + `BackgroundColor` int(5) NOT NULL default '0', + `info` text NOT NULL, + `motd` varchar(255) NOT NULL default '', + `createdate` bigint(20) NOT NULL default '0', + `BankMoney` bigint(20) NOT NULL default '0', + PRIMARY KEY (`guildid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Guild System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild` +-- + +LOCK TABLES `guild` WRITE; +/*!40000 ALTER TABLE `guild` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild_bank_eventlog` +-- + +DROP TABLE IF EXISTS `guild_bank_eventlog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild_bank_eventlog` ( + `guildid` int(11) unsigned NOT NULL default '0' COMMENT 'Guild Identificator', + `LogGuid` int(11) unsigned NOT NULL default '0' COMMENT 'Log record identificator - auxiliary column', + `TabId` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Guild bank TabId', + `EventType` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Event type', + `PlayerGuid` int(11) unsigned NOT NULL default '0', + `ItemOrMoney` int(11) unsigned NOT NULL default '0', + `ItemStackCount` tinyint(3) unsigned NOT NULL default '0', + `DestTabId` tinyint(1) unsigned NOT NULL default '0' COMMENT 'Destination Tab Id', + `TimeStamp` bigint(20) unsigned NOT NULL default '0' COMMENT 'Event UNIX time', + PRIMARY KEY (`guildid`,`LogGuid`,`TabId`), + KEY `guildid_key` (`guildid`), + INDEX `Idx_PlayerGuid`(`PlayerGuid`), + INDEX `Idx_LogGuid`(`LogGuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild_bank_eventlog` +-- + +LOCK TABLES `guild_bank_eventlog` WRITE; +/*!40000 ALTER TABLE `guild_bank_eventlog` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild_bank_eventlog` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild_bank_item` +-- + +DROP TABLE IF EXISTS `guild_bank_item`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild_bank_item` ( + `guildid` int(11) unsigned NOT NULL default '0', + `TabId` tinyint(1) unsigned NOT NULL default '0', + `SlotId` tinyint(3) unsigned NOT NULL default '0', + `item_guid` int(11) unsigned NOT NULL default '0', + `item_entry` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guildid`,`tabid`,`slotid`), + KEY `guildid_key` (`guildid`), + INDEX `Idx_item_guid`(`item_guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild_bank_item` +-- + +LOCK TABLES `guild_bank_item` WRITE; +/*!40000 ALTER TABLE `guild_bank_item` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild_bank_item` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild_bank_right` +-- + +DROP TABLE IF EXISTS `guild_bank_right`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild_bank_right` ( + `guildid` int(11) unsigned NOT NULL default '0', + `TabId` tinyint(1) unsigned NOT NULL default '0', + `rid` int(11) unsigned NOT NULL default '0', + `gbright` tinyint(3) unsigned NOT NULL default '0', + `SlotPerDay` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guildid`,`TabId`,`rid`), + KEY `guildid_key` (`guildid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild_bank_right` +-- + +LOCK TABLES `guild_bank_right` WRITE; +/*!40000 ALTER TABLE `guild_bank_right` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild_bank_right` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild_bank_tab` +-- + +DROP TABLE IF EXISTS `guild_bank_tab`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild_bank_tab` ( + `guildid` int(11) unsigned NOT NULL default '0', + `TabId` tinyint(1) unsigned NOT NULL default '0', + `TabName` varchar(100) NOT NULL default '', + `TabIcon` varchar(100) NOT NULL default '', + `TabText` text, + PRIMARY KEY (`guildid`,`TabId`), + KEY `guildid_key` (`guildid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild_bank_tab` +-- + +LOCK TABLES `guild_bank_tab` WRITE; +/*!40000 ALTER TABLE `guild_bank_tab` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild_bank_tab` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild_eventlog` +-- + +DROP TABLE IF EXISTS `guild_eventlog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild_eventlog` ( + `guildid` int(11) NOT NULL COMMENT 'Guild Identificator', + `LogGuid` int(11) NOT NULL COMMENT 'Log record identificator - auxiliary column', + `EventType` tinyint(1) NOT NULL COMMENT 'Event type', + `PlayerGuid1` int(11) NOT NULL COMMENT 'Player 1', + `PlayerGuid2` int(11) NOT NULL COMMENT 'Player 2', + `NewRank` tinyint(2) NOT NULL COMMENT 'New rank(in case promotion/demotion)', + `TimeStamp` bigint(20) NOT NULL COMMENT 'Event UNIX time', + PRIMARY KEY (`guildid`, `LogGuid`), + INDEX `Idx_PlayerGuid1`(`PlayerGuid1`), + INDEX `Idx_PlayerGuid2`(`PlayerGuid2`), + INDEX `Idx_LogGuid`(`LogGuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'Guild Eventlog'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild_eventlog` +-- + +LOCK TABLES `guild_eventlog` WRITE; +/*!40000 ALTER TABLE `guild_eventlog` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild_eventlog` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild_member` +-- + +DROP TABLE IF EXISTS `guild_member`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild_member` ( + `guildid` int(6) unsigned NOT NULL default '0', + `guid` int(11) unsigned NOT NULL default '0', + `rank` tinyint(2) unsigned NOT NULL default '0', + `pnote` varchar(255) NOT NULL default '', + `offnote` varchar(255) NOT NULL default '', + `BankResetTimeMoney` int(11) unsigned NOT NULL default '0', + `BankRemMoney` int(11) unsigned NOT NULL default '0', + `BankResetTimeTab0` int(11) unsigned NOT NULL default '0', + `BankRemSlotsTab0` int(11) unsigned NOT NULL default '0', + `BankResetTimeTab1` int(11) unsigned NOT NULL default '0', + `BankRemSlotsTab1` int(11) unsigned NOT NULL default '0', + `BankResetTimeTab2` int(11) unsigned NOT NULL default '0', + `BankRemSlotsTab2` int(11) unsigned NOT NULL default '0', + `BankResetTimeTab3` int(11) unsigned NOT NULL default '0', + `BankRemSlotsTab3` int(11) unsigned NOT NULL default '0', + `BankResetTimeTab4` int(11) unsigned NOT NULL default '0', + `BankRemSlotsTab4` int(11) unsigned NOT NULL default '0', + `BankResetTimeTab5` int(11) unsigned NOT NULL default '0', + `BankRemSlotsTab5` int(11) unsigned NOT NULL default '0', + KEY `guildid_key` (`guildid`), + KEY `guildid_rank_key` (`guildid`,`rank`), + UNIQUE KEY `guid_key` (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Guild System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild_member` +-- + +LOCK TABLES `guild_member` WRITE; +/*!40000 ALTER TABLE `guild_member` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild_member` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `guild_rank` +-- + +DROP TABLE IF EXISTS `guild_rank`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `guild_rank` ( + `guildid` int(6) unsigned NOT NULL default '0', + `rid` int(11) unsigned NOT NULL, + `rname` varchar(255) NOT NULL default '', + `rights` int(3) unsigned NOT NULL default '0', + `BankMoneyPerDay` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guildid`,`rid`), + INDEX `Idx_rid`(`rid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Guild System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `guild_rank` +-- + +LOCK TABLES `guild_rank` WRITE; +/*!40000 ALTER TABLE `guild_rank` DISABLE KEYS */; +/*!40000 ALTER TABLE `guild_rank` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `instance` +-- + +DROP TABLE IF EXISTS `instance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `instance` ( + `id` int(11) unsigned NOT NULL default '0', + `map` int(11) unsigned NOT NULL default '0', + `resettime` bigint(40) NOT NULL default '0', + `difficulty` tinyint(1) unsigned NOT NULL default '0', + `data` longtext, + PRIMARY KEY (`id`), + KEY `map` (`map`), + KEY `resettime` (`resettime`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `instance` +-- + +LOCK TABLES `instance` WRITE; +/*!40000 ALTER TABLE `instance` DISABLE KEYS */; +/*!40000 ALTER TABLE `instance` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `instance_reset` +-- + +DROP TABLE IF EXISTS `instance_reset`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `instance_reset` ( + `mapid` int(11) unsigned NOT NULL default '0', + `difficulty` tinyint(1) unsigned NOT NULL default '0', + `resettime` bigint(40) NOT NULL default '0', + PRIMARY KEY (`mapid`,`difficulty`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `instance_reset` +-- + +LOCK TABLES `instance_reset` WRITE; +/*!40000 ALTER TABLE `instance_reset` DISABLE KEYS */; +/*!40000 ALTER TABLE `instance_reset` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `item_instance` +-- + +DROP TABLE IF EXISTS `item_instance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_instance` ( + `guid` int(11) unsigned NOT NULL default '0', + `owner_guid` int(11) unsigned NOT NULL default '0', + `data` longtext, + `text` longtext, + PRIMARY KEY (`guid`), + KEY `idx_owner_guid` (`owner_guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Item System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `item_instance` +-- + +LOCK TABLES `item_instance` WRITE; +/*!40000 ALTER TABLE `item_instance` DISABLE KEYS */; +/*!40000 ALTER TABLE `item_instance` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `item_refund_instance` +-- + +DROP TABLE IF EXISTS `item_refund_instance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_refund_instance` ( + `item_guid` int(11) unsigned NOT NULL COMMENT 'Item GUID', + `player_guid` int(11) unsigned NOT NULL COMMENT 'Player GUID', + `paidMoney` int(11) unsigned NOT NULL DEFAULT '0', + `paidExtendedCost` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`item_guid`,`player_guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Item Refund System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `item_refund_instance` +-- + +LOCK TABLES `item_refund_instance` WRITE; +/*!40000 ALTER TABLE `item_refund_instance` DISABLE KEYS */; +/*!40000 ALTER TABLE `item_refund_instance` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `mail` +-- + +DROP TABLE IF EXISTS `mail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mail` ( + `id` int(11) unsigned NOT NULL default '0' COMMENT 'Identifier', + `messageType` tinyint(3) unsigned NOT NULL default '0', + `stationery` tinyint(3) NOT NULL default '41', + `mailTemplateId` mediumint(8) unsigned NOT NULL default '0', + `sender` int(11) unsigned NOT NULL default '0' COMMENT 'Character Global Unique Identifier', + `receiver` int(11) unsigned NOT NULL default '0' COMMENT 'Character Global Unique Identifier', + `subject` longtext, + `body` longtext, + `has_items` tinyint(3) unsigned NOT NULL default '0', + `expire_time` bigint(40) NOT NULL default '0', + `deliver_time` bigint(40) NOT NULL default '0', + `money` int(11) unsigned NOT NULL default '0', + `cod` int(11) unsigned NOT NULL default '0', + `checked` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `idx_receiver` (`receiver`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Mail System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `mail` +-- + +LOCK TABLES `mail` WRITE; +/*!40000 ALTER TABLE `mail` DISABLE KEYS */; +/*!40000 ALTER TABLE `mail` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `mail_items` +-- + +DROP TABLE IF EXISTS `mail_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mail_items` ( + `mail_id` int(11) NOT NULL default '0', + `item_guid` int(11) NOT NULL default '0', + `item_template` int(11) NOT NULL default '0', + `receiver` int(11) unsigned NOT NULL default '0' COMMENT 'Character Global Unique Identifier', + PRIMARY KEY (`mail_id`,`item_guid`), + KEY `idx_receiver` (`receiver`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `mail_items` +-- + +LOCK TABLES `mail_items` WRITE; +/*!40000 ALTER TABLE `mail_items` DISABLE KEYS */; +/*!40000 ALTER TABLE `mail_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pet_aura` +-- + +DROP TABLE IF EXISTS `pet_aura`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pet_aura` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `caster_guid` bigint(20) unsigned NOT NULL default '0' COMMENT 'Full Global Unique Identifier', + `spell` int(11) unsigned NOT NULL default '0', + `effect_mask` tinyint(3) unsigned NOT NULL default '0', + `recalculate_mask` tinyint(3) unsigned NOT NULL default '0', + `stackcount` tinyint(3) unsigned NOT NULL default '1', + `amount0` int(11) NOT NULL default '0', + `amount1` int(11) NOT NULL default '0', + `amount2` int(11) NOT NULL default '0', + `base_amount0` int(11) NOT NULL default '0', + `base_amount1` int(11) NOT NULL default '0', + `base_amount2` int(11) NOT NULL default '0', + `maxduration` int(11) NOT NULL default '0', + `remaintime` int(11) NOT NULL default '0', + `remaincharges` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`spell`,`effect_mask`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Pet System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pet_aura` +-- + +LOCK TABLES `pet_aura` WRITE; +/*!40000 ALTER TABLE `pet_aura` DISABLE KEYS */; +/*!40000 ALTER TABLE `pet_aura` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pet_spell` +-- + +DROP TABLE IF EXISTS `pet_spell`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pet_spell` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `spell` int(11) unsigned NOT NULL default '0' COMMENT 'Spell Identifier', + `active` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`spell`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Pet System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pet_spell` +-- + +LOCK TABLES `pet_spell` WRITE; +/*!40000 ALTER TABLE `pet_spell` DISABLE KEYS */; +/*!40000 ALTER TABLE `pet_spell` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pet_spell_cooldown` +-- + +DROP TABLE IF EXISTS `pet_spell_cooldown`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pet_spell_cooldown` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier, Low part', + `spell` int(11) unsigned NOT NULL default '0' COMMENT 'Spell Identifier', + `time` bigint(20) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`spell`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pet_spell_cooldown` +-- + +LOCK TABLES `pet_spell_cooldown` WRITE; +/*!40000 ALTER TABLE `pet_spell_cooldown` DISABLE KEYS */; +/*!40000 ALTER TABLE `pet_spell_cooldown` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `petition` +-- + +DROP TABLE IF EXISTS `petition`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `petition` ( + `ownerguid` int(10) unsigned NOT NULL, + `petitionguid` int(10) unsigned default '0', + `name` varchar(255) NOT NULL default '', + `type` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`ownerguid`,`type`), + UNIQUE KEY `index_ownerguid_petitionguid` (`ownerguid`,`petitionguid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Guild System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `petition` +-- + +LOCK TABLES `petition` WRITE; +/*!40000 ALTER TABLE `petition` DISABLE KEYS */; +/*!40000 ALTER TABLE `petition` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `petition_sign` +-- + +DROP TABLE IF EXISTS `petition_sign`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `petition_sign` ( + `ownerguid` int(10) unsigned NOT NULL, + `petitionguid` int(11) unsigned NOT NULL default '0', + `playerguid` int(11) unsigned NOT NULL default '0', + `player_account` int(11) unsigned NOT NULL default '0', + `type` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`petitionguid`,`playerguid`), + INDEX `Idx_playerguid`(`playerguid`), + INDEX `Idx_ownerguid`(`ownerguid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Guild System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `petition_sign` +-- + +LOCK TABLES `petition_sign` WRITE; +/*!40000 ALTER TABLE `petition_sign` DISABLE KEYS */; +/*!40000 ALTER TABLE `petition_sign` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `worldstates` +-- + +DROP TABLE IF EXISTS `worldstates`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `worldstates` ( + `entry` mediumint(11) UNSIGNED NOT NULL DEFAULT '0', + `value` bigint(40) UNSIGNED NOT NULL DEFAULT '0', + `comment` text, + PRIMARY KEY (`entry`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Variable Saves'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `worldstates` +-- + +LOCK TABLES `worldstates` WRITE; +/*!40000 ALTER TABLE `worldstates` DISABLE KEYS */; +INSERT INTO `worldstates` (`entry`,`value`, `comment`) VALUES +(20001, 0, 'NextArenaPointDistributionTime'), +(20002, 0, 'NextWeeklyQuestResetTime'), +(20003, 0, 'NextBGRandomDailyResetTime'); +/*!40000 ALTER TABLE `worldstates` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2008-01-10 11:37:06 + +-- Updated on 2010-01-29 23:05:45 GMT+1 diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql new file mode 100644 index 0000000..a0c566f --- /dev/null +++ b/sql/base/world_database.sql @@ -0,0 +1,15590 @@ +-- Remove the following line to import this ++++DO NOT IMPORT THIS UNLESS YOU WANT A *BLANK* DATABASE.+++ +-- MySQL dump 10.13 Distrib 5.1.36, for redhat-linux-gnu (x86_64) +-- +-- Host: localhost Database: world +-- ------------------------------------------------------ +-- Server version 5.1.36 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `access_requirement` +-- + +DROP TABLE IF EXISTS `access_requirement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `access_requirement` ( + `id` bigint(20) unsigned NOT NULL COMMENT 'Identifier', + `level_min` tinyint(3) unsigned NOT NULL DEFAULT '0', + `heroic_level_min` tinyint(3) unsigned NOT NULL DEFAULT '0', + `level_max` tinyint(3) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `heroic_key` mediumint(8) unsigned NOT NULL DEFAULT '0', + `heroic_key2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest_done` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest_failed_text` text, + `heroic_quest_done` mediumint(8) unsigned NOT NULL DEFAULT '0', + `heroic_quest_failed_text` text, + `comment` text, + `status` tinyint(3) unsigned DEFAULT '15' COMMENT 'instance status (open/close)', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Access Requirements'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `access_requirement` +-- + +LOCK TABLES `access_requirement` WRITE; +/*!40000 ALTER TABLE `access_requirement` DISABLE KEYS */; +/*!40000 ALTER TABLE `access_requirement` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `achievement_criteria_data` +-- + +DROP TABLE IF EXISTS `achievement_criteria_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `achievement_criteria_data` ( + `criteria_id` mediumint(8) NOT NULL, + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`criteria_id`,`type`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Achievment system'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `achievement_criteria_data` +-- + +LOCK TABLES `achievement_criteria_data` WRITE; +/*!40000 ALTER TABLE `achievement_criteria_data` DISABLE KEYS */; +/*!40000 ALTER TABLE `achievement_criteria_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `achievement_reward` +-- + +DROP TABLE IF EXISTS `achievement_reward`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `achievement_reward` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `title_A` mediumint(8) unsigned NOT NULL DEFAULT '0', + `title_H` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `sender` mediumint(8) unsigned NOT NULL DEFAULT '0', + `subject` varchar(255) DEFAULT NULL, + `text` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `achievement_reward` +-- + +LOCK TABLES `achievement_reward` WRITE; +/*!40000 ALTER TABLE `achievement_reward` DISABLE KEYS */; +/*!40000 ALTER TABLE `achievement_reward` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `areatrigger_involvedrelation` +-- + +DROP TABLE IF EXISTS `areatrigger_involvedrelation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `areatrigger_involvedrelation` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Identifier', + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Quest Identifier', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Trigger System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `areatrigger_involvedrelation` +-- + +LOCK TABLES `areatrigger_involvedrelation` WRITE; +/*!40000 ALTER TABLE `areatrigger_involvedrelation` DISABLE KEYS */; +/*!40000 ALTER TABLE `areatrigger_involvedrelation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `areatrigger_scripts` +-- + +DROP TABLE IF EXISTS `areatrigger_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `areatrigger_scripts` ( + `entry` mediumint(8) NOT NULL, + `ScriptName` char(64) NOT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `areatrigger_scripts` +-- + +LOCK TABLES `areatrigger_scripts` WRITE; +/*!40000 ALTER TABLE `areatrigger_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `areatrigger_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `areatrigger_tavern` +-- + +DROP TABLE IF EXISTS `areatrigger_tavern`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `areatrigger_tavern` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Identifier', + `name` text, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Trigger System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `areatrigger_tavern` +-- + +LOCK TABLES `areatrigger_tavern` WRITE; +/*!40000 ALTER TABLE `areatrigger_tavern` DISABLE KEYS */; +/*!40000 ALTER TABLE `areatrigger_tavern` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `areatrigger_teleport` +-- + +DROP TABLE IF EXISTS `areatrigger_teleport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `areatrigger_teleport` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Identifier', + `name` text, + `access_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `target_map` smallint(5) unsigned NOT NULL DEFAULT '0', + `target_position_x` float NOT NULL DEFAULT '0', + `target_position_y` float NOT NULL DEFAULT '0', + `target_position_z` float NOT NULL DEFAULT '0', + `target_orientation` float NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + FULLTEXT KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Trigger System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `areatrigger_teleport` +-- + +LOCK TABLES `areatrigger_teleport` WRITE; +/*!40000 ALTER TABLE `areatrigger_teleport` DISABLE KEYS */; +/*!40000 ALTER TABLE `areatrigger_teleport` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `autobroadcast` +-- + +DROP TABLE IF EXISTS `autobroadcast`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `autobroadcast` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `text` longtext NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `autobroadcast` +-- + +LOCK TABLES `autobroadcast` WRITE; +/*!40000 ALTER TABLE `autobroadcast` DISABLE KEYS */; +/*!40000 ALTER TABLE `autobroadcast` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `battleground_template` +-- + +DROP TABLE IF EXISTS `battleground_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `battleground_template` ( + `id` mediumint(8) unsigned NOT NULL, + `MinPlayersPerTeam` smallint(5) unsigned NOT NULL DEFAULT '0', + `MaxPlayersPerTeam` smallint(5) unsigned NOT NULL DEFAULT '0', + `MinLvl` tinyint(3) unsigned NOT NULL DEFAULT '0', + `MaxLvl` tinyint(3) unsigned NOT NULL DEFAULT '0', + `AllianceStartLoc` mediumint(8) unsigned NOT NULL, + `AllianceStartO` float NOT NULL, + `HordeStartLoc` mediumint(8) unsigned NOT NULL, + `HordeStartO` float NOT NULL, + `Disable` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `battleground_template` +-- + +LOCK TABLES `battleground_template` WRITE; +/*!40000 ALTER TABLE `battleground_template` DISABLE KEYS */; +INSERT INTO `battleground_template` (`id`,`MinPlayersPerTeam`,`MaxPlayersPerTeam`,`MinLvl`,`MaxLvl`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO`, `Disable`) VALUES +(1,20,40,51,80,611,2.72532,610,2.27452,0), +(2,5,10,10,80,769,3.14159,770,3.14159,0), +(3,8,15,20,80,890,3.40156,889,0.263892,0), +(4,0,2,10,80,929,0,936,3.14159,0), +(5,0,2,10,80,939,0,940,3.14159,0), +(6,0,2,10,80,0,0,0,0,0), +(7,8,15,61,80,1103,3.40156,1104,0.263892,0), +(8,0,2,10,80,1258,0,1259,3.14159,0), +(9,7,15,71,80,1367,0,1368,0,0), +(10,5,5,10,80,1362,0,1363,0,1), +(11,5,5,10,80,1364,0,1365,0,1), +(30,20,40,71,80,1485,0,1486,0,0), +(32,10,10,0,80,0,0,0,0,0); +/*!40000 ALTER TABLE `battleground_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `battlemaster_entry` +-- + +DROP TABLE IF EXISTS `battlemaster_entry`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `battlemaster_entry` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Entry of a creature', + `bg_template` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Battleground template id', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `battlemaster_entry` +-- + +LOCK TABLES `battlemaster_entry` WRITE; +/*!40000 ALTER TABLE `battlemaster_entry` DISABLE KEYS */; +/*!40000 ALTER TABLE `battlemaster_entry` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `command` +-- + +DROP TABLE IF EXISTS `command`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `command` ( + `name` varchar(50) NOT NULL DEFAULT '', + `security` tinyint(3) unsigned NOT NULL DEFAULT '0', + `help` longtext, + PRIMARY KEY (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Chat System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `command` +-- + +LOCK TABLES `command` WRITE; +/*!40000 ALTER TABLE `command` DISABLE KEYS */; +INSERT INTO `command` VALUES +('account',0,'Syntax: .account\r\n\r\nDisplay the access level of your account.'), +('account addon',1,'Syntax: .account addon #addon\nSet expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk.'), +('account create',4,'Syntax: .account create $account $password\r\n\r\nCreate account and set password to it.'), +('account delete',4,'Syntax: .account delete $account\r\n\r\nDelete account with all characters.'), +('account lock',0,'Syntax: .account lock [on|off]\r\n\r\nAllow login from account only from current used IP or remove this requirement.'), +('account onlinelist',4,'Syntax: .account onlinelist\r\n\r\nShow list of online accounts.'), +('account password',0,'Syntax: .account password $old_password $new_password $new_password\r\n\r\nChange your account password.'), +('account set',3,'Syntax: .account set $subcommand\nType .account set to see the list of possible subcommands or .help account set $subcommand to see info on subcommands'), +('account set addon',3,'Syntax: .account set addon [$account] #addon\r\n\r\nSet user (possible targeted) expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk.'), +('account set gmlevel',4,'Syntax: .account set gmlevel [$account] #level [#realmid]\r\n\r\nSet the security level for targeted player (can''t be used at self) or for account $name to a level of #level on the realm #realmID.\r\n\r\n#level may range from 0 to 3.\r\n\r\n#reamID may be -1 for all realms.'), +('account set password',4,'Syntax: .account set password $account $password $password\r\n\r\nSet password for account.'), +('additem',3,'Syntax: .additem #itemid/[#itemname]/#shift-click-item-link #itemcount\r\n\r\nAdds the specified number of items of id #itemid (or exact (!) name $itemname in brackets, or link created by shift-click at item in inventory or recipe) to your or selected character inventory. If #itemcount is omitted, only one item will be added.\r\n.'), +('additemset',3,'Syntax: .additemset #itemsetid\r\n\r\nAdd items from itemset of id #itemsetid to your or selected character inventory. Will add by one example each item from itemset.'), +('announce',1,'Syntax: .announce $MessageToBroadcast\r\n\r\nSend a global message to all players online in chat log.'), +('aura',3,'Syntax: .aura #spellid\r\n\r\nAdd the aura from spell #spellid to the selected Unit.'), +('ban',3,'Syntax: .ban $subcommand\nType .ban to see the list of possible subcommands or .help ban $subcommand to see info on subcommands'), +('ban account',3,'Syntax: .ban account $Name $bantime $reason\r\nBan account kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban character',3,'Syntax: .ban character $Name $bantime $reason\r\nBan account and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban ip',3,'Syntax: .ban ip $Ip $bantime $reason\r\nBan IP.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('baninfo',3,'Syntax: .baninfo $subcommand\nType .baninfo to see the list of possible subcommands or .help baninfo $subcommand to see info on subcommands'), +('baninfo account',3,'Syntax: .baninfo account $accountid\r\nWatch full information about a specific ban.'), +('baninfo character',3,'Syntax: .baninfo character $charactername \r\nWatch full information about a specific ban.'), +('baninfo ip',3,'Syntax: .baninfo ip $ip\r\nWatch full information about a specific ban.'), +('bank',3,'Syntax: .bank\r\n\r\nShow your bank inventory.'), +('banlist',3,'Syntax: .banlist $subcommand\nType .banlist to see the list of possible subcommands or .help banlist $subcommand to see info on subcommands'), +('banlist account',3,'Syntax: .banlist account [$Name]\r\nSearches the banlist for a account name pattern or show full list account bans.'), +('banlist character',3,'Syntax: .banlist character $Name\r\nSearches the banlist for a character name pattern. Pattern required.'), +('banlist ip',3,'Syntax: .banlist ip [$Ip]\r\nSearches the banlist for a IP pattern or show full list of IP bans.'), +('bindsight',3,'Syntax: .bindsight\r\n\r\nBinds vision to the selected unit indefinitely. Cannot be used while currently possessing a target.'), +('cast',3,'Syntax: .cast #spellid [triggered]\r\n Cast #spellid to selected target. If no target selected cast to self. If ''trigered'' or part provided then spell casted with triggered flag.'), +('cast back',3,'Syntax: .cast back #spellid [triggered]\r\n Selected target will cast #spellid to your character. If ''trigered'' or part provided then spell casted with triggered flag.'), +('cast dist',3,'Syntax: .cast dist #spellid [#dist [triggered]]\r\n You will cast spell to pint at distance #dist. If ''trigered'' or part provided then spell casted with triggered flag. Not all spells can be casted as area spells.'), +('cast self',3,'Syntax: .cast self #spellid [triggered]\r\nCast #spellid by target at target itself. If ''trigered'' or part provided then spell casted with triggered flag.'), +('cast target',3,'Syntax: .cast target #spellid [triggered]\r\n Selected target will cast #spellid to his victim. If ''trigered'' or part provided then spell casted with triggered flag.'), +('character customize',2,'Syntax: .character customize [$name]\r\n\r\nMark selected in game or by $name in command character for customize at next login.'), +('character delete',4,'Syntax: .character delete $name\r\n\r\nDelete character $name.'), +('character level',3,'Syntax: .character level [$playername] [#level]\r\n\r\nSet the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'), +('character rename',2,'Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'), +('character reputation',2,'Syntax: .character reputation [$player_name]\r\n\r\nShow reputation information for selected player or player find by $player_name.'), +('character titles',2,'Syntax: .character titles [$player_name]\r\n\r\nShow known titles list for selected player or player find by $player_name.'), +('channel set public', 3, 'Syntax: .channel set public $channel $public\r\n\r\nChange password-changing ability for a channel. 1 for possible, 0 for GM only.'), +('combatstop',2,'Syntax: .combatstop [$playername]\r\nStop combat for selected character. If selected non-player then command applied to self. If $playername provided then attempt applied to online player $playername.'), +('cometome',3,'SYntax: .cometome $parameter\nMake selected creature come to your current location (new position not saved to DB).'), +('commands',0,'Syntax: .commands\r\n\r\nDisplay a list of available commands for your account level.'), +('cooldown',3,'Syntax: .cooldown [#spell_id]\r\n\r\nRemove all (if spell_id not provided) or #spel_id spell cooldown from selected character or you (if no selection).'), +('damage',3,'Syntax: .damage $damage_amount [$school [$spellid]]\r\n\r\nApply $damage to target. If not $school and $spellid provided then this flat clean melee damage without any modifiers. If $school provided then damage modified by armor reduction (if school physical), and target absorbing modifiers and result applied as melee damage to target. If spell provided then damage modified and applied as spell damage. $spellid can be shift-link.'), +('debug',1,'Syntax: .debug $subcommand\nType .debug to see the list of possible subcommands or .help debug $subcommand to see info on subcommands'), +('debug arena',3,'Syntax: .debug arena\r\n\r\nToggle debug mode for arenas. In debug mode GM can start arena with single player.'), +('debug bg',3,'Syntax: .debug bg\r\n\r\nToggle debug mode for battlegrounds. In debug mode GM can start battleground with single player.'), +('debug Mod32Value',3,'Syntax: .debug Mod32Value #field #value\r\n\r\nAdd #value to field #field of your character.'), +('debug play cinematic',1,'Syntax: .debug play cinematic #cinematicid\r\n\r\nPlay cinematic #cinematicid for you. You stay at place while your mind fly.\r\n'), +('debug play movie',1,'Syntax: .debug play movie #movieid\r\n\r\nPlay movie #movieid for you.'), +('debug play sound',1,'Syntax: .debug play sound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'), +('demorph',2,'Syntax: .demorph\r\n\r\nDemorph the selected player.'), +('die',3,'Syntax: .die\r\n\r\nKill the selected player. If no player is selected, it will kill you.'), +('dismount',0,'Syntax: .dismount\r\n\r\nDismount you, if you are mounted.'), +('distance',3,'Syntax: .distance\r\n\r\nDisplay the distance from your character to the selected creature.'), +('event',2,'Syntax: .event #event_id\r\nShow details about event with #event_id.'), +('event activelist',2,'Syntax: .event activelist\r\nShow list of currently active events.'), +('event start',2,'Syntax: .event start #event_id\r\nStart event #event_id. Set start time for event to current moment (change not saved in DB).'), +('event stop',2,'Syntax: .event stop #event_id\r\nStop event #event_id. Set start time for event to time in past that make current moment is event stop time (change not saved in DB).'), +('explorecheat',3,'Syntax: .explorecheat #flag\r\n\r\nReveal or hide all maps for the selected player. If no player is selected, hide or reveal maps to you.\r\n\r\nUse a #flag of value 1 to reveal, use a #flag value of 0 to hide all maps.'), +('flusharenapoints',3,'Syntax: .flusharenapoints\r\n\r\nUse it to distribute arena points based on arena team ratings, and start a new week.'), +('freeze',1,'Syntax: .freeze (#player)\r\n\"Freezes\" #player and disables his chat. When using this without #name it will freeze your target.'), +('gm',1,'Syntax: .gm [on/off]\r\n\r\nEnable or Disable in game GM MODE or show current state of on/off not provided.'), +('gm chat',1,'Syntax: .gm chat [on/off]\r\n\r\nEnable or disable chat GM MODE (show gm badge in messages) or show current state of on/off not provided.'), +('gm fly',3,'Syntax: .gm fly [on/off]\r\nEnable/disable gm fly mode.'), +('gm ingame',0,'Syntax: .gm ingame\r\n\r\nDisplay a list of available in game Game Masters.'), +('gm list',3,'Syntax: .gm list\r\n\r\nDisplay a list of all Game Masters accounts and security levels.'), +('gm visible',1,'Syntax: .gm visible on/off\r\n\r\nOutput current visibility state or make GM visible(on) and invisible(off) for other players.'), +('gmannounce',1,'Syntax: .gmannounce $announcement\r\nSend an announcement to online Gamemasters.'), +('gmnameannounce',1,'Syntax: .gmnameannounce $announcement.\r\nSend an announcement to all online GM''s, displaying the name of the sender.'), +('gmnotify',1,'Syntax: .gmnotify $notification\r\nDisplays a notification on the screen of all online GM''s.'), +('go',1,'Syntax: .go $subcommand\nType .go to see the list of possible subcommands or .help go $subcommand to see info on subcommands'), +('go creature',1,'Syntax: .go creature #creature_guid\r\nTeleport your character to creature with guid #creature_guid.\r\n.gocreature #creature_name\r\nTeleport your character to creature with this name.\r\n.gocreature id #creature_id\r\nTeleport your character to a creature that was spawned from the template with this entry.\r\n*If* more than one creature is found, then you are teleported to the first that is found inside the database.'), +('go graveyard',1,'Syntax: .go graveyard #graveyardId\r\n Teleport to graveyard with the graveyardId specified.'), +('go grid',1,'Syntax: .go grid #gridX #gridY [#mapId]\r\n\r\nTeleport the gm to center of grid with provided indexes at map #mapId (or current map if it not provided).'), +('go object',1,'Syntax: .go object #object_guid\r\nTeleport your character to gameobject with guid #object_guid'), +('go taxinode',1,'Syntax: .go taxinode #taxinode\r\n\r\nTeleport player to taxinode coordinates. You can look up zone using .lookup taxinode $namepart'), +('go ticket',1,'Syntax: .go ticket #ticketid\r\nTeleports the user to the location where $ticketid was created.'), +('go trigger',1,'Syntax: .go trigger #trigger_id\r\n\r\nTeleport your character to areatrigger with id #trigger_id. Character will be teleported to trigger target if selected areatrigger is telporting trigger.'), +('go xy',1,'Syntax: .go xy #x #y [#mapid]\r\n\r\nTeleport player to point with (#x,#y) coordinates at ground(water) level at map #mapid or same map if #mapid not provided.'), +('go xyz',1,'Syntax: .go xyz #x #y #z [#mapid]\r\n\r\nTeleport player to point with (#x,#y,#z) coordinates at ground(water) level at map #mapid or same map if #mapid not provided.'), +('go zonexy',1,'Syntax: .go zonexy #x #y [#zone]\r\n\r\nTeleport player to point with (#x,#y) client coordinates at ground(water) level in zone #zoneid or current zone if #zoneid not provided. You can look up zone using .lookup area $namepart'), +('gobject',2,'Syntax: .gobject $subcommand\nType .gobject to see the list of possible subcommands or .help gobject $subcommand to see info on subcommands'), +('gobject activate',2,'Syntax: .gobject activate #guid\r\n\r\nActivates an object like a door or a button.'), +('gobject add',2,'Syntax: .gobject add #id \r\n\r\nAdd a game object from game object templates to the world at your current location using the #id.\r\nspawntimesecs sets the spawntime, it is optional.\r\n\r\nNote: this is a copy of .gameobject.'), +('gobject delete',2,'Syntax: .gobject delete #go_guid\r\nDelete gameobject with guid #go_guid.'), +('gobject info', 2, 'Syntax: .gobject info [$object_entry]\r\n\r\nQuery Gameobject information for selected gameobject or given entry.'), +('gobject move',2,'Syntax: .gobject move #goguid [#x #y #z]\r\n\r\nMove gameobject #goguid to character coordinates (or to (#x,#y,#z) coordinates if its provide).'), +('gobject near',2,'Syntax: .gobject near [#distance]\r\n\r\nOutput gameobjects at distance #distance from player. Output gameobject guids and coordinates sorted by distance from character. If #distance not provided use 10 as default value.'), +('gobject setphase',2,'Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'), +('gobject target',2,'Syntax: .gobject target [#go_id|#go_name_part]\r\n\r\nLocate and show position nearest gameobject. If #go_id or #go_name_part provide then locate and show position of nearest gameobject with gameobject template id #go_id or name included #go_name_part as part.'), +('gobject tempadd',2,'Adds a temporary gameobject that is not saved to DB.'), +('gobject turn',2,'Syntax: .gobject turn #goguid \r\n\r\nSet for gameobject #goguid orientation same as current character orientation.'), +('goname',1,'Syntax: .goname [$charactername]\r\n\r\nTeleport to the given character. Either specify the character name or click on the character''s portrait, e.g. when you are in a group. Character can be offline.'), +('gps',1,'Syntax: .gps [$name|$shift-link]\r\n\r\nDisplay the position information for a selected character or creature (also if player name $name provided then for named player, or if creature/gameobject shift-link provided then pointed creature/gameobject if it loaded). Position information includes X, Y, Z, and orientation, map Id and zone Id'), +('groupgo',1,'Syntax: .groupgo [$charactername]\r\n\r\nTeleport the given character and his group to you. Teleported only online characters but original selected group member can be offline.'), +('guid',2,'Syntax: .guid\r\n\r\nDisplay the GUID for the selected character.'), +('guild',3,'Syntax: .guild $subcommand\nType .guild to see the list of possible subcommands or .help guild $subcommand to see info on subcommands'), +('guild create',2,'Syntax: .guild create [$GuildLeaderName] \"$GuildName\"\r\n\r\nCreate a guild named $GuildName with the player $GuildLeaderName (or selected) as leader. Guild name must in quotes.'), +('guild delete',2,'Syntax: .guild delete \"$GuildName\"\r\n\r\nDelete guild $GuildName. Guild name must in quotes.'), +('guild invite',2,'Syntax: .guild invite [$CharacterName] \"$GuildName\"\r\n\r\nAdd player $CharacterName (or selected) into a guild $GuildName. Guild name must in quotes.'), +('guild rank',2,'Syntax: .guild rank [$CharacterName] #Rank\r\n\r\nSet for player $CharacterName (or selected) rank #Rank in a guild.'), +('guild uninvite',2,'Syntax: .guild uninvite [$CharacterName]\r\n\r\nRemove player $CharacterName (or selected) from a guild.'), +('help',0,'Syntax: .help [$command]\r\n\r\nDisplay usage instructions for the given $command. If no $command provided show list available commands.'), +('hidearea',3,'Syntax: .hidearea #areaid\r\n\r\nHide the area of #areaid to the selected character. If no character is selected, hide this area to you.'), +('honor',2,'Syntax: .honor $subcommand\nType .honor to see the list of possible subcommands or .help honor $subcommand to see info on subcommands'), +('honor add',2,'Syntax: .honor add $amount\r\n\r\nAdd a certain amount of honor (gained today) to the selected player.'), +('honor addkill',2,'Syntax: .honor addkikll\r\n\r\nAdd the targeted unit as one of your pvp kills today (you only get honor if it''s a racial leader or a player)'), +('honor update',2,'Syntax: .honor update\r\n\r\nForce the yesterday''s honor fields to be updated with today''s data, which will get reset for the selected player.'), +('hover',3,'Syntax: .hover #flag\r\n\r\nEnable or disable hover mode for your character.\r\n\r\nUse a #flag of value 1 to enable, use a #flag value of 0 to disable hover.'), +('instance',3,'Syntax: .instance $subcommand\nType .instance to see the list of possible subcommands or .help instance $subcommand to see info on subcommands'), +('instance listbinds',3,'Syntax: .instance listbinds\r\n Lists the binds of the selected player.'), +('instance savedata',3,'Syntax: .instance savedata\r\n Save the InstanceData for the current player''s map to the DB.'), +('instance stats',3,'Syntax: .instance stats\r\n Shows statistics about instances.'), +('instance unbind',3,'Syntax: .instance unbind all\r\n All of the selected player''s binds will be cleared.'), +('instance open', 3, 'Syntax: .instance open mapid [normal|heroic|10normal|10heroic|25normal|25heroic]'), +('instance close', 3, 'Syntax: .instance close mapid [normal|heroic|10normal|10heroic|25normal|25heroic]'), +('itemmove',2,'Syntax: .itemmove #sourceslotid #destinationslotid\r\n\r\nMove an item from slots #sourceslotid to #destinationslotid in your inventory\r\n\r\nNot yet implemented'), +('kick',2,'Syntax: .kick [$charactername] [$reason]\r\n\r\nKick the given character name from the world with or without reason. If no character name is provided then the selected player (except for yourself) will be kicked. If no reason is provided, default is \"No Reason\".'), +('learn',3,'Syntax: .learn #spell [all]\r\n\r\nSelected character learn a spell of id #spell. If ''all'' provided then all ranks learned.'), +('learn all',3,'Syntax: .learn all\r\n\r\nLearn all big set different spell maybe useful for Administaror.'), +('learn all_crafts',2,'Syntax: .learn crafts\r\n\r\nLearn all professions and recipes.'), +('learn all_default',1,'Syntax: .learn all_default [$playername]\r\n\r\nLearn for selected/$playername player all default spells for his race/class and spells rewarded by completed quests.'), +('learn all_gm',2,'Syntax: .learn all_gm\r\n\r\nLearn all default spells for Game Masters.'), +('learn all_lang',1,'Syntax: .learn all_lang\r\n\r\nLearn all languages'), +('learn all_myclass',3,'Syntax: .learn all_myclass\r\n\r\nLearn all spells and talents available for his class.'), +('learn all_mypettalents',3,'Syntax: .learn all_mypettalents\r\n\r\nLearn all talents for your pet available for his creature type (only for hunter pets).'), +('learn all_myspells',3,'Syntax: .learn all_myspells\r\n\r\nLearn all spells (except talents and spells with first rank learned as talent) available for his class.'), +('learn all_mytalents',3,'Syntax: .learn all_mytalents\r\n\r\nLearn all talents (and spells with first rank learned as talent) available for his class.'), +('learn all_recipes',2,'Syntax: .learn all_recipes [$profession]\r\rLearns all recipes of specified profession and sets skill level to max.\rExample: .learn all_recipes enchanting'), +('levelup',3,'Syntax: .levelup [$playername] [#numberoflevels]\r\n\r\nIncrease/decrease the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'), +('linkgrave',3,'Syntax: .linkgrave #graveyard_id [alliance|horde]\r\n\r\nLink current zone to graveyard for any (or alliance/horde faction ghosts). This let character ghost from zone teleport to graveyard after die if graveyard is nearest from linked to zone and accept ghost of this faction. Add only single graveyard at another map and only if no graveyards linked (or planned linked at same map).'), +('list',3,'Syntax: .list $subcommand\nType .list to see the list of possible subcommands or .help list $subcommand to see info on subcommands'), +('list auras',3,'Syntax: .list auras\nList auras (passive and active) of selected creature or player. If no creature or player is selected, list your own auras.'), +('list creature',3,'Syntax: .list creature #creature_id [#max_count]\r\n\r\nOutput creatures with creature id #creature_id found in world. Output creature guids and coordinates sorted by distance from character. Will be output maximum #max_count creatures. If #max_count not provided use 10 as default value.'), +('list item',3,'Syntax: .list item #item_id [#max_count]\r\n\r\nOutput items with item id #item_id found in all character inventories, mails, auctions, and guild banks. Output item guids, item owner guid, owner account and owner name (guild name and guid in case guild bank). Will be output maximum #max_count items. If #max_count not provided use 10 as default value.'), +('list object',3,'Syntax: .list object #gameobject_id [#max_count]\r\n\r\nOutput gameobjects with gameobject id #gameobject_id found in world. Output gameobject guids and coordinates sorted by distance from character. Will be output maximum #max_count gameobject. If #max_count not provided use 10 as default value.'), +('listfreeze',1,'Syntax: .listfreeze\r\n\r\nSearch and output all frozen players.'), +('loadpath',3,'Syntax: .loadpath $pathid\nLoad path changes ingame - IMPORTANT: must be applied first for new paths before .path load #pathid '), +('lookup',3,'Syntax: .lookup $subcommand\nType .lookup to see the list of possible subcommands or .help lookup $subcommand to see info on subcommands'), +('lookup area',1,'Syntax: .lookup area $namepart\r\n\r\nLooks up an area by $namepart, and returns all matches with their area ID''s.'), +('lookup creature',3,'Syntax: .lookup creature $namepart\r\n\r\nLooks up a creature by $namepart, and returns all matches with their creature ID''s.'), +('lookup event',2,'Syntax: .lookup event $name\r\nAttempts to find the ID of the event with the provided $name.'), +('lookup faction',3,'Syntax: .lookup faction $name\r\nAttempts to find the ID of the faction with the provided $name.'), +('lookup item',3,'Syntax: .lookup item $itemname\r\n\r\nLooks up an item by $itemname, and returns all matches with their Item ID''s.'), +('lookup itemset',3,'Syntax: .lookup itemset $itemname\r\n\r\nLooks up an item set by $itemname, and returns all matches with their Item set ID''s.'), +('lookup map',3,'Syntax: .lookup map $namepart\r\n\r\nLooks up a map by $namepart, and returns all matches with their map ID''s.'), +('lookup object',3,'Syntax: .lookup object $objname\r\n\r\nLooks up an gameobject by $objname, and returns all matches with their Gameobject ID''s.'), +('lookup player account',2,'Syntax: .lookup player account $account ($limit) \r\n\r\n Searchs players, which account username is $account with optional parametr $limit of results.'), +('lookup player email',2,'Syntax: .lookup player email $email ($limit) \r\n\r\n Searchs players, which account email is $email with optional parametr $limit of results.'), +('lookup player ip',2,'Syntax: .lookup player ip $ip ($limit) \r\n\r\n Searchs players, which account ast_ip is $ip with optional parametr $limit of results.'), +('lookup quest',3,'Syntax: .lookup quest $namepart\r\n\r\nLooks up a quest by $namepart, and returns all matches with their quest ID''s.'), +('lookup skill',3,'Syntax: .lookup skill $$namepart\r\n\r\nLooks up a skill by $namepart, and returns all matches with their skill ID''s.'), +('lookup spell',3,'Syntax: .lookup spell $namepart\r\n\r\nLooks up a spell by $namepart, and returns all matches with their spell ID''s.'), +('lookup taxinode',3,'Syntax: .lookup taxinode $substring\r\n\r\nSearch and output all taxinodes with provide $substring in name.'), +('lookup tele',1,'Syntax: .lookup tele $substring\r\n\r\nSearch and output all .tele command locations with provide $substring in name.'), +('maxskill',3,'Syntax: .maxskill\r\nSets all skills of the targeted player to their maximum values for its current level.'), +('modify',1,'Syntax: .modify $subcommand\nType .modify to see the list of possible subcommands or .help modify $subcommand to see info on subcommands'), +('modify arena',1,'Syntax: .modify arena #value\r\nAdd $amount arena points to the selected player.'), +('modify aspeed',1,'Syntax: .modify aspeed #rate\r\n\r\nModify all speeds -run,swim,run back,swim back- of the selected player to \"normalbase speed for this move type\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify bit',1,'Syntax: .modify bit #field #bit\r\n\r\nToggle the #bit bit of the #field field for the selected player. If no player is selected, modify your character.'), +('modify bwalk',1,'Syntax: .modify bwalk #rate\r\n\r\nModify the speed of the selected player while running backwards to \"normal walk back speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify drunk',1,'Syntax: .modify drunk #value\r\n Set drunk level to #value (0..100). Value 0 remove drunk state, 100 is max drunked state.'), +('modify energy',1,'Syntax: .modify energy #energy\r\n\r\nModify the energy of the selected player. If no player is selected, modify your energy.'), +('modify faction',1,'Syntax: .modify faction #factionid #flagid #npcflagid #dynamicflagid\r\n\r\nModify the faction and flags of the selected creature. Without arguments, display the faction and flags of the selected creature.'), +('modify fly',1,'.modify fly $parameter\nModify the flying speed of the selected player to \"normal flying speed\"*rate. If no player is selected, modify your speed.\n #rate may range from 0.1 to 50.'), +('modify gender',2,'Syntax: .modify gender male/female\r\n\r\nChange gender of selected player.'), +('modify honor',1,'Syntax: .modify honor $amount\r\n\r\nAdd $amount honor points to the selected player.'), +('modify hp',1,'Syntax: .modify hp #newhp\r\n\r\nModify the hp of the selected player. If no player is selected, modify your hp.'), +('modify mana',1,'Syntax: .modify mana #newmana\r\n\r\nModify the mana of the selected player. If no player is selected, modify your mana.'), +('modify money',1,'Syntax: .modify money #money\r\n.money #money\r\n\r\nAdd or remove money to the selected player. If no player is selected, modify your money.\r\n\r\n #gold can be negative to remove money.'), +('modify morph',2,'Syntax: .modify morph #displayid\r\n\r\nChange your current model id to #displayid.'), +('modify mount',1,'Syntax: .modify mount #id #speed\r\nDisplay selected player as mounted at #id creature and set speed to #speed value.'), +('modify phase',3,'Syntax: .modify phase #phasemask\r\n\r\nSelected character phasemask changed to #phasemask with related world vision update. Change active until in game phase changed, or GM-mode enable/disable, or re-login. Character pts pasemask update to same value.'), +('modify rage',1,'Syntax: .modify rage #newrage\r\n\r\nModify the rage of the selected player. If no player is selected, modify your rage.'), +('modify rep',2,'Syntax: .modify rep #repId (#repvalue | $rankname [#delta])\r\nSets the selected players reputation with faction #repId to #repvalue or to $reprank.\r\nIf the reputation rank name is provided, the resulting reputation will be the lowest reputation for that rank plus the delta amount, if specified.\r\nYou can use ''.pinfo rep'' to list all known reputation ids, or use ''.lookup faction $name'' to locate a specific faction id.'), +('modify runicpower',1,'Syntax: .modify runicpower #newrunicpower\r\n\r\nModify the runic power of the selected player. If no player is selected, modify your runic power.'), +('modify scale',1,'.modify scale $parameter\nModify size of the selected player to \"normal scale\"*rate. If no player is selected, modify your size.\n#rate may range from 0.1 to 10.'), +('modify speed',1,'Syntax: .modify speed #rate\r\n.speed #rate\r\n\r\nModify the running speed of the selected player to \"normal base run speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify spell',1,'TODO'), +('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'), +('modify swim',1,'Syntax: .modify swim #rate\r\n\r\nModify the swim speed of the selected player to \"normal swim speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify tp',1,'Syntax: .modify tp #amount\r\n\r\nSet free talent pointes for selected character or character''s pet. It will be reset to default expected at next levelup/login/quest reward.'), +('movegens',3,'Syntax: .movegens\r\n Show movement generators stack for selected creature or player.'), +('mute',1,'Syntax: .mute [$playerName] $timeInMinutes [$reason]\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'), +('nameannounce',1,'Syntax: .nameannounce $announcement.\nSend an announcement to all online players, displaying the name of the sender.'), +('namego',1,'Syntax: .namego [$charactername]\r\n\r\nTeleport the given character to you. Character can be offline.'), +('neargrave',3,'Syntax: .neargrave [alliance|horde]\r\n\r\nFind nearest graveyard linked to zone (or only nearest from accepts alliance or horde faction ghosts).'), +('notify',1,'Syntax: .notify $MessageToBroadcast\r\n\r\nSend a global message to all players online in screen.'), +('npc',1,'Syntax: .npc $subcommand\nType .npc to see the list of possible subcommands or .help npc $subcommand to see info on subcommands'), +('npc add',2,'Syntax: .npc add #creatureid\r\n\r\nSpawn a creature by the given template id of #creatureid.'), +('npc addformation',1,'Syntax: .npc addformation $leader\nAdd selected creature to a leader''s formation.'), +('npc additem',2,'Syntax: .npc additem #itemId <#maxcount><#incrtime><#extendedcost>r\r\n\r\nAdd item #itemid to item list of selected vendor. Also optionally set max count item in vendor item list and time to item count restoring and items ExtendedCost.'), +('npc addmove',2,'Syntax: .npc addmove #creature_guid [#waittime]\r\n\r\nAdd your current location as a waypoint for creature with guid #creature_guid. And optional add wait time.'), +('npc allowmove',3,'Syntax: .npc allowmove\r\n\r\nEnable or disable movement creatures in world. Not implemented.'), +('npc changeentry',3,'Syntax: .npc changeentry $entry\nSwitch selected creature with another entry from creature_template. - New creature.id value not saved to DB.'), +('npc changelevel',2,'Syntax: .npc changelevel #level\r\n\r\nChange the level of the selected creature to #level.\r\n\r\n#level may range from 1 to 63.'), +('npc delete',2,'Syntax: .npc delete [#guid]\r\n\r\nDelete creature with guid #guid (or the selected if no guid is provided)'), +('npc delitem',2,'Syntax: .npc delitem #itemId\r\n\r\nRemove item #itemid from item list of selected vendor.'), +('npc factionid',2,'Syntax: .npc factionid #factionid\r\n\r\nSet the faction of the selected creature to #factionid.'), +('npc flag',2,'Syntax: .npc flag #npcflag\r\n\r\nSet the NPC flags of creature template of the selected creature and selected creature to #npcflag. NPC flags will applied to all creatures of selected creature template after server restart or grid unload/load.'), +('npc follow',2,'Syntax: .npc follow\r\n\r\nSelected creature start follow you until death/fight/etc.'), +('npc info',3,'Syntax: .npc info\r\n\r\nDisplay a list of details for the selected creature.\r\n\r\nThe list includes:\r\n- GUID, Faction, NPC flags, Entry ID, Model ID,\r\n- Level,\r\n- Health (current/maximum),\r\n\r\n- Field flags, dynamic flags, faction template, \r\n- Position information,\r\n- and the creature type, e.g. if the creature is a vendor.'), +('npc move',2,'Syntax: .npc move [#creature_guid]\r\n\r\nMove the targeted creature spawn point to your coordinates.'), +('npc playemote',3,'Syntax: .npc playemote #emoteid\r\n\r\nMake the selected creature emote with an emote of id #emoteid.'), +('npc say',1,'Syntax: .npc say $message\nMake selected creature say specified message.'), +('npc setdeathstate',2,'Syntax: .npc setdeathstate on/off\r\n\r\nSet default death state (dead/alive) for npc at spawn.'), +('npc setlink',2,'Syntax: .npc setlink $creatureGUID\r\n\r\nLinks respawn of selected creature to the condition that $creatureGUID defined is alive.'), +('npc setmodel',2,'Syntax: .npc setmodel #displayid\r\n\r\nChange the model id of the selected creature to #displayid.'), +('npc setmovetype',2,'Syntax: .npc setmovetype [#creature_guid] stay/random/way [NODEL]\r\n\r\nSet for creature pointed by #creature_guid (or selected if #creature_guid not provided) movement type and move it to respawn position (if creature alive). Any existing waypoints for creature will be removed from the database if you do not use NODEL. If the creature is dead then movement type will applied at creature respawn.\r\nMake sure you use NODEL, if you want to keep the waypoints.'), +('npc setphase',2,'Syntax: .npc setphase #phasemask\r\n\r\nSelected unit or pet phasemask changed to #phasemask with related world vision update for players. In creature case state saved to DB and persistent. In pet case change active until in game phase changed for owner, owner re-login, or GM-mode enable/disable..'), +('npc spawndist',2,'Syntax: .npc spawndist #dist\r\n\r\nAdjust spawndistance of selected creature to dist.'), +('npc spawntime',2,'Syntax: .npc spawntime #time \r\n\r\nAdjust spawntime of selected creature to time.'), +('npc tempadd',2,'Adds temporary NPC, not saved to database.'), +('npc textemote',1,'Syntax: .npc textemote #emoteid\r\n\r\nMake the selected creature to do textemote with an emote of id #emoteid.'), +('npc unfollow',2,'Syntax: .npc unfollow\r\n\r\nSelected creature (non pet) stop follow you.'), +('npc whisper',1,'Syntax: .npc whisper #playerguid #text\r\nMake the selected npc whisper #text to #playerguid.'), +('npc yell',1,'Syntax: .npc yell $message\nMake selected creature yell specified message.'), +('pdump',3,'Syntax: .pdump $subcommand\nType .pdump to see the list of possible subcommands or .help pdump $subcommand to see info on subcommands'), +('pdump load',3,'Syntax: .pdump load $filename $account [$newname] [$newguid]\r\nLoad character dump from dump file into character list of $account with saved or $newname, with saved (or first free) or $newguid guid.'), +('pdump write',3,'Syntax: .pdump write $filename $playerNameOrGUID\r\nWrite character dump with name/guid $playerNameOrGUID to file $filename.'), +('pet',2,'Syntax: .pet $subcommand\nType .pet to see the list of possible subcommands or .help pet $subcommand to see info on subcommands'), +('pet create',2,'Syntax: .pet create\r\n\r\nCreates a pet of the selected creature.'), +('pet learn',2,'Syntax: .pet learn\r\n\r\nLearn #spellid to pet.'), +('pet tp',2,'Syntax: .pet tp #\r\n\r\nChange pet''s amount of training points.'), +('pet unlearn',2,'Syntax: .pet unlean\r\n\r\nunLearn #spellid to pet.'), +('pinfo',2,'Syntax: .pinfo [$player_name]\r\n\r\nOutput account information for selected player or player find by $player_name.'), +('playall',2,'Syntax: .playall #soundid\r\n\r\nPlayer a sound to whole server.'), +('possess',3,'Syntax: .possess\r\n\r\nPossesses indefinitely the selected creature.'), +('quest',3,'Syntax: .quest $subcommand\nType .quest to see the list of possible subcommands or .help quest $subcommand to see info on subcommands'), +('quest add',3,'Syntax: .quest add #quest_id\r\n\r\nAdd to character quest log quest #quest_id. Quest started from item can''t be added by this command but correct .additem call provided in command output.'), +('quest complete',3,'Syntax: .quest complete #questid\r\nMark all quest objectives as completed for target character active quest. After this target character can go and get quest reward.'), +('quest remove',3,'Syntax: .quest remove #quest_id\r\n\r\nSet quest #quest_id state to not completed and not active (and remove from active quest list) for selected player.'), +('recall',1,'Syntax: .recall [$playername]\r\n\r\nTeleport $playername or selected player to the place where he has been before last use of a teleportation command. If no $playername is entered and no player is selected, it will teleport you.'), +('reload',3,'Syntax: .reload $subcommand\nType .reload to see the list of possible subcommands or .help reload $subcommand to see info on subcommands'), +('reload all',3,'Syntax: .reload all\r\n\r\nReload all tables with reload support added and that can be _safe_ reloaded.'), +('reload all_item',3,'Syntax: .reload all_item\nReload page_text, item_enchantment_table tables.'), +('reload all_locales',3,'Syntax: .reload all_locales\r\n\r\nReload all `locales_*` tables with reload support added and that can be _safe_ reloaded.'), +('reload all_loot',3,'Syntax: .reload all_loot\r\n\r\nReload all `*_loot_template` tables. This can be slow operation with lags for server run.'), +('reload all_npc',3,'Syntax: .reload all_npc\nReload npc_gossip, npc_option, npc_trainer, npc vendor, points of interest tables.'), +('reload all_quest',3,'Syntax: .reload all_quest\r\n\r\nReload all quest related tables if reload support added for this table and this table can be _safe_ reloaded.'), +('reload all_scripts',3,'Syntax: .reload all_scripts\nReload gameobject_scripts, event_scripts, quest_end_scripts, quest_start_scripts, spell_scripts, db_script_string, waypoint_scripts tables.'), +('reload all_spell',3,'Syntax: .reload all\r\n\r\nReload all `spell_*` tables with reload support added and that can be _safe_ reloaded.'), +('reload areatrigger_involvedrelation',3,'Syntax: .reload areatrigger_involvedrelation\nReload areatrigger_involvedrelation table.'), +('reload areatrigger_tavern',3,'Syntax: .reload areatrigger_tavern\nReload areatrigger_tavern table.'), +('reload areatrigger_teleport',3,'Syntax: .reload areatrigger_teleport\nReload areatrigger_teleport table.'), +('reload autobroadcast',3,'Syntax: .reload autobroadcast\nReload autobroadcast table.'), +('reload command',3,'Syntax: .reload command\nReload command table.'), +('reload conditions', 3, 'Reload conditions table.'), +('reload config',3,'Syntax: .reload config\r\n\r\nReload config settings (by default stored in trinityd.conf). Not all settings can be change at reload: some new setting values will be ignored until restart, some values will applied with delay or only to new objects/maps, some values will explicitly rejected to change at reload.'), +('reload creature_involvedrelation',3,'Syntax: .reload creature_involvedrelation\nReload creature_involvedrelation table.'), +('reload creature_linked_respawn',2,'Syntax: .reload creature_linked_respawn\r\nReload creature_linked_respawn table.'), +('reload creature_loot_template',3,'Syntax: .reload creature_loot_template\nReload creature_loot_template table.'), +('reload creature_onkill_reputation','3','Syntax: .reload creature_onkill_reputation\r\nReload creature_onkill_reputation table.'), +('reload creature_questrelation',3,'Syntax: .reload creature_questrelation\nReload creature_questrelation table.'), +('reload disenchant_loot_template',3,'Syntax: .reload disenchant_loot_template\nReload disenchant_loot_template table.'), +('reload event_scripts',3,'Syntax: .reload event_scripts\nReload event_scripts table.'), +('reload fishing_loot_template',3,'Syntax: .reload fishing_loot_template\nReload fishing_loot_template table.'), +('reload gameobject_involvedrelation',3,'Syntax: .reload gameobject_involvedrelation\nReload gameobject_involvedrelation table.'), +('reload gameobject_loot_template',3,'Syntax: .reload gameobject_loot_template\nReload gameobject_loot_template table.'), +('reload gameobject_questrelation',3,'Syntax: .reload gameobject_questrelation\nReload gameobject_questrelation table.'), +('reload gameobject_scripts',3,'Syntax: .reload gameobject_scripts\nReload gameobject_scripts table.'), +('reload game_graveyard_zone',3,'Syntax: .reload game_graveyard_zone\nReload game_graveyard_zone table.'), +('reload game_tele',3,'Syntax: .reload game_tele\nReload game_tele table.'), +('reload gm_tickets',3,'Syntax: .reload gm_tickets\nReload gm_tickets table.'), +('reload item_enchantment_template',3,'Syntax: .reload item_enchantment_template\nReload item_enchantment_template table.'), +('reload item_loot_template',3,'Syntax: .reload item_loot_template\nReload item_loot_template table.'), +('reload item_set_names',3,'Syntax: .reload item_set_names\nReload item_set_names table.'), +('reload locales_creature',3,'Syntax: .reload locales_creature\nReload locales_creature table.'), +('reload locales_gameobject',3,'Syntax: .reload locales_gameobject\nReload locales_gameobject table.'), +('reload locales_item',3,'Syntax: .reload locales_item\nReload locales_item table.'), +('reload locales_item_set_name',3,'Syntax: .reload locales_item_set_name\nReload locales_item_set_name table.'), +('reload locales_npc_text',3,'Syntax: .reload locales_npc_text\nReload locales_npc_text table.'), +('reload locales_page_text',3,'Syntax: .reload locales_page_text\nReload locales_page_text table.'), +('reload locales_points_of_interest',3,'Syntax: .reload locales_points_of_interest\nReload locales_point_of_interest table.'), +('reload locales_quest',3,'Syntax: .reload locales_quest\nReload locales_quest table.'), +('reload milling_loot_template',3,'Syntax: .reload milling_loot_template\nReload milling_loot_template table.'), +('reload npc_gossip',3,'Syntax: .reload npc_gossip\nReload npc_gossip table.'), +('reload npc_trainer',3,'Syntax: .reload npc_trainer\nReload npc_trainer table.'), +('reload npc_vendor',3,'Syntax: .reload npc_vendor\nReload npc_vendor table.'), +('reload page_text',3,'Syntax: .reload page_text\nReload page_text table.'), +('reload pickpocketing_loot_template',3,'Syntax: .reload pickpocketing_loot_template\nReload pickpocketing_loot_template table.'), +('reload points_of_interest',3,'Syntax: .reload points_of_interest\nReload points_of_interest table.'), +('reload prospecting_loot_template',3,'Syntax: .reload prospecting_loot_template\nReload prospecting_loot_template table.'), +('reload quest_end_scripts',3,'Syntax: .reload quest_end_scripts\nReload quest_end_scripts table.'), +('reload mail_loot_template',3,'Syntax: .reload mail_loot_template\nReload mail_loot_template table.'), +('reload quest_start_scripts',3,'Syntax: .reload quest_start_scripts\nReload quest_start_scripts table.'), +('reload quest_template',3,'Syntax: .reload quest_template\nReload quest_template table.'), +('reload reference_loot_template',3,'Syntax: .reload reference_loot_template\nReload reference_loot_template table.'), +('reload reserved_name',3,'Syntax: .reload reserved_name\nReload reserved_name table.'), +('reload skill_discovery_template',3,'Syntax: .reload skill_discovery_template\nReload skill_discovery_template table.'), +('reload skill_extra_item_template',3,'Syntax: .reload skill_extra_item_template\nReload skill_extra_item_template table.'), +('reload skill_fishing_base_level',3,'Syntax: .reload skill_fishing_base_level\nReload skill_fishing_base_level table.'), +('reload skinning_loot_template',3,'Syntax: .reload skinning_loot_template\nReload skinning_loot_template table.'), +('reload spell_area',3,'Syntax: .reload spell_area\nReload spell_area table.'), +('reload spell_bonus_data',3,'Syntax: .reload spell_bonus_data\nReload spell_bonus_data table.'), +('reload spell_disabled',3,'Syntax: .reload spell_disabled\nReload spell_disabled table.'), +('reload spell_group',3,'Syntax: .reload spell_group\nReload spell_group table.'), +('reload spell_group_stack_rules',3,'Syntax: .reload spell_group\nReload spell_group_stack_rules table.'), +('reload spell_learn_spell',3,'Syntax: .reload spell_learn_spell\nReload spell_learn_spell table.'), +('reload spell_linked_spell',3,'Usage: .reload spell_linked_spell\r\nReloads the spell_linked_spell DB table.'), +('reload spell_loot_template',3,'Syntax: .reload spell_loot_template\nReload spell_loot_template table.'), +('reload spell_pet_auras',3,'Syntax: .reload spell_pet_auras\nReload spell_pet_auras table.'), +('reload spell_proc_event',3,'Syntax: .reload spell_proc_event\nReload spell_proc_event table.'), +('reload spell_required',3,'Syntax: .reload spell_required\nReload spell_required table.'), +('reload spell_scripts',3,'Syntax: .reload spell_scripts\nReload spell_scripts table.'), +('reload spell_target_position',3,'Syntax: .reload spell_target_position\nReload spell_target_position table.'), +('reload spell_threats',3,'Syntax: .reload spell_threats\nReload spell_threats table.'), +('reload creature_template','3','Syntax: .reload creature_template $entry\r\nReload the specified creature''s template.'), +('reload trinity_string',3,'Syntax: .reload trinity_string\nReload trinity_string table.'), +('reload waypoint_scripts',3,'Syntax: .reload waypoint_scripts\nReload waypoint_scripts table.'), +('repairitems',2,'Syntax: .repairitems\r\n\r\nRepair all selected player''s items.'), +('reset',3,'Syntax: .reset $subcommand\nType .reset to see the list of possible subcommands or .help reset $subcommand to see info on subcommands'), +('reset achievements',3,'Syntax: .reset achievements [$playername]\r\n\r\nReset achievements data for selected or named (online or offline) character. Achievements for persistance progress data like completed quests/etc re-filled at reset. Achievements for events like kills/casts/etc will lost.'), +('reset all',3,'Syntax: .reset all spells\r\n\r\nSyntax: .reset all talents\r\n\r\nRequest reset spells or talents (including talents for all character''s pets if any) at next login each existed character.'), +('reset honor',3,'Syntax: .reset honor [Playername]\r\n Reset all honor data for targeted character.'), +('reset level',3,'Syntax: .reset level [Playername]\r\n Reset level to 1 including reset stats and talents. Equipped items with greater level requirement can be lost.'), +('reset spells',3,'Syntax: .reset spells [Playername]\r\n Removes all non-original spells from spellbook.\r\n. Playername can be name of offline character.'), +('reset stats',3,'Syntax: .reset stats [Playername]\r\n Resets(recalculate) all stats of the targeted player to their original VALUESat current level.'), +('reset talents',3,'Syntax: .reset talents [Playername]\r\n Removes all talents of the targeted player or pet or named player. Playername can be name of offline character. With player talents also will be reset talents for all character''s pets if any.'), +('respawn',3,'Syntax: .respawn\r\n\r\nRespawn all nearest creatures and GO without waiting respawn time expiration.'), +('revive',3,'Syntax: .revive\r\n\r\nRevive the selected player. If no player is selected, it will revive you.'), +('save',0,'Syntax: .save\r\n\r\nSaves your character.'), +('saveall',1,'Syntax: .saveall\r\n\r\nSave all characters in game.'), +('send items',3,'Syntax: .send items #playername \"#subject\" \"#text\" itemid1[:count1] itemid2[:count2] ... itemidN[:countN]\r\n\r\nSend a mail to a player. Subject and mail text must be in \"\". If for itemid not provided related count values then expected 1, if count > max items in stack then items will be send in required amount stacks. All stacks amount in mail limited to 12.'), +('send mail',1,'Syntax: .send mail #playername \"#subject\" \"#text\"\r\n\r\nSend a mail to a player. Subject and mail text must be in \"\".'), +('send message',3,'Syntax: .send message $playername $message\r\n\r\nSend screen message to player from ADMINISTRATOR.'), +('send money',3,'Syntax: .send money #playername \"#subject\" \"#text\" #money\r\n\r\nSend mail with money to a player. Subject and mail text must be in \"\".'), +('server',3,'Syntax: .server $subcommand\nType .server to see the list of possible subcommands or .help server $subcommand to see info on subcommands'), +('server corpses',2,'Syntax: .server corpses\r\n\r\nTriggering corpses expire check in world.'), +('server exit',4,'Syntax: .server exit\r\n\r\nTerminate trinity-core NOW. Exit code 0.'), +('server idlerestart',3,'Syntax: .server idlerestart #delay\r\n\r\nRestart the server after #delay seconds if no active connections are present (no players). Use #exist_code or 2 as program exist code.'), +('server idlerestart cancel',3,'Syntax: .server idlerestart cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('server idleshutdown',3,'Syntax: .server idleshutdown #delay [#exist_code]\r\n\r\nShut the server down after #delay seconds if no active connections are present (no players). Use #exist_code or 0 as program exist code.'), +('server idleshutdown cancel',3,'Syntax: .server idleshutdown cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('server info',0,'Syntax: .server info\r\n\r\nDisplay server version and the number of connected players.'), +('server motd',0,'Syntax: .server motd\r\n\r\nShow server Message of the day.'), +('server plimit',3,'Syntax: .server plimit [#num|-1|-2|-3|reset|player|moderator|gamemaster|administrator]\r\n\r\nWithout arg show current player amount and security level limitations for login to server, with arg set player linit ($num > 0) or securiti limitation ($num < 0 or security leme name. With `reset` sets player limit to the one in the config file'), +('server restart',3,'Syntax: .server restart #delay\r\n\r\nRestart the server after #delay seconds. Use #exist_code or 2 as program exist code.'), +('server restart cancel',3,'Syntax: .server restart cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('server set closed',3,'Syntax: server set closed on/off\r\n\r\nSets whether the world accepts new client connectsions.'), +('server set loglevel',4,'Syntax: .server set loglevel #level\r\n\r\nSet server log level (0 - errors only, 1 - basic, 2 - detail, 3 - debug).'), +('server set motd',3,'Syntax: .server set motd $MOTD\r\n\r\nSet server Message of the day.'), +('server shutdown',3,'Syntax: .server shutdown #delay [#exit_code]\r\n\r\nShut the server down after #delay seconds. Use #exit_code or 0 as program exit code.'), +('server shutdown cancel',3,'Syntax: .server shutdown cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('setskill',3,'Syntax: .setskill #skill #level [#max]\r\n\r\nSet a skill of id #skill with a current skill value of #level and a maximum value of #max (or equal current maximum if not provide) for the selected character. If no character is selected, you learn the skill.'), +('showarea',3,'Syntax: .showarea #areaid\r\n\r\nReveal the area of #areaid to the selected character. If no character is selected, reveal this area to you.'), +('start',0,'Syntax: .start\r\n\r\nTeleport you to the starting area of your character.'), +('taxicheat',1,'Syntax: .taxicheat on/off\r\n\r\nTemporary grant access or remove to all taxi routes for the selected character. If no character is selected, hide or reveal all routes to you.\r\n\r\nVisited taxi nodes sill accessible after removing access.'), +('tele',1,'Syntax: .tele #location\r\n\r\nTeleport player to a given location.'), +('tele add',3,'Syntax: .tele add $name\r\n\r\nAdd current your position to .tele command target locations list with name $name.'), +('tele del',3,'Syntax: .tele del $name\r\n\r\nRemove location with name $name for .tele command locations list.'), +('tele group',1,'Syntax: .tele group#location\r\n\r\nTeleport a selected player and his group members to a given location.'), +('tele name',1,'Syntax: .tele name [#playername] #location\r\n\r\nTeleport the given character to a given location. Character can be offline.'), +('ticket',1,'Syntax: .ticket $subcommand\nType .ticket to see the list of possible subcommands or .help ticket $subcommand to see info on subcommands'), +('ticket assign',1,'Usage: .ticket assign $ticketid $gmname.\r\nAssigns the specified ticket to the specified Game Master.'), +('ticket close',1,'Usage: .ticket close $ticketid.\r\nCloses the specified ticket. Does not delete permanently.'), +('ticket closedlist',1,'Displays a list of closed GM tickets.'), +('ticket comment',1,'Usage: .ticket comment $ticketid $comment.\r\nAllows the adding or modifying of a comment to the specified ticket.'), +('ticket delete',3,'Usage: .ticket delete $ticketid.\r\nDeletes the specified ticket permanently. Ticket must be closed first.'), +('ticket list',1,'Displays a list of open GM tickets.'), +('ticket onlinelist',1,'Displays a list of open GM tickets whose owner is online.'), +('ticket unassign',1,'Usage: .ticket unassign $ticketid.\r\nUnassigns the specified ticket from the current assigned Game Master.'), +('ticket viewid',1,'Usage: .ticket viewid $ticketid.\r\nReturns details about specified ticket. Ticket must be open and not deleted.'), +('ticket viewname',1,'Usage: .ticket viewname $creatorname. \r\nReturns details about specified ticket. Ticket must be open and not deleted.'), +('titles add',2,'Syntax: .titles add #title\r\nAdd title #title (id or shift-link) to known titles list for selected player.'), +('titles current',2,'Syntax: .titles current #title\r\nSet title #title (id or shift-link) as current selected titl for selected player. If title not in known title list for player then it will be added to list.'), +('titles remove',2,'Syntax: .titles remove #title\r\nRemove title #title (id or shift-link) from known titles list for selected player.'), +('titles setmask',2,'Syntax: .titles setmask #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'), +('unaura',3,'Syntax: .unaura #spellid\r\n\r\nRemove aura due to spell #spellid from the selected Unit.'), +('unban',3,'Syntax: .unban $subcommand\nType .unban to see the list of possible subcommands or .help unban $subcommand to see info on subcommands'), +('unban account',3,'Syntax: .unban account $Name\r\nUnban accounts for account name pattern.'), +('unban character',3,'Syntax: .unban character $Name\r\nUnban accounts for character name pattern.'), +('unban ip',3,'Syntax : .unban ip $Ip\r\nUnban accounts for IP pattern.'), +('unbindsight',3,'Syntax: .unbindsight\r\n\r\nRemoves bound vision. Cannot be used while currently possessing a target.'), +('unfreeze',1,'Syntax: .unfreeze (#player)\r\n\"Unfreezes\" #player and enables his chat again. When using this without #name it will unfreeze your target.'), +('unlearn',3,'Syntax: .unlearn #spell [all]\r\n\r\nUnlearn for selected player a spell #spell. If ''all'' provided then all ranks unlearned.'), +('unmute',1,'Syntax: .unmute [$playerName]\r\n\r\nRestore chat messaging for any character from account of character $playerName (or selected). Character can be ofline.'), +('unpossess',3,'Syntax: .unpossess\r\n\r\nIf you are possessed, unpossesses yourself; otherwise unpossesses current possessed target.'), +('waterwalk',2,'Syntax: .waterwalk on/off\r\n\r\nSet on/off waterwalk state for selected player or self if no player selected.'), +('wchange',3,'Syntax: .wchange #weathertype #status\r\n\r\nSet current weather to #weathertype with an intensity of #status.\r\n\r\n#weathertype can be 1 for rain, 2 for snow, and 3 for sand. #status can be 0 for disabled, and 1 for enabled.'), +('whispers',1,'Syntax: .whispers on|off\r\nEnable/disable accepting whispers by GM from players. By default use trinityd.conf setting.'), +('wp event',2,'Syntax: .wp event $subcommand\nType .path event to see the list of possible subcommands or .help path event $subcommand to see info on subcommands.'), +('wp load',2,'Syntax: .wp load $pathid\nLoad pathid number for selected creature. Creature must have no waypoint data.'), +('wp show',2,'Syntax: .wp show $option\nOptions:\non $pathid (or selected creature with loaded path) - Show path\noff - Hide path\ninfo $slected_waypoint - Show info for selected waypoint.'), +('wp unload',2,'Syntax: .wp unload\nUnload path for selected creature.'); +/*!40000 ALTER TABLE `command` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for `conditions` +-- + +CREATE TABLE `conditions` ( + `SourceTypeOrReferenceId` mediumint(8) NOT NULL DEFAULT '0', + `SourceGroup` mediumint(8) unsigned NOT NULL DEFAULT '0', + `SourceEntry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ElseGroup` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ConditionTypeOrReference` mediumint(8) NOT NULL DEFAULT '0', + `ConditionValue1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ConditionValue2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ConditionValue3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ErrorTextId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Comment` varchar(255) DEFAULT NULL, + PRIMARY KEY (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Condition System'; + +-- +-- Dumping data for table `creature` +-- + +LOCK TABLES `conditions` WRITE; +/*!40000 ALTER TABLE `conditions` DISABLE KEYS */; +/*!40000 ALTER TABLE `conditions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature` +-- + +DROP TABLE IF EXISTS `creature`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature` ( + `guid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Global Unique Identifier', + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Creature Identifier', + `map` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Map Identifier', + `spawnMask` tinyint(3) unsigned NOT NULL DEFAULT '1', + `phaseMask` smallint(5) unsigned NOT NULL DEFAULT '1', + `modelid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `equipment_id` mediumint(9) NOT NULL DEFAULT '0', + `position_x` float NOT NULL DEFAULT '0', + `position_y` float NOT NULL DEFAULT '0', + `position_z` float NOT NULL DEFAULT '0', + `orientation` float NOT NULL DEFAULT '0', + `spawntimesecs` int(10) unsigned NOT NULL DEFAULT '120', + `spawndist` float NOT NULL DEFAULT '0', + `currentwaypoint` mediumint(8) unsigned NOT NULL DEFAULT '0', + `curhealth` int(10) unsigned NOT NULL DEFAULT '1', + `curmana` int(10) unsigned NOT NULL DEFAULT '0', + `DeathState` tinyint(3) unsigned NOT NULL DEFAULT '0', + `MovementType` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`), + KEY `idx_map` (`map`), + KEY `idx_id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Creature System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +ALTER TABLE `creature` AUTO_INCREMENT=250001; + +-- +-- Dumping data for table `creature` +-- + +LOCK TABLES `creature` WRITE; +/*!40000 ALTER TABLE `creature` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_addon` +-- + +DROP TABLE IF EXISTS `creature_addon`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_addon` ( + `guid` int(10) unsigned NOT NULL DEFAULT '0', + `path_id` int(11) unsigned NOT NULL DEFAULT '0', + `mount` mediumint(8) unsigned NOT NULL DEFAULT '0', + `bytes1` int(10) unsigned NOT NULL DEFAULT '0', + `bytes2` int(10) unsigned NOT NULL DEFAULT '0', + `emote` int(10) unsigned NOT NULL DEFAULT '0', + `auras` text, + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_addon` +-- + +LOCK TABLES `creature_addon` WRITE; +/*!40000 ALTER TABLE `creature_addon` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_addon` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_ai_scripts` +-- + +DROP TABLE IF EXISTS `creature_ai_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_ai_scripts` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', + `creature_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Creature Template Identifier', + `event_type` tinyint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Event Type', + `event_inverse_phase_mask` int(11) NOT NULL DEFAULT '0' COMMENT 'Mask which phases this event will not trigger in', + `event_chance` int(3) unsigned NOT NULL DEFAULT '100', + `event_flags` int(3) unsigned NOT NULL DEFAULT '0', + `event_param1` int(11) NOT NULL DEFAULT '0', + `event_param2` int(11) NOT NULL DEFAULT '0', + `event_param3` int(11) NOT NULL DEFAULT '0', + `event_param4` int(11) NOT NULL DEFAULT '0', + `action1_type` tinyint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Action Type', + `action1_param1` int(11) NOT NULL DEFAULT '0', + `action1_param2` int(11) NOT NULL DEFAULT '0', + `action1_param3` int(11) NOT NULL DEFAULT '0', + `action2_type` tinyint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Action Type', + `action2_param1` int(11) NOT NULL DEFAULT '0', + `action2_param2` int(11) NOT NULL DEFAULT '0', + `action2_param3` int(11) NOT NULL DEFAULT '0', + `action3_type` tinyint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Action Type', + `action3_param1` int(11) NOT NULL DEFAULT '0', + `action3_param2` int(11) NOT NULL DEFAULT '0', + `action3_param3` int(11) NOT NULL DEFAULT '0', + `comment` varchar(255) NOT NULL DEFAULT '' COMMENT 'Event Comment', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_ai_scripts` +-- + +LOCK TABLES `creature_ai_scripts` WRITE; +/*!40000 ALTER TABLE `creature_ai_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_ai_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_ai_summons` +-- + +DROP TABLE IF EXISTS `creature_ai_summons`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_ai_summons` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Location Identifier', + `position_x` float NOT NULL DEFAULT '0', + `position_y` float NOT NULL DEFAULT '0', + `position_z` float NOT NULL DEFAULT '0', + `orientation` float NOT NULL DEFAULT '0', + `spawntimesecs` int(11) unsigned NOT NULL DEFAULT '120', + `comment` varchar(255) NOT NULL DEFAULT '' COMMENT 'Summon Comment', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_ai_summons` +-- + +LOCK TABLES `creature_ai_summons` WRITE; +/*!40000 ALTER TABLE `creature_ai_summons` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_ai_summons` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_ai_texts` +-- + +DROP TABLE IF EXISTS `creature_ai_texts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_ai_texts` ( + `entry` mediumint(8) NOT NULL, + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + `sound` mediumint(8) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `language` tinyint(3) unsigned NOT NULL DEFAULT '0', + `emote` smallint(5) unsigned NOT NULL DEFAULT '0', + `comment` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_ai_texts` +-- + +LOCK TABLES `creature_ai_texts` WRITE; +/*!40000 ALTER TABLE `creature_ai_texts` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_ai_texts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_classlevelstats` +-- + +DROP TABLE IF EXISTS `creature_classlevelstats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_classlevelstats` ( + `level` tinyint(1) NOT NULL, + `class` tinyint(1) NOT NULL, + `basehp0` smallint(2) NOT NULL, + `basehp1` smallint(2) NOT NULL, + `basehp2` smallint(2) NOT NULL, + `basemana` smallint(2) NOT NULL, + `basearmor` smallint(2) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_classlevelstats`; +-- + +LOCK TABLES `creature_classlevelstats` WRITE; +/*!40000 ALTER TABLE `creature_classlevelstats` DISABLE KEYS */; +INSERT INTO `creature_classlevelstats` (`class`,`level`,`basehp0`,`basehp1`,`basehp2`,`basemana`,`basearmor`) VALUES +(1,1,42,1,1,0,8), +(1,2,55,1,1,0,20), +(1,3,71,1,1,0,33), +(1,4,86,1,1,0,68), +(1,5,102,1,1,0,111), +(1,6,120,1,1,0,165), +(1,7,137,1,1,0,230), +(1,8,156,1,1,0,306), +(1,9,176,1,1,0,387), +(1,10,198,1,1,0,463), +(1,11,222,1,1,0,528), +(1,12,247,1,1,0,562), +(1,13,273,1,1,0,596), +(1,14,300,1,1,0,630), +(1,15,328,1,1,0,665), +(1,16,356,1,1,0,700), +(1,17,386,1,1,0,734), +(1,18,417,1,1,0,768), +(1,19,449,1,1,0,802), +(1,20,484,1,1,0,836), +(1,21,521,1,1,0,872), +(1,22,562,1,1,0,906), +(1,23,605,1,1,0,940), +(1,24,651,1,1,0,975), +(1,25,699,1,1,0,1008), +(1,26,750,1,1,0,1043), +(1,27,800,1,1,0,1078), +(1,28,853,1,1,0,1111), +(1,29,905,1,1,0,1145), +(1,30,955,1,1,0,1179), +(1,31,1006,1,1,0,1213), +(1,32,1057,1,1,0,1249), +(1,33,1110,1,1,0,1281), +(1,34,1163,1,1,0,1317), +(1,35,1220,1,1,0,1349), +(1,36,1277,1,1,0,1456), +(1,37,1336,1,1,0,1568), +(1,38,1395,1,1,0,1684), +(1,39,1459,1,1,0,1808), +(1,40,1524,1,1,0,1938), +(1,41,1585,1,1,0,2074), +(1,42,1651,1,1,0,2218), +(1,43,1716,1,1,0,2369), +(1,44,1782,1,1,0,2528), +(1,45,1848,1,1,0,2695), +(1,46,1919,1,1,0,2750), +(1,47,1990,1,1,0,2804), +(1,48,2062,1,1,0,2857), +(1,49,2138,1,1,0,2912), +(1,50,2215,1,1,0,2966), +(1,51,2292,1,1,0,3018), +(1,52,2371,1,1,0,3060), +(1,53,2453,1,1,0,3128), +(1,54,2533,1,1,0,3180), +(1,55,2614,1,1,0,3234), +(1,56,2699,1,1,0,3289), +(1,57,2784,1,1,0,3342), +(1,58,2871,3989,1,0,3396), +(1,59,2961,4142,1,0,3449), +(1,60,3052,4979,1,0,3750), +(1,61,3144,5158,1,0,4047), +(1,62,3237,5341,1,0,4344), +(1,63,3331,5527,1,0,4641), +(1,64,3427,5715,1,0,4937), +(1,65,3524,5914,1,0,5234), +(1,66,3624,6116,1,0,5531), +(1,67,3728,6326,1,0,5829), +(1,68,3834,6542,6986,0,6126), +(1,69,3942,6761,7984,0,6423), +(1,70,4050,6986,8982,0,6719), +(1,71,4163,7181,9291,0,7018), +(1,72,4278,7380,9610,0,7318), +(1,73,4399,7588,9940,0,7618), +(1,74,4524,7804,10282,0,7918), +(1,75,4652,8025,10635,0,8219), +(1,76,4781,8247,11001,0,8520), +(1,77,4916,8480,11379,0,8822), +(1,78,5052,8715,11770,0,9124), +(1,79,5194,8960,12175,0,9426), +(1,80,5342,9215,12600,0,9729), +(1,81,5492,9474,13033,0,10033), +(1,82,5647,1,13481,0,10356), +(1,83,5808,1,13945,0,10673), +(1,84,1,1,1,0,1), +(1,85,1,1,1,0,1), +(1,86,1,1,1,0,1), +(1,87,1,1,1,0,1), +(1,88,1,1,1,0,1), +(1,89,1,1,1,0,1), +(1,90,1,1,1,0,1), +(1,91,1,1,1,0,1), +(1,92,1,1,1,0,1), +(1,93,1,1,1,0,1), +(1,94,1,1,1,0,1), +(1,95,1,1,1,0,1), +(1,96,1,1,1,0,1), +(1,97,1,1,1,0,1), +(1,98,1,1,1,0,1), +(1,99,1,1,1,0,1), +(1,100,1,1,1,0,1), +(2,1,41,1,1,60,7), +(2,2,54,1,1,69,19), +(2,3,69,1,1,79,33), +(2,4,83,1,1,104,66), +(2,5,98,1,1,115,109), +(2,6,115,1,1,126,163), +(2,7,131,1,1,138,208), +(2,8,148,1,1,165,303), +(2,9,166,1,1,178,369), +(2,10,186,1,1,191,460), +(2,11,208,1,1,205,526), +(2,12,230,1,1,249,560), +(2,13,253,1,1,264,596), +(2,14,276,1,1,295,630), +(2,15,301,1,1,326,665), +(2,16,325,1,1,357,700), +(2,17,350,1,1,390,734), +(2,18,377,1,1,408,768), +(2,19,404,1,1,456,802), +(2,20,433,1,1,490,836), +(2,21,464,1,1,510,872), +(2,22,498,1,1,545,906), +(2,23,533,1,1,581,940), +(2,24,571,1,1,618,975), +(2,25,610,1,1,655,1008), +(2,26,651,1,1,693,1042), +(2,27,690,1,1,732,1078), +(2,28,732,1,1,756,1110), +(2,29,773,1,1,811,1145), +(2,30,811,1,1,852,1178), +(2,31,850,1,1,878,1213), +(2,32,888,1,1,935,1248), +(2,33,928,1,1,963,1281), +(2,34,967,1,1,1007,1316), +(2,35,1009,1,1,1067,1349), +(2,36,1050,1,1,1097,1455), +(2,37,1093,1,1,1142,1567), +(2,38,1135,1,1,1189,1683), +(2,39,1180,1,1,1236,1807), +(2,40,1226,1,1,1283,1937), +(2,41,1268,1,1,1332,2072), +(2,42,1321,1,1,1381,2216), +(2,43,1373,1,1,1432,2367), +(2,44,1426,1,1,1483,2527), +(2,45,1478,1,1,1534,2692), +(2,46,1535,1,1,1587,2749), +(2,47,1592,1,1,1640,2802), +(2,48,1650,1,1,1695,2855), +(2,49,1710,1,1,1750,2910), +(2,50,1772,1,1,1807,2964), +(2,51,1834,1,1,1864,3017), +(2,52,1897,1,1,1923,3072), +(2,53,1962,1,1,1982,3126), +(2,54,2026,1,1,2041,3178), +(2,55,2091,1,1,2117,3232), +(2,56,2159,1,1,2163,3287), +(2,57,2227,1,1,2241,3340), +(2,58,2297,3191,1,2289,3394), +(2,59,2369,3314,1,2369,3447), +(2,60,2442,3984,1,2434,3748), +(2,61,2515,4126,1,2486,4044), +(2,62,2590,4274,1,2568,4340), +(2,63,2665,4422,1,2620,4637), +(2,64,2740,4572,1,2705,4933), +(2,65,2819,4731,1,2790,5228), +(2,66,2899,4892,6116,2846,5523), +(2,67,2982,5060,1,2933,5821), +(2,68,3067,5233,6986,2991,6116), +(2,69,3153,5409,7984,3080,6412), +(2,70,3240,5589,8982,3155,6708), +(2,71,3330,5744,9291,3231,7007), +(2,72,3422,5903,9610,3309,7305), +(2,73,3519,6070,9940,3387,7604), +(2,74,3619,6243,10282,3466,7903), +(2,75,3722,6420,10635,3561,8204), +(2,76,3825,6602,11001,3643,8503), +(2,77,3933,6784,11379,3725,8803), +(2,78,4042,6972,11770,3809,9104), +(2,79,4155,7167,12175,3893,9405), +(2,80,4274,7373,12600,3994,9706), +(2,81,4394,7581,13033,4081,10007), +(2,82,4518,7794,13481,4169,10253), +(2,83,4646,1,13945,4258,10573), +(2,84,1,1,1,1,1), +(2,85,1,1,1,1,1), +(2,86,1,1,1,1,1), +(2,87,1,1,1,1,1), +(2,88,1,1,1,1,1), +(2,89,1,1,1,1,1), +(2,90,1,1,1,1,1), +(2,91,1,1,1,1,1), +(2,92,1,1,1,1,1), +(2,93,1,1,1,1,1), +(2,94,1,1,1,1,1), +(2,95,1,1,1,1,1), +(2,96,1,1,1,1,1), +(2,97,1,1,1,1,1), +(2,98,1,1,1,1,1), +(2,99,1,1,1,1,1), +(2,100,1,1,1,1,1), +(4,1,42,1,1,0,6), +(4,2,55,1,1,0,18), +(4,3,71,1,1,0,31), +(4,4,86,1,1,0,63), +(4,5,102,1,1,0,102), +(4,6,120,1,1,0,152), +(4,7,137,1,1,0,212), +(4,8,156,1,1,0,286), +(4,9,176,1,1,0,363), +(4,10,198,1,1,0,443), +(4,11,222,1,1,0,488), +(4,12,247,1,1,0,519), +(4,13,273,1,1,0,553), +(4,14,300,1,1,0,577), +(4,15,328,1,1,0,612), +(4,16,356,1,1,0,645), +(4,17,386,1,1,0,676), +(4,18,417,1,1,0,706), +(4,19,449,1,1,0,738), +(4,20,484,1,1,0,769), +(4,21,521,1,1,0,801), +(4,22,562,1,1,0,833), +(4,23,605,1,1,0,863), +(4,24,651,1,1,0,895), +(4,25,699,1,1,0,926), +(4,26,750,1,1,0,957), +(4,27,800,1,1,0,989), +(4,28,853,1,1,0,1020), +(4,29,905,1,1,0,1051), +(4,30,955,1,1,0,1082), +(4,31,1006,1,1,0,1113), +(4,32,1057,1,1,0,1146), +(4,33,1110,1,1,0,1173), +(4,34,1163,1,1,0,1208), +(4,35,1220,1,1,0,1237), +(4,36,1277,1,1,0,1349), +(4,37,1336,1,1,0,1434), +(4,38,1395,1,1,0,1538), +(4,39,1459,1,1,0,1649), +(4,40,1524,1,1,0,1764), +(4,41,1585,1,1,0,1886), +(4,42,1651,1,1,0,2015), +(4,43,1716,1,1,0,2148), +(4,44,1782,1,1,0,2303), +(4,45,1848,1,1,0,2436), +(4,46,1919,1,1,0,2485), +(4,47,1990,1,1,0,2535), +(4,48,2062,1,1,0,2582), +(4,49,2138,1,1,0,2631), +(4,50,2215,1,1,0,2680), +(4,51,2292,1,1,0,2728), +(4,52,2371,1,1,0,2778), +(4,53,2453,1,1,0,2826), +(4,54,2533,1,1,0,2874), +(4,55,2614,1,1,0,2922), +(4,56,2699,1,1,0,2972), +(4,57,2784,1,1,0,3020), +(4,58,2871,3989,1,0,3068), +(4,59,2961,4142,1,0,3117), +(4,60,3052,4979,1,0,3388), +(4,61,3144,5158,1,0,3655), +(4,62,3237,5341,1,0,3922), +(4,63,3331,5527,1,0,4189), +(4,64,3427,5715,1,0,4457), +(4,65,3524,5914,1,0,4724), +(4,66,3624,6116,1,0,5104), +(4,67,3728,6326,1,0,5326), +(4,68,3834,6542,6986,0,5527), +(4,69,3942,6761,7984,0,5795), +(4,70,4050,6986,8982,0,6062), +(4,71,4163,7181,9291,0,6332), +(4,72,4278,7380,9610,0,6602), +(4,73,4399,7580,9940,0,6872), +(4,74,4524,1,10282,0,7143), +(4,75,4652,1,10635,0,7415), +(4,76,4781,1,11001,0,7686), +(4,77,4916,1,11379,0,7958), +(4,78,5052,1,11770,0,8230), +(4,79,5194,1,12175,0,8503), +(4,80,5342,1,12600,0,8776), +(4,81,5496,1,13033,0,9068), +(4,82,5647,1,13481,0,9348), +(4,83,5808,1,13945,0,9589), +(4,84,1,1,1,0,1), +(4,85,1,1,1,0,1), +(4,86,1,1,1,0,1), +(4,87,1,1,1,0,1), +(4,88,1,1,1,0,1), +(4,89,1,1,1,0,1), +(4,90,1,1,1,0,1), +(4,91,1,1,1,0,1), +(4,92,1,1,1,0,1), +(4,93,1,1,1,0,1), +(4,94,1,1,1,0,1), +(4,95,1,1,1,0,1), +(4,96,1,1,1,0,1), +(4,97,1,1,1,0,1), +(4,98,1,1,1,0,1), +(4,99,1,1,1,0,1), +(4,100,1,1,1,0,1), +(8,1,40,1,1,120,5), +(8,2,52,1,1,147,16), +(8,3,67,1,1,174,28), +(8,4,81,1,1,202,57), +(8,5,95,1,1,230,93), +(8,6,111,1,1,259,139), +(8,7,126,1,1,289,194), +(8,8,143,1,1,319,265), +(8,9,160,1,1,350,339), +(8,10,178,1,1,382,423), +(8,11,199,1,1,459,447), +(8,12,219,1,1,537,475), +(8,13,241,1,1,601,509), +(8,14,263,1,1,710,523), +(8,15,285,1,1,790,559), +(8,16,307,1,1,856,589), +(8,17,330,1,1,938,617), +(8,18,354,1,1,1020,643), +(8,19,379,1,1,1118,674), +(8,20,405,1,1,1202,701), +(8,21,432,1,1,1272,729), +(8,22,463,1,1,1357,759), +(8,23,494,1,1,1443,786), +(8,24,528,1,1,1545,815), +(8,25,562,1,1,1633,843), +(8,26,598,1,1,1707,871), +(8,27,633,1,1,1812,900), +(8,28,669,1,1,1977,928), +(8,29,704,1,1,2068,957), +(8,30,737,1,1,2175,984), +(8,31,770,1,1,2253,1012), +(8,32,802,1,1,2362,1042), +(8,33,835,1,1,2457,1065), +(8,34,867,1,1,2553,1098), +(8,35,902,1,1,2680,1124), +(8,36,935,1,1,2763,1241), +(8,37,970,1,1,2861,1300), +(8,38,1004,1,1,2975,1391), +(8,39,1040,1,1,3075,1489), +(8,40,1077,1,1,3191,1590), +(8,41,1110,1,1,3293,1697), +(8,42,1156,1,1,3471,1811), +(8,43,1201,1,1,3575,1926), +(8,44,1247,1,1,3680,2078), +(8,45,1294,1,1,3801,2177), +(8,46,1343,1,1,3923,2220), +(8,47,1393,1,1,4031,2265), +(8,48,1443,1,1,4140,2307), +(8,49,1497,1,1,4281,2349), +(8,50,1551,1,1,4393,2393), +(8,51,1604,1,1,4506,2437), +(8,52,1660,1,1,4650,2481), +(8,53,1717,1,1,4765,2524), +(8,54,1773,1,1,4896,2567), +(8,55,1830,1,1,5013,2609), +(8,56,1889,1,1,5206,2654), +(8,57,1949,1,1,5340,2698), +(8,58,2010,2793,1,5461,2740), +(8,59,2073,2899,1,5598,2784), +(8,60,2136,3484,1,5751,3025), +(8,61,2201,3611,1,5875,3263), +(8,62,2266,3739,1,6015,3500), +(8,63,2332,3870,1,6156,3736), +(8,64,2399,4000,1,6229,3977), +(8,65,2467,4140,4731,6443,4214), +(8,66,2552,4281,4892,6588,4460), +(8,67,2610,4429,1,6749,4710), +(8,68,2684,4580,5588,6882,4928), +(8,69,2759,4733,6387,7031,5167), +(8,70,2835,4890,7185,7196,5404), +(8,71,2914,5027,7432,7332,5645), +(8,72,2995,5166,7688,7500,5886), +(8,73,3098,5311,7952,7654,6126), +(8,74,3186,1,8225,7809,6368), +(8,75,3256,5617,8508,7981,6610), +(8,76,3367,1,8800,8139,6851), +(8,77,3462,1,9103,8313,7094), +(8,78,3558,1,9416,8459,7335), +(8,79,3658,1,9740,8636,7579), +(8,80,3739,1,10080,8814,7822), +(8,81,3870,1,10486,8979,8102), +(8,82,3977,1,10784,9160,8340), +(8,83,4090,1,11156,9325,8505), +(8,84,1,1,1,1,1), +(8,85,1,1,1,1,1), +(8,86,1,1,1,1,1), +(8,87,1,1,1,1,1), +(8,88,1,1,1,1,1), +(8,89,1,1,1,1,1), +(8,90,1,1,1,1,1), +(8,91,1,1,1,1,1), +(8,92,1,1,1,1,1), +(8,93,1,1,1,1,1), +(8,94,1,1,1,1,1), +(8,95,1,1,1,1,1), +(8,96,1,1,1,1,1), +(8,97,1,1,1,1,1), +(8,98,1,1,1,1,1), +(8,99,1,1,1,1,1), +(8,100,1,1,1,1,1); +/*!40000 ALTER TABLE `creature_classlevelstats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_equip_template` +-- + +DROP TABLE IF EXISTS `creature_equip_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_equip_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Unique entry', + `equipentry1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `equipentry2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `equipentry3` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Creature System (Equipment)'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_equip_template` +-- + +LOCK TABLES `creature_equip_template` WRITE; +/*!40000 ALTER TABLE `creature_equip_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_equip_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_formations` +-- + +DROP TABLE IF EXISTS `creature_formations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_formations` ( + `leaderGUID` int(11) unsigned NOT NULL, + `memberGUID` int(11) unsigned NOT NULL, + `dist` float unsigned NOT NULL, + `angle` float unsigned NOT NULL, + `groupAI` int(11) unsigned NOT NULL, + PRIMARY KEY (`memberGUID`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_formations` +-- + +LOCK TABLES `creature_formations` WRITE; +/*!40000 ALTER TABLE `creature_formations` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_formations` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_involvedrelation` +-- + +DROP TABLE IF EXISTS `creature_involvedrelation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_involvedrelation` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Identifier', + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Quest Identifier', + PRIMARY KEY (`id`,`quest`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Creature System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_involvedrelation` +-- + +LOCK TABLES `creature_involvedrelation` WRITE; +/*!40000 ALTER TABLE `creature_involvedrelation` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_involvedrelation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_linked_respawn` +-- + +DROP TABLE IF EXISTS `creature_linked_respawn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_linked_respawn` ( + `guid` int(10) unsigned NOT NULL COMMENT 'dependent creature', + `linkedGuid` int(10) unsigned NOT NULL COMMENT 'master creature', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Creature Respawn Link System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_linked_respawn` +-- + +LOCK TABLES `creature_linked_respawn` WRITE; +/*!40000 ALTER TABLE `creature_linked_respawn` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_linked_respawn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_loot_template` +-- + +DROP TABLE IF EXISTS `creature_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_loot_template` +-- + +LOCK TABLES `creature_loot_template` WRITE; +/*!40000 ALTER TABLE `creature_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_model_info` +-- + +DROP TABLE IF EXISTS `creature_model_info`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_model_info` ( + `modelid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `bounding_radius` float NOT NULL DEFAULT '0', + `combat_reach` float NOT NULL DEFAULT '0', + `gender` tinyint(3) unsigned NOT NULL DEFAULT '2', + `modelid_other_gender` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`modelid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Creature System (Model related info)'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_model_info` +-- + +LOCK TABLES `creature_model_info` WRITE; +/*!40000 ALTER TABLE `creature_model_info` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_model_info` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_onkill_reputation` +-- + +DROP TABLE IF EXISTS `creature_onkill_reputation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_onkill_reputation` ( + `creature_id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Creature Identifier', + `RewOnKillRepFaction1` smallint(6) NOT NULL DEFAULT '0', + `RewOnKillRepFaction2` smallint(6) NOT NULL DEFAULT '0', + `MaxStanding1` tinyint(4) NOT NULL DEFAULT '0', + `IsTeamAward1` tinyint(4) NOT NULL DEFAULT '0', + `RewOnKillRepValue1` mediumint(9) NOT NULL DEFAULT '0', + `MaxStanding2` tinyint(4) NOT NULL DEFAULT '0', + `IsTeamAward2` tinyint(4) NOT NULL DEFAULT '0', + `RewOnKillRepValue2` mediumint(9) NOT NULL DEFAULT '0', + `TeamDependent` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`creature_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Creature OnKill Reputation gain'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_onkill_reputation` +-- + +LOCK TABLES `creature_onkill_reputation` WRITE; +/*!40000 ALTER TABLE `creature_onkill_reputation` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_onkill_reputation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_questrelation` +-- + +DROP TABLE IF EXISTS `creature_questrelation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_questrelation` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Identifier', + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Quest Identifier', + PRIMARY KEY (`id`,`quest`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Creature System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_questrelation` +-- + +LOCK TABLES `creature_questrelation` WRITE; +/*!40000 ALTER TABLE `creature_questrelation` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_questrelation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_respawn` +-- + +DROP TABLE IF EXISTS `creature_respawn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_respawn` ( + `guid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier', + `respawntime` bigint(20) NOT NULL DEFAULT '0', + `instance` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`,`instance`), + KEY `instance` (`instance`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Grid Loading System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_respawn` +-- + +LOCK TABLES `creature_respawn` WRITE; +/*!40000 ALTER TABLE `creature_respawn` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_respawn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_template` +-- + +DROP TABLE IF EXISTS `creature_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `difficulty_entry_1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `difficulty_entry_2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `difficulty_entry_3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `KillCredit1` int(11) unsigned NOT NULL DEFAULT '0', + `KillCredit2` int(11) unsigned NOT NULL DEFAULT '0', + `modelid1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `modelid2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `modelid3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `modelid4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name` char(100) NOT NULL DEFAULT '0', + `subname` char(100) DEFAULT NULL, + `IconName` char(100) DEFAULT NULL, + `gossip_menu_id` mediumint(8) unsigned NOT NULL default '0', + `minlevel` tinyint(3) unsigned NOT NULL DEFAULT '1', + `maxlevel` tinyint(3) unsigned NOT NULL DEFAULT '1', + `exp` smallint(2) NOT NULL DEFAULT '0', + `faction_A` smallint(5) unsigned NOT NULL DEFAULT '0', + `faction_H` smallint(5) unsigned NOT NULL DEFAULT '0', + `npcflag` int(10) unsigned NOT NULL DEFAULT '0', + `speed_walk` float NOT NULL default '1' COMMENT 'Result of 2.5/2.5, most common value', + `speed_run` float NOT NULL default '1.14286' COMMENT 'Result of 8.0/7.0, most common value', + `scale` float NOT NULL DEFAULT '1', + `rank` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mindmg` float NOT NULL DEFAULT '0', + `maxdmg` float NOT NULL DEFAULT '0', + `dmgschool` tinyint(4) NOT NULL DEFAULT '0', + `attackpower` int(10) unsigned NOT NULL DEFAULT '0', + `dmg_multiplier` float NOT NULL DEFAULT '1', + `baseattacktime` int(10) unsigned NOT NULL DEFAULT '0', + `rangeattacktime` int(10) unsigned NOT NULL DEFAULT '0', + `unit_class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `unit_flags` int(10) unsigned NOT NULL DEFAULT '0', + `dynamicflags` int(10) unsigned NOT NULL DEFAULT '0', + `family` tinyint(4) NOT NULL DEFAULT '0', + `trainer_type` tinyint(4) NOT NULL DEFAULT '0', + `trainer_spell` mediumint(8) unsigned NOT NULL DEFAULT '0', + `trainer_class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `trainer_race` tinyint(3) unsigned NOT NULL DEFAULT '0', + `minrangedmg` float NOT NULL DEFAULT '0', + `maxrangedmg` float NOT NULL DEFAULT '0', + `rangedattackpower` smallint(5) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `type_flags` int(10) unsigned NOT NULL DEFAULT '0', + `lootid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `pickpocketloot` mediumint(8) unsigned NOT NULL DEFAULT '0', + `skinloot` mediumint(8) unsigned NOT NULL DEFAULT '0', + `resistance1` smallint(5) NOT NULL DEFAULT '0', + `resistance2` smallint(5) NOT NULL DEFAULT '0', + `resistance3` smallint(5) NOT NULL DEFAULT '0', + `resistance4` smallint(5) NOT NULL DEFAULT '0', + `resistance5` smallint(5) NOT NULL DEFAULT '0', + `resistance6` smallint(5) NOT NULL DEFAULT '0', + `spell1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell5` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell6` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell7` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell8` mediumint(8) unsigned NOT NULL DEFAULT '0', + `PetSpellDataId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `VehicleId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `mingold` mediumint(8) unsigned NOT NULL DEFAULT '0', + `maxgold` mediumint(8) unsigned NOT NULL DEFAULT '0', + `AIName` char(64) NOT NULL DEFAULT '', + `MovementType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `InhabitType` tinyint(3) unsigned NOT NULL DEFAULT '3', + `Health_mod` float NOT NULL DEFAULT '1', + `Mana_mod` float NOT NULL DEFAULT '1', + `Armor_mod` float NOT NULL DEFAULT '1', + `RacialLeader` tinyint(3) unsigned NOT NULL DEFAULT '0', + `questItem1` int(11) unsigned NOT NULL DEFAULT '0', + `questItem2` int(11) unsigned NOT NULL DEFAULT '0', + `questItem3` int(11) unsigned NOT NULL DEFAULT '0', + `questItem4` int(11) unsigned NOT NULL DEFAULT '0', + `questItem5` int(11) unsigned NOT NULL DEFAULT '0', + `questItem6` int(11) unsigned NOT NULL DEFAULT '0', + `movementId` int(11) unsigned NOT NULL DEFAULT '0', + `RegenHealth` tinyint(3) unsigned NOT NULL DEFAULT '1', + `equipment_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `mechanic_immune_mask` int(10) unsigned NOT NULL DEFAULT '0', + `flags_extra` int(10) unsigned NOT NULL DEFAULT '0', + `ScriptName` char(64) NOT NULL DEFAULT '', + `WDBVerified` smallint(5) signed DEFAULT '1', + PRIMARY KEY (`entry`), + KEY `idx_name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Creature System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_template` +-- + +LOCK TABLES `creature_template` WRITE; +/*!40000 ALTER TABLE `creature_template` DISABLE KEYS */; +INSERT INTO `creature_template` (`entry`,`difficulty_entry_1`,`difficulty_entry_2`,`difficulty_entry_3`,`KillCredit1`,`KillCredit2`,`modelid1`,`modelid2`,`modelid3`,`modelid4`,`name`,`subname`,`IconName`,`gossip_menu_id`,`minlevel`,`maxlevel`,`exp`,`faction_A`,`faction_H`,`npcflag`,`speed_walk`,`scale`,`rank`,`mindmg`,`maxdmg`,`dmgschool`,`attackpower`,`dmg_multiplier`,`baseattacktime`,`rangeattacktime`,`unit_class`,`unit_flags`,`dynamicflags`,`family`,`trainer_type`,`trainer_spell`,`trainer_class`,`trainer_race`,`minrangedmg`,`maxrangedmg`,`rangedattackpower`,`type`,`type_flags`,`lootid`,`pickpocketloot`,`skinloot`,`resistance1`,`resistance2`,`resistance3`,`resistance4`,`resistance5`,`resistance6`,`spell1`,`spell2`,`spell3`,`spell4`,`spell5`,`spell6`,`spell7`,`spell8`,`PetSpellDataId`,`VehicleId`,`mingold`,`maxgold`,`AIName`,`MovementType`,`InhabitType`,`Health_mod`,`Mana_mod`,`Armor_mod`,`RacialLeader`,`questItem1`,`questItem2`,`questItem3`,`questItem4`,`questItem5`,`questItem6`,`movementId`,`RegenHealth`,`equipment_id`,`mechanic_immune_mask`,`flags_extra`,`ScriptName`) VALUES (1,0,0,0,0,0,10045,0,0,0,'Waypoint (Only GM can see it)','Visual',NULL,0,1,80,0,35,35,0,0.91,1,0,7,7,0,3,1,2000,2200,1,4096,0,0,0,0,0,0,1.76,2.42,100,8,5242886,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'',0,7,0.0125,1,1,0,0,0,0,0,0,0,0,1,0,0,130,''); +/*!40000 ALTER TABLE `creature_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `creature_template_addon` +-- + +DROP TABLE IF EXISTS `creature_template_addon`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `creature_template_addon` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `path_id` int(11) unsigned NOT NULL DEFAULT '0', + `mount` mediumint(8) unsigned NOT NULL DEFAULT '0', + `bytes1` int(10) unsigned NOT NULL DEFAULT '0', + `bytes2` int(10) unsigned NOT NULL DEFAULT '0', + `emote` mediumint(8) unsigned NOT NULL DEFAULT '0', + `auras` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `creature_template_addon` +-- + +LOCK TABLES `creature_template_addon` WRITE; +/*!40000 ALTER TABLE `creature_template_addon` DISABLE KEYS */; +/*!40000 ALTER TABLE `creature_template_addon` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `custom_texts` +-- + +DROP TABLE IF EXISTS `custom_texts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `custom_texts` ( + `entry` mediumint(8) NOT NULL, + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + `sound` mediumint(8) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `language` tinyint(3) unsigned NOT NULL DEFAULT '0', + `emote` smallint(5) unsigned NOT NULL DEFAULT '0', + `comment` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom Texts'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `custom_texts` +-- + +LOCK TABLES `custom_texts` WRITE; +/*!40000 ALTER TABLE `custom_texts` DISABLE KEYS */; +/*!40000 ALTER TABLE `custom_texts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `db_script_string` +-- + +DROP TABLE IF EXISTS `db_script_string`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `db_script_string` ( + `entry` int(11) unsigned NOT NULL DEFAULT '0', + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `db_script_string` +-- + +LOCK TABLES `db_script_string` WRITE; +/*!40000 ALTER TABLE `db_script_string` DISABLE KEYS */; +/*!40000 ALTER TABLE `db_script_string` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `disenchant_loot_template` +-- + +DROP TABLE IF EXISTS `disenchant_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `disenchant_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Recommended id selection: item_level*100 + item_quality', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `disenchant_loot_template` +-- + +LOCK TABLES `disenchant_loot_template` WRITE; +/*!40000 ALTER TABLE `disenchant_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `disenchant_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `event_scripts` +-- + +DROP TABLE IF EXISTS `event_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `event_scripts` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `delay` int(10) unsigned NOT NULL DEFAULT '0', + `command` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong2` int(10) unsigned NOT NULL DEFAULT '0', + `dataint` int(11) NOT NULL DEFAULT '0', + `x` float NOT NULL DEFAULT '0', + `y` float NOT NULL DEFAULT '0', + `z` float NOT NULL DEFAULT '0', + `o` float NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `event_scripts` +-- + +LOCK TABLES `event_scripts` WRITE; +/*!40000 ALTER TABLE `event_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `event_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `exploration_basexp` +-- + +DROP TABLE IF EXISTS `exploration_basexp`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `exploration_basexp` ( + `level` tinyint(4) unsigned NOT NULL DEFAULT '0', + `basexp` mediumint(9) NOT NULL DEFAULT '0', + PRIMARY KEY (`level`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Exploration System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `exploration_basexp` +-- + +LOCK TABLES `exploration_basexp` WRITE; +/*!40000 ALTER TABLE `exploration_basexp` DISABLE KEYS */; +INSERT INTO `exploration_basexp` VALUES (0,0),(1,5),(2,15),(3,25),(4,35),(5,45),(6,55),(7,65),(8,70),(9,80),(10,85),(11,90),(12,90),(13,90),(14,100),(15,105),(16,115),(17,125),(18,135),(19,145),(20,155),(21,165),(22,175),(23,185),(24,195),(25,200),(26,210),(27,220),(28,230),(29,240),(30,245),(31,250),(32,255),(33,265),(34,270),(35,275),(36,280),(37,285),(38,285),(39,300),(40,315),(41,330),(42,345),(43,360),(44,375),(45,390),(46,405),(47,420),(48,440),(49,455),(50,470),(51,490),(52,510),(53,530),(54,540),(55,560),(56,580),(57,600),(58,620),(59,640),(60,660),(61,970),(62,1000),(63,1050),(64,1080),(65,1100),(66,1130),(67,1160),(68,1200),(69,1230),(70,1300); +/*!40000 ALTER TABLE `exploration_basexp` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `fishing_loot_template` +-- + +DROP TABLE IF EXISTS `fishing_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fishing_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `fishing_loot_template` +-- + +LOCK TABLES `fishing_loot_template` WRITE; +/*!40000 ALTER TABLE `fishing_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `fishing_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event` +-- + +DROP TABLE IF EXISTS `game_event`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event` ( + `entry` mediumint(8) unsigned NOT NULL COMMENT 'Entry of the game event', + `start_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Absolute start date, the event will never start before', + `end_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Absolute end date, the event will never start afler', + `occurence` bigint(20) unsigned NOT NULL DEFAULT '5184000' COMMENT 'Delay in minutes between occurences of the event', + `length` bigint(20) unsigned NOT NULL DEFAULT '2592000' COMMENT 'Length in minutes of the event', + `holiday` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Client side holiday id', + `description` varchar(255) DEFAULT NULL COMMENT 'Description of the event displayed in console', + `world_event` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0 if normal event, 1 if world event', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event` +-- + +LOCK TABLES `game_event` WRITE; +/*!40000 ALTER TABLE `game_event` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_battleground_holiday` +-- + +DROP TABLE IF EXISTS `game_event_battleground_holiday`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_battleground_holiday` ( + `event` int(10) unsigned NOT NULL, + `bgflag` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`event`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_battleground_holiday` +-- + +LOCK TABLES `game_event_battleground_holiday` WRITE; +/*!40000 ALTER TABLE `game_event_battleground_holiday` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_battleground_holiday` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_condition` +-- + +DROP TABLE IF EXISTS `game_event_condition`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_condition` ( + `event_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `req_num` float DEFAULT '0', + `max_world_state_field` smallint(5) unsigned NOT NULL DEFAULT '0', + `done_world_state_field` smallint(5) unsigned NOT NULL DEFAULT '0', + `description` varchar(25) NOT NULL DEFAULT '', + PRIMARY KEY (`event_id`,`condition_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_condition` +-- + +LOCK TABLES `game_event_condition` WRITE; +/*!40000 ALTER TABLE `game_event_condition` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_condition` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_creature` +-- + +DROP TABLE IF EXISTS `game_event_creature`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_creature` ( + `guid` int(10) unsigned NOT NULL, + `event` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Put negatives values to remove during event', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_creature` +-- + +LOCK TABLES `game_event_creature` WRITE; +/*!40000 ALTER TABLE `game_event_creature` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_creature` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_creature_quest` +-- + +DROP TABLE IF EXISTS `game_event_creature_quest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_creature_quest` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0', + `event` smallint(5) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`,`quest`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_creature_quest` +-- + +LOCK TABLES `game_event_creature_quest` WRITE; +/*!40000 ALTER TABLE `game_event_creature_quest` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_creature_quest` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_gameobject` +-- + +DROP TABLE IF EXISTS `game_event_gameobject`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_gameobject` ( + `guid` int(10) unsigned NOT NULL, + `event` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Put negatives values to remove during event', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_gameobject` +-- + +LOCK TABLES `game_event_gameobject` WRITE; +/*!40000 ALTER TABLE `game_event_gameobject` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_gameobject` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_gameobject_quest` +-- + +DROP TABLE IF EXISTS `game_event_gameobject_quest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_gameobject_quest` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0', + `event` smallint(5) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`quest`,`event`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_gameobject_quest` +-- + +LOCK TABLES `game_event_gameobject_quest` WRITE; +/*!40000 ALTER TABLE `game_event_gameobject_quest` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_gameobject_quest` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_model_equip` +-- + +DROP TABLE IF EXISTS `game_event_model_equip`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_model_equip` ( + `guid` int(10) unsigned NOT NULL DEFAULT '0', + `modelid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `equipment_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `event` smallint(5) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_model_equip` +-- + +LOCK TABLES `game_event_model_equip` WRITE; +/*!40000 ALTER TABLE `game_event_model_equip` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_model_equip` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_npc_gossip` +-- + +DROP TABLE IF EXISTS `game_event_npc_gossip`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_npc_gossip` ( + `guid` int(10) unsigned NOT NULL, + `event_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `textid` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_npc_gossip` +-- + +LOCK TABLES `game_event_npc_gossip` WRITE; +/*!40000 ALTER TABLE `game_event_npc_gossip` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_npc_gossip` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_npc_vendor` +-- + +DROP TABLE IF EXISTS `game_event_npc_vendor`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_npc_vendor` ( + `event` mediumint(8) unsigned NOT NULL DEFAULT '0', + `guid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `slot` smallint(6) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) NOT NULL DEFAULT '0', + `maxcount` mediumint(8) unsigned NOT NULL DEFAULT '0', + `incrtime` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '', + PRIMARY KEY (`guid`,`item`), + INDEX (`slot`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_npc_vendor` +-- + +LOCK TABLES `game_event_npc_vendor` WRITE; +/*!40000 ALTER TABLE `game_event_npc_vendor` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_npc_vendor` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_npcflag` +-- + +DROP TABLE IF EXISTS `game_event_npcflag`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_npcflag` ( + `guid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `event_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `npcflag` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`,`event_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_npcflag` +-- + +LOCK TABLES `game_event_npcflag` WRITE; +/*!40000 ALTER TABLE `game_event_npcflag` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_npcflag` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_pool` +-- + +DROP TABLE IF EXISTS `game_event_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_pool` ( + `pool_entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Id of the pool', + `event` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Put negatives values to remove during event', + PRIMARY KEY (`pool_entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_pool` +-- + +LOCK TABLES `game_event_pool` WRITE; +/*!40000 ALTER TABLE `game_event_pool` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_prerequisite` +-- + +DROP TABLE IF EXISTS `game_event_prerequisite`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_prerequisite` ( + `event_id` mediumint(8) unsigned NOT NULL, + `prerequisite_event` mediumint(8) unsigned NOT NULL, + PRIMARY KEY (`event_id`,`prerequisite_event`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_prerequisite` +-- + +LOCK TABLES `game_event_prerequisite` WRITE; +/*!40000 ALTER TABLE `game_event_prerequisite` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_prerequisite` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_event_quest_condition` +-- + +DROP TABLE IF EXISTS `game_event_quest_condition`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_event_quest_condition` ( + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0', + `event_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `num` float DEFAULT '0', + PRIMARY KEY (`quest`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_event_quest_condition` +-- + +LOCK TABLES `game_event_quest_condition` WRITE; +/*!40000 ALTER TABLE `game_event_quest_condition` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_event_quest_condition` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_graveyard_zone` +-- + +DROP TABLE IF EXISTS `game_graveyard_zone`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_graveyard_zone` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ghost_zone` mediumint(8) unsigned NOT NULL DEFAULT '0', + `faction` smallint(5) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`,`ghost_zone`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Trigger System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_graveyard_zone` +-- + +LOCK TABLES `game_graveyard_zone` WRITE; +/*!40000 ALTER TABLE `game_graveyard_zone` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_graveyard_zone` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_tele` +-- + +DROP TABLE IF EXISTS `game_tele`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_tele` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `position_x` float NOT NULL DEFAULT '0', + `position_y` float NOT NULL DEFAULT '0', + `position_z` float NOT NULL DEFAULT '0', + `orientation` float NOT NULL DEFAULT '0', + `map` smallint(5) unsigned NOT NULL DEFAULT '0', + `name` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Tele Command'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_tele` +-- + +LOCK TABLES `game_tele` WRITE; +/*!40000 ALTER TABLE `game_tele` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_tele` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `game_weather` +-- + +DROP TABLE IF EXISTS `game_weather`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `game_weather` ( + `zone` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spring_rain_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `spring_snow_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `spring_storm_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `summer_rain_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `summer_snow_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `summer_storm_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `fall_rain_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `fall_snow_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `fall_storm_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `winter_rain_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `winter_snow_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + `winter_storm_chance` tinyint(3) unsigned NOT NULL DEFAULT '25', + PRIMARY KEY (`zone`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Weather System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `game_weather` +-- + +LOCK TABLES `game_weather` WRITE; +/*!40000 ALTER TABLE `game_weather` DISABLE KEYS */; +/*!40000 ALTER TABLE `game_weather` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gameobject` +-- + +DROP TABLE IF EXISTS `gameobject`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gameobject` ( + `guid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Global Unique Identifier', + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Gameobject Identifier', + `map` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Map Identifier', + `spawnMask` tinyint(3) unsigned NOT NULL DEFAULT '1', + `phaseMask` smallint(5) unsigned NOT NULL DEFAULT '1', + `position_x` float NOT NULL DEFAULT '0', + `position_y` float NOT NULL DEFAULT '0', + `position_z` float NOT NULL DEFAULT '0', + `orientation` float NOT NULL DEFAULT '0', + `rotation0` float NOT NULL DEFAULT '0', + `rotation1` float NOT NULL DEFAULT '0', + `rotation2` float NOT NULL DEFAULT '0', + `rotation3` float NOT NULL DEFAULT '0', + `spawntimesecs` int(11) NOT NULL DEFAULT '0', + `animprogress` tinyint(3) unsigned NOT NULL DEFAULT '0', + `state` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Gameobject System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +ALTER TABLE `gameobject` AUTO_INCREMENT=200001; + +-- +-- Dumping data for table `gameobject` +-- + +LOCK TABLES `gameobject` WRITE; +/*!40000 ALTER TABLE `gameobject` DISABLE KEYS */; +/*!40000 ALTER TABLE `gameobject` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gameobject_involvedrelation` +-- + +DROP TABLE IF EXISTS `gameobject_involvedrelation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gameobject_involvedrelation` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Quest Identifier', + PRIMARY KEY (`id`,`quest`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gameobject_involvedrelation` +-- + +LOCK TABLES `gameobject_involvedrelation` WRITE; +/*!40000 ALTER TABLE `gameobject_involvedrelation` DISABLE KEYS */; +/*!40000 ALTER TABLE `gameobject_involvedrelation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gameobject_loot_template` +-- + +DROP TABLE IF EXISTS `gameobject_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gameobject_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gameobject_loot_template` +-- + +LOCK TABLES `gameobject_loot_template` WRITE; +/*!40000 ALTER TABLE `gameobject_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `gameobject_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gameobject_questrelation` +-- + +DROP TABLE IF EXISTS `gameobject_questrelation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gameobject_questrelation` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Quest Identifier', + PRIMARY KEY (`id`,`quest`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gameobject_questrelation` +-- + +LOCK TABLES `gameobject_questrelation` WRITE; +/*!40000 ALTER TABLE `gameobject_questrelation` DISABLE KEYS */; +/*!40000 ALTER TABLE `gameobject_questrelation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gameobject_respawn` +-- + +DROP TABLE IF EXISTS `gameobject_respawn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gameobject_respawn` ( + `guid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier', + `respawntime` bigint(20) NOT NULL DEFAULT '0', + `instance` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`,`instance`), + KEY `instance` (`instance`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Grid Loading System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gameobject_respawn` +-- + +LOCK TABLES `gameobject_respawn` WRITE; +/*!40000 ALTER TABLE `gameobject_respawn` DISABLE KEYS */; +/*!40000 ALTER TABLE `gameobject_respawn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gameobject_scripts` +-- + +DROP TABLE IF EXISTS `gameobject_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gameobject_scripts` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `delay` int(10) unsigned NOT NULL DEFAULT '0', + `command` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong2` int(10) unsigned NOT NULL DEFAULT '0', + `dataint` int(11) NOT NULL DEFAULT '0', + `x` float NOT NULL DEFAULT '0', + `y` float NOT NULL DEFAULT '0', + `z` float NOT NULL DEFAULT '0', + `o` float NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gameobject_scripts` +-- + +LOCK TABLES `gameobject_scripts` WRITE; +/*!40000 ALTER TABLE `gameobject_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `gameobject_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gameobject_template` +-- + +DROP TABLE IF EXISTS `gameobject_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gameobject_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `displayId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name` varchar(100) NOT NULL DEFAULT '', + `IconName` varchar(100) NOT NULL DEFAULT '', + `castBarCaption` varchar(100) NOT NULL DEFAULT '', + `unk1` varchar(100) NOT NULL DEFAULT '', + `faction` smallint(5) unsigned NOT NULL DEFAULT '0', + `flags` int(10) unsigned NOT NULL DEFAULT '0', + `size` float NOT NULL DEFAULT '1', + `questItem1` int(11) unsigned NOT NULL DEFAULT '0', + `questItem2` int(11) unsigned NOT NULL DEFAULT '0', + `questItem3` int(11) unsigned NOT NULL DEFAULT '0', + `questItem4` int(11) unsigned NOT NULL DEFAULT '0', + `questItem5` int(11) unsigned NOT NULL DEFAULT '0', + `questItem6` int(11) unsigned NOT NULL DEFAULT '0', + `data0` int(10) unsigned NOT NULL DEFAULT '0', + `data1` int(11) signed NOT NULL DEFAULT '-1', + `data2` int(10) unsigned NOT NULL DEFAULT '0', + `data3` int(10) unsigned NOT NULL DEFAULT '0', + `data4` int(10) unsigned NOT NULL DEFAULT '0', + `data5` int(10) unsigned NOT NULL DEFAULT '0', + `data6` int(11) signed NOT NULL DEFAULT '-1', + `data7` int(10) unsigned NOT NULL DEFAULT '0', + `data8` int(10) unsigned NOT NULL DEFAULT '0', + `data9` int(10) unsigned NOT NULL DEFAULT '0', + `data10` int(10) unsigned NOT NULL DEFAULT '0', + `data11` int(10) unsigned NOT NULL DEFAULT '0', + `data12` int(10) unsigned NOT NULL DEFAULT '0', + `data13` int(10) unsigned NOT NULL DEFAULT '0', + `data14` int(10) unsigned NOT NULL DEFAULT '0', + `data15` int(10) unsigned NOT NULL DEFAULT '0', + `data16` int(10) unsigned NOT NULL DEFAULT '0', + `data17` int(10) unsigned NOT NULL DEFAULT '0', + `data18` int(10) unsigned NOT NULL DEFAULT '0', + `data19` int(10) unsigned NOT NULL DEFAULT '0', + `data20` int(10) unsigned NOT NULL DEFAULT '0', + `data21` int(10) unsigned NOT NULL DEFAULT '0', + `data22` int(10) unsigned NOT NULL DEFAULT '0', + `data23` int(10) unsigned NOT NULL DEFAULT '0', + `ScriptName` varchar(64) NOT NULL DEFAULT '', + `WDBVerified` smallint(5) signed DEFAULT '1', + PRIMARY KEY (`entry`), + KEY `idx_name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Gameobject System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gameobject_template` +-- + +LOCK TABLES `gameobject_template` WRITE; +/*!40000 ALTER TABLE `gameobject_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `gameobject_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gossip_scripts` +-- + +DROP TABLE IF EXISTS `gossip_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gossip_scripts` ( + `id` mediumint(8) unsigned NOT NULL default '0', + `delay` int(10) unsigned NOT NULL default '0', + `command` mediumint(8) unsigned NOT NULL default '0', + `datalong` mediumint(8) unsigned NOT NULL default '0', + `datalong2` int(10) unsigned NOT NULL default '0', + `dataint` int(11) NOT NULL default '0', + `x` float NOT NULL default '0', + `y` float NOT NULL default '0', + `z` float NOT NULL default '0', + `o` float NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gossip_scripts` +-- + +LOCK TABLES `gossip_scripts` WRITE; +/*!40000 ALTER TABLE `gossip_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `gossip_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gossip_menu` +-- + +DROP TABLE IF EXISTS `gossip_menu`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `gossip_menu` ( + entry smallint(6) unsigned NOT NULL default '0', + text_id mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (entry, text_id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gossip_menu` +-- + +LOCK TABLES `gossip_menu` WRITE; +/*!40000 ALTER TABLE `gossip_menu` DISABLE KEYS */; +/*!40000 ALTER TABLE `gossip_menu` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `gossip_menu_option` +-- + +DROP TABLE IF EXISTS `gossip_menu_option`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE gossip_menu_option ( + menu_id smallint(6) unsigned NOT NULL default '0', + id smallint(6) unsigned NOT NULL default '0', + option_icon mediumint(8) unsigned NOT NULL default '0', + option_text text, + option_id tinyint(3) unsigned NOT NULL default '0', + npc_option_npcflag int(10) unsigned NOT NULL default '0', + action_menu_id mediumint(8) unsigned NOT NULL default '0', + action_poi_id mediumint(8) unsigned NOT NULL default '0', + action_script_id mediumint(8) unsigned NOT NULL default '0', + box_coded tinyint(3) unsigned NOT NULL default '0', + box_money int(11) unsigned NOT NULL default '0', + box_text text, + PRIMARY KEY (menu_id, id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `gossip_menu_option` +-- + +LOCK TABLES `gossip_menu_option` WRITE; +/*!40000 ALTER TABLE `gossip_menu_option` DISABLE KEYS */; +/*!40000 ALTER TABLE `gossip_menu_option` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `instance_template` +-- + +DROP TABLE IF EXISTS `instance_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `instance_template` ( + `map` smallint(5) unsigned NOT NULL, + `parent` int(10) unsigned NOT NULL, + `access_id` bigint(20) unsigned NOT NULL DEFAULT '0', + `startLocX` float DEFAULT NULL, + `startLocY` float DEFAULT NULL, + `startLocZ` float DEFAULT NULL, + `startLocO` float DEFAULT NULL, + `script` varchar(128) NOT NULL DEFAULT '', + `allowMount` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`map`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `instance_template` +-- + +LOCK TABLES `instance_template` WRITE; +/*!40000 ALTER TABLE `instance_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `instance_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `item_enchantment_template` +-- + +DROP TABLE IF EXISTS `item_enchantment_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_enchantment_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ench` mediumint(8) unsigned NOT NULL DEFAULT '0', + `chance` float unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`ench`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Item Random Enchantment System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `item_enchantment_template` +-- + +LOCK TABLES `item_enchantment_template` WRITE; +/*!40000 ALTER TABLE `item_enchantment_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `item_enchantment_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `item_loot_template` +-- + +DROP TABLE IF EXISTS `item_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` smallint(5) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `item_loot_template` +-- + +LOCK TABLES `item_loot_template` WRITE; +/*!40000 ALTER TABLE `item_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `item_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `item_set_names` +-- + +DROP TABLE IF EXISTS `item_set_names`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_set_names` ( + `entry` mediumint(8) unsigned NOT NULL, + `name` varchar(255) character set utf8 NOT NULL default '', + `InventoryType` tinyint(3) unsigned NOT NULL default '0', + `WDBVerified` smallint(5) signed NOT NULL DEFAULT '1', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `item_set_names` +-- + +LOCK TABLES `item_set_names` WRITE; +/*!40000 ALTER TABLE `item_set_names` DISABLE KEYS */; +/*!40000 ALTER TABLE `item_set_names` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `item_required_target` +-- + +DROP TABLE IF EXISTS `item_required_target`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_required_target` ( + `entry` mediumint(8) unsigned NOT NULL, + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `targetEntry` mediumint(8) unsigned NOT NULL DEFAULT '0', + UNIQUE KEY `entry_type_target` (`entry`,`type`,`targetEntry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `item_required_target` +-- + +LOCK TABLES `item_required_target` WRITE; +/*!40000 ALTER TABLE `item_required_target` DISABLE KEYS */; +/*!40000 ALTER TABLE `item_required_target` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `item_template` +-- + +DROP TABLE IF EXISTS `item_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `subclass` tinyint(3) unsigned NOT NULL DEFAULT '0', + `unk0` int(11) NOT NULL DEFAULT '-1', + `name` varchar(255) NOT NULL DEFAULT '', + `displayid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Quality` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Flags` bigint(20) signed NOT NULL DEFAULT '0', + `FlagsExtra` int(10) unsigned NOT NULL DEFAULT '0', + `BuyCount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `BuyPrice` bigint(20) signed NOT NULL DEFAULT '0', + `SellPrice` int(10) unsigned NOT NULL DEFAULT '0', + `InventoryType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `AllowableClass` int(11) NOT NULL DEFAULT '-1', + `AllowableRace` int(11) NOT NULL DEFAULT '-1', + `ItemLevel` smallint(5) unsigned NOT NULL DEFAULT '0', + `RequiredLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `RequiredSkill` smallint(5) unsigned NOT NULL DEFAULT '0', + `RequiredSkillRank` smallint(5) unsigned NOT NULL DEFAULT '0', + `requiredspell` mediumint(8) unsigned NOT NULL DEFAULT '0', + `requiredhonorrank` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RequiredCityRank` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RequiredReputationFaction` smallint(5) unsigned NOT NULL DEFAULT '0', + `RequiredReputationRank` smallint(5) unsigned NOT NULL DEFAULT '0', + `maxcount` int(11) signed NOT NULL DEFAULT '0', + `stackable` int(11) signed NOT NULL DEFAULT '1', + `ContainerSlots` tinyint(3) unsigned NOT NULL DEFAULT '0', + `StatsCount` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_type1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value1` smallint(6) NOT NULL DEFAULT '0', + `stat_type2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value2` smallint(6) NOT NULL DEFAULT '0', + `stat_type3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value3` smallint(6) NOT NULL DEFAULT '0', + `stat_type4` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value4` smallint(6) NOT NULL DEFAULT '0', + `stat_type5` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value5` smallint(6) NOT NULL DEFAULT '0', + `stat_type6` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value6` smallint(6) NOT NULL DEFAULT '0', + `stat_type7` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value7` smallint(6) NOT NULL DEFAULT '0', + `stat_type8` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value8` smallint(6) NOT NULL DEFAULT '0', + `stat_type9` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value9` smallint(6) NOT NULL DEFAULT '0', + `stat_type10` tinyint(3) unsigned NOT NULL DEFAULT '0', + `stat_value10` smallint(6) NOT NULL DEFAULT '0', + `ScalingStatDistribution` smallint(6) NOT NULL DEFAULT '0', + `ScalingStatValue` int(6) unsigned NOT NULL DEFAULT '0', + `dmg_min1` float NOT NULL DEFAULT '0', + `dmg_max1` float NOT NULL DEFAULT '0', + `dmg_type1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dmg_min2` float NOT NULL DEFAULT '0', + `dmg_max2` float NOT NULL DEFAULT '0', + `dmg_type2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `armor` smallint(5) unsigned NOT NULL DEFAULT '0', + `holy_res` tinyint(3) unsigned NOT NULL DEFAULT '0', + `fire_res` tinyint(3) unsigned NOT NULL DEFAULT '0', + `nature_res` tinyint(3) unsigned NOT NULL DEFAULT '0', + `frost_res` tinyint(3) unsigned NOT NULL DEFAULT '0', + `shadow_res` tinyint(3) unsigned NOT NULL DEFAULT '0', + `arcane_res` tinyint(3) unsigned NOT NULL DEFAULT '0', + `delay` smallint(5) unsigned NOT NULL DEFAULT '1000', + `ammo_type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `RangedModRange` float NOT NULL DEFAULT '0', + `spellid_1` mediumint(8) signed NOT NULL DEFAULT '0', + `spelltrigger_1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `spellcharges_1` smallint(4) NOT NULL DEFAULT '0', + `spellppmRate_1` float NOT NULL DEFAULT '0', + `spellcooldown_1` int(11) NOT NULL DEFAULT '-1', + `spellcategory_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `spellcategorycooldown_1` int(11) NOT NULL DEFAULT '-1', + `spellid_2` mediumint(8) signed NOT NULL DEFAULT '0', + `spelltrigger_2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `spellcharges_2` smallint(4) NOT NULL DEFAULT '0', + `spellppmRate_2` float NOT NULL DEFAULT '0', + `spellcooldown_2` int(11) NOT NULL DEFAULT '-1', + `spellcategory_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `spellcategorycooldown_2` int(11) NOT NULL DEFAULT '-1', + `spellid_3` mediumint(8) signed NOT NULL DEFAULT '0', + `spelltrigger_3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `spellcharges_3` smallint(4) NOT NULL DEFAULT '0', + `spellppmRate_3` float NOT NULL DEFAULT '0', + `spellcooldown_3` int(11) NOT NULL DEFAULT '-1', + `spellcategory_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `spellcategorycooldown_3` int(11) NOT NULL DEFAULT '-1', + `spellid_4` mediumint(8) signed NOT NULL DEFAULT '0', + `spelltrigger_4` tinyint(3) unsigned NOT NULL DEFAULT '0', + `spellcharges_4` smallint(4) NOT NULL DEFAULT '0', + `spellppmRate_4` float NOT NULL DEFAULT '0', + `spellcooldown_4` int(11) NOT NULL DEFAULT '-1', + `spellcategory_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `spellcategorycooldown_4` int(11) NOT NULL DEFAULT '-1', + `spellid_5` mediumint(8) signed NOT NULL DEFAULT '0', + `spelltrigger_5` tinyint(3) unsigned NOT NULL DEFAULT '0', + `spellcharges_5` smallint(4) NOT NULL DEFAULT '0', + `spellppmRate_5` float NOT NULL DEFAULT '0', + `spellcooldown_5` int(11) NOT NULL DEFAULT '-1', + `spellcategory_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `spellcategorycooldown_5` int(11) NOT NULL DEFAULT '-1', + `bonding` tinyint(3) unsigned NOT NULL DEFAULT '0', + `description` varchar(255) NOT NULL DEFAULT '', + `PageText` mediumint(8) unsigned NOT NULL DEFAULT '0', + `LanguageID` tinyint(3) unsigned NOT NULL DEFAULT '0', + `PageMaterial` tinyint(3) unsigned NOT NULL DEFAULT '0', + `startquest` mediumint(8) unsigned NOT NULL DEFAULT '0', + `lockid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Material` tinyint(4) NOT NULL DEFAULT '0', + `sheath` tinyint(3) unsigned NOT NULL DEFAULT '0', + `RandomProperty` mediumint(8) signed NOT NULL DEFAULT '0', + `RandomSuffix` mediumint(8) unsigned NOT NULL DEFAULT '0', + `block` mediumint(8) unsigned NOT NULL DEFAULT '0', + `itemset` mediumint(8) unsigned NOT NULL DEFAULT '0', + `MaxDurability` smallint(5) unsigned NOT NULL DEFAULT '0', + `area` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Map` smallint(6) NOT NULL DEFAULT '0', + `BagFamily` mediumint(9) NOT NULL DEFAULT '0', + `TotemCategory` mediumint(9) NOT NULL DEFAULT '0', + `socketColor_1` tinyint(4) NOT NULL DEFAULT '0', + `socketContent_1` mediumint(9) NOT NULL DEFAULT '0', + `socketColor_2` tinyint(4) NOT NULL DEFAULT '0', + `socketContent_2` mediumint(9) NOT NULL DEFAULT '0', + `socketColor_3` tinyint(4) NOT NULL DEFAULT '0', + `socketContent_3` mediumint(9) NOT NULL DEFAULT '0', + `socketBonus` mediumint(9) NOT NULL DEFAULT '0', + `GemProperties` mediumint(9) NOT NULL DEFAULT '0', + `RequiredDisenchantSkill` smallint(6) NOT NULL DEFAULT '-1', + `ArmorDamageModifier` float NOT NULL DEFAULT '0', + `Duration` int(11) NOT NULL DEFAULT '0' COMMENT 'Duration in seconds. Negative value means realtime, postive value ingame time', + `ItemLimitCategory` smallint(6) NOT NULL DEFAULT '0', + `HolidayId` int(11) unsigned NOT NULL DEFAULT '0', + `ScriptName` varchar(64) NOT NULL DEFAULT '', + `DisenchantID` mediumint(8) unsigned NOT NULL DEFAULT '0', + `FoodType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `minMoneyLoot` int(10) unsigned NOT NULL DEFAULT '0', + `maxMoneyLoot` int(10) unsigned NOT NULL DEFAULT '0', + `WDBVerified` smallint(5) signed DEFAULT '1', + PRIMARY KEY (`entry`), + KEY `idx_name` (`name`), + KEY `items_index` (`class`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Item System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `item_template` +-- + +LOCK TABLES `item_template` WRITE; +/*!40000 ALTER TABLE `item_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `item_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_achievement_reward` +-- + +DROP TABLE IF EXISTS `locales_achievement_reward`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_achievement_reward` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `subject_loc1` varchar(100) NOT NULL DEFAULT '', + `subject_loc2` varchar(100) NOT NULL DEFAULT '', + `subject_loc3` varchar(100) NOT NULL DEFAULT '', + `subject_loc4` varchar(100) NOT NULL DEFAULT '', + `subject_loc5` varchar(100) NOT NULL DEFAULT '', + `subject_loc6` varchar(100) NOT NULL DEFAULT '', + `subject_loc7` varchar(100) NOT NULL DEFAULT '', + `subject_loc8` varchar(100) NOT NULL DEFAULT '', + `text_loc1` text, + `text_loc2` text, + `text_loc3` text, + `text_loc4` text, + `text_loc5` text, + `text_loc6` text, + `text_loc7` text, + `text_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_achievement_reward` +-- + +LOCK TABLES `locales_achievement_reward` WRITE; +/*!40000 ALTER TABLE `locales_achievement_reward` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_achievement_reward` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_creature` +-- + +DROP TABLE IF EXISTS `locales_creature`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_creature` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name_loc1` varchar(100) NOT NULL DEFAULT '', + `name_loc2` varchar(100) NOT NULL DEFAULT '', + `name_loc3` varchar(100) NOT NULL DEFAULT '', + `name_loc4` varchar(100) NOT NULL DEFAULT '', + `name_loc5` varchar(100) NOT NULL DEFAULT '', + `name_loc6` varchar(100) NOT NULL DEFAULT '', + `name_loc7` varchar(100) NOT NULL DEFAULT '', + `name_loc8` varchar(100) NOT NULL DEFAULT '', + `subname_loc1` varchar(100) DEFAULT NULL, + `subname_loc2` varchar(100) DEFAULT NULL, + `subname_loc3` varchar(100) DEFAULT NULL, + `subname_loc4` varchar(100) DEFAULT NULL, + `subname_loc5` varchar(100) DEFAULT NULL, + `subname_loc6` varchar(100) DEFAULT NULL, + `subname_loc7` varchar(100) DEFAULT NULL, + `subname_loc8` varchar(100) DEFAULT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_creature` +-- + +LOCK TABLES `locales_creature` WRITE; +/*!40000 ALTER TABLE `locales_creature` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_creature` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_gameobject` +-- + +DROP TABLE IF EXISTS `locales_gameobject`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_gameobject` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name_loc1` varchar(100) NOT NULL DEFAULT '', + `name_loc2` varchar(100) NOT NULL DEFAULT '', + `name_loc3` varchar(100) NOT NULL DEFAULT '', + `name_loc4` varchar(100) NOT NULL DEFAULT '', + `name_loc5` varchar(100) NOT NULL DEFAULT '', + `name_loc6` varchar(100) NOT NULL DEFAULT '', + `name_loc7` varchar(100) NOT NULL DEFAULT '', + `name_loc8` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc1` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc2` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc3` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc4` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc5` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc6` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc7` varchar(100) NOT NULL DEFAULT '', + `castbarcaption_loc8` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_gameobject` +-- + +LOCK TABLES `locales_gameobject` WRITE; +/*!40000 ALTER TABLE `locales_gameobject` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_gameobject` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_item` +-- + +DROP TABLE IF EXISTS `locales_item`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_item` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name_loc1` varchar(100) NOT NULL DEFAULT '', + `name_loc2` varchar(100) NOT NULL DEFAULT '', + `name_loc3` varchar(100) NOT NULL DEFAULT '', + `name_loc4` varchar(100) NOT NULL DEFAULT '', + `name_loc5` varchar(100) NOT NULL DEFAULT '', + `name_loc6` varchar(100) NOT NULL DEFAULT '', + `name_loc7` varchar(100) NOT NULL DEFAULT '', + `name_loc8` varchar(100) NOT NULL DEFAULT '', + `description_loc1` varchar(255) DEFAULT NULL, + `description_loc2` varchar(255) DEFAULT NULL, + `description_loc3` varchar(255) DEFAULT NULL, + `description_loc4` varchar(255) DEFAULT NULL, + `description_loc5` varchar(255) DEFAULT NULL, + `description_loc6` varchar(255) DEFAULT NULL, + `description_loc7` varchar(255) DEFAULT NULL, + `description_loc8` varchar(255) DEFAULT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_item` +-- + +LOCK TABLES `locales_item` WRITE; +/*!40000 ALTER TABLE `locales_item` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_item` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_item_set_names` +-- + +DROP TABLE IF EXISTS `locales_item_set_names`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_item_set_names` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name_loc1` varchar(100) NOT NULL DEFAULT '', + `name_loc2` varchar(100) NOT NULL DEFAULT '', + `name_loc3` varchar(100) NOT NULL DEFAULT '', + `name_loc4` varchar(100) NOT NULL DEFAULT '', + `name_loc5` varchar(100) NOT NULL DEFAULT '', + `name_loc6` varchar(100) NOT NULL DEFAULT '', + `name_loc7` varchar(100) NOT NULL DEFAULT '', + `name_loc8` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_item_set_names` +-- + +LOCK TABLES `locales_item_set_names` WRITE; +/*!40000 ALTER TABLE `locales_item_set_names` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_item_set_names` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_gossip_menu_option` +-- + +DROP TABLE IF EXISTS `locales_gossip_menu_option`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_gossip_menu_option` ( + `menu_id` smallint(6) unsigned NOT NULL DEFAULT '0', + `id` smallint(6) unsigned NOT NULL DEFAULT '0', + `option_text_loc1` text, + `option_text_loc2` text, + `option_text_loc3` text, + `option_text_loc4` text, + `option_text_loc5` text, + `option_text_loc6` text, + `option_text_loc7` text, + `option_text_loc8` text, + `box_text_loc1` text, + `box_text_loc2` text, + `box_text_loc3` text, + `box_text_loc4` text, + `box_text_loc5` text, + `box_text_loc6` text, + `box_text_loc7` text, + `box_text_loc8` text, + PRIMARY KEY (`menu_id`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_gossip_menu_option` +-- + +LOCK TABLES `locales_gossip_menu_option` WRITE; +/*!40000 ALTER TABLE `locales_gossip_menu_option` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_gossip_menu_option` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_npc_text` +-- + +DROP TABLE IF EXISTS `locales_npc_text`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_npc_text` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Text0_0_loc1` longtext, + `Text0_0_loc2` longtext, + `Text0_0_loc3` longtext, + `Text0_0_loc4` longtext, + `Text0_0_loc5` longtext, + `Text0_0_loc6` longtext, + `Text0_0_loc7` longtext, + `Text0_0_loc8` longtext, + `Text0_1_loc1` longtext, + `Text0_1_loc2` longtext, + `Text0_1_loc3` longtext, + `Text0_1_loc4` longtext, + `Text0_1_loc5` longtext, + `Text0_1_loc6` longtext, + `Text0_1_loc7` longtext, + `Text0_1_loc8` longtext, + `Text1_0_loc1` longtext, + `Text1_0_loc2` longtext, + `Text1_0_loc3` longtext, + `Text1_0_loc4` longtext, + `Text1_0_loc5` longtext, + `Text1_0_loc6` longtext, + `Text1_0_loc7` longtext, + `Text1_0_loc8` longtext, + `Text1_1_loc1` longtext, + `Text1_1_loc2` longtext, + `Text1_1_loc3` longtext, + `Text1_1_loc4` longtext, + `Text1_1_loc5` longtext, + `Text1_1_loc6` longtext, + `Text1_1_loc7` longtext, + `Text1_1_loc8` longtext, + `Text2_0_loc1` longtext, + `Text2_0_loc2` longtext, + `Text2_0_loc3` longtext, + `Text2_0_loc4` longtext, + `Text2_0_loc5` longtext, + `Text2_0_loc6` longtext, + `Text2_0_loc7` longtext, + `Text2_0_loc8` longtext, + `Text2_1_loc1` longtext, + `Text2_1_loc2` longtext, + `Text2_1_loc3` longtext, + `Text2_1_loc4` longtext, + `Text2_1_loc5` longtext, + `Text2_1_loc6` longtext, + `Text2_1_loc7` longtext, + `Text2_1_loc8` longtext, + `Text3_0_loc1` longtext, + `Text3_0_loc2` longtext, + `Text3_0_loc3` longtext, + `Text3_0_loc4` longtext, + `Text3_0_loc5` longtext, + `Text3_0_loc6` longtext, + `Text3_0_loc7` longtext, + `Text3_0_loc8` longtext, + `Text3_1_loc1` longtext, + `Text3_1_loc2` longtext, + `Text3_1_loc3` longtext, + `Text3_1_loc4` longtext, + `Text3_1_loc5` longtext, + `Text3_1_loc6` longtext, + `Text3_1_loc7` longtext, + `Text3_1_loc8` longtext, + `Text4_0_loc1` longtext, + `Text4_0_loc2` longtext, + `Text4_0_loc3` longtext, + `Text4_0_loc4` longtext, + `Text4_0_loc5` longtext, + `Text4_0_loc6` longtext, + `Text4_0_loc7` longtext, + `Text4_0_loc8` longtext, + `Text4_1_loc1` longtext, + `Text4_1_loc2` longtext, + `Text4_1_loc3` longtext, + `Text4_1_loc4` longtext, + `Text4_1_loc5` longtext, + `Text4_1_loc6` longtext, + `Text4_1_loc7` longtext, + `Text4_1_loc8` longtext, + `Text5_0_loc1` longtext, + `Text5_0_loc2` longtext, + `Text5_0_loc3` longtext, + `Text5_0_loc4` longtext, + `Text5_0_loc5` longtext, + `Text5_0_loc6` longtext, + `Text5_0_loc7` longtext, + `Text5_0_loc8` longtext, + `Text5_1_loc1` longtext, + `Text5_1_loc2` longtext, + `Text5_1_loc3` longtext, + `Text5_1_loc4` longtext, + `Text5_1_loc5` longtext, + `Text5_1_loc6` longtext, + `Text5_1_loc7` longtext, + `Text5_1_loc8` longtext, + `Text6_0_loc1` longtext, + `Text6_0_loc2` longtext, + `Text6_0_loc3` longtext, + `Text6_0_loc4` longtext, + `Text6_0_loc5` longtext, + `Text6_0_loc6` longtext, + `Text6_0_loc7` longtext, + `Text6_0_loc8` longtext, + `Text6_1_loc1` longtext, + `Text6_1_loc2` longtext, + `Text6_1_loc3` longtext, + `Text6_1_loc4` longtext, + `Text6_1_loc5` longtext, + `Text6_1_loc6` longtext, + `Text6_1_loc7` longtext, + `Text6_1_loc8` longtext, + `Text7_0_loc1` longtext, + `Text7_0_loc2` longtext, + `Text7_0_loc3` longtext, + `Text7_0_loc4` longtext, + `Text7_0_loc5` longtext, + `Text7_0_loc6` longtext, + `Text7_0_loc7` longtext, + `Text7_0_loc8` longtext, + `Text7_1_loc1` longtext, + `Text7_1_loc2` longtext, + `Text7_1_loc3` longtext, + `Text7_1_loc4` longtext, + `Text7_1_loc5` longtext, + `Text7_1_loc6` longtext, + `Text7_1_loc7` longtext, + `Text7_1_loc8` longtext, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_npc_text` +-- + +LOCK TABLES `locales_npc_text` WRITE; +/*!40000 ALTER TABLE `locales_npc_text` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_npc_text` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_page_text` +-- + +DROP TABLE IF EXISTS `locales_page_text`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_page_text` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Text_loc1` longtext, + `Text_loc2` longtext, + `Text_loc3` longtext, + `Text_loc4` longtext, + `Text_loc5` longtext, + `Text_loc6` longtext, + `Text_loc7` longtext, + `Text_loc8` longtext, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_page_text` +-- + +LOCK TABLES `locales_page_text` WRITE; +/*!40000 ALTER TABLE `locales_page_text` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_page_text` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_points_of_interest` +-- + +DROP TABLE IF EXISTS `locales_points_of_interest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_points_of_interest` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `icon_name_loc1` text, + `icon_name_loc2` text, + `icon_name_loc3` text, + `icon_name_loc4` text, + `icon_name_loc5` text, + `icon_name_loc6` text, + `icon_name_loc7` text, + `icon_name_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_points_of_interest` +-- + +LOCK TABLES `locales_points_of_interest` WRITE; +/*!40000 ALTER TABLE `locales_points_of_interest` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_points_of_interest` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `locales_quest` +-- + +DROP TABLE IF EXISTS `locales_quest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_quest` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Title_loc1` text, + `Title_loc2` text, + `Title_loc3` text, + `Title_loc4` text, + `Title_loc5` text, + `Title_loc6` text, + `Title_loc7` text, + `Title_loc8` text, + `Details_loc1` text, + `Details_loc2` text, + `Details_loc3` text, + `Details_loc4` text, + `Details_loc5` text, + `Details_loc6` text, + `Details_loc7` text, + `Details_loc8` text, + `Objectives_loc1` text, + `Objectives_loc2` text, + `Objectives_loc3` text, + `Objectives_loc4` text, + `Objectives_loc5` text, + `Objectives_loc6` text, + `Objectives_loc7` text, + `Objectives_loc8` text, + `OfferRewardText_loc1` text, + `OfferRewardText_loc2` text, + `OfferRewardText_loc3` text, + `OfferRewardText_loc4` text, + `OfferRewardText_loc5` text, + `OfferRewardText_loc6` text, + `OfferRewardText_loc7` text, + `OfferRewardText_loc8` text, + `RequestItemsText_loc1` text, + `RequestItemsText_loc2` text, + `RequestItemsText_loc3` text, + `RequestItemsText_loc4` text, + `RequestItemsText_loc5` text, + `RequestItemsText_loc6` text, + `RequestItemsText_loc7` text, + `RequestItemsText_loc8` text, + `EndText_loc1` text, + `EndText_loc2` text, + `EndText_loc3` text, + `EndText_loc4` text, + `EndText_loc5` text, + `EndText_loc6` text, + `EndText_loc7` text, + `EndText_loc8` text, + `CompletedText_loc1` text, + `CompletedText_loc2` text, + `CompletedText_loc3` text, + `CompletedText_loc4` text, + `CompletedText_loc5` text, + `CompletedText_loc6` text, + `CompletedText_loc7` text, + `CompletedText_loc8` text, + `ObjectiveText1_loc1` text, + `ObjectiveText1_loc2` text, + `ObjectiveText1_loc3` text, + `ObjectiveText1_loc4` text, + `ObjectiveText1_loc5` text, + `ObjectiveText1_loc6` text, + `ObjectiveText1_loc7` text, + `ObjectiveText1_loc8` text, + `ObjectiveText2_loc1` text, + `ObjectiveText2_loc2` text, + `ObjectiveText2_loc3` text, + `ObjectiveText2_loc4` text, + `ObjectiveText2_loc5` text, + `ObjectiveText2_loc6` text, + `ObjectiveText2_loc7` text, + `ObjectiveText2_loc8` text, + `ObjectiveText3_loc1` text, + `ObjectiveText3_loc2` text, + `ObjectiveText3_loc3` text, + `ObjectiveText3_loc4` text, + `ObjectiveText3_loc5` text, + `ObjectiveText3_loc6` text, + `ObjectiveText3_loc7` text, + `ObjectiveText3_loc8` text, + `ObjectiveText4_loc1` text, + `ObjectiveText4_loc2` text, + `ObjectiveText4_loc3` text, + `ObjectiveText4_loc4` text, + `ObjectiveText4_loc5` text, + `ObjectiveText4_loc6` text, + `ObjectiveText4_loc7` text, + `ObjectiveText4_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `locales_quest` +-- + +LOCK TABLES `locales_quest` WRITE; +/*!40000 ALTER TABLE `locales_quest` DISABLE KEYS */; +/*!40000 ALTER TABLE `locales_quest` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `mail_level_reward` +-- + +DROP TABLE IF EXISTS `mail_level_reward`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mail_level_reward` ( + `level` tinyint(3) unsigned NOT NULL DEFAULT '0', + `raceMask` mediumint(8) unsigned NOT NULL DEFAULT '0', + `mailTemplateId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `senderEntry` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`level`,`raceMask`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Mail System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `mail_level_reward` +-- + +LOCK TABLES `mail_level_reward` WRITE; +/*!40000 ALTER TABLE `mail_level_reward` DISABLE KEYS */; +/*!40000 ALTER TABLE `mail_level_reward` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `mail_loot_template` +-- + +DROP TABLE IF EXISTS `mail_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mail_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `mail_loot_template` +-- + +LOCK TABLES `mail_loot_template` WRITE; +/*!40000 ALTER TABLE `mail_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `mail_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `milling_loot_template` +-- + +DROP TABLE IF EXISTS `milling_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `milling_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `milling_loot_template` +-- + +LOCK TABLES `milling_loot_template` WRITE; +/*!40000 ALTER TABLE `milling_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `milling_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `npc_gossip` +-- + +DROP TABLE IF EXISTS `npc_gossip`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `npc_gossip` ( + `npc_guid` int(10) unsigned NOT NULL DEFAULT '0', + `textid` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`npc_guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `npc_gossip` +-- + +LOCK TABLES `npc_gossip` WRITE; +/*!40000 ALTER TABLE `npc_gossip` DISABLE KEYS */; +/*!40000 ALTER TABLE `npc_gossip` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `npc_spellclick_spells` +-- + +DROP TABLE IF EXISTS `npc_spellclick_spells`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `npc_spellclick_spells` ( + `npc_entry` int(10) unsigned NOT NULL COMMENT 'reference to creature_template', + `spell_id` int(10) unsigned NOT NULL COMMENT 'spell which should be casted ', + `quest_start` mediumint(8) unsigned NOT NULL COMMENT 'reference to quest_template', + `quest_start_active` tinyint(1) unsigned NOT NULL DEFAULT '0', + `quest_end` mediumint(8) unsigned NOT NULL DEFAULT '0', + `cast_flags` tinyint(3) unsigned NOT NULL COMMENT 'first bit defines caster: 1=player, 0=creature; second bit defines target, same mapping as caster bit', + `aura_required` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'player without aura cant click', + `aura_forbidden` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'player with aura cant click', + `user_type` smallint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'relation with summoner: 0-no 1-friendly 2-raid 3-party player can click' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `npc_spellclick_spells` +-- + +LOCK TABLES `npc_spellclick_spells` WRITE; +/*!40000 ALTER TABLE `npc_spellclick_spells` DISABLE KEYS */; +/*!40000 ALTER TABLE `npc_spellclick_spells` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `npc_text` +-- + +DROP TABLE IF EXISTS `npc_text`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `npc_text` ( + `ID` mediumint(8) unsigned NOT NULL DEFAULT '0', + `text0_0` longtext, + `text0_1` longtext, + `lang0` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob0` float NOT NULL DEFAULT '0', + `em0_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em0_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em0_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em0_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em0_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em0_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `text1_0` longtext, + `text1_1` longtext, + `lang1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob1` float NOT NULL DEFAULT '0', + `em1_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em1_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em1_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em1_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em1_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em1_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `text2_0` longtext, + `text2_1` longtext, + `lang2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob2` float NOT NULL DEFAULT '0', + `em2_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em2_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em2_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em2_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em2_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em2_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `text3_0` longtext, + `text3_1` longtext, + `lang3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob3` float NOT NULL DEFAULT '0', + `em3_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em3_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em3_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em3_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em3_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em3_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `text4_0` longtext, + `text4_1` longtext, + `lang4` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob4` float NOT NULL DEFAULT '0', + `em4_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em4_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em4_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em4_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em4_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em4_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `text5_0` longtext, + `text5_1` longtext, + `lang5` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob5` float NOT NULL DEFAULT '0', + `em5_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em5_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em5_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em5_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em5_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em5_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `text6_0` longtext, + `text6_1` longtext, + `lang6` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob6` float NOT NULL DEFAULT '0', + `em6_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em6_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em6_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em6_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em6_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em6_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `text7_0` longtext, + `text7_1` longtext, + `lang7` tinyint(3) unsigned NOT NULL DEFAULT '0', + `prob7` float NOT NULL DEFAULT '0', + `em7_0` smallint(5) unsigned NOT NULL DEFAULT '0', + `em7_1` smallint(5) unsigned NOT NULL DEFAULT '0', + `em7_2` smallint(5) unsigned NOT NULL DEFAULT '0', + `em7_3` smallint(5) unsigned NOT NULL DEFAULT '0', + `em7_4` smallint(5) unsigned NOT NULL DEFAULT '0', + `em7_5` smallint(5) unsigned NOT NULL DEFAULT '0', + `WDBVerified` smallint(5) signed DEFAULT '1', + PRIMARY KEY (`ID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `npc_text` +-- + +LOCK TABLES `npc_text` WRITE; +/*!40000 ALTER TABLE `npc_text` DISABLE KEYS */; +/*!40000 ALTER TABLE `npc_text` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `npc_trainer` +-- + +DROP TABLE IF EXISTS `npc_trainer`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `npc_trainer` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `spell` mediumint(8) NOT NULL DEFAULT '0', + `spellcost` int(10) unsigned NOT NULL DEFAULT '0', + `reqskill` smallint(5) unsigned NOT NULL DEFAULT '0', + `reqskillvalue` smallint(5) unsigned NOT NULL DEFAULT '0', + `reqlevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`spell`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `npc_trainer` +-- + +LOCK TABLES `npc_trainer` WRITE; +/*!40000 ALTER TABLE `npc_trainer` DISABLE KEYS */; +/*!40000 ALTER TABLE `npc_trainer` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `npc_vendor` +-- + +DROP TABLE IF EXISTS `npc_vendor`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `npc_vendor` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `slot` smallint(6) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '0', + `incrtime` int(10) unsigned NOT NULL DEFAULT '0', + `ExtendedCost` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`,`extendedCost`), + INDEX (`slot`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Npc System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `npc_vendor` +-- + +LOCK TABLES `npc_vendor` WRITE; +/*!40000 ALTER TABLE `npc_vendor` DISABLE KEYS */; +/*!40000 ALTER TABLE `npc_vendor` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `page_text` +-- + +DROP TABLE IF EXISTS `page_text`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `page_text` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `text` longtext NOT NULL, + `next_page` mediumint(8) unsigned NOT NULL DEFAULT '0', + `WDBVerified` smallint(5) signed DEFAULT '1', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Item System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `page_text` +-- + +LOCK TABLES `page_text` WRITE; +/*!40000 ALTER TABLE `page_text` DISABLE KEYS */; +/*!40000 ALTER TABLE `page_text` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pet_levelstats` +-- + +DROP TABLE IF EXISTS `pet_levelstats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pet_levelstats` ( + `creature_entry` mediumint(8) unsigned NOT NULL, + `level` tinyint(3) unsigned NOT NULL, + `hp` smallint(5) unsigned NOT NULL, + `mana` smallint(5) unsigned NOT NULL, + `armor` int(10) unsigned NOT NULL DEFAULT '0', + `str` smallint(5) unsigned NOT NULL, + `agi` smallint(5) unsigned NOT NULL, + `sta` smallint(5) unsigned NOT NULL, + `inte` smallint(5) unsigned NOT NULL, + `spi` smallint(5) unsigned NOT NULL, + PRIMARY KEY (`creature_entry`,`level`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 COMMENT='Stores pet levels stats.'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pet_levelstats` +-- + +LOCK TABLES `pet_levelstats` WRITE; +/*!40000 ALTER TABLE `pet_levelstats` DISABLE KEYS */; +INSERT INTO `pet_levelstats` VALUES (1,1,42,1,20,22,20,22,20,20),(1,2,55,1,21,23,21,23,20,20),(1,3,71,1,46,24,21,24,20,21),(1,4,86,1,82,25,22,25,21,21),(1,5,102,1,126,26,23,25,21,21),(1,6,120,1,180,27,24,26,21,22),(1,7,137,1,245,28,24,27,21,22),(1,8,156,1,322,29,25,28,22,22),(1,9,176,1,412,30,26,29,22,23),(1,10,198,1,518,31,26,30,22,23),(1,11,222,1,545,32,27,34,22,24),(1,12,247,1,580,33,28,38,23,25),(1,13,273,1,615,34,30,42,23,25),(1,14,300,1,650,35,31,46,23,27),(1,15,328,1,685,37,32,51,24,28),(1,16,356,1,721,38,33,55,25,29),(1,17,386,1,756,40,34,59,25,30),(1,18,417,1,791,42,36,63,25,30),(1,19,449,1,826,44,37,67,26,32),(1,20,484,1,861,45,39,72,27,33),(1,21,521,1,897,47,39,76,27,34),(1,22,562,1,932,49,40,80,27,35),(1,23,605,1,967,50,42,84,28,36),(1,24,651,1,1002,52,43,88,28,37),(1,25,699,1,1037,53,45,94,29,39),(1,26,750,1,1072,55,46,98,30,39),(1,27,800,1,1108,56,47,102,30,40),(1,28,853,1,1142,58,49,106,30,41),(1,29,905,1,1177,60,50,110,31,42),(1,30,955,1,1212,61,52,115,32,44),(1,31,1006,1,1247,63,53,120,32,44),(1,32,1057,1,1283,64,54,124,33,46),(1,33,1110,1,1317,66,56,128,33,46),(1,34,1163,1,1353,67,57,132,33,48),(1,35,1220,1,1387,69,59,138,35,49),(1,36,1277,1,1494,70,60,142,35,50),(1,37,1336,1,1607,72,61,146,35,52),(1,38,1395,1,1724,74,63,151,36,52),(1,39,1459,1,1849,76,64,155,36,54),(1,40,1524,1,1980,78,66,160,37,55),(1,41,1585,1,2117,81,68,165,38,56),(1,42,1651,1,2262,86,69,169,38,57),(1,43,1716,1,2414,91,71,174,39,58),(1,44,1782,1,2574,97,72,178,39,59),(1,45,1848,1,2742,102,74,184,40,61),(1,46,1919,1,2798,104,75,188,41,62),(1,47,1990,1,2853,106,77,193,41,63),(1,48,2062,1,2907,108,79,197,42,64),(1,49,2138,1,2963,110,80,202,42,66),(1,50,2215,1,3018,113,82,207,43,67),(1,51,2292,1,3072,115,84,212,44,68),(1,52,2371,1,3128,117,85,216,44,69),(1,53,2453,1,3183,119,87,221,45,70),(1,54,2533,1,3237,122,89,226,45,72),(1,55,2614,1,3292,124,91,231,47,73),(1,56,2699,1,3348,127,92,236,47,74),(1,57,2784,1,3402,129,94,241,48,76),(1,58,2871,1,3457,131,96,245,48,77),(1,59,2961,1,3512,134,98,250,49,78),(1,60,3052,1,3814,136,100,256,50,80),(1,61,3144,1,4113,139,102,161,51,81),(1,62,3237,1,4410,141,105,266,52,83),(1,63,3331,1,4708,144,107,271,53,85),(1,64,3425,1,5006,146,110,276,54,87),(1,65,3524,1,5303,149,113,281,55,89),(1,66,3624,1,5601,151,116,287,56,91),(1,67,3728,1,5900,154,119,292,57,93),(1,68,3834,1,6197,156,122,297,58,95),(1,69,3941,1,6495,159,125,302,59,97),(1,70,4051,1,6794,162,128,307,60,99),(416,70,1528,2568,2207,145,39,101,334,264),(416,69,1464,2351,2008,144,36,100,327,262),(416,68,1429,2298,1987,143,34,98,320,260),(416,67,1401,2244,1900,142,33,98,313,258),(416,66,1357,2191,1872,141,33,97,306,255),(416,65,1335,2137,1844,140,33,97,299,250),(416,64,1292,2084,1809,139,33,95,292,247),(416,63,1188,2030,1732,137,32,92,285,244),(416,62,1050,1977,1663,135,31,90,278,241),(416,61,973,1925,1608,132,29,88,271,239),(416,60,920,1898,1163,122,27,86,264,197),(416,59,878,1824,1150,127,27,85,258,192),(416,58,862,1763,1125,125,27,84,250,189),(416,57,850,1714,1101,123,27,83,243,185),(416,56,846,1666,1091,121,27,83,236,181),(416,55,836,1620,1078,119,26,81,229,177),(416,54,820,1573,1055,115,26,80,222,172),(416,53,787,1527,1039,114,25,78,215,168),(416,52,764,1481,1013,112,24,76,208,165),(416,51,750,1435,996,109,22,74,202,161),(416,50,747,1391,983,107,22,72,194,158),(416,49,734,1347,964,105,22,69,188,155),(416,48,726,1320,946,102,22,68,184,152),(416,47,718,1294,928,100,22,68,181,151),(416,46,709,1267,910,98,22,67,177,149),(416,45,701,1240,884,96,21,67,174,148),(416,44,693,1214,853,91,21,66,170,146),(416,43,685,1187,808,87,20,66,167,145),(416,42,676,1103,756,81,20,65,163,144),(416,41,668,1063,694,77,20,65,160,143),(416,40,650,1026,639,74,20,64,156,142),(416,39,642,988,561,72,19,64,69,118),(416,38,634,952,549,70,19,63,68,115),(416,37,626,916,537,69,19,63,68,112),(416,36,617,879,525,67,19,62,66,110),(416,35,609,845,513,64,19,62,66,107),(416,34,601,793,501,63,19,60,65,104),(416,33,598,742,488,62,18,60,65,101),(416,32,590,720,476,60,17,58,64,98),(416,31,581,676,462,59,16,58,64,95),(416,30,579,648,449,57,16,57,63,92),(416,29,576,620,436,57,16,55,62,89),(416,28,574,592,424,55,15,54,62,86),(416,27,571,564,411,53,14,52,61,81),(416,26,569,534,399,52,13,49,60,78),(416,25,540,504,386,50,13,46,98,100),(416,24,520,476,373,49,13,43,97,95),(416,23,473,447,360,47,13,40,96,90),(416,22,449,420,346,46,13,38,95,86),(416,21,425,393,320,44,13,37,91,83),(416,20,403,377,303,42,13,35,87,78),(416,19,393,351,291,40,13,33,74,75),(416,18,362,314,278,39,13,32,70,70),(416,17,350,300,265,38,13,31,65,65),(416,16,329,275,253,36,13,30,62,56),(416,15,309,251,240,34,13,29,57,52),(416,14,299,227,228,33,13,28,54,47),(416,13,289,203,215,32,13,26,50,43),(416,12,250,180,203,31,12,26,41,39),(416,11,232,158,190,30,11,24,37,35),(416,10,223,147,180,29,10,24,33,31),(416,9,213,136,147,25,9,27,32,30),(416,8,204,125,117,23,8,23,31,29),(416,7,195,114,92,22,7,23,30,28),(416,6,186,103,68,20,7,22,29,27),(416,5,177,92,49,18,5,22,28,27),(416,4,168,81,33,17,5,21,27,26),(416,3,158,70,20,15,5,21,26,25),(416,2,149,59,20,21,5,20,25,24),(416,1,140,48,20,20,5,20,24,23),(417,70,3112,2420,4400,153,108,280,133,122),(417,69,3056,2360,4229,150,105,276,130,120),(417,68,3000,2300,4061,148,103,271,127,117),(417,67,2944,2252,3900,146,101,267,124,115),(417,66,2888,2195,3745,143,99,262,121,113),(417,65,2823,2139,3597,141,97,258,119,111),(417,64,2758,2084,3454,139,95,253,116,109),(417,63,2693,2030,3317,137,93,249,113,107),(417,62,2638,1977,3186,134,91,244,111,105),(417,61,2583,1925,3059,132,89,240,108,103),(417,60,2529,1874,2938,130,87,235,106,101),(417,59,2476,1824,2821,127,85,231,103,99),(417,58,2424,1763,2709,125,83,226,101,97),(417,57,2371,1714,2602,123,82,222,99,94),(417,56,2318,1666,2499,120,80,217,96,92),(417,55,2266,1620,2400,118,78,213,94,90),(417,54,2213,1573,2305,116,77,208,92,88),(417,53,2161,1527,2213,113,75,204,90,86),(417,52,2108,1481,2125,111,74,199,88,84),(417,51,2055,1435,2041,109,72,195,86,82),(417,50,2003,1391,1959,107,71,190,84,80),(417,49,1950,1347,1925,104,69,186,82,78),(417,48,1889,1320,1888,102,68,181,80,76),(417,47,1828,1294,1853,100,66,177,78,75),(417,46,1768,1267,1817,98,65,173,77,73),(417,45,1708,1240,1750,95,64,168,75,71),(417,44,1648,1214,1650,91,61,164,73,70),(417,43,1588,1187,1550,87,60,160,71,68),(417,42,1528,1103,1484,81,59,156,70,67),(417,41,1468,1063,1390,76,58,151,68,65),(417,40,1408,1026,1250,73,57,146,67,64),(417,39,1348,988,1048,71,56,142,68,62),(417,38,1288,952,1024,70,55,139,69,61),(417,37,1227,916,1001,68,54,138,70,60),(417,36,1167,879,977,67,53,138,72,58),(417,35,1107,845,953,65,52,137,73,57),(417,34,1047,793,929,63,50,135,76,56),(417,33,987,742,905,62,49,131,74,54),(417,32,921,720,882,60,47,127,73,53),(417,31,856,676,858,59,47,123,71,52),(417,30,800,648,834,57,46,118,69,51),(417,29,775,620,810,55,45,114,67,50),(417,28,740,592,786,54,44,110,65,49),(417,27,705,564,763,52,43,105,63,48),(417,26,678,543,739,51,42,101,61,47),(417,25,630,504,715,49,41,97,59,46),(417,24,595,476,691,47,40,93,57,45),(417,23,558,447,667,46,39,88,55,44),(417,22,528,423,644,44,38,84,53,43),(417,21,500,400,620,43,37,80,51,42),(417,20,471,377,596,41,36,75,49,41),(417,19,438,351,572,39,35,71,47,40),(417,18,392,314,548,38,34,67,45,39),(417,17,375,300,525,36,33,62,43,38),(417,16,343,275,501,35,32,58,41,37),(417,15,313,251,477,33,31,54,39,36),(417,14,284,227,453,31,30,50,37,35),(417,13,254,203,429,30,29,45,35,34),(417,12,225,180,406,28,28,41,33,33),(417,11,198,158,382,27,27,37,31,32),(417,10,184,147,358,25,26,34,29,31),(417,9,170,136,334,23,25,32,27,30),(417,8,156,125,310,22,24,29,25,29),(417,7,152,114,287,20,23,27,23,28),(417,6,129,103,263,19,22,24,21,27),(417,5,115,92,239,17,21,22,19,26),(417,4,101,81,215,15,20,19,17,25),(417,3,87,70,191,14,19,17,15,24),(417,2,73,59,168,12,18,14,13,23),(417,1,60,48,144,11,17,12,11,22),(1860,70,4860,2885,9109,153,109,280,133,190),(1860,69,4764,2751,8876,151,106,278,130,185),(1860,68,4529,2598,8409,148,104,276,127,175),(1860,67,4321,2444,7944,146,101,272,124,170),(1860,66,4145,2391,7481,144,99,268,122,168),(1860,65,3934,2237,7020,142,97,264,119,167),(1860,64,3830,2184,6561,139,95,259,102,164),(1860,63,3726,2030,6104,137,93,255,93,160),(1860,62,3627,1977,5649,135,91,253,86,158),(1860,61,3522,1925,5196,132,89,251,78,153),(1860,60,3419,1874,4745,129,85,249,70,150),(1860,59,3318,1824,4673,127,83,230,69,147),(1860,58,3222,1763,4579,125,82,224,68,144),(1860,57,3110,1714,4500,123,81,220,67,142),(1860,56,3006,1666,4428,121,80,215,66,139),(1860,55,2876,1620,4362,119,79,211,65,135),(1860,54,2840,1573,4302,115,76,207,64,133),(1860,53,2757,1527,4207,114,75,203,63,131),(1860,52,2661,1481,4136,112,74,198,62,128),(1860,51,2560,1435,4068,109,72,194,60,127),(1860,50,2527,1391,4013,107,71,190,59,123),(1860,49,2474,1347,3943,105,69,186,58,78),(1860,48,2436,1320,3868,102,68,181,57,76),(1860,47,2358,1294,3796,100,66,177,57,75),(1860,46,2349,1267,3722,98,65,173,57,73),(1860,45,2303,1240,3620,96,64,169,55,72),(1860,44,2290,1214,3463,91,61,164,54,71),(1860,43,2260,1187,3228,87,60,160,52,69),(1860,42,2215,1103,3034,81,59,156,51,67),(1860,41,2135,1063,2826,77,58,152,51,66),(1860,40,2052,1026,2675,74,57,147,50,64),(1860,39,1974,988,2496,72,56,142,49,62),(1860,38,1924,952,2331,70,55,139,49,61),(1860,37,1830,916,2246,69,53,138,48,59),(1860,36,1760,879,2150,67,52,137,47,58),(1860,35,1690,845,1911,64,51,136,46,57),(1860,34,1574,793,1861,63,50,135,46,56),(1860,33,1457,742,1812,62,49,131,45,54),(1860,32,1386,720,1766,60,47,127,43,53),(1860,31,1292,676,1715,59,47,123,42,52),(1860,30,1215,648,1667,57,46,118,41,51),(1860,29,1127,620,1619,57,44,114,40,49),(1860,28,1035,592,1572,55,43,110,39,48),(1860,27,968,564,1524,53,42,105,38,47),(1860,26,911,534,1474,52,41,101,37,46),(1860,25,854,504,1427,50,40,97,36,44),(1860,24,823,476,1378,49,39,93,35,43),(1860,23,746,447,1330,47,38,89,34,42),(1860,22,699,420,1282,46,36,84,33,41),(1860,21,653,393,1232,44,36,80,32,39),(1860,20,606,377,1165,42,35,67,31,49),(1860,19,566,351,1120,40,33,63,30,46),(1860,18,528,314,1068,39,33,59,28,38),(1860,17,490,300,1022,38,31,55,28,42),(1860,16,455,275,975,36,30,52,27,39),(1860,15,421,251,925,34,30,48,26,37),(1860,14,368,227,878,33,28,44,25,35),(1860,13,354,203,827,32,28,43,26,32),(1860,12,322,180,782,31,26,36,24,31),(1860,11,291,158,734,30,25,32,22,28),(1860,10,260,147,694,29,25,29,22,26),(1860,9,113,136,180,25,22,27,4,0),(1860,8,104,125,160,23,21,25,4,0),(1860,7,95,114,140,22,20,21,3,0),(1860,6,86,103,120,20,19,16,3,0),(1860,5,77,92,100,18,18,12,2,0),(1860,4,68,81,80,17,17,8,2,0),(1860,3,58,70,60,15,16,4,1,0),(1860,2,49,59,40,14,15,2,1,0),(1860,1,40,48,20,12,14,1,1,0),(1863,70,2164,2405,4293,153,108,280,133,122),(1863,69,2118,2351,3800,151,106,271,130,119),(1863,68,2073,2298,3450,148,104,266,127,117),(1863,67,2027,2244,3150,146,101,262,124,114),(1863,66,1982,2191,2910,144,99,258,122,112),(1863,65,1936,2137,2700,142,97,254,119,109),(1863,64,1891,2084,2550,139,95,249,116,107),(1863,63,1845,2030,2440,137,93,245,113,105),(1863,62,1800,1977,2380,135,91,241,111,103),(1863,61,1754,1925,2300,132,89,237,108,101),(1863,60,1709,1874,2261,130,87,232,106,98),(1863,59,1666,1824,2230,128,86,228,103,96),(1863,58,1623,1763,2189,125,84,224,101,94),(1863,57,1580,1714,2156,123,82,220,99,92),(1863,56,1536,1666,2113,121,80,215,96,90),(1863,55,1493,1620,2089,119,79,211,94,88),(1863,54,1450,1573,2056,116,77,207,92,87),(1863,53,1407,1527,2020,114,75,203,90,85),(1863,52,1364,1481,1984,112,74,198,88,83),(1863,51,1320,1435,1945,109,72,194,86,81),(1863,50,1277,1391,1912,107,71,190,84,80),(1863,49,1234,1347,1878,105,69,186,82,78),(1863,48,1196,1320,1843,102,68,181,80,76),(1863,47,1158,1294,1808,100,66,177,78,75),(1863,46,1119,1267,1773,98,65,173,77,73),(1863,45,1081,1240,1738,96,64,169,75,72),(1863,44,1043,1214,1670,91,61,164,74,71),(1863,43,1005,1187,1560,87,60,160,72,69),(1863,42,976,1103,1448,81,59,156,70,67),(1863,41,928,1063,1338,77,58,152,68,66),(1863,40,890,1026,1244,74,57,147,67,64),(1863,39,852,988,1163,72,56,142,68,62),(1863,38,814,952,1095,70,55,139,69,61),(1863,37,776,916,1038,69,53,138,70,59),(1863,36,737,879,990,67,52,137,72,58),(1863,35,699,845,950,63,51,136,73,57),(1863,34,661,793,908,64,50,135,76,56),(1863,33,728,742,884,62,49,131,74,54),(1863,32,680,720,862,60,47,127,73,53),(1863,31,631,676,838,59,47,123,71,52),(1863,30,599,648,815,57,46,118,69,51),(1863,29,566,620,791,57,44,114,67,49),(1863,28,534,592,768,55,43,110,65,48),(1863,27,501,564,745,53,42,105,63,47),(1863,26,469,534,721,52,41,101,62,46),(1863,25,440,504,699,50,40,97,60,44),(1863,24,400,476,675,49,39,93,57,43),(1863,23,373,447,652,47,38,89,56,42),(1863,22,349,420,628,46,36,84,54,41),(1863,21,325,393,604,44,36,80,53,39),(1863,20,303,377,563,42,35,67,31,49),(1863,19,293,351,550,40,33,72,29,39),(1863,18,262,314,510,39,32,67,24,38),(1863,17,250,300,460,37,31,63,20,37),(1863,16,229,275,400,36,30,59,16,36),(1863,15,209,251,360,34,29,55,14,35),(1863,14,189,227,320,33,28,50,11,35),(1863,13,169,203,280,31,27,46,9,34),(1863,12,150,180,240,29,26,42,8,33),(1863,11,132,158,220,28,25,38,6,32),(1863,10,123,147,200,26,23,33,5,31),(1863,9,113,136,180,25,22,29,4,31),(1863,8,104,125,160,23,21,25,4,30),(1863,7,95,114,140,22,20,21,3,29),(1863,6,86,103,120,20,19,16,3,29),(1863,5,77,92,100,18,18,12,2,28),(1863,4,68,81,80,17,17,8,2,27),(1863,3,58,70,60,15,16,4,1,27),(1863,2,49,59,40,14,15,2,1,26),(1863,1,40,48,20,12,14,1,1,25),(510,1,60,60,0,20,16,20,13,8),(510,2,73,73,0,21,17,21,14,10),(510,3,87,87,0,22,18,22,15,12),(510,4,101,101,0,23,19,23,16,14),(510,5,115,115,0,24,20,24,17,16),(510,6,129,129,0,25,21,25,18,18),(510,7,152,152,0,26,22,26,19,20),(510,8,156,156,0,27,23,27,20,22),(510,9,170,170,0,28,24,28,21,24),(510,10,184,184,0,29,25,29,22,26),(510,11,198,198,0,30,25,32,22,28),(510,12,225,225,0,31,26,36,24,31),(510,13,254,254,0,32,28,43,26,32),(510,14,284,254,0,33,28,44,25,35),(510,15,313,313,0,34,30,48,26,37),(510,16,343,343,0,36,30,52,27,39),(510,17,375,375,0,38,31,55,28,42),(510,18,392,392,0,39,33,59,28,44),(510,19,438,438,0,40,33,63,30,46),(510,20,471,471,0,42,35,67,31,49),(510,21,500,500,0,44,36,80,31,51),(510,22,528,528,0,46,36,84,32,53),(510,23,558,558,0,47,38,89,33,55),(510,24,595,595,0,49,39,83,34,58),(510,25,630,630,0,50,40,87,35,61),(510,26,678,678,0,52,41,91,36,62),(510,27,705,705,0,53,42,95,37,65),(510,28,740,740,0,55,43,99,38,67),(510,29,775,775,0,56,44,103,39,70),(510,30,800,800,0,58,46,107,40,72),(510,31,856,856,0,59,47,111,40,74),(510,32,921,921,0,61,48,115,41,77),(510,33,987,987,0,62,49,119,42,79),(510,34,1047,1047,0,63,51,123,43,82),(510,35,1107,1107,0,65,52,127,44,84),(510,36,1167,1167,0,66,53,131,45,87),(510,37,1227,1227,0,68,53,135,46,89),(510,38,1288,1288,0,70,55,139,47,91),(510,39,1348,1348,0,72,56,143,48,94),(510,40,1408,1408,0,74,58,148,49,97),(510,41,1468,1468,0,76,59,152,50,99),(510,42,1528,1528,0,81,59,156,51,102),(510,43,1588,1588,0,86,61,160,52,104),(510,44,1648,1648,0,89,62,164,53,107),(510,45,1708,1708,0,91,64,169,54,109),(510,46,1768,1768,0,94,65,173,55,112),(510,47,1828,1828,0,96,66,178,56,115),(510,48,1889,1889,0,99,68,182,57,117),(510,49,1950,1950,0,101,69,186,58,120),(510,50,2003,2003,0,104,71,191,59,123),(510,51,2055,2055,0,107,72,195,61,126),(510,52,2108,2108,0,109,73,199,62,128),(510,53,2161,2161,0,112,75,204,63,131),(510,54,2213,2213,0,114,76,208,64,134),(510,55,2266,2266,0,117,77,213,65,136),(510,56,2318,2318,0,119,79,217,66,139),(510,57,2371,2371,0,122,80,221,67,142),(510,58,2424,2425,0,124,82,226,68,144),(510,59,2476,2476,0,127,83,230,69,147),(510,60,2529,1874,0,129,85,234,70,150),(510,61,2582,2682,0,130,86,238,71,153),(510,62,2635,2735,0,131,87,242,72,156),(510,63,2688,2788,0,132,88,246,73,159),(510,64,2741,2841,0,133,89,250,74,162),(510,65,2794,2894,0,134,90,254,75,165),(510,66,2847,2947,0,135,91,258,76,168),(510,67,2900,3000,0,136,92,262,77,171),(510,68,2953,3053,0,137,93,266,78,174),(510,69,3006,3100,0,138,94,280,79,177),(510,70,3059,3212,0,139,95,284,80,180),(19668,1,100,0,100,10,10,0,0,0),(19668,2,100,0,100,10,10,0,0,0),(19668,3,100,0,100,10,10,0,0,0),(19668,4,100,0,100,10,10,0,0,0),(19668,5,100,0,100,10,10,0,0,0),(19668,6,100,0,100,10,10,0,0,0),(19668,7,100,0,100,10,10,0,0,0),(19668,8,100,0,100,10,10,0,0,0),(19668,9,100,0,100,10,10,0,0,0),(19668,10,100,0,100,10,10,0,0,0),(19668,11,100,0,100,10,10,0,0,0),(19668,12,100,0,100,10,10,0,0,0),(19668,13,100,0,100,10,10,0,0,0),(19668,14,100,0,100,10,10,0,0,0),(19668,15,100,0,100,10,10,0,0,0),(19668,16,100,0,100,10,10,0,0,0),(19668,17,100,0,100,10,10,0,0,0),(19668,18,100,0,100,10,10,0,0,0),(19668,19,100,0,100,10,10,0,0,0),(19668,20,100,0,100,10,10,0,0,0),(19668,21,100,0,100,10,10,0,0,0),(19668,22,100,0,100,10,10,0,0,0),(19668,23,100,0,100,10,10,0,0,0),(19668,24,100,0,100,10,10,0,0,0),(19668,25,100,0,100,10,10,0,0,0),(19668,26,100,0,100,10,10,0,0,0),(19668,27,100,0,100,10,10,0,0,0),(19668,28,100,0,100,10,10,0,0,0),(19668,29,100,0,100,10,10,0,0,0),(19668,30,100,0,100,10,10,0,0,0),(19668,31,100,0,100,10,10,0,0,0),(19668,32,100,0,100,10,10,0,0,0),(19668,33,100,0,100,10,10,0,0,0),(19668,34,100,0,100,10,10,0,0,0),(19668,35,100,0,100,10,10,0,0,0),(19668,36,100,0,100,10,10,0,0,0),(19668,37,100,0,100,10,10,0,0,0),(19668,38,100,0,100,10,10,0,0,0),(19668,39,100,0,100,10,10,0,0,0),(19668,40,100,0,100,10,10,0,0,0),(19668,41,100,0,100,10,10,0,0,0),(19668,42,100,0,100,10,10,0,0,0),(19668,43,100,0,100,10,10,0,0,0),(19668,44,100,0,100,10,10,0,0,0),(19668,45,100,0,100,10,10,0,0,0),(19668,46,100,0,100,10,10,0,0,0),(19668,47,100,0,100,10,10,0,0,0),(19668,48,100,0,100,10,10,0,0,0),(19668,49,100,0,100,10,10,0,0,0),(19668,50,100,0,100,10,10,0,0,0),(19668,51,100,0,100,10,10,0,0,0),(19668,52,100,0,100,10,10,0,0,0),(19668,53,100,0,100,10,10,0,0,0),(19668,54,100,0,100,10,10,0,0,0),(19668,55,100,0,100,10,10,0,0,0),(19668,56,100,0,100,10,10,0,0,0),(19668,57,100,0,100,10,10,0,0,0),(19668,58,100,0,100,10,10,0,0,0),(19668,59,100,0,100,10,10,0,0,0),(19668,60,100,0,100,10,10,0,0,0),(19668,61,100,0,100,10,10,0,0,0),(19668,62,100,0,100,10,10,0,0,0),(19668,63,100,0,100,10,10,0,0,0),(19668,64,100,0,100,10,10,0,0,0),(19668,65,100,0,100,10,10,0,0,0),(19668,66,7500,0,100,140,10,0,0,0),(19668,67,8000,0,100,140,10,0,0,0),(19668,68,8500,0,100,140,10,0,0,0),(19668,69,9000,0,100,140,10,0,0,0),(19668,70,9630,0,100,140,10,0,0,0),(575,1,100,0,100,10,10,0,0,0),(575,2,100,0,100,10,10,0,0,0),(575,3,100,0,100,10,10,0,0,0),(575,4,100,0,100,10,10,0,0,0),(575,5,100,0,100,10,10,0,0,0),(575,6,100,0,100,10,10,0,0,0),(575,7,100,0,100,10,10,0,0,0),(575,8,100,0,100,10,10,0,0,0),(575,9,100,0,100,10,10,0,0,0),(575,10,100,0,100,10,10,0,0,0),(575,11,100,0,100,10,10,0,0,0),(575,12,100,0,100,10,10,0,0,0),(575,13,100,0,100,10,10,0,0,0),(575,14,100,0,100,10,10,0,0,0),(575,15,100,0,100,10,10,0,0,0),(575,16,100,0,100,10,10,0,0,0),(575,17,100,0,100,10,10,0,0,0),(575,18,100,0,100,10,10,0,0,0),(575,19,100,0,100,10,10,0,0,0),(575,20,100,0,100,10,10,0,0,0),(575,21,100,0,100,10,10,0,0,0),(575,22,100,0,100,10,10,0,0,0),(575,23,100,0,100,10,10,0,0,0),(575,24,100,0,100,10,10,0,0,0),(575,25,100,0,100,10,10,0,0,0),(575,26,100,0,100,10,10,0,0,0),(575,27,100,0,100,10,10,0,0,0),(575,28,100,0,100,10,10,0,0,0),(575,29,100,0,100,10,10,0,0,0),(575,30,100,0,100,10,10,0,0,0),(575,31,100,0,100,10,10,0,0,0),(575,32,100,0,100,10,10,0,0,0),(575,33,100,0,100,10,10,0,0,0),(575,34,100,0,100,10,10,0,0,0),(575,35,1400,0,50,10,10,0,0,0),(575,36,1700,0,50,10,10,0,0,0),(575,37,100,0,100,10,10,0,0,0),(575,38,100,0,100,10,10,0,0,0),(575,39,100,0,100,10,10,0,0,0),(575,40,100,0,100,10,10,0,0,0),(575,41,100,0,100,10,10,0,0,0),(575,42,100,0,100,10,10,0,0,0),(575,43,100,0,100,10,10,0,0,0),(575,44,100,0,100,10,10,0,0,0),(575,45,100,0,100,10,10,0,0,0),(575,46,100,0,100,10,10,0,0,0),(575,47,100,0,100,10,10,0,0,0),(575,48,100,0,100,10,10,0,0,0),(575,49,100,0,100,10,10,0,0,0),(575,50,100,0,100,10,10,0,0,0),(575,51,100,0,100,10,10,0,0,0),(575,52,100,0,100,10,10,0,0,0),(575,53,100,0,100,10,10,0,0,0),(575,54,100,0,100,10,10,0,0,0),(575,55,100,0,100,10,10,0,0,0),(575,56,100,0,100,10,10,0,0,0),(575,57,100,0,100,10,10,0,0,0),(575,58,100,0,100,10,10,0,0,0),(575,59,100,0,100,10,10,0,0,0),(575,60,100,0,100,10,10,0,0,0),(575,61,100,0,100,10,10,0,0,0),(575,62,100,0,100,10,10,0,0,0),(575,63,100,0,100,10,10,0,0,0),(575,64,100,0,100,10,10,0,0,0),(575,65,100,0,100,10,10,0,0,0),(575,66,7500,0,100,140,10,0,0,0),(575,67,8000,0,100,140,10,0,0,0),(575,68,8500,0,100,140,10,0,0,0),(575,69,9000,0,100,140,10,0,0,0),(575,70,9630,0,100,140,10,0,0,0),(17252,1,40,48,20,12,14,1,1,25),(17252,2,49,59,40,14,15,2,1,26),(17252,3,58,70,60,15,16,4,1,27),(17252,4,68,81,80,17,17,8,2,27),(17252,5,77,92,100,18,18,12,2,28),(17252,6,86,103,120,20,19,16,3,29),(17252,7,95,114,140,22,20,21,3,29),(17252,8,104,125,160,23,21,25,4,30),(17252,9,113,136,180,25,22,29,4,31),(17252,10,123,147,200,26,23,33,5,31),(17252,11,132,158,220,28,25,38,6,32),(17252,12,150,180,240,29,26,42,8,33),(17252,13,169,203,280,31,27,46,9,34),(17252,14,189,227,320,33,28,50,11,35),(17252,15,209,251,360,34,29,55,14,35),(17252,16,229,275,400,36,30,59,16,36),(17252,17,250,300,460,37,31,63,20,37),(17252,18,262,314,510,39,32,67,24,38),(17252,19,293,351,550,40,33,72,29,39),(17252,20,303,377,563,42,35,67,31,49),(17252,21,325,393,604,44,36,80,53,39),(17252,22,349,420,628,46,36,84,54,41),(17252,23,373,447,652,47,38,89,56,42),(17252,24,400,476,675,49,39,93,57,43),(17252,25,440,504,699,50,40,97,60,44),(17252,26,469,534,721,52,41,101,62,46),(17252,27,501,564,745,53,42,105,63,47),(17252,28,534,592,768,55,43,110,65,48),(17252,29,566,620,791,57,44,114,67,49),(17252,30,599,648,815,57,46,118,69,51),(17252,31,631,676,838,59,47,123,71,52),(17252,32,680,720,862,60,47,127,73,53),(17252,33,728,742,884,62,49,131,74,54),(17252,34,661,793,908,64,50,135,76,56),(17252,35,699,845,950,63,51,136,73,57),(17252,36,737,879,990,67,52,137,72,58),(17252,37,776,916,1038,69,53,138,70,59),(17252,38,814,952,1095,70,55,139,69,61),(17252,39,852,988,1163,72,56,142,68,62),(17252,40,890,1026,1244,74,57,147,67,64),(17252,41,928,1063,1338,77,58,152,68,66),(17252,42,976,1103,1448,81,59,156,70,67),(17252,43,1005,1187,1560,87,60,160,72,69),(17252,44,1043,1214,1670,91,61,164,74,71),(17252,45,1081,1240,1738,96,64,169,75,72),(17252,46,1119,1267,1773,98,65,173,77,73),(17252,47,1158,1294,1808,100,66,177,78,75),(17252,48,1196,1320,1843,102,68,181,80,76),(17252,49,1234,1347,1878,105,69,186,82,78),(17252,50,2877,2391,3494,107,71,190,84,80),(17252,51,2920,2435,3559,109,72,223,97,81),(17252,52,3164,2481,3624,112,74,228,100,82),(17252,53,3207,2527,3686,113,75,233,102,84),(17252,54,3350,2573,3752,116,77,238,104,87),(17252,55,3493,2620,3814,119,78,243,106,88),(17252,56,3536,2766,3878,120,79,248,108,89),(17252,57,3680,2814,3941,123,82,251,111,92),(17252,58,3723,2913,4006,125,84,255,113,94),(17252,59,3866,2924,4067,128,86,258,115,96),(17252,60,3909,3174,4635,130,87,270,118,98),(17252,61,4054,3225,6300,132,90,274,121,101),(17252,62,4300,3377,6380,135,92,280,122,103),(17252,63,4545,3430,6440,137,93,286,123,105),(17252,64,4691,3584,6550,139,95,295,128,107),(17252,65,4749,3646,6612,142,98,300,129,110),(17252,66,4876,3778,6910,144,99,306,130,112),(17252,67,4984,3863,7150,146,101,310,131,114),(17252,68,5197,3949,7450,148,105,325,132,117),(17252,69,5208,4035,7800,151,107,335,133,119),(17252,70,5320,4170,7927,153,108,351,196,122),(14385,1,48,80,10,20,16,13,20,8),(14385,2,105,106,67,22,17,14,21,9),(14385,3,162,132,124,24,18,15,22,10),(14385,4,219,158,181,26,19,16,23,11),(14385,5,276,184,238,28,20,17,24,12),(14385,6,333,210,295,30,21,18,25,13),(14385,7,390,236,352,32,22,19,26,14),(14385,8,447,262,409,34,23,20,27,15),(14385,9,504,288,466,36,24,21,28,16),(14385,10,561,314,523,38,25,22,29,17),(14385,11,618,340,580,40,26,23,30,18),(14385,12,675,366,637,42,27,24,31,19),(14385,13,732,392,694,44,28,25,32,20),(14385,14,789,418,751,46,29,26,33,21),(14385,15,846,444,808,48,30,27,34,22),(14385,16,903,470,865,50,31,28,35,23),(14385,17,960,496,922,52,32,29,36,24),(14385,18,1017,522,979,54,33,30,37,25),(14385,19,1074,548,1036,56,34,31,38,26),(14385,20,1131,574,1093,58,35,32,39,27),(14385,21,1188,600,1150,60,36,33,40,28),(14385,22,1245,626,1207,62,37,34,41,29),(14385,23,1302,652,1264,64,38,35,42,30),(14385,24,1359,678,1321,66,39,36,43,31),(14385,25,1416,704,1378,68,40,37,44,32),(14385,26,1473,730,1435,70,41,38,45,33),(14385,27,1530,756,1492,72,42,39,46,34),(14385,28,1587,782,1549,74,43,40,47,35),(14385,29,1644,808,1606,76,44,41,48,36),(14385,30,1701,834,1663,78,45,42,49,37),(14385,31,1758,860,1720,80,46,43,50,38),(14385,32,1815,886,1777,82,47,44,51,39),(14385,33,1872,912,1834,84,48,45,52,40),(14385,34,1929,938,1891,86,49,46,53,41),(14385,35,1986,964,1948,88,50,47,54,42),(14385,36,2043,990,2005,90,51,48,55,43),(14385,37,2100,1016,2062,92,52,49,56,44),(14385,38,2157,1042,2119,94,53,50,57,45),(14385,39,2214,1068,2176,96,54,51,58,46),(14385,40,2271,1094,2233,98,55,52,59,47),(14385,41,2328,1120,2290,100,56,53,60,48),(14385,42,2385,1146,2347,102,57,54,61,49),(14385,43,2442,1172,2404,104,58,55,62,50),(14385,44,2499,1198,2461,106,59,56,63,51),(14385,45,2556,1224,2518,108,60,57,64,52),(14385,46,2613,1250,2575,110,61,58,65,53),(14385,47,2670,1276,2632,112,62,59,66,54),(14385,48,2727,1302,2689,114,63,60,67,55),(14385,49,2784,1328,2746,116,64,61,68,56),(14385,50,2841,1354,2803,118,65,62,69,57),(14385,51,2898,1380,2860,120,66,63,70,58),(14385,52,2955,1406,2917,122,67,64,71,59),(14385,53,3012,1432,2974,124,68,65,72,60),(14385,54,3069,1458,3031,126,69,66,73,61),(14385,55,3126,1484,3088,128,70,67,74,62),(14385,56,3183,1510,3145,130,71,68,75,63),(14385,57,3240,1536,3202,132,72,69,76,64),(14385,58,3297,1562,3259,134,73,70,77,65),(14385,59,3354,1588,3316,136,74,71,78,66),(14385,60,3411,1614,3373,138,75,72,79,67),(14385,61,3468,1640,3430,140,76,73,80,68),(14385,62,3525,1666,3487,142,77,74,81,69),(14385,63,3582,1692,3544,144,78,75,82,70),(14385,64,3639,1718,3601,146,79,76,83,71),(14385,65,3696,1744,3658,148,80,77,84,72),(14385,66,3753,1770,3715,150,81,78,85,73),(14385,67,3810,1796,3772,152,82,79,86,74),(14385,68,3867,1822,3829,154,83,80,87,75),(14385,69,3924,1848,3886,156,84,81,88,76),(14385,70,3981,1874,3943,158,85,82,89,77),(3450,1,14,40,0,20,20,20,24,23),(3450,2,19,49,0,21,20,20,25,24),(3450,3,24,58,0,22,20,21,26,25),(3450,4,29,67,0,23,21,21,27,26),(3450,5,34,76,0,23,21,22,28,27),(3450,6,40,85,0,24,21,22,29,27),(3450,7,46,95,0,25,21,23,30,28),(3450,8,52,105,0,26,21,23,31,29),(3450,9,58,116,0,27,21,23,32,30),(3450,10,64,126,0,27,22,24,33,31),(3450,11,75,151,0,28,22,24,37,35),(3450,12,83,177,0,29,22,26,41,39),(3450,13,91,198,0,30,22,26,44,43),(3450,14,120,234,0,31,22,28,50,47),(3450,15,129,262,0,32,23,29,54,52),(3450,16,138,290,0,34,23,30,57,56),(3450,17,147,318,0,36,23,31,61,60),(3450,18,156,346,0,37,23,32,65,65),(3450,19,165,374,0,38,23,33,70,69),(3450,20,175,402,0,40,24,35,74,74),(3450,21,184,430,0,42,24,37,87,78),(3450,22,193,458,0,44,24,39,91,82),(3450,23,202,486,0,45,24,40,95,86),(3450,24,212,514,0,46,25,42,94,90),(3450,25,224,539,0,47,25,43,94,95),(3450,26,237,568,0,48,25,43,98,100),(3450,27,249,598,0,50,25,42,102,104),(3450,28,262,632,0,51,25,44,109,110),(3450,29,274,667,0,52,26,44,114,114),(3450,30,287,702,0,54,26,45,120,118),(3450,31,299,734,0,55,26,46,124,123),(3450,32,312,772,0,57,26,47,128,128),(3450,33,324,807,0,58,27,48,132,131),(3450,34,338,842,0,60,27,50,136,135),(3450,35,360,898,0,62,27,51,139,136),(3450,36,382,954,0,65,27,52,142,137),(3450,37,404,1010,0,67,27,54,146,138),(3450,38,427,1066,0,70,28,55,149,139),(3450,39,449,1122,0,73,28,56,153,141),(3450,40,471,1178,0,75,28,58,156,142),(3450,41,493,1234,0,78,28,59,160,143),(3450,42,516,1290,0,80,29,60,163,144),(3450,43,538,1346,0,83,29,62,167,145),(3450,44,560,1402,0,86,29,63,170,147),(3450,45,582,1458,0,88,29,64,174,148),(3450,46,605,1514,0,91,30,66,177,149),(3450,47,627,1570,0,93,30,67,181,151),(3450,48,649,1627,0,96,30,68,184,152),(3450,49,672,1685,0,99,31,70,188,155),(3450,50,694,1704,0,101,31,71,194,160),(3450,51,716,1723,0,103,31,72,201,170),(3450,52,738,1743,0,105,32,74,208,180),(3450,53,761,1762,0,107,32,75,215,190),(3450,54,783,1781,0,109,32,77,222,200),(3450,55,805,1801,0,111,33,78,229,210),(3450,56,827,1820,0,113,33,80,236,220),(3450,57,850,1839,0,115,33,81,243,230),(3450,58,872,1859,0,117,34,83,250,240),(3450,59,894,1878,0,120,34,84,257,250),(3450,60,917,1898,0,122,35,86,264,260),(3450,61,939,1918,0,125,35,88,271,270),(3450,62,961,1937,0,128,36,89,278,280),(3450,63,983,1956,0,131,36,91,285,290),(3450,64,1005,1975,0,134,36,93,292,300),(3450,65,1027,1994,0,137,37,94,299,310),(3450,66,1049,2013,0,140,37,96,306,320),(3450,67,1072,2032,0,143,37,97,313,330),(3450,68,1094,2052,0,146,38,99,320,340),(3450,69,1126,2071,0,149,38,100,327,350),(3450,70,1149,2090,0,152,39,102,334,360),(8996,1,80,48,0,0,0,0,0,0),(8996,2,100,59,0,0,0,0,0,0),(8996,3,120,70,0,0,0,0,0,0),(8996,4,140,81,0,0,0,0,0,0),(8996,5,160,92,0,0,0,0,0,0),(8996,6,180,103,0,0,0,0,0,0),(8996,7,200,114,0,0,0,0,0,0),(8996,8,220,125,0,0,0,0,0,0),(8996,9,240,136,0,0,0,0,0,0),(8996,10,260,147,694,29,25,29,22,26),(8996,11,291,158,734,30,25,32,23,28),(8996,12,322,180,782,31,26,36,24,31),(8996,13,354,203,827,32,28,43,26,32),(8996,14,368,227,878,33,28,44,25,35),(8996,15,421,251,925,34,30,48,26,37),(8996,16,455,275,975,36,30,52,27,39),(8996,17,490,300,1022,38,31,55,28,42),(8996,18,528,314,1068,39,33,59,28,44),(8996,19,566,351,1120,40,33,63,29,46),(8996,20,606,377,1165,42,35,67,30,49),(8996,21,653,400,1232,44,36,80,31,51),(8996,22,699,423,1282,46,36,84,32,53),(8996,23,746,447,1330,47,38,89,33,55),(8996,24,823,476,1378,49,39,93,34,58),(8996,25,854,504,1427,50,40,97,35,61),(8996,26,911,543,1474,52,41,101,36,62),(8996,27,966,564,1524,53,42,105,37,65),(8996,28,1047,592,1572,55,43,110,38,67),(8996,29,1129,620,1619,56,44,114,39,70),(8996,30,1210,648,1667,58,46,118,40,72),(8996,31,1292,676,1715,59,47,123,40,74),(8996,32,1373,720,1766,61,48,127,41,77),(8996,33,1455,742,1812,62,49,131,42,79),(8996,34,1573,793,1861,63,51,135,43,82),(8996,35,1690,845,2000,65,52,136,44,84),(8996,36,1760,879,2154,66,53,137,45,87),(8996,37,1827,916,2248,68,53,138,46,89),(8996,38,1900,952,2331,70,55,139,47,91),(8996,39,1974,988,2483,72,56,144,48,94),(8996,40,2041,1026,2770,74,58,150,49,97),(8996,41,2127,1063,2856,76,59,153,50,99),(8996,42,2171,1103,3034,81,59,156,51,102),(8996,43,2215,1187,3228,86,61,169,52,104),(8996,44,2259,1214,2463,89,62,172,53,107),(8996,45,2303,1240,2638,91,64,175,54,109),(8996,46,2347,1267,2862,94,65,178,55,112),(8996,47,2391,1294,3021,96,66,181,56,115),(8996,48,2435,1320,3218,99,68,184,57,117),(8996,49,2479,1347,3370,101,69,187,58,120),(8996,50,2523,1391,3528,104,71,190,59,123),(8996,51,2568,1435,3963,107,72,193,61,126),(8996,52,2661,1481,4132,109,73,199,62,128),(8996,53,2755,1527,4286,112,75,203,63,131),(8996,54,2848,1573,4307,114,76,207,64,133),(8996,55,2942,1620,4389,117,77,213,65,136),(8996,56,3036,1666,4476,119,79,218,66,139),(8996,57,3129,1714,4532,122,80,222,67,142),(8996,58,3223,1763,4599,124,82,227,68,144),(8996,59,3317,1824,4673,127,83,230,69,147),(8996,60,3419,1874,4745,129,85,249,70,150),(8996,61,3522,1925,5238,131,87,252,78,153),(8996,62,3624,1977,5670,135,90,255,86,157),(8996,63,3727,2030,6133,138,94,258,93,160),(8996,64,3830,2084,6492,142,97,261,102,164),(8996,65,3934,2139,6981,145,101,264,110,167),(8996,66,4039,2195,7429,149,104,267,119,171),(8996,67,4143,2252,7912,152,108,270,125,175),(8996,68,4248,2310,8320,156,111,273,127,180),(8996,69,4352,2369,8693,159,115,276,130,185),(8996,70,4460,2429,9070,153,109,280,133,189),(10928,1,40,48,0,0,0,0,0,0),(10928,2,49,59,0,0,0,0,0,0),(10928,3,58,70,0,0,0,0,0,0),(10928,4,68,81,0,0,0,0,0,0),(10928,5,77,92,0,0,0,0,0,0),(10928,6,86,103,0,0,0,0,0,0),(10928,7,95,114,0,0,0,0,0,0),(10928,8,104,125,0,0,0,0,0,0),(10928,9,113,136,0,0,0,0,0,0),(10928,10,123,147,0,0,0,0,0,0),(10928,11,132,158,0,0,0,0,0,0),(10928,12,150,180,0,0,0,0,0,0),(10928,13,169,203,0,0,0,0,0,0),(10928,14,189,227,0,0,0,0,0,0),(10928,15,209,251,0,0,0,0,0,0),(10928,16,229,275,0,0,0,0,0,0),(10928,17,250,300,0,0,0,0,0,0),(10928,18,262,314,0,0,0,0,0,0),(10928,19,293,351,0,0,0,0,0,0),(10928,20,303,377,0,42,35,67,31,49),(10928,21,325,393,0,44,36,80,31,51),(10928,22,349,420,0,46,36,84,32,53),(10928,23,373,447,0,47,38,79,33,55),(10928,24,400,476,0,49,39,83,34,58),(10928,25,440,504,0,50,40,87,35,61),(10928,26,469,534,0,52,41,91,36,62),(10928,27,501,564,0,53,42,95,37,65),(10928,28,534,592,0,55,43,99,38,67),(10928,29,566,620,0,56,44,103,39,70),(10928,30,599,648,800,58,46,107,40,72),(10928,31,631,676,856,59,47,111,40,74),(10928,32,680,720,921,61,48,115,41,77),(10928,33,728,742,987,62,49,119,42,79),(10928,34,661,793,1047,63,51,123,43,82),(10928,35,699,845,1107,65,52,127,44,84),(10928,36,737,879,1167,66,53,131,45,87),(10928,37,776,916,1227,68,53,135,46,89),(10928,38,814,952,1288,70,55,139,47,91),(10928,39,852,988,1345,72,56,143,48,94),(10928,40,890,1026,1409,74,58,148,49,97),(10928,41,928,1063,1462,76,59,152,50,99),(10928,42,976,1103,1528,81,59,156,51,102),(10928,43,1005,1187,1586,86,61,160,52,104),(10928,44,1043,1214,1642,89,62,164,53,107),(10928,45,1081,1240,1708,91,64,169,54,109),(10928,46,1119,1267,1769,94,65,173,55,112),(10928,47,1158,1294,1826,96,66,178,56,115),(10928,48,1196,1320,1889,99,68,182,57,117),(10928,49,1234,1347,1950,101,69,186,58,120),(10928,50,1277,1391,2003,104,71,191,59,123),(10928,51,1320,1435,2055,107,72,195,61,126),(10928,52,1364,1481,2108,109,73,199,62,128),(10928,53,1407,1527,2161,112,75,204,63,131),(10928,54,1450,1573,2213,114,76,208,64,134),(10928,55,1493,1620,2266,117,77,213,65,136),(10928,56,1536,1666,2318,119,79,217,66,139),(10928,57,1580,1714,2371,122,80,221,67,142),(10928,58,1623,1763,2424,124,82,226,68,144),(10928,59,1666,1824,2476,127,83,230,69,147),(10928,60,1709,1874,2529,129,85,234,70,150),(10928,61,1754,1925,2583,132,86,239,72,154),(10928,62,1800,1977,2638,136,87,245,73,159),(10928,63,1845,2030,2693,140,88,250,74,163),(10928,64,1891,2084,2758,143,89,256,75,168),(10928,65,1936,2137,2823,147,90,261,76,172),(10928,66,1982,2191,2888,150,91,266,77,177),(10928,67,2027,2244,2944,154,92,272,78,181),(10928,68,2073,2298,3000,157,93,277,79,186),(10928,69,2118,2351,3056,161,94,283,80,190),(10928,70,2164,2405,3112,165,95,289,81,195),(12922,1,14,40,0,20,20,20,24,23),(12922,2,19,49,0,21,20,20,25,24),(12922,3,24,58,0,22,20,21,26,25),(12922,4,29,67,0,23,21,21,27,26),(12922,5,34,76,0,23,21,22,28,27),(12922,6,40,85,0,24,21,22,29,27),(12922,7,46,95,0,25,21,23,30,28),(12922,8,52,105,0,26,21,23,31,29),(12922,9,58,116,0,27,21,23,32,30),(12922,10,64,126,0,27,22,24,33,31),(12922,11,75,151,0,28,22,24,37,35),(12922,12,83,177,0,29,22,26,41,39),(12922,13,91,198,0,30,22,26,44,43),(12922,14,120,234,0,31,22,28,50,47),(12922,15,129,262,0,32,23,29,54,52),(12922,16,138,290,0,34,23,30,57,56),(12922,17,147,318,0,36,23,31,61,60),(12922,18,156,346,0,37,23,32,65,65),(12922,19,165,374,0,38,23,33,70,69),(12922,20,175,402,0,40,24,35,74,74),(12922,21,184,430,0,42,24,37,87,78),(12922,22,193,458,0,44,24,39,91,82),(12922,23,202,486,0,45,24,40,95,86),(12922,24,212,514,0,46,25,42,94,90),(12922,25,224,539,0,47,25,43,94,95),(12922,26,237,568,0,48,25,43,98,100),(12922,27,249,598,0,50,25,42,102,104),(12922,28,262,632,0,51,25,44,109,110),(12922,29,274,667,0,52,26,44,114,114),(12922,30,287,702,0,54,26,45,120,118),(12922,31,299,734,0,55,26,46,124,123),(12922,32,312,772,0,57,26,47,128,128),(12922,33,324,807,0,58,27,48,132,131),(12922,34,338,842,0,60,27,50,136,135),(12922,35,360,898,0,62,27,51,139,136),(12922,36,382,954,0,65,27,52,142,137),(12922,37,404,1010,0,67,27,54,146,138),(12922,38,427,1066,0,70,28,55,149,139),(12922,39,449,1122,0,73,28,56,153,141),(12922,40,471,1178,0,75,28,58,156,142),(12922,41,493,1234,0,78,28,59,160,143),(12922,42,516,1290,0,80,29,60,163,144),(12922,43,538,1346,0,83,29,62,167,145),(12922,44,560,1402,0,86,29,63,170,147),(12922,45,582,1458,0,88,29,64,174,148),(12922,46,605,1514,0,91,30,66,177,149),(12922,47,627,1570,0,93,30,67,181,151),(12922,48,649,1627,0,96,30,68,184,152),(12922,49,672,1685,0,99,31,70,188,155),(12922,50,694,1704,0,101,31,71,194,160),(12922,51,716,1723,0,103,31,72,201,170),(12922,52,738,1743,0,105,32,74,208,180),(12922,53,761,1762,0,107,32,75,215,190),(12922,54,783,1781,0,109,32,77,222,200),(12922,55,805,1801,0,111,33,78,229,210),(12922,56,827,1820,0,113,33,80,236,220),(12922,57,850,1839,0,115,33,81,243,230),(12922,58,872,1859,0,117,34,83,250,240),(12922,59,894,1878,0,120,34,84,257,250),(12922,60,917,1898,0,122,35,86,264,260),(12922,61,939,1918,0,125,35,88,271,270),(12922,62,961,1937,0,128,36,89,278,280),(12922,63,983,1956,0,131,36,91,285,290),(12922,64,1005,1975,0,134,36,93,292,300),(12922,65,1027,1994,0,137,37,94,299,310),(12922,66,1049,2013,0,140,37,96,306,320),(12922,67,1072,2032,0,143,37,97,313,330),(12922,68,1094,2052,0,146,38,99,320,340),(12922,69,1126,2071,0,149,38,100,327,350),(12922,70,1149,2090,0,152,39,102,334,360),(8477,1,80,48,0,0,0,0,0,0),(8477,2,100,59,0,0,0,0,0,0),(8477,3,120,70,0,0,0,0,0,0),(8477,4,140,81,0,0,0,0,0,0),(8477,5,160,92,0,0,0,0,0,0),(8477,6,180,103,0,0,0,0,0,0),(8477,7,200,114,0,0,0,0,0,0),(8477,8,220,125,0,0,0,0,0,0),(8477,9,240,136,0,0,0,0,0,0),(8477,10,260,147,694,29,25,29,22,26),(8477,11,291,158,734,30,25,32,23,28),(8477,12,322,180,782,31,26,36,24,31),(8477,13,354,203,827,32,28,43,26,32),(8477,14,368,227,878,33,28,44,25,35),(8477,15,421,251,925,34,30,48,26,37),(8477,16,455,275,975,36,30,52,27,39),(8477,17,490,300,1022,38,31,55,28,42),(8477,18,528,314,1068,39,33,59,28,44),(8477,19,566,351,1120,40,33,63,29,46),(8477,20,606,377,1165,42,35,67,30,49),(8477,21,653,400,1232,44,36,80,31,51),(8477,22,699,423,1282,46,36,84,32,53),(8477,23,746,447,1330,47,38,89,33,55),(8477,24,823,476,1378,49,39,93,34,58),(8477,25,854,504,1427,50,40,97,35,61),(8477,26,911,543,1474,52,41,101,36,62),(8477,27,966,564,1524,53,42,105,37,65),(8477,28,1047,592,1572,55,43,110,38,67),(8477,29,1129,620,1619,56,44,114,39,70),(8477,30,1210,648,1667,58,46,118,40,72),(8477,31,1292,676,1715,59,47,123,40,74),(8477,32,1373,720,1766,61,48,127,41,77),(8477,33,1455,742,1812,62,49,131,42,79),(8477,34,1573,793,1861,63,51,135,43,82),(8477,35,1690,845,2000,65,52,136,44,84),(8477,36,1760,879,2154,66,53,137,45,87),(8477,37,1827,916,2248,68,53,138,46,89),(8477,38,1900,952,2331,70,55,139,47,91),(8477,39,1974,988,2483,72,56,144,48,94),(8477,40,2041,1026,2770,74,58,150,49,97),(8477,41,2127,1063,2856,76,59,153,50,99),(8477,42,2171,1103,3034,81,59,156,51,102),(8477,43,2215,1187,3228,86,61,169,52,104),(8477,44,2259,1214,2463,89,62,172,53,107),(8477,45,2303,1240,2638,91,64,175,54,109),(8477,46,2347,1267,2862,94,65,178,55,112),(8477,47,2391,1294,3021,96,66,181,56,115),(8477,48,2435,1320,3218,99,68,184,57,117),(8477,49,2479,1347,3370,101,69,187,58,120),(8477,50,2523,1391,3528,104,71,190,59,123),(8477,51,2568,1435,3963,107,72,193,61,126),(8477,52,2661,1481,4132,109,73,199,62,128),(8477,53,2755,1527,4286,112,75,203,63,131),(8477,54,2848,1573,4307,114,76,207,64,133),(8477,55,2942,1620,4389,117,77,213,65,136),(8477,56,3036,1666,4476,119,79,218,66,139),(8477,57,3129,1714,4532,122,80,222,67,142),(8477,58,3223,1763,4599,124,82,227,68,144),(8477,59,3317,1824,4673,127,83,230,69,147),(8477,60,3419,1874,4745,129,85,249,70,150),(8477,61,3522,1925,5238,131,87,252,78,153),(8477,62,3624,1977,5670,135,90,255,86,157),(8477,63,3727,2030,6133,138,94,258,93,160),(8477,64,3830,2084,6492,142,97,261,102,164),(8477,65,3934,2139,6981,145,101,264,110,167),(8477,66,4039,2195,7429,149,104,267,119,171),(8477,67,4143,2252,7912,152,108,270,125,175),(8477,68,4248,2310,8320,156,111,273,127,180),(8477,69,4352,2369,8693,159,115,276,130,185),(8477,70,4460,2429,9070,153,109,280,133,189),(24815,1,14,40,0,20,20,20,24,23),(24815,2,19,49,0,21,20,20,25,24),(24815,3,24,58,0,22,20,21,26,25),(24815,4,29,67,0,23,21,21,27,26),(24815,5,34,76,0,23,21,22,28,27),(24815,6,40,85,0,24,21,22,29,27),(24815,7,46,95,0,25,21,23,30,28),(24815,8,52,105,0,26,21,23,31,29),(24815,9,58,116,0,27,21,23,32,30),(24815,10,64,126,0,27,22,24,33,31),(24815,11,75,151,0,28,22,24,37,35),(24815,12,83,177,0,29,22,26,41,39),(24815,13,91,198,0,30,22,26,44,43),(24815,14,120,234,0,31,22,28,50,47),(24815,15,129,262,0,32,23,29,54,52),(24815,16,138,290,0,34,23,30,57,56),(24815,17,147,318,0,36,23,31,61,60),(24815,18,156,346,0,37,23,32,65,65),(24815,19,165,374,0,38,23,33,70,69),(24815,20,175,402,0,40,24,35,74,74),(24815,21,184,430,0,42,24,37,87,78),(24815,22,193,458,0,44,24,39,91,82),(24815,23,202,486,0,45,24,40,95,86),(24815,24,212,514,0,46,25,42,94,90),(24815,25,224,539,0,47,25,43,94,95),(24815,26,237,568,0,48,25,43,98,100),(24815,27,249,598,0,50,25,42,102,104),(24815,28,262,632,0,51,25,44,109,110),(24815,29,274,667,0,52,26,44,114,114),(24815,30,287,702,0,54,26,45,120,118),(24815,31,299,734,0,55,26,46,124,123),(24815,32,312,772,0,57,26,47,128,128),(24815,33,324,807,0,58,27,48,132,131),(24815,34,338,842,0,60,27,50,136,135),(24815,35,360,898,0,62,27,51,139,136),(24815,36,382,954,0,65,27,52,142,137),(24815,37,404,1010,0,67,27,54,146,138),(24815,38,427,1066,0,70,28,55,149,139),(24815,39,449,1122,0,73,28,56,153,141),(24815,40,471,1178,0,75,28,58,156,142),(24815,41,493,1234,0,78,28,59,160,143),(24815,42,516,1290,0,80,29,60,163,144),(24815,43,538,1346,0,83,29,62,167,145),(24815,44,560,1402,0,86,29,63,170,147),(24815,45,582,1458,0,88,29,64,174,148),(24815,46,605,1514,0,91,30,66,177,149),(24815,47,627,1570,0,93,30,67,181,151),(24815,48,649,1627,0,96,30,68,184,152),(24815,49,672,1685,0,99,31,70,188,155),(24815,50,694,1704,0,101,31,71,194,160),(24815,51,716,1723,0,103,31,72,201,170),(24815,52,738,1743,0,105,32,74,208,180),(24815,53,761,1762,0,107,32,75,215,190),(24815,54,783,1781,0,109,32,77,222,200),(24815,55,805,1801,0,111,33,78,229,210),(24815,56,827,1820,0,113,33,80,236,220),(24815,57,850,1839,0,115,33,81,243,230),(24815,58,872,1859,0,117,34,83,250,240),(24815,59,894,1878,0,120,34,84,257,250),(24815,60,917,1898,0,122,35,86,264,260),(24815,61,939,1918,0,125,35,88,271,270),(24815,62,961,1937,0,128,36,89,278,280),(24815,63,983,1956,0,131,36,91,285,290),(24815,64,1005,1975,0,134,36,93,292,300),(24815,65,1027,1994,0,137,37,94,299,310),(24815,66,1049,2013,0,140,37,96,306,320),(24815,67,1072,2032,0,143,37,97,313,330),(24815,68,1094,2052,0,146,38,99,320,340),(24815,69,1126,2071,0,149,38,100,327,350),(24815,70,1149,2090,0,152,39,102,334,360),(22362,1,14,40,20,20,20,20,24,23),(22362,2,19,49,24,21,20,20,25,24),(22362,3,24,58,28,22,20,21,26,25),(22362,4,29,67,33,23,21,21,27,26),(22362,5,34,76,49,23,21,22,28,27),(22362,6,40,85,68,24,21,22,29,27),(22362,7,46,95,92,25,21,23,30,28),(22362,8,52,105,117,26,21,23,31,29),(22362,9,58,116,147,27,21,23,32,30),(22362,10,64,126,180,27,22,24,33,31),(22362,11,75,151,190,28,22,24,37,35),(22362,12,83,177,203,29,22,26,41,39),(22362,13,91,198,215,30,22,26,44,43),(22362,14,120,234,228,31,22,28,50,47),(22362,15,129,262,240,32,23,29,54,52),(22362,16,138,290,253,34,23,30,57,56),(22362,17,147,318,265,36,23,31,61,60),(22362,18,156,346,278,37,23,32,65,65),(22362,19,165,374,291,38,23,33,70,69),(22362,20,175,402,303,40,24,35,74,74),(22362,21,184,430,320,42,24,37,87,78),(22362,22,193,458,346,44,24,39,91,82),(22362,23,202,486,360,45,24,40,95,86),(22362,24,212,514,373,46,25,42,94,90),(22362,25,224,539,386,47,25,43,94,95),(22362,26,237,568,399,48,25,43,98,100),(22362,27,249,598,411,50,25,42,102,104),(22362,28,262,632,424,51,25,44,109,110),(22362,29,274,667,436,52,26,44,114,114),(22362,30,287,702,449,54,26,45,120,118),(22362,31,299,734,462,55,26,46,124,123),(22362,32,312,772,478,57,26,47,128,128),(22362,33,324,807,488,58,27,48,132,131),(22362,34,338,842,501,60,27,50,136,135),(22362,35,360,898,536,62,27,51,139,136),(22362,36,382,954,572,65,27,52,142,137),(22362,37,404,1010,604,67,27,54,146,138),(22362,38,427,1066,643,70,28,55,149,139),(22362,39,449,1122,682,73,28,56,153,141),(22362,40,471,1178,701,75,28,58,156,142),(22362,41,493,1234,726,78,28,59,160,143),(22362,42,516,1290,756,80,29,60,163,144),(22362,43,538,1346,782,83,29,62,167,145),(22362,44,560,1402,815,86,29,63,170,147),(22362,45,582,1458,843,88,29,64,174,148),(22362,46,605,1514,878,91,30,66,177,149),(22362,47,627,1570,900,93,30,67,181,151),(22362,48,649,1627,924,96,30,68,184,152),(22362,49,672,1685,946,99,31,70,188,155),(22362,50,694,1704,979,101,31,71,194,160),(22362,51,716,1723,999,103,31,72,201,170),(22362,52,738,1743,1020,105,32,74,208,180),(22362,53,761,1762,1039,107,32,75,215,190),(22362,54,783,1781,1055,109,32,77,222,200),(22362,55,805,1801,1073,111,33,78,229,210),(22362,56,827,1820,1091,113,33,80,236,220),(22362,57,850,1839,1107,115,33,81,243,230),(22362,58,872,1859,1123,117,34,83,250,240),(22362,59,894,1878,1148,120,34,84,257,250),(22362,60,917,1898,1163,122,35,86,264,260),(22362,61,939,1918,1260,125,35,88,271,270),(22362,62,961,1937,1398,128,36,89,278,280),(22362,63,983,1956,1420,131,36,91,285,290),(22362,64,1005,1975,1572,134,36,93,292,300),(22362,65,1027,1994,1699,137,37,94,299,310),(22362,66,1049,2013,1840,140,37,96,306,320),(22362,67,1072,2032,1939,143,37,97,313,330),(22362,68,1094,2052,2070,146,38,99,320,340),(22362,69,1126,2071,2130,149,38,100,327,350),(22362,70,1149,2090,2207,152,39,102,334,360),(10979,1,14,40,0,20,20,20,24,23),(10979,2,19,49,0,21,20,20,25,24),(10979,3,24,58,0,22,20,21,26,25),(10979,4,29,67,0,23,21,21,27,26),(10979,5,34,76,0,23,21,22,28,27),(10979,6,40,85,0,24,21,22,29,27),(10979,7,46,95,0,25,21,23,30,28),(10979,8,52,105,0,26,21,23,31,29),(10979,9,58,116,0,27,21,23,32,30),(10979,10,64,126,0,27,22,24,33,31),(10979,11,75,151,0,28,22,24,37,35),(10979,12,83,177,0,29,22,26,41,39),(10979,13,91,198,0,30,22,26,44,43),(10979,14,120,234,0,31,22,28,50,47),(10979,15,129,262,0,32,23,29,54,52),(10979,16,138,290,0,34,23,30,57,56),(10979,17,147,318,0,36,23,31,61,60),(10979,18,156,346,0,37,23,32,65,65),(10979,19,165,374,0,38,23,33,70,69),(10979,20,175,402,0,40,24,35,74,74),(10979,21,184,430,0,42,24,37,87,78),(10979,22,193,458,0,44,24,39,91,82),(10979,23,202,486,0,45,24,40,95,86),(10979,24,212,514,0,46,25,42,94,90),(10979,25,224,539,0,47,25,43,94,95),(10979,26,237,568,0,48,25,43,98,100),(10979,27,249,598,0,50,25,42,102,104),(10979,28,262,632,0,51,25,44,109,110),(10979,29,274,667,0,52,26,44,114,114),(10979,30,287,702,0,54,26,45,120,118),(10979,31,299,734,0,55,26,46,124,123),(10979,32,312,772,0,57,26,47,128,128),(10979,33,324,807,0,58,27,48,132,131),(10979,34,338,842,0,60,27,50,136,135),(10979,35,360,898,0,62,27,51,139,136),(10979,36,382,954,0,65,27,52,142,137),(10979,37,404,1010,0,67,27,54,146,138),(10979,38,427,1066,0,70,28,55,149,139),(10979,39,449,1122,0,73,28,56,153,141),(10979,40,471,1178,0,75,28,58,156,142),(10979,41,493,1234,0,78,28,59,160,143),(10979,42,516,1290,0,80,29,60,163,144),(10979,43,538,1346,0,83,29,62,167,145),(10979,44,560,1402,0,86,29,63,170,147),(10979,45,582,1458,0,88,29,64,174,148),(10979,46,605,1514,0,91,30,66,177,149),(10979,47,627,1570,0,93,30,67,181,151),(10979,48,649,1627,0,96,30,68,184,152),(10979,49,672,1685,0,99,31,70,188,155),(10979,50,694,1704,0,101,31,71,194,160),(10979,51,716,1723,0,103,31,72,201,170),(10979,52,738,1743,0,105,32,74,208,180),(10979,53,761,1762,0,107,32,75,215,190),(10979,54,783,1781,0,109,32,77,222,200),(10979,55,805,1801,0,111,33,78,229,210),(10979,56,827,1820,0,113,33,80,236,220),(10979,57,850,1839,0,115,33,81,243,230),(10979,58,872,1859,0,117,34,83,250,240),(10979,59,894,1878,0,120,34,84,257,250),(10979,60,917,1898,0,122,35,86,264,260),(10979,61,939,1918,0,125,35,88,271,270),(10979,62,961,1937,0,128,36,89,278,280),(10979,63,983,1956,0,131,36,91,285,290),(10979,64,1005,1975,0,134,36,93,292,300),(10979,65,1027,1994,0,137,37,94,299,310),(10979,66,1049,2013,0,140,37,96,306,320),(10979,67,1072,2032,0,143,37,97,313,330),(10979,68,1094,2052,0,146,38,99,320,340),(10979,69,1126,2071,0,149,38,100,327,350),(10979,70,1149,2090,0,152,39,102,334,360),(15352,1,1,0,1,1,1,1,1,1),(15352,2,1,0,1,1,1,1,1,1),(15352,3,1,0,1,1,1,1,1,1),(15352,4,1,0,1,1,1,1,1,1),(15352,5,1,0,1,1,1,1,1,1),(15352,6,1,0,1,1,1,1,1,1),(15352,7,1,0,1,1,1,1,1,1),(15352,8,1,0,1,1,1,1,1,1),(15352,9,1,0,1,1,1,1,1,1),(15352,10,1,0,1,1,1,1,1,1),(15352,11,1,0,1,1,1,1,1,1),(15352,12,1,0,1,1,1,1,1,1),(15352,13,1,0,1,1,1,1,1,1),(15352,14,1,0,1,1,1,1,1,1),(15352,15,1,0,1,1,1,1,1,1),(15352,16,1,0,1,1,1,1,1,1),(15352,17,1,0,1,1,1,1,1,1),(15352,18,1,0,1,1,1,1,1,1),(15352,19,1,0,1,1,1,1,1,1),(15352,20,1,0,1,1,1,1,1,1),(15352,21,1,0,1,1,1,1,1,1),(15352,22,1,0,1,1,1,1,1,1),(15352,23,1,0,1,1,1,1,1,1),(15352,24,1,0,1,1,1,1,1,1),(15352,25,1,0,1,1,1,1,1,1),(15352,26,1,0,1,1,1,1,1,1),(15352,27,1,0,1,1,1,1,1,1),(15352,28,1,0,1,1,1,1,1,1),(15352,29,1,0,1,1,1,1,1,1),(15352,30,1,0,1,1,1,1,1,1),(15352,31,1,0,1,1,1,1,1,1),(15352,32,1,0,1,1,1,1,1,1),(15352,33,1,0,1,1,1,1,1,1),(15352,34,1,0,1,1,1,1,1,1),(15352,35,1,0,1,1,1,1,1,1),(15352,36,1,0,1,1,1,1,1,1),(15352,37,1,0,1,1,1,1,1,1),(15352,38,1,0,1,1,1,1,1,1),(15352,39,1,0,1,1,1,1,1,1),(15352,40,1,0,1,1,1,1,1,1),(15352,41,1,0,1,1,1,1,1,1),(15352,42,1,0,1,1,1,1,1,1),(15352,43,1,0,1,1,1,1,1,1),(15352,44,1,0,1,1,1,1,1,1),(15352,45,1,0,1,1,1,1,1,1),(15352,46,1,0,1,1,1,1,1,1),(15352,47,1,0,1,1,1,1,1,1),(15352,48,1,0,1,1,1,1,1,1),(15352,49,1,0,1,1,1,1,1,1),(15352,50,1,0,1,1,1,1,1,1),(15352,51,1,0,1,1,1,1,1,1),(15352,52,1,0,1,1,1,1,1,1),(15352,53,1,0,1,1,1,1,1,1),(15352,54,1,0,1,1,1,1,1,1),(15352,55,1,0,1,1,1,1,1,1),(15352,56,1,0,1,1,1,1,1,1),(15352,57,1,0,1,1,1,1,1,1),(15352,58,1,0,1,1,1,1,1,1),(15352,59,1,0,1,1,1,1,1,1),(15352,60,1,0,1,1,1,1,1,1),(15352,61,1,0,1,1,1,1,1,1),(15352,62,1,0,1,1,1,1,1,1),(15352,63,1,0,1,1,1,1,1,1),(15352,64,1,0,1,1,1,1,1,1),(15352,65,1,0,1,1,1,1,1,1),(15352,66,6600,0,6200,132,62,96,132,320),(15352,67,6700,0,6400,134,64,97,134,330),(15352,68,6800,0,6600,136,66,99,136,340),(15352,69,6900,0,6800,138,68,100,138,350),(15352,70,7000,0,7000,140,70,102,140,360),(15438,1,1,1,1,1,1,1,1,1),(15438,2,1,1,1,1,1,1,1,1),(15438,3,1,1,1,1,1,1,1,1),(15438,4,1,1,1,1,1,1,1,1),(15438,5,1,1,1,1,1,1,1,1),(15438,6,1,1,1,1,1,1,1,1),(15438,7,1,1,1,1,1,1,1,1),(15438,8,1,1,1,1,1,1,1,1),(15438,9,1,1,1,1,1,1,1,1),(15438,10,1,1,1,1,1,1,1,1),(15438,11,1,1,1,1,1,1,1,1),(15438,12,1,1,1,1,1,1,1,1),(15438,13,1,1,1,1,1,1,1,1),(15438,14,1,1,1,1,1,1,1,1),(15438,15,1,1,1,1,1,1,1,1),(15438,16,1,1,1,1,1,1,1,1),(15438,17,1,1,1,1,1,1,1,1),(15438,18,1,1,1,1,1,1,1,1),(15438,19,1,1,1,1,1,1,1,1),(15438,20,1,1,1,1,1,1,1,1),(15438,21,1,1,1,1,1,1,1,1),(15438,22,1,1,1,1,1,1,1,1),(15438,23,1,1,1,1,1,1,1,1),(15438,24,1,1,1,1,1,1,1,1),(15438,25,1,1,1,1,1,1,1,1),(15438,26,1,1,1,1,1,1,1,1),(15438,27,1,1,1,1,1,1,1,1),(15438,28,1,1,1,1,1,1,1,1),(15438,29,1,1,1,1,1,1,1,1),(15438,30,1,1,1,1,1,1,1,1),(15438,31,1,1,1,1,1,1,1,1),(15438,32,1,1,1,1,1,1,1,1),(15438,33,1,1,1,1,1,1,1,1),(15438,34,1,1,1,1,1,1,1,1),(15438,35,1,1,1,1,1,1,1,1),(15438,36,1,1,1,1,1,1,1,1),(15438,37,1,1,1,1,1,1,1,1),(15438,38,1,1,1,1,1,1,1,1),(15438,39,1,1,1,1,1,1,1,1),(15438,40,1,1,1,1,1,1,1,1),(15438,41,1,1,1,1,1,1,1,1),(15438,42,1,1,1,1,1,1,1,1),(15438,43,1,1,1,1,1,1,1,1),(15438,44,1,1,1,1,1,1,1,1),(15438,45,1,1,1,1,1,1,1,1),(15438,46,1,1,1,1,1,1,1,1),(15438,47,1,1,1,1,1,1,1,1),(15438,48,1,1,1,1,1,1,1,1),(15438,49,1,1,1,1,1,1,1,1),(15438,50,1,1,1,1,1,1,1,1),(15438,51,1,1,1,1,1,1,1,1),(15438,52,1,1,1,1,1,1,1,1),(15438,53,1,1,1,1,1,1,1,1),(15438,54,1,1,1,1,1,1,1,1),(15438,55,1,1,1,1,1,1,1,1),(15438,56,1,1,1,1,1,1,1,1),(15438,57,1,1,1,1,1,1,1,1),(15438,58,1,1,1,1,1,1,1,1),(15438,59,1,1,1,1,1,1,1,1),(15438,60,1,1,1,1,1,1,1,1),(15438,61,1,1,1,1,1,1,1,1),(15438,62,1,1,1,1,1,1,1,1),(15438,63,1,1,1,1,1,1,1,1),(15438,64,1,1,1,1,1,1,1,1),(15438,65,1,1,1,1,1,1,1,1),(15438,66,1,1,1,1,1,1,1,1),(15438,67,1,1,1,1,1,1,1,1),(15438,68,6800,2052,980,198,136,99,320,340),(15438,69,6900,2071,990,204,138,100,327,350),(15438,70,7000,2090,1000,210,140,102,334,360),(26101,1,1,1,0,1,1,1,1,1),(26101,2,1,1,0,1,1,1,1,1),(26101,3,1,1,0,1,1,1,1,1),(26101,4,1,1,0,1,1,1,1,1),(26101,5,1,1,0,1,1,1,1,1),(26101,6,1,1,0,1,1,1,1,1),(26101,7,1,1,0,1,1,1,1,1),(26101,8,1,1,0,1,1,1,1,1),(26101,9,1,1,0,1,1,1,1,1),(26101,10,1,1,0,1,1,1,1,1),(26101,11,1,1,0,1,1,1,1,1),(26101,12,1,1,0,1,1,1,1,1),(26101,13,1,1,0,1,1,1,1,1),(26101,14,1,1,0,1,1,1,1,1),(26101,15,1,1,0,1,1,1,1,1),(26101,16,1,1,0,1,1,1,1,1),(26101,17,1,1,0,1,1,1,1,1),(26101,18,1,1,0,1,1,1,1,1),(26101,19,1,1,0,1,1,1,1,1),(26101,20,1,1,0,1,1,1,1,1),(26101,21,1,1,0,1,1,1,1,1),(26101,22,1,1,0,1,1,1,1,1),(26101,23,1,1,0,1,1,1,1,1),(26101,24,1,1,0,1,1,1,1,1),(26101,25,1,1,0,1,1,1,1,1),(26101,26,1,1,0,1,1,1,1,1),(26101,27,1,1,0,1,1,1,1,1),(26101,28,1,1,0,1,1,1,1,1),(26101,29,1,1,0,1,1,1,1,1),(26101,30,1,1,0,1,1,1,1,1),(26101,31,1,1,0,1,1,1,1,1),(26101,32,1,1,0,1,1,1,1,1),(26101,33,1,1,0,1,1,1,1,1),(26101,34,1,1,0,1,1,1,1,1),(26101,35,1,1,0,1,1,1,1,1),(26101,36,1,1,0,1,1,1,1,1),(26101,37,1,1,0,1,1,1,1,1),(26101,38,1,1,0,1,1,1,1,1),(26101,39,1,1,0,1,1,1,1,1),(26101,40,1,1,0,1,1,1,1,1),(26101,41,1,1,0,1,1,1,1,1),(26101,42,1,1,0,1,1,1,1,1),(26101,43,1,1,0,1,1,1,1,1),(26101,44,1,1,0,1,1,1,1,1),(26101,45,1,1,0,1,1,1,1,1),(26101,46,1,1,0,1,1,1,1,1),(26101,47,1,1,0,1,1,1,1,1),(26101,48,1,1,0,1,1,1,1,1),(26101,49,1,1,0,1,1,1,1,1),(26101,50,1,1,0,1,1,1,1,1),(26101,51,1,1,0,1,1,1,1,1),(26101,52,1,1,0,1,1,1,1,1),(26101,53,1,1,0,1,1,1,1,1),(26101,54,1,1,0,1,1,1,1,1),(26101,55,1,1,0,1,1,1,1,1),(26101,56,1,1,0,1,1,1,1,1),(26101,57,1,1,0,1,1,1,1,1),(26101,58,1,1,0,1,1,1,1,1),(26101,59,1,1,0,1,1,1,1,1),(26101,60,1,1,0,1,1,1,1,1),(26101,61,1,1,0,1,1,1,1,1),(26101,62,1,1,0,1,1,1,1,1),(26101,63,1,1,0,1,1,1,1,1),(26101,64,1,1,0,1,1,1,1,1),(26101,65,1,1,0,1,1,1,1,1),(26101,66,1,1,0,1,1,1,1,1),(26101,67,1,1,0,1,1,1,1,1),(26101,68,1,1,0,1,1,1,1,1),(26101,69,1,1,0,1,1,1,1,1),(26101,70,11352,3155,6792,152,39,102,334,360),(26101,71,1172,2109,0,155,39,104,341,370),(26101,72,1195,2128,0,158,40,106,348,380),(26101,73,1218,2147,0,161,40,108,355,390),(26101,74,1241,2166,0,164,40,110,362,400),(26101,75,1264,2185,0,167,41,112,369,410),(26101,76,1287,2204,0,170,41,114,376,420),(26101,77,1310,2223,0,173,41,116,383,430),(26101,78,1333,2242,0,176,42,118,390,440),(26101,79,1356,2261,0,179,42,120,397,450),(26101,80,1379,2280,0,182,42,122,404,460),(24815,71,1174,2110,0,158,40,105,347,370),(24815,72,1190,2132,0,164,40,106,354,380),(24815,73,1204,2145,0,179,42,108,363,390),(24815,74,1219,2159,0,188,43,110,377,400),(24815,75,1231,2172,0,200,44,113,390,410),(24815,76,1250,2190,0,211,45,115,402,420),(24815,77,1269,2203,0,225,46,118,420,430),(24815,78,1281,2220,0,236,47,131,439,440),(24815,79,1299,2239,0,249,48,140,450,450),(24815,80,1314,2252,0,261,50,162,470,460),(22362,71,1174,2110,0,158,40,105,347,370),(22362,72,1190,2132,0,164,40,106,354,380),(22362,73,1204,2145,0,179,42,108,363,390),(22362,74,1219,2159,0,188,43,110,377,400),(22362,75,1231,2172,0,200,44,113,390,410),(22362,76,1250,2190,0,211,45,115,402,420),(22362,77,1269,2203,0,225,46,118,420,430),(22362,78,1281,2220,0,236,47,131,439,440),(22362,79,1299,2239,0,249,48,140,450,450),(22362,80,1314,2252,0,261,50,162,470,460),(14385,71,4046,1902,4233,160,88,84,91,78),(14385,72,4112,1931,4528,162,88,84,92,80),(14385,73,4179,1960,4828,163,90,86,94,81),(14385,74,4247,1990,5133,164,90,87,95,82),(14385,75,4315,2021,5438,166,94,88,97,84),(14385,76,4384,2051,5748,168,95,90,98,86),(14385,77,4454,2084,6058,170,95,91,99,87),(14385,78,4525,2116,6368,174,96,92,100,88),(14385,79,4597,2149,6683,178,97,92,101,88),(14385,80,4665,2186,6993,181,98,95,103,90),(12922,71,1174,2110,0,158,40,105,347,370),(12922,72,1190,2132,0,164,40,106,354,380),(12922,73,1204,2145,0,179,42,108,363,390),(12922,74,1219,2159,0,188,43,110,377,400),(12922,75,1231,2172,0,200,44,113,390,410),(12922,76,1250,2190,0,211,45,115,402,420),(12922,77,1269,2203,0,225,46,118,420,430),(12922,78,1281,2220,0,236,47,131,439,440),(12922,79,1299,2239,0,249,48,140,450,450),(12922,80,1314,2252,0,261,50,162,470,460),(10979,71,1174,2110,0,158,40,105,347,370),(10979,72,1190,2132,0,164,40,106,354,380),(10979,73,1204,2145,0,179,42,108,363,390),(10979,74,1219,2159,0,188,43,110,377,400),(10979,75,1231,2172,0,200,44,113,390,410),(10979,76,1250,2190,0,211,45,115,402,420),(10979,77,1269,2203,0,225,46,118,420,430),(10979,78,1281,2220,0,236,47,131,439,440),(10979,79,1299,2239,0,249,48,140,450,450),(10979,80,1314,2252,0,261,50,162,470,460),(10928,71,1174,2110,0,158,40,105,347,370),(10928,72,1190,2132,0,164,40,106,354,380),(10928,73,1204,2145,0,179,42,108,363,390),(10928,74,1219,2159,0,188,43,110,377,400),(10928,75,1231,2172,0,200,44,113,390,410),(10928,76,1250,2190,0,211,45,115,402,420),(10928,77,1269,2203,0,225,46,118,420,430),(10928,78,1281,2220,0,236,47,131,439,440),(10928,79,1299,2239,0,249,48,140,450,450),(10928,80,1314,2252,0,261,50,162,470,460),(8996,71,1174,2110,0,158,40,105,347,370),(8996,72,1190,2132,0,164,40,106,354,380),(8996,73,1204,2145,0,179,42,108,363,390),(8996,74,1219,2159,0,188,43,110,377,400),(8996,75,1231,2172,0,200,44,113,390,410),(8996,76,1250,2190,0,211,45,115,402,420),(8996,77,1269,2203,0,225,46,118,420,430),(8996,78,1281,2220,0,236,47,131,439,440),(8996,79,1299,2239,0,249,48,140,450,450),(8996,80,1314,2252,0,261,50,162,470,460),(8477,71,1174,2110,0,158,40,105,347,370),(8477,72,1190,2132,0,164,40,106,354,380),(8477,73,1204,2145,0,179,42,108,363,390),(8477,74,1219,2159,0,188,43,110,377,400),(8477,75,1231,2172,0,200,44,113,390,410),(8477,76,1250,2190,0,211,45,115,402,420),(8477,77,1269,2203,0,225,46,118,420,430),(8477,78,1281,2220,0,236,47,131,439,440),(8477,79,1299,2239,0,249,48,140,450,450),(8477,80,1314,2252,0,261,50,162,470,460),(3450,71,1174,2110,0,158,40,105,347,370),(3450,72,1190,2132,0,164,40,106,354,380),(3450,73,1204,2145,0,179,42,108,363,390),(3450,74,1219,2159,0,188,43,110,377,400),(3450,75,1231,2172,0,200,44,113,390,410),(3450,76,1250,2190,0,211,45,115,402,420),(3450,77,1269,2203,0,225,46,118,420,430),(3450,78,1281,2220,0,236,47,131,439,440),(3450,79,1299,2239,0,249,48,140,450,450),(3450,80,1314,2252,0,261,50,162,470,460),(1,71,4162,1,7093,165,131,311,61,97),(1,72,4273,1,7392,168,134,316,62,99),(1,73,4384,1,7691,171,137,321,63,101),(1,74,4495,1,7990,174,140,326,64,103),(1,75,4606,1,8289,177,143,331,65,105),(1,76,4717,1,8588,180,146,336,66,107),(1,77,4828,1,8887,183,149,341,67,109),(1,78,4939,1,9186,186,152,346,68,111),(1,79,5050,1,9485,189,155,351,69,113),(1,80,5161,1,9784,192,158,356,70,115),(15438,71,7100,2109,1010,218,142,105,342,370),(15438,72,7200,2133,1020,224,144,106,349,380),(15438,73,7300,2149,1030,229,146,108,356,390),(15438,74,7400,2169,1040,238,148,110,363,400),(15438,75,7500,2188,1050,247,150,113,370,410),(15438,76,7600,2209,1060,253,152,115,377,420),(15438,77,7700,2228,1070,260,154,118,384,430),(15438,78,7800,2246,1080,268,156,120,391,440),(15438,79,7900,2264,1090,276,158,124,398,450),(15438,80,8000,2280,1100,283,160,125,405,460),(15352,71,7100,0,7200,158,72,105,142,370),(15352,72,7200,0,7400,164,74,106,144,380),(15352,73,7300,0,7600,179,77,108,147,390),(15352,74,7400,0,7800,188,80,110,150,400),(15352,75,7500,0,8000,200,83,113,152,410),(15352,76,7600,0,8200,211,84,115,155,420),(15352,77,7700,0,8400,225,86,118,158,430),(15352,78,7800,0,8600,236,89,131,160,440),(15352,79,7900,0,8800,249,89,140,163,450),(15352,80,8000,0,9000,261,90,162,165,460),(575,71,4501,4560,0,164,122,81,297,192),(575,72,4797,4664,0,167,125,82,303,196),(575,73,5093,4768,0,170,129,83,309,200),(575,74,5389,4872,0,174,132,84,315,204),(575,75,5685,4976,0,177,136,85,321,208),(575,76,5980,5080,0,180,139,86,326,212),(575,77,6276,5184,0,183,142,87,332,216),(575,78,6572,5288,0,186,146,88,338,220),(575,79,6868,5392,0,189,149,89,344,224),(575,80,7164,5496,0,193,153,90,350,228),(19668,71,2458,4560,0,177,122,81,297,192),(19668,72,2511,4664,0,181,125,82,303,196),(19668,73,2564,4768,0,186,129,83,309,200),(19668,74,2618,4872,0,191,132,84,315,204),(19668,75,2671,4976,0,196,136,85,321,208),(19668,76,2724,5080,0,200,139,86,326,212),(19668,77,2777,5184,0,205,142,87,332,216),(19668,78,2831,5288,0,210,146,88,338,220),(19668,79,2884,5392,0,215,149,89,344,224),(19668,80,2937,5496,0,219,153,90,350,228),(416,71,1580,2632,2319,148,40,102,342,269),(416,72,1639,2695,2431,150,41,104,351,274),(416,73,1699,2763,2544,153,44,104,358,280),(416,74,1761,2830,2660,156,45,108,365,283),(416,75,1821,2896,2760,159,46,109,373,288),(416,76,1882,2964,2890,164,48,110,381,295),(416,77,1949,3033,2999,166,49,113,390,300),(416,78,2011,3100,3110,168,50,114,397,308),(416,79,2073,3167,3150,171,51,115,392,313),(416,80,2129,3228,3191,175,54,119,402,319),(417,71,3169,2478,4561,156,111,285,136,124),(417,72,3227,2535,4721,159,113,290,139,126),(417,73,3283,2594,4882,162,116,294,143,128),(417,74,3342,2653,5041,165,118,298,146,129),(417,75,3403,2711,5199,167,121,304,150,131),(417,76,3459,2772,5363,170,124,309,153,132),(417,77,3518,2833,5526,172,127,313,156,135),(417,78,3576,2894,5688,175,129,319,157,137),(417,79,3645,2954,5868,177,130,324,158,140),(417,80,3733,3025,6008,179,133,329,162,142),(510,71,2489,4568,0,167,123,81,299,195),(510,72,2549,4676,0,171,127,82,305,200),(510,73,2609,4784,0,175,131,83,311,205),(510,74,2669,4892,0,179,135,84,317,210),(510,75,2729,5000,0,183,139,85,323,215),(510,76,2789,5108,0,187,143,86,329,220),(510,77,2849,5216,0,191,147,87,335,225),(510,78,2909,5324,0,195,151,88,341,230),(510,79,2969,5432,0,199,155,89,347,235),(510,80,3029,5540,0,203,159,90,353,240),(1860,71,5010,2992,9484,155,112,283,137,194),(1860,72,5161,3100,9861,157,114,286,141,197),(1860,73,5313,3208,10231,159,116,289,145,201),(1860,74,5466,3317,10603,163,120,293,151,205),(1860,75,5620,3426,10983,165,123,296,156,214),(1860,76,5775,3535,11362,167,125,300,160,218),(1860,77,5930,3645,11743,170,127,303,165,222),(1860,78,6086,3758,12125,172,129,306,172,226),(1860,79,6243,3874,12508,174,131,310,178,231),(1860,80,6401,3997,13011,177,134,313,185,235),(1863,71,2211,2460,4479,155,110,284,136,124),(1863,72,2259,2516,4666,157,111,288,139,125),(1863,73,2308,2573,4854,159,113,293,143,127),(1863,74,2358,2631,5042,161,115,298,147,131),(1863,75,2409,2660,5231,164,118,303,150,134),(1863,76,2461,2735,5421,167,120,309,154,137),(1863,77,2512,2793,5612,170,122,314,156,141),(1863,78,2562,2852,5804,172,124,319,158,143),(1863,79,2612,2911,5997,175,127,324,160,147),(1863,80,2665,2989,6204,178,130,330,163,150),(17252,71,5471,4277,8267,155,109,359,204,124),(17252,72,5623,4384,8607,158,111,367,211,125),(17252,73,5776,4492,8952,161,113,375,219,128),(17252,74,5930,4600,9297,164,115,382,227,130),(17252,75,6085,4709,9647,166,118,390,235,132),(17252,76,6241,4818,9997,170,121,399,242,135),(17252,77,6398,4927,10352,172,124,407,250,138),(17252,78,6556,5036,10712,174,125,414,257,141),(17252,79,6711,5144,11067,176,127,423,266,145),(17252,80,6872,5266,11454,177,130,432,275,150),(329,1,140,48,20,20,5,20,24,23),(329,2,149,59,20,21,5,2,25,24),(329,3,158,70,20,15,5,4,26,25),(329,4,168,81,33,17,5,8,27,26),(329,5,177,92,49,18,5,12,28,27),(329,6,186,103,68,20,7,16,29,27),(329,7,195,114,92,22,7,21,30,28),(329,8,204,125,117,23,8,25,31,29),(329,9,213,136,147,25,9,27,32,30),(329,10,223,147,180,29,10,29,33,31),(329,11,232,158,190,30,11,32,37,35),(329,12,250,180,203,31,12,36,41,39),(329,13,289,203,215,32,13,43,50,43),(329,14,299,227,228,33,13,44,54,47),(329,15,309,251,240,34,13,48,57,52),(329,16,329,275,253,36,13,52,62,56),(329,17,350,300,265,38,13,55,65,65),(329,18,362,314,278,39,13,59,70,70),(329,19,393,351,291,40,13,63,74,75),(329,20,403,377,303,42,13,67,87,78),(329,21,425,393,320,44,13,80,91,83),(329,22,449,420,346,46,13,84,95,86),(329,23,473,447,360,47,13,89,96,90),(329,24,520,476,373,49,13,93,97,95),(329,25,540,504,386,50,13,97,98,100),(329,26,569,534,399,52,13,101,60,78),(329,27,571,564,411,53,14,105,61,81),(329,28,574,592,424,55,15,110,62,86),(329,29,576,620,436,57,16,114,62,89),(329,30,579,648,449,57,16,118,63,92),(329,31,581,676,462,59,16,123,64,95),(329,32,590,720,476,60,17,127,64,98),(329,33,598,742,488,62,18,131,65,101),(329,34,601,793,501,63,19,135,65,104),(329,35,609,845,513,64,19,136,66,107),(329,36,617,879,525,67,19,137,66,110),(329,37,626,916,537,69,19,138,68,112),(329,38,634,952,549,70,19,139,68,115),(329,39,642,988,561,72,19,142,69,118),(329,40,650,1026,639,74,20,147,156,142),(329,41,668,1063,694,77,20,152,160,143),(329,42,676,1103,756,81,20,156,163,144),(329,43,685,1187,808,87,20,160,167,145),(329,44,693,1214,853,91,21,164,170,146),(329,45,701,1240,884,96,21,169,174,148),(329,46,709,1267,910,98,22,173,177,149),(329,47,718,1294,928,100,22,177,181,151),(329,48,726,1320,946,102,22,181,184,152),(329,49,734,1347,964,105,22,186,188,155),(329,50,747,1391,983,107,22,190,194,158),(329,51,750,1435,996,109,22,194,202,161),(329,52,764,1481,1013,112,24,198,208,165),(329,53,787,1527,1039,114,25,203,215,168),(329,54,820,1573,1055,115,26,207,222,172),(329,55,836,1620,1078,119,26,211,229,177),(329,56,846,1666,1091,121,27,215,236,181),(329,57,850,1714,1101,123,27,220,243,185),(329,58,862,1763,1125,125,27,224,250,189),(329,59,878,1824,1150,127,27,230,258,192),(329,60,920,1898,1163,122,27,128,264,197),(329,61,973,1925,1608,132,29,251,271,239),(329,62,1050,1977,1663,135,31,253,278,241),(329,63,1188,2030,1732,137,32,255,285,244),(329,64,1292,2084,1809,139,33,259,292,247),(329,65,1335,2137,1844,142,33,264,299,250),(329,66,1357,2191,1872,144,33,268,306,255),(329,67,1401,2244,1900,146,33,272,313,258),(329,68,1429,2298,1987,148,34,276,320,260),(329,69,1464,2351,2008,151,36,278,327,262),(329,70,1528,2568,2227,152,39,103,334,264),(329,71,7100,2109,1010,71,39,104,341,370),(329,72,7200,2128,1020,72,39,105,348,380),(329,73,7300,2147,1030,73,40,107,355,390),(329,74,7400,2167,1040,74,40,108,362,400),(329,75,7500,2186,1050,75,40,110,369,410),(329,76,7600,2205,1060,76,41,111,376,420),(329,77,7700,2224,1070,77,41,113,383,430),(329,78,7800,2243,1080,78,42,115,390,440),(329,79,7900,2262,1090,79,42,116,397,450),(329,80,8000,2282,1100,80,42,118,404,460),(3939,1,140,48,20,20,5,20,24,23),(3939,2,149,59,20,21,5,2,25,24),(3939,3,158,70,20,15,5,4,26,25),(3939,4,168,81,33,17,5,8,27,26),(3939,5,177,92,49,18,5,12,28,27),(3939,6,186,103,68,20,7,16,29,27),(3939,7,195,114,92,22,7,21,30,28),(3939,8,204,125,117,23,8,25,31,29),(3939,9,213,136,147,25,9,27,32,30),(3939,10,223,147,180,29,10,29,33,31),(3939,11,232,158,190,30,11,32,37,35),(3939,12,250,180,203,31,12,36,41,39),(3939,13,289,203,215,32,13,43,50,43),(3939,14,299,227,228,33,13,44,54,47),(3939,15,309,251,240,34,13,48,57,52),(3939,16,329,275,253,36,13,52,62,56),(3939,17,350,300,265,38,13,55,65,65),(3939,18,362,314,278,39,13,59,70,70),(3939,19,393,351,291,40,13,63,74,75),(3939,20,403,377,303,42,13,67,87,78),(3939,21,425,393,320,44,13,80,91,83),(3939,22,449,420,346,46,13,84,95,86),(3939,23,473,447,360,47,13,89,96,90),(3939,24,520,476,373,49,13,93,97,95),(3939,25,540,504,386,50,13,97,98,100),(3939,26,569,534,399,52,13,101,60,78),(3939,27,571,564,411,53,14,105,61,81),(3939,28,574,592,424,55,15,110,62,86),(3939,29,576,620,436,57,16,114,62,89),(3939,30,579,648,449,57,16,118,63,92),(3939,31,581,676,462,59,16,123,64,95),(3939,32,590,720,476,60,17,127,64,98),(3939,33,598,742,488,62,18,131,65,101),(3939,34,601,793,501,63,19,135,65,104),(3939,35,609,845,513,64,19,136,66,107),(3939,36,617,879,525,67,19,137,66,110),(3939,37,626,916,537,69,19,138,68,112),(3939,38,634,952,549,70,19,139,68,115),(3939,39,642,988,561,72,19,142,69,118),(3939,40,650,1026,639,74,20,147,156,142),(3939,41,668,1063,694,77,20,152,160,143),(3939,42,676,1103,756,81,20,156,163,144),(3939,43,685,1187,808,87,20,160,167,145),(3939,44,693,1214,853,91,21,164,170,146),(3939,45,701,1240,884,96,21,169,174,148),(3939,46,709,1267,910,98,22,173,177,149),(3939,47,718,1294,928,100,22,177,181,151),(3939,48,726,1320,946,102,22,181,184,152),(3939,49,734,1347,964,105,22,186,188,155),(3939,50,747,1391,983,107,22,190,194,158),(3939,51,750,1435,996,109,22,194,202,161),(3939,52,764,1481,1013,112,24,198,208,165),(3939,53,787,1527,1039,114,25,203,215,168),(3939,54,820,1573,1055,115,26,207,222,172),(3939,55,836,1620,1078,119,26,211,229,177),(3939,56,846,1666,1091,121,27,215,236,181),(3939,57,850,1714,1101,123,27,220,243,185),(3939,58,862,1763,1125,125,27,224,250,189),(3939,59,878,1824,1150,127,27,230,258,192),(3939,60,920,1898,1163,122,27,128,264,197),(3939,61,973,1925,1608,132,29,251,271,239),(3939,62,1050,1977,1663,135,31,253,278,241),(3939,63,1188,2030,1732,137,32,255,285,244),(3939,64,1292,2084,1809,139,33,259,292,247),(3939,65,1335,2137,1844,142,33,264,299,250),(3939,66,1357,2191,1872,144,33,268,306,255),(3939,67,1401,2244,1900,146,33,272,313,258),(3939,68,1429,2298,1987,148,34,276,320,260),(3939,69,1464,2351,2008,151,36,278,327,262),(3939,70,1528,2568,2227,152,39,103,334,264),(3939,71,5654,4225,8300,155,112,325,135,124),(3939,72,5750,4377,8380,157,115,329,136,126),(3939,73,5945,4430,8440,159,118,332,137,129),(3939,74,6191,4584,8550,162,121,335,138,131),(3939,75,6349,4646,8612,164,123,338,139,134),(3939,76,6676,4778,8910,166,126,343,140,136),(3939,77,6884,4863,9150,169,129,347,141,138),(3939,78,7097,4949,9450,172,132,351,142,141),(3939,79,7208,5035,9800,174,135,355,143,143),(3939,80,7320,5170,10087,177,137,361,144,146),(5058,1,40,48,20,12,14,1,1,25),(5058,2,49,59,40,14,15,2,1,26),(5058,3,58,70,60,15,16,4,1,27),(5058,4,68,81,80,17,17,8,2,27),(5058,5,77,92,100,18,18,12,2,28),(5058,6,86,103,120,20,19,16,3,29),(5058,7,95,114,140,22,20,21,3,29),(5058,8,104,125,160,23,21,25,4,30),(5058,9,113,136,180,25,22,29,4,31),(5058,10,123,147,200,26,23,33,5,31),(5058,11,132,158,220,28,25,38,6,32),(5058,12,150,180,240,29,26,42,8,33),(5058,13,169,203,280,31,27,46,9,34),(5058,14,189,227,320,33,28,50,11,35),(5058,15,209,251,360,34,29,55,14,35),(5058,16,229,275,400,36,30,59,16,36),(5058,17,250,300,460,37,31,63,20,37),(5058,18,262,314,510,39,32,67,24,38),(5058,19,293,351,550,40,33,72,29,39),(5058,20,303,377,563,42,35,67,31,49),(5058,21,325,393,604,44,36,80,53,39),(5058,22,349,420,628,46,36,84,54,41),(5058,23,373,447,652,47,38,89,56,42),(5058,24,400,476,675,49,39,93,57,43),(5058,25,440,504,699,50,40,97,60,44),(5058,26,469,534,721,52,41,101,62,46),(5058,27,501,564,745,53,42,105,63,47),(5058,28,534,592,768,55,43,110,65,48),(5058,29,566,620,791,57,44,114,67,49),(5058,30,599,648,815,57,46,118,69,51),(5058,31,631,676,838,59,47,123,71,52),(5058,32,680,720,862,60,47,127,73,53),(5058,33,728,742,884,62,49,131,74,54),(5058,34,661,793,908,64,50,135,76,56),(5058,35,699,845,950,63,51,136,73,57),(5058,36,737,879,990,67,52,137,72,58),(5058,37,776,916,1038,69,53,138,70,59),(5058,38,814,952,1095,70,55,139,69,61),(5058,39,852,988,1163,72,56,142,68,62),(5058,40,890,1026,1244,74,57,147,67,64),(5058,41,928,1063,1338,77,58,152,68,66),(5058,42,976,1103,1448,81,59,156,70,67),(5058,43,1005,1187,1560,87,60,160,72,69),(5058,44,1043,1214,1670,91,61,164,74,71),(5058,45,1081,1240,1738,96,64,169,75,72),(5058,46,1119,1267,1773,98,65,173,77,73),(5058,47,1158,1294,1808,100,66,177,78,75),(5058,48,1196,1320,1843,102,68,181,80,76),(5058,49,1234,1347,1878,105,69,186,82,78),(5058,50,2877,2391,3494,107,71,219,95,80),(5058,51,2920,2435,3559,109,72,223,97,81),(5058,52,3164,2481,3624,112,74,228,100,82),(5058,53,3207,2527,3686,113,75,233,102,84),(5058,54,3350,2573,3752,116,77,238,104,87),(5058,55,3493,2620,3814,119,78,243,106,88),(5058,56,3536,2766,3878,120,79,248,108,89),(5058,57,3680,2814,3941,123,82,251,111,92),(5058,58,3723,2913,4006,125,84,255,113,94),(5058,59,3866,2924,4067,128,86,258,115,96),(5058,60,3909,3174,4635,130,87,270,118,98),(5058,61,4054,3225,6300,132,90,274,121,101),(5058,62,4300,3377,6380,135,92,280,122,103),(5058,63,4545,3430,6440,137,93,286,123,105),(5058,64,4691,3584,6550,139,95,295,128,107),(5058,65,4749,3646,6612,142,98,300,129,110),(5058,66,4876,3778,6910,144,99,306,130,112),(5058,67,4984,3863,7150,146,101,310,131,114),(5058,68,5197,3949,7450,148,105,315,132,117),(5058,69,5208,4035,7800,151,107,318,133,119),(5058,70,5320,4170,8087,153,109,322,134,122),(5058,71,4162,1,7093,165,131,311,61,97),(5058,72,4273,1,7392,168,134,316,62,99),(5058,73,4384,1,7691,171,137,321,63,101),(5058,74,4495,1,7990,174,140,326,64,103),(5058,75,4606,1,8289,177,143,331,65,105),(5058,76,4717,1,8588,180,146,336,66,107),(5058,77,4828,1,8887,183,149,341,67,109),(5058,78,4939,1,9186,186,152,346,68,111),(5058,79,5050,1,9485,189,155,351,69,113),(5058,80,5161,1,9784,192,158,356,70,115),(5766,1,140,48,20,20,5,20,24,23),(5766,2,149,59,20,21,5,2,25,24),(5766,3,158,70,20,15,5,4,26,25),(5766,4,168,81,33,17,5,8,27,26),(5766,5,177,92,49,18,5,12,28,27),(5766,6,186,103,68,20,7,16,29,27),(5766,7,195,114,92,22,7,21,30,28),(5766,8,204,125,117,23,8,25,31,29),(5766,9,213,136,147,25,9,27,32,30),(5766,10,223,147,180,29,10,29,33,31),(5766,11,232,158,190,30,11,32,37,35),(5766,12,250,180,203,31,12,36,41,39),(5766,13,289,203,215,32,13,43,50,43),(5766,14,299,227,228,33,13,44,54,47),(5766,15,309,251,240,34,13,48,57,52),(5766,16,329,275,253,36,13,52,62,56),(5766,17,350,300,265,38,13,55,65,65),(5766,18,362,314,278,39,13,59,70,70),(5766,19,393,351,291,40,13,63,74,75),(5766,20,403,377,303,42,13,67,87,78),(5766,21,425,393,320,44,13,80,91,83),(5766,22,449,420,346,46,13,84,95,86),(5766,23,473,447,360,47,13,89,96,90),(5766,24,520,476,373,49,13,93,97,95),(5766,25,540,504,386,50,13,97,98,100),(5766,26,569,534,399,52,13,101,60,78),(5766,27,571,564,411,53,14,105,61,81),(5766,28,574,592,424,55,15,110,62,86),(5766,29,576,620,436,57,16,114,62,89),(5766,30,579,648,449,57,16,118,63,92),(5766,31,581,676,462,59,16,123,64,95),(5766,32,590,720,476,60,17,127,64,98),(5766,33,598,742,488,62,18,131,65,101),(5766,34,601,793,501,63,19,135,65,104),(5766,35,609,845,513,64,19,136,66,107),(5766,36,617,879,525,67,19,137,66,110),(5766,37,626,916,537,69,19,138,68,112),(5766,38,634,952,549,70,19,139,68,115),(5766,39,642,988,561,72,19,142,69,118),(5766,40,650,1026,639,74,20,147,156,142),(5766,41,668,1063,694,77,20,152,160,143),(5766,42,676,1103,756,81,20,156,163,144),(5766,43,685,1187,808,87,20,160,167,145),(5766,44,693,1214,853,91,21,164,170,146),(5766,45,701,1240,884,96,21,169,174,148),(5766,46,709,1267,910,98,22,173,177,149),(5766,47,718,1294,928,100,22,177,181,151),(5766,48,726,1320,946,102,22,181,184,152),(5766,49,734,1347,964,105,22,186,188,155),(5766,50,747,1391,983,107,22,190,194,158),(5766,51,750,1435,996,109,22,194,202,161),(5766,52,764,1481,1013,112,24,198,208,165),(5766,53,787,1527,1039,114,25,203,215,168),(5766,54,820,1573,1055,115,26,207,222,172),(5766,55,836,1620,1078,119,26,211,229,177),(5766,56,846,1666,1091,121,27,215,236,181),(5766,57,850,1714,1101,123,27,220,243,185),(5766,58,862,1763,1125,125,27,224,250,189),(5766,59,878,1824,1150,127,27,230,258,192),(5766,60,920,1898,1163,122,27,128,264,197),(5766,61,973,1925,1608,132,29,251,271,239),(5766,62,1050,1977,1663,135,31,253,278,241),(5766,63,1188,2030,1732,137,32,255,285,244),(5766,64,1292,2084,1809,139,33,259,292,247),(5766,65,1335,2137,1844,142,33,264,299,250),(5766,66,1357,2191,1872,144,33,268,306,255),(5766,67,1401,2244,1900,146,33,272,313,258),(5766,68,1429,2298,1987,148,34,276,320,260),(5766,69,1464,2351,2008,151,36,278,327,262),(5766,70,1528,2568,2227,152,39,103,334,264),(5766,71,4162,1,7093,165,131,311,61,97),(5766,72,4273,1,7392,168,134,316,62,99),(5766,73,4384,1,7691,171,137,321,63,101),(5766,74,4495,1,7990,174,140,326,64,103),(5766,75,4606,1,8289,177,143,331,65,105),(5766,76,4717,1,8588,180,146,336,66,107),(5766,77,4828,1,8887,183,149,341,67,109),(5766,78,4939,1,9186,186,152,346,68,111),(5766,79,5050,1,9485,189,155,351,69,113),(5766,80,5161,1,9784,192,158,356,70,115),(6250,1,140,48,20,20,5,20,24,23),(6250,2,149,59,20,21,5,2,25,24),(6250,3,158,70,20,15,5,4,26,25),(6250,4,168,81,33,17,5,8,27,26),(6250,5,177,92,49,18,5,12,28,27),(6250,6,186,103,68,20,7,16,29,27),(6250,7,195,114,92,22,7,21,30,28),(6250,8,204,125,117,23,8,25,31,29),(6250,9,213,136,147,25,9,27,32,30),(6250,10,223,147,180,29,10,29,33,31),(6250,11,232,158,190,30,11,32,37,35),(6250,12,250,180,203,31,12,36,41,39),(6250,13,289,203,215,32,13,43,50,43),(6250,14,299,227,228,33,13,44,54,47),(6250,15,309,251,240,34,13,48,57,52),(6250,16,329,275,253,36,13,52,62,56),(6250,17,350,300,265,38,13,55,65,65),(6250,18,362,314,278,39,13,59,70,70),(6250,19,393,351,291,40,13,63,74,75),(6250,20,403,377,303,42,13,67,87,78),(6250,21,425,393,320,44,13,80,91,83),(6250,22,449,420,346,46,13,84,95,86),(6250,23,473,447,360,47,13,89,96,90),(6250,24,520,476,373,49,13,93,97,95),(6250,25,540,504,386,50,13,97,98,100),(6250,26,569,534,399,52,13,101,60,78),(6250,27,571,564,411,53,14,105,61,81),(6250,28,574,592,424,55,15,110,62,86),(6250,29,576,620,436,57,16,114,62,89),(6250,30,579,648,449,57,16,118,63,92),(6250,31,581,676,462,59,16,123,64,95),(6250,32,590,720,476,60,17,127,64,98),(6250,33,598,742,488,62,18,131,65,101),(6250,34,601,793,501,63,19,135,65,104),(6250,35,609,845,513,64,19,136,66,107),(6250,36,617,879,525,67,19,137,66,110),(6250,37,626,916,537,69,19,138,68,112),(6250,38,634,952,549,70,19,139,68,115),(6250,39,642,988,561,72,19,142,69,118),(6250,40,650,1026,639,74,20,147,156,142),(6250,41,668,1063,694,77,20,152,160,143),(6250,42,676,1103,756,81,20,156,163,144),(6250,43,685,1187,808,87,20,160,167,145),(6250,44,693,1214,853,91,21,164,170,146),(6250,45,701,1240,884,96,21,169,174,148),(6250,46,709,1267,910,98,22,173,177,149),(6250,47,718,1294,928,100,22,177,181,151),(6250,48,726,1320,946,102,22,181,184,152),(6250,49,734,1347,964,105,22,186,188,155),(6250,50,747,1391,983,107,22,190,194,158),(6250,51,750,1435,996,109,22,194,202,161),(6250,52,764,1481,1013,112,24,198,208,165),(6250,53,787,1527,1039,114,25,203,215,168),(6250,54,820,1573,1055,115,26,207,222,172),(6250,55,836,1620,1078,119,26,211,229,177),(6250,56,846,1666,1091,121,27,215,236,181),(6250,57,850,1714,1101,123,27,220,243,185),(6250,58,862,1763,1125,125,27,224,250,189),(6250,59,878,1824,1150,127,27,230,258,192),(6250,60,920,1898,1163,122,27,128,264,197),(6250,61,973,1925,1608,132,29,251,271,239),(6250,62,1050,1977,1663,135,31,253,278,241),(6250,63,1188,2030,1732,137,32,255,285,244),(6250,64,1292,2084,1809,139,33,259,292,247),(6250,65,1335,2137,1844,142,33,264,299,250),(6250,66,1357,2191,1872,144,33,268,306,255),(6250,67,1401,2244,1900,146,33,272,313,258),(6250,68,1429,2298,1987,148,34,276,320,260),(6250,69,1464,2351,2008,151,36,278,327,262),(6250,70,1528,2568,2227,152,39,103,334,264),(6250,71,4162,1,7093,165,131,311,61,97),(6250,72,4273,1,7392,168,134,316,62,99),(6250,73,4384,1,7691,171,137,321,63,101),(6250,74,4495,1,7990,174,140,326,64,103),(6250,75,4606,1,8289,177,143,331,65,105),(6250,76,4717,1,8588,180,146,336,66,107),(6250,77,4828,1,8887,183,149,341,67,109),(6250,78,4939,1,9186,186,152,346,68,111),(6250,79,5050,1,9485,189,155,351,69,113),(6250,80,5161,1,9784,192,158,356,70,115),(15214,1,140,48,20,20,5,20,24,23),(15214,2,149,59,20,21,5,2,25,24),(15214,3,158,70,20,15,5,4,26,25),(15214,4,168,81,33,17,5,8,27,26),(15214,5,177,92,49,18,5,12,28,27),(15214,6,186,103,68,20,7,16,29,27),(15214,7,195,114,92,22,7,21,30,28),(15214,8,204,125,117,23,8,25,31,29),(15214,9,213,136,147,25,9,27,32,30),(15214,10,223,147,180,29,10,29,33,31),(15214,11,232,158,190,30,11,32,37,35),(15214,12,250,180,203,31,12,36,41,39),(15214,13,289,203,215,32,13,43,50,43),(15214,14,299,227,228,33,13,44,54,47),(15214,15,309,251,240,34,13,48,57,52),(15214,16,329,275,253,36,13,52,62,56),(15214,17,350,300,265,38,13,55,65,65),(15214,18,362,314,278,39,13,59,70,70),(15214,19,393,351,291,40,13,63,74,75),(15214,20,403,377,303,42,13,67,87,78),(15214,21,425,393,320,44,13,80,91,83),(15214,22,449,420,346,46,13,84,95,86),(15214,23,473,447,360,47,13,89,96,90),(15214,24,520,476,373,49,13,93,97,95),(15214,25,540,504,386,50,13,97,98,100),(15214,26,569,534,399,52,13,101,60,78),(15214,27,571,564,411,53,14,105,61,81),(15214,28,574,592,424,55,15,110,62,86),(15214,29,576,620,436,57,16,114,62,89),(15214,30,579,648,449,57,16,118,63,92),(15214,31,581,676,462,59,16,123,64,95),(15214,32,590,720,476,60,17,127,64,98),(15214,33,598,742,488,62,18,131,65,101),(15214,34,601,793,501,63,19,135,65,104),(15214,35,609,845,513,64,19,136,66,107),(15214,36,617,879,525,67,19,137,66,110),(15214,37,626,916,537,69,19,138,68,112),(15214,38,634,952,549,70,19,139,68,115),(15214,39,642,988,561,72,19,142,69,118),(15214,40,650,1026,639,74,20,147,156,142),(15214,41,668,1063,694,77,20,152,160,143),(15214,42,676,1103,756,81,20,156,163,144),(15214,43,685,1187,808,87,20,160,167,145),(15214,44,693,1214,853,91,21,164,170,146),(15214,45,701,1240,884,96,21,169,174,148),(15214,46,709,1267,910,98,22,173,177,149),(15214,47,718,1294,928,100,22,177,181,151),(15214,48,726,1320,946,102,22,181,184,152),(15214,49,734,1347,964,105,22,186,188,155),(15214,50,747,1391,983,107,22,190,194,158),(15214,51,750,1435,996,109,22,194,202,161),(15214,52,764,1481,1013,112,24,198,208,165),(15214,53,787,1527,1039,114,25,203,215,168),(15214,54,820,1573,1055,115,26,207,222,172),(15214,55,836,1620,1078,119,26,211,229,177),(15214,56,846,1666,1091,121,27,215,236,181),(15214,57,850,1714,1101,123,27,220,243,185),(15214,58,862,1763,1125,125,27,224,250,189),(15214,59,878,1824,1150,127,27,230,258,192),(15214,60,920,1898,1163,122,27,128,264,197),(15214,61,973,1925,1608,132,29,251,271,239),(15214,62,1050,1977,1663,135,31,253,278,241),(15214,63,1188,2030,1732,137,32,255,285,244),(15214,64,1292,2084,1809,139,33,259,292,247),(15214,65,1335,2137,1844,142,33,264,299,250),(15214,66,1357,2191,1872,144,33,268,306,255),(15214,67,1401,2244,1900,146,33,272,313,258),(15214,68,1429,2298,1987,148,34,276,320,260),(15214,69,1464,2351,2008,151,36,278,327,262),(15214,70,1528,2568,2227,152,39,103,334,264),(15214,71,5654,4225,8300,155,112,325,135,124),(15214,72,5750,4377,8380,157,115,329,136,126),(15214,73,5945,4430,8440,159,118,332,137,129),(15214,74,6191,4584,8550,162,121,335,138,131),(15214,75,6349,4646,8612,164,123,338,139,134),(15214,76,6676,4778,8910,166,126,343,140,136),(15214,77,6884,4863,9150,169,129,347,141,138),(15214,78,7097,4949,9450,172,132,351,142,141),(15214,79,7208,5035,9800,174,135,355,143,143),(15214,80,7320,5170,10087,177,137,361,144,146),(24476,1,140,48,20,20,5,20,24,23),(24476,2,149,59,20,21,5,2,25,24),(24476,3,158,70,20,15,5,4,26,25),(24476,4,168,81,33,17,5,8,27,26),(24476,5,177,92,49,18,5,12,28,27),(24476,6,186,103,68,20,7,16,29,27),(24476,7,195,114,92,22,7,21,30,28),(24476,8,204,125,117,23,8,25,31,29),(24476,9,213,136,147,25,9,27,32,30),(24476,10,223,147,180,29,10,29,33,31),(24476,11,232,158,190,30,11,32,37,35),(24476,12,250,180,203,31,12,36,41,39),(24476,13,289,203,215,32,13,43,50,43),(24476,14,299,227,228,33,13,44,54,47),(24476,15,309,251,240,34,13,48,57,52),(24476,16,329,275,253,36,13,52,62,56),(24476,17,350,300,265,38,13,55,65,65),(24476,18,362,314,278,39,13,59,70,70),(24476,19,393,351,291,40,13,63,74,75),(24476,20,403,377,303,42,13,67,87,78),(24476,21,425,393,320,44,13,80,91,83),(24476,22,449,420,346,46,13,84,95,86),(24476,23,473,447,360,47,13,89,96,90),(24476,24,520,476,373,49,13,93,97,95),(24476,25,540,504,386,50,13,97,98,100),(24476,26,569,534,399,52,13,101,60,78),(24476,27,571,564,411,53,14,105,61,81),(24476,28,574,592,424,55,15,110,62,86),(24476,29,576,620,436,57,16,114,62,89),(24476,30,579,648,449,57,16,118,63,92),(24476,31,581,676,462,59,16,123,64,95),(24476,32,590,720,476,60,17,127,64,98),(24476,33,598,742,488,62,18,131,65,101),(24476,34,601,793,501,63,19,135,65,104),(24476,35,609,845,513,64,19,136,66,107),(24476,36,617,879,525,67,19,137,66,110),(24476,37,626,916,537,69,19,138,68,112),(24476,38,634,952,549,70,19,139,68,115),(24476,39,642,988,561,72,19,142,69,118),(24476,40,650,1026,639,74,20,147,156,142),(24476,41,668,1063,694,77,20,152,160,143),(24476,42,676,1103,756,81,20,156,163,144),(24476,43,685,1187,808,87,20,160,167,145),(24476,44,693,1214,853,91,21,164,170,146),(24476,45,701,1240,884,96,21,169,174,148),(24476,46,709,1267,910,98,22,173,177,149),(24476,47,718,1294,928,100,22,177,181,151),(24476,48,726,1320,946,102,22,181,184,152),(24476,49,734,1347,964,105,22,186,188,155),(24476,50,747,1391,983,107,22,190,194,158),(24476,51,750,1435,996,109,22,194,202,161),(24476,52,764,1481,1013,112,24,198,208,165),(24476,53,787,1527,1039,114,25,203,215,168),(24476,54,820,1573,1055,115,26,207,222,172),(24476,55,836,1620,1078,119,26,211,229,177),(24476,56,846,1666,1091,121,27,215,236,181),(24476,57,850,1714,1101,123,27,220,243,185),(24476,58,862,1763,1125,125,27,224,250,189),(24476,59,878,1824,1150,127,27,230,258,192),(24476,60,920,1898,1163,122,27,128,264,197),(24476,61,973,1925,1608,132,29,251,271,239),(24476,62,1050,1977,1663,135,31,253,278,241),(24476,63,1188,2030,1732,137,32,255,285,244),(24476,64,1292,2084,1809,139,33,259,292,247),(24476,65,1335,2137,1844,142,33,264,299,250),(24476,66,1357,2191,1872,144,33,268,306,255),(24476,67,1401,2244,1900,146,33,272,313,258),(24476,68,1429,2298,1987,148,34,276,320,260),(24476,69,1464,2351,2008,151,36,278,327,262),(24476,70,1528,2568,2227,152,39,103,334,264),(24476,71,4162,1,7093,165,131,311,61,97),(24476,72,4273,1,7392,168,134,316,62,99),(24476,73,4384,1,7691,171,137,321,63,101),(24476,74,4495,1,7990,174,140,326,64,103),(24476,75,4606,1,8289,177,143,331,65,105),(24476,76,4717,1,8588,180,146,336,66,107),(24476,77,4828,1,8887,183,149,341,67,109),(24476,78,4939,1,9186,186,152,346,68,111),(24476,79,5050,1,9485,189,155,351,69,113),(24476,80,5161,1,9784,192,158,356,70,115),(24656,1,1,1,0,1,1,1,1,1),(24656,2,1,1,0,1,1,1,1,1),(24656,3,1,1,0,1,1,1,1,1),(24656,4,1,1,0,1,1,1,1,1),(24656,5,1,1,0,1,1,1,1,1),(24656,6,1,1,0,1,1,1,1,1),(24656,7,1,1,0,1,1,1,1,1),(24656,8,1,1,0,1,1,1,1,1),(24656,9,1,1,0,1,1,1,1,1),(24656,10,1,1,0,1,1,1,1,1),(24656,11,1,1,0,1,1,1,1,1),(24656,12,1,1,0,1,1,1,1,1),(24656,13,1,1,0,1,1,1,1,1),(24656,14,1,1,0,1,1,1,1,1),(24656,15,1,1,0,1,1,1,1,1),(24656,16,1,1,0,1,1,1,1,1),(24656,17,1,1,0,1,1,1,1,1),(24656,18,1,1,0,1,1,1,1,1),(24656,19,1,1,0,1,1,1,1,1),(24656,20,1,1,0,1,1,1,1,1),(24656,21,1,1,0,1,1,1,1,1),(24656,22,1,1,0,1,1,1,1,1),(24656,23,1,1,0,1,1,1,1,1),(24656,24,1,1,0,1,1,1,1,1),(24656,25,1,1,0,1,1,1,1,1),(24656,26,1,1,0,1,1,1,1,1),(24656,27,1,1,0,1,1,1,1,1),(24656,28,1,1,0,1,1,1,1,1),(24656,29,1,1,0,1,1,1,1,1),(24656,30,1,1,0,1,1,1,1,1),(24656,31,1,1,0,1,1,1,1,1),(24656,32,1,1,0,1,1,1,1,1),(24656,33,1,1,0,1,1,1,1,1),(24656,34,1,1,0,1,1,1,1,1),(24656,35,1,1,0,1,1,1,1,1),(24656,36,1,1,0,1,1,1,1,1),(24656,37,1,1,0,1,1,1,1,1),(24656,38,1,1,0,1,1,1,1,1),(24656,39,1,1,0,1,1,1,1,1),(24656,40,1,1,0,1,1,1,1,1),(24656,41,1,1,0,1,1,1,1,1),(24656,42,1,1,0,1,1,1,1,1),(24656,43,1,1,0,1,1,1,1,1),(24656,44,1,1,0,1,1,1,1,1),(24656,45,1,1,0,1,1,1,1,1),(24656,46,1,1,0,1,1,1,1,1),(24656,47,1,1,0,1,1,1,1,1),(24656,48,1,1,0,1,1,1,1,1),(24656,49,1,1,0,1,1,1,1,1),(24656,50,1,1,0,1,1,1,1,1),(24656,51,1,1,0,1,1,1,1,1),(24656,52,1,1,0,1,1,1,1,1),(24656,53,1,1,0,1,1,1,1,1),(24656,54,1,1,0,1,1,1,1,1),(24656,55,1,1,0,1,1,1,1,1),(24656,56,1,1,0,1,1,1,1,1),(24656,57,1,1,0,1,1,1,1,1),(24656,58,1,1,0,1,1,1,1,1),(24656,59,1,1,0,1,1,1,1,1),(24656,60,1,1,0,1,1,1,1,1),(24656,61,1,1,0,1,1,1,1,1),(24656,62,1,1,0,1,1,1,1,1),(24656,63,1,1,0,1,1,1,1,1),(24656,64,1,1,0,1,1,1,1,1),(24656,65,1,1,0,1,1,1,1,1),(24656,66,1,1,0,1,1,1,1,1),(24656,67,1,1,0,1,1,1,1,1),(24656,68,1,1,0,1,1,1,1,1),(24656,69,1,1,0,1,1,1,1,1),(24656,70,8782,2878,3696,152,39,102,334,360),(24656,71,5654,4225,8300,155,112,325,135,124),(24656,72,5750,4377,8380,157,115,329,136,126),(24656,73,5945,4430,8440,159,118,332,137,129),(24656,74,6191,4584,8550,162,121,335,138,131),(24656,75,6349,4646,8612,164,123,338,139,134),(24656,76,6676,4778,8910,166,126,343,140,136),(24656,77,6884,4863,9150,169,129,347,141,138),(24656,78,7097,4949,9450,172,132,351,142,141),(24656,79,7208,5035,9800,174,135,355,143,143),(24656,80,7320,5170,10087,177,137,361,144,146),(25553,1,140,48,20,20,5,20,24,23),(25553,2,149,59,20,21,5,2,25,24),(25553,3,158,70,20,15,5,4,26,25),(25553,4,168,81,33,17,5,8,27,26),(25553,5,177,92,49,18,5,12,28,27),(25553,6,186,103,68,20,7,16,29,27),(25553,7,195,114,92,22,7,21,30,28),(25553,8,204,125,117,23,8,25,31,29),(25553,9,213,136,147,25,9,27,32,30),(25553,10,223,147,180,29,10,29,33,31),(25553,11,232,158,190,30,11,32,37,35),(25553,12,250,180,203,31,12,36,41,39),(25553,13,289,203,215,32,13,43,50,43),(25553,14,299,227,228,33,13,44,54,47),(25553,15,309,251,240,34,13,48,57,52),(25553,16,329,275,253,36,13,52,62,56),(25553,17,350,300,265,38,13,55,65,65),(25553,18,362,314,278,39,13,59,70,70),(25553,19,393,351,291,40,13,63,74,75),(25553,20,403,377,303,42,13,67,87,78),(25553,21,425,393,320,44,13,80,91,83),(25553,22,449,420,346,46,13,84,95,86),(25553,23,473,447,360,47,13,89,96,90),(25553,24,520,476,373,49,13,93,97,95),(25553,25,540,504,386,50,13,97,98,100),(25553,26,569,534,399,52,13,101,60,78),(25553,27,571,564,411,53,14,105,61,81),(25553,28,574,592,424,55,15,110,62,86),(25553,29,576,620,436,57,16,114,62,89),(25553,30,579,648,449,57,16,118,63,92),(25553,31,581,676,462,59,16,123,64,95),(25553,32,590,720,476,60,17,127,64,98),(25553,33,598,742,488,62,18,131,65,101),(25553,34,601,793,501,63,19,135,65,104),(25553,35,609,845,513,64,19,136,66,107),(25553,36,617,879,525,67,19,137,66,110),(25553,37,626,916,537,69,19,138,68,112),(25553,38,634,952,549,70,19,139,68,115),(25553,39,642,988,561,72,19,142,69,118),(25553,40,650,1026,639,74,20,147,156,142),(25553,41,668,1063,694,77,20,152,160,143),(25553,42,676,1103,756,81,20,156,163,144),(25553,43,685,1187,808,87,20,160,167,145),(25553,44,693,1214,853,91,21,164,170,146),(25553,45,701,1240,884,96,21,169,174,148),(25553,46,709,1267,910,98,22,173,177,149),(25553,47,718,1294,928,100,22,177,181,151),(25553,48,726,1320,946,102,22,181,184,152),(25553,49,734,1347,964,105,22,186,188,155),(25553,50,747,1391,983,107,22,190,194,158),(25553,51,750,1435,996,109,22,194,202,161),(25553,52,764,1481,1013,112,24,198,208,165),(25553,53,787,1527,1039,114,25,203,215,168),(25553,54,820,1573,1055,115,26,207,222,172),(25553,55,836,1620,1078,119,26,211,229,177),(25553,56,846,1666,1091,121,27,215,236,181),(25553,57,850,1714,1101,123,27,220,243,185),(25553,58,862,1763,1125,125,27,224,250,189),(25553,59,878,1824,1150,127,27,230,258,192),(25553,60,920,1898,1163,122,27,128,264,197),(25553,61,973,1925,1608,132,29,251,271,239),(25553,62,1050,1977,1663,135,31,253,278,241),(25553,63,1188,2030,1732,137,32,255,285,244),(25553,64,1292,2084,1809,139,33,259,292,247),(25553,65,1335,2137,1844,142,33,264,299,250),(25553,66,1357,2191,1872,144,33,268,306,255),(25553,67,1401,2244,1900,146,33,272,313,258),(25553,68,1429,2298,1987,148,34,276,320,260),(25553,69,1464,2351,2008,151,36,278,327,262),(25553,70,1528,2568,2227,152,39,103,334,264),(25553,71,5654,4225,8300,155,112,325,135,124),(25553,72,5750,4377,8380,157,115,329,136,126),(25553,73,5945,4430,8440,159,118,332,137,129),(25553,74,6191,4584,8550,162,121,335,138,131),(25553,75,6349,4646,8612,164,123,338,139,134),(25553,76,6676,4778,8910,166,126,343,140,136),(25553,77,6884,4863,9150,169,129,347,141,138),(25553,78,7097,4949,9450,172,132,351,142,141),(25553,79,7208,5035,9800,174,135,355,143,143),(25553,80,7320,5170,10087,177,137,361,144,146),(25566,1,14,40,0,20,20,20,24,23),(25566,2,19,49,0,21,20,20,25,24),(25566,3,24,58,0,22,20,21,26,25),(25566,4,29,67,0,23,21,21,27,26),(25566,5,34,76,0,23,21,22,28,27),(25566,6,40,85,0,24,21,22,29,27),(25566,7,46,95,0,25,21,23,30,28),(25566,8,52,105,0,26,21,23,31,29),(25566,9,58,116,0,27,21,23,32,30),(25566,10,64,126,0,27,22,24,33,31),(25566,11,75,151,0,28,22,24,37,35),(25566,12,83,177,0,29,22,26,41,39),(25566,13,91,198,0,30,22,26,44,43),(25566,14,120,234,0,31,22,28,50,47),(25566,15,129,262,0,32,23,29,54,52),(25566,16,138,290,0,34,23,30,57,56),(25566,17,147,318,0,36,23,31,61,60),(25566,18,156,346,0,37,23,32,65,65),(25566,19,165,374,0,38,23,33,70,69),(25566,20,175,402,0,40,24,35,74,74),(25566,21,184,430,0,42,24,37,87,78),(25566,22,193,458,0,44,24,39,91,82),(25566,23,202,486,0,45,24,40,95,86),(25566,24,212,514,0,46,25,42,94,90),(25566,25,224,539,0,47,25,43,94,95),(25566,26,237,568,0,48,25,43,98,100),(25566,27,249,598,0,50,25,42,102,104),(25566,28,262,632,0,51,25,44,109,110),(25566,29,274,667,0,52,26,44,114,114),(25566,30,287,702,0,54,26,45,120,118),(25566,31,299,734,0,55,26,46,124,123),(25566,32,312,772,0,57,26,47,128,128),(25566,33,324,807,0,58,27,48,132,131),(25566,34,338,842,0,60,27,50,136,135),(25566,35,360,898,0,62,27,51,139,136),(25566,36,382,954,0,65,27,52,142,137),(25566,37,404,1010,0,67,27,54,146,138),(25566,38,427,1066,0,70,28,55,149,139),(25566,39,449,1122,0,73,28,56,153,141),(25566,40,471,1178,0,75,28,58,156,142),(25566,41,493,1234,0,78,28,59,160,143),(25566,42,516,1290,0,80,29,60,163,144),(25566,43,538,1346,0,83,29,62,167,145),(25566,44,560,1402,0,86,29,63,170,147),(25566,45,582,1458,0,88,29,64,174,148),(25566,46,605,1514,0,91,30,66,177,149),(25566,47,627,1570,0,93,30,67,181,151),(25566,48,649,1627,0,96,30,68,184,152),(25566,49,672,1685,0,99,31,70,188,155),(25566,50,694,1704,0,101,31,71,194,160),(25566,51,716,1723,0,103,31,72,201,170),(25566,52,738,1743,0,105,32,74,208,180),(25566,53,761,1762,0,107,32,75,215,190),(25566,54,783,1781,0,109,32,77,222,200),(25566,55,805,1801,0,111,33,78,229,210),(25566,56,827,1820,0,113,33,80,236,220),(25566,57,850,1839,0,115,33,81,243,230),(25566,58,872,1859,0,117,34,83,250,240),(25566,59,894,1878,0,120,34,84,257,250),(25566,60,917,1898,0,122,35,86,264,260),(25566,61,939,1918,0,125,35,88,271,270),(25566,62,961,1937,0,128,36,89,278,280),(25566,63,983,1956,0,131,36,91,285,290),(25566,64,1005,1975,0,134,36,93,292,300),(25566,65,1027,1994,0,137,37,94,299,310),(25566,66,1049,2013,0,140,37,96,306,320),(25566,67,1072,2032,0,143,37,97,313,330),(25566,68,1094,2052,0,146,38,99,320,340),(25566,69,1126,2071,0,149,38,100,327,350),(25566,70,1149,2090,0,152,39,102,334,360),(25566,71,5654,4225,8300,155,112,325,135,124),(25566,72,5750,4377,8380,157,115,329,136,126),(25566,73,5945,4430,8440,159,118,332,137,129),(25566,74,6191,4584,8550,162,121,335,138,131),(25566,75,6349,4646,8612,164,123,338,139,134),(25566,76,6676,4778,8910,166,126,343,140,136),(25566,77,6884,4863,9150,169,129,347,141,138),(25566,78,7097,4949,9450,172,132,351,142,141),(25566,79,7208,5035,9800,174,135,355,143,143),(25566,80,7320,5170,10087,177,137,361,144,146); +/*!40000 ALTER TABLE `pet_levelstats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pet_name_generation` +-- + +DROP TABLE IF EXISTS `pet_name_generation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pet_name_generation` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `word` tinytext NOT NULL, + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `half` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=314 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pet_name_generation` +-- + +LOCK TABLES `pet_name_generation` WRITE; +/*!40000 ALTER TABLE `pet_name_generation` DISABLE KEYS */; +INSERT INTO `pet_name_generation` VALUES (1,'Aba',416,0),(2,'Az',416,0),(3,'Bel',416,0),(4,'Biz',416,0),(5,'Cho',416,0),(6,'Dag',416,0),(7,'Gak',416,0),(8,'Gar',416,0),(9,'Gel',416,0),(10,'Gho',416,0),(11,'Gob',416,0),(12,'Gra',416,0),(13,'Jak',416,0),(14,'Jub',416,0),(15,'Kar',416,0),(16,'Kup',416,0),(17,'Laz',416,0),(18,'Nal',416,0),(19,'Nok',416,0),(20,'Pag',416,0),(21,'Pig',416,0),(22,'Pip',416,0),(23,'Piz',416,0),(24,'Quz',416,0),(25,'Rui',416,0),(26,'Rul',416,0),(27,'Rup',416,0),(28,'Tar',416,0),(29,'Vol',416,0),(30,'Yaz',416,0),(31,'Zep',416,0),(32,'Zig',416,0),(33,'Zil',416,0),(34,'Zor',416,0),(35,'bis',416,1),(36,'fip',416,1),(37,'gup',416,1),(38,'ham',416,1),(39,'jub',416,1),(40,'kin',416,1),(41,'kol',416,1),(42,'lop',416,1),(43,'loz',416,1),(44,'mat',416,1),(45,'mir',416,1),(46,'nam',416,1),(47,'nar',416,1),(48,'nik',416,1),(49,'nip',416,1),(50,'pad',416,1),(51,'pep',416,1),(52,'pit',416,1),(53,'qua',416,1),(54,'rai',416,1),(55,'rin',416,1),(56,'rot',416,1),(57,'tai',416,1),(58,'tal',416,1),(59,'tik',416,1),(60,'tip',416,1),(61,'tog',416,1),(62,'tuk',416,1),(63,'uri',416,1),(64,'yal',416,1),(65,'yap',416,1),(66,'Bhee',417,0),(67,'Bruu',417,0),(68,'Czaa',417,0),(69,'Droo',417,0),(70,'Flaa',417,0),(71,'Fzuu',417,0),(72,'Ghaa',417,0),(73,'Gree',417,0),(74,'Gzaa',417,0),(75,'Haa',417,0),(76,'Haad',417,0),(77,'Haag',417,0),(78,'Haap',417,0),(79,'Jhaa',417,0),(80,'Jhuu',417,0),(81,'Khaa',417,0),(82,'Khii',417,0),(83,'Khuu',417,0),(84,'Kree',417,0),(85,'Luu',417,0),(86,'Maa',417,0),(87,'Nhee',417,0),(88,'Phuu',417,0),(89,'Pryy',417,0),(90,'Rhuu',417,0),(91,'Shaa',417,0),(92,'Sloo',417,0),(93,'Sruu',417,0),(94,'Thoo',417,0),(95,'Traa',417,0),(96,'Wraa',417,0),(97,'Zhaa',417,0),(98,'dhon',417,1),(99,'dhum',417,1),(100,'dhun',417,1),(101,'dom',417,1),(102,'don',417,1),(103,'drom',417,1),(104,'dym',417,1),(105,'fenn',417,1),(106,'fum',417,1),(107,'fun',417,1),(108,'ghon',417,1),(109,'ghun',417,1),(110,'grom',417,1),(111,'grym',417,1),(112,'hom',417,1),(113,'hon',417,1),(114,'hun',417,1),(115,'jhom',417,1),(116,'kun',417,1),(117,'lum',417,1),(118,'mmon',417,1),(119,'mon',417,1),(120,'myn',417,1),(121,'nam',417,1),(122,'nem',417,1),(123,'nhym',417,1),(124,'nom',417,1),(125,'num',417,1),(126,'phom',417,1),(127,'roon',417,1),(128,'rym',417,1),(129,'shon',417,1),(130,'thun',417,1),(131,'tom',417,1),(132,'zhem',417,1),(133,'zhum',417,1),(134,'zun',417,1),(135,'Bar',1860,0),(136,'Bel',1860,0),(137,'Char',1860,0),(138,'Grak\'',1860,0),(139,'Graz\'',1860,0),(140,'Grim',1860,0),(141,'Hath',1860,0),(142,'Hel',1860,0),(143,'Hok',1860,0),(144,'Huk',1860,0),(145,'Jhaz',1860,0),(146,'Jhom',1860,0),(147,'Juk\'',1860,0),(148,'Kal\'',1860,0),(149,'Klath',1860,0),(150,'Kon',1860,0),(151,'Krag',1860,0),(152,'Krak',1860,0),(153,'Mak',1860,0),(154,'Mezz',1860,0),(155,'Orm',1860,0),(156,'Phan',1860,0),(157,'Sar',1860,0),(158,'Tang',1860,0),(159,'Than',1860,0),(160,'Thog',1860,0),(161,'Thok',1860,0),(162,'Thul',1860,0),(163,'Zag\'',1860,0),(164,'Zang',1860,0),(165,'Zhar\'',1860,0),(166,'kath',1860,1),(167,'doc',1860,1),(168,'dok',1860,1),(169,'gak',1860,1),(170,'garth',1860,1),(171,'gore',1860,1),(172,'gorg',1860,1),(173,'grave',1860,1),(174,'gron',1860,1),(175,'juk',1860,1),(176,'krast',1860,1),(177,'kresh',1860,1),(178,'krit',1860,1),(179,'los',1860,1),(180,'mon',1860,1),(181,'mos',1860,1),(182,'moth',1860,1),(183,'nagma',1860,1),(184,'nak',1860,1),(185,'nar',1860,1),(186,'nos',1860,1),(187,'nuz',1860,1),(188,'phog',1860,1),(189,'rath',1860,1),(190,'tast',1860,1),(191,'taz',1860,1),(192,'thak',1860,1),(193,'thang',1860,1),(194,'thyk',1860,1),(195,'vhug',1860,1),(196,'zazt',1860,1),(197,'Ael',1863,0),(198,'Aez',1863,0),(199,'Ang',1863,0),(200,'Ban',1863,0),(201,'Bet',1863,0),(202,'Bro',1863,0),(203,'Bry',1863,0),(204,'Cat',1863,0),(205,'Dir',1863,0),(206,'Dis',1863,0),(207,'Dom',1863,0),(208,'Drus',1863,0),(209,'Fie',1863,0),(210,'Fier',1863,0),(211,'Gly',1863,0),(212,'Hel',1863,0),(213,'Hes',1863,0),(214,'Kal',1863,0),(215,'Lyn',1863,0),(216,'Mir',1863,0),(217,'Nim',1863,0),(218,'Sar',1863,0),(219,'Sel',1863,0),(220,'Vil',1863,0),(221,'Zah',1863,0),(222,'aith',1863,1),(223,'anda',1863,1),(224,'antia',1863,1),(225,'evere',1863,1),(226,'lia',1863,1),(227,'lissa',1863,1),(228,'neri',1863,1),(229,'neth',1863,1),(230,'nia',1863,1),(231,'nlissa',1863,1),(232,'nora',1863,1),(233,'nva',1863,1),(234,'nys',1863,1),(235,'ola',1863,1),(236,'ona',1863,1),(237,'ora',1863,1),(238,'rah',1863,1),(239,'riana',1863,1),(240,'riel',1863,1),(241,'rona',1863,1),(242,'tai',1863,1),(243,'tevere',1863,1),(244,'thea',1863,1),(245,'vina',1863,1),(246,'wena',1863,1),(247,'wyn',1863,1),(248,'xia',1863,1),(249,'yla',1863,1),(250,'yssa',1863,1),(251,'Flaa',17252,0),(252,'Haa',17252,0),(253,'Jhuu',17252,0),(254,'Shaa',17252,0),(255,'Thoo',17252,0),(256,'dhun',17252,1),(257,'ghun',17252,1),(258,'roon',17252,1),(259,'thun',17252,1),(260,'tom',17252,1),(261,'Stone',26125,0),(262,'Stone',26125,0),(263,'Eye',26125,0),(264,'Dirt',26125,0),(265,'Blight',26125,0),(266,'Bat',26125,0),(267,'Rat',26125,0),(268,'Corpse',26125,0),(269,'Grave',26125,0),(270,'Carrion',26125,0),(271,'Skull',26125,0),(272,'Bone',26125,0),(273,'Crypt',26125,0),(274,'Rib',26125,0),(275,'Brain',26125,0),(276,'Tomb',26125,0),(277,'Rot',26125,0),(278,'Gravel',26125,0),(279,'Plague',26125,0),(280,'Casket',26125,0),(281,'Limb',26125,0),(282,'Worm',26125,0),(283,'Earth',26125,0),(284,'Spine',26125,0),(285,'Pebble',26125,0),(286,'Root',26125,0),(287,'Marrow',26125,0),(288,'Hammer',26125,0),(289,'ravager',26125,1),(290,'muncher',26125,1),(291,'cruncher',26125,1),(292,'masher',26125,1),(293,'leaper',26125,1),(294,'grinder',26125,1),(295,'stalker',26125,1),(296,'gobbler',26125,1),(297,'feeder',26125,1),(298,'basher',26125,1),(299,'chewer',26125,1),(300,'ripper',26125,1),(301,'slicer',26125,1),(302,'gnaw',26125,1),(303,'flayer',26125,1),(304,'rumbler',26125,1),(305,'chomp',26125,1),(306,'breaker',26125,1),(307,'keeper',26125,1),(308,'rawler',26125,1),(309,'stealer',26125,1),(310,'thief',26125,1),(311,'catcher',26125,1),(312,'drinker',26125,1),(313,'slicer',26125,1); +/*!40000 ALTER TABLE `pet_name_generation` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pickpocketing_loot_template` +-- + +DROP TABLE IF EXISTS `pickpocketing_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pickpocketing_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pickpocketing_loot_template` +-- + +LOCK TABLES `pickpocketing_loot_template` WRITE; +/*!40000 ALTER TABLE `pickpocketing_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `pickpocketing_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `player_classlevelstats` +-- + +DROP TABLE IF EXISTS `player_classlevelstats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `player_classlevelstats` ( + `class` tinyint(3) unsigned NOT NULL, + `level` tinyint(3) unsigned NOT NULL, + `basehp` smallint(5) unsigned NOT NULL, + `basemana` smallint(5) unsigned NOT NULL, + PRIMARY KEY (`class`,`level`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 COMMENT='Stores levels stats.'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `player_classlevelstats` +-- + +LOCK TABLES `player_classlevelstats` WRITE; +/*!40000 ALTER TABLE `player_classlevelstats` DISABLE KEYS */; +INSERT INTO `player_classlevelstats` VALUES (1,1,20,0),(1,2,29,0),(1,3,38,0),(1,4,47,0),(1,5,56,0),(1,6,65,0),(1,7,74,0),(1,8,83,0),(1,9,92,0),(1,10,101,0),(1,11,100,0),(1,12,109,0),(1,13,118,0),(1,14,128,0),(1,15,139,0),(1,16,151,0),(1,17,154,0),(1,18,168,0),(1,19,183,0),(1,20,199,0),(1,21,206,0),(1,22,224,0),(1,23,243,0),(1,24,253,0),(1,25,274,0),(1,26,296,0),(1,27,309,0),(1,28,333,0),(1,29,348,0),(1,30,374,0),(1,31,401,0),(1,32,419,0),(1,33,448,0),(1,34,468,0),(1,35,499,0),(1,36,521,0),(1,37,545,0),(1,38,581,0),(1,39,609,0),(1,40,649,0),(1,41,681,0),(1,42,715,0),(1,43,761,0),(1,44,799,0),(1,45,839,0),(1,46,881,0),(1,47,935,0),(1,48,981,0),(1,49,1029,0),(1,50,1079,0),(1,51,1131,0),(1,52,1185,0),(1,53,1241,0),(1,54,1299,0),(1,55,1359,0),(1,56,1421,0),(1,57,1485,0),(1,58,1551,0),(1,59,1619,0),(1,60,1689,0),(1,61,1902,0),(1,62,2129,0),(1,63,2357,0),(1,64,2612,0),(1,65,2883,0),(1,66,3169,0),(1,67,3455,0),(1,68,3774,0),(1,69,4109,0),(1,70,4444,0),(2,1,28,60),(2,2,36,78),(2,3,44,98),(2,4,52,104),(2,5,60,111),(2,6,68,134),(2,7,76,143),(2,8,84,153),(2,9,92,179),(2,10,100,192),(2,11,108,205),(2,12,116,219),(2,13,124,249),(2,14,132,265),(2,15,131,282),(2,16,141,315),(2,17,152,334),(2,18,164,354),(2,19,177,390),(2,20,191,412),(2,21,206,435),(2,22,222,459),(2,23,239,499),(2,24,247,525),(2,25,266,552),(2,26,286,579),(2,27,307,621),(2,28,329,648),(2,29,342,675),(2,30,366,702),(2,31,391,729),(2,32,407,756),(2,33,434,798),(2,34,462,825),(2,35,481,852),(2,36,511,879),(2,37,542,906),(2,38,564,933),(2,39,597,960),(2,40,621,987),(2,41,656,1014),(2,42,682,1041),(2,43,719,1068),(2,44,747,1110),(2,45,786,1137),(2,46,816,1164),(2,47,857,1176),(2,48,889,1203),(2,49,922,1230),(2,50,966,1257),(2,51,1001,1284),(2,52,1037,1311),(2,53,1084,1338),(2,54,1122,1365),(2,55,1161,1392),(2,56,1201,1419),(2,57,1252,1446),(2,58,1294,1458),(2,59,1337,1485),(2,60,1381,1512),(2,61,1540,1656),(2,62,1708,1800),(2,63,1884,1944),(2,64,2068,2088),(2,65,2262,2232),(2,66,2466,2377),(2,67,2679,2521),(2,68,2901,2665),(2,69,3134,2809),(2,70,3377,2953),(3,1,46,65),(3,2,53,70),(3,3,60,76),(3,4,67,98),(3,5,74,106),(3,6,81,130),(3,7,88,140),(3,8,95,166),(3,9,102,193),(3,10,109,206),(3,11,116,235),(3,12,123,250),(3,13,130,266),(3,14,138,298),(3,15,147,316),(3,16,157,350),(3,17,168,370),(3,18,180,391),(3,19,193,428),(3,20,207,451),(3,21,222,475),(3,22,238,515),(3,23,255,541),(3,24,273,568),(3,25,292,611),(3,26,312,640),(3,27,333,670),(3,28,355,715),(3,29,378,745),(3,30,402,775),(3,31,417,805),(3,32,443,850),(3,33,470,880),(3,34,498,910),(3,35,527,940),(3,36,547,970),(3,37,578,1015),(3,38,610,1045),(3,39,643,1075),(3,40,667,1105),(3,41,702,1135),(3,42,738,1180),(3,43,775,1210),(3,44,803,1240),(3,45,842,1270),(3,46,872,1300),(3,47,913,1330),(3,48,955,1360),(3,49,994,1390),(3,50,1047,1420),(3,51,1067,1450),(3,52,1113,1480),(3,53,1150,1510),(3,54,1198,1540),(3,55,1237,1570),(3,56,1287,1600),(3,57,1328,1630),(3,58,1370,1660),(3,59,1423,1690),(3,60,1467,1720),(3,61,1633,1886),(3,62,1819,2053),(3,63,2003,2219),(3,64,2195,2385),(3,65,2397,2552),(3,66,2623,2718),(3,67,2844,2884),(3,68,3075,3050),(3,69,3316,3217),(3,70,3568,3383),(4,1,25,0),(4,2,32,0),(4,3,49,0),(4,4,56,0),(4,5,63,0),(4,6,70,0),(4,7,87,0),(4,8,94,0),(4,9,101,0),(4,10,118,0),(4,11,125,0),(4,12,142,0),(4,13,149,0),(4,14,156,0),(4,15,173,0),(4,16,181,0),(4,17,190,0),(4,18,200,0),(4,19,221,0),(4,20,233,0),(4,21,246,0),(4,22,260,0),(4,23,275,0),(4,24,301,0),(4,25,318,0),(4,26,336,0),(4,27,355,0),(4,28,375,0),(4,29,396,0),(4,30,428,0),(4,31,451,0),(4,32,475,0),(4,33,500,0),(4,34,526,0),(4,35,553,0),(4,36,581,0),(4,37,610,0),(4,38,640,0),(4,39,671,0),(4,40,703,0),(4,41,736,0),(4,42,770,0),(4,43,805,0),(4,44,841,0),(4,45,878,0),(4,46,916,0),(4,47,955,0),(4,48,995,0),(4,49,1026,0),(4,50,1068,0),(4,51,1111,0),(4,52,1155,0),(4,53,1200,0),(4,54,1246,0),(4,55,1283,0),(4,56,1331,0),(4,57,1380,0),(4,58,1430,0),(4,59,1471,0),(4,60,1523,0),(4,61,1702,0),(4,62,1879,0),(4,63,2077,0),(4,64,2285,0),(4,65,2489,0),(4,66,2717,0),(4,67,2941,0),(4,68,3190,0),(4,69,3450,0),(4,70,3704,0),(5,1,52,73),(5,2,57,76),(5,3,72,95),(5,4,77,114),(5,5,92,133),(5,6,97,152),(5,7,112,171),(5,8,117,190),(5,9,132,209),(5,10,137,212),(5,11,142,215),(5,12,157,234),(5,13,172,254),(5,14,177,260),(5,15,192,282),(5,16,197,305),(5,17,212,329),(5,18,227,339),(5,19,232,365),(5,20,247,377),(5,21,252,405),(5,22,268,434),(5,23,275,449),(5,24,293,480),(5,25,302,497),(5,26,322,530),(5,27,343,549),(5,28,355,584),(5,29,378,605),(5,30,392,627),(5,31,417,665),(5,32,433,689),(5,33,460,728),(5,34,478,752),(5,35,507,776),(5,36,527,800),(5,37,548,839),(5,38,580,863),(5,39,603,887),(5,40,637,911),(5,41,662,950),(5,42,698,974),(5,43,725,998),(5,44,763,1022),(5,45,792,1046),(5,46,822,1070),(5,47,863,1094),(5,48,895,1118),(5,49,928,1142),(5,50,972,1166),(5,51,1007,1190),(5,52,1053,1214),(5,53,1090,1238),(5,54,1128,1262),(5,55,1177,1271),(5,56,1217,1295),(5,57,1258,1319),(5,58,1300,1343),(5,59,1353,1352),(5,60,1397,1376),(5,61,1557,1500),(5,62,1738,1625),(5,63,1916,1749),(5,64,2101,1873),(5,65,2295,1998),(5,66,2495,2122),(5,67,2719,2247),(5,68,2936,2371),(5,69,3160,2495),(5,70,3391,2620),(7,80,6939,4396),(7,79,6457,4252),(7,78,6009,4108),(7,77,5592,3965),(7,76,5203,3821),(7,75,4843,3677),(7,74,4507,3533),(7,73,4194,3389),(7,72,3903,3246),(7,71,3633,3102),(7,70,3380,2958),(7,69,3136,2814),(7,68,2903,2670),(7,67,2679,2527),(7,66,2465,2383),(7,65,2262,2239),(7,64,2067,2095),(7,63,1883,1951),(7,62,1694,1808),(7,61,1528,1664),(7,60,1423,1520),(7,59,1326,1501),(7,58,1283,1467),(7,57,1231,1448),(7,56,1190,1414),(7,55,1150,1395),(7,54,1101,1376),(7,53,1064,1342),(7,52,1027,1323),(7,51,981,1289),(7,50,947,1255),(7,49,903,1236),(7,48,871,1202),(7,47,829,1183),(7,46,799,1149),(7,45,760,1115),(7,44,732,1096),(7,43,694,1062),(7,42,669,1028),(7,41,633,1009),(7,40,610,975),(7,39,577,941),(7,38,545,922),(7,37,524,888),(7,36,494,854),(7,35,465,820),(7,34,448,786),(7,33,422,767),(7,32,396,733),(7,31,371,699),(7,30,358,665),(7,29,336,631),(7,28,315,598),(7,27,294,566),(7,26,275,535),(7,25,257,505),(7,24,250,476),(7,23,234,448),(7,22,219,421),(7,21,205,395),(7,20,193,370),(7,19,181,346),(7,18,170,323),(7,17,161,301),(7,16,152,280),(7,15,144,260),(7,14,137,241),(7,13,129,223),(7,12,122,206),(7,11,114,190),(8,1,32,100),(8,2,47,110),(8,3,52,106),(8,4,67,118),(8,5,82,131),(8,6,97,130),(8,7,102,145),(8,8,117,146),(8,9,132,163),(8,10,137,196),(8,11,152,215),(8,12,167,220),(8,13,172,241),(8,14,187,263),(8,15,202,271),(8,16,207,295),(8,17,222,305),(8,18,237,331),(8,19,242,343),(8,20,257,371),(8,21,272,385),(8,22,277,415),(8,23,292,431),(8,24,298,463),(8,25,315,481),(8,26,333,515),(8,27,342,535),(8,28,362,556),(8,29,373,592),(8,30,395,613),(8,31,418,634),(8,32,432,670),(8,33,457,691),(8,34,473,712),(8,35,500,733),(8,36,518,754),(8,37,547,790),(8,38,577,811),(8,39,598,832),(8,40,630,853),(8,41,653,874),(8,42,687,895),(8,43,712,916),(8,44,748,937),(8,45,775,958),(8,46,813,979),(8,47,842,1000),(8,48,882,1021),(8,49,913,1042),(8,50,955,1048),(8,51,988,1069),(8,52,1032,1090),(8,53,1067,1111),(8,54,1103,1117),(8,55,1150,1138),(8,56,1188,1159),(8,57,1237,1165),(8,58,1277,1186),(8,59,1328,1192),(8,60,1370,1213),(8,61,1526,1316),(8,62,1702,1419),(8,63,1875,1521),(8,64,2070,1624),(8,65,2261,1727),(8,66,2461,1830),(8,67,2686,1932),(8,68,2906,2035),(8,69,3136,2138),(8,70,3393,2241),(9,1,23,90),(9,2,28,98),(9,3,43,107),(9,4,48,102),(9,5,63,113),(9,6,68,126),(9,7,83,144),(9,8,88,162),(9,9,93,180),(9,10,108,198),(9,11,123,200),(9,12,128,218),(9,13,143,237),(9,14,148,257),(9,15,153,278),(9,16,168,300),(9,17,173,308),(9,18,189,332),(9,19,196,357),(9,20,204,383),(9,21,223,395),(9,22,233,423),(9,23,244,452),(9,24,266,467),(9,25,279,498),(9,26,293,530),(9,27,318,548),(9,28,334,582),(9,29,351,602),(9,30,379,638),(9,31,398,674),(9,32,418,695),(9,33,439,731),(9,34,471,752),(9,35,494,788),(9,36,518,809),(9,37,543,830),(9,38,569,866),(9,39,606,887),(9,40,634,923),(9,41,663,944),(9,42,693,965),(9,43,724,1001),(9,44,756,1022),(9,45,799,1043),(9,46,832,1064),(9,47,868,1100),(9,48,904,1121),(9,49,941,1142),(9,50,979,1163),(9,51,1018,1184),(9,52,1058,1205),(9,53,1099,1226),(9,54,1141,1247),(9,55,1184,1268),(9,56,1228,1289),(9,57,1273,1310),(9,58,1319,1331),(9,59,1366,1352),(9,60,1414,1373),(9,61,1580,1497),(9,62,1755,1621),(9,63,1939,1745),(9,64,2133,1870),(9,65,2323,1994),(9,66,2535,2118),(9,67,2758,2242),(9,68,2991,2366),(9,69,3235,2490),(9,70,3490,2615),(11,1,44,60),(11,2,51,66),(11,3,58,73),(11,4,75,81),(11,5,82,90),(11,6,89,100),(11,7,106,111),(11,8,113,123),(11,9,120,136),(11,10,137,150),(11,11,144,165),(11,12,151,182),(11,13,168,200),(11,14,175,219),(11,15,182,239),(11,16,199,260),(11,17,206,282),(11,18,214,305),(11,19,233,329),(11,20,243,354),(11,21,254,380),(11,22,266,392),(11,23,289,420),(11,24,303,449),(11,25,318,479),(11,26,334,509),(11,27,361,524),(11,28,379,554),(11,29,398,584),(11,30,418,614),(11,31,439,629),(11,32,461,659),(11,33,494,689),(11,34,518,704),(11,35,543,734),(11,36,569,749),(11,37,596,779),(11,38,624,809),(11,39,653,824),(11,40,683,854),(11,41,714,869),(11,42,746,899),(11,43,779,914),(11,44,823,944),(11,45,858,959),(11,46,894,989),(11,47,921,1004),(11,48,959,1019),(11,49,998,1049),(11,50,1038,1064),(11,51,1079,1079),(11,52,1121,1109),(11,53,1164,1124),(11,54,1208,1139),(11,55,1253,1154),(11,56,1299,1169),(11,57,1346,1199),(11,58,1384,1214),(11,59,1433,1229),(11,60,1483,1244),(11,61,1657,1357),(11,62,1840,1469),(11,63,2020,1582),(11,64,2222,1694),(11,65,2433,1807),(11,66,2640,1919),(11,67,2872,2032),(11,68,3114,2145),(11,69,3351,2257),(11,70,3614,2370),(1,71,4720,0),(1,72,5013,0),(1,73,5325,0),(1,74,5656,0),(1,75,6008,0),(1,76,6381,0),(1,77,6778,0),(1,78,7198,0),(1,79,7646,0),(1,80,8121,0),(2,71,3629,3097),(2,72,3900,3241),(2,73,4191,3385),(2,74,4503,3529),(2,75,4839,3673),(2,76,5200,3817),(2,77,5588,3962),(2,78,6005,4106),(2,79,6453,4250),(2,80,6934,4394),(3,71,3834,3549),(3,72,4120,3716),(3,73,4427,3882),(3,74,4757,4048),(3,75,5112,4215),(3,76,5493,4381),(3,77,5903,4547),(3,78,6343,4713),(3,79,6816,4880),(3,80,7324,5046),(4,71,3980,0),(4,72,4277,0),(4,73,4596,0),(4,74,4939,0),(4,75,5307,0),(4,76,5703,0),(4,77,6128,0),(4,78,6585,0),(4,79,7076,0),(4,80,7604,0),(5,71,3644,2744),(5,72,3916,2868),(5,73,4208,2993),(5,74,4522,3117),(5,75,4859,3242),(5,76,5221,3366),(5,77,5610,3490),(5,78,6028,3615),(5,79,6477,3739),(5,80,6960,3863),(6,1,22,0),(6,2,27,0),(6,3,32,0),(6,4,37,0),(6,5,42,0),(6,6,47,0),(6,7,52,0),(6,8,58,0),(6,9,64,0),(6,10,70,0),(6,11,77,0),(6,12,84,0),(6,13,92,0),(6,14,100,0),(6,15,117,0),(6,16,127,0),(6,17,138,0),(6,18,150,0),(6,19,163,0),(6,20,177,0),(6,21,192,0),(6,22,208,0),(6,23,225,0),(6,24,239,0),(6,25,258,0),(6,26,278,0),(6,27,299,0),(6,28,321,0),(6,29,344,0),(6,30,368,0),(6,31,393,0),(6,32,419,0),(6,33,446,0),(6,34,474,0),(6,35,503,0),(6,36,533,0),(6,37,564,0),(6,38,596,0),(6,39,629,0),(6,40,698,0),(6,41,698,0),(6,42,734,0),(6,43,771,0),(6,44,809,0),(6,45,849,0),(6,46,891,0),(6,47,935,0),(6,48,981,0),(6,49,1029,0),(6,50,1079,0),(6,51,1131,0),(6,52,1185,0),(6,53,1241,0),(6,54,1299,0),(6,55,1359,0),(6,56,1421,0),(6,57,1485,0),(6,58,1551,0),(6,59,1619,0),(6,60,1689,0),(6,61,1902,0),(6,62,2129,0),(6,63,2357,0),(6,64,2612,0),(6,65,2883,0),(6,66,3169,0),(6,67,3455,0),(6,68,3774,0),(6,69,4109,0),(6,70,4444,0),(6,71,4720,0),(6,72,5013,0),(6,73,5325,0),(6,74,5656,0),(6,75,6008,0),(6,76,6381,0),(6,77,6778,0),(6,78,7199,0),(6,79,7646,0),(6,80,8121,0),(7,10,107,175),(7,9,100,161),(7,8,92,148),(7,7,85,136),(7,6,77,125),(7,5,70,115),(7,4,62,106),(7,3,55,98),(7,2,47,91),(7,1,40,85),(8,71,3646,2343),(8,72,3918,2446),(8,73,4210,2549),(8,74,4524,2652),(8,75,4861,2754),(8,76,5223,2857),(8,77,5612,2960),(8,78,6030,3063),(8,79,6480,3165),(8,80,6963,3268),(9,71,3750,2739),(9,72,4025,2863),(9,73,4330,2987),(9,74,4646,3111),(9,75,4997,3235),(9,76,5373,3360),(9,77,5774,3483),(9,78,6207,3608),(9,79,6667,3732),(9,80,7136,3856),(11,71,3883,2482),(11,72,4172,2595),(11,73,4483,2708),(11,74,4817,2820),(11,75,5176,2933),(11,76,5562,3045),(11,77,5977,3158),(11,78,6423,3270),(11,79,6902,3383),(11,80,7417,3496); +/*!40000 ALTER TABLE `player_classlevelstats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `player_levelstats` +-- + +DROP TABLE IF EXISTS `player_levelstats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `player_levelstats` ( + `race` tinyint(3) unsigned NOT NULL, + `class` tinyint(3) unsigned NOT NULL, + `level` tinyint(3) unsigned NOT NULL, + `str` tinyint(3) unsigned NOT NULL, + `agi` tinyint(3) unsigned NOT NULL, + `sta` tinyint(3) unsigned NOT NULL, + `inte` tinyint(3) unsigned NOT NULL, + `spi` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`race`,`class`,`level`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0 COMMENT='Stores levels stats.'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `player_levelstats` +-- + +LOCK TABLES `player_levelstats` WRITE; +/*!40000 ALTER TABLE `player_levelstats` DISABLE KEYS */; +INSERT INTO `player_levelstats` VALUES (1,1,1,23,20,22,20,20),(1,1,2,24,21,23,20,20),(1,1,3,26,22,24,20,21),(1,1,4,27,22,26,20,21),(1,1,5,28,23,27,20,21),(1,1,6,30,24,28,20,21),(1,1,7,31,25,29,21,22),(1,1,8,32,26,30,21,22),(1,1,9,34,26,32,21,22),(1,1,10,35,27,33,21,23),(1,1,11,36,28,34,21,23),(1,1,12,38,29,35,21,23),(1,1,13,39,30,37,21,24),(1,1,14,41,31,38,21,24),(1,1,15,42,32,39,21,24),(1,1,16,44,33,41,21,25),(1,1,17,45,34,42,22,25),(1,1,18,47,34,43,22,25),(1,1,19,48,35,45,22,26),(1,1,20,50,36,46,22,26),(1,1,21,51,37,48,22,26),(1,1,22,53,38,49,22,27),(1,1,23,54,39,51,22,27),(1,1,24,56,40,52,23,28),(1,1,25,58,41,53,23,28),(1,1,26,59,42,55,23,28),(1,1,27,61,43,56,23,29),(1,1,28,63,44,58,23,29),(1,1,29,64,45,59,23,30),(1,1,30,66,46,61,24,30),(1,1,31,68,47,62,24,30),(1,1,32,69,48,64,24,31),(1,1,33,71,50,66,24,31),(1,1,34,73,51,67,24,32),(1,1,35,74,52,69,24,32),(1,1,36,76,53,70,25,33),(1,1,37,78,54,72,25,33),(1,1,38,80,55,74,25,34),(1,1,39,82,56,75,25,34),(1,1,40,83,57,77,25,35),(1,1,41,85,58,79,26,35),(1,1,42,87,60,80,26,35),(1,1,43,89,61,82,26,36),(1,1,44,91,62,84,26,36),(1,1,45,93,63,85,26,37),(1,1,46,95,64,87,27,37),(1,1,47,97,66,89,27,38),(1,1,48,99,67,91,27,38),(1,1,49,101,68,93,27,39),(1,1,50,103,69,94,28,40),(1,1,51,105,71,96,28,40),(1,1,52,107,72,98,28,41),(1,1,53,109,73,100,28,41),(1,1,54,111,74,102,29,42),(1,1,55,113,76,103,29,42),(1,1,56,115,77,105,29,43),(1,1,57,117,78,107,29,43),(1,1,58,119,79,109,30,44),(1,1,59,121,81,111,30,44),(1,1,60,123,82,113,30,45),(1,1,61,125,83,115,30,46),(1,1,62,127,85,117,31,46),(1,1,63,129,86,119,31,47),(1,1,64,132,88,121,31,47),(1,1,65,134,89,123,32,48),(1,1,66,136,90,125,32,49),(1,1,67,138,92,127,32,49),(1,1,68,140,93,129,32,50),(1,1,69,143,95,131,33,50),(1,1,70,145,96,133,33,51),(1,1,71,148,97,140,33,53),(1,1,72,156,99,143,33,54),(1,1,73,162,101,148,33,55),(1,1,74,162,102,148,34,55),(1,1,75,165,104,150,34,56),(1,1,76,171,106,156,34,57),(1,1,77,171,108,157,35,58),(1,1,78,174,109,159,35,58),(1,1,79,181,111,165,35,59),(1,1,80,184,113,168,36,60),(1,2,1,22,20,22,20,21),(1,2,2,23,21,23,21,22),(1,2,3,24,21,24,21,22),(1,2,4,25,22,25,22,23),(1,2,5,26,22,26,23,24),(1,2,6,28,23,27,23,25),(1,2,7,29,24,28,24,25),(1,2,8,30,24,29,25,26),(1,2,9,31,25,30,25,27),(1,2,10,32,25,32,26,27),(1,2,11,33,26,33,27,28),(1,2,12,35,27,34,27,29),(1,2,13,36,27,35,28,30),(1,2,14,37,28,36,29,31),(1,2,15,38,29,37,30,31),(1,2,16,40,29,38,30,32),(1,2,17,41,30,40,31,33),(1,2,18,42,31,41,32,34),(1,2,19,43,31,42,33,35),(1,2,20,45,32,43,33,35),(1,2,21,46,33,45,34,36),(1,2,22,47,33,46,35,37),(1,2,23,49,34,47,36,38),(1,2,24,50,35,48,37,39),(1,2,25,51,36,50,37,40),(1,2,26,53,36,51,38,41),(1,2,27,54,37,52,39,42),(1,2,28,56,38,54,40,43),(1,2,29,57,39,55,41,43),(1,2,30,58,39,56,42,44),(1,2,31,60,40,58,43,45),(1,2,32,61,41,59,43,46),(1,2,33,63,42,60,44,47),(1,2,34,64,43,62,45,48),(1,2,35,66,44,63,46,49),(1,2,36,67,44,65,47,50),(1,2,37,69,45,66,48,51),(1,2,38,70,46,67,49,52),(1,2,39,72,47,69,50,53),(1,2,40,73,48,70,51,54),(1,2,41,75,49,72,52,55),(1,2,42,77,49,73,53,56),(1,2,43,78,50,75,54,57),(1,2,44,80,51,76,55,58),(1,2,45,81,52,78,56,59),(1,2,46,83,53,79,57,61),(1,2,47,85,54,81,58,62),(1,2,48,86,55,83,59,63),(1,2,49,88,56,84,60,64),(1,2,50,90,57,86,61,65),(1,2,51,91,58,87,62,66),(1,2,52,93,59,89,63,67),(1,2,53,95,60,91,64,68),(1,2,54,97,61,92,65,69),(1,2,55,98,61,94,66,71),(1,2,56,100,62,95,67,72),(1,2,57,102,63,97,68,73),(1,2,58,104,64,99,69,74),(1,2,59,105,65,101,70,75),(1,2,60,107,66,102,71,77),(1,2,61,109,67,104,73,78),(1,2,62,111,69,106,74,79),(1,2,63,113,70,107,75,80),(1,2,64,115,71,109,76,81),(1,2,65,116,72,111,77,83),(1,2,66,118,73,113,78,84),(1,2,67,120,74,115,79,85),(1,2,68,122,75,116,81,86),(1,2,69,124,76,118,82,88),(1,2,70,126,77,120,83,89),(1,2,71,148,78,122,84,92),(1,2,72,150,79,125,86,94),(1,2,73,152,80,127,87,96),(1,2,74,156,82,129,89,97),(1,2,75,158,83,131,90,99),(1,2,76,162,84,134,92,100),(1,2,77,164,86,136,93,103),(1,2,78,167,87,138,95,105),(1,2,79,170,88,153,96,106),(1,2,80,173,90,160,98,108),(1,4,1,21,23,21,20,20),(1,4,2,22,24,22,20,20),(1,4,3,23,26,22,20,21),(1,4,4,23,27,23,20,21),(1,4,5,24,29,24,21,21),(1,4,6,25,30,25,21,22),(1,4,7,26,32,25,21,22),(1,4,8,26,33,26,21,23),(1,4,9,27,35,27,21,23),(1,4,10,28,36,27,21,23),(1,4,11,29,38,28,22,24),(1,4,12,30,39,29,22,24),(1,4,13,31,41,30,22,25),(1,4,14,31,43,31,22,25),(1,4,15,32,44,31,22,25),(1,4,16,33,46,32,23,26),(1,4,17,34,48,33,23,26),(1,4,18,35,49,34,23,27),(1,4,19,36,51,35,23,27),(1,4,20,37,53,35,23,28),(1,4,21,38,54,36,24,28),(1,4,22,39,56,37,24,29),(1,4,23,40,58,38,24,29),(1,4,24,41,60,39,24,30),(1,4,25,42,61,40,25,30),(1,4,26,43,63,41,25,31),(1,4,27,44,65,42,25,31),(1,4,28,45,67,43,25,32),(1,4,29,46,69,43,25,32),(1,4,30,47,71,44,26,33),(1,4,31,48,72,45,26,33),(1,4,32,49,74,46,26,34),(1,4,33,50,76,47,27,34),(1,4,34,51,78,48,27,35),(1,4,35,52,80,49,27,35),(1,4,36,53,82,50,27,36),(1,4,37,54,84,51,28,36),(1,4,38,55,86,52,28,37),(1,4,39,56,88,53,28,38),(1,4,40,57,90,54,28,38),(1,4,41,58,92,55,29,39),(1,4,42,60,94,56,29,39),(1,4,43,61,96,57,29,40),(1,4,44,62,98,58,30,40),(1,4,45,63,100,59,30,41),(1,4,46,64,103,61,30,42),(1,4,47,65,105,62,31,42),(1,4,48,66,107,63,31,43),(1,4,49,68,109,64,31,44),(1,4,50,69,111,65,32,44),(1,4,51,70,113,66,32,45),(1,4,52,71,116,67,32,45),(1,4,53,73,118,68,33,46),(1,4,54,74,120,69,33,47),(1,4,55,75,122,71,33,47),(1,4,56,76,125,72,34,48),(1,4,57,78,127,73,34,49),(1,4,58,79,129,74,34,49),(1,4,59,80,131,75,35,50),(1,4,60,81,134,77,35,51),(1,4,61,83,136,78,35,51),(1,4,62,84,138,79,36,52),(1,4,63,85,141,80,36,53),(1,4,64,87,143,81,37,54),(1,4,65,88,146,83,37,54),(1,4,66,89,148,84,37,55),(1,4,67,91,151,85,38,56),(1,4,68,92,153,86,38,57),(1,4,69,94,156,88,39,57),(1,4,70,95,158,89,39,58),(1,4,71,97,161,90,39,60),(1,4,72,99,164,92,40,60),(1,4,73,100,167,94,40,61),(1,4,74,102,170,95,41,62),(1,4,75,104,173,97,41,63),(1,4,76,105,176,98,41,64),(1,4,77,107,179,100,42,65),(1,4,78,109,183,106,42,66),(1,4,79,111,186,107,43,67),(1,4,80,113,189,109,43,69),(1,5,1,20,20,20,22,23),(1,5,2,20,20,20,23,24),(1,5,3,20,20,21,25,26),(1,5,4,20,21,21,26,27),(1,5,5,21,21,21,27,28),(1,5,6,21,21,22,29,30),(1,5,7,21,21,22,30,31),(1,5,8,21,22,23,31,33),(1,5,9,21,22,23,33,34),(1,5,10,21,22,23,34,36),(1,5,11,22,22,24,36,37),(1,5,12,22,23,24,37,39),(1,5,13,22,23,25,38,40),(1,5,14,22,23,25,40,42),(1,5,15,22,23,25,41,43),(1,5,16,23,24,26,43,45),(1,5,17,23,24,26,44,46),(1,5,18,23,24,27,46,48),(1,5,19,23,24,27,47,49),(1,5,20,23,25,28,49,51),(1,5,21,24,25,28,51,53),(1,5,22,24,25,29,52,54),(1,5,23,24,26,29,54,56),(1,5,24,24,26,30,55,58),(1,5,25,25,26,30,57,59),(1,5,26,25,27,31,59,61),(1,5,27,25,27,31,60,63),(1,5,28,25,27,32,62,65),(1,5,29,25,28,32,64,66),(1,5,30,26,28,33,65,68),(1,5,31,26,28,33,67,70),(1,5,32,26,29,34,69,72),(1,5,33,27,29,34,70,73),(1,5,34,27,29,35,72,75),(1,5,35,27,30,35,74,77),(1,5,36,27,30,36,76,79),(1,5,37,28,30,36,78,81),(1,5,38,28,31,37,79,83),(1,5,39,28,31,38,81,85),(1,5,40,28,31,38,83,87),(1,5,41,29,32,39,85,88),(1,5,42,29,32,39,87,90),(1,5,43,29,33,40,89,92),(1,5,44,30,33,40,91,94),(1,5,45,30,33,41,92,96),(1,5,46,30,34,42,94,98),(1,5,47,31,34,42,96,100),(1,5,48,31,35,43,98,102),(1,5,49,31,35,44,100,104),(1,5,50,32,36,44,102,106),(1,5,51,32,36,45,104,109),(1,5,52,32,36,45,106,111),(1,5,53,33,37,46,108,113),(1,5,54,33,37,47,110,115),(1,5,55,33,38,47,112,117),(1,5,56,34,38,48,114,119),(1,5,57,34,39,49,117,121),(1,5,58,34,39,49,119,124),(1,5,59,35,40,50,121,126),(1,5,60,35,40,51,123,128),(1,5,61,35,41,51,125,130),(1,5,62,36,41,52,127,132),(1,5,63,36,41,53,129,135),(1,5,64,37,42,54,132,137),(1,5,65,37,42,54,134,139),(1,5,66,37,43,55,136,142),(1,5,67,38,43,56,138,144),(1,5,68,38,44,57,140,146),(1,5,69,39,44,57,143,149),(1,5,70,39,45,58,145,151),(1,5,71,39,46,59,148,158),(1,5,72,40,46,59,151,161),(1,5,73,40,47,60,154,164),(1,5,74,41,47,61,156,167),(1,5,75,41,48,62,159,170),(1,5,76,41,49,63,162,174),(1,5,77,42,49,64,165,177),(1,5,78,42,50,65,168,180),(1,5,79,43,50,66,171,183),(1,5,80,43,51,67,174,186),(1,6,1,23,20,22,20,20),(1,6,2,24,21,23,20,20),(1,6,3,26,22,24,20,21),(1,6,4,27,22,26,20,21),(1,6,5,28,23,27,20,21),(1,6,6,30,24,28,20,21),(1,6,7,31,25,29,21,22),(1,6,8,32,26,30,21,22),(1,6,9,34,26,32,21,22),(1,6,10,35,27,33,21,23),(1,6,11,36,28,34,21,23),(1,6,12,38,29,35,21,23),(1,6,13,39,30,37,21,24),(1,6,14,41,31,38,21,24),(1,6,15,42,32,39,21,24),(1,6,16,44,33,41,21,25),(1,6,17,45,34,42,22,25),(1,6,18,47,34,43,22,25),(1,6,19,48,35,45,22,26),(1,6,20,50,36,46,22,26),(1,6,21,51,37,48,22,26),(1,6,22,53,38,49,22,27),(1,6,23,54,39,51,22,27),(1,6,24,56,40,52,23,28),(1,6,25,58,41,53,23,28),(1,6,26,59,42,55,23,28),(1,6,27,61,43,56,23,29),(1,6,28,63,44,58,23,29),(1,6,29,64,45,59,23,30),(1,6,30,66,46,61,24,30),(1,6,31,68,47,62,24,30),(1,6,32,69,48,64,24,31),(1,6,33,71,50,66,24,31),(1,6,34,73,51,67,24,32),(1,6,35,74,52,69,24,32),(1,6,36,76,53,70,25,33),(1,6,37,78,54,72,25,33),(1,6,38,80,55,74,25,34),(1,6,39,82,56,75,25,34),(1,6,40,83,57,77,25,35),(1,6,41,85,58,79,26,35),(1,6,42,87,60,80,26,35),(1,6,43,89,61,82,26,36),(1,6,44,91,62,84,26,36),(1,6,45,93,63,85,26,37),(1,6,46,95,64,87,27,37),(1,6,47,97,66,89,27,38),(1,6,48,99,67,91,27,38),(1,6,49,101,68,93,27,39),(1,6,50,103,69,94,28,40),(1,6,51,105,71,96,28,40),(1,6,52,106,72,97,28,41),(1,6,53,107,72,98,28,41),(1,6,54,107,73,98,29,42),(1,6,55,108,73,99,29,43),(1,6,56,111,75,102,29,44),(1,6,57,113,76,104,29,44),(1,6,58,118,77,106,30,45),(1,6,59,118,79,108,30,45),(1,6,60,123,80,110,30,46),(1,6,61,125,81,112,30,47),(1,6,62,128,83,114,30,47),(1,6,63,130,84,117,31,48),(1,6,64,130,86,119,31,48),(1,6,65,140,87,128,31,49),(1,6,66,143,89,131,31,50),(1,6,67,146,90,133,32,50),(1,6,68,148,92,135,32,51),(1,6,69,151,93,138,32,52),(1,6,70,154,95,140,32,52),(1,6,71,162,97,144,33,53),(1,6,72,164,98,146,33,54),(1,6,73,165,100,148,33,55),(1,6,74,166,102,151,33,55),(1,6,75,169,103,154,34,56),(1,6,76,172,105,157,34,57),(1,6,77,175,107,157,34,58),(1,6,78,176,108,157,34,58),(1,6,79,177,110,157,35,59),(1,6,80,180,112,160,35,60),(1,8,1,20,20,20,23,22),(1,8,2,20,20,20,24,23),(1,8,3,20,20,21,26,25),(1,8,4,20,20,21,27,26),(1,8,5,20,21,21,28,27),(1,8,6,20,21,21,30,29),(1,8,7,21,21,22,31,30),(1,8,8,21,21,22,33,31),(1,8,9,21,21,22,34,33),(1,8,10,21,21,23,36,34),(1,8,11,21,22,23,37,36),(1,8,12,21,22,23,39,37),(1,8,13,21,22,24,40,38),(1,8,14,21,22,24,42,40),(1,8,15,21,22,24,43,41),(1,8,16,21,23,25,45,43),(1,8,17,22,23,25,46,44),(1,8,18,22,23,25,48,46),(1,8,19,22,23,26,49,47),(1,8,20,22,23,26,51,49),(1,8,21,22,24,26,53,51),(1,8,22,22,24,27,54,52),(1,8,23,22,24,27,56,54),(1,8,24,23,24,28,58,55),(1,8,25,23,25,28,59,57),(1,8,26,23,25,28,61,59),(1,8,27,23,25,29,63,60),(1,8,28,23,25,29,65,62),(1,8,29,23,25,30,66,64),(1,8,30,24,26,30,68,65),(1,8,31,24,26,30,70,67),(1,8,32,24,26,31,72,69),(1,8,33,24,27,31,73,70),(1,8,34,24,27,32,75,72),(1,8,35,24,27,32,77,74),(1,8,36,25,27,33,79,76),(1,8,37,25,28,33,81,78),(1,8,38,25,28,34,83,79),(1,8,39,25,28,34,85,81),(1,8,40,25,28,35,87,83),(1,8,41,26,29,35,88,85),(1,8,42,26,29,35,90,87),(1,8,43,26,29,36,92,89),(1,8,44,26,30,36,94,91),(1,8,45,26,30,37,96,92),(1,8,46,27,30,37,98,94),(1,8,47,27,31,38,100,96),(1,8,48,27,31,38,102,98),(1,8,49,27,31,39,104,100),(1,8,50,28,32,40,106,102),(1,8,51,28,32,40,109,104),(1,8,52,28,32,41,111,106),(1,8,53,28,33,41,113,108),(1,8,54,29,33,42,115,110),(1,8,55,29,33,42,117,112),(1,8,56,29,34,43,119,114),(1,8,57,29,34,43,121,117),(1,8,58,30,34,44,124,119),(1,8,59,30,35,44,126,121),(1,8,60,30,35,45,128,123),(1,8,61,30,35,46,130,125),(1,8,62,31,36,46,132,127),(1,8,63,31,36,47,135,129),(1,8,64,31,37,47,137,132),(1,8,65,32,37,48,139,134),(1,8,66,32,37,49,142,136),(1,8,67,32,38,49,144,138),(1,8,68,32,38,50,146,140),(1,8,69,33,39,50,149,143),(1,8,70,33,39,51,151,145),(1,8,71,33,39,52,154,152),(1,8,72,33,40,53,160,155),(1,8,73,33,40,54,160,158),(1,8,74,34,41,54,163,160),(1,8,75,34,41,55,166,163),(1,8,76,34,41,56,169,166),(1,8,77,35,42,57,172,169),(1,8,78,35,42,57,175,173),(1,8,79,35,43,58,178,176),(1,8,80,36,43,59,181,179),(1,9,1,20,20,21,22,22),(1,9,2,20,20,22,23,23),(1,9,3,21,21,22,24,24),(1,9,4,21,21,23,26,25),(1,9,5,21,21,23,27,27),(1,9,6,21,22,24,28,28),(1,9,7,22,22,24,29,29),(1,9,8,22,23,25,30,30),(1,9,9,22,23,26,32,31),(1,9,10,23,23,26,33,33),(1,9,11,23,24,27,34,34),(1,9,12,23,24,27,35,35),(1,9,13,24,25,28,37,36),(1,9,14,24,25,29,38,38),(1,9,15,24,25,29,39,39),(1,9,16,25,26,30,41,40),(1,9,17,25,26,31,42,42),(1,9,18,25,27,31,43,43),(1,9,19,26,27,32,45,44),(1,9,20,26,28,33,46,46),(1,9,21,26,28,33,48,47),(1,9,22,27,29,34,49,49),(1,9,23,27,29,35,51,50),(1,9,24,28,30,35,52,51),(1,9,25,28,30,36,53,53),(1,9,26,28,31,37,55,54),(1,9,27,29,31,37,56,56),(1,9,28,29,32,38,58,57),(1,9,29,30,32,39,59,59),(1,9,30,30,33,40,61,60),(1,9,31,30,33,40,62,62),(1,9,32,31,34,41,64,63),(1,9,33,31,34,42,66,65),(1,9,34,32,35,43,67,66),(1,9,35,32,35,44,69,68),(1,9,36,33,36,44,70,69),(1,9,37,33,36,45,72,71),(1,9,38,34,37,46,74,73),(1,9,39,34,38,47,75,74),(1,9,40,35,38,48,77,76),(1,9,41,35,39,48,79,78),(1,9,42,35,39,49,80,79),(1,9,43,36,40,50,82,81),(1,9,44,36,40,51,84,83),(1,9,45,37,41,52,85,84),(1,9,46,37,42,53,87,86),(1,9,47,38,42,54,89,88),(1,9,48,38,43,55,91,89),(1,9,49,39,44,55,93,91),(1,9,50,40,44,56,94,93),(1,9,51,40,45,57,96,95),(1,9,52,41,45,58,98,97),(1,9,53,41,46,59,100,98),(1,9,54,42,47,60,102,100),(1,9,55,42,47,61,103,102),(1,9,56,43,48,62,105,104),(1,9,57,43,49,63,107,106),(1,9,58,44,49,64,109,108),(1,9,59,44,50,65,111,109),(1,9,60,45,51,66,113,111),(1,9,61,46,51,67,115,113),(1,9,62,46,52,68,117,115),(1,9,63,47,53,69,119,117),(1,9,64,47,54,70,121,119),(1,9,65,48,54,71,123,121),(1,9,66,49,55,72,125,123),(1,9,67,49,56,73,127,125),(1,9,68,50,57,74,129,127),(1,9,69,50,57,75,131,129),(1,9,70,51,58,76,133,131),(1,9,71,52,59,78,135,146),(1,9,72,53,59,79,138,148),(1,9,73,54,60,80,140,151),(1,9,74,54,61,89,143,154),(1,9,75,55,62,91,145,156),(1,9,76,56,63,92,148,159),(1,9,77,57,64,93,151,162),(1,9,78,57,65,95,153,165),(1,9,79,58,66,96,156,168),(1,9,80,59,67,97,159,170),(2,1,1,26,17,24,17,23),(2,1,2,27,18,25,17,23),(2,1,3,29,19,26,17,24),(2,1,4,30,19,27,17,24),(2,1,5,31,20,29,17,24),(2,1,6,32,21,30,17,24),(2,1,7,34,22,31,18,25),(2,1,8,35,23,32,18,25),(2,1,9,37,24,34,18,25),(2,1,10,38,24,35,18,26),(2,1,11,39,25,36,18,26),(2,1,12,41,26,37,18,26),(2,1,13,42,27,39,18,27),(2,1,14,44,28,40,18,27),(2,1,15,45,29,41,18,27),(2,1,16,47,30,43,19,28),(2,1,17,48,31,44,19,28),(2,1,18,50,32,45,19,28),(2,1,19,51,33,47,19,29),(2,1,20,53,34,48,19,29),(2,1,21,54,34,50,19,29),(2,1,22,56,35,51,19,30),(2,1,23,57,36,52,20,30),(2,1,24,59,37,54,20,30),(2,1,25,60,38,55,20,31),(2,1,26,62,39,57,20,31),(2,1,27,64,40,58,20,32),(2,1,28,65,41,60,20,32),(2,1,29,67,43,61,21,32),(2,1,30,69,44,63,21,33),(2,1,31,70,45,64,21,33),(2,1,32,72,46,66,21,34),(2,1,33,74,47,67,21,34),(2,1,34,76,48,69,21,35),(2,1,35,77,49,71,22,35),(2,1,36,79,50,72,22,36),(2,1,37,81,51,74,22,36),(2,1,38,83,52,76,22,36),(2,1,39,84,53,77,22,37),(2,1,40,86,55,79,23,37),(2,1,41,88,56,81,23,38),(2,1,42,90,57,82,23,38),(2,1,43,92,58,84,23,39),(2,1,44,94,59,86,23,39),(2,1,45,96,60,87,24,40),(2,1,46,98,62,89,24,40),(2,1,47,100,63,91,24,41),(2,1,48,101,64,93,24,41),(2,1,49,103,65,94,25,42),(2,1,50,105,66,96,25,42),(2,1,51,107,68,98,25,43),(2,1,52,109,69,100,25,43),(2,1,53,111,70,102,25,44),(2,1,54,113,71,104,26,45),(2,1,55,115,73,105,26,45),(2,1,56,118,74,107,26,46),(2,1,57,120,75,109,26,46),(2,1,58,122,77,111,27,47),(2,1,59,124,78,113,27,47),(2,1,60,126,79,115,27,48),(2,1,61,128,81,117,27,48),(2,1,62,130,82,119,28,49),(2,1,63,132,83,121,28,50),(2,1,64,135,85,123,28,50),(2,1,65,137,86,125,29,51),(2,1,66,139,87,127,29,52),(2,1,67,141,89,129,29,52),(2,1,68,143,90,131,29,53),(2,1,69,146,92,133,30,53),(2,1,70,148,93,135,30,54),(2,1,71,157,94,142,30,55),(2,1,72,162,96,148,30,56),(2,1,73,165,98,150,30,57),(2,1,74,168,99,153,31,57),(2,1,75,170,101,154,31,58),(2,1,76,172,103,156,31,59),(2,1,77,174,105,159,32,60),(2,1,78,179,106,162,32,60),(2,1,79,184,108,167,32,61),(2,1,80,187,110,170,33,62),(2,3,1,23,20,23,17,24),(2,3,2,23,21,24,18,25),(2,3,3,24,23,25,18,25),(2,3,4,24,24,26,19,26),(2,3,5,25,25,27,19,26),(2,3,6,25,27,28,20,27),(2,3,7,26,28,28,21,28),(2,3,8,26,30,29,21,28),(2,3,9,26,31,30,22,29),(2,3,10,27,33,31,22,30),(2,3,11,27,34,32,23,30),(2,3,12,28,36,33,24,31),(2,3,13,28,37,34,24,32),(2,3,14,29,39,35,25,33),(2,3,15,29,40,36,26,33),(2,3,16,30,42,37,26,34),(2,3,17,30,43,39,27,35),(2,3,18,31,45,40,28,35),(2,3,19,31,47,41,28,36),(2,3,20,32,48,42,29,37),(2,3,21,32,50,43,30,38),(2,3,22,33,51,44,31,39),(2,3,23,34,53,45,31,39),(2,3,24,34,55,46,32,40),(2,3,25,35,57,47,33,41),(2,3,26,35,58,48,34,42),(2,3,27,36,60,50,34,43),(2,3,28,36,62,51,35,43),(2,3,29,37,63,52,36,44),(2,3,30,38,65,53,37,45),(2,3,31,38,67,54,37,46),(2,3,32,39,69,56,38,47),(2,3,33,39,71,57,39,48),(2,3,34,40,72,58,40,49),(2,3,35,41,74,59,41,49),(2,3,36,41,76,61,42,50),(2,3,37,42,78,62,42,51),(2,3,38,43,80,63,43,52),(2,3,39,43,82,64,44,53),(2,3,40,44,84,66,45,54),(2,3,41,45,86,67,46,55),(2,3,42,45,88,68,47,56),(2,3,43,46,90,70,47,57),(2,3,44,47,91,71,48,58),(2,3,45,47,93,72,49,59),(2,3,46,48,95,74,50,60),(2,3,47,49,98,75,51,61),(2,3,48,50,100,77,52,62),(2,3,49,50,102,78,53,63),(2,3,50,51,104,79,54,64),(2,3,51,52,106,81,55,65),(2,3,52,52,108,82,56,66),(2,3,53,53,110,84,57,67),(2,3,54,54,112,85,58,68),(2,3,55,55,114,87,59,69),(2,3,56,55,116,88,60,70),(2,3,57,56,118,90,61,71),(2,3,58,57,121,91,62,72),(2,3,59,58,123,93,63,73),(2,3,60,59,125,94,64,74),(2,3,61,59,127,96,65,76),(2,3,62,60,130,97,66,77),(2,3,63,61,132,99,67,78),(2,3,64,62,134,100,68,79),(2,3,65,63,136,102,69,80),(2,3,66,64,139,104,70,81),(2,3,67,64,141,105,71,82),(2,3,68,65,143,107,72,84),(2,3,69,66,146,108,73,85),(2,3,70,67,148,110,74,86),(2,3,71,68,151,112,75,87),(2,3,72,69,154,114,76,88),(2,3,73,70,157,116,77,90),(2,3,74,71,160,118,79,91),(2,3,75,72,163,120,80,93),(2,3,76,73,166,122,81,94),(2,3,77,74,169,124,83,96),(2,3,78,75,172,126,84,97),(2,3,79,76,175,128,85,99),(2,3,80,77,178,130,87,100),(2,4,1,24,20,23,17,23),(2,4,2,25,21,24,17,23),(2,4,3,25,23,24,17,24),(2,4,4,26,24,25,17,24),(2,4,5,27,26,26,18,24),(2,4,6,28,27,26,18,25),(2,4,7,29,29,27,18,25),(2,4,8,29,30,28,18,26),(2,4,9,30,32,29,18,26),(2,4,10,31,33,29,19,26),(2,4,11,32,35,30,19,27),(2,4,12,33,37,31,19,27),(2,4,13,34,38,32,19,28),(2,4,14,34,40,32,19,28),(2,4,15,35,41,33,19,28),(2,4,16,36,43,34,20,29),(2,4,17,37,45,35,20,29),(2,4,18,38,46,36,20,30),(2,4,19,39,48,37,20,30),(2,4,20,40,50,37,21,31),(2,4,21,41,52,38,21,31),(2,4,22,42,53,39,21,31),(2,4,23,43,55,40,21,32),(2,4,24,43,57,41,21,32),(2,4,25,44,59,42,22,33),(2,4,26,45,60,43,22,33),(2,4,27,46,62,44,22,34),(2,4,28,47,64,44,22,34),(2,4,29,48,66,45,23,35),(2,4,30,49,68,46,23,35),(2,4,31,50,70,47,23,36),(2,4,32,51,72,48,23,36),(2,4,33,53,73,49,24,37),(2,4,34,54,75,50,24,38),(2,4,35,55,77,51,24,38),(2,4,36,56,79,52,24,39),(2,4,37,57,81,53,25,39),(2,4,38,58,83,54,25,40),(2,4,39,59,85,55,25,40),(2,4,40,60,87,56,26,41),(2,4,41,61,89,57,26,41),(2,4,42,62,91,58,26,42),(2,4,43,63,93,59,27,43),(2,4,44,65,95,60,27,43),(2,4,45,66,98,61,27,44),(2,4,46,67,100,62,27,44),(2,4,47,68,102,64,28,45),(2,4,48,69,104,65,28,46),(2,4,49,71,106,66,28,46),(2,4,50,72,108,67,29,47),(2,4,51,73,110,68,29,48),(2,4,52,74,113,69,29,48),(2,4,53,75,115,70,30,49),(2,4,54,77,117,71,30,50),(2,4,55,78,119,73,30,50),(2,4,56,79,122,74,31,51),(2,4,57,80,124,75,31,52),(2,4,58,82,126,76,31,52),(2,4,59,83,129,77,32,53),(2,4,60,84,131,78,32,54),(2,4,61,86,133,80,33,54),(2,4,62,87,136,81,33,55),(2,4,63,88,138,82,33,56),(2,4,64,90,140,83,34,57),(2,4,65,91,143,85,34,57),(2,4,66,92,145,86,34,58),(2,4,67,94,148,87,35,59),(2,4,68,95,150,88,35,59),(2,4,69,97,153,90,36,60),(2,4,70,98,155,91,36,61),(2,4,71,100,158,92,36,62),(2,4,72,102,161,94,37,62),(2,4,73,103,164,99,37,63),(2,4,74,105,167,100,38,64),(2,4,75,107,170,102,38,65),(2,4,76,108,173,102,38,66),(2,4,77,110,176,102,39,67),(2,4,78,112,180,103,39,68),(2,4,79,114,183,105,40,69),(2,4,80,116,186,107,40,70),(2,6,1,26,17,24,17,23),(2,6,2,27,18,25,17,23),(2,6,3,29,19,26,17,24),(2,6,4,30,19,27,17,24),(2,6,5,31,20,29,17,24),(2,6,6,32,21,30,17,24),(2,6,7,34,22,31,18,25),(2,6,8,35,23,32,18,25),(2,6,9,37,24,34,18,25),(2,6,10,38,24,35,18,26),(2,6,11,39,25,36,18,26),(2,6,12,41,26,37,18,26),(2,6,13,42,27,39,18,27),(2,6,14,44,28,40,18,27),(2,6,15,45,29,41,18,27),(2,6,16,47,30,43,19,28),(2,6,17,48,31,44,19,28),(2,6,18,50,32,45,19,28),(2,6,19,51,33,47,19,29),(2,6,20,53,34,48,19,29),(2,6,21,54,34,50,19,29),(2,6,22,56,35,51,19,30),(2,6,23,57,36,52,20,30),(2,6,24,59,37,54,20,30),(2,6,25,60,38,55,20,31),(2,6,26,62,39,57,20,31),(2,6,27,64,40,58,20,32),(2,6,28,65,41,60,20,32),(2,6,29,67,43,61,21,32),(2,6,30,69,44,63,21,33),(2,6,31,70,45,64,21,33),(2,6,32,72,46,66,21,34),(2,6,33,74,47,67,21,34),(2,6,34,76,48,69,21,35),(2,6,35,77,49,71,22,35),(2,6,36,79,50,72,22,36),(2,6,37,81,51,74,22,36),(2,6,38,83,52,76,22,36),(2,6,39,84,53,77,22,37),(2,6,40,86,55,79,23,37),(2,6,41,88,56,81,23,38),(2,6,42,90,57,82,23,38),(2,6,43,92,58,84,23,39),(2,6,44,94,59,86,23,39),(2,6,45,96,60,87,24,40),(2,6,46,98,62,89,24,40),(2,6,47,100,63,91,24,41),(2,6,48,101,64,93,24,41),(2,6,49,103,65,94,25,42),(2,6,50,105,66,96,25,42),(2,6,51,107,68,98,25,43),(2,6,52,109,69,100,25,43),(2,6,53,110,69,100,25,44),(2,6,54,111,70,101,26,45),(2,6,55,111,70,101,26,45),(2,6,56,114,72,104,26,46),(2,6,57,116,73,106,26,46),(2,6,58,118,74,108,27,47),(2,6,59,124,76,110,27,47),(2,6,60,126,77,112,27,48),(2,6,61,128,78,114,27,49),(2,6,62,131,80,116,27,49),(2,6,63,133,81,119,28,50),(2,6,64,136,83,121,28,50),(2,6,65,136,84,123,28,51),(2,6,66,142,86,126,28,52),(2,6,67,145,87,128,29,52),(2,6,68,147,89,130,29,53),(2,6,69,150,90,133,29,54),(2,6,70,157,92,135,29,54),(2,6,71,160,94,138,30,55),(2,6,72,163,95,140,30,56),(2,6,73,166,97,151,30,57),(2,6,74,169,99,154,30,57),(2,6,75,172,100,156,31,58),(2,6,76,175,102,160,31,59),(2,6,77,179,104,162,31,60),(2,6,78,182,105,165,31,60),(2,6,79,191,107,168,32,61),(2,6,80,194,109,171,32,62),(2,7,1,24,17,23,18,25),(2,7,2,25,17,24,19,26),(2,7,3,26,18,25,20,27),(2,7,4,26,18,26,21,28),(2,7,5,27,19,27,22,29),(2,7,6,28,19,28,23,30),(2,7,7,29,20,29,24,31),(2,7,8,30,20,30,25,32),(2,7,9,31,21,31,26,33),(2,7,10,32,21,32,27,34),(2,7,11,33,22,33,28,36),(2,7,12,34,22,34,29,37),(2,7,13,34,23,35,30,38),(2,7,14,35,23,36,31,39),(2,7,15,36,24,37,32,40),(2,7,16,37,24,39,33,41),(2,7,17,38,25,40,34,43),(2,7,18,39,25,41,35,44),(2,7,19,40,26,42,36,45),(2,7,20,41,26,43,37,46),(2,7,21,42,27,44,38,47),(2,7,22,43,27,45,39,49),(2,7,23,44,28,47,40,50),(2,7,24,45,28,48,41,51),(2,7,25,47,29,49,43,52),(2,7,26,48,30,50,44,54),(2,7,27,49,30,52,45,55),(2,7,28,50,31,53,46,56),(2,7,29,51,31,54,47,58),(2,7,30,52,32,55,48,59),(2,7,31,53,33,57,50,60),(2,7,32,54,33,58,51,62),(2,7,33,55,34,59,52,63),(2,7,34,57,34,61,53,65),(2,7,35,58,35,62,55,66),(2,7,36,59,36,63,56,67),(2,7,37,60,36,65,57,69),(2,7,38,61,37,66,58,70),(2,7,39,62,38,67,60,72),(2,7,40,64,38,69,61,73),(2,7,41,65,39,70,62,75),(2,7,42,66,40,72,64,76),(2,7,43,67,40,73,65,78),(2,7,44,69,41,74,66,79),(2,7,45,70,42,76,68,81),(2,7,46,71,42,77,69,82),(2,7,47,72,43,79,70,84),(2,7,48,74,44,80,72,85),(2,7,49,75,45,82,73,87),(2,7,50,76,45,83,75,89),(2,7,51,78,46,85,76,90),(2,7,52,79,47,86,77,92),(2,7,53,80,47,88,79,93),(2,7,54,82,48,90,80,95),(2,7,55,83,49,91,82,97),(2,7,56,85,50,93,83,98),(2,7,57,86,50,94,85,100),(2,7,58,87,51,96,86,102),(2,7,59,89,52,97,88,103),(2,7,60,90,53,99,89,105),(2,7,61,92,54,101,91,107),(2,7,62,93,54,102,92,109),(2,7,63,95,55,104,94,110),(2,7,64,96,56,106,95,112),(2,7,65,97,57,107,97,114),(2,7,66,99,58,109,99,116),(2,7,67,100,58,111,100,118),(2,7,68,102,59,113,102,119),(2,7,69,103,60,114,103,121),(2,7,70,105,61,116,105,123),(2,7,71,106,62,118,117,125),(2,7,72,108,63,120,119,128),(2,7,73,110,64,122,122,130),(2,7,74,112,65,125,124,132),(2,7,75,114,66,127,126,134),(2,7,76,116,67,129,128,137),(2,7,77,117,68,131,128,139),(2,7,78,119,69,133,133,141),(2,7,79,121,70,136,135,144),(2,7,80,123,71,138,137,146),(2,9,1,23,17,23,19,25),(2,9,2,23,17,24,20,26),(2,9,3,24,18,24,21,27),(2,9,4,24,18,25,23,28),(2,9,5,24,18,25,24,30),(2,9,6,24,19,26,25,31),(2,9,7,25,19,26,26,32),(2,9,8,25,20,27,27,33),(2,9,9,25,20,27,29,34),(2,9,10,26,20,28,30,36),(2,9,11,26,21,29,31,37),(2,9,12,26,21,29,33,38),(2,9,13,27,22,30,34,39),(2,9,14,27,22,31,35,41),(2,9,15,27,23,31,37,42),(2,9,16,28,23,32,38,43),(2,9,17,28,23,32,39,45),(2,9,18,28,24,33,41,46),(2,9,19,29,24,34,42,47),(2,9,20,29,25,34,43,49),(2,9,21,29,25,35,45,50),(2,9,22,30,26,36,46,51),(2,9,23,30,26,37,48,53),(2,9,24,30,27,37,49,54),(2,9,25,31,27,38,51,56),(2,9,26,31,28,39,52,57),(2,9,27,32,28,39,54,59),(2,9,28,32,29,40,55,60),(2,9,29,32,29,41,57,62),(2,9,30,33,30,42,58,63),(2,9,31,33,30,42,60,65),(2,9,32,34,31,43,61,66),(2,9,33,34,31,44,63,68),(2,9,34,35,32,45,64,69),(2,9,35,35,32,45,66,71),(2,9,36,36,33,46,68,72),(2,9,37,36,34,47,69,74),(2,9,38,36,34,48,71,76),(2,9,39,37,35,49,72,77),(2,9,40,37,35,50,74,79),(2,9,41,38,36,50,76,80),(2,9,42,38,36,51,77,82),(2,9,43,39,37,52,79,84),(2,9,44,39,38,53,81,85),(2,9,45,40,38,54,83,87),(2,9,46,40,39,55,84,89),(2,9,47,41,39,56,86,91),(2,9,48,41,40,56,88,92),(2,9,49,42,41,57,90,94),(2,9,50,42,41,58,91,96),(2,9,51,43,42,59,93,98),(2,9,52,43,43,60,95,99),(2,9,53,44,43,61,97,101),(2,9,54,45,44,62,99,103),(2,9,55,45,45,63,101,105),(2,9,56,46,45,64,102,107),(2,9,57,46,46,65,104,109),(2,9,58,47,47,66,106,110),(2,9,59,47,47,67,108,112),(2,9,60,48,48,68,110,114),(2,9,61,48,49,69,112,116),(2,9,62,49,49,70,114,118),(2,9,63,50,50,71,116,120),(2,9,64,50,51,72,118,122),(2,9,65,51,51,73,120,124),(2,9,66,52,52,74,122,126),(2,9,67,52,53,75,124,128),(2,9,68,53,54,76,126,130),(2,9,69,53,54,77,128,132),(2,9,70,54,55,78,130,134),(2,9,71,55,56,88,134,145),(2,9,72,56,56,89,135,147),(2,9,73,57,57,90,137,150),(2,9,74,57,58,91,142,153),(2,9,75,58,59,93,142,155),(2,9,76,59,60,94,145,158),(2,9,77,60,61,95,148,161),(2,9,78,60,62,97,150,164),(2,9,79,61,63,98,153,167),(2,9,80,62,64,99,156,169),(3,1,1,25,16,25,19,19),(3,1,2,26,17,26,19,19),(3,1,3,28,18,27,19,20),(3,1,4,29,18,28,19,20),(3,1,5,30,19,30,19,20),(3,1,6,31,20,31,19,20),(3,1,7,33,21,32,20,21),(3,1,8,34,22,33,20,21),(3,1,9,36,23,35,20,21),(3,1,10,37,23,36,20,22),(3,1,11,38,24,37,20,22),(3,1,12,40,25,38,20,22),(3,1,13,41,26,40,20,23),(3,1,14,43,27,41,20,23),(3,1,15,44,28,42,20,23),(3,1,16,46,29,44,21,24),(3,1,17,47,30,45,21,24),(3,1,18,49,31,46,21,24),(3,1,19,50,32,48,21,25),(3,1,20,52,33,49,21,25),(3,1,21,53,34,51,21,26),(3,1,22,55,34,52,21,26),(3,1,23,56,35,53,21,26),(3,1,24,58,36,55,22,27),(3,1,25,59,37,56,22,27),(3,1,26,61,38,58,22,27),(3,1,27,63,39,59,22,28),(3,1,28,64,41,61,22,28),(3,1,29,66,42,62,22,29),(3,1,30,68,43,64,23,29),(3,1,31,69,44,65,23,30),(3,1,32,71,45,67,23,30),(3,1,33,73,46,68,23,30),(3,1,34,75,47,70,23,31),(3,1,35,76,48,72,24,31),(3,1,36,78,49,73,24,32),(3,1,37,80,50,75,24,32),(3,1,38,82,51,76,24,33),(3,1,39,84,52,78,24,33),(3,1,40,85,54,80,24,34),(3,1,41,87,55,81,25,34),(3,1,42,89,56,83,25,35),(3,1,43,91,57,85,25,35),(3,1,44,93,58,87,25,36),(3,1,45,95,59,88,26,36),(3,1,46,97,61,90,26,37),(3,1,47,99,62,92,26,37),(3,1,48,101,63,94,26,38),(3,1,49,102,64,95,26,38),(3,1,50,104,65,97,27,39),(3,1,51,106,67,99,27,39),(3,1,52,108,68,101,27,40),(3,1,53,110,69,103,27,40),(3,1,54,112,70,104,28,41),(3,1,55,115,72,106,28,41),(3,1,56,117,73,108,28,42),(3,1,57,119,74,110,28,42),(3,1,58,121,76,112,29,43),(3,1,59,123,77,114,29,43),(3,1,60,125,78,116,29,44),(3,1,61,127,80,118,29,45),(3,1,62,129,81,120,30,45),(3,1,63,131,82,122,30,46),(3,1,64,134,84,124,30,46),(3,1,65,136,85,126,31,47),(3,1,66,138,86,128,31,48),(3,1,67,140,88,130,31,48),(3,1,68,142,89,132,31,49),(3,1,69,145,91,134,32,49),(3,1,70,147,92,136,32,50),(3,1,71,150,93,138,32,51),(3,1,72,152,95,141,32,52),(3,1,73,164,97,151,32,53),(3,1,74,164,98,151,33,53),(3,1,75,170,100,156,33,54),(3,1,76,173,102,160,33,55),(3,1,77,173,104,160,34,56),(3,1,78,176,105,162,34,56),(3,1,79,183,107,168,34,57),(3,1,80,186,109,171,35,58),(3,2,1,24,16,25,19,20),(3,2,2,25,17,26,20,21),(3,2,3,26,17,27,20,21),(3,2,4,27,18,28,21,22),(3,2,5,28,18,29,22,23),(3,2,6,29,19,30,22,24),(3,2,7,31,20,31,23,24),(3,2,8,32,20,32,24,25),(3,2,9,33,21,33,24,26),(3,2,10,34,21,34,25,26),(3,2,11,35,22,36,26,27),(3,2,12,36,23,37,26,28),(3,2,13,38,23,38,27,29),(3,2,14,39,24,39,28,30),(3,2,15,40,25,40,29,30),(3,2,16,41,25,41,29,31),(3,2,17,43,26,43,30,32),(3,2,18,44,27,44,31,33),(3,2,19,45,28,45,32,34),(3,2,20,47,28,46,32,35),(3,2,21,48,29,47,33,35),(3,2,22,49,30,49,34,36),(3,2,23,51,30,50,35,37),(3,2,24,52,31,51,36,38),(3,2,25,53,32,52,36,39),(3,2,26,55,33,54,37,40),(3,2,27,56,33,55,38,41),(3,2,28,57,34,56,39,42),(3,2,29,59,35,58,40,43),(3,2,30,60,36,59,41,43),(3,2,31,62,37,60,42,44),(3,2,32,63,37,62,42,45),(3,2,33,65,38,63,43,46),(3,2,34,66,39,65,44,47),(3,2,35,68,40,66,45,48),(3,2,36,69,41,67,46,49),(3,2,37,71,41,69,47,50),(3,2,38,72,42,70,48,51),(3,2,39,74,43,72,49,52),(3,2,40,75,44,73,50,53),(3,2,41,77,45,75,51,54),(3,2,42,78,46,76,52,55),(3,2,43,80,47,78,53,56),(3,2,44,82,47,79,54,57),(3,2,45,83,48,81,55,59),(3,2,46,85,49,82,56,60),(3,2,47,87,50,84,57,61),(3,2,48,88,51,85,58,62),(3,2,49,90,52,87,59,63),(3,2,50,92,53,89,60,64),(3,2,51,93,54,90,61,65),(3,2,52,95,55,92,62,66),(3,2,53,97,56,93,63,67),(3,2,54,98,57,95,64,69),(3,2,55,100,58,97,65,70),(3,2,56,102,59,98,66,71),(3,2,57,104,60,100,67,72),(3,2,58,106,61,102,68,73),(3,2,59,107,62,103,69,74),(3,2,60,109,63,105,70,76),(3,2,61,111,64,107,72,77),(3,2,62,113,65,109,73,78),(3,2,63,115,66,110,74,79),(3,2,64,117,67,112,75,80),(3,2,65,118,68,114,76,82),(3,2,66,120,69,116,77,83),(3,2,67,122,70,118,78,84),(3,2,68,124,71,119,80,85),(3,2,69,126,72,121,81,87),(3,2,70,128,73,123,82,88),(3,2,71,150,74,125,83,89),(3,2,72,152,75,128,85,91),(3,2,73,156,76,130,86,93),(3,2,74,158,78,132,88,94),(3,2,75,161,79,134,89,96),(3,2,76,164,80,137,91,97),(3,2,77,166,82,139,92,99),(3,2,78,170,83,141,94,101),(3,2,79,172,84,144,95,102),(3,2,80,175,86,146,97,104),(3,3,1,22,19,24,19,20),(3,3,2,22,20,25,20,21),(3,3,3,23,22,26,20,21),(3,3,4,23,23,27,21,22),(3,3,5,24,25,28,21,23),(3,3,6,24,26,29,22,23),(3,3,7,25,27,29,23,24),(3,3,8,25,29,30,23,25),(3,3,9,25,30,31,24,25),(3,3,10,26,32,32,24,26),(3,3,11,26,33,33,25,27),(3,3,12,27,35,34,26,27),(3,3,13,27,36,35,26,28),(3,3,14,28,38,36,27,29),(3,3,15,28,39,37,28,29),(3,3,16,29,41,38,28,30),(3,3,17,29,42,39,29,31),(3,3,18,30,44,41,30,32),(3,3,19,30,46,42,30,32),(3,3,20,31,47,43,31,33),(3,3,21,32,49,44,32,34),(3,3,22,32,51,45,33,35),(3,3,23,33,52,46,33,36),(3,3,24,33,54,47,34,36),(3,3,25,34,56,48,35,37),(3,3,26,34,57,49,35,38),(3,3,27,35,59,51,36,39),(3,3,28,35,61,52,37,40),(3,3,29,36,63,53,38,40),(3,3,30,37,64,54,39,41),(3,3,31,37,66,55,39,42),(3,3,32,38,68,57,40,43),(3,3,33,38,70,58,41,44),(3,3,34,39,71,59,42,45),(3,3,35,40,73,60,43,46),(3,3,36,40,75,62,43,47),(3,3,37,41,77,63,44,47),(3,3,38,42,79,64,45,48),(3,3,39,42,81,65,46,49),(3,3,40,43,83,67,47,50),(3,3,41,44,85,68,48,51),(3,3,42,44,87,69,49,52),(3,3,43,45,89,71,49,53),(3,3,44,46,91,72,50,54),(3,3,45,46,93,73,51,55),(3,3,46,47,95,75,52,56),(3,3,47,48,97,76,53,57),(3,3,48,49,99,78,54,58),(3,3,49,49,101,79,55,59),(3,3,50,50,103,80,56,60),(3,3,51,51,105,82,57,61),(3,3,52,51,107,83,58,62),(3,3,53,52,109,85,59,63),(3,3,54,53,111,86,60,64),(3,3,55,54,113,88,61,65),(3,3,56,55,115,89,62,66),(3,3,57,55,118,91,62,67),(3,3,58,56,120,92,63,68),(3,3,59,57,122,94,64,70),(3,3,60,58,124,95,65,71),(3,3,61,58,126,97,67,72),(3,3,62,59,129,98,68,73),(3,3,63,60,131,100,69,74),(3,3,64,61,133,101,70,75),(3,3,65,62,135,103,71,76),(3,3,66,63,138,105,72,77),(3,3,67,63,140,106,73,78),(3,3,68,64,142,108,74,80),(3,3,69,65,145,109,75,81),(3,3,70,66,147,111,76,82),(3,3,71,67,150,113,77,83),(3,3,72,68,153,115,78,84),(3,3,73,69,156,117,79,86),(3,3,74,70,159,119,81,87),(3,3,75,71,162,121,82,89),(3,3,76,72,165,123,83,90),(3,3,77,73,168,125,85,92),(3,3,78,74,171,127,86,93),(3,3,79,75,174,129,87,95),(3,3,80,76,177,131,89,96),(3,4,1,23,19,24,19,19),(3,4,2,24,20,25,19,19),(3,4,3,24,22,25,19,20),(3,4,4,25,23,26,19,20),(3,4,5,26,25,27,20,20),(3,4,6,27,26,27,20,21),(3,4,7,28,28,28,20,21),(3,4,8,28,29,29,20,22),(3,4,9,29,31,30,20,22),(3,4,10,30,32,30,20,22),(3,4,11,31,34,31,21,23),(3,4,12,32,36,32,21,23),(3,4,13,33,37,33,21,24),(3,4,14,33,39,33,21,24),(3,4,15,34,40,34,21,25),(3,4,16,35,42,35,22,25),(3,4,17,36,44,36,22,25),(3,4,18,37,45,37,22,26),(3,4,19,38,47,38,22,26),(3,4,20,39,49,38,22,27),(3,4,21,40,51,39,23,27),(3,4,22,41,52,40,23,28),(3,4,23,42,54,41,23,28),(3,4,24,43,56,42,23,29),(3,4,25,44,58,43,24,29),(3,4,26,44,59,44,24,30),(3,4,27,45,61,44,24,30),(3,4,28,46,63,45,24,31),(3,4,29,47,65,46,25,31),(3,4,30,48,67,47,25,32),(3,4,31,49,69,48,25,32),(3,4,32,51,71,49,25,33),(3,4,33,52,72,50,26,33),(3,4,34,53,74,51,26,34),(3,4,35,54,76,52,26,34),(3,4,36,55,78,53,26,35),(3,4,37,56,80,54,27,35),(3,4,38,57,82,55,27,36),(3,4,39,58,84,56,27,37),(3,4,40,59,86,57,28,37),(3,4,41,60,88,58,28,38),(3,4,42,61,90,59,28,38),(3,4,43,63,92,60,28,39),(3,4,44,64,95,61,29,39),(3,4,45,65,97,62,29,40),(3,4,46,66,99,63,29,41),(3,4,47,67,101,64,30,41),(3,4,48,68,103,66,30,42),(3,4,49,70,105,67,30,43),(3,4,50,71,107,68,31,43),(3,4,51,72,110,69,31,44),(3,4,52,73,112,70,31,44),(3,4,53,74,114,71,32,45),(3,4,54,76,116,72,32,46),(3,4,55,77,118,73,32,46),(3,4,56,78,121,75,33,47),(3,4,57,80,123,76,33,48),(3,4,58,81,125,77,33,48),(3,4,59,82,128,78,34,49),(3,4,60,83,130,79,34,50),(3,4,61,85,132,81,34,51),(3,4,62,86,135,82,35,51),(3,4,63,87,137,83,35,52),(3,4,64,89,139,84,36,53),(3,4,65,90,142,86,36,53),(3,4,66,91,144,87,36,54),(3,4,67,93,147,88,37,55),(3,4,68,94,149,89,37,56),(3,4,69,96,152,91,38,56),(3,4,70,97,154,92,38,57),(3,4,71,99,157,93,38,58),(3,4,72,101,160,96,39,58),(3,4,73,102,163,97,39,59),(3,4,74,104,166,98,40,60),(3,4,75,106,169,100,40,61),(3,4,76,107,172,101,40,62),(3,4,77,109,175,103,41,63),(3,4,78,111,179,105,41,64),(3,4,79,113,182,106,42,65),(3,4,80,115,185,108,42,66),(3,5,1,22,16,23,21,22),(3,5,2,22,16,23,22,23),(3,5,3,22,16,24,24,25),(3,5,4,22,17,24,25,26),(3,5,5,23,17,24,26,27),(3,5,6,23,17,25,28,29),(3,5,7,23,17,25,29,30),(3,5,8,23,18,26,30,32),(3,5,9,23,18,26,32,33),(3,5,10,23,18,26,33,35),(3,5,11,24,18,27,35,36),(3,5,12,24,19,27,36,38),(3,5,13,24,19,28,37,39),(3,5,14,24,19,28,39,41),(3,5,15,24,19,28,40,42),(3,5,16,24,20,29,42,44),(3,5,17,25,20,29,43,45),(3,5,18,25,20,30,45,47),(3,5,19,25,21,30,46,49),(3,5,20,25,21,31,48,50),(3,5,21,25,21,31,50,52),(3,5,22,26,22,31,51,53),(3,5,23,26,22,32,53,55),(3,5,24,26,22,32,54,57),(3,5,25,26,22,33,56,58),(3,5,26,27,23,33,58,60),(3,5,27,27,23,34,59,62),(3,5,28,27,23,34,61,64),(3,5,29,27,24,35,63,65),(3,5,30,28,24,35,64,67),(3,5,31,28,24,36,66,69),(3,5,32,28,25,36,68,71),(3,5,33,28,25,37,70,72),(3,5,34,29,26,38,71,74),(3,5,35,29,26,38,73,76),(3,5,36,29,26,39,75,78),(3,5,37,29,27,39,77,80),(3,5,38,30,27,40,78,82),(3,5,39,30,27,40,80,84),(3,5,40,30,28,41,82,86),(3,5,41,31,28,41,84,88),(3,5,42,31,29,42,86,89),(3,5,43,31,29,43,88,91),(3,5,44,32,29,43,90,93),(3,5,45,32,30,44,92,95),(3,5,46,32,30,44,93,97),(3,5,47,32,30,45,95,99),(3,5,48,33,31,46,97,101),(3,5,49,33,31,46,99,103),(3,5,50,33,32,47,101,106),(3,5,51,34,32,48,103,108),(3,5,52,34,33,48,105,110),(3,5,53,35,33,49,107,112),(3,5,54,35,33,50,109,114),(3,5,55,35,34,50,111,116),(3,5,56,36,34,51,113,118),(3,5,57,36,35,52,116,120),(3,5,58,36,35,52,118,123),(3,5,59,37,36,53,120,125),(3,5,60,37,36,54,122,127),(3,5,61,37,37,54,124,129),(3,5,62,38,37,55,126,131),(3,5,63,38,38,56,128,134),(3,5,64,39,38,57,131,136),(3,5,65,39,39,57,133,138),(3,5,66,39,39,58,135,141),(3,5,67,40,40,59,137,143),(3,5,68,40,40,59,139,145),(3,5,69,41,40,60,142,148),(3,5,70,41,41,61,144,150),(3,5,71,41,42,62,147,153),(3,5,72,42,42,62,150,163),(3,5,73,42,43,63,153,166),(3,5,74,43,43,64,155,170),(3,5,75,43,44,65,158,173),(3,5,76,43,45,66,161,176),(3,5,77,44,45,67,164,179),(3,5,78,44,46,68,167,182),(3,5,79,45,46,69,170,184),(3,5,80,45,47,70,173,189),(3,6,1,25,16,25,19,19),(3,6,2,26,17,26,19,19),(3,6,3,28,18,27,19,20),(3,6,4,29,18,28,19,20),(3,6,5,30,19,30,19,20),(3,6,6,31,20,31,19,20),(3,6,7,33,21,32,20,21),(3,6,8,34,22,33,20,21),(3,6,9,36,23,35,20,21),(3,6,10,37,23,36,20,22),(3,6,11,38,24,37,20,22),(3,6,12,40,25,38,20,22),(3,6,13,41,26,40,20,23),(3,6,14,43,27,41,20,23),(3,6,15,44,28,42,20,23),(3,6,16,46,29,44,21,24),(3,6,17,47,30,45,21,24),(3,6,18,49,31,46,21,24),(3,6,19,50,32,48,21,25),(3,6,20,52,33,49,21,25),(3,6,21,53,34,51,21,26),(3,6,22,55,34,52,21,26),(3,6,23,56,35,53,21,26),(3,6,24,58,36,55,22,27),(3,6,25,59,37,56,22,27),(3,6,26,61,38,58,22,27),(3,6,27,63,39,59,22,28),(3,6,28,64,41,61,22,28),(3,6,29,66,42,62,22,29),(3,6,30,68,43,64,23,29),(3,6,31,69,44,65,23,30),(3,6,32,71,45,67,23,30),(3,6,33,73,46,68,23,30),(3,6,34,75,47,70,23,31),(3,6,35,76,48,72,24,31),(3,6,36,78,49,73,24,32),(3,6,37,80,50,75,24,32),(3,6,38,82,51,76,24,33),(3,6,39,84,52,78,24,33),(3,6,40,85,54,80,24,34),(3,6,41,87,55,81,25,34),(3,6,42,89,56,83,25,35),(3,6,43,91,57,85,25,35),(3,6,44,93,58,87,25,36),(3,6,45,95,59,88,26,36),(3,6,46,97,61,90,26,37),(3,6,47,99,62,92,26,37),(3,6,48,101,63,94,26,38),(3,6,49,102,64,95,26,38),(3,6,50,104,65,97,27,39),(3,6,51,106,67,99,27,39),(3,6,52,108,68,99,27,40),(3,6,53,109,68,101,27,40),(3,6,54,110,69,101,28,41),(3,6,55,110,69,102,28,41),(3,6,56,113,71,105,28,42),(3,6,57,118,72,107,28,42),(3,6,58,120,73,109,29,43),(3,6,59,123,75,111,29,43),(3,6,60,125,76,113,29,44),(3,6,61,126,77,115,29,45),(3,6,62,127,79,117,29,45),(3,6,63,129,80,120,30,46),(3,6,64,132,82,122,30,46),(3,6,65,135,83,124,30,47),(3,6,66,137,85,127,30,48),(3,6,67,144,86,129,31,48),(3,6,68,146,88,131,31,49),(3,6,69,149,89,133,31,50),(3,6,70,152,91,136,31,50),(3,6,71,154,93,139,32,51),(3,6,72,157,94,141,32,52),(3,6,73,160,96,144,32,53),(3,6,74,163,98,146,32,53),(3,6,75,166,99,150,33,54),(3,6,76,169,101,152,33,55),(3,6,77,172,103,155,33,56),(3,6,78,176,104,157,33,56),(3,6,79,179,106,160,34,57),(3,6,80,182,108,163,34,58),(4,1,1,20,25,21,20,20),(4,1,2,21,26,22,20,20),(4,1,3,23,27,23,20,21),(4,1,4,24,27,25,20,21),(4,1,5,25,28,26,20,21),(4,1,6,27,29,27,20,21),(4,1,7,28,30,28,21,22),(4,1,8,29,31,29,21,22),(4,1,9,31,31,31,21,22),(4,1,10,32,32,32,21,23),(4,1,11,33,33,33,21,23),(4,1,12,35,34,34,21,23),(4,1,13,36,35,36,21,24),(4,1,14,38,36,37,21,24),(4,1,15,39,37,38,21,24),(4,1,16,41,37,40,21,25),(4,1,17,42,38,41,22,25),(4,1,18,44,39,43,22,25),(4,1,19,45,40,44,22,26),(4,1,20,47,41,45,22,26),(4,1,21,48,42,47,22,26),(4,1,22,50,43,48,22,27),(4,1,23,52,44,50,22,27),(4,1,24,53,45,51,23,28),(4,1,25,55,46,52,23,28),(4,1,26,56,47,54,23,28),(4,1,27,58,48,55,23,29),(4,1,28,60,49,57,23,29),(4,1,29,61,50,58,23,30),(4,1,30,63,51,60,24,30),(4,1,31,65,52,62,24,30),(4,1,32,66,53,63,24,31),(4,1,33,68,54,65,24,31),(4,1,34,70,55,66,24,32),(4,1,35,72,56,68,24,32),(4,1,36,73,58,69,25,33),(4,1,37,75,59,71,25,33),(4,1,38,77,60,73,25,34),(4,1,39,79,61,74,25,34),(4,1,40,81,62,76,25,35),(4,1,41,82,63,78,26,35),(4,1,42,84,64,79,26,35),(4,1,43,86,66,81,26,36),(4,1,44,88,67,83,26,36),(4,1,45,90,68,85,26,37),(4,1,46,92,69,86,27,37),(4,1,47,94,70,88,27,38),(4,1,48,96,72,90,27,38),(4,1,49,98,73,92,27,39),(4,1,50,100,74,93,28,40),(4,1,51,102,75,95,28,40),(4,1,52,104,77,97,28,41),(4,1,53,106,78,99,28,41),(4,1,54,108,79,101,29,42),(4,1,55,110,80,103,29,42),(4,1,56,112,82,104,29,43),(4,1,57,114,83,106,29,43),(4,1,58,116,84,108,30,44),(4,1,59,118,86,110,30,44),(4,1,60,120,87,112,30,45),(4,1,61,122,88,114,30,46),(4,1,62,124,90,116,31,46),(4,1,63,127,91,118,31,47),(4,1,64,129,92,120,31,47),(4,1,65,131,94,122,32,48),(4,1,66,133,95,124,32,49),(4,1,67,135,97,126,32,49),(4,1,68,138,98,128,32,50),(4,1,69,140,100,130,33,50),(4,1,70,142,101,132,33,51),(4,1,71,145,102,134,33,52),(4,1,72,147,104,137,33,53),(4,1,73,150,106,139,33,54),(4,1,74,153,107,142,34,54),(4,1,75,156,109,144,34,55),(4,1,76,159,111,148,34,56),(4,1,77,162,113,150,35,57),(4,1,78,165,114,152,35,57),(4,1,79,178,116,164,35,58),(4,1,80,181,118,167,36,59),(4,3,1,17,28,20,20,21),(4,3,2,17,29,21,21,22),(4,3,3,18,31,22,21,22),(4,3,4,18,32,23,22,23),(4,3,5,19,33,24,22,24),(4,3,6,19,35,25,23,24),(4,3,7,20,36,26,24,25),(4,3,8,20,38,27,24,25),(4,3,9,21,39,27,25,26),(4,3,10,21,40,28,25,27),(4,3,11,22,42,29,26,28),(4,3,12,22,43,30,27,28),(4,3,13,23,45,31,27,29),(4,3,14,23,46,32,28,30),(4,3,15,24,48,34,29,30),(4,3,16,24,50,35,29,31),(4,3,17,25,51,36,30,32),(4,3,18,25,53,37,31,33),(4,3,19,26,54,38,31,33),(4,3,20,26,56,39,32,34),(4,3,21,27,57,40,33,35),(4,3,22,27,59,41,33,36),(4,3,23,28,61,42,34,36),(4,3,24,28,62,43,35,37),(4,3,25,29,64,44,36,38),(4,3,26,30,66,46,36,39),(4,3,27,30,68,47,37,40),(4,3,28,31,69,48,38,41),(4,3,29,31,71,49,39,41),(4,3,30,32,73,50,39,42),(4,3,31,33,75,52,40,43),(4,3,32,33,76,53,41,44),(4,3,33,34,78,54,42,45),(4,3,34,34,80,55,43,46),(4,3,35,35,82,57,44,47),(4,3,36,36,84,58,44,48),(4,3,37,36,86,59,45,48),(4,3,38,37,87,60,46,49),(4,3,39,38,89,62,47,50),(4,3,40,38,91,63,48,51),(4,3,41,39,93,64,49,52),(4,3,42,40,95,66,49,53),(4,3,43,40,97,67,50,54),(4,3,44,41,99,68,51,55),(4,3,45,42,101,70,52,56),(4,3,46,42,103,71,53,57),(4,3,47,43,105,72,54,58),(4,3,48,44,107,74,55,59),(4,3,49,45,109,75,56,60),(4,3,50,45,111,77,57,61),(4,3,51,46,113,78,58,62),(4,3,52,47,115,79,59,63),(4,3,53,47,118,81,60,64),(4,3,54,48,120,82,61,65),(4,3,55,49,122,84,61,66),(4,3,56,50,124,85,62,67),(4,3,57,50,126,87,63,68),(4,3,58,51,128,88,64,69),(4,3,59,52,131,90,65,70),(4,3,60,53,133,91,66,72),(4,3,61,54,135,93,67,73),(4,3,62,54,137,94,69,74),(4,3,63,55,140,96,70,75),(4,3,64,56,142,97,71,76),(4,3,65,57,144,99,72,77),(4,3,66,58,147,101,73,78),(4,3,67,58,149,102,74,79),(4,3,68,59,151,104,75,81),(4,3,69,60,154,105,76,82),(4,3,70,61,156,107,77,83),(4,3,71,62,159,109,78,84),(4,3,72,63,162,111,79,85),(4,3,73,64,165,113,80,87),(4,3,74,65,168,115,82,88),(4,3,75,66,171,117,83,90),(4,3,76,67,174,119,84,91),(4,3,77,68,177,121,86,93),(4,3,78,69,180,123,87,94),(4,3,79,70,190,125,91,96),(4,3,80,71,193,127,93,97),(4,4,1,18,28,20,20,20),(4,4,2,19,29,21,20,20),(4,4,3,20,31,21,20,21),(4,4,4,20,32,22,20,21),(4,4,5,21,34,23,21,21),(4,4,6,22,35,24,21,22),(4,4,7,23,37,24,21,22),(4,4,8,24,38,25,21,23),(4,4,9,24,40,26,21,23),(4,4,10,25,41,26,21,23),(4,4,11,26,43,27,22,24),(4,4,12,27,44,28,22,24),(4,4,13,28,46,29,22,25),(4,4,14,29,48,30,22,25),(4,4,15,29,49,30,22,25),(4,4,16,30,51,31,23,26),(4,4,17,31,52,32,23,26),(4,4,18,32,54,33,23,27),(4,4,19,33,56,34,23,27),(4,4,20,34,57,35,23,28),(4,4,21,35,59,35,24,28),(4,4,22,36,61,36,24,29),(4,4,23,37,63,37,24,29),(4,4,24,38,64,38,24,30),(4,4,25,39,66,39,25,30),(4,4,26,40,68,40,25,31),(4,4,27,41,70,41,25,31),(4,4,28,42,72,42,25,32),(4,4,29,43,73,43,25,32),(4,4,30,44,75,43,26,33),(4,4,31,45,77,44,26,33),(4,4,32,46,79,45,26,34),(4,4,33,47,81,46,27,34),(4,4,34,48,83,47,27,35),(4,4,35,49,85,48,27,35),(4,4,36,50,87,49,27,36),(4,4,37,51,89,50,28,36),(4,4,38,52,91,51,28,37),(4,4,39,53,93,52,28,38),(4,4,40,54,95,53,28,38),(4,4,41,56,97,54,29,39),(4,4,42,57,99,55,29,39),(4,4,43,58,101,56,29,40),(4,4,44,59,103,57,30,40),(4,4,45,60,105,59,30,41),(4,4,46,61,107,60,30,42),(4,4,47,62,109,61,31,42),(4,4,48,64,112,62,31,43),(4,4,49,65,114,63,31,44),(4,4,50,66,116,64,32,44),(4,4,51,67,118,65,32,45),(4,4,52,68,120,66,32,45),(4,4,53,70,123,67,33,46),(4,4,54,71,125,69,33,47),(4,4,55,72,127,70,33,47),(4,4,56,73,129,71,34,48),(4,4,57,75,132,72,34,49),(4,4,58,76,134,73,34,49),(4,4,59,77,136,74,35,50),(4,4,60,79,139,76,35,51),(4,4,61,80,141,77,35,51),(4,4,62,81,143,78,36,52),(4,4,63,82,146,79,36,53),(4,4,64,84,148,80,37,54),(4,4,65,85,151,82,37,54),(4,4,66,87,153,83,37,55),(4,4,67,88,156,84,38,56),(4,4,68,89,158,85,38,57),(4,4,69,91,160,87,39,57),(4,4,70,92,163,88,39,58),(4,4,71,94,166,90,39,59),(4,4,72,96,169,91,40,59),(4,4,73,97,172,93,40,60),(4,4,74,99,175,94,41,61),(4,4,75,101,178,96,41,62),(4,4,76,102,181,97,41,63),(4,4,77,104,184,99,42,64),(4,4,78,106,188,101,42,65),(4,4,79,108,191,102,43,66),(4,4,80,110,194,104,43,67),(4,5,1,17,25,19,22,23),(4,5,2,17,25,19,23,24),(4,5,3,17,25,20,25,26),(4,5,4,17,26,20,26,27),(4,5,5,18,26,20,27,28),(4,5,6,18,26,21,29,30),(4,5,7,18,26,21,30,31),(4,5,8,18,26,22,31,33),(4,5,9,18,27,22,33,34),(4,5,10,19,27,22,34,36),(4,5,11,19,27,23,36,37),(4,5,12,19,27,23,37,39),(4,5,13,19,28,24,38,40),(4,5,14,19,28,24,40,42),(4,5,15,19,28,25,41,43),(4,5,16,20,28,25,43,45),(4,5,17,20,29,25,44,46),(4,5,18,20,29,26,46,48),(4,5,19,20,29,26,47,49),(4,5,20,21,30,27,49,51),(4,5,21,21,30,27,51,53),(4,5,22,21,30,28,52,54),(4,5,23,21,30,28,54,56),(4,5,24,21,31,29,55,58),(4,5,25,22,31,29,57,59),(4,5,26,22,31,30,59,61),(4,5,27,22,32,30,60,63),(4,5,28,22,32,31,62,65),(4,5,29,23,32,31,64,66),(4,5,30,23,33,32,65,68),(4,5,31,23,33,32,67,70),(4,5,32,23,33,33,69,72),(4,5,33,24,34,33,70,73),(4,5,34,24,34,34,72,75),(4,5,35,24,34,34,74,77),(4,5,36,24,35,35,76,79),(4,5,37,25,35,35,78,81),(4,5,38,25,35,36,79,83),(4,5,39,25,36,37,81,85),(4,5,40,26,36,37,83,87),(4,5,41,26,37,38,85,88),(4,5,42,26,37,38,87,90),(4,5,43,27,37,39,89,92),(4,5,44,27,38,39,91,94),(4,5,45,27,38,40,92,96),(4,5,46,27,39,41,94,98),(4,5,47,28,39,41,96,100),(4,5,48,28,39,42,98,102),(4,5,49,28,40,43,100,104),(4,5,50,29,40,43,102,106),(4,5,51,29,41,44,104,109),(4,5,52,29,41,44,106,111),(4,5,53,30,42,45,108,113),(4,5,54,30,42,46,110,115),(4,5,55,30,43,46,112,117),(4,5,56,31,43,47,114,119),(4,5,57,31,43,48,117,121),(4,5,58,31,44,48,119,124),(4,5,59,32,44,49,121,126),(4,5,60,32,45,50,123,128),(4,5,61,33,45,51,125,130),(4,5,62,33,46,51,127,132),(4,5,63,33,46,52,129,135),(4,5,64,34,47,53,132,137),(4,5,65,34,47,53,134,139),(4,5,66,34,48,54,136,142),(4,5,67,35,48,55,138,144),(4,5,68,35,49,56,140,146),(4,5,69,36,49,56,143,149),(4,5,70,36,50,57,145,151),(4,5,71,36,51,58,148,161),(4,5,72,37,51,58,151,164),(4,5,73,37,52,59,154,168),(4,5,74,38,52,60,156,171),(4,5,75,38,53,61,159,174),(4,5,76,38,54,62,162,177),(4,5,77,39,54,63,165,180),(4,5,78,39,55,64,168,183),(4,5,79,40,55,65,171,186),(4,5,80,40,56,66,200,191),(4,6,1,20,25,21,20,20),(4,6,2,21,26,22,20,20),(4,6,3,23,27,23,20,21),(4,6,4,24,27,25,20,21),(4,6,5,25,28,26,20,21),(4,6,6,27,29,27,20,21),(4,6,7,28,30,28,21,22),(4,6,8,29,31,29,21,22),(4,6,9,31,31,31,21,22),(4,6,10,32,32,32,21,23),(4,6,11,33,33,33,21,23),(4,6,12,35,34,34,21,23),(4,6,13,36,35,36,21,24),(4,6,14,38,36,37,21,24),(4,6,15,39,37,38,21,24),(4,6,16,41,37,40,21,25),(4,6,17,42,38,41,22,25),(4,6,18,44,39,43,22,25),(4,6,19,45,40,44,22,26),(4,6,20,47,41,45,22,26),(4,6,21,48,42,47,22,26),(4,6,22,50,43,48,22,27),(4,6,23,52,44,50,22,27),(4,6,24,53,45,51,23,28),(4,6,25,55,46,52,23,28),(4,6,26,56,47,54,23,28),(4,6,27,58,48,55,23,29),(4,6,28,60,49,57,23,29),(4,6,29,61,50,58,23,30),(4,6,30,63,51,60,24,30),(4,6,31,65,52,62,24,30),(4,6,32,66,53,63,24,31),(4,6,33,68,54,65,24,31),(4,6,34,70,55,66,24,32),(4,6,35,72,56,68,24,32),(4,6,36,73,58,69,25,33),(4,6,37,75,59,71,25,33),(4,6,38,77,60,73,25,34),(4,6,39,79,61,74,25,34),(4,6,40,81,62,76,25,35),(4,6,41,82,63,78,26,35),(4,6,42,84,64,79,26,35),(4,6,43,86,66,81,26,36),(4,6,44,88,67,83,26,36),(4,6,45,90,68,85,26,37),(4,6,46,92,69,86,27,37),(4,6,47,94,70,88,27,38),(4,6,48,96,72,90,27,38),(4,6,49,98,73,92,27,39),(4,6,50,100,74,93,28,40),(4,6,51,101,75,94,28,40),(4,6,52,102,76,95,28,41),(4,6,53,103,77,96,28,41),(4,6,54,104,77,97,29,42),(4,6,55,105,78,98,29,42),(4,6,56,108,80,101,29,43),(4,6,57,113,81,103,29,43),(4,6,58,115,82,105,30,44),(4,6,59,115,84,107,30,44),(4,6,60,120,85,109,30,45),(4,6,61,122,86,111,30,46),(4,6,62,122,88,113,30,46),(4,6,63,127,89,116,31,47),(4,6,64,127,91,118,31,47),(4,6,65,133,92,120,31,48),(4,6,66,135,94,123,31,49),(4,6,67,136,95,125,32,49),(4,6,68,137,97,127,32,50),(4,6,69,140,98,130,32,51),(4,6,70,147,100,132,32,51),(4,6,71,154,102,135,33,52),(4,6,72,156,103,137,33,53),(4,6,73,157,105,140,33,54),(4,6,74,158,107,142,33,54),(4,6,75,161,108,145,34,55),(4,6,76,164,110,148,34,56),(4,6,77,167,112,150,34,57),(4,6,78,170,113,153,34,57),(4,6,79,172,115,156,35,58),(4,6,80,177,117,159,35,59),(4,11,1,18,25,19,22,22),(4,11,2,19,25,20,23,23),(4,11,3,19,26,20,24,24),(4,11,4,20,26,21,25,26),(4,11,5,20,27,22,26,27),(4,11,6,21,27,22,27,28),(4,11,7,21,28,23,28,29),(4,11,8,22,28,24,29,30),(4,11,9,23,29,24,30,32),(4,11,10,23,29,25,32,33),(4,11,11,24,30,26,33,34),(4,11,12,24,31,26,34,35),(4,11,13,25,31,27,35,37),(4,11,14,26,32,28,36,38),(4,11,15,26,32,29,37,39),(4,11,16,27,33,29,38,41),(4,11,17,28,33,30,40,42),(4,11,18,28,34,31,41,43),(4,11,19,29,35,32,42,45),(4,11,20,30,35,32,43,46),(4,11,21,30,36,33,45,48),(4,11,22,31,36,34,46,49),(4,11,23,32,37,35,47,51),(4,11,24,32,38,36,48,52),(4,11,25,33,38,36,50,53),(4,11,26,34,39,37,51,55),(4,11,27,35,40,38,52,56),(4,11,28,35,40,39,54,58),(4,11,29,36,41,40,55,59),(4,11,30,37,42,41,56,61),(4,11,31,38,42,42,58,62),(4,11,32,38,43,42,59,64),(4,11,33,39,44,43,60,66),(4,11,34,40,44,44,62,67),(4,11,35,41,45,45,63,69),(4,11,36,42,46,46,65,70),(4,11,37,42,47,47,66,72),(4,11,38,43,47,48,67,74),(4,11,39,44,48,49,69,75),(4,11,40,45,49,50,70,77),(4,11,41,46,50,51,72,79),(4,11,42,46,50,52,73,80),(4,11,43,47,51,53,75,82),(4,11,44,48,52,54,76,84),(4,11,45,49,53,55,78,85),(4,11,46,50,54,56,79,87),(4,11,47,51,54,57,81,89),(4,11,48,52,55,58,83,91),(4,11,49,53,56,59,84,93),(4,11,50,53,57,60,86,94),(4,11,51,54,58,61,87,96),(4,11,52,55,59,62,89,98),(4,11,53,56,59,63,91,100),(4,11,54,57,60,64,92,102),(4,11,55,58,61,65,94,103),(4,11,56,59,62,66,95,105),(4,11,57,60,63,67,97,107),(4,11,58,61,64,68,99,109),(4,11,59,62,65,69,101,111),(4,11,60,63,66,70,102,113),(4,11,61,64,66,72,104,115),(4,11,62,65,67,73,106,117),(4,11,63,66,68,74,107,119),(4,11,64,67,69,75,109,121),(4,11,65,68,70,76,111,123),(4,11,66,69,71,77,113,125),(4,11,67,70,72,78,115,127),(4,11,68,71,73,80,116,129),(4,11,69,72,74,81,118,131),(4,11,70,73,75,82,120,133),(4,11,71,75,76,83,122,135),(4,11,72,76,78,85,125,138),(4,11,73,77,79,86,127,140),(4,11,74,78,80,88,131,143),(4,11,75,80,81,89,133,145),(4,11,76,81,82,91,134,148),(4,11,77,82,83,92,136,151),(4,11,78,84,85,94,138,153),(4,11,79,85,86,95,141,156),(4,11,80,86,87,97,143,159),(5,1,1,22,18,23,18,25),(5,1,2,23,19,24,18,25),(5,1,3,25,20,25,18,26),(5,1,4,26,20,26,18,26),(5,1,5,27,21,28,18,26),(5,1,6,29,22,29,18,26),(5,1,7,30,23,30,19,27),(5,1,8,31,24,31,19,27),(5,1,9,33,25,33,19,27),(5,1,10,34,25,34,19,28),(5,1,11,35,26,35,19,28),(5,1,12,37,27,36,19,28),(5,1,13,38,28,38,19,28),(5,1,14,40,29,39,19,29),(5,1,15,41,30,40,19,29),(5,1,16,43,31,42,20,29),(5,1,17,44,32,43,20,30),(5,1,18,46,33,44,20,30),(5,1,19,47,34,46,20,31),(5,1,20,49,34,47,20,31),(5,1,21,50,35,49,20,31),(5,1,22,52,36,50,20,32),(5,1,23,53,37,51,21,32),(5,1,24,55,38,53,21,32),(5,1,25,57,39,54,21,33),(5,1,26,58,40,56,21,33),(5,1,27,60,41,57,21,34),(5,1,28,62,42,59,21,34),(5,1,29,63,43,60,21,34),(5,1,30,65,44,62,22,35),(5,1,31,67,46,63,22,35),(5,1,32,68,47,65,22,36),(5,1,33,70,48,67,22,36),(5,1,34,72,49,68,22,36),(5,1,35,74,50,70,23,37),(5,1,36,75,51,71,23,37),(5,1,37,77,52,73,23,38),(5,1,38,79,53,75,23,38),(5,1,39,81,54,76,23,39),(5,1,40,83,55,78,24,39),(5,1,41,84,57,80,24,40),(5,1,42,86,58,81,24,40),(5,1,43,88,59,83,24,41),(5,1,44,90,60,85,24,41),(5,1,45,92,61,86,25,42),(5,1,46,94,62,88,25,42),(5,1,47,96,64,90,25,43),(5,1,48,98,65,92,25,43),(5,1,49,100,66,93,25,44),(5,1,50,102,67,95,26,44),(5,1,51,104,69,97,26,45),(5,1,52,106,70,99,26,45),(5,1,53,108,71,101,26,46),(5,1,54,110,72,103,27,46),(5,1,55,112,74,104,27,47),(5,1,56,114,75,106,27,48),(5,1,57,116,76,108,27,48),(5,1,58,118,78,110,28,49),(5,1,59,120,79,112,28,49),(5,1,60,122,80,114,28,50),(5,1,61,124,82,116,28,50),(5,1,62,126,83,118,29,51),(5,1,63,128,84,120,29,52),(5,1,64,131,86,122,29,52),(5,1,65,133,87,124,30,53),(5,1,66,135,88,126,30,53),(5,1,67,137,90,128,30,54),(5,1,68,139,91,130,30,55),(5,1,69,142,93,132,31,55),(5,1,70,144,94,134,31,56),(5,1,71,147,95,136,31,57),(5,1,72,150,97,139,31,58),(5,1,73,152,99,141,31,59),(5,1,74,155,100,144,32,59),(5,1,75,158,102,146,32,60),(5,1,76,163,104,149,32,61),(5,1,77,167,106,152,33,62),(5,1,78,167,107,154,33,62),(5,1,79,170,109,157,33,63),(5,1,80,173,111,160,34,64),(5,4,1,20,21,22,18,25),(5,4,2,21,22,23,18,25),(5,4,3,22,24,23,18,26),(5,4,4,22,25,24,18,26),(5,4,5,23,27,25,19,26),(5,4,6,24,28,25,19,27),(5,4,7,25,30,26,19,27),(5,4,8,25,31,27,19,27),(5,4,9,26,33,28,19,28),(5,4,10,27,34,28,19,28),(5,4,11,28,36,29,20,29),(5,4,12,29,38,30,20,29),(5,4,13,30,39,31,20,29),(5,4,14,31,41,32,20,30),(5,4,15,31,42,32,20,30),(5,4,16,32,44,33,21,31),(5,4,17,33,46,34,21,31),(5,4,18,34,47,35,21,32),(5,4,19,35,49,36,21,32),(5,4,20,36,51,36,21,32),(5,4,21,37,52,37,22,33),(5,4,22,38,54,38,22,33),(5,4,23,39,56,39,22,34),(5,4,24,40,58,40,22,34),(5,4,25,41,60,41,23,35),(5,4,26,42,61,42,23,35),(5,4,27,43,63,43,23,36),(5,4,28,44,65,44,23,36),(5,4,29,45,67,44,24,37),(5,4,30,46,69,45,24,37),(5,4,31,47,71,46,24,38),(5,4,32,48,72,47,24,38),(5,4,33,49,74,48,25,39),(5,4,34,50,76,49,25,39),(5,4,35,51,78,50,25,40),(5,4,36,52,80,51,25,41),(5,4,37,53,82,52,26,41),(5,4,38,54,84,53,26,42),(5,4,39,55,86,54,26,42),(5,4,40,56,88,55,27,43),(5,4,41,57,90,56,27,43),(5,4,42,59,92,57,27,44),(5,4,43,60,94,58,27,45),(5,4,44,61,96,59,28,45),(5,4,45,62,99,60,28,46),(5,4,46,63,101,61,28,46),(5,4,47,64,103,63,29,47),(5,4,48,66,105,64,29,48),(5,4,49,67,107,65,29,48),(5,4,50,68,109,66,30,49),(5,4,51,69,111,67,30,50),(5,4,52,70,114,68,30,50),(5,4,53,72,116,69,31,51),(5,4,54,73,118,70,31,52),(5,4,55,74,120,72,31,52),(5,4,56,75,123,73,32,53),(5,4,57,77,125,74,32,54),(5,4,58,78,127,75,32,54),(5,4,59,79,130,76,33,55),(5,4,60,81,132,77,33,56),(5,4,61,82,134,79,34,56),(5,4,62,83,137,80,34,57),(5,4,63,84,139,81,34,58),(5,4,64,86,141,82,35,59),(5,4,65,87,144,84,35,59),(5,4,66,88,146,85,35,60),(5,4,67,90,149,86,36,61),(5,4,68,91,151,87,36,61),(5,4,69,93,154,89,37,62),(5,4,70,94,156,90,37,63),(5,4,71,96,159,91,37,64),(5,4,72,98,162,93,38,64),(5,4,73,99,165,95,38,65),(5,4,74,101,168,96,39,66),(5,4,75,103,171,98,39,67),(5,4,76,104,174,99,39,68),(5,4,77,106,177,101,40,69),(5,4,78,108,181,103,40,70),(5,4,79,110,184,104,41,71),(5,4,80,112,187,106,41,72),(5,5,1,19,18,21,20,28),(5,5,2,19,18,21,21,29),(5,5,3,19,18,22,23,31),(5,5,4,19,19,22,24,32),(5,5,5,20,19,22,25,33),(5,5,6,20,19,23,27,35),(5,5,7,20,19,23,28,36),(5,5,8,20,20,24,29,38),(5,5,9,20,20,24,31,39),(5,5,10,20,20,24,32,40),(5,5,11,21,20,25,34,42),(5,5,12,21,21,25,35,43),(5,5,13,21,21,26,37,45),(5,5,14,21,21,26,38,46),(5,5,15,21,21,26,39,48),(5,5,16,22,22,27,41,50),(5,5,17,22,22,27,42,51),(5,5,18,22,22,28,44,53),(5,5,19,22,23,28,46,54),(5,5,20,22,23,29,47,56),(5,5,21,23,23,29,49,57),(5,5,22,23,23,30,50,59),(5,5,23,23,24,30,52,61),(5,5,24,23,24,31,53,62),(5,5,25,24,24,31,55,64),(5,5,26,24,25,32,57,66),(5,5,27,24,25,32,58,68),(5,5,28,24,25,33,60,69),(5,5,29,25,26,33,62,71),(5,5,30,25,26,34,63,73),(5,5,31,25,26,34,65,75),(5,5,32,25,27,35,67,76),(5,5,33,26,27,35,69,78),(5,5,34,26,27,36,70,80),(5,5,35,26,28,36,72,82),(5,5,36,26,28,37,74,84),(5,5,37,27,28,37,76,86),(5,5,38,27,29,38,77,87),(5,5,39,27,29,38,79,89),(5,5,40,28,30,39,81,91),(5,5,41,28,30,40,83,93),(5,5,42,28,30,40,85,95),(5,5,43,28,31,41,87,97),(5,5,44,29,31,41,89,99),(5,5,45,29,32,42,91,101),(5,5,46,29,32,43,92,103),(5,5,47,30,32,43,94,105),(5,5,48,30,33,44,96,107),(5,5,49,30,33,44,98,109),(5,5,50,31,34,45,100,111),(5,5,51,31,34,46,102,113),(5,5,52,31,35,46,104,115),(5,5,53,32,35,47,106,118),(5,5,54,32,35,48,108,120),(5,5,55,32,36,48,110,122),(5,5,56,33,36,49,113,124),(5,5,57,33,37,50,115,126),(5,5,58,33,37,50,117,128),(5,5,59,34,38,51,119,131),(5,5,60,34,38,52,121,133),(5,5,61,34,39,52,123,135),(5,5,62,35,39,53,125,137),(5,5,63,35,40,54,127,140),(5,5,64,36,40,55,130,142),(5,5,65,36,41,55,132,144),(5,5,66,36,41,56,134,147),(5,5,67,37,41,57,136,149),(5,5,68,37,42,58,138,151),(5,5,69,38,42,58,141,154),(5,5,70,38,43,59,143,156),(5,5,71,38,44,60,146,159),(5,5,72,39,44,60,149,162),(5,5,73,39,45,61,152,165),(5,5,74,40,45,62,157,168),(5,5,75,40,46,63,157,171),(5,5,76,40,47,64,160,174),(5,5,77,41,47,65,163,177),(5,5,78,41,48,66,166,180),(5,5,79,42,48,67,169,183),(5,5,80,42,49,68,172,186),(5,6,1,22,18,23,18,25),(5,6,2,23,19,24,18,25),(5,6,3,25,20,25,18,26),(5,6,4,26,20,26,18,26),(5,6,5,27,21,28,18,26),(5,6,6,29,22,29,18,26),(5,6,7,30,23,30,19,27),(5,6,8,31,24,31,19,27),(5,6,9,33,25,33,19,27),(5,6,10,34,25,34,19,28),(5,6,11,35,26,35,19,28),(5,6,12,37,27,36,19,28),(5,6,13,38,28,38,19,28),(5,6,14,40,29,39,19,29),(5,6,15,41,30,40,19,29),(5,6,16,43,31,42,20,29),(5,6,17,44,32,43,20,30),(5,6,18,46,33,44,20,30),(5,6,19,47,34,46,20,31),(5,6,20,49,34,47,20,31),(5,6,21,50,35,49,20,31),(5,6,22,52,36,50,20,32),(5,6,23,53,37,51,21,32),(5,6,24,55,38,53,21,32),(5,6,25,57,39,54,21,33),(5,6,26,58,40,56,21,33),(5,6,27,60,41,57,21,34),(5,6,28,62,42,59,21,34),(5,6,29,63,43,60,21,34),(5,6,30,65,44,62,22,35),(5,6,31,67,46,63,22,35),(5,6,32,68,47,65,22,36),(5,6,33,70,48,67,22,36),(5,6,34,72,49,68,22,36),(5,6,35,74,50,70,23,37),(5,6,36,75,51,71,23,37),(5,6,37,77,52,73,23,38),(5,6,38,79,53,75,23,38),(5,6,39,81,54,76,23,39),(5,6,40,83,55,78,24,39),(5,6,41,84,57,80,24,40),(5,6,42,86,58,81,24,40),(5,6,43,88,59,83,24,41),(5,6,44,90,60,85,24,41),(5,6,45,92,61,86,25,42),(5,6,46,94,62,88,25,42),(5,6,47,96,64,90,25,43),(5,6,48,98,65,92,25,43),(5,6,49,100,66,93,25,44),(5,6,50,102,67,95,26,44),(5,6,51,103,67,96,26,45),(5,6,52,104,68,97,26,45),(5,6,53,105,69,98,26,46),(5,6,54,106,70,99,27,46),(5,6,55,107,71,100,27,47),(5,6,56,110,73,103,27,48),(5,6,57,112,74,105,27,48),(5,6,58,114,75,107,28,49),(5,6,59,119,77,109,28,49),(5,6,60,122,78,111,28,50),(5,6,61,124,79,113,28,51),(5,6,62,127,81,115,28,51),(5,6,63,129,82,118,29,52),(5,6,64,136,84,120,29,52),(5,6,65,137,85,123,29,53),(5,6,66,138,87,125,29,54),(5,6,67,141,88,127,30,54),(5,6,68,143,90,129,30,55),(5,6,69,146,91,132,30,56),(5,6,70,149,93,134,30,56),(5,6,71,152,95,137,31,57),(5,6,72,154,96,139,31,58),(5,6,73,157,98,142,31,59),(5,6,74,158,100,145,31,59),(5,6,75,159,101,147,32,60),(5,6,76,162,103,150,32,61),(5,6,77,167,105,152,32,62),(5,6,78,173,106,155,32,62),(5,6,79,174,108,158,33,63),(5,6,80,174,110,161,33,64),(5,8,1,19,18,21,21,27),(5,8,2,19,18,21,22,28),(5,8,3,19,18,22,24,30),(5,8,4,19,18,22,25,31),(5,8,5,19,19,22,26,32),(5,8,6,19,19,22,28,34),(5,8,7,20,19,23,29,35),(5,8,8,20,19,23,31,36),(5,8,9,20,19,23,32,38),(5,8,10,20,19,24,34,39),(5,8,11,20,20,24,35,40),(5,8,12,20,20,24,37,42),(5,8,13,20,20,25,38,43),(5,8,14,20,20,25,40,45),(5,8,15,20,20,25,41,46),(5,8,16,21,21,26,43,48),(5,8,17,21,21,26,44,49),(5,8,18,21,21,26,46,51),(5,8,19,21,21,27,48,52),(5,8,20,21,21,27,49,54),(5,8,21,21,22,27,51,55),(5,8,22,21,22,28,52,57),(5,8,23,21,22,28,54,58),(5,8,24,22,22,29,56,60),(5,8,25,22,23,29,57,62),(5,8,26,22,23,29,59,63),(5,8,27,22,23,30,61,65),(5,8,28,22,23,30,63,67),(5,8,29,22,24,31,64,68),(5,8,30,23,24,31,66,70),(5,8,31,23,24,31,68,72),(5,8,32,23,24,32,70,73),(5,8,33,23,25,32,72,75),(5,8,34,23,25,33,73,77),(5,8,35,24,25,33,75,79),(5,8,36,24,25,34,77,80),(5,8,37,24,26,34,79,82),(5,8,38,24,26,35,81,84),(5,8,39,24,26,35,83,86),(5,8,40,24,27,35,85,88),(5,8,41,25,27,36,87,90),(5,8,42,25,27,36,89,91),(5,8,43,25,27,37,90,93),(5,8,44,25,28,37,92,95),(5,8,45,26,28,38,94,97),(5,8,46,26,28,38,96,99),(5,8,47,26,29,39,98,101),(5,8,48,26,29,39,100,103),(5,8,49,26,29,40,103,105),(5,8,50,27,30,40,105,107),(5,8,51,27,30,41,107,109),(5,8,52,27,30,42,109,111),(5,8,53,27,31,42,111,113),(5,8,54,28,31,43,113,115),(5,8,55,28,31,43,115,117),(5,8,56,28,32,44,117,119),(5,8,57,28,32,44,119,121),(5,8,58,29,32,45,122,123),(5,8,59,29,33,45,124,126),(5,8,60,29,33,46,126,128),(5,8,61,29,34,47,128,130),(5,8,62,30,34,47,131,132),(5,8,63,30,34,48,133,134),(5,8,64,30,35,48,135,136),(5,8,65,31,35,49,137,139),(5,8,66,31,35,50,140,141),(5,8,67,31,36,50,142,143),(5,8,68,31,36,51,144,145),(5,8,69,32,37,51,147,148),(5,8,70,32,37,52,149,150),(5,8,71,32,37,53,152,153),(5,8,72,32,38,54,155,156),(5,8,73,32,38,55,158,159),(5,8,74,33,39,55,161,161),(5,8,75,33,39,56,164,164),(5,8,76,33,39,57,167,167),(5,8,77,34,40,58,170,170),(5,8,78,34,40,58,173,173),(5,8,79,34,41,59,176,176),(5,8,80,35,41,60,179,179),(5,9,1,19,18,22,20,27),(5,9,2,19,18,23,21,28),(5,9,3,20,19,23,22,29),(5,9,4,20,19,24,24,30),(5,9,5,20,19,24,25,32),(5,9,6,20,20,25,26,33),(5,9,7,21,20,25,27,34),(5,9,8,21,21,26,28,35),(5,9,9,21,21,26,30,36),(5,9,10,22,21,27,31,38),(5,9,11,22,22,28,32,39),(5,9,12,22,22,28,34,40),(5,9,13,23,23,29,35,41),(5,9,14,23,23,30,36,43),(5,9,15,23,24,30,37,44),(5,9,16,24,24,31,39,45),(5,9,17,24,24,31,40,47),(5,9,18,24,25,32,42,48),(5,9,19,25,25,33,43,49),(5,9,20,25,26,33,44,51),(5,9,21,26,26,34,46,52),(5,9,22,26,27,35,47,53),(5,9,23,26,27,36,49,55),(5,9,24,27,28,36,50,56),(5,9,25,27,28,37,52,58),(5,9,26,27,29,38,53,59),(5,9,27,28,29,38,55,60),(5,9,28,28,30,39,56,62),(5,9,29,29,30,40,58,63),(5,9,30,29,31,41,59,65),(5,9,31,30,31,41,61,66),(5,9,32,30,32,42,62,68),(5,9,33,30,32,43,64,69),(5,9,34,31,33,44,65,71),(5,9,35,31,33,45,67,73),(5,9,36,32,34,45,69,74),(5,9,37,32,34,46,70,76),(5,9,38,33,35,47,72,77),(5,9,39,33,36,48,73,79),(5,9,40,34,36,49,75,81),(5,9,41,34,37,49,77,82),(5,9,42,35,37,50,78,84),(5,9,43,35,38,51,80,86),(5,9,44,36,39,52,82,87),(5,9,45,36,39,53,84,89),(5,9,46,37,40,54,85,91),(5,9,47,37,40,55,87,92),(5,9,48,38,41,55,89,94),(5,9,49,38,42,56,91,96),(5,9,50,39,42,57,92,98),(5,9,51,39,43,58,94,100),(5,9,52,40,44,59,96,101),(5,9,53,40,44,60,98,103),(5,9,54,41,45,61,100,105),(5,9,55,41,45,62,102,107),(5,9,56,42,46,63,103,109),(5,9,57,42,47,64,105,111),(5,9,58,43,47,65,107,112),(5,9,59,43,48,66,109,114),(5,9,60,44,49,67,111,116),(5,9,61,45,50,68,113,118),(5,9,62,45,50,69,115,120),(5,9,63,46,51,70,117,122),(5,9,64,46,52,71,119,124),(5,9,65,47,52,72,121,126),(5,9,66,48,53,73,123,128),(5,9,67,48,54,74,125,130),(5,9,68,49,55,75,127,132),(5,9,69,49,55,76,129,134),(5,9,70,50,56,77,131,136),(5,9,71,51,57,86,135,147),(5,9,72,52,57,88,136,149),(5,9,73,53,58,89,138,152),(5,9,74,53,59,90,141,155),(5,9,75,54,60,92,143,157),(5,9,76,55,61,93,146,160),(5,9,77,56,62,94,149,163),(5,9,78,56,63,96,151,166),(5,9,79,57,64,97,154,169),(5,9,80,58,65,99,157,171),(6,1,1,28,15,24,15,22),(6,1,2,29,16,25,15,22),(6,1,3,31,17,26,15,23),(6,1,4,32,17,27,15,23),(6,1,5,33,18,29,15,23),(6,1,6,34,19,30,15,23),(6,1,7,36,20,31,16,24),(6,1,8,37,21,32,16,24),(6,1,9,38,22,34,16,24),(6,1,10,40,22,35,16,25),(6,1,11,41,23,36,16,25),(6,1,12,43,24,37,16,25),(6,1,13,44,25,39,16,26),(6,1,14,46,26,40,16,26),(6,1,15,47,27,41,17,26),(6,1,16,48,28,43,17,27),(6,1,17,50,29,44,17,27),(6,1,18,51,30,45,17,27),(6,1,19,53,31,47,17,28),(6,1,20,54,32,48,17,28),(6,1,21,56,33,50,17,28),(6,1,22,58,34,51,18,29),(6,1,23,59,35,52,18,29),(6,1,24,61,36,54,18,30),(6,1,25,62,37,55,18,30),(6,1,26,64,38,57,18,30),(6,1,27,66,39,58,18,31),(6,1,28,67,40,60,18,31),(6,1,29,69,41,61,19,32),(6,1,30,71,42,63,19,32),(6,1,31,72,43,64,19,32),(6,1,32,74,44,66,19,33),(6,1,33,76,45,67,19,33),(6,1,34,77,46,69,20,34),(6,1,35,79,47,71,20,34),(6,1,36,81,48,72,20,35),(6,1,37,83,49,74,20,35),(6,1,38,85,50,76,20,35),(6,1,39,86,51,77,21,36),(6,1,40,88,53,79,21,36),(6,1,41,90,54,81,21,37),(6,1,42,92,55,82,21,37),(6,1,43,94,56,84,21,38),(6,1,44,96,57,86,22,38),(6,1,45,98,58,87,22,39),(6,1,46,99,60,89,22,39),(6,1,47,101,61,91,22,40),(6,1,48,103,62,93,22,40),(6,1,49,105,63,94,23,41),(6,1,50,107,65,96,23,41),(6,1,51,109,66,98,23,42),(6,1,52,111,67,100,23,42),(6,1,53,113,68,102,24,43),(6,1,54,115,70,104,24,44),(6,1,55,117,71,105,24,44),(6,1,56,119,72,107,24,45),(6,1,57,122,73,109,25,45),(6,1,58,124,75,111,25,46),(6,1,59,126,76,113,25,46),(6,1,60,128,77,115,25,47),(6,1,61,130,79,117,26,48),(6,1,62,132,80,119,26,48),(6,1,63,134,81,121,26,49),(6,1,64,137,83,123,26,49),(6,1,65,139,84,125,27,50),(6,1,66,141,85,127,27,51),(6,1,67,143,87,129,27,51),(6,1,68,145,88,131,27,52),(6,1,69,148,90,133,28,52),(6,1,70,150,91,135,28,53),(6,1,71,153,92,137,28,54),(6,1,72,155,94,140,28,55),(6,1,73,158,96,142,28,56),(6,1,74,161,97,145,29,56),(6,1,75,164,99,147,29,57),(6,1,76,167,101,150,29,58),(6,1,77,170,103,153,30,59),(6,1,78,173,104,155,30,59),(6,1,79,176,106,164,30,60),(6,1,80,179,108,170,31,61),(6,3,1,25,18,23,15,23),(6,3,2,25,19,24,16,24),(6,3,3,26,21,25,16,24),(6,3,4,26,22,26,17,25),(6,3,5,27,24,27,17,25),(6,3,6,27,25,28,18,26),(6,3,7,28,26,28,19,27),(6,3,8,28,28,29,19,27),(6,3,9,28,29,30,20,28),(6,3,10,29,31,31,20,29),(6,3,11,29,32,32,21,29),(6,3,12,30,34,33,22,30),(6,3,13,30,35,34,22,31),(6,3,14,31,37,35,23,32),(6,3,15,31,38,36,24,32),(6,3,16,32,40,37,24,33),(6,3,17,32,41,39,25,34),(6,3,18,33,43,40,26,35),(6,3,19,33,45,41,27,35),(6,3,20,34,46,42,27,36),(6,3,21,34,48,43,28,37),(6,3,22,35,50,44,29,38),(6,3,23,35,51,45,29,38),(6,3,24,36,53,46,30,39),(6,3,25,37,55,47,31,40),(6,3,26,37,56,48,32,41),(6,3,27,38,58,50,32,42),(6,3,28,38,60,51,33,42),(6,3,29,39,62,52,34,43),(6,3,30,39,63,53,35,44),(6,3,31,40,65,54,36,45),(6,3,32,41,67,56,36,46),(6,3,33,41,69,57,37,47),(6,3,34,42,71,58,38,48),(6,3,35,43,72,59,39,48),(6,3,36,43,74,61,40,49),(6,3,37,44,76,62,40,50),(6,3,38,45,78,63,41,51),(6,3,39,45,80,64,42,52),(6,3,40,46,82,66,43,53),(6,3,41,47,84,67,44,54),(6,3,42,47,86,68,45,55),(6,3,43,48,88,70,46,56),(6,3,44,49,90,71,46,57),(6,3,45,49,92,72,47,58),(6,3,46,50,94,74,48,59),(6,3,47,51,96,75,49,60),(6,3,48,51,98,77,50,61),(6,3,49,52,100,78,51,62),(6,3,50,53,102,79,52,63),(6,3,51,54,104,81,53,64),(6,3,52,54,106,82,54,65),(6,3,53,55,108,84,55,66),(6,3,54,56,110,85,56,67),(6,3,55,57,112,87,57,68),(6,3,56,57,114,88,58,69),(6,3,57,58,117,90,59,70),(6,3,58,59,119,91,60,71),(6,3,59,60,121,93,61,72),(6,3,60,61,123,94,62,74),(6,3,61,61,125,96,63,75),(6,3,62,62,128,97,64,76),(6,3,63,63,130,99,65,77),(6,3,64,64,132,100,66,78),(6,3,65,65,134,102,67,79),(6,3,66,66,137,104,68,80),(6,3,67,66,139,105,69,81),(6,3,68,67,141,107,70,83),(6,3,69,68,144,108,71,84),(6,3,70,69,146,110,72,85),(6,3,71,70,149,112,73,86),(6,3,72,71,152,114,74,87),(6,3,73,72,155,116,75,89),(6,3,74,73,158,118,77,90),(6,3,75,74,161,120,78,92),(6,3,76,75,164,122,79,93),(6,3,77,76,167,124,81,95),(6,3,78,77,176,126,85,96),(6,3,79,78,179,128,86,98),(6,3,80,79,183,130,88,99),(6,6,1,28,15,24,15,22),(6,6,2,29,16,25,15,22),(6,6,3,31,17,26,15,23),(6,6,4,32,17,27,15,23),(6,6,5,33,18,29,15,23),(6,6,6,34,19,30,15,23),(6,6,7,36,20,31,16,24),(6,6,8,37,21,32,16,24),(6,6,9,38,22,34,16,24),(6,6,10,40,22,35,16,25),(6,6,11,41,23,36,16,25),(6,6,12,43,24,37,16,25),(6,6,13,44,25,39,16,26),(6,6,14,46,26,40,16,26),(6,6,15,47,27,41,17,26),(6,6,16,48,28,43,17,27),(6,6,17,50,29,44,17,27),(6,6,18,51,30,45,17,27),(6,6,19,53,31,47,17,28),(6,6,20,54,32,48,17,28),(6,6,21,56,33,50,17,28),(6,6,22,58,34,51,18,29),(6,6,23,59,35,52,18,29),(6,6,24,61,36,54,18,30),(6,6,25,62,37,55,18,30),(6,6,26,64,38,57,18,30),(6,6,27,66,39,58,18,31),(6,6,28,67,40,60,18,31),(6,6,29,69,41,61,19,32),(6,6,30,71,42,63,19,32),(6,6,31,72,43,64,19,32),(6,6,32,74,44,66,19,33),(6,6,33,76,45,67,19,33),(6,6,34,77,46,69,20,34),(6,6,35,79,47,71,20,34),(6,6,36,81,48,72,20,35),(6,6,37,83,49,74,20,35),(6,6,38,85,50,76,20,35),(6,6,39,86,51,77,21,36),(6,6,40,88,53,79,21,36),(6,6,41,90,54,81,21,37),(6,6,42,92,55,82,21,37),(6,6,43,94,56,84,21,38),(6,6,44,96,57,86,22,38),(6,6,45,98,58,87,22,39),(6,6,46,99,60,89,22,39),(6,6,47,101,60,91,22,40),(6,6,48,103,61,93,22,40),(6,6,49,105,62,94,23,41),(6,6,50,107,63,96,23,41),(6,6,51,109,64,97,23,42),(6,6,52,110,65,98,23,42),(6,6,53,111,66,99,24,43),(6,6,54,112,67,100,24,44),(6,6,55,113,68,101,24,44),(6,6,56,116,70,104,24,45),(6,6,57,121,71,106,24,45),(6,6,58,123,72,108,25,46),(6,6,59,123,74,110,25,46),(6,6,60,125,75,112,25,47),(6,6,61,127,76,114,25,48),(6,6,62,133,78,116,25,48),(6,6,63,135,79,119,26,49),(6,6,64,139,81,121,26,49),(6,6,65,142,82,123,26,50),(6,6,66,146,84,126,26,51),(6,6,67,150,85,132,27,51),(6,6,68,153,87,137,27,52),(6,6,69,157,88,140,27,53),(6,6,70,160,90,143,27,53),(6,6,71,163,92,146,28,54),(6,6,72,165,93,148,28,55),(6,6,73,167,95,150,28,56),(6,6,74,171,97,153,28,56),(6,6,75,174,98,156,29,57),(6,6,76,178,100,156,29,58),(6,6,77,179,102,156,29,59),(6,6,78,179,103,156,29,59),(6,6,79,182,105,159,30,60),(6,6,80,185,107,162,30,61),(6,7,1,26,15,23,16,24),(6,7,2,27,15,24,17,25),(6,7,3,28,16,25,18,26),(6,7,4,28,16,26,19,27),(6,7,5,29,17,27,20,28),(6,7,6,30,17,28,21,29),(6,7,7,31,18,29,22,30),(6,7,8,32,18,30,23,31),(6,7,9,33,19,31,24,32),(6,7,10,34,19,32,25,33),(6,7,11,35,20,33,26,35),(6,7,12,35,20,34,27,36),(6,7,13,36,21,35,28,37),(6,7,14,37,21,36,29,38),(6,7,15,38,22,37,30,39),(6,7,16,39,22,39,31,40),(6,7,17,40,23,40,32,42),(6,7,18,41,23,41,33,43),(6,7,19,42,24,42,34,44),(6,7,20,43,24,43,35,45),(6,7,21,44,25,44,36,46),(6,7,22,45,25,45,37,48),(6,7,23,46,26,47,38,49),(6,7,24,47,27,48,40,50),(6,7,25,48,27,49,41,51),(6,7,26,49,28,50,42,53),(6,7,27,51,28,52,43,54),(6,7,28,52,29,53,44,55),(6,7,29,53,29,54,45,57),(6,7,30,54,30,55,47,58),(6,7,31,55,31,57,48,59),(6,7,32,56,31,58,49,61),(6,7,33,57,32,59,50,62),(6,7,34,58,33,61,51,64),(6,7,35,60,33,62,53,65),(6,7,36,61,34,63,54,66),(6,7,37,62,34,65,55,68),(6,7,38,63,35,66,57,69),(6,7,39,64,36,67,58,71),(6,7,40,66,36,69,59,72),(6,7,41,67,37,70,60,74),(6,7,42,68,38,72,62,75),(6,7,43,69,38,73,63,77),(6,7,44,70,39,74,64,78),(6,7,45,72,40,76,66,80),(6,7,46,73,41,77,67,81),(6,7,47,74,41,79,69,83),(6,7,48,76,42,80,70,84),(6,7,49,77,43,82,71,86),(6,7,50,78,43,83,73,88),(6,7,51,80,44,85,74,89),(6,7,52,81,45,86,76,91),(6,7,53,82,46,88,77,92),(6,7,54,84,46,90,78,94),(6,7,55,85,47,91,80,96),(6,7,56,86,48,93,81,97),(6,7,57,88,49,94,83,99),(6,7,58,89,49,96,84,101),(6,7,59,91,50,97,86,102),(6,7,60,92,51,99,87,104),(6,7,61,94,52,101,89,106),(6,7,62,95,52,102,90,108),(6,7,63,96,53,104,92,109),(6,7,64,98,54,106,93,111),(6,7,65,99,55,107,95,113),(6,7,66,101,56,109,97,115),(6,7,67,102,57,111,98,117),(6,7,68,104,57,113,100,118),(6,7,69,105,58,114,101,120),(6,7,70,107,59,116,103,122),(6,7,71,108,60,118,113,124),(6,7,72,110,61,120,117,127),(6,7,73,112,62,122,119,129),(6,7,74,114,63,125,122,131),(6,7,75,116,64,127,124,133),(6,7,76,118,65,129,126,136),(6,7,77,119,66,131,128,138),(6,7,78,121,67,133,130,140),(6,7,79,123,68,136,133,143),(6,7,80,125,69,138,135,145),(6,11,1,26,15,22,17,24),(6,11,2,27,16,23,18,25),(6,11,3,27,16,23,19,26),(6,11,4,28,17,24,20,27),(6,11,5,28,17,25,21,29),(6,11,6,29,18,25,22,30),(6,11,7,29,18,26,23,31),(6,11,8,30,19,27,24,32),(6,11,9,30,19,27,26,34),(6,11,10,31,20,28,27,35),(6,11,11,32,20,29,28,36),(6,11,12,32,21,29,29,37),(6,11,13,33,21,30,30,39),(6,11,14,33,22,31,31,40),(6,11,15,34,23,32,32,41),(6,11,16,35,23,32,34,43),(6,11,17,35,24,33,35,44),(6,11,18,36,24,34,36,45),(6,11,19,37,25,35,37,47),(6,11,20,37,26,35,39,48),(6,11,21,38,26,36,40,50),(6,11,22,39,27,37,41,51),(6,11,23,39,28,38,42,52),(6,11,24,40,28,39,44,54),(6,11,25,41,29,39,45,55),(6,11,26,41,30,40,46,57),(6,11,27,42,30,41,47,58),(6,11,28,43,31,42,49,60),(6,11,29,44,32,43,50,61),(6,11,30,44,32,44,52,63),(6,11,31,45,33,44,53,64),(6,11,32,46,34,45,54,66),(6,11,33,47,34,46,56,67),(6,11,34,47,35,47,57,69),(6,11,35,48,36,48,58,71),(6,11,36,49,36,49,60,72),(6,11,37,50,37,50,61,74),(6,11,38,51,38,51,63,76),(6,11,39,52,39,52,64,77),(6,11,40,52,39,53,66,79),(6,11,41,53,40,54,67,81),(6,11,42,54,41,55,69,82),(6,11,43,55,42,56,70,84),(6,11,44,56,43,57,72,86),(6,11,45,57,43,57,73,87),(6,11,46,57,44,58,75,89),(6,11,47,58,45,60,76,91),(6,11,48,59,46,61,78,93),(6,11,49,60,47,62,79,94),(6,11,50,61,47,63,81,96),(6,11,51,62,48,64,83,98),(6,11,52,63,49,65,84,100),(6,11,53,64,50,66,86,102),(6,11,54,65,51,67,87,104),(6,11,55,66,51,68,89,105),(6,11,56,67,52,69,91,107),(6,11,57,68,53,70,92,109),(6,11,58,69,54,71,94,111),(6,11,59,70,55,72,96,113),(6,11,60,71,56,73,97,115),(6,11,61,72,57,74,99,117),(6,11,62,73,58,76,101,119),(6,11,63,74,59,77,103,121),(6,11,64,75,59,78,104,123),(6,11,65,76,60,79,106,125),(6,11,66,77,61,80,108,127),(6,11,67,78,62,81,110,129),(6,11,68,79,63,83,111,131),(6,11,69,80,64,84,113,133),(6,11,70,81,65,85,115,135),(6,11,71,83,66,86,117,137),(6,11,72,84,68,88,120,140),(6,11,73,85,69,89,122,142),(6,11,74,86,70,91,124,145),(6,11,75,88,71,92,126,147),(6,11,76,89,72,94,128,150),(6,11,77,90,73,95,131,153),(6,11,78,92,75,97,133,155),(6,11,79,93,76,98,136,158),(6,11,80,94,77,100,138,185),(7,1,1,18,23,21,24,20),(7,1,2,19,24,22,24,20),(7,1,3,21,25,23,24,21),(7,1,4,22,25,25,24,21),(7,1,5,23,26,26,24,21),(7,1,6,25,27,27,24,21),(7,1,7,26,28,28,24,22),(7,1,8,27,29,29,25,22),(7,1,9,29,29,31,25,22),(7,1,10,30,30,32,25,23),(7,1,11,32,31,33,25,23),(7,1,12,33,32,34,25,23),(7,1,13,34,33,36,25,24),(7,1,14,36,34,37,25,24),(7,1,15,37,35,38,25,24),(7,1,16,39,36,40,25,25),(7,1,17,40,36,41,25,25),(7,1,18,42,37,43,26,25),(7,1,19,43,38,44,26,26),(7,1,20,45,39,45,26,26),(7,1,21,47,40,47,26,26),(7,1,22,48,41,48,26,27),(7,1,23,50,42,50,26,27),(7,1,24,51,43,51,26,28),(7,1,25,53,44,52,27,28),(7,1,26,55,45,54,27,28),(7,1,27,56,46,55,27,29),(7,1,28,58,47,57,27,29),(7,1,29,59,48,58,27,30),(7,1,30,61,49,60,27,30),(7,1,31,63,50,62,27,30),(7,1,32,65,51,63,28,31),(7,1,33,66,52,65,28,31),(7,1,34,68,53,66,28,32),(7,1,35,70,55,68,28,32),(7,1,36,72,56,69,28,33),(7,1,37,73,57,71,29,33),(7,1,38,75,58,73,29,34),(7,1,39,77,59,74,29,34),(7,1,40,79,60,76,29,35),(7,1,41,81,61,78,29,35),(7,1,42,82,62,79,30,35),(7,1,43,84,64,81,30,36),(7,1,44,86,65,83,30,36),(7,1,45,88,66,85,30,37),(7,1,46,90,67,86,30,37),(7,1,47,92,68,88,31,38),(7,1,48,94,70,90,31,38),(7,1,49,96,71,92,31,39),(7,1,50,98,72,93,31,40),(7,1,51,100,73,95,32,40),(7,1,52,102,75,97,32,41),(7,1,53,104,76,99,32,41),(7,1,54,106,77,101,32,42),(7,1,55,108,78,103,33,42),(7,1,56,110,80,104,33,43),(7,1,57,112,81,106,33,43),(7,1,58,114,82,108,33,44),(7,1,59,116,84,110,34,44),(7,1,60,118,85,112,34,45),(7,1,61,120,86,114,34,46),(7,1,62,122,88,116,35,46),(7,1,63,125,89,118,35,47),(7,1,64,127,91,120,35,47),(7,1,65,129,92,122,35,48),(7,1,66,131,93,124,36,49),(7,1,67,133,95,126,36,49),(7,1,68,136,96,128,36,50),(7,1,69,138,98,130,37,50),(7,1,70,140,99,132,37,51),(7,1,71,143,100,134,37,52),(7,1,72,145,102,137,37,53),(7,1,73,148,104,139,37,54),(7,1,74,151,105,142,38,54),(7,1,75,154,107,144,38,55),(7,1,76,157,109,147,38,56),(7,1,77,163,111,153,39,57),(7,1,78,169,112,158,39,57),(7,1,79,172,114,161,39,58),(7,1,80,175,116,164,40,59),(7,4,1,16,26,20,24,20),(7,4,2,17,27,21,24,20),(7,4,3,18,29,21,24,21),(7,4,4,18,30,22,24,21),(7,4,5,19,32,23,25,21),(7,4,6,20,33,24,25,22),(7,4,7,21,35,24,25,22),(7,4,8,22,36,25,25,23),(7,4,9,22,38,26,25,23),(7,4,10,23,39,26,25,23),(7,4,11,24,41,27,25,24),(7,4,12,25,42,28,26,24),(7,4,13,26,44,29,26,25),(7,4,14,27,46,30,26,25),(7,4,15,28,47,30,26,25),(7,4,16,28,49,31,26,26),(7,4,17,29,50,32,27,26),(7,4,18,30,52,33,27,27),(7,4,19,31,54,34,27,27),(7,4,20,32,56,35,27,28),(7,4,21,33,57,35,27,28),(7,4,22,34,59,36,28,29),(7,4,23,35,61,37,28,29),(7,4,24,36,62,38,28,30),(7,4,25,37,64,39,28,30),(7,4,26,38,66,40,29,31),(7,4,27,39,68,41,29,31),(7,4,28,40,70,42,29,32),(7,4,29,41,72,43,29,32),(7,4,30,42,73,43,29,33),(7,4,31,43,75,44,30,33),(7,4,32,44,77,45,30,34),(7,4,33,45,79,46,30,34),(7,4,34,46,81,47,31,35),(7,4,35,47,83,48,31,35),(7,4,36,48,85,49,31,36),(7,4,37,49,87,50,31,36),(7,4,38,50,89,51,32,37),(7,4,39,51,91,52,32,38),(7,4,40,53,93,53,32,38),(7,4,41,54,95,54,33,39),(7,4,42,55,97,55,33,39),(7,4,43,56,99,56,33,40),(7,4,44,57,101,57,33,40),(7,4,45,58,103,59,34,41),(7,4,46,59,105,60,34,42),(7,4,47,61,107,61,34,42),(7,4,48,62,110,62,35,43),(7,4,49,63,112,63,35,44),(7,4,50,64,114,64,35,44),(7,4,51,65,116,65,36,45),(7,4,52,67,118,66,36,45),(7,4,53,68,121,67,36,46),(7,4,54,69,123,69,37,47),(7,4,55,70,125,70,37,47),(7,4,56,72,127,71,37,48),(7,4,57,73,130,72,38,49),(7,4,58,74,132,73,38,49),(7,4,59,75,134,74,39,50),(7,4,60,77,137,76,39,51),(7,4,61,78,139,77,39,51),(7,4,62,79,141,78,40,52),(7,4,63,81,144,79,40,53),(7,4,64,82,146,80,41,54),(7,4,65,83,149,82,41,54),(7,4,66,85,151,83,41,55),(7,4,67,86,154,84,42,56),(7,4,68,87,156,85,42,57),(7,4,69,89,158,87,43,57),(7,4,70,90,161,88,43,58),(7,4,71,92,164,89,44,59),(7,4,72,94,167,91,45,59),(7,4,73,95,170,93,45,60),(7,4,74,97,173,94,46,61),(7,4,75,99,176,96,46,62),(7,4,76,100,179,97,46,63),(7,4,77,102,182,102,47,64),(7,4,78,104,186,105,47,65),(7,4,79,106,189,106,48,66),(7,4,80,108,192,108,48,67),(7,6,1,18,23,21,24,20),(7,6,2,19,24,22,24,20),(7,6,3,21,25,23,24,21),(7,6,4,22,25,25,24,21),(7,6,5,23,26,26,24,21),(7,6,6,25,27,27,24,21),(7,6,7,26,28,28,24,22),(7,6,8,27,29,29,25,22),(7,6,9,29,29,31,25,22),(7,6,10,30,30,32,25,23),(7,6,11,32,31,33,25,23),(7,6,12,33,32,34,25,23),(7,6,13,34,33,36,25,24),(7,6,14,36,34,37,25,24),(7,6,15,37,35,38,25,24),(7,6,16,39,36,40,25,25),(7,6,17,40,36,41,25,25),(7,6,18,42,37,43,26,25),(7,6,19,43,38,44,26,26),(7,6,20,45,39,45,26,26),(7,6,21,47,40,47,26,26),(7,6,22,48,41,48,26,27),(7,6,23,50,42,50,26,27),(7,6,24,51,43,51,26,28),(7,6,25,53,44,52,27,28),(7,6,26,55,45,54,27,28),(7,6,27,56,46,55,27,29),(7,6,28,58,47,57,27,29),(7,6,29,59,48,58,27,30),(7,6,30,61,49,60,27,30),(7,6,31,63,50,62,27,30),(7,6,32,65,51,63,28,31),(7,6,33,66,52,65,28,31),(7,6,34,68,53,66,28,32),(7,6,35,70,55,68,28,32),(7,6,36,72,56,69,28,33),(7,6,37,73,57,71,29,33),(7,6,38,75,58,73,29,34),(7,6,39,77,59,74,29,34),(7,6,40,79,60,76,29,35),(7,6,41,81,61,78,29,35),(7,6,42,82,62,79,30,35),(7,6,43,84,64,81,30,36),(7,6,44,86,65,83,30,36),(7,6,45,88,66,85,30,37),(7,6,46,90,67,86,30,37),(7,6,47,92,68,88,31,38),(7,6,48,94,70,90,31,38),(7,6,49,96,71,92,31,39),(7,6,50,98,72,93,31,40),(7,6,51,99,72,93,32,40),(7,6,52,100,73,95,32,41),(7,6,53,101,74,96,32,41),(7,6,54,102,75,97,32,42),(7,6,55,103,76,98,33,42),(7,6,56,106,78,101,33,43),(7,6,57,111,79,103,33,43),(7,6,58,113,80,105,34,44),(7,6,59,116,82,107,34,44),(7,6,60,118,83,109,34,45),(7,6,61,120,84,111,34,46),(7,6,62,127,86,119,34,46),(7,6,63,129,87,122,35,47),(7,6,64,132,89,125,35,47),(7,6,65,135,90,127,35,48),(7,6,66,137,92,130,35,49),(7,6,67,138,93,130,36,49),(7,6,68,140,95,131,36,50),(7,6,69,142,96,131,36,51),(7,6,70,145,98,132,36,51),(7,6,71,148,100,135,37,52),(7,6,72,150,101,137,37,53),(7,6,73,153,103,140,37,54),(7,6,74,154,105,142,37,54),(7,6,75,155,106,145,38,55),(7,6,76,158,108,151,38,56),(7,6,77,161,110,157,38,57),(7,6,78,164,111,162,38,57),(7,6,79,167,113,165,39,58),(7,6,80,170,115,168,39,59),(7,8,1,15,23,19,27,22),(7,8,2,15,23,19,28,23),(7,8,3,15,23,20,30,25),(7,8,4,15,23,20,31,26),(7,8,5,15,24,20,32,27),(7,8,6,15,24,20,34,29),(7,8,7,16,24,21,35,30),(7,8,8,16,24,21,37,31),(7,8,9,16,24,21,38,33),(7,8,10,16,24,22,40,34),(7,8,11,16,25,22,41,36),(7,8,12,16,25,22,42,37),(7,8,13,16,25,23,44,38),(7,8,14,16,25,23,45,40),(7,8,15,17,25,23,47,41),(7,8,16,17,25,24,49,43),(7,8,17,17,26,24,50,44),(7,8,18,17,26,24,52,46),(7,8,19,17,26,25,53,47),(7,8,20,17,26,25,55,49),(7,8,21,17,26,26,57,51),(7,8,22,18,27,26,58,52),(7,8,23,18,27,26,60,54),(7,8,24,18,27,27,61,55),(7,8,25,18,27,27,63,57),(7,8,26,18,28,27,65,59),(7,8,27,18,28,28,67,60),(7,8,28,18,28,28,68,62),(7,8,29,19,28,29,70,64),(7,8,30,19,29,29,72,65),(7,8,31,19,29,30,74,67),(7,8,32,19,29,30,75,69),(7,8,33,19,29,30,77,70),(7,8,34,20,30,31,79,72),(7,8,35,20,30,31,81,74),(7,8,36,20,30,32,83,76),(7,8,37,20,30,32,85,78),(7,8,38,20,31,33,86,79),(7,8,39,21,31,33,88,81),(7,8,40,21,31,34,90,83),(7,8,41,21,32,34,92,85),(7,8,42,21,32,35,94,87),(7,8,43,21,32,35,96,89),(7,8,44,22,32,36,98,91),(7,8,45,22,33,36,100,92),(7,8,46,22,33,37,102,94),(7,8,47,22,33,37,104,96),(7,8,48,22,34,38,106,98),(7,8,49,23,34,38,108,100),(7,8,50,23,34,39,110,102),(7,8,51,23,35,39,112,104),(7,8,52,23,35,40,114,106),(7,8,53,24,35,40,117,108),(7,8,54,24,36,41,119,110),(7,8,55,24,36,41,121,112),(7,8,56,24,37,42,123,114),(7,8,57,25,37,42,125,117),(7,8,58,25,37,43,127,119),(7,8,59,25,38,43,130,121),(7,8,60,25,38,44,132,123),(7,8,61,26,38,45,134,125),(7,8,62,26,39,45,136,127),(7,8,63,26,39,46,139,129),(7,8,64,26,40,46,141,132),(7,8,65,27,40,47,143,134),(7,8,66,27,40,48,146,136),(7,8,67,27,41,48,148,138),(7,8,68,27,41,49,150,140),(7,8,69,28,42,49,153,143),(7,8,70,28,42,50,155,145),(7,8,71,28,42,51,168,148),(7,8,72,28,43,52,168,151),(7,8,73,28,43,53,171,154),(7,8,74,29,44,53,174,156),(7,8,75,29,44,54,177,159),(7,8,76,29,44,55,180,162),(7,8,77,30,45,56,183,165),(7,8,78,30,45,56,186,168),(7,8,79,30,46,57,190,171),(7,8,80,31,46,58,193,174),(7,9,1,15,23,20,26,22),(7,9,2,15,23,21,27,23),(7,9,3,16,24,21,28,24),(7,9,4,16,24,22,29,25),(7,9,5,16,24,22,31,27),(7,9,6,17,25,23,32,28),(7,9,7,17,25,23,33,29),(7,9,8,17,26,24,34,30),(7,9,9,17,26,25,36,31),(7,9,10,18,26,25,37,33),(7,9,11,18,27,26,38,34),(7,9,12,18,27,26,39,35),(7,9,13,19,28,27,41,36),(7,9,14,19,28,28,42,38),(7,9,15,20,28,28,43,39),(7,9,16,20,29,29,45,40),(7,9,17,20,29,30,46,42),(7,9,18,21,30,30,47,43),(7,9,19,21,30,31,49,44),(7,9,20,21,31,32,50,46),(7,9,21,22,31,32,51,47),(7,9,22,22,31,33,53,49),(7,9,23,23,32,34,54,50),(7,9,24,23,32,34,56,51),(7,9,25,23,33,35,57,53),(7,9,26,24,33,36,59,54),(7,9,27,24,34,37,60,56),(7,9,28,25,34,37,62,57),(7,9,29,25,35,38,63,59),(7,9,30,25,35,39,65,60),(7,9,31,26,36,40,66,62),(7,9,32,26,36,40,68,63),(7,9,33,27,37,41,69,65),(7,9,34,27,38,42,71,66),(7,9,35,28,38,43,73,68),(7,9,36,28,39,43,74,69),(7,9,37,28,39,44,76,71),(7,9,38,29,40,45,77,73),(7,9,39,29,40,46,79,74),(7,9,40,30,41,47,81,76),(7,9,41,30,41,48,82,78),(7,9,42,31,42,48,84,79),(7,9,43,31,43,49,86,81),(7,9,44,32,43,50,88,83),(7,9,45,32,44,51,89,84),(7,9,46,33,44,52,91,86),(7,9,47,33,45,53,93,88),(7,9,48,34,46,54,95,89),(7,9,49,34,46,54,96,91),(7,9,50,35,47,55,98,93),(7,9,51,35,48,56,100,95),(7,9,52,36,48,57,102,97),(7,9,53,36,49,58,104,98),(7,9,54,37,50,59,105,100),(7,9,55,37,50,60,107,102),(7,9,56,38,51,61,109,104),(7,9,57,38,52,62,111,106),(7,9,58,39,52,63,113,108),(7,9,59,40,53,64,115,109),(7,9,60,40,54,65,117,111),(7,9,61,41,54,66,119,113),(7,9,62,41,55,67,121,115),(7,9,63,42,56,68,123,117),(7,9,64,42,57,69,125,119),(7,9,65,43,57,70,127,121),(7,9,66,44,58,71,129,123),(7,9,67,44,59,72,131,125),(7,9,68,45,59,73,133,127),(7,9,69,45,60,74,135,129),(7,9,70,46,61,75,137,131),(7,9,71,47,62,84,147,142),(7,9,72,48,62,85,148,144),(7,9,73,49,63,85,153,147),(7,9,74,49,64,88,153,150),(7,9,75,50,65,90,155,152),(7,9,76,51,66,91,158,155),(7,9,77,52,67,92,161,158),(7,9,78,52,68,93,163,161),(7,9,79,53,69,95,166,164),(7,9,80,54,70,96,170,166),(8,1,1,24,22,23,16,21),(8,1,2,25,23,24,16,21),(8,1,3,27,24,25,16,22),(8,1,4,28,24,26,16,22),(8,1,5,29,25,28,16,22),(8,1,6,31,26,29,16,22),(8,1,7,32,27,30,17,23),(8,1,8,33,28,31,17,23),(8,1,9,35,28,33,17,23),(8,1,10,36,29,34,17,24),(8,1,11,37,30,35,17,24),(8,1,12,39,31,36,17,24),(8,1,13,40,32,38,17,25),(8,1,14,42,33,39,17,25),(8,1,15,43,34,40,18,25),(8,1,16,45,35,42,18,26),(8,1,17,46,35,43,18,26),(8,1,18,48,36,44,18,26),(8,1,19,49,37,46,18,27),(8,1,20,51,38,47,18,27),(8,1,21,52,39,49,18,27),(8,1,22,54,40,50,18,28),(8,1,23,55,41,51,19,28),(8,1,24,57,42,53,19,29),(8,1,25,59,43,54,19,29),(8,1,26,60,44,56,19,29),(8,1,27,62,45,57,19,30),(8,1,28,63,46,59,19,30),(8,1,29,65,47,60,20,31),(8,1,30,67,48,62,20,31),(8,1,31,69,49,63,20,31),(8,1,32,70,50,65,20,32),(8,1,33,72,51,67,20,32),(8,1,34,74,53,68,20,33),(8,1,35,75,54,70,21,33),(8,1,36,77,55,71,21,34),(8,1,37,79,56,73,21,34),(8,1,38,81,57,75,21,35),(8,1,39,83,58,76,21,35),(8,1,40,84,59,78,22,35),(8,1,41,86,60,80,22,36),(8,1,42,88,62,81,22,36),(8,1,43,90,63,83,22,37),(8,1,44,92,64,85,22,37),(8,1,45,94,65,86,23,38),(8,1,46,96,66,88,23,38),(8,1,47,98,67,90,23,39),(8,1,48,100,69,92,23,39),(8,1,49,102,70,93,24,40),(8,1,50,103,71,95,24,40),(8,1,51,105,72,97,24,41),(8,1,52,107,74,99,24,42),(8,1,53,109,75,101,25,42),(8,1,54,112,76,103,25,43),(8,1,55,114,78,104,25,43),(8,1,56,116,79,106,25,44),(8,1,57,118,80,108,25,44),(8,1,58,120,81,110,26,45),(8,1,59,122,83,112,26,45),(8,1,60,124,84,114,26,46),(8,1,61,126,85,116,27,47),(8,1,62,128,87,118,27,47),(8,1,63,130,88,120,27,48),(8,1,64,133,90,122,27,48),(8,1,65,135,91,124,28,49),(8,1,66,137,92,126,28,50),(8,1,67,139,94,128,28,50),(8,1,68,141,95,130,28,51),(8,1,69,144,97,132,29,51),(8,1,70,146,98,134,29,52),(8,1,71,149,99,136,29,53),(8,1,72,151,101,139,29,54),(8,1,73,154,103,141,29,55),(8,1,74,157,104,144,30,55),(8,1,75,166,106,151,30,56),(8,1,76,172,108,157,30,57),(8,1,77,175,110,161,31,58),(8,1,78,179,111,163,31,58),(8,1,79,182,113,164,31,59),(8,1,80,185,115,169,32,60),(8,3,1,21,25,22,16,22),(8,3,2,21,26,23,17,23),(8,3,3,22,28,24,17,23),(8,3,4,22,29,25,18,24),(8,3,5,23,30,26,18,25),(8,3,6,23,32,27,19,25),(8,3,7,24,33,28,20,26),(8,3,8,24,35,28,20,26),(8,3,9,25,36,29,21,27),(8,3,10,25,38,30,21,28),(8,3,11,25,39,31,22,29),(8,3,12,26,41,32,23,29),(8,3,13,26,42,33,23,30),(8,3,14,27,44,34,24,31),(8,3,15,27,45,35,25,31),(8,3,16,28,47,36,25,32),(8,3,17,28,48,38,26,33),(8,3,18,29,50,39,27,34),(8,3,19,29,51,40,28,34),(8,3,20,30,53,41,28,35),(8,3,21,31,55,42,29,36),(8,3,22,31,56,43,30,37),(8,3,23,32,58,44,30,37),(8,3,24,32,60,45,31,38),(8,3,25,33,61,46,32,39),(8,3,26,33,63,48,33,40),(8,3,27,34,65,49,33,41),(8,3,28,35,66,50,34,41),(8,3,29,35,68,51,35,42),(8,3,30,36,70,52,36,43),(8,3,31,36,72,53,37,44),(8,3,32,37,73,55,37,45),(8,3,33,38,75,56,38,46),(8,3,34,38,77,57,39,47),(8,3,35,39,79,58,40,48),(8,3,36,39,81,60,41,48),(8,3,37,40,83,61,41,49),(8,3,38,41,85,62,42,50),(8,3,39,41,86,63,43,51),(8,3,40,42,88,65,44,52),(8,3,41,43,90,66,45,53),(8,3,42,43,92,67,46,54),(8,3,43,44,94,69,47,55),(8,3,44,45,96,70,47,56),(8,3,45,45,98,71,48,57),(8,3,46,46,100,73,49,58),(8,3,47,47,102,74,50,59),(8,3,48,48,104,76,51,60),(8,3,49,48,106,77,52,61),(8,3,50,49,108,78,53,62),(8,3,51,50,110,80,54,63),(8,3,52,51,113,81,55,64),(8,3,53,51,115,83,56,65),(8,3,54,52,117,84,57,66),(8,3,55,53,119,86,58,67),(8,3,56,54,121,87,59,68),(8,3,57,54,123,89,60,69),(8,3,58,55,126,90,61,70),(8,3,59,56,128,92,62,71),(8,3,60,57,130,93,63,73),(8,3,61,58,132,95,64,74),(8,3,62,58,134,96,65,75),(8,3,63,59,137,98,66,76),(8,3,64,60,139,99,67,77),(8,3,65,61,141,101,68,78),(8,3,66,62,144,103,69,79),(8,3,67,62,146,104,70,80),(8,3,68,63,148,106,71,82),(8,3,69,64,151,107,72,83),(8,3,70,65,153,109,73,84),(8,3,71,66,156,111,74,85),(8,3,72,67,159,113,75,86),(8,3,73,68,162,115,76,88),(8,3,74,69,165,117,78,89),(8,3,75,70,174,119,82,91),(8,3,76,71,177,121,83,92),(8,3,77,72,180,123,85,94),(8,3,78,73,184,125,86,95),(8,3,79,74,187,127,87,97),(8,3,80,75,190,129,89,98),(8,4,1,22,25,22,16,21),(8,4,2,23,26,23,16,21),(8,4,3,24,28,23,16,22),(8,4,4,24,29,24,16,22),(8,4,5,25,31,25,17,22),(8,4,6,26,32,25,17,23),(8,4,7,27,34,26,17,23),(8,4,8,27,35,27,17,24),(8,4,9,28,37,28,17,24),(8,4,10,29,38,28,18,24),(8,4,11,30,40,29,18,25),(8,4,12,31,41,30,18,25),(8,4,13,32,43,31,18,26),(8,4,14,32,45,32,18,26),(8,4,15,33,46,32,19,26),(8,4,16,34,48,33,19,27),(8,4,17,35,50,34,19,27),(8,4,18,36,51,35,19,28),(8,4,19,37,53,36,19,28),(8,4,20,38,55,36,20,29),(8,4,21,39,56,37,20,29),(8,4,22,40,58,38,20,30),(8,4,23,41,60,39,20,30),(8,4,24,42,62,40,20,31),(8,4,25,43,63,41,21,31),(8,4,26,44,65,42,21,32),(8,4,27,45,67,43,21,32),(8,4,28,46,69,44,21,33),(8,4,29,47,71,44,22,33),(8,4,30,48,72,45,22,34),(8,4,31,49,74,46,22,34),(8,4,32,50,76,47,22,35),(8,4,33,51,78,48,23,35),(8,4,34,52,80,49,23,36),(8,4,35,53,82,50,23,36),(8,4,36,54,84,51,24,37),(8,4,37,55,86,52,24,37),(8,4,38,56,88,53,24,38),(8,4,39,57,90,54,24,38),(8,4,40,58,92,55,25,39),(8,4,41,59,94,56,25,40),(8,4,42,60,96,57,25,40),(8,4,43,62,98,58,26,41),(8,4,44,63,100,59,26,41),(8,4,45,64,102,60,26,42),(8,4,46,65,104,61,27,43),(8,4,47,66,107,63,27,43),(8,4,48,67,109,64,27,44),(8,4,49,69,111,65,27,44),(8,4,50,70,113,66,28,45),(8,4,51,71,115,67,28,46),(8,4,52,72,117,68,28,46),(8,4,53,74,120,69,29,47),(8,4,54,75,122,70,29,48),(8,4,55,76,124,72,29,48),(8,4,56,77,126,73,30,49),(8,4,57,79,129,74,30,50),(8,4,58,80,131,75,30,50),(8,4,59,81,133,76,31,51),(8,4,60,82,136,77,31,52),(8,4,61,84,138,79,32,52),(8,4,62,85,140,80,32,53),(8,4,63,86,143,81,32,54),(8,4,64,88,145,82,33,55),(8,4,65,89,148,84,33,55),(8,4,66,90,150,85,33,56),(8,4,67,92,153,86,34,57),(8,4,68,93,155,87,34,58),(8,4,69,95,157,89,35,58),(8,4,70,96,160,90,35,59),(8,4,71,98,163,94,35,60),(8,4,72,100,166,96,36,60),(8,4,73,101,169,96,36,61),(8,4,74,103,172,97,37,62),(8,4,75,105,175,98,37,63),(8,4,76,106,178,99,37,64),(8,4,77,108,181,105,38,65),(8,4,78,110,185,107,38,66),(8,4,79,112,188,109,39,67),(8,4,80,114,191,110,39,68),(8,5,1,21,22,21,18,24),(8,5,2,21,22,21,19,25),(8,5,3,21,22,22,21,27),(8,5,4,21,23,22,22,28),(8,5,5,22,23,22,23,29),(8,5,6,22,23,23,25,31),(8,5,7,22,23,23,26,32),(8,5,8,22,24,24,27,34),(8,5,9,22,24,24,29,35),(8,5,10,22,24,24,30,37),(8,5,11,23,24,25,32,38),(8,5,12,23,24,25,33,40),(8,5,13,23,25,26,35,41),(8,5,14,23,25,26,36,43),(8,5,15,23,25,26,38,44),(8,5,16,24,26,27,39,46),(8,5,17,24,26,27,41,47),(8,5,18,24,26,28,42,49),(8,5,19,24,26,28,44,50),(8,5,20,24,27,29,45,52),(8,5,21,25,27,29,47,54),(8,5,22,25,27,30,48,55),(8,5,23,25,28,30,50,57),(8,5,24,25,28,31,52,59),(8,5,25,25,28,31,53,60),(8,5,26,26,28,32,55,62),(8,5,27,26,29,32,56,64),(8,5,28,26,29,33,58,65),(8,5,29,26,29,33,60,67),(8,5,30,27,30,34,62,69),(8,5,31,27,30,34,63,71),(8,5,32,27,30,35,65,73),(8,5,33,27,31,35,67,74),(8,5,34,28,31,36,68,76),(8,5,35,28,32,36,70,78),(8,5,36,28,32,37,72,80),(8,5,37,29,32,37,74,82),(8,5,38,29,33,38,76,84),(8,5,39,29,33,38,77,86),(8,5,40,29,33,39,79,87),(8,5,41,30,34,40,81,89),(8,5,42,30,34,40,83,91),(8,5,43,30,35,41,85,93),(8,5,44,31,35,41,87,95),(8,5,45,31,35,42,89,97),(8,5,46,31,36,43,91,99),(8,5,47,32,36,43,93,101),(8,5,48,32,37,44,94,103),(8,5,49,32,37,44,96,105),(8,5,50,33,37,45,98,107),(8,5,51,33,38,46,100,110),(8,5,52,33,38,46,102,112),(8,5,53,34,39,47,104,114),(8,5,54,34,39,48,106,116),(8,5,55,34,40,48,109,118),(8,5,56,35,40,49,111,120),(8,5,57,35,41,50,113,122),(8,5,58,35,41,50,115,125),(8,5,59,36,42,51,117,127),(8,5,60,36,42,52,119,129),(8,5,61,36,42,52,121,131),(8,5,62,37,43,53,123,133),(8,5,63,37,43,54,125,136),(8,5,64,38,44,55,128,138),(8,5,65,38,44,55,130,140),(8,5,66,38,45,56,132,143),(8,5,67,39,45,57,134,145),(8,5,68,39,46,58,136,147),(8,5,69,40,46,58,139,150),(8,5,70,40,47,59,141,152),(8,5,71,40,48,60,144,155),(8,5,72,41,48,60,147,158),(8,5,73,41,49,61,150,161),(8,5,74,42,49,62,152,164),(8,5,75,42,50,63,155,167),(8,5,76,42,51,64,158,170),(8,5,77,43,51,65,161,173),(8,5,78,43,52,66,164,176),(8,5,79,44,52,67,167,179),(8,5,80,44,53,68,170,182),(8,6,1,24,22,23,16,21),(8,6,2,25,23,24,16,21),(8,6,3,27,24,25,16,22),(8,6,4,28,24,26,16,22),(8,6,5,29,25,28,16,22),(8,6,6,31,26,29,16,22),(8,6,7,32,27,30,17,23),(8,6,8,33,28,31,17,23),(8,6,9,35,28,33,17,23),(8,6,10,36,29,34,17,24),(8,6,11,37,30,35,17,24),(8,6,12,39,31,36,17,24),(8,6,13,40,32,38,17,25),(8,6,14,42,33,39,17,25),(8,6,15,43,34,40,18,25),(8,6,16,45,35,42,18,26),(8,6,17,46,35,43,18,26),(8,6,18,48,36,44,18,26),(8,6,19,49,37,46,18,27),(8,6,20,51,38,47,18,27),(8,6,21,52,39,49,18,27),(8,6,22,54,40,50,18,28),(8,6,23,55,41,51,19,28),(8,6,24,57,42,53,19,29),(8,6,25,59,43,54,19,29),(8,6,26,60,44,56,19,29),(8,6,27,62,45,57,19,30),(8,6,28,63,46,59,19,30),(8,6,29,65,47,60,20,31),(8,6,30,67,48,62,20,31),(8,6,31,69,49,63,20,31),(8,6,32,70,50,65,20,32),(8,6,33,72,51,67,20,32),(8,6,34,74,53,68,20,33),(8,6,35,75,54,70,21,33),(8,6,36,77,55,71,21,34),(8,6,37,79,56,73,21,34),(8,6,38,81,57,75,21,35),(8,6,39,83,58,76,21,35),(8,6,40,84,59,78,22,35),(8,6,41,86,60,80,22,36),(8,6,42,88,62,81,22,36),(8,6,43,90,63,83,22,37),(8,6,44,92,64,85,22,37),(8,6,45,94,65,86,23,38),(8,6,46,96,66,88,23,38),(8,6,47,98,67,90,23,39),(8,6,48,100,69,92,23,39),(8,6,49,102,70,93,24,40),(8,6,50,103,71,95,24,40),(8,6,51,105,72,96,24,41),(8,6,52,106,74,97,24,42),(8,6,53,107,73,98,25,42),(8,6,54,108,74,99,25,43),(8,6,55,109,75,100,25,43),(8,6,56,112,77,103,25,44),(8,6,57,114,78,105,25,44),(8,6,58,118,79,107,26,45),(8,6,59,119,81,109,26,45),(8,6,60,121,82,111,26,46),(8,6,61,123,83,113,26,47),(8,6,62,126,85,115,26,47),(8,6,63,128,86,118,27,48),(8,6,64,131,88,120,27,48),(8,6,65,138,89,122,27,49),(8,6,66,140,91,125,27,50),(8,6,67,143,92,127,28,50),(8,6,68,145,94,129,28,51),(8,6,69,148,95,132,28,52),(8,6,70,151,97,134,28,52),(8,6,71,154,99,137,29,53),(8,6,72,156,100,139,29,54),(8,6,73,159,102,142,29,55),(8,6,74,162,104,144,29,55),(8,6,75,165,105,147,30,56),(8,6,76,168,107,150,30,57),(8,6,77,169,109,153,30,58),(8,6,78,170,110,155,30,58),(8,6,79,178,112,158,31,59),(8,6,80,181,114,161,31,60),(8,7,1,22,22,22,17,23),(8,7,2,23,22,23,18,24),(8,7,3,24,23,24,19,25),(8,7,4,25,23,25,20,26),(8,7,5,25,24,26,21,27),(8,7,6,26,24,27,22,28),(8,7,7,27,25,28,23,29),(8,7,8,28,25,29,24,30),(8,7,9,29,25,30,25,31),(8,7,10,30,26,31,26,33),(8,7,11,31,26,32,27,34),(8,7,12,32,27,33,28,35),(8,7,13,33,27,34,29,36),(8,7,14,34,28,35,30,37),(8,7,15,34,28,36,31,38),(8,7,16,35,29,38,32,39),(8,7,17,36,29,39,33,41),(8,7,18,37,30,40,34,42),(8,7,19,38,30,41,35,43),(8,7,20,39,31,42,36,44),(8,7,21,40,32,43,37,45),(8,7,22,41,32,45,38,47),(8,7,23,43,33,46,39,48),(8,7,24,44,33,47,40,49),(8,7,25,45,34,48,42,51),(8,7,26,46,34,49,43,52),(8,7,27,47,35,51,44,53),(8,7,28,48,35,52,45,54),(8,7,29,49,36,53,46,56),(8,7,30,50,37,54,48,57),(8,7,31,51,37,56,49,59),(8,7,32,52,38,57,50,60),(8,7,33,53,38,58,51,61),(8,7,34,55,39,60,52,63),(8,7,35,56,40,61,54,64),(8,7,36,57,40,62,55,66),(8,7,37,58,41,64,56,67),(8,7,38,59,42,65,57,68),(8,7,39,61,42,66,59,70),(8,7,40,62,43,68,60,71),(8,7,41,63,44,69,61,73),(8,7,42,64,44,71,63,74),(8,7,43,65,45,72,64,76),(8,7,44,67,46,74,65,77),(8,7,45,68,46,75,67,79),(8,7,46,69,47,76,68,80),(8,7,47,71,48,78,69,82),(8,7,48,72,49,79,71,83),(8,7,49,73,49,81,72,85),(8,7,50,74,50,82,74,87),(8,7,51,76,51,84,75,88),(8,7,52,77,51,85,77,90),(8,7,53,78,52,87,78,92),(8,7,54,80,53,89,79,93),(8,7,55,81,54,90,81,95),(8,7,56,83,55,92,82,96),(8,7,57,84,55,93,84,98),(8,7,58,85,56,95,85,100),(8,7,59,87,57,97,87,102),(8,7,60,88,58,98,88,103),(8,7,61,90,58,100,90,105),(8,7,62,91,59,101,91,107),(8,7,63,93,60,103,93,108),(8,7,64,94,61,105,94,110),(8,7,65,95,62,106,96,112),(8,7,66,97,63,108,98,114),(8,7,67,98,63,110,99,116),(8,7,68,100,64,112,101,117),(8,7,69,101,65,113,102,119),(8,7,70,103,66,115,104,121),(8,7,71,104,67,117,116,123),(8,7,72,106,68,119,118,126),(8,7,73,108,69,121,121,128),(8,7,74,110,70,124,123,130),(8,7,75,112,71,126,125,132),(8,7,76,114,72,128,127,135),(8,7,77,115,73,130,129,137),(8,7,78,117,74,132,132,139),(8,7,79,119,75,135,134,142),(8,7,80,121,76,137,136,144),(8,8,1,21,22,21,19,23),(8,8,2,21,22,21,20,24),(8,8,3,21,22,22,22,26),(8,8,4,21,22,22,23,27),(8,8,5,21,23,22,25,28),(8,8,6,21,23,22,26,30),(8,8,7,21,23,23,27,31),(8,8,8,22,23,23,29,32),(8,8,9,22,23,23,30,34),(8,8,10,22,23,24,32,35),(8,8,11,22,24,24,33,37),(8,8,12,22,24,24,35,38),(8,8,13,22,24,25,36,39),(8,8,14,22,24,25,38,41),(8,8,15,22,24,25,39,42),(8,8,16,22,24,26,41,44),(8,8,17,23,25,26,42,45),(8,8,18,23,25,26,44,47),(8,8,19,23,25,27,46,48),(8,8,20,23,25,27,47,50),(8,8,21,23,25,27,49,51),(8,8,22,23,26,28,51,53),(8,8,23,23,26,28,52,55),(8,8,24,24,26,29,54,56),(8,8,25,24,26,29,56,58),(8,8,26,24,27,29,57,60),(8,8,27,24,27,30,59,61),(8,8,28,24,27,30,61,63),(8,8,29,24,27,31,63,65),(8,8,30,24,28,31,64,66),(8,8,31,25,28,31,66,68),(8,8,32,25,28,32,68,70),(8,8,33,25,28,32,70,71),(8,8,34,25,29,33,71,73),(8,8,35,25,29,33,73,75),(8,8,36,26,29,34,75,77),(8,8,37,26,29,34,77,79),(8,8,38,26,30,35,79,80),(8,8,39,26,30,35,81,82),(8,8,40,26,30,35,83,84),(8,8,41,27,31,36,85,86),(8,8,42,27,31,36,87,88),(8,8,43,27,31,37,89,90),(8,8,44,27,32,37,91,91),(8,8,45,27,32,38,93,93),(8,8,46,28,32,38,95,95),(8,8,47,28,32,39,97,97),(8,8,48,28,33,39,99,99),(8,8,49,28,33,40,101,101),(8,8,50,29,33,40,103,103),(8,8,51,29,34,41,105,105),(8,8,52,29,34,42,107,107),(8,8,53,29,35,42,109,109),(8,8,54,30,35,43,111,111),(8,8,55,30,35,43,113,113),(8,8,56,30,36,44,115,115),(8,8,57,30,36,44,118,118),(8,8,58,31,36,45,120,120),(8,8,59,31,37,45,122,122),(8,8,60,31,37,46,124,124),(8,8,61,31,37,47,126,126),(8,8,62,32,38,47,129,128),(8,8,63,32,38,48,131,130),(8,8,64,32,39,48,133,133),(8,8,65,33,39,49,135,135),(8,8,66,33,39,50,138,137),(8,8,67,33,40,50,140,139),(8,8,68,33,40,51,142,141),(8,8,69,34,41,51,145,144),(8,8,70,34,41,52,147,146),(8,8,71,34,41,53,150,149),(8,8,72,34,42,54,153,152),(8,8,73,34,42,55,156,155),(8,8,74,35,43,55,159,157),(8,8,75,35,43,56,162,160),(8,8,76,35,43,57,168,163),(8,8,77,36,44,58,168,166),(8,8,78,36,44,58,171,169),(8,8,79,36,45,59,177,172),(8,8,80,37,45,60,177,175),(10,2,1,19,22,21,24,20),(10,2,2,20,23,22,25,21),(10,2,3,21,23,23,25,21),(10,2,4,22,24,24,26,22),(10,2,5,23,24,25,27,23),(10,2,6,25,25,26,27,24),(10,2,7,26,25,27,28,24),(10,2,8,27,26,28,29,25),(10,2,9,28,27,29,29,26),(10,2,10,29,27,31,30,26),(10,2,11,30,28,32,31,27),(10,2,12,32,29,33,31,28),(10,2,13,33,29,34,32,29),(10,2,14,34,30,35,33,30),(10,2,15,35,31,36,33,30),(10,2,16,37,31,37,34,31),(10,2,17,38,32,39,35,32),(10,2,18,39,33,40,36,33),(10,2,19,40,33,41,36,34),(10,2,20,42,34,42,37,35),(10,2,21,43,35,44,38,35),(10,2,22,44,35,45,39,36),(10,2,23,46,36,46,40,37),(10,2,24,47,37,47,40,38),(10,2,25,49,38,49,41,39),(10,2,26,50,38,50,42,40),(10,2,27,51,39,51,43,41),(10,2,28,53,40,53,44,42),(10,2,29,54,41,54,45,43),(10,2,30,56,41,55,45,43),(10,2,31,57,42,57,46,44),(10,2,32,58,43,58,47,45),(10,2,33,60,44,59,48,46),(10,2,34,61,45,61,49,47),(10,2,35,63,45,62,50,48),(10,2,36,64,46,64,51,49),(10,2,37,66,47,65,52,50),(10,2,38,67,48,67,53,51),(10,2,39,69,49,68,54,52),(10,2,40,71,50,69,55,53),(10,2,41,72,50,71,55,54),(10,2,42,74,51,72,56,55),(10,2,43,75,52,74,57,56),(10,2,44,77,53,75,58,57),(10,2,45,79,54,77,59,59),(10,2,46,80,55,78,60,60),(10,2,47,82,56,80,61,61),(10,2,48,83,57,82,62,62),(10,2,49,85,58,83,63,63),(10,2,50,87,59,85,64,64),(10,2,51,89,60,86,66,65),(10,2,52,90,61,88,67,66),(10,2,53,92,61,90,68,67),(10,2,54,94,62,91,69,69),(10,2,55,95,63,93,70,70),(10,2,56,97,64,95,71,71),(10,2,57,99,65,96,72,72),(10,2,58,101,66,98,73,73),(10,2,59,102,67,100,74,74),(10,2,60,104,68,101,75,76),(10,2,61,106,69,103,76,77),(10,2,62,108,70,105,78,78),(10,2,63,110,72,106,79,79),(10,2,64,112,73,108,80,80),(10,2,65,113,74,110,81,82),(10,2,66,115,75,112,82,83),(10,2,67,117,76,114,83,84),(10,2,68,119,77,115,85,85),(10,2,69,121,78,117,86,87),(10,2,70,123,79,119,87,88),(10,2,71,125,80,120,88,89),(10,2,72,128,81,123,90,91),(10,2,73,130,82,125,91,93),(10,2,74,133,84,127,93,94),(10,2,75,135,85,129,94,96),(10,2,76,137,86,132,96,97),(10,2,77,140,88,134,97,99),(10,2,78,143,89,136,99,101),(10,2,79,145,90,139,100,102),(10,2,80,148,92,141,102,104),(10,3,1,17,25,20,24,20),(10,3,2,17,26,21,25,21),(10,3,3,18,28,22,25,21),(10,3,4,18,29,23,26,22),(10,3,5,19,30,24,26,23),(10,3,6,19,32,25,27,23),(10,3,7,20,33,26,27,24),(10,3,8,20,35,27,28,25),(10,3,9,21,36,27,29,25),(10,3,10,21,38,28,29,26),(10,3,11,22,39,29,30,27),(10,3,12,22,41,30,31,27),(10,3,13,23,42,31,31,28),(10,3,14,23,44,32,32,29),(10,3,15,24,45,34,32,29),(10,3,16,24,47,35,33,30),(10,3,17,25,48,36,34,31),(10,3,18,25,50,37,34,32),(10,3,19,26,51,38,35,32),(10,3,20,26,53,39,36,33),(10,3,21,27,55,40,37,34),(10,3,22,27,56,41,37,35),(10,3,23,28,58,42,38,36),(10,3,24,28,60,43,39,36),(10,3,25,29,61,44,39,37),(10,3,26,30,63,46,40,38),(10,3,27,30,65,47,41,39),(10,3,28,31,66,48,42,40),(10,3,29,31,68,49,42,40),(10,3,30,32,70,50,43,41),(10,3,31,33,72,52,44,42),(10,3,32,33,73,53,45,43),(10,3,33,34,75,54,46,44),(10,3,34,34,77,55,46,45),(10,3,35,35,79,57,47,46),(10,3,36,36,81,58,48,47),(10,3,37,36,83,59,49,47),(10,3,38,37,85,60,50,48),(10,3,39,38,86,62,51,49),(10,3,40,38,88,63,51,50),(10,3,41,39,90,64,52,51),(10,3,42,40,92,66,53,52),(10,3,43,40,94,67,54,53),(10,3,44,41,96,68,55,54),(10,3,45,42,98,70,56,55),(10,3,46,42,100,71,57,56),(10,3,47,43,102,72,58,57),(10,3,48,44,104,74,59,58),(10,3,49,45,106,75,60,59),(10,3,50,45,108,77,61,60),(10,3,51,46,110,78,61,61),(10,3,52,47,113,79,62,62),(10,3,53,47,115,81,63,63),(10,3,54,48,117,82,64,64),(10,3,55,49,119,84,65,65),(10,3,56,50,121,85,66,66),(10,3,57,50,123,87,67,67),(10,3,58,51,126,88,68,68),(10,3,59,52,128,90,69,70),(10,3,60,53,130,91,70,71),(10,3,61,54,132,93,71,72),(10,3,62,54,134,94,72,73),(10,3,63,55,137,96,73,74),(10,3,64,56,139,97,75,75),(10,3,65,57,141,99,76,76),(10,3,66,58,144,101,77,77),(10,3,67,58,146,102,78,78),(10,3,68,59,148,104,79,80),(10,3,69,60,151,105,80,81),(10,3,70,61,153,107,81,82),(10,3,71,62,156,108,82,83),(10,3,72,63,159,110,83,84),(10,3,73,64,162,112,84,86),(10,3,74,65,165,114,86,87),(10,3,75,66,168,116,87,89),(10,3,76,67,171,118,89,90),(10,3,77,68,174,120,90,92),(10,3,78,69,177,122,91,93),(10,3,79,70,180,124,92,95),(10,3,80,71,183,126,94,96),(10,4,1,18,25,20,24,19),(10,4,2,19,26,21,24,19),(10,4,3,20,28,21,24,20),(10,4,4,20,29,22,24,20),(10,4,5,21,31,23,25,20),(10,4,6,22,32,24,25,21),(10,4,7,23,34,24,25,21),(10,4,8,24,35,25,25,22),(10,4,9,24,37,26,25,22),(10,4,10,25,38,26,25,22),(10,4,11,26,40,27,25,23),(10,4,12,27,41,28,26,23),(10,4,13,28,43,29,26,24),(10,4,14,29,45,30,26,24),(10,4,15,29,46,30,26,25),(10,4,16,30,48,31,26,25),(10,4,17,31,50,32,27,25),(10,4,18,32,51,33,27,26),(10,4,19,33,53,34,27,26),(10,4,20,34,55,35,27,27),(10,4,21,35,56,35,27,27),(10,4,22,36,58,36,28,28),(10,4,23,37,60,37,28,28),(10,4,24,38,62,38,28,29),(10,4,25,39,63,39,28,29),(10,4,26,40,65,40,29,30),(10,4,27,41,67,41,29,30),(10,4,28,42,69,42,29,31),(10,4,29,43,71,43,29,31),(10,4,30,44,72,43,29,32),(10,4,31,45,74,44,30,32),(10,4,32,46,76,45,30,33),(10,4,33,47,78,46,30,33),(10,4,34,48,80,47,31,34),(10,4,35,49,82,48,31,34),(10,4,36,50,84,49,31,35),(10,4,37,51,86,50,31,35),(10,4,38,52,88,51,32,36),(10,4,39,53,90,52,32,37),(10,4,40,54,92,53,32,37),(10,4,41,56,94,54,33,38),(10,4,42,57,96,55,33,38),(10,4,43,58,98,56,33,39),(10,4,44,59,100,57,33,39),(10,4,45,60,102,59,34,40),(10,4,46,61,104,60,34,41),(10,4,47,62,107,61,34,41),(10,4,48,64,109,62,35,42),(10,4,49,65,111,63,35,43),(10,4,50,66,113,64,35,43),(10,4,51,67,115,65,36,44),(10,4,52,68,117,66,36,44),(10,4,53,70,120,67,36,45),(10,4,54,71,122,69,37,46),(10,4,55,72,124,70,37,46),(10,4,56,73,126,71,37,47),(10,4,57,75,129,72,38,48),(10,4,58,76,131,73,38,48),(10,4,59,77,133,74,39,49),(10,4,60,79,136,76,39,50),(10,4,61,80,138,77,39,51),(10,4,62,81,140,78,40,51),(10,4,63,82,143,79,40,52),(10,4,64,84,145,80,41,53),(10,4,65,85,148,82,41,53),(10,4,66,87,150,83,41,54),(10,4,67,88,153,84,42,55),(10,4,68,89,155,85,42,56),(10,4,69,91,157,87,43,56),(10,4,70,92,160,88,43,57),(10,4,71,94,163,88,43,58),(10,4,72,96,166,90,44,58),(10,4,73,97,169,92,44,59),(10,4,74,99,172,93,45,60),(10,4,75,101,175,95,45,61),(10,4,76,102,178,96,45,62),(10,4,77,104,181,101,46,63),(10,4,78,106,185,104,46,64),(10,4,79,108,188,105,47,65),(10,4,80,110,191,107,47,66),(10,5,1,17,22,19,26,22),(10,5,2,17,22,19,27,23),(10,5,3,17,22,20,29,25),(10,5,4,17,23,20,30,26),(10,5,5,18,23,20,31,27),(10,5,6,18,23,21,33,29),(10,5,7,18,23,21,34,30),(10,5,8,18,24,22,35,32),(10,5,9,18,24,22,37,33),(10,5,10,19,24,22,38,35),(10,5,11,19,24,23,39,36),(10,5,12,19,24,23,41,38),(10,5,13,19,25,24,42,39),(10,5,14,19,25,24,44,41),(10,5,15,19,25,25,45,42),(10,5,16,20,26,25,47,44),(10,5,17,20,26,25,48,45),(10,5,18,20,26,26,50,47),(10,5,19,20,26,26,51,49),(10,5,20,21,27,27,53,50),(10,5,21,21,27,27,54,52),(10,5,22,21,27,28,56,53),(10,5,23,21,28,28,58,55),(10,5,24,21,28,29,59,57),(10,5,25,22,28,29,61,58),(10,5,26,22,28,30,62,60),(10,5,27,22,29,30,64,62),(10,5,28,22,29,31,66,64),(10,5,29,23,29,31,67,65),(10,5,30,23,30,32,69,67),(10,5,31,23,30,32,71,69),(10,5,32,23,30,33,72,71),(10,5,33,24,31,33,74,72),(10,5,34,24,31,34,76,74),(10,5,35,24,32,34,78,76),(10,5,36,24,32,35,80,78),(10,5,37,25,32,35,81,80),(10,5,38,25,33,36,83,82),(10,5,39,25,33,37,85,84),(10,5,40,26,33,37,87,86),(10,5,41,26,34,38,89,88),(10,5,42,26,34,38,91,89),(10,5,43,27,35,39,92,91),(10,5,44,27,35,39,94,93),(10,5,45,27,35,40,96,95),(10,5,46,27,36,41,98,97),(10,5,47,28,36,41,100,99),(10,5,48,28,37,42,102,101),(10,5,49,28,37,43,104,103),(10,5,50,29,37,43,106,106),(10,5,51,29,38,44,108,108),(10,5,52,29,38,44,110,110),(10,5,53,30,39,45,112,112),(10,5,54,30,39,46,114,114),(10,5,55,30,40,46,116,116),(10,5,56,31,40,47,118,118),(10,5,57,31,41,48,120,120),(10,5,58,31,41,48,123,123),(10,5,59,32,42,49,125,125),(10,5,60,32,42,50,127,127),(10,5,61,33,42,51,129,129),(10,5,62,33,43,51,131,131),(10,5,63,33,43,52,133,134),(10,5,64,34,44,53,135,136),(10,5,65,34,44,53,138,138),(10,5,66,34,45,54,140,141),(10,5,67,35,45,55,142,143),(10,5,68,35,46,56,144,145),(10,5,69,36,46,56,147,148),(10,5,70,36,47,57,149,150),(10,5,71,36,48,57,152,153),(10,5,72,37,48,57,155,156),(10,5,73,37,49,58,158,159),(10,5,74,38,49,59,160,163),(10,5,75,38,50,60,163,165),(10,5,76,38,51,61,166,170),(10,5,77,39,51,62,168,175),(10,5,78,39,52,63,172,174),(10,5,79,40,52,64,175,177),(10,5,80,40,53,65,178,180),(10,6,1,18,23,21,24,20),(10,6,2,19,24,22,24,20),(10,6,3,21,25,23,24,21),(10,6,4,22,25,25,24,21),(10,6,5,23,26,26,24,21),(10,6,6,25,27,27,24,21),(10,6,7,26,28,28,24,22),(10,6,8,27,29,29,25,22),(10,6,9,29,29,31,25,22),(10,6,10,30,30,32,25,23),(10,6,11,32,31,33,25,23),(10,6,12,33,32,34,25,23),(10,6,13,34,33,36,25,24),(10,6,14,36,34,37,25,24),(10,6,15,37,35,38,25,24),(10,6,16,39,36,40,25,25),(10,6,17,40,36,41,25,25),(10,6,18,42,37,43,26,25),(10,6,19,43,38,44,26,26),(10,6,20,45,39,45,26,26),(10,6,21,47,40,47,26,26),(10,6,22,48,41,48,26,27),(10,6,23,50,42,50,26,27),(10,6,24,51,43,51,26,28),(10,6,25,53,44,52,27,28),(10,6,26,55,45,54,27,28),(10,6,27,56,46,55,27,29),(10,6,28,58,47,57,27,29),(10,6,29,59,48,58,27,30),(10,6,30,61,49,60,27,30),(10,6,31,63,50,62,27,30),(10,6,32,65,51,63,28,31),(10,6,33,66,52,65,28,31),(10,6,34,68,53,66,28,32),(10,6,35,70,55,68,28,32),(10,6,36,72,56,69,28,33),(10,6,37,73,57,71,29,33),(10,6,38,75,58,73,29,34),(10,6,39,77,59,74,29,34),(10,6,40,79,60,76,29,35),(10,6,41,81,61,78,29,35),(10,6,42,82,62,79,30,35),(10,6,43,84,64,81,30,36),(10,6,44,86,65,83,30,36),(10,6,45,88,66,85,30,37),(10,6,46,90,67,86,30,37),(10,6,47,92,68,88,31,38),(10,6,48,94,69,90,31,38),(10,6,49,96,69,92,31,39),(10,6,50,98,70,93,31,40),(10,6,51,100,71,95,32,40),(10,6,52,102,72,96,32,41),(10,6,53,103,73,97,32,41),(10,6,54,104,74,98,32,41),(10,6,55,105,75,97,33,41),(10,6,56,108,77,100,33,42),(10,6,57,113,78,102,33,42),(10,6,58,115,79,104,34,43),(10,6,59,117,81,106,34,43),(10,6,60,118,82,108,34,44),(10,6,61,119,83,110,34,45),(10,6,62,121,85,112,34,45),(10,6,63,124,86,115,35,46),(10,6,64,127,88,117,35,46),(10,6,65,133,89,119,35,47),(10,6,66,135,91,122,35,48),(10,6,67,139,92,124,36,48),(10,6,68,141,94,126,36,49),(10,6,69,142,95,129,36,50),(10,6,70,145,97,131,36,50),(10,6,71,150,99,134,37,51),(10,6,72,152,100,136,37,52),(10,6,73,155,102,139,37,53),(10,6,74,158,104,141,37,53),(10,6,75,159,105,144,38,54),(10,6,76,160,107,147,38,55),(10,6,77,163,109,149,38,56),(10,6,78,166,110,152,38,56),(10,6,79,169,112,155,39,57),(10,6,80,172,114,158,39,58),(10,8,1,17,22,19,27,21),(10,8,2,17,22,19,28,22),(10,8,3,17,22,20,30,24),(10,8,4,17,22,20,31,25),(10,8,5,17,23,20,32,26),(10,8,6,17,23,20,34,28),(10,8,7,18,23,21,35,29),(10,8,8,18,23,21,37,30),(10,8,9,18,23,21,38,32),(10,8,10,18,23,22,40,33),(10,8,11,18,24,22,41,35),(10,8,12,18,24,22,42,36),(10,8,13,18,24,23,44,37),(10,8,14,18,24,23,45,39),(10,8,15,18,24,23,47,40),(10,8,16,19,24,24,49,42),(10,8,17,19,25,24,50,43),(10,8,18,19,25,24,52,45),(10,8,19,19,25,25,53,46),(10,8,20,19,25,25,55,48),(10,8,21,19,25,26,57,50),(10,8,22,19,26,26,58,51),(10,8,23,20,26,26,60,53),(10,8,24,20,26,27,61,54),(10,8,25,20,26,27,63,56),(10,8,26,20,27,27,65,58),(10,8,27,20,27,28,67,59),(10,8,28,20,27,28,68,61),(10,8,29,21,27,29,70,63),(10,8,30,21,28,29,72,64),(10,8,31,21,28,30,74,66),(10,8,32,21,28,30,75,68),(10,8,33,21,28,30,77,70),(10,8,34,21,29,31,79,71),(10,8,35,22,29,31,81,73),(10,8,36,22,29,32,83,75),(10,8,37,22,29,32,85,77),(10,8,38,22,30,33,86,78),(10,8,39,22,30,33,88,80),(10,8,40,23,30,34,90,82),(10,8,41,23,31,34,92,84),(10,8,42,23,31,35,94,86),(10,8,43,23,31,35,96,88),(10,8,44,23,32,36,98,90),(10,8,45,24,32,36,100,92),(10,8,46,24,32,37,102,93),(10,8,47,24,32,37,104,95),(10,8,48,24,33,38,106,97),(10,8,49,25,33,38,108,99),(10,8,50,25,33,39,110,101),(10,8,51,25,34,39,112,103),(10,8,52,25,34,40,114,105),(10,8,53,25,35,40,117,107),(10,8,54,26,35,41,119,109),(10,8,55,26,35,41,121,111),(10,8,56,26,36,42,123,113),(10,8,57,26,36,42,125,116),(10,8,58,27,36,43,127,118),(10,8,59,27,37,43,130,120),(10,8,60,27,37,44,132,122),(10,8,61,27,37,45,134,124),(10,8,62,28,38,45,136,126),(10,8,63,28,38,46,139,128),(10,8,64,28,39,46,141,131),(10,8,65,29,39,47,143,133),(10,8,66,29,39,48,146,135),(10,8,67,29,40,48,148,137),(10,8,68,29,40,49,150,139),(10,8,69,30,41,49,153,142),(10,8,70,30,41,50,155,144),(10,8,71,30,41,50,158,147),(10,8,72,30,42,51,161,150),(10,8,73,30,42,52,164,153),(10,8,74,31,43,52,167,155),(10,8,75,31,43,53,170,158),(10,8,76,31,43,54,173,161),(10,8,77,32,44,55,176,164),(10,8,78,32,44,55,179,167),(10,8,79,32,45,56,182,170),(10,8,80,33,45,57,185,173),(10,9,1,17,22,20,26,21),(10,9,2,17,22,21,27,22),(10,9,3,18,23,21,28,23),(10,9,4,18,23,22,29,24),(10,9,5,18,23,22,31,26),(10,9,6,18,24,23,32,27),(10,9,7,19,24,23,33,28),(10,9,8,19,25,24,34,29),(10,9,9,19,25,25,36,30),(10,9,10,20,25,25,37,32),(10,9,11,20,26,26,38,33),(10,9,12,20,26,26,39,34),(10,9,13,21,27,27,41,36),(10,9,14,21,27,28,42,37),(10,9,15,21,27,28,43,38),(10,9,16,22,28,29,45,39),(10,9,17,22,28,30,46,41),(10,9,18,23,29,30,47,42),(10,9,19,23,29,31,49,43),(10,9,20,23,30,32,50,45),(10,9,21,24,30,32,51,46),(10,9,22,24,31,33,53,48),(10,9,23,24,31,34,54,49),(10,9,24,25,31,34,56,50),(10,9,25,25,32,35,57,52),(10,9,26,26,32,36,59,53),(10,9,27,26,33,37,60,55),(10,9,28,26,33,37,62,56),(10,9,29,27,34,38,63,58),(10,9,30,27,34,39,65,59),(10,9,31,28,35,40,66,61),(10,9,32,28,36,40,68,62),(10,9,33,29,36,41,69,64),(10,9,34,29,37,42,71,65),(10,9,35,29,37,43,73,67),(10,9,36,30,38,43,74,69),(10,9,37,30,38,44,76,70),(10,9,38,31,39,45,77,72),(10,9,39,31,39,46,79,73),(10,9,40,32,40,47,81,75),(10,9,41,32,41,48,82,77),(10,9,42,33,41,48,84,78),(10,9,43,33,42,49,86,80),(10,9,44,34,42,50,88,82),(10,9,45,34,43,51,89,83),(10,9,46,35,44,52,91,85),(10,9,47,35,44,53,93,87),(10,9,48,36,45,54,95,89),(10,9,49,36,45,54,96,90),(10,9,50,37,46,55,98,92),(10,9,51,37,47,56,100,94),(10,9,52,38,47,57,102,96),(10,9,53,38,48,58,104,97),(10,9,54,39,49,59,105,99),(10,9,55,39,49,60,107,101),(10,9,56,40,50,61,109,103),(10,9,57,40,51,62,111,105),(10,9,58,41,51,63,113,107),(10,9,59,42,52,64,115,108),(10,9,60,42,53,65,117,110),(10,9,61,43,53,66,119,112),(10,9,62,43,54,67,121,114),(10,9,63,44,55,68,123,116),(10,9,64,44,56,69,125,118),(10,9,65,45,56,70,127,120),(10,9,66,46,57,71,129,122),(10,9,67,46,58,72,131,124),(10,9,68,47,58,73,133,126),(10,9,69,47,59,74,135,128),(10,9,70,48,60,75,137,130),(10,9,71,49,61,83,139,141),(10,9,72,50,61,84,142,143),(10,9,73,51,62,84,144,146),(10,9,74,51,63,86,147,149),(10,9,75,52,64,89,149,151),(10,9,76,53,65,90,155,154),(10,9,77,54,66,91,155,157),(10,9,78,54,67,93,157,160),(10,9,79,55,68,94,160,163),(10,9,80,56,69,95,163,165),(11,1,1,24,17,21,21,22),(11,1,2,25,18,22,21,22),(11,1,3,27,19,23,21,23),(11,1,4,28,19,25,21,23),(11,1,5,29,20,26,21,23),(11,1,6,31,21,27,21,23),(11,1,7,32,22,28,21,24),(11,1,8,33,23,29,22,24),(11,1,9,35,24,31,22,24),(11,1,10,36,24,32,22,25),(11,1,11,37,25,33,22,25),(11,1,12,39,26,34,22,25),(11,1,13,40,27,36,22,26),(11,1,14,42,28,37,22,26),(11,1,15,43,29,38,22,26),(11,1,16,45,30,40,22,27),(11,1,17,46,31,41,23,27),(11,1,18,48,32,43,23,27),(11,1,19,49,33,44,23,28),(11,1,20,51,34,45,23,28),(11,1,21,52,34,47,23,28),(11,1,22,54,35,48,23,29),(11,1,23,55,36,50,23,29),(11,1,24,57,37,51,24,30),(11,1,25,59,38,52,24,30),(11,1,26,60,39,54,24,30),(11,1,27,62,40,55,24,31),(11,1,28,63,41,57,24,31),(11,1,29,65,43,58,24,32),(11,1,30,67,44,60,24,32),(11,1,31,69,45,62,25,32),(11,1,32,70,46,63,25,33),(11,1,33,72,47,65,25,33),(11,1,34,74,48,66,25,34),(11,1,35,75,49,68,25,34),(11,1,36,77,50,69,26,35),(11,1,37,79,51,71,26,35),(11,1,38,81,52,73,26,35),(11,1,39,83,53,74,26,36),(11,1,40,84,55,76,26,36),(11,1,41,86,56,78,27,37),(11,1,42,88,57,79,27,37),(11,1,43,90,58,81,27,38),(11,1,44,92,59,83,27,38),(11,1,45,94,60,85,27,39),(11,1,46,96,62,86,28,39),(11,1,47,98,63,88,28,40),(11,1,48,100,64,90,28,40),(11,1,49,102,65,92,28,41),(11,1,50,103,66,93,29,41),(11,1,51,105,68,95,29,42),(11,1,52,107,69,97,29,42),(11,1,53,109,70,99,29,43),(11,1,54,112,71,101,30,44),(11,1,55,114,73,103,30,44),(11,1,56,116,74,104,30,45),(11,1,57,118,75,106,30,45),(11,1,58,120,77,108,31,46),(11,1,59,122,78,110,31,46),(11,1,60,124,79,112,31,47),(11,1,61,126,81,114,31,48),(11,1,62,128,82,116,32,48),(11,1,63,130,83,118,32,49),(11,1,64,133,85,120,32,49),(11,1,65,135,86,122,33,50),(11,1,66,137,87,124,33,51),(11,1,67,139,89,126,33,51),(11,1,68,141,90,128,33,52),(11,1,69,144,92,130,34,52),(11,1,70,146,93,132,34,53),(11,1,71,149,94,134,34,54),(11,1,72,151,96,137,34,55),(11,1,73,154,98,139,34,56),(11,1,74,157,99,142,35,56),(11,1,75,166,101,149,35,57),(11,1,76,172,103,155,35,58),(11,1,77,175,105,159,36,59),(11,1,78,179,106,161,36,59),(11,1,79,182,108,164,36,60),(11,1,80,185,110,167,37,61),(11,2,1,23,17,21,21,23),(11,2,2,24,18,22,22,24),(11,2,3,25,18,23,22,24),(11,2,4,26,19,24,23,25),(11,2,5,27,19,25,24,26),(11,2,6,29,20,26,24,26),(11,2,7,30,21,27,25,27),(11,2,8,31,21,28,26,28),(11,2,9,32,22,29,26,29),(11,2,10,33,22,31,27,29),(11,2,11,34,23,32,28,30),(11,2,12,36,24,33,28,31),(11,2,13,37,24,34,29,32),(11,2,14,38,25,35,30,32),(11,2,15,39,26,36,31,33),(11,2,16,40,26,37,31,34),(11,2,17,42,27,39,32,35),(11,2,18,43,28,40,33,36),(11,2,19,44,28,41,34,37),(11,2,20,46,29,42,34,37),(11,2,21,47,30,44,35,38),(11,2,22,48,31,45,36,39),(11,2,23,50,31,46,37,40),(11,2,24,51,32,47,38,41),(11,2,25,52,33,49,38,42),(11,2,26,54,34,50,39,43),(11,2,27,55,34,51,40,44),(11,2,28,56,35,53,41,44),(11,2,29,58,36,54,42,45),(11,2,30,59,37,55,43,46),(11,2,31,61,37,57,43,47),(11,2,32,62,38,58,44,48),(11,2,33,64,39,59,45,49),(11,2,34,65,40,61,46,50),(11,2,35,67,41,62,47,51),(11,2,36,68,42,64,48,52),(11,2,37,70,42,65,49,53),(11,2,38,71,43,67,50,54),(11,2,39,73,44,68,51,55),(11,2,40,74,45,69,52,56),(11,2,41,76,46,71,53,57),(11,2,42,78,47,72,54,58),(11,2,43,79,47,74,55,59),(11,2,44,81,48,75,56,60),(11,2,45,82,49,77,57,61),(11,2,46,84,50,78,58,62),(11,2,47,86,51,80,59,64),(11,2,48,87,52,82,60,65),(11,2,49,89,53,83,61,66),(11,2,50,91,54,85,62,67),(11,2,51,92,55,86,63,68),(11,2,52,94,56,88,64,69),(11,2,53,96,57,90,65,70),(11,2,54,97,58,91,66,71),(11,2,55,99,59,93,67,73),(11,2,56,101,60,95,68,74),(11,2,57,103,61,96,69,75),(11,2,58,105,62,98,70,76),(11,2,59,106,63,100,71,77),(11,2,60,108,64,101,72,78),(11,2,61,110,65,103,74,80),(11,2,62,112,66,105,75,81),(11,2,63,114,67,106,76,82),(11,2,64,116,68,108,77,83),(11,2,65,117,69,110,78,85),(11,2,66,119,70,112,79,86),(11,2,67,121,71,114,80,87),(11,2,68,123,72,115,82,88),(11,2,69,125,73,117,83,90),(11,2,70,127,74,119,84,91),(11,2,71,130,75,121,87,92),(11,2,72,132,76,124,90,94),(11,2,73,134,77,126,93,96),(11,2,74,137,79,128,97,97),(11,2,75,139,80,130,101,99),(11,2,76,142,81,133,106,100),(11,2,77,144,83,135,108,102),(11,2,78,147,84,137,110,104),(11,2,79,149,85,140,111,105),(11,2,80,152,87,142,113,107),(11,3,1,21,20,20,21,23),(11,3,2,21,21,21,22,24),(11,3,3,22,23,22,22,24),(11,3,4,22,24,23,23,25),(11,3,5,23,25,24,23,25),(11,3,6,23,27,25,24,26),(11,3,7,24,28,26,24,27),(11,3,8,24,30,27,25,27),(11,3,9,25,31,27,26,28),(11,3,10,25,33,28,26,29),(11,3,11,25,34,29,27,29),(11,3,12,26,36,30,28,30),(11,3,13,26,37,31,28,31),(11,3,14,27,39,32,29,32),(11,3,15,27,40,34,30,32),(11,3,16,28,42,35,30,33),(11,3,17,28,43,36,31,34),(11,3,18,29,45,37,32,35),(11,3,19,29,47,38,32,35),(11,3,20,30,48,39,33,36),(11,3,21,31,50,40,34,37),(11,3,22,31,51,41,34,38),(11,3,23,32,53,42,35,38),(11,3,24,32,55,43,36,39),(11,3,25,33,57,44,37,40),(11,3,26,33,58,46,37,41),(11,3,27,34,60,47,38,42),(11,3,28,35,62,48,39,42),(11,3,29,35,63,49,40,43),(11,3,30,36,65,50,40,44),(11,3,31,36,67,52,41,45),(11,3,32,37,69,53,42,46),(11,3,33,38,71,54,43,47),(11,3,34,38,72,55,44,48),(11,3,35,39,74,57,44,48),(11,3,36,39,76,58,45,49),(11,3,37,40,78,59,46,50),(11,3,38,41,80,60,47,51),(11,3,39,41,82,62,48,52),(11,3,40,42,84,63,49,53),(11,3,41,43,86,64,50,54),(11,3,42,43,88,66,50,55),(11,3,43,44,90,67,51,56),(11,3,44,45,91,68,52,57),(11,3,45,45,93,70,53,58),(11,3,46,46,95,71,54,59),(11,3,47,47,98,72,55,60),(11,3,48,48,100,74,56,61),(11,3,49,48,102,75,57,62),(11,3,50,49,104,77,58,63),(11,3,51,50,106,78,59,64),(11,3,52,51,108,79,60,65),(11,3,53,51,110,81,61,66),(11,3,54,52,112,82,61,67),(11,3,55,53,114,84,62,68),(11,3,56,54,116,85,63,69),(11,3,57,54,118,87,64,70),(11,3,58,55,121,88,65,71),(11,3,59,56,123,90,66,72),(11,3,60,57,125,91,67,74),(11,3,61,58,127,93,68,75),(11,3,62,58,130,94,69,76),(11,3,63,59,132,96,71,77),(11,3,64,60,134,97,72,78),(11,3,65,61,136,99,73,79),(11,3,66,62,139,101,74,80),(11,3,67,62,141,102,75,81),(11,3,68,63,143,104,76,83),(11,3,69,64,146,105,77,84),(11,3,70,65,148,107,78,85),(11,3,71,66,151,109,79,86),(11,3,72,67,154,111,80,87),(11,3,73,68,157,113,81,89),(11,3,74,69,160,115,83,90),(11,3,75,70,163,117,84,92),(11,3,76,71,166,119,85,93),(11,3,77,72,169,121,87,95),(11,3,78,73,172,123,88,96),(11,3,79,74,175,125,89,98),(11,3,80,75,178,127,91,99),(11,5,1,21,17,19,23,25),(11,5,2,21,17,19,24,26),(11,5,3,21,17,20,26,28),(11,5,4,21,18,20,27,29),(11,5,5,22,18,20,28,30),(11,5,6,22,18,21,30,32),(11,5,7,22,18,21,31,33),(11,5,8,22,19,22,32,35),(11,5,9,22,19,22,34,36),(11,5,10,22,19,22,35,38),(11,5,11,23,19,23,37,39),(11,5,12,23,20,23,38,41),(11,5,13,23,20,24,39,42),(11,5,14,23,20,24,41,44),(11,5,15,23,20,25,42,45),(11,5,16,24,21,25,44,47),(11,5,17,24,21,25,45,48),(11,5,18,24,21,26,47,50),(11,5,19,24,22,26,48,51),(11,5,20,24,22,27,50,53),(11,5,21,25,22,27,51,55),(11,5,22,25,22,28,53,56),(11,5,23,25,23,28,55,58),(11,5,24,25,23,29,56,60),(11,5,25,25,23,29,58,61),(11,5,26,26,24,30,60,63),(11,5,27,26,24,30,61,65),(11,5,28,26,24,31,63,66),(11,5,29,26,25,31,65,68),(11,5,30,27,25,32,66,70),(11,5,31,27,25,32,68,72),(11,5,32,27,26,33,70,73),(11,5,33,27,26,33,71,75),(11,5,34,28,26,34,73,77),(11,5,35,28,27,34,75,79),(11,5,36,28,27,35,77,81),(11,5,37,29,28,35,79,83),(11,5,38,29,28,36,80,85),(11,5,39,29,28,37,82,86),(11,5,40,29,29,37,84,88),(11,5,41,30,29,38,86,90),(11,5,42,30,29,38,88,92),(11,5,43,30,30,39,90,94),(11,5,44,31,30,39,91,96),(11,5,45,31,31,40,93,98),(11,5,46,31,31,41,95,100),(11,5,47,32,31,41,97,102),(11,5,48,32,32,42,99,104),(11,5,49,32,32,43,101,106),(11,5,50,33,33,43,103,108),(11,5,51,33,33,44,105,110),(11,5,52,33,34,44,107,113),(11,5,53,34,34,45,109,115),(11,5,54,34,34,46,111,117),(11,5,55,34,35,46,113,119),(11,5,56,35,35,47,115,121),(11,5,57,35,36,48,118,123),(11,5,58,35,36,48,120,126),(11,5,59,36,37,49,122,128),(11,5,60,36,37,50,124,130),(11,5,61,36,38,51,126,132),(11,5,62,37,38,51,128,134),(11,5,63,37,39,52,130,137),(11,5,64,38,39,53,133,139),(11,5,65,38,40,53,135,141),(11,5,66,38,40,54,137,144),(11,5,67,39,40,55,139,146),(11,5,68,39,41,56,141,148),(11,5,69,40,41,56,144,151),(11,5,70,40,42,57,146,153),(11,5,71,40,43,58,149,156),(11,5,72,41,43,58,155,159),(11,5,73,41,44,59,157,160),(11,5,74,42,44,61,160,163),(11,5,75,42,45,62,164,166),(11,5,76,42,46,62,167,169),(11,5,77,43,46,63,168,172),(11,5,78,43,47,64,169,177),(11,5,79,44,47,65,172,180),(11,5,80,44,48,66,175,183),(11,6,1,24,17,21,21,22),(11,6,2,25,18,22,21,22),(11,6,3,27,19,23,21,23),(11,6,4,28,19,25,21,23),(11,6,5,29,20,26,21,23),(11,6,6,31,21,27,21,23),(11,6,7,32,22,28,21,24),(11,6,8,33,23,29,22,24),(11,6,9,35,24,31,22,24),(11,6,10,36,24,32,22,25),(11,6,11,37,25,33,22,25),(11,6,12,39,26,34,22,25),(11,6,13,40,27,36,22,26),(11,6,14,42,28,37,22,26),(11,6,15,43,29,38,22,26),(11,6,16,45,30,40,22,27),(11,6,17,46,31,41,23,27),(11,6,18,48,32,43,23,27),(11,6,19,49,33,44,23,28),(11,6,20,51,34,45,23,28),(11,6,21,52,34,47,23,28),(11,6,22,54,35,48,23,29),(11,6,23,55,36,50,23,29),(11,6,24,57,37,51,24,30),(11,6,25,59,38,52,24,30),(11,6,26,60,39,54,24,30),(11,6,27,62,40,55,24,31),(11,6,28,63,41,57,24,31),(11,6,29,65,43,58,24,32),(11,6,30,67,44,60,24,32),(11,6,31,69,45,62,25,32),(11,6,32,70,46,63,25,33),(11,6,33,72,47,65,25,33),(11,6,34,74,48,66,25,34),(11,6,35,75,49,68,25,34),(11,6,36,77,50,69,26,35),(11,6,37,79,51,71,26,35),(11,6,38,81,52,73,26,35),(11,6,39,83,53,74,26,36),(11,6,40,84,55,76,26,36),(11,6,41,86,56,78,27,37),(11,6,42,88,57,79,27,37),(11,6,43,90,58,81,27,38),(11,6,44,92,59,83,27,38),(11,6,45,94,60,85,27,39),(11,6,46,96,62,86,28,39),(11,6,47,98,63,88,28,40),(11,6,48,100,64,90,28,40),(11,6,49,102,65,92,28,41),(11,6,50,103,65,93,29,41),(11,6,51,105,66,94,29,42),(11,6,52,106,67,95,29,42),(11,6,53,107,68,96,29,43),(11,6,54,108,69,97,30,44),(11,6,55,109,70,98,30,44),(11,6,56,112,72,101,30,45),(11,6,57,114,73,103,30,45),(11,6,58,117,74,105,31,46),(11,6,59,119,76,107,31,46),(11,6,60,121,77,109,31,47),(11,6,61,123,78,111,31,48),(11,6,62,126,80,113,31,48),(11,6,63,128,81,116,32,49),(11,6,64,131,83,118,32,49),(11,6,65,136,84,120,32,50),(11,6,66,140,86,123,32,51),(11,6,67,141,87,125,33,51),(11,6,68,141,89,127,33,52),(11,6,69,144,90,130,33,53),(11,6,70,147,92,132,33,53),(11,6,71,150,94,135,34,54),(11,6,72,152,95,137,34,55),(11,6,73,155,97,140,34,56),(11,6,74,162,99,142,34,56),(11,6,75,165,100,145,35,57),(11,6,76,167,102,146,35,58),(11,6,77,169,104,150,35,59),(11,6,78,170,105,152,35,59),(11,6,79,173,107,156,36,60),(11,6,80,176,109,159,36,61),(11,7,1,22,17,20,22,24),(11,7,2,23,17,21,23,25),(11,7,3,24,18,22,24,26),(11,7,4,25,18,23,25,27),(11,7,5,25,19,24,26,28),(11,7,6,26,19,25,27,29),(11,7,7,27,20,26,28,30),(11,7,8,28,20,27,28,31),(11,7,9,29,21,28,29,32),(11,7,10,30,21,29,30,33),(11,7,11,31,22,30,31,35),(11,7,12,32,22,31,32,36),(11,7,13,33,23,32,33,37),(11,7,14,34,23,33,34,38),(11,7,15,34,24,35,35,39),(11,7,16,35,24,36,36,40),(11,7,17,36,25,37,38,42),(11,7,18,37,25,38,39,43),(11,7,19,38,26,39,40,44),(11,7,20,39,26,40,41,45),(11,7,21,40,27,41,42,46),(11,7,22,41,27,43,43,48),(11,7,23,43,28,44,44,49),(11,7,24,44,28,45,45,50),(11,7,25,45,29,46,46,51),(11,7,26,46,30,47,48,53),(11,7,27,47,30,49,49,54),(11,7,28,48,31,50,50,55),(11,7,29,49,31,51,51,57),(11,7,30,50,32,53,52,58),(11,7,31,51,33,54,53,59),(11,7,32,52,33,55,55,61),(11,7,33,53,34,56,56,62),(11,7,34,55,34,58,57,64),(11,7,35,56,35,59,58,65),(11,7,36,57,36,60,60,66),(11,7,37,58,36,62,61,68),(11,7,38,59,37,63,62,69),(11,7,39,61,38,65,63,71),(11,7,40,62,38,66,65,72),(11,7,41,63,39,67,66,74),(11,7,42,64,40,69,67,75),(11,7,43,65,40,70,69,77),(11,7,44,67,41,72,70,78),(11,7,45,68,42,73,71,80),(11,7,46,69,42,75,73,81),(11,7,47,71,43,76,74,83),(11,7,48,72,44,78,76,84),(11,7,49,73,45,79,77,86),(11,7,50,74,45,81,78,88),(11,7,51,76,46,82,80,89),(11,7,52,77,47,84,81,91),(11,7,53,78,47,85,83,92),(11,7,54,80,48,87,84,94),(11,7,55,81,49,88,86,96),(11,7,56,83,50,90,87,97),(11,7,57,84,50,91,89,99),(11,7,58,85,51,93,90,101),(11,7,59,87,52,95,92,102),(11,7,60,88,53,96,93,104),(11,7,61,90,54,98,95,106),(11,7,62,91,54,99,96,108),(11,7,63,93,55,101,98,109),(11,7,64,94,56,103,99,111),(11,7,65,95,57,104,101,113),(11,7,66,97,58,106,103,115),(11,7,67,98,58,108,104,117),(11,7,68,100,59,110,106,118),(11,7,69,101,60,111,107,120),(11,7,70,103,61,113,109,122),(11,7,71,104,62,115,122,124),(11,7,72,106,63,117,124,127),(11,7,73,108,64,119,126,129),(11,7,74,110,65,122,128,131),(11,7,75,112,66,124,130,133),(11,7,76,114,67,126,133,136),(11,7,77,115,68,128,135,138),(11,7,78,117,69,130,137,140),(11,7,79,119,70,133,139,143),(11,7,80,121,71,135,141,145),(11,8,1,21,17,19,24,24),(11,8,2,21,17,19,25,25),(11,8,3,21,17,20,27,27),(11,8,4,21,17,20,28,28),(11,8,5,21,18,20,29,29),(11,8,6,21,18,20,31,31),(11,8,7,21,18,21,32,32),(11,8,8,22,18,21,34,33),(11,8,9,22,18,21,35,35),(11,8,10,22,19,22,37,36),(11,8,11,22,19,22,38,37),(11,8,12,22,19,22,40,39),(11,8,13,22,19,23,41,40),(11,8,14,22,19,23,43,42),(11,8,15,22,19,23,44,43),(11,8,16,22,20,24,46,45),(11,8,17,23,20,24,47,46),(11,8,18,23,20,24,49,48),(11,8,19,23,20,25,50,49),(11,8,20,23,21,25,52,51),(11,8,21,23,21,26,54,52),(11,8,22,23,21,26,55,54),(11,8,23,23,21,26,57,56),(11,8,24,24,21,27,59,57),(11,8,25,24,22,27,60,59),(11,8,26,24,22,27,62,60),(11,8,27,24,22,28,64,62),(11,8,28,24,22,28,65,64),(11,8,29,24,23,29,67,65),(11,8,30,24,23,29,69,67),(11,8,31,25,23,30,71,69),(11,8,32,25,23,30,73,71),(11,8,33,25,24,30,74,72),(11,8,34,25,24,31,76,74),(11,8,35,25,24,31,78,76),(11,8,36,26,24,32,80,78),(11,8,37,26,25,32,82,79),(11,8,38,26,25,33,84,81),(11,8,39,26,25,33,86,83),(11,8,40,26,26,34,87,85),(11,8,41,27,26,34,89,87),(11,8,42,27,26,35,91,89),(11,8,43,27,27,35,93,91),(11,8,44,27,27,36,95,92),(11,8,45,27,27,36,97,94),(11,8,46,28,27,37,99,96),(11,8,47,28,28,37,101,98),(11,8,48,28,28,38,103,100),(11,8,49,28,28,38,105,102),(11,8,50,29,29,39,107,104),(11,8,51,29,29,39,110,106),(11,8,52,29,29,40,112,108),(11,8,53,29,30,40,114,110),(11,8,54,30,30,41,116,112),(11,8,55,30,30,41,118,114),(11,8,56,30,31,42,120,116),(11,8,57,30,31,42,122,118),(11,8,58,31,31,43,125,121),(11,8,59,31,32,43,127,123),(11,8,60,31,32,44,129,125),(11,8,61,31,33,45,131,127),(11,8,62,32,33,45,133,129),(11,8,63,32,33,46,136,131),(11,8,64,32,34,46,138,134),(11,8,65,33,34,47,140,136),(11,8,66,33,34,48,143,138),(11,8,67,33,35,48,145,140),(11,8,68,33,35,49,147,142),(11,8,69,34,36,49,150,145),(11,8,70,34,36,50,152,147),(11,8,71,34,36,51,155,150),(11,8,72,34,37,52,161,153),(11,8,73,34,37,53,161,156),(11,8,74,35,38,53,164,158),(11,8,75,35,38,54,167,161),(11,8,76,35,38,55,170,164),(11,8,77,36,39,56,173,167),(11,8,78,36,39,56,176,170),(11,8,79,36,40,57,179,173),(11,8,80,37,40,58,182,176); +/*!40000 ALTER TABLE `player_levelstats` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `player_xp_for_level` +-- + +DROP TABLE IF EXISTS `player_xp_for_level`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `player_xp_for_level` ( + `lvl` int(3) unsigned NOT NULL, + `xp_for_next_level` int(10) unsigned NOT NULL, + PRIMARY KEY (`lvl`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `player_xp_for_level` +-- + +LOCK TABLES `player_xp_for_level` WRITE; +/*!40000 ALTER TABLE `player_xp_for_level` DISABLE KEYS */; +INSERT INTO `player_xp_for_level` VALUES (1,400),(2,900),(3,1400),(4,2100),(5,2800),(6,3600),(7,4500),(8,5400),(9,6500),(10,7600),(11,8700),(12,9800),(13,11000),(14,12300),(15,13600),(16,15000),(17,16400),(18,17800),(19,19300),(20,20800),(21,22400),(22,24000),(23,25500),(24,27200),(25,28900),(26,30500),(27,32200),(28,33900),(29,36300),(30,38800),(31,41600),(32,44600),(33,48000),(34,51400),(35,55000),(36,58700),(37,62400),(38,66200),(39,70200),(40,74300),(41,78500),(42,82800),(43,87100),(44,91600),(45,96300),(46,101000),(47,105800),(48,110700),(49,115700),(50,120900),(51,126100),(52,131500),(53,137000),(54,142500),(55,148200),(56,154000),(57,159900),(58,165800),(59,172000),(60,290000),(61,317000),(62,349000),(63,386000),(64,428000),(65,475000),(66,527000),(67,585000),(68,648000),(69,717000),(70,1523800),(71,1539600),(72,1555700),(73,1571800),(74,1587900),(75,1604200),(76,1620700),(77,1637400),(78,1653900),(79,1670800); +/*!40000 ALTER TABLE `player_xp_for_level` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `playercreateinfo` +-- + +DROP TABLE IF EXISTS `playercreateinfo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `playercreateinfo` ( + `race` tinyint(3) unsigned NOT NULL DEFAULT '0', + `class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `map` smallint(5) unsigned NOT NULL DEFAULT '0', + `zone` mediumint(8) unsigned NOT NULL DEFAULT '0', + `position_x` float NOT NULL DEFAULT '0', + `position_y` float NOT NULL DEFAULT '0', + `position_z` float NOT NULL DEFAULT '0', + PRIMARY KEY (`race`,`class`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `playercreateinfo` +-- + +LOCK TABLES `playercreateinfo` WRITE; +/*!40000 ALTER TABLE `playercreateinfo` DISABLE KEYS */; +INSERT INTO `playercreateinfo` VALUES (1,1,0,12,-8949.95,-132.493,83.5312),(1,2,0,12,-8949.95,-132.493,83.5312),(1,4,0,12,-8949.95,-132.493,83.5312),(1,5,0,12,-8949.95,-132.493,83.5312),(1,8,0,12,-8949.95,-132.493,83.5312),(1,9,0,12,-8949.95,-132.493,83.5312),(2,1,1,14,-618.518,-4251.67,38.718),(2,3,1,14,-618.518,-4251.67,38.718),(2,4,1,14,-618.518,-4251.67,38.718),(2,7,1,14,-618.518,-4251.67,38.718),(2,9,1,14,-618.518,-4251.67,38.718),(3,1,0,1,-6240.32,331.033,382.758),(3,2,0,1,-6240.32,331.033,382.758),(3,3,0,1,-6240.32,331.033,382.758),(3,4,0,1,-6240.32,331.033,382.758),(3,5,0,1,-6240.32,331.033,382.758),(4,1,1,141,10311.3,832.463,1326.41),(4,3,1,141,10311.3,832.463,1326.41),(4,4,1,141,10311.3,832.463,1326.41),(4,5,1,141,10311.3,832.463,1326.41),(4,11,1,141,10311.3,832.463,1326.41),(5,1,0,85,1676.71,1678.31,121.67),(5,4,0,85,1676.71,1678.31,121.67),(5,5,0,85,1676.71,1678.31,121.67),(5,8,0,85,1676.71,1678.31,121.67),(5,9,0,85,1676.71,1678.31,121.67),(6,1,1,215,-2917.58,-257.98,52.9968),(6,3,1,215,-2917.58,-257.98,52.9968),(6,7,1,215,-2917.58,-257.98,52.9968),(6,11,1,215,-2917.58,-257.98,52.9968),(7,1,0,1,-6240.32,331.033,382.758),(7,9,0,1,-6240,331,383),(7,8,0,1,-6240,331,383),(7,4,0,1,-6240,331,383),(8,1,1,14,-618.518,-4251.67,38.718),(8,3,1,14,-618.518,-4251.67,38.718),(8,4,1,14,-618.518,-4251.67,38.718),(8,5,1,14,-618.518,-4251.67,38.718),(8,7,1,14,-618.518,-4251.67,38.718),(8,8,1,14,-618.518,-4251.67,38.718),(10,2,530,3431,10349.6,-6357.29,33.4026),(10,3,530,3431,10349.6,-6357.29,33.4026),(10,4,530,3431,10349.6,-6357.29,33.4026),(10,5,530,3431,10349.6,-6357.29,33.4026),(10,8,530,3431,10349.6,-6357.29,33.4026),(10,9,530,3431,10349.6,-6357.29,33.4026),(11,1,530,3526,-3961.64,-13931.2,100.615),(11,2,530,3526,-3961.64,-13931.2,100.615),(11,3,530,3526,-3961.64,-13931.2,100.615),(11,5,530,3526,-3961.64,-13931.2,100.615),(11,7,530,3526,-3961.64,-13931.2,100.615),(11,8,530,3526,-3961.64,-13931.2,100.615),(1,6,609,4298,2355.84,-5664.77,426.028),(2,6,609,4298,2358.44,-5666.9,426.023),(3,6,609,4298,2358.44,-5666.9,426.023),(4,6,609,4298,2356.21,-5662.21,426.026),(5,6,609,4298,2356.21,-5662.21,426.026),(6,6,609,4298,2358.17,-5663.21,426.027),(7,6,609,4298,2355.05,-5661.7,426.026),(8,6,609,4298,2355.05,-5661.7,426.026),(10,6,609,4298,2355.84,-5664.77,426.028),(11,6,609,4298,2358.17,-5663.21,426.027); +/*!40000 ALTER TABLE `playercreateinfo` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `playercreateinfo_action` +-- + +DROP TABLE IF EXISTS `playercreateinfo_action`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `playercreateinfo_action` ( + `race` tinyint(3) unsigned NOT NULL DEFAULT '0', + `class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `button` smallint(5) unsigned NOT NULL DEFAULT '0', + `action` int(11) unsigned NOT NULL DEFAULT '0', + `type` smallint(5) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`race`,`class`,`button`), + KEY `playercreateinfo_race_class_index` (`race`,`class`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `playercreateinfo_action` +-- + +LOCK TABLES `playercreateinfo_action` WRITE; +/*!40000 ALTER TABLE `playercreateinfo_action` DISABLE KEYS */; +INSERT INTO `playercreateinfo_action` (`race`,`class`,`button`,`action`,`type`) VALUES +(10,6,2,45477,0), +(10,6,3,45462,0), +(10,6,4,45902,0), +(10,6,5,47541,0), +(10,6,6,50613,0), +(10,8,0,133,0), +(10,8,1,168,0), +(10,8,2,28730,0), +(10,9,0,686,0), +(10,9,1,687,0), +(10,9,2,28730,0), +(11,1,0,6603,0), +(11,1,72,6603,0), +(11,1,73,78,0), +(11,1,74,28880,0), +(11,1,84,6603,0), +(11,1,96,6603,0), +(11,1,108,6603,0), +(11,2,0,6603,0), +(11,2,1,21084,0), +(11,2,2,635,0), +(11,2,3,59542,0), +(11,3,0,6603,0), +(11,3,1,2973,0), +(11,3,2,75,0), +(11,3,3,59543,0), +(11,3,72,6603,0), +(11,3,73,2973,0), +(11,3,74,75,0), +(11,5,0,585,0), +(11,5,1,2050,0), +(11,5,2,59544,0), +(11,6,0,6603,0), +(11,6,1,49576,0), +(11,6,2,45477,0), +(11,6,3,45462,0), +(11,6,4,45902,0), +(11,6,5,47541,0), +(11,6,10,59545,0), +(11,7,0,6603,0), +(11,7,1,403,0), +(11,7,2,331,0), +(11,7,3,59547,0), +(11,8,0,133,0), +(11,8,1,168,0), +(11,8,2,59548,0), +(11,6,11,41751,128); +/*!40000 ALTER TABLE `playercreateinfo_action` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `playercreateinfo_item` +-- + +DROP TABLE IF EXISTS `playercreateinfo_item`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `playercreateinfo_item` ( + `race` tinyint(3) unsigned NOT NULL DEFAULT '0', + `class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `itemid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `amount` tinyint(3) NOT NULL DEFAULT '1', + KEY `playercreateinfo_race_class_index` (`race`,`class`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `playercreateinfo_item` +-- + +LOCK TABLES `playercreateinfo_item` WRITE; +/*!40000 ALTER TABLE `playercreateinfo_item` DISABLE KEYS */; +/*!40000 ALTER TABLE `playercreateinfo_item` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `playercreateinfo_spell` +-- + +DROP TABLE IF EXISTS `playercreateinfo_spell`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `playercreateinfo_spell` ( + `race` tinyint(3) unsigned NOT NULL DEFAULT '0', + `class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Spell` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Note` varchar(255) DEFAULT NULL, + PRIMARY KEY (`race`,`class`,`Spell`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `playercreateinfo_spell` +-- + +LOCK TABLES `playercreateinfo_spell` WRITE; +/*!40000 ALTER TABLE `playercreateinfo_spell` DISABLE KEYS */; +INSERT INTO `playercreateinfo_spell` VALUES (1,1,78,'Heroic Strike'),(1,1,81,'Dodge'),(1,1,107,'Block'),(1,1,196,'One-Handed Axes'),(1,1,198,'One-Handed Maces'),(1,1,201,'One-Handed Swords'),(1,1,203,'Unarmed'),(1,1,204,'Defense'),(1,1,522,'SPELLDEFENSE (DND)'),(1,1,668,'Language Common'),(1,1,1843,'Disarm'),(1,1,2382,'Generic'),(1,1,2457,'Battle Stance'),(1,1,2479,'Honorless Target'),(1,1,3050,'Detect'),(1,1,3365,'Opening'),(1,1,5301,'Defensive State (DND)'),(1,1,6233,'Closing'),(1,1,6246,'Closing'),(1,1,6247,'Opening'),(1,1,6477,'Opening'),(1,1,6478,'Opening'),(1,1,6603,'Attack'),(1,1,7266,'Duel'),(1,1,7267,'Grovel'),(1,1,7355,'Stuck'),(1,1,8386,'Attacking'),(1,1,8737,'Mail'),(1,1,9077,'Leather'),(1,1,9078,'Cloth'),(1,1,9116,'Shield'),(1,1,9125,'Generic'),(1,1,20597,'Sword Specialization'),(1,1,20598,'The Human Spirit'),(1,1,20599,'Diplomacy'),(1,1,20864,'Mace Specialization'),(1,1,21651,'Opening'),(1,1,21652,'Closing'),(1,1,22027,'Remove Insignia'),(1,1,22810,'Opening - No Text'),(1,1,32215,'Victorious State'),(1,1,45927,'Summon Friend'),(1,1,58985,'Perception'),(1,1,59752,'Every Man for Himself'),(1,1,61437,'Opening'),(1,2,81,'Dodge'),(1,2,107,'Block'),(1,2,198,'One-Handed Maces'),(1,2,199,'Two-Handed Maces'),(1,2,203,'Unarmed'),(1,2,204,'Defense'),(1,2,522,'SPELLDEFENSE (DND)'),(1,2,635,'Holy Light'),(1,2,668,'Language Common'),(1,2,1843,'Disarm'),(1,2,2382,'Generic'),(1,2,2479,'Honorless Target'),(1,2,3050,'Detect'),(1,2,3365,'Opening'),(1,2,6233,'Closing'),(1,2,6246,'Closing'),(1,2,6247,'Opening'),(1,2,6477,'Opening'),(1,2,6478,'Opening'),(1,2,6603,'Attack'),(1,2,7266,'Duel'),(1,2,7267,'Grovel'),(1,2,7355,'Stuck'),(1,2,8386,'Attacking'),(1,2,8737,'Mail'),(1,2,9077,'Leather'),(1,2,9078,'Cloth'),(1,2,9116,'Shield'),(1,2,9125,'Generic'),(1,2,21084,'Seal of Righteousness'),(1,2,20597,'Sword Specialization'),(1,2,20598,'The Human Spirit'),(1,2,20599,'Diplomacy'),(1,2,20864,'Mace Specialization'),(1,2,21651,'Opening'),(1,2,21652,'Closing'),(1,2,22027,'Remove Insignia'),(1,2,22810,'Opening - No Text'),(1,2,27762,'Libram'),(1,2,45927,'Summon Friend'),(1,2,58985,'Perception'),(1,2,59752,'Every Man for Himself'),(1,2,61437,'Opening'),(1,4,81,'Dodge'),(1,4,203,'Unarmed'),(1,4,204,'Defense'),(1,4,522,'SPELLDEFENSE (DND)'),(1,4,668,'Language Common'),(1,4,1180,'Daggers'),(1,4,1752,'Sinister Strike'),(1,4,1843,'Disarm'),(1,4,2098,'Eviscerate'),(1,4,2382,'Generic'),(1,4,2479,'Honorless Target'),(1,4,2567,'Thrown'),(1,4,2764,'Throw'),(1,4,3050,'Detect'),(1,4,3365,'Opening'),(1,4,6233,'Closing'),(1,4,6246,'Closing'),(1,4,6247,'Opening'),(1,4,6477,'Opening'),(1,4,6478,'Opening'),(1,4,6603,'Attack'),(1,4,7266,'Duel'),(1,4,7267,'Grovel'),(1,4,7355,'Stuck'),(1,4,8386,'Attacking'),(1,4,9077,'Leather'),(1,4,9078,'Cloth'),(1,4,9125,'Generic'),(1,4,16092,'Defensive State (DND)'),(1,4,20597,'Sword Specialization'),(1,4,20598,'The Human Spirit'),(1,4,20599,'Diplomacy'),(1,4,20864,'Mace Specialization'),(1,4,21184,'Rogue Passive (DND)'),(1,4,21651,'Opening'),(1,4,21652,'Closing'),(1,4,22027,'Remove Insignia'),(1,4,22810,'Opening - No Text'),(1,4,45927,'Summon Friend'),(1,4,58985,'Perception'),(1,4,59752,'Every Man for Himself'),(1,4,61437,'Opening'),(1,5,81,'Dodge'),(1,5,198,'One-Handed Maces'),(1,5,203,'Unarmed'),(1,5,204,'Defense'),(1,5,522,'SPELLDEFENSE (DND)'),(1,5,585,'Smite'),(1,5,668,'Language Common'),(1,5,1843,'Disarm'),(1,5,2050,'Lesser Heal'),(1,5,2382,'Generic'),(1,5,2479,'Honorless Target'),(1,5,3050,'Detect'),(1,5,3365,'Opening'),(1,5,5009,'Wands'),(1,5,5019,'Shoot'),(1,5,6233,'Closing'),(1,5,6246,'Closing'),(1,5,6247,'Opening'),(1,5,6477,'Opening'),(1,5,6478,'Opening'),(1,5,6603,'Attack'),(1,5,7266,'Duel'),(1,5,7267,'Grovel'),(1,5,7355,'Stuck'),(1,5,8386,'Attacking'),(1,5,9078,'Cloth'),(1,5,9125,'Generic'),(1,5,20597,'Sword Specialization'),(1,5,20598,'The Human Spirit'),(1,5,20599,'Diplomacy'),(1,5,20864,'Mace Specialization'),(1,5,21651,'Opening'),(1,5,21652,'Closing'),(1,5,22027,'Remove Insignia'),(1,5,22810,'Opening - No Text'),(1,5,45927,'Summon Friend'),(1,5,58985,'Perception'),(1,5,59752,'Every Man for Himself'),(1,5,61437,'Opening'),(1,6,81,'Dodge'),(1,6,196,'One-Handed Axes'),(1,6,197,'Two-Handed Axes'),(1,6,200,'Polearms'),(1,6,201,'One-Handed Swords'),(1,6,202,'Two-Handed Swords'),(1,6,203,'Unarmed'),(1,6,204,'Defense'),(1,6,522,'SPELLDEFENSE (DND)'),(1,6,668,'Language Common'),(1,6,674,'Dual Wield'),(1,6,750,'Plate Mail'),(1,6,1843,'Disarm'),(1,6,2382,'Generic'),(1,6,2479,'Honorless Target'),(1,6,3050,'Detect'),(1,6,3127,'Parry'),(1,6,3275,'Linen Bandage'),(1,6,3276,'Heavy Linen Bandage'),(1,6,3277,'Wool Bandage'),(1,6,3278,'Heavy Wool Bandage'),(1,6,3365,'Opening'),(1,6,6233,'Closing'),(1,6,6246,'Closing'),(1,6,6247,'Opening'),(1,6,6477,'Opening'),(1,6,6478,'Opening'),(1,6,6603,'Attack'),(1,6,7266,'Duel'),(1,6,7267,'Grovel'),(1,6,7355,'Stuck'),(1,6,7928,'Silk Bandage'),(1,6,7929,'Heavy Silk Bandage'),(1,6,7934,'Anti-Venom'),(1,6,8386,'Attacking'),(1,6,8737,'Mail'),(1,6,9077,'Leather'),(1,6,9078,'Cloth'),(1,6,9125,'Generic'),(1,6,10840,'Mageweave Bandage'),(1,6,10841,'Heavy Mageweave Bandage'),(1,6,10846,'First Aid'),(1,6,18629,'Runecloth Bandage'),(1,6,18630,'Heavy Runecloth Bandage'),(1,6,20597,'Sword Specialization'),(1,6,20598,'The Human Spirit'),(1,6,20599,'Diplomacy'),(1,6,20864,'Mace Specialization'),(1,6,21651,'Opening'),(1,6,21652,'Closing'),(1,6,22027,'Remove Insignia'),(1,6,22810,'Opening - No Text'),(1,6,33391,'Journeyman Riding'),(1,6,45462,'Plague Strike'),(1,6,45477,'Icy Touch'),(1,6,45902,'Blood Strike'),(1,6,45903,'Offensive State (DND)'),(1,6,45927,'Summon Friend'),(1,6,47541,'Death Coil'),(1,6,48266,'Blood Presence'),(1,6,49410,'Forceful Deflection'),(1,6,49576,'Death Grip'),(1,6,52665,'Sigil'),(1,6,58985,'Perception'),(1,6,59752,'Every Man for Himself'),(1,6,59879,'Blood Plague'),(1,6,59921,'Frost Fever'),(1,6,61437,'Opening'),(1,6,61455,'Runic Focus'),(1,8,81,'Dodge'),(1,8,133,'Fireball'),(1,8,168,'Frost Armor'),(1,8,203,'Unarmed'),(1,8,204,'Defense'),(1,8,227,'Staves'),(1,8,522,'SPELLDEFENSE (DND)'),(1,8,668,'Language Common'),(1,8,1843,'Disarm'),(1,8,2382,'Generic'),(1,8,2479,'Honorless Target'),(1,8,3050,'Detect'),(1,8,3365,'Opening'),(1,8,5009,'Wands'),(1,8,5019,'Shoot'),(1,8,6233,'Closing'),(1,8,6246,'Closing'),(1,8,6247,'Opening'),(1,8,6477,'Opening'),(1,8,6478,'Opening'),(1,8,6603,'Attack'),(1,8,7266,'Duel'),(1,8,7267,'Grovel'),(1,8,7355,'Stuck'),(1,8,8386,'Attacking'),(1,8,9078,'Cloth'),(1,8,9125,'Generic'),(1,8,20597,'Sword Specialization'),(1,8,20598,'The Human Spirit'),(1,8,20599,'Diplomacy'),(1,8,20864,'Mace Specialization'),(1,8,21651,'Opening'),(1,8,21652,'Closing'),(1,8,22027,'Remove Insignia'),(1,8,22810,'Opening - No Text'),(1,8,45927,'Summon Friend'),(1,8,58985,'Perception'),(1,8,59752,'Every Man for Himself'),(1,8,61437,'Opening'),(1,9,81,'Dodge'),(1,9,203,'Unarmed'),(1,9,204,'Defense'),(1,9,522,'SPELLDEFENSE (DND)'),(1,9,668,'Language Common'),(1,9,686,'Shadow Bolt'),(1,9,687,'Demon Skin'),(1,9,1180,'Daggers'),(1,9,1843,'Disarm'),(1,9,2382,'Generic'),(1,9,2479,'Honorless Target'),(1,9,3050,'Detect'),(1,9,3365,'Opening'),(1,9,5009,'Wands'),(1,9,5019,'Shoot'),(1,9,6233,'Closing'),(1,9,6246,'Closing'),(1,9,6247,'Opening'),(1,9,6477,'Opening'),(1,9,6478,'Opening'),(1,9,6603,'Attack'),(1,9,7266,'Duel'),(1,9,7267,'Grovel'),(1,9,7355,'Stuck'),(1,9,8386,'Attacking'),(1,9,9078,'Cloth'),(1,9,9125,'Generic'),(1,9,20597,'Sword Specialization'),(1,9,20598,'The Human Spirit'),(1,9,20599,'Diplomacy'),(1,9,20864,'Mace Specialization'),(1,9,21651,'Opening'),(1,9,21652,'Closing'),(1,9,22027,'Remove Insignia'),(1,9,22810,'Opening - No Text'),(1,9,45927,'Summon Friend'),(5,9,58284,'Chaos Bolt Passive'),(1,9,58985,'Perception'),(1,9,59752,'Every Man for Himself'),(1,9,61437,'Opening'),(2,1,78,'Heroic Strike'),(2,1,81,'Dodge'),(2,1,107,'Block'),(2,1,196,'One-Handed Axes'),(2,1,197,'Two-Handed Axes'),(2,1,201,'One-Handed Swords'),(2,1,203,'Unarmed'),(2,1,204,'Defense'),(2,1,522,'SPELLDEFENSE (DND)'),(2,1,669,'Language Orcish'),(2,1,1843,'Disarm'),(2,1,2382,'Generic'),(2,1,2457,'Battle Stance'),(2,1,2479,'Honorless Target'),(2,1,3050,'Detect'),(2,1,3365,'Opening'),(2,1,5301,'Defensive State (DND)'),(2,1,6233,'Closing'),(2,1,6246,'Closing'),(2,1,6247,'Opening'),(2,1,6477,'Opening'),(2,1,6478,'Opening'),(2,1,6603,'Attack'),(2,1,7266,'Duel'),(2,1,7267,'Grovel'),(2,1,7355,'Stuck'),(2,1,8386,'Attacking'),(2,1,8737,'Mail'),(2,1,9077,'Leather'),(2,1,9078,'Cloth'),(2,1,9116,'Shield'),(2,1,9125,'Generic'),(2,1,20572,'Blood Fury'),(2,1,20573,'Hardiness'),(2,1,20574,'Axe Specialization'),(2,1,21563,'Command'),(2,1,21651,'Opening'),(2,1,21652,'Closing'),(2,1,22027,'Remove Insignia'),(2,1,22810,'Opening - No Text'),(2,1,32215,'Victorious State'),(2,1,45927,'Summon Friend'),(2,1,61437,'Opening'),(2,3,75,'Auto Shot'),(2,3,81,'Dodge'),(2,3,196,'One-Handed Axes'),(2,3,203,'Unarmed'),(2,3,204,'Defense'),(2,3,264,'Bows'),(2,3,522,'SPELLDEFENSE (DND)'),(2,3,669,'Language Orcish'),(2,3,1843,'Disarm'),(2,3,2382,'Generic'),(2,3,2479,'Honorless Target'),(2,3,2973,'Raptor Strike'),(2,3,3050,'Detect'),(2,3,3365,'Opening'),(2,3,6233,'Closing'),(2,3,6246,'Closing'),(2,3,6247,'Opening'),(2,3,6477,'Opening'),(2,3,6478,'Opening'),(2,3,6603,'Attack'),(2,3,7266,'Duel'),(2,3,7267,'Grovel'),(2,3,7355,'Stuck'),(2,3,8386,'Attacking'),(2,3,9077,'Leather'),(2,3,9078,'Cloth'),(2,3,9125,'Generic'),(2,3,13358,'Defensive State (DND)'),(2,3,20572,'Blood Fury'),(2,3,20573,'Hardiness'),(2,3,20574,'Axe Specialization'),(2,3,20576,'Command'),(2,3,21651,'Opening'),(2,3,21652,'Closing'),(2,3,22027,'Remove Insignia'),(2,3,22810,'Opening - No Text'),(2,3,24949,'Defensive State 2 (DND)'),(2,3,34082,'Advantaged State (DND)'),(2,3,45927,'Summon Friend'),(2,3,61437,'Opening'),(2,4,81,'Dodge'),(2,4,203,'Unarmed'),(2,4,204,'Defense'),(2,4,522,'SPELLDEFENSE (DND)'),(2,4,669,'Language Orcish'),(2,4,1180,'Daggers'),(2,4,1752,'Sinister Strike'),(2,4,1843,'Disarm'),(2,4,2098,'Eviscerate'),(2,4,2382,'Generic'),(2,4,2479,'Honorless Target'),(2,4,2567,'Thrown'),(2,4,2764,'Throw'),(2,4,3050,'Detect'),(2,4,3365,'Opening'),(2,4,6233,'Closing'),(2,4,6246,'Closing'),(2,4,6247,'Opening'),(2,4,6477,'Opening'),(2,4,6478,'Opening'),(2,4,6603,'Attack'),(2,4,7266,'Duel'),(2,4,7267,'Grovel'),(2,4,7355,'Stuck'),(2,4,8386,'Attacking'),(2,4,9077,'Leather'),(2,4,9078,'Cloth'),(2,4,9125,'Generic'),(2,4,16092,'Defensive State (DND)'),(2,4,20572,'Blood Fury'),(2,4,20573,'Hardiness'),(2,4,20574,'Axe Specialization'),(2,4,21184,'Rogue Passive (DND)'),(2,4,21563,'Command'),(2,4,21651,'Opening'),(2,4,21652,'Closing'),(2,4,22027,'Remove Insignia'),(2,4,22810,'Opening - No Text'),(2,4,45927,'Summon Friend'),(2,4,61437,'Opening'),(2,6,81,'Dodge'),(2,6,196,'One-Handed Axes'),(2,6,197,'Two-Handed Axes'),(2,6,200,'Polearms'),(2,6,201,'One-Handed Swords'),(2,6,202,'Two-Handed Swords'),(2,6,203,'Unarmed'),(2,6,204,'Defense'),(2,6,522,'SPELLDEFENSE (DND)'),(2,6,669,'Language Orcish'),(2,6,674,'Dual Wield'),(2,6,750,'Plate Mail'),(2,6,1843,'Disarm'),(2,6,2382,'Generic'),(2,6,2479,'Honorless Target'),(2,6,3050,'Detect'),(2,6,3127,'Parry'),(2,6,3275,'Linen Bandage'),(2,6,3276,'Heavy Linen Bandage'),(2,6,3277,'Wool Bandage'),(2,6,3278,'Heavy Wool Bandage'),(2,6,3365,'Opening'),(2,6,6233,'Closing'),(2,6,6246,'Closing'),(2,6,6247,'Opening'),(2,6,6477,'Opening'),(2,6,6478,'Opening'),(2,6,6603,'Attack'),(2,6,7266,'Duel'),(2,6,7267,'Grovel'),(2,6,7355,'Stuck'),(2,6,7928,'Silk Bandage'),(2,6,7929,'Heavy Silk Bandage'),(2,6,7934,'Anti-Venom'),(2,6,8386,'Attacking'),(2,6,8737,'Mail'),(2,6,9077,'Leather'),(2,6,9078,'Cloth'),(2,6,9125,'Generic'),(2,6,10840,'Mageweave Bandage'),(2,6,10841,'Heavy Mageweave Bandage'),(2,6,10846,'First Aid'),(2,6,18629,'Runecloth Bandage'),(2,6,18630,'Heavy Runecloth Bandage'),(2,6,20572,'Blood Fury'),(2,6,20573,'Hardiness'),(2,6,20574,'Axe Specialization'),(2,6,21651,'Opening'),(2,6,21652,'Closing'),(2,6,22027,'Remove Insignia'),(2,6,22810,'Opening - No Text'),(2,6,33391,'Journeyman Riding'),(2,6,45462,'Plague Strike'),(2,6,45477,'Icy Touch'),(2,6,45902,'Blood Strike'),(2,6,45903,'Offensive State (DND)'),(2,6,45927,'Summon Friend'),(2,6,47541,'Death Coil'),(2,6,48266,'Blood Presence'),(2,6,49410,'Forceful Deflection'),(2,6,49576,'Death Grip'),(2,6,52665,'Sigil'),(2,6,54562,'Command'),(2,6,59879,'Blood Plague'),(2,6,59921,'Frost Fever'),(2,6,61437,'Opening'),(2,6,61455,'Runic Focus'),(2,7,81,'Dodge'),(2,7,107,'Block'),(2,7,198,'One-Handed Maces'),(2,7,203,'Unarmed'),(2,7,204,'Defense'),(2,7,227,'Staves'),(2,7,331,'Healing Wave'),(2,7,403,'Lightning Bolt'),(2,7,522,'SPELLDEFENSE (DND)'),(2,7,669,'Language Orcish'),(2,7,1843,'Disarm'),(2,7,2382,'Generic'),(2,7,2479,'Honorless Target'),(2,7,3050,'Detect'),(2,7,3365,'Opening'),(2,7,6233,'Closing'),(2,7,6246,'Closing'),(2,7,6247,'Opening'),(2,7,6477,'Opening'),(2,7,6478,'Opening'),(2,7,6603,'Attack'),(2,7,7266,'Duel'),(2,7,7267,'Grovel'),(2,7,7355,'Stuck'),(2,7,8386,'Attacking'),(2,7,9077,'Leather'),(2,7,9078,'Cloth'),(2,7,9116,'Shield'),(2,7,9125,'Generic'),(2,7,20573,'Hardiness'),(2,7,20574,'Axe Specialization'),(2,7,21563,'Command'),(2,7,21651,'Opening'),(2,7,21652,'Closing'),(2,7,22027,'Remove Insignia'),(2,7,22810,'Opening - No Text'),(2,7,27763,'Totem'),(2,7,33697,'Blood Fury'),(2,7,45927,'Summon Friend'),(2,7,61437,'Opening'),(2,9,81,'Dodge'),(2,9,203,'Unarmed'),(2,9,204,'Defense'),(2,9,522,'SPELLDEFENSE (DND)'),(2,9,669,'Language Orcish'),(2,9,686,'Shadow Bolt'),(2,9,687,'Demon Skin'),(2,9,1180,'Daggers'),(2,9,1843,'Disarm'),(2,9,2382,'Generic'),(2,9,2479,'Honorless Target'),(2,9,3050,'Detect'),(2,9,3365,'Opening'),(2,9,5009,'Wands'),(2,9,5019,'Shoot'),(2,9,6233,'Closing'),(2,9,6246,'Closing'),(2,9,6247,'Opening'),(2,9,6477,'Opening'),(2,9,6478,'Opening'),(2,9,6603,'Attack'),(2,9,7266,'Duel'),(2,9,7267,'Grovel'),(2,9,7355,'Stuck'),(2,9,8386,'Attacking'),(2,9,9078,'Cloth'),(2,9,9125,'Generic'),(2,9,20573,'Hardiness'),(2,9,20574,'Axe Specialization'),(2,9,20575,'Command'),(2,9,21651,'Opening'),(2,9,21652,'Closing'),(2,9,22027,'Remove Insignia'),(2,9,22810,'Opening - No Text'),(2,9,33702,'Blood Fury'),(2,9,45927,'Summon Friend'),(2,9,58284,'Chaos Bolt Passive'),(2,9,61437,'Opening'),(3,1,78,'Heroic Strike'),(3,1,81,'Dodge'),(3,1,107,'Block'),(3,1,196,'One-Handed Axes'),(3,1,197,'Two-Handed Axes'),(3,1,198,'One-Handed Maces'),(3,1,203,'Unarmed'),(3,1,204,'Defense'),(3,1,522,'SPELLDEFENSE (DND)'),(3,1,668,'Language Common'),(3,1,672,'Language Dwarven'),(3,1,1843,'Disarm'),(3,1,2382,'Generic'),(3,1,2457,'Battle Stance'),(3,1,2479,'Honorless Target'),(3,1,2481,'Find Treasure'),(3,1,3050,'Detect'),(3,1,3365,'Opening'),(3,1,5301,'Defensive State (DND)'),(3,1,6233,'Closing'),(3,1,6246,'Closing'),(3,1,6247,'Opening'),(3,1,6477,'Opening'),(3,1,6478,'Opening'),(3,1,6603,'Attack'),(3,1,7266,'Duel'),(3,1,7267,'Grovel'),(3,1,7355,'Stuck'),(3,1,8386,'Attacking'),(3,1,8737,'Mail'),(3,1,9077,'Leather'),(3,1,9078,'Cloth'),(3,1,9116,'Shield'),(3,1,9125,'Generic'),(3,1,20594,'Stoneform'),(3,1,20595,'Gun Specialization'),(3,1,20596,'Frost Resistance'),(3,1,21651,'Opening'),(3,1,21652,'Closing'),(3,1,22027,'Remove Insignia'),(3,1,22810,'Opening - No Text'),(3,1,32215,'Victorious State'),(3,1,45927,'Summon Friend'),(3,1,59224,'Mace Specialization'),(3,1,61437,'Opening'),(3,2,81,'Dodge'),(3,2,107,'Block'),(3,2,198,'One-Handed Maces'),(3,2,199,'Two-Handed Maces'),(3,2,203,'Unarmed'),(3,2,204,'Defense'),(3,2,522,'SPELLDEFENSE (DND)'),(3,2,635,'Holy Light'),(3,2,668,'Language Common'),(3,2,672,'Language Dwarven'),(3,2,1843,'Disarm'),(3,2,2382,'Generic'),(3,2,2479,'Honorless Target'),(3,2,2481,'Find Treasure'),(3,2,3050,'Detect'),(3,2,3365,'Opening'),(3,2,6233,'Closing'),(3,2,6246,'Closing'),(3,2,6247,'Opening'),(3,2,6477,'Opening'),(3,2,6478,'Opening'),(3,2,6603,'Attack'),(3,2,7266,'Duel'),(3,2,7267,'Grovel'),(3,2,7355,'Stuck'),(3,2,8386,'Attacking'),(3,2,8737,'Mail'),(3,2,9077,'Leather'),(3,2,9078,'Cloth'),(3,2,9116,'Shield'),(3,2,9125,'Generic'),(3,2,21084,'Seal of Righteousness'),(3,2,20594,'Stoneform'),(3,2,20595,'Gun Specialization'),(3,2,20596,'Frost Resistance'),(3,2,21651,'Opening'),(3,2,21652,'Closing'),(3,2,22027,'Remove Insignia'),(3,2,22810,'Opening - No Text'),(3,2,27762,'Libram'),(3,2,45927,'Summon Friend'),(3,2,59224,'Mace Specialization'),(3,2,61437,'Opening'),(3,3,75,'Auto Shot'),(3,3,81,'Dodge'),(3,3,196,'One-Handed Axes'),(3,3,203,'Unarmed'),(3,3,204,'Defense'),(3,3,266,'Guns'),(3,3,522,'SPELLDEFENSE (DND)'),(3,3,668,'Language Common'),(3,3,672,'Language Dwarven'),(3,3,1843,'Disarm'),(3,3,2382,'Generic'),(3,3,2479,'Honorless Target'),(3,3,2481,'Find Treasure'),(3,3,2973,'Raptor Strike'),(3,3,3050,'Detect'),(3,3,3365,'Opening'),(3,3,6233,'Closing'),(3,3,6246,'Closing'),(3,3,6247,'Opening'),(3,3,6477,'Opening'),(3,3,6478,'Opening'),(3,3,6603,'Attack'),(3,3,7266,'Duel'),(3,3,7267,'Grovel'),(3,3,7355,'Stuck'),(3,3,8386,'Attacking'),(3,3,9077,'Leather'),(3,3,9078,'Cloth'),(3,3,9125,'Generic'),(3,3,13358,'Defensive State (DND)'),(3,3,20594,'Stoneform'),(3,3,20595,'Gun Specialization'),(3,3,20596,'Frost Resistance'),(3,3,21651,'Opening'),(3,3,21652,'Closing'),(3,3,22027,'Remove Insignia'),(3,3,22810,'Opening - No Text'),(3,3,24949,'Defensive State 2 (DND)'),(3,3,34082,'Advantaged State (DND)'),(3,3,45927,'Summon Friend'),(3,3,59224,'Mace Specialization'),(3,3,61437,'Opening'),(3,4,81,'Dodge'),(3,4,203,'Unarmed'),(3,4,204,'Defense'),(3,4,522,'SPELLDEFENSE (DND)'),(3,4,668,'Language Common'),(3,4,672,'Language Dwarven'),(3,4,1180,'Daggers'),(3,4,1752,'Sinister Strike'),(3,4,1843,'Disarm'),(3,4,2098,'Eviscerate'),(3,4,2382,'Generic'),(3,4,2479,'Honorless Target'),(3,4,2481,'Find Treasure'),(3,4,2567,'Thrown'),(3,4,2764,'Throw'),(3,4,3050,'Detect'),(3,4,3365,'Opening'),(3,4,6233,'Closing'),(3,4,6246,'Closing'),(3,4,6247,'Opening'),(3,4,6477,'Opening'),(3,4,6478,'Opening'),(3,4,6603,'Attack'),(3,4,7266,'Duel'),(3,4,7267,'Grovel'),(3,4,7355,'Stuck'),(3,4,8386,'Attacking'),(3,4,9077,'Leather'),(3,4,9078,'Cloth'),(3,4,9125,'Generic'),(3,4,16092,'Defensive State (DND)'),(3,4,20594,'Stoneform'),(3,4,20595,'Gun Specialization'),(3,4,20596,'Frost Resistance'),(3,4,21184,'Rogue Passive (DND)'),(3,4,21651,'Opening'),(3,4,21652,'Closing'),(3,4,22027,'Remove Insignia'),(3,4,22810,'Opening - No Text'),(3,4,45927,'Summon Friend'),(3,4,59224,'Mace Specialization'),(3,4,61437,'Opening'),(3,5,81,'Dodge'),(3,5,198,'One-Handed Maces'),(3,5,203,'Unarmed'),(3,5,204,'Defense'),(3,5,522,'SPELLDEFENSE (DND)'),(3,5,585,'Smite'),(3,5,668,'Language Common'),(3,5,672,'Language Dwarven'),(3,5,1843,'Disarm'),(3,5,2050,'Lesser Heal'),(3,5,2382,'Generic'),(3,5,2479,'Honorless Target'),(3,5,2481,'Find Treasure'),(3,5,3050,'Detect'),(3,5,3365,'Opening'),(3,5,5009,'Wands'),(3,5,5019,'Shoot'),(3,5,6233,'Closing'),(3,5,6246,'Closing'),(3,5,6247,'Opening'),(3,5,6477,'Opening'),(3,5,6478,'Opening'),(3,5,6603,'Attack'),(3,5,7266,'Duel'),(3,5,7267,'Grovel'),(3,5,7355,'Stuck'),(3,5,8386,'Attacking'),(3,5,9078,'Cloth'),(3,5,9125,'Generic'),(3,5,20594,'Stoneform'),(3,5,20595,'Gun Specialization'),(3,5,20596,'Frost Resistance'),(3,5,21651,'Opening'),(3,5,21652,'Closing'),(3,5,22027,'Remove Insignia'),(3,5,22810,'Opening - No Text'),(3,5,45927,'Summon Friend'),(3,5,59224,'Mace Specialization'),(3,5,61437,'Opening'),(3,6,81,'Dodge'),(3,6,196,'One-Handed Axes'),(3,6,197,'Two-Handed Axes'),(3,6,200,'Polearms'),(3,6,201,'One-Handed Swords'),(3,6,202,'Two-Handed Swords'),(3,6,203,'Unarmed'),(3,6,204,'Defense'),(3,6,522,'SPELLDEFENSE (DND)'),(3,6,668,'Language Common'),(3,6,672,'Language Dwarven'),(3,6,674,'Dual Wield'),(3,6,750,'Plate Mail'),(3,6,1843,'Disarm'),(3,6,2382,'Generic'),(3,6,2479,'Honorless Target'),(3,6,2481,'Find Treasure'),(3,6,3050,'Detect'),(3,6,3127,'Parry'),(3,6,3275,'Linen Bandage'),(3,6,3276,'Heavy Linen Bandage'),(3,6,3277,'Wool Bandage'),(3,6,3278,'Heavy Wool Bandage'),(3,6,3365,'Opening'),(3,6,6233,'Closing'),(3,6,6246,'Closing'),(3,6,6247,'Opening'),(3,6,6477,'Opening'),(3,6,6478,'Opening'),(3,6,6603,'Attack'),(3,6,7266,'Duel'),(3,6,7267,'Grovel'),(3,6,7355,'Stuck'),(3,6,7928,'Silk Bandage'),(3,6,7929,'Heavy Silk Bandage'),(3,6,7934,'Anti-Venom'),(3,6,8386,'Attacking'),(3,6,8737,'Mail'),(3,6,9077,'Leather'),(3,6,9078,'Cloth'),(3,6,9125,'Generic'),(3,6,10840,'Mageweave Bandage'),(3,6,10841,'Heavy Mageweave Bandage'),(3,6,10846,'First Aid'),(3,6,18629,'Runecloth Bandage'),(3,6,18630,'Heavy Runecloth Bandage'),(3,6,20594,'Stoneform'),(3,6,20595,'Gun Specialization'),(3,6,20596,'Frost Resistance'),(3,6,21651,'Opening'),(3,6,21652,'Closing'),(3,6,22027,'Remove Insignia'),(3,6,22810,'Opening - No Text'),(3,6,33391,'Journeyman Riding'),(3,6,45462,'Plague Strike'),(3,6,45477,'Icy Touch'),(3,6,45902,'Blood Strike'),(3,6,45903,'Offensive State (DND)'),(3,6,45927,'Summon Friend'),(3,6,47541,'Death Coil'),(3,6,48266,'Blood Presence'),(3,6,49410,'Forceful Deflection'),(3,6,49576,'Death Grip'),(3,6,52665,'Sigil'),(3,6,59224,'Mace Specialization'),(3,6,59879,'Blood Plague'),(3,6,59921,'Frost Fever'),(3,6,61437,'Opening'),(3,6,61455,'Runic Focus'),(4,1,78,'Heroic Strike'),(4,1,81,'Dodge'),(4,1,107,'Block'),(4,1,198,'One-Handed Maces'),(4,1,201,'One-Handed Swords'),(4,1,203,'Unarmed'),(4,1,204,'Defense'),(4,1,522,'SPELLDEFENSE (DND)'),(4,1,668,'Language Common'),(4,1,671,'Language Darnassian'),(4,1,1180,'Daggers'),(4,1,1843,'Disarm'),(4,1,2382,'Generic'),(4,1,2457,'Battle Stance'),(4,1,2479,'Honorless Target'),(4,1,3050,'Detect'),(4,1,3365,'Opening'),(4,1,5301,'Defensive State (DND)'),(4,1,6233,'Closing'),(4,1,6246,'Closing'),(4,1,6247,'Opening'),(4,1,6477,'Opening'),(4,1,6478,'Opening'),(4,1,6603,'Attack'),(4,1,7266,'Duel'),(4,1,7267,'Grovel'),(4,1,7355,'Stuck'),(4,1,8386,'Attacking'),(4,1,8737,'Mail'),(4,1,9077,'Leather'),(4,1,9078,'Cloth'),(4,1,9116,'Shield'),(4,1,9125,'Generic'),(4,1,20582,'Quickness'),(4,1,20583,'Nature Resistance'),(4,1,20585,'Wisp Spirit'),(4,1,21651,'Opening'),(4,1,21652,'Closing'),(4,1,22027,'Remove Insignia'),(4,1,22810,'Opening - No Text'),(4,1,32215,'Victorious State'),(4,1,45927,'Summon Friend'),(4,1,58984,'Shadowmelt'),(4,1,61437,'Opening'),(4,3,75,'Auto Shot'),(4,3,81,'Dodge'),(4,3,203,'Unarmed'),(4,3,204,'Defense'),(4,3,264,'Bows'),(4,3,522,'SPELLDEFENSE (DND)'),(4,3,668,'Language Common'),(4,3,671,'Language Darnassian'),(4,3,1180,'Daggers'),(4,3,1843,'Disarm'),(4,3,2382,'Generic'),(4,3,2479,'Honorless Target'),(4,3,2973,'Raptor Strike'),(4,3,3050,'Detect'),(4,3,3365,'Opening'),(4,3,6233,'Closing'),(4,3,6246,'Closing'),(4,3,6247,'Opening'),(4,3,6477,'Opening'),(4,3,6478,'Opening'),(4,3,6603,'Attack'),(4,3,7266,'Duel'),(4,3,7267,'Grovel'),(4,3,7355,'Stuck'),(4,3,8386,'Attacking'),(4,3,9077,'Leather'),(4,3,9078,'Cloth'),(4,3,9125,'Generic'),(4,3,13358,'Defensive State (DND)'),(4,3,20582,'Quickness'),(4,3,20583,'Nature Resistance'),(4,3,20585,'Wisp Spirit'),(4,3,21651,'Opening'),(4,3,21652,'Closing'),(4,3,22027,'Remove Insignia'),(4,3,22810,'Opening - No Text'),(4,3,24949,'Defensive State 2 (DND)'),(4,3,34082,'Advantaged State (DND)'),(4,3,45927,'Summon Friend'),(4,3,58984,'Shadowmelt'),(4,3,61437,'Opening'),(4,4,81,'Dodge'),(4,4,203,'Unarmed'),(4,4,204,'Defense'),(4,4,522,'SPELLDEFENSE (DND)'),(4,4,668,'Language Common'),(4,4,671,'Language Darnassian'),(4,4,1180,'Daggers'),(4,4,1752,'Sinister Strike'),(4,4,1843,'Disarm'),(4,4,2098,'Eviscerate'),(4,4,2382,'Generic'),(4,4,2479,'Honorless Target'),(4,4,2567,'Thrown'),(4,4,2764,'Throw'),(4,4,3050,'Detect'),(4,4,3365,'Opening'),(4,4,6233,'Closing'),(4,4,6246,'Closing'),(4,4,6247,'Opening'),(4,4,6477,'Opening'),(4,4,6478,'Opening'),(4,4,6603,'Attack'),(4,4,7266,'Duel'),(4,4,7267,'Grovel'),(4,4,7355,'Stuck'),(4,4,8386,'Attacking'),(4,4,9077,'Leather'),(4,4,9078,'Cloth'),(4,4,9125,'Generic'),(4,4,16092,'Defensive State (DND)'),(4,4,20582,'Quickness'),(4,4,20583,'Nature Resistance'),(4,4,20585,'Wisp Spirit'),(4,4,21184,'Rogue Passive (DND)'),(4,4,21651,'Opening'),(4,4,21652,'Closing'),(4,4,22027,'Remove Insignia'),(4,4,22810,'Opening - No Text'),(4,4,45927,'Summon Friend'),(4,4,58984,'Shadowmelt'),(4,4,61437,'Opening'),(4,5,81,'Dodge'),(4,5,198,'One-Handed Maces'),(4,5,203,'Unarmed'),(4,5,204,'Defense'),(4,5,522,'SPELLDEFENSE (DND)'),(4,5,585,'Smite'),(4,5,668,'Language Common'),(4,5,671,'Language Darnassian'),(4,5,1843,'Disarm'),(4,5,2050,'Lesser Heal'),(4,5,2382,'Generic'),(4,5,2479,'Honorless Target'),(4,5,3050,'Detect'),(4,5,3365,'Opening'),(4,5,5009,'Wands'),(4,5,5019,'Shoot'),(4,5,6233,'Closing'),(4,5,6246,'Closing'),(4,5,6247,'Opening'),(4,5,6477,'Opening'),(4,5,6478,'Opening'),(4,5,6603,'Attack'),(4,5,7266,'Duel'),(4,5,7267,'Grovel'),(4,5,7355,'Stuck'),(4,5,8386,'Attacking'),(4,5,9078,'Cloth'),(4,5,9125,'Generic'),(4,5,20582,'Quickness'),(4,5,20583,'Nature Resistance'),(4,5,20585,'Wisp Spirit'),(4,5,21651,'Opening'),(4,5,21652,'Closing'),(4,5,22027,'Remove Insignia'),(4,5,22810,'Opening - No Text'),(4,5,45927,'Summon Friend'),(4,5,58984,'Shadowmelt'),(4,5,61437,'Opening'),(4,6,81,'Dodge'),(4,6,196,'One-Handed Axes'),(4,6,197,'Two-Handed Axes'),(4,6,200,'Polearms'),(4,6,201,'One-Handed Swords'),(4,6,202,'Two-Handed Swords'),(4,6,203,'Unarmed'),(4,6,204,'Defense'),(4,6,522,'SPELLDEFENSE (DND)'),(4,6,668,'Language Common'),(4,6,671,'Language Darnassian'),(4,6,674,'Dual Wield'),(4,6,750,'Plate Mail'),(4,6,1843,'Disarm'),(4,6,2382,'Generic'),(4,6,2479,'Honorless Target'),(4,6,3050,'Detect'),(4,6,3127,'Parry'),(4,6,3275,'Linen Bandage'),(4,6,3276,'Heavy Linen Bandage'),(4,6,3277,'Wool Bandage'),(4,6,3278,'Heavy Wool Bandage'),(4,6,3365,'Opening'),(4,6,6233,'Closing'),(4,6,6246,'Closing'),(4,6,6247,'Opening'),(4,6,6477,'Opening'),(4,6,6478,'Opening'),(4,6,6603,'Attack'),(4,6,7266,'Duel'),(4,6,7267,'Grovel'),(4,6,7355,'Stuck'),(4,6,7928,'Silk Bandage'),(4,6,7929,'Heavy Silk Bandage'),(4,6,7934,'Anti-Venom'),(4,6,8386,'Attacking'),(4,6,8737,'Mail'),(4,6,9077,'Leather'),(4,6,9078,'Cloth'),(4,6,9125,'Generic'),(4,6,10840,'Mageweave Bandage'),(4,6,10841,'Heavy Mageweave Bandage'),(4,6,10846,'First Aid'),(4,6,18629,'Runecloth Bandage'),(4,6,18630,'Heavy Runecloth Bandage'),(4,6,20582,'Quickness'),(4,6,20583,'Nature Resistance'),(4,6,20585,'Wisp Spirit'),(4,6,21651,'Opening'),(4,6,21652,'Closing'),(4,6,22027,'Remove Insignia'),(4,6,22810,'Opening - No Text'),(4,6,33391,'Journeyman Riding'),(4,6,45462,'Plague Strike'),(4,6,45477,'Icy Touch'),(4,6,45902,'Blood Strike'),(4,6,45903,'Offensive State (DND)'),(4,6,45927,'Summon Friend'),(4,6,47541,'Death Coil'),(4,6,48266,'Blood Presence'),(4,6,49410,'Forceful Deflection'),(4,6,49576,'Death Grip'),(4,6,52665,'Sigil'),(4,6,58984,'Shadowmeld'),(4,6,59879,'Blood Plague'),(4,6,59921,'Frost Fever'),(4,6,61437,'Opening'),(4,6,61455,'Runic Focus'),(4,11,81,'Dodge'),(4,11,203,'Unarmed'),(4,11,204,'Defense'),(4,11,227,'Staves'),(4,11,522,'SPELLDEFENSE (DND)'),(4,11,668,'Language Common'),(4,11,671,'Language Darnassian'),(4,11,1180,'Daggers'),(4,11,1843,'Disarm'),(4,11,2382,'Generic'),(4,11,2479,'Honorless Target'),(4,11,3050,'Detect'),(4,11,3365,'Opening'),(4,11,5176,'Wrath'),(4,11,5185,'Healing Touch'),(4,11,6233,'Closing'),(4,11,6246,'Closing'),(4,11,6247,'Opening'),(4,11,6477,'Opening'),(4,11,6478,'Opening'),(4,11,6603,'Attack'),(4,11,7266,'Duel'),(4,11,7267,'Grovel'),(4,11,7355,'Stuck'),(4,11,8386,'Attacking'),(4,11,9077,'Leather'),(4,11,9078,'Cloth'),(4,11,9125,'Generic'),(4,11,20582,'Quickness'),(4,11,20583,'Nature Resistance'),(4,11,20585,'Wisp Spirit'),(4,11,21651,'Opening'),(4,11,21652,'Closing'),(4,11,22027,'Remove Insignia'),(4,11,22810,'Opening - No Text'),(4,11,27764,'Fetish'),(4,11,45927,'Summon Friend'),(4,11,58984,'Shadowmelt'),(4,11,61437,'Opening'),(5,1,78,'Heroic Strike'),(5,1,81,'Dodge'),(5,1,107,'Block'),(5,1,201,'One-Handed Swords'),(5,1,202,'Two-Handed Swords'),(5,1,203,'Unarmed'),(5,1,204,'Defense'),(5,1,522,'SPELLDEFENSE (DND)'),(5,1,669,'Language Orcish'),(5,1,1180,'Daggers'),(5,1,1843,'Disarm'),(5,1,2382,'Generic'),(5,1,2457,'Battle Stance'),(5,1,2479,'Honorless Target'),(5,1,3050,'Detect'),(5,1,3365,'Opening'),(5,1,5227,'Underwater Breathing'),(5,1,5301,'Defensive State (DND)'),(5,1,6233,'Closing'),(5,1,6246,'Closing'),(5,1,6247,'Opening'),(5,1,6477,'Opening'),(5,1,6478,'Opening'),(5,1,6603,'Attack'),(5,1,7266,'Duel'),(5,1,7267,'Grovel'),(5,1,7355,'Stuck'),(5,1,7744,'Will of the Forsaken'),(5,1,8386,'Attacking'),(5,1,8737,'Mail'),(5,1,9077,'Leather'),(5,1,9078,'Cloth'),(5,1,9116,'Shield'),(5,1,9125,'Generic'),(5,1,17737,'Language Gutterspeak'),(5,1,20577,'Cannibalize'),(5,1,20579,'Shadow Resistance'),(5,1,21651,'Opening'),(5,1,21652,'Closing'),(5,1,22027,'Remove Insignia'),(5,1,22810,'Opening - No Text'),(5,1,32215,'Victorious State'),(5,1,45927,'Summon Friend'),(5,1,61437,'Opening'),(5,4,81,'Dodge'),(5,4,203,'Unarmed'),(5,4,204,'Defense'),(5,4,522,'SPELLDEFENSE (DND)'),(5,4,669,'Language Orcish'),(5,4,1180,'Daggers'),(5,4,1752,'Sinister Strike'),(5,4,1843,'Disarm'),(5,4,2098,'Eviscerate'),(5,4,2382,'Generic'),(5,4,2479,'Honorless Target'),(5,4,2567,'Thrown'),(5,4,2764,'Throw'),(5,4,3050,'Detect'),(5,4,3365,'Opening'),(5,4,5227,'Underwater Breathing'),(5,4,6233,'Closing'),(5,4,6246,'Closing'),(5,4,6247,'Opening'),(5,4,6477,'Opening'),(5,4,6478,'Opening'),(5,4,6603,'Attack'),(5,4,7266,'Duel'),(5,4,7267,'Grovel'),(5,4,7355,'Stuck'),(5,4,7744,'Will of the Forsaken'),(5,4,8386,'Attacking'),(5,4,9077,'Leather'),(5,4,9078,'Cloth'),(5,4,9125,'Generic'),(5,4,16092,'Defensive State (DND)'),(5,4,17737,'Language Gutterspeak'),(5,4,20577,'Cannibalize'),(5,4,20579,'Shadow Resistance'),(5,4,21184,'Rogue Passive (DND)'),(5,4,21651,'Opening'),(5,4,21652,'Closing'),(5,4,22027,'Remove Insignia'),(5,4,22810,'Opening - No Text'),(5,4,45927,'Summon Friend'),(5,4,61437,'Opening'),(5,5,81,'Dodge'),(5,5,198,'One-Handed Maces'),(5,5,203,'Unarmed'),(5,5,204,'Defense'),(5,5,522,'SPELLDEFENSE (DND)'),(5,5,585,'Smite'),(5,5,669,'Language Orcish'),(5,5,1843,'Disarm'),(5,5,2050,'Lesser Heal'),(5,5,2382,'Generic'),(5,5,2479,'Honorless Target'),(5,5,3050,'Detect'),(5,5,3365,'Opening'),(5,5,5009,'Wands'),(5,5,5019,'Shoot'),(5,5,5227,'Underwater Breathing'),(5,5,6233,'Closing'),(5,5,6246,'Closing'),(5,5,6247,'Opening'),(5,5,6477,'Opening'),(5,5,6478,'Opening'),(5,5,6603,'Attack'),(5,5,7266,'Duel'),(5,5,7267,'Grovel'),(5,5,7355,'Stuck'),(5,5,7744,'Will of the Forsaken'),(5,5,8386,'Attacking'),(5,5,9078,'Cloth'),(5,5,9125,'Generic'),(5,5,17737,'Language Gutterspeak'),(5,5,20577,'Cannibalize'),(5,5,20579,'Shadow Resistance'),(5,5,21651,'Opening'),(5,5,21652,'Closing'),(5,5,22027,'Remove Insignia'),(5,5,22810,'Opening - No Text'),(5,5,45927,'Summon Friend'),(5,5,61437,'Opening'),(5,6,81,'Dodge'),(5,6,196,'One-Handed Axes'),(5,6,197,'Two-Handed Axes'),(5,6,200,'Polearms'),(5,6,201,'One-Handed Swords'),(5,6,202,'Two-Handed Swords'),(5,6,203,'Unarmed'),(5,6,204,'Defense'),(5,6,522,'SPELLDEFENSE (DND)'),(5,6,669,'Language Orcish'),(5,6,674,'Dual Wield'),(5,6,750,'Plate Mail'),(5,6,1843,'Disarm'),(5,6,2382,'Generic'),(5,6,2479,'Honorless Target'),(5,6,3050,'Detect'),(5,6,3127,'Parry'),(5,6,3275,'Linen Bandage'),(5,6,3276,'Heavy Linen Bandage'),(5,6,3277,'Wool Bandage'),(5,6,3278,'Heavy Wool Bandage'),(5,6,3365,'Opening'),(5,6,5227,'Underwater Breathing'),(5,6,6233,'Closing'),(5,6,6246,'Closing'),(5,6,6247,'Opening'),(5,6,6477,'Opening'),(5,6,6478,'Opening'),(5,6,6603,'Attack'),(5,6,7266,'Duel'),(5,6,7267,'Grovel'),(5,6,7355,'Stuck'),(5,6,7744,'Will of the Forsaken'),(5,6,7928,'Silk Bandage'),(5,6,7929,'Heavy Silk Bandage'),(5,6,7934,'Anti-Venom'),(5,6,8386,'Attacking'),(5,6,8737,'Mail'),(5,6,9077,'Leather'),(5,6,9078,'Cloth'),(5,6,9125,'Generic'),(5,6,10840,'Mageweave Bandage'),(5,6,10841,'Heavy Mageweave Bandage'),(5,6,10846,'First Aid'),(5,6,17737,'Language Gutterspeak'),(5,6,18629,'Runecloth Bandage'),(5,6,18630,'Heavy Runecloth Bandage'),(5,6,20577,'Cannibalize'),(5,6,20579,'Shadow Resistance'),(5,6,21651,'Opening'),(5,6,21652,'Closing'),(5,6,22027,'Remove Insignia'),(5,6,22810,'Opening - No Text'),(5,6,33391,'Journeyman Riding'),(5,6,45462,'Plague Strike'),(5,6,45477,'Icy Touch'),(5,6,45902,'Blood Strike'),(5,6,45903,'Offensive State (DND)'),(5,6,45927,'Summon Friend'),(5,6,47541,'Death Coil'),(5,6,48266,'Blood Presence'),(5,6,49410,'Forceful Deflection'),(5,6,49576,'Death Grip'),(5,6,52665,'Sigil'),(5,6,59879,'Blood Plague'),(5,6,59921,'Frost Fever'),(5,6,61437,'Opening'),(5,6,61455,'Runic Focus'),(5,8,81,'Dodge'),(5,8,133,'Fireball'),(5,8,168,'Frost Armor'),(5,8,203,'Unarmed'),(5,8,204,'Defense'),(5,8,227,'Staves'),(5,8,522,'SPELLDEFENSE (DND)'),(5,8,669,'Language Orcish'),(5,8,1843,'Disarm'),(5,8,2382,'Generic'),(5,8,2479,'Honorless Target'),(5,8,3050,'Detect'),(5,8,3365,'Opening'),(5,8,5009,'Wands'),(5,8,5019,'Shoot'),(5,8,5227,'Underwater Breathing'),(5,8,6233,'Closing'),(5,8,6246,'Closing'),(5,8,6247,'Opening'),(5,8,6477,'Opening'),(5,8,6478,'Opening'),(5,8,6603,'Attack'),(5,8,7266,'Duel'),(5,8,7267,'Grovel'),(5,8,7355,'Stuck'),(5,8,7744,'Will of the Forsaken'),(5,8,8386,'Attacking'),(5,8,9078,'Cloth'),(5,8,9125,'Generic'),(5,8,17737,'Language Gutterspeak'),(5,8,20577,'Cannibalize'),(5,8,20579,'Shadow Resistance'),(5,8,21651,'Opening'),(5,8,21652,'Closing'),(5,8,22027,'Remove Insignia'),(5,8,22810,'Opening - No Text'),(5,8,45927,'Summon Friend'),(5,8,61437,'Opening'),(5,9,81,'Dodge'),(5,9,203,'Unarmed'),(5,9,204,'Defense'),(5,9,522,'SPELLDEFENSE (DND)'),(5,9,669,'Language Orcish'),(5,9,686,'Shadow Bolt'),(5,9,687,'Demon Skin'),(5,9,1180,'Daggers'),(5,9,1843,'Disarm'),(5,9,2382,'Generic'),(5,9,2479,'Honorless Target'),(5,9,3050,'Detect'),(5,9,3365,'Opening'),(5,9,5009,'Wands'),(5,9,5019,'Shoot'),(5,9,5227,'Underwater Breathing'),(5,9,6233,'Closing'),(5,9,6246,'Closing'),(5,9,6247,'Opening'),(5,9,6477,'Opening'),(5,9,6478,'Opening'),(5,9,6603,'Attack'),(5,9,7266,'Duel'),(5,9,7267,'Grovel'),(5,9,7355,'Stuck'),(5,9,7744,'Will of the Forsaken'),(5,9,8386,'Attacking'),(5,9,9078,'Cloth'),(5,9,9125,'Generic'),(5,9,17737,'Language Gutterspeak'),(5,9,20577,'Cannibalize'),(5,9,20579,'Shadow Resistance'),(5,9,21651,'Opening'),(5,9,21652,'Closing'),(5,9,22027,'Remove Insignia'),(5,9,22810,'Opening - No Text'),(5,9,45927,'Summon Friend'),(1,9,58284,'Chaos Bolt Passive'),(5,9,61437,'Opening'),(6,1,78,'Heroic Strike'),(6,1,81,'Dodge'),(6,1,107,'Block'),(6,1,196,'One-Handed Axes'),(6,1,198,'One-Handed Maces'),(6,1,199,'Two-Handed Maces'),(6,1,203,'Unarmed'),(6,1,204,'Defense'),(6,1,522,'SPELLDEFENSE (DND)'),(6,1,669,'Language Orcish'),(6,1,670,'Language Taurahe'),(6,1,1843,'Disarm'),(6,1,2382,'Generic'),(6,1,2457,'Battle Stance'),(6,1,2479,'Honorless Target'),(6,1,3050,'Detect'),(6,1,3365,'Opening'),(6,1,5301,'Defensive State (DND)'),(6,1,6233,'Closing'),(6,1,6246,'Closing'),(6,1,6247,'Opening'),(6,1,6477,'Opening'),(6,1,6478,'Opening'),(6,1,6603,'Attack'),(6,1,7266,'Duel'),(6,1,7267,'Grovel'),(6,1,7355,'Stuck'),(6,1,8386,'Attacking'),(6,1,8737,'Mail'),(6,1,9077,'Leather'),(6,1,9078,'Cloth'),(6,1,9116,'Shield'),(6,1,9125,'Generic'),(6,1,20549,'War Stomp'),(6,1,20550,'Endurance'),(6,1,20551,'Nature Resistance'),(6,1,20552,'Cultivation'),(6,1,21651,'Opening'),(6,1,21652,'Closing'),(6,1,22027,'Remove Insignia'),(6,1,22810,'Opening - No Text'),(6,1,32215,'Victorious State'),(6,1,45927,'Summon Friend'),(6,1,61437,'Opening'),(6,3,75,'Auto Shot'),(6,3,81,'Dodge'),(6,3,196,'One-Handed Axes'),(6,3,203,'Unarmed'),(6,3,204,'Defense'),(6,3,266,'Guns'),(6,3,522,'SPELLDEFENSE (DND)'),(6,3,669,'Language Orcish'),(6,3,670,'Language Taurahe'),(6,3,1843,'Disarm'),(6,3,2382,'Generic'),(6,3,2479,'Honorless Target'),(6,3,2973,'Raptor Strike'),(6,3,3050,'Detect'),(6,3,3365,'Opening'),(6,3,6233,'Closing'),(6,3,6246,'Closing'),(6,3,6247,'Opening'),(6,3,6477,'Opening'),(6,3,6478,'Opening'),(6,3,6603,'Attack'),(6,3,7266,'Duel'),(6,3,7267,'Grovel'),(6,3,7355,'Stuck'),(6,3,8386,'Attacking'),(6,3,9077,'Leather'),(6,3,9078,'Cloth'),(6,3,9125,'Generic'),(6,3,13358,'Defensive State (DND)'),(6,3,20549,'War Stomp'),(6,3,20550,'Endurance'),(6,3,20551,'Nature Resistance'),(6,3,20552,'Cultivation'),(6,3,21651,'Opening'),(6,3,21652,'Closing'),(6,3,22027,'Remove Insignia'),(6,3,22810,'Opening - No Text'),(6,3,24949,'Defensive State 2 (DND)'),(6,3,34082,'Advantaged State (DND)'),(6,3,45927,'Summon Friend'),(6,3,61437,'Opening'),(6,6,81,'Dodge'),(6,6,196,'One-Handed Axes'),(6,6,197,'Two-Handed Axes'),(6,6,200,'Polearms'),(6,6,201,'One-Handed Swords'),(6,6,202,'Two-Handed Swords'),(6,6,203,'Unarmed'),(6,6,204,'Defense'),(6,6,522,'SPELLDEFENSE (DND)'),(6,6,669,'Language Orcish'),(6,6,670,'Language Taurahe'),(6,6,674,'Dual Wield'),(6,6,750,'Plate Mail'),(6,6,1843,'Disarm'),(6,6,2382,'Generic'),(6,6,2479,'Honorless Target'),(6,6,3050,'Detect'),(6,6,3127,'Parry'),(6,6,3275,'Linen Bandage'),(6,6,3276,'Heavy Linen Bandage'),(6,6,3277,'Wool Bandage'),(6,6,3278,'Heavy Wool Bandage'),(6,6,3365,'Opening'),(6,6,6233,'Closing'),(6,6,6246,'Closing'),(6,6,6247,'Opening'),(6,6,6477,'Opening'),(6,6,6478,'Opening'),(6,6,6603,'Attack'),(6,6,7266,'Duel'),(6,6,7267,'Grovel'),(6,6,7355,'Stuck'),(6,6,7928,'Silk Bandage'),(6,6,7929,'Heavy Silk Bandage'),(6,6,7934,'Anti-Venom'),(6,6,8386,'Attacking'),(6,6,8737,'Mail'),(6,6,9077,'Leather'),(6,6,9078,'Cloth'),(6,6,9125,'Generic'),(6,6,10840,'Mageweave Bandage'),(6,6,10841,'Heavy Mageweave Bandage'),(6,6,10846,'First Aid'),(6,6,18629,'Runecloth Bandage'),(6,6,18630,'Heavy Runecloth Bandage'),(6,6,20549,'War Stomp'),(6,6,20550,'Endurance'),(6,6,20551,'Nature Resistance'),(6,6,20552,'Cultivation'),(6,6,21651,'Opening'),(6,6,21652,'Closing'),(6,6,22027,'Remove Insignia'),(6,6,22810,'Opening - No Text'),(6,6,33391,'Journeyman Riding'),(6,6,45462,'Plague Strike'),(6,6,45477,'Icy Touch'),(6,6,45902,'Blood Strike'),(6,6,45903,'Offensive State (DND)'),(6,6,45927,'Summon Friend'),(6,6,47541,'Death Coil'),(6,6,48266,'Blood Presence'),(6,6,49410,'Forceful Deflection'),(6,6,49576,'Death Grip'),(6,6,52665,'Sigil'),(6,6,59879,'Blood Plague'),(6,6,59921,'Frost Fever'),(6,6,61437,'Opening'),(6,6,61455,'Runic Focus'),(6,7,81,'Dodge'),(6,7,107,'Block'),(6,7,198,'One-Handed Maces'),(6,7,203,'Unarmed'),(6,7,204,'Defense'),(6,7,227,'Staves'),(6,7,331,'Healing Wave'),(6,7,403,'Lightning Bolt'),(6,7,522,'SPELLDEFENSE (DND)'),(6,7,669,'Language Orcish'),(6,7,670,'Language Taurahe'),(6,7,1843,'Disarm'),(6,7,2382,'Generic'),(6,7,2479,'Honorless Target'),(6,7,3050,'Detect'),(6,7,3365,'Opening'),(6,7,6233,'Closing'),(6,7,6246,'Closing'),(6,7,6247,'Opening'),(6,7,6477,'Opening'),(6,7,6478,'Opening'),(6,7,6603,'Attack'),(6,7,7266,'Duel'),(6,7,7267,'Grovel'),(6,7,7355,'Stuck'),(6,7,8386,'Attacking'),(6,7,9077,'Leather'),(6,7,9078,'Cloth'),(6,7,9116,'Shield'),(6,7,9125,'Generic'),(6,7,20549,'War Stomp'),(6,7,20550,'Endurance'),(6,7,20551,'Nature Resistance'),(6,7,20552,'Cultivation'),(6,7,21651,'Opening'),(6,7,21652,'Closing'),(6,7,22027,'Remove Insignia'),(6,7,22810,'Opening - No Text'),(6,7,27763,'Totem'),(6,7,45927,'Summon Friend'),(6,7,61437,'Opening'),(6,11,81,'Dodge'),(6,11,198,'One-Handed Maces'),(6,11,203,'Unarmed'),(6,11,204,'Defense'),(6,11,227,'Staves'),(6,11,522,'SPELLDEFENSE (DND)'),(6,11,669,'Language Orcish'),(6,11,670,'Language Taurahe'),(6,11,1843,'Disarm'),(6,11,2382,'Generic'),(6,11,2479,'Honorless Target'),(6,11,3050,'Detect'),(6,11,3365,'Opening'),(6,11,5176,'Wrath'),(6,11,5185,'Healing Touch'),(6,11,6233,'Closing'),(6,11,6246,'Closing'),(6,11,6247,'Opening'),(6,11,6477,'Opening'),(6,11,6478,'Opening'),(6,11,6603,'Attack'),(6,11,7266,'Duel'),(6,11,7267,'Grovel'),(6,11,7355,'Stuck'),(6,11,8386,'Attacking'),(6,11,9077,'Leather'),(6,11,9078,'Cloth'),(6,11,9125,'Generic'),(6,11,20549,'War Stomp'),(6,11,20550,'Endurance'),(6,11,20551,'Nature Resistance'),(6,11,20552,'Cultivation'),(6,11,21651,'Opening'),(6,11,21652,'Closing'),(6,11,22027,'Remove Insignia'),(6,11,22810,'Opening - No Text'),(6,11,27764,'Fetish'),(6,11,45927,'Summon Friend'),(6,11,61437,'Opening'),(7,1,78,'Heroic Strike'),(7,1,81,'Dodge'),(7,1,107,'Block'),(7,1,198,'One-Handed Maces'),(7,1,201,'One-Handed Swords'),(7,1,203,'Unarmed'),(7,1,204,'Defense'),(7,1,522,'SPELLDEFENSE (DND)'),(7,1,668,'Language Common'),(7,1,1180,'Daggers'),(7,1,1843,'Disarm'),(7,1,2382,'Generic'),(7,1,2457,'Battle Stance'),(7,1,2479,'Honorless Target'),(7,1,3050,'Detect'),(7,1,3365,'Opening'),(7,1,5301,'Defensive State (DND)'),(7,1,6233,'Closing'),(7,1,6246,'Closing'),(7,1,6247,'Opening'),(7,1,6477,'Opening'),(7,1,6478,'Opening'),(7,1,6603,'Attack'),(7,1,7266,'Duel'),(7,1,7267,'Grovel'),(7,1,7340,'Language Gnomish'),(7,1,7355,'Stuck'),(7,1,8386,'Attacking'),(7,1,8737,'Mail'),(7,1,9077,'Leather'),(7,1,9078,'Cloth'),(7,1,9116,'Shield'),(7,1,9125,'Generic'),(7,1,20589,'Escape Artist'),(7,1,20591,'Expansive Mind'),(7,1,20592,'Arcane Resistance'),(7,1,20593,'Engineering Specialization'),(7,1,21651,'Opening'),(7,1,21652,'Closing'),(7,1,22027,'Remove Insignia'),(7,1,22810,'Opening - No Text'),(7,1,32215,'Victorious State'),(7,1,45927,'Summon Friend'),(7,1,61437,'Opening'),(7,4,81,'Dodge'),(7,4,203,'Unarmed'),(7,4,204,'Defense'),(7,4,522,'SPELLDEFENSE (DND)'),(7,4,668,'Language Common'),(7,4,1180,'Daggers'),(7,4,1752,'Sinister Strike'),(7,4,1843,'Disarm'),(7,4,2098,'Eviscerate'),(7,4,2382,'Generic'),(7,4,2479,'Honorless Target'),(7,4,2567,'Thrown'),(7,4,2764,'Throw'),(7,4,3050,'Detect'),(7,4,3365,'Opening'),(7,4,6233,'Closing'),(7,4,6246,'Closing'),(7,4,6247,'Opening'),(7,4,6477,'Opening'),(7,4,6478,'Opening'),(7,4,6603,'Attack'),(7,4,7266,'Duel'),(7,4,7267,'Grovel'),(7,4,7340,'Language Gnomish'),(7,4,7355,'Stuck'),(7,4,8386,'Attacking'),(7,4,9077,'Leather'),(7,4,9078,'Cloth'),(7,4,9125,'Generic'),(7,4,16092,'Defensive State (DND)'),(7,4,20589,'Escape Artist'),(7,4,20591,'Expansive Mind'),(7,4,20592,'Arcane Resistance'),(7,4,20593,'Engineering Specialization'),(7,4,21184,'Rogue Passive (DND)'),(7,4,21651,'Opening'),(7,4,21652,'Closing'),(7,4,22027,'Remove Insignia'),(7,4,22810,'Opening - No Text'),(7,4,45927,'Summon Friend'),(7,4,61437,'Opening'),(7,6,81,'Dodge'),(7,6,196,'One-Handed Axes'),(7,6,197,'Two-Handed Axes'),(7,6,200,'Polearms'),(7,6,201,'One-Handed Swords'),(7,6,202,'Two-Handed Swords'),(7,6,203,'Unarmed'),(7,6,204,'Defense'),(7,6,522,'SPELLDEFENSE (DND)'),(7,6,668,'Language Common'),(7,6,674,'Dual Wield'),(7,6,750,'Plate Mail'),(7,6,1843,'Disarm'),(7,6,2382,'Generic'),(7,6,2479,'Honorless Target'),(7,6,3050,'Detect'),(7,6,3127,'Parry'),(7,6,3275,'Linen Bandage'),(7,6,3276,'Heavy Linen Bandage'),(7,6,3277,'Wool Bandage'),(7,6,3278,'Heavy Wool Bandage'),(7,6,3365,'Opening'),(7,6,6233,'Closing'),(7,6,6246,'Closing'),(7,6,6247,'Opening'),(7,6,6477,'Opening'),(7,6,6478,'Opening'),(7,6,6603,'Attack'),(7,6,7266,'Duel'),(7,6,7267,'Grovel'),(7,6,7340,'Language Gnomish'),(7,6,7355,'Stuck'),(7,6,7928,'Silk Bandage'),(7,6,7929,'Heavy Silk Bandage'),(7,6,7934,'Anti-Venom'),(7,6,8386,'Attacking'),(7,6,8737,'Mail'),(7,6,9077,'Leather'),(7,6,9078,'Cloth'),(7,6,9125,'Generic'),(7,6,10840,'Mageweave Bandage'),(7,6,10841,'Heavy Mageweave Bandage'),(7,6,10846,'First Aid'),(7,6,18629,'Runecloth Bandage'),(7,6,18630,'Heavy Runecloth Bandage'),(7,6,20589,'Escape Artist'),(7,6,20591,'Expansive Mind'),(7,6,20592,'Arcane Resistance'),(7,6,20593,'Engineering Specialization'),(7,6,21651,'Opening'),(7,6,21652,'Closing'),(7,6,22027,'Remove Insignia'),(7,6,22810,'Opening - No Text'),(7,6,33391,'Journeyman Riding'),(7,6,45462,'Plague Strike'),(7,6,45477,'Icy Touch'),(7,6,45902,'Blood Strike'),(7,6,45903,'Offensive State (DND)'),(7,6,45927,'Summon Friend'),(7,6,47541,'Death Coil'),(7,6,48266,'Blood Presence'),(7,6,49410,'Forceful Deflection'),(7,6,49576,'Death Grip'),(7,6,52665,'Sigil'),(7,6,59879,'Blood Plague'),(7,6,59921,'Frost Fever'),(7,6,61437,'Opening'),(7,6,61455,'Runic Focus'),(7,8,81,'Dodge'),(7,8,133,'Fireball'),(7,8,168,'Frost Armor'),(7,8,203,'Unarmed'),(7,8,204,'Defense'),(7,8,227,'Staves'),(7,8,522,'SPELLDEFENSE (DND)'),(7,8,668,'Language Common'),(7,8,1843,'Disarm'),(7,8,2382,'Generic'),(7,8,2479,'Honorless Target'),(7,8,3050,'Detect'),(7,8,3365,'Opening'),(7,8,5009,'Wands'),(7,8,5019,'Shoot'),(7,8,6233,'Closing'),(7,8,6246,'Closing'),(7,8,6247,'Opening'),(7,8,6477,'Opening'),(7,8,6478,'Opening'),(7,8,6603,'Attack'),(7,8,7266,'Duel'),(7,8,7267,'Grovel'),(7,8,7340,'Language Gnomish'),(7,8,7355,'Stuck'),(7,8,8386,'Attacking'),(7,8,9078,'Cloth'),(7,8,9125,'Generic'),(7,8,20589,'Escape Artist'),(7,8,20591,'Expansive Mind'),(7,8,20592,'Arcane Resistance'),(7,8,20593,'Engineering Specialization'),(7,8,21651,'Opening'),(7,8,21652,'Closing'),(7,8,22027,'Remove Insignia'),(7,8,22810,'Opening - No Text'),(7,8,45927,'Summon Friend'),(7,8,61437,'Opening'),(7,9,81,'Dodge'),(7,9,203,'Unarmed'),(7,9,204,'Defense'),(7,9,522,'SPELLDEFENSE (DND)'),(7,9,668,'Language Common'),(7,9,686,'Shadow Bolt'),(7,9,687,'Demon Skin'),(7,9,1180,'Daggers'),(7,9,1843,'Disarm'),(7,9,2382,'Generic'),(7,9,2479,'Honorless Target'),(7,9,3050,'Detect'),(7,9,3365,'Opening'),(7,9,5009,'Wands'),(7,9,5019,'Shoot'),(7,9,6233,'Closing'),(7,9,6246,'Closing'),(7,9,6247,'Opening'),(7,9,6477,'Opening'),(7,9,6478,'Opening'),(7,9,6603,'Attack'),(7,9,7266,'Duel'),(7,9,7267,'Grovel'),(7,9,7340,'Language Gnomish'),(7,9,7355,'Stuck'),(7,9,8386,'Attacking'),(7,9,9078,'Cloth'),(7,9,9125,'Generic'),(7,9,20589,'Escape Artist'),(7,9,20591,'Expansive Mind'),(7,9,20592,'Arcane Resistance'),(7,9,20593,'Engineering Specialization'),(7,9,21651,'Opening'),(7,9,21652,'Closing'),(7,9,22027,'Remove Insignia'),(7,9,22810,'Opening - No Text'),(7,9,45927,'Summon Friend'),(7,9,61437,'Opening'),(8,1,78,'Heroic Strike'),(8,1,81,'Dodge'),(8,1,107,'Block'),(8,1,196,'One-Handed Axes'),(8,1,203,'Unarmed'),(8,1,204,'Defense'),(8,1,522,'SPELLDEFENSE (DND)'),(8,1,669,'Language Orcish'),(8,1,1180,'Daggers'),(8,1,1843,'Disarm'),(8,1,2382,'Generic'),(8,1,2457,'Battle Stance'),(8,1,2479,'Honorless Target'),(8,1,2567,'Thrown'),(8,1,2764,'Throw'),(8,1,3050,'Detect'),(8,1,3365,'Opening'),(8,1,5301,'Defensive State (DND)'),(8,1,6233,'Closing'),(8,1,6246,'Closing'),(8,1,6247,'Opening'),(8,1,6477,'Opening'),(8,1,6478,'Opening'),(8,1,6603,'Attack'),(8,1,7266,'Duel'),(8,1,7267,'Grovel'),(8,1,7341,'Language Troll'),(8,1,7355,'Stuck'),(8,1,8386,'Attacking'),(8,1,8737,'Mail'),(8,1,9077,'Leather'),(8,1,9078,'Cloth'),(8,1,9116,'Shield'),(8,1,9125,'Generic'),(8,1,20555,'Regeneration'),(8,1,20557,'Beast Slaying'),(8,1,20558,'Throwing Specialization'),(8,1,21651,'Opening'),(8,1,21652,'Closing'),(8,1,22027,'Remove Insignia'),(8,1,22810,'Opening - No Text'),(8,1,26290,'Bow Specialization'),(8,1,26297,'Berserking'),(8,1,32215,'Victorious State'),(8,1,45927,'Summon Friend'),(8,1,58943,'Da Voodoo Shuffle'),(8,1,61437,'Opening'),(8,3,75,'Auto Shot'),(8,3,81,'Dodge'),(8,3,196,'One-Handed Axes'),(8,3,203,'Unarmed'),(8,3,204,'Defense'),(8,3,264,'Bows'),(8,3,522,'SPELLDEFENSE (DND)'),(8,3,669,'Language Orcish'),(8,3,1843,'Disarm'),(8,3,2382,'Generic'),(8,3,2479,'Honorless Target'),(8,3,2973,'Raptor Strike'),(8,3,3050,'Detect'),(8,3,3365,'Opening'),(8,3,6233,'Closing'),(8,3,6246,'Closing'),(8,3,6247,'Opening'),(8,3,6477,'Opening'),(8,3,6478,'Opening'),(8,3,6603,'Attack'),(8,3,7266,'Duel'),(8,3,7267,'Grovel'),(8,3,7341,'Language Troll'),(8,3,7355,'Stuck'),(8,3,8386,'Attacking'),(8,3,9077,'Leather'),(8,3,9078,'Cloth'),(8,3,9125,'Generic'),(8,3,13358,'Defensive State (DND)'),(8,3,26297,'Berserking'),(8,3,20555,'Regeneration'),(8,3,20557,'Beast Slaying'),(8,3,20558,'Throwing Specialization'),(8,3,21651,'Opening'),(8,3,21652,'Closing'),(8,3,22027,'Remove Insignia'),(8,3,22810,'Opening - No Text'),(8,3,24949,'Defensive State 2 (DND)'),(8,3,26290,'Bow Specialization'),(8,3,34082,'Advantaged State (DND)'),(8,3,45927,'Summon Friend'),(8,3,58943,'Da Voodoo Shuffle'),(8,3,61437,'Opening'),(8,4,81,'Dodge'),(8,4,203,'Unarmed'),(8,4,204,'Defense'),(8,4,522,'SPELLDEFENSE (DND)'),(8,4,669,'Language Orcish'),(8,4,1180,'Daggers'),(8,4,1752,'Sinister Strike'),(8,4,1843,'Disarm'),(8,4,2098,'Eviscerate'),(8,4,2382,'Generic'),(8,4,2479,'Honorless Target'),(8,4,2567,'Thrown'),(8,4,2764,'Throw'),(8,4,3050,'Detect'),(8,4,3365,'Opening'),(8,4,6233,'Closing'),(8,4,6246,'Closing'),(8,4,6247,'Opening'),(8,4,6477,'Opening'),(8,4,6478,'Opening'),(8,4,6603,'Attack'),(8,4,7266,'Duel'),(8,4,7267,'Grovel'),(8,4,7341,'Language Troll'),(8,4,7355,'Stuck'),(8,4,8386,'Attacking'),(8,4,9077,'Leather'),(8,4,9078,'Cloth'),(8,4,9125,'Generic'),(8,4,16092,'Defensive State (DND)'),(8,4,20555,'Regeneration'),(8,4,20557,'Beast Slaying'),(8,4,20558,'Throwing Specialization'),(8,4,21184,'Rogue Passive (DND)'),(8,4,21651,'Opening'),(8,4,21652,'Closing'),(8,4,22027,'Remove Insignia'),(8,4,22810,'Opening - No Text'),(8,4,26290,'Bow Specialization'),(8,4,26297,'Berserking'),(8,4,45927,'Summon Friend'),(8,4,58943,'Da Voodoo Shuffle'),(8,4,61437,'Opening'),(8,5,81,'Dodge'),(8,5,198,'One-Handed Maces'),(8,5,203,'Unarmed'),(8,5,204,'Defense'),(8,5,522,'SPELLDEFENSE (DND)'),(8,5,585,'Smite'),(8,5,669,'Language Orcish'),(8,5,1843,'Disarm'),(8,5,2050,'Lesser Heal'),(8,5,2382,'Generic'),(8,5,2479,'Honorless Target'),(8,5,3050,'Detect'),(8,5,3365,'Opening'),(8,5,5009,'Wands'),(8,5,5019,'Shoot'),(8,5,6233,'Closing'),(8,5,6246,'Closing'),(8,5,6247,'Opening'),(8,5,6477,'Opening'),(8,5,6478,'Opening'),(8,5,6603,'Attack'),(8,5,7266,'Duel'),(8,5,7267,'Grovel'),(8,5,7341,'Language Troll'),(8,5,7355,'Stuck'),(8,5,8386,'Attacking'),(8,5,9078,'Cloth'),(8,5,9125,'Generic'),(8,5,26297,'Berserking'),(8,5,20555,'Regeneration'),(8,5,20557,'Beast Slaying'),(8,5,20558,'Throwing Specialization'),(8,5,21651,'Opening'),(8,5,21652,'Closing'),(8,5,22027,'Remove Insignia'),(8,5,22810,'Opening - No Text'),(8,5,26290,'Bow Specialization'),(8,5,45927,'Summon Friend'),(8,5,58943,'Da Voodoo Shuffle'),(8,5,61437,'Opening'),(8,6,81,'Dodge'),(8,6,196,'One-Handed Axes'),(8,6,197,'Two-Handed Axes'),(8,6,200,'Polearms'),(8,6,201,'One-Handed Swords'),(8,6,202,'Two-Handed Swords'),(8,6,203,'Unarmed'),(8,6,204,'Defense'),(8,6,522,'SPELLDEFENSE (DND)'),(8,6,669,'Language Orcish'),(8,6,674,'Dual Wield'),(8,6,750,'Plate Mail'),(8,6,1843,'Disarm'),(8,6,2382,'Generic'),(8,6,2479,'Honorless Target'),(8,6,3050,'Detect'),(8,6,3127,'Parry'),(8,6,3275,'Linen Bandage'),(8,6,3276,'Heavy Linen Bandage'),(8,6,3277,'Wool Bandage'),(8,6,3278,'Heavy Wool Bandage'),(8,6,3365,'Opening'),(8,6,6233,'Closing'),(8,6,6246,'Closing'),(8,6,6247,'Opening'),(8,6,6477,'Opening'),(8,6,6478,'Opening'),(8,6,6603,'Attack'),(8,6,7266,'Duel'),(8,6,7267,'Grovel'),(8,6,7341,'Language Troll'),(8,6,7355,'Stuck'),(8,6,7928,'Silk Bandage'),(8,6,7929,'Heavy Silk Bandage'),(8,6,7934,'Anti-Venom'),(8,6,8386,'Attacking'),(8,6,8737,'Mail'),(8,6,9077,'Leather'),(8,6,9078,'Cloth'),(8,6,9125,'Generic'),(8,6,10840,'Mageweave Bandage'),(8,6,10841,'Heavy Mageweave Bandage'),(8,6,10846,'First Aid'),(8,6,18629,'Runecloth Bandage'),(8,6,18630,'Heavy Runecloth Bandage'),(8,6,20555,'Regeneration'),(8,6,20557,'Beast Slaying'),(8,6,20558,'Throwing Specialization'),(8,6,21651,'Opening'),(8,6,21652,'Closing'),(8,6,22027,'Remove Insignia'),(8,6,22810,'Opening - No Text'),(8,6,26290,'Bow Specialization'),(8,6,33391,'Journeyman Riding'),(8,6,45462,'Plague Strike'),(8,6,45477,'Icy Touch'),(8,6,45902,'Blood Strike'),(8,6,45903,'Offensive State (DND)'),(8,6,45927,'Summon Friend'),(8,6,47541,'Death Coil'),(8,6,48266,'Blood Presence'),(8,6,49410,'Forceful Deflection'),(8,6,49576,'Death Grip'),(8,6,26297,'Berserking'),(8,6,52665,'Sigil'),(8,6,58943,'Da Voodoo Shuffle'),(8,6,59879,'Blood Plague'),(8,6,59921,'Frost Fever'),(8,6,61437,'Opening'),(8,6,61455,'Runic Focus'),(8,7,81,'Dodge'),(8,7,107,'Block'),(8,7,198,'One-Handed Maces'),(8,7,203,'Unarmed'),(8,7,204,'Defense'),(8,7,227,'Staves'),(8,7,331,'Healing Wave'),(8,7,403,'Lightning Bolt'),(8,7,522,'SPELLDEFENSE (DND)'),(8,7,669,'Language Orcish'),(8,7,1843,'Disarm'),(8,7,2382,'Generic'),(8,7,2479,'Honorless Target'),(8,7,3050,'Detect'),(8,7,3365,'Opening'),(8,7,6233,'Closing'),(8,7,6246,'Closing'),(8,7,6247,'Opening'),(8,7,6477,'Opening'),(8,7,6478,'Opening'),(8,7,6603,'Attack'),(8,7,7266,'Duel'),(8,7,7267,'Grovel'),(8,7,7341,'Language Troll'),(8,7,7355,'Stuck'),(8,7,8386,'Attacking'),(8,7,9077,'Leather'),(8,7,9078,'Cloth'),(8,7,9116,'Shield'),(8,7,9125,'Generic'),(8,7,26297,'Berserking'),(8,7,20555,'Regeneration'),(8,7,20557,'Beast Slaying'),(8,7,20558,'Throwing Specialization'),(8,7,21651,'Opening'),(8,7,21652,'Closing'),(8,7,22027,'Remove Insignia'),(8,7,22810,'Opening - No Text'),(8,7,26290,'Bow Specialization'),(8,7,27763,'Totem'),(8,7,45927,'Summon Friend'),(8,7,58943,'Da Voodoo Shuffle'),(8,7,61437,'Opening'),(8,8,81,'Dodge'),(8,8,133,'Fireball'),(8,8,168,'Frost Armor'),(8,8,203,'Unarmed'),(8,8,204,'Defense'),(8,8,227,'Staves'),(8,8,522,'SPELLDEFENSE (DND)'),(8,8,669,'Language Orcish'),(8,8,1843,'Disarm'),(8,8,2382,'Generic'),(8,8,2479,'Honorless Target'),(8,8,3050,'Detect'),(8,8,3365,'Opening'),(8,8,5009,'Wands'),(8,8,5019,'Shoot'),(8,8,6233,'Closing'),(8,8,6246,'Closing'),(8,8,6247,'Opening'),(8,8,6477,'Opening'),(8,8,6478,'Opening'),(8,8,6603,'Attack'),(8,8,7266,'Duel'),(8,8,7267,'Grovel'),(8,8,7341,'Language Troll'),(8,8,7355,'Stuck'),(8,8,8386,'Attacking'),(8,8,9078,'Cloth'),(8,8,9125,'Generic'),(8,8,26297,'Berserking'),(8,8,20555,'Regeneration'),(8,8,20557,'Beast Slaying'),(8,8,20558,'Throwing Specialization'),(8,8,21651,'Opening'),(8,8,21652,'Closing'),(8,8,22027,'Remove Insignia'),(8,8,22810,'Opening - No Text'),(8,8,26290,'Bow Specialization'),(8,8,45927,'Summon Friend'),(8,8,58943,'Da Voodoo Shuffle'),(8,8,61437,'Opening'),(10,2,81,'Dodge'),(10,2,107,'Block'),(10,2,201,'One-Handed Swords'),(10,2,202,'Two-Handed Swords'),(10,2,203,'Unarmed'),(10,2,204,'Defense'),(10,2,522,'SPELLDEFENSE (DND)'),(10,2,635,'Holy Light'),(10,2,669,'Language Orcish'),(10,2,813,'Language Thalassian'),(10,2,822,'Magic Resistance'),(10,2,2382,'Generic'),(10,2,2479,'Honorless Target'),(10,2,3050,'Detect'),(10,2,3365,'Opening'),(10,2,6233,'Closing'),(10,2,6246,'Closing'),(10,2,6247,'Opening'),(10,2,6477,'Opening'),(10,2,6478,'Opening'),(10,2,6603,'Attack'),(10,2,7266,'Duel'),(10,2,7267,'Grovel'),(10,2,7355,'Stuck'),(10,2,8386,'Attacking'),(10,2,8737,'Mail'),(10,2,9077,'Leather'),(10,2,9078,'Cloth'),(10,2,9116,'Shield'),(10,2,9125,'Generic'),(10,2,21084,'Seal of Righteousness'),(10,2,21651,'Opening'),(10,2,21652,'Closing'),(10,2,22027,'Remove Insignia'),(10,2,22810,'Opening - No Text'),(10,2,27762,'Libram'),(10,2,28730,'Arcane Torrent'),(10,2,28877,'Arcane Affinity'),(10,3,75,'Auto Shot'),(10,3,81,'Dodge'),(10,3,203,'Unarmed'),(10,3,204,'Defense'),(10,3,264,'Bows'),(10,3,522,'SPELLDEFENSE (DND)'),(10,3,669,'Language Orcish'),(10,3,813,'Language Thalassian'),(10,3,822,'Magic Resistance'),(10,3,1180,'Daggers'),(10,3,2382,'Generic'),(10,3,2479,'Honorless Target'),(10,3,2973,'Raptor Strike'),(10,3,3050,'Detect'),(10,3,3365,'Opening'),(10,3,6233,'Closing'),(10,3,6246,'Closing'),(10,3,6247,'Opening'),(10,3,6477,'Opening'),(10,3,6478,'Opening'),(10,3,6603,'Attack'),(10,3,7266,'Duel'),(10,3,7267,'Grovel'),(10,3,7355,'Stuck'),(10,3,8386,'Attacking'),(10,3,9077,'Leather'),(10,3,9078,'Cloth'),(10,3,9125,'Generic'),(10,3,13358,'Defensive State (DND)'),(10,3,21651,'Opening'),(10,3,21652,'Closing'),(10,3,22027,'Remove Insignia'),(10,3,22810,'Opening - No Text'),(10,3,24949,'Defensive State 2 (DND)'),(10,3,28730,'Arcane Torrent'),(10,3,28877,'Arcane Affinity'),(10,3,34082,'Advantaged State (DND)'),(10,4,81,'Dodge'),(10,4,203,'Unarmed'),(10,4,204,'Defense'),(10,4,522,'SPELLDEFENSE (DND)'),(10,4,669,'Language Orcish'),(10,4,813,'Language Thalassian'),(10,4,822,'Magic Resistance'),(10,4,1180,'Daggers'),(10,4,1752,'Sinister Strike'),(10,4,2098,'Eviscerate'),(10,4,2382,'Generic'),(10,4,2479,'Honorless Target'),(10,4,2567,'Thrown'),(10,4,2764,'Throw'),(10,4,3050,'Detect'),(10,4,3365,'Opening'),(10,4,6233,'Closing'),(10,4,6246,'Closing'),(10,4,6247,'Opening'),(10,4,6477,'Opening'),(10,4,6478,'Opening'),(10,4,6603,'Attack'),(10,4,7266,'Duel'),(10,4,7267,'Grovel'),(10,4,7355,'Stuck'),(10,4,8386,'Attacking'),(10,4,9077,'Leather'),(10,4,9078,'Cloth'),(10,4,9125,'Generic'),(10,4,16092,'Defensive State (DND)'),(10,4,21184,'Rogue Passive (DND)'),(10,4,21651,'Opening'),(10,4,21652,'Closing'),(10,4,22027,'Remove Insignia'),(10,4,22810,'Opening - No Text'),(10,4,25046,'Arcane Torrent'),(10,4,28877,'Arcane Affinity'),(10,5,81,'Dodge'),(10,5,198,'One-Handed Maces'),(10,5,203,'Unarmed'),(10,5,204,'Defense'),(10,5,522,'SPELLDEFENSE (DND)'),(10,5,585,'Smite'),(10,5,669,'Language Orcish'),(10,5,813,'Language Thalassian'),(10,5,822,'Magic Resistance'),(10,5,2050,'Lesser Heal'),(10,5,2382,'Generic'),(10,5,2479,'Honorless Target'),(10,5,3050,'Detect'),(10,5,3365,'Opening'),(10,5,5009,'Wands'),(10,5,5019,'Shoot'),(10,5,6233,'Closing'),(10,5,6246,'Closing'),(10,5,6247,'Opening'),(10,5,6477,'Opening'),(10,5,6478,'Opening'),(10,5,6603,'Attack'),(10,5,7266,'Duel'),(10,5,7267,'Grovel'),(10,5,7355,'Stuck'),(10,5,8386,'Attacking'),(10,5,9078,'Cloth'),(10,5,9125,'Generic'),(10,5,21651,'Opening'),(10,5,21652,'Closing'),(10,5,22027,'Remove Insignia'),(10,5,22810,'Opening - No Text'),(10,5,28730,'Arcane Torrent'),(10,5,28877,'Arcane Affinity'),(10,6,81,'Dodge'),(10,6,196,'One-Handed Axes'),(10,6,197,'Two-Handed Axes'),(10,6,200,'Polearms'),(10,6,201,'One-Handed Swords'),(10,6,202,'Two-Handed Swords'),(10,6,203,'Unarmed'),(10,6,204,'Defense'),(10,6,522,'SPELLDEFENSE (DND)'),(10,6,669,'Language Orcish'),(10,6,674,'Dual Wield'),(10,6,750,'Plate Mail'),(10,6,813,'Language Thalassian'),(10,6,822,'Magic Resistance'),(10,6,1843,'Disarm'),(10,6,2382,'Generic'),(10,6,2479,'Honorless Target'),(10,6,3050,'Detect'),(10,6,3127,'Parry'),(10,6,3275,'Linen Bandage'),(10,6,3276,'Heavy Linen Bandage'),(10,6,3277,'Wool Bandage'),(10,6,3278,'Heavy Wool Bandage'),(10,6,3365,'Opening'),(10,6,6233,'Closing'),(10,6,6246,'Closing'),(10,6,6247,'Opening'),(10,6,6477,'Opening'),(10,6,6478,'Opening'),(10,6,6603,'Attack'),(10,6,7266,'Duel'),(10,6,7267,'Grovel'),(10,6,7355,'Stuck'),(10,6,7928,'Silk Bandage'),(10,6,7929,'Heavy Silk Bandage'),(10,6,7934,'Anti-Venom'),(10,6,8386,'Attacking'),(10,6,8737,'Mail'),(10,6,9077,'Leather'),(10,6,9078,'Cloth'),(10,6,9125,'Generic'),(10,6,10840,'Mageweave Bandage'),(10,6,10841,'Heavy Mageweave Bandage'),(10,6,10846,'First Aid'),(10,6,18629,'Runecloth Bandage'),(10,6,18630,'Heavy Runecloth Bandage'),(10,6,21651,'Opening'),(10,6,21652,'Closing'),(10,6,22027,'Remove Insignia'),(10,6,22810,'Opening - No Text'),(10,6,28877,'Arcane Affinity'),(10,6,33391,'Journeyman Riding'),(10,6,45462,'Plague Strike'),(10,6,45477,'Icy Touch'),(10,6,45902,'Blood Strike'),(10,6,45903,'Offensive State (DND)'),(10,6,45927,'Summon Friend'),(10,6,47541,'Death Coil'),(10,6,48266,'Blood Presence'),(10,6,49410,'Forceful Deflection'),(10,6,49576,'Death Grip'),(10,6,50613,'Arcane Torrent'),(10,6,52665,'Sigil'),(10,6,59879,'Blood Plague'),(10,6,59921,'Frost Fever'),(10,6,61437,'Opening'),(10,6,61455,'Runic Focus'),(10,8,81,'Dodge'),(10,8,133,'Fireball'),(10,8,168,'Frost Armor'),(10,8,203,'Unarmed'),(10,8,204,'Defense'),(10,8,227,'Staves'),(10,8,522,'SPELLDEFENSE (DND)'),(10,8,669,'Language Orcish'),(10,8,813,'Language Thalassian'),(10,8,822,'Magic Resistance'),(10,8,2382,'Generic'),(10,8,2479,'Honorless Target'),(10,8,3050,'Detect'),(10,8,3365,'Opening'),(10,8,5009,'Wands'),(10,8,5019,'Shoot'),(10,8,6233,'Closing'),(10,8,6246,'Closing'),(10,8,6247,'Opening'),(10,8,6477,'Opening'),(10,8,6478,'Opening'),(10,8,6603,'Attack'),(10,8,7266,'Duel'),(10,8,7267,'Grovel'),(10,8,7355,'Stuck'),(10,8,8386,'Attacking'),(10,8,9078,'Cloth'),(10,8,9125,'Generic'),(10,8,21651,'Opening'),(10,8,21652,'Closing'),(10,8,22027,'Remove Insignia'),(10,8,22810,'Opening - No Text'),(10,8,28730,'Arcane Torrent'),(10,8,28877,'Arcane Affinity'),(10,9,81,'Dodge'),(10,9,203,'Unarmed'),(10,9,204,'Defense'),(10,9,522,'SPELLDEFENSE (DND)'),(10,9,669,'Language Orcish'),(10,9,686,'Shadow Bolt'),(10,9,687,'Demon Skin'),(10,9,813,'Language Thalassian'),(10,9,822,'Magic Resistance'),(10,9,1180,'Daggers'),(10,9,2382,'Generic'),(10,9,2479,'Honorless Target'),(10,9,3050,'Detect'),(10,9,3365,'Opening'),(10,9,5009,'Wands'),(10,9,5019,'Shoot'),(10,9,6233,'Closing'),(10,9,6246,'Closing'),(10,9,6247,'Opening'),(10,9,6477,'Opening'),(10,9,6478,'Opening'),(10,9,6603,'Attack'),(10,9,7266,'Duel'),(10,9,7267,'Grovel'),(10,9,7355,'Stuck'),(10,9,8386,'Attacking'),(10,9,9078,'Cloth'),(10,9,9125,'Generic'),(10,9,21651,'Opening'),(10,9,21652,'Closing'),(10,9,22027,'Remove Insignia'),(10,9,22810,'Opening - No Text'),(10,9,28730,'Arcane Torrent'),(10,9,28877,'Arcane Affinity'),(11,1,78,'Heroic Strike'),(11,1,81,'Dodge'),(11,1,107,'Block'),(11,1,198,'One-Handed Maces'),(11,1,201,'One-Handed Swords'),(11,1,203,'Unarmed'),(11,1,204,'Defense'),(11,1,522,'SPELLDEFENSE (DND)'),(11,1,668,'Language Common'),(11,1,1843,'Disarm'),(11,1,2382,'Generic'),(11,1,2457,'Battle Stance'),(11,1,2479,'Honorless Target'),(11,1,3050,'Detect'),(11,1,3365,'Opening'),(11,1,5301,'Defensive State (DND)'),(11,1,6233,'Closing'),(11,1,6246,'Closing'),(11,1,6247,'Opening'),(11,1,6477,'Opening'),(11,1,6478,'Opening'),(11,1,6562,'Heroic Presence'),(11,1,6603,'Attack'),(11,1,7266,'Duel'),(11,1,7267,'Grovel'),(11,1,7355,'Stuck'),(11,1,8386,'Attacking'),(11,1,8737,'Mail'),(11,1,9077,'Leather'),(11,1,9078,'Cloth'),(11,1,9116,'Shield'),(11,1,9125,'Generic'),(11,1,21651,'Opening'),(11,1,21652,'Closing'),(11,1,22027,'Remove Insignia'),(11,1,22810,'Opening - No Text'),(11,1,28875,'Gemcutting'),(11,1,28880,'Gift of the Naaru'),(11,1,29932,'Language Draenei'),(11,1,32215,'Victorious State'),(11,1,45927,'Summon Friend'),(11,1,59221,'Shadow Resistance'),(11,1,61437,'Opening'),(11,2,81,'Dodge'),(11,2,107,'Block'),(11,2,198,'One-Handed Maces'),(11,2,199,'Two-Handed Maces'),(11,2,203,'Unarmed'),(11,2,204,'Defense'),(11,2,522,'SPELLDEFENSE (DND)'),(11,2,635,'Holy Light'),(11,2,668,'Language Common'),(11,2,1843,'Disarm'),(11,2,2382,'Generic'),(11,2,2479,'Honorless Target'),(11,2,3050,'Detect'),(11,2,3365,'Opening'),(11,2,6233,'Closing'),(11,2,6246,'Closing'),(11,2,6247,'Opening'),(11,2,6477,'Opening'),(11,2,6478,'Opening'),(11,2,6562,'Heroic Presence'),(11,2,6603,'Attack'),(11,2,7266,'Duel'),(11,2,7267,'Grovel'),(11,2,7355,'Stuck'),(11,2,8386,'Attacking'),(11,2,8737,'Mail'),(11,2,9077,'Leather'),(11,2,9078,'Cloth'),(11,2,9116,'Shield'),(11,2,9125,'Generic'),(11,2,21084,'Seal of Righteousness'),(11,2,21651,'Opening'),(11,2,21652,'Closing'),(11,2,22027,'Remove Insignia'),(11,2,22810,'Opening - No Text'),(11,2,27762,'Libram'),(11,2,28875,'Gemcutting'),(11,2,29932,'Language Draenei'),(11,2,45927,'Summon Friend'),(11,2,59221,'Shadow Resistance'),(11,2,59542,'Gift of the Naaru'),(11,2,61437,'Opening'),(11,3,75,'Auto Shot'),(11,3,81,'Dodge'),(11,3,201,'One-Handed Swords'),(11,3,203,'Unarmed'),(11,3,204,'Defense'),(11,3,522,'SPELLDEFENSE (DND)'),(11,3,668,'Language Common'),(11,3,1843,'Disarm'),(11,3,2382,'Generic'),(11,3,2479,'Honorless Target'),(11,3,2973,'Raptor Strike'),(11,3,3050,'Detect'),(11,3,3365,'Opening'),(11,3,5011,'Crossbows'),(11,3,6233,'Closing'),(11,3,6246,'Closing'),(11,3,6247,'Opening'),(11,3,6477,'Opening'),(11,3,6478,'Opening'),(11,3,6562,'Heroic Presence'),(11,3,6603,'Attack'),(11,3,7266,'Duel'),(11,3,7267,'Grovel'),(11,3,7355,'Stuck'),(11,3,8386,'Attacking'),(11,3,9077,'Leather'),(11,3,9078,'Cloth'),(11,3,9125,'Generic'),(11,3,13358,'Defensive State (DND)'),(11,3,21651,'Opening'),(11,3,21652,'Closing'),(11,3,22027,'Remove Insignia'),(11,3,22810,'Opening - No Text'),(11,3,24949,'Defensive State 2 (DND)'),(11,3,28875,'Gemcutting'),(11,3,29932,'Language Draenei'),(11,3,34082,'Advantaged State (DND)'),(11,3,45927,'Summon Friend'),(11,3,59221,'Shadow Resistance'),(11,3,59543,'Gift of the Naaru'),(11,3,61437,'Opening'),(11,5,81,'Dodge'),(11,5,198,'One-Handed Maces'),(11,5,203,'Unarmed'),(11,5,204,'Defense'),(11,5,522,'SPELLDEFENSE (DND)'),(11,5,585,'Smite'),(11,5,668,'Language Common'),(11,5,1843,'Disarm'),(11,5,2050,'Lesser Heal'),(11,5,2382,'Generic'),(11,5,2479,'Honorless Target'),(11,5,3050,'Detect'),(11,5,3365,'Opening'),(11,5,5009,'Wands'),(11,5,5019,'Shoot'),(11,5,6233,'Closing'),(11,5,6246,'Closing'),(11,5,6247,'Opening'),(11,5,6477,'Opening'),(11,5,6478,'Opening'),(11,5,6603,'Attack'),(11,5,7266,'Duel'),(11,5,7267,'Grovel'),(11,5,7355,'Stuck'),(11,5,8386,'Attacking'),(11,5,9078,'Cloth'),(11,5,9125,'Generic'),(11,5,21651,'Opening'),(11,5,21652,'Closing'),(11,5,22027,'Remove Insignia'),(11,5,22810,'Opening - No Text'),(11,5,28875,'Gemcutting'),(11,5,28878,'Inspiring Presence'),(11,5,29932,'Language Draenei'),(11,5,45927,'Summon Friend'),(11,5,59221,'Shadow Resistance'),(11,5,59544,'Gift of the Naaru'),(11,5,61437,'Opening'),(11,6,81,'Dodge'),(11,6,196,'One-Handed Axes'),(11,6,197,'Two-Handed Axes'),(11,6,200,'Polearms'),(11,6,201,'One-Handed Swords'),(11,6,202,'Two-Handed Swords'),(11,6,203,'Unarmed'),(11,6,204,'Defense'),(11,6,522,'SPELLDEFENSE (DND)'),(11,6,668,'Language Common'),(11,6,674,'Dual Wield'),(11,6,750,'Plate Mail'),(11,6,1843,'Disarm'),(11,6,2382,'Generic'),(11,6,2479,'Honorless Target'),(11,6,3050,'Detect'),(11,6,3127,'Parry'),(11,6,3275,'Linen Bandage'),(11,6,3276,'Heavy Linen Bandage'),(11,6,3277,'Wool Bandage'),(11,6,3278,'Heavy Wool Bandage'),(11,6,3365,'Opening'),(11,6,6233,'Closing'),(11,6,6246,'Closing'),(11,6,6247,'Opening'),(11,6,6477,'Opening'),(11,6,6478,'Opening'),(11,6,6562,'Heroic Presence'),(11,6,6603,'Attack'),(11,6,7266,'Duel'),(11,6,7267,'Grovel'),(11,6,7355,'Stuck'),(11,6,7928,'Silk Bandage'),(11,6,7929,'Heavy Silk Bandage'),(11,6,7934,'Anti-Venom'),(11,6,8386,'Attacking'),(11,6,8737,'Mail'),(11,6,9077,'Leather'),(11,6,9078,'Cloth'),(11,6,9125,'Generic'),(11,6,10840,'Mageweave Bandage'),(11,6,10841,'Heavy Mageweave Bandage'),(11,6,10846,'First Aid'),(11,6,18629,'Runecloth Bandage'),(11,6,18630,'Heavy Runecloth Bandage'),(11,6,21651,'Opening'),(11,6,21652,'Closing'),(11,6,22027,'Remove Insignia'),(11,6,22810,'Opening - No Text'),(11,6,28875,'Gemcutting'),(11,6,29932,'Language Draenei'),(11,6,33391,'Journeyman Riding'),(11,6,45462,'Plague Strike'),(11,6,45477,'Icy Touch'),(11,6,45902,'Blood Strike'),(11,6,45903,'Offensive State (DND)'),(11,6,45927,'Summon Friend'),(11,6,47541,'Death Coil'),(11,6,48266,'Blood Presence'),(11,6,49410,'Forceful Deflection'),(11,6,49576,'Death Grip'),(11,6,52665,'Sigil'),(11,6,59221,'Shadow Resistance'),(11,6,59539,'Shadow Resistance'),(11,6,59545,'Gift of the Naaru'),(11,6,59879,'Blood Plague'),(11,6,59921,'Frost Fever'),(11,6,61437,'Opening'),(11,6,61455,'Runic Focus'),(11,7,81,'Dodge'),(11,7,107,'Block'),(11,7,198,'One-Handed Maces'),(11,7,203,'Unarmed'),(11,7,204,'Defense'),(11,7,227,'Staves'),(11,7,331,'Healing Wave'),(11,7,403,'Lightning Bolt'),(11,7,522,'SPELLDEFENSE (DND)'),(11,7,668,'Language Common'),(11,7,1843,'Disarm'),(11,7,2382,'Generic'),(11,7,2479,'Honorless Target'),(11,7,3050,'Detect'),(11,7,3365,'Opening'),(11,7,6233,'Closing'),(11,7,6246,'Closing'),(11,7,6247,'Opening'),(11,7,6477,'Opening'),(11,7,6478,'Opening'),(11,7,6603,'Attack'),(11,7,7266,'Duel'),(11,7,7267,'Grovel'),(11,7,7355,'Stuck'),(11,7,8386,'Attacking'),(11,7,9077,'Leather'),(11,7,9078,'Cloth'),(11,7,9116,'Shield'),(11,7,9125,'Generic'),(11,7,21651,'Opening'),(11,7,21652,'Closing'),(11,7,22027,'Remove Insignia'),(11,7,22810,'Opening - No Text'),(11,7,27763,'Totem'),(11,7,28875,'Gemcutting'),(11,7,28878,'Inspiring Presence'),(11,7,29932,'Language Draenei'),(11,7,45927,'Summon Friend'),(11,7,59221,'Shadow Resistance'),(11,7,59547,'Gift of the Naaru'),(11,7,61437,'Opening'),(11,8,81,'Dodge'),(11,8,133,'Fireball'),(11,8,168,'Frost Armor'),(11,8,203,'Unarmed'),(11,8,204,'Defense'),(11,8,227,'Staves'),(11,8,522,'SPELLDEFENSE (DND)'),(11,8,668,'Language Common'),(11,8,1843,'Disarm'),(11,8,2382,'Generic'),(11,8,2479,'Honorless Target'),(11,8,3050,'Detect'),(11,8,3365,'Opening'),(11,8,5009,'Wands'),(11,8,5019,'Shoot'),(11,8,6233,'Closing'),(11,8,6246,'Closing'),(11,8,6247,'Opening'),(11,8,6477,'Opening'),(11,8,6478,'Opening'),(11,8,6603,'Attack'),(11,8,7266,'Duel'),(11,8,7267,'Grovel'),(11,8,7355,'Stuck'),(11,8,8386,'Attacking'),(11,8,9078,'Cloth'),(11,8,9125,'Generic'),(11,8,21651,'Opening'),(11,8,21652,'Closing'),(11,8,22027,'Remove Insignia'),(11,8,22810,'Opening - No Text'),(11,8,28875,'Gemcutting'),(11,8,28878,'Inspiring Presence'),(11,8,29932,'Language Draenei'),(11,8,45927,'Summon Friend'),(11,8,59221,'Shadow Resistance'),(11,8,59548,'Gift of the Naaru'),(11,8,61437,'Opening'),(7,9,58284,'Chaos Bolt Passive'),(10,9,58284,'Chaos Bolt Passive'),(11,2,60091,'Judgement Anti-Parry/Dodge Passive'),(10,2,60091,'Judgement Anti-Parry/Dodge Passive'),(3,2,60091,'Judgement Anti-Parry/Dodge Passive'),(1,2,60091,'Judgement Anti-Parry/Dodge Passive'),(0,6,56816,'Rune Strike'),(1,1,202,'Two-Handed Swords'),(4,1,202,'Two-Handed Swords'),(7,1,202,'Two-Handed Swords'),(8,1,202,'Two-Handed Swords'),(11,1,202,'Two-Handed Swords'),(2,3,197,'Two-Handed Axes'),(3,3,197,'Two-Handed Axes'),(4,3,197,'Two-Handed Axes'),(6,3,197,'Two-Handed Axes'),(8,3,197,'Two-Handed Axes'),(10,3,197,'Two-Handed Axes'),(11,3,197,'Two-Handed Axes'),(1,4,674,'Dual Wield'),(2,4,674,'Dual Wield'),(3,4,674,'Dual Wield'),(4,4,674,'Dual Wield'),(5,4,674,'Dual Wield'),(7,4,674,'Dual Wield'),(8,4,674,'Dual Wield'),(10,4,674,'Dual Wield'),(1,5,227,'Staves'),(3,5,227,'Staves'),(4,5,227,'Staves'),(5,5,227,'Staves'),(8,5,227,'Staves'),(10,5,227,'Staves'),(11,5,227,'Staves'),(1,9,227,'Staves'),(2,9,227,'Staves'),(5,9,227,'Staves'),(7,9,227,'Staves'),(10,9,227,'Staves'),(0,7,75461,'Flame Shock Passive'); +/*!40000 ALTER TABLE `playercreateinfo_spell` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `playercreateinfo_spell_custom` +-- + +DROP TABLE IF EXISTS `playercreateinfo_spell_custom`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `playercreateinfo_spell_custom` ( + `race` tinyint(3) unsigned NOT NULL DEFAULT '0', + `class` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Spell` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Note` varchar(255) DEFAULT NULL, + `Active` tinyint(3) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`race`,`class`,`Spell`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `playercreateinfo_spell_custom` +-- + +LOCK TABLES `playercreateinfo_spell_custom` WRITE; +/*!40000 ALTER TABLE `playercreateinfo_spell_custom` DISABLE KEYS */; +/*!40000 ALTER TABLE `playercreateinfo_spell_custom` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `points_of_interest` +-- + +DROP TABLE IF EXISTS `points_of_interest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `points_of_interest` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `x` float NOT NULL DEFAULT '0', + `y` float NOT NULL DEFAULT '0', + `icon` mediumint(8) unsigned NOT NULL DEFAULT '0', + `flags` mediumint(8) unsigned NOT NULL DEFAULT '0', + `data` mediumint(8) unsigned NOT NULL DEFAULT '0', + `icon_name` text NOT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `points_of_interest` +-- + +LOCK TABLES `points_of_interest` WRITE; +/*!40000 ALTER TABLE `points_of_interest` DISABLE KEYS */; +/*!40000 ALTER TABLE `points_of_interest` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pool_creature` +-- + +DROP TABLE IF EXISTS `pool_creature`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pool_creature` ( + `guid` int(10) unsigned NOT NULL DEFAULT '0', + `pool_entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `chance` float unsigned NOT NULL DEFAULT '0', + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`guid`), + KEY `idx_guid` (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pool_creature` +-- + +LOCK TABLES `pool_creature` WRITE; +/*!40000 ALTER TABLE `pool_creature` DISABLE KEYS */; +/*!40000 ALTER TABLE `pool_creature` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pool_gameobject` +-- + +DROP TABLE IF EXISTS `pool_gameobject`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pool_gameobject` ( + `guid` int(10) unsigned NOT NULL DEFAULT '0', + `pool_entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `chance` float unsigned NOT NULL DEFAULT '0', + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`guid`), + KEY `idx_guid` (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pool_gameobject` +-- + +LOCK TABLES `pool_gameobject` WRITE; +/*!40000 ALTER TABLE `pool_gameobject` DISABLE KEYS */; +/*!40000 ALTER TABLE `pool_gameobject` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pool_pool` +-- + +DROP TABLE IF EXISTS `pool_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pool_pool` ( + `pool_id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `mother_pool` mediumint(8) unsigned NOT NULL DEFAULT '0', + `chance` float NOT NULL DEFAULT '0', + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`pool_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pool_pool` +-- + +LOCK TABLES `pool_pool` WRITE; +/*!40000 ALTER TABLE `pool_pool` DISABLE KEYS */; +/*!40000 ALTER TABLE `pool_pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pool_template` +-- + +DROP TABLE IF EXISTS `pool_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pool_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Pool entry', + `max_limit` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Max number of objects (0) is no limit', + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pool_template` +-- + +LOCK TABLES `pool_template` WRITE; +/*!40000 ALTER TABLE `pool_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `pool_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `prospecting_loot_template` +-- + +DROP TABLE IF EXISTS `prospecting_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `prospecting_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `prospecting_loot_template` +-- + +LOCK TABLES `prospecting_loot_template` WRITE; +/*!40000 ALTER TABLE `prospecting_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `prospecting_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `quest_end_scripts` +-- + +DROP TABLE IF EXISTS `quest_end_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quest_end_scripts` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `delay` int(10) unsigned NOT NULL DEFAULT '0', + `command` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong2` int(10) unsigned NOT NULL DEFAULT '0', + `dataint` int(11) NOT NULL DEFAULT '0', + `x` float NOT NULL DEFAULT '0', + `y` float NOT NULL DEFAULT '0', + `z` float NOT NULL DEFAULT '0', + `o` float NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `quest_end_scripts` +-- + +LOCK TABLES `quest_end_scripts` WRITE; +/*!40000 ALTER TABLE `quest_end_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `quest_end_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `quest_poi` +-- + +DROP TABLE IF EXISTS `quest_poi`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quest_poi` ( + `questId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `id` int(10) UNSIGNED NOT NULL DEFAULT '0', + `objIndex` int(10) NOT NULL DEFAULT '0', + `mapid` int(10) UNSIGNED NOT NULL DEFAULT '0', + `WorldMapAreaId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `FloorId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `unk3` int(10) UNSIGNED NOT NULL DEFAULT '0', + `unk4` int(10) UNSIGNED NOT NULL DEFAULT '0', + KEY `questId` (`questId`,`id`), + KEY `id` (`id`,`questId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `quest_poi` +-- + +LOCK TABLES `quest_poi` WRITE; +/*!40000 ALTER TABLE `quest_poi` DISABLE KEYS */; +/*!40000 ALTER TABLE `quest_poi` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `quest_poi_points` +-- + +DROP TABLE IF EXISTS `quest_poi_points`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quest_poi_points` ( + `questId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `id` int(10) UNSIGNED NOT NULL DEFAULT '0', + `x` int(10) NOT NULL DEFAULT '0', + `y` int(10) NOT NULL DEFAULT '0', + KEY `questId_id` (`questId`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `quest_poi_points` +-- + +LOCK TABLES `quest_poi_points` WRITE; +/*!40000 ALTER TABLE `quest_poi_points` DISABLE KEYS */; +/*!40000 ALTER TABLE `quest_poi_points` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `quest_start_scripts` +-- + +DROP TABLE IF EXISTS `quest_start_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quest_start_scripts` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `delay` int(10) unsigned NOT NULL DEFAULT '0', + `command` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong2` int(10) unsigned NOT NULL DEFAULT '0', + `dataint` int(11) NOT NULL DEFAULT '0', + `x` float NOT NULL DEFAULT '0', + `y` float NOT NULL DEFAULT '0', + `z` float NOT NULL DEFAULT '0', + `o` float NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `quest_start_scripts` +-- + +LOCK TABLES `quest_start_scripts` WRITE; +/*!40000 ALTER TABLE `quest_start_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `quest_start_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `quest_template` +-- + +DROP TABLE IF EXISTS `quest_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quest_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Method` tinyint(3) unsigned NOT NULL DEFAULT '2', + `ZoneOrSort` smallint(6) NOT NULL DEFAULT '0', + `SkillOrClassMask` mediumint(8) NOT NULL DEFAULT '0', + `MinLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `MaxLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `QuestLevel` smallint(3) NOT NULL DEFAULT '1', + `Type` smallint(5) unsigned NOT NULL DEFAULT '0', + `RequiredRaces` smallint(5) unsigned NOT NULL DEFAULT '0', + `RequiredSkillValue` smallint(5) unsigned NOT NULL DEFAULT '0', + `RepObjectiveFaction` smallint(5) unsigned NOT NULL DEFAULT '0', + `RepObjectiveValue` mediumint(9) NOT NULL DEFAULT '0', + `RepObjectiveFaction2` smallint(5) unsigned NOT NULL DEFAULT '0', + `RepObjectiveValue2` mediumint(9) NOT NULL DEFAULT '0', + `RequiredMinRepFaction` smallint(5) unsigned NOT NULL DEFAULT '0', + `RequiredMinRepValue` mediumint(9) NOT NULL DEFAULT '0', + `RequiredMaxRepFaction` smallint(5) unsigned NOT NULL DEFAULT '0', + `RequiredMaxRepValue` mediumint(9) NOT NULL DEFAULT '0', + `SuggestedPlayers` tinyint(3) unsigned NOT NULL DEFAULT '0', + `LimitTime` int(10) unsigned NOT NULL DEFAULT '0', + `QuestFlags` int(10) unsigned NOT NULL DEFAULT '0', + `SpecialFlags` tinyint(3) unsigned NOT NULL DEFAULT '0', + `CharTitleId` tinyint(3) unsigned NOT NULL DEFAULT '0', + `PlayersSlain` tinyint(3) unsigned NOT NULL DEFAULT '0', + `BonusTalents` tinyint(3) unsigned unsigned NULL DEFAULT '0', + `RewardArenaPoints` smallint(5) unsigned NOT NULL DEFAULT '0', + `PrevQuestId` mediumint(9) NOT NULL DEFAULT '0', + `NextQuestId` mediumint(9) NOT NULL DEFAULT '0', + `ExclusiveGroup` mediumint(9) NOT NULL DEFAULT '0', + `NextQuestInChain` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewXPId` tinyint(2) unsigned NOT NULL DEFAULT '0', + `SrcItemId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `SrcItemCount` tinyint(3) unsigned NOT NULL DEFAULT '0', + `SrcSpell` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Title` text DEFAULT NULL, + `Details` text DEFAULT NULL, + `Objectives` text DEFAULT NULL, + `OfferRewardText` text DEFAULT NULL, + `RequestItemsText` text DEFAULT NULL, + `EndText` text DEFAULT NULL, + `CompletedText` text DEFAULT NULL, + `ObjectiveText1` text DEFAULT NULL, + `ObjectiveText2` text DEFAULT NULL, + `ObjectiveText3` text DEFAULT NULL, + `ObjectiveText4` text DEFAULT NULL, + `ReqItemId1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqItemId2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqItemId3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqItemId4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqItemId5` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqItemId6` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqItemCount1` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqItemCount2` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqItemCount3` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqItemCount4` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqItemCount5` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqItemCount6` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqSourceId1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqSourceId2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqSourceId3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqSourceId4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqSourceCount1` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqSourceCount2` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqSourceCount3` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqSourceCount4` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqCreatureOrGOId1` mediumint(9) NOT NULL DEFAULT '0', + `ReqCreatureOrGOId2` mediumint(9) NOT NULL DEFAULT '0', + `ReqCreatureOrGOId3` mediumint(9) NOT NULL DEFAULT '0', + `ReqCreatureOrGOId4` mediumint(9) NOT NULL DEFAULT '0', + `ReqCreatureOrGOCount1` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqCreatureOrGOCount2` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqCreatureOrGOCount3` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqCreatureOrGOCount4` smallint(5) unsigned NOT NULL DEFAULT '0', + `ReqSpellCast1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqSpellCast2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqSpellCast3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ReqSpellCast4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemId1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemId2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemId3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemId4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemId5` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemId6` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemCount1` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemCount2` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemCount3` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemCount4` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemCount5` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewChoiceItemCount6` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewItemId1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewItemId2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewItemId3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewItemId4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewItemCount1` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewItemCount2` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewItemCount3` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewItemCount4` smallint(5) unsigned NOT NULL DEFAULT '0', + `RewRepFaction1` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'faction id from Faction.dbc in this case', + `RewRepFaction2` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'faction id from Faction.dbc in this case', + `RewRepFaction3` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'faction id from Faction.dbc in this case', + `RewRepFaction4` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'faction id from Faction.dbc in this case', + `RewRepFaction5` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'faction id from Faction.dbc in this case', + `RewRepValueId1` mediumint(6) NOT NULL DEFAULT '0', + `RewRepValueId2` mediumint(6) NOT NULL DEFAULT '0', + `RewRepValueId3` mediumint(6) NOT NULL DEFAULT '0', + `RewRepValueId4` mediumint(6) NOT NULL DEFAULT '0', + `RewRepValueId5` mediumint(6) NOT NULL DEFAULT '0', + `RewRepValue1` mediumint(9) NOT NULL DEFAULT '0', + `RewRepValue2` mediumint(9) NOT NULL DEFAULT '0', + `RewRepValue3` mediumint(9) NOT NULL DEFAULT '0', + `RewRepValue4` mediumint(9) NOT NULL DEFAULT '0', + `RewRepValue5` mediumint(9) NOT NULL DEFAULT '0', + `RewHonorAddition` int(10) signed NOT NULL DEFAULT '0', + `RewHonorMultiplier` float NOT NULL DEFAULT '1', + `unk0` tinyint(2) unsigned NOT NULL DEFAULT '0', + `RewOrReqMoney` int(11) NOT NULL DEFAULT '0', + `RewMoneyMaxLevel` int(10) unsigned NOT NULL DEFAULT '0', + `RewSpell` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewSpellCast` int(11) signed NOT NULL DEFAULT '0', + `RewMailTemplateId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `RewMailDelaySecs` int(11) unsigned NOT NULL DEFAULT '0', + `PointMapId` smallint(5) unsigned NOT NULL DEFAULT '0', + `PointX` float NOT NULL DEFAULT '0', + `PointY` float NOT NULL DEFAULT '0', + `PointOpt` mediumint(8) unsigned NOT NULL DEFAULT '0', + `DetailsEmote1` smallint(5) unsigned NOT NULL DEFAULT '0', + `DetailsEmote2` smallint(5) unsigned NOT NULL DEFAULT '0', + `DetailsEmote3` smallint(5) unsigned NOT NULL DEFAULT '0', + `DetailsEmote4` smallint(5) unsigned NOT NULL DEFAULT '0', + `DetailsEmoteDelay1` int(11) unsigned NOT NULL DEFAULT '0', + `DetailsEmoteDelay2` int(11) unsigned NOT NULL DEFAULT '0', + `DetailsEmoteDelay3` int(11) unsigned NOT NULL DEFAULT '0', + `DetailsEmoteDelay4` int(11) unsigned NOT NULL DEFAULT '0', + `IncompleteEmote` smallint(5) unsigned NOT NULL DEFAULT '0', + `CompleteEmote` smallint(5) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmote1` smallint(5) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmote2` smallint(5) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmote3` smallint(5) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmote4` smallint(5) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmoteDelay1` int(11) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmoteDelay2` int(11) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmoteDelay3` int(11) unsigned NOT NULL DEFAULT '0', + `OfferRewardEmoteDelay4` int(11) unsigned NOT NULL DEFAULT '0', + `StartScript` mediumint(8) unsigned NOT NULL DEFAULT '0', + `CompleteScript` mediumint(8) unsigned NOT NULL DEFAULT '0', + `WDBVerified` smallint(5) signed DEFAULT '1', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Quest System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `quest_template` +-- + +LOCK TABLES `quest_template` WRITE; +/*!40000 ALTER TABLE `quest_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `quest_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `reference_loot_template` +-- + +DROP TABLE IF EXISTS `reference_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `reference_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `reference_loot_template` +-- + +LOCK TABLES `reference_loot_template` WRITE; +/*!40000 ALTER TABLE `reference_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `reference_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `reserved_name` +-- + +DROP TABLE IF EXISTS `reserved_name`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `reserved_name` ( + `name` varchar(12) NOT NULL DEFAULT '', + PRIMARY KEY (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player Reserved Names'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `reserved_name` +-- + +LOCK TABLES `reserved_name` WRITE; +/*!40000 ALTER TABLE `reserved_name` DISABLE KEYS */; +/*!40000 ALTER TABLE `reserved_name` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `script_texts` +-- + +DROP TABLE IF EXISTS `script_texts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `script_texts` ( + `npc_entry` mediumint(8) NOT NULL DEFAULT '0' COMMENT 'creature_template entry', + `entry` mediumint(8) NOT NULL, + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + `sound` mediumint(8) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `language` tinyint(3) unsigned NOT NULL DEFAULT '0', + `emote` smallint(5) unsigned NOT NULL DEFAULT '0', + `comment` text, + PRIMARY KEY (`npc_entry`,`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `script_texts` +-- + +LOCK TABLES `script_texts` WRITE; +/*!40000 ALTER TABLE `script_texts` DISABLE KEYS */; +/*!40000 ALTER TABLE `script_texts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `script_waypoint` +-- + +DROP TABLE IF EXISTS `script_waypoint`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `script_waypoint` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'creature_template entry', + `pointid` mediumint(8) unsigned NOT NULL DEFAULT '0', + `location_x` float NOT NULL DEFAULT '0', + `location_y` float NOT NULL DEFAULT '0', + `location_z` float NOT NULL DEFAULT '0', + `waittime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'waittime in millisecs', + `point_comment` text, + PRIMARY KEY (`entry`,`pointid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `script_waypoint` +-- + +LOCK TABLES `script_waypoint` WRITE; +/*!40000 ALTER TABLE `script_waypoint` DISABLE KEYS */; +/*!40000 ALTER TABLE `script_waypoint` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `season_linked_event` +-- + +DROP TABLE IF EXISTS `season_linked_event`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `season_linked_event` ( + `season` int(3) UNSIGNED NOT NULL default '0', + `event` int(8) UNSIGNED NOT NULL default '0', + PRIMARY KEY (`season`), + UNIQUE (`season`,`event`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `season_linked_event` +-- + +LOCK TABLES `season_linked_event` WRITE; +/*!40000 ALTER TABLE `season_linked_event` DISABLE KEYS */; +/*!40000 ALTER TABLE `season_linked_event` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `skill_discovery_template` +-- + +DROP TABLE IF EXISTS `skill_discovery_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `skill_discovery_template` ( + `spellId` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'SpellId of the discoverable spell', + `reqSpell` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'spell requirement', + `reqSkillValue` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'skill points requirement', + `chance` float NOT NULL DEFAULT '0' COMMENT 'chance to discover', + PRIMARY KEY (`spellId`,`reqSpell`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Skill Discovery System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `skill_discovery_template` +-- + +LOCK TABLES `skill_discovery_template` WRITE; +/*!40000 ALTER TABLE `skill_discovery_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `skill_discovery_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `skill_extra_item_template` +-- + +DROP TABLE IF EXISTS `skill_extra_item_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `skill_extra_item_template` ( + `spellId` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'SpellId of the item creation spell', + `requiredSpecialization` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Specialization spell id', + `additionalCreateChance` float NOT NULL DEFAULT '0' COMMENT 'chance to create add', + `additionalMaxNum` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'max num of adds', + PRIMARY KEY (`spellId`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Skill Specialization System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `skill_extra_item_template` +-- + +LOCK TABLES `skill_extra_item_template` WRITE; +/*!40000 ALTER TABLE `skill_extra_item_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `skill_extra_item_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `skill_fishing_base_level` +-- + +DROP TABLE IF EXISTS `skill_fishing_base_level`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `skill_fishing_base_level` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Area identifier', + `skill` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Base skill level requirement', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Fishing system'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `skill_fishing_base_level` +-- + +LOCK TABLES `skill_fishing_base_level` WRITE; +/*!40000 ALTER TABLE `skill_fishing_base_level` DISABLE KEYS */; +/*!40000 ALTER TABLE `skill_fishing_base_level` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `skinning_loot_template` +-- + +DROP TABLE IF EXISTS `skinning_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `skinning_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `skinning_loot_template` +-- + +LOCK TABLES `skinning_loot_template` WRITE; +/*!40000 ALTER TABLE `skinning_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `skinning_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_area` +-- + +DROP TABLE IF EXISTS `spell_area`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_area` ( + `spell` mediumint(8) unsigned NOT NULL DEFAULT '0', + `area` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest_start` mediumint(8) unsigned NOT NULL DEFAULT '0', + `quest_start_active` tinyint(1) unsigned NOT NULL DEFAULT '0', + `quest_end` mediumint(8) unsigned NOT NULL DEFAULT '0', + `aura_spell` mediumint(8) NOT NULL DEFAULT '0', + `racemask` mediumint(8) unsigned NOT NULL DEFAULT '0', + `gender` tinyint(1) unsigned NOT NULL DEFAULT '2', + `autocast` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`spell`,`area`,`quest_start`,`quest_start_active`,`aura_spell`,`racemask`,`gender`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_area` +-- + +LOCK TABLES `spell_area` WRITE; +/*!40000 ALTER TABLE `spell_area` DISABLE KEYS */; +/*!40000 ALTER TABLE `spell_area` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_bonus_data` +-- + +DROP TABLE IF EXISTS `spell_bonus_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_bonus_data` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `direct_bonus` float NOT NULL DEFAULT '0', + `dot_bonus` float NOT NULL DEFAULT '0', + `ap_bonus` float NOT NULL DEFAULT '0', + `ap_dot_bonus` float NOT NULL DEFAULT '0', + `comments` varchar(255) DEFAULT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_bonus_data` +-- + +LOCK TABLES `spell_bonus_data` WRITE; +/*!40000 ALTER TABLE `spell_bonus_data` DISABLE KEYS */; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES +(49941, -1, -1, 0.04, -1, 'Death Knight - Blood Boil'), +(48721, 0, -1, 0.04, -1, 'Death Knight - Blood Boil'), +(55078, 0, 0, -1, 0.06325, 'Death Knight - Blood Plague'), +(50444, -1, -1, 0.105, -1, 'Death Knight - Corpse Explosion Triggered'), +(52212, 0, -1, 0.0475, -1, 'Death Knight - Death and Decay'), +(47632, -1, -1, 0.15, -1, 'Death Knight - Death Coil'), +(47633, -1, -1, 0.15, -1, 'Death Knight - Death Coil Heal'), +(55095, -1, 0, -1, 0.06325, 'Death Knight - Frost Fever'), +(58621, -1, -1, 0.08, -1, 'Death Knight - Glyph of Chains of Ice'), +(49184, -1, -1, 0.1, -1, 'Death Knight - Howling Blast'), +(45477, 0, -1, 0.1, -1, 'Death Knight - Icy Touch'), +(56903, 0, 0, 0, 0, 'Death Knight - Lichflame'), +(51460, 0, -1, -1, -1, 'Death Knight - Necrosis'), +(50842, -1, -1, 0.04, -1, 'Death Knight - Pestilence'), +(50401, 0, 0, 0, 0, 'Death Knight - Razor Frost'), +(47476, -1, -1, 0.06, -1, 'Death Knight - Strangulate'), +(50536, -1, 0, -1, -1, 'Death Knight - Unholy Blight (Rank 1)'), +(339, -1, 0.1, -1, -1, 'Druid - Entangling Roots'), +(60089, -1, -1, 0.15, -1, 'Druid - Faerie Fire (feral)'), +(5185, 1.611, -1, -1, -1, 'Druid - Healing Touch'), +(42231, 0.12898, -1, -1, -1, 'Druid - Hurricane Triggered'), +(5570, -1, 0.2, -1, -1, 'Druid - Insect Swarm'), +(33745, -1, -1, -1, 0.01, 'Druid - Lacerate($AP*0.05 / number of ticks)'), +(33778, 0.516, 0, 0, 0, 'Druid - Lifebloom final heal'), +(33763, 0, 0.09518, 0, 0, 'Druid - Lifebloom HoT(rank 1)'), +(48450, 0, 0.09518, 0, 0, 'Druid - Lifebloom HoT(rank 2)'), +(48451, 0, 0.09518, 0, 0, 'Druid - Lifebloom HoT(rank 3)'), +(48628, -1, -1, -1, 0.15, 'Druid - Lock Jaw'), +(8921, 0.1515, 0.13, -1, -1, 'Druid - Moonfire'), +(50464, 0.67305, -1, -1, -1, 'Druid - Nourish'), +(1822, -1, -1, 0.01, 0.06, 'Druid - Rake ($AP*0.18 / number of ticks)'), +(8936, 0.539, 0.188, -1, -1, 'Druid - Regrowth'), +(774, -1, 0.37604, -1, -1, 'Druid - Rejuvenation'), +(50294, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 1'), +(53188, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 2'), +(53189, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 3'), +(53190, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 4'), +(50288, 0.0458, -1, -1, -1, 'Druid - Starfall rank 1'), +(53191, 0.0458, -1, -1, -1, 'Druid - Starfall rank 2'), +(53194, 0.0458, -1, -1, -1, 'Druid - Starfall rank 3'), +(53195, 0.0458, -1, -1, -1, 'Druid - Starfall rank 4'), +(2912, 1, -1, -1, -1, 'Druid - Starfire'), +(18562, 0, 0, 0, 0, 'Druid - Swiftmend'), +(779, -1, -1, 0.063, -1, 'Druid - Swipe (Bear)'), +(44203, 0.538, -1, -1, -1, 'Druid - Tranquility Triggered'), +(61391, 0.193, -1, -1, -1, 'Druid - Typhoon'), +(48438, -1, 0.11505, -1, -1, 'Druid - Wild Growth'), +(5176, 0.5714, -1, -1, -1, 'Druid - Wrath'), +(3044, -1, -1, 0.15, -1, 'Hunter - Arcane Shot'), +(3674, -1, -1, -1, 0.02, 'Hunter - Black Arrow($RAP*0.1 / number of ticks)'), +(19306, -1, -1, 0.2, -1, 'Hunter - Counterattack'), +(13812, -1, -1, 0.1, -1, 'Hunter - Explosive Trap Effect'), +(13797, -1, -1, -1, 0.02, 'Hunter - Immolation Trap($RAP*0.1 / number of ticks)'), +(1495, -1, -1, 0.2, -1, 'Hunter - Mongoose Bite'), +(1978, -1, -1, -1, 0.04, 'Hunter - Serpent Sting($RAP*0.2 / number of ticks)'), +(56641, -1, -1, 0.1, -1, 'Hunter - Steady Shot'), +(42243, -1, -1, 0.07, -1, 'Hunter - Volley'), +(53352, -1, -1, 0.14, -1, 'Hunter - Explosive Shot (triggered)'), +(55039, 0, 0, 0, 0, 'Item - Gnomish Lightning Generator'), +(40293, 0, 0, 0, 0, 'Item - Siphon Essence'), +(44425, 0.7143, -1, -1, -1, 'Mage - Arcane Barrage'), +(30451, 0.7143, -1, -1, -1, 'Mage - Arcane Blast'), +(1449, 0.2128, -1, -1, -1, 'Mage - Arcane Explosion'), +(7268, 0.2857, -1, -1, -1, 'Mage - Arcane Missiles Triggered Spell Rank 1'), +(7269, 0.2857, -1, -1, -1, 'Mage - Arcane Missiles Triggered Spell Rank 2'), +(11113, 0.1936, -1, -1, -1, 'Mage - Blast Wave'), +(42208, 0.1437, -1, -1, -1, 'Mage - Blizzard Triggered Spell'), +(120, 0.214, -1, -1, -1, 'Mage - Cone of Cold'), +(31661, 0.1936, -1, -1, -1, 'Mage - Dragons Breath'), +(133, 1, -1, -1, -1, 'Mage - Fire Ball'), +(2136, 0.4286, -1, -1, -1, 'Mage - Fire Blast'), +(543, 0.1, -1, -1, -1, 'Mage - Fire Ward'), +(2120, 0.2357, 0.122, -1, -1, 'Mage - Flamestrike'), +(116, 0.8143, -1, -1, -1, 'Mage - Frost Bolt'), +(122, 0.193, -1, -1, -1, 'Mage - Frost Nova'), +(6143, 0.1, -1, -1, -1, 'Mage - Frost Ward'), +(44614, 0.8571, -1, -1, -1, 'Mage - Frostfire Bolt'), +(11426, 0.8053, -1, -1, -1, 'Mage - Ice Barrier'), +(30455, 0.1429, -1, -1, -1, 'Mage - Ice Lance'), +(12654, 0, 0, 0, 0, 'Mage - Ignite'), +(44457, 0.4, 0.2, -1, -1, 'Mage - Living Bomb'), +(1463, 0.8053, -1, -1, -1, 'Mage - Mana Shield'), +(34913, 0, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 1'), +(11366, 1.15, 0.05, -1, -1, 'Mage - Pyroblast'), +(2948, 0.4286, -1, -1, -1, 'Mage - Scorch'), +(59638, 0.3, -1, 0, -1, 'Mage - Mirror Image Frostbolt'), +(59637, 0.15, -1, 0, -1, 'Mage - Mirror Image Fire Blast'), +(31935, 0.07, -1, 0.07, -1, 'Paladin - Avenger Shield'), +(53742, -1, 0.0176, -1, 0.03, 'Paladin - Blood Corruption'), +(26573, -1, 0.04, -1, 0.04, 'Paladin - Consecration'), +(879, 0.15, -1, 0.15, -1, 'Paladin - Exorcism'), +(19750, 1, -1, -1, -1, 'Paladin - Flash of Light'), +(53595, 0, 0, 0, 0, 'Paladin - Hammer of the Righteous'), +(24275, 0.15, -1, 0.15, -1, 'Paladin - Hammer of Wrath'), +(62124, 0.085, -1, -1, -1, 'Paladin - Hand of Reckoning'), +(635, 1.66, -1, -1, -1, 'Paladin - Holy Light'), +(20925, 0.09, -1, 0.056, -1, 'Paladin - Holy Shield'), +(25914, 0.81, -1, -1, -1, 'Paladin - Holy Shock Triggered Heal Rank 1'), +(25912, 0.4286, -1, -1, -1, 'Paladin - Holy Shock Triggered Hurt Rank 1'), +(31803, -1, 0.0176, -1, 0.03, 'Paladin - Holy Vengeance'), +(2812, 0.07, -1, 0.07, -1, 'Paladin - Holy Wrath'), +(31898, 0.25, -1, 0.16, -1, 'Paladin - Judgement of Blood Enemy'), +(32220, 0.0833, -1, 0.0533, -1, 'Paladin - Judgement of Blood Self'), +(20467, 0.25, -1, 0.16, -1, 'Paladin - Judgement of Command'), +(53733, 0.22, -1, 0.14, -1, 'Paladin - Judgement of Corruption'), +-- (20187, 0.4, -1, 0.25, -1, 'Paladin - Judgement of Righteousness'), +(20187, 0, 0, 0, 0, 'Paladin - Judgement of Righteousness'), +(53726, 0.25, -1, 0.16, -1, 'Paladin - Judgement of the Martyr Enemy'), +(53725, 0.0833, -1, 0.0533, -1, 'Paladin - Judgement of the Martyr Self'), +(31804, 0.22, -1, 0.14, -1, 'Paladin - Judgement of Vengeance'), +-- (54158, 0.25, -1, 0.16, -1, 'Paladin - Judgement (Seal of Light, Seal of Wisdom, Seal of Justice)'), +(54158, 0, 0, 0, 0, 'Paladin - Judgement (Seal of Light, Seal of Wisdom, Seal of Justice)'), +(58597, 0.75, -1, -1, -1, 'Paladin - Sacred Shield'), +(53601, 0.75, -1, -1, -1, 'Paladin - Sacred Shield'), +(31893, 0, 0, 0, 0, 'Paladin - Seal of Blood Proc Enemy'), +(32221, 0, 0, 0, 0, 'Paladin - Seal of Blood Proc Self'), +(20424, 0, 0, 0, 0, 'Paladin - Seal of Command Proc'), +(20167, 0.15, -1, 0.15, -1, 'Paladin - Seal of Light Proc'), +(25742, 0.07, -1, 0.039, -1, 'Paladin - Seal of Righteousness Dummy Proc'), +(53719, 0, 0, 0, 0, 'Paladin - Seal of the Martyr Proc Enemy'), +(53718, 0, 0, 0, 0, 'Paladin - Seal of the Martyr Proc Self'), +(20267, 0, 0, 0, 0, 'Paladin - Judgement of Light Proc'), +(25997, 0, 0, 0, 0, 'Paladin - Eye for an Eye'), +(50256, -1, -1, 0.08, -1, 'Pet Skills - Bear (Swipe)'), +(32546, 0.8068, -1, -1, -1, 'Priest - Binding Heal'), +(27813, 0, 0, 0, 0, 'Priest - Blessed Recovery Rank 1'), +(34861, 0.402, -1, -1, -1, 'Priest - Circle of Healing'), +(19236, 0.8068, -1, -1, -1, 'Priest - Desperate Prayer'), +(2944, -1, 0.1849, -1, -1, 'Priest - Devouring Plague'), +(63544, 0, -1, -1, -1, 'Priest - Empowered Renew'), +(2061, 0.8068, -1, -1, -1, 'Priest - Flash Heal'), +(2060, 1.6135, -1, -1, -1, 'Priest - Greater Heal'), +(14914, 0.5711, 0.024, -1, -1, 'Priest - Holy Fire'), +(15237, 0.1606, -1, -1, -1, 'Priest - Holy Nova Damage'), +(23455, 0.3035, -1, -1, -1, 'Priest - Holy Nova Heal Rank 1'), +(8129, 0, 0, 0, 0, 'Priest - Mana Burn'), +(8092, 0.428, -1, -1, -1, 'Priest - Mind Blast'), +(15407, 0.257, -1, -1, -1, 'Priest - Mind Flay'), +(49821, 0.2861, -1, -1, -1, 'Priest - Mind Sear Trigger Rank 1'), +(47750, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 1)'), +(52983, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 2)'), +(52954, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 3)'), +(58985, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 4)'), +(47666, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 1)'), +(52998, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 2)'), +(52999, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 3)'), +(53000, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 4)'), +(17, 0.8068, -1, -1, -1, 'Priest - Power Word: Shield'), +(596, 0.8068, -1, -1, -1, 'Priest - Prayer of Healing'), +(33110, 0.8068, -1, -1, -1, 'Priest - Prayer of Mending Heal Proc'), +(33619, 0, 0, 0, 0, 'Priest - Reflective Shield'), +(139, -1, 0.376, -1, -1, 'Priest - Renew'), +(32379, 0.4296, -1, -1, -1, 'Priest - Shadow Word: Death'), +(589, -1, 0.1829, -1, -1, 'Priest - Shadow Word: Pain'), +(34433, 0.65, -1, -1, -1, 'Priest - Shadowfiend'), +(585, 0.714, -1, -1, -1, 'Priest - Smite'), +(34914, -1, 0.4, -1, -1, 'Priest - Vampiric Touch'), +(7001, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 1'), +(63675, 0, 0, 0, 0, 'Priest - Improved Devouring Plague'), +(56131, 0, 0, 0, 0, 'Priest - Glyph of Dispel Magic'), +(56160, 0, 0, 0, 0, 'Priest - Glyph of Power Word: Shield'), +(2818, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 1($AP*0.12 / number of ticks)'), +(2819, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 2($AP*0.12 / number of ticks)'), +(11353, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 3($AP*0.12 / number of ticks)'), +(11354, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 4($AP*0.12 / number of ticks)'), +(25349, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 5($AP*0.12 / number of ticks)'), +(26968, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 6($AP*0.12 / number of ticks)'), +(27187, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 7($AP*0.12 / number of ticks)'), +(57969, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 8($AP*0.12 / number of ticks)'), +(57970, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 9($AP*0.12 / number of ticks)'), +(703, -1, -1, -1, 0.02, 'Rogue - Garrote'), +(1776, -1, -1, 0.21, -1, 'Rogue - Gouge'), +(8680, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 1'), +(8685, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 2'), +(8689, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 3'), +(11335, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 4'), +(11336, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 5'), +(11337, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 6'), +(26890, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 7'), +(57964, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 8'), +(57965, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 9'), +(13218, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 1'), +(13222, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 2'), +(13223, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 3'), +(13224, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 4'), +(27189, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 5'), +(57974, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 6'), +(57975, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 7'), +(1064, 1.34, -1, -1, -1, 'Shaman - Chain Heal'), +(421, 0.57, -1, -1, -1, 'Shaman - Chain Lightning'), +(974, 0.4762, -1, -1, -1, 'Shaman - Earth Shield'), +(379, 0, 0, 0, 0, 'Shaman - Earth Shield Triggered'), +(8042, 0.3858, -1, -1, -1, 'Shaman - Earth Shock'), +(8050, 0.2142, 0.1, -1, -1, 'Shaman - Flame Shock'), +(8026, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 1'), +(58788, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 10'), +(8028, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 2'), +(8029, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 3'), +(10445, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 4'), +(16343, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 5'), +(16344, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 6'), +(25488, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 7'), +(58786, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 8'), +(58787, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 9'), +(8056, 0.3858, -1, -1, -1, 'Shaman - Frost Shock'), +(8034, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 1'), +(8037, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 2'), +(10458, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 3'), +(16352, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 4'), +(16353, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 5'), +(25501, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 6'), +(58797, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 7'), +(58798, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 8'), +(58799, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 9'), +(2645, 0, 0, 0, 0, 'Shaman - Glyph of Ghost Wolf'), +(52042, 0.0445, 0.0445, -1, -1, 'Shaman - Healing Stream Totem Triggered Heal'), +(331, 1.6106, -1, -1, -1, 'Shaman - Healing Wave'), +(51505, 0.5714, -1, -1, -1, 'Shaman - Lava Burst'), +(8004, 0.8082, -1, -1, -1, 'Shaman - Lesser Healing Wave'), +(403, 0.7143, -1, -1, -1, 'Shaman - Lightning Bolt'), +(26364, 0.33, -1, -1, -1, 'Shaman - Lightning Shield Proc Rank 1'), +(45284, 0.357, -1, -1, -1, 'Shaman - LO Lightning Bolt'), +(45297, 0.285, -1, -1, -1, 'Shaman - LO Chain Lightning'), +(8188, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 1'), +(10582, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 2'), +(10583, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 3'), +(10584, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 4'), +(25551, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 5'), +(58733, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 6'), +(58736, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 7'), +(61295, 0.4, 0.18, -1, -1, 'Shaman - Riptide'), +(3606, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 1'), +(58702, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 10'), +(6350, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 2'), +(6351, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 3'), +(6352, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 4'), +(10435, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 5'), +(10436, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 6'), +(25530, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 7'), +(58700, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 8'), +(58701, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 9'), +(52752, 0, 0, 0, 0, 'Ancestral Awakening'), +(55533, 0, 0, 0, 0, 'Shaman - Glyph of Healing Wave'), +(50796, 0.7139, -1, -1, -1, 'Warlock - Chaos Bolt'), +(17962, 0, 0, 0, 0, 'Warlock - Conflagrate'), +(172, -1, 0.2, -1, -1, 'Warlock - Corruption'), +(980, -1, 0.1, -1, -1, 'Warlock - Curse of Agony'), +(603, -1, 2, -1, -1, 'Warlock - Curse of Doom'), +(18220, 0.96, -1, -1, -1, 'Warlock - Dark Pact Rank 1'), +(6789, 0.214, -1, -1, -1, 'Warlock - Death Coil'), +(689, -1, 0.143, -1, -1, 'Warlock - Drain Life'), +(5138, 0, 0, 0, 0, 'Warlock - Drain Mana'), +(1120, -1, 0.429, -1, -1, 'Warlock - Drain Soul'), +(28176, 0, 0, 0, 0, 'Warlock - Fel Armor'), +(18790, 0, 0, 0, 0, 'Warlock - Fel Stamina'), +(54181, 0, -1, -1, -1, 'Warlock - Fel Synergy'), +(48181, 0.4793, -1, -1, -1, 'Warlock - Haunt'), +(755, -1, 0.4485, -1, -1, 'Warlock - Health Funnel'), +(1949, -1, 0.0949, -1, -1, 'Warlock - Hellfire'), +(5857, 0.145, -1, -1, -1, 'Warlock - Hellfire Effect on Enemy Rank 1'), +(348, 0.2, 0.2, -1, -1, 'Warlock - Immolate'), +(29722, 0.7139, -1, -1, -1, 'Warlock - Incinerate'), +(42223, 0.286, -1, -1, -1, 'Warlock - Rain of Fire Triggered Rank 1'), +(5676, 0.4293, -1, -1, -1, 'Warlock - Searing Pain'), +(27243, 0.2129, 0.25, -1, -1, 'Warlock - Seed of Corruption'), +(686, 0.8569, -1, -1, -1, 'Warlock - Shadow Bolt'), +(6229, 0.3, -1, -1, -1, 'Warlock - Shadow Ward'), +(17877, 0.4293, -1, -1, -1, 'Warlock - Shadowburn'), +(47960, 0.1064, 0.0667, -1, -1, 'Warlock - Shadowflame Rank 1'), +(61291, 0.1064, 0.0667, -1, -1, 'Warlock - Shadowflame Rank 2'), +(30283, 0.1932, -1, -1, -1, 'Warlock - Shadowfury'), +(63106, 0, 0, 0, 0, 'Warlock - Siphon Life Triggered'), +(6353, 1.15, -1, -1, -1, 'Warlock - Soul Fire'), +(30294, 0, 0, 0, 0, 'Warlock - Soul Leech'), +(30108, -1, 0.2, -1, -1, 'Warlock - Unstable Affliction'), +(31117, 1.8, -1, -1, -1, 'Warlock - Unstable Affliction Dispell'), +(57755, -1, -1, 0.5, -1, 'Warrior - Heroic Throw'), +(20253, -1, -1, 0.12, -1, 'Warrior - Intercept'), +(61491, -1, -1, 0.12, -1, 'Warrior - Intercept'), +(6572, -1, -1, 0.207, -1, 'Warrior - Revenge'), +(64382, -1, -1, 0.5, -1, 'Warrior - Shattering Throw'), +(6343, -1, -1, 0.12, -1, 'Warrior - Thunder Clap'), +(54757, 0, -1, -1, -1, 'Hand-Mounted Pyro Rocket - Pyro Rocket'), +(45055, 0, -1, -1, -1, 'Timbal''s Focusing Crystal - Shadow Bolt'), +(60203, 0, -1, -1, -1, 'Darkmoon Card: Death'), +(60488, 0, -1, -1, -1, 'Extract of Necromatic Power'), +(45429, 0, -1, -1, -1, 'Shattered Sun Pendant of Acumen - Arcane Bolt'); +/*!40000 ALTER TABLE `spell_bonus_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_dbc` +-- + +DROP TABLE IF EXISTS `spell_dbc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_dbc` ( + `Id` int(10) unsigned NOT NULL, + `Dispel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Mechanic` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Attributes` int(10) unsigned NOT NULL DEFAULT '0', + `AttributesEx` int(10) unsigned NOT NULL DEFAULT '0', + `AttributesEx2` int(10) unsigned NOT NULL DEFAULT '0', + `AttributesEx3` int(10) unsigned NOT NULL DEFAULT '0', + `AttributesEx4` int(10) unsigned NOT NULL DEFAULT '0', + `AttributesEx5` int(10) unsigned NOT NULL DEFAULT '0', + `Stances` int(10) unsigned NOT NULL DEFAULT '0', + `StancesNot` int(10) unsigned NOT NULL DEFAULT '0', + `Targets` int(10) unsigned NOT NULL DEFAULT '0', + `CastingTimeIndex` tinyint(3) unsigned NOT NULL DEFAULT '1', + `AuraInterruptFlags` int(10) unsigned NOT NULL DEFAULT '0', + `ProcFlags` int(10) unsigned NOT NULL DEFAULT '0', + `ProcChance` tinyint(3) unsigned NOT NULL DEFAULT '0', + `ProcCharges` tinyint(3) unsigned NOT NULL DEFAULT '0', + `MaxLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `BaseLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `SpellLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `DurationIndex` smallint(5) unsigned NOT NULL DEFAULT '0', + `RangeIndex` tinyint(3) unsigned NOT NULL DEFAULT '1', + `StackAmount` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EquippedItemClass` int(11) NOT NULL DEFAULT '-1', + `EquippedItemSubClassMask` int(11) NOT NULL DEFAULT '0', + `EquippedItemInventoryTypeMask` int(11) NOT NULL DEFAULT '0', + `Effect1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Effect2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `Effect3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectDieSides1` int(11) NOT NULL DEFAULT '0', + `EffectDieSides2` int(11) NOT NULL DEFAULT '0', + `EffectDieSides3` int(11) NOT NULL DEFAULT '0', + `EffectRealPointsPerLevel1` float NOT NULL DEFAULT '0', + `EffectRealPointsPerLevel2` float NOT NULL DEFAULT '0', + `EffectRealPointsPerLevel3` float NOT NULL DEFAULT '0', + `EffectBasePoints1` int(11) NOT NULL DEFAULT '0', + `EffectBasePoints2` int(11) NOT NULL DEFAULT '0', + `EffectBasePoints3` int(11) NOT NULL DEFAULT '0', + `EffectMechanic1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectMechanic2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectMechanic3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectImplicitTargetA1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectImplicitTargetA2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectImplicitTargetA3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectImplicitTargetB1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectImplicitTargetB2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectImplicitTargetB3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectRadiusIndex1` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectRadiusIndex2` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectRadiusIndex3` tinyint(3) unsigned NOT NULL DEFAULT '0', + `EffectApplyAuraName1` smallint(5) unsigned NOT NULL DEFAULT '0', + `EffectApplyAuraName2` smallint(5) unsigned NOT NULL DEFAULT '0', + `EffectApplyAuraName3` smallint(5) unsigned NOT NULL DEFAULT '0', + `EffectAmplitude1` int(11) NOT NULL DEFAULT '0', + `EffectAmplitude2` int(11) NOT NULL DEFAULT '0', + `EffectAmplitude3` int(11) NOT NULL DEFAULT '0', + `EffectMultipleValue1` float NOT NULL DEFAULT '0', + `EffectMultipleValue2` float NOT NULL DEFAULT '0', + `EffectMultipleValue3` float NOT NULL DEFAULT '0', + `EffectMiscValue1` int(11) NOT NULL DEFAULT '0', + `EffectMiscValue2` int(11) NOT NULL DEFAULT '0', + `EffectMiscValue3` int(11) NOT NULL DEFAULT '0', + `EffectMiscValueB1` int(11) NOT NULL DEFAULT '0', + `EffectMiscValueB2` int(11) NOT NULL DEFAULT '0', + `EffectMiscValueB3` int(11) NOT NULL DEFAULT '0', + `EffectTriggerSpell1` int(10) unsigned NOT NULL DEFAULT '0', + `EffectTriggerSpell2` int(10) unsigned NOT NULL DEFAULT '0', + `EffectTriggerSpell3` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskA1` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskA2` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskA3` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskB1` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskB2` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskB3` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskC1` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskC2` int(10) unsigned NOT NULL DEFAULT '0', + `EffectSpellClassMaskC3` int(10) unsigned NOT NULL DEFAULT '0', + `MaxTargetLevel` tinyint(3) unsigned NOT NULL DEFAULT '0', + `SpellFamilyName` tinyint(3) unsigned NOT NULL DEFAULT '0', + `SpellFamilyFlags1` int(10) unsigned NOT NULL DEFAULT '0', + `SpellFamilyFlags2` int(10) unsigned NOT NULL DEFAULT '0', + `SpellFamilyFlags3` int(10) unsigned NOT NULL DEFAULT '0', + `MaxAffectedTargets` tinyint(3) unsigned NOT NULL DEFAULT '0', + `DmgClass` tinyint(3) unsigned NOT NULL DEFAULT '0', + `PreventionType` tinyint(3) unsigned NOT NULL DEFAULT '0', + `DmgMultiplier1` float NOT NULL DEFAULT '0', + `DmgMultiplier2` float NOT NULL DEFAULT '0', + `DmgMultiplier3` float NOT NULL DEFAULT '0', + `AreaGroupId` int(11) NOT NULL DEFAULT '0', + `SchoolMask` int(10) unsigned NOT NULL DEFAULT '0', + `Comment` text NOT NULL, + PRIMARY KEY (`Id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom spell.dbc entries'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_dbc` +-- + +LOCK TABLES `spell_dbc` WRITE; +/*!40000 ALTER TABLE `spell_dbc` DISABLE KEYS */; +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`Stances`,`StancesNot`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(62388, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 21, 1, 0, -1, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Demonic Circle: Teleport(48020) - casterAuraSpell'), +(65142, 3, 22, 0, 0, 0, 128, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 21, 13, 0, -1, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 'Crypt Fever - SPELL_AURA_LINKED'), +(34145, 0, 0, 0, 0, 0, 67108864, 0, 0, 0, 0, 0, 1, 0, 0, 101, 0, 0, 80, 80, 0, 1, 0, -1, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29886, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 'Ritual of Souls Rank 1 - Trigger Create Soulwell (29886)'), +(58888, 0, 0, 0, 0, 0, 67108864, 0, 0, 0, 0, 0, 1, 0, 0, 101, 0, 0, 68, 68, 0, 1, 0, -1, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58889, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 'Ritual of Souls Rank 2 - Trigger Create Soulwell (58889)'), +(61988, 0, 0, 671089024, 268436480, 4, 269484032, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 25, 13, 0, -1, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Divine Shield Exclude Aura - 61988'), +(200000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 8, 1, 0, -1, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 'Drain Soul increased damage - serverside spell'), +(42876, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 9275 reward serverside spell'), +(44987, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11521 reward serverside spell'), +(48803, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 12214 reward serverside spell'), +(68496, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Item_template serverside spell'), +(72958, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Item_template serverside spell'), +(32780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 10040 reward serverside spell'), +(45453, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11587 reward serverside spell'), +(25347, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Item_template serverside spell'), +(45315, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11566 reward serverside spell'), +(43236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11288 reward serverside spell'), +(43459, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11332 reward serverside spell'), +(43499, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11250 reward serverside spell'), +(44275, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11432 reward serverside spell'), +(64689, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 13854 and 13862 reward serverside spell'), +(50574, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 12597 reward serverside spell'), +(71356, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2108 spellid0 serverside spell'), +(71803, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2108 spellid1 serverside spell'), +(72111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2136 spellid0 serverside spell'), +(72125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2136 spellid1 serverside spell'), +(70816, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid0 serverside spell'), +(72233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid1 serverside spell'), +(72234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid2 serverside spell'), +(72235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid3 serverside spell'), +(58428, 0, 0, 671089024, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 100, 0, 0, 0, 0, 18, 1, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 226, 0, 0, 20000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 'Overkill - aura remove spell'), +(56817, 0, 0, 384, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 16, 101, 1, 0, 67, 67, 1, 1, 0, -1, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Rune strike proc'), +(24899, 0, 0, 400, 1024, 0, 0, 2097152, 0, 144, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 21, 1, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 137, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'Heart of the Wild Bear Effect'), +(24900, 0, 0, 400, 1024, 0, 0, 2097152, 0, 1, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 21, 1, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'Heart of the Wild Cat Effect'), +(43503, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11261 reward serverside spell'), +(39613, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 10967 reward serverside spell'), +(34448, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Serverside spell orb of translocation (gobjid=180911)'), +(34452, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Serverside spell orb of translocation (gobjid=180912)'), +(39616, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 10966 reward serverside spell'), +(11202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Item 3776 spellid_1 serverside spell'), +(25359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Item 21293 spellid_2 serverside spell'), +(40145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11000 RewSpellCast serverside spell'), +(45767, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 11670 RewSpellCast serverside spell'), +(71098, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Quest 24451 RewSpellCast serverside spell'); +/*!40000 ALTER TABLE `spell_dbc` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_disabled` +-- + +DROP TABLE IF EXISTS `spell_disabled`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_disabled` ( + `entry` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Spell entry', + `disable_mask` int(8) unsigned NOT NULL DEFAULT '0', + `comment` varchar(64) NOT NULL DEFAULT '', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Disabled Spell System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_disabled` +-- + +LOCK TABLES `spell_disabled` WRITE; +/*!40000 ALTER TABLE `spell_disabled` DISABLE KEYS */; +/*!40000 ALTER TABLE `spell_disabled` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_group` +-- + +DROP TABLE IF EXISTS `spell_group`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_group` ( + `id` int(11) unsigned NOT NULL DEFAULT 0, + `spell_id` int(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`, `spell_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Spell System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_group` +-- + +LOCK TABLES `spell_group` WRITE; +/*!40000 ALTER TABLE `spell_group` DISABLE KEYS */; +INSERT INTO `spell_group` (`id`, `spell_id`) VALUES + -- SPELL_GROUP_ELIXIR_BATTLE +(1, 2367), +(1, 2374), +(1, 3160), +(1, 3164), +(1, 7844), +(1, 8212), +(1, 10667), +(1, 10669), +(1, 11328), +(1, 11334), +(1, 11390), +(1, 11405), +(1, 11406), +(1, 11474), +(1, 16322), +(1, 16323), +(1, 16329), +(1, 17038), +(1, 17537), +(1, 17538), +(1, 17539), +(1, 17624), +(1, 17626), +(1, 17627), +(1, 17628), +(1, 17629), +(1, 21920), +(1, 26276), +(1, 28486), +(1, 28488), +(1, 28490), +(1, 28491), +(1, 28493), +(1, 28497), +(1, 28501), +(1, 28503), +(1, 28518), +(1, 28519), +(1, 28520), +(1, 28521), +(1, 28540), +(1, 33720), +(1, 33721), +(1, 33726), +(1, 38954), +(1, 40567), +(1, 40568), +(1, 40572), +(1, 40573), +(1, 40575), +(1, 40576), +(1, 41608), +(1, 41609), +(1, 41610), +(1, 41611), +(1, 42735), +(1, 45373), +(1, 46837), +(1, 46839), +(1, 53746), +(1, 53748), +(1, 53749), +(1, 53752), +(1, 53755), +(1, 53758), +(1, 53760), +(1, 54212), +(1, 54452), +(1, 54494), +(1, 60340), +(1, 60341), +(1, 60344), +(1, 60345), +(1, 60346), +(1, 62380), +(1, 67016), +(1, 67017), +(1, 67018), + -- SPELL_GROUP_ELIXIR_GUARDIAN +(2, 673), +(2, 2378), +(2, 2380), +(2, 3166), +(2, 3219), +(2, 3220), +(2, 3222), +(2, 3223), +(2, 3593), +(2, 10668), +(2, 10692), +(2, 10693), +(2, 11319), +(2, 11348), +(2, 11349), +(2, 11364), +(2, 11371), +(2, 11396), +(2, 15231), +(2, 15233), +(2, 16321), +(2, 16325), +(2, 16326), +(2, 16327), +(2, 17535), +(2, 17624), +(2, 17626), +(2, 17627), +(2, 17628), +(2, 17629), +(2, 24361), +(2, 24363), +(2, 24382), +(2, 24383), +(2, 24417), +(2, 27652), +(2, 27653), +(2, 28502), +(2, 28509), +(2, 28514), +(2, 28518), +(2, 28519), +(2, 28520), +(2, 28521), +(2, 28540), +(2, 29348), +(2, 39625), +(2, 39626), +(2, 39627), +(2, 39628), +(2, 40567), +(2, 40568), +(2, 40572), +(2, 40573), +(2, 40575), +(2, 40576), +(2, 41608), +(2, 41609), +(2, 41610), +(2, 41611), +(2, 42735), +(2, 46837), +(2, 46839), +(2, 53747), +(2, 53751), +(2, 53752), +(2, 53755), +(2, 53758), +(2, 53760), +(2, 53763), +(2, 53764), +(2, 54212), +(2, 60343), +(2, 60347), +(2, 62380), +(2, 67016), +(2, 67017), +(2, 67018), + -- SPELL_GROUP_ELIXIR_UNSTABLE +(3, 40567), +(3, 40568), +(3, 40572), +(3, 40573), +(3, 40575), +(3, 40576), + -- SPELL_GROUP_ELIXIR_SHATTRATH +(4, 41608), +(4, 41609), +(4, 41610), +(4, 41611), +(4, 46837), +(4, 46839), + -- Well Fed +(1001, 19705), +(1001, 19706), +(1001, 19708), +(1001, 19709), +(1001, 19710), +(1001, 19711), +(1001, 24799), +(1001, 24870), +(1001, 25694), +(1001, 25941), +(1001, 33254), +(1001, 33256), +(1001, 33257), +(1001, 33259), +(1001, 33261), +(1001, 33263), +(1001, 33265), +(1001, 33268), +(1001, 33272), +(1001, 35272), +(1001, 40323), +(1001, 42293), +(1001, 43764), +(1001, 43771), +(1001, 44097), +(1001, 44098), +(1001, 44099), +(1001, 44100), +(1001, 44101), +(1001, 44102), +(1001, 44104), +(1001, 44105), +(1001, 44106), +(1001, 45245), +(1001, 45619), +(1001, 46682), +(1001, 46687), +(1001, 46899), +(1001, 53284), +(1001, 57079), +(1001, 57097), +(1001, 57100), +(1001, 57102), +(1001, 57107), +(1001, 57111), +(1001, 57139), +(1001, 57286), +(1001, 57288), +(1001, 57291), +(1001, 57294), +(1001, 57325), +(1001, 57327), +(1001, 57329), +(1001, 57332), +(1001, 57334), +(1001, 57356), +(1001, 57358), +(1001, 57360), +(1001, 57363), +(1001, 57365), +(1001, 57367), +(1001, 57371), +(1001, 57373), +(1001, 57399), +(1001, 58468), +(1001, 58479), +(1001, 59230), +(1001, 59690), +(1001, 59699), +(1001, 62349), +(1001, 64057), +(1001, 65247), +(1001, 65365), +(1001, 65410), +(1001, 65412), +(1001, 65414), +(1001, 65415), +(1001, 65416), +(1001, 66623), +(1001, 66624), +(1001, 69559), +(1001, 18125), +(1001, 18141), +(1001, 23697), + -- Blessing of Might +(1002, 19740), +(1002, 25782), +(1002, 56520), +-- Battle Shout +(1003, 6673), +-- Blessing of Might, Battle Shout +(1004, -1002), +(1004, -1003), +-- Blessing of Wisdom +(1005, 19742), +(1005, 25894), +(1005, 56521), +-- Blessing of Kings +(1006, 20217), +(1006, 25898), +(1006, 43223), +(1006, 56525), +(1006, 58054), +-- Blessing of Sanctuary +(1007, 20911), +(1007, 25899), +-- Blessing of Protection +(1008, 41450), +(1008, 23415), +-- Blessing of Light +(1009, 32770), +-- Blessings +(1010, -1002), +(1010, -1005), +(1010, -1006), +(1010, -1007), +(1010, -1008), +(1010, -1009), +-- Commanding shout, Battle Shout +(1011,-1083), +(1011, -1003), +-- Armor Debuff (Major) +(1012,55749), -- Acid Spit +(1013,8647), -- Exposed Armor +(1014,7386), -- sunder Armor +-- Armor Debuff (Minor) +(1016,770), -- Faerie Fire +(1016,16857), -- Faerie Fire +(1017,56626), -- Sting +(1018,16231), -- Curse of Recklessness +-- Melee Haste Buff +(1020,55610), -- Improved Icy Talons +(1021,8515), -- windfury totem +-- Melee Critical Strike Chance Buff +(1023,17007), -- Leader of the Pack +(1024,29801), -- Rampage +-- Attack Power Buff (Multiplier) +(1026,53137), -- Abomination's Might +(1027,19506), -- Trueshot Aura +(1028,30802), -- Unleashed Rage +-- Bleed Damage Increase Debuff +(1030,33878), -- Mangle (Bear) +(1031,33876), -- Mangle (Cat) +(1032,46854), -- Trauma +-- Spell Critical Strike Chance Buff +(1034,24907), -- moonkng aura +(1035,51466), -- elemental oath +-- Spell Critical Strike Chance Debuff +(1037,11095), -- improved scorch +(1038,11180), -- Winter's Chill +-- Increased Spell Damage Taken Debuff +(1040,51099), -- Ebon Plaguebringer +(1041,48506), -- Earth and Moon +(1042,1490), -- Curse of the Elements +-- Increased Spell Power Buff +(1044,54646), -- Focus Magic +(1045,52109), -- Flametongue Totem +(1046,63283), -- Totem of Wrath +(1046,57658), -- Totem of Wrath +(1046,57660), -- Totem of Wrath +(1046,57662), -- Totem of Wrath +(1046,57663), -- Totem of Wrath +(1046,30708), -- Totem of Wrath +(1047,53646), -- Demonic Pact +-- Increased Spell Hit Chance Taken Debuff +(1049,33600), -- Improved Faerie Fire +(1050,33191), -- Misery +-- Percentage Haste Increase (All Types) +(1052,48384), -- Improved Moonkin Form +(1053,53379), -- Swift Retribution +-- Percentage Damage Increase +(1055,34455), -- Ferocious Inspiration +(1056,31869), -- Sanctified Retribution +-- Critical Strike Chance Taken Debuff (All types) +(1058,20335), -- Heart of the Crusader +-- totem of wrath 1046 CHECK IT! +-- Melee Attack Speed Slow Debuff +(1060,45477), -- Icy Touch +(1061,48483), -- Infected Wounds +(1062,53695), -- Judgements of the Just +(1063,6343), -- Thunder Clap +-- Melee Hit Chance Reduction Debuff +(1066,5570), -- Insect Swarm +(1067,3043), -- Scorpid Sting +-- Healing Debuff +(1070,13218), -- Wound Posion +(1071,19434), -- Aimed Shot +(1072,12294), -- Mortal Strike +(1073,46910), -- Furious Attacks +-- Attack Power Debuff +(1076,99), -- Demoralizing Roar +(1077,702), -- Curse of Weakness +(1078,1160), -- Demoralizing Shout +-- Agility and Strength Buff +(1080,8076), -- Strength of Earth +(1081,57330), -- Horn of Winter +-- Health Buff +(1083,469), -- Commanding Shout +(1084,6307), -- Blood Pact +-- Intellect Buff +(1086,1459), -- Arcane Intellect +(1104,23028), -- Arcane Brilliance +(1087,54424), -- Fel Intelligence +-- Spirit Buff +-- fel intelegencegoes here +(1105,14752), -- Divine Spirit +(1106,27681), -- Prayer of Spirit +-- Damage Reduction Percentage Buff +(1091,47930), -- Grace +(1092,20911), -- Blessing of Sanctuary +-- Percentage Increase Healing Received Buff +(1094,34123), -- tree of life aura +(1095,20138), -- Improved Devotion Aura +-- Armor Increase Percentage Buff +(1097,14892), -- Inspiration +(1098,16176), -- Ancestral Healing +-- Cast Speed Slow +(1100,1714), -- Curse of Tongues +(1101,31589), -- Slow +(1102,5760), -- Mind-numbing Poison +-- Armor Debuff (Major) +(1015,-1012), +(1015,-1013), +(1015,-1014), +-- Armor Debuff (Minor) +(1019,-1016), +(1019,-1017), +(1019,-1018), +-- Melee Haste Buff +(1022,-1020), +(1022,-1021), +-- Melee Critical Strike Chance Buff +(1025,-1023), +(1025,-1024), +-- Attack Power Buff (Multiplier) +(1029,-1026), +(1029,-1027), +(1029,-1028), +-- Bleed Damage Increase Debuff +(1033,-1030), +(1033,-1031), +(1033,-1032), +-- Spell Critical Strike Chance Buff +(1036,-1034), +(1036,-1035), +-- Spell Critical Strike Chance Debuff +(1039,-1037), +(1039,-1038), +-- Increased Spell Damage Taken Debuff +(1043,-1040), +(1043,-1041), +(1043,-1042), +-- Increased Spell Power Buff +(1048,-1044), +(1048,-1045), +(1048,-1046), +(1048,-1047), +-- Increased Spell Hit Chance Taken Debuff +(1051,-1049), +(1051,-1050), +-- Percentage Haste Increase (All Types) +(1054,-1052), +(1054,-1053), +-- Percentage Damage Increase +(1057,-1055), +(1057,-1056), +-- Critical Strike Chance Taken Debuff (All types) +(1059,-1058), +(1059,-1046), +-- Melee Attack Speed Slow Debuff +(1064,-1060), +(1064,-1061), +(1064,-1062), +(1064,-1063), +-- Melee Hit Chance Reduction Debuff +(1068,-1066), +(1068,-1067), +-- Healing Debuff +(1074,-1070), +(1074,-1071), +(1074,-1072), +(1074,-1073), +-- Attack Power Debuff +(1079,-1076), +(1079,-1077), +(1079,-1078), +-- Agility and Strength Buff +(1082,-1080), +(1082,-1081), +-- Health Buff +(1085,-1083), +(1085,-1084), +-- Intellect Buff +(1088,-1086), +(1088,-1104), +(1088,-1087), +-- Spirit Buff +(1090,-1087), +(1090,-1105), +(1090,-1106), +-- Damage Reduction Percentage Buff +(1093,-1091), +(1093,-1092), +-- Percentage Increase Healing Received Buff +(1096,-1094), +(1096,-1095), +-- Armor Increase Percentage Buff +(1099,-1097), +(1099,-1098), +-- Cast Speed Slow +(1103,-1100), +(1103,-1001), +(1103,-1002), +-- mage freezing spells +(1107, 122), -- Frost Nova +(1107, 33395), -- Freeze +(1107, 55080); -- Shattered Barrier + +/*!40000 ALTER TABLE `spell_group` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_enchant_proc_data` +-- + +DROP TABLE IF EXISTS `spell_enchant_proc_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_enchant_proc_data` ( + `entry` int(10) unsigned NOT NULL, + `customChance` int(10) unsigned NOT NULL DEFAULT '0', + `PPMChance` float unsigned NOT NULL DEFAULT '0', + `procEx` float unsigned NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Spell enchant proc data'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_enchant_proc_data` +-- + +LOCK TABLES `spell_enchant_proc_data` WRITE; +/*!40000 ALTER TABLE `spell_enchant_proc_data` DISABLE KEYS */; +INSERT INTO spell_enchant_proc_data (`entry`,`customChance`,`PPMChance`,`procEx`) VALUES + -- Frostbrand Weapon +(2, 0, 8.8,0), +(12, 0, 8.8,0), +(524, 0, 8.8,0), +(1667, 0, 8.8,0), +(1668, 0, 8.8,0), +(2635, 0, 8.8,0), +(3782, 0, 8.8,0), +(3783, 0, 8.8,0), +(3784, 0, 8.8,0), + -- Wound Poison +(703, 0, 21.43,0), +(704, 0, 21.43,0), +(705, 0, 21.43,0), +(706, 0, 21.43,0), +(2644, 0, 21.43,0), +(3772, 0, 21.43,0), +(3773, 0, 21.43,0), + -- Instant Poison +(323, 0, 8.53,0), +(324, 0, 8.53,0), +(325, 0, 8.53,0), +(623, 0, 8.53,0), +(624, 0, 8.53,0), +(625, 0, 8.53,0), +(2641, 0, 8.53,0), +(3768, 0, 8.53,0), +(3769, 0, 8.53,0), + -- Fiery Weapon +(803, 0, 6.0,0), + -- Demonslaying +(912, 0, 6.0,0), + -- Icy Weapon +(1894, 0, 3.0,0), + -- Lifestealing +(1898, 0, 6.0,0), + -- Unholy Weapon +(1899, 0, 1.0,0), + -- Crusader +(1900, 0, 1.0,0), + -- Mongoose +(2673, 0, 1.0,0), + -- Battlemaster +(2675, 0, 1.0,0), + -- Executioner +(3225, 0, 1.0,0), + -- Icebreaker Weapon +(3239, 0, 3.0,0), + -- Lifeward +(3241, 0, 3.0,0), + -- Giantslaying +(3251, 0, 3.0,0), + -- Deathfrost +(3273, 0, 3.0,0), + -- Rune of the Fallen Crusader +(3368, 0, 1.0,0), + -- Rune of Cinderglacier +(3369, 0, 1.0,0), + -- Berserking +(3789, 0, 1.0,0), + -- Blade Ward +(3869, 0, 1.0,0); +/*!40000 ALTER TABLE `spell_enchant_proc_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_learn_spell` +-- + +DROP TABLE IF EXISTS `spell_learn_spell`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_learn_spell` ( + `entry` smallint(5) unsigned NOT NULL DEFAULT '0', + `SpellID` smallint(5) unsigned NOT NULL DEFAULT '0', + `Active` tinyint(3) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`entry`,`SpellID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Item System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_learn_spell` +-- + +LOCK TABLES `spell_learn_spell` WRITE; +/*!40000 ALTER TABLE `spell_learn_spell` DISABLE KEYS */; +INSERT INTO `spell_learn_spell` VALUES (53428,53341,1),(53428,53343,1),(17002,24867,0),(24866,24864,0),(33872,47179,0),(33873,47180,0),(33943,34090,1),(58984,21009,1); +/*!40000 ALTER TABLE `spell_learn_spell` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_linked_spell` +-- + +-- -------- +-- LINKED +-- -------- +-- spell1 / spell2 / type +-- + + 0 caster casts 2 when casts 1 +-- + - 0 caster removes aura 2 when casts 1 +-- + + 1 target casts 2 on self (originalCaster = caster) when 1 casted by caster hits target +-- + - 1 target removes aura 2 when hit by 1 +-- + + 2 when aura 1 is applied, aura 2 is also applied; when 1 is removed, 2 is also removed +-- + - 2 when aura 1 is applied, target is immune to spell 2, until 1 is removed +-- - + 0 target casts 2 on self (originalCaster = caster) when aura 1 casted by caster is removed +-- - - 0 aura 2 is removed when aura 1 is removed + +DROP TABLE IF EXISTS `spell_linked_spell`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_linked_spell` ( + `spell_trigger` mediumint(8) NOT NULL, + `spell_effect` mediumint(8) NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `comment` text NOT NULL, + UNIQUE KEY `trigger_effect_type` (`spell_trigger`,`spell_effect`,`type`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Spell System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_linked_spell` +-- + +LOCK TABLES `spell_linked_spell` WRITE; +/*!40000 ALTER TABLE `spell_linked_spell` DISABLE KEYS */; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +-- class +( 16857, 60089, 0, 'Faerie Fire (Feral)'), +( 31224, -1543, 2, 'Cloak of Shadows - Flare'), +( 15237, 23455, 0, 'Holy Nova (rank1)'), +( 15430, 23458, 0, 'Holy Nova (rank2)'), +( 15431, 23459, 0, 'Holy Nova (rank3)'), +( 27799, 27803, 0, 'Holy Nova (rank4)'), +( 27800, 27804, 0, 'Holy Nova (rank5)'), +( 27801, 27805, 0, 'Holy Nova (rank6)'), +( 25331, 25329, 0, 'Holy Nova (rank7)'), +( 48077, 48075, 0, 'Holy Nova (rank8)'), +( 48078, 48076, 0, 'Holy Nova (rank9)'), +(-19386, 24131, 0, 'Wyvern Sting'), +(-24132, 24134, 0, 'Wyvern Sting'), +(-24133, 24135, 0, 'Wyvern Sting'), +(-27068, 27069, 0, 'Wyvern Sting'), +(-49011, 49009, 0, 'Wyvern Sting'), +(-49012, 49010, 0, 'Wyvern Sting'), +( 47585, 60069, 2, 'Dispersion (transform/regen)'), +( 47585, 63230, 2, 'Dispersion (immunity)'), +( 61847, 61848, 2, 'Aspect of the dragonhawk'), +( 61846, 61848, 2, 'Aspect of the dragonhawk'), +( 47988, 54501, 2, 'Consume Shadows - Rank 9'), +( 47987, 54501, 2, 'Consume Shadows - Rank 8'), +( 27272, 54501, 2, 'Consume Shadows - Rank 7'), +( 17854, 54501, 2, 'Consume Shadows - Rank 6'), +( 17853, 54501, 2, 'Consume Shadows - Rank 5'), +( 17852, 54501, 2, 'Consume Shadows - Rank 4'), +( 17851, 54501, 2, 'Consume Shadows - Rank 3'), +( 17850, 54501, 2, 'Consume Shadows - Rank 2'), +( 17767, 54501, 2, 'Consume Shadows - Rank 1'), +(-5143, -36032, 0, 'Arcane Missiles Rank 1'), +(-5144, -36032, 0, 'Arcane Missiles Rank 2'), +(-5145, -36032, 0, 'Arcane Missiles Rank 3'), +(-8416, -36032, 0, 'Arcane Missiles Rank 4'), +(-8417, -36032, 0, 'Arcane Missiles Rank 5'), +(-10211,-36032, 0, 'Arcane Missiles Rank 6'), +(-10212,-36032, 0, 'Arcane Missiles Rank 7'), +(-25345,-36032, 0, 'Arcane Missiles Rank 8'), +(-27075,-36032, 0, 'Arcane Missiles Rank 9'), +(-38699,-36032, 0, 'Arcane Missiles Rank 10'), +(-38704,-36032, 0, 'Arcane Missiles Rank 11'), +(-42843,-36032, 0, 'Arcane Missiles Rank 12'), +(-42846,-36032, 0, 'Arcane Missiles Rank 13'), +( 53563, 53651, 2, 'Beacon of Light'), +( 781, 56446, 0, 'Disengage'), +( 57635, 57636, 0, 'Disengage'), +( 60932, 60934, 0, 'Disengage'), +( 61507, 61508, 0, 'Disengage'), +( 49576, 49560, 0, 'Death Grip'), +( 47897, 47960, 1, 'Shadowflame Rank 1'), +( 61290, 61291, 1, 'Shadowflame Rank 2'), +( 51723, 52874, 0, 'Fan Of Knives'), +( 32386, 60448, 2, 'Shadow Embrace Rank1'), +( 32388, 60465, 2, 'Shadow Embrace Rank2'), +( 32389, 60466, 2, 'Shadow Embrace Rank3'), +( 32390, 60467, 2, 'Shadow Embrace Rank4'), +( 32391, 60468, 2, 'Shadow Embrace Rank5'), +( 33206, 44416, 2, 'Pain Suppression (threat)'), +( 52610, 62071, 0, 'Savage Roar'), +(-52610,-62071, 0, 'Savage Roar'), +( 51209, 55095, 1, 'Hungering cold - frost fever'), +( 50334, 58923, 2, 'Berserk - modify target number aura'), +(-5229, -51185, 0, 'King of the Jungle - remove with enrage'), +( 48384, 50170, 2, 'Improved Moonkin Form'), +( 48395, 50171, 2, 'Improved Moonkin Form'), +( 48396, 50172, 2, 'Improved Moonkin Form'), +( 20594, 65116, 0, 'Stoneform'), +( 49039, 50397, 2, 'Lichborne - shapeshift'), +( 64382, 64380, 0, 'Shattering Throw'), +(-59907, 7, 0, 'Lightwell Charges - Suicide'), +( 19263, 67801, 2, 'Deterrence'), +( 45524, 55095, 0, 'Chains of Ice - Frost Fever'), +( 20066,-61840, 0, 'Repentance'), +( 66235, 66233, 0, 'Ardent Defender Visuals'), +-- Quest +( 40214, 40216, 2, 'Dragonmaw Illusion'), +( 40214, 42016, 2, 'Dragonmaw Illusion'), +( 66744, 66747, 0, 'Totem of the earthen ring'), +( 53099, 53098, 0, 'Trigger teleport to acherus (for quest 12757)'), +-- Creature +( 36574, 36650, 0, 'Apply Phase Slip Vulnerability'), +-- instance +(-30410, 44032, 0, 'Manticron Cube Mind Exhaustion'), +(-33711, 33686, 0, 'Murmur''s Shockwave (Normal)'), +(-38794, 33686, 0, 'Murmur''s Shockwave (Heroic)'), +( 33686, 31705, 0, 'Murmur''s Shockwave Jump'), +-- Zul'aman +( 44008, 45265, 1, 'Static Disruption Visual'), +( 43648, 44007, 1, 'Storm Eye Safe Zone'), +( 44007,-43657, 2, 'Storm Eye Safe Zone Immune'), +( 43658, 43653, 0, 'Electrical Arc Visual'), +( 43658, 43654, 0, 'Electrical Arc Visual'), +( 43658, 43655, 0, 'Electrical Arc Visual'), +( 43658, 43656, 0, 'Electrical Arc Visual'), +( 43658, 43659, 0, 'Electrical Arc Visual'), +-- black temple +-- (39992, 39835, 1, 'Needle Spine'), +( 39835, 39968, 1, 'Needle Spine'), +(-41376, 41377, 0, 'Spite'), +( 41126, 41131, 1, 'Flame Crash'), +(-41914, 41915, 0, 'Summon Parasitic Shadowfiend'), +(-41917, 41915, 0, 'Summon Parasitic Shadowfiend'), +( 39908, 40017, 1, 'Eye Blast'), +( 40604, 40616, 1, 'Fel Rage Aura'), +( 40616, 41625, 1, 'Fel Rage Aura'), +( 41292, 42017, 2, 'Aura of Suffering'), +-- sunwell +( 44869, 44866, 1, 'Spectral Blast Portal'), +-- (44869, 46648, 1, 'Spectral Blast Visual'), cause severe lag seems should be casted by go +( 44869, 46019, 1, 'Spectral Blast Teleport'), +( 46019, 46021, 1, 'Spectral Realm Aura'), +-- (46021, 44852, 1, 'Spectral Realm Aura'), 44852 makes boss friendly to you +(-46021, 46020, 0, 'Teleport: Normal Realm'), +( 46020, 44867, 1, 'Spectral Exhaustion'), +( 44867,-46019, 2, 'Spectral Exhaustion - Teleport: Spectral Realm'), +( 45661, 45665, 1, 'Encapsulate'), +( 45347,-45348, 1, 'Remove Flame Touched'), +( 45348,-45347, 1, 'Remove Dark Touched'), +( 45248, 45347, 1, 'Apply Dark Touched'), +( 45329, 45347, 1, 'Apply Dark Touched'), +( 45256, 45347, 1, 'Apply Dark Touched'), +( 45270, 45347, 1, 'Apply Dark Touched'), +( 45342, 45348, 1, 'Apply Flame Touched'), +( 46771, 45348, 1, 'Apply Flame Touched'), +( 45271, 45347, 1, 'Apply Dark Touched'), +( 45246, 45348, 1, 'Apply Flame Touched'), +( 44869,-45018, 1, 'Remove Arcane Buffet'), +( 46019,-45018, 1, 'Remove Arcane Buffet'), +( 46242, 46247, 0, 'Black Hole Visual (Birth)'), +( 46228, 46235, 0, 'Black Hole Visual (Grown)'), +( 46228,-46247, 0, 'Black Hole Visual (Grown)'), +( 46262, 46265, 0, 'Void Zone Visual'), +-- naxx +(-28169, 28206, 0, 'Mutating Injection - Mutagen Explosion'), +( 28732,-28798, 1, 'Widow''s Embrace - Frenzy'), +( 54097,-54100, 1, 'Widow''s Embrace - Frenzy (H)'), +(-28169, 28240, 0, 'Mutating Injection - Poison Cloud'), +-- Archavon +( 58666, 58672, 1, 'Impale (Archavon)'), +( 60882, 58672, 1, 'Impale (Archavon)'), +-- Violet Hold +(-54361, 54343, 0, 'Void Shift (Normal) - Void Shifted'), +(-59743, 54343, 0, 'Void Shift (Heroic) - Void Shifted'), +-- Gundrak +( 54850, 54851, 1, 'Emerge - Emerge Summon'), +-- Trial of the Champion +( 66680, 66547, 0, 'Confess - Confess'), +( 66889,-66865, 0, 'Remove Vengeance'), +-- Warsong Gulch +( 54861,-23335, 0, 'Drop Flag on Nitro Boost WSG'), +( 54861,-23333, 0, 'Drop Flag on Nitro Boost WSG'), +( 55004,-23335, 0, 'Drop Flag on Nitro Boost WSG'), +( 55004,-23333, 0, 'Drop Flag on Nitro Boost WSG'), +-- Eye of Storm +( 54861,-34976, 0, 'Drop Flag on Nitro Boost EOS'), +( 55004,-34976, 0, 'Drop Flag on Nitro Boost EOS'), +-- Strand of the Ancients +( 52415, 52418, 0, 'Carrying Seaforium - Add'), +( 52410,-52418, 0, 'Carrying Seaforium - Remove'), +-- Item +( 69381, 72588, 1, 'Drums of the Wild'), +( 69378, 72586, 1, 'Drums of the Forgotten Kings'), +( 69377, 72590, 1, 'Runescroll of Fortitude'); +/*!40000 ALTER TABLE `spell_linked_spell` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_loot_template` +-- + +DROP TABLE IF EXISTS `spell_loot_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_loot_template` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `item` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ChanceOrQuestChance` float NOT NULL DEFAULT '100', + `lootmode` smallint(5) unsigned NOT NULL DEFAULT '1', + `groupid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `mincountOrRef` mediumint(9) NOT NULL DEFAULT '1', + `maxcount` tinyint(3) unsigned NOT NULL DEFAULT '1', + `lootcondition` tinyint(3) unsigned NOT NULL DEFAULT '0', + `condition_value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `condition_value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`,`item`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Loot System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_loot_template` +-- + +LOCK TABLES `spell_loot_template` WRITE; +/*!40000 ALTER TABLE `spell_loot_template` DISABLE KEYS */; +/*!40000 ALTER TABLE `spell_loot_template` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_pet_auras` +-- + +DROP TABLE IF EXISTS `spell_pet_auras`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_pet_auras` ( + `spell` mediumint(8) unsigned NOT NULL COMMENT 'dummy spell id', + `effectId` tinyint(3) unsigned NOT NULL DEFAULT '0', + `pet` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'pet id; 0 = all', + `aura` mediumint(8) unsigned NOT NULL COMMENT 'pet aura id', + PRIMARY KEY (`spell`,`effectId`,`pet`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_pet_auras` +-- + +LOCK TABLES `spell_pet_auras` WRITE; +/*!40000 ALTER TABLE `spell_pet_auras` DISABLE KEYS */; +INSERT INTO `spell_pet_auras` VALUES (19028,0,0,25228),(19578,0,0,19579),(20895,0,0,24529),(28757,0,0,28758),(35029,0,0,35060),(35030,0,0,35061),(35691,0,0,35696),(35692,0,0,35696),(35693,0,0,35696),(56314,0,0,57447),(56314,1,0,57485),(56315,0,0,57452),(56315,1,0,57484),(56316,0,0,57453),(56316,1,0,57483),(56317,0,0,57457),(56317,1,0,57482),(56318,0,0,57458),(56318,1,0,57475),(23785,0,416,23759),(23822,0,416,23826),(23823,0,416,23827),(23824,0,416,23828),(23825,0,416,23829),(23785,0,417,23762),(23822,0,417,23837),(23823,0,417,23838),(23824,0,417,23839),(23825,0,417,23840),(23785,0,1860,23760),(23822,0,1860,23841),(23823,0,1860,23842),(23824,0,1860,23843),(23825,0,1860,23844),(23785,0,1863,23761),(23822,0,1863,23833),(23823,0,1863,23834),(23824,0,1863,23835),(23825,0,1863,23836),(23785,0,17252,35702),(23822,0,17252,35703),(23823,0,17252,35704),(23824,0,17252,35705),(23825,0,17252,35706); +/*!40000 ALTER TABLE `spell_pet_auras` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_proc_event` +-- + +DROP TABLE IF EXISTS `spell_proc_event`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_proc_event` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `SchoolMask` tinyint(4) NOT NULL DEFAULT '0', + `SpellFamilyName` smallint(5) unsigned NOT NULL DEFAULT '0', + `SpellFamilyMask0` int(10) unsigned NOT NULL DEFAULT '0', + `SpellFamilyMask1` int(10) unsigned NOT NULL DEFAULT '0', + `SpellFamilyMask2` int(10) unsigned NOT NULL DEFAULT '0', + `procFlags` int(10) unsigned NOT NULL DEFAULT '0', + `procEx` int(10) unsigned NOT NULL DEFAULT '0', + `ppmRate` float NOT NULL DEFAULT '0', + `CustomChance` float NOT NULL DEFAULT '0', + `Cooldown` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_proc_event` +-- + +LOCK TABLES `spell_proc_event` WRITE; +/*!40000 ALTER TABLE `spell_proc_event` DISABLE KEYS */; +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +( 324, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 1) +( 325, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 2) +( 905, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 3) +( 945, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 4) +( 974, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000222A8, 0x00000000, 0, 0, 3), -- Earth Shield (Rank 1) +( 1463, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 1) +( 3232, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Gouge Stun Test +( 5952, 0x00, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Throwing Specialization (Rank 1) +( 6346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0, 0, 0), -- Fear Ward +( 7383, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0, 0, 0), -- Water Bubble +( 7434, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Fate Rune of Unsurpassed Vigor +( 8134, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 5) +( 8178, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Grounding Totem Effect (Rank 1) +( 8494, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 2) +( 8495, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 3) +( 9452, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Vindication (Rank 1) +( 9782, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Mithril Shield Spike +( 9784, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Iron Shield Spike +( 9799, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Eye for an Eye (Rank 1) +( 10191, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 4) +( 10192, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 5) +( 10193, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 6) +( 10431, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 6) +( 10432, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 7) +( 11095, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Scorch (Rank 1) +( 11119, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ignite (Rank 1) +( 11120, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ignite (Rank 2) +( 11129, 0x04, 3, 0x08c00017, 0x00031048, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Combustion +( 11180, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Winter's Chill (Rank 1) +( 11185, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0, 0, 0), -- Improved Blizzard (Rank 1) +( 11255, 0x00, 3, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Counterspell (Rank 1) +( 12169, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Shield Block +( 12281, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Sword Specialization (Rank 1) +( 12289, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Hamstring (Rank 1) +( 12298, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Shield Specialization (Rank 1) +( 12311, 0x00, 4, 0x00000800, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Gag Order (Rank 1) +( 12319, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 1) +( 12322, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 0), -- Unbridled Wrath (Rank 1) +( 12487, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0, 0, 0), -- Improved Blizzard (Rank 2) +( 12488, 0x00, 3, 0x00000080, 0x00000000, 0x00000000, 0x00050000, 0x00000000, 0, 0, 0), -- Improved Blizzard (Rank 3) +( 12598, 0x00, 3, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Counterspell (Rank 2) +( 12668, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Hamstring (Rank 2) +( 12724, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Shield Specialization (Rank 2) +( 12725, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Shield Specialization (Rank 3) +( 12726, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Shield Specialization (Rank 4) +( 12727, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Shield Specialization (Rank 5) +( 12797, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Revenge (Rank 1) +( 12799, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Revenge (Rank 2) +( 12812, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Sword Specialization (Rank 2) +( 12813, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Sword Specialization (Rank 3) +( 12814, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Sword Specialization (Rank 4) +( 12815, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Sword Specialization (Rank 5) +( 12834, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Deep Wounds (Rank 1) +( 12846, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ignite (Rank 3) +( 12847, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ignite (Rank 4) +( 12848, 0x04, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ignite (Rank 5) +( 12849, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Deep Wounds (Rank 2) +( 12867, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Deep Wounds (Rank 3) +( 12872, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Scorch (Rank 2) +( 12873, 0x00, 3, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Scorch (Rank 3) +( 12958, 0x00, 4, 0x00000800, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Gag Order (Rank 2) +( 12966, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 1) +( 12967, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 2) +( 12968, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 3) +( 12969, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 4) +( 12970, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 5) +( 12971, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 2) +( 12972, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 3) +( 12973, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 4) +( 12974, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 5) +( 12999, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4, 0, 0), -- Unbridled Wrath (Rank 2) +( 13000, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6, 0, 0), -- Unbridled Wrath (Rank 3) +( 13001, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 8, 0, 0), -- Unbridled Wrath (Rank 4) +( 13002, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 10, 0, 0), -- Unbridled Wrath (Rank 5) +( 13163, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0, 0, 0), -- Aspect of the Monkey +( 13754, 0x00, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Kick (Rank 1) +( 13867, 0x00, 8, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Kick (Rank 2) +( 13983, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0, 0, 0), -- Setup (Rank 1) +( 14070, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0, 0, 0), -- Setup (Rank 2) +( 14071, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000018, 0, 0, 0), -- Setup (Rank 3) +( 14156, 0x00, 8, 0x003E0000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Ruthlessness (Rank 1) +( 14160, 0x00, 8, 0x003E0000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Ruthlessness (Rank 2) +( 14161, 0x00, 8, 0x003E0000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Ruthlessness (Rank 3) +( 14186, 0x00, 8, 0x40800508, 0x00000006, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Seal Fate (Rank 1) +( 14190, 0x00, 8, 0x40800508, 0x00000006, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Seal Fate (Rank 2) +( 14193, 0x00, 8, 0x40800508, 0x00000006, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Seal Fate (Rank 3) +( 14194, 0x00, 8, 0x40800508, 0x00000006, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Seal Fate (Rank 4) +( 14195, 0x00, 8, 0x40800508, 0x00000006, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Seal Fate (Rank 5) +( 14531, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Martyrdom (Rank 1) +( 14774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Martyrdom (Rank 2) +( 14892, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Inspiration (Rank 1) +( 15088, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry +( 15128, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Mark of Flames +( 15277, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6, 0, 0), -- Seal of Reckoning +( 15286, 0x20, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vampiric Embrace +( 15337, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Improved Spirit Tap (Rank 1) +( 15338, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Improved Spirit Tap (Rank 2) +( 15346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6, 0, 0), -- Seal of Reckoning +( 15362, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Inspiration (Rank 2) +( 15363, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Inspiration (Rank 3) +( 15600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1, 0, 0), -- Hand of Justice +( 16086, 0x04, 11, 0x00000000, 0x00040000, 0x00000000, 0x00030000, 0x00000000, 0, 0, 0), -- Improved Fire Nova Totem (Rank 1) +( 16544, 0x04, 11, 0x00000000, 0x00040000, 0x00000000, 0x00030000, 0x00000000, 0, 0, 0), -- Improved Fire Nova Totem (Rank 2) +( 16176, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 1) +( 16180, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 100, 0), -- Improved Water Shield (Rank 1) +( 16196, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 100, 0), -- Improved Water Shield (Rank 2) +( 16198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 100, 0), -- Improved Water Shield (Rank 3) +( 16235, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 2) +( 16240, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 3) +( 16256, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 1) +( 16257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 1) +( 16277, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 2) +( 16278, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 3) +( 16279, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 4) +( 16280, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 5) +( 16281, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 2) +( 16282, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 3) +( 16283, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 4) +( 16284, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 5) +( 16487, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blood Craze (Rank 1) +( 16489, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blood Craze (Rank 2) +( 16492, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blood Craze (Rank 3) +( 16550, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Bonespike (Rank 1) +( 16620, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Proc Self Invulnerability +( 16624, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Thorium Shield Spike +( 16850, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Celestial Focus (Rank 1) +( 16864, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 0), -- Omen of Clarity +( 16880, 0x48, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Nature's Grace +( 16923, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Celestial Focus (Rank 2) +( 16924, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Celestial Focus (Rank 3) +( 16952, 0x00, 7, 0x00039000, 0x00000400, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blood Frenzy (Rank 1) +( 16954, 0x00, 7, 0x00039000, 0x00000400, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blood Frenzy (Rank 2) +( 16958, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Primal Fury (Rank 1) +( 16961, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Primal Fury (Rank 2) +( 17106, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Intensity (Rank 1) +( 17107, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Intensity (Rank 2) +( 17108, 0x00, 7, 0x00080000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Intensity (Rank 3) +( 17364, 0x08, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Stormstrike +( 17495, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Crest of Retribution +( 17619, 0x00, 13, 0x00000000, 0x00000000, 0x00000000, 0x00008000, 0x00000000, 0, 0, 0), -- Alchemist's Stone +( 17793, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Shadow Bolt (Rank 1) +( 17796, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Shadow Bolt (Rank 2) +( 17801, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Shadow Bolt (Rank 3) +( 17802, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Shadow Bolt (Rank 4) +( 17803, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Shadow Bolt (Rank 5) +( 18094, 0x00, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Nightfall (Rank 1) +( 18095, 0x00, 5, 0x0000000A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Nightfall (Rank 2) +( 18820, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Insight +( 19184, 0x00, 9, 0x00000010, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Entrapment (Rank 1) +( 19387, 0x00, 9, 0x00000010, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Entrapment (Rank 2) +( 19388, 0x00, 9, 0x00000010, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Entrapment (Rank 3) +( 19572, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Mend Pet (Rank 1) +( 19573, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Mend Pet (Rank 2) +( 20049, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Vengeance (Rank 1) +( 20056, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Vengeance (Rank 2) +( 20057, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Vengeance (Rank 3) +( 20128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Redoubt +( 20131, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Redoubt +( 20132, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Redoubt +( 20164, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5, 0, 0), -- Seal of Justice +( 20165, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 20, 0, 0), -- Seal of Light +( 20166, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 12, 0, 0), -- Seal of Wisdom +( 20177, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Reckoning (Rank 1) +( 20179, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Reckoning (Rank 2) +( 20180, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Reckoning (Rank 4) +( 20181, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Reckoning (Rank 3) +( 20182, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Reckoning (Rank 5) +( 20185, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 15, 0, 0), -- Judgement of Light +( 20186, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 15, 0, 0), -- Judgement of Wisdom +( 20210, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 1) +( 20212, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 2) +( 20213, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 3) +( 20214, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 4) +( 20215, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 5) +( 20234, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Lay on Hands (Rank 1) +( 20235, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Lay on Hands (Rank 2) +( 20375, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 1), -- Seal of Command +( 20500, 0x00, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Berserker Rage (Rank 1) +( 20501, 0x00, 4, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Berserker Rage (Rank 2) +( 20705, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Power Shield 500 +( 20911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Blessing of Sanctuary +( 20925, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield (Rank 1) +( 20927, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield (Rank 2) +( 20928, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield (Rank 3) +( 21084, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Seal of Righteousness +( 21185, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Spinal Reaper +( 21882, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Judgement Smite +( 21890, 0x00, 4, 0x2A764EEF, 0x0000036C, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Warrior's Wrath +( 22007, 0x00, 3, 0x00200021, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Netherwind Focus +( 22618, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Force Reactive Disk +( 22648, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Call of Eskhandar +( 23547, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 0), -- Parry +( 23548, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Parry +( 23551, 0x00, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Lightning Shield +( 23552, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield +( 23572, 0x00, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Mana Surge +( 23578, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 0), -- Expose Weakness +( 23581, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 0), -- Bloodfang +( 23686, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 0), -- Lightning Strike +( 23688, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Aura of the Blue Dragon +( 23689, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4, 0, 0), -- Heroism +( 23695, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Hamstring (Rank 3) +( 23721, 0x00, 9, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Arcane Infused +( 23920, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Spell Reflection +( 24353, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Primal Instinct +( 24389, 0x00, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Chaos Fire +( 24398, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 7) +( 24658, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00014110, 0x00000000, 0, 0, 0), -- Unstable Power +( 24905, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 15, 0, 0), -- Moonkin Form (Passive) (Passive) +( 24932, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 6), -- Leader of the Pack +( 25050, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Mark of Flames +( 25469, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 8) +( 25472, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 9) +( 25669, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1, 0, 0), -- Decapitate +( 25899, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Greater Blessing of Sanctuary +( 25988, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Eye for an Eye (Rank 2) +( 26016, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 0), -- Vindication (Rank 2) +( 26107, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000064, 0, 0, 0), -- Symbols of Unending Life Finisher Bonus +( 26119, 0x00, 10, 0x90100003, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Stormcaller Spelldamage Bonus +( 26128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0, 0, 0), -- Enigma Resist Bonus +( 26135, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Battlegear of Eternal Justice +( 26480, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Badge of the Swarmguard +( 26605, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Bloodcrown +( 27131, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 7) +( 27179, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield (Rank 4) +( 27419, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Warrior's Resolve +( 27498, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Crusader's Wrath +( 27521, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 15), -- Mana Restore +( 27656, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Flame Lash +( 27774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- The Furious Storm +( 27787, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Rogue Armor Energize +( 27811, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blessed Recovery (Rank 1) +( 27815, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blessed Recovery (Rank 2) +( 27816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blessed Recovery (Rank 3) +( 28592, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Winter's Chill (Rank 2) +( 28593, 0x10, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Winter's Chill (Rank 3) +( 28716, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0, 0, 0), -- Rejuvenation +( 28719, 0x00, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Healing Touch +( 28744, 0x00, 7, 0x00000040, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0, 0, 0), -- Regrowth +( 28752, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Adrenaline Rush +( 28789, 0x00, 10, 0xC0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Holy Power +( 28802, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Epiphany +( 28809, 0x00, 6, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Greater Heal +( 28812, 0x00, 8, 0x02000006, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Head Rush +( 28816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Invigorate +( 28823, 0x00, 11, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Totemic Power +( 28847, 0x00, 7, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Healing Touch Refund +( 28849, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Lesser Healing Wave +( 29074, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Master of Elements (Rank 1) +( 29075, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Master of Elements (Rank 2) +( 29076, 0x14, 3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Master of Elements (Rank 3) +( 29150, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Electric Discharge +( 29179, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Elemental Devastation (Rank 2) +( 29180, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Elemental Devastation (Rank 3) +( 29385, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7, 0, 0), -- Seal of Command +( 29441, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0, 0, 1), -- Magic Absorption (Rank 1) +( 29444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0, 0, 1), -- Magic Absorption (Rank 2) +( 29455, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Felsteel Shield Spike +( 29501, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Frost Arrow +( 29593, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Improved Defensive Stance (Rank 1) +( 29594, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Improved Defensive Stance (Rank 2) +( 29624, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Searing Arrow +( 29625, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Flaming Cannonball +( 29626, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Shadow Bolt +( 29632, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Shadow Shot +( 29633, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Fire Blast +( 29634, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Quill Shot +( 29635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Flaming Shell +( 29636, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Venom Shot +( 29637, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Keeper's Sting +( 29834, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Second Wind (Rank 1) +( 29838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Second Wind (Rank 2) +( 29977, 0x00, 3, 0x00C00017, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Combustion +( 30003, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Sheen of Zanza +( 30160, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Elemental Devastation (Rank 1) +( 30293, 0x00, 5, 0x00000381, 0x000200C0, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Soul Leech (Rank 1) +( 30295, 0x00, 5, 0x00000381, 0x000200C0, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Soul Leech (Rank 2) +( 30296, 0x00, 5, 0x00000381, 0x000200C0, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Soul Leech (Rank 3) +( 30299, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Nether Protection (Rank 1) +( 30301, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Nether Protection (Rank 2) +( 30302, 0x7E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Nether Protection (Rank 3) +( 30675, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Lightning Overload (Rank 1) +( 30678, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Lightning Overload (Rank 2) +( 30679, 0x00, 11, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Lightning Overload (Rank 3) +( 30701, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Elemental Absorption (Rank 1) +( 30705, 0x1C, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Elemental Absorption (Rank 5) +( 30823, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 10., 0, 0), -- Shamanistic Rage +( 30881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Nature's Guardian (Rank 1) +( 30883, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Nature's Guardian (Rank 2) +( 30884, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Nature's Guardian (Rank 3) +( 30885, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Nature's Guardian (Rank 4) +( 30886, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Nature's Guardian (Rank 5) +( 30937, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Mark of Shadow +( 31124, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blade Twisting (Rank 1) +( 31126, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blade Twisting (Rank 2) +( 31244, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000004, 0, 0, 0), -- Quick Recovery (Rank 1) +( 31245, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000004, 0, 0, 0), -- Quick Recovery (Rank 2) +( 31394, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Mark of Shadow +( 31569, 0x00, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Blink (Rank 1) +( 31570, 0x00, 3, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Blink (Rank 2) +( 31571, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Arcane Potency (Rank 1) +( 31572, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Arcane Potency (Rank 2) +( 31656, 0x04, 3, 0x8000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Empowered Fire (Rank 1) +( 31657, 0x04, 3, 0x8000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Empowered Fire (Rank 2) +( 31658, 0x04, 3, 0x8000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Empowered Fire (Rank 3) +( 31794, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Focused Mind +( 31801, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Seal of Vengeance +( 31833, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Light's Grace (Rank 1) +( 31835, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Light's Grace (Rank 2) +( 31836, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Light's Grace (Rank 3) +( 31871, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Divine Purpose (Rank 1) +( 31872, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Divine Purpose (Rank 2) +( 53530, 1, 10, 0x00000000, 0x00000000, 0x0004, 0x0400, 0x0001, 0, 100, 0), -- Divine Guardian +( 31876, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Wise (Rank 1) +( 31877, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Wise (Rank 2) +( 31878, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Wise (Rank 3) +( 31904, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield +( 32385, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shadow Embrace (Rank 1) +( 32387, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shadow Embrace (Rank 2) +( 32392, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shadow Embrace (Rank 3) +( 32393, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shadow Embrace (Rank 4) +( 32394, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shadow Embrace (Rank 5) +( 32409, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shadow Word: Death +( 32587, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Shield Block +( 32593, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000222A8, 0x00000000, 0, 0, 3), -- Earth Shield (Rank 2) +( 32594, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000222A8, 0x00000000, 0, 0, 3), -- Earth Shield (Rank 3) +( 32642, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Spore Cloud +( 32734, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Earth Shield +( 32748, 0x00, 8, 0x00000000, 0x00000001, 0x00000000, 0x00000140, 0x00000000, 0, 0, 0), -- Deadly Throw Interrupt (Rank 5) +( 32776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Redoubt +( 32777, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield +( 32837, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 45), -- Spell Focus Trigger +( 32844, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 0), -- Lesser Heroism +( 32885, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Infuriate +( 33076, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 1) +( 33089, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Vigilance of the Colossus +( 33127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7, 0, 0), -- Seal of Command +( 33142, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blessed Resilience (Rank 1) +( 33145, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blessed Resilience (Rank 2) +( 33146, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Blessed Resilience (Rank 3) +( 33150, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Surge of Light (Rank 1) +( 33151, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Surge of Light (Rank 1) +( 33154, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Surge of Light (Rank 2) +( 33191, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Misery (Rank 1) +( 33192, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Misery (Rank 2) +( 33193, 0x00, 6, 0x00808000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Misery (Rank 3) +( 33297, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Spell Haste Trinket +( 33299, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Coilfang Slave Pens Lvl 70 Boss3a Caster Trinket +( 33510, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5, 0, 0), -- Health Restore +( 33648, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Reflection of Torment +( 33719, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Perfect Spell Reflection +( 33736, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 8) +( 33746, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Essence Infused Mushroom +( 33757, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 100, 3), -- Windfury Weapon (Passive) (Rank 1) +( 33759, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Power Infused Mushroom +( 33881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Natural Perfection (Rank 1) +( 33882, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Natural Perfection (Rank 2) +( 33883, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Natural Perfection (Rank 3) +( 33953, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0, 0, 45), -- Essence of Life +( 34074, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0, 0, 0), -- Aspect of the Viper +( 34080, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0, 0, 0), -- Riposte Stance +( 34138, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Totem of the Third Wind +( 34139, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Libram of Justice +( 34258, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Justice +( 34262, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Mercy +( 34320, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Call of the Nexus +( 34355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Poison Shield +( 34497, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Thrill of the Hunt (Rank 1) +( 34498, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Thrill of the Hunt (Rank 2) +( 34499, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Thrill of the Hunt (Rank 3) +( 34500, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Expose Weakness (Rank 1) +( 34502, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Expose Weakness (Rank 2) +( 34503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Expose Weakness (Rank 3) +( 34584, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Love Struck +( 34586, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.5, 0, 0), -- Romulo's Poison +( 34598, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Karazhan Caster Robe +( 34749, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0, 0, 0), -- Recurring Power +( 34753, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Holy Concentration (Rank 1) +( 34774, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.5, 0, 20), -- Magtheridon Melee Trinket +( 34783, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Spell Reflection +( 34827, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield +( 34859, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Holy Concentration (Rank 2) +( 34860, 0x00, 6, 0x00001800, 0x00000004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Holy Concentration (Rank 3) +( 34914, 0x00, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vampiric Touch (Rank 1) +( 34916, 0x00, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vampiric Touch (Rank 2) +( 34917, 0x00, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vampiric Touch (Rank 3) +( 34935, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 8), -- Backlash (Rank 1) +( 34938, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 8), -- Backlash (Rank 2) +( 34939, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 8), -- Backlash (Rank 3) +( 34950, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Go for the Throat (Rank 1) +( 34954, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Go for the Throat (Rank 2) +( 35077, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Band of the Eternal Defender +( 35080, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1, 0, 60), -- Band of the Eternal Champion +( 35083, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Band of the Eternal Sage +( 35086, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Band of the Eternal Restorer +( 35121, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Nether Power +( 35541, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency (Rank 1) +( 35550, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency (Rank 2) +( 35551, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency (Rank 3) +( 35552, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency (Rank 4) +( 35553, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency (Rank 5) +( 36032, 0x00, 3, 0x00001000, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Arcane Blast +( 36096, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Spell Reflection +( 36111, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- World Breaker +( 36541, 0x04, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Curse of Burning Shadows +( 37165, 0x00, 8, 0x00200400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Haste +( 37168, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Finisher Combo +( 37170, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1, 0, 0), -- Free Finisher Chance +( 37173, 0x00, 8, 0x2CBC0598, 0x00000106, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Armor Penetration +( 37189, 0x00, 10, 0xC0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 60), -- Recuced Holy Light Cast Time +( 37193, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Infused Shield +( 37195, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgement Group Heal +( 37197, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 45), -- Spell Damage +( 37213, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Mana Cost Reduction +( 37214, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Energized +( 37227, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 60), -- Improved Healing Wave +( 37237, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Lightning Bolt Discount +( 37247, 0x08, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 45), -- Regain Mana +( 37377, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Shadowflame +( 37379, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Flameshadow +( 37384, 0x00, 5, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Corruption and Immolate +( 37443, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Crit Bonus Damage +( 37514, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 0), -- Blade Turning +( 37516, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Revenge Bonus +( 37519, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0, 0, 0), -- Rage Bonus +( 37523, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Reinforced Shield +( 37528, 0x00, 4, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Overpower Bonus +( 37536, 0x00, 4, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Battle Shout +( 37568, 0x00, 6, 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Greater Heal Discount +( 37594, 0x00, 6, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Greater Heal Refund +( 37600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Offensive Discount +( 37601, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Relentlessness +( 37603, 0x00, 6, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shadow Word Pain Damage +( 37655, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Bonus Mana Regen +( 37657, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 3), -- Lightning Capacitor +( 38026, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0, 0, 0), -- Viscous Shield +( 38031, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Shield Block +( 38290, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1.6, 0, 0), -- Santos' Blessing +( 38299, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- HoTs on Heals +( 38326, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Crit Threat Reduction Melee +( 38327, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Crit Threat Reduction Spell +( 38334, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Proc Mana Regen +( 38347, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Crit Proc Spell Damage +( 38350, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Crit Proc Heal +( 38394, 0x00, 5, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Dot Heals +( 38857, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Spell Ground +( 39027, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Poison Shield +( 39372, 0x30, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Frozen Shadoweave +( 39437, 0x04, 5, 0x00001364, 0x000000C0, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Shadowflame Hellfire and RoF +( 39442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0, 0, 0), -- Aura of Wrath +( 39443, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Aura of Wrath +( 39530, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Focus +( 39958, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.7, 0, 40), -- Skyfire Swiftness +( 40407, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6, 0, 0), -- Illidan Tank Shield +( 40438, 0x00, 6, 0x00008040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Priest Tier 6 Trinket +( 40442, 0x00, 7, 0x00000014, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Druid Tier 6 Trinket +( 40444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Black Temple Tank Trinket +( 40458, 0x00, 4, 0x02000000, 0x00000601, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Warrior Tier 6 Trinket +( 40463, 0x00, 11, 0x00000081, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shaman Tier 6 Trinket +( 40470, 0x00, 10, 0xC0800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Paladin Tier 6 Trinket +( 40475, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 3, 0, 0), -- Black Temple Melee Trinket +( 40478, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Warlock Tier 6 Trinket +( 40482, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Mage Tier 6 Trinket +( 40485, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Hunter Tier 6 Trinket +( 40899, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Felfire Proc +( 41034, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Spell Absorption +( 41260, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Aviana's Purpose +( 41262, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Aviana's Will +( 41381, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0, 0, 0), -- Shell of Life +( 41393, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 0), -- Riposte +( 41434, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2, 0, 45), -- The Twin Blades of Azzinoth +( 41469, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7, 0, 0), -- Seal of Command +( 41635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 1) +( 41989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.5, 0, 0), -- Fists of Fury +( 42083, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Fury of the Crashing Waves +( 42135, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 90), -- Lesser Rune of Warding +( 42136, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 90), -- Greater Rune of Warding +( 42368, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Merciless Libram of Justice +( 42370, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Merciless Totem of the Third WInd +( 42770, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Second Wind (Rank 2) +( 43019, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 8) +( 43020, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0, 0, 0), -- Mana Shield (Rank 9) +( 43338, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Shamanistic Focus +( 43443, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Spell Reflection +( 43726, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vengeful Libram of Justice +( 43728, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vengeful Totem of Third WInd +( 43737, 0x00, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Primal Instinct +( 43739, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Lunar Grace +( 43741, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Light's Grace +( 43745, 0x00, 10, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Crusader's Command +( 43748, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Elemental Strength +( 43750, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Energized +( 43819, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Lucidity +( 44404, 0x00, 3, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Missile Barrage (Rank 1) +( 44442, 0x00, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0, 0, 1), -- Firestarter (Rank 1) +( 44443, 0x00, 3, 0x00800000, 0x00000040, 0x00000000, 0x00000000, 0x00010000, 0, 0, 1), -- Firestarter (Rank 2) +( 44445, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Hot Streak (Rank 1) +( 44446, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Hot Streak (Rank 2) +( 44448, 0x00, 3, 0x00000013, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Hot Streak (Rank 3) +( 44449, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Burnout (Rank 1) +( 44469, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Burnout (Rank 2) +( 44470, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Burnout (Rank 3) +( 44471, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Burnout (Rank 4) +( 44472, 0x00, 3, 0x20E21277, 0x00019048, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Burnout (Rank 5) +( 44543, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00010000, 0x00000000, 0, 7, 0), -- Fingers of Frost (Rank 1) +( 44545, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00010000, 0x00000000, 0, 15, 0), -- Fingers of Frost (Rank 2) +( 44546, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Brain Freeze (Rank 1) +( 44548, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Brain Freeze (Rank 2) +( 44549, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Brain Freeze (Rank 3) +( 44557, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 1) +( 44560, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 2) +( 44561, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 3) +( 44835, 0x00, 7, 0x00000000, 0x00000080, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Maim Interrupt +( 45054, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Augment Pain +( 45057, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Evasive Maneuvers +( 45234, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Focused Will (Rank 1) +( 45243, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Focused Will (Rank 2) +( 45244, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Focused Will (Rank 3) +( 45354, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Item - Sunwell Dungeon Melee Trinket +( 45469, 0x00, 15, 0x00000010, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Death Strike +( 45481, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Sunwell Exalted Caster Neck +( 45482, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Sunwell Exalted Melee Neck +( 45483, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Sunwell Exalted Tank Neck +( 45484, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 45), -- Sunwell Exalted Healer Neck +( 46025, 0x20, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blackout (Rank 5) +( 46092, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Brutal Libram of Justice +( 46098, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Brutal Totem of Third WInd +( 46569, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Sunwell Exalted Caster Neck +( 46662, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 20), -- Deathfrost +( 46832, 0x00, 7, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Moonkin Starfire Bonus +( 46854, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Trauma (Rank 1) +( 46855, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Trauma (Rank 2) +( 46867, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Wrecking Crew (Rank 1) +( 46910, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 5.5, 0, 0), -- Furious Attacks (Rank 1) +( 46911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 7.5, 0, 0), -- Furious Attacks (Rank 2) +( 46913, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Bloodsurge (Rank 1) +( 46914, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Bloodsurge (Rank 2) +( 46915, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Bloodsurge (Rank 3) +( 46916, 0x00, 4, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Slam! +( 46951, 0x00, 4, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sword and Board (Rank 1) +( 46952, 0x00, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sword and Board (Rank 2) +( 46953, 0x00, 0, 0x00000400, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sword and Board (Rank 3) +( 47195, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Eradication (Rank 1) +( 47196, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Eradication (Rank 2) +( 47197, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Eradication (Rank 3) +( 47201, 0x00, 5, 0x00004009, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Everlasting Affliction (1) +( 47202, 0x00, 5, 0x00004009, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Everlasting Affliction (2) +( 47203, 0x00, 5, 0x00004009, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Everlasting Affliction (3) +( 47204, 0x00, 5, 0x00004009, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Everlasting Affliction (4) +( 47205, 0x00, 5, 0x00004009, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Everlasting Affliction (5) +( 47245, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0, 0, 0), -- Molten Core (Rank 1) +( 47246, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0, 0, 0), -- Molten Core (Rank 2) +( 47247, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0, 0, 0), -- Molten Core (Rank 3) +( 47258, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Backdraft (Rank 1) +( 47259, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Backdraft (Rank 2) +( 47260, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Backdraft (Rank 3) +( 47263, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 20), -- Torture (Rank 1) +( 47264, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 20), -- Torture (Rank 2) +( 47265, 0x20, 5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 20), -- Torture (Rank 3) +( 47509, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Divine Aegis (Rank 1) +( 47511, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Divine Aegis (Rank 2) +( 47515, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Divine Aegis (Rank 3) +( 47516, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Grace (Rank 1) +( 47517, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Grace (Rank 2) +( 47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Shadowform (Rank 1) +( 47570, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Shadowform (Rank 2) +( 47580, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0, 0, 0), -- Pain and Suffering (Rank 1) +( 47581, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0, 0, 0), -- Pain and Suffering (Rank 2) +( 47582, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0, 0, 0), -- Pain and Suffering (Rank 3) +( 48110, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 2) +( 48111, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 3) +( 48112, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 2) +( 48113, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 3) +( 48159, 0x00, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vampiric Touch (Rank 4) +( 48160, 0x00, 6, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vampiric Touch (Rank 5) +( 48483, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Infected Wounds (Rank 1) +( 48484, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Infected Wounds (Rank 2) +( 48485, 0x00, 7, 0x00008800, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Infected Wounds (Rank 3) +( 48492, 0x00, 7, 0x00080000, 0x00000000, 0x00000800, 0x00000400, 0x00000000, 0, 0, 0), -- King of the Jungle (Rank1) +( 48494, 0x00, 7, 0x00080000, 0x00000000, 0x00000800, 0x00000400, 0x00000000, 0, 0, 0), -- King of the Jungle (Rank2) +( 48495, 0x00, 7, 0x00080000, 0x00000000, 0x00000800, 0x00000400, 0x00000000, 0, 0, 0), -- King of the Jungle (Rank3) +( 48496, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Living Seed (Rank 1) +( 48499, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Living Seed (Rank 2) +( 48500, 0x00, 7, 0x00000060, 0x02000002, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Living Seed (Rank 3) +( 48506, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Earth and Moon (Rank 1) +( 48510, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Earth and Moon (Rank 2) +( 48511, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Earth and Moon (Rank 3) +( 48516, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 30), -- Eclipse (Rank 1) +( 48521, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 30), -- Eclipse (Rank 2) +( 48525, 0x00, 7, 0x00000005, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 30), -- Eclipse (Rank 3) +( 48833, 0x00, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Primal Instinct +( 48835, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Justice +( 48837, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Elemental Tenacity +( 48951, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield (Rank 5) +( 48952, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Holy Shield (Rank 6) +( 48988, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Bloody Vengeance (Rank 1) +( 49018, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sudden Doom (Rank 1) +( 49194, 0x00, 15, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Unholy Blight +( 49027, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 3, 20), -- Bloodworms rank 1 +( 49542, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 6, 20), -- Bloodworms rank 2 +( 49543, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 9, 20), -- Bloodworms rank 3 +( 49208, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Reaping (Rank 1) +( 49222, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Bone Shield +( 49280, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 10) +( 49281, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Lightning Shield (Rank 11) +( 49283, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000222A8, 0x00000000, 0, 0, 3), -- Earth Shield (Rank 4) +( 49284, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000222A8, 0x00000000, 0, 0, 3), -- Earth Shield (Rank 5) +( 49503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Bloody Vengeance (Rank 2) +( 49504, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Bloody Vengeance (Rank 3) +( 49529, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sudden Doom (Rank 2) +( 49530, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sudden Doom (Rank 3) +( 49622, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Bonus Mana Regen +( 50781, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 6), -- Fate Rune of Primal Energy +( 50880, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50884, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50885, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50886, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50887, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 51123, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Killing Machine (Rank 1) +( 51127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Killing Machine (Rank 2) +( 51128, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Killing Machine (Rank 3) +( 51129, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Killing Machine (Rank 4) +( 51130, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Killing Machine (Rank 5) +( 51346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Venture Company Beatdown! +( 51349, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Venture Company Beatdown +( 51352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Venture Company Beatdown! +( 51359, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 10), -- Venture Company Beatdown +( 51414, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Venomous Breath Aura +( 51474, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 1) +( 51478, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 2) +( 51479, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Astral Shift (Rank 3) +( 51483, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0, 0, 0), -- Storm, Earth and Fire +( 51485, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0, 0, 0), -- Storm, Earth and Fire +( 51486, 0x01, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0, 0, 0), -- Storm, Earth and Fire +( 51521, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Stormstrike +( 51522, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Stormstrike +( 51523, 0x00, 11, 0x00000000, 0x00000001, 0x00000000, 0x00010000, 0x00000000, 0, 50, 0), -- Earthen Power (Rank 1) +( 51524, 0x00, 11, 0x00000000, 0x00000001, 0x00000000, 0x00010000, 0x00000000, 0, 50, 0), -- Earthen Power (Rank 2) +( 51528, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2.5, 0, 0), -- Maelstrom Weapon (Rank 1) +( 51529, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5, 0, 0), -- Maelstrom Weapon (Rank 2) +( 51530, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7.5, 0, 0), -- Maelstrom Weapon (Rank 3) +( 51531, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 10, 0, 0), -- Maelstrom Weapon (Rank 4) +( 51532, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 12., 0, 0), -- Maelstrom Weapon (Rank 5) +( 51556, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Awakening (Rank 1) +( 51557, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Awakening (Rank 2) +( 51558, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Awakening (Rank 3) +( 51562, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0, 0, 0), -- Tidal Waves (Rank 1) +( 51563, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0, 0, 0), -- Tidal Waves (Rank 2) +( 51564, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0, 0, 0), -- Tidal Waves (Rank 3) +( 51565, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0, 0, 0), -- Tidal Waves (Rank 4) +( 51566, 0x00, 11, 0x00000100, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0, 0, 0), -- Tidal Waves (Rank 5) +( 51625, 0x00, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Deadly Brew (Rank 1) +( 51626, 0x00, 8, 0x1000A000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Deadly Brew (Rank 2) +( 51627, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Turn the Tables (Rank 1) +( 51628, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Turn the Tables (Rank 2) +( 51629, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0, 0, 0), -- Turn the Tables (Rank 3) +( 51634, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Focused Attacks (Rank 1) +( 51635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Focused Attacks (Rank 2) +( 51636, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Focused Attacks (Rank 3) +( 51664, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Cut to the Chase (Rank 1) +( 51665, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Cut to the Chase (Rank 2) +( 51667, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Cut to the Chase (Rank 3) +( 51668, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Cut to the Chase (Rank 4) +( 51669, 0x00, 8, 0x00020000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Cut to the Chase (Rank 5) +( 51672, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0, 0, 1), -- Unfair Advantage (Rank 1) +( 51674, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0, 0, 1), -- Unfair Advantage (Rank 2) +( 51679, 0x00, 8, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Throwing Specialization (Rank 2) +( 51692, 0x00, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Waylay (Rank 1) +( 51696, 0x00, 8, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Waylay (Rank 2) +( 51698, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Honor Among Thieves (Rank 1) +( 51700, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Honor Among Thieves (Rank 2) +( 51701, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Honor Among Thieves (Rank 3) +( 51915, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0, 100, 600), -- Undying Resolve +( 51940, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 20, 0), -- Earthliving Weapon (Passive) (Rank 1) +( 51989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 20, 0), -- Earthliving Weapon (Passive) (Rank 2) +( 52004, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 20, 0), -- Earthliving Weapon (Passive) (Rank 3) +( 52005, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 20, 0), -- Earthliving Weapon (Passive) (Rank 4) +( 52007, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 20, 0), -- Earthliving Weapon (Passive) (Rank 5) +( 52008, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 20, 0), -- Earthliving Weapon (Passive) (Rank 6) +( 52020, 0x00, 7, 0x00008000, 0x00100000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Snap and Snarl +( 52127, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 1) +( 52129, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 2) +( 52131, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 3) +( 52134, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 4) +( 52136, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 5) +( 52138, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 6) +( 52420, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Deflection +( 52423, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 0), -- Retaliation +( 52795, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Borrowed Time (Rank 1) +( 52797, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Borrowed Time (Rank 2) +( 52798, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Borrowed Time (Rank 3) +( 52799, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Borrowed Time (Rank 4) +( 52800, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Borrowed Time (Rank 5) +( 52898, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Spell Damping +( 53215, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Wild Quiver (Rank 1) +( 53216, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Wild Quiver (Rank 2) +( 53217, 0x00, 9, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Wild Quiver (Rank 3) +( 53221, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Steady Shot (Rank 1) +( 53222, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Steady Shot (Rank 2) +( 53224, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Steady Shot (Rank 3) +( 53228, 0x00, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rapid Recuperation (Rank 1) +( 53232, 0x00, 9, 0x00000020, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rapid Recuperation (Rank 2) +( 53256, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Cobra Strikes (Rank 1) +( 53259, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Cobra Strikes (Rank 2) +( 53260, 0x00, 9, 0x00000800, 0x00800001, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Cobra Strikes (Rank 3) +( 53290, 0x00, 9, 0x00000800, 0x7FFFFFFF, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Hunting Party (Rank 1) +( 53291, 0x00, 9, 0x00000800, 0x7FFFFFFF, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Hunting Party (Rank 2) +( 53292, 0x00, 9, 0x00000800, 0x7FFFFFFF, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Hunting Party (Rank 3) +( 53375, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00000400, 0x00000000, 0, 0, 6), -- Sanctified Wrath (Rank 1) +( 53376, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00000400, 0x00000000, 0, 0, 6), -- Sanctified Wrath (Rank 2) +( 53380, 0x00, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- Righteous Vengeance (Rank 1) +( 53381, 0x00, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- Righteous Vengeance (Rank 2) +( 53382, 0x00, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- Righteous Vengeance (Rank 3) +( 53397, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Invigoration (Rank 1) +( 53486, 0x00, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000004, 0x00040002, 0, 0, 0), -- The Art of War (Rank 1) +( 53488, 0x00, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000004, 0x00040002, 0, 0, 0), -- The Art of War (Rank 2) +( 53501, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Sheath of Light (Rank 1) +( 53502, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Sheath of Light (Rank 2) +( 53503, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Sheath of Light (Rank 3) +( 53551, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sacred Cleansing (Rank 1) +( 53552, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sacred Cleansing (Rank 2) +( 53553, 0x00, 10, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sacred Cleansing (Rank 3) +( 53569, 0x00, 10, 0x40200000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Infusion of Light (Rank 1) +( 53576, 0x00, 10, 0x40200000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Infusion of Light (Rank 2) +( 53646, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Demonic Pact (Rank 1) +( 53671, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 1) +( 53672, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Infusion of Light +( 53673, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 2) +( 53709, 0x02, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shield of the templar +( 53710, 0x02, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shield of the templar +( 53711, 0x02, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shield of the templar +( 54149, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Infusion of Light (Rank 2) +( 54151, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 3) +( 54154, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 4) +( 54155, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 5) +( 54278, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Empowered Imp +( 54486, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Missile Barrage (Rank 2) +( 54488, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Missile Barrage (Rank 3) +( 54489, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Missile Barrage (Rank 4) +( 54490, 0x00, 0, 0x20000021, 0x00009000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Missile Barrage (Rank 5) +( 54695, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Item - Death Knight's Anguish Base +( 54707, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Sonic Awareness (DND) +( 54738, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Star of Light +( 54747, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Burning Determination (Rank 1) +( 54749, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Burning Determination (Rank 2) +( 54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Rejuvenation +( 54808, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Sonic Shield +( 54838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Purified Spirit +( 54841, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 3), -- Thunder Capacitor +( 54936, 0x00, 10, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Flash of Light +( 54937, 0x00, 10, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Holy Light +( 54939, 0x00, 10, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Divinity +( 55198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00004000, 0x00000002, 0, 0, 0), -- Tidal Force +( 55380, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Skyflare Swiftness +( 55381, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 15), -- Mana Restore +( 55440, 0x00, 11, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Healing Wave +( 55610, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00001000, 0x00000000, 0, 0, 0), -- Improved Icy Talons +( 55640, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Lightweave Embroidery +( 55677, 0x00, 6, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Dispel Magic +( 55680, 0x00, 6, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Prayer of Healing +( 55689, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Glyph of Shadow +( 55747, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Argent Fury +( 55768, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Darkglow Embroidery +( 55776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Swordguard Embroidery +( 56218, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Corruption +( 56249, 0x00, 5, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Felhunter +( 56355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0, 0, 0), -- Titanium Shield Spike +( 56364, 0x00, 3, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Remove Curse +( 56372, 0x00, 3, 0x00000000, 0x00000080, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Glyph of Ice Block +( 56374, 0x00, 3, 0x00000000, 0x00004000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Glyph of Icy Veins +( 56451, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Earth Shield +( 56611, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Wrecking Crew (Rank 2) +( 56612, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Wrecking Crew (Rank 3) +( 56613, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Wrecking Crew (Rank 4) +( 56614, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Wrecking Crew (Rank 5) +( 56816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0, 0, 0), -- Rune Strike +( 56821, 0x00, 8, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Glyph of Sinister Strike +( 56834, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Reaping (Rank 2) +( 56835, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Reaping (Rank 3) +( 57345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Darkmoon Card: Greatness +( 57352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00051154, 0x00000000, 0, 0, 45), -- Darkmoon Card: Death +( 57870, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0, 0, 0), -- Glyph of Mend Pet +( 57878, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0, 0, 0), -- Natural Reaction (Rank 1) +( 57880, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0, 0, 0), -- Natural Reaction (Rank 2) +( 57881, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0, 0, 0), -- Natural Reaction (Rank 3) +( 57907, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Increased Spirit +( 57960, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Water Shield (Rank 9) +( 58357, 0x00, 4, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Glyph of Heroic Strike +( 58364, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Revenge +( 58372, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Hamstring +( 58386, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 0), -- Glyph of Overpower +( 58442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Airy Pale Ale +( 58444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 5), -- Worg Tooth Oatmeal Stout +( 58626, 0x00, 15, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Death Grip +( 58642, 0x00, 15, 0x00000000, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Scourge Strike +( 58644, 0x00, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Frost Strike +( 58647, 0x00, 15, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Frost Strike +( 58676, 0x00, 15, 0x00000000, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Vampiric Blood +( 58677, 0x00, 15, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Death's Embrace +( 58872, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Damage Shield (Rank 1) +( 58874, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Damage Shield (Rank 2) +( 58901, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Tears of Anguish +( 59088, 0x00, 4, 0x00000000, 0x00000002, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Improved Spell Reflection (Rank 1) +( 59089, 0x00, 4, 0x00000000, 0x00000002, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Improved Spell Reflection (Rank 2) +( 59176, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Spell Damping +( 59327, 0x00, 15, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Rune Tap +( 59345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Chagrin +( 59630, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Black Magic +( 59725, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Spell Reflection +( 60061, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Flow of Time +( 60063, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Now is the Time! +( 60132, 0x00, 15, 0x00000000, 0x08020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Oblit/Scourge Strike Runic Power Up +( 60170, 0x00, 5, 0x00000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Corruption Triggers Crit +( 60172, 0x00, 5, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Life Tap Bonus Spirit +( 60176, 0x00, 4, 0x00000020, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Bleed Cost Reduction +( 60221, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Essence of Gossamer +( 60301, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Meteorite Whetstone +( 60306, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Vestige of Haldor +( 60317, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Signet of Edward the Odd +( 60436, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Grim Toll +( 60442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Bandit's Insignia +( 60473, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Forge Ember +( 60482, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Pendulum of Telluric Currents +( 60487, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Extract of Necromatic Power +( 60490, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Embrace of the Spider +( 60493, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Dying Curse +( 60519, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Spark of Life +( 60529, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Forethought Talisman +( 60537, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Soul of the Dead +( 60564, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Savage Gladiator's Totem of Survival +( 60571, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Hateful Gladiator's Totem of Survival +( 60572, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Deadly Gladiator's Totem of Survival +( 60573, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- LK Arena 4 Gladiator's Totem of Survival +( 60574, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- LK Arena 5 Gladiator's Totem of Survival +( 60575, 0x00, 11, 0x90100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- LK Arena 6 Gladiator's Totem of Survival +( 60617, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 0), -- Parry +( 60710, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Savage Gladiator's Idol of Steadfastness +( 60717, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 100, 0), -- Hateful Gladiator's Idol of Steadfastness +( 60719, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Deadly Gladiator's Idol of Steadfastness +( 60722, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- LK Arena 4 Gladiator's Idol of Steadfastness +( 60724, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- LK Arena 5 Gladiator's Idol of Steadfastness +( 60726, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- LK Arena 6 Gladiator's Idol of Steadfastness +( 60770, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Totem of the Elemental Plane +( 60818, 0x00, 10, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Libram of Reciprocation +( 60826, 0x00, 15, 0x01400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Sigil of Haunted Dreams +( 61188, 0x00, 5, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Chaotic Mind +( 61324, 0x00, 10, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Justice +( 61345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Nature's Grace +( 61346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Nature's Grace +( 61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 90), -- Invigorating Earthsiege Diamond Passive +( 61618, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Tentacles +( 61848, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0, 0, 0), -- Aspect of the Dragonhawk +( 62147, 0x00, 15, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Touch Defense Increase +( 62459, 0x00, 15, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Chains of Ice Frost Rune Refresh (Rank 3) +( 63108, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Siphon Life +( 63158, 0x00, 5, 0x00000001, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Decimation +( 63156, 0x00, 5, 0x00000001, 0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Decimation +( 64343, 0x00, 3, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Impact +( 64976, 0x00, 4, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Juggernaut +( 64914, 0x00, 8, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Rogue T8 2P Bonus +( 64938, 0x00, 4, 0x00200040, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Item - Warrior T8 Melee 2P Bonus +( 64952, 0x00, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Druid T8 Feral Relic +( 64964, 0x00, 15, 0x00000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Death Knight T8 Tank Relic +( 65002, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Bonus Mana Regen +( 65005, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Alacrity of the Elements +( 64999, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5, 0, 0), -- Meteoric Inspiration +( 65007, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5, 0, 0), -- Eye of the Broodmother +( 65013, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Pyrite Infusion +( 65020, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Mjolnir Runestone +( 65025, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Dark Matter +( 46949, 0x00, 4, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Safeguard +( 46945, 0x00, 4, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Safeguard +( 64415, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Val'anyr Hammer of Ancient Kings - Equip Effect +( 60066, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Rage of the Unraveller +( 62115, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Strength of the Titans +( 62114, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Flow of Knowledge +( 62600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Savage Defense +( 63245, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Pyroclasm +( 18096, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Pyroclasm +( 18073, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Pyroclasm +( 63280, 0x00, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Totem of Wrath +( 63310, 0x00, 5, 0x00000000, 0x00010000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Glyph of Shadowflame +( 63335, 0x00, 15, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Howling Blast +( 63730, 0x00, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Serendipity +( 63733, 0x00, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Serendipity +( 63737, 0x00, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Serendipity +( 64127, 0x00, 6, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Body and Soul +( 64129, 0x00, 6, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Body and Soul +( 64568, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Blood Reserve +( 64571, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Blood Draining +( 64440, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 20), -- Blade Warding +( 64714, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Flame of the Heavens +( 64738, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Show of Faith +( 64742, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Pandora's Plea +( 64752, 0x00, 7, 0x00800000, 0x10000100, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Druid T8 Feral 2P Bonus +( 64786, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Comet's Trail +( 64792, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Blood of the Old God +( 64824, 0x00, 7, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Druid T8 Balance 4P Bonus +( 64928, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Item - Shaman T8 Elemental +( 64860, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Hunter T8 4P Bonus +( 64867, 0x00, 3, 0x20000021, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Mage T8 2P Bonus +( 64882, 0x00, 10, 0x00000000, 0x00100000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Paladin T8 Protection 4P Bonus +( 64890, 0x00, 10, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Item - Paladin T8 Holy 2P Bonus +( 64908, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Priest T8 Shadow 4P Bonus +( 64912, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Priest T8 Healer 4P Bonus +( 57470, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Renewed Hope +( 57472, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Renewed Hope +( 35100, 0x00, 9, 0x00001000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0, 0, 0), -- Concussive Barrage +( 35102, 0x00, 9, 0x00001000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0, 0, 0), -- Concussive Barrage +( 18119, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Aftermath +( 18120, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Aftermath +( 13165, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14318, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14319, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14320, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14321, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14322, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 25296, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 27044, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 61846, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Dragonhawk +( 61847, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Dragonhawk +( 49223, 0x00, 15, 0x00000011, 0x08020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Dirge +( 49599, 0x00, 15, 0x00000011, 0x08020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Dirge +( 49188, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rime +( 56822, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rime +( 59057, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rime +( 55666, 0x00, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Desecration +( 55667, 0x00, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Desecration +( 58616, 0x00, 15, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Heart Strike +( 16164, 0x00, 11, 0x901000C3, 0x00001000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Elemental Focus +( 49149, 0x00, 15, 0x00000006, 0x00020002, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Chill of the Grave +( 50115, 0x00, 15, 0x00000006, 0x00020002, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Chill of the Grave +( 49217, 0x00, 15, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0, 0, 1), -- Wandering Plague +( 49654, 0x00, 15, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0, 0, 1), -- Wandering Plague +( 49655, 0x00, 15, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0, 0, 1), -- Wandering Plague +( 58620, 0x00, 15, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Chains of Ice +( 56342, 0x00, 9, 0x00000018, 0x08000000, 0x00024000, 0x00000000, 0x00000000, 0, 0, 0), -- Lock and Load +( 56343, 0x00, 9, 0x00000018, 0x08000000, 0x00024000, 0x00000000, 0x00000000, 0, 0, 0), -- Lock and Load +( 56344, 0x00, 9, 0x00000018, 0x08000000, 0x00024000, 0x00000000, 0x00000000, 0, 0, 0), -- Lock and Load +( 48539, 0x00, 7, 0x00000010, 0x04000000, 0x00000000, 0x00040000, 0x00000000, 0, 0, 0), -- Revitalize +( 48544, 0x00, 7, 0x00000010, 0x04000000, 0x00000000, 0x00040000, 0x00000000, 0, 0, 0), -- Revitalize +( 48545, 0x00, 7, 0x00000010, 0x04000000, 0x00000000, 0x00040000, 0x00000000, 0, 0, 0), -- Revitalize +( 53234, 0x00, 9, 0x00020000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0, 0, 0), -- Piercing Shots (Rank 1) +( 53237, 0x00, 9, 0x00020000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0, 0, 0), -- Piercing Shots (Rank 2) +( 53238, 0x00, 9, 0x00020000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0, 0, 0), -- Piercing Shots (Rank 3) +( 56636, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 1) +( 56637, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 2) +( 56638, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 3) +( 56375, 0x00, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Glyphs of Polymorph +( 54639, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 54638, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 54637, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 49467, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery +( 50033, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery +( 50034, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery +( 63373, 0x00, 11, 0x80000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Frozen Power (Rank 1) +( 63374, 0x00, 11, 0x80000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Frozen Power (Rank 2) +( 54821, 0x00, 7, 0x00001000, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Glyph of Rake +( 54815, 0x00, 7, 0x00008000, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Glyph of Shred +( 54845, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Glyph of Starfire +( 56800, 0x00, 8, 0x00800004, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Glyph of Backstab +( 54832, 0x00, 7, 0x00000000, 0x00001000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Glyph of Innervate +( 67353, 0x00, 7, 0x00008000, 0x00100500, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- uncommented +( 57989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0, 0, 0), -- uncommented +( 65661, 0x00, 15, 0x00400010, 0x20020004, 0x00000000, 0x00000010, 0x00000000, 0, 100, 0), -- Threat of Thassarian (Rank 1) +( 66191, 0x00, 15, 0x00400010, 0x20020004, 0x00000000, 0x00000010, 0x00000000, 0, 100, 0), -- Threat of Thassarian (Rank 2) +( 66192, 0x00, 15, 0x00400010, 0x20020004, 0x00000000, 0x00000010, 0x00000000, 0, 100, 0), -- Threat of Thassarian (Rank 3) +( 53601, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0, 0, 6), -- Sacred Shield (Rank 1) +( 58375, 0x00, 4, 0x00000000, 0x00000200, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Glyph of Blocking +( 58387, 0x00, 4, 0x00004000, 0x00000040, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Glyph of Sunder Armor +( 54925, 0x02, 10, 0x00000000, 0x00000208, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Seal of Command +( 63320, 0x00, 5, 0x80040000, 0x00000000, 0x00008000, 0x00000400, 0x00000000, 0, 0, 0), -- Glyph of Life Tap +( 67356, 0x08, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Druid T9 Restoration Relic (Rejuvenation) +( 67653, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00400028, 0x00000000, 0, 0, 45), -- Item - Coliseum Tank Trinket 5men +( 67667, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 45), -- Item - Coliseum Healer Trinket 5men +( 67670, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 45), -- Item - Coliseum Caster Trinket 5men +( 67672, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800154, 0x00000000, 0, 0, 45), -- Item - Coliseum Melee Trinket 5men +( 67758, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 2), -- Item - Coliseum 25 Heroic Caster Trinket +( 67771, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00851154, 0x00000003, 0, 35, 45), -- Item - Coliseum Melee Trinket 10men +( 67702, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00851154, 0x00000003, 0, 35, 45), -- Item - Coliseum Melee Trinket 25men +( 70807, 0x00, 11, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0, 100, 0), -- Item - Shaman T10 Restoration 2P Bonus +( 71519, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 105), -- Item - Deathbringer's Will Trinket Normal +( 71562, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 105), -- Item - Deathbringer's Will Trinket Heroic +( 70761, 0x00, 10, 0x00000000, 0x80004000, 0x00000001, 0x00000400, 0x00000000, 0, 0, 0); -- Item - Paladin T10 Protection 4P Bonus +/*!40000 ALTER TABLE `spell_proc_event` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_required` +-- + +DROP TABLE IF EXISTS `spell_required`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_required` ( + `spell_id` mediumint(9) NOT NULL DEFAULT '0', + `req_spell` mediumint(9) NOT NULL DEFAULT '0', + PRIMARY KEY (`spell_id`, `req_spell`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Spell Additinal Data'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_required` +-- + +LOCK TABLES `spell_required` WRITE; +/*!40000 ALTER TABLE `spell_required` DISABLE KEYS */; +/*!40000 ALTER TABLE `spell_required` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_script_target` +-- + +DROP TABLE IF EXISTS `spell_script_target`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_script_target` ( + `entry` mediumint(8) unsigned NOT NULL, + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `targetEntry` mediumint(8) unsigned NOT NULL DEFAULT '0', + UNIQUE KEY `entry_type_target` (`entry`,`type`,`targetEntry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Spell System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_script_target` +-- + +LOCK TABLES `spell_script_target` WRITE; +/*!40000 ALTER TABLE `spell_script_target` DISABLE KEYS */; +/*!40000 ALTER TABLE `spell_script_target` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_scripts` +-- + +DROP TABLE IF EXISTS `spell_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_scripts` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0', + `delay` int(10) unsigned NOT NULL DEFAULT '0', + `command` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong` mediumint(8) unsigned NOT NULL DEFAULT '0', + `datalong2` int(10) unsigned NOT NULL DEFAULT '0', + `dataint` int(11) NOT NULL DEFAULT '0', + `x` float NOT NULL DEFAULT '0', + `y` float NOT NULL DEFAULT '0', + `z` float NOT NULL DEFAULT '0', + `o` float NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_scripts` +-- + +LOCK TABLES `spell_scripts` WRITE; +/*!40000 ALTER TABLE `spell_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `spell_scripts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_group_stack_rules` +-- + +DROP TABLE IF EXISTS `spell_group_stack_rules`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +DROP TABLE IF EXISTS `spell_group_stack_rules`; +CREATE TABLE `spell_group_stack_rules` ( + `group_id` INT(11) UNSIGNED NOT NULL DEFAULT 0, + `stack_rule` TINYINT(3) NOT NULL DEFAULT 0, + PRIMARY KEY (`group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_group_stack_rules` +-- + +LOCK TABLES `spell_group_stack_rules` WRITE; +/*!40000 ALTER TABLE `spell_group_stack_rules` DISABLE KEYS */; +INSERT INTO spell_group_stack_rules (`group_id`, `stack_rule`) VALUES +(1, 1), +(2, 1), +(1001, 1), +(1002, 1), +(1003, 1), +(1004, 1), +(1005, 1), +(1006, 1), +(1007, 1), +(1008, 1), +(1009, 1), +(1010, 2), +(1011, 2), +(1015,1), +(1016,1), +(1019,1), +(1022,1), +(1025,1), +(1029,1), +(1033,1), +(1036,1), +(1043,1), +(1048,1), +(1051,1), +(1054,1), +(1057,1), +(1059,1), +(1064,1), +(1068,1), +(1074,1), +(1079,1), +(1082,1), +(1085,1), +(1088,1), +(1090,1), +(1093,1), +(1096,1), +(1099,1), +(1103,1), +(1046,1), +(1107,1); + +/*!40000 ALTER TABLE `spell_group_stack_rules` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_ranks` +-- + +DROP TABLE IF EXISTS `spell_ranks`; +CREATE TABLE `spell_ranks` ( + `first_spell_id` INT UNSIGNED NOT NULL DEFAULT 0, + `spell_id` INT UNSIGNED NOT NULL DEFAULT 0, + `rank` TINYINT UNSIGNED NOT NULL DEFAULT 0, + PRIMARY KEY (`first_spell_id`, `rank`), + UNIQUE (`spell_id`) +) ENGINE=MYISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Spell Rank Data'; + +-- +-- Dumping data for table `spell_ranks` +-- + +LOCK TABLES `spell_ranks` WRITE; +/*!40000 ALTER TABLE `spell_ranks` DISABLE KEYS */; +INSERT INTO spell_ranks (`first_spell_id`, `spell_id`, `rank`) VALUES + -- Abomination's Might +(53137, 53137, 1), +(53137, 53138, 2), + -- Absolution +(33167, 33167, 1), +(33167, 33171, 2), +(33167, 33172, 3), + -- Acclimation +(49200, 49200, 1), +(49200, 50151, 2), +(49200, 50152, 3), + -- Acid Spit +(55749, 55749, 1), +(55749, 55750, 2), +(55749, 55751, 3), +(55749, 55752, 4), +(55749, 55753, 5), +(55749, 55754, 6), + -- Aftermath +(18119, 18119, 1), +(18119, 18120, 2), + -- Aggression +(18427, 18427, 1), +(18427, 18428, 2), +(18427, 18429, 3), +(18427, 61330, 4), +(18427, 61331, 5), + -- Agility +(8115, 8115, 1), +(8115, 8116, 2), +(8115, 8117, 3), +(8115, 12174, 4), +(8115, 33077, 5), +(8115, 43194, 6), +(8115, 58450, 7), +(8115, 58451, 8), + -- Aimed Shot +(19434, 19434, 1), +(19434, 20900, 2), +(19434, 20901, 3), +(19434, 20902, 4), +(19434, 20903, 5), +(19434, 20904, 6), +(19434, 27065, 7), +(19434, 49049, 8), +(19434, 49050, 9), + -- Alchemy +(2259, 2259, 1), +(2259, 3101, 2), +(2259, 3464, 3), +(2259, 11611, 4), +(2259, 28596, 5), +(2259, 51304, 6), + -- Ambush +(8676, 8676, 1), +(8676, 8724, 2), +(8676, 8725, 3), +(8676, 11267, 4), +(8676, 11268, 5), +(8676, 11269, 6), +(8676, 27441, 7), +(8676, 48689, 8), +(8676, 48690, 9), +(8676, 48691, 10), + -- Amplify Magic +(1267, 1267, 1), +(1267, 8456, 2), +(1267, 10171, 3), +(1267, 10172, 4), +(1267, 27397, 5), +(1267, 33947, 6), + -- Amplify Magic +(1008, 1008, 1), +(1008, 8455, 2), +(1008, 10169, 3), +(1008, 10170, 4), +(1008, 27130, 5), +(1008, 33946, 6), +(1008, 43017, 7), + -- Ancestral Awakening +(51556, 51556, 1), +(51556, 51557, 2), +(51556, 51558, 3), + -- Ancestral Fortitude +(16177, 16177, 1), +(16177, 16236, 2), +(16177, 16237, 3), + -- Ancestral Healing +(16176, 16176, 1), +(16176, 16235, 2), +(16176, 16240, 3), + -- Ancestral Knowledge +(17485, 17485, 1), +(17485, 17486, 2), +(17485, 17487, 3), +(17485, 17488, 4), +(17485, 17489, 5), + -- Ancestral Spirit +(2008, 2008, 1), +(2008, 20609, 2), +(2008, 20610, 3), +(2008, 20776, 4), +(2008, 20777, 5), +(2008, 25590, 6), +(2008, 49277, 7), + -- Anguish +(33704, 33704, 1), +(33704, 33705, 2), +(33704, 33706, 3), + -- Anguish +(33698, 33698, 1), +(33698, 33699, 2), +(33698, 33700, 3), +(33698, 47993, 4), + -- Animal Handler +(34453, 34453, 1), +(34453, 34454, 2), + -- Annihilation +(51468, 51468, 1), +(51468, 51472, 2), +(51468, 51473, 3), + -- Anticipation +(12297, 12297, 1), +(12297, 12750, 2), +(12297, 12751, 3), +(12297, 12752, 4), +(12297, 12753, 5), + -- Anticipation +(20096, 20096, 1), +(20096, 20097, 2), +(20096, 20098, 3), +(20096, 20099, 4), +(20096, 20100, 5), + -- Anticipation +(16254, 16254, 1), +(16254, 16271, 2), +(16254, 16272, 3), + -- Anticipation +(55129, 55129, 1), +(55129, 55130, 2), +(55129, 55131, 3), +(55129, 55132, 4), +(55129, 55133, 5), + -- Arcane Barrage +(44425, 44425, 1), +(44425, 44780, 2), +(44425, 44781, 3), + -- Arcane Blast +(30451, 30451, 1), +(30451, 42894, 2), +(30451, 42896, 3), +(30451, 42897, 4), + -- Arcane Brilliance +(23028, 23028, 1), +(23028, 27127, 2), +(23028, 43002, 3), + -- Arcane Concentration +(11213, 11213, 1), +(11213, 12574, 2), +(11213, 12575, 3), +(11213, 12576, 4), +(11213, 12577, 5), + -- Arcane Empowerment +(31579, 31579, 1), +(31579, 31582, 2), +(31579, 31583, 3), + -- Arcane Explosion +(1449, 1449, 1), +(1449, 8437, 2), +(1449, 8438, 3), +(1449, 8439, 4), +(1449, 10201, 5), +(1449, 10202, 6), +(1449, 27080, 7), +(1449, 27082, 8), +(1449, 42920, 9), +(1449, 42921, 10), + -- Arcane Flows +(44378, 44378, 1), +(44378, 44379, 2), + -- Arcane Focus +(11222, 11222, 1), +(11222, 12839, 2), +(11222, 12840, 3), + -- Arcane Fortitude +(28574, 28574, 1), +(28574, 54658, 2), +(28574, 54659, 3), + -- Arcane Instability +(15058, 15058, 1), +(15058, 15059, 2), +(15058, 15060, 3), + -- Arcane Intellect +(1459, 1459, 1), +(1459, 1460, 2), +(1459, 1461, 3), +(1459, 10156, 4), +(1459, 10157, 5), +(1459, 27126, 6), +(1459, 42995, 7), + -- Arcane Mastery +(16734, 16734, 1), +(16734, 16735, 2), +(16734, 16736, 3), +(16734, 16737, 4), +(16734, 16738, 5), + -- Arcane Meditation +(18462, 18462, 1), +(18462, 18463, 2), +(18462, 18464, 3), + -- Arcane Mind +(11232, 11232, 1), +(11232, 12500, 2), +(11232, 12501, 3), +(11232, 12502, 4), +(11232, 12503, 5), + -- Arcane Potency +(31571, 31571, 1), +(31571, 31572, 2), + -- Arcane Shielding +(11252, 11252, 1), +(11252, 12605, 2), + -- Arcane Shot +(3044, 3044, 1), +(3044, 14281, 2), +(3044, 14282, 3), +(3044, 14283, 4), +(3044, 14284, 5), +(3044, 14285, 6), +(3044, 14286, 7), +(3044, 14287, 8), +(3044, 27019, 9), +(3044, 49044, 10), +(3044, 49045, 11), + -- Arcane Stability +(11237, 11237, 1), +(11237, 12463, 2), +(11237, 12464, 3), +(11237, 16769, 4), +(11237, 16770, 5), + -- Arcane Subtlety +(11210, 11210, 1), +(11210, 12592, 2), + -- Arctic Reach +(16757, 16757, 1), +(16757, 16758, 2), + -- Arctic Winds +(31674, 31674, 1), +(31674, 31675, 2), +(31674, 31676, 3), +(31674, 31677, 4), +(31674, 31678, 5), + -- Ardent Defender +(31850, 31850, 1), +(31850, 31851, 2), +(31850, 31852, 3), + -- Armor +(8091, 8091, 1), +(8091, 8094, 2), +(8091, 8095, 3), +(8091, 12175, 4), +(8091, 33079, 5), +(8091, 43196, 6), +(8091, 58452, 7), +(8091, 58453, 8), + -- Armored to the Teeth +(61216, 61216, 1), +(61216, 61221, 2), +(61216, 61222, 3), + -- Aspect of the Dragonhawk +(61846, 61846, 1), +(61846, 61847, 2), + -- Aspect of the Hawk +(13165, 13165, 1), +(13165, 14318, 2), +(13165, 14319, 3), +(13165, 14320, 4), +(13165, 14321, 5), +(13165, 14322, 6), +(13165, 25296, 7), +(13165, 27044, 8), + -- Aspect of the Wild +(20043, 20043, 1), +(20043, 20190, 2), +(20043, 27045, 3), +(20043, 49071, 4), + -- Aspiration +(47507, 47507, 1), +(47507, 47508, 2), + -- Astral Shift +(51474, 51474, 1), +(51474, 51478, 2), +(51474, 51479, 3), + -- Avenger's Shield +(31935, 31935, 1), +(31935, 32699, 2), +(31935, 32700, 3), +(31935, 48826, 4), +(31935, 48827, 5), + -- Backdraft +(47258, 47258, 1), +(47258, 47259, 2), +(47258, 47260, 3), + -- Backlash +(34935, 34935, 1), +(34935, 34938, 2), +(34935, 34939, 3), + -- Backstab +(53, 53, 1), +(53, 2589, 2), +(53, 2590, 3), +(53, 2591, 4), +(53, 8721, 5), +(53, 11279, 6), +(53, 11280, 7), +(53, 11281, 8), +(53, 25300, 9), +(53, 26863, 10), +(53, 48656, 11), +(53, 48657, 12), + -- Bad Attitude +(50433, 50433, 1), +(50433, 52395, 2), +(50433, 52396, 3), +(50433, 52397, 4), +(50433, 52398, 5), +(50433, 52399, 6), + -- Balance of Power +(33592, 33592, 1), +(33592, 33596, 2), + -- Bane +(17788, 17788, 1), +(17788, 17789, 2), +(17788, 17790, 3), +(17788, 17791, 4), +(17788, 17792, 5), + -- Banish +(710, 710, 1), +(710, 18647, 2), + -- Barrage +(19461, 19461, 1), +(19461, 19462, 2), +(19461, 24691, 3), + -- Bash +(5211, 5211, 1), +(5211, 6798, 2), +(5211, 8983, 3), + -- Battle Shout +(6673, 6673, 1), +(6673, 5242, 2), +(6673, 6192, 3), +(6673, 11549, 4), +(6673, 11550, 5), +(6673, 11551, 6), +(6673, 25289, 7), +(6673, 2048, 8), +(6673, 47436, 9), + -- Benediction +(20101, 20101, 1), +(20101, 20102, 2), +(20101, 20103, 3), +(20101, 20104, 4), +(20101, 20105, 5), + -- Bestial Discipline +(19590, 19590, 1), +(19590, 19592, 2), + -- Bestial Fury +(19603, 19603, 1), +(19603, 19605, 2), +(19603, 19606, 3), +(19603, 19607, 4), +(19603, 19608, 5), + -- Binding Heal +(32546, 32546, 1), +(32546, 48119, 2), +(32546, 48120, 3), + -- Bite +(17254, 17254, 1), +(17254, 17262, 2), +(17254, 17263, 3), +(17254, 17264, 4), +(17254, 17265, 5), +(17254, 17266, 6), +(17254, 17267, 7), +(17254, 17268, 8), +(17254, 27348, 9), + -- Bite +(17253, 17253, 1), +(17253, 17255, 2), +(17253, 17256, 3), +(17253, 17257, 4), +(17253, 17258, 5), +(17253, 17259, 6), +(17253, 17260, 7), +(17253, 17261, 8), +(17253, 27050, 9), +(17253, 52473, 10), +(17253, 52474, 11), + -- Black Arrow +(3674, 3674, 1), +(3674, 63668, 2), +(3674, 63669, 3), +(3674, 63670, 4), +(3674, 63671, 5), +(3674, 63672, 6), + -- Black Ice +(49140, 49140, 1), +(49140, 49661, 2), +(49140, 49662, 3), +(49140, 49663, 4), +(49140, 49664, 5), + -- Blacksmithing +(2018, 2018, 1), +(2018, 3100, 2), +(2018, 3538, 3), +(2018, 9785, 4), +(2018, 29844, 5), +(2018, 51300, 6), + -- Blade Barrier +(51789, 51789, 1), +(51789, 64855, 2), +(51789, 64856, 3), +(51789, 64858, 4), +(51789, 64859, 5), + -- Blade Barrier +(49182, 49182, 1), +(49182, 49500, 2), +(49182, 49501, 3), +(49182, 55225, 4), +(49182, 55226, 5), + -- Blade Twisting +(31124, 31124, 1), +(31124, 31126, 2), + -- Bladed Armor +(48978, 48978, 1), +(48978, 49390, 2), +(48978, 49391, 3), +(48978, 49392, 4), +(48978, 49393, 5), + -- Blast Wave +(11113, 11113, 1), +(11113, 13018, 2), +(11113, 13019, 3), +(11113, 13020, 4), +(11113, 13021, 5), +(11113, 27133, 6), +(11113, 33933, 7), +(11113, 42944, 8), +(11113, 42945, 9), + -- Blazing Speed +(31641, 31641, 1), +(31641, 31642, 2), + -- Blessed Hands +(53660, 53660, 1), +(53660, 53661, 2), + -- Blessed Life +(31828, 31828, 1), +(31828, 31829, 2), +(31828, 31830, 3), + -- Blessing of Might +(19740, 19740, 1), +(19740, 19834, 2), +(19740, 19835, 3), +(19740, 19836, 4), +(19740, 19837, 5), +(19740, 19838, 6), +(19740, 25291, 7), +(19740, 27140, 8), +(19740, 48931, 9), +(19740, 48932, 10), + -- Blessing of the Eternals +(51554, 51554, 1), +(51554, 51555, 2), + -- Blessing of Wisdom +(19742, 19742, 1), +(19742, 19850, 2), +(19742, 19852, 3), +(19742, 19853, 4), +(19742, 19854, 5), +(19742, 25290, 6), +(19742, 27142, 7), +(19742, 48935, 8), +(19742, 48936, 9), + -- Blood Boil +(48721, 48721, 1), +(48721, 49939, 2), +(48721, 49940, 3), +(48721, 49941, 4), + -- Blood Craze +(16487, 16487, 1), +(16487, 16489, 2), +(16487, 16492, 3), + -- Blood Frenzy +(30069, 30069, 1), +(30069, 30070, 2), + -- Blood Frenzy +(29836, 29836, 1), +(29836, 29859, 2), + -- Blood Frenzy +(16952, 16952, 1), +(16952, 16954, 2), + -- Blood of Icewater +(50122, 50122, 1), +(50122, 50123, 2), +(50122, 50124, 3), +(50122, 50125, 4), +(50122, 50126, 5), + -- Blood of the North +(54639, 54639, 1), +(54639, 54638, 2), +(54639, 54637, 3), + -- Blood of the Rhino +(53481, 53481, 1), +(53481, 53482, 2), + -- Blood Pact +(6307, 6307, 1), +(6307, 7804, 2), +(6307, 7805, 3), +(6307, 11766, 4), +(6307, 11767, 5), +(6307, 27268, 6), +(6307, 47982, 7), + -- Blood Spatter +(51632, 51632, 1), +(51632, 51633, 2), + -- Blood-Caked Blade +(49219, 49219, 1), +(49219, 49627, 2), +(49219, 49628, 3), + -- Bloodsurge +(46913, 46913, 1), +(46913, 46914, 2), +(46913, 46915, 3), + -- Bloodthirsty +(53186, 53186, 1), +(53186, 53187, 2), + -- Bloodworms +(49027, 49027, 1), +(49027, 49542, 2), +(49027, 49543, 3), + -- Bloody Strikes +(48977, 48977, 1), +(48977, 49394, 2), +(48977, 49395, 3), + -- Bloody Vengeance +(48988, 48988, 1), +(48988, 49503, 2), +(48988, 49504, 3), + -- Body and Soul +(64127, 64127, 1), +(64127, 64129, 2), + -- Booming Echoes +(63370, 63370, 1), +(63370, 63372, 2), + -- Booming Voice +(12321, 12321, 1), +(12321, 12835, 2), + -- Borrowed Time +(52795, 52795, 1), +(52795, 52797, 2), +(52795, 52798, 3), +(52795, 52799, 4), +(52795, 52800, 5), + -- Brain Freeze +(44546, 44546, 1), +(44546, 44548, 2), +(44546, 44549, 3), + -- Brambles +(16836, 16836, 1), +(16836, 16839, 2), +(16836, 16840, 3), + -- Brutal Impact +(16940, 16940, 1), +(16940, 16941, 2), + -- Burning Determination +(54747, 54747, 1), +(54747, 54749, 2), + -- Burning Soul +(11083, 11083, 1), +(11083, 12351, 2), + -- Burnout +(44449, 44449, 1), +(44449, 44469, 2), +(44449, 44470, 3), +(44449, 44471, 4), +(44449, 44472, 5), + -- Butchery +(48979, 48979, 1), +(48979, 49483, 2), + -- Call of Flame +(16038, 16038, 1), +(16038, 16160, 2), +(16038, 16161, 3), + -- Camouflage +(13975, 13975, 1), +(13975, 14062, 2), +(13975, 14063, 3), + -- Careful Aim +(34482, 34482, 1), +(34482, 34483, 2), +(34482, 34484, 3), + -- Cataclysm +(17778, 17778, 1), +(17778, 17779, 2), +(17778, 17780, 3), + -- Catlike Reflexes +(34462, 34462, 1), +(34462, 34464, 2), +(34462, 34465, 3), + -- Celestial Focus +(16850, 16850, 1), +(16850, 16923, 2), +(16850, 16924, 3), + -- Chain Heal +(1064, 1064, 1), +(1064, 10622, 2), +(1064, 10623, 3), +(1064, 25422, 4), +(1064, 25423, 5), +(1064, 55458, 6), +(1064, 55459, 7), + -- Chains of Ice +(113, 113, 1), +(113, 512, 2), + -- Chaos Bolt +(50796, 50796, 1), +(50796, 59170, 2), +(50796, 59171, 3), +(50796, 59172, 4), + -- Charge +(100, 100, 1), +(100, 6178, 2), +(100, 11578, 3), + -- Charge Rage Bonus Effect +(12695, 12695, 1), +(12695, 12696, 2), + -- Cheat Death +(31228, 31228, 1), +(31228, 31229, 2), +(31228, 31230, 3), + -- Chilblains +(50040, 50040, 1), +(50040, 50041, 2), +(50040, 50043, 3), + -- Chill of the Grave +(49149, 49149, 1), +(49149, 50115, 2), + -- Chilled +(12484, 12484, 1), +(12484, 12485, 2), +(12484, 12486, 3), + -- Chilled to the Bone +(44566, 44566, 1), +(44566, 44567, 2), +(44566, 44568, 3), +(44566, 44570, 4), +(44566, 44571, 5), + -- Circle of Healing +(34861, 34861, 1), +(34861, 34863, 2), +(34861, 34864, 3), +(34861, 34865, 4), +(34861, 34866, 5), +(34861, 48088, 6), +(34861, 48089, 7), + -- Claw +(1082, 1082, 1), +(1082, 3029, 2), +(1082, 5201, 3), +(1082, 9849, 4), +(1082, 9850, 5), +(1082, 27000, 6), +(1082, 48569, 7), +(1082, 48570, 8), + -- Claw +(16827, 16827, 1), +(16827, 16828, 2), +(16827, 16829, 3), +(16827, 16830, 4), +(16827, 16831, 5), +(16827, 16832, 6), +(16827, 3010, 7), +(16827, 3009, 8), +(16827, 27049, 9), +(16827, 52471, 10), +(16827, 52472, 11), + -- Cleave +(30214, 30214, 1), +(30214, 30222, 2), +(30214, 30224, 3), + -- Cleave +(845, 845, 1), +(845, 7369, 2), +(845, 11608, 3), +(845, 11609, 4), +(845, 20569, 5), +(845, 25231, 6), +(845, 47519, 7), +(845, 47520, 8), + -- Cleave +(30213, 30213, 1), +(30213, 30219, 2), +(30213, 30223, 3), +(30213, 47994, 4), + -- Cleave Armor +(5508, 5508, 1), +(5508, 5480, 2), + -- Close Quarters Combat +(13706, 13706, 1), +(13706, 13804, 2), +(13706, 13805, 3), +(13706, 13806, 4), +(13706, 13807, 5), + -- Cobra Reflexes +(61682, 61682, 1), +(61682, 61683, 2), + -- Cobra Strikes +(53256, 53256, 1), +(53256, 53259, 2), +(53256, 53260, 3), + -- Cold as Ice +(55091, 55091, 1), +(55091, 55092, 2), + -- Combat Endurance +(17427, 17427, 1), +(17427, 17428, 2), +(17427, 17429, 3), + -- Combat Experience +(34475, 34475, 1), +(34475, 34476, 2), + -- Combat Expertise +(31858, 31858, 1), +(31858, 31859, 2), +(31858, 31860, 3), + -- Combat Potency +(35542, 35542, 1), +(35542, 35545, 2), +(35542, 35546, 3), +(35542, 35547, 4), +(35542, 35548, 5), + -- Combat Potency +(35541, 35541, 1), +(35541, 35550, 2), +(35541, 35551, 3), +(35541, 35552, 4), +(35541, 35553, 5), + -- Commanding Presence +(12318, 12318, 1), +(12318, 12857, 2), +(12318, 12858, 3), +(12318, 12860, 4), +(12318, 12861, 5), + -- Commanding Shout +(469, 469, 1), +(469, 47439, 2), +(469, 47440, 3), + -- Concussion +(16035, 16035, 1), +(16035, 16105, 2), +(16035, 16106, 3), +(16035, 16107, 4), +(16035, 16108, 5), + -- Concussive Barrage +(35100, 35100, 1), +(35100, 35102, 2), + -- Cone of Cold +(120, 120, 1), +(120, 8492, 2), +(120, 10159, 3), +(120, 10160, 4), +(120, 10161, 5), +(120, 27087, 6), +(120, 42930, 7), +(120, 42931, 8), + -- Conjure Food +(587, 587, 1), +(587, 597, 2), +(587, 990, 3), +(587, 6129, 4), +(587, 10144, 5), +(587, 10145, 6), +(587, 28612, 7), +(587, 33717, 8), + -- Conjure Mana Gem +(759, 759, 1), +(759, 3552, 2), +(759, 10053, 3), +(759, 10054, 4), +(759, 27101, 5), +(759, 42985, 6), + -- Conjure Refreshment +(42955, 42955, 1), +(42955, 42956, 2), + -- Conjure Water +(5504, 5504, 1), +(5504, 5505, 2), +(5504, 5506, 3), +(5504, 6127, 4), +(5504, 10138, 5), +(5504, 10139, 6), +(5504, 10140, 7), +(5504, 37420, 8), +(5504, 27090, 9), + -- Consecration +(26573, 26573, 1), +(26573, 20116, 2), +(26573, 20922, 3), +(26573, 20923, 4), +(26573, 20924, 5), +(26573, 27173, 6), +(26573, 48818, 7), +(26573, 48819, 8), + -- Consume Shadows +(17767, 17767, 1), +(17767, 17850, 2), +(17767, 17851, 3), +(17767, 17852, 4), +(17767, 17853, 5), +(17767, 17854, 6), +(17767, 27272, 7), +(17767, 47987, 8), +(17767, 47988, 9), + -- Contagion +(30060, 30060, 1), +(30060, 30061, 2), +(30060, 30062, 3), +(30060, 30063, 4), +(30060, 30064, 5), + -- Convection +(16039, 16039, 1), +(16039, 16109, 2), +(16039, 16110, 3), +(16039, 16111, 4), +(16039, 16112, 5), + -- Conviction +(20117, 20117, 1), +(20117, 20118, 2), +(20117, 20119, 3), +(20117, 20120, 4), +(20117, 20121, 5), + -- Cooking +(2550, 2550, 1), +(2550, 3102, 2), +(2550, 3413, 3), +(2550, 18260, 4), +(2550, 33359, 5), +(2550, 51296, 6), + -- Cornered +(52234, 52234, 1), +(52234, 53497, 2), + -- Corpse Explosion +(49158, 49158, 1), +(49158, 51325, 2), +(49158, 51326, 3), +(49158, 51327, 4), +(49158, 51328, 5), + -- Corruption +(172, 172, 1), +(172, 6222, 2), +(172, 6223, 3), +(172, 7648, 4), +(172, 11671, 5), +(172, 11672, 6), +(172, 25311, 7), +(172, 27216, 8), +(172, 47812, 9), +(172, 47813, 10), + -- Counterattack +(19306, 19306, 1), +(19306, 20909, 2), +(19306, 20910, 3), +(19306, 27067, 4), +(19306, 48998, 5), +(19306, 48999, 6), + -- Cower +(8998, 8998, 1), +(8998, 9000, 2), +(8998, 9892, 3), +(8998, 31709, 4), +(8998, 27004, 5), +(8998, 48575, 6), + -- Create Firestone +(6366, 6366, 1), +(6366, 17951, 2), +(6366, 17952, 3), +(6366, 17953, 4), +(6366, 27250, 5), +(6366, 60219, 6), +(6366, 60220, 7), + -- Create Healthstone +(6201, 6201, 1), +(6201, 6202, 2), +(6201, 5699, 3), +(6201, 11729, 4), +(6201, 11730, 5), +(6201, 27230, 6), +(6201, 47871, 7), +(6201, 47878, 8), + -- Create Soulstone +(693, 693, 1), +(693, 20752, 2), +(693, 20755, 3), +(693, 20756, 4), +(693, 20757, 5), +(693, 27238, 6), +(693, 47884, 7), + -- Create Spellstone +(2362, 2362, 1), +(2362, 17727, 2), +(2362, 17728, 3), +(2362, 28172, 4), +(2362, 47886, 5), +(2362, 47888, 6), + -- Critical Block +(47294, 47294, 1), +(47294, 47295, 2), +(47294, 47296, 3), + -- Critical Mass +(11115, 11115, 1), +(11115, 11367, 2), +(11115, 11368, 3), + -- Cruelty +(12320, 12320, 1), +(12320, 12852, 2), +(12320, 12853, 3), +(12320, 12855, 4), +(12320, 12856, 5), + -- Crusade +(31866, 31866, 1), +(31866, 31867, 2), +(31866, 31868, 3), + -- Crypt Fever +(49032, 49032, 1), +(49032, 49631, 2), +(49032, 49632, 3), + -- Culling the Herd +(61680, 61680, 1), +(61680, 61681, 2), +(61680, 52858, 3), + -- Curse of Agony +(980, 980, 1), +(980, 1014, 2), +(980, 6217, 3), +(980, 11711, 4), +(980, 11712, 5), +(980, 11713, 6), +(980, 27218, 7), +(980, 47863, 8), +(980, 47864, 9), + -- Curse of Doom +(603, 603, 1), +(603, 30910, 2), +(603, 47867, 3), + -- Curse of the Elements +(1490, 1490, 1), +(1490, 11721, 2), +(1490, 11722, 3), +(1490, 27228, 4), +(1490, 47865, 5), + -- Curse of Tongues +(1714, 1714, 1), +(1714, 11719, 2), + -- Curse of Weakness +(702, 702, 1), +(702, 1108, 2), +(702, 6205, 3), +(702, 7646, 4), +(702, 11707, 5), +(702, 11708, 6), +(702, 27224, 7), +(702, 30909, 8), +(702, 50511, 9), + -- Cut to the Chase +(51664, 51664, 1), +(51664, 51665, 2), +(51664, 51667, 3), +(51664, 51668, 4), +(51664, 51669, 5), + -- Damage Shield +(58872, 58872, 1), +(58872, 58874, 2), + -- Dampen Magic +(1266, 1266, 1), +(1266, 8452, 2), +(1266, 8453, 3), +(1266, 10175, 4), +(1266, 10176, 5), + -- Dampen Magic +(604, 604, 1), +(604, 8450, 2), +(604, 8451, 3), +(604, 10173, 4), +(604, 10174, 5), +(604, 33944, 6), +(604, 43015, 7), + -- Dark Conviction +(48987, 48987, 1), +(48987, 49477, 2), +(48987, 49478, 3), +(48987, 49479, 4), +(48987, 49480, 5), + -- Dark Pact +(18220, 18220, 1), +(18220, 18937, 2), +(18220, 18938, 3), +(18220, 27265, 4), +(18220, 59092, 5), + -- Darkness +(15259, 15259, 1), +(15259, 15307, 2), +(15259, 15308, 3), +(15259, 15309, 4), +(15259, 15310, 5), + -- Dash +(1850, 1850, 1), +(1850, 9821, 2), +(1850, 33357, 3), + -- Deadened Nerves +(31380, 31380, 1), +(31380, 31382, 2), +(31380, 31383, 3), + -- Deadliness +(30902, 30902, 1), +(30902, 30903, 2), +(30902, 30904, 3), +(30902, 30905, 4), +(30902, 30906, 5), + -- Deadly Brew +(51625, 51625, 1), +(51625, 51626, 2), + -- Deadly Throw +(26679, 26679, 1), +(26679, 48673, 2), +(26679, 48674, 3), + -- Death and Decay +(43265, 43265, 1), +(43265, 49936, 2), +(43265, 49937, 3), +(43265, 49938, 4), + -- Death Coil +(6789, 6789, 1), +(6789, 17925, 2), +(6789, 17926, 3), +(6789, 27223, 4), +(6789, 47859, 5), +(6789, 47860, 6), + -- Death Coil +(62900, 62900, 1), +(62900, 62901, 2), +(62900, 62902, 3), +(62900, 62903, 4), +(62900, 62904, 5), + -- Death Strike +(49998, 49998, 1), +(49998, 49999, 2), +(49998, 45463, 3), +(49998, 49923, 4), +(49998, 49924, 5), + -- Death's Embrace +(47198, 47198, 1), +(47198, 47199, 2), +(47198, 47200, 3), + -- Decimation +(63156, 63156, 1), +(63156, 63158, 2), + -- Deep Wounds +(12162, 12162, 1), +(12162, 12850, 2), +(12162, 12868, 3), + -- Deep Wounds +(12834, 12834, 1), +(12834, 12849, 2), +(12834, 12867, 3), + -- Defensive Tactics +(29559, 29559, 1), +(29559, 29588, 2), +(29559, 29589, 3), + -- Defiance +(12303, 12303, 1), +(12303, 12788, 2), +(12303, 12789, 3), + -- Deflection +(16462, 16462, 1), +(16462, 16463, 2), +(16462, 16464, 3), +(16462, 16465, 4), +(16462, 16466, 5), + -- Deflection +(13713, 13713, 1), +(13713, 13853, 2), +(13713, 13854, 3), + -- Deflection +(19295, 19295, 1), +(19295, 19297, 2), +(19295, 19298, 3), + -- Deflection +(20060, 20060, 1), +(20060, 20061, 2), +(20060, 20062, 3), +(20060, 20063, 4), +(20060, 20064, 5), + -- Demon Armor +(706, 706, 1), +(706, 1086, 2), +(706, 11733, 3), +(706, 11734, 4), +(706, 11735, 5), +(706, 27260, 6), +(706, 47793, 7), +(706, 47889, 8), + -- Demon Skin +(687, 687, 1), +(687, 696, 2), + -- Demonic Aegis +(30143, 30143, 1), +(30143, 30144, 2), +(30143, 30145, 3), + -- Demonic Brutality +(18705, 18705, 1), +(18705, 18706, 2), +(18705, 18707, 3), + -- Demonic Embrace +(18697, 18697, 1), +(18697, 18698, 2), +(18697, 18699, 3), + -- Demonic Knowledge +(35691, 35691, 1), +(35691, 35692, 2), +(35691, 35693, 3), + -- Demonic Pact +(47236, 47236, 1), +(47236, 47237, 2), +(47236, 47238, 3), +(47236, 47239, 4), +(47236, 47240, 5), + -- Demonic Power +(18126, 18126, 1), +(18126, 18127, 2), + -- Demonic Resilience +(30319, 30319, 1), +(30319, 30320, 2), +(30319, 30321, 3), + -- Demonic Tactics +(30242, 30242, 1), +(30242, 30245, 2), +(30242, 30246, 3), +(30242, 30247, 4), +(30242, 30248, 5), + -- Demoralizing Roar +(99, 99, 1), +(99, 1735, 2), +(99, 9490, 3), +(99, 9747, 4), +(99, 9898, 5), +(99, 26998, 6), +(99, 48559, 7), +(99, 48560, 8), + -- Demoralizing Screech +(24424, 24424, 1), +(24424, 24580, 2), +(24424, 24581, 3), +(24424, 24582, 4), +(24424, 27349, 5), + -- Demoralizing Screech +(24423, 24423, 1), +(24423, 24577, 2), +(24423, 24578, 3), +(24423, 24579, 4), +(24423, 27051, 5), +(24423, 55487, 6), + -- Demoralizing Shout +(1160, 1160, 1), +(1160, 6190, 2), +(1160, 11554, 3), +(1160, 11555, 4), +(1160, 11556, 5), +(1160, 25202, 6), +(1160, 25203, 7), +(1160, 47437, 8), + -- Desecration +(55666, 55666, 1), +(55666, 55667, 2), + -- Desperate Prayer +(19236, 19236, 1), +(19236, 19238, 2), +(19236, 19240, 3), +(19236, 19241, 4), +(19236, 19242, 5), +(19236, 19243, 6), +(19236, 25437, 7), +(19236, 48172, 8), +(19236, 48173, 9), + -- Destructive Reach +(17917, 17917, 1), +(17917, 17918, 2), + -- Destructive Soul +(30251, 30251, 1), +(30251, 30256, 2), + -- Devastate +(20243, 20243, 1), +(20243, 30016, 2), +(20243, 30022, 3), +(20243, 47497, 4), +(20243, 47498, 5), + -- Devotion Aura +(465, 465, 1), +(465, 10290, 2), +(465, 643, 3), +(465, 10291, 4), +(465, 1032, 5), +(465, 10292, 6), +(465, 10293, 7), +(465, 27149, 8), +(465, 48941, 9), +(465, 48942, 10), + -- Devour Magic +(19505, 19505, 1), +(19505, 19731, 2), +(19505, 19734, 3), +(19505, 19736, 4), +(19505, 27276, 5), +(19505, 27277, 6), +(19505, 48011, 7), + -- Devouring Plague +(2944, 2944, 1), +(2944, 19276, 2), +(2944, 19277, 3), +(2944, 19278, 4), +(2944, 19279, 5), +(2944, 19280, 6), +(2944, 25467, 7), +(2944, 48299, 8), +(2944, 48300, 9), + -- Dirge +(49223, 49223, 1), +(49223, 49599, 2), + -- Dirty Deeds +(14082, 14082, 1), +(14082, 14083, 2), + -- Dirty Tricks +(14076, 14076, 1), +(14076, 14094, 2), + -- Dispel Magic +(527, 527, 1), +(527, 988, 2), + -- Displacement +(34478, 34478, 1), +(34478, 34479, 2), +(34478, 34481, 3), + -- Dive +(23146, 23146, 1), +(23146, 23149, 2), +(23146, 23150, 3), + -- Divine Aegis +(47509, 47509, 1), +(47509, 47511, 2), +(47509, 47515, 3), + -- Divine Fury +(18530, 18530, 1), +(18530, 18531, 2), +(18530, 18533, 3), +(18530, 18534, 4), +(18530, 18535, 5), + -- Divine Guardian +(53527, 53527, 1), +(53527, 53530, 2), + -- Divine Intellect +(20257, 20257, 1), +(20257, 20258, 2), +(20257, 20259, 3), +(20257, 20260, 4), +(20257, 20261, 5), + -- Divine Providence +(47562, 47562, 1), +(47562, 47564, 2), +(47562, 47565, 3), +(47562, 47566, 4), +(47562, 47567, 5), + -- Divine Purpose +(31871, 31871, 1), +(31871, 31872, 2), + -- Divine Spirit +(14752, 14752, 1), +(14752, 14818, 2), +(14752, 14819, 3), +(14752, 27841, 4), +(14752, 25312, 5), +(14752, 48073, 6), + -- Divine Strength +(20262, 20262, 1), +(20262, 20263, 2), +(20262, 20264, 3), +(20262, 20265, 4), +(20262, 20266, 5), + -- Divinity +(63646, 63646, 1), +(63646, 63647, 2), +(63646, 63648, 3), +(63646, 63649, 4), +(63646, 63650, 5), + -- Dragon's Breath +(31661, 31661, 1), +(31661, 33041, 2), +(31661, 33042, 3), +(31661, 33043, 4), +(31661, 42949, 5), +(31661, 42950, 6), + -- Drain Life +(689, 689, 1), +(689, 699, 2), +(689, 709, 3), +(689, 7651, 4), +(689, 11699, 5), +(689, 11700, 6), +(689, 27219, 7), +(689, 27220, 8), +(689, 47857, 9), + -- Drain Soul +(1120, 1120, 1), +(1120, 8288, 2), +(1120, 8289, 3), +(1120, 11675, 4), +(1120, 27217, 5), +(1120, 47855, 6), + -- Dreamstate +(33597, 33597, 1), +(33597, 33599, 2), +(33597, 33956, 3), + -- Dual Wield Specialization +(13715, 13715, 1), +(13715, 13848, 2), +(13715, 13849, 3), +(13715, 13851, 4), +(13715, 13852, 5), + -- Dual Wield Specialization +(23584, 23584, 1), +(23584, 23585, 2), +(23584, 23586, 3), +(23584, 23587, 4), +(23584, 23588, 5), + -- Dual Wield Specialization +(30816, 30816, 1), +(30816, 30818, 2), +(30816, 30819, 3), + -- Earth and Moon +(48506, 48506, 1), +(48506, 48510, 2), +(48506, 48511, 3), + -- Earth Shield +(974, 974, 1), +(974, 32593, 2), +(974, 32594, 3), +(974, 49283, 4), +(974, 49284, 5), + -- Earth Shock +(8042, 8042, 1), +(8042, 8044, 2), +(8042, 8045, 3), +(8042, 8046, 4), +(8042, 10412, 5), +(8042, 10413, 6), +(8042, 10414, 7), +(8042, 25454, 8), +(8042, 49230, 9), +(8042, 49231, 10), + -- Earthen Power +(51523, 51523, 1), +(51523, 51524, 2), + -- Earthliving +(51945, 51945, 1), +(51945, 51990, 2), +(51945, 51997, 3), +(51945, 51998, 4), +(51945, 51999, 5), +(51945, 52000, 6), + -- Earthliving Weapon +(51730, 51730, 1), +(51730, 51988, 2), +(51730, 51991, 3), +(51730, 51992, 4), +(51730, 51993, 5), +(51730, 51994, 6), + -- Earthliving Weapon (Passive) +(51940, 51940, 1), +(51940, 51989, 2), +(51940, 52004, 3), +(51940, 52005, 4), +(51940, 52007, 5), +(51940, 52008, 6), + -- Earth's Grasp +(16043, 16043, 1), +(16043, 16130, 2), + -- Ebon Plaguebringer +(51099, 51099, 1), +(51099, 51160, 2), +(51099, 51161, 3), + -- Eclipse +(48516, 48516, 1), +(48516, 48521, 2), +(48516, 48525, 3), + -- Efficiency +(19416, 19416, 1), +(19416, 19417, 2), +(19416, 19418, 3), +(19416, 19419, 4), +(19416, 19420, 5), + -- Elemental Absorption +(30701, 30701, 1), +(30701, 30702, 2), +(30701, 30703, 3), +(30701, 30704, 4), +(30701, 30705, 5), + -- Elemental Oath +(51466, 51466, 1), +(51466, 51470, 2), + -- Elemental Precision +(30672, 30672, 1), +(30672, 30673, 2), +(30672, 30674, 3), + -- Elemental Reach +(28999, 28999, 1), +(28999, 29000, 2), + -- Elemental Shields +(30669, 30669, 1), +(30669, 30670, 2), +(30669, 30671, 3), + -- Elemental Warding +(28996, 28996, 1), +(28996, 28997, 2), +(28996, 28998, 3), + -- Elemental Weapons +(16266, 16266, 1), +(16266, 29079, 2), +(16266, 29080, 3), + -- Elusiveness +(13981, 13981, 1), +(13981, 14066, 2), + -- Emberstorm +(17954, 17954, 1), +(17954, 17955, 2), +(17954, 17956, 3), +(17954, 17957, 4), +(17954, 17958, 5), + -- Empowered Corruption +(32381, 32381, 1), +(32381, 32382, 2), +(32381, 32383, 3), + -- Empowered Fire +(31656, 31656, 1), +(31656, 31657, 2), +(31656, 31658, 3), + -- Empowered Frostbolt +(31682, 31682, 1), +(31682, 31683, 2), + -- Empowered Healing +(33158, 33158, 1), +(33158, 33159, 2), +(33158, 33160, 3), +(33158, 33161, 4), +(33158, 33162, 5), + -- Empowered Imp +(47220, 47220, 1), +(47220, 47221, 2), +(47220, 47223, 3), + -- Empowered Rejuvenation +(33886, 33886, 1), +(33886, 33887, 2), +(33886, 33888, 3), +(33886, 33889, 4), +(33886, 33890, 5), + -- Empowered Renew +(63534, 63534, 1), +(63534, 63542, 2), +(63534, 63543, 3), + -- Empowered Touch +(33879, 33879, 1), +(33879, 33880, 2), + -- Enchanting +(7411, 7411, 1), +(7411, 7412, 2), +(7411, 7413, 3), +(7411, 13920, 4), +(7411, 28029, 5), +(7411, 51313, 6), + -- Endless Winter +(49137, 49137, 1), +(49137, 49657, 2), + -- Endurance +(13742, 13742, 1), +(13742, 13872, 2), + -- Endurance Training +(19583, 19583, 1), +(19583, 19584, 2), +(19583, 19585, 3), +(19583, 19586, 4), +(19583, 19587, 5), + -- Enduring Winter +(44557, 44557, 1), +(44557, 44560, 2), +(44557, 44561, 3), + -- Engineering +(4036, 4036, 1), +(4036, 4037, 2), +(4036, 4038, 3), +(4036, 12656, 4), +(4036, 30350, 5), +(4036, 51306, 6), + -- Enhancing Totems +(16259, 16259, 1), +(16259, 16295, 2), +(16259, 52456, 3), + -- Enlightened Judgements +(53556, 53556, 1), +(53556, 53557, 2), + -- Enlightenment +(34908, 34908, 1), +(34908, 34909, 2), +(34908, 34910, 3), + -- Enrage +(12317, 12317, 1), +(12317, 13045, 2), +(12317, 13046, 3), +(12317, 13047, 4), +(12317, 13048, 5), + -- Enslave Demon +(1098, 1098, 1), +(1098, 11725, 2), +(1098, 11726, 3), +(1098, 61191, 4), + -- Entangling Roots +(339, 339, 1), +(339, 1062, 2), +(339, 5195, 3), +(339, 5196, 4), +(339, 9852, 5), +(339, 9853, 6), +(339, 26989, 7), +(339, 53308, 8), + -- Entrapment +(19184, 19184, 1), +(19184, 19387, 2), +(19184, 19388, 3), + -- Enveloping Shadows +(31211, 31211, 1), +(31211, 31212, 2), +(31211, 31213, 3), + -- Envenom +(32645, 32645, 1), +(32645, 32684, 2), +(32645, 57992, 3), +(32645, 57993, 4), + -- Epidemic +(49036, 49036, 1), +(49036, 49562, 2), + -- Eradication +(47195, 47195, 1), +(47195, 47196, 2), +(47195, 47197, 3), + -- Evasion +(5277, 5277, 1), +(5277, 26669, 2), + -- Everlasting Affliction +(47201, 47201, 1), +(47201, 47202, 2), +(47201, 47203, 3), +(47201, 47204, 4), +(47201, 47205, 5), + -- Eviscerate +(2098, 2098, 1), +(2098, 6760, 2), +(2098, 6761, 3), +(2098, 6762, 4), +(2098, 8623, 5), +(2098, 8624, 6), +(2098, 11299, 7), +(2098, 11300, 8), +(2098, 31016, 9), +(2098, 26865, 10), +(2098, 48667, 11), +(2098, 48668, 12), + -- Execute +(5308, 5308, 1), +(5308, 20658, 2), +(5308, 20660, 3), +(5308, 20661, 4), +(5308, 20662, 5), +(5308, 25234, 6), +(5308, 25236, 7), +(5308, 47470, 8), +(5308, 47471, 9), + -- Exorcism +(879, 879, 1), +(879, 5614, 2), +(879, 5615, 3), +(879, 10312, 4), +(879, 10313, 5), +(879, 10314, 6), +(879, 27138, 7), +(879, 48800, 8), +(879, 48801, 9), + -- Explosive Shot +(53301, 53301, 1), +(53301, 60051, 2), +(53301, 60052, 3), +(53301, 60053, 4), + -- Explosive Trap +(13813, 13813, 1), +(13813, 14316, 2), +(13813, 14317, 3), +(13813, 27025, 4), +(13813, 49066, 5), +(13813, 49067, 6), + -- Explosive Trap Effect +(13812, 13812, 1), +(13812, 14314, 2), +(13812, 14315, 3), +(13812, 27026, 4), +(13812, 49064, 5), +(13812, 49065, 6), + -- Expose Weakness +(34500, 34500, 1), +(34500, 34502, 2), +(34500, 34503, 3), + -- Eye of the Storm +(29062, 29062, 1), +(29062, 29064, 2), +(29062, 29065, 3), + -- Faerie Fire +(13424, 13424, 1), +(13424, 13752, 2), + -- Fanaticism +(31879, 31879, 1), +(31879, 31880, 2), +(31879, 31881, 3), + -- Fear +(5782, 5782, 1), +(5782, 6213, 2), +(5782, 6215, 3), + -- Feeding Frenzy +(60096, 60096, 1), +(60096, 60097, 2), + -- Feeding Frenzy +(53511, 53511, 1), +(53511, 53512, 2), + -- Feint +(1966, 1966, 1), +(1966, 6768, 2), +(1966, 8637, 3), +(1966, 11303, 4), +(1966, 25302, 5), +(1966, 27448, 6), +(1966, 48658, 7), +(1966, 48659, 8), + -- Fel Armor +(28176, 28176, 1), +(28176, 28189, 2), +(28176, 47892, 3), +(28176, 47893, 4), + -- Fel Concentration +(17783, 17783, 1), +(17783, 17784, 2), +(17783, 17785, 3), + -- Fel Intelligence +(54424, 54424, 1), +(54424, 57564, 2), +(54424, 57565, 3), +(54424, 57566, 4), +(54424, 57567, 5), + -- Fel Synergy +(47230, 47230, 1), +(47230, 47231, 2), + -- Fel Vitality +(18731, 18731, 1), +(18731, 18743, 2), +(18731, 18744, 3), + -- Feral Aggression +(16858, 16858, 1), +(16858, 16859, 2), +(16858, 16860, 3), +(16858, 16861, 4), +(16858, 16862, 5), + -- Feral Instinct +(16947, 16947, 1), +(16947, 16948, 2), +(16947, 16949, 3), + -- Ferocious Bite +(22568, 22568, 1), +(22568, 22827, 2), +(22568, 22828, 3), +(22568, 22829, 4), +(22568, 31018, 5), +(22568, 24248, 6), +(22568, 48576, 7), +(22568, 48577, 8), + -- Ferocious Dead +(49038, 49038, 1), +(49038, 49595, 2), +(49038, 49596, 3), + -- Ferocious Inspiration +(34455, 34455, 1), +(34455, 34459, 2), +(34455, 34460, 3), + -- Ferocity +(19598, 19598, 1), +(19598, 19599, 2), +(19598, 19600, 3), +(19598, 19601, 4), +(19598, 19602, 5), + -- Ferocity +(16934, 16934, 1), +(16934, 16935, 2), +(16934, 16936, 3), +(16934, 16937, 4), +(16934, 16938, 5), + -- Filthy Tricks +(58414, 58414, 1), +(58414, 58415, 2), + -- Find Weakness +(31234, 31234, 1), +(31234, 31235, 2), +(31234, 31236, 3), + -- Fingers of Frost +(44543, 44543, 1), +(44543, 44545, 2), + -- Fire and Brimstone +(47266, 47266, 1), +(47266, 47267, 2), +(47266, 47268, 3), +(47266, 47269, 4), +(47266, 47270, 5), + -- Fire Blast +(2141, 2141, 1), +(2141, 2142, 2), +(2141, 2143, 3), +(2141, 8414, 4), +(2141, 8415, 5), +(2141, 10198, 6), +(2141, 10200, 7), +(2141, 27378, 8), +(2141, 27379, 9), + -- Fire Blast +(2136, 2136, 1), +(2136, 2137, 2), +(2136, 2138, 3), +(2136, 8412, 4), +(2136, 8413, 5), +(2136, 10197, 6), +(2136, 10199, 7), +(2136, 27078, 8), +(2136, 27079, 9), +(2136, 42872, 10), +(2136, 42873, 11), + -- Fire Breath +(34889, 34889, 1), +(34889, 35323, 2), +(34889, 55482, 3), +(34889, 55483, 4), +(34889, 55484, 5), +(34889, 55485, 6), + -- Fire Power +(11124, 11124, 1), +(11124, 12378, 2), +(11124, 12398, 3), +(11124, 12399, 4), +(11124, 12400, 5), + -- Fire Resistance Aura +(19891, 19891, 1), +(19891, 19899, 2), +(19891, 19900, 3), +(19891, 27153, 4), +(19891, 48947, 5), + -- Fire Resistance Totem +(8184, 8184, 1), +(8184, 10537, 2), +(8184, 10538, 3), +(8184, 25563, 4), +(8184, 58737, 5), +(8184, 58739, 6), + -- Fire Shield +(2947, 2947, 1), +(2947, 8316, 2), +(2947, 8317, 3), +(2947, 11770, 4), +(2947, 11771, 5), +(2947, 27269, 6), +(2947, 47983, 7), + -- Fire Shot +(3011, 3011, 1), +(3011, 6979, 2), +(3011, 6980, 3), + -- Fire Ward +(1035, 1035, 1), +(1035, 8459, 2), +(1035, 8460, 3), +(1035, 10224, 4), +(1035, 10226, 5), +(1035, 27395, 6), + -- Fire Ward +(543, 543, 1), +(543, 8457, 2), +(543, 8458, 3), +(543, 10223, 4), +(543, 10225, 5), +(543, 27128, 6), +(543, 43010, 7), + -- Fireball +(133, 133, 1), +(133, 143, 2), +(133, 145, 3), +(133, 3140, 4), +(133, 8400, 5), +(133, 8401, 6), +(133, 8402, 7), +(133, 10148, 8), +(133, 10149, 9), +(133, 10150, 10), +(133, 10151, 11), +(133, 25306, 12), +(133, 27070, 13), +(133, 38692, 14), +(133, 42832, 15), +(133, 42833, 16), + -- Firebolt +(3110, 3110, 1), +(3110, 7799, 2), +(3110, 7800, 3), +(3110, 7801, 4), +(3110, 7802, 5), +(3110, 11762, 6), +(3110, 11763, 7), +(3110, 27267, 8), +(3110, 47964, 9), + -- Firestarter +(44442, 44442, 1), +(44442, 44443, 2), + -- First Aid +(3273, 3273, 1), +(3273, 3274, 2), +(3273, 7924, 3), +(3273, 10846, 4), +(3273, 27028, 5), +(3273, 45542, 6), + -- Flame Shock +(8050, 8050, 1), +(8050, 8052, 2), +(8050, 8053, 3), +(8050, 10447, 4), +(8050, 10448, 5), +(8050, 29228, 6), +(8050, 25457, 7), +(8050, 49232, 8), +(8050, 49233, 9), + -- Flame Throwing +(11100, 11100, 1), +(11100, 12353, 2), + -- Flamestrike +(2120, 2120, 1), +(2120, 2121, 2), +(2120, 8422, 3), +(2120, 8423, 4), +(2120, 10215, 5), +(2120, 10216, 6), +(2120, 27086, 7), +(2120, 42925, 8), +(2120, 42926, 9), + -- Flametongue Totem +(52109, 52109, 1), +(52109, 52110, 2), +(52109, 52111, 3), +(52109, 52112, 4), +(52109, 52113, 5), +(52109, 58651, 6), +(52109, 58654, 7), +(52109, 58655, 8), + -- Flametongue Totem +(8227, 8227, 1), +(8227, 8249, 2), +(8227, 10526, 3), +(8227, 16387, 4), +(8227, 25557, 5), +(8227, 58649, 6), +(8227, 58652, 7), +(8227, 58656, 8), + -- Flametongue Weapon +(8024, 8024, 1), +(8024, 8027, 2), +(8024, 8030, 3), +(8024, 16339, 4), +(8024, 16341, 5), +(8024, 16342, 6), +(8024, 25489, 7), +(8024, 58785, 8), +(8024, 58789, 9), +(8024, 58790, 10), + -- Flametongue Weapon (Passive) +(10400, 10400, 1), +(10400, 15567, 2), +(10400, 15568, 3), +(10400, 15569, 4), +(10400, 16311, 5), +(10400, 16312, 6), +(10400, 16313, 7), +(10400, 58784, 8), +(10400, 58791, 9), +(10400, 58792, 10), + -- Flametongue Weapon Proc +(8026, 8026, 1), +(8026, 8028, 2), +(8026, 8029, 3), +(8026, 10445, 4), +(8026, 16343, 5), +(8026, 16344, 6), +(8026, 25488, 7), +(8026, 58786, 8), +(8026, 58787, 9), +(8026, 58788, 10), + -- Flash Heal +(2061, 2061, 1), +(2061, 9472, 2), +(2061, 9473, 3), +(2061, 9474, 4), +(2061, 10915, 5), +(2061, 10916, 6), +(2061, 10917, 7), +(2061, 25233, 8), +(2061, 25235, 9), +(2061, 48070, 10), +(2061, 48071, 11), + -- Flash of Light +(19750, 19750, 1), +(19750, 19939, 2), +(19750, 19940, 3), +(19750, 19941, 4), +(19750, 19942, 5), +(19750, 19943, 6), +(19750, 27137, 7), +(19750, 48784, 8), +(19750, 48785, 9), + -- Fleet Footed +(31208, 31208, 1), +(31208, 31209, 2), + -- Flurry +(16257, 16257, 1), +(16257, 16277, 2), +(16257, 16278, 3), +(16257, 16279, 4), +(16257, 16280, 5), + -- Flurry +(16256, 16256, 1), +(16256, 16281, 2), +(16256, 16282, 3), +(16256, 16283, 4), +(16256, 16284, 5), + -- Focused Aim +(53620, 53620, 1), +(53620, 53621, 2), +(53620, 53622, 3), + -- Focused Attacks +(51634, 51634, 1), +(51634, 51635, 2), +(51634, 51636, 3), + -- Focused Casting +(14743, 14743, 1), +(14743, 27828, 2), + -- Focused Fire +(35060, 35060, 1), +(35060, 35061, 2), + -- Focused Fire +(35029, 35029, 1), +(35029, 35030, 2), + -- Focused Mind +(33213, 33213, 1), +(33213, 33214, 2), +(33213, 33215, 3), + -- Focused Mind +(30864, 30864, 1), +(30864, 30865, 2), +(30864, 30866, 3), + -- Focused Power +(33186, 33186, 1), +(33186, 33190, 2), + -- Focused Rage +(29787, 29787, 1), +(29787, 29790, 2), +(29787, 29792, 3), + -- Freezing Trap +(1499, 1499, 1), +(1499, 14310, 2), +(1499, 14311, 3), + -- Freezing Trap Effect +(3355, 3355, 1), +(3355, 14308, 2), +(3355, 14309, 3), + -- Frenzy +(19621, 19621, 1), +(19621, 19622, 2), +(19621, 19623, 3), +(19621, 19624, 4), +(19621, 19625, 5), + -- Frigid Dreadplate +(49186, 49186, 1), +(49186, 51108, 2), +(49186, 51109, 3), + -- Frost Armor +(168, 168, 1), +(168, 7300, 2), +(168, 7301, 3), + -- Frost Channeling +(11160, 11160, 1), +(11160, 12518, 2), +(11160, 12519, 3), + -- Frost Nova +(122, 122, 1), +(122, 865, 2), +(122, 6131, 3), +(122, 10230, 4), +(122, 27088, 5), +(122, 42917, 6), + -- Frost Resistance Aura +(19888, 19888, 1), +(19888, 19897, 2), +(19888, 19898, 3), +(19888, 27152, 4), +(19888, 48945, 5), + -- Frost Resistance Totem +(8181, 8181, 1), +(8181, 10478, 2), +(8181, 10479, 3), +(8181, 25560, 4), +(8181, 58741, 5), +(8181, 58745, 6), + -- Frost Shock +(8056, 8056, 1), +(8056, 8058, 2), +(8056, 10472, 3), +(8056, 10473, 4), +(8056, 25464, 5), +(8056, 49235, 6), +(8056, 49236, 7), + -- Frost Ward +(6144, 6144, 1), +(6144, 8463, 2), +(6144, 8464, 3), +(6144, 10178, 4), +(6144, 27396, 5), +(6144, 32797, 6), + -- Frost Ward +(6143, 6143, 1), +(6143, 8461, 2), +(6143, 8462, 3), +(6143, 10177, 4), +(6143, 28609, 5), +(6143, 32796, 6), +(6143, 43012, 7), + -- Frost Warding +(11189, 11189, 1), +(11189, 28332, 2), + -- Frostbite +(11071, 11071, 1), +(11071, 12496, 2), +(11071, 12497, 3), + -- Frostbolt +(116, 116, 1), +(116, 205, 2), +(116, 837, 3), +(116, 7322, 4), +(116, 8406, 5), +(116, 8407, 6), +(116, 8408, 7), +(116, 10179, 8), +(116, 10180, 9), +(116, 10181, 10), +(116, 25304, 11), +(116, 27071, 12), +(116, 27072, 13), +(116, 38697, 14), +(116, 42841, 15), +(116, 42842, 16), + -- Frostbrand Weapon +(8033, 8033, 1), +(8033, 8038, 2), +(8033, 10456, 3), +(8033, 16355, 4), +(8033, 16356, 5), +(8033, 25500, 6), +(8033, 58794, 7), +(8033, 58795, 8), +(8033, 58796, 9), + -- Frostfire Bolt +(44614, 44614, 1), +(44614, 47610, 2), + -- Froststorm Breath +(54644, 54644, 1), +(54644, 55488, 2), +(54644, 55489, 3), +(54644, 55490, 4), +(54644, 55491, 5), +(54644, 55492, 6), + -- Frozen Core +(31667, 31667, 1), +(31667, 31668, 2), +(31667, 31669, 3), + -- Frozen Power +(63373, 63373, 1), +(63373, 63374, 2), + -- Furious Attacks +(46910, 46910, 1), +(46910, 46911, 2), + -- Furious Howl +(24604, 24604, 1), +(24604, 64491, 2), +(24604, 64492, 3), +(24604, 64493, 4), +(24604, 64494, 5), +(24604, 64495, 6), + -- Furor +(17056, 17056, 1), +(17056, 17058, 2), +(17056, 17059, 3), +(17056, 17060, 4), +(17056, 17061, 5), + -- Gag Order +(12311, 12311, 1), +(12311, 12958, 2), + -- Gale Winds +(48488, 48488, 1), +(48488, 48514, 2), + -- Garrote +(703, 703, 1), +(703, 8631, 2), +(703, 8632, 3), +(703, 8633, 4), +(703, 11289, 5), +(703, 11290, 6), +(703, 26839, 7), +(703, 26884, 8), +(703, 48675, 9), +(703, 48676, 10), + -- Genesis +(57810, 57810, 1), +(57810, 57811, 2), +(57810, 57812, 3), +(57810, 57813, 4), +(57810, 57814, 5), + -- Gift of Nature +(17104, 17104, 1), +(17104, 24943, 2), +(17104, 24944, 3), +(17104, 24945, 4), +(17104, 24946, 5), + -- Gift of the Earthmother +(51179, 51179, 1), +(51179, 51180, 2), +(51179, 51181, 3), +(51179, 51182, 4), +(51179, 51183, 5), + -- Gift of the Wild +(21849, 21849, 1), +(21849, 21850, 2), +(21849, 26991, 3), +(21849, 48470, 4), + -- Glacier Rot +(49471, 49471, 1), +(49471, 49790, 2), +(49471, 49791, 3), + -- Go for the Throat +(34952, 34952, 1), +(34952, 34953, 2), + -- Go for the Throat +(34950, 34950, 1), +(34950, 34954, 2), + -- Gore +(35299, 35299, 1), +(35299, 35300, 2), +(35299, 35302, 3), +(35299, 35303, 4), +(35299, 35304, 5), +(35299, 35305, 6), +(35299, 35306, 7), +(35299, 35307, 8), +(35299, 35308, 9), + -- Gore +(35290, 35290, 1), +(35290, 35291, 2), +(35290, 35292, 3), +(35290, 35293, 4), +(35290, 35294, 5), +(35290, 35295, 6), + -- Grace +(47516, 47516, 1), +(47516, 47517, 2), + -- Grace of the Mantis +(53450, 53450, 1), +(53450, 53451, 2), + -- Great Resistance +(53427, 53427, 1), +(53427, 53429, 2), +(53427, 53430, 3), + -- Great Stamina +(4195, 4195, 1), +(4195, 4196, 2), +(4195, 4197, 3), +(4195, 4198, 4), +(4195, 4199, 5), +(4195, 4200, 6), +(4195, 4201, 7), +(4195, 4202, 8), +(4195, 5048, 9), +(4195, 5049, 10), +(4195, 27364, 11), + -- Great Stamina +(61686, 61686, 1), +(61686, 61687, 2), +(61686, 61688, 3), + -- Greater Blessing of Might +(25782, 25782, 1), +(25782, 25916, 2), +(25782, 27141, 3), +(25782, 48933, 4), +(25782, 48934, 5), + -- Greater Blessing of Wisdom +(25894, 25894, 1), +(25894, 25918, 2), +(25894, 27143, 3), +(25894, 48937, 4), +(25894, 48938, 5), + -- Greater Heal +(2060, 2060, 1), +(2060, 10963, 2), +(2060, 10964, 3), +(2060, 10965, 4), +(2060, 25314, 5), +(2060, 25210, 6), +(2060, 25213, 7), +(2060, 48062, 8), +(2060, 48063, 9), + -- Grim Reach +(18218, 18218, 1), +(18218, 18219, 2), + -- Growl +(1853, 1853, 1), +(1853, 14922, 2), +(1853, 14923, 3), +(1853, 14924, 4), +(1853, 14925, 5), +(1853, 14926, 6), +(1853, 14927, 7), +(1853, 27344, 8), + -- Growl +(2649, 2649, 1), +(2649, 14916, 2), +(2649, 14917, 3), +(2649, 14918, 4), +(2649, 14919, 5), +(2649, 14920, 6), +(2649, 14921, 7), +(2649, 27047, 8), +(2649, 61676, 9), + -- Guard Dog +(53178, 53178, 1), +(53178, 53179, 2), + -- Guarded by the Light +(53583, 53583, 1), +(53583, 53585, 2), + -- Guardian Totems +(16258, 16258, 1), +(16258, 16293, 2), + -- Guardian's Favor +(20174, 20174, 1), +(20174, 20175, 2), + -- Guile of Gorefiend +(50187, 50187, 1), +(50187, 50190, 2), +(50187, 50191, 3), + -- Hack and Slash +(13960, 13960, 1), +(13960, 13961, 2), +(13960, 13962, 3), +(13960, 13963, 4), +(13960, 13964, 5), + -- Hammer of Justice +(853, 853, 1), +(853, 5588, 2), +(853, 5589, 3), +(853, 10308, 4), + -- Hammer of Wrath +(24275, 24275, 1), +(24275, 24274, 2), +(24275, 24239, 3), +(24275, 27180, 4), +(24275, 48805, 5), +(24275, 48806, 6), + -- Hand of Protection +(1022, 1022, 1), +(1022, 5599, 2), +(1022, 10278, 3), + -- Haunt +(48181, 48181, 1), +(48181, 59161, 2), +(48181, 59163, 3), +(48181, 59164, 4), + -- Hawk Eye +(19498, 19498, 1), +(19498, 19499, 2), +(19498, 19500, 3), + -- Heal +(2054, 2054, 1), +(2054, 2055, 2), +(2054, 6063, 3), +(2054, 6064, 4), + -- Healing Focus +(14913, 14913, 1), +(14913, 15012, 2), + -- Healing Focus +(16181, 16181, 1), +(16181, 16230, 2), +(16181, 16232, 3), + -- Healing Grace +(29187, 29187, 1), +(29187, 29189, 2), +(29187, 29191, 3), + -- Healing Light +(20237, 20237, 1), +(20237, 20238, 2), +(20237, 20239, 3), + -- Healing Prayers +(14911, 14911, 1), +(14911, 15018, 2), + -- Healing Stream Totem +(5394, 5394, 1), +(5394, 6375, 2), +(5394, 6377, 3), +(5394, 10462, 4), +(5394, 10463, 5), +(5394, 25567, 6), +(5394, 58755, 7), +(5394, 58756, 8), +(5394, 58757, 9), + -- Healing Touch +(5185, 5185, 1), +(5185, 5186, 2), +(5185, 5187, 3), +(5185, 5188, 4), +(5185, 5189, 5), +(5185, 6778, 6), +(5185, 8903, 7), +(5185, 9758, 8), +(5185, 9888, 9), +(5185, 9889, 10), +(5185, 25297, 11), +(5185, 26978, 12), +(5185, 26979, 13), +(5185, 48377, 14), +(5185, 48378, 15), + -- Healing Wave +(331, 331, 1), +(331, 332, 2), +(331, 547, 3), +(331, 913, 4), +(331, 939, 5), +(331, 959, 6), +(331, 8005, 7), +(331, 10395, 8), +(331, 10396, 9), +(331, 25357, 10), +(331, 25391, 11), +(331, 25396, 12), +(331, 49272, 13), +(331, 49273, 14), + -- Healing Way +(29206, 29206, 1), +(29206, 29205, 2), +(29206, 29202, 3), + -- Health Funnel +(755, 755, 1), +(755, 3698, 2), +(755, 3699, 3), +(755, 3700, 4), +(755, 11693, 5), +(755, 11694, 6), +(755, 11695, 7), +(755, 27259, 8), +(755, 47856, 9), + -- Heart of the Crusader +(21183, 21183, 1), +(21183, 54498, 2), +(21183, 54499, 3), + -- Heart of the Crusader +(20335, 20335, 1), +(20335, 20336, 2), +(20335, 20337, 3), + -- Heart of the Wild +(17003, 17003, 1), +(17003, 17004, 2), +(17003, 17005, 3), +(17003, 17006, 4), +(17003, 24894, 5), + -- Heart Strike +(55050, 55050, 1), +(55050, 55258, 2), +(55050, 55259, 3), +(55050, 55260, 4), +(55050, 55261, 5), +(55050, 55262, 6), + -- Heightened Senses +(30894, 30894, 1), +(30894, 30895, 2), + -- Hellfire +(1949, 1949, 1), +(1949, 11683, 2), +(1949, 11684, 3), +(1949, 27213, 4), +(1949, 47823, 5), + -- Hellfire Effect +(5857, 5857, 1), +(5857, 11681, 2), +(5857, 11682, 3), +(5857, 27214, 4), +(5857, 47822, 5), + -- Hemorrhage +(16511, 16511, 1), +(16511, 17347, 2), +(16511, 17348, 3), +(16511, 26864, 4), +(16511, 48660, 5), + -- Herb Gathering +(2366, 2366, 1), +(2366, 2368, 2), +(2366, 3570, 3), +(2366, 11993, 4), +(2366, 28695, 5), +(2366, 50300, 6), + -- Heroic Strike +(78, 78, 1), +(78, 284, 2), +(78, 285, 3), +(78, 1608, 4), +(78, 11564, 5), +(78, 11565, 6), +(78, 11566, 7), +(78, 11567, 8), +(78, 25286, 9), +(78, 29707, 10), +(78, 30324, 11), +(78, 47449, 12), +(78, 47450, 13), + -- Hibernate +(2637, 2637, 1), +(2637, 18657, 2), +(2637, 18658, 3), + -- Holy Concentration +(34753, 34753, 1), +(34753, 34859, 2), +(34753, 34860, 3), + -- Holy Fire +(14914, 14914, 1), +(14914, 15262, 2), +(14914, 15263, 3), +(14914, 15264, 4), +(14914, 15265, 5), +(14914, 15266, 6), +(14914, 15267, 7), +(14914, 15261, 8), +(14914, 25384, 9), +(14914, 48134, 10), +(14914, 48135, 11), + -- Holy Guidance +(31837, 31837, 1), +(31837, 31838, 2), +(31837, 31839, 3), +(31837, 31840, 4), +(31837, 31841, 5), + -- Holy Light +(635, 635, 1), +(635, 639, 2), +(635, 647, 3), +(635, 1026, 4), +(635, 1042, 5), +(635, 3472, 6), +(635, 10328, 7), +(635, 10329, 8), +(635, 25292, 9), +(635, 27135, 10), +(635, 27136, 11), +(635, 48781, 12), +(635, 48782, 13), + -- Holy Power +(5923, 5923, 1), +(5923, 5924, 2), +(5923, 5925, 3), +(5923, 5926, 4), +(5923, 25829, 5), + -- Holy Reach +(27789, 27789, 1), +(27789, 27790, 2), + -- Holy Shield +(20925, 20925, 1), +(20925, 20927, 2), +(20925, 20928, 3), +(20925, 27179, 4), +(20925, 48951, 5), +(20925, 48952, 6), + -- Holy Specialization +(14889, 14889, 1), +(14889, 15008, 2), +(14889, 15009, 3), +(14889, 15010, 4), +(14889, 15011, 5), + -- Holy Wrath +(2812, 2812, 1), +(2812, 10318, 2), +(2812, 27139, 3), +(2812, 48816, 4), +(2812, 48817, 5), + -- Honor Among Thieves +(51698, 51698, 1), +(51698, 51700, 2), +(51698, 51701, 3), + -- Horn of Winter +(57330, 57330, 1), +(57330, 57623, 2), + -- Hot Streak +(44445, 44445, 1), +(44445, 44446, 2), +(44445, 44448, 3), + -- Howl of Terror +(5484, 5484, 1), +(5484, 17928, 2), + -- Howling Blast +(49184, 49184, 1), +(49184, 51409, 2), +(49184, 51410, 3), +(49184, 51411, 4), + -- Hunter vs. Wild +(56339, 56339, 1), +(56339, 56340, 2), +(56339, 56341, 3), + -- Hunter's Mark +(1130, 1130, 1), +(1130, 14323, 2), +(1130, 14324, 3), +(1130, 14325, 4), +(1130, 53338, 5), + -- Hunting Party +(53290, 53290, 1), +(53290, 53291, 2), +(53290, 53292, 3), + -- Ice Armor +(1214, 1214, 1), +(1214, 1228, 2), +(1214, 10221, 3), +(1214, 10222, 4), +(1214, 27391, 5), + -- Ice Armor +(7302, 7302, 1), +(7302, 7320, 2), +(7302, 10219, 3), +(7302, 10220, 4), +(7302, 27124, 5), +(7302, 43008, 6), + -- Ice Barrier +(11426, 11426, 1), +(11426, 13031, 2), +(11426, 13032, 3), +(11426, 13033, 4), +(11426, 27134, 5), +(11426, 33405, 6), +(11426, 43038, 7), +(11426, 43039, 8), + -- Ice Floes +(31670, 31670, 1), +(31670, 31672, 2), +(31670, 55094, 3), + -- Ice Lance +(30455, 30455, 1), +(30455, 42913, 2), +(30455, 42914, 3), + -- Ice Shards +(11207, 11207, 1), +(11207, 12672, 2), +(11207, 15047, 3), + -- Icy Reach +(55061, 55061, 1), +(55061, 55062, 2), + -- Icy Talons +(50880, 50880, 1), +(50880, 50884, 2), +(50880, 50885, 3), +(50880, 50886, 4), +(50880, 50887, 5), + -- Ignite +(11119, 11119, 1), +(11119, 11120, 2), +(11119, 12846, 3), +(11119, 12847, 4), +(11119, 12848, 5), + -- Illumination +(20210, 20210, 1), +(20210, 20212, 2), +(20210, 20213, 3), +(20210, 20214, 4), +(20210, 20215, 5), + -- Immolate +(348, 348, 1), +(348, 707, 2), +(348, 1094, 3), +(348, 2941, 4), +(348, 11665, 5), +(348, 11667, 6), +(348, 11668, 7), +(348, 25309, 8), +(348, 27215, 9), +(348, 47810, 10), +(348, 47811, 11), + -- Impale +(16493, 16493, 1), +(16493, 16494, 2), + -- Improved Ambush +(14079, 14079, 1), +(14079, 14080, 2), + -- Improved Arcane Shot +(19454, 19454, 1), +(19454, 19455, 2), +(19454, 19456, 3), + -- Improved Aspect of the Hawk +(19552, 19552, 1), +(19552, 19553, 2), +(19552, 19554, 3), +(19552, 19555, 4), +(19552, 19556, 5), + -- Improved Aspect of the Monkey +(19549, 19549, 1), +(19549, 19550, 2), +(19549, 19551, 3), + -- Improved Barkskin +(63410, 63410, 1), +(63410, 63411, 2), + -- Improved Barrage +(35104, 35104, 1), +(35104, 35110, 2), +(35104, 35111, 3), + -- Improved Berserker Rage +(20500, 20500, 1), +(20500, 20501, 2), + -- Improved Berserker Stance +(29759, 29759, 1), +(29759, 29760, 2), +(29759, 29761, 3), +(29759, 29762, 4), +(29759, 29763, 5), + -- Improved Blessing of Might +(20042, 20042, 1), +(20042, 20045, 2), + -- Improved Blessing of Salvation +(20194, 20194, 1), +(20194, 20195, 2), + -- Improved Blessing of Wisdom +(20244, 20244, 1), +(20244, 20245, 2), + -- Improved Blink +(31569, 31569, 1), +(31569, 31570, 2), + -- Improved Blizzard +(11185, 11185, 1), +(11185, 12487, 2), +(11185, 12488, 3), + -- Improved Blood Presence +(50365, 50365, 1), +(50365, 50371, 2), + -- Improved Bloodrage +(12301, 12301, 1), +(12301, 12818, 2), + -- Improved Chain Heal +(30872, 30872, 1), +(30872, 30873, 2), + -- Improved Challenging Shout +(12327, 12327, 1), +(12327, 12886, 2), + -- Improved Charge +(12285, 12285, 1), +(12285, 12697, 2), + -- Improved Cleave +(12329, 12329, 1), +(12329, 12950, 2), +(12329, 20496, 3), + -- Improved Concentration Aura +(20254, 20254, 1), +(20254, 20255, 2), +(20254, 20256, 3), + -- Improved Concussive Shot +(19407, 19407, 1), +(19407, 19412, 2), + -- Improved Cone of Cold +(11190, 11190, 1), +(11190, 12489, 2), +(11190, 12490, 3), + -- Improved Corpse Explosion +(49601, 49601, 1), +(49601, 49602, 2), + -- Improved Corruption +(17810, 17810, 1), +(17810, 17811, 2), +(17810, 17812, 3), +(17810, 17813, 4), +(17810, 17814, 5), + -- Improved Counterspell +(11255, 11255, 1), +(11255, 12598, 2), + -- Improved Cower +(53180, 53180, 1), +(53180, 53181, 2), + -- Improved Curse of Agony +(18827, 18827, 1), +(18827, 18829, 2), + -- Improved Curse of Weakness +(18179, 18179, 1), +(18179, 18180, 2), + -- Improved Death Coil +(30049, 30049, 1), +(30049, 30051, 2), +(30049, 30052, 3), + -- Improved Defensive Stance +(29593, 29593, 1), +(29593, 29594, 2), + -- Improved Demonic Tactics +(54347, 54347, 1), +(54347, 54348, 2), +(54347, 54349, 3), + -- Improved Demoralizing Shout +(12324, 12324, 1), +(12324, 12876, 2), +(12324, 12877, 3), +(12324, 12878, 4), +(12324, 12879, 5), + -- Improved Devotion Aura +(20138, 20138, 1), +(20138, 20139, 2), +(20138, 20140, 3), + -- Improved Devouring Plague +(63625, 63625, 1), +(63625, 63626, 2), +(63625, 63627, 3), + -- Improved Disarm +(12313, 12313, 1), +(12313, 12804, 2), + -- Improved Disciplines +(12312, 12312, 1), +(12312, 12803, 2), + -- Improved Drain Soul +(18213, 18213, 1), +(18213, 18372, 2), + -- Improved Earth Shield +(51560, 51560, 1), +(51560, 51561, 2), + -- Improved Eviscerate +(14162, 14162, 1), +(14162, 14163, 2), +(14162, 14164, 3), + -- Improved Execute +(20502, 20502, 1), +(20502, 20503, 2), + -- Improved Expose Armor +(14168, 14168, 1), +(14168, 14169, 2), + -- Improved Eyes of the Beast +(19557, 19557, 1), +(19557, 19558, 2), + -- Improved Faerie Fire +(33600, 33600, 1), +(33600, 33601, 2), +(33600, 33602, 3), + -- Improved Fear +(53754, 53754, 1), +(53754, 53759, 2), + -- Improved Felhunter +(54037, 54037, 1), +(54037, 54038, 2), + -- Improved Fire Blast +(11078, 11078, 1), +(11078, 11080, 2), + -- Improved Fire Nova +(16086, 16086, 1), +(16086, 16544, 2), + -- Improved Fireball +(11069, 11069, 1), +(11069, 12338, 2), +(11069, 12339, 3), +(11069, 12340, 4), +(11069, 12341, 5), + -- Improved Flash of Light +(20249, 20249, 1), +(20249, 20250, 2), +(20249, 20251, 3), + -- Improved Frost Presence +(50384, 50384, 1), +(50384, 50385, 2), + -- Improved Frostbolt +(11070, 11070, 1), +(11070, 12473, 2), +(11070, 16763, 3), +(11070, 16765, 4), +(11070, 16766, 5), + -- Improved Ghost Wolf +(16262, 16262, 1), +(16262, 16287, 2), + -- Improved Gouge +(13741, 13741, 1), +(13741, 13793, 2), +(13741, 13792, 3), + -- Improved Hammer of Justice +(20487, 20487, 1), +(20487, 20488, 2), + -- Improved Hamstring +(12289, 12289, 1), +(12289, 12668, 2), +(12289, 23695, 3), + -- Improved Healing +(14912, 14912, 1), +(14912, 15013, 2), +(14912, 15014, 3), + -- Improved Healing Wave +(16182, 16182, 1), +(16182, 16226, 2), +(16182, 16227, 3), +(16182, 16228, 4), +(16182, 16229, 5), + -- Improved Health Funnel +(18703, 18703, 1), +(18703, 18704, 2), + -- Improved Healthstone +(18692, 18692, 1), +(18692, 18693, 2), + -- Improved Heroic Strike +(12282, 12282, 1), +(12282, 12663, 2), +(12282, 12664, 3), + -- Improved Howl of Terror +(30054, 30054, 1), +(30054, 30057, 2), + -- Improved Hunter's Mark +(19421, 19421, 1), +(19421, 19422, 2), +(19421, 19423, 3), + -- Improved Icy Touch +(49175, 49175, 1), +(49175, 50031, 2), +(49175, 51456, 3), + -- Improved Immolate +(17815, 17815, 1), +(17815, 17833, 2), +(17815, 17834, 3), + -- Improved Imp +(18694, 18694, 1), +(18694, 18695, 2), +(18694, 18696, 3), + -- Improved Inner Fire +(14747, 14747, 1), +(14747, 14770, 2), +(14747, 14771, 3), + -- Improved Inner Rage +(12325, 12325, 1), +(12325, 12863, 2), +(12325, 12864, 3), +(12325, 12865, 4), +(12325, 12866, 5), + -- Improved Insect Swarm +(57849, 57849, 1), +(57849, 57850, 2), +(57849, 57851, 3), + -- Improved Intercept +(29888, 29888, 1), +(29888, 29889, 2), + -- Improved Intimidating Shout +(19870, 19870, 1), +(19870, 19871, 2), + -- Improved Judgements +(25956, 25956, 1), +(25956, 25957, 2), + -- Improved Kick +(13754, 13754, 1), +(13754, 13867, 2), + -- Improved Kidney Shot +(14174, 14174, 1), +(14174, 14175, 2), +(14174, 14176, 3), + -- Improved Lay on Hands +(20234, 20234, 1), +(20234, 20235, 2), + -- Improved Leader of the Pack +(34297, 34297, 1), +(34297, 34300, 2), + -- Improved Life Tap +(18182, 18182, 1), +(18182, 18183, 2), + -- Improved Mana Burn +(14750, 14750, 1), +(14750, 14772, 2), + -- Improved Mangle +(48532, 48532, 1), +(48532, 48489, 2), +(48532, 48491, 3), + -- Improved Mark of the Wild +(17050, 17050, 1), +(17050, 17051, 2), + -- Improved Mind Blast +(15273, 15273, 1), +(15273, 15312, 2), +(15273, 15313, 3), +(15273, 15314, 4), +(15273, 15316, 5), + -- Improved Moonfire +(16821, 16821, 1), +(16821, 16822, 2), + -- Improved Moonkin Form +(50170, 50170, 1), +(50170, 50171, 2), +(50170, 50172, 3), + -- Improved Moonkin Form +(48384, 48384, 1), +(48384, 48395, 2), +(48384, 48396, 3), + -- Improved Mortal Strike +(35446, 35446, 1), +(35446, 35448, 2), +(35446, 35449, 3), + -- Improved Overpower +(12290, 12290, 1), +(12290, 12963, 2), + -- Improved Poisons +(14113, 14113, 1), +(14113, 14114, 2), +(14113, 14115, 3), +(14113, 14116, 4), +(14113, 14117, 5), + -- Improved Power Word: Fortitude +(14749, 14749, 1), +(14749, 14767, 2), + -- Improved Power Word: Shield +(14748, 14748, 1), +(14748, 14768, 2), +(14748, 14769, 3), + -- Improved Psychic Scream +(15392, 15392, 1), +(15392, 15448, 2), + -- Improved Reincarnation +(16184, 16184, 1), +(16184, 16209, 2), + -- Improved Rejuvenation +(17111, 17111, 1), +(17111, 17112, 2), +(17111, 17113, 3), + -- Improved Rend +(12286, 12286, 1), +(12286, 12658, 2), + -- Improved Renew +(14908, 14908, 1), +(14908, 15020, 2), +(14908, 17191, 3), + -- Improved Revenge +(12797, 12797, 1), +(12797, 12799, 2), + -- Improved Revive Pet +(24443, 24443, 1), +(24443, 19575, 2), + -- Improved Righteous Fury +(20468, 20468, 1), +(20468, 20469, 2), +(20468, 20470, 3), + -- Improved Rune Tap +(48985, 48985, 1), +(48985, 49488, 2), +(48985, 49489, 3), + -- Improved Scorch +(11095, 11095, 1), +(11095, 12872, 2), +(11095, 12873, 3), + -- Improved Scorpid Sting +(19491, 19491, 1), +(19491, 19493, 2), +(19491, 19494, 3), + -- Improved Searing Pain +(17927, 17927, 1), +(17927, 17929, 2), +(17927, 17930, 3), + -- Improved Shadow Bolt +(17793, 17793, 1), +(17793, 17796, 2), +(17793, 17801, 3), +(17793, 17802, 4), +(17793, 17803, 5), + -- Improved Shadow Word: Pain +(15275, 15275, 1), +(15275, 15317, 2), + -- Improved Shadowform +(47569, 47569, 1), +(47569, 47570, 2), + -- Improved Shields +(16261, 16261, 1), +(16261, 16290, 2), +(16261, 51881, 3), + -- Improved Sinister Strike +(13732, 13732, 1), +(13732, 13863, 2), + -- Improved Slam +(12862, 12862, 1), +(12862, 12330, 2), + -- Improved Slice and Dice +(14165, 14165, 1), +(14165, 14166, 2), + -- Improved Soul Leech +(54117, 54117, 1), +(54117, 54118, 2), + -- Improved Spell Reflection +(59088, 59088, 1), +(59088, 59089, 2), + -- Improved Spirit Tap +(49694, 49694, 1), +(49694, 59000, 2), + -- Improved Spirit Tap +(15337, 15337, 1), +(15337, 15338, 2), + -- Improved Sprint +(13743, 13743, 1), +(13743, 13875, 2), + -- Improved Steady Shot +(53221, 53221, 1), +(53221, 53222, 2), +(53221, 53224, 3), + -- Improved Stings +(19464, 19464, 1), +(19464, 19465, 2), +(19464, 19466, 3), + -- Improved Stormstrike +(51521, 51521, 1), +(51521, 51522, 2), + -- Improved Succubus +(18754, 18754, 1), +(18754, 18755, 2), +(18754, 18756, 3), + -- Improved Thunder Clap +(12287, 12287, 1), +(12287, 12665, 2), +(12287, 12666, 3), + -- Improved Tracking +(52783, 52783, 1), +(52783, 52785, 2), +(52783, 52786, 3), +(52783, 52787, 4), +(52783, 52788, 5), + -- Improved Tranquility +(17123, 17123, 1), +(17123, 17124, 2), + -- Improved Tree of Life +(48535, 48535, 1), +(48535, 48536, 2), +(48535, 48537, 3), + -- Improved Unholy Presence +(50391, 50391, 1), +(50391, 50392, 2), + -- Improved Vampiric Embrace +(27839, 27839, 1), +(27839, 27840, 2), + -- Improved Water Shield +(16180, 16180, 1), +(16180, 16196, 2), +(16180, 16198, 3), + -- Improved Whirlwind +(29721, 29721, 1), +(29721, 29776, 2), + -- Improved Windfury Totem +(29192, 29192, 1), +(29192, 29193, 2), + -- Impurity +(49220, 49220, 1), +(49220, 49633, 2), +(49220, 49635, 3), +(49220, 49636, 4), +(49220, 49638, 5), + -- Incanter's Absorption +(44394, 44394, 1), +(44394, 44395, 2), +(44394, 44396, 3), + -- Incinerate +(29722, 29722, 1), +(29722, 32231, 2), +(29722, 47837, 3), +(29722, 47838, 4), + -- Incineration +(18459, 18459, 1), +(18459, 18460, 2), +(18459, 54734, 3), + -- Incite +(50685, 50685, 1), +(50685, 50686, 2), +(50685, 50687, 3), + -- Infected Wounds +(48483, 48483, 1), +(48483, 48484, 2), +(48483, 48485, 3), + -- Infectious Poisons +(51630, 51630, 1), +(51630, 51631, 2), + -- Inner Fire +(588, 588, 1), +(588, 7128, 2), +(588, 602, 3), +(588, 1006, 4), +(588, 10951, 5), +(588, 10952, 6), +(588, 25431, 7), +(588, 48040, 8), +(588, 48168, 9), + -- Inscription +(45357, 45357, 1), +(45357, 45358, 2), +(45357, 45359, 3), +(45357, 45360, 4), +(45357, 45361, 5), +(45357, 45363, 6), + -- Insect Swarm +(5570, 5570, 1), +(5570, 24974, 2), +(5570, 24975, 3), +(5570, 24976, 4), +(5570, 24977, 5), +(5570, 27013, 6), +(5570, 48468, 7), + -- Inspiration +(14893, 14893, 1), +(14893, 15357, 2), +(14893, 15359, 3), + -- Inspiration +(14892, 14892, 1), +(14892, 15362, 2), +(14892, 15363, 3), + -- Intensify Rage +(46908, 46908, 1), +(46908, 46909, 2), +(46908, 56924, 3), + -- Intensity +(17080, 17080, 1), +(17080, 35358, 2), +(17080, 35359, 3), + -- Intensity +(17106, 17106, 1), +(17106, 17107, 2), +(17106, 17108, 3), + -- Intensity +(18135, 18135, 1), +(18135, 18136, 2), + -- Invigoration +(53252, 53252, 1), +(53252, 53253, 2), + -- Iron Will +(12300, 12300, 1), +(12300, 12959, 2), +(12300, 12960, 3), + -- Jewelcrafting +(25229, 25229, 1), +(25229, 25230, 2), +(25229, 28894, 3), +(25229, 28895, 4), +(25229, 28897, 5), +(25229, 51311, 6), + -- Judgements of the Just +(53695, 53695, 1), +(53695, 53696, 2), + -- Judgements of the Wise +(31876, 31876, 1), +(31876, 31877, 2), +(31876, 31878, 3), + -- Khadgar's Unlocking +(491, 491, 1), +(491, 857, 2), +(491, 10165, 3), +(491, 10166, 4), + -- Kidney Shot +(408, 408, 1), +(408, 8643, 2), + -- Kill Shot +(53351, 53351, 1), +(53351, 61005, 2), +(53351, 61006, 3), + -- Killer Instinct +(19370, 19370, 1), +(19370, 19371, 2), +(19370, 19373, 3), + -- Killing Machine +(51123, 51123, 1), +(51123, 51127, 2), +(51123, 51128, 3), +(51123, 51129, 4), +(51123, 51130, 5), + -- Kindling Soul +(47426, 47426, 1), +(47426, 47427, 2), + -- Kindling Soul +(47261, 47261, 1), +(47261, 47262, 2), + -- Kindred Spirits +(56314, 56314, 1), +(56314, 56315, 2), +(56314, 56316, 3), +(56314, 56317, 4), +(56314, 56318, 5), + -- King of the Jungle +(48492, 48492, 1), +(48492, 48494, 2), +(48492, 48495, 3), + -- Lacerate +(33745, 33745, 1), +(33745, 48567, 2), +(33745, 48568, 3), + -- Lash of Pain +(7814, 7814, 1), +(7814, 7815, 2), +(7814, 7816, 3), +(7814, 11778, 4), +(7814, 11779, 5), +(7814, 11780, 6), +(7814, 27274, 7), +(7814, 47991, 8), +(7814, 47992, 9), + -- Lava Breath +(58604, 58604, 1), +(58604, 58607, 2), +(58604, 58608, 3), +(58604, 58609, 4), +(58604, 58610, 5), +(58604, 58611, 6), + -- Lava Burst +(51505, 51505, 1), +(51505, 60043, 2), + -- Lava Flows +(51480, 51480, 1), +(51480, 51481, 2), +(51480, 51482, 3), + -- Lay on Hands +(633, 633, 1), +(633, 2800, 2), +(633, 10310, 3), +(633, 27154, 4), +(633, 48788, 5), + -- Leatherworking +(2108, 2108, 1), +(2108, 3104, 2), +(2108, 3811, 3), +(2108, 10662, 4), +(2108, 32549, 5), +(2108, 51302, 6), + -- Lesser Heal +(2050, 2050, 1), +(2050, 2052, 2), +(2050, 2053, 3), + -- Lesser Healing Wave +(8004, 8004, 1), +(8004, 8008, 2), +(8004, 8010, 3), +(8004, 10466, 4), +(8004, 10467, 5), +(8004, 10468, 6), +(8004, 25420, 7), +(8004, 49275, 8), +(8004, 49276, 9), + -- Lethal Shots +(19426, 19426, 1), +(19426, 19427, 2), +(19426, 19429, 3), +(19426, 19430, 4), +(19426, 19431, 5), + -- Lethality +(14128, 14128, 1), +(14128, 14132, 2), +(14128, 14135, 3), +(14128, 14136, 4), +(14128, 14137, 5), + -- Life Tap +(1454, 1454, 1), +(1454, 1455, 2), +(1454, 1456, 3), +(1454, 11687, 4), +(1454, 11688, 5), +(1454, 11689, 6), +(1454, 27222, 7), +(1454, 57946, 8), + -- Lifeblood +(55428, 55428, 1), +(55428, 55480, 2), +(55428, 55500, 3), +(55428, 55501, 4), +(55428, 55502, 5), +(55428, 55503, 6), + -- Lifebloom +(33763, 33763, 1), +(33763, 48450, 2), +(33763, 48451, 3), + -- Lightning Breath +(24845, 24845, 1), +(24845, 25013, 2), +(24845, 25014, 3), +(24845, 25015, 4), +(24845, 25016, 5), +(24845, 25017, 6), + -- Lightning Breath +(24844, 24844, 1), +(24844, 25008, 2), +(24844, 25009, 3), +(24844, 25010, 4), +(24844, 25011, 5), +(24844, 25012, 6), + -- Lightning Mastery +(16578, 16578, 1), +(16578, 16579, 2), +(16578, 16580, 3), +(16578, 16581, 4), +(16578, 16582, 5), + -- Lightning Overload +(30675, 30675, 1), +(30675, 30678, 2), +(30675, 30679, 3), + -- Lightning Reflexes +(13712, 13712, 1), +(13712, 13788, 2), +(13712, 13789, 3), + -- Lightning Reflexes +(19168, 19168, 1), +(19168, 19180, 2), +(19168, 19181, 3), +(19168, 24296, 4), +(19168, 24297, 5), + -- Light's Grace +(31833, 31833, 1), +(31833, 31835, 2), +(31833, 31836, 3), + -- Lightwell +(724, 724, 1), +(724, 27870, 2), +(724, 27871, 3), +(724, 28275, 4), +(724, 48086, 5), +(724, 48087, 6), + -- Lightwell Renew +(7001, 7001, 1), +(7001, 27873, 2), +(7001, 27874, 3), +(7001, 28276, 4), +(7001, 48084, 5), +(7001, 48085, 6), + -- Lionhearted +(53409, 53409, 1), +(53409, 53411, 2), + -- Living Seed +(48496, 48496, 1), +(48496, 48499, 2), +(48496, 48500, 3), + -- Living Spirit +(34151, 34151, 1), +(34151, 34152, 2), +(34151, 34153, 3), + -- Lock and Load +(56342, 56342, 1), +(56342, 56343, 2), +(56342, 56344, 3), + -- Lockpicking +(1809, 1809, 1), +(1809, 1810, 2), +(1809, 6460, 3), + -- Longevity +(53262, 53262, 1), +(53262, 53263, 2), +(53262, 53264, 3), + -- Lunar Guidance +(33589, 33589, 1), +(33589, 33590, 2), +(33589, 33591, 3), + -- Mace Specialization +(13709, 13709, 1), +(13709, 13800, 2), +(13709, 13801, 3), +(13709, 13802, 4), +(13709, 13803, 5), + -- Maelstrom Weapon +(51528, 51528, 1), +(51528, 51529, 2), +(51528, 51530, 3), +(51528, 51531, 4), +(51528, 51532, 5), + -- Mage Armor +(6121, 6121, 1), +(6121, 22784, 2), +(6121, 22785, 3), +(6121, 27392, 4), + -- Mage Armor +(6117, 6117, 1), +(6117, 22782, 2), +(6117, 22783, 3), +(6117, 27125, 4), +(6117, 43023, 5), +(6117, 43024, 6), + -- Magic Absorption +(29441, 29441, 1), +(29441, 29444, 2), + -- Magic Attunement +(11247, 11247, 1), +(11247, 12606, 2), + -- Magic Suppression +(49224, 49224, 1), +(49224, 49610, 2), +(49224, 49611, 3), + -- Magma Totem +(8187, 8187, 1), +(8187, 10579, 2), +(8187, 10580, 3), +(8187, 10581, 4), +(8187, 25550, 5), +(8187, 58732, 6), +(8187, 58735, 7), + -- Magma Totem +(8190, 8190, 1), +(8190, 10585, 2), +(8190, 10586, 3), +(8190, 10587, 4), +(8190, 25552, 5), +(8190, 58731, 6), +(8190, 58734, 7), + -- Magma Totem Passive +(8188, 8188, 1), +(8188, 10582, 2), +(8188, 10583, 3), +(8188, 10584, 4), +(8188, 25551, 5), +(8188, 58733, 6), +(8188, 58736, 7), + -- Maim +(22570, 22570, 1), +(22570, 49802, 2), + -- Malediction +(32477, 32477, 1), +(32477, 32483, 2), +(32477, 32484, 3), + -- Malice +(14138, 14138, 1), +(14138, 14139, 2), +(14138, 14140, 3), +(14138, 14141, 4), +(14138, 14142, 5), + -- Mana Shield +(1481, 1481, 1), +(1481, 8496, 2), +(1481, 8497, 3), +(1481, 10194, 4), +(1481, 10195, 5), +(1481, 10196, 6), +(1481, 27398, 7), + -- Mana Shield +(1463, 1463, 1), +(1463, 8494, 2), +(1463, 8495, 3), +(1463, 10191, 4), +(1463, 10192, 5), +(1463, 10193, 6), +(1463, 27131, 7), +(1463, 43019, 8), +(1463, 43020, 9), + -- Mana Spring +(5677, 5677, 1), +(5677, 10491, 2), +(5677, 10493, 3), +(5677, 10494, 4), +(5677, 25569, 5), +(5677, 58775, 6), +(5677, 58776, 7), +(5677, 58777, 8), + -- Mana Spring Totem +(5675, 5675, 1), +(5675, 10495, 2), +(5675, 10496, 3), +(5675, 10497, 4), +(5675, 25570, 5), +(5675, 58771, 6), +(5675, 58773, 7), +(5675, 58774, 8), + -- Mangle (Bear) +(33878, 33878, 1), +(33878, 33986, 2), +(33878, 33987, 3), +(33878, 48563, 4), +(33878, 48564, 5), + -- Mangle (Cat) +(33876, 33876, 1), +(33876, 33982, 2), +(33876, 33983, 3), +(33876, 48565, 4), +(33876, 48566, 5), + -- Mark of the Wild +(1126, 1126, 1), +(1126, 5232, 2), +(1126, 6756, 3), +(1126, 5234, 4), +(1126, 8907, 5), +(1126, 9884, 6), +(1126, 9885, 7), +(1126, 26990, 8), +(1126, 48469, 9), + -- Marked for Death +(53241, 53241, 1), +(53241, 53243, 2), +(53241, 53244, 3), +(53241, 53245, 4), +(53241, 53246, 5), + -- Martyrdom +(14531, 14531, 1), +(14531, 14774, 2), + -- Master Conjuror +(18767, 18767, 1), +(18767, 18768, 2), + -- Master Healer +(14904, 14904, 1), +(14904, 15024, 2), +(14904, 15025, 3), +(14904, 15026, 4), +(14904, 15027, 5), + -- Master Marksman +(34485, 34485, 1), +(34485, 34486, 2), +(34485, 34487, 3), +(34485, 34488, 4), +(34485, 34489, 5), + -- Master of Anatomy +(53125, 53125, 1), +(53125, 53662, 2), +(53125, 53663, 3), +(53125, 53664, 4), +(53125, 53665, 5), +(53125, 53666, 6), + -- Master of Deception +(13958, 13958, 1), +(13958, 13970, 2), +(13958, 13971, 3), + -- Master of Elements +(29074, 29074, 1), +(29074, 29075, 2), +(29074, 29076, 3), + -- Master of Subtlety +(31221, 31221, 1), +(31221, 31222, 2), +(31221, 31223, 3), + -- Master Poisoner +(31226, 31226, 1), +(31226, 31227, 2), +(31226, 58410, 3), + -- Master Summoner +(18709, 18709, 1), +(18709, 18710, 2), + -- Maul +(6807, 6807, 1), +(6807, 6808, 2), +(6807, 6809, 3), +(6807, 8972, 4), +(6807, 9745, 5), +(6807, 9880, 6), +(6807, 9881, 7), +(6807, 26996, 8), +(6807, 48479, 9), +(6807, 48480, 10), + -- Meditation +(14521, 14521, 1), +(14521, 14776, 2), +(14521, 14777, 3), + -- Melee Specialization +(19381, 19381, 1), +(19381, 19382, 2), +(19381, 19383, 3), +(19381, 19384, 4), +(19381, 19385, 5), + -- Melted Mind +(58378, 58378, 1), +(58378, 58379, 2), + -- Mend Pet +(136, 136, 1), +(136, 3111, 2), +(136, 3661, 3), +(136, 3662, 4), +(136, 13542, 5), +(136, 13543, 6), +(136, 13544, 7), +(136, 27046, 8), +(136, 48989, 9), +(136, 48990, 10), + -- Mental Agility +(14520, 14520, 1), +(14520, 14780, 2), +(14520, 14781, 3), + -- Mental Dexterity +(51883, 51883, 1), +(51883, 51884, 2), +(51883, 51885, 3), + -- Mental Quickness +(30812, 30812, 1), +(30812, 30813, 2), +(30812, 30814, 3), + -- Mental Strength +(18551, 18551, 1), +(18551, 18552, 2), +(18551, 18553, 3), +(18551, 18554, 4), +(18551, 18555, 5), + -- Merciless Combat +(49024, 49024, 1), +(49024, 49538, 2), + -- Might of Mograine +(49023, 49023, 1), +(49023, 49533, 2), +(49023, 49534, 3), + -- Mind Blast +(8092, 8092, 1), +(8092, 8102, 2), +(8092, 8103, 3), +(8092, 8104, 4), +(8092, 8105, 5), +(8092, 8106, 6), +(8092, 10945, 7), +(8092, 10946, 8), +(8092, 10947, 9), +(8092, 25372, 10), +(8092, 25375, 11), +(8092, 48126, 12), +(8092, 48127, 13), + -- Mind Flay +(15407, 15407, 1), +(15407, 17311, 2), +(15407, 17312, 3), +(15407, 17313, 4), +(15407, 17314, 5), +(15407, 18807, 6), +(15407, 25387, 7), +(15407, 48155, 8), +(15407, 48156, 9), + -- Mind Mastery +(31584, 31584, 1), +(31584, 31585, 2), +(31584, 31586, 3), +(31584, 31587, 4), +(31584, 31588, 5), + -- Mind Melt +(14910, 14910, 1), +(14910, 33371, 2), + -- Mind Vision +(2096, 2096, 1), +(2096, 10909, 2), + -- Mining +(2575, 2575, 1), +(2575, 2576, 2), +(2575, 3564, 3), +(2575, 10248, 4), +(2575, 29354, 5), +(2575, 50310, 6), + -- Missile Barrage +(44404, 44404, 1), +(44404, 54486, 2), +(44404, 54488, 3), +(44404, 54489, 4), +(44404, 54490, 5), + -- Molten Core +(47245, 47245, 1), +(47245, 47246, 2), +(47245, 47247, 3), + -- Molten Fury +(31679, 31679, 1), +(31679, 31680, 2), + -- Molten Shields +(11094, 11094, 1), +(11094, 13043, 2), + -- Mongoose Bite +(1495, 1495, 1), +(1495, 14269, 2), +(1495, 14270, 3), +(1495, 14271, 4), +(1495, 36916, 5), +(1495, 53339, 6), + -- Monstrous Bite +(54680, 54680, 1), +(54680, 55495, 2), +(54680, 55496, 3), +(54680, 55497, 4), +(54680, 55498, 5), +(54680, 55499, 6), + -- Moonfire +(8921, 8921, 1), +(8921, 8924, 2), +(8921, 8925, 3), +(8921, 8926, 4), +(8921, 8927, 5), +(8921, 8928, 6), +(8921, 8929, 7), +(8921, 9833, 8), +(8921, 9834, 9), +(8921, 9835, 10), +(8921, 26987, 11), +(8921, 26988, 12), +(8921, 48462, 13), +(8921, 48463, 14), + -- Moonfury +(16896, 16896, 1), +(16896, 16897, 2), +(16896, 16899, 3), + -- Moonglow +(16845, 16845, 1), +(16845, 16846, 2), +(16845, 16847, 3), + -- Morbidity +(48963, 48963, 1), +(48963, 49564, 2), +(48963, 49565, 3), + -- Mortal Shots +(19485, 19485, 1), +(19485, 19487, 2), +(19485, 19488, 3), +(19485, 19489, 4), +(19485, 19490, 5), + -- Mortal Strike +(12294, 12294, 1), +(12294, 21551, 2), +(12294, 21552, 3), +(12294, 21553, 4), +(12294, 25248, 5), +(12294, 30330, 6), +(12294, 47485, 7), +(12294, 47486, 8), + -- Multi-Shot +(2643, 2643, 1), +(2643, 14288, 2), +(2643, 14289, 3), +(2643, 14290, 4), +(2643, 25294, 5), +(2643, 27021, 6), +(2643, 49047, 7), +(2643, 49048, 8), + -- Murder +(14158, 14158, 1), +(14158, 14159, 2), + -- Mutilate +(1329, 1329, 1), +(1329, 34411, 2), +(1329, 34412, 3), +(1329, 34413, 4), +(1329, 48663, 5), +(1329, 48666, 6), + -- Natural Armor +(24547, 24547, 1), +(24547, 24556, 2), +(24547, 24557, 3), +(24547, 24558, 4), +(24547, 24559, 5), +(24547, 24560, 6), +(24547, 24561, 7), +(24547, 24562, 8), +(24547, 24631, 9), +(24547, 24632, 10), +(24547, 27362, 11), + -- Natural Armor +(61689, 61689, 1), +(61689, 61690, 2), + -- Natural Perfection +(45281, 45281, 1), +(45281, 45282, 2), +(45281, 45283, 3), + -- Natural Perfection +(33881, 33881, 1), +(33881, 33882, 2), +(33881, 33883, 3), + -- Natural Reaction +(57878, 57878, 1), +(57878, 57880, 2), +(57878, 57881, 3), + -- Natural Shapeshifter +(16833, 16833, 1), +(16833, 16834, 2), +(16833, 16835, 3), + -- Naturalist +(17069, 17069, 1), +(17069, 17070, 2), +(17069, 17071, 3), +(17069, 17072, 4), +(17069, 17073, 5), + -- Nature Resistance Totem +(10595, 10595, 1), +(10595, 10600, 2), +(10595, 10601, 3), +(10595, 25574, 4), +(10595, 58746, 5), +(10595, 58749, 6), + -- Nature's Blessing +(30867, 30867, 1), +(30867, 30868, 2), +(30867, 30869, 3), + -- Nature's Bounty +(17074, 17074, 1), +(17074, 17075, 2), +(17074, 17076, 3), +(17074, 17077, 4), +(17074, 17078, 5), + -- Nature's Focus +(17063, 17063, 1), +(17063, 17065, 2), +(17063, 17066, 3), + -- Nature's Grasp +(16689, 16689, 1), +(16689, 16810, 2), +(16689, 16811, 3), +(16689, 16812, 4), +(16689, 16813, 5), +(16689, 17329, 6), +(16689, 27009, 7), +(16689, 53312, 8), + -- Nature's Guardian +(30881, 30881, 1), +(30881, 30883, 2), +(30881, 30884, 3), +(30881, 30885, 4), +(30881, 30886, 5), + -- Nature's Reach +(16819, 16819, 1), +(16819, 16820, 2), + -- Necrosis +(51459, 51459, 1), +(51459, 51462, 2), +(51459, 51463, 3), +(51459, 51464, 4), +(51459, 51465, 5), + -- Nemesis +(63117, 63117, 1), +(63117, 63121, 2), +(63117, 63123, 3), + -- Nerves of Cold Steel +(49226, 49226, 1), +(49226, 50137, 2), +(49226, 50138, 3), + -- Nerves of Steel +(31130, 31130, 1), +(31130, 31131, 2), + -- Nether Protection +(30299, 30299, 1), +(30299, 30301, 2), +(30299, 30302, 3), + -- Nether Shock +(50479, 50479, 1), +(50479, 53584, 2), +(50479, 53586, 3), +(50479, 53587, 4), +(50479, 53588, 5), +(50479, 53589, 6), + -- Netherwind Presence +(44400, 44400, 1), +(44400, 44402, 2), +(44400, 44403, 3), + -- Night of the Dead +(55620, 55620, 1), +(55620, 55623, 2), + -- Nightfall +(18094, 18094, 1), +(18094, 18095, 2), + -- Noxious Stings +(53295, 53295, 1), +(53295, 53296, 2), +(53295, 53297, 3), + -- Nurturing Instinct +(47179, 47179, 1), +(47179, 47180, 2), + -- Nurturing Instinct +(33872, 33872, 1), +(33872, 33873, 2), + -- One-Handed Weapon Specialization +(16538, 16538, 1), +(16538, 16539, 2), +(16538, 16540, 3), +(16538, 16541, 4), +(16538, 16542, 5), + -- One-Handed Weapon Specialization +(20196, 20196, 1), +(20196, 20197, 2), +(20196, 20198, 3), + -- Opportunity +(14057, 14057, 1), +(14057, 14072, 2), + -- Outbreak +(49013, 49013, 1), +(49013, 55236, 2), +(49013, 55237, 3), + -- Owlkin Frenzy +(48389, 48389, 1), +(48389, 48392, 2), +(48389, 48393, 3), + -- Owl's Focus +(53514, 53514, 1), +(53514, 53516, 2), + -- Pain and Suffering +(47580, 47580, 1), +(47580, 47581, 2), +(47580, 47582, 3), + -- Pathfinding +(19559, 19559, 1), +(19559, 19560, 2), + -- Permafrost +(11175, 11175, 1), +(11175, 12569, 2), +(11175, 12571, 3), + -- Pet Aggression +(6311, 6311, 1), +(6311, 6314, 2), +(6311, 6315, 3), +(6311, 6316, 4), +(6311, 6317, 5), + -- Pet Barding +(53175, 53175, 1), +(53175, 53176, 2), + -- Pet Hardiness +(6280, 6280, 1), +(6280, 6281, 2), +(6280, 6282, 3), +(6280, 6283, 4), +(6280, 6286, 5), + -- Pet Recovery +(6328, 6328, 1), +(6328, 6331, 2), +(6328, 6332, 3), +(6328, 6333, 4), +(6328, 6334, 5), + -- Pet Resistance +(6443, 6443, 1), +(6443, 6444, 2), +(6443, 6445, 3), +(6443, 6446, 4), +(6443, 6447, 5), + -- Piercing Ice +(11151, 11151, 1), +(11151, 12952, 2), +(11151, 12953, 3), + -- Piercing Shots +(53234, 53234, 1), +(53234, 53237, 2), +(53234, 53238, 3), + -- Pin +(50245, 50245, 1), +(50245, 53544, 2), +(50245, 53545, 3), +(50245, 53546, 4), +(50245, 53547, 5), +(50245, 53548, 6), + -- Playing with Fire +(31638, 31638, 1), +(31638, 31639, 2), +(31638, 31640, 3), + -- Point of No Escape +(53298, 53298, 1), +(53298, 53299, 2), + -- Poison Spit +(35388, 35388, 1), +(35388, 35390, 2), +(35388, 35391, 3), + -- Poison Spit +(35387, 35387, 1), +(35387, 35389, 2), +(35387, 35392, 3), +(35387, 55555, 4), +(35387, 55556, 5), +(35387, 55557, 6), + -- Poleaxe Specialization +(12700, 12700, 1), +(12700, 12781, 2), +(12700, 12783, 3), +(12700, 12784, 4), +(12700, 12785, 5), + -- Polymorph +(118, 118, 1), +(118, 12824, 2), +(118, 12825, 3), +(118, 12826, 4), + -- Pounce +(9005, 9005, 1), +(9005, 9823, 2), +(9005, 9827, 3), +(9005, 27006, 4), +(9005, 49803, 5), + -- Pounce Bleed +(9007, 9007, 1), +(9007, 9824, 2), +(9007, 9826, 3), +(9007, 27007, 4), +(9007, 49804, 5), + -- Power Word: Fortitude +(1243, 1243, 1), +(1243, 1244, 2), +(1243, 1245, 3), +(1243, 2791, 4), +(1243, 10937, 5), +(1243, 10938, 6), +(1243, 25389, 7), +(1243, 48161, 8), + -- Power Word: Shield +(17, 17, 1), +(17, 592, 2), +(17, 600, 3), +(17, 3747, 4), +(17, 6065, 5), +(17, 6066, 6), +(17, 10898, 7), +(17, 10899, 8), +(17, 10900, 9), +(17, 10901, 10), +(17, 25217, 11), +(17, 25218, 12), +(17, 48065, 13), +(17, 48066, 14), + -- Prayer of Fortitude +(21562, 21562, 1), +(21562, 21564, 2), +(21562, 25392, 3), +(21562, 48162, 4), + -- Prayer of Healing +(596, 596, 1), +(596, 996, 2), +(596, 10960, 3), +(596, 10961, 4), +(596, 25316, 5), +(596, 25308, 6), +(596, 48072, 7), + -- Prayer of Mending +(41635, 41635, 1), +(41635, 48110, 2), +(41635, 48111, 3), + -- Prayer of Mending +(33076, 33076, 1), +(33076, 48112, 2), +(33076, 48113, 3), + -- Prayer of Shadow Protection +(27683, 27683, 1), +(27683, 39374, 2), +(27683, 48170, 3), + -- Prayer of Spirit +(27681, 27681, 1), +(27681, 32999, 2), +(27681, 48074, 3), + -- Precision +(29438, 29438, 1), +(29438, 29439, 2), +(29438, 29440, 3), + -- Precision +(13705, 13705, 1), +(13705, 13832, 2), +(13705, 13843, 3), +(13705, 13844, 4), +(13705, 13845, 5), + -- Precision +(29590, 29590, 1), +(29590, 29591, 2), +(29590, 29592, 3), + -- Predatory Instincts +(33859, 33859, 1), +(33859, 33866, 2), +(33859, 33867, 3), + -- Predatory Strikes +(16972, 16972, 1), +(16972, 16974, 2), +(16972, 16975, 3), + -- Prey on the Weak +(51685, 51685, 1), +(51685, 51686, 2), +(51685, 51687, 3), +(51685, 51688, 4), +(51685, 51689, 5), + -- Primal Precision +(48409, 48409, 1), +(48409, 48410, 2), + -- Primal Tenacity +(33851, 33851, 1), +(33851, 33852, 2), +(33851, 33957, 3), + -- Prismatic Cloak +(31574, 31574, 1), +(31574, 31575, 2), +(31574, 54354, 3), + -- Protector of the Pack +(57873, 57873, 1), +(57873, 57876, 2), +(57873, 57877, 3), + -- Prowl +(24450, 24450, 1), +(24450, 24452, 2), +(24450, 24453, 3), + -- Psychic Scream +(8122, 8122, 1), +(8122, 8124, 2), +(8122, 10888, 3), +(8122, 10890, 4), + -- Pummel +(13491, 13491, 1), +(13491, 6554, 2), +(13491, 6555, 3), + -- Puncture +(12308, 12308, 1), +(12308, 12810, 2), +(12308, 12811, 3), + -- Puncturing Wounds +(13733, 13733, 1), +(13733, 13865, 2), +(13733, 13866, 3), + -- Pure of Heart +(31822, 31822, 1), +(31822, 31823, 2), + -- Purge +(370, 370, 1), +(370, 8012, 2), + -- Purification +(16178, 16178, 1), +(16178, 16210, 2), +(16178, 16211, 3), +(16178, 16212, 4), +(16178, 16213, 5), + -- Purifying Power +(31825, 31825, 1), +(31825, 31826, 2), + -- Pursuit of Justice +(26022, 26022, 1), +(26022, 26023, 2), + -- Pyroblast +(11366, 11366, 1), +(11366, 12505, 2), +(11366, 12522, 3), +(11366, 12523, 4), +(11366, 12524, 5), +(11366, 12525, 6), +(11366, 12526, 7), +(11366, 18809, 8), +(11366, 27132, 9), +(11366, 33938, 10), +(11366, 42890, 11), +(11366, 42891, 12), + -- Pyroclasm +(18096, 18096, 1), +(18096, 18073, 2), +(18096, 63245, 3), + -- Pyromaniac +(34293, 34293, 1), +(34293, 34295, 2), +(34293, 34296, 3), + -- Quick Recovery +(31244, 31244, 1), +(31244, 31245, 2), + -- Rage of Rivendare +(50117, 50117, 1), +(50117, 50118, 2), +(50117, 50119, 3), +(50117, 50120, 4), +(50117, 50121, 5), + -- Rake +(1822, 1822, 1), +(1822, 1823, 2), +(1822, 1824, 3), +(1822, 9904, 4), +(1822, 27003, 5), +(1822, 48573, 6), +(1822, 48574, 7), + -- Rake +(59881, 59881, 1), +(59881, 59882, 2), +(59881, 59883, 3), +(59881, 59884, 4), +(59881, 59885, 5), +(59881, 59886, 6), + -- Ranged Weapon Specialization +(19507, 19507, 1), +(19507, 19508, 2), +(19507, 19509, 3), + -- Rapid Recuperation +(53228, 53228, 1), +(53228, 53232, 2), + -- Raptor Strike +(2973, 2973, 1), +(2973, 14260, 2), +(2973, 14261, 3), +(2973, 14262, 4), +(2973, 14263, 5), +(2973, 14264, 6), +(2973, 14265, 7), +(2973, 14266, 8), +(2973, 27014, 9), +(2973, 48995, 10), +(2973, 48996, 11), + -- Rapture +(47535, 47535, 1), +(47535, 47536, 2), +(47535, 47537, 3), + -- Ravage +(6785, 6785, 1), +(6785, 6787, 2), +(6785, 9866, 3), +(6785, 9867, 4), +(6785, 27005, 5), +(6785, 48578, 6), +(6785, 48579, 7), + -- Ravage +(50518, 50518, 1), +(50518, 53558, 2), +(50518, 53559, 3), +(50518, 53560, 4), +(50518, 53561, 5), +(50518, 53562, 6), + -- Ravenous Dead +(48965, 48965, 1), +(48965, 49571, 2), +(48965, 49572, 3), + -- Reaping +(49208, 49208, 1), +(49208, 56834, 2), +(49208, 56835, 3), + -- Rebirth +(20484, 20484, 1), +(20484, 20739, 2), +(20484, 20742, 3), +(20484, 20747, 4), +(20484, 20748, 5), +(20484, 26994, 6), +(20484, 48477, 7), + -- Reckoning +(20177, 20177, 1), +(20177, 20179, 2), +(20177, 20181, 3), +(20177, 20180, 4), +(20177, 20182, 5), + -- Redemption +(7328, 7328, 1), +(7328, 10322, 2), +(7328, 10324, 3), +(7328, 20772, 4), +(7328, 20773, 5), +(7328, 48949, 6), +(7328, 48950, 7), + -- Redoubt +(20127, 20127, 1), +(20127, 20130, 2), +(20127, 20135, 3), + -- Reflective Shield +(33201, 33201, 1), +(33201, 33202, 2), + -- Regeneration +(30799, 30799, 1), +(30799, 30800, 2), +(30799, 30801, 3), + -- Regrowth +(8936, 8936, 1), +(8936, 8938, 2), +(8936, 8939, 3), +(8936, 8940, 4), +(8936, 8941, 5), +(8936, 9750, 6), +(8936, 9856, 7), +(8936, 9857, 8), +(8936, 9858, 9), +(8936, 26980, 10), +(8936, 48442, 11), +(8936, 48443, 12), + -- Rejuvenation +(774, 774, 1), +(774, 1058, 2), +(774, 1430, 3), +(774, 2090, 4), +(774, 2091, 5), +(774, 3627, 6), +(774, 8910, 7), +(774, 9839, 8), +(774, 9840, 9), +(774, 9841, 10), +(774, 25299, 11), +(774, 26981, 12), +(774, 26982, 13), +(774, 48440, 14), +(774, 48441, 15), + -- Relentless Strikes +(14179, 14179, 1), +(14179, 58422, 2), +(14179, 58423, 3), +(14179, 58424, 4), +(14179, 58425, 5), + -- Remorseless +(14143, 14143, 1), +(14143, 14149, 2), + -- Remorseless Attacks +(14144, 14144, 1), +(14144, 14148, 2), + -- Rend +(772, 772, 1), +(772, 6546, 2), +(772, 6547, 3), +(772, 6548, 4), +(772, 11572, 5), +(772, 11573, 6), +(772, 11574, 7), +(772, 25208, 8), +(772, 46845, 9), +(772, 47465, 10), + -- Rend and Tear +(48432, 48432, 1), +(48432, 48433, 2), +(48432, 48434, 3), +(48432, 51268, 4), +(48432, 51269, 5), + -- Renew +(139, 139, 1), +(139, 6074, 2), +(139, 6075, 3), +(139, 6076, 4), +(139, 6077, 5), +(139, 6078, 6), +(139, 10927, 7), +(139, 10928, 8), +(139, 10929, 9), +(139, 25315, 10), +(139, 25221, 11), +(139, 25222, 12), +(139, 48067, 13), +(139, 48068, 14), + -- Renewed Hope +(57470, 57470, 1), +(57470, 57472, 2), + -- Replenish Mana +(5405, 5405, 1), +(5405, 10052, 2), +(5405, 10057, 3), +(5405, 10058, 4), +(5405, 27103, 5), +(5405, 42987, 6), +(5405, 42988, 7), + -- Resourcefulness +(34491, 34491, 1), +(34491, 34492, 2), +(34491, 34493, 3), + -- Restorative Totems +(16187, 16187, 1), +(16187, 16205, 2), +(16187, 16206, 3), + -- Resurrection +(2006, 2006, 1), +(2006, 2010, 2), +(2006, 10880, 3), +(2006, 10881, 4), +(2006, 20770, 5), +(2006, 25435, 6), +(2006, 48171, 7), + -- Retribution Aura +(7294, 7294, 1), +(7294, 10298, 2), +(7294, 10299, 3), +(7294, 10300, 4), +(7294, 10301, 5), +(7294, 27150, 6), +(7294, 54043, 7), + -- Revenge +(6572, 6572, 1), +(6572, 6574, 2), +(6572, 7379, 3), +(6572, 11600, 4), +(6572, 11601, 5), +(6572, 25288, 6), +(6572, 25269, 7), +(6572, 30357, 8), +(6572, 57823, 9), + -- Reverberation +(16040, 16040, 1), +(16040, 16113, 2), +(16040, 16114, 3), +(16040, 16115, 4), +(16040, 16116, 5), + -- Revitalize +(48539, 48539, 1), +(48539, 48544, 2), +(48539, 48545, 3), + -- Revive +(50769, 50769, 1), +(50769, 50768, 2), +(50769, 50767, 3), +(50769, 50766, 4), +(50769, 50765, 5), +(50769, 50764, 6), +(50769, 50763, 7), + -- Righteous Vengeance +(53380, 53380, 1), +(53380, 53381, 2), +(53380, 53382, 3), + -- Rime +(49188, 49188, 1), +(49188, 56822, 2), +(49188, 59057, 3), + -- Rip +(1079, 1079, 1), +(1079, 9492, 2), +(1079, 9493, 3), +(1079, 9752, 4), +(1079, 9894, 5), +(1079, 9896, 6), +(1079, 27008, 7), +(1079, 49799, 8), +(1079, 49800, 9), + -- Riptide +(61295, 61295, 1), +(61295, 61299, 2), +(61295, 61300, 3), +(61295, 61301, 4), + -- Ritual of Refreshment +(43987, 43987, 1), +(43987, 58659, 2), + -- Ritual of Souls +(29893, 29893, 1), +(29893, 58887, 2), + -- Rockbiter Weapon +(8017, 8017, 1), +(8017, 8018, 2), +(8017, 8019, 3), +(8017, 10399, 4), + -- Ruin +(17959, 17959, 1), +(17959, 59738, 2), +(17959, 59739, 3), +(17959, 59740, 4), +(17959, 59741, 5), + -- Runic Power Mastery +(49455, 49455, 1), +(49455, 50147, 2), + -- Rupture +(1943, 1943, 1), +(1943, 8639, 2), +(1943, 8640, 3), +(1943, 11273, 4), +(1943, 11274, 5), +(1943, 11275, 6), +(1943, 26867, 7), +(1943, 48671, 8), +(1943, 48672, 9), + -- Ruthlessness +(14156, 14156, 1), +(14156, 14160, 2), +(14156, 14161, 3), + -- Sacred Cleansing +(53551, 53551, 1), +(53551, 53552, 2), +(53551, 53553, 3), + -- Sacred Duty +(31848, 31848, 1), +(31848, 31849, 2), + -- Sacrifice +(7812, 7812, 1), +(7812, 19438, 2), +(7812, 19440, 3), +(7812, 19441, 4), +(7812, 19442, 5), +(7812, 19443, 6), +(7812, 27273, 7), +(7812, 47985, 8), +(7812, 47986, 9), + -- Sanctified Light +(20359, 20359, 1), +(20359, 20360, 2), +(20359, 20361, 3), + -- Sanctified Wrath +(53375, 53375, 1), +(53375, 53376, 2), + -- Sanctity of Battle +(32043, 32043, 1), +(32043, 35396, 2), +(32043, 35397, 3), + -- Sap +(6770, 6770, 1), +(6770, 2070, 2), +(6770, 11297, 3), +(6770, 51724, 4), + -- Savage Combat +(58684, 58684, 1), +(58684, 58683, 2), + -- Savage Combat +(51682, 51682, 1), +(51682, 58413, 2), + -- Savage Fury +(16998, 16998, 1), +(16998, 16999, 2), + -- Savage Strikes +(19159, 19159, 1), +(19159, 19160, 2), + -- Scare Beast +(1513, 1513, 1), +(1513, 14326, 2), +(1513, 14327, 3), + -- Scent of Blood +(49004, 49004, 1), +(49004, 49508, 2), +(49004, 49509, 3), + -- Scorch +(1811, 1811, 1), +(1811, 8447, 2), +(1811, 8448, 3), +(1811, 8449, 4), +(1811, 10208, 5), +(1811, 10209, 6), +(1811, 10210, 7), +(1811, 27375, 8), +(1811, 27376, 9), + -- Scorch +(2948, 2948, 1), +(2948, 8444, 2), +(2948, 8445, 3), +(2948, 8446, 4), +(2948, 10205, 5), +(2948, 10206, 6), +(2948, 10207, 7), +(2948, 27073, 8), +(2948, 27074, 9), +(2948, 42858, 10), +(2948, 42859, 11), + -- Scorpid Poison +(24641, 24641, 1), +(24641, 24584, 2), +(24641, 24588, 3), +(24641, 24589, 4), +(24641, 27361, 5), + -- Scorpid Poison +(24640, 24640, 1), +(24640, 24583, 2), +(24640, 24586, 3), +(24640, 24587, 4), +(24640, 27060, 5), +(24640, 55728, 6), + -- Scourge Strike +(55090, 55090, 1), +(55090, 55265, 2), +(55090, 55270, 3), +(55090, 55271, 4), + -- Seal Fate +(14186, 14186, 1), +(14186, 14190, 2), +(14186, 14193, 3), +(14186, 14194, 4), +(14186, 14195, 5), + -- Seals of the Pure +(20224, 20224, 1), +(20224, 20225, 2), +(20224, 20330, 3), +(20224, 20331, 4), +(20224, 20332, 5), + -- Searing Light +(14909, 14909, 1), +(14909, 15017, 2), + -- Searing Pain +(5676, 5676, 1), +(5676, 17919, 2), +(5676, 17920, 3), +(5676, 17921, 4), +(5676, 17922, 5), +(5676, 17923, 6), +(5676, 27210, 7), +(5676, 30459, 8), +(5676, 47814, 9), +(5676, 47815, 10), + -- Searing Totem +(2075, 2075, 1), +(2075, 38116, 2), + -- Searing Totem +(3599, 3599, 1), +(3599, 6363, 2), +(3599, 6364, 3), +(3599, 6365, 4), +(3599, 10437, 5), +(3599, 10438, 6), +(3599, 25533, 7), +(3599, 58699, 8), +(3599, 58703, 9), +(3599, 58704, 10), + -- Seed of Corruption +(43991, 43991, 1), +(43991, 47831, 2), +(43991, 47832, 3), + -- Serendipity +(63730, 63730, 1), +(63730, 63733, 2), +(63730, 63737, 3), + -- Serenity Dust +(50318, 50318, 1), +(50318, 52012, 2), +(50318, 52013, 3), +(50318, 52014, 4), +(50318, 52015, 5), +(50318, 52016, 6), + -- Serious Wound +(5597, 5597, 1), +(5597, 5598, 2), + -- Serpent Sting +(1978, 1978, 1), +(1978, 13549, 2), +(1978, 13550, 3), +(1978, 13551, 4), +(1978, 13552, 5), +(1978, 13553, 6), +(1978, 13554, 7), +(1978, 13555, 8), +(1978, 25295, 9), +(1978, 27016, 10), +(1978, 49000, 11), +(1978, 49001, 12), + -- Serpent's Swiftness +(34466, 34466, 1), +(34466, 34467, 2), +(34466, 34468, 3), +(34466, 34469, 4), +(34466, 34470, 5), + -- Serrated Blades +(14171, 14171, 1), +(14171, 14172, 2), +(14171, 14173, 3), + -- Setup +(13983, 13983, 1), +(13983, 14070, 2), +(13983, 14071, 3), + -- Shackle Undead +(9484, 9484, 1), +(9484, 9485, 2), +(9484, 10955, 3), + -- Shadow Affinity +(15318, 15318, 1), +(15318, 15272, 2), +(15318, 15320, 3), + -- Shadow and Flame +(30288, 30288, 1), +(30288, 30289, 2), +(30288, 30290, 3), +(30288, 30291, 4), +(30288, 30292, 5), + -- Shadow Bite +(54049, 54049, 1), +(54049, 54050, 2), +(54049, 54051, 3), +(54049, 54052, 4), +(54049, 54053, 5), + -- Shadow Bolt +(686, 686, 1), +(686, 695, 2), +(686, 705, 3), +(686, 1088, 4), +(686, 1106, 5), +(686, 7641, 6), +(686, 11659, 7), +(686, 11660, 8), +(686, 11661, 9), +(686, 25307, 10), +(686, 27209, 11), +(686, 47808, 12), +(686, 47809, 13), + -- Shadow Embrace +(32385, 32385, 1), +(32385, 32387, 2), +(32385, 32392, 3), +(32385, 32393, 4), +(32385, 32394, 5), + -- Shadow Focus +(15260, 15260, 1), +(15260, 15327, 2), +(15260, 15328, 3), + -- Shadow Mastery +(18271, 18271, 1), +(18271, 18272, 2), +(18271, 18273, 3), +(18271, 18274, 4), +(18271, 18275, 5), + -- Shadow Power +(33221, 33221, 1), +(33221, 33222, 2), +(33221, 33223, 3), +(33221, 33224, 4), +(33221, 33225, 5), + -- Shadow Protection +(976, 976, 1), +(976, 10957, 2), +(976, 10958, 3), +(976, 25433, 4), +(976, 48169, 5), + -- Shadow Reach +(17322, 17322, 1), +(17322, 17323, 2), + -- Shadow Resistance Aura +(19876, 19876, 1), +(19876, 19895, 2), +(19876, 19896, 3), +(19876, 27151, 4), +(19876, 48943, 5), + -- Shadow Ward +(6229, 6229, 1), +(6229, 11739, 2), +(6229, 11740, 3), +(6229, 28610, 4), +(6229, 47890, 5), +(6229, 47891, 6), + -- Shadow Weaving +(15257, 15257, 1), +(15257, 15331, 2), +(15257, 15332, 3), + -- Shadow Word: Death +(32379, 32379, 1), +(32379, 32996, 2), +(32379, 48157, 3), +(32379, 48158, 4), + -- Shadow Word: Pain +(589, 589, 1), +(589, 594, 2), +(589, 970, 3), +(589, 992, 4), +(589, 2767, 5), +(589, 10892, 6), +(589, 10893, 7), +(589, 10894, 8), +(589, 25367, 9), +(589, 25368, 10), +(589, 48124, 11), +(589, 48125, 12), + -- Shadowburn +(17877, 17877, 1), +(17877, 18867, 2), +(17877, 18868, 3), +(17877, 18869, 4), +(17877, 18870, 5), +(17877, 18871, 6), +(17877, 27263, 7), +(17877, 30546, 8), +(17877, 47826, 9), +(17877, 47827, 10), + -- Shadowflame +(47897, 47897, 1), +(47897, 61290, 2), + -- Shadowfury +(30283, 30283, 1), +(30283, 30413, 2), +(30283, 30414, 3), +(30283, 47846, 4), +(30283, 47847, 5), + -- Shamanism +(62097, 62097, 1), +(62097, 62098, 2), +(62097, 62099, 3), +(62097, 62100, 4), +(62097, 62101, 5), + -- Shark Attack +(62759, 62759, 1), +(62759, 62760, 2), + -- Sharpened Claws +(16942, 16942, 1), +(16942, 16943, 2), +(16942, 16944, 3), + -- Shatter +(11170, 11170, 1), +(11170, 12982, 2), +(11170, 12983, 3), + -- Shattered Barrier +(44745, 44745, 1), +(44745, 54787, 2), + -- Sheath of Light +(53501, 53501, 1), +(53501, 53502, 2), +(53501, 53503, 3), + -- Shield Mastery +(29598, 29598, 1), +(29598, 29599, 2), + -- Shield of Righteousness +(53600, 53600, 1), +(53600, 61411, 2), + -- Shield of the Templar +(53709, 53709, 1), +(53709, 53710, 2), +(53709, 53711, 3), + -- Shield Slam +(23922, 23922, 1), +(23922, 23923, 2), +(23922, 23924, 3), +(23922, 23925, 4), +(23922, 25258, 5), +(23922, 30356, 6), +(23922, 47487, 7), +(23922, 47488, 8), + -- Shield Specialization +(12298, 12298, 1), +(12298, 12724, 2), +(12298, 12725, 3), +(12298, 12726, 4), +(12298, 12727, 5), + -- Shield Specialization +(16253, 16253, 1), +(16253, 16298, 2), + -- Shock +(2607, 2607, 1), +(2607, 2606, 2), +(2607, 2608, 3), +(2607, 2609, 4), +(2607, 2610, 5), + -- Shred +(5221, 5221, 1), +(5221, 6800, 2), +(5221, 8992, 3), +(5221, 9829, 4), +(5221, 9830, 5), +(5221, 27001, 6), +(5221, 27002, 7), +(5221, 48571, 8), +(5221, 48572, 9), + -- Shredding Attacks +(16966, 16966, 1), +(16966, 16968, 2), + -- Silenced - Improved Counterspell +(18469, 18469, 1), +(18469, 55021, 2), + -- Silent Hunter +(34472, 34472, 1), +(34472, 34473, 2), +(34472, 34474, 3), + -- Silent Resolve +(14523, 14523, 1), +(14523, 14784, 2), +(14523, 14785, 3), + -- Silverback +(62764, 62764, 1), +(62764, 62765, 2), + -- Sinister Calling +(31216, 31216, 1), +(31216, 31217, 2), +(31216, 31218, 3), +(31216, 31219, 4), +(31216, 31220, 5), + -- Sinister Strike +(1752, 1752, 1), +(1752, 1757, 2), +(1752, 1758, 3), +(1752, 1759, 4), +(1752, 1760, 5), +(1752, 8621, 6), +(1752, 11293, 7), +(1752, 11294, 8), +(1752, 26861, 9), +(1752, 26862, 10), +(1752, 48637, 11), +(1752, 48638, 12), + -- Skinning +(8613, 8613, 1), +(8613, 8617, 2), +(8613, 8618, 3), +(8613, 10768, 4), +(8613, 32678, 5), +(8613, 50305, 6), + -- Slam +(1464, 1464, 1), +(1464, 8820, 2), +(1464, 11604, 3), +(1464, 11605, 4), +(1464, 25241, 5), +(1464, 25242, 6), +(1464, 47474, 7), +(1464, 47475, 8), + -- Slaughter from the Shadows +(51708, 51708, 1), +(51708, 51709, 2), +(51708, 51710, 3), +(51708, 51711, 4), +(51708, 51712, 5), + -- Sleep +(700, 700, 1), +(700, 1090, 2), + -- Sleight of Hand +(30892, 30892, 1), +(30892, 30893, 2), + -- Slice and Dice +(5171, 5171, 1), +(5171, 6774, 2), + -- Slow +(246, 246, 1), +(246, 6146, 2), + -- Smack +(49966, 49966, 1), +(49966, 49967, 2), +(49966, 49968, 3), +(49966, 49969, 4), +(49966, 49970, 5), +(49966, 49971, 6), +(49966, 49972, 7), +(49966, 49973, 8), +(49966, 49974, 9), +(49966, 52475, 10), +(49966, 52476, 11), + -- Smite +(585, 585, 1), +(585, 591, 2), +(585, 598, 3), +(585, 984, 4), +(585, 1004, 5), +(585, 6060, 6), +(585, 10933, 7), +(585, 10934, 8), +(585, 25363, 9), +(585, 25364, 10), +(585, 48122, 11), +(585, 48123, 12), + -- Snatch +(50541, 50541, 1), +(50541, 53537, 2), +(50541, 53538, 3), +(50541, 53540, 4), +(50541, 53542, 5), +(50541, 53543, 6), + -- Sniper Training +(53302, 53302, 1), +(53302, 53303, 2), +(53302, 53304, 3), + -- Sonic Blast +(50519, 50519, 1), +(50519, 53564, 2), +(50519, 53565, 3), +(50519, 53566, 4), +(50519, 53567, 5), +(50519, 53568, 6), + -- Soothe Animal +(2908, 2908, 1), +(2908, 8955, 2), +(2908, 9901, 3), +(2908, 26995, 4), + -- Soothing Kiss +(6360, 6360, 1), +(6360, 7813, 2), +(6360, 11784, 3), +(6360, 11785, 4), +(6360, 27275, 5), + -- Soul Fire +(6353, 6353, 1), +(6353, 17924, 2), +(6353, 27211, 3), +(6353, 30545, 4), +(6353, 47824, 5), +(6353, 47825, 6), + -- Soul Leech +(30293, 30293, 1), +(30293, 30295, 2), +(30293, 30296, 3), + -- Soul Siphon +(17804, 17804, 1), +(17804, 17805, 2), + -- Spark of Nature +(48435, 48435, 1), +(48435, 48436, 2), +(48435, 48437, 3), + -- Spell Deflection +(49145, 49145, 1), +(49145, 49495, 2), +(49145, 49497, 3), + -- Spell Impact +(11242, 11242, 1), +(11242, 12467, 2), +(11242, 12469, 3), + -- Spell Lock +(19244, 19244, 1), +(19244, 19647, 2), + -- Spell Power +(35578, 35578, 1), +(35578, 35581, 2), + -- Spell Warding +(27900, 27900, 1), +(27900, 27901, 2), +(27900, 27902, 3), +(27900, 27903, 4), +(27900, 27904, 5), + -- Spider's Bite +(53203, 53203, 1), +(53203, 53204, 2), +(53203, 53205, 3), + -- Spiked Collar +(53182, 53182, 1), +(53182, 53183, 2), +(53182, 53184, 3), + -- Spirit +(8112, 8112, 1), +(8112, 8113, 2), +(8112, 8114, 3), +(8112, 12177, 4), +(8112, 33080, 5), +(8112, 43197, 6), +(8112, 48103, 7), +(8112, 48104, 8), + -- Spirit Strike +(61193, 61193, 1), +(61193, 61194, 2), +(61193, 61195, 3), +(61193, 61196, 4), +(61193, 61197, 5), +(61193, 61198, 6), + -- Spirit Tap +(15270, 15270, 1), +(15270, 15335, 2), +(15270, 15336, 3), + -- Spiritual Attunement +(31785, 31785, 1), +(31785, 33776, 2), + -- Spiritual Focus +(20205, 20205, 1), +(20205, 20206, 2), +(20205, 20207, 3), +(20205, 20209, 4), +(20205, 20208, 5), + -- Spiritual Guidance +(14901, 14901, 1), +(14901, 15028, 2), +(14901, 15029, 3), +(14901, 15030, 4), +(14901, 15031, 5), + -- Spiritual Healing +(14898, 14898, 1), +(14898, 15349, 2), +(14898, 15354, 3), +(14898, 15355, 4), +(14898, 15356, 5), + -- Spore Cloud +(50274, 50274, 1), +(50274, 53593, 2), +(50274, 53594, 3), +(50274, 53596, 4), +(50274, 53597, 5), +(50274, 53598, 6), + -- Sprint +(2983, 2983, 1), +(2983, 8696, 2), +(2983, 11305, 3), + -- Stampede +(57386, 57386, 1), +(57386, 57389, 2), +(57386, 57390, 3), +(57386, 57391, 4), +(57386, 57392, 5), +(57386, 57393, 6), + -- Starfall +(48505, 48505, 1), +(48505, 53199, 2), +(48505, 53200, 3), +(48505, 53201, 4), + -- Starfire +(2912, 2912, 1), +(2912, 8949, 2), +(2912, 8950, 3), +(2912, 8951, 4), +(2912, 9875, 5), +(2912, 9876, 6), +(2912, 25298, 7), +(2912, 26986, 8), +(2912, 48464, 9), +(2912, 48465, 10), + -- Starlight Wrath +(16814, 16814, 1), +(16814, 16815, 2), +(16814, 16816, 3), +(16814, 16817, 4), +(16814, 16818, 5), + -- Static Shock +(51525, 51525, 1), +(51525, 51526, 2), +(51525, 51527, 3), + -- Steady Shot +(56641, 56641, 1), +(56641, 34120, 2), +(56641, 49051, 3), +(56641, 49052, 4), + -- Sting +(56626, 56626, 1), +(56626, 56627, 2), +(56626, 56628, 3), +(56626, 56629, 4), +(56626, 56630, 5), +(56626, 56631, 6), + -- Stoicism +(31844, 31844, 1), +(31844, 31845, 2), +(31844, 53519, 3), + -- Stoneclaw Totem +(5730, 5730, 1), +(5730, 6390, 2), +(5730, 6391, 3), +(5730, 6392, 4), +(5730, 10427, 5), +(5730, 10428, 6), +(5730, 25525, 7), +(5730, 58580, 8), +(5730, 58581, 9), +(5730, 58582, 10), + -- Stoneclaw Totem Passive +(5728, 5728, 1), +(5728, 6397, 2), +(5728, 6398, 3), +(5728, 6399, 4), +(5728, 10425, 5), +(5728, 10426, 6), +(5728, 25513, 7), +(5728, 58583, 8), +(5728, 58584, 9), +(5728, 58585, 10), + -- Stoneskin Totem +(8073, 8073, 1), +(8073, 38115, 2), + -- Stoneskin Totem +(8071, 8071, 1), +(8071, 8154, 2), +(8071, 8155, 3), +(8071, 10406, 4), +(8071, 10407, 5), +(8071, 10408, 6), +(8071, 25508, 7), +(8071, 25509, 8), +(8071, 58751, 9), +(8071, 58753, 10), + -- Storm, Earth and Fire +(51483, 51483, 1), +(51483, 51485, 2), +(51483, 51486, 3), + -- Strength +(8118, 8118, 1), +(8118, 8119, 2), +(8118, 8120, 3), +(8118, 12179, 4), +(8118, 33082, 5), +(8118, 43199, 6), +(8118, 58448, 7), +(8118, 58449, 8), + -- Strength of Arms +(46865, 46865, 1), +(46865, 46866, 2), + -- Strength of Earth Totem +(8075, 8075, 1), +(8075, 8160, 2), +(8075, 8161, 3), +(8075, 10442, 4), +(8075, 25361, 5), +(8075, 25528, 6), +(8075, 57622, 7), +(8075, 58643, 8), + -- Student of the Mind +(44397, 44397, 1), +(44397, 44398, 2), +(44397, 44399, 3), + -- Stunning Blast +(5648, 5648, 1), +(5648, 5649, 2), + -- Stunning Blow +(5726, 5726, 1), +(5726, 5727, 2), + -- Subtlety +(17118, 17118, 1), +(17118, 17119, 2), +(17118, 17120, 3), + -- Subversion +(48997, 48997, 1), +(48997, 49490, 2), +(48997, 49491, 3), + -- Sudden Death +(29723, 29723, 1), +(29723, 29725, 2), +(29723, 29724, 3), + -- Sudden Doom +(49018, 49018, 1), +(49018, 49529, 2), +(49018, 49530, 3), + -- Suffering +(17735, 17735, 1), +(17735, 17750, 2), +(17735, 17751, 3), +(17735, 17752, 4), +(17735, 27271, 5), +(17735, 33701, 6), +(17735, 47989, 7), +(17735, 47990, 8), + -- Suppression +(18174, 18174, 1), +(18174, 18175, 2), +(18174, 18176, 3), + -- Surefooted +(19290, 19290, 1), +(19290, 19294, 2), +(19290, 24283, 3), + -- Survival Instincts +(34494, 34494, 1), +(34494, 34496, 2), + -- Survival of the Fittest +(33853, 33853, 1), +(33853, 33855, 2), +(33853, 33856, 3), + -- Survival Tactics +(19286, 19286, 1), +(19286, 19287, 2), + -- Survivalist +(19255, 19255, 1), +(19255, 19256, 2), +(19255, 19257, 3), +(19255, 19258, 4), +(19255, 19259, 5), + -- Swift Retribution +(53379, 53379, 1), +(53379, 53484, 2), +(53379, 53648, 3), + -- Swipe +(50256, 50256, 1), +(50256, 53526, 2), +(50256, 53528, 3), +(50256, 53529, 4), +(50256, 53532, 5), +(50256, 53533, 6), + -- Swipe (Bear) +(779, 779, 1), +(779, 780, 2), +(779, 769, 3), +(779, 9754, 4), +(779, 9908, 5), +(779, 26997, 6), +(779, 48561, 7), +(779, 48562, 8), + -- Sword and Board +(46951, 46951, 1), +(46951, 46952, 2), +(46951, 46953, 3), + -- Sword Specialization +(12281, 12281, 1), +(12281, 12812, 2), +(12281, 12813, 3), +(12281, 12814, 4), +(12281, 12815, 5), + -- T.N.T. +(56333, 56333, 1), +(56333, 56336, 2), +(56333, 56337, 3), + -- Tactical Mastery +(12295, 12295, 1), +(12295, 12676, 2), +(12295, 12677, 3), + -- Tailoring +(3908, 3908, 1), +(3908, 3909, 2), +(3908, 3910, 3), +(3908, 12180, 4), +(3908, 26790, 5), +(3908, 51309, 6), + -- Taste for Blood +(56636, 56636, 1), +(56636, 56637, 2), +(56636, 56638, 3), + -- Tendon Rip +(50271, 50271, 1), +(50271, 53571, 2), +(50271, 53572, 3), +(50271, 53573, 4), +(50271, 53574, 5), +(50271, 53575, 6), + -- Test of Faith +(47558, 47558, 1), +(47558, 47559, 2), +(47558, 47560, 3), + -- Thick Hide +(19609, 19609, 1), +(19609, 19610, 2), +(19609, 19612, 3), + -- Thick Hide +(16929, 16929, 1), +(16929, 16930, 2), +(16929, 16931, 3), + -- Thorns +(467, 467, 1), +(467, 782, 2), +(467, 1075, 3), +(467, 8914, 4), +(467, 9756, 5), +(467, 9910, 6), +(467, 26992, 7), +(467, 53307, 8), + -- Threat of Thassarian +(65661, 65661, 1), +(65661, 66191, 2), +(65661, 66192, 3), + -- Thrill of the Hunt +(34497, 34497, 1), +(34497, 34498, 2), +(34497, 34499, 3), + -- Throwing Specialization +(5952, 5952, 1), +(5952, 51679, 2), + -- Thunder Clap +(6343, 6343, 1), +(6343, 8198, 2), +(6343, 8204, 3), +(6343, 8205, 4), +(6343, 11580, 5), +(6343, 11581, 6), +(6343, 25264, 7), +(6343, 47501, 8), +(6343, 47502, 9), + -- Thundering Strikes +(16255, 16255, 1), +(16255, 16302, 2), +(16255, 16303, 3), +(16255, 16304, 4), +(16255, 16305, 5), + -- Thunderstorm +(51490, 51490, 1), +(51490, 59156, 2), +(51490, 59158, 3), +(51490, 59159, 4), + -- Tidal Focus +(16179, 16179, 1), +(16179, 16214, 2), +(16179, 16215, 3), +(16179, 16216, 4), +(16179, 16217, 5), + -- Tidal Mastery +(16194, 16194, 1), +(16194, 16218, 2), +(16194, 16219, 3), +(16194, 16220, 4), +(16194, 16221, 5), + -- Tidal Waves +(51562, 51562, 1), +(51562, 51563, 2), +(51562, 51564, 3), +(51562, 51565, 4), +(51562, 51566, 5), + -- Tiger's Fury +(5217, 5217, 1), +(5217, 6793, 2), +(5217, 9845, 3), +(5217, 9846, 4), +(5217, 50212, 5), +(5217, 50213, 6), + -- Torment +(3716, 3716, 1), +(3716, 7809, 2), +(3716, 7810, 3), +(3716, 7811, 4), +(3716, 11774, 5), +(3716, 11775, 6), +(3716, 27270, 7), +(3716, 47984, 8), + -- Torment the Weak +(29447, 29447, 1), +(29447, 55339, 2), +(29447, 55340, 3), + -- Torture +(47263, 47263, 1), +(47263, 47264, 2), +(47263, 47265, 3), + -- Totem of Wrath +(30706, 30706, 1), +(30706, 57720, 2), +(30706, 57721, 3), +(30706, 57722, 4), + -- Totemic Focus +(16173, 16173, 1), +(16173, 16222, 2), +(16173, 16223, 3), +(16173, 16224, 4), +(16173, 16225, 5), + -- Touched by the Light +(53590, 53590, 1), +(53590, 53591, 2), +(53590, 53592, 3), + -- Toughness +(53120, 53120, 1), +(53120, 53121, 2), +(53120, 53122, 3), +(53120, 53123, 4), +(53120, 53124, 5), +(53120, 53040, 6), + -- Toughness +(12299, 12299, 1), +(12299, 12761, 2), +(12299, 12762, 3), +(12299, 12763, 4), +(12299, 12764, 5), + -- Toughness +(20143, 20143, 1), +(20143, 20144, 2), +(20143, 20145, 3), +(20143, 20146, 4), +(20143, 20147, 5), + -- Toughness +(16252, 16252, 1), +(16252, 16306, 2), +(16252, 16307, 3), +(16252, 16308, 4), +(16252, 16309, 5), + -- Toughness +(49042, 49042, 1), +(49042, 49786, 2), +(49042, 49787, 3), +(49042, 49788, 4), +(49042, 49789, 5), + -- Tranquil Spirit +(24968, 24968, 1), +(24968, 24969, 2), +(24968, 24970, 3), +(24968, 24971, 4), +(24968, 24972, 5), + -- Trap Mastery +(19376, 19376, 1), +(19376, 63457, 2), +(19376, 63458, 3), + -- Tundra Stalker +(49202, 49202, 1), +(49202, 50127, 2), +(49202, 50128, 3), +(49202, 50129, 4), +(49202, 50130, 5), + -- Turn the Tables +(51627, 51627, 1), +(51627, 51628, 2), +(51627, 51629, 3), + -- Twin Disciplines +(47586, 47586, 1), +(47586, 47587, 2), +(47586, 47588, 3), +(47586, 52802, 4), +(47586, 52803, 5), + -- Twisted Faith +(47573, 47573, 1), +(47573, 47577, 2), +(47573, 47578, 3), +(47573, 51166, 4), +(47573, 51167, 5), + -- Two-Handed Weapon Specialization +(12163, 12163, 1), +(12163, 12711, 2), +(12163, 12712, 3), + -- Two-Handed Weapon Specialization +(20111, 20111, 1), +(20111, 20112, 2), +(20111, 20113, 3), + -- Two-Handed Weapon Specialization +(55107, 55107, 1), +(55107, 55108, 2), + -- Unbreakable Will +(14522, 14522, 1), +(14522, 14788, 2), +(14522, 14789, 3), +(14522, 14790, 4), +(14522, 14791, 5), + -- Unending Fury +(56927, 56927, 1), +(56927, 56929, 2), +(56927, 56930, 3), +(56927, 56931, 4), +(56927, 56932, 5), + -- Unholy Command +(49588, 49588, 1), +(49588, 49589, 2), + -- Unholy Power +(18769, 18769, 1), +(18769, 18770, 2), +(18769, 18771, 3), +(18769, 18772, 4), +(18769, 18773, 5), + -- Unleashed Fury +(19616, 19616, 1), +(19616, 19617, 2), +(19616, 19618, 3), +(19616, 19619, 4), +(19616, 19620, 5), + -- Unrelenting Assault +(46859, 46859, 1), +(46859, 46860, 2), + -- Unrelenting Storm +(30664, 30664, 1), +(30664, 30665, 2), +(30664, 30666, 3), + -- Unstable Affliction +(30108, 30108, 1), +(30108, 30404, 2), +(30108, 30405, 3), +(30108, 47841, 4), +(30108, 47843, 5), + -- Unyielding Faith +(9453, 9453, 1), +(9453, 25836, 2), + -- Vampiric Touch +(34914, 34914, 1), +(34914, 34916, 2), +(34914, 34917, 3), +(34914, 48159, 4), +(34914, 48160, 5), + -- Vanish +(1856, 1856, 1), +(1856, 1857, 2), +(1856, 26889, 3), + -- Veiled Shadows +(15274, 15274, 1), +(15274, 15311, 2), + -- Vendetta +(49015, 49015, 1), +(49015, 50154, 2), +(49015, 55136, 3), + -- Vengeance +(20049, 20049, 1), +(20049, 20056, 2), +(20049, 20057, 3), + -- Vengeance +(16909, 16909, 1), +(16909, 16910, 2), +(16909, 16911, 3), +(16909, 16912, 4), +(16909, 16913, 5), + -- Venom Web Spray +(54706, 54706, 1), +(54706, 55505, 2), +(54706, 55506, 3), +(54706, 55507, 4), +(54706, 55508, 5), +(54706, 55509, 6), + -- Veteran of the Third War +(49006, 49006, 1), +(49006, 49526, 2), +(49006, 50029, 3), + -- Vicious Strikes +(51745, 51745, 1), +(51745, 51746, 2), + -- Vile Poisons +(16513, 16513, 1), +(16513, 16514, 2), +(16513, 16515, 3), + -- Virulence +(48962, 48962, 1), +(48962, 49567, 2), +(48962, 49568, 3), + -- Vitality +(31122, 31122, 1), +(31122, 31123, 2), +(31122, 61329, 3), + -- Vitality +(29140, 29140, 1), +(29140, 29143, 2), +(29140, 29144, 3), + -- Wand Specialization +(14524, 14524, 1), +(14524, 14525, 2), +(14524, 14526, 3), +(14524, 14527, 4), +(14524, 14528, 5), + -- Wandering Plague +(49217, 49217, 1), +(49217, 49654, 2), +(49217, 49655, 3), + -- Water Shield +(52127, 52127, 1), +(52127, 52129, 2), +(52127, 52131, 3), +(52127, 52134, 4), +(52127, 52136, 5), +(52127, 52138, 6), +(52127, 24398, 7), +(52127, 33736, 8), +(52127, 57960, 9), + -- Waylay +(51692, 51692, 1), +(51692, 51696, 2), + -- Weapon Expertise +(30919, 30919, 1), +(30919, 30920, 2), + -- Weapon Mastery +(20504, 20504, 1), +(20504, 20505, 2), + -- Weapon Mastery +(29082, 29082, 1), +(29082, 29084, 2), +(29082, 29086, 3), + -- Wild Growth +(48438, 48438, 1), +(48438, 53248, 2), +(48438, 53249, 3), +(48438, 53251, 4), + -- Wild Hunt +(62758, 62758, 1), +(62758, 62762, 2), + -- Wild Quiver +(53215, 53215, 1), +(53215, 53216, 2), +(53215, 53217, 3), + -- Windfury Weapon +(8232, 8232, 1), +(8232, 8235, 2), +(8232, 10486, 3), +(8232, 16362, 4), +(8232, 25505, 5), +(8232, 58801, 6), +(8232, 58803, 7), +(8232, 58804, 8), + -- Winter's Chill +(11180, 11180, 1), +(11180, 28592, 2), +(11180, 28593, 3), + -- World in Flames +(11108, 11108, 1), +(11108, 12349, 2), +(11108, 12350, 3), + -- Wrath +(5176, 5176, 1), +(5176, 5177, 2), +(5176, 5178, 3), +(5176, 5179, 4), +(5176, 5180, 5), +(5176, 6780, 6), +(5176, 8905, 7), +(5176, 9912, 8), +(5176, 26984, 9), +(5176, 26985, 10), +(5176, 48459, 11), +(5176, 48461, 12), + -- Wrath of Cenarius +(33603, 33603, 1), +(33603, 33604, 2), +(33603, 33605, 3), +(33603, 33606, 4), +(33603, 33607, 5), + -- Wrecking Crew +(46867, 46867, 1), +(46867, 56611, 2), +(46867, 56612, 3), +(46867, 56613, 4), +(46867, 56614, 5), + -- Arcane Brilliance +(23030, 23030, 1), +(23030, 27394, 2), + -- Arcane Explosion +(1467, 1467, 1), +(1467, 8440, 2), +(1467, 8441, 3), +(1467, 8442, 4), +(1467, 10203, 5), +(1467, 10204, 6), +(1467, 27380, 7), +(1467, 27381, 8), + -- Arcane Intellect +(1472, 1472, 1), +(1472, 1473, 2), +(1472, 1474, 3), +(1472, 1475, 4), +(1472, 10158, 5), +(1472, 27393, 6), +(1472, 42999, 7), + -- Arcane Missiles +(5143, 5143, 1), +(5143, 5144, 2), +(5143, 5145, 3), +(5143, 8416, 4), +(5143, 8417, 5), +(5143, 10211, 6), +(5143, 10212, 7), +(5143, 25345, 8), +(5143, 27075, 9), +(5143, 38699, 10), +(5143, 38704, 11), +(5143, 42843, 12), +(5143, 42846, 13), + -- Blessed Recovery +(27811, 27811, 1), +(27811, 27815, 2), +(27811, 27816, 3), + -- Blessed Recovery +(27813, 27813, 1), +(27813, 27817, 2), +(27813, 27818, 3), + -- Blessed Resilience +(33142, 33142, 1), +(33142, 33145, 2), +(33142, 33146, 3), + -- Blizzard +(1196, 1196, 1), +(1196, 6142, 2), +(1196, 8428, 3), +(1196, 10188, 4), +(1196, 10189, 5), +(1196, 10190, 6), +(1196, 27384, 7), + -- Blizzard +(42208, 42208, 1), +(42208, 42209, 2), +(42208, 42210, 3), +(42208, 42211, 4), +(42208, 42212, 5), +(42208, 42213, 6), +(42208, 42198, 7), +(42208, 42937, 8), +(42208, 42938, 9), + -- Blizzard +(10, 10, 1), +(10, 6141, 2), +(10, 8427, 3), +(10, 10185, 4), +(10, 10186, 5), +(10, 10187, 6), +(10, 27085, 7), +(10, 42939, 8), +(10, 42940, 9), + -- Chain Lightning +(421, 421, 1), +(421, 930, 2), +(421, 2860, 3), +(421, 10605, 4), +(421, 25439, 5), +(421, 25442, 6), +(421, 49270, 7), +(421, 49271, 8), + -- Chain Lightning +(45297, 45297, 1), +(45297, 45298, 2), +(45297, 45299, 3), +(45297, 45300, 4), +(45297, 45301, 5), +(45297, 45302, 6), +(45297, 49268, 7), +(45297, 49269, 8), + -- Charge +(7370, 7370, 1), +(7370, 26184, 2), +(7370, 26185, 3), +(7370, 26186, 4), +(7370, 26202, 5), +(7370, 28343, 6), + -- Consume Shadows +(17776, 17776, 1), +(17776, 17855, 2), +(17776, 17856, 3), +(17776, 17857, 4), +(17776, 17859, 5), +(17776, 17860, 6), + -- Consume Shadows +(20387, 20387, 1), +(20387, 20388, 2), +(20387, 20389, 3), +(20387, 20390, 4), +(20387, 20391, 5), +(20387, 20392, 6), +(20387, 27491, 7), +(20387, 48003, 8), +(20387, 48004, 9), + -- Cower +(1747, 1747, 1), +(1747, 1748, 2), +(1747, 1749, 3), +(1747, 1750, 4), +(1747, 1751, 5), +(1747, 16698, 6), +(1747, 27346, 7), + -- Echoes of Lordaeron +(6966, 6966, 1), +(6966, 30880, 2), +(6966, 30683, 3), +(6966, 30682, 4), +(6966, 29520, 5), + -- Echoes of Lordaeron +(6964, 6964, 1), +(6964, 11413, 2), +(6964, 11414, 3), +(6964, 11415, 4), +(6964, 1386, 5), + -- Eye for an Eye +(9799, 9799, 1), +(9799, 25988, 2), + -- Fire Nova +(1535, 1535, 1), +(1535, 8498, 2), +(1535, 8499, 3), +(1535, 11314, 4), +(1535, 11315, 5), +(1535, 25546, 6), +(1535, 25547, 7), +(1535, 61649, 8), +(1535, 61657, 9), + -- Fire Nova +(8349, 8349, 1), +(8349, 8502, 2), +(8349, 8503, 3), +(8349, 11306, 4), +(8349, 11307, 5), +(8349, 25535, 6), +(8349, 25537, 7), +(8349, 61650, 8), +(8349, 61654, 9), + -- Fire Protection +(7230, 7230, 1), +(7230, 7231, 2), +(7230, 7232, 3), +(7230, 7233, 4), +(7230, 7234, 5), + -- Fire Resistance +(24440, 24440, 1), +(24440, 24441, 2), +(24440, 24463, 3), +(24440, 24464, 4), +(24440, 27351, 5), + -- Fire Resistance +(8185, 8185, 1), +(8185, 10534, 2), +(8185, 10535, 3), +(8185, 25562, 4), +(8185, 58738, 5), +(8185, 58740, 6), + -- Fire Shield +(2949, 2949, 1), +(2949, 8318, 2), +(2949, 8319, 3), +(2949, 11772, 4), +(2949, 11773, 5), +(2949, 27486, 6), + -- Fire Shield +(20322, 20322, 1), +(20322, 20323, 2), +(20322, 20324, 3), +(20322, 20326, 4), +(20322, 20327, 5), +(20322, 27489, 6), +(20322, 47998, 7), + -- Flameblade +(7829, 7829, 1), +(7829, 7874, 2), +(7829, 7875, 3), + -- Flameblade +(7806, 7806, 1), +(7806, 7807, 2), +(7806, 7808, 3), + -- Flurry +(12319, 12319, 1), +(12319, 12971, 2), +(12319, 12972, 3), +(12319, 12973, 4), +(12319, 12974, 5), + -- Flurry +(12966, 12966, 1), +(12966, 12967, 2), +(12966, 12968, 3), +(12966, 12969, 4), +(12966, 12970, 5), + -- Focused Will +(45234, 45234, 1), +(45234, 45243, 2), +(45234, 45244, 3), + -- Focused Will +(45237, 45237, 1), +(45237, 45241, 2), +(45237, 45242, 3), + -- Frost Nova +(1194, 1194, 1), +(1194, 1225, 2), +(1194, 6132, 3), +(1194, 10231, 4), +(1194, 27387, 5), + -- Frost Protection +(7240, 7240, 1), +(7240, 7236, 2), +(7240, 7238, 3), +(7240, 7237, 4), +(7240, 7239, 5), + -- Frost Resistance +(24475, 24475, 1), +(24475, 24476, 2), +(24475, 24477, 3), +(24475, 24478, 4), +(24475, 27352, 5), + -- Frost Resistance +(8182, 8182, 1), +(8182, 10476, 2), +(8182, 10477, 3), +(8182, 25559, 4), +(8182, 58742, 5), +(8182, 58744, 6), + -- Frostbrand Attack +(8034, 8034, 1), +(8034, 8037, 2), +(8034, 10458, 3), +(8034, 16352, 4), +(8034, 16353, 5), +(8034, 25501, 6), +(8034, 58797, 7), +(8034, 58798, 8), +(8034, 58799, 9), + -- Healing Stream +(5672, 5672, 1), +(5672, 6371, 2), +(5672, 6372, 3), +(5672, 10460, 4), +(5672, 10461, 5), +(5672, 25566, 6), +(5672, 58763, 7), +(5672, 58764, 8), +(5672, 58765, 9), + -- Holy Nova +(15237, 15237, 1), +(15237, 15430, 2), +(15237, 15431, 3), +(15237, 27799, 4), +(15237, 27800, 5), +(15237, 27801, 6), +(15237, 25331, 7), +(15237, 48077, 8), +(15237, 48078, 9), + -- Holy Nova +(23455, 23455, 1), +(23455, 23458, 2), +(23455, 23459, 3), +(23455, 27803, 4), +(23455, 27804, 5), +(23455, 27805, 6), +(23455, 25329, 7), +(23455, 48075, 8), +(23455, 48076, 9), + -- Holy Protection +(7245, 7245, 1), +(7245, 7246, 2), +(7245, 7247, 3), +(7245, 7248, 4), +(7245, 7249, 5), +(7245, 17545, 6), + -- Holy Shock +(20473, 20473, 1), +(20473, 20929, 2), +(20473, 20930, 3), +(20473, 27174, 4), +(20473, 33072, 5), +(20473, 48824, 6), +(20473, 48825, 7), + -- Holy Shock +(25912, 25912, 1), +(25912, 25911, 2), +(25912, 25902, 3), +(25912, 27176, 4), +(25912, 33073, 5), +(25912, 48822, 6), +(25912, 48823, 7), + -- Holy Shock +(25914, 25914, 1), +(25914, 25913, 2), +(25914, 25903, 3), +(25914, 27175, 4), +(25914, 33074, 5), +(25914, 48820, 6), +(25914, 48821, 7), + -- Hurricane +(16914, 16914, 1), +(16914, 17401, 2), +(16914, 17402, 3), +(16914, 27012, 4), +(16914, 48467, 5), + -- Hurricane +(42231, 42231, 1), +(42231, 42232, 2), +(42231, 42233, 3), +(42231, 42230, 4), +(42231, 48466, 5), + -- Immolation Trap +(13795, 13795, 1), +(13795, 14302, 2), +(13795, 14303, 3), +(13795, 14304, 4), +(13795, 14305, 5), +(13795, 27023, 6), +(13795, 49055, 7), +(13795, 49056, 8), + -- Impact +(11103, 11103, 1), +(11103, 12357, 2), +(11103, 12358, 3), + -- Improved Mend Pet +(19572, 19572, 1), +(19572, 19573, 2), + -- Infusion of Light +(53569, 53569, 1), +(53569, 53576, 2), + -- Initiative +(13976, 13976, 1), +(13976, 13979, 2), +(13976, 13980, 3), + -- Intercept +(30154, 30154, 1), +(30154, 30199, 2), +(30154, 30200, 3), + -- Intercept +(30153, 30153, 1), +(30153, 30195, 2), +(30153, 30197, 3), +(30153, 47995, 4), + -- Intercept +(30151, 30151, 1), +(30151, 30194, 2), +(30151, 30198, 3), +(30151, 47996, 4), + -- Lash of Pain +(7876, 7876, 1), +(7876, 7877, 2), +(7876, 7878, 3), +(7876, 11781, 4), +(7876, 11782, 5), +(7876, 11783, 6), + -- Lay on Hands +(20233, 20233, 1), +(20233, 20236, 2), + -- Lay on Hands +(17233, 17233, 1), +(17233, 9257, 2), + -- Lightning Bolt +(403, 403, 1), +(403, 529, 2), +(403, 548, 3), +(403, 915, 4), +(403, 943, 5), +(403, 6041, 6), +(403, 10391, 7), +(403, 10392, 8), +(403, 15207, 9), +(403, 15208, 10), +(403, 25448, 11), +(403, 25449, 12), +(403, 49237, 13), +(403, 49238, 14), + -- Lightning Bolt +(45284, 45284, 1), +(45284, 45286, 2), +(45284, 45287, 3), +(45284, 45288, 4), +(45284, 45289, 5), +(45284, 45290, 6), +(45284, 45291, 7), +(45284, 45292, 8), +(45284, 45293, 9), +(45284, 45294, 10), +(45284, 45295, 11), +(45284, 45296, 12), +(45284, 49239, 13), +(45284, 49240, 14), + -- Lightning Shield +(324, 324, 1), +(324, 325, 2), +(324, 905, 3), +(324, 945, 4), +(324, 8134, 5), +(324, 10431, 6), +(324, 10432, 7), +(324, 25469, 8), +(324, 25472, 9), +(324, 49280, 10), +(324, 49281, 11), + -- Lightning Shield +(26364, 26364, 1), +(26364, 26365, 2), +(26364, 26366, 3), +(26364, 26367, 4), +(26364, 26369, 5), +(26364, 26370, 6), +(26364, 26363, 7), +(26364, 26371, 8), +(26364, 26372, 9), +(26364, 49278, 10), +(26364, 49279, 11), + -- Living Bomb +(44457, 44457, 1), +(44457, 55359, 2), +(44457, 55360, 3), + -- Living Bomb +(44461, 44461, 1), +(44461, 55361, 2), +(44461, 55362, 3), + -- Mind Sear +(48045, 48045, 1), +(48045, 53023, 2), + -- Mind Sear +(49821, 49821, 1), +(49821, 53022, 2), + -- Molten Armor +(34913, 34913, 1), +(34913, 43043, 2), +(34913, 43044, 3), + -- Molten Armor +(30482, 30482, 1), +(30482, 43045, 2), +(30482, 43046, 3), + -- Nature Protection +(7250, 7250, 1), +(7250, 7251, 2), +(7250, 7252, 3), +(7250, 7253, 4), +(7250, 7254, 5), + -- Nature Resistance +(24494, 24494, 1), +(24494, 24511, 2), +(24494, 24512, 3), +(24494, 24513, 4), +(24494, 27354, 5), + -- Nature Resistance +(10596, 10596, 1), +(10596, 10598, 2), +(10596, 10599, 3), +(10596, 25573, 4), +(10596, 58748, 5), +(10596, 58750, 6), + -- On a Pale Horse +(49146, 49146, 1), +(49146, 51267, 2), + -- Penance +(47540, 47540, 1), +(47540, 53005, 2), +(47540, 53006, 3), +(47540, 53007, 4), + -- Penance +(47750, 47750, 1), +(47750, 52983, 2), +(47750, 52984, 3), +(47750, 52985, 4), + -- Penance +(47666, 47666, 1), +(47666, 52998, 2), +(47666, 52999, 3), +(47666, 53000, 4), + -- Plague Strike +(59133, 59133, 1), +(59133, 66988, 2), +(59133, 66989, 3), +(59133, 66990, 4), +(59133, 66991, 5), +(59133, 66992, 6), + -- Prowl +(24451, 24451, 1), +(24451, 24454, 2), +(24451, 24455, 3), + -- Rain of Fire +(42223, 42223, 1), +(42223, 42224, 2), +(42223, 42225, 3), +(42223, 42226, 4), +(42223, 42218, 5), +(42223, 47817, 6), +(42223, 47818, 7), + -- Rain of Fire +(5740, 5740, 1), +(5740, 6219, 2), +(5740, 11677, 3), +(5740, 11678, 4), +(5740, 27212, 5), +(5740, 47819, 6), +(5740, 47820, 7), + -- Sacrifice +(7885, 7885, 1), +(7885, 19439, 2), +(7885, 19444, 3), +(7885, 19445, 4), +(7885, 19446, 5), +(7885, 19447, 6), + -- Sacrifice +(20381, 20381, 1), +(20381, 20382, 2), +(20381, 20383, 3), +(20381, 20384, 4), +(20381, 20385, 5), +(20381, 20386, 6), +(20381, 27492, 7), +(20381, 48001, 8), +(20381, 48002, 9), + -- Safeguard +(46945, 46945, 1), +(46945, 46949, 2), + -- Safeguard +(46946, 46946, 1), +(46946, 46947, 2), + -- Seed of Corruption +(27285, 27285, 1), +(27285, 47833, 2), +(27285, 47834, 3), + -- Seed of Corruption +(27243, 27243, 1), +(27243, 47835, 2), +(27243, 47836, 3), + -- Shadow Protection +(7235, 7235, 1), +(7235, 7241, 2), +(7235, 7242, 3), +(7235, 7243, 4), +(7235, 7244, 5), + -- Shadow Resistance +(24490, 24490, 1), +(24490, 24514, 2), +(24490, 24515, 3), +(24490, 24516, 4), +(24490, 27353, 5), + -- Soothing Kiss +(6362, 6362, 1), +(6362, 7879, 2), +(6362, 11786, 3), +(6362, 11787, 4), + -- Soothing Kiss +(20403, 20403, 1), +(20403, 20404, 2), +(20403, 20405, 3), +(20403, 20406, 4), +(20403, 27494, 5), + -- Spell Lock +(19648, 19648, 1), +(19648, 19650, 2), + -- Spell Lock +(20433, 20433, 1), +(20433, 20434, 2), + -- Starfall +(50286, 50286, 1), +(50286, 53196, 2), +(50286, 53197, 3), +(50286, 53198, 4), + -- Starfall +(50294, 50294, 1), +(50294, 53188, 2), +(50294, 53189, 3), +(50294, 53190, 4), + -- Starfall +(50288, 50288, 1), +(50288, 53191, 2), +(50288, 53194, 3), +(50288, 53195, 4), + -- Suffering +(17736, 17736, 1), +(17736, 17753, 2), +(17736, 17754, 3), +(17736, 17755, 4), + -- Suffering +(20393, 20393, 1), +(20393, 20394, 2), +(20393, 20395, 3), +(20393, 20396, 4), +(20393, 27500, 5), +(20393, 33703, 6), +(20393, 48005, 7), +(20393, 48006, 8), + -- Surge of Light +(33150, 33150, 1), +(33150, 33154, 2), + -- Tainted Blood +(19661, 19661, 1), +(19661, 19662, 2), +(19661, 19663, 3), +(19661, 19664, 4), + -- Tainted Blood +(20429, 20429, 1), +(20429, 20430, 2), +(20429, 20431, 3), +(20429, 20432, 4), +(20429, 27497, 5), + -- The Art of War +(53486, 53486, 1), +(53486, 53488, 2), + -- Thick Skin +(5364, 5364, 1), +(5364, 5368, 2), +(5364, 5369, 3), +(5364, 5370, 4), + -- Thick Skin +(5363, 5363, 1), +(5363, 5365, 2), +(5363, 5366, 3), +(5363, 5367, 4), + -- Torment +(7881, 7881, 1), +(7881, 7882, 2), +(7881, 7883, 3), +(7881, 7884, 4), +(7881, 11776, 5), +(7881, 11777, 6), + -- Tough Shell +(4112, 4112, 1), +(4112, 4113, 2), +(4112, 4115, 3), +(4112, 4114, 4), + -- Tough Shell +(4107, 4107, 1), +(4107, 4108, 2), +(4107, 4109, 3), +(4107, 4111, 4), + -- Tranquility +(740, 740, 1), +(740, 8918, 2), +(740, 9862, 3), +(740, 9863, 4), +(740, 26983, 5), +(740, 48446, 6), +(740, 48447, 7), + -- Tranquility +(44203, 44203, 1), +(44203, 44205, 2), +(44203, 44206, 3), +(44203, 44207, 4), +(44203, 44208, 5), +(44203, 48444, 6), +(44203, 48445, 7), + -- Typhoon +(61391, 61391, 1), +(61391, 61390, 2), +(61391, 61388, 3), +(61391, 61387, 4), +(61391, 53227, 5), + -- Typhoon +(50516, 50516, 1), +(50516, 53223, 2), +(50516, 53225, 3), +(50516, 53226, 4), +(50516, 61384, 5), + -- Unfair Advantage +(51675, 51675, 1), +(51675, 51677, 2), + -- Unfair Advantage +(51672, 51672, 1), +(51672, 51674, 2), + -- Unleashed Rage +(30802, 30802, 1), +(30802, 30808, 2), +(30802, 30809, 3), + -- Vindication +(9452, 9452, 1), +(9452, 26016, 2), + -- Vindication +(67, 67, 1), +(67, 26017, 2), + -- Volley +(42243, 42243, 1), +(42243, 42244, 2), +(42243, 42245, 3), +(42243, 42234, 4), +(42243, 58432, 5), +(42243, 58433, 6), + -- Volley +(1510, 1510, 1), +(1510, 14294, 2), +(1510, 14295, 3), +(1510, 27022, 4), +(1510, 58431, 5), +(1510, 58434, 6), + -- Will of the Necropolis +(52284, 52284, 1), +(52284, 52285, 2), +(52284, 52286, 3), + -- Will of the Necropolis +(49189, 49189, 1), +(49189, 50149, 2), +(49189, 50150, 3), + -- Wyvern Sting +(19386, 19386, 1), +(19386, 24132, 2), +(19386, 24133, 3), +(19386, 27068, 4), +(19386, 49011, 5), +(19386, 49012, 6), + -- First Aid +(746, 746, 1), +(746, 1159, 2), +(746, 3267, 3), +(746, 3268, 4), +(746, 7926, 5), +(746, 7927, 6), +(746, 10838, 7), +(746, 10839, 8), +(746, 18608, 9), +(746, 18610, 10), +(746, 27030, 11), +(746, 27031, 12), +(746, 45543, 13), +(746, 51827, 14), +(746, 45544, 15), +(746, 51803, 16), + -- Frost Strike +(49143, 49143, 1), +(49143, 51416, 2), +(49143, 51417, 3), +(49143, 51418, 4), +(49143, 51419, 5), +(49143, 55268, 6), + -- Intercept +(20253, 20253, 1), +(20253, 20614, 2), +(20253, 20615, 3), +(20253, 25273, 4), +(20253, 25274, 5), + -- Misery +(33191, 33191, 1), +(33191, 33192, 2), +(33191, 33193, 3), + -- Misery +(33196, 33196, 1), +(33196, 33197, 2), +(33196, 33198, 3), + -- Obliterate +(49020, 49020, 1), +(49020, 51423, 2), +(49020, 51424, 3), +(49020, 51425, 4), + -- Penance +(47758, 47758, 1), +(47758, 53001, 2), +(47758, 53002, 3), +(47758, 53003, 4), + -- Penance +(47757, 47757, 1), +(47757, 52986, 2), + -- Savage Rend +(50498, 50498, 1), +(50498, 53578, 2), +(50498, 53579, 3), +(50498, 53580, 4), +(50498, 53581, 5), +(50498, 53582, 6), + -- Spirit Bond +(19578, 19578, 1), +(19578, 20895, 2), + -- Spirit Bond +(19579, 19579, 1), +(19579, 24529, 2), + -- Stoneskin +(8072, 8072, 1), +(8072, 8156, 2), +(8072, 8157, 3), +(8072, 10403, 4), +(8072, 10404, 5), +(8072, 10405, 6), +(8072, 25506, 7), +(8072, 25507, 8), +(8072, 58752, 9), +(8072, 58754, 10), + -- Attack +(3606, 3606, 1), +(3606, 6350, 2), +(3606, 6351, 3), +(3606, 6352, 4), +(3606, 10435, 5), +(3606, 10436, 6), +(3606, 25530, 7), +(3606, 58700, 8), +(3606, 58701, 9), +(3606, 58702, 10), + -- Blood Strike +(45902, 45902, 1), +(45902, 49926, 2), +(45902, 49927, 3), +(45902, 49928, 4), +(45902, 49929, 5), +(45902, 49930, 6), + -- Elemental Devastation +(30160, 30160, 1), +(30160, 29179, 2), +(30160, 29180, 3), + -- Elemental Devastation +(30165, 30165, 1), +(30165, 29177, 2), +(30165, 29178, 3), + -- Fishing +(7620, 7620, 1), +(7620, 7731, 2), +(7620, 7732, 3), +(7620, 18248, 4), +(7620, 33095, 5), +(7620, 51294, 6), + -- Icy Touch +(45477, 45477, 1), +(45477, 49896, 2), +(45477, 49903, 3), +(45477, 49904, 4), +(45477, 49909, 5), + -- Judgements of the Pure +(53671, 53671, 1), +(53671, 53673, 2), +(53671, 54151, 3), +(53671, 54154, 4), +(53671, 54155, 5), + -- Judgements of the Pure +(53655, 53655, 1), +(53655, 53656, 2), +(53655, 53657, 3), +(53655, 54152, 4), +(53655, 54153, 5), + -- Master Tactician +(34506, 34506, 1), +(34506, 34507, 2), +(34506, 34508, 3), +(34506, 34838, 4), +(34506, 34839, 5), + -- Master Tactician +(34833, 34833, 1), +(34833, 34834, 2), +(34833, 34835, 3), +(34833, 34836, 4), +(34833, 34837, 5), + -- Plague Strike +(45462, 45462, 1), +(45462, 49917, 2), +(45462, 49918, 3), +(45462, 49919, 4), +(45462, 49920, 5), +(45462, 49921, 6), + -- Rapid Killing +(34948, 34948, 1), +(34948, 34949, 2), + -- Rapid Killing +(35098, 35098, 1), +(35098, 35099, 2), + -- Second Wind +(29841, 29841, 1), +(29841, 29842, 2), + -- Second Wind +(29834, 29834, 1), +(29834, 29838, 2), + -- Strength of Earth +(8076, 8076, 1), +(8076, 8162, 2), +(8076, 8163, 3), +(8076, 10441, 4), +(8076, 25362, 5), +(8076, 25527, 6), +(8076, 57621, 7), +(8076, 58646, 8), + -- Trauma +(46854, 46854, 1), +(46854, 46855, 2), + -- Trauma +(46856, 46856, 1), +(46856, 46857, 2), + -- Unbridled Wrath +(12322, 12322, 1), +(12322, 12999, 2), +(12322, 13000, 3), +(12322, 13001, 4), +(12322, 13002, 5), + -- Vanish +(11327, 11327, 1), +(11327, 11329, 2), +(11327, 26888, 3), + -- Blood Gorged +(50096, 50096, 1), +(50096, 50108, 2), +(50096, 50109, 3), +(50096, 50110, 4), +(50096, 50111, 5), + -- Blood Gorged +(61274, 61274, 1), +(61274, 61275, 2), +(61274, 61276, 3), +(61274, 61277, 4), +(61274, 61278, 5), + -- Blood Gorged +(61154, 61154, 1), +(61154, 61155, 2), +(61154, 61156, 3), +(61154, 61157, 4), +(61154, 61158, 5), + -- Cone of Cold +(1241, 1241, 1), +(1241, 8493, 2), +(1241, 10162, 3), +(1241, 10163, 4), +(1241, 10164, 5), +(1241, 27386, 6), + -- Flamestrike +(2124, 2124, 1), +(2124, 2125, 2), +(2124, 8425, 3), +(2124, 8426, 4), +(2124, 10217, 5), +(2124, 10218, 6), +(2124, 27385, 7), + -- Anesthetic Poison +(26688, 26688, 1), +(26688, 57981, 2), + -- Anesthetic Poison +(26785, 26785, 1), +(26785, 57982, 2), + -- Apprentice Riding +(33388, 33388, 1), +(33388, 33391, 2), +(33388, 34090, 3), +(33388, 34091, 4), + -- Primal Fury +(16958, 16958, 1), +(16958, 16961, 2), + -- Primal Fury +(37116, 37116, 1), +(37116, 37117, 2), + -- Nature Resist +(4548, 4548, 1), +(4548, 24502, 2), +(4548, 24503, 3), +(4548, 24504, 4), +(4548, 27055, 5), + -- Instant Poison +(8680, 8680, 1), +(8680, 8685, 2), +(8680, 8689, 3), +(8680, 11335, 4), +(8680, 11336, 5), +(8680, 11337, 6), +(8680, 26890, 7), +(8680, 57964, 8), +(8680, 57965, 9), + -- Instant Poison +(8679, 8679, 1), +(8679, 8686, 2), +(8679, 8688, 3), +(8679, 11338, 4), +(8679, 11339, 5), +(8679, 11340, 6), +(8679, 26891, 7), +(8679, 57967, 8), +(8679, 57968, 9), + -- Claw +(2980, 2980, 1), +(2980, 2981, 2), +(2980, 2982, 3), +(2980, 3667, 4), +(2980, 2975, 5), +(2980, 2976, 6), +(2980, 2977, 7), +(2980, 3666, 8), +(2980, 27347, 9), + -- Mace Specialization +(12284, 12284, 1), +(12284, 12701, 2), +(12284, 12702, 3), +(12284, 12703, 4), +(12284, 12704, 5), + -- Deadly Toxin +(11539, 11539, 1), +(11539, 11471, 2), +(11539, 11470, 3), +(11539, 11469, 4), + -- Deadly Poison +(2818, 2818, 1), +(2818, 2819, 2), +(2818, 11353, 3), +(2818, 11354, 4), +(2818, 25349, 5), +(2818, 26968, 6), +(2818, 27187, 7), +(2818, 57969, 8), +(2818, 57970, 9), + -- Deadly Poison +(2823, 2823, 1), +(2823, 2824, 2), +(2823, 11355, 3), +(2823, 11356, 4), +(2823, 25351, 5), +(2823, 26967, 6), +(2823, 27186, 7), +(2823, 57972, 8), +(2823, 57973, 9), + -- On a Pale Horse +(51983, 51983, 1), +(51983, 51986, 2), + -- On a Pale Horse +(51969, 51969, 1), +(51969, 51970, 2), + -- Wound Poison +(13218, 13218, 1), +(13218, 13222, 2), +(13218, 13223, 3), +(13218, 13224, 4), +(13218, 27189, 5), +(13218, 57974, 6), +(13218, 57975, 7), + -- Wound Poison +(13219, 13219, 1), +(13219, 13225, 2), +(13219, 13226, 3), +(13219, 13227, 4), +(13219, 27188, 5), +(13219, 57977, 6), +(13219, 57978, 7), + -- Thunderstomp +(26094, 26094, 1), +(26094, 26189, 2), +(26094, 26190, 3), +(26094, 27366, 4), + -- Obliterate +(66198, 66198, 1), +(66198, 66972, 2), +(66198, 66973, 3), +(66198, 66974, 4), + -- Frost Strike +(66196, 66196, 1), +(66196, 66958, 2), +(66196, 66959, 3), +(66196, 66960, 4), +(66196, 66961, 5), +(66196, 66962, 6), + -- Death Strike +(66188, 66188, 1), +(66188, 66950, 2), +(66188, 66951, 3), +(66188, 66952, 4), +(66188, 66953, 5), + -- Fiery Payback +(44440, 44440, 1), +(44440, 44441, 2), + -- Fiery Payback +(64353, 64353, 1), +(64353, 64357, 2), + -- Improved Flash Heal +(63504, 63504, 1), +(63504, 63505, 2), +(63504, 63506, 3), + -- Elemental Fury +(16089, 16089, 1), +(16089, 60184, 2), +(16089, 60185, 3), +(16089, 60187, 4), +(16089, 60188, 5), + -- Feral Swiftness +(17002, 17002, 1), +(17002, 24866, 2), + -- Master Shapeshifter +(48411, 48411, 1), +(48411, 48412, 2), + -- Nature's Majesty +(35363, 35363, 1), +(35363, 35364, 2), + -- Nature's Grace +(16880, 16880, 1), +(16880, 61345, 2), +(16880, 61346, 3), + -- Molten Skin +(63349, 63349, 1), +(63349, 63350, 2), +(63349, 63351, 3), + -- Master Demonologist +(23785, 23785, 1), +(23785, 23822, 2), +(23785, 23823, 3), +(23785, 23824, 4), +(23785, 23825, 5), + -- Death Rune Mastery +(49467, 49467, 1), +(49467, 50033, 2), +(49467, 50034, 3), + -- Improved Death Strike +(62905, 62905, 1), +(62905, 62908, 2), + -- Desolation +(66799, 66799, 1), +(66799, 66814, 2), +(66799, 66815, 3), +(66799, 66816, 4), +(66799, 66817, 5), + -- Mobility +(53483, 53483, 1), +(53483, 53485, 2), + -- Mobility +(53554, 53554, 1), +(53554, 53555, 2), + -- Arcane Missiles +(7268, 7268, 1), +(7268, 7269, 2), +(7268, 7270, 3), +(7268, 8419, 4), +(7268, 8418, 5), +(7268, 10273, 6), +(7268, 10274, 7), +(7268, 25346, 8), +(7268, 27076, 9), +(7268, 38700, 10), +(7268, 38703, 11), +(7268, 42844, 12), +(7268, 42845, 13), + -- Entangling Roots +(19975, 19975, 1), +(19975, 19974, 2), +(19975, 19973, 3), +(19975, 19972, 4), +(19975, 19971, 5), +(19975, 19970, 6), +(19975, 27010, 7), +(19975, 53313, 8), + -- Death Coil +(47541, 47541, 1), +(47541, 49892, 2), +(47541, 49893, 3), +(47541, 49894, 4), +(47541, 49895, 5), + -- Intellect +(8096, 8096, 1), +(8096, 8097, 2), +(8096, 8098, 3), +(8096, 12176, 4), +(8096, 33078, 5), +(8096, 43195, 6), +(8096, 48099, 7), +(8096, 48100, 8), + -- Stamina +(8099, 8099, 1), +(8099, 8100, 2), +(8099, 8101, 3), +(8099, 12178, 4), +(8099, 33081, 5), +(8099, 48101, 6), +(8099, 48102, 7), +(8099, 43198, 8), + -- Mutilate +(5374, 5374, 1), +(5374, 34414, 2), +(5374, 34416, 3), +(5374, 34419, 4), +(5374, 48662, 5), +(5374, 48665, 6), + -- Mutilate +(27576, 27576, 1), +(27576, 34415, 2), +(27576, 34417, 3), +(27576, 34418, 4), +(27576, 48661, 5), +(27576, 48664, 6), + -- Immolation trap +(13797, 13797, 1), +(13797, 14298, 2), +(13797, 14299, 3), +(13797, 14300, 4), +(13797, 14301, 5), +(13797, 27024, 6), +(13797, 49053, 7), +(13797, 49054, 8), + -- Sniper Training +(64418, 64418, 1), +(64418, 64419, 2), +(64418, 64420, 3), + -- Blood Strike +(66215, 66215, 1), +(66215, 66975, 2), +(66215, 66976, 3), +(66215, 66977, 4), +(66215, 66978, 5), +(66215, 66979, 6), + -- Stoneclaw Totem Effect +(5729, 5729, 1), +(5729, 6393, 2), +(5729, 6394, 3), +(5729, 6395, 4), +(5729, 10423, 5), +(5729, 10424, 6), +(5729, 25512, 7), +(5729, 58586, 8), +(5729, 58587, 9), +(5729, 58588, 10); +/*!40000 ALTER TABLE `spell_ranks` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `spell_target_position` +-- + +DROP TABLE IF EXISTS `spell_target_position`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_target_position` ( + `id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Identifier', + `target_map` smallint(5) unsigned NOT NULL DEFAULT '0', + `target_position_x` float NOT NULL DEFAULT '0', + `target_position_y` float NOT NULL DEFAULT '0', + `target_position_z` float NOT NULL DEFAULT '0', + `target_orientation` float NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Spell System'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_target_position` +-- + +LOCK TABLES `spell_target_position` WRITE; +/*!40000 ALTER TABLE `spell_target_position` DISABLE KEYS */; +/*!40000 ALTER TABLE `spell_target_position` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_threat` +-- + +DROP TABLE IF EXISTS `spell_threat`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spell_threat` ( + `entry` mediumint(8) unsigned NOT NULL, + `Threat` smallint(6) NOT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_threat` +-- + +LOCK TABLES `spell_threat` WRITE; +/*!40000 ALTER TABLE `spell_threat` DISABLE KEYS */; +INSERT INTO `spell_threat` VALUES (78,20),(284,39),(285,59),(770,108),(1608,78),(1672,180),(1715,61),(6572,155),(6574,195),(6809,89),(7372,101),(7373,141),(7379,235),(7386,100),(7405,140),(8380,180),(8972,118),(9745,148),(9880,178),(9881,207),(11556,43),(11564,98),(11565,118),(11566,137),(11567,145),(11596,220),(11597,261),(11600,275),(11601,315),(11775,395),(14921,415),(17735,200),(17750,300),(17751,450),(17752,600),(20736,100),(23922,160),(23923,190),(23924,220),(23925,250),(24394,580),(24583,5),(25286,175),(25288,355),(25289,60),(20243,101),(30016,101),(30022,101),(29707,196),(30324,220),(26996,176),(25258,286),(30356,323),(25269,400),(30357,483),(29704,230),(25225,300),(20569,100),(25231,130),(33745,285),(16857,108),(6343,17),(8198,40),(8204,64),(8205,96),(11580,143),(11581,180),(25264,215),(33878,129),(33986,180),(33987,232),(20925,20),(20927,30),(20928,40),(27179,54),(2139,300); +/*!40000 ALTER TABLE `spell_threat` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `spell_difficulty_dbc` +-- + +DROP TABLE IF EXISTS `spelldifficulty_dbc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `spelldifficulty_dbc` ( + `id` int(11) unsigned NOT NULL DEFAULT '0', + `spellid0` int(11) unsigned NOT NULL DEFAULT '0', + `spellid1` int(11) unsigned NOT NULL DEFAULT '0', + `spellid2` int(11) unsigned NOT NULL DEFAULT '0', + `spellid3` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `spell_difficulty_dbc` +-- + +LOCK TABLES `spelldifficulty_dbc` WRITE; +/*!40000 ALTER TABLE `spelldifficulty_dbc` DISABLE KEYS */; +INSERT INTO `spelldifficulty_dbc` VALUES +(3000, 47772, 56935, 0, 0), -- Magus Telestra - Ice Nova +(3001, 47773, 56934, 0, 0), -- Magus Telestra - Fire Bomb +(3002, 44189, 46164, 0, 0), -- SPELL_FIREBALL_NORMAL / SPELL_FIREBALL_HEROIC +(3003, 44190, 46163, 0, 0), -- SPELL_FLAMESTRIKE1_NORMAL / SPELL_FLAMESTRIKE1_HEROIC +(3004, 44174, 46192, 0, 0), -- SPELL_RENEW_NORMAL / SPELL_RENEW_HEROIC +(3005, 14032, 15654, 0, 0), -- SPELL_SW_PAIN_NORMAL / SPELL_SW_PAIN_HEROIC +(3006, 44318, 46380, 0, 0), -- SPELL_CHAIN_LIGHTNING / SPELL_H_CHAIN_LIGHTNING +(3007, 44319, 46381, 0, 0), -- SPELL_ARCANE_SHOCK / SPELL_H_ARCANE_SHOCK +(3008, 52771, 58830, 0, 0), -- SPELL_WOUNDING_STRIKE / H_SPELL_WOUNDING_STRIKE +(3009, 52720, 58852, 0, 0), -- SPELL_CARRION_SWARM / H_SPELL_CARRION_SWARM +(3010, 52722, 58850, 0, 0), -- SPELL_MIND_BLAST / H_SPELL_MIND_BLAST +(3011, 52721, 58849, 0, 0), -- SPELL_SLEEP / H_SPELL_SLEEP +(3012, 52666, 58824, 0, 0), -- SPELL_DISEASE_EXPULSION / H_SPELL_DISEASE_EXPULSION +(3013, 52696, 58823, 0, 0), -- SPELL_CONSTRICTING_CHAINS / H_SPELL_CONSTRICTING_CHAINS +(3014, 57725, 58827, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3015, 52445, 58822, 0, 0), -- SPELL_EXORCISM_N / SPELL_EXORCISM_H +(3016, 31473, 39049, 0, 0), -- SPELL_SAND_BREATH / H_SPELL_SAND_BREATH +(3017, 31457, 38538, 0, 0), -- SPELL_ARCANE_BLAST / H_SPELL_ARCANE_BLAST +(3018, 31472, 38539, 0, 0), -- SPELL_ARCANE_DISCHARGE / H_SPELL_ARCANE_DISCHARGE +(3019, 31475, 38593, 0, 0), -- SPELL_WING_BUFFET / H_SPELL_WING_BUFFET +(3020, 56130, 59467, 0, 0), -- SPELL_BROOD_PLAGUE / H_SPELL_BROOD_PLAGUE +(3021, 57941, 59974, 0, 0), -- SPELL_MIND_FLAY / H_SPELL_MIND_FLAY +(3022, 57942, 59975, 0, 0), -- SPELL_SHADOW_BOLT_VOLLEY / H_SPELL_SHADOW_BOLT_VOLLEY +(3023, 57949, 59978, 0, 0), -- SPELL_SHIVER / H_SPELL_SHIVER +(3024, 56855, 60030, 0, 0), -- SPELL_CYCLONE_STRIKE / SPELL_CYCLONE_STRIKE_H +(3025, 55959, 59513, 0, 0), -- SPELL_EMBRACE_OF_THE_VAMPYR / H_SPELL_EMBRACE_OF_THE_VAMPYR +(3026, 55926, 59508, 0, 0), -- SPELL_FLAME_SPHERE_PERIODIC / H_SPELL_FLAME_SPHERE_PERIODIC +(3027, 53472, 59433, 0, 0), -- SPELL_POUND / H_SPELL_POUND +(3028, 53400, 59419, 0, 0), -- SPELL_ACID_CLOUD / H_SPELL_ACID_CLOUD +(3029, 53030, 59417, 0, 0), -- SPELL_LEECH_POISON / H_SPELL_LEECH_POISON +(3030, 57731, 59421, 0, 0), -- SPELL_WEB_GRAB / H_SPELL_WEB_GRAB +(3031, 52586, 59367, 0, 0), -- SPELL_MIND_FLAY / H_SPELL_MIND_FLAY +(3032, 52592, 59368, 0, 0), -- SPELL_CURSE_OF_FATIGUE / H_SPELL_CURSE_OF_FATIGUE +(3033, 52592, 59368, 0, 0), -- SPELL_CURSE_OF_FATIGUE / H_SPELL_CURSE_OF_FATIGUE +(3034, 59363, 52446, 0, 0), -- SPELL_ACID_SPLASH / H_SPELL_ACID_SPLASH +(3035, 52534, 59357, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3036, 52535, 59358, 0, 0), -- SPELL_SHADOW_NOVA / H_SPELL_SHADOW_NOVA +(3037, 52469, 59364, 0, 0), -- SPELL_INFECTED_BITE / H_SPELL_INFECTED_BITE +(3038, 52469, 59364, 0, 0), -- SPELL_INFECTED_BITE / H_SPELL_INFECTED_BITE +(3039, 52524, 59365, 0, 0), -- SPELL_BLINDING_WEBS / H_SPELL_BLINDING_WEBS +(3040, 52469, 59364, 0, 0), -- SPELL_INFECTED_BITE / H_SPELL_INFECTED_BITE +(3041, 52493, 59366, 0, 0), -- SPELL_POSION_SPRAY / H_SPELL_POSION_SPRAY +(3042, 66538, 67676, 0, 0), -- SPELL_HOLY_FIRE / SPELL_HOLY_FIRE_H +(3043, 66536, 67674, 0, 0), -- SPELL_SMITE / SPELL_SMITE_H +(3044, 66537, 67675, 0, 0), -- SPELL_RENEW / SPELL_RENEW_H +(3045, 66537, 67675, 0, 0), -- SPELL_RENEW / SPELL_RENEW_H +(3046, 66620, 67679, 0, 0), -- SPELL_OLD_WOUNDS / SPELL_OLD_WOUNDS_H +(3047, 66552, 67677, 0, 0), -- SPELL_WAKING_NIGHTMARE / SPELL_WAKING_NIGHTMARE_H +(3048, 66619, 67678, 0, 0), -- SPELL_SHADOWS_PAST / SPELL_SHADOWS_PAST_H +(3049, 67881, 67718, 0, 0), -- SPELL_ICY_TOUCH / SPELL_ICY_TOUCH_H +(3050, 67881, 67718, 0, 0), -- SPELL_ICY_TOUCH / SPELL_ICY_TOUCH_H +(3051, 67883, 67725, 0, 0), -- SPELL_OBLITERATE / SPELL_OBLITERATE_H +(3052, 67875, 67808, 0, 0), -- SPELL_DEATH_BITE / SPELL_DEATH_BITE_H +(3053, 67749, 67880, 0, 0), -- SPELL_LEAP / SPELL_LEAP_H +(3054, 68783, 68784, 0, 0), -- SPELL_MORTAL_STRIKE / SPELL_MORTAL_STRIKE_H +(3055, 66042, 68310, 0, 0), -- SPELL_FIREBALL / SPELL_FIREBALL_H +(3056, 66042, 68310, 0, 0), -- SPELL_FIREBALL / SPELL_FIREBALL_H +(3057, 66043, 68311, 0, 0), -- SPELL_POLYMORPH / SPELL_POLYMORPH_H +(3058, 66044, 68312, 0, 0), -- SPELL_BLAST_WAVE / SPELL_BLAST_WAVE_H +(3059, 67529, 68319, 0, 0), -- SPELL_CHAIN_LIGHTNING / SPELL_CHAIN_LIGHTNING_H +(3060, 67528, 68318, 0, 0), -- SPELL_HEALING_WAVE / SPELL_HEALING_WAVE_H +(3061, 67528, 68318, 0, 0), -- SPELL_HEALING_WAVE / SPELL_HEALING_WAVE_H +(3062, 65868, 67988, 0, 0), -- SPELL_SHOOT / SPELL_SHOOT_H +(3063, 67709, 68317, 0, 0), -- SPELL_EVISCERATE / SPELL_EVISCERATE_H +(3064, 48849, 59422, 0, 0), -- SPELL_FEARSOME_ROAR / H_SPELL_FEARSOME_ROAR +(3065, 49527, 59972, 0, 0), -- SPELL_CURSE_OF_LIFE / H_SPELL_CURSE_OF_LIFE +(3066, 49528, 59973, 0, 0), -- SPELL_SHADOW_VOLLEY / H_SPELL_SHADOW_VOLLEY +(3067, 49518, 59971, 0, 0), -- SPELL_RAIN_OF_FIRE / H_SPELL_RAIN_OF_FIRE +(3068, 49537, 59963, 0, 0), -- SPELL_LIGHTNING_BREATH / H_SPELL_LIGHTNING_BREATH +(3069, 49544, 59965, 0, 0), -- SPELL_EYE_BEAM / H_SPELL_EYE_BEAM +(3070, 49548, 59969, 0, 0), -- SPELL_POISON_CLOUD / H_SPELL_POISON_CLOUD +(3071, 59803, 49381, 0, 0), -- SPELL_CONSUME / H_SPELL_CONSUME +(3072, 49555, 59807, 0, 0), -- SPELL_CORPSE_EXPLODE / H_SPELL_CORPSE_EXPLODE +(3073, 68793, 69050, 0, 0), -- SPELL_MAGIC_S_BANE / H_SPELL_MAGIC_S_BANE +(3074, 68858, 69047, 0, 0), -- SPELL_CONSUME_SOUL / H_SPELL_CONSUME_SOUL +(3075, 68982, 70322, 0, 0), -- SPELL_PHANTOM_BLAST / H_SPELL_PHANTOM_BLAST +(3076, 68895, 70212, 0, 0), -- SPELL_SPITE / H_SPELL_SPITE +(3077, 69148, 70210, 0, 0), -- SPELL_WAIL_OF_SOULS / H_SPELL_WAIL_OF_SOULS +(3078, 69060, 70209, 0, 0), -- SPELL_FROST_NOVA / H_SPELL_FROST_NOVA +(3079, 69080, 70206, 0, 0), -- SPELL_BONE_VOLLEY / H_SPELL_BONE_VOLLEY +(3080, 69069, 70207, 0, 0), -- SPELL_SHIELD_OF_BONES / H_SPELL_SHIELD_OF_BONES +(3081, 69068, 70208, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3082, 69068, 70208, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3083, 69066, 70213, 0, 0), -- SPELL_DRAIN_LIFE / H_SPELL_DRAIN_LIFE +(3084, 69564, 70205, 0, 0), -- SPELL_SHADOW_MEND / H_SPELL_SHADOW_MEND +(3085, 69088, 70211, 0, 0), -- SPELL_SOUL_STRIKE / H_SPELL_SOUL_STRIKE +(3086, 68774, 70334, 0, 0), -- SPELL_FORGE_BLADE / H_SPELL_FORGE_BLADE +(3087, 68785, 70335, 0, 0), -- SPELL_FORGE_MACE / H_SPELL_FORGE_MACE +(3088, 70381, 72930, 0, 0), -- SPELL_DEEP_FREEZE / H_SPELL_DEEP_FREEZE +(3089, 68778, 70333, 0, 0), -- SPELL_CHILLING_WAVE / H_SPELL_CHILLING_WAVE +(3090, 68989, 70434, 0, 0), -- SPELL_POISON_NOVA / H_SPELL_POISON_NOVA +(3091, 69024, 70436, 0, 0), -- SPELL_TOXIC_WASTE / H_SPELL_TOXIC_WASTE +(3092, 69155, 69627, 0, 0), -- SPELL_FORCEFUL_SMASH / H_SPELL_FORCEFUL_SMASH +(3093, 69167, 69629, 0, 0), -- SPELL_DARK_MIGHT / H_SPELL_DARK_MIGHT +(3094, 69233, 69646, 0, 0), -- SPELL_ICY_BLAST / H_SPELL_ICY_BLAST +(3095, 69238, 69628, 0, 0), -- SPELL_ICY_BLAST_2 / H_SPELL_ICY_BLAST_2 +(3096, 55626, 58993, 0, 0), -- SPELL_MOJO_WAVE / H_SPELL_MOJO_WAVE +(3097, 55627, 58994, 0, 0), -- SPELL_MOJO_PUDDLE / H_SPELL_MOJO_PUDDLE +(3098, 55250, 59824, 0, 0), -- SPELL_WHIRLING_SLASH / H_SPELL_WHIRLING_SLASH +(3099, 55276, 59826, 0, 0), -- SPELL_PUNCTURE / H_SPELL_PUNCTURE +(3100, 55285, 59828, 0, 0), -- SPELL_ENRAGE / H_SPELL_ENRAGE +(3101, 55292, 59829, 0, 0), -- SPELL_STOMP / H_SPELL_STOMP +(3102, 54956, 59827, 0, 0), -- SPELL_IMPALING_CHARGE / H_SPELL_IMPALING_CHARGE +(3103, 55102, 59444, 0, 0), -- SPELL_DETERMINED_GORE / H_SPELL_DETERMINED_GORE +(3104, 55081, 59842, 0, 0), -- SPELL_POISON_NOVA / H_SPELL_POISON_NOVA +(3105, 48287, 59840, 0, 0), -- SPELL_POWERFULL_BITE / H_SPELL_POWERFULL_BITE +(3106, 54970, 59839, 0, 0), -- SPELL_VENOM_BOLT / H_SPELL_VENOM_BOLT +(3107, 54987, 58996, 0, 0), -- SPELL_VENOMOUS_BITE / H_SPELL_VENOMOUS_BITE +(3108, 47751, 57062, 0, 0), -- SPELL_SPARK / H_SPELL_SPARK +(3109, 48096, 57091, 0, 0), -- SPELL_CRYSTALFIRE_BREATH / H_SPELL_CRYSTALFIRE_BREATH +(3110, 48016, 57066, 0, 0), -- SPELL_TRAMPLE / H_SPELL_TRAMPLE +(3111, 47944, 57067, 0, 0), -- SPELL_CRYSTALL_SPIKE_DAMAGE / H_SPELL_CRYSTALL_SPIKE_DAMAGE +(3112, 50774, 59370, 0, 0), -- SPELL_THUNDERING_STOMP / SPELL_THUNDERING_STOMP_H +(3113, 52774, 59160, 0, 0), -- SPELL_RENEW_STEEL_N / SPELL_RENEW_STEEL_H +(3114, 52658, 59795, 0, 0), -- SPELL_STATIC_OVERLOAD / H_SPELL_STATIC_OVERLOAD +(3115, 52780, 59800, 0, 0), -- SPELL_BALL_LIGHTNING / H_SPELL_BALL_LIGHTNING +(3116, 52961, 59836, 0, 0), -- SPELL_PULSING_SHOCKWAVE_N / SPELL_PULSING_SHOCKWAVE_H +(3117, 52960, 59835, 0, 0), -- SPELL_LIGHTNING_NOVA_N / SPELL_LIGHTNING_NOVA_H +(3118, 52237, 59529, 0, 0), -- SPELL_SHATTERING_STOMP_N / SPELL_SHATTERING_STOMP_H +(3119, 52433, 59530, 0, 0), -- SPELL_IMMOLATION_STRIKE_N / SPELL_IMMOLATION_STRIKE_H +(3120, 50843, 59742, 0, 0), -- SPELL_BOULDER_TOSS / H_SPELL_BOULDER_TOSS +(3121, 48131, 59744, 0, 0), -- SPELL_STOMP / H_SPELL_STOMP +(3122, 50810, 61546, 0, 0), -- SPELL_SHATTER / H_SPELL_SHATTER +(3123, 50752, 59772, 0, 0), -- SPELL_STORM_OF_GRIEF_N / SPELL_STORM_OF_GRIEF_H +(3124, 50760, 59726, 0, 0), -- SPELL_SHOCK_OF_SORROW_N / SPELL_SHOCK_OF_SORROW_H +(3125, 50761, 59727, 0, 0), -- SPELL_PILLAR_OF_WOE_N / SPELL_PILLAR_OF_WOE_H +(3126, 50761, 59727, 0, 0), -- SPELL_PILLAR_OF_WOE_N / SPELL_PILLAR_OF_WOE_H +(3127, 50830, 59844, 0, 0), -- SPELL_CHAIN_LIGHTING / H_SPELL_CHAIN_LIGHTING +(3128, 50831, 59845, 0, 0), -- SPELL_LIGHTING_SHIELD / H_SPELL_LIGHTING_SHIELD +(3129, 50834, 59846, 0, 0), -- SPELL_STATIC_CHARGE / H_SPELL_STATIC_CHARGE +(3130, 51849, 59861, 0, 0), -- SPELL_LIGHTING_RING / H_SPELL_LIGHTING_RING +(3131, 42730, 59735, 0, 0), -- SPELL_WOE_STRIKE / H_SPELL_WOE_STRIKE +(3132, 42669, 59706, 0, 0), -- SPELL_SMASH / H_SPELL_SMASH +(3133, 42705, 59707, 0, 0), -- SPELL_ENRAGE / H_SPELL_ENRAGE +(3134, 42729, 59734, 0, 0), -- SPELL_DREADFUL_ROAR / H_SPELL_DREADFUL_ROAR +(3135, 42708, 59708, 0, 0), -- SPELL_STAGGERING_ROAR / H_SPELL_STAGGERING_ROAR +(3136, 42750, 59719, 0, 0), -- SPELL_SHADOW_AXE_DAMAGE / H_SPELL_SHADOW_AXE_DAMAGE +(3137, 43649, 59575, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3138, 48261, 59268, 0, 0), -- SPELL_IMPALE / H_SPELL_IMPALE +(3139, 48256, 59267, 0, 0), -- SPELL_WITHERING_ROAR / H_SPELL_WITHERING_ROAR +(3140, 48140, 59273, 0, 0), -- SPELL_CHAIN_LIGHTING / H_SPELL_CHAIN_LIGHTING +(3141, 48137, 59265, 0, 0), -- SPELL_MORTAL_WOUND / H_SPELL_MORTAL_WOUND +(3142, 48130, 59264, 0, 0), -- SPELL_GORE / H_SPELL_GORE +(3143, 48105, 59263, 0, 0), -- SPELL_GRIEVOUS_WOUND / H_SPELL_GRIEVOUS_WOUND +(3144, 48133, 59271, 0, 0), -- SPELL_POISON_BREATH / H_SPELL_POISON_BREATH +(3145, 48133, 59271, 0, 0), -- SPELL_POISON_BREATH / H_SPELL_POISON_BREATH +(3146, 50234, 59330, 0, 0), -- SPELL_CRUSH / H_SPELL_CRUSH +(3147, 50225, 59331, 0, 0), -- SPELL_POISONED_SPEAR / H_SPELL_POISONED_SPEAR +(3148, 15667, 59409, 0, 0), -- SPELL_SINSTER_STRIKE / H_SPELL_SINSTER_STRIKE +(3149, 48294, 59301, 0, 0), -- SPELL_BANE / H_SPELL_BANE +(3150, 48291, 59300, 0, 0), -- SPELL_FETID_ROT / H_SPELL_FETID_ROT +(3151, 48423, 59304, 0, 0), -- SPELL_SPIRIT_STRIKE / H_SPELL_SPIRIT_STRIKE +(3152, 48529, 59305, 0, 0), -- SPELL_SPIRIT_BURST / H_SPELL_SPIRIT_BURST +(3153, 58693, 59369, 0, 0), -- SPELL_BLIZZARD / H_SPELL_BLIZZARD +(3154, 58690, 59283, 0, 0), -- SPELL_TAIL_SWEEP / H_SPELL_TAIL_SWEEP +(3155, 58688, 59281, 0, 0), -- SPELL_UNCONTROLLABLE_ENERGY / H_SPELL_UNCONTROLLABLE_ENERGY +(3156, 54479, 59471, 0, 0), -- SPELL_EARTH_SHIELD / H_SPELL_EARTH_SHIELD +(3157, 54479, 59471, 0, 0), -- SPELL_EARTH_SHIELD / H_SPELL_EARTH_SHIELD +(3158, 54481, 59473, 0, 0), -- SPELL_CHAIN_HEAL / H_SPELL_CHAIN_HEAL +(3159, 54312, 59522, 0, 0), -- SPELL_FRENZY / SPELL_FRENZY_H +(3160, 54237, 59520, 0, 0), -- SPELL_WATER_BLAST / SPELL_WATER_BLAST_H +(3161, 54241, 59521, 0, 0), -- SPELL_WATER_BOLT_VOLLEY / SPELL_WATER_BOLT_VOLLEY_H +(3162, 54235, 59468, 0, 0), -- SPELL_FIREBOLT / H_SPELL_FIREBOLT +(3163, 54282, 59469, 0, 0), -- SPELL_FLAME_BREATH / H_SPELL_FLAME_BREATH +(3164, 54249, 59594, 0, 0), -- SPELL_LAVA_BURN / H_SPELL_LAVA_BURN +(3165, 54202, 59483, 0, 0), -- SPELL_ARCANE_BARRAGE_VOLLEY / SPELL_ARCANE_BARRAGE_VOLLEY_H +(3166, 54226, 59485, 0, 0), -- SPELL_ARCANE_BUFFET / SPELL_ARCANE_BUFFET_H +(3167, 54160, 59474, 0, 0), -- SPELL_ARCANE_POWER / H_SPELL_ARCANE_POWER +(3168, 54361, 59743, 0, 0), -- SPELL_VOID_SHIFT / H_SPELL_VOID_SHIFT +(3169, 54524, 59745, 0, 0), -- SPELL_SHROUD_OF_DARKNESS / H_SPELL_SHROUD_OF_DARKNESS +(3170, 54342, 59747, 0, 0), -- SPELL_ZURAMAT_ADD_2 / H_SPELL_ZURAMAT_ADD_2 +(3171, 32325, 38760, 0, 0), -- SPELL_VOID_BLAST / H_SPELL_VOID_BLAST +(3172, 32358, 38759, 0, 0), -- SPELL_DARK_SHELL / H_SPELL_DARK_SHELL +(3173, 38197, 40425, 0, 0), -- SPELL_ARCANE_EXPLOSION / H_SPELL_ARCANE_EXPLOSION +(3174, 35059, 40424, 0, 0), -- SPELL_ARCANE_VOLLEY / H_SPELL_ARCANE_VOLLEY +(3175, 38245, 43309, 0, 0), -- SPELL_POLYMORPH / H_SPELL_POLYMORPH +(3176, 33617, 39363, 0, 0), -- SPELL_RAIN_OF_FIRE / H_SPELL_RAIN_OF_FIRE +(3177, 34449, 37924, 0, 0), -- SPELL_WATER_BOLT_VOLLEY / H_SPELL_WATER_BOLT_VOLLEY +(3178, 31532, 37936, 0, 0), -- SPELL_REPAIR / H_SPELL_REPAIR +(3179, 33132, 37371, 0, 0), -- SPELL_FIRE_NOVA / H_SPELL_FIRE_NOVA +(3180, 28599, 40070, 0, 0), -- SPELL_SHADOW_BOLT_VOLLEY / H_SPELL_SHADOW_BOLT_VOLLEY +(3181, 49381, 59805, 0, 0), -- SPELL_CONSUME_AURA / H_SPELL_CONSUME_AURA +(3182, 30695, 37566, 0, 0), -- SPELL_TREACHEROUS_AURA / H_SPELL_BANE_OF_TREACHERY +(3183, 30686, 39297, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3184, 30641, 36814, 0, 0), -- SPELL_MORTAL_WOUND / H_SPELL_MORTAL_WOUND +(3185, 30495, 35953, 0, 0), -- SPELL_SHADOW_CLEAVE / H_SPELL_SHADOW_SLAM +(3186, 30598, 36056, 0, 0), -- SPELL_BURNING_MAUL / H_SPELL_BURNING_MAUL +(3187, 36924, 39017, 0, 0), -- SPELL_MIND_REND / H_SPELL_MIND_REND +(3188, 36924, 39017, 0, 0), -- SPELL_MIND_REND / H_SPELL_MIND_REND +(3189, 37162, 39019, 0, 0), -- SPELL_DOMINATION / H_SPELL_DOMINATION +(3190, 37162, 39019, 0, 0), -- SPELL_DOMINATION / H_SPELL_DOMINATION +(3191, 35322, 39193, 0, 0), -- SPELL_SHADOW_POWER / H_SPELL_SHADOW_POWER +(3192, 35327, 39194, 0, 0), -- SPELL_JACKHAMMER / H_SPELL_JACKHAMMER +(3193, 35275, 39084, 0, 0), -- SPELL_SUMMON_RAGIN_FLAMES / H_SPELL_SUMMON_RAGIN_FLAMES +(3194, 35268, 39346, 0, 0); -- SPELL_INFERNO / H_SPELL_INFERNO +/*!40000 ALTER TABLE `spelldifficulty_dbc` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `transports` +-- + +DROP TABLE IF EXISTS `transports`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `transports` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name` text, + `period` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Transports'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `transports` +-- + +LOCK TABLES `transports` WRITE; +/*!40000 ALTER TABLE `transports` DISABLE KEYS */; +/*!40000 ALTER TABLE `transports` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `trinity_string` +-- + +DROP TABLE IF EXISTS `trinity_string`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `trinity_string` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `trinity_string` +-- + +LOCK TABLES `trinity_string` WRITE; +/*!40000 ALTER TABLE `trinity_string` DISABLE KEYS */; +INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`) VALUES +(1, 'You should select a character or a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2, 'You should select a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(3, '|cffff0000[System Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(4, '|cffff0000[Event Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5, 'There is no help for that command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6, 'There is no such command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7, 'There is no such subcommand', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(8, 'Command %s have subcommands:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(9, 'Commands available to you:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10, 'Incorrect syntax.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(11, 'Your account level is: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12, 'Active connections: %u (max: %u) Queued connections: %u (max: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(13, 'Server uptime: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(14, 'Player saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(15, 'All players saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(16, 'There are the following active GMs on this server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(17, 'There are no GMs currently logged in on this server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(18, 'Cannot do that while flying.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(19, 'Cannot do that in Battlegrounds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(20, 'Target is flying you can''t do that.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(21, '%s is flying command failed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(22, 'You are not mounted so you can''t dismount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(23, 'Cannot do that while fighting.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(24, 'You used it recently.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(25, 'Password not changed (unknown error)!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(26, 'The password was changed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(27, 'The old password is wrong', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(28, 'Your account is now locked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(29, 'Your account is now unlocked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(30, ', rank ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(31, ' [known]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(32, ' [learn]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(33, ' [passive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(34, ' [talent]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(35, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(36, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(37, ' (offline)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(38, 'on', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(39, 'off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(40, 'You are: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(41, 'visible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(42, 'invisible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(43, 'done', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(44, 'You', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(45, ' ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(46, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(47, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(48, 'UNKNOWN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(49, 'You must be at least level %u to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(50, 'You must be at least level %u and have item %s to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(51, 'Hello! Ready for some training?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(52, 'Invaid item count (%u) for item %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(53, 'Mail can''t have more %u item stacks', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(54, 'The new passwords do not match', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(55, 'Your password can''t be longer than 16 characters (client limit), password not changed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(56, 'Current Message of the day: \r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(57, 'Using World DB: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(58, 'Using script library: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(59, 'Using creature EventAI: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(60, 'Online players: %u (max: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(61, 'Up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(62, 'One on more parameters have incorrect values', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(100, 'Global notify: ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(101, 'Map: %u (%s) Zone: %u (%s) Area: %u (%s) Phase: %u\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(102, '%s is already being teleported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(103, 'You can summon a player to your instance only if he is in your party with you as leader.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(104, 'You cannot go to the player''s instance because you are in a party now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(105, 'You can go to the player''s instance while not being in his party only if your GM mode is on.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(106, 'You can not go to player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(107, 'You can not summon player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(108, 'You are summoning %s%s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(109, 'You are being summoned by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(110, 'You are teleporting %s%s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(111, 'You are being teleported by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(112, 'Player (%s) does not exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(113, 'Appearing at %s''s location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(114, '%s is appearing to your location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(115, 'Incorrect values.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(116, 'No character selected.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(117, '%s is not in a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(118, 'You changed HP of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(119, '%s changed your HP to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(120, 'You changed MANA of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(121, '%s changed your MANA to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(122, 'You changed ENERGY of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(123, '%s changed your ENERGY to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(124, 'Current energy: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(125, 'You changed rage of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(126, '%s changed your rage to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(127, 'You changed level of %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(128, 'GUID %i, faction is %i, flags is %i, npcflag is %i, DY flag is %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(129, 'Wrong faction: %u (not found in factiontemplate.dbc).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(130, 'You changed GUID=%i ''s Faction to %i, flags to %i, npcflag to %i, dyflag to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(131, 'You changed the spellflatid=%i, val= %i, mark =%i to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(132, '%s changed your spellflatid=%i, val= %i, mark =%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(133, '%s has access to all taxi nodes now (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(134, '%s has no more access to all taxi nodes now (only visited accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(135, '%s has given you access to all taxi nodes (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(136, '%s has removed access to all taxi nodes (only visited still accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(137, 'You set all speeds to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(138, '%s set all your speeds to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(139, 'You set the speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(140, '%s set your speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(141, 'You set the swim speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(142, '%s set your swim speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(143, 'You set the backwards run speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(144, '%s set your backwards run speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(145, 'You set the fly speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(146, '%s set your fly speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(147, 'You set the size %2.2f of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(148, '%s set your size to %2.2f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(149, 'There is no such mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(150, 'You give a mount to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(151, '%s gave you a mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(152, 'USER1: %i, ADD: %i, DIF: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(153, 'You take all copper of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(154, '%s took you all of your copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(155, 'You take %i copper from %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(156, '%s took %i copper from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(157, 'You give %i copper to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(158, '%s gave you %i copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(159, 'You hear sound %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(160, 'USER2: %i, ADD: %i, RESULT: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(161, 'Removed bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(162, 'Set bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(163, 'Teleport location table is empty!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(164, 'Teleport location not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(165, 'Requires search parameter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(166, 'There are no teleport locations matching your request.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(168, 'Locations found are:\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(169, 'Mail sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(170, 'You try to hear sound %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(171, 'You can''t teleport self to self!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(172, 'server console command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(173, 'You changed runic power of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(174, '%s changed your runic power to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(175, 'Liquid level: %f, ground: %f, type: %d, status: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(200, 'No selection.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(201, 'Object GUID is: lowpart %u highpart %X', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(202, 'The name was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(203, 'Error, name can only contain characters A-Z and a-z.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(204, 'The subname was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(205, 'Not yet implemented', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(206, 'Item ''%i'' ''%s'' added to list with maxcount ''%i'' and incrtime ''%i'' and extendedcost ''%i''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(207, 'Item ''%i'' not found in database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(208, 'Item ''%i'' ''%s'' deleted from vendor list', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(209, 'Item ''%i'' not found in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(210, 'Item ''%u'' (with extended cost %u) already in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(211, 'Spells of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(212, 'Spells of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(213, 'Talents of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(214, 'Talents of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(215, 'Your spells have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(216, 'Your talents have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(217, 'Unknown case ''%s'' for .resetall command. Type full correct case name.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(218, 'Spells will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(219, 'Talents will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(220, 'Creature (GUID: %u) No waypoint found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(221, 'Creature (GUID: %u) Last waypoint not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(222, 'Creature (GUID: %u) No waypoint found - used ''wpguid''. Now trying to find it by its position...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(223, 'Creature (GUID: %u) No waypoints found - This is a MaNGOS db problem (single float).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(224, 'Selected creature is ignored - provided GUID is used', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(225, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(226, 'You must select a visual waypoint.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(227, 'No visual waypoints found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(228, 'Could not create visual waypoint with creatureID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(229, 'All visual waypoints removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(230, 'Could not create waypoint-creature with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(231, 'No GUID provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(232, 'No waypoint number provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(233, 'Argument required for ''%s''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(234, 'Waypoint %i added to GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(235, 'Waypoint %d added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(236, 'Waypoint changed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(237, 'Waypoint %s modified.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(238, 'WP export successfull.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(239, 'No waypoints found inside the database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(240, 'File imported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(241, 'Waypoint removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(242, 'Warning: Could not delete WP from the world with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(243, 'This happens if the waypoint is too far away from your char.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(244, 'The WP is deleted from the database, but not from the world here.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(245, 'They will disappear after a server restart.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(246, 'Waypoint %d: Info for creature: %s, GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(247, 'Waittime: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(248, 'Model %d: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(249, 'Emote: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(250, 'Spell: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(251, 'Text%d (ID: %i): %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(252, 'AIScript: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(253, 'Forced rename for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(254, 'Forced rename for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(255, 'Waypoint-Creature (GUID: %u) Not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(256, 'Could not find NPC...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(257, 'Creature movement type set to ''%s'', waypoints removed (if any).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(258, 'Creature movement type set to ''%s'', waypoints were not removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(259, 'Incorrect value, use on or off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(260, 'Value saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(261, 'Value saved, you may need to rejoin or clean your client cache.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(262, 'Areatrigger ID %u not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(263, 'Target map or coordinates is invalid (X: %f Y: %f MapId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(264, 'Zone coordinates is invalid (X: %f Y: %f AreaId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(265, 'Zone %u (%s) is part of instanceable map %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(266, 'Nothing found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(267, 'Object not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(268, 'Creature not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(269, 'Warning: Mob found more than once - you will be teleported to the first one found in DB.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(270, 'Creature Removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(271, 'Creature moved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(272, 'Creature (GUID:%u) must be on the same map as player!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(273, 'Game Object (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(274, 'Game Object (GUID: %u) has references in not found creature %u GO list, can''t be deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(275, 'Game Object (GUID: %u) removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(276, 'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) turned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(277, 'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) moved', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(278, 'You must select a vendor', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(279, 'You must send id for item', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(280, 'Vendor has too many items (max 128)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(281, 'You can''t kick self, logout instead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(282, 'Player %s kicked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(284, 'Accepting Whisper: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(285, 'Accepting Whisper: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(286, 'Accepting Whisper: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(287, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(288, 'Tickets count: %i show new tickets: %s\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(289, 'New ticket from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(290, 'Ticket of %s (Last updated: %s):\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(291, 'New ticket show: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(292, 'New ticket show: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(293, 'Ticket %i doesn''t exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(294, 'All tickets deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(295, 'Character %s ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(296, 'Ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(297, 'Spawn distance changed to: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(298, 'Spawn time changed to: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(299, 'The honor of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(300, 'Your chat has been disabled for %u minutes. Reason: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(301, 'You have disabled %s''s chat for %u minutes. Reason: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(302, 'Player''s chat is already enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(303, 'Your chat has been enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(304, 'You have enabled %s''s chat.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(305, 'Faction %s (%u) reputation of %s was set to %5d!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(306, 'The arena points of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(307, 'No faction found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(308, 'Faction %i unknown!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(309, 'Invalid parameter %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(310, 'delta must be between 0 and %d (inclusive)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(311, '%d - |cffffffff|Hfaction:%d|h[%s]|h|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(312, ' [visible]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(313, ' [at war]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(314, ' [peace forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(315, ' [hidden]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(316, ' [invisible forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(317, ' [inactive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(318, 'Hated', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(319, 'Hostile', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(320, 'Unfriendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(321, 'Neutral', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(322, 'Friendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(323, 'Honored', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(324, 'Revered', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(325, 'Exalted', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(326, 'Faction %s (%u) can''nt have reputation.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(327, ' [no reputation]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(328, 'Characters at account %s (Id: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(329, ' %s (GUID %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(330, 'No players found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(331, 'Extended item cost %u not exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(332, 'GM mode is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(333, 'GM mode is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(334, 'GM Chat Badge is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(335, 'GM Chat Badge is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(336, 'You repair all %s''s items.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(337, 'All your items repaired by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(338, 'You set waterwalk mode %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(339, 'Your waterwalk mode %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(340, '%s is now following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(341, '%s is not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(342, '%s is now not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(343, 'Creature (Entry: %u) cannot be tamed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(344, 'You already have pet.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(345, 'Forced customize for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(346, 'Forced customize for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(347, 'TaxiNode ID %u not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(348,'Game Object (Entry: %u) have invalid data and can''t be spawned',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(349,'%d (idx:%d) - |cffffffff|Htitle:%d|h[%s %s]|h|r %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(350,'%d (idx:%d) - [%s %s] %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(351,'No titles found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(352,'Invalid title id: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(353,'Title %u (%s) added to known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(354,'Title %u (%s) removed from known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(355,'Title %u (%s) set as current seelcted title for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(356,'Current selected title for player %s reset as not known now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(400, '|cffff0000[System Message]:|rScripts reloaded', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(401, 'You change security level of account %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(402, '%s changed your security level to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(403, 'You have low security level for this.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(404, 'Creature movement disabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(405, 'Creature movement enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(406, 'Weather can''t be changed for this zone.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(407, 'Weather system disabled at server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(408, '%s is banned for %s. Reason: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(409, '%s is banned permanently for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(410, '%s %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(411, '%s unbanned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(412, 'There was an error removing the ban on %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(413, 'Account not exist: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(414, 'There is no such character.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(415, 'There is no such IP in banlist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(416, 'Account %s has never been banned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(417, 'Ban history for account %s:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(418, 'Ban Date: %s Bantime: %s Still active: %s Reason: %s Set by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(419, 'Inf.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(420, 'Never', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(421, 'Yes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(422, 'No', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(423, 'IP: %s\nBan Date: %s\nUnban Date: %s\nRemaining: %s\nReason: %s\nSet by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(424, 'There is no matching IPban.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(425, 'There is no matching account.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(426, 'There is no banned account owning a character matching this part.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(427, 'The following IPs match your pattern:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(428, 'The following accounts match your query:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(429, 'You learned many spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(430, 'You learned all spells for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(431, 'You learned all talents for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(432, 'You learned all languages.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(433, 'You learned all craft skills and recipes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(434, 'Could not find ''%s''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(435, 'Invalid item id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(436, 'No items found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(437, 'Invalid gameobject id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(438, 'Found items %u: %u ( inventory %u mail %u auction %u guild %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(439, 'Found gameobjects %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(440, 'Invalid creature id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(441, 'Found creatures %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(442, 'No area found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(443, 'No item sets found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(444, 'No skills found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(445, 'No spells found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(446, 'No quests found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(447, 'No creatures found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(448, 'No gameobjects found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(449, 'Graveyard #%u doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(450, 'Graveyard #%u already linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(451, 'Graveyard #%u linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(452, 'Graveyard #%u can''t be linked to subzone or not existed zone #%u (internal error).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(454, 'No faction in Graveyard with id= #%u , fix your DB', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(455, 'invalid team, please fix database', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(456, 'any', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(457, 'alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(458, 'horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(459, 'Graveyard #%u (faction: %s) is nearest from linked to zone #%u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(460, 'Zone #%u doesn''t have linked graveyards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(461, 'Zone #%u doesn''t have linked graveyards for faction: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(462, 'Teleport location already exists!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(463, 'Teleport location added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(464, 'Teleport location NOT added: database error.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(465, 'Teleport location deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(466, 'No taxinodes found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(467, 'Target unit has %d auras:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(468, 'id: %d effmask: %d charges: %d stack: %d slot %d duration: %d maxduration: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(469, 'Target unit has %d auras of type %d:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(470, 'id: %d eff: %d amount: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(471, 'Quest %u not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(472, 'Quest %u started from item. For correct work, please, add item to inventory and start quest in normal way: .additem %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(473, 'Quest removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(474, ' [rewarded]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(475, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(476, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(477, '%s''s Fly Mode %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(478, 'Opcode %u sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(479, 'Character loaded successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(480, 'Failed to load the character!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(481, 'Character dumped successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(482, 'Character dump failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(483, 'Spell %u broken and not allowed to cast or learn!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(484, 'Skill %u (%s) for player %s set to %u and current maximum set to %u (without permanent (talent) bonuses).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(485, 'Player %s must have skill %u (%s) before using this command.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(486, 'Invalid skill id (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(487, 'You learned default GM spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(488, 'You already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(489, 'Target(%s) already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(490, '%s doesn''t know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(491, 'You already forgot that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(492, 'All spell cooldowns removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(493, 'Spell %u cooldown removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(494, 'Command : Additem, itemId = %i, amount = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(495, 'Command : Additemset, itemsetId = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(496, 'Removed itemID = %i, amount = %i from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(497, 'Cannot create item ''%i'' (amount: %i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(498, 'You need to provide a guild name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(499, 'Player not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(500, 'Player already has a guild!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(501, 'Guild not created! (already exists?)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(502, 'No items from itemset ''%u'' found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(503, 'The distance is: (3D) %f (2D) %f (Exact 3D) %f (Exact 2D) %f yards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(504, 'Item ''%i'' ''%s'' Item Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(505, 'Item ''%i'' doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(506, 'Item ''%i'' ''%s'' Added to Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(507, 'Item save failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(508, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(509, '%d - sender: %s (guid: %u account: %u ) receiver: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(510, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(511, 'Wrong link type!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(512, '%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0:0|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(513, '%d - |cffffffff|Hquest:%d:%d|h[%s]|h|r %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(514, '%d - |cffffffff|Hcreature_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(515, '%d - |cffffffff|Hcreature:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(516, '%d - |cffffffff|Hgameobject_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(517, '%d - |cffffffff|Hgameobject:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(518, '%d - |cffffffff|Hitemset:%d|h[%s %s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(519, '|cffffffff|Htele:%s|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(520, '%d - |cffffffff|Hspell:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(521, '%d - |cffffffff|Hskill:%d|h[%s %s]|h|r %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(522, 'Game Object (Entry: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(523, '>> Game Object %s (GUID: %u) at %f %f %f. Orientation %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(524, 'Selected object:\n|cffffffff|Hgameobject:%d|h[%s]|h|r GUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f\nPhasemask %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(525, '>> Add Game Object ''%i'' (%s) (GUID: %i) added at ''%f %f %f''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(526, '%s (lowguid: %u) movement generators stack:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(527, ' Idle', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(528, ' Random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(529, ' Waypoint', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(530, ' Animal random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(531, ' Confused', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(532, ' Targeted to player %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(533, ' Targeted to creature %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(534, ' Targeted to ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(535, ' Home movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(536, ' Home movement used for player?!?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(537, ' Taxi flight', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(538, ' Unknown movement generator (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(539, 'Player selected NPC\nGUID: %u.\nFaction: %u.\nnpcFlags: %u.\nEntry: %u.\nDisplayID: %u (Native: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(540, 'Level: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(541, 'Health (base): %u. (max): %u. (current): %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(542, 'Field Flags: %u.\nDynamic Flags: %u.\nFaction Template: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(543, 'Loot: %u Pickpocket: %u Skinning: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(544, 'Position: %f %f %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(545, '*** Is a vendor!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(546, '*** Is a trainer!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(547, 'InstanceID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(548, 'Player%s %s (guid: %u) Account: %s (id: %u) Email: %s GMLevel: %u Last IP: %s Last login: %s Latency: %ums', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(549, 'Race: %s Class: %s Played time: %s Level: %u Money: %ug%us%uc', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(550, 'Command .pinfo doesn''t support ''rep'' option for offline players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(551, '%s has explored all zones now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(552, '%s has no more explored zones.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(553, '%s has explored all zones for you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(554, '%s has hidden all zones from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(555, 'Hover enabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(556, 'Hover disabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(557, '%s level up you to (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(558, '%s level down you to (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(559, '%s reset your level progress.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(560, 'The area has been set as explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(561, 'The area has been set as not explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(562, 'GUID=%i ''s updateIndex: %i, value: %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(563, 'You change GUID=%i ''s UpdateIndex: %i value to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(564, 'The value index %u is too big to %u(count: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(565, 'Set %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(566, 'You Set %u Field:%u to uint32 Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(567, 'Set %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(568, 'You Set %u Field:%i to float Value: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(569, 'Get %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(570, 'The uint32 value of %u in %u is: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(571, 'Get %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(572, 'The float of %u value in %u is: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(573, '.Set32Bit:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(574, 'You set Bit of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(575, '.Mod32Value:[OPCODE]:%u [VALUE]:%i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(576, 'You modified the value of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(577, 'You are now invisible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(578, 'You are now visible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(579, 'Selected player or creature not have victim.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(580, 'Player %s learned all default spells for race/class and completed quests rewarded spells.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(581, 'Found near gameobjects (distance %f): %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(582, 'SpawnTime: Full:%s Remain:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(583, '%d - |cffffffff|Hgameevent:%d|h[%s]|h|r%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(584, 'No event found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(585, 'Event not exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(586, 'Event %u: %s%s\nStart: %s End: %s Occurence: %s Length: %s\nNext state change: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(587, 'Event %u already active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(588, 'Event %u not active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(589, ' Point movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(590, ' Fear movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(591, ' Distract movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(592, 'You have learned all spells in craft: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(593, 'Currently Banned Accounts:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(594, '| Account | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(595, 'Currently Banned IPs:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(596, '| IP | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(597, 'Current gamemasters:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(598, '| Account | GM |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(599, 'No gamemasters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(600, 'The Alliance wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(601, 'The Horde wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(602, 'The battle for Warsong Gulch begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(603, 'The battle for Warsong Gulch begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(604, 'Let the battle for Warsong Gulch begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(605, '$n captured the Horde flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(606, '$n captured the Alliance flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(607, 'The Horde flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(608, 'The Alliance Flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(609, 'The Alliance Flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(610, 'The Horde flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(611, 'The Horde flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(612, 'The Alliance Flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(613, 'The flags are now placed at their bases.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(614, 'The Alliance flag is now placed at its base.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(615, 'The Horde flag is now placed at its base.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(636, 'The Battle for Eye of the Storm begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(637, 'The Battle for Eye of the Storm begins in 30 seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(638, 'The Battle for Eye of the Storm has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(650, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(651, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(652, 'stables', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(653, 'blacksmith', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(654, 'farm', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(655, 'lumber mill', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(656, 'mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(657, 'The %s has taken the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(658, '$n has defended the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(659, '$n has assaulted the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(660, '$n claims the %s! If left unchallenged, the %s will control it in 1 minute!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(661, 'The Battle for Arathi Basin begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(662, 'The Battle for Arathi Basin begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(663, 'The Battle for Arathi Basin has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(664, 'The Alliance has gathered $1776W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(665, 'The Horde has gathered $1777W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(666, 'After your recent battle in %s our best attempts to award you a Mark of Honor failed. Enclosed you will find the Mark of Honor we were not able to deliver to you at the time. Thanks for fighting in %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(667, 'The Alliance has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(668, 'The Horde has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(669, 'The Alliance has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(670, 'The Horde has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(671, 'The Alliance has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(672, 'The Horde has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(673, 'The Alliance has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(674, 'The Horde has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(675, 'The Alliance has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(676, 'The Horde has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(677, 'The Alliance has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(678, 'The Horde has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(679, 'The Alliance has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(680, 'The Horde has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(681, 'The Alliance has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(682, 'The Horde has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(683, '%s has taken the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(684, 'The Alliance have captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(685, 'The Horde have captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(686, 'The flag has been dropped.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(687, 'The flag has been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(700, 'You must be level %u to form an arena team', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(701, 'One minute until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(702, 'Thirty seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(703, 'Fifteen seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(704, 'The Arena battle has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(705, 'You must wait %s before speaking again.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(706, 'This item(s) have problems with equipping/storing in inventory.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(707, '%s wishes to not be disturbed and cannot receive whisper messages: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(708, '%s is Away from Keyboard: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(709, 'Do not Disturb', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(710, 'Away from Keyboard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(711, 'Queue status for %s (Lvl: %u to %u)\nQueued alliances: %u (Need at least %u more)\nQueued hordes: %u (Need at least %u more)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(712, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] A: %u/%u, H: %u/%u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(713, 'You must be level %u to join an arena team!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(715, 'You don''t meet Battleground level requirements', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(717, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] Started!|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(718, '|cffff0000[Arena Queue Announcer]:|r %s -- Joined : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(719, '|cffff0000[Arena Queue Announcer]:|r %s -- Exited : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(720, 'Your group is too large for this battleground. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(721, 'Your group is too large for this arena. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(722, 'Your group has members not in your arena team. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(723, 'Your group does not have enough players to join this match.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(724, 'The Gold Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(725, 'The Green Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(726, 'There aren''t enough players in this battleground. It will end soon unless some more players join to balance the fight.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(727, 'Your group has an offline member. Please remove him before joining.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(728, 'Your group has players from the opposing faction. You can''t join the battleground as a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(729, 'Your group has players from different battleground brakets. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(730, 'Someone in your party is already in this battleground queue. (S)he must leave it before joining as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(731, 'Someone in your party is Deserter. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(732, 'Someone in your party is already in three battleground queues. You cannot join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(733, 'You cannot teleport to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(734, 'You cannot summon players to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(735, 'You must be in GM mode to teleport to a player in a battleground.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(736, 'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(737, 'Arenas are set to 1v1 for debugging. So, don''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(738, 'Arenas are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(739, 'Battlegrounds are set to 1v0 for debugging.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(740, 'Battlegrounds are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(741, 'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(742, 'Distributing arena points to players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(743, 'Finished setting arena points for online players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(744, 'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(745, 'Modification done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(746, 'Done flushing Arena points.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(747, 'This Battleground have been disabled. You can''t join the queue.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(748, 'Arenas have been disabled. You can''t join the queue.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(750, 'Not enough players. This game will close in %u mins.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(751, 'Not enough players. This game will close in %u seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(753, 'The battle for Warsong Gulch begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(754, 'The battle for Arathi Basin begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(755, 'The battle for Eye of the Storm begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(785, 'Arena testing turned %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(786, '|cffff0000[Automatic]:|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(787, '|cffffff00[|c1f40af20Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(800, 'Invalid name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(801, 'You do not have enough gold', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(802, 'You do not have enough free slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(803, 'Your partner does not have enough free bag slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(804, 'You do not have permission to perform that function', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(805, 'Unknown language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(806, 'You don''t know that language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(807, 'Please provide character name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(808, 'Player %s not found or offline', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(809, 'Account for character %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(810, '|Hplayer:$N|h[$N]|h has earned the achievement $a!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(811, 'Guild Master', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(812, 'Officer', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(813, 'Veteran', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(814, 'Member', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(815, 'Initiate', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(816, 'Warning: You''ve entered a no-fly zone and are about to be dismounted!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(817, 'Entry %u not found in creature_template table.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(818, 'Entry %u not found in sCreatureStorage. Possible new line in creature_template, but you can not add new creatures without restarting. Only modifing is allowed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1000, 'Exiting daemon...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1001, 'Account deleted: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1002, 'Account %s NOT deleted (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1003, 'Account %s NOT deleted (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1004, 'Account created: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1005, 'Account name can''t be longer than 16 characters (client limit), account not created!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1006, 'Account with this name already exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1007, 'Account %s NOT created (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1008, 'Account %s NOT created (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1009, 'Player %s (Guid: %u) Account %s (Id: %u) deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1010, '[ Account][ Character][ IP][GMLev][Expansion][Map][Zone]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1011, '| | %20s | || |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1012, '==============================================================================', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1013, '-[%16s][%12s][%15s][%5d][%9d][%3d][%4d]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1014, 'No online players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1015, '============================== Characters Online =============================', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1100, 'Account %s (Id: %u) have up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1101, 'Message of the day changed to:\r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1102, 'Message sent to %s: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1103, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1104, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1105, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1106, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1107, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1108, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1109, '%d - %s %s %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1110, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1111, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1112, 'Failed to open file: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1113, 'Account %s (%u) have max amount allowed characters (client limit)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1114, 'Dump file have broken data!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1115, 'Invalid character name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1116, 'Invalid character guid!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1117, 'Character guid %u in use!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1118, '%d - guild: %s (guid: %u) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1119, 'You must use male or female as gender.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1120, 'You change gender of %s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1121, 'Your gender changed to %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1122, '(%u/%u +perm %u +temp %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1123, 'Not pet found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1124, 'Wrong pet type', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1125, 'Your pet learned all talents', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1126, 'Your pet talents have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1127, 'Talents of %s''s pet reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1128, '%d - |cffffffff|Htaxinode:%u|h[%s %s]|h|r (Map:%u X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1129, '%d - %s %s (Map:%u X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1200, 'You try to view cinemitic %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1201, 'You try to view movie %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1300, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1301, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1302, '%s was destroyed by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1303, 'The %s is under attack! If left unchecked, the %s will destroy it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1304, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1305, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1306, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1307, 'The %s is under attack! If left unchecked, the %s will capture it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1308, 'The %s has taken the %s! Its supplies will now be used for reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1309, 'Irondeep Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1310, 'Coldtooth Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1311, 'Stormpike Aid Station', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1312, 'Dun Baldar South Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1313, 'Dun Baldar North Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1314, 'Stormpike Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1315, 'Icewing Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1316, 'Stonehearth Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1317, 'Stonehearth Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1318, 'Snowfall Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1319, 'Iceblood Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1320, 'Iceblood Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1321, 'Tower Point', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1322, 'Frostwolf Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1323, 'East Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1324, 'West Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1325, 'Frostwolf Relief Hut', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1326, 'The Battle for Alterac Valley begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1327, 'The Battle for Alterac Valley begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1328, 'The Battle for Alterac Valley has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1329, 'The Alliance Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1330, 'The Horde Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1331, 'The Frostwolf General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1332, 'The Stormpike General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1333, 'The Battle for Alterac Valley begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2000, '|cff00ff00New ticket from|r|cffff00ff %s.|r |cff00ff00Ticket entry:|r|cffff00ff %d.|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2001, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00edited his/her ticket:|r|cffff00ff %d.|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2002, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00abandoned ticket entry:|r|cffff00ff %d.|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2003, '|cff00ff00Closed by|r:|cff00ccff %s|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2004, '|cff00ff00Deleted by|r:|cff00ccff %s|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2005, 'Ticket not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2006, 'Please close ticket before deleting it permanently.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2007, 'Ticket %d is already assigned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2008, '%u Tickets succesfully reloaded from the database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2009, 'Showing list of open tickets.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2010, 'Showing list of open tickets whose creator is online.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2011, 'Showing list of closed tickets.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2012, 'Invalid name specified. Name should be that of an online Gamemaster.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2013, 'This ticket is already assigned to yourself. To unassign use .ticket unassign %d and then reassign.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2014, 'Ticket %d is not assigned, you cannot unassign it.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2015, 'You cannot unassign tickets from staffmembers with a higher security level than yourself.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2016, 'Cannot close ticket %d, it is assigned to another GM.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2017, '|cffaaffaaTicket|r:|cffaaccff %d.|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2018, '|cff00ff00Created by|r:|cff00ccff %s|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2019, '|cff00ff00Last change|r:|cff00ccff %s ago|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2020, '|cff00ff00Assigned to|r:|cff00ccff %s|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2021, '|cff00ff00Unassigned by|r:|cff00ccff %s|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2022, '|cff00ff00Ticket Message|r: [%s]|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2023, '|cff00ff00GM Comment|r: [%s]|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2024, '|cff00ccff%s|r |cff00ff00Added comment|r: [%s]|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2025, '|cff00ff00Created|r:|cff00ccff %s ago|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5000, 'You froze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5001, 'It might be amusing but no... you cant freeze yourself!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5002, 'Invalid input check the name of target.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5003, 'You unfroze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5004, 'There are no frozen players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5005, 'Following players are frozen on the server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5006, '- %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5007, 'You must be in a raid group to enter this instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5008, 'This instance is closed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5009, 'Sound %u Played to server', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5010, 'linkGUID: %u, Entry: %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5011, 'You can''t teleport self to self!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5012, 'No maps found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5013, '[Continent]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5014, '[Instance]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5015, '[Battleground]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5016, '[Arena]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5017, '[Raid reset time: %s]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5018, '[Heroic reset time: %s]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5019, '[Mountable]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5020, 'Phasemask: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5021, 'Armor: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5022, 'Channel password not changed due to channel being marked public. GM Powers required.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5023, 'Channel: %s publicity set to: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5024, 'Entry: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5025, 'Type: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5026, 'DisplayID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5027, 'Name: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6604, 'You cannot say, yell or emote until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6605, 'You cannot whisper until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6606, 'You cannot write to channels until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6607, 'You cannot use auction until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6608, 'You cannot write tickets until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6609, 'You cannot trade until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6610, 'You cannot trade with characters lower than level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6611, 'You cannot send mail until you become level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6612, 'You cannot send mail to characters lower than level %d.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6616, 'Silence is ON for %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7523, 'WORLD: Denying connections.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7524, 'WORLD: Accepting connections.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10001, 'The Horde has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10002, 'The Alliance has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10003, 'The Horde has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10004, 'The Alliance has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10005, 'The Horde has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10006, 'The Alliance has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10007, 'The Horde lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10008, 'The Alliance lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10009, 'The Horde lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10010, 'The Alliance lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10011, 'The Horde lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10012, 'The Alliance lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10013, 'The Horde has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10014, 'The Alliance has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10015, 'The Horde has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10016, 'The Alliance has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10017, 'The Horde has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10018, 'The Alliance has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10019, 'The Horde lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10020, 'The Alliance lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10021, 'The Horde lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10022, 'The Alliance lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10023, 'The Horde lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10024, 'The Alliance lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10025, 'The Horde has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10026, 'The Alliance has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10027, 'The Horde lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10028, 'The Alliance lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10029, 'The Horde has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10030, 'The Alliance has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10031, 'The Horde lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10032, 'The Alliance lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10033, 'The Horde has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10034, 'The Alliance has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10035, 'The Horde has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10036, 'The Alliance has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10037, 'The Horde has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10038, 'The Alliance has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10039, 'The Horde has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10040, 'The Alliance has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10041, 'The Horde lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10042, 'The Alliance lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10043, 'The Horde lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10044, 'The Alliance lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10045, 'The Horde lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10046, 'The Alliance lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10047, 'The Horde lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10048, 'The Alliance lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10049, 'The Horde has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10050, 'The Alliance has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10051, 'Take me to Northpass Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10052, 'Take me to Eastwall Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10053, 'Take me to Crown Guard Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10054, 'Give me the flag, I''ll take it to the central beacon for the glory of the Alliance!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10055, 'Give me the flag, I''ll take it to the central beacon for the glory of the Horde!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10056,'The battle for Strand of the Ancients begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10057,'The battle for Strand of the Ancients begins in 1 minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10058,'The battle for Strand of the Ancients begins in 30 seconds. Prepare yourselves!.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10059,'Let the battle for Strand of the Ancients begin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10060,'The %s is under attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10061,'The %s was destroyed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10062,'Round 1 - finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10063,'The Alliance captured the titan portal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10064,'The Horde captured the titan portal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10065,'Round 2 of the Battle for the Strand of the Ancients begins in 1 minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10066,'Round 2 begins in 30 seconds. Prepare yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10067,'The chamber has been breached! The titan relic is vulnerable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10068,'The Alliance captured the South Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10069,'The Alliance captured the West Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10070,'The Alliance captured the East Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10071,'The Horde captured the South Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10072,'The Horde captured the West Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10073,'The Horde captured the East Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(11000, '|cffffff00[|c00077766Autobroadcast|cffffff00]: |cFFF222FF%s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(11001, 'You have not chosen -1 or the current realmID that you are on.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +/*!40000 ALTER TABLE `trinity_string` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `vehicle_accessory` +-- + +DROP TABLE IF EXISTS `vehicle_accessory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicle_accessory` ( + `entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, + `accessory_entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, + `seat_id` TINYINT(1) SIGNED NOT NULL DEFAULT 0, + `minion` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + `description` TEXT NOT NULL, + PRIMARY KEY (`entry`, `seat_id`) +) +COLLATE=utf8_general_ci +ENGINE=MyISAM +ROW_FORMAT=FIXED +AVG_ROW_LENGTH=0; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `version` +-- + +LOCK TABLES `vehicle_accessory` WRITE; +/*!40000 ALTER TABLE `vehicle_accessory` DISABLE KEYS */; +/*!40000 ALTER TABLE `vehicle_accessory` ENABLE KEYS */; +UNLOCK TABLES; +-- +-- Table structure for table `version` +-- + +DROP TABLE IF EXISTS `version`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `version` ( + `core_version` varchar(120) DEFAULT NULL COMMENT 'Core revision dumped at startup.', + `core_revision` bigint(20) unsigned DEFAULT NULL, + `db_version` varchar(120) DEFAULT NULL COMMENT 'Version of world DB.', + `script_version` varchar(120) DEFAULT NULL COMMENT 'Version of scripts DB.', + `cache_id` int(10) DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Version Notes'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `version` +-- + +LOCK TABLES `version` WRITE; +/*!40000 ALTER TABLE `version` DISABLE KEYS */; +/*!40000 ALTER TABLE `version` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `waypoint_data` +-- + +DROP TABLE IF EXISTS `waypoint_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `waypoint_data` ( + `id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Creature GUID', + `point` mediumint(8) unsigned NOT NULL DEFAULT '0', + `position_x` float NOT NULL DEFAULT '0', + `position_y` float NOT NULL DEFAULT '0', + `position_z` float NOT NULL DEFAULT '0', + `delay` int(10) unsigned NOT NULL DEFAULT '0', + `move_flag` tinyint(1) NOT NULL DEFAULT '0', + `action` int(11) NOT NULL DEFAULT '0', + `action_chance` smallint(3) NOT NULL DEFAULT '100', + `wpguid` int(11) NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `waypoint_data` +-- + +LOCK TABLES `waypoint_data` WRITE; +/*!40000 ALTER TABLE `waypoint_data` DISABLE KEYS */; +/*!40000 ALTER TABLE `waypoint_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `waypoint_scripts` +-- + +DROP TABLE IF EXISTS `waypoint_scripts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `waypoint_scripts` ( + `id` int(11) unsigned NOT NULL DEFAULT '0', + `delay` int(11) unsigned NOT NULL DEFAULT '0', + `command` int(11) unsigned NOT NULL DEFAULT '0', + `datalong` int(11) unsigned NOT NULL DEFAULT '0', + `datalong2` int(11) unsigned NOT NULL DEFAULT '0', + `dataint` int(11) unsigned NOT NULL DEFAULT '0', + `x` float NOT NULL DEFAULT '0', + `y` float NOT NULL DEFAULT '0', + `z` float NOT NULL DEFAULT '0', + `o` float NOT NULL DEFAULT '0', + `guid` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `waypoint_scripts` +-- + +LOCK TABLES `waypoint_scripts` WRITE; +/*!40000 ALTER TABLE `waypoint_scripts` DISABLE KEYS */; +/*!40000 ALTER TABLE `waypoint_scripts` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2009-12-18 17:18:11 diff --git a/sql/create/CMakeLists.txt b/sql/create/CMakeLists.txt new file mode 100644 index 0000000..91cb61e --- /dev/null +++ b/sql/create/CMakeLists.txt @@ -0,0 +1,5 @@ +########### install files ############### + +FILE(GLOB _SQL *.sql) + +install(FILES ${_SQL} DESTINATION share/trinity/sql/tools) \ No newline at end of file diff --git a/sql/create/create_mysql.sql b/sql/create/create_mysql.sql new file mode 100644 index 0000000..e182e06 --- /dev/null +++ b/sql/create/create_mysql.sql @@ -0,0 +1,13 @@ +GRANT USAGE ON * . * TO 'trinity'@'localhost' IDENTIFIED BY 'trinity' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 ; + +CREATE DATABASE `world` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; + +CREATE DATABASE `characters` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; + +CREATE DATABASE `auth` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; + +GRANT ALL PRIVILEGES ON `world` . * TO 'trinity'@'localhost' WITH GRANT OPTION; + +GRANT ALL PRIVILEGES ON `characters` . * TO 'trinity'@'localhost' WITH GRANT OPTION; + +GRANT ALL PRIVILEGES ON `auth` . * TO 'trinity'@'localhost' WITH GRANT OPTION; diff --git a/sql/create/drop_mysql.sql b/sql/create/drop_mysql.sql new file mode 100644 index 0000000..ee05439 --- /dev/null +++ b/sql/create/drop_mysql.sql @@ -0,0 +1,21 @@ +REVOKE ALL PRIVILEGES ON * . * FROM 'trinity'@'localhost'; + +REVOKE ALL PRIVILEGES ON `world` . * FROM 'trinity'@'localhost'; + +REVOKE GRANT OPTION ON `world` . * FROM 'trinity'@'localhost'; + +REVOKE ALL PRIVILEGES ON `characters` . * FROM 'trinity'@'localhost'; + +REVOKE GRANT OPTION ON `characters` . * FROM 'trinity'@'localhost'; + +REVOKE ALL PRIVILEGES ON `auth` . * FROM 'trinity'@'localhost'; + +REVOKE GRANT OPTION ON `auth` . * FROM 'trinity'@'localhost'; + +DROP USER 'trinity'@'localhost'; + +DROP DATABASE IF EXISTS `world`; + +DROP DATABASE IF EXISTS `characters`; + +DROP DATABASE IF EXISTS `auth`; diff --git a/sql/scripts/CMakeLists.txt b/sql/scripts/CMakeLists.txt new file mode 100644 index 0000000..554ff9b --- /dev/null +++ b/sql/scripts/CMakeLists.txt @@ -0,0 +1,5 @@ +########### install files ############### + +FILE(GLOB _SQL *.sql) + +install(FILES ${README} DESTINATION share/trinity/sql/full) \ No newline at end of file diff --git a/sql/scripts/world_script_texts.sql b/sql/scripts/world_script_texts.sql new file mode 100644 index 0000000..84e0531 --- /dev/null +++ b/sql/scripts/world_script_texts.sql @@ -0,0 +1,3073 @@ +-- Up to TC2 5408 +-- +-- trinityscript_script_texts.sql Contains data for table `script_texts` mainly used in C++ parts. +-- valid entries for table are between -1000000 and -1999999 +-- + +-- ALTER TABLE `script_texts` ADD COLUMN `npc_entry` mediumint(8) NOT NULL DEFAULT 0 COMMENT 'creature_template entry' FIRST; +/* +DROP TABLE IF EXISTS `script_texts`; +CREATE TABLE `script_texts` ( + `npc_entry` mediumint(8) NOT NULL default '0' COMMENT 'creature_template entry', + `entry` mediumint(8) NOT NULL, + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + `sound` mediumint(8) unsigned NOT NULL default '0', + `type` tinyint(3) unsigned NOT NULL default '0', + `language` tinyint(3) unsigned NOT NULL default '0', + `emote` smallint(5) unsigned NOT NULL default '0', + `comment` text, + PRIMARY KEY (`npc_entry`,`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; +*/ +-- +-- -1 000 000 First 100 entries are reserved for special use, do not add regular text here. +-- +DELETE FROM `script_texts` WHERE entry BETWEEN -1999925 AND -1000000; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (0,-1000000,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'DEFAULT_TEXT'), + (0,-1000001,'%s goes into a killing frenzy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'EMOTE_GENERIC_FRENZY_KILL'), + (0,-1000004,'goes into a berserker rage!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'EMOTE_GENERIC_BERSERK'), + (0,-1000005,'UNUSED',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'REUSE ME'), + +-- +-- Normal text entries. Say/Yell/Whisper/Emote for any regular world object. +-- + +-- -1 000 100 GENERAL MAPS (not typical instance maps) + (6109,-1000100,'Come, little ones. Face me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'azuregos SAY_TELEPORT'), + (467,-1000101,'Follow me, $N. I''ll take you to the Defias hideout. But you better protect me or I am as good as dead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'defias traitor SAY_START'), + (467,-1000102,'The entrance is hidden here in Moonbrook. Keep your eyes peeled for thieves. They want me dead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'defias traitor SAY_PROGRESS'), + (467,-1000103,'You can go tell Stoutmantle this is where the Defias Gang is holed up, $N.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'defias traitor SAY_END'), + (467,-1000104,'%s coming in fast! Prepare to fight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'defias traitor SAY_AGGRO_1'), + (467,-1000105,'Help!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'defias traitor SAY_AGGRO_2'), + (12858,-1000106,'Everyone ready?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'torek SAY_READY'), + (12858,-1000107,'Ok, Lets move out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'torek SAY_MOVE'), + (12858,-1000108,'Prepare yourselves. Silverwing is just around the bend.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'torek SAY_PREPARE'), + (12858,-1000109,'Silverwing is ours!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'torek SAY_WIN'), + (12858,-1000110,'Go report that the outpost is taken. We will remain here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'torek SAY_END'), + (17312,-1000111,'Our house is this way, through the thicket.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'magwin SAY_START'), + (17312,-1000112,'Help me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'magwin SAY_AGGRO'), + (17312,-1000113,'My poor family. Everything has been destroyed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'magwin SAY_PROGRESS'), + (17312,-1000114,'Father! Father! You''re alive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'magwin SAY_END1'), + (17312,-1000115,'You can thank $N for getting me back here safely, father.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'magwin SAY_END2'), + (17312,-1000116,'hugs her father.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,7,0,'magwin EMOTE_HUG'), + (16993,-1000117,'Thank you for agreeing to help. Now, let''s get out of here $N.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'wounded elf SAY_ELF_START'), + (16993,-1000118,'Over there! They''re following us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'wounded elf SAY_ELF_SUMMON1'), + (16993,-1000119,'Allow me a moment to rest. The journey taxes what little strength I have.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,16,'wounded elf SAY_ELF_RESTING'), + (16993,-1000120,'Did you hear something?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'wounded elf SAY_ELF_SUMMON2'), + (16993,-1000121,'Falcon Watch, at last! Now, where''s my... Oh no! My pack, it''s missing! Where has -',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'wounded elf SAY_ELF_COMPLETE'), + (16993,-1000122,'You won''t keep me from getting to Falcon Watch!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'wounded elf SAY_ELF_AGGRO'), + (0,-1000123,'Ready when you are, $c.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,15,'big will SAY_BIG_WILL_READY'), + (0,-1000124,'The Affray has begun. $n, get ready to fight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'twiggy SAY_TWIGGY_BEGIN'), + (0,-1000125,'You! Enter the fray!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'twiggy SAY_TWIGGY_FRAY'), + (0,-1000126,'Challenger is down!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'twiggy SAY_TWIGGY_DOWN'), + (0,-1000127,'The Affray is over.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'twiggy SAY_TWIGGY_OVER'), + (19831,-1000128,'We need you to send reinforcements to Manaforge Duro, Ardonis. This is not a request, it''s an order.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge SAY_COMMANDER_DAWNFORGE_1'), + (19831,-1000129,'You cannot be serious! We are severely understaffed and can barely keep this manaforge functional!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge SAY_ARCANIST_ARDONIS_1'), + (19831,-1000130,'You will do as ordered. Manaforge Duro has come under heavy attack by mana creatures and the situation is out of control. Failure to comply will not be tolerated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge SAY_COMMANDER_DAWNFORGE_2'), + (19831,-1000131,'Indeed, it is not a request.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge SAY_PATHALEON_CULATOR_IMAGE_1'), + (19831,-1000132,'My lord!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge SAY_COMMANDER_DAWNFORGE_3'), + (19831,-1000133,'Duro will be reinforced! Ultris was a complete disaster. I will NOT have that mistake repeated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge PATHALEON_CULATOR_IMAGE_2'), + (19831,-1000134,'We''ve had too many setbacks along the way: Hellfire Citadel, Fallen Sky Ridge, Firewing Point... Prince Kael''thas will tolerate no further delays. I will tolerate nothing other than complete success!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge PATHALEON_CULATOR_IMAGE_2_1'), + (19831,-1000135,'I am returning to Tempest Keep. See to it that I do not have reason to return!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge PATHALEON_CULATOR_IMAGE_2_2'), + (19831,-1000136,'Yes, my lord.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge COMMANDER_DAWNFORGE_4 SAY_ARCANIST_ARDONIS_2'), + (19831,-1000137,'See to it, Ardonis!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dawnforge COMMANDER_DAWNFORGE_5'), + (17085,-1000138,'Avruu''s magic... it still controls me. You must fight me, mortal. It''s the only way to break the spell!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'aeranas SAY_SUMMON'), + (17085,-1000139,'Avruu''s magic is broken! I''m free once again!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'aeranas SAY_FREE'), + (16295,-1000140,'Let''s go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lilatha SAY_START'), + (16295,-1000141,'$N, let''s use the antechamber to the right.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lilatha SAY_PROGRESS1'), + (16295,-1000142,'I can see the light at the end of the tunnel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lilatha SAY_PROGRESS2'), + (16295,-1000143,'There''s Farstrider Enclave now, $C. Not far to go... Look out! Troll ambush!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lilatha SAY_PROGRESS3'), + (16295,-1000144,'Thank you for saving my life and bringing me back to safety, $N',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lilatha SAY_END1'), + (16295,-1000145,'Captain Helios, I''ve been rescued from the Amani Catacombs. Reporting for duty, sir!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lilatha SAY_END2'), + (16295,-1000146,'Liatha, get someone to look at those injuries. Thank you for bringing her back safely.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lilatha CAPTAIN_ANSWER'), + (10427,-1000147,'I remember well the sting of defeat at the conclusion of the Third War. I have waited far too long for my revenge. Now the shadow of the Legion falls over this world. It is only a matter of time until all of your failed creation... is undone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11332,1,0,0,'kazzak SAY_INTRO'), + (10427,-1000148,'The Legion will conquer all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11333,1,0,0,'kazzak SAY_AGGRO1'), + (10427,-1000149,'All mortals will perish!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11334,1,0,0,'kazzak SAY_AGGRO2'), + (20129,-1000150,'All life must be eradicated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11335,1,0,0,'kazzak SAY_SURPREME1'), + (20129,-1000151,'I''ll rip the flesh from your bones!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11336,1,0,0,'kazzak SAY_SURPREME2'), + (20129,-1000152,'Kirel Narak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11337,1,0,0,'kazzak SAY_KILL1'), + (20129,-1000153,'Contemptible wretch!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11338,1,0,0,'kazzak SAY_KILL2'), + (20129,-1000154,'The universe will be remade.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11339,1,0,0,'kazzak SAY_KILL3'), + (20129,-1000155,'The Legion... will never... fall.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11340,1,0,0,'kazzak SAY_DEATH'), + (20129,-1000156,'%s goes into a frenzy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kazzak EMOTE_FRENZY'), + (20129,-1000157,'Invaders, you dangle upon the precipice of oblivion! The Burning Legion comes and with it comes your end.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'kazzak SAY_RAND1'), + (20129,-1000158,'Impudent whelps, you only delay the inevitable. Where one has fallen, ten shall rise. Such is the will of Kazzak...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'kazzak SAY_RAND2'), + (20129,-1000159,'Do not proceed. You will be eliminated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11344,1,0,0,'doomwalker SAY_AGGRO'), + (20129,-1000160,'Tectonic disruption commencing.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11345,1,0,0,'doomwalker SAY_EARTHQUAKE_1'), + (20129,-1000161,'Magnitude set. Release.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11346,1,0,0,'doomwalker SAY_EARTHQUAKE_2'), + (20129,-1000162,'Trajectory locked.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11347,1,0,0,'doomwalker SAY_OVERRUN_1'), + (20129,-1000163,'Engage maximum speed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11348,1,0,0,'doomwalker SAY_OVERRUN_2'), + (12429,-1000164,'Threat level zero.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11349,1,0,0,'doomwalker SAY_SLAY_1'), + (12429,-1000165,'Directive accomplished.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11350,1,0,0,'doomwalker SAY_SLAY_2'), + (12429,-1000166,'Target exterminated.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11351,1,0,0,'doomwalker SAY_SLAY_3'), + (12429,-1000167,'System failure in five, f-o-u-r...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11352,1,0,0,'doomwalker SAY_DEATH'), + (12429,-1000168,'Who dares awaken Aquementas?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'aquementas AGGRO_YELL_AQUE'), + (12429,-1000169,'Muahahahaha! You fool! You''ve released me from my banishment in the interstices between space and time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nether_drake SAY_NIHIL_1'), + (12429,-1000170,'All of Draenor shall quick beneath my feet! I will destroy this world and reshape it in my image!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nether_drake SAY_NIHIL_2'), + (12429,-1000171,'Where shall I begin? I cannot bother myself with a worm such as yourself. There is a world to be conquered!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nether_drake SAY_NIHIL_3'), + (12429,-1000172,'No doubt the fools that banished me are long dead. I shall take wing survey my demense. Pray to whatever gods you hold dear that we do not meet again.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nether_drake SAY_NIHIL_4'), + (12429,-1000173,'NOOOOooooooo!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nether_drake SAY_NIHIL_INTERRUPT'), + (21469,-1000174,'Good $N, you are under the spell''s influence. I must analyze it quickly, then we can talk.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'daranelle SAY_SPELL_INFLUENCE'), + (0,-1000175,'Thank you, mortal.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,11,0,' SAY_JUST_EATEN'), + (0,-1000176,'The last thing I remember is the ship falling and us getting into the pods. I''ll go see how I can help. Thank you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HEAL1'), + (0,-1000177,'$C, Where am I? Who are you? Oh no! What happened to the ship?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HEAL2'), + (0,-1000178,'$C You saved me! I owe you a debt that I can never repay. I''ll go see if I can help the others.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HEAL3'), + (0,-1000179,'Ugh... what is this place? Is that all that''s left of the ship over there?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HEAL4'), + (0,-1000180,'Oh, the pain...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HELP1'), + (0,-1000181,'Everything hurts, Please make it stop...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HELP2'), + (0,-1000182,'Ughhh... I hurt. Can you help me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HELP3'), + (0,-1000183,'I don''t know if I can make it, please help me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'draenei_survivor SAY_HELP4'), + (0,-1000184,'Yes Master, all goes along as planned.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'engineer_spark SAY_TEXT'), + (0,-1000185,'%s puts the shell to his ear.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,7,0,'engineer_spark EMOTE_SHELL'), + (0,-1000186,'Now I cut you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,7,0,'engineer_spark SAY_ATTACK'), + (0,-1000187,'Thank you, dear $C, you just saved my life.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'faulk SAY_HEAL'), + (0,-1000188,'Deployment sucessful. Trespassers will be neutralized.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'converted_sentry SAY_CONVERTED_1'), + (0,-1000189,'Objective acquired. Initiating security routines.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'converted_sentry SAY_CONVERTED_2'), + (0,-1000190,'In Nagrand, food hunt ogre!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,' SAY_LUMP_0'), + (0,-1000191,'You taste good with maybe a little salt and pepper.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,' SAY_LUMP_1'), + (0,-1000192,'OK, OK! Lump give up!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,' SAY_LUMP_DEFEAT'), + (0,-1000193,'Thank you, dear $C, you just saved my life.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'stillblade SAY_HEAL'), + (0,-1000194,'I give up! Please don''t kill me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unkor SAY_SUBMIT'), + (0,-1000195,'I choose the third option: KILLING YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'floon SAY_FLOON_ATTACK'), + (0,-1000196,'Belore...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lady_sylvanas SAY_LAMENT_END'), + (0,-1000197,'%s kneels down and pick up the amulet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,1,0,'lady_sylvanas EMOTE_LAMENT_END'), + (0,-1000198,'Taste blade, mongrel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_GUARD_SIL_AGGRO1'), + (0,-1000199,'Please tell me that you didn''t just do what I think you just did. Please tell me that I''m not going to have to hurt you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_GUARD_SIL_AGGRO2'), + (9623,-1000200,'As if we don''t have enough problems, you go and create more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_GUARD_SIL_AGGRO3'), + (9623,-1000201,'I''m saved! Thank you, doctor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'injured_patient SAY_DOC1'), + (9623,-1000202,'HOORAY! I AM SAVED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'injured_patient SAY_DOC2'), + (9623,-1000203,'Sweet, sweet embrace... take me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'injured_patient SAY_DOC3'), + (9623,-1000204,'%s looks up at you quizzically. Maybe you should inspect it?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'cluck EMOTE_A_HELLO'), + (9623,-1000205,'%s looks at you unexpectadly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'cluck EMOTE_H_HELLO'), + (23139,-1000206,'%s starts pecking at the feed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'cluck EMOTE_CLUCK_TEXT2'), + (23139,-1000207,'You have my blessing',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ashyen_and_keleth SAY_REWARD_BLESS'), + (28315,-1000208,'Frenzyheart kill you if you come back. You no welcome here no more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'vekjik SAY_TEXTID_VEKJIK1'), + (15420,-1000209,'Very well. Let''s see what you have to show me, $N.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'anvilward SAY_ANVIL1'), + (15420,-1000210,'What manner of trick is this, $R? If you seek to ambush me, I warn you I will not go down quietly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'anvilward SAY_ANVIL2'), + (23139,-1000211,'Warning! %s emergency shutdown process initiated by $N. Shutdown will complete in two minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'manaforge_control EMOTE_START'), + (23139,-1000212,'Emergency shutdown will complete in one minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'manaforge_control EMOTE_60'), + (23139,-1000213,'Emergency shutdown will complete in thirty seconds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'manaforge_control EMOTE_30'), + (22083,-1000214,'Emergency shutdown will complete in ten seconds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'manaforge_control EMOTE_10'), + (22083,-1000215,'Emergency shutdown complete.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'manaforge_control EMOTE_COMPLETE'), + (22083,-1000216,'Emergency shutdown aborted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'manaforge_control EMOTE_ABORT'), + (22083,-1000217,'Greetings, $N. I will guide you through the cavern. Please try and keep up.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_1'), + (22083,-1000218,'We do not know if the Caverns of Time have always been accessible to mortals. Truly, it is impossible to tell as the Timeless One is in perpetual motion, changing our timeways as he sees fit. What you see now may very well not exist tomorrow. You may wake up and have no memory of this place.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_2'), + (22083,-1000219,'It is strange, I know... Most mortals cannot actually comprehend what they see here, as often, what they see is not anchored within their own perception of reality.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_3'), + (22083,-1000220,'Follow me, please.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_4'), + (23141,-1000221,'There are only two truths to be found here: First, that time is chaotic, always in flux, and completely malleable and second, perception does not dictate reality.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_5'), + (21648,-1000222,'As custodians of time, we watch over and care for Nozdormu''s realm. The master is away at the moment, which means that attempts are being made to dramatically alter time. The master never meddles in the affairs of mortals but instead corrects the alterations made to time by others. He is reactionary in this regard.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_6'), + (0,-1000223,'For normal maintenance of time, the Keepers of Time are sufficient caretakers. We are able to deal with most ordinary disturbances. I speak of little things, such as rogue mages changing something in the past to elevate their status or wealth in the present.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_7'), + (0,-1000224,'These tunnels that you see are called timeways. They are infinite in number. The ones that currently exist in your reality are what the master has deemed as ''trouble spots.'' These trouble spots may differ completely in theme but they always share a cause. That is, their existence is a result of the same temporal disturbance. Remember that should you venture inside one...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_8'), + (0,-1000225,'This timeway is in great disarray! We have agents inside right now attempting to restore order. What information I have indicates that Thrall''s freedom is in jeopardy. A malevolent organization known as the Infinite Dragonflight is trying to prevent his escape. I fear without outside assistance, all will be lost.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_9'), + (0,-1000226,'We have very little information on this timeway. Sa''at has been dispatched and is currently inside. The data we have gathered from his correspondence is that the Infinite Dragonflight are once again attempting to alter time. Could it be that the opening of the Dark Portal is being targeted for sabotage? Let us hope not...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_10'), + (0,-1000227,'This timeway is currently collapsing. What that may hold for the past, present and future is currently unknown...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_11'), + (0,-1000228,'The timeways are currently ranked in order from least catastrophic to most catastrophic. Note that they are all classified as catastrophic, meaning that any single one of these timeways collapsing would mean that your world would end. We only classify them in such a way so that the heroes and adventurers that are sent here know which timeway best suits their abilities.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_12'), + (0,-1000229,'All we know of this timeway is that it leads to Mount Hyjal. The Infinite Dragonflight have gone to great lengths to prevent our involvement. We know next to nothing, mortal. Soridormi is currently attempting to break through the timeway''s defenses but has thus far been unsuccessful. You might be our only hope of breaking through and resolving the conflict.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_13'), + (0,-1000230,'Our time is at an end $N. I would wish you luck, if such a thing existed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'WHISPER_CUSTODIAN_14'), + (0,-1000231,'Ah, $GPriest:Priestess; you came along just in time. I appreciate it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,20,'garments SAY_COMMON_HEALED'), + (0,-1000232,'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those gnolls with your power to back me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,4,'garments SAY_DG_KEL_THANKS'), + (0,-1000233,'Farewell to you, and may shadow always protect you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,3,'garments SAY_DG_KEL_GOODBYE'), + (0,-1000234,'Follow me, stranger. This won''t take long.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_KHAD_SERV_0'), + (2768,-1000235,'Shattrath was once the draenei capital of this world. Its name means "dwelling of light."',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_1'), + (2768,-1000236,'When the Burning Legion turned the orcs against the draenei, the fiercest battle was fought here. The draenei fought tooth and nail, but in the end the city fell.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_2'), + (2768,-1000237,'The city was left in ruins and darkness... until the Sha''tar arrived.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_3'), + (2768,-1000238,'Let us go into the Lower City. I will warn you that as one of the only safe havens in Outland, Shattrath has attracted droves of refugees from all wars, current and past.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_4'), + (2768,-1000239,'The Sha''tar, or "born from light" are the naaru that came to Outland to fight the demons of the Burning Legion.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_5'), + (2768,-1000240,'They were drawn to the ruins of Shattrath City where a small remnant of the draenei priesthood conducted its rites inside a ruined temple on this very spot.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_6'), + (2768,-1000241,'The priesthood, known as the Aldor, quickly regained its strength as word spread that the naaru had returned and reconstruction soon began. The ruined temple is now used as an infirmary for injured refugees.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_7'), + (2768,-1000242,'It wouldn''t be long, however, before the city came under attack once again. This time, the attack came from Illidan''s armies. A large regiment of blood elves had been sent by Illidan''s ally, Kael''thas Sunstrider, to lay waste to the city.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_8'), + (2768,-1000243,'As the regiment of blood elves crossed this very bridge, the Aldor''s exarchs and vindicators lined up to defend the Terrace of Light. But then the unexpected happened.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_9'), + (2768,-1000244,'The blood elves laid down their weapons in front of the city''s defenders; their leader, a blood elf elder known as Voren''thal, stormed into the Terrace of Light and demanded to speak to A''dal.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_10'), + (23002,-1000245,'As the naaru approached him, Voren''thal kneeled before him and uttered the following words: "I''ve seen you in a vision, naaru. My race''s only hope for survival lies with you. My followers and I are here to serve you."',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_11'), + (23002,-1000246,'The defection of Voren''thal and his followers was the largest loss ever incurred by Kael''s forces. And these weren''t just any blood elves. Many of the best and brightest amongst Kael''s scholars and magisters had been swayed by Voren''thal''s influence.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_12'), + (23002,-1000247,'The naaru accepted the defectors, who would become known as the Scryers; their dwelling lies in the platform above. Only those initiated with the Scryers are allowed there.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_13'), + (16483,-1000248,'The Aldor are followers of the Light and forgiveness and redemption are values they understand. However, they found hard to forget the deeds of the blood elves while under Kael''s command.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_14'), + (16483,-1000249,'Many of the priesthood had been slain by the same magisters who now vowed to serve the naaru. They were not happy to share the city with their former enemies.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_15'), + (16483,-1000250,'The Aldor''s most holy temple and its surrounding dwellings lie on the terrace above. As a holy site, only the initiated are welcome inside.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_16'), + (16483,-1000251,'The attacks against Shattrath continued, but the city did not fall, as you can see. On the contrary, the naaru known as Xi''ri led a successful incursion into Shadowmoon Valley - Illidan''s doorstep.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_17'), + (16483,-1000252,'There he continues to wage war on Illidan with the assistance of the Aldor and the Scryers. The two factions have not given up on their old feuds, though.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_18'), + (16483,-1000253,'Such is their animosity that they vie for the honor of being sent to assist the naaru there. Each day, that decision is made here by A''dal. The armies gather here to receive A''dal''s blessing before heading to Shadowmoon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_19'), + (16483,-1000254,'Khadgar should be ready to see you again. Just remember that to serve the Sha''tar you will most likely have to ally with the Aldor or the Scryers. And seeking the favor of one group will cause the others'' dislike.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_20'), + (16483,-1000255,'Good luck stranger, and welcome to Shattrath City.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'SAY_KHAD_SERV_21'), + (17243,-1000256,'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those murlocs with the Light on my side!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,4,'garments SAY_ROBERTS_THANKS'), + (17243,-1000257,'Farewell to you, and may the Light be with you always.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,3,'garments SAY_ROBERTS_GOODBYE'), + (17243,-1000258,'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those humans with your power to back me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,4,'garments SAY_KORJA_THANKS'), + (17318,-1000259,'Farewell to you, and may our ancestors be with you always!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,3,'garments SAY_KORJA_GOODBYE'), + (17318,-1000260,'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those wendigo with the Light on my side!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,4,'garments SAY_DOLF_THANKS'), + (17318,-1000261,'Farewell to you, and may the Light be with you always.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,3,'garments SAY_DOLF_GOODBYE'), + (17318,-1000262,'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those corrupt timberlings with Elune''s power behind me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,2,4,'garments SAY_SHAYA_THANKS'), + (17318,-1000263,'Farewell to you, and may Elune be with you always.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,2,3,'garments SAY_SHAYA_GOODBYE'), + (17318,-1000264,'Ok, $N. Follow me to the cave where I''ll attempt to harness the power of the rune stone into these goggles.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'phizzlethorpe SAY_PROGRESS_1'), + (17318,-1000265,'I discovered this cave on our first day here. I believe the energy in the stone can be used to our advantage.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'phizzlethorpe SAY_PROGRESS_2'), + (17318,-1000266,'I''ll begin drawing energy from the stone. Your job, $N, is to defend me. This place is cursed... trust me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'phizzlethorpe SAY_PROGRESS_3'), + (6248,-1000267,'%s begins tinkering with the goggles before the stone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'phizzlethorpe EMOTE_PROGRESS_4'), + (6248,-1000268,'Help!!! Get these things off me so I can get my work done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'phizzlethorpe SAY_AGGRO'), + (6248,-1000269,'Almost done! Just a little longer!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'phizzlethorpe SAY_PROGRESS_5'), + (6248,-1000270,'I''ve done it! I have harnessed the power of the stone into the goggles! Let''s get out of here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'phizzlethorpe SAY_PROGRESS_6'), + (6248,-1000271,'Phew! Glad to be back from that creepy cave.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'phizzlethorpe SAY_PROGRESS_7'), + (3439,-1000272,'%s hands one glowing goggles over to Doctor Draxlegauge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'phizzlethorpe EMOTE_PROGRESS_8'), + (3439,-1000273,'Doctor Draxlegauge will give you further instructions, $N. Many thanks for your help!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'phizzlethorpe SAY_PROGRESS_9'), + (3439,-1000274,'Time to teach you a lesson in manners, little $Gboy:girl;!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'larry SAY_START'), + (3439,-1000275,'Now I''m gonna give you to the count of ''3'' to get out of here before I sick the dogs on you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'larry SAY_COUNT'), + (3439,-1000276,'1...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'larry SAY_COUNT_1'), + (3439,-1000277,'2...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'larry SAY_COUNT_2'), + (3439,-1000278,'Time to meet your maker!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'larry SAY_ATTACK_5'), + (3439,-1000279,'Alright, we give up! Don''t hurt us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'larry SAY_GIVEUP'), + (6172,-1000280,'A shadowy, sinister presence has invaded the Emerald Dream. Its power is poised to spill over into our world, $N. We must oppose it! That''s why I cannot accompany you in person.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'clintar SAY_START'), + (15420,-1000281,'The Emerald Dream will never be yours!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'clintar SAY_AGGRO_1'), + (15420,-1000282,'Begone from this place!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'clintar SAY_AGGRO_2'), + (0,-1000283,'That''s the first relic, but there are still two more. Follow me, $N.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'clintar SAY_RELIC1'), + (24981,-1000284,'I''ve recovered the second relic. Take a moment to rest, and then we''ll continue to the last reliquary.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'clintar SAY_RELIC2'), + (0,-1000285,'We have all three of the relics, but my energy is rapidly fading. We must make our way back to Dreamwarden Lurosa! He will let you know what to do next.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'clintar SAY_RELIC3'), + (22916,-1000286,'Lurosa, I am entrusting the Relics of Aviana to $N, who will take them to Morthis Whisperwing. I must return completely to the Emerald Dream now. Do not let $N fail!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'clintar SAY_END'), + (7806,-1000287,'Emergency power activated! Initializing ambulanory motor! CLUCK!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'oox SAY_OOX_START'), + (7806,-1000288,'Physical threat detected! Evasive action! CLUCK!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'oox SAY_OOX_AGGRO1'), + (7806,-1000289,'Thread analyzed! Activating combat plan beta! CLUCK!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'oox SAY_OOX_AGGRO2'), + (7806,-1000290,'CLUCK! Sensors detect spatial anomaly - danger imminent! CLUCK!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'oox SAY_OOX_AMBUSH'), + (7806,-1000291,'No one challanges the Wastewander nomads - not even robotic chickens! ATTACK!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'oox SAY_OOX17_AMBUSH_REPLY'), + (0,-1000292,'Cloaking systems online! CLUCK! Engaging cloak for transport to Booty Bay!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'oox SAY_OOX_END'), + (18351,-1000293,'To the house! Stay close to me, no matter what! I have my gun and ammo there!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'stilwell SAY_DS_START'), + (18351,-1000294,'We showed that one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'stilwell SAY_DS_DOWN_1'), + (18351,-1000295,'One more down!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'stilwell SAY_DS_DOWN_2'), + (20209,-1000296,'We''ve done it! We won!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'stilwell SAY_DS_DOWN_3'), + (20209,-1000297,'Meet me down by the orchard-- I just need to put my gun away.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'stilwell SAY_DS_PROLOGUE'), + (20209,-1000298,'Alright, alright I think I can figure out how to operate this thing...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,393,'wizzlecrank SAY_START'), + (20209,-1000299,'Arrrgh! This isn''t right!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wizzlecrank SAY_STARTUP1'), + (20209,-1000300,'Okay, I think I''ve got it, now. Follow me, $n!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'wizzlecrank SAY_STARTUP2'), + (20209,-1000301,'There''s the stolen shredder! Stop it or Lugwizzle will have our hides!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'wizzlecrank SAY_MERCENARY'), + (20907,-1000302,'Looks like we''re out of woods, eh? Wonder what this does...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wizzlecrank SAY_PROGRESS_1'), + (18879,-1000303,'Come on, don''t break down on me now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,393,'wizzlecrank SAY_PROGRESS_2'), + (20415,-1000304,'That was a close one! Well, let''s get going, it''s still a ways to Ratchet!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wizzlecrank SAY_PROGRESS_3'), + (20415,-1000305,'Hmm... I don''t think this blinking red light is a good thing...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wizzlecrank SAY_END'), + (19685,-1000306,'Let''s get to the others, and keep an eye open for those wolves cutside...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'erland SAY_START_1'), + (19685,-1000307,'Be careful, $N. Those wolves like to hide among the trees.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'erland SAY_START_2'), + (19685,-1000308,'A $C attacks!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'erland SAY_AGGRO_1'), + (19685,-1000309,'Beware! I am under attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'erland SAY_AGGRO_2'), + (19685,-1000310,'Oh no! A $C is upon us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'erland SAY_AGGRO_3'), + (19685,-1000311,'We''re almost there!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'erland SAY_PROGRESS'), + (19685,-1000312,'We made it! Thanks, $N. I couldn''t have gotten without you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'erland SAY_END'), + (19685,-1000313,'It''s good to see you again, Erland. What is your report?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,33,1,'erland SAY_RANE'), + (19685,-1000314,'Masses of wolves are to the east, and whoever lived at Malden''s Orchard is gone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'erland SAY_RANE_REPLY'), + (19685,-1000315,'If I am excused, then I''d like to check on Quinn...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'erland SAY_CHECK_NEXT'), + (19685,-1000316,'Hello, Quinn. How are you faring?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'erland SAY_QUINN'), + (19685,-1000317,'I''ve been better. Ivar the Foul got the better of me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,33,1,'erland SAY_QUINN_REPLY'), + (19685,-1000318,'Try to take better care of yourself, Quinn. You were lucky this time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'erland SAY_BYE'), + (19685,-1000319,'Let the trial begin, Bloodwrath, attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,1,0,'kelerun SayId1'), + (19685,-1000320,'Champion Lightrend, make me proud!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,1,0,'kelerun SayId2'), + (19685,-1000321,'Show this upstart how a real Blood Knight fights, Swiftblade!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,1,0,'kelerun SayId3'), + (19685,-1000322,'Show $n the meaning of pain, Sunstriker!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,1,0,'kelerun SayId4'), + (19685,-1000323,'Mist! I feared I would never see you again! Yes, I am well, do not worry for me. You must rest and recover your health.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'mist SAY_AT_HOME'), + (19685,-1000324,'%s growls in acknowledgement before straightening and making her way off into the forest.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'mist EMOTE_AT_HOME'), + (19685,-1000325,'"Threshwackonator First Mate unit prepared to follow"',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'threshwackonator EMOTE_START'), + (19685,-1000326,'YARRR! Swabie, what have ye done?! He''s gone mad! Baton him down the hatches! Hoist the mast! ARRRR! Every man for hi''self!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'threshwackonator SAY_AT_CLOSE'), + (19685,-1000327,'Ok, $n, let''s go find where I left that mysterious fossil. Follow me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_START'), + (19720,-1000328,'Now where did I put that mysterious fossil? Ah, maybe up there...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_RAMP1_1'), + (19720,-1000329,'Hrm, nothing up here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_RAMP1_2'), + (19720,-1000330,'No mysterious fossil here... Ah, but my copy of Green Hills of Stranglethorn. What a good book!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_BOOK'), + (19720,-1000331,'I bet you I left it in the tent!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_TENT1_1'), + (19720,-1000332,'Oh wait, that''s Hollee''s tent... and it''s empty.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_TENT1_2'), + (19720,-1000333,'Interesting... I hadn''t noticed this earlier...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_MOSS'), + (17768,-1000334,'%s inspects the ancient, mossy stone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,7,0,'remtravel EMOTE_REM_MOSS'), + (1978,-1000335,'Oh wait! I''m supposed to be looking for that mysterious fossil!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_MOSS_PROGRESS'), + (1978,-1000336,'Nope. didn''t leave the fossil back here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_PROGRESS'), + (1978,-1000337,'Ah. I remember now! I gave the mysterious fossil to Hollee! Check with her.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_REMEMBER'), + (1978,-1000338,'%s goes back to work, oblivious to everything around him.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,7,0,'remtravel EMOTE_REM_END'), + (1978,-1000339,'Something tells me this $r wants the mysterious fossil too. Help!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'remtravel SAY_REM_AGGRO'), + (1978,-1000340,'%s howls in delight at the sight of his lunch!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kyle EMOTE_SEE_LUNCH'), + (1978,-1000341,'%s eats his lunch.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kyle EMOTE_EAT_LUNCH'), + (1978,-1000342,'%s thanks you with a special dance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kyle EMOTE_DANCE'), + (1978,-1000343,'Is the way clear? Let''s get out while we can, $N.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kayra SAY_START'), + (1978,-1000344,'Looks like we won''t get away so easy. Get ready!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kayra SAY_AMBUSH1'), + (1978,-1000345,'Let''s keep moving. We''re not safe here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kayra SAY_PROGRESS'), + (1978,-1000346,'Look out, $N! Enemies ahead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kayra SAY_AMBUSH2'), + (11856,-1000347,'We''re almost to the refuge! Let''s go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kayra SAY_END'), + (11856,-1000348,'Ah...the wondrous sound of kodos. I love the way they make the ground shake... inspect the beast for me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kodo round SAY_SMEED_HOME_1'), + (11856,-1000349,'Hey, look out with that kodo! You had better inspect that beast before I give you credit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kodo round SAY_SMEED_HOME_2'), + (9453,-1000350,'That kodo sure is a beauty. Wait a minute, where are my bifocals? Perhaps you should inspect the beast for me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kodo round SAY_SMEED_HOME_3'), + (18262,-1000351,'You, there! Hand over that moonstone and nobody gets hurt!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'sprysprocket SAY_START'), + (18588,-1000352,'%s takes the Southfury moonstone and escapes into the river. Follow her!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'sprysprocket EMOTE_START'), + (18760,-1000353,'Just chill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0,'sprysprocket SAY_WHISPER_CHILL'), + (18760,-1000354,'Stupid grenade picked a fine time to backfire! So much for high quality goblin engineering!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'sprysprocket SAY_GRENADE_FAIL'), + (18760,-1000355,'All right, you win! I surrender! Just don''t hurt me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'sprysprocket SAY_END'), + (18760,-1000356,'Okay, okay... gimme a minute to rest now. You gone and beat me up good.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,14,'calvin SAY_COMPLETE'), + (10181,-1000357,'Let''s go before they find out I''m free!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'KAYA_SAY_START'), + (10181,-1000358,'Look out! We''re under attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'KAYA_AMBUSH'), + (17900,-1000359,'Thank you for helping me. I know my way back from here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'KAYA_END'), + (17969,-1000360,'The strands of LIFE have been severed! The Dreamers must be avenged!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,' ysondre SAY_AGGRO'), + (17969,-1000361,'Come forth, ye Dreamers � and claim your vengeance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,' ysondre SAY_SUMMONDRUIDS'), + (17969,-1000362,'Let''s go $N. I am ready to reach Whitereach Post.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'paoka SAY_START'), + (17969,-1000363,'Now this looks familiar. If we keep heading east, I think we can... Ahh, Wyvern on the attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'paoka SAY_WYVERN'), + (17969,-1000364,'Thanks a bunch... I can find my way back to Whitereach Post from here. Be sure to talk with Motega Firemane; perhaps you can keep him from sending me home.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'paoka SAY_COMPLETE'), + (10646,-1000365,'Be on guard... Arnak has some strange power over the Grimtotem... they will not be happy to see me escape.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lakota SAY_LAKO_START'), + (10646,-1000366,'Look out, the Grimtotem are upon us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lakota SAY_LAKO_LOOK_OUT'), + (10646,-1000367,'Here they come.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lakota SAY_LAKO_HERE_COME'), + (10646,-1000368,'More Grimtotems are coming this way!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lakota SAY_LAKO_MORE'), + (10646,-1000369,'Finally, free at last... I must be going now, thanks for helping me escape. I can get back to Freewind Post by myself.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'lakota SAY_LAKO_END'), + (3465,-1000370,'Stay close, $n. I''ll need all the help I can get to break out of here. Let''s go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'gilthares SAY_GIL_START'), + (3465,-1000371,'At last! Free from Northwatch Hold! I need a moment to catch my breath...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,5,'gilthares SAY_GIL_AT_LAST'), + (3465,-1000372,'Now I feel better. Let''s get back to Ratchet. Come on, $n.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,23,'gilthares SAY_GIL_PROCEED'), + (3465,-1000373,'Looks like the Southsea Freeboters are heavily entrenched on the coast. This could get rough.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,25,'gilthares SAY_GIL_FREEBOOTERS'), + (3465,-1000374,'Help! $C attacking!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'gilthares SAY_GIL_AGGRO_1'), + (3465,-1000375,'$C heading this way fast! Time for revenge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'gilthares SAY_GIL_AGGRO_2'), + (3465,-1000376,'$C coming right at us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'gilthares SAY_GIL_AGGRO_3'), + (3465,-1000377,'Get this $C off of me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'gilthares SAY_GIL_AGGRO_4'), + (3465,-1000378,'Almost back to Ratchet! Let''s keep up the pace...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'gilthares SAY_GIL_ALMOST'), + (3465,-1000379,'Ah, the sweet salt air of Ratchet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'gilthares SAY_GIL_SWEET'), + (3465,-1000380,'Captain Brightsun, $N here has freed me! $N, I am certain the Captain will reward your bravery.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,66,'gilthares SAY_GIL_FREED'), + (21027,-1000381,'I sense the tortured spirits, $n. They are this way, come quickly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'wilda SAY_WIL_START'), + (21027,-1000382,'Watch out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_AGGRO1'), + (21027,-1000383,'Naga attackers! Defend yourself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_AGGRO2'), + (21027,-1000384,'Grant me protection $n, I must break trough their foul magic!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_PROGRESS1'), + (21027,-1000385,'The naga of Coilskar are exceptionally cruel to their prisoners. It is a miracle that I survived inside that watery prison for as long as I did. Earthmother be praised.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_PROGRESS2'), + (21027,-1000386,'Now we must find the exit.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_FIND_EXIT'), + (21027,-1000387,'Lady Vashj must answer for these atrocities. She must be brought to justice!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_PROGRESS4'), + (21027,-1000388,'The tumultuous nature of the great waterways of Azeroth and Draenor are a direct result of tormented water spirits.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_PROGRESS5'), + (21027,-1000389,'It shouldn''t be much further, $n. The exit is just up ahead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_JUST_AHEAD'), + (21027,-1000390,'Thank you, $n. Please return to my brethren at the Altar of Damnation, near the Hand of Gul''dan, and tell them that Wilda is safe. May the Earthmother watch over you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'wilda SAY_WIL_END'), + (5955,-1000391,'I''m Thirsty.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TOOG_THIRST'), + (5955,-1000392,'Torta must be so worried.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TOOG_WORRIED'), + (5955,-1000393,'Torta, my love! I have returned at long last.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TOOG_POST_1'), + (5955,-1000394,'You have any idea how long I''ve been waiting here? And where''s dinner? All that time gone and nothing to show for it?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TORT_POST_2'), + (5955,-1000395,'My dearest Torta. I have been gone for so long. Finally we are reunited. At long last our love can blossom again.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TOOG_POST_3'), + (5955,-1000396,'Enough with the rambling. I am starving! Now, get your dusty shell into that ocean and bring momma some grub.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TORT_POST_4'), + (5955,-1000397,'Yes Torta. Whatever your heart desires...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TOOG_POST_5'), + (5955,-1000398,'And try not to get lost this time...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'tooga SAY_TORT_POST_6'), + (20021,-1000399,'Peace is but a fleeting dream! Let the NIGHTMARE reign!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'taerar SAY_AGGRO'), + (20021,-1000400,'Children of Madness - I release you upon this world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'taerar SAY_SUMMONSHADE'), + (14889,-1000401,'Hope is a DISEASE of the soul! This land shall wither and die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'emeriss SAY_AGGRO'), + (6182,-1000402,'Taste your world''s corruption!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'emeriss SAY_CASTCORRUPTION'), + (6182,-1000403,'Rin''ji is free!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_RIN_FREE'), + (6182,-1000404,'Attack my sisters! The troll must not escape!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_RIN_BY_OUTRUNNER'), + (6182,-1000405,'Rin''ji needs help!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'SAY_RIN_HELP_1'), + (6182,-1000406,'Rin''ji is being attacked!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'SAY_RIN_HELP_2'), + (7780,-1000407,'Rin''ji can see road now, $n. Rin''ji knows the way home.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'SAY_RIN_COMPLETE'), + (7780,-1000408,'Rin''ji will tell you secret now... $n, should go to the Overlook Cliffs. Rin''ji hid something on island there',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'SAY_RIN_PROGRESS_1'), + (7780,-1000409,'You find it, you keep it! Don''t tell no one that Rin''ji talked to you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'SAY_RIN_PROGRESS_2'), + (10638,-1000410,'Here they come! Defend yourself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,5,'kanati SAY_KAN_START'), + (3568,-1000411,'Why don''t we deal with you now, Hendel? Lady Proudmoore will speak for you back in the tower.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'hendel SAY_PROGRESS_1_TER'), + (3568,-1000412,'Please... please... Miss Proudmore. I didn''t mean to...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'hendel SAY_PROGRESS_2_HEN'), + (4966,-1000413,'I apologize for taking so long to get here. I wanted Lady Proudmoore to be present also.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'hendel SAY_PROGRESS_3_TER'), + (4966,-1000414,'We can only stay a few moments before returning to the tower. If you wish to speak to us more you may find us there.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,0,'hendel SAY_PROGRESS_4_TER'), + (4966,-1000415,'%s, too injured, gives up the chase.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'hendel EMOTE_SURRENDER'), + (9999,-1000416,'Well, I''m not sure how far I''ll make it in this state... I''m feeling kind of faint...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_RIN_START_1'), + (9999,-1000417,'Remember, if I faint again, the water that Spraggle gave you will revive me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_RIN_START_2'), + (9999,-1000418,'The heat... I can''t take it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_FAINT_1'), + (9999,-1000419,'Maybe... you could carry me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_FAINT_2'), + (9999,-1000420,'Uuuuuuggggghhhhh....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_FAINT_3'), + (9999,-1000421,'I''m not feeling so well...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_FAINT_4'), + (9999,-1000422,'Where... Where am I?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_WAKE_1'), + (9999,-1000423,'I am feeling a little better now, thank you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_WAKE_2'), + (9999,-1000424,'Yes, I must go on.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_WAKE_3'), + (9999,-1000425,'How am I feeling? Quite soaked, thank you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_WAKE_4'), + (9999,-1000426,'Spraggle! I didn''t think I''d make it back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_RIN_END_1'), + (9999,-1000427,'Ringo! You''re okay!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_SPR_END_2'), + (9999,-1000428,'Oh... I''m feeling faint...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_RIN_END_3'), + (9999,-1000429,'%s collapses onto the ground.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'ringo EMOTE_RIN_END_4'), + (9999,-1000430,'%s stands up after a short pause.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'ringo EMOTE_RIN_END_5'), + (6784,-1000431,'Ugh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_RIN_END_6'), + (9999,-1000432,'Ringo? Wake up! Don''t worry, I''ll take care of you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ringo SAY_SPR_END_7'), + (9999,-1000433,'%s fades away after a long pause.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'ringo EMOTE_RIN_END_8'), + (11218,-1000434,'Liladris has been waiting for me at Maestra''s Post, so we should make haste, $N.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_START'), + (11218,-1000435,'%s looks very sleepy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kerlonian EMOTE_KER_SLEEP_1'), + (11218,-1000436,'%s suddenly falls asleep',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kerlonian EMOTE_KER_SLEEP_2'), + (11218,-1000437,'%s begins to drift off...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kerlonian EMOTE_KER_SLEEP_3'), + (11218,-1000438,'This looks like the perfect place for a nap...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_SLEEP_1'), + (11218,-1000439,'Yaaaaawwwwwnnnn...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_SLEEP_2'), + (11218,-1000440,'Oh, I am so tired...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_SLEEP_3'), + (11218,-1000441,'You don''t mind if I stop here for a moment, do you?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_SLEEP_4'), + (11218,-1000442,'Be on the alert! The Blackwood furbolgs are numerous in the area...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_ALERT_1'), + (11218,-1000443,'It''s quiet... Too quiet...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_ALERT_2'), + (11218,-1000444,'Oh, I can see Liladris from here... Tell her I''m here, won''t you?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'kerlonian SAY_KER_END'), + (11218,-1000445,'%s wakes up!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'kerlonian EMOTE_KER_AWAKEN'), + (18210,-1000482,'Look out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'maghar captive SAY_MAG_START'), + (18210,-1000483,'Don''t let them escape! Kill the strong one first!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'maghar captive SAY_MAG_NO_ESCAPE'), + (18210,-1000484,'More of them coming! Watch out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'maghar captive SAY_MAG_MORE'), + (18210,-1000485,'Where do you think you''re going? Kill them all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'maghar captive SAY_MAG_MORE_REPLY'), + (18210,-1000486,'Ride the lightning, filth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'maghar captive SAY_MAG_LIGHTNING'), + (18210,-1000487,'FROST SHOCK!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'maghar captive SAY_MAG_SHOCK'), + (18210,-1000488,'It is best that we split up now, in case they send more after us. Hopefully one of us will make it back to Garrosh. Farewell stranger.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'maghar captive SAY_MAG_COMPLETE'), + (17077,-1000496,'%s lifts its head into the air, as if listening for something.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'ancestral wolf EMOTE_WOLF_LIFT_HEAD'), + (17077,-1000497,'%s lets out a howl that rings across the mountains to the north and motions for you to follow.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'ancestral wolf EMOTE_WOLF_HOWL'), + (17077,-1000498,'Welcome, kind spirit. What has brought you to us?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'ancestral wolf SAY_WOLF_WELCOME'), + (8856,-1000499,'By your command!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7766,-1000450,'Wait here. Spybot will make Lescovar come out as soon as possible. Be ready! Attack only after you''ve overheard their conversation.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000451,'Good day to you both. I would speak to Lord Lescovar.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1756,-1000452,'Of course. He awaits you in the library.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000453,'Thank you. The Light be with you both.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000454,'Milord, your guest has arrived. He awaits your presence.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000455,'Ah, thank you kindly. I will leave you to the library while I tend to this small matter.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000456,'I shall use the time wisely, milord. Thank you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000457,'It''s time for my meditation, leave me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1756,-1000458,'Yes, sir!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000459,'There you are. What news from Westfall?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1755,-1000460,'VanCleef sends word that the plans are underway. But he''s hear rumors about someone snooping about.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000461,'Hmm, it could be that meddle Shaw. I will see what I can discover. Be off with you. I''ll contact you again soon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7766,-1000462,'That''s it! That''s what you were waiting for! KILL THEM!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (1755,-1000463,'The Defias shall succeed! No meek adventurer will stop us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000464,'My wounds are grave. Forgive my slow pace but my injuries won''t allow me to walk any faster.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000465,'Ah, fresh air, at last! I need a moment to reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000466,'The Blackrock infestation is thick in these parts. I will do my best to keep the pace. Let''s go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000467,'Marshal Marris, sir. Corporal Keeshan of the 12th Sabre Regiment returned from battle and reporting for duty!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000468,'Brave adventurer, thank you for rescuing me! I am sure Marshal Marris will reward your kind deed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (23861,-1000469,'It is too late for us, living one. Take yourself and your friend away from here before you both are... claimed...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (23861,-1000470,'Go away, whoever you are! Witch Hill is mine... mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (23861,-1000471,'It was... terrible... the demon...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (23864,-1000472,'This land was mine long before your wretched kind set foot here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (23864,-1000473,'All who venture here belong to me, including you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (17375, -1000474, '[Fulborg] The Stillpine furbolgs will not soon forget your bravery!', 0, 0, 'Stillpine Capitive free say text 1'), + (17375, -1000475, '[Fulborg] Thank you, $N', 0, 0, 'Stillpine Capitive free say text 2'), + (17375, -1000476, '[Fulborg] Those remaining at Stillpine Hold will welcome you as a hero!', 0, 0, 'Stillpine Capitive free say text 3'); + (26588,-1800001, 'Um... I think one of those wolves is back...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800002, 'He''s going for Mr. Floppy! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800003, 'Oh, no! Look, it''s another wolf, and it''s a biiiiiig one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800004, 'He''s gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800005, 'There''s a big meanie attacking Mr. Floppy! Help! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800006, 'Let''s get out of here before more wolves find us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800007, 'Don''t go toward the light, Mr. Floppy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800008, 'Mr. Floppy, you''re ok! Thank you so much for saving Mr. Floppy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800009, 'I think I see the camp! We''re almost home, Mr. Floppy! Let''s go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800010, 'Mr. Floppy revives',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0, '12027'), + (26588,-1800011, 'The Ravenous Worg chomps down on Mr. Floppy',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,4,0,0, '12027'), + (26588,-1800012, 'Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (26588,-1800013, 'Thank you for helping me get back to the camp. Go tell Walter that I''m safe now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, '12027'), + (27316,-1800014, 'Stand back, $N, the beast might lash out and harm you. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800015, 'GODFREY! Hear me, fiend! Hear me, for I am the Light, here to deliver you from evil! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800016, 'Good, I have your attention, then, Godfrey? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800017, 'We can do this in one of two ways, Godfrey. First,I will simply ask you to tell me what the unholy markings etched upon the pages of this tome mean. What say you? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800018, 'Tell you nothing, preacher. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800019, 'What can you do to me that Kel''Thuzad has not? That the Lich King will not? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800020, 'The book is your salvation, yes... but nothing will you know. NOTHING I SAY! NOTHING! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800021, 'Then it is option two. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800022, 'I say a prayer for you now,lost soul. May the Light take you gracefully. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800023, 'Let the sermon begin.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800024, 'LET THE LIGHT IN,GODFREY GODDARD! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800025, 'IT BURNSSSSS! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800026, 'May the power of Light compel you! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800027, 'LET THE LIGHT IN,GODFREY GODDARD! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800028, 'Never felt hurt like this! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800029, 'LIGHT TAKE YOU, BEAST! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800030, 'The power of the Lich King pales in comparison to the glory of the Light! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800031, 'I thought you would see the Light, Godfrey... Now speak quickly,fiend. What does it say? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800032, 'It tells of the coming apocalypse. How this world will burn and be reborn from death. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800033, 'RUBBISH! Godfrey do you take me for a fool? Do not spew your Scourge propaganda at a man of the Light,heathen! Speak now or I will have the peasants craft a holy water bath and dip you into it like a dog with fleas! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800034, 'NOOOO!!! I tell you! I tell you everything! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800035, 'Humans... Beneath the earth of Wintergarde Village you built a mausoleum! Why do you think Naxxramas attacked that spot? Thel''zan hides deep in your own crypt and sends a thousand-thousand corpses at you! Perish you will... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800036, 'What? There is a mausoleum beneath the old village? What fools we are to not have noticed. We will find and strike down your master now,Godfrey. We will end this nightmare. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800037, 'How? Humans truly are stupid, yes? Thel''zan the Duskbringer! Thel''zan the Lich! He who is born of human flesh and bone,sacrificed all power, protected by the Lich King! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27577,-1800038, 'You cannot stop Thel''zan! He bears the dark gift, bestowed upon him by the Lich King himself! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800039, 'You let us worry about how we kill the bastard, Godfrey. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800040, 'Return to Halford with the information the good mayor was kind enough to submit, $N, I will finish here and squeeze whatever else this wretch might know about Thel''zan. Now, I will show Godfrey the rarely shown "option three." ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (27316,-1800041, 'Let''s you and I have a chat about some things, Godfrey.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), + (29434,-1800042, 'Let me know when you''re ready. I''d prefer sooner than later... what with the slowly dying from poison and all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'injured goblin SAY_QUEST_START'), + (29434,-1800043, 'I''m going to bring the venom sack to Ricket... and then... you know... collapse. Thank you for helping me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'injured goblin SAY_END_WP_REACHED'), + (27463,-1800044, 'Ahh..better..', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'RANDOM_SAY_1'), + (27463,-1800045, 'Whoa.. i nearly died there. Thank you, $Race!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'RANDOM_SAY_2'), + (27463,-1800046, 'Thank you. $Class!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'RANDOM_SAY_3'), + (28787,-1800047, 'Let''s get the hell out of here', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (28787,-1800048, 'Listen up, Venture Company goons! Rule #1: Never keep the prisoner near the explosives.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (28787,-1800049, 'Or THIS is what you get. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (28787,-1800050, 'It''s getting a little hot over here. Shall we move on? ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (28787,-1800051, 'Oh, look, it''s another cartload of explosives! Let''s help them dispose of it. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (28787,-1800052, 'You really shouldn''t play with this stuff. Someone could get hurt.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (28787,-1800053, 'We made it! Thank you for getting me out of that hell hole. Tell Hemet to expect me! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (12717,-1800054, 'Are you sure that you are ready? If we do not have a group of your allies to aid us, we will surely fail.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_START1'), + (12717,-1800055, 'This will be a though fight, $N. Follow me closely.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_START2'), + (12717,-1800056, 'This is the brazier, $N. Put it out. Vorsha is a beast, worthy of praise from no one!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_BRAZIER'), + (12717,-1800057, 'Now we must wait. It won''t be long before the naga realize what we have done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_BRAZIER_WAIT'), + (12717,-1800058, 'Be on your guard, $N!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_ON_GUARD'), + (12717,-1800059, 'Perhaps we will get a moment to rest. But I will not give up until we have faced off against Vorsha!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_REST'), + (12717,-1800060, 'We have done it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_DONE'), + (12717,-1800061, 'You have my deepest gratitude. I thank you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_GRATITUDE'), + (12717,-1800062, 'I am going to patrol the area for a while longer and ensure that things are truly safe.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_PATROL'), + (12717,-1800063, 'Please return to Zoram''gar and report our success to the Warsong runner.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_RETURN'), + + +-- -1 033 000 SHADOWFANG KEEP + (0,-1033000,'Follow me and I''ll open the courtyard door for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,1,'prisoner ashcrombe SAY_FREE_AS'), + (0,-1033001,'I have just the spell to get this door open. Too bad the cell doors weren''t locked so haphazardly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,1,'prisoner ashcrombe SAY_OPEN_DOOR_AS'), + (0,-1033002,'There it is! Wide open. Good luck to you conquering what lies beyond. I must report back to the Kirin Tor at once!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,1,'prisoner ashcrombe SAY_POST_DOOR_AS'), + (0,-1033003,'Free from this wretched cell at last! Let me show you to the courtyard....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'prisoner adamant SAY_FREE_AD'), + (0,-1033004,'You are indeed courageous for wanting to brave the horrors that lie beyond this door.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'prisoner adamant SAY_OPEN_DOOR_AD'), + (0,-1033005,'There we go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'prisoner adamant SAY_POST1_DOOR_AD'), + (0,-1033006,'Good luck with Arugal. I must hurry back to Hadrec now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'prisoner adamant SAY_POST2_DOOR_AD'), + (3849,-1033007,'About time someone killed the wretch.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,1,'prisoner adamant SAY_BOSS_DIE_AD'), + (3850,-1033008,'For once I agree with you... scum.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,7,1,'prisoner ashcrombe SAY_BOSS_DIE_AS'), + (4275,-1033009,'Who dares interfere with the Sons of Arugal?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + +-- -1 034 000 STOCKADES +-- -1 036 000 DEADMINES + (0,-1036000,'You there, check out that noise!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5775,1,7,0,'smite INST_SAY_ALARM1'), + (0,-1036001,'We''re under attack! A vast, ye swabs! Repel the invaders!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5777,1,7,0,'smite INST_SAY_ALARM2'), + +-- -1 043 000 WAILING CAVERNS + (3678,-1043000,'At last! Naralex can be awakened! Come aid me, brave adventurers!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Disciple SAY_AT_LAST'), + (3678,-1043001,'I must make the necessary preparations before the awakening ritual can begin. You must protect me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_MAKE_PREPARATIONS'), + (3678,-1043002,'These caverns were once a temple of promise for regrowth in the Barrens. Now, they are the halls of nightmares.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_TEMPLE_OF_PROMISE'), + (3678,-1043003,'Come. We must continue. There is much to be done before we can pull Naralex from his nightmare.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_MUST_CONTINUE'), + (3678,-1043004,'Within this circle of fire I must cast the spell to banish the spirits of the slain Fanglords.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_BANISH_THE_SPIRITS'), + (3678,-1043005,'The caverns have been purified. To Naralex''s chamber we go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_CAVERNS_PURIFIED'), + (3678,-1043006,'Beyond this corridor, Naralex lies in fitful sleep. Let us go awaken him before it is too late.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_BEYOND_THIS_CORRIDOR'), + (3678,-1043007,'Protect me brave souls as I delve into this Emerald Dream to rescue Naralex and put an end to this corruption!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_EMERALD_DREAM'), + (3678,-1043008,'%s begins to perform the awakening ritual on Naralex.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Disciple EMOTE_AWAKENING_RITUAL'), + (3678,-1043009,'%s tosses fitfully in troubled sleep.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Naralex EMOTE_TROUBLED_SLEEP'), + (3678,-1043010,'%s writhes in agony. The Disciple seems to be breaking through.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Naralex EMOTE_WRITHE_IN_AGONY'), + (3678,-1043011,'%s dreams up a horrendous vision. Something stirs beneath the murky waters.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Naralex EMOTE_HORRENDOUS_VISION'), + (3678,-1043012,'This Mutanus the Devourer is a minion from Naralex''s nightmare no doubt!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_MUTANUS_THE_DEVOURER'), + (3678,-1043013,'I AM AWAKE, AT LAST!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Naralex SAY_I_AM_AWAKE'), + (3678,-1043014,'At last! Naralex awakes from the nightmare.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_NARALEX_AWAKES'), + (3678,-1043015,'Ah, to be pulled from the dreaded nightmare! I thank you, my loyal Disciple, along with your brave companions.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Naralex SAY_THANK_YOU'), + (3678,-1043016,'We must go and gather with the other Disciples. There is much work to be done before I can make another attempt to restore the Barrens. Farewell, brave souls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Naralex SAY_FAREWELL'), + (3678,-1043017,'Attacked! Help get this $N off of me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Disciple SAY_ATTACKED'), + +-- -1 047 000 RAZORFEN KRAUL + (4508,-1047000,'Phew! Finally, out here. However, it will not become easy. Detain your eyes after annoyance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047001,'There on top resides Charlga Razorflank. The damned old Crone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047002,'Help! Get this Raging Agam''ar from me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047003,'In this ditch there are Blueleaf Tuber! As if the gold waited only to be dug out, I say it you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047004,'Danger is behind every corner.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047005,'I do not understand how these disgusting animals can live at such a place.... puh as this stinks!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047006,'I think, I see a way how we come out of this damned thorn tangle.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047007,'I am glad that we are out again from this damned ditch. However, up here it is not much better!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047008,'Finally! I am glad that I come, finally out here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047009,'I will rather rest a moment and come again to breath, before I return to Ratchet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + (4508,-1047010,'Many thanks for your help.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Willix'), + +-- -1 048 000 BLACKFATHOM DEEPS + (4832,-1048000,'Just...Dust...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5803,1,0,0,''), (4832,-1048001,'Sleep...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5804,1,0,0,''), +(4832,-1048002,'Who dares disturb my meditation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5805,1,0,0,''), +(6729,-1048003,'Aku''mai is dead! At last, I can leave this wretched place.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(6729,-1048004,'Speak with me to hear my tale',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + +-- -1 060 000 863_world_scripts.sql + (0,-1060005,'REUSE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'REUSE'), + (0,-1060004,'REUSE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'REUSE'), + (0,-1060003,'REUSE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'REUSE'), + (0,-1060002,'REUSE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'REUSE'), + (0,-1060001,'REUSE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'REUSE'), + (0,-1060000,'REUSE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'REUSE'), + +-- -1 070 000 ULDAMAN + (7228,-1070000,'None may steal the secrets of the makers!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5851,1,0,0,'ironaya SAY_AGGRO'), + (0,-1070001,'Taste blade, mongrel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_GUARD_SIL_AGGRO1'), + (0,-1070002,'Please tell me that you didn''t just do what I think you just did. Please tell me that I''m not going to have to hurt you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_GUARD_SIL_AGGRO2'), + (0,-1070003,'As if we don''t have enough problems, you go and create more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'SAY_GUARD_SIL_AGGRO3'), + (620,-1070004,'looks up at you quizzically. Maybe you should inspect it?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'cluck EMOTE_A_HELLO'), + (0,-1070005,'looks at you unexpectadly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'cluck EMOTE_H_HELLO'), + (620,-1070006,'starts pecking at the feed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'cluck EMOTE_CLUCK_TEXT2'), + +-- -1 090 000 GNOMEREGAN + (7998,-1090000,'With your help, I can evaluate these tunnels.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090001,'Let''s see if we can find out where these Troggs are coming from... and put a stop to the invasion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090002,'Such devastation... what horrible mess...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090003,'It''s quiet here...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090004,'...too quiet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090005,'Look! Over there at the tunnel wall!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090006,'Trogg incrusion! Defend me while i blast the hole closed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090007,'The charges are set. Get back before they blow!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090008,'Incoming blast in 10 seconds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090009,'Incoming blast in 5 seconds. Clear the tunnel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090010,'FIRE IN THE HOLE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090011,'Well done! Without your help I would have never been able to thwart that wave of troggs.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090012,'Did you hear something?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090013,'I heard something over there.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090014,'More troggs! Ward them off as I prepare the explosives!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090015,'The final charge is set. Stand back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090016,'The final charge is set. Stand back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090017,'Incoming blast in 10 seconds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090018,'Incoming blast in 5 seconds. Clear the tunnel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090019,'I don''t think one charge is going to cut it. Keep fending them off!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090020,'FIRE IN THE HOLE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090021,'Well done! Without your help I would have never been able to thwart that wave of troggs.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090022,'Did you hear something?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090023,'I heard something over there.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090024,'More troggs! Ward them off as I prepare the explosives!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090025,'The final charge is set. Stand back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090026,'10 seconds to blast! Stand back!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090027,'5 seconds until detonation!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7361,-1090028,'We come from below! You can never stop us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + +-- -1 109 000 SUNKEN TEMPLE + +-- -1 129 000 RAZORFEN DOWNS + (7358,-1129000,'You''ll never leave this place... alive.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5825,1,0,0,'amnennar SAY_AGGRO'), + (7358,-1129001,'To me, my servants!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5828,1,0,0,'amnennar SAY_SUMMON60'), + (7358,-1129002,'Come, spirits, attend your master!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5829,1,0,0,'amnennar SAY_SUMMON30'), + (7358,-1129003,'I am the hand of the Lich King!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5827,1,0,0,'amnennar SAY_HP'), + (7358,-1129004,'Too...easy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5826,1,0,0,'amnennar SAY_KILL'), + +-- -1 189 000 SCARLET MONASTERY + (3975,-1189000,'Ah, I have been waiting for a real challenge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5830,1,0,0,'herod SAY_AGGRO'), + (3975,-1189001,'Blades of Light!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5832,1,0,0,'herod SAY_WHIRLWIND'), + (3975,-1189002,'Light, give me strength!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5833,1,0,0,'herod SAY_ENRAGE'), + (3975,-1189003,'Hah, is that all?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5831,1,0,0,'herod SAY_KILL'), + (3975,-1189004,'%s becomes enraged!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'herod EMOTE_ENRAGE'), + (3976,-1189005,'Infidels! They must be purified!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5835,1,0,0,'mograine SAY_MO_AGGRO'), + (3976,-1189006,'Unworthy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5836,1,0,0,'mograine SAY_MO_KILL'), + (3976,-1189007,'At your side, milady!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5837,1,0,0,'mograine SAY_MO_RESSURECTED'), + (3977,-1189008,'What, Mograine has fallen? You shall pay for this treachery!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5838,1,0,0,'whitemane SAY_WH_INTRO'), + (3977,-1189009,'The Light has spoken!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5839,1,0,0,'whitemane SAY_WH_KILL'), + (3977,-1189010,'Arise, my champion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5840,1,0,0,'whitemane SAY_WH_RESSURECT'), + (3983,-1189011,'Tell me... tell me everything!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5847,1,0,0,'vishas SAY_AGGRO'), + (3983,-1189012,'Naughty secrets!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5849,1,0,0,'vishas SAY_HEALTH1'), + (3983,-1189013,'I''ll rip the secrets from your flesh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5850,1,0,0,'vishas SAY_HEALTH2'), + (3983,-1189014,'Purged by pain!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5848,1,0,0,'vishas SAY_KILL'), + (3983,-1189015,'The monster got what he deserved.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'vishas SAY_TRIGGER_VORREL'), + (4543,-1189016,'We hunger for vengeance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5844,1,0,0,'thalnos SAY_AGGRO'), + (4543,-1189017,'No rest, for the angry dead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5846,1,0,0,'thalnos SAY_HEALTH'), + (4543,-1189018,'More... More souls.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5845,1,0,0,'thalnos SAY_KILL'), + (6487,-1189019,'You will not defile these mysteries!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5842,1,0,0,'doan SAY_AGGRO'), + (6487,-1189020,'Burn in righteous fire!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5843,1,0,0,'doan SAY_SPECIALAE'), + (3974,-1189021,'Release the hounds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5841,1,0,0,'loksey SAY_AGGRO'), + +-- -1 209 000 ZUL'FARRAK + +-- -1 229 000 BLACKROCK SPIRE + +-- -1 230 000 BLACKROCK DEPTHS + (9503,-1230000,'Ah, hits the spot!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'rocknot SAY_GOT_BEER'), + (9019,-1230001,'Come to aid the Throne!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'dagran SAY_AGGRO'), + (9019,-1230002,'Hail to the king, baby!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'dagran SAY_SLAY'), + +-- -1 249 000 ONYXIA'S LAIR + (10184,-1249000,'How fortuitous. Usually, I must leave my lair to feed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'onyxia SAY_AGGRO'), + (10184,-1249001,'Learn your place mortal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'onyxia SAY_KILL'), + (10184,-1249002,'This meaningless exertion bores me. I''ll incinerate you all from above!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,254,'onyxia SAY_PHASE_2_TRANS'), + (10184,-1249003,'It seems you''ll need another lesson, mortals!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,293,'onyxia SAY_PHASE_3_TRANS'), + (10184,-1249004,'%s takes in a deep breath...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'onyxia EMOTE_BREATH'), + +-- -1 269 000 OPENING OF THE DARK PORTAL (BLACK MORASS) + (17880,-1269000,'Why do you persist? Surely you can see the futility of it all. It is not too late! You may still leave with your lives ...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10442,1,0,0,'temporus SAY_ENTER'), + (17880,-1269001,'So be it ... you have been warned.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10444,1,0,0,'temporus SAY_AGGRO'), + (17880,-1269002,'Time... sands of time is run out for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10443,1,0,0,'temporus SAY_BANISH'), + (17880,-1269003,'You should have left when you had the chance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10445,1,0,0,'temporus SAY_SLAY1'), + (17880,-1269004,'Your days are done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10446,1,0,0,'temporus SAY_SLAY2'), + (17880,-1269005,'My death means ... little.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10447,1,0,0,'temporus SAY_DEATH'), + (17879,-1269006,'Why do you aid the Magus? Just think of how many lives could be saved if the portal is never opened, if the resulting wars could be erased ...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10412,1,0,0,'chrono_lord_deja SAY_ENTER'), + (17879,-1269007,'If you will not cease this foolish quest, then you will die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10414,1,0,0,'chrono_lord_deja SAY_AGGRO'), + (17879,-1269008,'You have outstayed your welcome, Timekeeper. Begone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10413,1,0,0,'chrono_lord_deja SAY_BANISH'), + (17879,-1269009,'I told you it was a fool''s quest!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10415,1,0,0,'chrono_lord_deja SAY_SLAY1'), + (17879,-1269010,'Leaving so soon?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10416,1,0,0,'chrono_lord_deja SAY_SLAY2'), + (17879,-1269011,'Time ... is on our side.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10417,1,0,0,'chrono_lord_deja SAY_DEATH'), + (17881,-1269012,'The time has come to shatter this clockwork universe forever! Let us no longer be slaves of the hourglass! I warn you: those who do not embrace the greater path shall become victims of its passing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10400,1,0,0,'aeonus SAY_ENTER'), + (17881,-1269013,'Let us see what fate lays in store...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10402,1,0,0,'aeonus SAY_AGGRO'), + (17881,-1269014,'Your time is up, slave of the past!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10401,1,0,0,'aeonus SAY_BANISH'), + (17881,-1269015,'One less obstacle in our way!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10403,1,0,0,'aeonus SAY_SLAY1'), + (17881,-1269016,'No one can stop us! No one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10404,1,0,0,'aeonus SAY_SLAY2'), + (17881,-1269017,'It is only a matter...of time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10405,1,0,0,'aeonus SAY_DEATH'), + (17881,-1269018,'goes into a frenzy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'aeonus EMOTE_FRENZY'), + (20201,-1269019,'Stop! Do not go further, mortals. You are ill-prepared to face the forces of the Infinite Dragonflight. Come, let me help you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'saat SAY_SAAT_WELCOME'), + (15608,-1269020,'The time has come! Gul''dan, order your warlocks to double their efforts! Moments from now the gateway will open, and your Horde will be released upon this ripe, unsuspecting world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10435,1,0,0,'medivh SAY_ENTER'), + (15608,-1269021,'What is this? Champions, coming to my aid? I sense the hand of the dark one in this. Truly this sacred event bears his blessing?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10436,1,0,0,'medivh SAY_INTRO'), + (15608,-1269022,'Champions, my shield grows weak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10437,1,0,0,'medivh SAY_WEAK75'), + (15608,-1269023,'My powers must be concentrated on the portal! I do not have time to hold the shield!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10438,1,0,0,'medivh SAY_WEAK50'), + (15608,-1269024,'The shield is nearly gone! All that I have worked for is in danger!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10439,1,0,0,'medivh SAY_WEAK25'), + (15608,-1269025,'No... damn this feeble mortal coil...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10441,1,0,0,'medivh SAY_DEATH'), + (15608,-1269026,'I am grateful for your aid, champions. Now, Gul''dan''s Horde will sweep across this world, like a locust swarm, and all my designs, all my carefully laid plans will at last fall into place.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10440,1,0,0,'medivh SAY_WIN'), + (15608,-1269027,'Orcs of the Horde! This portalis the gateway to your new destiny! Azeroth lies before you, ripe for the taking!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'medivh SAY_ORCS_ENTER'), + (15608,-1269028,'Gul''dan speaks the truth! We should return at once to tell our brothers of the news! Retreat back trought the portal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'medivh SAY_ORCS_ANSWER'), + +-- -1 289 000 SCHOLOMANCE + +-- -1 309 000 ZUL'GURUB + (14507,-1309000,'Let the coils of hate unfurl!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8421,1,0,0,'venoxis SAY_TRANSFORM'), + (14507,-1309001,'Ssserenity..at lassst!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'venoxis SAY_DEATH'), + (14517,-1309002,'Lord Hir''eek, grant me wings of vengance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8417,1,0,0,'jeklik SAY_AGGRO'), + (14517,-1309003,'I command you to rain fire down upon these invaders!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'jeklik SAY_RAIN_FIRE'), + (14517,-1309004,'Finally ...death. Curse you Hakkar! Curse you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8422,1,0,0,'jeklik SAY_DEATH'), + (14510,-1309005,'Draw me to your web mistress Shadra. Unleash your venom!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8418,1,0,0,'marli SAY_AGGRO'), + (14510,-1309006,'Shadra, make of me your avatar!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'marli SAY_TRANSFORM'), + (14510,-1309007,'Aid me my brood!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'marli SAY_SPIDER_SPAWN'), + (14510,-1309008,'Bless you mortal for this release. Hakkar controls me no longer...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8423,1,0,0,'marli SAY_DEATH'), + (14509,-1309009,'Shirvallah, fill me with your RAGE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8419,1,0,0,'thekal SAY_AGGRO'), + (14509,-1309010,'Hakkar binds me no more! Peace at last!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8424,1,0,0,'thekal SAY_DEATH'), + (14515,-1309011,'Bethekk, your priestess calls upon your might!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8416,1,0,0,'arlokk SAY_AGGRO'), + (14515,-1309012,'Feast on $n, my pretties!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'arlokk SAY_FEAST_PANTHER'), + (14515,-1309013,'At last, I am free of the Soulflayer!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8412,1,0,0,'arlokk SAY_DEATH'), + (11380,-1309014,'Welcome to da great show friends! Step right up to die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8425,1,0,0,'jindo SAY_AGGRO'), + (11382,-1309015,'I''ll feed your souls to Hakkar himself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8413,1,0,0,'mandokir SAY_AGGRO'), + (11382,-1309016,'DING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'mandokir SAY_DING_KILL'), + (11382,-1309017,'GRATS!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'mandokir SAY_GRATS_JINDO'), + (11382,-1309018,'I''m keeping my eye on you, $N!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'mandokir SAY_WATCH'), + (11382,-1309019,'Don''t make me angry. You won''t like it when I''m angry.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'mandokir SAY_WATCH_WHISPER'), + (14834,-1309020,'PRIDE HERALDS THE END OF YOUR WORLD. COME, MORTALS! FACE THE WRATH OF THE SOULFLAYER!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8414,1,0,0,'hakkar SAY_AGGRO'), + (14834,-1309021,'Fleeing will do you no good, mortals!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'hakkar SAY_FLEEING'), + (14834,-1309022,'You dare set foot upon Hakkari holy ground? Minions of Hakkar, destroy the infidels!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'hakkar SAY_MINION_DESTROY'), + (14834,-1309023,'Minions of Hakkar, hear your God. The sanctity of this temple has been compromised. Invaders encroach upon holy ground! The Altar of Blood must be protected. Kill them all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'hakkar SAY_PROTECT_ALTAR'), + +-- -1 329 000 STRATHOLME + (11136,-1329000,'Thanks to Egan',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'freed_soul SAY_ZAPPED0'), + (11136,-1329001,'Rivendare must die',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'freed_soul SAY_ZAPPED1'), + (11136,-1329002,'Who you gonna call?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'freed_soul SAY_ZAPPED2'), + (11136,-1329003,'Don''t cross those beams!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'freed_soul SAY_ZAPPED3'), + +-- -1 349 000 MARAUDON + +-- -1 350 000 Gates of Ahn'Qiraj Opening + (15381,-1350000,'We must act quickly or all shall be lost!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_1'), + (15381,-1350001,'NOW, STAGHELM! WE GO NOW! Prepare your magic!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,81,'ANACHRONOS_SAY_2'), + (15381,-1350002,'Stay close...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_3'), + (15381,-1350003,'The sands of time will halt, but only for a moment! I will now conjure the barrier.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_4'), + (15381,-1350004,'FINISH THE SPELL STAGHELM! I CANNOT HOLD THE GLYPHS OF WARDING IN PLACE MUCH LONGER! CALL FORTH THE ROOTS!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,53,'ANACHRONOS_SAY_5'), + (15381,-1350005,'It... It is over, Lord Staghelm. We are victorious. Albeit the cost for this victory was great.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_6'), + (15381,-1350006,'There is but one duty that remains...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_7'), + (15381,-1350007,'Before I leave this place, I make one final offreing to you, Lord Staghelm. Should a time arise in which you must gain entry to this accursed fortress, use the Scepter of the Shifting Sands on the sacred gong. The magic holding the barrier together will dissipate and the horrors of Ahn''Qiraj will be unleashed upon the world once more.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_8'), + (15381,-1350008,'Lord Staghelm, where are you going? You would shatter our bond for the sake of pride?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_9'), + (15381,-1350009,'And now you know all that there is to know, mortal...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ANACHRONOS_SAY_10'), + (15381,-1350010,'hands the Scepter of the Shifting Sands to Fandral Staghelm.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,1,'ANACHRONOS_EMOTE_1'), + (15381,-1350011,'shakes his head in dissapointment.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,274,'ANACHRONOS_EMOTE_2'), + (15381,-1350012,'kneels down to pick up the fragments of the shattered scepter.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,87,'ANACHRONOS_EMOTE_3'), + (15382,-1350013,'My forces cannot overcome the Qiraji defenses. We will not be able to get close enough to place your precious barrier, dragon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'FANDRAL_SAY_1'), + (15382,-1350014,'It is done dragon. Lead the way...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'FANDRAL_SAY_2'), + (15382,-1350015,'Ancient ones guide my hand... Wake from your slumber! WAKE AND SEAL THIS CURSED PLACE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'FANDRAL_SAY_3'), + (15382,-1350016,'After the savagery that my people have witnessed and felt, you expect me to accept another burden, dragon? Surely you are mad.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'FANDRAL_SAY_4'), + (15382,-1350017,'I want nothing to do with Silithus, the Qiraji and least of all, any damned dragons!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'FANDRAL_SAY_5'), + (15382,-1350018,'My son''s soul will find no comfort in this hollow victory, dragon. I will have him back.Thought it takes a millennia, I WILL have my son back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,254,'FANDRAL_SAY_6'), + (15382,-1350019,'falls to one knee - exhausted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,16,'FANDRAL_EMOTE_1'), + (15382,-1350020,'hurls the Scepter of the Shifting Sands into the barrier, shattering it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'FANDRAL_EMOTE_2'), + (15379,-1350021,'Aye, Fandral, remember these words: Let not your grief guide your faith. These thoughts you hold... dark places you go, night elf. Absolution cannot be had through misguided vengeance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'CAELESTRASZ_SAY_1'), + (15379,-1350022,'Do not forget the sacrifices made on this day, night elf. We have all suffered immensely at the hands of these beasts.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'CAELESTRASZ_SAY_2'), + (15379,-1350023,'Alexstrasza grant me the resolve to drive our enemies back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,53,'CAELESTRASZ_YELL_1'), + (15380,-1350024,'This distraction will give you and the young druid time enough to seal the gate. Do not falter. Now, let us see how they deal with chaotic magic.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'ARYGOS_SAY_1'), + (15380,-1350025,'Let them feel the wrath of the Blue Flight! May Malygos protect me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,53,'ARYGOS_YELL_1'), + (15380,-1350026,'nods knowingly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,273,'ARYGOS_EMOTE_1'), + (15378,-1350027,'There is a way...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'MERITHRA_SAY_1'), + (15378,-1350028,'We will push them back, Anachronos. This I vow. Uphold the end of this task. Let not your hands falter as you seal our fates behind the barrier.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'MERITHRA_SAY_2'), + (15378,-1350029,'Succumb to the endless dream, little ones. Let it consume you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,53,'MERITHRA_YELL_1'), + (15378,-1350030,'glances at her compatriots.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,2,'MERITHRA_EMOTE_1'), + +-- -1 389 000 RAGEFIRE CHASM + +-- -1 409 000 MOLTEN CORE + (12056,-1409000,'%s performs one last service for Ragnaros.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'geddon EMOTE_SERVICE'), + (11982,-1409001,'%s goes into a killing frenzy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'magmadar EMOTE_FRENZY'), + (11988,-1409002,'%s refuses to die while its master is in trouble.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'core rager EMOTE_LOWHP'), + (12018,-1409003,'Reckless mortals, none may challenge the sons of the living flame!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8035,1,0,0,'majordomo SAY_AGGRO'), + (12018,-1409004,'The runes of warding have been destroyed! Hunt down the infedels my bretheren.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8039,1,0,0,'majordomo SAY_SPAWN'), + (12018,-1409005,'Ashes to Ashes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8037,1,0,0,'majordomo SAY_SLAY'), + (12018,-1409006,'Burn mortals! Burn for this transgression!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8036,1,0,0,'majordomo SAY_SPECIAL'), + (12018,-1409007,'Impossible! Stay your attack mortals! I submitt! I submitt! Brashly you have come to rest the secrets of the living flame. You will soon regret the recklessness of your quest. I go now to summon the lord whos house this is. Should you seek an audiance with him your paltry lives will surly be forfit. Nevertheless seek out his lair if you dare!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8038,1,0,0,'majordomo SAY_DEFEAT'), + (12018,-1409008,'Behold Ragnaros, the Firelord! He who was ancient when this world was young! Bow before him, mortals! Bow before your ending!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8040,1,0,0,'ragnaros SAY_SUMMON_MAJ'), + (12018,-1409009,'TOO SOON! YOU HAVE AWAKENED ME TOO SOON, EXECUTUS! WHAT IS THE MEANING OF THIS INTRUSION?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8043,1,0,0,'ragnaros SAY_ARRIVAL1_RAG'), + (12018,-1409010,'These mortal infidels, my lord! They have invaded your sanctum, and seek to steal your secrets!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8041,1,0,0,'ragnaros SAY_ARRIVAL2_MAJ'), + (12018,-1409011,'FOOL! YOU ALLOWED THESE INSECTS TO RUN RAMPANT THROUGH THE HALLOWED CORE, AND NOW YOU LEAD THEM TO MY VERY LAIR? YOU HAVE FAILED ME, EXECUTUS! JUSTICE SHALL BE MET, INDEED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8044,1,0,0,'ragnaros SAY_ARRIVAL3_RAG'), + (12018,-1409012,'NOW FOR YOU, INSECTS. BOLDLY YOU SAUGHT THE POWER OF RAGNAROS NOW YOU SHALL SEE IT FIRST HAND.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8045,1,0,0,'ragnaros SAY_ARRIVAL5_RAG'), + (11502,-1409013,'COME FORTH, MY SERVANTS! DEFEND YOUR MASTER!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8049,1,0,0,'ragnaros SAY_REINFORCEMENTS1'), + (11502,-1409014,'YOU CANNOT DEFEAT THE LIVING FLAME! COME YOU MINIONS OF FIRE! COME FORTH YOU CREATURES OF HATE! YOUR MASTER CALLS!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8050,1,0,0,'ragnaros SAY_REINFORCEMENTS2'), + (11502,-1409015,'BY FIRE BE PURGED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8046,1,0,0,'ragnaros SAY_HAND'), + (11502,-1409016,'TASTE THE FLAMES OF SULFURON!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8047,1,0,0,'ragnaros SAY_WRATH'), + (11502,-1409017,'DIE INSECT!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8051,1,0,0,'ragnaros SAY_KILL'), + (11502,-1409018,'MY PATIENCE IS DWINDLING! COME NATS TO YOUR DEATH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8048,1,0,0,'ragnaros SAY_MAGMABURST'), + +-- -1 429 000 DIRE MAUL + +-- -1 469 000 BLACKWING LAIR + (12017,-1469000,'None of your kind should be here! You''ve doomed only yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8286,1,0,0,'broodlord SAY_AGGRO'), + (12017,-1469001,'Clever Mortals but I am not so easily lured away from my sanctum!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8287,1,0,0,'broodlord SAY_LEASH'), + (14020,-1469002,'goes into a killing frenzy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'chromaggus EMOTE_FRENZY'), + (14020,-1469003,'flinches as its skin shimmers.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'chromaggus EMOTE_SHIMMER'), + (10162,-1469004,'In this world where time is your enemy, it is my greatest ally. This grand game of life that you think you play in fact plays you. To that I say...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'victor_nefarius SAY_GAMESBEGIN_1'), + (10162,-1469005,'Let the games begin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8280,1,0,0,'victor_nefarius SAY_GAMESBEGIN_2'), + (10162,-1469006,'Ah, the heroes. You are persistent, aren''t you. Your allied attempted to match his power against mine, and had to pay the price. Now he shall serve me, by slaughtering you. Get up little red wyrm and destroy them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8279,1,0,0,'victor_nefarius SAY_VAEL_INTRO'), + (11583,-1469007,'Well done, my minions. The mortals'' courage begins to wane! Now, let''s see how they contend with the true Lord of Blackrock Spire!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8288,1,0,0,'nefarian SAY_AGGRO'), + (11583,-1469008,'Enough! Now you vermin shall feel the force of my birthright, the fury of the earth itself.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8289,1,0,0,'nefarian SAY_XHEALTH'), + (11583,-1469009,'Burn, you wretches! Burn!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8290,1,0,0,'nefarian SAY_SHADOWFLAME'), + (11583,-1469010,'Impossible! Rise my minions! Serve your master once more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8291,1,0,0,'nefarian SAY_RAISE_SKELETONS'), + (11583,-1469011,'Worthless $N! Your friends will join you soon enough!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8293,1,0,0,'nefarian SAY_SLAY'), + (11583,-1469012,'This cannot be! I am the Master here! You mortals are nothing to my kind! DO YOU HEAR? NOTHING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8292,1,0,0,'nefarian SAY_DEATH'), + (11583,-1469013,'Mages too? You should be more careful when you play with magic...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_MAGE'), + (11583,-1469014,'Warriors, I know you can hit harder than that! Let''s see it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_WARRIOR'), + (11583,-1469015,'Druids and your silly shapeshifting. Let''s see it in action!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_DRUID'), + (11583,-1469016,'Priests! If you''re going to keep healing like that, we might as well make it a little more interesting!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_PRIEST'), + (11583,-1469017,'Paladins, I''ve heard you have many lives. Show me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_PALADIN'), + (11583,-1469018,'Shamans, show me what your totems can do!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_SHAMAN'), + (11583,-1469019,'Warlocks, you shouldn''t be playing with magic you don''t understand. See what happens?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_WARLOCK'), + (11583,-1469020,'Hunters and your annoying pea-shooters!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_HUNTER'), + (11583,-1469021,'Rogues? Stop hiding and face me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'nefarian SAY_ROGUE'), + (12435,-1469022,'You''ll pay for forcing me to do this.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8275,1,0,0,'razorgore SAY_EGGS_BROKEN1'), + (12435,-1469023,'Fools! These eggs are more precious than you know.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8276,1,0,0,'razorgore SAY_EGGS_BROKEN2'), + (12435,-1469024,'No! Not another one! I''ll have your heads for this atrocity.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8277,1,0,0,'razorgore SAY_EGGS_BROKEN3'), + (12435,-1469025,'If I fall into the abyss I''ll take all of you mortals with me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8278,1,0,0,'razorgore SAY_DEATH'), + (13020,-1469026,'Too late...friends. Nefarius'' corruption has taken hold. I cannot...control myself.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8281,1,0,0,'vaelastrasz SAY_LINE1'), + (13020,-1469027,'I beg you Mortals, flee! Flee before I lose all control. The Black Fire rages within my heart. I must release it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8282,1,0,0,'vaelastrasz SAY_LINE2'), + (13020,-1469028,'FLAME! DEATH! DESTRUCTION! COWER MORTALS BEFORE THE WRATH OF LORD....NO! I MUST FIGHT THIS!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8283,1,0,0,'vaelastrasz SAY_LINE3'), + (13020,-1469029,'Nefarius'' hate has made me stronger than ever before. You should have fled, while you could, mortals! The fury of Blackrock courses through my veins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8285,1,0,0,'vaelastrasz SAY_HALFLIFE'), + (13020,-1469030,'Forgive me $N, your death only adds to my failure.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8284,1,0,0,'vaelastrasz SAY_KILLTARGET'), + (11981,-1469031,'goes into a frenzy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'flamegor EMOTE_FRENZY'), + +/* Ruins of Ahn'qiraj have not assigned scripts or missing scripts */ +-- -1 509 000 RUINS OF AHN'QIRAJ + (0,-1509000,'senses your fear.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'moam EMOTE_AGGRO'), + (0,-1509001,'bristles with energy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'moan EMOTE_MANA_FULL'), + (0,-1509002,'sets eyes on $N!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'buru EMOTE_TARGET'), + (0,-1509003,'They come now. Try not to get yourself killed, young blood.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'andorov SAY_ANDOROV_INTRO'), + (0,-1509004,'Remember, Rajaxx, when I said I''d kill you last? I lied...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'andorov SAY_ANDOROV_ATTACK'), + (0,-1509005,'The time of our retribution is at hand! Let darkness reign in the hearts of our enemies!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8612,1,0,0,'rajaxx SAY_WAVE3'), + (0,-1509006,'No longer will we wait behind barred doors and walls of stone! No longer will our vengeance be denied! The dragons themselves will tremble before our wrath!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8610,1,0,0,'rajaxx SAY_WAVE4'), + (0,-1509007,'Fear is for the enemy! Fear and death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8608,1,0,0,'rajaxx SAY_WAVE5'), + (0,-1509008,'Staghelm will whimper and beg for his life, just as his whelp of a son did! One thousand years of injustice will end this day!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8611,1,0,0,'rajaxx SAY_WAVE6'), + (0,-1509009,'Fandral! Your time has come! Go and hide in the Emerald Dream and pray we never find you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8607,1,0,0,'rajaxx SAY_WAVE7'), + (0,-1509010,'Impudent fool! I will kill you myself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8609,1,0,0,'rajaxx SAY_INTRO'), + (0,-1509011,'Attack and make them pay dearly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8603,1,0,0,'rajaxx SAY_UNK1'), + (0,-1509012,'Crush them! Drive them out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8605,1,0,0,'rajaxx SAY_UNK2'), + (0,-1509013,'Do not hesitate! Destroy them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8606,1,0,0,'rajaxx SAY_UNK3'), + (0,-1509014,'Warriors! Captains! Continue the fight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8613,1,0,0,'rajaxx SAY_UNK4'), + (0,-1509015,'You are not worth my time $N!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8614,1,0,0,'rajaxx SAY_DEAGGRO'), + (0,-1509016,'Breath your last!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8604,1,0,0,'rajaxx SAY_KILLS_ANDOROV'), + (0,-1509017,'Soon you will know the price of your meddling, mortals... The master is nearly whole... And when he rises, your world will be cease!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'rajaxx SAY_COMPLETE_QUEST'), + (0,-1509018,'I am rejuvinated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8593,1,0,0,'ossirian SAY_SURPREME1'), + (0,-1509019,'My powers are renewed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8595,1,0,0,'ossirian SAY_SURPREME2'), + (0,-1509020,'My powers return!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8596,1,0,0,'ossirian SAY_SURPREME3'), + (0,-1509021,'Protect the city at all costs!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8597,1,0,0,'ossirian SAY_RAND_INTRO1'), + (0,-1509022,'The walls have been breached!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8599,1,0,0,'ossirian SAY_RAND_INTRO2'), + (0,-1509023,'To your posts. Defend the city.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8600,1,0,0,'ossirian SAY_RAND_INTRO3'), + (0,-1509024,'Tresspassers will be terminated.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8601,1,0,0,'ossirian SAY_RAND_INTRO4'), + (0,-1509025,'Sands of the desert rise and block out the sun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8598,1,0,0,'ossirian SAY_AGGRO'), + (0,-1509026,'You are terminated.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8602,1,0,0,'ossirian SAY_SLAY'), + (0,-1509027,'I...have...failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8594,1,0,0,'ossirian SAY_DEATH'), + +-- -1 531 000 TEMPLE OF AHN'QIRAJ + (15263,-1531000,'Are you so eager to die? I would be happy to accomodate you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8615,1,0,0,'skeram SAY_AGGRO1'), + (15263,-1531001,'Cower mortals! The age of darkness is at hand.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8616,1,0,0,'skeram SAY_AGGRO2'), + (15263,-1531002,'Tremble! The end is upon you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8621,1,0,0,'skeram SAY_AGGRO3'), + (15263,-1531003,'Let your death serve as an example!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8617,1,0,0,'skeram SAY_SLAY1'), + (15263,-1531004,'Spineless wretches! You will drown in rivers of blood!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8619,1,0,0,'skeram SAY_SLAY2'), + (15263,-1531005,'The screams of the dying will fill the air. A symphony of terror is about to begin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8620,1,0,0,'skeram SAY_SLAY3'), + (15263,-1531006,'Prepare for the return of the ancient ones!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8618,1,0,0,'skeram SAY_SPLIT'), + (15263,-1531007,'You only delay... the inevetable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8622,1,0,0,'skeram SAY_DEATH'), + (15516,-1531008,'You will be judged for defiling these sacred grounds! The laws of the Ancients will not be challenged! Trespassers will be annihilated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8646,1,0,0,'sartura SAY_AGGRO'), + (15516,-1531009,'I sentence you to death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8647,1,0,0,'sartura SAY_SLAY'), + (15516,-1531010,'I serve to the last!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8648,1,0,0,'sartura SAY_DEATH'), + (15727,-1531011,'is weakened!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'cthun EMOTE_WEAKENED'), + +-- -1 532 000 KARAZHAN + (16151,-1532000,'Well done Midnight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9173,1,0,0,'attumen SAY_MIDNIGHT_KILL'), + (16151,-1532001,'Cowards! Wretches!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9167,1,0,0,'attumen SAY_APPEAR1'), + (16151,-1532002,'Who dares attack the steed of the Huntsman?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9298,1,0,0,'attumen SAY_APPEAR2'), + (16151,-1532003,'Perhaps you would rather test yourselves against a more formidable opponent?!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9299,1,0,0,'attumen SAY_APPEAR3'), + (16151,-1532004,'Come, Midnight, let''s disperse this petty rabble!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9168,1,0,0,'attumen SAY_MOUNT'), + (15550,-1532005,'It was... inevitable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9169,1,0,0,'attumen SAY_KILL1'), + (15550,-1532006,'Another trophy to add to my collection!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9300,1,0,0,'attumen SAY_KILL2'), + (15550,-1532007,'Weapons are merely a convenience for a warrior of my skill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9166,1,0,0,'attumen SAY_DISARMED'), + (15550,-1532008,'I always knew... someday I would become... the hunted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9165,1,0,0,'attumen SAY_DEATH'), + (15550,-1532009,'Such easy sport.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9170,1,0,0,'attumen SAY_RANDOM1'), + (15550,-1532010,'Amateurs! Do not think you can best me! I kill for a living.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9304,1,0,0,'attumen SAY_RANDOM2'), + (15687,-1532011,'Hmm, unannounced visitors? Preparations must be made.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9211,1,0,0,'moroes SAY_AGGRO'), + (15687,-1532012,'Now, where was I? Oh yes...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9215,1,0,0,'moroes SAY_SPECIAL_1'), + (15687,-1532013,'You rang?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9316,1,0,0,'moroes SAY_SPECIAL_2'), + (15687,-1532014,'One more for dinner this evening.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9214,1,0,0,'moroes SAY_KILL_1'), + (15687,-1532015,'Time... Never enough time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9314,1,0,0,'moroes SAY_KILL_2'), + (15687,-1532016,'I''ve gone and made a mess.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9315,1,0,0,'moroes SAY_KILL_3'), + (15687,-1532017,'How terribly clumsy of me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9213,1,0,0,'moroes SAY_DEATH'), + (16457,-1532018,'Your behavior will not be tolerated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9204,1,0,0,'maiden SAY_AGGRO'), + (16457,-1532019,'Ah ah ah...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9207,1,0,0,'maiden SAY_SLAY1'), + (16457,-1532020,'This is for the best.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9312,1,0,0,'maiden SAY_SLAY2'), + (16457,-1532021,'Impure thoughts lead to profane actions.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9311,1,0,0,'maiden SAY_SLAY3'), + (16457,-1532022,'Cast out your corrupt thoughts.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9313,1,0,0,'maiden SAY_REPENTANCE1'), + (16457,-1532023,'Your impurity must be cleansed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9208,1,0,0,'maiden SAY_REPENTANCE2'), + (16457,-1532024,'Death comes. Will your conscience be clear?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9206,1,0,0,'maiden SAY_DEATH'), + (17535,-1532025,'Oh at last, at last. I can go home.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9190,1,0,0,'dorothee SAY_DOROTHEE_DEATH'), + (17535,-1532026,'Don''t let them hurt us, Tito! Oh, you won''t, will you?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9191,1,0,0,'dorothee SAY_DOROTHEE_SUMMON'), + (17535,-1532027,'Tito, oh Tito, no!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9192,1,0,0,'dorothee SAY_DOROTHEE_TITO_DEATH'), + (17535,-1532028,'Oh dear, we simply must find a way home! The old wizard could be our only hope! Strawman, Roar, Tinhead, will you... wait! Oh golly, look! We have visitors!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9195,1,0,0,'dorothee SAY_DOROTHEE_AGGRO'), + (17546,-1532029,'Wanna fight? Huh? Do ya? C''mon, I''ll fight you with both claws behind my back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9227,1,0,0,'roar SAY_ROAR_AGGRO'), + (17546,-1532030,'You didn''t have to go and do that.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9229,1,0,0,'roar SAY_ROAR_DEATH'), + (17546,-1532031,'I think I''m going to go take fourty winks.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9230,1,0,0,'roar SAY_ROAR_SLAY'), + (17543,-1532032,'Now what should I do with you? I simply can''t make up my mind.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9254,1,0,0,'strawman SAY_STRAWMAN_AGGRO'), + (17543,-1532033,'Don''t let them make a mattress... out of me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9256,1,0,0,'strawman SAY_STRAWMAN_DEATH'), + (17543,-1532034,'I guess I''m not a failure after all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9257,1,0,0,'strawman SAY_STRAWMAN_SLAY'), + (17547,-1532035,'I could really use a heart. Say, can I have yours?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9268,1,0,0,'tinhead SAY_TINHEAD_AGGRO'), + (17547,-1532036,'Back to being an old rustbucket.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9270,1,0,0,'tinhead SAY_TINHEAD_DEATH'), + (17547,-1532037,'Guess I''m not so rusty, after all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9271,1,0,0,'tinhead SAY_TINHEAD_SLAY'), + (17547,-1532038,'begins to rust.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'tinhead EMOTE_RUST'), + (18168,-1532039,'Woe to each and every one of you my pretties! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9179,1,0,0,'crone SAY_CRONE_AGGRO'), + (18168,-1532040,'It will all be over soon! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9307,1,0,0,'crone SAY_CRONE_AGGRO2'), + (18168,-1532041,'How could you? What a cruel, cruel world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9178,1,0,0,'crone SAY_CRONE_DEATH'), + (18168,-1532042,'Fixed you, didn''t I? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9180,1,0,0,'crone SAY_CRONE_SLAY'), + (17521,-1532043,'All the better to own you with!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9276,1,0,0,'wolf SAY_WOLF_AGGRO'), + (17521,-1532044,'Mmmm... delicious.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9277,1,0,0,'wolf SAY_WOLF_SLAY'), + (17521,-1532045,'Run away little girl, run away!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9278,1,0,0,'wolf SAY_WOLF_HOOD'), + (17534,-1532046,'What devil art thou, that dost torment me thus?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9196,1,0,0,'julianne SAY_JULIANNE_AGGRO'), + (17534,-1532047,'Where is my lord? Where is my Romulo?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9199,1,0,0,'julianne SAY_JULIANNE_ENTER'), + (17534,-1532048,'Romulo, I come! Oh... this do I drink to thee!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9198,1,0,0,'julianne SAY_JULIANNE_DEATH01'), + (17534,-1532049,'Where is my Lord? Where is my Romulo? Ohh, happy dagger! This is thy sheath! There rust, and let me die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9310,1,0,0,'julianne SAY_JULIANNE_DEATH02'), + (17534,-1532050,'Come, gentle night; and give me back my Romulo!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9200,1,0,0,'julianne SAY_JULIANNE_RESURRECT'), + (17534,-1532051,'Parting is such sweet sorrow.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9201,1,0,0,'julianne SAY_JULIANNE_SLAY'), + (17533,-1532052,'Wilt thou provoke me? Then have at thee, boy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9233,1,0,0,'romulo SAY_ROMULO_AGGRO'), + (17533,-1532053,'Thou smilest... upon the stroke that... murders me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9235,1,0,0,'romulo SAY_ROMULO_DEATH'), + (17533,-1532054,'This day''s black fate on more days doth depend. This but begins the woe. Others must end.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9236,1,0,0,'romulo SAY_ROMULO_ENTER'), + (17533,-1532055,'Thou detestable maw, thou womb of death; I enforce thy rotten jaws to open!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9237,1,0,0,'romulo SAY_ROMULO_RESURRECT'), + (17533,-1532056,'How well my comfort is revived by this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9238,1,0,0,'romulo SAY_ROMULO_SLAY'), + (15691,-1532057,'The Menagerie is for guests only.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9183,1,0,0,'curator SAY_AGGRO'), + (15691,-1532058,'Gallery rules will be strictly enforced.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9188,1,0,0,'curator SAY_SUMMON1'), + (15691,-1532059,'This curator is equipped for gallery protection.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9309,1,0,0,'curator SAY_SUMMON2'), + (15691,-1532060,'Your request cannot be processed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9186,1,0,0,'curator SAY_EVOCATE'), + (15691,-1532061,'Failure to comply will result in offensive action.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9185,1,0,0,'curator SAY_ENRAGE'), + (15691,-1532062,'Do not touch the displays.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9187,1,0,0,'curator SAY_KILL1'), + (15691,-1532063,'You are not a guest.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9308,1,0,0,'curator SAY_KILL2'), + (15691,-1532064,'This Curator is no longer op... er... ation... al.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9184,1,0,0,'curator SAY_DEATH'), + (15688,-1532065,'Your blood will anoint my circle.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9264,1,0,0,'terestian SAY_SLAY1'), + (15688,-1532066,'The great one will be pleased.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9329,1,0,0,'terestian SAY_SLAY2'), + (15688,-1532067,'My life, is yours. Oh great one.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9262,1,0,0,'terestian SAY_DEATH'), + (15688,-1532068,'Ah, you''re just in time. The rituals are about to begin.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9260,1,0,0,'terestian SAY_AGGRO'), + (15688,-1532069,'Please, accept this humble offering, oh great one.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9263,1,0,0,'terestian SAY_SACRIFICE1'), + (15688,-1532070,'Let the sacrifice serve his testament to my fealty.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9330,1,0,0,'terestian SAY_SACRIFICE2'), + (15688,-1532071,'Come, you dwellers in the dark. Rally to my call!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9265,1,0,0,'terestian SAY_SUMMON1'), + (15688,-1532072,'Gather, my pets. There is plenty for all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9331,1,0,0,'terestian SAY_SUMMON2'), + (16524,-1532073,'Please, no more. My son... he''s gone mad!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9241,1,0,0,'aran SAY_AGGRO1'), + (16524,-1532074,'I''ll not be tortured again!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9323,1,0,0,'aran SAY_AGGRO2'), + (16524,-1532075,'Who are you? What do you want? Stay away from me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9324,1,0,0,'aran SAY_AGGRO3'), + (16524,-1532076,'I''ll show you this beaten dog still has some teeth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9245,1,0,0,'aran SAY_FLAMEWREATH1'), + (16524,-1532077,'Burn you hellish fiends!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9326,1,0,0,'aran SAY_FLAMEWREATH2'), + (16524,-1532078,'I''ll freeze you all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9246,1,0,0,'aran SAY_BLIZZARD1'), + (16524,-1532079,'Back to the cold dark with you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9327,1,0,0,'aran SAY_BLIZZARD2'), + (16524,-1532080,'Yes, yes, my son is quite powerful... but I have powers of my own!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9242,1,0,0,'aran SAY_EXPLOSION1'), + (16524,-1532081,'I am not some simple jester! I am Nielas Aran!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9325,1,0,0,'aran SAY_EXPLOSION2'), + (16524,-1532082,'Surely you would not deny an old man a replenishing drink? No, no I thought not.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9248,1,0,0,'aran SAY_DRINK'), + (16524,-1532083,'I''m not finished yet! No, I have a few more tricks up me sleeve.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9251,1,0,0,'aran SAY_ELEMENTALS'), + (16524,-1532084,'I want this nightmare to be over!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9250,1,0,0,'aran SAY_KILL1'), + (16524,-1532085,'Torment me no more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9328,1,0,0,'aran SAY_KILL2'), + (16524,-1532086,'You''ve wasted enough of my time. Let these games be finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9247,1,0,0,'aran SAY_TIMEOVER'), + (16524,-1532087,'At last... The nightmare is.. over...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9244,1,0,0,'aran SAY_DEATH'), + (16524,-1532088,'Where did you get that?! Did HE send you?!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9249,1,0,0,'aran SAY_ATIESH'), + (15689,-1532089,'cries out in withdrawal, opening gates to the warp.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'netherspite EMOTE_PHASE_PORTAL'), + (15689,-1532090,'goes into a nether-fed rage!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'netherspite EMOTE_PHASE_BANISH'), + (15690,-1532091,'Madness has brought you here to me. I shall be your undoing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9218,1,0,0,'malchezaar SAY_AGGRO'), + (15690,-1532092,'Simple fools! Time is the fire in which you''ll burn!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9220,1,0,0,'malchezaar SAY_AXE_TOSS1'), + (15690,-1532093,'I see the subtlety of conception is beyond primitives such as you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9317,1,0,0,'malchezaar SAY_AXE_TOSS2'), + (15690,-1532094,'Who knows what secrets hide in the dark.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9223,1,0,0,'malchezaar SAY_SPECIAL1'), + (15690,-1532095,'The cerestial forces are mine to manipulate.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9320,1,0,0,'malchezaar SAY_SPECIAL2'), + (15690,-1532096,'How can you hope to withstand against such overwhelming power?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9321,1,0,0,'malchezaar SAY_SPECIAL3'), + (15690,-1532097,'Surely you did not think you could win.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9222,1,0,0,'malchezaar SAY_SLAY1'), + (15690,-1532098,'Your greed, your foolishness has brought you to this end.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9318,1,0,0,'malchezaar SAY_SLAY2'), + (15690,-1532099,'You are, but a plaything, unfit even to amuse.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9319,1,0,0,'malchezaar SAY_SLAY3'), + (15690,-1532100,'All realities, all dimensions are open to me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9224,1,0,0,'malchezaar SAY_SUMMON1'), + (15690,-1532101,'You face not Malchezaar alone, but the legions I command!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9322,1,0,0,'malchezaar SAY_SUMMON2'), + (15690,-1532102,'I refuse to concede defeat. I am a prince of the Eredar! I am...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9221,1,0,0,'malchezaar SAY_DEATH'), + (16812,-1532103,'Welcome Ladies and Gentlemen, to this evening''s presentation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9174,1,0,0,'barnes OZ1'), + (16812,-1532104,'Tonight we plumb the depths of the human soul as we join a lost, lonely girl trying desperately -- with the help of her loyal companions -- to find her way home!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9338,1,0,0,'barnes OZ2'), + (16812,-1532105,'But she is pursued... by a wicked malevolent crone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9339,1,0,0,'barnes OZ3'), + (16812,-1532106,'Will she survive? Will she prevail? Only time will tell. And now ... on with the show!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9340,1,0,0,'barnes OZ4'), + (16812,-1532107,'Good evening, Ladies and Gentlemen! Welcome to this evening''s presentation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9175,1,0,0,'barnes HOOD1'), + (16812,-1532108,'Tonight, things are not what they seem. For tonight, your eyes may not be trusted',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9335,1,0,0,'barnes HOOD2'), + (16812,-1532109,'Take for instance, this quiet, elderly woman, waiting for a visit from her granddaughter. Surely there is nothing to fear from this sweet, grey-haired, old lady.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9336,1,0,0,'barnes HOOD3'), + (16812,-1532110,'But don''t let me pull the wool over your eyes. See for yourself what lies beneath those covers! And now... on with the show!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9337,1,0,0,'barnes HOOD4'), + (16812,-1532111,'Welcome, Ladies and Gentlemen, to this evening''s presentation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9176,1,0,0,'barnes RAJ1'), + (16812,-1532112,'Tonight, we explore a tale of forbidden love!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9341,1,0,0,'barnes RAJ2'), + (16812,-1532113,'But beware, for not all love stories end happily, as you may find out. Sometimes, love pricks like a thorn.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9342,1,0,0,'barnes RAJ3'), + (16812,-1532114,'But don''t take it from me, see for yourself what tragedy lies ahead when the paths of star-crossed lovers meet. And now...on with the show!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9343,1,0,0,'barnes RAJ4'), + +-- -1 533 000 NAXXRAMAS + (15956,-1533000,'Ahh... welcome to my parlor.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8788,1,0,0,'anubrekhan SAY_GREET'), + (15956,-1533001,'Just a little taste...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8785,1,0,0,'anubrekhan SAY_AGGRO1'), + (15956,-1533002,'There is no way out.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8786,1,0,0,'anubrekhan SAY_AGGRO2'), + (15956,-1533003,'Yes, Run! It makes the blood pump faster!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8787,1,0,0,'anubrekhan SAY_AGGRO3'), + (15956,-1533004,'I hear little hearts beating. Yesss... beating faster now. Soon the beating will stop.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8790,1,0,0,'anubrekhan SAY_TAUNT1'), + (15956,-1533005,'Where to go? What to do? So many choices that all end in pain, end in death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8791,1,0,0,'anubrekhan SAY_TAUNT2'), + (15956,-1533006,'Which one shall I eat first? So difficult to choose... the all smell so delicious.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8792,1,0,0,'anubrekhan SAY_TAUNT3'), + (15956,-1533007,'Closer now... tasty morsels. I''ve been too long without food. Without blood to drink.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8793,1,0,0,'anubrekhan SAY_TAUNT4'), + (15956,-1533008,'Shh... it will all be over soon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8789,1,0,0,'anubrekhan SAY_SLAY'), + (15953,-1533009,'Your old lives, your mortal desires, mean nothing. You are acolytes of the master now, and you will serve the cause without question! The greatest glory is to die in the master''s service!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8799,1,0,0,'faerlina SAY_GREET'), + (15953,-1533010,'Slay them in the master''s name!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8794,1,0,0,'faerlina SAY_AGGRO1'), + (15953,-1533011,'You cannot hide from me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8795,1,0,0,'faerlina SAY_AGGRO2'), + (15953,-1533012,'Kneel before me, worm!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8796,1,0,0,'faerlina SAY_AGGRO3'), + (15953,-1533013,'Run while you still can!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8797,1,0,0,'faerlina SAY_AGGRO4'), + (15953,-1533014,'You have failed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8800,1,0,0,'faerlina SAY_SLAY1'), + (15953,-1533015,'Pathetic wretch!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8801,1,0,0,'faerlina SAY_SLAY2'), + (15953,-1533016,'The master... will avenge me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8798,1,0,0,'faerlina SAY_DEATH'), + (16028,-1533017,'Patchwerk want to play!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8909,1,0,0,'patchwerk SAY_AGGRO1'), + (16028,-1533018,'Kel''Thuzad make Patchwerk his Avatar of War!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8910,1,0,0,'patchwerk SAY_AGGRO2'), + (16028,-1533019,'No more play?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8912,1,0,0,'patchwerk SAY_SLAY'), + (16028,-1533020,'What happened to... Patch...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8911,1,0,0,'patchwerk SAY_DEATH'), + (16028,-1533021,'goes into a berserker rage!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'patchwerk EMOTE_BERSERK'), + (16028,-1533022,'%s becomes enraged!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'patchwerk EMOTE_ENRAGE'), + (0,-1533023,'Stalagg crush you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8864,1,0,0,'stalagg SAY_STAL_AGGRO'), + (0,-1533024,'Stalagg kill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8866,1,0,0,'stalagg SAY_STAL_SLAY'), + (0,-1533025,'Master save me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8865,1,0,0,'stalagg SAY_STAL_DEATH'), + (0,-1533026,'Feed you to master!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8802,1,0,0,'feugen SAY_FEUG_AGGRO'), + (0,-1533027,'Feugen make master happy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8804,1,0,0,'feugen SAY_FEUG_SLAY'), + (0,-1533028,'No... more... Feugen...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8803,1,0,0,'feugen SAY_FEUG_DEATH'), + (0,-1533029,'You are too late... I... must... OBEY!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8872,1,0,0,'thaddius SAY_GREET'), + (15928,-1533030,'KILL!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8867,1,0,0,'thaddius SAY_AGGRO1'), + (15928,-1533031,'EAT YOUR BONES!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8868,1,0,0,'thaddius SAY_AGGRO2'), + (15928,-1533032,'BREAK YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8869,1,0,0,'thaddius SAY_AGGRO3'), + (15928,-1533033,'You die now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8877,1,0,0,'thaddius SAY_SLAY'), + (0,-1533034,'Now YOU feel pain!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8871,1,0,0,'thaddius SAY_ELECT'), + (15928,-1533035,'Thank... you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8870,1,0,0,'thaddius SAY_DEATH'), + (0,-1533036,'Pleeease!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8873,1,0,0,'thaddius SAY_SCREAM1'), + (0,-1533037,'Stop, make it stop!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8874,1,0,0,'thaddius SAY_SCREAM2'), + (0,-1533038,'Help me! Save me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8875,1,0,0,'thaddius SAY_SCREAM3'), + (0,-1533039,'Please, nooo!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8876,1,0,0,'thaddius SAY_SCREAM4'), + (16060,-1533040,'Foolishly you have sought your own demise. Brazenly you have disregarded powers beyond your understanding. You have fought hard to invade the realm of the harvester. Now there is only one way out - to walk the lonely path of the damned.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8807,1,0,0,'gothik SAY_SPEECH'), + (16060,-1533041,'Death is the only escape.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8806,1,0,0,'gothik SAY_KILL'), + (16060,-1533042,'I... am... undone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8805,1,0,0,'gothik SAY_DEATH'), + (16060,-1533043,'I have waited long enough! Now, you face the harvester of souls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8808,1,0,0,'gothik SAY_TELEPORT'), + (16063,-1533044,'Defend youself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8892,1,0,0,'blaumeux SAY_BLAU_AGGRO'), + (16063,-1533045,'Come, Zeliek, do not drive them out. Not before we''ve had our fun.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8896,1,0,0,'blaumeux SAY_BLAU_TAUNT1'), + (16063,-1533046,'I do hope they stay alive long enough for me to... introduce myself.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8897,1,0,0,'blaumeux SAY_BLAU_TAUNT2'), + (16063,-1533047,'The first kill goes to me! Anyone care to wager?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8898,1,0,0,'blaumeux SAY_BLAU_TAUNT3'), + (16063,-1533048,'Your life is mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8895,1,0,0,'blaumeux SAY_BLAU_SPECIAL'), + (16063,-1533049,'Who''s next?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8894,1,0,0,'blaumeux SAY_BLAU_SLAY'), + (16063,-1533050,'Tou... che!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8893,1,0,0,'blaumeux SAY_BLAU_DEATH'), + (16063,-1533051,'Come out and fight, ye wee ninny!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8899,1,0,0,'korthazz SAY_KORT_AGGRO'), + (16063,-1533052,'To arms, ye roustabouts! We''ve got company!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8903,1,0,0,'korthazz SAY_KORT_TAUNT1'), + (16063,-1533053,'I heard about enough of yer sniveling. Shut yer fly trap ''afore I shut it for ye!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8904,1,0,0,'korthazz SAY_KORT_TAUNT2'), + (16063,-1533054,'I''m gonna enjoy killin'' these slack-jawed daffodils!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8905,1,0,0,'korthazz SAY_KORT_TAUNT3'), + (16063,-1533055,'I like my meat extra crispy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8902,1,0,0,'korthazz SAY_KORT_SPECIAl'), + (16063,-1533056,'Next time, bring more friends!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8901,1,0,0,'korthazz SAY_KORT_SLAY'), + (16063,-1533057,'What a bloody waste this is!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8900,1,0,0,'korthazz SAY_KORT_DEATH'), + (16063,-1533058,'Flee, before it''s too late!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8913,1,0,0,'zeliek SAY_ZELI_AGGRO'), + (16063,-1533059,'Invaders, cease this foolish venture at once! Turn away while you still can!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8917,1,0,0,'zeliek SAY_ZELI_TAUNT1'), + (16063,-1533060,'Perhaps they will come to their senses, and run away as fast as they can!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8918,1,0,0,'zeliek SAY_ZELI_TAUNT2'), + (16063,-1533061,'Do not continue! Turn back while there''s still time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8919,1,0,0,'zeliek SAY_ZELI_TAUNT3'), + (16063,-1533062,'I- I have no choice but to obey!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8916,1,0,0,'zeliek SAY_ZELI_SPECIAL'), + (16063,-1533063,'Forgive me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8915,1,0,0,'zeliek SAY_ZELI_SLAY'), + (16063,-1533064,'It is... as it should be.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8914,1,0,0,'zeliek SAY_ZELI_DEATH'), + (16063,-1533065,'You seek death?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14571,1,0,0,'rivendare_naxx SAY_RIVE_AGGRO1'), + (16063,-1533066,'None shall pass!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14572,1,0,0,'rivendare_naxx SAY_RIVE_AGGRO2'), + (16063,-1533067,'Be still!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14573,1,0,0,'rivendare_naxx SAY_RIVE_AGGRO3'), + (16063,-1533068,'You will find no peace in death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14574,1,0,0,'rivendare_naxx SAY_RIVE_SLAY1'), + (16063,-1533069,'The master''s will is done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14575,1,0,0,'rivendare_naxx SAY_RIVE_SLAY2'), + (16063,-1533070,'Bow to the might of the scourge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14576,1,0,0,'rivendare_naxx SAY_RIVE_SPECIAL'), + (16063,-1533071,'Enough prattling. Let them come! We shall grind their bones to dust.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14577,1,0,0,'rivendare_naxx SAY_RIVE_TAUNT1'), + (16063,-1533072,'Conserve your anger! Harness your rage! You will all have outlets for your frustration soon enough.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14578,1,0,0,'rivendare_naxx SAY_RIVE_TAUNT2'), + (16063,-1533073,'Life is meaningless. It is in death that we are truly tested.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14579,1,0,0,'rivendare_naxx SAY_RIVE_TAUNT3'), + (16063,-1533074,'Death... will not stop me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14580,1,0,0,'rivendare_naxx SAY_RIVE_DEATH'), + (15954,-1533075,'Glory to the master!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8845,1,0,0,'noth SAY_AGGRO1'), + (15954,-1533076,'Your life is forfeit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8846,1,0,0,'noth SAY_AGGRO2'), + (15954,-1533077,'Die, trespasser!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8847,1,0,0,'noth SAY_AGGRO3'), + (15954,-1533078,'Rise, my soldiers! Rise and fight once more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8851,1,0,0,'noth SAY_SUMMON'), + (15954,-1533079,'My task is done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8849,1,0,0,'noth SAY_SLAY1'), + (15954,-1533080,'Breathe no more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8850,1,0,0,'noth SAY_SLAY2'), + (15954,-1533081,'I will serve the master... in... death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8848,1,0,0,'noth SAY_DEATH'), + (15989,-1533082,'takes in a deep breath...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'sapphiron EMOTE_BREATH'), + (15989,-1533083,'%s enrages!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'sapphiron EMOTE_ENRAGE'), + (0,-1533084,'Our preparations continue as planned, master.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14467,1,0,0,'kelthuzad SAY_SAPP_DIALOG1'), + (0,-1533085,'It is good that you serve me so faithfully. Soon, all will serve the Lich King and in the end, you shall be rewarded...so long as you do not falter.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8881,1,0,0,'kelthuzad SAY_SAPP_DIALOG2_LICH'), + (0,-1533086,'I see no complications... Wait... What is this?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14468,1,0,0,'kelthuzad SAY_SAPP_DIALOG3'), + (0,-1533087,'Your security measures have failed! See to this interruption immediately!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8882,1,0,0,'kelthuzad SAY_SAPP_DIALOG4_LICH'), + (0,-1533088,'Yes, master!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14469,1,0,0,'kelthuzad SAY_SAPP_DIALOG5'), + (0,-1533089,'No!!! A curse upon you, interlopers! The armies of the Lich King will hunt you down. You will not escape your fate...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14484,1,0,0,'kelthuzad SAY_CAT_DIED'), + (0,-1533090,'Who dares violate the sanctity of my domain? Be warned, all who trespass here are doomed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14463,1,0,0,'kelthuzad SAY_TAUNT1'), + (0,-1533091,'Fools, you think yourselves triumphant? You have only taken one step closer to the abyss! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14464,1,0,0,'kelthuzad SAY_TAUNT2'), + (0,-1533092,'I grow tired of these games. Proceed, and I will banish your souls to oblivion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14465,1,0,0,'kelthuzad SAY_TAUNT3'), + (0,-1533093,'You have no idea what horrors lie ahead. You have seen nothing! The frozen heart of Naxxramas awaits you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14466,1,0,0,'kelthuzad SAY_TAUNT4'), + (15990,-1533094,'Pray for mercy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14475,1,0,0,'kelthuzad SAY_AGGRO1'), + (15990,-1533095,'Scream your dying breath!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14476,1,0,0,'kelthuzad SAY_AGGRO2'), + (15990,-1533096,'The end is upon you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14477,1,0,0,'kelthuzad SAY_AGGRO3'), + (15990,-1533097,'The dark void awaits you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14478,1,0,0,'kelthuzad SAY_SLAY1'), + (15990,-1533098,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14479,1,0,0,'kelthuzad SAY_SLAY2'), + (15990,-1533099,'AAAAGHHH!... Do not rejoice... your victory is a hollow one... for I shall return with powers beyond your imagining!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14480,1,0,0,'kelthuzad SAY_DEATH'), + (15990,-1533100,'Your soul, is bound to me now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14472,1,0,0,'kelthuzad SAY_CHAIN1'), + (15990,-1533101,'There will be no escape!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14473,1,0,0,'kelthuzad SAY_CHAIN2'), + (15990,-1533102,'I will freeze the blood in your veins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14474,1,0,0,'kelthuzad SAY_FROST_BLAST'), + (15990,-1533103,'Master! I require aid! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14470,1,0,0,'kelthuzad SAY_REQUEST_AID'), + (15990,-1533104,'Very well... warriors of the frozen wastes, rise up! I command you to fight, kill, and die for your master. Let none survive...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'kelthuzad SAY_ANSWER_REQUEST'), + (0,-1533105,'Minions, servants, soldiers of the cold dark, obey the call of Kel''Thuzad!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14471,1,0,0,'kelthuzad SAY_SUMMON_MINIONS'), + (15990,-1533106,'Your petty magics are no challenge to the might of the Scourge! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14481,1,0,0,'kelthuzad SAY_SPECIAL1_MANA_DET'), + (15990,-1533107,'Enough! I grow tired of these distractions! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14483,1,0,0,'kelthuzad SAY_SPECIAL3_MANA_DET'), + (15990,-1533108,'Fools, you have spread your powers too thin. Be free, my minions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14482,1,0,0,'kelthuzad SAY_SPECIAL2_DISPELL'), + (15936,-1533109,'You are mine now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8825,1,0,0,'heigan SAY_AGGRO1'), + (15936,-1533110,'I see you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8826,1,0,0,'heigan SAY_AGGRO2'), + (15936,-1533111,'You...are next!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8827,1,0,0,'heigan SAY_AGGRO3'), + (15936,-1533112,'Close your eyes... sleep!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8829,1,0,0,'heigan SAY_SLAY'), + (15936,-1533113,'The races of the world will perish. It is only a matter of time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8830,1,0,0,'heigan SAY_TAUNT1'), + (15936,-1533114,'I see endless suffering, I see torment, I see rage. I see... everything!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8831,1,0,0,'heigan SAY_TAUNT2'), + (15936,-1533115,'Soon... the world will tremble!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8832,1,0,0,'heigan SAY_TAUNT3'), + (15936,-1533116,'The end is upon you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8833,1,0,0,'heigan SAY_TAUNT4'), + (15936,-1533117,'Hungry worms will feast on your rotten flesh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8834,1,0,0,'heigan SAY_TAUNT5'), + (15936,-1533118,'Noo... o...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8828,1,0,0,'heigan SAY_DEATH'), + +-- -1 534 000 THE BATTLE OF MT. HYJAL + (17772,-1534000,'I''m in jeopardy, help me if you can!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11007,1,0,0,'jaina hyjal ATTACKED 1'), + (17772,-1534001,'They''ve broken through!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11049,1,0,0,'jaina hyjal ATTACKED 2'), + (17772,-1534002,'Stay alert! Another wave approaches.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11008,1,0,0,'jaina hyjal INCOMING'), + (17772,-1534003,'Don''t give up! We must prevail!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11006,1,0,0,'jaina hyjal BEGIN'), + (17772,-1534004,'Hold them back as long as possible.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11050,1,0,0,'jaina hyjal RALLY 1'), + (17772,-1534005,'We must hold strong!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11051,1,0,0,'jaina hyjal RALLY 2'), + (17772,-1534006,'We are lost. Fall back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11009,1,0,0,'jaina hyjal FAILURE'), + (17772,-1534007,'We have won valuable time. Now we must pull back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11011,1,0,0,'jaina hyjal SUCCESS'), + (17772,-1534008,'I did... my best.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11010,1,0,0,'jaina hyjal DEATH'), + (17852,-1534009,'I will lie down for no one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11031,1,0,0,'thrall hyjal ATTACKED 1'), + (17852,-1534010,'Bring the fight to me and pay with your lives!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11061,1,0,0,'thrall hyjal ATTACKED 2'), + (17852,-1534011,'Make ready for another wave! LOK-TAR OGAR!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11032,1,0,0,'thrall hyjal INCOMING'), + (17852,-1534012,'Hold them back! Do not falter!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11030,1,0,0,'thrall hyjal BEGIN'), + (17852,-1534013,'Victory or death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11059,1,0,0,'thrall hyjal RALLY 1'), + (17852,-1534014,'Do not give an inch of ground!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11060,1,0,0,'thrall hyjal RALLY 2'), + (17852,-1534015,'It is over. Withdraw! We have failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11033,1,0,0,'thrall hyjal FAILURE'), + (17852,-1534016,'We have played our part and done well. It is up to the others now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11035,1,0,0,'thrall hyjal SUCCESS'), + (17852,-1534017,'Uraaa...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11034,1,0,0,'thrall hyjal DEATH'), + (0,-1534018,'All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10986,1,0,0,'archimonde SAY_PRE_EVENTS_COMPLETE'), + (17968,-1534019,'Your resistance is insignificant.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10987,1,0,0,'archimonde SAY_AGGRO'), + (17968,-1534020,'This world will burn!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10990,1,0,0,'archimonde SAY_DOOMFIRE1'), + (17968,-1534021,'Manach sheek-thrish!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11041,1,0,0,'archimonde SAY_DOOMFIRE2'), + (17968,-1534022,'A-kreesh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10989,1,0,0,'archimonde SAY_AIR_BURST1'), + (17968,-1534023,'Away vermin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11043,1,0,0,'archimonde SAY_AIR_BURST2'), + (17968,-1534024,'All creation will be devoured!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11044,1,0,0,'archimonde SAY_SLAY1'), + (17968,-1534025,'Your soul will languish for eternity.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10991,1,0,0,'archimonde SAY_SLAY2'), + (17968,-1534026,'I am the coming of the end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11045,1,0,0,'archimonde SAY_SLAY3'), + (17968,-1534027,'At last it is here. Mourn and lament the passing of all you have ever known and all that would have been! Akmin-kurai!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10993,1,0,0,'archimonde SAY_ENRAGE'), + (17968,-1534028,'No, it cannot be! Nooo!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10992,1,0,0,'archimonde SAY_DEATH'), + (17968,-1534029,'You are mine now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10988,1,0,0,'archimonde SAY_SOUL_CHARGE1'), + (17968,-1534030,'Bow to my will.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11042,1,0,0,'archimonde SAY_SOUL_CHARGE2'), + +-- -1 540 000 SHATTERED HALLS + (16807,-1540000,'You wish to fight us all at once? This should be amusing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10262,1,0,0,'nethekurse SAY_INTRO'), + (16807,-1540001,'You can have that one. I no longer need him.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10263,1,0,0,'nethekurse PEON_ATTACK_1'), + (16807,-1540002,'Yes, beat him mercilessly. His skull is a thick as an ogres.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10264,1,0,0,'nethekurse PEON_ATTACK_2'), + (16807,-1540003,'Don''t waste your time on that one. He''s weak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10265,1,0,0,'nethekurse PEON_ATTACK_3'), + (16807,-1540004,'You want him? Very well, take him!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10266,1,0,0,'nethekurse PEON_ATTACK_4'), + (16807,-1540005,'One pitiful wretch down. Go on, take another one.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10267,1,0,0,'nethekurse PEON_DIE_1'), + (16807,-1540006,'Ahh, what a waste... Next!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10268,1,0,0,'nethekurse PEON_DIE_2'), + (16807,-1540007,'I was going to kill him anyway!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10269,1,0,0,'nethekurse PEON_DIE_3'), + (16807,-1540008,'Thank you for saving me the trouble! Now it''s my turn to have some fun...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10270,1,0,0,'nethekurse PEON_DIE_4'), + (16807,-1540009,'Beg for your pittyfull life!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10259,1,0,0,'nethekurse SAY_TAUNT_1'), + (16807,-1540010,'Run covad, ruun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10260,1,0,0,'nethekurse SAY_TAUNT_2'), + (16807,-1540011,'Your pain amuses me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10261,1,0,0,'nethekurse SAY_TAUNT_3'), + (16807,-1540012,'I''m already bored.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10271,1,0,0,'nethekurse SAY_AGGRO_1'), + (16807,-1540013,'Come on! ... Show me a real fight.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10272,1,0,0,'nethekurse SAY_AGGRO_2'), + (16807,-1540014,'I had more fun torturing the peons.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10273,1,0,0,'nethekurse SAY_AGGRO_3'), + (16807,-1540015,'You Loose.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10274,1,0,0,'nethekurse SAY_SLAY_1'), + (16807,-1540016,'Ohh! Just die.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10275,1,0,0,'nethekurse SAY_SLAY_2'), + (16807,-1540017,'What a ... a shame.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10276,1,0,0,'nethekurse SAY_DIE'), + (16809,-1540018,'Smash!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10306,1,0,0,'omrogg GoCombat_1'), + (16809,-1540019,'If you nice me let you live.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10308,1,0,0,'omrogg GoCombat_2'), + (16809,-1540020,'Me hungry!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10309,1,0,0,'omrogg GoCombat_3'), + (16809,-1540021,'Why don''t you let me do the talking?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10317,1,0,0,'omrogg GoCombatDelay_1'), + (16809,-1540022,'No, we will NOT let you live!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10318,1,0,0,'omrogg GoCombatDelay_2'), + (16809,-1540023,'You always hungry. That why we so fat!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10319,1,0,0,'omrogg GoCombatDelay_3'), + (16809,-1540024,'You stay here. Me go kill someone else!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10303,1,0,0,'omrogg Threat_1'), + (16809,-1540025,'What are you doing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10315,1,0,0,'omrogg Threat_2'), + (16809,-1540026,'Me kill someone else...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10302,1,0,0,'omrogg Threat_3'), + (16809,-1540027,'Me not like this one...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10300,1,0,0,'omrogg Threat_4'), + (16809,-1540028,'That''s not funny!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10314,1,0,0,'omrogg ThreatDelay1_1'), + (16809,-1540029,'Me get bored...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10305,1,0,0,'omrogg ThreatDelay1_2'), + (16809,-1540030,'I''m not done yet, idiot!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10313,1,0,0,'omrogg ThreatDelay1_3'), + (16809,-1540031,'Hey you numbskull!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10312,1,0,0,'omrogg ThreatDelay1_4'), + (16809,-1540032,'Ha ha ha.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10304,1,0,0,'omrogg ThreatDelay2_1'), + (16809,-1540033,'Whhy! He almost dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10316,1,0,0,'omrogg ThreatDelay2_2'), + (16809,-1540034,'H''ey...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10307,1,0,0,'omrogg ThreatDelay2_3'), + (16809,-1540035,'We kill his friend!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10301,1,0,0,'omrogg ThreatDelay2_4'), + (16809,-1540036,'This one die easy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10310,1,0,0,'omrogg Killing_1'), + (16809,-1540037,'I''m tired. You kill next one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10320,1,0,0,'omrogg Killing_2'), + (16809,-1540038,'That''s because I do all the hard work!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10321,1,0,0,'omrogg KillingDelay_1'), + (16809,-1540039,'This all...your fault!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10311,1,0,0,'omrogg YELL_DIE_L'), + (16809,-1540040,'I...hate...you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10322,1,0,0,'omrogg YELL_DIE_R'), + (16809,-1540041,'%s enrages',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'omrogg EMOTE_ENRAGE'), + (16808,-1540042,'Ours is the true Horde! The only Horde!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10323,1,0,0,'kargath SAY_AGGRO1'), + (16808,-1540043,'I''ll carve the meat from your bones!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10324,1,0,0,'kargath SAY_AGGRO2'), + (16808,-1540044,'I am called Bladefist for a reason, as you will see!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10325,1,0,0,'kargath SAY_AGGRO3'), + (16808,-1540045,'For the real Horde!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10326,1,0,0,'kargath SAY_SLAY1'), + (16808,-1540046,'I am the only Warchief!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10327,1,0,0,'kargath SAY_SLAY2'), + (16808,-1540047,'The true Horde... will.. prevail...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10328,1,0,0,'kargath SAY_DEATH'), + +-- -1 542 000 BLOOD FURNACE + (17377,-1542000,'Who dares interrupt... What is this? What have you done? You ruin everything!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10164,1,0,0,'kelidan SAY_WAKE'), + (17377,-1542001,'You mustn''t let him loose!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10166,1,0,0,'kelidan SAY_ADD_AGGRO_1'), + (17377,-1542002,'Ignorant whelps!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10167,1,0,0,'kelidan SAY_ADD_AGGRO_2'), + (17377,-1542003,'You fools! He''ll kill us all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10168,1,0,0,'kelidan SAY_ADD_AGGRO_3'), + (17377,-1542004,'Just as you deserve!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10169,1,0,0,'kelidan SAY_KILL_1'), + (17377,-1542005,'Your friends will soon be joining you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10170,1,0,0,'kelidan SAY_KILL_2'), + (17377,-1542006,'Closer... Come closer.. and burn!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10165,1,0,0,'kelidan SAY_NOVA'), + (17377,-1542007,'Good luck... you''ll need it..',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10171,1,0,0,'kelidan SAY_DIE'), + (17380,-1542008,'Come intruders....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'broggok SAY_AGGRO'), + (17381,-1542009,'My work must not be interrupted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10286,1,0,0,'the_maker SAY_AGGRO_1'), + (17381,-1542010,'Perhaps I can find a use for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10287,1,0,0,'the_maker SAY_AGGRO_2'), + (17381,-1542011,'Anger... Hate... These are tools I can use.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10288,1,0,0,'the_maker SAY_AGGRO_3'), + (17381,-1542012,'Let''s see what I can make of you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10289,1,0,0,'the_maker SAY_KILL_1'), + (17381,-1542013,'It is pointless to resist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10290,1,0,0,'the_maker SAY_KILL_2'), + (17381,-1542014,'Stay away from... me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10291,1,0,0,'the_maker SAY_DIE'), + +-- -1 543 000 HELLFIRE RAMPARTS + (17306,-1543000,'Do you smell that? Fresh meat has somehow breached our citadel. Be wary of any intruders.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'gargolmar SAY_TAUNT'), + (17306,-1543001,'Heal me! QUICKLY!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10329,1,0,0,'gargolmar SAY_HEAL'), + (17306,-1543002,'Back off, pup!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10330,1,0,0,'gargolmar SAY_SURGE'), + (17306,-1543003,'What have we here...?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10331,1,0,0,'gargolmar SAY_AGGRO_1'), + (17306,-1543004,'Heh... this may hurt a little.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10332,1,0,0,'gargolmar SAY_AGGRO_2'), + (17306,-1543005,'I''m gonna enjoy this.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10333,1,0,0,'gargolmar SAY_AGGRO_3'), + (17306,-1543006,'Say farewell!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10334,1,0,0,'gargolmar SAY_KILL_1'), + (17306,-1543007,'Much too easy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10335,1,0,0,'gargolmar SAY_KILL_2'), + (17306,-1543008,'Hahah.. ..argh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10336,1,0,0,'gargolmar SAY_DIE'), + (17308,-1543009,'You dare stand against me?!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10280,1,0,0,'omor SAY_AGGRO_1'), + (17308,-1543010,'I will not be defeated!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10279,1,0,0,'omor SAY_AGGRO_2'), + (17308,-1543011,'Your insolence will be your death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10281,1,0,0,'omor SAY_AGGRO_3'), + (17308,-1543012,'Achor-she-ki! Feast my pet! Eat your fill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10277,1,0,0,'omor SAY_SUMMON'), + (17308,-1543013,'A-Kreesh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10278,1,0,0,'omor SAY_CURSE'), + (17308,-1543014,'Die, weakling!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10282,1,0,0,'omor SAY_KILL_1'), + (17308,-1543015,'It is... not over.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10284,1,0,0,'omor SAY_DIE'), + (17308,-1543016,'I am victorious!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10283,1,0,0,'omor SAY_WIPE'), + + (17307,-1543017,'You have faced many challenges, pity they were all in vain. Soon your people will kneel to my lord!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10292,1,0,0,'vazruden SAY_INTRO'), + (17537,-1543018,'Is there no one left to test me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10293,1,0,0,'vazruden SAY_WIPE'), + (17537,-1543019,'Your time is running out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10294,1,0,0,'vazruden SAY_AGGRO_1'), + (17537,-1543020,'You are nothing, I answer a higher call!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10295,1,0,0,'vazruden SAY_AGGRO_2'), + (17537,-1543021,'The Dark Lord laughs at you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10296,1,0,0,'vazruden SAY_AGGRO_3'), + (17537,-1543022,'It is over. Finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10297,1,0,0,'vazruden SAY_KILL_1'), + (17537,-1543023,'Your days are done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10298,1,0,0,'vazruden SAY_KILL_2'), + (17537,-1543024,'My lord will be the end you all...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10299,1,0,0,'vazruden SAY_DIE'), + (17537,-1543025,'descends from the sky',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'vazruden EMOTE'), + +-- -1 544 000 MAGTHERIDON'S LAIR + (17257,-1544000,'Wretched, meddling insects. Release me and perhaps I will grant you a merciful death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10247,1,0,0,'magtheridon SAY_TAUNT1'), + (17257,-1544001,'Vermin! Leeches! Take my blood and choke on it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10248,1,0,0,'magtheridon SAY_TAUNT2'), + (17257,-1544002,'Illidan is an arrogant fool. I will crush him and reclaim Outland as my own.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10249,1,0,0,'magtheridon SAY_TAUNT3'), + (17257,-1544003,'Away, you mindless parasites. My blood is my own!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10250,1,0,0,'magtheridon SAY_TAUNT4'), + (17257,-1544004,'How long do you believe your pathetic sorcery can hold me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10251,1,0,0,'magtheridon SAY_TAUNT5'), + (17257,-1544005,'My blood will be the end of you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10252,1,0,0,'magtheridon SAY_TAUNT6'), + (17257,-1544006,'I...am...UNLEASHED!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10253,1,0,0,'magtheridon SAY_FREED'), + (17257,-1544007,'Thank you for releasing me. Now...die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10254,1,0,0,'magtheridon SAY_AGGRO'), + (17257,-1544008,'Not again...NOT AGAIN!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10256,1,0,0,'magtheridon SAY_BANISH'), + (17257,-1544009,'I will not be taken so easily. Let the walls of this prison tremble...and FALL!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10257,1,0,0,'magtheridon SAY_CHAMBER_DESTROY'), + (17257,-1544010,'Did you think me weak? Soft? Who is the weak one now?!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10255,1,0,0,'magtheridon SAY_PLAYER_KILLED'), + (17257,-1544011,'The Legion...will consume you...all...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10258,1,0,0,'magtheridon SAY_DEATH'), + (17257,-1544012,'%s becomes enraged!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'magtheridon EMOTE_BERSERK'), + (17257,-1544013,'begins to cast Blast Nova!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'magtheridon EMOTE_BLASTNOVA'), + (17257,-1544014,'bonds begin to weaken!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'magtheridon EMOTE_BEGIN'), + (0,-1544015,'breaks free!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'magtheridon EMOTE_FREED'), + +-- -1 545 000 THE STEAMVAULT + (17797,-1545000,'Surge forth my pets!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10360,1,0,0,'thespia SAY_SUMMON'), + (17797,-1545001,'The depths will consume you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10361,1,0,0,'thespia SAY_AGGRO_1'), + (17797,-1545002,'Meet your doom, surface dwellers!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10362,1,0,0,'thespia SAY_AGGRO_2'), + (17797,-1545003,'You will drown in blood!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10363,1,0,0,'thespia SAY_AGGRO_3'), + (17797,-1545004,'To the depths of oblivion with you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10364,1,0,0,'thespia SAY_SLAY_1'), + (17797,-1545005,'For my lady and master!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10365,1,0,0,'thespia SAY_SLAY_2'), + (17797,-1545006,'Our matron will be.. the end of.. you..',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10366,1,0,0,'thespia SAY_DEAD'), + (17796,-1545007,'I''m bringin'' the pain!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10367,1,0,0,'mekgineer SAY_MECHANICS'), + (17796,-1545008,'You''re in for a world of hurt!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10368,1,0,0,'mekgineer SAY_AGGRO_1'), + (17796,-1545009,'Eat hot metal, scumbag!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10369,1,0,0,'mekgineer SAY_AGGRO_2'), + (17796,-1545010,'I''ll come over there!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10370,1,0,0,'mekgineer SAY_AGGRO_3'), + (17796,-1545011,'I''m bringin'' the pain!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10371,1,0,0,'mekgineer SAY_AGGRO_4'), + (17796,-1545012,'You just got served, punk!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10372,1,0,0,'mekgineer SOUND_SLAY_1'), + (17796,-1545013,'I own you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10373,1,0,0,'mekgineer SOUND_SLAY_2'), + (17796,-1545014,'Have fun dyin'', cupcake!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10374,1,0,0,'mekgineer SOUND_SLAY_3'), + (17796,-1545015,'Mommy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10375,1,0,0,'mekgineer SAY_DEATH'), + (17798,-1545016,'You deem yourselves worthy simply because you bested my guards? Our work here will not be compromised!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10390,1,0,0,'kalithresh SAY_INTRO'), + (17798,-1545017,'This is not nearly over...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10391,1,0,0,'kalithresh SAY_REGEN'), + (17798,-1545018,'Your head will roll!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10392,1,0,0,'kalithresh SAY_AGGRO1'), + (17798,-1545019,'I despise all of your kind!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10393,1,0,0,'kalithresh SAY_AGGRO2'), + (17798,-1545020,'Ba''ahntha sol''dorei!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10394,1,0,0,'kalithresh SAY_AGGRO3'), + (17798,-1545021,'Scram, surface filth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10395,1,0,0,'kalithresh SAY_SLAY1'), + (17798,-1545022,'Ah ha ha ha ha ha ha!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10396,1,0,0,'kalithresh SAY_SLAY2'), + (17798,-1545023,'For her Excellency... for... Vashj!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10397,1,0,0,'kalithresh SAY_DEATH'), + +-- -1 546 000 THE UNDERBOG + +-- -1 547 000 THE SLAVE PENS + +-- -1 548 000 SERPENTSHRINE CAVERN + (21216,-1548000,'I cannot allow you to interfere!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11289,1,0,0,'hydross SAY_AGGRO'), + (21216,-1548001,'Better, much better.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11290,1,0,0,'hydross SAY_SWITCH_TO_CLEAN'), + (21216,-1548002,'They have forced me to this...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11291,1,0,0,'hydross SAY_CLEAN_SLAY1'), + (21216,-1548003,'I have no choice.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11292,1,0,0,'hydross SAY_CLEAN_SLAY2'), + (21216,-1548004,'I am... released...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11293,1,0,0,'hydross SAY_CLEAN_DEATH'), + (21216,-1548005,'Aaghh, the poison...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11297,1,0,0,'hydross SAY_SWITCH_TO_CORRUPT'), + (21216,-1548006,'I will purge you from this place.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11298,1,0,0,'hydross SAY_CORRUPT_SLAY1'), + (21216,-1548007,'You are no better than they!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11299,1,0,0,'hydross SAY_CORRUPT_SLAY2'), + (21216,-1548008,'You are the disease, not I',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11300,1,0,0,'hydross SAY_CORRUPT_DEATH'), + (21215,-1548009,'Finally, my banishment ends!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11312,1,0,0,'leotheras SAY_AGGRO'), + (21215,-1548010,'Be gone, trifling elf. I am in control now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11304,1,0,0,'leotheras SAY_SWITCH_TO_DEMON'), + (21215,-1548011,'We all have our demons...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11305,1,0,0,'leotheras SAY_INNER_DEMONS'), + (21215,-1548012,'I have no equal.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11306,1,0,0,'leotheras SAY_DEMON_SLAY1'), + (21215,-1548013,'Perish, mortal.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11307,1,0,0,'leotheras SAY_DEMON_SLAY2'), + (21215,-1548014,'Yes, YES! Ahahah!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11308,1,0,0,'leotheras SAY_DEMON_SLAY3'), + (21215,-1548015,'Kill! KILL!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11314,1,0,0,'leotheras SAY_NIGHTELF_SLAY1'), + (21215,-1548016,'That''s right! Yes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11315,1,0,0,'leotheras SAY_NIGHTELF_SLAY2'), + (21215,-1548017,'Who''s the master now?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11316,1,0,0,'leotheras SAY_NIGHTELF_SLAY3'), + (21215,-1548018,'No... no! What have you done? I am the master! Do you hear me? I am... aaggh! Can''t... contain him...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11313,1,0,0,'leotheras SAY_FINAL_FORM'), + (21215,-1548019,'At last I am liberated. It has been too long since I have tasted true freedom!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11309,1,0,0,'leotheras SAY_FREE'), + (21215,-1548020,'You cannot kill me! Fools, I''ll be back! I''ll... aarghh...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11317,1,0,0,'leotheras SAY_DEATH'), + (21214,-1548021,'Guards, attention! We have visitors...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11277,1,0,0,'karathress SAY_AGGRO'), + (21214,-1548022,'Your overconfidence will be your undoing! Guards, lend me your strength!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11278,1,0,0,'karathress SAY_GAIN_BLESSING'), + (21214,-1548023,'Go on, kill them! I''ll be the better for it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11279,1,0,0,'karathress SAY_GAIN_ABILITY1'), + (21214,-1548024,'I am more powerful than ever!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11280,1,0,0,'karathress SAY_GAIN_ABILITY2'), + (21214,-1548025,'More knowledge, more power!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11281,1,0,0,'karathress SAY_GAIN_ABILITY3'), + (21214,-1548026,'Land-dwelling scum!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11282,1,0,0,'karathress SAY_SLAY1'), + (21214,-1548027,'Alana be''lendor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11283,1,0,0,'karathress SAY_SLAY2'), + (21214,-1548028,'I am rid of you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11284,1,0,0,'karathress SAY_SLAY3'), + (21214,-1548029,'Her ... excellency ... awaits!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11285,1,0,0,'karathress SAY_DEATH'), + (21213,-1548030,'Flood of the deep, take you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11321,1,0,0,'morogrim SAY_AGGRO'), + (21213,-1548031,'By the Tides, kill them at once!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11322,1,0,0,'morogrim SAY_SUMMON1'), + (21213,-1548032,'Destroy them my subjects!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11323,1,0,0,'morogrim SAY_SUMMON2'), + (21213,-1548033,'There is nowhere to hide!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11324,1,0,0,'morogrim SAY_SUMMON_BUBL1'), + (21213,-1548034,'Soon it will be finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11325,1,0,0,'morogrim SAY_SUMMON_BUBL2'), + (21213,-1548035,'It is done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11326,1,0,0,'morogrim SAY_SLAY1'), + (21213,-1548036,'Strugging only makes it worse.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11327,1,0,0,'morogrim SAY_SLAY2'), + (21213,-1548037,'Only the strong survive.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11328,1,0,0,'morogrim SAY_SLAY3'), + (21213,-1548038,'Great... currents of... Ageon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11329,1,0,0,'morogrim SAY_DEATH'), + (21213,-1548039,'sends his enemies to their watery graves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'morogrim EMOTE_WATERY_GRAVE'), + (21213,-1548040,'The violent earthquake has alerted nearby murlocs!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'morogrim EMOTE_EARTHQUAKE'), + (21213,-1548041,'summons Watery Globules!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'morogrim EMOTE_WATERY_GLOBULES'), + (21212,-1548042,'Water is life. It has become a rare commodity here in Outland. A commodity that we alone shall control. We are the Highborne, and the time has come at last for us to retake our rightful place in the world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11531,1,0,0,'vashj SAY_INTRO'), + (21212,-1548043,'I''ll split you from stem to stern!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11532,1,0,0,'vashj SAY_AGGRO1'), + (21212,-1548044,'Victory to Lord Illidan!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11533,1,0,0,'vashj SAY_AGGRO2'), + (21212,-1548045,'I spit on you, surface filth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11534,1,0,0,'vashj SAY_AGGRO3'), + (21212,-1548046,'Death to the outsiders!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11535,1,0,0,'vashj SAY_AGGRO4'), + (21212,-1548047,'I did not wish to lower myself by engaging your kind, but you leave me little choice!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11538,1,0,0,'vashj SAY_PHASE1'), + (21212,-1548048,'The time is now! Leave none standing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11539,1,0,0,'vashj SAY_PHASE2'), + (21212,-1548049,'You may want to take cover.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11540,1,0,0,'vashj SAY_PHASE3'), + (21212,-1548050,'Straight to the heart!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11536,1,0,0,'vashj SAY_BOWSHOT1'), + (21212,-1548051,'Seek your mark!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11537,1,0,0,'vashj SAY_BOWSHOT2'), + (21212,-1548052,'Your time ends now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11541,1,0,0,'vashj SAY_SLAY1'), + (21212,-1548053,'You have failed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11542,1,0,0,'vashj SAY_SLAY2'), + (21212,-1548054,'Be''lamere an''delay',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11543,1,0,0,'vashj SAY_SLAY3'), + (21212,-1548055,'Lord Illidan, I... I am... sorry.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11544,1,0,0,'vashj SAY_DEATH'), + +-- -1 550 000 THE EYE + (19516,-1550000,'Alert, you are marked for extermination!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11213,1,0,0,'voidreaver SAY_AGGRO'), + (19516,-1550001,'Extermination, successful.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11215,1,0,0,'voidreaver SAY_SLAY1'), + (19516,-1550002,'Imbecile life form, no longer functional.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11216,1,0,0,'voidreaver SAY_SLAY2'), + (19516,-1550003,'Threat neutralized.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11217,1,0,0,'voidreaver SAY_SLAY3'), + (19516,-1550004,'Systems... shutting... down...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11214,1,0,0,'voidreaver SAY_DEATH'), + (19516,-1550005,'Alternative measure commencing...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11218,1,0,0,'voidreaver SAY_POUNDING1'), + (19516,-1550006,'Calculating force parameters...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11219,1,0,0,'voidreaver SAY_POUNDING2'), + (18805,-1550007,'Tal anu''men no Sin''dorei!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11134,1,0,0,'solarian SAY_AGGRO'), + (18805,-1550008,'Ha ha ha! You are hopelessly outmatched!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11139,1,0,0,'solarian SAY_SUMMON1'), + (18805,-1550009,'I will crush your delusions of grandeur!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11140,1,0,0,'solarian SAY_SUMMON2'), + (18805,-1550010,'Your soul belongs to the Abyss!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11136,1,0,0,'solarian SAY_KILL1'), + (18805,-1550011,'By the blood of the Highborne!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11137,1,0,0,'solarian SAY_KILL2'), + (18805,-1550012,'For the Sunwell!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11138,1,0,0,'solarian SAY_KILL3'), + (18805,-1550013,'The warmth of the sun... awaits.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11135,1,0,0,'solarian SAY_DEATH'), + (18805,-1550014,'Enough of this! Now I call upon the fury of the cosmos itself.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'solarian SAY_VOIDA'), + (18805,-1550015,'I become ONE... with the VOID!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'solarian SAY_VOIDB'), + (19622,-1550016,'Energy. Power. My people are addicted to it... a dependence made manifest after the Sunwell was destroyed. Welcome... to the future. A pity you are too late to stop it. No one can stop me now! Selama ashal''anore!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11256,1,0,0,'kaelthas SAY_INTRO'), + (19622,-1550017,'Capernian will see to it that your stay here is a short one.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11257,1,0,0,'kaelthas SAY_INTRO_CAPERNIAN'), + (19622,-1550018,'Well done, you have proven worthy to test your skills against my master engineer, Telonicus.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11258,1,0,0,'kaelthas SAY_INTRO_TELONICUS'), + (19622,-1550019,'Let us see how your nerves hold up against the Darkener, Thaladred.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11259,1,0,0,'kaelthas SAY_INTRO_THALADRED'), + (19622,-1550020,'You have persevered against some of my best advisors... but none can withstand the might of the Blood Hammer. Behold, Lord Sanguinar!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11260,1,0,0,'kaelthas SAY_INTRO_SANGUINAR'), + (19622,-1550021,'As you see, I have many weapons in my arsenal...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11261,1,0,0,'kaelthas SAY_PHASE2_WEAPON'), + (19622,-1550022,'Perhaps I underestimated you. It would be unfair to make you fight all four advisors at once, but... fair treatment was never shown to my people. I''m just returning the favor.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11262,1,0,0,'kaelthas SAY_PHASE3_ADVANCE'), + (19622,-1550023,'Alas, sometimes one must take matters into one''s own hands. Balamore shanal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11263,1,0,0,'kaelthas SAY_PHASE4_INTRO2'), + (19622,-1550024,'I have not come this far to be stopped! The future I have planned will not be jeopardized! Now you will taste true power!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11273,1,0,0,'kaelthas SAY_PHASE5_NUTS'), + (19622,-1550025,'You will not prevail.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11270,1,0,0,'kaelthas SAY_SLAY1'), + (19622,-1550026,'You gambled...and lost.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11271,1,0,0,'kaelthas SAY_SLAY2'), + (19622,-1550027,'This was Child''s play.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11272,1,0,0,'kaelthas SAY_SLAY3'), + (19622,-1550028,'Obey me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11268,1,0,0,'kaelthas SAY_MINDCONTROL1'), + (19622,-1550029,'Bow to my will.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11269,1,0,0,'kaelthas SAY_MINDCONTROL2'), + (19622,-1550030,'Let us see how you fare when your world is turned upside down.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11264,1,0,0,'kaelthas SAY_GRAVITYLAPSE1'), + (19622,-1550031,'Having trouble staying grounded?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11265,1,0,0,'kaelthas SAY_GRAVITYLAPSE2'), + (19622,-1550032,'Anara''nel belore!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11267,1,0,0,'kaelthas SAY_SUMMON_PHOENIX1'), + (19622,-1550033,'By the power of the sun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11266,1,0,0,'kaelthas SAY_SUMMON_PHOENIX2'), + (19622,-1550034,'For...Quel...thalas!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11274,1,0,0,'kaelthas SAY_DEATH'), + (20064,-1550035,'Prepare yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11203,1,0,0,'thaladred SAY_THALADRED_AGGRO'), + (20064,-1550036,'Forgive me, my prince! I have... failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11204,1,0,0,'thaladred SAY_THALADRED_DEATH'), + (20064,-1550037,'sets his gaze on $N!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'thaladred EMOTE_THALADRED_GAZE'), + (20060,-1550038,'Blood for blood!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11152,1,0,0,'sanguinar SAY_SANGUINAR_AGGRO'), + (20060,-1550039,'NO! I ...will... not...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11153,1,0,0,'sanguinar SAY_SANGUINAR_DEATH'), + (20062,-1550040,'The sin''dore reign supreme!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11117,1,0,0,'capernian SAY_CAPERNIAN_AGGRO'), + (20062,-1550041,'This is not over!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11118,1,0,0,'capernian SAY_CAPERNIAN_DEATH'), + (20063,-1550042,'Anar''alah belore!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11157,1,0,0,'telonicus SAY_TELONICUS_AGGRO'), + (20063,-1550043,'More perils... await',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11158,1,0,0,'telonicus SAY_TELONICUS_DEATH'), + +-- -1 552 000 THE ARCATRAZ + (20912,-1552000,'It is a small matter to control the mind of the weak... for I bear allegiance to powers untouched by time, unmoved by fate. No force on this world or beyond harbors the strength to bend our knee... not even the mighty Legion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11122,1,0,0,'skyriss SAY_INTRO'), + (20912,-1552001,'Bear witness to the agent of your demise!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11123,1,0,0,'skyriss SAY_AGGRO'), + (20912,-1552002,'Your fate is written!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11124,1,0,0,'skyriss SAY_KILL_1'), + (20912,-1552003,'The chaos I have sown here is but a taste...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11125,1,0,0,'skyriss SAY_KILL_2'), + (20912,-1552004,'You will do my bidding, weakling.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11127,1,0,0,'skyriss SAY_MIND_1'), + (20912,-1552005,'Your will is no longer your own.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11128,1,0,0,'skyriss SAY_MIND_2'), + (20912,-1552006,'Flee in terror!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11129,1,0,0,'skyriss SAY_FEAR_1'), + (20912,-1552007,'I will show you horrors undreamed of!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11130,1,0,0,'skyriss SAY_FEAR_2'), + (20912,-1552008,'We span the universe, as countless as the stars!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11131,1,0,0,'skyriss SAY_IMAGE'), + (20912,-1552009,'I am merely one of... infinite multitudes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11126,1,0,0,'skyriss SAY_DEATH'), + (20977,-1552010,'Where in Bonzo''s brass buttons am I? And who are-- yaaghh, that''s one mother of a headache!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11171,1,0,0,'millhouse SAY_INTRO_1'), + (20977,-1552011,'"Lowly"? I don''t care who you are friend, no one refers to the mighty Millhouse Manastorm as "Lowly"! I have no idea what goes on here, but I will gladly join your fight against this impudent imbecile! Prepare to defend yourself, cretin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11172,1,0,0,'millhouse SAY_INTRO_2'), + (20977,-1552012,'I just need to get some things ready first. You guys go ahead and get started. I need to summon up some water...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11173,1,0,0,'millhouse SAY_WATER'), + (20977,-1552013,'Fantastic! Next, some protective spells. Yes! Now we''re cookin''',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11174,1,0,0,'millhouse SAY_BUFFS'), + (20977,-1552014,'And of course i''ll need some mana. You guys are gonna love this, just wait.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11175,1,0,0,'millhouse SAY_DRINK'), + (20977,-1552015,'Aaalllriiiight!! Who ordered up an extra large can of whoop-ass?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11176,1,0,0,'millhouse SAY_READY'), + (20977,-1552016,'I didn''t even break a sweat on that one.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11177,1,0,0,'millhouse SAY_KILL_1'), + (20977,-1552017,'You guys, feel free to jump in anytime.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11178,1,0,0,'millhouse SAY_KILL_2'), + (20977,-1552018,'I''m gonna light you up, sweet cheeks!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11179,1,0,0,'millhouse SAY_PYRO'), + (20977,-1552019,'Ice, ice, baby!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11180,1,0,0,'millhouse SAY_ICEBLOCK'), + (20977,-1552020,'Heal me! Oh, for the love of all that is holy, HEAL me! I''m dying!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11181,1,0,0,'millhouse SAY_LOWHP'), + (20977,-1552021,'You''ll be hearing from my lawyer...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11182,1,0,0,'millhouse SAY_DEATH'), + (20977,-1552022,'Who''s bad? Who''s bad? That''s right: we bad!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11183,1,0,0,'millhouse SAY_COMPLETE'), + (20904,-1552023,'I knew the prince would be angry but, I... I have not been myself. I had to let them out! The great one speaks to me, you see. Wait--outsiders. Kael''thas did not send you! Good... I''ll just tell the prince you released the prisoners!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11222,1,0,0,'mellichar YELL_INTRO1'), + (20904,-1552024,'The naaru kept some of the most dangerous beings in existence here in these cells. Let me introduce you to another...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11223,1,0,0,'mellichar YELL_INTRO2'), + (20904,-1552025,'Yes, yes... another! Your will is mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11224,1,0,0,'mellichar YELL_RELEASE1'), + (20904,-1552026,'Behold another terrifying creature of incomprehensible power!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11225,1,0,0,'mellichar YELL_RELEASE2A'), + (20904,-1552027,'What is this? A lowly gnome? I will do better, O''great one.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11226,1,0,0,'mellichar YELL_RELEASE2B'), + (20904,-1552028,'Anarchy! Bedlam! Oh, you are so wise! Yes, I see it now, of course!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11227,1,0,0,'mellichar YELL_RELEASE3'), + (20904,-1552029,'One final cell remains. Yes, O''great one, right away!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11228,1,0,0,'mellichar YELL_RELEASE4'), + (20904,-1552030,'Welcome, O''great one. I am your humble servant.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11229,1,0,0,'mellichar YELL_WELCOME'), + +-- -1 553 000 THE BOTANICA + (17975,-1553000,'What are you doing? These specimens are very delicate!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11144,1,0,0,'freywinn SAY_AGGRO'), + (17975,-1553001,'Your life cycle is now concluded!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11145,1,0,0,'freywinn SAY_KILL_1'), + (17975,-1553002,'You will feed the worms.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11146,1,0,0,'freywinn SAY_KILL_2'), + (17975,-1553003,'Endorel aluminor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11147,1,0,0,'freywinn SAY_TREE_1'), + (17975,-1553004,'Nature bends to my will!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11148,1,0,0,'freywinn SAY_TREE_2'), + (17975,-1553005,'The specimens...must be preserved.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11149,1,0,0,'freywinn SAY_DEATH'), + (17980,-1553006,'emits a strange noise.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'laj EMOTE_SUMMON'), + (17977,-1553007,'Who disturbs this sanctuary?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11230,1,0,0,'warp SAY_AGGRO'), + (17977,-1553008,'You must die! But wait: this does not-- No, no... you must die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11231,1,0,0,'warp SAY_SLAY_1'), + (17977,-1553009,'What am I doing? Why do I...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11232,1,0,0,'warp SAY_SLAY_2'), + (17977,-1553010,'Children, come to me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11233,1,0,0,'warp SAY_SUMMON_1'), + (17977,-1553011,'Maybe this is not-- No, we fight! Come to my aid.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11234,1,0,0,'warp SAY_SUMMON_2'), + (17977,-1553012,'So... confused. Do not... belong here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11235,1,0,0,'warp SAY_DEATH'), + +-- -1 554 000 THE MECHANAR + (0,-1554000,'I predict a painful death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11101,1,0,0,'gyro SAY_AGGRO'), + (0,-1554001,'Measure twice; cut once!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11104,1,0,0,'gyro SAY_SAW_ATTACK1'), + (0,-1554002,'If my division is correct, you should be quite dead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11105,1,0,0,'gyro SAY_SAW_ATTACK2'), + (0,-1554003,'Your strategy was flawed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11102,1,0,0,'gyro SAY_SLAY1'), + (0,-1554004,'Yes, the only logical outcome.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11103,1,0,0,'gyro SAY_SLAY2'), + (0,-1554005,'An unforseen... contingency',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11106,1,0,0,'gyro SAY_DEATH'), + (19710,-1554006,'You have approximately five seconds to live.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11109,1,0,0,'ironhand SAY_AGGRO_1'), + (19710,-1554007,'With the precise angle and velocity...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11112,1,0,0,'ironhand SAY_HAMMER_1'), + (19710,-1554008,'Low tech yet quiet effective!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11113,1,0,0,'ironhand SAY_HAMMER_2'), + (19710,-1554009,'A foregone conclusion.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11110,1,0,0,'ironhand SAY_SLAY_1'), + (19710,-1554010,'The processing will continue a schedule!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11111,1,0,0,'ironhand SAY_SLAY_2'), + (19710,-1554011,'My calculations did not...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11114,1,0,0,'ironhand SAY_DEATH_1'), + (19710,-1554012,'raises his hammer menacingly...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'ironhand EMOTE_HAMMER'), + (19221,-1554013,'Don''t value your life very much, do you?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11186,1,0,0,'sepethrea SAY_AGGRO'), + (19221,-1554014,'I am not alone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11191,1,0,0,'sepethrea SAY_SUMMON'), + (19221,-1554015,'Think you can take the heat?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11189,1,0,0,'sepethrea SAY_DRAGONS_BREATH_1'), + (19221,-1554016,'Anar''endal dracon!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11190,1,0,0,'sepethrea SAY_DRAGONS_BREATH_2'), + (19221,-1554017,'And don''t come back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11187,1,0,0,'sepethrea SAY_SLAY1'), + (19221,-1554018,'En''dala finel el''dal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11188,1,0,0,'sepethrea SAY_SLAY2'), + (19221,-1554019,'Anu... bala belore...alon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11192,1,0,0,'sepethrea SAY_DEATH'), + (19220,-1554020,'We are on a strict timetable. You will not interfere!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11193,1,0,0,'pathaleon SAY_AGGRO'), + (19220,-1554021,'I''m looking for a team player...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11197,1,0,0,'pathaleon SAY_DOMINATION_1'), + (19220,-1554022,'You work for me now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11198,1,0,0,'pathaleon SAY_DOMINATION_2'), + (19220,-1554023,'Time to supplement my work force.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11196,1,0,0,'pathaleon SAY_SUMMON'), + (19220,-1554024,'I prefeer to be hands-on...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11199,1,0,0,'pathaleon SAY_ENRAGE'), + (19220,-1554025,'A minor inconvenience.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11194,1,0,0,'pathaleon SAY_SLAY_1'), + (19220,-1554026,'Looks like you lose.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11195,1,0,0,'pathaleon SAY_SLAY_2'), + (19220,-1554027,'The project will... continue.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11200,1,0,0,'pathaleon SAY_DEATH'), + +-- -1 555 000 SHADOW LABYRINTH + (18731,-1555000,'Infidels have invaded the sanctuary! Sniveling pests...You have yet to learn the true meaning of agony!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10473,1,0,0,'hellmaw SAY_INTRO'), + (18731,-1555001,'Pathetic mortals! You will pay dearly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10475,1,0,0,'hellmaw SAY_AGGRO1'), + (18731,-1555002,'I will break you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10476,1,0,0,'hellmaw SAY_AGGRO2'), + (18731,-1555003,'Finally! Something to relieve the tedium!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10477,1,0,0,'hellmaw SAY_AGGRO3'), + (18731,-1555004,'Aid me, you fools, before it''s too late!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10474,1,0,0,'hellmaw SAY_HELP'), + (18731,-1555005,'Do you fear death?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10478,1,0,0,'hellmaw SAY_SLAY1'), + (18731,-1555006,'This is the part I enjoy most.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10479,1,0,0,'hellmaw SAY_SLAY2'), + (18731,-1555007,'Do not...grow...overconfident, mortal.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10480,1,0,0,'hellmaw SAY_DEATH'), + (0,-1555008,'All flesh must burn.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10482,1,0,0,'blackhearth SAY_INTRO1'), + (0,-1555009,'All creation must be unmade!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10483,1,0,0,'blackhearth SAY_INTRO2'), + (0,-1555010,'Power will be yours!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10484,1,0,0,'blackhearth SAY_INTRO3'), + (18667,-1555011,'You''ll be sorry!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10486,1,0,0,'blackhearth SAY_AGGRO1'), + (18667,-1555012,'Time for fun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10487,1,0,0,'blackhearth SAY_AGGRO2'), + (18667,-1555013,'I see dead people!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10488,1,0,0,'blackhearth SAY_AGGRO3'), + (18667,-1555014,'No comin'' back for you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10489,1,0,0,'blackhearth SAY_SLAY1'), + (18667,-1555015,'Nice try!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10490,1,0,0,'blackhearth SAY_SLAY2'), + (0,-1555016,'Help us, hurry!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10485,1,0,0,'blackhearth SAY_HELP'), + (18667,-1555017,'This... no... good...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10491,1,0,0,'blackhearth SAY_DEATH'), + (0,-1555018,'Be ready for Dark One''s return.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10492,1,0,0,'blackhearth SAY2_INTRO1'), + (0,-1555019,'So we have place in new universe.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10493,1,0,0,'blackhearth SAY2_INTRO2'), + (0,-1555020,'Dark one promise!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10494,1,0,0,'blackhearth SAY2_INTRO3'), + (0,-1555021,'You''ll be sorry!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10496,1,0,0,'blackhearth SAY2_AGGRO1'), + (0,-1555022,'Time to kill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10497,1,0,0,'blackhearth SAY2_AGGRO2'), + (0,-1555023,'You be dead people!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10498,1,0,0,'blackhearth SAY2_AGGRO3'), + (0,-1555024,'Now you gone for good.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10499,1,0,0,'blackhearth SAY2_SLAY1'), + (0,-1555025,'You failed, haha haha',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10500,1,0,0,'blackhearth SAY2_SLAY2'), + (0,-1555026,'Help us, hurry!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10495,1,0,0,'blackhearth SAY2_HELP'), + (0,-1555027,'Arrgh, aah...ahhh',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10501,1,0,0,'blackhearth SAY2_DEATH'), + (18732,-1555028,'Keep your minds focused for the days of reckoning are close at hand. Soon, the destroyer of worlds will return to make good on his promise. Soon the destruction of all that is will begin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10522,1,0,0,'vorpil SAY_INTRO'), + (18732,-1555029,'I''ll make an offering of your blood!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10524,1,0,0,'vorpil SAY_AGGRO1'), + (18732,-1555030,'You''ll be a fine example, for the others.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10525,1,0,0,'vorpil SAY_AGGRO2'), + (18732,-1555031,'Good, a worthy sacrifice.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10526,1,0,0,'vorpil SAY_AGGRO3'), + (18732,-1555032,'Come to my aid, heed your master now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10523,1,0,0,'vorpil SAY_HELP'), + (18732,-1555033,'I serve with pride.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10527,1,0,0,'vorpil SAY_SLAY1'), + (18732,-1555034,'Your death is for the greater cause!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10528,1,0,0,'vorpil SAY_SLAY2'), + (18732,-1555035,'I give my life... Gladly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10529,1,0,0,'vorpil SAY_DEATH'), + (18708,-1555036,'draws energy from the air.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'murmur EMOTE_SONIC_BOOM'), + +-- -1 556 000 SETHEKK HALLS + (18472,-1556000,'I have pets....of my own!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10502,1,0,0,'syth SAY_SUMMON'), + (18472,-1556001,'Hrrmm.. Time to.. hrrm.. make my move.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10503,1,0,0,'syth SAY_AGGRO_1'), + (18472,-1556002,'Nice pets..hrm.. Yes! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10504,1,0,0,'syth SAY_AGGRO_2'), + (18472,-1556003,'Nice pets have.. weapons. Not so....nice.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10505,1,0,0,'syth SAY_AGGRO_3'), + (18472,-1556004,'Death.. meeting life is.. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10506,1,0,0,'syth SAY_SLAY_1'), + (18472,-1556005,'Uhn.. Be free..',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10507,1,0,0,'syth SAY_SLAY_2'), + (18472,-1556006,'No more life..hrm. No more pain. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10508,1,0,0,'syth SAY_DEATH'), + (18473,-1556007,'..Trinkets yes pretty Trinkets....power, great power. ..power in Trinkets..',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10557,1,0,0,'ikiss SAY_INTRO'), + (18473,-1556008,'You make war on Ikiss?..',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10554,1,0,0,'ikiss SAY_AGGRO_1'), + (18473,-1556009,'Ikiss cut you pretty....slice you. Yes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10555,1,0,0,'ikiss SAY_AGGRO_2'), + (18473,-1556010,'No escape for....for you',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10556,1,0,0,'ikiss SAY_AGGRO_3'), + (18473,-1556011,'You die....stay away from Trinkets',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10558,1,0,0,'ikiss SAY_SLAY_1'), + (18473,-1556012,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10559,1,0,0,'ikiss SAY_SLAY_2'), + (18473,-1556013,'Ikiss will not....die',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10560,1,0,0,'ikiss SAY_DEATH'), + (18473,-1556015,'begins to channel arcane energy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'ikiss EMOTE_ARCANE_EXP'), + +-- -1 557 000 MANA TOMBS + (18344,-1557000,'What is this? You must forgive me, but I was not expecting company. As you can see, we are somewhat preoccupied right now. But no matter. As I am a gracious host, I will tend to you... personally.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10539,1,0,0,'shaffar SAY_INTRO'), + (18344,-1557001,'We have not yet been properly introduced.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10541,1,0,0,'shaffar SAY_AGGRO_1'), + (18344,-1557002,'An epic battle. How exciting!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10542,1,0,0,'shaffar SAY_AGGRO_2'), + (18344,-1557003,'I have longed for a good adventure.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10543,1,0,0,'shaffar SAY_AGGRO_3'), + (18344,-1557004,'It has been... entertaining.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10544,1,0,0,'shaffar SAY_SLAY_1'), + (18344,-1557005,'And now we part company.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10545,1,0,0,'shaffar SAY_SLAY_2'), + (18344,-1557006,'I have such fascinating things to show you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10540,1,0,0,'shaffar SAY_SUMMON'), + (18344,-1557007,'I must bid you... farewell.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10546,1,0,0,'shaffar SAY_DEAD'), + (18341,-1557008,'I will feed on your soul.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10561,1,0,0,'pandemonius SAY_AGGRO_1'), + (18341,-1557009,'So... full of life!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10562,1,0,0,'pandemonius SAY_AGGRO_2'), + (18341,-1557010,'Do not... resist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10563,1,0,0,'pandemonius SAY_AGGRO_3'), + (18341,-1557011,'Yes! I am... empowered!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10564,1,0,0,'pandemonius SAY_KILL_1'), + (18341,-1557012,'More... I must have more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10565,1,0,0,'pandemonius SAY_KILL_2'), + (18341,-1557013,'To the void... once... more..',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10566,1,0,0,'pandemonius SAY_DEATH'), + (18341,-1557014,'shifts into the void...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'pandemonius EMOTE_DARK_SHELL'), + +-- -1 558 000 AUCHENAI CRYPTS + (18373,-1558000,'You have defiled the resting place of our ancestors. For this offense, there can be but one punishment. It is fitting that you have come to a place of the dead... for you will soon be joining them.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10509,1,0,0,'maladaar SAY_INTRO'), + (18373,-1558001,'Rise my fallen brothers. Take form and fight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10512,1,0,0,'maladaar SAY_SUMMON'), + (18373,-1558002,'You will pay with your life!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10513,1,0,0,'maladaar SAY_AGGRO_1'), + (18373,-1558003,'There''s no turning back now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10514,1,0,0,'maladaar SAY_AGGRO_2'), + (18373,-1558004,'Serve your penitence!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10515,1,0,0,'maladaar SAY_AGGRO_3'), + (18373,-1558005,'Let your mind be clouded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10510,1,0,0,'maladaar SAY_ROAR'), + (18373,-1558006,'Stare into the darkness of your soul.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10511,1,0,0,'maladaar SAY_SOUL_CLEAVE'), + (18373,-1558007,'These walls will be your doom.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10516,1,0,0,'maladaar SAY_SLAY_1'), + (18373,-1558008,' Now, you''ll stay for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10517,1,0,0,'maladaar SAY_SLAY_2'), + (18373,-1558009,'This is... where.. I belong...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10518,1,0,0,'maladaar SAY_DEATH'), + +-- -1 560 000 ESCAPE FROM DURNHOLDE (OLD HILLSBRAD) + (17862,-1560000,'Thrall! You didn''t really think you would escape did you? You and your allies shall answer to Blackmoore - after I''ve had my fun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10406,1,0,0,'skarloc SAY_ENTER'), + (17862,-1560001,'You''re a slave. That''s all you''ll ever be.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10407,1,0,0,'skarloc SAY_TAUNT1'), + (17862,-1560002,'I don''t know what Blackmoore sees in you. For my money, you''re just another ignorant savage!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10408,1,0,0,'skarloc SAY_TAUNT2'), + (17862,-1560003,'Thrall will never be free!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10409,1,0,0,'skarloc SAY_SLAY1'), + (17862,-1560004,'Did you really think you would leave here alive?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10410,1,0,0,'skarloc SAY_SLAY2'), + (17862,-1560005,'Guards! Urgh..Guards..!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10411,1,0,0,'skarloc SAY_DEATH'), + (17848,-1560006,'You there, fetch water quickly! Get these flames out before they spread to the rest of the keep! Hurry, damn you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10428,1,0,0,'lieutenant_drake SAY_ENTER'), + (17848,-1560007,'I know what you''re up to, and I mean to put an end to it, permanently!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10429,1,0,0,'lieutenant_drake SAY_AGGRO'), + (17848,-1560008,'No more middling for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10432,1,0,0,'lieutenant_drake SAY_SLAY1'), + (17848,-1560009,'You will not interfere!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10433,1,0,0,'lieutenant_drake SAY_SLAY2'), + (17848,-1560010,'Time to bleed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10430,1,0,0,'lieutenant_drake SAY_MORTAL'), + (17848,-1560011,'Run, you blasted cowards!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10431,1,0,0,'lieutenant_drake SAY_SHOUT'), + (17848,-1560012,'Thrall... must not... go free.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10434,1,0,0,'lieutenant_drake SAY_DEATH'), + (18096,-1560013,'Thrall! Come outside and face your fate!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10418,1,0,0,'epoch_hunter SAY_ENTER1'), + (18096,-1560014,'Taretha''s life hangs in the balance. Surely you care for her. Surely you wish to save her...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10419,1,0,0,'epoch_hunter SAY_ENTER2'), + (18096,-1560015,'Ah, there you are. I had hoped to accomplish this with a bit of subtlety, but I suppose direct confrontation was inevitable. Your future, Thrall, must not come to pass and so...you and your troublesome friends must die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10420,1,0,0,'epoch_hunter SAY_ENTER3'), + (18096,-1560016,'Enough! I will erase your very existence!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10421,1,0,0,'epoch_hunter SAY_AGGRO1'), + (18096,-1560017,'You cannot fight fate!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10422,1,0,0,'epoch_hunter SAY_AGGRO2'), + (18096,-1560018,'You are...irrelevant.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10425,1,0,0,'epoch_hunter SAY_SLAY1'), + (18096,-1560019,'Thrall will remain a slave. Taretha will die. You have failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10426,1,0,0,'epoch_hunter SAY_SLAY2'), + (18096,-1560020,'Not so fast!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10423,1,0,0,'epoch_hunter SAY_BREATH1'), + (18096,-1560021,'Struggle as much as you like!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10424,1,0,0,'epoch_hunter SAY_BREATH2'), + (18096,-1560022,'No!...The master... will not... be pleased.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10427,1,0,0,'epoch_hunter SAY_DEATH'), + (17876,-1560023,'Very well then. Let''s go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10465,1,0,0,'thrall hillsbrad SAY_TH_START_EVENT_PART1'), + (17876,-1560024,'As long as we''re going with a new plan, I may aswell pick up a weapon and some armor.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'thrall hillsbrad SAY_TH_ARMORY'), + (17876,-1560025,'A rider approaches!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10466,0,0,0,'thrall hillsbrad SAY_TH_SKARLOC_MEET'), + (17876,-1560026,'I''ll never be chained again!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10467,1,0,0,'thrall hillsbrad SAY_TH_SKARLOC_TAUNT'), + (17876,-1560027,'Very well. Tarren Mill lies just west of here. Since time is of the essence...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10468,1,0,0,'thrall hillsbrad SAY_TH_START_EVENT_PART2'), + (17876,-1560028,'Let''s ride!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10469,0,0,1,'thrall hillsbrad SAY_TH_MOUNTS_UP'), + (17876,-1560029,'Taretha must be in the inn. Let''s go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'thrall hillsbrad SAY_TH_CHURCH_END'), + (17876,-1560030,'Taretha! What foul magic is this?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'thrall hillsbrad SAY_TH_MEET_TARETHA'), + (17876,-1560031,'Who or what was that?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10470,1,0,1,'thrall hillsbrad SAY_TH_EPOCH_WONDER'), + (17876,-1560032,'No!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10471,1,0,5,'thrall hillsbrad SAY_TH_EPOCH_KILL_TARETHA'), + (17876,-1560033,'Goodbye, Taretha. I will never forget your kindness.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10472,1,0,0,'thrall hillsbrad SAY_TH_EVENT_COMPLETE'), + (17876,-1560034,'Things are looking grim...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10458,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_LOW_HP1'), + (17876,-1560035,'I will fight to the last!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10459,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_LOW_HP2'), + (17876,-1560036,'Taretha...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10460,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_DIE1'), + (17876,-1560037,'A good day...to die...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10461,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_DIE2'), + (17876,-1560038,'I have earned my freedom!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10448,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO1'), + (17876,-1560039,'This day is long overdue. Out of my way!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10449,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO2'), + (17876,-1560040,'I am a slave no longer!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10450,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO3'), + (17876,-1560041,'Blackmoore has much to answer for!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10451,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO4'), + (17876,-1560042,'You have forced my hand!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10452,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_KILL1'), + (17876,-1560043,'It should not have come to this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10453,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_KILL2'), + (17876,-1560044,'I did not ask for this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10454,1,0,0,'thrall hillsbrad SAY_TH_RANDOM_KILL3'), + (17876,-1560045,'I am truly in your debt, strangers.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10455,1,0,0,'thrall hillsbrad SAY_TH_LEAVE_COMBAT1'), + (17876,-1560046,'Thank you, strangers. You have given me hope.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10456,1,0,0,'thrall hillsbrad SAY_TH_LEAVE_COMBAT2'), + (17876,-1560047,'I will not waste this chance. I will seek out my destiny.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,10457,1,0,0,'thrall hillsbrad SAY_TH_LEAVE_COMBAT3'), + (18887,-1560048,'I''m free! Thank you all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'taretha SAY_TA_FREE'), + (18887,-1560049,'Thrall, you escaped!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'taretha SAY_TA_ESCAPED'), + +-- -1 564 000 BLACK TEMPLE + (22887,-1564000,'You will die in the name of Lady Vashj!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11450,1,0,0,'SAY_AGGRO'), + (22887,-1564001,'Stick around!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11451,1,0,0,'SAY_NEEDLE1'), + (22887,-1564002,'I''ll deal with you later!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11452,1,0,0,'SAY_NEEDLE2'), + (22887,-1564003,'Your success was short lived!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11455,1,0,0,'SAY_SLAY1'), + (22887,-1564004,'Time for you to go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11456,1,0,0,'SAY_SLAY2'), + (22887,-1564005,'Bel''anen dal''lorei!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11453,1,0,0,'SAY_SPECIAL1'), + (22887,-1564006,'Blood will flow!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11454,1,0,0,'SAY_SPECIAL2'), + (22887,-1564007,'Bal''amer ch''itah!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11457,1,0,0,'SAY_ENRAGE1'), + (22887,-1564008,'My patience has ran out! Die, DIE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11458,1,0,0,'SAY_ENRAGE2'), + (22887,-1564009,'Lord Illidan will... crush you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11459,1,0,0,'SAY_DEATH'), + (22898,-1564010,'%s acquires a new target!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'supremus EMOTE_NEW_TARGET'), + (22898,-1564011,'%s punches the ground in anger!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'supremus EMOTE_PUNCH_GROUND'), + (22898,-1564012,'The ground begins to crack open!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'supremus EMOTE_GROUND_CRACK'), + (22990,-1564013,'No! Not yet...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11385,1,0,0,'akama shade SAY_LOW_HEALTH'), + (22990,-1564014,'I will not last much longer...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11386,1,0,0,'akama shade SAY_DEATH'), + (22990,-1564015,'Come out from the shadows! I''ve returned to lead you against our true enemy! Shed your chains and raise your weapons against your Illidari masters!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'akama shade SAY_FREE'), + (22990,-1564016,'Hail our leader! Hail Akama!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'akama shade broken SAY_BROKEN_FREE_01'), + (22990,-1564017,'Hail Akama!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'akama shade broken SAY_BROKEN_FREE_02'), + (22947,-1564018,'You play, you pay.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11501,1,0,0,'shahraz SAY_TAUNT1'), + (22947,-1564019,'I''m not impressed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11502,1,0,0,'shahraz SAY_TAUNT2'), + (22947,-1564020,'Enjoying yourselves?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11503,1,0,0,'shahraz SAY_TAUNT3'), + (22947,-1564021,'So... business or pleasure?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11504,1,0,0,'shahraz SAY_AGGRO'), + (22947,-1564022,'You seem a little tense.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11505,1,0,0,'shahraz SAY_SPELL1'), + (22947,-1564023,'Don''t be shy.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11506,1,0,0,'shahraz SAY_SPELL2'), + (22947,-1564024,'I''m all... yours.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11507,1,0,0,'shahraz SAY_SPELL3'), + (22947,-1564025,'Easy come, easy go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11508,1,0,0,'shahraz SAY_SLAY1'), + (22947,-1564026,'So much for a happy ending.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11509,1,0,0,'shahraz SAY_SLAY2'), + (22947,-1564027,'Stop toying with my emotions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11510,1,0,0,'shahraz SAY_ENRAGE'), + (22947,-1564028,'I wasn''t... finished.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11511,1,0,0,'shahraz SAY_DEATH'), + (22948,-1564029,'Horde will... crush you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11432,1,0,0,'bloodboil SOUND_AGGRO'), + (22948,-1564030,'Time to feast!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11433,1,0,0,'bloodboil SAY_SLAY1'), + (22948,-1564031,'More! I want more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11434,1,0,0,'bloodboil SAY_SLAY2'), + (22948,-1564032,'Drink your blood! Eat your flesh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11435,1,0,0,'bloodboil SAY_SPECIAL1'), + (22948,-1564033,'I hunger!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11436,1,0,0,'bloodboil SAY_SPECIAL2'), + (22948,-1564034,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11437,1,0,0,'bloodboil SAY_ENRAGE1'), + (22948,-1564035,'I''ll rip the meat from your bones!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11438,1,0,0,'bloodboil SAY_ENRAGE2'), + (22948,-1564036,'Aaaahrg...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11439,1,0,0,'bloodboil SAY_DEATH'), + (22871,-1564037,'I was the first, you know. For me, the wheel of death has spun many times. So much time has passed. I have a lot of catching up to do...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11512,1,0,0,'teron SAY_INTRO'), + (22871,-1564038,'Vengeance is mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11513,1,0,0,'teron SAY_AGGRO'), + (22871,-1564039,'I have use for you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11514,1,0,0,'teron SAY_SLAY1'), + (22871,-1564040,'It gets worse...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11515,1,0,0,'teron SAY_SLAY2'), + (22871,-1564041,'What are you afraid of?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11517,1,0,0,'teron SAY_SPELL1'), + (22871,-1564042,'Death... really isn''t so bad.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11516,1,0,0,'teron SAY_SPELL2'), + (22871,-1564043,'Give in!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11518,1,0,0,'teron SAY_SPECIAL1'), + (22871,-1564044,'I have something for you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11519,1,0,0,'teron SAY_SPECIAL2'), + (22871,-1564045,'YOU WILL SHOW THE PROPER RESPECT!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11520,1,0,0,'teron SAY_ENRAGE'), + (22871,-1564046,'The wheel...spins...again....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11521,1,0,0,'teron SAY_DEATH'), + (23418,-1564047,'Pain and suffering are all that await you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11415,1,0,0,'essence SUFF_SAY_FREED'), + (23418,-1564048,'Don''t leave me alone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11416,1,0,0,'essence SUFF_SAY_AGGRO'), + (23418,-1564049,'Look at what you make me do!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11417,1,0,0,'essence SUFF_SAY_SLAY1'), + (23418,-1564050,'I didn''t ask for this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11418,1,0,0,'essence SUFF_SAY_SLAY2'), + (23418,-1564051,'The pain is only beginning!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11419,1,0,0,'essence SUFF_SAY_SLAY3'), + (23418,-1564052,'I don''t want to go back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11420,1,0,0,'essence SUFF_SAY_RECAP'), + (23418,-1564053,'Now what do I do?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11421,1,0,0,'essence SUFF_SAY_AFTER'), + (23418,-1564054,'%s becomes enraged!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'essence SUFF_EMOTE_ENRAGE'), + (23419,-1564055,'You can have anything you desire... for a price.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11408,1,0,0,'essence DESI_SAY_FREED'), + (23419,-1564056,'Fulfilment is at hand!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11409,1,0,0,'essence DESI_SAY_SLAY1'), + (23419,-1564057,'Yes... you''ll stay with us now...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11410,1,0,0,'essence DESI_SAY_SLAY2'), + (23419,-1564058,'Your reach exceeds your grasp.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11412,1,0,0,'essence DESI_SAY_SLAY3'), + (23419,-1564059,'Be careful what you wish for...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11411,1,0,0,'essence DESI_SAY_SPEC'), + (23419,-1564060,'I''ll be waiting...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11413,1,0,0,'essence DESI_SAY_RECAP'), + (23419,-1564061,'I won''t be far...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11414,1,0,0,'essence DESI_SAY_AFTER'), + (23420,-1564062,'Beware: I live!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11399,1,0,0,'essence ANGER_SAY_FREED'), + (23420,-1564063,'So... foolish.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11400,1,0,0,'essence ANGER_SAY_FREED2'), + (23420,-1564064,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11401,1,0,0,'essence ANGER_SAY_SLAY1'), + (23420,-1564065,'Enough. No more.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11402,1,0,0,'essence ANGER_SAY_SLAY2'), + (23420,-1564066,'On your knees!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11403,1,0,0,'essence ANGER_SAY_SPEC'), + (23420,-1564067,'Beware, coward.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11405,1,0,0,'essence ANGER_SAY_BEFORE'), + (23420,-1564068,'I won''t... be... ignored.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11404,1,0,0,'essence ANGER_SAY_DEATH'), + (0,-1564069,'You wish to test me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11524,1,0,0,'council vera AGGRO'), + (0,-1564070,'I have better things to do...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11422,1,0,0,'council gath AGGRO'), + (0,-1564071,'Flee or die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11482,1,0,0,'council mala AGGRO'), + (0,-1564072,'Common... such a crude language. Bandal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11440,1,0,0,'council zere AGGRO'), + (0,-1564073,'Enough games!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11428,1,0,0,'council gath ENRAGE'), + (0,-1564074,'You wish to kill me? Hahaha, you first!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11530,1,0,0,'council vera ENRAGE'), + (0,-1564075,'For Quel''Thalas! For the Sunwell!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11488,1,0,0,'council mala ENRAGE'), + (0,-1564076,'Sha''amoor sine menoor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11446,1,0,0,'council zere ENRAGE'), + (22949,-1564077,'Enjoy your final moments!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11426,1,0,0,'council gath SPECIAL1'), + (22952,-1564078,'You''re not caught up for this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11528,1,0,0,'council vera SPECIAL1'), + (22951,-1564079,'No second chances!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11486,1,0,0,'council mala SPECIAL1'), + (22950,-1564080,'Diel fin''al',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11444,1,0,0,'council zere SPECIAL1'), + (22949,-1564081,'You are mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11427,1,0,0,'council gath SPECIAL2'), + (22952,-1564082,'Anar''alah belore!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11529,1,0,0,'council vera SPECIAL2'), + (22951,-1564083,'I''m full of surprises!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11487,1,0,0,'council mala SPECIAL2'), + (22950,-1564084,'Sha''amoor ara mashal?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11445,1,0,0,'council zere SPECIAL2'), + (22949,-1564085,'Selama am''oronor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11423,1,0,0,'council gath SLAY'), + (22952,-1564086,'Valiant effort!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11525,1,0,0,'council vera SLAY'), + (22951,-1564087,'My work is done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11483,1,0,0,'council mala SLAY'), + (22950,-1564088,'Shorel''aran.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11441,1,0,0,'council zere SLAY'), + (22949,-1564089,'Well done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11424,1,0,0,'council gath SLAY_COMT'), + (22951,-1564090,'A glorious kill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11526,1,0,0,'council vera SLAY_COMT'), + (22950,-1564091,'As it should be!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11484,1,0,0,'council mala SLAY_COMT'), + (0,-1564092,'Belesa menoor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11442,1,0,0,'council zere SLAY_COMT'), + (22949,-1564093,'Lord Illidan... I...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11425,1,0,0,'council gath DEATH'), + (22952,-1564094,'You got lucky!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11527,1,0,0,'council vera DEATH'), + (22951,-1564095,'Destiny... awaits.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11485,1,0,0,'council mala DEATH'), + (22950,-1564096,'Diel ma''ahn... oreindel''o',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11443,1,0,0,'council zere DEATH'), + +-- -1 565 000 GRUUL'S LAIR + (18831,-1565000,'Gronn are the real power in outland.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11367,1,0,0,'maulgar SAY_AGGRO'), + (18831,-1565001,'You will not defeat the hand of Gruul!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11368,1,0,0,'maulgar SAY_ENRAGE'), + (18831,-1565002,'You won''t kill next one so easy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11369,1,0,0,'maulgar SAY_OGRE_DEATH1'), + (18831,-1565003,'Pah! Does not prove anything!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11370,1,0,0,'maulgar SAY_OGRE_DEATH2'), + (18831,-1565004,'I''m not afraid of you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11371,1,0,0,'maulgar SAY_OGRE_DEATH3'), + (18831,-1565005,'Good, now you fight me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11372,1,0,0,'maulgar SAY_OGRE_DEATH4'), + (18831,-1565006,'You not so tough afterall!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11373,1,0,0,'maulgar SAY_SLAY1'), + (18831,-1565007,'Aha-ha ha ha!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11374,1,0,0,'maulgar SAY_SLAY2'), + (18831,-1565008,'Mulgar is king!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11375,1,0,0,'maulgar SAY_SLAY3'), + (18831,-1565009,'Gruul... will crush you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11376,1,0,0,'maulgar SAY_DEATH'), + (19044,-1565010,'Come... and die.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11355,1,0,0,'gruul SAY_AGGRO'), + (19044,-1565011,'Scurry',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11356,1,0,0,'gruul SAY_SLAM1'), + (19044,-1565012,'No escape',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11357,1,0,0,'gruul SAY_SLAM2'), + (19044,-1565013,'Stay',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11358,1,0,0,'gruul SAY_SHATTER1'), + (19044,-1565014,'Beg... for life',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11359,1,0,0,'gruul SAY_SHATTER2'), + (19044,-1565015,'No more',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11360,1,0,0,'gruul SAY_SLAY1'), + (19044,-1565016,'Unworthy',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11361,1,0,0,'gruul SAY_SLAY2'), + (19044,-1565017,'Die',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11362,1,0,0,'gruul SAY_SLAY3'), + (19044,-1565018,'Aaargh...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11363,1,0,0,'gruul SAY_DEATH'), + (19044,-1565019,'%s grows in size!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'gruul EMOTE_GROW'), + +-- -1 568 000 ZUL'AMAN + (23578,-1568000,'Spirits of da wind be your doom!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12031,1,0,0,'janalai SAY_AGGRO'), + (23578,-1568001,'I burn ya now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12032,1,0,0,'janalai SAY_FIRE_BOMBS'), + (23578,-1568002,'Where ma hatcha? Get to work on dem eggs!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12033,1,0,0,'janalai SAY_SUMMON_HATCHER'), + (23578,-1568003,'I show you strength... in numbers.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12034,1,0,0,'janalai SAY_ALL_EGGS'), + (23578,-1568004,'You done run outta time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12035,1,0,0,'janalai SAY_BERSERK'), + (23578,-1568005,'It all be over now, mon!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12036,1,0,0,'janalai SAY_SLAY_1'), + (23578,-1568006,'Tazaga-choo!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12037,1,0,0,'janalai SAY_SLAY_2'), + (23578,-1568007,'Zul''jin... got a surprise for you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12038,1,0,0,'janalai SAY_DEATH'), + (23578,-1568008,'Come, strangers. The spirit of the dragonhawk hot be hungry for worthy souls.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12039,1,0,0,'janalai SAY_EVENT_STRANGERS'), + (23578,-1568009,'Come, friends. Your bodies gonna feed ma hatchlings, and your souls are going to feed me with power!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12040,1,0,0,'janalai SAY_EVENT_FRIENDS'), + (0,-1568010,'Get da move on, guards! It be killin'' time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12066,1,0,0,'nalorakk SAY_WAVE1_AGGRO'), + (0,-1568011,'Guards, go already! Who you more afraid of, dem... or me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12067,1,0,0,'nalorakk SAY_WAVE2_STAIR1'), + (0,-1568012,'Ride now! Ride out dere and bring me back some heads!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12068,1,0,0,'nalorakk SAY_WAVE3_STAIR2'), + (0,-1568013,'I be losin'' me patience! Go on: make dem wish dey was never born!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12069,1,0,0,'nalorakk SAY_WAVE4_PLATFORM'), + (0,-1568014,'What could be better than servin'' da bear spirit for eternity? Come closer now. Bring your souls to me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12078,1,0,0,'nalorakk SAY_EVENT1_SACRIFICE'), + (0,-1568015,'Don''t be delayin'' your fate. Come to me now. I make your sacrifice quick.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12079,1,0,0,'nalorakk SAY_EVENT2_SACRIFICE'), + (0,-1568016,'You be dead soon enough!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12070,1,0,0,'nalorakk SAY_AGGRO'), + (0,-1568017,'I bring da pain!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12071,1,0,0,'nalorakk SAY_SURGE'), + (0,-1568018,'You call on da beast, you gonna get more dan you bargain for!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12072,1,0,0,'nalorakk SAY_TOBEAR'), + (0,-1568019,'Make way for Nalorakk!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12073,1,0,0,'nalorakk SAY_TOTROLL'), + (0,-1568020,'You had your chance, now it be too late!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12074,1,0,0,'nalorakk SAY_BERSERK'), + (0,-1568021,'Mua-ha-ha! Now whatchoo got to say?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12075,1,0,0,'nalorakk SAY_SLAY1'), + (0,-1568022,'Da Amani gonna rule again!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12076,1,0,0,'nalorakk SAY_SLAY2'), + (0,-1568023,'I... be waitin'' on da udda side....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12077,1,0,0,'nalorakk SAY_DEATH'), + +-- -1 571 000 NORTHREND + (28217,-1571000,'You save me! We thank you. We going to go back to village now. You come too... you can stay with us! Puppy-men kind of mean anyway. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'npc_injured_rainspeaker_oracle SAY_END_IRO'), + (28217,-1571001,'Let me know when you ready to go, okay?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'npc_injured_rainspeaker_oracle SAY_QUEST_ACCEPT_IRO '), + (28217,-1571002,'Home time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'npc_injured_rainspeaker_oracle SAY_START_IRO'), + (30154,-1571003,'I''m not afraid of anything -- bring it on!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'aggro_Agnetta'), + (25301,-1571004,'My liege, the infiltration and control of the Alliance power structure by our cultists is well underway.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26203,-1571005,'Your progress in this region has been impressive, Blood Prince. I am pleased...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26203,-1571006,'The power you''ve bestowed upon me has allowed me great mental influence over human minds. I bear these offerings as proof of my progress.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571007,'Leryssa!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (26170,-1571008,'What have you done to my sister, you motherless elf scum!?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (26203,-1571009,'Now this is a surprise, Thassarian. I hadn''t heard from Mograine or the other death knights for months. You''ve come to rejoin the Scourge, I take it?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571010,'I would sooner slit my own throat. You will pay for what you did to your own men, Arthas... for what you did to me! I swear it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25301,-1571011,'Allow me to take care of the intruders, lord. I will feed their entrails to the maggots.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26203,-1571012,'Do not fail me, San''layn. Return to Icecrown with this fool''s head or do not bother to return.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25301,-1571013,'Yes, my lord!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25250,-1571014,'What... what happened to me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25250,-1571015,'Ugh! My head won''t stop spinning...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25251,-1571016,'Thassarian, you''re alive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (26170,-1571017,'Leryssa... you... you''re all right!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25251,-1571018,'I thought... I thought you were... dead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571019,'I cannot return home with you just yet, Leryssa. I am not quite done with the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25251,-1571020,'Don''t leave me again! You want to fight for your country, but they don''t even want you! They sent you here to die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571021,'You might be right, sister. My obligations to my land and King have been fulfilled. But there is still something that I owe to myself.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571022,'I know that look in your eye... I''m not going to be able to talk you out of this. If you die on me again...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571023,'Do not worry, Leryssa. I will come back to you when I''m done. Nothing in the world will stop me from coming home to the only family that I have left.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571024,'Pathetic fool! A servant of malygos would sooner die than aid an emeny...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571025,'Aargh! Do your worst, $C ! I''ll tell you NOTHING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571026,'Aahhhh! Release me! I am of no use to you. I swear it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571027,'Stop! I beg you, please stop. Please...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571028,'Alright! I am beaten. Your previous archmage is held in a prison, elevated and sealed. Even if you manage to reach her, Salrand herself holds the key. Your mission is folly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571029,'I''ve given you the information, $C ! You''re wasting your time....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571030,'Noooo! This tortue is inhumane! You have what you want... why don''t you just kill me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (30007,-1571031,'This battle must be seen to be believed! Once a mild-mannered tuskarr fisherman, our next fighter turned to the life of a soulless mercenary when his entire family was wiped out by a vicious pack of lion seals and III-tempered penguins! Now he''s just In It for the gold! Ladies and gentlemen, ORINOKO TUSKBREAKER!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13363,1,0,0,''), + (30020,-1571032,'Whisker! Where are you? Assist me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (30007,-1571033,'The champion of the Winterax trolls has challenged you, Treeofdoom! I hope you''re ready!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (30007,-1571034,'Hailling from the distant mountains of Alterac, one of the fiercest competitors this arena has ever seen: KORRAK THE BLOODRAGER!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13363,1,0,0,''), + (30007,-1571035,'The battle is about to begin! Am I reading this card right It... It''s the nefarious magnataur lord, STINKBEARD! Yes, folks, STINKBEARD! Chitchat dosen''t stand a chance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13363,1,0,0,''), + (28090,-1571036, 'We''ll cleanse this place! Arthas beware!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'crusade recruit RECRUIT_SAY1'), + (28090,-1571037, 'Your''re right! We can do this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'crusade recruit RECRUIT_SAY2'), + (28090,-1571038, 'Your''re right! What was I thinking? Bring on the Scourge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'crusade recruit RECRUIT_SAY3'), + (30014,-1571039,'Yggdras emerges!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,''), + (30017,-1571040,'Stinkbeard comin'' for you, little ones!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (30007,-1571041,'Do you fell that folks? The air is cracking with energy! Than can only mean one thing...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + +-- -1 574 000 UTGARDE KEEP + (23953,-1574000,'Your blood is mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13221,1,0,0,'keleseth SAY_AGGRO'), + (23953,-1574001,'Not so fast.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13222,1,0,0,'keleseth SAY_FROST_TOMB'), + (23953,-1574002,'Aranal, lidel! Their fate shall be yours!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13224,1,0,0,'keleseth SAY_SKELETONS'), + (23953,-1574003,'Darkness waits',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13223,1,0,0,'keleseth SAY_KILL'), + (23953,-1574004,'I join... the night.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13225,1,0,0,'keleseth SAY_DEATH'), + (23954,-1574005,'I''ll paint my face with your blood!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13207,1,0,0,'ingvar SAY_AGGRO_FIRST'), + (23954,-1574006,'I return! A second chance to carve out your skull!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13209,1,0,0,'ingvar SAY_AGGRO_SECOND'), + (23954,-1574007,'My life for the... death god!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13213,1,0,0,'ingvar SAY_DEATH_FIRST'), + (23954,-1574008,'No! I can do... better! I can...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13211,1,0,0,'ingvar SAY_DEATH_SECOND'), + (23954,-1574009,'Mjul orm agn gjor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13212,1,0,0,'ingvar SAY_KILL_FIRST'), + (23954,-1574010,'I am a warrior born!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13214,1,0,0,'ingvar SAY_KILL_SECOND'), + (24200,-1574011,'Dalronn! See if you can muster the nerve to join my attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13229,1,0,0,'skarvald YELL_SKARVALD_AGGRO'), + (24200,-1574012,'Not... over... yet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13230,1,0,0,'skarvald YELL_SKARVALD_DAL_DIED'), + (24200,-1574013,'A warrior''s death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13231,1,0,0,'skarvald YELL_SKARVALD_SKA_DIEDFIRST'), + (24200,-1574014,'???',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13232,1,0,0,'skarvald YELL_SKARVALD_KILL'), + (24200,-1574015,'Pagh! What sort of necromancer lets death stop him? I knew you were worthless!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13233,1,0,0,'skarvald YELL_SKARVALD_DAL_DIEDFIRST'), + (24201,-1574016,'By all means, don''t assess the situation, you halfwit! Just jump into the fray!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13199,1,0,0,'dalronn YELL_DALRONN_AGGRO'), + (24201,-1574017,'See... you... soon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13200,1,0,0,'dalronn YELL_DALRONN_SKA_DIED'), + (24201,-1574018,'There''s no... greater... glory.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13201,1,0,0,'dalronn YELL_DALRONN_DAL_DIEDFIRST'), + (24201,-1574019,'You may serve me yet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13202,1,0,0,'dalronn YELL_DALRONN_KILL'), + (24201,-1574020,'Skarvald, you incompetent slug! Return and make yourself useful!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13203,1,0,0,'dalronn YELL_DALRONN_SKA_DIEDFIRST'), + +-- -1 575 000 UTGARDE PINNACLE +-- Skadi the Ruthless voice + (26693,-1575004,'What mongrels dare intrude here? Look alive, my brothers! A feast for the one that brings me their heads!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13497,1,0,0, 'Skadi - SAY_AGGRO'), + (26693,-1575005,'Not so brash now, are you?' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13504,1,0,0, 'Skadi - SAY_KILL_1'), + (26693,-1575006,'I''ll mount your skull from the highest tower!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13505,1,0,0, 'Skadi - SAY_KILL_2'), + (26693,-1575007,'%s in within range of the harpoon launchers!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0, 'Skadi - EMOTE_RANGE'), + (26693,-1575008,'ARGH! You call that... an attack? I''ll... show... aghhhh...' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13506,1,0,0, 'Skadi - SAY_DEATH'), + (26693,-1575009,'%s in within range of the harpoon launchers!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0, 'Skadi - EMOTE_RANGE'), + (26693,-1575010,'You motherless knaves! Your corpses will make fine morsels for my new drake!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13507,1,0,0, 'Skadi - SAY_DRAKE_DEATH'), + (26693,-1575011,'Sear them to the bone!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13498,1,0,0, 'Skadi - SAY_DRAKE_BREATH_1'), + (26693,-1575012,'Go now! Leave nothing but ash in your wake!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13499,1,0,0, 'Skadi - SAY_DRAKE_BREATH_2'), + (26693,-1575013,'Cleanse our sacred halls with flame!' ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13500,1,0,0, 'Skadi - SAY_DRAKE_BREATH_3'), + (26861,-1575028,'You invade my home and then dare to challenge me? I will tear the hearts from your chests and offer them as gifts to the death god! Rualg nja gaborr!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13609,1,0,0, 'King Ymirom - SAY_AGGRO'), + (26861,-1575029,'Your death is only the beginning!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13614,1,0,0, 'King Ymirom - SAY_SLAY_1'), + (26861,-1575030,'You have failed your people!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13615,1,0,0, 'King Ymirom - SAY_SLAY_2'), + (26861,-1575031,'There is a reason I am king!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13616,1,0,0, 'King Ymirom - SAY_SLAY_3'), + (26861,-1575032,'Bleed no more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13617,1,0,0, 'King Ymirom - SAY_SLAY_4'), + (26861,-1575033,'What... awaits me... now?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13618,1,0,0, 'King Ymirom - SAY_DEATH'), + (26861,-1575034,'Bjorn of the Black Storm! Honor me now with your presence!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13610,1,0,0, 'King Ymirom - SAY_SUMMON_BJORN'), + (26861,-1575035,'Haldor of the Rocky Cliffs, grant me your strength!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13611,1,0,0, 'King Ymirom - SAY_SUMMON_HALDOR'), + (26861,-1575036,'Ranulf of the Screaming Abyss, snuff these maggots with darkest night! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13612,1,0,0, 'King Ymirom - SAY_SUMMON_RANULF'), + (26861,-1575037,'Tor of the Brutal Siege! Bestow your might upon me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13613,1,0,0, 'King Ymirom - SAY_SUMMON_TORGYN'), + +-- -1 576 000 THE NEXUS: THE NEXUS + (26731,-1576000,'You know what they say about curiosity.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13319,1,0,0,'grand magus telestra SAY_AGGRO'), + (26731,-1576001,'Death becomes you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13324,1,0,0,'grand magus telestra SAY_KILL'), + (26731,-1576002,'Damn the... luck.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13320,1,0,0,'grand magus telestra SAY_DEATH'), + (26731,-1576003,'Now to finish the job!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13323,1,0,0,'grand magus telestra SAY_MERGE'), + (26731,-1576004,'There''s plenty of me to go around.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13321,1,0,0,'grand magus telestra SAY_SPLIT_1'), + (26731,-1576005,'I''ll give you more than you can handle.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13322,1,0,0,'grand magus telestra SAY_SPLIT_2'), + (26763,-1576010,'Chaos beckons.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13186,1,0,0,'anomalus SAY_AGGRO'), + (26763,-1576011,'Of course.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13187,1,0,0,'anomalus SAY_DEATH'), + (26763,-1576012,'Reality... unwoven.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13188,1,0,0,'anomalus SAY_RIFT'), + (26763,-1576013,'Indestructible.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13189,1,0,0,'anomalus SAY_SHIELD'), + (26794,-1576020,'Noo!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13328,1,0,0,'ormorok SAY_AGGRO'), + (26794,-1576021,'Aaggh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13330,1,0,0,'ormorok SAY_DEATH'), + (26794,-1576022,'Back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13331,1,0,0,'ormorok SAY_REFLECT'), + (26794,-1576023,'Bleed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13332,1,0,0,'ormorok SAY_CRYSTAL_SPIKES'), + (26794,-1576024,'Aaggh! Kill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13329,1,0,0,'ormorok SAY_KILL'), + (26723,-1576040,'Preserve? Why? There''s no truth in it. No no no... only in the taking! I see that now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13450,1,0,0,'keristrasza SAY_AGGRO'), + (26723,-1576041,'Now we''ve come to the truth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13453,1,0,0,'keristrasza SAY_SLAY'), + (26723,-1576042,'Finish it! FINISH IT! Kill me, or I swear by the Dragonqueen you''ll never see daylight again!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13452,1,0,0,'keristrasza SAY_ENRAGE'), + (26723,-1576043,'Dragonqueen... Life-Binder... preserve... me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13454,1,0,0,'keristrasza SAY_DEATH'), + (26723,-1576044,'Stay. Enjoy your final moments.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13451,1,0,0,'keristrasza SAY_CRYSTAL_NOVA'), + +-- -1 578 000 THE NEXUS: OCULUS + (27655,-1578000,'What do we have here... those that would defy the Spell-Weaver? Those without foresight our understanding. How can i make you see? Malygos is saving the world from itself! Bah! You are hardly worth my time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578001,'Clearly my pets failed. Perhaps another demonstration is in order.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578002,'Still you fight. Still you cling to misguided principles. If you survive, you''ll find me in the center ring.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578003,'Poor blind fools!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578004,'A taste... just a small taste... of the Spell-Weaver''s power!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + +-- -1 580 000 SUNWELL PLATEAU + (24850,-1580000,'Aggh! No longer will I be a slave to Malygos! Challenge me and you will be destroyed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12422,1,0,0,'kalecgos SAY_EVIL_AGGRO'), + (24850,-1580001,'I will purge you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12423,1,0,0,'kalecgos SAY_EVIL_SPELL1'), + (24850,-1580002,'Your pain has only begun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12424,1,0,0,'kalecgos SAY_EVIL_SPELL2'), + (24850,-1580003,'In the name of Kil''jaeden!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12425,1,0,0,'kalecgos SAY_EVIL_SLAY1'), + (24850,-1580004,'You were warned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12426,1,0,0,'kalecgos SAY_EVIL_SLAY2'), + (24850,-1580005,'My awakening is complete! You shall all perish!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12427,1,0,0,'kalecgos SAY_EVIL_ENRAGE'), + (24891,-1580006,'I need... your help... Cannot... resist him... much longer...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12428,1,0,0,'kalecgos humanoid SAY_GOOD_AGGRO'), + (24891,-1580007,'Aaahhh! Help me, before I lose my mind!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12429,1,0,0,'kalecgos humanoid SAY_GOOD_NEAR_DEATH'), + (24891,-1580008,'Hurry! There is not much of me left!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12430,1,0,0,'kalecgos humanoid SAY_GOOD_NEAR_DEATH2'), + (24891,-1580009,'I am forever in your debt. Once we have triumphed over Kil''jaeden, this entire world will be in your debt as well.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12431,1,0,0,'kalecgos humanoid SAY_GOOD_PLRWIN'), + (24892,-1580010,'There will be no reprieve. My work here is nearly finished.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12451,1,0,0,'sathrovarr SAY_SATH_AGGRO'), + (24892,-1580011,'I''m... never on... the losing... side...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12452,1,0,0,'sathrovarr SAY_SATH_DEATH'), + (24892,-1580012,'Your misery is my delight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12453,1,0,0,'sathrovarr SAY_SATH_SPELL1'), + (24892,-1580013,'I will watch you bleed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12454,1,0,0,'sathrovarr SAY_SATH_SPELL2'), + (24892,-1580014,'Pitious mortal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12455,1,0,0,'sathrovarr SAY_SATH_SLAY1'), + (24892,-1580015,'Haven''t you heard? I always win!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12456,1,0,0,'sathrovarr SAY_SATH_SLAY2'), + (24892,-1580016,'I have toyed with you long enough!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12457,1,0,0,'sathrovarr SAY_SATH_ENRAGE'), + (24882,-1580017,'Puny lizard! Death is the only answer you''ll find here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12458,1,0,0,'brutallus YELL_INTRO'), + (24882,-1580018,'Grah! Your magic is weak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12459,1,0,0,'brutallus YELL_INTRO_BREAK_ICE'), + (24882,-1580019,'I will crush you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12460,1,0,0,'brutallus YELL_INTRO_CHARGE'), + (24882,-1580020,'That was fun.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12461,1,0,0,'brutallus YELL_INTRO_KILL_MADRIGOSA'), + (24882,-1580021,'Come, try your luck!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12462,1,0,0,'brutallus YELL_INTRO_TAUNT'), + (24882,-1580022,'Ahh! More lambs to the slaughter!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12463,1,0,0,'brutallus YELL_AGGRO'), + (24882,-1580023,'Perish, insect!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12464,1,0,0,'brutallus YELL_KILL1'), + (24882,-1580024,'You are meat!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12465,1,0,0,'brutallus YELL_KILL2'), + (24882,-1580025,'Too easy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12466,1,0,0,'brutallus YELL_KILL3'), + (24882,-1580026,'Bring the fight to me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12467,1,0,0,'brutallus YELL_LOVE1'), + (24882,-1580027,'Another day, another glorious battle!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12468,1,0,0,'brutallus YELL_LOVE2'), + (24882,-1580028,'I live for this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12469,1,0,0,'brutallus YELL_LOVE3'), + (24882,-1580029,'So much for a real challenge... Die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12470,1,0,0,'brutallus YELL_BERSERK'), + (24882,-1580030,'Gah! Well done... Now... this gets... interesting...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12471,1,0,0,'brutallus YELL_DEATH'), + (24882,-1580031,'Hold, friends! There is information to be had before this devil meets his fate!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12472,1,0,0,'madrigosa YELL_MADR_ICE_BARRIER'), + (24882,-1580032,'Where is Anveena, demon? What has become of Kalec?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12473,1,0,0,'madrigosa YELL_MADR_INTRO'), + (24882,-1580033,'You will tell me where they are!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12474,1,0,0,'madrigosa YELL_MADR_ICE_BLOCK'), + (24882,-1580034,'Speak, I grow weary of asking!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12475,1,0,0,'madrigosa YELL_MADR_TRAP'), + (24882,-1580035,'Malygos, my lord! I did my best!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12476,1,0,0,'madrigosa YELL_MADR_DEATH'), + (25038,-1580036,'Glory to Kil''jaeden! Death to all who oppose!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12477,1,0,0,'felmyst - YELL_BIRTH'), + (25038,-1580037,'I kill for the master!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12480,1,0,0,'felmyst - YELL_KILL1'), + (25038,-1580038,'The end has come!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12481,1,0,0,'felmyst - YELL_KILL2'), + (25038,-1580039,'Choke on your final breath!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12478,1,0,0,'felmyst - YELL_BREATH'), + (25038,-1580040,'I am stronger than ever before!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12479,1,0,0,'felmyst- YELL_TAKEOFF'), + (25038,-1580041,'No more hesitation! Your fates are written!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12482,1,0,0,'felmyst - YELL_BERSERK'), + (25038,-1580042,'Kil''jaeden... will... prevail...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12483,1,0,0,'felmyst - YELL_DEATH'), + (25038,-1580043,'Madrigosa deserved a far better fate. You did what had to be done, but this battle is far from over.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12439,1,0,0,'felmyst - YELL_KALECGOS'), + (25166,-1580044,'Fire to the aid of shadow!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12489,1,0,0,'eredar - YELL_CANFLAGRATION'), + (25166,-1580045,'Sacrolash!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12492,1,0,0,'eredar - YELL_SISTER_SACROLASH_DEAD'), + (25166,-1580046,'Fire consume.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12490,1,0,0,'eredar - YELL_ALY_KILL_1'), + (25166,-1580047,'Ed-ir Halach!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12491,1,0,0,'eredar - YELL_ALY_KILL_2'), + (25166,-1580048,'De-ek Anur!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12494,1,0,0,'eredar - YELL_ALY_DEAD'), + (25166,-1580049,'Your luck has run its curse!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12493,1,0,0,'eredar - YELL_BERSERK'), + (25165,-1580050,'Shadow to the aid of fire!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12485,1,0,0,'eredar - YELL_SHADOW_NOVA'), + (25165,-1580051,'Alythess! Your fire burns within me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12488,1,0,0,'eredar - YELL_SISTER_ALYTHESS_DEAD'), + (25165,-1580052,'Shadow engulf.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12486,1,0,0,'eredar - YELL_SAC_KILL_1'), + (25165,-1580053,'Ee-nok Kryul!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12487,1,0,0,'eredar - YELL_SAC_KILL_2'), + (25165,-1580054,'I... fade.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_SAC_DEAD'), + (25165,-1580055,'Time is a luxury you no longer possess!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_ENRAGE'), + (25166,-1580056,'Misery...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12484,1,0,0,'eredar - YELL_INTRO_SAC_1'), + (25166,-1580057,'Depravity...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_INTRO_ALY_2'), + (25166,-1580058,'Confusion...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_INTRO_SAC_3'), + (25166,-1580059,'Hatred...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_INTRO_ALY_4'), + (25166,-1580060,'Mistrust...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_INTRO_SAC_5'), + (25166,-1580061,'Chaos...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_INTRO_ALY_6'), + (25166,-1580062,'These are the hallmarks...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_INTRO_SAC_7'), + (25166,-1580063,'These are the pillars...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'eredar - YELL_INTRO_ALY_8'), + (25165,-1580064,'%s directs Shadow Nova at $N',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'eredar - emote shadow nova'), + (25166,-1580065,'%s directs Conflagration at $N',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'eredar - emote conflagration'), + (25608,-1580066,'All my plans have led to this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12495,1,0,0,'KJ - SAY_KJ_OFFCOMBAT1'), + (25608,-1580067,'Stay on task! Do not waste time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12496,1,0,0,'KJ - SAY_KJ_OFFCOMBAT2'), + (25608,-1580068,'I have waited long enough!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12497,1,0,0,'KJ - SAY_KJ_OFFCOMBAT3'), + (25608,-1580069,'Fail me and suffer for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12498,1,0,0,'KJ - SAY_KJ_OFFCOMBAT4'), + (25608,-1580070,'Drain the girl! Drain her power until there is nothing but a vacant shell!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12499,1,0,0,'KJ - SAY_KJ_OFFCOMBAT5'), + (25315,-1580071,'The expendible have perished... So be it! Now I shall succeed where Sargeras could not! I will bleed this wretched world and secure my place as the true master of the Burning Legion. The end has come! Let the unraveling of this world commence!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12500,1,0,0,'KJ - SAY_KJ_EMERGE'), + (25315,-1580072,'Another step towards destruction!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12501,1,0,0,'KJ - SAY_KJ_SLAY1'), + (25315,-1580073,'Anak-ky''ri!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12502,1,0,0,'KJ - SAY_KJ_SLAY2'), + (25315,-1580074,'Who can you trust?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12503,1,0,0,'KJ - SAY_KJ_REFLECTION1'), + (25315,-1580075,'The enemy is among you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12504,1,0,0,'KJ - SAY_KJ_REFLECTION2'), + (25315,-1580076,'Chaos!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12505,1,0,0,'KJ - SAY_KJ_DARKNESS1'), + (25315,-1580077,'Destruction!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12506,1,0,0,'KJ - SAY_KJ_DARKNESS2'), + (25315,-1580078,'Oblivion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12507,1,0,0,'KJ - SAY_KJ_DARKNESS3'), + (25315,-1580079,'I will not be denied! This world shall fall!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12508,1,0,0,'KJ - SAY_KJ_PHASE3'), + (25315,-1580080,'Do not harbor false hope. You cannot win!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12509,1,0,0,'KJ - SAY_KJ_PHASE4'), + (25315,-1580081,'Aggghh! The powers of the Sunwell... turned... against me! What have you done? WHAT HAVE YOU DONE?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12510,1,0,0,'KJ - SAY_KJ_PHASE5'), + (25315,-1580082,'Anveena, you must awaken, this world needs you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12445,1,0,0,'KJ - SAY_KALECGOS_AWAKEN'), + (25315,-1580083,'I serve only the Master now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12511,1,0,0,'KJ - SAY_ANVEENA_IMPRISONED'), + (25315,-1580084,'You must let go! You must become what you were always meant to be! The time is now, Anveena!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12446,1,0,0,'KJ - SAY_KALECGOS_LETGO'), + (25315,-1580085,'But I''m... lost... I cannot find my way back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12512,1,0,0,'KJ - SAY_ANVEENA_LOST'), + (25315,-1580086,'Anveena, I love you! Focus on my voice, come back for me now! Only you can cleanse the Sunwell!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12447,1,0,0,'KJ - SAY_KALECGOS_FOCUS'), + (25315,-1580087,'Kalec... Kalec?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12513,1,0,0,'KJ - SAY_ANVEENA_KALEC'), + (25315,-1580088,'Yes, Anveena! Let fate embrace you now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12448,1,0,0,'KJ - SAY_KALECGOS_FATE'), + (25315,-1580089,'The nightmare is over, the spell is broken! Goodbye, Kalec, my love!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12514,1,0,0,'KJ - SAY_ANVEENA_GOODBYE'), + (25315,-1580090,'Goodbye, Anveena, my love. Few will remember your name, yet this day you change the course of destiny. What was once corrupt is now pure. Heroes, do not let her sacrifice be in vain.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12450,1,0,0,'KJ - SAY_KALECGOS_GOODBYE'), + (25315,-1580091,'Strike now, heroes, while he is weakened! Vanquish the Deceiver!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12449,1,0,0,'KJ - SAY_KALECGOS_ENCOURAGE'), + (25319,-1580092,'You are not alone. The Blue Dragonflight shall help you vanquish the Deceiver.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12438,1,0,0,'KJ - SAY_KALECGOS_JOIN'), + (25315,-1580093,'Nooooooooooooo!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12527,1,0,0,'KJ - SAY_KJ_DEATH'), + (25315,-1580094,'%s begins to channel dark energy',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'KJ - EMOTE_KJ_DARKNESS'), + (25319,-1580095,'I will channel my power into the orbs, be ready!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12440,1,0,0,'KJ - SAY_KALEC_ORB_READY1'), + (25319,-1580096,'I have empowered another orb! Use it quickly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12441,1,0,0,'KJ - SAY_KALEC_ORB_READY2'), + (25319,-1580097,'Another orb is ready! Make haste!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12442,1,0,0,'KJ - SAY_KALEC_ORB_READY3'), + (25319,-1580098,'I have channeled all I can! The power is in your hands!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12443,1,0,0,'KJ - SAY_KALEC_ORB_READY4'), + (0,-1580099,'Mortal heroes, your victory here today was foretold long ago. My brother''s anguished cry of defeat will echo across the universe, bringing renewed hope to all those who still stand against the Burning Crusade.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12515,0,0,0,'prophet velen - SAY1'), + (0,-1580100,'As the Legion''s final defeat draws ever-nearer, stand proud in the knowledge that you have saved worlds without number from the flame. Just as this day marks an ending, so too does it herald a new beginning...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12516,0,0,0,'prophet velen - SAY2'), + (0,-1580101,'The creature Entropius, whom you were forced to destroy, was once the noble naaru, M''uru. In life, M''uru channeled vast energies of LIGHT and HOPE. For a time, a misguided few sought to steal those energies...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12518,0,0,0,'prophet velen - SAY3'), + (0,-1580102,'Then fortunate it is, that I have reclaimed the noble naaru''s spark from where it fell! Where faith dwells, hope is never lost, young blood elf.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12519,0,0,0,'prophet velen - SAY4'), + (0,-1580103,'Gaze now, mortals - upon the HEART OF M''URU! Unblemished. Bathed by the light of Creation - just as it was at the Dawn.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12520,0,0,0,'prophet velen - SAY5'), + (0,-1580104,'In time, the light and hope held within - will rebirth more than this mere fount of power... Mayhap, they will rebirth the soul of a nation.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12521,0,0,0,'prophet velen - SAY6'), + (0,-1580105,'Salvation, young one. It waits for us all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12522,0,0,0,'prophet velen - SAY7'), + (0,-1580106,'Farewell...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12523,0,0,0,'prophet velen - SAY8'), + (0,-1580107,'Our arrogance was unpardonable. We damned one of the most noble beings of all. We may never atone for this sin.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12524,0,0,0,'lady liadrinn - SAY1'), + (0,-1580108,'Can it be?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12525,0,0,0,'lady liadrinn - SAY2'), + (0,-1580109,'Blessed ancestors! I feel it... so much love... so much grace... there are... no words... impossible to describe...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12525,0,0,0,'lady liadrinn - SAY3'), + +-- -1 585 000 MAGISTER'S TERRACE + (24723,-1585000,'You only waste my time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12378,1,0,0,'selin SAY_AGGRO'), + (24723,-1585001,'My hunger knows no bounds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12381,1,0,0,'selin SAY_ENERGY'), + (24723,-1585002,'Yes! I am a god!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12382,1,0,0,'selin SAY_EMPOWERED'), + (24723,-1585003,'Enough distractions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12388,1,0,0,'selin SAY_KILL_1'), + (24723,-1585004,'I am invincible!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12385,1,0,0,'selin SAY_KILL_2'), + (24723,-1585005,'No! More... I must have more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12383,1,0,0,'selin SAY_DEATH'), + (24723,-1585006,'%s begins to channel from the nearby Fel Crystal...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'selin EMOTE_CRYSTAL'), + (24744,-1585007,'Drain...life!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12389,1,0,0,'vexallus SAY_AGGRO'), + (24744,-1585008,'Un...con...tainable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12392,1,0,0,'vexallus SAY_ENERGY'), + (24744,-1585009,'Un...leash...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12390,1,0,0,'vexallus SAY_OVERLOAD'), + (24744,-1585010,'Con...sume.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12393,1,0,0,'vexallus SAY_KILL'), + (24744,-1585011,'discharges pure energy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'vexallus EMOTE_DISCHARGE_ENERGY'), + (24560,-1585012,'Annihilate them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12395,1,0,0,'delrissa SAY_AGGRO'), + (24560,-1585013,'Oh, the horror.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12398,1,0,0,'delrissa LackeyDeath1'), + (24560,-1585014,'Well, aren''t you lucky?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12400,1,0,0,'delrissa LackeyDeath2'), + (24560,-1585015,'Now I''m getting annoyed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12401,1,0,0,'delrissa LackeyDeath3'), + (24560,-1585016,'Lackies be damned! I''ll finish you myself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12403,1,0,0,'delrissa LackeyDeath4'), + (24560,-1585017,'I call that a good start.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12405,1,0,0,'delrissa PlayerDeath1'), + (24560,-1585018,'I could have sworn there were more of you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12407,1,0,0,'delrissa PlayerDeath2'), + (24560,-1585019,'Not really much of a group, anymore, is it?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12409,1,0,0,'delrissa PlayerDeath3'), + (24560,-1585020,'One is such a lonely number.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12410,1,0,0,'delrissa PlayerDeath4'), + (24560,-1585021,'It''s been a kick, really.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12411,1,0,0,'delrissa PlayerDeath5'), + (24560,-1585022,'Not what I had... planned...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12397,1,0,0,'delrissa SAY_DEATH'), + (24664,-1585023,'Don''t look so smug! I know what you''re thinking, but Tempest Keep was merely a set back. Did you honestly believe I would trust the future to some blind, half-night elf mongrel? Oh no, he was merely an instrument, a stepping stone to a much larger plan! It has all led to this, and this time, you will not interfere!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12413,1,0,0,'kaelthas MT SAY_AGGRO'), + (24664,-1585024,'Vengeance burns!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12415,1,0,0,'kaelthas MT SAY_PHOENIX'), + (24664,-1585025,'Felomin ashal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12417,1,0,0,'kaelthas MT SAY_FLAMESTRIKE'), + (24664,-1585026,'I''ll turn your world... upside... down...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12418,1,0,0,'kaelthas MT SAY_GRAVITY_LAPSE'), + (24664,-1585027,'Master... grant me strength.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12419,1,0,0,'kaelthas MT SAY_TIRED'), + (24664,-1585028,'Do not... get too comfortable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12420,1,0,0,'kaelthas MT SAY_RECAST_GRAVITY'), + (24664,-1585029,'My demise accomplishes nothing! The Master will have you! You will drown in your own blood! This world shall burn! Aaaghh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12421,1,0,0,'kaelthas MT SAY_DEATH'), + +-- -1 590 000 VAULT OF ARCHAVON + (33993,-1590000,'Emalon the Storm Watcher overcharges a Tempest Minion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'emalon EMOTE_OVERCHARGE_TEMPEST_MINION'), + (33993,-1590001,'A Tempest Minion appears to defend Emalon!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'emalon EMOTE_MINION_RESPAWN'), + (33993,-1590002,'Archavon the Stone Watcher goes into a berserker rage!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'archavon EMOTE_BERSERK'), + +-- -1 595 000 CAVERNS OF TIME: CULLING OF STRATHOLME +-- Chrono Lord Epoch + (26532,-1595000,'Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13408,1,0,0,'epoch SAY_INTRO | culling SAY_PHASE314'), + (26532,-1595001,'We''ll see about that, young prince.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13409,1,0,0,'epoch SAY_AGGRO'), + (26532,-1595002,'Tick tock, tick tock...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13410,1,0,0,'epoch SAY_TIME_WARP_1'), + (26532,-1595003,'Not quick enough!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13411,1,0,0,'epoch SAY_TIME_WARP_2'), + (26532,-1595004,'Let''s get this over with. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13412,1,0,0,'epoch SAY_TIME_WARP_3'), + (26532,-1595005,'There is no future for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13413,1,0,0,'epoch SAY_SLAY_1'), + (26532,-1595006,'This is the hour of our greatest triumph!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13414,1,0,0,'epoch SAY_SLAY_2'), + (26532,-1595007,'You were destined to fail.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13415,1,0,0,'epoch SAY_SLAY_3'), + (26532,-1595008,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13416,0,0,0,'epoch SAY_DEATH'), +-- Mal'Ganis + (26533,-1595009,'Yes, this is the beginning. I''ve been waiting for you, young prince. I am Mal''Ganis.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14410,0,0,1,'mal_ganis SAY_INTRO_1 | culling SAY_PHASE206'), + (26533,-1595010,'As you can see, your people are now mine. I will now turn this city household by household, until the flame of life has been snuffed out... forever.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14411,0,0,1,'mal_ganis SAY_INTRO_2 | culling SAY_PHASE207'), + (26533,-1595011,'This will be a fine test...Prince Arthas...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14413,1,0,0,'mal_ganis SAY_AGGRO'), + (26533,-1595012,'All too easy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14416,1,0,0,'mal_ganis SAY_KILL_1'), + (26533,-1595013,'The dark lord is displeased with your interference...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14417,1,0,0,'mal_ganis SAY_KILL_2'), + (26533,-1595014,'It is Prince Arthas I want... not you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14418,1,0,0,'mal_ganis SAY_KILL_3'), + (26533,-1595015,'Anak''Keri...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14422,1,0,0,'mal_ganis SAY_SLAY_1'), + (26533,-1595016,'My onslaught will wash over the Lich King''s forces...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14423,1,0,0,'mal_ganis SAY_SLAY_2'), + (26533,-1595017,'Your death is in vain, tiny mortal...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14424,1,0,0,'mal_ganis SAY_SLAY_3'), + (26533,-1595018,'Your time has come to an end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14425,1,0,0,'mal_ganis SAY_SLAY_4'), + (26533,-1595019,'Time out...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14414,1,0,0,'mal_ganis SAY_SLEEP_1'), + (26533,-1595020,'You seem...tired...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14415,1,0,0,'mal_ganis SAY_SLEEP_2'), + (26533,-1595021,'I spent too much time in that weak little shell...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14426,1,0,0,'mal_ganis SAY_30HEALTH'), + (26533,-1595022,'(Eredun) I AM MAL''GANIS! I AM ETERNAL!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14427,1,0,0,'mal_ganis SAY_15HEALTH'), + (26533,-1595023,'ENOUGH! I waste my time here...I must gather my strength on the home world...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14428,1,0,0,'mal_ganis SAY_ESCAPE_SPEECH_1'), + (26533,-1595024,'You''ll never defeat the Lich King without my forces! I''ll have my revenge...on him, AND you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14429,1,0,0,'mal_ganis SAY_ESCAPE_SPEECH_2'), + (26533,-1595025,'Your journey has just begun, young prince. Gather your forces and meet me in the artic land of Northrend. It is there that we shall settle the score between us. It is there that your true destiny will unfold.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14412,1,0,1,'mal_ganis SAY_OUTRO'), +-- Meathook + (26529,-1595026,'Play time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13428,1,0,0,'meathook SAY_AGGRO'), + (26529,-1595027,'Boring...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13430,1,0,0,'meathook SAY_SLAY_1'), + (26529,-1595028,'Why you stop moving?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13431,1,0,0,'meathook SAY_SLAY_2'), + (26529,-1595029,'Get up! Me not done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13432,1,0,0,'meathook SAY_SLAY_3'), + (26529,-1595030,'New toys!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13429,1,0,0,'meathook SAY_SPAWN'), + (26529,-1595031,'This... not fun...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13433,1,0,0,'meathook SAY_DEATH'), +-- Salramm the Fleshcrafter + (26530,-1595032,'Ah, the entertainment has arrived!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13472,1,0,0,'salramm SAY_AGGRO'), + (26530,-1595033,'You are too late, champion of Lordaeron. The dead shall have their day.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13471,1,0,0,'salramm SAY_SPAWN'), + (26530,-1595034,'The fun is just beginning!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13473,1,0,0,'salramm SAY_SLAY_1'), + (26530,-1595035,'Aah, quality materials!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13474,1,0,0,'salramm SAY_SLAY_2'), + (26530,-1595036,'Don''t worry, I''ll make good use of you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13475,1,0,0,'salramm SAY_SLAY_3'), + (26530,-1595037,'You only advance... the master''s plan...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13483,1,0,0,'salramm SAY_DEATH'), + (26530,-1595038,'BOOM! Hahahahah...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13478,1,0,0,'salramm SAY_EXPLODE_GHOUL_1'), + (26530,-1595039,'Blood... destruction... EXHILARATING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13479,1,0,0,'salramm SAY_EXPLODE_GHOUL_2'), + (26530,-1595040,'I want a sample...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13480,1,0,0,'salramm SAY_STEAL_FLESH_1'), + (26530,-1595041,'Such strength... it must be mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13481,1,0,0,'salramm SAY_STEAL_FLESH_2'), + (26530,-1595042,'Your flesh betrays you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13482,1,0,0,'salramm SAY_STEAL_FLESH_3'), + (26530,-1595043,'Say hello to some friends of mine.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13476,1,0,0,'salramm SAY_SUMMON_GHOULS_1'), + (26530,-1595044,'Come, citizen of Stratholme! Meet your saviors.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13477,1,0,0,'salramm SAY_SUMMON_GHOULS_2'), +-- The Infinite Corruptor + (32273,-1595045,'How dare you interfere with our work here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'infinite SAY_AGGRO'), + (32273,-1595046,'My work here is finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'infinite SAY_FAIL'), + (32273,-1595047,'My time... has run out...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'infinite SAY_DEATH'), +-- First Act - Uther and Jaina Dialog +-- Outside the city, Arthas, Uther and Jaina dialog + (26499,-1595070,'Glad you could make it, Uther.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12828,0,0,1,'culling SAY_PHASE101'), + (26528,-1595071,'Watch your tone with me, boy. You may be the prince, but I''m still your superior as a paladin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12839,0,0,25,'culling SAY_PHASE102'), + (26499,-1595072,'As if I could forget. Listen, Uther, there''s something about the plague you should know... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12829,0,0,0,'culling SAY_PHASE103'), + (26499,-1595073,'Oh, no. We''re too late. These people have all been infected! They may look fine now, but it''s just a matter of time before they turn into the undead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12830,0,0,1,'culling SAY_PHASE104'), + (26528,-1595074,'What?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12840,0,0,5,'culling SAY_PHASE105'), + (26499,-1595075,'This entire city must be purged.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12831,0,0,1,'culling SAY_PHASE106'), + (26528,-1595076,'How can you even consider that? There''s got to be some other way.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12841,0,0,1,'culling SAY_PHASE107'), + (26499,-1595077,'Damn it, Uther! As your future king, I order you to purge this city!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12832,1,0,5,'culling SAY_PHASE108'), + (26528,-1595078,'You are not my king yet, boy! Nor would I obey that command even if you were!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12842,1,0,22,'culling SAY_PHASE109'), + (26499,-1595079,'Then I must consider this an act of treason.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12833,0,0,0,'culling SAY_PHASE110'), + (26528,-1595080,'Treason? Have you lost your mind, Arthas?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12843,0,0,5,'culling SAY_PHASE111'), + (26499,-1595081,'Have I? Lord Uther, by my right of succession and the sovereignty of my crown, I hereby relieve you of your command and suspend your paladins from service.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12834,0,0,1,'culling SAY_PHASE112'), + (26497,-1595082,'Arthas! You can''t just--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12837,0,0,1,'culling SAY_PHASE113'), + (26499,-1595083,'It''s done! Those of you who have the will to save this land, follow me! The rest of you... get out of my sight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12835,0,0,0,'culling SAY_PHASE114'), + (26528,-1595084,'You''ve just crossed a terrible threshold, Arthas.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12844,0,0,25,'culling SAY_PHASE115'), + (26499,-1595085,'Jaina?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12836,0,0,1,'culling SAY_PHASE116'), + (26497,-1595086,'I''m sorry, Arthas. I can''t watch you do this.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12838,0,0,1,'culling SAY_PHASE117'), + (26499,-1595087,'Take position here, and I will lead a small force inside Stratholme to begin the culling. We must contain and purge the infected for the sake of all Lordaeron!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14327,0,0,1,'culling SAY_PHASE118'), +-- Second Act - City Streets +-- Arthas enters the city and dialog with Mal'Ganis +-- After defeating 2 bosses he runs to Town Hall + (26499,-1595088,'Everyone looks ready. Remember, these people are all infected with the plague and will die soon. We must purge Stratholme to protect the remainder of Lordaeron from the Scourge. Let''s go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14293,0,0,1,'culling SAY_PHASE201'), + (0,-1595089,'Prince Arthas, may the light be praised! Many people in the town have begun to fall seriously ill, can you help us?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'culling SAY_PHASE202'), + (26499,-1595090,'I can only help you with a clean death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14294,0,0,0,'culling SAY_PHASE203'), + (0,-1595091,'What? This can''t be!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'culling SAY_PHASE204'), + (26499,-1595092,'That was just the beginning.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14295,0,0,1,'culling SAY_PHASE205'), + (26499,-1595093,'I won''t allow it, Mal''Ganis! Better that these people die by my hand than serve as your slaves in death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14296,0,0,5,'culling SAY_PHASE208'), + (26499,-1595094,'Mal''ganis will send out some of his Scourge minions to interfere with us. Those of you with the strongest steel and magic shall go forth and destroy them. I will lead the rest of my forces in purging Stratholme of the infected.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14885,0,0,1,'culling SAY_PHASE209'), + (26499,-1595095,'Champions, meet me at town hall at once! We must take the fight to Mal''Ganis.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14297,0,0,1,'culling SAY_PHASE210'), +-- Third Act - Town Hall + (26499,-1595096,'Follow me. I know the way trought.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14298,0,0,1,'culling SAY_PHASE301'), + (0,-1595097,'Ah, you''ve finally arrived Prince Arthas. You''re just in the nick of time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'culling SAY_PHASE302'), + (26499,-1595098,'Yes, I''m glad i could get you before the plague.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14299,0,0,1,'culling SAY_PHASE303'), + (26499,-1595099,'What is this sorcery?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14300,0,0,0,'culling SAY_PHASE304'), + (0,-1595100,'There''s no need for you to understand, Arthas. All you need to do is die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'culling SAY_PHASE305'), + (26499,-1595101,'Mal''Ganis appears to have more than scourge in his arsenal. We should make haste.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14301,0,0,0,'culling SAY_PHASE306'), + (26499,-1595102,'More vile sorcery! Be ready for anything.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14302,0,0,0,'culling SAY_PHASE307'), + (26499,-1595103,'Let''s move on.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14303,0,0,0,'culling SAY_PHASE308'), + (26499,-1595104,'Watch your backs... they have us surrounded in this hall.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14304,0,0,0,'culling SAY_PHASE309'), + (26499,-1595105,'One less obstacle to deal with.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'culling SAY_PHASE310'), + (26499,-1595106,'Mal''Ganis is not making this easy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14305,0,0,0,'culling SAY_PHASE311'), + (26499,-1595107,'They''re very persistent.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14306,0,0,0,'culling SAY_PHASE312'), + (26499,-1595108,'What else can be put in my way?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14307,0,0,0,'culling SAY_PHASE313'), + (26499,-1595109,'I do what i must for Lordaeron. And neither your words nor your actions will stop me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14309,0,0,5,'culling SAY_PHASE315'), +-- Fourth Act - Fire Corridor + (26499,-1595110,'The quickest path to Mal''Ganis lays behind that bookshelf ahead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14308,0,0,0,'culling SAY_PHASE401'), + (26499,-1595111,'This will only take a moment.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14310,0,0,0,'culling SAY_PHASE402'), + (26499,-1595112,'I believe that secret passage still works!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14311,0,0,0,'culling SAY_PHASE403'), + (26499,-1595113,'Let''s move trought here as quickly as possible. If the undead don''t kill us the fires might.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14312,0,0,0,'culling SAY_PHASE404'), + (26499,-1595114,'Rest a moment and clear your lungs. But we must move again soon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14313,0,0,0,'culling SAY_PHASE405'), + (26499,-1595115,'That''s enough, we must move again. Mal''Ganis awaits.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14314,0,0,0,'culling SAY_PHASE406'), + (26499,-1595116,'At last some good luck, Market Row has not caught fire yet. Mal''Ganis is supposed to be on Crusader Square which is just ahead. Tell me when you''re ready to move forth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14315,0,0,0,'culling SAY_PHASE407'), +-- Fifth Act - Mal'Ganis Fight + (26499,-1595117,'Justice will be done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14316,0,0,0,'culling SAY_PHASE501'), + (26499,-1595118,'We''re going to finish this right now Mal''Ganis... just you and me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14317,0,0,0,'culling SAY_PHASE502'), + (26499,-1595119,'I''ll hunt you to the ends of the earth if I have to! Do you hear me? To the ends of the earth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14318,1,0,5,'culling SAY_PHASE503'), + (26499,-1595120,'You performed well this day. Anything that Mal''Ganis has left behind is yours. Take it as your reward. I must now begin plans for an expedition to Northrend.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14319,0,0,5,'culling SAY_PHASE504'), + +-- -1 599 000 HALLS OF STONE +/* Maiden of Grief */ + (27975,-1599000,'You shouldn''t have come...now you will die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13487,1,0,0,'maiden of grief SAY_AGGRO'), + (27975,-1599001,'Why must it be this way?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13488,1,0,0,'maiden of grief SAY_SLAY_1'), + (27975,-1599002,'You had it coming!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13489,1,0,0,'maiden of grief SAY_SLAY_2'), + (27975,-1599003,'My burden grows heavier.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13490,1,0,0,'maiden of grief SAY_SLAY_3'), + (27975,-1599004,'This is your own fault!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13491,1,0,0,'maiden of grief SAY_SLAY_4'), + (27975,-1599005,'I hope you all rot! I never...wanted...this.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13493,1,0,0,'maiden of grief SAY_DEATH'), + (27975,-1599006,'So much lost time... that you''ll never get back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13492,1,0,0,'maiden of grief SAY_STUN'), +/* Krystallus */ + (27977,-1599007,'Crush....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14176,1,0,0,'krystallus SAY_AGGRO'), + (27977,-1599008,'Ha...ha...ha...ha...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14177,1,0,0,'krystallus SAY_KILL'), + (27977,-1599009,'Uuuuhhhhhhhhhh......',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14179,1,0,0,'krystallus SAY_DEATH'), + (27977,-1599010,'Break.... you....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14178,1,0,0,'krystallus SAY_SHATTER'), +/* Sjonnir */ + (27978,-1599011,'Soft, vulnerable shells. Brief, fragile lives. You can not escape the curse of flesh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14180,1,0,0,'Sjonnir SAY_AGGRO'), + (27978,-1599012,'Flesh is no match for iron!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14182,1,0,0,'Sjonnir SAY_SLAY_1'), + (27978,-1599013,'Armies of iron will smother the world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14183,1,0,0,'Sjonnir SAY_SLAY_2'), + (27978,-1599015,'Loken will not rest, until the forge is retaken. You changed nothing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14184,1,0,0,'Sjonnir SAY_DEATH'), +/* Brann and Tribunal Event */ + (28070,-1599016,'Now that''s owning your supper!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14244,1,0,0,'brann SAY_KILL_1'), + (28070,-1599017,'Press on, that''s the way!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14245,1,0,0,'brann SAY_KILL_2'), + (28070,-1599018,'Keep it up now. Plenty of death-dealing for everyone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14246,1,0,0,'brann SAY_KILL_3'), + (28070,-1599019,'I''m all kinds of busted up. Might not... make it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14257,1,0,0,'brann SAY_LOW_HEALTH'), + (28070,-1599020,'Not yet, not... yet-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14258,1,0,0,'brann SAY_DEATH'), + (28070,-1599021,'I''m doing everything I can!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14260,1,0,0,'brann SAY_PLAYER_DEATH_1'), + (28070,-1599022,'Light preserve you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14261,1,0,0,'brann SAY_PLAYER_DEATH_2'), + (28070,-1599023,'I hope this is all worth it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14262,1,0,0,'brann SAY_PLAYER_DEATH_3'), + (28070,-1599024,'Time to get some answers! Let''s get this show on the road!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14259,1,0,0,'brann SAY_ESCORT_START'), + (28070,-1599025,'Don''t worry. Old Brann has got your back. Keep that metal monstrosity busy and I''ll see if I can sweet talk this machine into helping you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14274,1,0,0,'brann SAY_SPAWN_DWARF'), + (28070,-1599026,'This is a wee bit trickier that before... Oh, bloody--incomin''!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14275,1,0,0,'brann SAY_SPAWN_TROGG'), + (28070,-1599027,'What in the name o'' Madoran did THAT do? Oh! Wait: I just about got it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14276,1,0,0,'brann SAY_SPAWN_OOZE'), + (28070,-1599028,'Ha, that did it. Help''s a-coming. Take this you glow-eying brute!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14277,1,0,0,'brann SAY_SPAWN_EARTHEN'), + (28070,-1599029,'Take a moment and relish this with me! Soon all will be revealed! Okay then, let''s do this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14247,1,0,0,'brann SAY_EVENT_INTRO_1'), + (28070,-1599030,'Now keep an eye out! I''ll have this licked in two shakes of a--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14248,1,0,0,'brann SAY_EVENT_INTRO_2'), + (28070,-1599031,'Warning! Life form pattern not recognized. Archival processing terminated. Continued interference will result in targeted response.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13765,1,0,0,'brann SAY_EVENT_INTRO_3_ABED'), + (28070,-1599032,'Oh, that doesn''t sound good. We might have a complication or two...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14249,1,0,0,'brann SAY_EVENT_A_1'), + (28070,-1599033,'Security breach in progress. Analysis of historical archives transferred to lower priority queue. Countermeasures engaged.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13756,1,0,0,'brann SAY_EVENT_A_2_KADD'), + (28070,-1599034,'Ah, you want to play hardball, eh? That''s just my game!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14250,1,0,0,'brann SAY_EVENT_A_3'), + (28070,-1599035,'Couple more minutes and I''ll--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14251,1,0,0,'brann SAY_EVENT_B_1'), + (28070,-1599036,'Threat index threshold exceeded. Celestial archive aborted. Security level heightened.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13761,1,0,0,'brann SAY_EVENT_B_2_MARN'), + (28070,-1599037,'Heightened? What''s the good news?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14252,1,0,0,'brann SAY_EVENT_B_3'), + (28070,-1599038,'So that was the problem? Now I''m makin'' progress...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14253,1,0,0,'brann SAY_EVENT_C_1'), + (28070,-1599039,'Critical threat index. Void analysis diverted. Initiating sanitization protocol.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13767,1,0,0,'brann SAY_EVENT_C_2_ABED'), + (28070,-1599040,'Hang on! Nobody''s gonna'' be sanitized as long as I have a say in it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14254,1,0,0,'brann SAY_EVENT_C_3'), + (28070,-1599041,'Ha! The old magic fingers finally won through! Now let''s get down to-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14255,1,0,0,'brann SAY_EVENT_D_1'), + (28070,-1599042,'Alert! Security fail safes deactivated. Beginning memory purge...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13768,1,0,0,'brann SAY_EVENT_D_2_ABED'), + (28070,-1599043,'Purge? No no no no no! Where did I-- Aha, this should do the trick...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14256,1,0,0,'brann SAY_EVENT_D_3'), + (28070,-1599044,'System online. Life form pattern recognized. Welcome Branbronzan. Query?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13769,1,0,0,'brann SAY_EVENT_D_4_ABED'), + (28070,-1599045,'Query? What do you think I''m here for? Tea and biscuits? Spill the beans already!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14263,1,0,0,'brann SAY_EVENT_END_01'), + (28070,-1599046,'Tell me how that dwarfs came to be! And start at the beginning!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14264,1,0,0,'brann SAY_EVENT_END_02'), + (28070,-1599047,'Accessing prehistoric data. Retrieved. In the beginning Earthen were created to-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13770,1,0,0,'brann SAY_EVENT_END_03_ABED'), + (28070,-1599048,'Right, right! I know that the Earthen were made of stone to shape the deep reaches of the world but what about the anomalies? Matrix non-stabilizing and whatnot.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14265,1,0,0,'brann SAY_EVENT_END_04'), + (28070,-1599049,'Accessing. In the early stages of its development cycle Azeroth suffered infection by parasitic, necrophotic symbiotes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13771,1,0,0,'brann SAY_EVENT_END_05_ABED'), + (28070,-1599050,'Necro-what? Speak bloody common will ya?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14266,1,0,0,'brann SAY_EVENT_END_06'), + (28070,-1599051,'Designation: Old Gods. Old Gods rendered all systems, including Earthen defenseless in order to facilitate assimilation. This matrix destabilization has been termed the Curse of Flesh. Effects of destabilization increased over time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13772,1,0,0,'brann SAY_EVENT_END_07_ABED'), + (28070,-1599052,'Old Gods eh? So they zapped the Earthen with this Curse of Flesh. And then what?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14267,1,0,0,'brann SAY_EVENT_END_08'), + (28070,-1599053,'Accessing. Creators arrived to extirpate symbiotic infection. Assessment revealed that Old God infestation had grown malignant. Excising parasites would result in loss of host.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13757,1,0,0,'brann SAY_EVENT_END_09_KADD'), + (28070,-1599054,'If they killed the Old Gods Azeroth would have been destroyed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14268,1,0,0,'brann SAY_EVENT_END_10'), + (28070,-1599055,'Correct. Creators neutralized parasitic threat and contained it within the host. Forge of Wills and other systems were instituted to create new Earthen. Safeguards were implemented and protectors were appointed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13758,1,0,0,'brann SAY_EVENT_END_11_KADD'), + (28070,-1599056,'What protectors?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14269,1,0,0,'brann SAY_EVENT_END_12'), + (28070,-1599057,'Designations: Aesir and Vanir or in common nomenclator Storm and Earth Giants. Sentinel Loken designated supreme. Dragon Aspects appointed to monitor evolution of Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13759,1,0,0,'brann SAY_EVENT_END_13_KADD'), + (28070,-1599058,'Aesir and Vanir. Okay. So the Forge of Wills started to make new Earthen. But what happened to the old ones?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14270,1,0,0,'brann SAY_EVENT_END_14'), + (28070,-1599059,'Additional background is relevant to your query. Following global combat between-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13762,1,0,0,'brann SAY_EVENT_END_15_MARN'), + (28070,-1599060,'Hold everything! The Aesir and Vanir went to war? Why?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14271,1,0,0,'brann SAY_EVENT_END_16'), + (28070,-1599061,'Unknown. Data suggests that impetus for global combat originated with prime designate Loken who neutralized all remaining Aesir and Vanir affecting termination of conflict. Prime designate Loken then initiated stasis of several seed races including Earthen, Giant and Vrykul at designated holding facilities.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13763,1,0,0,'brann SAY_EVENT_END_17_MARN'), + (28070,-1599062,'This Loken sounds like a nasty character. Glad we don''t have to worry about the likes of him anymore. So if I''m understanding you lads the original Earthen eventually woke up from this statis. And by that time this destabily-whatever had turned them into our brother dwarfs. Or at least dwarf ancestors. Hm?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14272,1,0,0,'brann SAY_EVENT_END_18'), + (28070,-1599063,'Essentially that is correct.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13764,1,0,0,'brann SAY_EVENT_END_19_MARN'), + (28070,-1599064,'Well now. That''s a lot to digest. I''m gonna need some time to take all of this in. Thank you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14273,1,0,0,'brann SAY_EVENT_END_20'), + (28070,-1599065,'Acknowledged Branbronzan. Session terminated.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13773,1,0,0,'brann SAY_EVENT_END_21_ABED'), + (28070,-1599066,'Loken?! That''s downright bothersome... We might''ve neutralized the iron dwarves, but I''d lay odds there''s another machine somewhere else churnin'' out a whole mess o'' these iron vrykul!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14278,1,0,0,'brann SAY_VICTORY_SJONNIR_1'), + (28070,-1599067,'I''ll use the forge to make badtches o'' earthen to stand guard... But our greatest challenge still remains: find and stop Loken!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14279,1,0,0,'brann SAY_VICTORY_SJONNIR_2'), + (28070,-1599068,'I think it''s time to see what''s behind the door near the entrance. I''m going to sneak over there, nice and quiet. Meet me at the door and I''ll get us in.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'brann SAY_ENTRANCE_MEET'), + +-- -1 600 000 DRAK'THARON KEEP + (26631,-1600000,'The chill that you feel is the herald of your doom!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13173,1,0,0,'novos SAY_AGGRO'), + (26631,-1600001,'Such is the fate of all who oppose the Lich King.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13175,1,0,0,'novos SAY_KILL'), + (26631,-1600002,'Your efforts... are in vain.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13174,1,0,0,'novos SAY_DEATH'), + (26631,-1600003,'Bolster my defenses! Hurry, curse you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13176,1,0,0,'novos SAY_NECRO_ADD'), + (26631,-1600004,'Surely you can see the futility of it all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13177,1,0,0,'novos SAY_REUBBLE_1'), + (26631,-1600005,'Just give up and die already!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13178,1,0,0,'novos SAY_REUBBLE_2'), + (26630,-1600006,'More grunts, more glands, more FOOD!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13181,1,0,0,'trollgore SAY_AGGRO'), + (26630,-1600007,'You have gone, me gonna eat you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13185,1,0,0,'trollgore SAY_KILL'), + (26630,-1600008,'So hungry! Must feed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13182,1,0,0,'trollgore SAY_CONSUME'), + (26630,-1600009,'Corpse go boom!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13184,1,0,0,'trollgore SAY_EXPLODE'), + (26630,-1600010,'Aaaargh...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13183,1,0,0,'trollgore SAY_DEATH'), + (26632,-1600011,'Tharon''ja sees all! The work of mortals shall not end the eternal dynasty!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13862,1,0,0,'tharon''ja SAY_AGGRO'), + (26632,-1600012,'As Tharon''ja predicted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13863,1,0,0,'tharon''ja SAY_KILL_1'), + (26632,-1600013,'As it was written.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13864,1,0,0,'tharon''ja SAY_KILL_2'), + (26632,-1600014,'Your flesh serves Tharon''ja now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13865,1,0,0,'tharon''ja SAY_FLESH_1'), + (26632,-1600015,'Tharon''ja has a use for your mortal shell!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13866,1,0,0,'tharon''ja SAY_FLESH_2'), + (26632,-1600016,'No! A taste... all too brief!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13867,1,0,0,'tharon''ja SAY_SKELETON_1'), + (26632,-1600017,'Tharon''ja will have more!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13868,1,0,0,'tharon''ja SAY_SKELETON_2'), + (26632,-1600018,'I''m... impossible! Tharon''ja is eternal! Tharon''ja... is...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13869,1,0,0,'tharon''ja SAY_DEATH'), + +-- -1 601 000 AZJOL-NERUB + ('29120', '-1601000', 'Eternal aggony awaits you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14054', '1',0,0, ''), + ('29120', '-1601001', 'Soon, the Master\'s voice will call to you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14057', '1',0,0, ''), + ('29120', '-1601002', 'You have made your choice.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14056', '1',0,0, ''), + ('29120', '-1601003', 'You shall experience my torment, first-hand!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14055', '1',0,0, ''), + ('29120', '-1601004', 'Ahhh... RAAAAAGH! Never thought... I would be free of him...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14069', '1',0,0, ''), + ('29120', '-1601005', 'Your armor is useless againts my locusts.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14060', '1',0,0, ''), + ('29120', '-1601006', 'Uunak-hissss tik-k-k-k-k!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14067', '1',0,0, ''), + ('29120', '-1601007', 'The pestilence upon you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14068', '1',0,0, ''), + ('29120', '-1601008', 'Auum na-l ak-k-k-k, isshhh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14058', '1',0,0, ''), + ('29120', '-1601009', 'Come forth my brethren! Feast on their flesh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14059', '1',0,0, ''), + ('29120', '-1601010', 'I was king of this empire once\, long ago. In life I stood as champion. In death I returned as conqueror. Now I protect the kingdom once more. Ironic\, yes? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14053', '1',0,0, ''), + ('28684', '-1601011', 'This kingdom belongs to the Scourge! Only the dead may enter.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14075', '1',0,0, ''), + ('28684', '-1601012', 'You were foolish to come.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14077', '1',0,0, ''), + ('28684', '-1601013', 'As Anub\'Arak commands!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14078', '1',0,0, ''), + ('28684', '-1601014', 'I should be grateful. But I long ago lost the capacity.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14087', '1',0,0, ''), + ('28684', '-1601015', 'They hunger.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14085', '1',0,0, ''), + ('28684', '-1601016', 'Dinner time\, my pets.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14086', '1',0,0, ''), + ('28684', '-1601017', 'Keep an eye on the tunnel. We must not let anyone through!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14082', '1',0,0, ''), + ('28684', '-1601018', 'I hear footsteps. Be on your guard.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14083', '1',0,0, ''), + ('28684', '-1601019', 'I sense the living. Be ready.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14084', '1',0,0, ''), + ('28684', '-1601020', 'We are besieged. Strike out and bring back their corpses!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14079', '1',0,0, ''), + ('28684', '-1601021', 'We must hold the gate. Attack! Tear them limb from limb!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14080', '1',0,0, ''), + ('28684', '-1601022', 'The gate must be protected at all costs. Rip them to shreds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '14081', '1',0,0, ''), + +-- -1 602 000 HALLS OF LIGHTNING +/* Bjarngrim */ + (28586,-1602000,'I am the greatest of my father''s sons! Your end has come!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14149,1,0,0,'bjarngrim SAY_AGGRO'), + (28586,-1602001,'So ends your curse!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14153,1,0,0,'bjarngrim SAY_SLAY_1'), + (28586,-1602002,'Flesh... is... weak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14154,1,0,0,'bjarngrim SAY_SLAY_2'), + (28586,-1602003,'...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14155,1,0,0,'bjarngrim SAY_SLAY_3'), + (28586,-1602004,'How can it be...? Flesh is not... stronger!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14156,1,0,0,'bjarngrim SAY_DEATH'), + (28586,-1602005,'Defend yourself, for all the good it will do!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14151,1,0,0,'bjarngrim SAY_BATTLE_STANCE'), + (28586,-1602006,'%s switches to Battle Stance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'bjarngrim EMOTE_BATTLE_STANCE'), + (28586,-1602007,'GRAAAAAH! Behold the fury of iron and steel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14152,1,0,0,'bjarngrim SAY_BERSEKER_STANCE'), + (28586,-1602008,'%s switches to Berserker Stance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'bjarngrim EMOTE_BERSEKER_STANCE'), + (28586,-1602009,'Give me your worst!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14150,1,0,0,'bjarngrim SAY_DEFENSIVE_STANCE'), + (28586,-1602010,'%s switches to Defensive Stance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'bjarngrim EMOTE_DEFENSIVE_STANCE'), + (28546,-1602011,'You wish to confront the master? You must weather the storm!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14453,1,0,0,'ionar SAY_AGGRO'), + (28546,-1602012,'Shocking ... I know!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14456,1,0,0,'ionar SAY_SLAY_1'), + (28546,-1602013,'You atempt the unpossible.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14457,1,0,0,'ionar SAY_SLAY_2'), + (28546,-1602014,'Your spark of light is ... extinguish.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14458,1,0,0,'ionar SAY_SLAY_3'), + (28546,-1602015,'Master... you have guests.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14459,1,0,0,'ionar SAY_DEATH'), + (28546,-1602016,'The slightest spark shall be your undoing.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14454,1,0,0,'ionar SAY_SPLIT_1'), + (28546,-1602017,'No one is safe!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14455,1,0,0,'ionar SAY_SPLIT_2'), + (28923,-1602018,'What hope is there for you? None!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14162,1,0,0,'loken SAY_AGGRO0'), + (28923,-1602019,'I have witnessed the rise and fall of empires. The birth and extinction of entire species. Over countless millennia the foolishness of mortals has remained beyond a constant. Your presence here confirms this.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14160,1,0,0,'loken SAY_INTRO_1'), + (28923,-1602020,'My master has shown me the future, and you have no place in it. Azeroth will be reborn in darkness. Yogg-Saron shall be released! The Pantheon shall fall!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14162,1,0,0,'loken SAY_INTRO_2'), + (28923,-1602021,'Only mortal...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14166,1,0,0,'loken SAY_SLAY_1'), + (28923,-1602022,'I... am... FOREVER!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14167,1,0,0,'loken SAY_SLAY_2'), + (28923,-1602023,'What little time you had, you wasted!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14168,1,0,0,'loken SAY_SLAY_3'), + (28923,-1602024,'My death... heralds the end of this world.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14172,1,0,0,'loken SAY_DEATH'), + (28923,-1602025,'You cannot hide from fate!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14163,1,0,0,'loken SAY_NOVA_1'), + (28923,-1602026,'Come closer. I will make it quick.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14164,1,0,0,'loken SAY_NOVA_2'), + (28923,-1602027,'Your flesh cannot hold out for long.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14165,1,0,0,'loken SAY_NOVA_3'), + (28923,-1602028,'You stare blindly into the abyss!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14169,1,0,0,'loken SAY_75HEALTH'), + (28923,-1602029,'Your ignorance is profound. Can you not see where this path leads?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14170,1,0,0,'loken SAY_50HEALTH'), + (28923,-1602030,'You cross the precipice of oblivion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14171,1,0,0,'loken SAY_25HEALTH'), + (28923,-1602031,'%s begins to cast Lightning Nova!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'loken EMOTE_NOVA'), + (28587,-1602032,'It is you who have destroyed my children? You... shall... pay!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13960,1,0,0,'volkhan SAY_AGGRO'), + (28587,-1602033,'The armies of iron will conquer all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13965,1,0,0,'volkhan SAY_SLAY_1'), + (28587,-1602034,'Ha, pathetic!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13966,1,0,0,'volkhan SAY_SLAY_2'), + (28587,-1602035,'You have cost me too much work!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13967,1,0,0,'volkhan SAY_SLAY_3'), + (28587,-1602036,'The master was right... to be concerned.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13968,1,0,0,'volkhan SAY_DEATH'), + (28587,-1602037,'I will crush you beneath my boots!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13963,1,0,0,'volkhan SAY_STOMP_1'), + (28587,-1602038,'All my work... undone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13964,1,0,0,'volkhan SAY_STOMP_2'), + (28587,-1602039,'Life from the lifelessness... death for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13961,1,0,0,'volkhan SAY_FORGE_1'), + (28587,-1602040,'Nothing is wasted in the process. You will see....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13962,1,0,0,'volkhan SAY_FORGE_2'), + (28587,-1602041,'%s runs to his anvil!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'volkhan EMOTE_TO_ANVIL'), + (28587,-1602042,'%s prepares to shatter his Brittle Golems!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'volkhan EMOTE_SHATTER'), + +-- -1 603 000 ULDUAR +-- Algalon + (32871,-1603000,'Your actions are illogical. All possible results for this encounter have been calculated. The Pantheon will receive the Observer''s message regardless of outcome.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15386,1,0,0,'algalon SAY_AGGRO'), + (32871,-1603001,'Loss of life, unavoidable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15387,1,0,0,'algalon SAY_SLAY_1'), + (32871,-1603002,'I do what I must.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15388,1,0,0,'algalon SAY_SLAY_2'), + (32871,-1603003,'See your world through my eyes: A universe so vast as to be immeasurable - incomprehensible even to your greatest minds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15390,1,0,0,'algalon SAY_ENGADED_FOR_FIRTS_TIME'), + (32871,-1603004,'Beware!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15391,1,0,0,'algalon SAY_PHASE_2'), + (32871,-1603005,'The stars come to my aid.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15392,1,0,0,'algalon SAY_SUMMON_COLLAPSING_STAR'), + (32871,-1603006,'I have seen worlds bathed in the Makers'' flames. Their denizens fading without so much as a whimper. Entire planetary systems born and raised in the time that it takes your mortal hearts to beat once. Yet all throughout, my own heart, devoid of emotion... of empathy. I... have... felt... NOTHING! A million, million lives wasted. Had they all held within them your tenacity? Had they all loved life as you do?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15393,1,0,0,'algalon SAY_DEATH_1'), + (32871,-1603007,'Perhaps it is your imperfection that which grants you free will. That allows you to persevere against cosmically calculated odds. You prevailed where the Titans'' own perfect creations have failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15401,1,0,0,'algalon SAY_DEATH_2'), + (32871,-1603008,'I''ve rearranged the reply code. Your planet will be spared. I cannot be certain of my own calculations anymore.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15402,1,0,0,'algalon SAY_DEATH_3'), + (32871,-1603009,'I lack the strength to transmit the signal. You must hurry. Find a place of power close to the skies.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15403,1,0,0,'algalon SAY_DEATH_4'), + (32871,-1603010,'Do not worry about my fate $N. If the signal is not transmitted in time re-origination will proceed regardless. Save. Your. World.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15404,1,0,0,'algalon SAY_DEATH_5'), + (32871,-1603011,'You are... out of time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15394,1,0,0,'algalon SAY_BERSERK'), + (32871,-1603012,'Witness the fury of cosmos!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15396,1,0,0,'algalon SAY_BIGBANG_1'), + (32871,-1603013,'Behold the tools of creation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15397,1,0,0,'algalon SAY_BIGBANG_2'), + (32871,-1603014,'Analysis complete. There is partial corruption in the planet''s life-support systems as well as complete corruption in most of the planet''s defense mechanisms.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15398,1,0,0,'algalon SAY_TIMER_1'), + (32871,-1603015,'Begin uplink: Reply Code: ''Omega''. Planetary re-origination requested.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15399,1,0,0,'algalon SAY_TIMER_2'), + (32871,-1603016,'Farewell, mortals. Your bravery is admirable, for such flawed creatures.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15400,1,0,0,'algalon SAY_TIMER_3'), + (32871,-1603017,'Trans-location complete. Commencing planetary analysis of Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15405,1,0,0,'algalon SAY_SUMMON_1'), + (32871,-1603018,'Stand back, mortals. I am not here to fight you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15406,1,0,0,'algalon SAY_SUMMON_2'), + (32871,-1603019,'It is in the universe''s best interest to re-originate this planet should my analysis find systemic corruption. Do not interfere.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15407,1,0,0,'algalon SAY_SUMMON_3'), + +-- Assembly of Iron - Stellbreaker + (32867,-1603020,'You will not defeat the Assembly of Iron so easily, invaders!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15674,1,0,0,'steelbreaker SAY_AGGRO'), + (32867,-1603021,'So fragile and weak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15675,1,0,0,'steelbreaker SAY_SLAY_1'), + (32867,-1603022,'Flesh... such a hindrance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15676,1,0,0,'steelbreaker SAY_SLAY_2'), + (32867,-1603023,'You seek the secrets of Ulduar? Then take them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15677,1,0,0,'steelbreaker SAY_POWER'), + (32867,-1603024,'My death only serves to hasten your demise.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15678,1,0,0,'steelbreaker SAY_DEATH_1'), + (32867,-1603025,'Impossible!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15679,1,0,0,'steelbreaker SAY_DEATH_2'), + (32867,-1603026,'This meeting of the Assembly of Iron is adjourned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15680,1,0,0,'steelbreaker SAY_BERSERK'), + +-- Assembly of Iron - Runemaster Molgeim + (32927,-1603030,'Nothing short of total decimation will suffice.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15657,1,0,0,'Molgeim SAY_AGGRO'), + (32927,-1603031,'The world suffers yet another insignificant loss.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15658,1,0,0,'Molgeim SAY_SLAY_1'), + (32927,-1603032,'Death is the price of your arrogance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15659,1,0,0,'Molgeim SAY_SLAY_2'), + (32927,-1603033,'Decipher this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15660,1,0,0,'Molgeim SAY_RUNE_DEATH'), + (32927,-1603034,'Face the lightning surge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15661,1,0,0,'Molgeim SAY_SUMMON'), + (32927,-1603035,'The legacy of storms shall not be undone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15662,1,0,0,'Molgeim SAY_DEATH_1'), + (32927,-1603036,'What have you gained from my defeat? You are no less doomed, mortals!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15663,1,0,0,'Molgeim SAY_DEATH_2'), + (32927,-1603037,'This meeting of the Assembly of Iron is adjourned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15664,1,0,0,'Molgeim SAY_BERSERK'), + +-- Assembly of Iron - Stormcaller Brundir + (32857,-1603040,'Whether the world''s greatest gnats or the world''s greatest heroes, you''re still only mortal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15684,1,0,0,'Brundir SAY_AGGRO'), + (32857,-1603041,'A merciful kill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15685,1,0,0,'Brundir SAY_SLAY_1'), + (32857,-1603042,'HAH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15686,1,0,0,'Brundir SAY_SLAY_2'), + (32857,-1603043,'Stand still and stare into the light!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15687,1,0,0,'Brundir SAY_SPECIAL'), + (32857,-1603044,'Let the storm clouds rise and rain down death from above!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15688,1,0,0,'Brundir SAY_FLIGHT'), + (32857,-1603045,'The power of the storm lives on...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15689,1,0,0,'Brundir SAY_DEATH_1'), + (32857,-1603046,'You rush headlong into the maw of madness!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15690,1,0,0,'Brundir SAY_DEATH_2'), + (32857,-1603047,'This meeting of the Assembly of Iron is adjourned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15691,1,0,0,'Brundir SAY_BERSERK'), + +-- Auriaya + (33515,-1603050,'Some things are better left alone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15473,1,0,0,'Auriaya SAY_AGGRO'), + (33515,-1603051,'The secret dies with you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15474,1,0,0,'Auriaya SAY_SLAY_1'), + (33515,-1603052,'There is no escape!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15475,1,0,0,'Auriaya SAY_SLAY_2'), + (33515,-1603053,'Auriaya screams in agony.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,6,0,15476,'Auriaya SAY_DEATH'), + (33515,-1603054,'You waste my time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15477,1,0,0,'Auriaya SAY_BERSERK'), + +-- Flame Leviathan + (33113,-1603060,'Hostile entities detected. Threat assessment protocol active. Primary target engaged. Time minus thirty seconds to re-evaluation.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15506,1,0,0,'Flame Leviathan SAY_AGGRO'), + (33113,-1603061,'Threat assessment routine modified. Current target threat level: zero. Acquiring new target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15521,1,0,0,'Flame Leviathan SAY_SLAY'), + (33113,-1603062,'Total systems failure. Defense protocols breached. Leviathan Unit shutting down.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15520,1,0,0,'Flame Leviathan SAY_DEATH'), + (33113,-1603063,'Threat re-evaluated. Target assessment complete. Changing course.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15507,1,0,0,'Flame Leviathan SAY_TARGET_1'), + (33113,-1603064,'Pursuit objective modified. Changing course.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15508,1,0,0,'Flame Leviathan SAY_TARGET_2'), + (33113,-1603065,'Hostile entity stratagem predicted. Rerouting battle function. Changing course.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15509,1,0,0,'Flame Leviathan SAY_TARGET_3'), + (33113,-1603066,'Orbital countermeasures enabled.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15510,1,0,0,'Flame Leviathan SAY_HARDMODE'), + (33113,-1603067,'Alert! Static defense system failure. Orbital countermeasures disabled.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15511,1,0,0,'Flame Leviathan SAY_TOWER_NONE'), + (33113,-1603068,'''Hodir''s Fury'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15512,1,0,0,'Flame Leviathan SAY_TOWER_FROST'), + (33113,-1603069,'''Mimiron''s Inferno'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15513,1,0,0,'Flame Leviathan SAY_TOWER_FLAME'), + (33113,-1603070,'''Freya''s Ward'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15514,1,0,0,'Flame Leviathan SAY_TOWER_NATURE'), + (33113,-1603071,'''Thorim''s Hammer'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15515,1,0,0,'Flame Leviathan SAY_TOWER_STORM'), + (33113,-1603072,'Unauthorized entity attempting circuit overload. Activating anti-personnel countermeasures.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15516,1,0,0,'Flame Leviathan SAY_PLAYER_RIDING'), + (33113,-1603073,'System malfunction. Diverting power to support systems.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15517,1,0,0,'Flame Leviathan SAY_OVERLOAD_1'), + (33113,-1603074,'Combat matrix overload. Powering do-o-o-own...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15518,1,0,0,'Flame Leviathan SAY_OVERLOAD_2'), + (33113,-1603075,'System restart required. Deactivating weapon systems.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15519,1,0,0,'Flame Leviathan SAY_OVERLOAD_3'), + -- reserve 1603076-1603179 to implement other texts related to flame leviathan encounter + +-- Freya + (32906,-1603180,'The Conservatory must be protected!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15526,1,0,0,'Freya SAY_AGGRO'), + (32906,-1603181,'Elders, grant me your strength!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15527,1,0,0,'Freya SAY_AGGRO_WITH_ELDER'), + (32906,-1603182,'Forgive me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15529,1,0,0,'Freya SAY_SLAY_1'), + (32906,-1603183,'From your death springs life anew!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15530,1,0,0,'Freya SAY_SLAY_2'), + (32906,-1603184,'His hold on me dissipates. I can see clearly once more. Thank you, heroes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15531,1,0,0,'Freya SAY_DEATH'), + (32906,-1603185,'You have strayed too far, wasted too much time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15532,1,0,0,'Freya SAY_BERSERK'), + (32906,-1603186,'Eonar, your servant requires aid!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15528,1,0,0,'Freya SAY_SUMMON_CONSERVATOR'), + (32906,-1603187,'Children, assist me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15533,1,0,0,'Freya SAY_SUMMON_TRIO'), + (32906,-1603188,'The swarm of the elements shall overtake you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15534,1,0,0,'Freya SAY_SUMMON_LASHERS'), + (32906,-1603189,'Eonar, your servant calls for your blessing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15535,1,0,0,'Freya SAY_YS_HELP'), + +-- Elder Brightleaf + (32915,-1603190,'Matron, the Conservatory has been breached!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15483,1,0,0,'Elder Brightleaf SAY_AGGRO'), + (32915,-1603191,'Fertilizer.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15485,1,0,0,'Elder Brightleaf SAY_SLAY_1'), + (32915,-1603192,'Your corpse will nourish the soil!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15486,1,0,0,'Elder Brightleaf SAY_SLAY_2'), + (32915,-1603193,'Matron, one has fallen!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15487,1,0,0,'Elder Brightleaf SAY_DEATH'), + +-- Elder Ironbranch + (32913,-1603194,'Mortals have no place here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15493,1,0,0,'Elder Ironbranch SAY_AGGRO'), + (32913,-1603195,'I return you whence you came!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15494,1,0,0,'Elder Ironbranch SAY_SLAY_1'), + (32913,-1603196,'BEGONE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15495,1,0,0,'Elder Ironbranch SAY_SLAY_2'), + (32913,-1603197,'Freya! They come for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15496,1,0,0,'Elder Ironbranch SAY_DEATH'), + +-- Elder Stonebark + (32914,-1603198,'This place will serve as your graveyard.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15500,1,0,0,'Elder Stonebark SAY_AGGRO'), + (32914,-1603199,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15501,1,0,0,'Elder Stonebark SAY_SLAY_1'), + (32914,-1603200,'Such a waste.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15502,1,0,0,'Elder Stonebark SAY_SLAY_2'), + (32914,-1603201,'Matron, flee! They are ruthless....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15503,1,0,0,'Elder Stonebark SAY_DEATH'), + +-- Hodir + (32845,-1603210,'You will suffer for this trespass!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15552,1,0,0,'Hodir SAY_AGGRO'), + (32845,-1603211,'Tragic. To come so far, only to fail.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15553,1,0,0,'Hodir SAY_SLAY_1'), + (32845,-1603212,'Welcome to the endless winter.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15554,1,0,0,'Hodir SAY_SLAY_2'), + (32845,-1603213,'Winds of the north consume you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15555,1,0,0,'Hodir SAY_FLASH_FREEZE'), + (32845,-1603214,'Hodir roars furious.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15556,6,0,0,'Hodir SAY_STALACTITE'), + (32845,-1603215,'I... I am released from his grasp... at last.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15557,1,0,0,'Hodir SAY_DEATH'), + (32845,-1603216,'Enough! This ends now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15558,1,0,0,'Hodir SAY_BERSERK'), + (32845,-1603217,'The veil of winter will protect you, champions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15559,1,0,0,'Hodir SAY_YS_HELP'), + (32845,-1603218,'Hodir shatters the Rare Cache of Hodir!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,6,0,0,'Hodir SAY_HARD_MODE_MISSED'), + +-- Ignis + (33118,-1603220,'Insolent whelps! Your blood will temper the weapons used to reclaim this world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15564,1,0,0,'Ignis SAY_AGGRO'), + (33118,-1603221,'More scraps for the scrapheap!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15569,1,0,0,'Ignis SAY_SLAY_1'), + (33118,-1603222,'Your bones will serve as kindling!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15570,1,0,0,'Ignis SAY_SLAY_2'), + (33118,-1603223,'I. Have. Failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15572,1,0,0,'Ignis SAY_DEATH'), + (33118,-1603224,'Arise, soldiers of the Iron Crucible! The Makers'' will be done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15565,1,0,0,'Ignis SAY_SUMMON'), + (33118,-1603225,'I will burn away your impurities!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15566,1,0,0,'Ignis SAY_SLAG_POT'), + (33118,-1603226,'Let the inferno consume you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15567,1,0,0,'Ignis SAY_SCORCH_1'), + (33118,-1603227,'BURN! Burn in the makers fire!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15568,1,0,0,'Ignis SAY_SCORCH_2'), + (33118,-1603228,'Let it be finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15571,1,0,0,'Ignis SAY_BERSERK'), + +-- Kologarn + (32930,-1603230,'None shall pass!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15586,1,0,0,'Kologarn SAY_AGGRO'), + (32930,-1603231,'KOL-THARISH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15587,1,0,0,'Kologarn SAY_SLAY_1'), + (32930,-1603232,'YOU FAIL!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15588,1,0,0,'Kologarn SAY_SLAY_2'), + (32930,-1603233,'Just a scratch!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15589,1,0,0,'Kologarn SAY_LEFT_ARM_GONE'), + (32930,-1603234,'Only a flesh wound!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15590,1,0,0,'Kologarn SAY_RIGHT_ARM_GONE'), + (32930,-1603235,'OBLIVION!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15591,1,0,0,'Kologarn SAY_SHOCKWAVE'), + (32930,-1603236,'I will squeeze the life from you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15592,1,0,0,'Kologarn SAY_GRAB_PLAYER'), + (32930,-1603237,'Master, they come...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15593,1,0,0,'Kologarn SAY_DEATH'), + (32930,-1603238,'I am invincible!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15594,1,0,0,'Kologarn SAY_BERSERK'), + +-- Mimiron + (33350,-1603240,'Oh, my! I wasn''t expecting company! The workshop is such a mess! How embarrassing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15611,1,0,0,'Mimiron SAY_AGGRO'), + (33350,-1603241,'Now why would you go and do something like that? Didn''t you see the sign that said ''DO NOT PUSH THIS BUTTON!''? How will we finish testing with the self-destruct mechanism active?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15629,1,0,0,'Mimiron SAY_HARDMODE_ON'), + (33350,-1603242,'We haven''t much time, friends! You''re going to help me test out my latest and greatest creation. Now, before you change your minds, remember, that you kind of owe it to me after the mess you made with the XT-002.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15612,1,0,0,'Mimiron SAY_MKII_ACTIVATE'), + (33350,-1603243,'MEDIC!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15613,1,0,0,'Mimiron SAY_MKII_SLAY_1'), + (33350,-1603244,'I can fix that... or, maybe not! Sheesh, what a mess...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15614,1,0,0,'Mimiron SAY_MKII_SLAY_2'), + (33350,-1603245,'WONDERFUL! Positively marvelous results! Hull integrity at 98.9 percent! Barely a dent! Moving right along.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15615,1,0,0,'Mimiron SAY_MKII_DEATH'), + (33350,-1603246,'Behold the VX-001 Anti-personnel Assault Cannon! You might want to take cover.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15616,1,0,0,'Mimiron SAY_VX001_ACTIVATE'), + (33350,-1603247,'Fascinating. I think they call that a "clean kill".',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15617,1,0,0,'Mimiron SAY_VX001_SLAY_1'), + (33350,-1603248,'Note to self: Cannon highly effective against flesh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15618,1,0,0,'Mimiron SAY_VX001_SLAY_2'), + (33350,-1603249,'Thank you, friends! Your efforts have yielded some fantastic data! Now, where did I put-- oh, there it is!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15619,1,0,0,'Mimiron SAY_VX001_DEATH'), + (33350,-1603250,'Isn''t it beautiful? I call it the magnificent aerial command unit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15620,1,0,0,'Mimiron SAY_AERIAL_ACTIVATE'), + (33350,-1603251,'Outplayed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15621,1,0,0,'Mimiron SAY_AERIAL_SLAY_1'), + (33350,-1603252,'You can do better than that!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15622,1,0,0,'Mimiron SAY_AERIAL_SLAY_2'), + (33350,-1603253,'Preliminary testing phase complete. Now comes the true test!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15623,1,0,0,'Mimiron SAY_AERIAL_DEATH'), + (33350,-1603254,'Gaze upon its magnificence! Bask in its glorious, um, glory! I present you... V-07-TR-0N!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15624,1,0,0,'Mimiron SAY_V07TRON_ACTIVATE'), + (33350,-1603255,'Prognosis: Negative!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15625,1,0,0,'Mimiron SAY_V07TRON_SLAY_1'), + (33350,-1603256,'You''re not going to get up from that one, friend.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15626,1,0,0,'Mimiron SAY_V07TRON_SLAY_2'), + (33350,-1603257,'It would appear that I''ve made a slight miscalculation. I allowed my mind to be corrupted by the fiend in the prison, overriding my primary directive. All systems seem to be functional now. Clear.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15627,1,0,0,'Mimiron SAY_V07TRON_DEATH'), + (33350,-1603258,'Oh, my! It would seem that we are out of time, my friends!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15628,1,0,0,'Mimiron SAY_BERSERK'), + (33350,-1603259,'Combat matrix enhanced. Behold wonderous rapidity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15630,1,0,0,'Mimiron SAY_YS_HELP'), + +-- Razorscale encounter + (33210,-1603260,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15647,1,0,0,'Exp. Commander SAY_INTRO'), + (33210,-1603261,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15648,1,0,0,'Exp. Commander SAY_GROUND'), + +-- Thorim + (33413,-1603270,'Interlopers! You mortals who dare to interfere with my sport will pay... Wait--you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15733,1,0,0,'Thorim SAY_AGGRO_1'), + (33413,-1603271,'I remember you... In the mountains... But you... what is this? Where am--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15734,1,0,0,'Thorim SAY_AGGRO_2'), + (33413,-1603272,'Behold the power of the storms and despair!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15735,1,0,0,'Thorim SAY_SPECIAL_1'), + (33413,-1603273,'Do not hold back! Destroy them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15736,1,0,0,'Thorim SAY_SPECIAL_2'), + (33413,-1603274,'Have you begun to regret your intrusion?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15737,1,0,0,'Thorim SAY_SPECIAL_3'), + (33413,-1603275,'Impertinent whelps! You dare challenge me atop my pedestal! I will crush you myself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15738,1,0,0,'Thorim SAY_JUMPDOWN'), + (33413,-1603276,'Can''t you at least put up a fight!?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15739,1,0,0,'Thorim SAY_SLAY_1'), + (33413,-1603277,'Pathetic!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15740,1,0,0,'Thorim SAY_SLAY_2'), + (33413,-1603278,'My patience has reached its limit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15741,1,0,0,'Thorim SAY_BERSERK'), + (33413,-1603279,'Failures! Weaklings!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15742,1,0,0,'Thorim SAY_WIPE'), + (33413,-1603280,'Stay your arms! I yield!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15743,1,0,0,'Thorim SAY_DEATH'), + (33413,-1603281,'I feel as though I am awakening from a nightmare, but the shadows in this place yet linger.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15744,1,0,0,'Thorim SAY_END_NORMAL_1'), + (33413,-1603282,'Sif... was Sif here? Impossible--she died by my brother''s hand. A dark nightmare indeed....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15745,1,0,0,'Thorim SAY_END_NORMAL_2'), + (33413,-1603283,'I need time to reflect.... I will aid your cause if you should require it. I owe you at least that much. Farewell.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15746,1,0,0,'Thorim SAY_END_NORMAL_3'), + (33413,-1603284,'You! Fiend! You are not my beloved! Be gone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15747,1,0,0,'Thorim SAY_END_HARD_1'), + (33413,-1603285,'Behold the hand behind all the evil that has befallen Ulduar! Left my kingdom in ruins, corrupted my brother and slain my wife!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15748,1,0,0,'Thorim SAY_END_HARD_2'), + (33413,-1603286,'And now it falls to you, champions, to avenge us all! The task before you is great, but I will lend you my aid as I am able. You must prevail!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15749,1,0,0,'Thorim SAY_END_HARD_3'), + (33413,-1603287,'Golganneth, lend me your strengh! Grant my mortal allies the power of thunder!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15750,1,0,0,'Thorim SAY_YS_HELP'), + +-- General Vezax + (33271,-1603290,'Your destruction will herald a new age of suffering!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15542,1,0,0,'Vezax SAY_AGGRO'), + (33271,-1603291,'You thought to stand before the legions of death... and survive?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15543,1,0,0,'Vezax SAY_SLAY_1'), + (33271,-1603292,'Defiance... a flaw of mortality.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15544,1,0,0,'Vezax SAY_SLAY_2'), + (33271,-1603293,'The black blood of Yogg-Saron courses through me! I. AM. UNSTOPPABLE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15545,1,0,0,'Vezax SAY_SURGE_DARKNESS'), + (33271,-1603294,'Oh, what horrors await....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15546,1,0,0,'Vezax SAY_DEATH'), + (33271,-1603295,'Your defeat was inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15547,1,0,0,'Vezax SAY_BERSERK'), + (33271,-1603296,'Behold, now! Terror, absolute!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15548,1,0,0,'Vezax SAY_HARDMODE_ON'), + +-- XT002 + (33293,-1603300,'New toys? For me? I promise I won''t break them this time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15724,1,0,0,'XT002 SAY_AGGRO'), + (33293,-1603301,'So tired. I will rest for just a moment!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15725,1,0,0,'XT002 SAY_HEART_OPENED'), + (33293,-1603302,'I''m ready to play!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15726,1,0,0,'XT002 SAY_HEART_CLOSED'), + (33293,-1603303,'NO! NO! NO! NO! NO!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15727,1,0,0,'XT002 SAY_TYMPANIC_TANTRUM'), + (33293,-1603304,'I... I think I broke it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15728,1,0,0,'XT002 SAY_SLAY_1'), + (33293,-1603305,'I guess it doesn''t bend that way.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15729,1,0,0,'XT002 SAY_SLAY_2'), + (33293,-1603306,'I''m tired of these toys. I don''t want to play anymore!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15730,1,0,0,'XT002 SAY_BERSERK'), + (33293,-1603307,'You are bad... Toys... Very... Baaaaad!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15731,1,0,0,'XT002 SAY_DEATH'), + (33293,-1603308,'Time for a new game! My old toys will fight my new toys!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15732,1,0,0,'XT002 SAY_SUMMON'), + +-- Sara (YS) + (33134,-1603310,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15771,1,0,0,'Sara SAY_PREFIGHT_1'), + (33134,-1603311,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15772,1,0,0,'Sara SAY_PREFIGHT_2'), + (33134,-1603312,'The time to strike at the head of the beast will soon be upon us! Focus your anger and hatred on his minions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15775,1,0,0,'Sara SAY_AGGRO_1'), + (33134,-1603313,'Yes! YES! Show them no mercy! Give no pause to your attacks!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15773,1,0,0,'Sara SAY_AGGRO_2'), + (33134,-1603314,'Let hatred and rage guide your blows!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15774,1,0,0,'Sara SAY_AGGRO_3'), + (33134,-1603315,'Powerless to act...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15778,1,0,0,'Sara SAY_SLAY_1'), + (33134,-1603316,'Could they have been saved?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15779,1,0,0,'Sara SAY_SLAY_2'), + (33134,-1603317,'Weak-minded fools!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15780,5,0,0,'Sara WHISP_INSANITY'), + (33134,-1603318,'Suffocate upon your own hate!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15776,1,0,0,'Sara SAY_PHASE2_1'), + (33134,-1603319,'Tremble, mortals, before the coming of the end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15777,1,0,0,'Sara SAY_PHASE2_2'), + +-- YoggSaron + (33288,-1603330,'I am the lucid dream.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15754,1,0,0,'YoggSaron SAY_PHASE2_1'), -- sound 15754 contains the 5 texts + (33288,-1603331,'The monster in your nightmares.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_2'), + (33288,-1603332,'The fiend of a thousand faces.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_3'), + (33288,-1603333,'Cower before my true form.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_4'), + (33288,-1603334,'BOW DOWN BEFORE THE GOD OF DEATH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_5'), + (33288,-1603335,'Look upon the true face of death and know that your end comes soon!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15755,1,0,0,'YoggSaron SAY_PHASE3'), + (33288,-1603336,'MADNESS WILL CONSUME YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15756,1,0,0,'YoggSaron SAY_VISION'), + (33288,-1603337,'Hoohehehahahaha... AHAHAHAHAHAHA!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15757,1,0,0,'YoggSaron SAY_SLAY_1'), + (33288,-1603338,'Eternal suffering awaits!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15758,1,0,0,'YoggSaron SAY_SLAY_2'), + (33288,-1603339,'Your will is no longer you own...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15759,5,0,0,'YoggSaron WHISP_INSANITY_1'), + (33288,-1603340,'Destroy them minion, your master commands it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15760,5,0,0,'YoggSaron WHISP_INSANITY_2'), + (33288,-1603341,'Your fate is sealed. The end of days is finally upon you and ALL who inhabit this miserable little seedling. Uulwi ifis halahs gag erh''ongg w''ssh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15761,1,0,0,'YoggSaron SAY_DEATH'), + +-- -1 604 000 GUNDRAK +/* Moorabi */ + (29305,-1604010,'We fought back da Scourge. What chance joo be thinkin'' JOO got?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_AGGRO boss_moorabi'), + (29305,-1604012,'Who gonna stop me; you? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_SLAY_2 boss_moorabi'), + (29305,-1604013,'Not so tough now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_SLAY_3 boss_moorabi'), + (29305,-1604014,'If our gods can die... den so can we... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_DEATH boss_moorabi'), + (29305,-1604015,'Get ready for somethin''... much... BIGGAH! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_TRANSFORM boss_moorabi'), + (29305,-1604016,'Da ground gonna swallow you up',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_QUAKE boss_moorabi'), + (29305,-1604017,'%s begins to transform!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'EMOTE_TRANSFORM boss_moorabi'), + +-- -1 608 000 VIOLET HOLD +/* Cyanigosa */ + (31134,-1608000,'We finish this now, champions of Kirin Tor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13947,1,0,0,'cyanigosa SAY_AGGRO'), + (31134,-1608001,'I will end the Kirin Tor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13952,1,0,0,'cyanigosa SAY_SLAY_1'), + (31134,-1608002,'Dalaran will fall!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13953,1,0,0,'cyanigosa SAY_SLAY_2'), + (31134,-1608003,'So ends your defiance of the Spell-Weaver!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13954,1,0,0,'cyanigosa SAY_SLAY_3'), + (31134,-1608004,'Perhaps... we have... underestimated... you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13955,1,0,0,'cyanigosa SAY_DEATH'), + (31134,-1608005,'A valiant defense, but this city must be razed. I will fulfill Malygos''s wishes myself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13946,1,0,0,'cyanigosa SAY_SPAWN'), + (31134,-1608006,'Am I interrupting?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13951,1,0,0,'cyanigosa SAY_DISRUPTION'), + (31134,-1608007,'Shiver and die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13948,1,0,0,'cyanigosa SAY_BREATH_ATTACK'), + (31134,-1608008,'The world has forgotten what true magic is! Let this be a reminder!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13949,1,0,0,'cyanigosa SAY_SPECIAL_ATTACK_1'), + (31134,-1608009,'Who among you can withstand my power?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13950,1,0,0,'cyanigosa SAY_SPECIAL_ATTACK_2'), + +/* Erekem */ + (29315,-1608010,'Not--caww--get in way of--rrak-rrak--flee!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14219,1,0,0,'erekem SAY_AGGRO'), + (29315,-1608011,'Ya ya ya yaaaa',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14222,1,0,0,'erekem SAY_SLAY_1'), + (29315,-1608012,'Preeciouuss life---Ra-aak---Wasted!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14223,1,0,0,'erekem SAY_SLAY_2'), + (29315,-1608013,'Only the strong---Ra-aak---Survive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14224,1,0,0,'erekem SAY_SLAY_3'), + (29315,-1608014,'No--kaw, kaw--flee...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14225,1,0,0,'erekem SAY_DEATH'), + (29315,-1608015,'Free to--mm--fly now. Ra-aak... Not find us--ekh-ekh! Escape!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14218,1,0,0,'erekem SAY_SPAWN'), + (29315,-1608016,'My---raaak--favorite! Awk awk awk! Raa-kaa!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14220,1,0,0,'erekem SAY_ADD_KILLED'), + (29315,-1608017,'Nasty little...A-ak, kaw! Kill! Yes, kill you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14221,1,0,0,'erekem SAY_BOTH_ADDS_KILLED'), + +/* Ichoron */ + (29313,-1608018,'Stand aside, mortals!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14230,1,0,0,'ichoron SAY_AGGRO'), + (29313,-1608019,'I am a force of nature!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14234,1,0,0,'ichoron SAY_SLAY_1'), + (29313,-1608020,'I shall pass!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14235,1,0,0,'ichoron SAY_SLAY_2'), + (29313,-1608021,'You can not stop the tide!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14236,1,0,0,'ichoron SAY_SLAY_3'), + (29313,-1608022,'I... recede.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14237,1,0,0,'ichoron SAY_DEATH'), + (29313,-1608023,'I... am fury... unrestrained!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14229,1,0,0,'ichoron SAY_SPAWN'), + (29313,-1608024,'I shall consume, decimate, devastate, and destroy! Yield now to the wrath of the pounding sea!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14231,1,0,0,'ichoron SAY_ENRAGE'), + (29313,-1608025,'I will not be contained! Ngyah!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14233,1,0,0,'ichoron SAY_SHATTER'), + (29313,-1608026,'Water can hold any form, take any shape... overcome any obstacle.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14232,1,0,0,'ichoron SAY_BUBBLE'), + +/* Xevozz */ + (29266,-1608027,'It seems my freedom must be bought with blood...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14498,1,0,0,'Xevozz SAY_AGGRO'), + (29266,-1608028,'Nothing personal.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14504,1,0,0,'Xevozz SAY_SLAY_1'), + (29266,-1608029,'Business concluded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14505,1,0,0,'Xevozz SAY_SLAY_2'), + (29266,-1608030,'Profit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14506,1,0,0,'Xevozz SAY_SLAY_3'), + (29266,-1608031,'This is an... unrecoverable... loss.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14507,1,0,0,'Xevozz SAY_DEATH'), + (29266,-1608032,'Back in business! Now to execute an exit strategy.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14498,1,0,0,'Xevozz SAY_SPAWN'), + (29266,-1608033,'It would seem that a renegotiation is in order.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14503,1,0,0,'Xevozz SAY_CHARGED'), + (29266,-1608034,'The air teems with latent energy... quite the harvest!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14501,1,0,0,'Xevozz SAY_REPEAT_SUMMON_1'), + (29266,-1608035,'Plentiful, exploitable resources... primed for acquisition!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14502,1,0,0,'Xevozz SAY_REPEAT_SUMMON_2'), + (29266,-1608036,'Intriguing... a high quantity of arcane energy is near. Time for some prospecting...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14500,1,0,0,'Xevozz SAY_SUMMON_ENERGY'), + +/* Zuramat */ + (29314,-1608037,'Eradicate.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13996,1,0,0,'zuramat SAY_AGGRO'), + (29314,-1608038,'More... energy.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13999,1,0,0,'zuramat SAY_SLAY_1'), + (29314,-1608039,'Relinquish.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14000,1,0,0,'zuramat SAY_SLAY_2'), + (29314,-1608040,'Fall... to shadow.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14001,1,0,0,'zuramat SAY_SLAY_3'), + (29314,-1608041,'Disperse.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14002,1,0,0,'zuramat SAY_DEATH'), + (29314,-1608042,'I am... renewed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13995,1,0,0,'zuramat SAY_SPAWN'), + (29314,-1608043,'Know... my... pain.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13997,1,0,0,'zuramat SAY_SHIELD'), + (29314,-1608044,'Gaze... into the void.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13998,1,0,0,'zuramat SAY_WHISPER'), + +/* Sinclari */ + (30658,-1608045,'Prison guards, we are leaving! These adventurers are taking over! Go go go',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'sinclari SAY_SINCLARI_1'), + +-- -1 615 000 OBSIDIAN SANCTUM + (30451,-1615000,'I fear nothing! Least of all you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14111,1,0,0,'shadron SAY_SHADRON_AGGRO'), + (30451,-1615001,'You are insignificant!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14112,1,0,0,'shadron SAY_SHADRON_SLAY_1'), + (30451,-1615002,'Such mediocre resistance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14113,1,0,0,'shadron SAY_SHADRON_SLAY_2'), + (30451,-1615003,'We...are superior! How could this...be...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14118,1,0,0,'shadron SAY_SHADRON_DEATH'), + (30451,-1615004,'You are easily bested! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14114,1,0,0,'shadron SAY_SHADRON_BREATH'), + (30451,-1615005,'I will take pity on you Sartharion, just this once.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14117,1,0,0,'shadron SAY_SHADRON_RESPOND'), + (30451,-1615006,'Father tought me well!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14115,1,0,0,'shadron SAY_SHADRON_SPECIAL_1'), + (30451,-1615007,'On your knees!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14116,1,0,0,'shadron SAY_SHADRON_SPECIAL_2'), + (28860,-1615008,'A Shadron Disciple appears in the Twilight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,5,0,0,'shadron WHISPER_SHADRON_DICIPLE'), + (30452,-1615009,'You have no place here. Your place is among the departed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14122,1,0,0,'tenebron SAY_TENEBRON_AGGRO'), + (30452,-1615010,'No contest.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14123,1,0,0,'tenebron SAY_TENEBRON_SLAY_1'), + (30452,-1615011,'Typical... Just as I was having fun.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14124,1,0,0,'tenebron SAY_TENEBRON_SLAY_2'), + (30452,-1615012,'I should not... have held back...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14129,1,0,0,'tenebron SAY_TENEBRON_DEATH'), + (30452,-1615013,'To darkness I condemn you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14125,1,0,0,'tenebron SAY_TENEBRON_BREATH'), + (30452,-1615014,'It is amusing to watch you struggle. Very well, witness how it is done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14128,1,0,0,'tenebron SAY_TENEBRON_RESPOND'), + (30452,-1615015,'Arrogant little creatures! To challenge powers you do not yet understand...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14126,1,0,0,'tenebron SAY_TENEBRON_SPECIAL_1'), + (30452,-1615016,'I am no mere dragon! You will find I am much, much, more...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14127,1,0,0,'tenebron SAY_TENEBRON_SPECIAL_2'), + (28860,-1615017,'%s begins to hatch eggs in the twilight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,5,0,0,'tenebron WHISPER_HATCH_EGGS'), + (28860,-1615018,'It is my charge to watch over these eggs. I will see you burn before any harm comes to them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14093,1,0,0,'sartharion SAY_SARTHARION_AGGRO'), + (28860,-1615019,'This pathetic siege ends NOW!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14103,1,0,0,'sartharion SAY_SARTHARION_BERSERK'), + (28860,-1615020,'Burn, you miserable wretches!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14098,1,0,0,'sartharion SAY_SARTHARION_BREATH'), + (28860,-1615021,'Shadron! Come to me, all is at risk!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14105,1,0,0,'sartharion SARTHARION_CALL_SHADRON'), + (28860,-1615022,'Tenebron! The eggs are yours to protect as well!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14106,1,0,0,'sartharion SAY_SARTHARION_CALL_TENEBRON'), + (28860,-1615023,'Vesperon! The clutch is in danger! Assist me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14104,1,0,0,'sartharion SAY_SARTHARION_CALL_VESPERON'), + (28860,-1615024,'Such is the price... of failure...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14107,1,0,0,'sartharion SAY_SARTHARION_DEATH'), + (28860,-1615025,'Such flammable little insects....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14099,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_1'), + (28860,-1615026,'Your charred bones will litter the floor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14100,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_2'), + (28860,-1615027,'How much heat can you take?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14101,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_3'), + (28860,-1615028,'All will be reduced to ash!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14102,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_4'), + (28860,-1615029,'You will make a fine meal for the hatchlings.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14094,1,0,0,'sartharion SAY_SARTHARION_SLAY_1'), + (28860,-1615030,'You are the grave disadvantage.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14096,1,0,0,'sartharion SAY_SARTHARION_SLAY_2'), + (28860,-1615031,'This is why we call you lesser beeings.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14097,1,0,0,'sartharion SAY_SARTHARION_SLAY_3'), + (28860,-1615032,'The lava surrounding %s churns!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,5,0,0,'sartharion WHISPER_LAVA_CHURN'), + (30449,-1615033,'You pose no threat, lesser beings...give me your worst!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14133,1,0,0,'vesperon SAY_VESPERON_AGGRO'), + (30449,-1615034,'The least you could do is put up a fight...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14134,1,0,0,'vesperon SAY_VESPERON_SLAY_1'), + (30449,-1615035,'Was that the best you can do?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14135,1,0,0,'vesperon SAY_VESPERON_SLAY_2'), + (30449,-1615036,'I still have some...fight..in...me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14140,1,0,0,'vesperon SAY_VESPERON_DEATH'), + (30449,-1615037,'I will pick my teeth with your bones!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14136,1,0,0,'vesperon SAY_VESPERON_BREATH'), + (30449,-1615038,'Father was right about you, Sartharion...You are a weakling!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14139,1,0,0,'vesperon SAY_VESPERON_RESPOND'), + (30449,-1615039,'Aren''t you tricky...I have a few tricks of my own...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14137,1,0,0,'vesperon SAY_VESPERON_SPECIAL_1'), + (30449,-1615040,'Unlike, I have many talents.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14138,1,0,0,'vesperon SAY_VESPERON_SPECIAL_2'), + (28860,-1615041,'A Vesperon Disciple appears in the Twilight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,5,0,0,'shadron WHISPER_VESPERON_DICIPLE'), + (28860,-1615042,'%s begins to open a Twilight Portal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,5,0,0,'sartharion drake WHISPER_OPEN_PORTAL'), + +-- -1 619 000 AHN'KAHET: THE OLD KINGDOM + (29308,-1619021,'I will feast on your remains.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_AGGRO'), + (29308,-1619022,'I will drink no blood before it''s time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_SLAY_1'), + (29308,-1619023,'One final embrace.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_SLAY_2'), + (29308,-1619024,'Still I hunger, still I thirst.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_DEATH'), + (29308,-1619025,'So appetizing.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_FEED1'), + (29308,-1619026,'Fresh, warm blood. It has been too long.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_FEED2'), + (29308,-1619027,'Your heartbeat is music to my ears.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_VANISH1'), + (29308,-1619028,'I am nowhere. I am everywhere. I am the watcher, unseen.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'prince taldaram SAY_VANISH2'), + +-- -1 632 000 ICECROWN CITADEL: FROZEN HALLS: FORGE OF SOULS +-- Bronjham + (36497,-1632001,'Finally...a captive audience!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16595,1,0,0,'Bronjham SAY_AGGRO'), + (36497,-1632002,'Fodder for the engine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16596,1,0,0,'Bronjham SAY_SLAY_1'), + (36497,-1632003,'Another soul to strengthen the host!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16597,1,0,0,'Bronjham SAY_SLAY_2'), + (36497,-1632004,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16598,1,0,0,'Bronjham SAY_DEATH'), + (36497,-1632005,'The vortex of the harvested calls to you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16599,1,0,0,'Bronjham SAY_SOUL_STORM'), + (36497,-1632006,'I will sever the soul from your body!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16600,1,0,0,'Bronjham SAY_CORRUPT_SOUL'), + +-- Devourer of Souls + (36502,-1632010,'You dare look upon the host of souls? I SHALL DEVOUR YOU WHOLE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16884,1,0,0,'Devoureur SAY_FACE_ANGER_AGGRO'), + (36502,-1632011,'You dare look upon the host of souls? I SHALL DEVOUR YOU WHOLE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16890,1,0,0,'Devoureur SAY_FACE_DESIRE_AGGRO'), + (36502,-1632012,'Damnation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16885,1,0,0,'Devoureur SAY_FACE_ANGER_SLAY_1'), + (36502,-1632013,'Damnation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16896,1,0,0,'Devoureur SAY_FACE_SORROW_SLAY_1'), + (36502,-1632014,'Damnation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16891,1,0,0,'Devoureur SAY_FACE_DESIRE_SLAY_1'), + (36502,-1632015,'Doomed for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16886,1,0,0,'Devoureur SAY_FACE_ANGER_SLAY_2'), + (36502,-1632016,'Doomed for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16897,1,0,0,'Devoureur SAY_FACE_SORROW_SLAY_2'), + (36502,-1632017,'Doomed for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16892,1,0,0,'Devoureur SAY_FACE_DESIRE_SLAY_2'), + (36502,-1632018,'The swell of souls will not be abated! You only delay the inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16887,1,0,0,'Devoureur SAY_FACE_ANGER_DEATH'), + (36502,-1632019,'The swell of souls will not be abated! You only delay the inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16898,1,0,0,'Devoureur SAY_FACE_SORROW_DEATH'), + (36502,-1632020,'The swell of souls will not be abated! You only delay the inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16893,1,0,0,'Devoureur SAY_FACE_DESIRE_DEATH'), + (36502,-1632021,'Devourer of Souls begins to cast Mirrored Soul!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Devoureur EMOTE_MIRRORED_SOUL'), + (36502,-1632022,'Devourer of Souls begins to Unleash Souls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Devoureur EMOTE_UNLEASH_SOUL'), + (36502,-1632023,'SUFFERING! ANGUISH! CHAOS! RISE AND FEED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16888,1,0,0,'Devoureur SAY_FACE_ANGER_UNLEASH_SOUL'), + (36502,-1632024,'SUFFERING! ANGUISH! CHAOS! RISE AND FEED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16899,1,0,0,'Devoureur SAY_FACE_SORROW_UNLEASH_SOUL'), + (36502,-1632025,'SUFFERING! ANGUISH! CHAOS! RISE AND FEED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16894,1,0,0,'Devoureur SAY_FACE_DESIRE_UNLEASH_SOUL'), + (36502,-1632026,'Devourer of Souls begins to cast Wailing Souls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Devoureur EMOTE_WAILING_SOUL'), + (36502,-1632027,'Stare into the abyss, and see your end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16889,1,0,0,'Devoureur SAY_FACE_ANGER_WAILING_SOUL'), + (36502,-1632028,'Stare into the abyss, and see your end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16895,1,0,0,'Devoureur SAY_FACE_DESIRE_WAILING_SOUL'), + (38160,-1632029,'Excellent work, champions! We shall set up our base camp in these chambers. My mages will get the Scourge transport device working shortly. Step inside it when you''re ready for your next mission. I will meet you on the other side.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16625,1,0,0,'Jaina SAY_JAINA_OUTRO'), + (38161,-1632030,'Excellent work, champions! We shall set up our base camp in these chambers. My mages will get the Scourge transport device working shortly. Step inside when you are ready for your next mission. I will meet you on the other side.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17044,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO'), + +-- Jaina + (37597,-1632040,'Thank the light for seeing you here safely. We have much work to do if we are to defeat the Lich King and put an end to the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16617,0,0,0,'Jaina SAY_INTRO_1'), + (37597,-1632041,'Our allies within the Argent Crusade and the Knights of the Ebon Blade have broken through the front gate of Icecrown and are attempting to establish a foothold within the Citadel.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16618,0,0,0,'Jaina SAY_INTRO_2'), + (37597,-1632042,'Their success hinges upon what we discover in these cursed halls. Although our mission is a wrought with peril, we must persevere!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16619,0,0,0,'Jaina SAY_INTRO_3'), + (37597,-1632043,'With the attention of the Lich King drawn toward the front gate, we will be working our way through the side in search of information that will enable us to defeat the Scourge - once and for all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16620,0,0,0,'Jaina SAY_INTRO_4'), + (37597,-1632044,'King Varian''s SI7 agents have gathered information about a private sanctum of the Lich King''s deep within a place called the Halls of Reflection.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16621,0,0,0,'Jaina SAY_INTRO_5'), + (37597,-1632045,'We will carve a path through this wretched place and find a way to enter the Halls of Reflection. I sense powerful magic hidden away within those walls... Magic that could be the key to destroy the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16622,0,0,0,'Jaina SAY_INTRO_6'), + (37597,-1632046,'Your first mission is to destroy the machines of death within this malevolent engine of souls, and clear a path for our soldiers.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16623,0,0,0,'Jaina SAY_INTRO_7'), + (37597,-1632047,'Make haste, champions! I will prepare the troops to fall in behind you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16624,0,0,0,'Jaina SAY_INTRO_8'), + +-- Sylvanas + (37596,-1632050,'The Argent Crusade and the Knights of the Ebon Blade have assaulted the gates of Icecrown Citadel and are preparing for a massive attack upon the Scourge. Our missition is a bit more subtle, but equally as important.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17038,0,0,0,'Sylvanas SAY_INTRO_1'), + (37596,-1632051,'With the attention of the Lich King turned towards the front gate, we''ll be working our way through the side in search of information that will enable us to defeat the Lich King - once and for all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17039,0,0,0,'Sylvanas SAY_INTRO_2'), + (37596,-1632052,'Our scouts have reported that the Lich King has a private chamber, outside of the Frozen Throne, deep within a place called the Halls of Reflection. That is our target, champions.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17040,0,0,0,'Sylvanas SAY_INTRO_3'), + (37596,-1632053,'We will cut a swath of destruction through this cursed place and find a way to enter the Halls of Reflection. If there is anything of value to be found here, it will be found in the Halls.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17041,0,0,0,'Sylvanas SAY_INTRO_4'), + (37596,-1632054,'Your first mission is to destroy the machines of death within this wretched engine of souls, and clear a path for our soldiers.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17042,0,0,0,'Sylvanas SAY_INTRO_5'), + (37596,-1632055,'The Dark Lady watches over you. Make haste!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17043,0,0,0,'Sylvanas SAY_INTRO_6'), + +-- -1 658 000 ICECROWN CITADEL: FROZEN HALLS: PIT OF SARON +-- Garfrost + (36494,-1658001,'Tiny creatures under feet, you bring Garfrost something good to eat!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16912,1,0,0,'garfrost SAY_AGGRO'), + (36494,-1658002,'Will save for snack. For later.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16913,1,0,0,'garfrost SAY_SLAY_1'), + (36494,-1658003,'That one maybe not so good to eat now. Stupid Garfrost! BAD! BAD!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16914,1,0,0,'garfrost SAY_SLAY_2'), + (36494,-1658004,'Garfrost hope giant underpants clean. Save boss great shame. For later.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16915,1,0,0,'garfrost SAY_DEATH'), + (36494,-1658005,'Axe too weak. Garfrost make better and CRUSH YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16916,1,0,0,'garfrost SAY_PHASE2'), + (36494,-1658006,'Garfrost tired of puny mortals. Now your bones will freeze!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16917,1,0,0,'garfrost SAY_PHASE3'), + (36658,-1658007,'Another shall take his place. You waste your time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16752,1,0,0,'Tyrannus SAY_TYRANNUS_DEATH'), + +-- Krick + (36477,-1658010,'Our work must not be interrupted! Ick! Take care of them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16926,1,0,0,'Krick SAY_AGGRO'), + (36477,-1658011,'Ooh...We could probably use these parts!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16927,1,0,0,'Krick SAY_SLAY_1'), + (36477,-1658012,'Arms and legs are in short supply...Thanks for your contribution!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16928,1,0,0,'Krick SAY_SLAY_2'), + (36477,-1658013,'Enough moving around! Hold still while I blow them all up!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16929,1,0,0,'Krick SAY_BARRAGE_1'), + (36477,-1658014,'Krick begins rapidly conjuring explosive mines!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Krick SAY_BARRAGE_2'), + (36477,-1658015,'Quickly! Poison them all while they''re still close!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16930,1,0,0,'Krick SAY_POISON_NOVA'), + (36477,-1658016,'No! That one! That one! Get that one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16931,1,0,0,'Krick SAY_CHASE_1'), + (36477,-1658017,'I''ve changed my mind...go get that one instead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16932,1,0,0,'Krick SAY_CHASE_2'), + (36477,-1658018,'What are you attacking him for? The dangerous one is over there,fool!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16933,1,0,0,'Krick SAY_CHASE_3'), + +-- Ick + (36476,-1658020,'Ick begins to unleash a toxic poison cloud!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Ick SAY_ICK_POISON_NOVA'), + (36476,-1658021,'Ick is chasing you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Ick SAY_ICK_CHASE_1'), + +-- Krick OUTRO + (36477,-1658030,'Wait! Stop! Don''t kill me, please! I''ll tell you everything!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16934,1,0,0,'Krick SAY_KRICK_OUTRO_1'), + (36993,-1658031,'I''m not so naive as to believe your appeal for clemency, but I will listen.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16611,1,0,0,'Jaina SAY_JAINA_OUTRO_2'), + (36990,-1658032,'Why should the Banshee Queen spare your miserable life?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17033,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_2'), + (36477,-1658033,'What you seek is in the master''s lair, but you must destroy Tyrannus to gain entry. Within the Halls of Reflection you will find Frostmourne. It... it holds the truth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16935,1,0,0,'Krick SAY_KRICK_OUTRO_3'), + (36993,-1658034,'Frostmourne lies unguarded? Impossible!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16612,1,0,0,'Jaina SAY_JAINA_OUTRO_4'), + (36990,-1658035,'Frostmourne? The Lich King is never without his blade! If you are lying to me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17034,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_4'), + (36477,-1658036,'I swear it is true! Please, don''t kill me!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16936,1,0,0,'Krick SAY_KRICK_OUTRO_5'), + (36658,-1658037,'Worthless gnat! Death is all that awaits you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16753,1,0,0,'Tyrannus SAY_TYRANNUS_OUTRO_7'), + (36477,-1658038,'Urg... no!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16937,1,0,0,'Krick SAY_KRICK_OUTRO_8'), + (36658,-1658039,'Do not think that I shall permit you entry into my master''s sanctum so easily. Pursue me if you dare.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16754,1,0,0,'Tyrannus SAY_TYRANNUS_OUTRO_9'), + (36993,-1658040,'What a cruel end. Come, heroes. We must see if the gnome''s story is true. If we can separate Arthas from Frostmourne, we might have a chance at stopping him.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16613,1,0,0,'Jaina SAY_JAINA_OUTRO_10'), + (36990,-1658041,'A fitting end for a traitor. Come, we must free the slaves and see what is within the Lich King''s chamber for ourselves.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17035,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_10'), + +-- Tyrannus + (36658,-1658050,'Your pursuit shall be in vain, adventurers, for the Lich King has placed an army of undead at my command! Behold!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16755,1,0,0,'Tyrannus SAY_AMBUSH_1'), + (36658,-1658051,'Persistent whelps! You will not reach the entrance of my lord''s lair! Soldiers, destroy them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16756,1,0,0,'Tyrannus SAY_AMBUSH_2'), + (36658,-1658052,'Rimefang! Trap them within the tunnel! Bury them alive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16757,1,0,0,'Tyrannus SAY_GAUNTLET_START'), + (36658,-1658053,'Alas, brave, brave adventurers, your meddling has reached its end. Do you hear the clatter of bone and steel coming up the tunnel behind you? That is the sound of your impending demise.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16758,1,0,0,'Tyrannus SAY_INTRO_1'), + (36658,-1658054,'Ha, such an amusing gesture from the rabble. When I have finished with you, my master''s blade will feast upon your souls. Die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16759,1,0,0,'Tyrannus SAY_INTRO_2'), + (36658,-1658055,'I shall not fail The Lich King! Come and meet your end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16760,1,0,0,'Tyrannus SAY_AGGRO'), + (36658,-1658056,'Such a shameful display... You are better off dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16761,1,0,0,'Tyrannus SAY_SLAY_1'), + (36658,-1658057,'Perhaps you should have stayed in the mountains!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16762,1,0,0,'Tyrannus SAY_SLAY_2'), + (36658,-1658058,'Impossible! Rimefang... Warn...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16763,1,0,0,'Tyrannus SAY_DEATH'), + (36658,-1658059,'Rimefang, destroy this fool!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16764,1,0,0,'Tyrannus SAY_MARK_RIMEFANG_1'), + (36658,-1658060,'The frostwyrm Rimefang gazes at $N and readies an icy attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Tyrannus SAY_MARK_RIMEFANG_2'), + (36658,-1658061,'Power... overwhelming!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16765,1,0,0,'Tyrannus SAY_DARK_MIGHT_1'), + (36658,-1658062,'Scourgelord Tyrannus roars and swells with dark might!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Tyrannus SAY_DARK_MIGHT_2'), + (37592,-1658063,'Brave champions, we owe you our lives, our freedom... Though it be a tiny gesture in the face of this enormous debt, I pledge that from this day forth, all will know of your deeds, and the blazing path of light you cut through the shadow of this dark citadel.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Gorkun SAY_GORKUN_OUTRO_1'), + (37592,-1658064,'This day will stand as a testament not only to your valor, but to the fact that no foe, not even the Lich King himself, can stand when Alliance and Horde set aside their differences and ---',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Gorkun SAY_GORKUN_OUTRO_2'), + (36993,-1658065,'Heroes, to me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16614,1,0,0,'Jaina SAY_JAYNA_OUTRO_3'), + (36990,-1658066,'Take cover behind me! Quickly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17037,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_3'), + (36993,-1658067,'The Frost Queen is gone. We must keep moving - our objective is near.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16615,0,0,0,'Jaina SAY_JAYNA_OUTRO_4'), + (36990,-1658068,'I thought he''d never shut up. At last, Sindragosa silenced that long-winded fool. To the Halls of Reflection, champions! Our objective is near... I can sense it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17036,0,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_4'), + (36993,-1658069,'I... I could not save them... Damn you, Arthas! DAMN YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16616,0,0,0,'Jaina SAY_JAYNA_OUTRO_5'), + +-- -1 658 000 ICECROWN CITADEL: FROZEN HALLS: HALLS OF REFLECTION +-- INTRO + (37221,-1668001,'The chill of this place... Brr... I can feel my blood freezing.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16631,1,0,0,'Jaina SAY_JAINA_INTRO_1'), + (37221,-1668002,'What is that? Up ahead! Could it be... ? Heroes at my side!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16632,1,0,0,'Jaina SAY_JAINA_INTRO_2'), + (37221,-1668003,'Frostmourne! The blade that destroyed our kingdom...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16633,1,0,0,'Jaina SAY_JAINA_INTRO_3'), + (37221,-1668004,'Stand back! Touch that blade and your soul will be scarred for all eternity! I must attempt to commune with the spirits locked away within Frostmourne. Give me space, back up please!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16634,1,0,0,'Jaina SAY_JAINA_INTRO_4'), + (37225,-1668005,'Jaina! Could it truly be you?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16666,1,0,0,'Uther SAY_UTHER_INTRO_A2_1'), + (37221,-1668006,'Uther! Dear Uther! ... I... I''m so sorry.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16635,0,0,0,'Jaina SAY_JAINA_INTRO_5'), + (37225,-1668007,'Jaina you haven''t much time. The Lich King sees what the sword sees. He will be here shortly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16667,0,0,0,'Uther SAY_UTHER_INTRO_A2_2'), + (37221,-1668008,'Arthas is here? Maybe I...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16636,0,0,0,'Jaina SAY_JAINA_INTRO_6'), + (37225,-1668009,'No, girl. Arthas is not here. Arthas is merely a presence within the Lich King''s mind. A dwindling presence...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16668,0,0,0,'Uther SAY_UTHER_INTRO_A2_3'), + (37221,-1668010,'But Uther, if there''s any hope of reaching Arthas. I... I must try.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16637,0,0,0,'Jaina SAY_JAINA_INTRO_7'), + (37225,-1668011,'Jaina, listen to me. You must destroy the Lich King. You cannot reason with him. He will kill you and your allies and raise you all as powerful soldiers of the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16669,0,0,0,'Uther SAY_UTHER_INTRO_A2_4'), + (37221,-1668012,'Tell me how, Uther? How do I destroy my prince? My...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16638,0,0,0,'Jaina SAY_JAINA_INTRO_8'), + (37225,-1668013,'Snap out of it, girl. You must destroy the Lich King at the place where he merged with Ner''zhul - atop the spire, at the Frozen Throne. It is the only way.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16670,0,0,0,'Uther SAY_UTHER_INTRO_A2_5'), + (37221,-1668014,'You''re right, Uther. Forgive me. I... I don''t know what got a hold of me. We will deliver this information to the King and the knights that battle the Scourge within Icecrown Citadel.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16639,0,0,0,'Jaina SAY_JAINA_INTRO_9'), + (37225,-1668015,'There is... something else that you should know about the Lich King. Control over the Scourge must never be lost. Even if you were to strike down the Lich King, another would have to take his place. For without the control of its master, the Scourge would run rampant across the world - destroying all living things.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16671,0,0,0,'Uther SAY_UTHER_INTRO_A2_6'), + (37225,-1668016,'A grand sacrifice by a noble soul...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16672,0,0,0,'Uther SAY_UTHER_INTRO_A2_7'), + (37221,-1668017,'Who could bear such a burden?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16640,0,0,0,'Jaina SAY_JAINA_INTRO_10'), + (37225,-1668018,'I do not know, Jaina. I suspect that the piece of Arthas that might be left inside the Lich King is all that holds the Scourge from annihilating Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16673,0,0,0,'Uther SAY_UTHER_INTRO_A2_8'), + (37221,-1668019,'Then maybe there is still hope...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16641,0,0,0,'Jaina SAY_JAINA_INTRO_11'), + (37225,-1668020,'No, Jaina! Aargh! He... He is coming! You... You must...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16674,0,0,0,'Uther SAY_UTHER_INTRO_A2_9'), + (37223,-1668021,'I... I don''t believe it! Frostmourne stands before us, unguarded! Just as the Gnome claimed. Come, heroes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17049,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_1'), + (37223,-1668022,'Standing this close to the blade that ended my life... The pain... It is renewed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17050,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_2'), + (37223,-1668023,'I dare not touch it. Stand back! Stand back as I attempt to commune with the blade! Perhaps our salvation lies within...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17051,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_3'), + (37225,-1668024,'Careful, girl. I''ve heard talk of that cursed blade saving us before. Look around you and see what has been born of Frostmourne.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16659,0,0,0,'Uther SAY_UTHER_INTRO_H2_1'), + (37223,-1668025,'Uther...Uther the Lightbringer. How...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17052,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_4'), + (37225,-1668026,'You haven''t much time. The Lich King sees what the sword sees. He will be here shortly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16660,0,0,0,'Uther SAY_UTHER_INTRO_H2_2'), + (37223,-1668027,'The Lich King is here? Then my destiny shall be fulfilled today!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17053,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_5'), + (37225,-1668028,'You cannot defeat the Lich King. Not here. You would be a fool to try. He will kill those who follow you and raise them as powerful servants of the Scourge. But for you, Sylvanas, his reward for you would be worse than the last.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16661,0,0,0,'Uther SAY_UTHER_INTRO_H2_3'), + (37223,-1668029,'There must be a way... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17054,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_6'), + (37225,-1668030,'Perhaps, but know this: there must always be a Lich King. Even if you were to strike down Arthas, another would have to take his place, for without the control of the Lich King, the Scourge would wash over this world like locusts, destroying all that they touched.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16662,0,0,0,'Uther SAY_UTHER_INTRO_H2_4'), + (37223,-1668031,'Who could bear such a burden?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17055,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_7'), + (37225,-1668032,'I do not know, Banshee Queen. I suspect that the piece of Arthas that might be left inside the Lich King is all that holds the Scourge from annihilating Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16663,0,0,0,'Uther SAY_UTHER_INTRO_H2_5'), + (37225,-1668033,'Alas, the only way to defeat the Lich King is to destroy him at the place he was created.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16664,0,0,0,'Uther SAY_UTHER_INTRO_H2_6'), + (37223,-1668034,'The Frozen Throne...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17056,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_8'), + (37225,-1668035,'I... Aargh... He... He is coming... You... You must...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16665,0,0,0,'Uther SAY_UTHER_INTRO_H2_7'), + (37226,-1668036,'SILENCE, PALADIN!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17225,1,0,0,'Lich King SAY_LK_INTRO_1'), + (37226,-1668037,'So you wish to commune with the dead? You shall have your wish.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17226,1,0,0,'Lich King SAY_LK_INTRO_2'), + (37226,-1668038,'Falric. Marwyn. Bring their corpses to my chamber when you are through.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17227,1,0,0,'Lich King SAY_LK_INTRO_3'), + (38112,-1668039,'As you wish, my lord.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16717,1,0,0,'Falric SAY_FALRIC_INTRO_1'), + (38113,-1668040,'As you wish, my lord.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16741,1,0,0,'Marwyn SAY_MARWYN_INTRO_1'), + (38112,-1668041,'Soldiers of Lordaeron, rise to meet your master''s call!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16714,1,0,0,'Falric SAY_FALRIC_INTRO_2'), + (37221,-1668042,'You won''t deny me this Arthas! I must know! I must find out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16642,1,0,0,'Jaina SAY_JAINA_INTRO_END'), + (37223,-1668043,'You will not escape me that easily, Arthas! I will have my vengeance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17057,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_END'), +-- Falric + (38112,-1668050,'Men, women and children... None were spared the master''s wrath. Your death will be no different.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16710,1,0,0,'Falric SAY_AGGRO'), + (38112,-1668051,'Sniveling maggot!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16711,1,0,0,'Falric SAY_SLAY_1'), + (38112,-1668052,'The children of Stratholme fought with more ferocity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16712,1,0,0,'Falric SAY_SLAY_2'), + (38112,-1668053,'Marwyn, finish them...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16713,1,0,0,'Falric SAY_DEATH'), + (38112,-1668054,'Despair... so delicious...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16715,1,0,0,'Falric SAY_IMPENDING_DESPAIR'), + (38112,-1668055,'Fear... so exhilarating...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16716,1,0,0,'Falric SAY_DEFILING_HORROR'), +-- Marwyn + (38113,-1668060,'Death is all that you will find here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16734,1,0,0,'Marwyn SAY_AGGRO'), + (38113,-1668061,'I saw the same look in his eyes when he died. Terenas could hardly believe it. Hahahaha!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16735,1,0,0,'Marwyn SAY_SLAY_1'), + (38113,-1668062,'Choke on your suffering!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16736,1,0,0,'Marwyn SAY_SLAY_2'), + (38113,-1668063,'Yes... Run... Run to meet your destiny... Its bitter, cold embrace, awaits you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16737,1,0,0,'Marwyn SAY_DEATH'), + (38113,-1668064,'Your flesh has decayed before your very eyes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16739,1,0,0,'Marwyn SAY_CORRUPTED_FLESH_1'), + (38113,-1668065,'Waste away into nothingness!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16740,1,0,0,'Marwyn SAY_CORRUPTED_FLESH_2'), + +-- -1 999 900+ - RANDOM + (0,-1999900,'Let the games begin.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8280,1,0,0,'example_creature SAY_AGGRO'), + (0,-1999901,'I see endless suffering. I see torment. I see rage. I see everything.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8831,1,0,0,'example_creature SAY_RANDOM_0'), + (0,-1999902,'Muahahahaha',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8818,1,0,0,'example_creature SAY_RANDOM_1'), + (0,-1999903,'These mortal infedels my lord, they have invaded your sanctum and seek to steal your secrets.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8041,1,0,0,'example_creature SAY_RANDOM_2'), + (0,-1999904,'You are already dead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8581,1,0,0,'example_creature SAY_RANDOM_3'), + (0,-1999905,'Where to go? What to do? So many choices that all end in pain, end in death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8791,1,0,0,'example_creature SAY_RANDOM_4'), + (0,-1999906,'$N, I sentance you to death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,8588,1,0,0,'example_creature SAY_BESERK'), + (0,-1999907,'The suffering has just begun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'example_creature SAY_PHASE'), + (0,-1999908,'I always thought I was a good dancer.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_creature SAY_DANCE'), + (0,-1999909,'Move out Soldier!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_creature SAY_SALUTE'), + (0,-1999910,'Help $N! I''m under attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_AGGRO1'), + (0,-1999911,'Die scum!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_AGGRO2'), + (0,-1999912,'Hmm a nice day for a walk alright',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_WP_1'), + (0,-1999913,'Wild Felboar attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_WP_2'), + (0,-1999914,'Time for me to go! See ya around $N!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,3,'example_escort SAY_WP_3'), + (0,-1999915,'Bye Bye!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,3,'example_escort SAY_WP_4'), + (0,-1999916,'How dare you leave me like that! I hate you! =*(',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'example_escort SAY_DEATH_1'), + (0,-1999917,'...no...how could you let me die $N',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_DEATH_2'), + (0,-1999918,'ugh...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_DEATH_3'), + (0,-1999919,'Taste death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_SPELL'), + (0,-1999920,'Fireworks!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_RAND_1'), + (0,-1999921,'Hmm, I think I could use a buff.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_escort SAY_RAND_2'), + (0,-1999922,'Normal select, guess you''re not interested.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_gossip_codebox SAY_NOT_INTERESTED'), + (0,-1999923,'Wrong!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_gossip_codebox SAY_WRONG'), + (0,-1999924,'You''re right, you are allowed to see my inner secrets.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_gossip_codebox SAY_CORRECT'), + (0,-1999925,'Hi!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'example_areatrigger SAY_HI'), + +-- -1 609 000 - THE SCARLET ENCLAVE + (29519,-1609000,'You have made a grave error, fiend!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_1'), + (29519,-1609001,'I was a soldier of the Light once... Look at what I have become... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_2'), + (29519,-1609002,'You are hopelessly outmatched\, $R.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_3'), + (29519,-1609003,'They brand me unworthy? I will show them unmorthy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_4'), + (29519,-1609004,'You will allow me a weapon and armor, yes?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_5'), + (29519,-1609005,'I will win my freedom and leave this cursed place!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_6'), + (29519,-1609006,'I will dismantle this festering hellhole!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_7'), + (29519,-1609007,'There can be only one survivor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_START_8'), + (29519,-1609008,'To battle!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_1'), + (29519,-1609009,'Let your fears consume you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_2'), + (29519,-1609010,'HAH! You can barely hold a blade! Yours will be a quick death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_3'), + (29519,-1609011,'And now you die',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_4'), + (29519,-1609012,'To battle!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_5'), + (29519,-1609013,'There is no hope for our future...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_6'), + (29519,-1609014,'Sate your hunger on cold steel\, $R',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_7'), + (29519,-1609015,'It ends here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_8'), + (29519,-1609016,'Death is the only cure!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'unworthy_initiate SAY_EVENT_ATTACK_9'), + (29032,-1609025,'Come to finish the job, have you?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_START_1'), + (29032,-1609026,'Come to finish the job, have ye?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_START_2'), + (29032,-1609027,'Come ta finish da job, mon?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_START_3'), + (29032,-1609028,'You''ll look me in the eyes when...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'special_surprise SAY_EXEC_PROG_1'), + (29032,-1609029,'Well this son o'' Ironforge would like...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'special_surprise SAY_EXEC_PROG_2'), + (29032,-1609030,'Ironic, isn''t it? To be killed...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'special_surprise SAY_EXEC_PROG_3'), + (29032,-1609031,'If you''d allow me just one...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'special_surprise SAY_EXEC_PROG_4'), + (29032,-1609032,'I''d like to stand for...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'special_surprise SAY_EXEC_PROG_5'), + (29032,-1609033,'I want to die like an orc...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'special_surprise SAY_EXEC_PROG_6'), + (29032,-1609034,'Dis troll gonna stand for da...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,25,'special_surprise SAY_EXEC_PROG_7'), + (29032,-1609035,'$N?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NAME_1'), + (29032,-1609036,'$N? Mon?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NAME_2'), + (29032,-1609037,'$N, I''d recognize that face anywhere... What... What have they done to you, $N?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_RECOG_1'), + (29032,-1609038,'$N, I''d recognize those face tentacles anywhere... What... What have they done to you, $N?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_RECOG_2'), + (29032,-1609039,'$N, I''d recognize that face anywhere... What... What have they done to ye, $Glad:lass;?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_RECOG_3'), + (29032,-1609040,'$N, I''d recognize that decay anywhere... What... What have they done to you, $N?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_RECOG_4'), + (29032,-1609041,'$N, I''d recognize those horns anywhere... What have they done to you, $N?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_RECOG_5'), + (29032,-1609042,'$N, I''d recognize dem tusks anywhere... What... What have dey done ta you, mon?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_RECOG_6'), + (29032,-1609043,'You don''t remember me, do you? Blasted Scourge... They''ve tried to drain you of everything that made you a righteous force of reckoning. Every last ounce of good... Everything that made you a draenei!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_1'), + (29032,-1609044,'Ye don''t remember me, do ye? Blasted Scourge... They''ve tried to drain ye o'' everything that made ye a righteous force o'' reckoning. Every last ounce o'' good... Everything that made you a $Gson:daughter; of Ironforge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_2'), + (29032,-1609045,'You don''t remember me, do you? We were humans once - long, long ago - until Lordaeron fell to the Scourge. Your transformation to a Scourge zombie came shortly after my own. Not long after that, our minds were freed by the Dark Lady.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_3'), + (29032,-1609046,'You don''t remember me, do you? Blasted Scourge... They''ve tried to drain you of everything that made you a pint-sized force of reckoning. Every last ounce of good... Everything that made you a gnome!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_4'), + (29032,-1609047,'You don''t remember me, do you? Blasted Scourge...They''ve tried to drain of everything that made you a righteous force of reckoning. Every last ounce of good...Everything that made you a human!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_5'), + (29032,-1609048,'You don''t remember me? When you were a child your mother would leave you in my care while she served at the Temple of the Moon. I held you in my arms and fed you with honey and sheep''s milk to calm you until she would return. You were my little angel. Blasted Scourge... What have they done to you, $N?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_6'), + (29032,-1609049,'You don''t recognize me, do you? Blasted Scourge... They''ve tried to drain you of everything that made you a righteous force of reckoning. Every last ounce of good... Everything that made you an orc!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_7'), + (29032,-1609050,'You don''t remember me, do you? Blasted Scourge... They''ve tried to drain you of everything that made you a righteous force of reckoning. Every last ounce of good... Everything that made you a tauren!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_8'), + (29032,-1609051,'You don''t remember me, mon? Damn da Scourge! Dey gone ta drain you of everytin dat made ya a mojo masta. Every last ounce of good... Everytin'' dat made ya a troll hero, mon!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_NOREM_9'), + (29032,-1609052,'A pact was made, $Gbrother:sister;! We vowed vengeance against the Lich King! For what he had done to us! We battled the Scourge as Forsaken, pushing them back into the plaguelands and freeing Tirisfal! You and I were champions of the Forsaken!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_THINK_1'), + (29032,-1609053,'You must remember the splendor of life, $Gbrother:sister;. You were a champion of the Kaldorei once! This isn''t you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_THINK_2'), + (29032,-1609054,'Think, $N. Think back. Try and remember the majestic halls of Silvermoon City, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the sin''dorei once! This isn''t you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_3'), + (29032,-1609055,'Think, $N. Think back. Try and remember the proud mountains of Argus, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the draenei once! This isn''t you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_4'), + (29032,-1609056,'Think, $N. Think back. Try and remember the snow capped mountains o'' Dun Morogh! Ye were born there, $Glad:lass;. Remember the splendor o'' life, $N! Ye were a champion o'' the dwarves once! This isn''t ye!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_5'), + (29032,-1609057,'Think, $N. Think back. Try and remember Gnomeregan before those damned troggs! Remember the feel of an [arclight spanner] $Gbrother:sister;. You were a champion of gnome-kind once! This isn''t you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_6'), + (29032,-1609058,'Think, $N. Think back. Try and remember the hills and valleys of Elwynn, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the Alliance once! This isn''t you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_7'), + (29032,-1609059,'Think, $N. Think back. Try and remember Durotar, $Gbrother:sister;! Remember the sacrifices our heroes made so that we could be free of the blood curse. Harken back to the Valley of Trials, where we were reborn into a world without demonic influence. We found the splendor of life, $N. Together! This isn''t you. You were a champion of the Horde once!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_8'), + (29032,-1609060,'Think, $N. Think back. Try and remember the rolling plains of Mulgore, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the tauren once! This isn''t you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_9'), + (29032,-1609061,'TINK $N. Tink back, mon! We be Darkspear, mon! Bruddas and sistas! Remember when we fought the Zalazane and done took he head and freed da Echo Isles? MON! TINK! You was a champion of da Darkspear trolls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,6,'special_surprise SAY_EXEC_THINK_10'), + (29032,-1609062,'Listen to me, $N. You must fight against the Lich King''s control. He is a monster that wants to see this world - our world - in ruin. Don''t let him use you to accomplish his goals. You were once a hero and you can be again. Fight, damn you! Fight his control!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,5,'special_surprise SAY_EXEC_LISTEN_1'), + (29032,-1609063,'Listen to me, $N Ye must fight against the Lich King''s control. He''s a monster that wants to see this world - our world - in ruin. Don''t let him use ye to accomplish his goals. Ye were once a hero and ye can be again. Fight, damn ye! Fight his control!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,5,'special_surprise SAY_EXEC_LISTEN_2'), + (29032,-1609064,'Listen to me, $N. You must fight against the Lich King''s control. He is a monster that wants to see this world - our world - in ruin. Don''t let him use you to accomplish his goals AGAIN. You were once a hero and you can be again. Fight, damn you! Fight his control!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,5,'special_surprise SAY_EXEC_LISTEN_3'), + (29032,-1609065,'Listen ta me, $Gbrudda:sista;. You must fight against da Lich King''s control. He be a monstar dat want ta see dis world - our world - be ruined. Don''t let he use you ta accomplish he goals. You be a hero once and you be a hero again! Fight it, mon! Fight he control!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,5,'special_surprise SAY_EXEC_LISTEN_4'), + (29032,-1609066,'What''s going on in there? What''s taking so long, $N?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'special_surprise SAY_PLAGUEFIST'), + (29032,-1609067,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both. $N... Remember Silvermoon. This world is worth saving!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_1'), + (29032,-1609068,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both. $N... Remember Argus. Don''t let that happen to this world.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_2'), + (29032,-1609069,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both $N... For KHAAAAAAAAZZZ MODAAAAAANNNNNN!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_3'), + (29032,-1609070,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both. $N... Remember Tirisfal! This world is worth saving!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_4'), + (29032,-1609071,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both. $N... Remember Gnomeregan! This world is worth saving.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_5'), + (29032,-1609072,'There... There''s no more time for me. I''m done for. FInish me off, $N. Do it or they''ll kill us both. $N...Remember Elwynn. This world is worth saving.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_6'), + (29032,-1609073,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both. $N... Remember Teldrassil, our beloved home. This world is worth saving.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_7'), + (29032,-1609074,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both. $N... For the Horde! This world is worth saving.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_8'), + (29032,-1609075,'There... There''s no more time for me. I''m done for. Finish me off, $N. Do it or they''ll kill us both. $N... Remember Mulgore. This world is worth saving.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_9'), + (29032,-1609076,'Der... Der''s no more time for me. I be done for. Finish me off $N. Do it or they''ll kill us both. $N... Remember Sen''jin Village, mon! Dis world be worth saving!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,18,'special_surprise SAY_EXEC_TIME_10'), + (29032,-1609077,'Do it, $N! Put me out of my misery!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'special_surprise SAY_EXEC_WAITING'), + (29032,-1609078,'%s dies from his wounds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'special_surprise EMOTE_DIES'), + (28406,-1609080,'No potions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_A'), + (28406,-1609081,'Remember this day, $n, for it is the day that you will be thoroughly owned.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_B'), + (28406,-1609082,'I''m going to tear your heart out, cupcake!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_C'), + (28406,-1609083,'Don''t make me laugh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_D'), + (28406,-1609084,'Here come the tears...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_E'), + (28406,-1609085,'You have challenged death itself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_F'), + (28406,-1609086,'The Lich King will see his true champion on this day!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_G'), + (28406,-1609087,'You''re going down!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_H'), + (28406,-1609088,'You don''t stand a chance, $n',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'dk_initiate SAY_DUEL_I'), + (0,-1609089,'I''ll need to get my runeblade and armor... Just need a little more time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,399,'koltira SAY_BREAKOUT1'), + (0,-1609090,'I''m still weak, but I think I can get an anti-magic barrier up. Stay inside it or you''ll be destroyed by their spells.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'koltira SAY_BREAKOUT2'), + (0,-1609091,'Maintaining this barrier will require all of my concentration. Kill them all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,16,'koltira SAY_BREAKOUT3'), + (0,-1609092,'There are more coming. Defend yourself! Don''t fall out of the anti-magic field! They''ll tear you apart without its protection!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'koltira SAY_BREAKOUT4'), + (0,-1609093,'I can''t keep barrier up much longer... Where is that coward?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'koltira SAY_BREAKOUT5'), + (0,-1609094,'The High Inquisitor comes! Be ready, death knight! Do not let him draw you out of the protective bounds of my anti-magic field! Kill him and take his head!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'koltira SAY_BREAKOUT6'), + (0,-1609095,'Stay in the anti-magic field! Make them come to you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'koltira SAY_BREAKOUT7'), + (0,-1609096,'The death of the High Inquisitor of New Avalon will not go unnoticed. You need to get out of here at once! Go, before more of them show up. I''ll be fine on my own.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'koltira SAY_BREAKOUT8'), + (0,-1609097,'I''ll draw their fire, you make your escape behind me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'koltira SAY_BREAKOUT9'), + (0,-1609098,'Your High Inquisitor is nothing more than a pile of meat, Crusaders! There are none beyond the grasp of the Scourge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'koltira SAY_BREAKOUT10'), + + +-- How To Win Friends And Influence Enemies + (28939,-1609501,'I''ll tear the secrets from your soul! Tell me about the "Crimson Dawn" and your life may be spared!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'player SAY_PERSUADE1'), + (28939,-1609502,'Tell me what you know about "Crimson Dawn" or the beatings will continue!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'player SAY_PERSUADE2'), + (28939,-1609503,'I''m through being courteous with your kind, human! What is the "Crimson Dawn?"',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'player SAY_PERSUADE3'), + (28939,-1609504,'Is your life worth so little? Just tell me what I need to know about "Crimson Dawn" and I''ll end your suffering quickly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'player SAY_PERSUADE4'), + (28939,-1609505,'I can keep this up for a very long time, Scarlet dog! Tell me about the "Crimson Dawn!"',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'player SAY_PERSUADE5'), + (28939,-1609506,'What is the "Crimson Dawn?"',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'player SAY_PERSUADE6'), + (28939,-1609507,'"Crimson Dawn!" What is it! Speak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'player SAY_PERSUADE7'), + (28939,-1609508,'You''ll be hanging in the gallows shortly, Scourge fiend!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'crusader SAY_CRUSADER1'), + (28939,-1609509,'You''ll have to kill me, monster! I will tell you NOTHING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'crusader SAY_CRUSADER2'), + (28939,-1609510,'You hit like a girl. Honestly. Is that the best you can do?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'crusader SAY_CRUSADER3'), + (28939,-1609511,'ARGH! You burned my last good tabard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'crusader SAY_CRUSADER4'), + (28939,-1609512,'Argh... The pain... The pain is almost as unbearable as the lashings I received in grammar school when I was but a child.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'crusader SAY_CRUSADER5'), + (28939,-1609513,'I used to work for Grand Inquisitor Isillien! Your idea of pain is a normal mid-afternoon for me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'crusader SAY_CRUSADER6'), + (28939,-1609514,'I''ll tell you everything! STOP! PLEASE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,20,'break crusader SAY_PERSUADED1'), + (28939,-1609515,'We... We have only been told that the "Crimson Dawn" is an awakening. You see, the Light speaks to the High General. It is the Light...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,20,'break crusader SAY_PERSUADED2'), + (28939,-1609516,'The Light that guides us. The movement was set in motion before you came... We... We do as we are told. It is what must be done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,20,'break crusader SAY_PERSUADED3'), + (28939,-1609517,'I know very little else... The High General chooses who may go and who must stay behind. There''s nothing else... You must believe me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,20,'break crusader SAY_PERSUADED4'), + (28939,-1609518,'LIES! The pain you are about to endure will be talked about for years to come!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'break crusader SAY_PERSUADED5'), + (28939,-1609519,'NO! PLEASE! There is one more thing that I forgot to mention... A courier comes soon... From Hearthglen. It...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,20,'break crusader SAY_PERSUADED6'), +-- Ambush At The Overlook + (29076,-1609531,'Hrm, what a strange tree. I must investigate.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Scarlet Courier SAY_TREE1'), + (29076,-1609532,'What''s this!? This isn''t a tree at all! Guards! Guards!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Scarlet Courier SAY_TREE2'), +-- Bloody Breakout + (28912,-1609561,'I''ll need to get my runeblade and armor... Just need a little more time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,399,'Koltira Deathweaver SAY_BREAKOUT1'), + (28912,-1609562,'I''m still weak, but I think I can get an anti-magic barrier up. Stay inside it or you''ll be destroyed by their spells.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT2'), + (28912,-1609563,'Maintaining this barrier will require all of my concentration. Kill them all!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,16,'Koltira Deathweaver SAY_BREAKOUT3'), + (28912,-1609564,'There are more coming. Defend yourself! Don''t fall out of the anti-magic field! They''ll tear you apart without its protection!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT4'), + (28912,-1609565,'I can''t keep barrier up much longer... Where is that coward?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT5'), + (28912,-1609566,'The High Inquisitor comes! Be ready, death knight! Do not let him draw you out of the protective bounds of my anti-magic field! Kill him and take his head!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT6'), + (28912,-1609567,'Stay in the anti-magic field! Make them come to you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT7'), + (28912,-1609568,'The death of the High Inquisitor of New Avalon will not go unnoticed. You need to get out of here at once! Go, before more of them show up. I''ll be fine on my own.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT8'), + (28912,-1609569,'I''ll draw their fire, you make your escape behind me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT9'), + (28912,-1609570,'Your High Inquisitor is nothing more than a pile of meat, Crusaders! There are none beyond the grasp of the Scourge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Koltira Deathweaver SAY_BREAKOUT10'), + (29001,-1609581,'The Crusade will purge your kind from this world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'High Inquisitor Valroth start'), + (29001,-1609582,'It seems that I''ll need to deal with you myself. The High Inquisitor comes for you, Scourge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'High Inquisitor Valroth aggro'), + (29001,-1609583,'You have come seeking deliverance? I have come to deliver!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'High Inquisitor Valroth yell'), + (29001,-1609584,'LIGHT PURGE YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'High Inquisitor Valroth yell'), + (29001,-1609585,'Coward!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'High Inquisitor Valroth yell'), + (29001,-1609586,'High Inquisitor Valroth''s remains fall to the ground.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'High Inquisitor Valroth death'), + + +-- The Light of Dawn +-- pre text + (29173,-1609201,'Soldiers of the Scourge, stand ready! You will soon be able to unleash your fury upon the Argent Dawn!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14677,1,0,0,'Highlord Darion Mograine'), + (29173,-1609202,'The sky weeps at the devastation of sister earth! Soon, tears of blood will rain down upon us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14678,1,0,0,'Highlord Darion Mograine'), + (29173,-1609203,'Death knights of Acherus, the death march begins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14681,1,0,0,'Highlord Darion Mograine'), +-- intro + (29173,-1609204,'Soldiers of the Scourge, death knights of Acherus, minions of the darkness: hear the call of the Highlord!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14679,1,0,22,'Highlord Darion Mograine'), + (29173,-1609205,'RISE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14680,1,0,15,'Highlord Darion Mograine'), + (29173,-1609206,'The skies turn red with the blood of the fallen! The Lich King watches over us, minions! Onward! Leave only ashes and misery in your destructive wake!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14682,1,0,25,'Highlord Darion Mograine'), +-- During the fight + (29173,-1609207,'Scourge armies approach!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Korfax, Champion of the Light'), + (29173,-1609208,'Stand fast, brothers and sisters! The Light will prevail!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14487,1,0,0,'Lord Maxwell Tyrosus'), + (29173,-1609209,'Kneel before the Highlord!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14683,0,0,0,'Highlord Darion Mograine'), + (29173,-1609210,'You stand no chance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14684,0,0,0,'Highlord Darion Mograine'), + (29173,-1609211,'The Scourge will destroy this place!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14685,0,0,0,'Highlord Darion Mograine'), + (29173,-1609212,'Your life is forfeit.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14686,0,0,0,'Highlord Darion Mograine'), + (29173,-1609213,'Life is meaningless without suffering.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14687,0,0,0,'Highlord Darion Mograine'), + (29173,-1609214,'How much longer will your forces hold out?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14688,0,0,0,'Highlord Darion Mograine'), + (29173,-1609215,'The Argent Dawn is finished!"',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14689,0,0,0,'Highlord Darion Mograine'), + (29173,-1609216,'Spare no one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14690,0,0,0,'Highlord Darion Mograine'), + (29173,-1609217,'What is this?! My... I cannot strike...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14691,0,0,0,'Highlord Darion Mograine'), + (29173,-1609218,'Obey me, blade!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14692,1,0,0,'Highlord Darion Mograine'), + (29173,-1609219,'You will do as I command! I am in control here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14693,0,0,0,'Highlord Darion Mograine'), + (29173,-1609220,'I can not... the blade fights me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14694,0,0,0,'Highlord Darion Mograine'), + (29173,-1609221,'What is happening to me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14695,0,0,0,'Highlord Darion Mograine'), + (29173,-1609222,'Power...wanes...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14696,0,0,0,'Highlord Darion Mograine'), + (29173,-1609223,'Ashbringer defies me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14697,0,0,0,'Highlord Darion Mograine'), + (29173,-1609224,'Minions, come to my aid!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14698,0,0,0,'Highlord Darion Mograine'), +-- After the fight + (29173,-1609225,'You cannot win, Darion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14584,1,0,0,'Highlord Tirion Fordring'), + (29173,-1609226,'Bring them before the chapel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14585,1,0,0,'Highlord Tirion Fordring'), + (29173,-1609227,'Stand down, death knights. We have lost... The Light... This place... No hope...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14699,0,0,68,'Highlord Darion Mograine'), + (29173,-1609228,'Have you learned nothing, boy? You have become all that your father fought against! Like that coward, Arthas, you allowed yourself to be consumed by the darkness...the hate... Feeding upon the misery of those you tortured and killed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14586,0,0,378,'Highlord Tirion Fordring'), + (29173,-1609229,'Your master knows what lies beneath the chapel. It is why he dares not show his face! He''s sent you and your death knights to meet their doom, Darion.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14587,0,0,25,'Highlord Tirion Fordring'), + (29173,-1609230,'What you are feeling right now is the anguish of a thousand lost souls! Souls that you and your master brought here! The Light will tear you apart, Darion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14588,0,0,1,'Highlord Tirion Fordring'), + (29173,-1609231,'Save your breath, old man. It might be the last you ever draw.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14700,0,0,25,'Highlord Darion Mograine'), + (29173,-1609232,'My son! My dear, beautiful boy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14493,0,0,0,'Highlord Alexandros Mograine'), + (29173,-1609233,'Father!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14701,0,0,5,'Highlord Darion Mograine'), + (29173,-1609234,'Argh...what...is...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14702,0,0,68,'Highlord Darion Mograine'), + (29173,-1609235,'Father, you have returned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14703,0,0,0,'Darion Mograine'), + (29173,-1609236,'You have been gone a long time, father. I thought...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14704,0,0,0,'Darion Mograine'), + (29173,-1609237,'Nothing could have kept me away from here, Darion. Not from my home and family.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14494,0,0,1,'Highlord Alexandros Mograine'), + (29173,-1609238,'Father, I wish to join you in the war against the undead. I want to fight! I can sit idle no longer!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14705,0,0,6,'Darion Mograine'), + (29173,-1609239,'Darion Mograine, you are barely of age to hold a sword, let alone battle the undead hordes of Lordaeron! I couldn''t bear losing you. Even the thought...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14495,0,0,1,'Highlord Alexandros Mograine'), + (29173,-1609240,'If I die, father, I would rather it be on my feet, standing in defiance against the undead legions! If I die, father, I die with you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14706,0,0,6,'Darion Mograine'), + (29173,-1609241,'My son, there will come a day when you will command the Ashbringer and, with it, mete justice across this land. I have no doubt that when that day finally comes, you will bring pride to our people and that Lordaeron will be a better place because of you. But, my son, that day is not today.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14496,0,0,1,'Highlord Alexandros Mograine'), + (29173,-1609242,'Do not forget...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14497,0,0,6,'Highlord Alexandros Mograine'), + (29173,-1609243,'Touching...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14803,1,0,0,'The Lich King'), + (29173,-1609244,'You have''ve betrayed me! You betrayed us all you monster! Face the might of Mograine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14707,1,0,0,'Highlord Darion Mograine'), + (29173,-1609245,'He''s mine now...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14805,0,0,0,'The Lich King'), + (29173,-1609246,'Pathetic...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14804,0,0,0,'The Lich King'), + (29173,-1609247,'You''re a damned monster, Arthas!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14589,0,0,25,'Highlord Tirion Fordring'), + (29173,-1609248,'You were right, Fordring. I did send them in to die. Their lives are meaningless, but yours...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14806,0,0,1,'The Lich King'), + (29173,-1609249,'How simple it was to draw the great Tirion Fordring out of hiding. You''ve left yourself exposed, paladin. Nothing will save you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14807,0,0,1,'The Lich King'), + (29173,-1609250,'ATTACK!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14488,1,0,0,'Lord Maxwell Tyrosus'), + (29173,-1609251,'APOCALYPSE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14808,1,0,0,'The Lich King'), + (29173,-1609252,'That day is not today...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14708,0,0,0,'Highlord Darion Mograine'), + (29173,-1609253,'Tirion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14709,1,0,0,'Highlord Darion Mograine'), + (29173,-1609254,'ARTHAS!!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14591,1,0,0,'Highlord Tirion Fordring'), + (29173,-1609255,'What is this?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14809,1,0,0,'The Lich King'), + (29173,-1609256,'Your end.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14592,1,0,0,'Highlord Tirion Fordring'), + (29173,-1609257,'Impossible...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14810,1,0,0,'The Lich King'), + (29173,-1609258,'This... isn''t... over...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14811,1,0,25,'The Lich King'), + (29173,-1609259,'When next we meet it won''t be on holy ground, paladin.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14812,1,0,1,'The Lich King'), + (29173,-1609260,'Rise, Darion, and listen...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14593,0,0,0,'Highlord Tirion Fordring'), + (29173,-1609261,'We have all been witness to a terrible tragedy. The blood of good men has been shed upon this soil! Honorable knights, slain defending their lives - our lives!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14594,0,0,0,'Highlord Tirion Fordring'), + (29173,-1609262,'And while such things can never be forgotten, we must remain vigilant in our cause!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14595,0,0,0,'Highlord Tirion Fordring'), + (29173,-1609263,'The Lich King must answer for what he has done and must not be allowed to cause further destruction to our world.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14596,0,0,0,'Highlord Tirion Fordring'), + (29173,-1609264,'I make a promise to you now, brothers and sisters: The Lich King will be defeated! On this day, I call for a union.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14597,0,0,0,'Highlord Tirion Fordring'), + (29173,-1609265,'The Argent Dawn and the Order of the Silver Hand will come together as one! We will succeed where so many before us have failed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14598,0,0,0,'Highlord Tirion Fordring'), + (29173,-1609266,'We will take the fight to Arthas and tear down the walls of Icecrown!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14599,0,0,15,'Highlord Tirion Fordring'), + (29173,-1609267,'The Argent Crusade comes for you, Arthas!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14600,1,0,15,'Highlord Tirion Fordring'), + (29173,-1609268,'So too do the Knights of the Ebon Blade... While our kind has no place in your world, we will fight to bring an end to the Lich King. This I vow!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14710,0,0,1,'Highlord Darion Mograine'), +-- Emotes + (29173,-1609269,'Thousands of Scourge rise up at the Highlord''s command.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), + (29173,-1609270,'The army marches towards Light''s Hope Chapel.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), + (29173,-1609271,'After over a hundred Defenders of the Light fall, Highlord Tirion Fordring arrives.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), + (29173,-1609272,'%s flee',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Orbaz'), + (29173,-1609273,'%s kneels in defeat before Tirion Fordring.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Darion Mograine'), + (29173,-1609274,'%s arrives.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Alexandros Mograine'), + (29173,-1609275,'%s becomes a shade of his past, and walks up to his father.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Darion Mograine'), + (29173,-1609276,'%s hugs his father.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Darion Mograine'), + (29173,-1609277,'%s disappears, and the Lich King appears.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Alexandros'), + (29173,-1609278,'%s becomes himself again...and is now angry.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Darion Mograine'), + (29173,-1609279,'%s casts a spell on Tirion.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'The Lich King'), + (29173,-1609280,'%s gasps for air.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Tirion Fordring'), + (29173,-1609281,'%s casts a powerful spell, killing the Defenders and knocking back the others.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'The Lich King'), + (29173,-1609282,'%s throws the Corrupted Ashbringer to Tirion, who catches it. Tirion becomes awash with Light, and the Ashbringer is cleansed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Darion Mograine'), + (29173,-1609283,'%s collapses.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Darion Mograine'), + (29173,-1609284,'%s charges towards the Lich King, Ashbringer in hand and strikes the Lich King.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Tirion Fordring'), + (29173,-1609285,'%s disappears. Tirion walks over to where Darion lay',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'The Lich King'), + (29173,-1609286,'Light washes over the chapel î“ž the Light of Dawn is uncovered.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), + (25504, -1750040, 'My father''s aura is quite strong, he cannot be far. Could you be a doll and fight off the monsters wandering throught the mist?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), + (25504, -1750041, 'Watch out for the monsters!Which way should we go first? Let''s try this way...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), + (25504, -1750042, 'What could this be?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), + (25504, -1750043, 'There''s no sign of it ending! Where could my father be?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), + (25504, -1750044, 'Father! You''re safe!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), + (25589, -1700003, 'I\'ll make you a deal: If you get me out of here alive, you\'ll get a reward larger than you can imagine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'npc_bonker_togglevolt'), + (25589, -1700002, 'I AM NOT AN APPETIZER!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'npc_bonker_togglevolt'), + (25589, -1700001, 'Right then, no time to waste. Lets get outa here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'npc_bonker_togglevolt'); + +-- moved from world_spells_full.sql +UPDATE `script_texts` SET `type`=3 WHERE `entry` IN (-1532089,-1532090); diff --git a/sql/scripts/world_script_waypoints.sql b/sql/scripts/world_script_waypoints.sql new file mode 100644 index 0000000..3a5734d --- /dev/null +++ b/sql/scripts/world_script_waypoints.sql @@ -0,0 +1,2269 @@ +-- Up to TC2 5408 + +-- This file contains all waypoints used by escortAI scripts +/* +DROP TABLE IF EXISTS script_waypoint; +CREATE TABLE `script_waypoint` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'creature_template `entry`', + pointid mediumint(8) unsigned NOT NULL DEFAULT '0', + location_x float NOT NULL DEFAULT '0', + location_y float NOT NULL DEFAULT '0', + location_z float NOT NULL DEFAULT '0', + waittime int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'waittime in millisecs', + point_comment text, + PRIMARY KEY (entry, pointid) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; +*/ + +-- +-- Not sure why we don't just run +-- DELETE FROM `script_waypoint`; +-- I mean seriously, who has custom waypoint creatures? +-- + +DELETE FROM `script_waypoint` WHERE `entry`=26170; +INSERT INTO `script_waypoint` VALUES + (26170,1,3700.08,3574.54,473.322,0, ''), + (26170,2,3705.94,3573.63,476.841,0, ''), + (26170,3,3714.32,3572.3,477.442,0, ''), + (26170,4,3720.19,3563.44,477.441,0, ''), + (26170,5,3721.24,3561.95,477.44,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=24156; +INSERT INTO `script_waypoint` VALUES + (24156,1,1859.74,-6178.15,24.3033,0, ''), + (24156,2,1866.06,-6172.81,23.9216,0, ''), + (24156,3,1876.43,-6167.42,23.7332,0, ''), + (24156,4,1903.37,-6167.9,23.312,0, ''), + (24156,5,1934.43,-6168.46,23.7148,0, ''), + (24156,6,1942.38,-6168.21,23.7133,0, ''), + (24156,7,1953.48,-6172.4,24.2785,0, ''), + (24156,8,1969.21,-6179.69,23.8501,0, ''), + (24156,9,1992.18,-6177.24,21.3992,0, ''), + (24156,10,2015.73,-6174.73,15.3766,0, ''), + (24156,11,2016.99,-6156.39,12.5927,0, ''), + (24156,12,2018.14,-6130.62,6.31995,0, ''), + (24156,13,2043.73,-6119.18,5.17474,0, ''), + (24156,14,2080.99,-6100.03,7.72235,0, ''), + (24156,15,2115.47,-6096.21,5.36958,0, ''), + (24156,16,2130.36,-6151.59,1.24893,0, ''), + (24156,17,2160.5,-6098.78,3.14191,0, ''), + (24156,18,2161.26,-6101.38,2.81571,0, ''), + (24156,19,2172.54,-6108.54,2.26422,0, ''), + (24156,20,2206.69,-6110.46,0.787735,0, ''), + (24156,21,2228.23,-6090.02,1.17018,0, ''), + (24156,22,2262.76,-6056.79,1.82852,0, ''), + (24156,23,2285.54,-6046.96,1.6305,0, ''), + (24156,24,2298.05,-6041.56,2.01465,0, ''), + (24156,25,2307.53,-6031.23,2.93796,0, ''), + (24156,26,2309.46,-6024.45,3.65369,5000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=20415; +INSERT INTO `script_waypoint` VALUES + (20415 ,0,2488.77,2184.89,104.64,0, ''), + (20415 ,1,2478.72,2184.77,98.58,0, ''), + (20415 ,2,2473.52,2184.71,99.00,0, ''), + (20415 ,3,2453.15,2184.96,97.09,4000, ''), + (20415 ,4,2424.18,2184.15,94.11,0, ''), + (20415 ,5,2413.18,2184.15,93.42,0, ''), + (20415 ,6,2402.02,2183.90,87.59,0, ''), + (20415 ,7,2333.31,2181.63,90.03,4000, ''), + (20415 ,8,2308.73,2184.34,92.04,0, ''), + (20415 ,9,2303.10,2196.89,94.94,0, ''), + (20415 ,10,2304.58,2272.23,96.67,0, ''), + (20415 ,11,2297.09,2271.40,95.16,0, ''), + (20415 ,12,2297.68,2266.79,95.07,4000, ''), + (20415 ,13,2297.67,2266.76,95.07,4000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=18760; +INSERT INTO `script_waypoint` VALUES + (18760 ,0,-2265.21,3091.14,13.91,0, ''), + (18760 ,1,-2266.80,3091.33,13.82,1000, ''), + (18760 ,2,-2268.20,3091.14,13.82,7000, 'progress1'), + (18760 ,3,-2278.32,3098.98,13.82,0, ''), + (18760 ,4,-2294.82,3110.59,13.82,0, ''), + (18760 ,5,-2300.71,3114.60,13.82,20000, 'progress2'), + (18760 ,6,-2300.71,3114.60,13.82,3000, 'progress3'), + (18760 ,7,-2307.36,3122.76,13.79,0, ''), + (18760 ,8,-2312.83,3130.55,12.04,0, ''), + (18760 ,9,-2345.02,3151.00,8.38,0, ''), + (18760 ,10,-2351.97,3157.61,6.27,0, ''), + (18760 ,11,-2360.35,3171.48,3.31,0, ''), + (18760 ,12,-2371.44,3185.41,0.89,0, ''), + (18760 ,13,-2371.21,3197.92,-0.96,0, ''), + (18760 ,14,-2380.35,3210.45,-1.08,0, ''), + (18760 ,15,-2384.74,3221.25,-1.17,0, ''), + (18760 ,16,-2386.15,3233.39,-1.29,0, ''), + (18760 ,17,-2383.45,3247.79,-1.32,0, ''), + (18760 ,18,-2367.50,3265.64,-1.33,0, ''), + (18760 ,19,-2354.90,3273.30,-1.50,0, ''), + (18760 ,20,-2348.88,3280.58,-0.09,0, ''), + (18760 ,21,-2349.06,3295.86,-0.95,0, ''), + (18760 ,22,-2350.43,3328.27,-2.10,0, ''), + (18760 ,23,-2346.76,3356.27,-2.82,0, ''), + (18760 ,24,-2340.56,3370.68,-4.02,0, ''), + (18760 ,25,-2318.84,3384.60,-7.61,0, ''), + (18760 ,26,-2313.99,3398.61,-10.40,0, ''), + (18760 ,27,-2320.85,3414.49,-11.49,0, ''), + (18760 ,28,-2338.26,3426.06,-11.46,0, ''), + (18760 ,29,-2342.67,3439.44,-11.32,12000, 'progress4'), + (18760 ,30,-2342.67,3439.44,-11.32,7000, 'emote bye'), + (18760 ,31,-2342.67,3439.44,-11.32,5000, 'cat form'), + (18760 ,32,-2344.60,3461.27,-10.44,0, ''), + (18760 ,33,-2396.81,3517.17,-3.55,0, ''), + (18760 ,34,-2439.23,3523.00,-1.05,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=9623; +INSERT INTO `script_waypoint` VALUES + (9623 ,1,-6380.38,-1965.14,-258.292,5000, ''), + (9623 ,2,-6383.06,-1962.9,-258.936,0, ''), + (9623 ,3,-6391.09,-1956.13,-260.291,0, ''), + (9623 ,4,-6395.29,-1933.58,-262.949,0, ''), + (9623 ,5,-6396.58,-1919.93,-263.838,0, ''), + (9623 ,6,-6389.01,-1912.64,-260.689,0, ''), + (9623 ,7,-6369.19,-1892.87,-255.924,0, ''), + (9623 ,8,-6373.77,-1879.36,-259.268,0, ''), + (9623 ,9,-6377.55,-1869.56,-260.503,0, ''), + (9623 ,10,-6376.58,-1860.79,-260.026,0, ''), + (9623 ,11,-6373.13,-1847.22,-259.249,0, ''), + (9623 ,12,-6370.54,-1837.04,-260.007,0, ''), + (9623 ,13,-6372.52,-1829.16,-260.071,0, ''), + (9623 ,14,-6377.13,-1815.94,-262.632,0, ''), + (9623 ,15,-6380.27,-1806.95,-265.53,0, ''), + (9623 ,16,-6386.04,-1790.43,-268.546,0, ''), + (9623 ,17,-6386.72,-1776.29,-269.851,0, ''), + (9623 ,18,-6385.92,-1762.31,-271.494,0, ''), + (9623 ,19,-6384.69,-1744.86,-272.196,0, ''), + (9623 ,20,-6383.8,-1732.66,-272.222,0, ''), + (9623 ,21,-6382.66,-1716.96,-272.235,0, ''), + (9623 ,22,-6381.5,-1703.01,-272.964,0, ''), + (9623 ,23,-6379.96,-1685.58,-272.842,0, ''), + (9623 ,24,-6379.34,-1678.61,-272.34,0, ''), + (9623 ,25,-6364.45,-1636.27,-271.065,0, ''), + (9623 ,26,-6371.85,-1626.36,-272.188,0, ''), + (9623 ,27,-6383.5,-1629.01,-272.206,0, ''), + (9623 ,28,-6388.09,-1635.37,-272.105,5000, ''), + (9623 ,29,-6375.42,-1637.33,-272.193,0, ''), + (9623 ,30,-6365.46,-1617.25,-272.141,0, ''), + (9623 ,31,-6353.79,-1603.48,-271.932,0, ''), + (9623 ,32,-6340.24,-1592.41,-269.435,0, ''), + (9623 ,33,-6329.45,-1566.89,-269.895,0, ''), + (9623 ,34,-6312.2,-1499.06,-269.507,0, ''), + (9623 ,35,-6304.55,-1468.5,-269.431,0, ''), + (9623 ,36,-6310.36,-1440.94,-268.427,0, ''), + (9623 ,37,-6321,-1418.91,-266.525,0, ''), + (9623 ,38,-6358.76,-1389.97,-267.522,0, ''), + (9623 ,39,-6378.65,-1375.67,-271.749,0, ''), + (9623 ,40,-6387.22,-1360.95,-272.109,0, ''), + (9623 ,41,-6406.95,-1323.87,-271.586,0, ''), + (9623 ,42,-6405,-1311.92,-271.906,0, ''), + (9623 ,43,-6395.56,-1303.62,-271.902,0, ''), + (9623 ,44,-6375.97,-1296.08,-271.865,0, ''), + (9623 ,45,-6364.39,-1281.23,-269.012,0, ''), + (9623 ,46,-6353.71,-1263.19,-267.95,0, ''), + (9623 ,47,-6340.09,-1248.65,-267.441,0, ''), + (9623 ,48,-6338.21,-1237.11,-267.844,0, ''), + (9623 ,49,-6336.6,-1219.69,-269.196,0, ''), + (9623 ,50,-6334.44,-1202.33,-271.527,0, ''), + (9623 ,51,-6329.56,-1189.82,-270.947,0, ''), + (9623 ,52,-6324.66,-1179.46,-270.103,0, ''), + (9623 ,53,-6315.08,-1176.74,-269.735,0, ''), + (9623 ,54,-6308.49,-1179.12,-269.57,0, ''), + (9623 ,55,-6302.43,-1181.32,-269.328,5000, ''), + (9623 ,56,-6298.87,-1185.79,-269.278,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=4508; +INSERT INTO `script_waypoint` VALUES + (4508 ,0,2194.38,1791.65,65.48,5000, ''), + (4508 ,1,2188.56,1805.87,64.45,0, ''), + (4508 ,2,2187,1843.49,59.33,0, ''), + (4508 ,3,2163.27,1851.67,56.73,5000, ''), + (4508 ,4,2137.66,1843.98,48.08,5000, ''), + (4508 ,5,2140.22,1845.02,48.32,0, ''), + (4508 ,6,2131.5,1804.29,46.85,0, ''), + (4508 ,7,2096.18,1789.03,51.13,0, ''), + (4508 ,8,2074.46,1780.09,55.64,3000, ''), + (4508 ,9,2055.12,1768.67,58.46,5000, ''), + (4508 ,10,2037.83,1748.62,60.27,0, ''), + (4508 ,11,2037.51,1728.94,60.85,0, ''), + (4508 ,12,2044.7,1711.71,59.71,0, ''), + (4508 ,13,2067.66,1701.84,57.77,3000, ''), + (4508 ,14,2078.91,1704.54,56.77,3000, ''), + (4508 ,15,2097.65,1715.24,54.74,0, ''), + (4508 ,16,2106.44,1720.98,54.41,0, ''), + (4508 ,17,2123.96,1732.56,52.27,0, ''), + (4508 ,18,2153.82,1728.73,51.92,0, ''), + (4508 ,19,2163.49,1706.33,54.42,0, ''), + (4508 ,20,2158.75,1695.98,55.70,0, ''), + (4508 ,21,2142.6,1680.72,58.24,0, ''), + (4508 ,22,2118.31,1671.54,59.21,0, ''), + (4508 ,23,2086.02,1672.04,61.24,0, ''), + (4508 ,24,2068.81,1658.93,61.24,0, ''), + (4508 ,25,2062.82,1633.31,64.35,3000, ''), + (4508 ,26,2063.05,1589.16,63.26,0, ''), + (4508 ,27,2063.67,1577.22,65.89,0, ''), + (4508 ,28,2057.94,1560.68,68.40,0, ''), + (4508 ,29,2052.56,1548.05,73.35,0, ''), + (4508 ,30,2045.22,1543.4,76.65,0, ''), + (4508 ,31,2034.35,1543.01,79.70,0, ''), + (4508 ,32,2029.95,1542.94,80.79,0, ''), + (4508 ,33,2021.34,1538.67,80.8,0, ''), + (4508 ,34,2012.45,1549.48,79.93,0, ''), + (4508 ,35,2008.05,1554.92,80.44,0, ''), + (4508 ,36,2006.54,1562.72,81.11,0, ''), + (4508 ,37,2003.8,1576.43,81.57,0, ''), + (4508 ,38,2000.57,1590.06,80.62,0, ''), + (4508 ,39,1998.96,1596.87,80.22,0, ''), + (4508 ,40,1991.19,1600.82,79.39,0, ''), + (4508 ,41,1980.71,1601.44,79.77,3000, ''), + (4508 ,42,1967.22,1600.18,80.62,3000, ''), + (4508 ,43,1956.43,1596.97,81.75,3000, ''), + (4508 ,44,1954.87,1592.02,82.18,0, ''), + (4508 ,45,1948.35,1571.35,80.96,30000, ''), + (4508 ,46,1947.02,1566.42,81.80,30000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=7784; +INSERT INTO `script_waypoint` VALUES + (7784 ,0,-8843.73,-4374.44,43.71,0, ''), + (7784 ,1,-8834.68,-4373.88,45.71,0, ''), + (7784 ,2,-8832.93,-4373.85,45.67,0, ''), + (7784 ,3,-8829.21,-4373.72,44.14,0, ''), + (7784 ,4,-8825.10,-4373.56,41.44,0, ''), + (7784 ,5,-8818.88,-4372.75,36.43,0, ''), + (7784 ,6,-8803.37,-4369.68,30.06,0, ''), + (7784 ,7,-8786.68,-4366.18,23.91,0, ''), + (7784 ,8,-8764.97,-4366.94,25.23,0, ''), + (7784 ,9,-8745.49,-4363.16,22.80,0, ''), + (7784 ,10,-8724.13,-4353.55,20.72,0, ''), + (7784 ,11,-8706.77,-4346.14,16.12,0, ''), + (7784 ,12,-8688.27,-4372.85,13.64,0, ''), + (7784 ,13,-8668.76,-4380.38,11.69,0, ''), + (7784 ,14,-8645.19,-4388.62,12.56,0, ''), + (7784 ,15,-8614.73,-4398.60,9.86,0, ''), + (7784 ,16,-8560.33,-4411.27,13.17,0, ''), + (7784 ,17,-8536.45,-4416.49,11.84,0, ''), + (7784 ,18,-8503.48,-4423.70,13.59,0, ''), + (7784 ,19,-8471.91,-4430.60,9.56,0, ''), + (7784 ,20,-8441.36,-4435.31,9.40,0, ''), + (7784 ,21,-8403.41,-4441.16,11.83,0, ''), + (7784 ,22,-8371.24,-4446.13,9.47,0, ''), + (7784 ,23,-8353.96,-4448.79,10.10,0, 'Scorpid'), + (7784 ,24,-8336.40,-4446.39,8.98,0, ''), + (7784 ,25,-8303.78,-4441.96,11.89,0, ''), + (7784 ,26,-8272.20,-4433.31,9.60,0, ''), + (7784 ,27,-8224.76,-4419.39,13.03,0, ''), + (7784 ,28,-8193.31,-4406.04,10.17,0, ''), + (7784 ,29,-8155.65,-4397.74,8.99,0, ''), + (7784 ,30,-8129.25,-4394.57,10.92,0, ''), + (7784 ,31,-8104.86,-4399.03,8.93,0, ''), + (7784 ,32,-8063.15,-4423.40,10.07,0, ''), + (7784 ,33,-8032.15,-4443.47,9.97,0, ''), + (7784 ,34,-8015.39,-4454.33,9.39,0, ''), + (7784 ,35,-7981.64,-4482.44,10.32,0, ''), + (7784 ,36,-7958.83,-4503.98,9.69,0, ''), + (7784 ,37,-7932.45,-4528.91,10.08,0, ''), + (7784 ,38,-7904.09,-4566.67,12.59,0, ''), + (7784 ,39,-7883.33,-4593.91,12.15,0, ''), + (7784 ,40,-7862.83,-4624.53,10.21,0, ''), + (7784 ,41,-7840.79,-4654.26,9.45,0, ''), + (7784 ,42,-7826.17,-4673.99,10.61,0, ''), + (7784 ,43,-7807.86,-4698.69,11.24,0, ''), + (7784 ,44,-7793.88,-4717.55,10.48,0, ''), + (7784 ,45,-7778.68,-4738.05,8.89,0, ''), + (7784 ,46,-7746.42,-4780.39,9.84,0, ''), + (7784 ,47,-7724.11,-4772.75,10.28,0, ''), + (7784 ,48,-7697.98,-4763.80,9.52,0, ''), + (7784 ,49,-7665.33,-4752.62,10.56,0, ''), + (7784 ,50,-7641.47,-4750.33,8.94,0, ''), + (7784 ,51,-7620.08,-4753.96,8.93,0, ''), + (7784 ,52,-7603.15,-4757.53,9.06,0, ''), + (7784 ,53,-7579.43,-4767.07,8.93,0, ''), + (7784 ,54,-7558.51,-4779.01,9.64,0, ''), + (7784 ,55,-7536.40,-4789.32,8.92,0, ''), + (7784 ,56,-7512.07,-4793.50,9.35,0, 'Wastewander'), + (7784 ,57,-7490.79,-4788.80,10.53,0, ''), + (7784 ,58,-7469.10,-4785.11,10.42,0, ''), + (7784 ,59,-7453.18,-4782.41,9.15,0, ''), + (7784 ,60,-7426.27,-4777.83,9.54,0, ''), + (7784 ,61,-7393.84,-4770.19,12.57,0, ''), + (7784 ,62,-7367.25,-4764.17,11.92,0, ''), + (7784 ,63,-7341.00,-4752.11,10.17,0, ''), + (7784 ,64,-7321.62,-4744.97,11.58,0, ''), + (7784 ,65,-7302.35,-4744.35,11.97,0, ''), + (7784 ,66,-7281.00,-4743.66,11.21,0, ''), + (7784 ,67,-7258.33,-4742.93,9.64,0, ''), + (7784 ,68,-7236.70,-4742.24,10.16,0, ''), + (7784 ,69,-7217.52,-4743.87,10.79,0, ''), + (7784 ,70,-7201.86,-4746.32,9.58,0, ''), + (7784 ,71,-7182.01,-4749.41,9.09,0, ''), + (7784 ,72,-7159.61,-4752.90,9.52,0, ''), + (7784 ,73,-7139.58,-4756.02,9.53,0, ''), + (7784 ,74,-7122.60,-4754.91,9.66,0, ''), + (7784 ,75,-7101.06,-4753.87,8.92,0, ''), + (7784 ,76,-7082.79,-4752.99,9.97,0, ''), + (7784 ,77,-7061.81,-4751.98,9.26,0, ''), + (7784 ,78,-7035.12,-4754.39,9.19,0, ''), + (7784 ,79,-7013.90,-4758.64,10.28,0, ''), + (7784 ,80,-7001.71,-4769.73,10.59,0, ''), + (7784 ,81,-6984.95,-4788.61,9.30,0, ''), + (7784 ,82,-6970.41,-4788.77,9.42,0, ''), + (7784 ,83,-6957.16,-4788.92,6.26,0, ''), + (7784 ,84,-6951.29,-4802.73,4.45,0, ''), + (7784 ,85,-6944.81,-4816.58,1.60,0, ''), + (7784 ,86,-6942.06,-4839.40,0.66,5000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=1978; +INSERT INTO `script_waypoint` VALUES + (1978,0,1406.32,1083.10,52.55,0, ''), + (1978,1,1400.49,1080.42,52.50,0, 'first say'), + (1978,2,1388.48,1083.10,52.52,0, ''), + (1978,3,1370.16,1084.02,52.30,0, ''), + (1978,4,1359.02,1080.85,52.46,0, ''), + (1978,5,1341.43,1087.39,52.69,0, ''), + (1978,6,1321.93,1090.51,50.66,0, ''), + (1978,7,1312.98,1095.91,47.49,0, ''), + (1978,8,1301.09,1102.94,47.76,0, ''), + (1978,9,1297.73,1106.35,50.18,0, ''), + (1978,10,1295.49,1124.32,50.49,0, ''), + (1978,11,1294.84,1137.25,51.75,0, ''), + (1978,12,1292.89,1158.99,52.65,0, ''), + (1978,13,1290.75,1168.67,52.56,1000, 'complete quest and say last'), + (1978,14,1287.12,1203.49,52.66,5000, ''), + (1978,15,1287.12,1203.49,52.66,4000, ''), + (1978,16,1287.12,1203.49,52.66,5000, ''), + (1978,17,1287.12,1203.49,52.66,4000, ''), + (1978,18,1290.72,1207.44,52.69,0, ''), + (1978,19,1297.50,1207.18,53.74,0, ''), + (1978,20,1301.32,1220.90,53.74,0, ''), + (1978,21,1298.55,1220.43,53.74,0, ''), + (1978,22,1297.59,1211.23,58.47,0, ''), + (1978,23,1305.01,1206.10,58.51,0, ''), + (1978,24,1310.51,1207.36,58.51,5000, ''), + (1978,25,1310.51,1207.36,58.51,5000, ''), + (1978,26,1310.51,1207.36,58.51,2000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=3439; +INSERT INTO `script_waypoint` VALUES + (3439,0,1105.090332,-3101.254150,82.706,1000, 'SAY_STARTUP1'), + (3439,1,1103.204468,-3104.345215,83.113,1000, ''), + (3439,2,1107.815186,-3106.495361,82.739,1000, ''), + (3439,3,1104.733276,-3100.830811,82.747,1000, ''), + (3439,4,1103.242554,-3106.270020,83.133,1000, ''), + (3439,5,1112.807373,-3106.285400,82.320,1000, ''), + (3439,6,1112.826782,-3108.908691,82.377,1000, ''), + (3439,7,1108.053955,-3115.156738,82.894,0, ''), + (3439,8,1108.355591,-3104.365234,82.377,5000, ''), + (3439,9,1100.306763,-3097.539063,83.150,0, 'SAY_STARTUP2'), + (3439,10,1100.562378,-3082.721924,82.768,0, ''), + (3439,11,1097.512939,-3069.226563,82.206,0, ''), + (3439,12,1092.964966,-3053.114746,82.351,0, ''), + (3439,13,1094.010986,-3036.958496,82.888,0, ''), + (3439,14,1095.623901,-3025.760254,83.392,0, ''), + (3439,15,1107.656494,-3013.530518,85.653,0, ''), + (3439,16,1119.647705,-3006.928223,87.019,0, ''), + (3439,17,1129.991211,-3002.410645,91.232,7000, 'SAY_MERCENARY'), + (3439,18,1133.328735,-2997.710693,91.675,1000, 'SAY_PROGRESS_1'), + (3439,19,1131.799316,-2987.948242,91.976,1000, ''), + (3439,20,1122.028687,-2993.397461,91.536,0, ''), + (3439,21,1116.614868,-2981.916748,92.103,0, ''), + (3439,22,1102.239136,-2994.245117,92.074,0, ''), + (3439,23,1096.366211,-2978.306885,91.873,0, ''), + (3439,24,1091.971558,-2985.919189,91.730,40000, 'SAY_PROGRESS_2'); + +DELETE FROM `script_waypoint` WHERE `entry`=7806; +INSERT INTO `script_waypoint` VALUES + (7806,0,495.404358,-3478.350830,114.837,0, ''), + (7806,1,492.704742,-3486.112549,108.627,0, ''), + (7806,2,487.249756,-3485.764404,107.890,0, ''), + (7806,3,476.851959,-3489.875977,99.985,0, ''), + (7806,4,467.212402,-3493.355469,99.819,0, ''), + (7806,5,460.017029,-3496.984375,104.481,0, ''), + (7806,6,439.619446,-3500.730225,110.534,0, ''), + (7806,7,428.326385,-3495.874756,118.662,0, ''), + (7806,8,424.664032,-3489.381592,121.999,0, ''), + (7806,9,424.137299,-3470.952637,124.333,0, ''), + (7806,10,421.791107,-3449.242676,119.126,0, ''), + (7806,11,404.247070,-3429.376953,117.644,0, ''), + (7806,12,335.465271,-3430.717773,116.456,0, ''), + (7806,13,317.160126,-3426.708984,116.226,0, ''), + (7806,14,331.180115,-3464.002197,117.143,0, ''), + (7806,15,336.393616,-3501.877441,118.201,0, ''), + (7806,16,337.251312,-3544.764648,117.284,0, ''), + (7806,17,337.748932,-3565.415527,116.797,0, ''), + (7806,18,336.010925,-3597.363037,118.225,0, ''), + (7806,19,324.619141,-3622.884033,119.811,0, ''), + (7806,20,308.027466,-3648.600098,123.047,0, ''), + (7806,21,276.325409,-3685.738525,128.356,0, ''), + (7806,22,239.981064,-3717.330811,131.874,0, ''), + (7806,23,224.950974,-3730.169678,132.125,0, ''), + (7806,24,198.707870,-3768.292725,129.420,0, ''), + (7806,25,183.758316,-3791.068848,128.045,0, ''), + (7806,26,178.110657,-3801.575439,128.370,3000, 'SAY_OOX_DANGER'), + (7806,27,162.215225,-3827.014160,129.424,0, ''), + (7806,28,141.664734,-3864.519287,131.419,0, ''), + (7806,29,135.301697,-3880.089111,132.120,0, ''), + (7806,30,122.461151,-3910.071533,135.605,0, ''), + (7806,31,103.376175,-3937.725098,137.342,0, ''), + (7806,32,81.414474,-3958.614258,138.469,0, ''), + (7806,33,55.378139,-3982.004639,136.520,0, ''), + (7806,34,13.983131,-4013.952881,126.903,0, ''), + (7806,35,-21.658007,-4048.713623,118.068,0, ''), + (7806,36,-52.443058,-4081.209717,117.477,0, ''), + (7806,37,-102.710854,-4116.760742,118.666,0, ''), + (7806,38,-92.996193,-4135.847168,119.310,0, ''), + (7806,39,-86.391273,-4153.331055,122.502,0, ''), + (7806,40,-85.746086,-4163.600586,121.892,0, ''), + (7806,41,-90.544006,-4183.577637,117.587,0, ''), + (7806,42,-110.223564,-4205.861328,121.878,0, ''), + (7806,43,-115.257607,-4211.962402,121.878,3000, 'SAY_OOX_DANGER'), + (7806,44,-128.594650,-4233.343750,117.766,0, ''), + (7806,45,-135.358917,-4258.120117,117.562,0, ''), + (7806,46,-156.832428,-4258.961914,120.059,0, ''), + (7806,47,-167.119873,-4274.102539,117.062,0, ''), + (7806,48,-176.291016,-4287.594727,118.721,0, ''), + (7806,49,-196.992981,-4315.815430,117.588,0, ''), + (7806,50,-209.329300,-4331.671387,115.142,0, ''), + (7806,51,-232.292236,-4356.015625,108.543,0, ''), + (7806,52,-232.159683,-4370.904297,102.815,0, ''), + (7806,53,-210.271133,-4389.896973,84.167,0, ''), + (7806,54,-187.940186,-4407.532715,70.987,0, ''), + (7806,55,-181.353577,-4418.771973,64.778,0, ''), + (7806,56,-170.529861,-4440.438965,58.943,0, ''), + (7806,57,-141.428543,-4465.323242,45.963,0, ''), + (7806,58,-120.993629,-4487.088379,32.075,0, ''), + (7806,59,-104.134621,-4501.837402,25.051,0, ''), + (7806,60,-84.154663,-4529.436523,11.952,0, ''), + (7806,61,-88.698898,-4544.626465,9.055,0, ''), + (7806,62,-100.603447,-4575.034180,11.388,0, ''), + (7806,63,-106.908669,-4600.407715,11.046,0, ''), + (7806,64,-106.831703,-4620.503418,11.057,3000, 'SAY_OOX_COMPLETE'); + +DELETE FROM `script_waypoint` WHERE `entry`=4962; +INSERT INTO `script_waypoint` VALUES + (4962,0,-3804.438965,-828.048035,10.093068,0, ''), + (4962,1,-3803.934326,-835.772400,10.077722,0, ''), + (4962,2,-3792.629150,-835.670898, 9.655657,0, ''), + (4962,3,-3772.433838,-835.345947,10.868981,0, ''), + (4962,4,-3765.937256,-840.128601,10.885593,0, ''), + (4962,5,-3738.633789,-830.997498,11.057384,0, ''), + (4962,6,-3690.224121,-862.261597, 9.960449,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=10638; +INSERT INTO `script_waypoint` VALUES + (10638,0,-4903.521973,-1368.339844,-52.611,5000, 'SAY_KAN_START'), + (10638,1,-4906.004395,-1367.048096,-52.611,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=7780; +INSERT INTO `script_waypoint` VALUES + (7780,0,261.058868,-2757.876221,122.553,0, ''), + (7780,1,259.812195,-2758.249023,122.555,0, 'SAY_RIN_FREE'), + (7780,2,253.823441,-2758.619141,122.562,0, ''), + (7780,3,241.394791,-2769.754883,123.309,0, ''), + (7780,4,218.915588,-2783.397461,123.355,0, ''), + (7780,5,209.088196,-2789.676270,122.001,0, ''), + (7780,6,204.453568,-2792.205811,120.620,0, ''), + (7780,7,182.012604,-2809.995361,113.887,0, 'summon'), + (7780,8,164.411591,-2825.162842,107.779,0, ''), + (7780,9,149.727600,-2833.704346,106.224,0, ''), + (7780,10,142.448074,-2838.807373,109.665,0, ''), + (7780,11,133.274963,-2845.135254,112.606,0, ''), + (7780,12,111.247459,-2861.065674,116.305,0, ''), + (7780,13,96.104073,-2874.886230,114.397,0, 'summon'), + (7780,14,73.369942,-2881.184570,117.666,0, ''), + (7780,15,58.579178,-2889.151611,116.253,0, ''), + (7780,16,33.214249,-2906.343994,115.083,0, ''), + (7780,17,19.586519,-2908.712402,117.276,7500, 'SAY_RIN_COMPLETE'), + (7780,18,10.282522,-2911.607422,118.394,0, ''), + (7780,19,-37.580383,-2942.730225,117.145,0, ''), + (7780,20,-68.599411,-2953.694824,116.685,0, ''), + (7780,21,-102.054253,-2956.965576,116.677,0, ''), + (7780,22,-135.993637,-2955.743652,115.788,0, ''), + (7780,23,-171.561600,-2951.417480,115.451,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=18731; +INSERT INTO `script_waypoint` VALUES + (18731,0,-157.366,2.177,8.073,0, ''), + (18731,1,-172.266,-18.280,8.073,0, ''), + (18731,2,-171.051,-38.748,8.073,0, ''), + (18731,3,-170.718,-59.436,8.073,0, ''), + (18731,4,-156.659,-72.118,8.073,0, ''), + (18731,5,-142.292,-59.423,8.073,0, ''), + (18731,6,-141.779,-38.972,8.073,0, ''), + (18731,7,-142.922,-18.950,8.073,0, ''), + (18731,8,-157.366,2.177,8.073,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=21027; +INSERT INTO `script_waypoint` VALUES + (21027,0,-2714.697266,1326.879395,34.306953,0, ''), + (21027,1,-2666.364990,1348.222656,34.445557,0, ''), + (21027,2,-2693.789307,1336.964966,34.445557,0, ''), + (21027,3,-2715.495361,1328.054443,34.106014,0, ''), + (21027,4,-2742.530762,1314.138550,33.606144,0, ''), + (21027,5,-2745.077148,1311.108765,33.630898,0, ''), + (21027,6,-2749.855225,1302.737915,33.475632,0, ''), + (21027,7,-2753.639648,1294.059448,33.314930,0, ''), + (21027,8,-2756.796387,1285.122192,33.391262,0, ''), + (21027,9,-2750.042969,1273.661987,33.188259,0, ''), + (21027,10,-2740.378418,1258.846680,33.212521,0, ''), + (21027,11,-2733.629395,1248.259766,33.640598,0, ''), + (21027,12,-2727.212646,1238.606445,33.520847,0, ''), + (21027,13,-2726.377197,1237.264526,33.461823,3000, 'SAY_WIL_PROGRESS1'), + (21027,14,-2746.383301,1266.390625,33.191952,2000, ''), + (21027,15,-2746.383301,1266.390625,33.191952,4000, 'SAY_WIL_FIND_EXIT'), + (21027,16,-2758.927734,1285.134155,33.341728,0, ''), + (21027,17,-2761.845703,1292.313599,33.209042,0, ''), + (21027,18,-2758.871826,1300.677612,33.285332,0, ''), + (21027,19,-2753.928955,1307.755859,33.452457,0, ''), + (21027,20,-2738.612061,1316.191284,33.482975,0, ''), + (21027,21,-2727.897461,1320.013916,33.381111,0, ''), + (21027,22,-2709.458740,1315.739990,33.301838,0, ''), + (21027,23,-2704.658936,1301.620361,32.463303,0, ''), + (21027,24,-2704.120117,1298.922607,32.768162,0, ''), + (21027,25,-2691.798340,1292.846436,33.852642,0, ''), + (21027,26,-2682.879639,1288.853882,32.995399,0, ''), + (21027,27,-2661.869141,1279.682495,26.686783,0, ''), + (21027,28,-2648.943604,1270.272827,24.147522,0, ''), + (21027,29,-2642.506836,1262.938721,23.512444,0, ''), + (21027,30,-2636.984863,1252.429077,20.418257,0, ''), + (21027,31,-2648.113037,1224.984863,8.691818,0, ''), + (21027,32,-2658.393311,1200.136719,5.492243,0, ''), + (21027,33,-2668.504395,1190.450562,3.127407,0, ''), + (21027,34,-2685.930420,1174.360840,5.163924,0, ''), + (21027,35,-2701.613770,1160.026367,5.611311,0, ''), + (21027,36,-2714.659668,1149.980347,4.342373,0, ''), + (21027,37,-2721.443359,1145.002808,1.913474,0, ''), + (21027,38,-2733.962158,1143.436279,2.620415,0, ''), + (21027,39,-2757.876709,1146.937500,6.184002,2000, 'SAY_WIL_JUST_AHEAD'), + (21027,40,-2772.300537,1166.052734,6.331811,0, ''), + (21027,41,-2790.265381,1189.941650,5.207958,0, ''), + (21027,42,-2805.448975,1208.663940,5.557623,0, ''), + (21027,43,-2820.617676,1225.870239,6.266103,0, ''), + (21027,44,-2831.926758,1237.725830,5.808506,0, ''), + (21027,45,-2842.578369,1252.869629,6.807481,0, ''), + (21027,46,-2846.344971,1258.727295,7.386168,0, ''), + (21027,47,-2847.556396,1266.771729,8.208790,0, ''), + (21027,48,-2841.654541,1285.809204,7.933223,0, ''), + (21027,49,-2841.754883,1289.832520,6.990304,0, ''), + (21027,50,-2871.398438,1302.348145,6.807335,7500, 'SAY_WIL_END'); + +DELETE FROM `script_waypoint` WHERE `entry`=3465; +INSERT INTO `script_waypoint` VALUES + (3465,0,-2095.840820,-3650.001221,61.716,0, ''), + (3465,1,-2100.193604,-3613.949219,61.604,0, ''), + (3465,2,-2098.549561,-3601.557129,59.154,0, ''), + (3465,3,-2093.796387,-3595.234375,56.658,0, ''), + (3465,4,-2072.575928,-3578.827637,48.844,0, ''), + (3465,5,-2023.858398,-3568.146240,24.636,0, ''), + (3465,6,-2013.576416,-3571.499756,22.203,0, ''), + (3465,7,-2009.813721,-3580.547852,21.791,0, ''), + (3465,8,-2015.296021,-3597.387695,21.760,0, ''), + (3465,9,-2020.677368,-3610.296143,21.759,0, ''), + (3465,10,-2019.990845,-3640.155273,21.759,0, ''), + (3465,11,-2016.110596,-3664.133301,21.758,0, ''), + (3465,12,-1999.397095,-3679.435059,21.316,0, ''), + (3465,13,-1987.455811,-3688.309326,18.495,0, ''), + (3465,14,-1973.966553,-3687.666748,14.996,0, ''), + (3465,15,-1949.163940,-3678.054932,11.293,0, ''), + (3465,16,-1934.091187,-3682.859619,9.897,30000, 'SAY_GIL_AT_LAST'), + (3465,17,-1935.383911,-3682.322021,10.029,1500, 'SAY_GIL_PROCEED'), + (3465,18,-1879.039185,-3699.498047,6.582,7500, 'SAY_GIL_FREEBOOTERS'), + (3465,19,-1852.728149,-3703.778809,6.875,0, ''), + (3465,20,-1812.989990,-3718.500732,10.572,0, ''), + (3465,21,-1788.171265,-3722.867188,9.663,0, ''), + (3465,22,-1767.206665,-3739.923096,10.082,0, ''), + (3465,23,-1750.194580,-3747.392090,10.390,0, ''), + (3465,24,-1729.335571,-3776.665527,11.779,0, ''), + (3465,25,-1715.997925,-3802.404541,12.618,0, ''), + (3465,26,-1690.711548,-3829.262451,13.905,0, ''), + (3465,27,-1674.700684,-3842.398682,13.872,0, ''), + (3465,28,-1632.726318,-3846.109619,14.401,0, ''), + (3465,29,-1592.734497,-3842.225342,14.981,0, ''), + (3465,30,-1561.614746,-3839.320801,19.118,0, ''), + (3465,31,-1544.567627,-3834.393311,18.761,0, ''), + (3465,32,-1512.514404,-3831.715820,22.914,0, ''), + (3465,33,-1486.889771,-3836.639893,23.964,0, ''), + (3465,34,-1434.193604,-3852.702881,18.843,0, ''), + (3465,35,-1405.794678,-3854.488037,17.276,0, ''), + (3465,36,-1366.592041,-3852.383789,19.273,0, ''), + (3465,37,-1337.360962,-3837.827148,17.352,2000, 'SAY_GIL_ALMOST'), + (3465,38,-1299.744507,-3810.691406,20.801,0, ''), + (3465,39,-1277.144409,-3782.785156,25.918,0, ''), + (3465,40,-1263.686768,-3781.251953,26.447,0, ''), + (3465,41,-1243.674438,-3786.328125,25.281,0, ''), + (3465,42,-1221.875488,-3784.124512,24.051,0, ''), + (3465,43,-1204.011230,-3775.943848,24.437,0, ''), + (3465,44,-1181.706787,-3768.934082,23.368,0, ''), + (3465,45,-1156.913818,-3751.559326,21.074,0, ''), + (3465,46,-1138.830688,-3741.809326,17.843,0, ''), + (3465,47,-1080.101196,-3738.780029,19.805,0, 'SAY_GIL_SWEET'), + (3465,48,-1069.065186,-3735.006348,19.302,0, ''), + (3465,49,-1061.941040,-3724.062256,21.086,0, ''), + (3465,50,-1053.593262,-3697.608643,27.320,0, ''), + (3465,51,-1044.110474,-3690.133301,24.856,0, ''), + (3465,52,-1040.260986,-3690.739014,25.342,0, ''), + (3465,53,-1028.146606,-3688.718750,23.843,7500, 'SAY_GIL_FREED'); + +DELETE FROM `script_waypoint` WHERE `entry`=10646; +INSERT INTO `script_waypoint` VALUES + (10646,0,-4792.401855,-2137.775146,82.423,0, ''), + (10646,1,-4813.508301,-2141.543457,80.774,0, ''), + (10646,2,-4828.630859,-2154.309814,82.074,0, ''), + (10646,3,-4833.772949,-2149.182617,81.676,0, ''), + (10646,4,-4846.418945,-2136.045410,77.871,0, ''), + (10646,5,-4865.076660,-2116.549561,76.483,0, ''), + (10646,6,-4888.434570,-2090.729248,80.907,0, ''), + (10646,7,-4893.068359,-2085.468994,82.094,0, ''), + (10646,8,-4907.256836,-2074.929932,84.437,5000, 'SAY_LAKO_LOOK_OUT'), + (10646,9,-4899.899902,-2062.143555,83.780,0, ''), + (10646,10,-4897.762207,-2056.520020,84.184,0, ''), + (10646,11,-4888.331543,-2033.182495,83.654,0, ''), + (10646,12,-4876.343750,-2003.916138,90.887,0, ''), + (10646,13,-4872.227051,-1994.173340,91.513,0, ''), + (10646,14,-4879.569336,-1976.985229,92.185,5000, 'SAY_LAKO_HERE_COME'), + (10646,15,-4879.049316,-1964.349609,92.001,0, ''), + (10646,16,-4874.720215,-1956.939819,90.737,0, ''), + (10646,17,-4869.474609,-1952.612671,89.206,0, ''), + (10646,18,-4842.466797,-1929.000732,84.147,0, ''), + (10646,19,-4804.444824,-1897.302734,89.362,0, ''), + (10646,20,-4798.072754,-1892.383545,89.368,0, ''), + (10646,21,-4779.447754,-1882.759155,90.169,5000, 'SAY_LAKO_MORE'), + (10646,22,-4762.081055,-1866.530640,89.481,0, ''), + (10646,23,-4766.267090,-1861.867798,87.847,0, ''), + (10646,24,-4782.929688,-1852.174683,78.354,0, ''), + (10646,25,-4793.605469,-1850.961182,77.658,0, ''), + (10646,26,-4803.323730,-1855.102661,78.958,0, ''), + (10646,27,-4807.971680,-1854.501221,77.743,0, ''), + (10646,28,-4837.212891,-1848.493408,64.488,0, ''), + (10646,29,-4884.619629,-1840.401123,56.219,0, ''), + (10646,30,-4889.705566,-1839.623291,54.417,0, ''), + (10646,31,-4893.904297,-1843.685791,53.012,0, ''), + (10646,32,-4903.142090,-1872.383545,32.266,0, ''), + (10646,33,-4910.940918,-1879.864868,29.940,0, ''), + (10646,34,-4920.047363,-1880.940796,30.597,0, ''), + (10646,35,-4924.457031,-1881.447144,29.292,0, ''), + (10646,36,-4966.120117,-1886.033081,10.977,0, ''), + (10646,37,-4999.369629,-1890.847290,4.430,0, ''), + (10646,38,-5007.271484,-1891.669678,2.771,0, ''), + (10646,39,-5013.334473,-1879.588257,-1.947,0, ''), + (10646,40,-5023.328613,-1855.959961,-17.103,0, ''), + (10646,41,-5038.513184,-1825.986694,-35.821,0, ''), + (10646,42,-5048.733887,-1809.798218,-46.457,0, ''), + (10646,43,-5053.188965,-1791.682983,-57.186,0, ''), + (10646,44,-5062.093750,-1794.399780,-56.515,0, ''), + (10646,45,-5052.657227,-1797.044800,-54.734,5000, 'SAY_LAKO_END'); + +DELETE FROM `script_waypoint` WHERE `entry`=10427; +INSERT INTO `script_waypoint` VALUES + (10427,0,-5185.463,-1185.927,45.951,0, ''), + (10427,1,-5184.880,-1154.210,45.035,0, ''), + (10427,2,-5175.880,-1126.526,43.701,0, ''), + (10427,3,-5138.651,-1111.874,44.024,0, ''), + (10427,4,-5134.728,-1104.796,47.365,0, ''), + (10427,5,-5129.681,-1097.878,49.449,2500, ''), + (10427,6,-5125.303,-1080.572,47.033,0, ''), + (10427,7,-5146.668,-1053.694,28.415,0, ''), + (10427,8,-5147.463,-1027.539,13.818,0, ''), + (10427,9,-5139.238,-1018.889,8.220,0, ''), + (10427,10,-5121.168,-1013.126,-0.619,0, ''), + (10427,11,-5091.919,-1014.205,-4.902,0, ''), + (10427,12,-5069.240,-994.299,-4.631,0, ''), + (10427,13,-5059.975,-944.112,-5.377,0, ''), + (10427,14,-5013.546,-906.184,-5.490,0, ''), + (10427,15,-4992.461,-920.983,-4.980,5000, 'SAY_WYVERN'), + (10427,16,-4976.355,-1002.997,-5.380,0, ''), + (10427,17,-4958.478,-1033.185,-5.433,0, ''), + (10427,18,-4953.353,-1052.211,-10.836,0, ''), + (10427,19,-4937.447,-1056.351,-22.139,0, ''), + (10427,20,-4908.455,-1050.433,-33.458,0, ''), + (10427,21,-4905.530,-1056.885,-33.722,0, ''), + (10427,22,-4920.830,-1073.284,-45.515,0, ''), + (10427,23,-4933.368,-1082.700,-50.186,0, ''), + (10427,24,-4935.313,-1092.353,-52.785,0, ''), + (10427,25,-4929.553,-1101.268,-50.637,0, ''), + (10427,26,-4920.679,-1100.028,-51.944,10000, 'SAY_COMPLETE'), + (10427,27,-4920.679,-1100.028,-51.944,0, 'quest complete'); + +DELETE FROM `script_waypoint` WHERE `entry`=16812; +INSERT INTO `script_waypoint` VALUES + (16812,0,-10868.260,-1779.836,90.476,2500, 'Open door,begin walking'), + (16812,1,-10875.585,-1779.581,90.478,0, ''), + (16812,2,-10887.447,-1779.258,90.476,0, ''), + (16812,3,-10894.592,-1780.668,90.476,0, ''), + (16812,4,-10895.015,-1782.036,90.476,2500, 'Begin Speech after this'), + (16812,5,-10894.592,-1780.668,90.476,0, 'Resume walking (back to spawn point now) after speech'), + (16812,6,-10887.447,-1779.258,90.476,0, ''), + (16812,7,-10875.585,-1779.581,90.478,0, ''), + (16812,8,-10868.260,-1779.836,90.476,5000, 'close door'), + (16812,9,-10866.799,-1780.958,90.470,2000, 'Summon mobs,open curtains'); + +DELETE FROM `script_waypoint` WHERE `entry`=28912; +INSERT INTO `script_waypoint` VALUES + (28912,0,1653.518,-6038.374,127.585,0, 'Jump off'), + (28912,1,1653.978,-6034.614,127.585,5000, 'To Box'), + (28912,2,1653.854,-6034.726,127.585,500, 'Equip'), + (28912,3,1652.297,-6035.671,127.585,3000, 'Recover'), + (28912,4,1639.762,-6046.343,127.948,0, 'Escape'), + (28912,5,1640.963,-6028.119,134.740,0, ''), + (28912,6,1625.805,-6029.197,134.740,0, ''), + (28912,7,1626.845,-6015.085,134.740,0, ''), + (28912,8,1649.150,-6016.975,133.240,0, ''), + (28912,9,1653.063,-5974.844,132.652,5000, 'Mount'), + (28912,10,1654.747,-5926.424,121.191,0, 'Disappear'); + +DELETE FROM `script_waypoint` WHERE `entry`=11856; +INSERT INTO `script_waypoint` VALUES + (11856,0,113.91,-350.13,4.55,0, ''), + (11856,1,109.54,-350.08,3.74,0, ''), + (11856,2,106.95,-353.40,3.60,0, ''), + (11856,3,100.28,-338.89,2.97,0, ''), + (11856,4,110.11,-320.26,3.47,0, ''), + (11856,5,109.78,-287.80,5.30,0, ''), + (11856,6,105.02,-269.71,4.71,0, ''), + (11856,7,86.71,-251.81,5.34,0, ''), + (11856,8,64.10,-246.38,5.91,0, ''), + (11856,9,-2.55,-243.58,6.3,0, ''), + (11856,10,-27.78,-267.53,-1.08,0, ''), + (11856,11,-31.27,-283.54,-4.36,0, ''), + (11856,12,-28.96,-322.44,-9.19,0, ''), + (11856,13,-35.63,-360.03,-16.59,0, ''), + (11856,14,-58.30,-412.26,-30.60,0, ''), + (11856,15,-58.88,-474.17,-44.54,0, ''), + (11856,16,-45.92,-496.57,-46.26,5000, 'AMBUSH'), + (11856,17,-40.25,-510.07,-46.05,0, ''), + (11856,18,-38.88,-520.72,-46.06,5000, 'END'); + +/* Harrison Jones Zul'Aman - Bad sd2 merge leftover +DELETE FROM `script_waypoint` WHERE `entry`=24358; +INSERT INTO `script_waypoint` VALUES + (24358,0,121.193970,1645.619385,42.021,0, ''), + (24358,1,132.051468,1642.176025,42.021,5000, 'SAY_AT_GONG'), + (24358,2,120.670631,1636.346802,42.415,0, ''), + (24358,3,120.536003,1611.654663,43.473,10000, 'SAY_OPEN_ENTRANCE'), + (24358,4,120.536003,1611.654663,43.473,0, '');*/ + +DELETE FROM `script_waypoint` WHERE `entry`=16295; +INSERT INTO `script_waypoint` VALUES + (16295,0,7545.070000,-7359.870000,162.354000,4000, 'SAY_START'), + (16295,1,7550.048340,-7362.237793,162.235657,0, ''), + (16295,2,7566.976074,-7364.315430,161.738770,0, ''), + (16295,3,7578.830566,-7361.677734,161.738770,0, ''), + (16295,4,7590.969238,-7359.053711,162.257660,0, ''), + (16295,5,7598.354004,-7362.815430,162.256683,4000, 'SAY_PROGRESS_1'), + (16295,6,7605.861328,-7380.424316,161.937073,0, ''), + (16295,7,7605.295410,-7387.382813,157.253998,0, ''), + (16295,8,7606.131836,-7393.893555,156.941925,0, ''), + (16295,9,7615.207520,-7400.187012,157.142639,0, ''), + (16295,10,7618.956543,-7402.652832,158.202042,0, ''), + (16295,11,7636.850586,-7401.756836,162.144791,0, 'SAY_PROGRESS_2'), + (16295,12,7637.058105,-7404.944824,162.206970,4000, ''), + (16295,13,7636.910645,-7412.585449,162.366425,0, ''), + (16295,14,7637.607910,-7425.591797,162.630661,0, ''), + (16295,15,7637.816895,-7459.057129,163.302704,0, ''), + (16295,16,7638.859863,-7470.902344,162.517059,0, ''), + (16295,17,7641.395996,-7488.217285,157.381287,0, ''), + (16295,18,7634.455566,-7505.451660,154.682159,0, 'SAY_PROGRESS_3'), + (16295,19,7631.906738,-7516.948730,153.597382,0, ''), + (16295,20,7622.231445,-7537.037598,151.587112,0, ''), + (16295,21,7610.921875,-7550.670410,149.639374,0, ''), + (16295,22,7598.229004,-7562.551758,145.953888,0, ''), + (16295,23,7588.509277,-7577.755371,148.294479,0, ''), + (16295,24,7567.339355,-7608.456055,146.006485,0, ''), + (16295,25,7562.547852,-7617.417969,148.097504,0, ''), + (16295,26,7561.508789,-7645.064453,151.245163,0, ''), + (16295,27,7563.337402,-7654.652344,151.227158,0, ''), + (16295,28,7565.533691,-7658.296387,151.248886,0, ''), + (16295,39,7571.155762,-7659.118652,151.244568,0, ''), + (16295,30,7579.119629,-7662.213867,151.651505,0, 'quest complete'), + (16295,31,7603.768066,-7667.000488,153.997726,0, ''), + (16295,32,7603.768066,-7667.000488,153.997726,4000, 'SAY_END_1'), + (16295,33,7603.768066,-7667.000488,153.997726,8000, 'SAY_END_2'), + (16295,34,7603.768066,-7667.000488,153.997726,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=17969; +INSERT INTO `script_waypoint` VALUES + (17969,0,-930.048950,5288.080078,23.848402,0, ''), + (17969,1,-925.677917,5296.482910,18.183748,0, ''), + (17969,2,-924.297180,5299.016113,17.710915,0, ''), + (17969,3,-928.390076,5317.022949,18.208593,0, ''), + (17969,4,-930.620972,5329.915039,18.773422,0, 'SAY_AMBUSH1'), + (17969,5,-931.490295,5357.654785,18.027155,0, 'SAY_PROGRESS'), + (17969,6,-934.777771,5369.341797,22.278048,0, ''), + (17969,7,-934.521851,5373.407227,22.834690,0, ''), + (17969,8,-937.008545,5382.980469,22.699078,0, ''), + (17969,9,-941.948059,5404.141602,22.669743,0, ''), + (17969,10,-931.244263,5415.846680,23.063961,0, 'at crossroad'), + (17969,11,-901.497925,5420.315430,24.213270,0, ''), + (17969,12,-860.311707,5415.617676,23.671139,0, ''), + (17969,13,-777.988953,5391.982422,23.001669,0, ''), + (17969,14,-750.362000,5385.786621,22.765791,0, ''), + (17969,15,-731.339417,5382.449707,22.517065,0, ''), + (17969,16,-681.235901,5381.377930,22.050159,2500, 'end bridge SAY_AMBUSH2'), + (17969,17,-637.944458,5384.338379,22.205647,0, 'SAY_END'), + (17969,18,-608.954407,5408.715332,21.630386,0, ''), + (17969,19,-598.134277,5413.608398,21.412275,0, ''), + (17969,20,-571.268982,5420.771973,21.184925,0, ''), + (17969,21,-553.099915,5424.616211,21.193716,0, ''), + (17969,22,-524.745483,5443.945313,20.977013,0, ''), + (17969,23,-502.984985,5446.283691,22.149435,0, ''), + (17969,24,-472.463959,5449.546875,22.561453,0, ''), + (17969,25,-454.533264,5461.302246,22.602837,30000, 'quest complete'); + +DELETE FROM `script_waypoint` WHERE `entry`=467; +INSERT INTO `script_waypoint` VALUES + (467,0,-10508.40,1068.00,55.21,0, ''), + (467,1,-10518.30,1074.84,53.96,0, ''), + (467,2,-10534.82,1081.92,49.88,0, ''), + (467,3,-10546.51,1084.88,50.13,0, ''), + (467,4,-10555.29,1084.45,45.75,0, ''), + (467,5,-10566.57,1083.53,42.10,0, ''), + (467,6,-10575.83,1082.34,39.46,0, ''), + (467,7,-10585.67,1081.08,37.77,0, ''), + (467,8,-10600.08,1078.19,36.23,0, ''), + (467,9,-10608.69,1076.08,35.88,0, ''), + (467,10,-10621.26,1073.00,35.40,0, ''), + (467,11,-10638.12,1060.18,33.61,0, ''), + (467,12,-10655.87,1038.99,33.48,0, ''), + (467,13,-10664.68,1030.54,32.70,0, ''), + (467,14,-10708.68,1033.86,33.32,0, ''), + (467,15,-10754.43,1017.93,32.79,0, ''), + (467,16,-10802.26,1018.01,32.16,0, ''), + (467,17,-10832.60,1009.04,32.71,0, ''), + (467,18,-10866.56,1006.51,31.71,0, ''), + (467,19,-10879.98,1005.10,32.84,0, ''), + (467,20,-10892.45,1001.32,34.46,0, ''), + (467,21,-10906.14,997.11,36.15,0, ''), + (467,22,-10922.26,1002.23,35.74,0, ''), + (467,23,-10936.32,1023.38,36.52,0, ''), + (467,24,-10933.35,1052.61,35.85,0, ''), + (467,25,-10940.25,1077.66,36.49,0, ''), + (467,26,-10957.09,1099.33,36.83,0, ''), + (467,27,-10956.53,1119.90,36.73,0, ''), + (467,28,-10939.30,1150.75,37.42,0, ''), + (467,29,-10915.14,1202.09,36.55,0, ''), + (467,30,-10892.59,1257.03,33.37,0, ''), + (467,31,-10891.93,1306.66,35.45,0, ''), + (467,32,-10896.17,1327.86,37.77,0, ''), + (467,33,-10906.03,1368.05,40.91,0, ''), + (467,34,-10910.18,1389.33,42.62,0, ''), + (467,35,-10915.42,1417.72,42.93,0, ''), + (467,36,-10926.37,1421.18,43.04,0, 'walk here and say'), + (467,37,-10952.31,1421.74,43.40,0, ''), + (467,38,-10980.04,1411.38,42.79,0, ''), + (467,39,-11006.06,1420.47,43.26,0, ''), + (467,40,-11021.98,1450.59,43.09,0, ''), + (467,41,-11025.36,1491.59,43.15,0, ''), + (467,42,-11036.09,1508.32,43.28,0, ''), + (467,43,-11060.68,1526.72,43.19,0, ''), + (467,44,-11072.75,1527.77,43.20,5000, 'say and quest credit'); + +DELETE FROM `script_waypoint` WHERE `entry`=2768; +INSERT INTO `script_waypoint` VALUES + (2768,0,-2077.73,-2091.17,9.49,0, ''), + (2768,1,-2077.99,-2105.33,13.24,0, ''), + (2768,2,-2074.60,-2109.67,14.24,0, ''), + (2768,3,-2076.60,-2117.46,16.67,0, ''), + (2768,4,-2073.51,-2123.46,18.42,2000, ''), + (2768,5,-2073.51,-2123.46,18.42,4000, ''), + (2768,6,-2066.60,-2131.85,21.56,0, ''), + (2768,7,-2053.85,-2143.19,20.31,0, ''), + (2768,8,-2043.49,-2153.73,20.20,10000, ''), + (2768,9,-2043.49,-2153.73,20.20,20000, ''), + (2768,10,-2043.49,-2153.73,20.20,10000, ''), + (2768,11,-2043.49,-2153.73,20.20,2000, ''), + (2768,12,-2053.85,-2143.19,20.31,0, ''), + (2768,13,-2066.60,-2131.85,21.56,0, ''), + (2768,14,-2073.51,-2123.46,18.42,0, ''), + (2768,15,-2076.60,-2117.46,16.67,0, ''), + (2768,16,-2074.60,-2109.67,14.24,0, ''), + (2768,17,-2077.99,-2105.33,13.24,0, ''), + (2768,18,-2077.73,-2091.17,9.49,0, ''), + (2768,19,-2066.41,-2086.21,8.97,6000, ''), + (2768,20,-2066.41,-2086.21,8.97,2000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=12818; +INSERT INTO `script_waypoint` VALUES + (12818,0,3347.250089,-694.700989,159.925995,0, ''), + (12818,1,3341.527039,-694.725891,161.124542,4000, ''), + (12818,2,3338.351074,-686.088138,163.444000,0, ''), + (12818,3,3352.744873,-677.721741,162.316269,0, ''), + (12818,4,3370.291016,-669.366943,160.751358,0, ''), + (12818,5,3381.479492,-659.449097,162.545303,0, ''), + (12818,6,3389.554199,-648.500000,163.651825,0, ''), + (12818,7,3396.645020,-641.508911,164.216019,0, ''), + (12818,8,3410.498535,-634.299622,165.773453,0, ''), + (12818,9,3418.461426,-631.791992,166.477615,0, ''), + (12818,10,3429.500000,-631.588745,166.921265,0, ''), + (12818,11,3434.950195,-629.245483,168.333969,0, ''), + (12818,12,3438.927979,-618.503235,171.503143,0, ''), + (12818,13,3444.217529,-609.293640,173.077972,1000, 'Ambush 1'), + (12818,14,3460.505127,-593.794189,174.342255,0, ''), + (12818,15,3480.283203,-578.210327,176.652313,0, ''), + (12818,16,3492.912842,-562.335449,181.396301,0, ''), + (12818,17,3495.230957,-550.977600,184.652267,0, ''), + (12818,18,3496.247070,-529.194214,188.172028,0, ''), + (12818,19,3497.619385,-510.411499,188.345322,1000, 'Ambush 2'), + (12818,20,3498.498047,-497.787506,185.806274,0, ''), + (12818,21,3484.218750,-489.717529,182.389862,4000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=12858; +INSERT INTO `script_waypoint` VALUES + (12858,0,1782.63,-2241.11,109.73,5000, ''), + (12858,1,1788.88,-2240.17,111.71,0, ''), + (12858,2,1797.49,-2238.11,112.31,0, ''), + (12858,3,1803.83,-2232.77,111.22,0, ''), + (12858,4,1806.65,-2217.83,107.36,0, ''), + (12858,5,1811.81,-2208.01,107.45,0, ''), + (12858,6,1820.85,-2190.82,100.49,0, ''), + (12858,7,1829.60,-2177.49,96.44,0, ''), + (12858,8,1837.98,-2164.19,96.71,0, 'prepare'), + (12858,9,1839.99,-2149.29,96.78,0, ''), + (12858,10,1835.14,-2134.98,96.80,0, ''), + (12858,11,1823.57,-2118.27,97.43,0, ''), + (12858,12,1814.99,-2110.35,98.38,0, ''), + (12858,13,1806.60,-2103.09,99.19,0, ''), + (12858,14,1798.27,-2095.77,100.04,0, ''), + (12858,15,1783.59,-2079.92,100.81,0, ''), + (12858,16,1776.79,-2069.48,101.77,0, ''), + (12858,17,1776.82,-2054.59,109.82,0, ''), + (12858,18,1776.88,-2047.56,109.83,0, ''), + (12858,19,1776.86,-2036.55,109.83,0, ''), + (12858,20,1776.90,-2024.56,109.83,0, 'win'), + (12858,21,1776.87,-2028.31,109.83,60000, 'stay'), + (12858,22,1776.90,-2028.30,109.83,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=15420; +INSERT INTO `script_waypoint` VALUES + (15420,0,9294.78,-6682.51,22.42,0, ''), + (15420,1,9298.27,-6667.99,22.42,0, ''), + (15420,2,9309.63,-6658.84,22.43,0, ''), + (15420,3,9304.43,-6649.31,26.46,0, ''), + (15420,4,9298.83,-6648.00,28.61,0, ''), + (15420,5,9291.06,-6653.46,31.83,2500, ''), + (15420,6,9289.08,-6660.17,31.85,5000, ''), + (15420,7,9291.06,-6653.46,31.83,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=16993; +INSERT INTO `script_waypoint` VALUES + (16993,0,-1137.72,4272.10,14.04,5000, ''), + (16993,1,-1141.34,4232.42,14.63,0, ''), + (16993,2,-1133.47,4220.88,11.78,0, ''), + (16993,3,-1126.18,4213.26,13.51,0, ''), + (16993,4,-1100.12,4204.32,16.41,0, ''), + (16993,5,-1063.68,4197.92,15.51,0, ''), + (16993,6,-1027.28,4194.36,15.52,0, ''), + (16993,7,-995.68,4189.59,19.84,0, ''), + (16993,8,-970.90,4188.60,24.61,0, ''), + (16993,9,-961.93,4193.34,26.11,15000, 'Summon 1'), + (16993,10,-935.52,4210.99,31.98,0, ''), + (16993,11,-913.42,4218.27,37.29,0, ''), + (16993,12,-896.53,4207.73,43.23,0, ''), + (16993,13,-868.49,4194.77,46.75,30000, 'Kneel and Rest Here'), + (16993,14,-852.83,4198.29,47.28,15000, 'Summon 2'), + (16993,15,-819.85,4200.50,46.37,0, ''), + (16993,16,-791.92,4201.96,44.19,0, ''), + (16993,17,-774.42,4202.46,47.41,0, ''), + (16993,18,-762.90,4202.17,48.81,0, ''), + (16993,19,-728.25,4195.35,50.68,0, ''), + (16993,20,-713.58,4192.07,53.98,0, ''), + (16993,21,-703.09,4189.74,56.96,0, ''), + (16993,22,-693.70,4185.43,57.06,0, ''), + (16993,23,-686.38,4159.81,60.26,0, ''), + (16993,24,-679.88,4147.04,64.20,0, ''), + (16993,25,-656.74,4147.72,64.11,0, ''), + (16993,26,-652.22,4137.50,64.58,0, ''), + (16993,27,-649.99,4136.38,64.63,30000, 'Quest Credit'); + +DELETE FROM `script_waypoint` WHERE `entry`=17312; +INSERT INTO `script_waypoint` VALUES + (17312,0,-4784.532227,-11051.060547,3.484263,0, ''), + (17312,1,-4805.509277,-11037.293945,3.043942,0, ''), + (17312,2,-4827.826172,-11034.398438,1.741959,0, ''), + (17312,3,-4852.630859,-11033.695313,2.208656,0, ''), + (17312,4,-4876.791992,-11034.517578,3.175228,0, ''), + (17312,5,-4895.486816,-11038.306641,9.390890,0, ''), + (17312,6,-4915.464844,-11048.402344,12.369793,0, ''), + (17312,7,-4937.288086,-11067.041992,13.857983,0, ''), + (17312,8,-4966.577637,-11067.507813,15.754786,0, ''), + (17312,9,-4993.799805,-11056.544922,19.175295,0, ''), + (17312,10,-5017.836426,-11052.569336,22.476587,0, ''), + (17312,11,-5039.706543,-11058.459961,25.831593,0, ''), + (17312,12,-5057.289063,-11045.474609,26.972496,0, ''), + (17312,13,-5078.828125,-11037.601563,29.053417,0, ''), + (17312,14,-5104.158691,-11039.195313,29.440195,0, ''), + (17312,15,-5120.780273,-11039.518555,30.142139,0, ''), + (17312,16,-5140.833008,-11039.810547,28.788074,0, ''), + (17312,17,-5161.201660,-11040.050781,27.879545,4000, ''), + (17312,18,-5171.842285,-11046.803711,27.183821,0, ''), + (17312,19,-5185.995117,-11056.359375,20.234867,0, ''), + (17312,20,-5198.485840,-11065.065430,18.872593,0, ''), + (17312,21,-5214.062500,-11074.653320,19.215731,0, ''), + (17312,22,-5220.157227,-11088.377930,19.818476,0, ''), + (17312,23,-5233.652832,-11098.846680,18.349432,0, ''), + (17312,24,-5250.163086,-11111.653320,16.438959,0, ''), + (17312,25,-5268.194336,-11125.639648,12.668313,0, ''), + (17312,26,-5286.270508,-11130.669922,6.912246,0, ''), + (17312,27,-5317.449707,-11137.392578,4.963446,0, ''), + (17312,28,-5334.854492,-11154.384766,6.742664,0, ''), + (17312,29,-5353.874512,-11171.595703,6.903912,20000, ''), + (17312,30,-5354.240000,-11171.940000,6.890000,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=19685; +INSERT INTO `script_waypoint` VALUES + (19685,0,-1863.369019,5419.517090,-10.463668,5000, ''), + (19685,1,-1861.749023,5416.465332,-10.508068,0, ''), + (19685,2,-1857.036133,5410.966309,-12.428039,0, ''), + (19685,3,-1831.539185,5365.472168,-12.428039,0, ''), + (19685,4,-1813.416504,5333.776855,-12.428039,0, ''), + (19685,5,-1800.354370,5313.290039,-12.428039,0, ''), + (19685,6,-1775.624878,5268.786133,-38.809181,0, ''), + (19685,7,-1770.147339,5259.268066,-38.829231,0, ''), + (19685,8,-1762.814209,5261.098145,-38.848995,0, ''), + (19685,9,-1740.110474,5268.858398,-40.208965,0, ''), + (19685,10,-1725.837402,5270.936035,-40.208965,0, ''), + (19685,11,-1701.580322,5290.323242,-40.209187,0, ''), + (19685,12,-1682.877808,5291.406738,-34.429646,0, ''), + (19685,13,-1670.101685,5291.201172,-32.786007,0, ''), + (19685,14,-1656.666870,5294.333496,-37.862648,0, ''), + (19685,15,-1652.035767,5295.413086,-40.245499,0, ''), + (19685,16,-1620.860596,5300.133301,-40.208992,0, ''), + (19685,17,-1607.630981,5293.983398,-38.577045,5000, ''), + (19685,18,-1607.630981,5293.983398,-38.577045,5000, ''), + (19685,19,-1607.630981,5293.983398,-38.577045,5000, ''), + (19685,20,-1622.140869,5301.955566,-40.208897,0, ''), + (19685,21,-1621.131836,5333.112793,-40.208897,0, ''), + (19685,22,-1637.598999,5342.134277,-40.208790,0, ''), + (19685,23,-1648.521606,5352.309570,-47.496170,0, ''), + (19685,24,-1654.606934,5357.419434,-45.870892,0, ''), + (19685,25,-1633.670044,5422.067871,-42.835541,0, ''), + (19685,26,-1656.567505,5426.236328,-40.405815,0, ''), + (19685,27,-1664.932373,5425.686523,-38.846405,0, ''), + (19685,28,-1681.406006,5425.871094,-38.810928,0, ''), + (19685,29,-1730.875977,5427.413574,-12.427910,0, ''), + (19685,30,-1743.509521,5369.599121,-12.427910,0, ''), + (19685,31,-1877.217041,5303.710449,-12.427989,0, ''), + (19685,32,-1890.371216,5289.273438,-12.428268,0, ''), + (19685,33,-1905.505737,5266.534668,2.630672,0, ''), + (19685,34,-1909.381348,5273.008301,1.663714,10000, ''), + (19685,35,-1909.381348,5273.008301,1.663714,12000, ''), + (19685,36,-1909.381348,5273.008301,1.663714,8000, ''), + (19685,37,-1909.381348,5273.008301,1.663714,15000, ''), + (19685,38,-1927.561401,5275.324707,1.984987,0, ''), + (19685,39,-1927.385498,5300.879883,-12.427236,0, ''), + (19685,40,-1921.063965,5314.318359,-12.427236,0, ''), + (19685,41,-1965.425415,5379.298828,-12.427236,0, ''), + (19685,42,-1981.233154,5450.743652,-12.427236,0, ''), + (19685,43,-1958.022461,5455.904297,0.487659,0, ''), + (19685,44,-1951.991455,5463.580566,0.874490,10000, ''), + (19685,45,-1951.991455,5463.580566,0.874490,12000, ''), + (19685,46,-1968.730225,5481.752930,-12.427846,0, ''), + (19685,47,-1881.839844,5554.040039,-12.427846,0, ''), + (19685,48,-1841.566650,5545.965332,-12.427846,0, ''), + (19685,49,-1837.658325,5523.780273,0.558756,0, ''), + (19685,50,-1831.321777,5534.821777,1.221819,6000, ''), + (19685,51,-1831.321777,5534.821777,1.221819,8000, ''), + (19685,52,-1831.321777,5534.821777,1.221819,5000, ''), + (19685,53,-1850.060669,5472.610840,0.857320,6000, ''), + (19685,54,-1850.060669,5472.610840,0.857320,8000, ''), + (19685,55,-1850.060669,5472.610840,0.857320,9000, ''), + (19685,56,-1850.060669,5472.610840,0.857320,9000, ''), + (19685,57,-1850.060669,5472.610840,0.857320,4000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=20129; +INSERT INTO `script_waypoint` VALUES + (20129,0,-8374.93,-4250.21,-204.38,5000, ''), + (20129,1,-8374.93,-4250.21,-204.38,16000, ''), + (20129,2,-8374.93,-4250.21,-204.38,10000, ''), + (20129,3,-8374.93,-4250.21,-204.38,2000, ''), + (20129,4,-8439.40,-4180.05,-209.25,0, ''), + (20129,5,-8437.82,-4120.84,-208.59,10000, ''), + (20129,6,-8437.82,-4120.84,-208.59,16000, ''), + (20129,7,-8437.82,-4120.84,-208.59,13000, ''), + (20129,8,-8437.82,-4120.84,-208.59,18000, ''), + (20129,9,-8437.82,-4120.84,-208.59,15000, ''), + (20129,10,-8437.82,-4120.84,-208.59,2000, ''), + (20129,11,-8467.26,-4198.63,-214.21,0, ''), + (20129,12,-8667.76,-4252.13,-209.56,0, ''), + (20129,13,-8703.71,-4234.58,-209.5,14000, ''), + (20129,14,-8703.71,-4234.58,-209.5,2000, ''), + (20129,15,-8642.81,-4304.37,-209.57,0, ''), + (20129,16,-8649.06,-4394.36,-208.46,6000, ''), + (20129,17,-8649.06,-4394.36,-208.46,18000, ''), + (20129,18,-8649.06,-4394.36,-208.46,2000, ''), + (20129,19,-8468.72,-4437.67,-215.45,0, ''), + (20129,20,-8427.54,-4426,-211.13,0, ''), + (20129,21,-8364.83,-4393.32,-205.91,0, ''), + (20129,22,-8304.54,-4357.2,-208.2,18000, ''), + (20129,23,-8304.54,-4357.2,-208.2,2000, ''), + (20129,24,-8375.42,-4250.41,-205.14,5000, ''), + (20129,25,-8375.42,-4250.41,-205.14,5000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=6575; +INSERT INTO `script_waypoint` VALUES + (6575,0,1945.81,-431.54,16.36,0, ''), + (6575,1,1946.21,-436.41,16.36,0, ''), + (6575,2,1950.01,-444.11,14.63,0, ''), + (6575,3,1956.08,-449.34,13.12,0, ''), + (6575,4,1966.59,-450.55,11.27,0, ''), + (6575,5,1976.09,-447.51,11.27,0, ''), + (6575,6,1983.42,-435.85,11.27,0, ''), + (6575,7,1978.17,-428.81,11.27,0, ''), + (6575,8,1973.97,-422.08,9.04,0, ''), + (6575,9,1963.84,-418.90,6.17,0, ''), + (6575,10,1961.22,-422.74,6.17,0, ''), + (6575,11,1964.80,-431.26,6.17,300000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=3849; +INSERT INTO `script_waypoint` VALUES + (3849,0,-252.92,2126.82,81.17,0, ''), + (3849,1,-253.88,2131.11,81.21,0, ''), + (3849,2,-249.66,2142.45,87.01,0, ''), + (3849,3,-248.08,2143.68,87.01,0, ''), + (3849,4,-238.87,2139.93,87.01,0, ''), + (3849,5,-235.47,2149.18,90.59,0, ''), + (3849,6,-239.89,2156.06,90.62,20000, 'SAY_FREE'); + +DELETE FROM `script_waypoint` WHERE `entry`=3850; +INSERT INTO `script_waypoint` VALUES + (3850,0,-255.33,2117.99,81.17,0, ''), + (3850,1,-253.88,2131.11,81.21,0, ''), + (3850,2,-249.66,2142.45,87.01,0, ''), + (3850,3,-248.08,2143.68,87.01,0, ''), + (3850,4,-238.87,2139.93,87.01,0, ''), + (3850,5,-235.47,2149.18,90.59,0, ''), + (3850,6,-239.89,2156.06,90.62,20000, 'SAY_FREE'); + +DELETE FROM `script_waypoint` WHERE `entry`=3849; +INSERT INTO `script_waypoint` VALUES + (3849,0,-250.923431,2116.264160,81.179,0, 'SAY_FREE_AD'), + (3849,1,-255.048538,2119.392578,81.179,0, ''), + (3849,2,-254.129105,2123.454346,81.179,0, ''), + (3849,3,-253.897552,2130.873535,81.179,0, ''), + (3849,4,-249.889435,2142.307861,86.972,0, ''), + (3849,5,-248.204926,2144.017090,87.013,0, ''), + (3849,6,-240.552826,2140.552734,87.012,0, ''), + (3849,7,-237.513916,2142.066650,87.012,0, ''), + (3849,8,-235.638138,2149.231689,90.587,0, ''), + (3849,9,-237.188019,2151.946045,90.624,0, ''), + (3849,10,-241.162064,2153.649658,90.624,0, 'SAY_OPEN_DOOR_AD'), + (3849,11,-241.129700,2154.562988,90.624,5000, ''), + (3849,12,-241.129700,2154.562988,90.624,5000, 'SAY_POST1_DOOR_AD'), + (3849,13,-241.129700,2154.562988,90.624,25000, 'SAY_POST2_DOOR_AD'); + +DELETE FROM `script_waypoint` WHERE `entry`=3850; +INSERT INTO `script_waypoint` VALUES + (3850,0,-241.816895,2122.904053,81.179,0, 'SAY_FREE_AS'), + (3850,1,-247.139297,2124.886475,81.179,0, ''), + (3850,2,-253.179184,2127.406738,81.179,0, ''), + (3850,3,-253.897552,2130.873535,81.179,0, ''), + (3850,4,-249.889435,2142.307861,86.972,0, ''), + (3850,5,-248.204926,2144.017090,87.013,0, ''), + (3850,6,-240.552826,2140.552734,87.012,0, ''), + (3850,7,-237.513916,2142.066650,87.012,0, ''), + (3850,8,-235.638138,2149.231689,90.587,0, ''), + (3850,9,-237.188019,2151.946045,90.624,0, ''), + (3850,10,-241.162064,2153.649658,90.624,0, 'SAY_OPEN_DOOR_AS'), + (3850,11,-241.129700,2154.562988,90.624,5000, 'cast'), + (3850,12,-241.129700,2154.562988,90.624,5000, 'SAY_POST_DOOR_AS'), + (3850,13,-241.129700,2154.562988,90.624,25000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=17876; +INSERT INTO `script_waypoint` VALUES + (17876,0,2230.91,118.765,82.2947,5000, ''), + (17876,1,2230.33,114.980,82.2946,0, ''), + (17876,2,2233.36,111.057,82.2996,0, ''), + (17876,3,2231.17,108.486,82.6624,0, ''), + (17876,4,2220.22,114.605,89.4264,0, ''), + (17876,5,2215.23,115.990,89.4549,0, ''), + (17876,6,2210.00,106.849,89.4549,0, ''), + (17876,7,2205.66,105.234,89.4549,0, ''), + (17876,8,2192.26,112.618,89.4549,0, 'spawn armorer'), + (17876,9,2181.28,118.612,89.4549,8000, 'get weapon'), + (17876,10,2181.62,120.385,89.4549,5000, 'get armor'), + (17876,11,2189.44,113.922,89.4549,0, ''), + (17876,12,2195.63,110.584,89.4549,0, ''), + (17876,13,2201.09,115.115,89.4549,0, ''), + (17876,14,2204.34,121.036,89.4355,0, ''), + (17876,15,2208.66,129.127,87.9560,0, 'first ambush'), + (17876,16,2193.09,137.940,88.2164,0, ''), + (17876,17,2173.39,149.064,87.9227,0, ''), + (17876,18,2164.25,137.965,85.0595,0, ''), + (17876,19,2149.31,125.645,77.0858,0, ''), + (17876,20,2142.78,127.173,75.5954,0, ''), + (17876,21,2139.28,133.952,73.6386,0, 'second ambush'), + (17876,22,2139.54,155.235,67.1269,0, ''), + (17876,23,2145.38,167.551,64.8974,0, ''), + (17876,24,2134.28,175.304,67.9446,0, ''), + (17876,25,2118.08,187.387,68.8141,0, ''), + (17876,26,2105.88,195.461,65.1854,0, 'third ambush'), + (17876,27,2096.77,196.939,65.2117,0, ''), + (17876,28,2083.90,209.395,64.8736,0, ''), + (17876,29,2067.84,224.376,64.8022,30000, 'meeting scarloc'), + (17876,30,2055.40,242.90,63.3418,0, 'after skarloc'), + (17876,31,2039.20,266.460,63.0182,10000, 'mount up'), + (17876,32,2011.77,278.478,65.3388,0, ''), + (17876,33,2005.08,289.676,66.1179,0, ''), + (17876,34,2033.11,337.450,66.0948,0, ''), + (17876,35,2070.30,416.208,66.0893,0, ''), + (17876,36,2086.76,469.768,65.9182,0, ''), + (17876,37,2101.70,497.955,61.7881,0, 'road ambush'), + (17876,38,2133.39,530.933,55.3700,5000, ''), + (17876,39,2157.91,559.635,48.5157,0, ''), + (17876,40,2167.34,586.191,42.4394,0, ''), + (17876,41,2174.17,637.643,33.9002,0, ''), + (17876,42,2179.31,656.053,34.723,0, ''), + (17876,43,2183.65,670.941,34.0318,0, ''), + (17876,44,2201.50,668.616,36.1236,0, ''), + (17876,45,2221.56,652.747,36.6153,0, ''), + (17876,46,2238.97,640.125,37.2214,0, ''), + (17876,47,2251.17,620.574,40.1473,0, ''), + (17876,48,2261.98,595.303,41.4117,0, ''), + (17876,49,2278.67,560.172,38.9090,0, ''), + (17876,50,2336.72,528.327,40.9369,0, ''), + (17876,51,2381.04,519.612,37.7312,0, ''), + (17876,52,2412.20,515.425,39.2068,0, ''), + (17876,53,2452.39,516.174,42.9387,0, ''), + (17876,54,2467.38,539.389,47.4992,0, ''), + (17876,55,2470.70,554.333,46.6668,0, ''), + (17876,56,2478.07,575.321,55.4549,0, ''), + (17876,57,2480.00,585.408,56.6921,0, ''), + (17876,58,2482.67,608.817,55.6643,0, ''), + (17876,59,2485.62,626.061,58.0132,2000, 'dismount'), + (17876,60,2486.91,626.356,58.0761,0, 'scare horse'), + (17876,61,2488.58,660.940,57.3913,0, ''), + (17876,62,2502.56,686.059,55.6252,0, ''), + (17876,63,2502.08,694.360,55.5083,0, ''), + (17876,64,2491.46,694.321,55.7163,0, ''), + (17876,65,2491.10,703.300,55.7630,0, ''), + (17876,66,2485.64,702.992,55.7917,0, ''), + (17876,67,2479.10,695.291,55.7901,10000, ''), + (17876,68,2476.75,693.689,55.7960,0, 'spawn mobs'), + (17876,69,2475.39,695.983,55.8146,0, ''), + (17876,70,2477.75,694.473,55.7945,0, ''), + (17876,71,2481.27,697.747,55.7910,0, 'mobs in doorway'), + (17876,72,2486.31,703.131,55.7861,5000, ''), + (17876,73,2490.76,703.511,55.7662,0, ''), + (17876,74,2491.30,694.792,55.7195,0, ''), + (17876,75,2518.69,693.876,55.1383,0, ''), + (17876,76,2531.33,681.914,55.1383,0, ''), + (17876,77,2568.25,682.654,55.1778,0, ''), + (17876,78,2589.61,689.981,55.1421,0, ''), + (17876,79,2634.74,679.833,54.6613,0, ''), + (17876,80,2630.41,661.464,54.2761,0, ''), + (17876,81,2629.00,656.982,56.0651,0, ''), + (17876,82,2620.84,633.007,56.0300,3000, 'stop in church'), + (17876,83,2622.99,639.178,56.0300,0, 'summon'), + (17876,84,2628.73,656.693,56.0610,5000, ''), + (17876,85,2630.34,661.135,54.2738,0, ''), + (17876,86,2635.38,672.243,54.4508,0, ''), + (17876,87,2644.13,668.158,55.3797,0, ''), + (17876,88,2646.82,666.740,56.9898,0, ''), + (17876,89,2658.22,665.432,57.1725,0, ''), + (17876,90,2661.88,674.849,57.1725,0, ''), + (17876,91,2656.23,677.208,57.1725,0, ''), + (17876,92,2652.28,670.270,61.9353,0, ''), + (17876,93,2650.79,664.290,61.9302,0, 'summon inn'), + (17876,94,2658.19,660.454,61.9320,5000, ''), + (17876,95,2660.57,659.173,61.9370,0, 'speak with Taretha'), + (17876,96,2658.19,660.454,61.9320,5000, 'epoch calls'), + (17876,97,2659.84,659.482,61.9361,5000, 'taretha "dies"'), + (17876,98,2654.28,662.722,61.9313,0, ''), + (17876,99,2652.37,670.561,61.9368,0, ''), + (17876,100,2656.05,676.761,57.1727,0, ''), + (17876,101,2658.49,677.166,57.1727,0, ''), + (17876,102,2659.28,667.117,57.1727,0, ''), + (17876,103,2649.71,665.387,57.1727,0, ''), + (17876,104,2634.79,672.964,54.4577,0, 'outside inn'), + (17876,105,2635.06,673.892,54.4713,30000, 'getting ready'), + (17876,106,2634.79,672.964,54.4577,60000, 'when all dead and meet Taretha'), + (17876,107,2631.72,665.629,54.2923,0, 'run off'), + (17876,108,2647.40,640.530,55.7634,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=18887; +INSERT INTO `script_waypoint` VALUES + (18887,0,2650.06,665.473,61.9305,0, ''), + (18887,1,2652.44,670.761,61.9370,0, ''), + (18887,2,2655.96,676.913,57.1725,0, ''), + (18887,3,2659.40,677.317,57.1725,0, ''), + (18887,4,2651.75,664.482,57.1725,0, ''), + (18887,5,2647.49,666.595,57.0824,0, ''), + (18887,6,2644.37,668.167,55.4182,0, ''), + (18887,7,2640.96,669.890,54.7567,60000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=10096; +INSERT INTO `script_waypoint` VALUES + (10096,0,604.802673,-191.081985,-54.058590,0, 'ring'), + (10096,1,604.072998,-222.106918,-52.743759,0, 'first gate'), + (10096,2,621.400391,-214.499054,-52.814453,0, 'hiding in corner'), + (10096,3,601.300781,-198.556992,-53.950256,0, 'ring'), + (10096,4,631.818359,-180.548126,-52.654770,0, 'second gate'), + (10096,5,627.390381,-201.075974,-52.692917,0, 'hiding in corner'); + +DELETE FROM `script_waypoint` WHERE `entry`=9503; +INSERT INTO `script_waypoint` VALUES + (9503,0,883.294861,-188.926300,-43.703655,0, ''), + (9503,1,872.763550,-185.605621,-43.703655,5000, 'b1'), + (9503,2,867.923401,-188.006393,-43.703655,5000, 'b2'), + (9503,3,863.295898,-190.795212,-43.703655,5000, 'b3'), + (9503,4,856.139587,-194.652756,-43.703655,5000, 'b4'), + (9503,5,851.878906,-196.928131,-43.703655,15000, 'b5'), + (9503,6,877.035217,-187.048080,-43.703655,0, ''), + (9503,7,891.198000,-197.924000,-43.620400,0, 'home'); + +DELETE FROM `script_waypoint` WHERE `entry`=12423; +INSERT INTO `script_waypoint` VALUES + (12423,0,-9509.72,-147.03,58.74,0, ''), + (12423,1,-9517.07,-172.82,58.66,0, ''); +DELETE FROM `script_waypoint` WHERE `entry`=12427; +INSERT INTO `script_waypoint` VALUES + (12427,0,-5689.20,-456.44,391.08,0, ''), + (12427,1,-5700.37,-450.77,393.19,0, ''); +DELETE FROM `script_waypoint` WHERE `entry`=12428; +INSERT INTO `script_waypoint` VALUES + (12428,0,2454.09,361.26,31.51,0, ''), + (12428,1,2472.03,378.08,30.98,0, ''); +DELETE FROM `script_waypoint` WHERE `entry`=12429; +INSERT INTO `script_waypoint` VALUES + (12429,0,9654.19,909.58,1272.11,0, ''), + (12429,1,9642.53,908.11,1269.10,0, ''); +DELETE FROM `script_waypoint` WHERE `entry`=12430; +INSERT INTO `script_waypoint` VALUES + (12430,0,161.65,-4779.34,14.64,0, ''), + (12430,1,140.71,-4813.56,17.04,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=6182; +INSERT INTO `script_waypoint` VALUES + (6182,0,-11480.684570,1545.091187,49.898571,0, ''), + (6182,1,-11466.825195,1530.151733,50.263611,0, ''), + (6182,2,-11465.213867,1528.343750,50.954369,0, 'entrance hut'), + (6182,3,-11462.990234,1525.235596,50.937702,0, ''), + (6182,4,-11461.000000,1526.614014,50.937702,5000, 'pick up rifle'), + (6182,5,-11462.990234,1525.235596,50.937702,0, ''), + (6182,6,-11465.213867,1528.343750,50.954369,0, ''), + (6182,7,-11468.353516,1535.075562,50.400948,15000, 'hold,prepare for wave1'), + (6182,8,-11468.353516,1535.075562,50.400948,15000, 'hold,prepare for wave2'), + (6182,9,-11468.353516,1535.075562,50.400948,10000, 'hold,prepare for wave3'), + (6182,10,-11467.898438,1532.459595,50.348885,0, 'we are done'), + (6182,11,-11466.064453,1529.855225,50.209351,0, ''), + (6182,12,-11462.990234,1525.235596,50.937702,0, ''), + (6182,13,-11461.000000,1526.614014,50.937702,5000, 'deliver rifle'), + (6182,14,-11462.990234,1525.235596,50.937702,0, ''), + (6182,15,-11465.213867,1528.343750,50.954369,0, ''), + (6182,16,-11470.260742,1537.276733,50.378487,0, ''), + (6182,17,-11475.581055,1548.678833,50.184380,0, 'complete quest'), + (6182,18,-11482.299805,1557.410034,48.624519,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=7807; +INSERT INTO `script_waypoint` VALUES + (7807,0,-4943.74,1715.74,62.74,0, 'SAY_START'), + (7807,1,-4944.93,1706.66,63.16,0, ''), + (7807,2,-4942.82,1690.22,64.25,0, ''), + (7807,3,-4946.47,1669.62,63.84,0, ''), + (7807,4,-4955.93,1651.88,63.00,0, ''), + (7807,5,-4967.58,1643.86,64.31,0, ''), + (7807,6,-4978.12,1607.90,64.30,0, ''), + (7807,7,-4975.38,1596.16,64.70,0, ''), + (7807,8,-4972.82,1581.89,61.75,0, ''), + (7807,9,-4958.65,1581.05,61.81,0, ''), + (7807,10,-4936.72,1594.89,65.96,0, ''), + (7807,11,-4885.69,1598.10,67.45,4000, 'first ambush SAY_AMBUSH'), + (7807,12,-4874.20,1601.73,68.54,0, ''), + (7807,13,-4816.64,1594.47,78.20,0, ''), + (7807,14,-4802.20,1571.92,87.01,0, ''), + (7807,15,-4746.40,1576.11,84.59,0, ''), + (7807,16,-4739.72,1707.16,94.04,0, ''), + (7807,17,-4674.03,1840.44,89.17,0, ''), + (7807,18,-4667.94,1864.11,85.18,0, ''), + (7807,19,-4668.08,1886.39,81.14,0, ''), + (7807,20,-4679.43,1932.32,73.76,0, ''), + (7807,21,-4674.17,1946.66,70.83,5000, 'second ambush SAY_AMBUSH'), + (7807,22,-4643.94,1967.45,65.27,0, ''), + (7807,23,-4595.60,2010.75,52.10,0, ''), + (7807,24,-4562.65,2029.28,45.41,0, ''), + (7807,25,-4538.56,2032.65,45.28,0, ''), + (7807,26,-4531.96,2034.15,48.34,0, ''), + (7807,27,-4507.75,2039.32,51.57,0, ''), + (7807,28,-4482.74,2045.67,48.15,0, ''), + (7807,29,-4460.87,2051.54,45.55,0, ''), + (7807,30,-4449.97,2060.03,45.51,10000, 'third ambush SAY_AMBUSH'), + (7807,31,-4448.99,2079.05,44.64,0, ''), + (7807,32,-4436.64,2134.48,28.83,0, ''), + (7807,33,-4429.25,2170.20,15.44,0, ''), + (7807,34,-4424.83,2186.11,11.48,0, ''), + (7807,35,-4416.71,2209.76,7.36,0, ''), + (7807,36,-4405.25,2231.77,5.94,0, ''), + (7807,37,-4377.61,2265.45,06.71,15000, 'complete quest SAY_END'); + +DELETE FROM `script_waypoint` WHERE `entry`=2917; +INSERT INTO `script_waypoint` VALUES + (2917,0,4675.812500,598.614563,17.645658,0, 'SAY_REM_START'), + (2917,1,4672.844238,599.325378,16.417622,0, ''), + (2917,2,4663.449707,607.430176,10.494752,0, ''), + (2917,3,4655.969238,613.761353,8.523270,0, ''), + (2917,4,4640.804688,623.999329,8.377054,0, ''), + (2917,5,4631.678711,630.801086,6.414999,5000, 'SAY_REM_RAMP1_1'), + (2917,6,4633.533203,632.476440,6.509831,0, 'ambush'), + (2917,7,4639.413574,637.120789,13.338119,0, ''), + (2917,8,4642.352051,637.668152,13.437444,0, ''), + (2917,9,4645.082031,634.463989,13.437208,5000, 'SAY_REM_RAMP1_2'), + (2917,10,4642.345215,637.584839,13.435211,0, ''), + (2917,11,4639.630859,637.233765,13.339752,0, ''), + (2917,12,4633.363281,632.462280,6.488438,0, ''), + (2917,13,4624.714844,631.723511,6.264030,0, ''), + (2917,14,4623.525879,629.718506,6.201339,5000, 'SAY_REM_BOOK'), + (2917,15,4623.452148,630.369629,6.218942,0, 'SAY_REM_TENT1_1'), + (2917,16,4622.622070,637.221558,6.312845,0, 'ambush'), + (2917,17,4619.755371,637.386230,6.312050,5000, 'SAY_REM_TENT1_2'), + (2917,18,4620.027832,637.367676,6.312050,0, ''), + (2917,19,4624.154785,637.560303,6.313898,0, ''), + (2917,20,4622.967773,634.016479,6.294979,0, ''), + (2917,21,4616.926758,630.303284,6.239193,0, ''), + (2917,22,4614.546387,616.983337,5.687642,0, ''), + (2917,23,4610.279297,610.029419,5.442539,0, ''), + (2917,24,4601.149902,604.111694,2.054856,0, ''), + (2917,25,4589.618164,597.685730,1.057147,0, ''), + (2917,26,4577.588379,592.145813,1.120190,0, 'SAY_REM_MOSS (?)'), + (2917,27,4569.848145,592.177490,1.260874,5000, 'EMOTE_REM_MOSS (?)'), + (2917,28,4568.791992,590.870911,1.211338,3000, 'SAY_REM_MOSS_PROGRESS (?)'), + (2917,29,4566.722656,564.077881,1.343084,0, 'ambush'), + (2917,30,4568.269531,551.958435,5.004200,0, ''), + (2917,31,4566.731934,551.557861,5.426314,5000, 'SAY_REM_PROGRESS'), + (2917,32,4566.741699,560.767639,1.703257,0, ''), + (2917,33,4573.916016,582.566101,0.749801,0, ''), + (2917,34,4594.206055,598.533020,1.034056,0, ''), + (2917,35,4601.194824,604.283081,2.060146,0, ''), + (2917,36,4609.539551,610.844727,5.402220,0, ''), + (2917,37,4624.800293,618.076477,5.851541,0, ''), + (2917,38,4632.414063,623.778442,7.286243,0, ''), + (2917,39,4645.915039,621.983765,8.579967,0, ''), + (2917,40,4658.669922,611.092651,8.891747,0, ''), + (2917,41,4671.924316,599.752197,16.01242,5000, 'SAY_REM_REMEMBER'), + (2917,42,4676.976074,600.649780,17.82566,5000, 'EMOTE_REM_END'); + +DELETE FROM `script_waypoint` WHERE `entry`=28217; +INSERT INTO `script_waypoint` VALUES + (28217,0,5399.96,4509.07,-131.053,0, ''), + (28217,1,5396.95,4514.84,-131.791, 0, ''), + (28217,2,5395.16,4524.06,-132.335, 0, ''), + (28217,3,5400.15,4526.84,-136.058,0, ''), + (28217,4,5403.53,4527.2,-138.907,0, ''), + (28217,5,5406.51,4527.47,-141.983,0, ''), + (28217,6,5409.16,4526.37,-143.902, 0, ''), + (28217,7,5412.04,4523.05,-143.998, 0, ''), + (28217,8,5415.23,4521.19,-143.961, 0, ''), + (28217,9,5417.74,4519.74,-144.292, 0, ''), + (28217,10,5421.77,4519.79,-145.36,0, ''), + (28217,11,5426.75,4520.53,-147.931,0, ''), + (28217,12,5429.06,4521.82,-148.919, 0, ''), + (28217,13,5436.52,4534.63,-149.618, 0, ''), + (28217,14,5441.52,4542.23,-149.367, 0, ''), + (28217,15,5449.06,4553.47,-149.187,0, ''), + (28217,16,5453.5,4565.61,-147.526, 0, ''), + (28217,17,5455.04,4578.6,-147.147, 0, ''), + (28217,18,5462.32,4591.69,-147.738,0, ''), + (28217,19,5470.04,4603.04,-146.044,0, ''), + (28217,20,5475.93,4608.86,-143.152,0, ''), + (28217,21,5484.48,4613.78,-139.19,0, ''), + (28217,22,5489.03,4616.56,-137.796,0, ''), + (28217,23,5497.92,4629.89,-135.556,0, ''), + (28217,24,5514.48,4638.82,-136.19,0, ''), + (28217,25,5570,4654.5,-134.947,0, ''), + (28217,26,5578.32,4653.29,-136.896,0, ''), + (28217,27,5596.56,4642.26,-136.593,0, ''), + (28217,28,5634.02,4600.35,-137.291,2000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=3678; +INSERT INTO `script_waypoint` VALUES + (3678,0,-120.864,132.825,-79.2972,5000, 'TYPE_NARALEX_EVENT'), + (3678,1,-109.944,155.417,-80.4659,0, ''), + (3678,2,-106.104,198.456,-80.5970,0, ''), + (3678,3,-110.246,214.763,-85.6669,0, ''), + (3678,4,-105.609,236.184,-92.1732,0, 'TYPE_NARALEX_PART1'), + (3678,5,-93.5297,227.956,-90.7522,0, ''), + (3678,6,-85.3155,226.976,-93.1286,0, ''), + (3678,7,-62.1510,206.673,-93.5510,0, ''), + (3678,8,-45.0534,205.580,-96.2435,0, ''), + (3678,9,-31.1235,234.225,-94.0841,0, ''), + (3678,10,-49.2158,269.141,-92.8442,0, ''), + (3678,11,-54.1220,274.717,-92.8442,31000, 'TYPE_NARALEX_PART2'), + (3678,12,-58.9650,282.274,-92.5380,0, ''), + (3678,13,-38.3566,306.239,-90.0192,0, ''), + (3678,14,-28.8928,312.842,-89.2155,0, ''), + (3678,15,-1.58198,296.127,-85.5984,0, ''), + (3678,16,9.89992,272.008,-85.7759,0, ''), + (3678,17,26.8162,259.218,-87.3938,0, ''), + (3678,18,49.1166,227.259,-88.3379,0, ''), + (3678,19,54.4171,209.316,-90.0000,1500, 'SAY_BEYOND_THIS_CORRIDOR'), + (3678,20,71.0380,205.404,-93.0422,0, ''), + (3678,21,81.5941,212.832,-93.0154,0, ''), + (3678,22,94.3376,236.933,-95.8261,0, ''), + (3678,23,114.619,235.908,-96.0495,0, ''), + (3678,24,114.777,237.155,-96.0304,2500, 'NARALEX_EVENT_FINISHED'); + +DELETE FROM `script_waypoint` WHERE `entry`=22424; +INSERT INTO `script_waypoint` VALUES + (22424,0,-3605.719971,4175.580078,-0.031817,0, 'START_SKYWING'), + (22424,1,-3602.311279,4253.213867,0.562436,0, ''), + (22424,2,-3529.151367,4263.524414,-7.871151,0, ''), + (22424,3,-3448.130371,4257.990723,-11.626289,0, ''), + (22424,4,-3377.783936,4209.064941,-9.476727,0, ''), + (22424,5,-3378.211426,4154.628418,0.366330,0, ''), + (22424,6,-3376.920166,4085.501709,14.178538,0, ''), + (22424,7,-3399.274658,4055.948975,18.603474,0, ''), + (22424,8,-3432.678223,4054.069824,29.588032,10000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=22377; +INSERT INTO `script_waypoint` VALUES + (22377,0,-2766.31,5429.65,-34.53,0, ''), + (22377,1,-2769.35,5416.25,-34.53,0, ''), + (22377,2,-2780.07,5416.06,-34.53,1000, ''), + (22377,3,-2812.56,5415.20,-34.53,1000, ''), + (22377,4,-2816.95,5415.02,-34.52,0, ''), + (22377,5,-2827.86,5414.56,-28.29,0, ''), + (22377,6,-2878.32,5414.11,-28.26,0, ''), + (22377,7,-2893.17,5413.15,-18.59,0, ''), + (22377,8,-2896.36,5409.65,-18.59,0, ''), + (22377,9,-2896.50,5396.76,-8.77,0, ''), + (22377,10,-2896.67,5366.20,-9.59,0, ''), + (22377,11,-2888.23,5330.39,-11.19,2000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=18210; +INSERT INTO `script_waypoint` VALUES + (18210,0,-1581.410034,8557.933594,2.726,0, ''), + (18210,1,-1579.908447,8553.716797,2.559,0, ''), + (18210,2,-1577.829102,8549.880859,2.001,0, ''), + (18210,3,-1571.161987,8543.494141,2.001,0, ''), + (18210,4,-1563.944824,8530.334961,1.605,0, ''), + (18210,5,-1554.565552,8518.413086,0.364,0, ''), + (18210,6,-1549.239136,8515.518555,0.293,0, ''), + (18210,7,-1518.490112,8516.771484,0.683,2000, 'SAY_MAG_MORE'), + (18210,8,-1505.038940,8513.247070,0.672,0, ''), + (18210,9,-1476.161133,8496.066406,2.157,0, ''), + (18210,10,-1464.450684,8492.601563,3.529,0, ''), + (18210,11,-1457.568359,8492.183594,4.449,0, ''), + (18210,12,-1444.100342,8499.031250,6.177,0, ''), + (18210,13,-1426.472168,8510.116211,7.686,0, ''), + (18210,14,-1403.685303,8524.146484,9.680,0, ''), + (18210,15,-1384.890503,8542.014648,11.180,0, ''), + (18210,16,-1382.286133,8539.869141,11.139,7500, 'SAY_MAG_COMPLETE'), + (18210,17,-1361.224609,8521.440430,11.144,0, ''), + (18210,18,-1324.803589,8510.688477,13.050,0, ''), + (18210,19,-1312.075439,8492.709961,14.235,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=17077; +INSERT INTO `script_waypoint` VALUES + (17077,0,-16.950142,3801.409424,95.064,5000, 'EMOTE_WOLF_LIFT_HEAD'), + (17077,1,-15.577404,3805.170898,94.833,2500, ''), + (17077,2,-20.011766,3806.609863,92.476,5000, 'EMOTE_WOLF_HOWL'), + (17077,3,-18.594666,3816.207764,91.482,0, ''), + (17077,4,-19.293468,3838.218750,85.012,0, ''), + (17077,5,-16.504408,3871.034668,82.327,0, ''), + (17077,6,2.064510,3898.678711,85.623,0, ''), + (17077,7,16.403864,3921.174072,86.024,0, ''), + (17077,8,47.307926,3932.001465,83.302,0, ''), + (17077,9,90.067230,3942.906250,77.000,0, ''), + (17077,10,106.886024,3944.388428,76.502,0, ''), + (17077,11,139.085480,3941.897217,80.617,0, ''), + (17077,12,150.092346,3942.782959,80.399,0, ''), + (17077,13,193.511475,3950.396484,74.366,0, ''), + (17077,14,226.274948,3958.003418,73.257,0, ''), + (17077,15,246.686981,3963.309326,76.376,0, ''), + (17077,16,264.206177,3977.726563,83.704,0, ''), + (17077,17,279.857422,3986.417236,88.245,0, ''), + (17077,18,304.039642,3998.354004,95.649,0, ''), + (17077,19,328.071503,3995.832764,104.434,0, ''), + (17077,20,347.485229,3990.817627,113.608,0, ''), + (17077,21,351.257202,3954.260254,125.747,0, ''), + (17077,22,345.625977,3932.016113,132.358,0, ''), + (17077,23,347.971893,3908.549561,135.520,0, ''), + (17077,24,351.887878,3891.062744,139.957,0, ''), + (17077,25,346.116852,3864.634277,146.647,0, ''), + (17077,26,330.012360,3839.859375,154.148,0, ''), + (17077,27,297.250610,3811.855225,166.893,0, ''), + (17077,28,290.783112,3800.188477,172.130,0, ''), + (17077,29,288.125427,3782.474365,180.825,0, ''), + (17077,30,296.817841,3771.629639,184.961,0, ''), + (17077,31,305.256256,3765.380615,185.360,0, ''), + (17077,32,311.447906,3757.902100,184.312,0, ''), + (17077,33,325.258026,3730.282227,184.076,0, ''), + (17077,34,341.158630,3717.757080,183.904,0, ''), + (17077,35,365.589020,3717.200684,183.902,0, ''), + (17077,36,387.395081,3731.750732,183.645,0, ''), + (17077,37,396.574127,3732.604248,179.831,0, ''), + (17077,38,404.303192,3737.313232,180.151,0, ''), + (17077,39,410.995972,3742.286865,183.364,0, ''), + (17077,40,434.904541,3761.058838,186.219,0, ''), + (17077,41,460.128815,3774.436768,186.348,0, ''), + (17077,42,467.643951,3788.506104,186.446,0, ''), + (17077,43,491.551666,3815.446777,189.848,0, ''), + (17077,44,496.957855,3836.875244,193.078,0, ''), + (17077,45,502.889191,3855.458740,194.834,0, ''), + (17077,46,508.208466,3863.689453,194.024,0, ''), + (17077,47,528.907593,3887.348633,189.762,0, ''), + (17077,48,527.722229,3890.686523,189.240,0, ''), + (17077,49,524.637329,3891.768066,189.149,0, ''), + (17077,50,519.146057,3886.701660,190.128,60000, 'SAY_WOLF_WELCOME'); + +/* EOF */ + +DELETE FROM `script_waypoint` WHERE `entry`=28912; +INSERT INTO `script_waypoint` VALUES + (28912,0,1653.518,-6038.374,127.585,1000, 'Jump off'), + (28912,1,1653.978,-6034.614,127.585,5000, 'To Box'), + (28912,2,1653.854,-6034.726,127.585,0, 'Equip'), + (28912,3,1652.297,-6035.671,127.585,1000, 'Recover'), + (28912,4,1639.762,-6046.343,127.948,0, 'Escape'), + (28912,5,1640.963,-6028.119,134.740,0, ''), + (28912,6,1625.805,-6029.197,134.740,0, ''), + (28912,7,1626.845,-6015.085,134.740,0, ''), + (28912,8,1649.150,-6016.975,133.240,0, ''), + (28912,9,1653.063,-5974.844,132.652,5000, 'Mount'), + (28912,10,1654.747,-5926.424,121.191,0, 'Disappear'); + + +DELETE FROM `script_waypoint` WHERE `entry`=29173; +INSERT INTO `script_waypoint` VALUES + (29173,0,2431.639,-5137.05,83.843,0, 'intro'), + (29173,1,2319.242,-5266.486,82.825,0, 'summon & on hold'), + (29173,2,2318.775,-5266.832,82.783,0, 'cast light of dawn'), + (29173,3,2280.812,-5284.091,82.608,0, 'move to here and start'), + (29173,4,2280.727,-5286.839,82.930,0, 'move forward to talk'), + (29173,5,2280.812,-5284.091,82.608,0, 'when baba pop'), + (29173,6,2281.461,-5263.014,81.164,0, 'charge to lich king'), + (29173,7,2257.479,-5296.702,82.165,0, 'being kicked by Lich King'), + (29173,8,2261.237,-5294.983,82.167,0, 'throw'), + (29173,9,2259.34,-5294.379,82.167,0, 'event end'); + + +DELETE FROM script_waypoint WHERE `entry`=28070; +INSERT INTO script_waypoint VALUES + (28070,0,1053.789795,476.639343,207.744,0, ''), + (28070,1,1032.293945,467.623444,207.736,0, ''), + (28070,2,1017.908752,454.765656,207.719,0, ''), + (28070,3,1004.810120,441.305115,207.373,0, ''), + (28070,4,988.694214,424.422485,207.425,0, ''), + (28070,5,984.816345,422.177917,205.994,0, ''), + (28070,6,977.204468,420.026917,205.994,0, ''), + (28070,7,962.388123,421.983307,205.994,0, ''), + (28070,8,950.419556,416.515198,205.994,0, ''), + (28070,9,943.972290,403.071228,205.994,0, ''), + (28070,10,947.921936,387.683563,205.994,0, ''), + (28070,11,946.554749,383.270782,205.994,0, ''), + (28070,12,944.654724,380.630859,207.286,0, ''), + (28070,13,941.101563,377.373413,207.421,0, 'reach tribunal,set pause'), + (28070,14,935.217896,370.557343,207.421,0, ''), + (28070,15,928.035950,363.026733,204.018,0, ''), + (28070,16,909.287292,344.392792,203.706,0, ''), + (28070,17,897.946838,333.634735,203.706,0, 'reach panel'), + (28070,18,918.914429,351.312866,203.706,0, 'reach floor disc (end event begin)'), + (28070,19,928.070068,363.296326,204.091,0, 'stealth'), + (28070,20,934.817627,370.136261,207.421,0, ''), + (28070,21,941.501465,377.254456,207.421,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=23784; +INSERT INTO `script_waypoint` VALUES + (23784,1,1383.52,-6411.72,1.2181,5, 'Apothecary Hanes'), + (23784,2,1392.57,-6403.5,1.9699,2000, 'Apothecary Hanes'), + (23784,3,1397.42,-6378.76,4.996,5, 'Apothecary Hanes'), + (23784,4,1427.36,-6359.47,6.385,5, 'Apothecary Hanes'), + (23784,5,1406.46,-6334.45,6.149,2000, 'Apothecary Hanes'), + (23784,6,1400.77,-6339.71,6.367,5000, 'Apothecary Hanes'), + (23784,7,1424.09,-6326.67,5.716,5, 'Apothecary Hanes'), + (23784,8,1470,-6347.45,7.596,5000, 'Apothecary Hanes'), + (23784,9,1465.18,-6343.53,7.58766,2000, 'Apothecary Hanes'), + (23784,10,1463.9,-6339.28,7.56152,5, 'Apothecary Hanes'), + (23784,11,1474.6,-6327.65,7.02011,5, 'Apothecary Hanes'), + (23784,12,1486.59,-6319.08,8.13591,5, 'Apothecary Hanes'), + (23784,13,1499.87,-6312.24,7.11185,5, 'Apothecary Hanes'), + (23784,14,1507.95,-6315.27,7.05227,5000, 'Apothecary Hanes'), + (23784,15,1511.92,-6300.64,6.43812,5, 'Apothecary Hanes'), + (23784,16,1520.02,-6279.71,5.31363,5, 'Apothecary Hanes'), + (23784,17,1534.01,-6245,6.31535,5, 'Apothecary Hanes'), + (23784,18,1537.98,-6224.37,6.36504,5, 'Apothecary Hanes'), + (23784,19,1551.58,-6206.27,6.9545,2000, 'Apothecary Hanes'), + (23784,20,1572.99,-6197.74,6.70809,5, 'Apothecary Hanes'), + (23784,21,1608.51,-6175.83,8.80075,5, 'Apothecary Hanes'), + (23784,22,1619.15,-6167.6,9.39125,5, 'Apothecary Hanes'), + (23784,23,1634.05,-6153.81,8.08527,5, 'Apothecary Hanes'); + +DELETE FROM `script_waypoint` WHERE `entry`=25208; +INSERT INTO `script_waypoint` VALUES + (25208,0,4014.01,6391.91,29.9735,17000, ''), + (25208,1,4029.05,6374.1,28.8288,0, ''), + (25208,2,4039.11,6370.05,27.8701,0, ''), + (25208,3,4052.24,6364.92,27.2941,0, ''), + (25208,4,4058.31,6357.79,26.3543,0, ''), + (25208,5,4062.46,6346.26,24.3838,0, ''), + (25208,6,4063.82,6334.14,25.3818,0, ''), + (25208,7,4062.66,6319.39,24.9775,0, ''), + (25208,8,4061.14,6307.67,24.4034,0, ''), + (25208,9,4059.64,6301.33,24.5615,0, ''), + (25208,10,4066.46,6292.12,24.3167,0, ''), + (25208,11,4078.37,6280.88,26.6926,0, ''), + (25208,12,4087.03,6281.33,27.4604,0, ''), + (25208,13,4097.8,6282.47,25.4414,0, ''), + (25208,14,4107.07,6279.26,25.2578,0, ''), + (25208,15,4114.68,6279.78,24.7762,0, ''), + (25208,16,4122.9,6280.34,26.1671,0, ''), + (25208,17,4127.69,6280.67,28.1951,0, ''), + (25208,18,4134.75,6282.09,28.9761,0, ''), + (25208,19,4141.62,6281.92,29.3518,0, ''), + (25208,20,4152.14,6281.43,30.6951,0, ''), + (25208,21,4159.63,6282.6,30.2401,0, ''), + (25208,22,4169.82,6289.25,24.182,0, ''), + (25208,23,4181.02,6293.88,18.035,0, ''), + (25208,24,4189.27,6295.87,14.4513,0, ''), + (25208,25,4200.09,6298.4,12.7249,0, ''), + (25208,26,4206.46,6291.56,10.9628,0, ''), + (25208,27,4211.45,6282.82,9.05693,0, ''), + (25208,28,4215.22,6277.25,8.54002,0, ''), + (25208,29,4215.28,6268.57,8.30674,0, ''), + (25208,30,4224.23,6269.53,6.97205,0, ''), + (25208,31,4235.98,6270.9,3.27214,0, ''), + (25208,32,4242.67,6269.45,1.45579,0, ''), + (25208,33,4250.43,6262.49,0.611961,0, ''), + (25208,34,4259.07,6253.33,-0.0686721,0, ''), + (25208,35,4261.11,6248.81,-0.112029,0, ''), + (25208,36,4257.58,6234.09,-0.094803,0, ''), + (25208,37,4252.62,6224.3,-0.154816,0, ''), + (25208,38,4247.92,6214.75,-0.221144,0, ''), + (25208,39,4254.04,6205.58,-0.186623,0, ''), + (25208,40,4262.6,6194.47,-0.145114,0, ''), + (25208,41,4268.96,6189.47,0.0303093,21000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=1754; +INSERT INTO `script_waypoint` VALUES + (1754,1,-8334.89,394.130,122.274,0, ''), + (1754,2,-8335.58,393.519,122.275,0, ''), + (1754,3,-8352.99,379.932,122.275,0, ''), + (1754,4,-8356.65,385.247,122.275,0, ''), + (1754,5,-8364.29,395.317,122.275,0, ''), + (1754,6,-8361.75,402.852,122.275,0, ''), + (1754,7,-8359.94,410.92,122.275,0, ''), + (1754,8,-8362.84,415.409,122.275,0, ''), + (1754,9,-8370.42,424.6,122.275,0, ''), + (1754,10,-8380.45,437.115,122.275,0, ''), + (1754,11,-8386.37,444.906,122.275,0, ''), + (1754,12,-8388.5,447.314,123.275,0, ''), + (1754,13,-8390.25,449.247,124.275,0, ''), + (1754,14,-8392.84,452.397,123.761,0, ''), + (1754,15,-8397.52,457.326,123.761,0, ''), + (1754,16,-8402.42,461.646,123.761,0, ''), + (1754,17,-8409.52,462.677,123.761,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=8856; +INSERT INTO `script_waypoint` VALUES + (8856,1,-8409.34,453.345,123.761,0, ''), + (8856,2,-8409.52,462.677,123.761,0, ''), + (8856,3,-8402.42,461.646,123.761,0, ''), + (8856,4,-8397.52,457.326,123.761,0, ''), + (8856,5,-8392.84,452.397,123.761,0, ''), + (8856,6,-8390.25,449.247,124.275,0, ''), + (8856,7,-8388.5,447.314,123.275,0, ''), + (8856,8,-8386.37,444.906,122.275,0, ''), + (8856,9,-8380.45,437.115,122.275,0, ''), + (8856,10,-8370.42,424.6,122.275,0, ''), + (8856,11,-8362.84,415.409,122.275,0, ''), + (8856,12,-8359.94,410.92,122.275,0, ''), + (8856,13,-8361.75,402.852,122.275,0, ''), + (8856,14,-8364.29,395.317,122.275,0, ''), + (8856,15,-8356.65,385.247,122.275,0, ''), + (8856,16,-8352.99,379.932,122.275,0, ''), + (8856,17,-8335.58,393.519,122.275,0, ''), + (8856,18,-8334.89,394.13,122.274,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=30023; +INSERT INTO `script_waypoint` VALUES + (30023,1,5722.558,-2960.685,286.276,0, ''), + (30023,2,5734.698,-2984.990,286.276,0, ''), + (30023,3,5737.401,-2991.310,282.575,0, ''), + (30023,4,5740.416,-2997.536,277.263,0, ''), + (30023,5,5743.790,-3004.050,273.570,0, ''), + (30023,6,5764.240,-2993.788,272.944,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=30017; +INSERT INTO `script_waypoint` VALUES + (30017,1,5790.975,-2927.297,286.277,0, ''), + (30017,2,5803.003,-2952.998,286.277,0, ''), + (30017,3,5805.184,-2958.513,282.899,0, ''), + (30017,4,5807.038,-2961.449,280.250,0, ''), + (30017,5,5808.862,-2965.138,277.089,0, ''), + (30017,6,5811.703,-2970.821,273.569,0, ''), + (30017,7,5789.979,-2980.250,273.584,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry` IN(25504,25589); +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`,`location_y`,`location_z`,`waittime`,`point_comment`) VALUES +(25504,1, '2882.26', '6734.51', '32.8864',0, 'Mootoo the Younger'), +(25504,2, '2877.37', '6731.59', '32.8721',0, 'Mootoo the Younger'), +(25504,3, '2874.18', '6725.85', '30.3087',0, 'Mootoo the Younger'), +(25504,4, '2866.36', '6726.04', '26.7277',0, 'Mootoo the Younger'), +(25504,5, '2863.97', '6731.91', '23.8372',0, 'Mootoo the Younger'), +(25504,6, '2869.29', '6736.92', '20.5227',0, 'Mootoo the Younger'), +(25504,7, '2874.16', '6731.88', '18.5042',0, 'Mootoo the Younger'), +(25504,8, '2887.05', '6736.39', '13.997',0, 'Mootoo the Younger'), +(25504,9, '2901.68', '6741.25', '14.0413',0, 'Mootoo the Younger'), +(25504,10, '2919.45', '6746.28', '13.7325',5000, 'Mootoo the Younger'), +(25504,11, '2947.18', '6738.71', '12.7117',0, 'Mootoo the Younger'), +(25504,12, '2982.43', '6748.59', '10.2755',5000, 'Mootoo the Younger'), +(25504,13, '2985.05', '6776.05', '8.33081',0, 'Mootoo the Younger'), +(25504,14, '2978.72', '6801.48', '5.83056',0, 'Mootoo the Younger'), +(25504,15, '2957.81', '6818.86', '4.7594',0, 'Mootoo the Younger'), +(25504,16, '2917.03', '6820.55', '5.87954',5000, 'Mootoo the Younger'), +(25504,17, '2890.04', '6825.68', '4.11676',0, 'Mootoo the Younger'), +(25504,18, '2850.31', '6812.35', '2.09411',0, 'Mootoo the Younger'), +(25504,19, '2821.29', '6797.99', '4.49696',0, 'Mootoo the Younger'), +(25504,20, '2798.25', '6770.64', '5.0632',1000, 'Mootoo the Younger'), +(25504,21, '2807.49', '6748.29', '8.25933',5000, 'Mootoo the Younger'); + +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`,`location_y`,`location_z`,`waittime`) VALUES +(25589,1, '4462.37', '5372.75', '-15.2912',0), +(25589,2, '4478.7', '5377.27', '-15.0012',5000), +(25589,3, '4482.25', '5390.64', '-15.2354',0), +(25589,4, '4477.09', '5405.02', '-15.2386',0), +(25589,5, '4468.71', '5416.9', '-15.2602',0), +(25589,6, '4457.24', '5426.87', '-15.6104',0), +(25589,7, '4439.7', '5433.46', '-15.2384',0), +(25589,8, '4422.63', '5432.32', '-14.8822',0), +(25589,9, '4404.71', '5422.74', '-14.4494',0), +(25589,10, '4394.68', '5406.63', '-10.8423',0), +(25589,11, '4391.99', '5392.88', '-6.45477',0), +(25589,12, '4390.65', '5370.91', '0.504708',0), +(25589,13, '4393.34', '5354.19', '3.1859',0), +(25589,14, '4401.68', '5342.78', '5.20245',0), +(25589,15, '4417.98', '5335.18', '8.31299',0), +(25589,16, '4431.01', '5335.17', '11.0135',0), +(25589,17, '4446.21', '5340.58', '14.4585',0), +(25589,18, '4462.73', '5350.22', '16.8783',0), +(25589,19, '4475.06', '5362.82', '19.1229',0), +(25589,20, '4480.92', '5381.72', '22.2479',0), +(25589,21, '4481.31', '5394.2', '26.2008',0), +(25589,22, '4476.32', '5409.12', '29.0811',5000), +(25589,23, '4466.33', '5420.75', '31.8093',0), +(25589,24, '4450.66', '5430.03', '36.2843',0), +(25589,25, '4431.24', '5433.77', '38.2282',0), +(25589,26, '4417.65', '5437.11', '40.2429',0), +(25589,27, '4402.5', '5440.94', '42.7727',0), +(25589,28, '4387.11', '5450.98', '48.6992',0), +(25589,29, '4364.52', '5468.98', '48.8229',0), +(25589,30, '4344.02', '5483.26', '48.0509',0); + +DELETE FROM `script_waypoint` WHERE `entry`=349; +INSERT INTO `script_waypoint` VALUES +(349,1,-8763.9,-2185.21,141.217,0, ''), +(349,2,-8768.76,-2185.94,141.949,0, ''), +(349,3,-8772.1,-2189.18,141.443,0, ''), +(349,4,-8778.78,-2195.66,140.662,0, ''), +(349,5,-8789.74,-2191.46,141.634,0, ''), +(349,6,-8802.37,-2185.99,141.96,0, ''), +(349,7,-8818,-2184.8,139.153,0, ''), +(349,8,-8828.42,-2193.02,138.973,0, ''), +(349,9,-8826.45,-2203.82,140.293,0, ''), +(349,10,-8822.54,-2211.43,142.884,0, ''), +(349,11,-8813.51,-2225.08,143.327,0, ''), +(349,12,-8807.5,-2233.92,144.441,0, ''), +(349,13,-8801.3,-2239.04,146.476,0, ''), +(349,14,-8797.57,-2243.61,146.594,0, ''), +(349,15,-8794.38,-2250.83,146.723,0, ''), +(349,16,-8788.1,-2255.1,147.309,0, ''), +(349,17,-8775.37,-2259.82,149.18,0, ''), +(349,18,-8768.09,-2259.54,150.52,0, ''), +(349,19,-8754.65,-2255.62,152.253,0, ''), +(349,20,-8748.51,-2252.62,153.098,0, ''), +(349,21,-8743.2,-2251.67,154.038,0, ''), +(349,22,-8738.4,-2250.23,154.028,0, ''), +(349,23,-8734.35,-2251.56,154.363,0, ''), +(349,24,-8727.41,-2248.64,154.919,0, ''), +(349,25,-8717.66,-2246.3,154.926,0, ''), +(349,26,-8709.05,-2245.83,154.767,0, ''), +(349,27,-8700.13,-2243.28,153.872,0, ''), +(349,28,-8690.15,-2242.54,153.733,0, ''), +(349,29,-8683.49,-2244.31,155.356,0, ''), +(349,30,-8674.53,-2247.89,155.574,0, ''), +(349,31,-8669.86,-2252.77,154.854,0, ''), +(349,32,-8669.07,-2258.88,156.424,0, ''), +(349,33,-8670.56,-2264.69,156.978,0, ''), +(349,34,-8673.45,-2269.45,156.007,0, ''), +(349,35,-8674.4,-2275.9,155.747,0, ''), +(349,36,-8674.82,-2282.75,155.496,0, ''), +(349,37,-8675.17,-2289.5,157.049,0, ''), +(349,38,-8676.43,-2297.67,156.701,0, ''), +(349,39,-8677.59,-2304.85,155.917,0, ''), +(349,40,-8682.32,-2312.88,155.928,0, ''), +(349,41,-8687.78,-2324.44,156.024,0, ''), +(349,42,-8695.71,-2334.87,156.06,0, ''), +(349,43,-8705.17,-2345.13,156.021,0, ''), +(349,44,-8715.1,-2353.95,156.188,0, ''), +(349,45,-8725.8,-2359.17,156.253,0, ''), +(349,46,-8735.92,-2363.27,157.151,0, ''), +(349,47,-8746.82,-2367.99,158.13,0, ''), +(349,48,-8755.38,-2375.72,157.271,0, ''), +(349,49,-8765.12,-2388.08,156.092,0, ''), +(349,50,-8768.84,-2395.58,155.926,0, ''), +(349,51,-8772.85,-2405.27,156.418,0, ''), +(349,52,-8776.95,-2414.94,156.388,0, ''), +(349,53,-8781.69,-2430.11,153.264,0, ''), +(349,54,-8786.76,-2440.34,147.849,0, ''), +(349,55,-8792.01,-2453.38,142.746,0, ''), +(349,56,-8797.41,-2462.21,138.171,0, ''), +(349,57,-8804.78,-2472.43,134.192,0, ''), +(349,58,-8815.26,-2478.45,133.079,0, ''), +(349,59,-8823.74,-2491.21,132.911,0, ''), +(349,60,-8835.25,-2496.44,132.057,0, ''), +(349,61,-8841.04,-2503.01,132.199,0, ''), +(349,62,-8850.81,-2509.63,132.865,0, ''), +(349,63,-8858.64,-2522.29,133.852,0, ''), +(349,64,-8862.25,-2527.1,134.279,0, ''), +(349,65,-8870.67,-2542.08,131.044,0, ''), +(349,66,-8880.4,-2550.79,130.505,0, ''), +(349,67,-8892.87,-2560.3,130.558,0, ''), +(349,68,-8908.74,-2573.64,131.616,0, ''), +(349,69,-8922.05,-2585.31,132.446,0, ''), +(349,70,-8935.86,-2591.19,132.446,0, ''), +(349,71,-8949.08,-2596.87,132.537,0, ''), +(349,72,-8959.17,-2599.72,132.507,0, ''), +(349,73,-8969.43,-2601.96,132.471,0, ''), +(349,74,-8979.77,-2603.66,132.39,0, ''), +(349,75,-8991.61,-2604.16,131.196,0, ''), +(349,76,-9000.2,-2602.38,128.954,0, ''), +(349,77,-9011.57,-2594.23,127.435,0, ''), +(349,78,-9019.77,-2587.67,126.618,0, ''), +(349,79,-9028.35,-2582.26,125.787,0, ''), +(349,80,-9038.96,-2572.71,124.748,0, ''), +(349,81,-9046.92,-2560.64,124.447,0, ''), +(349,82,-9059.29,-2550.1,123.756,0, ''), +(349,83,-9068.15,-2547.28,122.965,0, ''), +(349,84,-9077.54,-2541.67,121.17,0, ''), +(349,85,-9085.61,-2532.98,118.85,0, ''), +(349,86,-9097.8,-2520.49,117.401,0, ''), +(349,87,-9110.18,-2507.01,117.098,0, ''), +(349,88,-9119.21,-2498.23,116.627,0, ''), +(349,89,-9124.61,-2487.07,115.972,0, ''), +(349,90,-9127.42,-2478.53,114.843,0, ''), +(349,91,-9133.18,-2465.77,113.029,0, ''), +(349,92,-9137.54,-2456.22,111.051,0, ''), +(349,93,-9146.73,-2441.6,107.979,0, ''), +(349,94,-9155.62,-2430.79,106.251,0, ''), +(349,95,-9158.06,-2420.36,104.838,0, ''), +(349,96,-9157.25,-2410.2,103.858,0, ''), +(349,97,-9152.95,-2401.47,102.679,0, ''), +(349,98,-9153.63,-2393.46,100.63,0, ''), +(349,99,-9156.48,-2385.68,98.2937,0, ''), +(349,100,-9161.01,-2379.87,96.2066,0, ''), +(349,101,-9169.08,-2373.14,93.8832,0, ''), +(349,102,-9175.61,-2368.72,92.5178,0, ''), +(349,103,-9187.1,-2360.52,89.9231,0, ''), +(349,104,-9194.27,-2352.89,87.593,0, ''), +(349,105,-9201.07,-2344.88,85.8516,0, ''), +(349,106,-9205.62,-2339.56,85.0342,0, ''), +(349,107,-9212.44,-2331.58,83.8068,0, ''), +(349,108,-9219.26,-2323.6,82.29,0, ''), +(349,109,-9229.98,-2313.25,79.4506,0, ''), +(349,110,-9240.03,-2303.51,76.7841,0, ''), +(349,111,-9249.34,-2298.82,74.3911,0, ''), +(349,112,-9254.95,-2296.68,72.8144,0, ''), +(349,113,-9264.73,-2292.92,70.0089,0, ''), +(349,114,-9272.24,-2293.79,68.6096,0, ''), +(349,115,-9277.03,-2295.98,68.1135,10000, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=6729; +INSERT INTO `script_waypoint` VALUES +(6729,1,-861.803,-460.36,-33.8918,0, ''), +(6729,2,-856.168,-464.425,-33.9223,0, ''), +(6729,3,-849.964,-469.231,-34.0381,0, ''), +(6729,4,-839.838,-473.654,-34.0535,0, ''), +(6729,5,-837.417,-473.105,-34.0288,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=7998; +INSERT INTO `script_waypoint` VALUES + (7998,1,-511.065,-134.51,-152.493,0, ''), + (7998,2,-511.862,-131.76,-152.932,0, ''), + (7998,3,-513.319,-126.733,-156.095,0, ''), + (7998,4,-515.969,-118.962,-156.109,0, ''), + (7998,5,-518.983,-111.608,-155.923,0, ''), + (7998,6,-522.392,-101.145,-155.228,0, ''), + (7998,7,-523.941,-96.9487,-154.823,0, ''), + (7998,8,-531.938,-104.249,-156.031,0, ''), + (7998,9,-533.141,-105.332,-156.017,30000, ''), + (7998,10,-541.3,-96.7414,-155.895,30000, ''), + (7998,11,-517.556,-106.826,-155.149,0, ''), + (7998,12,-508.757,-103.227,-151.742,30000, ''), + (7998,13,-512.396,-86.3113,-151.642,30000, ''), + (7998,14,-520.928,-117.679,-156.119,0, ''), + (7998,15,-521.717,-119.564,-156.114,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=35491; +INSERT INTO `script_waypoint` VALUES + (35491,1,754.709,646.999,442.961,0, ''), + (35491,2,738.85,637.289,439.134,0, ''), + (35491,3,727.272,619.164,438.186,0, ''), + (35491,4,733.524,608.939,433.711,0, ''), + (35491,5,745.537,605.399,428.795,0, ''), + (35491,6,754.46,607.124,426.542,0, ''), + (35491,7,763.48,616.796,422.603,0, ''), + (35491,8,761.823,625.299,418.482,0, ''), + (35491,9,755.923,631.506,413.966,0, ''), + (35491,10,744.841,634.505,411.575,0, ''); + +DELETE FROM `script_waypoint` WHERE `entry`=26588; +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`,`location_y`,`location_z`,`waittime`,`point_comment`) VALUES +(26588,1,4333.18,-3688.4,263.857,0, ''), +(26588,2,4341.38,-3683.77,257.422,0, ''), +(26588,3,4342.67,-3683.21,257.218,0, ''), +(26588,4,4346.22,-3688.72,257.065,0, ''), +(26588,5,4343.8,-3695.27,257.124,0, ''), +(26588,6,4337.74,-3707.2,257.628,0, ''), +(26588,7,4317.58,-3722.8,256.941,0, ''), +(26588,8,4306.64,-3736.46,258.304,0, ''), +(26588,9,4299.96,-3760.02,254.959,0, ''), +(26588,10,4294.21,-3777.34,249.139,1000, ''), +(26588,11,4294.37,-3776.97,249.259,10000, ''), +(26588,12,4300.22,-3794.61,240.107,2000, ''), +(26588,13,4307.25,-3817.76,231.414,2000, ''), +(26588,14,4326.31,-3883.31,208.457,2000, ''), +(26588,15,4346.19,-3905.41,198.805,2000, ''), +(26588,16,4347.39,-3916.43,196.716,5000, ''), +(26588,17,4350.17,-3935.03,191.824,1000, ''), +(26588,18,4347.24,-3939.54,191.445,2000, ''), +(26588,19,4347.24,-3939.54,191.445,2000, ''), +(26588,20,4347.24,-3939.54,191.445,5000, ''), +(26588,21,4347.24,-3939.54,191.445,7000, ''), +(26588,22,4347.24,-3939.54,191.445,5000, ''), +(26588,23,4347.24,-3939.54,191.445,5000, ''), +(26588,24,4347.24,-3939.54,191.445,0, ''), +(26588,25,4353.72,-3965.61,190.154,0, ''), +(26588,26,4363.12,-3995.61,183.327,0, ''), +(26588,27,4371.99,-4010.97,181.33,0, ''); + +-- script_waypoints for Arthas movements inside Culling +DELETE FROM `script_waypoint` WHERE `entry`=26499; +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`,`location_y`,`location_z`,`waittime`,`point_comment`) VALUES +(26499,0,1903.167,1291.573,143.32,0, 'culling Bridge WP1'), +(26499,1,1911.087,1314.263,150.026,0, 'culling Bridge WP2'), +(26499,2,1902.959,1295.127,143.388,10000, 'culling Bridge WP3'), +(26499,3,1913.726,1287.407,141.927,0, 'culling Bridge WP4'), +(26499,4,1990.833,1293.391,145.467,0, 'culling Bridge WP5'), +(26499,5,1997.003,1317.776,142.963,0, 'culling Bridge WP6'), +(26499,6,2019.631,1326.084,142.929,0, 'culling Bridge WP7'), +(26499,7,2026.469,1287.088,143.596,0, 'culling Bridge WP8'), +(26499,8,2050.660,1287.333,142.671,0, 'culling Bridge WP9'), +(26499,9,2081.447,1287.770,141.324,0, 'culling Streets WP1'), +(26499,10,2087.689,1280.344,140.730,0, 'culling Streets WP2'), +(26499,11,2092.154,1276.645,140.520,0, 'culling Streets WP3'), +(26499,12,2099.876,1280.21,138.55,0, 'culling Streets WP4'), +(26499,13,2120.757,1286.97,136.343,0, 'culling Streets WP5'), +(26499,14,2165.073,1279.338,133.40,0, 'culling Streets WP6'), +(26499,15,2186.441,1234.445,136.524,0, 'culling Streets WP7'), +(26499,16,2210.385,1207.550,136.259,0, 'culling Streets WP8'), +(26499,17,2243.594,1177.705,137.144,0, 'culling Streets WP9'), +(26499,18,2286.883,1177.262,137.631,0, 'culling Streets WP10'), +(26499,19,2320.374,1179.954,133.926,0, 'culling Streets WP11'), +(26499,20,2365.626,1194.838,131.974,0, 'culling Streets WP12'), +(26499,21,2366.559,1197.759,132.382,0, 'culling House WP1'), +(26499,22,2394.011,1205.148,134.125,0, 'culling House WP2'), +(26499,23,2395.854,1206.345,134.039,0, 'culling House WP3'), +(26499,24,2442.023,1219.205,133.999,0, 'culling House WP3'), +(26499,25,2447.105,1191.182,148.076,0, 'culling House WP4'), +(26499,26,2444.250,1190.510,148.076,0, 'culling House WP5'), +(26499,27,2418.487,1196.059,148.076,0, 'culling House WP6'), +(26499,28,2401.221,1191.705,148.076,0, 'culling House WP7'), +(26499,29,2409.205,1157.425,148.190,0, 'culling House WP8'), +(26499,30,2417.584,1121.026,148.082,0, 'culling House WP9'), +(26499,31,2423.123,1119.431,148.076,0, 'culling House WP10'), +(26499,32,2447.833,1112.714,148.076,0, 'culling House WP11'), +(26499,33,2457.133,1120.941,150.008,0, 'culling House WP12'), +(26499,34,2459.694,1127.012,150.008,0, 'culling House WP13'), +(26499,35,2469.617,1122.274,150.008,0, 'culling House WP14'), +(26499,36,2470.437,1122.794,150.008,3000, 'culling House WP15'), +(26499,37,2471.662,1123.077,150.035,3000, 'culling House WP16'), +(26499,38,2483.183,1125.042,149.905,0, 'culling Secret WP1'), +(26499,39,2487.867,1099.760,144.858,0, 'culling Secret WP2'), +(26499,40,2498.270,1101.929,144.599,0, 'culling Secret WP3'), +(26499,41,2492.114,1128.238,139.967,0, 'culling Secret WP4'), +(26499,42,2500.286,1130.183,139.982,0, 'culling Room WP1'), +(26499,43,2503.010,1119.241,139.978,0, 'culling Room WP2'), +(26499,44,2517.820,1122.645,132.066,0, 'culling Room WP3'), +(26499,45,2540.479,1129.061,130.868,7000, 'culling Fire Street WP1'), +(26499,46,2568.619,1157.794,126.906,0, 'culling Fire Street WP2'), +(26499,47,2556.074,1222.058,125.412,20000, 'culling Fire Street WP3'), +(26499,48,2521.531,1295.209,130.573,0, 'culling Fire Street WP4'), +(26499,49,2504.362,1348.667,132.944,0, 'culling Fire Street WP5'), +(26499,50,2450.594,1431.544,131.361,0, 'culling Fire Street WP6'), +(26499,51,2353.485,1404.839,128.531,0, 'culling Market WP1'), +(26499,52,2329.882,1406.273,128.013,0, 'culling Market WP2'), +(26499,53,2329.882,1406.273,128.013,12000, 'culling Market WP3'), +(26499,54,2327.391,1412.475,127.692,0, 'culling Market WP4'), +(26499,55,2303.016,1480.070,128.139,0, 'culling Crusader WP1'), +(26499,56,2296.665,1502.362,128.362,0, 'culling Crusader WP2'); + +-- Quest 12321 - Inquisitor Hallard in Dragonblight +DELETE FROM `script_waypoint` WHERE `entry`=27316; +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`,`location_y`,`location_z`,`waittime`,`point_comment`) VALUES +(27316,1,3801.11,-678.964,213.753,5000, ''), +(27316,2,3801.11,-678.964,213.753,5000, ''), +(27316,3,3801.11,-678.964,213.753,5000, ''), +(27316,4,3801.11,-678.964,213.753,5000, ''), +(27316,5,3801.11,-678.964,213.753,5000, ''), +(27316,6,3801.11,-678.964,213.753,5000, ''), +(27316,7,3801.11,-678.964,213.753,5000, ''), +(27316,8,3801.11,-678.964,213.753,5000, ''), +(27316,9,3801.11,-678.964,213.753,5000, ''), +(27316,10,3801.11,-678.964,213.753,5000, ''), +(27316,11,3801.11,-678.964,213.753,5000, ''), +(27316,12,3801.11,-678.964,213.753,5000, ''), +(27316,13,3801.11,-678.964,213.753,5000, ''), +(27316,14,3801.11,-678.964,213.753,5000, ''), +(27316,15,3801.11,-678.964,213.753,5000, ''), +(27316,16,3801.11,-678.964,213.753,5000, ''), +(27316,17,3801.11,-678.964,213.753,5000, ''), +(27316,18,3801.11,-678.964,213.753,5000, ''), +(27316,19,3801.11,-678.964,213.753,5000, ''), +(27316,20,3801.11,-678.964,213.753,5000, ''), +(27316,21,3801.11,-678.964,213.753,5000, ''), +(27316,22,3801.11,-678.964,213.753,5000, ''), +(27316,23,3801.11,-678.964,213.753,5000, ''), +(27316,24,3801.11,-678.964,213.753,5000, ''), +(27316,25,3801.11,-678.964,213.753,5000, ''), +(27316,26,3801.11,-678.964,213.753,5000, ''), +(27316,27,3801.11,-678.964,213.753,10000, ''); + +-- Quest 12832 - Bitter Departure +DELETE FROM `script_waypoint` WHERE `entry` =29434; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(29434, 1, 6645.47, -1263.66, 396.938, 0, ''), +(29434, 2, 6662.06, -1274.13, 397.319, 0, ''), +(29434, 3, 6666.29, -1254.59, 396.11, 0, ''), +(29434, 4, 6669.33, -1240.06, 397.789, 0, ''), +(29434, 5, 6654.31, -1205.01, 399.823, 0, ''), +(29434, 6, 6657.03, -1170.15, 398.755, 0, ''), +(29434, 7, 6667.33, -1146.28, 399.014, 0, ''), +(29434, 8, 6670.9, -1138.68, 397.125, 0, ''), +(29434, 9, 6685.09, -1103.95, 396.828, 0, ''), +(29434, 10, 6688.71, -1094.32, 395.019, 0, ''), +(29434, 11, 6684.75, -1084.31, 396.916, 0, ''), +(29434, 12, 6679.3, -1074.4, 404.284, 0, ''), +(29434, 13, 6691.91, -1051.96, 407.983, 0, ''), +(29434, 14, 6696.28, -1016.54, 414.823, 0, ''), +(29434, 15, 6675.32, -1005.06, 414.844, 0, ''), +(29434, 16, 6661.01, -1007.41, 414.946, 0, ''), +(29434, 17, 6643.75, -1010.24, 420.508, 0, ''), +(29434, 18, 6620.76, -1012.59, 424.378, 0, ''), +(29434, 19, 6610.33, -996.992, 428.116, 0, ''), +(29434, 20, 6581.3, -1005.9, 434.257, 0, ''), +(29434, 21, 6570.74, -1013, 434.076, 0, ''), +(29434, 22, 6551.68, -1012.38, 433.218, 0, ''), +(29434, 23, 6530.83, -1024.99, 433.04, 0, ''), +(29434, 24, 6510.05, -1031.23, 435.824, 0, ''), +(29434, 25, 6491.5, -1032.46, 434.226, 0, ''), +(29434, 26, 6475.58, -1023.13, 434.759, 0, ''), +(29434, 27, 6451.81, -1025.43, 431.502, 10000, ''); + +-- Quest 9446 - Tomb of the Lightbringer +DELETE FROM `script_waypoint` WHERE `entry`=17238; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(17238, 1, 953.061, -1432.52, 63.2255, 0, ''), +(17238, 2, 969.607, -1438.15, 65.3669, 0, ''), +(17238, 3, 980.073, -1441.5, 65.3997, 0, ''), +(17238, 4, 995.001, -1450.47, 61.3227, 0, ''), +(17238, 5, 1032.7, -1473.49, 63.7699, 0, ''), +(17238, 6, 1039.69, -1491.42, 65.2801, 0, ''), +(17238, 7, 1038.8, -1523.32, 64.4661, 0, ''), +(17238, 8, 1035.43, -1572.97, 61.5412, 0, ''), +(17238, 9, 1034.45, -1612.83, 61.6186, 0, ''), +(17238, 10, 1040.12, -1663.41, 60.923, 0, ''), +(17238, 11, 1059.75, -1703.75, 60.5768, 0, ''), +(17238, 12, 1091.83, -1735.24, 60.8057, 0, ''), +(17238, 13, 1131.75, -1755.32, 61.0073, 0, ''), +(17238, 14, 1159.77, -1762.64, 60.5699, 0, ''), +(17238, 15, 1153.79, -1772, 60.6475, 0, ''), +(17238, 16, 1115.4, -1787.21, 61.0759, 0, ''), +(17238, 17, 1091.88, -1799.06, 61.6055, 0, ''), +(17238, 18, 1056.22, -1805.65, 71.8112, 0, ''), +(17238, 19, 1024.03, -1807.93, 77.025, 0, ''), +(17238, 20, 1012.74, -1811.67, 77.5636, 0, ''), +(17238, 21, 1006.74, -1813.59, 80.4872, 0, ''), +(17238, 22, 983.15, -1823.05, 80.4872, 0, ''), +(17238, 23, 974.954, -1825.33, 81.3482, 5000, ''), +(17238, 24, 974.954, -1825.33, 81.3482, 5000, ''), +(17238, 25, 974.954, -1825.33, 81.3482, 5000, ''), +(17238, 26, 974.954, -1825.33, 81.3482, 5000, ''); + +-- Quest 1440 - Return to Vahlarriel +DELETE FROM `script_waypoint` WHERE `entry`=5644; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(5644, 1, -339.679, 1752.04, 139.482, 0, ''), +(5644, 2, -328.957, 1734.95, 139.327, 0, ''), +(5644, 3, -350.747, 1731.12, 139.338, 0, ''), +(5644, 4, -365.064, 1739.04, 139.376, 0, ''), +(5644, 5, -371.105, 1746.03, 139.374, 0, ''), +(5644, 6, -383.141, 1738.62, 138.93, 0, ''), +(5644, 7, -390.445, 1733.98, 136.353, 0, ''), +(5644, 8, -401.368, 1726.77, 131.071, 0, ''), +(5644, 9, -416.016, 1721.19, 129.807, 0, ''), +(5644, 10, -437.139, 1709.82, 126.342, 0, ''), +(5644, 11, -459.862, 1687.92, 116.059, 0, ''), +(5644, 12, -460.686, 1679.55, 111.976, 0, ''), +(5644, 13, -461.485, 1670.94, 109.033, 0, ''), +(5644, 14, -468.53, 1645.51, 102.811, 0, ''), +(5644, 15, -474.529, 1615.97, 97.228, 0, ''), +(5644, 16, -474.329, 1590.01, 94.4982, 0, ''); + +-- Quest 12688 - Engineering a Disaster +DELETE FROM `script_waypoint` WHERE `entry` =28787; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(28787, 0, 5919.43, 5374.88, -98.8816, 5000, ''), +(28787, 1, 5919.43, 5374.88, -98.8816, 5000, ''), +(28787, 2, 5925.17, 5372.37, -98.8815, 0, ''), +(28787, 3, 5928.32, 5377, -99.0266, 0, ''), +(28787, 4, 5917.24, 5383.36, -106.31, 0, ''), +(28787, 5, 5907.49, 5389.62, -106.31, 0, ''), +(28787, 6, 5899.66, 5405.25, -96.5535, 0, ''), +(28787, 7, 5890.27, 5395.42, -95.5519, 0, ''), +(28787, 8, 5887.57, 5384.4, -95.4326, 5000, ''), +(28787, 9, 5878.52, 5384.61, -93.3333, 0, ''), +(28787, 10, 5873.17, 5360.43, -98.4124, 0, ''), +(28787, 11, 5859.23, 5353.29, -98.8777, 0, ''), +(28787, 12, 5841.27, 5334.14, -100.446, 0, ''), +(28787, 13, 5819.81, 5300.27, -96.8567, 0, ''); + +-- Quest 6641 - Vorsha the Lasher +DELETE FROM `script_waypoint` WHERE `entry`=12717; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`,`location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(12717, 0, 3346.25, 1007.88, 3.59, 0, 'SAY_MUG_START2'), +(12717, 1, 3367.39, 1011.51, 3.72, 0, ''), +(12717, 2, 3418.64, 1013.96, 2.905, 0, ''), +(12717, 3, 3426.84, 1015.1, 3.449, 0, ''), +(12717, 4, 3437.03, 1020.79, 2.742, 0, ''), +(12717, 5, 3460.56, 1024.26, 1.353, 0, ''), +(12717, 6, 3479.87, 1037.96, 1.023, 0, ''), +(12717, 7, 3490.53, 1043.35, 3.338, 0, ''), +(12717, 8, 3504.28, 1047.77, 8.205, 0, ''), +(12717, 9, 3510.73, 1049.79, 12.143, 0, ''), +(12717, 10, 3514.41, 1051.17, 13.235, 0, ''), +(12717, 11, 3516.94, 1052.91, 12.918, 0, ''), +(12717, 12, 3523.64, 1056.3, 7.563, 0, ''), +(12717, 13, 3531.94, 1059.86, 6.175, 0, ''), +(12717, 14, 3535.48, 1069.96, 1.697, 0, ''), +(12717, 15, 3546.98, 1093.49, 0.68, 0, ''), +(12717, 16, 3549.73, 1101.88, -1.123, 0, ''), +(12717, 17, 3555.14, 1116.99, -4.326, 0, ''), +(12717, 18, 3571.94, 1132.18, -0.634, 0, ''), +(12717, 19, 3574.28, 1137.58, 3.684, 0, ''), +(12717, 20, 3579.31, 1137.25, 8.205, 0, ''), +(12717, 21, 3590.22, 1143.65, 8.291, 0, ''), +(12717, 22, 3595.97, 1145.83, 6.773, 0, ''), +(12717, 23, 3603.65, 1146.92, 9.763, 0, ''), +(12717, 24, 3607.08, 1146.01, 10.692, 5000, 'SAY_MUG_BRAZIER'), +(12717, 25, 3614.52, 1142.63, 10.248, 0, ''), +(12717, 26, 3616.66, 1140.84, 10.682, 3000, 'SAY_MUG_PATROL'), +(12717, 27, 3621.08, 1138.11, 10.369, 0, 'SAY_MUG_RETURN'), +(12717, 28, 3615.48, 1145.53, 9.614, 0, ''), +(12717, 29, 3607.19, 1152.72, 8.871, 0, ''); + +-- Waypoints for Mimiron Inferno +DELETE FROM `script_waypoint` WHERE `entry`=33370; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(33370, 1, 331.674, -68.6878, 409.804, 0, '0'), +(33370, 2, 274.578, -92.1829, 409.804, 0, '0'), +(33370, 3, 226.433, -66.6652, 409.793, 0, '0'), +(33370, 4, 206.092, -34.7447, 409.801, 0, '0'), +(33370, 5, 240.208, 1.10346, 409.802, 0, '0'), +(33370, 6, 337.199, 11.7051, 409.802, 0, '0'); diff --git a/sql/scripts/world_scripts_full.sql b/sql/scripts/world_scripts_full.sql new file mode 100644 index 0000000..5298b3c --- /dev/null +++ b/sql/scripts/world_scripts_full.sql @@ -0,0 +1,1580 @@ +-- Up to TC2 6928 + +-- Cleanup first +UPDATE `instance_template` SET `Script`=''; +UPDATE `item_template` SET `ScriptName`=''; +UPDATE `creature_template` SET `ScriptName`=''; +UPDATE `gameobject_template` SET `ScriptName`=''; + +/* AREA TRIGGERS */ +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (5284,5285,5286,5287,4871,4872,4873,5108,5332,5338,5334,5340,5369,5423); +DELETE FROM `areatrigger_scripts` WHERE `entry` BETWEEN 1726 AND 1740; +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES +(5284, 'at_aldurthar_gate'), +(5285, 'at_aldurthar_gate'), +(5286, 'at_aldurthar_gate'), +(5287, 'at_aldurthar_gate'), +(4871, 'at_warsong_farms'), +(4872, 'at_warsong_farms'), +(4873, 'at_warsong_farms'), +(5108, 'at_stormwright_shelf'), +(5332, 'at_last_rites'), +(5338, 'at_last_rites'), +(5334, 'at_last_rites'), +(5340, 'at_last_rites'), +(1726, 'at_scent_larkorwi'), +(1727, 'at_scent_larkorwi'), +(1728, 'at_scent_larkorwi'), +(1729, 'at_scent_larkorwi'), +(1730, 'at_scent_larkorwi'), +(1731, 'at_scent_larkorwi'), +(1732, 'at_scent_larkorwi'), +(1733, 'at_scent_larkorwi'), +(1734, 'at_scent_larkorwi'), +(1735, 'at_scent_larkorwi'), +(1736, 'at_scent_larkorwi'), +(1737, 'at_scent_larkorwi'), +(1738, 'at_scent_larkorwi'), +(1739, 'at_scent_larkorwi'), +(1740, 'at_scent_larkorwi'), +(5369, 'at_RX_214_repair_o_matic_station'), +(5423, 'at_RX_214_repair_o_matic_station'); + + +/* WORLD BOSS */ +UPDATE `creature_template` SET `ScriptName`='boss_ysondre' WHERE `entry`=14887; +UPDATE `creature_template` SET `ScriptName`='boss_emeriss' WHERE `entry`=14889; +UPDATE `creature_template` SET `ScriptName`='boss_taerar' WHERE `entry`=14890; +UPDATE `creature_template` SET `ScriptName`='boss_shade_of_taerar' WHERE `entry`=15302; +UPDATE `creature_template` SET `ScriptName`='boss_kruul' WHERE `entry`=18338; +UPDATE `creature_template` SET `ScriptName`='boss_azuregos' WHERE `entry`=6109; +UPDATE `creature_template` SET `ScriptName`='mob_dementeddruids' WHERE `entry`=15260; +UPDATE `creature_template` SET `ScriptName`='boss_mr_smite' WHERE `entry`=646; + +/* GO */ +UPDATE `gameobject_template` SET `ScriptName`='go_cat_figurine' WHERE `entry`=13873; +UPDATE `gameobject_template` SET `ScriptName`='go_northern_crystal_pylon' WHERE `entry`=164955; +UPDATE `gameobject_template` SET `ScriptName`='go_western_crystal_pylon' WHERE `entry`=164956; +UPDATE `gameobject_template` SET `ScriptName`='go_eastern_crystal_pylon' WHERE `entry`=164957; +UPDATE `gameobject_template` SET `ScriptName`='go_barov_journal' WHERE `entry`=180794; +UPDATE `gameobject_template` SET `ScriptName`='go_field_repair_bot_74A' WHERE `entry`=179552; +UPDATE `gameobject_template` SET `ScriptName`='go_orb_of_command' WHERE `entry`=179879; +UPDATE `gameobject_template` SET `ScriptName`='go_resonite_cask' WHERE entry=178145; +UPDATE `gameobject_template` SET `ScriptName`='go_tablet_of_madness' WHERE `entry`=180368; +UPDATE `gameobject_template` SET `ScriptName`='go_tablet_of_the_seven' WHERE `entry`=169294; +UPDATE `gameobject_template` SET `ScriptName`='go_manticron_cube' WHERE `entry`=181713; +UPDATE `gameobject_template` SET `ScriptName`='go_mausoleum_trigger' WHERE `entry`=104593; +UPDATE `gameobject_template` SET `ScriptName`='go_mausoleum_door' WHERE `entry`=176594; +UPDATE `gameobject_template` SET `ScriptName`='go_crystal_prison' WHERE `entry`=185126; +UPDATE `gameobject_template` SET `ScriptName`='go_legion_obelisk' WHERE `entry` IN (185193,185195,185196,185197,185198); +UPDATE `gameobject_template` SET `ScriptName`='go_jump_a_tron' WHERE `entry`=183146; +UPDATE `gameobject_template` SET `ScriptName`='go_ethereum_prison' WHERE `entry` BETWEEN 184418 AND 184431; +UPDATE `gameobject_template` SET `ScriptName`='go_ethereum_stasis' WHERE `entry` BETWEEN 185465 AND 185467; +UPDATE `gameobject_template` SET `ScriptName`='go_ethereum_stasis' WHERE `entry`=184595; +UPDATE `gameobject_template` SET `ScriptName`='go_ethereum_stasis' WHERE `entry` BETWEEN 185461 AND 185464; +UPDATE `gameobject_template` SET `ScriptName`='go_sacred_fire_of_life' WHERE `entry`=175944; +UPDATE `gameobject_template` SET `ScriptName`='go_skull_pile' WHERE `entry`=185913; +UPDATE `gameobject_template` SET `ScriptName`='go_tele_to_dalaran_crystal' WHERE `entry`=191230; +UPDATE `gameobject_template` SET `ScriptName`='go_tele_to_violet_stand' WHERE `entry`=191229; +UPDATE `gameobject_template` SET `ScriptName`='go_orb_of_the_blue_flight' WHERE `entry`=188415; +UPDATE `gameobject_template` SET `ScriptName`='go_acherus_soul_prison' WHERE `entry` IN (191577,191580,191581,191582,191583,191584,191585,191586,191587,191588,191589,191590); +UPDATE `gameobject_template` SET `ScriptName`='go_shrine_of_the_birds' WHERE `entry` IN (185547,185553,185551); +UPDATE `gameobject_template` SET `ScriptName`='go_matrix_punchograph' WHERE `entry` IN (142345,142475,142476,142696); +UPDATE `gameobject_template` SET `ScriptName`='go_jotunheim_cage' WHERE `entry`=192135; +UPDATE `gameobject_template` SET `scriptname`='go_inconspicuous_landmark' WHERE `entry`=142189; +UPDATE `gameobject_template` SET `ScriptName`='go_soulwell' WHERE `entry` IN (181621,193169); +UPDATE `gameobject_template` SET `scriptname`='go_tadpole_cage' WHERE `entry`=187373; +UPDATE `gameobject_template` SET `ScriptName`='go_dragonflayer_cage' WHERE entry IN (186566,186567,186568,186569,186570,186571,186572,186573,186574,186575); +UPDATE `gameobject_template` SET `ScriptName`='go_black_cage' WHERE `entry`=195310; +UPDATE `gameobject_template` SET `ScriptName`='go_massive_seaforium_charge' WHERE `entry`=190752; +UPDATE `gameobject_template` SET `ScriptName`='go_harpoon_launcher' WHERE `entry` IN (192175,192176,192177); + +/* GUARD */ +UPDATE `creature_template` SET `ScriptName`='guard_generic' WHERE `entry` IN (727,1423,1735,1738,1742,1743,1744,1745,1746,2209,2210,3084,3212,3215,3217,3218,3219,3220,3221,3222,3223,3224,3502,3571,4262,4264,5595,5624,5725,5953,9460,11190,13076,15184,16221,16222,16733,18038,19687); +UPDATE `creature_template` SET `ScriptName`='guard_orgrimmar' WHERE `entry`=3296; +UPDATE `creature_template` SET `ScriptName`='guard_stormwind' WHERE `entry` IN (68,1976); +UPDATE `creature_template` SET `ScriptName`='guard_shattrath_aldor' WHERE `entry`=18549; +UPDATE `creature_template` SET `ScriptName`='guard_shattrath_scryer' WHERE `entry`=18568; + +/* INNKEEPER */ +UPDATE `creature_template` SET `ScriptName`='npc_innkeeper' WHERE `entry` IN +(32418,32411,29926,30308,31433,32413,30005,29963,31115,31557,29971,18649,15397,6806,6778,16542,17553,19046,16739,16553,11116,9501, +6740,2352,6739,1247,3934,6727,7714,15433,16458,295,5111,7733,7737,6928,6929,6734,8931,1464,6272,7731,17630,6930,6747,12196,6736, +6738,11103,6741,6746,5688,6735,6737,2388,9356,7736,11106,5814,7744,6790,16618,11118,6791,23995,24208,6807,14731,16256,15174,16826, +19531,16602,19470,19232,21088,18245,18906,18905,18251,18907,18908,27148,18914,27187,21746,19352,19319,18957,19571,19495,18913,21744, +23731,21110,23143,23937,25278,25245,26596,24149,24033,25036,24057,27950,27042,22922,27066,27027,27052,26709,24342,26985,27125,26680, +29532,28687,28686,27174,28791,29583,26375,28038,29904); + +/* ITEM */ +UPDATE `item_template` SET `ScriptName`='item_draenei_fishing_net' WHERE `entry`=23654; +UPDATE `item_template` SET `ScriptName`='item_flying_machine' WHERE `entry` IN (34060,34061); +UPDATE `item_template` SET `ScriptName`='item_gor_dreks_ointment' WHERE `entry`=30175; +UPDATE `item_template` SET `ScriptName`='item_nether_wraith_beacon' WHERE `entry`=31742; +UPDATE `item_template` SET `ScriptName`='item_tainted_core' WHERE `entry`=31088; +UPDATE `item_template` SET `ScriptName`='item_only_for_flight' WHERE `entry` IN (34475,34489,24538); +UPDATE `item_template` SET `ScriptName`='item_incendiary_explosives' WHERE (`entry`=35704); +UPDATE `item_template` SET `ScriptName`='item_mysterious_egg' WHERE `entry` IN(39878); +UPDATE `item_template` SET `ScriptName`='item_disgusting_jar' WHERE `entry` IN(44717); +UPDATE `item_template` SET `ScriptName`='item_harvesters_gift' WHERE `entry`=39253; +UPDATE `item_template` SET `ScriptName`='item_petrov_cluster_bombs' WHERE `entry`=33098; +UPDATE `item_template` SET `ScriptName`='item_Trident_of_Nazjan' WHERE `entry`=35850; + +/* NPC (usually creatures to be found in more than one specific zone) */ +UPDATE `creature_template` SET `ScriptName`='npc_air_force_bots' WHERE `entry` IN (2614,2615,21974,21993,21996,21997,21999,22001,22002,22003,22063,22065,22066,22068,22069,22070,22071,22078,22079,22080,22086,22087,22088,22090,22124,22125,22126); +UPDATE `creature_template` SET `ScriptName`='npc_lunaclaw_spirit' WHERE `entry`=12144; +UPDATE `creature_template` SET `ScriptName`='npc_chicken_cluck' WHERE `entry`=620; +UPDATE `creature_template` SET `ScriptName`='npc_dancing_flames' WHERE `entry`=25305; +UPDATE `creature_template` SET `ScriptName`='npc_garments_of_quests' WHERE `entry` IN (12429,12423,12427,12430,12428); +UPDATE `creature_template` SET `ScriptName`='npc_guardian' WHERE `entry`=5764; +UPDATE `creature_template` SET `ScriptName`='npc_mount_vendor' WHERE `entry` IN (384,1261,1460,2357,3362,3685,4730,4731,4885,7952,7955,16264,17584); +UPDATE `creature_template` SET `ScriptName`='npc_doctor' WHERE `entry` IN (12939,12920); +UPDATE `creature_template` SET `ScriptName`='npc_injured_patient' WHERE `entry` IN (12936,12937,12938,12923,12924,12925); +UPDATE `creature_template` SET `ScriptName`='npc_prof_alchemy' WHERE `entry` IN (17909,19052,22427); +UPDATE `creature_template` SET `ScriptName`='npc_prof_blacksmith' WHERE `entry` IN (5164,11145,11146,11176,11177,11178,11191,11192,11193); +UPDATE `creature_template` SET `ScriptName`='npc_engineering_tele_trinket' WHERE `entry` IN (14742,14743,21493,21494); +UPDATE `creature_template` SET `ScriptName`='npc_prof_leather' WHERE `entry` IN (7866,7867,7868,7869,7870,7871); +UPDATE `creature_template` SET `ScriptName`='npc_prof_tailor' WHERE `entry` IN (22208,22212,22213); +UPDATE `creature_template` SET `ScriptName`='npc_rogue_trainer' WHERE `entry` IN (918,4163,3328,4583,5165,5167,13283,16684); +UPDATE `creature_template` SET `ScriptName`='npc_sayge' WHERE `entry`=14822; +UPDATE `creature_template` SET `ScriptName`='npc_steam_tonk' WHERE `entry`=19405; +UPDATE `creature_template` SET `ScriptName`='npc_tonk_mine' WHERE `entry`=15368; +UPDATE `creature_template` SET `ScriptName`='npc_winter_reveler' WHERE `entry`=15760; +UPDATE `creature_template` SET `ScriptName`='npc_brewfest_reveler' WHERE `entry`=24484; +UPDATE `creature_template` SET `ScriptName`='npc_snake_trap_serpents' WHERE `entry` IN (19921,19833); +UPDATE `creature_template` SET `ScriptName`='npc_unworthy_initiate' WHERE `entry` IN (29519,29520,29565,29566,29567); +UPDATE `creature_template` SET `ScriptName`='npc_unworthy_initiate_anchor' WHERE `entry`=29521; +UPDATE `creature_template` SET `ScriptName`='npc_kingdom_of_dalaran_quests' WHERE `entry` IN (29169,23729,26673,27158,29158,29161,26471,29155,29159,29160,29162); +UPDATE `creature_template` SET `ScriptName`='npc_taxi' WHERE `entry` IN (17435,23413,18725,19401,19409,20235,25059,25236,20903,20162,29154,23415,27575,26443,26949,23816,23704,26602,17209); +UPDATE `creature_template` SET `ScriptName`='npc_death_knight_initiate' WHERE `entry`=28406; +UPDATE `creature_template` SET `ScriptName`='npc_salanar_the_horseman' WHERE `entry` IN (28653,28788); +UPDATE `creature_template` SET `ScriptName`='npc_dark_rider_of_acherus' WHERE `entry`=28654; +UPDATE `creature_template` SET `ScriptName`='npc_ros_dark_rider' WHERE `entry`=28768; +UPDATE `creature_template` SET `ScriptName`='npc_dkc1_gothik' WHERE `entry`=28658; +UPDATE `creature_template` SET `ScriptName`='npc_scarlet_ghoul' WHERE `entry`=28845; +UPDATE `creature_template` SET `ScriptName`='npc_a_special_surprise' WHERE `entry` IN (29032,29061,29065,29067,29068,29070,29074,29072,29073,29071); +UPDATE `creature_template` SET `ScriptName`='npc_koltira_deathweaver' WHERE `entry`=28912; +UPDATE `creature_template` SET `ScriptName`='mob_high_inquisitor_valroth' WHERE `entry`=29001; +UPDATE `creature_template` SET `ScriptName`='npc_demolisher_engineerer' WHERE `entry` IN (30400,30499); +UPDATE `creature_template` SET `ScriptName`='npc_valkyr_battle_maiden' WHERE `entry`=28534; +UPDATE `creature_template` SET `ScriptName`='npc_mirror_image' WHERE `entry`=31216; +UPDATE `creature_template` SET `ScriptName`='npc_training_dummy' WHERE `entry` IN (17578,24792,32543,32546,32542,32545,30527,31143,31144,31146,32541,32666,32667,16111,2674,2673,33229,33243,33272); +UPDATE `creature_template` SET `ScriptName`='npc_lightwell' WHERE `entry` IN (31883,31893,31894,31895,31896,31897); +UPDATE `creature_template` SET `ScriptName`='npc_ebon_gargoyle' WHERE `entry`=27829; +UPDATE `gameobject_template` SET `ScriptName`='go_inconspicuous_mine_car' WHERE `entry`=190767; +UPDATE `creature_template` SET `ScriptName`='npc_scarlet_miner_cart' WHERE `entry`=28817; +UPDATE `creature_template` SET `ScriptName`='npc_scarlet_miner' WHERE `entry`=28841; +UPDATE `creature_template` SET `ScriptName`='npc_crusade_persuaded' WHERE `entry` IN (28939,28940,28610); +UPDATE `creature_template` SET `ScriptName`='mob_scarlet_courier' WHERE `entry`=29076; +UPDATE `creature_template` SET `AIName`='ArchorAI', `ScriptName`='' WHERE `entry` IN (29102,29103); +UPDATE `creature_template` SET `AIName`='TurretAI', `ScriptName`='' WHERE `entry`=29104; +UPDATE `creature_template` SET `ScriptName`='npc_highlord_darion_mograine' WHERE `entry`=29173; +UPDATE `creature_template` SET `ScriptName`='npc_the_lich_king_tirion_dawn' WHERE `entry` IN (29183,29175); +UPDATE `creature_template` SET `ScriptName`='npc_shadowfiend' WHERE `entry`=19668; +UPDATE `creature_template` SET `ScriptName`='npc_wormhole' WHERE `entry`=35646; +UPDATE `creature_template` SET `ScriptName`='npc_pet_trainer' WHERE `entry` IN (10090,3698,17484,4320,3545,16712,3622,16675,3620,10086,2879,3306,543,2878,3688,10089,16271,10088,3624); +UPDATE `creature_template` SET `ScriptName`='npc_locksmith' WHERE `entry` IN (29665,29725,29728); +UPDATE `creature_template` SET `ScriptName`='npc_tabard_vendor' WHERE `entry`=28776; +UPDATE `creature_template` SET `ScriptName`='npc_experience'WHERE `entry` IN (35364,35365); + +/* */ +/* ZONE */ +/* */ + +/* ALTERAC MOUNTAINS */ + +/* ALTERAC VALLEY */ + +UPDATE `creature_template` SET `ScriptName`='boss_drekthar' WHERE `entry`=11946; +UPDATE `creature_template` SET `ScriptName`='boss_vanndar' WHERE `entry`=11948; +UPDATE `creature_template` SET `ScriptName`='boss_balinda' WHERE `entry`=11949; +UPDATE `creature_template` SET `ScriptName`='mob_water_elemental' WHERE `entry`=25040; +UPDATE `creature_template` SET `ScriptName`='boss_galvangar' WHERE `entry`=11947; +UPDATE `creature_template` SET `ScriptName`='mob_av_marshal_or_warmaster' WHERE `entry` IN (14762,14763,14764,14765,14772,14773,14776,14777); + +/* ARATHI HIGHLANDS */ +UPDATE `creature_template` SET `ScriptName`='npc_professor_phizzlethorpe' WHERE `entry`=2768; + +/* ASHENVALE */ +UPDATE `creature_template` SET `ScriptName`='npc_torek' WHERE `entry`=12858; +UPDATE `creature_template` SET `ScriptName`='npc_ruul_snowhoof' WHERE `entry`=12818; +UPDATE `gameobject_template` SET `ScriptName`='go_naga_brazier' WHERE `entry`=178247; +UPDATE `creature_template` SET `ScriptName`='npc_muglash' WHERE `entry`=12717; + +/* AUCHINDOUN */ + +/* MANA TOMBS */ +UPDATE `creature_template` SET `ScriptName`='boss_pandemonius' WHERE `entry`=18341; +UPDATE `creature_template` SET `ScriptName`='boss_nexusprince_shaffar' WHERE `entry`=18344; +UPDATE `creature_template` SET `ScriptName`='mob_ethereal_beacon' WHERE `entry`=18431; +UPDATE `creature_template` SET `ScriptName`='mob_ethereal_apprentice' WHERE `entry`=18430; + +/* AUCHENAI CRYPTS */ +UPDATE `creature_template` SET `ScriptName`='boss_exarch_maladaar' WHERE `entry`=18373; +UPDATE `creature_template` SET `ScriptName`='mob_avatar_of_martyred' WHERE `entry`=18478; +UPDATE `creature_template` SET `ScriptName`='mob_stolen_soul' WHERE `entry`=18441; +UPDATE `creature_template` SET `ScriptName`='boss_shirrak_the_dead_watcher' WHERE `entry`=18371; +UPDATE `creature_template` SET `ScriptName`='mob_focus_fire' WHERE `entry`=18374; + +/* SETHEKK HALLS */ +UPDATE `instance_template` SET `script`='instance_sethekk_halls' WHERE `map`=556; +UPDATE `creature_template` SET `ScriptName`='mob_syth_fire' WHERE `entry`=19203; +UPDATE `creature_template` SET `ScriptName`='mob_syth_arcane' WHERE `entry`=19205; +UPDATE `creature_template` SET `ScriptName`='mob_syth_frost' WHERE `entry`=19204; +UPDATE `creature_template` SET `ScriptName`='mob_syth_shadow' WHERE `entry`=19206; +UPDATE `creature_template` SET `ScriptName`='boss_talon_king_ikiss' WHERE `entry`=18473; +UPDATE `creature_template` SET `ScriptName`='boss_darkweaver_syth' WHERE `entry`=18472; + +/* SHADOW LABYRINTH */ +UPDATE `instance_template` SET `script`='instance_shadow_labyrinth' WHERE `map`=555; +UPDATE `creature_template` SET `ScriptName`='boss_murmur' WHERE `entry`=18708; +UPDATE `creature_template` SET `ScriptName`='boss_grandmaster_vorpil' WHERE `entry`=18732; +UPDATE `creature_template` SET `ScriptName`='boss_blackheart_the_inciter' WHERE `entry`=18667; +UPDATE `creature_template` SET `ScriptName`='boss_ambassador_hellmaw' WHERE `entry`=18731; +UPDATE `creature_template` SET `ScriptName`='mob_voidtraveler' WHERE `entry`=19226; + +/* AZJOL-NERUB */ +UPDATE `instance_template` SET `script`='instance_azjol_nerub' WHERE `map`=601; +UPDATE `creature_template` SET `ScriptName`='npc_watcher_narjil' WHERE `entry`=28729; +UPDATE `creature_template` SET `ScriptName`='npc_watcher_silthik' WHERE `entry`=28731; +UPDATE `creature_template` SET `ScriptName`='npc_anub_ar_warrior' WHERE `entry`=28732; +UPDATE `creature_template` SET `ScriptName`='npc_watcher_gashra' WHERE `entry`=28730; +UPDATE `creature_template` SET `ScriptName`='boss_krik_thir' WHERE `entry`=28684; +UPDATE `creature_template` SET `ScriptName`='npc_skittering_infector' WHERE `entry`=28736; +UPDATE `creature_template` SET `ScriptName`='npc_anub_ar_skirmisher' WHERE `entry`=28734; +UPDATE `creature_template` SET `ScriptName`='npc_anub_ar_shadowcaster' WHERE `entry`=28733; +UPDATE `creature_template` SET `ScriptName`='boss_hadronox' WHERE `entry`=28921; +UPDATE `creature_template` SET `ScriptName`='boss_anub_arak' WHERE `entry`=29120; + +/* AHN'KAHET: THE OLD KINGDOM */ +UPDATE `instance_template` SET `script`='instance_ahnkahet' WHERE `map`=619; +UPDATE `creature_template` SET `ScriptName`='boss_elder_nadox' WHERE `entry`=29309; +UPDATE `creature_template` SET `ScriptName`='mob_ahnkahar_nerubian' WHERE `entry` IN (30176,30178); +UPDATE `creature_template` SET `ScriptName`='boss_taldaram' WHERE `entry`=29308; +UPDATE `creature_template` SET `ScriptName`='mob_taldaram_flamesphere' WHERE `entry` IN (30106,31686,31687); +UPDATE `gameobject_template` SET `ScriptName`='prince_taldaram_sphere' WHERE `entry` IN (193093,193094); +UPDATE `creature_template` SET `ScriptName`='boss_volazj' WHERE `entry`=29311; +UPDATE `creature_template` SET `ScriptName`='boss_amanitar' WHERE `entry`=30258; +UPDATE `creature_template` SET `ScriptName`='mob_amanitar_mushrooms' WHERE `entry` IN (30435,30391); +UPDATE `creature_template` SET `ScriptName`='mob_nadox_eggs' WHERE `entry` IN (30172,30173); +UPDATE `creature_template` SET `ScriptName`='boss_jedoga_shadowseeker' WHERE `entry`=29310; +UPDATE `creature_template` SET `ScriptName`='mob_jedoga_initiand' WHERE `entry`=30114; +UPDATE `creature_template` SET `ScriptName`='npc_jedogas_aufseher_trigger' WHERE `entry`=30181; + +/* AZSHARA */ +UPDATE `creature_template` SET `ScriptName`='mobs_spitelashes' WHERE `entry` IN (6190,6193,6194,6195,6196,7885,7886,12204,12205); +UPDATE `creature_template` SET `ScriptName`='npc_loramus_thalipedes' WHERE `entry`=7783; +UPDATE `creature_template` SET `ScriptName`='mob_rizzle_sprysprocket' WHERE `entry`=23002; +UPDATE `creature_template` SET `ScriptName`='mob_depth_charge' WHERE `entry`=23025; + +/* AZUREMYST ISLE */ +UPDATE `creature_template` SET `ScriptName`='npc_engineer_spark_overgrind' WHERE `entry`=17243; +UPDATE `creature_template` SET `ScriptName`='npc_injured_draenei' WHERE `entry`=16971; +UPDATE `creature_template` SET `ScriptName`='npc_magwin' WHERE `entry`=17312; +UPDATE `creature_template` SET `ScriptName`='npc_geezle' WHERE `entry`=17318; +UPDATE `creature_template` SET `ScriptName`='npc_nestlewood_owlkin' WHERE `entry`=16518; +UPDATE `creature_template` SET `ScriptName`='npc_draenei_survivor' WHERE `entry`=16483; +UPDATE `creature_template` SET `ScriptName`='npc_death_ravager' WHERE `entry`=17556; +UPDATE `creature_template` SET `ScriptName`='npc_stillpine_capitive' where `entry`=17375; +UPDATE `gameobject_template` SET `ScriptName`='go_ravager_cage' WHERE `entry`=181849; +UPDATE `gameobject_template` SET `ScriptName`='go_bristlelimb_cage' WHERE `entry`=181714; + +/* BADLANDS */ + +/* BARRENS */ +UPDATE `creature_template` SET `ScriptName`='npc_beaten_corpse' WHERE `entry`=10668; +UPDATE `creature_template` SET `ScriptName`='npc_gilthares' WHERE `entry`=3465; +UPDATE `creature_template` SET `ScriptName`='npc_sputtervalve' WHERE `entry`=3442; +UPDATE `creature_template` SET `ScriptName`='npc_taskmaster_fizzule' WHERE `entry`=7233; +UPDATE `creature_template` SET `ScriptName`='npc_twiggy_flathead' WHERE `entry`=6248; +UPDATE `creature_template` SET `ScriptName`='npc_wizzlecrank_shredder' WHERE `entry`=3439; + +/* BLACK TEMPLE */ +UPDATE `gameobject_template` SET `ScriptName`='go_najentus_spine' WHERE `entry`=185584; +UPDATE `gameobject_template` SET `ScriptName`='gameobject_cage_trap' WHERE `entry`=185916; -- Cage Trap GO in Illidan Encounter +UPDATE `instance_template` SET `script`='instance_black_temple' WHERE `map`=564; +UPDATE `creature_template` SET `ScriptName`='npc_akama_shade' WHERE `entry`=22990; -- Akama at Shade of Akama +UPDATE `creature_template` SET `ScriptName`='npc_akama_illidan' WHERE `entry`=23089; -- Akama at Illidan +UPDATE `creature_template` SET `ScriptName`='mob_illidari_council' WHERE `entry`=23426; -- Illidari Council controller mob +UPDATE `creature_template` SET `ScriptName`='mob_blood_elf_council_voice_trigger' WHERE `entry`=23499; -- Voice Trigger Mob (Controls Aggro + Enrage yells) +UPDATE `creature_template` SET `ScriptName`='boss_veras_darkshadow' WHERE `entry`=22952; -- Rogue of Illidari Council +UPDATE `creature_template` SET `ScriptName`='boss_teron_gorefiend' WHERE `entry`=22871; -- Teron Gorefiend +UPDATE `creature_template` SET `ScriptName`='boss_supremus' WHERE `entry`=22898; -- Supremus +UPDATE `creature_template` SET `ScriptName`='boss_shade_of_akama' WHERE `entry`=22841; -- Shade of Akama +UPDATE `creature_template` SET `ScriptName`='boss_reliquary_of_souls' WHERE `entry`=22856; -- Reliquary Controller Mob +UPDATE `creature_template` SET `ScriptName`='boss_essence_of_suffering' WHERE `entry`=23418; -- Essence Of Suffering +UPDATE `creature_template` SET `ScriptName`='boss_essence_of_desire' WHERE `entry`=23419; -- Essence of Desire +UPDATE `creature_template` SET `ScriptName`='boss_essence_of_anger' WHERE `entry`=23420; -- Essence of Anger +UPDATE `creature_template` SET `ScriptName`='boss_najentus' WHERE `entry`=22887; -- High Warlord Naj'entus +UPDATE `creature_template` SET `ScriptName`='boss_gurtogg_bloodboil' WHERE `entry`=22948; -- Gurtogg Bloodboil +UPDATE `creature_template` SET `ScriptName`='boss_mother_shahraz' WHERE `entry`=22947; -- Mother Shahraz +UPDATE `creature_template` SET `ScriptName`='boss_lady_malande' WHERE `entry`=22951; -- Priest <3 at Illidari Council +UPDATE `creature_template` SET `ScriptName`='boss_illidan_stormrage' WHERE `entry`=22917; -- Illidan The Betrayer! +UPDATE `creature_template` SET `ScriptName`='boss_high_nethermancer_zerevor' WHERE `entry`=22950; -- Mage at Illidari Council +UPDATE `creature_template` SET `ScriptName`='boss_gathios_the_shatterer' WHERE `entry`=22949; -- Paladin at Illidari Council +UPDATE `creature_template` SET `ScriptName`='boss_maiev_shadowsong' WHERE `entry`=23197; -- Maiev Shadowsong +UPDATE `creature_template` SET `ScriptName`='mob_blaze' WHERE `entry`=23259; -- Blaze mob in Illidan Phase 2 +UPDATE `creature_template` SET `ScriptName`='mob_flame_of_azzinoth' WHERE `entry`=22997; -- Flame of Azzinoth (Illidan Phase 2) +UPDATE `creature_template` SET `ScriptName`='mob_blade_of_azzinoth' WHERE `entry`=22996; -- Blade of Azzinoth (Illidan Phase 2) +UPDATE `creature_template` SET `ScriptName`='mob_demon_fire' WHERE `entry`=23069; -- Demon Fire in Illidan Phase 2 +UPDATE `creature_template` SET `ScriptName`='mob_flame_crash' WHERE `entry`=23336; -- Flame Crash in Illidan Normal Form +UPDATE `creature_template` SET `ScriptName`='mob_cage_trap_trigger' WHERE `entry`=23304; -- Cage Trap mob in Illidan Phase 3/4 Normal +UPDATE `creature_template` SET `ScriptName`='mob_shadow_demon' WHERE `entry`=23375; -- Shadow Demon in Illidan Demon Form +UPDATE `creature_template` SET `ScriptName`='npc_volcano' WHERE `entry`=23085; -- Supremus Volcano +UPDATE `creature_template` SET `ScriptName`='molten_flame' WHERE `entry`=23095; -- Molten Flame in SUpremus +UPDATE `creature_template` SET `ScriptName`='mob_ashtongue_channeler' WHERE `entry`=23421; -- Ashtongue CHanneler in Shade of AKama +UPDATE `creature_template` SET `ScriptName`='mob_ashtongue_sorcerer' WHERE `entry`=23215; -- Ashtongue Sorcerer in Shade of Akama +UPDATE `creature_template` SET `ScriptName`='npc_enslaved_soul' WHERE `entry`=23469; -- Enslaved Soul in Reliquary Event +UPDATE `creature_template` SET `ScriptName`='mob_doom_blossom' WHERE `entry`=23123; -- Doom Blossoms in Teron Gorefiend's encounter +UPDATE `creature_template` SET `ScriptName`='npc_spirit_of_olum' WHERE `entry`=23411; +UPDATE `creature_template` SET `ScriptName`='mob_shadowy_construct' WHERE `entry`=23111; +UPDATE `creature_template` SET `ScriptName`='mob_parasitic_shadowfiend' WHERE `entry`=23498; + +/* BLACKFATHOM DEPTHS */ +UPDATE `instance_template` SET `script`='instance_blackfathom_deeps' WHERE `map`=48; +UPDATE `gameobject_template` SET `ScriptName`='go_blackfathom_fire' WHERE `entry` IN (21118,21119,21120,21121); +UPDATE `gameobject_template` SET `ScriptName`='go_blackfathom_altar' WHERE `entry` IN (103015,103016); +UPDATE `creature_template` SET `ScriptName`='boss_gelihast' WHERE `entry`=6243; +UPDATE `creature_template` SET `ScriptName`='boss_kelris' WHERE `entry`=4832; +UPDATE `creature_template` SET `ScriptName`='boss_aku_mai' WHERE `entry`=4829; +UPDATE `creature_template` SET `ScriptName`='npc_blackfathom_deeps_event' WHERE `entry` IN (4823,4825,4977,4978); +UPDATE `creature_template` SET `ScriptName`='npc_morridune' WHERE `entry`=6729; + +/* BLACKROCK DEPTHS */ +UPDATE `instance_template` SET `script`='instance_blackrock_depths' WHERE `map`=230; +UPDATE `creature_template` SET `ScriptName`='boss_emperor_dagran_thaurissan' WHERE `entry`=9019; +UPDATE `creature_template` SET `ScriptName`='boss_moira_bronzebeard' WHERE `entry`=8929; +UPDATE `creature_template` SET `ScriptName`='boss_ambassador_flamelash' WHERE `entry`=9156; +UPDATE `creature_template` SET `ScriptName`='boss_anubshiah' WHERE `entry`=9031; +UPDATE `creature_template` SET `ScriptName`='boss_doomrel' WHERE `entry`=9039; +UPDATE `creature_template` SET `ScriptName`='boss_gloomrel' WHERE `entry`=9037; +UPDATE `creature_template` SET `ScriptName`='boss_general_angerforge' WHERE `entry`=9033; +UPDATE `creature_template` SET `ScriptName`='boss_gorosh_the_dervish' WHERE `entry`=9027; +UPDATE `creature_template` SET `ScriptName`='boss_grizzle' WHERE `entry`=9028; +UPDATE `creature_template` SET `ScriptName`='boss_high_interrogator_gerstahn' WHERE `entry`=9018; +UPDATE `creature_template` SET `ScriptName`='boss_magmus' WHERE `entry`=9938; +UPDATE `creature_template` SET `ScriptName`='npc_lokhtos_darkbargainer' WHERE `entry`=12944; +UPDATE `creature_template` SET `ScriptName`='npc_kharan_mighthammer' WHERE `entry`=9021; +UPDATE `creature_template` SET `ScriptName`='npc_grimstone' WHERE `entry`=10096; +UPDATE `creature_template` SET `ScriptName`='npc_rocknot' WHERE `entry`=9503; +UPDATE `creature_template` SET `ScriptName`='mob_phalanx' WHERE `entry`=9502; +UPDATE `gameobject_template` SET `ScriptName`='go_shadowforge_brazier' WHERE `entry` IN (174744,174745); + +/* BLACKROCK SPIRE */ + +UPDATE `instance_template` SET `script`='instance_blackrock_spire' WHERE `map`=229; +UPDATE `creature_template` SET `ScriptName`='npc_rookey_whelp' WHERE `entry`=10161; +UPDATE `gameobject_template` SET `ScriptName`='go_rookey_egg' WHERE `entry`=175124; + +/* BLACKROCK SPIRE Lower bosses */ +UPDATE `creature_template` SET `ScriptName`='boss_highlord_omokk' WHERE `entry`=9196; +UPDATE `creature_template` SET `ScriptName`='boss_shadow_hunter_voshgajin' WHERE `entry`=9236; +UPDATE `creature_template` SET `ScriptName`='boss_warmaster_voone' WHERE `entry`=9237; +UPDATE `creature_template` SET `ScriptName`='boss_mother_smolderweb' WHERE `entry`=10596; +UPDATE `creature_template` SET `ScriptName`='quartermaster_zigris' WHERE `entry`=9736; +UPDATE `creature_template` SET `ScriptName`='boss_halycon' WHERE `entry`=10220; +UPDATE `creature_template` SET `ScriptName`='boss_overlord_wyrmthalak' WHERE `entry`=9568; +/* BLACKROCK SPIRE Upper bosses */ +UPDATE `creature_template` SET `ScriptName`='boss_the_beast' WHERE `entry`=10430; +UPDATE `creature_template` SET `ScriptName`='boss_drakkisath' WHERE `entry`=10363; +UPDATE `creature_template` SET `ScriptName`='boss_gyth' WHERE `entry`=10339; +UPDATE `creature_template` SET `ScriptName`='boss_rend_blackhand' WHERE `entry`=10429; +UPDATE `creature_template` SET `ScriptName`='boss_pyroguard_emberseer' WHERE `entry`=9816; + +/* BLACKWING LAIR */ +UPDATE `instance_template` SET `script`='instance_blackwing_lair' WHERE `map`=469; +UPDATE `creature_template` SET `ScriptName`='boss_razorgore' WHERE `entry`=12435; +UPDATE `creature_template` SET `ScriptName`='boss_vaelastrasz' WHERE `entry`=13020; +UPDATE `creature_template` SET `ScriptName`='boss_broodlord' WHERE `entry`=12017; +UPDATE `creature_template` SET `ScriptName`='boss_firemaw' WHERE `entry`=11983; +UPDATE `creature_template` SET `ScriptName`='boss_ebonroc' WHERE `entry`=14601; +UPDATE `creature_template` SET `ScriptName`='boss_flamegor' WHERE `entry`=11981; +UPDATE `creature_template` SET `ScriptName`='boss_chromaggus' WHERE `entry`=14020; +UPDATE `creature_template` SET `ScriptName`='boss_victor_nefarius' WHERE `entry`=10162; +UPDATE `creature_template` SET `ScriptName`='boss_nefarian' WHERE `entry`=11583; + +/* BLADE'S EDGE MOUNTAINS */ +UPDATE `creature_template` SET `ScriptName`='mobs_bladespire_ogre' WHERE `entry` IN (19998,20334,21296,21975); +UPDATE `creature_template` SET `ScriptName`='mobs_nether_drake' WHERE `entry` IN (20021,21817,21820,21821,21823); +UPDATE `creature_template` SET `ScriptName`='npc_daranelle' WHERE `entry`=21469; +UPDATE `creature_template` SET `ScriptName`='npc_overseer_nuaar' WHERE `entry`=21981; +UPDATE `creature_template` SET `ScriptName`='npc_saikkal_the_elder' WHERE `entry`=22932; +UPDATE `gameobject_template` SET `ScriptName`='go_fel_crystalforge' WHERE `entry`=185919; +UPDATE `gameobject_template` SET `ScriptName`='go_bashir_crystalforge' WHERE `entry`=185921; +UPDATE `creature_template` SET `ScriptName`='npc_ogre_brute' WHERE `entry`=19995; +UPDATE `creature_template` SET `ScriptName`='npc_bloodmaul_brutebane' WHERE `entry`=21241; + +/* BLASTED LANDS */ +UPDATE `creature_template` SET `ScriptName`='npc_deathly_usher' WHERE `entry`=8816; +UPDATE `creature_template` SET `ScriptName`='npc_fallen_hero_of_horde' WHERE `entry`=7572; + +/* BLOODMYST ISLE */ +UPDATE `creature_template` SET `ScriptName`='mob_webbed_creature' WHERE `entry`=17680; +UPDATE `creature_template` SET `ScriptName`='npc_captured_sunhawk_agent' WHERE `entry`=17824; + +/* BOREAN TUNDRA */ +UPDATE `creature_template` SET `ScriptName`='npc_fizzcrank_fullthrottle' WHERE `entry`=25590; +UPDATE `creature_template` SET `ScriptName`='npc_surristrasz' WHERE `entry`=24795; +UPDATE `creature_template` SET `ScriptName`='npc_tiare' WHERE `entry`=30051; +UPDATE `creature_template` SET `ScriptName`='npc_sinkhole_kill_credit' WHERE `entry` IN (26248,26249); +UPDATE `creature_template` SET `ScriptName`='npc_khunok_the_behemoth' WHERE `entry`=25862; +UPDATE `creature_template` SET `ScriptName`='npc_keristrasza' WHERE `entry`=26206; +UPDATE `creature_template` SET `ScriptName`='npc_iruk' WHERE `entry`=26219; +UPDATE `creature_template` SET `ScriptName`='npc_corastrasza' WHERE `entry`=32548; +UPDATE `creature_template` SET `ScriptName`='mob_nerubar_victim' WHERE `entry`=25284; +UPDATE `creature_template` SET `ScriptName`='npc_scourge_prisoner' WHERE `entry`=25610; +UPDATE `gameobject_template` SET `ScriptName`='go_scourge_cage' WHERE `entry` IN (187854,187855,187856,187857,187858,187859,187860,187862,187863,187864,187865,187866,187867,187868,187870,187871,187872,187873,187874,187861,190803); +UPDATE `gameobject_template` SET `ScriptName`='go_arcane_prison' WHERE `entry`=187561; +UPDATE `creature_template` SET `ScriptName`='npc_loklira_crone' WHERE `entry`=29975; +UPDATE `creature_template` SET `ScriptName`='npc_victorious_challenger' WHERE `entry`=30012; +UPDATE `creature_template` SET `ScriptName`='npc_mcgoyver' WHERE `entry`=24040; +UPDATE `creature_template` SET `ScriptName`='npc_jenny' WHERE `entry`=25969; +UPDATE `creature_template` SET `ScriptName`='npc_lurgglbr' WHERE `entry`=25208; +UPDATE `creature_template` SET `ScriptName`='npc_nexus_drake_hatchling' WHERE `entry`=26127; +UPDATE `creature_template` SET `ScriptName`='npc_nesingwary_trapper' WHERE `entry`=25835; +UPDATE `item_template` SET `ScriptName`='item_pile_fake_furs' WHERE `entry`=35127; +UPDATE `creature_template` SET `ScriptName`='npc_general_arlos' WHERE `entry`=25250; +UPDATE `creature_template` SET `ScriptName`='npc_leryssa' WHERE `entry`=25251; +UPDATE `creature_template` SET `ScriptName`='npc_thassarian' WHERE `entry`=26170; +UPDATE `creature_template` SET `ScriptName`='npc_image_lich_king' WHERE `entry`=26203; +UPDATE `creature_template` SET `ScriptName`='npc_counselor_talbot' WHERE `entry`=25301; +UPDATE `creature_template` SET `ScriptName`='npc_beryl_sorcerer' WHERE `entry`=25316; +UPDATE `creature_template` SET `ScriptName`='npc_imprisoned_beryl_sorcerer' WHERE `entry`=25478; +UPDATE `creature_template` SET `ScriptName`='npc_mootoo_the_younger' WHERE `entry`=25504; +UPDATE `creature_template` SET `ScriptName`='npc_bonker_togglevolt' WHERE `entry`=25589; +UPDATE `creature_template` SET `ScriptName`='npc_fezzix_geartwist' WHERE `entry`=25849; +UPDATE `creature_template` SET `scriptname`='npc_trapped_mammoth_calf' WHERE `entry`=25850; +UPDATE `item_template` SET `scriptname`='item_dehta_trap_smasher' WHERE `entry`=35228; +UPDATE `creature_template` SET `ScriptName`='npc_magmoth_crusher' WHERE `entry`=25434; +UPDATE `creature_template` SET `ScriptName`='npc_valiance_keep_cannoneer' WHERE `entry`=25306; +UPDATE `creature_template` SET `ScriptName`='npc_warmage_coldarra' WHERE `entry` IN (27173,27904,27906); +UPDATE `creature_template` SET `ScriptName`='npc_valiance_keep_cannoneer' WHERE `entry`=25306; +UPDATE `creature_template` SET `ScriptName`= 'npc_seaforium_depth_charge' WHERE `entry`=25401; + + +/* BURNING STEPPES */ +UPDATE `creature_template` SET `ScriptName`='npc_ragged_john' WHERE `entry`=9563; + +/* CAVERNS OF TIME - CULLING OF STRATHOLME */ +UPDATE `instance_template` SET `script`='instance_culling_of_stratholme' WHERE `map`=595; +UPDATE `creature_template` SET `Scriptname`='npc_arthas' WHERE `entry`=26499; +UPDATE `creature_template` SET `Scriptname`='boss_salramm' WHERE `entry`=26530; +UPDATE `creature_template` SET `Scriptname`='boss_meathook' WHERE `entry`=26529; +UPDATE `creature_template` SET `Scriptname`='boss_epoch' WHERE `entry`=26532; +UPDATE `creature_template` SET `Scriptname`='boss_mal_ganis' WHERE `entry`=26533; +UPDATE `creature_template` SET `Scriptname`='boss_infinite_corruptor' WHERE `entry`=32273; + +/* CRYSTALSONG FOREST */ +UPDATE `creature_template` SET `ScriptName`='npc_warmage_violetstand' WHERE `entry` IN (32369,32371,32372); + +/* MT. HYJAL */ +UPDATE `instance_template` SET `script`='instance_hyjal' WHERE `map`=534; +UPDATE `creature_template` SET `ScriptName`='npc_tyrande_whisperwind' WHERE `entry`=17948; +UPDATE `creature_template` SET `ScriptName`='npc_thrall' WHERE `entry`=17852; +UPDATE `creature_template` SET `ScriptName`='npc_jaina_proudmoore' WHERE `entry`=17772; +UPDATE `creature_template` SET `ScriptName`='boss_archimonde' WHERE `entry`=17968; +UPDATE `creature_template` SET `ScriptName`='mob_doomfire' WHERE `entry`=18095; +UPDATE `creature_template` SET `ScriptName`='mob_doomfire_targetting' WHERE `entry`=18104; +UPDATE `creature_template` SET `ScriptName`='mob_ancient_wisp' WHERE `entry`=17946; +UPDATE `creature_template` SET `ScriptName`='mob_giant_infernal' WHERE `entry`=17908; +UPDATE `creature_template` SET `ScriptName`='mob_abomination' WHERE `entry`=17898; +UPDATE `creature_template` SET `ScriptName`='mob_ghoul' WHERE `entry`=17895; +UPDATE `creature_template` SET `ScriptName`='mob_necromancer' WHERE `entry`=17899; +UPDATE `creature_template` SET `ScriptName`='mob_banshee' WHERE `entry`=17905; +UPDATE `creature_template` SET `ScriptName`='mob_crypt_fiend' WHERE `entry`=17897; +UPDATE `creature_template` SET `ScriptName`='mob_fel_stalker' WHERE `entry`=17916; +UPDATE `creature_template` SET `ScriptName`='mob_frost_wyrm' WHERE `entry`=17907; +UPDATE `creature_template` SET `ScriptName`='mob_gargoyle' WHERE `entry`=17906; +UPDATE `creature_template` SET `ScriptName`='alliance_rifleman' WHERE `entry`=17921; +UPDATE `creature_template` SET `ScriptName`='mob_towering_infernal' WHERE `entry`=17818; +UPDATE `creature_template` SET `ScriptName`='boss_anetheron' WHERE `entry`=17808; +UPDATE `creature_template` SET `ScriptName`='boss_azgalor' WHERE `entry`=17842; +UPDATE `creature_template` SET `ScriptName`='mob_lesser_doomguard' WHERE `entry`=17864; +UPDATE `creature_template` SET `ScriptName`='boss_kazrogal' WHERE `entry`=17888; +UPDATE `creature_template` SET `ScriptName`='boss_rage_winterchill' WHERE `entry`=17767; + +/* OLD HILLSBRAD */ +UPDATE `instance_template` SET `script`='instance_old_hillsbrad' WHERE `map`=560; +UPDATE `creature_template` SET `ScriptName`='boss_lieutenant_drake' WHERE `entry`=17848; +UPDATE `creature_template` SET `ScriptName`='boss_epoch_hunter' WHERE `entry`=18096; +UPDATE `creature_template` SET `ScriptName`='boss_captain_skarloc' WHERE `entry`=17862; +UPDATE `creature_template` SET `ScriptName`='npc_erozion' WHERE `entry`=18723; +UPDATE `creature_template` SET `ScriptName`='npc_taretha' WHERE `entry`=18887; +UPDATE `creature_template` SET `ScriptName`='npc_thrall_old_hillsbrad' WHERE `entry`=17876; +UPDATE `gameobject_template` SET `ScriptName`='go_barrel_old_hillsbrad' WHERE `entry`=182589; + +/* THE DARK PORTAL */ +UPDATE `instance_template` SET `script`='instance_dark_portal' WHERE `map`=269; +UPDATE `creature_template` SET `ScriptName`='boss_chrono_lord_deja' WHERE `entry`=17879; +UPDATE `creature_template` SET `ScriptName`='boss_aeonus' WHERE `entry`=17881; +UPDATE `creature_template` SET `ScriptName`='boss_temporus' WHERE `entry`=17880; +UPDATE `creature_template` SET `ScriptName`='npc_medivh_bm' WHERE `entry`=15608; +UPDATE `creature_template` SET `ScriptName`='npc_time_rift' WHERE `entry`=17838; +UPDATE `creature_template` SET `ScriptName`='npc_saat' WHERE `entry`=20201; + +/* COILFANG RESERVOIR */ + +/* THE SLAVE PENS */ + +/* THE UNDERBOG */ +UPDATE `creature_template` SET `ScriptName`='mob_underbog_mushroom' WHERE `entry`=17990; +UPDATE `creature_template` SET `ScriptName`='boss_hungarfen' WHERE `entry`=17770; +UPDATE `creature_template` SET `ScriptName`='boss_the_black_stalker' WHERE `entry`=17882; + +/* THE STEAMVAULT */ +UPDATE `instance_template` SET `script`='instance_steam_vault' WHERE `map`=545; +UPDATE `creature_template` SET `ScriptName`='boss_hydromancer_thespia' WHERE `entry`=17797; +UPDATE `creature_template` SET `ScriptName`='boss_mekgineer_steamrigger' WHERE `entry`=17796; +UPDATE `creature_template` SET `ScriptName`='boss_warlord_kalithresh' WHERE `entry`=17798; +UPDATE `creature_template` SET `ScriptName`='mob_coilfang_waterelemental' WHERE `entry`=17917; +UPDATE `creature_template` SET `ScriptName`='mob_naga_distiller' WHERE `entry`=17954; +UPDATE `creature_template` SET `ScriptName`='mob_steamrigger_mechanic' WHERE `entry`=17951; + +/* SERPENTSHRINE CAVERN */ +UPDATE `instance_template` SET `script`='instance_serpent_shrine' WHERE `map`=548; +UPDATE `creature_template` SET `ScriptName`='boss_hydross_the_unstable' WHERE `entry`=21216; +UPDATE `gameobject_template` SET `ScriptName`='go_bridge_console' WHERE `entry`=184568; +INSERT IGNORE INTO `areatrigger_scripts` VALUES (4591,'at_coilfang_waterfall'); + +/* Leotheras the Blind event */ +UPDATE `creature_template` SET `ScriptName`='boss_leotheras_the_blind' WHERE `entry`=21215; +UPDATE `creature_template` SET `ScriptName`='boss_leotheras_the_blind_demonform' WHERE `entry`=21875; +UPDATE `creature_template` SET `ScriptName`='mob_greyheart_spellbinder' WHERE `entry`=21806; +UPDATE `creature_template` SET `ScriptName`='mob_inner_demon' WHERE `entry`=21857; +/* Fathom-lord Karathress event */ +UPDATE `creature_template` SET `ScriptName`='boss_fathomlord_karathress' WHERE `entry`=21214; +UPDATE `creature_template` SET `ScriptName`='boss_fathomguard_sharkkis' WHERE `entry`=21966; +UPDATE `creature_template` SET `ScriptName`='boss_fathomguard_tidalvess' WHERE `entry`=21965; +UPDATE `creature_template` SET `ScriptName`='boss_fathomguard_caribdis' WHERE `entry`=21964; +/* Morogrim Tidewalker event */ +UPDATE `creature_template` SET `ScriptName`='boss_morogrim_tidewalker' WHERE `entry`=21213; +UPDATE `creature_template` SET `ScriptName`='mob_water_globule' WHERE `entry`=21913; +/* The Lurker Below */ +UPDATE `creature_template` SET `ScriptName`='boss_the_lurker_below' WHERE `entry`=21217; +UPDATE `creature_template` SET `ScriptName`='mob_coilfang_ambusher' WHERE `entry`=21865; +UPDATE `creature_template` SET `ScriptName`='mob_coilfang_guardian' WHERE `entry`=21873; +/* Lady Vashj event */ +UPDATE `creature_template` SET `ScriptName`='boss_lady_vashj' WHERE `entry`=21212; +UPDATE `creature_template` SET `ScriptName`='mob_enchanted_elemental' WHERE `entry`=21958; +UPDATE `creature_template` SET `ScriptName`='mob_tainted_elemental' WHERE `entry`=22009; +UPDATE `creature_template` SET `ScriptName`='mob_coilfang_elite' WHERE `entry`=22055; +UPDATE `creature_template` SET `ScriptName`='mob_coilfang_strider' WHERE `entry`=22056; +UPDATE `creature_template` SET `ScriptName`='mob_toxic_sporebat' WHERE `entry`=22140; +UPDATE `creature_template` SET `ScriptName`='mob_shield_generator_channel' WHERE `entry`=19870; + +/* CRYSTALSONG FOREST */ + +/* DALARAN */ +UPDATE `creature_template` SET `ScriptName`='npc_mageguard_dalaran' WHERE `entry` IN (29254,29255); +UPDATE `creature_template` SET `ScriptName`='npc_hira_snowdawn' WHERE `entry`=31238; + +/* DARKSHORE */ +UPDATE `creature_template` SET `ScriptName`='npc_kerlonian' WHERE `entry`=11218; +UPDATE `creature_template` SET `ScriptName`='npc_threshwackonator' WHERE `entry`=6669; +UPDATE `creature_template` SET `ScriptName`='npc_prospector_remtravel' WHERE `entry`=2917; + +/* DEADMINES */ +UPDATE `instance_template` SET `script`='instance_deadmines' WHERE `map`=36; +UPDATE `item_template` SET `ScriptName`='item_defias_gunpowder' WHERE `entry`=5397; +UPDATE `gameobject_template` SET `ScriptName`='go_defias_cannon' WHERE `entry`=16398; +UPDATE `gameobject_template` SET `ScriptName`='go_door_lever_dm' WHERE `entry`=101833; +UPDATE `gameobject_template` SET `ScriptName`='go_main_chambers_access_panel' WHERE `entry` IN (184125,184126); + +/* DRAGONBLIGHT */ +UPDATE `creature_template` SET `ScriptName`='npc_alexstrasza_wr_gate' WHERE `entry`=31333; +UPDATE `creature_template` SET `ScriptName`='npc_inquisitor_hallard' WHERE `entry`=27316; + +/* DEADWIND PASS */ + +/* DESOLACE */ +UPDATE `creature_template` SET `ScriptName`='npc_aged_dying_ancient_kodo' WHERE `entry` IN (4700,4701,4702,11627); +UPDATE `gameobject_template` SET `ScriptName`='go_iruxos' WHERE `entry`=176581; +UPDATE `creature_template` SET `ScriptName`='npc_dalinda' WHERE `entry`=5644; + + +/* DIRE MAUL */ + +/* DUN MOROGH */ +UPDATE `creature_template` SET `ScriptName`='npc_narm_faulk' WHERE `entry`=6177; + +/* DUROTAR */ +UPDATE `creature_template` SET `ScriptName`='npc_lazy_peon' WHERE `entry`=10556; + +/* DUSKWOOD */ +DELETE FROM `areatrigger_scripts` WHERE `entry`=4017; +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES (4017,'at_twilight_grove'); +UPDATE `creature_template` SET `ScriptName`='boss_twilight_corrupter' WHERE `entry`=15625; + +/* DUSTWALLOW MARSH */ +UPDATE `creature_template` SET `ScriptName`='mobs_risen_husk_spirit' WHERE `entry` IN (23554,23555); +UPDATE `creature_template` SET `ScriptName`='npc_deserter_agitator' WHERE `entry`=23602; +UPDATE `creature_template` SET `ScriptName`='npc_lady_jaina_proudmoore' WHERE `entry`=4968; +UPDATE `creature_template` SET `ScriptName`='npc_nat_pagle' WHERE `entry`=12919; +UPDATE `creature_template` SET `ScriptName`='npc_restless_apparition' WHERE `entry`=23861; +UPDATE `creature_template` SET `ScriptName`='npc_private_hendel' WHERE `entry`=4966; +UPDATE `creature_template` SET `ScriptName`='npc_zelfrax' WHERE `entry`=23864; + +/* EASTERN PLAGUELANDS */ +UPDATE `creature_template` SET `ScriptName`='mobs_ghoul_flayer' WHERE `entry` IN (8530,8531,8532); +UPDATE `creature_template` SET `ScriptName`='npc_augustus_the_touched' WHERE `entry`=12384; +UPDATE `creature_template` SET `ScriptName`='npc_darrowshire_spirit' WHERE `entry`=11064; +UPDATE `creature_template` SET `ScriptName`='npc_tirion_fordring' WHERE `entry`=1855; + +/* ELWYNN FOREST */ +UPDATE `creature_template` SET `ScriptName`='npc_henze_faulk' WHERE `entry`=6172; + +/* EVERSONG WOODS */ +UPDATE `creature_template` SET `ScriptName`='npc_prospector_anvilward' WHERE `entry`=15420; +UPDATE `creature_template` SET `ScriptName`='npc_second_trial_paladin' WHERE `entry` IN (17809,17810,17811,17812); +UPDATE `creature_template` SET `ScriptName`='npc_second_trial_controller' WHERE `entry` IN (17807); +UPDATE `creature_template` SET `ScriptName`='npc_apprentice_mirveda' WHERE `entry`=15402; +UPDATE `creature_template` SET `ScriptName`='npc_infused_crystal' WHERE `entry`=16364; +UPDATE `gameobject_template` SET `ScriptName`='go_second_trial' WHERE `entry` IN (182052); + +/* FELWOOD */ +UPDATE `creature_template` SET `ScriptName`='npcs_riverbreeze_and_silversky' WHERE `entry` IN (9528,9529); + +/* FERALAS */ +UPDATE `creature_template` SET `ScriptName`='npc_gregan_brewspewer' WHERE `entry`=7775; +UPDATE `creature_template` SET `ScriptName`='npc_screecher_spirit' WHERE `entry`=8612; +UPDATE `creature_template` SET `ScriptName`='npc_oox22fe' WHERE `entry`=7807; + +/* FORGE OF SOULS */ +UPDATE `instance_template` SET `script`='instance_forge_of_souls' WHERE `map`=632; +UPDATE `creature_template` SET `Scriptname`='boss_devourer_of_souls' WHERE `entry`=36502; +UPDATE `creature_template` SET `Scriptname`='boss_bronjahm' WHERE `entry`=36497; +UPDATE `creature_template` SET `Scriptname`='npc_jaina_fos' WHERE `entry`=37597; +UPDATE `creature_template` SET `Scriptname`='npc_sylvanas_fos' WHERE `entry`=37596; +UPDATE `creature_template` SET `Scriptname`='mob_soul_horror' WHERE `entry`=36522; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_adept' WHERE `entry`=36620; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_animator' WHERE `entry`=36516; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_bonecaster' WHERE `entry`=36564; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_reaper' WHERE `entry`=36499; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_watchman' WHERE `entry`=36478; +UPDATE `creature_template` SET `Scriptname`='mob_spectral_warden' WHERE `entry`=36666; +UPDATE `creature_template` SET `Scriptname`='mob_spiteful_apparition' WHERE `entry`=36551; +UPDATE `creature_template` SET `Scriptname`='mob_corrupted_soul_fragment' WHERE `entry`=36535; + +/* GHOSTLANDS */ +UPDATE `creature_template` SET `ScriptName`='npc_blood_knight_dawnstar' WHERE `entry`=17832; +UPDATE `creature_template` SET `ScriptName`='npc_budd_nedreck' WHERE `entry`=23559; +UPDATE `creature_template` SET `ScriptName`='npc_rathis_tomber' WHERE `entry`=16224; +UPDATE `creature_template` SET `Scriptname`='npc_ranger_lilatha' WHERE `entry`=16295; +UPDATE `gameobject_template` SET `ScriptName`='go_gilded_brazier' WHERE `entry`=181956; + +/* GNOMEREGAN */ +UPDATE `creature_template` SET `ScriptName`='npc_blastmaster_emi_shortfuse' WHERE `entry`=7998; +UPDATE `creature_template` SET `ScriptName`='boss_grubbis' WHERE `entry`=7361; +UPDATE `instance_template` SET `script`='instance_gnomeregan' WHERE `map`=90; + +/* GRIZZLY HILLS */ +UPDATE `creature_template` SET `ScriptName`='npc_orsonn_and_kodian' WHERE `entry` IN (27274,27275); +UPDATE `creature_template` SET `ScriptName`='npc_emily' WHERE `entry`=26588; +UPDATE `creature_template` SET `ScriptName`='npc_mrfloppy' WHERE `entry`=26589; +UPDATE `gameobject_template` SET `ScriptName`='go_amberpine_outhouse' WHERE `entry`=188666; +UPDATE `creature_template` SET `ScriptName`='npc_outhouse_bunny' WHERE `entry`=27326; +UPDATE `creature_template` SET `ScriptName`='npc_tallhorn_stag' WHERE `entry`=26363; +UPDATE `creature_template` SET `ScriptName`='npc_amberpine_woodsman' WHERE `entry`=27293; +UPDATE `creature_template` SET `ScriptName`='npc_wounded_skirmisher' WHERE `entry`=27463; + +/* DRAK'THARON KEEP */ +UPDATE `instance_template` SET `script`='instance_drak_tharon' WHERE `map`=600; +UPDATE `creature_template` SET `ScriptName`='boss_trollgore' WHERE `entry`=26630; +UPDATE `creature_template` SET `ScriptName`='boss_novos' WHERE `entry`=26631; +UPDATE `creature_template` SET `ScriptName`='mob_crystal_handler' WHERE `entry`=26627; +UPDATE `creature_template` SET `ScriptName`='mob_novos_minion' WHERE `entry` IN (27600,27597,27598); +UPDATE `creature_template` SET `ScriptName`='npc_drakkari_gutripper' WHERE `entry`=26641; +UPDATE `creature_template` SET `ScriptName`='npc_drakkari_scytheclaw' WHERE `entry`=26628; +UPDATE `creature_template` SET `ScriptName`='boss_dred' WHERE `entry`=27483; +UPDATE `creature_template` SET `ScriptName`='boss_tharon_ja' WHERE `entry`=26632; + +/* GRUUL'S LAIR */ +UPDATE `instance_template` SET `script`='instance_gruuls_lair' WHERE `map`=565; +UPDATE `creature_template` SET `ScriptName`='boss_gruul' WHERE `entry`=19044; +/* Maulgar and Event */ +UPDATE `creature_template` SET `ScriptName`='boss_high_king_maulgar' WHERE `entry`=18831; +UPDATE `creature_template` SET `ScriptName`='boss_kiggler_the_crazed' WHERE `entry`=18835; +UPDATE `creature_template` SET `ScriptName`='boss_blindeye_the_seer' WHERE `entry`=18836; +UPDATE `creature_template` SET `ScriptName`='boss_olm_the_summoner' WHERE `entry`=18834; +UPDATE `creature_template` SET `ScriptName`='boss_krosh_firehand' WHERE `entry`=18832; + +/* GUNDRAK */ +UPDATE `instance_template` SET `script`='instance_gundrak' WHERE `map`=604; +/* Moorabi */ +UPDATE `creature_template` SET `ScriptName`='boss_moorabi' WHERE `entry`=29305; +/* Slad'ran */ +UPDATE `creature_template` SET `ScriptName`='boss_slad_ran' WHERE `entry`=29304; +UPDATE `creature_template` SET `ScriptName`='mob_slad_ran_viper' WHERE `entry`=29680; +UPDATE `creature_template` SET `ScriptName`='mob_slad_ran_constrictor' WHERE `entry`=29713; +/* Gal'darah */ +UPDATE `creature_template` SET `ScriptName`='boss_gal_darah' WHERE `entry`=29306; +/* Drakkari Colossus */ +UPDATE `creature_template` SET `ScriptName`='boss_drakkari_colossus' WHERE `entry`=29307; +UPDATE `creature_template` SET `ScriptName`='boss_drakkari_elemental' WHERE `entry`=29573; +UPDATE `creature_template` SET `ScriptName`='npc_living_mojo' WHERE `entry`=29830; +/* Eck the Ferocious */ +UPDATE `creature_template` SET `ScriptName`='boss_eck' WHERE `entry`=29932; +UPDATE `creature_template` SET `ScriptName`='npc_ruins_dweller' WHERE `entry`=29920; + +UPDATE `gameobject_template` SET `ScriptName`='go_gundrak_altar' WHERE `entry`=192518; +UPDATE `gameobject_template` SET `ScriptName`='go_gundrak_altar' WHERE `entry`=192519; +UPDATE `gameobject_template` SET `ScriptName`='go_gundrak_altar' WHERE `entry`=192520; + +/* HALLS OF LIGHTNING */ +UPDATE `instance_template` SET `script`='instance_halls_of_lightning' WHERE `map`=602; +/* Bjarngrim */ +UPDATE `creature_template` SET `ScriptName`='boss_bjarngrim' WHERE `entry`=28586; +UPDATE `creature_template` SET `ScriptName`='mob_stormforged_lieutenant' WHERE `entry`=29240; +/* Loken */ +UPDATE `creature_template` SET `ScriptName`='boss_loken' WHERE `entry`=28923; +/* Volkhan */ +UPDATE `creature_template` SET `ScriptName`='boss_volkhan' WHERE `entry`=28587; +UPDATE `creature_template` SET `ScriptName`='mob_molten_golem' WHERE `entry`=28695; +UPDATE `creature_template` SET `ScriptName`='npc_volkhan_anvil' WHERE `entry`=28823; +/* Ionar */ +UPDATE `creature_template` SET `ScriptName`='boss_ionar' WHERE `entry`=28546; +UPDATE `creature_template` SET `ScriptName`='mob_spark_of_ionar' WHERE `entry`=28926; + +/* HALLS OF STONE */ +UPDATE `instance_template` SET `script`='instance_halls_of_stone' WHERE `map`=599; +/* Krystallus */ +UPDATE `creature_template` SET `ScriptName`='boss_krystallus' WHERE `entry`=27977; +/* Sjonnir */ +UPDATE `creature_template` SET `ScriptName`='boss_sjonnir' WHERE `entry`=27978; +UPDATE `creature_template` SET `ScriptName`='mob_tribuna_controller' WHERE `entry`=28234; +UPDATE `creature_template` SET `ScriptName`='npc_brann_hos' WHERE `entry`=28070; +UPDATE `creature_template` SET `ScriptName`='mob_malformed_ooze' WHERE `entry`=27981; +UPDATE `creature_template` SET `ScriptName`='mob_iron_sludge' WHERE `entry`=28165; +/* Maiden of Grief */ +UPDATE `creature_template` SET `ScriptName`='boss_maiden_of_grief' WHERE `entry`=27975; + +/* HELLFIRE CITADEL */ + +/* BLOOD FURNACE */ +UPDATE `instance_template` SET `script`='instance_blood_furnace' WHERE `map`=542; +UPDATE `creature_template` SET `ScriptName`='boss_the_maker' WHERE `entry`=17381; +UPDATE `creature_template` SET `ScriptName`='boss_broggok' WHERE `entry`=17380; +UPDATE `creature_template` SET `ScriptName`='boss_kelidan_the_breaker' WHERE `entry`=17377; +UPDATE `creature_template` SET `ScriptName`='mob_broggok_poisoncloud' WHERE `entry`=17662; +UPDATE `creature_template` SET `ScriptName`='mob_shadowmoon_channeler' WHERE `entry`=17653; + +/* HELLFIRE RAMPARTS */ +UPDATE `instance_template` SET `script`='instance_ramparts' WHERE `map`=543; + +/* Vazruden, Omor the Unscarred, Watchkeeper Gargolmar */ +UPDATE `creature_template` SET `ScriptName`='boss_omor_the_unscarred' WHERE `entry`=17308; +UPDATE `creature_template` SET `ScriptName`='boss_watchkeeper_gargolmar' WHERE `entry`=17306; +UPDATE `creature_template` SET `ScriptName`='boss_vazruden_the_herald' WHERE `entry`=17307; +UPDATE `creature_template` SET `ScriptName`='boss_vazruden' WHERE `entry`=17537; +UPDATE `creature_template` SET `ScriptName`='boss_nazan' WHERE `entry`=17536; +UPDATE `creature_template` SET `ScriptName`='mob_hellfire_sentry' WHERE `entry`=17517; + +/* SHATTERED HALLS */ +/* Nethekurse and his spawned shadow fissure */ +UPDATE `creature_template` SET `ScriptName`='boss_grand_warlock_nethekurse' WHERE `entry`=16807; +UPDATE `creature_template` SET `ScriptName`='boss_warchief_kargath_bladefist' WHERE `entry`=16808; +UPDATE `creature_template` SET `ScriptName`='boss_warbringer_omrogg' WHERE `entry`=16809; +UPDATE `creature_template` SET `ScriptName`='mob_fel_orc_convert' WHERE `entry`=17083; +UPDATE `creature_template` SET `ScriptName`='mob_lesser_shadow_fissure' WHERE `entry`=17471; +UPDATE `creature_template` SET `ScriptName`='mob_omrogg_heads' WHERE `entry` IN (19523,19524); +UPDATE `instance_template` SET `script`='instance_shattered_halls' WHERE `map`=540; + +/* MAGTHERIDON'S LAIR */ +UPDATE `instance_template` SET `script`='instance_magtheridons_lair' WHERE `map`=544; +UPDATE `gameobject_template` SET `ScriptName`='go_manticron_cube' WHERE `entry`=181713; +UPDATE `creature_template` SET `ScriptName`='boss_magtheridon' WHERE `entry`=17257; +UPDATE `creature_template` SET `ScriptName`='mob_hellfire_channeler' WHERE `entry`=17256; +UPDATE `creature_template` SET `ScriptName`='mob_abyssal' WHERE `entry`=17454; + +/* HALLS OF REFLECTION */ +UPDATE `instance_template` SET `script`='instance_halls_of_reflection' WHERE `map`=668; +UPDATE `creature_template` SET `Scriptname`='boss_falric' WHERE `entry`=38112; +UPDATE `creature_template` SET `Scriptname`='boss_marwyn' WHERE `entry`=38113; +UPDATE `creature_template` SET `Scriptname`='npc_jaina_hor_part1' WHERE `entry`=37221; +UPDATE `creature_template` SET `Scriptname`='npc_sylvanas_hor_part1' WHERE `entry`=37223; +UPDATE `creature_template` SET `Scriptname`='npc_ghostly_priest' WHERE `entry`=38175; +UPDATE `creature_template` SET `Scriptname`='npc_phantom_mage' WHERE `entry`=38172; +UPDATE `creature_template` SET `Scriptname`='npc_phantom_hallucination' WHERE `entry`=38567; +UPDATE `creature_template` SET `Scriptname`='npc_shadowy_mercenary' WHERE `entry`=38177; +UPDATE `creature_template` SET `Scriptname`='npc_spectral_footman' WHERE `entry`=38173; +UPDATE `creature_template` SET `Scriptname`='npc_tortured_rifleman' WHERE `entry`=38176; + +/* HELLFIRE PENINSULA */ +UPDATE `creature_template` SET `ScriptName`='boss_doomlord_kazzak' WHERE `entry`=18728; +UPDATE `creature_template` SET `ScriptName`='npc_wounded_blood_elf' WHERE `entry`=16993; +UPDATE `creature_template` SET `ScriptName`='npc_aeranas' WHERE `entry`=17085; +UPDATE `gameobject_template` SET `ScriptName`='go_haaleshi_altar' WHERE `entry`=181606; +UPDATE `creature_template` SET `ScriptName`='npc_naladu' WHERE `entry`=19361; +UPDATE `creature_template` SET `ScriptName`='npc_tracy_proudwell' WHERE `entry`=18266; +UPDATE `creature_template` SET `ScriptName`='npc_trollbane' WHERE `entry`=16819; +UPDATE `creature_template` SET `ScriptName`='npc_ancestral_wolf' WHERE `entry`=17077; +UPDATE `creature_template` SET `ScriptName`='npc_fel_guard_hound' WHERE `entry`=21847; + +/* HILLSBRAD FOOTHILLS */ + +/* HINTERLANDS */ +UPDATE `creature_template` SET `ScriptName`='npc_00x09hl' WHERE `entry`=7806; +UPDATE `creature_template` SET `ScriptName`='npc_rinji' WHERE `entry`=7780; + +/* HOWLING FJORD */ +UPDATE `creature_template` SET `ScriptName`='npc_plaguehound_tracker' WHERE `entry`=24156; +UPDATE `creature_template` SET `ScriptName`='npc_razael_and_lyana' WHERE `entry` IN (23778,23998); +UPDATE `creature_template` SET `ScriptName`='npc_apothecary_hanes' WHERE `entry`=23784; + +/* ICECROWN */ +UPDATE `creature_template` SET `ScriptName`='npc_arete' WHERE `entry`=29344; +UPDATE `creature_template` SET `ScriptName`='npc_dame_evniki_kapsalis' WHERE `entry`=34885; +UPDATE `creature_template` SET `ScriptName`='npc_squire_david' WHERE `entry`=33447; +UPDATE `creature_template` SET `ScriptName`='npc_argent_valiant' WHERE `entry`=33448; +UPDATE `creature_template` SET `ScriptName`='npc_argent_tournament_post' WHERE `entry`=35473; +UPDATE `creature_template` SET `ScriptName`='npc_alorah_and_grimmin' WHERE `entry` IN (36101,36102); +UPDATE `creature_template` SET `ScriptName`='npc_guardian_pavilion' WHERE `entry` IN (33543,33643); + +/* IRONFORGE */ +UPDATE `creature_template` SET `ScriptName`='npc_royal_historian_archesonus' WHERE `entry`=8879; + +/* ISLE OF QUEL'DANAS */ +UPDATE `creature_template` SET `ScriptName`='npc_converted_sentry' WHERE `entry`=24981; +UPDATE `creature_template` SET `ScriptName`='npc_greengill_slave' WHERE `entry`=25084; + +/* KARAZHAN */ +UPDATE `instance_template` SET `script`='instance_karazhan' WHERE `map`=532; +UPDATE `creature_template` SET `ScriptName`='boss_midnight' WHERE `entry`=16151; +UPDATE `creature_template` SET `ScriptName`='boss_attumen' WHERE `entry`=15550; +UPDATE `creature_template` SET `ScriptName`='boss_moroes' WHERE `entry`=15687; +UPDATE `creature_template` SET `ScriptName`='boss_maiden_of_virtue' WHERE `entry`=16457; +UPDATE `creature_template` SET `ScriptName`='boss_curator' WHERE `entry`=15691; +UPDATE `creature_template` SET `ScriptName`='boss_julianne' WHERE `entry`=17534; +UPDATE `creature_template` SET `ScriptName`='boss_romulo' WHERE `entry`=17533; +UPDATE `creature_template` SET `ScriptName`='boss_dorothee' WHERE `entry`=17535; +UPDATE `creature_template` SET `ScriptName`='boss_strawman' WHERE `entry`=17543; +UPDATE `creature_template` SET `ScriptName`='boss_tinhead' WHERE `entry`=17547; +UPDATE `creature_template` SET `ScriptName`='mob_tito' WHERE `entry`=17548; +UPDATE `creature_template` SET `ScriptName`='boss_roar' WHERE `entry`=17546; +UPDATE `creature_template` SET `ScriptName`='boss_crone' WHERE `entry`=18168; +UPDATE `creature_template` SET `ScriptName`='boss_terestian_illhoof' WHERE `entry`=15688; +UPDATE `creature_template` SET `ScriptName`='mob_fiendish_portal' WHERE `entry`=17265; +UPDATE `creature_template` SET `ScriptName`='boss_shade_of_aran' WHERE `entry`=16524; +UPDATE `creature_template` SET `ScriptName`='boss_netherspite' WHERE `entry`=15689; +UPDATE `creature_template` SET `ScriptName`='boss_malchezaar' WHERE `entry`=15690; +UPDATE `creature_template` SET `ScriptName`='boss_nightbane' WHERE `entry`=17225; +UPDATE `creature_template` SET `ScriptName`='boss_baroness_dorothea_millstipe' WHERE `entry`=19875; +UPDATE `creature_template` SET `ScriptName`='boss_baron_rafe_dreuger' WHERE `entry`=19874; +UPDATE `creature_template` SET `ScriptName`='boss_lady_catriona_von_indi' WHERE `entry`=19872; +UPDATE `creature_template` SET `ScriptName`='boss_lady_keira_berrybuck' WHERE `entry`=17007; +UPDATE `creature_template` SET `ScriptName`='boss_lord_robin_daris' WHERE `entry`=19876; +UPDATE `creature_template` SET `ScriptName`='boss_lord_crispin_ference' WHERE `entry`=19873; +UPDATE `creature_template` SET `ScriptName`='boss_bigbadwolf' WHERE `entry`=17521; +UPDATE `creature_template` SET `ScriptName`='mob_shadow_of_aran' WHERE `entry`=18254; +UPDATE `creature_template` SET `ScriptName`='mob_aran_elemental' WHERE `entry`=17167; +UPDATE `creature_template` SET `ScriptName`='mob_aran_blizzard' WHERE `entry`=17161; +UPDATE `creature_template` SET `ScriptName`='mob_homunculus' WHERE `entry`=16539; +UPDATE `creature_template` SET `ScriptName`='mob_fiendish_imp' WHERE `entry`=17267; +UPDATE `creature_template` SET `ScriptName`='mob_kilrek' WHERE `entry`=17229; +UPDATE `creature_template` SET `ScriptName`='mob_demon_chain' WHERE `entry`=17248; +UPDATE `creature_template` SET `ScriptName`='mob_cyclone' WHERE `entry`=18412; +UPDATE `creature_template` SET `ScriptName`='netherspite_infernal' WHERE `entry`=17646; +UPDATE `creature_template` SET `ScriptName`='npc_berthold' WHERE `entry`=16153; +UPDATE `creature_template` SET `ScriptName`='npc_barnes' WHERE `entry`=16812; +UPDATE `creature_template` SET `ScriptName`='npc_grandmother' WHERE `entry`=17603; +UPDATE `creature_template` SET `ScriptName`='npc_image_of_medivh' WHERE `entry`=17651; + +/* LOCH MODAN */ +UPDATE `creature_template` SET `ScriptName`='npc_mountaineer_pebblebitty' WHERE `entry`=3836; + +/* Magister's Terrace */ +UPDATE `instance_template` SET `script`='instance_magisters_terrace' WHERE `map`=585; +UPDATE `creature_template` SET `ScriptName`='boss_selin_fireheart' WHERE `entry`=24723; +UPDATE `creature_template` SET `ScriptName`='mob_fel_crystal' WHERE `entry`=24722; +UPDATE `creature_template` SET `ScriptName`='boss_vexallus' WHERE `entry`=24744; +UPDATE `creature_template` SET `ScriptName`='mob_pure_energy' WHERE `entry`=24745; +UPDATE `creature_template` SET `ScriptName`='boss_priestess_delrissa' WHERE `entry`=24560; +UPDATE `creature_template` SET `ScriptName`='boss_kagani_nightstrike' WHERE `entry`=24557; +UPDATE `creature_template` SET `ScriptName`='boss_ellris_duskhallow' WHERE `entry`=24558; +UPDATE `creature_template` SET `ScriptName`='boss_eramas_brightblaze' WHERE `entry`=24554; +UPDATE `creature_template` SET `ScriptName`='boss_yazzai' WHERE `entry`=24561; +UPDATE `creature_template` SET `ScriptName`='boss_warlord_salaris' WHERE `entry`=24559; +UPDATE `creature_template` SET `ScriptName`='boss_garaxxas' WHERE `entry`=24555; +UPDATE `creature_template` SET `ScriptName`='mob_sliver' WHERE `entry`=24552; +UPDATE `creature_template` SET `ScriptName`='boss_apoko' WHERE `entry`=24553; +UPDATE `creature_template` SET `ScriptName`='boss_zelfan' WHERE `entry`=24556; +UPDATE `creature_template` SET `ScriptName`='boss_felblood_kaelthas' WHERE `entry`=24664; +UPDATE `creature_template` SET `ScriptName`='mob_arcane_sphere' WHERE `entry`=24708; +UPDATE `creature_template` SET `ScriptName`='mob_felkael_phoenix' WHERE `entry`=24674; +UPDATE `creature_template` SET `ScriptName`='mob_felkael_phoenix_egg' WHERE `entry`=24675; +UPDATE `creature_template` SET `ScriptName`='mob_felkael_flamestrike' WHERE `entry`=24666; +UPDATE `creature_template` SET `ScriptName`='npc_kalecgos' WHERE `entry` IN (24844,24848); + +/* MARAUDON */ +UPDATE `creature_template` SET `ScriptName`='boss_princess_theradras' WHERE `entry`=12201; +UPDATE `creature_template` SET `ScriptName`='boss_noxxion' WHERE `entry`=13282; +UPDATE `creature_template` SET `ScriptName`='boss_landslide' WHERE `entry`=12203; +UPDATE `creature_template` SET `ScriptName`='celebras_the_cursed' WHERE `entry`=12225; + +/* MOLTEN CORE */ +UPDATE `instance_template` SET `script`='instance_molten_core' WHERE `map`=409; +UPDATE `creature_template` SET `ScriptName`='boss_lucifron' WHERE `entry`=12118; +UPDATE `creature_template` SET `ScriptName`='boss_magmadar' WHERE `entry`=11982; +UPDATE `creature_template` SET `ScriptName`='boss_gehennas' WHERE `entry`=12259; +UPDATE `creature_template` SET `ScriptName`='boss_garr' WHERE `entry`=12057; +UPDATE `creature_template` SET `ScriptName`='boss_baron_geddon' WHERE `entry`=12056; +UPDATE `creature_template` SET `ScriptName`='boss_shazzrah' WHERE `entry`=12264; +UPDATE `creature_template` SET `ScriptName`='boss_golemagg' WHERE `entry`=11988; +UPDATE `creature_template` SET `ScriptName`='boss_sulfuron' WHERE `entry`=12098; +UPDATE `creature_template` SET `ScriptName`='boss_majordomo' WHERE `entry`=12018; +UPDATE `creature_template` SET `ScriptName`='boss_ragnaros' WHERE `entry`=11502; +UPDATE `creature_template` SET `ScriptName`='mob_ancient_core_hound' WHERE `entry`=11673; +UPDATE `creature_template` SET `ScriptName`='mob_firesworn' WHERE `entry`=12099; +UPDATE `creature_template` SET `ScriptName`='mob_core_rager' WHERE `entry`=11672; +UPDATE `creature_template` SET `ScriptName`='mob_flamewaker_priest' WHERE `entry`=11662; + +/* MOONGLADE */ +UPDATE `creature_template` SET `ScriptName`='npc_bunthen_plainswind' WHERE `entry`=11798; +UPDATE `creature_template` SET `ScriptName`='npc_great_bear_spirit' WHERE `entry`=11956; +UPDATE `creature_template` SET `ScriptName`='npc_silva_filnaveth' WHERE `entry`=11800; +UPDATE `creature_template` SET `ScriptName`='npc_clintar_dreamwalker' WHERE `entry`=22834; +UPDATE `creature_template` SET `ScriptName`='npc_clintar_spirit' WHERE `entry`=22916; + +/* MULGORE */ +UPDATE `creature_template` SET `ScriptName`='npc_skorn_whitecloud' WHERE `entry`=3052; +UPDATE `creature_template` SET `ScriptName`='npc_kyle_frenzied' WHERE `entry`=23616; +UPDATE `creature_template` SET `ScriptName`='npc_plains_vision' WHERE `entry`=2983; + +/* NAGRAND */ +UPDATE `creature_template` SET `ScriptName`='mob_lump' WHERE `entry`=18351; +UPDATE `creature_template` SET `ScriptName`='mob_shattered_rumbler' WHERE `entry`=17157; +UPDATE `creature_template` SET `ScriptName`='mob_sunspring_villager' WHERE `entry`=18240; +UPDATE `creature_template` SET `ScriptName`='npc_altruis_the_sufferer' WHERE `entry`=18417; +UPDATE `creature_template` SET `ScriptName`='npc_greatmother_geyah' WHERE `entry`=18141; +UPDATE `creature_template` SET `ScriptName`='npc_lantresor_of_the_blade' WHERE `entry`=18261; +UPDATE `creature_template` SET `ScriptName`='npc_creditmarker_visit_with_ancestors' WHERE `entry` IN (18840,18841,18842,18843); +UPDATE `creature_template` SET `ScriptName`='mob_sparrowhawk' WHERE `entry`=22979; +UPDATE `creature_template` SET `ScriptName`='npc_maghar_captive' WHERE `entry`=18210; + +/* NAXXRAMAS */ +UPDATE `instance_template` SET `script`='instance_naxxramas' WHERE `map`=533; +UPDATE `creature_template` SET `ScriptName`='boss_anubrekhan' WHERE `entry`=15956; +UPDATE `creature_template` SET `ScriptName`='boss_faerlina' WHERE `entry`=15953; +UPDATE `creature_template` SET `ScriptName`='mob_faerlina_add' WHERE `entry`=16506; +UPDATE `creature_template` SET `ScriptName`='boss_maexxna' WHERE `entry`=15952; +UPDATE `creature_template` SET `ScriptName`='mob_webwrap' WHERE `entry`=16486; +UPDATE `creature_template` SET `ScriptName`='boss_noth' WHERE `entry`=15954; +UPDATE `creature_template` SET `ScriptName`='boss_heigan' WHERE `entry`=15936; +UPDATE `creature_template` SET `ScriptName`='boss_loatheb' WHERE `entry`=16011; +UPDATE `creature_template` SET `ScriptName`='mob_loatheb_spore' WHERE `entry`=16286; +UPDATE `creature_template` SET `ScriptName`='boss_razuvious' WHERE `entry`=16061; +UPDATE `creature_template` SET `ScriptName`='boss_gothik' WHERE `entry`=16060; +UPDATE `creature_template` SET `ScriptName`='mob_gothik_minion' where `entry` IN (16124,16125,16126,16127,16148,16149,16150); +UPDATE `creature_template` SET `ScriptName`='boss_four_horsemen' WHERE `entry` IN (16063,16064,16065,30549); +UPDATE `creature_template` SET `ScriptName`='boss_patchwerk' WHERE `entry`=16028; +UPDATE `creature_template` SET `ScriptName`='boss_grobbulus' WHERE `entry`=15931; +UPDATE `creature_template` SET `ScriptName`='npc_grobbulus_poison_cloud' WHERE `entry`=16363; +UPDATE `creature_template` SET `ScriptName`='boss_gluth' WHERE `entry`=15932; +UPDATE `creature_template` SET `ScriptName`='boss_thaddius' WHERE `entry`=15928; +UPDATE `creature_template` SET `ScriptName`='mob_stalagg' WHERE `entry`=15929; +UPDATE `creature_template` SET `ScriptName`='mob_feugen' WHERE `entry`=15930; +UPDATE `creature_template` SET `ScriptName`='boss_sapphiron' WHERE `entry`=15989; +UPDATE `creature_template` SET `ScriptName`='boss_kelthuzad' WHERE `entry`=15990; +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry` IN (16062,30000); +UPDATE `creature_template` SET `ScriptName`='trigger_periodic' WHERE `entry` IN (16474,16697,16129); + +DELETE FROM `areatrigger_scripts` WHERE `entry`=4112; +INSERT INTO `areatrigger_scripts`(`entry`,`ScriptName`) VALUES(4112,'at_kelthuzad_center'); + +/* NETHERSTORM */ +UPDATE `gameobject_template` SET `ScriptName`='go_manaforge_control_console' WHERE `entry` IN (183770,183956,184311,184312); +UPDATE `creature_template` SET `ScriptName`='npc_manaforge_control_console' WHERE `entry` IN (20209,20417,20418,20440); +UPDATE `creature_template` SET `ScriptName`='mob_phase_hunter' WHERE `entry`=18879; +UPDATE `creature_template` SET `ScriptName`='npc_professor_dabiri' WHERE `entry`=20907; +UPDATE `creature_template` SET `ScriptName`='npc_bessy' WHERE `entry`=20415; +UPDATE `creature_template` SET `ScriptName`='npc_commander_dawnforge' WHERE `entry`=19831; + +/* THE NEXUS */ +UPDATE `instance_template` SET `script`='instance_nexus' WHERE `map`=576; +UPDATE `creature_template` SET `ScriptName`='boss_magus_telestra' WHERE `entry`=26731; +UPDATE `creature_template` SET `ScriptName`='boss_anomalus' WHERE `entry`=26763; +UPDATE `creature_template` SET `ScriptName`='mob_chaotic_rift' WHERE `entry`=26918; +UPDATE `creature_template` SET `ScriptName`='boss_ormorok' WHERE `entry`=26794; +UPDATE `creature_template` SET `ScriptName`='mob_crystal_spike' WHERE `entry`=27099; +UPDATE `creature_template` SET `ScriptName`='mob_crystalline_tangler' WHERE `entry`=32665; +UPDATE `creature_template` SET `ScriptName`='boss_keristrasza' WHERE `entry`=26723; +UPDATE `gameobject_template` SET `ScriptName`='containment_sphere' WHERE `entry` IN (188527,188528,188526); + +/* THE NEXUS, THE OCULUS */ + + +/* OBSIDIAN SANCTUM */ + + +/* ONYXIA'S LAIR */ +UPDATE `instance_template` SET `script`='instance_onyxias_lair' WHERE `map`=249; +UPDATE `creature_template` SET `ScriptName`='boss_onyxia' WHERE `entry`=10184; + +/* ORGRIMMAR */ +UPDATE `creature_template` SET `ScriptName`='npc_neeru_fireblade' WHERE `entry`=3216; +UPDATE `creature_template` SET `ScriptName`='npc_shenthul' WHERE `entry`=3401; +UPDATE `creature_template` SET `ScriptName`='npc_thrall_warchief' WHERE `entry`=4949; + +/* PIT OF SARON */ +UPDATE `instance_template` SET `script`='instance_pit_of_saron' WHERE `map`=658; +UPDATE `creature_template` SET `Scriptname`='boss_garfrost' WHERE `entry`=36494; +UPDATE `creature_template` SET `Scriptname`='boss_ick' WHERE `entry`=36476; +UPDATE `creature_template` SET `Scriptname`='boss_krick' WHERE `entry`=36477; +UPDATE `creature_template` SET `Scriptname`='boss_tyrannus' WHERE `entry`=36658; +UPDATE `creature_template` SET `Scriptname`='boss_rimefang' WHERE `entry`=36661; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_wrathbringer' WHERE `entry`=36840; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_skycaller' WHERE `entry`=31260; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_flamebearer' WHERE `entry`=36893; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_deathbringer' WHERE `entry`=36892; +UPDATE `creature_template` SET `Scriptname`='mob_wrathbone_laborer' WHERE `entry`=36830; +UPDATE `creature_template` SET `Scriptname`='mob_wrathbone_coldwraith' WHERE `entry`=36842; +UPDATE `creature_template` SET `Scriptname`='mob_wrathbone_sorcerer' WHERE `entry`=37728; +UPDATE `creature_template` SET `Scriptname`='mob_stonespine_gargoyle' WHERE `entry`=36896; +UPDATE `creature_template` SET `Scriptname`='mob_plagueborn_horror' WHERE `entry`=36879; +UPDATE `creature_template` SET `Scriptname`='mob_iceborn_protodrake' WHERE `entry`=36891; +UPDATE `creature_template` SET `Scriptname`='mob_hungering_ghoul' WHERE `entry`=37711; +UPDATE `creature_template` SET `Scriptname`='mob_fallen_warrior' WHERE `entry`=38487; +UPDATE `creature_template` SET `Scriptname`='mob_fallen_warrior' WHERE `entry`=36841; +UPDATE `creature_template` SET `Scriptname`='mob_deathwhisper_torturer' WHERE `entry`=37713; +UPDATE `creature_template` SET `Scriptname`='mob_deathwhisper_shadowcaster' WHERE `entry`=37712; +UPDATE `creature_template` SET `Scriptname`='mob_deathwhisper_necrolyte' WHERE `entry`=36788; +UPDATE `creature_template` SET `Scriptname`='mob_geist_ambusher' WHERE `entry`=36886; + +/* RAGEFIRE CHASM */ +UPDATE `gameobject_template` SET `ScriptName`='go_blood_filled_orb' WHERE `entry`=182024; + +/* RAZORFEN DOWNS */ +UPDATE `creature_template` SET `ScriptName`='boss_amnennar_the_coldbringer' WHERE `entry`=7358; +UPDATE `creature_template` SET `ScriptName`='npc_henry_stern' WHERE `entry`=8696; +UPDATE `creature_template` SET `ScriptName`='npc_tomb_creature' WHERE `entry` IN (7351,7349); +UPDATE `instance_template` SET `script`='instance_razorfen_downs' WHERE `map`=129; +UPDATE `gameobject_template` SET `ScriptName`='go_gong' WHERE `entry`=148917; + +/* RAZORFEN KRAUL */ +UPDATE `creature_template` SET `Scriptname`='npc_willix' WHERE `entry`=4508; +UPDATE `instance_template` SET `script`='instance_razorfen_kraul' WHERE `map`=47; +UPDATE `creature_template` SET `ScriptName`='npc_deaths_head_ward_keeper' WHERE `entry`=4625; + +/* REDRIDGE MOUNTAINS */ +UPDATE `creature_template` SET `ScriptName`='npc_corporal_keeshan' WHERE `entry`=349; + +/* RUINS OF AHN'QIRAJ */ +UPDATE `creature_template` SET `ScriptName`='boss_kurinnaxx' WHERE `entry`=15348; +UPDATE `creature_template` SET `ScriptName`='boss_rajaxx' WHERE `entry`=15341; +UPDATE `creature_template` SET `ScriptName`='boss_moam' WHERE `entry`=15340; +UPDATE `creature_template` SET `ScriptName`='boss_buru' WHERE `entry`=15370; +UPDATE `creature_template` SET `ScriptName`='boss_ayamiss' WHERE `entry`=15369; +UPDATE `creature_template` SET `ScriptName`='boss_ossirian' WHERE `entry`=15339; +UPDATE `instance_template` SET `script`='instance_ruins_of_ahnqiraj' WHERE `map`=509; + +/* SCARLET MONASTERY */ +UPDATE `instance_template` SET `script`='instance_scarlet_monastery' WHERE `map`=189; +UPDATE `creature_template` SET `ScriptName`='boss_arcanist_doan' WHERE `entry`=6487; +UPDATE `creature_template` SET `ScriptName`='boss_azshir_the_sleepless' WHERE `entry`=6490; +UPDATE `creature_template` SET `ScriptName`='boss_bloodmage_thalnos' WHERE `entry`=4543; +UPDATE `creature_template` SET `ScriptName`='boss_herod' WHERE `entry`=3975; +UPDATE `creature_template` SET `ScriptName`='boss_high_inquisitor_fairbanks' WHERE `entry`=4542; +UPDATE `creature_template` SET `ScriptName`='boss_high_inquisitor_whitemane' WHERE `entry`=3977; +UPDATE `creature_template` SET `ScriptName`='boss_houndmaster_loksey' WHERE `entry`=3974; +UPDATE `creature_template` SET `ScriptName`='boss_interrogator_vishas' WHERE `entry`=3983; +UPDATE `creature_template` SET `ScriptName`='boss_scarlet_commander_mograine' WHERE `entry`=3976; +UPDATE `creature_template` SET `ScriptName`='boss_scorn' WHERE `entry`=14693; +UPDATE `creature_template` SET `ScriptName`='boss_headless_horseman' WHERE `entry`=23682; +UPDATE `creature_template` SET `ScriptName`='mob_head' WHERE `entry`=23775; +UPDATE `creature_template` SET `ScriptName`='mob_pulsing_pumpkin' WHERE `entry`=23694; +UPDATE `creature_template` SET `ScriptName`='mob_wisp_invis' WHERE `entry`=23686; +UPDATE `creature_template` SET `ScriptName`='mob_wisp_invis' WHERE `entry`=24034; +UPDATE `creature_template` SET `ScriptName`='mob_scarlet_trainee' WHERE `entry`=6575; +UPDATE `gameobject_template` SET `ScriptName`='go_loosely_turned_soil' WHERE `entry`=186314; + +/* SCHOLOMANCE */ +UPDATE `instance_template` SET `script`='instance_scholomance' WHERE `map`=289; +UPDATE `creature_template` SET `ScriptName`='boss_darkmaster_gandling' WHERE `entry`=1853; +UPDATE `creature_template` SET `ScriptName`='boss_death_knight_darkreaver' WHERE `entry`=14516; +UPDATE `creature_template` SET `ScriptName`='boss_lord_alexei_barov' WHERE `entry`=10504; +UPDATE `creature_template` SET `ScriptName`='boss_instructor_malicia' WHERE `entry`=10505; +UPDATE `creature_template` SET `ScriptName`='boss_boss_ras_frostwhisper' WHERE `entry`=10508; +UPDATE `creature_template` SET `ScriptName`='boss_the_ravenian' WHERE `entry`=10507; +UPDATE `creature_template` SET `ScriptName`='boss_vectus' WHERE `entry`=10432; +UPDATE `creature_template` SET `ScriptName`='boss_illucia_barov' WHERE `entry`=10502; +UPDATE `creature_template` SET `ScriptName`='boss_doctor_theolen_krastinov' WHERE `entry`=11261; +UPDATE `creature_template` SET `ScriptName`='boss_jandice_barov' WHERE `entry`=10503; +UPDATE `creature_template` SET `ScriptName`='boss_lorekeeper_polkelt' WHERE `entry`=10901; +UPDATE `creature_template` SET `ScriptName`='boss_kormok' WHERE `entry`=16118; +UPDATE `creature_template` SET `ScriptName`='mob_illusionofjandicebarov' WHERE `entry`=11439; + +/* SEARING GORGE */ +UPDATE `creature_template` SET `ScriptName`='npc_kalaran_windblade' WHERE `entry`=8479; +UPDATE `creature_template` SET `ScriptName`='npc_lothos_riftwaker' WHERE `entry`=14387; +UPDATE `creature_template` SET `ScriptName`='npc_zamael_lunthistle' WHERE `entry`=8436; + +/* SHADOWFANG KEEP */ +UPDATE `instance_template` SET `script`='instance_shadowfang_keep' WHERE `map`=33; +UPDATE `creature_template` SET `ScriptName`='npc_shadowfang_prisoner' WHERE `entry` IN (3849,3850); +UPDATE `creature_template` SET `ScriptName`='npc_arugal_voidwalker' WHERE `entry`=4627; + +/* SHADOWMOON VALLEY */ +UPDATE `creature_template` SET `ScriptName`='boss_doomwalker' WHERE `entry`=17711; +UPDATE `creature_template` SET `ScriptName`='npc_drake_dealer_hurlunk' WHERE `entry`=23489; +UPDATE `creature_template` SET `ScriptName`='npc_invis_legion_teleporter' WHERE `entry`=21807; +UPDATE `creature_template` SET `ScriptName`='npcs_flanis_swiftwing_and_kagrosh' WHERE `entry` IN (21725,21727); +UPDATE `creature_template` SET `ScriptName`='npc_murkblood_overseer' WHERE `entry`=23309; +UPDATE `creature_template` SET `ScriptName`='npc_neltharaku' WHERE `entry`=21657; +UPDATE `creature_template` SET `ScriptName`='npc_oronok_tornheart' WHERE `entry`=21183; +UPDATE `creature_template` SET `ScriptName`='mob_mature_netherwing_drake' WHERE `entry`=21648; +UPDATE `creature_template` SET `ScriptName`='mob_enslaved_netherwing_drake' WHERE `entry`=21722; +UPDATE `creature_template` SET `ScriptName`='npc_overlord_morghor' WHERE `entry`=23139; +UPDATE `creature_template` SET `ScriptName`='mob_illidari_spawn' WHERE `entry` IN (22075,22074,19797); +UPDATE `creature_template` SET `ScriptName`='mob_torloth_the_magnificent' WHERE `entry`=22076; +UPDATE `creature_template` SET `ScriptName`='npc_lord_illidan_stormrage' WHERE `entry`=22083; +UPDATE `creature_template` SET `ScriptName`='npc_earthmender_wilda' WHERE `entry`=21027; +UPDATE `creature_template` SET `ScriptName`='npc_enraged_spirit' WHERE `entry` IN (21050,21061,21060,21059); +UPDATE `creature_template` SET `ScriptName`='mob_dragonmaw_peon' WHERE `entry`=22252; +UPDATE `creature_template` SET `ScriptName`='npc_karynaku' WHERE `entry`=22112; + +/* SHATTRATH */ +UPDATE `creature_template` SET `ScriptName`='npc_raliq_the_drunk' WHERE `entry`=18585; +UPDATE `creature_template` SET `ScriptName`='npc_salsalabim' WHERE `entry`=18584; +UPDATE `creature_template` SET `ScriptName`='npc_shattrathflaskvendors' WHERE `entry` IN (23483,23484); +UPDATE `creature_template` SET `ScriptName`='npc_zephyr' WHERE `entry`=25967; +UPDATE `creature_template` SET `ScriptName`='npc_kservant' WHERE `entry`=19685; +UPDATE `creature_template` SET `ScriptName`='npc_dirty_larry' WHERE `entry`=19720; +UPDATE `creature_template` SET `ScriptName`='npc_ishanah' WHERE `entry`=18538; +UPDATE `creature_template` SET `ScriptName`='npc_khadgar' WHERE `entry`=18166; + +/* Sholazar Basin */ +UPDATE `creature_template` SET `ScriptName`='npc_injured_rainspeaker_oracle' WHERE `entry`=28217; +UPDATE `creature_template` SET `ScriptName`='npc_vekjik' WHERE `entry`=28315; +UPDATE `creature_template` SET `ScriptName`='npc_avatar_of_freya' WHERE `entry`=27801; +UPDATE `creature_template` SET `ScriptName`='npc_bushwhacker' WHERE `entry`=28317; +UPDATE `creature_template` SET `ScriptName`='npc_engineer_helice' WHERE `entry`=28787; + +/* SILITHUS */ +UPDATE `creature_template` SET `ScriptName`='npcs_rutgar_and_frankal' WHERE `entry` IN (15170,15171); +UPDATE `creature_template` SET `ScriptName`='npc_highlord_demitrian' WHERE `entry`=14347; +UPDATE `gameobject_template` SET `ScriptName`='go_gauntlet_gate' WHERE `entry`=175357; +UPDATE `gameobject_template` SET `ScriptName`='go_crystalline_tear' WHERE `entry`=180633; +UPDATE `creature_template` SET `ScriptName`='mob_qiraj_war_spawn' WHERE `entry` IN (15414,15422,15424,15423); +UPDATE `creature_template` SET `ScriptName`='npc_anachronos_the_ancient' WHERE `entry`=15381; +UPDATE `creature_template` SET `ScriptName`='npc_anachronos_quest_trigger' WHERE `entry`=15454; +UPDATE `gameobject_template` SET `ScriptName`='go_hive_pod' WHERE `entry`=178553; + +/* SILVERMOON */ +UPDATE `creature_template` SET `ScriptName`='npc_blood_knight_stillblade' WHERE `entry`=17768; + +/* SILVERPINE FOREST */ +UPDATE `creature_template` SET `ScriptName`='npc_astor_hadren' WHERE `entry`=6497; +UPDATE `creature_template` SET `ScriptName`='npc_deathstalker_erland' WHERE `entry`=1978; +UPDATE `creature_template` SET `ScriptName`='pyrewood_ambush' WHERE `entry`=2058; + +/* STOCKADES */ + +/* STONETALON MOUNTAINS */ +UPDATE `creature_template` SET `ScriptName`='npc_braug_dimspirit' WHERE `entry`=4489; +UPDATE `creature_template` SET `ScriptName`='npc_kaya_flathoof' WHERE `entry`=11856; + +/* STORM PEAKS */ +UPDATE `creature_template` SET `ScriptName`='npc_agnetta_tyrsdottar' WHERE `entry`=30154; +UPDATE `creature_template` SET `ScriptName`='npc_frostborn_scout' WHERE `entry`=29811; +UPDATE `creature_template` SET `ScriptName`='npc_thorim' WHERE `entry`=29445; +UPDATE `creature_template` SET `ScriptName`='npc_goblin_prisoner' WHERE `entry`=29466; +UPDATE `gameobject_template` SET ScriptName='go_rusty_cage' WHERE `entry`=191544; +UPDATE `creature_template` SET `ScriptName`='npc_injured_goblin' WHERE `entry`=29434; + +/* STORMWIND CITY */ +UPDATE `creature_template` SET `ScriptName`='npc_archmage_malin' WHERE `entry`=2708; +UPDATE `creature_template` SET `ScriptName`='npc_bartleby' WHERE `entry`=6090; +UPDATE `creature_template` SET `ScriptName`='npc_dashel_stonefist' WHERE `entry`=4961; +UPDATE `creature_template` SET `ScriptName`='npc_lady_katrana_prestor' WHERE `entry`=1749; +UPDATE `creature_template` SET `ScriptName`='npc_tyrion' WHERE `entry`=7766; +UPDATE `creature_template` SET `ScriptName`='npc_tyrion_spybot' WHERE `entry`=8856; +UPDATE `creature_template` SET `ScriptName`='npc_lord_gregor_lescovar' WHERE `entry`=1754; +UPDATE `creature_template` SET `ScriptName`='npc_marzon_silent_blade' WHERE `entry`=1755; + + +/* STRANGLETHORN VALE */ +UPDATE `creature_template` SET `ScriptName`='mob_yenniku' WHERE `entry`=2530; + +/* STRATHOLME */ +UPDATE `instance_template` SET `script`='instance_stratholme' WHERE `map`=329; +UPDATE `creature_template` SET `ScriptName`='boss_dathrohan_balnazzar' WHERE `entry`=10812; +UPDATE `creature_template` SET `ScriptName`='boss_magistrate_barthilas' WHERE `entry`=10435; +UPDATE `creature_template` SET `ScriptName`='boss_maleki_the_pallid' WHERE `entry`=10438; +UPDATE `creature_template` SET `ScriptName`='boss_nerubenkan' WHERE `entry`=10437; +UPDATE `creature_template` SET `ScriptName`='boss_cannon_master_willey' WHERE `entry`=10997; +UPDATE `creature_template` SET `ScriptName`='boss_baroness_anastari' WHERE `entry`=10436; +UPDATE `creature_template` SET `ScriptName`='boss_ramstein_the_gorger' WHERE `entry`=10439; +UPDATE `creature_template` SET `ScriptName`='boss_timmy_the_cruel' WHERE `entry`=10808; +UPDATE `creature_template` SET `ScriptName`='boss_silver_hand_bosses' WHERE `entry` IN (17910,17911,17912,17913,17914); +UPDATE `creature_template` SET `ScriptName`='boss_postmaster_malown' WHERE `entry`=11143; +UPDATE `creature_template` SET `ScriptName`='boss_baron_rivendare' WHERE `entry`=10440; +UPDATE `creature_template` SET `ScriptName`='mob_mindless_skeleton' WHERE `entry`=11197; +UPDATE `creature_template` SET `ScriptName`='mob_thuzadin_acolyte' WHERE `entry`=10399; +UPDATE `creature_template` SET `ScriptName`='mobs_spectral_ghostly_citizen' WHERE `entry` IN (10384,10385); +UPDATE `creature_template` SET `ScriptName`='mob_restless_soul' WHERE `entry`=11122; +UPDATE `creature_template` SET `ScriptName`='mob_freed_soul' WHERE `entry`=11136; + +/* SUNKEN TEMPLE */ +UPDATE `instance_template` SET `script`='instance_sunken_temple' WHERE `map`=109; +UPDATE `gameobject_template` SET `ScriptName`='go_atalai_statue' WHERE `entry` IN (148830,148831,148832,148833,148834,148835); +UPDATE `creature_template` SET `ScriptName`='boss_twilight_corrupter' WHERE `entry`=15625; +DELETE FROM `areatrigger_scripts` WHERE `entry`=4016; +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES (4016,'at_malfurion_stormrage'); + +/* SUNWELL PLATEAU */ +UPDATE `instance_template` SET `script`='instance_sunwell_plateau' WHERE `map`=580; +UPDATE `creature_template` SET `ScriptName`='boss_brutallus' WHERE `entry`=24882; +UPDATE `creature_template` SET `ScriptName`='boss_felmyst' WHERE `entry`=25038; +UPDATE `creature_template` SET `ScriptName`='mob_felmyst_vapor' WHERE `entry`=25265; +UPDATE `creature_template` SET `ScriptName`='mob_felmyst_trail' WHERE `entry`=25267; +UPDATE `creature_template` SET `ScriptName`='boss_sacrolash' WHERE `entry`=25165; +UPDATE `creature_template` SET `ScriptName`='boss_alythess' WHERE `entry`=25166; +UPDATE `creature_template` SET `ScriptName`='mob_shadow_image' WHERE `entry`=25214; +UPDATE `creature_template` SET `ScriptName`='boss_kiljaeden' WHERE `entry`=25315; +UPDATE `creature_template` SET `ScriptName`='boss_kalecgos_kj' WHERE `entry`=25319; +UPDATE `creature_template` SET `ScriptName`='mob_kiljaeden_controller' WHERE `entry`=25608; +UPDATE `creature_template` SET `ScriptName`='mob_hand_of_the_deceiver' WHERE `entry`=25588; +UPDATE `creature_template` SET `ScriptName`='mob_felfire_portal' WHERE `entry`=25603; +UPDATE `creature_template` SET `ScriptName`='mob_volatile_felfire_fiend' WHERE `entry`=25598; +UPDATE `creature_template` SET `ScriptName`='mob_armageddon' WHERE `entry`=25735; +UPDATE `creature_template` SET `ScriptName`='mob_shield_orb' WHERE `entry`=25502; +UPDATE `creature_template` SET `ScriptName`='mob_sinster_reflection' WHERE `entry`=25708; +UPDATE `gameobject_template` SET `ScriptName`='go_orb_of_the_blue_flight' WHERE `entry`=188415; +UPDATE `creature_template` SET `ScriptName`='npc_void_sentinel' WHERE `entry`=25772; +UPDATE `creature_template` SET `ScriptName`='npc_dark_fiend' WHERE `entry`=25744; +UPDATE `creature_template` SET `ScriptName`='boss_muru' WHERE `entry`=25741; +UPDATE `creature_template` SET `ScriptName`='boss_entropius' WHERE `entry`=25840; +UPDATE `creature_template` SET `ScriptName`='npc_muru_portal' WHERE `entry`=25770; +UPDATE `creature_template` SET `ScriptName`='boss_kalecgos' WHERE `entry`=24850; +UPDATE `creature_template` SET `ScriptName`='boss_sathrovarr' WHERE `entry`=24892; +UPDATE `creature_template` SET `ScriptName`='boss_kalec' WHERE `entry`=24891; +UPDATE `gameobject_template` SET `ScriptName`='kalecgos_teleporter' WHERE `entry`=187055; +UPDATE `creature_template` SET `ScriptName`='npc_blackhole' WHERE `entry`=25855; + +/* SWAMP OF SORROWS */ + +/* TANARIS */ +UPDATE `creature_template` SET `ScriptName`='mob_aquementas' WHERE `entry`=9453; +UPDATE `creature_template` SET `ScriptName`='npc_custodian_of_time' WHERE `entry`=20129; +UPDATE `creature_template` SET `ScriptName`='npc_marin_noggenfogger' WHERE `entry`=7564; +UPDATE `creature_template` SET `ScriptName`='npc_steward_of_time' WHERE `entry`=20142; +UPDATE `creature_template` SET `ScriptName`='npc_stone_watcher_of_norgannon' WHERE `entry`=7918; +UPDATE `creature_template` SET `ScriptName`='npc_OOX17' WHERE `entry`=7784; +UPDATE `creature_template` SET `ScriptName`='npc_tooga' WHERE `entry`=5955; + +/* TELDRASSIL */ +UPDATE `creature_template` SET `ScriptName`='npc_mist' WHERE `entry`=3568; + +/* TEMPEST KEEP */ + +/* THE MECHANAR */ +UPDATE `creature_template` SET `ScriptName`='boss_gatewatcher_iron_hand' WHERE `entry`=19710; +UPDATE `creature_template` SET `ScriptName`='boss_nethermancer_sepethrea' WHERE `entry`=19221; +UPDATE `creature_template` SET `ScriptName`='mob_ragin_flames' WHERE `entry`=20481; +UPDATE `creature_template` SET `ScriptName`='boss_pathaleon_the_calculator' WHERE `entry`=19220; +UPDATE `creature_template` SET `ScriptName`='mob_nether_wraith' WHERE `entry`=21062; +UPDATE `instance_template` SET `script`='instance_mechanar' WHERE `map`=554; + +/* THE BOTANICA */ +UPDATE `creature_template` SET `ScriptName`='boss_high_botanist_freywinn' WHERE `entry`=17975; +UPDATE `creature_template` SET `ScriptName`='boss_laj' WHERE `entry`=17980; +UPDATE `creature_template` SET `ScriptName`='boss_warp_splinter' WHERE `entry`=17977; +UPDATE `creature_template` SET `ScriptName`='mob_warp_splinter_treant' WHERE `entry`=19949; + +/* THE ARCATRAZ */ +UPDATE `instance_template` SET `script`='instance_arcatraz' WHERE `map`=552; +UPDATE `creature_template` SET `ScriptName`='mob_zerekethvoidzone' WHERE `entry`=21101; +UPDATE `creature_template` SET `ScriptName`='boss_harbinger_skyriss' WHERE `entry`=20912; +UPDATE `creature_template` SET `ScriptName`='boss_harbinger_skyriss_illusion' WHERE `entry` IN (21466,21467); +UPDATE `creature_template` SET `ScriptName`='npc_warden_mellichar' WHERE `entry`=20904; +UPDATE `creature_template` SET `ScriptName`='npc_millhouse_manastorm' WHERE `entry`=20977; + +/* THE EYE */ +UPDATE `instance_template` SET `script`='instance_the_eye' WHERE `map`=550; +UPDATE `gameobject_template` SET `ScriptName`='go_kael_orb' WHERE `entry`=188173; +UPDATE `gameobject_template` SET `ScriptName`='go_movie_orb' WHERE `entry`=187578; +/* The Eye Trash Mobs */ +UPDATE `creature_template` SET `ScriptName`='mob_crystalcore_devastator' WHERE `entry`=20040; +/* Void Reaver event */ +UPDATE `creature_template` SET `ScriptName`='boss_void_reaver' WHERE `entry`=19516; +/* Astromancer event */ +UPDATE `creature_template` SET `ScriptName`='boss_high_astromancer_solarian' WHERE `entry`=18805; +UPDATE `creature_template` SET `ScriptName`='mob_solarium_priest' WHERE `entry`=18806; +/* Kael'thas event */ +UPDATE `creature_template` SET `ScriptName`='boss_kaelthas' WHERE `entry`=19622; +UPDATE `creature_template` SET `ScriptName`='boss_thaladred_the_darkener' WHERE `entry`=20064; +UPDATE `creature_template` SET `ScriptName`='boss_lord_sanguinar' WHERE `entry`=20060; +UPDATE `creature_template` SET `ScriptName`='boss_grand_astromancer_capernian' WHERE `entry`=20062; +UPDATE `creature_template` SET `ScriptName`='boss_master_engineer_telonicus' WHERE `entry`=20063; +UPDATE `creature_template` SET `ScriptName`='mob_phoenix_tk' WHERE `entry`=21362; +UPDATE `creature_template` SET `ScriptName`='mob_phoenix_egg_tk' WHERE `entry`=21364; +UPDATE `creature_template` SET `ScriptName`='mob_nether_vapor' WHERE `entry`=21002; +UPDATE `creature_template` SET `ScriptName`='mob_kael_flamestrike' WHERE `entry`=21369; +UPDATE `creature_template` SET `ScriptName`='boss_alar' WHERE `entry`=19514; +UPDATE `creature_template` SET `ScriptName`='mob_ember_of_alar' WHERE `entry`=19551; +UPDATE `creature_template` SET `ScriptName`='mob_flame_patch_alar' WHERE `entry`=20602; + +/* TEMPLE OF AHN'QIRAJ */ +UPDATE `instance_template` SET `script`='instance_temple_of_ahnqiraj' WHERE `map`=531; +UPDATE `creature_template` SET `ScriptName`='boss_cthun' WHERE `entry`=15727; +UPDATE `creature_template` SET `ScriptName`='boss_skeram' WHERE `entry`=15263; +UPDATE `creature_template` SET `ScriptName`='boss_vem' WHERE `entry`=15544; +UPDATE `creature_template` SET `ScriptName`='boss_yauj' WHERE `entry`=15543; +UPDATE `creature_template` SET `ScriptName`='boss_kri' WHERE `entry`=15511; +UPDATE `creature_template` SET `ScriptName`='boss_sartura' WHERE `entry`=15516; +UPDATE `creature_template` SET `ScriptName`='boss_fankriss' WHERE `entry`=15510; +UPDATE `creature_template` SET `ScriptName`='boss_viscidus' WHERE `entry`=15299; +UPDATE `creature_template` SET `ScriptName`='boss_glob_of_viscidus' WHERE `entry`=15667; +UPDATE `creature_template` SET `ScriptName`='boss_huhuran' WHERE `entry`=15509; +UPDATE `creature_template` SET `ScriptName`='boss_veklor' WHERE `entry`=15276; +UPDATE `creature_template` SET `ScriptName`='boss_veknilash' WHERE `entry`=15275; +UPDATE `creature_template` SET `ScriptName`='boss_ouro' WHERE `entry`=15517; +UPDATE `creature_template` SET `ScriptName`='boss_eye_of_cthun' WHERE `entry`=15589; +UPDATE `creature_template` SET `ScriptName`='mob_sartura_royal_guard' WHERE `entry`=15984; +UPDATE `creature_template` SET `ScriptName`='mob_yauj_brood' WHERE `entry`=15621; +UPDATE `creature_template` SET `ScriptName`='mob_claw_tentacle' WHERE `entry`=15725; +UPDATE `creature_template` SET `ScriptName`='mob_eye_tentacle' WHERE `entry`=15726; +UPDATE `creature_template` SET `ScriptName`='mob_giant_claw_tentacle' WHERE `entry`=15728; +UPDATE `creature_template` SET `ScriptName`='mob_giant_eye_tentacle' WHERE `entry`=15334; +UPDATE `creature_template` SET `ScriptName`='mob_giant_flesh_tentacle' WHERE `entry`=15802; +UPDATE `creature_template` SET `ScriptName`='mob_anubisath_sentinel' WHERE `entry`=15264; + +/* TEROKKAR FOREST */ +UPDATE `creature_template` SET `ScriptName`='mob_infested_root_walker' WHERE `entry`=22095; +UPDATE `creature_template` SET `ScriptName`='mob_netherweb_victim' WHERE `entry`=22355; +UPDATE `creature_template` SET `ScriptName`='mob_rotting_forest_rager' WHERE `entry`=22307; +UPDATE `creature_template` SET `ScriptName`='npc_floon' WHERE `entry`=18588; +UPDATE `creature_template` SET `ScriptName`='npc_isla_starmane' WHERE `entry`=18760; +UPDATE `creature_template` SET `ScriptName`='mob_unkor_the_ruthless' WHERE `entry`=18262; +UPDATE `creature_template` SET `ScriptName`='npc_slim' WHERE `entry`=19679; +UPDATE `creature_template` SET `ScriptName`='npc_akuno' WHERE `entry`=22377; + +/* THOUSAND NEEDLES */ +UPDATE `creature_template` SET `ScriptName`='npc_kanati' WHERE `entry`=10638; +UPDATE `creature_template` SET `ScriptName`='npc_paoka_swiftmountain' WHERE `entry`=10427; +UPDATE `creature_template` SET `ScriptName`='npc_plucky' WHERE `entry`=6626; +UPDATE `creature_template` SET `ScriptName`='npc_lakota_windsong' WHERE `entry`=10646; +UPDATE `creature_template` SET `ScriptName`='npc_enraged_panther' WHERE `entry`=10992; +UPDATE `gameobject_template` SET `ScriptName`='go_panther_cage' WHERE `entry`=176195; + +/* THUNDER BLUFF */ +UPDATE `creature_template` SET `ScriptName`='npc_cairne_bloodhoof' WHERE `entry`=3057; + +/* TRIAL OF THE CHAMPION */ + + +/* TIRISFAL GLADES */ +UPDATE `creature_template` SET `ScriptName`='npc_calvin_montague' WHERE `entry`=6784; + +/* ULDAMAN */ +UPDATE `instance_template` SET `script`='instance_uldaman' WHERE `map`=70; +UPDATE `creature_template` SET `ScriptName`='boss_ironaya' WHERE `entry`=7228; +UPDATE `creature_template` SET `ScriptName`='mob_jadespine_basilisk' WHERE `entry`=4863; +UPDATE `creature_template` SET `ScriptName`='npc_lore_keeper_of_norgannon' WHERE `entry`=7172; +UPDATE `creature_template` SET `ScriptName`='boss_archaedas' WHERE `entry`=2748; +UPDATE `creature_template` SET `ScriptName`='mob_archaedas_minions' WHERE `entry` IN (7309,7077,7076,10120); +UPDATE `creature_template` SET `ScriptName`='mob_stonekeepers' WHERE `entry`=4857; +UPDATE `gameobject_template` SET `ScriptName`='go_altar_of_the_keepers' WHERE `entry`=130511; +UPDATE `gameobject_template` SET `ScriptName`='go_altar_of_archaedas' WHERE `entry`=133234; + +/* ULDUAR */ + + + +/* UN'GORO CRATER */ +UPDATE `creature_template` SET `ScriptName`='npc_ame' WHERE `entry`=9623; +UPDATE `creature_template` SET `ScriptName`='npc_ringo' WHERE `entry`=9999; + +/* UNDERCITY */ +UPDATE `creature_template` SET `ScriptName`='npc_lady_sylvanas_windrunner' WHERE `entry`=10181; +UPDATE `creature_template` SET `ScriptName`='npc_highborne_lamenter' WHERE `entry`=21628; +UPDATE `creature_template` SET `ScriptName`='npc_parqual_fintallas' WHERE `entry`=4488; + +/* UTGARDE KEEP */ +UPDATE `creature_template` SET `scriptname`='boss_keleseth' WHERE `entry`=23953; +UPDATE `creature_template` SET `scriptname`='mob_frost_tomb' WHERE `entry`=23965; +UPDATE `instance_template` SET `script`='instance_utgarde_keep' WHERE `map`=574; +UPDATE `creature_template` SET `ScriptName`='mob_vrykul_skeleton' WHERE `entry`=23970; +UPDATE `creature_template` SET `ScriptName`='boss_skarvald_the_constructor' WHERE `entry` IN (24200,27390); +UPDATE `creature_template` SET `ScriptName`='boss_dalronn_the_controller' WHERE `entry` IN (24201,27389); +UPDATE `creature_template` SET `ScriptName`='boss_ingvar_the_plunderer' WHERE `entry`=23954; +UPDATE `creature_template` SET `ScriptName`='mob_annhylde_the_caller' WHERE `entry`=24068; +UPDATE `creature_template` SET `ScriptName`='mob_ingvar_throw_dummy' WHERE `entry`=23997; +UPDATE `creature_template` SET `ScriptName`='npc_dragonflayer_forge_master' WHERE `entry`=24079; + +/* UTGARDE PINNACLE */ +UPDATE `creature_template` SET `ScriptName`='boss_svala_sorrowgrave' WHERE `entry`=26668; +UPDATE `creature_template` SET `ScriptName`='mob_ritual_channeler' WHERE `entry`=27281; +UPDATE `creature_template` SET `ScriptName`='boss_svala' WHERE `entry`=29281; +UPDATE `creature_template` SET `ScriptName`='boss_palehoof' WHERE `entry`=26687; +UPDATE `creature_template` SET `ScriptName`='mob_palehoof_orb' WHERE `entry`=26688; +UPDATE `creature_template` SET `ScriptName`='boss_skadi' WHERE `entry`=26693; +UPDATE `creature_template` SET `ScriptName`='boss_ymiron' WHERE `entry`=26861; +UPDATE `creature_template` SET `ScriptName`='mob_frenzied_worgen' WHERE `entry`=26683; +UPDATE `creature_template` SET `ScriptName`='mob_ravenous_furbolg' WHERE `entry`=26684; +UPDATE `creature_template` SET `ScriptName`='mob_massive_jormungar' WHERE `entry`=26685; +UPDATE `creature_template` SET `ScriptName`='mob_ferocious_rhino' WHERE `entry`=26686; +UPDATE `creature_template` SET `ScriptName`='mob_palehoof_orb' WHERE `entry`=26688; +UPDATE `instance_template` SET `script`='instance_utgarde_pinnacle' WHERE `map`=575; +UPDATE `gameobject_template` SET `ScriptName`='go_palehoof_sphere'WHERE `entry`=188593; + +/* VAULT OF ARCHAVON */ +UPDATE `creature_template` SET `ScriptName`='boss_archavon' WHERE `entry`=31125; +UPDATE `creature_template` SET `ScriptName`='mob_archavon_warder' WHERE `entry`=32353; +UPDATE `creature_template` SET `ScriptName`='boss_emalon' WHERE `entry`=33993; +UPDATE `creature_template` SET `ScriptName`='mob_tempest_minion' WHERE `entry`=33998; +UPDATE `creature_template` SET `ScriptName`='boss_koralon' WHERE `entry`=35013; +UPDATE `creature_template` SET `ScriptName`='mob_flame_warder' WHERE `entry`=35143; +UPDATE `creature_template` SET `ScriptName`='boss_toravon' WHERE `entry`=38433; +UPDATE `creature_template` SET `ScriptName`='mob_frost_warder' WHERE `entry`=38482; +UPDATE `creature_template` SET `ScriptName`='mob_frozen_orb_stalker' WHERE `entry`=38461; +UPDATE `creature_template` SET `ScriptName`='mob_frozen_orb' WHERE `entry`=38456; +UPDATE `instance_template` SET `script`='instance_archavon' WHERE `map`=624; + +/* VIOLET HOLD */ +UPDATE `creature_template` SET `ScriptName`='npc_sinclari_vh' WHERE `entry`=30658; +UPDATE `creature_template` SET `ScriptName`='npc_teleportation_portal_vh' WHERE `entry`=31011; +UPDATE `creature_template` SET `ScriptName`='boss_lavanthor' WHERE `entry`=29312; +UPDATE `creature_template` SET `ScriptName`='boss_ichoron' WHERE `entry`=29313; +UPDATE `creature_template` SET `ScriptName`='mob_ichor_globule' WHERE `entry`=29321; +UPDATE `creature_template` SET `ScriptName`='boss_zuramat' WHERE `entry`=29314; +UPDATE `creature_template` SET `ScriptName`='boss_erekem' WHERE `entry`=29315; +UPDATE `creature_template` SET `ScriptName`='mob_erekem_guard' WHERE `entry`=29395; +UPDATE `creature_template` SET `ScriptName`='boss_moragg' WHERE `entry`=29316; +UPDATE `creature_template` SET `ScriptName`='boss_xevozz' WHERE `entry`=29266; +UPDATE `creature_template` SET `ScriptName`='mob_ethereal_sphere' WHERE `entry`=29271; +UPDATE `creature_template` SET `ScriptName`='boss_cyanigosa' WHERE `entry`=31134; +update `creature_template` SET `scriptname`='mob_azure_invader' WHERE `entry`=30661; +update `creature_template` SET `scriptname`='mob_azure_spellbreaker' WHERE `entry`=30662; +update `creature_template` SET `scriptname`='mob_azure_binder' WHERE `entry`=30663; +update `creature_template` SET `scriptname`='mob_azure_mage_slayer' WHERE `entry`=30664; +update `creature_template` SET `scriptname`='mob_azure_captain' WHERE `entry`=30666; +update `creature_template` SET `scriptname`='mob_azure_sorceror' WHERE `entry`=30667; +update `creature_template` SET `scriptname`='mob_azure_raider' WHERE `entry`=30668; +update `creature_template` SET `scriptname`='mob_azure_stalker' WHERE `entry`=32191; +update `creature_template` SET `scriptname`='mob_azure_invader' WHERE `entry`=30961; +update `creature_template` SET `scriptname`='mob_azure_spellbreaker' WHERE `entry`=30962; +update `creature_template` SET `scriptname`='mob_azure_binder' WHERE `entry`=30918; +update `creature_template` SET `scriptname`='mob_azure_mage_slayer' WHERE `entry`=30963; +UPDATE `creature_template` SET `scriptname`='mob_azure_saboteur' WHERE `entry`=31079; +UPDATE `instance_template` SET `script`='instance_violet_hold' WHERE `map`=608; + +/* WAILING CAVERNS */ +UPDATE `creature_template` SET `ScriptName`='npc_disciple_of_naralex' WHERE entry=3678; +UPDATE `instance_template` SET `script`='instance_wailing_caverns' WHERE map=43; + +/* WESTERN PLAGUELANDS */ +UPDATE `creature_template` SET `ScriptName`='npcs_dithers_and_arbington' WHERE `entry` IN (11056,11057); +UPDATE `creature_template` SET `ScriptName`='npc_the_scourge_cauldron' WHERE `entry`=11152; +UPDATE `creature_template` SET `ScriptName`='npc_myranda_the_hag' WHERE `entry`=11872; +UPDATE `creature_template` SET `ScriptName`='npc_andorhal_tower' WHERE `entry` IN (10902,10903,10904,10905); +UPDATE `creature_template` SET `ScriptName`='npc_anchorite_truuen' WHERE `entry`=17238; + +/* WESTFALL */ +UPDATE `creature_template` SET `ScriptName`='npc_defias_traitor' WHERE `entry`=467; +UPDATE `creature_template` SET `ScriptName`='npc_daphne_stilwell' WHERE `entry`=6182; + +/* WETLANDS */ +UPDATE `creature_template` SET `ScriptName`='npc_tapoke_slim_jahn' WHERE `entry`=4962; +UPDATE `creature_template` SET `ScriptName`='npc_mikhail' WHERE `entry`=4963; + +/* WINTERSPRING */ +UPDATE `creature_template` SET `ScriptName`='npc_lorax' WHERE `entry`=10918; +UPDATE `creature_template` SET `ScriptName`='npc_rivern_frostwind' WHERE `entry`=10618; +UPDATE `creature_template` SET `ScriptName`='npc_witch_doctor_mauari' WHERE `entry`=10307; + +/* ZANGARMARSH */ +UPDATE `creature_template` SET `ScriptName`='npcs_ashyen_and_keleth' WHERE `entry` IN (17900,17901); +UPDATE `creature_template` SET `ScriptName`='npc_cooshcoosh' WHERE `entry`=18586; +UPDATE `creature_template` SET `ScriptName`='npc_elder_kuruti' WHERE `entry`=18197; +UPDATE `creature_template` SET `ScriptName`='npc_mortog_steamhead' WHERE `entry`=23373; +UPDATE `creature_template` SET `ScriptName`='npc_kayra_longmane' WHERE `entry`=17969; +UPDATE `creature_template` SET `ScriptName`='npc_timothy_daniels' WHERE `entry`=18019; +UPDATE `gameobject_template` SET `ScriptName`='go_southfury_moonstone' WHERE `entry`=185566; + +/* ZUL'AMAN */ +UPDATE `instance_template` SET `script`='instance_zulaman' WHERE `map`=568; +UPDATE `creature_template` SET `ScriptName`='boss_janalai' WHERE `entry`=23578; +UPDATE `creature_template` SET `ScriptName`='boss_nalorakk' WHERE `entry`=23576; +UPDATE `creature_template` SET `ScriptName`='mob_janalai_firebomb' WHERE `entry`=23920; +UPDATE `creature_template` SET `ScriptName`='mob_janalai_hatcher' WHERE `entry`=23818; +UPDATE `creature_template` SET `ScriptName`='mob_janalai_hatchling' WHERE `entry`=23598; +UPDATE `creature_template` SET `ScriptName`='mob_janalai_egg' WHERE `entry`=23817; +UPDATE `creature_template` SET `ScriptName`='npc_forest_frog' WHERE `entry`=24396; +UPDATE `creature_template` SET `ScriptName`='boss_akilzon' WHERE `entry`=23574; +UPDATE `creature_template` SET `ScriptName`='mob_akilzon_eagle' WHERE `entry`=24858; +UPDATE `creature_template` SET `ScriptName`='boss_halazzi' WHERE `entry`=23577; +UPDATE `creature_template` SET `ScriptName`='mob_halazzi_lynx' WHERE `entry`=24143; +UPDATE `creature_template` SET `ScriptName`='boss_hexlord_malacrass' WHERE `entry`=24239; +UPDATE `creature_template` SET `ScriptName`='boss_alyson_antille' WHERE `entry`=24240; +UPDATE `creature_template` SET `ScriptName`='boss_thurg' WHERE `entry`=24241; +UPDATE `creature_template` SET `ScriptName`='boss_slither' WHERE `entry`=24242; +UPDATE `creature_template` SET `ScriptName`='boss_lord_raadan' WHERE `entry`=24243; +UPDATE `creature_template` SET `ScriptName`='boss_gazakroth' WHERE `entry`=24244; +UPDATE `creature_template` SET `ScriptName`='boss_fenstalker' WHERE `entry`=24245; +UPDATE `creature_template` SET `ScriptName`='boss_darkheart' WHERE `entry`=24246; +UPDATE `creature_template` SET `ScriptName`='boss_koragg' WHERE `entry`=24247; +UPDATE `creature_template` SET `ScriptName`='boss_zuljin' WHERE `entry`=23863; +UPDATE `creature_template` SET `ScriptName`='do_nothing' WHERE `entry`=24187; +UPDATE `creature_template` SET `ScriptName`='mob_zuljin_vortex' WHERE `entry`=24136; +UPDATE `creature_template` SET `ScriptName`='npc_zulaman_hostage' WHERE `entry` IN (23790,23999,24024,24001); +UPDATE `creature_template` SET `ScriptName`='mob_mojo' WHERE `entry`=24480; + +/* ZUL'DRAK */ +UPDATE `creature_template` SET `ScriptName`='npc_captured_rageclaw' WHERE `entry`=29686; +UPDATE `creature_template` SET `ScriptName`='npc_drakuru_shackles' WHERE `entry`=29700; +UPDATE `creature_template` SET `ScriptName`='npc_gymer' WHERE `entry`=29647; +UPDATE `creature_template` SET `ScriptName`='npc_gurgthock' WHERE `entry`=30007; +UPDATE `creature_template` SET `ScriptName`='npc_orinoko_tuskbreaker' WHERE `entry`=30020; +UPDATE `creature_template` SET `ScriptName`='npc_korrak_bloodrager' WHERE `entry`=30023; +UPDATE `creature_template` SET `ScriptName`='npc_yggdras' WHERE `entry`=30014; +UPDATE `creature_template` SET `ScriptName`='npc_released_offspring_harkoa' WHERE `entry`=28526; +UPDATE `creature_template` SET `ScriptName`='npc_stinkbeard' WHERE `entry`=30017; +UPDATE `creature_template` SET `ScriptName`='npc_crusade_recruit' WHERE `entry`=28090; +UPDATE `gameobject_template` SET `ScriptName`='go_scourge_enclosure' WHERE `entry`=191548; +UPDATE `creature_template` SET `ScriptName`='npc_elemental_lord' WHERE `entry` IN (30024,30025,30019,30026); +UPDATE `creature_template` SET `ScriptName`='npc_fiend_elemental' WHERE `entry` IN (30044,30042,30043,30045); + +/* ZUL'FARRAK */ +UPDATE `creature_template` SET `ScriptName`='npc_sergeant_bly' WHERE `entry`=7604; +UPDATE `creature_template` SET `ScriptName`='npc_weegli_blastfuse' WHERE `entry`=7607; +UPDATE `gameobject_template` SET `ScriptName`='go_shallow_grave' WHERE `entry` IN (128308,128403); +INSERT IGNORE INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES(962, 'at_zumrah'); +UPDATE `gameobject_template` SET `ScriptName`='go_table_theka' WHERE `entry`=142715; +UPDATE `instance_template` SET `script`='instance_zulfarrak' WHERE `map`=209; + +/* ZUL'GURUB */ +UPDATE `instance_template` SET `script`='instance_zulgurub' WHERE `map`=309; +UPDATE `creature_template` SET `ScriptName`='boss_jeklik' WHERE `entry`=14517; +UPDATE `creature_template` SET `ScriptName`='boss_venoxis' WHERE `entry`=14507; +UPDATE `creature_template` SET `ScriptName`='boss_marli' WHERE `entry`=14510; +UPDATE `creature_template` SET `ScriptName`='boss_mandokir' WHERE `entry`=11382; +UPDATE `creature_template` SET `ScriptName`='boss_gahzranka' WHERE `entry`=15114; +UPDATE `creature_template` SET `ScriptName`='boss_jindo' WHERE `entry`=11380; +UPDATE `creature_template` SET `ScriptName`='boss_hakkar' WHERE `entry`=14834; +UPDATE `creature_template` SET `ScriptName`='boss_thekal' WHERE `entry`=14509; +UPDATE `creature_template` SET `ScriptName`='boss_arlokk' WHERE `entry`=14515; +UPDATE `gameobject_template` SET `ScriptName`='go_gong_of_bethekk' WHERE `entry`=180526; +UPDATE `creature_template` SET `ScriptName`='boss_grilek' WHERE `entry`=15082; +UPDATE `creature_template` SET `ScriptName`='boss_hazzarah' WHERE `entry`=15083; +UPDATE `creature_template` SET `ScriptName`='boss_renataki' WHERE `entry`=15084; +UPDATE `creature_template` SET `ScriptName`='boss_wushoolay' WHERE `entry`=15085; +UPDATE `creature_template` SET `ScriptName`='mob_zealot_lorkhan' WHERE `entry`=11347; +UPDATE `creature_template` SET `ScriptName`='mob_zealot_zath' WHERE `entry`=11348; +UPDATE `creature_template` SET `ScriptName`='mob_healing_ward' WHERE `entry`=14987; +UPDATE `creature_template` SET `ScriptName`='mob_spawn_of_marli' WHERE `entry`=15041; +UPDATE `creature_template` SET `ScriptName`='mob_batrider' WHERE `entry`=14965; +UPDATE `creature_template` SET `ScriptName`='mob_shade_of_jindo' WHERE `entry`=14986; +UPDATE `creature_template` SET `ScriptName`='mob_ohgan' WHERE `entry`=14988; + +/* EOF */ + +UPDATE `creature_template` SET `ScriptName`='npc_skywing' WHERE `entry`=22424; + +DELETE FROM areatrigger_scripts WHERE `entry`=3066; +INSERT INTO areatrigger_scripts VALUES + (3066,'at_ravenholdt'); + +-- moved from world_spell_full.sql to here +update creature_template set AIName='TurretAI',scriptname='' where entry=33139; +update creature_template set ScriptName='boss_kologarn' where entry=32930; +update creature_template set scriptname="boss_flame_leviathan_safety_container" where entry=33218; diff --git a/sql/updates/2.4.3_old/1018_world.sql b/sql/updates/2.4.3_old/1018_world.sql new file mode 100644 index 0000000..d231eb1 --- /dev/null +++ b/sql/updates/2.4.3_old/1018_world.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (31224,41292,44007,44867); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(31224, -1543, 2, 'Cloak of Shadows - Flare'), +(41292, 42017, 2, 'Aura of Suffering'), +(44007, -43657, 2, 'Storm Eye Safe Zone Immune'), +(44867, -46019, 2, 'Spectral Exhaustion - Teleport: Spectral Realm'); diff --git a/sql/updates/2.4.3_old/1026_world.sql b/sql/updates/2.4.3_old/1026_world.sql new file mode 100644 index 0000000..ae18946 --- /dev/null +++ b/sql/updates/2.4.3_old/1026_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_effect` IN ('33686', '31705'); +INSERT INTO `spell_linked_spell`(`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +('-33711','33686','0','Murmur\'s Shockwave (Normal)'), +('-38794','33686','0','Murmur\'s Shockwave (Heroic)'), +('33686','31705','0','Murmur\'s Shockwave Jump'); diff --git a/sql/updates/2.4.3_old/1028_world_scripts.sql b/sql/updates/2.4.3_old/1028_world_scripts.sql new file mode 100644 index 0000000..9c821c7 --- /dev/null +++ b/sql/updates/2.4.3_old/1028_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_the_black_stalker' WHERE `entry`='17882'; diff --git a/sql/updates/2.4.3_old/102_world.sql b/sql/updates/2.4.3_old/102_world.sql new file mode 100644 index 0000000..6cbf3d1 --- /dev/null +++ b/sql/updates/2.4.3_old/102_world.sql @@ -0,0 +1,2 @@ +ALTER TABLE `quest_template` + ADD `RewHonorableKills` mediumint(9) unsigned NOT NULL default '0' AFTER `RewRepValue5`; diff --git a/sql/updates/2.4.3_old/1069_world_scripts.sql b/sql/updates/2.4.3_old/1069_world_scripts.sql new file mode 100644 index 0000000..569a1be --- /dev/null +++ b/sql/updates/2.4.3_old/1069_world_scripts.sql @@ -0,0 +1,12 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN ('44807', '32307', '32314'); +INSERT INTO `spell_script_target` (`entry`,`type`,`targetEntry`) VALUES +('44807', '1', '24850'), +('44807', '1', '24892'), +('32307', '2', '17146'), +('32307', '2', '17147'), +('32307', '2', '17148'), +('32307', '2', '18658'), +('32314', '2', '17138'), +('32314', '2', '18037'), +('32314', '2', '18064'), +('32314', '2', '18065'); diff --git a/sql/updates/2.4.3_old/1073_world_scripts.sql b/sql/updates/2.4.3_old/1073_world_scripts.sql new file mode 100644 index 0000000..c893673 --- /dev/null +++ b/sql/updates/2.4.3_old/1073_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_plains_vision' WHERE `entry`='2983'; diff --git a/sql/updates/2.4.3_old/1074_world_scripts.sql b/sql/updates/2.4.3_old/1074_world_scripts.sql new file mode 100644 index 0000000..13061c0 --- /dev/null +++ b/sql/updates/2.4.3_old/1074_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_plucky' WHERE `entry` = '6626'; diff --git a/sql/updates/2.4.3_old/112_world_scripts.sql b/sql/updates/2.4.3_old/112_world_scripts.sql new file mode 100644 index 0000000..9a2f535 --- /dev/null +++ b/sql/updates/2.4.3_old/112_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `item_template` SET `ScriptName`='item_arcane_charges' WHERE `entry`='34475'; +UPDATE gameobject_template SET faction = 14 WHERE entry = 185134; diff --git a/sql/updates/2.4.3_old/1138_world.sql b/sql/updates/2.4.3_old/1138_world.sql new file mode 100644 index 0000000..610f971 --- /dev/null +++ b/sql/updates/2.4.3_old/1138_world.sql @@ -0,0 +1 @@ +INSERT INTO `spell_proc_event` VALUES (17619, 0x00, 13, 0x0000000000000000, 0x00008000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/2.4.3_old/1142_world.sql b/sql/updates/2.4.3_old/1142_world.sql new file mode 100644 index 0000000..2109d0f --- /dev/null +++ b/sql/updates/2.4.3_old/1142_world.sql @@ -0,0 +1,8 @@ +DELETE from `spell_affect` where entry=16999 and effectId=0; +DELETE from `spell_affect` where entry=16999 and effectId=2; +INSERT INTO `spell_affect` VALUES (16999, 0, 0x1000001000); +INSERT INTO `spell_affect` VALUES (16999, 2, 0x1000001000); +DELETE from `spell_affect` where entry=16998 and effectId=0; +DELETE from `spell_affect` where entry=16998 and effectId=2; +INSERT INTO `spell_affect` VALUES (16998, 0, 0x1000001000); +INSERT INTO `spell_affect` VALUES (16998, 2, 0x1000001000); diff --git a/sql/updates/2.4.3_old/1159_world.sql b/sql/updates/2.4.3_old/1159_world.sql new file mode 100644 index 0000000..13da445 --- /dev/null +++ b/sql/updates/2.4.3_old/1159_world.sql @@ -0,0 +1,8 @@ +DELETE from `spell_affect` where entry=16999; +DELETE from `spell_affect` where entry=16998; +INSERT INTO `spell_affect` VALUES (16998, 0, 0x40000001000); +INSERT INTO `spell_affect` VALUES (16998, 1, 0x40000001000); +INSERT INTO `spell_affect` VALUES (16998, 2, 0x40000001000); +INSERT INTO `spell_affect` VALUES (16999, 0, 0x40000001000); +INSERT INTO `spell_affect` VALUES (16999, 1, 0x40000001000); +INSERT INTO `spell_affect` VALUES (16999, 2, 0x40000001000); diff --git a/sql/updates/2.4.3_old/1160_world.sql b/sql/updates/2.4.3_old/1160_world.sql new file mode 100644 index 0000000..726c0b6 --- /dev/null +++ b/sql/updates/2.4.3_old/1160_world.sql @@ -0,0 +1,140 @@ +DROP TABLE IF EXISTS `access_requirement`; +CREATE TABLE `access_requirement` ( + `id` bigint(20) unsigned NOT NULL COMMENT 'Identifier', + `level_min` tinyint(3) unsigned NOT NULL default '0', + `level_max` tinyint(3) unsigned NOT NULL default '0', + `item` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `item2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_key` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_key2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `quest_failed_text` TEXT NULL DEFAULT NULL, + `heroic_quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_quest_failed_text` TEXT NULL DEFAULT NULL, + `comment` TEXT NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Access Requirements'; + +ALTER TABLE `instance_template` + DROP COLUMN `levelMin`, + DROP COLUMN `levelMax`, + ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `reset_delay`; + +ALTER TABLE `areatrigger_teleport` + DROP COLUMN `required_level`, + DROP COLUMN `required_item`, + DROP COLUMN `required_item2`, + DROP COLUMN `heroic_key`, + DROP COLUMN `heroic_key2`, + DROP COLUMN `heroic_required_quest_done`, + DROP COLUMN `heroic_required_failed_quest_text`, + DROP COLUMN `required_quest_done`, + DROP COLUMN `required_failed_text`, + ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `name`; + +INSERT INTO `access_requirement` VALUES +('1','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Shadowfang Keep (33)'), +('2','15','0','0','0','0','0','0',NULL,'0',NULL,'instance The Stockade (34)'), +('3','10','0','0','0','0','0','0',NULL,'0',NULL,'instance The Deadmines (36)'), +('4','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Wailing Caverns (43)'), +('5','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Kraul (47)'), +('6','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackfathom Deeps (48)'), +('7','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Uldaman (70)'), +('8','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Gnomeregan (90)'), +('9','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunken Temple (109)'), +('10','25','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Downs (129)'), +('11','20','0','0','0','0','0','0',NULL,'0',NULL,'instance Scarlet Monastery (189)'), +('12','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Farrak (209)'), +('13','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Spire (229)'), +('14','40','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Depths (230)'), +('15','55','0','16309','0','0','0','0',NULL,'0',NULL,'instance Onyxia\'s Lair (249)'), +('16','66','0','0','0','30635','0','10285','You can\'t enter Black Morass until you rescue Thrall from Durnholde Keep.','0',NULL,'instance The Black Morass (269)'), +('17','45','0','13704','0','0','0','0',NULL,'0',NULL,'instance Scholomance (289)'), +('18','50','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Gurub (309)'), +('19','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Stratholme (329)'), +('20','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Maraudon (349)'), +('21','8','0','0','0','0','0','0',NULL,'0',NULL,'instance Ragefire Chasm (389)'), +('22','50','0','0','0','0','0','7487',NULL,'0',NULL,'instance Molten Core (409)'), +('23','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Dire Maul (429)'), +('24','60','0','0','0','0','0','7761',NULL,'0',NULL,'instance Blackwing Lair (469)'), +('25','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Ruins of Ahn\'Qiraj (509)'), +('26','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Temple of Ahn\'Qiraj (531)'), +('27','68','0','0'/*'24490'*/,'0','0','0','0',NULL,'0',NULL,'instance Karazhan (532)'), +('28','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Naxxramas (533)'), +('29','70','0','0','0','0','0','10445',NULL,'0',NULL,'instance Hyjal Summit (534)'), +('30','55','0','0'/*'28395'*/,'0','30637','30622','0',NULL,'0',NULL,'instance The Shattered Halls (540)'), +('31','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance The Blood Furnace (542)'), +('32','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance Hellfire Ramparts (543)'), +('33','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Magtheridon\'s Lair (544)'), +('34','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Steamvault (545)'), +('35','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Underbog (546)'), +('36','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Slave Pens (547)'), +('37','70','0','0','0','0','0','0'/*'10901'*/,NULL,'0',NULL,'instance Serpentshrine Cavern (548)'), +('38','70','0','0'/*'31704'*/,'0','0','0','0',NULL,'0',NULL,'instance The Eye (550)'), +('39','68','0','0'/*'31084'*/,'0','30634','0','0',NULL,'0',NULL,'instance The Arcatraz (552)'), +('40','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Botanica (553)'), +('41','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Mechanar (554)'), +('42','65','0','27991','0','30633','0','0',NULL,'0',NULL,'instance Shadow Labyrinth (555)'), +('43','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Sethekk Halls (556)'), +('44','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Mana-Tombs (557)'), +('45','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Auchenai Crypts (558)'), +('46','66','0','0','0','30635','0','0',NULL,'0',NULL,'instance Old Hillsbrad Foothills (560)'), +('47','70','0','32649','0','0','0','0',NULL,'0',NULL,'instance Black Temple (564)'), +('48','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Gruul\'s Lair (565)'), +('49','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Aman (568)'), +('50','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunwell Plateau (580)'), +('51','70','0','0','0','0','0','0',NULL,'11492','Heroic Difficulty requires completion of the "Hard to Kill" quest.','instance Magisters\' Terrace (585)'), +('52','58','0','0','0','0','0','0',NULL,'0',NULL,'Dark Portal'); + +UPDATE `instance_template` SET `access_id` = '1' WHERE `map` = '33'; +UPDATE `instance_template` SET `access_id` = '2' WHERE `map` = '34'; +UPDATE `instance_template` SET `access_id` = '3' WHERE `map` = '36'; +UPDATE `instance_template` SET `access_id` = '4' WHERE `map` = '43'; +UPDATE `instance_template` SET `access_id` = '5' WHERE `map` = '47'; +UPDATE `instance_template` SET `access_id` = '6' WHERE `map` = '48'; +UPDATE `instance_template` SET `access_id` = '7' WHERE `map` = '70'; +UPDATE `instance_template` SET `access_id` = '8' WHERE `map` = '90'; +UPDATE `instance_template` SET `access_id` = '9' WHERE `map` = '109'; +UPDATE `instance_template` SET `access_id` = '10' WHERE `map` = '129'; +UPDATE `instance_template` SET `access_id` = '11' WHERE `map` = '189'; +UPDATE `instance_template` SET `access_id` = '12' WHERE `map` = '209'; +UPDATE `instance_template` SET `access_id` = '13' WHERE `map` = '229'; +UPDATE `instance_template` SET `access_id` = '14' WHERE `map` = '230'; +UPDATE `instance_template` SET `access_id` = '15' WHERE `map` = '249'; +UPDATE `instance_template` SET `access_id` = '16' WHERE `map` = '269'; +UPDATE `instance_template` SET `access_id` = '17' WHERE `map` = '289'; +UPDATE `instance_template` SET `access_id` = '18' WHERE `map` = '309'; +UPDATE `instance_template` SET `access_id` = '19' WHERE `map` = '329'; +UPDATE `instance_template` SET `access_id` = '20' WHERE `map` = '349'; +UPDATE `instance_template` SET `access_id` = '21' WHERE `map` = '389'; +UPDATE `instance_template` SET `access_id` = '22' WHERE `map` = '409'; +UPDATE `instance_template` SET `access_id` = '23' WHERE `map` = '429'; +UPDATE `instance_template` SET `access_id` = '24' WHERE `map` = '469'; +UPDATE `instance_template` SET `access_id` = '25' WHERE `map` = '509'; +UPDATE `instance_template` SET `access_id` = '26' WHERE `map` = '531'; +UPDATE `instance_template` SET `access_id` = '27' WHERE `map` = '532'; +UPDATE `instance_template` SET `access_id` = '28' WHERE `map` = '533'; +UPDATE `instance_template` SET `access_id` = '29' WHERE `map` = '534'; +UPDATE `instance_template` SET `access_id` = '30' WHERE `map` = '540'; +UPDATE `instance_template` SET `access_id` = '31' WHERE `map` = '542'; +UPDATE `instance_template` SET `access_id` = '32' WHERE `map` = '543'; +UPDATE `instance_template` SET `access_id` = '33' WHERE `map` = '544'; +UPDATE `instance_template` SET `access_id` = '34' WHERE `map` = '545'; +UPDATE `instance_template` SET `access_id` = '35' WHERE `map` = '546'; +UPDATE `instance_template` SET `access_id` = '36' WHERE `map` = '547'; +UPDATE `instance_template` SET `access_id` = '37' WHERE `map` = '548'; +UPDATE `instance_template` SET `access_id` = '38' WHERE `map` = '550'; +UPDATE `instance_template` SET `access_id` = '39' WHERE `map` = '552'; +UPDATE `instance_template` SET `access_id` = '40' WHERE `map` = '553'; +UPDATE `instance_template` SET `access_id` = '41' WHERE `map` = '554'; +UPDATE `instance_template` SET `access_id` = '42' WHERE `map` = '555'; +UPDATE `instance_template` SET `access_id` = '43' WHERE `map` = '556'; +UPDATE `instance_template` SET `access_id` = '44' WHERE `map` = '557'; +UPDATE `instance_template` SET `access_id` = '45' WHERE `map` = '558'; +UPDATE `instance_template` SET `access_id` = '46' WHERE `map` = '560'; +UPDATE `instance_template` SET `access_id` = '47' WHERE `map` = '564'; +UPDATE `instance_template` SET `access_id` = '48' WHERE `map` = '565'; +UPDATE `instance_template` SET `access_id` = '49' WHERE `map` = '568'; +UPDATE `instance_template` SET `access_id` = '50' WHERE `map` = '580'; +UPDATE `instance_template` SET `access_id` = '51' WHERE `map` = '585'; +UPDATE `areatrigger_teleport` SET `access_id` = '52' WHERE `id` IN ('4352','4354'); diff --git a/sql/updates/2.4.3_old/1164_characters.sql b/sql/updates/2.4.3_old/1164_characters.sql new file mode 100644 index 0000000..bc552a4 --- /dev/null +++ b/sql/updates/2.4.3_old/1164_characters.sql @@ -0,0 +1,27 @@ +ALTER TABLE auctionhouse + DROP COLUMN location; + +ALTER TABLE `auctionhousebot` + ADD COLUMN `percentgreytradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Grey Trade Goods auction items' AFTER `maxtime`, + ADD COLUMN `percentorangetradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Orange Trade Goods auction items' AFTER `percentpurpletradegoods`, + ADD COLUMN `percentyellowtradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Yellow Trade Goods auction items' AFTER `percentorangetradegoods`, + ADD COLUMN `percentgreyitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Grey auction items' AFTER `percentyellowtradegoods`, + ADD COLUMN `percentorangeitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Orange auction items' AFTER `percentpurpleitems`, + ADD COLUMN `percentyellowitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Yellow auction items' AFTER `percentorangeitems`, + ADD COLUMN `minpricegrey` int(11) default '100' COMMENT 'Minimum price of Grey items (percentage).' AFTER `percentyellowitems`, + ADD COLUMN `maxpricegrey` int(11) default '150' COMMENT 'Maximum price of Grey items (percentage).' AFTER `minpricegrey`, + ADD COLUMN `minpriceorange` int(11) default '3250' COMMENT 'Minimum price of Orange items (percentage).' AFTER `maxpricepurple`, + ADD COLUMN `maxpriceorange` int(11) default '5550' COMMENT 'Maximum price of Orange items (percentage).' AFTER `minpriceorange`, + ADD COLUMN `minpriceyellow` int(11) default '5250' COMMENT 'Minimum price of Yellow items (percentage).' AFTER `maxpriceorange`, + ADD COLUMN `maxpriceyellow` int(11) default '6550' COMMENT 'Maximum price of Yellow items (percentage).' AFTER `minpriceyellow`, + ADD COLUMN `minbidpricegrey` int(11) default '70' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 70' AFTER `maxpriceyellow`, + ADD COLUMN `maxbidpricegrey` int(11) default '100' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpricegrey`, + ADD COLUMN `minbidpriceorange` int(11) default '80' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 80' AFTER `maxbidpricepurple`, + ADD COLUMN `maxbidpriceorange` int(11) default '100' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpriceorange`, + ADD COLUMN `minbidpriceyellow` int(11) default '80' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 80' AFTER `maxbidpriceorange`, + ADD COLUMN `maxbidpriceyellow` int(11) default '100' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpriceyellow`, + ADD COLUMN `maxstackgrey` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.' AFTER `maxbidpriceyellow`, + ADD COLUMN `maxstackorange` int(11) default '1' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.' AFTER `maxstackpurple`, + ADD COLUMN `maxstackyellow` int(11) default '1' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.' AFTER `maxstackorange`, + ADD COLUMN `buyerpriceorange` int(11) default '20' COMMENT 'Multiplier to vendorprice when buying orange items from auctionhouse' AFTER `buyerpricepurple`, + ADD COLUMN `buyerpriceyellow` int(11) default '22' COMMENT 'Multiplier to vendorprice when buying yellow items from auctionhouse' AFTER `buyerpriceorange`; diff --git a/sql/updates/2.4.3_old/116_world.sql b/sql/updates/2.4.3_old/116_world.sql new file mode 100644 index 0000000..86864bd --- /dev/null +++ b/sql/updates/2.4.3_old/116_world.sql @@ -0,0 +1,8 @@ +INSERT INTO `spell_script_target` VALUES ('30531', '1', '17256'); +INSERT INTO `spell_script_target` VALUES ('41455', '1', '22949'); +INSERT INTO `spell_script_target` VALUES ('41455', '1', '22950'); +INSERT INTO `spell_script_target` VALUES ('41455', '1', '22951'); +INSERT INTO `spell_script_target` VALUES ('41455', '1', '22952'); +INSERT INTO `spell_script_target` VALUES ('42471', '1', '23817'); +INSERT INTO `spell_script_target` VALUES ('43734', '1', '23817'); +INSERT INTO `spell_script_target` VALUES ('42631', '1', '23920'); diff --git a/sql/updates/2.4.3_old/117_world_scripts.sql b/sql/updates/2.4.3_old/117_world_scripts.sql new file mode 100644 index 0000000..794258b --- /dev/null +++ b/sql/updates/2.4.3_old/117_world_scripts.sql @@ -0,0 +1,64 @@ +-- +-- NOTE: If you have temporary stored data in table `eventai_localized_texts` make sure to make backup of this before running this update! +-- NOTE: If you have any texts in current eventai_texts and they are not using entries valid for *_texts table, you _will_ get error messages on startup. +-- NOTE: Do not run this update twice, it may create bad data if you choose to do so. +-- + +-- drop obsolete table +DROP TABLE eventai_localized_texts; + +-- alter and add fields in table `eventai_texts` +ALTER TABLE eventai_texts CHANGE COLUMN `id` `entry` mediumint(8) NOT NULL; +ALTER TABLE eventai_texts CHANGE COLUMN `text` `content_default` text NOT NULL AFTER `entry`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc1` text AFTER `content_default`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc2` text AFTER `content_loc1`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc3` text AFTER `content_loc2`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc4` text AFTER `content_loc3`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc5` text AFTER `content_loc4`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc6` text AFTER `content_loc5`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc7` text AFTER `content_loc6`; +ALTER TABLE eventai_texts ADD COLUMN `content_loc8` text AFTER `content_loc7`; +ALTER TABLE eventai_texts ADD COLUMN `sound` mediumint(8) unsigned NOT NULL default '0' AFTER `content_loc8`; +ALTER TABLE eventai_texts ADD COLUMN `type` tinyint unsigned NOT NULL default '0' AFTER `sound`; +ALTER TABLE eventai_texts ADD COLUMN `language` tinyint unsigned NOT NULL default '0' AFTER `type`; +ALTER TABLE eventai_texts MODIFY COLUMN `comment` text; + +-- get our current action type, and update text type = yell +UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=1 WHERE eventai_scripts.action1_type IN (2,7) AND eventai_scripts.action1_param1=eventai_texts.entry; +UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=1 WHERE eventai_scripts.action2_type IN (2,7) AND eventai_scripts.action2_param1=eventai_texts.entry; +UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=1 WHERE eventai_scripts.action3_type IN (2,7) AND eventai_scripts.action3_param1=eventai_texts.entry; +-- get our current action type, and update text type = textemote +UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=2 WHERE eventai_scripts.action1_type IN (3,8) AND eventai_scripts.action1_param1=eventai_texts.entry; +UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=2 WHERE eventai_scripts.action2_type IN (3,8) AND eventai_scripts.action2_param1=eventai_texts.entry; +UPDATE eventai_texts,eventai_scripts SET eventai_texts.type=2 WHERE eventai_scripts.action3_type IN (3,8) AND eventai_scripts.action3_param1=eventai_texts.entry; + +-- update our scripts, for all action type 2, 3, 6, 7 & 8 to become 1 +UPDATE eventai_scripts SET action1_type=1 WHERE action1_type IN (2,3,6,7,8); +UPDATE eventai_scripts SET action2_type=1 WHERE action2_type IN (2,3,6,7,8); +UPDATE eventai_scripts SET action3_type=1 WHERE action3_type IN (2,3,6,7,8); + +-- was OOC, so at least one could be -1, set this to 0 (dev note: below will be bad, if run twice) +UPDATE eventai_scripts SET action1_param2=0 WHERE action1_type=1 AND action1_param2=-1; +UPDATE eventai_scripts SET action1_param3=0 WHERE action1_type=1 AND action1_param3=-1; +UPDATE eventai_scripts SET action2_param2=0 WHERE action2_type=1 AND action2_param2=-1; +UPDATE eventai_scripts SET action2_param3=0 WHERE action2_type=1 AND action2_param3=-1; +UPDATE eventai_scripts SET action3_param2=0 WHERE action3_type=1 AND action3_param2=-1; +UPDATE eventai_scripts SET action3_param3=0 WHERE action3_type=1 AND action3_param3=-1; + +-- expect all to be action type 1 now, continue convert to negative text entry +UPDATE eventai_scripts SET action1_param1=(`action1_param1`) *-1 WHERE action1_type=1 AND action1_param1>0; +UPDATE eventai_scripts SET action2_param1=(`action2_param1`) *-1 WHERE action2_type=1 AND action2_param1>0; +UPDATE eventai_scripts SET action3_param1=(`action3_param1`) *-1 WHERE action3_type=1 AND action3_param1>0; + +UPDATE eventai_scripts SET action1_param2=(`action1_param2`) *-1 WHERE action1_type=1 AND action1_param2>0; +UPDATE eventai_scripts SET action2_param2=(`action2_param2`) *-1 WHERE action2_type=1 AND action2_param2>0; +UPDATE eventai_scripts SET action3_param2=(`action3_param2`) *-1 WHERE action3_type=1 AND action3_param2>0; + +UPDATE eventai_scripts SET action1_param3=(`action1_param3`) *-1 WHERE action1_type=1 AND action1_param3>0; +UPDATE eventai_scripts SET action2_param3=(`action2_param3`) *-1 WHERE action2_type=1 AND action2_param3>0; +UPDATE eventai_scripts SET action3_param3=(`action3_param3`) *-1 WHERE action3_type=1 AND action3_param3>0; + +-- now we have negative numbers in script, must make sure text entries have same entry as script +UPDATE eventai_texts SET entry=(`entry`) *-1 WHERE entry>0; + +ALTER TABLE script_texts MODIFY COLUMN `sound` mediumint(8) unsigned NOT NULL default '0'; diff --git a/sql/updates/2.4.3_old/11_characters.sql b/sql/updates/2.4.3_old/11_characters.sql new file mode 100644 index 0000000..2377680 --- /dev/null +++ b/sql/updates/2.4.3_old/11_characters.sql @@ -0,0 +1,5 @@ +ALTER TABLE `arena_team_member` ADD COLUMN `points_to_add` int(10) UNSIGNED NOT NULL DEFAULT '0'; +DROP TABLE IF EXISTS `saved_variables`; +CREATE TABLE `saved_variables` ( + `NextArenaPointDistributionTime` timestamp NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Variable Saves'; diff --git a/sql/updates/2.4.3_old/120_world.sql b/sql/updates/2.4.3_old/120_world.sql new file mode 100644 index 0000000..7cba69f --- /dev/null +++ b/sql/updates/2.4.3_old/120_world.sql @@ -0,0 +1,162 @@ +-- Add/Edit/Move lang strings +DELETE FROM `trinity_string` WHERE `entry` IN (25,52,54,55,56,171,401,413,438,593,594,595,596,597,598,599,614,615,636,637,638,809,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118); +DELETE FROM `trinity_string` WHERE `entry` BETWEEN '667' AND '687'; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN '711' AND '716'; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN '730' AND '747'; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN '5000' AND '5006'; +INSERT INTO trinity_string VALUES +('25','Password not changed (unknown error)!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('52', 'Invaid item count (%u) for item %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('54','The new passwords do not match',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('55','Your password can\'t be longer than 16 characters (client limit), password not changed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('56','Current Message of the day: \r\n%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(171,'You are being teleported by server console command.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(401,'You change security level of account %s to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(413,'Account not exist: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(438,'Found items %u: %u ( inventory %u mail %u auction %u guild %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(593,'Currently Banned Accounts:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(594,'| Account | BanDate | UnbanDate | Banned By | Ban Reason |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(595,'Currently Banned IPs:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(596,'| IP | BanDate | UnbanDate | Banned By | Ban Reason |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(597,'Current gamemasters:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(598,'| Account | GM |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(599,'No gamemasters.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('614', 'The Alliance flag has been respawned!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('615', 'The Horde flag has been respawned!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('636', 'The Battle for Eye of the Storm begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('637', 'The Battle for Eye of the Storm begins in 30 seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('638', 'The Battle for Eye of the Storm has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('667', 'The Alliance has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('668', 'The Horde has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('669', 'The Alliance has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('670', 'The Horde has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('671', 'The Alliance has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('672', 'The Horde has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('673', 'The Alliance has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('674', 'The Horde has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('675', 'The Alliance has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('676', 'The Horde has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('677', 'The Alliance has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('678', 'The Horde has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('679', 'The Alliance has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('680', 'The Horde has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('681', 'The Alliance has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('682', 'The Horde has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('683', '$N has taken the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('684', 'The Alliance has captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('685', 'The Horde has captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('686', 'The Flag has been dropped!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('687', 'The flag has been reset', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('711', 'Your group is too large for this battleground. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('712', 'Your group is too large for this arena. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('713', 'You must be level %u to join an arena team!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('714', '%s is not high enough level to join your team', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('715', 'You don\'t meet Battleground level requirements', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('716', 'Your arena team is full, %s cannot join it.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('730', 'Your group has members not in your arena team. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('731', 'Your group does not have enough players to join this match.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('732', 'The Gold Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('733', 'The Green Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('734', 'There aren\'t enough players in this battleground. It will end soon unless some more players join to balance the fight.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('735', 'Your group has an offline member. Please remove him before joining.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('736', 'Your group has players from the opposing faction. You can\'t join the battleground as a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('737', 'Your group has players from different battleground brakets. You can\'t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('738', 'Someone in your party is already in this battleground queue. (S)he must leave it before joining as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('739', 'Someone in your party is Deserter. You can\'t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('740', 'Someone in your party is already in three battleground queues. You cannot join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('741', 'You cannot teleport to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('742', 'You cannot summon players to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('743', 'You must be in GM mode to teleport to a player in a battleground.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('744', 'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('745', 'Arena testing turned %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('746','|cffff0000[Automatic]:|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('747','|cffffff00[|c1f40af20Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +('809','Account for character %s not found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('1000','Exiting daemon...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('1001','Account deleted: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('1002','Account %s NOT deleted (probably sql file format was updated)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('1003','Account %s NOT deleted (unknown error)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('1004','Account created: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +('1005','Account name can\'t be longer than 16 characters (client limit), account not created!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1006,'Account with this name already exist!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1007,'Account %s NOT created (probably sql file format was updated)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1008,'Account %s NOT created (unknown error)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1009,'Player %s (Guid: %u) Account %s (Id: %u) deleted.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1010,'| Account | Character | IP | GM | TBC |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1011,'| | %20s | |||',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1100,'Account %s (Id: %u) have up to %u expansion allowed now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1101,'Message of the day changed to:\r\n%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1102,'Message sent to %s: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1103,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1104,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1105,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1106,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1107,'%d - %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1108,'%d - %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1109,'%d - %s %s %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1110,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1111,'%d - %s X:%f Y:%f Z:%f MapId:%d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1112,'Failed to open file: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1113,'Account %s (%u) have max amount allowed characters (client limit)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1114,'Dump file has broken data!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1115,'Invalid character name!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1116,'Invalid character guid!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1117,'Character guid %u in use!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1118,'%d - guild: %s (guid: %u) %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5000,'You froze player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5001,'It might be amusing but no... you cant freeze yourself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5002,'Invalid input check the name of target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5003,'You unfroze player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5004,'There are no frozen players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5005,'Following players are frozen on the server:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5006,'- %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + + +-- cleanup command syntax +DELETE FROM command WHERE name IN ( + 'gm ingame','gm online', + 'ban','ban account','ban character','ban ip', + 'baninfo','baninfo account','baninfo character','baninfo ip','pdump load', + 'banlist','banlist account','banlist character','banlist ip','help','transport', + 'unban','unban account','unban character','unban ip','list item','pdump write', + 'acct','account','account create','account delete','account onlinelist', + 'account set addon','account set gmlevel','account set password', + 'chardelete','gm list','gm online','sendmessage','server corpses','server exit','server motd', + 'server set loglevel','server set motd','security' + +); + +INSERT INTO command VALUES +('gm ingame',0,'Syntax: .gm ingame\r\n\r\nDisplay a list of available in game Game Masters.'), +('ban account',3,'Syntax is: ban account $Name $bantime $reason\r\nBan account kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban character',3,'Syntax is: ban character $Name $bantime $reason\r\nBan account and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban ip',3,'Syntax is: ban ip $Ip $bantime $reason\r\nBan IP.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('baninfo account',3,'Syntax is: baninfo account\r\nWatch full information about a specific ban.'), +('baninfo character',3,'Syntax is: baninfo character\r\nWatch full information about a specific ban.'), +('baninfo ip',3,'Syntax is: baninfo ip\r\nWatch full information about a specific ban.'), +('banlist account',3,'Syntax is: banlist account [$Name]\r\nSearches the banlist for a account name pattern or show full list account bans.'), +('banlist character',3,'Syntax is: banlist character $Name\r\nSearches the banlist for a character name pattern. Pattern required.'), +('banlist ip',3,'Syntax is: banlist ip [$Ip]\r\nSearches the banlist for a IP pattern or show full list of IP bans.'), +('unban account',3,'Syntax is: unban account $Name\r\nUnban accounts for account name pattern.'), +('unban character',3,'Syntax is: unban character $Name\r\nUnban accounts for character name pattern.'), +('unban ip',3,'Syntax is: unban ip $Ip\r\nUnban accounts for IP pattern.'), +('pdump write',3,'Syntax is: pdump write $filename $playerNameOrGUID\r\nWrite character dump with name/guid $playerNameOrGUID to file $filename.'), +('pdump load',3,'Syntax is: pdump load $filename $account [$newname] [$newguid]\r\nLoad character dump from dump file into character list of $account with saved or $newname, with saved (or first free) or $newguid guid.'), +('list item',3,'Syntax: .list item #item_id [#max_count]\r\n\r\nOutput items with item id #item_id found in all character inventories, mails, auctions, and guild banks. Output item guids, item owner guid, owner account and owner name (guild name and guid in case guild bank). Will be output maximum #max_count items. If #max_count not provided use 10 as default value.'), +('help',0,'Syntax: .help [$command]\r\n\r\nDisplay usage instructions for the given $command. If no $command provided show list available commands.'), +('account',0,'Syntax: .account\r\n\r\nDisplay the access level of your account.'), +('account create',4,'Syntax: .account create $account $password\r\n\r\nCreate account and set password to it.'), +('account delete',4,'Syntax: .account delete $account\r\n\r\nDelete account with all characters.'), +('account onlinelist',4,'Syntax: .account onlinelist\r\n\r\nShow list of online accounts.'), +('account set addon',3,'Syntax: .account set addon [$account] #addon\r\n\r\nSet user (posible targeted) expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk.'), +('account set gmlevel',4,'Syntax: .account set gmlevel [$account] #level\r\n\r\nSet the security level for targeted player (can''t be used at self) or for account $name to a level of #level.\r\n\r\n#level may range from 0 to 3.'), +('account set password',4,'Syntax: .account set password $account $password $password\r\n\r\nSet password for account.'), +('chardelete',4,'Syntax: .chardelete $charactername\r\n\r\nDelete character.'), +('gm list',3,'Syntax: .gm list\r\n\r\nDisplay a list of all Game Masters accounts and security levels.'), +('gm online',0,'Syntax: .gm online\r\n\r\nDisplay a list of available Game Masters.'), +('sendmessage',3,'Syntax: .sendmessage $playername $message\r\n\r\nSend screen message to player from ADMINISTRATOR.'), +('server corpses',2,'Syntax: .server corpses\r\n\r\nTriggering corpses expire check in world.'), +('server exit',4,'Syntax: .server exit\r\n\r\nTerminate Trinity NOW.'), +('server motd',0,'Syntax: .server motd\r\n\r\nShow server Message of the day.'), +('server set loglevel',4,'Syntax: .server set loglevel #level\r\n\r\nSet server log level (0 - errors only, 1 - basic, 2 - detail, 3 - debug).'), +('server set motd',3,'Syntax: .server set motd $MOTD\r\n\r\nSet server Message of the day.'); diff --git a/sql/updates/2.4.3_old/123_world_scripts.sql b/sql/updates/2.4.3_old/123_world_scripts.sql new file mode 100644 index 0000000..b5f9305 --- /dev/null +++ b/sql/updates/2.4.3_old/123_world_scripts.sql @@ -0,0 +1,215 @@ +-- +-- trinity_script_texts.sql Contains data for table `script_texts` mainly used in C++ parts. +-- valid entries for table are between -1000000 and -1999999 +-- + +TRUNCATE `script_texts`; + +-- +-- -1 000 000 First 100 entries are reserved for special use, do not add regular text here. +-- + +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000000,'',0,0,0,'DEFAULT_TEXT'); + +-- +-- Normal text entries. Say/Yell/Whisper/Emote for any regular world object. +-- + +-- -1 000 100 GENERAL MAPS (not typical instance maps) + +-- -1 033 000 SHADOWFANG KEEP + +-- -1 034 000 STOCKADES + +-- -1 036 000 DEADMINES + +-- -1 043 000 WAILING CAVERNS + +-- -1 047 000 RAZORFEN KRAUL + +-- -1 048 000 BLACKFATHOM DEEPS + +-- -1 070 000 ULDAMAN + +-- -1 090 000 GNOMEREGAN + +-- -1 109 000 SUNKEN TEMPLE + +-- -1 129 000 RAZORFEN DOWNS + +-- -1 189 000 SCARLET MONASTERY + +-- -1 209 000 ZUL'FARRAK + +-- -1 229 000 BLACKROCK SPIRE + +-- -1 230 000 BLACKROCK DEPTHS + +-- -1 249 000 ONYXIA'S LAIR + +-- -1 269 000 OPENING OF THE DARK PORTAL (BLACK MORASS) + +-- -1 289 000 SCHOLOMANCE + +-- -1 309 000 ZUL'GURUB + +-- -1 329 000 STRATHOLME + +-- -1 349 000 MARAUDON + +-- -1 389 000 RAGEFIRE CHASM + +-- -1 409 000 MOLTEN CORE + +-- -1 429 000 DIRE MAUL + +-- -1 469 000 BLACKWING LAIR + +-- -1 509 000 RUINS OF AHN'QIRAJ + +-- -1 531 000 TEMPLE OF AHN'QIRAJ + +-- -1 532 000 KARAZHAN + +-- -1 533 000 NAXXRAMAS + +-- -1 534 000 THE BATTLE OF MT. HYJAL + +-- -1 540 000 SHATTERED HALLS + +-- -1 542 000 BLOOD FURNACE + +-- -1 543 000 HELLFIRE RAMPARTS + +-- -1 544 000 MAGTHERIDON'S LAIR + +-- -1 545 000 THE STEAMVAULT + +-- -1 546 000 THE UNDERBOG + +-- -1 547 000 THE SLAVE PENS + +-- -1 548 000 SERPENTSHRINE CAVERN + +-- -1 550 000 THE EYE + +-- -1 552 000 THE ARCATRAZ + +-- -1 553 000 THE BOTANICA + +-- -1 554 000 THE MECHANAR + +-- -1 555 000 SHADOW LABYRINTH +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1555000,'Infidels have invaded the sanctuary! Sniveling pests...You have yet to learn the true meaning of agony!',10473,1,0,'hellmaw SAY_INTRO'), +(-1555001,'Pathetic mortals! You will pay dearly!',10475,1,0,'hellmaw SAY_AGGRO1'), +(-1555002,'I will break you!',10476,1,0,'hellmaw SAY_AGGRO2'), +(-1555003,'Finally! Something to relieve the tedium!',10477,1,0,'hellmaw SAY_AGGRO3'), +(-1555004,'Aid me, you fools, before it\'s too late!',10474,1,0,'hellmaw SAY_HELP'), +(-1555005,'Do you fear death?',10478,1,0,'hellmaw SAY_SLAY1'), +(-1555006,'This is the part I enjoy most.',10479,1,0,'hellmaw SAY_SLAY2'), +(-1555007,'Do not...grow...overconfident, mortal.',10480,1,0,'hellmaw SAY_DEATH'), + +(-1555008,'All flesh must burn.',10482,1,0,'blackhearth SAY_INTRO1'), +(-1555009,'All creation must be unmade!',10483,1,0,'blackhearth SAY_INTRO2'), +(-1555010,'Power will be yours!',10484,1,0,'blackhearth SAY_INTRO3'), +(-1555011,'You\'ll be sorry!',10486,1,0,'blackhearth SAY_AGGRO1'), +(-1555012,'Time for fun!',10487,1,0,'blackhearth SAY_AGGRO2'), +(-1555013,'I see dead people!',10488,1,0,'blackhearth SAY_AGGRO3'), +(-1555014,'No comin\' back for you!',10489,1,0,'blackhearth SAY_SLAY1'), +(-1555015,'Nice try!',10490,1,0,'blackhearth SAY_SLAY2'), +(-1555016,'Help us, hurry!',10485,1,0,'blackhearth SAY_HELP'), +(-1555017,'This... no... good...',10491,1,0,'blackhearth SAY_DEATH'), + +(-1555018,'Be ready for Dark One\'s return.',10492,1,0,'blackhearth SAY2_INTRO1'), +(-1555019,'So we have place in new universe.',10493,1,0,'blackhearth SAY2_INTRO2'), +(-1555020,'Dark one promise!',10494,1,0,'blackhearth SAY2_INTRO3'), +(-1555021,'You\'ll be sorry!',10496,1,0,'blackhearth SAY2_AGGRO1'), +(-1555022,'Time to kill!',10497,1,0,'blackhearth SAY2_AGGRO2'), +(-1555023,'You be dead people!',10498,1,0,'blackhearth SAY2_AGGRO3'), +(-1555024,'Now you gone for good.',10499,1,0,'blackhearth SAY2_SLAY1'), +(-1555025,'You failed, haha haha',10500,1,0,'blackhearth SAY2_SLAY2'), +(-1555026,'Help us, hurry!',10495,1,0,'blackhearth SAY2_HELP'), +(-1555027,'Arrgh, aah...ahhh',10501,1,0,'blackhearth SAY2_DEATH'), + +(-1555028,'Keep your minds focused for the days of reckoning are close at hand. Soon, the destroyer of worlds will return to make good on his promise. Soon the destruction of all that is will begin!',10522,1,0,'vorpil SAY_INTRO'), +(-1555029,'I\'ll make an offering of your blood!',10524,1,0,'vorpil SAY_AGGRO1'), +(-1555030,'You\'ll be a fine example, for the others.',10525,1,0,'vorpil SAY_AGGRO2'), +(-1555031,'Good, a worthy sacrifice.',10526,1,0,'vorpil SAY_AGGRO3'), +(-1555032,'Come to my aid, heed your master now!',10523,1,0,'vorpil SAY_HELP'), +(-1555033,'I serve with pride.',10527,1,0,'vorpil SAY_SLAY1'), +(-1555034,'Your death is for the greater cause!',10528,1,0,'vorpil SAY_SLAY2'), +(-1555035,'I give my life... Gladly.',10529,1,0,'vorpil SAY_DEATH'), + +(-1555036,'draws energy from the air.',0,2,0,'murmur EMOTE_SONIC_BOOM'); + +-- -1 556 000 SETHEKK HALLS +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1556000,'I have pets....of my own!',10502,1,0,'syth SAY_SUMMON'), +(-1556001,'Hrrmm.. Time to.. hrrm.. make my move.',10503,1,0,'syth SAY_AGGRO_1'), +(-1556002,'Nice pets..hrm.. Yes! ',10504,1,0,'syth SAY_AGGRO_2'), +(-1556003,'Nice pets have.. weapons. No so....nice.',10505,1,0,'syth SAY_AGGRO_3'), +(-1556004,'Death.. meeting life is.. ',10506,1,0,'syth SAY_SLAY_1'), +(-1556005,'Uhn.. Be free..',10507,1,0,'syth SAY_SLAY_2'), +(-1556006,'No more life..hrm. No more pain. ',10508,1,0,'syth SAY_DEATH'), + +(-1556007,'..Trinkets yes pretty Trinkets....power, great power...power in Trinkets..',10557,1,0,'ikiss SAY_INTRO'), +(-1556008,'You make war on Ikiss?..',10554,1,0,'ikiss SAY_AGGRO_1'), +(-1556009,'Ikiss cut you pretty....slice you. Yes!',10555,1,0,'ikiss SAY_AGGRO_2'), +(-1556010,'No escape for....for you',10556,1,0,'ikiss SAY_AGGRO_3'), +(-1556011,'You die....stay away from Trinkets',10558,1,0,'ikiss SAY_SLAY_1'), +(-1556012,'',10559,1,0,'ikiss SAY_SLAY_2'), +(-1556013,'Ikiss will not....die',10560,1,0,'ikiss SAY_DEATH'), +(-1556015,'begins to channel arcane energy...',0,3,0,'ikiss EMOTE_ARCANE_EXP'); + +-- -1 557 000 MANA TOMBS +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1557000,'What is this? You must forgive me, but I was not expecting company. As you can see, we are somewhat preoccupied right now. But no matter. As I am a gracious host, I will tend to you... personally.',10539,1,0,'shaffar SAY_INTRO'), +(-1557001,'We have not yet been properly introduced.',10541,1,0,'shaffar SAY_AGGRO_1'), +(-1557002,'An epic battle. How exciting!',10542,1,0,'shaffar SAY_AGGRO_2'), +(-1557003,'I have longed for a good adventure.',10543,1,0,'shaffar SAY_AGGRO_3'), +(-1557004,'It has been... entertaining.',10544,1,0,'shaffar SAY_SLAY_1'), +(-1557005,'And now we part company.',10545,1,0,'shaffar SAY_SLAY_2'), +(-1557006,'I have such fascinating things to show you.',10540,1,0,'shaffar SAY_SUMMON'), +(-1557007,'I must bid you... farewell.',10546,1,0,'shaffar SAY_DEAD'), + +(-1557008,'I will feed on your soul.',10561,1,0,'pandemonius SAY_AGGRO_1'), +(-1557009,'So... full of life!',10562,1,0,'pandemonius SAY_AGGRO_2'), +(-1557010,'Do not... resist.',10563,1,0,'pandemonius SAY_AGGRO_3'), +(-1557011,'Yes! I am... empowered!',10564,1,0,'pandemonius SAY_KILL_1'), +(-1557012,'More... I must have more!',10565,1,0,'pandemonius SAY_KILL_2'), +(-1557013,'To the void... once... more..',10566,1,0,'pandemonius SAY_DEATH'), +(-1557014,'shifts into the void...',0,3,0,'pandemonius EMOTE_DARK_SHELL'); + +-- -1 558 000 AUCHENAI CRYPTS +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1558000,'You have defiled the resting place of our ancestors. For this offense, there can be but one punishment. It is fitting that you have come to a place of the dead... for you will soon be joining them.',10509,1,0,'maladaar SAY_INTRO'), +(-1558001,'Rise my fallen brothers. Take form and fight!',10512,1,0,'maladaar SAY_SUMMON'), +(-1558002,'You will pay with your life!',10513,1,0,'maladaar SAY_AGGRO_1'), +(-1558003,'There\'s no turning back now!',10514,1,0,'maladaar SAY_AGGRO_2'), +(-1558004,'Serve your penitence!',10515,1,0,'maladaar SAY_AGGRO_3'), +(-1558005,'Let your mind be clouded.',10510,1,0,'maladaar SAY_ROAR'), +(-1558006,'Stare into the darkness of your soul.',10511,1,0,'maladaar SAY_SOUL_CLEAVE'), +(-1558007,'These walls will be your doom.',10516,1,0,'maladaar SAY_SLAY_1'), +(-1558008,' Now, you\'ll stay for eternity!',10517,1,0,'maladaar SAY_SLAY_2'), +(-1558009,'This is... where.. I belong...',10518,1,0,'maladaar SAY_DEATH'); + +-- -1 560 000 ESCAPE FROM DURNHOLDE (OLD HILLSBRAD) + +-- -1 564 000 BLACK TEMPLE + +-- -1 565 000 GRUUL'S LAIR + +-- -1 568 000 ZUL'AMAN + +-- -1 580 000 SUNWELL PLATEAU + +-- -1 585 000 MAGISTER'S TERRACE + + +-- +-- Below just for beautiful view in table, run at own desire +-- + +-- ALTER TABLE `script_texts` ORDER BY `entry` desc; diff --git a/sql/updates/2.4.3_old/1247_world.sql b/sql/updates/2.4.3_old/1247_world.sql new file mode 100644 index 0000000..2e9a708 --- /dev/null +++ b/sql/updates/2.4.3_old/1247_world.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_jump_a_tron' WHERE `entry` = 183146; diff --git a/sql/updates/2.4.3_old/1249_world.sql b/sql/updates/2.4.3_old/1249_world.sql new file mode 100644 index 0000000..6ce0e77 --- /dev/null +++ b/sql/updates/2.4.3_old/1249_world.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184421; diff --git a/sql/updates/2.4.3_old/125_world_scripts.sql b/sql/updates/2.4.3_old/125_world_scripts.sql new file mode 100644 index 0000000..ed16208 --- /dev/null +++ b/sql/updates/2.4.3_old/125_world_scripts.sql @@ -0,0 +1,5 @@ +update creature_template set speed='0.01', scriptname='mob_toxic_sporebat' WHERE entry=22140; +update creature_template SET scriptname='npc_overlord_morghor' WHERE entry=23139; +update creature_template SET scriptname='npc_lord_illidan_stormrage' WHERE entry=22083; +update creature_template SET scriptname='npc_yarzill_the_merc' WHERE entry=23141; +update quest_template SET StartScript=0 WHERE entry=11108; diff --git a/sql/updates/2.4.3_old/1261_world.sql b/sql/updates/2.4.3_old/1261_world.sql new file mode 100644 index 0000000..3f97153 --- /dev/null +++ b/sql/updates/2.4.3_old/1261_world.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `scriptname` = 'go_sacred_fire_of_life' WHERE `entry` = 175944; diff --git a/sql/updates/2.4.3_old/1265_world.sql b/sql/updates/2.4.3_old/1265_world.sql new file mode 100644 index 0000000..5b5b875 --- /dev/null +++ b/sql/updates/2.4.3_old/1265_world.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `scriptname`='go_skull_pile' WHERE `entry`=185913; diff --git a/sql/updates/2.4.3_old/1304_world.sql b/sql/updates/2.4.3_old/1304_world.sql new file mode 100644 index 0000000..afacec5 --- /dev/null +++ b/sql/updates/2.4.3_old/1304_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name` IN ('reload spell_linked_spell'); +INSERT INTO `command` VALUES +('reload spell_linked_spell','3','Usage: .reload spell_linked_spell\r\nReloads the spell_linked_spell DB table.'); diff --git a/sql/updates/2.4.3_old/133_world_scripts.sql b/sql/updates/2.4.3_old/133_world_scripts.sql new file mode 100644 index 0000000..6c14326 --- /dev/null +++ b/sql/updates/2.4.3_old/133_world_scripts.sql @@ -0,0 +1,80 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1469030 AND -1469000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1469000,'None of your kind should be here! You\'ve doomed only yourselves!',8286,1,0,'broodlord SAY_AGGRO'), +(-1469001,'Clever Mortals but I am not so easily lured away from my sanctum!',8287,1,0,'broodlord SAY_LEASH'), +(-1469002,'goes into a killing frenzy!',0,2,0,'chromaggus EMOTE_FRENZY'), +(-1469003,'flinches as its skin shimmers.',0,2,0,'chromaggus EMOTE_SHIMMER'), +(-1469004,'In this world where time is your enemy, it is my greatest ally. This grand game of life that you think you play in fact plays you. To that I say...',0,0,0,'victor_nefarius SAY_GAMESBEGIN_1'), +(-1469005,'Let the games begin!',8280,1,0,'victor_nefarius SAY_GAMESBEGIN_2'), +(-1469006,'Ah, the heroes. You are persistent, aren\'t you. Your allied attempted to match his power against mine, and had to pay the price. Now he shall serve me, by slaughtering you. Get up little red wyrm and destroy them!',8279,1,0,'victor_nefarius SAY_VAEL_INTRO'), +(-1469007,'Well done, my minions. The mortals\' courage begins to wane! Now, let\'s see how they contend with the true Lord of Blackrock Spire!',8288,1,0,'nefarian SAY_AGGRO'), +(-1469008,'Enough! Now you vermin shall feel the force of my birthright, the fury of the earth itself.',8289,1,0,'nefarian SAY_XHEALTH'), +(-1469009,'Burn, you wretches! Burn!',8290,1,0,'nefarian SAY_SHADOWFLAME'), +(-1469010,'Impossible! Rise my minions! Serve your master once more!',8291,1,0,'nefarian SAY_RAISE_SKELETONS'), +(-1469011,'Worthless $N! Your friends will join you soon enough!',8293,1,0,'nefarian SAY_SLAY'), +(-1469012,'This cannot be! I am the Master here! You mortals are nothing to my kind! DO YOU HEAR? NOTHING!',8292,1,0,'nefarian SAY_DEATH'), +(-1469013,'Mages too? You should be more careful when you play with magic...',0,1,0,'nefarian SAY_MAGE'), +(-1469014,'Warriors, I know you can hit harder than that! Let\'s see it!',0,1,0,'nefarian SAY_WARRIOR'), +(-1469015,'Druids and your silly shapeshifting. Let\'s see it in action!',0,1,0,'nefarian SAY_DRUID'), +(-1469016,'Priests! If you\'re going to keep healing like that, we might as well make it a little more interesting!',0,1,0,'nefarian SAY_PRIEST'), +(-1469017,'Paladins, I\'ve heard you have many lives. Show me.',0,1,0,'nefarian SAY_PALADIN'), +(-1469018,'Shamans, show me what your totems can do!',0,1,0,'nefarian SAY_SHAMAN'), +(-1469019,'Warlocks, you shouldn\'t be playing with magic you don\'t understand. See what happens?',0,1,0,'nefarian SAY_WARLOCK'), +(-1469020,'Hunters and your annoying pea-shooters!',0,1,0,'nefarian SAY_HUNTER'), +(-1469021,'Rogues? Stop hiding and face me!',0,1,0,'nefarian SAY_ROGUE'), +(-1469022,'You\'ll pay for forcing me to do this.',8275,1,0,'razorgore SAY_EGGS_BROKEN1'), +(-1469023,'Fools! These eggs are more precious than you know.',8276,1,0,'razorgore SAY_EGGS_BROKEN2'), +(-1469024,'No! Not another one! I\'ll have your heads for this atrocity.',8277,1,0,'razorgore SAY_EGGS_BROKEN3'), +(-1469025,'If I fall into the abyss I\'ll take all of you mortals with me...',8278,1,0,'razorgore SAY_DEATH'), +(-1469026,'Too late...friends. Nefarius\' corruption has taken hold. I cannot...control myself.',8281,1,0,'vaelastrasz SAY_LINE1'), +(-1469027,'I beg you Mortals, flee! Flee before I lose all control. The Black Fire rages within my heart. I must release it!',8282,1,0,'vaelastrasz SAY_LINE2'), +(-1469028,'FLAME! DEATH! DESTRUCTION! COWER MORTALS BEFORE THE WRATH OF LORD....NO! I MUST FIGHT THIS!',8283,1,0,'vaelastrasz SAY_LINE3'), +(-1469029,'Nefarius\' hate has made me stronger than ever before. You should have fled, while you could, mortals! The fury of Blackrock courses through my veins!',8285,1,0,'vaelastrasz SAY_HALFLIFE'), +(-1469030,'Forgive me $N, your death only adds to my failure.',8284,1,0,'vaelastrasz SAY_KILLTARGET'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1269017 AND -1269000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1269000,'Why do you persist? Surely you can see the futility of it all. It is not too late! You may still leave with your lives ...',10442,1,0,'temporus SAY_ENTER'), +(-1269001,'So be it ... you have been warned.',10444,1,0,'temporus SAY_AGGRO'), +(-1269002,'Time... sands of time is run out for you.',10443,1,0,'temporus SAY_BANISH'), +(-1269003,'You should have left when you had the chance.',10445,1,0,'temporus SAY_SLAY1'), +(-1269004,'Your days are done.',10446,1,0,'temporus SAY_SLAY2'), +(-1269005,'My death means ... little.',10447,1,0,'temporus SAY_DEATH'), +(-1269006,'Why do you aid the Magus? Just think of how many lives could be saved if the portal is never opened, if the resulting wars could be erased ...',10412,1,0,'chrono_lord_deja SAY_ENTER'), +(-1269007,'If you will not cease this foolish quest, then you will die!',10414,1,0,'chrono_lord_deja SAY_AGGRO'), +(-1269008,'You have outstayed your welcome, Timekeeper. Begone!',10413,1,0,'chrono_lord_deja SAY_BANISH'), +(-1269009,'I told you it was a fool\'s quest!',10415,1,0,'chrono_lord_deja SAY_SLAY1'), +(-1269010,'Leaving so soon?',10416,1,0,'chrono_lord_deja SAY_SLAY2'), +(-1269011,'Time ... is on our side.',10417,1,0,'chrono_lord_deja SAY_DEATH'), +(-1269012,'The time has come to shatter this clockwork universe forever! Let us no longer be slaves of the hourglass! I warn you: those who do not embrace the greater path shall become victims of its passing!',10400,1,0,'aeonus SAY_ENTER'), +(-1269013,'Let us see what fate lays in store...',10402,1,0,'aeonus SAY_AGGRO'), +(-1269014,'Your time is up, slave of the past!',10401,1,0,'aeonus SAY_BANISH'), +(-1269015,'One less obstacle in our way!',10403,1,0,'aeonus SAY_SLAY1'), +(-1269016,'No one can stop us! No one!',10404,1,0,'aeonus SAY_SLAY2'), +(-1269017,'It is only a matter...of time.',10405,1,0,'aeonus SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1560022 AND -1560000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1560000,'Thrall! You didn\'t really think you would escape did you? You and your allies shall answer to Blackmoore - after I\'ve had my fun!',10406,1,0,'skarloc SAY_ENTER'), +(-1560001,'You\'re a slave. That\'s all you\'ll ever be.',10407,1,0,'skarloc SAY_TAUNT1'), +(-1560002,'I don\'t know what Blackmoore sees in you. For my money, you\'re just another ignorant savage!',10408,1,0,'skarloc SAY_TAUNT2'), +(-1560003,'Thrall will never be free!',10409,1,0,'skarloc SAY_SLAY1'), +(-1560004,'Did you really think you would leave here alive?',10410,1,0,'skarloc SAY_SLAY2'), +(-1560005,'Guards! Urgh..Guards..!',10411,1,0,'skarloc SAY_DEATH'), +(-1560006,'You there, fetch water quickly! Get these flames out before they spread to the rest of the keep! Hurry, damn you!',10428,1,0,'lieutenant_drake SAY_ENTER'), +(-1560007,'I know what you\'re up to, and I mean to put an end to it, permanently!',10429,1,0,'lieutenant_drake SAY_AGGRO'), +(-1560008,'No more middling for you.',10432,1,0,'lieutenant_drake SAY_SLAY1'), +(-1560009,'You will not interfere!',10433,1,0,'lieutenant_drake SAY_SLAY2'), +(-1560010,'Time to bleed!',10430,1,0,'lieutenant_drake SAY_MORTAL'), +(-1560011,'Run, you blasted cowards!',10431,1,0,'lieutenant_drake SAY_SHOUT'), +(-1560012,'Thrall... must not... go free.',10434,1,0,'lieutenant_drake SAY_DEATH'), +(-1560013,'Thrall! Come outside and face your fate!',10418,1,0,'epoch SAY_ENTER1'), +(-1560014,'Taretha\'s life hangs in the balance. Surely you care for her. Surely you wish to save her...',10419,1,0,'epoch SAY_ENTER2'), +(-1560015,'Ah, there you are. I had hoped to accomplish this with a bit of subtlety, but I suppose direct confrontation was inevitable. Your future, Thrall, must not come to pass and so...you and your troublesome friends must die!',10420,1,0,'epoch SAY_ENTER3'), +(-1560016,'Enough! I will erase your very existence!',10421,1,0,'epoch SAY_AGGRO1'), +(-1560017,'You cannot fight fate!',10422,1,0,'epoch SAY_AGGRO2'), +(-1560018,'You are...irrelevant.',10425,1,0,'epoch SAY_SLAY1'), +(-1560019,'Thrall will remain a slave. Taretha will die. You have failed.',10426,1,0,'epoch SAY_SLAY2'), +(-1560020,'Not so fast!',10423,1,0,'epoch SAY_BREATH1'), +(-1560021,'Struggle as much as you like!',10424,1,0,'epoch SAY_BREATH2'), +(-1560022,'No!...The master... will not... be pleased.',10427,1,0,'epoch SAY_DEATH'); diff --git a/sql/updates/2.4.3_old/140_world.sql b/sql/updates/2.4.3_old/140_world.sql new file mode 100644 index 0000000..c72f82c --- /dev/null +++ b/sql/updates/2.4.3_old/140_world.sql @@ -0,0 +1,21 @@ +DELETE FROM command WHERE name IN ('npc follow','npc unfollow','waterwalk','repairitems'); + +INSERT INTO command VALUES +('repairitems',2,'Syntax: .repairitems\r\n\r\nRepair all selected player''s items.'), +('npc follow',2,'Syntax: .npc follow\r\n\r\nSelected creature start follow you until death/fight/etc.'), +('npc unfollow',2,'Syntax: .npc unfollow\r\n\r\nSelected creature (non pet) stop follow you.'), +('waterwalk',2,'Syntax: .waterwalk on/off\r\n\r\nSet on/off waterwalk state for selected player or self if no player selected.'); + +DELETE FROM trinity_string WHERE entry IN (171,172,336,337,338,339,340,341,342,5007,5008); + +INSERT INTO trinity_string VALUES +(172,'server console command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(336,'You repair all %s''s items.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(337,'All your items repaired by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(338,'You set waterwalk mode %s for %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(339,'Your waterwalk mode set to %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(340,'%s is now following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(341,'%s is not following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(342,'%s is now not following you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(810,'You must be in a raid group to enter the instance %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(811,'You cannot enter %s while in a ghost mode!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/2.4.3_old/1437_world_scripts.sql b/sql/updates/2.4.3_old/1437_world_scripts.sql new file mode 100644 index 0000000..cbc84d3 --- /dev/null +++ b/sql/updates/2.4.3_old/1437_world_scripts.sql @@ -0,0 +1,14 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184418 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184419 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184420 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184421 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184422 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184423 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184424 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184425 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184426 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184427 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184428 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184429 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184430 LIMIT 1; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` = 184431 LIMIT 1; diff --git a/sql/updates/2.4.3_old/145_world_scripts.sql b/sql/updates/2.4.3_old/145_world_scripts.sql new file mode 100644 index 0000000..7045d2f --- /dev/null +++ b/sql/updates/2.4.3_old/145_world_scripts.sql @@ -0,0 +1,27 @@ +DELETE FROM gameobject_template WHERE `entry` IN (187578, 188173); +INSERT INTO gameobject_template () VALUES (187578, 10, 4891, 'Scrying Orb', '', 0, 0, 2.16851, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'go_movie_orb'); +INSERT INTO gameobject_template () VALUES (188173, 10, 7161, 'Escape to the Isle of Quel\'Danas', '', 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'go_kael_orb'); + +DELETE FROM spell_script_target WHERE `entry` IN (44320, 44321); +INSERT INTO spell_script_target () VALUES (44320, 1, 24723); +INSERT INTO spell_script_target () VALUES (44321, 1, 24723); + +UPDATE creature_template SET modelid_A = '17612' WHERE entry = '24745'; +UPDATE creature_template SET modelid_H = '17612' WHERE entry = '24745'; + +UPDATE `creature_template` SET `minhealth` = '6900' WHERE `entry` = 24675; +UPDATE `creature_template` SET `maxhealth` = '6900' WHERE `entry` = 24675; + +UPDATE `creature_template` SET `minlevel` = '70' WHERE `entry` = 24708; +UPDATE `creature_template` SET `maxlevel` = '70' WHERE `entry` = 24708; + +UPDATE `creature_template` SET `minlevel` = '70' WHERE `entry` = 24666; +UPDATE `creature_template` SET `maxlevel` = '70' WHERE `entry` = 24666; + +UPDATE `creature_template` SET `scale` = '0.5' WHERE `entry` = 24708; + +UPDATE `gameobject_template` SET `ScriptName` = 'go_kael_orb' WHERE `entry` = 188173; +UPDATE `gameobject_template` SET `ScriptName` = 'go_movie_orb' WHERE `entry` = 187578; + +update creature_template SET spell1=6474 WHERE entry=22487; +update creature_template SET spell1=3600 WHERE entry=22486; diff --git a/sql/updates/2.4.3_old/146_world.sql b/sql/updates/2.4.3_old/146_world.sql new file mode 100644 index 0000000..f0ed61a --- /dev/null +++ b/sql/updates/2.4.3_old/146_world.sql @@ -0,0 +1,93 @@ +DROP TABLE IF EXISTS `spell_linked_spell`; +CREATE TABLE `spell_linked_spell` ( + `spell_trigger` int(10) NOT NULL, + `spell_effect` int(10) NOT NULL default '0', + `type` smallint(3) unsigned NOT NULL default '0', + `comment` text NOT NULL, + PRIMARY KEY (`spell_trigger`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (44008, 45265, 1, 'Static Disruption Visual'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (-30410, 44032, 0, 'Manticron Cube Mind Exhaustion'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45661, 45665, 1, 'Encapsulate\r\n'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (40604, 40616, 1, 'Fel Rage Aura'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (40616, 41625, 1, 'Fel Rage Aura'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (41292, 42017, 1, 'Aura of Suffering'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (-41292, -42017, 0, 'Aura of Suffering'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45347, -45348, 1, 'Remove Flame Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45348, -45347, 1, 'Remove Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45248, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45329, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45256, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45270, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45342, 45348, 1, 'Apply Flame Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (46771, 45348, 1, 'Apply Flame Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45271, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45246, 45348, 1, 'Apply Flame Touched'); diff --git a/sql/updates/2.4.3_old/147_world.sql b/sql/updates/2.4.3_old/147_world.sql new file mode 100644 index 0000000..714cba8 --- /dev/null +++ b/sql/updates/2.4.3_old/147_world.sql @@ -0,0 +1,3 @@ +-- Magtheridon Earthquake +DELETE FROM spell_script_target WHERE `entry` IN (30657); +INSERT INTO spell_script_target VALUES ('30657', '1', '24136'); diff --git a/sql/updates/2.4.3_old/152_world.sql b/sql/updates/2.4.3_old/152_world.sql new file mode 100644 index 0000000..3329064 --- /dev/null +++ b/sql/updates/2.4.3_old/152_world.sql @@ -0,0 +1,8 @@ +delete from `spell_linked_spell` where `spell_trigger` in ('15237','15430','15431','27799','27800','27801','25331'); +insert into `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) values('15237','23455','0','Holy Nova (rank1)'); +insert into `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) values('15430','23458','0','Holy Nova (rank2)'); +insert into `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) values('15431','23459','0','Holy Nova (rank3)'); +insert into `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) values('27799','27803','0','Holy Nova (rank4)'); +insert into `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) values('27800','27804','0','Holy Nova (rank5)'); +insert into `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) values('27801','27805','0','Holy Nova (rank6)'); +insert into `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) values('25331','25329','0','Holy Nova (rank7)'); diff --git a/sql/updates/2.4.3_old/153_world.sql b/sql/updates/2.4.3_old/153_world.sql new file mode 100644 index 0000000..d34320f --- /dev/null +++ b/sql/updates/2.4.3_old/153_world.sql @@ -0,0 +1 @@ +update creature_template set flags_extra = 128 where entry = 12999; diff --git a/sql/updates/2.4.3_old/171_world.sql b/sql/updates/2.4.3_old/171_world.sql new file mode 100644 index 0000000..520c214 --- /dev/null +++ b/sql/updates/2.4.3_old/171_world.sql @@ -0,0 +1,17 @@ +DELETE FROM trinity_string WHERE entry IN (57,58,5009); + +INSERT INTO trinity_string VALUES +(57,'Using World DB: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(58,'Using script library: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5009,'Sound %u Played to server',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + + +DELETE FROM `command` WHERE name IN ('pet create','pet learn','pet unlearn','pet tp','gobject activate','playall'); +INSERT INTO `command` (name,security,help) VALUES +('pet create',2,'Syntax: .pet create\r\n\r\nCreates a pet of the selected creature.'), +('pet learn',2,'Syntax: .pet learn\r\n\r\nLearn #spellid to pet.'), +('pet unlearn',2,'Syntax: .pet unlean\r\n\r\nunLearn #spellid to pet.'), +('pet tp',2,'Syntax: .pet tp #\r\n\r\nChange pet\'s amount of training points.'), +('modify gender',2,'Syntax: .modify gender\r\n\r\n.modify gender #male/female - Turns selected player into a male or female'), +('gobject activate',2,'Syntax: .gobject activate #guid\r\n\r\nActivates an object like a door or a button.'), +('playall',2,'Syntax: .playall #soundid\r\n\r\nPlayer a sound to whole server.'); diff --git a/sql/updates/2.4.3_old/172_world_scripts.sql b/sql/updates/2.4.3_old/172_world_scripts.sql new file mode 100644 index 0000000..358afe5 --- /dev/null +++ b/sql/updates/2.4.3_old/172_world_scripts.sql @@ -0,0 +1,778 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1548055 AND -1548000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1548000,'I cannot allow you to interfere!',11289,1,0,'hydross SAY_AGGRO'), +(-1548001,'Better, much better.',11290,1,0,'hydross SAY_SWITCH_TO_CLEAN'), +(-1548002,'They have forced me to this...',11291,1,0,'hydross SAY_CLEAN_SLAY1'), +(-1548003,'I have no choice.',11292,1,0,'hydross SAY_CLEAN_SLAY2'), +(-1548004,'I am... released...',11293,1,0,'hydross SAY_CLEAN_DEATH'), +(-1548005,'Aaghh, the poison...',11297,1,0,'hydross SAY_SWITCH_TO_CORRUPT'), +(-1548006,'I will purge you from this place.',11298,1,0,'hydross SAY_CORRUPT_SLAY1'), +(-1548007,'You are no better than they!',11299,1,0,'hydross SAY_CORRUPT_SLAY2'), +(-1548008,'You are the disease, not I',11300,1,0,'hydross SAY_CORRUPT_DEATH'), +(-1548009,'Finally my banishment ends!',11312,1,0,'leotheras SAY_AGGRO'), +(-1548010,'Be gone trifling elf. I\'m in control now.',11304,1,0,'leotheras SAY_SWITCH_TO_DEMON'), +(-1548011,'We all have our demons...',11305,1,0,'leotheras SAY_INNER_DEMONS'), +(-1548012,'I have no equal.',11306,1,0,'leotheras SAY_DEMON_SLAY1'), +(-1548013,'Perish, mortal.',11307,1,0,'leotheras SAY_DEMON_SLAY2'), +(-1548014,'Yes, YES! Ahahah!',11308,1,0,'leotheras SAY_DEMON_SLAY3'), +(-1548015,'Kill! KILL!',11314,1,0,'leotheras SAY_NIGHTELF_SLAY1'), +(-1548016,'That\'s right! Yes!',11315,1,0,'leotheras SAY_NIGHTELF_SLAY2'), +(-1548017,'Who\'s the master now?',11316,1,0,'leotheras SAY_NIGHTELF_SLAY3'), +(-1548018,'No! NO! What have you done?! I am the master, do you hear me? I... aaghh... Can\'t... contain him...',11313,1,0,'leotheras SAY_FINAL_FORM'), +(-1548019,'At last I am liberated. It has been too long since I have tasted true freedom!',11309,1,0,'leotheras SAY_FREE'), +(-1548020,'You cannot kill me! Fools, I\'ll be back! I\'ll... aarghh...',11317,1,0,'leotheras SAY_DEATH'), +(-1548021,'Guards, attention! We have visitors...',11277,1,0,'karathress SAY_AGGRO'), +(-1548022,'Your overconfidence will be your undoing! Guards, lend me your strength!',11278,1,0,'karathress SAY_GAIN_BLESSING'), +(-1548023,'Go on, kill them! I\'ll be the better for it!',11279,1,0,'karathress SAY_GAIN_ABILITY1'), +(-1548024,'I am more powerful than ever!',11280,1,0,'karathress SAY_GAIN_ABILITY2'), +(-1548025,'More knowledge, more power!',11281,1,0,'karathress SAY_GAIN_ABILITY3'), +(-1548026,'Land-dwelling scum!',11282,1,0,'karathress SAY_SLAY1'), +(-1548027,'Alana be\'lendor!',11283,1,0,'karathress SAY_SLAY2'), +(-1548028,'I am rid of you.',11284,1,0,'karathress SAY_SLAY3'), +(-1548029,'Her ... excellency ... awaits!',11285,1,0,'karathress SAY_DEATH'), +(-1548030,'Flood of the deep, take you!',11321,1,0,'morogrim SAY_AGGRO'), +(-1548031,'By the Tides, kill them at once!',11322,1,0,'morogrim SAY_SUMMON1'), +(-1548032,'Destroy them my subjects!',11323,1,0,'morogrim SAY_SUMMON2'), +(-1548033,'There is nowhere to hide!',11324,1,0,'morogrim SAY_SUMMON_BUBL1'), +(-1548034,'Soon it will be finished!',11325,1,0,'morogrim SAY_SUMMON_BUBL2'), +(-1548035,'It is done!',11326,1,0,'morogrim SAY_SLAY1'), +(-1548036,'Strugging only makes it worse.',11327,1,0,'morogrim SAY_SLAY2'), +(-1548037,'Only the strong survive.',11328,1,0,'morogrim SAY_SLAY3'), +(-1548038,'Great... currents of... Ageon.',11329,1,0,'morogrim SAY_DEATH'), +(-1548039,'sends his enemies to their watery graves!',0,2,0,'morogrim EMOTE_WATERY_GRAVE'), +(-1548040,'The violent earthquake has alerted nearby murlocs!',0,3,0,'morogrim EMOTE_EARTHQUAKE'), +(-1548041,'summons Watery Globules!',0,2,0,'morogrim EMOTE_WATERY_GLOBULES'), +(-1548042,'Water is life. It has become a rare commodity here in Outland. A commodity that we alone shall control. We are the Highborne, and the time has come at last for us to retake our rightful place in the world!',11531,1,0,'vashj SAY_INTRO'), +(-1548043,'I\'ll split you from stem to stern!',11532,1,0,'vashj SAY_AGGRO1'), +(-1548044,'Victory to Lord Illidan!',11533,1,0,'vashj SAY_AGGRO2'), +(-1548045,'I spit on you, surface filth!',11534,1,0,'vashj SAY_AGGRO3'), +(-1548046,'Death to the outsiders!',11535,1,0,'vashj SAY_AGGRO4'), +(-1548047,'I did not wish to lower myself by engaging your kind, but you leave me little choice!',11538,1,0,'vashj SAY_PHASE1'), +(-1548048,'The time is now! Leave none standing!',11539,1,0,'vashj SAY_PHASE2'), +(-1548049,'You may want to take cover.',11540,1,0,'vashj SAY_PHASE3'), +(-1548050,'Straight to the heart!',11536,1,0,'vashj SAY_BOWSHOT1'), +(-1548051,'Seek your mark!',11537,1,0,'vashj SAY_BOWSHOT2'), +(-1548052,'Your time ends now!',11541,1,0,'vashj SAY_SLAY1'), +(-1548053,'You have failed!',11542,1,0,'vashj SAY_SLAY2'), +(-1548054,'Be\'lamere an\'delay',11543,1,0,'vashj SAY_SLAY3'), +(-1548055,'Lord Illidan, I... I am... sorry.',11544,1,0,'vashj SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1545023 AND -1545000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1545000,'Surge forth my pets!',10360,1,0,'thespia SAY_SUMMON'), +(-1545001,'The depths will consume you!',10361,1,0,'thespia SAY_AGGRO_1'), +(-1545002,'Meet your doom, surface dwellers!',10362,1,0,'thespia SAY_AGGRO_2'), +(-1545003,'You will drown in blood!',10363,1,0,'thespia SAY_AGGRO_3'), +(-1545004,'To the depths of oblivion with you!',10364,1,0,'thespia SAY_SLAY_1'), +(-1545005,'For my lady and master!',10365,1,0,'thespia SAY_SLAY_2'), +(-1545006,'Our matron will be.. the end of.. you..',10366,1,0,'thespia SAY_DEAD'), +(-1545007,'I\'m bringin\' the pain!',10367,1,0,'mekgineer SAY_MECHANICS'), +(-1545008,'You\'re in for a world of hurt!',10368,1,0,'mekgineer SAY_AGGRO_1'), +(-1545009,'Eat hot metal, scumbag!',10369,1,0,'mekgineer SAY_AGGRO_2'), +(-1545010,'I\'ll come over there!',10370,1,0,'mekgineer SAY_AGGRO_3'), +(-1545011,'I\'m bringin\' the pain!',10371,1,0,'mekgineer SAY_AGGRO_4'), +(-1545012,'You just got served, punk!',10372,1,0,'mekgineer SOUND_SLAY_1'), +(-1545013,'I own you!',10373,1,0,'mekgineer SOUND_SLAY_2'), +(-1545014,'Have fun dyin\', cupcake!',10374,1,0,'mekgineer SOUND_SLAY_3'), +(-1545015,'Mommy!',10375,1,0,'mekgineer SAY_DEATH'), +(-1545016,'You deem yourselves worthy simply because you bested my guards? Our work here will not be compromised!',10390,1,0,'kalithresh SAY_INTRO'), +(-1545017,'This is not nearly over...',10391,1,0,'kalithresh SAY_REGEN'), +(-1545018,'Your head will roll!',10392,1,0,'kalithresh SAY_AGGRO1'), +(-1545019,'I despise all of your kind!',10393,1,0,'kalithresh SAY_AGGRO2'), +(-1545020,'Ba\'ahntha sol\'dorei!',10394,1,0,'kalithresh SAY_AGGRO3'), +(-1545021,'Scram, surface filth!',10395,1,0,'kalithresh SAY_SLAY1'), +(-1545022,'Ah ha ha ha ha ha ha!',10396,1,0,'kalithresh SAY_SLAY2'), +(-1545023,'For her Excellency... for... Vashj!',10397,1,0,'kalithresh SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1540041 AND -1540000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1540000,'You wish to fight us all at once? This should be amusing!',10262,1,0,'nethekurse SAY_INTRO'), +(-1540001,'You can have that one. I no longer need him.',10263,1,0,'nethekurse PEON_ATTACK_1'), +(-1540002,'Yes, beat him mercilessly. His skull is a thick as an ogres.',10264,1,0,'nethekurse PEON_ATTACK_2'), +(-1540003,'Don\'t waste your time on that one. He\'s weak!',10265,1,0,'nethekurse PEON_ATTACK_3'), +(-1540004,'You want him? Very well, take him!',10266,1,0,'nethekurse PEON_ATTACK_4'), +(-1540005,'One pitiful wretch down. Go on, take another one.',10267,1,0,'nethekurse PEON_DIE_1'), +(-1540006,'Ahh, what a waste... Next!',10268,1,0,'nethekurse PEON_DIE_2'), +(-1540007,'I was going to kill him anyway!',10269,1,0,'nethekurse PEON_DIE_3'), +(-1540008,'Thank you for saving me the trouble! Now it\'s my turn to have some fun...',10270,1,0,'nethekurse PEON_DIE_4'), +(-1540009,'Beg for your pittyfull life!',10259,1,0,'nethekurse SAY_TAUNT_1'), +(-1540010,'Run covad, ruun!',10260,1,0,'nethekurse SAY_TAUNT_2'), +(-1540011,'Your pain amuses me.',10261,1,0,'nethekurse SAY_TAUNT_3'), +(-1540012,'I\'m already bored.',10271,1,0,'nethekurse SAY_AGGRO_1'), +(-1540013,'Come on! ... Show me a real fight.',10272,1,0,'nethekurse SAY_AGGRO_2'), +(-1540014,'I had more fun torturing the peons.',10273,1,0,'nethekurse SAY_AGGRO_3'), +(-1540015,'You Loose.',10274,1,0,'nethekurse SAY_SLAY_1'), +(-1540016,'Ohh! Just die.',10275,1,0,'nethekurse SAY_SLAY_2'), +(-1540017,'What a ... a shame.',10276,1,0,'nethekurse SAY_DIE'), +(-1540018,'Smash!',10306,1,0,'omrogg GoCombat_1'), +(-1540019,'If you nice me let you live.',10308,1,0,'omrogg GoCombat_2'), +(-1540020,'Me hungry!',10309,1,0,'omrogg GoCombat_3'), +(-1540021,'Why don\'t you let me do the talking?',10317,1,0,'omrogg GoCombatDelay_1'), +(-1540022,'No, we will NOT let you live!',10318,1,0,'omrogg GoCombatDelay_2'), +(-1540023,'You always hungry. That why we so fat!',10319,1,0,'omrogg GoCombatDelay_3'), +(-1540024,'You stay here. Me go kill someone else!',10303,1,0,'omrogg Threat_1'), +(-1540025,'What are you doing!',10315,1,0,'omrogg Threat_2'), +(-1540026,'Me kill someone else...',10302,1,0,'omrogg Threat_3'), +(-1540027,'Me not like this one...',10300,1,0,'omrogg Threat_4'), +(-1540028,'That\'s not funny!',10314,1,0,'omrogg ThreatDelay1_1'), +(-1540029,'Me get bored...',10305,1,0,'omrogg ThreatDelay1_2'), +(-1540030,'I\'m not done yet, idiot!',10313,1,0,'omrogg ThreatDelay1_3'), +(-1540031,'Hey you numbskull!',10312,1,0,'omrogg ThreatDelay1_4'), +(-1540032,'Ha ha ha.',10304,1,0,'omrogg ThreatDelay2_1'), +(-1540033,'Whhy! He almost dead!',10316,1,0,'omrogg ThreatDelay2_2'), +(-1540034,'H\'ey...',10307,1,0,'omrogg ThreatDelay2_3'), +(-1540035,'We kill his friend!',10301,1,0,'omrogg ThreatDelay2_4'), +(-1540036,'This one die easy!',10310,1,0,'omrogg Killing_1'), +(-1540037,'I\'m tired. You kill next one!',10320,1,0,'omrogg Killing_2'), +(-1540038,'That\'s because I do all the hard work!',10321,1,0,'omrogg KillingDelay_1'), +(-1540039,'This all...your fault!',10311,1,0,'omrogg YELL_DIE_L'), +(-1540040,'I...hate...you...',10322,1,0,'omrogg YELL_DIE_R'), +(-1540041,'enrages',0,2,0,'omrogg EMOTE_ENRAGE'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1542014 AND -1542000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1542000,'Who dares interrupt... What is this? What have you done? You ruin everything!',10164,1,0,'kelidan SAY_WAKE'), +(-1542001,'You mustn\'t let him loose!',10166,1,0,'kelidan SAY_ADD_AGGRO_1'), +(-1542002,'Ignorant whelps!',10167,1,0,'kelidan SAY_ADD_AGGRO_2'), +(-1542003,'You fools! He\'ll kill us all!',10168,1,0,'kelidan SAY_ADD_AGGRO_3'), +(-1542004,'Just as you deserve!',10169,1,0,'kelidan SAY_KILL_1'), +(-1542005,'Your friends will soon be joining you.',10170,1,0,'kelidan SAY_KILL_2'), +(-1542006,'Closer... Come closer.. and burn!',10165,1,0,'kelidan SAY_NOVA'), +(-1542007,'Good luck... you\'ll need it..',10171,1,0,'kelidan SAY_DIE'), +(-1542008,'Come intruders....',0,1,0,'broggok SAY_AGGRO'), +(-1542009,'My work must not be interrupted.',10286,1,0,'the_maker SAY_AGGRO_1'), +(-1542010,'Perhaps I can find a use for you.',10287,1,0,'the_maker SAY_AGGRO_2'), +(-1542011,'Anger... Hate... These are tools I can use.',10288,1,0,'the_maker SAY_AGGRO_3'), +(-1542012,'Let\'s see what I can make of you.',10289,1,0,'the_maker SAY_KILL_1'), +(-1542013,'It is pointless to resist.',10290,1,0,'the_maker SAY_KILL_2'), +(-1542014,'Stay away from... me.',10291,1,0,'the_maker SAY_DIE'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1543016 AND -1543000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1543000,'Do you smell that? Fresh meat has somehow breached our citadel. Be wary of any intruders.',0,1,0,'gargolmar SAY_TAUNT'), +(-1543001,'Heal me! QUICKLY!',10329,1,0,'gargolmar SAY_HEAL'), +(-1543002,'Back off, pup!',10330,1,0,'gargolmar SAY_SURGE'), +(-1543003,'What have we here...?',10331,1,0,'gargolmar SAY_AGGRO_1'), +(-1543004,'Heh... this may hurt a little.',10332,1,0,'gargolmar SAY_AGGRO_2'), +(-1543005,'I\'m gonna enjoy this.',10333,1,0,'gargolmar SAY_AGGRO_3'), +(-1543006,'Say farewell!',10334,1,0,'gargolmar SAY_KILL_1'), +(-1543007,'Much too easy...',10335,1,0,'gargolmar SAY_KILL_2'), +(-1543008,'Hahah.. ..argh!',10336,1,0,'gargolmar SAY_DIE'), +(-1543009,'You dare stand against me?!',10280,1,0,'omor SAY_AGGRO_1'), +(-1543010,'I will not be defeated!',10279,1,0,'omor SAY_AGGRO_2'), +(-1543011,'Your insolence will be your death.',10281,1,0,'omor SAY_AGGRO_3'), +(-1543012,'Achor-she-ki! Feast my pet! Eat your fill!',10277,1,0,'omor SAY_SUMMON'), +(-1543013,'A-Kreesh!',10278,1,0,'omor SAY_CURSE'), +(-1543014,'Die, weakling!',10282,1,0,'omor SAY_KILL_1'), +(-1543015,'It is... not over.',10284,1,0,'omor SAY_DIE'), +(-1543016,'I am victorious!',10283,1,0,'omor SAY_WIPE'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1544014 AND -1544000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1544000,'Wretched, meddling insects. Release me and perhaps i will grant you a merciful death!',10247,1,0,'magtheridon SAY_TAUNT1'), +(-1544001,'Vermin! Leeches! Take my blood and choke on it!',10248,1,0,'magtheridon SAY_TAUNT2'), +(-1544002,'Illidan is an arrogant fool. I will crush him and reclaim Outland as my own.',10249,1,0,'magtheridon SAY_TAUNT3'), +(-1544003,'Away, you mindless parasites. My blood is my own!',10250,1,0,'magtheridon SAY_TAUNT4'), +(-1544004,'How long do you believe your pathetic sorcery can hold me?',10251,1,0,'magtheridon SAY_TAUNT5'), +(-1544005,'My blood will be the end of you!',10252,1,0,'magtheridon SAY_TAUNT6'), +(-1544006,'I...am...UNLEASHED!!!',10253,1,0,'magtheridon SAY_FREED'), +(-1544007,'Thank you for releasing me. Now...die!',10254,1,0,'magtheridon SAY_AGGRO'), +(-1544008,'Not again...NOT AGAIN!',10256,1,0,'magtheridon SAY_BANISH'), +(-1544009,'I will not be taken so easily. Let the walls of this prison tremble...and FALL!!!',10257,1,0,'magtheridon SAY_CHAMBER_DESTROY'), +(-1544010,'Did you think me weak? Soft? Who is the weak one now?!',10255,1,0,'magtheridon SAY_PLAYER_KILLED'), +(-1544011,'The Legion...will consume you...all...',10258,1,0,'magtheridon SAY_DEATH'), +(-1544012,'becomes enraged!',0,2,0,'magtheridon EMOTE_BERSERK'), +(-1544013,'begins to cast Blast Nova!',0,2,0,'magtheridon EMOTE_BLASTNOVA'), +(-1544014,'bonds begin to weaken!',0,2,0,'magtheridon EMOTE_BEGIN'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1565019 AND -1565000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1565000,'Gronn are the real power in outland.',11367,1,0,'maulgar SAY_AGGRO'), +(-1565001,'You will not defeat the hand of Gruul!',11368,1,0,'maulgar SAY_ENRAGE'), +(-1565002,'You won\'t kill next one so easy!',11369,1,0,'maulgar SAY_OGRE_DEATH1'), +(-1565003,'Pah! Does not prove anything!',11370,1,0,'maulgar SAY_OGRE_DEATH2'), +(-1565004,'I\'m not afraid of you.',11371,1,0,'maulgar SAY_OGRE_DEATH3'), +(-1565005,'Good, now you fight me!',11372,1,0,'maulgar SAY_OGRE_DEATH4'), +(-1565006,'You not so tough afterall!',11373,1,0,'maulgar SAY_SLAY1'), +(-1565007,'Aha-ha ha ha!',11374,1,0,'maulgar SAY_SLAY2'), +(-1565008,'Mulgar is king!',11375,1,0,'maulgar SAY_SLAY3'), +(-1565009,'Gruul... will crush you...',11376,1,0,'maulgar SAY_DEATH'), +(-1565010,'Come... and die.',11355,1,0,'gruul SAY_AGGRO'), +(-1565011,'Scurry',11356,1,0,'gruul SAY_SLAM1'), +(-1565012,'No escape',11357,1,0,'gruul SAY_SLAM2'), +(-1565013,'Stay',11358,1,0,'gruul SAY_SHATTER1'), +(-1565014,'Beg... for life',11359,1,0,'gruul SAY_SHATTER2'), +(-1565015,'No more',11360,1,0,'gruul SAY_SLAY1'), +(-1565016,'Unworthy',11361,1,0,'gruul SAY_SLAY2'), +(-1565017,'Die',11362,1,0,'gruul SAY_SLAY3'), +(-1565018,'Aaargh...',11363,1,0,'gruul SAY_DEATH'), +(-1565019,'grows in size!',0,2,0,'gruul EMOTE_GROW'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1532102 AND -1532000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1532000,'Well done Midnight!',9173,1,0,'attumen SAY_MIDNIGHT_KILL'), +(-1532001,'Cowards! Wretches!',9167,1,0,'attumen SAY_APPEAR1'), +(-1532002,'Who dares attack the steed of the Huntsman?',9298,1,0,'attumen SAY_APPEAR2'), +(-1532003,'Perhaps you would rather test yourselves against a more formidable opponent?!',9299,1,0,'attumen SAY_APPEAR3'), +(-1532004,'Come, Midnight, let\'s disperse this petty rabble!',9168,1,0,'attumen SAY_MOUNT'), +(-1532005,'It was... inevitable.',9169,1,0,'attumen SAY_KILL1'), +(-1532006,'Another trophy to add to my collection!',9300,1,0,'attumen SAY_KILL2'), +(-1532007,'Weapons are merely a convenience for a warrior of my skill!',9166,1,0,'attumen SAY_DISARMED'), +(-1532008,'I always knew... someday I would become... the hunted.',9165,1,0,'attumen SAY_DEATH'), +(-1532009,'Such easy sport.',9170,1,0,'attumen SAY_RANDOM1'), +(-1532010,'Amateurs! Do not think you can best me! I kill for a living.',9304,1,0,'attumen SAY_RANDOM2'), +(-1532011,'Hmm, unannounced visitors? Preparations must be made.',9211,1,0,'moroes SAY_AGGRO'), +(-1532012,'Now, where was I? Oh yes...',9215,1,0,'moroes SAY_SPECIAL_1'), +(-1532013,'You rang?',9316,1,0,'moroes SAY_SPECIAL_2'), +(-1532014,'One more for dinner this evening.',9214,1,0,'moroes SAY_KILL_1'), +(-1532015,'Time... Never enough time.',9314,1,0,'moroes SAY_KILL_2'), +(-1532016,'I\'ve gone and made a mess.',9315,1,0,'moroes SAY_KILL_3'), +(-1532017,'How terribly clumsy of me...',9213,1,0,'moroes SAY_DEATH'), +(-1532018,'Your behavior will not be tolerated!',9204,1,0,'maiden SAY_AGGRO'), +(-1532019,'Ah ah ah...',9207,1,0,'maiden SAY_SLAY1'), +(-1532020,'This is for the best.',9312,1,0,'maiden SAY_SLAY2'), +(-1532021,'Impure thoughts lead to profane actions.',9311,1,0,'maiden SAY_SLAY3'), +(-1532022,'Cast out your corrupt thoughts.',9313,1,0,'maiden SAY_REPENTANCE1'), +(-1532023,'Your impurity must be cleansed.',9208,1,0,'maiden SAY_REPENTANCE2'), +(-1532024,'Death comes. Will your conscience be clear?',9206,1,0,'maiden SAY_DEATH'), +(-1532025,'Oh at last, at last. I can go home.',9190,1,0,'dorothee SAY_DOROTHEE_DEATH'), +(-1532026,'Don\'t let them hurt us, Tito! Oh, you won\'t, will you?',9191,1,0,'dorothee SAY_DOROTHEE_SUMMON'), +(-1532027,'Tito, oh Tito, no!',9192,1,0,'dorothee SAY_DOROTHEE_TITO_DEATH'), +(-1532028,'Oh dear, we simply must find a way home! The old wizard could be our only hope! Strawman, Roar, Tinhead, will you... wait! Oh golly, look! We have visitors!',9195,1,0,'dorothee SAY_DOROTHEE_AGGRO'), +(-1532029,'Wanna fight? Huh? Do ya? C\'mon, I\'ll fight you with both claws behind my back!',9227,1,0,'roar SAY_ROAR_AGGRO'), +(-1532030,'You didn\'t have to go and do that.',9229,1,0,'roar SAY_ROAR_DEATH'), +(-1532031,'I think I\'m going to go take fourty winks.',9230,1,0,'roar SAY_ROAR_SLAY'), +(-1532032,'Now what should I do with you? I simply can\'t make up my mind.',9254,1,0,'strawman SAY_STRAWMAN_AGGRO'), +(-1532033,'Don\'t let them make a mattress... out of me.',9256,1,0,'strawman SAY_STRAWMAN_DEATH'), +(-1532034,'I guess I\'m not a failure after all.',9257,1,0,'strawman SAY_STRAWMAN_SLAY'), +(-1532035,'I could really use a heart. Say, can I have yours?',9268,1,0,'tinhead SAY_TINHEAD_AGGRO'), +(-1532036,'Back to being an old rustbucket.',9270,1,0,'tinhead SAY_TINHEAD_DEATH'), +(-1532037,'Guess I\'m not so rusty, after all.',9271,1,0,'tinhead SAY_TINHEAD_SLAY'), +(-1532038,'begins to rust.',0,2,0,'tinhead EMOTE_RUST'), +(-1532039,'Woe to each and every one of you my pretties! ',9179,1,0,'crone SAY_CRONE_AGGRO'), +(-1532040,'It will all be over soon! ',9307,1,0,'crone SAY_CRONE_AGGRO2'), +(-1532041,'How could you? What a cruel, cruel world!',9178,1,0,'crone SAY_CRONE_DEATH'), +(-1532042,'Fixed you, didn\'t I? ',9180,1,0,'crone SAY_CRONE_SLAY'), +(-1532043,'All the better to own you with!',9276,1,0,'wolf SAY_WOLF_AGGRO'), +(-1532044,'Mmmm... delicious.',9277,1,0,'wolf SAY_WOLF_SLAY'), +(-1532045,'Run away little girl, run away!',9278,1,0,'wolf SAY_WOLF_HOOD'), +(-1532046,'What devil art thou, that dost torment me thus?',9196,1,0,'julianne SAY_JULIANNE_AGGRO'), +(-1532047,'Where is my lord? Where is my Romulo?',9199,1,0,'julianne SAY_JULIANNE_ENTER'), +(-1532048,'Romulo, I come! Oh... this do I drink to thee!',9198,1,0,'julianne SAY_JULIANNE_DEATH01'), +(-1532049,'Where is my Lord? Where is my Romulo? Ohh, happy dagger! This is thy sheath! There rust, and let me die!',9310,1,0,'julianne SAY_JULIANNE_DEATH02'), +(-1532050,'Come, gentle night; and give me back my Romulo!',9200,1,0,'julianne SAY_JULIANNE_RESURRECT'), +(-1532051,'Parting is such sweet sorrow.',9201,1,0,'julianne SAY_JULIANNE_SLAY'), +(-1532052,'Wilt thou provoke me? Then have at thee, boy!',9233,1,0,'romulo SAY_ROMULO_AGGRO'), +(-1532053,'Thou smilest... upon the stroke that... murders me.',9235,1,0,'romulo SAY_ROMULO_DEATH'), +(-1532054,'This day\'s black fate on more days doth depend. This but begins the woe. Others must end.',9236,1,0,'romulo SAY_ROMULO_ENTER'), +(-1532055,'Thou detestable maw, thou womb of death; I enforce thy rotten jaws to open!',9237,1,0,'romulo SAY_ROMULO_RESURRECT'), +(-1532056,'How well my comfort is revived by this!',9238,1,0,'romulo SAY_ROMULO_SLAY'), +(-1532057,'The Menagerie is for guests only.',9183,1,0,'curator SAY_AGGRO'), +(-1532058,'Gallery rules will be strictly enforced.',9188,1,0,'curator SAY_SUMMON1'), +(-1532059,'This curator is equipped for gallery protection.',9309,1,0,'curator SAY_SUMMON2'), +(-1532060,'Your request cannot be processed.',9186,1,0,'curator SAY_EVOCATE'), +(-1532061,'Failure to comply will result in offensive action.',9185,1,0,'curator SAY_ENRAGE'), +(-1532062,'Do not touch the displays.',9187,1,0,'curator SAY_KILL1'), +(-1532063,'You are not a guest.',9308,1,0,'curator SAY_KILL2'), +(-1532064,'This Curator is no longer op... er... ation... al.',9184,1,0,'curator SAY_DEATH'), +(-1532065,'Your blood will anoint my circle.',9264,1,0,'terestian SAY_SLAY1'), +(-1532066,'The great one will be pleased.',9329,1,0,'terestian SAY_SLAY2'), +(-1532067,'My life, is yours. Oh great one.',9262,1,0,'terestian SAY_DEATH'), +(-1532068,'Ah, you\'re just in time. The rituals are about to begin.',9260,1,0,'terestian SAY_AGGRO'), +(-1532069,'Please, accept this humble offering, oh great one.',9263,1,0,'terestian SAY_SACRIFICE1'), +(-1532070,'Let the sacrifice serve his testament to my fealty.',9330,1,0,'terestian SAY_SACRIFICE2'), +(-1532071,'Come, you dwellers in the dark. Rally to my call!',9265,1,0,'terestian SAY_SUMMON1'), +(-1532072,'Gather, my pets. There is plenty for all.',9331,1,0,'terestian SAY_SUMMON2'), +(-1532073,'Please, no more. My son... he\'s gone mad!',9241,1,0,'aran SAY_AGGRO1'), +(-1532074,'I\'ll not be tortured again!',9323,1,0,'aran SAY_AGGRO2'), +(-1532075,'Who are you? What do you want? Stay away from me!',9324,1,0,'aran SAY_AGGRO3'), +(-1532076,'I\'ll show you this beaten dog still has some teeth!',9245,1,0,'aran SAY_FLAMEWREATH1'), +(-1532077,'Burn you hellish fiends!',9326,1,0,'aran SAY_FLAMEWREATH2'), +(-1532078,'I\'ll freeze you all!',9246,1,0,'aran SAY_BLIZZARD1'), +(-1532079,'Back to the cold dark with you!',9327,1,0,'aran SAY_BLIZZARD2'), +(-1532080,'Yes, yes, my son is quite powerful... but I have powers of my own!',9242,1,0,'aran SAY_EXPLOSION1'), +(-1532081,'I am not some simple jester! I am Nielas Aran!',9325,1,0,'aran SAY_EXPLOSION2'), +(-1532082,'Surely you would not deny an old man a replenishing drink? No, no I thought not.',9248,1,0,'aran SAY_DRINK'), +(-1532083,'I\'m not finished yet! No, I have a few more tricks up me sleeve.',9251,1,0,'aran SAY_ELEMENTALS'), +(-1532084,'I want this nightmare to be over!',9250,1,0,'aran SAY_KILL1'), +(-1532085,'Torment me no more!',9328,1,0,'aran SAY_KILL2'), +(-1532086,'You\'ve wasted enough of my time. Let these games be finished!',9247,1,0,'aran SAY_TIMEOVER'), +(-1532087,'At last... The nightmare is.. over...',9244,1,0,'aran SAY_DEATH'), +(-1532088,'Where did you get that?! Did HE send you?!',9249,1,0,'aran SAY_ATIESH'), +(-1532089,'cries out in withdrawal, opening gates to the warp.',0,2,0,'netherspite EMOTE_PHASE_PORTAL'), +(-1532090,'goes into a nether-fed rage!',0,2,0,'netherspite EMOTE_PHASE_BANISH'), +(-1532091,'Madness has brought you here to me. I shall be your undoing!',9218,1,0,'malchezaar SAY_AGGRO'), +(-1532092,'Simple fools! Time is the fire in which you\'ll burn!',9220,1,0,'malchezaar SAY_AXE_TOSS1'), +(-1532093,'I see the subtlety of conception is beyond primitives such as you.',9317,1,0,'malchezaar SAY_AXE_TOSS2'), +(-1532094,'Who knows what secrets hide in the dark.',9223,1,0,'malchezaar SAY_SPECIAL1'), +(-1532095,'The cerestial forces are mine to manipulate.',9320,1,0,'malchezaar SAY_SPECIAL2'), +(-1532096,'How can you hope to withstand against such overwhelming power?',9321,1,0,'malchezaar SAY_SPECIAL3'), +(-1532097,'Surely you did not think you could win.',9222,1,0,'malchezaar SAY_SLAY1'), +(-1532098,'Your greed, your foolishness has brought you to this end.',9318,1,0,'malchezaar SAY_SLAY2'), +(-1532099,'You are, but a plaything, unfit even to amuse.',9319,1,0,'malchezaar SAY_SLAY3'), +(-1532100,'All realities, all dimensions are open to me!',9224,1,0,'malchezaar SAY_SUMMON1'), +(-1532101,'You face not Malchezaar alone, but the legions I command!',9322,1,0,'malchezaar SAY_SUMMON2'), +(-1532102,'I refuse to concede defeat. I am a prince of the Eredar! I am...',9221,1,0,'malchezaar SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1550043 AND -1550000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1550000,'Alert, you are marked for extermination!',11213,1,0,'voidreaver SAY_AGGRO'), +(-1550001,'Extermination, successful.',11215,1,0,'voidreaver SAY_SLAY1'), +(-1550002,'Imbecile life form, no longer functional.',11216,1,0,'voidreaver SAY_SLAY2'), +(-1550003,'Threat neutralized.',11217,1,0,'voidreaver SAY_SLAY3'), +(-1550004,'Systems... shutting... down...',11214,1,0,'voidreaver SAY_DEATH'), +(-1550005,'Alternative measure commencing...',11218,1,0,'voidreaver SAY_POUNDING1'), +(-1550006,'Calculating force parameters...',11219,1,0,'voidreaver SAY_POUNDING2'), +(-1550007,'Tal anu\'men no Sin\'dorei!',11134,1,0,'solarian SAY_AGGRO'), +(-1550008,'Ha ha ha! You are hopelessly outmatched!',11139,1,0,'solarian SAY_SUMMON1'), +(-1550009,'I will crush your delusions of grandeur!',11140,1,0,'solarian SAY_SUMMON2'), +(-1550010,'Your soul belongs to the Abyss!',11136,1,0,'solarian SAY_KILL1'), +(-1550011,'By the blood of the Highborne!',11137,1,0,'solarian SAY_KILL2'), +(-1550012,'For the Sunwell!',11138,1,0,'solarian SAY_KILL3'), +(-1550013,'The warmth of the sun... awaits.',11135,1,0,'solarian SAY_DEATH'), +(-1550014,'Enough of this! Now I call upon the fury of the cosmos itself.',0,1,0,'solarian SAY_VOIDA'), +(-1550015,'I become ONE... with the VOID!',0,1,0,'solarian SAY_VOIDB'), +(-1550016,'Energy. Power. My people are addicted to it... a dependence made manifest after the Sunwell was destroyed. Welcome... to the future. A pity you are too late to stop it. No one can stop me now! Selama ashal\'anore!',11256,1,0,'kaelthas SAY_INTRO'), +(-1550017,'Capernian will see to it that your stay here is a short one.',11257,1,0,'kaelthas SAY_INTRO_CAPERNIAN'), +(-1550018,'Well done, you have proven worthy to test your skills against my master engineer, Telonicus.',11258,1,0,'kaelthas SAY_INTRO_TELONICUS'), +(-1550019,'Let us see how your nerves hold up against the Darkener, Thaladred.',11259,1,0,'kaelthas SAY_INTRO_THALADRED'), +(-1550020,'You have persevered against some of my best advisors... but none can withstand the might of the Blood Hammer. Behold, Lord Sanguinar!',11260,1,0,'kaelthas SAY_INTRO_SANGUINAR'), +(-1550021,'As you see, I have many weapons in my arsenal...',11261,1,0,'kaelthas SAY_PHASE2_WEAPON'), +(-1550022,'Perhaps I underestimated you. It would be unfair to make you fight all four advisors at once, but... fair treatment was never shown to my people. I\'m just returning the favor.',11262,1,0,'kaelthas SAY_PHASE3_ADVANCE'), +(-1550023,'Alas, sometimes one must take matters into one\'s own hands. Balamore shanal!',11263,1,0,'kaelthas SAY_PHASE4_INTRO2'), +(-1550024,'I have not come this far to be stopped! The future I have planned will not be jeopardized! Now you will taste true power!!',11273,1,0,'kaelthas SAY_PHASE5_NUTS'), +(-1550025,'You will not prevail.',11270,1,0,'kaelthas SAY_SLAY1'), +(-1550026,'You gambled...and lost.',11271,1,0,'kaelthas SAY_SLAY2'), +(-1550027,'This was Child\'s play.',11272,1,0,'kaelthas SAY_SLAY3'), +(-1550028,'Obey me.',11268,1,0,'kaelthas SAY_MINDCONTROL1'), +(-1550029,'Bow to my will.',11269,1,0,'kaelthas SAY_MINDCONTROL2'), +(-1550030,'Let us see how you fare when your world is turned upside down.',11264,1,0,'kaelthas SAY_GRAVITYLAPSE1'), +(-1550031,'Having trouble staying grounded?',11265,1,0,'kaelthas SAY_GRAVITYLAPSE2'), +(-1550032,'Anara\'nel belore!',11267,1,0,'kaelthas SAY_SUMMON_PHOENIX1'), +(-1550033,'By the power of the sun!',11266,1,0,'kaelthas SAY_SUMMON_PHOENIX2'), +(-1550034,'For...Quel...thalas!',11274,1,0,'kaelthas SAY_DEATH'), +(-1550035,'Prepare yourselves!',11203,1,0,'thaladred SAY_THALADRED_AGGRO'), +(-1550036,'Forgive me, my prince! I have... failed.',11204,1,0,'thaladred SAY_THALADRED_DEATH'), +(-1550037,'sets his gaze on $N!',0,2,0,'thaladred EMOTE_THALADRED_GAZE'), +(-1550038,'Blood for blood!',11152,1,0,'sanguinar SAY_SANGUINAR_AGGRO'), +(-1550039,'NO! I ...will... not...',11153,1,0,'sanguinar SAY_SANGUINAR_DEATH'), +(-1550040,'The sin\'dore reign supreme!',11117,1,0,'capernian SAY_CAPERNIAN_AGGRO'), +(-1550041,'This is not over!',11118,1,0,'capernian SAY_CAPERNIAN_DEATH'), +(-1550042,'Anar\'alah belore!',11157,1,0,'telonicus SAY_TELONICUS_AGGRO'), +(-1550043,'More perils... await',11158,1,0,'telonicus SAY_TELONICUS_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1553012 AND -1553000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1553000,'What are you doing? These specimens are very delicate!',11144,1,0,'freywinn SAY_AGGRO'), +(-1553001,'Your life cycle is now concluded!',11145,1,0,'freywinn SAY_KILL_1'), +(-1553002,'You will feed the worms.',11146,1,0,'freywinn SAY_KILL_2'), +(-1553003,'Endorel aluminor!',11147,1,0,'freywinn SAY_TREE_1'), +(-1553004,'Nature bends to my will!',11148,1,0,'freywinn SAY_TREE_2'), +(-1553005,'The specimens...must be preserved.',11149,1,0,'freywinn SAY_DEATH'), +(-1553006,'emits a strange noise.',0,2,0,'laj EMOTE_SUMMON'), +(-1553007,'Who disturbs this sanctuary?',11230,1,0,'warp SAY_AGGRO'), +(-1553008,'You must die! But wait: this does not--No, no... you must die!',11231,1,0,'warp SAY_SLAY_1'), +(-1553009,'What am I doing? Why do I...',11232,1,0,'warp SAY_SLAY_2'), +(-1553010,'Children, come to me!',11233,1,0,'warp SAY_SUMMON_1'), +(-1553011,'Maybe this is not--No, we fight! Come to my aid.',11234,1,0,'warp SAY_SUMMON_2'), +(-1553012,'So... confused. Do not... belong here!',11235,1,0,'warp SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1554027 AND -1554000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1554000,'I predict a painful death.',11101,1,0,'gyro SAY_AGGRO'), +(-1554001,'Measure twice; cut once!',11104,1,0,'gyro SAY_SAW_ATTACK1'), +(-1554002,'If my division is correct, you should be quite dead.',11105,1,0,'gyro SAY_SAW_ATTACK2'), +(-1554003,'Your strategy was flawed!',11102,1,0,'gyro SAY_SLAY1'), +(-1554004,'Yes, the only logical outcome.',11103,1,0,'gyro SAY_SLAY2'), +(-1554005,'An unforseen... contingency',11106,1,0,'gyro SAY_DEATH'), +(-1554006,'You have approximately five seconds to live.',11109,1,0,'ironhand SAY_AGGRO_1'), +(-1554007,'With the precise angle and velocity...',11112,1,0,'ironhand SAY_HAMMER_1'), +(-1554008,'Low tech yet quiet effective!',11113,1,0,'ironhand SAY_HAMMER_2'), +(-1554009,'A foregone conclusion.',11110,1,0,'ironhand SAY_SLAY_1'), +(-1554010,'The processing will continue a schedule!',11111,1,0,'ironhand SAY_SLAY_2'), +(-1554011,'My calculations did not...',11114,1,0,'ironhand SAY_DEATH_1'), +(-1554012,'raises his hammer menacingly...',0,3,0,'ironhand EMOTE_HAMMER'), +(-1554013,'Don\'t value your life very much, do you?',11186,1,0,'sepethrea SAY_AGGRO'), +(-1554014,'I am not alone.',11191,1,0,'sepethrea SAY_SUMMON'), +(-1554015,'Think you can take the heat?',11189,1,0,'sepethrea SAY_DRAGONS_BREATH_1'), +(-1554016,'Anar\'endal dracon!',11190,1,0,'sepethrea SAY_DRAGONS_BREATH_2'), +(-1554017,'And don\'t come back!',11187,1,0,'sepethrea SAY_SLAY1'), +(-1554018,'En\'dala finel el\'dal',11188,1,0,'sepethrea SAY_SLAY2'), +(-1554019,'Anu... bala belore...alon.',11192,1,0,'sepethrea SAY_DEATH'), +(-1554020,'We are on a strict timetable. You will not interfere!',11193,1,0,'pathaleon SAY_AGGRO'), +(-1554021,'I\'m looking for a team player...',11197,1,0,'pathaleon SAY_DOMINATION_1'), +(-1554022,'You work for me now!',11198,1,0,'pathaleon SAY_DOMINATION_2'), +(-1554023,'Time to supplement my work force.',11196,1,0,'pathaleon SAY_SUMMON'), +(-1554024,'I prefeer to be hands-on...',11199,1,0,'pathaleon SAY_ENRAGE'), +(-1554025,'A minor inconvenience.',11194,1,0,'pathaleon SAY_SLAY_1'), +(-1554026,'Looks like you lose.',11195,1,0,'pathaleon SAY_SLAY_2'), +(-1554027,'The project will... continue.',11200,1,0,'pathaleon SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1585029 AND -1585000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1585000,'You only waste my time!',12378,1,0,'selin SAY_AGGRO'), +(-1585001,'My hunger knows no bounds!',12381,1,0,'selin SAY_ENERGY'), +(-1585002,'Yes! I am a god!',12382,1,0,'selin SAY_EMPOWERED'), +(-1585003,'Enough distractions!',12388,1,0,'selin SAY_KILL_1'), +(-1585004,'I am invincible!',12385,1,0,'selin SAY_KILL_2'), +(-1585005,'No! More... I must have more!',12383,1,0,'selin SAY_DEATH'), +(-1585006,'begins to channel from the nearby Fel Crystal...',0,3,0,'selin EMOTE_CRYSTAL'), +(-1585007,'Drain...life!',12389,1,0,'vexallus SAY_AGGRO'), +(-1585008,'Un...con...tainable.',12392,1,0,'vexallus SAY_ENERGY'), +(-1585009,'Un...leash...',12390,1,0,'vexallus SAY_OVERLOAD'), +(-1585010,'Con...sume.',12393,1,0,'vexallus SAY_KILL'), +(-1585011,'discharges pure energy!',0,3,0,'vexallus EMOTE_DISCHARGE_ENERGY'), +(-1585012,'Annihilate them!',12395,1,0,'delrissa SAY_AGGRO'), +(-1585013,'Oh, the horror.',12398,1,0,'delrissa LackeyDeath1'), +(-1585014,'Well, aren\'t you lucky?',12400,1,0,'delrissa LackeyDeath2'), +(-1585015,'Now I\'m getting annoyed.',12401,1,0,'delrissa LackeyDeath3'), +(-1585016,'Lackies be damned! I\'ll finish you myself!',12403,1,0,'delrissa LackeyDeath4'), +(-1585017,'I call that a good start.',12405,1,0,'delrissa PlayerDeath1'), +(-1585018,'I could have sworn there were more of you.',12407,1,0,'delrissa PlayerDeath2'), +(-1585019,'Not really much of a group, anymore, is it?',12409,1,0,'delrissa PlayerDeath3'), +(-1585020,'One is such a lonely number.',12410,1,0,'delrissa PlayerDeath4'), +(-1585021,'It\'s been a kick, really.',12411,1,0,'delrissa PlayerDeath5'), +(-1585022,'Not what I had... planned...',12397,1,0,'delrissa SAY_DEATH'), +(-1585023,'Don\'t look so smug! I know what you\'re thinking, but Tempest Keep was merely a set back. Did you honestly believe I would trust the future to some blind, half-night elf mongrel? Oh no, he was merely an instrument, a stepping stone to a much larger plan! It has all led to this, and this time, you will not interfere!',12413,1,0,'kaelthas MT SAY_AGGRO'), +(-1585024,'Vengeance burns!',12415,1,0,'kaelthas MT SAY_PHOENIX'), +(-1585025,'Felomin ashal!',12417,1,0,'kaelthas MT SAY_FLAMESTRIKE'), +(-1585026,'I\'ll turn your world... upside... down...',12418,1,0,'kaelthas MT SAY_GRAVITY_LAPSE'), +(-1585027,'Master... grant me strength.',12419,1,0,'kaelthas MT SAY_TIRED'), +(-1585028,'Do not... get too comfortable.',12420,1,0,'kaelthas MT SAY_RECAST_GRAVITY'), +(-1585029,'My demise accomplishes nothing! The Master will have you! You will drown in your own blood! This world shall burn! Aaaghh!',12421,1,0,'kaelthas MT SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580035 AND -1580000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1580000,'Aggh! No longer will I be a slave to Malygos! Challenge me and you will be destroyed!',12422,1,0,'kalecgos SAY_EVIL_AGGRO'), +(-1580001,'I will purge you!',12423,1,0,'kalecgos SAY_EVIL_SPELL1'), +(-1580002,'Your pain has only begun!',12424,1,0,'kalecgos SAY_EVIL_SPELL2'), +(-1580003,'In the name of Kil\'jaeden!',12425,1,0,'kalecgos SAY_EVIL_SLAY1'), +(-1580004,'You were warned!',12426,1,0,'kalecgos SAY_EVIL_SLAY2'), +(-1580005,'My awakening is complete! You shall all perish!',12427,1,0,'kalecgos SAY_EVIL_ENRAGE'), +(-1580006,'I need... your help... Cannot... resist him... much longer...',12428,1,0,'kalecgos humanoid SAY_GOOD_AGGRO'), +(-1580007,'Aaahhh! Help me, before I lose my mind!',12429,1,0,'kalecgos humanoid SAY_GOOD_NEAR_DEATH'), +(-1580008,'Hurry! There is not much of me left!',12430,1,0,'kalecgos humanoid SAY_GOOD_NEAR_DEATH2'), +(-1580009,'I am forever in your debt. Once we have triumphed over Kil\'jaeden, this entire world will be in your debt as well.',12431,1,0,'kalecgos humanoid SAY_GOOD_PLRWIN'), +(-1580010,'There will be no reprieve. My work here is nearly finished.',12451,1,0,'sathrovarr SAY_SATH_AGGRO'), +(-1580011,'I\'m... never on... the losing... side...',12452,1,0,'sathrovarr SAY_SATH_DEATH'), +(-1580012,'Your misery is my delight!',12453,1,0,'sathrovarr SAY_SATH_SPELL1'), +(-1580013,'I will watch you bleed!',12454,1,0,'sathrovarr SAY_SATH_SPELL2'), +(-1580014,'Pitious mortal!',12455,1,0,'sathrovarr SAY_SATH_SLAY1'), +(-1580015,'Haven\'t you heard? I always win!',12456,1,0,'sathrovarr SAY_SATH_SLAY2'), +(-1580016,'I have toyed with you long enough!',12457,1,0,'sathrovarr SAY_SATH_ENRAGE'), +(-1580017,'Puny lizard! Death is the only answer you\'ll find here!',12458,1,0,'brutallus YELL_INTRO'), +(-1580018,'Grah! Your magic is weak!',12459,1,0,'brutallus YELL_INTRO_BREAK_ICE'), +(-1580019,'I will crush you!',12460,1,0,'brutallus YELL_INTRO_CHARGE'), +(-1580020,'That was fun.',12461,1,0,'brutallus YELL_INTRO_KILL_MADRIGOSA'), +(-1580021,'Come, try your luck!',12462,1,0,'brutallus YELL_INTRO_TAUNT'), +(-1580022,'Ahh! More lambs to the slaughter!',12463,1,0,'brutallus YELL_AGGRO'), +(-1580023,'Perish, insect!',12464,1,0,'brutallus YELL_KILL1'), +(-1580024,'You are meat!',12465,1,0,'brutallus YELL_KILL2'), +(-1580025,'Too easy!',12466,1,0,'brutallus YELL_KILL3'), +(-1580026,'Bring the fight to me!',12467,1,0,'brutallus YELL_LOVE1'), +(-1580027,'Another day, another glorious battle!',12468,1,0,'brutallus YELL_LOVE2'), +(-1580028,'I live for this!',12469,1,0,'brutallus YELL_LOVE3'), +(-1580029,'So much for a real challenge... Die!',12470,1,0,'brutallus YELL_BERSERK'), +(-1580030,'Gah! Well done... Now... this gets... interesting...',12471,1,0,'brutallus YELL_DEATH'), +(-1580031,'Hold, friends! There is information to be had before this devil meets his fate!',12472,1,0,'madrigosa YELL_MADR_ICE_BARRIER'), +(-1580032,'Where is Anveena, demon? What has become of Kalec?',12473,1,0,'madrigosa YELL_MADR_INTRO'), +(-1580033,'You will tell me where they are!',12474,1,0,'madrigosa YELL_MADR_ICE_BLOCK'), +(-1580034,'Speak, I grow weary of asking!',12475,1,0,'madrigosa YELL_MADR_TRAP'), +(-1580035,'Malygos, my lord! I did my best!',12476,1,0,'madrigosa YELL_MADR_DEATH'); + +DELETE FROM `script_texts` WHERE `entry`=-1033000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1033000,'Thanks for freeing me, I\'ll open this door for you, then I will get out of here.',0,0,0,'shadowfang_prisoner SAY_FREE'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1309023 AND -1309000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1309000,'Let the coils of hate unfurl!',8421,1,0,'venoxis SAY_TRANSFORM'), +(-1309001,'Ssserenity..at lassst!',0,1,0,'venoxis SAY_DEATH'), +(-1309002,'Lord Hir\'eek, grant me wings of vengance!',8417,1,0,'jeklik SAY_AGGRO'), +(-1309003,'I command you to rain fire down upon these invaders!',0,1,0,'jeklik SAY_RAIN_FIRE'), +(-1309004,'Finally ...death. Curse you Hakkar! Curse you!',8422,1,0,'jeklik SAY_DEATH'), +(-1309005,'Draw me to your web mistress Shadra. Unleash your venom!',8418,1,0,'marli SAY_AGGRO'), +(-1309006,'Shadra, make of me your avatar!',0,1,0,'marli SAY_TRANSFORM'), +(-1309007,'Aid me my brood!',0,1,0,'marli SAY_SPIDER_SPAWN'), +(-1309008,'Bless you mortal for this release. Hakkar controls me no longer...',8423,1,0,'marli SAY_DEATH'), +(-1309009,'Shirvallah, fill me with your RAGE!',8419,1,0,'thekal SAY_AGGRO'), +(-1309010,'Hakkar binds me no more! Peace at last!',8424,1,0,'thekal SAY_DEATH'), +(-1309011,'Bethekk, your priestess calls upon your might!',8416,1,0,'arlokk SAY_AGGRO'), +(-1309012,'Feast on $n, my pretties!',0,1,0,'arlokk SAY_FEAST_PANTHER'), +(-1309013,'At last, I am free of the Soulflayer!',8412,1,0,'arlokk SAY_DEATH'), +(-1309014,'Welcome to da great show friends! Step right up to die!',8425,1,0,'jindo SAY_AGGRO'), +(-1309015,'I\'ll feed your souls to Hakkar himself!',8413,1,0,'mandokir SAY_AGGRO'), +(-1309016,'DING!',0,1,0,'mandokir SAY_DING_KILL'), +(-1309017,'GRATS!',0,1,0,'mandokir SAY_GRATS_JINDO'), +(-1309018,'I\'m keeping my eye on you, $N!',0,1,0,'mandokir SAY_WATCH'), +(-1309019,'Don\'t make me angry. You won\'t like it when I\'m angry.',0,1,0,'mandokir SAY_WATCH_WHISPER'), +(-1309020,'PRIDE HERALDS THE END OF YOUR WORLD. COME, MORTALS! FACE THE WRATH OF THE SOULFLAYER!',8414,1,0,'hakkar SAY_AGGRO'), +(-1309021,'Fleeing will do you no good, mortals!',0,1,0,'hakkar SAY_FLEEING'), +(-1309022,'You dare set foot upon Hakkari holy ground? Minions of Hakkar, destroy the infidels!',0,1,0,'hakkar SAY_MINION_DESTROY'), +(-1309023,'Minions of Hakkar, hear your God. The sanctity of this temple has been compromised. Invaders encroach upon holy ground! The Altar of Blood must be protected. Kill them all!',0,1,0,'hakkar SAY_PROTECT_ALTAR'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1568023 AND -1568000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1568000,'Spirits of da wind be your doom!',12031,1,0,'janalai SAY_AGGRO'), +(-1568001,'I burn ya now!',12032,1,0,'janalai SAY_FIRE_BOMBS'), +(-1568002,'Where ma hatcha? Get to work on dem eggs!',12033,1,0,'janalai SAY_SUMMON_HATCHER'), +(-1568003,'I show you strength... in numbers.',12034,1,0,'janalai SAY_ALL_EGGS'), +(-1568004,'You done run outta time!',12035,1,0,'janalai SAY_BERSERK'), +(-1568005,'It all be over now, mon!',12036,1,0,'janalai SAY_SLAY_1'), +(-1568006,'Tazaga-choo!',12037,1,0,'janalai SAY_SLAY_2'), +(-1568007,'Zul\'jin... got a surprise for you...',12038,1,0,'janalai SAY_DEATH'), +(-1568008,'Come, strangers. The spirit of the dragonhawk hot be hungry for worthy souls.',12039,1,0,'janalai SAY_EVENT_STRANGERS'), +(-1568009,'Come, friends. Your bodies gonna feed ma hatchlings, and your souls are going to feed me with power!',12040,1,0,'janalai SAY_EVENT_FRIENDS'), +(-1568010,'Get da move on, guards! It be killin\' time!',12066,1,0,'nalorakk SAY_WAVE1_AGGRO'), +(-1568011,'Guards, go already! Who you more afraid of, dem... or me?',12067,1,0,'nalorakk SAY_WAVE2_STAIR1'), +(-1568012,'Ride now! Ride out dere and bring me back some heads!',12068,1,0,'nalorakk SAY_WAVE3_STAIR2'), +(-1568013,'I be losin\' me patience! Go on: make dem wish dey was never born!',12069,1,0,'nalorakk SAY_WAVE4_PLATFORM'), +(-1568014,'What could be better than servin\' da bear spirit for eternity? Come closer now. Bring your souls to me!',12078,1,0,'nalorakk SAY_EVENT1_SACRIFICE'), +(-1568015,'Don\'t be delayin\' your fate. Come to me now. I make your sacrifice quick.',12079,1,0,'nalorakk SAY_EVENT2_SACRIFICE'), +(-1568016,'You be dead soon enough!',12070,1,0,'nalorakk SAY_AGGRO'), +(-1568017,'I bring da pain!',12071,1,0,'nalorakk SAY_SURGE'), +(-1568018,'You call on da beast, you gonna get more dan you bargain for!',12072,1,0,'nalorakk SAY_TOBEAR'), +(-1568019,'Make way for Nalorakk!',12073,1,0,'nalorakk SAY_TOTROLL'), +(-1568020,'You had your chance, now it be too late!',12074,1,0,'nalorakk SAY_BERSERK'), +(-1568021,'Mua-ha-ha! Now whatchoo got to say?',12075,1,0,'nalorakk SAY_SLAY1'), +(-1568022,'Da Amani gonna rule again!',12076,1,0,'nalorakk SAY_SLAY2'), +(-1568023,'I... be waitin\' on da udda side....',12077,1,0,'nalorakk SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1509027 AND -1509000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1509000,'senses your fear.',0,2,0,'moam EMOTE_AGGRO'), +(-1509001,'bristles with energy!',0,2,0,'moan EMOTE_MANA_FULL'), +(-1509002,'sets eyes on $N!',0,2,0,'buru EMOTE_TARGET'), +(-1509003,'They come now. Try not to get yourself killed, young blood.',0,1,0,'andorov SAY_ANDOROV_INTRO'), +(-1509004,'Remember, Rajaxx, when I said I\'d kill you last? I lied...',0,1,0,'andorov SAY_ANDOROV_ATTACK'), +(-1509005,'The time of our retribution is at hand! Let darkness reign in the hearts of our enemies!',8612,1,0,'rajaxx SAY_WAVE3'), +(-1509006,'No longer will we wait behind barred doors and walls of stone! No longer will our vengeance be denied! The dragons themselves will tremble before our wrath!',8610,1,0,'rajaxx SAY_WAVE4'), +(-1509007,'Fear is for the enemy! Fear and death!',8608,1,0,'rajaxx SAY_WAVE5'), +(-1509008,'Staghelm will whimper and beg for his life, just as his whelp of a son did! One thousand years of injustice will end this day!',8611,1,0,'rajaxx SAY_WAVE6'), +(-1509009,'Fandral! Your time has come! Go and hide in the Emerald Dream and pray we never find you!',8607,1,0,'rajaxx SAY_WAVE7'), +(-1509010,'Impudent fool! I will kill you myself!',8609,1,0,'rajaxx SAY_INTRO'), +(-1509011,'Attack and make them pay dearly!',8603,1,0,'rajaxx SAY_UNK1'), +(-1509012,'Crush them! Drive them out!',8605,1,0,'rajaxx SAY_UNK2'), +(-1509013,'Do not hesitate! Destroy them!',8606,1,0,'rajaxx SAY_UNK3'), +(-1509014,'Warriors! Captains! Continue the fight!',8613,1,0,'rajaxx SAY_UNK4'), +(-1509015,'You are not worth my time $N!',8614,1,0,'rajaxx SAY_DEAGGRO'), +(-1509016,'Breath your last!',8604,1,0,'rajaxx SAY_KILLS_ANDOROV'), +(-1509017,'Soon you will know the price of your meddling, mortals... The master is nearly whole... And when he rises, your world will be cease!',0,1,0,'rajaxx SAY_COMPLETE_QUEST'), +(-1509018,'I am rejuvinated!',8593,1,0,'ossirian SAY_SURPREME1'), +(-1509019,'My powers are renewed!',8595,1,0,'ossirian SAY_SURPREME2'), +(-1509020,'My powers return!',8596,1,0,'ossirian SAY_SURPREME3'), +(-1509021,'Protect the city at all costs!',8597,1,0,'ossirian SAY_RAND_INTRO1'), +(-1509022,'The walls have been breached!',8599,1,0,'ossirian SAY_RAND_INTRO2'), +(-1509023,'To your posts. Defend the city.',8600,1,0,'ossirian SAY_RAND_INTRO3'), +(-1509024,'Tresspassers will be terminated.',8601,1,0,'ossirian SAY_RAND_INTRO4'), +(-1509025,'Sands of the desert rise and block out the sun!',8598,1,0,'ossirian SAY_AGGRO'), +(-1509026,'You are terminated.',8602,1,0,'ossirian SAY_SLAY'), +(-1509027,'I...have...failed.',8594,1,0,'ossirian SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1531011 AND -1531000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1531000,'Are you so eager to die? I would be happy to accomodate you.',8615,1,0,'skeram SAY_AGGRO1'), +(-1531001,'Cower mortals! The age of darkness is at hand.',8616,1,0,'skeram SAY_AGGRO2'), +(-1531002,'Tremble! The end is upon you.',8621,1,0,'skeram SAY_AGGRO3'), +(-1531003,'Let your death serve as an example!',8617,1,0,'skeram SAY_SLAY1'), +(-1531004,'Spineless wretches! You will drown in rivers of blood!',8619,1,0,'skeram SAY_SLAY2'), +(-1531005,'The screams of the dying will fill the air. A symphony of terror is about to begin!',8620,1,0,'skeram SAY_SLAY3'), +(-1531006,'Prepare for the return of the ancient ones!',8618,1,0,'skeram SAY_SPLIT'), +(-1531007,'You only delay... the inevetable.',8622,1,0,'skeram SAY_DEATH'), +(-1531008,'You will be judged for defiling these sacred grounds! The laws of the Ancients will not be challenged! Trespassers will be annihilated!',8646,1,0,'sartura SAY_AGGRO'), +(-1531009,'I sentence you to death!',8647,1,0,'sartura SAY_SLAY'), +(-1531010,'I serve to the last!',8648,1,0,'sartura SAY_DEATH'), +(-1531011,'is weakened!',0,2,0,'cthun EMOTE_WEAKENED'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1509027 AND -1509018; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1509018,'I am rejuvinated!',8593,1,0,'ossirian SAY_SURPREME1'), +(-1509019,'My powers are renewed!',8595,1,0,'ossirian SAY_SURPREME2'), +(-1509020,'My powers return!',8596,1,0,'ossirian SAY_SURPREME3'), +(-1509021,'Protect the city at all costs!',8597,1,0,'ossirian SAY_RAND_INTRO1'), +(-1509022,'The walls have been breached!',8599,1,0,'ossirian SAY_RAND_INTRO2'), +(-1509023,'To your posts. Defend the city.',8600,1,0,'ossirian SAY_RAND_INTRO3'), +(-1509024,'Tresspassers will be terminated.',8601,1,0,'ossirian SAY_RAND_INTRO4'), +(-1509025,'Sands of the desert rise and block out the sun!',8598,1,0,'ossirian SAY_AGGRO'), +(-1509026,'You are terminated.',8602,1,0,'ossirian SAY_SLAY'), +(-1509027,'I...have...failed.',8594,1,0,'ossirian SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1564096 AND -1564000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1564000,'You will die in the name of Lady Vashj!',11450,1,0,'SAY_AGGRO'), +(-1564001,'Stick around!',11451,1,0,'SAY_NEEDLE1'), +(-1564002,'I\'ll deal with you later!',11452,1,0,'SAY_NEEDLE2'), +(-1564003,'Your success was short lived!',11455,1,0,'SAY_SLAY1'), +(-1564004,'Time for you to go!',11456,1,0,'SAY_SLAY2'), +(-1564005,'Bel\'anen dal\'lorei!',11453,1,0,'SAY_SPECIAL1'), +(-1564006,'Blood will flow!',11454,1,0,'SAY_SPECIAL2'), +(-1564007,'Bal\'amer ch\'itah!',11457,1,0,'SAY_ENRAGE1'), +(-1564008,'My patience has ran out! Die, DIE!',11458,1,0,'SAY_ENRAGE2'), +(-1564009,'Lord Illidan will... crush you.',11459,1,0,'SAY_DEATH'), +(-1564010,'%s acquires a new target!',0,3,0,'supremus EMOTE_NEW_TARGET'), +(-1564011,'%s punches the ground in anger!',0,3,0,'supremus EMOTE_PUNCH_GROUND'), +(-1564012,'The ground begins to crack open!',0,3,0,'supremus EMOTE_GROUND_CRACK'), +(-1564013,'No! Not yet...',11385,1,0,'akama shade SAY_LOW_HEALTH'), +(-1564014,'I will not last much longer...',11386,1,0,'akama shade SAY_DEATH'), +(-1564015,'Come out from the shadows! I\'ve returned to lead you against our true enemy! Shed your chains and raise your weapons against your Illidari masters!',0,1,0,'akama shade SAY_FREE'), +(-1564016,'Hail our leader! Hail Akama!',0,1,0,'akama shade broken SAY_BROKEN_FREE_01'), +(-1564017,'Hail Akama!',0,1,0,'akama shade broken SAY_BROKEN_FREE_02'), +(-1564018,'You play, you pay.',11501,1,0,'shahraz SAY_TAUNT1'), +(-1564019,'I\'m not impressed.',11502,1,0,'shahraz SAY_TAUNT2'), +(-1564020,'Enjoying yourselves?',11503,1,0,'shahraz SAY_TAUNT3'), +(-1564021,'So... business or pleasure?',11504,1,0,'shahraz SAY_AGGRO'), +(-1564022,'You seem a little tense.',11505,1,0,'shahraz SAY_SPELL1'), +(-1564023,'Don\'t be shy.',11506,1,0,'shahraz SAY_SPELL2'), +(-1564024,'I\'m all... yours.',11507,1,0,'shahraz SAY_SPELL3'), +(-1564025,'Easy come, easy go.',11508,1,0,'shahraz SAY_SLAY1'), +(-1564026,'So much for a happy ending.',11509,1,0,'shahraz SAY_SLAY2'), +(-1564027,'Stop toying with my emotions!',11510,1,0,'shahraz SAY_ENRAGE'), +(-1564028,'I wasn\'t... finished.',11511,1,0,'shahraz SAY_DEATH'), +(-1564029,'Horde will... crush you.',11432,1,0,'bloodboil SOUND_AGGRO'), +(-1564030,'Time to feast!',11433,1,0,'bloodboil SAY_SLAY1'), +(-1564031,'More! I want more!',11434,1,0,'bloodboil SAY_SLAY2'), +(-1564032,'Drink your blood! Eat your flesh!',11435,1,0,'bloodboil SAY_SPECIAL1'), +(-1564033,'I hunger!',11436,1,0,'bloodboil SAY_SPECIAL2'), +(-1564034,'',11437,1,0,'bloodboil SAY_ENRAGE1'), +(-1564035,'I\'ll rip the meat from your bones!',11438,1,0,'bloodboil SAY_ENRAGE2'), +(-1564036,'Aaaahrg...',11439,1,0,'bloodboil SAY_DEATH'), +(-1564037,'I was the first, you know. For me, the wheel of death has spun many times. So much time has passed. I have a lot of catching up to do...',11512,1,0,'teron SAY_INTRO'), +(-1564038,'Vengeance is mine!',11513,1,0,'teron SAY_AGGRO'), +(-1564039,'I have use for you!',11514,1,0,'teron SAY_SLAY1'), +(-1564040,'It gets worse...',11515,1,0,'teron SAY_SLAY2'), +(-1564041,'What are you afraid of?',11517,1,0,'teron SAY_SPELL1'), +(-1564042,'Death... really isn\'t so bad.',11516,1,0,'teron SAY_SPELL2'), +(-1564043,'Give in!',11518,1,0,'teron SAY_SPECIAL1'), +(-1564044,'I have something for you...',11519,1,0,'teron SAY_SPECIAL2'), +(-1564045,'YOU WILL SHOW THE PROPER RESPECT!',11520,1,0,'teron SAY_ENRAGE'), +(-1564046,'The wheel...spins...again....',11521,1,0,'teron SAY_DEATH'), +(-1564047,'Pain and suffering are all that await you!',11415,1,0,'essence SUFF_SAY_FREED'), +(-1564048,'Don\'t leave me alone!',11416,1,0,'essence SUFF_SAY_AGGRO'), +(-1564049,'Look at what you make me do!',11417,1,0,'essence SUFF_SAY_SLAY1'), +(-1564050,'I didn\'t ask for this!',11418,1,0,'essence SUFF_SAY_SLAY2'), +(-1564051,'The pain is only beginning!',11419,1,0,'essence SUFF_SAY_SLAY3'), +(-1564052,'I don\'t want to go back!',11420,1,0,'essence SUFF_SAY_RECAP'), +(-1564053,'Now what do I do?',11421,1,0,'essence SUFF_SAY_AFTER'), +(-1564054,'%s becomes enraged!',0,3,0,'essence SUFF_EMOTE_ENRAGE'), +(-1564055,'You can have anything you desire... for a price.',11408,1,0,'essence DESI_SAY_FREED'), +(-1564056,'Fulfilment is at hand!',11409,1,0,'essence DESI_SAY_SLAY1'), +(-1564057,'Yes... you\'ll stay with us now...',11410,1,0,'essence DESI_SAY_SLAY2'), +(-1564058,'Your reach exceeds your grasp.',11412,1,0,'essence DESI_SAY_SLAY3'), +(-1564059,'Be careful what you wish for...',11411,1,0,'essence DESI_SAY_SPEC'), +(-1564060,'I\'ll be waiting...',11413,1,0,'essence DESI_SAY_RECAP'), +(-1564061,'I won\'t be far...',11414,1,0,'essence DESI_SAY_AFTER'), +(-1564062,'Beware: I live!',11399,1,0,'essence ANGER_SAY_FREED'), +(-1564063,'So... foolish.',11400,1,0,'essence ANGER_SAY_FREED2'), +(-1564064,'',11401,1,0,'essence ANGER_SAY_SLAY1'), +(-1564065,'Enough. No more.',11402,1,0,'essence ANGER_SAY_SLAY2'), +(-1564066,'On your knees!',11403,1,0,'essence ANGER_SAY_SPEC'), +(-1564067,'Beware, coward.',11405,1,0,'essence ANGER_SAY_BEFORE'), +(-1564068,'I won\'t... be... ignored.',11404,1,0,'essence ANGER_SAY_DEATH'), +(-1564069,'You wish to test me?',11524,1,0,'council vera AGGRO'), +(-1564070,'I have better things to do...',11422,1,0,'council gath AGGRO'), +(-1564071,'Flee or die!',11482,1,0,'council mala AGGRO'), +(-1564072,'Common... such a crude language. Bandal!',11440,1,0,'council zere AGGRO'), +(-1564073,'Enough games!',11428,1,0,'council gath ENRAGE'), +(-1564074,'You wish to kill me? Hahaha, you first!',11530,1,0,'council vera ENRAGE'), +(-1564075,'For Quel\'Thalas! For the Sunwell!',11488,1,0,'council mala ENRAGE'), +(-1564076,'Sha\'amoor sine menoor!',11446,1,0,'council zere ENRAGE'), +(-1564077,'Enjoy your final moments!',11426,1,0,'council gath SPECIAL1'), +(-1564078,'You\'re not caught up for this!',11528,1,0,'council vera SPECIAL1'), +(-1564079,'No second chances!',11486,1,0,'council mala SPECIAL1'), +(-1564080,'Diel fin\'al',11444,1,0,'council zere SPECIAL1'), +(-1564081,'You are mine!',11427,1,0,'council gath SPECIAL2'), +(-1564082,'Anar\'alah belore!',11529,1,0,'council vera SPECIAL2'), +(-1564083,'I\'m full of surprises!',11487,1,0,'council mala SPECIAL2'), +(-1564084,'Sha\'amoor ara mashal?',11445,1,0,'council zere SPECIAL2'), +(-1564085,'Selama am\'oronor!',11423,1,0,'council gath SLAY'), +(-1564086,'Valiant effort!',11525,1,0,'council vera SLAY'), +(-1564087,'My work is done.',11483,1,0,'council mala SLAY'), +(-1564088,'Shorel\'aran.',11441,1,0,'council zere SLAY'), +(-1564089,'Well done!',11424,1,0,'council gath SLAY_COMT'), +(-1564090,'A glorious kill!',11526,1,0,'council vera SLAY_COMT'), +(-1564091,'As it should be!',11484,1,0,'council mala SLAY_COMT'), +(-1564092,'Belesa menoor!',11442,1,0,'council zere SLAY_COMT'), +(-1564093,'Lord Illidan... I...',11425,1,0,'council gath DEATH'), +(-1564094,'You got lucky!',11527,1,0,'council vera DEATH'), +(-1564095,'Destiny... awaits.',11485,1,0,'council mala DEATH'), +(-1564096,'Diel ma\'ahn... oreindel\'o',11443,1,0,'council zere DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1409018 AND -1409000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1409000,'performs one last service for Ragnaros.',0,2,0,'geddon EMOTE_SERVICE'), +(-1409001,'goes into a killing frenzy!',0,2,0,'magmadar EMOTE_FRENZY'), +(-1409002,'refuses to die while its master is in trouble.',0,2,0,'core rager EMOTE_AEGIS'), +(-1409003,'Reckless mortals, none may challenge the sons of the living flame!',8035,1,0,'majordomo SAY_AGGRO'), +(-1409004,'The runes of warding have been destroyed! Hunt down the infedels my bretheren.',8039,1,0,'majordomo SAY_SPAWN'), +(-1409005,'Ashes to Ashes!',8037,1,0,'majordomo SAY_SLAY'), +(-1409006,'Burn mortals! Burn for this transgression!',8036,1,0,'majordomo SAY_SPECIAL'), +(-1409007,'Impossible! Stay your attack mortals! I submitt! I submitt! Brashly you have come to rest the secrets of the living flame. You will soon regret the recklessness of your quest. I go now to summon the lord whos house this is. Should you seek an audiance with him your paltry lives will surly be forfit. Nevertheless seek out his lair if you dare!',8038,1,0,'majordomo SAY_DEFEAT'), +(-1409008,'Behold Ragnaros, the Firelord! He who was ancient when this world was young! Bow before him, mortals! Bow before your ending!',8040,1,0,'ragnaros SAY_SUMMON_MAJ'), +(-1409009,'TOO SOON! YOU HAVE AWAKENED ME TOO SOON, EXECUTUS! WHAT IS THE MEANING OF THIS INTRUSION?',8043,1,0,'ragnaros SAY_ARRIVAL1_RAG'), +(-1409010,'These mortal infidels, my lord! They have invaded your sanctum, and seek to steal your secrets!',8041,1,0,'ragnaros SAY_ARRIVAL2_MAJ'), +(-1409011,'FOOL! YOU ALLOWED THESE INSECTS TO RUN RAMPANT THROUGH THE HALLOWED CORE, AND NOW YOU LEAD THEM TO MY VERY LAIR? YOU HAVE FAILED ME, EXECUTUS! JUSTICE SHALL BE MET, INDEED!',8044,1,0,'ragnaros SAY_ARRIVAL3_RAG'), +(-1409012,'NOW FOR YOU, INSECTS. BOLDLY YOU SAUGHT THE POWER OF RAGNAROS NOW YOU SHALL SEE IT FIRST HAND.',8045,1,0,'ragnaros SAY_ARRIVAL5_RAG'), +(-1409013,'COME FORTH, MY SERVANTS! DEFEND YOUR MASTER!',8049,1,0,'ragnaros SAY_REINFORCEMENTS1'), +(-1409014,'YOU CANNOT DEFEAT THE LIVING FLAME! COME YOU MINIONS OF FIRE! COME FORTH YOU CREATURES OF HATE! YOUR MASTER CALLS!',8050,1,0,'ragnaros SAY_REINFORCEMENTS2'), +(-1409015,'BY FIRE BE PURGED!',8046,1,0,'ragnaros SAY_HAND'), +(-1409016,'TASTE THE FLAMES OF SULFURON!',8047,1,0,'ragnaros SAY_WRATH'), +(-1409017,'DIE INSECT!',8051,1,0,'ragnaros SAY_KILL'), +(-1409018,'MY PATIENCE IS DWINDILING! COME NATS TO YOUR DEATH!',8048,1,0,'ragnaros SAY_MAGMABURST'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1552030 AND -1552000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1552000,'It is a small matter to control the mind of the weak... for I bear allegiance to powers untouched by time, unmoved by fate. No force on this world or beyond harbors the strength to bend our knee... not even the mighty Legion!',11122,1,0,'skyriss SAY_INTRO'), +(-1552001,'Bear witness to the agent of your demise!',11123,1,0,'skyriss SAY_AGGRO'), +(-1552002,'Your fate is written!',11124,1,0,'skyriss SAY_KILL_1'), +(-1552003,'The chaos I have sown here is but a taste...',11125,1,0,'skyriss SAY_KILL_2'), +(-1552004,'You will do my bidding, weakling.',11127,1,0,'skyriss SAY_MIND_1'), +(-1552005,'Your will is no longer your own.',11128,1,0,'skyriss SAY_MIND_2'), +(-1552006,'Flee in terror!',11129,1,0,'skyriss SAY_FEAR_1'), +(-1552007,'I will show you horrors undreamed of!',11130,1,0,'skyriss SAY_FEAR_2'), +(-1552008,'We span the universe, as countless as the stars!',11131,1,0,'skyriss SAY_IMAGE'), +(-1552009,'I am merely one of... infinite multitudes.',11126,1,0,'skyriss SAY_DEATH'), +(-1552010,'Where in Bonzo\'s brass buttons am I? And who are-- yaaghh, that\'s one mother of a headache!',11171,1,0,'millhouse SAY_INTRO_1'), +(-1552011,'\"Lowly\"? I don\'t care who you are friend, no one refers to the mighty Millhouse Manastorm as \"Lowly\"! I have no idea what goes on here, but I will gladly join your fight against this impudent imbecile! Prepare to defend yourself, cretin!',11172,1,0,'millhouse SAY_INTRO_2'), +(-1552012,'I just need to get some things ready first. You guys go ahead and get started. I need to summon up some water...',11173,1,0,'millhouse SAY_WATER'), +(-1552013,'Fantastic! Next, some protective spells. Yes! Now we\'re cookin\'',11174,1,0,'millhouse SAY_BUFFS'), +(-1552014,'And of course i\'ll need some mana. You guys are gonna love this, just wait.',11175,1,0,'millhouse SAY_DRINK'), +(-1552015,'Aaalllriiiight!! Who ordered up an extra large can of whoop-ass?',11176,1,0,'millhouse SAY_READY'), +(-1552016,'I didn\'t even break a sweat on that one.',11177,1,0,'millhouse SAY_KILL_1'), +(-1552017,'You guys, feel free to jump in anytime.',11178,1,0,'millhouse SAY_KILL_2'), +(-1552018,'I\'m gonna light you up, sweet cheeks!',11179,1,0,'millhouse SAY_PYRO'), +(-1552019,'Ice, ice, baby!',11180,1,0,'millhouse SAY_ICEBLOCK'), +(-1552020,'Heal me! Oh, for the love of all that is holy, HEAL me! I\'m dying!',11181,1,0,'millhouse SAY_LOWHP'), +(-1552021,'You\'ll be hearing from my lawyer...',11182,1,0,'millhouse SAY_DEATH'), +(-1552022,'Who\'s bad? Who\'s bad? That\'s right: we bad!',11183,1,0,'millhouse SAY_COMPLETE'), +(-1552023,'I knew the prince would be angry but, I... I have not been myself. I had to let them out! The great one speaks to me, you see. Wait--outsiders. Kael\'thas did not send you! Good... I\'ll just tell the prince you released the prisoners!',11222,1,0,'mellichar YELL_INTRO1'), +(-1552024,'The naaru kept some of the most dangerous beings in existence here in these cells. Let me introduce you to another...',11223,1,0,'mellichar YELL_INTRO2'), +(-1552025,'Yes, yes... another! Your will is mine!',11224,1,0,'mellichar YELL_RELEASE1'), +(-1552026,'Behold another terrifying creature of incomprehensible power!',11225,1,0,'mellichar YELL_RELEASE2A'), +(-1552027,'What is this? A lowly gnome? I will do better, O\'great one.',11226,1,0,'mellichar YELL_RELEASE2B'), +(-1552028,'Anarchy! Bedlam! Oh, you are so wise! Yes, I see it now, of course!',11227,1,0,'mellichar YELL_RELEASE3'), +(-1552029,'One final cell remains. Yes, O\'great one, right away!',11228,1,0,'mellichar YELL_RELEASE4'), +(-1552030,'Welcome, O\'great one. I am your humble servant.',11229,1,0,'mellichar YELL_WELCOME'); + +DELETE FROM `script_texts` WHERE `entry`=-1000100; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000100,'Come, little ones. Face me!',0,1,0,'azuregos SAY_TELEPORT'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1249004 AND -1249000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1249000,'How fortuitous. Usually, I must leave my lair to feed.',0,1,0,'onyxia SAY_AGGRO'), +(-1249001,'Learn your place mortal!',0,1,0,'onyxia SAY_KILL'), +(-1249002,'This meaningless exertion bores me. I\'ll incinerate you all from above!',0,1,0,'onyxia SAY_PHASE_2_TRANS'), +(-1249003,'It seems you\'ll need another lesson, mortals!',0,1,0,'onyxia SAY_PHASE_3_TRANS'), +(-1249004,'takes in a deep breath...',0,1,0,'onyxia EMOTE_BREATH'); + +DELETE FROM `script_texts` WHERE `entry`=-1469031; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1469031,'goes into a frenzy!',0,2,0,'flamegor EMOTE_FRENZY'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000105 AND -1000101; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000101,'Follow me, $N. I\'ll take you to the Defias hideout. But you better protect me or I am as good as dead',0,0,7,'defias traitor SAY_START'), +(-1000102,'The entrance is hidden here in Moonbrook. Keep your eyes peeled for thieves. They want me dead.',0,0,7,'defias traitor SAY_PROGRESS'), +(-1000103,'You can go tell Stoutmantle this is where the Defias Gang is holed up, $N.',0,0,7,'defias traitor SAY_END'), +(-1000104,'%s coming in fast! Prepare to fight!',0,0,7,'defias traitor SAY_AGGRO_1'), +(-1000105,'Help!',0,0,7,'defias traitor SAY_AGGRO_2'); diff --git a/sql/updates/2.4.3_old/175_world_scripts.sql b/sql/updates/2.4.3_old/175_world_scripts.sql new file mode 100644 index 0000000..05b1813 --- /dev/null +++ b/sql/updates/2.4.3_old/175_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_defias_traitor' WHERE `entry`='467'; diff --git a/sql/updates/2.4.3_old/176_world.sql b/sql/updates/2.4.3_old/176_world.sql new file mode 100644 index 0000000..12df2a0 --- /dev/null +++ b/sql/updates/2.4.3_old/176_world.sql @@ -0,0 +1,32 @@ +ALTER TABLE `npc_option` + CHANGE COLUMN `id` `id` mediumint(8) unsigned NOT NULL default '0', + CHANGE COLUMN `gossip_id` `gossip_id` mediumint(8) unsigned NOT NULL default '0', + CHANGE COLUMN `action` `action` mediumint(8) unsigned NOT NULL default '0', + ADD COLUMN `box_money` int(10) unsigned NOT NULL default '0' AFTER `action`, + ADD COLUMN `coded` tinyint(3) unsigned NOT NULL default '0' AFTER `box_money`, + ADD COLUMN `box_text` text AFTER `option_text`; + +CREATE TABLE `locales_npc_option` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `option_text_loc1` text, + `option_text_loc2` text, + `option_text_loc3` text, + `option_text_loc4` text, + `option_text_loc5` text, + `option_text_loc6` text, + `option_text_loc7` text, + `option_text_loc8` text, + `box_text_loc1` text, + `box_text_loc2` text, + `box_text_loc3` text, + `box_text_loc4` text, + `box_text_loc5` text, + `box_text_loc6` text, + `box_text_loc7` text, + `box_text_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +ALTER TABLE `creature_template` + CHANGE COLUMN `flags` `unit_flags` int(10) unsigned NOT NULL default '0', + CHANGE COLUMN `flag1` `type_flags` int(10) unsigned NOT NULL default '0'; diff --git a/sql/updates/2.4.3_old/182_world.sql b/sql/updates/2.4.3_old/182_world.sql new file mode 100644 index 0000000..450b539 --- /dev/null +++ b/sql/updates/2.4.3_old/182_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE name IN ('possess', 'unpossess'); +INSERT INTO `command` (name,security,help) VALUES +('possess',3,'Syntax: .possess\r\n\r\nPossesses indefinitely the selected creature.'), +('unpossess',3,'Syntax: .unpossess\r\n\r\nIf you are possessed, unpossesses yourself; otherwise unpossesses current possessed target.'); diff --git a/sql/updates/2.4.3_old/212_world_scripts.sql b/sql/updates/2.4.3_old/212_world_scripts.sql new file mode 100644 index 0000000..96f7def --- /dev/null +++ b/sql/updates/2.4.3_old/212_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `ScriptName`='npc_clintar_dreamwalker' WHERE `entry`=22834; +UPDATE `creature_template` SET `ScriptName`='npc_clintar_spirit' WHERE `entry` = 22916; +UPDATE `creature_template` SET `ScriptName`='mob_sparrowhawk' WHERE `entry`=22979; +UPDATE `creature_template` SET `ScriptName`='mob_rizzle_sprysprocket' WHERE `entry`=23002; +UPDATE `creature_template` SET `ScriptName`='mob_depth_charge' WHERE `entry`=23025; diff --git a/sql/updates/2.4.3_old/220_characters.sql b/sql/updates/2.4.3_old/220_characters.sql new file mode 100644 index 0000000..f66762b --- /dev/null +++ b/sql/updates/2.4.3_old/220_characters.sql @@ -0,0 +1,2 @@ +ALTER TABLE `characters` + ADD `latency` int(11) unsigned NOT NULL default '0' AFTER `taxi_path`; diff --git a/sql/updates/2.4.3_old/230_world.sql b/sql/updates/2.4.3_old/230_world.sql new file mode 100644 index 0000000..3f3565e --- /dev/null +++ b/sql/updates/2.4.3_old/230_world.sql @@ -0,0 +1,2 @@ +UPDATE `spell_proc_event` SET `procFlags` = '8396800' WHERE `entry` =14774; +UPDATE `spell_proc_event` SET `procFlags` = '8396800' WHERE `entry` =14531; diff --git a/sql/updates/2.4.3_old/230_world_blacktemple.sql b/sql/updates/2.4.3_old/230_world_blacktemple.sql new file mode 100644 index 0000000..3d74f7e --- /dev/null +++ b/sql/updates/2.4.3_old/230_world_blacktemple.sql @@ -0,0 +1,25 @@ +DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (39992, 39835, 42052, -41914, -41917, 41126, -41376, 39908); +-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39992, 39835, 1, 'Needle Spine'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39835, 39968, 1, 'Needle Spine'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41376, 41377, 0, 'Spite'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (41126, 41131, 1, 'Flame Crash'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41914, 41915, 0, 'Summon Parasitic Shadowfiend'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41917, 41915, 0, 'Summon Parasitic Shadowfiend'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39908, 40017, 1, 'Eye Blast'); + +-- spine +update gameobject_template set scriptname = 'go_najentus_spine' where entry = 185584; +-- molten_flame +UPDATE creature_template SET spell1 = 40980, flags_extra = 128, speed = 1.0, scriptname = 'molten_flame' WHERE entry = 23095; +-- volcano +UPDATE creature_template SET spell1 = 40117, flags_extra = 128, scriptname = '' WHERE entry = 23085; +-- flame crash +update creature_template set spell1 = 40836, flags_extra = 128, scriptname = '' where entry = 23336; +-- blaze +update creature_template set spell1 = 40610, flags_extra = 128, scriptname = '' where entry = 23259; +-- glaive +update creature_template set scriptname = 'mob_blade_of_azzinoth' where entry = 22996; +-- parasitic shadowfiend +update creature_template set scriptname = 'mob_parasitic_shadowfiend' where entry = 23498; +-- Maiev +update creature_template set minlevel = 73, maxlevel = 73, minhealth = 500000, maxhealth = 500000, mindmg = 3000, maxdmg = 4000 where entry = 23197; diff --git a/sql/updates/2.4.3_old/230_world_scripts.sql b/sql/updates/2.4.3_old/230_world_scripts.sql new file mode 100644 index 0000000..0c62a29 --- /dev/null +++ b/sql/updates/2.4.3_old/230_world_scripts.sql @@ -0,0 +1 @@ +update gameobject_template set scriptname = 'go_gilded_brazier' where entry = 181956; diff --git a/sql/updates/2.4.3_old/230_world_serpent_shrine.sql b/sql/updates/2.4.3_old/230_world_serpent_shrine.sql new file mode 100644 index 0000000..0e16bd6 --- /dev/null +++ b/sql/updates/2.4.3_old/230_world_serpent_shrine.sql @@ -0,0 +1,13 @@ +UPDATE creature_template SET ScriptName = 'boss_leotheras_the_blind' WHERE entry = '21215'; +UPDATE creature_template SET ScriptName = 'boss_leotheras_the_blind_demonform' WHERE entry = '21875'; +UPDATE creature_template SET ScriptName = 'mob_greyheart_spellbinder' WHERE entry = '21806'; +UPDATE creature_template SET ScriptName = 'mob_inner_demon' WHERE entry = '21857'; + +UPDATE creature_template SET ScriptName = 'mob_toxic_sporebat', speed = '1' WHERE entry = '22140'; +UPDATE creature_template SET modelid_A = '11686', modelid_H = '11686', flags_extra = '128' WHERE entry = '22207'; + +-- lurker +UPDATE creature_model_info SET bounding_radius = '13', combat_reach = '20' WHERE modelid = '20216'; +UPDATE creature_template SET InhabitType = '3', ScriptName = 'boss_the_lurker_below' WHERE entry = '21217'; +UPDATE creature_template SET ScriptName = 'mob_coilfang_ambusher' WHERE entry = '21865'; +UPDATE creature_template SET ScriptName = 'mob_coilfang_guardian' WHERE entry = '21873'; diff --git a/sql/updates/2.4.3_old/231_world_scripts.sql b/sql/updates/2.4.3_old/231_world_scripts.sql new file mode 100644 index 0000000..33f2e05 --- /dev/null +++ b/sql/updates/2.4.3_old/231_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_pathaleon_the_calculator' WHERE `entry`=19220; +UPDATE `creature_template` SET `ScriptName`='mob_nether_wraith' WHERE `entry`=21062; +UPDATE `instance_template` SET `script`='instance_mechanar' WHERE `map`=554; diff --git a/sql/updates/2.4.3_old/233_world.sql b/sql/updates/2.4.3_old/233_world.sql new file mode 100644 index 0000000..e77d057 --- /dev/null +++ b/sql/updates/2.4.3_old/233_world.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET `SchoolMask` = '1' WHERE `entry` = '41434'; diff --git a/sql/updates/2.4.3_old/238_world.sql b/sql/updates/2.4.3_old/238_world.sql new file mode 100644 index 0000000..6e3c03a --- /dev/null +++ b/sql/updates/2.4.3_old/238_world.sql @@ -0,0 +1 @@ +DELETE FROM trinity_string WHERE entry IN (453); diff --git a/sql/updates/2.4.3_old/240_world.sql b/sql/updates/2.4.3_old/240_world.sql new file mode 100644 index 0000000..83f3b3e --- /dev/null +++ b/sql/updates/2.4.3_old/240_world.sql @@ -0,0 +1,4 @@ +delete from `command` where `name` IN ('senditems','sendmail'); +insert into `command` (`name`, `security`, `help`) values +('senditems',3,'Syntax: .senditems #playername "#subject" "#text" itemid1[:count1] itemid2[:count2] ... itemidN[:countN]\r\n\r\nSend a mail to a player. Subject and mail text must be in "". If for itemid not provided related count values then expected 1, if count > max items in stack then items will be send in required amount stacks. All stacks amount in mail limited to 12.'), +('sendmail',1,'Syntax: .sendmail #playername "#subject" "#text"\r\n\r\nSend a mail to a player. Subject and mail text must be in "".'); diff --git a/sql/updates/2.4.3_old/241_world.sql b/sql/updates/2.4.3_old/241_world.sql new file mode 100644 index 0000000..2bc028b --- /dev/null +++ b/sql/updates/2.4.3_old/241_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE name IN ('bindsight', 'unbindsight'); +INSERT INTO `command` (name,security,help) VALUES +('bindsight',3,'Syntax: .bindsight\r\n\r\nBinds vision to the selected unit indefinitely. Cannot be used while currently possessing a target.'), +('unbindsight',3,'Syntax: .unbindsight\r\n\r\nRemoves bound vision. Cannot be used while currently possessing a target.'); diff --git a/sql/updates/2.4.3_old/247_world.sql b/sql/updates/2.4.3_old/247_world.sql new file mode 100644 index 0000000..e8fb49e --- /dev/null +++ b/sql/updates/2.4.3_old/247_world.sql @@ -0,0 +1,29 @@ +ALTER TABLE `spell_linked_spell` DROP PRIMARY KEY; + +UPDATE creature_template SET scriptname = 'boss_kalecgos' WHERE entry = 24850; +UPDATE creature_template SET scriptname = 'boss_sathrovarr' WHERE entry = 24892; +UPDATE creature_template SET scriptname = 'boss_kalec' WHERE entry = 24891; +UPDATE creature_template SET minhealth = 2018275, maxhealth = minhealth = 2018275 WHERE entry = 24892; +UPDATE creature_template SET minlevel = 73, maxlevel = 73, minhealth = 828555, maxhealth = 828555, armor = 5000, mindmg = 1000, maxdmg = 2000 WHERE entry = 24891; +UPDATE gameobject_template SET scriptname = 'kalocegos_teleporter' WHERE entry = 187055; + +INSERT INTO creature_template_addon (entry) SELECT 24891 FROM creature_template_addon WHERE NOT EXISTS(SELECT * FROM creature_template_addon WHERE entry = 24891) LIMIT 1; +INSERT INTO creature_template_addon (entry) SELECT 24892 FROM creature_template_addon WHERE NOT EXISTS(SELECT * FROM creature_template_addon WHERE entry = 24892) LIMIT 1; +UPDATE creature_template_addon SET auras = '45769 0 45769 1' WHERE entry = 24850; +UPDATE creature_template_addon SET auras = '45769 0 45769 1 44801 0 44801 1 44801 2' WHERE entry = 24891; +UPDATE creature_template_addon SET auras = '45769 0 45769 1 44801 0 44801 1 44801 2 44800 0' WHERE entry = 24892; + +DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (44869, 46648, 46019, 46021, -46021, 46020); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (44869, 44866, 1, 'Spectral Blast Portal'); +-- 46648 will cause severe lag if your video card is not good enough +-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (44869, 46648, 1, 'Spectral Blast Visual'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (44869, 46019, 1, 'Spectral Blast Teleport'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46019, 46021, 1, 'Spectral Realm Aura'); +-- 44852 makes boss friendly to you, weird +-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46021, 44852, 1, 'Spectral Realm Aura'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-46021, 46020, 0, 'Teleport: Normal Realm'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46020, 44867, 1, 'Spectral Exhaustion'); + +DELETE FROM spell_target_position WHERE `id` IN (46019, 46020); +INSERT INTO spell_target_position () VALUES (46019, 580, 1704.34, 928.17, -74.558, 0); +INSERT INTO spell_target_position () VALUES (46020, 580, 1704.34, 928.17, 53.079, 0); diff --git a/sql/updates/2.4.3_old/262_characters.sql b/sql/updates/2.4.3_old/262_characters.sql new file mode 100644 index 0000000..b3caa97 --- /dev/null +++ b/sql/updates/2.4.3_old/262_characters.sql @@ -0,0 +1,5 @@ +ALTER TABLE `guild_bank_tab` + CHANGE COLUMN `TabText` `TabText` text; + +ALTER TABLE `character_aura` ADD `stackcount` INT NOT NULL DEFAULT '1' AFTER `effect_index` ; +ALTER TABLE `pet_aura` ADD `stackcount` INT NOT NULL DEFAULT '1' AFTER `effect_index`; diff --git a/sql/updates/2.4.3_old/262_realmd.sql b/sql/updates/2.4.3_old/262_realmd.sql new file mode 100644 index 0000000..1953f19 --- /dev/null +++ b/sql/updates/2.4.3_old/262_realmd.sql @@ -0,0 +1,2 @@ +ALTER TABLE `account` + CHANGE COLUMN `email` `email` text; diff --git a/sql/updates/2.4.3_old/262_world.sql b/sql/updates/2.4.3_old/262_world.sql new file mode 100644 index 0000000..a10ddd7 --- /dev/null +++ b/sql/updates/2.4.3_old/262_world.sql @@ -0,0 +1,101 @@ +DELETE FROM trinity_string WHERE entry IN (1119,1120,1121); + +INSERT INTO trinity_string VALUES +(1119,'You must use male or female as gender.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1120,'You change gender of %s to %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1121,'Your gender changed to %s by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + + +DELETE FROM command WHERE name IN ('modify gender'); + +INSERT INTO command VALUES +('modify gender',2,'Syntax: .modify gender male/female\r\n\r\nChange gender of selected player.'); + + +delete from `command` where `name` IN ('senditems','sendmail'); +insert into `command` (`name`, `security`, `help`) values +('senditems',3,'Syntax: .senditems #playername "#subject" "#text" itemid1[:count1] itemid2[:count2] ... itemidN[:countN]\r\n\r\nSend a mail to a player. Subject and mail text must be in "". If for itemid not provided related count values then expected 1, if count > max items in stack then items will be send in required amount stacks. All stacks amount in mail limited to 12.'), +('sendmail',1,'Syntax: .sendmail #playername "#subject" "#text"\r\n\r\nSend a mail to a player. Subject and mail text must be in "".'); + + +delete from `command` where `name` = 'sendmoney'; +insert into `command` (`name`, `security`, `help`) values +('sendmoney',3,'Syntax: .sendmoney #playername "#subject" "#text" #money\r\n\r\nSend mail with money to a player. Subject and mail text must be in "".'); + + +DELETE FROM trinity_string WHERE entry IN (453); + + +DROP TABLE IF EXISTS `db_script_string`; +CREATE TABLE `db_script_string` ( + `entry` int(11) unsigned NOT NULL default '0', + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + +DELETE FROM `command` WHERE `name` IN ( + 'server exit', + 'server idleshutdown', + 'server idleshutdown cancel', + 'server idlerestart', + 'server idlerestart cancel', + 'server restart', + 'server restart cancel', + 'server shutdown', + 'server shutdown cancel' +); + +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('server exit',4,'Syntax: .server exit\r\n\r\nTerminate trinity-core NOW. Exit code 0.'), +('server idleshutdown',3,'Syntax: .server idleshutdown #delay [#exist_code]\r\n\r\nShut the server down after #delay seconds if no active connections are present (no players). Use #exist_code or 0 as program exist code.'), +('server idleshutdown cancel',3,'Syntax: .server idleshutdown cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('server idlerestart',3,'Syntax: .server idlerestart #delay\r\n\r\nRestart the server after #delay seconds if no active connections are present (no players). Use #exist_code or 2 as program exist code.'), +('server idlerestart cancel',3,'Syntax: .server idlerestart cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('server restart',3,'Syntax: .server restart #delay\r\n\r\nRestart the server after #delay seconds. Use #exist_code or 2 as program exist code.'), +('server restart cancel',3,'Syntax: .server restart cancel\r\n\r\nCancel the restart/shutdown timer if any.'), +('server shutdown',3,'Syntax: .server shutdown #delay [#exist_code]\r\n\r\nShut the server down after #delay seconds. Use #exist_code or 0 as program exist code.'), +('server shutdown cancel',3,'Syntax: .server shutdown cancel\r\n\r\nCancel the restart/shutdown timer if any.'); + +DELETE FROM trinity_string WHERE entry IN (251); +INSERT INTO trinity_string VALUES +(251,'Text%d (ID: %i): %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +ALTER TABLE event_scripts + DROP datatext, + ADD COLUMN dataint int(11) NOT NULL default '0' AFTER datalong2; + +ALTER TABLE gameobject_scripts + DROP datatext, + ADD COLUMN dataint int(11) NOT NULL default '0' AFTER datalong2; + +ALTER TABLE quest_end_scripts + DROP datatext, + ADD COLUMN dataint int(11) NOT NULL default '0' AFTER datalong2; + +ALTER TABLE quest_start_scripts + DROP datatext, + ADD COLUMN dataint int(11) NOT NULL default '0' AFTER datalong2; + +ALTER TABLE spell_scripts + DROP datatext, + ADD COLUMN dataint int(11) NOT NULL default '0' AFTER datalong2; + +ALTER TABLE creature_movement + DROP `text1`, + DROP `text2`, + DROP `text3`, + DROP `text4`, + DROP `text5`, + ADD COLUMN textid1 int(11) NOT NULL default '0' AFTER waittime, + ADD COLUMN textid2 int(11) NOT NULL default '0' AFTER textid1, + ADD COLUMN textid3 int(11) NOT NULL default '0' AFTER textid2, + ADD COLUMN textid4 int(11) NOT NULL default '0' AFTER textid3, + ADD COLUMN textid5 int(11) NOT NULL default '0' AFTER textid4; diff --git a/sql/updates/2.4.3_old/273_world_scripts.sql b/sql/updates/2.4.3_old/273_world_scripts.sql new file mode 100644 index 0000000..3cda7ad --- /dev/null +++ b/sql/updates/2.4.3_old/273_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_wounded_blood_elf' WHERE `entry`='16993'; +UPDATE `creature_template` SET `ScriptName` = 'mob_phase_hunter' WHERE `entry` = '18879'; diff --git a/sql/updates/2.4.3_old/285_world.sql b/sql/updates/2.4.3_old/285_world.sql new file mode 100644 index 0000000..39451ec --- /dev/null +++ b/sql/updates/2.4.3_old/285_world.sql @@ -0,0 +1,37 @@ +-- `trinity_string` Language.h entries + +DELETE FROM `trinity_string` WHERE `entry` > 716 AND `entry` < 750; +INSERT INTO `trinity_string` VALUES +(717,'Alliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(718,'Horde',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(719,'%s was destroyed by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(720,'The %s is under attack! If left unchecked, the %s will destroy it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(721,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(722,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(723,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(724,'The %s is under attack! If left unchecked, the %s will capture it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(725,'The %s has taken the %s! Its supplies will now be used for reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(726,'Irondeep Mine',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(727,'Coldtooth Mine',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(728,'Stormpike Aid Station',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(729,'Dun Baldar South Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(730,'Dun Baldar North Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(731,'Stormpike Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(732,'Icewing Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(733,'Stonehearth Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(734,'Stonehearth Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(735,'Snowfall Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(736,'Iceblood Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(737,'Iceblood Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(738,'Tower Point',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(739,'Frostwolf Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(740,'East Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(741,'West Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(742,'Frostwolf Relief Hut',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(743,'The Battle for Alterac Valley begins in 1 minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(744,'The Battle for Alterac Valley begins in 30 seconds. Prepare yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(745,'The Battle for Alterac Valley has begun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(746,'The Alliance Team is running out of reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(747,'The Horde Team is running out of reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(748,'The Frostwolf General is Dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(749,'The Stormpike General is Dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/2.4.3_old/287_world_scripts.sql b/sql/updates/2.4.3_old/287_world_scripts.sql new file mode 100644 index 0000000..6e3deee --- /dev/null +++ b/sql/updates/2.4.3_old/287_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_steam_tonk' WHERE `entry` = '19405'; +UPDATE `creature_template` SET `ScriptName` = 'npc_tonk_mine' WHERE `entry` = '15368'; diff --git a/sql/updates/2.4.3_old/329_world.sql b/sql/updates/2.4.3_old/329_world.sql new file mode 100644 index 0000000..33f6141 --- /dev/null +++ b/sql/updates/2.4.3_old/329_world.sql @@ -0,0 +1,585 @@ +DROP TABLE IF EXISTS `spell_proc_event`; + +SET FOREIGN_KEY_CHECKS=0; +-- ---------------------------- +-- Table structure for spell_proc_event +-- ---------------------------- +CREATE TABLE `spell_proc_event` ( + `entry` smallint(6) unsigned NOT NULL default '0', + `SchoolMask` tinyint(4) NOT NULL default '0', + `SpellFamilyName` smallint(6) unsigned NOT NULL default '0', + `SpellFamilyMask` bigint(40) unsigned NOT NULL default '0', + `procFlags` int(10) unsigned NOT NULL default '0', + `procEx` int(10) unsigned NOT NULL default '0', + `ppmRate` float NOT NULL default '0', + `CustomChance` float NOT NULL default '0', + `Cooldown` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records +-- ---------------------------- +INSERT INTO `spell_proc_event` VALUES ('9452', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34917', '32', '6', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34916', '32', '6', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34914', '32', '6', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29076', '20', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29075', '20', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29074', '20', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12704', '0', '0', '0', '0', '0', '1.6626', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12289', '0', '4', '2', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12311', '0', '4', '2048', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28849', '0', '11', '128', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28847', '0', '7', '32', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28823', '0', '11', '192', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28809', '0', '6', '4096', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28719', '0', '7', '32', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12668', '0', '4', '2', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12703', '0', '0', '0', '0', '0', '1.33008', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12702', '0', '0', '0', '0', '0', '0.99756', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12701', '0', '0', '0', '0', '0', '0.66504', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12284', '0', '0', '0', '0', '0', '0.33252', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12797', '0', '4', '1024', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12799', '0', '4', '1024', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12800', '0', '4', '1024', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28595', '16', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28594', '16', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28593', '16', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12958', '0', '4', '2048', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13754', '0', '8', '16', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13867', '0', '8', '16', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14186', '0', '8', '1082131720', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14190', '0', '8', '9672066312', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14193', '0', '8', '9672066312', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14194', '0', '8', '9672066312', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14195', '0', '8', '9672066312', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28592', '16', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23721', '0', '9', '2048', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15277', '0', '0', '0', '0', '0', '6', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23572', '0', '11', '192', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23551', '0', '11', '192', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20235', '0', '10', '32768', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20234', '0', '10', '32768', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19415', '0', '9', '512', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15346', '0', '0', '0', '0', '0', '6', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19414', '0', '9', '512', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19413', '0', '9', '512', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15600', '0', '0', '0', '0', '0', '1', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19412', '0', '9', '512', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16850', '0', '7', '4', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16864', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16923', '0', '7', '4', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16924', '0', '7', '4', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16952', '0', '7', '4398046744576', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16954', '0', '7', '4398046744576', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19407', '0', '9', '512', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18096', '0', '5', '549755813984', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18073', '0', '5', '549755813984', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17793', '0', '5', '1', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17796', '0', '5', '1', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17801', '0', '5', '1', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18095', '0', '5', '10', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18094', '0', '5', '10', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17802', '0', '5', '1', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18119', '0', '5', '18416819766245', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18120', '0', '5', '18416819766245', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18121', '0', '5', '18416819766245', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18122', '0', '5', '18416819766245', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18123', '0', '5', '18416819766245', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19228', '0', '0', '64', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19232', '0', '9', '64', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19233', '0', '9', '64', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17803', '0', '5', '1', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16164', '0', '11', '2416967683', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15363', '0', '6', '17448312320', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15362', '0', '6', '17448312320', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15326', '0', '6', '8691163136', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20164', '0', '0', '0', '0', '0', '5', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20165', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20166', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20215', '0', '10', '3223322624', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20214', '0', '10', '3223322624', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20213', '0', '10', '3223322624', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20212', '0', '10', '3223322624', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20210', '0', '10', '3223322624', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15325', '0', '6', '8691163136', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15324', '0', '6', '8691163136', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20347', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20348', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20349', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20356', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20357', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20375', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20500', '0', '4', '268435456', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20501', '0', '4', '268435456', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20915', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20918', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20919', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20920', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('21890', '0', '4', '3763103747823', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15323', '0', '6', '8691163136', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15286', '32', '6', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23578', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23581', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23686', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23689', '0', '0', '0', '0', '0', '4', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23695', '0', '4', '2', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15268', '0', '6', '8691163136', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('25669', '0', '0', '0', '0', '0', '1', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26016', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26021', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26119', '0', '10', '2416967683', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26480', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27160', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27166', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27170', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27419', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27498', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27656', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27787', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14892', '0', '6', '17448312320', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12848', '4', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12847', '4', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12846', '4', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('11255', '0', '3', '16384', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28789', '0', '10', '3221225472', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12360', '4', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28816', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12359', '4', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12358', '4', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12357', '4', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12598', '0', '3', '16384', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('11180', '16', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('11129', '0', '3', '274890489879', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29150', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29501', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29624', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29625', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29626', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29632', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29633', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29634', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29635', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29636', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29637', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30299', '36', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30675', '0', '11', '3', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30678', '0', '11', '3', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30679', '0', '11', '3', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30680', '0', '11', '3', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30681', '0', '11', '3', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31801', '0', '0', '0', '0', '0', '20', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31833', '0', '10', '2147483648', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31835', '0', '10', '2147483648', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31836', '0', '10', '2147483648', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30302', '36', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30301', '36', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32385', '0', '5', '73014445058', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32387', '0', '5', '73014445058', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32392', '0', '5', '73014445058', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32393', '0', '5', '73014445058', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32394', '0', '5', '73014445058', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('11120', '4', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('11119', '4', '3', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('11103', '4', '3', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37195', '0', '10', '8388608', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37377', '32', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('39437', '4', '5', '824633725796', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33191', '0', '6', '4398054932480', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33192', '0', '6', '4398054932480', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33193', '0', '6', '4398054932480', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33194', '0', '6', '4398054932480', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33195', '0', '6', '4398054932480', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40475', '0', '0', '0', '0', '0', '3', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('41434', '0', '0', '0', '0', '0', '2', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('37523', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30293', '0', '5', '824633721729', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30295', '0', '5', '824633721729', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30296', '0', '5', '824633721729', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40407', '0', '0', '0', '0', '0', '6', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31895', '0', '0', '0', '0', '0', '5', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37247', '8', '0', '0', '0', '65536', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('33510', '0', '0', '0', '0', '0', '5', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16624', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28752', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16176', '0', '11', '448', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16235', '0', '11', '448', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16240', '0', '11', '448', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23920', '0', '0', '0', '0', '2048', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27811', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27815', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27816', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33142', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33145', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33146', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16487', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16489', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16492', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26605', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16550', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('22648', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34320', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29977', '0', '3', '274890489879', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37443', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('38350', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('38347', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12834', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12849', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12867', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30160', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29179', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29180', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12317', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13045', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13046', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13047', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13048', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34500', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34502', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34503', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('9799', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('25988', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29062', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29064', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29065', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15088', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12319', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16256', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12971', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16281', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12972', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16282', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12973', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16283', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12974', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16284', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('42083', '0', '0', '0', '0', '2', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('34950', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34954', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28812', '0', '8', '33554438', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37227', '0', '11', '448', '0', '2', '0', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('32885', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('21882', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34258', '0', '10', '34359739392', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37237', '0', '11', '1', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37657', '0', '0', '0', '0', '2', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('40482', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37213', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14531', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14774', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16880', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('35121', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20705', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16958', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16961', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33648', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37189', '0', '10', '3221225472', '0', '2', '0', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('43338', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33150', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33154', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34497', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34498', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34499', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30802', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30808', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30809', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30810', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30811', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20049', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20056', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20057', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20058', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20059', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37519', '0', '0', '0', '0', '48', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26107', '0', '7', '549764202496', '0', '116', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23548', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37514', '0', '0', '0', '0', '32', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40444', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20911', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20912', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20913', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20914', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27168', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17495', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('22618', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('25899', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27169', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31904', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32777', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20925', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20927', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20928', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27179', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12298', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12724', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12725', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12726', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12727', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32642', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33089', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26128', '0', '0', '0', '0', '8', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29441', '0', '0', '0', '0', '8', '0', '0', '1'); +INSERT INTO `spell_proc_event` VALUES ('29444', '0', '0', '0', '0', '8', '0', '0', '1'); +INSERT INTO `spell_proc_event` VALUES ('29445', '0', '0', '0', '0', '8', '0', '0', '1'); +INSERT INTO `spell_proc_event` VALUES ('29446', '0', '0', '0', '0', '8', '0', '0', '1'); +INSERT INTO `spell_proc_event` VALUES ('29447', '0', '0', '0', '0', '8', '0', '0', '1'); +INSERT INTO `spell_proc_event` VALUES ('34749', '0', '0', '0', '0', '8', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13983', '0', '0', '0', '0', '24', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14070', '0', '0', '0', '0', '24', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14071', '0', '0', '0', '0', '24', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('41034', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32734', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('974', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('32593', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('32594', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('40899', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('324', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('325', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('905', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('945', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('8134', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('10431', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('10432', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('25469', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('25472', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('34355', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('39027', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('34827', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('24398', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('33736', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('41260', '0', '0', '0', '0', '0', '0', '0', '10'); +INSERT INTO `spell_proc_event` VALUES ('41262', '0', '0', '0', '0', '0', '0', '0', '10'); +INSERT INTO `spell_proc_event` VALUES ('34935', '0', '0', '0', '0', '0', '0', '0', '8'); +INSERT INTO `spell_proc_event` VALUES ('34938', '0', '0', '0', '0', '0', '0', '0', '8'); +INSERT INTO `spell_proc_event` VALUES ('34939', '0', '0', '0', '0', '0', '0', '0', '8'); +INSERT INTO `spell_proc_event` VALUES ('33746', '0', '0', '0', '0', '0', '0', '0', '10'); +INSERT INTO `spell_proc_event` VALUES ('33759', '0', '0', '0', '0', '0', '0', '0', '10'); +INSERT INTO `spell_proc_event` VALUES ('16620', '0', '0', '0', '0', '0', '0', '0', '30'); +INSERT INTO `spell_proc_event` VALUES ('21185', '0', '0', '0', '0', '0', '0', '0', '10'); +INSERT INTO `spell_proc_event` VALUES ('29801', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30030', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30033', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30701', '28', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30705', '28', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43748', '0', '11', '2416967680', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43750', '0', '11', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('42370', '0', '11', '64', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30881', '0', '0', '0', '0', '0', '0', '0', '5'); +INSERT INTO `spell_proc_event` VALUES ('30883', '0', '0', '0', '0', '0', '0', '0', '5'); +INSERT INTO `spell_proc_event` VALUES ('30884', '0', '0', '0', '0', '0', '0', '0', '5'); +INSERT INTO `spell_proc_event` VALUES ('30885', '0', '0', '0', '0', '0', '0', '0', '5'); +INSERT INTO `spell_proc_event` VALUES ('30886', '0', '0', '0', '0', '0', '0', '0', '5'); +INSERT INTO `spell_proc_event` VALUES ('34138', '0', '11', '128', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43728', '0', '11', '128', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('26135', '0', '10', '8388608', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43745', '0', '10', '2199023255552', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34139', '0', '10', '1073741824', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43741', '0', '10', '2147483648', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('42368', '0', '10', '1073741824', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34262', '0', '10', '8388608', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('41469', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33127', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29385', '0', '0', '0', '0', '0', '7', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43726', '0', '10', '1073741824', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('35100', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('35102', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('35103', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40485', '0', '9', '4294967296', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31124', '0', '8', '536870926', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31126', '0', '8', '536870926', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31233', '0', '8', '38658768896', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31239', '0', '8', '38658768896', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31240', '0', '8', '38658768896', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31241', '0', '8', '38658768896', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31242', '0', '8', '38658768896', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37168', '0', '8', '38658768896', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37170', '0', '0', '0', '0', '0', '1', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37165', '0', '8', '2098176', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31244', '0', '8', '38658768896', '0', '4', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31245', '0', '8', '38658768896', '0', '4', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('41393', '0', '0', '0', '0', '32', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14156', '0', '8', '4063232', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14160', '0', '8', '4063232', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14161', '0', '8', '4063232', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('38326', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17106', '0', '7', '524288', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17107', '0', '7', '524288', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17108', '0', '7', '524288', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43739', '0', '7', '2', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43737', '0', '7', '4672924418048', '0', '0', '0', '0', '10'); +INSERT INTO `spell_proc_event` VALUES ('39372', '48', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37568', '0', '6', '2048', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37594', '0', '6', '4096', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34753', '0', '6', '17179875328', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34859', '0', '6', '17179875328', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34860', '0', '6', '17179875328', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37603', '0', '6', '32768', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('38394', '0', '5', '6', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37384', '0', '5', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40478', '0', '5', '2', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37528', '0', '4', '4', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37516', '0', '4', '1024', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40458', '0', '4', '6601398288384', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('22007', '0', '3', '2097185', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('3232', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17364', '8', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30937', '32', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('15128', '4', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37193', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32776', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20132', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20131', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20128', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17794', '32', '0', '0', '0', '1', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31394', '32', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('25050', '4', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('24353', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20134', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17797', '32', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17798', '32', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('24389', '0', '3', '274890489879', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('20133', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('36111', '0', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29455', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34774', '0', '0', '0', '0', '0', '1.5', '0', '20'); +INSERT INTO `spell_proc_event` VALUES ('9784', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31785', '0', '0', '0', '34816', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('9782', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('24932', '0', '0', '0', '0', '2', '0', '0', '6'); +INSERT INTO `spell_proc_event` VALUES ('33776', '0', '0', '0', '34816', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34586', '0', '0', '0', '0', '0', '1.5', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('2565', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12169', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32587', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('38031', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34080', '0', '0', '0', '0', '8', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('42136', '0', '0', '0', '0', '0', '0', '0', '90'); +INSERT INTO `spell_proc_event` VALUES ('42135', '0', '0', '0', '0', '0', '0', '0', '90'); +INSERT INTO `spell_proc_event` VALUES ('23547', '0', '0', '0', '0', '32', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32837', '0', '0', '0', '0', '65536', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('17799', '32', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('17800', '32', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37197', '0', '0', '0', '0', '65536', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('23688', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('34783', '0', '0', '0', '0', '2048', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27521', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27774', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28802', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37600', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19184', '0', '9', '35184372088852', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19387', '0', '9', '35184372088852', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19388', '0', '9', '35184372088852', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37655', '0', '0', '0', '0', '0', '0', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('38334', '0', '0', '0', '0', '0', '0', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('12966', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12967', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12968', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12969', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12970', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16257', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16277', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16278', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16279', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('16280', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('36096', '0', '0', '0', '0', '2048', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43443', '0', '0', '0', '0', '2048', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30003', '0', '0', '0', '0', '2048', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27181', '1', '0', '0', '0', '256', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('41381', '0', '0', '0', '0', '256', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('38026', '1', '0', '0', '0', '256', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31569', '0', '3', '65536', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31570', '0', '3', '65536', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('7383', '1', '0', '0', '0', '256', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('39530', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33299', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37214', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('31794', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('18820', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('37601', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('43819', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('6346', '0', '0', '0', '0', '256', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23552', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('46025', '0', '0', '0', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40442', '0', '7', '4672924418068', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40470', '0', '10', '3229614080', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40438', '0', '6', '32832', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('40463', '0', '11', '68719476865', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12322', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12999', '0', '0', '0', '0', '0', '4', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13000', '0', '0', '0', '0', '0', '6', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13001', '0', '0', '0', '0', '0', '8', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13002', '0', '0', '0', '0', '0', '10', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14318', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('13165', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14319', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14320', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14321', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('14322', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('25296', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27044', '0', '9', '1', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('39443', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('39442', '0', '0', '0', '0', '1', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('35080', '0', '0', '0', '0', '0', '1', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('35077', '0', '0', '0', '0', '0', '0', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('35086', '0', '0', '0', '0', '0', '0', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('35083', '0', '0', '0', '0', '0', '0', '0', '60'); +INSERT INTO `spell_proc_event` VALUES ('18137', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('19308', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('19309', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('19310', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('19311', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('19312', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('25477', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('38327', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33881', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33882', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33883', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33719', '0', '0', '0', '0', '2048', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29834', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('29838', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('39958', '0', '0', '0', '0', '0', '0.7', '0', '40'); +INSERT INTO `spell_proc_event` VALUES ('1463', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('8494', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('8495', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('10191', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('10192', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('10193', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('27131', '0', '0', '0', '0', '1024', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('32844', '0', '0', '0', '0', '0', '2', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33076', '0', '0', '0', '656040', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('46662', '0', '0', '0', '0', '0', '0', '0', '20'); +INSERT INTO `spell_proc_event` VALUES ('38857', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('8178', '0', '0', '0', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('41635', '0', '0', '0', '656040', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('30823', '0', '0', '0', '0', '0', '10.5', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('24905', '0', '0', '0', '0', '0', '15', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('46098', '0', '11', '128', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('46092', '0', '10', '1073741824', '0', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('38290', '0', '0', '0', '0', '0', '1.6', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('45234', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('45243', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('45244', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('23602', '0', '0', '0', '0', '64', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('45483', '0', '0', '0', '0', '0', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('45482', '0', '0', '0', '0', '0', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('45484', '0', '0', '0', '16384', '0', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('46569', '0', '0', '0', '0', '0', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('45481', '0', '0', '0', '0', '0', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('32748', '0', '8', '4294967296', '320', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('24658', '0', '0', '0', '82192', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('44835', '0', '7', '549755813888', '16', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('46832', '0', '7', '1', '0', '65536', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('45057', '0', '0', '0', '0', '0', '0', '0', '30'); +INSERT INTO `spell_proc_event` VALUES ('37173', '0', '8', '1126031951256', '0', '0', '0', '0', '30'); +INSERT INTO `spell_proc_event` VALUES ('45054', '0', '0', '0', '0', '0', '0', '0', '15'); +INSERT INTO `spell_proc_event` VALUES ('45354', '0', '0', '0', '0', '0', '0', '0', '45'); +INSERT INTO `spell_proc_event` VALUES ('41989', '0', '0', '0', '0', '0', '0.5', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('11185', '0', '3', '128', '327680', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12487', '0', '3', '128', '327680', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19572', '0', '9', '8388608', '16384', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28716', '0', '7', '16', '294912', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('28744', '0', '7', '64', '278528', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('12488', '0', '3', '128', '327680', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('19573', '0', '9', '8388608', '16384', '0', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33757', '0', '0', '0', '0', '0', '0', '0', '3'); diff --git a/sql/updates/2.4.3_old/332_world.sql b/sql/updates/2.4.3_old/332_world.sql new file mode 100644 index 0000000..58d1f66 --- /dev/null +++ b/sql/updates/2.4.3_old/332_world.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_script_target` WHERE `entry` in (30659); +INSERT INTO `spell_script_target` VALUES (30659, 1, 17281); diff --git a/sql/updates/2.4.3_old/333_world.sql b/sql/updates/2.4.3_old/333_world.sql new file mode 100644 index 0000000..9bd405e --- /dev/null +++ b/sql/updates/2.4.3_old/333_world.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (42083, 33727, 33754, 33755, 33756, 8516, 10608, 10610, 25583, 25584); +INSERT INTO `spell_proc_event` VALUES ('42083', '0', '0', '0', '0', '2', '0', '0', '0'); +INSERT INTO `spell_proc_event` VALUES ('33727', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('33754', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('33755', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('33756', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('8516', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('10608', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('10610', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('25583', '0', '0', '0', '0', '0', '0', '0', '3'); +INSERT INTO `spell_proc_event` VALUES ('25584', '0', '0', '0', '0', '0', '0', '0', '3'); diff --git a/sql/updates/2.4.3_old/334_world.sql b/sql/updates/2.4.3_old/334_world.sql new file mode 100644 index 0000000..719d522 --- /dev/null +++ b/sql/updates/2.4.3_old/334_world.sql @@ -0,0 +1,20 @@ +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 770 AND 787; +INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`) VALUES +(770,'Your group has members not in your arena team. Please regroup to join.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(771,'Your group does not have enough players to join this match.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(772,'The Gold Team wins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(773,'The Green Team wins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(774,'There aren\'t enough players in this battleground. It will end soon unless some more players join to balance the fight.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(775,'Your group has an offline member. Please remove him before joining.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(776,'Your group has players from the opposing faction. You can\'t join the battleground as a group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(777,'Your group has players from different battleground brakets. You can\'t join as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(778,'Someone in your party is already in this battleground queue. (S)he must leave it before joining as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(779,'Someone in your party is Deserter. You can\'t join as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(780,'Someone in your party is already in three battleground queues. You cannot join as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(781,'You cannot teleport to a battleground or arena map.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(782,'You cannot summon players to a battleground or arena map.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(783,'You must be in GM mode to teleport to a player in a battleground.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(784,'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(785,'Arena testing turned %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(786,'|cffff0000[Automatic]:|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(787,'|cffffff00[|c1f40af20Announce by|r |cffff0000%s|cffffff00]:|r %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/2.4.3_old/341_world.sql b/sql/updates/2.4.3_old/341_world.sql new file mode 100644 index 0000000..248224f --- /dev/null +++ b/sql/updates/2.4.3_old/341_world.sql @@ -0,0 +1 @@ +TRUNCATE TABLE playercreateinfo_item; diff --git a/sql/updates/2.4.3_old/356_world.sql b/sql/updates/2.4.3_old/356_world.sql new file mode 100644 index 0000000..9db8a85 --- /dev/null +++ b/sql/updates/2.4.3_old/356_world.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_elixir` WHERE `entry` = 45373; +INSERT INTO `spell_elixir` VALUES (45373,0x1); diff --git a/sql/updates/2.4.3_old/373_world_scripts.sql b/sql/updates/2.4.3_old/373_world_scripts.sql new file mode 100644 index 0000000..db27ebe --- /dev/null +++ b/sql/updates/2.4.3_old/373_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_warchief_kargath_bladefist' WHERE `entry`=16808; +UPDATE `instance_template` SET `script`='instance_deadmines' WHERE `map`=36; +UPDATE `item_template` SET `ScriptName`='item_defias_gunpowder' WHERE `entry`=5397; diff --git a/sql/updates/2.4.3_old/377_world_scripts.sql b/sql/updates/2.4.3_old/377_world_scripts.sql new file mode 100644 index 0000000..fe93962 --- /dev/null +++ b/sql/updates/2.4.3_old/377_world_scripts.sql @@ -0,0 +1,10 @@ +UPDATE `creature_template` SET `ScriptName`='npc_second_trial_paladin' WHERE `entry` IN (17809,17810,17811,17812); +UPDATE `creature_template` SET `ScriptName`='npc_second_trial_controller' WHERE `entry` IN (17807); +UPDATE `gameobject_template` SET `ScriptName`='go_second_trial' WHERE `entry` IN (182052); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1645009 AND -1645006; +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `comment`) VALUES +(-1645006,'Let the trial begin, Bloodwrath, attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,'master_kelerun_bloodmourn YELL_PHASE'), +(-1645007,'Champion Lightrend, make me proud!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,'master_kelerun_bloodmourn YELL_PHASE'), +(-1645008,'Show this upstart how a real Blood Knight fights, Swiftblade!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,'master_kelerun_bloodmourn YELL_PHASE'), +(-1645009,'Show $N the meaning of pain, Sunstriker!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,'master_kelerun_bloodmourn YELL_PHASE'); diff --git a/sql/updates/2.4.3_old/389_world.sql b/sql/updates/2.4.3_old/389_world.sql new file mode 100644 index 0000000..8909414 --- /dev/null +++ b/sql/updates/2.4.3_old/389_world.sql @@ -0,0 +1,9 @@ +DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (-19386, -24132, -24133, -27068, -49011, -49012); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-19386, 24131, 0, 'Wyvern Sting'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-24132, 24134, 0, 'Wyvern Sting'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-24133, 24135, 0, 'Wyvern Sting'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-27068, 27069, 0, 'Wyvern Sting'); +-- Rank 5 (not available till wotlk) +-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-49011, 49009, 0, 'Wyvern Sting'); +-- Rank 6 (not available till wotlk) +-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-49012, 49010, 0, 'Wyvern Sting'); diff --git a/sql/updates/2.4.3_old/400_world.sql b/sql/updates/2.4.3_old/400_world.sql new file mode 100644 index 0000000..a2f7d1e --- /dev/null +++ b/sql/updates/2.4.3_old/400_world.sql @@ -0,0 +1,10 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (34186, 42492, 33831, 5628, 45109, 45149); +INSERT INTO `spell_script_target` VALUES (34186, 1, 16938); +INSERT INTO `spell_script_target` VALUES (42492, 1, 0); +INSERT INTO `spell_script_target` VALUES (33831, 1, 0); +INSERT INTO `spell_script_target` VALUES (5628, 1, 2011); +INSERT INTO `spell_script_target` VALUES (5628, 1, 2012); +INSERT INTO `spell_script_target` VALUES (5628, 1, 2013); +INSERT INTO `spell_script_target` VALUES (5628, 1, 2014); +INSERT INTO `spell_script_target` VALUES (45109, 1, 25084); +INSERT INTO `spell_script_target` VALUES (45149, 0, 300154); diff --git a/sql/updates/2.4.3_old/410_characters.sql b/sql/updates/2.4.3_old/410_characters.sql new file mode 100644 index 0000000..483b991 --- /dev/null +++ b/sql/updates/2.4.3_old/410_characters.sql @@ -0,0 +1,2 @@ +ALTER TABLE `guild_member` DROP INDEX `guid_key` , +ADD UNIQUE `guid_key` ( `guid` ); diff --git a/sql/updates/2.4.3_old/426_world_scripts.sql b/sql/updates/2.4.3_old/426_world_scripts.sql new file mode 100644 index 0000000..fde6ee6 --- /dev/null +++ b/sql/updates/2.4.3_old/426_world_scripts.sql @@ -0,0 +1,13 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_altar_of_the_keepers' WHERE `entry`=130511; +UPDATE `gameobject_template` SET `ScriptName`='go_altar_of_archaedas' WHERE `entry`=133234; + +UPDATE `instance_template` SET `script`='instance_uldaman' WHERE `map`=70; + +-- Archaedas +UPDATE `creature_template` SET `ScriptName`='boss_archaedas' WHERE `entry`=2748; + +-- Archaedas' minions +UPDATE `creature_template` SET `ScriptName`='mob_archaedas_minions' WHERE `entry` IN ('7309', '7077', '7076', '10120'); + +-- Stone keepers +UPDATE `creature_template` SET `ScriptName`='mob_stonekeepers' WHERE `entry`=4857; diff --git a/sql/updates/2.4.3_old/427_world_scripts.sql b/sql/updates/2.4.3_old/427_world_scripts.sql new file mode 100644 index 0000000..b6fe5fb --- /dev/null +++ b/sql/updates/2.4.3_old/427_world_scripts.sql @@ -0,0 +1,57 @@ +UPDATE `instance_template` SET `script`='instance_scarlet_monastery' WHERE `map`='189'; +UPDATE `gameobject_template` SET `ScriptName`='go_loosely_turned_soil' WHERE `entry`='186314'; + +UPDATE `creature_template` SET `ScriptName`='boss_headless_horseman', +`minlevel`=70, `maxlevel`=70, `minhealth`=67068, `maxhealth`=67068, +`minmana`=3155, `maxmana`=3155, `type`=6 + WHERE `entry` = 23682; + +UPDATE `creature_template` SET `ScriptName`='mob_head', + `minlevel`=70, `maxlevel`=70, `type`=6, `modelid_h`=21908, +`minhealth`=24300, `maxhealth`=24300, +`faction_A`=14, `faction_H`=14 +WHERE `entry` = 23775; + +UPDATE `creature_template` SET `ScriptName`='mob_pulsing_pumpkin', +`faction_A`=14, `faction_H`=14, `type`=6, +`minlevel`=70, `maxlevel`=70, +`minhealth`=9781, `maxhealth`=9781, +`minmana`=3155, `maxmana`=3155 +WHERE `entry` = 23694; + +-- helper +UPDATE `creature_template` SET `ScriptName`='mob_wisp_invis', +`faction_A`=35, `faction_H`=35, +`unit_flags`='33554434' WHERE `entry`='23686'; + +-- pumpkin fiend +UPDATE `creature_template` SET + `minlevel`=70, `maxlevel`=70, +`faction_A`=14, `faction_H`=14, +`type`=6 +WHERE `entry`='23545'; + +-- wisp +UPDATE `creature_template` SET `ScriptName`='mob_wisp_invis', +`modelid_a`=21342, `modelid_h`=21342, +`faction_A`=35, `faction_H`=35, `unit_flags`='33554434' +WHERE `entry`='24034'; + +UPDATE `creature_template` SET `equipment_id`=23682 WHERE `entry` = 23682; +replace into`creature_equip_template` (`entry`, `equipmodel1`, `equipmodel2`, `equipmodel3`, `equipinfo1`, `equipinfo2`, `equipinfo3`, `equipslot1`, `equipslot2`, `equipslot3`) +VALUES (23682, 50495, 0, 0, 33490690, 0, 0, 781, 0, 0); + +REPLACE INTO `script_texts` VALUES +(-1189001, 'It is over, your search is done! Let fate choose now, the righteous one',0,0,0,0,0,0,0,0,11961,1,0,'Headless Horseman SAY_ENTRANCE'), + +(-1189002, 'Here\'s my body, fit and pure! Now, your blackened souls I\'ll cure!',0,0,0,0,0,0,0,0,12567,1,0,'Headless Horseman SAY_REJOINED'), + +(-1189003, 'Over here, you idiot!',0,0,0,0,0,0,0,0,12569,1,0,'Headless Horseman SAY_LOST_HEAD'), + +(-1189004, 'Harken, cur! Tis you I spurn! Now, $N, feel the burn!',0,0,0,0,0,0,0,0,12573,1,0,'Headless Horseman SAY_CONFLAGRATION'), + +(-1189005, 'Soldiers arise, stand and fight! Bring victory at last to this fallen knight!',0,0,0,0,0,0,0,0,11963,1,0,'Headless Horseman SAY_SPROUTING_PUMPKINS'), + +(-1189006, 'Your body lies beaten, battered and broken. Let my curse be your own, fate has spoken',0,0,0,0,0,0,0,0,11962,0,0,'Headless Horseman SAY_PLAYER_DEATH'), + +(-1189007, 'This end have I reached before. What new adventure lies in store?',0,0,0,0,0,0,0,0,11964,0,0,'Headless Horseman SAY_DEATH'); diff --git a/sql/updates/2.4.3_old/444_world.sql b/sql/updates/2.4.3_old/444_world.sql new file mode 100644 index 0000000..004cf62 --- /dev/null +++ b/sql/updates/2.4.3_old/444_world.sql @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS `waypoint_data`; + +CREATE TABLE `waypoint_data` ( + `id` int(10) unsigned NOT NULL default '0' COMMENT 'Creature GUID', + `point` mediumint(8) unsigned NOT NULL default '0', + `position_x` float NOT NULL default '0', + `position_y` float NOT NULL default '0', + `position_z` float NOT NULL default '0', + `delay` int(10) unsigned NOT NULL default '0', + `move_flag` tinyint(1) NOT NULL default '0', + `action` int(11) NOT NULL default '0', + `action_chance` smallint(3) NOT NULL default '100', + `wpguid` int(11) NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `waypoint_scripts`; + +CREATE TABLE `waypoint_scripts` ( + `id` int(11) unsigned NOT NULL default '0', + `delay` int(11) unsigned NOT NULL default '0', + `command` int(11) unsigned NOT NULL default '0', + `datalong` int(11) unsigned NOT NULL default '0', + `datalong2` int(11) unsigned NOT NULL default '0', + `dataint` int(11) unsigned NOT NULL default '0', + `x` float NOT NULL default '0', + `y` float NOT NULL default '0', + `z` float NOT NULL default '0', + `o` float NOT NULL default '0', + `guid` int(11) NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +ALTER TABLE `creature_addon` + ADD `path_id` int(11) unsigned NOT NULL default '0' AFTER `guid`; +ALTER TABLE `creature_template_addon` + ADD `path_id` int(11) unsigned NOT NULL default '0' AFTER `entry`; diff --git a/sql/updates/2.4.3_old/452_world.sql b/sql/updates/2.4.3_old/452_world.sql new file mode 100644 index 0000000..3b54927 --- /dev/null +++ b/sql/updates/2.4.3_old/452_world.sql @@ -0,0 +1,9 @@ +-- link gift of the wild to mark of the wild + +DELETE FROM `spell_chain` WHERE `spell_id` = 21849; +DELETE FROM `spell_chain` WHERE `spell_id` = 21850; +DELETE FROM `spell_chain` WHERE `spell_id` = 26991; + +INSERT INTO `spell_chain` (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (21849,0,1126,1,0); +INSERT INTO `spell_chain` (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (21850,21849,1126,2,0); +INSERT INTO `spell_chain` (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (26991,21850,1126,3,0); diff --git a/sql/updates/2.4.3_old/455_world.sql b/sql/updates/2.4.3_old/455_world.sql new file mode 100644 index 0000000..a5a23c5 --- /dev/null +++ b/sql/updates/2.4.3_old/455_world.sql @@ -0,0 +1,14 @@ +-- demon fire +UPDATE `creature_template` SET spell1 = 40029, flags_extra = 128, ScriptName = '' WHERE entry = 23069; +-- pillar of fire +UPDATE `creature_template` SET spell1 = 43218, flags_extra = 128, ScriptName = '' WHERE entry = 24187; +-- Broggok Poison Cloud +UPDATE `creature_template` SET spell1 = 30914, flags_extra = 128, ScriptName = '' WHERE entry = 17662; + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (43468, 43648, 43658, 43658, 43658, 43658, 43658); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (43648, 44007, 1, 'Storm Eye Safe Zone'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (43658, 43653, 0, 'Electrical Arc Visual'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (43658, 43654, 0, 'Electrical Arc Visual'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (43658, 43655, 0, 'Electrical Arc Visual'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (43658, 43656, 0, 'Electrical Arc Visual'); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (43658, 43659, 0, 'Electrical Arc Visual'); diff --git a/sql/updates/2.4.3_old/45_characters.sql b/sql/updates/2.4.3_old/45_characters.sql new file mode 100644 index 0000000..9f370ba --- /dev/null +++ b/sql/updates/2.4.3_old/45_characters.sql @@ -0,0 +1,13 @@ +CREATE TABLE `game_event_save` ( + `event_id` mediumint(8) unsigned NOT NULL, + `state` tinyint(3) unsigned NOT NULL default '1', + `next_start` timestamp NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (`event_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `game_event_condition_save` ( + `event_id` mediumint(8) unsigned NOT NULL, + `condition_id` mediumint(8) unsigned NOT NULL default '0', + `done` float default '0', + PRIMARY KEY (`event_id`,`condition_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/updates/2.4.3_old/471_world.sql b/sql/updates/2.4.3_old/471_world.sql new file mode 100644 index 0000000..2db3683 --- /dev/null +++ b/sql/updates/2.4.3_old/471_world.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `faction`=1375 WHERE `entry` IN (184203, 184204, 184205); +UPDATE `gameobject_template` SET `Scriptname`='go_bridge_console' WHERE entry=184568; diff --git a/sql/updates/2.4.3_old/480_world_scripts.sql b/sql/updates/2.4.3_old/480_world_scripts.sql new file mode 100644 index 0000000..203196a --- /dev/null +++ b/sql/updates/2.4.3_old/480_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_winter_reveler' WHERE `entry`=15760; +UPDATE `creature_template` SET `ScriptName`='npc_brewfest_reveler' WHERE `entry`=24484; diff --git a/sql/updates/2.4.3_old/488_world_scripts.sql b/sql/updates/2.4.3_old/488_world_scripts.sql new file mode 100644 index 0000000..41b264f --- /dev/null +++ b/sql/updates/2.4.3_old/488_world_scripts.sql @@ -0,0 +1,735 @@ +UPDATE `creature_template` SET `ScriptName`='npc_defias_traitor' WHERE `entry`=467; +UPDATE `creature_template` SET `ScriptName`='npc_torek' WHERE `entry`=12858; +UPDATE `creature_template` SET `ScriptName`='npc_magwin' WHERE `entry`=17312; +UPDATE `creature_template` SET `ScriptName`='npc_wounded_blood_elf' WHERE `entry`=16993; +UPDATE `creature_template` SET `ScriptName`='mob_abyssal' WHERE `entry`=17454; +UPDATE `creature_template` SET `ScriptName`='mob_scarlet_trainee' WHERE `entry`=6575; +UPDATE `instance_template` SET `script`='instance_scarlet_monastery' WHERE `map`=189; +UPDATE `creature_template` SET `ScriptName`='mob_phoenix_tk' WHERE `entry`=21362; +UPDATE `creature_template` SET `ScriptName`='mob_phoenix_egg_tk' WHERE `entry`=21364; +UPDATE `creature_template` SET `ScriptName`='npc_highlord_demitrian' WHERE `entry`=14347; +UPDATE `gameobject_template` SET `ScriptName`='go_gauntlet_gate' WHERE `entry`=175357; +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=11197; +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=10399; +UPDATE `gameobject_template` SET `ScriptName`='go_barrel_old_hillsbrad' WHERE `entry`=182589; +UPDATE `instance_template` SET `script`='instance_deadmines' WHERE `map`=36; +UPDATE `gameobject_template` SET `ScriptName`='go_defias_cannon' WHERE `entry`=16398; +UPDATE `gameobject_template` SET `ScriptName`='go_door_lever_dm' WHERE `entry`=101833; +UPDATE `gameobject_template` SET `ScriptName`='go_main_chambers_access_panel' WHERE `entry` IN (184125,184126); +UPDATE `creature_template` SET `ScriptName`='npc_twiggy_flathead' WHERE `entry`=6248; +DELETE FROM `areatrigger_scripts` WHERE `entry`=522; +INSERT INTO `areatrigger_scripts` VALUES (522,'at_twiggy_flathead');DELETE FROM `script_texts` WHERE `entry` BETWEEN -1565019 AND -1565000; + +-- text +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1565000,'Gronn are the real power in outland.',11367,1,0,'maulgar SAY_AGGRO'), +(-1565001,'You will not defeat the hand of Gruul!',11368,1,0,'maulgar SAY_ENRAGE'), +(-1565002,'You won\'t kill next one so easy!',11369,1,0,'maulgar SAY_OGRE_DEATH1'), +(-1565003,'Pah! Does not prove anything!',11370,1,0,'maulgar SAY_OGRE_DEATH2'), +(-1565004,'I\'m not afraid of you.',11371,1,0,'maulgar SAY_OGRE_DEATH3'), +(-1565005,'Good, now you fight me!',11372,1,0,'maulgar SAY_OGRE_DEATH4'), +(-1565006,'You not so tough afterall!',11373,1,0,'maulgar SAY_SLAY1'), +(-1565007,'Aha-ha ha ha!',11374,1,0,'maulgar SAY_SLAY2'), +(-1565008,'Mulgar is king!',11375,1,0,'maulgar SAY_SLAY3'), +(-1565009,'Gruul... will crush you...',11376,1,0,'maulgar SAY_DEATH'), +(-1565010,'Come... and die.',11355,1,0,'gruul SAY_AGGRO'), +(-1565011,'Scurry',11356,1,0,'gruul SAY_SLAM1'), +(-1565012,'No escape',11357,1,0,'gruul SAY_SLAM2'), +(-1565013,'Stay',11358,1,0,'gruul SAY_SHATTER1'), +(-1565014,'Beg... for life',11359,1,0,'gruul SAY_SHATTER2'), +(-1565015,'No more',11360,1,0,'gruul SAY_SLAY1'), +(-1565016,'Unworthy',11361,1,0,'gruul SAY_SLAY2'), +(-1565017,'Die',11362,1,0,'gruul SAY_SLAY3'), +(-1565018,'Aaargh...',11363,1,0,'gruul SAY_DEATH'), +(-1565019,'grows in size!',0,2,0,'gruul EMOTE_GROW'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1532102 AND -1532000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1532000,'Well done Midnight!',9173,1,0,'attumen SAY_MIDNIGHT_KILL'), +(-1532001,'Cowards! Wretches!',9167,1,0,'attumen SAY_APPEAR1'), +(-1532002,'Who dares attack the steed of the Huntsman?',9298,1,0,'attumen SAY_APPEAR2'), +(-1532003,'Perhaps you would rather test yourselves against a more formidable opponent?!',9299,1,0,'attumen SAY_APPEAR3'), +(-1532004,'Come, Midnight, let\'s disperse this petty rabble!',9168,1,0,'attumen SAY_MOUNT'), +(-1532005,'It was... inevitable.',9169,1,0,'attumen SAY_KILL1'), +(-1532006,'Another trophy to add to my collection!',9300,1,0,'attumen SAY_KILL2'), +(-1532007,'Weapons are merely a convenience for a warrior of my skill!',9166,1,0,'attumen SAY_DISARMED'), +(-1532008,'I always knew... someday I would become... the hunted.',9165,1,0,'attumen SAY_DEATH'), +(-1532009,'Such easy sport.',9170,1,0,'attumen SAY_RANDOM1'), +(-1532010,'Amateurs! Do not think you can best me! I kill for a living.',9304,1,0,'attumen SAY_RANDOM2'), +(-1532011,'Hmm, unannounced visitors? Preparations must be made.',9211,1,0,'moroes SAY_AGGRO'), +(-1532012,'Now, where was I? Oh yes...',9215,1,0,'moroes SAY_SPECIAL_1'), +(-1532013,'You rang?',9316,1,0,'moroes SAY_SPECIAL_2'), +(-1532014,'One more for dinner this evening.',9214,1,0,'moroes SAY_KILL_1'), +(-1532015,'Time... Never enough time.',9314,1,0,'moroes SAY_KILL_2'), +(-1532016,'I\'ve gone and made a mess.',9315,1,0,'moroes SAY_KILL_3'), +(-1532017,'How terribly clumsy of me...',9213,1,0,'moroes SAY_DEATH'), +(-1532018,'Your behavior will not be tolerated!',9204,1,0,'maiden SAY_AGGRO'), +(-1532019,'Ah ah ah...',9207,1,0,'maiden SAY_SLAY1'), +(-1532020,'This is for the best.',9312,1,0,'maiden SAY_SLAY2'), +(-1532021,'Impure thoughts lead to profane actions.',9311,1,0,'maiden SAY_SLAY3'), +(-1532022,'Cast out your corrupt thoughts.',9313,1,0,'maiden SAY_REPENTANCE1'), +(-1532023,'Your impurity must be cleansed.',9208,1,0,'maiden SAY_REPENTANCE2'), +(-1532024,'Death comes. Will your conscience be clear?',9206,1,0,'maiden SAY_DEATH'), +(-1532025,'Oh at last, at last. I can go home.',9190,1,0,'dorothee SAY_DOROTHEE_DEATH'), +(-1532026,'Don\'t let them hurt us, Tito! Oh, you won\'t, will you?',9191,1,0,'dorothee SAY_DOROTHEE_SUMMON'), +(-1532027,'Tito, oh Tito, no!',9192,1,0,'dorothee SAY_DOROTHEE_TITO_DEATH'), +(-1532028,'Oh dear, we simply must find a way home! The old wizard could be our only hope! Strawman, Roar, Tinhead, will you... wait! Oh golly, look! We have visitors!',9195,1,0,'dorothee SAY_DOROTHEE_AGGRO'), +(-1532029,'Wanna fight? Huh? Do ya? C\'mon, I\'ll fight you with both claws behind my back!',9227,1,0,'roar SAY_ROAR_AGGRO'), +(-1532030,'You didn\'t have to go and do that.',9229,1,0,'roar SAY_ROAR_DEATH'), +(-1532031,'I think I\'m going to go take fourty winks.',9230,1,0,'roar SAY_ROAR_SLAY'), +(-1532032,'Now what should I do with you? I simply can\'t make up my mind.',9254,1,0,'strawman SAY_STRAWMAN_AGGRO'), +(-1532033,'Don\'t let them make a mattress... out of me.',9256,1,0,'strawman SAY_STRAWMAN_DEATH'), +(-1532034,'I guess I\'m not a failure after all.',9257,1,0,'strawman SAY_STRAWMAN_SLAY'), +(-1532035,'I could really use a heart. Say, can I have yours?',9268,1,0,'tinhead SAY_TINHEAD_AGGRO'), +(-1532036,'Back to being an old rustbucket.',9270,1,0,'tinhead SAY_TINHEAD_DEATH'), +(-1532037,'Guess I\'m not so rusty, after all.',9271,1,0,'tinhead SAY_TINHEAD_SLAY'), +(-1532038,'begins to rust.',0,2,0,'tinhead EMOTE_RUST'), +(-1532039,'Woe to each and every one of you my pretties! ',9179,1,0,'crone SAY_CRONE_AGGRO'), +(-1532040,'It will all be over soon! ',9307,1,0,'crone SAY_CRONE_AGGRO2'), +(-1532041,'How could you? What a cruel, cruel world!',9178,1,0,'crone SAY_CRONE_DEATH'), +(-1532042,'Fixed you, didn\'t I? ',9180,1,0,'crone SAY_CRONE_SLAY'), +(-1532043,'All the better to own you with!',9276,1,0,'wolf SAY_WOLF_AGGRO'), +(-1532044,'Mmmm... delicious.',9277,1,0,'wolf SAY_WOLF_SLAY'), +(-1532045,'Run away little girl, run away!',9278,1,0,'wolf SAY_WOLF_HOOD'), +(-1532046,'What devil art thou, that dost torment me thus?',9196,1,0,'julianne SAY_JULIANNE_AGGRO'), +(-1532047,'Where is my lord? Where is my Romulo?',9199,1,0,'julianne SAY_JULIANNE_ENTER'), +(-1532048,'Romulo, I come! Oh... this do I drink to thee!',9198,1,0,'julianne SAY_JULIANNE_DEATH01'), +(-1532049,'Where is my Lord? Where is my Romulo? Ohh, happy dagger! This is thy sheath! There rust, and let me die!',9310,1,0,'julianne SAY_JULIANNE_DEATH02'), +(-1532050,'Come, gentle night; and give me back my Romulo!',9200,1,0,'julianne SAY_JULIANNE_RESURRECT'), +(-1532051,'Parting is such sweet sorrow.',9201,1,0,'julianne SAY_JULIANNE_SLAY'), +(-1532052,'Wilt thou provoke me? Then have at thee, boy!',9233,1,0,'romulo SAY_ROMULO_AGGRO'), +(-1532053,'Thou smilest... upon the stroke that... murders me.',9235,1,0,'romulo SAY_ROMULO_DEATH'), +(-1532054,'This day\'s black fate on more days doth depend. This but begins the woe. Others must end.',9236,1,0,'romulo SAY_ROMULO_ENTER'), +(-1532055,'Thou detestable maw, thou womb of death; I enforce thy rotten jaws to open!',9237,1,0,'romulo SAY_ROMULO_RESURRECT'), +(-1532056,'How well my comfort is revived by this!',9238,1,0,'romulo SAY_ROMULO_SLAY'), +(-1532057,'The Menagerie is for guests only.',9183,1,0,'curator SAY_AGGRO'), +(-1532058,'Gallery rules will be strictly enforced.',9188,1,0,'curator SAY_SUMMON1'), +(-1532059,'This curator is equipped for gallery protection.',9309,1,0,'curator SAY_SUMMON2'), +(-1532060,'Your request cannot be processed.',9186,1,0,'curator SAY_EVOCATE'), +(-1532061,'Failure to comply will result in offensive action.',9185,1,0,'curator SAY_ENRAGE'), +(-1532062,'Do not touch the displays.',9187,1,0,'curator SAY_KILL1'), +(-1532063,'You are not a guest.',9308,1,0,'curator SAY_KILL2'), +(-1532064,'This Curator is no longer op... er... ation... al.',9184,1,0,'curator SAY_DEATH'), +(-1532065,'Your blood will anoint my circle.',9264,1,0,'terestian SAY_SLAY1'), +(-1532066,'The great one will be pleased.',9329,1,0,'terestian SAY_SLAY2'), +(-1532067,'My life, is yours. Oh great one.',9262,1,0,'terestian SAY_DEATH'), +(-1532068,'Ah, you\'re just in time. The rituals are about to begin.',9260,1,0,'terestian SAY_AGGRO'), +(-1532069,'Please, accept this humble offering, oh great one.',9263,1,0,'terestian SAY_SACRIFICE1'), +(-1532070,'Let the sacrifice serve his testament to my fealty.',9330,1,0,'terestian SAY_SACRIFICE2'), +(-1532071,'Come, you dwellers in the dark. Rally to my call!',9265,1,0,'terestian SAY_SUMMON1'), +(-1532072,'Gather, my pets. There is plenty for all.',9331,1,0,'terestian SAY_SUMMON2'), +(-1532073,'Please, no more. My son... he\'s gone mad!',9241,1,0,'aran SAY_AGGRO1'), +(-1532074,'I\'ll not be tortured again!',9323,1,0,'aran SAY_AGGRO2'), +(-1532075,'Who are you? What do you want? Stay away from me!',9324,1,0,'aran SAY_AGGRO3'), +(-1532076,'I\'ll show you this beaten dog still has some teeth!',9245,1,0,'aran SAY_FLAMEWREATH1'), +(-1532077,'Burn you hellish fiends!',9326,1,0,'aran SAY_FLAMEWREATH2'), +(-1532078,'I\'ll freeze you all!',9246,1,0,'aran SAY_BLIZZARD1'), +(-1532079,'Back to the cold dark with you!',9327,1,0,'aran SAY_BLIZZARD2'), +(-1532080,'Yes, yes, my son is quite powerful... but I have powers of my own!',9242,1,0,'aran SAY_EXPLOSION1'), +(-1532081,'I am not some simple jester! I am Nielas Aran!',9325,1,0,'aran SAY_EXPLOSION2'), +(-1532082,'Surely you would not deny an old man a replenishing drink? No, no I thought not.',9248,1,0,'aran SAY_DRINK'), +(-1532083,'I\'m not finished yet! No, I have a few more tricks up me sleeve.',9251,1,0,'aran SAY_ELEMENTALS'), +(-1532084,'I want this nightmare to be over!',9250,1,0,'aran SAY_KILL1'), +(-1532085,'Torment me no more!',9328,1,0,'aran SAY_KILL2'), +(-1532086,'You\'ve wasted enough of my time. Let these games be finished!',9247,1,0,'aran SAY_TIMEOVER'), +(-1532087,'At last... The nightmare is.. over...',9244,1,0,'aran SAY_DEATH'), +(-1532088,'Where did you get that?! Did HE send you?!',9249,1,0,'aran SAY_ATIESH'), +(-1532089,'cries out in withdrawal, opening gates to the warp.',0,2,0,'netherspite EMOTE_PHASE_PORTAL'), +(-1532090,'goes into a nether-fed rage!',0,2,0,'netherspite EMOTE_PHASE_BANISH'), +(-1532091,'Madness has brought you here to me. I shall be your undoing!',9218,1,0,'malchezaar SAY_AGGRO'), +(-1532092,'Simple fools! Time is the fire in which you\'ll burn!',9220,1,0,'malchezaar SAY_AXE_TOSS1'), +(-1532093,'I see the subtlety of conception is beyond primitives such as you.',9317,1,0,'malchezaar SAY_AXE_TOSS2'), +(-1532094,'Who knows what secrets hide in the dark.',9223,1,0,'malchezaar SAY_SPECIAL1'), +(-1532095,'The cerestial forces are mine to manipulate.',9320,1,0,'malchezaar SAY_SPECIAL2'), +(-1532096,'How can you hope to withstand against such overwhelming power?',9321,1,0,'malchezaar SAY_SPECIAL3'), +(-1532097,'Surely you did not think you could win.',9222,1,0,'malchezaar SAY_SLAY1'), +(-1532098,'Your greed, your foolishness has brought you to this end.',9318,1,0,'malchezaar SAY_SLAY2'), +(-1532099,'You are, but a plaything, unfit even to amuse.',9319,1,0,'malchezaar SAY_SLAY3'), +(-1532100,'All realities, all dimensions are open to me!',9224,1,0,'malchezaar SAY_SUMMON1'), +(-1532101,'You face not Malchezaar alone, but the legions I command!',9322,1,0,'malchezaar SAY_SUMMON2'), +(-1532102,'I refuse to concede defeat. I am a prince of the Eredar! I am...',9221,1,0,'malchezaar SAY_DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1550043 AND -1550000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1550000,'Alert, you are marked for extermination!',11213,1,0,'voidreaver SAY_AGGRO'), +(-1550001,'Extermination, successful.',11215,1,0,'voidreaver SAY_SLAY1'), +(-1550002,'Imbecile life form, no longer functional.',11216,1,0,'voidreaver SAY_SLAY2'), +(-1550003,'Threat neutralized.',11217,1,0,'voidreaver SAY_SLAY3'), +(-1550004,'Systems... shutting... down...',11214,1,0,'voidreaver SAY_DEATH'), +(-1550005,'Alternative measure commencing...',11218,1,0,'voidreaver SAY_POUNDING1'), +(-1550006,'Calculating force parameters...',11219,1,0,'voidreaver SAY_POUNDING2'), +(-1550007,'Tal anu\'men no Sin\'dorei!',11134,1,0,'solarian SAY_AGGRO'), +(-1550008,'Ha ha ha! You are hopelessly outmatched!',11139,1,0,'solarian SAY_SUMMON1'), +(-1550009,'I will crush your delusions of grandeur!',11140,1,0,'solarian SAY_SUMMON2'), +(-1550010,'Your soul belongs to the Abyss!',11136,1,0,'solarian SAY_KILL1'), +(-1550011,'By the blood of the Highborne!',11137,1,0,'solarian SAY_KILL2'), +(-1550012,'For the Sunwell!',11138,1,0,'solarian SAY_KILL3'), +(-1550013,'The warmth of the sun... awaits.',11135,1,0,'solarian SAY_DEATH'), +(-1550014,'Enough of this! Now I call upon the fury of the cosmos itself.',0,1,0,'solarian SAY_VOIDA'), +(-1550015,'I become ONE... with the VOID!',0,1,0,'solarian SAY_VOIDB'), +(-1550016,'Energy. Power. My people are addicted to it... a dependence made manifest after the Sunwell was destroyed. Welcome... to the future. A pity you are too late to stop it. No one can stop me now! Selama ashal\'anore!',11256,1,0,'kaelthas SAY_INTRO'), +(-1550017,'Capernian will see to it that your stay here is a short one.',11257,1,0,'kaelthas SAY_INTRO_CAPERNIAN'), +(-1550018,'Well done, you have proven worthy to test your skills against my master engineer, Telonicus.',11258,1,0,'kaelthas SAY_INTRO_TELONICUS'), +(-1550019,'Let us see how your nerves hold up against the Darkener, Thaladred.',11259,1,0,'kaelthas SAY_INTRO_THALADRED'), +(-1550020,'You have persevered against some of my best advisors... but none can withstand the might of the Blood Hammer. Behold, Lord Sanguinar!',11260,1,0,'kaelthas SAY_INTRO_SANGUINAR'), +(-1550021,'As you see, I have many weapons in my arsenal...',11261,1,0,'kaelthas SAY_PHASE2_WEAPON'), +(-1550022,'Perhaps I underestimated you. It would be unfair to make you fight all four advisors at once, but... fair treatment was never shown to my people. I\'m just returning the favor.',11262,1,0,'kaelthas SAY_PHASE3_ADVANCE'), +(-1550023,'Alas, sometimes one must take matters into one\'s own hands. Balamore shanal!',11263,1,0,'kaelthas SAY_PHASE4_INTRO2'), +(-1550024,'I have not come this far to be stopped! The future I have planned will not be jeopardized! Now you will taste true power!!',11273,1,0,'kaelthas SAY_PHASE5_NUTS'), +(-1550025,'You will not prevail.',11270,1,0,'kaelthas SAY_SLAY1'), +(-1550026,'You gambled...and lost.',11271,1,0,'kaelthas SAY_SLAY2'), +(-1550027,'This was Child\'s play.',11272,1,0,'kaelthas SAY_SLAY3'), +(-1550028,'Obey me.',11268,1,0,'kaelthas SAY_MINDCONTROL1'), +(-1550029,'Bow to my will.',11269,1,0,'kaelthas SAY_MINDCONTROL2'), +(-1550030,'Let us see how you fare when your world is turned upside down.',11264,1,0,'kaelthas SAY_GRAVITYLAPSE1'), +(-1550031,'Having trouble staying grounded?',11265,1,0,'kaelthas SAY_GRAVITYLAPSE2'), +(-1550032,'Anara\'nel belore!',11267,1,0,'kaelthas SAY_SUMMON_PHOENIX1'), +(-1550033,'By the power of the sun!',11266,1,0,'kaelthas SAY_SUMMON_PHOENIX2'), +(-1550034,'For...Quel...thalas!',11274,1,0,'kaelthas SAY_DEATH'), +(-1550035,'Prepare yourselves!',11203,1,0,'thaladred SAY_THALADRED_AGGRO'), +(-1550036,'Forgive me, my prince! I have... failed.',11204,1,0,'thaladred SAY_THALADRED_DEATH'), +(-1550037,'sets his gaze on $N!',0,2,0,'thaladred EMOTE_THALADRED_GAZE'), +(-1550038,'Blood for blood!',11152,1,0,'sanguinar SAY_SANGUINAR_AGGRO'), +(-1550039,'NO! I ...will... not...',11153,1,0,'sanguinar SAY_SANGUINAR_DEATH'), +(-1550040,'The sin\'dore reign supreme!',11117,1,0,'capernian SAY_CAPERNIAN_AGGRO'), +(-1550041,'This is not over!',11118,1,0,'capernian SAY_CAPERNIAN_DEATH'), +(-1550042,'Anar\'alah belore!',11157,1,0,'telonicus SAY_TELONICUS_AGGRO'), +(-1550043,'More perils... await',11158,1,0,'telonicus SAY_TELONICUS_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1553012 AND -1553000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1553000,'What are you doing? These specimens are very delicate!',11144,1,0,'freywinn SAY_AGGRO'), +(-1553001,'Your life cycle is now concluded!',11145,1,0,'freywinn SAY_KILL_1'), +(-1553002,'You will feed the worms.',11146,1,0,'freywinn SAY_KILL_2'), +(-1553003,'Endorel aluminor!',11147,1,0,'freywinn SAY_TREE_1'), +(-1553004,'Nature bends to my will!',11148,1,0,'freywinn SAY_TREE_2'), +(-1553005,'The specimens...must be preserved.',11149,1,0,'freywinn SAY_DEATH'), +(-1553006,'emits a strange noise.',0,2,0,'laj EMOTE_SUMMON'), +(-1553007,'Who disturbs this sanctuary?',11230,1,0,'warp SAY_AGGRO'), +(-1553008,'You must die! But wait: this does not--No, no... you must die!',11231,1,0,'warp SAY_SLAY_1'), +(-1553009,'What am I doing? Why do I...',11232,1,0,'warp SAY_SLAY_2'), +(-1553010,'Children, come to me!',11233,1,0,'warp SAY_SUMMON_1'), +(-1553011,'Maybe this is not--No, we fight! Come to my aid.',11234,1,0,'warp SAY_SUMMON_2'), +(-1553012,'So... confused. Do not... belong here!',11235,1,0,'warp SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1554027 AND -1554000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1554000,'I predict a painful death.',11101,1,0,'gyro SAY_AGGRO'), +(-1554001,'Measure twice; cut once!',11104,1,0,'gyro SAY_SAW_ATTACK1'), +(-1554002,'If my division is correct, you should be quite dead.',11105,1,0,'gyro SAY_SAW_ATTACK2'), +(-1554003,'Your strategy was flawed!',11102,1,0,'gyro SAY_SLAY1'), +(-1554004,'Yes, the only logical outcome.',11103,1,0,'gyro SAY_SLAY2'), +(-1554005,'An unforseen... contingency',11106,1,0,'gyro SAY_DEATH'), +(-1554006,'You have approximately five seconds to live.',11109,1,0,'ironhand SAY_AGGRO_1'), +(-1554007,'With the precise angle and velocity...',11112,1,0,'ironhand SAY_HAMMER_1'), +(-1554008,'Low tech yet quiet effective!',11113,1,0,'ironhand SAY_HAMMER_2'), +(-1554009,'A foregone conclusion.',11110,1,0,'ironhand SAY_SLAY_1'), +(-1554010,'The processing will continue a schedule!',11111,1,0,'ironhand SAY_SLAY_2'), +(-1554011,'My calculations did not...',11114,1,0,'ironhand SAY_DEATH_1'), +(-1554012,'raises his hammer menacingly...',0,3,0,'ironhand EMOTE_HAMMER'), +(-1554013,'Don\'t value your life very much, do you?',11186,1,0,'sepethrea SAY_AGGRO'), +(-1554014,'I am not alone.',11191,1,0,'sepethrea SAY_SUMMON'), +(-1554015,'Think you can take the heat?',11189,1,0,'sepethrea SAY_DRAGONS_BREATH_1'), +(-1554016,'Anar\'endal dracon!',11190,1,0,'sepethrea SAY_DRAGONS_BREATH_2'), +(-1554017,'And don\'t come back!',11187,1,0,'sepethrea SAY_SLAY1'), +(-1554018,'En\'dala finel el\'dal',11188,1,0,'sepethrea SAY_SLAY2'), +(-1554019,'Anu... bala belore...alon.',11192,1,0,'sepethrea SAY_DEATH'), +(-1554020,'We are on a strict timetable. You will not interfere!',11193,1,0,'pathaleon SAY_AGGRO'), +(-1554021,'I\'m looking for a team player...',11197,1,0,'pathaleon SAY_DOMINATION_1'), +(-1554022,'You work for me now!',11198,1,0,'pathaleon SAY_DOMINATION_2'), +(-1554023,'Time to supplement my work force.',11196,1,0,'pathaleon SAY_SUMMON'), +(-1554024,'I prefeer to be hands-on...',11199,1,0,'pathaleon SAY_ENRAGE'), +(-1554025,'A minor inconvenience.',11194,1,0,'pathaleon SAY_SLAY_1'), +(-1554026,'Looks like you lose.',11195,1,0,'pathaleon SAY_SLAY_2'), +(-1554027,'The project will... continue.',11200,1,0,'pathaleon SAY_DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1585029 AND -1585000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1585000,'You only waste my time!',12378,1,0,'selin SAY_AGGRO'), +(-1585001,'My hunger knows no bounds!',12381,1,0,'selin SAY_ENERGY'), +(-1585002,'Yes! I am a god!',12382,1,0,'selin SAY_EMPOWERED'), +(-1585003,'Enough distractions!',12388,1,0,'selin SAY_KILL_1'), +(-1585004,'I am invincible!',12385,1,0,'selin SAY_KILL_2'), +(-1585005,'No! More... I must have more!',12383,1,0,'selin SAY_DEATH'), +(-1585006,'begins to channel from the nearby Fel Crystal...',0,3,0,'selin EMOTE_CRYSTAL'), +(-1585007,'Drain...life!',12389,1,0,'vexallus SAY_AGGRO'), +(-1585008,'Un...con...tainable.',12392,1,0,'vexallus SAY_ENERGY'), +(-1585009,'Un...leash...',12390,1,0,'vexallus SAY_OVERLOAD'), +(-1585010,'Con...sume.',12393,1,0,'vexallus SAY_KILL'), +(-1585011,'discharges pure energy!',0,3,0,'vexallus EMOTE_DISCHARGE_ENERGY'), +(-1585012,'Annihilate them!',12395,1,0,'delrissa SAY_AGGRO'), +(-1585013,'Oh, the horror.',12398,1,0,'delrissa LackeyDeath1'), +(-1585014,'Well, aren\'t you lucky?',12400,1,0,'delrissa LackeyDeath2'), +(-1585015,'Now I\'m getting annoyed.',12401,1,0,'delrissa LackeyDeath3'), +(-1585016,'Lackies be damned! I\'ll finish you myself!',12403,1,0,'delrissa LackeyDeath4'), +(-1585017,'I call that a good start.',12405,1,0,'delrissa PlayerDeath1'), +(-1585018,'I could have sworn there were more of you.',12407,1,0,'delrissa PlayerDeath2'), +(-1585019,'Not really much of a group, anymore, is it?',12409,1,0,'delrissa PlayerDeath3'), +(-1585020,'One is such a lonely number.',12410,1,0,'delrissa PlayerDeath4'), +(-1585021,'It\'s been a kick, really.',12411,1,0,'delrissa PlayerDeath5'), +(-1585022,'Not what I had... planned...',12397,1,0,'delrissa SAY_DEATH'), +(-1585023,'Don\'t look so smug! I know what you\'re thinking, but Tempest Keep was merely a set back. Did you honestly believe I would trust the future to some blind, half-night elf mongrel? Oh no, he was merely an instrument, a stepping stone to a much larger plan! It has all led to this, and this time, you will not interfere!',12413,1,0,'kaelthas MT SAY_AGGRO'), +(-1585024,'Vengeance burns!',12415,1,0,'kaelthas MT SAY_PHOENIX'), +(-1585025,'Felomin ashal!',12417,1,0,'kaelthas MT SAY_FLAMESTRIKE'), +(-1585026,'I\'ll turn your world... upside... down...',12418,1,0,'kaelthas MT SAY_GRAVITY_LAPSE'), +(-1585027,'Master... grant me strength.',12419,1,0,'kaelthas MT SAY_TIRED'), +(-1585028,'Do not... get too comfortable.',12420,1,0,'kaelthas MT SAY_RECAST_GRAVITY'), +(-1585029,'My demise accomplishes nothing! The Master will have you! You will drown in your own blood! This world shall burn! Aaaghh!',12421,1,0,'kaelthas MT SAY_DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1580035 AND -1580000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1580000,'Aggh! No longer will I be a slave to Malygos! Challenge me and you will be destroyed!',12422,1,0,'kalecgos SAY_EVIL_AGGRO'), +(-1580001,'I will purge you!',12423,1,0,'kalecgos SAY_EVIL_SPELL1'), +(-1580002,'Your pain has only begun!',12424,1,0,'kalecgos SAY_EVIL_SPELL2'), +(-1580003,'In the name of Kil\'jaeden!',12425,1,0,'kalecgos SAY_EVIL_SLAY1'), +(-1580004,'You were warned!',12426,1,0,'kalecgos SAY_EVIL_SLAY2'), +(-1580005,'My awakening is complete! You shall all perish!',12427,1,0,'kalecgos SAY_EVIL_ENRAGE'), +(-1580006,'I need... your help... Cannot... resist him... much longer...',12428,1,0,'kalecgos humanoid SAY_GOOD_AGGRO'), +(-1580007,'Aaahhh! Help me, before I lose my mind!',12429,1,0,'kalecgos humanoid SAY_GOOD_NEAR_DEATH'), +(-1580008,'Hurry! There is not much of me left!',12430,1,0,'kalecgos humanoid SAY_GOOD_NEAR_DEATH2'), +(-1580009,'I am forever in your debt. Once we have triumphed over Kil\'jaeden, this entire world will be in your debt as well.',12431,1,0,'kalecgos humanoid SAY_GOOD_PLRWIN'), +(-1580010,'There will be no reprieve. My work here is nearly finished.',12451,1,0,'sathrovarr SAY_SATH_AGGRO'), +(-1580011,'I\'m... never on... the losing... side...',12452,1,0,'sathrovarr SAY_SATH_DEATH'), +(-1580012,'Your misery is my delight!',12453,1,0,'sathrovarr SAY_SATH_SPELL1'), +(-1580013,'I will watch you bleed!',12454,1,0,'sathrovarr SAY_SATH_SPELL2'), +(-1580014,'Pitious mortal!',12455,1,0,'sathrovarr SAY_SATH_SLAY1'), +(-1580015,'Haven\'t you heard? I always win!',12456,1,0,'sathrovarr SAY_SATH_SLAY2'), +(-1580016,'I have toyed with you long enough!',12457,1,0,'sathrovarr SAY_SATH_ENRAGE'), +(-1580017,'Puny lizard! Death is the only answer you\'ll find here!',12458,1,0,'brutallus YELL_INTRO'), +(-1580018,'Grah! Your magic is weak!',12459,1,0,'brutallus YELL_INTRO_BREAK_ICE'), +(-1580019,'I will crush you!',12460,1,0,'brutallus YELL_INTRO_CHARGE'), +(-1580020,'That was fun.',12461,1,0,'brutallus YELL_INTRO_KILL_MADRIGOSA'), +(-1580021,'Come, try your luck!',12462,1,0,'brutallus YELL_INTRO_TAUNT'), +(-1580022,'Ahh! More lambs to the slaughter!',12463,1,0,'brutallus YELL_AGGRO'), +(-1580023,'Perish, insect!',12464,1,0,'brutallus YELL_KILL1'), +(-1580024,'You are meat!',12465,1,0,'brutallus YELL_KILL2'), +(-1580025,'Too easy!',12466,1,0,'brutallus YELL_KILL3'), +(-1580026,'Bring the fight to me!',12467,1,0,'brutallus YELL_LOVE1'), +(-1580027,'Another day, another glorious battle!',12468,1,0,'brutallus YELL_LOVE2'), +(-1580028,'I live for this!',12469,1,0,'brutallus YELL_LOVE3'), +(-1580029,'So much for a real challenge... Die!',12470,1,0,'brutallus YELL_BERSERK'), +(-1580030,'Gah! Well done... Now... this gets... interesting...',12471,1,0,'brutallus YELL_DEATH'), +(-1580031,'Hold, friends! There is information to be had before this devil meets his fate!',12472,1,0,'madrigosa YELL_MADR_ICE_BARRIER'), +(-1580032,'Where is Anveena, demon? What has become of Kalec?',12473,1,0,'madrigosa YELL_MADR_INTRO'), +(-1580033,'You will tell me where they are!',12474,1,0,'madrigosa YELL_MADR_ICE_BLOCK'), +(-1580034,'Speak, I grow weary of asking!',12475,1,0,'madrigosa YELL_MADR_TRAP'), +(-1580035,'Malygos, my lord! I did my best!',12476,1,0,'madrigosa YELL_MADR_DEATH'); +DELETE FROM `script_texts` WHERE `entry`=-1033000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1033000,'Thanks for freeing me, I\'ll open this door for you, then I will get out of here.',0,0,0,'shadowfang_prisoner SAY_FREE'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1309023 AND -1309000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1309000,'Let the coils of hate unfurl!',8421,1,0,'venoxis SAY_TRANSFORM'), +(-1309001,'Ssserenity..at lassst!',0,1,0,'venoxis SAY_DEATH'), +(-1309002,'Lord Hir\'eek, grant me wings of vengance!',8417,1,0,'jeklik SAY_AGGRO'), +(-1309003,'I command you to rain fire down upon these invaders!',0,1,0,'jeklik SAY_RAIN_FIRE'), +(-1309004,'Finally ...death. Curse you Hakkar! Curse you!',8422,1,0,'jeklik SAY_DEATH'), +(-1309005,'Draw me to your web mistress Shadra. Unleash your venom!',8418,1,0,'marli SAY_AGGRO'), +(-1309006,'Shadra, make of me your avatar!',0,1,0,'marli SAY_TRANSFORM'), +(-1309007,'Aid me my brood!',0,1,0,'marli SAY_SPIDER_SPAWN'), +(-1309008,'Bless you mortal for this release. Hakkar controls me no longer...',8423,1,0,'marli SAY_DEATH'), +(-1309009,'Shirvallah, fill me with your RAGE!',8419,1,0,'thekal SAY_AGGRO'), +(-1309010,'Hakkar binds me no more! Peace at last!',8424,1,0,'thekal SAY_DEATH'), +(-1309011,'Bethekk, your priestess calls upon your might!',8416,1,0,'arlokk SAY_AGGRO'), +(-1309012,'Feast on $n, my pretties!',0,1,0,'arlokk SAY_FEAST_PANTHER'), +(-1309013,'At last, I am free of the Soulflayer!',8412,1,0,'arlokk SAY_DEATH'), +(-1309014,'Welcome to da great show friends! Step right up to die!',8425,1,0,'jindo SAY_AGGRO'), +(-1309015,'I\'ll feed your souls to Hakkar himself!',8413,1,0,'mandokir SAY_AGGRO'), +(-1309016,'DING!',0,1,0,'mandokir SAY_DING_KILL'), +(-1309017,'GRATS!',0,1,0,'mandokir SAY_GRATS_JINDO'), +(-1309018,'I\'m keeping my eye on you, $N!',0,1,0,'mandokir SAY_WATCH'), +(-1309019,'Don\'t make me angry. You won\'t like it when I\'m angry.',0,1,0,'mandokir SAY_WATCH_WHISPER'), +(-1309020,'PRIDE HERALDS THE END OF YOUR WORLD. COME, MORTALS! FACE THE WRATH OF THE SOULFLAYER!',8414,1,0,'hakkar SAY_AGGRO'), +(-1309021,'Fleeing will do you no good, mortals!',0,1,0,'hakkar SAY_FLEEING'), +(-1309022,'You dare set foot upon Hakkari holy ground? Minions of Hakkar, destroy the infidels!',0,1,0,'hakkar SAY_MINION_DESTROY'), +(-1309023,'Minions of Hakkar, hear your God. The sanctity of this temple has been compromised. Invaders encroach upon holy ground! The Altar of Blood must be protected. Kill them all!',0,1,0,'hakkar SAY_PROTECT_ALTAR'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1568023 AND -1568000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1568000,'Spirits of da wind be your doom!',12031,1,0,'janalai SAY_AGGRO'), +(-1568001,'I burn ya now!',12032,1,0,'janalai SAY_FIRE_BOMBS'), +(-1568002,'Where ma hatcha? Get to work on dem eggs!',12033,1,0,'janalai SAY_SUMMON_HATCHER'), +(-1568003,'I show you strength... in numbers.',12034,1,0,'janalai SAY_ALL_EGGS'), +(-1568004,'You done run outta time!',12035,1,0,'janalai SAY_BERSERK'), +(-1568005,'It all be over now, mon!',12036,1,0,'janalai SAY_SLAY_1'), +(-1568006,'Tazaga-choo!',12037,1,0,'janalai SAY_SLAY_2'), +(-1568007,'Zul\'jin... got a surprise for you...',12038,1,0,'janalai SAY_DEATH'), +(-1568008,'Come, strangers. The spirit of the dragonhawk hot be hungry for worthy souls.',12039,1,0,'janalai SAY_EVENT_STRANGERS'), +(-1568009,'Come, friends. Your bodies gonna feed ma hatchlings, and your souls are going to feed me with power!',12040,1,0,'janalai SAY_EVENT_FRIENDS'), +(-1568010,'Get da move on, guards! It be killin\' time!',12066,1,0,'nalorakk SAY_WAVE1_AGGRO'), +(-1568011,'Guards, go already! Who you more afraid of, dem... or me?',12067,1,0,'nalorakk SAY_WAVE2_STAIR1'), +(-1568012,'Ride now! Ride out dere and bring me back some heads!',12068,1,0,'nalorakk SAY_WAVE3_STAIR2'), +(-1568013,'I be losin\' me patience! Go on: make dem wish dey was never born!',12069,1,0,'nalorakk SAY_WAVE4_PLATFORM'), +(-1568014,'What could be better than servin\' da bear spirit for eternity? Come closer now. Bring your souls to me!',12078,1,0,'nalorakk SAY_EVENT1_SACRIFICE'), +(-1568015,'Don\'t be delayin\' your fate. Come to me now. I make your sacrifice quick.',12079,1,0,'nalorakk SAY_EVENT2_SACRIFICE'), +(-1568016,'You be dead soon enough!',12070,1,0,'nalorakk SAY_AGGRO'), +(-1568017,'I bring da pain!',12071,1,0,'nalorakk SAY_SURGE'), +(-1568018,'You call on da beast, you gonna get more dan you bargain for!',12072,1,0,'nalorakk SAY_TOBEAR'), +(-1568019,'Make way for Nalorakk!',12073,1,0,'nalorakk SAY_TOTROLL'), +(-1568020,'You had your chance, now it be too late!',12074,1,0,'nalorakk SAY_BERSERK'), +(-1568021,'Mua-ha-ha! Now whatchoo got to say?',12075,1,0,'nalorakk SAY_SLAY1'), +(-1568022,'Da Amani gonna rule again!',12076,1,0,'nalorakk SAY_SLAY2'), +(-1568023,'I... be waitin\' on da udda side....',12077,1,0,'nalorakk SAY_DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1509027 AND -1509000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1509000,'senses your fear.',0,2,0,'moam EMOTE_AGGRO'), +(-1509001,'bristles with energy!',0,2,0,'moan EMOTE_MANA_FULL'), +(-1509002,'sets eyes on $N!',0,2,0,'buru EMOTE_TARGET'), +(-1509003,'They come now. Try not to get yourself killed, young blood.',0,1,0,'andorov SAY_ANDOROV_INTRO'), +(-1509004,'Remember, Rajaxx, when I said I\'d kill you last? I lied...',0,1,0,'andorov SAY_ANDOROV_ATTACK'), +(-1509005,'The time of our retribution is at hand! Let darkness reign in the hearts of our enemies!',8612,1,0,'rajaxx SAY_WAVE3'), +(-1509006,'No longer will we wait behind barred doors and walls of stone! No longer will our vengeance be denied! The dragons themselves will tremble before our wrath!',8610,1,0,'rajaxx SAY_WAVE4'), +(-1509007,'Fear is for the enemy! Fear and death!',8608,1,0,'rajaxx SAY_WAVE5'), +(-1509008,'Staghelm will whimper and beg for his life, just as his whelp of a son did! One thousand years of injustice will end this day!',8611,1,0,'rajaxx SAY_WAVE6'), +(-1509009,'Fandral! Your time has come! Go and hide in the Emerald Dream and pray we never find you!',8607,1,0,'rajaxx SAY_WAVE7'), +(-1509010,'Impudent fool! I will kill you myself!',8609,1,0,'rajaxx SAY_INTRO'), +(-1509011,'Attack and make them pay dearly!',8603,1,0,'rajaxx SAY_UNK1'), +(-1509012,'Crush them! Drive them out!',8605,1,0,'rajaxx SAY_UNK2'), +(-1509013,'Do not hesitate! Destroy them!',8606,1,0,'rajaxx SAY_UNK3'), +(-1509014,'Warriors! Captains! Continue the fight!',8613,1,0,'rajaxx SAY_UNK4'), +(-1509015,'You are not worth my time $N!',8614,1,0,'rajaxx SAY_DEAGGRO'), +(-1509016,'Breath your last!',8604,1,0,'rajaxx SAY_KILLS_ANDOROV'), +(-1509017,'Soon you will know the price of your meddling, mortals... The master is nearly whole... And when he rises, your world will be cease!',0,1,0,'rajaxx SAY_COMPLETE_QUEST'), +(-1509018,'I am rejuvinated!',8593,1,0,'ossirian SAY_SURPREME1'), +(-1509019,'My powers are renewed!',8595,1,0,'ossirian SAY_SURPREME2'), +(-1509020,'My powers return!',8596,1,0,'ossirian SAY_SURPREME3'), +(-1509021,'Protect the city at all costs!',8597,1,0,'ossirian SAY_RAND_INTRO1'), +(-1509022,'The walls have been breached!',8599,1,0,'ossirian SAY_RAND_INTRO2'), +(-1509023,'To your posts. Defend the city.',8600,1,0,'ossirian SAY_RAND_INTRO3'), +(-1509024,'Tresspassers will be terminated.',8601,1,0,'ossirian SAY_RAND_INTRO4'), +(-1509025,'Sands of the desert rise and block out the sun!',8598,1,0,'ossirian SAY_AGGRO'), +(-1509026,'You are terminated.',8602,1,0,'ossirian SAY_SLAY'), +(-1509027,'I...have...failed.',8594,1,0,'ossirian SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1531011 AND -1531000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1531000,'Are you so eager to die? I would be happy to accomodate you.',8615,1,0,'skeram SAY_AGGRO1'), +(-1531001,'Cower mortals! The age of darkness is at hand.',8616,1,0,'skeram SAY_AGGRO2'), +(-1531002,'Tremble! The end is upon you.',8621,1,0,'skeram SAY_AGGRO3'), +(-1531003,'Let your death serve as an example!',8617,1,0,'skeram SAY_SLAY1'), +(-1531004,'Spineless wretches! You will drown in rivers of blood!',8619,1,0,'skeram SAY_SLAY2'), +(-1531005,'The screams of the dying will fill the air. A symphony of terror is about to begin!',8620,1,0,'skeram SAY_SLAY3'), +(-1531006,'Prepare for the return of the ancient ones!',8618,1,0,'skeram SAY_SPLIT'), +(-1531007,'You only delay... the inevetable.',8622,1,0,'skeram SAY_DEATH'), +(-1531008,'You will be judged for defiling these sacred grounds! The laws of the Ancients will not be challenged! Trespassers will be annihilated!',8646,1,0,'sartura SAY_AGGRO'), +(-1531009,'I sentence you to death!',8647,1,0,'sartura SAY_SLAY'), +(-1531010,'I serve to the last!',8648,1,0,'sartura SAY_DEATH'), +(-1531011,'is weakened!',0,2,0,'cthun EMOTE_WEAKENED'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1509027 AND -1509018; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1509018,'I am rejuvinated!',8593,1,0,'ossirian SAY_SURPREME1'), +(-1509019,'My powers are renewed!',8595,1,0,'ossirian SAY_SURPREME2'), +(-1509020,'My powers return!',8596,1,0,'ossirian SAY_SURPREME3'), +(-1509021,'Protect the city at all costs!',8597,1,0,'ossirian SAY_RAND_INTRO1'), +(-1509022,'The walls have been breached!',8599,1,0,'ossirian SAY_RAND_INTRO2'), +(-1509023,'To your posts. Defend the city.',8600,1,0,'ossirian SAY_RAND_INTRO3'), +(-1509024,'Tresspassers will be terminated.',8601,1,0,'ossirian SAY_RAND_INTRO4'), +(-1509025,'Sands of the desert rise and block out the sun!',8598,1,0,'ossirian SAY_AGGRO'), +(-1509026,'You are terminated.',8602,1,0,'ossirian SAY_SLAY'), +(-1509027,'I...have...failed.',8594,1,0,'ossirian SAY_DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1564096 AND -1564000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1564000,'You will die in the name of Lady Vashj!',11450,1,0,'SAY_AGGRO'), +(-1564001,'Stick around!',11451,1,0,'SAY_NEEDLE1'), +(-1564002,'I\'ll deal with you later!',11452,1,0,'SAY_NEEDLE2'), +(-1564003,'Your success was short lived!',11455,1,0,'SAY_SLAY1'), +(-1564004,'Time for you to go!',11456,1,0,'SAY_SLAY2'), +(-1564005,'Bel\'anen dal\'lorei!',11453,1,0,'SAY_SPECIAL1'), +(-1564006,'Blood will flow!',11454,1,0,'SAY_SPECIAL2'), +(-1564007,'Bal\'amer ch\'itah!',11457,1,0,'SAY_ENRAGE1'), +(-1564008,'My patience has ran out! Die, DIE!',11458,1,0,'SAY_ENRAGE2'), +(-1564009,'Lord Illidan will... crush you.',11459,1,0,'SAY_DEATH'), +(-1564010,'%s acquires a new target!',0,3,0,'supremus EMOTE_NEW_TARGET'), +(-1564011,'%s punches the ground in anger!',0,3,0,'supremus EMOTE_PUNCH_GROUND'), +(-1564012,'The ground begins to crack open!',0,3,0,'supremus EMOTE_GROUND_CRACK'), +(-1564013,'No! Not yet...',11385,1,0,'akama shade SAY_LOW_HEALTH'), +(-1564014,'I will not last much longer...',11386,1,0,'akama shade SAY_DEATH'), +(-1564015,'Come out from the shadows! I\'ve returned to lead you against our true enemy! Shed your chains and raise your weapons against your Illidari masters!',0,1,0,'akama shade SAY_FREE'), +(-1564016,'Hail our leader! Hail Akama!',0,1,0,'akama shade broken SAY_BROKEN_FREE_01'), +(-1564017,'Hail Akama!',0,1,0,'akama shade broken SAY_BROKEN_FREE_02'), +(-1564018,'You play, you pay.',11501,1,0,'shahraz SAY_TAUNT1'), +(-1564019,'I\'m not impressed.',11502,1,0,'shahraz SAY_TAUNT2'), +(-1564020,'Enjoying yourselves?',11503,1,0,'shahraz SAY_TAUNT3'), +(-1564021,'So... business or pleasure?',11504,1,0,'shahraz SAY_AGGRO'), +(-1564022,'You seem a little tense.',11505,1,0,'shahraz SAY_SPELL1'), +(-1564023,'Don\'t be shy.',11506,1,0,'shahraz SAY_SPELL2'), +(-1564024,'I\'m all... yours.',11507,1,0,'shahraz SAY_SPELL3'), +(-1564025,'Easy come, easy go.',11508,1,0,'shahraz SAY_SLAY1'), +(-1564026,'So much for a happy ending.',11509,1,0,'shahraz SAY_SLAY2'), +(-1564027,'Stop toying with my emotions!',11510,1,0,'shahraz SAY_ENRAGE'), +(-1564028,'I wasn\'t... finished.',11511,1,0,'shahraz SAY_DEATH'), +(-1564029,'Horde will... crush you.',11432,1,0,'bloodboil SOUND_AGGRO'), +(-1564030,'Time to feast!',11433,1,0,'bloodboil SAY_SLAY1'), +(-1564031,'More! I want more!',11434,1,0,'bloodboil SAY_SLAY2'), +(-1564032,'Drink your blood! Eat your flesh!',11435,1,0,'bloodboil SAY_SPECIAL1'), +(-1564033,'I hunger!',11436,1,0,'bloodboil SAY_SPECIAL2'), +(-1564034,'',11437,1,0,'bloodboil SAY_ENRAGE1'), +(-1564035,'I\'ll rip the meat from your bones!',11438,1,0,'bloodboil SAY_ENRAGE2'), +(-1564036,'Aaaahrg...',11439,1,0,'bloodboil SAY_DEATH'), +(-1564037,'I was the first, you know. For me, the wheel of death has spun many times. So much time has passed. I have a lot of catching up to do...',11512,1,0,'teron SAY_INTRO'), +(-1564038,'Vengeance is mine!',11513,1,0,'teron SAY_AGGRO'), +(-1564039,'I have use for you!',11514,1,0,'teron SAY_SLAY1'), +(-1564040,'It gets worse...',11515,1,0,'teron SAY_SLAY2'), +(-1564041,'What are you afraid of?',11517,1,0,'teron SAY_SPELL1'), +(-1564042,'Death... really isn\'t so bad.',11516,1,0,'teron SAY_SPELL2'), +(-1564043,'Give in!',11518,1,0,'teron SAY_SPECIAL1'), +(-1564044,'I have something for you...',11519,1,0,'teron SAY_SPECIAL2'), +(-1564045,'YOU WILL SHOW THE PROPER RESPECT!',11520,1,0,'teron SAY_ENRAGE'), +(-1564046,'The wheel...spins...again....',11521,1,0,'teron SAY_DEATH'), +(-1564047,'Pain and suffering are all that await you!',11415,1,0,'essence SUFF_SAY_FREED'), +(-1564048,'Don\'t leave me alone!',11416,1,0,'essence SUFF_SAY_AGGRO'), +(-1564049,'Look at what you make me do!',11417,1,0,'essence SUFF_SAY_SLAY1'), +(-1564050,'I didn\'t ask for this!',11418,1,0,'essence SUFF_SAY_SLAY2'), +(-1564051,'The pain is only beginning!',11419,1,0,'essence SUFF_SAY_SLAY3'), +(-1564052,'I don\'t want to go back!',11420,1,0,'essence SUFF_SAY_RECAP'), +(-1564053,'Now what do I do?',11421,1,0,'essence SUFF_SAY_AFTER'), +(-1564054,'%s becomes enraged!',0,3,0,'essence SUFF_EMOTE_ENRAGE'), +(-1564055,'You can have anything you desire... for a price.',11408,1,0,'essence DESI_SAY_FREED'), +(-1564056,'Fulfilment is at hand!',11409,1,0,'essence DESI_SAY_SLAY1'), +(-1564057,'Yes... you\'ll stay with us now...',11410,1,0,'essence DESI_SAY_SLAY2'), +(-1564058,'Your reach exceeds your grasp.',11412,1,0,'essence DESI_SAY_SLAY3'), +(-1564059,'Be careful what you wish for...',11411,1,0,'essence DESI_SAY_SPEC'), +(-1564060,'I\'ll be waiting...',11413,1,0,'essence DESI_SAY_RECAP'), +(-1564061,'I won\'t be far...',11414,1,0,'essence DESI_SAY_AFTER'), +(-1564062,'Beware: I live!',11399,1,0,'essence ANGER_SAY_FREED'), +(-1564063,'So... foolish.',11400,1,0,'essence ANGER_SAY_FREED2'), +(-1564064,'',11401,1,0,'essence ANGER_SAY_SLAY1'), +(-1564065,'Enough. No more.',11402,1,0,'essence ANGER_SAY_SLAY2'), +(-1564066,'On your knees!',11403,1,0,'essence ANGER_SAY_SPEC'), +(-1564067,'Beware, coward.',11405,1,0,'essence ANGER_SAY_BEFORE'), +(-1564068,'I won\'t... be... ignored.',11404,1,0,'essence ANGER_SAY_DEATH'), +(-1564069,'You wish to test me?',11524,1,0,'council vera AGGRO'), +(-1564070,'I have better things to do...',11422,1,0,'council gath AGGRO'), +(-1564071,'Flee or die!',11482,1,0,'council mala AGGRO'), +(-1564072,'Common... such a crude language. Bandal!',11440,1,0,'council zere AGGRO'), +(-1564073,'Enough games!',11428,1,0,'council gath ENRAGE'), +(-1564074,'You wish to kill me? Hahaha, you first!',11530,1,0,'council vera ENRAGE'), +(-1564075,'For Quel\'Thalas! For the Sunwell!',11488,1,0,'council mala ENRAGE'), +(-1564076,'Sha\'amoor sine menoor!',11446,1,0,'council zere ENRAGE'), +(-1564077,'Enjoy your final moments!',11426,1,0,'council gath SPECIAL1'), +(-1564078,'You\'re not caught up for this!',11528,1,0,'council vera SPECIAL1'), +(-1564079,'No second chances!',11486,1,0,'council mala SPECIAL1'), +(-1564080,'Diel fin\'al',11444,1,0,'council zere SPECIAL1'), +(-1564081,'You are mine!',11427,1,0,'council gath SPECIAL2'), +(-1564082,'Anar\'alah belore!',11529,1,0,'council vera SPECIAL2'), +(-1564083,'I\'m full of surprises!',11487,1,0,'council mala SPECIAL2'), +(-1564084,'Sha\'amoor ara mashal?',11445,1,0,'council zere SPECIAL2'), +(-1564085,'Selama am\'oronor!',11423,1,0,'council gath SLAY'), +(-1564086,'Valiant effort!',11525,1,0,'council vera SLAY'), +(-1564087,'My work is done.',11483,1,0,'council mala SLAY'), +(-1564088,'Shorel\'aran.',11441,1,0,'council zere SLAY'), +(-1564089,'Well done!',11424,1,0,'council gath SLAY_COMT'), +(-1564090,'A glorious kill!',11526,1,0,'council vera SLAY_COMT'), +(-1564091,'As it should be!',11484,1,0,'council mala SLAY_COMT'), +(-1564092,'Belesa menoor!',11442,1,0,'council zere SLAY_COMT'), +(-1564093,'Lord Illidan... I...',11425,1,0,'council gath DEATH'), +(-1564094,'You got lucky!',11527,1,0,'council vera DEATH'), +(-1564095,'Destiny... awaits.',11485,1,0,'council mala DEATH'), +(-1564096,'Diel ma\'ahn... oreindel\'o',11443,1,0,'council zere DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1409018 AND -1409000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1409000,'performs one last service for Ragnaros.',0,2,0,'geddon EMOTE_SERVICE'), +(-1409001,'goes into a killing frenzy!',0,2,0,'magmadar EMOTE_FRENZY'), +(-1409002,'refuses to die while its master is in trouble.',0,2,0,'core rager EMOTE_AEGIS'), +(-1409003,'Reckless mortals, none may challenge the sons of the living flame!',8035,1,0,'majordomo SAY_AGGRO'), +(-1409004,'The runes of warding have been destroyed! Hunt down the infedels my bretheren.',8039,1,0,'majordomo SAY_SPAWN'), +(-1409005,'Ashes to Ashes!',8037,1,0,'majordomo SAY_SLAY'), +(-1409006,'Burn mortals! Burn for this transgression!',8036,1,0,'majordomo SAY_SPECIAL'), +(-1409007,'Impossible! Stay your attack mortals! I submitt! I submitt! Brashly you have come to rest the secrets of the living flame. You will soon regret the recklessness of your quest. I go now to summon the lord whos house this is. Should you seek an audiance with him your paltry lives will surly be forfit. Nevertheless seek out his lair if you dare!',8038,1,0,'majordomo SAY_DEFEAT'), +(-1409008,'Behold Ragnaros, the Firelord! He who was ancient when this world was young! Bow before him, mortals! Bow before your ending!',8040,1,0,'ragnaros SAY_SUMMON_MAJ'), +(-1409009,'TOO SOON! YOU HAVE AWAKENED ME TOO SOON, EXECUTUS! WHAT IS THE MEANING OF THIS INTRUSION?',8043,1,0,'ragnaros SAY_ARRIVAL1_RAG'), +(-1409010,'These mortal infidels, my lord! They have invaded your sanctum, and seek to steal your secrets!',8041,1,0,'ragnaros SAY_ARRIVAL2_MAJ'), +(-1409011,'FOOL! YOU ALLOWED THESE INSECTS TO RUN RAMPANT THROUGH THE HALLOWED CORE, AND NOW YOU LEAD THEM TO MY VERY LAIR? YOU HAVE FAILED ME, EXECUTUS! JUSTICE SHALL BE MET, INDEED!',8044,1,0,'ragnaros SAY_ARRIVAL3_RAG'), +(-1409012,'NOW FOR YOU, INSECTS. BOLDLY YOU SAUGHT THE POWER OF RAGNAROS NOW YOU SHALL SEE IT FIRST HAND.',8045,1,0,'ragnaros SAY_ARRIVAL5_RAG'), +(-1409013,'COME FORTH, MY SERVANTS! DEFEND YOUR MASTER!',8049,1,0,'ragnaros SAY_REINFORCEMENTS1'), +(-1409014,'YOU CANNOT DEFEAT THE LIVING FLAME! COME YOU MINIONS OF FIRE! COME FORTH YOU CREATURES OF HATE! YOUR MASTER CALLS!',8050,1,0,'ragnaros SAY_REINFORCEMENTS2'), +(-1409015,'BY FIRE BE PURGED!',8046,1,0,'ragnaros SAY_HAND'), +(-1409016,'TASTE THE FLAMES OF SULFURON!',8047,1,0,'ragnaros SAY_WRATH'), +(-1409017,'DIE INSECT!',8051,1,0,'ragnaros SAY_KILL'), +(-1409018,'MY PATIENCE IS DWINDILING! COME NATS TO YOUR DEATH!',8048,1,0,'ragnaros SAY_MAGMABURST'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1552030 AND -1552000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1552000,'It is a small matter to control the mind of the weak... for I bear allegiance to powers untouched by time, unmoved by fate. No force on this world or beyond harbors the strength to bend our knee... not even the mighty Legion!',11122,1,0,'skyriss SAY_INTRO'), +(-1552001,'Bear witness to the agent of your demise!',11123,1,0,'skyriss SAY_AGGRO'), +(-1552002,'Your fate is written!',11124,1,0,'skyriss SAY_KILL_1'), +(-1552003,'The chaos I have sown here is but a taste...',11125,1,0,'skyriss SAY_KILL_2'), +(-1552004,'You will do my bidding, weakling.',11127,1,0,'skyriss SAY_MIND_1'), +(-1552005,'Your will is no longer your own.',11128,1,0,'skyriss SAY_MIND_2'), +(-1552006,'Flee in terror!',11129,1,0,'skyriss SAY_FEAR_1'), +(-1552007,'I will show you horrors undreamed of!',11130,1,0,'skyriss SAY_FEAR_2'), +(-1552008,'We span the universe, as countless as the stars!',11131,1,0,'skyriss SAY_IMAGE'), +(-1552009,'I am merely one of... infinite multitudes.',11126,1,0,'skyriss SAY_DEATH'), +(-1552010,'Where in Bonzo\'s brass buttons am I? And who are-- yaaghh, that\'s one mother of a headache!',11171,1,0,'millhouse SAY_INTRO_1'), +(-1552011,'\"Lowly\"? I don\'t care who you are friend, no one refers to the mighty Millhouse Manastorm as \"Lowly\"! I have no idea what goes on here, but I will gladly join your fight against this impudent imbecile! Prepare to defend yourself, cretin!',11172,1,0,'millhouse SAY_INTRO_2'), +(-1552012,'I just need to get some things ready first. You guys go ahead and get started. I need to summon up some water...',11173,1,0,'millhouse SAY_WATER'), +(-1552013,'Fantastic! Next, some protective spells. Yes! Now we\'re cookin\'',11174,1,0,'millhouse SAY_BUFFS'), +(-1552014,'And of course i\'ll need some mana. You guys are gonna love this, just wait.',11175,1,0,'millhouse SAY_DRINK'), +(-1552015,'Aaalllriiiight!! Who ordered up an extra large can of whoop-ass?',11176,1,0,'millhouse SAY_READY'), +(-1552016,'I didn\'t even break a sweat on that one.',11177,1,0,'millhouse SAY_KILL_1'), +(-1552017,'You guys, feel free to jump in anytime.',11178,1,0,'millhouse SAY_KILL_2'), +(-1552018,'I\'m gonna light you up, sweet cheeks!',11179,1,0,'millhouse SAY_PYRO'), +(-1552019,'Ice, ice, baby!',11180,1,0,'millhouse SAY_ICEBLOCK'), +(-1552020,'Heal me! Oh, for the love of all that is holy, HEAL me! I\'m dying!',11181,1,0,'millhouse SAY_LOWHP'), +(-1552021,'You\'ll be hearing from my lawyer...',11182,1,0,'millhouse SAY_DEATH'), +(-1552022,'Who\'s bad? Who\'s bad? That\'s right: we bad!',11183,1,0,'millhouse SAY_COMPLETE'), +(-1552023,'I knew the prince would be angry but, I... I have not been myself. I had to let them out! The great one speaks to me, you see. Wait--outsiders. Kael\'thas did not send you! Good... I\'ll just tell the prince you released the prisoners!',11222,1,0,'mellichar YELL_INTRO1'), +(-1552024,'The naaru kept some of the most dangerous beings in existence here in these cells. Let me introduce you to another...',11223,1,0,'mellichar YELL_INTRO2'), +(-1552025,'Yes, yes... another! Your will is mine!',11224,1,0,'mellichar YELL_RELEASE1'), +(-1552026,'Behold another terrifying creature of incomprehensible power!',11225,1,0,'mellichar YELL_RELEASE2A'), +(-1552027,'What is this? A lowly gnome? I will do better, O\'great one.',11226,1,0,'mellichar YELL_RELEASE2B'), +(-1552028,'Anarchy! Bedlam! Oh, you are so wise! Yes, I see it now, of course!',11227,1,0,'mellichar YELL_RELEASE3'), +(-1552029,'One final cell remains. Yes, O\'great one, right away!',11228,1,0,'mellichar YELL_RELEASE4'), +(-1552030,'Welcome, O\'great one. I am your humble servant.',11229,1,0,'mellichar YELL_WELCOME'); + +DELETE FROM `script_texts` WHERE `entry`=-1000100; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000100,'Come, little ones. Face me!',0,1,0,'azuregos SAY_TELEPORT'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1249004 AND -1249000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1249000,'How fortuitous. Usually, I must leave my lair to feed.',0,1,0,'onyxia SAY_AGGRO'), +(-1249001,'Learn your place mortal!',0,1,0,'onyxia SAY_KILL'), +(-1249002,'This meaningless exertion bores me. I\'ll incinerate you all from above!',0,1,0,'onyxia SAY_PHASE_2_TRANS'), +(-1249003,'It seems you\'ll need another lesson, mortals!',0,1,0,'onyxia SAY_PHASE_3_TRANS'), +(-1249004,'takes in a deep breath...',0,1,0,'onyxia EMOTE_BREATH'); + +DELETE FROM `script_texts` WHERE `entry`=-1469031; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1469031,'goes into a frenzy!',0,2,0,'flamegor EMOTE_FRENZY'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000105 AND -1000101; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000101,'Follow me, $N. I\'ll take you to the Defias hideout. But you better protect me or I am as good as dead',0,0,7,'defias traitor SAY_START'), +(-1000102,'The entrance is hidden here in Moonbrook. Keep your eyes peeled for thieves. They want me dead.',0,0,7,'defias traitor SAY_PROGRESS'), +(-1000103,'You can go tell Stoutmantle this is where the Defias Gang is holed up, $N.',0,0,7,'defias traitor SAY_END'), +(-1000104,'%s coming in fast! Prepare to fight!',0,0,7,'defias traitor SAY_AGGRO_1'), +(-1000105,'Help!',0,0,7,'defias traitor SAY_AGGRO_2'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000110 AND -1000106; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000106,'Everyone ready?',0,0,1,'torek SAY_READY'), +(-1000107,'Ok, Lets move out!',0,0,1,'torek SAY_MOVE'), +(-1000108,'Prepare yourselves. Silverwing is just around the bend.',0,0,1,'torek SAY_PREPARE'), +(-1000109,'Silverwing is ours!',0,0,1,'torek SAY_WIN'), +(-1000110,'Go report that the outpost is taken. We will remain here.',0,0,1,'torek SAY_END'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000116 AND -1000111; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000111, 'Our house is this way, through the thicket.', 0, 0, 7, 'magwin SAY_START'), +(-1000112, 'Help me!', 0, 0, 7, 'magwin SAY_AGGRO'), +(-1000113, 'My poor family. Everything has been destroyed.', 0, 0, 7, 'magwin SAY_PROGRESS'), +(-1000114, 'Father! Father! You\'re alive!', 0, 0, 7, 'magwin SAY_END1'), +(-1000115, 'You can thank $N for getting me back here safely, father.', 0, 0, 7, 'magwin SAY_END2'), +(-1000116, 'hugs her father.', 0, 2, 7, 'magwin EMOTE_HUG'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1560048 AND -1560023; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1560023,'Very well then. Let\'s go!',10465,1,0,'thrall hillsbrad SAY_TH_START_EVENT_PART1'), +(-1560024,'As long as we\'re going with a new plan, I may aswell pick up a weapon and some armor.',0,0,0,'thrall hillsbrad SAY_TH_ARMORY'), +(-1560025,'A rider approaches!',10466,0,0,'thrall hillsbrad SAY_TH_SKARLOC_MEET'), +(-1560026,'I\'ll never be chained again!',10467,1,0,'thrall hillsbrad SAY_TH_SKARLOC_TAUNT'), +(-1560027,'Very well. Tarren Mill lies just west of here. Since time is of the essence...',10468,1,0,'thrall hillsbrad SAY_TH_START_EVENT_PART2'), +(-1560028,'Let\'s ride!',10469,0,0,'thrall hillsbrad SAY_TH_MOUNTS_UP'), +(-1560029,'Taretha must be in the inn. Let\'s go.',0,0,0,'thrall hillsbrad SAY_TH_CHURCH_END'), +(-1560030,'Taretha! What foul magic is this?',0,0,0,'thrall hillsbrad SAY_TH_MEET_TARETHA'), +(-1560031,'Who or what was that?',10470,1,0,'thrall hillsbrad SAY_TH_EPOCH_WONDER'), +(-1560032,'No!',10471,1,0,'thrall hillsbrad SAY_TH_EPOCH_KILL_TARETHA'), +(-1560033,'Goodbye, Taretha. I will never forget your kindness.',10472,1,0,'thrall hillsbrad SAY_TH_EVENT_COMPLETE'), +(-1560034,'Things are looking grim...',10458,1,0,'thrall hillsbrad SAY_TH_RANDOM_LOW_HP1'), +(-1560035,'I will fight to the last!',10459,1,0,'thrall hillsbrad SAY_TH_RANDOM_LOW_HP2'), +(-1560036,'Taretha...',10460,1,0,'thrall hillsbrad SAY_TH_RANDOM_DIE1'), +(-1560037,'A good day...to die...',10461,1,0,'thrall hillsbrad SAY_TH_RANDOM_DIE2'), +(-1560038,'I have earned my freedom!',10448,1,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO1'), +(-1560039,'This day is long overdue. Out of my way!',10449,1,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO2'), +(-1560040,'I am a slave no longer!',10450,1,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO3'), +(-1560041,'Blackmoore has much to answer for!',10451,1,0,'thrall hillsbrad SAY_TH_RANDOM_AGGRO4'), +(-1560042,'You have forced my hand!',10452,1,0,'thrall hillsbrad SAY_TH_RANDOM_KILL1'), +(-1560043,'It should not have come to this!',10453,1,0,'thrall hillsbrad SAY_TH_RANDOM_KILL2'), +(-1560044,'I did not ask for this!',10454,1,0,'thrall hillsbrad SAY_TH_RANDOM_KILL3'), +(-1560045,'I am truly in your debt, strangers.',10455,1,0,'thrall hillsbrad SAY_TH_LEAVE_COMBAT1'), +(-1560046,'Thank you, strangers. You have given me hope.',10456,1,0,'thrall hillsbrad SAY_TH_LEAVE_COMBAT2'), +(-1560047,'I will not waste this chance. I will seek out my destiny.',10457,1,0,'thrall hillsbrad SAY_TH_LEAVE_COMBAT3'), +(-1560048,'I\'m free! Thank you all!',0,0,0,'taretha SAY_TA_FREE'); +DELETE FROM `script_texts` WHERE `entry`=-1560049; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1560049,'Thrall, you escaped!',0,0,0,'taretha SAY_TA_ESCAPED'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1534017 AND -1534000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1534000,'I\'m in jeopardy, help me if you can!',11007,1,0,'jaina hyjal ATTACKED 1'), +(-1534001,'They\'ve broken through!',11049,1,0,'jaina hyjal ATTACKED 2'), +(-1534002,'Stay alert! Another wave approaches.',11008,1,0,'jaina hyjal INCOMING'), +(-1534003,'Don\'t give up! We must prevail!',11006,1,0,'jaina hyjal BEGIN'), +(-1534004,'Hold them back as long as possible.',11050,1,0,'jaina hyjal RALLY 1'), +(-1534005,'We must hold strong!',11051,1,0,'jaina hyjal RALLY 2'), +(-1534006,'We are lost. Fall back!',11009,1,0,'jaina hyjal FAILURE'), +(-1534007,'We have won valuable time. Now we must pull back!',11011,1,0,'jaina hyjal SUCCESS'), +(-1534008,'I did... my best.',11010,1,0,'jaina hyjal DEATH'), +(-1534009,'I will lie down for no one!',11031,1,0,'thrall hyjal ATTACKED 1'), +(-1534010,'Bring the fight to me and pay with your lives!',11061,1,0,'thrall hyjal ATTACKED 2'), +(-1534011,'Make ready for another wave! LOK-TAR OGAR!',11032,1,0,'thrall hyjal INCOMING'), +(-1534012,'Hold them back! Do not falter!',11030,1,0,'thrall hyjal BEGIN'), +(-1534013,'Victory or death!',11059,1,0,'thrall hyjal RALLY 1'), +(-1534014,'Do not give an inch of ground!',11060,1,0,'thrall hyjal RALLY 2'), +(-1534015,'It is over. Withdraw! We have failed.',11033,1,0,'thrall hyjal FAILURE'), +(-1534016,'We have played our part and done well. It is up to the others now.',11035,1,0,'thrall hyjal SUCCESS'), +(-1534017,'Uraaa...',11034,1,0,'thrall hyjal DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1534030 AND -1534018; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1534018,'All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more.',10986,1,0,'archimonde SAY_PRE_EVENTS_COMPLETE'), +(-1534019,'Your resistance is insignificant.',10987,1,0,'archimonde SAY_AGGRO'), +(-1534020,'This world will burn!',10990,1,0,'archimonde SAY_DOOMFIRE1'), +(-1534021,'Manach sheek-thrish!',11041,1,0,'archimonde SAY_DOOMFIRE2'), +(-1534022,'A-kreesh!',10989,1,0,'archimonde SAY_AIR_BURST1'), +(-1534023,'Away vermin!',11043,1,0,'archimonde SAY_AIR_BURST2'), +(-1534024,'All creation will be devoured!',11044,1,0,'archimonde SAY_SLAY1'), +(-1534025,'Your soul will languish for eternity.',10991,1,0,'archimonde SAY_SLAY2'), +(-1534026,'I am the coming of the end!',11045,1,0,'archimonde SAY_SLAY3'), +(-1534027,'At last it is here. Mourn and lament the passing of all you have ever known and all that would have been! Akmin-kurai!',10993,1,0,'archimonde SAY_ENRAGE'), +(-1534028,'No, it cannot be! Nooo!',10992,1,0,'archimonde SAY_DEATH'), +(-1534029,'You are mine now.',10988,1,0,'archimonde SAY_SOUL_CHARGE1'), +(-1534030,'Bow to my will.',11042,1,0,'archimonde SAY_SOUL_CHARGE2'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000117 AND -1000122; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000117, 'Thank you for agreeing to help. Now, let\'s get out of here $N.', 0, 0, 1, 'wounded elf SAY_ELF_START'), +(-1000118, 'Over there! They\'re following us!', 0, 0, 1, 'wounded elf SAY_ELF_SUMMON1'), +(-1000119, 'Allow me a moment to rest. The journey taxes what little strength I have.', 0, 0, 1, 'wounded elf SAY_ELF_RESTING'), +(-1000120, 'Did you hear something?', 0, 0, 1, 'wounded elf SAY_ELF_SUMMON2'), +(-1000121, 'Falcon Watch, at last! Now, where\'s my... Oh no! My pack, it\'s missing! Where has -', 0, 0, 1, 'wounded elf SAY_ELF_COMPLETE'), +(-1000122, 'You won\'t keep me from getting to Falcon Watch!', 0, 0, 1, 'wounded elf SAY_ELF_AGGRO'); +DELETE FROM `script_texts` WHERE `entry`=-1544015; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1544015,'breaks free!',0,2,0,'magtheridon EMOTE_FREED'); + +UPDATE `script_texts` SET `type`=3 WHERE `entry`=-1544013; +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1189004 AND -1189000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1189000,'Ah, I have been waiting for a real challenge!',5830,1,0,'herod SAY_AGGRO'), +(-1189001,'Blades of Light!',5832,1,0,'herod SAY_WHIRLWIND'), +(-1189002,'Light, give me strength!',5833,1,0,'herod SAY_ENRAGE'), +(-1189003,'Hah, is that all?',5831,1,0,'herod SAY_KILL'), +(-1189004,'becomes enraged!',0,2,0,'herod EMOTE_ENRAGE'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1189010 AND -1189005; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1189005,'Infidels! They must be purified!',5835,1,0,'mograine SAY_MO_AGGRO'), +(-1189006,'Unworthy!',5836,1,0,'mograine SAY_MO_KILL'), +(-1189007,'At your side, milady!',5837,1,0,'mograine SAY_MO_RESSURECTED'), +(-1189008,'What, Mograine has fallen? You shall pay for this treachery!',5838,1,0,'whitemane SAY_WH_INTRO'), +(-1189009,'The Light has spoken!',5839,1,0,'whitemane SAY_WH_KILL'), +(-1189010,'Arise, my champion!',5840,1,0,'whitemane SAY_WH_RESSURECT'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1532114 AND -1532103; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1532103,'Welcome Ladies and Gentlemen, to this evening\'s presentation!',9174,1,0,'barnes OZ1'), +(-1532104,'Tonight we plumb the depths of the human soul as we join a lost, lonely girl trying desperately -- with the help of her loyal companions -- to find her way home!',9338,1,0,'barnes OZ2'), +(-1532105,'But she is pursued... by a wicked malevolent crone!',9339,1,0,'barnes OZ3'), +(-1532106,'Will she survive? Will she prevail? Only time will tell. And now ... on with the show!',9340,1,0,'barnes OZ4'), +(-1532107,'Good evening, Ladies and Gentlemen! Welcome to this evening\'s presentation!',9175,1,0,'barnes HOOD1'), +(-1532108,'Tonight, things are not what they seem. For tonight, your eyes may not be trusted',9335,1,0,'barnes HOOD2'), +(-1532109,'Take for instance, this quiet, elderly woman, waiting for a visit from her granddaughter. Surely there is nothing to fear from this sweet, grey-haired, old lady.',9336,1,0,'barnes HOOD3'), +(-1532110,'But don\'t let me pull the wool over your eyes. See for yourself what lies beneath those covers! And now... on with the show!',9337,1,0,'barnes HOOD4'), +(-1532111,'Welcome, Ladies and Gentlemen, to this evening\'s presentation!',9176,1,0,'barnes RAJ1'), +(-1532112,'Tonight, we explore a tale of forbidden love!',9341,1,0,'barnes RAJ2'), +(-1532113,'But beware, for not all love stories end happily, as you may find out. Sometimes, love pricks like a thorn.',9342,1,0,'barnes RAJ3'), +(-1532114,'But don\'t take it from me, see for yourself what tragedy lies ahead when the paths of star-crossed lovers meet. And now...on with the show!',9343,1,0,'barnes RAJ4'); +DELETE FROM `script_texts` WHERE `entry` IN (-1036000,-1036001); +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1036000,'You there, check out that noise!',5775,1,7,'smite INST_SAY_ALARM1'), +(-1036001,'We\'re under attack! A vast, ye swabs! Repel the invaders!',5777,1,7,'smite INST_SAY_ALARM2'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000127 AND -1000123; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000123, 'Ready when you are, $c.', 0, 0, 0, 'big will SAY_BIG_WILL_READY'), +(-1000124, 'The Affray has begun. $n, get ready to fight!', 0, 0, 0, 'twiggy SAY_TWIGGY_BEGIN'), +(-1000125, 'You! Enter the fray!', 0, 0, 0, 'twiggy SAY_TWIGGY_FRAY'), +(-1000126, 'Challenger is down!', 0, 0, 0, 'twiggy SAY_TWIGGY_DOWN'), +(-1000127, 'The Affray is over.', 0, 0, 0, 'twiggy SAY_TWIGGY_OVER'); diff --git a/sql/updates/2.4.3_old/502_world_scripts.sql b/sql/updates/2.4.3_old/502_world_scripts.sql new file mode 100644 index 0000000..458d8bb --- /dev/null +++ b/sql/updates/2.4.3_old/502_world_scripts.sql @@ -0,0 +1,6 @@ +UPDATE `creature_template` SET `minhealth`=2655000, `maxhealth`=2655000, `ScriptName` = 'boss_the_lurker_below', `InhabitType` = '3' WHERE `entry` = '21217'; + +UPDATE `creature_template` SET `ScriptName` = 'mob_coilfang_ambusher' WHERE `entry` = '21865'; +UPDATE `creature_template` SET `ScriptName` = 'mob_coilfang_guardian' WHERE `entry` = '21873'; + +UPDATE `creature_model_info` SET `bounding_radius` = '13', `combat_reach` = '20' WHERE `modelid` = '20216'; diff --git a/sql/updates/2.4.3_old/505_world.sql b/sql/updates/2.4.3_old/505_world.sql new file mode 100644 index 0000000..fe3b3c8 --- /dev/null +++ b/sql/updates/2.4.3_old/505_world.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS `creature_formations`; + +CREATE TABLE `creature_formations` ( + `leader` int(11) unsigned NOT NULL, + `follower` int(11) unsigned NOT NULL, + `dist` float unsigned NOT NULL, + `angle` float unsigned NOT NULL, + `groupAI` int(11) unsigned NOT NULL, + PRIMARY KEY (`follower`)); diff --git a/sql/updates/2.4.3_old/506_world.sql b/sql/updates/2.4.3_old/506_world.sql new file mode 100644 index 0000000..069690c --- /dev/null +++ b/sql/updates/2.4.3_old/506_world.sql @@ -0,0 +1,83 @@ +-- added missing entry for 3rd rank of gift of the wild + +DELETE FROM spell_chain WHERE spell_id = 21849; +DELETE FROM spell_chain WHERE spell_id = 21850; +DELETE FROM spell_chain WHERE spell_id = 26991; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (21849,0,21849,1,0); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (21850,21849,21849,2,0); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (26991,21850,21849,3,0); + +-- weaponsmith and armorsmith as blacksmith req spells + +DELETE FROM spell_chain WHERE spell_id = 9787; +DELETE FROM spell_chain WHERE spell_id = 9788; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (9787,0,9787,1,9785); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (9788,0,9788,1,9785); + +-- axe/sword/hammer smith req weaponsmith + +DELETE FROM spell_chain WHERE spell_id = 17039; +DELETE FROM spell_chain WHERE spell_id = 17040; +DELETE FROM spell_chain WHERE spell_id = 17041; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (17039,0,17039,1,9787); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (17040,0,17040,1,9787); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (17041,0,17041,1,9787); + +-- letherworking specs req spells + +DELETE FROM spell_chain WHERE spell_id = 10660; +DELETE FROM spell_chain WHERE spell_id = 10658; +DELETE FROM spell_chain WHERE spell_id = 10656; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (10660,0,10660,1,10662); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (10658,0,10658,1,10662); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (10656,0,10656,1,10662); + +-- alchemy specs req spells + +DELETE FROM spell_chain WHERE spell_id = 28672; +DELETE FROM spell_chain WHERE spell_id = 28675; +DELETE FROM spell_chain WHERE spell_id = 28677; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (28672,0,28672,1,28596); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (28675,0,28675,1,28596); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (28677,0,28677,1,28596); + +-- tailoring specs req spells + +DELETE FROM spell_chain WHERE spell_id = 26801; +DELETE FROM spell_chain WHERE spell_id = 26798; +DELETE FROM spell_chain WHERE spell_id = 26797; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (26801,0,26801,1,26790); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (26798,0,26798,1,26790); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (26797,0,26797,1,26790); + +-- engineering specs req spells + +DELETE FROM spell_chain WHERE spell_id = 20222; +DELETE FROM spell_chain WHERE spell_id = 20219; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (20222,0,20222,1,12656); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (20219,0,20219,1,12656); + +-- divine spirit req spells + +DELETE FROM spell_chain WHERE spell_id = 27681; +DELETE FROM spell_chain WHERE spell_id = 32999; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (27681,0,27681,1,14752); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (32999,27681,27681,2,0); + +-- judgement of justice req seal of justice(dunno what is this for) + +DELETE FROM spell_chain WHERE spell_id = 20184; +DELETE FROM spell_chain WHERE spell_id = 31896; + +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (20184,0,20184,1,20164); +INSERT INTO spell_chain (spell_id,prev_spell,first_spell,rank,req_spell) VALUES (31896,20184,20184,2,0); + +ALTER TABLE spell_chain DROP COLUMN prev_spell; diff --git a/sql/updates/2.4.3_old/513_world_scripts.sql b/sql/updates/2.4.3_old/513_world_scripts.sql new file mode 100644 index 0000000..21a57ea --- /dev/null +++ b/sql/updates/2.4.3_old/513_world_scripts.sql @@ -0,0 +1,19 @@ +UPDATE `instance_template` SET `script`='instance_dark_portal' WHERE `map`=269; +UPDATE `creature_template` SET `ScriptName`='npc_medivh_bm' WHERE `entry`=15608; +UPDATE `creature_template` SET `ScriptName`='npc_time_rift' WHERE `entry`=17838; +UPDATE `creature_template` SET `ScriptName`='npc_saat' WHERE `entry`=20201; + + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1269028 AND -1269018; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1269018,'goes into a frenzy!',0,2,0,'aeonus EMOTE_FRENZY'), +(-1269019,'Stop! Do not go further, mortals. You are ill-prepared to face the forces of the Infinite Dragonflight. Come, let me help you.',0,0,0,'saat SAY_SAAT_WELCOME'), +(-1269020,'The time has come! Gul\'dan, order your warlocks to double their efforts! Moments from now the gateway will open, and your Horde will be released upon this ripe, unsuspecting world!',10435,1,0,'medivh SAY_ENTER'), +(-1269021,'What is this? Champions, coming to my aid? I sense the hand of the dark one in this. Truly this sacred event bears his blessing?',10436,1,0,'medivh SAY_INTRO'), +(-1269022,'Champions, my shield grows weak!',10437,1,0,'medivh SAY_WEAK75'), +(-1269023,'My powers must be concentrated on the portal! I do not have time to hold the shield!',10438,1,0,'medivh SAY_WEAK50'), +(-1269024,'The shield is nearly gone! All that I have worked for is in danger!',10439,1,0,'medivh SAY_WEAK25'), +(-1269025,'No... damn this feeble mortal coil...',10441,1,0,'medivh SAY_DEATH'), +(-1269026,'I am grateful for your aid, champions. Now, Gul\'dan\'s Horde will sweep across this world, like a locust swarm, and all my designs, all my carefully laid plans will at last fall into place.',10440,1,0,'medivh SAY_WIN'), +(-1269027,'Orcs of the Horde! This portalis the gateway to your new destiny! Azeroth lies before you, ripe for the taking!',0,1,0,'medivh SAY_ORCS_ENTER'), +(-1269028,'Gul\'dan speaks the truth! We should return at once to tell our brothers of the news! Retreat back trought the portal!',0,1,0,'medivh SAY_ORCS_ANSWER'); diff --git a/sql/updates/2.4.3_old/519_world.sql b/sql/updates/2.4.3_old/519_world.sql new file mode 100644 index 0000000..2423f94 --- /dev/null +++ b/sql/updates/2.4.3_old/519_world.sql @@ -0,0 +1,2 @@ +ALTER TABLE `creature_formations` CHANGE `leader` `leaderGUID` int(11) unsigned NOT NULL default '0'; +ALTER TABLE `creature_formations` CHANGE `follower` `memberGUID` int(11) unsigned NOT NULL default '0'; diff --git a/sql/updates/2.4.3_old/537_world.sql b/sql/updates/2.4.3_old/537_world.sql new file mode 100644 index 0000000..2401a5a --- /dev/null +++ b/sql/updates/2.4.3_old/537_world.sql @@ -0,0 +1,2 @@ +-- Removing the now unused creature_movement table +DROP TABLE IF EXISTS `creature_movement`; diff --git a/sql/updates/2.4.3_old/541_characters.sql b/sql/updates/2.4.3_old/541_characters.sql new file mode 100644 index 0000000..2651c06 --- /dev/null +++ b/sql/updates/2.4.3_old/541_characters.sql @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS `saved_variables`; +CREATE TABLE `saved_variables` ( + `NextArenaPointDistributionTime` bigint(40) UNSIGNED NOT NULL DEFAULT '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Variable Saves'; + +ALTER TABLE `arena_team_member` DROP COLUMN `points_to_add`; +ALTER TABLE `arena_team_member` ADD COLUMN `personal_rating` int(10) UNSIGNED NOT NULL DEFAULT '0'; +ALTER TABLE `characters` ADD COLUMN `arena_pending_points` int(10) UNSIGNED NOT NULL default '0' AFTER `taxi_path`; diff --git a/sql/updates/2.4.3_old/541_world.sql b/sql/updates/2.4.3_old/541_world.sql new file mode 100644 index 0000000..e381865 --- /dev/null +++ b/sql/updates/2.4.3_old/541_world.sql @@ -0,0 +1,26 @@ +DELETE FROM `command` WHERE `name` = "flusharenapoints"; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('flusharenapoints','3','Syntax: .flusharenapoints\r\n\r\nUse it to distribute arena points based on arena team ratings, and start a new week.'); + +DELETE FROM trinity_string WHERE entry BETWEEN 1122 AND 1138; + +INSERT INTO trinity_string (entry, content_default) VALUES + (1122,'Your group is too large for this battleground. Please regroup to join.'), + (1123,'Your group is too large for this arena. Please regroup to join.'), + (1124,'Your group has members not in your arena team. Please regroup to join.'), + (1125,'Your group does not have enough players to join this match.'), + (1126,'The Gold Team wins!'), + (1127,'The Green Team wins!'), + (1128, 'There aren\'t enough players in this battleground. It will end soon unless some more players join to balance the fight.'), + (1129, 'Your group has an offline member. Please remove him before joining.'), + (1130, 'Your group has players from the opposing faction. You can\'t join the battleground as a group.'), + (1131, 'Your group has players from different battleground brakets. You can\'t join as group.'), + (1132, 'Someone in your party is already in this battleground queue. (S)he must leave it before joining as group.'), + (1133, 'Someone in your party is Deserter. You can\'t join as group.'), + (1134, 'Someone in your party is already in three battleground queues. You cannot join as group.'), + (1135, 'You cannot teleport to a battleground or arena map.'), + (1136, 'You cannot summon players to a battleground or arena map.'), + (1137, 'You must be in GM mode to teleport to a player in a battleground.'), + (1138, 'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.'); + +DELETE FROM trinity_string WHERE entry = 714 OR entry = 716; diff --git a/sql/updates/2.4.3_old/542_characters.sql b/sql/updates/2.4.3_old/542_characters.sql new file mode 100644 index 0000000..4cc3beb --- /dev/null +++ b/sql/updates/2.4.3_old/542_characters.sql @@ -0,0 +1,74 @@ +UPDATE + `arena_team_member` AS `a`, + (SELECT + `attq1`.`guid` AS `b_guid`, + `atid`, `atpr` + FROM + (SELECT + `guid`, + `name`, + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',1545),' ',-1) AS `atid`, + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',1550),' ',-1) AS `atpr` + FROM + `characters`) AS `attq1` + INNER JOIN + `arena_team_member` ON `arenateamid` = `atid` AND + `arena_team_member`.`guid` = `attq1`.`guid` + WHERE + `atid` <> 0) + AS `b` +SET + `a`.`personal_rating` = `b`.`atpr` +WHERE + `a`.`arenateamid` = `b`.`atid` AND + `a`.`guid` = `b`.`b_guid`; + +UPDATE + `arena_team_member` AS `a`, + (SELECT + `attq1`.`guid` AS `b_guid`, + `atid`, `atpr` + FROM + (SELECT + `guid`, + `name`, + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',1551),' ',-1) AS `atid`, + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',1556),' ',-1) AS `atpr` + FROM + `characters`) AS `attq1` + INNER JOIN + `arena_team_member` ON `arenateamid` = `atid` AND + `arena_team_member`.`guid` = `attq1`.`guid` + WHERE + `atid` <> 0) + AS `b` +SET + `a`.`personal_rating` = `b`.`atpr` +WHERE + `a`.`arenateamid` = `b`.`atid` AND + `a`.`guid` = `b`.`b_guid`; + +UPDATE + `arena_team_member` AS `a`, + (SELECT + `attq1`.`guid` AS `b_guid`, + `atid`, `atpr` + FROM + (SELECT + `guid`, + `name`, + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',1557),' ',-1) AS `atid`, + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',1562),' ',-1) AS `atpr` + FROM + `characters`) AS `attq1` + INNER JOIN + `arena_team_member` ON `arenateamid` = `atid` AND + `arena_team_member`.`guid` = `attq1`.`guid` + WHERE + `atid` <> 0) + AS `b` +SET + `a`.`personal_rating` = `b`.`atpr` +WHERE + `a`.`arenateamid` = `b`.`atid` AND + `a`.`guid` = `b`.`b_guid`; diff --git a/sql/updates/2.4.3_old/54_world.sql b/sql/updates/2.4.3_old/54_world.sql new file mode 100644 index 0000000..2d5e984 --- /dev/null +++ b/sql/updates/2.4.3_old/54_world.sql @@ -0,0 +1,5 @@ +CREATE TABLE `game_event_battleground_holiday` ( + `event` int(10) unsigned NOT NULL, + `bgflag` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`event`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/2.4.3_old/551_world.sql b/sql/updates/2.4.3_old/551_world.sql new file mode 100644 index 0000000..5c45b8e --- /dev/null +++ b/sql/updates/2.4.3_old/551_world.sql @@ -0,0 +1,22 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = '36574'; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES ('36574', '36650', '0', 'Apply Phase Slip Vulnerability'); + +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=21807; +DELETE FROM `areatrigger_scripts` WHERE `entry`=4560; +INSERT INTO `areatrigger_scripts` VALUES (4560,'at_legion_teleporter'); +UPDATE `creature_template` SET `ScriptName`='npc_commander_dawnforge' WHERE `entry`=19831; +DELETE FROM `areatrigger_scripts` WHERE `entry`=4497; +INSERT INTO `areatrigger_scripts` VALUES (4497,'at_commander_dawnforge'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000137 AND -1000128; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000128, 'We need you to send reinforcements to Manaforge Duro, Ardonis. This is not a request, it\'s an order.', 0, 0, 0, 'dawnforge SAY_COMMANDER_DAWNFORGE_1'), +(-1000129, 'You cannot be serious! We are severely understaffed and can barely keep this manaforge functional!', 0, 0, 0, 'dawnforge SAY_ARCANIST_ARDONIS_1'), +(-1000130, 'You will do as ordered. Manaforge Duro has come under heavy attack by mana creatures and the situation is out of control. Failure to comply will not be tolerated!', 0, 0, 0, 'dawnforge SAY_COMMANDER_DAWNFORGE_2'), +(-1000131, 'Indeed, it is not a request.', 0, 0, 0, 'dawnforge SAY_PATHALEON_CULATOR_IMAGE_1'), +(-1000132, 'My lord!', 0, 0, 0, 'dawnforge SAY_COMMANDER_DAWNFORGE_3'), +(-1000133, 'Duro will be reinforced! Ultris was a complete disaster. I will NOT have that mistake repeated!', 0, 0, 0, 'dawnforge PATHALEON_CULATOR_IMAGE_2'), +(-1000134, 'We\'ve had too many setbacks along the way: Hellfire Citadel, Fallen Sky Ridge, Firewing Point... Prince Kael\'thas will tolerate no further delays. I will tolerate nothing other than complete success!', 0, 0, 0, 'dawnforge PATHALEON_CULATOR_IMAGE_2_1'), +(-1000135, 'I am returning to Tempest Keep. See to it that I do not have reason to return!', 0, 0, 0, 'dawnforge PATHALEON_CULATOR_IMAGE_2_2' ), +(-1000136, 'Yes, my lord.', 0, 0, 0, 'dawnforge COMMANDER_DAWNFORGE_4 SAY_ARCANIST_ARDONIS_2'), +(-1000137, 'See to it, Ardonis!', 0, 0, 0, 'dawnforge COMMANDER_DAWNFORGE_5'); diff --git a/sql/updates/2.4.3_old/566_world.sql b/sql/updates/2.4.3_old/566_world.sql new file mode 100644 index 0000000..6c176e1 --- /dev/null +++ b/sql/updates/2.4.3_old/566_world.sql @@ -0,0 +1,24 @@ +INSERT INTO spell_script_target VALUES +(8913,1,1200), +(9095,1,6492), +(33655,0,183351), +(33655,0,183350), +(34526,1,19723), +(34526,1,19724), +(36904,0,21511), +(38738,0,185193), +(38738,0,185195), +(38738,0,185196), +(38738,0,185197), +(38738,0,185198), +(39844,0,185549), +(42391,0,300152), +(12613,1,5843), +(34019,2,16873), +(34019,2,16871), +(34019,2,19422), +(34019,2,16907), +(38015,1,21216), +(39011,1,20885), +(40106,1,22883), +(40105,1,22883); diff --git a/sql/updates/2.4.3_old/571_world.sql b/sql/updates/2.4.3_old/571_world.sql new file mode 100644 index 0000000..269ee69 --- /dev/null +++ b/sql/updates/2.4.3_old/571_world.sql @@ -0,0 +1,4 @@ +ALTER TABLE spell_chain DROP COLUMN first_spell; +ALTER TABLE spell_chain DROP COLUMN rank; +ALTER TABLE spell_chain RENAME TO spell_required; +DELETE FROM spell_required WHERE req_spell=0; diff --git a/sql/updates/2.4.3_old/572_world.sql b/sql/updates/2.4.3_old/572_world.sql new file mode 100644 index 0000000..33ce446 --- /dev/null +++ b/sql/updates/2.4.3_old/572_world.sql @@ -0,0 +1,7 @@ +UPDATE `creature_template` SET `ScriptName`='npc_aeranas' WHERE `entry`=17085; +UPDATE `gameobject_template` SET `ScriptName`='go_haaleshi_altar' WHERE `entry`=181606; + +DELETE FROM `script_texts` WHERE `entry` IN (-1000138,-1000139); +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000138, 'Avruu\'s magic... it still controls me. You must fight me, mortal. It\'s the only way to break the spell!', 0, 0, 0, 'aeranas SAY_SUMMON'), +(-1000139, 'Avruu\'s magic is broken! I\'m free once again!', 0, 0, 0, 'aeranas SAY_FREE'); diff --git a/sql/updates/2.4.3_old/575_world_scripts.sql b/sql/updates/2.4.3_old/575_world_scripts.sql new file mode 100644 index 0000000..85a7521 --- /dev/null +++ b/sql/updates/2.4.3_old/575_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `item_template` SET `ScriptName` = "item_only_for_flight" WHERE `entry` IN (34475, 34489, 24538); diff --git a/sql/updates/2.4.3_old/57_world_scripts.sql b/sql/updates/2.4.3_old/57_world_scripts.sql new file mode 100644 index 0000000..12263ac --- /dev/null +++ b/sql/updates/2.4.3_old/57_world_scripts.sql @@ -0,0 +1,39 @@ +/*sql for zulaman*/ +UPDATE `creature_template` SET `ScriptName` = 'boss_nalorakk' WHERE `entry` = 23576; +UPDATE `creature_template` SET `flags_extra` = 33 WHERE `entry` = 23576; /*no crush*/ + +UPDATE `creature_template` set `ScriptName` = 'boss_akilzon' where entry = 23574; +UPDATE `creature_template` set `ScriptName` = 'mob_akilzon_eagle' where `entry`=24858; /*default is event ai*/ + +UPDATE `creature_template` SET `ScriptName` = 'boss_halazzi' WHERE `entry` = '23577'; +UPDATE `creature_template` SET `ScriptName` = 'mob_halazzi_lynx' WHERE `entry` = '24143'; +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = '24224'; /*totem default `spell1` = '43301' should be in DB*/ + +UPDATE `creature_template` SET `ScriptName` = 'boss_janalai' WHERE `entry` = '23578'; +UPDATE `creature_template` SET `ScriptName` = 'mob_janalai_hatcher' WHERE `entry` = '23818'; +UPDATE `creature_template` SET `ScriptName` = 'mob_janalai_hatchling' WHERE `entry` = '23598'; +UPDATE `creature_template` SET `ScriptName` = 'mob_janalai_egg' WHERE `entry` = '23817'; +UPDATE `creature_template` SET `ScriptName` = 'mob_janalai_firebomb' WHERE `entry` = '23920'; + +UPDATE `creature_template` SET `ScriptName` = 'boss_hexlord_malacrass' WHERE `entry` =24239; +UPDATE `creature_template` SET `ScriptName` = 'boss_alyson_antille' WHERE `entry` =24240; +UPDATE `creature_template` SET `ScriptName` = 'boss_thurg' WHERE `entry` =24241; +UPDATE `creature_template` SET `ScriptName` = 'boss_slither' WHERE `entry` =24242; +UPDATE `creature_template` SET `ScriptName` = 'boss_lord_raadan' WHERE `entry` =24243; +UPDATE `creature_template` SET `ScriptName` = 'boss_gazakroth' WHERE `entry` =24244; +UPDATE `creature_template` SET `ScriptName` = 'boss_fenstalker' WHERE `entry` =24245; +UPDATE `creature_template` SET `ScriptName` = 'boss_darkheart' WHERE `entry` =24246; +UPDATE `creature_template` SET `ScriptName` = 'boss_koragg' WHERE `entry` =24247; +UPDATE `creature` SET `position_x` = '117.8827',`position_y` = '921.2795',`position_z` = '33.8883',`orientation` = '1.5696' WHERE `id` = '24239' LIMIT 1; +UPDATE `creature_template` SET `faction_A` = '1890', `faction_H` = '1890' WHERE `entry` in ('24240', '24241', '24242', '24243', '24244', '24245', '24246', '24247'); + +UPDATE `creature_template` SET `ScriptName` = 'boss_zuljin' WHERE `entry` =23863; +UPDATE `creature_template` SET `ScriptName` = 'do_nothing' WHERE `entry` = '24187'; +UPDATE `creature_template` SET `ScriptName` = 'mob_zuljin_vortex' WHERE `entry` = '24136'; +UPDATE `creature_template` SET `minlevel` = '73', `maxlevel` = '73' WHERE `entry` IN (24187, 24136); +DELETE FROM `spell_proc_event` WHERE `entry` = 43983; +INSERT INTO `spell_proc_event` VALUES ('43983', '0', '0', '0', '0', '0', '16384', '0', '0'); +DELETE FROM `spell_script_target` WHERE `entry` = 42577; +INSERT INTO `spell_script_target` VALUES ('42577', '1', '24136'); + +UPDATE `creature_template` SET `ScriptName` = 'npc_zulaman_hostage' WHERE `entry` IN (23790, 23999, 24024, 24001); diff --git a/sql/updates/2.4.3_old/583_world_scripts.sql b/sql/updates/2.4.3_old/583_world_scripts.sql new file mode 100644 index 0000000..2e43f16 --- /dev/null +++ b/sql/updates/2.4.3_old/583_world_scripts.sql @@ -0,0 +1 @@ +UPDATE creature_template SET Scriptname='npc_ranger_lilatha' WHERE entry=16295; diff --git a/sql/updates/2.4.3_old/586_world_scripts.sql b/sql/updates/2.4.3_old/586_world_scripts.sql new file mode 100644 index 0000000..dceb802 --- /dev/null +++ b/sql/updates/2.4.3_old/586_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_mausoleum_trigger' WHERE `entry` = 104593; +UPDATE `gameobject_template` SET `ScriptName` = 'go_mausoleum_door' WHERE `entry` = 176594; diff --git a/sql/updates/2.4.3_old/588_world.sql b/sql/updates/2.4.3_old/588_world.sql new file mode 100644 index 0000000..9db1b08 --- /dev/null +++ b/sql/updates/2.4.3_old/588_world.sql @@ -0,0 +1,7 @@ +DELETE FROM `trinity_string`WHERE `entry` in ('6613', '6614', '6615'); +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES ('6613','|cfff00000[GM Announcement]: %s|r'); +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES ('6614','Notification to GM\'s - '); +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES ('6615','|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('gmnotify', 2, 'Syntax: .gmnotify $notification\r\nDisplays a notification on the screen of all online GM\'s.'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('gmnameannounce', 2, 'Syntax: .gmnameannounce $announcement.\r\nSend an announcement to all online GM\'s, displaying the name of the sender.'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('gmannounce', 4, 'Syntax: .gmannounce $announcement\r\nSend an announcement to online Gamemasters.'); diff --git a/sql/updates/2.4.3_old/608_world.sql b/sql/updates/2.4.3_old/608_world.sql new file mode 100644 index 0000000..5c052ec --- /dev/null +++ b/sql/updates/2.4.3_old/608_world.sql @@ -0,0 +1,166 @@ +INSERT INTO `spell_script_target` VALUES +(3730,1,15263), +(6955,1,4946), +(7022,1,4945), +(7277,1,5409), +(9457,1,3701), +(11893,1,8156), +(12134,2,5270), +(12134,2,5271), +(12134,2,5273), +(12134,2,8313), +(12134,2,5256), +(12134,2,5259), +(13489,1,9178), +(15658,1,8929), -- It's up to script to implement SpellHit() for Moira Bronze beard +(16032,1,6557), -- Dummy effect should be implemented in core i think +(16337,1,10339), +(16337,1,10429), -- per spells description, it buffs two npc's. +(16637,1,10447), +(17748,1,10556), +(18969,1,12126), +(19749,1,12352), -- used by creature script to check if all troopers are presents, NYI +(19773,1,12018), -- used by Ragnaros to kill Majordomo +(21556,1,13378), -- no longer in game, but still could be used for some FUN-so why not fix it ? ;) +(21566,1,13416), +(22710,1,14349), +(23168,1,14020), +(24062,1,15010), +(24217,1,15069), +(24323,1,14834), +(24804,1,14888), +(25896,1,15299), +(28096,1,15929), +(28111,1,15930), +(28353,2,16390), +(28392,1,16420), +(28697,1,3976), +(28861,1,16592), +(29172,0,181605), +(29456,1,17060), +(29457,1,17060), +(29459,1,17060), -- Those are spells Arch Mage Xintor casts at training dummies near him. +(29531,0,181605), +(29831,0,181288), +(30221,1,620), +(30232,1,15691), +(30460,1,17404), +(30951,1,17533), +(31326,1,15608), +(31611,1,17979), +(31727,1,17536), +(32301,1,18371), +(32396,1,18358), +(32890,1,18764), +(33111,1,17400), +(33111,1,18894), +(33644,1,19279), +(33644,1,19328), +(33644,1,19278), +(33644,1,19329), +(33644,1,19326), +(33644,1,19277), +(33644,1,19276), -- All legion antennas. +(33742,1,17400), +(33742,1,18894), +(33742,1,19279), +(33742,1,19328), +(33742,1,19278), +(33742,1,19329), +(33742,1,19326), +(33742,1,19277), +(33742,1,19276), -- All legion antennas, another spell. +(33783,1,18732), +(34254,1,19554), +(34350,1,19554), +(34662,1,17827), +(35596,1,20794), +(36174,1,20885), +(37465,1,17469), +(37465,1,21747), +(37465,1,21750), +(37465,1,21748), +(37469,1,21664), +(37469,1,21682), +(37469,1,21683), +(37469,1,17211), +(37626,1,15689), -- Netherspite's beam +(37853,1,15608), +(37868,1,21909), +(37893,1,21909), +(37895,1,21909), +(38003,1,21949), +(38044,1,21212), +(38121,1,21949), +(38123,1,21949), +(38126,1,21949), +(38128,1,21949), +(38130,1,21949), +(38250,0,185125), +(38508,1,17270), +(38508,1,16873), +(38508,1,17269), +(38508,1,16871), +(38508,1,19422), +(38508,1,16907), +(38508,1,17478), +(38508,1,19424), +(38629,0,185214), +(38722,1,21506), +(38966,1,22293), +(38968,1,38968), +(39124,0,184738), +(39126,1,19557), +(39221,1,23116), +(39364,1,19732), +(39601,1,22916), +(39974,0,300127), +(39978,1,21851), +(39993,1,23382), +(40359,1,23382), +(40454,1,22181), +(40547,1,22911), +(40828,1,23327), +(40828,1,23322), +(41128,1,23164), +(41362,1,22956), +(41362,1,22964), +(41975,1,23191), +(42317,1,22844), +(42317,1,23319), +(42317,1,23421), +(42317,1,23216), +(42317,1,23523), +(42317,1,22849), +(42317,1,22845), +(42317,1,22847), +(42317,1,23318), +(42317,1,23215), +(42317,1,23524), +(42317,1,23374), +(42317,1,22846), +(42318,1,22844), +(42318,1,23319), +(42318,1,23421), +(42318,1,23216), +(42318,1,23523), +(42318,1,22849), +(42318,1,22845), +(42318,1,22847), +(42318,1,23318), +(42318,1,23215), +(42318,1,23524), +(42318,1,23374), +(42318,1,22846), +(42405,1,23775), +(42410,1,23775), +(42517,1,23864), +(42734,1,4974), +(44864,1,24955), +(45201,1,24882), +(46809,1,26239), -- Make Ahune's Ghost Burst +(46818,1,25840), +(46852,0,181605), -- Ribbon Pole Music +(46896,0,181605), +(47104,1,26401), +(49058,1,24968); -- Rocket Bot Attack diff --git a/sql/updates/2.4.3_old/615_world.sql b/sql/updates/2.4.3_old/615_world.sql new file mode 100644 index 0000000..34b99e5 --- /dev/null +++ b/sql/updates/2.4.3_old/615_world.sql @@ -0,0 +1,6 @@ +-- Wyvern Sting rank 5 and 6 not avail. till wotlk +DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (-49011, -49012); + +-- typo +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (43468, 43648); +INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (43648, 44007, 1, 'Storm Eye Safe Zone'); diff --git a/sql/updates/2.4.3_old/636_world_scripts.sql b/sql/updates/2.4.3_old/636_world_scripts.sql new file mode 100644 index 0000000..97a8fff --- /dev/null +++ b/sql/updates/2.4.3_old/636_world_scripts.sql @@ -0,0 +1,9 @@ +-- event script for Medivh's Journal +delete from event_scripts where id = 10951; +insert into event_scripts values +(10951,0,10,17651, 300000, 0,-11159,-1907.22,91.48,0); + +-- remove every Image from Medivh (should not be spawned by db) +delete from creature where id = 17651; +-- add script +update creature_template set scriptname = 'npc_image_of_medivh' where entry = 17651; diff --git a/sql/updates/2.4.3_old/640_world.sql b/sql/updates/2.4.3_old/640_world.sql new file mode 100644 index 0000000..2025302 --- /dev/null +++ b/sql/updates/2.4.3_old/640_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_script_target` WHERE entry IN (33655, 33633, 44374); +INSERT INTO `spell_script_target` VALUES +(33655,0,183350), +(33633,0,183351), +(44374,1,24722); diff --git a/sql/updates/2.4.3_old/645_world_scripts.sql b/sql/updates/2.4.3_old/645_world_scripts.sql new file mode 100644 index 0000000..a424358 --- /dev/null +++ b/sql/updates/2.4.3_old/645_world_scripts.sql @@ -0,0 +1,5 @@ +delete from creature where id=17318; +update creature_template set scriptname='npc_geezle' where entry=17318; +delete from event_scripts where id=10675; +insert into event_scripts () VALUES (10675, 0, 10, 17318, 120000, 0, -5134.3, -11250.3, 5.29568, 6.23554), +(10675, 72, 7, 9531, 0, 0, 0, 0, 0, 0); diff --git a/sql/updates/2.4.3_old/667_world_scripts.sql b/sql/updates/2.4.3_old/667_world_scripts.sql new file mode 100644 index 0000000..411b365 --- /dev/null +++ b/sql/updates/2.4.3_old/667_world_scripts.sql @@ -0,0 +1 @@ +update creature_template set scriptname='npc_professor_dabiri' where entry=20907; diff --git a/sql/updates/2.4.3_old/66_world_scripts.sql b/sql/updates/2.4.3_old/66_world_scripts.sql new file mode 100644 index 0000000..495cc28 --- /dev/null +++ b/sql/updates/2.4.3_old/66_world_scripts.sql @@ -0,0 +1,18 @@ +update instance_template set script = 'instance_sunwell_plateau' where map = 580; +UPDATE creature_template SET ScriptName = 'boss_brutallus' WHERE entry = 24882; +UPDATE `creature_template` SET `ScriptName` = 'boss_felmyst' WHERE `entry` = 25038; +UPDATE `creature_template` SET `ScriptName` = 'mob_felmyst_vapor' WHERE `entry` = 25265; +UPDATE `creature_template` SET `ScriptName` = 'mob_felmyst_trail' WHERE `entry` = 25267; +update creature_template set scriptname = 'boss_sacrolash' where entry = 25165; +update creature_template set scriptname = 'boss_alythess' where entry = 25166; +update creature_template set scriptname = 'mob_shadow_image' where entry = 25214; +REPLACE INTO `gameobject_template` VALUES (187366, 6, 4251, 'Blaze', '', 14, 0, 1, 0, 73, 2, 45246, 0, 1, 0, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''); +UPDATE creature_template SET faction_H = 14, faction_A = 14, minlevel = 73, maxlevel = 73,rank = 3, flags = 33554434, flag1 = 0 WHERE entry = 25214; +UPDATE `creature_template` SET `minlevel` = '70', `maxlevel` = '70',`faction_A` = '14', `faction_H` = '14' WHERE `entry` in (25265,25267,25268); +UPDATE `creature_template` SET `mindmg` = '1500', `maxdmg` = '2500', `minhealth` = '40000', `maxhealth` = '40000', `baseattacktime` = '2000' WHERE `entry` = 25268; +DELETE FROM `spell_script_target` WHERE `entry` in (44885,45388,45389,46350,45714); +INSERT INTO `spell_script_target` VALUES ('45388', '1', '25038'); +INSERT INTO `spell_script_target` VALUES ('45389', '1', '25265'); +INSERT INTO `spell_script_target` VALUES ('44885', '1', '25160'); +INSERT INTO `spell_script_target` VALUES ('46350', '1', '25160'); +INSERT INTO `spell_script_target` VALUES ('45714', '1', '25038'); diff --git a/sql/updates/2.4.3_old/676_world.sql b/sql/updates/2.4.3_old/676_world.sql new file mode 100644 index 0000000..2e46f64 --- /dev/null +++ b/sql/updates/2.4.3_old/676_world.sql @@ -0,0 +1,2 @@ +UPDATE `trinity_string` SET `content_default`='Player |cffff0000%s|r kicked by |cffff0000%s|r. Reason: |cffff0000%s|r.' WHERE (`entry`='282'); +UPDATE `command` SET `help`='Syntax: .kick [$charactername] [$reason]\r\n\r\nKick the given character name from the world with or without reason. If no character name is provided then the selected player (except for yourself) will be kicked. If no reason is provided, default is \"No Reason\".' WHERE (`name`='kick'); diff --git a/sql/updates/2.4.3_old/679_world_scripts.sql b/sql/updates/2.4.3_old/679_world_scripts.sql new file mode 100644 index 0000000..ca02004 --- /dev/null +++ b/sql/updates/2.4.3_old/679_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_deathstalker_erland' WHERE `entry`=1978; diff --git a/sql/updates/2.4.3_old/683_world_scripts.sql b/sql/updates/2.4.3_old/683_world_scripts.sql new file mode 100644 index 0000000..204a8b3 --- /dev/null +++ b/sql/updates/2.4.3_old/683_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `quest_template` SET `SpecialFlags`=2 WHERE `entry`=665; +UPDATE `creature_template` SET `ScriptName`='npc_professor_phizzlethorpe' WHERE `entry`=2768; diff --git a/sql/updates/2.4.3_old/686_world_scripts.sql b/sql/updates/2.4.3_old/686_world_scripts.sql new file mode 100644 index 0000000..1a24f7a --- /dev/null +++ b/sql/updates/2.4.3_old/686_world_scripts.sql @@ -0,0 +1,15 @@ +UPDATE `creature_template` SET `Scriptname`='npc_willix' WHERE entry=4508; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1047010 and -1047000; +INSERT INTO `script_texts` (entry, content_default, sound, type, language, comment) VALUES +(-1047000, 'Phew! Finally,out here. However, it will not become easy. Detain your eyes after annoyance.', 0, 0, 0, 'Willix'), +(-1047001, 'There on top resides Charlga Razorflank. The damned old Crone.', 0, 0, 0, 'Willix'), +(-1047002, 'Help! Get this Raging Agam\'ar from me!', 0, 0, 0, 'Willix'), +(-1047003, 'In this ditch there are Blueleaf Tuber! As if the gold waited only to be dug out, I say it you!', 0, 0, 0, 'Willix'), +(-1047004, 'Danger is behind every corner.', 0, 0, 0, 'Willix'), +(-1047005, 'I do not understand how these disgusting animals can live at such a place.... puh as this stinks!', 0, 0, 0, 'Willix'), +(-1047006, 'I think, I see a way how we come out of this damned thorn tangle.', 0, 0, 0, 'Willix'), +(-1047007, 'I am glad that we are out again from this damned ditch. However, up here it is not much better!', 0, 0, 0, 'Willix'), +(-1047008, 'Finally! I am glad that I come, finally out here.', 0, 0, 0, 'Willix'), +(-1047009, 'I will rather rest a moment and come again to breath, before I return to Ratchet.', 0, 0, 0, 'Willix'), +(-1047010, 'Many thanks for your help.', 0, 0, 0, 'Willix'); diff --git a/sql/updates/2.4.3_old/68_world.sql b/sql/updates/2.4.3_old/68_world.sql new file mode 100644 index 0000000..3303699 --- /dev/null +++ b/sql/updates/2.4.3_old/68_world.sql @@ -0,0 +1,16 @@ +-- add lang strings +DELETE FROM trinity_string WHERE entry BETWEEN 1000 AND 1006; +INSERT INTO trinity_string VALUES +(1000,'You froze player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1001,'It might be amusing but no... you cant freeze yourself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1002,'Invalid input check the name of target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1003,'You unfroze player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1004,'There are no frozen players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1005,'Following players are frozen on the server:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1006,'- %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- add commands +DELETE FROM `command` WHERE `name` = 'freeze' or `name` = 'unfreeze' or name = 'listfreeze'; +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('freeze','2','Syntax: .freeze (#player)\r\n\"Freezes\" #player and disables his chat. When using this without #name it will freeze your target.'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('unfreeze','2','Syntax: .unfreeze (#player)\r\n\"Unfreezes\" #player and enables his chat again. When using this without #name it will unfreeze your target.'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('listfreeze','1','Syntax: .listfreeze\r\n\r\nSearch and output all frozen players.'); diff --git a/sql/updates/2.4.3_old/691_world_scripts.sql b/sql/updates/2.4.3_old/691_world_scripts.sql new file mode 100644 index 0000000..9493f71 --- /dev/null +++ b/sql/updates/2.4.3_old/691_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_earthmender_wilda' WHERE `entry`=21027; diff --git a/sql/updates/2.4.3_old/692_world.sql b/sql/updates/2.4.3_old/692_world.sql new file mode 100644 index 0000000..9a98f14 --- /dev/null +++ b/sql/updates/2.4.3_old/692_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN ('38164','14144','14148'); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +('38164','0','0','0','0','1','0','0','60'), +('14144','0','0','0','2','0','0','0','0'), +('14148','0','0','0','2','0','0','0','0'); diff --git a/sql/updates/2.4.3_old/708_world_scripts.sql b/sql/updates/2.4.3_old/708_world_scripts.sql new file mode 100644 index 0000000..c90a15a --- /dev/null +++ b/sql/updates/2.4.3_old/708_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='boss_shirrak_the_dead_watcher' WHERE `entry`=18371; +UPDATE `creature_template` SET `ScriptName`='mob_focus_fire' WHERE `entry`=18374; diff --git a/sql/updates/2.4.3_old/70_world_scripts.sql b/sql/updates/2.4.3_old/70_world_scripts.sql new file mode 100644 index 0000000..18ccafc --- /dev/null +++ b/sql/updates/2.4.3_old/70_world_scripts.sql @@ -0,0 +1,27 @@ +UPDATE `creature_template` SET +`minlevel` = '60', +`maxlevel` = '60', +`minhealth` = '6900', +`maxhealth` = '7200', +`minmana` = '9476', +`maxmana` = '9736', +`armor` = '4000', +`speed` = '1.7', +`rank` = '1', +`mindmg` = '600', +`maxdmg` = '1500', +`attackpower` = '1200', +`family` = '16', +`minrangedmg` = '0', +`maxrangedmg` = '0', +`rangedattackpower` = '0', +`resistance1` = '15', +`resistance2` = '15', +`resistance3` = '15', +`resistance4` = '15', +`resistance5` = '15', +`resistance6` = '15', +`ScriptName` = 'npc_kservant' WHERE `entry` = '19685'; + +DELETE FROM `quest_start_scripts` WHERE `id`='10211'; +UPDATE `quest_template` SET `StartScript`='0' WHERE entry=10211; diff --git a/sql/updates/2.4.3_old/722_world_script_texts.sql b/sql/updates/2.4.3_old/722_world_script_texts.sql new file mode 100644 index 0000000..7bb5692 --- /dev/null +++ b/sql/updates/2.4.3_old/722_world_script_texts.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000146 AND -1000140; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1000140,'Let\'s go.',0,0,1,'lilatha SAY_START'), +(-1000141,'$N, let\'s use the antechamber to the right.',0,0,1,'lilatha SAY_PROGRESS1'), +(-1000142,'I can see the light at the end of the tunnel!',0,0,1,'lilatha SAY_PROGRESS2'), +(-1000143,'There\'s Farstrider Enclave now, $C. Not far to go... Look out! Troll ambush!!',0,0,1,'lilatha SAY_PROGRESS3'), +(-1000144,'Thank you for saving my life and bringing me back to safety, $N',0,0,1,'lilatha SAY_END1'), +(-1000145,'Captain Helios, I\'ve been rescued from the Amani Catacombs. Reporting for duty, sir!',0,0,1,'lilatha SAY_END2'), +(-1000146,'Liatha, get someone to look at those injuries. Thank you for bringing her back safely.',0,0,1,'lilatha CAPTAIN_ANSWER'); diff --git a/sql/updates/2.4.3_old/724_world.sql b/sql/updates/2.4.3_old/724_world.sql new file mode 100644 index 0000000..2295375 --- /dev/null +++ b/sql/updates/2.4.3_old/724_world.sql @@ -0,0 +1,3 @@ +ALTER TABLE `custom_texts` ADD COLUMN `emote` tinyint(3) UNSIGNED DEFAULT '0' NOT NULL AFTER `language`; +ALTER TABLE `eventai_texts` ADD COLUMN `emote` tinyint(3) UNSIGNED DEFAULT '0' NOT NULL AFTER `language`; +ALTER TABLE `script_texts` ADD COLUMN `emote` tinyint(3) UNSIGNED DEFAULT '0' NOT NULL AFTER `language`; diff --git a/sql/updates/2.4.3_old/725_characters.sql b/sql/updates/2.4.3_old/725_characters.sql new file mode 100644 index 0000000..60555c7 --- /dev/null +++ b/sql/updates/2.4.3_old/725_characters.sql @@ -0,0 +1,5 @@ +ALTER TABLE `character_ticket` RENAME TO `gm_tickets`; +ALTER TABLE `gm_tickets` CHANGE `guid` `playerGuid` int(11) unsigned NOT NULL default '0'; +ALTER TABLE `gm_tickets` CHANGE `ticket_id` `guid` int(11) unsigned NOT NULL default '0'; +ALTER TABLE `gm_tickets` CHANGE `ticket_text` `message` text(0) NOT NULL; +ALTER TABLE `gm_tickets` CHANGE `ticket_lastchange` `timestamp` int(10) NOT NULL default '0'; diff --git a/sql/updates/2.4.3_old/725_world.sql b/sql/updates/2.4.3_old/725_world.sql new file mode 100644 index 0000000..38eeead --- /dev/null +++ b/sql/updates/2.4.3_old/725_world.sql @@ -0,0 +1,31 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (290,296,289); +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 2000 AND 2016; +INSERT INTO trinity_string (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(2000, '|cff00ff00New ticket from|r|cffff00ff %s.|r |cff00ff00Ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2001, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00edited his/her ticket:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2002, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00abandoned ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2003, '|cffff00ff %s|r |cff00ff00closed ticket|r |cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2004, 'Ticket %d permanently deleted by %s.', '', '', '', '', '', '', '', ''), +(2005, 'Ticket not found.', '', '', '', '', '', '', '', ''), +(2007, 'Please close ticket before deleting it permanently.', '', '', '', '', '', '', '', ''), +(2008, 'Ticket %d is already assigned to GM %s.', '', '', '', '', '', '', '', ''), +(2009, '%u Tickets succesfully reloaded from the database.', '', '', '', '', '', '', '', ''), +(2010, 'Showing list of open tickets.', '', '', '', '', '', '', '', ''), +(2011, 'Showing list of open tickets whose creator is online.', '', '', '', '', '', '', '', ''), +(2012, 'Invalid name specified. Name should be that of an online Gamemaster.', '', '', '', '', '', '', '', ''), +(2013, 'This ticket is already assigned to yourself. To unassign use .ticket unassign %d and then reassign.', '', '', '', '', '', '', '', ''), +(2014, 'Ticket %d is not assigned, you cannot unassign it.', '', '', '', '', '', '', '', ''), +(2015, 'You cannot unassign tickets from staffmembers with a higher security level than yourself.', '', '', '', '', '', '', '', ''), +(2016, 'Cannot close ticket %d, it is assigned to another GM.', '', '', '', '', '', '', '', ''); +DELETE FROM `command` WHERE (`name` LIKE '%ticket%'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('ticket list','1','Displays a list of open GM tickets.'), +('ticket onlinelist','1','Displays a list of open GM tickets whose owner is online.'), +('ticket viewname','1','Usage: .ticket viewname $creatorname. \r\nReturns details about specified ticket. Ticket must be open and not deleted.'), +('ticket viewid','1','Usage: .ticket viewid $ticketid.\r\nReturns details about specified ticket. Ticket must be open and not deleted.'), +('ticket close','2','Usage: .ticket close $ticketid.\r\nCloses the specified ticket. Does not delete permanently.'), +('ticket delete','3','Usage: .ticket delete $ticketid.\r\nDeletes the specified ticket permanently. Ticket must be closed first.'), +('ticket assign','3','Usage: .ticket assign $ticketid $gmname.\r\nAssigns the specified ticket to the specified Game Master.'), +('ticket unassign','3','Usage: .ticket unassign $ticketid.\r\nUnassigns the specified ticket from the current assigned Game Master.'), +('ticket comment','2','Usage: .ticket comment $ticketid $comment.\r\nAllows the adding or modifying of a comment to the specified ticket.'), +('reload tickets','4','Usage: .reload tickets.\r\nReloads GM Tickets from the database and re-caches them into memory.'); diff --git a/sql/updates/2.4.3_old/728_world_scripts.sql b/sql/updates/2.4.3_old/728_world_scripts.sql new file mode 100644 index 0000000..2d47af7 --- /dev/null +++ b/sql/updates/2.4.3_old/728_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_apprentice_mirveda' WHERE `entry`=15402; diff --git a/sql/updates/2.4.3_old/733_characters.sql b/sql/updates/2.4.3_old/733_characters.sql new file mode 100644 index 0000000..03b553b --- /dev/null +++ b/sql/updates/2.4.3_old/733_characters.sql @@ -0,0 +1 @@ +ALTER TABLE `gm_tickets` ADD `name` varchar(15) NOT NULL AFTER `playerGuid`; diff --git a/sql/updates/2.4.3_old/739_characters.sql b/sql/updates/2.4.3_old/739_characters.sql new file mode 100644 index 0000000..bb656d7 --- /dev/null +++ b/sql/updates/2.4.3_old/739_characters.sql @@ -0,0 +1 @@ +ALTER TABLE `gm_tickets` ADD `comment` text(0) NOT NULL; diff --git a/sql/updates/2.4.3_old/741_characters.sql b/sql/updates/2.4.3_old/741_characters.sql new file mode 100644 index 0000000..dd04c01 --- /dev/null +++ b/sql/updates/2.4.3_old/741_characters.sql @@ -0,0 +1,2 @@ +ALTER TABLE `gm_tickets` ADD `closed` tinyint(1) NOT NULL default '0' AFTER `timestamp`; +ALTER TABLE `gm_tickets` ADD `assignedto` int(10) NOT NULL default '0' AFTER `timestamp`; diff --git a/sql/updates/2.4.3_old/741_world.sql b/sql/updates/2.4.3_old/741_world.sql new file mode 100644 index 0000000..a93d4e2 --- /dev/null +++ b/sql/updates/2.4.3_old/741_world.sql @@ -0,0 +1,10 @@ +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket list','1','Displays a list of open GM tickets.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket onlinelist','1','Displays a list of open GM tickets whose owner is online.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket viewname','1','Usage: .ticket viewname $creatorname. \r\nReturns details about specified ticket. Ticket must be open and not deleted.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket viewid','1','Usage: .ticket viewid $ticketid.\r\nReturns details about specified ticket. Ticket must be open and not deleted.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket close','2','Usage: .ticket close $ticketid.\r\nCloses the specified ticket. Does not delete permanently.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket delete','3','Usage: .ticket delete $ticketid.\r\nDeletes the specified ticket permanently. Ticket must be closed first.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket assign','3','Usage: .ticket assign $ticketid $gmname.\r\nAssigns the specified ticket to the specified Game Master.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket unassign','3','Usage: .ticket unassign $ticketid.\r\nUnassigns the specified ticket from the current assigned Game Master.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('ticket comment','2','Usage: .ticket comment $ticketid $comment.\r\nAllows the adding or modifying of a comment to the specified ticket.'); +REPLACE INTO `command` (`name`,`security`,`help`) VALUES ('reload tickets','4','Usage: .reload tickets.\r\nReloads GM Tickets from the database and re-caches them into memory.'); diff --git a/sql/updates/2.4.3_old/747_world.sql b/sql/updates/2.4.3_old/747_world.sql new file mode 100644 index 0000000..2c04129 --- /dev/null +++ b/sql/updates/2.4.3_old/747_world.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default`='Ticket %d is already assigned.' WHERE `entry`=2008; diff --git a/sql/updates/2.4.3_old/748_world_scripts.sql b/sql/updates/2.4.3_old/748_world_scripts.sql new file mode 100644 index 0000000..eaddead --- /dev/null +++ b/sql/updates/2.4.3_old/748_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='npc_infused_crystal' WHERE `entry`=16364; +UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry`=16364; +DELETE FROM `creature` WHERE `id`=17086; diff --git a/sql/updates/2.4.3_old/758_world_scripts.sql b/sql/updates/2.4.3_old/758_world_scripts.sql new file mode 100644 index 0000000..a538428 --- /dev/null +++ b/sql/updates/2.4.3_old/758_world_scripts.sql @@ -0,0 +1,6 @@ +DELETE FROM `creature_template_addon` WHERE `entry`=17225; +UPDATE `creature_template` SET `ScriptName`='boss_nightbane' WHERE `entry`=17225; +UPDATE `creature_template` SET `unit_flags`=0 WHERE `entry`=17225; +DELETE FROM `event_scripts` WHERE `id`=10951; +INSERT INTO `event_scripts` VALUES +(10951,0,10,17651,180000,0,-11159,-1907.22,91.48,0); diff --git a/sql/updates/2.4.3_old/762_world.sql b/sql/updates/2.4.3_old/762_world.sql new file mode 100644 index 0000000..ce64e8c --- /dev/null +++ b/sql/updates/2.4.3_old/762_world.sql @@ -0,0 +1,6 @@ +DROP TABLE IF EXISTS `transport_events`; +CREATE TABLE `transport_events` ( + `entry` int(11) unsigned NOT NULL default '0', + `waypoint_id` int(11) unsigned NOT NULL default '0', + `event_id` int(11) unsigned NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/2.4.3_old/764_world_scripts.sql b/sql/updates/2.4.3_old/764_world_scripts.sql new file mode 100644 index 0000000..52592cd --- /dev/null +++ b/sql/updates/2.4.3_old/764_world_scripts.sql @@ -0,0 +1,123 @@ +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=16062; +UPDATE `creature_template` SET `ScriptName`='boss_rivendare_naxx' WHERE `entry`=30549; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533039 AND -1533000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533000,'Ahh... welcome to my parlor.',8788,1,0,'anubrekhan SAY_GREET'), +(-1533001,'Just a little taste...',8785,1,0,'anubrekhan SAY_AGGRO1'), +(-1533002,'There is no way out.',8786,1,0,'anubrekhan SAY_AGGRO2'), +(-1533003,'Yes, Run! It makes the blood pump faster!',8787,1,0,'anubrekhan SAY_AGGRO3'), +(-1533004,'I hear little hearts beating. Yesss... beating faster now. Soon the beating will stop.',8790,1,0,'anubrekhan SAY_TAUNT1'), +(-1533005,'Where to go? What to do? So many choices that all end in pain, end in death.',8791,1,0,'anubrekhan SAY_TAUNT2'), +(-1533006,'Which one shall I eat first? So difficult to choose... the all smell so delicious.',8792,1,0,'anubrekhan SAY_TAUNT3'), +(-1533007,'Closer now... tasty morsels. I\'ve been too long without food. Without blood to drink.',8793,1,0,'anubrekhan SAY_TAUNT4'), +(-1533008,'Shh... it will all be over soon.',8789,1,0,'anubrekhan SAY_SLAY'), +(-1533009,'Your old lives, your mortal desires, mean nothing. You are acolytes of the master now, and you will serve the cause without question! The greatest glory is to die in the master\'s service!',8799,1,0,'faerlina SAY_GREET'), +(-1533010,'Slay them in the master\'s name!',8794,1,0,'faerlina SAY_AGGRO1'), +(-1533011,'You cannot hide from me!',8795,1,0,'faerlina SAY_AGGRO2'), +(-1533012,'Kneel before me, worm!',8796,1,0,'faerlina SAY_AGGRO3'), +(-1533013,'Run while you still can!',8797,1,0,'faerlina SAY_AGGRO4'), +(-1533014,'You have failed!',8800,1,0,'faerlina SAY_SLAY1'), +(-1533015,'Pathetic wretch!',8801,1,0,'faerlina SAY_SLAY2'), +(-1533016,'The master... will avenge me!',8798,1,0,'faerlina SAY_DEATH'), +(-1533017,'Patchwerk want to play!',8909,1,0,'patchwerk SAY_AGGRO1'), +(-1533018,'Kel\'Thuzad make Patchwerk his Avatar of War!',8910,1,0,'patchwerk SAY_AGGRO2'), +(-1533019,'No more play?',8912,1,0,'patchwerk SAY_SLAY'), +(-1533020,'What happened to... Patch...',8911,1,0,'patchwerk SAY_DEATH'), +(-1533021,'goes into a berserker rage!',0,2,0,'patchwerk EMOTE_BERSERK'), +(-1533022,'becomes enraged!',0,2,0,'patchwerk EMOTE_ENRAGE'), +(-1533023,'Stalagg crush you!',8864,1,0,'stalagg SAY_STAL_AGGRO'), +(-1533024,'Stalagg kill!',8866,1,0,'stalagg SAY_STAL_SLAY'), +(-1533025,'Master save me...',8865,1,0,'stalagg SAY_STAL_DEATH'), +(-1533026,'Feed you to master!',8802,1,0,'feugen SAY_FEUG_AGGRO'), +(-1533027,'Feugen make master happy!',8804,1,0,'feugen SAY_FEUG_SLAY'), +(-1533028,'No... more... Feugen...',8803,1,0,'feugen SAY_FEUG_DEATH'), +(-1533029,'You are too late... I... must... OBEY!',8872,1,0,'thaddius SAY_GREET'), +(-1533030,'KILL!',8867,1,0,'thaddius SAY_AGGRO1'), +(-1533031,'EAT YOUR BONES!',8868,1,0,'thaddius SAY_AGGRO2'), +(-1533032,'BREAK YOU!',8869,1,0,'thaddius SAY_AGGRO3'), +(-1533033,'You die now!',8877,1,0,'thaddius SAY_SLAY'), +(-1533034,'Now YOU feel pain!',8871,1,0,'thaddius SAY_ELECT'), +(-1533035,'Thank... you...',8870,1,0,'thaddius SAY_DEATH'), +(-1533036,'Pleeease!',8873,1,0,'thaddius SAY_SCREAM1'), +(-1533037,'Stop, make it stop!',8874,1,0,'thaddius SAY_SCREAM2'), +(-1533038,'Help me! Save me!',8875,1,0,'thaddius SAY_SCREAM3'), +(-1533039,'Please, nooo!',8876,1,0,'thaddius SAY_SCREAM4'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533074 AND -1533040; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533040,'Foolishly you have sought your own demise. Brazenly you have disregarded powers beyond your understanding. You have fought hard to invade the realm of the harvester. Now there is only one way out - to walk the lonely path of the damned.',8807,1,0,'gothik SAY_SPEECH'), +(-1533041,'Death is the only escape.',8806,1,0,'gothik SAY_KILL'), +(-1533042,'I... am... undone!',8805,1,0,'gothik SAY_DEATH'), +(-1533043,'I have waited long enough! Now, you face the harvester of souls!',8808,1,0,'gothik SAY_TELEPORT'), +(-1533044,'Defend youself!',8892,1,0,'blaumeux SAY_BLAU_AGGRO'), +(-1533045,'Come, Zeliek, do not drive them out. Not before we\'ve had our fun.',8896,1,0,'blaumeux SAY_BLAU_TAUNT1'), +(-1533046,'I do hope they stay alive long enough for me to... introduce myself.',8897,1,0,'blaumeux SAY_BLAU_TAUNT2'), +(-1533047,'The first kill goes to me! Anyone care to wager?',8898,1,0,'blaumeux SAY_BLAU_TAUNT3'), +(-1533048,'Your life is mine!',8895,1,0,'blaumeux SAY_BLAU_SPECIAL'), +(-1533049,'Who\'s next?',8894,1,0,'blaumeux SAY_BLAU_SLAY'), +(-1533050,'Tou... che!',8893,1,0,'blaumeux SAY_BLAU_DEATH'), +(-1533051,'Come out and fight, ye wee ninny!',8899,1,0,'korthazz SAY_KORT_AGGRO'), +(-1533052,'To arms, ye roustabouts! We\'ve got company!',8903,1,0,'korthazz SAY_KORT_TAUNT1'), +(-1533053,'I heard about enough of yer sniveling. Shut yer fly trap \'afore I shut it for ye!',8904,1,0,'korthazz SAY_KORT_TAUNT2'), +(-1533054,'I\'m gonna enjoy killin\' these slack-jawed daffodils!',8905,1,0,'korthazz SAY_KORT_TAUNT3'), +(-1533055,'I like my meat extra crispy!',8901,1,0,'korthazz SAY_KORT_SPECIAl'), +(-1533056,'Next time, bring more friends!',8902,1,0,'korthazz SAY_KORT_SLAY'), +(-1533057,'What a bloody waste this is!',8900,1,0,'korthazz SAY_KORT_DEATH'), +(-1533058,'Flee, before it\'s too late!',8913,1,0,'zeliek SAY_ZELI_AGGRO'), +(-1533059,'Invaders, cease this foolish venture at once! Turn away while you still can!',8917,1,0,'zeliek SAY_ZELI_TAUNT1'), +(-1533060,'Perhaps they will come to their senses, and run away as fast as they can!',8918,1,0,'zeliek SAY_ZELI_TAUNT2'), +(-1533061,'Do not continue! Turn back while there\'s still time!',8919,1,0,'zeliek SAY_ZELI_TAUNT3'), +(-1533062,'I- I have no choice but to obey!',8916,1,0,'zeliek SAY_ZELI_SPECIAL'), +(-1533063,'Forgive me!',8915,1,0,'zeliek SAY_ZELI_SLAY'), +(-1533064,'It is... as it should be.',8914,1,0,'zeliek SAY_ZELI_DEATH'), +(-1533065,'You seek death?',14571,1,0,'rivendare_naxx SAY_RIVE_AGGRO1'), +(-1533066,'None shall pass!',14572,1,0,'rivendare_naxx SAY_RIVE_AGGRO2'), +(-1533067,'Be still!',14573,1,0,'rivendare_naxx SAY_RIVE_AGGRO3'), +(-1533068,'You will find no peace in death.',14574,1,0,'rivendare_naxx SAY_RIVE_SLAY1'), +(-1533069,'The master\'s will is done.',14575,1,0,'rivendare_naxx SAY_RIVE_SLAY2'), +(-1533070,'Bow to the might of the scourge!',14576,1,0,'rivendare_naxx SAY_RIVE_SPECIAL'), +(-1533071,'Enough prattling. Let them come! We shall grind their bones to dust.',14577,1,0,'rivendare_naxx SAY_RIVE_TAUNT1'), +(-1533072,'Conserve your anger! Harness your rage! You will all have outlets for your frustration soon enough.',14578,1,0,'rivendare_naxx SAY_RIVE_TAUNT2'), +(-1533073,'Life is meaningless. It is in death that we are truly tested.',14579,1,0,'rivendare_naxx SAY_RIVE_TAUNT3'), +(-1533074,'Death... will not stop me...',14580,1,0,'rivendare_naxx SAY_RIVE_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533108 AND -1533075; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533075,'Glory to the master!',8845,1,0,'noth SAY_AGGRO1'), +(-1533076,'Your life is forfeit!',8846,1,0,'noth SAY_AGGRO2'), +(-1533077,'Die, trespasser!',8847,1,0,'noth SAY_AGGRO3'), +(-1533078,'Rise, my soldiers! Rise and fight once more!',8851,1,0,'noth SAY_SUMMON'), +(-1533079,'My task is done!',8849,1,0,'noth SAY_SLAY1'), +(-1533080,'Breathe no more!',8850,1,0,'noth SAY_SLAY2'), +(-1533081,'I will serve the master... in... death!',8848,1,0,'noth SAY_DEATH'), +(-1533082,'takes in a deep breath...',0,2,0,'sapphiron EMOTE_BREATH'), +(-1533083,'enrages!',0,2,0,'sapphiron EMOTE_ENRAGE'), +(-1533084,'Our preparations continue as planned, master.',14467,1,0,'kelthuzad SAY_SAPP_DIALOG1'), +(-1533085,'It is good that you serve me so faithfully. Soon, all will serve the Lich King and in the end, you shall be rewarded...so long as you do not falter.',8881,1,0,'kelthuzad SAY_SAPP_DIALOG2_LICH'), +(-1533086,'I see no complications... Wait... What is this?',14468,1,0,'kelthuzad SAY_SAPP_DIALOG3'), +(-1533087,'Your security measures have failed! See to this interruption immediately!',8882,1,0,'kelthuzad SAY_SAPP_DIALOG4_LICH'), +(-1533088,'Yes, master!',14469,1,0,'kelthuzad SAY_SAPP_DIALOG5'), +(-1533089,'No!!! A curse upon you, interlopers! The armies of the Lich King will hunt you down. You will not escape your fate...',14484,1,0,'kelthuzad SAY_CAT_DIED'), +(-1533090,'Who dares violate the sanctity of my domain? Be warned, all who trespass here are doomed.',14463,1,0,'kelthuzad SAY_TAUNT1'), +(-1533091,'Fools, you think yourselves triumphant? You have only taken one step closer to the abyss! ',14464,1,0,'kelthuzad SAY_TAUNT2'), +(-1533092,'I grow tired of these games. Proceed, and I will banish your souls to oblivion!',14465,1,0,'kelthuzad SAY_TAUNT3'), +(-1533093,'You have no idea what horrors lie ahead. You have seen nothing! The frozen heart of Naxxramas awaits you!',14466,1,0,'kelthuzad SAY_TAUNT4'), +(-1533094,'Pray for mercy!',14475,1,0,'kelthuzad SAY_AGGRO1'), +(-1533095,'Scream your dying breath!',14476,1,0,'kelthuzad SAY_AGGRO2'), +(-1533096,'The end is upon you!',14477,1,0,'kelthuzad SAY_AGGRO3'), +(-1533097,'The dark void awaits you!',14478,1,0,'kelthuzad SAY_SLAY1'), +(-1533098,'',14479,1,0,'kelthuzad SAY_SLAY2'), +(-1533099,'AAAAGHHH!... Do not rejoice... your victory is a hollow one... for I shall return with powers beyond your imagining!',14480,1,0,'kelthuzad SAY_DEATH'), +(-1533100,'Your soul, is bound to me now!',14472,1,0,'kelthuzad SAY_CHAIN1'), +(-1533101,'There will be no escape!',14473,1,0,'kelthuzad SAY_CHAIN2'), +(-1533102,'I will freeze the blood in your veins!',14474,1,0,'kelthuzad SAY_FROST_BLAST'), +(-1533103,'Master! I require aid! ',14470,1,0,'kelthuzad SAY_REQUEST_AID'), +(-1533104,'Very well... warriors of the frozen wastes, rise up! I command you to fight, kill, and die for your master. Let none survive...',0,1,0,'kelthuzad SAY_ANSWER_REQUEST'), +(-1533105,'Minions, servants, soldiers of the cold dark, obey the call of Kel\'Thuzad!',14471,1,0,'kelthuzad SAY_SUMMON_MINIONS'), +(-1533106,'Your petty magics are no challenge to the might of the Scourge! ',14481,1,0,'kelthuzad SAY_SPECIAL1_MANA_DET'), +(-1533107,'Enough! I grow tired of these distractions! ',14483,1,0,'kelthuzad SAY_SPECIAL3_MANA_DET'), +(-1533108,'Fools, you have spread your powers too thin. Be free, my minions!',14482,1,0,'kelthuzad SAY_SPECIAL2_DISPELL'); + +UPDATE `script_texts` SET `sound`=8902 WHERE `entry`=-1533055; +UPDATE `script_texts` SET `sound`=8901 WHERE `entry`=-1533056; diff --git a/sql/updates/2.4.3_old/765_world_scripts.sql b/sql/updates/2.4.3_old/765_world_scripts.sql new file mode 100644 index 0000000..0a0a9f6 --- /dev/null +++ b/sql/updates/2.4.3_old/765_world_scripts.sql @@ -0,0 +1,19 @@ +UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry`=20129; + +-- Insert English and French dialogs in database +DELETE FROM `script_texts` WHERE entry BETWEEN -1000163 and -1000150; +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc2`, `type`, `language`, `comment`) VALUES +(-1000150, 'Greetings, $N. I will guide you through the cavern. Please try and keep up.', 'Salutations, $N. Je vais vous guider ŕ travers cette grotte. Veuillez me suivre.', 4, 0, 'WHISPER_CUSTODIAN_1'), +(-1000151, 'We do not know if the Caverns of Time have always been accessible to mortals. Truly, it is impossible to tell as the Timeless One is in perpetual motion, changing our timeways as he sees fit. What you see now may very well not exist tomorrow. You may wake up and have no memory of this place.', 'Nous ne savons pas si les Grottes du Temps ont toujours été accessibles aux mortels. Vraiment, c\'est impossible ŕ dire étant donné que l\'Intemporel est en mouvement perpétuel, changeant nos spirales temporelles comme bon lui semble. Ce que vous voyez aujourd\'hui peut trčs bien ne plus exister demain. Vous pourriez vous réveiller sans aucun souvenir de cet endroit.', 4, 0, 'WHISPER_CUSTODIAN_2'), +(-1000152, 'It is strange, I know... Most mortals cannot actually comprehend what they see here, as often, what they see is not anchored within their own perception of reality.', 'C\'est étrange, je sais... La plupart des mortels ne peuvent pas réellement comprendre ce qu\ils voient ici, comme souvent, ce qu\'ils voient n\'est pas ancré dans leur propre perception de la réalité.', 4, 0, 'WHISPER_CUSTODIAN_3'), +(-1000153, 'Follow me, please.', 'Veuillez me suivre.', 4, 0, 'WHISPER_CUSTODIAN_4'), +(-1000154, 'There are only two truths to be found here: First, that time is chaotic, always in flux, and completely malleable and second, perception does not dictate reality.', 'Il n\'y a que deux vérités qui peuvent ętre trouvées ici : premičrement, ce temps est chaotique, toujours en mouvement, et complčtement malléable, et ensuite, la perception ne détermine pas la réalité.', 4, 0, 'WHISPER_CUSTODIAN_5'), +(-1000155, 'As custodians of time, we watch over and care for Nozdormu\'s realm. The master is away at the moment, which means that attempts are being made to dramatically alter time. The master never meddles in the affairs of mortals but instead corrects the alterations made to time by others. He is reactionary in this regard.', 'En tant que protecteurs du temps, nous observons et veillons sur le royaume de Nozdormu. Le maître est absent en ce moment, ce qui signifie que des tentatives sont faites pour altérer fortement le temps. Le maître ne se męle jamais des affaires des mortels mais il corrige les altérations faites au temps par d\'autres. Il est réactionnaire ŕ cet égard.', 4, 0, 'WHISPER_CUSTODIAN_6'), +(-1000156, 'For normal maintenance of time, the Keepers of Time are sufficient caretakers. We are able to deal with most ordinary disturbances. I speak of little things, such as rogue mages changing something in the past to elevate their status or wealth in the present.', 'Pour le maintien normal du temps, les Gardiens du temps suffisent ŕ la tâche. Nous sommes capables de gérer les perturbations les plus ordinaires. Je parle de petites choses, comme des mages voleurs qui changent quelque chose dans le passé pour élever leur statut ou leur richesse dans le présent.', 4, 0, 'WHISPER_CUSTODIAN_7'), +(-1000157, 'These tunnels that you see are called timeways. They are infinite in number. The ones that currently exist in your reality are what the master has deemed as \'trouble spots.\' These trouble spots may differ completely in theme but they always share a cause. That is, their existence is a result of the same temporal disturbance. Remember that should you venture inside one...', 'Ces tunnels que vous voyez sont appelés Voies Temporelles. Leur nombre est infini. Ceux qui existent actuellement dans votre réalité sont ceux que le maître a considérés comme \'points sensibles\'. Ces points sensibles peuvent différer complčtement de part leur thčme, mais partagent toujours une cause. C\'est-ŕ-dire, leur existence est le résultat des męmes perturbations temporelles. Rappelez-vous en si vous osez vous aventurer dans l\'un d\'eux...', 4, 0, 'WHISPER_CUSTODIAN_8'), +(-1000158, 'This timeway is in great disarray! We have agents inside right now attempting to restore order. What information I have indicates that Thrall\'s freedom is in jeopardy. A malevolent organization known as the Infinite Dragonflight is trying to prevent his escape. I fear without outside assistance, all will be lost.', 'Cette voie temporelle est en grand désarroi ! Nous avons actuellement des agents ŕ l\intérieur qui tentent de restaurer l\'ordre. Les informations que j\'ai indiquent que la liberté de Thrall est en péril. Une organisation malveillante connue sous le nom de Vol du Dragon Infini essaye d\'empęcher son évasion. J\'ai peur que sans assistance extérieure, tout soit perdu.', 4, 0, 'WHISPER_CUSTODIAN_9'), +(-1000159, 'We have very little information on this timeway. Sa\'at has been dispatched and is currently inside. The data we have gathered from his correspondence is that the Infinite Dragonflight are once again attempting to alter time. Could it be that the opening of the Dark Portal is being targeted for sabotage? Let us hope not...', 'Nous avons trčs peu d\'informations sur cette voie. Sa\'at a été envoyé et est actuellement sur place. Les données que nous avons recueillies de sa correspondance est que le Vol du Dragon Infini tente une fois de plus d\'altérer le temps. Se pourrait-il que l\'ouverture de la Porte des Ténčbres soit la cible d\'un sabotage. Espérons que non...', 4, 0, 'WHISPER_CUSTODIAN_10'), +(-1000160, 'This timeway is currently collapsing. What that may hold for the past, present and future is currently unknown...', 'Cette voie est en train de s\'effondrer. Ce qu\'elle peut avoir contenu dans le passé, le présent et le futur nous est actuellement inconnu...', 4, 0, 'WHISPER_CUSTODIAN_11'), +(-1000161, 'The timeways are currently ranked in order from least catastrophic to most catastrophic. Note that they are all classified as catastrophic, meaning that any single one of these timeways collapsing would mean that your world would end. We only classify them in such a way so that the heroes and adventurers that are sent here know which timeway best suits their abilities.', 'Les voies sont pour le moment classées de la moins catastrophique ŕ la plus catastrophique, ce qui veut dire que la moindre de celles-ci qui s\'effondre signifierait la fin de votre monde. Nous les classons seulement de cette façon pour que les héros et aventuriers qui y sont envoyés sachent quelle voie est la plus adaptée ŕ leurs compétences.', 4, 0, 'WHISPER_CUSTODIAN_12'), +(-1000162, 'All we know of this timeway is that it leads to Mount Hyjal. The Infinite Dragonflight have gone to great lengths to prevent our involvement. We know next to nothing, mortal. Soridormi is currently attempting to break through the timeway\'s defenses but has thus far been unsuccessful. You might be our only hope of breaking through and resolving the conflict.', 'Tout ce que nous savons sur cette voie temporelle est qu\'elle mčne au Mont Hyjal. Le Vol du Dragon Infini s\'est donné beaucoup de peine pour empęcher notre participation. Soridormi est actuellement en train de tenter de briser les défenses de cette voie, mais ses efforts ont été vain jusqu\'ici. Vous pourriez ętre notre seul espoir de les briser et de résoudre le conflit.', 4, 0, 'WHISPER_CUSTODIAN_13'), +(-1000163, 'Our time is at an end $N. I would wish you luck, if such a thing existed.', 'Notre entretien touche ŕ sa fin, $N. Je vous souhaite bonne chance, si tant est qu\'une telle chose a jamais existé.', 4, 0, 'WHISPER_CUSTODIAN_14'); diff --git a/sql/updates/2.4.3_old/773_world_scripts.sql b/sql/updates/2.4.3_old/773_world_scripts.sql new file mode 100644 index 0000000..7b10e9b --- /dev/null +++ b/sql/updates/2.4.3_old/773_world_scripts.sql @@ -0,0 +1,9 @@ +UPDATE `quest_template` SET `SpecialFlags`=2 WHERE `entry`=4770; +UPDATE `creature_template` SET `ScriptName`='npc_swiftmountain' WHERE `entry`=10427; +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000149 AND -1000147; +INSERT INTO `script_texts` + (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `comment`) +VALUES + (-1000147, 'Lets go $N. I am ready to start to Whitereach Post.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL), + (-1000148, 'This seems to me trusted. If we move to the east, we are probably... Aah! Wyvern attack !', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL), + (-1000149, 'Thanks so much... From here I find the way back to the Whitereach Post. Speak with Motega Firemane, maybe you can persuade him to send me home.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL); diff --git a/sql/updates/2.4.3_old/780_characters.sql b/sql/updates/2.4.3_old/780_characters.sql new file mode 100644 index 0000000..13e11f2 --- /dev/null +++ b/sql/updates/2.4.3_old/780_characters.sql @@ -0,0 +1,2 @@ +ALTER TABLE `gm_tickets` CHANGE `guid` `guid` int(10) NOT NULL AUTO_INCREMENT; +ALTER TABLE `gm_tickets` CHANGE `closed` `closed` int(10) NOT NULL; diff --git a/sql/updates/2.4.3_old/783_world.sql b/sql/updates/2.4.3_old/783_world.sql new file mode 100644 index 0000000..4005ab2 --- /dev/null +++ b/sql/updates/2.4.3_old/783_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (10056, 10057); +INSERT INTO `trinity_string` (entry, content_default) VALUES +(10056, 'You must be a member of the Horde to enter the Hall of Legends.'), +(10057, 'You must be a member of the Alliance to enter the Champion\'s Hall.'); diff --git a/sql/updates/2.4.3_old/785_world.sql b/sql/updates/2.4.3_old/785_world.sql new file mode 100644 index 0000000..64ffa36 --- /dev/null +++ b/sql/updates/2.4.3_old/785_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('gobject addtemp', 'npc addtemp'); +INSERT INTO `command` (name, security, help) VALUES +('gobject addtemp','2','Adds a temporary gameobject that is not saved to DB.'), +('npc addtemp','2','Adds temporary NPC, not saved to database.'); diff --git a/sql/updates/2.4.3_old/789_world.sql b/sql/updates/2.4.3_old/789_world.sql new file mode 100644 index 0000000..48311e1 --- /dev/null +++ b/sql/updates/2.4.3_old/789_world.sql @@ -0,0 +1 @@ +ALTER TABLE `eventai_texts` DROP COLUMN `emote`; diff --git a/sql/updates/2.4.3_old/78_world.sql b/sql/updates/2.4.3_old/78_world.sql new file mode 100644 index 0000000..faa02e0 --- /dev/null +++ b/sql/updates/2.4.3_old/78_world.sql @@ -0,0 +1,23 @@ +DELETE FROM spell_affect WHERE entry IN (30017,30280,44373) AND effectId = 0; +INSERT INTO spell_affect (entry, effectId, SpellFamilyMask) VALUES +(30017,0,0x0000000000000000), +(30280,0,0x0000000000000000), +(44373,0,0x0000000000000000); + +DELETE FROM spell_affect WHERE entry IN (34520,37508) AND effectId = 1; +INSERT INTO spell_affect (entry, effectId, SpellFamilyMask) VALUES +(34520,1,0x0000000000000000), +(37508,1,0x0000000000000000); + +DELETE FROM spell_proc_event WHERE entry IN (34139,42368,43726,46092); +INSERT INTO spell_proc_event (entry, SchoolMask, Category, SkillID, SpellFamilyName, SpellFamilyMask, procFlags, ppmRate, cooldown) VALUES +(34139,0,0,0,10,0x0000000040000000,0x08000000,0,0), +(42368,0,0,0,10,0x0000000040000000,0x08000000,0,0), +(43726,0,0,0,10,0x0000000040000000,0x08000000,0,0), +(46092,0,0,0,10,0x0000000040000000,0x08000000,0,0); + +DELETE FROM spell_proc_event where entry IN (34598, 34584, 36488); +INSERT INTO spell_proc_event (entry, SchoolMask, Category, SkillID, SpellFamilyName, SpellFamilyMask, procFlags, ppmRate, cooldown) VALUES +(34598,0,0,0,0,0x0000000000000000,0x00020000,0,45), +(36488,0,0,0,0,0x0000000000000000,0x08000000,0,0), +(34584,0,0,0,0,0x0000000000000000,0x00004000,0,30); diff --git a/sql/updates/2.4.3_old/79_characters.sql b/sql/updates/2.4.3_old/79_characters.sql new file mode 100644 index 0000000..4544be2 --- /dev/null +++ b/sql/updates/2.4.3_old/79_characters.sql @@ -0,0 +1,2 @@ +ALTER TABLE characters + CHANGE COLUMN gmstate extra_flags int(11) unsigned NOT NULL default '0'; diff --git a/sql/updates/2.4.3_old/79_world.sql b/sql/updates/2.4.3_old/79_world.sql new file mode 100644 index 0000000..7d24987 --- /dev/null +++ b/sql/updates/2.4.3_old/79_world.sql @@ -0,0 +1,3 @@ +DELETE FROM spell_proc_event where entry = 42083; +INSERT INTO spell_proc_event (entry, SchoolMask, Category, SkillID, SpellFamilyName, SpellFamilyMask, procFlags, ppmRate, cooldown) VALUES +(42083,0,0,0,0,0x0000000000000000,0x00401000,0,45); diff --git a/sql/updates/2.4.3_old/807_world_scripts.sql b/sql/updates/2.4.3_old/807_world_scripts.sql new file mode 100644 index 0000000..0804dcf --- /dev/null +++ b/sql/updates/2.4.3_old/807_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_isla_starmane' WHERE `entry`=18760; diff --git a/sql/updates/2.4.3_old/817_world_scripts.sql b/sql/updates/2.4.3_old/817_world_scripts.sql new file mode 100644 index 0000000..8865bb9 --- /dev/null +++ b/sql/updates/2.4.3_old/817_world_scripts.sql @@ -0,0 +1,12 @@ +UPDATE `creature_template` SET `ScriptName`='npc_ame' WHERE `entry`=9623; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000205 AND -1000200; +INSERT INTO `script_texts` + (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES + (-1000200, 'A-Me good.Good A-me.Follow...A-ME follow.Home.A-ME go home.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1000201, 'Bad Un´Goro Stomper.Stomper evil.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1000202, 'Good..good,A-ME. Home. Search way.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1000203, 'A-Me home.A-ME go home!Tar Lord dont disturb A-ME.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1000204, 'Tar Lord A-ME no hurt.A-ME good.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1000205, 'A-ME at home!A-ME good!Good A-ME.At home.Home.Home', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL); +UPDATE `quest_template` SET `QuestFlags` = 2, `SpecialFlags` = 2 WHERE `entry` = 4245; diff --git a/sql/updates/2.4.3_old/822_world_scripts.sql b/sql/updates/2.4.3_old/822_world_scripts.sql new file mode 100644 index 0000000..89ab6e7 --- /dev/null +++ b/sql/updates/2.4.3_old/822_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='npc_kayra_longmane' WHERE `entry`=17969; +DELETE FROM `creature_template_addon` WHERE `entry`=17969; +UPDATE `quest_template` SET specialflags=2 WHERE `entry`=9752; diff --git a/sql/updates/2.4.3_old/826_world_scripts.sql b/sql/updates/2.4.3_old/826_world_scripts.sql new file mode 100644 index 0000000..a5293ee --- /dev/null +++ b/sql/updates/2.4.3_old/826_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_ruul_snowhoof' WHERE `entry`=12818; diff --git a/sql/updates/2.4.3_old/82_world_scripts.sql b/sql/updates/2.4.3_old/82_world_scripts.sql new file mode 100644 index 0000000..c1521b0 --- /dev/null +++ b/sql/updates/2.4.3_old/82_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_twiggy_flathead' WHERE `entry` =6248; diff --git a/sql/updates/2.4.3_old/833_world_scripts.sql b/sql/updates/2.4.3_old/833_world_scripts.sql new file mode 100644 index 0000000..f459441 --- /dev/null +++ b/sql/updates/2.4.3_old/833_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_dirty_larry', `unit_flags`=0, `flags_extra`=0 WHERE `entry`=19720; +UPDATE `creature_template` SET `unit_flags`=0, `flags_extra`=0 WHERE `entry` IN (19726, 19725); diff --git a/sql/updates/2.4.3_old/834_world_scripts.sql b/sql/updates/2.4.3_old/834_world_scripts.sql new file mode 100644 index 0000000..f9cdf4f --- /dev/null +++ b/sql/updates/2.4.3_old/834_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_ishanah' WHERE `entry`=18538; diff --git a/sql/updates/2.4.3_old/837_world_scripts.sql b/sql/updates/2.4.3_old/837_world_scripts.sql new file mode 100644 index 0000000..4746eb1 --- /dev/null +++ b/sql/updates/2.4.3_old/837_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_khadgar' WHERE `entry`=18166; diff --git a/sql/updates/2.4.3_old/838_world_scripts.sql b/sql/updates/2.4.3_old/838_world_scripts.sql new file mode 100644 index 0000000..4a35167 --- /dev/null +++ b/sql/updates/2.4.3_old/838_world_scripts.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='npc_kyle_frenzied' WHERE `entry`='23616'; +DELETE FROM `spell_script_target` WHERE `entry`=42222; +INSERT INTO `spell_script_target` VALUES +('42222','1','23616'); diff --git a/sql/updates/2.4.3_old/839_world_scripts.sql b/sql/updates/2.4.3_old/839_world_scripts.sql new file mode 100644 index 0000000..3820b21 --- /dev/null +++ b/sql/updates/2.4.3_old/839_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_wizzlecrank_shredder' WHERE `entry`=3439; diff --git a/sql/updates/2.4.3_old/83_realmd.sql b/sql/updates/2.4.3_old/83_realmd.sql new file mode 100644 index 0000000..ad6201c --- /dev/null +++ b/sql/updates/2.4.3_old/83_realmd.sql @@ -0,0 +1,2 @@ +ALTER TABLE account + CHANGE COLUMN tbc expansion tinyint(3) unsigned NOT NULL default '0'; diff --git a/sql/updates/2.4.3_old/840_world_scripts.sql b/sql/updates/2.4.3_old/840_world_scripts.sql new file mode 100644 index 0000000..b9a2372 --- /dev/null +++ b/sql/updates/2.4.3_old/840_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `spell1`=0, `flags_extra`=0, `ScriptName`='npc_volcano' WHERE `entry`=23085; diff --git a/sql/updates/2.4.3_old/841_world_scripts.sql b/sql/updates/2.4.3_old/841_world_scripts.sql new file mode 100644 index 0000000..6208dd6 --- /dev/null +++ b/sql/updates/2.4.3_old/841_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_greengill_slave' WHERE `entry`=25084; diff --git a/sql/updates/2.4.3_old/842_world.sql b/sql/updates/2.4.3_old/842_world.sql new file mode 100644 index 0000000..729d136 --- /dev/null +++ b/sql/updates/2.4.3_old/842_world.sql @@ -0,0 +1,5 @@ +ALTER TABLE `areatrigger_teleport` +ADD `heroic_required_quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0 AFTER `heroic_key2`, +ADD `heroic_required_failed_quest_text` TEXT NULL DEFAULT NULL AFTER `heroic_required_quest_done`; + +UPDATE `areatrigger_teleport` SET `heroic_required_quest_done`=11492, `heroic_required_failed_quest_text`='Heroic Difficulty requires completion of the "Hard to Kill" quest.' WHERE `id`=4887; diff --git a/sql/updates/2.4.3_old/84_world.sql b/sql/updates/2.4.3_old/84_world.sql new file mode 100644 index 0000000..100185c --- /dev/null +++ b/sql/updates/2.4.3_old/84_world.sql @@ -0,0 +1,3 @@ +DELETE FROM command WHERE name = 'reload all_locales'; +INSERT INTO `command` VALUES +('reload all_locales',3,'Syntax: .reload all_locales\r\n\r\nReload all `locales_*` tables with reload support added and that can be _safe_ reloaded.'); diff --git a/sql/updates/2.4.3_old/850_world_scripts.sql b/sql/updates/2.4.3_old/850_world_scripts.sql new file mode 100644 index 0000000..0987e02 --- /dev/null +++ b/sql/updates/2.4.3_old/850_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_bessy' WHERE `entry`=20415; diff --git a/sql/updates/2.4.3_old/852_world_scripts.sql b/sql/updates/2.4.3_old/852_world_scripts.sql new file mode 100644 index 0000000..cc6567d --- /dev/null +++ b/sql/updates/2.4.3_old/852_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='mob_nestlewood_owlkin' WHERE `entry`=16518; +UPDATE `item_template` SET `ScriptName`='item_inoculating_crystal' WHERE `entry`=22962; diff --git a/sql/updates/2.4.3_old/857_world_scripts.sql b/sql/updates/2.4.3_old/857_world_scripts.sql new file mode 100644 index 0000000..55b1ba4 --- /dev/null +++ b/sql/updates/2.4.3_old/857_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_kaya_flathoof' WHERE `entry`=11856; diff --git a/sql/updates/2.4.3_old/863_world_scripts.sql b/sql/updates/2.4.3_old/863_world_scripts.sql new file mode 100644 index 0000000..85e15a4 --- /dev/null +++ b/sql/updates/2.4.3_old/863_world_scripts.sql @@ -0,0 +1,11 @@ +UPDATE `creature_template` SET `ScriptName`='npc_OOX17' WHERE `entry`=7784; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1060005 AND -1060000; +INSERT INTO `script_texts` + (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES + (-1060000, 'Emergency power activated! Initializing ambulatory motor! CLUCK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060001, 'Physical threat detected! Evasive action! CLUCK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060002, 'Threat analyzed! Activating combat plan beta! CLUCK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060003, 'CLUCK! Sensors detect spatial anomaly -- danger imminent! CLUCK', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060004, 'No one challenges the wastevander nomads -- not even robotic chickens! ATTACK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), + (-1060005, 'Cloaking systems online! CLUCK! Engaging cloak for transport to Booty Bay!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL); diff --git a/sql/updates/2.4.3_old/86_world_scripts.sql b/sql/updates/2.4.3_old/86_world_scripts.sql new file mode 100644 index 0000000..ff527ea --- /dev/null +++ b/sql/updates/2.4.3_old/86_world_scripts.sql @@ -0,0 +1,6 @@ +update `creature_template` set `ScriptName`='boss_alar' where `entry`='19514'; +update `creature_template` set `ScriptName`='mob_ember_of_alar' where `entry`='19551'; +update `creature_template` set `ScriptName`='mob_flame_patch_alar' where `entry`='20602'; + +update gameobject_template set scriptname = "go_manticron_cube" where entry = 181713; +update creature_template set scriptname = "mob_abyssal" where entry = 17454; diff --git a/sql/updates/2.4.3_old/871_world.sql b/sql/updates/2.4.3_old/871_world.sql new file mode 100644 index 0000000..2ef2e65 --- /dev/null +++ b/sql/updates/2.4.3_old/871_world.sql @@ -0,0 +1,31 @@ +DELETE FROM `trinity_string` WHERE `entry` BETWEEN '288' AND '295'; +DELETE FROM `trinity_string` WHERE `entry` BETWEEN '2000' AND '2029'; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(2000, '|cff00ff00New ticket from|r|cffff00ff %s.|r |cff00ff00Ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2001, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00edited his/her ticket:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2002, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00abandoned ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2003, '|cff00ff00Closed by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2004, '|cff00ff00Deleted by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2005, 'Ticket not found.', '', '', '', '', '', '', '', ''), +(2006, 'Please close ticket before deleting it permanently.', '', '', '', '', '', '', '', ''), +(2007, 'Ticket %d is already assigned.', '', '', '', '', '', '', '', ''), +(2008, '%u Tickets succesfully reloaded from the database.', '', '', '', '', '', '', '', ''), +(2009, 'Showing list of open tickets.', '', '', '', '', '', '', '', ''), +(2010, 'Showing list of open tickets whose creator is online.', '', '', '', '', '', '', '', ''), +(2011, 'Showing list of closed tickets.', '', '', '', '', '', '', '', ''), +(2012, 'Invalid name specified. Name should be that of an online Gamemaster.', '', '', '', '', '', '', '', ''), +(2013, 'This ticket is already assigned to yourself. To unassign use .ticket unassign %d and then reassign.', '', '', '', '', '', '', '', ''), +(2014, 'Ticket %d is not assigned, you cannot unassign it.', '', '', '', '', '', '', '', ''), +(2015, 'You cannot unassign tickets from staffmembers with a higher security level than yourself.', '', '', '', '', '', '', '', ''), +(2016, 'Cannot close ticket %d, it is assigned to another GM.', '', '', '', '', '', '', '', ''), +(2017, '|cff00ff00Ticket|r:|cff00ccff %d.|r ', '', '', '', '', '', '', '', ''), +(2018, '|cff00ff00Created by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2019, '|cff00ff00Last change|r:|cff00ccff %s ago|r ', '', '', '', '', '', '', '', ''), +(2020, '|cff00ff00Assigned to|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2021, '|cff00ff00Unassigned by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2022, '\n|cff00ff00Message|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), +(2023, '\n|cff00ff00Comment|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), +(2024, '\n|cff00ccff%s|r |cff00ff00Added comment|r: \"%s\"|r ', '', '', '', '', '', '', '', ''); + +DELETE FROM `command` WHERE (`name` LIKE '%ticket closedlist%'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('.ticket closedlist','1','Displays a list of closed GM tickets.'); diff --git a/sql/updates/2.4.3_old/884_world.sql b/sql/updates/2.4.3_old/884_world.sql new file mode 100644 index 0000000..7fcccb0 --- /dev/null +++ b/sql/updates/2.4.3_old/884_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('gobject addtemp','npc addtemp'); +INSERT INTO `command` (name, security, help) VALUES +('gobject addtemp','2','Adds a temporary gameobject that is not saved to DB.'), +('npc addtemp','2','Adds temporary NPC, not saved to database.'); diff --git a/sql/updates/2.4.3_old/905_world_scripts.sql b/sql/updates/2.4.3_old/905_world_scripts.sql new file mode 100644 index 0000000..5bb26d1 --- /dev/null +++ b/sql/updates/2.4.3_old/905_world_scripts.sql @@ -0,0 +1,10 @@ +UPDATE `creature_template` SET `ScriptName`='npc_grimstone' WHERE `entry`=10096; +UPDATE `creature_template` SET `ScriptName`='mob_phalanx' WHERE `entry`=9502; +UPDATE `creature_template` SET `ScriptName`='npc_rocknot' WHERE `entry`=9503; + +DELETE FROM `areatrigger_scripts` WHERE `entry`=1526; +INSERT INTO `areatrigger_scripts` VALUES (1526,'at_ring_of_law'); + +DELETE FROM `script_texts` WHERE `entry`=-1230000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1230000,'Ah, hits the spot!',0,0,0,'rocknot SAY_GOT_BEER'); diff --git a/sql/updates/2.4.3_old/90_world.sql b/sql/updates/2.4.3_old/90_world.sql new file mode 100644 index 0000000..52ca028 --- /dev/null +++ b/sql/updates/2.4.3_old/90_world.sql @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS `spell_disabled`; +CREATE TABLE `spell_disabled` ( + `entry` int(11) unsigned NOT NULL default '0' COMMENT 'Spell entry', + `disable_mask` int(8) unsigned NOT NULL default '0', + `comment` varchar(64) NOT NULL default '', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Disabled Spell System'; diff --git a/sql/updates/2.4.3_old/917_world.sql b/sql/updates/2.4.3_old/917_world.sql new file mode 100644 index 0000000..450cf72 --- /dev/null +++ b/sql/updates/2.4.3_old/917_world.sql @@ -0,0 +1,8 @@ +CREATE TABLE `version` ( + `core_version` varchar(120) default NULL COMMENT 'Core revision dumped at startup.', + `db_version` varchar(120) default NULL COMMENT 'Version of world DB.', + `script_version` varchar(120) default NULL COMMENT 'Version of scripts DB.' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Version Notes'; +INSERT INTO `version` (core_version, db_version, script_version) VALUES ("",(SELECT version FROM db_version),(SELECT version FROM script_db_version)); +DROP TABLE IF EXISTS `db_version`; +DROP TABLE IF EXISTS `script_db_version`; diff --git a/sql/updates/2.4.3_old/919_world.sql b/sql/updates/2.4.3_old/919_world.sql new file mode 100644 index 0000000..bd6aa0c --- /dev/null +++ b/sql/updates/2.4.3_old/919_world.sql @@ -0,0 +1,2 @@ +ALTER TABLE `version` + ADD `core_revision` varchar(120) AFTER `core_version`; diff --git a/sql/updates/2.4.3_old/927_characters.sql b/sql/updates/2.4.3_old/927_characters.sql new file mode 100644 index 0000000..cf9df74 --- /dev/null +++ b/sql/updates/2.4.3_old/927_characters.sql @@ -0,0 +1 @@ +ALTER TABLE `gm_tickets` CHANGE `closed` `closed` int(10) NOT NULL default '0'; diff --git a/sql/updates/2.4.3_old/930_characters.sql b/sql/updates/2.4.3_old/930_characters.sql new file mode 100644 index 0000000..1edcd12 --- /dev/null +++ b/sql/updates/2.4.3_old/930_characters.sql @@ -0,0 +1,56 @@ +-- +-- Table structure for table `auctionhousebot` +-- + +CREATE TABLE IF NOT EXISTS `auctionhousebot` ( + `auctionhouse` int(11) NOT NULL default '0' COMMENT 'mapID of the auctionhouse.', + `name` char(25) default NULL COMMENT 'Text name of the auctionhouse.', + `minitems` int(11) default '0' COMMENT 'This is the minimum number of items you want to keep in the auction house. a 0 here will make it the same as the maximum.', + `maxitems` int(11) default '0' COMMENT 'This is the number of items you want to keep in the auction house.', + `mintime` int(11) default '8' COMMENT 'Sets the minimum number of hours for an auction.', + `maxtime` int(11) default '24' COMMENT 'Sets the maximum number of hours for an auction.', + `percentwhitetradegoods` int(11) default '27' COMMENT 'Sets the percentage of the White Trade Goods auction items', + `percentgreentradegoods` int(11) default '12' COMMENT 'Sets the percentage of the Green Trade Goods auction items', + `percentbluetradegoods` int(11) default '10' COMMENT 'Sets the percentage of the Blue Trade Goods auction items', + `percentpurpletradegoods` int(11) default '1' COMMENT 'Sets the percentage of the Purple Trade Goods auction items', + `percentwhiteitems` int(11) default '10' COMMENT 'Sets the percentage of the non trade White auction items', + `percentgreenitems` int(11) default '30' COMMENT 'Sets the percentage of the non trade Green auction items', + `percentblueitems` int(11) default '8' COMMENT 'Sets the percentage of the non trade Blue auction items', + `percentpurpleitems` int(11) default '2' COMMENT 'Sets the percentage of the non trade Purple auction items', + `minpricewhite` int(11) default '150' COMMENT 'Minimum price of White items (percentage).', + `maxpricewhite` int(11) default '250' COMMENT 'Maximum price of White items (percentage).', + `minpricegreen` int(11) default '800' COMMENT 'Minimum price of Green items (percentage).', + `maxpricegreen` int(11) default '1400' COMMENT 'Maximum price of Green items (percentage).', + `minpriceblue` int(11) default '1250' COMMENT 'Minimum price of Blue items (percentage).', + `maxpriceblue` int(11) default '1750' COMMENT 'Maximum price of Blue items (percentage).', + `minpricepurple` int(11) default '2250' COMMENT 'Minimum price of Purple items (percentage).', + `maxpricepurple` int(11) default '4550' COMMENT 'Maximum price of Purple items (percentage).', + `minbidpricewhite` int(11) default '70' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `maxbidpricewhite` int(11) default '100' COMMENT 'Starting bid price of White items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `minbidpricegreen` int(11) default '80' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `maxbidpricegreen` int(11) default '100' COMMENT 'Starting bid price of Green items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `minbidpriceblue` int(11) default '75' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `maxbidpriceblue` int(11) default '100' COMMENT 'Starting bid price of Blue items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `minbidpricepurple` int(11) default '80' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `maxbidpricepurple` int(11) default '100' COMMENT 'Starting bid price of Purple items as a percentage of the randomly chosen buyout price. Default: 100 (Bid and buyout price the same)', + `maxstackwhite` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackgreen` int(11) default '3' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackblue` int(11) default '2' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `maxstackpurple` int(11) default '1' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + `buyerpricegrey` int(11) default '1' COMMENT 'Multiplier to vendorprice when buying grey items from auctionhouse', + `buyerpricewhite` int(11) default '1' COMMENT 'Multiplier to vendorprice when buying white items from auctionhouse', + `buyerpricegreen` int(11) default '5' COMMENT 'Multiplier to vendorprice when buying green items from auctionhouse', + `buyerpriceblue` int(11) default '12' COMMENT 'Multiplier to vendorprice when buying blue items from auctionhouse', + `buyerpricepurple` int(11) default '15' COMMENT 'Multiplier to vendorprice when buying purple items from auctionhouse', + `buyerbiddinginterval` int(11) default '1' COMMENT 'Interval how frequently AHB bids on each AH. Time in minutes', + `buyerbidsperinterval` int(11) default '1' COMMENT 'number of bids to put in per bidding interval', + PRIMARY KEY (`auctionhouse`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Data for table `auctionhousebot` +-- +INSERT IGNORE INTO `auctionhousebot` (`auctionhouse`,`name`,`minitems`,`maxitems`,`mintime`,`maxtime`,`percentwhitetradegoods`,`percentgreentradegoods`,`percentbluetradegoods`,`percentpurpletradegoods`,`percentwhiteitems`,`percentgreenitems`,`percentblueitems`,`percentpurpleitems`,`minpricewhite`,`maxpricewhite`,`minpricegreen`,`maxpricegreen`,`minpriceblue`,`maxpriceblue`,`minpricepurple`,`maxpricepurple`,`minbidpricewhite`,`maxbidpricewhite`,`minbidpricegreen`,`maxbidpricegreen`,`minbidpriceblue`,`maxbidpriceblue`,`minbidpricepurple`,`maxbidpricepurple`,`maxstackwhite`,`maxstackgreen`,`maxstackblue`,`maxstackpurple`,`buyerpricegrey`,`buyerpricewhite`,`buyerpricegreen`,`buyerpriceblue`,`buyerpricepurple`,`buyerbiddinginterval`,`buyerbidsperinterval`) values +(2,'Alliance',0,0,8,24,27,12,10,1,10,30,8,2,150,250,800,1400,1250,1750,2250,4550,70,100,80,100,75,100,80,100,0,3,2,1,1,1,5,12,15,1,1), +(6,'Horde',0,0,8,24,27,12,10,1,10,30,8,2,150,250,800,1400,1250,1750,2250,4550,70,100,80,100,75,100,80,100,0,3,2,1,1,1,5,12,15,1,1), +(7,'Neutral',0,0,8,24,27,12,10,1,10,30,8,2,150,250,800,1400,1250,1750,2250,4550,70,100,80,100,75,100,80,100,0,3,2,1,1,1,5,12,15,1,1); diff --git a/sql/updates/2.4.3_old/933_world_scripts.sql b/sql/updates/2.4.3_old/933_world_scripts.sql new file mode 100644 index 0000000..0948dd8 --- /dev/null +++ b/sql/updates/2.4.3_old/933_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_snake_trap_serpents' WHERE `entry` IN (19921, 19833); diff --git a/sql/updates/2.4.3_old/935_world_scripts.sql b/sql/updates/2.4.3_old/935_world_scripts.sql new file mode 100644 index 0000000..c21dbdb --- /dev/null +++ b/sql/updates/2.4.3_old/935_world_scripts.sql @@ -0,0 +1,6 @@ +DELETE FROM `creature` WHERE `id`='17653'; + +UPDATE `gameobject_template` SET `flags`='4' WHERE `entry` IN ('181766','181823'); +UPDATE `gameobject` SET `SpawnMask`='3',`state`='1' WHERE `id` IN ('181766','181823'); + +UPDATE `instance_template` SET `script`='instance_blood_furnace' WHERE `map`=542; diff --git a/sql/updates/2.4.3_old/940_world_scripts.sql b/sql/updates/2.4.3_old/940_world_scripts.sql new file mode 100644 index 0000000..366fa47 --- /dev/null +++ b/sql/updates/2.4.3_old/940_world_scripts.sql @@ -0,0 +1,2 @@ +ALTER TABLE `custom_texts` CHANGE COLUMN `emote` `emote` smallint(5) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `script_texts` CHANGE COLUMN `emote` `emote` smallint(5) unsigned NOT NULL DEFAULT '0'; diff --git a/sql/updates/2.4.3_old/945_world_scripts.sql b/sql/updates/2.4.3_old/945_world_scripts.sql new file mode 100644 index 0000000..28f82af --- /dev/null +++ b/sql/updates/2.4.3_old/945_world_scripts.sql @@ -0,0 +1,40 @@ +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=22083; +UPDATE `creature_template` SET `ScriptName`='npc_overlord_morghor' WHERE `entry`=23139; +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=23141; +DELETE FROM `script_texts` WHERE entry BETWEEN -1000221 and -1000206; +INSERT INTO `script_texts` (entry, content_default, type, emote, comment) VALUES +(-1000206, 'Come, $N. Lord Stormrage awaits.', 0, 1, 'OVERLORD_SAY_1'), +(-1000207, 'Lord Illidan will be here shortly.', 0, 1, 'OVERLORD_SAY_2'), +(-1000208, 'Lord Illidan, this is the Dragonmaw that I, and others, have told you about. He will lead us to victory!', 0, 1, 'OVERLORD_SAY_3'), +(-1000209, 'But... My lord, I do not understand. $N... He is the orc that has...', 0, 1, 'OVERLORD_SAY_4'), +(-1000210, 'It will be done, my lord.', 0, 1, 'OVERLORD_SAY_5'), +(-1000211, 'So you thought to make a fool of Mor\'ghor, eh? Before you are delivered to Lord Illidan, you will feel pain that you could not know to exist. I will take pleasure in exacting my own vengeance.', 0, 25, 'OVERLORD_SAY_6'), +(-1000212, 'Warriors of Dragonmaw, gather \'round! One among you has attained the rank of highlord! Bow your heads in reverence! Show your respect and allegiance to Highlord $N!', 1, 22, 'OVERLORD_YELL_1'), +(-1000213, 'All hail Lord Illidan!', 1, 66, 'OVERLORD_YELL_2'), +(-1000214, 'What is the meaning of this, Mor\'ghor?', 0, 1, 'LORD_ILLIDAN_SAY_1'), +(-1000215, 'SILENCE!', 0, 22, 'LORD_ILLIDAN_SAY_2'), +(-1000216, 'Blathering idiot. You incomprehensibly incompetent buffoon...', 0, 1, 'LORD_ILLIDAN_SAY_3'), +(-1000217, 'THIS is your hero?', 0, 6, 'LORD_ILLIDAN_SAY_4'), +(-1000218, 'You have been deceived, imbecile.', 0, 1, 'LORD_ILLIDAN_SAY_5'), +(-1000219, 'This... whole... operation... HAS BEEN COMPROMISED!', 0, 22, 'LORD_ILLIDAN_SAY_6'), +(-1000220, 'I expect to see this insect\'s carcass in pieces in my lair within the hour. Fail and you will suffer a fate so much worse than death.', 0, 1, 'LORD_ILLIDAN_SAY_7'), +(-1000221, 'You will not harm the boy, Mor\'ghor! Quickly, $N, climb on my back!', 0, 22, 'YARZILL_THE_MERC_SAY'); + +DELETE FROM `script_texts` WHERE `entry`='-1000222'; +INSERT INTO `script_texts` (entry, content_default, type, language, emote, comment) VALUES +(-1000222, 'Thank you, mortal.', 0, 11, 1, 'SAY_JUST_EATEN'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000234 and -1000223; +INSERT INTO `script_texts` (entry, content_default, emote, comment) VALUES +(-1000223, 'I sense the tortured spirits, $N. They are this way, come quickly!', 1, 'SAY_START'), +(-1000224, 'Watch out!', 0, 'SAY_AGGRO1'), +(-1000225, 'Naga attackers! Defend yourself!', 0, 'SAY_AGGRO2'), +(-1000226, 'Kill them all!', 0, 'ASSASSIN_SAY_AGGRO1'), +(-1000227, 'You will never essscape Coilssskarrr...', 0, 'ASSASSIN_SAY_AGGRO2'), +(-1000228, 'Grant me protection $N, i must break trough their foul magic!', 0, 'SAY_PROGRESS1'), +(-1000229, 'The naga of Coilskar are exceptionally cruel to their prisoners. It is a miracle that I survived inside that watery prison for as long as I did. Earthmother be praised.', 0, 'SAY_PROGRESS2'), +(-1000230, 'Now we must find the exit.', 0, 'SAY_PROGRESS3'), +(-1000231, 'Lady Vashj must answer for these atrocities. She must be brought to justice!', 0, 'SAY_PROGRESS4'), +(-1000232, 'The tumultuous nature of the great waterways of Azeroth and Draenor are a direct result of tormented water spirits.', 0, 'SAY_PROGRESS5'), +(-1000233, 'It shouldn\'t be much further, $N. The exit is just up ahead.', 0, 'SAY_PROGRESS6'), +(-1000234, 'Thank you, $N. Please return to my brethren at the Altar of Damnation, near the Hand of Gul\'dan, and tell them that Wilda is safe. May the Earthmother watch over you...', 0, 'SAY_END'); diff --git a/sql/updates/2.4.3_old/947_world_scripts.sql b/sql/updates/2.4.3_old/947_world_scripts.sql new file mode 100644 index 0000000..9686bd4 --- /dev/null +++ b/sql/updates/2.4.3_old/947_world_scripts.sql @@ -0,0 +1,12 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000244 and -1000235; +INSERT INTO `script_texts` (entry, content_default, type, emote, comment) VALUES +(-1000235, 'Ok, $N. Follow me to the cave where I\'ll attempt to harness the power of the rune stone into these goggles.', 0, 1, 'phizzlethorpe - SAY_PROGRESS_1'), +(-1000236, 'I discovered this cave on our first day here. I believe the energy in the stone can be used to our advantage.', 0, 1, 'phizzlethorpe - SAY_PROGRESS_2'), +(-1000237, 'I\'ll begin drawing energy from the stone. Your job, $N, is to defend me. This place is cursed... trust me.', 0, 1, 'phizzlethorpe - SAY_PROGRESS_3'), +(-1000238, 'begins tinkering with the goggles before the stone.', 2, 0, 'phizzlethorpe - EMOTE_PROGRESS_4'), +(-1000239, 'Help!!! Get these things off me so I can get my work done!', 0, 0, 'SAY_AGGRO'), +(-1000240, 'Almost done! Just a little longer!', 0, 1, 'phizzlethorpe - SAY_PROGRESS_5'), +(-1000241, 'I\'ve done it! I have harnessed the power of the stone into the goggles! Let\'s get out of here!', 0, 1, 'phizzlethorpe - SAY_PROGRESS_6'), +(-1000242, 'Phew! Glad to be back from that creepy cave.', 0, 1, 'phizzlethorpe - SAY_PROGRESS_7'), +(-1000243, 'hands one glowing goggles over to Doctor Draxlegauge.', 2, 0, 'phizzlethorpe - EMOTE_PROGRESS_8'), +(-1000244, 'Doctor Draxlegauge will give you further instructions, $N. Many thanks for your help!', 0, 1, 'phizzlethorpe - SAY_PROGRESS_9'); diff --git a/sql/updates/2.4.3_old/948_world_scripts.sql b/sql/updates/2.4.3_old/948_world_scripts.sql new file mode 100644 index 0000000..727d1bf --- /dev/null +++ b/sql/updates/2.4.3_old/948_world_scripts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000247 and -1000245; +INSERT INTO `script_texts` (entry, content_default, type, comment) VALUES +(-1000245, 'You, there! Hand over that moonstone and nobody gets hurt!', 1, 'SAY_RIZZLE_START'), +(-1000246, 'Just chill!', 4, 'SAY_RIZZLE_GRENADE'), +(-1000247, 'All right, you win! I surrender! Just don\'t hurt me!', 1, 'SAY_RIZZLE_FINAL'); diff --git a/sql/updates/2.4.3_old/950_world_scripts.sql b/sql/updates/2.4.3_old/950_world_scripts.sql new file mode 100644 index 0000000..202bf6a --- /dev/null +++ b/sql/updates/2.4.3_old/950_world_scripts.sql @@ -0,0 +1,23 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000266 and -1000248; +INSERT INTO `script_texts` (entry, content_default, type, emote, comment) VALUES +(-1000248, 'The last thing I remember is the ship falling and us getting into the pods. I\'ll go see how I can help. Thank you!', 0, 0, 'draenei survivor - HEAL1'), +(-1000249, '$C, Where am I? Who are you? Oh no! What happened to the ship?.', 0, 0, 'draenei survivor - HEAL2'), +(-1000250, '$C You saved me! I owe you a debt that I can never repay. I\'ll go see if I can help the others.', 0, 0, 'draenei survivor - HEAL3'), +(-1000251, 'Ugh... what is this place? Is that all that\'s left of the ship over there?', 0, 0, 'draenei survivor - HEAL4'), +(-1000252, 'Oh, the pain...', 0, 0, 'draenei survivor - HELP1'), +(-1000253, 'Everything hurts, Please make it stop...', 0, 0, 'draenei survivor - HELP2'), +(-1000254, 'Ughhh... I hurt. Can you help me?', 0, 0, 'draenei survivor - HELP3'), +(-1000255, 'I don\'t know if I can make it, please help me...', 0, 0, 'draenei survivor - HELP4'), + +(-1000256, 'Yes Master, all goes along as planned.', 0, 1, 'overgrind - SAY_TEXT'), +(-1000257, 'puts the shell to his ear.', 2, 0, 'overgrind - SAY_EMOTE'), +(-1000258, 'Now I cut you!', 1, 0, 'overgrind - YELL_ATTACK'), + +(-1000259, 'What\'s the big idea, Spark?', 0, 0, 'geezle - GEEZLE_SAY_1'), +(-1000260, 'What\'s the big idea? You nearly blew my cover, idiot! I told you to put the compass and navigation maps somewhere safe - not out in the open for any fool to discover.', 0, 0, 'geezle - SPARK_SAY_2'), +(-1000261, 'The Master has gone to great lengths to secure information about the whereabouts of the Exodar. You could have blown the entire operation, including the cover of our spy on the inside.', 0, 0, 'geezle - SPARK_SAY_3'), +(-1000262, 'Relax, Spark! I have it all under control. We\'ll strip mine the Exodar right out from under \'em - making both you and I very, very rich in the process.', 0, 0, 'geezle - GEEZLE_SAY_4'), +(-1000263, 'Relax? Do you know what Kael\'thas does to those that fail him, Geezle? Eternal suffering and pain... Do NOT screw this up, fool.', 0, 0, 'geezle - SPARK_SAY_5'), +(-1000264, 'Our Bloodmyst scouts have located our contact. The fool, Velen, will soon leave himself open and defenseless -- long enough for us to strike! Now get out of my sight before I vaporize you...', 0, 0, 'geezle - SPARK_SAY_6'), +(-1000265, 'Yes, sir. It won\'t happen again...', 0, 0, 'geezle - GEEZLE_SAY_7'), +(-1000266, 'picks up the naga flag.', 2, 0, 'geezle - EMOTE_SPARK'); diff --git a/sql/updates/2.4.3_old/951_world_scripts.sql b/sql/updates/2.4.3_old/951_world_scripts.sql new file mode 100644 index 0000000..d07443a --- /dev/null +++ b/sql/updates/2.4.3_old/951_world_scripts.sql @@ -0,0 +1,16 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000279 and -1000267; +INSERT INTO `script_texts` (entry, content_default, type, comment) VALUES +(-1000267, 'Ready when you are, warrior.', 1, 'flathead - SAY_BIG_WILL_READY'), +(-1000268, 'The Affray has begun, get ready to fight!', 1, 'flathead - SAY_TWIGGY_FLATHEAD_BEGIN'), +(-1000269, 'You! Enter the fray!', 1, 'flathead - SAY_TWIGGY_FLATHEAD_FRAY'), +(-1000270, 'Challenger is down!', 1, 'flathead - SAY_TWIGGY_FLATHEAD_DOWN'), +(-1000271, 'The Affray is over.', 1, 'flathead - SAY_TWIGGY_FLATHEAD_OVER'), + +(-1000272, 'Alright, alright I think I can figure out how to operate this thing...', 0, 'shredder - SAY_PROGRESS_1'), +(-1000273, 'Arrrgh! This isn\'t right!', 0, 'shredder - SAY_PROGRESS_2'), +(-1000274, 'Okay, I think I\'ve got it, now. Follow me, $N!', 0, 'shredder - SAY_PROGRESS_3'), +(-1000275, 'There\'s the stolen shredder! Stop it or Lugwizzle will have our hides!', 1, 'shredder - SAY_MERCENARY_4'), +(-1000276, 'Looks like we\'re out of woods, eh? Wonder what this does...', 0, 'shredder - SAY_PROGRESS_5'), +(-1000277, 'Come on, don\'t break down on me now!', 0, 'shredder - SAY_PROGRESS_6'), +(-1000278, 'That was a close one! Well, let\'s get going, it\'s still a ways to Ratchet!', 0, 'shredder - SAY_PROGRESS_7'), +(-1000279, 'Hmm... I don\'t think this blinking red light is a good thing...', 0, 'shredder - SAY_PROGRESS_8'); diff --git a/sql/updates/2.4.3_old/952_world_scripts.sql b/sql/updates/2.4.3_old/952_world_scripts.sql new file mode 100644 index 0000000..de9f01c --- /dev/null +++ b/sql/updates/2.4.3_old/952_world_scripts.sql @@ -0,0 +1,10 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000285 and -1000280; +INSERT INTO `script_texts` (entry, content_default, type, language, comment) VALUES +(-1000280, 'Thank you, dear Paladin, you just saved my life.', 0, 7, 'faulk - SAY_HEAL'), + +(-1000281, 'Very well. Let\'s see what you have to show me, $N.', 0, 0, 'anvilvard - SAY_PR_1'), +(-1000282, 'What manner of trick is this, $R? If you seek to ambush me, I warn you I will not go down quietly!', 0, 0, 'anvilvard - SAY_PR_2'), +(-1000283, 'releases the last of its energies into the nerarby runestone, succesfully reactivating it.', 2, 0, 'crystal - EMOTE'), + +(-1000284, 'Deployment sucessful. Trespassers will be neutralized.', 0, 0, 'sentry - SAY_CONVERTED_1'), +(-1000285, 'Objective acquired. Initiating security routines.', 0, 0, 'sentry - SAY_CONVERTED_1'); diff --git a/sql/updates/2.4.3_old/953_world_scripts.sql b/sql/updates/2.4.3_old/953_world_scripts.sql new file mode 100644 index 0000000..ec40eeb --- /dev/null +++ b/sql/updates/2.4.3_old/953_world_scripts.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000292 and -1000286; +INSERT INTO `script_texts` (entry, content_default, type, emote, comment) VALUES +(-1000286, 'A shadowy, sinister presence has invader the Emerald Dream. Its power is poised to spill over into our world, $N. We must oppose it! That\'s why I cannot accompany you in person.', 0, 0, 'clintar_spirit'), +(-1000287, 'The Emerald Dream will never be yours!', 0, 0, 'clintar_spirit'), +(-1000288, 'Begone from this place!', 0, 0, 'clintar_spirit'), +(-1000289, 'That\'s the first relic, but there are still two more. Follow me, $N.', 0, 0, 'clintar_spirit'), +(-1000290, 'I\'ve recovered the second relic. Take a moment to rest, and then we\'ll continue to the last reliquary.', 0, 0, 'clintar_spirit'), +(-1000291, 'We have all three of the relics, but my energy is rapidly fading. We must make our way back to Dreamwarden Lurosa! He will let you know what to do next.', 0, 0, 'clintar_spirit'), +(-1000292, 'Lurosa, I am entrusting the Relics of Aviana to $N, who will take them to Morthis Whisperwing. I must return completely to the Emerald Dream now. Do not let $N fail!', 0, 0, 'clintar_spirit'); diff --git a/sql/updates/2.4.3_old/954_world_scripts.sql b/sql/updates/2.4.3_old/954_world_scripts.sql new file mode 100644 index 0000000..2240cb3 --- /dev/null +++ b/sql/updates/2.4.3_old/954_world_scripts.sql @@ -0,0 +1,19 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000305 and -1000293; +INSERT INTO `script_texts` (entry, content_default, type, comment) VALUES +(-1000293, 'In Nagrand, food hunt ogre!', 0, 'LUMP_SAY0'), +(-1000294, 'You taste good with maybe a little salt and pepper.', 0, 'LUMP_SAY1'), +(-1000295, 'OK, OK! Lump give up!', 0, 'LUMP_DEFEAT'), + +(-1000296, 'Warning! Emergency shutdown process initiated by $N. Shutdown will complete in two minutes.', 2, 'npc_manaforge_control_console - EMOTE_START'), +(-1000297, 'Emergency shutdown will complete in one minute.', 2, 'npc_manaforge_control_console - EMOTE_60'), +(-1000298, 'Emergency shutdown will complete in thirty seconds.', 2, 'npc_manaforge_control_console - EMOTE_30'), +(-1000299, 'Emergency shutdown will complete in ten seconds.', 2, 'npc_manaforge_control_console - EMOTE_10'), +(-1000300, 'Emergency shutdown complete.', 2, 'npc_manaforge_control_console - EMOTE_COMPLETE'), +(-1000301, 'Emergency shutdown aborted.', 2, 'npc_manaforge_control_console - EMOTE_ABORT'), + +(-1000302, 'Saeed is currently engaged or awaiting orders to engage. You may check directly east of me and see if Saeed is ready for you. If he is not present then he is off fighting another battle. I recommend that you wait for him to return before attacking Dimensius.', 4, 'npc_professor_dabiri - WHISPER_DABIRI'), + +(-1000303, 'is very weak', 2, 'mob_phase_hunter - EMOTE_WEAK'), + +(-1000304, 'Bessy, is that you?', 0, 'npc_bessy- SAY_THADELL_1'), +(-1000305, 'Thank you for bringing back my Bessy, $N. I couldn\'t live without her!', 0, 'npc_bessy- SAY_THADELL_2'); diff --git a/sql/updates/2.4.3_old/955_world_scripts.sql b/sql/updates/2.4.3_old/955_world_scripts.sql new file mode 100644 index 0000000..b1c80e8 --- /dev/null +++ b/sql/updates/2.4.3_old/955_world_scripts.sql @@ -0,0 +1,59 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000333 and -1000306; +INSERT INTO `script_texts` (entry, content_default, type, comment) VALUES +(-1000306, 'Follow me, stranger. This won\'t take long.', 0, 'npc_kservant - SAY1'), +(-1000307, 'Shattrath was once the draenei capital of this world. Its name means \"dwelling of light.\"', 4, 'npc_kservant - WHISP1'), +(-1000308, 'When the Burning Legion turned the orcs against the draenei, the fiercest battle was fought here. The draenei fought tooth and nail, but in the end the city fell.', 4, 'npc_kservant - WHISP2'), +(-1000309, 'The city was left in ruins and darkness... until the Sha\'tar arrived.', 4, 'npc_kservant - WHISP3'), +(-1000310, 'Let us go into the Lower City. I will warn you that as one of the only safe havens in Outland, Shattrath has attracted droves of refugees from all wars, current and past.', 4, 'npc_kservant - WHISP4'), +(-1000311, 'The Sha\'tar, or \"born from light\" are the naaru that came to Outland to fight the demons of the Burning Legion.', 4, 'npc_kservant - WHISP5'), +(-1000312, 'They were drawn to the ruins of Shattrath City where a small remnant of the draenei priesthood conducted its rites inside a ruined temple on this very spot.', 4, 'npc_kservant - WHISP6'), +(-1000313, 'The priesthood, known as the Aldor, quickly regained its strength as word spread that the naaru had returned and reconstruction soon began. The ruined temple is now used as an infirmary for injured refugees.', 4, 'npc_kservant - WHISP7'), +(-1000314, 'It wouldn\'t be long, however, before the city came under attack once again. This time, the attack came from Illidan\'s armies. A large regiment of blood elves had been sent by Illidan\'s ally, Kael\'thas Sunstrider, to lay waste to the city.', 4, 'npc_kservant - WHISP8'), +(-1000315, 'As the regiment of blood elves crossed this very bridge, the Aldor\'s exarchs and vindicators lined up to defend the Terrace of Light. But then the unexpected happened.', 4, 'npc_kservant - WHISP9'), +(-1000316, 'The blood elves laid down their weapons in front of the city\'s defenders; their leader, a blood elf elder known as Voren\'thal, stormed into the Terrace of Light and demanded to speak to A\'dal.', 4, 'npc_kservant - WHISP10'), +(-1000317, 'As the naaru approached him, Voren\'thal kneeled before him and uttered the following words: \"I\'ve seen you in a vision, naaru. My race\'s only hope for survival lies with you. My followers and I are here to serve you.\"', 4, 'npc_kservant - WHISP11'), +(-1000318, 'The defection of Voren\'thal and his followers was the largest loss ever incurred by Kael\'s forces. And these weren\'t just any blood elves. Many of the best and brightest amongst Kael\'s scholars and magisters had been swayed by Voren\'thal\'s influence.', 4, 'npc_kservant - WHISP12'), +(-1000319, 'The naaru accepted the defectors, who would become known as the Scryers; their dwelling lies in the platform above. Only those initiated with the Scryers are allowed there.', 4, 'npc_kservant - WHISP13'), +(-1000320, 'The Aldor are followers of the Light and forgiveness and redemption are values they understand. However, they found hard to forget the deeds of the blood elves while under Kael\'s command.', 4, 'npc_kservant - WHISP14'), +(-1000321, 'Many of the priesthood had been slain by the same magisters who now vowed to serve the naaru. They were not happy to share the city with their former enemies.', 4, 'npc_kservant - WHISP15'), +(-1000322, 'The Aldor\'s most holy temple and its surrounding dwellings lie on the terrace above. As a holy site, only the initiated are welcome inside.', 4, 'npc_kservant - WHISP16'), +(-1000323, 'The attacks against Shattrath continued, but the city did not fall, as you can see. On the contrary, the naaru known as Xi\'ri led a successful incursion into Shadowmoon Valley - Illidan\'s doorstep.', 4, 'npc_kservant - WHISP17'), +(-1000324, 'There he continues to wage war on Illidan with the assistance of the Aldor and the Scryers. The two factions have not given up on their old feuds, though.', 4, 'npc_kservant - WHISP18'), +(-1000325, 'Such is their animosity that they vie for the honor of being sent to assist the naaru there. Each day, that decision is made here by A\'dal. The armies gather here to receive A\'dal\'s blessing before heading to Shadowmoon.', 4, 'npc_kservant - WHISP19'), +(-1000326, 'Khadgar should be ready to see you again. Just remember that to serve the Sha\'tar you will most likely have to ally with the Aldor or the Scryers. And seeking the favor of one group will cause the others\' dislike.', 4, 'npc_kservant - WHISP20'), +(-1000327, 'Good luck stranger, and welcome to Shattrath City.', 4, 'npc_kservant - WHISP21'), + + +(-1000328, 'Time to teach you a lesson in manners, little boy!', 0, ''), +(-1000329, 'Now I\'m gonna give you to the count of \'3\' to get out of here before I sick the dogs on you.', 0, ''), +(-1000330, '1...', 0, ''), +(-1000331, '2...', 0, ''), +(-1000332, 'Time to meet your maker!', 0, ''), +(-1000333, 'Alright, we give up! Don\'t hurt us!', 0, ''); + +DELETE FROM `script_texts` WHERE `entry`=-1000334; +INSERT INTO `script_texts` (entry, content_default, type, language, comment) VALUES +(-1000334, 'Thank you, dear Paladin, you just saved my life.', 0, 10, 'stillblade - SAY_HEAL'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000349 and -1000335; +INSERT INTO `script_texts` (entry, content_default, type, comment) VALUES +(-1000335, 'Let\'s get to the others, and keep an eye open for those wolves cutside...', 0, 'npc_deathstalker_erland +- SAY_QUESTACCEPT'), +(-1000336, 'Be careful, $N. Those wolves like to hide among the trees.', 0, 'npc_deathstalker_erland - SAY_START'), +(-1000337, 'A $C attacks!', 0, 'npc_deathstalker_erland - SAY_AGGRO_1'), +(-1000338, 'Beware! I am under attack!', 0, 'npc_deathstalker_erland - SAY_AGGRO_2'), +(-1000339, 'We\'re almost there!', 0, 'npc_deathstalker_erland - SAY_LAST'), +(-1000340, 'We made it! Thanks, $N. I couldn\'t have gotten without you.', 0, 'npc_deathstalker_erland - +SAY_THANKS'), +(-1000341, 'It\'s good to see you again, Erland. What is your report?', 0, 'npc_deathstalker_erland - SAY_RANE'), +(-1000342, 'Masses of wolves are to the east, and whoever lived at Malden\'s Orchard is gone.', 0, +'npc_deathstalker_erland - SAY_ANSWER'), +(-1000343, 'If I am excused, then I\'d like to check on Quinn...', 0, 'npc_deathstalker_erland - SAY_MOVE_QUINN'), +(-1000344, 'Hello, Quinn. How are you faring?', 0, 'npc_deathstalker_erland - SAY_GREETINGS'), +(-1000345, 'I\'ve been better. Ivar the Foul got the better of me...', 0, 'npc_deathstalker_erland - SAY_QUINN'), +(-1000346, 'Try to take better care of yourself, Quinn. You were lucky this time.', 0, 'npc_deathstalker_erland - +SAY_ON_BYE'), + +(-1000347, 'Let\'s go before they find out I\'m free!', 0, 'npc_kaya_flathoof - SAY_START'), +(-1000348, 'Look out! We\'re under attack!', 0, 'npc_kaya_flathoof - SAY_AMBUSH'), +(-1000349, 'Thank you for helping me. I know my way back from here.', 0, 'npc_kaya_flathoof - SAY_END'); diff --git a/sql/updates/2.4.3_old/956_world_scripts.sql b/sql/updates/2.4.3_old/956_world_scripts.sql new file mode 100644 index 0000000..57fb3b8 --- /dev/null +++ b/sql/updates/2.4.3_old/956_world_scripts.sql @@ -0,0 +1,24 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000365 and -1000350; +INSERT INTO `script_texts` (entry, content_default, type, comment) VALUES +(-1000350, 'Who dares awaken Aquementas?', 1, 'mob_aquementas - AGGRO_YELL_AQUE'), + +(-1000351, 'I give up! Please don\'t kill me!', 0, 'mob_unkor_the_ruthless - SAY_SUBMIT'), + +(-1000352, 'I choose the third option: KILLING YOU!', 0, 'npc_floon - SAY_FLOON_ATTACK'), + +(-1000353, 'Ok let\'s get out of here!', 0, 'npc_isla_starmane - SAY_PROGRESS_1'), +(-1000354, 'You sure you\'re ready? Take a moment.', 0, 'npc_isla_starmane - SAY_PROGRESS_2'), +(-1000355, 'Alright, let\'s do this!', 0, 'npc_isla_starmane - SAY_PROGRESS_3'), +(-1000356, 'Ok, I think I can make it on my own from here. Thank you so much for breaking me out of there!', 0, 'npc_isla_starmane - SAY_PROGRESS_4'), + +(-1000357, 'Belore...', 0, 'npc_lady_sylvanas_windrunner - SAY_LAMENT_END'), +(-1000358, 'kneels down and pick up the amulet.', 2, 'npc_lady_sylvanas_windrunner - EMOTE_LAMENT_END'), + +(-1000359, 'You have my blessing', 0, 'npcs_ashyen_and_keleth - GOSSIP_REWARD_BLESS'), + +(-1000360, 'Is the way clear? Let\'s get out while we can, $N.', 0, 'npc_kayra_longmane - SAY_PROGRESS_1'), +(-1000361, 'Looks like we won\'t get away so easy. Get ready!', 0, 'npc_kayra_longmane - SAY_PROGRESS_2'), +(-1000362, 'Let\'s keep moving. We\'re not safe here!', 0, 'npc_kayra_longmane - SAY_PROGRESS_3'), +(-1000363, 'Look out, $N! Enemies ahead!', 0, 'npc_kayra_longmane - SAY_PROGRESS_4'), +(-1000364, 'We\'re almost to the refuge! Let\'s go.', 0, 'npc_kayra_longmane - SAY_PROGRESS_5'), +(-1000365, 'I can see my fellow druids from here. Thank you, $N. I\'m sure Ysiel will reward you for your actions!', 0, 'npc_kayra_longmane - SAY_PROGRESS_6'); diff --git a/sql/updates/2.4.3_old/957_world_scripts.sql b/sql/updates/2.4.3_old/957_world_scripts.sql new file mode 100644 index 0000000..8cae6b3 --- /dev/null +++ b/sql/updates/2.4.3_old/957_world_scripts.sql @@ -0,0 +1,36 @@ +-- Liquid Fire +UPDATE `gameobject_template` SET `data2`='5',`data11`='1' WHERE `entry` IN ('180125','182533'); + +-- Scripts & Stats +UPDATE `creature_template` SET `ScriptName`='boss_vazruden_the_herald' WHERE `entry` = '17307'; +UPDATE `creature_template` SET `ScriptName`='boss_vazruden',`heroic_entry`='18434' WHERE `entry` = '17537'; +UPDATE `creature_template` SET `ScriptName`='boss_nazan' WHERE `entry` = '17536'; +UPDATE `creature_template` SET `ScriptName`='mob_hellfire_sentry' WHERE `entry` = '17517'; +UPDATE `creature_template` SET `equipment_id`='2183',`mechanic_immune_mask`='805306367' WHERE `entry` = '18434'; + +-- Reinforced Fel Iron Chest +DELETE FROM `gameobject` WHERE `id` IN ('185168','185169'); + +-- Script Texts +DELETE FROM `script_texts` WHERE `entry` BETWEEN '-1543025' AND '-1543017'; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +('-1543017','You have faced many challenges, pity they were all in vain. Soon your people will kneel to my lord!',10292,1,0,'vazruden SAY_INTRO'), +('-1543018','Is there no one left to test me?',10293,1,0,'vazruden SAY_WIPE'), +('-1543019','Your time is running out!',10294,1,0,'vazruden SAY_AGGRO_1'), +('-1543020','You are nothing, I answer a higher call!',10295,1,0,'vazruden SAY_AGGRO_2'), +('-1543021','The Dark Lord laughs at you!',10296,1,0,'vazruden SAY_AGGRO_3'), +('-1543022','It is over. Finished!',10297,1,0,'vazruden SAY_KILL_1'), +('-1543023','Your days are done!',10298,1,0,'vazruden SAY_KILL_2'), +('-1543024','My lord will be the end you all...',10299,1,0,'vazruden SAY_DIE'), +('-1543025','descends from the sky',0,3,0,'vazruden EMOTE'); + +-- Waypoint Movement +DELETE FROM `waypoint_data` WHERE `id` = '2081'; +INSERT INTO `waypoint_data`(`id`,`point`,`position_x`,`position_y`,`position_z`) VALUES +('2081','1','-1412.2','1784','112'), +('2081','2','-1447.9','1760.9','112'), +('2081','3','-1454.2','1729.3','112'), +('2081','4','-1430','1705','112'), +('2081','5','-1393.5','1705.5','112'), +('2081','6','-1369.8','1724.5','112'), +('2081','7','-1377','1760','112'); diff --git a/sql/updates/2.4.3_old/963_world_scripts.sql b/sql/updates/2.4.3_old/963_world_scripts.sql new file mode 100644 index 0000000..32965bb --- /dev/null +++ b/sql/updates/2.4.3_old/963_world_scripts.sql @@ -0,0 +1,21 @@ +UPDATE `creature_template` SET `ScriptName`='mob_illidari_spawn' WHERE `entry` IN (22075,22074,19797); +UPDATE `creature_template` SET `ScriptName`='mob_torloth_the_magnificent' WHERE `entry`='22076'; +UPDATE `creature_template` SET `ScriptName`='npc_lord_illidan_stormrage' WHERE `entry`=22083; +DELETE FROM `creature` WHERE `id`=22083; +INSERT INTO `creature` (id, map, spawnMask, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, DeathState, MovementType) + VALUES (22083, 530, 1, 0, 0, -4635.75, 1386.32, 137.34, 5.72398, 25,0, 0, 9955, 6774, 0, 0); +UPDATE `gameobject_template` SET `ScriptName`='go_crystal_prison' WHERE `entry`=185126; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000374 and -1000366; +INSERT INTO `script_texts` (entry, content_default, type, comment) VALUES +(-1000366, 'So you have defeated the Crimson Sigil. You now seek to challenge my rule? Not even Arthas could defeat me, yet you dare to even harbor such thoughts? Then I say to you, come! Come $N! The Black Temple awaits...', 1, 'Quest: Battle of the crimson watch - END_TEXT'), + +(-1000367, 'At your command, my liege...', 0, 'TorlothAnim - First'), +(-1000368, 'Destroy them, Torloth. Let lose their blood like a river upon this hallowed ground.', 0, 'Quest: Battle of the crimson watch TorlothAnim - Second'), +(-1000369, 'As you desire, Lord Illidan.', 0, 'Quest: Battle of the crimson watch TorlothAnim - Third'), +(-1000370, 'Yes, Lord Illidan, I would sacrifice to you this magnificent physique. On this day you will fall - another victim of Torloth...', 0, 'Quest: Battle of the crimson watch TorlothAnim - Fourth'), + +(-1000371, 'What manner of fool dares stand before Illidan Stormrage? Soldiers, destroy these insects!', 1, 'Quest: Battle of the crimson watch WavesInfo - First'), +(-1000372, 'You are no challenge for the Crimson Sigil. Mind breakers, end this nonsense.', 1, 'Quest: Battle of the crimson watch WavesInfo - Second'), +(-1000373, 'Run while you still can. The highlords come soon...', 1, 'Quest: Battle of the crimson watch WavesInfo - Third'), +(-1000374, 'Torloth your master calls!', 1, 'Quest: Battle of the crimson watch WavesInfo - Fourth'); diff --git a/sql/updates/2.4.3_old/965_world_scripts.sql b/sql/updates/2.4.3_old/965_world_scripts.sql new file mode 100644 index 0000000..9c93f78 --- /dev/null +++ b/sql/updates/2.4.3_old/965_world_scripts.sql @@ -0,0 +1,17 @@ +REPLACE INTO `spell_script_target` VALUES +(33655,0,183350), +(33655,0,183351), +(44374,1,24722), +(31538,1,17895), +(29967,1,16524), +(39887,1,23002), +(31617,1,17899), +(31624,1,17899), +(31625,1,17899), +(34019,1,19422), +(34946,1,20040), +(34946,1,20041), +(21934,1,21934), +(43144,1,23817), +(12613,1,5843), +(9095,1,1200); diff --git a/sql/updates/2.4.3_old/966_world_scripts.sql b/sql/updates/2.4.3_old/966_world_scripts.sql new file mode 100644 index 0000000..757f2cb --- /dev/null +++ b/sql/updates/2.4.3_old/966_world_scripts.sql @@ -0,0 +1,24 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000395 AND -1000375; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000375 ,'I remember well the sting of defeat at the conclusion of the Third War. I have waited far too long for my revenge. Now the shadow of the Legion falls over this world. It is only a matter of time until all of your failed creation... is undone.',11332,1,0,0,'kazzak SAY_INTRO'), +(-1000376,'The Legion will conquer all!',11333,1,0,0,'kazzak SAY_AGGRO1'), +(-1000377,'All mortals will perish!',11334,1,0,0,'kazzak SAY_AGGRO2'), +(-1000378,'All life must be eradicated!',11335,1,0,0,'kazzak SAY_SURPREME1'), +(-1000379,'I\'ll rip the flesh from your bones!',11336,1,0,0,'kazzak SAY_SURPREME2'), +(-1000380,'Kirel Narak!',11337,1,0,0,'kazzak SAY_KILL1'), +(-1000381,'Contemptible wretch!',11338,1,0,0,'kazzak SAY_KILL2'), +(-1000382,'The universe will be remade.',11339,1,0,0,'kazzak SAY_KILL3'), +(-1000383,'The Legion... will never... fall.',11340,1,0,0,'kazzak SAY_DEATH'), +(-1000384,'%s goes into a frenzy!',0,2,0,0,'kazzak EMOTE_FRENZY'), +(-1000385,'Invaders, you dangle upon the precipice of oblivion! The Burning Legion comes and with it comes your end.',0,1,0,0,'kazzak SAY_RAND1'), +(-1000386,'Impudent whelps, you only delay the inevitable. Where one has fallen, ten shall rise. Such is the will of Kazzak...',0,1,0,0,'kazzak SAY_RAND2'), + +(-1000387,'Do not proceed. You will be eliminated!',11344,1,0,0,'doomwalker SAY_AGGRO'), +(-1000388,'Tectonic disruption commencing.',11345,1,0,0,'doomwalker SAY_EARTHQUAKE_1'), +(-1000389,'Magnitude set. Release.',11346,1,0,0,'doomwalker SAY_EARTHQUAKE_2'), +(-1000390,'Trajectory locked.',11347,1,0,0,'doomwalker SAY_OVERRUN_1'), +(-1000391,'Engage maximum speed.',11348,1,0,0,'doomwalker SAY_OVERRUN_2'), +(-1000392,'Threat level zero.',11349,1,0,0,'doomwalker SAY_SLAY_1'), +(-1000393,'Directive accomplished.',11350,1,0,0,'doomwalker SAY_SLAY_2'), +(-1000394,'Target exterminated.',11351,1,0,0,'doomwalker SAY_SLAY_3'), +(-1000395,'System failure in five, f-o-u-r...',11352,1,0,0,'doomwalker SAY_DEATH'); diff --git a/sql/updates/2.4.3_old/970_world_scripts.sql b/sql/updates/2.4.3_old/970_world_scripts.sql new file mode 100644 index 0000000..3394b71 --- /dev/null +++ b/sql/updates/2.4.3_old/970_world_scripts.sql @@ -0,0 +1,8 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000401 AND -1000396; +INSERT INTO `script_texts` (entry, content_default, type, language, comment) VALUES +(-1000396, 'Muahahahaha! You fool! You\'ve released me from my banishment in the interstices between space and time!', 0, 0, 'mobs_nether_drake - SAY_NIHIL_1'), +(-1000397, 'All of Draenor shall quick beneath my feet! I will destroy this world and reshape it in my image!', 0, 0, 'mobs_nether_drake - SAY_NIHIL_2'), +(-1000398, 'Where shall I begin? I cannot bother myself with a worm such as yourself. There is a world to be conquered!', 0, 0, 'mobs_nether_Drake - SAY_NIHIL_3'), +(-1000399, 'No doubt the fools that banished me are long dead. I shall take wing survey my demense. Pray to whatever gods you hold dear that we do not meet again.', 0, 0, 'mobs_nether_drake - SAY_NIHIL_4'), +(-1000400, 'NOOOOooooooo!', 1, 0, 'mobs_nether_drake - SAY_NIHIL_INTERRUPT'), +(-1000401, 'Good $N, you are under the spell\'s influence. I must analyze it quickly, then we can talk.', 0, 7, 'npc_daranelle - SAY_DARANELLE'); diff --git a/sql/updates/2.4.3_old/973_world_scripts.sql b/sql/updates/2.4.3_old/973_world_scripts.sql new file mode 100644 index 0000000..b55409f --- /dev/null +++ b/sql/updates/2.4.3_old/973_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_enraged_spirit' WHERE `entry` IN (21050, 21061, 21060, 21059); diff --git a/sql/updates/2.4.3_old/CMakeLists.txt b/sql/updates/2.4.3_old/CMakeLists.txt new file mode 100644 index 0000000..585813a --- /dev/null +++ b/sql/updates/2.4.3_old/CMakeLists.txt @@ -0,0 +1,3 @@ +FILE(GLOB _SQL_243 *.sql) + +INSTALL(FILES ${_SQL_243} DESTINATION share/trinity/sql/updates/2.4.3_old) \ No newline at end of file diff --git a/sql/updates/3.0.9_old/0000_3.0.9_old.sql b/sql/updates/3.0.9_old/0000_3.0.9_old.sql new file mode 100644 index 0000000..daa56fa --- /dev/null +++ b/sql/updates/3.0.9_old/0000_3.0.9_old.sql @@ -0,0 +1,4328 @@ +-- 805_world_scripts +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533039 AND -1533000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533000,'Ahh... welcome to my parlor.',8788,1,0,'anubrekhan SAY_GREET'), +(-1533001,'Just a little taste...',8785,1,0,'anubrekhan SAY_AGGRO1'), +(-1533002,'There is no way out.',8786,1,0,'anubrekhan SAY_AGGRO2'), +(-1533003,'Yes, Run! It makes the blood pump faster!',8787,1,0,'anubrekhan SAY_AGGRO3'), +(-1533004,'I hear little hearts beating. Yesss... beating faster now. Soon the beating will stop.',8790,1,0,'anubrekhan SAY_TAUNT1'), +(-1533005,'Where to go? What to do? So many choices that all end in pain, end in death.',8791,1,0,'anubrekhan SAY_TAUNT2'), +(-1533006,'Which one shall I eat first? So difficult to choose... the all smell so delicious.',8792,1,0,'anubrekhan SAY_TAUNT3'), +(-1533007,'Closer now... tasty morsels. I\'ve been too long without food. Without blood to drink.',8793,1,0,'anubrekhan SAY_TAUNT4'), +(-1533008,'Shh... it will all be over soon.',8789,1,0,'anubrekhan SAY_SLAY'), +(-1533009,'Your old lives, your mortal desires, mean nothing. You are acolytes of the master now, and you will serve the cause without question! The greatest glory is to die in the master\'s service!',8799,1,0,'faerlina SAY_GREET'), +(-1533010,'Slay them in the master\'s name!',8794,1,0,'faerlina SAY_AGGRO1'), +(-1533011,'You cannot hide from me!',8795,1,0,'faerlina SAY_AGGRO2'), +(-1533012,'Kneel before me, worm!',8796,1,0,'faerlina SAY_AGGRO3'), +(-1533013,'Run while you still can!',8797,1,0,'faerlina SAY_AGGRO4'), +(-1533014,'You have failed!',8800,1,0,'faerlina SAY_SLAY1'), +(-1533015,'Pathetic wretch!',8801,1,0,'faerlina SAY_SLAY2'), +(-1533016,'The master... will avenge me!',8798,1,0,'faerlina SAY_DEATH'), +(-1533017,'Patchwerk want to play!',8909,1,0,'patchwerk SAY_AGGRO1'), +(-1533018,'Kel\'Thuzad make Patchwerk his Avatar of War!',8910,1,0,'patchwerk SAY_AGGRO2'), +(-1533019,'No more play?',8912,1,0,'patchwerk SAY_SLAY'), +(-1533020,'What happened to... Patch...',8911,1,0,'patchwerk SAY_DEATH'), +(-1533021,'goes into a berserker rage!',0,2,0,'patchwerk EMOTE_BERSERK'), +(-1533022,'becomes enraged!',0,2,0,'patchwerk EMOTE_ENRAGE'), +(-1533023,'Stalagg crush you!',8864,1,0,'stalagg SAY_STAL_AGGRO'), +(-1533024,'Stalagg kill!',8866,1,0,'stalagg SAY_STAL_SLAY'), +(-1533025,'Master save me...',8865,1,0,'stalagg SAY_STAL_DEATH'), +(-1533026,'Feed you to master!',8802,1,0,'feugen SAY_FEUG_AGGRO'), +(-1533027,'Feugen make master happy!',8804,1,0,'feugen SAY_FEUG_SLAY'), +(-1533028,'No... more... Feugen...',8803,1,0,'feugen SAY_FEUG_DEATH'), +(-1533029,'You are too late... I... must... OBEY!',8872,1,0,'thaddius SAY_GREET'), +(-1533030,'KILL!',8867,1,0,'thaddius SAY_AGGRO1'), +(-1533031,'EAT YOUR BONES!',8868,1,0,'thaddius SAY_AGGRO2'), +(-1533032,'BREAK YOU!',8869,1,0,'thaddius SAY_AGGRO3'), +(-1533033,'You die now!',8877,1,0,'thaddius SAY_SLAY'), +(-1533034,'Now YOU feel pain!',8871,1,0,'thaddius SAY_ELECT'), +(-1533035,'Thank... you...',8870,1,0,'thaddius SAY_DEATH'), +(-1533036,'Pleeease!',8873,1,0,'thaddius SAY_SCREAM1'), +(-1533037,'Stop, make it stop!',8874,1,0,'thaddius SAY_SCREAM2'), +(-1533038,'Help me! Save me!',8875,1,0,'thaddius SAY_SCREAM3'), +(-1533039,'Please, nooo!',8876,1,0,'thaddius SAY_SCREAM4'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533074 AND -1533040; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533040,'Foolishly you have sought your own demise. Brazenly you have disregarded powers beyond your understanding. You have fought hard to invade the realm of the harvester. Now there is only one way out - to walk the lonely path of the damned.',8807,1,0,'gothik SAY_SPEECH'), +(-1533041,'Death is the only escape.',8806,1,0,'gothik SAY_KILL'), +(-1533042,'I... am... undone!',8805,1,0,'gothik SAY_DEATH'), +(-1533043,'I have waited long enough! Now, you face the harvester of souls!',8808,1,0,'gothik SAY_TELEPORT'), +(-1533044,'Defend youself!',8892,1,0,'blaumeux SAY_BLAU_AGGRO'), +(-1533045,'Come, Zeliek, do not drive them out. Not before we\'ve had our fun.',8896,1,0,'blaumeux SAY_BLAU_TAUNT1'), +(-1533046,'I do hope they stay alive long enough for me to... introduce myself.',8897,1,0,'blaumeux SAY_BLAU_TAUNT2'), +(-1533047,'The first kill goes to me! Anyone care to wager?',8898,1,0,'blaumeux SAY_BLAU_TAUNT3'), +(-1533048,'Your life is mine!',8895,1,0,'blaumeux SAY_BLAU_SPECIAL'), +(-1533049,'Who\'s next?',8894,1,0,'blaumeux SAY_BLAU_SLAY'), +(-1533050,'Tou... che!',8893,1,0,'blaumeux SAY_BLAU_DEATH'), +(-1533051,'Come out and fight, ye wee ninny!',8899,1,0,'korthazz SAY_KORT_AGGRO'), +(-1533052,'To arms, ye roustabouts! We\'ve got company!',8903,1,0,'korthazz SAY_KORT_TAUNT1'), +(-1533053,'I heard about enough of yer sniveling. Shut yer fly trap \'afore I shut it for ye!',8904,1,0,'korthazz SAY_KORT_TAUNT2'), +(-1533054,'I\'m gonna enjoy killin\' these slack-jawed daffodils!',8905,1,0,'korthazz SAY_KORT_TAUNT3'), +(-1533055,'I like my meat extra crispy!',8901,1,0,'korthazz SAY_KORT_SPECIAl'), +(-1533056,'Next time, bring more friends!',8902,1,0,'korthazz SAY_KORT_SLAY'), +(-1533057,'What a bloody waste this is!',8900,1,0,'korthazz SAY_KORT_DEATH'), +(-1533058,'Flee, before it\'s too late!',8913,1,0,'zeliek SAY_ZELI_AGGRO'), +(-1533059,'Invaders, cease this foolish venture at once! Turn away while you still can!',8917,1,0,'zeliek SAY_ZELI_TAUNT1'), +(-1533060,'Perhaps they will come to their senses, and run away as fast as they can!',8918,1,0,'zeliek SAY_ZELI_TAUNT2'), +(-1533061,'Do not continue! Turn back while there\'s still time!',8919,1,0,'zeliek SAY_ZELI_TAUNT3'), +(-1533062,'I- I have no choice but to obey!',8916,1,0,'zeliek SAY_ZELI_SPECIAL'), +(-1533063,'Forgive me!',8915,1,0,'zeliek SAY_ZELI_SLAY'), +(-1533064,'It is... as it should be.',8914,1,0,'zeliek SAY_ZELI_DEATH'), +(-1533065,'You seek death?',14571,1,0,'rivendare_naxx SAY_RIVE_AGGRO1'), +(-1533066,'None shall pass!',14572,1,0,'rivendare_naxx SAY_RIVE_AGGRO2'), +(-1533067,'Be still!',14573,1,0,'rivendare_naxx SAY_RIVE_AGGRO3'), +(-1533068,'You will find no peace in death.',14574,1,0,'rivendare_naxx SAY_RIVE_SLAY1'), +(-1533069,'The master\'s will is done.',14575,1,0,'rivendare_naxx SAY_RIVE_SLAY2'), +(-1533070,'Bow to the might of the scourge!',14576,1,0,'rivendare_naxx SAY_RIVE_SPECIAL'), +(-1533071,'Enough prattling. Let them come! We shall grind their bones to dust.',14577,1,0,'rivendare_naxx SAY_RIVE_TAUNT1'), +(-1533072,'Conserve your anger! Harness your rage! You will all have outlets for your frustration soon enough.',14578,1,0,'rivendare_naxx SAY_RIVE_TAUNT2'), +(-1533073,'Life is meaningless. It is in death that we are truly tested.',14579,1,0,'rivendare_naxx SAY_RIVE_TAUNT3'), +(-1533074,'Death... will not stop me...',14580,1,0,'rivendare_naxx SAY_RIVE_DEATH'); + +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=16062; +UPDATE `creature_template` SET `ScriptName`='boss_rivendare_naxx' WHERE `entry`=30549; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533108 AND -1533075; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533075,'Glory to the master!',8845,1,0,'noth SAY_AGGRO1'), +(-1533076,'Your life is forfeit!',8846,1,0,'noth SAY_AGGRO2'), +(-1533077,'Die, trespasser!',8847,1,0,'noth SAY_AGGRO3'), +(-1533078,'Rise, my soldiers! Rise and fight once more!',8851,1,0,'noth SAY_SUMMON'), +(-1533079,'My task is done!',8849,1,0,'noth SAY_SLAY1'), +(-1533080,'Breathe no more!',8850,1,0,'noth SAY_SLAY2'), +(-1533081,'I will serve the master... in... death!',8848,1,0,'noth SAY_DEATH'), +(-1533082,'takes in a deep breath...',0,2,0,'sapphiron EMOTE_BREATH'), +(-1533083,'enrages!',0,2,0,'sapphiron EMOTE_ENRAGE'), +(-1533084,'Our preparations continue as planned, master.',14467,1,0,'kelthuzad SAY_SAPP_DIALOG1'), +(-1533085,'It is good that you serve me so faithfully. Soon, all will serve the Lich King and in the end, you shall be rewarded...so long as you do not falter.',8881,1,0,'kelthuzad SAY_SAPP_DIALOG2_LICH'), +(-1533086,'I see no complications... Wait... What is this?',14468,1,0,'kelthuzad SAY_SAPP_DIALOG3'), +(-1533087,'Your security measures have failed! See to this interruption immediately!',8882,1,0,'kelthuzad SAY_SAPP_DIALOG4_LICH'), +(-1533088,'Yes, master!',14469,1,0,'kelthuzad SAY_SAPP_DIALOG5'), +(-1533089,'No!!! A curse upon you, interlopers! The armies of the Lich King will hunt you down. You will not escape your fate...',14484,1,0,'kelthuzad SAY_CAT_DIED'), +(-1533090,'Who dares violate the sanctity of my domain? Be warned, all who trespass here are doomed.',14463,1,0,'kelthuzad SAY_TAUNT1'), +(-1533091,'Fools, you think yourselves triumphant? You have only taken one step closer to the abyss! ',14464,1,0,'kelthuzad SAY_TAUNT2'), +(-1533092,'I grow tired of these games. Proceed, and I will banish your souls to oblivion!',14465,1,0,'kelthuzad SAY_TAUNT3'), +(-1533093,'You have no idea what horrors lie ahead. You have seen nothing! The frozen heart of Naxxramas awaits you!',14466,1,0,'kelthuzad SAY_TAUNT4'), +(-1533094,'Pray for mercy!',14475,1,0,'kelthuzad SAY_AGGRO1'), +(-1533095,'Scream your dying breath!',14476,1,0,'kelthuzad SAY_AGGRO2'), +(-1533096,'The end is upon you!',14477,1,0,'kelthuzad SAY_AGGRO3'), +(-1533097,'The dark void awaits you!',14478,1,0,'kelthuzad SAY_SLAY1'), +(-1533098,'',14479,1,0,'kelthuzad SAY_SLAY2'), +(-1533099,'AAAAGHHH!... Do not rejoice... your victory is a hollow one... for I shall return with powers beyond your imagining!',14480,1,0,'kelthuzad SAY_DEATH'), +(-1533100,'Your soul, is bound to me now!',14472,1,0,'kelthuzad SAY_CHAIN1'), +(-1533101,'There will be no escape!',14473,1,0,'kelthuzad SAY_CHAIN2'), +(-1533102,'I will freeze the blood in your veins!',14474,1,0,'kelthuzad SAY_FROST_BLAST'), +(-1533103,'Master! I require aid! ',14470,1,0,'kelthuzad SAY_REQUEST_AID'), +(-1533104,'Very well... warriors of the frozen wastes, rise up! I command you to fight, kill, and die for your master. Let none survive...',0,1,0,'kelthuzad SAY_ANSWER_REQUEST'), +(-1533105,'Minions, servants, soldiers of the cold dark, obey the call of Kel\'Thuzad!',14471,1,0,'kelthuzad SAY_SUMMON_MINIONS'), +(-1533106,'Your petty magics are no challenge to the might of the Scourge! ',14481,1,0,'kelthuzad SAY_SPECIAL1_MANA_DET'), +(-1533107,'Enough! I grow tired of these distractions! ',14483,1,0,'kelthuzad SAY_SPECIAL3_MANA_DET'), +(-1533108,'Fools, you have spread your powers too thin. Be free, my minions!',14482,1,0,'kelthuzad SAY_SPECIAL2_DISPELL'); + +UPDATE `script_texts` SET `sound`=8902 WHERE `entry`=-1533055; +UPDATE `script_texts` SET `sound`=8901 WHERE `entry`=-1533056; + +-- 1028_mangos_7141_01_world_instance_template +ALTER TABLE instance_template ADD maxPlayersHeroic tinyint(3) unsigned NOT NULL default '0' AFTER maxPlayers; +UPDATE instance_template SET maxPlayersHeroic = maxPlayers; +DELETE FROM instance_template WHERE map IN (533,615,616,624); +INSERT INTO instance_template VALUES +(533,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''), +(615,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''), +(616,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''), +(624,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''); + +-- 1028_mangos_7147_01_world_creature_template +UPDATE creature_template + SET family = 0 WHERE entry = 1; + +-- 1028_mangos_7150_01_world_playercreateinfo_spell +DELETE FROM `playercreateinfo_spell` WHERE Spell = 58284; +INSERT INTO `playercreateinfo_spell` VALUES +(1,9,58284,'Chaos Bolt Passive'), +(2,9,58284,'Chaos Bolt Passive'), +(5,9,58284,'Chaos Bolt Passive'), +(7,9,58284,'Chaos Bolt Passive'), +(10,9,58284,'Chaos Bolt Passive'); + +-- 1084_mangos_7168_01_world_command +DELETE FROM `command` WHERE `name` IN ('learn','unlearn'); +INSERT INTO `command` VALUES +('learn',3,'Syntax: .learn #spell [all]\r\n\r\nSelected character learn a spell of id #spell. If \'all\' provided then all ranks learned.'), +('unlearn',3,'Syntax: .unlearn #spell [all]\r\n\r\nUnlearn for selected player a spell #spell. If \'all\' provided then all ranks unlearned.'); + +-- 1094_mangos_7193_01_world_trinity_string +UPDATE trinity_string SET content_default = 'Unit Flags: %u.\nDynamic Flags: %u.\nFaction Template: %u.' WHERE entry = 542; + +-- 1108_mangos_7196_02_world_spell_bonus_data +-- ---------------------------- +-- Table structure for spell_bonus_data +-- ---------------------------- +DROP TABLE IF EXISTS `spell_bonus_data`; +CREATE TABLE `spell_bonus_data` ( + `entry` smallint(5) unsigned NOT NULL, + `direct_bonus` float NOT NULL default '0', + `dot_bonus` float NOT NULL default '0', + `ap_bonus` float NOT NULL default '0', + `comments` varchar(255) default NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO `spell_bonus_data` VALUES +('5185', '1.6104', '0', '0', 'Druid - Healing Touch'), +('33763', '0', '0.09518', '0', 'Druid - Lifebloom'), +('774', '0', '0.37604', '0', 'Druid - Rejuvenation'), +('8936', '0.539', '0.188', '0', 'Druid - Regrowth'), +('18562', '0', '0', '0', 'Druid - Swiftmend'), +('44203', '0.538', '0', '0', 'Druid - Tranquility Triggered'), +('48438', '0', '0.11505', '0', 'Druid - Wild Growth'), +('50464', '0.6611', '0', '0', 'Druid - Nourish'), +('339', '0', '0.1', '0', 'Druid - Entangling Roots'), +('42231', '0.12898', '0', '0', 'Druid - Hurricane Triggered'), +('5570', '0', '0.127', '0', 'Druid - Insect Swarm'), +('8921', '0.1515', '0.13', '0', 'Druid - Moonfire'), +('2912', '1', '0', '0', 'Druid - Starfire'), +('5176', '0.5714', '0', '0', 'Druid - Wrath'), +('30451', '0.7143', '0', '0', 'Mage - Arcane Blast'), +('1449', '0.2128', '0', '0', 'Mage - Arcane Explosion'), +('7268', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 1'), +('7269', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 2'), +('7270', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 3'), +('8419', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 4'), +('8418', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 5'), +('10273', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 6'), +('10274', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 7'), +('25346', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 8'), +('27076', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 9'), +('38700', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 10'), +('38703', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 11'), +('42844', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 12'), +('42845', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 13'), +('1463', '0.8053', '0', '0', 'Mage - Mana Shield'), +('44425', '0.8571', '0', '0', 'Mage - Arcane Barrage'), +('11113', '0.1357', '0', '0', 'Mage - Blast Wave Rank'), +('31661', '0.1357', '0', '0', 'Mage - Dragons Breath'), +('2136', '0.4286', '0', '0', 'Mage - Fire Blast'), +('133', '1', '0', '0', 'Mage - Fire Ball'), +('2120', '0.2357', '0.122', '0', 'Mage - Flamestrike'), +('11366', '1.15', '0.05', '0', 'Mage - Pyroblast'), +('2948', '0.4286', '0', '0', 'Mage - Scorch'), +('44614', '0.8571', '0', '0', 'Frostfire Bolt'), +('44457', '0.4', '0.2', '0', 'Mage - Living Bomb'), +('42208', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 1'), +('42209', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 2'), +('42210', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 3'), +('42211', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 4'), +('42212', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 5'), +('42213', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 6'), +('42198', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 7'), +('42937', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 8'), +('42938', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 9'), +('120', '0.1357', '0', '0', 'Mage - Cone of Cold'), +('122', '0.193', '0', '0', 'Mage - Frost Nova'), +('116', '0.8143', '0', '0', 'Mage - Frost Bolt'), +('11426', '0.8053', '0', '0', 'Mage - Ice Barrier'), +('30455', '0.1429', '0', '0', 'Mage - Ice Lance'), +('19750', '0.4286', '0', '0', 'Paladin - Flash of Light'), +('635', '0.7143', '0', '0', 'Paladin - Holy Light'), +('25912', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 1'), +('25911', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 2'), +('25902', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 3'), +('27176', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 4'), +('33073', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 5'), +('48822', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 6'), +('48823', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 7'), +('25914', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 1'), +('25913', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 2'), +('25903', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 3'), +('27175', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 4'), +('33074', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 5'), +('48820', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 6'), +('48821', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 7'), +('31935', '0.07', '0', '0.07', 'Paladin - Avengers Shiled'), +('26573', '0', '0.04', '0.04', 'Paladin - Consecration'), +('879', '0.15', '0', '0.15', 'Paladin - Exorcism'), +('24275', '0.15', '0', '0.15', 'Paladin - Hammer of Wrath'), +('20925', '0.09', '0', '0.056', 'Paladin - Holy Shield'), +('2812', '0.07', '0', '0.07', 'Paladin - Holy Wrath'), +('31893', '0.25', '0', '0.16', 'Paladin - Seal of Blood Enemy Proc'), +('32221', '0.25', '0', '0.16', 'Paladin - Seal of Blood Self Proc'), +('20424', '0.25', '0', '0.16', 'Paladin - Seal of Command Proc'), +('379', '0', '0', '0', 'Shaman - Earth Shield Triggered'), +('20167', '0.25', '0', '0.16', 'Paladin - Seal of Light Proc'), +('53719', '0.25', '0', '0.16', 'Paladin - Seal of The Martyr Enemy Proc'), +('53718', '0.25', '0', '0.16', 'Paladin - Seal of The Martyr Self Proc'), +('25742', '0.07', '0', '0.039', 'Paladin - Seal of Righteousness Dummy Proc'), +('31803', '0', '0.013', '0.15', 'Paladin - Holy Vengeance'), +('52042', '0.045', '0', '0', 'Shaman - Healing Stream Totem Triggered Heal'), +('32546', '0.8068', '0', '0', 'Priest - Binding Heal'), +('34861', '0.402', '0', '0', 'Priest - Circle of Healing'), +('19236', '0.8068', '0', '0', 'Priest - Desperate Prayer'), +('2061', '0.8068', '0', '0', 'Priest - Flash Heal'), +('2060', '1.6135', '0', '0', 'Priest - Greater Heal'), +('23455', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 1'), +('23458', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 2'), +('23459', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 3'), +('27803', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 4'), +('27804', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 5'), +('27805', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 6'), +('25329', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 7'), +('17', '0.8068', '0', '0', 'Priest - Power Word: Shield'), +('596', '0.8086', '0', '0', 'Priest - Prayer of Healing'), +('33110', '0.8068', '0', '0', 'Priest - Prayer of Mending Heal Proc'), +('139', '1.88', '0', '0', 'Priest - Renew'), +('2944', '0.1849', '0', '0', 'Priest - Devouring Plague'), +('14914', '0.5711', '0.024', '0', 'Priest - Holy Fire'), +('15237', '0.1606', '0', '0', 'Priest - Holy Nova Damage'), +('8129', '0', '0', '0', 'Priest - Mana Burn'), +('8092', '0.4296', '0', '0', 'Priest - Mind Blast'), +('15407', '0.257', '0', '0', 'Priest - Mind Flay'), +('49821', '0.7143', '0', '0', 'Priest - Mind Sear Trigger Rank 1'), +('53022', '0.7143', '0', '0', 'Priest - Mind Sear Trigger Rank 2'), +('34433', '0.65', '0', '0', 'Priest - Shadowfiend'), +('32379', '0.4296', '0', '0', 'Priest - Shadow Word: Death'), +('589', '0', '0.1829', '0', 'Priest - Shadow Word: Pain'), +('585', '0.714', '0', '0', 'Priest - Smite'), +('34914', '0', '0.4', '0', 'Priest - Vampiric Touch'), +('974', '0.4762', '0', '0', 'Shaman - Earth Shield'), +('1064', '1.34', '0', '0', 'Shaman - Chain Heal'), +('331', '1.6106', '0', '0', 'Shaman - Healing Wave'), +('8004', '0.8082', '0', '0', 'Shaman - Lesser Healing Wave'), +('61295', '0.4', '0.18', '0', 'Shaman - Riptide'), +('421', '0.57', '0', '0', 'Shaman - Chain Lightning'), +('8042', '0.3858', '0', '0', 'Shaman - Earth Shock'), +('8443', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 1'), +('8504', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 2'), +('8505', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 3'), +('11310', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 4'), +('11311', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 5'), +('25538', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 6'), +('25539', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 7'), +('61651', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 8'), +('61660', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 9'), +('8050', '0.2142', '0.1', '0', 'Shaman - Flame Shock'), +('8026', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 1'), +('8028', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 2'), +('8029', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 3'), +('10445', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 4'), +('16343', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 5'), +('16344', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 6'), +('25488', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 7'), +('58786', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 8'), +('58787', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 9'), +('58788', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 10'), +('8056', '0.3858', '0', '0', 'Shaman - Frost Shock'), +('8034', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 1'), +('8037', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 2'), +('10458', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 3'), +('16352', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 4'), +('16353', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 5'), +('25501', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 6'), +('58797', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 7'), +('58798', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 8'), +('58799', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 9'), +('51505', '0.5714', '0', '0', 'Shaman - Lava Burst'), +('403', '0.7143', '0', '0', 'Shaman - Lightning Bolt'), +('26364', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 1'), +('26365', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 2'), +('26366', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 3'), +('26367', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 4'), +('26369', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 5'), +('26370', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 6'), +('26363', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 7'), +('26371', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 8'), +('26372', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 9'), +('49278', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 10'), +('49279', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 11'), +('8188', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 1'), +('10582', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 2'), +('10583', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 3'), +('10584', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 4'), +('25551', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 5'), +('58733', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 6'), +('58736', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 7'), +('3606', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 1'), +('6350', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 2'), +('6351', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 3'), +('6352', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 4'), +('10435', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 5'), +('10436', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 6'), +('25530', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 7'), +('58700', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 8'), +('58701', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 9'), +('58702', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 10'), +('980', '0', '0.1', '0', 'Warlock - Curse of Agony'), +('603', '0', '2', '0', 'Warlock - Curse of Doom'), +('172', '0', '0.3', '0', 'Warlock - Corruption'), +('348', '0.2', '0.2', '0', 'Warlock - Immolate'), +('27243', '0.22', '0.25', '0', 'Warlock - Seed of Corruption'), +('18265', '0', '1', '0', 'Warlock - Siphon Life'), +('30108', '0', '0.24', '0', 'Warlock - Unstable Affliction'), +('17962', '0.4286', '0', '0', 'Warlock - Conflagrate'), +('6789', '0.22', '0', '0', 'Warlock - Death Coil'), +('48181', '0.4729', '0', '0', 'Warlock - Haunt'), +('29722', '0.7143', '0', '0', 'Warlock - Incinerate'), +('5676', '0.4286', '0', '0', 'Warlock - Searing Pain'), +('686', '0.8571', '0', '0', 'Warlock - Shadow Bolt'), +('17877', '0.4286', '0', '0', 'Warlock - Shadowburn'), +('30283', '0.195', '0', '0', 'Warlock - Shadowfury'), +('6353', '1.15', '0', '0', 'Warlock - Soul Fire'), +('689', '0', '0.1428', '0', 'Warlock - Drain Life'), +('5138', '0', '0', '0', 'Warlock - Drain Mana'), +('1120', '0', '0.4286', '0', 'Warlock - Drain Soul'), +('755', '0', '0.4485', '0', 'Warlock - Health Funnel'), +('1949', '0', '0.0946', '0', 'Warlock - Hellfire'), +('5857', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 1'), +('11681', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 2'), +('11682', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 3'), +('27214', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 4'), +('47822', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 5'), +('42223', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 1'), +('42224', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 2'), +('42225', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 3'), +('42226', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 4'), +('42218', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 5'), +('47817', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 6'), +('47818', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 7'), +('18220', '0.96', '0', '0', 'Warlock - Dark Pact'), +('6229', '0.3', '0', '0', 'Warlock - Shadow Ward'); + +-- 1108_mangos_7199_01_world_spell_bonus_data +DELETE FROM `spell_bonus_data` WHERE `entry` IN (44614, 139, 49821, 53022, 18265, 31117, 28176); +INSERT INTO `spell_bonus_data` VALUES +('44614', '0.8571', '0', '0', 'Mage - Frostfire Bolt'), +('139', '0', '0.376', '0', 'Priest - Renew'), +('49821', '0.14286', '0', '0', 'Priest - Mind Sear Trigger Rank 1'), +('53022', '0.14286', '0', '0', 'Priest - Mind Sear Trigger Rank 2'), +('18265', '0', '0.1', '0', 'Warlock - Siphon Life'), +('31117', '1.8', '0', '0', 'Warlock - Unstable Affliction Dispell'), +('28176', '0', '0', '0', 'Warlock - Fel Armor'); + +-- 1135_mangos_7207_01_world_creature +ALTER TABLE creature + ADD COLUMN `phaseMask` smallint(5) unsigned NOT NULL default '1' AFTER `spawnMask`; + +-- 1135_mangos_7207_02_world_gameobject +ALTER TABLE gameobject + ADD COLUMN `phaseMask` smallint(5) unsigned NOT NULL default '1' AFTER `spawnMask`; + +-- 1140_mangos_7209_01_world_spell_bonus_data +DELETE FROM `spell_bonus_data` WHERE `entry` IN (53595); +INSERT INTO `spell_bonus_data` VALUES +('53595', '0', '0', '0','Paladin - Hammer of the Righteous'); + +-- 1185_mangos_7214_01_world_command +DELETE FROM `command` WHERE `name` IN ('gps','modify phase','npc phase','gobject phase'); +INSERT INTO `command` VALUES +('gps',1,'Syntax: .gps [$name|$shift-link]\r\n\r\nDisplay the position information for a selected character or creature (also if player name $name provided then for named player, or if creature/gameobject shift-link provided then pointed creature/gameobject if it loaded). Position information includes X, Y, Z, and orientation, map Id and zone Id'), +('modify phase',3,'Syntax: .modify phase #phasemask\r\n\r\nSelected character phasemask changed to #phasemask with related world vision update. Change active until in game phase changed, or GM-mode enable/disable, or re-login. Character pts pasemask update to same value.'), +('npc phase',3,'Syntax: .npc phase #phasemask\r\n\r\nSelected unit or pet phasemask changed to #phasemask with related world vision update for players. In creature case state saved to DB and persistent. In pet case change active until in game phase changed for owner, owner re-login, or GM-mode enable/disable..'), +('gobject phase',3,'Syntax: .gobject phase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'); + +-- 1185_mangos_7214_02_world_trinity_string +DELETE FROM `trinity_string` WHERE entry = 101; +INSERT INTO `trinity_string` VALUES +(101,'Map: %u (%s) Zone: %u (%s) Area: %u (%s) Phase: %u\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 1185_mangos_7214_03_world_spell_proc_event +DROP TABLE IF EXISTS `spell_proc_event`; +CREATE TABLE IF NOT EXISTS `spell_proc_event` ( + `entry` smallint(5) unsigned NOT NULL default '0', + `SchoolMask` tinyint(4) NOT NULL default '0', + `SpellFamilyName` smallint(5) unsigned NOT NULL default '0', + `SpellFamilyMask0` int(10) unsigned NOT NULL default '0', + `SpellFamilyMask1` int(10) unsigned NOT NULL default '0', + `SpellFamilyMask2` int(10) unsigned NOT NULL default '0', + `procFlags` int(10) unsigned NOT NULL default '0', + `procEx` int(10) unsigned NOT NULL default '0', + `ppmRate` float NOT NULL default '0', + `CustomChance` float NOT NULL default '0', + `Cooldown` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(905, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(945, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(974, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(1463, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(3232, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(5952, 0, 8, 1, 1, 0, 0, 0, 0, 0, 0), +(6346, 0, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(7383, 1, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(7434, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(8134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(8178, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(8494, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(8495, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(9452, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(9782, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(9784, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(9799, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(10191, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(10192, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(10193, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(10431, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(10432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(11095, 0, 3, 16, 0, 0, 0, 0, 0, 0, 0), +(11119, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(11120, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(11129, 0, 3, 12582935, 64, 0, 0, 0, 0, 0, 0), +(11180, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0), +(11185, 0, 3, 128, 0, 0, 327680, 0, 0, 0, 0), +(11255, 0, 3, 16384, 0, 0, 0, 0, 0, 0, 0), +(12169, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12281, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12289, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(12298, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12311, 0, 4, 2048, 1, 0, 0, 0, 0, 0, 0), +(12317, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12319, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12322, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(12487, 0, 3, 128, 0, 0, 327680, 0, 0, 0, 0), +(12488, 0, 3, 128, 0, 0, 327680, 0, 0, 0, 0), +(12598, 0, 3, 16384, 0, 0, 0, 0, 0, 0, 0), +(12668, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(12724, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12725, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12726, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12727, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12797, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(12799, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(12812, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12813, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12814, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12815, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12834, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12846, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(12847, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(12848, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(12849, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12867, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12872, 0, 3, 16, 0, 0, 0, 0, 0, 0, 0), +(12873, 0, 3, 16, 0, 0, 0, 0, 0, 0, 0), +(12958, 0, 4, 2048, 1, 0, 0, 0, 0, 0, 0), +(12966, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12967, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12968, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12969, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12970, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12971, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12972, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12973, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12974, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12999, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0), +(13000, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(13001, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0), +(13002, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0), +(13045, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13046, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13047, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13163, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(13165, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(13754, 0, 8, 16, 0, 0, 0, 0, 0, 0, 0), +(13867, 0, 8, 16, 0, 0, 0, 0, 0, 0, 0), +(13983, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0), +(14070, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0), +(14071, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0), +(14156, 0, 8, 4063232, 0, 0, 0, 0, 0, 0, 0), +(14160, 0, 8, 4063232, 0, 0, 0, 0, 0, 0, 0), +(14161, 0, 8, 4063232, 0, 0, 0, 0, 0, 0, 0), +(14186, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14190, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14193, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14194, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14195, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14318, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14319, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14320, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14321, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14322, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14531, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(14774, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(14892, 0, 6, 268443136, 65540, 0, 0, 2, 0, 0, 0), +(15088, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(15128, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(15268, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15277, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(15286, 32, 6, 0, 0, 0, 0, 0, 0, 0, 0), +(15323, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15324, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15325, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15326, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15337, 0, 6, 8192, 2, 0, 0, 2, 0, 0, 0), +(15338, 0, 6, 8192, 2, 0, 0, 2, 0, 0, 0), +(15346, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(15362, 0, 6, 268443136, 65540, 0, 0, 2, 0, 0, 0), +(15363, 0, 6, 268443136, 65540, 0, 0, 2, 0, 0, 0), +(15600, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), +(16164, 0, 11, 2416967875, 0, 0, 0, 2, 0, 0, 0), +(16176, 0, 11, 448, 0, 0, 0, 2, 0, 0, 0), +(16180, 0, 11, 192, 0, 0, 0, 2, 0, 0, 0), +(16196, 0, 11, 192, 0, 0, 0, 2, 0, 0, 0), +(16198, 0, 11, 192, 0, 0, 0, 2, 0, 0, 0), +(16235, 0, 11, 448, 0, 0, 0, 2, 0, 0, 0), +(16240, 0, 11, 448, 0, 0, 0, 2, 0, 0, 0), +(16256, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16257, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16277, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16278, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16279, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16280, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16281, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16282, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16283, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16284, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16487, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16489, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16492, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16550, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(16624, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(16850, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0), +(16864, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(16880, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16923, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0), +(16924, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0), +(16952, 0, 7, 233472, 1024, 0, 0, 2, 0, 0, 0), +(16954, 0, 7, 233472, 1024, 0, 0, 2, 0, 0, 0), +(16958, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16961, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(17106, 0, 7, 524288, 0, 0, 0, 0, 0, 0, 0), +(17107, 0, 7, 524288, 0, 0, 0, 0, 0, 0, 0), +(17108, 0, 7, 524288, 0, 0, 0, 0, 0, 0, 0), +(17364, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17495, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(17793, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17794, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0), +(17796, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17797, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17798, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17799, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17800, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17801, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17802, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17803, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(18073, 0, 5, 96, 128, 0, 0, 0, 0, 0, 0), +(18094, 0, 5, 10, 0, 0, 0, 0, 0, 0, 0), +(18095, 0, 5, 10, 0, 0, 0, 0, 0, 0, 0), +(18096, 0, 5, 96, 128, 0, 0, 0, 0, 0, 0), +(18119, 0, 5, 997, 4288, 0, 0, 0, 0, 0, 0), +(18120, 0, 5, 997, 4288, 0, 0, 0, 0, 0, 0), +(18820, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(19184, 0, 9, 20, 8192, 0, 0, 0, 0, 0, 0), +(19228, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0), +(19232, 0, 9, 64, 0, 0, 0, 0, 0, 0, 0), +(19233, 0, 9, 64, 0, 0, 0, 0, 0, 0, 0), +(19387, 0, 9, 20, 8192, 0, 0, 0, 0, 0, 0), +(19388, 0, 9, 20, 8192, 0, 0, 0, 0, 0, 0), +(19572, 0, 9, 8388608, 0, 0, 16384, 0, 0, 0, 0), +(19573, 0, 9, 8388608, 0, 0, 16384, 0, 0, 0, 0), +(20049, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20056, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20057, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20128, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20131, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20132, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20164, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0), +(20165, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0), +(20166, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0), +(20182, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20210, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20212, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20213, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20214, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20215, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20234, 0, 10, 32768, 0, 0, 0, 0, 0, 0, 0), +(20235, 0, 10, 32768, 0, 0, 0, 0, 0, 0, 0), +(20375, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(20500, 0, 4, 268435456, 0, 0, 0, 0, 0, 0, 0), +(20501, 0, 4, 268435456, 0, 0, 0, 0, 0, 0, 0), +(20705, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20911, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(20925, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20927, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20928, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(21185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(21882, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(21890, 0, 4, 712396527, 876, 0, 0, 0, 0, 0, 0), +(22007, 0, 3, 2097185, 0, 0, 0, 65536, 0, 0, 0), +(22618, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(22648, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(23547, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(23548, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(23551, 0, 11, 192, 0, 0, 0, 0, 0, 0, 0), +(23552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(23572, 0, 11, 192, 0, 0, 0, 0, 0, 0, 0), +(23578, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(23581, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(23602, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(23686, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(23688, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(23689, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0), +(23695, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(23721, 0, 9, 2048, 0, 0, 0, 0, 0, 0, 0), +(23920, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(24353, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(24389, 0, 3, 12582935, 64, 0, 0, 0, 0, 0, 0), +(24398, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(24658, 0, 0, 0, 0, 0, 82192, 0, 0, 0, 0), +(24905, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0), +(24932, 0, 0, 0, 0, 0, 0, 2, 0, 0, 6), +(25050, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(25296, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(25469, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(25472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(25669, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), +(25899, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(25988, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(26016, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(26107, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0), +(26119, 0, 10, 2416967683, 0, 0, 0, 65536, 0, 0, 0), +(26128, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0), +(26135, 0, 10, 8388608, 0, 0, 0, 65536, 0, 0, 0), +(26480, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(26605, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(27044, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(27131, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(27179, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(27419, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27498, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27521, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(27656, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27774, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(27787, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27811, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(27815, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(27816, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(28592, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0), +(28593, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0), +(28716, 0, 7, 16, 0, 0, 294912, 0, 0, 0, 0), +(28719, 0, 7, 32, 0, 0, 0, 2, 0, 0, 0), +(28744, 0, 7, 64, 0, 0, 278528, 0, 0, 0, 0), +(28752, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(28789, 0, 10, 3221225472, 0, 0, 0, 0, 0, 0, 0), +(28802, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(28809, 0, 6, 4096, 0, 0, 0, 2, 0, 0, 0), +(28812, 0, 8, 33554438, 0, 0, 0, 2, 0, 0, 0), +(28816, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(28823, 0, 11, 192, 0, 0, 0, 0, 0, 0, 0), +(28847, 0, 7, 32, 0, 0, 0, 0, 0, 0, 0), +(28849, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(29074, 20, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(29075, 20, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(29076, 20, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(29150, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29179, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(29180, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(29385, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(29441, 0, 0, 0, 0, 0, 0, 8, 0, 0, 1), +(29444, 0, 0, 0, 0, 0, 0, 8, 0, 0, 1), +(29455, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(29501, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29593, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(29594, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(29624, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29625, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29626, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29632, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29633, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29634, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29635, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29636, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29637, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29801, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(29834, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(29838, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(29977, 0, 3, 12582935, 64, 0, 0, 0, 0, 0, 0), +(30003, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(30160, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30293, 0, 5, 897, 192, 0, 0, 0, 0, 0, 0), +(30295, 0, 5, 897, 192, 0, 0, 0, 0, 0, 0), +(30296, 0, 5, 897, 192, 0, 0, 0, 0, 0, 0), +(30299, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30301, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30302, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30675, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30678, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30679, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30680, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30681, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30701, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30705, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30802, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30803, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30804, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30805, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30806, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30807, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30808, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30809, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30810, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30811, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30823, 0, 0, 0, 0, 0, 0, 0, 10.5, 0, 0), +(30881, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30883, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30884, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30885, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30886, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30937, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(31124, 0, 8, 536870926, 0, 0, 0, 0, 0, 0, 0), +(31126, 0, 8, 536870926, 0, 0, 0, 0, 0, 0, 0), +(31244, 0, 8, 4063232, 9, 0, 0, 4, 0, 0, 0), +(31245, 0, 8, 4063232, 9, 0, 0, 4, 0, 0, 0), +(31394, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(31569, 0, 3, 65536, 0, 0, 0, 0, 0, 0, 0), +(31570, 0, 3, 65536, 0, 0, 0, 0, 0, 0, 0), +(31785, 0, 0, 0, 0, 0, 34816, 0, 0, 0, 0), +(31794, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(31801, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0), +(31833, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(31835, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(31836, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(31871, 0, 10, 16, 0, 0, 16384, 0, 0, 0, 0), +(31872, 0, 10, 16, 0, 0, 16384, 0, 0, 0, 0), +(31876, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31877, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31878, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31904, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32385, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32387, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32392, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32393, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32394, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32409, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(32587, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32593, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(32594, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(32642, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32734, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(32748, 0, 8, 0, 1, 0, 320, 0, 0, 0, 0), +(32776, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32777, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32837, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 45), +(32844, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(32885, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33076, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(33089, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(33127, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(33142, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33145, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33146, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33150, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33151, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33154, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33191, 0, 6, 8421376, 1024, 0, 0, 0, 0, 0, 0), +(33192, 0, 6, 8421376, 1024, 0, 0, 0, 0, 0, 0), +(33193, 0, 6, 8421376, 1024, 0, 0, 0, 0, 0, 0), +(33299, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(33510, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0), +(33648, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33719, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(33736, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(33746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(33757, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(33759, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(33776, 0, 0, 0, 0, 0, 34816, 0, 0, 0, 0), +(33881, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33882, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33883, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33953, 0, 0, 0, 0, 0, 16384, 0, 0, 0, 45), +(34080, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0), +(34138, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(34139, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(34258, 0, 10, 1024, 8, 0, 0, 0, 0, 0, 0), +(34262, 0, 10, 8388608, 0, 0, 0, 65536, 0, 0, 0), +(34320, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34355, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(34497, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34498, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34499, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34500, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34502, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34503, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(34586, 0, 0, 0, 0, 0, 0, 0, 1.5, 0, 0), +(34598, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(34749, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0), +(34753, 0, 6, 6144, 4, 0, 0, 2, 0, 0, 0), +(34774, 0, 0, 0, 0, 0, 0, 0, 1.5, 0, 20), +(34783, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(34827, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(34859, 0, 6, 6144, 4, 0, 0, 2, 0, 0, 0), +(34860, 0, 6, 6144, 4, 0, 0, 2, 0, 0, 0), +(34914, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(34916, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(34917, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(34935, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8), +(34938, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8), +(34939, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8), +(34950, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34954, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(35077, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(35080, 0, 0, 0, 0, 0, 0, 0, 1, 0, 60), +(35083, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(35086, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(35100, 0, 9, 12289, 0, 0, 65856, 0, 0, 0, 0), +(35102, 0, 9, 12289, 0, 0, 0, 0, 0, 0, 0), +(35103, 0, 9, 12289, 0, 0, 0, 0, 0, 0, 0), +(35121, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(36096, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(36111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(36541, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(37165, 0, 8, 2098176, 0, 0, 0, 0, 0, 0, 0), +(37168, 0, 8, 4063232, 9, 0, 0, 0, 0, 0, 0), +(37170, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), +(37173, 0, 8, 750519704, 262, 0, 0, 0, 0, 0, 30), +(37189, 0, 10, 3221225472, 0, 0, 0, 2, 0, 0, 60), +(37193, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(37195, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(37197, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 45), +(37213, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(37214, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37227, 0, 11, 448, 0, 0, 0, 2, 0, 0, 60), +(37237, 0, 11, 1, 0, 0, 0, 2, 0, 0, 0), +(37247, 8, 0, 0, 0, 0, 0, 65536, 0, 0, 45), +(37377, 32, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37379, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(37384, 0, 5, 1, 0, 0, 0, 0, 0, 0, 0), +(37443, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(37514, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(37516, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(37519, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0), +(37523, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(37528, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0), +(37536, 0, 4, 65536, 0, 0, 0, 0, 0, 0, 0), +(37568, 0, 6, 2048, 0, 0, 0, 0, 0, 0, 0), +(37594, 0, 6, 4096, 0, 0, 0, 0, 0, 0, 0), +(37600, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37601, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37603, 0, 6, 32768, 0, 0, 0, 0, 0, 0, 0), +(37655, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(37657, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3), +(38026, 1, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(38031, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(38290, 0, 0, 0, 0, 0, 0, 0, 1.6, 0, 0), +(38326, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38327, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38334, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(38347, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38350, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38394, 0, 5, 6, 0, 0, 0, 0, 0, 0, 0), +(38857, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(39027, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(39372, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(39437, 4, 5, 4964, 192, 0, 0, 65536, 0, 0, 0), +(39442, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), +(39443, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(39530, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(39958, 0, 0, 0, 0, 0, 0, 0, 0.7, 0, 40), +(40407, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(40438, 0, 6, 32832, 0, 0, 0, 0, 0, 0, 0), +(40442, 0, 7, 20, 1088, 0, 0, 0, 0, 0, 0), +(40444, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(40458, 0, 4, 33554432, 1537, 0, 0, 0, 0, 0, 0), +(40463, 0, 11, 129, 16, 0, 0, 0, 0, 0, 0), +(40470, 0, 10, 3229614080, 0, 0, 0, 0, 0, 0, 0), +(40475, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(40478, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0), +(40482, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(40485, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(40899, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(41034, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(41260, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(41262, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(41381, 0, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(41393, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(41434, 0, 0, 0, 0, 0, 0, 0, 2, 0, 45), +(41469, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(41635, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(41989, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0), +(42083, 0, 0, 0, 0, 0, 0, 2, 0, 0, 45), +(42135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90), +(42136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90), +(42368, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(42370, 0, 11, 64, 0, 0, 0, 0, 0, 0, 0), +(42770, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(43019, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(43020, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(43338, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(43443, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(43726, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(43728, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(43737, 0, 7, 0, 1088, 0, 0, 0, 0, 0, 10), +(43739, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(43741, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(43745, 0, 10, 0, 512, 0, 0, 0, 0, 0, 0), +(43748, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(43750, 0, 11, 1, 0, 0, 0, 0, 0, 0, 0), +(43819, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(44394, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(44395, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(44396, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(44401, 0, 3, 2097152, 0, 0, 0, 4095, 0, 0, 0), +(44404, 0, 3, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(44442, 0, 3, 8388608, 64, 0, 0, 65536, 0, 0, 1), +(44443, 0, 3, 8388608, 64, 0, 0, 65536, 0, 0, 1), +(44445, 0, 3, 19, 4096, 0, 0, 0, 0, 0, 0), +(44446, 0, 3, 19, 4096, 0, 0, 0, 0, 0, 0), +(44448, 0, 3, 19, 4096, 0, 0, 0, 0, 0, 0), +(44449, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44469, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44470, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44471, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44472, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44546, 0, 3, 33555104, 0, 0, 0, 0, 0, 0, 0), +(44548, 0, 3, 33555104, 0, 0, 0, 0, 0, 0, 0), +(44549, 0, 3, 33555104, 0, 0, 0, 0, 0, 0, 0), +(44835, 0, 7, 0, 128, 0, 16, 0, 0, 0, 0), +(45054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15), +(45057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(45234, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(45243, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(45244, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(45354, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45481, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45482, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45483, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45484, 0, 0, 0, 0, 0, 16384, 0, 0, 0, 45), +(46025, 32, 6, 0, 0, 0, 0, 0, 0, 0, 0), +(46092, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(46098, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(46569, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(46662, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20), +(46832, 0, 7, 1, 0, 0, 0, 65536, 0, 0, 0), +(46854, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(46855, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(46867, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(46913, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46914, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46915, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46916, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46951, 0, 4, 1024, 64, 0, 0, 0, 0, 0, 0), +(46952, 0, 0, 1024, 64, 0, 0, 0, 0, 0, 0), +(46953, 0, 0, 1024, 64, 0, 0, 0, 0, 0, 0), +(47195, 0, 5, 2, 0, 0, 0, 0, 0, 0, 30), +(47196, 0, 5, 2, 0, 0, 0, 0, 0, 0, 30), +(47197, 0, 5, 2, 0, 0, 0, 0, 0, 0, 30), +(47201, 0, 5, 8, 262144, 0, 0, 65536, 0, 0, 0), +(47202, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47203, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47204, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47205, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47232, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47234, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47235, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47245, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(47246, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(47247, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(47258, 0, 5, 0, 8388608, 0, 0, 65536, 0, 0, 0), +(47259, 0, 5, 0, 8388608, 0, 0, 65536, 0, 0, 0), +(47260, 0, 5, 0, 8388608, 0, 0, 65536, 0, 0, 0), +(47263, 32, 5, 0, 0, 0, 0, 2, 0, 0, 20), +(47264, 32, 5, 0, 0, 0, 0, 2, 0, 0, 20), +(47265, 32, 5, 0, 0, 0, 0, 2, 0, 0, 20), +(47509, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47511, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47515, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47516, 0, 6, 6144, 65536, 0, 0, 0, 0, 0, 0), +(47517, 0, 6, 6144, 65536, 0, 0, 0, 0, 0, 0), +(47535, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47536, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47537, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47538, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47539, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47549, 0, 6, 0, 131072, 0, 0, 0, 0, 0, 0), +(47551, 0, 6, 0, 131072, 0, 0, 0, 0, 0, 0), +(47552, 0, 6, 0, 131072, 0, 0, 0, 0, 0, 0), +(47555, 0, 6, 6144, 0, 0, 0, 0, 0, 0, 0), +(47556, 0, 6, 6144, 0, 0, 0, 0, 0, 0, 0), +(47557, 0, 6, 6144, 0, 0, 0, 0, 0, 0, 0), +(47572, 0, 6, 65536, 0, 0, 0, 0, 0, 0, 0), +(47580, 0, 6, 0, 0, 64, 0, 65536, 0, 0, 0), +(47581, 0, 6, 0, 0, 64, 0, 65536, 0, 0, 0), +(47582, 0, 6, 0, 0, 64, 0, 65536, 0, 0, 0), +(48110, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48111, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48112, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48113, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48159, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(48160, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(48483, 0, 7, 34816, 1088, 0, 0, 0, 0, 0, 0), +(48484, 0, 7, 34816, 1088, 0, 0, 0, 0, 0, 0), +(48485, 0, 7, 34816, 1088, 0, 0, 0, 0, 0, 0), +(48496, 0, 7, 96, 33554434, 0, 0, 2, 0, 0, 0), +(48499, 0, 7, 96, 33554434, 0, 0, 2, 0, 0, 0), +(48500, 0, 7, 96, 33554434, 0, 0, 2, 0, 0, 0), +(48506, 0, 7, 5, 0, 0, 0, 0, 0, 0, 0), +(48510, 0, 7, 5, 0, 0, 0, 0, 0, 0, 0), +(48511, 0, 7, 5, 0, 0, 0, 0, 0, 0, 0), +(48516, 0, 7, 5, 0, 0, 0, 2, 0, 0, 30), +(48521, 0, 7, 5, 0, 0, 0, 2, 0, 0, 30), +(48525, 0, 7, 5, 0, 0, 0, 2, 0, 0, 30), +(48833, 0, 7, 0, 1088, 0, 0, 0, 0, 0, 0), +(48835, 0, 10, 0, 8, 0, 0, 0, 0, 0, 0), +(48837, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(48951, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(48952, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(48988, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(49018, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49137, 0, 15, 0, 16384, 0, 0, 0, 0, 0, 0), +(49188, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(49208, 0, 15, 4456448, 0, 0, 0, 0, 0, 0, 0), +(49222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49281, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49283, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49284, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49503, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(49504, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(49529, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49530, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49531, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49532, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49622, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(49657, 0, 15, 0, 16384, 0, 0, 0, 0, 0, 0), +(50781, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51123, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51127, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51128, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51129, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51130, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51349, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51352, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51466, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51470, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51474, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(51478, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(51479, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(51556, 0, 11, 192, 0, 16, 0, 2, 0, 0, 0), +(51557, 0, 11, 192, 0, 16, 0, 2, 0, 0, 0), +(51558, 0, 11, 192, 0, 16, 0, 2, 0, 0, 0), +(51562, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51563, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51564, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51565, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51566, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51625, 0, 8, 268476416, 0, 0, 0, 0, 0, 0, 0), +(51626, 0, 8, 268476416, 0, 0, 0, 0, 0, 0, 0), +(51627, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(51628, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(51629, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(51634, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51635, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51636, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51664, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51665, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51667, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51668, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51669, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51672, 0, 0, 0, 0, 0, 0, 16, 0, 0, 1), +(51674, 0, 0, 0, 0, 0, 0, 16, 0, 0, 1), +(51679, 0, 8, 1, 1, 0, 0, 0, 0, 0, 0), +(51692, 0, 8, 512, 0, 0, 0, 2, 0, 0, 0), +(51696, 0, 8, 512, 0, 0, 0, 2, 0, 0, 0), +(51698, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1), +(51700, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1), +(51701, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1), +(51940, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(51989, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52004, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52005, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52007, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52008, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52020, 0, 7, 32768, 1048576, 0, 0, 0, 0, 0, 0), +(52127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(52423, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(52795, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52797, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52798, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52799, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52800, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52898, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53137, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(53138, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(53215, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(53216, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(53217, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(53221, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(53222, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(53224, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(53228, 0, 9, 32, 16777216, 0, 0, 0, 0, 0, 0), +(53232, 0, 9, 32, 16777216, 0, 0, 0, 0, 0, 0), +(53256, 0, 9, 2048, 8388609, 0, 0, 2, 0, 0, 0), +(53259, 0, 9, 2048, 8388609, 0, 0, 2, 0, 0, 0), +(53260, 0, 9, 2048, 8388609, 0, 0, 2, 0, 0, 0), +(53290, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53291, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53292, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53293, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53294, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53380, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53381, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53382, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53383, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53384, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53486, 0, 10, 8388608, 163840, 0, 0, 2, 0, 0, 0), +(53488, 0, 10, 8388608, 163840, 0, 0, 2, 0, 0, 0), +(53501, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53502, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53503, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53551, 0, 10, 4096, 0, 0, 0, 0, 0, 0, 0), +(53552, 0, 10, 4096, 0, 0, 0, 0, 0, 0, 0), +(53553, 0, 10, 4096, 0, 0, 0, 0, 0, 0, 0), +(53569, 0, 10, 2097152, 0, 0, 0, 2, 0, 0, 0), +(53576, 0, 10, 2097152, 0, 0, 0, 2, 0, 0, 0), +(53601, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(53671, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(53673, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54149, 0, 10, 2097152, 0, 0, 0, 2, 0, 0, 0), +(54151, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54154, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54155, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54278, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(54486, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54488, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54489, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54490, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54738, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(54747, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(54749, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(54754, 0, 7, 16, 0, 0, 0, 0, 0, 0, 0), +(54841, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(54936, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(54937, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(54939, 0, 10, 32768, 0, 0, 0, 0, 0, 0, 0), +(55440, 0, 11, 64, 0, 0, 0, 0, 0, 0, 0), +(55620, 0, 15, 1, 134217728, 0, 0, 0, 0, 0, 0), +(55623, 0, 15, 1, 134217728, 0, 0, 0, 0, 0, 0), +(55666, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55667, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55668, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55669, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55670, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55677, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0), +(55680, 0, 6, 512, 0, 0, 0, 0, 0, 0, 0), +(55689, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56218, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0), +(56333, 0, 9, 4, 0, 512, 0, 0, 0, 0, 0), +(56336, 0, 9, 4, 0, 512, 0, 0, 0, 0, 0), +(56337, 0, 9, 4, 0, 512, 0, 0, 0, 0, 0), +(56342, 0, 9, 16384, 0, 0, 0, 0, 0, 0, 0), +(56343, 0, 9, 16384, 0, 0, 0, 0, 0, 0, 0), +(56344, 0, 9, 16384, 0, 0, 0, 0, 0, 0, 0), +(56364, 0, 3, 0, 16777216, 0, 0, 0, 0, 0, 0), +(56451, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(56611, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56612, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56613, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56614, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56636, 0, 4, 32, 0, 0, 0, 0, 0, 0, 0), +(56637, 0, 4, 32, 0, 0, 0, 0, 0, 0, 0), +(56638, 0, 4, 32, 0, 0, 0, 0, 0, 0, 0), +(56821, 0, 8, 2, 0, 0, 0, 2, 0, 0, 0), +(56822, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(56834, 0, 15, 4456448, 0, 0, 0, 0, 0, 0, 0), +(56835, 0, 15, 4456448, 0, 0, 0, 0, 0, 0, 0), +(57878, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(57880, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(57881, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(57960, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(58357, 0, 4, 64, 0, 0, 0, 2, 0, 0, 0), +(58364, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(58372, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(58386, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(58435, 0, 5, 2, 256, 0, 0, 0, 0, 0, 0), +(58436, 0, 5, 2, 256, 0, 0, 0, 0, 0, 0), +(58437, 0, 5, 2, 256, 0, 0, 0, 0, 0, 0), +(58616, 0, 15, 262144, 0, 0, 0, 0, 0, 0, 0), +(58620, 0, 15, 0, 16384, 0, 0, 0, 0, 0, 0), +(58626, 0, 15, 33554432, 0, 0, 0, 0, 0, 0, 0), +(58631, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(58642, 0, 15, 0, 134217728, 0, 0, 0, 0, 0, 0), +(58644, 0, 15, 0, 4, 0, 0, 0, 0, 0, 0), +(58647, 0, 15, 0, 4, 0, 0, 0, 0, 0, 0), +(58676, 0, 15, 0, 8, 0, 0, 0, 0, 0, 0), +(58677, 0, 15, 8192, 0, 0, 0, 0, 0, 0, 0), +(58872, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(58874, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(58901, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(59057, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(59176, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(59327, 0, 15, 134217728, 0, 0, 0, 0, 0, 0, 0), +(59725, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(60132, 0, 15, 0, 134348800, 0, 0, 0, 0, 0, 0), +(60170, 0, 5, 6, 0, 0, 0, 0, 0, 0, 0), +(60172, 0, 5, 262144, 0, 0, 0, 65536, 0, 0, 0), +(60200, 0, 15, 4096, 0, 0, 0, 65536, 0, 0, 0), +(60493, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(60503, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0), +(60537, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(60564, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60571, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60572, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60573, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60574, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60575, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60617, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(60710, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60717, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60719, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60722, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60724, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60726, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60770, 0, 11, 1, 0, 0, 0, 0, 0, 0, 0), +(60818, 0, 10, 0, 512, 0, 0, 0, 0, 0, 0), +(60826, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(61188, 0, 5, 4, 0, 0, 0, 0, 0, 0, 0), +(61257, 0, 0, 0, 0, 0, 131752, 65536, 0, 0, 0), +(61324, 0, 10, 0, 131072, 0, 0, 0, 0, 0, 0), +(61846, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(61847, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0); + +-- 1206_world_scripts +UPDATE `gameobject_template` SET `ScriptName`='go_legion_obelisk' WHERE `entry` IN (185193,185195,185196,185197,185198); + +-- 1207_world_scripts +UPDATE `creature_template` SET `ScriptName`='npc_surristrasz' WHERE `entry`=24795; +UPDATE `creature_template` SET `ScriptName`='npc_tiare' WHERE `entry`=30051; + +-- 1237_mangos_7230_01_world_spell_bonus_data +DELETE FROM `spell_bonus_data` WHERE `entry` IN (18220,18937,18938,27265,59092); +INSERT INTO `spell_bonus_data` VALUES +('18220', '0.96', '0', '0', 'Warlock - Dark Pact Rank 1'), +('18937', '0.96', '0', '0', 'Warlock - Dark Pact Rank 2'), +('18938', '0.96', '0', '0', 'Warlock - Dark Pact Rank 3'), +('27265', '0.96', '0', '0', 'Warlock - Dark Pact Rank 4'), +('59092', '0.96', '0', '0', 'Warlock - Dark Pact Rank 5'); + +-- 1248_mangos_7235_01_world_command +DELETE FROM `command` WHERE `name` = 'reset achievements'; +INSERT INTO `command` VALUES +('reset achievements',3,'Syntax: .reset achievements [$playername]\r\n\r\nReset achievements data for selected or named (online or offline) character. Achievements for persistance progress data like completed quests/etc re-filled at reset. Achievements for events like kills/casts/etc will lost.'); + +-- 1288_mangos_7242_01_world_spell_bonus_data +DELETE FROM spell_bonus_data WHERE entry IN (34913, 43043, 43044); +INSERT INTO spell_bonus_data VALUES + (34913, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 1'), + (43043, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 2'), + (43044, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 3'); + +-- 1293_mangos_7249_01_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry`='60200'; + +-- 1296_mangos_7252_01_world_command +DELETE FROM `command` WHERE `name` IN ('debug arena','debug bg'); +INSERT INTO `command` VALUES +('debug arena',3,'Syntax: .debug arena\r\n\r\nToggle debug mode for arenas. In debug mode GM can start arena with single player.'), +('debug bg',3,'Syntax: .debug bg\r\n\r\nToggle debug mode for battlegrounds. In debug mode GM can start battleground with single player.'); + +-- 1296_mangos_7252_02_world_trinity_string +DELETE FROM `trinity_string` WHERE entry IN (737,738,739,740,741,742,743,744,745,746); +INSERT INTO `trinity_string` VALUES +(737,'Arenas are set to 1v1 for debugging. So, don\'t join as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(738,'Arenas are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(739,'Battlegrounds are set to 1v0 for debugging.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(740,'Battlegrounds are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(741,'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(742,'Distributing arena points to players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(743,'Finished setting arena points for online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(744,'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(745,'Modification done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(746,'Done flushing Arena points.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 1307_world +UPDATE `creature_template` SET `ScriptName`='npc_stormwind_harbor_taxi' WHERE `entry`=29154; + +-- 1312_world +UPDATE `creature_template` SET `scriptname` = 'boss_keleseth' WHERE `entry` = '23953'; +UPDATE `creature_template` SET `scriptname` = 'mob_frost_tomb' WHERE `entry` = '23965'; +UPDATE `instance_template` SET `script`='instance_utgarde_keep' WHERE `map`= '574'; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1574000, 'Your blood is mine!',13221,1,0,'keleseth SAY_AGGRO'), +(-1574001, 'Darkness waits',13223,1,0, 'keleseth SAY_KILL'), +(-1574002, 'I join... the night.',13225,1,0, 'keleseth SAY_DEATH'), +(-1574003, 'Not so fast.',13222,1,0, 'keleseth SAY_FROST_TOMB'), +(-1574004, 'Aranal, lidel! Their fate shall be yours!',13224,1,0, 'keleseth SAY_SKELETONS'); + +-- 1327_world +ALTER TABLE `creature_template` ADD COLUMN `spell5` mediumint(8) unsigned NOT NULL default '0' AFTER `spell4`; +ALTER TABLE `creature_template` ADD COLUMN `spell6` mediumint(8) unsigned NOT NULL default '0' AFTER `spell5`; +ALTER TABLE `creature_template` ADD COLUMN `spell7` mediumint(8) unsigned NOT NULL default '0' AFTER `spell6`; +ALTER TABLE `creature_template` ADD COLUMN `spell8` mediumint(8) unsigned NOT NULL default '0' AFTER `spell7`; + +-- 1351_world +DROP TABLE IF EXISTS `trinity_string`; +CREATE TABLE IF NOT EXISTS `trinity_string` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `mangos_string` +-- + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(1, 'You should select a character or a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2, 'You should select a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(3, '|cffff0000[System Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(4, '|cffff0000[Event Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5, 'There is no help for that command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6, 'There is no such command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7, 'There is no such subcommand', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(8, 'Command %s have subcommands:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(9, 'Commands available to you:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10, 'Incorrect syntax.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(11, 'Your account level is: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12, 'Online players: %u (max: %u) Queued players: %u (max: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(13, 'Server uptime: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(14, 'Player saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(15, 'All players saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(16, 'There are the following active GMs on this server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(17, 'There are no GMs currently logged in on this server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(18, 'Cannot do that while flying.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(19, 'Cannot do that in Battlegrounds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(20, 'Target is flying you can''t do that.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(21, '%s is flying command failed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(22, 'You are not mounted so you can''t dismount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(23, 'Cannot do that while fighting.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(24, 'You used it recently.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(25, 'Password not changed (unknown error)!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(26, 'The password was changed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(27, 'The new passwords do not match or the old password is wrong', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(28, 'Your account is now locked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(29, 'Your account is now unlocked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(30, ', rank ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(31, ' [known]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(32, ' [learn]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(33, ' [passive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(34, ' [talent]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(35, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(36, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(37, ' (offline)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(38, 'on', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(39, 'off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(40, 'You are: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(41, 'visible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(42, 'invisible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(43, 'done', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(44, 'You', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(45, ' ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(46, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(47, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(48, 'UNKNOWN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(49, 'You must be at least level %u to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(50, 'You must be at least level %u and have item %s to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(51, 'Hello! Ready for some training?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(52, 'Invaid item count (%u) for item %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(53, 'Mail can''t have more %u item stacks', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(54, 'The new passwords do not match', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(55, 'Your password can''t be longer than 16 characters (client limit), password not changed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(56, 'Current Message of the day: \r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(57, 'Using World DB: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(58, 'Using script library: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(100, 'Global notify: ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(101, 'Map: %u (%s) Zone: %u (%s) Area: %u (%s)\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(102, '%s is already being teleported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(103, 'You can summon a player to your instance only if he is in your party with you as leader.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(104, 'You cannot go to the player''s instance because you are in a party now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(105, 'You can go to the player''s instance while not being in his party only if your GM mode is on.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(106, 'You can not go to player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(107, 'You can not summon player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(108, 'You are summoning %s%s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(109, 'You are being summoned by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(110, 'You are teleporting %s%s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(111, 'You are being teleported by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(112, 'Player (%s) does not exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(113, 'Appearing at %s''s location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(114, '%s is appearing to your location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(115, 'Incorrect values.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(116, 'No character selected.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(117, '%s is not in a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(118, 'You changed HP of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(119, '%s changed your HP to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(120, 'You changed MANA of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(121, '%s changed your MANA to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(122, 'You changed ENERGY of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(123, '%s changed your ENERGY to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(124, 'Current energy: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(125, 'You changed rage of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(126, '%s changed your rage to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(127, 'You changed level of %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(128, 'GUID %i, faction is %i, flags is %i, npcflag is %i, DY flag is %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(129, 'Wrong faction: %u (not found in factiontemplate.dbc).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(130, 'You changed GUID=%i ''s Faction to %i, flags to %i, npcflag to %i, dyflag to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(131, 'You changed the spellflatid=%i, val= %i, mark =%i to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(132, '%s changed your spellflatid=%i, val= %i, mark =%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(133, '%s has access to all taxi nodes now (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(134, '%s has no more access to all taxi nodes now (only visited accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(135, '%s has given you access to all taxi nodes (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(136, '%s has removed access to all taxi nodes (only visited still accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(137, 'You set all speeds to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(138, '%s set all your speeds to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(139, 'You set the speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(140, '%s set your speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(141, 'You set the swim speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(142, '%s set your swim speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(143, 'You set the backwards run speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(144, '%s set your backwards run speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(145, 'You set the fly speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(146, '%s set your fly speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(147, 'You set the size %2.2f of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(148, '%s set your size to %2.2f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(149, 'There is no such mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(150, 'You give a mount to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(151, '%s gave you a mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(152, 'USER1: %i, ADD: %i, DIF: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(153, 'You take all copper of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(154, '%s took you all of your copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(155, 'You take %i copper from %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(156, '%s took %i copper from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(157, 'You give %i copper to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(158, '%s gave you %i copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(159, 'You hear sound %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(160, 'USER2: %i, ADD: %i, RESULT: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(161, 'Removed bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(162, 'Set bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(163, 'Teleport location table is empty!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(164, 'Teleport location not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(165, 'Requires search parameter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(166, 'There are no teleport locations matching your request.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(168, 'Locations found are:\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(169, 'Mail sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(170, 'You try to hear sound %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(172, 'server console command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(173, 'You changed runic power of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(174, '%s changed your runic power to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(200, 'No selection.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(201, 'Object GUID is: lowpart %u highpart %X', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(202, 'The name was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(203, 'Error, name can only contain characters A-Z and a-z.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(204, 'The subname was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(205, 'Not yet implemented', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(206, 'Item ''%i'' ''%s'' added to list with maxcount ''%i'' and incrtime ''%i'' and extendedcost ''%i''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(207, 'Item ''%i'' not found in database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(208, 'Item ''%i'' ''%s'' deleted from vendor list', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(209, 'Item ''%i'' not found in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(210, 'Item ''%i'' already in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(211, 'Spells of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(212, 'Spells of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(213, 'Talents of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(214, 'Talents of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(215, 'Your spells have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(216, 'Your talents have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(217, 'Unknown case ''%s'' for .resetall command. Type full correct case name.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(218, 'Spells will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(219, 'Talents will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(220, 'Creature (GUID: %u) No waypoint found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(221, 'Creature (GUID: %u) Last waypoint not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(222, 'Creature (GUID: %u) No waypoint found - used ''wpguid''. Now trying to find it by its position...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(223, 'Creature (GUID: %u) No waypoints found - This is a MaNGOS db problem (single float).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(224, 'Selected creature is ignored - provided GUID is used', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(225, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(226, 'You must select a visual waypoint.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(227, 'No visual waypoints found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(228, 'Could not create visual waypoint with creatureID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(229, 'All visual waypoints removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(230, 'Could not create waypoint-creature with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(231, 'No GUID provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(232, 'No waypoint number provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(233, 'Argument required for ''%s''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(234, 'Waypoint %i added to GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(235, 'Waypoint %d added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(236, 'Waypoint changed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(237, 'Waypoint %s modified.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(238, 'WP export successfull.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(239, 'No waypoints found inside the database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(240, 'File imported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(241, 'Waypoint removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(242, 'Warning: Could not delete WP from the world with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(243, 'This happens if the waypoint is too far away from your char.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(244, 'The WP is deleted from the database, but not from the world here.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(245, 'They will disappear after a server restart.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(246, 'Waypoint %d: Info for creature: %s, GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(247, 'Waittime: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(248, 'Model %d: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(249, 'Emote: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(250, 'Spell: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(251, 'Text%d (ID: %i): %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(252, 'AIScript: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(253, 'Forced rename for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(254, 'Forced rename for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(255, 'Waypoint-Creature (GUID: %u) Not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(256, 'Could not find NPC...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(257, 'Creature movement type set to ''%s'', waypoints removed (if any).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(258, 'Creature movement type set to ''%s'', waypoints were not removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(259, 'Incorrect value, use on or off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(260, 'Value saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(261, 'Value saved, you may need to rejoin or clean your client cache.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(262, 'Areatrigger ID %u not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(263, 'Target map or coordinates is invalid (X: %f Y: %f MapId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(264, 'Zone coordinates is invalid (X: %f Y: %f AreaId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(265, 'Zone %u (%s) is part of instanceable map %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(266, 'Nothing found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(267, 'Object not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(268, 'Creature not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(269, 'Warning: Mob found more than once - you will be teleported to the first one found in DB.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(270, 'Creature Removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(271, 'Creature moved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(272, 'Creature (GUID:%u) must be on the same map as player!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(273, 'Game Object (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(274, 'Game Object (GUID: %u) has references in not found creature %u GO list, can''t be deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(275, 'Game Object (GUID: %u) removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(276, 'Game Object (GUID: %u) turned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(277, 'Game Object (GUID: %u) moved', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(278, 'You must select a vendor', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(279, 'You must send id for item', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(280, 'Vendor has too many items (max 128)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(281, 'You can''t kick self, logout instead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(282, 'Player %s kicked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(283, 'Player %s not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(284, 'Accepting Whisper: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(285, 'Accepting Whisper: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(286, 'Accepting Whisper: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(287, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(288, 'Tickets count: %i show new tickets: %s\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(289, 'New ticket from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(290, 'Ticket of %s (Last updated: %s):\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(291, 'New ticket show: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(292, 'New ticket show: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(293, 'Ticket %i doesn''t exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(294, 'All tickets deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(295, 'Character %s ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(296, 'Ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(297, 'Spawn distance changed to: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(298, 'Spawn time changed to: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(299, 'The honor of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(300, 'Your chat has been disabled for %u minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(301, 'You have disabled %s''s chat for %u minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(302, 'Player''s chat is already enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(303, 'Your chat has been enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(304, 'You have enabled %s''s chat.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(305, 'Faction %s (%u) reputation of %s was set to %5d!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(306, 'The arena points of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(307, 'No faction found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(308, 'Faction %i unknown!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(309, 'Invalid parameter %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(310, 'delta must be between 0 and %d (inclusive)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(311, '%d - |cffffffff|Hfaction:%d|h[%s]|h|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(312, ' [visible]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(313, ' [at war]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(314, ' [peace forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(315, ' [hidden]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(316, ' [invisible forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(317, ' [inactive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(318, 'Hated', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(319, 'Hostile', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(320, 'Unfriendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(321, 'Neutral', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(322, 'Friendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(323, 'Honored', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(324, 'Revered', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(325, 'Exalted', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(326, 'Faction %s (%u) can''not have reputation.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(327, ' [no reputation]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(328, 'Characters at account %s (Id: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(329, ' %s (GUID %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(330, 'No players found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(331, 'Extended item cost %u not exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(332, 'GM mode is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(333, 'GM mode is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(334, 'GM Chat Badge is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(335, 'GM Chat Badge is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(336, 'You repair all %s''s items.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(337, 'All your items repaired by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(338, 'You set waterwalk mode %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(339, 'Your waterwalk mode %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(340, '%s is now following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(341, '%s is not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(342, '%s is now not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(343, 'Creature (Entry: %u) cannot be tamed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(344, 'You already have pet.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(345, 'Forced customize for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(346, 'Forced customize for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(400, '|cffff0000[System Message]:|rScripts reloaded', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(401, 'You change security level of account %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(402, '%s changed your security level to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(403, 'You have low security level for this.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(404, 'Creature movement disabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(405, 'Creature movement enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(406, 'Weather can''t be changed for this zone.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(407, 'Weather system disabled at server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(408, '%s is banned for %s. Reason: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(409, '%s is banned permanently for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(410, '%s %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(411, '%s unbanned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(412, 'There was an error removing the ban on %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(413, 'Account not exist: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(414, 'There is no such character.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(415, 'There is no such IP in banlist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(416, 'Account %s has never been banned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(417, 'Ban history for account %s:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(418, 'Ban Date: %s Bantime: %s Still active: %s Reason: %s Set by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(419, 'Inf.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(420, 'Never', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(421, 'Yes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(422, 'No', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(423, 'IP: %s\nBan Date: %s\nUnban Date: %s\nRemaining: %s\nReason: %s\nSet by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(424, 'There is no matching IPban.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(425, 'There is no matching account.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(426, 'There is no banned account owning a character matching this part.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(427, 'The following IPs match your pattern:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(428, 'The following accounts match your query:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(429, 'You learned many spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(430, 'You learned all spells for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(431, 'You learned all talents for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(432, 'You learned all languages.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(433, 'You learned all craft skills and recipes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(434, 'Could not find ''%s''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(435, 'Invalid item id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(436, 'No items found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(437, 'Invalid gameobject id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(438, 'Found items %u: %u ( inventory %u mail %u auction %u guild %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(439, 'Found gameobjects %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(440, 'Invalid creature id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(441, 'Found creatures %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(442, 'No area found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(443, 'No item sets found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(444, 'No skills found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(445, 'No spells found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(446, 'No quests found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(447, 'No creatures found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(448, 'No gameobjects found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(449, 'Graveyard #%u doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(450, 'Graveyard #%u already linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(451, 'Graveyard #%u linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(452, 'Graveyard #%u can''t be linked to subzone or not existed zone #%u (internal error).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(454, 'No faction in Graveyard with id= #%u , fix your DB', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(455, 'invalid team, please fix database', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(456, 'any', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(457, 'alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(458, 'horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(459, 'Graveyard #%u (faction: %s) is nearest from linked to zone #%u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(460, 'Zone #%u doesn''t have linked graveyards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(461, 'Zone #%u doesn''t have linked graveyards for faction: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(462, 'Teleport location already exists!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(463, 'Teleport location added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(464, 'Teleport location NOT added: database error.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(465, 'Teleport location deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(467, 'Target unit has %d auras:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(468, 'id: %d eff: %d type: %d duration: %d maxduration: %d name: %s%s%s caster: %s %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(469, 'Target unit has %d auras of type %d:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(470, 'id: %d eff: %d name: %s%s%s caster: %s %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(471, 'Quest %u not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(472, 'Quest %u started from item. For correct work, please, add item to inventory and start quest in normal way: .additem %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(473, 'Quest removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(474, ' [rewarded]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(475, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(476, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(477, '%s''s Fly Mode %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(478, 'Opcode %u sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(479, 'Character loaded successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(480, 'Failed to load the character!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(481, 'Character dumped successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(482, 'Character dump failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(483, 'Spell %u broken and not allowed to cast or learn!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(484, 'Skill %u (%s) for player %s set to %u and current maximum set to %u (without permanent (talent) bonuses).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(485, 'Player %s must have skill %u (%s) before using this command.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(486, 'Invalid skill id (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(487, 'You learned default GM spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(488, 'You already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(489, 'Target(%s) already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(490, '%s doesn''t know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(491, 'You already forgot that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(492, 'All spell cooldowns removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(493, 'Spell %u cooldown removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(494, 'Command : Additem, itemId = %i, amount = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(495, 'Command : Additemset, itemsetId = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(496, 'Removed itemID = %i, amount = %i from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(497, 'Cannot create item ''%i'' (amount: %i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(498, 'You need to provide a guild name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(499, 'Player not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(500, 'Player already has a guild!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(501, 'Guild not created! (already exists?)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(502, 'No items from itemset ''%u'' found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(503, 'The distance is: (3D) %f (2D) %f yards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(504, 'Item ''%i'' ''%s'' Item Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(505, 'Item ''%i'' doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(506, 'Item ''%i'' ''%s'' Added to Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(507, 'Item save failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(508, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(509, '%d - sender: %s (guid: %u account: %u ) receiver: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(510, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(511, 'Wrong link type!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(512, '%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(513, '%d - |cffffffff|Hquest:%d|h[%s]|h|r %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(514, '%d - |cffffffff|Hcreature_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(515, '%d - |cffffffff|Hcreature:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(516, '%d - |cffffffff|Hgameobject_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(517, '%d - |cffffffff|Hgameobject:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(518, '%d - |cffffffff|Hitemset:%d|h[%s %s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(519, '|cffffffff|Htele:%s|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(520, '%d - |cffffffff|Hspell:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(521, '%d - |cffffffff|Hskill:%d|h[%s %s]|h|r %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(522, 'Game Object (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(523, '>> Game Object %s (GUID: %u) at %f %f %f. Orientation %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(524, 'Selected object:\n|cffffffff|Hitemset:%d|h[%s]|h|r\nGUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(525, '>> Add Game Object ''%i'' (%s) (GUID: %i) added at ''%f %f %f''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(526, '%s (lowguid: %u) movement generators stack:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(527, ' Idle', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(528, ' Random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(529, ' Waypoint', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(530, ' Animal random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(531, ' Confused', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(532, ' Targeted to player %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(533, ' Targeted to creature %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(534, ' Targeted to ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(535, ' Home movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(536, ' Home movement used for player?!?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(537, ' Taxi flight', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(538, ' Unknown movement generator (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(539, 'Player selected NPC\nGUID: %u.\nFaction: %u.\nnpcFlags: %u.\nEntry: %u.\nDisplayID: %u (Native: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(540, 'Level: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(541, 'Health (base): %u. (max): %u. (current): %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(542, 'Field Flags: %u.\nDynamic Flags: %u.\nFaction Template: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(543, 'Loot: %u Pickpocket: %u Skinning: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(544, 'Position: %f %f %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(545, '*** Is a vendor!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(546, '*** Is a trainer!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(547, 'InstanceID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(548, 'Player%s %s (guid: %u) Account: %s (id: %u) GMLevel: %u Last IP: %s Last login: %s Latency: %ums', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(549, 'Played time: %s Level: %u Money: %ug%us%uc', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(550, 'Command .pinfo doesn''t support ''rep'' option for offline players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(551, '%s has explored all zones now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(552, '%s has no more explored zones.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(553, '%s has explored all zones for you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(554, '%s has hidden all zones from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(555, 'Hover enabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(556, 'Hover disabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(557, 'You have been leveled up (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(558, 'You have been leveled down (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(559, 'Your level progress has been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(560, 'The area has been set as explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(561, 'The area has been set as not explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(562, 'GUID=%i ''s updateIndex: %i, value: %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(563, 'You change GUID=%i ''s UpdateIndex: %i value to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(564, 'The value index %u is too big to %u(count: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(565, 'Set %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(566, 'You Set %u Field:%u to uint32 Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(567, 'Set %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(568, 'You Set %u Field:%i to float Value: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(569, 'Get %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(570, 'The uint32 value of %u in %u is: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(571, 'Get %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(572, 'The float of %u value in %u is: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(573, '.Set32Bit:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(574, 'You set Bit of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(575, '.Mod32Value:[OPCODE]:%u [VALUE]:%i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(576, 'You modified the value of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(577, 'You are now invisible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(578, 'You are now visible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(579, 'Selected player or creature not have victim.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(580, 'Player %s learned all default spells for race/class and completed quests rewarded spells.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(581, 'Found near gameobjects (distance %f): %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(582, 'SpawnTime: Full:%s Remain:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(583, '%d - |cffffffff|Hgameevent:%d|h[%s]|h|r%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(584, 'No event found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(585, 'Event not exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(586, 'Event %u: %s%s\nStart: %s End: %s Occurence: %s Length: %s\nNext state change: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(587, 'Event %u already active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(588, 'Event %u not active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(589, ' Point movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(590, ' Fear movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(591, ' Distract movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(592, 'You have learned all spells in craft: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(593, 'Currently Banned Accounts:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(594, '| Account | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(595, 'Currently Banned IPs:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(596, '| IP | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(597, 'Current gamemasters:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(598, '| Account | GM |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(599, 'No gamemasters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(600, 'The Alliance wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(601, 'The Horde wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(602, 'The battle for Warsong Gulch begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(603, 'The battle for Warsong Gulch begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(604, 'Let the battle for Warsong Gulch begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(605, '$n captured the Horde flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(606, '$n captured the Alliance flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(607, 'The Horde flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(608, 'The Alliance Flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(609, 'The Alliance Flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(610, 'The Horde flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(611, 'The Horde flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(612, 'The Alliance Flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(613, 'The flags are now placed at their bases.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(614, 'The Alliance flag has been respawned!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(615, 'The Horde flag has been respawned!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(636, 'The Battle for Eye of the Storm begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(637, 'The Battle for Eye of the Storm begins in 30 seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(638, 'The Battle for Eye of the Storm has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(650, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(651, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(652, 'stables', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(653, 'blacksmith', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(654, 'farm', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(655, 'lumber mill', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(656, 'mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(657, 'The %s has taken the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(658, '$n has defended the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(659, '$n has assaulted the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(660, '$n claims the %s! If left unchallenged, the %s will control it in 1 minute!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(661, 'The Battle for Arathi Basin begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(662, 'The Battle for Arathi Basin begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(663, 'The Battle for Arathi Basin has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(664, 'The Alliance has gathered $1776W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(665, 'The Horde has gathered $1777W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(666, 'After your recent battle in %s our best attempts to award you a Mark of Honor failed. Enclosed you will find the Mark of Honor we were not able to deliver to you at the time. Thanks for fighting in %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(667, 'The Alliance has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(668, 'The Horde has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(669, 'The Alliance has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(670, 'The Horde has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(671, 'The Alliance has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(672, 'The Horde has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(673, 'The Alliance has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(674, 'The Horde has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(675, 'The Alliance has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(676, 'The Horde has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(677, 'The Alliance has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(678, 'The Horde has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(679, 'The Alliance has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(680, 'The Horde has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(681, 'The Alliance has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(682, 'The Horde has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(683, '$N has taken the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(684, 'The Alliance has captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(685, 'The Horde has captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(686, 'The Flag has been dropped!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(687, 'The flag has been reset', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(700, 'You must be level %u to form an arena team', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(701, 'One minute until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(702, 'Thirty seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(703, 'Fifteen seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(704, 'The Arena battle has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(705, 'You must wait %s before speaking again.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(706, 'This item(s) have problems with equipping/storing in inventory.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(707, '%s wishes to not be disturbed and cannot receive whisper messages: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(708, '%s is Away from Keyboard: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(709, 'Do not Disturb', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(710, 'Away from Keyboard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(711, 'Queue status for %s (Lvl: %u to %u)\nQueued alliances: %u (Need at least %u more)\nQueued hordes: %u (Need at least %u more)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(712, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] A: %u/%u, H: %u/%u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(713, 'You must be level %u to join an arena team!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(715, 'You don''t meet Battleground level requirements', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(717, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] Started!|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(718, '|cffff0000[Arena Queue Announcer]:|r %s -- Joined : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(719, '|cffff0000[Arena Queue Announcer]:|r %s -- Exited : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(720, 'Your group is too large for this battleground. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(721, 'Your group is too large for this arena. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(722, 'Your group has members not in your arena team. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(723, 'Your group does not have enough players to join this match.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(724, 'The Gold Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(725, 'The Green Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(726, 'There aren''t enough players in this battleground. It will end soon unless some more players join to balance the fight.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(727, 'Your group has an offline member. Please remove him before joining.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(728, 'Your group has players from the opposing faction. You can''t join the battleground as a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(729, 'Your group has players from different battleground brakets. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(730, 'Someone in your party is already in this battleground queue. (S)he must leave it before joining as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(731, 'Someone in your party is Deserter. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(732, 'Someone in your party is already in three battleground queues. You cannot join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(733, 'You cannot teleport to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(734, 'You cannot summon players to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(735, 'You must be in GM mode to teleport to a player in a battleground.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(736, 'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(737, 'Arenas are set to 1v1 for debugging. So, don''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(738, 'Arenas are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(739, 'Battlegrounds are set to 1v0 for debugging.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(740, 'Battlegrounds are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(741, 'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(742, 'Distributing arena points to players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(743, 'Finished setting arena points for online players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(744, 'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(745, 'Modification done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(746, 'Done flushing Arena points.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(785, 'Arena testing turned %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(786, '|cffff0000[Automatic]:|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(787, '|cffffff00[|c1f40af20Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(800, 'Invalid name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(801, 'You do not have enough gold', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(802, 'You do not have enough free slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(803, 'Your partner does not have enough free bag slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(804, 'You do not have permission to perform that function', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(805, 'Unknown language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(806, 'You don''t know that language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(807, 'Please provide character name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(808, 'Player %s not found or offline', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(809, 'Account for character %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1000, 'Exiting daemon...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1001, 'Account deleted: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1002, 'Account %s NOT deleted (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1003, 'Account %s NOT deleted (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1004, 'Account created: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1005, 'Account name can''t be longer than 16 characters (client limit), account not created!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1006, 'Account with this name already exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1007, 'Account %s NOT created (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1008, 'Account %s NOT created (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1009, 'Player %s (Guid: %u) Account %s (Id: %u) deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1010, '| Account | Character | IP | GM | TBC |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1011, '| | %20s | |||', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1100, 'Account %s (Id: %u) have up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1101, 'Message of the day changed to:\r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1102, 'Message sent to %s: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1103, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1104, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1105, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1106, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1107, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1108, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1109, '%d - %s %s %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1110, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1111, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1112, 'Failed to open file: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1113, 'Account %s (%u) have max amount allowed characters (client limit)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1114, 'Dump file have broken data!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1115, 'Invalid character name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1116, 'Invalid character guid!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1117, 'Character guid %u in use!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1118, '%d - guild: %s (guid: %u) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1119, 'You must use male or female as gender.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1120, 'You change gender of %s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1121, 'Your gender changed to %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1122, '(%u/%u +perm %u +temp %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + +(1200,'Alliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1201,'Horde',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1202,'%s was destroyed by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1203,'The %s is under attack! If left unchecked, the %s will destroy it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1204,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1205,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1206,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1207,'The %s is under attack! If left unchecked, the %s will capture it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1208,'The %s has taken the %s! Its supplies will now be used for reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1209,'Irondeep Mine',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1210,'Coldtooth Mine',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1211,'Stormpike Aid Station',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1212,'Dun Baldar South Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1213,'Dun Baldar North Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1214,'Stormpike Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1215,'Icewing Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1216,'Stonehearth Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1217,'Stonehearth Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1218,'Snowfall Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1219,'Iceblood Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1220,'Iceblood Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1221,'Tower Point',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1222,'Frostwolf Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1223,'East Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1224,'West Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1225,'Frostwolf Relief Hut',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1226,'The Battle for Alterac Valley begins in 1 minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1227,'The Battle for Alterac Valley begins in 30 seconds. Prepare yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1228,'The Battle for Alterac Valley has begun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1229,'The Alliance Team is running out of reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1230,'The Horde Team is running out of reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1231,'The Frostwolf General is Dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1232,'The Stormpike General is Dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(2000, '|cff00ff00New ticket from|r|cffff00ff %s.|r |cff00ff00Ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2001, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00edited his/her ticket:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2002, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00abandoned ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2003, '|cff00ff00Closed by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2004, '|cff00ff00Deleted by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2005, 'Ticket not found.', '', '', '', '', '', '', '', ''), +(2006, 'Please close ticket before deleting it permanently.', '', '', '', '', '', '', '', ''), +(2007, 'Ticket %d is already assigned.', '', '', '', '', '', '', '', ''), +(2008, '%u Tickets succesfully reloaded from the database.', '', '', '', '', '', '', '', ''), +(2009, 'Showing list of open tickets.', '', '', '', '', '', '', '', ''), +(2010, 'Showing list of open tickets whose creator is online.', '', '', '', '', '', '', '', ''), +(2011, 'Showing list of closed tickets.', '', '', '', '', '', '', '', ''), +(2012, 'Invalid name specified. Name should be that of an online Gamemaster.', '', '', '', '', '', '', '', ''), +(2013, 'This ticket is already assigned to yourself. To unassign use .ticket unassign %d and then reassign.', '', '', '', '', '', '', '', ''), +(2014, 'Ticket %d is not assigned, you cannot unassign it.', '', '', '', '', '', '', '', ''), +(2015, 'You cannot unassign tickets from staffmembers with a higher security level than yourself.', '', '', '', '', '', '', '', ''), +(2016, 'Cannot close ticket %d, it is assigned to another GM.', '', '', '', '', '', '', '', ''), +(2017, '|cff00ff00Ticket|r:|cff00ccff %d.|r ', '', '', '', '', '', '', '', ''), +(2018, '|cff00ff00Created by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2019, '|cff00ff00Last change|r:|cff00ccff %s ago|r ', '', '', '', '', '', '', '', ''), +(2020, '|cff00ff00Assigned to|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2021, '|cff00ff00Unassigned by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2022, '\n|cff00ff00Message|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), +(2023, '\n|cff00ff00Comment|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), +(2024, '\n|cff00ccff%s|r |cff00ff00Added comment|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), + +(5000, 'You froze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5001, 'It might be amusing but no... you cant freeze yourself!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5002, 'Invalid input check the name of target.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5003, 'You unfroze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5004, 'There are no frozen players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5005, 'Following players are frozen on the server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5006, '- %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5009, 'Sound %u Played to server', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + +(6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + +(10001, 'The Horde has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10002, 'The Alliance has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10003, 'The Horde has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10004, 'The Alliance has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10005, 'The Horde has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10006, 'The Alliance has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10007, 'The Horde lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10008, 'The Alliance lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10009, 'The Horde lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10010, 'The Alliance lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10011, 'The Horde lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10012, 'The Alliance lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10013, 'The Horde has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10014, 'The Alliance has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10015, 'The Horde has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10016, 'The Alliance has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10017, 'The Horde has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10018, 'The Alliance has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10019, 'The Horde lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10020, 'The Alliance lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10021, 'The Horde lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10022, 'The Alliance lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10023, 'The Horde lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10024, 'The Alliance lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10025, 'The Horde has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10026, 'The Alliance has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10027, 'The Horde lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10028, 'The Alliance lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10029, 'The Horde has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10030, 'The Alliance has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10031, 'The Horde lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10032, 'The Alliance lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10033, 'The Horde has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10034, 'The Alliance has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10035, 'The Horde has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10036, 'The Alliance has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10037, 'The Horde has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10038, 'The Alliance has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10039, 'The Horde has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10040, 'The Alliance has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10041, 'The Horde lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10042, 'The Alliance lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10043, 'The Horde lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10044, 'The Alliance lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10045, 'The Horde lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10046, 'The Alliance lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10047, 'The Horde lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10048, 'The Alliance lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10049, 'The Horde has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10050, 'The Alliance has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10051, 'Take me to Northpass Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10052, 'Take me to Eastwall Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10053, 'Take me to Crown Guard Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10054, 'Give me the flag, I''ll take it to the central beacon for the glory of the Alliance!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10055, 'Give me the flag, I''ll take it to the central beacon for the glory of the Horde!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10056, 'You must be a member of the Horde to enter the Hall of Legends.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10057, 'You must be a member of the Alliance to enter the Champion''s Hall.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- 1414_world_scripts +-- r847_scriptdev2_script_texts.sql +UPDATE `script_texts` SET emote=15 WHERE `entry`=-1000123; +UPDATE `script_texts` SET emote=1 WHERE `entry`=-1560028; +UPDATE `script_texts` SET emote=1 WHERE `entry`=-1560031; +UPDATE `script_texts` SET emote=5 WHERE `entry`=-1560032; +UPDATE `script_texts` SET emote=16 WHERE `entry`=-1000119; +UPDATE `script_texts` SET emote=254 WHERE `entry`=-1249002; +UPDATE `script_texts` SET emote=293 WHERE `entry`=-1249003; +UPDATE `script_texts` SET emote=1 WHERE `entry`=-1033000; +-- r848_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1540047 AND -1540042; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1540042,'Ours is the true Horde! The only Horde!',10323,1,0,0,'kargath SAY_AGGRO1'), +(-1540043,'I\'ll carve the meat from your bones!',10324,1,0,0,'kargath SAY_AGGRO2'), +(-1540044,'I am called Bladefist for a reason, as you will see!',10325,1,0,0,'kargath SAY_AGGRO3'), +(-1540045,'For the real Horde!',10326,1,0,0,'kargath SAY_SLAY1'), +(-1540046,'I am the only Warchief!',10327,1,0,0,'kargath SAY_SLAY2'), +(-1540047,'The true Horde... will.. prevail...',10328,1,0,0,'kargath SAY_DEATH'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533118 AND -1533109; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1533109,'You are mine now!',8825,1,0,0,'heigan SAY_AGGRO1'), +(-1533110,'I see you!',8826,1,0,0,'heigan SAY_AGGRO2'), +(-1533111,'You...are next!',8827,1,0,0,'heigan SAY_AGGRO3'), +(-1533112,'Close your eyes... sleep!',8829,1,0,0,'heigan SAY_SLAY'), +(-1533113,'The races of the world will perish. It is only a matter of time.',8830,1,0,0,'heigan SAY_TAUNT1'), +(-1533114,'I see endless suffering, I see torment, I see rage. I see... everything!',8831,1,0,0,'heigan SAY_TAUNT2'), +(-1533115,'Soon... the world will tremble!',8832,1,0,0,'heigan SAY_TAUNT3'), +(-1533116,'The end is upon you.',8833,1,0,0,'heigan SAY_TAUNT4'), +(-1533117,'Hungry worms will feast on your rotten flesh!',8834,1,0,0,'heigan SAY_TAUNT5'), +(-1533118,'Noo... o...',8828,1,0,0,'heigan SAY_DEATH'); +-- r849_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry`=-1070000; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1070000,'None may steal the secrets of the makers!',5851,1,0,0,'ironaya SAY_AGGRO'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1129004 AND -1129000; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1129000,'You\'ll never leave this place... alive.',5825,1,0,0,'amnennar SAY_AGGRO'), +(-1129001,'To me, my servants!',5828,1,0,0,'amnennar SAY_SUMMON60'), +(-1129002,'Come, spirits, attend your master!',5829,1,0,0,'amnennar SAY_SUMMON30'), +(-1129003,'I am the hand of the Lich King!',5827,1,0,0,'amnennar SAY_HP'), +(-1129004,'Too...easy!',5826,1,0,0,'amnennar SAY_KILL'); +DELETE FROM `script_texts` WHERE `entry` IN (-1230002,-1230001); +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1230001,'Come to aid the Throne!',0,1,0,0,'dagran SAY_AGGRO'), +(-1230002,'Hail to the king, baby!',0,1,0,0,'dagran SAY_SLAY'); +-- r852_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1189021 AND -1189011; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1189011,'Tell me... tell me everything!',5847,1,0,0,'vishas SAY_AGGRO'), +(-1189012,'Naughty secrets!',5849,1,0,0,'vishas SAY_HEALTH1'), +(-1189013,'I\'ll rip the secrets from your flesh!',5850,1,0,0,'vishas SAY_HEALTH2'), +(-1189014,'Purged by pain!',5848,1,0,0,'vishas SAY_KILL'), +(-1189015,'The monster got what he deserved.',0,0,1,0,'vishas SAY_TRIGGER_VORREL'), +(-1189016,'We hunger for vengeance.',5844,1,0,0,'thalnos SAY_AGGRO'), +(-1189017,'No rest, for the angry dead.',5846,1,0,0,'thalnos SAY_HEALTH'), +(-1189018,'More... More souls.',5845,1,0,0,'thalnos SAY_KILL'), +(-1189019,'You will not defile these mysteries!',5842,1,0,0,'doan SAY_AGGRO'), +(-1189020,'Burn in righteous fire!',5843,1,0,0,'doan SAY_SPECIALAE'), +(-1189021,'Release the hounds!',5841,1,0,0,'loksey SAY_AGGRO'); +-- r854_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1070006 AND -1070001; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1070001,'Taste blade, mongrel!',0,0,0,0,'SAY_GUARD_SIL_AGGRO1'), +(-1070002,'Please tell me that you didn\'t just do what I think you just did. Please tell me that I\'m not going to have to hurt you...',0,0,0,0,'SAY_GUARD_SIL_AGGRO2'), +(-1070003,'As if we don\'t have enough problems, you go and create more!',0,0,0,0,'SAY_GUARD_SIL_AGGRO3'), +(-1070004,'looks up at you quizzically. Maybe you should inspect it?',0,2,0,0,'cluck EMOTE_A_HELLO'), +(-1070005,'looks at you unexpectadly.',0,2,0,0,'cluck EMOTE_H_HELLO'), +(-1070006,'starts pecking at the feed.',0,2,0,0,'cluck EMOTE_CLUCK_TEXT2'); +-- r855_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` IN (-1000004,-1000001); +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000001,'goes into a killing frenzy!',0,2,0,0,'EMOTE_GENERIC_FRENZY_KILL'), +(-1000004,'goes into a berserker rage!',0,2,0,0,'EMOTE_GENERIC_BERSERK'); +DELETE FROM `script_texts` WHERE `entry` = -1000005; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000005,'Greetings citizen',0,0,7,0,'general_marcus SAY_GREETING'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1329003 AND -1329000; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1329000,'Thanks to Egan',0,0,0,0,'freed_soul SAY_ZAPPED0'), +(-1329001,'Rivendare must die',0,0,0,0,'freed_soul SAY_ZAPPED1'), +(-1329002,'Who you gonna call?',0,0,0,0,'freed_soul SAY_ZAPPED2'), +(-1329003,'Don\'t cross those beams!',0,0,0,0,'freed_soul SAY_ZAPPED3'); +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1999925 AND -1999900; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1999900,'Let the games begin.',8280,1,0,0,'example_creature SAY_AGGRO'), +(-1999901,'I see endless suffering. I see torment. I see rage. I see everything.',8831,1,0,0,'example_creature SAY_RANDOM_0'), +(-1999902,'Muahahahaha',8818,1,0,0,'example_creature SAY_RANDOM_1'), +(-1999903,'These mortal infedels my lord, they have invaded your sanctum and seek to steal your secrets.',8041,1,0,0,'example_creature SAY_RANDOM_2'), +(-1999904,'You are already dead.',8581,1,0,0,'example_creature SAY_RANDOM_3'), +(-1999905,'Where to go? What to do? So many choices that all end in pain, end in death.',8791,1,0,0,'example_creature SAY_RANDOM_4'), +(-1999906,'$N, I sentance you to death!',8588,1,0,0,'example_creature SAY_BESERK'), +(-1999907,'The suffering has just begun!',0,1,0,0,'example_creature SAY_PHASE'), +(-1999908,'I always thought I was a good dancer.',0,0,0,0,'example_creature SAY_DANCE'), +(-1999909,'Move out Soldier!',0,0,0,0,'example_creature SAY_SALUTE'), +(-1999910,'Help $N! I\'m under attack!',0,0,0,0,'example_escort SAY_AGGRO1'), +(-1999911,'Die scum!',0,0,0,0,'example_escort SAY_AGGRO2'), +(-1999912,'Hmm a nice day for a walk alright',0,0,0,0,'example_escort SAY_WP_1'), +(-1999913,'Wild Felboar attack!',0,0,0,0,'example_escort SAY_WP_2'), +(-1999914,'Time for me to go! See ya around $N!',0,0,0,3,'example_escort SAY_WP_3'), +(-1999915,'Bye Bye!',0,0,0,3,'example_escort SAY_WP_4'), +(-1999916,'How dare you leave me like that! I hate you! =*(',0,3,0,0,'example_escort SAY_DEATH_1'), +(-1999917,'...no...how could you let me die $N',0,0,0,0,'example_escort SAY_DEATH_2'), +(-1999918,'ugh...',0,0,0,0,'example_escort SAY_DEATH_3'), +(-1999919,'Taste death!',0,0,0,0,'example_escort SAY_SPELL'), +(-1999920,'Fireworks!',0,0,0,0,'example_escort SAY_RAND_1'), +(-1999921,'Hmm, I think I could use a buff.',0,0,0,0,'example_escort SAY_RAND_2'), +(-1999922,'Normal select, guess you\'re not interested.',0,0,0,0,'example_gossip_codebox SAY_NOT_INTERESTED'), +(-1999923,'Wrong!',0,0,0,0,'example_gossip_codebox SAY_WRONG'), +(-1999924,'You\'re right, you are allowed to see my inner secrets.',0,0,0,0,'example_gossip_codebox SAY_CORRECT'), +(-1999925,'Hi!',0,0,0,0,'example_areatrigger SAY_HI'); + +-- 1423_mangos_7290_01_world_command +DELETE FROM `command` WHERE `name` = 'npc setdeathstate'; +INSERT INTO `command` VALUES +('npc setdeathstate',2,'Syntax: .npc setdeathstate on/off\r\n\r\nSet default death state (dead/alive) for npc at spawn.'); + +-- 1426_mangos_7292_01_world_points_of_interest +DROP TABLE IF EXISTS `points_of_interest`; +CREATE TABLE `points_of_interest` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `x` float NOT NULL default '0', + `y` float NOT NULL default '0', + `icon` mediumint(8) unsigned NOT NULL default '0', + `flags` mediumint(8) unsigned NOT NULL default '0', + `data` mediumint(8) unsigned NOT NULL default '0', + `icon_name` text NOT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- 1426_mangos_7292_02_world_locales_points_of_interest +DROP TABLE IF EXISTS `locales_points_of_interest`; +CREATE TABLE `locales_points_of_interest` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `icon_name_loc1` text, + `icon_name_loc2` text, + `icon_name_loc3` text, + `icon_name_loc4` text, + `icon_name_loc5` text, + `icon_name_loc6` text, + `icon_name_loc7` text, + `icon_name_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- 1463_mangos_7303_01_world_pools +DROP TABLE IF EXISTS `pool_creature`; +CREATE TABLE `pool_creature` ( + `guid` int(10) unsigned NOT NULL default '0', + `pool_entry` mediumint(8) unsigned NOT NULL default '0', + `chance` float unsigned NOT NULL default '0', + PRIMARY KEY (`pool_entry`,`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `pool_gameobject`; +CREATE TABLE `pool_gameobject` ( + `guid` int(10) unsigned NOT NULL default '0', + `pool_entry` mediumint(8) unsigned NOT NULL default '0', + `chance` float unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`pool_entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `pool_pool`; +CREATE TABLE `pool_pool` ( + `pool_id` mediumint(8) unsigned NOT NULL default '0', + `mother_pool` mediumint(8) unsigned NOT NULL default '0', + `chance` float NOT NULL default '0', + PRIMARY KEY (`pool_id`,`mother_pool`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `pool_template`; +CREATE TABLE `pool_template` ( + `entry` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Pool entry', + `max_limit` int(10) unsigned NOT NULL default '0' COMMENT 'Max number of objects (0) is no limit', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `game_event_pool`; +CREATE TABLE `game_event_pool` ( + `pool_entry` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Id of the pool', + `event` smallint(6) NOT NULL default '0' COMMENT 'Put negatives values to remove during event', + PRIMARY KEY (`pool_entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- 1470_world_scripts +-- Remove script for quest 8346. Note support for this quest will be added in next ACID release(25) +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry` IN (15273,15274,15294,15298,15367); +UPDATE `creature_template` SET `ScriptName`='mob_broggok_poisoncloud' WHERE `entry`=17662; +-- UPDATE `creature_template` SET `ScriptName`='npc_draenei_survivor' WHERE `entry`=16483; + +-- 1495_mangos_7312_01_world_trinity_string +DELETE FROM `trinity_string` WHERE entry = 810; +INSERT INTO `trinity_string` VALUES +(810,'|Hplayer:$N|h[$N]|h has earned the achievement $a!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 1525_world_scripts +-- Script for Yrykul Skeleton - Prince Keleseth Event +UPDATE `creature_template` SET `ScriptName`='mob_vrykul_skeleton' WHERE `entry`=23970; + +-- 1555_mangos_7331_01_world_command +DELETE FROM `command` WHERE `name` = 'account set addon'; +DELETE FROM `command` WHERE `name` = 'ban account'; +DELETE FROM `command` WHERE `name` = 'ban character'; +DELETE FROM `command` WHERE `name` = 'ban ip'; +DELETE FROM `command` WHERE `name` = 'baninfo account'; +DELETE FROM `command` WHERE `name` = 'baninfo character'; +DELETE FROM `command` WHERE `name` = 'baninfo ip'; +DELETE FROM `command` WHERE `name` = 'banlist account'; +DELETE FROM `command` WHERE `name` = 'banlist character'; +DELETE FROM `command` WHERE `name` = 'banlist ip'; +DELETE FROM `command` WHERE `name` = 'gm fly'; +/* next command deleted even in case it has been already corrected (trailing space) */ +DELETE FROM `command` WHERE `name` = 'gobject near '; +DELETE FROM `command` WHERE `name` = 'gobject near'; +DELETE FROM `command` WHERE `name` = 'lookup player account'; +DELETE FROM `command` WHERE `name` = 'lookup player ip'; +DELETE FROM `command` WHERE `name` = 'lookup player email'; +DELETE FROM `command` WHERE `name` = 'modify money'; +DELETE FROM `command` WHERE `name` = 'modify mount'; +DELETE FROM `command` WHERE `name` = 'modify speed'; +DELETE FROM `command` WHERE `name` = 'modify titles'; +DELETE FROM `command` WHERE `name` = 'pdump write'; +DELETE FROM `command` WHERE `name` = 'pdump load'; +DELETE FROM `command` WHERE `name` = 'reset honor'; +DELETE FROM `command` WHERE `name` = 'reset level'; +DELETE FROM `command` WHERE `name` = 'reset spells'; +DELETE FROM `command` WHERE `name` = 'reset stats'; +DELETE FROM `command` WHERE `name` = 'reset talents'; +DELETE FROM `command` WHERE `name` = 'unban account'; +DELETE FROM `command` WHERE `name` = 'unban character'; +DELETE FROM `command` WHERE `name` = 'unban ip'; + +INSERT INTO `command` VALUES +('account set addon',3,'Syntax: .account set addon [$account] #addon\r\n\r\nSet user (possible targeted) expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk.'), +('ban account',3,'Syntax: .ban account $Name $bantime $reason\r\nBan account kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban character',3,'Syntax: .ban character $Name $bantime $reason\r\nBan account and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban ip',3,'Syntax: .ban ip $Ip $bantime $reason\r\nBan IP.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('baninfo account',3,'Syntax: .baninfo account\r\nWatch full information about a specific ban.'), +('baninfo character',3,'Syntax: .baninfo character\r\nWatch full information about a specific ban.'), +('baninfo ip',3,'Syntax: .baninfo ip\r\nWatch full information about a specific ban.'), +('banlist account',3,'Syntax: .banlist account [$Name]\r\nSearches the banlist for a account name pattern or show full list account bans.'), +('banlist character',3,'Syntax: .banlist character $Name\r\nSearches the banlist for a character name pattern. Pattern required.'), +('banlist ip',3,'Syntax: .banlist ip [$Ip]\r\nSearches the banlist for a IP pattern or show full list of IP bans.'), +('gm fly',3,'Syntax: .gm fly [on/off]\r\nEnable/disable gm fly mode.'), +('gobject near',3,'Syntax: .gobject near [#distance]\r\n\r\nOutput gameobjects at distance #distance from player. Output gameobject guids and coordinates sorted by distance from character. If #distance not provided use 10 as default value.'), +('lookup player account',2,'Syntax: .lookup player account $account ($limit) \r\n\r\n Searchs players, which account username is $account with optional parametr $limit of results.'), +('lookup player ip',2,'Syntax: .lookup player ip $ip ($limit) \r\n\r\n Searchs players, which account ast_ip is $ip with optional parametr $limit of results.'), +('lookup player email',2,'Syntax: .lookup player email $email ($limit) \r\n\r\n Searchs players, which account email is $email with optional parametr $limit of results.'), +('modify money',1,'Syntax: .modify money #money\r\n.money #money\r\n\r\nAdd or remove money to the selected player. If no player is selected, modify your money.\r\n\r\n #gold can be negative to remove money.'), +('modify mount',1,'Syntax: .modify mount #id #speed\r\nDisplay selected player as mounted at #id creature and set speed to #speed value.'), +('modify speed',1,'Syntax: .modify speed #rate\r\n.speed #rate\r\n\r\nModify the running speed of the selected player to \"normal base run speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'), +('modify titles',1,'Syntax: .modify titles #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'), +('pdump write',3,'Syntax: .pdump write $filename $playerNameOrGUID\r\nWrite character dump with name/guid $playerNameOrGUID to file $filename.'), +('pdump load',3,'Syntax: .pdump load $filename $account [$newname] [$newguid]\r\nLoad character dump from dump file into character list of $account with saved or $newname, with saved (or first free) or $newguid guid.'), +('reset honor',3,'Syntax: .reset honor [Playername]\r\n Reset all honor data for targeted character.'), +('reset level',3,'Syntax: .reset level [Playername]\r\n Reset level to 1 including reset stats and talents. Equipped items with greater level requirement can be lost.'), +('reset spells',3,'Syntax: .reset spells [Playername]\r\n Removes all non-original spells from spellbook.\r\n. Playername can be name of offline character.'), +('reset stats',3,'Syntax: .reset stats [Playername]\r\n Resets(recalculate) all stats of the targeted player to their original VALUESat current level.'), +('reset talents',3,'Syntax: .reset talents [Playername]\r\n Removes all talents of the targeted player. Playername can be name of offline character.'), +('unban account',3,'Syntax: .unban account $Name\r\nUnban accounts for account name pattern.'), +('unban character',3,'Syntax: .unban character $Name\r\nUnban accounts for character name pattern.'), +('unban ip',3,'Syntax : .unban ip $Ip\r\nUnban accounts for IP pattern.'); + +-- 1558_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = '44869' AND `spell_effect` = '-45018'; +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = '46019' AND `spell_effect` = '-45018'; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(44869, -45018, 1, 'Remove Arcane Buffet'), +(46019, -45018, 1, 'Remove Arcane Buffet'); + +-- 1559_world +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(48077, 48075, 0, 'Holy Nova (rank8)'), +(48078, 48076, 0, 'Holy Nova (rank9)'), +(47585, 60069, 0, 'Dispersion (transform/regen)'); +DELETE FROM `spell_proc_event` WHERE `entry` IN (47549); +INSERT INTO `spell_proc_event` VALUES (47549, 0x00, 6, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +DELETE FROM `spell_proc_event` WHERE `entry` IN (47551); +INSERT INTO `spell_proc_event` VALUES (47551, 0x00, 6, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +DELETE FROM `spell_proc_event` WHERE `entry` IN (47552); +INSERT INTO `spell_proc_event` VALUES (47552, 0x00, 6, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +-- 1576_mangos_7332_01_world_command +DELETE FROM `command` WHERE `name` = 'distance'; +INSERT INTO `command` VALUES +('distance',3,'Syntax: .distance [$name/$link]\r\n\r\nDisplay the distance from your character to the selected creature/player, or player with name $name, or player/creature/gameobject pointed to shift-link with guid.'); + +-- 1605_mangos_7349_01_world_spell_area +DROP TABLE IF EXISTS `spell_area`; +CREATE TABLE `spell_area` ( + `spell` mediumint(8) unsigned NOT NULL default '0', + `area` mediumint(8) unsigned NOT NULL default '0', + `quest_start` mediumint(8) unsigned NOT NULL default '0', + `quest_start_active` tinyint(1) unsigned NOT NULL default '0', + `quest_end` mediumint(8) unsigned NOT NULL default '0', + `aura_spell` mediumint(8) unsigned NOT NULL default '0', + `racemask` mediumint(8) unsigned NOT NULL default '0', + `gender` tinyint(1) unsigned NOT NULL default '2', + `autocast` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`spell`,`area`,`quest_start`,`quest_start_active`,`aura_spell`,`racemask`,`gender`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- 1613_world_scripts +-- Script for Skarvald and Dalronn +UPDATE `creature_template` SET `ScriptName`= 'boss_skarvald_the_constructor' WHERE `entry` IN (24200,27390); +UPDATE `creature_template` SET `ScriptName`= 'boss_dalronn_the_controller' WHERE `entry` IN (24201,27389); + +-- 1618_world +-- Glyph of power word: shield +INSERT INTO `spell_proc_event` VALUES (55672, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); +-- Bloodsurge +DELETE FROM `spell_proc_event` WHERE `entry` IN (46915); +INSERT INTO `spell_proc_event` VALUES (46915, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- 1646_mangos_7369_01_world_quest_template +ALTER TABLE quest_template + DROP COLUMN ReqSourceRef1, + DROP COLUMN ReqSourceRef2, + DROP COLUMN ReqSourceRef3, + DROP COLUMN ReqSourceRef4; + +-- 1654_world +INSERT INTO `spell_proc_event` VALUES (17619, 0x00, 13, 0x00000000, 0x00000000, 0x00000000, 0x00008000, 0x00000000, 0.000000, 0.000000, 0); + +-- 1657_world +DELETE FROM `trinity_string` WHERE `entry`=1010; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES(1010, "| Account | Character | IP | GM | EXP |"); + +-- 1661_world +-- Death Strike +INSERT INTO `spell_proc_event` VALUES (45469, 0x00, 15, 0x00000010, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0.000000, 0.000000, 0); + +-- 1663_mangos_7376_01_world_spell_area +ALTER TABLE spell_area + CHANGE COLUMN `aura_spell` `aura_spell` mediumint(8) NOT NULL default '0'; + +-- 1688_mangos_7382_01_world_creature_template +ALTER TABLE creature_template + ADD COLUMN unk16 float NOT NULL default '1' AFTER InhabitType, + ADD COLUMN unk17 float NOT NULL default '1' AFTER unk16; + +-- 1693_world +-- Update Proc Rate +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +('60442', '0', '0', '0', '0', '0', '0', '0', '0', '0', '45'), +('57345', '0', '0', '0', '0', '0', '0', '0', '0', '0', '45'), +('61356', '0', '0', '0', '0', '0', '0', '0', '0', '0', '45'), +('54707', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60'), +('54808', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60'); +-- Update Spell Coefficients +DELETE FROM `spell_bonus_data` WHERE `entry` IN ('689', '18790', '172', '42223', '42224', '42225', '42226', '42218', '47817', '47818', '1949', '5857', '11681', '11682', '27214', '47822', '27243', '30108', '17962', '6789', '48181', '29722', '5676', '686', '17877', '30283', '1120', '30294', '44425', '42208', '42209', '42210', '42211', '42212', '42213', '42198', '42937', '42938', '11113', '31661', '120', '19750', '635', '25914', '25913', '25903', '27175', '33074', '48820', '48821', '58597', '31803', '53742', '31893', '32221', '53719', '53718', '20167', '20424', '31804', '53733', '31898', '32220', '53726', '53725', '20267', '20187', '20467', '53600', '596', '2944', '8092', '27813', '27817', '27818', '33619'); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +('689', '0', '0.143', '0', 'Warlock - Drain Life'), +('18790', '0', '0', '0','Warlock - Fel Stamina'), +('172', '0', '0.2', '0', 'Warlock - Corruption'), +('42223', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 1'), +('42224', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 2'), +('42225', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 3'), +('42226', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 4'), +('42218', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 5'), +('47817', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 6'), +('47818', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 7'), +('1949', '0', '0.0949', '0', 'Warlock - Hellfire'), +('5857', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 1'), +('11681', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 2'), +('11682', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 3'), +('27214', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 4'), +('47822', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 5'), +('27243', '0.2129', '0.25', '0', 'Warlock - Seed of Corruption'), +('30108', '0', '0.2', '0', 'Warlock - Unstable Affliction'), +('17962', '0.4293', '0', '0', 'Warlock - Conflagrate'), +('6789', '0.214', '0', '0', 'Warlock - Death Coil'), +('48181', '0.4793', '0', '0', 'Warlock - Haunt'), +('29722', '0.7139', '0', '0', 'Warlock - Incinerate'), +('5676', '0.4293', '0', '0', 'Warlock - Searing Pain'), +('686', '0.8569', '0', '0', 'Warlock - Shadow Bolt'), +('17877', '0.4293', '0', '0', 'Warlock - Shadowburn'), +('30283', '0.1932', '0', '0', 'Warlock - Shadowfury'), +('1120', '0', '0.429', '0', 'Warlock - Drain Soul'), +('30294', '0', '0', '0', 'Warlock - Soul Leech'), +('44425', '0.7143', '0', '0', 'Mage - Arcane Barrage'), +('42208', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 1'), +('42209', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 2'), +('42210', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 3'), +('42211', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 4'), +('42212', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 5'), +('42213', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 6'), +('42198', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 7'), +('42937', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 8'), +('42938', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 9'), +('11113', '0.1936', '0', '0', 'Mage - Blast Wave Rank'), +('31661', '0.1936', '0', '0', 'Mage - Dragons Breath'), +('120', '0.214', '0', '0', 'Mage - Cone of Cold'), +('19750', '1', '0', '0', 'Paladin - Flash of Light'), +('635', '1.66', '0', '0', 'Paladin - Holy Light'), +('25914', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 1'), +('25913', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 2'), +('25903', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 3'), +('27175', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 4'), +('33074', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 5'), +('48820', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 6'), +('48821', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 7'), +('58597', '0.75', '0', '0', 'Paladin - Sacred Shield'), +('31803', '0', '0.018', '0.03', 'Paladin - Holy Vengeance'), +('53742', '0', '0.018', '0.03', 'Paladin - Blood Corruption'), +('31893', '0', '0', '0', 'Paladin - Seal of Blood Enemy Proc'), +('32221', '0', '0', '0', 'Paladin - Seal of Blood Self Proc'), +('53719', '0', '0', '0', 'Paladin - Seal of The Martyr Enemy Proc'), +('53718', '0', '0', '0', 'Paladin - Seal of The Martyr Self Proc'), +('20167', '0.15', '0', '0.15', 'Paladin - Seal of Light Proc'), +('20424', '0.1035', '0', '0', 'Paladin - Seal of Command Proc'), +('31804', '0.22', '0', '0.14', 'Paladin - Judgement of Vengeance'), +('53733', '0.22', '0', '0.14', 'Paladin - Judgement of Corruption'), +('31898', '0.25', '0', '0.16', 'Paladin - Judgement of Blood Enemy'), +('32220', '0', '0', '0', 'Paladin - Judgement of Blood Self'), +('53726', '0.25', '0', '0.16', 'Paladin - Judgement of the Martyr Enemy'), +('53725', '0', '0', '0', 'Paladin - Judgement of the Martyr Self'), +('20267', '0.1', '0', '0.1', 'Paladin - Judgement of Light Proc'), +('20187', '0.4', '0', '0.25', 'Paladin - Judgement of Righteousness'), +('20467', '0.25', '0', '0.16', 'Paladin - Judgement of Command'), +('53600', '0', '0', '0', 'Paladin - Shield of Righteousness'), +('596', '0.8068', '0', '0', 'Priest - Prayer of Healing'), +('2944', '0.8149', '0', '0', 'Priest - Devouring Plague'), +('8092', '0.428', '0', '0', 'Priest - Mind Blast'), +('27813', '0', '0', '0', 'Priest - Blessed Recovery Rank 1'), +('27817', '0', '0', '0', 'Priest - Blessed Recovery Rank 2'), +('27818', '0', '0', '0', 'Priest - Blessed Recovery Rank 3'), +('33619', '0', '0', '0', 'Priest - Reflective Shield'); + +-- 1694_world +-- Sanctified Wrath +INSERT INTO `spell_proc_event` VALUES (57318, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 6); +INSERT INTO `spell_proc_event` VALUES (53375, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 6); +-- Star Sinner +DELETE FROM `spell_proc_event` WHERE `entry` IN (54738); +INSERT INTO `spell_proc_event` VALUES (54738, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45); +-- Tentacles +DELETE FROM `spell_proc_event` WHERE `entry` IN (61618); +INSERT INTO `spell_proc_event` VALUES (61618, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); +-- Demonic Sacrifice +DELETE FROM `spell_bonus_data` WHERE `entry` = 18790; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`comments`) VALUES +('18790','0','0','0','Warlock - Fel Stamina'); + +-- 1697_mangos_7388_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (750,751); +INSERT INTO `trinity_string` VALUES +(750,'Not enough players. This game will close in %u mins.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(751,'Not enough players. This game will close in %u seconds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 1703_world +DROP TABLE IF EXISTS `access_requirement`; +CREATE TABLE `access_requirement` ( + `id` bigint(20) unsigned NOT NULL COMMENT 'Identifier', + `level_min` tinyint(3) unsigned NOT NULL default '0', + `level_max` tinyint(3) unsigned NOT NULL default '0', + `item` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `item2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_key` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_key2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `quest_failed_text` TEXT NULL DEFAULT NULL, + `heroic_quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_quest_failed_text` TEXT NULL DEFAULT NULL, + `comment` TEXT NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Access Requirements'; + +ALTER TABLE `instance_template` + DROP COLUMN `levelMin`, + DROP COLUMN `levelMax`, + ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `reset_delay`; + +ALTER TABLE `areatrigger_teleport` + DROP COLUMN `required_level`, + DROP COLUMN `required_item`, + DROP COLUMN `required_item2`, + DROP COLUMN `heroic_key`, + DROP COLUMN `heroic_key2`, + DROP COLUMN `heroic_required_quest_done`, + DROP COLUMN `heroic_required_failed_quest_text`, + DROP COLUMN `required_quest_done`, + DROP COLUMN `required_failed_text`, + ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `name`; + +INSERT INTO `access_requirement` VALUES +('1','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Shadowfang Keep (33)'), +('2','15','0','0','0','0','0','0',NULL,'0',NULL,'instance The Stockade (34)'), +('3','10','0','0','0','0','0','0',NULL,'0',NULL,'instance The Deadmines (36)'), +('4','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Wailing Caverns (43)'), +('5','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Kraul (47)'), +('6','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackfathom Deeps (48)'), +('7','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Uldaman (70)'), +('8','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Gnomeregan (90)'), +('9','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunken Temple (109)'), +('10','25','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Downs (129)'), +('11','20','0','0','0','0','0','0',NULL,'0',NULL,'instance Scarlet Monastery (189)'), +('12','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Farrak (209)'), +('13','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Spire (229)'), +('14','40','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Depths (230)'), +('15','55','0','16309','0','0','0','0',NULL,'0',NULL,'instance Onyxia\'s Lair (249)'), +('16','66','0','0','0','30635','0','10285','You can\'t enter Black Morass until you rescue Thrall from Durnholde Keep.','0',NULL,'instance The Black Morass (269)'), +('17','45','0','13704','0','0','0','0',NULL,'0',NULL,'instance Scholomance (289)'), +('18','50','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Gurub (309)'), +('19','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Stratholme (329)'), +('20','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Maraudon (349)'), +('21','8','0','0','0','0','0','0',NULL,'0',NULL,'instance Ragefire Chasm (389)'), +('22','50','0','0','0','0','0','7487',NULL,'0',NULL,'instance Molten Core (409)'), +('23','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Dire Maul (429)'), +('24','60','0','0','0','0','0','7761',NULL,'0',NULL,'instance Blackwing Lair (469)'), +('25','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Ruins of Ahn\'Qiraj (509)'), +('26','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Temple of Ahn\'Qiraj (531)'), +('27','68','0','0'/*'24490'*/,'0','0','0','0',NULL,'0',NULL,'instance Karazhan (532)'), +('28','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Naxxramas (533)'), +('29','70','0','0','0','0','0','10445',NULL,'0',NULL,'instance Hyjal Summit (534)'), +('30','55','0','0'/*'28395'*/,'0','30637','30622','0',NULL,'0',NULL,'instance The Shattered Halls (540)'), +('31','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance The Blood Furnace (542)'), +('32','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance Hellfire Ramparts (543)'), +('33','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Magtheridon\'s Lair (544)'), +('34','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Steamvault (545)'), +('35','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Underbog (546)'), +('36','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Slave Pens (547)'), +('37','70','0','0','0','0','0','0'/*'10901'*/,NULL,'0',NULL,'instance Serpentshrine Cavern (548)'), +('38','70','0','0'/*'31704'*/,'0','0','0','0',NULL,'0',NULL,'instance The Eye (550)'), +('39','68','0','0'/*'31084'*/,'0','30634','0','0',NULL,'0',NULL,'instance The Arcatraz (552)'), +('40','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Botanica (553)'), +('41','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Mechanar (554)'), +('42','65','0','27991','0','30633','0','0',NULL,'0',NULL,'instance Shadow Labyrinth (555)'), +('43','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Sethekk Halls (556)'), +('44','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Mana-Tombs (557)'), +('45','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Auchenai Crypts (558)'), +('46','66','0','0','0','30635','0','0',NULL,'0',NULL,'instance Old Hillsbrad Foothills (560)'), +('47','70','0','32649','0','0','0','0',NULL,'0',NULL,'instance Black Temple (564)'), +('48','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Gruul\'s Lair (565)'), +('49','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Aman (568)'), +('50','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunwell Plateau (580)'), +('51','70','0','0','0','0','0','0',NULL,'11492','Heroic Difficulty requires completion of the "Hard to Kill" quest.','instance Magisters\' Terrace (585)'), +('52','58','0','0','0','0','0','0',NULL,'0',NULL,'Dark Portal'); +UPDATE `instance_template` SET `access_id` = '1' WHERE `map` = '33'; +UPDATE `instance_template` SET `access_id` = '2' WHERE `map` = '34'; +UPDATE `instance_template` SET `access_id` = '3' WHERE `map` = '36'; +UPDATE `instance_template` SET `access_id` = '4' WHERE `map` = '43'; +UPDATE `instance_template` SET `access_id` = '5' WHERE `map` = '47'; +UPDATE `instance_template` SET `access_id` = '6' WHERE `map` = '48'; +UPDATE `instance_template` SET `access_id` = '7' WHERE `map` = '70'; +UPDATE `instance_template` SET `access_id` = '8' WHERE `map` = '90'; +UPDATE `instance_template` SET `access_id` = '9' WHERE `map` = '109'; +UPDATE `instance_template` SET `access_id` = '10' WHERE `map` = '129'; +UPDATE `instance_template` SET `access_id` = '11' WHERE `map` = '189'; +UPDATE `instance_template` SET `access_id` = '12' WHERE `map` = '209'; +UPDATE `instance_template` SET `access_id` = '13' WHERE `map` = '229'; +UPDATE `instance_template` SET `access_id` = '14' WHERE `map` = '230'; +UPDATE `instance_template` SET `access_id` = '15' WHERE `map` = '249'; +UPDATE `instance_template` SET `access_id` = '16' WHERE `map` = '269'; +UPDATE `instance_template` SET `access_id` = '17' WHERE `map` = '289'; +UPDATE `instance_template` SET `access_id` = '18' WHERE `map` = '309'; +UPDATE `instance_template` SET `access_id` = '19' WHERE `map` = '329'; +UPDATE `instance_template` SET `access_id` = '20' WHERE `map` = '349'; +UPDATE `instance_template` SET `access_id` = '21' WHERE `map` = '389'; +UPDATE `instance_template` SET `access_id` = '22' WHERE `map` = '409'; +UPDATE `instance_template` SET `access_id` = '23' WHERE `map` = '429'; +UPDATE `instance_template` SET `access_id` = '24' WHERE `map` = '469'; +UPDATE `instance_template` SET `access_id` = '25' WHERE `map` = '509'; +UPDATE `instance_template` SET `access_id` = '26' WHERE `map` = '531'; +UPDATE `instance_template` SET `access_id` = '27' WHERE `map` = '532'; +UPDATE `instance_template` SET `access_id` = '28' WHERE `map` = '533'; +UPDATE `instance_template` SET `access_id` = '29' WHERE `map` = '534'; +UPDATE `instance_template` SET `access_id` = '30' WHERE `map` = '540'; +UPDATE `instance_template` SET `access_id` = '31' WHERE `map` = '542'; +UPDATE `instance_template` SET `access_id` = '32' WHERE `map` = '543'; +UPDATE `instance_template` SET `access_id` = '33' WHERE `map` = '544'; +UPDATE `instance_template` SET `access_id` = '34' WHERE `map` = '545'; +UPDATE `instance_template` SET `access_id` = '35' WHERE `map` = '546'; +UPDATE `instance_template` SET `access_id` = '36' WHERE `map` = '547'; +UPDATE `instance_template` SET `access_id` = '37' WHERE `map` = '548'; +UPDATE `instance_template` SET `access_id` = '38' WHERE `map` = '550'; +UPDATE `instance_template` SET `access_id` = '39' WHERE `map` = '552'; +UPDATE `instance_template` SET `access_id` = '40' WHERE `map` = '553'; +UPDATE `instance_template` SET `access_id` = '41' WHERE `map` = '554'; +UPDATE `instance_template` SET `access_id` = '42' WHERE `map` = '555'; +UPDATE `instance_template` SET `access_id` = '43' WHERE `map` = '556'; +UPDATE `instance_template` SET `access_id` = '44' WHERE `map` = '557'; +UPDATE `instance_template` SET `access_id` = '45' WHERE `map` = '558'; +UPDATE `instance_template` SET `access_id` = '46' WHERE `map` = '560'; +UPDATE `instance_template` SET `access_id` = '47' WHERE `map` = '564'; +UPDATE `instance_template` SET `access_id` = '48' WHERE `map` = '565'; +UPDATE `instance_template` SET `access_id` = '49' WHERE `map` = '568'; +UPDATE `instance_template` SET `access_id` = '50' WHERE `map` = '580'; +UPDATE `instance_template` SET `access_id` = '51' WHERE `map` = '585'; +UPDATE `areatrigger_teleport` SET `access_id` = '52' WHERE `id` IN ('4352','4354'); + +-- 1709_mangos_7393_01_world_game_event +ALTER TABLE `game_event` + ADD COLUMN `holiday` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Client side holiday id' AFTER `length`; + +-- 1724_mangos_7399_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (753, 754, 755); +INSERT INTO `trinity_string` VALUES +(753,'The battle for Warsong Gulch begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(754,'The battle for Arathi Basin begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(755,'The battle for Eye of the Storm begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 1727_world +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES (42857,1,23954); + +-- 1727_world_script +UPDATE `creature_template` SET `ScriptName`='boss_ingvar_the_plunderer' WHERE `entry`=23954; +UPDATE `creature_template` SET `ScriptName`='mob_annhylde_the_caller' WHERE `entry`=24068; +UPDATE `creature_template` SET `ScriptName`='mob_ingvar_throw_dummy' WHERE `entry`=23997; + +-- 1729_world +-- Judgements of the Wise +REPLACE INTO `spell_proc_event` VALUES (31876, 0x00, 10, 0x20180400, 0x0000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (31877, 0x00, 10, 0x20180400, 0x0000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (31878, 0x00, 10, 0x20180400, 0x0000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +-- 1730_world +-- Faerie fire +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES ('60089', '0', '0', '0.05', 'Druid - Faerie Fire (Bear Form)'); +-- Glyph of Devastate +INSERT INTO `spell_proc_event` VALUES (58388, 0x00, 4, 0x00000040, 0x00000000, 0x00000000, 0x00000110, 0x00000000, 0.000000, 0.000000, 0); + +-- 1755_world +DELETE FROM spell_proc_event WHERE entry IN (47535, 47536, 47537, 47538, 47539,34074,58426,31221,31222,31223); +-- Rapture +INSERT INTO `spell_proc_event` VALUES (47535, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47536, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47537, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47538, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47539, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +-- Aspect of the viper +INSERT INTO `spell_proc_event` VALUES (34074, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0.000000, 0.000000, 0); +-- Overkill +INSERT INTO `spell_proc_event` VALUES (58426, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x00000000, 0.000000, 0.000000, 0); +-- Master of subtlety +INSERT INTO `spell_proc_event` VALUES (31221, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (31222, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (31223, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x00000000, 0.000000, 0.000000, 0); +DELETE FROM `spell_bonus_data` WHERE entry=2944; +INSERT INTO `spell_bonus_data` VALUES ('2944', '0', '0.1849', '0', 'Priest - Devouring Plague'); + +-- 1764_world +DELETE FROM spell_proc_event WHERE entry IN (54149,53672,20210,20212,20213,20214,20215); +-- Infusion of Light +INSERT INTO `spell_proc_event` VALUES (54149, 0x00, 10, 2097152, 65536, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (53672, 0x00, 10, 2097152, 65536, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- Illumination +INSERT INTO `spell_proc_event` VALUES (20210, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (20212, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (20213, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (20214, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (20215, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- 1766_world +DELETE FROM spell_proc_event WHERE entry IN (33182,33174); +INSERT INTO `spell_proc_event` VALUES (33182, 0x00, 6, 32, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (33174, 0x00, 6, 32, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); + +-- 1791_mangos_7422_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (811, 812, 813, 814, 815); +INSERT INTO `trinity_string` VALUES +(811,'Guild Master',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(812,'Officer',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(813,'Veteran',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(814,'Member',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(815,'Initiate',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 1814_world +-- Improved Fire Nova Totem +DELETE FROM `spell_proc_event` WHERE `entry` IN (16086, 16544); +INSERT INTO `spell_proc_event` VALUES (16086, 0x00, 7, 0, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (16544, 0x00, 7, 0, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +-- 1825_world +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-47953); +INSERT INTO `spell_linked_spell` VALUES (-47953, 60406, 0, 'Divine hymn buff to enemies'); + +-- 1828_world +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (48265,49772,48263); +INSERT INTO `spell_linked_spell` VALUES (48265, 49772, 2, 'Unholy Presence'); +INSERT INTO `spell_linked_spell` VALUES (49772, 55222, 2, 'Unholy Presence'); +INSERT INTO `spell_linked_spell` VALUES (48263, 61261, 2, 'Frost Presence'); + +-- 1877_mangos_7439_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (175); +INSERT INTO `trinity_string` VALUES +(175,'Liquid level: %f, ground: %f, type: %d, status: %d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 1884_world +DELETE FROM `trinity_string` WHERE `entry` IN (10056, 10057); + +-- 1886_world +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (61847,61846); +INSERT INTO `spell_linked_spell` VALUES (61847, 61848, 2, 'Aspect of te dragonhawk'); +INSERT INTO `spell_linked_spell` VALUES (61846, 61848, 2, 'Aspect of te dragonhawk'); +-- Glyph of Aspect of the Monkey +DELETE FROM `spell_proc_event` WHERE `entry` IN (13163,61848); +INSERT INTO `spell_proc_event` VALUES (13163, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000010, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (61848, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000010, 0.000000, 0.000000, 0); + +-- 1911_world +DELETE FROM `spell_proc_event` WHERE `entry` IN (44545, 44543); +INSERT INTO `spell_proc_event` VALUES +(44545, 0x00, 3, 1049120, 4096, 0x00000000, 0x0010000, 0x00000000, 15.000000, 0.000000, 0), +(44543, 0x00, 3, 1049120, 4096, 0x00000000, 0x0010000, 0x00000000, 7.000000, 0.000000, 0); + +-- 1912_world +-- Shattered Barrier +-- Improved Fear +DELETE FROM `spell_proc_event` WHERE `entry` IN (44745, 54787, 53754, 53759); +INSERT INTO `spell_proc_event` VALUES +(44745, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00008000, 0x0006000, 0.000000, 0.000000, 0), +(54787, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00008000, 0x0006000, 0.000000, 0.000000, 0), +(53754, 0x00, 5, 0x00000000, 1024, 0x00000000, 0x00000000, 0x0006000, 0.000000, 0.000000, 0), +(53759, 0x00, 5, 0x00000000, 1024, 0x00000000, 0x00000000, 0x0006000, 0.000000, 0.000000, 0); + +-- 1927_world +-- Nature's Grace -- +DELETE FROM `spell_proc_event` WHERE `entry` IN (16880, 61345, 61346); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(16880, 0x48, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61345, 0x48, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61346, 0x48, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- Blade Twisting -- +DELETE FROM `spell_proc_event` WHERE `entry` IN (31124, 31126); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(31124, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31126, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +-- 1939_world +-- Psychic Horror +DELETE FROM `spell_proc_event` WHERE `entry` IN (47571, 47572); +INSERT INTO `spell_proc_event` VALUES +(47571, 0x00, 6, 65536, 0x00000000, 0x00000000, 0x00010000, 0x0006000, 0.000000, 50.000000, 0), +(47572, 0x00, 6, 65536, 0x00000000, 0x00000000, 0x00010000, 0x0006000, 0.000000, 100.000000, 0); + +-- 1957_word +-- Furious Attacks +DELETE FROM `spell_proc_event` WHERE `entry` IN (46910, 46911); +INSERT INTO `spell_proc_event` VALUES +(46910, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000001, 5.5000000, 0.000000, 0), +(46911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000001, 7.5000000, 0.000000, 0); + +-- 1962_mangos_7472_01_world_trinity_string +DELETE FROM trinity_string WHERE entry >= 667 and entry <= 687 or entry = 614 or entry = 615; +INSERT INTO trinity_string VALUES +(614,'The Alliance flag is now placed at its base.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(615,'The Horde flag is now placed at its base.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(667,'The Alliance has taken control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(668,'The Horde has taken control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(669,'The Alliance has taken control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(670,'The Horde has taken control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(671,'The Alliance has taken control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(672,'The Horde has taken control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(673,'The Alliance has taken control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(674,'The Horde has taken control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(675,'The Alliance has lost control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(676,'The Horde has lost control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(677,'The Alliance has lost control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(678,'The Horde has lost control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(679,'The Alliance has lost control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(680,'The Horde has lost control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(681,'The Alliance has lost control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(682,'The Horde has lost control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(683,'%s has taken the flag!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(684,'The Alliance have captured the flag!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(685,'The Horde have captured the flag!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(686,'The flag has been dropped.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(687,'The flag has been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2013_world +-- Shattered Barrier +DELETE FROM `spell_proc_event` WHERE `entry` IN (44745, 54787, 58426, 31221, 31222, 31223); +INSERT INTO `spell_proc_event` VALUES +(44745, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00008000, 0x0002000, 0.000000, 0.000000, 0), +(54787, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00008000, 0x0002000, 0.000000, 0.000000, 0), +-- Overkill +(58426, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0004001, 0.000000, 0.000000, 0), +-- Master of subtlety +(31221, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0004001, 0.000000, 0.000000, 0), +(31222, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0004001, 0.000000, 0.000000, 0), +(31223, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0004001, 0.000000, 0.000000, 0); + +-- 2021_world +DELETE FROM `spell_proc_event` WHERE `entry` IN (30293, 30295, 30296); +INSERT INTO `spell_proc_event` VALUES +-- Soul Leech +(30293, 0x00, 5, 0x00000381, 0x200C0, 0x00000000, 0x0000000, 0x0000000, 0.000000, 0.000000, 0), +(30295, 0x00, 5, 0x00000381, 0x200C0, 0x00000000, 0x0000000, 0x0000000, 0.000000, 0.000000, 0), +(30296, 0x00, 5, 0x00000381, 0x200C0, 0x00000000, 0x0000000, 0x0000000, 0.000000, 0.000000, 0); + +-- 2025_mangos_7493_01_world_command +DELETE FROM `command` WHERE `name` IN ('gobject near','gobject phase','gobject setphase'); +INSERT INTO `command` VALUES +('gobject near',2,'Syntax: .gobject near [#distance]\r\n\r\nOutput gameobjects at distance #distance from player. Output gameobject guids and coordinates sorted by distance from character. If #distance not provided use 10 as default value.'), +('gobject setphase',2,'Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'); + +-- 2025_mangos_7495_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (276,277,524); +INSERT INTO `trinity_string` VALUES +(276,'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) turned',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(277,'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) moved',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(524,'Selected object:\n|cffffffff|Hgameobject:%d|h[%s]|h|r GUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2057_world +DELETE FROM `spell_bonus_data` WHERE `entry` IN (15290, 39373, 33778, 379, 38395, 40972, 22845, 33504, 34299); +INSERT INTO `spell_bonus_data` VALUES +(15290, 0, 0, 0, 'Vampiric Embrace'), +(39373, 0, 0, 0, 'Shadowmend'), +(33778, 0, 0, 0, 'Lifebloom'), +(379, 0, 0, 0, 'Earth Shield'), +(38395, 0, 0, 0, 'Siphon Essence'), +(40972, 0, 0, 0, 'Heal'), +(22845, 0, 0, 0, 'Frenzied Regeneration'), +(33504, 0, 0, 0, 'Mark of Conquest'), +(34299, 0, 0, 0, 'Improved Leader of the Pack'); + +-- 2064_world +DELETE FROM `trinity_string` WHERE `entry` IN (7523,7524); +INSERT INTO `trinity_string` VALUES +(7523,'WORLD: Denying connections.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(7524,'WORLD: Accepting connections.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +DELETE FROM `command` WHERE `name` IN ('server set closed'); +INSERT INTO `command` VALUES ('server set closed', 3, 'Syntax: server set closed on/off\r\n\r\nSets whether the world accepts new client connectsions.'); + +-- 2080_mangos_7503_01_world_command +DELETE FROM `command` WHERE `name` IN ('addmove','allowmove','debug Mod32Value','debug standstate','go creature','go graveyard','go trigger','gobject phase','gobject setphase','Mod32Value','modify arena','modify standstate','npc addmove','npc allowmove','npc textemote','npc phase','npc setphase','showhonor'); +INSERT INTO `command` VALUES +('debug Mod32Value',3,'Syntax: .debug Mod32Value #field #value\r\n\r\nAdd #value to field #field of your character.'), +('go creature',1,'Syntax: .go creature #creature_guid\r\nTeleport your character to creature with guid #creature_guid.\r\n.gocreature #creature_name\r\nTeleport your character to creature with this name.\r\n.gocreature id #creature_id\r\nTeleport your character to a creature that was spawned from the template with this entry.\r\n*If* more than one creature is found, then you are teleported to the first that is found inside the database.'), +('go graveyard',1,'Syntax: .go graveyard #graveyardId\r\n Teleport to graveyard with the graveyardId specified.'), +('go trigger',1,'Syntax: .go trigger #trigger_id\r\n\r\nTeleport your character to areatrigger with id #trigger_id. Character will be teleported to trigger target if selected areatrigger is telporting trigger.'), +('gobject setphase',2,'Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'), +('modify arena',1,'Syntax: .modify arena #value\r\nAdd $amount arena points to the selected player.'), +('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'), +('npc addmove',2,'Syntax: .npc addmove #creature_guid [#waittime]\r\n\r\nAdd your current location as a waypoint for creature with guid #creature_guid. And optional add wait time.'), +('npc allowmove',3,'Syntax: .npc allowmove\r\n\r\nEnable or disable movement creatures in world. Not implemented.'), +('npc setphase',2,'Syntax: .npc setphase #phasemask\r\n\r\nSelected unit or pet phasemask changed to #phasemask with related world vision update for players. In creature case state saved to DB and persistent. In pet case change active until in game phase changed for owner, owner re-login, or GM-mode enable/disable..'), +('npc textemote',1,'Syntax: .npc textemote #emoteid\r\n\r\nMake the selected creature to do textemote with an emote of id #emoteid.'); + +-- 2131_world +DELETE FROM `command` WHERE `name` IN ('server difftime', 'npc tempadd', 'gobject tempadd', ''); +INSERT INTO `command` VALUES +('gobject tempadd','2','Adds a temporary gameobject that is not saved to DB.'), +('npc tempadd','2','Adds temporary NPC, not saved to database.'); +UPDATE `command` SET `name`="ahbotoption" WHERE `name`="ahbotoptions"; +DELETE FROM `command` WHERE `name` IN ('reload tickets'); +DELETE FROM `command` WHERE `name` LIKE "path%"; +DELETE FROM `command` WHERE `name` LIKE "wp%"; +INSERT INTO `command` VALUES +('wp load',2,'Syntax: .path load $pathid\nLoad pathid number for selected creature. Creature must have no waypoint data.'), +('wp event',2,'Syntax: .path event $subcommand\nType .path event to see the list of possible subcommands or .help path event $subcommand to see info on subcommands.'), +('wp event add',2,'Syntax: .path event add $subcommand\nAdd new waypoint action in DB.'), +('wp event mod',2,'Syntax: .path mod $eventid $parameter $parameter_value\nModify parameter value for specified eventid.\nPossible parameters: pos_x, pos_y, pos_z, command, datalong, datalon2, dataint.'), +('wp event listid',2,'Syntax: .path event listid $eventid\nShows specified eventid info.'), +('wp unload',2,'Syntax: .path unload\nUnload path for selected creature.'), +('wp show',2,'Syntax: .path show $option\nOptions:\non $pathid (or selected creature with loaded path) - Show path\noff - Hide path\ninfo $slected_waypoint - Show info for selected waypoint.'), +('wp mod ',2,'Syntax: .path mod\nType .path mod to see the list of possible subcommands or .help path mod $subcommand to see info on subcommands.'), +('wp mod del',2,'Syntax: .path mod del\nDelete selected waypoint.'), +('wp mod move',2,'Syntax: .path mod move\nChange selected waypoint coordinates to your position.'), +('wp mod move_flag',2,'Syntax: .path mod move_flag\nSet move/run flag.'), +('wp mod action',2,'Syntax: .path mod action\nAssign action (waypoint script id) to selected waypoint.'), +('wp mod action_chance',2,'Syntax: .path mod action_chance\nAssign chance.'); + +-- 2138_world +DELETE FROM `spell_proc_event` WHERE `entry` IN (55198, 34026); +INSERT INTO `spell_proc_event` VALUES +-- Tidial Force +(55198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00004000, 0x00000002, 0.000000, 0.000000, 0), +-- Kill Command +(34026, 0x00, 9, 0x00000000, 0x10000000, 0x00000000, 0x0000000, 0x00000000, 0.000000, 0.000000, 0); + +-- 2139_script_waypoint +DROP TABLE IF EXISTS script_waypoint; +CREATE TABLE script_waypoint ( + entry mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'creature_template entry', + pointid mediumint(8) unsigned NOT NULL DEFAULT '0', + location_x float NOT NULL DEFAULT '0', + location_y float NOT NULL DEFAULT '0', + location_z float NOT NULL DEFAULT '0', + waittime int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'waittime in millisecs', + point_comment text, + PRIMARY KEY (entry, pointid) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; +DELETE FROM `script_waypoint` WHERE `entry`=16295; +INSERT INTO `script_waypoint` VALUES +(16295, 0, 7545.070000, -7359.870000, 162.354000, 4000, 'SAY_START'), +(16295, 1, 7550.048340, -7362.237793, 162.235657, 0, ''), +(16295, 2, 7566.976074, -7364.315430, 161.738770, 0, ''), +(16295, 3, 7578.830566, -7361.677734, 161.738770, 0, ''), +(16295, 4, 7590.969238, -7359.053711, 162.257660, 0, ''), +(16295, 5, 7598.354004, -7362.815430, 162.256683, 4000, 'SAY_PROGRESS_1'), +(16295, 6, 7605.861328, -7380.424316, 161.937073, 0, ''), +(16295, 7, 7605.295410, -7387.382813, 157.253998, 0, ''), +(16295, 8, 7606.131836, -7393.893555, 156.941925, 0, ''), +(16295, 9, 7615.207520, -7400.187012, 157.142639, 0, ''), +(16295, 10, 7618.956543, -7402.652832, 158.202042, 0, ''), +(16295, 11, 7636.850586, -7401.756836, 162.144791, 0, 'SAY_PROGRESS_2'), +(16295, 12, 7637.058105, -7404.944824, 162.206970, 4000, ''), +(16295, 13, 7636.910645, -7412.585449, 162.366425, 0, ''), +(16295, 14, 7637.607910, -7425.591797, 162.630661, 0, ''), +(16295, 15, 7637.816895, -7459.057129, 163.302704, 0, ''), +(16295, 16, 7638.859863, -7470.902344, 162.517059, 0, ''), +(16295, 17, 7641.395996, -7488.217285, 157.381287, 0, ''), +(16295, 18, 7634.455566, -7505.451660, 154.682159, 0, 'SAY_PROGRESS_3'), +(16295, 19, 7631.906738, -7516.948730, 153.597382, 0, ''), +(16295, 20, 7622.231445, -7537.037598, 151.587112, 0, ''), +(16295, 21, 7610.921875, -7550.670410, 149.639374, 0, ''), +(16295, 22, 7598.229004, -7562.551758, 145.953888, 0, ''), +(16295, 23, 7588.509277, -7577.755371, 148.294479, 0, ''), +(16295, 24, 7567.339355, -7608.456055, 146.006485, 0, ''), +(16295, 25, 7562.547852, -7617.417969, 148.097504, 0, ''), +(16295, 26, 7561.508789, -7645.064453, 151.245163, 0, ''), +(16295, 27, 7563.337402, -7654.652344, 151.227158, 0, ''), +(16295, 28, 7565.533691, -7658.296387, 151.248886, 0, ''), +(16295, 39, 7571.155762, -7659.118652, 151.244568, 0, ''), +(16295, 30, 7579.119629, -7662.213867, 151.651505, 0, 'quest complete'), +(16295, 31, 7603.768066, -7667.000488, 153.997726, 0, ''), +(16295, 32, 7603.768066, -7667.000488, 153.997726, 4000, 'SAY_END_1'), +(16295, 33, 7603.768066, -7667.000488, 153.997726, 8000, 'SAY_END_2'), +(16295, 34, 7603.768066, -7667.000488, 153.997726, 0, ''); + +-- 2139_world +UPDATE `gameobject_template` SET `ScriptName`='go_cat_figurine' WHERE `entry`=13873; +UPDATE `creature_template` SET `ScriptName`='npc_garments_of_quests' WHERE `entry` IN (12429,12423,12427,12430,12428); + +-- 2139_world_script +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000164 AND -1000174; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000164,'Ah, $GPriest:Priestess; you came along just in time. I appreciate it.',0,0,0,2,'garments SAY_COMMON_HEALED'), +(-1000165,'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those gnolls with your power to back me!',0,0,1,1,'garments SAY_DG_KEL_THANKS'), +(-1000166,'Farewell to you, and may shadow always protect you!',0,0,1,3,'garments SAY_DG_KEL_GOODBYE'), +(-1000167, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those murlocs with the Light on my side!',0,0,7,1,'garments SAY_ROBERTS_THANKS'), +(-1000168, 'Farewell to you, and may the Light be with you always.',0,0,7,3,'garments SAY_ROBERTS_GOODBYE'), +(-1000169, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those humans with your power to back me!',0,0,1,1,'garments SAY_KORJA_THANKS'), +(-1000170, 'Farewell to you, and may our ancestors be with you always!',0,0,1,3,'garments SAY_KORJA_GOODBYE'), +(-1000171, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those wendigo with the Light on my side!',0,0,7,1,'garments SAY_DOLF_THANKS'), +(-1000172, 'Farewell to you, and may the Light be with you always.',0,0,7,3,'garments SAY_DOLF_GOODBYE'), +(-1000173, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those corrupt timberlings with Elune\'s power behind me!',0,0,2,1,'garments SAY_SHAYA_THANKS'), +(-1000174, 'Farewell to you, and may Elune be with you always.',0,0,2,3,'garments SAY_SHAYA_GOODBYE'); + +-- 2160_world +DELETE FROM `command` WHERE `name` LIKE "ahbotoption %"; +DELETE FROM `command` WHERE `name` LIKE "ahbotoptions %"; +DELETE FROM `command` WHERE `name` IN ('gobject addtemp','npc addtemp'); + +-- 2161_world +DELETE FROM `command` WHERE `name` LIKE "wp mod %"; +DELETE FROM `command` WHERE `name` LIKE "wp event %"; + +-- 2227_mangos_7544_01_world_uptime +DROP TABLE IF EXISTS `uptime`; + +-- 2254_world +DELETE FROM `command` WHERE `name` IN ('server difftime', 'addmove', 'Mod32Value', 'allowmove', 'reload tickets', 'npc tempadd', 'gobject tempadd', 'gobject addtemp', 'npc addtemp'); +INSERT INTO `command` VALUES +('gobject tempadd','2','Adds a temporary gameobject that is not saved to DB.'), +('npc tempadd','2','Adds temporary NPC, not saved to database.'); +UPDATE `command` SET `name`="ahbotoption" WHERE `name`="ahbotoptions"; +DELETE FROM `command` WHERE `name` LIKE "path%"; +DELETE FROM `command` WHERE `name` LIKE "wp%"; +INSERT INTO `command` VALUES +('wp load',2,'Syntax: .wp load $pathid\nLoad pathid number for selected creature. Creature must have no waypoint data.'), +('wp event',2,'Syntax: .wp event $subcommand\nType .path event to see the list of possible subcommands or .help path event $subcommand to see info on subcommands.'), +('wp unload',2,'Syntax: .wp unload\nUnload path for selected creature.'), +('wp show',2,'Syntax: .wp show $option\nOptions:\non $pathid (or selected creature with loaded path) - Show path\noff - Hide path\ninfo $slected_waypoint - Show info for selected waypoint.'), +('wp mod',2,'Syntax: .wp mod\nType .path mod to see the list of possible subcommands or .help path mod $subcommand to see info on subcommands.'); + +-- 2274_mangos_7558_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (1123,1124,1125,1126,1127); +INSERT INTO `trinity_string` VALUES +(1123,'Not pet found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1124,'Wrong pet type',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1125,'Your pet learned all talents',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1126,'Your pet talents have been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1127,'Talents of %s\'s pet reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2274_mangos_7558_02_world_command +DELETE FROM `command` WHERE `name` IN ('learn all_mypettalents'); +INSERT INTO `command` VALUES +('learn all_mypettalents',3,'Syntax: .learn all_mypettalents\r\n\r\nLearn all talents for your pet available for his creature type (only for hunter pets).'); + +-- 2276_mangos_7560_01_world_gameobject_template +ALTER TABLE gameobject_template + ADD COLUMN IconName varchar(100) NOT NULL default '' AFTER name; + +-- 2280_mangos_7565_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (1010,1011,1012,1013,1014); +INSERT INTO `trinity_string` VALUES +(1010,'| Account | Character | IP | GM | Expansion |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1011,'| | %20s | || |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1012,'===========================================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1013,'|%15s| %20s | %15s |%4d| %9d |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1014,'No online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2284_mangos_7568_01_world_spell_proc_event +-- (53569) Infusion of Light (Rank 1) +DELETE FROM `spell_proc_event` WHERE `entry` IN (53569); +INSERT INTO `spell_proc_event` VALUES (53569, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- (53576) Infusion of Light (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (53576); +INSERT INTO `spell_proc_event` VALUES (53576, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- (54149) Infusion of Light (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (54149); +INSERT INTO `spell_proc_event` VALUES (54149, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- (55776) Swordguard Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55776); +INSERT INTO `spell_proc_event` VALUES (55776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); +-- (55768) Darkglow Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55768); +INSERT INTO `spell_proc_event` VALUES (55768, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); +-- (55640) Lightweave Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55640); +INSERT INTO `spell_proc_event` VALUES (55640, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); +-- (55380) Skyflare Swiftness () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55380); +INSERT INTO `spell_proc_event` VALUES (55380, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); +-- (56355) Titanium Shield Spike () +DELETE FROM `spell_proc_event` WHERE `entry` IN (56355); +INSERT INTO `spell_proc_event` VALUES (56355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0); +-- (61345) Natures Grace () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61345); +INSERT INTO `spell_proc_event` VALUES (61345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- (61346) Natures Grace () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61346); +INSERT INTO `spell_proc_event` VALUES (61346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- (61356) Invigorating Earthsiege Diamond Passive () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61356); +INSERT INTO `spell_proc_event` VALUES (61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- (24905) Moonkin Form (Passive) (Passive) +DELETE FROM `spell_proc_event` WHERE `entry` IN (24905); +INSERT INTO `spell_proc_event` VALUES (24905, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 15.000000, 0.000000, 0); + +-- 2296_world +ALTER TABLE creature_template + ADD COLUMN `VehicleId` mediumint(8) unsigned NOT NULL default '0' AFTER `PetSpellDataId`; + +-- 2339_world - 2346_world +DELETE FROM `command` WHERE `name` LIKE "ahbotoption %"; +DELETE FROM `command` WHERE `name` LIKE "ahbotoptions %"; + +-- 2412_world +UPDATE `trinity_string` SET `content_default` = 'id: %d effmask: %d charges: %d stack: %d slot %d duration: %d maxduration: %d' WHERE `entry` =468; +UPDATE `trinity_string` SET `content_default` = 'id: %d eff: %d amount: %d' WHERE `trinity_string`.`entry` =470; + +-- 2432_mangos_7615_01_world_command +DELETE FROM `command` WHERE `name` IN ('senditems','sendmail','sendmoney','sendmessage','send items','send mail','send money','send message'); +INSERT INTO `command` VALUES +('send items',3,'Syntax: .send items #playername "#subject" "#text" itemid1[:count1] itemid2[:count2] ... itemidN[:countN]\r\n\r\nSend a mail to a player. Subject and mail text must be in "". If for itemid not provided related count values then expected 1, if count > max items in stack then items will be send in required amount stacks. All stacks amount in mail limited to 12.'), +('send mail',1,'Syntax: .send mail #playername "#subject" "#text"\r\n\r\nSend a mail to a player. Subject and mail text must be in "".'), +('send message',3,'Syntax: .send message $playername $message\r\n\r\nSend screen message to player from ADMINISTRATOR.'), +('send money','3','Syntax: .send money #playername "#subject" "#text" #money\r\n\r\nSend mail with money to a player. Subject and mail text must be in "".'); + +-- 2433_mangos_7616_01_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (1200,1201); +INSERT INTO `trinity_string` VALUES +(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2433_mangos_7616_02_world_command +DELETE FROM `command` WHERE `name` IN ('debug playsound','debug play sound','debug play cinematic','debug play movie'); +INSERT INTO `command` VALUES +('debug play cinematic',1,'Syntax: .debug play cinematic #cinematicid\r\n\r\nPlay cinematic #cinematicid for you. You stay at place while your mind fly.\r\n'), +('debug play movie',1,'Syntax: .debug play movie #movieid\r\n\r\nPlay movie #movieid for you.'), +('debug play sound',1,'Syntax: .debug play sound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'); + +-- 2444_world +DELETE FROM `command` WHERE `name` IN ('reload spell_linked_spell'); +INSERT INTO `command` VALUES +('reload spell_linked_spell','3','Usage: .reload spell_linked_spell\r\nReloads the spell_linked_spell DB table.'); + +-- 2450_world +UPDATE `gameobject_template` SET `ScriptName`='go_jump_a_tron' WHERE `entry`=183146; +UPDATE `gameobject_template` SET `ScriptName`='go_ethereum_prison' WHERE `entry`=184421; +UPDATE `gameobject_template` SET `scriptname`='go_sacred_fire_of_life' WHERE `entry`=175944; +UPDATE `gameobject_template` SET `scriptname`='go_skull_pile' WHERE `entry`=185913; +DELETE FROM `command` WHERE `name` IN ('reload spell_linked_spell'); +INSERT INTO `command` VALUES +('reload spell_linked_spell','3','Usage: .reload spell_linked_spell\r\nReloads the spell_linked_spell DB table.'); + +-- 2479_world +DELETE FROM `trinity_string` WHERE `entry` = 5007; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (5007, 'You must be in a raid group to enter this instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- 2492_mangos_7622_01_world_creature_ai_scripts +DROP TABLE IF EXISTS `creature_ai_scripts`; +CREATE TABLE `creature_ai_scripts` ( + `id` int(11) unsigned NOT NULL COMMENT 'Identifier' AUTO_INCREMENT, + `creature_id` int(11) unsigned NOT NULL default '0' COMMENT 'Creature Template Identifier', + `event_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Event Type', + `event_inverse_phase_mask` int(11) signed NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in', + `event_chance` int(3) unsigned NOT NULL default '100', + `event_flags` int(3) unsigned NOT NULL default '0', + `event_param1` int(11) signed NOT NULL default '0', + `event_param2` int(11) signed NOT NULL default '0', + `event_param3` int(11) signed NOT NULL default '0', + `event_param4` int(11) signed NOT NULL default '0', + `action1_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', + `action1_param1` int(11) signed NOT NULL default '0', + `action1_param2` int(11) signed NOT NULL default '0', + `action1_param3` int(11) signed NOT NULL default '0', + `action2_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', + `action2_param1` int(11) signed NOT NULL default '0', + `action2_param2` int(11) signed NOT NULL default '0', + `action2_param3` int(11) signed NOT NULL default '0', + `action3_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', + `action3_param1` int(11) signed NOT NULL default '0', + `action3_param2` int(11) signed NOT NULL default '0', + `action3_param3` int(11) signed NOT NULL default '0', + `comment` varchar(255) NOT NULL default '' COMMENT 'Event Comment', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts'; + +-- 2492_mangos_7622_02_world_creature_ai_summons +DROP TABLE IF EXISTS `creature_ai_summons`; +CREATE TABLE `creature_ai_summons` ( + `id` int(11) unsigned NOT NULL COMMENT 'Location Identifier' AUTO_INCREMENT, + `position_x` float NOT NULL default '0', + `position_y` float NOT NULL default '0', + `position_z` float NOT NULL default '0', + `orientation` float NOT NULL default '0', + `spawntimesecs` int(11) unsigned NOT NULL default '120', + `comment` varchar(255) NOT NULL default '' COMMENT 'Summon Comment', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations'; + +-- 2492_mangos_7622_03_world_creature_ai_texts +DROP TABLE IF EXISTS `creature_ai_texts`; +CREATE TABLE `creature_ai_texts` ( + `entry` mediumint(8) NOT NULL, + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + `sound` mediumint(8) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `language` tinyint(3) unsigned NOT NULL DEFAULT '0', + `emote` tinyint(3) unsigned NOT NULL DEFAULT '0', + `comment` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; + +-- 2515_world_scripts +UPDATE `creature_template` SET `ScriptName`='mob_giant_infernal' WHERE `entry`=17908; +UPDATE `creature_template` SET `ScriptName`='mob_abomination' WHERE `entry`=17898; +UPDATE `creature_template` SET `ScriptName`='mob_ghoul' WHERE `entry`=17895; +UPDATE `creature_template` SET `ScriptName`='mob_necromancer' WHERE `entry`=17899; +UPDATE `creature_template` SET `ScriptName`='mob_banshee' WHERE `entry`=17905; +UPDATE `creature_template` SET `ScriptName`='mob_crypt_fiend' WHERE `entry`=17897; +UPDATE `creature_template` SET `ScriptName`='mob_fel_stalker' WHERE `entry`=17916; +UPDATE `creature_template` SET `ScriptName`='mob_frost_wyrm' WHERE `entry`=17907; +UPDATE `creature_template` SET `ScriptName`='mob_gargoyle' WHERE `entry`=17906; +UPDATE `creature_template` SET `ScriptName`='alliance_rifleman' WHERE `entry`=17921; +UPDATE `creature_template` SET `ScriptName`='mob_towering_infernal' WHERE `entry`=17818; +UPDATE `creature_template` SET `ScriptName`='boss_anetheron' WHERE `entry`=17808; +UPDATE `creature_template` SET `ScriptName`='boss_azgalor' WHERE `entry`=17842; +UPDATE `creature_template` SET `ScriptName`='mob_lesser_doomguard' WHERE `entry`=17864; +UPDATE `creature_template` SET `ScriptName`='boss_kazrogal' WHERE `entry`=17888; +UPDATE `creature_template` SET `ScriptName`='boss_rage_winterchill' WHERE `entry`=17767; +UPDATE `creature_template` SET `scale`='0.5' WHERE `entry`=17968; +UPDATE `creature_template` SET `equipment_id`='17888' WHERE `entry`=17888; +UPDATE `creature_template` SET `equipment_id`='17921' WHERE `entry`=17921; + +-- 2521_world +-- Sudden Death +DELETE FROM `spell_proc_event` WHERE `entry` IN (29723, 29725, 29724); +INSERT INTO `spell_proc_event` VALUES (29723, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (29725, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (29724, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0); + +-- 2522_mangos_7627_01_world_achievement_criteria_data +DROP TABLE IF EXISTS `achievement_criteria_data`; +CREATE TABLE `achievement_criteria_data` ( + `criteria_id` mediumint(8) NOT NULL, + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`criteria_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Achievment system'; + +-- 2528_mangos_7633_01_world_achievement_criteria_data +ALTER TABLE `achievement_criteria_data` + DROP PRIMARY KEY, + ADD PRIMARY KEY (`criteria_id`,`type`); + +-- 2551_world_spell_bonus_data +-- Judgement +DELETE FROM `spell_bonus_data` WHERE `entry` = 54158; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`comments`) VALUES +('54158','0.25','0','0.16','Paladin - Unleashing spell for Seal of Wisdom, Justice and Light'); + +-- 2559_world_spell_proc_event +-- Fingers of frost triggered spell +DELETE FROM `spell_proc_event` WHERE `entry` IN (44544); +INSERT INTO `spell_proc_event` VALUES (44544, 0x00, 0x00000003, 0x00000000, 0x00100000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0); +-- Sudden Death +DELETE FROM `spell_proc_event` WHERE `entry` IN (29723, 29725, 29724); +INSERT INTO `spell_proc_event` VALUES (29723, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (29725, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (29724, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- 2565_world_SD2_scripts +-- script waypoint +DELETE FROM script_waypoint WHERE entry=467; +INSERT INTO script_waypoint VALUES +(467, 0, -10508.40, 1068.00, 55.21, 0, ''), +(467, 1, -10518.30, 1074.84, 53.96, 0, ''), +(467, 2, -10534.82, 1081.92, 49.88, 0, ''), +(467, 3, -10546.51, 1084.88, 50.13, 0, ''), +(467, 4, -10555.29, 1084.45, 45.75, 0, ''), +(467, 5, -10566.57, 1083.53, 42.10, 0, ''), +(467, 6, -10575.83, 1082.34, 39.46, 0, ''), +(467, 7, -10585.67, 1081.08, 37.77, 0, ''), +(467, 8, -10600.08, 1078.19, 36.23, 0, ''), +(467, 9, -10608.69, 1076.08, 35.88, 0, ''), +(467, 10, -10621.26, 1073.00, 35.40, 0, ''), +(467, 11, -10638.12, 1060.18, 33.61, 0, ''), +(467, 12, -10655.87, 1038.99, 33.48, 0, ''), +(467, 13, -10664.68, 1030.54, 32.70, 0, ''), +(467, 14, -10708.68, 1033.86, 33.32, 0, ''), +(467, 15, -10754.43, 1017.93, 32.79, 0, ''), +(467, 16, -10802.26, 1018.01, 32.16, 0, ''), +(467, 17, -10832.60, 1009.04, 32.71, 0, ''), +(467, 18, -10866.56, 1006.51, 31.71, 0, ''), +(467, 19, -10879.98, 1005.10, 32.84, 0, ''), +(467, 20, -10892.45, 1001.32, 34.46, 0, ''), +(467, 21, -10906.14, 997.11, 36.15, 0, ''), +(467, 22, -10922.26, 1002.23, 35.74, 0, ''), +(467, 23, -10936.32, 1023.38, 36.52, 0, ''), +(467, 24, -10933.35, 1052.61, 35.85, 0, ''), +(467, 25, -10940.25, 1077.66, 36.49, 0, ''), +(467, 26, -10957.09, 1099.33, 36.83, 0, ''), +(467, 27, -10956.53, 1119.90, 36.73, 0, ''), +(467, 28, -10939.30, 1150.75, 37.42, 0, ''), +(467, 29, -10915.14, 1202.09, 36.55, 0, ''), +(467, 30, -10892.59, 1257.03, 33.37, 0, ''), +(467, 31, -10891.93, 1306.66, 35.45, 0, ''), +(467, 32, -10896.17, 1327.86, 37.77, 0, ''), +(467, 33, -10906.03, 1368.05, 40.91, 0, ''), +(467, 34, -10910.18, 1389.33, 42.62, 0, ''), +(467, 35, -10915.42, 1417.72, 42.93, 0, ''), +(467, 36, -10926.37, 1421.18, 43.04, 0, 'walk here and say'), +(467, 37, -10952.31, 1421.74, 43.40, 0, ''), +(467, 38, -10980.04, 1411.38, 42.79, 0, ''), +(467, 39, -11006.06, 1420.47, 43.26, 0, ''), +(467, 40, -11021.98, 1450.59, 43.09, 0, ''), +(467, 41, -11025.36, 1491.59, 43.15, 0, ''), +(467, 42, -11036.09, 1508.32, 43.28, 0, ''), +(467, 43, -11060.68, 1526.72, 43.19, 0, ''), +(467, 44, -11072.75, 1527.77, 43.20, 5000, 'say and quest credit'); +DELETE FROM script_waypoint WHERE entry=2768; +INSERT INTO script_waypoint VALUES +(2768, 0, -2066.45, -2085.96, 9.08, 0, ''), +(2768, 1, -2077.99, -2105.33, 13.24, 0, ''), +(2768, 2, -2074.60, -2109.67, 14.24, 0, ''), +(2768, 3, -2076.60, -2117.46, 16.67, 0, ''), +(2768, 4, -2073.51, -2123.46, 18.42, 2000, ''), +(2768, 5, -2073.51, -2123.46, 18.42, 4000, ''), +(2768, 6, -2066.60, -2131.85, 21.56, 0, ''), +(2768, 7, -2053.85, -2143.19, 20.31, 0, ''), +(2768, 8, -2043.49, -2153.73, 20.20, 10000, ''), +(2768, 9, -2043.49, -2153.73, 20.20, 20000, ''), +(2768, 10, -2043.49, -2153.73, 20.20, 10000, ''), +(2768, 11, -2043.49, -2153.73, 20.20, 2000, ''), +(2768, 12, -2053.85, -2143.19, 20.31, 0, ''), +(2768, 13, -2066.60, -2131.85, 21.56, 0, ''), +(2768, 14, -2073.51, -2123.46, 18.42, 0, ''), +(2768, 15, -2076.60, -2117.46, 16.67, 0, ''), +(2768, 16, -2074.60, -2109.67, 14.24, 0, ''), +(2768, 17, -2077.99, -2105.33, 13.24, 0, ''), +(2768, 18, -2066.45, -2085.96, 9.08, 0, ''), +(2768, 19, -2066.41, -2086.21, 8.97, 6000, ''), +(2768, 20, -2066.41, -2086.21, 8.97, 2000, ''); +DELETE FROM script_waypoint WHERE entry=12818; +INSERT INTO script_waypoint VALUES +(12818, 0, 3347.250089, -694.700989, 159.925995, 0, ''), +(12818, 1, 3341.527039, -694.725891, 161.124542, 4000, ''), +(12818, 2, 3338.351074, -686.088138, 163.444000, 0, ''), +(12818, 3, 3352.744873, -677.721741, 162.316269, 0, ''), +(12818, 4, 3370.291016, -669.366943, 160.751358, 0, ''), +(12818, 5, 3381.479492, -659.449097, 162.545303, 0, ''), +(12818, 6, 3389.554199, -648.500000, 163.651825, 0, ''), +(12818, 7, 3396.645020, -641.508911, 164.216019, 0, ''), +(12818, 8, 3410.498535, -634.299622, 165.773453, 0, ''), +(12818, 9, 3418.461426, -631.791992, 166.477615, 0, ''), +(12818, 10, 3429.500000, -631.588745, 166.921265, 0, ''), +(12818, 11,3434.950195, -629.245483, 168.333969, 0, ''), +(12818, 12,3438.927979, -618.503235, 171.503143, 0, ''), +(12818, 13,3444.217529, -609.293640, 173.077972, 1000, 'Ambush 1'), +(12818, 14,3460.505127, -593.794189, 174.342255, 0, ''), +(12818, 15,3480.283203, -578.210327, 176.652313, 0, ''), +(12818, 16,3492.912842, -562.335449, 181.396301, 0, ''), +(12818, 17,3495.230957, -550.977600, 184.652267, 0, ''), +(12818, 18,3496.247070, -529.194214, 188.172028, 0, ''), +(12818, 19,3497.619385, -510.411499, 188.345322, 1000, 'Ambush 2'), +(12818, 20,3498.498047, -497.787506, 185.806274, 0, ''), +(12818, 21,3484.218750, -489.717529, 182.389862, 4000, ''); +DELETE FROM script_waypoint WHERE entry=12858; +INSERT INTO script_waypoint VALUES +(12858, 0, 1782.63, -2241.11, 109.73, 5000, ''), +(12858, 1, 1788.88, -2240.17, 111.71, 0, ''), +(12858, 2, 1797.49, -2238.11, 112.31, 0, ''), +(12858, 3, 1803.83, -2232.77, 111.22, 0, ''), +(12858, 4, 1806.65, -2217.83, 107.36, 0, ''), +(12858, 5, 1811.81, -2208.01, 107.45, 0, ''), +(12858, 6, 1820.85, -2190.82, 100.49, 0, ''), +(12858, 7, 1829.60, -2177.49, 96.44, 0, ''), +(12858, 8, 1837.98, -2164.19, 96.71, 0, 'prepare'), +(12858, 9, 1839.99, -2149.29, 96.78, 0, ''), +(12858, 10, 1835.14, -2134.98, 96.80, 0, ''), +(12858, 11, 1823.57, -2118.27, 97.43, 0, ''), +(12858, 12, 1814.99, -2110.35, 98.38, 0, ''), +(12858, 13, 1806.60, -2103.09, 99.19, 0, ''), +(12858, 14, 1798.27, -2095.77, 100.04, 0, ''), +(12858, 15, 1783.59, -2079.92, 100.81, 0, ''), +(12858, 16, 1776.79, -2069.48, 101.77, 0, ''), +(12858, 17, 1776.82, -2054.59, 109.82, 0, ''), +(12858, 18, 1776.88, -2047.56, 109.83, 0, ''), +(12858, 19, 1776.86, -2036.55, 109.83, 0, ''), +(12858, 20, 1776.90, -2024.56, 109.83, 0, 'win'), +(12858, 21, 1776.87, -2028.31, 109.83,60000, 'stay'), +(12858, 22, 1776.90, -2028.30, 109.83, 0, ''); +DELETE FROM script_waypoint WHERE entry=15420; +INSERT INTO script_waypoint VALUES +(15420, 0, 9294.78, -6682.51, 22.42, 0, ''), +(15420, 1, 9298.27, -6667.99, 22.42, 0, ''), +(15420, 2, 9309.63, -6658.84, 22.43, 0, ''), +(15420, 3, 9304.43, -6649.31, 26.46, 0, ''), +(15420, 4, 9298.83, -6648.00, 28.61, 0, ''), +(15420, 5, 9291.06, -6653.46, 31.83,2500, ''), +(15420, 6, 9289.08, -6660.17, 31.85,5000, ''), +(15420, 7, 9291.06, -6653.46, 31.83, 0, ''); +DELETE FROM script_waypoint WHERE entry=16993; +INSERT INTO script_waypoint VALUES +(16993, 0, -1137.72, 4272.10, 14.04, 5000, ''), +(16993, 1, -1141.34, 4232.42, 14.63, 0, ''), +(16993, 2, -1133.47, 4220.88, 11.78, 0, ''), +(16993, 3, -1126.18, 4213.26, 13.51, 0, ''), +(16993, 4, -1100.12, 4204.32, 16.41, 0, ''), +(16993, 5, -1063.68, 4197.92, 15.51, 0, ''), +(16993, 6, -1027.28, 4194.36, 15.52, 0, ''), +(16993, 7, -995.68, 4189.59, 19.84, 0, ''), +(16993, 8, -970.90, 4188.60, 24.61, 0, ''), +(16993, 9, -961.93, 4193.34, 26.11, 15000, 'Summon 1'), +(16993, 10, -935.52, 4210.99, 31.98, 0, ''), +(16993, 11, -913.42, 4218.27, 37.29, 0, ''), +(16993, 12, -896.53, 4207.73, 43.23, 0, ''), +(16993, 13, -868.49, 4194.77, 46.75, 30000, 'Kneel and Rest Here'), +(16993, 14, -852.83, 4198.29, 47.28, 15000, 'Summon 2'), +(16993, 15, -819.85, 4200.50, 46.37, 0, ''), +(16993, 16, -791.92, 4201.96, 44.19, 0, ''), +(16993, 17, -774.42, 4202.46, 47.41, 0, ''), +(16993, 18, -762.90, 4202.17, 48.81, 0, ''), +(16993, 19, -728.25, 4195.35, 50.68, 0, ''), +(16993, 20, -713.58, 4192.07, 53.98, 0, ''), +(16993, 21, -703.09, 4189.74, 56.96, 0, ''), +(16993, 22, -693.70, 4185.43, 57.06, 0, ''), +(16993, 23, -686.38, 4159.81, 60.26, 0, ''), +(16993, 24, -679.88, 4147.04, 64.20, 0, ''), +(16993, 25, -656.74, 4147.72, 64.11, 0, ''), +(16993, 26, -652.22, 4137.50, 64.58, 0, ''), +(16993, 27, -649.99, 4136.38, 64.63, 30000, 'Quest Credit'); +DELETE FROM script_waypoint WHERE entry=17312; +INSERT INTO script_waypoint VALUES +(17312, 0, -4784.532227, -11051.060547, 3.484263, 0, ''), +(17312, 1, -4805.509277, -11037.293945, 3.043942, 0, ''), +(17312, 2, -4827.826172, -11034.398438, 1.741959, 0, ''), +(17312, 3, -4852.630859, -11033.695313, 2.208656, 0, ''), +(17312, 4, -4876.791992, -11034.517578, 3.175228, 0, ''), +(17312, 5, -4895.486816, -11038.306641, 9.390890, 0, ''), +(17312, 6, -4915.464844, -11048.402344, 12.369793, 0, ''), +(17312, 7, -4937.288086, -11067.041992, 13.857983, 0, ''), +(17312, 8, -4966.577637, -11067.507813, 15.754786, 0, ''), +(17312, 9, -4993.799805, -11056.544922, 19.175295, 0, ''), +(17312, 10, -5017.836426, -11052.569336, 22.476587, 0, ''), +(17312, 11, -5039.706543, -11058.459961, 25.831593, 0, ''), +(17312, 12, -5057.289063, -11045.474609, 26.972496, 0, ''), +(17312, 13, -5078.828125, -11037.601563, 29.053417, 0, ''), +(17312, 14, -5104.158691, -11039.195313, 29.440195, 0, ''), +(17312, 15, -5120.780273, -11039.518555, 30.142139, 0, ''), +(17312, 16, -5140.833008, -11039.810547, 28.788074, 0, ''), +(17312, 17, -5161.201660, -11040.050781, 27.879545, 4000, ''), +(17312, 18, -5171.842285, -11046.803711, 27.183821, 0, ''), +(17312, 19, -5185.995117, -11056.359375, 20.234867, 0, ''), +(17312, 20, -5198.485840, -11065.065430, 18.872593, 0, ''), +(17312, 21, -5214.062500, -11074.653320, 19.215731, 0, ''), +(17312, 22, -5220.157227, -11088.377930, 19.818476, 0, ''), +(17312, 23, -5233.652832, -11098.846680, 18.349432, 0, ''), +(17312, 24, -5250.163086, -11111.653320, 16.438959, 0, ''), +(17312, 25, -5268.194336, -11125.639648, 12.668313, 0, ''), +(17312, 26, -5286.270508, -11130.669922, 6.912246, 0, ''), +(17312, 27, -5317.449707, -11137.392578, 4.963446, 0, ''), +(17312, 28, -5334.854492, -11154.384766, 6.742664, 0, ''), +(17312, 29, -5353.874512, -11171.595703, 6.903912, 20000, ''), +(17312, 30, -5354.240000, -11171.940000, 6.890000, 0, ''); +DELETE FROM script_waypoint WHERE entry=19685; +INSERT INTO script_waypoint VALUES +(19685, 0, -1863.369019, 5419.517090, -10.463668, 5000, ''), +(19685, 1, -1861.749023, 5416.465332, -10.508068, 0, ''), +(19685, 2, -1857.036133, 5410.966309, -12.428039, 0, ''), +(19685, 3, -1831.539185, 5365.472168, -12.428039, 0, ''), +(19685, 4, -1813.416504, 5333.776855, -12.428039, 0, ''), +(19685, 5, -1800.354370, 5313.290039, -12.428039, 0, ''), +(19685, 6, -1775.624878, 5268.786133, -38.809181, 0, ''), +(19685, 7, -1770.147339, 5259.268066, -38.829231, 0, ''), +(19685, 8, -1762.814209, 5261.098145, -38.848995, 0, ''), +(19685, 9, -1740.110474, 5268.858398, -40.208965, 0, ''), +(19685, 10, -1725.837402, 5270.936035, -40.208965, 0, ''), +(19685, 11, -1701.580322, 5290.323242, -40.209187, 0, ''), +(19685, 12, -1682.877808, 5291.406738, -34.429646, 0, ''), +(19685, 13, -1670.101685, 5291.201172, -32.786007, 0, ''), +(19685, 14, -1656.666870, 5294.333496, -37.862648, 0, ''), +(19685, 15, -1652.035767, 5295.413086, -40.245499, 0, ''), +(19685, 16, -1620.860596, 5300.133301, -40.208992, 0, ''), +(19685, 17, -1607.630981, 5293.983398, -38.577045, 5000, ''), +(19685, 18, -1607.630981, 5293.983398, -38.577045, 5000, ''), +(19685, 19, -1607.630981, 5293.983398, -38.577045, 5000, ''), +(19685, 20, -1622.140869, 5301.955566, -40.208897, 0, ''), +(19685, 21, -1621.131836, 5333.112793, -40.208897, 0, ''), +(19685, 22, -1637.598999, 5342.134277, -40.208790, 0, ''), +(19685, 23, -1648.521606, 5352.309570, -47.496170, 0, ''), +(19685, 24, -1654.606934, 5357.419434, -45.870892, 0, ''), +(19685, 25, -1633.670044, 5422.067871, -42.835541, 0, ''), +(19685, 26, -1656.567505, 5426.236328, -40.405815, 0, ''), +(19685, 27, -1664.932373, 5425.686523, -38.846405, 0, ''), +(19685, 28, -1681.406006, 5425.871094, -38.810928, 0, ''), +(19685, 29, -1730.875977, 5427.413574, -12.427910, 0, ''), +(19685, 30, -1743.509521, 5369.599121, -12.427910, 0, ''), +(19685, 31, -1877.217041, 5303.710449, -12.427989, 0, ''), +(19685, 32, -1890.371216, 5289.273438, -12.428268, 0, ''), +(19685, 33, -1905.505737, 5266.534668, 2.630672, 0, ''), +(19685, 34, -1909.381348, 5273.008301, 1.663714, 10000, ''), +(19685, 35, -1909.381348, 5273.008301, 1.663714, 12000, ''), +(19685, 36, -1909.381348, 5273.008301, 1.663714, 8000, ''), +(19685, 37, -1909.381348, 5273.008301, 1.663714, 15000, ''), +(19685, 38, -1927.561401, 5275.324707, 1.984987, 0, ''), +(19685, 39, -1927.385498, 5300.879883, -12.427236, 0, ''), +(19685, 40, -1921.063965, 5314.318359, -12.427236, 0, ''), +(19685, 41, -1965.425415, 5379.298828, -12.427236, 0, ''), +(19685, 42, -1981.233154, 5450.743652, -12.427236, 0, ''), +(19685, 43, -1958.022461, 5455.904297, 0.487659, 0, ''), +(19685, 44, -1951.991455, 5463.580566, 0.874490, 10000, ''), +(19685, 45, -1951.991455, 5463.580566, 0.874490, 12000, ''), +(19685, 46, -1968.730225, 5481.752930, -12.427846, 0, ''), +(19685, 47, -1881.839844, 5554.040039, -12.427846, 0, ''), +(19685, 48, -1841.566650, 5545.965332, -12.427846, 0, ''), +(19685, 49, -1837.658325, 5523.780273, 0.558756, 0, ''), +(19685, 50, -1831.321777, 5534.821777, 1.221819, 6000, ''), +(19685, 51, -1831.321777, 5534.821777, 1.221819, 8000, ''), +(19685, 52, -1831.321777, 5534.821777, 1.221819, 5000, ''), +(19685, 53, -1850.060669, 5472.610840, 0.857320, 6000, ''), +(19685, 54, -1850.060669, 5472.610840, 0.857320, 8000, ''), +(19685, 55, -1850.060669, 5472.610840, 0.857320, 9000, ''), +(19685, 56, -1850.060669, 5472.610840, 0.857320, 9000, ''), +(19685, 57, -1850.060669, 5472.610840, 0.857320, 4000, ''); +DELETE FROM script_waypoint WHERE entry=20129; +INSERT INTO script_waypoint VALUES +(20129, 0, -8374.93,-4250.21, -204.38,5000, ''), +(20129, 1, -8374.93,-4250.21, -204.38,16000, ''), +(20129, 2, -8374.93,-4250.21, -204.38,10000, ''), +(20129, 3, -8374.93,-4250.21, -204.38,2000, ''), +(20129, 4, -8439.40,-4180.05, -209.25, 0, ''), +(20129, 5, -8437.82,-4120.84, -208.59,10000, ''), +(20129, 6, -8437.82,-4120.84, -208.59,16000, ''), +(20129, 7, -8437.82,-4120.84, -208.59,13000, ''), +(20129, 8, -8437.82,-4120.84, -208.59,18000, ''), +(20129, 9, -8437.82,-4120.84, -208.59,15000, ''), +(20129, 10, -8437.82,-4120.84, -208.59,2000, ''), +(20129, 11, -8467.26,-4198.63, -214.21, 0, ''), +(20129, 12, -8667.76,-4252.13, -209.56, 0, ''), +(20129, 13, -8703.71,-4234.58, -209.5,14000, ''), +(20129, 14, -8703.71,-4234.58, -209.5,2000, ''), +(20129, 15, -8642.81,-4304.37, -209.57, 0, ''), +(20129, 16, -8649.06,-4394.36, -208.46,6000, ''), +(20129, 17, -8649.06,-4394.36, -208.46,18000, ''), +(20129, 18, -8649.06,-4394.36, -208.46,2000, ''), +(20129, 19, -8468.72,-4437.67, -215.45, 0, ''), +(20129, 20, -8427.54,-4426, -211.13, 0, ''), +(20129, 21, -8364.83,-4393.32, -205.91, 0, ''), +(20129, 22, -8304.54,-4357.2, -208.2,18000, ''), +(20129, 23, -8304.54,-4357.2, -208.2,2000, ''), +(20129, 24, -8375.42,-4250.41, -205.14,5000, ''), +(20129, 25, -8375.42,-4250.41, -205.14,5000, ''); +DELETE FROM script_waypoint WHERE entry=6575; +INSERT INTO script_waypoint VALUES +(6575, 0, 1945.81, -431.54, 16.36, 0, ''), +(6575, 1, 1946.21, -436.41, 16.36, 0, ''), +(6575, 2, 1950.01, -444.11, 14.63, 0, ''), +(6575, 3, 1956.08, -449.34, 13.12, 0, ''), +(6575, 4, 1966.59, -450.55, 11.27, 0, ''), +(6575, 5, 1976.09, -447.51, 11.27, 0, ''), +(6575, 6, 1983.42, -435.85, 11.27, 0, ''), +(6575, 7, 1978.17, -428.81, 11.27, 0, ''), +(6575, 8, 1973.97, -422.08, 9.04, 0, ''), +(6575, 9, 1963.84, -418.90, 6.17, 0, ''), +(6575, 10, 1961.22, -422.74, 6.17, 0, ''), +(6575, 11, 1964.80, -431.26, 6.17, 300000, ''); +DELETE FROM script_waypoint WHERE entry=3849; +INSERT INTO script_waypoint VALUES +(3849, 0, -252.92, 2126.82, 81.17, 0, ''), +(3849, 1, -253.88, 2131.11, 81.21, 0, ''), +(3849, 2, -249.66, 2142.45, 87.01, 0, ''), +(3849, 3, -248.08, 2143.68, 87.01, 0, ''), +(3849, 4, -238.87, 2139.93, 87.01, 0, ''), +(3849, 5, -235.47, 2149.18, 90.59, 0, ''), +(3849, 6, -239.89, 2156.06, 90.62, 20000, 'SAY_FREE'); +DELETE FROM script_waypoint WHERE entry=3850; +INSERT INTO script_waypoint VALUES +(3850, 0, -255.33, 2117.99, 81.17, 0, ''), +(3850, 1, -253.88, 2131.11, 81.21, 0, ''), +(3850, 2, -249.66, 2142.45, 87.01, 0, ''), +(3850, 3, -248.08, 2143.68, 87.01, 0, ''), +(3850, 4, -238.87, 2139.93, 87.01, 0, ''), +(3850, 5, -235.47, 2149.18, 90.59, 0, ''), +(3850, 6, -239.89, 2156.06, 90.62, 20000, 'SAY_FREE'); +-- Henry Stern +UPDATE `creature_template` SET `ScriptName`='npc_henry_stern' WHERE `entry`=8696; +DELETE FROM `trinity_string` WHERE `entry` IN (59); +INSERT INTO `trinity_string` VALUES +(59,'Using creature EventAI: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2570_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (47988,47987,27272,17854,17853,17852,17851,17850,17767); +INSERT INTO `spell_linked_spell` VALUES (47988, 54501, 2, 'Consume Shadows - Rank 9'); +INSERT INTO `spell_linked_spell` VALUES (47987, 54501, 2, 'Consume Shadows - Rank 8'); +INSERT INTO `spell_linked_spell` VALUES (27272, 54501, 2, 'Consume Shadows - Rank 7'); +INSERT INTO `spell_linked_spell` VALUES (17854, 54501, 2, 'Consume Shadows - Rank 6'); +INSERT INTO `spell_linked_spell` VALUES (17853, 54501, 2, 'Consume Shadows - Rank 5'); +INSERT INTO `spell_linked_spell` VALUES (17852, 54501, 2, 'Consume Shadows - Rank 4'); +INSERT INTO `spell_linked_spell` VALUES (17851, 54501, 2, 'Consume Shadows - Rank 3'); +INSERT INTO `spell_linked_spell` VALUES (17850, 54501, 2, 'Consume Shadows - Rank 2'); +INSERT INTO `spell_linked_spell` VALUES (17767, 54501, 2, 'Consume Shadows - Rank 1'); + +-- 2586_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (53563); +INSERT INTO `spell_linked_spell` VALUES (53563, 53651, 2, 'Beacon of Light'); +DELETE FROM `spell_proc_event` WHERE `entry` IN (53651); +INSERT INTO `spell_proc_event` VALUES +(53651, 0x00, 10, 0xC0008000, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); + +-- 2591_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (16857,17390,17391,17392,27011,48475); +INSERT INTO `spell_linked_spell` VALUES (16857, 60089, 0, 'Faerie Fire (Feral) Rank 1'); +INSERT INTO `spell_linked_spell` VALUES (17390, 60089, 0, 'Faerie Fire (Feral) Rank 2'); +INSERT INTO `spell_linked_spell` VALUES (17391, 60089, 0, 'Faerie Fire (Feral) Rank 3'); +INSERT INTO `spell_linked_spell` VALUES (17392, 60089, 0, 'Faerie Fire (Feral) Rank 4'); +INSERT INTO `spell_linked_spell` VALUES (27011, 60089, 0, 'Faerie Fire (Feral) Rank 5'); +INSERT INTO `spell_linked_spell` VALUES (48475, 60089, 0, 'Faerie Fire (Feral) Rank 6'); + +-- 2617_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (781, 57635, 60932, 61507, 49576); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(781, 56446, 0, 'Disengage'), +(57635, 57636, 0, 'Disengage'), +(60932, 60934, 0, 'Disengage'), +(61507, 61508, 0, 'Disengage'), +(49576, 49560, 0, 'Death Grip'); + +-- 2629_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (47897,61290); +INSERT INTO `spell_linked_spell` VALUES (47897, 47960, 1, 'Shadowflame Rank 1'); +INSERT INTO `spell_linked_spell` VALUES (61290, 61291, 1, 'Shadowflame Rank 2'); + +-- 2678_mangos_7662_01_world_spell_bonus_data +DELETE FROM `spell_bonus_data` WHERE entry IN (50288, 50294); +INSERT INTO `spell_bonus_data` VALUES +(50288, 0.05, 0, 0, "Druid - Starfall"), +(50294, 0.012, 0, 0, "Druid - Starfall AOE"); + +-- 2682_world_SD2_scripts +DELETE FROM script_waypoint WHERE entry=3849; +INSERT INTO script_waypoint VALUES +(3849, 0, -250.923431, 2116.264160, 81.179, 0, 'SAY_FREE_AD'), +(3849, 1, -255.048538, 2119.392578, 81.179, 0, ''), +(3849, 2, -254.129105, 2123.454346, 81.179, 0, ''), +(3849, 3, -253.897552, 2130.873535, 81.179, 0, ''), +(3849, 4, -249.889435, 2142.307861, 86.972, 0, ''), +(3849, 5, -248.204926, 2144.017090, 87.013, 0, ''), +(3849, 6, -240.552826, 2140.552734, 87.012, 0, ''), +(3849, 7, -237.513916, 2142.066650, 87.012, 0, ''), +(3849, 8, -235.638138, 2149.231689, 90.587, 0, ''), +(3849, 9, -237.188019, 2151.946045, 90.624, 0, ''), +(3849, 10, -241.162064, 2153.649658, 90.624, 0, 'SAY_OPEN_DOOR_AD'), +(3849, 11, -241.129700, 2154.562988, 90.624, 5000, ''), +(3849, 12, -241.129700, 2154.562988, 90.624, 5000, 'SAY_POST1_DOOR_AD'), +(3849, 13, -241.129700, 2154.562988, 90.624, 25000, 'SAY_POST2_DOOR_AD'); + +DELETE FROM script_waypoint WHERE entry=3850; +INSERT INTO script_waypoint VALUES +(3850, 0, -241.816895, 2122.904053, 81.179, 0, 'SAY_FREE_AS'), +(3850, 1, -247.139297, 2124.886475, 81.179, 0, ''), +(3850, 2, -253.179184, 2127.406738, 81.179, 0, ''), +(3850, 3, -253.897552, 2130.873535, 81.179, 0, ''), +(3850, 4, -249.889435, 2142.307861, 86.972, 0, ''), +(3850, 5, -248.204926, 2144.017090, 87.013, 0, ''), +(3850, 6, -240.552826, 2140.552734, 87.012, 0, ''), +(3850, 7, -237.513916, 2142.066650, 87.012, 0, ''), +(3850, 8, -235.638138, 2149.231689, 90.587, 0, ''), +(3850, 9, -237.188019, 2151.946045, 90.624, 0, ''), +(3850, 10, -241.162064, 2153.649658, 90.624, 0, 'SAY_OPEN_DOOR_AS'), +(3850, 11, -241.129700, 2154.562988, 90.624, 5000, 'cast'), +(3850, 12, -241.129700, 2154.562988, 90.624, 5000, 'SAY_POST_DOOR_AS'), +(3850, 13, -241.129700, 2154.562988, 90.624, 25000, ''); + +UPDATE script_texts SET content_default='Follow me and I\'ll open the courtyard door for you.', language=7, comment='prisoner ashcrombe SAY_FREE_AS' WHERE entry=-1033000; + +DELETE FROM script_texts WHERE entry BETWEEN -1033008 AND -1033001; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1033001,'I have just the spell to get this door open. Too bad the cell doors weren\'t locked so haphazardly.',0,0,7,1,'prisoner ashcrombe SAY_OPEN_DOOR_AS'), +(-1033002,'There it is! Wide open. Good luck to you conquering what lies beyond. I must report back to the Kirin Tor at once!',0,0,7,1,'prisoner ashcrombe SAY_POST_DOOR_AS'), +(-1033003,'Free from this wretched cell at last! Let me show you to the courtyard....',0,0,1,1,'prisoner adamant SAY_FREE_AD'), +(-1033004,'You are indeed courageous for wanting to brave the horrors that lie beyond this door.',0,0,1,1,'prisoner adamant SAY_OPEN_DOOR_AD'), +(-1033005,'There we go!',0,0,1,1,'prisoner adamant SAY_POST1_DOOR_AD'), +(-1033006,'Good luck with Arugal. I must hurry back to Hadrec now.',0,0,1,1,'prisoner adamant SAY_POST2_DOOR_AD'), +(-1033007,'About time someone killed the wretch.',0,0,1,1,'prisoner adamant SAY_BOSS_DIE_AD'), +(-1033008,'For once I agree with you... scum.',0,0,7,1,'prisoner ashcrombe SAY_BOSS_DIE_AS'); + +-- 2683_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry`=2025; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +('2025','|cff00ff00Created|r:|cff00ccff %s ago|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2685_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (56337, 56336, 56333); +INSERT INTO `spell_proc_event` VALUES +(56337, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +(56336, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +(56333, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00022200, 0x0000000, 0.000000, 0.000000, 0); + +-- 2686_world_command +DELETE FROM `command` WHERE `name` IN ('go ticket'); +INSERT INTO `command` VALUES +('go ticket','1','Syntax: .go ticket #ticketid\r\nTeleports the user to the location where $ticketid was created.'); + +-- 2687_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (44545, 44543); +INSERT INTO `spell_proc_event` VALUES +(44545, 0x00, 3, 1049120, 4096, 0, 65536, 0x0000000, 0.000000, 15.000000, 0), +(44543, 0x00, 3, 1049120, 4096, 0, 65536, 0x0000000, 0.000000, 7.000000, 0); + +-- 2689_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (51723); +INSERT INTO `spell_linked_spell` VALUES (51723, 52874, 0, 'Fan Of Knives'); + +-- 2702_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (56337, 56336, 56333); +INSERT INTO `spell_proc_event` VALUES +(56337, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00011100, 0x0000000, 0.000000, 0.000000, 0), +(56336, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00011100, 0x0000000, 0.000000, 0.000000, 0), +(56333, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00011100, 0x0000000, 0.000000, 0.000000, 0); + +-- 2706_world_SD2_scripts +UPDATE creature_template SET ScriptName='npc_kingdom_of_dalaran_quests' WHERE entry IN (29169,23729,26673,27158,29158,29161,26471,29155,29159,29160,29162); +DELETE FROM spell_target_position WHERE id=53360; +INSERT INTO spell_target_position VALUES +(53360, 571, 5807.829, 587.960, 660.939, 1.663); + +-- 2715_TC1_1362_world_creature_linked_respawn +DROP TABLE IF EXISTS `creature_linked_respawn`; +CREATE TABLE `creature_linked_respawn` ( + `guid` int(10) unsigned NOT NULL COMMENT 'dependent creature', + `linkedGuid` int(10) unsigned NOT NULL COMMENT 'master creature', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Creature Respawn Link System'; +DELETE FROM `trinity_string` WHERE `entry` = '750'; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +('750', 'linkGUID: %u, Entry: %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- 2724_TC1_world_1371_script +UPDATE `creature_template` SET `ScriptName` = 'mob_unkor_the_ruthless' WHERE `entry` = 18262; + +-- 2774_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (56337, 56336, 56333, 58426, 31221, 31222, 31223); +INSERT INTO `spell_proc_event` VALUES +(56337, 0x00, 9, 0x00000004, 0x00000000, 0x00000040, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +(56336, 0x00, 9, 0x00000004, 0x00000000, 0x00000040, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +(56333, 0x00, 9, 0x00000004, 0x00000000, 0x00000040, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +-- Overkill +(58426, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0), +-- Master of subtlety +(31221, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0), +(31222, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0), +(31223, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0); + +-- 2792_world_spell_bonus_data +DELETE FROM `spell_bonus_data` WHERE entry IN (33778); +INSERT INTO `spell_bonus_data` VALUES +(33778, 0.6453, 0, 0, "Lifebloom- final effect"); + +-- 2792_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (16180, 16198, 16196); +INSERT INTO `spell_proc_event` VALUES +(16180, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x0000002, 0.000000, 0.000000, 0), +(16198, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x0000002, 0.000000, 0.000000, 0), +(16196, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x0000002, 0.000000, 0.000000, 0); + +-- 2793_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (54754); +INSERT INTO `spell_proc_event` VALUES +(54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); + +-- 2794_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (54754); +INSERT INTO `spell_proc_event` VALUES +(54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); + +-- 2798_world_SD2_scripts +UPDATE gameobject_template SET ScriptName='go_tele_to_dalaran_crystal' WHERE entry=191230; +UPDATE gameobject_template SET ScriptName='go_tele_to_violet_stand' WHERE entry=191229; + +-- 2802_world_SD2_scripts +DELETE FROM script_waypoint WHERE entry=17876; +INSERT INTO script_waypoint VALUES +(17876, 0, 2230.91, 118.765, 82.2947,5000, ''), +(17876, 1, 2230.33, 114.980, 82.2946, 0, ''), +(17876, 2, 2233.36, 111.057, 82.2996, 0, ''), +(17876, 3, 2231.17, 108.486, 82.6624, 0, ''), +(17876, 4, 2220.22, 114.605, 89.4264, 0, ''), +(17876, 5, 2215.23, 115.990, 89.4549, 0, ''), +(17876, 6, 2210.00, 106.849, 89.4549, 0, ''), +(17876, 7, 2205.66, 105.234, 89.4549, 0, ''), +(17876, 8, 2192.26, 112.618, 89.4549, 0, 'spawn armorer'), +(17876, 9, 2181.28, 118.612, 89.4549,8000, 'get weapon'), +(17876, 10, 2181.62, 120.385, 89.4549,5000, 'get armor'), +(17876, 11, 2189.44, 113.922, 89.4549, 0, ''), +(17876, 12, 2195.63, 110.584, 89.4549, 0, ''), +(17876, 13, 2201.09, 115.115, 89.4549, 0, ''), +(17876, 14, 2204.34, 121.036, 89.4355, 0, ''), +(17876, 15, 2208.66, 129.127, 87.9560, 0, 'first ambush'), +(17876, 16, 2193.09, 137.940, 88.2164, 0, ''), +(17876, 17, 2173.39, 149.064, 87.9227, 0, ''), +(17876, 18, 2164.25, 137.965, 85.0595, 0, ''), +(17876, 19, 2149.31, 125.645, 77.0858, 0, ''), +(17876, 20, 2142.78, 127.173, 75.5954, 0, ''), +(17876, 21, 2139.28, 133.952, 73.6386, 0, 'second ambush'), +(17876, 22, 2139.54, 155.235, 67.1269, 0, ''), +(17876, 23, 2145.38, 167.551, 64.8974, 0, ''), +(17876, 24, 2134.28, 175.304, 67.9446, 0, ''), +(17876, 25, 2118.08, 187.387, 68.8141, 0, ''), +(17876, 26, 2105.88, 195.461, 65.1854, 0, 'third ambush'), +(17876, 27, 2096.77, 196.939, 65.2117, 0, ''), +(17876, 28, 2083.90, 209.395, 64.8736, 0, ''), +(17876, 29, 2067.84, 224.376, 64.8022,30000, 'meeting scarloc'), +(17876, 30, 2055.40, 242.90, 63.3418, 0, 'after skarloc'), +(17876, 31, 2039.20, 266.460, 63.0182,10000, 'mount up'), +(17876, 32, 2011.77, 278.478, 65.3388, 0, ''), +(17876, 33, 2005.08, 289.676, 66.1179, 0, ''), +(17876, 34, 2033.11, 337.450, 66.0948, 0, ''), +(17876, 35, 2070.30, 416.208, 66.0893, 0, ''), +(17876, 36, 2086.76, 469.768, 65.9182, 0, ''), +(17876, 37, 2101.70, 497.955, 61.7881, 0, 'road ambush'), +(17876, 38, 2133.39, 530.933, 55.3700,5000, ''), +(17876, 39, 2157.91, 559.635, 48.5157, 0, ''), +(17876, 40, 2167.34, 586.191, 42.4394, 0, ''), +(17876, 41, 2174.17, 637.643, 33.9002, 0, ''), +(17876, 42, 2179.31, 656.053, 34.723, 0, ''), +(17876, 43, 2183.65, 670.941, 34.0318, 0, ''), +(17876, 44, 2201.50, 668.616, 36.1236, 0, ''), +(17876, 45, 2221.56, 652.747, 36.6153, 0, ''), +(17876, 46, 2238.97, 640.125, 37.2214, 0, ''), +(17876, 47, 2251.17, 620.574, 40.1473, 0, ''), +(17876, 48, 2261.98, 595.303, 41.4117, 0, ''), +(17876, 49, 2278.67, 560.172, 38.9090, 0, ''), +(17876, 50, 2336.72, 528.327, 40.9369, 0, ''), +(17876, 51, 2381.04, 519.612, 37.7312, 0, ''), +(17876, 52, 2412.20, 515.425, 39.2068, 0, ''), +(17876, 53, 2452.39, 516.174, 42.9387, 0, ''), +(17876, 54, 2467.38, 539.389, 47.4992, 0, ''), +(17876, 55, 2470.70, 554.333, 46.6668, 0, ''), +(17876, 56, 2478.07, 575.321, 55.4549, 0, ''), +(17876, 57, 2480.00, 585.408, 56.6921, 0, ''), +(17876, 58, 2482.67, 608.817, 55.6643, 0, ''), +(17876, 59, 2485.62, 626.061, 58.0132, 2000, 'dismount'), +(17876, 60, 2486.91, 626.356, 58.0761, 0, 'scare horse'), +(17876, 61, 2488.58, 660.940, 57.3913, 0, ''), +(17876, 62, 2502.56, 686.059, 55.6252, 0, ''), +(17876, 63, 2502.08, 694.360, 55.5083, 0, ''), +(17876, 64, 2491.46, 694.321, 55.7163, 0, ''), +(17876, 65, 2491.10, 703.300, 55.7630, 0, ''), +(17876, 66, 2485.64, 702.992, 55.7917, 0, ''), +(17876, 67, 2479.10, 695.291, 55.7901, 10000, ''), +(17876, 68, 2476.75, 693.689, 55.7960, 0, 'spawn mobs'), +(17876, 69, 2475.39, 695.983, 55.8146, 0, ''), +(17876, 70, 2477.75, 694.473, 55.7945, 0, ''), +(17876, 71, 2481.27, 697.747, 55.7910, 0, 'mobs in doorway'), +(17876, 72, 2486.31, 703.131, 55.7861, 5000, ''), +(17876, 73, 2490.76, 703.511, 55.7662, 0, ''), +(17876, 74, 2491.30, 694.792, 55.7195, 0, ''), +(17876, 75, 2518.69, 693.876, 55.1383, 0, ''), +(17876, 76, 2531.33, 681.914, 55.1383, 0, ''), +(17876, 77, 2568.25, 682.654, 55.1778, 0, ''), +(17876, 78, 2589.61, 689.981, 55.1421, 0, ''), +(17876, 79, 2634.74, 679.833, 54.6613, 0, ''), +(17876, 80, 2630.41, 661.464, 54.2761, 0, ''), +(17876, 81, 2629.00, 656.982, 56.0651, 0, ''), +(17876, 82, 2620.84, 633.007, 56.0300, 3000, 'stop in church'), +(17876, 83, 2622.99, 639.178, 56.0300, 0, 'summon'), +(17876, 84, 2628.73, 656.693, 56.0610, 5000, ''), +(17876, 85, 2630.34, 661.135, 54.2738, 0, ''), +(17876, 86, 2635.38, 672.243, 54.4508, 0, ''), +(17876, 87, 2644.13, 668.158, 55.3797, 0, ''), +(17876, 88, 2646.82, 666.740, 56.9898, 0, ''), +(17876, 89, 2658.22, 665.432, 57.1725, 0, ''), +(17876, 90, 2661.88, 674.849, 57.1725, 0, ''), +(17876, 91, 2656.23, 677.208, 57.1725, 0, ''), +(17876, 92, 2652.28, 670.270, 61.9353, 0, ''), +(17876, 93, 2650.79, 664.290, 61.9302, 0, 'summon inn'), +(17876, 94, 2658.19, 660.454, 61.9320, 5000, ''), +(17876, 95, 2660.57, 659.173, 61.9370, 0, 'speak with Taretha'), +(17876, 96, 2658.19, 660.454, 61.9320, 5000, 'epoch calls'), +(17876, 97, 2659.84, 659.482, 61.9361, 5000, 'taretha "dies"'), +(17876, 98, 2654.28, 662.722, 61.9313, 0, ''), +(17876, 99, 2652.37, 670.561, 61.9368, 0, ''), +(17876, 100, 2656.05, 676.761, 57.1727, 0, ''), +(17876, 101, 2658.49, 677.166, 57.1727, 0, ''), +(17876, 102, 2659.28, 667.117, 57.1727, 0, ''), +(17876, 103, 2649.71, 665.387, 57.1727, 0, ''), +(17876, 104, 2634.79, 672.964, 54.4577, 0, 'outside inn'), +(17876, 105, 2635.06, 673.892, 54.4713, 30000, 'getting ready'), +(17876, 106, 2634.79, 672.964, 54.4577, 60000, 'when all dead and meet Taretha'), +(17876, 107, 2631.72, 665.629, 54.2923, 0, 'run off'), +(17876, 108, 2647.40, 640.530, 55.7634, 0, ''); +DELETE FROM script_waypoint WHERE entry=18887; +INSERT INTO script_waypoint VALUES +(18887, 0, 2650.06, 665.473, 61.9305, 0, ''), +(18887, 1, 2652.44, 670.761, 61.9370, 0, ''), +(18887, 2, 2655.96, 676.913, 57.1725, 0, ''), +(18887, 3, 2659.40, 677.317, 57.1725, 0, ''), +(18887, 4, 2651.75, 664.482, 57.1725, 0, ''), +(18887, 5, 2647.49, 666.595, 57.0824, 0, ''), +(18887, 6, 2644.37, 668.167, 55.4182, 0, ''), +(18887, 7, 2640.96, 669.890, 54.7567, 60000, ''); +DELETE FROM script_waypoint WHERE entry=10096; +INSERT INTO script_waypoint VALUES +(10096, 0, 604.802673, -191.081985, -54.058590, 0,'ring'), +(10096, 1, 604.072998, -222.106918, -52.743759, 0,'first gate'), +(10096, 2, 621.400391, -214.499054, -52.814453, 0,'hiding in corner'), +(10096, 3, 601.300781, -198.556992, -53.950256, 0,'ring'), +(10096, 4, 631.818359, -180.548126, -52.654770, 0,'second gate'), +(10096, 5, 627.390381, -201.075974, -52.692917, 0,'hiding in corner'); +DELETE FROM script_waypoint WHERE entry=9503; +INSERT INTO script_waypoint VALUES +(9503, 0, 883.294861, -188.926300, -43.703655, 0,''), +(9503, 1, 872.763550, -185.605621, -43.703655, 5000,'b1'), +(9503, 2, 867.923401, -188.006393, -43.703655, 5000,'b2'), +(9503, 3, 863.295898, -190.795212, -43.703655, 5000,'b3'), +(9503, 4, 856.139587, -194.652756, -43.703655, 5000,'b4'), +(9503, 5, 851.878906, -196.928131, -43.703655, 15000,'b5'), +(9503, 6, 877.035217, -187.048080, -43.703655, 0,''), +(9503, 7, 891.198000, -197.924000, -43.620400, 0,'home'); + +-- 2813_world_scripts +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_nadox' WHERE `entry` = 29309; +UPDATE `creature_template` SET `ScriptName` = 'mob_ahnkahar_nerubian' WHERE `entry` in (30176,30178); +UPDATE `instance_template` SET `script`= 'instance_ahnkahet' WHERE `map` = 619; + +-- 2813_world_SD2_scripts +DELETE FROM script_waypoint WHERE entry=12423; +INSERT INTO script_waypoint VALUES +(12423, 0, -9509.72, -147.03, 58.74, 0, ''), +(12423, 1, -9517.07, -172.82, 58.66, 0, ''); +DELETE FROM script_waypoint WHERE entry=12427; +INSERT INTO script_waypoint VALUES +(12427, 0, -5689.20, -456.44, 391.08, 0, ''), +(12427, 1, -5700.37, -450.77, 393.19, 0, ''); +DELETE FROM script_waypoint WHERE entry=12428; +INSERT INTO script_waypoint VALUES +(12428, 0, 2454.09, 361.26, 31.51, 0, ''), +(12428, 1, 2472.03, 378.08, 30.98, 0, ''); +DELETE FROM script_waypoint WHERE entry=12429; +INSERT INTO script_waypoint VALUES +(12429, 0, 9654.19, 909.58, 1272.11, 0, ''), +(12429, 1, 9642.53, 908.11, 1269.10, 0, ''); +DELETE FROM script_waypoint WHERE entry=12430; +INSERT INTO script_waypoint VALUES +(12430, 0, 161.65, -4779.34, 14.64, 0, ''), +(12430, 1, 140.71, -4813.56, 17.04, 0, ''); +UPDATE script_texts SET emote=20 WHERE entry=-1000231; +UPDATE script_texts SET emote=4 WHERE entry IN (-1000232, -1000256, -1000258, -1000260, -1000262); + +-- 2814_world_spell_linked_spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (32386, 32388, 32389, 32390, 32391); +INSERT INTO `spell_linked_spell` VALUES (32386, 60448, 2, 'Shadow Embrace Rank1'); +INSERT INTO `spell_linked_spell` VALUES (32388, 60465, 2, 'Shadow Embrace Rank2'); +INSERT INTO `spell_linked_spell` VALUES (32389, 60466, 2, 'Shadow Embrace Rank3'); +INSERT INTO `spell_linked_spell` VALUES (32390, 60467, 2, 'Shadow Embrace Rank4'); +INSERT INTO `spell_linked_spell` VALUES (32391, 60468, 2, 'Shadow Embrace Rank5'); + +-- 2828_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (16544, 16086); +INSERT INTO `spell_proc_event` VALUES +(16544, 0x00, 11, 0x00000000, 0x00040000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0), +(16086, 0x00, 11, 0x00000000, 0x00040000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); + +-- 2885_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (34457); +INSERT INTO `spell_proc_event` VALUES +(34457, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000002, 0.000000, 0.000000, 0); +DELETE FROM `spell_proc_event` WHERE `entry` IN (34456); +INSERT INTO `spell_proc_event` VALUES +(19615, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000002, 0.000000, 0.000000, 0); +INSERT INTO trinity_string (entry, content_default)VALUES (6616 , "Pet spells will reset for all players at login. Strongly recommend re-login!"); + +-- 2907_mangos_7705_01_world_command +DELETE FROM `command` WHERE `name` IN +('account lock','account password','chardelete','character customize','character delete','character rename','customize','lockaccount','password','rename'); +INSERT INTO `command` VALUES +('account lock',0,'Syntax: .account lock [on|off]\r\n\r\nAllow login from account only from current used IP or remove this requirement.'), +('account password',0,'Syntax: .account password $old_password $new_password $new_password\r\n\r\nChange your account password.'), +('character customize',2,'Syntax: .character customize [$name]\r\n\r\nMark selected in game or by $name in command character for customize at next login.'), +('character delete',4,'Syntax: .character delete $name\r\n\r\nDelete character $name.'), +('character rename',2,'Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'); + +-- 2907_mangos_7706_01_world_command +DELETE FROM `command` WHERE `name` IN ('plimit','server plimit'); +INSERT INTO `command` VALUES +('server plimit',3,'Syntax: .server plimit [#num|-1|-2|-3|reset|player|moderator|gamemaster|administrator]\r\n\r\nWithout arg show current player amount and security level limitations for login to server, with arg set player linit ($num > 0) or securiti limitation ($num < 0 or security leme name. With `reset` sets player limit to the one in the config file'); + +-- 2923_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (47569, 47570); +INSERT INTO `spell_proc_event` VALUES +(47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 50.000000, 0), +(47570, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 100.000000, 0); + +-- 2932_mangos_7714_01_world_command +DELETE FROM `command` WHERE `name` IN ('character level'); +INSERT INTO `command` VALUES +('character level',3,'Syntax: .character level [$playername] [#level]\r\n\r\nSet the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'); + +-- 2938_mangos_7720_01_world_trinity_string +DELETE FROM trinity_string WHERE entry IN(557,558,559); +INSERT INTO trinity_string VALUES +(557,'%s level up you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(558,'%s level down you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(559,'%s reset your level progress.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +-- 2949_world_creature_template +INSERT INTO creature_template (entry, spell1, spell2, spell3, spell4) VALUES +(15352, 36213, 0, 0, 0), # Greater Earth Elemental +(15438, 57984, 12470, 13376, 0), # Greater Fire Elemental +(29264, 58861, 58875, 58867, 58857), # Spirit Wolf +(510, 31707, 33395, 0, 0) # Water Elemental +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +spell2 = VALUES(spell2), +spell3 = VALUES(spell3), +spell4 = VALUES(spell4); + +-- 2955_world_scripts_naxx +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(-28169, 28206, 0, 'Mutating Injection - Mutagen Explosion'), +(-28169, 28240, 0, 'Mutating Injection - Poison Cloud'); +UPDATE creature_template SET spell1 = 28158, spell2 = 54362, flags_extra = 128 WHERE entry = 16363; +UPDATE creature_template SET scriptname = 'boss_grobbulus' WHERE entry = 15931; + +-- 2963_world_spell_proc_event +DELETE FROM `spell_proc_event` WHERE `entry` IN (20911, 25899); +-- Blessing of sanctuary +INSERT INTO `spell_proc_event` VALUES +(20911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(25899, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0); +DELETE FROM `spell_required` WHERE `spell_id` IN (25899); +INSERT INTO spell_required VALUES (25899, 20911); + +-- 2986_TC1_world +-- Kil'jaeden +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 45909; +DELETE FROM `spell_script_target` WHERE `entry` IN (46589, 45839); +INSERT INTO `spell_script_target` () VALUES (46589, 1, 30598); +INSERT INTO `spell_script_target` () VALUES (46589, 1, 30614); +INSERT INTO `spell_script_target` () VALUES (45839, 1, 25653); + +DELETE FROM `creature_template` WHERE entry in (30598, 30614); +INSERT INTO `creature_template` () VALUES +(30598, 0, 4449, 0, 4449, 0, 'Spike Target', '', '', 70, 70, 1, 1, 0, 0, 0, 14, 14, 0, 1, 1, 0, 0, 0, 0, 0, 2600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 0, 0, 0, 1, 0, 0, 128, ''), +(30614, 0, 4449, 0, 4449, 0, 'Spike Target 2', '', '', 70, 70, 1, 1, 0, 0, 0, 14, 14, 0, 1, 1, 0, 0, 0, 0, 0, 2600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 0, 0, 0, 1, 0, 0, 128, ''); + +UPDATE `creature_template` SET `flags_extra` = 128 WHERE `entry` IN (30614, 30598, 25735); +UPDATE `creature_template` SET `minlevel` = 73, `maxlevel` = 73, unit_flags = 33554432, minhealth=5000000, maxhealth=5000000 WHERE entry IN (26046, 25319); +UPDATE `creature_template` SET `minlevel` = 70, `unit_flags` = 33554432 WHERE entry = 26046; +UPDATE `creature_template` SET `minlevel` =70, `maxlevel` = 70, `unit_flags` = 33554432, spell1 = 45848, spell2 = 45862, spell3 = 45860, spell4 = 45856, minhealth = 5000000, maxhealth=5000000 WHERE entry=25653; +UPDATE `creature_template` SET `minlevel` = 70, `maxlevel` = 70, `minhealth` = 20000, maxhealth = 20000 WHERE entry = 25502; +UPDATE `creature_template` SET `minhealth` = 12600000, maxhealth = 12600000, minmana = 2000000, maxmana = 2000000 WHERE entry = 25315; +UPDATE `creature_template` SET `minhealth` = 110000, maxhealth = 110000, minmana = 100000, maxmana = 100000 WHERE entry =25708; +UPDATE `creature_template` SET `minlevel` = 73, `maxlevel` = 73 WHERE entry = 25735; + +DELETE FROM creature WHERE id IN (25319, 25588, 25608); +INSERT INTO creature (id, map, spawnMask, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, DeathState, MovementType) VALUES +(25319, 580, 1, 0, 0, 1701.7, 635.515, 72.2884, 4.65461, 25, 0, 0, 1, 0, 0, 0), +(25608, 580, 1, 0, 0, 1698.9, 627.877, 27.6233, 0.034907, 604800, 0, 0, 1, 0, 0, 0); + +DELETE FROM gameobject WHERE id=188415; +INSERT INTO gameobject (id, map, spawnMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES +(188415, 580, 1, 1653.12, 635.41, 28.0932, 0.0977725, 0, 0, 0.0488668, 0.998805, 25, 0, 1), +(188415, 580, 1, 1704.14, 583.591, 28.1696, 1.59003, 0, 0, 0.713874, 0.700274, 25, 0, 1), +(188415, 580, 1, 1745.68, 621.823, 28.0505, 2.93777, 0, 0, 0.994812, 0.101733, 25, 0, 1), +(188415, 580, 1, 1694.48, 674.29, 28.0502, 4.86985, 0, 0, 0.649302, -0.760531, 25, 0, 1); +UPDATE `gameobject_template` SET `type` = 1 WHERE `entry` = 188415; + +-- M'uru +UPDATE `creature_template` SET `modelid_A` = 23842 WHERE `entry` = 25744; +UPDATE `creature_template` SET `flags_extra` = 128 WHERE entry IN (25855, 25770); +UPDATE `creature_template` SET `spell1` = 46262, flags_extra = 128, scriptname = '' WHERE entry = 25879; + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (46242, 46228, 46228, 46262); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46242, 46247, 0, 'Black Hole Visual (Birth)'); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46228, 46235, 0, 'Black Hole Visual (Grown)'); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46228, -46247, 0, 'Black Hole Visual (Grown)'); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46262, 46265, 0, 'Void Zone Visual'); + +DELETE FROM `spell_script_target` WHERE `entry` IN (45976, 46177); +INSERT INTO `spell_script_target` VALUES (45976, 1, 25770); +INSERT INTO `spell_script_target` VALUES (46177, 1, 25770); + +-- EAI for Berserks FROM Megamage +DELETE FROM `creature_ai_scripts` WHERE `creature_id` = 25798; +INSERT INTO `creature_ai_scripts` (`id`, `creature_id`, `event_type`, `event_flags`,`event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_type`, `action1_param1`, `action1_param2`, `action1_param3`, `action2_type`, `action2_param1`, `action2_param2`, `action2_param3`, `action3_type`, `action3_param1`, `action3_param2`, `action3_param3`, `comment`, `event_chance`, `event_inverse_phase_mask`) VALUES +(2579800, 25798, 11, 0, 0*1000, 0*1000, 0*1000, 0*1000, 11, 45769, 0, 0, 20, 1, 0, 0, 21, 1, 0, 0,"Shadowsword Berserker - Sunwell Radiance", 100, 0), +(2579801, 25798, 0, 1, 10*1000, 12*1000, 10*1000, 15*1000, 11, 46160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadowsword Berserker - Cast Flurry', 70, 0), +(2579802, 25798, 1, 0, 180*1000, 180*1000, 0*1000, 0*1000, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadowsword Berserker - 180s OOC => Evade', 100, 0); + +-- Brutallus +UPDATE `creature_template` SET `unit_flags` = 0 WHERE `entry` = 24882; + +-- Felmyst +UPDATE `creature_template` SET `modelid_H` = 22838 WHERE `entry` = 25038; +DELETE FROM `script_texts` WHERE `entry` BETWEEN '-1580109' and '-1580036'; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `comment`) VALUES +(-1580036, 'Glory to Kil\'jaeden! Death to all who oppose!', 12477, 1, 'felmyst - YELL_BIRTH'), +(-1580037, 'I kill for the master!', 12480, 1, 'felmyst - YELL_KILL1'), +(-1580038, 'The end has come!', 12481, 1, 'felmyst - YELL_KILL2'), +(-1580039, 'Choke on your final breath!', 12478, 1, 'felmyst - YELL_BREATH'), +(-1580040, 'I am stronger than ever before!', 12479, 1, 'felmyst- YELL_TAKEOFF'), +(-1580041, 'No more hesitation! Your fates are written!', 12482, 1, 'felmyst - YELL_BERSERK'), +(-1580042, 'Kil\'jaeden... will... prevail...', 12483, 1, 'felmyst - YELL_DEATH'), +(-1580043, 'Madrigosa deserved a far better fate. You did what had to be done, but this battle is far from over.', 12439, 1, 'felmyst - YELL_KALECGOS'), +(-1580044, 'Fire to the aid of shadow!', 12489, 1, 'eredar - YELL_CANFLAGRATION'), +(-1580045, 'Sacrolash!', 12492, 1, 'eredar - YELL_SISTER_SACROLASH_DEAD'), +(-1580046, 'Fire consume.', 12490, 1, 'eredar - YELL_ALY_KILL_1'), +(-1580047, 'Ed-ir Halach!', 12491, 1, 'eredar - YELL_ALY_KILL_2'), +(-1580048, 'De-ek Anur!', 12494, 1, 'eredar - YELL_ALY_DEAD'), +(-1580049, 'Your luck has run its curse!', 12493, 1, 'eredar - YELL_BERSERK'), +(-1580050, 'Shadow to the aid of fire!', 12485, 1, 'eredar - YELL_SHADOW_NOVA'), +(-1580051, 'Alythess! Your fire burns within me!', 12488, 1, 'eredar - YELL_SISTER_ALYTHESS_DEAD'), +(-1580052, 'Shadow engulf.', 12486, 1, 'eredar - YELL_SAC_KILL_1'), +(-1580053, 'Ee-nok Kryul!', 12487, 1, 'eredar - YELL_SAC_KILL_2'), +(-1580054, 'I... fade.', 0, 1, 'eredar - YELL_SAC_DEAD'), +(-1580055, 'Time is a luxury you no longer possess!', 0, 1, 'eredar - YELL_ENRAGE'), +(-1580056, 'Misery...', 12484, 1, 'eredar - YELL_INTRO_SAC_1'), +(-1580057, 'Depravity...', 0, 1, 'eredar - YELL_INTRO_ALY_2'), +(-1580058, 'Confusion...', 0, 1, 'eredar - YELL_INTRO_SAC_3'), +(-1580059, 'Hatred...', 0, 1, 'eredar - YELL_INTRO_ALY_4'), +(-1580060, 'Mistrust...', 0, 1, 'eredar - YELL_INTRO_SAC_5'), +(-1580061, 'Chaos...', 0, 1, 'eredar - YELL_INTRO_ALY_6'), +(-1580062, 'These are the hallmarks...', 0, 1, 'eredar - YELL_INTRO_SAC_7'), +(-1580063, 'These are the pillars...', 0, 1, 'eredar - YELL_INTRO_ALY_8'), +(-1580064, 'directs Shadow Nova at $N', 0, 3, 'eredar - emote shadow nova'), +(-1580065, 'directs Conflagration at $N', 0, 3, 'eredar - emote conflagration'), +(-1580066, 'All my plans have led to this!', 12495, 1, 'KJ - SAY_KJ_OFFCOMBAT1'), +(-1580067, 'Stay on task! Do not waste tim!', 12496, 1, 'KJ - SAY_KJ_OFFCOMBAT2'), +(-1580068, 'I have waited long enough!', 12497, 1, 'KJ - SAY_KJ_OFFCOMBAT3'), +(-1580069, 'Fail me and suffer for eternity!', 12498, 1, 'KJ - SAY_KJ_OFFCOMBAT4'), +(-1580070, 'Drain the girl! Drain her power until there is nothing but a vacant shell!', 12499, 1, 'KJ - SAY_KJ_OFFCOMBAT5'), +(-1580071, 'The expendible have perished... So be it! Now I shall succeed where Sargeras could not! I will bleed this wretched world and secure my place as the true master of the Burning Legion. The end has come! Let the unraveling of this world commence!', 12500, 1, 'KJ - SAY_KJ_EMERGE'), +(-1580072, 'Another step towards destruction!', 12501, 1, 'KJ - SAY_KJ_SLAY1'), +(-1580073, 'Anak-ky\'ri!', 12502, 1, 'KJ - SAY_KJ_SLAY2'), +(-1580074, 'Who can you trust?', 12503, 1, 'KJ - SAY_KJ_REFLECTION1'), +(-1580075, 'The enemy is among you.', 12504, 1, 'KJ - SAY_KJ_REFLECTION2'), +(-1580076, 'Chaos!', 12505, 1, 'KJ - SAY_KJ_DARKNESS1'), +(-1580077, 'Destruction!', 12506, 1, 'KJ - SAY_KJ_DARKNESS2'), +(-1580078, 'Oblivion!', 12507, 1, 'KJ - SAY_KJ_DARKNESS3'), +(-1580079, 'I will not be denied! This world shall fall!', 12508, 1, 'KJ - SAY_KJ_PHASE3'), +(-1580080, 'Do not harbor false hope. You cannot win!', 12509, 1, 'KJ - SAY_KJ_PHASE4'), +(-1580081, 'Aggghh! The powers of the Sunwell... turned... against me! What have you done? WHAT HAVE YOU DONE?', 12510, 1, 'KJ - SAY_KJ_PHASE5'), +(-1580082, 'Anveena, you must awaken, this world needs you!', 12445, 1, 'KJ - SAY_KALECGOS_AWAKEN'), +(-1580083, 'I serve only the Master now.', 12511, 1, 'KJ - SAY_ANVEENA_IMPRISONED'), +(-1580084, 'You must let go! You must become what you were always meant to be! The time is now, Anveena!', 12446, 1, 'KJ - SAY_KALECGOS_LETGO'), +(-1580085, 'But I\'m... lost... I cannot find my way back!', 12512, 1, 'KJ - SAY_ANVEENA_LOST'), +(-1580086, 'Anveena, I love you! Focus on my voice, come back for me now! Only you can cleanse the Sunwell!', 12447, 1, 'KJ - SAY_KALECGOS_FOCUS'), +(-1580087, 'Kalec... Kalec?', 12513, 1, 'KJ - SAY_ANVEENA_KALEC'), +(-1580088, 'Yes, Anveena! Let fate embrace you now!', 12448, 1, 'KJ - SAY_KALECGOS_FATE'), +(-1580089, 'The nightmare is over, the spell is broken! Goodbye, Kalec, my love!', 12514, 1, 'KJ - SAY_ANVEENA_GOODBYE'), +(-1580090, 'Goodbye, Anveena, my love. Few will remember your name, yet this day you change the course of destiny. What was once corrupt is now pure. Heroes, do not let her sacrifice be in vain.', 12450, 1, 'KJ - SAY_KALECGOS_GOODBYE'), +(-1580091, 'Strike now, heroes, while he is weakened! Vanquish the Deceiver!', 12449, 1, 'KJ - SAY_KALECGOS_ENCOURAGE'), +(-1580092, 'You are not alone. The Blue Dragonflight shall help you vanquish the Deceiver.', 12438, 1, 'KJ - SAY_KALECGOS_JOIN'), +(-1580093, 'Nooooooooooooo!', 12527, 1, 'KJ - SAY_KJ_DEATH'), +(-1580094, 'begins to channel dark energy', 0, 3, 'KJ - EMOTE_KJ_DARKNESS'), +(-1580095, 'I will channel my power into the orbs, be ready!', 12440, 1, 'KJ - SAY_KALEC_ORB_READY1'), +(-1580096, 'I have empowered another orb! Use it quickly!', 12441, 1, 'KJ - SAY_KALEC_ORB_READY2'), +(-1580097, 'Another orb is ready! Make haste!', 12442, 1, 'KJ - SAY_KALEC_ORB_READY3'), +(-1580098, 'I have channeled all I can! The power is in your hands!', 12443, 1, 'KJ - SAY_KALEC_ORB_READY4'), +(-1580099, 'Mortal heroes, your victory here today was foretold long ago. My brother\'s anguished cry of defeat will echo across the universe, bringing renewed hope to all those who still stand against the Burning Crusade.', 12515, 0, 'prophet velen - SAY1'), +(-1580100, 'As the Legion\'s final defeat draws ever-nearer, stand proud in the knowledge that you have saved worlds without number from the flame. Just as this day marks an ending, so too does it herald a new beginning...', 12516, 0, 'prophet velen - SAY2'), -- van mĂ©gegy hang 12517 ami ehhez tartozik +(-1580101, 'The creature Entropius, whom you were forced to destroy, was once the noble naaru, M\'uru. In life, M\'uru channeled vast energies of LIGHT and HOPE. For a time, a misguided few sought to steal those energies...', 12518, 0, 'prophet velen - SAY3'), +(-1580102, 'Then fortunate it is, that I have reclaimed the noble naaru\'s spark from where it fell! Where faith dwells, hope is never lost, young blood elf.', 12519, 0, 'prophet velen - SAY4'), +(-1580103, 'Gaze now, mortals - upon the HEART OF M\'URU! Unblemished. Bathed by the light of Creation - just as it was at the Dawn.', 12520, 0, 'prophet velen - SAY5'), +(-1580104, 'In time, the light and hope held within - will rebirth more than this mere fount of power... Mayhap, they will rebirth the soul of a nation.', 12521, 0, 'prophet velen - SAY6'), +(-1580105, 'Salvation, young one. It waits for us all.', 12522, 0, 'prophet velen - SAY7'), +(-1580106, 'Farewell...', 12523, 0, 'prophet velen - SAY8'), +(-1580107, 'Our arrogance was unpardonable. We damned one of the most noble beings of all. We may never atone for this sin.', 12524, 0, 'lady liadrinn - SAY1'), +(-1580108, 'Can it be?', 12525, 0, 'lady liadrinn - SAY2'), +(-1580109, 'Blessed ancestors! I feel it... so much love... so much grace... there are... no words... impossible to describe...', 12525, 0, 'lady liadrinn - SAY3'); + +-- Kil'jaeden script +UPDATE `creature_template` SET `ScriptName`='boss_kiljaeden' WHERE `entry`=25315; +UPDATE `creature_template` SET `ScriptName`='boss_kalecgosKJ' WHERE `entry`=25319; +UPDATE `creature_template` SET `ScriptName`='mob_kiljaeden_controller' WHERE `entry`=25608; +UPDATE `creature_template` SET `ScriptName`='mob_hand_of_the_deceiver' WHERE `entry`=25588; +UPDATE `creature_template` SET `ScriptName`='mob_felfire_portal' WHERE `entry`=25603; +UPDATE `creature_template` SET `ScriptName`='mob_volatile_felfire_fiend' WHERE `entry`=25598; +UPDATE `creature_template` SET `ScriptName`='mob_armageddon' WHERE `entry`=25735; +UPDATE `creature_template` SET `ScriptName`='mob_shield_orb' WHERE `entry`=25502; +UPDATE `creature_template` SET `ScriptName`='mob_sinster_reflection' WHERE `entry`=25708; +UPDATE `gameobject_template` SET `ScriptName`='go_orb_of_the_blue_flight' WHERE `entry`=188415; + +-- M'uru& Entropius +UPDATE `creature_template` SET `ScriptName`='npc_void_sentinel' WHERE `entry`=25772; +UPDATE `creature_template` SET `ScriptName`='npc_dark_fiend' WHERE `entry`=25744; +UPDATE `creature_template` SET `ScriptName`='boss_muru' WHERE `entry`=25741; +UPDATE `creature_template` SET `ScriptName`='boss_entropius' WHERE `entry`=25840; +UPDATE `creature_template` SET `ScriptName`='npc_muru_portal' WHERE `entry`=25770; +UPDATE `creature_template` SET `AIName`='EventAI' WHERE `entry`=25798; + +-- 2996_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` IN (750,751); +INSERT INTO `trinity_string` VALUES +(750,'Not enough players. This game will close in %u mins.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(751,'Not enough players. This game will close in %u seconds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1200 AND 1232; +INSERT INTO `trinity_string` VALUES +(1200, 'You try to view cinemitic %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1201, 'You try to view movie %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1300 AND 1332; +INSERT INTO `trinity_string` VALUES +(1300, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1301, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1302, '%s was destroyed by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1303, 'The %s is under attack! If left unchecked, the %s will destroy it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1304, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1305, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1306, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1307, 'The %s is under attack! If left unchecked, the %s will capture it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1308, 'The %s has taken the %s! Its supplies will now be used for reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1309, 'Irondeep Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1310, 'Coldtooth Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1311, 'Stormpike Aid Station', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1312, 'Dun Baldar South Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1313, 'Dun Baldar North Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1314, 'Stormpike Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1315, 'Icewing Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1316, 'Stonehearth Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1317, 'Stonehearth Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1318, 'Snowfall Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1319, 'Iceblood Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1320, 'Iceblood Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1321, 'Tower Point', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1322, 'Frostwolf Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1323, 'East Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1324, 'West Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1325, 'Frostwolf Relief Hut', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1326, 'The Battle for Alterac Valley begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1327, 'The Battle for Alterac Valley begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1328, 'The Battle for Alterac Valley has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1329, 'The Alliance Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1330, 'The Horde Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1331, 'The Frostwolf General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1332, 'The Stormpike General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- 2997_world_trinity_string +DELETE FROM `trinity_string` WHERE `entry` = 5010; +INSERT INTO `trinity_string` VALUES +(5010,'linkGUID: %u, Entry: %u (%s)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1026_mangos_7113_01_characters_character_achievement_progress.sql b/sql/updates/3.0.9_old/1026_mangos_7113_01_characters_character_achievement_progress.sql new file mode 100644 index 0000000..4d0d0b9 --- /dev/null +++ b/sql/updates/3.0.9_old/1026_mangos_7113_01_characters_character_achievement_progress.sql @@ -0,0 +1,3 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7100_01_characters_character_spell required_7113_01_characters_character_achievement_progress bit;*/ + +DELETE FROM character_achievement_progress WHERE counter=0; diff --git a/sql/updates/3.0.9_old/1028_mangos_7141_01_world_instance_template.sql b/sql/updates/3.0.9_old/1028_mangos_7141_01_world_instance_template.sql new file mode 100644 index 0000000..f50dc68 --- /dev/null +++ b/sql/updates/3.0.9_old/1028_mangos_7141_01_world_instance_template.sql @@ -0,0 +1,12 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7133_02_mangos_spell_loot_template required_7141_01_mangos_instance_template bit;*/ + +ALTER TABLE instance_template ADD maxPlayersHeroic tinyint(3) unsigned NOT NULL default '0' AFTER maxPlayers; + +UPDATE instance_template SET maxPlayersHeroic = maxPlayers; + +DELETE FROM instance_template WHERE map IN (533,615,616,624); +INSERT INTO instance_template VALUES +(533,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''), +(615,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''), +(616,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''), +(624,0,80,0,10,25,0,NULL,NULL,NULL,NULL,''); diff --git a/sql/updates/3.0.9_old/1028_mangos_7147_01_world_creature_template.sql b/sql/updates/3.0.9_old/1028_mangos_7147_01_world_creature_template.sql new file mode 100644 index 0000000..ca36b13 --- /dev/null +++ b/sql/updates/3.0.9_old/1028_mangos_7147_01_world_creature_template.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7141_01_mangos_instance_template required_7147_01_mangos_creature_template bit;*/ + +UPDATE creature_template + SET family = 0 WHERE entry = 1; diff --git a/sql/updates/3.0.9_old/1028_mangos_7150_01_world_playercreateinfo_spell.sql b/sql/updates/3.0.9_old/1028_mangos_7150_01_world_playercreateinfo_spell.sql new file mode 100644 index 0000000..feb634e --- /dev/null +++ b/sql/updates/3.0.9_old/1028_mangos_7150_01_world_playercreateinfo_spell.sql @@ -0,0 +1,10 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7149_01_mangos_spell_proc_event required_7150_01_mangos_playercreateinfo_spell bit;*/ + +DELETE FROM `playercreateinfo_spell` WHERE Spell = 58284; + +INSERT INTO `playercreateinfo_spell` VALUES +(1,9,58284,'Chaos Bolt Passive'), +(2,9,58284,'Chaos Bolt Passive'), +(5,9,58284,'Chaos Bolt Passive'), +(7,9,58284,'Chaos Bolt Passive'), +(10,9,58284,'Chaos Bolt Passive'); diff --git a/sql/updates/3.0.9_old/1084_mangos_7168_01_world_command.sql b/sql/updates/3.0.9_old/1084_mangos_7168_01_world_command.sql new file mode 100644 index 0000000..2f1b8f5 --- /dev/null +++ b/sql/updates/3.0.9_old/1084_mangos_7168_01_world_command.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7156_01_mangos_spell_proc_event required_7168_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('learn','unlearn'); +INSERT INTO `command` VALUES +('learn',3,'Syntax: .learn #spell [all]\r\n\r\nSelected character learn a spell of id #spell. If \'all\' provided then all ranks learned.'), +('unlearn',3,'Syntax: .unlearn #spell [all]\r\n\r\nUnlearn for selected player a spell #spell. If \'all\' provided then all ranks unlearned.'); diff --git a/sql/updates/3.0.9_old/1094_mangos_7193_01_world_trinity_string.sql b/sql/updates/3.0.9_old/1094_mangos_7193_01_world_trinity_string.sql new file mode 100644 index 0000000..be6f241 --- /dev/null +++ b/sql/updates/3.0.9_old/1094_mangos_7193_01_world_trinity_string.sql @@ -0,0 +1,3 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7175_01_mangos_spell_proc_event required_7193_01_mangos_mangos_string bit;*/ + +UPDATE mangos_string SET content_default = 'Unit Flags: %u.\nDynamic Flags: %u.\nFaction Template: %u.' WHERE entry = 542; diff --git a/sql/updates/3.0.9_old/1108_mangos_7196_02_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/1108_mangos_7196_02_world_spell_bonus_data.sql new file mode 100644 index 0000000..13f8407 --- /dev/null +++ b/sql/updates/3.0.9_old/1108_mangos_7196_02_world_spell_bonus_data.sql @@ -0,0 +1,233 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7196_01_mangos_spell_chain required_7196_02_mangos_spell_bonus_data bit;*/ + +-- ---------------------------- +-- Table structure for spell_bonus_data +-- ---------------------------- +DROP TABLE IF EXISTS `spell_bonus_data`; +CREATE TABLE `spell_bonus_data` ( + `entry` smallint(5) unsigned NOT NULL, + `direct_bonus` float NOT NULL default '0', + `dot_bonus` float NOT NULL default '0', + `ap_bonus` float NOT NULL default '0', + `comments` varchar(255) default NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO `spell_bonus_data` VALUES +('5185', '1.6104', '0', '0', 'Druid - Healing Touch'), +('33763', '0', '0.09518', '0', 'Druid - Lifebloom'), +('774', '0', '0.37604', '0', 'Druid - Rejuvenation'), +('8936', '0.539', '0.188', '0', 'Druid - Regrowth'), +('18562', '0', '0', '0', 'Druid - Swiftmend'), +('44203', '0.538', '0', '0', 'Druid - Tranquility Triggered'), +('48438', '0', '0.11505', '0', 'Druid - Wild Growth'), +('50464', '0.6611', '0', '0', 'Druid - Nourish'), +('339', '0', '0.1', '0', 'Druid - Entangling Roots'), +('42231', '0.12898', '0', '0', 'Druid - Hurricane Triggered'), +('5570', '0', '0.127', '0', 'Druid - Insect Swarm'), +('8921', '0.1515', '0.13', '0', 'Druid - Moonfire'), +('2912', '1', '0', '0', 'Druid - Starfire'), +('5176', '0.5714', '0', '0', 'Druid - Wrath'), +('30451', '0.7143', '0', '0', 'Mage - Arcane Blast'), +('1449', '0.2128', '0', '0', 'Mage - Arcane Explosion'), +('7268', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 1'), +('7269', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 2'), +('7270', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 3'), +('8419', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 4'), +('8418', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 5'), +('10273', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 6'), +('10274', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 7'), +('25346', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 8'), +('27076', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 9'), +('38700', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 10'), +('38703', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 11'), +('42844', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 12'), +('42845', '0.2857', '0', '0', 'Mage - Arcane Missiles Triggered Spell Rank 13'), +('1463', '0.8053', '0', '0', 'Mage - Mana Shield'), +('44425', '0.8571', '0', '0', 'Mage - Arcane Barrage'), +('11113', '0.1357', '0', '0', 'Mage - Blast Wave Rank'), +('31661', '0.1357', '0', '0', 'Mage - Dragons Breath'), +('2136', '0.4286', '0', '0', 'Mage - Fire Blast'), +('133', '1', '0', '0', 'Mage - Fire Ball'), +('2120', '0.2357', '0.122', '0', 'Mage - Flamestrike'), +('11366', '1.15', '0.05', '0', 'Mage - Pyroblast'), +('2948', '0.4286', '0', '0', 'Mage - Scorch'), +('44614', '0.8571', '0', '0', 'Frostfire Bolt'), +('44457', '0.4', '0.2', '0', 'Mage - Living Bomb'), +('42208', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 1'), +('42209', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 2'), +('42210', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 3'), +('42211', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 4'), +('42212', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 5'), +('42213', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 6'), +('42198', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 7'), +('42937', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 8'), +('42938', '0.0952', '0', '0', 'Mage - Blizzard Triggered Spell Rank 9'), +('120', '0.1357', '0', '0', 'Mage - Cone of Cold'), +('122', '0.193', '0', '0', 'Mage - Frost Nova'), +('116', '0.8143', '0', '0', 'Mage - Frost Bolt'), +('11426', '0.8053', '0', '0', 'Mage - Ice Barrier'), +('30455', '0.1429', '0', '0', 'Mage - Ice Lance'), +('19750', '0.4286', '0', '0', 'Paladin - Flash of Light'), +('635', '0.7143', '0', '0', 'Paladin - Holy Light'), +('25912', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 1'), +('25911', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 2'), +('25902', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 3'), +('27176', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 4'), +('33073', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 5'), +('48822', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 6'), +('48823', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Hurt Rank 7'), +('25914', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 1'), +('25913', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 2'), +('25903', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 3'), +('27175', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 4'), +('33074', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 5'), +('48820', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 6'), +('48821', '0.4286', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 7'), +('31935', '0.07', '0', '0.07', 'Paladin - Avengers Shiled'), +('26573', '0', '0.04', '0.04', 'Paladin - Consecration'), +('879', '0.15', '0', '0.15', 'Paladin - Exorcism'), +('24275', '0.15', '0', '0.15', 'Paladin - Hammer of Wrath'), +('20925', '0.09', '0', '0.056', 'Paladin - Holy Shield'), +('2812', '0.07', '0', '0.07', 'Paladin - Holy Wrath'), +('31893', '0.25', '0', '0.16', 'Paladin - Seal of Blood Enemy Proc'), +('32221', '0.25', '0', '0.16', 'Paladin - Seal of Blood Self Proc'), +('20424', '0.25', '0', '0.16', 'Paladin - Seal of Command Proc'), +('379', '0', '0', '0', 'Shaman - Earth Shield Triggered'), +('20167', '0.25', '0', '0.16', 'Paladin - Seal of Light Proc'), +('53719', '0.25', '0', '0.16', 'Paladin - Seal of The Martyr Enemy Proc'), +('53718', '0.25', '0', '0.16', 'Paladin - Seal of The Martyr Self Proc'), +('25742', '0.07', '0', '0.039', 'Paladin - Seal of Righteousness Dummy Proc'), +('31803', '0', '0.013', '0.15', 'Paladin - Holy Vengeance'), +('52042', '0.045', '0', '0', 'Shaman - Healing Stream Totem Triggered Heal'), +('32546', '0.8068', '0', '0', 'Priest - Binding Heal'), +('34861', '0.402', '0', '0', 'Priest - Circle of Healing'), +('19236', '0.8068', '0', '0', 'Priest - Desperate Prayer'), +('2061', '0.8068', '0', '0', 'Priest - Flash Heal'), +('2060', '1.6135', '0', '0', 'Priest - Greater Heal'), +('23455', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 1'), +('23458', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 2'), +('23459', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 3'), +('27803', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 4'), +('27804', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 5'), +('27805', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 6'), +('25329', '0.3035', '0', '0', 'Priest - Holy Nova Heal Rank 7'), +('17', '0.8068', '0', '0', 'Priest - Power Word: Shield'), +('596', '0.8086', '0', '0', 'Priest - Prayer of Healing'), +('33110', '0.8068', '0', '0', 'Priest - Prayer of Mending Heal Proc'), +('139', '1.88', '0', '0', 'Priest - Renew'), +('2944', '0.1849', '0', '0', 'Priest - Devouring Plague'), +('14914', '0.5711', '0.024', '0', 'Priest - Holy Fire'), +('15237', '0.1606', '0', '0', 'Priest - Holy Nova Damage'), +('8129', '0', '0', '0', 'Priest - Mana Burn'), +('8092', '0.4296', '0', '0', 'Priest - Mind Blast'), +('15407', '0.257', '0', '0', 'Priest - Mind Flay'), +('49821', '0.7143', '0', '0', 'Priest - Mind Sear Trigger Rank 1'), +('53022', '0.7143', '0', '0', 'Priest - Mind Sear Trigger Rank 2'), +('34433', '0.65', '0', '0', 'Priest - Shadowfiend'), +('32379', '0.4296', '0', '0', 'Priest - Shadow Word: Death'), +('589', '0', '0.1829', '0', 'Priest - Shadow Word: Pain'), +('585', '0.714', '0', '0', 'Priest - Smite'), +('34914', '0', '0.4', '0', 'Priest - Vampiric Touch'), +('974', '0.4762', '0', '0', 'Shaman - Earth Shield'), +('1064', '1.34', '0', '0', 'Shaman - Chain Heal'), +('331', '1.6106', '0', '0', 'Shaman - Healing Wave'), +('8004', '0.8082', '0', '0', 'Shaman - Lesser Healing Wave'), +('61295', '0.4', '0.18', '0', 'Shaman - Riptide'), +('421', '0.57', '0', '0', 'Shaman - Chain Lightning'), +('8042', '0.3858', '0', '0', 'Shaman - Earth Shock'), +('8443', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 1'), +('8504', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 2'), +('8505', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 3'), +('11310', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 4'), +('11311', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 5'), +('25538', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 6'), +('25539', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 7'), +('61651', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 8'), +('61660', '0.2142', '0', '0', 'Shaman - Fire Nova Totem Casted by Totem Rank 9'), +('8050', '0.2142', '0.1', '0', 'Shaman - Flame Shock'), +('8026', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 1'), +('8028', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 2'), +('8029', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 3'), +('10445', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 4'), +('16343', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 5'), +('16344', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 6'), +('25488', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 7'), +('58786', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 8'), +('58787', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 9'), +('58788', '0.1', '0', '0', 'Shaman - Flametongue Weapon Proc Rank 10'), +('8056', '0.3858', '0', '0', 'Shaman - Frost Shock'), +('8034', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 1'), +('8037', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 2'), +('10458', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 3'), +('16352', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 4'), +('16353', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 5'), +('25501', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 6'), +('58797', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 7'), +('58798', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 8'), +('58799', '0.1', '0', '0', 'Shaman - Frostbrand Attack Rank 9'), +('51505', '0.5714', '0', '0', 'Shaman - Lava Burst'), +('403', '0.7143', '0', '0', 'Shaman - Lightning Bolt'), +('26364', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 1'), +('26365', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 2'), +('26366', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 3'), +('26367', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 4'), +('26369', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 5'), +('26370', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 6'), +('26363', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 7'), +('26371', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 8'), +('26372', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 9'), +('49278', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 10'), +('49279', '0.33', '0', '0', 'Shaman - Lightning Shield Proc Rank 11'), +('8188', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 1'), +('10582', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 2'), +('10583', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 3'), +('10584', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 4'), +('25551', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 5'), +('58733', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 6'), +('58736', '0.1', '0', '0', 'Shaman - Magma Totam Passive Rank 7'), +('3606', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 1'), +('6350', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 2'), +('6351', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 3'), +('6352', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 4'), +('10435', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 5'), +('10436', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 6'), +('25530', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 7'), +('58700', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 8'), +('58701', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 9'), +('58702', '0.1667', '0', '0', 'Shaman - Searing Totem Attack Rank 10'), +('980', '0', '0.1', '0', 'Warlock - Curse of Agony'), +('603', '0', '2', '0', 'Warlock - Curse of Doom'), +('172', '0', '0.3', '0', 'Warlock - Corruption'), +('348', '0.2', '0.2', '0', 'Warlock - Immolate'), +('27243', '0.22', '0.25', '0', 'Warlock - Seed of Corruption'), +('18265', '0', '1', '0', 'Warlock - Siphon Life'), +('30108', '0', '0.24', '0', 'Warlock - Unstable Affliction'), +('17962', '0.4286', '0', '0', 'Warlock - Conflagrate'), +('6789', '0.22', '0', '0', 'Warlock - Death Coil'), +('48181', '0.4729', '0', '0', 'Warlock - Haunt'), +('29722', '0.7143', '0', '0', 'Warlock - Incinerate'), +('5676', '0.4286', '0', '0', 'Warlock - Searing Pain'), +('686', '0.8571', '0', '0', 'Warlock - Shadow Bolt'), +('17877', '0.4286', '0', '0', 'Warlock - Shadowburn'), +('30283', '0.195', '0', '0', 'Warlock - Shadowfury'), +('6353', '1.15', '0', '0', 'Warlock - Soul Fire'), +('689', '0', '0.1428', '0', 'Warlock - Drain Life'), +('5138', '0', '0', '0', 'Warlock - Drain Mana'), +('1120', '0', '0.4286', '0', 'Warlock - Drain Soul'), +('755', '0', '0.4485', '0', 'Warlock - Health Funnel'), +('1949', '0', '0.0946', '0', 'Warlock - Hellfire'), +('5857', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 1'), +('11681', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 2'), +('11682', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 3'), +('27214', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 4'), +('47822', '0.1428', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 5'), +('42223', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 1'), +('42224', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 2'), +('42225', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 3'), +('42226', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 4'), +('42218', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 5'), +('47817', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 6'), +('47818', '0.952', '0', '0', 'Warlock - Rain of Fire Triggered Rank 7'), +('18220', '0.96', '0', '0', 'Warlock - Dark Pact'), +('6229', '0.3', '0', '0', 'Warlock - Shadow Ward'); diff --git a/sql/updates/3.0.9_old/1108_mangos_7198_01_characters_characters.sql b/sql/updates/3.0.9_old/1108_mangos_7198_01_characters_characters.sql new file mode 100644 index 0000000..c7cff65 --- /dev/null +++ b/sql/updates/3.0.9_old/1108_mangos_7198_01_characters_characters.sql @@ -0,0 +1,27 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7113_01_characters_character_achievement_progress required_7198_01_characters_characters bit;*/ + +UPDATE `characters`.`item_instance` AS `t1` +INNER JOIN `world`.`item_template` AS `t2` ON +`t2`.`entry` = SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',4),' ',-1) +SET `t1`.`data` = CONCAT( + SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',16),' ',-16), ' ', + IF (`t2`.`spellcharges_1` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',17),' ',-1) = 0, IF(`t2`.`spellcharges_1` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',17),' ',-1))), ' ', + IF (`t2`.`spellcharges_2` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',18),' ',-1) = 0, IF(`t2`.`spellcharges_2` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',18),' ',-1))), ' ', + IF (`t2`.`spellcharges_3` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',19),' ',-1) = 0, IF(`t2`.`spellcharges_3` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',19),' ',-1))), ' ', + IF (`t2`.`spellcharges_4` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',20),' ',-1) = 0, IF(`t2`.`spellcharges_4` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',20),' ',-1))), ' ', + IF (`t2`.`spellcharges_5` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',21),' ',-1) = 0, IF(`t2`.`spellcharges_5` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',21),' ',-1))), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',64),' ',-64+21),' ') +WHERE (`t2`.`spellid_1` = 55884) AND (SUBSTRING_INDEX(data,' ',64) = data AND SUBSTRING_INDEX(data,' ',64-1) <> data); + +UPDATE `characters`.`item_instance` AS `t1` +INNER JOIN `world`.`item_template` AS `t2` ON +`t2`.`entry` = SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',4),' ',-1) +SET `t1`.`data` = CONCAT( + SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',16),' ',-16), ' ', + IF (`t2`.`spellcharges_1` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',17),' ',-1) = 0, IF(`t2`.`spellcharges_1` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',17),' ',-1))), ' ', + IF (`t2`.`spellcharges_2` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',18),' ',-1) = 0, IF(`t2`.`spellcharges_2` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',18),' ',-1))), ' ', + IF (`t2`.`spellcharges_3` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',19),' ',-1) = 0, IF(`t2`.`spellcharges_3` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',19),' ',-1))), ' ', + IF (`t2`.`spellcharges_4` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',20),' ',-1) = 0, IF(`t2`.`spellcharges_4` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',20),' ',-1))), ' ', + IF (`t2`.`spellcharges_5` = 0, 0, IF (SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',21),' ',-1) = 0, IF(`t2`.`spellcharges_5` < 0, 4294967295, 1), SUBSTRING_INDEX(SUBSTRING_INDEX(`t1`.`data`,' ',21),' ',-1))), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',138),' ',-138+21),' ') +WHERE (`t2`.`spellid_1` = 55884) AND (SUBSTRING_INDEX(data,' ',138) = data AND SUBSTRING_INDEX(data,' ',138-1) <> data); diff --git a/sql/updates/3.0.9_old/1108_mangos_7199_01_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/1108_mangos_7199_01_world_spell_bonus_data.sql new file mode 100644 index 0000000..1179349 --- /dev/null +++ b/sql/updates/3.0.9_old/1108_mangos_7199_01_world_spell_bonus_data.sql @@ -0,0 +1,11 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7196_02_mangos_spell_bonus_data required_7199_01_mangos_spell_bonus_data bit;*/ + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (44614, 139, 49821, 53022, 18265, 31117, 28176); +INSERT INTO `spell_bonus_data` VALUES +('44614', '0.8571', '0', '0', 'Mage - Frostfire Bolt'), +('139', '0', '0.376', '0', 'Priest - Renew'), +('49821', '0.14286', '0', '0', 'Priest - Mind Sear Trigger Rank 1'), +('53022', '0.14286', '0', '0', 'Priest - Mind Sear Trigger Rank 2'), +('18265', '0', '0.1', '0', 'Warlock - Siphon Life'), +('31117', '1.8', '0', '0', 'Warlock - Unstable Affliction Dispell'), +('28176', '0', '0', '0', 'Warlock - Fel Armor'); diff --git a/sql/updates/3.0.9_old/1135_mangos_7207_01_world_creature.sql b/sql/updates/3.0.9_old/1135_mangos_7207_01_world_creature.sql new file mode 100644 index 0000000..1bba3c2 --- /dev/null +++ b/sql/updates/3.0.9_old/1135_mangos_7207_01_world_creature.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7205_01_mangos_spell_chain required_7207_01_mangos_creature bit;*/ + +ALTER TABLE creature + ADD COLUMN `phaseMask` smallint(5) unsigned NOT NULL default '1' AFTER `spawnMask`; diff --git a/sql/updates/3.0.9_old/1135_mangos_7207_02_world_gameobject.sql b/sql/updates/3.0.9_old/1135_mangos_7207_02_world_gameobject.sql new file mode 100644 index 0000000..dc0ef64 --- /dev/null +++ b/sql/updates/3.0.9_old/1135_mangos_7207_02_world_gameobject.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7207_01_mangos_creature required_7207_02_mangos_gameobject bit;*/ + +ALTER TABLE gameobject + ADD COLUMN `phaseMask` smallint(5) unsigned NOT NULL default '1' AFTER `spawnMask`; diff --git a/sql/updates/3.0.9_old/1135_mangos_7207_03_characters_corpse.sql b/sql/updates/3.0.9_old/1135_mangos_7207_03_characters_corpse.sql new file mode 100644 index 0000000..c33fd7e --- /dev/null +++ b/sql/updates/3.0.9_old/1135_mangos_7207_03_characters_corpse.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7198_01_characters_characters required_7207_03_characters_corpse bit;*/ + +ALTER TABLE corpse + ADD COLUMN `phaseMask` smallint(5) unsigned NOT NULL default '1' AFTER `map`; diff --git a/sql/updates/3.0.9_old/1140_mangos_7209_01_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/1140_mangos_7209_01_world_spell_bonus_data.sql new file mode 100644 index 0000000..1d1c907 --- /dev/null +++ b/sql/updates/3.0.9_old/1140_mangos_7209_01_world_spell_bonus_data.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7207_02_mangos_gameobject required_7209_01_mangos_spell_bonus_data bit;*/ + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (53595); +INSERT INTO `spell_bonus_data` VALUES +('53595', '0', '0', '0','Paladin - Hammer of the Righteous'); diff --git a/sql/updates/3.0.9_old/1185_mangos_7214_01_world_command.sql b/sql/updates/3.0.9_old/1185_mangos_7214_01_world_command.sql new file mode 100644 index 0000000..09ad0f6 --- /dev/null +++ b/sql/updates/3.0.9_old/1185_mangos_7214_01_world_command.sql @@ -0,0 +1,8 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7209_01_mangos_spell_bonus_data required_7214_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('gps','modify phase','npc phase','gobject phase'); +INSERT INTO `command` VALUES +('gps',1,'Syntax: .gps [$name|$shift-link]\r\n\r\nDisplay the position information for a selected character or creature (also if player name $name provided then for named player, or if creature/gameobject shift-link provided then pointed creature/gameobject if it loaded). Position information includes X, Y, Z, and orientation, map Id and zone Id'), +('modify phase',3,'Syntax: .modify phase #phasemask\r\n\r\nSelected character phasemask changed to #phasemask with related world vision update. Change active until in game phase changed, or GM-mode enable/disable, or re-login. Character pts pasemask update to same value.'), +('npc phase',3,'Syntax: .npc phase #phasemask\r\n\r\nSelected unit or pet phasemask changed to #phasemask with related world vision update for players. In creature case state saved to DB and persistent. In pet case change active until in game phase changed for owner, owner re-login, or GM-mode enable/disable..'), +('gobject phase',3,'Syntax: .gobject phase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'); diff --git a/sql/updates/3.0.9_old/1185_mangos_7214_02_world_trinity_string.sql b/sql/updates/3.0.9_old/1185_mangos_7214_02_world_trinity_string.sql new file mode 100644 index 0000000..0419b82 --- /dev/null +++ b/sql/updates/3.0.9_old/1185_mangos_7214_02_world_trinity_string.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7214_01_mangos_command required_7214_02_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE entry = 101; +INSERT INTO `trinity_string` VALUES +(101,'Map: %u (%s) Zone: %u (%s) Area: %u (%s) Phase: %u\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1185_mangos_7214_03_world_spell_proc_event.sql b/sql/updates/3.0.9_old/1185_mangos_7214_03_world_spell_proc_event.sql new file mode 100644 index 0000000..e93dcdc --- /dev/null +++ b/sql/updates/3.0.9_old/1185_mangos_7214_03_world_spell_proc_event.sql @@ -0,0 +1,865 @@ +DROP TABLE IF EXISTS `spell_proc_event`; +CREATE TABLE IF NOT EXISTS `spell_proc_event` ( + `entry` smallint(5) unsigned NOT NULL default '0', + `SchoolMask` tinyint(4) NOT NULL default '0', + `SpellFamilyName` smallint(5) unsigned NOT NULL default '0', + `SpellFamilyMask0` int(10) unsigned NOT NULL default '0', + `SpellFamilyMask1` int(10) unsigned NOT NULL default '0', + `SpellFamilyMask2` int(10) unsigned NOT NULL default '0', + `procFlags` int(10) unsigned NOT NULL default '0', + `procEx` int(10) unsigned NOT NULL default '0', + `ppmRate` float NOT NULL default '0', + `CustomChance` float NOT NULL default '0', + `Cooldown` int(10) unsigned NOT NULL default '0', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(905, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(945, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(974, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(1463, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(3232, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(5952, 0, 8, 1, 1, 0, 0, 0, 0, 0, 0), +(6346, 0, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(7383, 1, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(7434, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(8134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(8178, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(8494, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(8495, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(9452, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(9782, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(9784, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(9799, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(10191, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(10192, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(10193, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(10431, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(10432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(11095, 0, 3, 16, 0, 0, 0, 0, 0, 0, 0), +(11119, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(11120, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(11129, 0, 3, 12582935, 64, 0, 0, 0, 0, 0, 0), +(11180, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0), +(11185, 0, 3, 128, 0, 0, 327680, 0, 0, 0, 0), +(11255, 0, 3, 16384, 0, 0, 0, 0, 0, 0, 0), +(12169, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12281, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12289, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(12298, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12311, 0, 4, 2048, 1, 0, 0, 0, 0, 0, 0), +(12317, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12319, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12322, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(12487, 0, 3, 128, 0, 0, 327680, 0, 0, 0, 0), +(12488, 0, 3, 128, 0, 0, 327680, 0, 0, 0, 0), +(12598, 0, 3, 16384, 0, 0, 0, 0, 0, 0, 0), +(12668, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(12724, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12725, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12726, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12727, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(12797, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(12799, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(12812, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12813, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12814, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12815, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(12834, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12846, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(12847, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(12848, 4, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(12849, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12867, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12872, 0, 3, 16, 0, 0, 0, 0, 0, 0, 0), +(12873, 0, 3, 16, 0, 0, 0, 0, 0, 0, 0), +(12958, 0, 4, 2048, 1, 0, 0, 0, 0, 0, 0), +(12966, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12967, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12968, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12969, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12970, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(12971, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12972, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12973, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12974, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(12999, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0), +(13000, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(13001, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0), +(13002, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0), +(13045, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13046, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13047, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13048, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(13163, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(13165, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(13754, 0, 8, 16, 0, 0, 0, 0, 0, 0, 0), +(13867, 0, 8, 16, 0, 0, 0, 0, 0, 0, 0), +(13983, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0), +(14070, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0), +(14071, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0), +(14156, 0, 8, 4063232, 0, 0, 0, 0, 0, 0, 0), +(14160, 0, 8, 4063232, 0, 0, 0, 0, 0, 0, 0), +(14161, 0, 8, 4063232, 0, 0, 0, 0, 0, 0, 0), +(14186, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14190, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14193, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14194, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14195, 0, 8, 1082131720, 2, 0, 0, 2, 0, 0, 0), +(14318, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14319, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14320, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14321, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14322, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(14531, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(14774, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(14892, 0, 6, 268443136, 65540, 0, 0, 2, 0, 0, 0), +(15088, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(15128, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(15268, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15277, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(15286, 32, 6, 0, 0, 0, 0, 0, 0, 0, 0), +(15323, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15324, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15325, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15326, 32, 6, 101187584, 2, 0, 0, 0, 0, 0, 0), +(15337, 0, 6, 8192, 2, 0, 0, 2, 0, 0, 0), +(15338, 0, 6, 8192, 2, 0, 0, 2, 0, 0, 0), +(15346, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(15362, 0, 6, 268443136, 65540, 0, 0, 2, 0, 0, 0), +(15363, 0, 6, 268443136, 65540, 0, 0, 2, 0, 0, 0), +(15600, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), +(16164, 0, 11, 2416967875, 0, 0, 0, 2, 0, 0, 0), +(16176, 0, 11, 448, 0, 0, 0, 2, 0, 0, 0), +(16180, 0, 11, 192, 0, 0, 0, 2, 0, 0, 0), +(16196, 0, 11, 192, 0, 0, 0, 2, 0, 0, 0), +(16198, 0, 11, 192, 0, 0, 0, 2, 0, 0, 0), +(16235, 0, 11, 448, 0, 0, 0, 2, 0, 0, 0), +(16240, 0, 11, 448, 0, 0, 0, 2, 0, 0, 0), +(16256, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16257, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16277, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16278, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16279, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16280, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(16281, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16282, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16283, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16284, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16487, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16489, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16492, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16550, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(16624, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(16850, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0), +(16864, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(16880, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16923, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0), +(16924, 0, 7, 4, 0, 0, 0, 0, 0, 0, 0), +(16952, 0, 7, 233472, 1024, 0, 0, 2, 0, 0, 0), +(16954, 0, 7, 233472, 1024, 0, 0, 2, 0, 0, 0), +(16958, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(16961, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(17106, 0, 7, 524288, 0, 0, 0, 0, 0, 0, 0), +(17107, 0, 7, 524288, 0, 0, 0, 0, 0, 0, 0), +(17108, 0, 7, 524288, 0, 0, 0, 0, 0, 0, 0), +(17364, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17495, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(17793, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17794, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0), +(17796, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17797, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17798, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17799, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17800, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(17801, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17802, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(17803, 0, 5, 1, 0, 0, 0, 2, 0, 0, 0), +(18073, 0, 5, 96, 128, 0, 0, 0, 0, 0, 0), +(18094, 0, 5, 10, 0, 0, 0, 0, 0, 0, 0), +(18095, 0, 5, 10, 0, 0, 0, 0, 0, 0, 0), +(18096, 0, 5, 96, 128, 0, 0, 0, 0, 0, 0), +(18119, 0, 5, 997, 4288, 0, 0, 0, 0, 0, 0), +(18120, 0, 5, 997, 4288, 0, 0, 0, 0, 0, 0), +(18820, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(19184, 0, 9, 20, 8192, 0, 0, 0, 0, 0, 0), +(19228, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0), +(19232, 0, 9, 64, 0, 0, 0, 0, 0, 0, 0), +(19233, 0, 9, 64, 0, 0, 0, 0, 0, 0, 0), +(19387, 0, 9, 20, 8192, 0, 0, 0, 0, 0, 0), +(19388, 0, 9, 20, 8192, 0, 0, 0, 0, 0, 0), +(19572, 0, 9, 8388608, 0, 0, 16384, 0, 0, 0, 0), +(19573, 0, 9, 8388608, 0, 0, 16384, 0, 0, 0, 0), +(20049, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20056, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20057, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20128, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20131, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20132, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20164, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0), +(20165, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0), +(20166, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0), +(20182, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20210, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20212, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20213, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20214, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20215, 0, 10, 3221225472, 65536, 0, 0, 2, 0, 0, 0), +(20234, 0, 10, 32768, 0, 0, 0, 0, 0, 0, 0), +(20235, 0, 10, 32768, 0, 0, 0, 0, 0, 0, 0), +(20375, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(20500, 0, 4, 268435456, 0, 0, 0, 0, 0, 0, 0), +(20501, 0, 4, 268435456, 0, 0, 0, 0, 0, 0, 0), +(20705, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(20911, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(20925, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20927, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(20928, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(21185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(21882, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(21890, 0, 4, 712396527, 876, 0, 0, 0, 0, 0, 0), +(22007, 0, 3, 2097185, 0, 0, 0, 65536, 0, 0, 0), +(22618, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(22648, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(23547, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(23548, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(23551, 0, 11, 192, 0, 0, 0, 0, 0, 0, 0), +(23552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(23572, 0, 11, 192, 0, 0, 0, 0, 0, 0, 0), +(23578, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(23581, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(23602, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(23686, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(23688, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(23689, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0), +(23695, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(23721, 0, 9, 2048, 0, 0, 0, 0, 0, 0, 0), +(23920, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(24353, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(24389, 0, 3, 12582935, 64, 0, 0, 0, 0, 0, 0), +(24398, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(24658, 0, 0, 0, 0, 0, 82192, 0, 0, 0, 0), +(24905, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0), +(24932, 0, 0, 0, 0, 0, 0, 2, 0, 0, 6), +(25050, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(25296, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(25469, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(25472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(25669, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), +(25899, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(25988, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(26016, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(26107, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0), +(26119, 0, 10, 2416967683, 0, 0, 0, 65536, 0, 0, 0), +(26128, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0), +(26135, 0, 10, 8388608, 0, 0, 0, 65536, 0, 0, 0), +(26480, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(26605, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(27044, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(27131, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(27179, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(27419, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27498, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27521, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(27656, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27774, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(27787, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(27811, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(27815, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(27816, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(28592, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0), +(28593, 16, 3, 0, 0, 0, 0, 0, 0, 0, 0), +(28716, 0, 7, 16, 0, 0, 294912, 0, 0, 0, 0), +(28719, 0, 7, 32, 0, 0, 0, 2, 0, 0, 0), +(28744, 0, 7, 64, 0, 0, 278528, 0, 0, 0, 0), +(28752, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(28789, 0, 10, 3221225472, 0, 0, 0, 0, 0, 0, 0), +(28802, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(28809, 0, 6, 4096, 0, 0, 0, 2, 0, 0, 0), +(28812, 0, 8, 33554438, 0, 0, 0, 2, 0, 0, 0), +(28816, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(28823, 0, 11, 192, 0, 0, 0, 0, 0, 0, 0), +(28847, 0, 7, 32, 0, 0, 0, 0, 0, 0, 0), +(28849, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(29074, 20, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(29075, 20, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(29076, 20, 3, 0, 0, 0, 0, 2, 0, 0, 0), +(29150, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29179, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(29180, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(29385, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(29441, 0, 0, 0, 0, 0, 0, 8, 0, 0, 1), +(29444, 0, 0, 0, 0, 0, 0, 8, 0, 0, 1), +(29455, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(29501, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29593, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(29594, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(29624, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29625, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29626, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29632, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29633, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29634, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29635, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29636, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29637, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(29801, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(29834, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(29838, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(29977, 0, 3, 12582935, 64, 0, 0, 0, 0, 0, 0), +(30003, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(30160, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30293, 0, 5, 897, 192, 0, 0, 0, 0, 0, 0), +(30295, 0, 5, 897, 192, 0, 0, 0, 0, 0, 0), +(30296, 0, 5, 897, 192, 0, 0, 0, 0, 0, 0), +(30299, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30301, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30302, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30675, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30678, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30679, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30680, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30681, 0, 11, 3, 0, 0, 0, 0, 0, 0, 0), +(30701, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30705, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(30802, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30803, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30804, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30805, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30806, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30807, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30808, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30809, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30810, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30811, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(30823, 0, 0, 0, 0, 0, 0, 0, 10.5, 0, 0), +(30881, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30883, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30884, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30885, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30886, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5), +(30937, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(31124, 0, 8, 536870926, 0, 0, 0, 0, 0, 0, 0), +(31126, 0, 8, 536870926, 0, 0, 0, 0, 0, 0, 0), +(31244, 0, 8, 4063232, 9, 0, 0, 4, 0, 0, 0), +(31245, 0, 8, 4063232, 9, 0, 0, 4, 0, 0, 0), +(31394, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(31569, 0, 3, 65536, 0, 0, 0, 0, 0, 0, 0), +(31570, 0, 3, 65536, 0, 0, 0, 0, 0, 0, 0), +(31785, 0, 0, 0, 0, 0, 34816, 0, 0, 0, 0), +(31794, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(31801, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0), +(31833, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(31835, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(31836, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(31871, 0, 10, 16, 0, 0, 16384, 0, 0, 0, 0), +(31872, 0, 10, 16, 0, 0, 16384, 0, 0, 0, 0), +(31876, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31877, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31878, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31904, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32385, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32387, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32392, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32393, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32394, 0, 5, 1026, 17, 0, 0, 0, 0, 0, 0), +(32409, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(32587, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32593, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(32594, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(32642, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32734, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(32748, 0, 8, 0, 1, 0, 320, 0, 0, 0, 0), +(32776, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32777, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(32837, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 45), +(32844, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0), +(32885, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33076, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(33089, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(33127, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(33142, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33145, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33146, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33150, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33151, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33154, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33191, 0, 6, 8421376, 1024, 0, 0, 0, 0, 0, 0), +(33192, 0, 6, 8421376, 1024, 0, 0, 0, 0, 0, 0), +(33193, 0, 6, 8421376, 1024, 0, 0, 0, 0, 0, 0), +(33299, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(33510, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0), +(33648, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33719, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(33736, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(33746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(33757, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(33759, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(33776, 0, 0, 0, 0, 0, 34816, 0, 0, 0, 0), +(33881, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33882, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33883, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(33953, 0, 0, 0, 0, 0, 16384, 0, 0, 0, 45), +(34080, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0), +(34138, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(34139, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(34258, 0, 10, 1024, 8, 0, 0, 0, 0, 0, 0), +(34262, 0, 10, 8388608, 0, 0, 0, 65536, 0, 0, 0), +(34320, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34355, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(34497, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34498, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34499, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34500, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34502, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34503, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34584, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(34586, 0, 0, 0, 0, 0, 0, 0, 1.5, 0, 0), +(34598, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(34749, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0), +(34753, 0, 6, 6144, 4, 0, 0, 2, 0, 0, 0), +(34774, 0, 0, 0, 0, 0, 0, 0, 1.5, 0, 20), +(34783, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(34827, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(34859, 0, 6, 6144, 4, 0, 0, 2, 0, 0, 0), +(34860, 0, 6, 6144, 4, 0, 0, 2, 0, 0, 0), +(34914, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(34916, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(34917, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(34935, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8), +(34938, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8), +(34939, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8), +(34950, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(34954, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(35077, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(35080, 0, 0, 0, 0, 0, 0, 0, 1, 0, 60), +(35083, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(35086, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(35100, 0, 9, 12289, 0, 0, 65856, 0, 0, 0, 0), +(35102, 0, 9, 12289, 0, 0, 0, 0, 0, 0, 0), +(35103, 0, 9, 12289, 0, 0, 0, 0, 0, 0, 0), +(35121, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(36096, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(36111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(36541, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(37165, 0, 8, 2098176, 0, 0, 0, 0, 0, 0, 0), +(37168, 0, 8, 4063232, 9, 0, 0, 0, 0, 0, 0), +(37170, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), +(37173, 0, 8, 750519704, 262, 0, 0, 0, 0, 0, 30), +(37189, 0, 10, 3221225472, 0, 0, 0, 2, 0, 0, 60), +(37193, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(37195, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(37197, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 45), +(37213, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(37214, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37227, 0, 11, 448, 0, 0, 0, 2, 0, 0, 60), +(37237, 0, 11, 1, 0, 0, 0, 2, 0, 0, 0), +(37247, 8, 0, 0, 0, 0, 0, 65536, 0, 0, 45), +(37377, 32, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37379, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(37384, 0, 5, 1, 0, 0, 0, 0, 0, 0, 0), +(37443, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(37514, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(37516, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(37519, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0), +(37523, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(37528, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0), +(37536, 0, 4, 65536, 0, 0, 0, 0, 0, 0, 0), +(37568, 0, 6, 2048, 0, 0, 0, 0, 0, 0, 0), +(37594, 0, 6, 4096, 0, 0, 0, 0, 0, 0, 0), +(37600, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37601, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(37603, 0, 6, 32768, 0, 0, 0, 0, 0, 0, 0), +(37655, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(37657, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3), +(38026, 1, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(38031, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(38290, 0, 0, 0, 0, 0, 0, 0, 1.6, 0, 0), +(38326, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38327, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38334, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(38347, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38350, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(38394, 0, 5, 6, 0, 0, 0, 0, 0, 0, 0), +(38857, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(39027, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(39372, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0), +(39437, 4, 5, 4964, 192, 0, 0, 65536, 0, 0, 0), +(39442, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), +(39443, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(39530, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(39958, 0, 0, 0, 0, 0, 0, 0, 0.7, 0, 40), +(40407, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), +(40438, 0, 6, 32832, 0, 0, 0, 0, 0, 0, 0), +(40442, 0, 7, 20, 1088, 0, 0, 0, 0, 0, 0), +(40444, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(40458, 0, 4, 33554432, 1537, 0, 0, 0, 0, 0, 0), +(40463, 0, 11, 129, 16, 0, 0, 0, 0, 0, 0), +(40470, 0, 10, 3229614080, 0, 0, 0, 0, 0, 0, 0), +(40475, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0), +(40478, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0), +(40482, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(40485, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(40899, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(41034, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(41260, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(41262, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(41381, 0, 0, 0, 0, 0, 0, 256, 0, 0, 0), +(41393, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(41434, 0, 0, 0, 0, 0, 0, 0, 2, 0, 45), +(41469, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0), +(41635, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(41989, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0), +(42083, 0, 0, 0, 0, 0, 0, 2, 0, 0, 45), +(42135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90), +(42136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90), +(42368, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(42370, 0, 11, 64, 0, 0, 0, 0, 0, 0, 0), +(42770, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(43019, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(43020, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(43338, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(43443, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(43726, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(43728, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(43737, 0, 7, 0, 1088, 0, 0, 0, 0, 0, 10), +(43739, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(43741, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(43745, 0, 10, 0, 512, 0, 0, 0, 0, 0, 0), +(43748, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(43750, 0, 11, 1, 0, 0, 0, 0, 0, 0, 0), +(43819, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(44394, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(44395, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(44396, 0, 0, 0, 0, 0, 0, 1024, 0, 0, 0), +(44401, 0, 3, 2097152, 0, 0, 0, 4095, 0, 0, 0), +(44404, 0, 3, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(44442, 0, 3, 8388608, 64, 0, 0, 65536, 0, 0, 1), +(44443, 0, 3, 8388608, 64, 0, 0, 65536, 0, 0, 1), +(44445, 0, 3, 19, 4096, 0, 0, 0, 0, 0, 0), +(44446, 0, 3, 19, 4096, 0, 0, 0, 0, 0, 0), +(44448, 0, 3, 19, 4096, 0, 0, 0, 0, 0, 0), +(44449, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44469, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44470, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44471, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44472, 0, 3, 551686775, 102472, 0, 0, 2, 0, 0, 0), +(44546, 0, 3, 33555104, 0, 0, 0, 0, 0, 0, 0), +(44548, 0, 3, 33555104, 0, 0, 0, 0, 0, 0, 0), +(44549, 0, 3, 33555104, 0, 0, 0, 0, 0, 0, 0), +(44835, 0, 7, 0, 128, 0, 16, 0, 0, 0, 0), +(45054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15), +(45057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(45234, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(45243, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(45244, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(45354, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45481, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45482, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45483, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(45484, 0, 0, 0, 0, 0, 16384, 0, 0, 0, 45), +(46025, 32, 6, 0, 0, 0, 0, 0, 0, 0, 0), +(46092, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(46098, 0, 11, 128, 0, 0, 0, 0, 0, 0, 0), +(46569, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(46662, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20), +(46832, 0, 7, 1, 0, 0, 0, 65536, 0, 0, 0), +(46854, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(46855, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(46867, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(46913, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46914, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46915, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46916, 0, 4, 0, 1024, 0, 0, 2, 0, 0, 0), +(46951, 0, 4, 1024, 64, 0, 0, 0, 0, 0, 0), +(46952, 0, 0, 1024, 64, 0, 0, 0, 0, 0, 0), +(46953, 0, 0, 1024, 64, 0, 0, 0, 0, 0, 0), +(47195, 0, 5, 2, 0, 0, 0, 0, 0, 0, 30), +(47196, 0, 5, 2, 0, 0, 0, 0, 0, 0, 30), +(47197, 0, 5, 2, 0, 0, 0, 0, 0, 0, 30), +(47201, 0, 5, 8, 262144, 0, 0, 65536, 0, 0, 0), +(47202, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47203, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47204, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47205, 0, 5, 8, 262144, 0, 0, 0, 0, 0, 0), +(47232, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47234, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47235, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47245, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(47246, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(47247, 32, 5, 0, 0, 0, 0, 0, 0, 0, 0), +(47258, 0, 5, 0, 8388608, 0, 0, 65536, 0, 0, 0), +(47259, 0, 5, 0, 8388608, 0, 0, 65536, 0, 0, 0), +(47260, 0, 5, 0, 8388608, 0, 0, 65536, 0, 0, 0), +(47263, 32, 5, 0, 0, 0, 0, 2, 0, 0, 20), +(47264, 32, 5, 0, 0, 0, 0, 2, 0, 0, 20), +(47265, 32, 5, 0, 0, 0, 0, 2, 0, 0, 20), +(47509, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47511, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47515, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(47516, 0, 6, 6144, 65536, 0, 0, 0, 0, 0, 0), +(47517, 0, 6, 6144, 65536, 0, 0, 0, 0, 0, 0), +(47535, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47536, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47537, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47538, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47539, 0, 6, 6144, 8388608, 0, 0, 0, 0, 0, 0), +(47549, 0, 6, 0, 131072, 0, 0, 0, 0, 0, 0), +(47551, 0, 6, 0, 131072, 0, 0, 0, 0, 0, 0), +(47552, 0, 6, 0, 131072, 0, 0, 0, 0, 0, 0), +(47555, 0, 6, 6144, 0, 0, 0, 0, 0, 0, 0), +(47556, 0, 6, 6144, 0, 0, 0, 0, 0, 0, 0), +(47557, 0, 6, 6144, 0, 0, 0, 0, 0, 0, 0), +(47572, 0, 6, 65536, 0, 0, 0, 0, 0, 0, 0), +(47580, 0, 6, 0, 0, 64, 0, 65536, 0, 0, 0), +(47581, 0, 6, 0, 0, 64, 0, 65536, 0, 0, 0), +(47582, 0, 6, 0, 0, 64, 0, 65536, 0, 0, 0), +(48110, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48111, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48112, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48113, 0, 0, 0, 0, 0, 656040, 0, 0, 0, 0), +(48159, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(48160, 0, 6, 8192, 0, 0, 0, 0, 0, 0, 0), +(48483, 0, 7, 34816, 1088, 0, 0, 0, 0, 0, 0), +(48484, 0, 7, 34816, 1088, 0, 0, 0, 0, 0, 0), +(48485, 0, 7, 34816, 1088, 0, 0, 0, 0, 0, 0), +(48496, 0, 7, 96, 33554434, 0, 0, 2, 0, 0, 0), +(48499, 0, 7, 96, 33554434, 0, 0, 2, 0, 0, 0), +(48500, 0, 7, 96, 33554434, 0, 0, 2, 0, 0, 0), +(48506, 0, 7, 5, 0, 0, 0, 0, 0, 0, 0), +(48510, 0, 7, 5, 0, 0, 0, 0, 0, 0, 0), +(48511, 0, 7, 5, 0, 0, 0, 0, 0, 0, 0), +(48516, 0, 7, 5, 0, 0, 0, 2, 0, 0, 30), +(48521, 0, 7, 5, 0, 0, 0, 2, 0, 0, 30), +(48525, 0, 7, 5, 0, 0, 0, 2, 0, 0, 30), +(48833, 0, 7, 0, 1088, 0, 0, 0, 0, 0, 0), +(48835, 0, 10, 0, 8, 0, 0, 0, 0, 0, 0), +(48837, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(48951, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(48952, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(48988, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(49018, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49137, 0, 15, 0, 16384, 0, 0, 0, 0, 0, 0), +(49188, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(49208, 0, 15, 4456448, 0, 0, 0, 0, 0, 0, 0), +(49222, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49281, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49283, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49284, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(49503, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(49504, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(49529, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49530, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49531, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49532, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(49622, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60), +(49657, 0, 15, 0, 16384, 0, 0, 0, 0, 0, 0), +(50781, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51123, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51127, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51128, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51129, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51130, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51349, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51352, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10), +(51466, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51470, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51474, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(51478, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(51479, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(51556, 0, 11, 192, 0, 16, 0, 2, 0, 0, 0), +(51557, 0, 11, 192, 0, 16, 0, 2, 0, 0, 0), +(51558, 0, 11, 192, 0, 16, 0, 2, 0, 0, 0), +(51562, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51563, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51564, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51565, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51566, 0, 11, 256, 0, 16, 0, 0, 0, 0, 0), +(51625, 0, 8, 268476416, 0, 0, 0, 0, 0, 0, 0), +(51626, 0, 8, 268476416, 0, 0, 0, 0, 0, 0, 0), +(51627, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(51628, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(51629, 0, 0, 0, 0, 0, 0, 112, 0, 0, 0), +(51634, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51635, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51636, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(51664, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51665, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51667, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51668, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51669, 0, 8, 131072, 8, 0, 0, 0, 0, 0, 0), +(51672, 0, 0, 0, 0, 0, 0, 16, 0, 0, 1), +(51674, 0, 0, 0, 0, 0, 0, 16, 0, 0, 1), +(51679, 0, 8, 1, 1, 0, 0, 0, 0, 0, 0), +(51692, 0, 8, 512, 0, 0, 0, 2, 0, 0, 0), +(51696, 0, 8, 512, 0, 0, 0, 2, 0, 0, 0), +(51698, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1), +(51700, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1), +(51701, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1), +(51940, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(51989, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52004, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52005, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52007, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52008, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0), +(52020, 0, 7, 32768, 1048576, 0, 0, 0, 0, 0, 0), +(52127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(52420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30), +(52423, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(52795, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52797, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52798, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52799, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52800, 0, 6, 1, 0, 0, 0, 0, 0, 0, 0), +(52898, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53137, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(53138, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(53215, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(53216, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(53217, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0), +(53221, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(53222, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(53224, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0), +(53228, 0, 9, 32, 16777216, 0, 0, 0, 0, 0, 0), +(53232, 0, 9, 32, 16777216, 0, 0, 0, 0, 0, 0), +(53256, 0, 9, 2048, 8388609, 0, 0, 2, 0, 0, 0), +(53259, 0, 9, 2048, 8388609, 0, 0, 2, 0, 0, 0), +(53260, 0, 9, 2048, 8388609, 0, 0, 2, 0, 0, 0), +(53290, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53291, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53292, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53293, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53294, 0, 9, 2048, 2147483647, 0, 0, 2, 0, 0, 0), +(53380, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53381, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53382, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53383, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53384, 0, 10, 8388608, 131072, 0, 0, 2, 0, 0, 0), +(53486, 0, 10, 8388608, 163840, 0, 0, 2, 0, 0, 0), +(53488, 0, 10, 8388608, 163840, 0, 0, 2, 0, 0, 0), +(53501, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53502, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53503, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(53551, 0, 10, 4096, 0, 0, 0, 0, 0, 0, 0), +(53552, 0, 10, 4096, 0, 0, 0, 0, 0, 0, 0), +(53553, 0, 10, 4096, 0, 0, 0, 0, 0, 0, 0), +(53569, 0, 10, 2097152, 0, 0, 0, 2, 0, 0, 0), +(53576, 0, 10, 2097152, 0, 0, 0, 2, 0, 0, 0), +(53601, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6), +(53671, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(53673, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54149, 0, 10, 2097152, 0, 0, 0, 2, 0, 0, 0), +(54151, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54154, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54155, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(54278, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(54486, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54488, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54489, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54490, 0, 0, 536870945, 36864, 0, 0, 0, 0, 0, 0), +(54738, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(54747, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(54749, 0, 0, 0, 0, 0, 0, 65536, 0, 0, 0), +(54754, 0, 7, 16, 0, 0, 0, 0, 0, 0, 0), +(54841, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(54936, 0, 10, 1073741824, 0, 0, 0, 0, 0, 0, 0), +(54937, 0, 10, 2147483648, 0, 0, 0, 0, 0, 0, 0), +(54939, 0, 10, 32768, 0, 0, 0, 0, 0, 0, 0), +(55440, 0, 11, 64, 0, 0, 0, 0, 0, 0, 0), +(55620, 0, 15, 1, 134217728, 0, 0, 0, 0, 0, 0), +(55623, 0, 15, 1, 134217728, 0, 0, 0, 0, 0, 0), +(55666, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55667, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55668, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55669, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55670, 0, 15, 1, 0, 0, 0, 0, 0, 0, 0), +(55677, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0), +(55680, 0, 6, 512, 0, 0, 0, 0, 0, 0, 0), +(55689, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56218, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0), +(56333, 0, 9, 4, 0, 512, 0, 0, 0, 0, 0), +(56336, 0, 9, 4, 0, 512, 0, 0, 0, 0, 0), +(56337, 0, 9, 4, 0, 512, 0, 0, 0, 0, 0), +(56342, 0, 9, 16384, 0, 0, 0, 0, 0, 0, 0), +(56343, 0, 9, 16384, 0, 0, 0, 0, 0, 0, 0), +(56344, 0, 9, 16384, 0, 0, 0, 0, 0, 0, 0), +(56364, 0, 3, 0, 16777216, 0, 0, 0, 0, 0, 0), +(56451, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(56611, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56612, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56613, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56614, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(56636, 0, 4, 32, 0, 0, 0, 0, 0, 0, 0), +(56637, 0, 4, 32, 0, 0, 0, 0, 0, 0, 0), +(56638, 0, 4, 32, 0, 0, 0, 0, 0, 0, 0), +(56821, 0, 8, 2, 0, 0, 0, 2, 0, 0, 0), +(56822, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(56834, 0, 15, 4456448, 0, 0, 0, 0, 0, 0, 0), +(56835, 0, 15, 4456448, 0, 0, 0, 0, 0, 0, 0), +(57878, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(57880, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(57881, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(57960, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3), +(58357, 0, 4, 64, 0, 0, 0, 2, 0, 0, 0), +(58364, 0, 4, 1024, 0, 0, 0, 0, 0, 0, 0), +(58372, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0), +(58386, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(58435, 0, 5, 2, 256, 0, 0, 0, 0, 0, 0), +(58436, 0, 5, 2, 256, 0, 0, 0, 0, 0, 0), +(58437, 0, 5, 2, 256, 0, 0, 0, 0, 0, 0), +(58616, 0, 15, 262144, 0, 0, 0, 0, 0, 0, 0), +(58620, 0, 15, 0, 16384, 0, 0, 0, 0, 0, 0), +(58626, 0, 15, 33554432, 0, 0, 0, 0, 0, 0, 0), +(58631, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(58642, 0, 15, 0, 134217728, 0, 0, 0, 0, 0, 0), +(58644, 0, 15, 0, 4, 0, 0, 0, 0, 0, 0), +(58647, 0, 15, 0, 4, 0, 0, 0, 0, 0, 0), +(58676, 0, 15, 0, 8, 0, 0, 0, 0, 0, 0), +(58677, 0, 15, 8192, 0, 0, 0, 0, 0, 0, 0), +(58872, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(58874, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0), +(58901, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(59057, 0, 15, 2, 0, 0, 0, 0, 0, 0, 0), +(59176, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(59327, 0, 15, 134217728, 0, 0, 0, 0, 0, 0, 0), +(59725, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0), +(60132, 0, 15, 0, 134348800, 0, 0, 0, 0, 0, 0), +(60170, 0, 5, 6, 0, 0, 0, 0, 0, 0, 0), +(60172, 0, 5, 262144, 0, 0, 0, 65536, 0, 0, 0), +(60200, 0, 15, 4096, 0, 0, 0, 65536, 0, 0, 0), +(60493, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45), +(60503, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0), +(60537, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0), +(60564, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60571, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60572, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60573, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60574, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60575, 0, 11, 2416967680, 0, 0, 0, 0, 0, 0, 0), +(60617, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0), +(60710, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60717, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60719, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60722, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60724, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60726, 0, 7, 2, 0, 0, 0, 0, 0, 0, 0), +(60770, 0, 11, 1, 0, 0, 0, 0, 0, 0, 0), +(60818, 0, 10, 0, 512, 0, 0, 0, 0, 0, 0), +(60826, 0, 15, 20971520, 0, 0, 0, 0, 0, 0, 0), +(61188, 0, 5, 4, 0, 0, 0, 0, 0, 0, 0), +(61257, 0, 0, 0, 0, 0, 131752, 65536, 0, 0, 0), +(61324, 0, 10, 0, 131072, 0, 0, 0, 0, 0, 0), +(61846, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0), +(61847, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0); diff --git a/sql/updates/3.0.9_old/1206_world_scripts.sql b/sql/updates/3.0.9_old/1206_world_scripts.sql new file mode 100644 index 0000000..b1e0d61 --- /dev/null +++ b/sql/updates/3.0.9_old/1206_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_legion_obelisk' WHERE `entry` IN (185193,185195,185196,185197,185198); diff --git a/sql/updates/3.0.9_old/1207_world_scripts.sql b/sql/updates/3.0.9_old/1207_world_scripts.sql new file mode 100644 index 0000000..43885c6 --- /dev/null +++ b/sql/updates/3.0.9_old/1207_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_surristrasz' WHERE `entry`=24795; +UPDATE `creature_template` SET `ScriptName`='npc_tiare' WHERE `entry`=30051; diff --git a/sql/updates/3.0.9_old/1237_mangos_7230_01_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/1237_mangos_7230_01_world_spell_bonus_data.sql new file mode 100644 index 0000000..db77548 --- /dev/null +++ b/sql/updates/3.0.9_old/1237_mangos_7230_01_world_spell_bonus_data.sql @@ -0,0 +1,9 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7230_01_mangos_spell_chain required_7230_02_mangos_spell_bonus_data bit;*/ + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (18220,18937,18938,27265,59092); +INSERT INTO `spell_bonus_data` VALUES +('18220', '0.96', '0', '0', 'Warlock - Dark Pact Rank 1'), +('18937', '0.96', '0', '0', 'Warlock - Dark Pact Rank 2'), +('18938', '0.96', '0', '0', 'Warlock - Dark Pact Rank 3'), +('27265', '0.96', '0', '0', 'Warlock - Dark Pact Rank 4'), +('59092', '0.96', '0', '0', 'Warlock - Dark Pact Rank 5'); diff --git a/sql/updates/3.0.9_old/1248_mangos_7235_01_world_command.sql b/sql/updates/3.0.9_old/1248_mangos_7235_01_world_command.sql new file mode 100644 index 0000000..e229773 --- /dev/null +++ b/sql/updates/3.0.9_old/1248_mangos_7235_01_world_command.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7230_02_mangos_spell_bonus_data required_7235_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` = 'reset achievements'; +INSERT INTO `command` VALUES +('reset achievements',3,'Syntax: .reset achievements [$playername]\r\n\r\nReset achievements data for selected or named (online or offline) character. Achievements for persistance progress data like completed quests/etc re-filled at reset. Achievements for events like kills/casts/etc will lost.'); diff --git a/sql/updates/3.0.9_old/1288_mangos_7242_01_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/1288_mangos_7242_01_world_spell_bonus_data.sql new file mode 100644 index 0000000..169584c --- /dev/null +++ b/sql/updates/3.0.9_old/1288_mangos_7242_01_world_spell_bonus_data.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7235_01_mangos_command required_7242_01_mangos_spell_bonus_data bit;*/ + +DELETE FROM spell_bonus_data WHERE entry IN (34913, 43043, 43044); +INSERT INTO spell_bonus_data VALUES + (34913, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 1'), + (43043, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 2'), + (43044, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 3'); diff --git a/sql/updates/3.0.9_old/1293_mangos_7249_01_world_spell_proc_event.sql b/sql/updates/3.0.9_old/1293_mangos_7249_01_world_spell_proc_event.sql new file mode 100644 index 0000000..80ec087 --- /dev/null +++ b/sql/updates/3.0.9_old/1293_mangos_7249_01_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7242_01_mangos_spell_bonus_data required_7249_01_mangos_spell_proc_event bit;*/ + +DELETE FROM `spell_proc_event` WHERE `entry`='60200'; diff --git a/sql/updates/3.0.9_old/1296_mangos_7252_01_world_command.sql b/sql/updates/3.0.9_old/1296_mangos_7252_01_world_command.sql new file mode 100644 index 0000000..fdb0e55 --- /dev/null +++ b/sql/updates/3.0.9_old/1296_mangos_7252_01_world_command.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7251_01_mangos_spell_chain required_7252_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('debug arena','debug bg'); +INSERT INTO `command` VALUES +('debug arena',3,'Syntax: .debug arena\r\n\r\nToggle debug mode for arenas. In debug mode GM can start arena with single player.'), +('debug bg',3,'Syntax: .debug bg\r\n\r\nToggle debug mode for battlegrounds. In debug mode GM can start battleground with single player.'); diff --git a/sql/updates/3.0.9_old/1296_mangos_7252_02_world_trinity_string.sql b/sql/updates/3.0.9_old/1296_mangos_7252_02_world_trinity_string.sql new file mode 100644 index 0000000..03e2b40 --- /dev/null +++ b/sql/updates/3.0.9_old/1296_mangos_7252_02_world_trinity_string.sql @@ -0,0 +1,14 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7252_01_mangos_command required_7252_02_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE entry IN (737,738,739,740,741,742,743,744,745,746); +INSERT INTO `trinity_string` VALUES +(737,'Arenas are set to 1v1 for debugging. So, don\'t join as group.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(738,'Arenas are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(739,'Battlegrounds are set to 1v0 for debugging.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(740,'Battlegrounds are set to normal playercount.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(741,'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(742,'Distributing arena points to players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(743,'Finished setting arena points for online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(744,'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(745,'Modification done.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(746,'Done flushing Arena points.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1299_mangos_7255_01_characters_characters.sql b/sql/updates/3.0.9_old/1299_mangos_7255_01_characters_characters.sql new file mode 100644 index 0000000..85ae09a --- /dev/null +++ b/sql/updates/3.0.9_old/1299_mangos_7255_01_characters_characters.sql @@ -0,0 +1,10 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7251_02_characters_character_spell required_7255_01_characters_characters bit;*/ + +ALTER TABLE `characters` + ADD COLUMN `bgid` int(10) unsigned NOT NULL default '0' AFTER `latency`, + ADD COLUMN `bgteam` int(10) unsigned NOT NULL default '0' AFTER `bgid`, + ADD COLUMN `bgmap` int(10) unsigned NOT NULL default '0' AFTER `bgteam`, + ADD COLUMN `bgx` float NOT NULL default '0' AFTER `bgmap`, + ADD COLUMN `bgy` float NOT NULL default '0' AFTER `bgx`, + ADD COLUMN `bgz` float NOT NULL default '0' AFTER `bgy`, + ADD COLUMN `bgo` float NOT NULL default '0' AFTER `bgz`; diff --git a/sql/updates/3.0.9_old/1307_world.sql b/sql/updates/3.0.9_old/1307_world.sql new file mode 100644 index 0000000..d4f245a --- /dev/null +++ b/sql/updates/3.0.9_old/1307_world.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_stormwind_harbor_taxi' WHERE `entry`=29154; diff --git a/sql/updates/3.0.9_old/1312_world.sql b/sql/updates/3.0.9_old/1312_world.sql new file mode 100644 index 0000000..7c98560 --- /dev/null +++ b/sql/updates/3.0.9_old/1312_world.sql @@ -0,0 +1,16 @@ +UPDATE `creature_template` SET `scriptname` = 'boss_keleseth' WHERE `entry` = '23953'; +UPDATE `creature_template` SET `scriptname` = 'mob_frost_tomb' WHERE `entry` = '23965'; +UPDATE `instance_template` SET `script`='instance_utgarde_keep' WHERE `map`= '574'; + +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1574000, 'Your blood is mine!',13221,1,0,'keleseth SAY_AGGRO'), +(-1574001, 'Darkness waits',13223,1,0, 'keleseth SAY_KILL'), +(-1574002, 'I join... the night.',13225,1,0, 'keleseth SAY_DEATH'), +(-1574003, 'Not so fast.',13222,1,0, 'keleseth SAY_FROST_TOMB'), +(-1574004, 'Aranal, lidel! Their fate shall be yours!',13224,1,0, 'keleseth SAY_SKELETONS'); + +-- DB Data for testing +-- REPLACE INTO `creature_template` (`entry`, `heroic_entry`, `modelid_A`, `modelid_A2`, `modelid_H`, `modelid_H2`, `name`, `subname`, `IconName`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `baseattacktime`, `rangeattacktime`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `class`, `race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `PetSpellDataId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `RacialLeader`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES +-- (23953, 0, 25338, 0, 25338, 0, 'Prince Keleseth', NULL, NULL, 70, 80, 192200, 417056, 0, 0, 6700, 16, 16, 2, 1, 1, 0, 445, 1200, 0, 58, 2000, 2200, 0, 0, 0, 0, 0, 0, 0, 1, 2, 100, 6, 76, 23953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 3, 3, 0, 0, 0, 0, 'boss_keleseth'), +-- (23965, 0, 25865, 0, 25865, 0, 'Frost Tomb', NULL, NULL, 70, 80, 7345, 10465, 0, 0, 6700, 16, 16, 0, 1, 1, 0, 445, 1200, 0, 58, 2000, 2200, 0, 0, 0, 0, 0, 0, 0, 1, 2, 100, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 3, 3, 0, 0, 0, 0, 'mob_frost_tomb'), +-- (23970, 0, 27651, 0, 27651, 0, 'Vrykul Skeleton', NULL, NULL, 70, 80, 7345, 10465, 0, 0, 6700, 16, 16, 0, 1, 1, 0, 445, 1200, 0, 58, 2000, 2200, 0, 0, 0, 0, 0, 0, 0, 1, 2, 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 3, 3, 0, 716, 0, 0, '0'); diff --git a/sql/updates/3.0.9_old/1327_world.sql b/sql/updates/3.0.9_old/1327_world.sql new file mode 100644 index 0000000..61ae8de --- /dev/null +++ b/sql/updates/3.0.9_old/1327_world.sql @@ -0,0 +1,4 @@ +ALTER TABLE `creature_template` ADD COLUMN `spell5` mediumint(8) unsigned NOT NULL default '0' AFTER `spell4`; +ALTER TABLE `creature_template` ADD COLUMN `spell6` mediumint(8) unsigned NOT NULL default '0' AFTER `spell5`; +ALTER TABLE `creature_template` ADD COLUMN `spell7` mediumint(8) unsigned NOT NULL default '0' AFTER `spell6`; +ALTER TABLE `creature_template` ADD COLUMN `spell8` mediumint(8) unsigned NOT NULL default '0' AFTER `spell7`; diff --git a/sql/updates/3.0.9_old/1350_world_scripts.sql b/sql/updates/3.0.9_old/1350_world_scripts.sql new file mode 100644 index 0000000..ab8abe5 --- /dev/null +++ b/sql/updates/3.0.9_old/1350_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `mindmg`=700, `maxdmg`=1200, `attackpower`=1000, `flags_extra`=196641 WHERE `entry`=23418; diff --git a/sql/updates/3.0.9_old/1351_world.sql b/sql/updates/3.0.9_old/1351_world.sql new file mode 100644 index 0000000..9f9c569 --- /dev/null +++ b/sql/updates/3.0.9_old/1351_world.sql @@ -0,0 +1,784 @@ +DROP TABLE IF EXISTS `trinity_string`; +CREATE TABLE IF NOT EXISTS `trinity_string` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `mangos_string` +-- + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(1, 'You should select a character or a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2, 'You should select a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(3, '|cffff0000[System Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(4, '|cffff0000[Event Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5, 'There is no help for that command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6, 'There is no such command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7, 'There is no such subcommand', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(8, 'Command %s have subcommands:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(9, 'Commands available to you:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10, 'Incorrect syntax.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(11, 'Your account level is: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12, 'Online players: %u (max: %u) Queued players: %u (max: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(13, 'Server uptime: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(14, 'Player saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(15, 'All players saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(16, 'There are the following active GMs on this server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(17, 'There are no GMs currently logged in on this server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(18, 'Cannot do that while flying.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(19, 'Cannot do that in Battlegrounds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(20, 'Target is flying you can''t do that.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(21, '%s is flying command failed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(22, 'You are not mounted so you can''t dismount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(23, 'Cannot do that while fighting.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(24, 'You used it recently.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(25, 'Password not changed (unknown error)!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(26, 'The password was changed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(27, 'The new passwords do not match or the old password is wrong', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(28, 'Your account is now locked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(29, 'Your account is now unlocked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(30, ', rank ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(31, ' [known]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(32, ' [learn]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(33, ' [passive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(34, ' [talent]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(35, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(36, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(37, ' (offline)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(38, 'on', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(39, 'off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(40, 'You are: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(41, 'visible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(42, 'invisible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(43, 'done', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(44, 'You', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(45, ' ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(46, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(47, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(48, 'UNKNOWN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(49, 'You must be at least level %u to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(50, 'You must be at least level %u and have item %s to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(51, 'Hello! Ready for some training?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(52, 'Invaid item count (%u) for item %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(53, 'Mail can''t have more %u item stacks', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(54, 'The new passwords do not match', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(55, 'Your password can''t be longer than 16 characters (client limit), password not changed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(56, 'Current Message of the day: \r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(57, 'Using World DB: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(58, 'Using script library: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(100, 'Global notify: ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(101, 'Map: %u (%s) Zone: %u (%s) Area: %u (%s)\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(102, '%s is already being teleported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(103, 'You can summon a player to your instance only if he is in your party with you as leader.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(104, 'You cannot go to the player''s instance because you are in a party now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(105, 'You can go to the player''s instance while not being in his party only if your GM mode is on.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(106, 'You can not go to player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(107, 'You can not summon player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(108, 'You are summoning %s%s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(109, 'You are being summoned by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(110, 'You are teleporting %s%s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(111, 'You are being teleported by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(112, 'Player (%s) does not exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(113, 'Appearing at %s''s location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(114, '%s is appearing to your location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(115, 'Incorrect values.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(116, 'No character selected.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(117, '%s is not in a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(118, 'You changed HP of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(119, '%s changed your HP to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(120, 'You changed MANA of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(121, '%s changed your MANA to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(122, 'You changed ENERGY of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(123, '%s changed your ENERGY to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(124, 'Current energy: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(125, 'You changed rage of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(126, '%s changed your rage to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(127, 'You changed level of %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(128, 'GUID %i, faction is %i, flags is %i, npcflag is %i, DY flag is %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(129, 'Wrong faction: %u (not found in factiontemplate.dbc).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(130, 'You changed GUID=%i ''s Faction to %i, flags to %i, npcflag to %i, dyflag to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(131, 'You changed the spellflatid=%i, val= %i, mark =%i to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(132, '%s changed your spellflatid=%i, val= %i, mark =%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(133, '%s has access to all taxi nodes now (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(134, '%s has no more access to all taxi nodes now (only visited accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(135, '%s has given you access to all taxi nodes (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(136, '%s has removed access to all taxi nodes (only visited still accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(137, 'You set all speeds to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(138, '%s set all your speeds to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(139, 'You set the speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(140, '%s set your speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(141, 'You set the swim speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(142, '%s set your swim speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(143, 'You set the backwards run speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(144, '%s set your backwards run speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(145, 'You set the fly speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(146, '%s set your fly speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(147, 'You set the size %2.2f of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(148, '%s set your size to %2.2f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(149, 'There is no such mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(150, 'You give a mount to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(151, '%s gave you a mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(152, 'USER1: %i, ADD: %i, DIF: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(153, 'You take all copper of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(154, '%s took you all of your copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(155, 'You take %i copper from %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(156, '%s took %i copper from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(157, 'You give %i copper to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(158, '%s gave you %i copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(159, 'You hear sound %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(160, 'USER2: %i, ADD: %i, RESULT: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(161, 'Removed bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(162, 'Set bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(163, 'Teleport location table is empty!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(164, 'Teleport location not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(165, 'Requires search parameter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(166, 'There are no teleport locations matching your request.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(168, 'Locations found are:\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(169, 'Mail sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(170, 'You try to hear sound %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(172, 'server console command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(173, 'You changed runic power of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(174, '%s changed your runic power to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(200, 'No selection.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(201, 'Object GUID is: lowpart %u highpart %X', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(202, 'The name was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(203, 'Error, name can only contain characters A-Z and a-z.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(204, 'The subname was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(205, 'Not yet implemented', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(206, 'Item ''%i'' ''%s'' added to list with maxcount ''%i'' and incrtime ''%i'' and extendedcost ''%i''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(207, 'Item ''%i'' not found in database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(208, 'Item ''%i'' ''%s'' deleted from vendor list', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(209, 'Item ''%i'' not found in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(210, 'Item ''%i'' already in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(211, 'Spells of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(212, 'Spells of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(213, 'Talents of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(214, 'Talents of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(215, 'Your spells have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(216, 'Your talents have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(217, 'Unknown case ''%s'' for .resetall command. Type full correct case name.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(218, 'Spells will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(219, 'Talents will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(220, 'Creature (GUID: %u) No waypoint found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(221, 'Creature (GUID: %u) Last waypoint not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(222, 'Creature (GUID: %u) No waypoint found - used ''wpguid''. Now trying to find it by its position...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(223, 'Creature (GUID: %u) No waypoints found - This is a MaNGOS db problem (single float).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(224, 'Selected creature is ignored - provided GUID is used', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(225, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(226, 'You must select a visual waypoint.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(227, 'No visual waypoints found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(228, 'Could not create visual waypoint with creatureID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(229, 'All visual waypoints removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(230, 'Could not create waypoint-creature with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(231, 'No GUID provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(232, 'No waypoint number provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(233, 'Argument required for ''%s''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(234, 'Waypoint %i added to GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(235, 'Waypoint %d added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(236, 'Waypoint changed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(237, 'Waypoint %s modified.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(238, 'WP export successfull.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(239, 'No waypoints found inside the database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(240, 'File imported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(241, 'Waypoint removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(242, 'Warning: Could not delete WP from the world with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(243, 'This happens if the waypoint is too far away from your char.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(244, 'The WP is deleted from the database, but not from the world here.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(245, 'They will disappear after a server restart.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(246, 'Waypoint %d: Info for creature: %s, GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(247, 'Waittime: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(248, 'Model %d: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(249, 'Emote: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(250, 'Spell: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(251, 'Text%d (ID: %i): %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(252, 'AIScript: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(253, 'Forced rename for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(254, 'Forced rename for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(255, 'Waypoint-Creature (GUID: %u) Not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(256, 'Could not find NPC...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(257, 'Creature movement type set to ''%s'', waypoints removed (if any).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(258, 'Creature movement type set to ''%s'', waypoints were not removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(259, 'Incorrect value, use on or off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(260, 'Value saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(261, 'Value saved, you may need to rejoin or clean your client cache.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(262, 'Areatrigger ID %u not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(263, 'Target map or coordinates is invalid (X: %f Y: %f MapId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(264, 'Zone coordinates is invalid (X: %f Y: %f AreaId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(265, 'Zone %u (%s) is part of instanceable map %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(266, 'Nothing found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(267, 'Object not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(268, 'Creature not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(269, 'Warning: Mob found more than once - you will be teleported to the first one found in DB.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(270, 'Creature Removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(271, 'Creature moved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(272, 'Creature (GUID:%u) must be on the same map as player!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(273, 'Game Object (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(274, 'Game Object (GUID: %u) has references in not found creature %u GO list, can''t be deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(275, 'Game Object (GUID: %u) removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(276, 'Game Object (GUID: %u) turned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(277, 'Game Object (GUID: %u) moved', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(278, 'You must select a vendor', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(279, 'You must send id for item', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(280, 'Vendor has too many items (max 128)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(281, 'You can''t kick self, logout instead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(282, 'Player %s kicked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(283, 'Player %s not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(284, 'Accepting Whisper: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(285, 'Accepting Whisper: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(286, 'Accepting Whisper: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(287, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(288, 'Tickets count: %i show new tickets: %s\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(289, 'New ticket from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(290, 'Ticket of %s (Last updated: %s):\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(291, 'New ticket show: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(292, 'New ticket show: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(293, 'Ticket %i doesn''t exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(294, 'All tickets deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(295, 'Character %s ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(296, 'Ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(297, 'Spawn distance changed to: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(298, 'Spawn time changed to: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(299, 'The honor of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(300, 'Your chat has been disabled for %u minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(301, 'You have disabled %s''s chat for %u minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(302, 'Player''s chat is already enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(303, 'Your chat has been enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(304, 'You have enabled %s''s chat.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(305, 'Faction %s (%u) reputation of %s was set to %5d!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(306, 'The arena points of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(307, 'No faction found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(308, 'Faction %i unknown!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(309, 'Invalid parameter %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(310, 'delta must be between 0 and %d (inclusive)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(311, '%d - |cffffffff|Hfaction:%d|h[%s]|h|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(312, ' [visible]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(313, ' [at war]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(314, ' [peace forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(315, ' [hidden]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(316, ' [invisible forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(317, ' [inactive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(318, 'Hated', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(319, 'Hostile', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(320, 'Unfriendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(321, 'Neutral', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(322, 'Friendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(323, 'Honored', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(324, 'Revered', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(325, 'Exalted', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(326, 'Faction %s (%u) can''not have reputation.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(327, ' [no reputation]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(328, 'Characters at account %s (Id: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(329, ' %s (GUID %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(330, 'No players found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(331, 'Extended item cost %u not exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(332, 'GM mode is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(333, 'GM mode is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(334, 'GM Chat Badge is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(335, 'GM Chat Badge is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(336, 'You repair all %s''s items.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(337, 'All your items repaired by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(338, 'You set waterwalk mode %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(339, 'Your waterwalk mode %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(340, '%s is now following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(341, '%s is not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(342, '%s is now not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(343, 'Creature (Entry: %u) cannot be tamed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(344, 'You already have pet.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(345, 'Forced customize for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(346, 'Forced customize for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(400, '|cffff0000[System Message]:|rScripts reloaded', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(401, 'You change security level of account %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(402, '%s changed your security level to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(403, 'You have low security level for this.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(404, 'Creature movement disabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(405, 'Creature movement enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(406, 'Weather can''t be changed for this zone.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(407, 'Weather system disabled at server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(408, '%s is banned for %s. Reason: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(409, '%s is banned permanently for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(410, '%s %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(411, '%s unbanned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(412, 'There was an error removing the ban on %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(413, 'Account not exist: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(414, 'There is no such character.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(415, 'There is no such IP in banlist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(416, 'Account %s has never been banned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(417, 'Ban history for account %s:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(418, 'Ban Date: %s Bantime: %s Still active: %s Reason: %s Set by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(419, 'Inf.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(420, 'Never', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(421, 'Yes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(422, 'No', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(423, 'IP: %s\nBan Date: %s\nUnban Date: %s\nRemaining: %s\nReason: %s\nSet by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(424, 'There is no matching IPban.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(425, 'There is no matching account.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(426, 'There is no banned account owning a character matching this part.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(427, 'The following IPs match your pattern:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(428, 'The following accounts match your query:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(429, 'You learned many spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(430, 'You learned all spells for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(431, 'You learned all talents for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(432, 'You learned all languages.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(433, 'You learned all craft skills and recipes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(434, 'Could not find ''%s''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(435, 'Invalid item id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(436, 'No items found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(437, 'Invalid gameobject id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(438, 'Found items %u: %u ( inventory %u mail %u auction %u guild %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(439, 'Found gameobjects %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(440, 'Invalid creature id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(441, 'Found creatures %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(442, 'No area found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(443, 'No item sets found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(444, 'No skills found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(445, 'No spells found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(446, 'No quests found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(447, 'No creatures found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(448, 'No gameobjects found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(449, 'Graveyard #%u doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(450, 'Graveyard #%u already linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(451, 'Graveyard #%u linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(452, 'Graveyard #%u can''t be linked to subzone or not existed zone #%u (internal error).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(454, 'No faction in Graveyard with id= #%u , fix your DB', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(455, 'invalid team, please fix database', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(456, 'any', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(457, 'alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(458, 'horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(459, 'Graveyard #%u (faction: %s) is nearest from linked to zone #%u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(460, 'Zone #%u doesn''t have linked graveyards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(461, 'Zone #%u doesn''t have linked graveyards for faction: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(462, 'Teleport location already exists!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(463, 'Teleport location added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(464, 'Teleport location NOT added: database error.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(465, 'Teleport location deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(467, 'Target unit has %d auras:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(468, 'id: %d eff: %d type: %d duration: %d maxduration: %d name: %s%s%s caster: %s %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(469, 'Target unit has %d auras of type %d:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(470, 'id: %d eff: %d name: %s%s%s caster: %s %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(471, 'Quest %u not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(472, 'Quest %u started from item. For correct work, please, add item to inventory and start quest in normal way: .additem %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(473, 'Quest removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(474, ' [rewarded]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(475, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(476, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(477, '%s''s Fly Mode %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(478, 'Opcode %u sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(479, 'Character loaded successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(480, 'Failed to load the character!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(481, 'Character dumped successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(482, 'Character dump failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(483, 'Spell %u broken and not allowed to cast or learn!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(484, 'Skill %u (%s) for player %s set to %u and current maximum set to %u (without permanent (talent) bonuses).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(485, 'Player %s must have skill %u (%s) before using this command.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(486, 'Invalid skill id (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(487, 'You learned default GM spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(488, 'You already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(489, 'Target(%s) already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(490, '%s doesn''t know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(491, 'You already forgot that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(492, 'All spell cooldowns removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(493, 'Spell %u cooldown removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(494, 'Command : Additem, itemId = %i, amount = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(495, 'Command : Additemset, itemsetId = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(496, 'Removed itemID = %i, amount = %i from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(497, 'Cannot create item ''%i'' (amount: %i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(498, 'You need to provide a guild name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(499, 'Player not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(500, 'Player already has a guild!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(501, 'Guild not created! (already exists?)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(502, 'No items from itemset ''%u'' found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(503, 'The distance is: (3D) %f (2D) %f yards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(504, 'Item ''%i'' ''%s'' Item Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(505, 'Item ''%i'' doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(506, 'Item ''%i'' ''%s'' Added to Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(507, 'Item save failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(508, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(509, '%d - sender: %s (guid: %u account: %u ) receiver: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(510, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(511, 'Wrong link type!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(512, '%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(513, '%d - |cffffffff|Hquest:%d|h[%s]|h|r %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(514, '%d - |cffffffff|Hcreature_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(515, '%d - |cffffffff|Hcreature:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(516, '%d - |cffffffff|Hgameobject_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(517, '%d - |cffffffff|Hgameobject:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(518, '%d - |cffffffff|Hitemset:%d|h[%s %s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(519, '|cffffffff|Htele:%s|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(520, '%d - |cffffffff|Hspell:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(521, '%d - |cffffffff|Hskill:%d|h[%s %s]|h|r %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(522, 'Game Object (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(523, '>> Game Object %s (GUID: %u) at %f %f %f. Orientation %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(524, 'Selected object:\n|cffffffff|Hitemset:%d|h[%s]|h|r\nGUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(525, '>> Add Game Object ''%i'' (%s) (GUID: %i) added at ''%f %f %f''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(526, '%s (lowguid: %u) movement generators stack:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(527, ' Idle', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(528, ' Random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(529, ' Waypoint', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(530, ' Animal random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(531, ' Confused', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(532, ' Targeted to player %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(533, ' Targeted to creature %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(534, ' Targeted to ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(535, ' Home movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(536, ' Home movement used for player?!?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(537, ' Taxi flight', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(538, ' Unknown movement generator (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(539, 'Player selected NPC\nGUID: %u.\nFaction: %u.\nnpcFlags: %u.\nEntry: %u.\nDisplayID: %u (Native: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(540, 'Level: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(541, 'Health (base): %u. (max): %u. (current): %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(542, 'Field Flags: %u.\nDynamic Flags: %u.\nFaction Template: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(543, 'Loot: %u Pickpocket: %u Skinning: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(544, 'Position: %f %f %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(545, '*** Is a vendor!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(546, '*** Is a trainer!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(547, 'InstanceID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(548, 'Player%s %s (guid: %u) Account: %s (id: %u) GMLevel: %u Last IP: %s Last login: %s Latency: %ums', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(549, 'Played time: %s Level: %u Money: %ug%us%uc', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(550, 'Command .pinfo doesn''t support ''rep'' option for offline players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(551, '%s has explored all zones now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(552, '%s has no more explored zones.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(553, '%s has explored all zones for you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(554, '%s has hidden all zones from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(555, 'Hover enabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(556, 'Hover disabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(557, 'You have been leveled up (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(558, 'You have been leveled down (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(559, 'Your level progress has been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(560, 'The area has been set as explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(561, 'The area has been set as not explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(562, 'GUID=%i ''s updateIndex: %i, value: %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(563, 'You change GUID=%i ''s UpdateIndex: %i value to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(564, 'The value index %u is too big to %u(count: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(565, 'Set %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(566, 'You Set %u Field:%u to uint32 Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(567, 'Set %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(568, 'You Set %u Field:%i to float Value: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(569, 'Get %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(570, 'The uint32 value of %u in %u is: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(571, 'Get %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(572, 'The float of %u value in %u is: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(573, '.Set32Bit:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(574, 'You set Bit of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(575, '.Mod32Value:[OPCODE]:%u [VALUE]:%i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(576, 'You modified the value of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(577, 'You are now invisible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(578, 'You are now visible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(579, 'Selected player or creature not have victim.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(580, 'Player %s learned all default spells for race/class and completed quests rewarded spells.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(581, 'Found near gameobjects (distance %f): %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(582, 'SpawnTime: Full:%s Remain:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(583, '%d - |cffffffff|Hgameevent:%d|h[%s]|h|r%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(584, 'No event found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(585, 'Event not exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(586, 'Event %u: %s%s\nStart: %s End: %s Occurence: %s Length: %s\nNext state change: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(587, 'Event %u already active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(588, 'Event %u not active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(589, ' Point movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(590, ' Fear movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(591, ' Distract movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(592, 'You have learned all spells in craft: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(593, 'Currently Banned Accounts:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(594, '| Account | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(595, 'Currently Banned IPs:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(596, '| IP | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(597, 'Current gamemasters:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(598, '| Account | GM |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(599, 'No gamemasters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(600, 'The Alliance wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(601, 'The Horde wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(602, 'The battle for Warsong Gulch begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(603, 'The battle for Warsong Gulch begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(604, 'Let the battle for Warsong Gulch begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(605, '$n captured the Horde flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(606, '$n captured the Alliance flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(607, 'The Horde flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(608, 'The Alliance Flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(609, 'The Alliance Flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(610, 'The Horde flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(611, 'The Horde flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(612, 'The Alliance Flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(613, 'The flags are now placed at their bases.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(614, 'The Alliance flag has been respawned!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(615, 'The Horde flag has been respawned!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(636, 'The Battle for Eye of the Storm begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(637, 'The Battle for Eye of the Storm begins in 30 seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(638, 'The Battle for Eye of the Storm has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(650, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(651, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(652, 'stables', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(653, 'blacksmith', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(654, 'farm', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(655, 'lumber mill', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(656, 'mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(657, 'The %s has taken the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(658, '$n has defended the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(659, '$n has assaulted the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(660, '$n claims the %s! If left unchallenged, the %s will control it in 1 minute!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(661, 'The Battle for Arathi Basin begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(662, 'The Battle for Arathi Basin begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(663, 'The Battle for Arathi Basin has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(664, 'The Alliance has gathered $1776W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(665, 'The Horde has gathered $1777W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(666, 'After your recent battle in %s our best attempts to award you a Mark of Honor failed. Enclosed you will find the Mark of Honor we were not able to deliver to you at the time. Thanks for fighting in %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(667, 'The Alliance has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(668, 'The Horde has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(669, 'The Alliance has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(670, 'The Horde has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(671, 'The Alliance has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(672, 'The Horde has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(673, 'The Alliance has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(674, 'The Horde has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(675, 'The Alliance has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(676, 'The Horde has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(677, 'The Alliance has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(678, 'The Horde has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(679, 'The Alliance has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(680, 'The Horde has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(681, 'The Alliance has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(682, 'The Horde has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(683, '$N has taken the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(684, 'The Alliance has captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(685, 'The Horde has captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(686, 'The Flag has been dropped!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(687, 'The flag has been reset', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(700, 'You must be level %u to form an arena team', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(701, 'One minute until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(702, 'Thirty seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(703, 'Fifteen seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(704, 'The Arena battle has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(705, 'You must wait %s before speaking again.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(706, 'This item(s) have problems with equipping/storing in inventory.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(707, '%s wishes to not be disturbed and cannot receive whisper messages: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(708, '%s is Away from Keyboard: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(709, 'Do not Disturb', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(710, 'Away from Keyboard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(711, 'Queue status for %s (Lvl: %u to %u)\nQueued alliances: %u (Need at least %u more)\nQueued hordes: %u (Need at least %u more)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(712, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] A: %u/%u, H: %u/%u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(713, 'You must be level %u to join an arena team!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(715, 'You don''t meet Battleground level requirements', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(717, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] Started!|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(718, '|cffff0000[Arena Queue Announcer]:|r %s -- Joined : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(719, '|cffff0000[Arena Queue Announcer]:|r %s -- Exited : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(720, 'Your group is too large for this battleground. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(721, 'Your group is too large for this arena. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(722, 'Your group has members not in your arena team. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(723, 'Your group does not have enough players to join this match.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(724, 'The Gold Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(725, 'The Green Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(726, 'There aren''t enough players in this battleground. It will end soon unless some more players join to balance the fight.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(727, 'Your group has an offline member. Please remove him before joining.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(728, 'Your group has players from the opposing faction. You can''t join the battleground as a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(729, 'Your group has players from different battleground brakets. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(730, 'Someone in your party is already in this battleground queue. (S)he must leave it before joining as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(731, 'Someone in your party is Deserter. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(732, 'Someone in your party is already in three battleground queues. You cannot join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(733, 'You cannot teleport to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(734, 'You cannot summon players to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(735, 'You must be in GM mode to teleport to a player in a battleground.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(736, 'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(737, 'Arenas are set to 1v1 for debugging. So, don''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(738, 'Arenas are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(739, 'Battlegrounds are set to 1v0 for debugging.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(740, 'Battlegrounds are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(741, 'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(742, 'Distributing arena points to players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(743, 'Finished setting arena points for online players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(744, 'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(745, 'Modification done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(746, 'Done flushing Arena points.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(785, 'Arena testing turned %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(786, '|cffff0000[Automatic]:|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(787, '|cffffff00[|c1f40af20Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(800, 'Invalid name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(801, 'You do not have enough gold', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(802, 'You do not have enough free slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(803, 'Your partner does not have enough free bag slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(804, 'You do not have permission to perform that function', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(805, 'Unknown language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(806, 'You don''t know that language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(807, 'Please provide character name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(808, 'Player %s not found or offline', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(809, 'Account for character %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1000, 'Exiting daemon...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1001, 'Account deleted: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1002, 'Account %s NOT deleted (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1003, 'Account %s NOT deleted (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1004, 'Account created: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1005, 'Account name can''t be longer than 16 characters (client limit), account not created!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1006, 'Account with this name already exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1007, 'Account %s NOT created (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1008, 'Account %s NOT created (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1009, 'Player %s (Guid: %u) Account %s (Id: %u) deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1010, '| Account | Character | IP | GM | TBC |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1011, '| | %20s | |||', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1100, 'Account %s (Id: %u) have up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1101, 'Message of the day changed to:\r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1102, 'Message sent to %s: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1103, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1104, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1105, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1106, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1107, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1108, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1109, '%d - %s %s %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1110, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1111, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1112, 'Failed to open file: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1113, 'Account %s (%u) have max amount allowed characters (client limit)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1114, 'Dump file have broken data!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1115, 'Invalid character name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1116, 'Invalid character guid!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1117, 'Character guid %u in use!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1118, '%d - guild: %s (guid: %u) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1119, 'You must use male or female as gender.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1120, 'You change gender of %s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1121, 'Your gender changed to %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1122, '(%u/%u +perm %u +temp %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + +(1200,'Alliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1201,'Horde',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1202,'%s was destroyed by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1203,'The %s is under attack! If left unchecked, the %s will destroy it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1204,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1205,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1206,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1207,'The %s is under attack! If left unchecked, the %s will capture it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1208,'The %s has taken the %s! Its supplies will now be used for reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1209,'Irondeep Mine',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1210,'Coldtooth Mine',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1211,'Stormpike Aid Station',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1212,'Dun Baldar South Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1213,'Dun Baldar North Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1214,'Stormpike Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1215,'Icewing Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1216,'Stonehearth Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1217,'Stonehearth Bunker',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1218,'Snowfall Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1219,'Iceblood Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1220,'Iceblood Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1221,'Tower Point',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1222,'Frostwolf Graveyard',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1223,'East Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1224,'West Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1225,'Frostwolf Relief Hut',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1226,'The Battle for Alterac Valley begins in 1 minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1227,'The Battle for Alterac Valley begins in 30 seconds. Prepare yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1228,'The Battle for Alterac Valley has begun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1229,'The Alliance Team is running out of reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1230,'The Horde Team is running out of reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1231,'The Frostwolf General is Dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1232,'The Stormpike General is Dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(2000, '|cff00ff00New ticket from|r|cffff00ff %s.|r |cff00ff00Ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2001, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00edited his/her ticket:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2002, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00abandoned ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2003, '|cff00ff00Closed by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2004, '|cff00ff00Deleted by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2005, 'Ticket not found.', '', '', '', '', '', '', '', ''), +(2006, 'Please close ticket before deleting it permanently.', '', '', '', '', '', '', '', ''), +(2007, 'Ticket %d is already assigned.', '', '', '', '', '', '', '', ''), +(2008, '%u Tickets succesfully reloaded from the database.', '', '', '', '', '', '', '', ''), +(2009, 'Showing list of open tickets.', '', '', '', '', '', '', '', ''), +(2010, 'Showing list of open tickets whose creator is online.', '', '', '', '', '', '', '', ''), +(2011, 'Showing list of closed tickets.', '', '', '', '', '', '', '', ''), +(2012, 'Invalid name specified. Name should be that of an online Gamemaster.', '', '', '', '', '', '', '', ''), +(2013, 'This ticket is already assigned to yourself. To unassign use .ticket unassign %d and then reassign.', '', '', '', '', '', '', '', ''), +(2014, 'Ticket %d is not assigned, you cannot unassign it.', '', '', '', '', '', '', '', ''), +(2015, 'You cannot unassign tickets from staffmembers with a higher security level than yourself.', '', '', '', '', '', '', '', ''), +(2016, 'Cannot close ticket %d, it is assigned to another GM.', '', '', '', '', '', '', '', ''), +(2017, '|cff00ff00Ticket|r:|cff00ccff %d.|r ', '', '', '', '', '', '', '', ''), +(2018, '|cff00ff00Created by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2019, '|cff00ff00Last change|r:|cff00ccff %s ago|r ', '', '', '', '', '', '', '', ''), +(2020, '|cff00ff00Assigned to|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2021, '|cff00ff00Unassigned by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2022, '\n|cff00ff00Message|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), +(2023, '\n|cff00ff00Comment|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), +(2024, '\n|cff00ccff%s|r |cff00ff00Added comment|r: \"%s\"|r ', '', '', '', '', '', '', '', ''), + +(5000, 'You froze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5001, 'It might be amusing but no... you cant freeze yourself!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5002, 'Invalid input check the name of target.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5003, 'You unfroze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5004, 'There are no frozen players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5005, 'Following players are frozen on the server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5006, '- %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5009, 'Sound %u Played to server', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + +(6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + +(10001, 'The Horde has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10002, 'The Alliance has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10003, 'The Horde has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10004, 'The Alliance has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10005, 'The Horde has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10006, 'The Alliance has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10007, 'The Horde lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10008, 'The Alliance lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10009, 'The Horde lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10010, 'The Alliance lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10011, 'The Horde lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10012, 'The Alliance lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10013, 'The Horde has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10014, 'The Alliance has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10015, 'The Horde has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10016, 'The Alliance has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10017, 'The Horde has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10018, 'The Alliance has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10019, 'The Horde lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10020, 'The Alliance lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10021, 'The Horde lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10022, 'The Alliance lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10023, 'The Horde lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10024, 'The Alliance lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10025, 'The Horde has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10026, 'The Alliance has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10027, 'The Horde lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10028, 'The Alliance lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10029, 'The Horde has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10030, 'The Alliance has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10031, 'The Horde lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10032, 'The Alliance lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10033, 'The Horde has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10034, 'The Alliance has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10035, 'The Horde has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10036, 'The Alliance has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10037, 'The Horde has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10038, 'The Alliance has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10039, 'The Horde has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10040, 'The Alliance has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10041, 'The Horde lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10042, 'The Alliance lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10043, 'The Horde lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10044, 'The Alliance lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10045, 'The Horde lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10046, 'The Alliance lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10047, 'The Horde lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10048, 'The Alliance lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10049, 'The Horde has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10050, 'The Alliance has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10051, 'Take me to Northpass Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10052, 'Take me to Eastwall Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10053, 'Take me to Crown Guard Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10054, 'Give me the flag, I''ll take it to the central beacon for the glory of the Alliance!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10055, 'Give me the flag, I''ll take it to the central beacon for the glory of the Horde!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10056, 'You must be a member of the Horde to enter the Hall of Legends.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10057, 'You must be a member of the Alliance to enter the Champion''s Hall.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.0.9_old/1396_mangos_7267_01_characters_auctionhouse.sql b/sql/updates/3.0.9_old/1396_mangos_7267_01_characters_auctionhouse.sql new file mode 100644 index 0000000..939c053 --- /dev/null +++ b/sql/updates/3.0.9_old/1396_mangos_7267_01_characters_auctionhouse.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7255_01_characters_characters required_7267_01_characters_auctionhouse bit;*/ + +ALTER TABLE auctionhouse + DROP COLUMN location; diff --git a/sql/updates/3.0.9_old/1414_world_scripts.sql b/sql/updates/3.0.9_old/1414_world_scripts.sql new file mode 100644 index 0000000..e78f03f --- /dev/null +++ b/sql/updates/3.0.9_old/1414_world_scripts.sql @@ -0,0 +1,121 @@ +-- r847_scriptdev2_script_texts.sql +UPDATE `script_texts` SET emote=15 WHERE `entry`=-1000123; +UPDATE `script_texts` SET emote=1 WHERE `entry`=-1560028; +UPDATE `script_texts` SET emote=1 WHERE `entry`=-1560031; +UPDATE `script_texts` SET emote=5 WHERE `entry`=-1560032; +UPDATE `script_texts` SET emote=16 WHERE `entry`=-1000119; +UPDATE `script_texts` SET emote=254 WHERE `entry`=-1249002; +UPDATE `script_texts` SET emote=293 WHERE `entry`=-1249003; +UPDATE `script_texts` SET emote=1 WHERE `entry`=-1033000; + +-- r848_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1540047 AND -1540042; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1540042,'Ours is the true Horde! The only Horde!',10323,1,0,0,'kargath SAY_AGGRO1'), +(-1540043,'I\'ll carve the meat from your bones!',10324,1,0,0,'kargath SAY_AGGRO2'), +(-1540044,'I am called Bladefist for a reason, as you will see!',10325,1,0,0,'kargath SAY_AGGRO3'), +(-1540045,'For the real Horde!',10326,1,0,0,'kargath SAY_SLAY1'), +(-1540046,'I am the only Warchief!',10327,1,0,0,'kargath SAY_SLAY2'), +(-1540047,'The true Horde... will.. prevail...',10328,1,0,0,'kargath SAY_DEATH'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533118 AND -1533109; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1533109,'You are mine now!',8825,1,0,0,'heigan SAY_AGGRO1'), +(-1533110,'I see you!',8826,1,0,0,'heigan SAY_AGGRO2'), +(-1533111,'You...are next!',8827,1,0,0,'heigan SAY_AGGRO3'), +(-1533112,'Close your eyes... sleep!',8829,1,0,0,'heigan SAY_SLAY'), +(-1533113,'The races of the world will perish. It is only a matter of time.',8830,1,0,0,'heigan SAY_TAUNT1'), +(-1533114,'I see endless suffering, I see torment, I see rage. I see... everything!',8831,1,0,0,'heigan SAY_TAUNT2'), +(-1533115,'Soon... the world will tremble!',8832,1,0,0,'heigan SAY_TAUNT3'), +(-1533116,'The end is upon you.',8833,1,0,0,'heigan SAY_TAUNT4'), +(-1533117,'Hungry worms will feast on your rotten flesh!',8834,1,0,0,'heigan SAY_TAUNT5'), +(-1533118,'Noo... o...',8828,1,0,0,'heigan SAY_DEATH'); + +-- r849_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry`=-1070000; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1070000,'None may steal the secrets of the makers!',5851,1,0,0,'ironaya SAY_AGGRO'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1129004 AND -1129000; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1129000,'You\'ll never leave this place... alive.',5825,1,0,0,'amnennar SAY_AGGRO'), +(-1129001,'To me, my servants!',5828,1,0,0,'amnennar SAY_SUMMON60'), +(-1129002,'Come, spirits, attend your master!',5829,1,0,0,'amnennar SAY_SUMMON30'), +(-1129003,'I am the hand of the Lich King!',5827,1,0,0,'amnennar SAY_HP'), +(-1129004,'Too...easy!',5826,1,0,0,'amnennar SAY_KILL'); + +DELETE FROM `script_texts` WHERE `entry` IN (-1230002,-1230001); +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1230001,'Come to aid the Throne!',0,1,0,0,'dagran SAY_AGGRO'), +(-1230002,'Hail to the king, baby!',0,1,0,0,'dagran SAY_SLAY'); + +-- r852_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1189021 AND -1189011; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1189011,'Tell me... tell me everything!',5847,1,0,0,'vishas SAY_AGGRO'), +(-1189012,'Naughty secrets!',5849,1,0,0,'vishas SAY_HEALTH1'), +(-1189013,'I\'ll rip the secrets from your flesh!',5850,1,0,0,'vishas SAY_HEALTH2'), +(-1189014,'Purged by pain!',5848,1,0,0,'vishas SAY_KILL'), +(-1189015,'The monster got what he deserved.',0,0,1,0,'vishas SAY_TRIGGER_VORREL'), +(-1189016,'We hunger for vengeance.',5844,1,0,0,'thalnos SAY_AGGRO'), +(-1189017,'No rest, for the angry dead.',5846,1,0,0,'thalnos SAY_HEALTH'), +(-1189018,'More... More souls.',5845,1,0,0,'thalnos SAY_KILL'), +(-1189019,'You will not defile these mysteries!',5842,1,0,0,'doan SAY_AGGRO'), +(-1189020,'Burn in righteous fire!',5843,1,0,0,'doan SAY_SPECIALAE'), +(-1189021,'Release the hounds!',5841,1,0,0,'loksey SAY_AGGRO'); + +-- r854_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1070006 AND -1070001; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1070001,'Taste blade, mongrel!',0,0,0,0,'SAY_GUARD_SIL_AGGRO1'), +(-1070002,'Please tell me that you didn\'t just do what I think you just did. Please tell me that I\'m not going to have to hurt you...',0,0,0,0,'SAY_GUARD_SIL_AGGRO2'), +(-1070003,'As if we don\'t have enough problems, you go and create more!',0,0,0,0,'SAY_GUARD_SIL_AGGRO3'), +(-1070004,'looks up at you quizzically. Maybe you should inspect it?',0,2,0,0,'cluck EMOTE_A_HELLO'), +(-1070005,'looks at you unexpectadly.',0,2,0,0,'cluck EMOTE_H_HELLO'), +(-1070006,'starts pecking at the feed.',0,2,0,0,'cluck EMOTE_CLUCK_TEXT2'); + +-- r855_scriptdev2_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` IN (-1000004,-1000001); +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000001,'goes into a killing frenzy!',0,2,0,0,'EMOTE_GENERIC_FRENZY_KILL'), +(-1000004,'goes into a berserker rage!',0,2,0,0,'EMOTE_GENERIC_BERSERK'); + +DELETE FROM `script_texts` WHERE `entry` = -1000005; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000005,'Greetings citizen',0,0,7,0,'general_marcus SAY_GREETING'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1329003 AND -1329000; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1329000,'Thanks to Egan',0,0,0,0,'freed_soul SAY_ZAPPED0'), +(-1329001,'Rivendare must die',0,0,0,0,'freed_soul SAY_ZAPPED1'), +(-1329002,'Who you gonna call?',0,0,0,0,'freed_soul SAY_ZAPPED2'), +(-1329003,'Don\'t cross those beams!',0,0,0,0,'freed_soul SAY_ZAPPED3'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1999925 AND -1999900; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1999900,'Let the games begin.',8280,1,0,0,'example_creature SAY_AGGRO'), +(-1999901,'I see endless suffering. I see torment. I see rage. I see everything.',8831,1,0,0,'example_creature SAY_RANDOM_0'), +(-1999902,'Muahahahaha',8818,1,0,0,'example_creature SAY_RANDOM_1'), +(-1999903,'These mortal infedels my lord, they have invaded your sanctum and seek to steal your secrets.',8041,1,0,0,'example_creature SAY_RANDOM_2'), +(-1999904,'You are already dead.',8581,1,0,0,'example_creature SAY_RANDOM_3'), +(-1999905,'Where to go? What to do? So many choices that all end in pain, end in death.',8791,1,0,0,'example_creature SAY_RANDOM_4'), +(-1999906,'$N, I sentance you to death!',8588,1,0,0,'example_creature SAY_BESERK'), +(-1999907,'The suffering has just begun!',0,1,0,0,'example_creature SAY_PHASE'), +(-1999908,'I always thought I was a good dancer.',0,0,0,0,'example_creature SAY_DANCE'), +(-1999909,'Move out Soldier!',0,0,0,0,'example_creature SAY_SALUTE'), +(-1999910,'Help $N! I\'m under attack!',0,0,0,0,'example_escort SAY_AGGRO1'), +(-1999911,'Die scum!',0,0,0,0,'example_escort SAY_AGGRO2'), +(-1999912,'Hmm a nice day for a walk alright',0,0,0,0,'example_escort SAY_WP_1'), +(-1999913,'Wild Felboar attack!',0,0,0,0,'example_escort SAY_WP_2'), +(-1999914,'Time for me to go! See ya around $N!',0,0,0,3,'example_escort SAY_WP_3'), +(-1999915,'Bye Bye!',0,0,0,3,'example_escort SAY_WP_4'), +(-1999916,'How dare you leave me like that! I hate you! =*(',0,3,0,0,'example_escort SAY_DEATH_1'), +(-1999917,'...no...how could you let me die $N',0,0,0,0,'example_escort SAY_DEATH_2'), +(-1999918,'ugh...',0,0,0,0,'example_escort SAY_DEATH_3'), +(-1999919,'Taste death!',0,0,0,0,'example_escort SAY_SPELL'), +(-1999920,'Fireworks!',0,0,0,0,'example_escort SAY_RAND_1'), +(-1999921,'Hmm, I think I could use a buff.',0,0,0,0,'example_escort SAY_RAND_2'), +(-1999922,'Normal select, guess you\'re not interested.',0,0,0,0,'example_gossip_codebox SAY_NOT_INTERESTED'), +(-1999923,'Wrong!',0,0,0,0,'example_gossip_codebox SAY_WRONG'), +(-1999924,'You\'re right, you are allowed to see my inner secrets.',0,0,0,0,'example_gossip_codebox SAY_CORRECT'), +(-1999925,'Hi!',0,0,0,0,'example_areatrigger SAY_HI'); diff --git a/sql/updates/3.0.9_old/1423_mangos_7290_01_world_command.sql b/sql/updates/3.0.9_old/1423_mangos_7290_01_world_command.sql new file mode 100644 index 0000000..35f529b --- /dev/null +++ b/sql/updates/3.0.9_old/1423_mangos_7290_01_world_command.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7252_02_mangos_mangos_string required_7290_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` = 'npc setdeathstate'; +INSERT INTO `command` VALUES +('npc setdeathstate',2,'Syntax: .npc setdeathstate on/off\r\n\r\nSet default death state (dead/alive) for npc at spawn.'); diff --git a/sql/updates/3.0.9_old/1426_mangos_7292_01_world_points_of_interest.sql b/sql/updates/3.0.9_old/1426_mangos_7292_01_world_points_of_interest.sql new file mode 100644 index 0000000..0dcd481 --- /dev/null +++ b/sql/updates/3.0.9_old/1426_mangos_7292_01_world_points_of_interest.sql @@ -0,0 +1,13 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7290_01_mangos_command required_7292_01_mangos_points_of_interest bit;*/ + +DROP TABLE IF EXISTS `points_of_interest`; +CREATE TABLE `points_of_interest` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `x` float NOT NULL default '0', + `y` float NOT NULL default '0', + `icon` mediumint(8) unsigned NOT NULL default '0', + `flags` mediumint(8) unsigned NOT NULL default '0', + `data` mediumint(8) unsigned NOT NULL default '0', + `icon_name` text NOT NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.0.9_old/1426_mangos_7292_02_world_locales_points_of_interest.sql b/sql/updates/3.0.9_old/1426_mangos_7292_02_world_locales_points_of_interest.sql new file mode 100644 index 0000000..2a1989e --- /dev/null +++ b/sql/updates/3.0.9_old/1426_mangos_7292_02_world_locales_points_of_interest.sql @@ -0,0 +1,15 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7292_01_mangos_points_of_interest required_7292_02_mangos_locales_points_of_interest bit;*/ + +DROP TABLE IF EXISTS `locales_points_of_interest`; +CREATE TABLE `locales_points_of_interest` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `icon_name_loc1` text, + `icon_name_loc2` text, + `icon_name_loc3` text, + `icon_name_loc4` text, + `icon_name_loc5` text, + `icon_name_loc6` text, + `icon_name_loc7` text, + `icon_name_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.0.9_old/1463_mangos_7303_01_world_pools.sql b/sql/updates/3.0.9_old/1463_mangos_7303_01_world_pools.sql new file mode 100644 index 0000000..ff25b33 --- /dev/null +++ b/sql/updates/3.0.9_old/1463_mangos_7303_01_world_pools.sql @@ -0,0 +1,39 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7292_02_mangos_locales_points_of_interest required_7303_01_mangos_pools bit;*/ + +DROP TABLE IF EXISTS `pool_creature`; +CREATE TABLE `pool_creature` ( + `guid` int(10) unsigned NOT NULL default '0', + `pool_entry` mediumint(8) unsigned NOT NULL default '0', + `chance` float unsigned NOT NULL default '0', + PRIMARY KEY (`pool_entry`,`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `pool_gameobject`; +CREATE TABLE `pool_gameobject` ( + `guid` int(10) unsigned NOT NULL default '0', + `pool_entry` mediumint(8) unsigned NOT NULL default '0', + `chance` float unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`pool_entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `pool_pool`; +CREATE TABLE `pool_pool` ( + `pool_id` mediumint(8) unsigned NOT NULL default '0', + `mother_pool` mediumint(8) unsigned NOT NULL default '0', + `chance` float NOT NULL default '0', + PRIMARY KEY (`pool_id`,`mother_pool`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `pool_template`; +CREATE TABLE `pool_template` ( + `entry` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Pool entry', + `max_limit` int(10) unsigned NOT NULL default '0' COMMENT 'Max number of objects (0) is no limit', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `game_event_pool`; +CREATE TABLE `game_event_pool` ( + `pool_entry` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Id of the pool', + `event` smallint(6) NOT NULL default '0' COMMENT 'Put negatives values to remove during event', + PRIMARY KEY (`pool_entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.0.9_old/1470_world_scripts.sql b/sql/updates/3.0.9_old/1470_world_scripts.sql new file mode 100644 index 0000000..1d2d5ba --- /dev/null +++ b/sql/updates/3.0.9_old/1470_world_scripts.sql @@ -0,0 +1,4 @@ +-- Remove script for quest 8346. Note support for this quest will be added in next ACID release(25) +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry` IN (15273,15274,15294,15298,15367); +UPDATE `creature_template` SET `ScriptName`='mob_broggok_poisoncloud' WHERE `entry`=17662; +-- UPDATE `creature_template` SET `ScriptName`='npc_draenei_survivor' WHERE `entry`=16483; diff --git a/sql/updates/3.0.9_old/1484_mangos_7307_01_characters_arena_team_member.sql b/sql/updates/3.0.9_old/1484_mangos_7307_01_characters_arena_team_member.sql new file mode 100644 index 0000000..749bedf --- /dev/null +++ b/sql/updates/3.0.9_old/1484_mangos_7307_01_characters_arena_team_member.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7267_01_characters_auctionhouse required_7307_01_characters_arena_team_member bit;*/ + +ALTER TABLE arena_team_member + ADD PRIMARY KEY (arenateamid,guid); diff --git a/sql/updates/3.0.9_old/1495_mangos_7312_01_world_trinity_string.sql b/sql/updates/3.0.9_old/1495_mangos_7312_01_world_trinity_string.sql new file mode 100644 index 0000000..71979b7 --- /dev/null +++ b/sql/updates/3.0.9_old/1495_mangos_7312_01_world_trinity_string.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7303_01_mangos_pools required_7312_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry`=810; +INSERT INTO `trinity_string` VALUES +(810,'|Hplayer:$N|h[$N]|h has earned the achievement $a!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1497_mangos_7314_01_characters_guild_rank.sql b/sql/updates/3.0.9_old/1497_mangos_7314_01_characters_guild_rank.sql new file mode 100644 index 0000000..b1c07f4 --- /dev/null +++ b/sql/updates/3.0.9_old/1497_mangos_7314_01_characters_guild_rank.sql @@ -0,0 +1,3 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7307_01_characters_arena_team_member required_7314_01_characters_guild_rank bit;*/ + +UPDATE guild_rank SET rights = rights & ~0x00020000; diff --git a/sql/updates/3.0.9_old/1525_world_scripts.sql b/sql/updates/3.0.9_old/1525_world_scripts.sql new file mode 100644 index 0000000..6dedfd8 --- /dev/null +++ b/sql/updates/3.0.9_old/1525_world_scripts.sql @@ -0,0 +1,2 @@ +-- Script for Yrykul Skeleton - Prince Keleseth Event +UPDATE `creature_template` SET `ScriptName`='mob_vrykul_skeleton' WHERE `entry`=23970; diff --git a/sql/updates/3.0.9_old/1531_mangos_7324_01_characters_character_spell.sql b/sql/updates/3.0.9_old/1531_mangos_7324_01_characters_character_spell.sql new file mode 100644 index 0000000..2aaefe9 --- /dev/null +++ b/sql/updates/3.0.9_old/1531_mangos_7324_01_characters_character_spell.sql @@ -0,0 +1,13 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7314_01_characters_guild_rank required_7324_01_characters_character_spell bit;*/ + +/* remove some deleted spells or ranks from characters */ +/* Mana Tap no longer Blood Elf Racial */ +DELETE FROM `character_spell` WHERE `spell` = '28734'; +/* Hamstring is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_spell` WHERE `spell` IN ('7373', '7372', '25212'); +/* Intercept is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_spell` WHERE `spell` IN ('20616', '20617', '25272', '25275'); +/* Overpower is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_spell` WHERE `spell` IN ('7887', '11584', '11585'); +/* Shield Bash is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_spell` WHERE `spell` IN ('1671', '1672', '29704'); diff --git a/sql/updates/3.0.9_old/1531_mangos_7324_02_characters_character_aura.sql b/sql/updates/3.0.9_old/1531_mangos_7324_02_characters_character_aura.sql new file mode 100644 index 0000000..b3d741b --- /dev/null +++ b/sql/updates/3.0.9_old/1531_mangos_7324_02_characters_character_aura.sql @@ -0,0 +1,13 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7324_01_characters_character_spell required_7324_02_characters_character_aura bit;*/ + +/* remove some deleted spells or ranks from characters auras */ +/* Mana Tap no longer Blood Elf Racial */ +DELETE FROM `character_aura` WHERE `spell` = '28734'; +/* Hamstring is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_aura` WHERE `spell` IN ('7373', '7372', '25212'); +/* Intercept is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_aura` WHERE `spell` IN ('20616', '20617', '25272', '25275'); +/* Overpower is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_aura` WHERE `spell` IN ('7887', '11584', '11585'); +/* Shield Bash is only one rank now, need to delete these zzOLDRank spells */ +DELETE FROM `character_aura` WHERE `spell` IN ('1671', '1672', '29704'); diff --git a/sql/updates/3.0.9_old/1555_mangos_7331_01_world_command.sql b/sql/updates/3.0.9_old/1555_mangos_7331_01_world_command.sql new file mode 100644 index 0000000..064cffa --- /dev/null +++ b/sql/updates/3.0.9_old/1555_mangos_7331_01_world_command.sql @@ -0,0 +1,65 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7312_01_mangos_mangos_string required_7331_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` = 'account set addon'; +DELETE FROM `command` WHERE `name` = 'ban account'; +DELETE FROM `command` WHERE `name` = 'ban character'; +DELETE FROM `command` WHERE `name` = 'ban ip'; +DELETE FROM `command` WHERE `name` = 'baninfo account'; +DELETE FROM `command` WHERE `name` = 'baninfo character'; +DELETE FROM `command` WHERE `name` = 'baninfo ip'; +DELETE FROM `command` WHERE `name` = 'banlist account'; +DELETE FROM `command` WHERE `name` = 'banlist character'; +DELETE FROM `command` WHERE `name` = 'banlist ip'; +DELETE FROM `command` WHERE `name` = 'gm fly'; +/* next command deleted even in case it has been already corrected (trailing space) */ +DELETE FROM `command` WHERE `name` = 'gobject near '; +DELETE FROM `command` WHERE `name` = 'gobject near'; + +DELETE FROM `command` WHERE `name` = 'lookup player account'; +DELETE FROM `command` WHERE `name` = 'lookup player ip'; +DELETE FROM `command` WHERE `name` = 'lookup player email'; +DELETE FROM `command` WHERE `name` = 'modify money'; +DELETE FROM `command` WHERE `name` = 'modify mount'; +DELETE FROM `command` WHERE `name` = 'modify speed'; +DELETE FROM `command` WHERE `name` = 'modify titles'; +DELETE FROM `command` WHERE `name` = 'pdump write'; +DELETE FROM `command` WHERE `name` = 'pdump load'; +DELETE FROM `command` WHERE `name` = 'reset honor'; +DELETE FROM `command` WHERE `name` = 'reset level'; +DELETE FROM `command` WHERE `name` = 'reset spells'; +DELETE FROM `command` WHERE `name` = 'reset stats'; +DELETE FROM `command` WHERE `name` = 'reset talents'; +DELETE FROM `command` WHERE `name` = 'unban account'; +DELETE FROM `command` WHERE `name` = 'unban character'; +DELETE FROM `command` WHERE `name` = 'unban ip'; + +INSERT INTO `command` VALUES +('account set addon',3,'Syntax: .account set addon [$account] #addon\r\n\r\nSet user (possible targeted) expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk.'), +('ban account',3,'Syntax: .ban account $Name $bantime $reason\r\nBan account kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban character',3,'Syntax: .ban character $Name $bantime $reason\r\nBan account and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('ban ip',3,'Syntax: .ban ip $Ip $bantime $reason\r\nBan IP.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'), +('baninfo account',3,'Syntax: .baninfo account\r\nWatch full information about a specific ban.'), +('baninfo character',3,'Syntax: .baninfo character\r\nWatch full information about a specific ban.'), +('baninfo ip',3,'Syntax: .baninfo ip\r\nWatch full information about a specific ban.'), +('banlist account',3,'Syntax: .banlist account [$Name]\r\nSearches the banlist for a account name pattern or show full list account bans.'), +('banlist character',3,'Syntax: .banlist character $Name\r\nSearches the banlist for a character name pattern. Pattern required.'), +('banlist ip',3,'Syntax: .banlist ip [$Ip]\r\nSearches the banlist for a IP pattern or show full list of IP bans.'), +('gm fly',3,'Syntax: .gm fly [on/off]\r\nEnable/disable gm fly mode.'), +('gobject near',3,'Syntax: .gobject near [#distance]\r\n\r\nOutput gameobjects at distance #distance from player. Output gameobject guids and coordinates sorted by distance from character. If #distance not provided use 10 as default value.'), +('lookup player account',2,'Syntax: .lookup player account $account ($limit) \r\n\r\n Searchs players, which account username is $account with optional parametr $limit of results.'), +('lookup player ip',2,'Syntax: .lookup player ip $ip ($limit) \r\n\r\n Searchs players, which account ast_ip is $ip with optional parametr $limit of results.'), +('lookup player email',2,'Syntax: .lookup player email $email ($limit) \r\n\r\n Searchs players, which account email is $email with optional parametr $limit of results.'), +('modify money',1,'Syntax: .modify money #money\r\n.money #money\r\n\r\nAdd or remove money to the selected player. If no player is selected, modify your money.\r\n\r\n #gold can be negative to remove money.'), +('modify mount',1,'Syntax: .modify mount #id #speed\r\nDisplay selected player as mounted at #id creature and set speed to #speed value.'), +('modify speed',1,'Syntax: .modify speed #rate\r\n.speed #rate\r\n\r\nModify the running speed of the selected player to \"normal base run speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'), +('modify titles',1,'Syntax: .modify titles #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'), +('pdump write',3,'Syntax: .pdump write $filename $playerNameOrGUID\r\nWrite character dump with name/guid $playerNameOrGUID to file $filename.'), +('pdump load',3,'Syntax: .pdump load $filename $account [$newname] [$newguid]\r\nLoad character dump from dump file into character list of $account with saved or $newname, with saved (or first free) or $newguid guid.'), +('reset honor',3,'Syntax: .reset honor [Playername]\r\n Reset all honor data for targeted character.'), +('reset level',3,'Syntax: .reset level [Playername]\r\n Reset level to 1 including reset stats and talents. Equipped items with greater level requirement can be lost.'), +('reset spells',3,'Syntax: .reset spells [Playername]\r\n Removes all non-original spells from spellbook.\r\n. Playername can be name of offline character.'), +('reset stats',3,'Syntax: .reset stats [Playername]\r\n Resets(recalculate) all stats of the targeted player to their original VALUESat current level.'), +('reset talents',3,'Syntax: .reset talents [Playername]\r\n Removes all talents of the targeted player. Playername can be name of offline character.'), +('unban account',3,'Syntax: .unban account $Name\r\nUnban accounts for account name pattern.'), +('unban character',3,'Syntax: .unban character $Name\r\nUnban accounts for character name pattern.'), +('unban ip',3,'Syntax : .unban ip $Ip\r\nUnban accounts for IP pattern.'); diff --git a/sql/updates/3.0.9_old/1558_world.sql b/sql/updates/3.0.9_old/1558_world.sql new file mode 100644 index 0000000..e9f3494 --- /dev/null +++ b/sql/updates/3.0.9_old/1558_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = '44869' AND `spell_effect` = '-45018'; +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = '46019' AND `spell_effect` = '-45018'; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(44869, -45018, 1, 'Remove Arcane Buffet'), +(46019, -45018, 1, 'Remove Arcane Buffet'); diff --git a/sql/updates/3.0.9_old/1559_world.sql b/sql/updates/3.0.9_old/1559_world.sql new file mode 100644 index 0000000..c3e70a4 --- /dev/null +++ b/sql/updates/3.0.9_old/1559_world.sql @@ -0,0 +1,11 @@ +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(48077, 48075, 0, 'Holy Nova (rank8)'), +(48078, 48076, 0, 'Holy Nova (rank9)'), +(47585, 60069, 0, 'Dispersion (transform/regen)'); + +DELETE FROM `spell_proc_event` WHERE `entry` IN (47549); +INSERT INTO `spell_proc_event` VALUES (47549, 0x00, 6, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +DELETE FROM `spell_proc_event` WHERE `entry` IN (47551); +INSERT INTO `spell_proc_event` VALUES (47551, 0x00, 6, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +DELETE FROM `spell_proc_event` WHERE `entry` IN (47552); +INSERT INTO `spell_proc_event` VALUES (47552, 0x00, 6, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1576_mangos_7332_01_world_command.sql b/sql/updates/3.0.9_old/1576_mangos_7332_01_world_command.sql new file mode 100644 index 0000000..5d178fe --- /dev/null +++ b/sql/updates/3.0.9_old/1576_mangos_7332_01_world_command.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7331_01_mangos_command required_7332_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` = 'distance'; +INSERT INTO `command` VALUES +('distance',3,'Syntax: .distance [$name/$link]\r\n\r\nDisplay the distance from your character to the selected creature/player, or player with name $name, or player/creature/gameobject pointed to shift-link with guid.'); diff --git a/sql/updates/3.0.9_old/1605_mangos_7349_01_world_spell_area.sql b/sql/updates/3.0.9_old/1605_mangos_7349_01_world_spell_area.sql new file mode 100644 index 0000000..f24dd96 --- /dev/null +++ b/sql/updates/3.0.9_old/1605_mangos_7349_01_world_spell_area.sql @@ -0,0 +1,15 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7332_01_mangos_command required_7349_01_mangos_spell_area bit;*/ + +DROP TABLE IF EXISTS `spell_area`; +CREATE TABLE `spell_area` ( + `spell` mediumint(8) unsigned NOT NULL default '0', + `area` mediumint(8) unsigned NOT NULL default '0', + `quest_start` mediumint(8) unsigned NOT NULL default '0', + `quest_start_active` tinyint(1) unsigned NOT NULL default '0', + `quest_end` mediumint(8) unsigned NOT NULL default '0', + `aura_spell` mediumint(8) unsigned NOT NULL default '0', + `racemask` mediumint(8) unsigned NOT NULL default '0', + `gender` tinyint(1) unsigned NOT NULL default '2', + `autocast` tinyint(1) unsigned NOT NULL default '0', + PRIMARY KEY (`spell`,`area`,`quest_start`,`quest_start_active`,`aura_spell`,`racemask`,`gender`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.0.9_old/1613_world_scripts.sql b/sql/updates/3.0.9_old/1613_world_scripts.sql new file mode 100644 index 0000000..4a106a1 --- /dev/null +++ b/sql/updates/3.0.9_old/1613_world_scripts.sql @@ -0,0 +1,3 @@ +-- Script for Skarvald and Dalronn +UPDATE `creature_template` SET `ScriptName`= 'boss_skarvald_the_constructor' WHERE `entry` IN (24200,27390); +UPDATE `creature_template` SET `ScriptName`= 'boss_dalronn_the_controller' WHERE `entry` IN (24201,27389); diff --git a/sql/updates/3.0.9_old/1614_characters_auctionhouse.sql b/sql/updates/3.0.9_old/1614_characters_auctionhouse.sql new file mode 100644 index 0000000..79423f1 --- /dev/null +++ b/sql/updates/3.0.9_old/1614_characters_auctionhouse.sql @@ -0,0 +1,24 @@ +ALTER TABLE `auctionhousebot` + ADD COLUMN `percentgreytradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Grey Trade Goods auction items' AFTER `maxtime`, + ADD COLUMN `percentorangetradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Orange Trade Goods auction items' AFTER `percentpurpletradegoods`, + ADD COLUMN `percentyellowtradegoods` int(11) default '0' COMMENT 'Sets the percentage of the Yellow Trade Goods auction items' AFTER `percentorangetradegoods`, + ADD COLUMN `percentgreyitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Grey auction items' AFTER `percentyellowtradegoods`, + ADD COLUMN `percentorangeitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Orange auction items' AFTER `percentpurpleitems`, + ADD COLUMN `percentyellowitems` int(11) default '0' COMMENT 'Sets the percentage of the non trade Yellow auction items' AFTER `percentorangeitems`, + ADD COLUMN `minpricegrey` int(11) default '100' COMMENT 'Minimum price of Grey items (percentage).' AFTER `percentyellowitems`, + ADD COLUMN `maxpricegrey` int(11) default '150' COMMENT 'Maximum price of Grey items (percentage).' AFTER `minpricegrey`, + ADD COLUMN `minpriceorange` int(11) default '3250' COMMENT 'Minimum price of Orange items (percentage).' AFTER `maxpricepurple`, + ADD COLUMN `maxpriceorange` int(11) default '5550' COMMENT 'Maximum price of Orange items (percentage).' AFTER `minpriceorange`, + ADD COLUMN `minpriceyellow` int(11) default '5250' COMMENT 'Minimum price of Yellow items (percentage).' AFTER `maxpriceorange`, + ADD COLUMN `maxpriceyellow` int(11) default '6550' COMMENT 'Maximum price of Yellow items (percentage).' AFTER `minpriceyellow`, + ADD COLUMN `minbidpricegrey` int(11) default '70' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 70' AFTER `maxpriceyellow`, + ADD COLUMN `maxbidpricegrey` int(11) default '100' COMMENT 'Starting bid price of Grey items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpricegrey`, + ADD COLUMN `minbidpriceorange` int(11) default '80' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 80' AFTER `maxbidpricepurple`, + ADD COLUMN `maxbidpriceorange` int(11) default '100' COMMENT 'Starting bid price of Orange items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpriceorange`, + ADD COLUMN `minbidpriceyellow` int(11) default '80' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 80' AFTER `maxbidpriceorange`, + ADD COLUMN `maxbidpriceyellow` int(11) default '100' COMMENT 'Starting bid price of Yellow items as a percentage of the randomly chosen buyout price. Default: 100' AFTER `minbidpriceyellow`, + ADD COLUMN `maxstackgrey` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.' AFTER `maxbidpriceyellow`, + ADD COLUMN `maxstackorange` int(11) default '1' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.' AFTER `maxstackpurple`, + ADD COLUMN `maxstackyellow` int(11) default '1' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.' AFTER `maxstackorange`, + ADD COLUMN `buyerpriceorange` int(11) default '20' COMMENT 'Multiplier to vendorprice when buying orange items from auctionhouse' AFTER `buyerpricepurple`, + ADD COLUMN `buyerpriceyellow` int(11) default '22' COMMENT 'Multiplier to vendorprice when buying yellow items from auctionhouse' AFTER `buyerpriceorange`; diff --git a/sql/updates/3.0.9_old/1618_world.sql b/sql/updates/3.0.9_old/1618_world.sql new file mode 100644 index 0000000..0f08c98 --- /dev/null +++ b/sql/updates/3.0.9_old/1618_world.sql @@ -0,0 +1,6 @@ +-- Glyph of power word: shield +INSERT INTO `spell_proc_event` VALUES (55672, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); + +-- Bloodsurge +DELETE FROM `spell_proc_event` WHERE `entry` IN (46915); +INSERT INTO `spell_proc_event` VALUES (46915, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1646_mangos_7369_01_world_quest_template.sql b/sql/updates/3.0.9_old/1646_mangos_7369_01_world_quest_template.sql new file mode 100644 index 0000000..3856e88 --- /dev/null +++ b/sql/updates/3.0.9_old/1646_mangos_7369_01_world_quest_template.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7349_01_mangos_spell_area required_7369_01_mangos_quest_template bit;*/ + +ALTER TABLE quest_template + DROP COLUMN ReqSourceRef1, + DROP COLUMN ReqSourceRef2, + DROP COLUMN ReqSourceRef3, + DROP COLUMN ReqSourceRef4; diff --git a/sql/updates/3.0.9_old/1654_world.sql b/sql/updates/3.0.9_old/1654_world.sql new file mode 100644 index 0000000..466c0e0 --- /dev/null +++ b/sql/updates/3.0.9_old/1654_world.sql @@ -0,0 +1 @@ +INSERT INTO `spell_proc_event` VALUES (17619, 0x00, 13, 0x00000000, 0x00000000, 0x00000000, 0x00008000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1657_world.sql b/sql/updates/3.0.9_old/1657_world.sql new file mode 100644 index 0000000..bdd8c67 --- /dev/null +++ b/sql/updates/3.0.9_old/1657_world.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry`=1010; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES(1010, "| Account | Character | IP | GM | EXP |"); diff --git a/sql/updates/3.0.9_old/1661_world.sql b/sql/updates/3.0.9_old/1661_world.sql new file mode 100644 index 0000000..d8fcc0a --- /dev/null +++ b/sql/updates/3.0.9_old/1661_world.sql @@ -0,0 +1,2 @@ +-- Death Strike +INSERT INTO `spell_proc_event` VALUES (45469, 0x00, 15, 0x00000010, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1663_mangos_7376_01_world_spell_area.sql b/sql/updates/3.0.9_old/1663_mangos_7376_01_world_spell_area.sql new file mode 100644 index 0000000..6a036cb --- /dev/null +++ b/sql/updates/3.0.9_old/1663_mangos_7376_01_world_spell_area.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7369_01_mangos_quest_template required_7376_01_mangos_spell_area bit;*/ + +ALTER TABLE spell_area + CHANGE COLUMN `aura_spell` `aura_spell` mediumint(8) NOT NULL default '0'; diff --git a/sql/updates/3.0.9_old/1688_mangos_7382_01_world_creature_template.sql b/sql/updates/3.0.9_old/1688_mangos_7382_01_world_creature_template.sql new file mode 100644 index 0000000..6edbd5e --- /dev/null +++ b/sql/updates/3.0.9_old/1688_mangos_7382_01_world_creature_template.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7376_01_mangos_spell_area required_7382_01_mangos_creature_template bit;*/ + +ALTER TABLE creature_template + ADD COLUMN unk16 float NOT NULL default '1' AFTER InhabitType, + ADD COLUMN unk17 float NOT NULL default '1' AFTER unk16; diff --git a/sql/updates/3.0.9_old/1693_world.sql b/sql/updates/3.0.9_old/1693_world.sql new file mode 100644 index 0000000..d3b1675 --- /dev/null +++ b/sql/updates/3.0.9_old/1693_world.sql @@ -0,0 +1,87 @@ +-- Update Proc Rate +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +('60442', '0', '0', '0', '0', '0', '0', '0', '0', '0', '45'), +('57345', '0', '0', '0', '0', '0', '0', '0', '0', '0', '45'), +('61356', '0', '0', '0', '0', '0', '0', '0', '0', '0', '45'), +('54707', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60'), +('54808', '0', '0', '0', '0', '0', '0', '0', '0', '0', '60'); + +-- Update Spell Coefficients +DELETE FROM `spell_bonus_data` WHERE `entry` IN ('689', '18790', '172', '42223', '42224', '42225', '42226', '42218', '47817', '47818', '1949', '5857', '11681', '11682', '27214', '47822', '27243', '30108', '17962', '6789', '48181', '29722', '5676', '686', '17877', '30283', '1120', '30294', '44425', '42208', '42209', '42210', '42211', '42212', '42213', '42198', '42937', '42938', '11113', '31661', '120', '19750', '635', '25914', '25913', '25903', '27175', '33074', '48820', '48821', '58597', '31803', '53742', '31893', '32221', '53719', '53718', '20167', '20424', '31804', '53733', '31898', '32220', '53726', '53725', '20267', '20187', '20467', '53600', '596', '2944', '8092', '27813', '27817', '27818', '33619'); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +('689', '0', '0.143', '0', 'Warlock - Drain Life'), +('18790', '0', '0', '0','Warlock - Fel Stamina'), +('172', '0', '0.2', '0', 'Warlock - Corruption'), +('42223', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 1'), +('42224', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 2'), +('42225', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 3'), +('42226', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 4'), +('42218', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 5'), +('47817', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 6'), +('47818', '0.6932', '0', '0', 'Warlock - Rain of Fire Triggered Rank 7'), +('1949', '0', '0.0949', '0', 'Warlock - Hellfire'), +('5857', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 1'), +('11681', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 2'), +('11682', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 3'), +('27214', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 4'), +('47822', '0.1427', '0', '0', 'Warlock - Hellfire Effect on Enemy Rank 5'), +('27243', '0.2129', '0.25', '0', 'Warlock - Seed of Corruption'), +('30108', '0', '0.2', '0', 'Warlock - Unstable Affliction'), +('17962', '0.4293', '0', '0', 'Warlock - Conflagrate'), +('6789', '0.214', '0', '0', 'Warlock - Death Coil'), +('48181', '0.4793', '0', '0', 'Warlock - Haunt'), +('29722', '0.7139', '0', '0', 'Warlock - Incinerate'), +('5676', '0.4293', '0', '0', 'Warlock - Searing Pain'), +('686', '0.8569', '0', '0', 'Warlock - Shadow Bolt'), +('17877', '0.4293', '0', '0', 'Warlock - Shadowburn'), +('30283', '0.1932', '0', '0', 'Warlock - Shadowfury'), +('1120', '0', '0.429', '0', 'Warlock - Drain Soul'), +('30294', '0', '0', '0', 'Warlock - Soul Leech'), +('44425', '0.7143', '0', '0', 'Mage - Arcane Barrage'), +('42208', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 1'), +('42209', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 2'), +('42210', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 3'), +('42211', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 4'), +('42212', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 5'), +('42213', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 6'), +('42198', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 7'), +('42937', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 8'), +('42938', '0.1437', '0', '0', 'Mage - Blizzard Triggered Spell Rank 9'), +('11113', '0.1936', '0', '0', 'Mage - Blast Wave Rank'), +('31661', '0.1936', '0', '0', 'Mage - Dragons Breath'), +('120', '0.214', '0', '0', 'Mage - Cone of Cold'), +('19750', '1', '0', '0', 'Paladin - Flash of Light'), +('635', '1.66', '0', '0', 'Paladin - Holy Light'), +('25914', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 1'), +('25913', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 2'), +('25903', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 3'), +('27175', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 4'), +('33074', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 5'), +('48820', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 6'), +('48821', '0.81', '0', '0', 'Paladin - Holy Shock Triggered Heal Rank 7'), +('58597', '0.75', '0', '0', 'Paladin - Sacred Shield'), +('31803', '0', '0.018', '0.03', 'Paladin - Holy Vengeance'), +('53742', '0', '0.018', '0.03', 'Paladin - Blood Corruption'), +('31893', '0', '0', '0', 'Paladin - Seal of Blood Enemy Proc'), +('32221', '0', '0', '0', 'Paladin - Seal of Blood Self Proc'), +('53719', '0', '0', '0', 'Paladin - Seal of The Martyr Enemy Proc'), +('53718', '0', '0', '0', 'Paladin - Seal of The Martyr Self Proc'), +('20167', '0.15', '0', '0.15', 'Paladin - Seal of Light Proc'), +('20424', '0.1035', '0', '0', 'Paladin - Seal of Command Proc'), +('31804', '0.22', '0', '0.14', 'Paladin - Judgement of Vengeance'), +('53733', '0.22', '0', '0.14', 'Paladin - Judgement of Corruption'), +('31898', '0.25', '0', '0.16', 'Paladin - Judgement of Blood Enemy'), +('32220', '0', '0', '0', 'Paladin - Judgement of Blood Self'), +('53726', '0.25', '0', '0.16', 'Paladin - Judgement of the Martyr Enemy'), +('53725', '0', '0', '0', 'Paladin - Judgement of the Martyr Self'), +('20267', '0.1', '0', '0.1', 'Paladin - Judgement of Light Proc'), +('20187', '0.4', '0', '0.25', 'Paladin - Judgement of Righteousness'), +('20467', '0.25', '0', '0.16', 'Paladin - Judgement of Command'), +('53600', '0', '0', '0', 'Paladin - Shield of Righteousness'), +('596', '0.8068', '0', '0', 'Priest - Prayer of Healing'), +('2944', '0.8149', '0', '0', 'Priest - Devouring Plague'), +('8092', '0.428', '0', '0', 'Priest - Mind Blast'), +('27813', '0', '0', '0', 'Priest - Blessed Recovery Rank 1'), +('27817', '0', '0', '0', 'Priest - Blessed Recovery Rank 2'), +('27818', '0', '0', '0', 'Priest - Blessed Recovery Rank 3'), +('33619', '0', '0', '0', 'Priest - Reflective Shield'); diff --git a/sql/updates/3.0.9_old/1694_world.sql b/sql/updates/3.0.9_old/1694_world.sql new file mode 100644 index 0000000..bfbb47a --- /dev/null +++ b/sql/updates/3.0.9_old/1694_world.sql @@ -0,0 +1,16 @@ +-- Sanctified Wrath +INSERT INTO `spell_proc_event` VALUES (57318, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 6); +INSERT INTO `spell_proc_event` VALUES (53375, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 6); + +-- Star Sinner +DELETE FROM `spell_proc_event` WHERE `entry` IN (54738); +INSERT INTO `spell_proc_event` VALUES (54738, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 45); + +-- Tentacles +DELETE FROM `spell_proc_event` WHERE `entry` IN (61618); +INSERT INTO `spell_proc_event` VALUES (61618, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- Demonic Sacrifice +DELETE FROM `spell_bonus_data` WHERE `entry` = 18790; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`comments`) VALUES +('18790','0','0','0','Warlock - Fel Stamina'); diff --git a/sql/updates/3.0.9_old/1697_mangos_7388_01_world_trinity_string.sql b/sql/updates/3.0.9_old/1697_mangos_7388_01_world_trinity_string.sql new file mode 100644 index 0000000..c452723 --- /dev/null +++ b/sql/updates/3.0.9_old/1697_mangos_7388_01_world_trinity_string.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7382_01_mangos_creature_template required_7388_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (750,751); +INSERT INTO `trinity_string` VALUES +(750,'Not enough players. This game will close in %u mins.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(751,'Not enough players. This game will close in %u seconds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1703_world.sql b/sql/updates/3.0.9_old/1703_world.sql new file mode 100644 index 0000000..726c0b6 --- /dev/null +++ b/sql/updates/3.0.9_old/1703_world.sql @@ -0,0 +1,140 @@ +DROP TABLE IF EXISTS `access_requirement`; +CREATE TABLE `access_requirement` ( + `id` bigint(20) unsigned NOT NULL COMMENT 'Identifier', + `level_min` tinyint(3) unsigned NOT NULL default '0', + `level_max` tinyint(3) unsigned NOT NULL default '0', + `item` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `item2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_key` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_key2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `quest_failed_text` TEXT NULL DEFAULT NULL, + `heroic_quest_done` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `heroic_quest_failed_text` TEXT NULL DEFAULT NULL, + `comment` TEXT NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Access Requirements'; + +ALTER TABLE `instance_template` + DROP COLUMN `levelMin`, + DROP COLUMN `levelMax`, + ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `reset_delay`; + +ALTER TABLE `areatrigger_teleport` + DROP COLUMN `required_level`, + DROP COLUMN `required_item`, + DROP COLUMN `required_item2`, + DROP COLUMN `heroic_key`, + DROP COLUMN `heroic_key2`, + DROP COLUMN `heroic_required_quest_done`, + DROP COLUMN `heroic_required_failed_quest_text`, + DROP COLUMN `required_quest_done`, + DROP COLUMN `required_failed_text`, + ADD COLUMN `access_id` bigint(20) unsigned NOT NULL DEFAULT '0' AFTER `name`; + +INSERT INTO `access_requirement` VALUES +('1','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Shadowfang Keep (33)'), +('2','15','0','0','0','0','0','0',NULL,'0',NULL,'instance The Stockade (34)'), +('3','10','0','0','0','0','0','0',NULL,'0',NULL,'instance The Deadmines (36)'), +('4','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Wailing Caverns (43)'), +('5','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Kraul (47)'), +('6','10','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackfathom Deeps (48)'), +('7','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Uldaman (70)'), +('8','15','0','0','0','0','0','0',NULL,'0',NULL,'instance Gnomeregan (90)'), +('9','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunken Temple (109)'), +('10','25','0','0','0','0','0','0',NULL,'0',NULL,'instance Razorfen Downs (129)'), +('11','20','0','0','0','0','0','0',NULL,'0',NULL,'instance Scarlet Monastery (189)'), +('12','35','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Farrak (209)'), +('13','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Spire (229)'), +('14','40','0','0','0','0','0','0',NULL,'0',NULL,'instance Blackrock Depths (230)'), +('15','55','0','16309','0','0','0','0',NULL,'0',NULL,'instance Onyxia\'s Lair (249)'), +('16','66','0','0','0','30635','0','10285','You can\'t enter Black Morass until you rescue Thrall from Durnholde Keep.','0',NULL,'instance The Black Morass (269)'), +('17','45','0','13704','0','0','0','0',NULL,'0',NULL,'instance Scholomance (289)'), +('18','50','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Gurub (309)'), +('19','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Stratholme (329)'), +('20','30','0','0','0','0','0','0',NULL,'0',NULL,'instance Maraudon (349)'), +('21','8','0','0','0','0','0','0',NULL,'0',NULL,'instance Ragefire Chasm (389)'), +('22','50','0','0','0','0','0','7487',NULL,'0',NULL,'instance Molten Core (409)'), +('23','45','0','0','0','0','0','0',NULL,'0',NULL,'instance Dire Maul (429)'), +('24','60','0','0','0','0','0','7761',NULL,'0',NULL,'instance Blackwing Lair (469)'), +('25','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Ruins of Ahn\'Qiraj (509)'), +('26','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Temple of Ahn\'Qiraj (531)'), +('27','68','0','0'/*'24490'*/,'0','0','0','0',NULL,'0',NULL,'instance Karazhan (532)'), +('28','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Naxxramas (533)'), +('29','70','0','0','0','0','0','10445',NULL,'0',NULL,'instance Hyjal Summit (534)'), +('30','55','0','0'/*'28395'*/,'0','30637','30622','0',NULL,'0',NULL,'instance The Shattered Halls (540)'), +('31','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance The Blood Furnace (542)'), +('32','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance Hellfire Ramparts (543)'), +('33','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Magtheridon\'s Lair (544)'), +('34','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Steamvault (545)'), +('35','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Underbog (546)'), +('36','55','0','0','0','30623','0','0',NULL,'0',NULL,'instance The Slave Pens (547)'), +('37','70','0','0','0','0','0','0'/*'10901'*/,NULL,'0',NULL,'instance Serpentshrine Cavern (548)'), +('38','70','0','0'/*'31704'*/,'0','0','0','0',NULL,'0',NULL,'instance The Eye (550)'), +('39','68','0','0'/*'31084'*/,'0','30634','0','0',NULL,'0',NULL,'instance The Arcatraz (552)'), +('40','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Botanica (553)'), +('41','68','0','0','0','30634','0','0',NULL,'0',NULL,'instance The Mechanar (554)'), +('42','65','0','27991','0','30633','0','0',NULL,'0',NULL,'instance Shadow Labyrinth (555)'), +('43','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Sethekk Halls (556)'), +('44','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Mana-Tombs (557)'), +('45','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Auchenai Crypts (558)'), +('46','66','0','0','0','30635','0','0',NULL,'0',NULL,'instance Old Hillsbrad Foothills (560)'), +('47','70','0','32649','0','0','0','0',NULL,'0',NULL,'instance Black Temple (564)'), +('48','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Gruul\'s Lair (565)'), +('49','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Aman (568)'), +('50','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunwell Plateau (580)'), +('51','70','0','0','0','0','0','0',NULL,'11492','Heroic Difficulty requires completion of the "Hard to Kill" quest.','instance Magisters\' Terrace (585)'), +('52','58','0','0','0','0','0','0',NULL,'0',NULL,'Dark Portal'); + +UPDATE `instance_template` SET `access_id` = '1' WHERE `map` = '33'; +UPDATE `instance_template` SET `access_id` = '2' WHERE `map` = '34'; +UPDATE `instance_template` SET `access_id` = '3' WHERE `map` = '36'; +UPDATE `instance_template` SET `access_id` = '4' WHERE `map` = '43'; +UPDATE `instance_template` SET `access_id` = '5' WHERE `map` = '47'; +UPDATE `instance_template` SET `access_id` = '6' WHERE `map` = '48'; +UPDATE `instance_template` SET `access_id` = '7' WHERE `map` = '70'; +UPDATE `instance_template` SET `access_id` = '8' WHERE `map` = '90'; +UPDATE `instance_template` SET `access_id` = '9' WHERE `map` = '109'; +UPDATE `instance_template` SET `access_id` = '10' WHERE `map` = '129'; +UPDATE `instance_template` SET `access_id` = '11' WHERE `map` = '189'; +UPDATE `instance_template` SET `access_id` = '12' WHERE `map` = '209'; +UPDATE `instance_template` SET `access_id` = '13' WHERE `map` = '229'; +UPDATE `instance_template` SET `access_id` = '14' WHERE `map` = '230'; +UPDATE `instance_template` SET `access_id` = '15' WHERE `map` = '249'; +UPDATE `instance_template` SET `access_id` = '16' WHERE `map` = '269'; +UPDATE `instance_template` SET `access_id` = '17' WHERE `map` = '289'; +UPDATE `instance_template` SET `access_id` = '18' WHERE `map` = '309'; +UPDATE `instance_template` SET `access_id` = '19' WHERE `map` = '329'; +UPDATE `instance_template` SET `access_id` = '20' WHERE `map` = '349'; +UPDATE `instance_template` SET `access_id` = '21' WHERE `map` = '389'; +UPDATE `instance_template` SET `access_id` = '22' WHERE `map` = '409'; +UPDATE `instance_template` SET `access_id` = '23' WHERE `map` = '429'; +UPDATE `instance_template` SET `access_id` = '24' WHERE `map` = '469'; +UPDATE `instance_template` SET `access_id` = '25' WHERE `map` = '509'; +UPDATE `instance_template` SET `access_id` = '26' WHERE `map` = '531'; +UPDATE `instance_template` SET `access_id` = '27' WHERE `map` = '532'; +UPDATE `instance_template` SET `access_id` = '28' WHERE `map` = '533'; +UPDATE `instance_template` SET `access_id` = '29' WHERE `map` = '534'; +UPDATE `instance_template` SET `access_id` = '30' WHERE `map` = '540'; +UPDATE `instance_template` SET `access_id` = '31' WHERE `map` = '542'; +UPDATE `instance_template` SET `access_id` = '32' WHERE `map` = '543'; +UPDATE `instance_template` SET `access_id` = '33' WHERE `map` = '544'; +UPDATE `instance_template` SET `access_id` = '34' WHERE `map` = '545'; +UPDATE `instance_template` SET `access_id` = '35' WHERE `map` = '546'; +UPDATE `instance_template` SET `access_id` = '36' WHERE `map` = '547'; +UPDATE `instance_template` SET `access_id` = '37' WHERE `map` = '548'; +UPDATE `instance_template` SET `access_id` = '38' WHERE `map` = '550'; +UPDATE `instance_template` SET `access_id` = '39' WHERE `map` = '552'; +UPDATE `instance_template` SET `access_id` = '40' WHERE `map` = '553'; +UPDATE `instance_template` SET `access_id` = '41' WHERE `map` = '554'; +UPDATE `instance_template` SET `access_id` = '42' WHERE `map` = '555'; +UPDATE `instance_template` SET `access_id` = '43' WHERE `map` = '556'; +UPDATE `instance_template` SET `access_id` = '44' WHERE `map` = '557'; +UPDATE `instance_template` SET `access_id` = '45' WHERE `map` = '558'; +UPDATE `instance_template` SET `access_id` = '46' WHERE `map` = '560'; +UPDATE `instance_template` SET `access_id` = '47' WHERE `map` = '564'; +UPDATE `instance_template` SET `access_id` = '48' WHERE `map` = '565'; +UPDATE `instance_template` SET `access_id` = '49' WHERE `map` = '568'; +UPDATE `instance_template` SET `access_id` = '50' WHERE `map` = '580'; +UPDATE `instance_template` SET `access_id` = '51' WHERE `map` = '585'; +UPDATE `areatrigger_teleport` SET `access_id` = '52' WHERE `id` IN ('4352','4354'); diff --git a/sql/updates/3.0.9_old/1709_mangos_7393_01_world_game_event.sql b/sql/updates/3.0.9_old/1709_mangos_7393_01_world_game_event.sql new file mode 100644 index 0000000..8ea4ed9 --- /dev/null +++ b/sql/updates/3.0.9_old/1709_mangos_7393_01_world_game_event.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7390_01_mangos_areatrigger_teleport required_7393_01_mangos_game_event bit;*/ + +ALTER TABLE `game_event` + ADD COLUMN `holiday` mediumint(8) unsigned NOT NULL default '0' COMMENT 'Client side holiday id' AFTER `length`; diff --git a/sql/updates/3.0.9_old/1724_mangos_7399_01_world_trinity_string.sql b/sql/updates/3.0.9_old/1724_mangos_7399_01_world_trinity_string.sql new file mode 100644 index 0000000..cf98d1f --- /dev/null +++ b/sql/updates/3.0.9_old/1724_mangos_7399_01_world_trinity_string.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7393_01_mangos_game_event required_7399_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (753, 754, 755); +INSERT INTO `trinity_string` VALUES +(753,'The battle for Warsong Gulch begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(754,'The battle for Arathi Basin begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(755,'The battle for Eye of the Storm begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1727_world.sql b/sql/updates/3.0.9_old/1727_world.sql new file mode 100644 index 0000000..208dd49 --- /dev/null +++ b/sql/updates/3.0.9_old/1727_world.sql @@ -0,0 +1 @@ +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES (42857,1,23954); diff --git a/sql/updates/3.0.9_old/1727_world_script.sql b/sql/updates/3.0.9_old/1727_world_script.sql new file mode 100644 index 0000000..0c87218 --- /dev/null +++ b/sql/updates/3.0.9_old/1727_world_script.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_ingvar_the_plunderer' WHERE `entry`=23954; +UPDATE `creature_template` SET `ScriptName`='mob_annhylde_the_caller' WHERE `entry`=24068; +UPDATE `creature_template` SET `ScriptName`='mob_ingvar_throw_dummy' WHERE `entry`=23997; diff --git a/sql/updates/3.0.9_old/1729_world.sql b/sql/updates/3.0.9_old/1729_world.sql new file mode 100644 index 0000000..6066bb5 --- /dev/null +++ b/sql/updates/3.0.9_old/1729_world.sql @@ -0,0 +1,4 @@ +-- Judgements of the Wise +REPLACE INTO `spell_proc_event` VALUES (31876, 0x00, 10, 0x20180400, 0x0000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (31877, 0x00, 10, 0x20180400, 0x0000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (31878, 0x00, 10, 0x20180400, 0x0000008, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1730_world.sql b/sql/updates/3.0.9_old/1730_world.sql new file mode 100644 index 0000000..615277e --- /dev/null +++ b/sql/updates/3.0.9_old/1730_world.sql @@ -0,0 +1,4 @@ +-- Faerie fire +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES ('60089', '0', '0', '0.05', 'Druid - Faerie Fire (Bear Form)'); +-- Glyph of Devastate +INSERT INTO `spell_proc_event` VALUES (58388, 0x00, 4, 0x00000040, 0x00000000, 0x00000000, 0x00000110, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1732_world.sql b/sql/updates/3.0.9_old/1732_world.sql new file mode 100644 index 0000000..c3ff759 --- /dev/null +++ b/sql/updates/3.0.9_old/1732_world.sql @@ -0,0 +1,7 @@ +-- Improved Cower +INSERT INTO `spell_proc_event` VALUES (53180, 0x00, 9, 0x00000000, 268435456, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (53181, 0x00, 9, 0x00000000, 268435456, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); + +-- Guard Dog +INSERT INTO `spell_proc_event` VALUES (53178, 0x00, 9, 0x00000000, 268435456, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (53179, 0x00, 9, 0x00000000, 268435456, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1755_world.sql b/sql/updates/3.0.9_old/1755_world.sql new file mode 100644 index 0000000..2f2e305 --- /dev/null +++ b/sql/updates/3.0.9_old/1755_world.sql @@ -0,0 +1,12 @@ +DELETE FROM spell_proc_event WHERE entry IN (47535, 47536, 47537, 47538, 47539); +-- Rapture +INSERT INTO `spell_proc_event` VALUES (47535, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47536, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47537, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47538, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (47539, 0x00, 6, 0x1800, 0x10000, 0x00000000, 0x00014010, 0x00000000, 0.000000, 0.000000, 0); +-- Aspect of the viper +INSERT INTO `spell_proc_event` VALUES (34074, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0.000000, 0.000000, 0); + +DELETE FROM `spell_bonus_data` WHERE entry=2944; +INSERT INTO `spell_bonus_data` VALUES ('2944', '0', '0.1849', '0', 'Priest - Devouring Plague'); diff --git a/sql/updates/3.0.9_old/1764_world.sql b/sql/updates/3.0.9_old/1764_world.sql new file mode 100644 index 0000000..b87a048 --- /dev/null +++ b/sql/updates/3.0.9_old/1764_world.sql @@ -0,0 +1,9 @@ +-- Infusion of Light +REPLACE INTO `spell_proc_event` VALUES (54149, 0x00, 10, 2097152, 65536, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (53672, 0x00, 10, 2097152, 65536, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- Illumination +REPLACE INTO `spell_proc_event` VALUES (20210, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (20212, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (20213, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (20214, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (20215, 0x00, 10, 3221225472, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1766_world.sql b/sql/updates/3.0.9_old/1766_world.sql new file mode 100644 index 0000000..6ed4846 --- /dev/null +++ b/sql/updates/3.0.9_old/1766_world.sql @@ -0,0 +1,2 @@ +REPLACE INTO `spell_proc_event` VALUES (33182, 0x00, 6, 32, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (33174, 0x00, 6, 32, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1791_mangos_7422_01_world_trinity_string.sql b/sql/updates/3.0.9_old/1791_mangos_7422_01_world_trinity_string.sql new file mode 100644 index 0000000..5ac7aa3 --- /dev/null +++ b/sql/updates/3.0.9_old/1791_mangos_7422_01_world_trinity_string.sql @@ -0,0 +1,9 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7399_01_mangos_mangos_string required_7422_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (811, 812, 813, 814, 815); +INSERT INTO `trinity_string` VALUES +(811,'Guild Master',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(812,'Officer',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(813,'Veteran',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(814,'Member',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(815,'Initiate',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1814_world.sql b/sql/updates/3.0.9_old/1814_world.sql new file mode 100644 index 0000000..2940f06 --- /dev/null +++ b/sql/updates/3.0.9_old/1814_world.sql @@ -0,0 +1,4 @@ +-- Improved Fire Nova Totem +DELETE FROM `spell_proc_event` WHERE `entry` IN (16086, 16544); +INSERT INTO `spell_proc_event` VALUES (16086, 0x00, 7, 0, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (16544, 0x00, 7, 0, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1825_world.sql b/sql/updates/3.0.9_old/1825_world.sql new file mode 100644 index 0000000..9548a52 --- /dev/null +++ b/sql/updates/3.0.9_old/1825_world.sql @@ -0,0 +1 @@ +INSERT INTO `spell_linked_spell` VALUES (-47953, 60406, 0, 'Divine hymn buff to enemies'); diff --git a/sql/updates/3.0.9_old/1828_world.sql b/sql/updates/3.0.9_old/1828_world.sql new file mode 100644 index 0000000..e984b8e --- /dev/null +++ b/sql/updates/3.0.9_old/1828_world.sql @@ -0,0 +1,3 @@ +INSERT INTO `spell_linked_spell` VALUES (48265, 49772, 2, 'Unholy Presence'); +INSERT INTO `spell_linked_spell` VALUES (49772, 55222, 2, 'Unholy Presence'); +INSERT INTO `spell_linked_spell` VALUES (48263, 61261, 2, 'Frost Presence'); diff --git a/sql/updates/3.0.9_old/1877_mangos_7439_01_world_trinity_string.sql b/sql/updates/3.0.9_old/1877_mangos_7439_01_world_trinity_string.sql new file mode 100644 index 0000000..4b278a4 --- /dev/null +++ b/sql/updates/3.0.9_old/1877_mangos_7439_01_world_trinity_string.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7422_01_mangos_mangos_string required_7439_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (175); +INSERT INTO `trinity_string` VALUES +(175,'Liquid level: %f, ground: %f, type: %d, status: %d',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/1884_world.sql b/sql/updates/3.0.9_old/1884_world.sql new file mode 100644 index 0000000..1376397 --- /dev/null +++ b/sql/updates/3.0.9_old/1884_world.sql @@ -0,0 +1 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (10056, 10057); diff --git a/sql/updates/3.0.9_old/1886_world.sql b/sql/updates/3.0.9_old/1886_world.sql new file mode 100644 index 0000000..d682101 --- /dev/null +++ b/sql/updates/3.0.9_old/1886_world.sql @@ -0,0 +1,6 @@ +INSERT INTO `spell_linked_spell` VALUES (61847, 61848, 2, 'Aspect of te dragonhawk'); +INSERT INTO `spell_linked_spell` VALUES (61846, 61848, 2, 'Aspect of te dragonhawk'); + +-- Glyph of Aspect of the Monkey +REPLACE INTO `spell_proc_event` VALUES (13163, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000010, 0.000000, 0.000000, 0); +REPLACE INTO `spell_proc_event` VALUES (61848, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000010, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1911_world.sql b/sql/updates/3.0.9_old/1911_world.sql new file mode 100644 index 0000000..4a351fc --- /dev/null +++ b/sql/updates/3.0.9_old/1911_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (44545, 44543); +INSERT INTO `spell_proc_event` VALUES +(44545, 0x00, 3, 1049120, 4096, 0x00000000, 0x0010000, 0x00000000, 15.000000, 0.000000, 0), +(44543, 0x00, 3, 1049120, 4096, 0x00000000, 0x0010000, 0x00000000, 7.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1912_world.sql b/sql/updates/3.0.9_old/1912_world.sql new file mode 100644 index 0000000..defcec0 --- /dev/null +++ b/sql/updates/3.0.9_old/1912_world.sql @@ -0,0 +1,5 @@ +-- Improved Fear +DELETE FROM `spell_proc_event` WHERE `entry` IN (53754, 53759); +INSERT INTO `spell_proc_event` VALUES +(53754, 0x00, 5, 0x00000000, 1024, 0x00000000, 0x00000000, 0x0006000, 0.000000, 0.000000, 0), +(53759, 0x00, 5, 0x00000000, 1024, 0x00000000, 0x00000000, 0x0006000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1927_world.sql b/sql/updates/3.0.9_old/1927_world.sql new file mode 100644 index 0000000..8867c6c --- /dev/null +++ b/sql/updates/3.0.9_old/1927_world.sql @@ -0,0 +1,11 @@ +-- Nature's Grace -- +DELETE FROM `spell_proc_event` WHERE `entry` IN (16880, 61345, 61346); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(16880, 0x48, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61345, 0x48, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), +(61346, 0x48, 7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +-- Blade Twisting -- +DELETE FROM `spell_proc_event` WHERE `entry` IN (31124, 31126); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(31124, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31126, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1939_word.sql b/sql/updates/3.0.9_old/1939_word.sql new file mode 100644 index 0000000..dec33f9 --- /dev/null +++ b/sql/updates/3.0.9_old/1939_word.sql @@ -0,0 +1,5 @@ +-- Psychic Horror +DELETE FROM `spell_proc_event` WHERE `entry` IN (47571, 47572); +INSERT INTO `spell_proc_event` VALUES +(47571, 0x00, 6, 65536, 0x00000000, 0x00000000, 0x00010000, 0x0006000, 0.000000, 50.000000, 0), +(47572, 0x00, 6, 65536, 0x00000000, 0x00000000, 0x00010000, 0x0006000, 0.000000, 100.000000, 0); diff --git a/sql/updates/3.0.9_old/1957_word.sql b/sql/updates/3.0.9_old/1957_word.sql new file mode 100644 index 0000000..83f7dcf --- /dev/null +++ b/sql/updates/3.0.9_old/1957_word.sql @@ -0,0 +1,5 @@ +-- Furious Attacks +DELETE FROM `spell_proc_event` WHERE `entry` IN (46910, 46911); +INSERT INTO `spell_proc_event` VALUES +(46910, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000001, 5.5000000, 0.000000, 0), +(46911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000001, 7.5000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/1962_mangos_7472_01_world_trinity_string.sql b/sql/updates/3.0.9_old/1962_mangos_7472_01_world_trinity_string.sql new file mode 100644 index 0000000..811291a --- /dev/null +++ b/sql/updates/3.0.9_old/1962_mangos_7472_01_world_trinity_string.sql @@ -0,0 +1,27 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7439_01_mangos_mangos_string required_7472_01_mangos_mangos_string bit;*/ + +DELETE FROM trinity_string WHERE entry >= 667 and entry <= 687 or entry = 614 or entry = 615; +INSERT INTO trinity_string VALUES +(614,'The Alliance flag is now placed at its base.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(615,'The Horde flag is now placed at its base.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(667,'The Alliance has taken control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(668,'The Horde has taken control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(669,'The Alliance has taken control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(670,'The Horde has taken control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(671,'The Alliance has taken control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(672,'The Horde has taken control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(673,'The Alliance has taken control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(674,'The Horde has taken control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(675,'The Alliance has lost control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(676,'The Horde has lost control of the Mage Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(677,'The Alliance has lost control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(678,'The Horde has lost control of the Draenei Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(679,'The Alliance has lost control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(680,'The Horde has lost control of the Blood Elf Tower!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(681,'The Alliance has lost control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(682,'The Horde has lost control of the Fel Reaver Ruins!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(683,'%s has taken the flag!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(684,'The Alliance have captured the flag!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(685,'The Horde have captured the flag!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(686,'The flag has been dropped.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(687,'The flag has been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2013_world.sql b/sql/updates/3.0.9_old/2013_world.sql new file mode 100644 index 0000000..ed89867 --- /dev/null +++ b/sql/updates/3.0.9_old/2013_world.sql @@ -0,0 +1,5 @@ +-- Shattered Barrier +DELETE FROM `spell_proc_event` WHERE `entry` IN (44745, 54787, 58426, 31221, 31222, 31223); +INSERT INTO `spell_proc_event` VALUES +(44745, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00008000, 0x0002000, 0.000000, 0.000000, 0), +(54787, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00008000, 0x0002000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2021_world.sql b/sql/updates/3.0.9_old/2021_world.sql new file mode 100644 index 0000000..ab88db8 --- /dev/null +++ b/sql/updates/3.0.9_old/2021_world.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (30293, 30295, 30296); +INSERT INTO `spell_proc_event` VALUES +-- Soul Leech +(30293, 0x00, 5, 0x00000381, 0x200C0, 0x00000000, 0x0000000, 0x0000000, 0.000000, 0.000000, 0), +(30295, 0x00, 5, 0x00000381, 0x200C0, 0x00000000, 0x0000000, 0x0000000, 0.000000, 0.000000, 0), +(30296, 0x00, 5, 0x00000381, 0x200C0, 0x00000000, 0x0000000, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2025_mangos_7493_01_world_command.sql b/sql/updates/3.0.9_old/2025_mangos_7493_01_world_command.sql new file mode 100644 index 0000000..f3c8db4 --- /dev/null +++ b/sql/updates/3.0.9_old/2025_mangos_7493_01_world_command.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7472_01_mangos_mangos_string required_7493_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('gobject near','gobject phase','gobject setphase'); + +INSERT INTO `command` VALUES +('gobject near',2,'Syntax: .gobject near [#distance]\r\n\r\nOutput gameobjects at distance #distance from player. Output gameobject guids and coordinates sorted by distance from character. If #distance not provided use 10 as default value.'), +('gobject setphase',2,'Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'); diff --git a/sql/updates/3.0.9_old/2025_mangos_7495_01_world_trinity_string.sql b/sql/updates/3.0.9_old/2025_mangos_7495_01_world_trinity_string.sql new file mode 100644 index 0000000..7666951 --- /dev/null +++ b/sql/updates/3.0.9_old/2025_mangos_7495_01_world_trinity_string.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7493_01_mangos_command required_7495_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (276,277,524); +INSERT INTO `trinity_string` VALUES +(276,'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) turned',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(277,'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) moved',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(524,'Selected object:\n|cffffffff|Hgameobject:%d|h[%s]|h|r GUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2031_realmd.sql b/sql/updates/3.0.9_old/2031_realmd.sql new file mode 100644 index 0000000..fb81c0e --- /dev/null +++ b/sql/updates/3.0.9_old/2031_realmd.sql @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS `logs`; +-- create logs table +CREATE TABLE `logs` ( + `time` int(14) NOT NULL, + `realm` int(4) NOT NULL, + `type` int(4) NOT NULL, + `string` text +) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/sql/updates/3.0.9_old/2057_world.sql b/sql/updates/3.0.9_old/2057_world.sql new file mode 100644 index 0000000..e6bfc96 --- /dev/null +++ b/sql/updates/3.0.9_old/2057_world.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (15290, 39373, 33778, 379, 38395, 40972, 22845, 33504, 34299); +INSERT INTO `spell_bonus_data` VALUES +(15290, 0, 0, 0, 'Vampiric Embrace'), +(39373, 0, 0, 0, 'Shadowmend'), +(33778, 0, 0, 0, 'Lifebloom'), +(379, 0, 0, 0, 'Earth Shield'), +(38395, 0, 0, 0, 'Siphon Essence'), +(40972, 0, 0, 0, 'Heal'), +(22845, 0, 0, 0, 'Frenzied Regeneration'), +(33504, 0, 0, 0, 'Mark of Conquest'), +(34299, 0, 0, 0, 'Improved Leader of the Pack'); diff --git a/sql/updates/3.0.9_old/2064_world.sql b/sql/updates/3.0.9_old/2064_world.sql new file mode 100644 index 0000000..83004c2 --- /dev/null +++ b/sql/updates/3.0.9_old/2064_world.sql @@ -0,0 +1,7 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (7523,7524); +INSERT INTO `trinity_string` VALUES +(7523,'WORLD: Denying connections.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(7524,'WORLD: Accepting connections.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +DELETE FROM `command` WHERE `name` IN ('server set closed'); +INSERT INTO `command` VALUES ('server set closed', 3, 'Syntax: server set closed on/off\r\n\r\nSets whether the world accepts new client connectsions.'); diff --git a/sql/updates/3.0.9_old/2080_mangos_7503_01_world_command.sql b/sql/updates/3.0.9_old/2080_mangos_7503_01_world_command.sql new file mode 100644 index 0000000..fbffcd1 --- /dev/null +++ b/sql/updates/3.0.9_old/2080_mangos_7503_01_world_command.sql @@ -0,0 +1,15 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7495_01_mangos_mangos_string required_7503_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('addmove','allowmove','debug Mod32Value','debug standstate','go creature','go graveyard','go trigger','gobject phase','gobject setphase','Mod32Value','modify arena','modify standstate','npc addmove','npc allowmove','npc textemote','npc phase','npc setphase','showhonor'); +INSERT INTO `command` VALUES +('debug Mod32Value',3,'Syntax: .debug Mod32Value #field #value\r\n\r\nAdd #value to field #field of your character.'), +('go creature',1,'Syntax: .go creature #creature_guid\r\nTeleport your character to creature with guid #creature_guid.\r\n.gocreature #creature_name\r\nTeleport your character to creature with this name.\r\n.gocreature id #creature_id\r\nTeleport your character to a creature that was spawned from the template with this entry.\r\n*If* more than one creature is found, then you are teleported to the first that is found inside the database.'), +('go graveyard',1,'Syntax: .go graveyard #graveyardId\r\n Teleport to graveyard with the graveyardId specified.'), +('go trigger',1,'Syntax: .go trigger #trigger_id\r\n\r\nTeleport your character to areatrigger with id #trigger_id. Character will be teleported to trigger target if selected areatrigger is telporting trigger.'), +('gobject setphase',2,'Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'), +('modify arena',1,'Syntax: .modify arena #value\r\nAdd $amount arena points to the selected player.'), +('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'), +('npc addmove',2,'Syntax: .npc addmove #creature_guid [#waittime]\r\n\r\nAdd your current location as a waypoint for creature with guid #creature_guid. And optional add wait time.'), +('npc allowmove',3,'Syntax: .npc allowmove\r\n\r\nEnable or disable movement creatures in world. Not implemented.'), +('npc setphase',2,'Syntax: .npc setphase #phasemask\r\n\r\nSelected unit or pet phasemask changed to #phasemask with related world vision update for players. In creature case state saved to DB and persistent. In pet case change active until in game phase changed for owner, owner re-login, or GM-mode enable/disable..'), +('npc textemote',1,'Syntax: .npc textemote #emoteid\r\n\r\nMake the selected creature to do textemote with an emote of id #emoteid.'); diff --git a/sql/updates/3.0.9_old/2131_world.sql b/sql/updates/3.0.9_old/2131_world.sql new file mode 100644 index 0000000..60b5617 --- /dev/null +++ b/sql/updates/3.0.9_old/2131_world.sql @@ -0,0 +1,22 @@ +DELETE FROM `command` WHERE `name` IN ('server difftime', 'npc tempadd', 'gobject tempadd', 'gobject addtemp', 'npc addtemp'); +INSERT INTO `command` VALUES +('gobject tempadd','2','Adds a temporary gameobject that is not saved to DB.'), +('npc tempadd','2','Adds temporary NPC, not saved to database.'); +UPDATE `command` SET `name`="ahbotoption" WHERE `name`="ahbotoptions"; +DELETE FROM `command` WHERE `name` IN ('reload tickets'); +DELETE FROM `command` WHERE `name` LIKE "path%"; +DELETE FROM `command` WHERE `name` LIKE "wp%"; +INSERT INTO `command` VALUES +('wp load',2,'Syntax: .wp load $pathid\nLoad pathid number for selected creature. Creature must have no waypoint data.'), +('wp event',2,'Syntax: .wp event $subcommand\nType .path event to see the list of possible subcommands or .help path event $subcommand to see info on subcommands.'), +('wp event add',2,'Syntax: .wp event add $subcommand\nAdd new waypoint action in DB.'), +('wp event mod',2,'Syntax: .wp mod $eventid $parameter $parameter_value\nModify parameter value for specified eventid.\nPossible parameters: pos_x, pos_y, pos_z, command, datalong, datalon2, dataint.'), +('wp event listid',2,'Syntax: .wp event listid $eventid\nShows specified eventid info.'), +('wp unload',2,'Syntax: .wp unload\nUnload path for selected creature.'), +('wp show',2,'Syntax: .wp show $option\nOptions:\non $pathid (or selected creature with loaded path) - Show path\noff - Hide path\ninfo $slected_waypoint - Show info for selected waypoint.'), +('wp mod ',2,'Syntax: .wp mod\nType .path mod to see the list of possible subcommands or .help path mod $subcommand to see info on subcommands.'), +('wp mod del',2,'Syntax: .wp mod del\nDelete selected waypoint.'), +('wp mod move',2,'Syntax: .wp mod move\nChange selected waypoint coordinates to your position.'), +('wp mod move_flag',2,'Syntax: .wp mod move_flag\nSet move/run flag.'), +('wp mod action',2,'Syntax: .wp mod action\nAssign action (waypoint script id) to selected waypoint.'), +('wp mod action_chance',2,'Syntax: .wp mod action_chance\nAssign chance.'); diff --git a/sql/updates/3.0.9_old/2138_world.sql b/sql/updates/3.0.9_old/2138_world.sql new file mode 100644 index 0000000..c95ca63 --- /dev/null +++ b/sql/updates/3.0.9_old/2138_world.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (55198, 34026); +INSERT INTO `spell_proc_event` VALUES +-- Tidial Force +(55198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00004000, 0x00000002, 0.000000, 0.000000, 0), +-- Kill Command +(34026, 0x00, 9, 0x00000000, 0x10000000, 0x00000000, 0x0000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2139_script_waypoint.sql b/sql/updates/3.0.9_old/2139_script_waypoint.sql new file mode 100644 index 0000000..c289df1 --- /dev/null +++ b/sql/updates/3.0.9_old/2139_script_waypoint.sql @@ -0,0 +1,49 @@ +DROP TABLE IF EXISTS script_waypoint; +CREATE TABLE script_waypoint ( + entry mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'creature_template entry', + pointid mediumint(8) unsigned NOT NULL DEFAULT '0', + location_x float NOT NULL DEFAULT '0', + location_y float NOT NULL DEFAULT '0', + location_z float NOT NULL DEFAULT '0', + waittime int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'waittime in millisecs', + point_comment text, + PRIMARY KEY (entry, pointid) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; + +DELETE FROM `script_waypoint` WHERE `entry`=16295; +INSERT INTO `script_waypoint` VALUES +(16295, 0, 7545.070000, -7359.870000, 162.354000, 4000, 'SAY_START'), +(16295, 1, 7550.048340, -7362.237793, 162.235657, 0, ''), +(16295, 2, 7566.976074, -7364.315430, 161.738770, 0, ''), +(16295, 3, 7578.830566, -7361.677734, 161.738770, 0, ''), +(16295, 4, 7590.969238, -7359.053711, 162.257660, 0, ''), +(16295, 5, 7598.354004, -7362.815430, 162.256683, 4000, 'SAY_PROGRESS_1'), +(16295, 6, 7605.861328, -7380.424316, 161.937073, 0, ''), +(16295, 7, 7605.295410, -7387.382813, 157.253998, 0, ''), +(16295, 8, 7606.131836, -7393.893555, 156.941925, 0, ''), +(16295, 9, 7615.207520, -7400.187012, 157.142639, 0, ''), +(16295, 10, 7618.956543, -7402.652832, 158.202042, 0, ''), +(16295, 11, 7636.850586, -7401.756836, 162.144791, 0, 'SAY_PROGRESS_2'), +(16295, 12, 7637.058105, -7404.944824, 162.206970, 4000, ''), +(16295, 13, 7636.910645, -7412.585449, 162.366425, 0, ''), +(16295, 14, 7637.607910, -7425.591797, 162.630661, 0, ''), +(16295, 15, 7637.816895, -7459.057129, 163.302704, 0, ''), +(16295, 16, 7638.859863, -7470.902344, 162.517059, 0, ''), +(16295, 17, 7641.395996, -7488.217285, 157.381287, 0, ''), +(16295, 18, 7634.455566, -7505.451660, 154.682159, 0, 'SAY_PROGRESS_3'), +(16295, 19, 7631.906738, -7516.948730, 153.597382, 0, ''), +(16295, 20, 7622.231445, -7537.037598, 151.587112, 0, ''), +(16295, 21, 7610.921875, -7550.670410, 149.639374, 0, ''), +(16295, 22, 7598.229004, -7562.551758, 145.953888, 0, ''), +(16295, 23, 7588.509277, -7577.755371, 148.294479, 0, ''), +(16295, 24, 7567.339355, -7608.456055, 146.006485, 0, ''), +(16295, 25, 7562.547852, -7617.417969, 148.097504, 0, ''), +(16295, 26, 7561.508789, -7645.064453, 151.245163, 0, ''), +(16295, 27, 7563.337402, -7654.652344, 151.227158, 0, ''), +(16295, 28, 7565.533691, -7658.296387, 151.248886, 0, ''), +(16295, 39, 7571.155762, -7659.118652, 151.244568, 0, ''), +(16295, 30, 7579.119629, -7662.213867, 151.651505, 0, 'quest complete'), +(16295, 31, 7603.768066, -7667.000488, 153.997726, 0, ''), +(16295, 32, 7603.768066, -7667.000488, 153.997726, 4000, 'SAY_END_1'), +(16295, 33, 7603.768066, -7667.000488, 153.997726, 8000, 'SAY_END_2'), +(16295, 34, 7603.768066, -7667.000488, 153.997726, 0, ''); diff --git a/sql/updates/3.0.9_old/2139_world.sql b/sql/updates/3.0.9_old/2139_world.sql new file mode 100644 index 0000000..af536a3 --- /dev/null +++ b/sql/updates/3.0.9_old/2139_world.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_cat_figurine' WHERE `entry`=13873; +UPDATE `creature_template` SET `ScriptName`='npc_garments_of_quests' WHERE `entry` IN (12429,12423,12427,12430,12428); diff --git a/sql/updates/3.0.9_old/2139_world_script.sql b/sql/updates/3.0.9_old/2139_world_script.sql new file mode 100644 index 0000000..c9ef53a --- /dev/null +++ b/sql/updates/3.0.9_old/2139_world_script.sql @@ -0,0 +1,13 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000164 AND -1000174; +INSERT INTO `script_texts` (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000164,'Ah, $GPriest:Priestess; you came along just in time. I appreciate it.',0,0,0,2,'garments SAY_COMMON_HEALED'), +(-1000165,'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those gnolls with your power to back me!',0,0,1,1,'garments SAY_DG_KEL_THANKS'), +(-1000166,'Farewell to you, and may shadow always protect you!',0,0,1,3,'garments SAY_DG_KEL_GOODBYE'), +(-1000167, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those murlocs with the Light on my side!',0,0,7,1,'garments SAY_ROBERTS_THANKS'), +(-1000168, 'Farewell to you, and may the Light be with you always.',0,0,7,3,'garments SAY_ROBERTS_GOODBYE'), +(-1000169, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those humans with your power to back me!',0,0,1,1,'garments SAY_KORJA_THANKS'), +(-1000170, 'Farewell to you, and may our ancestors be with you always!',0,0,1,3,'garments SAY_KORJA_GOODBYE'), +(-1000171, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those wendigo with the Light on my side!',0,0,7,1,'garments SAY_DOLF_THANKS'), +(-1000172, 'Farewell to you, and may the Light be with you always.',0,0,7,3,'garments SAY_DOLF_GOODBYE'), +(-1000173, 'Thank you! Thank you, $GPriest:Priestess;. Now I can take on those corrupt timberlings with Elune\'s power behind me!',0,0,2,1,'garments SAY_SHAYA_THANKS'), +(-1000174, 'Farewell to you, and may Elune be with you always.',0,0,2,3,'garments SAY_SHAYA_GOODBYE'); diff --git a/sql/updates/3.0.9_old/2160_world.sql b/sql/updates/3.0.9_old/2160_world.sql new file mode 100644 index 0000000..e6560fb --- /dev/null +++ b/sql/updates/3.0.9_old/2160_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name` LIKE "ahbotoption %"; +DELETE FROM `command` WHERE `name` LIKE "ahbotoptions %"; +DELETE FROM `command` WHERE `name` IN ('gobject addtemp','npc addtemp'); diff --git a/sql/updates/3.0.9_old/2161_world.sql b/sql/updates/3.0.9_old/2161_world.sql new file mode 100644 index 0000000..a02e1b0 --- /dev/null +++ b/sql/updates/3.0.9_old/2161_world.sql @@ -0,0 +1,2 @@ +DELETE FROM `command` WHERE `name` LIKE "wp mod %"; +DELETE FROM `command` WHERE `name` LIKE "wp event %"; diff --git a/sql/updates/3.0.9_old/2227_mangos_7544_01_world_uptime.sql b/sql/updates/3.0.9_old/2227_mangos_7544_01_world_uptime.sql new file mode 100644 index 0000000..6fb0fe5 --- /dev/null +++ b/sql/updates/3.0.9_old/2227_mangos_7544_01_world_uptime.sql @@ -0,0 +1,3 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7536_01_mangos_spell_chain required_7544_01_mangos_uptime bit;*/ + +DROP TABLE IF EXISTS `uptime`; diff --git a/sql/updates/3.0.9_old/2227_mangos_7546_02_realmd_uptime.sql b/sql/updates/3.0.9_old/2227_mangos_7546_02_realmd_uptime.sql new file mode 100644 index 0000000..1e19b1c --- /dev/null +++ b/sql/updates/3.0.9_old/2227_mangos_7546_02_realmd_uptime.sql @@ -0,0 +1,15 @@ +/*ALTER TABLE realmd_db_version CHANGE COLUMN required_6976_01_realmd_realmd_db_version required_7546_02_realmd_uptime bit;*/ + +-- +-- Table structure for table `uptime` +-- + +DROP TABLE IF EXISTS `uptime`; +CREATE TABLE `uptime` ( + `realmid` int(11) unsigned NOT NULL, + `starttime` bigint(20) unsigned NOT NULL default '0', + `startstring` varchar(64) NOT NULL default '', + `uptime` bigint(20) unsigned NOT NULL default '0', + `maxplayers` smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (`realmid`,`starttime`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system'; diff --git a/sql/updates/3.0.9_old/2254_world.sql b/sql/updates/3.0.9_old/2254_world.sql new file mode 100644 index 0000000..fef5b79 --- /dev/null +++ b/sql/updates/3.0.9_old/2254_world.sql @@ -0,0 +1,13 @@ +DELETE FROM `command` WHERE `name` IN ('server difftime', 'addmove', 'Mod32Value', 'allowmove', 'reload tickets', 'npc tempadd', 'gobject tempadd', 'gobject addtemp', 'npc addtemp'); +INSERT INTO `command` VALUES +('gobject tempadd','2','Adds a temporary gameobject that is not saved to DB.'), +('npc tempadd','2','Adds temporary NPC, not saved to database.'); +UPDATE `command` SET `name`="ahbotoption" WHERE `name`="ahbotoptions"; +DELETE FROM `command` WHERE `name` LIKE "path%"; +DELETE FROM `command` WHERE `name` LIKE "wp%"; +INSERT INTO `command` VALUES +('wp load',2,'Syntax: .wp load $pathid\nLoad pathid number for selected creature. Creature must have no waypoint data.'), +('wp event',2,'Syntax: .wp event $subcommand\nType .path event to see the list of possible subcommands or .help path event $subcommand to see info on subcommands.'), +('wp unload',2,'Syntax: .wp unload\nUnload path for selected creature.'), +('wp show',2,'Syntax: .wp show $option\nOptions:\non $pathid (or selected creature with loaded path) - Show path\noff - Hide path\ninfo $slected_waypoint - Show info for selected waypoint.'), +('wp mod',2,'Syntax: .wp mod\nType .path mod to see the list of possible subcommands or .help path mod $subcommand to see info on subcommands.'); diff --git a/sql/updates/3.0.9_old/2274_mangos_7558_01_world_trinity_string.sql b/sql/updates/3.0.9_old/2274_mangos_7558_01_world_trinity_string.sql new file mode 100644 index 0000000..ea2bbb3 --- /dev/null +++ b/sql/updates/3.0.9_old/2274_mangos_7558_01_world_trinity_string.sql @@ -0,0 +1,9 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7544_01_mangos_uptime required_7558_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (1123,1124,1125,1126,1127); +INSERT INTO `trinity_string` VALUES +(1123,'Not pet found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1124,'Wrong pet type',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1125,'Your pet learned all talents',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1126,'Your pet talents have been reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1127,'Talents of %s\'s pet reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2274_mangos_7558_02_world_command.sql b/sql/updates/3.0.9_old/2274_mangos_7558_02_world_command.sql new file mode 100644 index 0000000..91665d8 --- /dev/null +++ b/sql/updates/3.0.9_old/2274_mangos_7558_02_world_command.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7558_01_mangos_mangos_string required_7558_02_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('learn all_mypettalents'); +INSERT INTO `command` VALUES +('learn all_mypettalents',3,'Syntax: .learn all_mypettalents\r\n\r\nLearn all talents for your pet available for his creature type (only for hunter pets).'); diff --git a/sql/updates/3.0.9_old/2276_mangos_7560_01_world_gameobject_template.sql b/sql/updates/3.0.9_old/2276_mangos_7560_01_world_gameobject_template.sql new file mode 100644 index 0000000..f4fff3e --- /dev/null +++ b/sql/updates/3.0.9_old/2276_mangos_7560_01_world_gameobject_template.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7558_02_mangos_command required_7560_01_mangos_gameobject_template bit;*/ + +ALTER TABLE gameobject_template + ADD COLUMN IconName varchar(100) NOT NULL default '' AFTER name; diff --git a/sql/updates/3.0.9_old/2280_mangos_7565_01_world_trinity_string.sql b/sql/updates/3.0.9_old/2280_mangos_7565_01_world_trinity_string.sql new file mode 100644 index 0000000..8eb55d1 --- /dev/null +++ b/sql/updates/3.0.9_old/2280_mangos_7565_01_world_trinity_string.sql @@ -0,0 +1,9 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7560_01_mangos_gameobject_template required_7565_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (1010,1011,1012,1013,1014); +INSERT INTO `trinity_string` VALUES +(1010,'| Account | Character | IP | GM | Expansion |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1011,'| | %20s | || |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1012,'===========================================================================',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1013,'|%15s| %20s | %15s |%4d| %9d |',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1014,'No online players.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2284_mangos_7568_01_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2284_mangos_7568_01_world_spell_proc_event.sql new file mode 100644 index 0000000..114db52 --- /dev/null +++ b/sql/updates/3.0.9_old/2284_mangos_7568_01_world_spell_proc_event.sql @@ -0,0 +1,49 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7565_01_mangos_mangos_string required_7568_01_mangos_spell_proc_event bit;*/ + +-- (53569) Infusion of Light (Rank 1) +DELETE FROM `spell_proc_event` WHERE `entry` IN (53569); +INSERT INTO `spell_proc_event` VALUES (53569, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (53576) Infusion of Light (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (53576); +INSERT INTO `spell_proc_event` VALUES (53576, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (54149) Infusion of Light (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (54149); +INSERT INTO `spell_proc_event` VALUES (54149, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (55776) Swordguard Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55776); +INSERT INTO `spell_proc_event` VALUES (55776, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (55768) Darkglow Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55768); +INSERT INTO `spell_proc_event` VALUES (55768, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (55640) Lightweave Embroidery () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55640); +INSERT INTO `spell_proc_event` VALUES (55640, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (55380) Skyflare Swiftness () +DELETE FROM `spell_proc_event` WHERE `entry` IN (55380); +INSERT INTO `spell_proc_event` VALUES (55380, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45); + +-- (56355) Titanium Shield Spike () +DELETE FROM `spell_proc_event` WHERE `entry` IN (56355); +INSERT INTO `spell_proc_event` VALUES (56355, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0.000000, 0.000000, 0); + +-- (61345) Natures Grace () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61345); +INSERT INTO `spell_proc_event` VALUES (61345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (61346) Natures Grace () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61346); +INSERT INTO `spell_proc_event` VALUES (61346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (61356) Invigorating Earthsiege Diamond Passive () +DELETE FROM `spell_proc_event` WHERE `entry` IN (61356); +INSERT INTO `spell_proc_event` VALUES (61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); + +-- (24905) Moonkin Form (Passive) (Passive) +DELETE FROM `spell_proc_event` WHERE `entry` IN (24905); +INSERT INTO `spell_proc_event` VALUES (24905, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 15.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2296_world.sql b/sql/updates/3.0.9_old/2296_world.sql new file mode 100644 index 0000000..4e266e4 --- /dev/null +++ b/sql/updates/3.0.9_old/2296_world.sql @@ -0,0 +1,2 @@ +ALTER TABLE creature_template + ADD COLUMN `VehicleId` mediumint(8) unsigned NOT NULL default '0' AFTER `PetSpellDataId`; diff --git a/sql/updates/3.0.9_old/2339_world.sql b/sql/updates/3.0.9_old/2339_world.sql new file mode 100644 index 0000000..106de73 --- /dev/null +++ b/sql/updates/3.0.9_old/2339_world.sql @@ -0,0 +1,16 @@ +DELETE FROM `command` WHERE `name` LIKE "ahbotoption %"; +INSERT INTO `command`(`name`,`security`,`help`) VALUES +('ahbotoption ahexpire', '3', '.Syntax: .ahbotoption ahexpire $ahMapID Expire all auctions started by AHbot.'), +('ahbotoption minitems', '3', '.Syntax: .ahbotoption minitems $ahMapID $parameter Set minimum number of items to be sold in the auctionhouse. If value is 0 then minitems=maxitems. If minitems>maxitems then it will be set equal to maxitems.'), +('ahbotoption maxitems', '3', '.Syntax: .ahbotoption maxitems $ahMapID $parameter Set maximum number of items to be sold in the auctionhouse.'), +('ahbotoption mintime', '3', '.Syntax: .ahbotoption mintime $ahMapID $parameter Set minimum number of hours for the items\' auction.'), +('ahbotoption maxtime', '3', '.Syntax: .ahbotoption maxtime $ahMapID $parameter Set maximum number of hours for the items\' auction.'), +('ahbotoption percentages', '3', '.Syntax: .ahbotoption percentages $ahMapID $greytrade $whitetrade $greentrade $bluetrade $purpletrade $orangetrade $yellowtrade $greyitem $whiteitem $greenitem $blueitem $purpleitem $orangeitem $yellowitem Set percentages for item types to be sold. Percentages must add up to 100, no higher. If percentage is set to 0 then item type will be disabled.'), +('ahbotoption minprice', '3', '.Syntax: .ahbotoption minprice $ahMapID $color $price Set rate for minimum selling price for item. 1=100%, 1.5=150%...'), +('ahbotoption maxprice', '3', '.Syntax: .ahbotoption maxprice $ahMapID $color $price Set rate for maximum selling price for item. 1=100%, 1.5=150%...'), +('ahbotoption minbidprice', '3', '.Syntax: .ahbotoption minbidprice $ahMapID $color $price Set minimum possible bid made considering buyoutprice. 30=30% of buyout price, 40%=40%...'), +('ahbotoption maxbidprice', '3', '.Syntax: .ahbotoption maxbidprice $ahMapID $color $price Set maximum possible bid made considering buyoutprice. 70=70% of buyout price, 80%=80%...'), +('ahbotoption maxstack', '3', '.Syntax: .ahbotoption maxstack $ahMapID $color $value Set maximum stacks for single item in auction. if set to 0 then item_template.stackable value will be considered $color: grey, white, green, blue, purple, orange, yellow.'), +('ahbotoption buyerprice', '3', '.Syntax: .ahbotoption buyerprice $ahMapID $color $value Set rate for which Ahbot will be allowed to buy an item. 1=item_template.sellprice, 2=2*item_template.sellprice... $color: grey, white, green, blue, purple, orange, yellow.'), +('ahbotoption bidinterval', '3', '.Syntax: .ahbotoption bidinterval $ahMapID $parameter Set number of minutes between bids'), +('ahbotoption bidsperinterval', '3', '.Syntax: .ahbotoption bidsperinterval $ahMapID $parameter Set number of bids to be made per cycle.'); diff --git a/sql/updates/3.0.9_old/2343_world.sql b/sql/updates/3.0.9_old/2343_world.sql new file mode 100644 index 0000000..4b2b5e6 --- /dev/null +++ b/sql/updates/3.0.9_old/2343_world.sql @@ -0,0 +1,17 @@ +DELETE FROM `command` WHERE `name` LIKE "ahbotoption %"; +DELETE FROM `command` WHERE `name` LIKE "ahbotoptions %"; +INSERT INTO `command`(`name`,`security`,`help`) VALUES +('ahbotoptions ahexpire', '3', '.Syntax: .ahbotoptions ahexpire $ahMapID Expire all auctions started by AHbot.'), +('ahbotoptions minitems', '3', '.Syntax: .ahbotoptions minitems $ahMapID $parameter Set minimum number of items to be sold in the auctionhouse. If value is 0 then minitems=maxitems. If minitems>maxitems then it will be set equal to maxitems.'), +('ahbotoptions maxitems', '3', '.Syntax: .ahbotoptions maxitems $ahMapID $parameter Set maximum number of items to be sold in the auctionhouse.'), +('ahbotoptions mintime', '3', '.Syntax: .ahbotoptions mintime $ahMapID $parameter Set minimum number of hours for the items\' auction.'), +('ahbotoptions maxtime', '3', '.Syntax: .ahbotoptions maxtime $ahMapID $parameter Set maximum number of hours for the items\' auction.'), +('ahbotoptions percentages', '3', '.Syntax: .ahbotoptions percentages $ahMapID $greytrade $whitetrade $greentrade $bluetrade $purpletrade $orangetrade $yellowtrade $greyitem $whiteitem $greenitem $blueitem $purpleitem $orangeitem $yellowitem Set percentages for item types to be sold. Percentages must add up to 100, no higher. If percentage is set to 0 then item type will be disabled.'), +('ahbotoptions minprice', '3', '.Syntax: .ahbotoptions minprice $ahMapID $color $price Set rate for minimum selling price for item. 1=100%, 1.5=150%...'), +('ahbotoptions maxprice', '3', '.Syntax: .ahbotoptions maxprice $ahMapID $color $price Set rate for maximum selling price for item. 1=100%, 1.5=150%...'), +('ahbotoptions minbidprice', '3', '.Syntax: .ahbotoptions minbidprice $ahMapID $color $price Set minimum possible bid made considering buyoutprice. 30=30% of buyout price, 40%=40%...'), +('ahbotoptions maxbidprice', '3', '.Syntax: .ahbotoptions maxbidprice $ahMapID $color $price Set maximum possible bid made considering buyoutprice. 70=70% of buyout price, 80%=80%...'), +('ahbotoptions maxstack', '3', '.Syntax: .ahbotoptions maxstack $ahMapID $color $value Set maximum stacks for single item in auction. if set to 0 then item_template.stackable value will be considered $color: grey, white, green, blue, purple, orange, yellow.'), +('ahbotoptions buyerprice', '3', '.Syntax: .ahbotoptions buyerprice $ahMapID $color $value Set rate for which Ahbot will be allowed to buy an item. 1=item_template.sellprice, 2=2*item_template.sellprice... $color: grey, white, green, blue, purple, orange, yellow.'), +('ahbotoptions bidinterval', '3', '.Syntax: .ahbotoptions bidinterval $ahMapID $parameter Set number of minutes between bids'), +('ahbotoptions bidsperinterval', '3', '.Syntax: .ahbotoptions bidsperinterval $ahMapID $parameter Set number of bids to be made per cycle.'); diff --git a/sql/updates/3.0.9_old/2346_world.sql b/sql/updates/3.0.9_old/2346_world.sql new file mode 100644 index 0000000..f3cb07b --- /dev/null +++ b/sql/updates/3.0.9_old/2346_world.sql @@ -0,0 +1,2 @@ +DELETE FROM `command` WHERE `name` LIKE "ahbotoption %"; +DELETE FROM `command` WHERE `name` LIKE "ahbotoptions %"; diff --git a/sql/updates/3.0.9_old/2412_characters.sql b/sql/updates/3.0.9_old/2412_characters.sql new file mode 100644 index 0000000..e93a2c7 --- /dev/null +++ b/sql/updates/3.0.9_old/2412_characters.sql @@ -0,0 +1,10 @@ +DELETE FROM `character_aura` WHERE 'effect_index'>'1'; + ALTER TABLE `character_aura` CHANGE `effect_index` `effect_mask` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0'; + ALTER TABLE `character_aura` CHANGE `amount` `amount0` INT( 11 ) NOT NULL DEFAULT '0'; + ALTER TABLE `character_aura` ADD `amount1` INT( 11 ) NOT NULL DEFAULT '0' AFTER `amount0`; + ALTER TABLE `character_aura` ADD `amount2` INT( 11 ) NOT NULL DEFAULT '0' AFTER `amount1`; +DELETE FROM `pet_aura` WHERE 'effect_index'>'1'; + ALTER TABLE `pet_aura` CHANGE `effect_index` `effect_mask` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0'; + ALTER TABLE `pet_aura` CHANGE `amount` `amount0` INT( 11 ) NOT NULL DEFAULT '0'; + ALTER TABLE `pet_aura` ADD `amount1` INT( 11 ) NOT NULL DEFAULT '0' AFTER `amount0`; + ALTER TABLE `pet_aura` ADD `amount2` INT( 11 ) NOT NULL DEFAULT '0' AFTER `amount1`; diff --git a/sql/updates/3.0.9_old/2412_world.sql b/sql/updates/3.0.9_old/2412_world.sql new file mode 100644 index 0000000..7200a24 --- /dev/null +++ b/sql/updates/3.0.9_old/2412_world.sql @@ -0,0 +1,2 @@ +UPDATE `trinity_string` SET `content_default` = 'id: %d effmask: %d charges: %d stack: %d slot %d duration: %d maxduration: %d' WHERE `entry` =468; +UPDATE `trinity_string` SET `content_default` = 'id: %d eff: %d amount: %d' WHERE `trinity_string`.`entry` =470; diff --git a/sql/updates/3.0.9_old/2432_mangos_7615_01_world_command.sql b/sql/updates/3.0.9_old/2432_mangos_7615_01_world_command.sql new file mode 100644 index 0000000..b834d9b --- /dev/null +++ b/sql/updates/3.0.9_old/2432_mangos_7615_01_world_command.sql @@ -0,0 +1,8 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7568_01_mangos_spell_proc_event required_7615_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('senditems','sendmail','sendmoney','sendmessage','send items','send mail','send money','send message'); +INSERT INTO `command` VALUES +('send items',3,'Syntax: .send items #playername "#subject" "#text" itemid1[:count1] itemid2[:count2] ... itemidN[:countN]\r\n\r\nSend a mail to a player. Subject and mail text must be in "". If for itemid not provided related count values then expected 1, if count > max items in stack then items will be send in required amount stacks. All stacks amount in mail limited to 12.'), +('send mail',1,'Syntax: .send mail #playername "#subject" "#text"\r\n\r\nSend a mail to a player. Subject and mail text must be in "".'), +('send message',3,'Syntax: .send message $playername $message\r\n\r\nSend screen message to player from ADMINISTRATOR.'), +('send money','3','Syntax: .send money #playername "#subject" "#text" #money\r\n\r\nSend mail with money to a player. Subject and mail text must be in "".'); diff --git a/sql/updates/3.0.9_old/2433_mangos_7616_01_world_trinity_string.sql b/sql/updates/3.0.9_old/2433_mangos_7616_01_world_trinity_string.sql new file mode 100644 index 0000000..4450a6a --- /dev/null +++ b/sql/updates/3.0.9_old/2433_mangos_7616_01_world_trinity_string.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7615_01_mangos_command required_7616_01_mangos_mangos_string bit;*/ + +DELETE FROM `trinity_string` WHERE `entry` IN (1200,1201); +INSERT INTO `trinity_string` VALUES +(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2433_mangos_7616_02_world_command.sql b/sql/updates/3.0.9_old/2433_mangos_7616_02_world_command.sql new file mode 100644 index 0000000..ec2e06f --- /dev/null +++ b/sql/updates/3.0.9_old/2433_mangos_7616_02_world_command.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7616_01_mangos_mangos_string required_7616_02_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('debug playsound','debug play sound','debug play cinematic','debug play movie'); +INSERT INTO `command` VALUES +('debug play cinematic',1,'Syntax: .debug play cinematic #cinematicid\r\n\r\nPlay cinematic #cinematicid for you. You stay at place while your mind fly.\r\n'), +('debug play movie',1,'Syntax: .debug play movie #movieid\r\n\r\nPlay movie #movieid for you.'), +('debug play sound',1,'Syntax: .debug play sound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'); diff --git a/sql/updates/3.0.9_old/2444_world.sql b/sql/updates/3.0.9_old/2444_world.sql new file mode 100644 index 0000000..afacec5 --- /dev/null +++ b/sql/updates/3.0.9_old/2444_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name` IN ('reload spell_linked_spell'); +INSERT INTO `command` VALUES +('reload spell_linked_spell','3','Usage: .reload spell_linked_spell\r\nReloads the spell_linked_spell DB table.'); diff --git a/sql/updates/3.0.9_old/2450_world.sql b/sql/updates/3.0.9_old/2450_world.sql new file mode 100644 index 0000000..f5d90ab --- /dev/null +++ b/sql/updates/3.0.9_old/2450_world.sql @@ -0,0 +1,7 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_jump_a_tron' WHERE `entry`=183146; +UPDATE `gameobject_template` SET `ScriptName`='go_ethereum_prison' WHERE `entry`=184421; +UPDATE `gameobject_template` SET `scriptname`='go_sacred_fire_of_life' WHERE `entry`=175944; +UPDATE `gameobject_template` SET `scriptname`='go_skull_pile' WHERE `entry`=185913; +DELETE FROM `command` WHERE `name` IN ('reload spell_linked_spell'); +INSERT INTO `command` VALUES +('reload spell_linked_spell','3','Usage: .reload spell_linked_spell\r\nReloads the spell_linked_spell DB table.'); diff --git a/sql/updates/3.0.9_old/2479_world.sql b/sql/updates/3.0.9_old/2479_world.sql new file mode 100644 index 0000000..e5f0e2f --- /dev/null +++ b/sql/updates/3.0.9_old/2479_world.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry` = 5007; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES (5007, 'You must be in a raid group to enter this instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.0.9_old/2492_mangos_7622_01_world_creature_ai_scripts.sql b/sql/updates/3.0.9_old/2492_mangos_7622_01_world_creature_ai_scripts.sql new file mode 100644 index 0000000..7fd0ab9 --- /dev/null +++ b/sql/updates/3.0.9_old/2492_mangos_7622_01_world_creature_ai_scripts.sql @@ -0,0 +1,29 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7616_02_mangos_command required_7622_01_mangos_creature_ai_scripts bit;*/ + +DROP TABLE IF EXISTS `creature_ai_scripts`; +CREATE TABLE `creature_ai_scripts` ( + `id` int(11) unsigned NOT NULL COMMENT 'Identifier' AUTO_INCREMENT, + `creature_id` int(11) unsigned NOT NULL default '0' COMMENT 'Creature Template Identifier', + `event_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Event Type', + `event_inverse_phase_mask` int(11) signed NOT NULL default '0' COMMENT 'Mask which phases this event will not trigger in', + `event_chance` int(3) unsigned NOT NULL default '100', + `event_flags` int(3) unsigned NOT NULL default '0', + `event_param1` int(11) signed NOT NULL default '0', + `event_param2` int(11) signed NOT NULL default '0', + `event_param3` int(11) signed NOT NULL default '0', + `event_param4` int(11) signed NOT NULL default '0', + `action1_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', + `action1_param1` int(11) signed NOT NULL default '0', + `action1_param2` int(11) signed NOT NULL default '0', + `action1_param3` int(11) signed NOT NULL default '0', + `action2_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', + `action2_param1` int(11) signed NOT NULL default '0', + `action2_param2` int(11) signed NOT NULL default '0', + `action2_param3` int(11) signed NOT NULL default '0', + `action3_type` tinyint(5) unsigned NOT NULL default '0' COMMENT 'Action Type', + `action3_param1` int(11) signed NOT NULL default '0', + `action3_param2` int(11) signed NOT NULL default '0', + `action3_param3` int(11) signed NOT NULL default '0', + `comment` varchar(255) NOT NULL default '' COMMENT 'Event Comment', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Scripts'; diff --git a/sql/updates/3.0.9_old/2492_mangos_7622_02_world_creature_ai_summons.sql b/sql/updates/3.0.9_old/2492_mangos_7622_02_world_creature_ai_summons.sql new file mode 100644 index 0000000..e82691e --- /dev/null +++ b/sql/updates/3.0.9_old/2492_mangos_7622_02_world_creature_ai_summons.sql @@ -0,0 +1,13 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7622_01_mangos_creature_ai_scripts required_7622_02_mangos_creature_ai_summons bit;*/ + +DROP TABLE IF EXISTS `creature_ai_summons`; +CREATE TABLE `creature_ai_summons` ( + `id` int(11) unsigned NOT NULL COMMENT 'Location Identifier' AUTO_INCREMENT, + `position_x` float NOT NULL default '0', + `position_y` float NOT NULL default '0', + `position_z` float NOT NULL default '0', + `orientation` float NOT NULL default '0', + `spawntimesecs` int(11) unsigned NOT NULL default '120', + `comment` varchar(255) NOT NULL default '' COMMENT 'Summon Comment', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='EventAI Summoning Locations'; diff --git a/sql/updates/3.0.9_old/2492_mangos_7622_03_world_creature_ai_texts.sql b/sql/updates/3.0.9_old/2492_mangos_7622_03_world_creature_ai_texts.sql new file mode 100644 index 0000000..1ff30b0 --- /dev/null +++ b/sql/updates/3.0.9_old/2492_mangos_7622_03_world_creature_ai_texts.sql @@ -0,0 +1,21 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7622_02_mangos_creature_ai_summons required_7622_03_mangos_creature_ai_texts bit;*/ + +DROP TABLE IF EXISTS `creature_ai_texts`; +CREATE TABLE `creature_ai_texts` ( + `entry` mediumint(8) NOT NULL, + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + `sound` mediumint(8) unsigned NOT NULL DEFAULT '0', + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `language` tinyint(3) unsigned NOT NULL DEFAULT '0', + `emote` tinyint(3) unsigned NOT NULL DEFAULT '0', + `comment` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; diff --git a/sql/updates/3.0.9_old/2508_characters.sql b/sql/updates/3.0.9_old/2508_characters.sql new file mode 100644 index 0000000..2ab9c8e --- /dev/null +++ b/sql/updates/3.0.9_old/2508_characters.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `has_logged_in_before`; diff --git a/sql/updates/3.0.9_old/2515_world_scripts.sql b/sql/updates/3.0.9_old/2515_world_scripts.sql new file mode 100644 index 0000000..9b2c26e --- /dev/null +++ b/sql/updates/3.0.9_old/2515_world_scripts.sql @@ -0,0 +1,22 @@ +UPDATE `creature_template` SET `ScriptName`='mob_giant_infernal' WHERE `entry`=17908; +UPDATE `creature_template` SET `ScriptName`='mob_abomination' WHERE `entry`=17898; +UPDATE `creature_template` SET `ScriptName`='mob_ghoul' WHERE `entry`=17895; +UPDATE `creature_template` SET `ScriptName`='mob_necromancer' WHERE `entry`=17899; +UPDATE `creature_template` SET `ScriptName`='mob_banshee' WHERE `entry`=17905; +UPDATE `creature_template` SET `ScriptName`='mob_crypt_fiend' WHERE `entry`=17897; +UPDATE `creature_template` SET `ScriptName`='mob_fel_stalker' WHERE `entry`=17916; +UPDATE `creature_template` SET `ScriptName`='mob_frost_wyrm' WHERE `entry`=17907; +UPDATE `creature_template` SET `ScriptName`='mob_gargoyle' WHERE `entry`=17906; +UPDATE `creature_template` SET `ScriptName`='alliance_rifleman' WHERE `entry`=17921; +UPDATE `creature_template` SET `ScriptName`='mob_towering_infernal' WHERE `entry`=17818; +UPDATE `creature_template` SET `ScriptName`='boss_anetheron' WHERE `entry`=17808; +UPDATE `creature_template` SET `ScriptName`='boss_azgalor' WHERE `entry`=17842; +UPDATE `creature_template` SET `ScriptName`='mob_lesser_doomguard' WHERE `entry`=17864; +UPDATE `creature_template` SET `ScriptName`='boss_kazrogal' WHERE `entry`=17888; +UPDATE `creature_template` SET `ScriptName`='boss_rage_winterchill' WHERE `entry`=17767; +UPDATE `creature_template` SET `scale`='0.5' WHERE `entry`=17968; +UPDATE `creature_template` SET `equipment_id`='17888' WHERE `entry`=17888; +UPDATE `creature_template` SET `equipment_id`='17921' WHERE `entry`=17921; +/*DELETE FROM creature_equip_template WHERE `entry` IN (17888, 17921); +INSERT INTO creature_equip_template () VALUES (17888, 45776, 0, 0, 33490946, 0, 0, 0, 0, 0); +INSERT INTO creature_equip_template () VALUES (17921, 20732, 0, 20732, 33489666, 0, 33489666, 26, 0, 26);*/ diff --git a/sql/updates/3.0.9_old/2522_mangos_7627_01_world_achievement_criteria_data.sql b/sql/updates/3.0.9_old/2522_mangos_7627_01_world_achievement_criteria_data.sql new file mode 100644 index 0000000..e7701bf --- /dev/null +++ b/sql/updates/3.0.9_old/2522_mangos_7627_01_world_achievement_criteria_data.sql @@ -0,0 +1,10 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7622_03_mangos_creature_ai_texts required_7627_01_mangos_achievement_criteria_data bit;*/ + +DROP TABLE IF EXISTS `achievement_criteria_data`; +CREATE TABLE `achievement_criteria_data` ( + `criteria_id` mediumint(8) NOT NULL, + `type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `value1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `value2` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`criteria_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Achievment system'; diff --git a/sql/updates/3.0.9_old/2528_mangos_7633_01_world_achievement_criteria_data.sql b/sql/updates/3.0.9_old/2528_mangos_7633_01_world_achievement_criteria_data.sql new file mode 100644 index 0000000..3f59608 --- /dev/null +++ b/sql/updates/3.0.9_old/2528_mangos_7633_01_world_achievement_criteria_data.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7627_01_mangos_achievement_criteria_data required_7633_01_mangos_achievement_criteria_data bit;*/ + +ALTER TABLE `achievement_criteria_data` + DROP PRIMARY KEY, + ADD PRIMARY KEY (`criteria_id`,`type`); diff --git a/sql/updates/3.0.9_old/2551_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/2551_world_spell_bonus_data.sql new file mode 100644 index 0000000..ef40ff9 --- /dev/null +++ b/sql/updates/3.0.9_old/2551_world_spell_bonus_data.sql @@ -0,0 +1,4 @@ +-- Judgement +DELETE FROM `spell_bonus_data` WHERE `entry` = 54158; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`comments`) VALUES +('54158','0.25','0','0.16','Paladin - Unleashing spell for Seal of Wisdom, Justice and Light'); diff --git a/sql/updates/3.0.9_old/2559_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2559_world_spell_proc_event.sql new file mode 100644 index 0000000..245f6db --- /dev/null +++ b/sql/updates/3.0.9_old/2559_world_spell_proc_event.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (44544); +-- Fingers of frost triggered spell +INSERT INTO `spell_proc_event` VALUES (44544, 0x00, 0x00000003, 0x00000000, 0x00100000, 0x00000000, 0x00010000, 0x00000000, 0.000000, 0.000000, 0); + +-- Sudden Death +DELETE FROM `spell_proc_event` WHERE `entry` IN (29723, 29725, 29724); +INSERT INTO `spell_proc_event` VALUES (29723, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (29725, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); +INSERT INTO `spell_proc_event` VALUES (29724, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2565_world_SD2_scripts.sql b/sql/updates/3.0.9_old/2565_world_SD2_scripts.sql new file mode 100644 index 0000000..b827a6b --- /dev/null +++ b/sql/updates/3.0.9_old/2565_world_SD2_scripts.sql @@ -0,0 +1,343 @@ +DROP TABLE IF EXISTS script_waypoint; +CREATE TABLE script_waypoint ( + entry mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'creature_template entry', + pointid mediumint(8) unsigned NOT NULL DEFAULT '0', + location_x float NOT NULL DEFAULT '0', + location_y float NOT NULL DEFAULT '0', + location_z float NOT NULL DEFAULT '0', + waittime int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'waittime in millisecs', + point_comment text, + PRIMARY KEY (entry, pointid) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; + +-- script waypoint +DELETE FROM script_waypoint WHERE entry=467; +INSERT INTO script_waypoint VALUES +(467, 0, -10508.40, 1068.00, 55.21, 0, ''), +(467, 1, -10518.30, 1074.84, 53.96, 0, ''), +(467, 2, -10534.82, 1081.92, 49.88, 0, ''), +(467, 3, -10546.51, 1084.88, 50.13, 0, ''), +(467, 4, -10555.29, 1084.45, 45.75, 0, ''), +(467, 5, -10566.57, 1083.53, 42.10, 0, ''), +(467, 6, -10575.83, 1082.34, 39.46, 0, ''), +(467, 7, -10585.67, 1081.08, 37.77, 0, ''), +(467, 8, -10600.08, 1078.19, 36.23, 0, ''), +(467, 9, -10608.69, 1076.08, 35.88, 0, ''), +(467, 10, -10621.26, 1073.00, 35.40, 0, ''), +(467, 11, -10638.12, 1060.18, 33.61, 0, ''), +(467, 12, -10655.87, 1038.99, 33.48, 0, ''), +(467, 13, -10664.68, 1030.54, 32.70, 0, ''), +(467, 14, -10708.68, 1033.86, 33.32, 0, ''), +(467, 15, -10754.43, 1017.93, 32.79, 0, ''), +(467, 16, -10802.26, 1018.01, 32.16, 0, ''), +(467, 17, -10832.60, 1009.04, 32.71, 0, ''), +(467, 18, -10866.56, 1006.51, 31.71, 0, ''), +(467, 19, -10879.98, 1005.10, 32.84, 0, ''), +(467, 20, -10892.45, 1001.32, 34.46, 0, ''), +(467, 21, -10906.14, 997.11, 36.15, 0, ''), +(467, 22, -10922.26, 1002.23, 35.74, 0, ''), +(467, 23, -10936.32, 1023.38, 36.52, 0, ''), +(467, 24, -10933.35, 1052.61, 35.85, 0, ''), +(467, 25, -10940.25, 1077.66, 36.49, 0, ''), +(467, 26, -10957.09, 1099.33, 36.83, 0, ''), +(467, 27, -10956.53, 1119.90, 36.73, 0, ''), +(467, 28, -10939.30, 1150.75, 37.42, 0, ''), +(467, 29, -10915.14, 1202.09, 36.55, 0, ''), +(467, 30, -10892.59, 1257.03, 33.37, 0, ''), +(467, 31, -10891.93, 1306.66, 35.45, 0, ''), +(467, 32, -10896.17, 1327.86, 37.77, 0, ''), +(467, 33, -10906.03, 1368.05, 40.91, 0, ''), +(467, 34, -10910.18, 1389.33, 42.62, 0, ''), +(467, 35, -10915.42, 1417.72, 42.93, 0, ''), +(467, 36, -10926.37, 1421.18, 43.04, 0, 'walk here and say'), +(467, 37, -10952.31, 1421.74, 43.40, 0, ''), +(467, 38, -10980.04, 1411.38, 42.79, 0, ''), +(467, 39, -11006.06, 1420.47, 43.26, 0, ''), +(467, 40, -11021.98, 1450.59, 43.09, 0, ''), +(467, 41, -11025.36, 1491.59, 43.15, 0, ''), +(467, 42, -11036.09, 1508.32, 43.28, 0, ''), +(467, 43, -11060.68, 1526.72, 43.19, 0, ''), +(467, 44, -11072.75, 1527.77, 43.20, 5000, 'say and quest credit'); + +DELETE FROM script_waypoint WHERE entry=2768; +INSERT INTO script_waypoint VALUES +(2768, 0, -2066.45, -2085.96, 9.08, 0, ''), +(2768, 1, -2077.99, -2105.33, 13.24, 0, ''), +(2768, 2, -2074.60, -2109.67, 14.24, 0, ''), +(2768, 3, -2076.60, -2117.46, 16.67, 0, ''), +(2768, 4, -2073.51, -2123.46, 18.42, 2000, ''), +(2768, 5, -2073.51, -2123.46, 18.42, 4000, ''), +(2768, 6, -2066.60, -2131.85, 21.56, 0, ''), +(2768, 7, -2053.85, -2143.19, 20.31, 0, ''), +(2768, 8, -2043.49, -2153.73, 20.20, 10000, ''), +(2768, 9, -2043.49, -2153.73, 20.20, 20000, ''), +(2768, 10, -2043.49, -2153.73, 20.20, 10000, ''), +(2768, 11, -2043.49, -2153.73, 20.20, 2000, ''), +(2768, 12, -2053.85, -2143.19, 20.31, 0, ''), +(2768, 13, -2066.60, -2131.85, 21.56, 0, ''), +(2768, 14, -2073.51, -2123.46, 18.42, 0, ''), +(2768, 15, -2076.60, -2117.46, 16.67, 0, ''), +(2768, 16, -2074.60, -2109.67, 14.24, 0, ''), +(2768, 17, -2077.99, -2105.33, 13.24, 0, ''), +(2768, 18, -2066.45, -2085.96, 9.08, 0, ''), +(2768, 19, -2066.41, -2086.21, 8.97, 6000, ''), +(2768, 20, -2066.41, -2086.21, 8.97, 2000, ''); + +DELETE FROM script_waypoint WHERE entry=12818; +INSERT INTO script_waypoint VALUES +(12818, 0, 3347.250089, -694.700989, 159.925995, 0, ''), +(12818, 1, 3341.527039, -694.725891, 161.124542, 4000, ''), +(12818, 2, 3338.351074, -686.088138, 163.444000, 0, ''), +(12818, 3, 3352.744873, -677.721741, 162.316269, 0, ''), +(12818, 4, 3370.291016, -669.366943, 160.751358, 0, ''), +(12818, 5, 3381.479492, -659.449097, 162.545303, 0, ''), +(12818, 6, 3389.554199, -648.500000, 163.651825, 0, ''), +(12818, 7, 3396.645020, -641.508911, 164.216019, 0, ''), +(12818, 8, 3410.498535, -634.299622, 165.773453, 0, ''), +(12818, 9, 3418.461426, -631.791992, 166.477615, 0, ''), +(12818, 10, 3429.500000, -631.588745, 166.921265, 0, ''), +(12818, 11,3434.950195, -629.245483, 168.333969, 0, ''), +(12818, 12,3438.927979, -618.503235, 171.503143, 0, ''), +(12818, 13,3444.217529, -609.293640, 173.077972, 1000, 'Ambush 1'), +(12818, 14,3460.505127, -593.794189, 174.342255, 0, ''), +(12818, 15,3480.283203, -578.210327, 176.652313, 0, ''), +(12818, 16,3492.912842, -562.335449, 181.396301, 0, ''), +(12818, 17,3495.230957, -550.977600, 184.652267, 0, ''), +(12818, 18,3496.247070, -529.194214, 188.172028, 0, ''), +(12818, 19,3497.619385, -510.411499, 188.345322, 1000, 'Ambush 2'), +(12818, 20,3498.498047, -497.787506, 185.806274, 0, ''), +(12818, 21,3484.218750, -489.717529, 182.389862, 4000, ''); + +DELETE FROM script_waypoint WHERE entry=12858; +INSERT INTO script_waypoint VALUES +(12858, 0, 1782.63, -2241.11, 109.73, 5000, ''), +(12858, 1, 1788.88, -2240.17, 111.71, 0, ''), +(12858, 2, 1797.49, -2238.11, 112.31, 0, ''), +(12858, 3, 1803.83, -2232.77, 111.22, 0, ''), +(12858, 4, 1806.65, -2217.83, 107.36, 0, ''), +(12858, 5, 1811.81, -2208.01, 107.45, 0, ''), +(12858, 6, 1820.85, -2190.82, 100.49, 0, ''), +(12858, 7, 1829.60, -2177.49, 96.44, 0, ''), +(12858, 8, 1837.98, -2164.19, 96.71, 0, 'prepare'), +(12858, 9, 1839.99, -2149.29, 96.78, 0, ''), +(12858, 10, 1835.14, -2134.98, 96.80, 0, ''), +(12858, 11, 1823.57, -2118.27, 97.43, 0, ''), +(12858, 12, 1814.99, -2110.35, 98.38, 0, ''), +(12858, 13, 1806.60, -2103.09, 99.19, 0, ''), +(12858, 14, 1798.27, -2095.77, 100.04, 0, ''), +(12858, 15, 1783.59, -2079.92, 100.81, 0, ''), +(12858, 16, 1776.79, -2069.48, 101.77, 0, ''), +(12858, 17, 1776.82, -2054.59, 109.82, 0, ''), +(12858, 18, 1776.88, -2047.56, 109.83, 0, ''), +(12858, 19, 1776.86, -2036.55, 109.83, 0, ''), +(12858, 20, 1776.90, -2024.56, 109.83, 0, 'win'), +(12858, 21, 1776.87, -2028.31, 109.83,60000, 'stay'), +(12858, 22, 1776.90, -2028.30, 109.83, 0, ''); + +DELETE FROM script_waypoint WHERE entry=15420; +INSERT INTO script_waypoint VALUES +(15420, 0, 9294.78, -6682.51, 22.42, 0, ''), +(15420, 1, 9298.27, -6667.99, 22.42, 0, ''), +(15420, 2, 9309.63, -6658.84, 22.43, 0, ''), +(15420, 3, 9304.43, -6649.31, 26.46, 0, ''), +(15420, 4, 9298.83, -6648.00, 28.61, 0, ''), +(15420, 5, 9291.06, -6653.46, 31.83,2500, ''), +(15420, 6, 9289.08, -6660.17, 31.85,5000, ''), +(15420, 7, 9291.06, -6653.46, 31.83, 0, ''); + +DELETE FROM script_waypoint WHERE entry=16993; +INSERT INTO script_waypoint VALUES +(16993, 0, -1137.72, 4272.10, 14.04, 5000, ''), +(16993, 1, -1141.34, 4232.42, 14.63, 0, ''), +(16993, 2, -1133.47, 4220.88, 11.78, 0, ''), +(16993, 3, -1126.18, 4213.26, 13.51, 0, ''), +(16993, 4, -1100.12, 4204.32, 16.41, 0, ''), +(16993, 5, -1063.68, 4197.92, 15.51, 0, ''), +(16993, 6, -1027.28, 4194.36, 15.52, 0, ''), +(16993, 7, -995.68, 4189.59, 19.84, 0, ''), +(16993, 8, -970.90, 4188.60, 24.61, 0, ''), +(16993, 9, -961.93, 4193.34, 26.11, 15000, 'Summon 1'), +(16993, 10, -935.52, 4210.99, 31.98, 0, ''), +(16993, 11, -913.42, 4218.27, 37.29, 0, ''), +(16993, 12, -896.53, 4207.73, 43.23, 0, ''), +(16993, 13, -868.49, 4194.77, 46.75, 30000, 'Kneel and Rest Here'), +(16993, 14, -852.83, 4198.29, 47.28, 15000, 'Summon 2'), +(16993, 15, -819.85, 4200.50, 46.37, 0, ''), +(16993, 16, -791.92, 4201.96, 44.19, 0, ''), +(16993, 17, -774.42, 4202.46, 47.41, 0, ''), +(16993, 18, -762.90, 4202.17, 48.81, 0, ''), +(16993, 19, -728.25, 4195.35, 50.68, 0, ''), +(16993, 20, -713.58, 4192.07, 53.98, 0, ''), +(16993, 21, -703.09, 4189.74, 56.96, 0, ''), +(16993, 22, -693.70, 4185.43, 57.06, 0, ''), +(16993, 23, -686.38, 4159.81, 60.26, 0, ''), +(16993, 24, -679.88, 4147.04, 64.20, 0, ''), +(16993, 25, -656.74, 4147.72, 64.11, 0, ''), +(16993, 26, -652.22, 4137.50, 64.58, 0, ''), +(16993, 27, -649.99, 4136.38, 64.63, 30000, 'Quest Credit'); + +DELETE FROM script_waypoint WHERE entry=17312; +INSERT INTO script_waypoint VALUES +(17312, 0, -4784.532227, -11051.060547, 3.484263, 0, ''), +(17312, 1, -4805.509277, -11037.293945, 3.043942, 0, ''), +(17312, 2, -4827.826172, -11034.398438, 1.741959, 0, ''), +(17312, 3, -4852.630859, -11033.695313, 2.208656, 0, ''), +(17312, 4, -4876.791992, -11034.517578, 3.175228, 0, ''), +(17312, 5, -4895.486816, -11038.306641, 9.390890, 0, ''), +(17312, 6, -4915.464844, -11048.402344, 12.369793, 0, ''), +(17312, 7, -4937.288086, -11067.041992, 13.857983, 0, ''), +(17312, 8, -4966.577637, -11067.507813, 15.754786, 0, ''), +(17312, 9, -4993.799805, -11056.544922, 19.175295, 0, ''), +(17312, 10, -5017.836426, -11052.569336, 22.476587, 0, ''), +(17312, 11, -5039.706543, -11058.459961, 25.831593, 0, ''), +(17312, 12, -5057.289063, -11045.474609, 26.972496, 0, ''), +(17312, 13, -5078.828125, -11037.601563, 29.053417, 0, ''), +(17312, 14, -5104.158691, -11039.195313, 29.440195, 0, ''), +(17312, 15, -5120.780273, -11039.518555, 30.142139, 0, ''), +(17312, 16, -5140.833008, -11039.810547, 28.788074, 0, ''), +(17312, 17, -5161.201660, -11040.050781, 27.879545, 4000, ''), +(17312, 18, -5171.842285, -11046.803711, 27.183821, 0, ''), +(17312, 19, -5185.995117, -11056.359375, 20.234867, 0, ''), +(17312, 20, -5198.485840, -11065.065430, 18.872593, 0, ''), +(17312, 21, -5214.062500, -11074.653320, 19.215731, 0, ''), +(17312, 22, -5220.157227, -11088.377930, 19.818476, 0, ''), +(17312, 23, -5233.652832, -11098.846680, 18.349432, 0, ''), +(17312, 24, -5250.163086, -11111.653320, 16.438959, 0, ''), +(17312, 25, -5268.194336, -11125.639648, 12.668313, 0, ''), +(17312, 26, -5286.270508, -11130.669922, 6.912246, 0, ''), +(17312, 27, -5317.449707, -11137.392578, 4.963446, 0, ''), +(17312, 28, -5334.854492, -11154.384766, 6.742664, 0, ''), +(17312, 29, -5353.874512, -11171.595703, 6.903912, 20000, ''), +(17312, 30, -5354.240000, -11171.940000, 6.890000, 0, ''); + +DELETE FROM script_waypoint WHERE entry=19685; +INSERT INTO script_waypoint VALUES +(19685, 0, -1863.369019, 5419.517090, -10.463668, 5000, ''), +(19685, 1, -1861.749023, 5416.465332, -10.508068, 0, ''), +(19685, 2, -1857.036133, 5410.966309, -12.428039, 0, ''), +(19685, 3, -1831.539185, 5365.472168, -12.428039, 0, ''), +(19685, 4, -1813.416504, 5333.776855, -12.428039, 0, ''), +(19685, 5, -1800.354370, 5313.290039, -12.428039, 0, ''), +(19685, 6, -1775.624878, 5268.786133, -38.809181, 0, ''), +(19685, 7, -1770.147339, 5259.268066, -38.829231, 0, ''), +(19685, 8, -1762.814209, 5261.098145, -38.848995, 0, ''), +(19685, 9, -1740.110474, 5268.858398, -40.208965, 0, ''), +(19685, 10, -1725.837402, 5270.936035, -40.208965, 0, ''), +(19685, 11, -1701.580322, 5290.323242, -40.209187, 0, ''), +(19685, 12, -1682.877808, 5291.406738, -34.429646, 0, ''), +(19685, 13, -1670.101685, 5291.201172, -32.786007, 0, ''), +(19685, 14, -1656.666870, 5294.333496, -37.862648, 0, ''), +(19685, 15, -1652.035767, 5295.413086, -40.245499, 0, ''), +(19685, 16, -1620.860596, 5300.133301, -40.208992, 0, ''), +(19685, 17, -1607.630981, 5293.983398, -38.577045, 5000, ''), +(19685, 18, -1607.630981, 5293.983398, -38.577045, 5000, ''), +(19685, 19, -1607.630981, 5293.983398, -38.577045, 5000, ''), +(19685, 20, -1622.140869, 5301.955566, -40.208897, 0, ''), +(19685, 21, -1621.131836, 5333.112793, -40.208897, 0, ''), +(19685, 22, -1637.598999, 5342.134277, -40.208790, 0, ''), +(19685, 23, -1648.521606, 5352.309570, -47.496170, 0, ''), +(19685, 24, -1654.606934, 5357.419434, -45.870892, 0, ''), +(19685, 25, -1633.670044, 5422.067871, -42.835541, 0, ''), +(19685, 26, -1656.567505, 5426.236328, -40.405815, 0, ''), +(19685, 27, -1664.932373, 5425.686523, -38.846405, 0, ''), +(19685, 28, -1681.406006, 5425.871094, -38.810928, 0, ''), +(19685, 29, -1730.875977, 5427.413574, -12.427910, 0, ''), +(19685, 30, -1743.509521, 5369.599121, -12.427910, 0, ''), +(19685, 31, -1877.217041, 5303.710449, -12.427989, 0, ''), +(19685, 32, -1890.371216, 5289.273438, -12.428268, 0, ''), +(19685, 33, -1905.505737, 5266.534668, 2.630672, 0, ''), +(19685, 34, -1909.381348, 5273.008301, 1.663714, 10000, ''), +(19685, 35, -1909.381348, 5273.008301, 1.663714, 12000, ''), +(19685, 36, -1909.381348, 5273.008301, 1.663714, 8000, ''), +(19685, 37, -1909.381348, 5273.008301, 1.663714, 15000, ''), +(19685, 38, -1927.561401, 5275.324707, 1.984987, 0, ''), +(19685, 39, -1927.385498, 5300.879883, -12.427236, 0, ''), +(19685, 40, -1921.063965, 5314.318359, -12.427236, 0, ''), +(19685, 41, -1965.425415, 5379.298828, -12.427236, 0, ''), +(19685, 42, -1981.233154, 5450.743652, -12.427236, 0, ''), +(19685, 43, -1958.022461, 5455.904297, 0.487659, 0, ''), +(19685, 44, -1951.991455, 5463.580566, 0.874490, 10000, ''), +(19685, 45, -1951.991455, 5463.580566, 0.874490, 12000, ''), +(19685, 46, -1968.730225, 5481.752930, -12.427846, 0, ''), +(19685, 47, -1881.839844, 5554.040039, -12.427846, 0, ''), +(19685, 48, -1841.566650, 5545.965332, -12.427846, 0, ''), +(19685, 49, -1837.658325, 5523.780273, 0.558756, 0, ''), +(19685, 50, -1831.321777, 5534.821777, 1.221819, 6000, ''), +(19685, 51, -1831.321777, 5534.821777, 1.221819, 8000, ''), +(19685, 52, -1831.321777, 5534.821777, 1.221819, 5000, ''), +(19685, 53, -1850.060669, 5472.610840, 0.857320, 6000, ''), +(19685, 54, -1850.060669, 5472.610840, 0.857320, 8000, ''), +(19685, 55, -1850.060669, 5472.610840, 0.857320, 9000, ''), +(19685, 56, -1850.060669, 5472.610840, 0.857320, 9000, ''), +(19685, 57, -1850.060669, 5472.610840, 0.857320, 4000, ''); + +DELETE FROM script_waypoint WHERE entry=20129; +INSERT INTO script_waypoint VALUES +(20129, 0, -8374.93,-4250.21, -204.38,5000, ''), +(20129, 1, -8374.93,-4250.21, -204.38,16000, ''), +(20129, 2, -8374.93,-4250.21, -204.38,10000, ''), +(20129, 3, -8374.93,-4250.21, -204.38,2000, ''), +(20129, 4, -8439.40,-4180.05, -209.25, 0, ''), +(20129, 5, -8437.82,-4120.84, -208.59,10000, ''), +(20129, 6, -8437.82,-4120.84, -208.59,16000, ''), +(20129, 7, -8437.82,-4120.84, -208.59,13000, ''), +(20129, 8, -8437.82,-4120.84, -208.59,18000, ''), +(20129, 9, -8437.82,-4120.84, -208.59,15000, ''), +(20129, 10, -8437.82,-4120.84, -208.59,2000, ''), +(20129, 11, -8467.26,-4198.63, -214.21, 0, ''), +(20129, 12, -8667.76,-4252.13, -209.56, 0, ''), +(20129, 13, -8703.71,-4234.58, -209.5,14000, ''), +(20129, 14, -8703.71,-4234.58, -209.5,2000, ''), +(20129, 15, -8642.81,-4304.37, -209.57, 0, ''), +(20129, 16, -8649.06,-4394.36, -208.46,6000, ''), +(20129, 17, -8649.06,-4394.36, -208.46,18000, ''), +(20129, 18, -8649.06,-4394.36, -208.46,2000, ''), +(20129, 19, -8468.72,-4437.67, -215.45, 0, ''), +(20129, 20, -8427.54,-4426, -211.13, 0, ''), +(20129, 21, -8364.83,-4393.32, -205.91, 0, ''), +(20129, 22, -8304.54,-4357.2, -208.2,18000, ''), +(20129, 23, -8304.54,-4357.2, -208.2,2000, ''), +(20129, 24, -8375.42,-4250.41, -205.14,5000, ''), +(20129, 25, -8375.42,-4250.41, -205.14,5000, ''); + +DELETE FROM script_waypoint WHERE entry=6575; +INSERT INTO script_waypoint VALUES +(6575, 0, 1945.81, -431.54, 16.36, 0, ''), +(6575, 1, 1946.21, -436.41, 16.36, 0, ''), +(6575, 2, 1950.01, -444.11, 14.63, 0, ''), +(6575, 3, 1956.08, -449.34, 13.12, 0, ''), +(6575, 4, 1966.59, -450.55, 11.27, 0, ''), +(6575, 5, 1976.09, -447.51, 11.27, 0, ''), +(6575, 6, 1983.42, -435.85, 11.27, 0, ''), +(6575, 7, 1978.17, -428.81, 11.27, 0, ''), +(6575, 8, 1973.97, -422.08, 9.04, 0, ''), +(6575, 9, 1963.84, -418.90, 6.17, 0, ''), +(6575, 10, 1961.22, -422.74, 6.17, 0, ''), +(6575, 11, 1964.80, -431.26, 6.17, 300000, ''); + +DELETE FROM script_waypoint WHERE entry=3849; +INSERT INTO script_waypoint VALUES +(3849, 0, -252.92, 2126.82, 81.17, 0, ''), +(3849, 1, -253.88, 2131.11, 81.21, 0, ''), +(3849, 2, -249.66, 2142.45, 87.01, 0, ''), +(3849, 3, -248.08, 2143.68, 87.01, 0, ''), +(3849, 4, -238.87, 2139.93, 87.01, 0, ''), +(3849, 5, -235.47, 2149.18, 90.59, 0, ''), +(3849, 6, -239.89, 2156.06, 90.62, 20000, 'SAY_FREE'); + +DELETE FROM script_waypoint WHERE entry=3850; +INSERT INTO script_waypoint VALUES +(3850, 0, -255.33, 2117.99, 81.17, 0, ''), +(3850, 1, -253.88, 2131.11, 81.21, 0, ''), +(3850, 2, -249.66, 2142.45, 87.01, 0, ''), +(3850, 3, -248.08, 2143.68, 87.01, 0, ''), +(3850, 4, -238.87, 2139.93, 87.01, 0, ''), +(3850, 5, -235.47, 2149.18, 90.59, 0, ''), +(3850, 6, -239.89, 2156.06, 90.62, 20000, 'SAY_FREE'); + +-- Henry Stern +UPDATE `creature_template` SET `ScriptName`='npc_henry_stern' WHERE `entry`=8696; + +DELETE FROM `trinity_string` WHERE `entry` IN (59); +INSERT INTO `trinity_string` VALUES +(59,'Using creature EventAI: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2570_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/2570_world_spell_linked_spell.sql new file mode 100644 index 0000000..6499d2d --- /dev/null +++ b/sql/updates/3.0.9_old/2570_world_spell_linked_spell.sql @@ -0,0 +1,9 @@ +INSERT IGNORE INTO `spell_linked_spell` VALUES (47988, 54501, 2, 'Consume Shadows - Rank 9'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (47987, 54501, 2, 'Consume Shadows - Rank 8'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (27272, 54501, 2, 'Consume Shadows - Rank 7'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17854, 54501, 2, 'Consume Shadows - Rank 6'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17853, 54501, 2, 'Consume Shadows - Rank 5'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17852, 54501, 2, 'Consume Shadows - Rank 4'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17851, 54501, 2, 'Consume Shadows - Rank 3'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17850, 54501, 2, 'Consume Shadows - Rank 2'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17767, 54501, 2, 'Consume Shadows - Rank 1'); diff --git a/sql/updates/3.0.9_old/2582_mangos_7644_01_characters_character_pet.sql b/sql/updates/3.0.9_old/2582_mangos_7644_01_characters_character_pet.sql new file mode 100644 index 0000000..fe0f8fd --- /dev/null +++ b/sql/updates/3.0.9_old/2582_mangos_7644_01_characters_character_pet.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7546_01_characters_uptime required_7644_01_characters_character_pet bit;*/ + +/* only hunter pets must be in stable */ +UPDATE `character_pet` + SET slot = 100 WHERE PetType <> 1 AND slot >= 1 AND slot <= 4; diff --git a/sql/updates/3.0.9_old/2586_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/2586_world_spell_linked_spell.sql new file mode 100644 index 0000000..489fe7b --- /dev/null +++ b/sql/updates/3.0.9_old/2586_world_spell_linked_spell.sql @@ -0,0 +1,4 @@ +INSERT IGNORE INTO `spell_linked_spell` VALUES (53563, 53651, 2, 'Beacon of Light'); + +INSERT INTO `spell_proc_event` VALUES +(53651, 0x00, 10, 0xC0008000, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2591_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/2591_world_spell_linked_spell.sql new file mode 100644 index 0000000..63da911 --- /dev/null +++ b/sql/updates/3.0.9_old/2591_world_spell_linked_spell.sql @@ -0,0 +1,6 @@ +INSERT IGNORE INTO `spell_linked_spell` VALUES (16857, 60089, 0, 'Faerie Fire (Feral) Rank 1'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17390, 60089, 0, 'Faerie Fire (Feral) Rank 2'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17391, 60089, 0, 'Faerie Fire (Feral) Rank 3'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (17392, 60089, 0, 'Faerie Fire (Feral) Rank 4'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (27011, 60089, 0, 'Faerie Fire (Feral) Rank 5'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (48475, 60089, 0, 'Faerie Fire (Feral) Rank 6'); diff --git a/sql/updates/3.0.9_old/2617_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/2617_world_spell_linked_spell.sql new file mode 100644 index 0000000..b8b40c5 --- /dev/null +++ b/sql/updates/3.0.9_old/2617_world_spell_linked_spell.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (781, 57635, 60932, 61507, 49576); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(781, 56446, 0, 'Disengage'), +(57635, 57636, 0, 'Disengage'), +(60932, 60934, 0, 'Disengage'), +(61507, 61508, 0, 'Disengage'), +(49576, 49560, 0, 'Death Grip'); diff --git a/sql/updates/3.0.9_old/2629_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/2629_world_spell_linked_spell.sql new file mode 100644 index 0000000..be4609b --- /dev/null +++ b/sql/updates/3.0.9_old/2629_world_spell_linked_spell.sql @@ -0,0 +1,2 @@ +INSERT IGNORE INTO `spell_linked_spell` VALUES (47897, 47960, 1, 'Shadowflame Rank 1'); +INSERT IGNORE INTO `spell_linked_spell` VALUES (61290, 61291, 1, 'Shadowflame Rank 2'); diff --git a/sql/updates/3.0.9_old/2678_mangos_7662_01_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/2678_mangos_7662_01_world_spell_bonus_data.sql new file mode 100644 index 0000000..8bdcf09 --- /dev/null +++ b/sql/updates/3.0.9_old/2678_mangos_7662_01_world_spell_bonus_data.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7662_01_mangos_spell_chain required_7662_02_mangos_spell_bonus_data bit;*/ + +DELETE FROM `spell_bonus_data` WHERE entry IN (50288, 50294); +INSERT INTO `spell_bonus_data` VALUES +(50288, 0.05, 0, 0, "Druid - Starfall"), +(50294, 0.012, 0, 0, "Druid - Starfall AOE"); diff --git a/sql/updates/3.0.9_old/2682_world_SD2_scripts.sql b/sql/updates/3.0.9_old/2682_world_SD2_scripts.sql new file mode 100644 index 0000000..b75da0b --- /dev/null +++ b/sql/updates/3.0.9_old/2682_world_SD2_scripts.sql @@ -0,0 +1,46 @@ +DELETE FROM script_waypoint WHERE entry=3849; +INSERT INTO script_waypoint VALUES +(3849, 0, -250.923431, 2116.264160, 81.179, 0, 'SAY_FREE_AD'), +(3849, 1, -255.048538, 2119.392578, 81.179, 0, ''), +(3849, 2, -254.129105, 2123.454346, 81.179, 0, ''), +(3849, 3, -253.897552, 2130.873535, 81.179, 0, ''), +(3849, 4, -249.889435, 2142.307861, 86.972, 0, ''), +(3849, 5, -248.204926, 2144.017090, 87.013, 0, ''), +(3849, 6, -240.552826, 2140.552734, 87.012, 0, ''), +(3849, 7, -237.513916, 2142.066650, 87.012, 0, ''), +(3849, 8, -235.638138, 2149.231689, 90.587, 0, ''), +(3849, 9, -237.188019, 2151.946045, 90.624, 0, ''), +(3849, 10, -241.162064, 2153.649658, 90.624, 0, 'SAY_OPEN_DOOR_AD'), +(3849, 11, -241.129700, 2154.562988, 90.624, 5000, ''), +(3849, 12, -241.129700, 2154.562988, 90.624, 5000, 'SAY_POST1_DOOR_AD'), +(3849, 13, -241.129700, 2154.562988, 90.624, 25000, 'SAY_POST2_DOOR_AD'); + +DELETE FROM script_waypoint WHERE entry=3850; +INSERT INTO script_waypoint VALUES +(3850, 0, -241.816895, 2122.904053, 81.179, 0, 'SAY_FREE_AS'), +(3850, 1, -247.139297, 2124.886475, 81.179, 0, ''), +(3850, 2, -253.179184, 2127.406738, 81.179, 0, ''), +(3850, 3, -253.897552, 2130.873535, 81.179, 0, ''), +(3850, 4, -249.889435, 2142.307861, 86.972, 0, ''), +(3850, 5, -248.204926, 2144.017090, 87.013, 0, ''), +(3850, 6, -240.552826, 2140.552734, 87.012, 0, ''), +(3850, 7, -237.513916, 2142.066650, 87.012, 0, ''), +(3850, 8, -235.638138, 2149.231689, 90.587, 0, ''), +(3850, 9, -237.188019, 2151.946045, 90.624, 0, ''), +(3850, 10, -241.162064, 2153.649658, 90.624, 0, 'SAY_OPEN_DOOR_AS'), +(3850, 11, -241.129700, 2154.562988, 90.624, 5000, 'cast'), +(3850, 12, -241.129700, 2154.562988, 90.624, 5000, 'SAY_POST_DOOR_AS'), +(3850, 13, -241.129700, 2154.562988, 90.624, 25000, ''); + +UPDATE script_texts SET content_default='Follow me and I\'ll open the courtyard door for you.', language=7, comment='prisoner ashcrombe SAY_FREE_AS' WHERE entry=-1033000; + +DELETE FROM script_texts WHERE entry BETWEEN -1033008 AND -1033001; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1033001,'I have just the spell to get this door open. Too bad the cell doors weren\'t locked so haphazardly.',0,0,7,1,'prisoner ashcrombe SAY_OPEN_DOOR_AS'), +(-1033002,'There it is! Wide open. Good luck to you conquering what lies beyond. I must report back to the Kirin Tor at once!',0,0,7,1,'prisoner ashcrombe SAY_POST_DOOR_AS'), +(-1033003,'Free from this wretched cell at last! Let me show you to the courtyard....',0,0,1,1,'prisoner adamant SAY_FREE_AD'), +(-1033004,'You are indeed courageous for wanting to brave the horrors that lie beyond this door.',0,0,1,1,'prisoner adamant SAY_OPEN_DOOR_AD'), +(-1033005,'There we go!',0,0,1,1,'prisoner adamant SAY_POST1_DOOR_AD'), +(-1033006,'Good luck with Arugal. I must hurry back to Hadrec now.',0,0,1,1,'prisoner adamant SAY_POST2_DOOR_AD'), +(-1033007,'About time someone killed the wretch.',0,0,1,1,'prisoner adamant SAY_BOSS_DIE_AD'), +(-1033008,'For once I agree with you... scum.',0,0,7,1,'prisoner ashcrombe SAY_BOSS_DIE_AS'); diff --git a/sql/updates/3.0.9_old/2683_characters_gm_tickets.sql b/sql/updates/3.0.9_old/2683_characters_gm_tickets.sql new file mode 100644 index 0000000..688e151 --- /dev/null +++ b/sql/updates/3.0.9_old/2683_characters_gm_tickets.sql @@ -0,0 +1 @@ +ALTER TABLE `gm_tickets` ADD COLUMN `createtime` int(10) NOT NULL after `message`; diff --git a/sql/updates/3.0.9_old/2683_world_trinity_string.sql b/sql/updates/3.0.9_old/2683_world_trinity_string.sql new file mode 100644 index 0000000..ead79e0 --- /dev/null +++ b/sql/updates/3.0.9_old/2683_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry`=2025; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +('2025','|cff00ff00Created|r:|cff00ccff %s ago|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2686_characters_gm_tickets.sql b/sql/updates/3.0.9_old/2686_characters_gm_tickets.sql new file mode 100644 index 0000000..8a8d61c --- /dev/null +++ b/sql/updates/3.0.9_old/2686_characters_gm_tickets.sql @@ -0,0 +1,4 @@ +ALTER TABLE `gm_tickets` ADD COLUMN `map` INT NOT NULL DEFAULT '0' AFTER `createtime`; +ALTER TABLE `gm_tickets` ADD COLUMN `posX` FLOAT NOT NULL DEFAULT '0' AFTER `map`; +ALTER TABLE `gm_tickets` ADD COLUMN `posY` FLOAT NOT NULL DEFAULT '0' AFTER `posX`; +ALTER TABLE `gm_tickets` ADD COLUMN `posZ` FLOAT NOT NULL DEFAULT '0' AFTER `posY`; diff --git a/sql/updates/3.0.9_old/2686_world_command.sql b/sql/updates/3.0.9_old/2686_world_command.sql new file mode 100644 index 0000000..4abdd7b --- /dev/null +++ b/sql/updates/3.0.9_old/2686_world_command.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name` IN ('go ticket'); +INSERT INTO `command` VALUES +('go ticket','1','Syntax: .go ticket #ticketid\r\nTeleports the user to the location where $ticketid was created.'); diff --git a/sql/updates/3.0.9_old/2687_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2687_world_spell_proc_event.sql new file mode 100644 index 0000000..4053afc --- /dev/null +++ b/sql/updates/3.0.9_old/2687_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (44545, 44543); +INSERT INTO `spell_proc_event` VALUES +(44545, 0x00, 3, 1049120, 4096, 0, 65536, 0x0000000, 0.000000, 15.000000, 0), +(44543, 0x00, 3, 1049120, 4096, 0, 65536, 0x0000000, 0.000000, 7.000000, 0); diff --git a/sql/updates/3.0.9_old/2689_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/2689_world_spell_linked_spell.sql new file mode 100644 index 0000000..0573588 --- /dev/null +++ b/sql/updates/3.0.9_old/2689_world_spell_linked_spell.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (51723); +INSERT INTO `spell_linked_spell` VALUES (51723, 52874, 0, 'Fan Of Knives'); diff --git a/sql/updates/3.0.9_old/2702_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2702_world_spell_proc_event.sql new file mode 100644 index 0000000..a887d59 --- /dev/null +++ b/sql/updates/3.0.9_old/2702_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (56337, 56336, 56333); +INSERT INTO `spell_proc_event` VALUES +(56337, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00011100, 0x0000000, 0.000000, 0.000000, 0), +(56336, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00011100, 0x0000000, 0.000000, 0.000000, 0), +(56333, 0x00, 9, 0x00000004, 0x00000000, 0x00000200, 0x00011100, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2706_world_SD2_scripts.sql b/sql/updates/3.0.9_old/2706_world_SD2_scripts.sql new file mode 100644 index 0000000..b607284 --- /dev/null +++ b/sql/updates/3.0.9_old/2706_world_SD2_scripts.sql @@ -0,0 +1,4 @@ +UPDATE creature_template SET ScriptName='npc_kingdom_of_dalaran_quests' WHERE entry IN (29169,23729,26673,27158,29158,29161,26471,29155,29159,29160,29162); +DELETE FROM spell_target_position WHERE id=53360; +INSERT INTO spell_target_position VALUES +(53360, 571, 5807.829, 587.960, 660.939, 1.663); diff --git a/sql/updates/3.0.9_old/2715_TC1_1362_world_creature_linked_respawn.sql b/sql/updates/3.0.9_old/2715_TC1_1362_world_creature_linked_respawn.sql new file mode 100644 index 0000000..a6d7868 --- /dev/null +++ b/sql/updates/3.0.9_old/2715_TC1_1362_world_creature_linked_respawn.sql @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS `creature_linked_respawn`; +CREATE TABLE `creature_linked_respawn` ( + `guid` int(10) unsigned NOT NULL COMMENT 'dependent creature', + `linkedGuid` int(10) unsigned NOT NULL COMMENT 'master creature', + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Creature Respawn Link System'; + +DELETE FROM `trinity_string` WHERE `entry` = '750'; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +('750', 'linkGUID: %u, Entry: %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.0.9_old/2724_TC1_world_1371_script.sql b/sql/updates/3.0.9_old/2724_TC1_world_1371_script.sql new file mode 100644 index 0000000..39dab98 --- /dev/null +++ b/sql/updates/3.0.9_old/2724_TC1_world_1371_script.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'mob_unkor_the_ruthless' WHERE `entry` = 18262; diff --git a/sql/updates/3.0.9_old/2774_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2774_world_spell_proc_event.sql new file mode 100644 index 0000000..05e6c17 --- /dev/null +++ b/sql/updates/3.0.9_old/2774_world_spell_proc_event.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (56337, 56336, 56333, 58426, 31221, 31222, 31223); +INSERT INTO `spell_proc_event` VALUES +(56337, 0x00, 9, 0x00000004, 0x00000000, 0x00000040, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +(56336, 0x00, 9, 0x00000004, 0x00000000, 0x00000040, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +(56333, 0x00, 9, 0x00000004, 0x00000000, 0x00000040, 0x00022200, 0x0000000, 0.000000, 0.000000, 0), +-- Overkill +(58426, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0), +-- Master of subtlety +(31221, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0), +(31222, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0), +(31223, 0x00, 8, 0x400000, 0x00000000, 0x00000000, 0x00014000, 0x0006001, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2792_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/2792_world_spell_bonus_data.sql new file mode 100644 index 0000000..674a68f --- /dev/null +++ b/sql/updates/3.0.9_old/2792_world_spell_bonus_data.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE entry IN (33778); +INSERT INTO `spell_bonus_data` VALUES +(33778, 0.6453, 0, 0, "Lifebloom- final effect"); diff --git a/sql/updates/3.0.9_old/2792_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2792_world_spell_proc_event.sql new file mode 100644 index 0000000..c2db051 --- /dev/null +++ b/sql/updates/3.0.9_old/2792_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (16180, 16198, 16196); +INSERT INTO `spell_proc_event` VALUES +(16180, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x0000002, 0.000000, 0.000000, 0), +(16198, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x0000002, 0.000000, 0.000000, 0), +(16196, 0x00, 11, 0x000000C0, 0x00000000, 0x00000010, 0x00000000, 0x0000002, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2793_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2793_world_spell_proc_event.sql new file mode 100644 index 0000000..ac52b41 --- /dev/null +++ b/sql/updates/3.0.9_old/2793_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (54754); +INSERT INTO `spell_proc_event` VALUES +(54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2794_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2794_world_spell_proc_event.sql new file mode 100644 index 0000000..ac52b41 --- /dev/null +++ b/sql/updates/3.0.9_old/2794_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (54754); +INSERT INTO `spell_proc_event` VALUES +(54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2798_world_SD2_scripts.sql b/sql/updates/3.0.9_old/2798_world_SD2_scripts.sql new file mode 100644 index 0000000..34c6c6f --- /dev/null +++ b/sql/updates/3.0.9_old/2798_world_SD2_scripts.sql @@ -0,0 +1,2 @@ +UPDATE gameobject_template SET ScriptName='go_tele_to_dalaran_crystal' WHERE entry=191230; +UPDATE gameobject_template SET ScriptName='go_tele_to_violet_stand' WHERE entry=191229; diff --git a/sql/updates/3.0.9_old/2802_world_SD2_scripts.sql b/sql/updates/3.0.9_old/2802_world_SD2_scripts.sql new file mode 100644 index 0000000..150e6bb --- /dev/null +++ b/sql/updates/3.0.9_old/2802_world_SD2_scripts.sql @@ -0,0 +1,142 @@ +DELETE FROM script_waypoint WHERE entry=17876; +INSERT INTO script_waypoint VALUES +(17876, 0, 2230.91, 118.765, 82.2947,5000, ''), +(17876, 1, 2230.33, 114.980, 82.2946, 0, ''), +(17876, 2, 2233.36, 111.057, 82.2996, 0, ''), +(17876, 3, 2231.17, 108.486, 82.6624, 0, ''), +(17876, 4, 2220.22, 114.605, 89.4264, 0, ''), +(17876, 5, 2215.23, 115.990, 89.4549, 0, ''), +(17876, 6, 2210.00, 106.849, 89.4549, 0, ''), +(17876, 7, 2205.66, 105.234, 89.4549, 0, ''), +(17876, 8, 2192.26, 112.618, 89.4549, 0, 'spawn armorer'), +(17876, 9, 2181.28, 118.612, 89.4549,8000, 'get weapon'), +(17876, 10, 2181.62, 120.385, 89.4549,5000, 'get armor'), +(17876, 11, 2189.44, 113.922, 89.4549, 0, ''), +(17876, 12, 2195.63, 110.584, 89.4549, 0, ''), +(17876, 13, 2201.09, 115.115, 89.4549, 0, ''), +(17876, 14, 2204.34, 121.036, 89.4355, 0, ''), +(17876, 15, 2208.66, 129.127, 87.9560, 0, 'first ambush'), +(17876, 16, 2193.09, 137.940, 88.2164, 0, ''), +(17876, 17, 2173.39, 149.064, 87.9227, 0, ''), +(17876, 18, 2164.25, 137.965, 85.0595, 0, ''), +(17876, 19, 2149.31, 125.645, 77.0858, 0, ''), +(17876, 20, 2142.78, 127.173, 75.5954, 0, ''), +(17876, 21, 2139.28, 133.952, 73.6386, 0, 'second ambush'), +(17876, 22, 2139.54, 155.235, 67.1269, 0, ''), +(17876, 23, 2145.38, 167.551, 64.8974, 0, ''), +(17876, 24, 2134.28, 175.304, 67.9446, 0, ''), +(17876, 25, 2118.08, 187.387, 68.8141, 0, ''), +(17876, 26, 2105.88, 195.461, 65.1854, 0, 'third ambush'), +(17876, 27, 2096.77, 196.939, 65.2117, 0, ''), +(17876, 28, 2083.90, 209.395, 64.8736, 0, ''), +(17876, 29, 2067.84, 224.376, 64.8022,30000, 'meeting scarloc'), +(17876, 30, 2055.40, 242.90, 63.3418, 0, 'after skarloc'), +(17876, 31, 2039.20, 266.460, 63.0182,10000, 'mount up'), +(17876, 32, 2011.77, 278.478, 65.3388, 0, ''), +(17876, 33, 2005.08, 289.676, 66.1179, 0, ''), +(17876, 34, 2033.11, 337.450, 66.0948, 0, ''), +(17876, 35, 2070.30, 416.208, 66.0893, 0, ''), +(17876, 36, 2086.76, 469.768, 65.9182, 0, ''), +(17876, 37, 2101.70, 497.955, 61.7881, 0, 'road ambush'), +(17876, 38, 2133.39, 530.933, 55.3700,5000, ''), +(17876, 39, 2157.91, 559.635, 48.5157, 0, ''), +(17876, 40, 2167.34, 586.191, 42.4394, 0, ''), +(17876, 41, 2174.17, 637.643, 33.9002, 0, ''), +(17876, 42, 2179.31, 656.053, 34.723, 0, ''), +(17876, 43, 2183.65, 670.941, 34.0318, 0, ''), +(17876, 44, 2201.50, 668.616, 36.1236, 0, ''), +(17876, 45, 2221.56, 652.747, 36.6153, 0, ''), +(17876, 46, 2238.97, 640.125, 37.2214, 0, ''), +(17876, 47, 2251.17, 620.574, 40.1473, 0, ''), +(17876, 48, 2261.98, 595.303, 41.4117, 0, ''), +(17876, 49, 2278.67, 560.172, 38.9090, 0, ''), +(17876, 50, 2336.72, 528.327, 40.9369, 0, ''), +(17876, 51, 2381.04, 519.612, 37.7312, 0, ''), +(17876, 52, 2412.20, 515.425, 39.2068, 0, ''), +(17876, 53, 2452.39, 516.174, 42.9387, 0, ''), +(17876, 54, 2467.38, 539.389, 47.4992, 0, ''), +(17876, 55, 2470.70, 554.333, 46.6668, 0, ''), +(17876, 56, 2478.07, 575.321, 55.4549, 0, ''), +(17876, 57, 2480.00, 585.408, 56.6921, 0, ''), +(17876, 58, 2482.67, 608.817, 55.6643, 0, ''), +(17876, 59, 2485.62, 626.061, 58.0132, 2000, 'dismount'), +(17876, 60, 2486.91, 626.356, 58.0761, 0, 'scare horse'), +(17876, 61, 2488.58, 660.940, 57.3913, 0, ''), +(17876, 62, 2502.56, 686.059, 55.6252, 0, ''), +(17876, 63, 2502.08, 694.360, 55.5083, 0, ''), +(17876, 64, 2491.46, 694.321, 55.7163, 0, ''), +(17876, 65, 2491.10, 703.300, 55.7630, 0, ''), +(17876, 66, 2485.64, 702.992, 55.7917, 0, ''), +(17876, 67, 2479.10, 695.291, 55.7901, 10000, ''), +(17876, 68, 2476.75, 693.689, 55.7960, 0, 'spawn mobs'), +(17876, 69, 2475.39, 695.983, 55.8146, 0, ''), +(17876, 70, 2477.75, 694.473, 55.7945, 0, ''), +(17876, 71, 2481.27, 697.747, 55.7910, 0, 'mobs in doorway'), +(17876, 72, 2486.31, 703.131, 55.7861, 5000, ''), +(17876, 73, 2490.76, 703.511, 55.7662, 0, ''), +(17876, 74, 2491.30, 694.792, 55.7195, 0, ''), +(17876, 75, 2518.69, 693.876, 55.1383, 0, ''), +(17876, 76, 2531.33, 681.914, 55.1383, 0, ''), +(17876, 77, 2568.25, 682.654, 55.1778, 0, ''), +(17876, 78, 2589.61, 689.981, 55.1421, 0, ''), +(17876, 79, 2634.74, 679.833, 54.6613, 0, ''), +(17876, 80, 2630.41, 661.464, 54.2761, 0, ''), +(17876, 81, 2629.00, 656.982, 56.0651, 0, ''), +(17876, 82, 2620.84, 633.007, 56.0300, 3000, 'stop in church'), +(17876, 83, 2622.99, 639.178, 56.0300, 0, 'summon'), +(17876, 84, 2628.73, 656.693, 56.0610, 5000, ''), +(17876, 85, 2630.34, 661.135, 54.2738, 0, ''), +(17876, 86, 2635.38, 672.243, 54.4508, 0, ''), +(17876, 87, 2644.13, 668.158, 55.3797, 0, ''), +(17876, 88, 2646.82, 666.740, 56.9898, 0, ''), +(17876, 89, 2658.22, 665.432, 57.1725, 0, ''), +(17876, 90, 2661.88, 674.849, 57.1725, 0, ''), +(17876, 91, 2656.23, 677.208, 57.1725, 0, ''), +(17876, 92, 2652.28, 670.270, 61.9353, 0, ''), +(17876, 93, 2650.79, 664.290, 61.9302, 0, 'summon inn'), +(17876, 94, 2658.19, 660.454, 61.9320, 5000, ''), +(17876, 95, 2660.57, 659.173, 61.9370, 0, 'speak with Taretha'), +(17876, 96, 2658.19, 660.454, 61.9320, 5000, 'epoch calls'), +(17876, 97, 2659.84, 659.482, 61.9361, 5000, 'taretha "dies"'), +(17876, 98, 2654.28, 662.722, 61.9313, 0, ''), +(17876, 99, 2652.37, 670.561, 61.9368, 0, ''), +(17876, 100, 2656.05, 676.761, 57.1727, 0, ''), +(17876, 101, 2658.49, 677.166, 57.1727, 0, ''), +(17876, 102, 2659.28, 667.117, 57.1727, 0, ''), +(17876, 103, 2649.71, 665.387, 57.1727, 0, ''), +(17876, 104, 2634.79, 672.964, 54.4577, 0, 'outside inn'), +(17876, 105, 2635.06, 673.892, 54.4713, 30000, 'getting ready'), +(17876, 106, 2634.79, 672.964, 54.4577, 60000, 'when all dead and meet Taretha'), +(17876, 107, 2631.72, 665.629, 54.2923, 0, 'run off'), +(17876, 108, 2647.40, 640.530, 55.7634, 0, ''); + +DELETE FROM script_waypoint WHERE entry=18887; +INSERT INTO script_waypoint VALUES +(18887, 0, 2650.06, 665.473, 61.9305, 0, ''), +(18887, 1, 2652.44, 670.761, 61.9370, 0, ''), +(18887, 2, 2655.96, 676.913, 57.1725, 0, ''), +(18887, 3, 2659.40, 677.317, 57.1725, 0, ''), +(18887, 4, 2651.75, 664.482, 57.1725, 0, ''), +(18887, 5, 2647.49, 666.595, 57.0824, 0, ''), +(18887, 6, 2644.37, 668.167, 55.4182, 0, ''), +(18887, 7, 2640.96, 669.890, 54.7567, 60000, ''); + +DELETE FROM script_waypoint WHERE entry=10096; +INSERT INTO script_waypoint VALUES +(10096, 0, 604.802673, -191.081985, -54.058590, 0,'ring'), +(10096, 1, 604.072998, -222.106918, -52.743759, 0,'first gate'), +(10096, 2, 621.400391, -214.499054, -52.814453, 0,'hiding in corner'), +(10096, 3, 601.300781, -198.556992, -53.950256, 0,'ring'), +(10096, 4, 631.818359, -180.548126, -52.654770, 0,'second gate'), +(10096, 5, 627.390381, -201.075974, -52.692917, 0,'hiding in corner'); + +DELETE FROM script_waypoint WHERE entry=9503; +INSERT INTO script_waypoint VALUES +(9503, 0, 883.294861, -188.926300, -43.703655, 0,''), +(9503, 1, 872.763550, -185.605621, -43.703655, 5000,'b1'), +(9503, 2, 867.923401, -188.006393, -43.703655, 5000,'b2'), +(9503, 3, 863.295898, -190.795212, -43.703655, 5000,'b3'), +(9503, 4, 856.139587, -194.652756, -43.703655, 5000,'b4'), +(9503, 5, 851.878906, -196.928131, -43.703655, 15000,'b5'), +(9503, 6, 877.035217, -187.048080, -43.703655, 0,''), +(9503, 7, 891.198000, -197.924000, -43.620400, 0,'home'); diff --git a/sql/updates/3.0.9_old/2813_world_SD2_scripts.sql b/sql/updates/3.0.9_old/2813_world_SD2_scripts.sql new file mode 100644 index 0000000..7d349d7 --- /dev/null +++ b/sql/updates/3.0.9_old/2813_world_SD2_scripts.sql @@ -0,0 +1,27 @@ +DELETE FROM script_waypoint WHERE entry=12423; +INSERT INTO script_waypoint VALUES +(12423, 0, -9509.72, -147.03, 58.74, 0, ''), +(12423, 1, -9517.07, -172.82, 58.66, 0, ''); + +DELETE FROM script_waypoint WHERE entry=12427; +INSERT INTO script_waypoint VALUES +(12427, 0, -5689.20, -456.44, 391.08, 0, ''), +(12427, 1, -5700.37, -450.77, 393.19, 0, ''); + +DELETE FROM script_waypoint WHERE entry=12428; +INSERT INTO script_waypoint VALUES +(12428, 0, 2454.09, 361.26, 31.51, 0, ''), +(12428, 1, 2472.03, 378.08, 30.98, 0, ''); + +DELETE FROM script_waypoint WHERE entry=12429; +INSERT INTO script_waypoint VALUES +(12429, 0, 9654.19, 909.58, 1272.11, 0, ''), +(12429, 1, 9642.53, 908.11, 1269.10, 0, ''); + +DELETE FROM script_waypoint WHERE entry=12430; +INSERT INTO script_waypoint VALUES +(12430, 0, 161.65, -4779.34, 14.64, 0, ''), +(12430, 1, 140.71, -4813.56, 17.04, 0, ''); + +UPDATE script_texts SET emote=20 WHERE entry=-1000231; +UPDATE script_texts SET emote=4 WHERE entry IN (-1000232, -1000256, -1000258, -1000260, -1000262); diff --git a/sql/updates/3.0.9_old/2813_world_scripts.sql b/sql/updates/3.0.9_old/2813_world_scripts.sql new file mode 100644 index 0000000..70d7219 --- /dev/null +++ b/sql/updates/3.0.9_old/2813_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_nadox' WHERE `entry` = 29309; +UPDATE `creature_template` SET `ScriptName` = 'mob_ahnkahar_nerubian' WHERE `entry` in (30176,30178); +UPDATE `instance_template` SET `script`= 'instance_ahnkahet' WHERE `map` = 619; diff --git a/sql/updates/3.0.9_old/2814_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/2814_world_spell_linked_spell.sql new file mode 100644 index 0000000..4986c2a --- /dev/null +++ b/sql/updates/3.0.9_old/2814_world_spell_linked_spell.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (32386, 32388, 32389, 32390, 32391); +INSERT INTO `spell_linked_spell` VALUES (32386, 60448, 2, 'Shadow Embrace Rank1'); +INSERT INTO `spell_linked_spell` VALUES (32388, 60465, 2, 'Shadow Embrace Rank2'); +INSERT INTO `spell_linked_spell` VALUES (32389, 60466, 2, 'Shadow Embrace Rank3'); +INSERT INTO `spell_linked_spell` VALUES (32390, 60467, 2, 'Shadow Embrace Rank4'); +INSERT INTO `spell_linked_spell` VALUES (32391, 60468, 2, 'Shadow Embrace Rank5'); diff --git a/sql/updates/3.0.9_old/2828_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2828_world_spell_proc_event.sql new file mode 100644 index 0000000..23c4365 --- /dev/null +++ b/sql/updates/3.0.9_old/2828_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (16544, 16086); +INSERT INTO `spell_proc_event` VALUES +(16544, 0x00, 11, 0x00000000, 0x00040000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0), +(16086, 0x00, 11, 0x00000000, 0x00040000, 0x00000000, 0x00000000, 0x0000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/2885_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2885_world_spell_proc_event.sql new file mode 100644 index 0000000..46a56f9 --- /dev/null +++ b/sql/updates/3.0.9_old/2885_world_spell_proc_event.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (34457); +INSERT INTO `spell_proc_event` VALUES +(34457, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000002, 0.000000, 0.000000, 0); +DELETE FROM `spell_proc_event` WHERE `entry` IN (34456); +INSERT INTO `spell_proc_event` VALUES +(19615, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000002, 0.000000, 0.000000, 0); + +INSERT INTO trinity_string (entry, content_default)VALUES (6616 , "Pet spells will reset for all players at login. Strongly recommend re-login!"); diff --git a/sql/updates/3.0.9_old/2907_mangos_7705_01_world_command.sql b/sql/updates/3.0.9_old/2907_mangos_7705_01_world_command.sql new file mode 100644 index 0000000..d1b40e1 --- /dev/null +++ b/sql/updates/3.0.9_old/2907_mangos_7705_01_world_command.sql @@ -0,0 +1,11 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7662_02_mangos_spell_bonus_data required_7705_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN +('account lock','account password','chardelete','character customize','character delete','character rename','customize','lockaccount','password','rename'); + +INSERT INTO `command` VALUES +('account lock',0,'Syntax: .account lock [on|off]\r\n\r\nAllow login from account only from current used IP or remove this requirement.'), +('account password',0,'Syntax: .account password $old_password $new_password $new_password\r\n\r\nChange your account password.'), +('character customize',2,'Syntax: .character customize [$name]\r\n\r\nMark selected in game or by $name in command character for customize at next login.'), +('character delete',4,'Syntax: .character delete $name\r\n\r\nDelete character $name.'), +('character rename',2,'Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'); diff --git a/sql/updates/3.0.9_old/2907_mangos_7706_01_world_command.sql b/sql/updates/3.0.9_old/2907_mangos_7706_01_world_command.sql new file mode 100644 index 0000000..4e17f11 --- /dev/null +++ b/sql/updates/3.0.9_old/2907_mangos_7706_01_world_command.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7705_01_mangos_command required_7706_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('plimit','server plimit'); +INSERT INTO `command` VALUES +('server plimit',3,'Syntax: .server plimit [#num|-1|-2|-3|reset|player|moderator|gamemaster|administrator]\r\n\r\nWithout arg show current player amount and security level limitations for login to server, with arg set player linit ($num > 0) or securiti limitation ($num < 0 or security leme name. With `reset` sets player limit to the one in the config file'); diff --git a/sql/updates/3.0.9_old/2923_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2923_world_spell_proc_event.sql new file mode 100644 index 0000000..8317889 --- /dev/null +++ b/sql/updates/3.0.9_old/2923_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (47569, 47570); +INSERT INTO `spell_proc_event` VALUES +(47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 50.000000, 0), +(47570, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 100.000000, 0); diff --git a/sql/updates/3.0.9_old/2928_characters_character_pet.sql b/sql/updates/3.0.9_old/2928_characters_character_pet.sql new file mode 100644 index 0000000..95a3440 --- /dev/null +++ b/sql/updates/3.0.9_old/2928_characters_character_pet.sql @@ -0,0 +1,2 @@ +ALTER TABLE character_pet ADD load_flags INT(3) DEFAULT '0' NOT NULL AFTER teachspelldata; +UPDATE characters SET at_login = at_login & ~16 WHERE at_login & 16; diff --git a/sql/updates/3.0.9_old/2932_mangos_7714_01_world_command.sql b/sql/updates/3.0.9_old/2932_mangos_7714_01_world_command.sql new file mode 100644 index 0000000..58880bc --- /dev/null +++ b/sql/updates/3.0.9_old/2932_mangos_7714_01_world_command.sql @@ -0,0 +1,5 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7706_01_mangos_command required_7714_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('character level'); +INSERT INTO `command` VALUES +('character level',3,'Syntax: .character level [$playername] [#level]\r\n\r\nSet the level of character with $playername (or the selected if not name provided) by #numberoflevels Or +1 if no #numberoflevels provided). If #numberoflevels is omitted, the level will be increase by 1. If #numberoflevels is 0, the same level will be restarted. If no character is selected and name not provided, increase your level. Command can be used for offline character. All stats and dependent values recalculated. At level decrease talents can be reset if need. Also at level decrease equipped items with greater level requirement can be lost.'); diff --git a/sql/updates/3.0.9_old/2938_mangos_7720_01_world_trinity_string.sql b/sql/updates/3.0.9_old/2938_mangos_7720_01_world_trinity_string.sql new file mode 100644 index 0000000..73a0329 --- /dev/null +++ b/sql/updates/3.0.9_old/2938_mangos_7720_01_world_trinity_string.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7714_01_mangos_command required_7720_01_mangos_mangos_string bit;*/ + +DELETE FROM trinity_string WHERE entry IN(557,558,559); +INSERT INTO trinity_string VALUES +(557,'%s level up you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(558,'%s level down you to (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(559,'%s reset your level progress.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/2949_world_creature_template.sql b/sql/updates/3.0.9_old/2949_world_creature_template.sql new file mode 100644 index 0000000..3a69b87 --- /dev/null +++ b/sql/updates/3.0.9_old/2949_world_creature_template.sql @@ -0,0 +1,10 @@ +INSERT INTO creature_template (entry, spell1, spell2, spell3, spell4) VALUES +(15352, 36213, 0, 0, 0), # Greater Earth Elemental +(15438, 57984, 12470, 13376, 0), # Greater Fire Elemental +(29264, 58861, 58875, 58867, 58857), # Spirit Wolf +(510, 31707, 33395, 0, 0) # Water Elemental +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +spell2 = VALUES(spell2), +spell3 = VALUES(spell3), +spell4 = VALUES(spell4); diff --git a/sql/updates/3.0.9_old/2955_world_scripts_naxx.sql b/sql/updates/3.0.9_old/2955_world_scripts_naxx.sql new file mode 100644 index 0000000..33ea44a --- /dev/null +++ b/sql/updates/3.0.9_old/2955_world_scripts_naxx.sql @@ -0,0 +1,7 @@ +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(-28169, 28206, 0, 'Mutating Injection - Mutagen Explosion'), +(-28169, 28240, 0, 'Mutating Injection - Poison Cloud'); + +UPDATE creature_template SET spell1 = 28158, spell2 = 54362, flags_extra = 128 WHERE entry = 16363; + +UPDATE creature_template SET scriptname = 'boss_grobbulus' WHERE entry = 15931; diff --git a/sql/updates/3.0.9_old/2963_world_spell_proc_event.sql b/sql/updates/3.0.9_old/2963_world_spell_proc_event.sql new file mode 100644 index 0000000..84550fb --- /dev/null +++ b/sql/updates/3.0.9_old/2963_world_spell_proc_event.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (20911, 25899); +-- Blessing of sanctuary +INSERT INTO `spell_proc_event` VALUES +(20911, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0), +(25899, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000070, 0.000000, 0.000000, 0); + +DELETE FROM `spell_required` WHERE `spell_id` IN (25899); +INSERT INTO spell_required VALUES (25899, 20911); diff --git a/sql/updates/3.0.9_old/2986_TC1_world.sql b/sql/updates/3.0.9_old/2986_TC1_world.sql new file mode 100644 index 0000000..fd0d6b3 --- /dev/null +++ b/sql/updates/3.0.9_old/2986_TC1_world.sql @@ -0,0 +1,157 @@ +-- Kil'jaeden +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 45909; +DELETE FROM `spell_script_target` WHERE `entry` IN (46589, 45839); +INSERT INTO `spell_script_target` () VALUES (46589, 1, 30598); +INSERT INTO `spell_script_target` () VALUES (46589, 1, 30614); +INSERT INTO `spell_script_target` () VALUES (45839, 1, 25653); + +DELETE FROM `creature_template` WHERE entry in (30598, 30614); +INSERT INTO `creature_template` () VALUES +(30598, 0, 4449, 0, 4449, 0, 'Spike Target', '', '', 70, 70, 1, 1, 0, 0, 0, 14, 14, 0, 1, 1, 0, 0, 0, 0, 0, 2600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 0, 0, 0, 1, 0, 0, 128, ''), +(30614, 0, 4449, 0, 4449, 0, 'Spike Target 2', '', '', 70, 70, 1, 1, 0, 0, 0, 14, 14, 0, 1, 1, 0, 0, 0, 0, 0, 2600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 0, 0, 0, 1, 0, 0, 128, ''); + +UPDATE `creature_template` SET `flags_extra` = 128 WHERE `entry` IN (30614, 30598, 25735); +UPDATE `creature_template` SET `minlevel` = 73, `maxlevel` = 73, unit_flags = 33554432, minhealth=5000000, maxhealth=5000000 WHERE entry IN (26046, 25319); +UPDATE `creature_template` SET `minlevel` = 70, `unit_flags` = 33554432 WHERE entry = 26046; +UPDATE `creature_template` SET `minlevel` =70, `maxlevel` = 70, `unit_flags` = 33554432, spell1 = 45848, spell2 = 45862, spell3 = 45860, spell4 = 45856, minhealth = 5000000, maxhealth=5000000 WHERE entry=25653; +UPDATE `creature_template` SET `minlevel` = 70, `maxlevel` = 70, `minhealth` = 20000, maxhealth = 20000 WHERE entry = 25502; +UPDATE `creature_template` SET `minhealth` = 12600000, maxhealth = 12600000, minmana = 2000000, maxmana = 2000000 WHERE entry = 25315; +UPDATE `creature_template` SET `minhealth` = 110000, maxhealth = 110000, minmana = 100000, maxmana = 100000 WHERE entry =25708; +UPDATE `creature_template` SET `minlevel` = 73, `maxlevel` = 73 WHERE entry = 25735; + +DELETE FROM creature WHERE id IN (25319, 25588, 25608); +INSERT INTO creature (id, map, spawnMask, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, DeathState, MovementType) VALUES +(25319, 580, 1, 0, 0, 1701.7, 635.515, 72.2884, 4.65461, 25, 0, 0, 1, 0, 0, 0), +(25608, 580, 1, 0, 0, 1698.9, 627.877, 27.6233, 0.034907, 604800, 0, 0, 1, 0, 0, 0); + +DELETE FROM gameobject WHERE id=188415; +INSERT INTO gameobject (id, map, spawnMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES +(188415, 580, 1, 1653.12, 635.41, 28.0932, 0.0977725, 0, 0, 0.0488668, 0.998805, 25, 0, 1), +(188415, 580, 1, 1704.14, 583.591, 28.1696, 1.59003, 0, 0, 0.713874, 0.700274, 25, 0, 1), +(188415, 580, 1, 1745.68, 621.823, 28.0505, 2.93777, 0, 0, 0.994812, 0.101733, 25, 0, 1), +(188415, 580, 1, 1694.48, 674.29, 28.0502, 4.86985, 0, 0, 0.649302, -0.760531, 25, 0, 1); +UPDATE `gameobject_template` SET `type` = 1 WHERE `entry` = 188415; + +-- M'uru +UPDATE `creature_template` SET `modelid_A` = 23842 WHERE `entry` = 25744; +UPDATE `creature_template` SET `flags_extra` = 128 WHERE entry IN (25855, 25770); +UPDATE `creature_template` SET `spell1` = 46262, flags_extra = 128, scriptname = '' WHERE entry = 25879; + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (46242, 46228, 46228, 46262); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46242, 46247, 0, 'Black Hole Visual (Birth)'); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46228, 46235, 0, 'Black Hole Visual (Grown)'); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46228, -46247, 0, 'Black Hole Visual (Grown)'); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (46262, 46265, 0, 'Void Zone Visual'); + +DELETE FROM `spell_script_target` WHERE `entry` IN (45976, 46177); +INSERT INTO `spell_script_target` VALUES (45976, 1, 25770); +INSERT INTO `spell_script_target` VALUES (46177, 1, 25770); + +-- EAI for Berserks FROM Megamage +DELETE FROM `creature_ai_scripts` WHERE `creature_id` = 25798; +INSERT INTO `creature_ai_scripts` (`id`, `creature_id`, `event_type`, `event_flags`,`event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_type`, `action1_param1`, `action1_param2`, `action1_param3`, `action2_type`, `action2_param1`, `action2_param2`, `action2_param3`, `action3_type`, `action3_param1`, `action3_param2`, `action3_param3`, `comment`, `event_chance`, `event_inverse_phase_mask`) VALUES +(2579800, 25798, 11, 0, 0*1000, 0*1000, 0*1000, 0*1000, 11, 45769, 0, 0, 20, 1, 0, 0, 21, 1, 0, 0,"Shadowsword Berserker - Sunwell Radiance", 100, 0), +(2579801, 25798, 0, 1, 10*1000, 12*1000, 10*1000, 15*1000, 11, 46160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadowsword Berserker - Cast Flurry', 70, 0), +(2579802, 25798, 1, 0, 180*1000, 180*1000, 0*1000, 0*1000, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Shadowsword Berserker - 180s OOC => Evade', 100, 0); + +-- Brutallus +UPDATE `creature_template` SET `unit_flags` = 0 WHERE `entry` = 24882; + +-- Felmyst +UPDATE `creature_template` SET `modelid_H` = 22838 WHERE `entry` = 25038; +DELETE FROM `script_texts` WHERE `entry` BETWEEN '-1580109' and '-1580036'; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `comment`) VALUES +(-1580036, 'Glory to Kil\'jaeden! Death to all who oppose!', 12477, 1, 'felmyst - YELL_BIRTH'), +(-1580037, 'I kill for the master!', 12480, 1, 'felmyst - YELL_KILL1'), +(-1580038, 'The end has come!', 12481, 1, 'felmyst - YELL_KILL2'), +(-1580039, 'Choke on your final breath!', 12478, 1, 'felmyst - YELL_BREATH'), +(-1580040, 'I am stronger than ever before!', 12479, 1, 'felmyst- YELL_TAKEOFF'), +(-1580041, 'No more hesitation! Your fates are written!', 12482, 1, 'felmyst - YELL_BERSERK'), +(-1580042, 'Kil\'jaeden... will... prevail...', 12483, 1, 'felmyst - YELL_DEATH'), +(-1580043, 'Madrigosa deserved a far better fate. You did what had to be done, but this battle is far from over.', 12439, 1, 'felmyst - YELL_KALECGOS'), +(-1580044, 'Fire to the aid of shadow!', 12489, 1, 'eredar - YELL_CANFLAGRATION'), +(-1580045, 'Sacrolash!', 12492, 1, 'eredar - YELL_SISTER_SACROLASH_DEAD'), +(-1580046, 'Fire consume.', 12490, 1, 'eredar - YELL_ALY_KILL_1'), +(-1580047, 'Ed-ir Halach!', 12491, 1, 'eredar - YELL_ALY_KILL_2'), +(-1580048, 'De-ek Anur!', 12494, 1, 'eredar - YELL_ALY_DEAD'), +(-1580049, 'Your luck has run its curse!', 12493, 1, 'eredar - YELL_BERSERK'), +(-1580050, 'Shadow to the aid of fire!', 12485, 1, 'eredar - YELL_SHADOW_NOVA'), +(-1580051, 'Alythess! Your fire burns within me!', 12488, 1, 'eredar - YELL_SISTER_ALYTHESS_DEAD'), +(-1580052, 'Shadow engulf.', 12486, 1, 'eredar - YELL_SAC_KILL_1'), +(-1580053, 'Ee-nok Kryul!', 12487, 1, 'eredar - YELL_SAC_KILL_2'), +(-1580054, 'I... fade.', 0, 1, 'eredar - YELL_SAC_DEAD'), +(-1580055, 'Time is a luxury you no longer possess!', 0, 1, 'eredar - YELL_ENRAGE'), +(-1580056, 'Misery...', 12484, 1, 'eredar - YELL_INTRO_SAC_1'), +(-1580057, 'Depravity...', 0, 1, 'eredar - YELL_INTRO_ALY_2'), +(-1580058, 'Confusion...', 0, 1, 'eredar - YELL_INTRO_SAC_3'), +(-1580059, 'Hatred...', 0, 1, 'eredar - YELL_INTRO_ALY_4'), +(-1580060, 'Mistrust...', 0, 1, 'eredar - YELL_INTRO_SAC_5'), +(-1580061, 'Chaos...', 0, 1, 'eredar - YELL_INTRO_ALY_6'), +(-1580062, 'These are the hallmarks...', 0, 1, 'eredar - YELL_INTRO_SAC_7'), +(-1580063, 'These are the pillars...', 0, 1, 'eredar - YELL_INTRO_ALY_8'), +(-1580064, 'directs Shadow Nova at $N', 0, 3, 'eredar - emote shadow nova'), +(-1580065, 'directs Conflagration at $N', 0, 3, 'eredar - emote conflagration'), +(-1580066, 'All my plans have led to this!', 12495, 1, 'KJ - SAY_KJ_OFFCOMBAT1'), +(-1580067, 'Stay on task! Do not waste tim!', 12496, 1, 'KJ - SAY_KJ_OFFCOMBAT2'), +(-1580068, 'I have waited long enough!', 12497, 1, 'KJ - SAY_KJ_OFFCOMBAT3'), +(-1580069, 'Fail me and suffer for eternity!', 12498, 1, 'KJ - SAY_KJ_OFFCOMBAT4'), +(-1580070, 'Drain the girl! Drain her power until there is nothing but a vacant shell!', 12499, 1, 'KJ - SAY_KJ_OFFCOMBAT5'), +(-1580071, 'The expendible have perished... So be it! Now I shall succeed where Sargeras could not! I will bleed this wretched world and secure my place as the true master of the Burning Legion. The end has come! Let the unraveling of this world commence!', 12500, 1, 'KJ - SAY_KJ_EMERGE'), +(-1580072, 'Another step towards destruction!', 12501, 1, 'KJ - SAY_KJ_SLAY1'), +(-1580073, 'Anak-ky\'ri!', 12502, 1, 'KJ - SAY_KJ_SLAY2'), +(-1580074, 'Who can you trust?', 12503, 1, 'KJ - SAY_KJ_REFLECTION1'), +(-1580075, 'The enemy is among you.', 12504, 1, 'KJ - SAY_KJ_REFLECTION2'), +(-1580076, 'Chaos!', 12505, 1, 'KJ - SAY_KJ_DARKNESS1'), +(-1580077, 'Destruction!', 12506, 1, 'KJ - SAY_KJ_DARKNESS2'), +(-1580078, 'Oblivion!', 12507, 1, 'KJ - SAY_KJ_DARKNESS3'), +(-1580079, 'I will not be denied! This world shall fall!', 12508, 1, 'KJ - SAY_KJ_PHASE3'), +(-1580080, 'Do not harbor false hope. You cannot win!', 12509, 1, 'KJ - SAY_KJ_PHASE4'), +(-1580081, 'Aggghh! The powers of the Sunwell... turned... against me! What have you done? WHAT HAVE YOU DONE?', 12510, 1, 'KJ - SAY_KJ_PHASE5'), +(-1580082, 'Anveena, you must awaken, this world needs you!', 12445, 1, 'KJ - SAY_KALECGOS_AWAKEN'), +(-1580083, 'I serve only the Master now.', 12511, 1, 'KJ - SAY_ANVEENA_IMPRISONED'), +(-1580084, 'You must let go! You must become what you were always meant to be! The time is now, Anveena!', 12446, 1, 'KJ - SAY_KALECGOS_LETGO'), +(-1580085, 'But I\'m... lost... I cannot find my way back!', 12512, 1, 'KJ - SAY_ANVEENA_LOST'), +(-1580086, 'Anveena, I love you! Focus on my voice, come back for me now! Only you can cleanse the Sunwell!', 12447, 1, 'KJ - SAY_KALECGOS_FOCUS'), +(-1580087, 'Kalec... Kalec?', 12513, 1, 'KJ - SAY_ANVEENA_KALEC'), +(-1580088, 'Yes, Anveena! Let fate embrace you now!', 12448, 1, 'KJ - SAY_KALECGOS_FATE'), +(-1580089, 'The nightmare is over, the spell is broken! Goodbye, Kalec, my love!', 12514, 1, 'KJ - SAY_ANVEENA_GOODBYE'), +(-1580090, 'Goodbye, Anveena, my love. Few will remember your name, yet this day you change the course of destiny. What was once corrupt is now pure. Heroes, do not let her sacrifice be in vain.', 12450, 1, 'KJ - SAY_KALECGOS_GOODBYE'), +(-1580091, 'Strike now, heroes, while he is weakened! Vanquish the Deceiver!', 12449, 1, 'KJ - SAY_KALECGOS_ENCOURAGE'), +(-1580092, 'You are not alone. The Blue Dragonflight shall help you vanquish the Deceiver.', 12438, 1, 'KJ - SAY_KALECGOS_JOIN'), +(-1580093, 'Nooooooooooooo!', 12527, 1, 'KJ - SAY_KJ_DEATH'), +(-1580094, 'begins to channel dark energy', 0, 3, 'KJ - EMOTE_KJ_DARKNESS'), +(-1580095, 'I will channel my power into the orbs, be ready!', 12440, 1, 'KJ - SAY_KALEC_ORB_READY1'), +(-1580096, 'I have empowered another orb! Use it quickly!', 12441, 1, 'KJ - SAY_KALEC_ORB_READY2'), +(-1580097, 'Another orb is ready! Make haste!', 12442, 1, 'KJ - SAY_KALEC_ORB_READY3'), +(-1580098, 'I have channeled all I can! The power is in your hands!', 12443, 1, 'KJ - SAY_KALEC_ORB_READY4'), +(-1580099, 'Mortal heroes, your victory here today was foretold long ago. My brother\'s anguished cry of defeat will echo across the universe, bringing renewed hope to all those who still stand against the Burning Crusade.', 12515, 0, 'prophet velen - SAY1'), +(-1580100, 'As the Legion\'s final defeat draws ever-nearer, stand proud in the knowledge that you have saved worlds without number from the flame. Just as this day marks an ending, so too does it herald a new beginning...', 12516, 0, 'prophet velen - SAY2'), -- van mĂ©gegy hang 12517 ami ehhez tartozik +(-1580101, 'The creature Entropius, whom you were forced to destroy, was once the noble naaru, M\'uru. In life, M\'uru channeled vast energies of LIGHT and HOPE. For a time, a misguided few sought to steal those energies...', 12518, 0, 'prophet velen - SAY3'), +(-1580102, 'Then fortunate it is, that I have reclaimed the noble naaru\'s spark from where it fell! Where faith dwells, hope is never lost, young blood elf.', 12519, 0, 'prophet velen - SAY4'), +(-1580103, 'Gaze now, mortals - upon the HEART OF M\'URU! Unblemished. Bathed by the light of Creation - just as it was at the Dawn.', 12520, 0, 'prophet velen - SAY5'), +(-1580104, 'In time, the light and hope held within - will rebirth more than this mere fount of power... Mayhap, they will rebirth the soul of a nation.', 12521, 0, 'prophet velen - SAY6'), +(-1580105, 'Salvation, young one. It waits for us all.', 12522, 0, 'prophet velen - SAY7'), +(-1580106, 'Farewell...', 12523, 0, 'prophet velen - SAY8'), +(-1580107, 'Our arrogance was unpardonable. We damned one of the most noble beings of all. We may never atone for this sin.', 12524, 0, 'lady liadrinn - SAY1'), +(-1580108, 'Can it be?', 12525, 0, 'lady liadrinn - SAY2'), +(-1580109, 'Blessed ancestors! I feel it... so much love... so much grace... there are... no words... impossible to describe...', 12525, 0, 'lady liadrinn - SAY3'); + +-- Kil'jaeden script +UPDATE `creature_template` SET `ScriptName`='boss_kiljaeden' WHERE `entry`=25315; +UPDATE `creature_template` SET `ScriptName`='boss_kalecgosKJ' WHERE `entry`=25319; +UPDATE `creature_template` SET `ScriptName`='mob_kiljaeden_controller' WHERE `entry`=25608; +UPDATE `creature_template` SET `ScriptName`='mob_hand_of_the_deceiver' WHERE `entry`=25588; +UPDATE `creature_template` SET `ScriptName`='mob_felfire_portal' WHERE `entry`=25603; +UPDATE `creature_template` SET `ScriptName`='mob_volatile_felfire_fiend' WHERE `entry`=25598; +UPDATE `creature_template` SET `ScriptName`='mob_armageddon' WHERE `entry`=25735; +UPDATE `creature_template` SET `ScriptName`='mob_shield_orb' WHERE `entry`=25502; +UPDATE `creature_template` SET `ScriptName`='mob_sinster_reflection' WHERE `entry`=25708; +UPDATE `gameobject_template` SET `ScriptName`='go_orb_of_the_blue_flight' WHERE `entry`=188415; + +-- M'uru& Entropius +UPDATE `creature_template` SET `ScriptName`='npc_void_sentinel' WHERE `entry`=25772; +UPDATE `creature_template` SET `ScriptName`='npc_dark_fiend' WHERE `entry`=25744; +UPDATE `creature_template` SET `ScriptName`='boss_muru' WHERE `entry`=25741; +UPDATE `creature_template` SET `ScriptName`='boss_entropius' WHERE `entry`=25840; +UPDATE `creature_template` SET `ScriptName`='npc_muru_portal' WHERE `entry`=25770; +UPDATE `creature_template` SET `AIName`='EventAI' WHERE `entry`=25798; diff --git a/sql/updates/3.0.9_old/2996_world_trinity_string.sql b/sql/updates/3.0.9_old/2996_world_trinity_string.sql new file mode 100644 index 0000000..761ad5d --- /dev/null +++ b/sql/updates/3.0.9_old/2996_world_trinity_string.sql @@ -0,0 +1,45 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (750,751); +INSERT INTO `trinity_string` VALUES +(750,'Not enough players. This game will close in %u mins.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(751,'Not enough players. This game will close in %u seconds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1200 AND 1232; +INSERT INTO `trinity_string` VALUES +(1200, 'You try to view cinemitic %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1201, 'You try to view movie %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 1300 AND 1332; +INSERT INTO `trinity_string` VALUES +(1300, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1301, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1302, '%s was destroyed by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1303, 'The %s is under attack! If left unchecked, the %s will destroy it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1304, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1305, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1306, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1307, 'The %s is under attack! If left unchecked, the %s will capture it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1308, 'The %s has taken the %s! Its supplies will now be used for reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1309, 'Irondeep Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1310, 'Coldtooth Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1311, 'Stormpike Aid Station', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1312, 'Dun Baldar South Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1313, 'Dun Baldar North Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1314, 'Stormpike Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1315, 'Icewing Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1316, 'Stonehearth Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1317, 'Stonehearth Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1318, 'Snowfall Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1319, 'Iceblood Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1320, 'Iceblood Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1321, 'Tower Point', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1322, 'Frostwolf Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1323, 'East Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1324, 'West Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1325, 'Frostwolf Relief Hut', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1326, 'The Battle for Alterac Valley begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1327, 'The Battle for Alterac Valley begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1328, 'The Battle for Alterac Valley has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1329, 'The Alliance Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1330, 'The Horde Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1331, 'The Frostwolf General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1332, 'The Stormpike General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.0.9_old/2997_world_trinity_string.sql b/sql/updates/3.0.9_old/2997_world_trinity_string.sql new file mode 100644 index 0000000..51a3547 --- /dev/null +++ b/sql/updates/3.0.9_old/2997_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry` = 5010; +INSERT INTO `trinity_string` VALUES +(5010,'linkGUID: %u, Entry: %u (%s)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/3008_1437_TC1_world_scripts.sql b/sql/updates/3.0.9_old/3008_1437_TC1_world_scripts.sql new file mode 100644 index 0000000..0eacd52 --- /dev/null +++ b/sql/updates/3.0.9_old/3008_1437_TC1_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_ethereum_prison' WHERE `entry` IN (184418,184419,184420,184421,184422,184423,184424,184425,184426,184427,184428,184429,184430,184431); diff --git a/sql/updates/3.0.9_old/3018_spell_linked_spell.sql b/sql/updates/3.0.9_old/3018_spell_linked_spell.sql new file mode 100644 index 0000000..f1d9281 --- /dev/null +++ b/sql/updates/3.0.9_old/3018_spell_linked_spell.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 38528; + +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 38528,-31984, 2, 'Protection of Elune - Finger of Death'), +( 38528,-32111, 2, 'Protection of Elune - Finger of Death'); diff --git a/sql/updates/3.0.9_old/3030_world_scripts.sql b/sql/updates/3.0.9_old/3030_world_scripts.sql new file mode 100644 index 0000000..a0a4d9a --- /dev/null +++ b/sql/updates/3.0.9_old/3030_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='npc_unworthy_initiate' WHERE `entry` IN (29519,29520,29565,29566,29567); +UPDATE `creature_template` SET `ScriptName`='npc_unworthy_initiate_anchor' WHERE `entry`=29521; +UPDATE `gameobject_template` SET `ScriptName`='go_acherus_soul_prison' WHERE `entry` IN (191577,191580,191581,191582,191583,191584,191585,191586,191587,191588,191589,191590); diff --git a/sql/updates/3.0.9_old/3039_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/3039_world_spell_linked_spell.sql new file mode 100644 index 0000000..1cf6cf5 --- /dev/null +++ b/sql/updates/3.0.9_old/3039_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 38528 AND `spell_effect` = -32124; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(38528, -32124, 2, 'Protection of Elune - Denouement Wisp'); diff --git a/sql/updates/3.0.9_old/3070_TC1_1463_world_scripts.sql b/sql/updates/3.0.9_old/3070_TC1_1463_world_scripts.sql new file mode 100644 index 0000000..de973cc --- /dev/null +++ b/sql/updates/3.0.9_old/3070_TC1_1463_world_scripts.sql @@ -0,0 +1,10 @@ +UPDATE `instance_template` SET `script` = 'instance_blackrock_depths' WHERE `map` = 230; +UPDATE `creature_template` SET `ScriptName` = 'mob_voidtraveler' WHERE `entry` = 19226; +UPDATE `creature_template` SET `ScriptName` = 'mob_shadowy_construct' WHERE `entry` = 23111; +UPDATE `creature_template` SET `ScriptName` = 'mob_phalanx' WHERE `entry` = 9502; +UPDATE `creature_template` SET `ScriptName` = 'npc_draenei_survivor' WHERE `entry` = 16483; +UPDATE `creature_template` SET `ScriptName` = 'mob_inner_demon' WHERE entry = 21857; +UPDATE `creature_template` SET `ScriptName` = 'mob_webwrap' WHERE `entry` = 16486; +UPDATE `creature_template` SET `ScriptName` = 'mob_dragonmaw_peon' WHERE `entry` = 22252; +UPDATE `creature_template` SET `ScriptName` = 'npc_karynaku' WHERE `entry` = 22112; +UPDATE `creature_template` SET `ScriptName` = 'mob_ohgan' WHERE `entry` = 14988; diff --git a/sql/updates/3.0.9_old/3070_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3070_world_spell_proc_event.sql new file mode 100644 index 0000000..c382b00 --- /dev/null +++ b/sql/updates/3.0.9_old/3070_world_spell_proc_event.sql @@ -0,0 +1,15 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (20166, 32385, 32392, 32387, 32393, 32394, + 13046, 13045, 12317, 13048, 13047, -- Enrage + 29724, 29725, 29723); -- Sudden Death + +-- Seal of wisdom +INSERT INTO `spell_proc_event` VALUES +(20166, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 12.000000, 0.000000, 0); + +-- Shadow embrace +INSERT INTO `spell_proc_event` VALUES +(32385, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(32387, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(32392, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(32393, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(32394, 0x00, 5, 0x00000001, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/3075_TC1_1465_world_scripts.sql b/sql/updates/3.0.9_old/3075_TC1_1465_world_scripts.sql new file mode 100644 index 0000000..ca1d88f --- /dev/null +++ b/sql/updates/3.0.9_old/3075_TC1_1465_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'mob_fiendish_imp' WHERE `entry` = 17267; diff --git a/sql/updates/3.0.9_old/3089_world_trinity_string.sql b/sql/updates/3.0.9_old/3089_world_trinity_string.sql new file mode 100644 index 0000000..7c9862e --- /dev/null +++ b/sql/updates/3.0.9_old/3089_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (101); +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(101, 'Map: %u (%s) Zone: %u (%s) Area: %u (%s) Phase: %u\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.0.9_old/3121_world_scripts.sql b/sql/updates/3.0.9_old/3121_world_scripts.sql new file mode 100644 index 0000000..23e5ada --- /dev/null +++ b/sql/updates/3.0.9_old/3121_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_dragonflayer_forge_master' WHERE `entry` =24079; diff --git a/sql/updates/3.0.9_old/3148_mangos_7776_01_world_npc_spellclick_spells.sql b/sql/updates/3.0.9_old/3148_mangos_7776_01_world_npc_spellclick_spells.sql new file mode 100644 index 0000000..eff8fd5 --- /dev/null +++ b/sql/updates/3.0.9_old/3148_mangos_7776_01_world_npc_spellclick_spells.sql @@ -0,0 +1,8 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7720_01_mangos_mangos_string required_7776_01_mangos_npc_spellclick_spells bit;*/ + +CREATE TABLE `npc_spellclick_spells` ( + `npc_entry` INT UNSIGNED NOT NULL COMMENT 'reference to creature_template', + `spell_id` INT UNSIGNED NOT NULL COMMENT 'spell which should be casted ', + `quest_id` INT UNSIGNED NOT NULL COMMENT 'reference to quest_template', + `cast_flags` TINYINT UNSIGNED NOT NULL COMMENT 'first bit defines caster: 1=player, 0=creature; second bit defines target, same mapping as caster bit' +) ENGINE = MYISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.0.9_old/3178_mangos_7777_01_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3178_mangos_7777_01_world_spell_proc_event.sql new file mode 100644 index 0000000..9c689d9 --- /dev/null +++ b/sql/updates/3.0.9_old/3178_mangos_7777_01_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7776_01_mangos_npc_spellclick_spells required_7777_01_mangos_spell_proc_event bit;*/ + +DELETE FROM spell_proc_event WHERE entry IN (30299,30301,30302); +INSERT INTO spell_proc_event VALUES (30299, 0x0000007E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO spell_proc_event VALUES (30301, 0x0000007E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); +INSERT INTO spell_proc_event VALUES (30302, 0x0000007E, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/3204_mangos_7796_01_world_command.sql b/sql/updates/3.0.9_old/3204_mangos_7796_01_world_command.sql new file mode 100644 index 0000000..4d87bf0 --- /dev/null +++ b/sql/updates/3.0.9_old/3204_mangos_7796_01_world_command.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7782_01_mangos_spell_proc_event required_7796_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('go taxinode','lookup taxinode'); +INSERT INTO `command` VALUES +('go taxinode',1,'Syntax: .go taxinode #taxinode\r\n\r\nTeleport player to taxinode coordinates. You can look up zone using .lookup taxinode $namepart'), +('lookup taxinode',3,'Syntax: .lookup taxinode $substring\r\n\r\nSearch and output all taxinodes with provide $substring in name.'); diff --git a/sql/updates/3.0.9_old/3204_mangos_7796_02_world_trinity_string.sql b/sql/updates/3.0.9_old/3204_mangos_7796_02_world_trinity_string.sql new file mode 100644 index 0000000..a1c0e32 --- /dev/null +++ b/sql/updates/3.0.9_old/3204_mangos_7796_02_world_trinity_string.sql @@ -0,0 +1,8 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7796_01_mangos_command required_7796_02_mangos_mangos_string bit;*/ + +DELETE FROM trinity_string WHERE entry IN(347,466,1128,1129); +INSERT INTO trinity_string VALUES +(347,'TaxiNode ID %u not found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(466,'No taxinodes found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1128,'%d - |cffffffff|Htaxinode:%u|h[%s %s]|h|r (Map:%u X:%f Y:%f Z:%f)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(1129,'%d - %s %s (Map:%u X:%f Y:%f Z:%f)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/3210_mangos_7802_01_characters_character_achievement.sql b/sql/updates/3.0.9_old/3210_mangos_7802_01_characters_character_achievement.sql new file mode 100644 index 0000000..4039b5a --- /dev/null +++ b/sql/updates/3.0.9_old/3210_mangos_7802_01_characters_character_achievement.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7644_01_characters_character_pet required_7802_01_characters_character_achievement bit;*/ + +ALTER TABLE character_achievement + CHANGE COLUMN guid guid int(11) unsigned NOT NULL, + CHANGE COLUMN achievement achievement int(11) unsigned NOT NULL, + CHANGE COLUMN date date bigint(11) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.0.9_old/3210_mangos_7802_02_characters_character_achievement_progress.sql b/sql/updates/3.0.9_old/3210_mangos_7802_02_characters_character_achievement_progress.sql new file mode 100644 index 0000000..6e525f8 --- /dev/null +++ b/sql/updates/3.0.9_old/3210_mangos_7802_02_characters_character_achievement_progress.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7802_01_characters_character_achievement required_7802_02_characters_character_achievement_progress bit;*/ + +ALTER TABLE character_achievement_progress + CHANGE COLUMN guid guid int(11) unsigned NOT NULL, + CHANGE COLUMN criteria criteria int(11) unsigned NOT NULL, + CHANGE COLUMN counter counter int(11) unsigned NOT NULL, + CHANGE COLUMN date date bigint(11) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.0.9_old/3233_world_scripts_naxx.sql b/sql/updates/3.0.9_old/3233_world_scripts_naxx.sql new file mode 100644 index 0000000..ddb18bd --- /dev/null +++ b/sql/updates/3.0.9_old/3233_world_scripts_naxx.sql @@ -0,0 +1,113 @@ +UPDATE `creature_template` SET `ScriptName`='mob_webwrap' WHERE `entry`=16486; +UPDATE `creature_template` SET `ScriptName`='boss_grobbulus' WHERE entry = 15931; +UPDATE `creature_template` SET `ScriptName`='mob_gothik_minion' WHERE entry IN (16124,16125,16126,16127,16148,16149,16150); +UPDATE `creature_template` SET `ScriptName`='boss_four_horsemen' WHERE `entry` IN (16063,16064,16065,30549); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN +(28732,54097,-29865,-55053,-28169,28059,39088,-28059,-39088,28062,39090,28084, +39091,-28084,-39091,28085,39093); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 28732,-28798, 1, 'Widow\'s Embrace - Frenzy'), +( 54097,-54100, 1, 'Widow\'s Embrace - Frenzy (H)'), +(-29865, 55594, 0, 'Deathbloom'), +(-55053, 55601, 0, 'Deathbloom (H)'), +(-28169, 28206, 0, 'Mutating Injection - Mutagen Explosion'), +(-28169, 28240, 0, 'Mutating Injection - Poison Cloud'), +( 28059,-28084, 1, 'Positive Charge - Negative Charge'), +(-28059,-29659, 0, 'Positive Charge'), +# ( 28062,-29659, 0, 'Positive Charge'), +( 28084,-28059, 1, 'Negative Charge - Positive Charge'), +(-28084,-29660, 0, 'Negative Charge'), +# ( 28085,-29660, 0, 'Negative Charge'), +( 39088,-39091, 1, 'Positive Charge - Negative Charge'), +(-39088,-29659, 0, 'Positive Charge'), +# ( 39090,-29659, 0, 'Positive Charge'), +( 39091,-39088, 1, 'Negative Charge - Positive Charge'), +(-39091,-39092, 0, 'Negative Charge'); +# ( 39093,-39092, 0, 'Negative Charge'); + +INSERT INTO creature_template (entry, spell1, flags_extra, scriptname) VALUES +(16363, 28158, 128, ''), # Grobbulus Cloud +(29379, 54362, 128, ''), # Grobbulus Cloud (H) +(16697, 28158, 128, ''), # Void Zone +(29379, 54362, 128, '') # Void Zone (H) +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +flags_extra = VALUES(flags_extra), +scriptname = VALUES(scriptname); + +INSERT INTO creature_template (entry, baseattacktime, spell1, flags_extra, scriptname) VALUES +(16474, 1000, 28547, 128, 'trigger_periodic'), # Blizzard (Sapphiron) +(30000, 1000, 55699, 128, 'trigger_periodic'), # Blizzard (Sapphiron) (H) +(16697, 1000, 28865, 128, 'trigger_periodic') # Void Zone (Lady Blaumeux) +ON DUPLICATE KEY UPDATE +baseattacktime = VALUES(baseattacktime), +spell1 = VALUES(spell1), +flags_extra = VALUES(flags_extra), +scriptname = VALUES(scriptname); + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (29912); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_id`, `cast_flags`) VALUES +(29912, 55479, 0, 1); # Obedience Crystal - Force Obedience + +DELETE FROM `spell_script_target` WHERE `entry` IN +(28732,54097,55479, +27892,27893,27928,27929,27935,27936); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(28732, 1, 15953), # Widow's Embrace +(54097, 1, 15953), # Widow's Embrace +(55479, 1, 16803), # Force Obedience - Death Knight Understudy +# (29105, 1, 16803), # Hopeless - Death Knight Understudy +(27892, 1, 16060), # To Anchor 1 - Gothik +(27893, 1, 16060), # To Anchor 2 - Gothik +(27928, 1, 16060), # To Anchor 1 - Gothik +(27929, 1, 16060), # To Anchor 2 - Gothik +(27935, 1, 16060), # To Anchor 1 - Gothik +(27936, 1, 16060); # To Anchor 2 - Gothik + +INSERT INTO creature_template (entry, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8) VALUES +(16573, 15284, 28991, 28969, 34970, 0, 0, 0, 28864), # Crypt Guard +(29256, 15284, 28991, 56098, 34970, 0, 0, 0, 28864), # Crypt Guard (H) +(16506, 54095, 0, 0, 0, 0, 0, 0, 28732), # Naxxramas Worshipper +(29274, 54096, 0, 0, 0, 0, 0, 0, 54097), # Naxxramas Worshipper (H) +(17055, 54121, 0, 0, 0, 0, 0, 0, 0), # Maexxna Spiderling +(29279, 28776, 0, 0, 0, 0, 0, 0, 0), # Maexxna Spiderling (H) +(16486, 28622, 0, 0, 0, 0, 0, 0, 0), # Web Wrap +(30183, 28622, 0, 0, 0, 0, 0, 0, 0), # Web Wrap (H) +(16984, 15496, 0, 0, 0, 0, 0, 0, 0), # Plagued Warrior +(29632, 15496, 0, 0, 0, 0, 0, 0, 0), # Plagued Warrior (H) +(16983, 32736, 30138, 0, 0, 0, 0, 0, 0), # Plagued Champion +(29632, 32736, 54889, 0, 0, 0, 0, 0, 0), # Plagued Champion (H) +(16981, 15496, 54890, 0, 0, 0, 0, 0, 0), # Plagued Guardian +(29632, 15496, 54891, 0, 0, 0, 0, 0, 0), # Plagued Guardian (H) +(16286, 0, 0, 0, 0, 0, 0, 0, 29232), # Spore +(30068, 0, 0, 0, 0, 0, 0, 0, 29232), # Spore (H) +(16290, 28156, 0, 0, 0, 0, 0, 0, 0), # Fallout Slime +(29388, 54367, 0, 0, 0, 0, 0, 0, 0), # Fallout Slime (H) +(16360, 29307, 0, 0, 0, 0, 0, 0, 0), # Zombie Chow +(30303, 29307, 0, 0, 0, 0, 0, 0, 0), # Zombie Chow (H) +(16803, 0, 0, 0, 61696, 29060, 29061, 0, 0), # Death Knight Understudy +(29941, 0, 0, 0, 61696, 29060, 29061, 0, 0), # Death Knight Understudy (H) +(16124, 55604, 0, 0, 0, 0, 0, 0, 27892), # Unrelenting Trainee +(16125, 27825, 0, 0, 0, 0, 0, 0, 27928), # Unrelenting Death Knight +(16126, 27831, 55606, 0, 0, 0, 0, 0, 27935), # Unrelenting Rider +(16127, 27989, 0, 0, 0, 0, 0, 0, 0), # Spectral Trainee +(16148, 56408, 0, 0, 0, 0, 0, 0, 0), # Spectral Death Knight +(16150, 27994, 55648, 55606, 0, 0, 0, 0, 0), # Spectral Rider +(16149, 27993, 0, 0, 0, 0, 0, 0, 0), # Spectral Horse +(29985, 55645, 0, 0, 0, 0, 0, 0, 27892), # Unrelenting Trainee (H) +(29986, 27825, 0, 0, 0, 0, 0, 0, 27928), # Unrelenting Death Knight (H) +(29987, 55638, 55608, 0, 0, 0, 0, 0, 27935), # Unrelenting Rider (H) +(30264, 56407, 0, 0, 0, 0, 0, 0, 0), # Spectral Trainee (H) +(29990, 56408, 0, 0, 0, 0, 0, 0, 0), # Spectral Death Knight (H) +(29988, 55646, 27995, 55608, 0, 0, 0, 0, 0), # Spectral Rider (H) +(29989, 27993, 0, 0, 0, 0, 0, 0, 0) # Spectral Horse (H) +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +spell2 = VALUES(spell2), +spell3 = VALUES(spell3), +spell4 = VALUES(spell4), +spell5 = VALUES(spell5), +spell6 = VALUES(spell6), +spell7 = VALUES(spell7), +spell8 = VALUES(spell8); diff --git a/sql/updates/3.0.9_old/3235_characters.sql b/sql/updates/3.0.9_old/3235_characters.sql new file mode 100644 index 0000000..814b2dd --- /dev/null +++ b/sql/updates/3.0.9_old/3235_characters.sql @@ -0,0 +1,4 @@ +DELETE FROM `character_action` WHERE `type` = 0 AND `action` = 28734; +DELETE FROM `character_aura` WHERE `spell` = 28734; +DELETE FROM `character_spell` WHERE `spell` = 28734; +DELETE FROM `character_spell_cooldown` WHERE `spell` = 28734; diff --git a/sql/updates/3.0.9_old/3235_world.sql b/sql/updates/3.0.9_old/3235_world.sql new file mode 100644 index 0000000..fea9efe --- /dev/null +++ b/sql/updates/3.0.9_old/3235_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `playercreateinfo_action` WHERE `type` = 0 AND `action` = 28734; +DELETE FROM `playercreateinfo_spell` WHERE `spell` = 28734; +DELETE FROM `playercreateinfo_spell_custom` WHERE `spell` = 28734; +UPDATE `playercreateinfo_action` SET `button` = 3 WHERE `race` = 10 AND `class` IN (2, 3, 5, 8, 9) AND `action` = 28730 AND `type` = 0; +UPDATE `playercreateinfo_action` SET `button` = 4 WHERE `race` = 10 AND `class` = 4 AND `action` = 25046 AND `type` = 0; diff --git a/sql/updates/3.0.9_old/3257_world_waypoint_data_converter.sql b/sql/updates/3.0.9_old/3257_world_waypoint_data_converter.sql new file mode 100644 index 0000000..7da23dc --- /dev/null +++ b/sql/updates/3.0.9_old/3257_world_waypoint_data_converter.sql @@ -0,0 +1,15 @@ +ALTER TABLE creature_addon ADD INDEX ( `path_id` ); +ALTER TABLE waypoint_data ADD INDEX ( `id` ); + +ALTER TABLE waypoint_data ADD COLUMN id_old int(10) unsigned NOT NULL default '0' COMMENT 'Creature GUID' AFTER wpguid; + +UPDATE waypoint_data SET id_old=id; +ALTER TABLE waypoint_data ADD INDEX ( `id_old` ); + +UPDATE waypoint_data,creature_addon SET waypoint_data.id=creature_addon.guid*10 WHERE creature_addon.path_id > 0 AND creature_addon.path_id=waypoint_data.id_old; +UPDATE waypoint_data SET id = 1343801 WHERE id_old = 2084; +UPDATE waypoint_scripts SET datalong = 1343801 WHERE id = 515; + +ALTER TABLE waypoint_data DROP COLUMN id_old; +ALTER TABLE `creature_addon` DROP INDEX `path_id` ; +ALTER TABLE waypoint_data DROP INDEX `id`; diff --git a/sql/updates/3.0.9_old/3258_world_creature_addon_(waypoint).sql b/sql/updates/3.0.9_old/3258_world_creature_addon_(waypoint).sql new file mode 100644 index 0000000..69937b2 --- /dev/null +++ b/sql/updates/3.0.9_old/3258_world_creature_addon_(waypoint).sql @@ -0,0 +1,2 @@ +ALTER TABLE creature_template_addon DROP COLUMN path_id; +ALTER TABLE creature_addon DROP COLUMN path_id; diff --git a/sql/updates/3.0.9_old/3263_world_scripts_missing_in_full.sql b/sql/updates/3.0.9_old/3263_world_scripts_missing_in_full.sql new file mode 100644 index 0000000..aab3dea --- /dev/null +++ b/sql/updates/3.0.9_old/3263_world_scripts_missing_in_full.sql @@ -0,0 +1,14 @@ +UPDATE creature_template SET ScriptName='npc_kingdom_of_dalaran_quests' WHERE entry IN (29169,23729,26673,27158,29158,29161,26471,29155,29159,29160,29162); +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_nadox' WHERE `entry` = 29309; +UPDATE `creature_template` SET `ScriptName` = 'mob_ahnkahar_nerubian' WHERE `entry` in (30176,30178); +UPDATE `instance_template` SET `script`= 'instance_ahnkahet' WHERE `map` = 619; +update creature_template set scriptname = 'mob_parasitic_shadowfiend' where entry = 23498; +UPDATE `creature_template` SET `ScriptName`='npc_aeranas' WHERE `entry`=17085; +UPDATE `gameobject_template` SET `ScriptName`='go_haaleshi_altar' WHERE `entry`=181606; +UPDATE `creature_template` SET `ScriptName`='npc_commander_dawnforge' WHERE `entry`=19831; +UPDATE creature_template SET scriptname = 'boss_kalecgos' WHERE entry = 24850; +UPDATE creature_template SET scriptname = 'boss_sathrovarr' WHERE entry = 24892; +UPDATE creature_template SET scriptname = 'boss_kalec' WHERE entry = 24891; +UPDATE creature_template SET scriptname = 'npc_blackhole' WHERE entry = 25855; +UPDATE creature_template SET scriptname = 'boss_archavon' WHERE entry = 31125; +UPDATE creature_template SET scriptname = 'mob_archavon_warder' WHERE entry = 32353; diff --git a/sql/updates/3.0.9_old/3314_mangos_7823_01_world_item_template.sql b/sql/updates/3.0.9_old/3314_mangos_7823_01_world_item_template.sql new file mode 100644 index 0000000..eb2b40a --- /dev/null +++ b/sql/updates/3.0.9_old/3314_mangos_7823_01_world_item_template.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7796_02_mangos_mangos_string required_7823_01_mangos_item_template bit;*/ + +ALTER TABLE item_template +CHANGE COLUMN ScalingStatValue ScalingStatValue int(6) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.0.9_old/3320_worldspell_enchant_proc_data.sql b/sql/updates/3.0.9_old/3320_worldspell_enchant_proc_data.sql new file mode 100644 index 0000000..7f5df5e --- /dev/null +++ b/sql/updates/3.0.9_old/3320_worldspell_enchant_proc_data.sql @@ -0,0 +1,17 @@ +CREATE TABLE `spell_enchant_proc_data` ( + `entry` INT(10) UNSIGNED NOT NULL, + `customChance` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `PPMChance` FLOAT UNSIGNED NOT NULL DEFAULT '0', + `procEx` FLOAT UNSIGNED NOT NULL DEFAULT '0' +) ENGINE=MYISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Spell enchant proc data'; + +-- Frostbrand Weapon +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (2, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (12, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (524, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (1667, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (1668, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (2635, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (3782, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (3783, 0, 8.8,0); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES (3784, 0, 8.8,0); diff --git a/sql/updates/3.0.9_old/3323_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3323_world_spell_proc_event.sql new file mode 100644 index 0000000..e1ed164 --- /dev/null +++ b/sql/updates/3.0.9_old/3323_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +-- Glyph of Ice Block -- +DELETE FROM `spell_proc_event` WHERE `entry` = 56372; +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(56372, 0x00, 3, 0x00000000, 0x00000080, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/3331_world_spell.sql b/sql/updates/3.0.9_old/3331_world_spell.sql new file mode 100644 index 0000000..bbad179 --- /dev/null +++ b/sql/updates/3.0.9_old/3331_world_spell.sql @@ -0,0 +1,6 @@ +DELETE FROM spell_script_target WHERE targetentry IN (8313,38968,21934); +DELETE FROM spell_proc_event WHERE entry in (19615); + +UPDATE creature_template SET spell2 = 0 WHERE entry IN (16474,30000); +UPDATE gameobject_template SET scriptname = 'go_najentus_spine' WHERE entry = 185584; +UPDATE gameobject_template SET scriptname = 'go_bridge_console' WHERE entry = 184568; diff --git a/sql/updates/3.0.9_old/3358_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/3358_world_spell_bonus_data.sql new file mode 100644 index 0000000..e2cb0aa --- /dev/null +++ b/sql/updates/3.0.9_old/3358_world_spell_bonus_data.sql @@ -0,0 +1 @@ +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.6453' WHERE `spell_bonus_data`.`entry` =33763; diff --git a/sql/updates/3.0.9_old/3359_world_spell_linked_spell.sql b/sql/updates/3.0.9_old/3359_world_spell_linked_spell.sql new file mode 100644 index 0000000..284320a --- /dev/null +++ b/sql/updates/3.0.9_old/3359_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE spell_trigger = 33206; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 33206, 44416, 2, 'Pain Suppression (threat)'); diff --git a/sql/updates/3.0.9_old/3363_characters_characters.sql b/sql/updates/3.0.9_old/3363_characters_characters.sql new file mode 100644 index 0000000..121e534 --- /dev/null +++ b/sql/updates/3.0.9_old/3363_characters_characters.sql @@ -0,0 +1 @@ +ALTER TABLE `characters` ADD COLUMN `instance_id` int(11) unsigned NOT NULL default '0' AFTER `map`; diff --git a/sql/updates/3.0.9_old/3373_world_spell.sql b/sql/updates/3.0.9_old/3373_world_spell.sql new file mode 100644 index 0000000..23fe9ba --- /dev/null +++ b/sql/updates/3.0.9_old/3373_world_spell.sql @@ -0,0 +1,2 @@ +DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (38528); +DELETE FROM spell_proc_event WHERE `entry` IN (31785, 33776); diff --git a/sql/updates/3.0.9_old/3375_mangos_7839_01_world_trinity_string.sql b/sql/updates/3.0.9_old/3375_mangos_7839_01_world_trinity_string.sql new file mode 100644 index 0000000..6c7c9b4 --- /dev/null +++ b/sql/updates/3.0.9_old/3375_mangos_7839_01_world_trinity_string.sql @@ -0,0 +1,4 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (283,171,5011); +INSERT INTO `trinity_string` VALUES +(171,'You can\'t teleport self to self!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(5011,'You can\'t teleport self to self!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.0.9_old/3375_mangos_7839_02_world_command.sql b/sql/updates/3.0.9_old/3375_mangos_7839_02_world_command.sql new file mode 100644 index 0000000..f8c09af --- /dev/null +++ b/sql/updates/3.0.9_old/3375_mangos_7839_02_world_command.sql @@ -0,0 +1,22 @@ +/* ALTER TABLE db_version CHANGE COLUMN required_7839_01_mangos_mangos_string required_7839_02_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ( + 'baninfo account','baninfo character','baninfo ip','goname','groupgo', + 'guild create','guild invite','guild rank','guild uninvite','mute', + 'namego','tele name','unmute' +); + +INSERT INTO `command` VALUES +('baninfo account',3,'Syntax: .baninfo account $accountid\r\nWatch full information about a specific ban.'), +('baninfo character',3,'Syntax: .baninfo character $charactername \r\nWatch full information about a specific ban.'), +('baninfo ip',3,'Syntax: .baninfo ip $ip\r\nWatch full information about a specific ban.'), +('goname',1,'Syntax: .goname [$charactername]\r\n\r\nTeleport to the given character. Either specify the character name or click on the character\'s portrait, e.g. when you are in a group. Character can be offline.'), +('groupgo',1,'Syntax: .groupgo [$charactername]\r\n\r\nTeleport the given character and his group to you. Teleported only online characters but original selected group member can be offline.'), +('guild create',2,'Syntax: .guild create [$GuildLeaderName] $GuildName\r\n\r\nCreate a guild named $GuildName with the player $GuildLeaderName (or selected) as leader.'), +('guild invite',2,'Syntax: .guild invite [$CharacterName] $GuildName\r\n\r\nAdd player $CharacterName (or selected) into a guild $GuildName.'), +('guild rank',2,'Syntax: .guild rank [$CharacterName] #Rank\r\n\r\nSet for player $CharacterName (or selected) rank #Rank in a guild.'), +('guild uninvite',2,'Syntax: .guild uninvite [$CharacterName]\r\n\r\nRemove player $CharacterName (or selected) from a guild.'), +('mute',1,'Syntax: .mute [$playerName] $timeInMinutes\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'), +('namego',1,'Syntax: .namego [$charactername]\r\n\r\nTeleport the given character to you. Character can be offline.'), +('tele name',1,'Syntax: .tele name [#playername] #location\r\n\r\nTeleport the given character to a given location. Character can be offline.'), +('unmute',1,'Syntax: .unmute [$playerName]\r\n\r\nRestore chat messaging for any character from account of character $playerName (or selected). Character can be ofline.'); diff --git a/sql/updates/3.0.9_old/3392_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3392_world_spell_proc_event.sql new file mode 100644 index 0000000..d0965c1 --- /dev/null +++ b/sql/updates/3.0.9_old/3392_world_spell_proc_event.sql @@ -0,0 +1,20 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN +(27521, 55381, 62459, 60176, 60529, 60717, 62147, 57907, 51528, 51529, 51530, 51531, 51532); +INSERT INTO `spell_proc_event` +(`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) +VALUES +-- malestorm weapon +(51528, 0, 0, 0, 0, 0, 0, 0, 2.5, 0, 0), +(51529, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0), +(51530, 0, 0, 0, 0, 0, 0, 0, 7.5, 0, 0), +(51531, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0), +(51532, 0, 0, 0, 0, 0, 0, 0, 12.5, 0, 0), + +(27521, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 15), +(55381, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0.000000, 0.000000, 15), +(62459, 0x00, 15, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60176, 0x00, 4, 0x00000020, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(60529, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 45), +(60717, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 100.000000, 0), +(62147, 0x00, 15, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(57907, 0x00, 7, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/3393_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3393_world_spell_proc_event.sql new file mode 100644 index 0000000..7593080 --- /dev/null +++ b/sql/updates/3.0.9_old/3393_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (53651); diff --git a/sql/updates/3.0.9_old/3394_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/3394_world_spell_bonus_data.sql new file mode 100644 index 0000000..d960ae5 --- /dev/null +++ b/sql/updates/3.0.9_old/3394_world_spell_bonus_data.sql @@ -0,0 +1,10 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (48505,50288,50294,53191,53188,53194,53189,53195,53190); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +(50288, 0.05, 0, 0, 'Druid - Starfall rank 1'), +(50294, 0.012, 0, 0, 'Druid - Starfall AOE rank 1'), +(53191, 0.05, 0, 0, 'Druid - Starfall rank 2'), +(53188, 0.012, 0, 0, 'Druid - Starfall AOE rank 2'), +(53194, 0.05, 0, 0, 'Druid - Starfall rank 3'), +(53189, 0.012, 0, 0, 'Druid - Starfall AOE rank 3'), +(53195, 0.05, 0, 0, 'Druid - Starfall rank 4'), +(53190, 0.012, 0, 0, 'Druid - Starfall AOE rank 4'); diff --git a/sql/updates/3.0.9_old/3409_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3409_world_spell_proc_event.sql new file mode 100644 index 0000000..da24f66 --- /dev/null +++ b/sql/updates/3.0.9_old/3409_world_spell_proc_event.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (31878, 31877, 31876, 46913, 46914, 46915); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(31876, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31877, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(31878, 0, 10, 8388608, 0, 0, 0, 0, 0, 0, 0), +(46913, 0, 4, 0, 1024, 0, 0, 0, 0, 0, 0), +(46914, 0, 4, 0, 1024, 0, 0, 0, 0, 0, 0), +(46915, 0, 4, 0, 1024, 0, 0, 0, 0, 0, 0); diff --git a/sql/updates/3.0.9_old/3410_world_SD2_scripts.sql b/sql/updates/3.0.9_old/3410_world_SD2_scripts.sql new file mode 100644 index 0000000..9a54cea --- /dev/null +++ b/sql/updates/3.0.9_old/3410_world_SD2_scripts.sql @@ -0,0 +1,31 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_daphne_stilwell' WHERE `entry` = 6182; + +DELETE FROM `script_waypoint` WHERE `entry` = 6182; +INSERT INTO `script_waypoint` VALUES +(6182, 0, -11480.684570, 1545.091187, 49.898571, 0, ''), +(6182, 1, -11466.825195, 1530.151733, 50.263611, 0, ''), +(6182, 2, -11465.213867, 1528.343750, 50.954369, 0, 'entrance hut'), +(6182, 3, -11462.990234, 1525.235596, 50.937702, 0, ''), +(6182, 4, -11461.000000, 1526.614014, 50.937702, 5000, 'pick up rifle'), +(6182, 5, -11462.990234, 1525.235596, 50.937702, 0, ''), +(6182, 6, -11465.213867, 1528.343750, 50.954369, 0, ''), +(6182, 7, -11468.353516, 1535.075562, 50.400948, 15000, 'hold, prepare for wave1'), +(6182, 8, -11468.353516, 1535.075562, 50.400948, 15000, 'hold, prepare for wave2'), +(6182, 9, -11468.353516, 1535.075562, 50.400948, 10000, 'hold, prepare for wave3'), +(6182, 10, -11467.898438, 1532.459595, 50.348885, 0, 'we are done'), +(6182, 11, -11466.064453, 1529.855225, 50.209351, 0, ''), +(6182, 12, -11462.990234, 1525.235596, 50.937702, 0, ''), +(6182, 13, -11461.000000, 1526.614014, 50.937702, 5000, 'deliver rifle'), +(6182, 14, -11462.990234, 1525.235596, 50.937702, 0, ''), +(6182, 15, -11465.213867, 1528.343750, 50.954369, 0, ''), +(6182, 16, -11470.260742, 1537.276733, 50.378487, 0, ''), +(6182, 17, -11475.581055, 1548.678833, 50.184380, 0, 'complete quest'), +(6182, 18, -11482.299805, 1557.410034, 48.624519, 0, ''); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000406 AND -1000402; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1000402, 'To the house! Stay close to me, no matter what! I have my gun and ammo there!', 0, 0, 7, 0, 'stilwell SAY_DS_START'), +(-1000403, 'We showed that one!', 0, 0, 7, 0, 'stilwell SAY_DS_DOWN_1'), +(-1000404, 'One more down!', 0, 0, 7, 0, 'stilwell SAY_DS_DOWN_2'), +(-1000405, 'We\'ve done it! We won!', 0, 0, 7, 0, 'stilwell SAY_DS_DOWN_3'), +(-1000406, 'Meet me down by the orchard--I just need to put my gun away.', 0, 0, 7, 0, 'stilwell SAY_DS_PROLOGUE'); diff --git a/sql/updates/3.0.9_old/3414_mangos_7850_01_world_command.sql b/sql/updates/3.0.9_old/3414_mangos_7850_01_world_command.sql new file mode 100644 index 0000000..4a98543 --- /dev/null +++ b/sql/updates/3.0.9_old/3414_mangos_7850_01_world_command.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7839_02_mangos_command required_7850_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('character reputation','pinfo'); +INSERT INTO `command` VALUES +('pinfo',2,'Syntax: .pinfo [$player_name]\r\n\r\nOutput account information for selected player or player find by $player_name.'), +('character reputation',2,'Syntax: .character reputation [$player_name]\r\n\r\nShow reputation information for selected player or player find by $player_name.'); diff --git a/sql/updates/3.0.9_old/3416_mangos_7855_01_world_pools.sql b/sql/updates/3.0.9_old/3416_mangos_7855_01_world_pools.sql new file mode 100644 index 0000000..b692233 --- /dev/null +++ b/sql/updates/3.0.9_old/3416_mangos_7855_01_world_pools.sql @@ -0,0 +1,13 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7850_01_mangos_command required_7855_01_mangos_pools bit;*/ + +ALTER TABLE pool_creature + ADD COLUMN description varchar(255) NOT NULL AFTER chance; + +ALTER TABLE pool_gameobject + ADD COLUMN description varchar(255) NOT NULL AFTER chance; + +ALTER TABLE pool_pool + ADD COLUMN description varchar(255) NOT NULL AFTER chance; + +ALTER TABLE pool_template + ADD COLUMN description varchar(255) NOT NULL AFTER max_limit; diff --git a/sql/updates/3.0.9_old/3419_world_SD2_scripts.sql b/sql/updates/3.0.9_old/3419_world_SD2_scripts.sql new file mode 100644 index 0000000..103def1 --- /dev/null +++ b/sql/updates/3.0.9_old/3419_world_SD2_scripts.sql @@ -0,0 +1,51 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_oox22fe' WHERE `entry` = 7807; + +DELETE FROM `script_waypoint` WHERE `entry` = 7807; +INSERT INTO `script_waypoint` VALUES +(7807, 0, -4943.74, 1715.74, 62.74, 0, 'SAY_START'), +(7807, 1, -4944.93, 1706.66, 63.16, 0, ''), +(7807, 2, -4942.82, 1690.22, 64.25, 0, ''), +(7807, 3, -4946.47, 1669.62, 63.84, 0, ''), +(7807, 4, -4955.93, 1651.88, 63.00, 0, ''), +(7807, 5, -4967.58, 1643.86, 64.31, 0, ''), +(7807, 6, -4978.12, 1607.90, 64.30, 0, ''), +(7807, 7, -4975.38, 1596.16, 64.70, 0, ''), +(7807, 8, -4972.82, 1581.89, 61.75, 0, ''), +(7807, 9, -4958.65, 1581.05, 61.81, 0, ''), +(7807, 10, -4936.72, 1594.89, 65.96, 0, ''), +(7807, 11, -4885.69, 1598.10, 67.45, 4000, 'first ambush SAY_AMBUSH'), +(7807, 12, -4874.20, 1601.73, 68.54, 0, ''), +(7807, 13, -4816.64, 1594.47, 78.20, 0, ''), +(7807, 14, -4802.20, 1571.92, 87.01, 0, ''), +(7807, 15, -4746.40, 1576.11, 84.59, 0, ''), +(7807, 16, -4739.72, 1707.16, 94.04, 0, ''), +(7807, 17, -4674.03, 1840.44, 89.17, 0, ''), +(7807, 18, -4667.94, 1864.11, 85.18, 0, ''), +(7807, 19, -4668.08, 1886.39, 81.14, 0, ''), +(7807, 20, -4679.43, 1932.32, 73.76, 0, ''), +(7807, 21, -4674.17, 1946.66, 70.83, 5000, 'second ambush SAY_AMBUSH'), +(7807, 22, -4643.94, 1967.45, 65.27, 0, ''), +(7807, 23, -4595.60, 2010.75, 52.10, 0, ''), +(7807, 24, -4562.65, 2029.28, 45.41, 0, ''), +(7807, 25, -4538.56, 2032.65, 45.28, 0, ''), +(7807, 26, -4531.96, 2034.15, 48.34, 0, ''), +(7807, 27, -4507.75, 2039.32, 51.57, 0, ''), +(7807, 28, -4482.74, 2045.67, 48.15, 0, ''), +(7807, 29, -4460.87, 2051.54, 45.55, 0, ''), +(7807, 30, -4449.97, 2060.03, 45.51, 10000, 'third ambush SAY_AMBUSH'), +(7807, 31, -4448.99, 2079.05, 44.64, 0, ''), +(7807, 32, -4436.64, 2134.48, 28.83, 0, ''), +(7807, 33, -4429.25, 2170.20, 15.44, 0, ''), +(7807, 34, -4424.83, 2186.11, 11.48, 0, ''), +(7807, 35, -4416.71, 2209.76, 7.36, 0, ''), +(7807, 36, -4405.25, 2231.77, 5.94, 0, ''), +(7807, 37, -4377.61, 2265.45, 06.71, 15000, 'complete quest SAY_END'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1060005 AND -1060000; +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1060005, 'Cloaking systems online! CLUCK! Engaging cloak for transport to Booty Bay!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'oox17 SAY_END'), +(-1060004, 'No one challenges the wastevander nomads -- not even robotic chickens! ATTACK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'oox17 SAY_AMBUSH_REPLY'), +(-1060003, 'CLUCK! Sensors detect spatial anomaly -- danger imminent! CLUCK', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'oox17 SAY_AMBUSH'), +(-1060002, 'Threat analyzed! Activating combat plan beta! CLUCK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'oox17 SAY_AGGRO2'), +(-1060001, 'Physical threat detected! Evasive action! CLUCK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'oox17 SAY_AGGRO1'), +(-1060000, 'Emergency power activated! Initializing ambulatory motor! CLUCK!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'oox17 SAY_START'); diff --git a/sql/updates/3.0.9_old/3421_world_scripts.sql b/sql/updates/3.0.9_old/3421_world_scripts.sql new file mode 100644 index 0000000..b1f9f3e --- /dev/null +++ b/sql/updates/3.0.9_old/3421_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_taxi' WHERE `entry` IN (17435, 23413, 18725, 19401, 19409, 20235, 25059, 25236, 20903, 20162, 29154, 23415); diff --git a/sql/updates/3.0.9_old/3422_world_scripts.sql b/sql/updates/3.0.9_old/3422_world_scripts.sql new file mode 100644 index 0000000..7854f5d --- /dev/null +++ b/sql/updates/3.0.9_old/3422_world_scripts.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName='npc_karynaku' WHERE entry=22112; diff --git a/sql/updates/3.0.9_old/3423_world_scripts.sql b/sql/updates/3.0.9_old/3423_world_scripts.sql new file mode 100644 index 0000000..16b07bd --- /dev/null +++ b/sql/updates/3.0.9_old/3423_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_taxi' WHERE `entry` IN (27575, 26443, 26949); diff --git a/sql/updates/3.0.9_old/3424_world_scripts.sql b/sql/updates/3.0.9_old/3424_world_scripts.sql new file mode 100644 index 0000000..bd15ac0 --- /dev/null +++ b/sql/updates/3.0.9_old/3424_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_taxi' WHERE `entry`=23816; diff --git a/sql/updates/3.0.9_old/3427_world_scripts_naxx.sql b/sql/updates/3.0.9_old/3427_world_scripts_naxx.sql new file mode 100644 index 0000000..ddb18bd --- /dev/null +++ b/sql/updates/3.0.9_old/3427_world_scripts_naxx.sql @@ -0,0 +1,113 @@ +UPDATE `creature_template` SET `ScriptName`='mob_webwrap' WHERE `entry`=16486; +UPDATE `creature_template` SET `ScriptName`='boss_grobbulus' WHERE entry = 15931; +UPDATE `creature_template` SET `ScriptName`='mob_gothik_minion' WHERE entry IN (16124,16125,16126,16127,16148,16149,16150); +UPDATE `creature_template` SET `ScriptName`='boss_four_horsemen' WHERE `entry` IN (16063,16064,16065,30549); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN +(28732,54097,-29865,-55053,-28169,28059,39088,-28059,-39088,28062,39090,28084, +39091,-28084,-39091,28085,39093); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 28732,-28798, 1, 'Widow\'s Embrace - Frenzy'), +( 54097,-54100, 1, 'Widow\'s Embrace - Frenzy (H)'), +(-29865, 55594, 0, 'Deathbloom'), +(-55053, 55601, 0, 'Deathbloom (H)'), +(-28169, 28206, 0, 'Mutating Injection - Mutagen Explosion'), +(-28169, 28240, 0, 'Mutating Injection - Poison Cloud'), +( 28059,-28084, 1, 'Positive Charge - Negative Charge'), +(-28059,-29659, 0, 'Positive Charge'), +# ( 28062,-29659, 0, 'Positive Charge'), +( 28084,-28059, 1, 'Negative Charge - Positive Charge'), +(-28084,-29660, 0, 'Negative Charge'), +# ( 28085,-29660, 0, 'Negative Charge'), +( 39088,-39091, 1, 'Positive Charge - Negative Charge'), +(-39088,-29659, 0, 'Positive Charge'), +# ( 39090,-29659, 0, 'Positive Charge'), +( 39091,-39088, 1, 'Negative Charge - Positive Charge'), +(-39091,-39092, 0, 'Negative Charge'); +# ( 39093,-39092, 0, 'Negative Charge'); + +INSERT INTO creature_template (entry, spell1, flags_extra, scriptname) VALUES +(16363, 28158, 128, ''), # Grobbulus Cloud +(29379, 54362, 128, ''), # Grobbulus Cloud (H) +(16697, 28158, 128, ''), # Void Zone +(29379, 54362, 128, '') # Void Zone (H) +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +flags_extra = VALUES(flags_extra), +scriptname = VALUES(scriptname); + +INSERT INTO creature_template (entry, baseattacktime, spell1, flags_extra, scriptname) VALUES +(16474, 1000, 28547, 128, 'trigger_periodic'), # Blizzard (Sapphiron) +(30000, 1000, 55699, 128, 'trigger_periodic'), # Blizzard (Sapphiron) (H) +(16697, 1000, 28865, 128, 'trigger_periodic') # Void Zone (Lady Blaumeux) +ON DUPLICATE KEY UPDATE +baseattacktime = VALUES(baseattacktime), +spell1 = VALUES(spell1), +flags_extra = VALUES(flags_extra), +scriptname = VALUES(scriptname); + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (29912); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_id`, `cast_flags`) VALUES +(29912, 55479, 0, 1); # Obedience Crystal - Force Obedience + +DELETE FROM `spell_script_target` WHERE `entry` IN +(28732,54097,55479, +27892,27893,27928,27929,27935,27936); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(28732, 1, 15953), # Widow's Embrace +(54097, 1, 15953), # Widow's Embrace +(55479, 1, 16803), # Force Obedience - Death Knight Understudy +# (29105, 1, 16803), # Hopeless - Death Knight Understudy +(27892, 1, 16060), # To Anchor 1 - Gothik +(27893, 1, 16060), # To Anchor 2 - Gothik +(27928, 1, 16060), # To Anchor 1 - Gothik +(27929, 1, 16060), # To Anchor 2 - Gothik +(27935, 1, 16060), # To Anchor 1 - Gothik +(27936, 1, 16060); # To Anchor 2 - Gothik + +INSERT INTO creature_template (entry, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8) VALUES +(16573, 15284, 28991, 28969, 34970, 0, 0, 0, 28864), # Crypt Guard +(29256, 15284, 28991, 56098, 34970, 0, 0, 0, 28864), # Crypt Guard (H) +(16506, 54095, 0, 0, 0, 0, 0, 0, 28732), # Naxxramas Worshipper +(29274, 54096, 0, 0, 0, 0, 0, 0, 54097), # Naxxramas Worshipper (H) +(17055, 54121, 0, 0, 0, 0, 0, 0, 0), # Maexxna Spiderling +(29279, 28776, 0, 0, 0, 0, 0, 0, 0), # Maexxna Spiderling (H) +(16486, 28622, 0, 0, 0, 0, 0, 0, 0), # Web Wrap +(30183, 28622, 0, 0, 0, 0, 0, 0, 0), # Web Wrap (H) +(16984, 15496, 0, 0, 0, 0, 0, 0, 0), # Plagued Warrior +(29632, 15496, 0, 0, 0, 0, 0, 0, 0), # Plagued Warrior (H) +(16983, 32736, 30138, 0, 0, 0, 0, 0, 0), # Plagued Champion +(29632, 32736, 54889, 0, 0, 0, 0, 0, 0), # Plagued Champion (H) +(16981, 15496, 54890, 0, 0, 0, 0, 0, 0), # Plagued Guardian +(29632, 15496, 54891, 0, 0, 0, 0, 0, 0), # Plagued Guardian (H) +(16286, 0, 0, 0, 0, 0, 0, 0, 29232), # Spore +(30068, 0, 0, 0, 0, 0, 0, 0, 29232), # Spore (H) +(16290, 28156, 0, 0, 0, 0, 0, 0, 0), # Fallout Slime +(29388, 54367, 0, 0, 0, 0, 0, 0, 0), # Fallout Slime (H) +(16360, 29307, 0, 0, 0, 0, 0, 0, 0), # Zombie Chow +(30303, 29307, 0, 0, 0, 0, 0, 0, 0), # Zombie Chow (H) +(16803, 0, 0, 0, 61696, 29060, 29061, 0, 0), # Death Knight Understudy +(29941, 0, 0, 0, 61696, 29060, 29061, 0, 0), # Death Knight Understudy (H) +(16124, 55604, 0, 0, 0, 0, 0, 0, 27892), # Unrelenting Trainee +(16125, 27825, 0, 0, 0, 0, 0, 0, 27928), # Unrelenting Death Knight +(16126, 27831, 55606, 0, 0, 0, 0, 0, 27935), # Unrelenting Rider +(16127, 27989, 0, 0, 0, 0, 0, 0, 0), # Spectral Trainee +(16148, 56408, 0, 0, 0, 0, 0, 0, 0), # Spectral Death Knight +(16150, 27994, 55648, 55606, 0, 0, 0, 0, 0), # Spectral Rider +(16149, 27993, 0, 0, 0, 0, 0, 0, 0), # Spectral Horse +(29985, 55645, 0, 0, 0, 0, 0, 0, 27892), # Unrelenting Trainee (H) +(29986, 27825, 0, 0, 0, 0, 0, 0, 27928), # Unrelenting Death Knight (H) +(29987, 55638, 55608, 0, 0, 0, 0, 0, 27935), # Unrelenting Rider (H) +(30264, 56407, 0, 0, 0, 0, 0, 0, 0), # Spectral Trainee (H) +(29990, 56408, 0, 0, 0, 0, 0, 0, 0), # Spectral Death Knight (H) +(29988, 55646, 27995, 55608, 0, 0, 0, 0, 0), # Spectral Rider (H) +(29989, 27993, 0, 0, 0, 0, 0, 0, 0) # Spectral Horse (H) +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +spell2 = VALUES(spell2), +spell3 = VALUES(spell3), +spell4 = VALUES(spell4), +spell5 = VALUES(spell5), +spell6 = VALUES(spell6), +spell7 = VALUES(spell7), +spell8 = VALUES(spell8); diff --git a/sql/updates/3.0.9_old/3433_world.sql b/sql/updates/3.0.9_old/3433_world.sql new file mode 100644 index 0000000..0d5b0ee --- /dev/null +++ b/sql/updates/3.0.9_old/3433_world.sql @@ -0,0 +1,10 @@ +UPDATE `instance_template` SET `script` = 'instance_ramparts' WHERE `map` = 543; + +UPDATE `creature_template` SET `ScriptName` = 'npc_alexstrasza_wr_gate' WHERE `entry` = 31333; + +UPDATE `creature_template` SET `ScriptName` = 'npc_mist' WHERE `entry` = 3568; + +DELETE FROM `script_texts` WHERE `entry` IN (-1000411, -1000412); +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000411, 'Mist! I feared I would never see you again! Yes, I am well, do not worry for me. You must rest and recover your health.', 0, 0, 7, 0, 'mist SAY_AT_HOME'), +(-1000412, 'growls in acknowledgement before straightening and making her way off into the forest.', 0, 2, 0, 0, 'mist EMOTE_AT_HOME'); diff --git a/sql/updates/3.0.9_old/3451_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3451_world_spell_proc_event.sql new file mode 100644 index 0000000..480fcf4 --- /dev/null +++ b/sql/updates/3.0.9_old/3451_world_spell_proc_event.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (20177, 20179, 20181, 20180, 20182); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(20177, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0), +(20179, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0), +(20181, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0), +(20180, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0), +(20182, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (50720); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 50720, 59665, 0, 'Vigilance (redirect threat)'); diff --git a/sql/updates/3.0.9_old/3466_world_scripts_wintergrasp.sql b/sql/updates/3.0.9_old/3466_world_scripts_wintergrasp.sql new file mode 100644 index 0000000..b514fb3 --- /dev/null +++ b/sql/updates/3.0.9_old/3466_world_scripts_wintergrasp.sql @@ -0,0 +1,19 @@ +DELETE FROM `spell_script_target` WHERE entry IN +(56575,56661,56663,56665,56667,56669,61408); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(56575, 1, 27852), +(56661, 1, 27852), +(56663, 1, 27852), +(56665, 1, 27852), +(56667, 1, 27852), +(56669, 1, 27852), +(61408, 1, 27852); + + +update creature_template set maxhealth = 133525, minhealth = 133525, maxmana = 51360, minmana = 51360, spell1 = 53114, spell2 = 53112, spell3=53110 where entry = 28670; +update creature_template set maxhealth = 30000, minhealth = 30000, speed = 2, spell1=50025, spell2=50989, VehicleId = 36 where entry = 27881; +update creature_template set maxhealth = 50000, minhealth = 50000, speed = 1.6, spell1=50896, spell2=50652, VehicleId = 106 where entry = 28094; +update creature_template set maxhealth = 75000, minhealth = 75000, speed = 1, spell1=51678, VehicleId = 117 where entry IN (28312,32627); +update creature_template set maxhealth = 50000, minhealth = 50000, spell1=51362, VehicleId = 116 where entry IN (28319,32629); + +update creature_template set scriptname = "npc_demolisher_engineerer" where entry in (30400,30499); diff --git a/sql/updates/3.0.9_old/3467_world_spellclick_dk.sql b/sql/updates/3.0.9_old/3467_world_spellclick_dk.sql new file mode 100644 index 0000000..a3f3ac9 --- /dev/null +++ b/sql/updates/3.0.9_old/3467_world_spellclick_dk.sql @@ -0,0 +1,7 @@ +ALTER TABLE `npc_spellclick_spells` + ADD COLUMN `quest_status` int(11) UNSIGNED NOT NULL DEFAULT 3 COMMENT 'Quest status: 3 incompleted, 1 completed/rewarded' AFTER `quest_id`; + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN ('29501', '29488'); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_id`, `quest_status`, `cast_flags`) VALUES +('29488', '54568', '12670', '1', '3'), +('29501', '54575', '12670', '1', '3'); diff --git a/sql/updates/3.0.9_old/3498_world_scripts.sql b/sql/updates/3.0.9_old/3498_world_scripts.sql new file mode 100644 index 0000000..2a39f2b --- /dev/null +++ b/sql/updates/3.0.9_old/3498_world_scripts.sql @@ -0,0 +1,12 @@ +UPDATE creature_template SET VehicleId = 312 WHERE entry IN (31857,31858,31861,31862,32212,32213,32633,32640); +UPDATE creature_template SET VehicleId = 174 WHERE entry IN (31125,31722); + +DELETE FROM `spell_linked_spell` WHERE spell_trigger IN (58666,60882); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 58666, 58672, 1, 'Impale (Archavon)'), +( 60882, 58672, 1, 'Impale (Archavon)'); + +DELETE FROM `spell_script_target` WHERE entry IN +(58672); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(58672, 1, 31125); diff --git a/sql/updates/3.0.9_old/3500_mangos_7879_01_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3500_mangos_7879_01_world_spell_proc_event.sql new file mode 100644 index 0000000..9a216e3 --- /dev/null +++ b/sql/updates/3.0.9_old/3500_mangos_7879_01_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7855_01_mangos_pools required_7879_01_mangos_spell_proc_event bit;*/ + +DELETE FROM spell_proc_event WHERE entry IN (31571, 31572); +INSERT INTO spell_proc_event VALUES +(31571, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(31572, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.0.9_old/3508_mangos_7886_01_world_petcreateinfo_spell.sql b/sql/updates/3.0.9_old/3508_mangos_7886_01_world_petcreateinfo_spell.sql new file mode 100644 index 0000000..6adcc12 --- /dev/null +++ b/sql/updates/3.0.9_old/3508_mangos_7886_01_world_petcreateinfo_spell.sql @@ -0,0 +1,3 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7884_02_mangos_playercreateinfo_action required_7886_01_mangos_petcreateinfo_spell bit;*/ + +DROP TABLE IF EXISTS `petcreateinfo_spell`; diff --git a/sql/updates/3.0.9_old/3508_mangos_7887_01_characters_character_pet.sql b/sql/updates/3.0.9_old/3508_mangos_7887_01_characters_character_pet.sql new file mode 100644 index 0000000..4b0052c --- /dev/null +++ b/sql/updates/3.0.9_old/3508_mangos_7887_01_characters_character_pet.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7884_05_characters_character_action required_7887_01_characters_character_pet bit;*/ + +ALTER TABLE `character_pet` + DROP TeachSpelldata; diff --git a/sql/updates/3.0.9_old/3535_TC1_1509_world_scripts.sql b/sql/updates/3.0.9_old/3535_TC1_1509_world_scripts.sql new file mode 100644 index 0000000..1dcf150 --- /dev/null +++ b/sql/updates/3.0.9_old/3535_TC1_1509_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'kalecgos_teleporter' WHERE `entry`=187055; +UPDATE `creature_template` SET `ScriptName` = 'boss_kalecgos_kj' WHERE `entry`=25319; diff --git a/sql/updates/3.0.9_old/3576_world_spell_script_target.sql b/sql/updates/3.0.9_old/3576_world_spell_script_target.sql new file mode 100644 index 0000000..37d786b --- /dev/null +++ b/sql/updates/3.0.9_old/3576_world_spell_script_target.sql @@ -0,0 +1,8 @@ +-- Teleports in dk starting area +DELETE FROM `spell_script_target` WHERE entry IN +(54699,54725,54744,54746); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(54699,1,0), +(54725,1,0), +(54744,1,0), +(54746,1,0); diff --git a/sql/updates/3.0.9_old/3577_world_spell_target_position.sql b/sql/updates/3.0.9_old/3577_world_spell_target_position.sql new file mode 100644 index 0000000..35190cd --- /dev/null +++ b/sql/updates/3.0.9_old/3577_world_spell_target_position.sql @@ -0,0 +1,5 @@ +-- positions for teleports in acherus +DELETE FROM `spell_target_position` WHERE `id` IN (54744,54746); +INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES +(54744, 0, 2418.67, -5621.41, 420.644, 3.89597), +(54746, 0, 2402.15, -5633.74, 377.021, 3.65249); diff --git a/sql/updates/3.0.9_old/3587_mangos_7893_01_world_command.sql b/sql/updates/3.0.9_old/3587_mangos_7893_01_world_command.sql new file mode 100644 index 0000000..8212b07 --- /dev/null +++ b/sql/updates/3.0.9_old/3587_mangos_7893_01_world_command.sql @@ -0,0 +1,7 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7886_01_mangos_petcreateinfo_spell required_7893_01_mangos_command bit;*/ + +DELETE FROM `command` WHERE `name` IN ('guild create','guild delete','guild invite'); +INSERT INTO `command` VALUES +('guild create',2,'Syntax: .guild create [$GuildLeaderName] "$GuildName"\r\n\r\nCreate a guild named $GuildName with the player $GuildLeaderName (or selected) as leader. Guild name must in quotes.'), +('guild invite',2,'Syntax: .guild invite [$CharacterName] "$GuildName"\r\n\r\nAdd player $CharacterName (or selected) into a guild $GuildName. Guild name must in quotes.'), +('guild delete',2,'Syntax: .guild delete "$GuildName"\r\n\r\nDelete guild $GuildName. Guild name must in quotes.'); diff --git a/sql/updates/3.0.9_old/3592_world_spell_dk.sql b/sql/updates/3.0.9_old/3592_world_spell_dk.sql new file mode 100644 index 0000000..7089309 --- /dev/null +++ b/sql/updates/3.0.9_old/3592_world_spell_dk.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_script_target` WHERE entry IN (51859); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(51859, 1, 28525), -- siphon of archerus +(51859, 1, 28542), +(51859, 1, 28543), +(51859, 1, 28544); +UPDATE `creature_template` SET `spell5`=51890 WHERE `entry`=28511; -- Eye of Acherus flight +UPDATE `creature_template` SET `minlevel`=50,`maxlevel`=52,`minhealth`=2215,`maxhealth`=2317,`faction_A`=2084,`faction_H`=2084,`mindmg`=50,`maxdmg`=50 WHERE `entry`=28528; -- ghoul diff --git a/sql/updates/3.0.9_old/3593_world_spellclick_dk.sql b/sql/updates/3.0.9_old/3593_world_spellclick_dk.sql new file mode 100644 index 0000000..d8baab5 --- /dev/null +++ b/sql/updates/3.0.9_old/3593_world_spellclick_dk.sql @@ -0,0 +1,4 @@ +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN ('29501', '29488'); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_id`, `quest_status`, `cast_flags`) VALUES +('29488', '54568', '12670', '1', '3'), +('29501', '54575', '12670', '1', '3'); diff --git a/sql/updates/3.0.9_old/3596_world_scripts.sql b/sql/updates/3.0.9_old/3596_world_scripts.sql new file mode 100644 index 0000000..14eafdb --- /dev/null +++ b/sql/updates/3.0.9_old/3596_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_death_knight_initiate' WHERE `entry`=28406; diff --git a/sql/updates/3.0.9_old/3601_world.sql b/sql/updates/3.0.9_old/3601_world.sql new file mode 100644 index 0000000..1b1eab1 --- /dev/null +++ b/sql/updates/3.0.9_old/3601_world.sql @@ -0,0 +1,8 @@ +UPDATE `creature_template` SET `VehicleId`=200 WHERE `entry` IN (28605,28606,28607); +UPDATE `creature_template` SET `ScriptName`='npc_salanar_the_horseman' WHERE `entry`=28653; + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (28605,28606,28607); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_id`, `quest_status`, `cast_flags`) VALUES +(28605, 52263, 12680, 3, 1), +(28606, 52263, 12680, 3, 1), +(28607, 52263, 12680, 3, 1); diff --git a/sql/updates/3.0.9_old/3603_mangos_7896_01_world_creature_template.sql b/sql/updates/3.0.9_old/3603_mangos_7896_01_world_creature_template.sql new file mode 100644 index 0000000..22342e8 --- /dev/null +++ b/sql/updates/3.0.9_old/3603_mangos_7896_01_world_creature_template.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7893_01_mangos_command required_7896_01_mangos_creature_template bit;*/ + +ALTER TABLE creature_template CHANGE COLUMN class trainer_class tinyint(3) unsigned NOT NULL default '0'; +ALTER TABLE creature_template CHANGE COLUMN race trainer_race tinyint(3) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.0.9_old/3609_mangos_7902_01_world_pool_creature.sql b/sql/updates/3.0.9_old/3609_mangos_7902_01_world_pool_creature.sql new file mode 100644 index 0000000..ec1d63a --- /dev/null +++ b/sql/updates/3.0.9_old/3609_mangos_7902_01_world_pool_creature.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7896_01_mangos_creature_template required_7902_01_mangos_pool_creature bit;*/ + +ALTER TABLE `pool_creature` + ADD INDEX `idx_guid`(`guid`); diff --git a/sql/updates/3.0.9_old/3609_mangos_7902_02_world_pool_gameobject.sql b/sql/updates/3.0.9_old/3609_mangos_7902_02_world_pool_gameobject.sql new file mode 100644 index 0000000..3935a14 --- /dev/null +++ b/sql/updates/3.0.9_old/3609_mangos_7902_02_world_pool_gameobject.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7902_01_mangos_pool_creature required_7902_02_mangos_pool_gameobject bit;*/ + +ALTER TABLE `pool_gameobject` + ADD INDEX `idx_guid`(`guid`); diff --git a/sql/updates/3.0.9_old/3612_world_spell_dk.sql b/sql/updates/3.0.9_old/3612_world_spell_dk.sql new file mode 100644 index 0000000..80d7e24 --- /dev/null +++ b/sql/updates/3.0.9_old/3612_world_spell_dk.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_target` WHERE entry IN (52124); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(52124, 1, 28655); +UPDATE `creature_template` SET spell1=52372,spell2=52373,spell3=52374,spell4=52375 WHERE `entry`=28406; diff --git a/sql/updates/3.0.9_old/3618_mangos_7903_01_characters_character_pet.sql b/sql/updates/3.0.9_old/3618_mangos_7903_01_characters_character_pet.sql new file mode 100644 index 0000000..952ec78 --- /dev/null +++ b/sql/updates/3.0.9_old/3618_mangos_7903_01_characters_character_pet.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7887_01_characters_character_pet required_7903_01_characters_character_pet bit;*/ + +ALTER TABLE `character_pet` + DROP `talentpoints`; diff --git a/sql/updates/3.0.9_old/3619_mangos_7904_01_world_creature_template.sql b/sql/updates/3.0.9_old/3619_mangos_7904_01_world_creature_template.sql new file mode 100644 index 0000000..dd66056 --- /dev/null +++ b/sql/updates/3.0.9_old/3619_mangos_7904_01_world_creature_template.sql @@ -0,0 +1,9 @@ +/*ALTER TABLE db_version CHANGE COLUMN required_7902_02_mangos_pool_gameobject required_7904_01_mangos_creature_template bit;*/ + +ALTER TABLE creature_template + ADD COLUMN dmg_multiplier float NOT NULL default '1' AFTER attackpower; + +UPDATE creature_template SET mindmg = round(mindmg + attackpower / 14); +UPDATE creature_template SET maxdmg = round(maxdmg + attackpower / 14); +UPDATE creature_template SET attackpower = round((maxdmg + mindmg) * 0.3); +UPDATE creature_template SET mindmg = round(mindmg * 0.7), maxdmg = round(maxdmg * 0.7); diff --git a/sql/updates/3.0.9_old/3632_mangos_7908_world_creature_template.sql b/sql/updates/3.0.9_old/3632_mangos_7908_world_creature_template.sql new file mode 100644 index 0000000..8d54029 --- /dev/null +++ b/sql/updates/3.0.9_old/3632_mangos_7908_world_creature_template.sql @@ -0,0 +1,21 @@ +ALTER TABLE creature_template ADD COLUMN unit_class tinyint(3) unsigned NOT NULL default '0' AFTER rangeattacktime; + +UPDATE creature_template ct +JOIN creature c ON ct.entry=c.id +JOIN creature_addon ad ON c.guid=ad.guid +SET ct.unit_class=(ad.bytes0 & 0x0000FF00) >> 8 +WHERE ct.entry=c.id AND ct.unit_class=0; + +UPDATE creature_template ct +JOIN creature_template_addon ad ON ct.entry=ad.entry +SET ct.unit_class=(ad.bytes0 & 0x0000FF00) >> 8 +WHERE ct.entry=ad.entry AND ct.unit_class=0; + +UPDATE creature_template a1, creature_template a2 SET a1.unit_class=a2.unit_class WHERE a1.unit_class=0 AND a2.unit_class!=0 AND a1.entry=a2.heroic_entry; +UPDATE creature_template a1, creature_template a2 SET a1.unit_class=a2.unit_class WHERE a1.unit_class=0 AND a2.unit_class!=0 AND a2.entry=a1.heroic_entry; + +ALTER TABLE creature_addon + DROP COLUMN bytes0; + +ALTER TABLE creature_template_addon + DROP COLUMN bytes0; diff --git a/sql/updates/3.0.9_old/3637_world_spell.sql b/sql/updates/3.0.9_old/3637_world_spell.sql new file mode 100644 index 0000000..c2fe66a --- /dev/null +++ b/sql/updates/3.0.9_old/3637_world_spell.sql @@ -0,0 +1,7 @@ +DELETE FROM `playercreateinfo_spell` WHERE Spell = 56816; +INSERT INTO `playercreateinfo_spell` (`race`, `class`, `Spell`, `Note`) VALUES +(0, 6, 56816, 'Rune Strike'); + +DELETE FROM `spell_proc_event` WHERE `entry`=56816; +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(56816, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000030, 0, 0, 0); -- Rune Strike diff --git a/sql/updates/3.0.9_old/3643_world_wintergrasp.sql b/sql/updates/3.0.9_old/3643_world_wintergrasp.sql new file mode 100644 index 0000000..e5c365d --- /dev/null +++ b/sql/updates/3.0.9_old/3643_world_wintergrasp.sql @@ -0,0 +1,12 @@ +DELETE FROM `spell_script_target` WHERE entry IN (54643); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(54643,1,23472); + +DELETE FROM `game_event` WHERE `entry` IN (50,51); +INSERT INTO `game_event` (`entry`, `description`, `world_event`) VALUES +(50, 'Wintergrasp Alliance Defence', 5), +(51, 'Wintergrasp Horde Defence', 5); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (54643); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 54643,-54643, 2, 'Wintergrasp Defender Teleport'); diff --git a/sql/updates/3.0.9_old/3648_world_trinity_string_full.sql b/sql/updates/3.0.9_old/3648_world_trinity_string_full.sql new file mode 100644 index 0000000..00b14ab --- /dev/null +++ b/sql/updates/3.0.9_old/3648_world_trinity_string_full.sql @@ -0,0 +1,801 @@ +DROP TABLE IF EXISTS `trinity_string`; +CREATE TABLE `trinity_string` ( + `entry` mediumint(8) unsigned NOT NULL default '0', + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(1, 'You should select a character or a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2, 'You should select a creature.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(3, '|cffff0000[System Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(4, '|cffff0000[Event Message]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5, 'There is no help for that command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6, 'There is no such command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7, 'There is no such subcommand', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(8, 'Command %s have subcommands:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(9, 'Commands available to you:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10, 'Incorrect syntax.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(11, 'Your account level is: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(12, 'Online players: %u (max: %u) Queued players: %u (max: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(13, 'Server uptime: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(14, 'Player saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(15, 'All players saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(16, 'There are the following active GMs on this server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(17, 'There are no GMs currently logged in on this server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(18, 'Cannot do that while flying.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(19, 'Cannot do that in Battlegrounds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(20, 'Target is flying you can''t do that.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(21, '%s is flying command failed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(22, 'You are not mounted so you can''t dismount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(23, 'Cannot do that while fighting.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(24, 'You used it recently.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(25, 'Password not changed (unknown error)!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(26, 'The password was changed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(27, 'The new passwords do not match or the old password is wrong', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(28, 'Your account is now locked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(29, 'Your account is now unlocked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(30, ', rank ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(31, ' [known]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(32, ' [learn]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(33, ' [passive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(34, ' [talent]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(35, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(36, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(37, ' (offline)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(38, 'on', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(39, 'off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(40, 'You are: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(41, 'visible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(42, 'invisible', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(43, 'done', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(44, 'You', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(45, ' ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(46, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(47, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(48, 'UNKNOWN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(49, 'You must be at least level %u to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(50, 'You must be at least level %u and have item %s to enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(51, 'Hello! Ready for some training?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(52, 'Invaid item count (%u) for item %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(53, 'Mail can''t have more %u item stacks', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(54, 'The new passwords do not match', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(55, 'Your password can''t be longer than 16 characters (client limit), password not changed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(56, 'Current Message of the day: \r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(57, 'Using World DB: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(58, 'Using script library: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(100, 'Global notify: ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(101, 'Map: %u (%s) Zone: %u (%s) Area: %u (%s) Phase: %u\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(102, '%s is already being teleported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(103, 'You can summon a player to your instance only if he is in your party with you as leader.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(104, 'You cannot go to the player''s instance because you are in a party now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(105, 'You can go to the player''s instance while not being in his party only if your GM mode is on.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(106, 'You can not go to player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(107, 'You can not summon player %s from instance to instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(108, 'You are summoning %s%s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(109, 'You are being summoned by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(110, 'You are teleporting %s%s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(111, 'You are being teleported by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(112, 'Player (%s) does not exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(113, 'Appearing at %s''s location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(114, '%s is appearing to your location.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(115, 'Incorrect values.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(116, 'No character selected.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(117, '%s is not in a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(118, 'You changed HP of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(119, '%s changed your HP to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(120, 'You changed MANA of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(121, '%s changed your MANA to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(122, 'You changed ENERGY of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(123, '%s changed your ENERGY to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(124, 'Current energy: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(125, 'You changed rage of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(126, '%s changed your rage to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(127, 'You changed level of %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(128, 'GUID %i, faction is %i, flags is %i, npcflag is %i, DY flag is %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(129, 'Wrong faction: %u (not found in factiontemplate.dbc).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(130, 'You changed GUID=%i ''s Faction to %i, flags to %i, npcflag to %i, dyflag to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(131, 'You changed the spellflatid=%i, val= %i, mark =%i to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(132, '%s changed your spellflatid=%i, val= %i, mark =%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(133, '%s has access to all taxi nodes now (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(134, '%s has no more access to all taxi nodes now (only visited accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(135, '%s has given you access to all taxi nodes (until logout).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(136, '%s has removed access to all taxi nodes (only visited still accessible).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(137, 'You set all speeds to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(138, '%s set all your speeds to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(139, 'You set the speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(140, '%s set your speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(141, 'You set the swim speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(142, '%s set your swim speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(143, 'You set the backwards run speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(144, '%s set your backwards run speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(145, 'You set the fly speed to %2.2f from normal of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(146, '%s set your fly speed to %2.2f from normal.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(147, 'You set the size %2.2f of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(148, '%s set your size to %2.2f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(149, 'There is no such mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(150, 'You give a mount to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(151, '%s gave you a mount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(152, 'USER1: %i, ADD: %i, DIF: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(153, 'You take all copper of %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(154, '%s took you all of your copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(155, 'You take %i copper from %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(156, '%s took %i copper from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(157, 'You give %i copper to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(158, '%s gave you %i copper.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(159, 'You hear sound %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(160, 'USER2: %i, ADD: %i, RESULT: %i\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(161, 'Removed bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(162, 'Set bit %i in field %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(163, 'Teleport location table is empty!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(164, 'Teleport location not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(165, 'Requires search parameter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(166, 'There are no teleport locations matching your request.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(168, 'Locations found are:\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(169, 'Mail sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(170, 'You try to hear sound %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(172, 'server console command', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(173, 'You changed runic power of %s to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(174, '%s changed your runic power to %i/%i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(200, 'No selection.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(201, 'Object GUID is: lowpart %u highpart %X', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(202, 'The name was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(203, 'Error, name can only contain characters A-Z and a-z.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(204, 'The subname was too long by %i characters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(205, 'Not yet implemented', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(206, 'Item ''%i'' ''%s'' added to list with maxcount ''%i'' and incrtime ''%i'' and extendedcost ''%i''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(207, 'Item ''%i'' not found in database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(208, 'Item ''%i'' ''%s'' deleted from vendor list', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(209, 'Item ''%i'' not found in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(210, 'Item ''%i'' already in vendor list.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(211, 'Spells of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(212, 'Spells of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(213, 'Talents of %s reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(214, 'Talents of %s will reset at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(215, 'Your spells have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(216, 'Your talents have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(217, 'Unknown case ''%s'' for .resetall command. Type full correct case name.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(218, 'Spells will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(219, 'Talents will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(220, 'Creature (GUID: %u) No waypoint found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(221, 'Creature (GUID: %u) Last waypoint not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(222, 'Creature (GUID: %u) No waypoint found - used ''wpguid''. Now trying to find it by its position...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(223, 'Creature (GUID: %u) No waypoints found - This is a MaNGOS db problem (single float).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(224, 'Selected creature is ignored - provided GUID is used', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(225, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(226, 'You must select a visual waypoint.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(227, 'No visual waypoints found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(228, 'Could not create visual waypoint with creatureID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(229, 'All visual waypoints removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(230, 'Could not create waypoint-creature with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(231, 'No GUID provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(232, 'No waypoint number provided.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(233, 'Argument required for ''%s''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(234, 'Waypoint %i added to GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(235, 'Waypoint %d added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(236, 'Waypoint changed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(237, 'Waypoint %s modified.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(238, 'WP export successfull.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(239, 'No waypoints found inside the database.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(240, 'File imported.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(241, 'Waypoint removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(242, 'Warning: Could not delete WP from the world with ID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(243, 'This happens if the waypoint is too far away from your char.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(244, 'The WP is deleted from the database, but not from the world here.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(245, 'They will disappear after a server restart.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(246, 'Waypoint %d: Info for creature: %s, GUID: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(247, 'Waittime: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(248, 'Model %d: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(249, 'Emote: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(250, 'Spell: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(251, 'Text%d (ID: %i): %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(252, 'AIScript: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(253, 'Forced rename for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(254, 'Forced rename for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(255, 'Waypoint-Creature (GUID: %u) Not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(256, 'Could not find NPC...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(257, 'Creature movement type set to ''%s'', waypoints removed (if any).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(258, 'Creature movement type set to ''%s'', waypoints were not removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(259, 'Incorrect value, use on or off', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(260, 'Value saved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(261, 'Value saved, you may need to rejoin or clean your client cache.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(262, 'Areatrigger ID %u not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(263, 'Target map or coordinates is invalid (X: %f Y: %f MapId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(264, 'Zone coordinates is invalid (X: %f Y: %f AreaId: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(265, 'Zone %u (%s) is part of instanceable map %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(266, 'Nothing found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(267, 'Object not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(268, 'Creature not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(269, 'Warning: Mob found more than once - you will be teleported to the first one found in DB.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(270, 'Creature Removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(271, 'Creature moved.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(272, 'Creature (GUID:%u) must be on the same map as player!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(273, 'Game Object (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(274, 'Game Object (GUID: %u) has references in not found creature %u GO list, can''t be deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(275, 'Game Object (GUID: %u) removed', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(277, 'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) moved', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(278, 'You must select a vendor', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(279, 'You must send id for item', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(280, 'Vendor has too many items (max 128)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(281, 'You can''t kick self, logout instead', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(282, 'Player %s kicked.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5011, 'You can''t teleport self to self!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(284, 'Accepting Whisper: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(285, 'Accepting Whisper: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(286, 'Accepting Whisper: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(287, 'Creature (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(288, 'Tickets count: %i show new tickets: %s\n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(289, 'New ticket from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(290, 'Ticket of %s (Last updated: %s):\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(291, 'New ticket show: ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(292, 'New ticket show: OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(293, 'Ticket %i doesn''t exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(294, 'All tickets deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(295, 'Character %s ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(296, 'Ticket deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(297, 'Spawn distance changed to: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(298, 'Spawn time changed to: %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(299, 'The honor of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(300, 'Your chat has been disabled for %u minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(301, 'You have disabled %s''s chat for %u minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(302, 'Player''s chat is already enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(303, 'Your chat has been enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(304, 'You have enabled %s''s chat.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(305, 'Faction %s (%u) reputation of %s was set to %5d!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(306, 'The arena points of %s was set to %u!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(307, 'No faction found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(308, 'Faction %i unknown!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(309, 'Invalid parameter %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(310, 'delta must be between 0 and %d (inclusive)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(311, '%d - |cffffffff|Hfaction:%d|h[%s]|h|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(312, ' [visible]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(313, ' [at war]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(314, ' [peace forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(315, ' [hidden]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(316, ' [invisible forced]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(317, ' [inactive]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(318, 'Hated', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(319, 'Hostile', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(320, 'Unfriendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(321, 'Neutral', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(322, 'Friendly', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(323, 'Honored', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(324, 'Revered', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(325, 'Exalted', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(326, 'Faction %s (%u) can''not have reputation.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(327, ' [no reputation]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(328, 'Characters at account %s (Id: %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(329, ' %s (GUID %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(330, 'No players found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(331, 'Extended item cost %u not exist', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(332, 'GM mode is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(333, 'GM mode is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(334, 'GM Chat Badge is ON', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(335, 'GM Chat Badge is OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(336, 'You repair all %s''s items.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(337, 'All your items repaired by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(338, 'You set waterwalk mode %s for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(339, 'Your waterwalk mode %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(340, '%s is now following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(341, '%s is not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(342, '%s is now not following you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(343, 'Creature (Entry: %u) cannot be tamed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(344, 'You already have pet.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(345, 'Forced customize for player %s will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(346, 'Forced customize for player %s (GUID #%u) will be requested at next login.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(400, '|cffff0000[System Message]:|rScripts reloaded', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(401, 'You change security level of account %s to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(402, '%s changed your security level to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(403, 'You have low security level for this.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(404, 'Creature movement disabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(405, 'Creature movement enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(406, 'Weather can''t be changed for this zone.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(407, 'Weather system disabled at server.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(408, '%s is banned for %s. Reason: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(409, '%s is banned permanently for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(410, '%s %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(411, '%s unbanned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(412, 'There was an error removing the ban on %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(413, 'Account not exist: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(414, 'There is no such character.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(415, 'There is no such IP in banlist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(416, 'Account %s has never been banned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(417, 'Ban history for account %s:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(418, 'Ban Date: %s Bantime: %s Still active: %s Reason: %s Set by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(419, 'Inf.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(420, 'Never', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(421, 'Yes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(422, 'No', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(423, 'IP: %s\nBan Date: %s\nUnban Date: %s\nRemaining: %s\nReason: %s\nSet by: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(424, 'There is no matching IPban.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(425, 'There is no matching account.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(426, 'There is no banned account owning a character matching this part.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(427, 'The following IPs match your pattern:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(428, 'The following accounts match your query:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(429, 'You learned many spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(430, 'You learned all spells for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(431, 'You learned all talents for class.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(432, 'You learned all languages.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(433, 'You learned all craft skills and recipes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(434, 'Could not find ''%s''', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(435, 'Invalid item id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(436, 'No items found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(437, 'Invalid gameobject id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(438, 'Found items %u: %u ( inventory %u mail %u auction %u guild %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(439, 'Found gameobjects %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(440, 'Invalid creature id: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(441, 'Found creatures %u: %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(442, 'No area found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(443, 'No item sets found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(444, 'No skills found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(445, 'No spells found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(446, 'No quests found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(447, 'No creatures found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(448, 'No gameobjects found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(449, 'Graveyard #%u doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(450, 'Graveyard #%u already linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(451, 'Graveyard #%u linked to zone #%u (current).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(452, 'Graveyard #%u can''t be linked to subzone or not existed zone #%u (internal error).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(454, 'No faction in Graveyard with id= #%u , fix your DB', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(455, 'invalid team, please fix database', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(456, 'any', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(457, 'alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(458, 'horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(459, 'Graveyard #%u (faction: %s) is nearest from linked to zone #%u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(460, 'Zone #%u doesn''t have linked graveyards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(461, 'Zone #%u doesn''t have linked graveyards for faction: %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(462, 'Teleport location already exists!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(463, 'Teleport location added.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(464, 'Teleport location NOT added: database error.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(465, 'Teleport location deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(467, 'Target unit has %d auras:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(468, 'id: %d effmask: %d charges: %d stack: %d slot %d duration: %d maxduration: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(469, 'Target unit has %d auras of type %d:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(470, 'id: %d eff: %d amount: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(471, 'Quest %u not found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(472, 'Quest %u started from item. For correct work, please, add item to inventory and start quest in normal way: .additem %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(473, 'Quest removed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(474, ' [rewarded]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(475, ' [complete]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(476, ' [active]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(477, '%s''s Fly Mode %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(478, 'Opcode %u sent to %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(479, 'Character loaded successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(480, 'Failed to load the character!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(481, 'Character dumped successfully!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(482, 'Character dump failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(483, 'Spell %u broken and not allowed to cast or learn!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(484, 'Skill %u (%s) for player %s set to %u and current maximum set to %u (without permanent (talent) bonuses).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(485, 'Player %s must have skill %u (%s) before using this command.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(486, 'Invalid skill id (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(487, 'You learned default GM spells/skills.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(488, 'You already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(489, 'Target(%s) already know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(490, '%s doesn''t know that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(491, 'You already forgot that spell.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(492, 'All spell cooldowns removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(493, 'Spell %u cooldown removed for %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(494, 'Command : Additem, itemId = %i, amount = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(495, 'Command : Additemset, itemsetId = %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(496, 'Removed itemID = %i, amount = %i from %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(497, 'Cannot create item ''%i'' (amount: %i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(498, 'You need to provide a guild name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(499, 'Player not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(500, 'Player already has a guild!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(501, 'Guild not created! (already exists?)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(502, 'No items from itemset ''%u'' found.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(503, 'The distance is: (3D) %f (2D) %f yards.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(504, 'Item ''%i'' ''%s'' Item Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(505, 'Item ''%i'' doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(506, 'Item ''%i'' ''%s'' Added to Slot %i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(507, 'Item save failed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(508, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(509, '%d - sender: %s (guid: %u account: %u ) receiver: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(510, '%d - owner: %s (guid: %u account: %u ) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(511, 'Wrong link type!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(512, '%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(513, '%d - |cffffffff|Hquest:%d|h[%s]|h|r %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(514, '%d - |cffffffff|Hcreature_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(515, '%d - |cffffffff|Hcreature:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(516, '%d - |cffffffff|Hgameobject_entry:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(517, '%d - |cffffffff|Hgameobject:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(518, '%d - |cffffffff|Hitemset:%d|h[%s %s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(519, '|cffffffff|Htele:%s|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(520, '%d - |cffffffff|Hspell:%d|h[%s]|h|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(521, '%d - |cffffffff|Hskill:%d|h[%s %s]|h|r %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(522, 'Game Object (GUID: %u) not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(523, '>> Game Object %s (GUID: %u) at %f %f %f. Orientation %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(276, 'Game Object |cffffffff|Hgameobject:%d|h[%s]|h|r (GUID: %u) turned', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(525, '>> Add Game Object ''%i'' (%s) (GUID: %i) added at ''%f %f %f''.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(526, '%s (lowguid: %u) movement generators stack:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(527, ' Idle', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(528, ' Random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(529, ' Waypoint', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(530, ' Animal random', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(531, ' Confused', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(532, ' Targeted to player %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(533, ' Targeted to creature %s (lowguid %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(534, ' Targeted to ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(535, ' Home movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(536, ' Home movement used for player?!?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(537, ' Taxi flight', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(538, ' Unknown movement generator (%u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(539, 'Player selected NPC\nGUID: %u.\nFaction: %u.\nnpcFlags: %u.\nEntry: %u.\nDisplayID: %u (Native: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(540, 'Level: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(541, 'Health (base): %u. (max): %u. (current): %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(542, 'Field Flags: %u.\nDynamic Flags: %u.\nFaction Template: %u.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(543, 'Loot: %u Pickpocket: %u Skinning: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(544, 'Position: %f %f %f.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(545, '*** Is a vendor!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(546, '*** Is a trainer!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(547, 'InstanceID: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(548, 'Player%s %s (guid: %u) Account: %s (id: %u) GMLevel: %u Last IP: %s Last login: %s Latency: %ums', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(549, 'Played time: %s Level: %u Money: %ug%us%uc', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(550, 'Command .pinfo doesn''t support ''rep'' option for offline players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(551, '%s has explored all zones now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(552, '%s has no more explored zones.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(553, '%s has explored all zones for you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(554, '%s has hidden all zones from you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(555, 'Hover enabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(556, 'Hover disabled', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(559, '%s reset your level progress.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(558, '%s level down you to (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(560, 'The area has been set as explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(561, 'The area has been set as not explored.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(562, 'GUID=%i ''s updateIndex: %i, value: %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(563, 'You change GUID=%i ''s UpdateIndex: %i value to %i.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(564, 'The value index %u is too big to %u(count: %u).', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(565, 'Set %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(566, 'You Set %u Field:%u to uint32 Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(567, 'Set %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(568, 'You Set %u Field:%i to float Value: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(569, 'Get %u uint32 Value:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(570, 'The uint32 value of %u in %u is: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(571, 'Get %u float Value:[OPCODE]:%u [VALUE]:%f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(572, 'The float of %u value in %u is: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(573, '.Set32Bit:[OPCODE]:%u [VALUE]:%u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(574, 'You set Bit of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(575, '.Mod32Value:[OPCODE]:%u [VALUE]:%i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(576, 'You modified the value of Field:%u to Value: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(577, 'You are now invisible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(578, 'You are now visible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(579, 'Selected player or creature not have victim.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(580, 'Player %s learned all default spells for race/class and completed quests rewarded spells.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(581, 'Found near gameobjects (distance %f): %u ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(582, 'SpawnTime: Full:%s Remain:%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(583, '%d - |cffffffff|Hgameevent:%d|h[%s]|h|r%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(584, 'No event found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(585, 'Event not exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(586, 'Event %u: %s%s\nStart: %s End: %s Occurence: %s Length: %s\nNext state change: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(587, 'Event %u already active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(588, 'Event %u not active!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(589, ' Point movement to (X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(590, ' Fear movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(591, ' Distract movement', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(592, 'You have learned all spells in craft: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(593, 'Currently Banned Accounts:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(594, '| Account | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(595, 'Currently Banned IPs:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(596, '| IP | BanDate | UnbanDate | Banned By | Ban Reason |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(597, 'Current gamemasters:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(598, '| Account | GM |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(599, 'No gamemasters.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(600, 'The Alliance wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(601, 'The Horde wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(602, 'The battle for Warsong Gulch begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(603, 'The battle for Warsong Gulch begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(604, 'Let the battle for Warsong Gulch begin!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(605, '$n captured the Horde flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(606, '$n captured the Alliance flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(607, 'The Horde flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(608, 'The Alliance Flag was dropped by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(609, 'The Alliance Flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(610, 'The Horde flag was returned to its base by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(611, 'The Horde flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(612, 'The Alliance Flag was picked up by $n!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(613, 'The flags are now placed at their bases.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(680, 'The Horde has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(636, 'The Battle for Eye of the Storm begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(637, 'The Battle for Eye of the Storm begins in 30 seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(638, 'The Battle for Eye of the Storm has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(650, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(651, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(652, 'stables', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(653, 'blacksmith', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(654, 'farm', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(655, 'lumber mill', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(656, 'mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(657, 'The %s has taken the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(658, '$n has defended the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(659, '$n has assaulted the %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(660, '$n claims the %s! If left unchallenged, the %s will control it in 1 minute!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(661, 'The Battle for Arathi Basin begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(662, 'The Battle for Arathi Basin begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(663, 'The Battle for Arathi Basin has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(664, 'The Alliance has gathered $1776W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(665, 'The Horde has gathered $1777W resources, and is near victory!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(666, 'After your recent battle in %s our best attempts to award you a Mark of Honor failed. Enclosed you will find the Mark of Honor we were not able to deliver to you at the time. Thanks for fighting in %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(679, 'The Alliance has lost control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(678, 'The Horde has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(677, 'The Alliance has lost control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(676, 'The Horde has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(675, 'The Alliance has lost control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(674, 'The Horde has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(673, 'The Alliance has taken control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(672, 'The Horde has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(671, 'The Alliance has taken control of the Blood Elf Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(670, 'The Horde has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(669, 'The Alliance has taken control of the Draenei Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(668, 'The Horde has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(667, 'The Alliance has taken control of the Mage Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(615, 'The Horde flag is now placed at its base.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(614, 'The Alliance flag is now placed at its base.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(700, 'You must be level %u to form an arena team', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(701, 'One minute until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(702, 'Thirty seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(703, 'Fifteen seconds until the Arena battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(704, 'The Arena battle has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(705, 'You must wait %s before speaking again.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(706, 'This item(s) have problems with equipping/storing in inventory.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(707, '%s wishes to not be disturbed and cannot receive whisper messages: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(708, '%s is Away from Keyboard: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(709, 'Do not Disturb', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(710, 'Away from Keyboard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(711, 'Queue status for %s (Lvl: %u to %u)\nQueued alliances: %u (Need at least %u more)\nQueued hordes: %u (Need at least %u more)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(712, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] A: %u/%u, H: %u/%u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(713, 'You must be level %u to join an arena team!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(715, 'You don''t meet Battleground level requirements', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(717, '|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] Started!|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(718, '|cffff0000[Arena Queue Announcer]:|r %s -- Joined : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(719, '|cffff0000[Arena Queue Announcer]:|r %s -- Exited : %ux%u : %u|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(720, 'Your group is too large for this battleground. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(721, 'Your group is too large for this arena. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(722, 'Your group has members not in your arena team. Please regroup to join.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(723, 'Your group does not have enough players to join this match.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(724, 'The Gold Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(725, 'The Green Team wins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(726, 'There aren''t enough players in this battleground. It will end soon unless some more players join to balance the fight.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(727, 'Your group has an offline member. Please remove him before joining.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(728, 'Your group has players from the opposing faction. You can''t join the battleground as a group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(729, 'Your group has players from different battleground brakets. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(730, 'Someone in your party is already in this battleground queue. (S)he must leave it before joining as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(731, 'Someone in your party is Deserter. You can''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(732, 'Someone in your party is already in three battleground queues. You cannot join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(733, 'You cannot teleport to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(734, 'You cannot summon players to a battleground or arena map.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(735, 'You must be in GM mode to teleport to a player in a battleground.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(736, 'You cannot teleport to a battleground from another battleground. Please leave the current battleground first.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(737, 'Arenas are set to 1v1 for debugging. So, don''t join as group.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(738, 'Arenas are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(739, 'Battlegrounds are set to 1v0 for debugging.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(740, 'Battlegrounds are set to normal playercount.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(741, 'Flushing Arena points based on team ratings, this may take a few minutes. Please stand by...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(742, 'Distributing arena points to players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(743, 'Finished setting arena points for online players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(744, 'Modifying played count, arena points etc. for loaded arena teams, sending updated stats to online players...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(745, 'Modification done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(746, 'Done flushing Arena points.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(785, 'Arena testing turned %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(786, '|cffff0000[Automatic]:|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(787, '|cffffff00[|c1f40af20Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(800, 'Invalid name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(801, 'You do not have enough gold', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(802, 'You do not have enough free slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(803, 'Your partner does not have enough free bag slots', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(804, 'You do not have permission to perform that function', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(805, 'Unknown language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(806, 'You don''t know that language', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(807, 'Please provide character name', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(808, 'Player %s not found or offline', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(809, 'Account for character %s not found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1000, 'Exiting daemon...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1001, 'Account deleted: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1002, 'Account %s NOT deleted (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1003, 'Account %s NOT deleted (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1004, 'Account created: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1005, 'Account name can''t be longer than 16 characters (client limit), account not created!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1006, 'Account with this name already exist!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1007, 'Account %s NOT created (probably sql file format was updated)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1008, 'Account %s NOT created (unknown error)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1009, 'Player %s (Guid: %u) Account %s (Id: %u) deleted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1010, '| Account | Character | IP | GM | Expansion |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1100, 'Account %s (Id: %u) have up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1101, 'Message of the day changed to:\r\n%s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1102, 'Message sent to %s: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1103, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1104, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1105, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1106, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1107, '%d - %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1108, '%d - %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1109, '%d - %s %s %s %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1110, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1111, '%d - %s X:%f Y:%f Z:%f MapId:%d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1112, 'Failed to open file: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1113, 'Account %s (%u) have max amount allowed characters (client limit)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1114, 'Dump file have broken data!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1115, 'Invalid character name!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1116, 'Invalid character guid!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1117, 'Character guid %u in use!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1118, '%d - guild: %s (guid: %u) %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1119, 'You must use male or female as gender.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1120, 'You change gender of %s to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1121, 'Your gender changed to %s by %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1122, '(%u/%u +perm %u +temp %u)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1326, 'The Battle for Alterac Valley begins in 1 minute.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1325, 'Frostwolf Relief Hut', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1308, 'The %s has taken the %s! Its supplies will now be used for reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1309, 'Irondeep Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1310, 'Coldtooth Mine', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1311, 'Stormpike Aid Station', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1312, 'Dun Baldar South Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1313, 'Dun Baldar North Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1314, 'Stormpike Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1315, 'Icewing Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1316, 'Stonehearth Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1317, 'Stonehearth Bunker', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1318, 'Snowfall Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1319, 'Iceblood Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1320, 'Iceblood Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1321, 'Tower Point', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1322, 'Frostwolf Graveyard', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1323, 'East Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1324, 'West Frostwolf Tower', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2000, '|cff00ff00New ticket from|r|cffff00ff %s.|r |cff00ff00Ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2001, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00edited his/her ticket:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2002, '|cff00ff00Character|r|cffff00ff %s |r|cff00ff00abandoned ticket entry:|r|cffff00ff %d.|r', '', '', '', '', '', '', '', ''), +(2003, '|cff00ff00Closed by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2004, '|cff00ff00Deleted by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2005, 'Ticket not found.', '', '', '', '', '', '', '', ''), +(2006, 'Please close ticket before deleting it permanently.', '', '', '', '', '', '', '', ''), +(2007, 'Ticket %d is already assigned.', '', '', '', '', '', '', '', ''), +(2008, '%u Tickets succesfully reloaded from the database.', '', '', '', '', '', '', '', ''), +(2009, 'Showing list of open tickets.', '', '', '', '', '', '', '', ''), +(2010, 'Showing list of open tickets whose creator is online.', '', '', '', '', '', '', '', ''), +(2011, 'Showing list of closed tickets.', '', '', '', '', '', '', '', ''), +(2012, 'Invalid name specified. Name should be that of an online Gamemaster.', '', '', '', '', '', '', '', ''), +(2013, 'This ticket is already assigned to yourself. To unassign use .ticket unassign %d and then reassign.', '', '', '', '', '', '', '', ''), +(2014, 'Ticket %d is not assigned, you cannot unassign it.', '', '', '', '', '', '', '', ''), +(2015, 'You cannot unassign tickets from staffmembers with a higher security level than yourself.', '', '', '', '', '', '', '', ''), +(2016, 'Cannot close ticket %d, it is assigned to another GM.', '', '', '', '', '', '', '', ''), +(2017, '|cff00ff00Ticket|r:|cff00ccff %d.|r ', '', '', '', '', '', '', '', ''), +(2018, '|cff00ff00Created by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2019, '|cff00ff00Last change|r:|cff00ccff %s ago|r ', '', '', '', '', '', '', '', ''), +(2020, '|cff00ff00Assigned to|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2021, '|cff00ff00Unassigned by|r:|cff00ccff %s|r ', '', '', '', '', '', '', '', ''), +(2022, '\n|cff00ff00Message|r: "%s"|r ', '', '', '', '', '', '', '', ''), +(2023, '\n|cff00ff00Comment|r: "%s"|r ', '', '', '', '', '', '', '', ''), +(2024, '\n|cff00ccff%s|r |cff00ff00Added comment|r: "%s"|r ', '', '', '', '', '', '', '', ''), +(5000, 'You froze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5001, 'It might be amusing but no... you cant freeze yourself!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5002, 'Invalid input check the name of target.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5003, 'You unfroze player %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5004, 'There are no frozen players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5005, 'Following players are frozen on the server:', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5006, '- %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5009, 'Sound %u Played to server', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10001, 'The Horde has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10002, 'The Alliance has taken The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10003, 'The Horde has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10004, 'The Alliance has taken The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10005, 'The Horde has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10006, 'The Alliance has taken Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10007, 'The Horde lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10008, 'The Alliance lost The Overlook!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10009, 'The Horde lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10010, 'The Alliance lost The Stadium!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10011, 'The Horde lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10012, 'The Alliance lost Broken Hill!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10013, 'The Horde has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10014, 'The Alliance has taken the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10015, 'The Horde has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10016, 'The Alliance has taken the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10017, 'The Horde has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10018, 'The Alliance has captured the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10019, 'The Horde lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10020, 'The Alliance lost the West Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10021, 'The Horde lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10022, 'The Alliance lost the East Beacon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10023, 'The Horde lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10024, 'The Alliance lost the Twin Spire Graveyard!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10025, 'The Horde has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10026, 'The Alliance has captured Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10027, 'The Horde lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10028, 'The Alliance lost Halaa!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10029, 'The Horde has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10030, 'The Alliance has taken a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10031, 'The Horde lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10032, 'The Alliance lost a Spirit Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10033, 'The Horde has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10034, 'The Alliance has taken the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10035, 'The Horde has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10036, 'The Alliance has taken the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10037, 'The Horde has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10038, 'The Alliance has taken the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10039, 'The Horde has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10040, 'The Alliance has taken the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10041, 'The Horde lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10042, 'The Alliance lost the Northpass Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10043, 'The Horde lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10044, 'The Alliance lost the Eastwall Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10045, 'The Horde lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10046, 'The Alliance lost the Crown Guard Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10047, 'The Horde lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10048, 'The Alliance lost the Plaguewood Tower!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10049, 'The Horde has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10050, 'The Alliance has collected 200 silithyst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10051, 'Take me to Northpass Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10052, 'Take me to Eastwall Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10053, 'Take me to Crown Guard Tower.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10054, 'Give me the flag, I''ll take it to the central beacon for the glory of the Alliance!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(10055, 'Give me the flag, I''ll take it to the central beacon for the glory of the Horde!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(681, 'The Alliance has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(810, '|Hplayer:$N|h[$N]|h has earned the achievement $a!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(750, 'Not enough players. This game will close in %u mins.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(751, 'Not enough players. This game will close in %u seconds.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(753, 'The battle for Warsong Gulch begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(754, 'The battle for Arathi Basin begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(755, 'The battle for Eye of the Storm begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(811, 'Guild Master', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(812, 'Officer', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(813, 'Veteran', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(814, 'Member', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(815, 'Initiate', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(175, 'Liquid level: %f, ground: %f, type: %d, status: %d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(682, 'The Horde has lost control of the Fel Reaver Ruins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(683, '%s has taken the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(684, 'The Alliance have captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(685, 'The Horde have captured the flag!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(686, 'The flag has been dropped.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(687, 'The flag has been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(524, 'Selected object:\n|cffffffff|Hgameobject:%d|h[%s]|h|r GUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7523, 'WORLD: Denying connections.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(7524, 'WORLD: Accepting connections.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1123, 'Not pet found', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1124, 'Wrong pet type', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1125, 'Your pet learned all talents', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1126, 'Your pet talents have been reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1127, 'Talents of %s''s pet reset.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1011, '| | %20s | || |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1012, '===========================================================================', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1013, '|%15s| %20s | %15s |%4d| %9d |', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1014, 'No online players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5007, 'You must be in a raid group to enter this instance.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(59, 'Using creature EventAI: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(2025, '|cff00ff00Created|r:|cff00ccff %s ago|r ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(6616, 'Pet spells will reset for all players at login. Strongly recommend re-login!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1307, 'The %s is under attack! If left unchecked, the %s will capture it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1305, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1306, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1304, 'The %s was taken by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1303, 'The %s is under attack! If left unchecked, the %s will destroy it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1302, '%s was destroyed by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1301, 'Horde', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1300, 'Alliance', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5010, 'linkGUID: %u, Entry: %u (%s)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(466, 'No taxinodes found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1128, '%d - |cffffffff|Htaxinode:%u|h[%s %s]|h|r (Map:%u X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1129, '%d - %s %s (Map:%u X:%f Y:%f Z:%f)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(557, '%s level up you to (%i)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1327, 'The Battle for Alterac Valley begins in 30 seconds. Prepare yourselves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1328, 'The Battle for Alterac Valley has begun!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1329, 'The Alliance Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1330, 'The Horde Team is running out of reinforcements!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1331, 'The Frostwolf General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1332, 'The Stormpike General is Dead!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1201, 'You try to view movie %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(347, 'TaxiNode ID %u not found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(171, 'You can''t teleport self to self!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1200, 'You try to view cinemitic %u but it doesn''t exist.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.0.9_old/3649_world.sql b/sql/updates/3.0.9_old/3649_world.sql new file mode 100644 index 0000000..c50d778 --- /dev/null +++ b/sql/updates/3.0.9_old/3649_world.sql @@ -0,0 +1,5 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_prison' WHERE `entry` BETWEEN 184418 AND 184431; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_stasis' WHERE `entry` BETWEEN 185465 AND 185467; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_stasis' WHERE `entry` = 184595; +UPDATE `gameobject_template` SET `ScriptName` = 'go_ethereum_stasis' WHERE `entry` BETWEEN 185461 AND 185464; +UPDATE `creature_template` SET `ScriptName` = 'npc_engineering_tele_trinket' WHERE `entry` IN (14742, 14743, 21493, 21494); diff --git a/sql/updates/3.0.9_old/3689_TC1_1534_world.sql b/sql/updates/3.0.9_old/3689_TC1_1534_world.sql new file mode 100644 index 0000000..cde0c50 --- /dev/null +++ b/sql/updates/3.0.9_old/3689_TC1_1534_world.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName` = 'mob_ethereal_apprentice' WHERE `entry` = 18430; +DELETE FROM `creature` WHERE `id` = 18431; diff --git a/sql/updates/3.0.9_old/3691_TC1_919_world.sql b/sql/updates/3.0.9_old/3691_TC1_919_world.sql new file mode 100644 index 0000000..644daa2 --- /dev/null +++ b/sql/updates/3.0.9_old/3691_TC1_919_world.sql @@ -0,0 +1,2 @@ +ALTER TABLE version + ADD `core_revision` varchar(120) AFTER `core_version`; diff --git a/sql/updates/3.0.9_old/3715_mangos_7932_01_characters_character_pet.sql b/sql/updates/3.0.9_old/3715_mangos_7932_01_characters_character_pet.sql new file mode 100644 index 0000000..c141dca --- /dev/null +++ b/sql/updates/3.0.9_old/3715_mangos_7932_01_characters_character_pet.sql @@ -0,0 +1,9 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7903_01_characters_character_pet required_7932_01_characters_character_pet bit;*/ + +UPDATE character_pet + SET abdata = CONCAT(REPLACE(TRIM(abdata),' ',' '),' '); + +UPDATE character_pet + SET abdata = SUBSTRING_INDEX(SUBSTRING_INDEX(abdata,' ',(10-3)*2),' ',-(10-3-3)*2) + WHERE length(SUBSTRING_INDEX(abdata, ' ', 20)) < length(abdata) and length(SUBSTRING_INDEX(abdata, ' ', 21)) >= length(abdata); + \ No newline at end of file diff --git a/sql/updates/3.0.9_old/3724_world.sql b/sql/updates/3.0.9_old/3724_world.sql new file mode 100644 index 0000000..1269925 --- /dev/null +++ b/sql/updates/3.0.9_old/3724_world.sql @@ -0,0 +1,10 @@ +-- Vehicle and summon spell(summon npc 28788) for Acherus Deathcharger +UPDATE creature_template SET `spell1`=52362, `VehicleId`=200 WHERE `entry`=28782; + +-- ScriptName for dark rider +UPDATE creature_template SET `ScriptName`='npc_ros_dark_rider' WHERE `entry`=28768; + +-- Spellclick spell to mount deathcharger +DELETE FROM npc_spellclick_spells WHERE `npc_entry`=28782; +INSERT INTO npc_spellclick_spells (`npc_entry`, `spell_id`, `quest_id`, `quest_status`, `cast_flags`) VALUES +(28782, 52280, 12687, 3, 1); diff --git a/sql/updates/3.0.9_old/3729_mangos_7938_01_realmd_account.sql b/sql/updates/3.0.9_old/3729_mangos_7938_01_realmd_account.sql new file mode 100644 index 0000000..05fde4e --- /dev/null +++ b/sql/updates/3.0.9_old/3729_mangos_7938_01_realmd_account.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE realmd_db_version CHANGE COLUMN required_7867_01_realmd_account required_7938_01_realmd_account bit;*/ + +ALTER TABLE account + CHANGE id id int(11) unsigned NOT NULL auto_increment COMMENT 'Identifier'; diff --git a/sql/updates/3.0.9_old/3736_world_spell_dk.sql b/sql/updates/3.0.9_old/3736_world_spell_dk.sql new file mode 100644 index 0000000..c4097fe --- /dev/null +++ b/sql/updates/3.0.9_old/3736_world_spell_dk.sql @@ -0,0 +1,3 @@ +DELETE FROM spell_area WHERE spell = 52693; +INSERT INTO spell_area (`spell`, `area`, `quest_start`, `quest_start_active`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`) VALUES +(52693, 4298, 12687, 1, 12687, 0, 0, 0, 1); diff --git a/sql/updates/3.0.9_old/3747_mangos_7945_01_quest_template.sql b/sql/updates/3.0.9_old/3747_mangos_7945_01_quest_template.sql new file mode 100644 index 0000000..ab28ccd --- /dev/null +++ b/sql/updates/3.0.9_old/3747_mangos_7945_01_quest_template.sql @@ -0,0 +1,9 @@ +ALTER TABLE quest_template + ADD COLUMN `DetailsEmoteDelay1` int(11) unsigned NOT NULL default '0' AFTER `DetailsEmote4`, + ADD COLUMN `DetailsEmoteDelay2` int(11) unsigned NOT NULL default '0' AFTER `DetailsEmoteDelay1`, + ADD COLUMN `DetailsEmoteDelay3` int(11) unsigned NOT NULL default '0' AFTER `DetailsEmoteDelay2`, + ADD COLUMN `DetailsEmoteDelay4` int(11) unsigned NOT NULL default '0' AFTER `DetailsEmoteDelay3`, + ADD COLUMN `OfferRewardEmoteDelay1` int(11) unsigned NOT NULL default '0' AFTER `OfferRewardEmote4`, + ADD COLUMN `OfferRewardEmoteDelay2` int(11) unsigned NOT NULL default '0' AFTER `OfferRewardEmoteDelay1`, + ADD COLUMN `OfferRewardEmoteDelay3` int(11) unsigned NOT NULL default '0' AFTER `OfferRewardEmoteDelay2`, + ADD COLUMN `OfferRewardEmoteDelay4` int(11) unsigned NOT NULL default '0' AFTER `OfferRewardEmoteDelay3`; diff --git a/sql/updates/3.0.9_old/3791_characters_ahbot.sql b/sql/updates/3.0.9_old/3791_characters_ahbot.sql new file mode 100644 index 0000000..ead144c --- /dev/null +++ b/sql/updates/3.0.9_old/3791_characters_ahbot.sql @@ -0,0 +1,4 @@ +ALTER TABLE `auctionhousebot` + DROP COLUMN `minTime`, + DROP COLUMN `maxTime`; + \ No newline at end of file diff --git a/sql/updates/3.0.9_old/3801_world_spell.sql b/sql/updates/3.0.9_old/3801_world_spell.sql new file mode 100644 index 0000000..8fabcad --- /dev/null +++ b/sql/updates/3.0.9_old/3801_world_spell.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (44544, 60503, 36032); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(36032, 0x00, 3, 0x00000800, 0x00008000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Arcane Blast + +DELETE FROM `spell_affect` WHERE `entry` IN (44544); +INSERT INTO `spell_affect` (`entry`, `effectId`, `SpellClassMask0`, `SpellClassMask1`, `SpellClassMask2`) VALUES +(44544,0,685904631,1151048,0); -- Fingers of frost diff --git a/sql/updates/3.0.9_old/3808_world.sql b/sql/updates/3.0.9_old/3808_world.sql new file mode 100644 index 0000000..24ce276 --- /dev/null +++ b/sql/updates/3.0.9_old/3808_world.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_salanar_the_horseman' WHERE `entry` = 28788; diff --git a/sql/updates/3.0.9_old/3810_world_spell_bonus_data.sql b/sql/updates/3.0.9_old/3810_world_spell_bonus_data.sql new file mode 100644 index 0000000..1803687 --- /dev/null +++ b/sql/updates/3.0.9_old/3810_world_spell_bonus_data.sql @@ -0,0 +1,94 @@ +-- by Drahy +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.6453' WHERE `entry`=33763; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.67305' WHERE `entry`=50464; +UPDATE `spell_bonus_data` SET `dot_bonus` = '0.2' WHERE `entry`=5570; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7143' WHERE `entry`=44425; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1936' WHERE `entry`=11113; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1936' WHERE `entry`=31661; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.214' WHERE `entry`=120; +UPDATE `spell_bonus_data` SET `direct_bonus` = '1' WHERE `entry`=19750; +UPDATE `spell_bonus_data` SET `direct_bonus` = '1.66' WHERE `entry`=635; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.4280' WHERE `entry`=8092; +UPDATE `spell_bonus_data` SET `dot_bonus` = '0.2' WHERE `entry`=172; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.2129' WHERE `entry`=27243; +UPDATE `spell_bonus_data` SET `dot_bonus` = '0.2' WHERE `entry`=30108; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0' WHERE `entry`=17962; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.2140' WHERE `entry`=6789; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.4793' WHERE `entry`=48181; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7139' WHERE `entry`=29722; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.4293' WHERE `entry`=5676; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.8569' WHERE `entry`=686; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.4293' WHERE `entry`=17877; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1932' WHERE `entry`=30283; +UPDATE `spell_bonus_data` SET `dot_bonus` = '0.143' WHERE `entry`=689; +UPDATE `spell_bonus_data` SET `dot_bonus` = '0.429' WHERE `entry`=1120; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1427' WHERE `entry`=5857; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1427' WHERE `entry`=11681; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1427' WHERE `entry`=11682; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1427' WHERE `entry`=27214; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1427' WHERE `entry`=47822; +UPDATE `spell_bonus_data` SET `dot_bonus` = '0.0949' WHERE `entry`=1949; +UPDATE `spell_bonus_data` SET `ap_bonus` = '0.025' WHERE `entry`=31803; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42208; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42209; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42210; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42211; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42212; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42213; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42198; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42937; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.1437' WHERE `entry`= 42938; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.2861' WHERE `entry` =49821; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.2861' WHERE `entry` =53022; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7024' WHERE `entry`=42223; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7024' WHERE `entry`=42224; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7024' WHERE `entry`=42225; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7024' WHERE `entry`=42226; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7024' WHERE `entry`=42218; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7024' WHERE `entry`=47817; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.7024' WHERE `entry`=47818; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.4762' WHERE `entry`=379; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.81' WHERE `entry`=25914; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.81' WHERE `entry`=25913; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.81' WHERE `entry`=25903; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.81' WHERE `entry`=27175; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.81' WHERE `entry`=33074; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.81' WHERE `entry`=48821; +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.6453' WHERE `entry`=33763; +DELETE FROM `spell_bonus_data` WHERE `entry` IN (53742,61391,47897,50796,50590,58597,974,47757,52986,52987,52988); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +('53742', '0.013', '0', '0.025', 'Paladin - Blood Corruption'), +('61391', '0.193', '0', '0', 'Druid - Typhoon'), +('47897', '0.1064', '0.0667', '0', 'Warlock - Shadowflame'), +('50796', '0.7139', '0', '0', 'Warlock - Chaos Bolt'), +('50590', '0', '0.1622', '0', 'Warlock - Immolation Aura'), +('58597', '0.75', '0', '0', 'Paladin - Sacred Shield'), +('47757', '1.6135', '0', '0', 'Priest - Penance (Rank 1'), +('52986', '1.6135', '0', '0', 'Priest - Penance (Rank 2'), +('52987', '1.6135', '0', '0', 'Priest - Penance (Rank 3'), +('52988', '1.6135', '0', '0', 'Priest - Penance (Rank 4'); +DELETE FROM `spell_bonus_data` WHERE `entry` IN (48505,50288,50294,53191,53188,53194,53189,53195,53190); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +(50288, 0.05, 0, 0, 'Druid - Starfall rank 1'), +(50294, 0.012, 0, 0, 'Druid - Starfall AOE rank 1'), +(53191, 0.05, 0, 0, 'Druid - Starfall rank 2'), +(53188, 0.012, 0, 0, 'Druid - Starfall AOE rank 2'), +(53194, 0.05, 0, 0, 'Druid - Starfall rank 3'), +(53189, 0.012, 0, 0, 'Druid - Starfall AOE rank 3'), +(53195, 0.05, 0, 0, 'Druid - Starfall rank 4'), +(53190, 0.012, 0, 0, 'Druid - Starfall AOE rank 4'); + +-- by nesocip +DELETE FROM `spell_bonus_data` WHERE `entry` IN (48721, 55078, 52212, 47632, 55095, 49184, 45477, 50536, 51373, 51374, 51375); +INSERT INTO spell_bonus_data( entry, ap_bonus, comments ) VALUES +('48721', '0.04', 'DK - Blood Boil'), +('55078', '0.055', 'DK - Blood Plague'), +('52212', '0.0475', 'DK - Death and Decay'), +('47632', '0.15', 'DK - Death Coil'), +('55095', '0.055', 'DK - Frost Fever'), +('49184', '0.1', 'DK - Howling Blast'), +('45477', '0.1', 'DK - Icy Touch'), +('50536', '0.013', 'DK - Unholy Blight (Rank1)'), +('51373', '0.013', 'DK - Unholy Blight (Rank2)'), +('51374', '0.013', 'DK - Unholy Blight (Rank3)'), +('51375', '0.013', 'DK - Unholy Blight (Rank4)'); diff --git a/sql/updates/3.0.9_old/3813_world_spell_dk.sql b/sql/updates/3.0.9_old/3813_world_spell_dk.sql new file mode 100644 index 0000000..2b43888 --- /dev/null +++ b/sql/updates/3.0.9_old/3813_world_spell_dk.sql @@ -0,0 +1,8 @@ +UPDATE `creature_template` SET maxhealth = 133525, minhealth = 133525, maxmana = 51360, minmana = 51360, spell1 = 53114, spell2 = 53112, spell3=53110, VehicleId = 156 where entry = 28670; +UPDATE `creature_template` SET `ScriptName`='npc_dkc1_gothik' WHERE `entry`=28658; + +-- gift of harvester +DELETE FROM `spell_script_target` WHERE entry IN (52479); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(52479,1,28819), +(52479,1,28822); diff --git a/sql/updates/3.0.9_old/3851_characters_aura.sql b/sql/updates/3.0.9_old/3851_characters_aura.sql new file mode 100644 index 0000000..762f8b7 --- /dev/null +++ b/sql/updates/3.0.9_old/3851_characters_aura.sql @@ -0,0 +1 @@ +DELETE FROM `character_aura` WHERE `spell` IN (48714,57806); diff --git a/sql/updates/3.0.9_old/3851_world_spell.sql b/sql/updates/3.0.9_old/3851_world_spell.sql new file mode 100644 index 0000000..ed10e84 --- /dev/null +++ b/sql/updates/3.0.9_old/3851_world_spell.sql @@ -0,0 +1,8 @@ +UPDATE `spell_bonus_data` SET `direct_bonus` = '0.6453' WHERE `entry`=33763; +DELETE FROM `spell_script_target` WHERE `entry` IN (48714,57806); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +('48714', '2', '27237'), +('48714', '2', '27235'), +('48714', '2', '27234'), +('48714', '2', '27236'), +('57806', '2', '31043'); diff --git a/sql/updates/3.0.9_old/3856_world_spell_naxx.sql b/sql/updates/3.0.9_old/3856_world_spell_naxx.sql new file mode 100644 index 0000000..3b3895b --- /dev/null +++ b/sql/updates/3.0.9_old/3856_world_spell_naxx.sql @@ -0,0 +1,9 @@ +UPDATE `creature_template` SET `minlevel`='80',`maxlevel`='80',`faction_A`='21',`faction_H`='21' WHERE entry IN (16286,30068); + +INSERT INTO creature_template (entry, baseattacktime, spell1, flags_extra, scriptname) VALUES +(16129, 10000, 27812, 128, 'trigger_periodic') # Shadow Fissure (Kel'thezad) +ON DUPLICATE KEY UPDATE +baseattacktime = VALUES(baseattacktime), +spell1 = VALUES(spell1), +flags_extra = VALUES(flags_extra), +scriptname = VALUES(scriptname); diff --git a/sql/updates/3.0.9_old/3869_world_access_requirement.sql b/sql/updates/3.0.9_old/3869_world_access_requirement.sql new file mode 100644 index 0000000..d6ccad3 --- /dev/null +++ b/sql/updates/3.0.9_old/3869_world_access_requirement.sql @@ -0,0 +1 @@ +ALTER TABLE `access_requirement` ADD COLUMN `heroic_level_min` tinyint(3) unsigned NOT NULL default '0' AFTER `level_min`; diff --git a/sql/updates/3.0.9_old/3870_mangos_7980_01_world_item_required_target.sql b/sql/updates/3.0.9_old/3870_mangos_7980_01_world_item_required_target.sql new file mode 100644 index 0000000..7853e49 --- /dev/null +++ b/sql/updates/3.0.9_old/3870_mangos_7980_01_world_item_required_target.sql @@ -0,0 +1,9 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_7945_01_mangos_quest_template required_7980_01_mangos_item_required_target bit; + +DROP TABLE IF EXISTS `item_required_target`; +CREATE TABLE `item_required_target` ( + `entry` mediumint(8) unsigned NOT NULL, + `type` tinyint(3) unsigned NOT NULL default '0', + `targetEntry` mediumint(8) unsigned NOT NULL default '0', + UNIQUE KEY `entry_type_target` (`entry`,`type`,`targetEntry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED; diff --git a/sql/updates/3.0.9_old/3873_world_spell_dk.sql b/sql/updates/3.0.9_old/3873_world_spell_dk.sql new file mode 100644 index 0000000..142ec20 --- /dev/null +++ b/sql/updates/3.0.9_old/3873_world_spell_dk.sql @@ -0,0 +1,28 @@ +DELETE FROM `creature_questrelation` WHERE `quest`=12701; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28377, 12701); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12701; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28377, 12701); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12723; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12723); +DELETE FROM `creature_questrelation` WHERE `quest`=12724; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12724); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12724; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12724); +DELETE FROM `creature_questrelation` WHERE `quest`=12725; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28913, 12725); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12725; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28912, 12725); +DELETE FROM `creature_questrelation` WHERE `quest`=12727; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28912, 12727); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12727; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28913, 12727); +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (28833,28887); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_id`, `quest_status`, `cast_flags`) VALUES +(28833, 52447, 12701, 3, 3), +(28887, 52447, 12701, 3, 3); +UPDATE creature_template SET spell1=52435,spell2=52576,spell5=52588,VehicleId=68,speed=0 WHERE entry IN (28833,28887); +UPDATE creature_template SET spell1=52211 WHERE entry=28864; +DELETE FROM `spell_script_target` WHERE entry IN (52576); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(52576,1,28834), +(52576,1,28886); diff --git a/sql/updates/3.0.9_old/3877_world_spell_script_target.sql b/sql/updates/3.0.9_old/3877_world_spell_script_target.sql new file mode 100644 index 0000000..57392c5 --- /dev/null +++ b/sql/updates/3.0.9_old/3877_world_spell_script_target.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (48743); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +('48743', '1', '26125'); diff --git a/sql/updates/3.0.9_old/3886_world_script_nexus.sql b/sql/updates/3.0.9_old/3886_world_script_nexus.sql new file mode 100644 index 0000000..eba6741 --- /dev/null +++ b/sql/updates/3.0.9_old/3886_world_script_nexus.sql @@ -0,0 +1,82 @@ +-- Grand Magus Telestra +UPDATE `creature_template` SET `ScriptName`='boss_magus_telestra' WHERE `entry`=26731; + +-- Anomalus +UPDATE `creature_template` SET `ScriptName`='boss_anomalus' WHERE `entry`=26763; +UPDATE `creature_template` SET `ScriptName`='mob_chaotic_rift' WHERE `entry`=26918; + +-- Ormorok the Tree-Shaper +UPDATE `creature_template` SET `ScriptName`='boss_ormorok' WHERE `entry`=26794; +UPDATE `creature_template` SET `ScriptName`='mob_crystal_spike' WHERE `entry`=27099; +UPDATE `creature_template` SET `ScriptName`='mob_crystalline_tangler' WHERE `entry`=32665; + +-- Keristrasza +UPDATE `creature_template` SET `ScriptName`='boss_keristrasza' WHERE `entry`=26723; + +-- Instance script +UPDATE `instance_template` SET `script`='instance_nexus' WHERE `map`=576; + +UPDATE `creature_template` SET `AIName` = 'EventAI' WHERE entry IN (26796, 26798, 26929, 26928, 26930); +DELETE FROM `creature_ai_scripts` WHERE `creature_id` IN (26796, 26798, 26929, 26928, 26930); +INSERT INTO `creature_ai_scripts` VALUES +-- Commander Stoutbeard +( 2679600, 26796, 4, 0, 100, 4, 0, 0, 0, 0, 28, 0, 47543, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Stoutbeard - crystal prison remove'), +( 2679601, 26796, 4, 0, 100, 4, 0, 0, 0, 0, 11, 31403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Stoutbeard - cast battle shout'), +( 2679602, 26796, 0, 0, 100, 5, 3000, 3000, 11000, 15000, 11, 60067, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Stoutbeard - cast charge'), +( 2679603, 26796, 0, 0, 100, 5, 6000, 8000, 19500, 25000, 11, 38618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Stoutbeard - cast whirlwind'), +( 2679604, 26796, 0, 0, 100, 5, 13000, 13000, 45000, 55000, 11, 19134, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Stoutbeard - cast Frightening Shout'), +-- Commander Kolurg +( 2679800, 26798, 4, 0, 100, 4, 0, 0, 0, 0, 28, 0, 47543, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Kolurg - crystal prison remove'), +( 2679801, 26798, 4, 0, 100, 4, 0, 0, 0, 0, 11, 31403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Kolurg - cast battle shout'), +( 2679802, 26798, 0, 0, 100, 5, 3000, 3000, 11000, 15000, 11, 60067, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Kolurg - cast charge'), +( 2679803, 26798, 0, 0, 100, 5, 6000, 8000, 19500, 25000, 11, 38618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Kolurg - cast whirlwind'), +( 2679804, 26798, 0, 0, 100, 5, 13000, 13000, 45000, 55000, 11, 19134, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Commander Kolurg - cast Frightening Shout'), +-- Grand Magus Telestra Clone (Arcane) +( 2692901, 26929, 0, 0, 100, 7, 6000, 8000, 10000, 12000, 11, 47731, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand Magus Telestra arcane - cast pollymorph critter'), +( 2692902, 26929, 0, 0, 100, 7, 15000, 16000, 15000, 16000, 11, 47736, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand Magus Telestra arcane - cast time stop'), +-- Grand Magus Telestra Clone (Fire) +( 2692801, 26928, 0, 0, 100, 3, 3000, 3000, 8000, 9000, 11, 47721, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand magus Telestra fire - cast fire blast N'), +( 2692802, 26928, 0, 0, 100, 5, 3000, 3000, 8000, 9000, 11, 56939, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand magus Telestra fire - cast fire blast H'), +( 2692803, 26928, 0, 0, 100, 3, 9000, 9000, 9500, 11500, 11, 47723, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand magus Telestra fire - cast scorge N'), +( 2692804, 26928, 0, 0, 100, 5, 9000, 9000, 9500, 11500, 11, 56938, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand magus Telestra fire - cast scorge H'), +-- Grand Magus Telestra Clone (Frost) +( 2693001, 26930, 0, 0, 100, 3, 3000, 3000, 8000, 9000, 11, 47729, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand Magus Telestra frost - cast ice bard N'), +( 2693002, 26930, 0, 0, 100, 5, 3000, 3000, 8000, 9000, 11, 56937, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand Magus Telestra frost - cast ice bard H'), +( 2693003, 26930, 0, 0, 100, 3, 9000, 9000, 15000, 16000, 11, 47727, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand Magus Telestra frost - cast blizzard N'), +( 2693004, 26930, 0, 0, 100, 5, 9000, 9000, 15000, 16000, 11, 56936, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Grand Magus Telestra frost - cast blizzard H'); + +-- Grand Magus Telestra +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1576005 AND -1576000; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1576000,'You know what they say about curiosity.',13319,1,0,0,'grand magus telestra SAY_AGGRO'), +(-1576001,'Death becomes you!',13324,1,0,0,'grand magus telestra SAY_KILL'), +(-1576002,'Damn the... luck.',13320,1,0,0,'grand magus telestra SAY_DEATH'), +(-1576003,'Now to finish the job!',13323,1,0,0,'grand magus telestra SAY_MERGE'), +(-1576004,'There\'s plenty of me to go around.',13321,1,0,0,'grand magus telestra SAY_SPLIT_1'), +(-1576005,'I\'ll give you more than you can handle.',13322,1,0,0,'grand magus telestra SAY_SPLIT_2'); + +-- Anomalus +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1576013 AND -1576010; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1576010,'Chaos beckons.',13186,1,0,0,'anomalus SAY_AGGRO'), +(-1576011,'Of course.',13187,1,0,0,'anomalus SAY_DEATH'), +(-1576012,'Reality... unwoven.',13188,1,0,0,'anomalus SAY_RIFT'), +(-1576013,'Indestructible.',13189,1,0,0,'anomalus SAY_SHIELD'); + +-- Ormorok the Tree-Shaper +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1576024 AND -1576020; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1576020,'Noo!',13328,1,0,0,'ormorok SAY_AGGRO'), +(-1576021,'Aaggh!',13330,1,0,0,'ormorok SAY_DEATH'), +(-1576022,'Back!',13331,1,0,0,'ormorok SAY_REFLECT'), +(-1576023,'Bleed!',13332,1,0,0,'ormorok SAY_CRYSTAL_SPIKES'), +(-1576024,'Aaggh! Kill!',13329,1,0,0,'ormorok SAY_KILL'); + +-- Keristrasza +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1576044 AND -1576040; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1576040,'Preserve? Why? There\'s no truth in it. No no no... only in the taking! I see that now!',13450,1,0,0,'keristrasza SAY_AGGRO'), +(-1576041,'Now we\'ve come to the truth!',13453,1,0,0,'keristrasza SAY_SLAY'), +(-1576042,'Finish it! FINISH IT! Kill me, or I swear by the Dragonqueen you\'ll never see daylight again!',13452,1,0,0,'keristrasza SAY_ENRAGE'), +(-1576043,'Dragonqueen... Life-Binder... preserve... me.',13454,1,0,0,'keristrasza SAY_DEATH'), +(-1576044,'Stay. Enjoy your final moments.',13451,1,0,0,'keristrasza SAY_CRYSTAL_NOVA'); diff --git a/sql/updates/3.0.9_old/3899_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3899_world_spell_proc_event.sql new file mode 100644 index 0000000..bc8b159 --- /dev/null +++ b/sql/updates/3.0.9_old/3899_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (18096, 18073); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(18096, 0x00, 5, 0x00000060, 0x00800080, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Pyroclasm (Rank 1) +(18073, 0x00, 5, 0x00000060, 0x00800080, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Pyroclasm (Rank 2) diff --git a/sql/updates/3.0.9_old/3903_world_spell_proc_event.sql b/sql/updates/3.0.9_old/3903_world_spell_proc_event.sql new file mode 100644 index 0000000..ab534ec --- /dev/null +++ b/sql/updates/3.0.9_old/3903_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (56249); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(56249, 0x00, 5, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0, 0, 0); -- Glyph of Felhunter diff --git a/sql/updates/3.0.9_old/3910_world.sql b/sql/updates/3.0.9_old/3910_world.sql new file mode 100644 index 0000000..2e0d54f --- /dev/null +++ b/sql/updates/3.0.9_old/3910_world.sql @@ -0,0 +1,72 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_threshwackonator' WHERE `entry` = 6669; + +DELETE FROM `script_texts` WHERE `entry` IN (-1000414, -1000413); +INSERT INTO script_texts (entry, content_default, sound, type, language, emote, comment) VALUES +(-1000413, 'Threshwackonator First Mate unit prepared to follow', 0, 2, 0, 0, 'threshwackonator EMOTE_START'), +(-1000414, 'YARRR! Swabie, what have ye done?! He\'s gone mad! Baton him down the hatches! Hoist the mast! ARRRR! Every man for hi\'self!', 0, 0, 7, 0, 'threshwackonator SAY_AT_CLOSE'); + +UPDATE `creature_template` SET `ScriptName` = 'npc_prospector_remtravel' WHERE `entry` = 2917; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000427 AND -1000415; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1000415, 'Ok, $n, let\'s go find where I left that mysterious fossil. Follow me!', 0, 0, 7, 0, 'remtravel SAY_REM_START'), +(-1000416, 'Now where did I put that mysterious fossil? Ah, maybe up there...', 0, 0, 7, 0, 'remtravel SAY_REM_RAMP1_1'), +(-1000417, 'Hrm, nothing up here.', 0, 0, 7, 0, 'remtravel SAY_REM_RAMP1_2'), +(-1000418, 'No mysterious fossil here... Ah, but my copy of Green Hills of Stranglethorn. What a good book!', 0, 0, 7, 0, 'remtravel SAY_REM_BOOK'), +(-1000419, 'I bet you I left it in the tent!', 0, 0, 7, 0, 'remtravel SAY_REM_TENT1_1'), +(-1000420, 'Oh wait, that\'s Hollee\'s tent... and it\'s empty.', 0, 0, 7, 0, 'remtravel SAY_REM_TENT1_2'), +(-1000421, 'Interesting... I hadn\'t noticed this earlier...', 0, 0, 7, 0, 'remtravel SAY_REM_MOSS'), +(-1000422, '%s inspects the ancient, mossy stone.', 0, 2, 7, 0, 'remtravel EMOTE_REM_MOSS'), +(-1000423, 'Oh wait! I\'m supposed to be looking for that mysterious fossil!', 0, 0, 7, 0, 'remtravel SAY_REM_MOSS_PROGRESS'), +(-1000424, 'Nope. didn\'t leave the fossil back here!', 0, 0, 7, 0, 'remtravel SAY_REM_PROGRESS'), +(-1000425, 'Ah. I remember now! I gave the mysterious fossil to Hollee! Check with her.', 0, 0, 7, 0, 'remtravel SAY_REM_REMEMBER'), +(-1000426, '%s goes back to work, oblivious to everything around him.', 0, 2, 7, 0, 'remtravel EMOTE_REM_END'), +(-1000427, 'Something tells me this $r wants the mysterious fossil too. Help!', 0, 0, 7, 0, 'remtravel SAY_REM_AGGRO'); + +DELETE FROM `script_waypoint` WHERE `entry` = 2917; +INSERT INTO `script_waypoint` VALUES +(2917, 0, 4675.812500, 598.614563, 17.645658, 0, 'SAY_REM_START'), +(2917, 1, 4672.844238, 599.325378, 16.417622, 0, ''), +(2917, 2, 4663.449707, 607.430176, 10.494752, 0, ''), +(2917, 3, 4655.969238, 613.761353, 8.523270, 0, ''), +(2917, 4, 4640.804688, 623.999329, 8.377054, 0, ''), +(2917, 5, 4631.678711, 630.801086, 6.414999, 5000, 'SAY_REM_RAMP1_1'), +(2917, 6, 4633.533203, 632.476440, 6.509831, 0, 'ambush'), +(2917, 7, 4639.413574, 637.120789, 13.338119, 0, ''), +(2917, 8, 4642.352051, 637.668152, 13.437444, 0, ''), +(2917, 9, 4645.082031, 634.463989, 13.437208, 5000, 'SAY_REM_RAMP1_2'), +(2917, 10, 4642.345215, 637.584839, 13.435211, 0, ''), +(2917, 11, 4639.630859, 637.233765, 13.339752, 0, ''), +(2917, 12, 4633.363281, 632.462280, 6.488438, 0, ''), +(2917, 13, 4624.714844, 631.723511, 6.264030, 0, ''), +(2917, 14, 4623.525879, 629.718506, 6.201339, 5000, 'SAY_REM_BOOK'), +(2917, 15, 4623.452148, 630.369629, 6.218942, 0, 'SAY_REM_TENT1_1'), +(2917, 16, 4622.622070, 637.221558, 6.312845, 0, 'ambush'), +(2917, 17, 4619.755371, 637.386230, 6.312050, 5000, 'SAY_REM_TENT1_2'), +(2917, 18, 4620.027832, 637.367676, 6.312050, 0, ''), +(2917, 19, 4624.154785, 637.560303, 6.313898, 0, ''), +(2917, 20, 4622.967773, 634.016479, 6.294979, 0, ''), +(2917, 21, 4616.926758, 630.303284, 6.239193, 0, ''), +(2917, 22, 4614.546387, 616.983337, 5.687642, 0, ''), +(2917, 23, 4610.279297, 610.029419, 5.442539, 0, ''), +(2917, 24, 4601.149902, 604.111694, 2.054856, 0, ''), +(2917, 25, 4589.618164, 597.685730, 1.057147, 0, ''), +(2917, 26, 4577.588379, 592.145813, 1.120190, 0, 'SAY_REM_MOSS (?)'), +(2917, 27, 4569.848145, 592.177490, 1.260874, 5000, 'EMOTE_REM_MOSS (?)'), +(2917, 28, 4568.791992, 590.870911, 1.211338, 3000, 'SAY_REM_MOSS_PROGRESS (?)'), +(2917, 29, 4566.722656, 564.077881, 1.343084, 0, 'ambush'), +(2917, 30, 4568.269531, 551.958435, 5.004200, 0, ''), +(2917, 31, 4566.731934, 551.557861, 5.426314, 5000, 'SAY_REM_PROGRESS'), +(2917, 32, 4566.741699, 560.767639, 1.703257, 0, ''), +(2917, 33, 4573.916016, 582.566101, 0.749801, 0, ''), +(2917, 34, 4594.206055, 598.533020, 1.034056, 0, ''), +(2917, 35, 4601.194824, 604.283081, 2.060146, 0, ''), +(2917, 36, 4609.539551, 610.844727, 5.402220, 0, ''), +(2917, 37, 4624.800293, 618.076477, 5.851541, 0, ''), +(2917, 38, 4632.414063, 623.778442, 7.286243, 0, ''), +(2917, 39, 4645.915039, 621.983765, 8.579967, 0, ''), +(2917, 40, 4658.669922, 611.092651, 8.891747, 0, ''), +(2917, 41, 4671.924316, 599.752197, 16.01242, 5000, 'SAY_REM_REMEMBER'), +(2917, 42, 4676.976074, 600.649780, 17.82566, 5000, 'EMOTE_REM_END'); + +UPDATE `creature_template` SET `ScriptName` = 'npc_myranda_the_hag' WHERE `entry` = 11872; diff --git a/sql/updates/3.0.9_old/805_world_scripts.sql b/sql/updates/3.0.9_old/805_world_scripts.sql new file mode 100644 index 0000000..be57e9c --- /dev/null +++ b/sql/updates/3.0.9_old/805_world_scripts.sql @@ -0,0 +1,123 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533039 AND -1533000; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533000,'Ahh... welcome to my parlor.',8788,1,0,'anubrekhan SAY_GREET'), +(-1533001,'Just a little taste...',8785,1,0,'anubrekhan SAY_AGGRO1'), +(-1533002,'There is no way out.',8786,1,0,'anubrekhan SAY_AGGRO2'), +(-1533003,'Yes, Run! It makes the blood pump faster!',8787,1,0,'anubrekhan SAY_AGGRO3'), +(-1533004,'I hear little hearts beating. Yesss... beating faster now. Soon the beating will stop.',8790,1,0,'anubrekhan SAY_TAUNT1'), +(-1533005,'Where to go? What to do? So many choices that all end in pain, end in death.',8791,1,0,'anubrekhan SAY_TAUNT2'), +(-1533006,'Which one shall I eat first? So difficult to choose... the all smell so delicious.',8792,1,0,'anubrekhan SAY_TAUNT3'), +(-1533007,'Closer now... tasty morsels. I\'ve been too long without food. Without blood to drink.',8793,1,0,'anubrekhan SAY_TAUNT4'), +(-1533008,'Shh... it will all be over soon.',8789,1,0,'anubrekhan SAY_SLAY'), +(-1533009,'Your old lives, your mortal desires, mean nothing. You are acolytes of the master now, and you will serve the cause without question! The greatest glory is to die in the master\'s service!',8799,1,0,'faerlina SAY_GREET'), +(-1533010,'Slay them in the master\'s name!',8794,1,0,'faerlina SAY_AGGRO1'), +(-1533011,'You cannot hide from me!',8795,1,0,'faerlina SAY_AGGRO2'), +(-1533012,'Kneel before me, worm!',8796,1,0,'faerlina SAY_AGGRO3'), +(-1533013,'Run while you still can!',8797,1,0,'faerlina SAY_AGGRO4'), +(-1533014,'You have failed!',8800,1,0,'faerlina SAY_SLAY1'), +(-1533015,'Pathetic wretch!',8801,1,0,'faerlina SAY_SLAY2'), +(-1533016,'The master... will avenge me!',8798,1,0,'faerlina SAY_DEATH'), +(-1533017,'Patchwerk want to play!',8909,1,0,'patchwerk SAY_AGGRO1'), +(-1533018,'Kel\'Thuzad make Patchwerk his Avatar of War!',8910,1,0,'patchwerk SAY_AGGRO2'), +(-1533019,'No more play?',8912,1,0,'patchwerk SAY_SLAY'), +(-1533020,'What happened to... Patch...',8911,1,0,'patchwerk SAY_DEATH'), +(-1533021,'goes into a berserker rage!',0,2,0,'patchwerk EMOTE_BERSERK'), +(-1533022,'becomes enraged!',0,2,0,'patchwerk EMOTE_ENRAGE'), +(-1533023,'Stalagg crush you!',8864,1,0,'stalagg SAY_STAL_AGGRO'), +(-1533024,'Stalagg kill!',8866,1,0,'stalagg SAY_STAL_SLAY'), +(-1533025,'Master save me...',8865,1,0,'stalagg SAY_STAL_DEATH'), +(-1533026,'Feed you to master!',8802,1,0,'feugen SAY_FEUG_AGGRO'), +(-1533027,'Feugen make master happy!',8804,1,0,'feugen SAY_FEUG_SLAY'), +(-1533028,'No... more... Feugen...',8803,1,0,'feugen SAY_FEUG_DEATH'), +(-1533029,'You are too late... I... must... OBEY!',8872,1,0,'thaddius SAY_GREET'), +(-1533030,'KILL!',8867,1,0,'thaddius SAY_AGGRO1'), +(-1533031,'EAT YOUR BONES!',8868,1,0,'thaddius SAY_AGGRO2'), +(-1533032,'BREAK YOU!',8869,1,0,'thaddius SAY_AGGRO3'), +(-1533033,'You die now!',8877,1,0,'thaddius SAY_SLAY'), +(-1533034,'Now YOU feel pain!',8871,1,0,'thaddius SAY_ELECT'), +(-1533035,'Thank... you...',8870,1,0,'thaddius SAY_DEATH'), +(-1533036,'Pleeease!',8873,1,0,'thaddius SAY_SCREAM1'), +(-1533037,'Stop, make it stop!',8874,1,0,'thaddius SAY_SCREAM2'), +(-1533038,'Help me! Save me!',8875,1,0,'thaddius SAY_SCREAM3'), +(-1533039,'Please, nooo!',8876,1,0,'thaddius SAY_SCREAM4'); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533074 AND -1533040; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533040,'Foolishly you have sought your own demise. Brazenly you have disregarded powers beyond your understanding. You have fought hard to invade the realm of the harvester. Now there is only one way out - to walk the lonely path of the damned.',8807,1,0,'gothik SAY_SPEECH'), +(-1533041,'Death is the only escape.',8806,1,0,'gothik SAY_KILL'), +(-1533042,'I... am... undone!',8805,1,0,'gothik SAY_DEATH'), +(-1533043,'I have waited long enough! Now, you face the harvester of souls!',8808,1,0,'gothik SAY_TELEPORT'), +(-1533044,'Defend youself!',8892,1,0,'blaumeux SAY_BLAU_AGGRO'), +(-1533045,'Come, Zeliek, do not drive them out. Not before we\'ve had our fun.',8896,1,0,'blaumeux SAY_BLAU_TAUNT1'), +(-1533046,'I do hope they stay alive long enough for me to... introduce myself.',8897,1,0,'blaumeux SAY_BLAU_TAUNT2'), +(-1533047,'The first kill goes to me! Anyone care to wager?',8898,1,0,'blaumeux SAY_BLAU_TAUNT3'), +(-1533048,'Your life is mine!',8895,1,0,'blaumeux SAY_BLAU_SPECIAL'), +(-1533049,'Who\'s next?',8894,1,0,'blaumeux SAY_BLAU_SLAY'), +(-1533050,'Tou... che!',8893,1,0,'blaumeux SAY_BLAU_DEATH'), +(-1533051,'Come out and fight, ye wee ninny!',8899,1,0,'korthazz SAY_KORT_AGGRO'), +(-1533052,'To arms, ye roustabouts! We\'ve got company!',8903,1,0,'korthazz SAY_KORT_TAUNT1'), +(-1533053,'I heard about enough of yer sniveling. Shut yer fly trap \'afore I shut it for ye!',8904,1,0,'korthazz SAY_KORT_TAUNT2'), +(-1533054,'I\'m gonna enjoy killin\' these slack-jawed daffodils!',8905,1,0,'korthazz SAY_KORT_TAUNT3'), +(-1533055,'I like my meat extra crispy!',8901,1,0,'korthazz SAY_KORT_SPECIAl'), +(-1533056,'Next time, bring more friends!',8902,1,0,'korthazz SAY_KORT_SLAY'), +(-1533057,'What a bloody waste this is!',8900,1,0,'korthazz SAY_KORT_DEATH'), +(-1533058,'Flee, before it\'s too late!',8913,1,0,'zeliek SAY_ZELI_AGGRO'), +(-1533059,'Invaders, cease this foolish venture at once! Turn away while you still can!',8917,1,0,'zeliek SAY_ZELI_TAUNT1'), +(-1533060,'Perhaps they will come to their senses, and run away as fast as they can!',8918,1,0,'zeliek SAY_ZELI_TAUNT2'), +(-1533061,'Do not continue! Turn back while there\'s still time!',8919,1,0,'zeliek SAY_ZELI_TAUNT3'), +(-1533062,'I- I have no choice but to obey!',8916,1,0,'zeliek SAY_ZELI_SPECIAL'), +(-1533063,'Forgive me!',8915,1,0,'zeliek SAY_ZELI_SLAY'), +(-1533064,'It is... as it should be.',8914,1,0,'zeliek SAY_ZELI_DEATH'), +(-1533065,'You seek death?',14571,1,0,'rivendare_naxx SAY_RIVE_AGGRO1'), +(-1533066,'None shall pass!',14572,1,0,'rivendare_naxx SAY_RIVE_AGGRO2'), +(-1533067,'Be still!',14573,1,0,'rivendare_naxx SAY_RIVE_AGGRO3'), +(-1533068,'You will find no peace in death.',14574,1,0,'rivendare_naxx SAY_RIVE_SLAY1'), +(-1533069,'The master\'s will is done.',14575,1,0,'rivendare_naxx SAY_RIVE_SLAY2'), +(-1533070,'Bow to the might of the scourge!',14576,1,0,'rivendare_naxx SAY_RIVE_SPECIAL'), +(-1533071,'Enough prattling. Let them come! We shall grind their bones to dust.',14577,1,0,'rivendare_naxx SAY_RIVE_TAUNT1'), +(-1533072,'Conserve your anger! Harness your rage! You will all have outlets for your frustration soon enough.',14578,1,0,'rivendare_naxx SAY_RIVE_TAUNT2'), +(-1533073,'Life is meaningless. It is in death that we are truly tested.',14579,1,0,'rivendare_naxx SAY_RIVE_TAUNT3'), +(-1533074,'Death... will not stop me...',14580,1,0,'rivendare_naxx SAY_RIVE_DEATH'); + +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=16062; +UPDATE `creature_template` SET `ScriptName`='boss_rivendare_naxx' WHERE `entry`=30549; + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1533108 AND -1533075; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1533075,'Glory to the master!',8845,1,0,'noth SAY_AGGRO1'), +(-1533076,'Your life is forfeit!',8846,1,0,'noth SAY_AGGRO2'), +(-1533077,'Die, trespasser!',8847,1,0,'noth SAY_AGGRO3'), +(-1533078,'Rise, my soldiers! Rise and fight once more!',8851,1,0,'noth SAY_SUMMON'), +(-1533079,'My task is done!',8849,1,0,'noth SAY_SLAY1'), +(-1533080,'Breathe no more!',8850,1,0,'noth SAY_SLAY2'), +(-1533081,'I will serve the master... in... death!',8848,1,0,'noth SAY_DEATH'), +(-1533082,'takes in a deep breath...',0,2,0,'sapphiron EMOTE_BREATH'), +(-1533083,'enrages!',0,2,0,'sapphiron EMOTE_ENRAGE'), +(-1533084,'Our preparations continue as planned, master.',14467,1,0,'kelthuzad SAY_SAPP_DIALOG1'), +(-1533085,'It is good that you serve me so faithfully. Soon, all will serve the Lich King and in the end, you shall be rewarded...so long as you do not falter.',8881,1,0,'kelthuzad SAY_SAPP_DIALOG2_LICH'), +(-1533086,'I see no complications... Wait... What is this?',14468,1,0,'kelthuzad SAY_SAPP_DIALOG3'), +(-1533087,'Your security measures have failed! See to this interruption immediately!',8882,1,0,'kelthuzad SAY_SAPP_DIALOG4_LICH'), +(-1533088,'Yes, master!',14469,1,0,'kelthuzad SAY_SAPP_DIALOG5'), +(-1533089,'No!!! A curse upon you, interlopers! The armies of the Lich King will hunt you down. You will not escape your fate...',14484,1,0,'kelthuzad SAY_CAT_DIED'), +(-1533090,'Who dares violate the sanctity of my domain? Be warned, all who trespass here are doomed.',14463,1,0,'kelthuzad SAY_TAUNT1'), +(-1533091,'Fools, you think yourselves triumphant? You have only taken one step closer to the abyss! ',14464,1,0,'kelthuzad SAY_TAUNT2'), +(-1533092,'I grow tired of these games. Proceed, and I will banish your souls to oblivion!',14465,1,0,'kelthuzad SAY_TAUNT3'), +(-1533093,'You have no idea what horrors lie ahead. You have seen nothing! The frozen heart of Naxxramas awaits you!',14466,1,0,'kelthuzad SAY_TAUNT4'), +(-1533094,'Pray for mercy!',14475,1,0,'kelthuzad SAY_AGGRO1'), +(-1533095,'Scream your dying breath!',14476,1,0,'kelthuzad SAY_AGGRO2'), +(-1533096,'The end is upon you!',14477,1,0,'kelthuzad SAY_AGGRO3'), +(-1533097,'The dark void awaits you!',14478,1,0,'kelthuzad SAY_SLAY1'), +(-1533098,'',14479,1,0,'kelthuzad SAY_SLAY2'), +(-1533099,'AAAAGHHH!... Do not rejoice... your victory is a hollow one... for I shall return with powers beyond your imagining!',14480,1,0,'kelthuzad SAY_DEATH'), +(-1533100,'Your soul, is bound to me now!',14472,1,0,'kelthuzad SAY_CHAIN1'), +(-1533101,'There will be no escape!',14473,1,0,'kelthuzad SAY_CHAIN2'), +(-1533102,'I will freeze the blood in your veins!',14474,1,0,'kelthuzad SAY_FROST_BLAST'), +(-1533103,'Master! I require aid! ',14470,1,0,'kelthuzad SAY_REQUEST_AID'), +(-1533104,'Very well... warriors of the frozen wastes, rise up! I command you to fight, kill, and die for your master. Let none survive...',0,1,0,'kelthuzad SAY_ANSWER_REQUEST'), +(-1533105,'Minions, servants, soldiers of the cold dark, obey the call of Kel\'Thuzad!',14471,1,0,'kelthuzad SAY_SUMMON_MINIONS'), +(-1533106,'Your petty magics are no challenge to the might of the Scourge! ',14481,1,0,'kelthuzad SAY_SPECIAL1_MANA_DET'), +(-1533107,'Enough! I grow tired of these distractions! ',14483,1,0,'kelthuzad SAY_SPECIAL3_MANA_DET'), +(-1533108,'Fools, you have spread your powers too thin. Be free, my minions!',14482,1,0,'kelthuzad SAY_SPECIAL2_DISPELL'); + +UPDATE `script_texts` SET `sound`=8902 WHERE `entry`=-1533055; +UPDATE `script_texts` SET `sound`=8901 WHERE `entry`=-1533056; diff --git a/sql/updates/3.0.9_old/875_mangos_7047_01_characters_character_spell.sql b/sql/updates/3.0.9_old/875_mangos_7047_01_characters_character_spell.sql new file mode 100644 index 0000000..686869e --- /dev/null +++ b/sql/updates/3.0.9_old/875_mangos_7047_01_characters_character_spell.sql @@ -0,0 +1,10 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_6976_02_characters_character_db_version required_7047_01_characters_character_spell bit;*/ + +DELETE FROM `character_spell` WHERE `spell` IN ('28880', 59542, 59543, 59544, 59545, 59547, 59548); +INSERT INTO character_spell SELECT characters.guid as guid, 28880, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 1; +INSERT INTO character_spell SELECT characters.guid as guid, 59542, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 2; +INSERT INTO character_spell SELECT characters.guid as guid, 59543, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 3; +INSERT INTO character_spell SELECT characters.guid as guid, 59544, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 5; +INSERT INTO character_spell SELECT characters.guid as guid, 59545, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 6; +INSERT INTO character_spell SELECT characters.guid as guid, 59547, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 7; +INSERT INTO character_spell SELECT characters.guid as guid, 59548, 1, 0 FROM `characters` WHERE characters.race=11 AND characters.class = 8; diff --git a/sql/updates/3.0.9_old/875_mangos_7059_01_characters_pet_spell.sql b/sql/updates/3.0.9_old/875_mangos_7059_01_characters_pet_spell.sql new file mode 100644 index 0000000..04257a3 --- /dev/null +++ b/sql/updates/3.0.9_old/875_mangos_7059_01_characters_pet_spell.sql @@ -0,0 +1,4 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_7059_01_characters_character_spell required_7059_02_characters_pet_spell bit;*/ + +ALTER TABLE pet_spell + DROP slot; diff --git a/sql/updates/3.0.9_old/CMakeLists.txt b/sql/updates/3.0.9_old/CMakeLists.txt new file mode 100644 index 0000000..d09917d --- /dev/null +++ b/sql/updates/3.0.9_old/CMakeLists.txt @@ -0,0 +1,3 @@ +FILE(GLOB _SQL_309 *.sql) + +INSTALL(FILES ${_SQL_309} DESTINATION share/trinity/sql/updates/3.0.9_old) \ No newline at end of file diff --git a/sql/updates/3.1.3_old/3920_characters_309-313_converter.sql b/sql/updates/3.1.3_old/3920_characters_309-313_converter.sql new file mode 100644 index 0000000..1a711f3 --- /dev/null +++ b/sql/updates/3.1.3_old/3920_characters_309-313_converter.sql @@ -0,0 +1,63 @@ +CREATE TABLE `character_equipmentsets` ( + `guid` int(11) NOT NULL default '0', + `setguid` bigint(20) NOT NULL auto_increment, + `setindex` tinyint(4) NOT NULL default '0', + `name` varchar(100) NOT NULL, + `iconname` varchar(100) NOT NULL, + `item0` int(11) NOT NULL default '0', + `item1` int(11) NOT NULL default '0', + `item2` int(11) NOT NULL default '0', + `item3` int(11) NOT NULL default '0', + `item4` int(11) NOT NULL default '0', + `item5` int(11) NOT NULL default '0', + `item6` int(11) NOT NULL default '0', + `item7` int(11) NOT NULL default '0', + `item8` int(11) NOT NULL default '0', + `item9` int(11) NOT NULL default '0', + `item10` int(11) NOT NULL default '0', + `item11` int(11) NOT NULL default '0', + `item12` int(11) NOT NULL default '0', + `item13` int(11) NOT NULL default '0', + `item14` int(11) NOT NULL default '0', + `item15` int(11) NOT NULL default '0', + `item16` int(11) NOT NULL default '0', + `item17` int(11) NOT NULL default '0', + `item18` int(11) NOT NULL default '0', + PRIMARY KEY (`setguid`), + UNIQUE KEY `idx_set` (`guid`,`setguid`,`setindex`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); +UPDATE `characters` SET `data` = CONCAT( + SUBSTRING_INDEX(`data`, ' ', 257 + 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 1), ' ', -261 + 260 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18 + 1), ' ', -261 - 18 + 260 + 18 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*2 + 1), ' ', -261 - 18*2 + 260 + 18*2 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*3 + 1), ' ', -261 - 18*3 + 260 + 18*3 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*4 + 1), ' ', -261 - 18*4 + 260 + 18*4 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*5 + 1), ' ', -261 - 18*5 + 260 + 18*5 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*6 + 1), ' ', -261 - 18*6 + 260 + 18*6 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*7 + 1), ' ', -261 - 18*7 + 260 + 18*7 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*8 + 1), ' ', -261 - 18*8 + 260 + 18*8 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*9 + 1), ' ', -261 - 18*9 + 260 + 18*9 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*10 + 1), ' ', -261 - 18*10 + 260 + 18*10 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*11 + 1), ' ', -261 - 18*11 + 260 + 18*11 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*12 + 1), ' ', -261 - 18*12 + 260 + 18*12 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*13 + 1), ' ', -261 - 18*13 + 260 + 18*13 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*14 + 1), ' ', -261 - 18*14 + 260 + 18*14 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*15 + 1), ' ', -261 - 18*15 + 260 + 18*15 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*16 + 1), ' ', -261 - 18*16 + 260 + 18*16 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*17 + 1), ' ', -261 - 18*17 + 260 + 18*17 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 261 + 18*18 + 1), ' ', -261 - 18*18 + 260 + 18*18 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 837 + 1), ' ', -837 + 600 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 937 + 1), ' ', -937 + 874 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1007 + 1), ' ', -1007 + 1002 - 1), ' ', + '0 0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1688 + 1), ' ', -1688 + 1008 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1696 + 1), ' ', -1696 + 1691 - 1), ' ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1700 + 1), ' ', -1700 + 1699 - 1), ' ' + ) +WHERE length(SUBSTRING_INDEX(data, ' ', 1700)) < length(data) and length(SUBSTRING_INDEX(data, ' ', 1701)) >= length(data); +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); diff --git a/sql/updates/3.1.3_old/3920_world_309-313_converter.sql b/sql/updates/3.1.3_old/3920_world_309-313_converter.sql new file mode 100644 index 0000000..695748c --- /dev/null +++ b/sql/updates/3.1.3_old/3920_world_309-313_converter.sql @@ -0,0 +1,66 @@ +ALTER TABLE `item_template` + DROP COLUMN `dmg_type3`, + DROP COLUMN `dmg_max3`, + DROP COLUMN `dmg_min3`, + DROP COLUMN `dmg_type4`, + DROP COLUMN `dmg_max4`, + DROP COLUMN `dmg_min4`, + DROP COLUMN `dmg_type5`, + DROP COLUMN `dmg_max5`, + DROP COLUMN `dmg_min5`; + +ALTER TABLE `creature_template` + ADD COLUMN `unk1` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `heroic_entry`, + ADD COLUMN `unk2` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `unk1`, + ADD COLUMN `questItem1` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `RacialLeader`, + ADD COLUMN `questItem2` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `questItem1`, + ADD COLUMN `questItem3` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `questItem2`, + ADD COLUMN `questItem4` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `questItem3`, + ADD COLUMN `movementId` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `questItem4`; + +ALTER TABLE `item_template` + ADD COLUMN `HolidayId` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `ItemLimitCategory`; + +ALTER TABLE `gameobject_template` + ADD COLUMN `unk1` varchar(100) NOT NULL default '' AFTER `castBarCaption`, + ADD COLUMN `questItem1` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `size`, + ADD COLUMN `questItem2` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `questItem1`, + ADD COLUMN `questItem3` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `questItem2`, + ADD COLUMN `questItem4` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `questItem3`; + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (18265); + +/* Blackout removed */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (15268, 15269, 15323, 15324, 15325, 15326); +/* Improved Wing Clip removed */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (19228, 19232, 19233); +/* Shadow Mastery, not have charges now */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (17794,17797,17798,17799,17800); +/* Lightning Overload have 3 ranks now, 2 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (30680,30681); +/* Unleashed Rage have 3 ranks now, 2 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (30806,30807,30810,30811); +/* Concussive Barrage have 2 ranks now, 1 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (35103); +/* Demonic Empathy, removed */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (47232,47234,47235); +/* Rapture have 3 ranks now, 2 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (47538,47539); +/* Psychic Horror have 1 rank now, 1 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (47572); +/* Sudden Doom have 3 ranks now, 2 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (49531,49532); +/* Hunting Party have 3 ranks now, 2 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (53293,53294); +/* Righteous Vengeance have 3 ranks now, 2 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (53383,53384); +/* Night of the Dead not have charges now */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (55620,55623); +/* Pandemic have 1 rank, 2 dropped */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (58436,58437); +/* Improved Holy Concentration, removed */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (47549,47551,47552); +/* Serendipity, replace by aanother spell ids */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (47555,47556,47557); +/* T.N.T. non triggring now */ +DELETE FROM `spell_proc_event` WHERE `entry` IN (56333,56336,56337); diff --git a/sql/updates/3.1.3_old/3927_world_spell_proc_event.sql b/sql/updates/3.1.3_old/3927_world_spell_proc_event.sql new file mode 100644 index 0000000..526afb8 --- /dev/null +++ b/sql/updates/3.1.3_old/3927_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (59088, 59089, 58388, 56374); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(59088, 0x00, 4, 0x00000000, 0x00000002, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Spell Reflection +(59089, 0x00, 4, 0x00000000, 0x00000002, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Spell Reflection +(56374, 0x00, 3, 0x00000000, 0x00004000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0); -- Glyph of icy veins diff --git a/sql/updates/3.1.3_old/3943_world_spell_proc_event.sql b/sql/updates/3.1.3_old/3943_world_spell_proc_event.sql new file mode 100644 index 0000000..7d4c96c --- /dev/null +++ b/sql/updates/3.1.3_old/3943_world_spell_proc_event.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (52610); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(52610, 0x00, 7, 0x80000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0); -- Savage roar + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (52610, -52610); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 52610, 62071, 0, 'Savage Roar'), +( -52610, -62071, 0, 'Savage Roar'); diff --git a/sql/updates/3.1.3_old/3947_world_spell_proc_event.sql b/sql/updates/3.1.3_old/3947_world_spell_proc_event.sql new file mode 100644 index 0000000..6859fc9 --- /dev/null +++ b/sql/updates/3.1.3_old/3947_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (53397); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(53397, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0); -- Invigoration diff --git a/sql/updates/3.1.3_old/3951_world_spell_proc_event.sql b/sql/updates/3.1.3_old/3951_world_spell_proc_event.sql new file mode 100644 index 0000000..ec0d9d9 --- /dev/null +++ b/sql/updates/3.1.3_old/3951_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (53646); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(53646, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0); -- Demonic Pact diff --git a/sql/updates/3.1.3_old/3952_world_spell_pet_auras.sql b/sql/updates/3.1.3_old/3952_world_spell_pet_auras.sql new file mode 100644 index 0000000..ec9083d --- /dev/null +++ b/sql/updates/3.1.3_old/3952_world_spell_pet_auras.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_pet_auras` WHERE `spell` IN (18754, 18755, 18756); +INSERT INTO `spell_pet_auras` VALUES +(18754,65536,18754), +(18755,65536,18755), +(18756,65536,18756); diff --git a/sql/updates/3.1.3_old/3954_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/3954_world_spell_bonus_data.sql new file mode 100644 index 0000000..6e35ce4 --- /dev/null +++ b/sql/updates/3.1.3_old/3954_world_spell_bonus_data.sql @@ -0,0 +1,10 @@ +DELETE FROM `spell_bonus_data` WHERE entry IN (31893, 32221, 31898, 32220, 53719, 53718, 53726, 53725); +INSERT INTO `spell_bonus_data` VALUES +(31893, 0, 0, 0, "Paladin - Seal of Blood Proc Enemy"), +(32221, 0, 0, 0, "Paladin - Seal of Blood Proc Self"), +(31898, 0.25, 0, 0.16, "Paladin - Judgement of Blood Enemy"), +(32220, 0.0833, 0, 0.0533, "Paladin - Judgement of Blood Self"), +(53719, 0, 0, 0, "Paladin - Seal of the Martyr Proc Enemy"), +(53718, 0, 0, 0, "Paladin - Seal of the Martyr Proc Self"), +(53726, 0.25, 0, 0.16, "Paladin - Judgement of the Martyr Enemy"), +(53725, 0.0833, 0, 0.0533, "Paladin - Judgement of the Martyr Self"); diff --git a/sql/updates/3.1.3_old/3956_world_spell_proc_event.sql b/sql/updates/3.1.3_old/3956_world_spell_proc_event.sql new file mode 100644 index 0000000..a7dcc25 --- /dev/null +++ b/sql/updates/3.1.3_old/3956_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (49531,49532); diff --git a/sql/updates/3.1.3_old/3969_world_spell_proc_event.sql b/sql/updates/3.1.3_old/3969_world_spell_proc_event.sql new file mode 100644 index 0000000..bca25a6 --- /dev/null +++ b/sql/updates/3.1.3_old/3969_world_spell_proc_event.sql @@ -0,0 +1,42 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (35553, 35552, 35551, 35550, 35541); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(35553, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency +(35552, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency +(35551, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency +(35550, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0), -- Combat Potency +(35541, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800000, 0x00000000, 0, 0, 0); -- Combat Potency + +DELETE FROM `spell_proc_event` WHERE `entry` IN (20375, 50781, 51414, 54695, 54838, 54841, 55747, 57352, 58442, 58444, 58901, 59345, 60061, 60063, 60066, 60221, 60301, 60306, 60317, 60436, 60473, 60482, 60487, 60490, 60519, 60537, 38347, 34320, 33297, 38299, 59630, 61356); +INSERT INTO `spell_proc_event`(`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(20375, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 7, 0, 1), -- Seal of Command +(50781, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 6), -- Fate Rune of Primal Energy +(51414, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Venomous Tome +(54695, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Death Knights Anguish +(54838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Valonforths Remembrance +(54841, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 3), -- Thunder Capacitor +(55747, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Horn of Argent Fury +(57352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000288AA, 0x00000000, 0, 0, 45), -- Darkmoon Card: Death +(58442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Airy Pale Ale +(58444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 5), -- Worg Tooth Oatmeal Stout +(58901, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Tears of Bitter Anguish +(59345, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Crusaders Locket +(60061, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Scarab of the Infinite Cycle +(60063, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Sundial of the Exiled +(60066, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Hourglass of the Unraveller +(60221, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Essence of Gossamer +(60301, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Meteorite Whetstone +(60306, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Vestige of Haldor +(60317, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Signet of Edward the Odd +(60436, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Grim Toll +(60473, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Forge Ember +(60482, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Pendulum of Telluric Currents +(60487, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Extract of Necromantic Power +(60490, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Embrace of the Spider +(60519, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Spark of Life +(60537, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Soul of the Dead +(38347, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Sextant of Unstable Currents +(34320, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Shiffars Nexus-Horn +(33297, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Quagmirrans Eye +(38299, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Fel Reavers Piston +(59630, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Black Magic +(61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000002A8, 0x00000002, 0, 0, 90); -- Invigorating Earthsiege Diamond diff --git a/sql/updates/3.1.3_old/3991_world_spell_proc_event.sql b/sql/updates/3.1.3_old/3991_world_spell_proc_event.sql new file mode 100644 index 0000000..95f9edf --- /dev/null +++ b/sql/updates/3.1.3_old/3991_world_spell_proc_event.sql @@ -0,0 +1,26 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (28716, 31221, 31222, 31223, 31571, 31572, 31871, 31872, 44745, 61257, 59089, 59088, 58426, 57352, 57318, 56374, 56372, 56337, 56336, 56333, 54787, 53375, 53376, 47570, 47569, 47537, 47536, 47535, 63108); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 28716, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0, 0, 0), -- Rejuvenation +( 31221, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Master of Subtlety (Rank 1) +( 31222, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Master of Subtlety (Rank 2) +( 31223, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Master of Subtlety (Rank 3) +( 31571, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Arcane Potency (Rank 1) +( 31572, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Arcane Potency (Rank 2) +( 31871, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Divine Purpose (Rank 1) +( 31872, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Divine Purpose (Rank 2) +( 44745, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00000400, 0x00002000, 0, 0, 0), -- Shattered Barrier (Rank 1) +( 59088, 0x00, 4, 0x00000000, 0x00000002, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Improved Spell Reflection (Rank 1) +( 59089, 0x00, 4, 0x00000000, 0x00000002, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Improved Spell Reflection (Rank 2) +( 58426, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Overkill +( 57352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Darkmoon Card: Death +( 56374, 0x00, 3, 0x00000000, 0x00004000, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Glyph of Icy Veins +( 56372, 0x00, 3, 0x00000000, 0x00000080, 0x00000000, 0x00000400, 0x00000000, 0, 0, 0), -- Glyph of Ice Block +( 54787, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00000400, 0x00002000, 0, 0, 0), -- Shattered Barrier (Rank 2) +( 53375, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00000400, 0x00000000, 0, 0, 6), -- Sanctified Wrath (Rank 1) +( 53376, 0x00, 10, 0x00000000, 0x00002000, 0x00000000, 0x00000400, 0x00000000, 0, 0, 6), -- Sanctified Wrath (Rank 2) +( 47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0, 50, 0), -- Improved Shadowform (Rank 1) +( 47570, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0, 100, 0), -- Improved Shadowform (Rank 2) +( 47535, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000400, 0x00002000, 0, 0, 12), -- Rapture (Rank 1) +( 47536, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000400, 0x00002000, 0, 0, 12), -- Rapture (Rank 2) +( 47537, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000400, 0x00002000, 0, 0, 12), -- Rapture (Rank 3) +( 63108, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Siphon Life diff --git a/sql/updates/3.1.3_old/3998_sd2.sql b/sql/updates/3.1.3_old/3998_sd2.sql new file mode 100644 index 0000000..6927d6f --- /dev/null +++ b/sql/updates/3.1.3_old/3998_sd2.sql @@ -0,0 +1,7 @@ +DELETE FROM script_texts WHERE entry BETWEEN -1000409 AND -1000407; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000407, '%s howls in delight at the sight of his lunch!',0,2,0,0,'kyle EMOTE_SEE_LUNCH'), +(-1000408, '%s eats his lunch.',0,2,0,0,'kyle EMOTE_EAT_LUNCH'), +(-1000409, '%s thanks you with a special dance.',0,2,0,0,'kyle EMOTE_DANCE'); + +UPDATE `creature_template` SET `ScriptName`='npc_kyle_frenzied' WHERE `entry`=23616; diff --git a/sql/updates/3.1.3_old/3999_sd2.sql b/sql/updates/3.1.3_old/3999_sd2.sql new file mode 100644 index 0000000..aefda08 --- /dev/null +++ b/sql/updates/3.1.3_old/3999_sd2.sql @@ -0,0 +1,5 @@ +DELETE FROM script_texts WHERE entry BETWEEN -1000342 AND -1000340; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000340, 'We made it! Thanks, $N. I couldn''t have gotten without you.', 0, 0, 0, 0, 'npc_deathstalker_erland - SAY_THANKS'), +(-1000341, 'It''s good to see you again, Erland. What is your report?', 0, 0, 0, 0, 'npc_deathstalker_erland - SAY_RANE'), +(-1000342, 'Masses of wolves are to the east, and whoever lived at Malden''s Orchard is gone.', 0, 0, 0, 0, 'npc_deathstalker_erland - SAY_ANSWER'); diff --git a/sql/updates/3.1.3_old/4002_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4002_world_spell_proc_event.sql new file mode 100644 index 0000000..d426dc4 --- /dev/null +++ b/sql/updates/3.1.3_old/4002_world_spell_proc_event.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (50880, 50884, 50885, 50886, 50887, 55610); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 50880, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50884, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50885, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50886, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 50887, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Icy Talons +( 55610, 0x00, 15, 0x00000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Improved Icy Talons diff --git a/sql/updates/3.1.3_old/4003_world_script_waypoint.sql b/sql/updates/3.1.3_old/4003_world_script_waypoint.sql new file mode 100644 index 0000000..603115f --- /dev/null +++ b/sql/updates/3.1.3_old/4003_world_script_waypoint.sql @@ -0,0 +1,28 @@ +DELETE FROM script_waypoint WHERE entry=17969; +INSERT INTO script_waypoint VALUES +(17969, 0, -930.048950, 5288.080078, 23.848402, 0, ''), +(17969, 1, -925.677917, 5296.482910, 18.183748, 0, ''), +(17969, 2, -924.297180, 5299.016113, 17.710915, 0, ''), +(17969, 3, -928.390076, 5317.022949, 18.208593, 0, ''), +(17969, 4, -930.620972, 5329.915039, 18.773422, 0, 'SAY_AMBUSH1'), +(17969, 5, -931.490295, 5357.654785, 18.027155, 0, 'SAY_PROGRESS'), +(17969, 6, -934.777771, 5369.341797, 22.278048, 0, ''), +(17969, 7, -934.521851, 5373.407227, 22.834690, 0, ''), +(17969, 8, -937.008545, 5382.980469, 22.699078, 0, ''), +(17969, 9, -941.948059, 5404.141602, 22.669743, 0, ''), +(17969, 10, -931.244263, 5415.846680, 23.063961, 0, 'at crossroad'), +(17969, 11, -901.497925, 5420.315430, 24.213270, 0, ''), +(17969, 12, -860.311707, 5415.617676, 23.671139, 0, ''), +(17969, 13, -777.988953, 5391.982422, 23.001669, 0, ''), +(17969, 14, -750.362000, 5385.786621, 22.765791, 0, ''), +(17969, 15, -731.339417, 5382.449707, 22.517065, 0, ''), +(17969, 16, -681.235901, 5381.377930, 22.050159, 2500, 'end bridge SAY_AMBUSH2'), +(17969, 17, -637.944458, 5384.338379, 22.205647, 0, 'SAY_END'), +(17969, 18, -608.954407, 5408.715332, 21.630386, 0, ''), +(17969, 19, -598.134277, 5413.608398, 21.412275, 0, ''), +(17969, 20, -571.268982, 5420.771973, 21.184925, 0, ''), +(17969, 21, -553.099915, 5424.616211, 21.193716, 0, ''), +(17969, 22, -524.745483, 5443.945313, 20.977013, 0, ''), +(17969, 23, -502.984985, 5446.283691, 22.149435, 0, ''), +(17969, 24, -472.463959, 5449.546875, 22.561453, 0, ''), +(17969, 25, -454.533264, 5461.302246, 22.602837, 30000, 'quest complete'); diff --git a/sql/updates/3.1.3_old/4006_sd2.sql b/sql/updates/3.1.3_old/4006_sd2.sql new file mode 100644 index 0000000..cfc7233 --- /dev/null +++ b/sql/updates/3.1.3_old/4006_sd2.sql @@ -0,0 +1,10 @@ +UPDATE creature_template SET ScriptName='' WHERE entry=466; +UPDATE script_texts SET content_default='UNUSED', language=0, comment='REUSE ME' WHERE entry=-1000005; + +UPDATE `creature_template` SET `ScriptName`='npc_aged_dying_ancient_kodo' WHERE `entry` IN (4700,4701,4702,11627); + +DELETE FROM script_texts WHERE entry BETWEEN -1000430 AND -1000428; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000428, 'Ah...the wondrous sound of kodos. I love the way they make the ground shake... inspect the beast for me.',0,0,0,0,'kodo round SAY_SMEED_HOME_1'), +(-1000429, 'Hey, look out with that kodo! You had better inspect that beast before i give you credit!',0,0,0,0,'kodo round SAY_SMEED_HOME_2'), +(-1000430, 'That kodo sure is a beauty. Wait a minute, where are my bifocals? Perhaps you should inspect the beast for me.',0,0,0,0,'kodo round SAY_SMEED_HOME_3'); diff --git a/sql/updates/3.1.3_old/4016_world_spell_dk.sql b/sql/updates/3.1.3_old/4016_world_spell_dk.sql new file mode 100644 index 0000000..18e62cc --- /dev/null +++ b/sql/updates/3.1.3_old/4016_world_spell_dk.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_target` WHERE entry IN(53110); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(53110,1,28940); diff --git a/sql/updates/3.1.3_old/4023_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4023_world_spell_proc_event.sql new file mode 100644 index 0000000..4a9c17e --- /dev/null +++ b/sql/updates/3.1.3_old/4023_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (51521, 51522); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 51521, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Improved Stormspike +( 51522, 0x00, 11, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Improved Stormspike diff --git a/sql/updates/3.1.3_old/4030_world.sql b/sql/updates/3.1.3_old/4030_world.sql new file mode 100644 index 0000000..09041e6 --- /dev/null +++ b/sql/updates/3.1.3_old/4030_world.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_nestlewood_owlkin' WHERE `entry`=16518; diff --git a/sql/updates/3.1.3_old/4031_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4031_world_spell_proc_event.sql new file mode 100644 index 0000000..f887ea2 --- /dev/null +++ b/sql/updates/3.1.3_old/4031_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (51698, 51700, 51701); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 51698, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 1), -- Honor Among Thieves +( 51700, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 1), -- Honor Among Thieves +( 51701, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 1); -- Honor Among Thieves diff --git a/sql/updates/3.1.3_old/4032_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4032_world_spell_proc_event.sql new file mode 100644 index 0000000..25c0b56 --- /dev/null +++ b/sql/updates/3.1.3_old/4032_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (51209, 50334); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(51209, 55095, 1, 'Hungering cold - frost fever'), +(50334, 58923, 2, 'Berserk - modify target number aura'); diff --git a/sql/updates/3.1.3_old/4043_world_npc_spellclick_spells.sql b/sql/updates/3.1.3_old/4043_world_npc_spellclick_spells.sql new file mode 100644 index 0000000..3b4a0ee --- /dev/null +++ b/sql/updates/3.1.3_old/4043_world_npc_spellclick_spells.sql @@ -0,0 +1,29 @@ +ALTER TABLE npc_spellclick_spells + DROP COLUMN quest_status, + CHANGE COLUMN quest_id quest_start mediumint(8) unsigned NOT NULL COMMENT 'reference to quest_template', + ADD COLUMN quest_start_active tinyint(1) unsigned NOT NULL default '0' AFTER quest_start, + ADD COLUMN quest_end mediumint(8) unsigned NOT NULL default '0' AFTER quest_start_active; + +/* compatibility with old data */ +UPDATE npc_spellclick_spells + SET quest_end = quest_start, quest_start_active = 1 + WHERE quest_start <> 0; + +DELETE FROM `npc_spellclick_spells` WHERE `spell_id` IN (54568, 54575, 52263, 52280, 52447); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`) VALUES +(29488, 54568, 12670, 1, 0, 3), -- Taxi to Death's Breath +(29501, 54575, 12670, 1, 0, 3), +(28605, 52263, 12680, 1, 12680, 1), -- Stolen Horse +(28606, 52263, 12680, 1, 12680, 1), +(28607, 52263, 12680, 1, 12680, 1), +(28782, 52280, 12687, 1, 12687, 1), -- Unbound Charger +(28833, 52447, 12701, 1, 12701, 1), -- Scarlet Cannon Master +(28887, 52447, 12701, 1, 12701, 1); + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (29912); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`) VALUES +(29912, 55479, 0, 0, 0, 3); -- Obedience Crystal - Force Obedience + +DELETE FROM `spell_target_position` WHERE `id`=51852; +INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES +(51852, 609, 2361.21, -5660.45, 503.828, 4.49); diff --git a/sql/updates/3.1.3_old/4045_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4045_world_spell_proc_event.sql new file mode 100644 index 0000000..fc1034e --- /dev/null +++ b/sql/updates/3.1.3_old/4045_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (51483,51485,51486); +INSERT INTO `spell_proc_event` VALUES +(51483, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0.000000, 0.000000, 0), +(51485, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0.000000, 0.000000, 0), +(51486, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.1.3_old/4063_TC1_1569_world_scripts.sql b/sql/updates/3.1.3_old/4063_TC1_1569_world_scripts.sql new file mode 100644 index 0000000..5fc2287 --- /dev/null +++ b/sql/updates/3.1.3_old/4063_TC1_1569_world_scripts.sql @@ -0,0 +1,3 @@ +-- Razorfen Kraul +UPDATE `instance_template` SET `script` = 'instance_razorfen_kraul' WHERE `map` = '47' LIMIT 1; +UPDATE `creature_template` SET `ScriptName` = 'npc_deaths_head_ward_keeper' WHERE `entry` = '4625' LIMIT 1; diff --git a/sql/updates/3.1.3_old/4066_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4066_world_spell_proc_event.sql new file mode 100644 index 0000000..08adad1 --- /dev/null +++ b/sql/updates/3.1.3_old/4066_world_spell_proc_event.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (64976,64343, 63158, 63156, 51698, 51700, 51701); +INSERT INTO `spell_proc_event` VALUES +( 51698, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Honor Among Thieves (Rank 1) +( 51700, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Honor Among Thieves (Rank 2) +( 51701, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 1), -- Honor Among Thieves (Rank 3) +( 64976, 0x00, 4, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Juggernaut +( 64343, 0x00, 3, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Impact +( 63158, 0x00, 5, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Decimation +( 63156, 0x00, 5, 0x00000001, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Decimation diff --git a/sql/updates/3.1.3_old/4081_world.sql b/sql/updates/3.1.3_old/4081_world.sql new file mode 100644 index 0000000..7f6528c --- /dev/null +++ b/sql/updates/3.1.3_old/4081_world.sql @@ -0,0 +1,15 @@ +DELETE FROM `spell_pet_auras` WHERE `spell` IN(56314, 56315, 56316, 56317, 56318); +INSERT INTO `spell_pet_auras` VALUES +(56314,0,57447), +(56315,0,57482), +(56316,0,57453), +(56317,0,57457), +(56318,0,57458); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN(57447, 57482, 57453, 57457, 57458); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(57447,57485,2,'Kindred Spirits'), +(57482,57484,2,'Kindred Spirits'), +(57453,57483,2,'Kindred Spirits'), +(57457,57482,2,'Kindred Spirits'), +(57458,57475,2,'Kindred Spirits'); diff --git a/sql/updates/3.1.3_old/4105_8030_01_characters_character_spell.sql b/sql/updates/3.1.3_old/4105_8030_01_characters_character_spell.sql new file mode 100644 index 0000000..5d65fce --- /dev/null +++ b/sql/updates/3.1.3_old/4105_8030_01_characters_character_spell.sql @@ -0,0 +1,7 @@ +-- ALTER TABLE character_db_version CHANGE COLUMN required_7988_07_characters_characters required_8030_01_characters_character_spell bit; + +UPDATE IGNORE character_spell + SET spell = 64901 + WHERE spell = 64904; + +DELETE FROM character_spell WHERE spell = 64904; diff --git a/sql/updates/3.1.3_old/4105_8030_02_characters_character_action.sql b/sql/updates/3.1.3_old/4105_8030_02_characters_character_action.sql new file mode 100644 index 0000000..5588350 --- /dev/null +++ b/sql/updates/3.1.3_old/4105_8030_02_characters_character_action.sql @@ -0,0 +1,5 @@ +-- ALTER TABLE character_db_version CHANGE COLUMN required_8030_01_characters_character_spell required_8030_02_characters_character_action bit; + +UPDATE character_action + SET action = 64901 + WHERE action = 64904 AND type = '0'; diff --git a/sql/updates/3.1.3_old/4105_8030_03_mangos_npc_trainer.sql b/sql/updates/3.1.3_old/4105_8030_03_mangos_npc_trainer.sql new file mode 100644 index 0000000..2b6f04b --- /dev/null +++ b/sql/updates/3.1.3_old/4105_8030_03_mangos_npc_trainer.sql @@ -0,0 +1,3 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8021_01_mangos_spell_proc_event required_8030_03_mangos_npc_trainer bit; + +DELETE FROM npc_trainer WHERE spell = 64904; diff --git a/sql/updates/3.1.3_old/4115_world_sd2.sql b/sql/updates/3.1.3_old/4115_world_sd2.sql new file mode 100644 index 0000000..ede0c59 --- /dev/null +++ b/sql/updates/3.1.3_old/4115_world_sd2.sql @@ -0,0 +1,6 @@ +UPDATE creature_template SET ScriptName='' WHERE entry=21845; +UPDATE creature_template SET ScriptName='boss_leotheras_the_blind_demonform' WHERE entry=21875; + +UPDATE script_texts SET content_default='Finally, my banishment ends!' WHERE entry=-1548009; +UPDATE script_texts SET content_default='Be gone, trifling elf. I am in control now!' WHERE entry=-1548010; +UPDATE script_texts SET content_default='No... no! What have you done? I am the master! Do you hear me? I am... aaggh! Can\'t... contain him...' WHERE entry=-1548018; diff --git a/sql/updates/3.1.3_old/4154_world_script.sql b/sql/updates/3.1.3_old/4154_world_script.sql new file mode 100644 index 0000000..1372842 --- /dev/null +++ b/sql/updates/3.1.3_old/4154_world_script.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName='npc_air_force_bots' WHERE entry IN (2614, 2615, 21974, 21993, 21996, 21997, 21999, 22001, 22002, 22003, 22063, 22065, 22066, 22068, 22069, 22070, 22071, 22078, 22079, 22080, 22086, 22087, 22088, 22090, 22124, 22125, 22126); diff --git a/sql/updates/3.1.3_old/4159_world.sql b/sql/updates/3.1.3_old/4159_world.sql new file mode 100644 index 0000000..0077869 --- /dev/null +++ b/sql/updates/3.1.3_old/4159_world.sql @@ -0,0 +1,14 @@ +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 5012 AND 5019; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(5012, 'No maps found!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5013, '[Continent]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5014, '[Instance]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5015, '[Battleground]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5016, '[Arena]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5017, '[Raid reset time: %u]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5018, '[Heroic reset time: %u]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(5019, '[Mountable]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +DELETE FROM `command` WHERE `name` = 'lookup map'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('lookup map', 3, 'Syntax: .lookup map $namepart\r\n\r\nLooks up a map by $namepart, and returns all matches with their map ID''s.'); diff --git a/sql/updates/3.1.3_old/4174_world_script.sql b/sql/updates/3.1.3_old/4174_world_script.sql new file mode 100644 index 0000000..3ed520e --- /dev/null +++ b/sql/updates/3.1.3_old/4174_world_script.sql @@ -0,0 +1 @@ +UPDATE `instance_template` SET `script`='instance_blackfathom_deeps' WHERE `map`=48; diff --git a/sql/updates/3.1.3_old/4176_world.sql b/sql/updates/3.1.3_old/4176_world.sql new file mode 100644 index 0000000..8e471e1 --- /dev/null +++ b/sql/updates/3.1.3_old/4176_world.sql @@ -0,0 +1,2 @@ +UPDATE `trinity_string` SET `content_default` = '[Raid reset time: %s]' WHERE `entry` = 5017; +UPDATE `trinity_string` SET `content_default` = '[Heroic reset time: %s]' WHERE `entry` = 5018; diff --git a/sql/updates/3.1.3_old/4209_characters_TDB.sql b/sql/updates/3.1.3_old/4209_characters_TDB.sql new file mode 100644 index 0000000..a380d2a --- /dev/null +++ b/sql/updates/3.1.3_old/4209_characters_TDB.sql @@ -0,0 +1 @@ +ALTER TABLE character_pet DROP COLUMN load_flags; diff --git a/sql/updates/3.1.3_old/4209_world_TDB.sql b/sql/updates/3.1.3_old/4209_world_TDB.sql new file mode 100644 index 0000000..6baca03 --- /dev/null +++ b/sql/updates/3.1.3_old/4209_world_TDB.sql @@ -0,0 +1,5 @@ +DELETE FROM trinity_string WHERE `entry` = 6616; +DELETE FROM `command` WHERE `name` IN ('reset all','reset talents'); +INSERT INTO `command` VALUES +('reset all',3,'Syntax: .reset all spells\r\n\r\nSyntax: .reset all talents\r\n\r\nRequest reset spells or talents (including talents for all character\'s pets if any) at next login each existed character.'), +('reset talents',3,'Syntax: .reset talents [Playername]\r\n Removes all talents of the targeted player or pet or named player. Playername can be name of offline character. With player talents also will be reset talents for all character\'s pets if any.'); diff --git a/sql/updates/3.1.3_old/4211_world.sql b/sql/updates/3.1.3_old/4211_world.sql new file mode 100644 index 0000000..59c057b --- /dev/null +++ b/sql/updates/3.1.3_old/4211_world.sql @@ -0,0 +1,2 @@ +ALTER TABLE spell_pet_auras ADD effectId TINYINT( 3 ) UNSIGNED NOT NULL AFTER spell; +ALTER TABLE spell_pet_auras DROP PRIMARY KEY, ADD PRIMARY KEY(spell,effectId,pet); diff --git a/sql/updates/3.1.3_old/4216_world.sql b/sql/updates/3.1.3_old/4216_world.sql new file mode 100644 index 0000000..e8fba8f --- /dev/null +++ b/sql/updates/3.1.3_old/4216_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name` IN ('modify tp'); +INSERT INTO `command` VALUES +('modify tp',1,'Syntax: .modify tp #amount\r\n\r\nSte free talent pointes for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'); diff --git a/sql/updates/3.1.3_old/4217_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4217_world_spell_proc_event.sql new file mode 100644 index 0000000..00df39c --- /dev/null +++ b/sql/updates/3.1.3_old/4217_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (13165 ,14318, 14319, 14320, 14321, 14322, 25296, 27044, 61846, 61847); diff --git a/sql/updates/3.1.3_old/4222_world.sql b/sql/updates/3.1.3_old/4222_world.sql new file mode 100644 index 0000000..88cba6a --- /dev/null +++ b/sql/updates/3.1.3_old/4222_world.sql @@ -0,0 +1,13 @@ +DELETE FROM spell_pet_auras where `spell` in (56314,56315,56316, 56317, 56318); +INSERT INTO spell_pet_auras VALUES +(56314, 0, 0, 57447), +(56314, 1, 0, 57485), +(56315, 0, 0, 57452), +(56315, 1, 0, 57484), +(56316, 0, 0, 57453), +(56316, 1, 0, 57483), +(56317, 0, 0, 57457), +(56317, 1, 0, 57482), +(56318, 0, 0, 57458), +(56318, 1, 0, 57475); +DELETE FROM spell_linked_spell where `spell_trigger` in (57447,57482,57453, 57457, 57458); diff --git a/sql/updates/3.1.3_old/4225_world.sql b/sql/updates/3.1.3_old/4225_world.sql new file mode 100644 index 0000000..39aa777 --- /dev/null +++ b/sql/updates/3.1.3_old/4225_world.sql @@ -0,0 +1,9 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (48492, 48494, 48495); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 48492, 0x00, 7, 0x00080000, 0x00000000, 0x00000800, 0x00000400, 0x00000000, 0, 0, 0), -- King of the Jungle (Rank1) +( 48494, 0x00, 7, 0x00080000, 0x00000000, 0x00000800, 0x00000400, 0x00000000, 0, 0, 0), -- King of the Jungle (Rank2) +( 48495, 0x00, 7, 0x00080000, 0x00000000, 0x00000800, 0x00000400, 0x00000000, 0, 0, 0); -- King of the Jungle (Rank3) + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-5229); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( -5229, -51185, 0, 'King of the Jungle - remove with enrage'); diff --git a/sql/updates/3.1.3_old/4233_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4233_world_spell_proc_event.sql new file mode 100644 index 0000000..52b3f27 --- /dev/null +++ b/sql/updates/3.1.3_old/4233_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (17794 ,17797, 17798, 17799, 17800, 55620, 55623, 58435); diff --git a/sql/updates/3.1.3_old/4234_world_spell_bonus_data_TDB.sql b/sql/updates/3.1.3_old/4234_world_spell_bonus_data_TDB.sql new file mode 100644 index 0000000..5bf95f4 --- /dev/null +++ b/sql/updates/3.1.3_old/4234_world_spell_bonus_data_TDB.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry`='17962'; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +('17962', '0', '0', '0', 'Warlock - Conflagrate'); diff --git a/sql/updates/3.1.3_old/4246_world_script.sql b/sql/updates/3.1.3_old/4246_world_script.sql new file mode 100644 index 0000000..8773215 --- /dev/null +++ b/sql/updates/3.1.3_old/4246_world_script.sql @@ -0,0 +1,19 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1609016 AND -1609000; +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1609000, 'You have made a grave error, fiend!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_1' ), +(-1609001, 'I was a soldier of the Light once... Look at what I have become... ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_2'), +(-1609002, 'You are hopelessly outmatched\, $R.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_3'), +(-1609003, 'They brand me unworthy? I will show them unmorthy!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_4'), +(-1609004, 'You will allow me a weapon and armor, yes?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_5'), +(-1609005, 'I will win my freedom and leave this cursed place!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_6'), +(-1609006, 'I will dismantle this festering hellhole!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_7'), +(-1609007, 'There can be only one survivor!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_START_8'), +(-1609008, 'To battle!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_1'), +(-1609009, 'Let your fears consume you!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_2'), +(-1609010, 'HAH! You can barely hold a blade! Yours will be a quick death.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_3'), +(-1609011, 'And now you die', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_4'), +(-1609012, 'To battle!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_5'), +(-1609013, 'There is no hope for our future...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_6'), +(-1609014, 'Sate your hunger on cold steel\, $R', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_7'), +(-1609015, 'It ends here!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_8'), +(-1609016, 'Death is the only cure!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'unworthy_initiate SAY_EVENT_ATTACK_9'); diff --git a/sql/updates/3.1.3_old/4258_world_TDB.sql b/sql/updates/3.1.3_old/4258_world_TDB.sql new file mode 100644 index 0000000..d9764e5 --- /dev/null +++ b/sql/updates/3.1.3_old/4258_world_TDB.sql @@ -0,0 +1,8 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (300, 301); +INSERT INTO `trinity_string` (`entry`, `content_default`)VALUES +('300', 'Your chat has been disabled for %u minutes. Reason: %s.'), +('301', 'You have disabled %s\'s chat for %u minutes. Reason: %s.'); + +DELETE FROM `command` WHERE `name` = 'mute'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('mute', 1 ,'Syntax: .mute [$playerName] $timeInMinutes [$reason]\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'); diff --git a/sql/updates/3.1.3_old/4276_world_TDB.sql b/sql/updates/3.1.3_old/4276_world_TDB.sql new file mode 100644 index 0000000..ea9df1a --- /dev/null +++ b/sql/updates/3.1.3_old/4276_world_TDB.sql @@ -0,0 +1,14 @@ +REPLACE INTO gameobject_template VALUES (178925,1,5651,"Alliance Banner","","","",83,0,1,0,0,0,0,0,1479,196608,180421,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (178943,1,5652,"Horde Banner","","","",84,0,1,0,0,0,0,0,1479,196608,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (178940,1,5653,"Contested Banner","","","",83,0,1,0,0,0,0,0,1479,196608,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (179435,1,5654,"Contested Banner","","","",84,0,1,0,0,0,0,0,1479,196608,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (178365,1,5771,"Alliance Banner","","","",83,0,1,0,0,0,0,0,1479,196608,180100,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (179286,1,5772,"Contested Banner","","","",83,0,1,0,0,0,0,0,1479,196608,180102,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (179287,1,5774,"Contested Banner","","","",84,0,1,0,0,0,0,0,1479,0,180102,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (180418,1,6211,"Snowfall Banner","","","",0,0,1,0,0,0,0,0,1479,196608,180100,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (180100,6,2232,"Alliance Banner Aura","","","",0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (180102,6,266,"Neutral Banner Aura","","","",0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (180101,6,1311,"Horde Banner Aura","","","",0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (180421,6,2232,"Alliance Banner Aura, Large","","","",0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (180423,6,266,"Neutral Banner Aura, Large","","","",0,0,5,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,""); +REPLACE INTO gameobject_template VALUES (180422,6,1311,"Horde Banner Aura, Large","","","",0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,""); diff --git a/sql/updates/3.1.3_old/4283_world_TDB.sql b/sql/updates/3.1.3_old/4283_world_TDB.sql new file mode 100644 index 0000000..f17f0a4 --- /dev/null +++ b/sql/updates/3.1.3_old/4283_world_TDB.sql @@ -0,0 +1,82 @@ +DELETE FROM pet_levelstats WHERE creature_entry = 26125; +INSERT INTO `pet_levelstats` (`creature_entry`, `level`, `hp`, `mana`, `armor`, `str`, `agi`, `sta`, `inte`, `spi`) VALUES +('26125','1','48','80','10','20','16','13','20','8'), +('26125','2','105','106','67','22','17','14','21','9'), +('26125','3','162','132','124','24','18','15','22','10'), +('26125','4','219','158','181','26','19','16','23','11'), +('26125','5','276','184','238','28','20','17','24','12'), +('26125','6','333','210','295','30','21','18','25','13'), +('26125','7','390','236','352','32','22','19','26','14'), +('26125','8','447','262','409','34','23','20','27','15'), +('26125','9','504','288','466','36','24','21','28','16'), +('26125','10','561','314','523','38','25','22','29','17'), +('26125','11','618','340','580','40','26','23','30','18'), +('26125','12','675','366','637','42','27','24','31','19'), +('26125','13','732','392','694','44','28','25','32','20'), +('26125','14','789','418','751','46','29','26','33','21'), +('26125','15','846','444','808','48','30','27','34','22'), +('26125','16','903','470','865','50','31','28','35','23'), +('26125','17','960','496','922','52','32','29','36','24'), +('26125','18','1017','522','979','54','33','30','37','25'), +('26125','19','1074','548','1036','56','34','31','38','26'), +('26125','20','1131','574','1093','58','35','32','39','27'), +('26125','21','1188','600','1150','60','36','33','40','28'), +('26125','22','1245','626','1207','62','37','34','41','29'), +('26125','23','1302','652','1264','64','38','35','42','30'), +('26125','24','1359','678','1321','66','39','36','43','31'), +('26125','25','1416','704','1378','68','40','37','44','32'), +('26125','26','1473','730','1435','70','41','38','45','33'), +('26125','27','1530','756','1492','72','42','39','46','34'), +('26125','28','1587','782','1549','74','43','40','47','35'), +('26125','29','1644','808','1606','76','44','41','48','36'), +('26125','30','1701','834','1663','78','45','42','49','37'), +('26125','31','1758','860','1720','80','46','43','50','38'), +('26125','32','1815','886','1777','82','47','44','51','39'), +('26125','33','1872','912','1834','84','48','45','52','40'), +('26125','34','1929','938','1891','86','49','46','53','41'), +('26125','35','1986','964','1948','88','50','47','54','42'), +('26125','36','2043','990','2005','90','51','48','55','43'), +('26125','37','2100','1016','2062','92','52','49','56','44'), +('26125','38','2157','1042','2119','94','53','50','57','45'), +('26125','39','2214','1068','2176','96','54','51','58','46'), +('26125','40','2271','1094','2233','98','55','52','59','47'), +('26125','41','2328','1120','2290','100','56','53','60','48'), +('26125','42','2385','1146','2347','102','57','54','61','49'), +('26125','43','2442','1172','2404','104','58','55','62','50'), +('26125','44','2499','1198','2461','106','59','56','63','51'), +('26125','45','2556','1224','2518','108','60','57','64','52'), +('26125','46','2613','1250','2575','110','61','58','65','53'), +('26125','47','2670','1276','2632','112','62','59','66','54'), +('26125','48','2727','1302','2689','114','63','60','67','55'), +('26125','49','2784','1328','2746','116','64','61','68','56'), +('26125','50','2841','1354','2803','118','65','62','69','57'), +('26125','51','2898','1380','2860','120','66','63','70','58'), +('26125','52','2955','1406','2917','122','67','64','71','59'), +('26125','53','3012','1432','2974','124','68','65','72','60'), +('26125','54','3069','1458','3031','126','69','66','73','61'), +('26125','55','3126','1484','3088','128','70','67','74','62'), +('26125','56','3183','1510','3145','130','71','68','75','63'), +('26125','57','3240','1536','3202','132','72','69','76','64'), +('26125','58','3297','1562','3259','134','73','70','77','65'), +('26125','59','3354','1588','3316','136','74','71','78','66'), +('26125','60','3411','1614','3373','138','75','72','79','67'), +('26125','61','3468','1640','3430','140','76','73','80','68'), +('26125','62','3525','1666','3487','142','77','74','81','69'), +('26125','63','3582','1692','3544','144','78','75','82','70'), +('26125','64','3639','1718','3601','146','79','76','83','71'), +('26125','65','3696','1744','3658','148','80','77','84','72'), +('26125','66','3753','1770','3715','150','81','78','85','73'), +('26125','67','3810','1796','3772','152','82','79','86','74'), +('26125','68','3867','1822','3829','154','83','80','87','75'), +('26125','69','3924','1848','3886','156','84','81','88','76'), +('26125','70','3981','1874','3943','158','85','82','89','77'), +('26125','71','4038','1900','4000','160','86','83','90','78'), +('26125','72','4095','1926','4057','162','87','84','91','79'), +('26125','73','4152','1952','4114','164','88','85','92','80'), +('26125','74','4209','1978','4171','166','89','86','93','81'), +('26125','75','4266','2004','4228','168','90','87','94','82'), +('26125','76','4323','2030','4285','170','91','88','95','83'), +('26125','77','4380','2056','4342','172','92','89','96','84'), +('26125','78','4437','2082','4399','174','93','90','97','85'), +('26125','79','4494','2108','4456','176','94','91','98','86'), +('26125','80','4551','2134','4513','178','95','92','99','87'); diff --git a/sql/updates/3.1.3_old/4292_8072_01_characters_characters.sql b/sql/updates/3.1.3_old/4292_8072_01_characters_characters.sql new file mode 100644 index 0000000..663fc48 --- /dev/null +++ b/sql/updates/3.1.3_old/4292_8072_01_characters_characters.sql @@ -0,0 +1,10 @@ +-- ALTER TABLE character_db_version CHANGE COLUMN required_8030_02_characters_character_action required_8072_01_characters_characters bit; + +ALTER TABLE characters +ADD gender TINYINT UNSIGNED NOT NULL default '0' AFTER class, +ADD level TINYINT UNSIGNED NOT NULL default '0' AFTER gender, +ADD xp INT UNSIGNED NOT NULL default '0' AFTER level, +ADD money INT UNSIGNED NOT NULL default '0' AFTER xp, +ADD playerBytes INT UNSIGNED NOT NULL default '0' AFTER money, +ADD playerBytes2 INT UNSIGNED NOT NULL default '0' AFTER playerBytes, +ADD playerFlags INT UNSIGNED NOT NULL default '0' AFTER playerBytes2; diff --git a/sql/updates/3.1.3_old/4292_8072_02_characters_characters.sql b/sql/updates/3.1.3_old/4292_8072_02_characters_characters.sql new file mode 100644 index 0000000..06fa04c --- /dev/null +++ b/sql/updates/3.1.3_old/4292_8072_02_characters_characters.sql @@ -0,0 +1,11 @@ +-- ALTER TABLE character_db_version CHANGE COLUMN required_8072_01_characters_characters required_8072_02_characters_characters bit; + +UPDATE characters SET +gender = (CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 23), ' ', -1) AS UNSIGNED) & 0xFF0000) >> 16, +level = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 54), ' ', -1) AS UNSIGNED), +xp = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 609), ' ', -1) AS UNSIGNED), +money = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 1145), ' ', -1) AS UNSIGNED), +playerBytes = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 154), ' ', -1) AS UNSIGNED), +playerBytes2 = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 155), ' ', -1) AS UNSIGNED), +playerFlags = CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(data, ' ', 151), ' ', -1) AS UNSIGNED) +WHERE LENGTH(SUBSTRING_INDEX(data, ' ', 1294)) < LENGTH(data) && LENGTH(data) <= LENGTH(SUBSTRING_INDEX(data, ' ', 1295)); diff --git a/sql/updates/3.1.3_old/4307_world_TDB.sql b/sql/updates/3.1.3_old/4307_world_TDB.sql new file mode 100644 index 0000000..9385003 --- /dev/null +++ b/sql/updates/3.1.3_old/4307_world_TDB.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (16857); +DELETE FROM `spell_bonus_data` WHERE `entry` IN (60089); +INSERT INTO `spell_bonus_data` (entry, direct_bonus, dot_bonus, ap_bonus, comments) VALUES +(60089, 0, 0, 0.05, 'Faerie Fire (feral)'); diff --git a/sql/updates/3.1.3_old/4308_world_TDB.sql b/sql/updates/3.1.3_old/4308_world_TDB.sql new file mode 100644 index 0000000..248bdef --- /dev/null +++ b/sql/updates/3.1.3_old/4308_world_TDB.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (20187); +INSERT INTO `spell_bonus_data` (entry, direct_bonus, dot_bonus, ap_bonus, comments) VALUES +(20187, 0.4, 0, 0.25, 'Judgement of Righteousness'); diff --git a/sql/updates/3.1.3_old/4320_world_.sql b/sql/updates/3.1.3_old/4320_world_.sql new file mode 100644 index 0000000..a89e44b --- /dev/null +++ b/sql/updates/3.1.3_old/4320_world_.sql @@ -0,0 +1,20 @@ +DELETE FROM `spell_enchant_proc_data` WHERE `entry` IN (703, 704, 705, 706, 2644, 3772, 3773, 323, 324, 325, 623, 624, 625, 2641, 3768, 3769); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES + -- Wound Poison +(703, 0, 21.43,0), +(704, 0, 21.43,0), +(705, 0, 21.43,0), +(706, 0, 21.43,0), +(2644, 0, 21.43,0), +(3772, 0, 21.43,0), +(3773, 0, 21.43,0), + -- Instant Poison +(323, 0, 8.53,0), +(324, 0, 8.53,0), +(325, 0, 8.53,0), +(623, 0, 8.53,0), +(624, 0, 8.53,0), +(625, 0, 8.53,0), +(2641, 0, 8.53,0), +(3768, 0, 8.53,0), +(3769, 0, 8.53,0); diff --git a/sql/updates/3.1.3_old/4321_world.sql b/sql/updates/3.1.3_old/4321_world.sql new file mode 100644 index 0000000..33365e7 --- /dev/null +++ b/sql/updates/3.1.3_old/4321_world.sql @@ -0,0 +1,36 @@ +DELETE FROM `creature_questrelation` WHERE `quest`=12701; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28377, 12701); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12701; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28377, 12701); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12723; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12723); +DELETE FROM `creature_questrelation` WHERE `quest`=12724; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12724); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12724; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12724); +DELETE FROM `creature_questrelation` WHERE `quest`=12725; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28913, 12725); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12725; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28912, 12725); +DELETE FROM `creature_questrelation` WHERE `quest`=12727; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28912, 12727); +DELETE FROM `creature_involvedrelation` WHERE `quest`=12727; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28913, 12727); + +DELETE FROM `spell_script_target` WHERE `entry` IN (48714,57806); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +('48714', '2', '27237'), +('48714', '2', '27235'), +('48714', '2', '27234'), +('48714', '2', '27236'), +('57806', '2', '31043'); + +UPDATE `creature_template` SET `ScriptName`='npc_aged_dying_ancient_kodo' WHERE `entry` IN (4700,4701,4702,11627); + +DELETE FROM `spell_target_position` WHERE `id`=51852; +INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES +(51852, 609, 2361.21, -5660.45, 503.828, 4.49); + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (20187); +INSERT INTO `spell_bonus_data` (entry, direct_bonus, dot_bonus, ap_bonus, comments) VALUES +(20187, 0.4, 0, 0.25, 'Judgement of Righteousness'); diff --git a/sql/updates/3.1.3_old/4346_8098_characters.sql b/sql/updates/3.1.3_old/4346_8098_characters.sql new file mode 100644 index 0000000..11a7856 --- /dev/null +++ b/sql/updates/3.1.3_old/4346_8098_characters.sql @@ -0,0 +1,27 @@ +/*ALTER TABLE character_db_version CHANGE COLUMN required_8072_02_characters_characters required_8098_01_characters_character_action bit;*/ + +ALTER TABLE character_action + CHANGE COLUMN action action int(11) unsigned NOT NULL default '0'; + +UPDATE character_action + SET action = action | ( misc << 16 ); + +ALTER TABLE character_action + DROP COLUMN misc; + + +UPDATE character_pet + SET abdata = CONCAT( + (SUBSTRING(abdata, 1, length(SUBSTRING_INDEX(abdata, ' ', 1))) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 1))+2, length(SUBSTRING_INDEX(abdata, ' ', 2))-length(SUBSTRING_INDEX(abdata, ' ', 1))-1),' ', + (SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 2))+2, length(SUBSTRING_INDEX(abdata, ' ', 3))-length(SUBSTRING_INDEX(abdata, ' ', 2))-1) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 3))+2, length(SUBSTRING_INDEX(abdata, ' ', 4))-length(SUBSTRING_INDEX(abdata, ' ', 3))-1),' ', + (SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 4))+2, length(SUBSTRING_INDEX(abdata, ' ', 5))-length(SUBSTRING_INDEX(abdata, ' ', 4))-1) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 5))+2, length(SUBSTRING_INDEX(abdata, ' ', 6))-length(SUBSTRING_INDEX(abdata, ' ', 5))-1),' ', + (SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 6))+2, length(SUBSTRING_INDEX(abdata, ' ', 7))-length(SUBSTRING_INDEX(abdata, ' ', 6))-1) >> 8),' ', + SUBSTRING(abdata, length(SUBSTRING_INDEX(abdata, ' ', 7))+2, length(SUBSTRING_INDEX(abdata, ' ', 8))-length(SUBSTRING_INDEX(abdata, ' ', 7))-1),' ' + ); + + +UPDATE pet_spell + SET active = ( active >> 8); diff --git a/sql/updates/3.1.3_old/4346_8098_world.sql b/sql/updates/3.1.3_old/4346_8098_world.sql new file mode 100644 index 0000000..ad81835 --- /dev/null +++ b/sql/updates/3.1.3_old/4346_8098_world.sql @@ -0,0 +1,10 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8071_01_mangos_command required_8098_02_mangos_playercreateinfo_action bit; + +ALTER TABLE playercreateinfo_action + CHANGE COLUMN action action int(11) unsigned NOT NULL default '0'; + +UPDATE playercreateinfo_action + SET action = action | ( misc << 16 ); + +ALTER TABLE playercreateinfo_action + DROP COLUMN misc; diff --git a/sql/updates/3.1.3_old/4351_8104_01_characters.sql b/sql/updates/3.1.3_old/4351_8104_01_characters.sql new file mode 100644 index 0000000..aa5ec77 --- /dev/null +++ b/sql/updates/3.1.3_old/4351_8104_01_characters.sql @@ -0,0 +1,7 @@ +-- ALTER TABLE character_db_version CHANGE COLUMN required_8098_04_characters_pet_spell required_8104_01_characters bit; + +ALTER TABLE character_achievement ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE character_achievement_progress ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE character_declinedname ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +ALTER TABLE character_pet_declinedname ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +ALTER TABLE guild_eventlog ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'Guild Eventlog'; diff --git a/sql/updates/3.1.3_old/4352_spell_bonus_data_full.sql b/sql/updates/3.1.3_old/4352_spell_bonus_data_full.sql new file mode 100644 index 0000000..8742309 --- /dev/null +++ b/sql/updates/3.1.3_old/4352_spell_bonus_data_full.sql @@ -0,0 +1,287 @@ +TRUNCATE TABLE `spell_bonus_data`; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +(49941, 0, 0, 0.04, 'Death Knight - Blood Boil'), +(48721, 0, 0, 0.04, 'Death Knight - Blood Boil'), +(55078, 0, 0, 0.055, 'Death Knight - Blood Plague'), +(50444, 0, 0, 0.105, 'Death Knight - Corpse Explosion Triggered'), +(52212, 0, 0, 0.0475, 'Death Knight - Death and Decay'), +(47632, 0, 0, 0.15, 'Death Knight - Death Coil'), +(47633, 0, 0, 0.15, 'Death Knight - Death Coil Heal'), +(55095, 0, 0, 0.055, 'Death Knight - Frost Fever'), +(49184, 0, 0, 0.1, 'Death Knight - Howling Blast'), +(45477, 0, 0, 0.1, 'Death Knight - Icy Touch'), +(56903, 0, 0, 0, 'Death Knight - Lichflame'), +(50842, 0, 0, 0.04, 'Death Knight - Pestilence'), +(50401, 0, 0, 0, 'Death Knight - Razor Frost'), +(47476, 0, 0, 0.06, 'Death Knight - Strangulate'), +(50536, 0, 0, 0.013, 'Death Knight - Unholy Blight (Rank1)'), +(51373, 0, 0, 0.013, 'Death Knight - Unholy Blight (Rank2)'), +(51374, 0, 0, 0.013, 'Death Knight - Unholy Blight (Rank3)'), +(51375, 0, 0, 0.013, 'Death Knight - Unholy Blight (Rank4)'), +(339, 0, 0.1, 0, 'Druid - Entangling Roots'), +(5185, 1.611, 0, 0, 'Druid - Healing Touch'), +(42231, 0.12898, 0, 0, 'Druid - Hurricane Triggered'), +(5570, 0, 0.2, 0, 'Druid - Insect Swarm'), +(33763, 0.6453, 0.09518, 0, 'Druid - Lifebloom'), +(8921, 0.1515, 0.13, 0, 'Druid - Moonfire'), +(50464, 0.67305, 0, 0, 'Druid - Nourish'), +(8936, 0.539, 0.188, 0, 'Druid - Regrowth'), +(774, 0, 0.37604, 0, 'Druid - Rejuvenation'), +(50294, 0.0119, 0, 0, 'Druid - Starfall AOE rank 1'), +(53188, 0.0119, 0, 0, 'Druid - Starfall AOE rank 2'), +(53189, 0.0119, 0, 0, 'Druid - Starfall AOE rank 3'), +(53190, 0.0119, 0, 0, 'Druid - Starfall AOE rank 4'), +(50288, 0.0458, 0, 0, 'Druid - Starfall rank 1'), +(53191, 0.0458, 0, 0, 'Druid - Starfall rank 2'), +(53194, 0.0458, 0, 0, 'Druid - Starfall rank 3'), +(53195, 0.0458, 0, 0, 'Druid - Starfall rank 4'), +(2912, 1, 0, 0, 'Druid - Starfire'), +(18562, 0, 0, 0, 'Druid - Swiftmend'), +(44203, 0.538, 0, 0, 'Druid - Tranquility Triggered'), +(61391, 0.193, 0, 0, 'Druid - Typhoon'), +(48438, 0, 0.11505, 0, 'Druid - Wild Growth'), +(5176, 0.5714, 0, 0, 'Druid - Wrath'), +(60089, 0, 0, 0.05, 'Faerie Fire (feral)'), +(55039, 0, 0, 0, 'Item - Gnomish Lightning Generator'), +(44425, 0.7143, 0, 0, 'Mage - Arcane Barrage'), +(30451, 0.7143, 0, 0, 'Mage - Arcane Blast'), +(1449, 0.2128, 0, 0, 'Mage - Arcane Explosion'), +(7268, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 1'), +(38700, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 10'), +(38703, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 11'), +(42844, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 12'), +(42845, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 13'), +(7269, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 2'), +(7270, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 3'), +(8419, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 4'), +(8418, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 5'), +(10273, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 6'), +(10274, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 7'), +(25346, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 8'), +(27076, 0.2857, 0, 0, 'Mage - Arcane Missiles Triggered Spell Rank 9'), +(11113, 0.1936, 0, 0, 'Mage - Blast Wave'), +(42208, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 1'), +(42209, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 2'), +(42210, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 3'), +(42211, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 4'), +(42212, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 5'), +(42213, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 6'), +(42198, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 7'), +(42937, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 8'), +(42938, 0.1437, 0, 0, 'Mage - Blizzard Triggered Spell Rank 9'), +(120, 0.214, 0, 0, 'Mage - Cone of Cold'), +(31661, 0.1936, 0, 0, 'Mage - Dragons Breath'), +(133, 1, 0, 0, 'Mage - Fire Ball'), +(2136, 0.4286, 0, 0, 'Mage - Fire Blast'), +(543, 0.1, 0, 0, 'Mage - Fire Ward'), +(2120, 0.2357, 0.122, 0, 'Mage - Flamestrike'), +(116, 0.8143, 0, 0, 'Mage - Frost Bolt'), +(122, 0.193, 0, 0, 'Mage - Frost Nova'), +(6143, 0.1, 0, 0, 'Mage - Frost Ward'), +(44614, 0.8571, 0, 0, 'Mage - Frostfire Bolt'), +(11426, 0.8053, 0, 0, 'Mage - Ice Barrier'), +(30455, 0.1429, 0, 0, 'Mage - Ice Lance'), +(44457, 0.4, 0.2, 0, 'Mage - Living Bomb'), +(1463, 0.8053, 0, 0, 'Mage - Mana Shield'), +(34913, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 1'), +(43043, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 2'), +(43044, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 3'), +(11366, 1.15, 0.05, 0, 'Mage - Pyroblast'), +(2948, 0.4286, 0, 0, 'Mage - Scorch'), +(31935, 0.07, 0, 0.07, 'Paladin - Avenger Shield'), +(53742, 0, 0.0176, 0.03, 'Paladin - Blood Corruption'), +(26573, 0, 0.04, 0.04, 'Paladin - Consecration'), +(879, 0.15, 0, 0.15, 'Paladin - Exorcism'), +(19750, 1, 0, 0, 'Paladin - Flash of Light'), +(53595, 0, 0, 0, 'Paladin - Hammer of the Righteous'), +(24275, 0.15, 0, 0.15, 'Paladin - Hammer of Wrath'), +(635, 1.66, 0, 0, 'Paladin - Holy Light'), +(20925, 0.09, 0, 0.056, 'Paladin - Holy Shield'), +(25914, 0.81, 0, 0, 'Paladin - Holy Shock Triggered Heal Rank 1'), +(25913, 0.81, 0, 0, 'Paladin - Holy Shock Triggered Heal Rank 2'), +(25903, 0.81, 0, 0, 'Paladin - Holy Shock Triggered Heal Rank 3'), +(27175, 0.81, 0, 0, 'Paladin - Holy Shock Triggered Heal Rank 4'), +(33074, 0.81, 0, 0, 'Paladin - Holy Shock Triggered Heal Rank 5'), +(48820, 0.81, 0, 0, 'Paladin - Holy Shock Triggered Heal Rank 6'), +(48821, 0.81, 0, 0, 'Paladin - Holy Shock Triggered Heal Rank 7'), +(25912, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt Rank 1'), +(25911, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt Rank 2'), +(25902, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt Rank 3'), +(27176, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt Rank 4'), +(33073, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt Rank 5'), +(48822, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt Rank 6'), +(48823, 0.4286, 0, 0, 'Paladin - Holy Shock Triggered Hurt Rank 7'), +(31803, 0, 0.0176, 0.03, 'Paladin - Holy Vengeance'), +(2812, 0.07, 0, 0.07, 'Paladin - Holy Wrath'), +(31898, 0.25, 0, 0.16, 'Paladin - Judgement of Blood Enemy'), +(32220, 0.0833, 0, 0.0533, 'Paladin - Judgement of Blood Self'), +(20467, 0.25, 0, 0.16, 'Paladin - Judgement of Command'), +(53733, 0, 0, 0, 'Paladin - Judgement of Corruption'), +(20267, 0.1, 0, 0.1, 'Paladin - Judgement of Light Proc'), +(20187, 0.4, 0, 0.25, 'Paladin - Judgement of Righteousness'), +(53726, 0.25, 0, 0.16, 'Paladin - Judgement of the Martyr Enemy'), +(53725, 0.0833, 0, 0.0533, 'Paladin - Judgement of the Martyr Self'), +(31804, 0, 0, 0, 'Paladin - Judgement of Vengeance'), +(58597, 0.75, 0, 0, 'Paladin - Sacred Shield'), +(53601, 0.75, 0, 0, 'Paladin - Sacred Shield'), +(31893, 0, 0, 0, 'Paladin - Seal of Blood Proc Enemy'), +(32221, 0, 0, 0, 'Paladin - Seal of Blood Proc Self'), +(20424, 0, 0, 0, 'Paladin - Seal of Command Proc'), +(20167, 0.15, 0, 0.15, 'Paladin - Seal of Light Proc'), +(25742, 0.07, 0, 0.039, 'Paladin - Seal of Righteousness Dummy Proc'), +(53719, 0, 0, 0, 'Paladin - Seal of the Martyr Proc Enemy'), +(53718, 0, 0, 0, 'Paladin - Seal of the Martyr Proc Self'), +(53600, 0, 0, 0, 'Paladin - Shield of Righteousness'), +(32546, 0.8068, 0, 0, 'Priest - Binding Heal'), +(27813, 0, 0, 0, 'Priest - Blessed Recovery Rank 1'), +(27817, 0, 0, 0, 'Priest - Blessed Recovery Rank 2'), +(27818, 0, 0, 0, 'Priest - Blessed Recovery Rank 3'), +(34861, 0.402, 0, 0, 'Priest - Circle of Healing'), +(19236, 0.8068, 0, 0, 'Priest - Desperate Prayer'), +(2944, 0, 0.1849, 0, 'Priest - Devouring Plague'), +(2061, 0.8068, 0, 0, 'Priest - Flash Heal'), +(2060, 1.6135, 0, 0, 'Priest - Greater Heal'), +(14914, 0.5711, 0.024, 0, 'Priest - Holy Fire'), +(15237, 0.1606, 0, 0, 'Priest - Holy Nova Damage'), +(23455, 0.3035, 0, 0, 'Priest - Holy Nova Heal Rank 1'), +(23458, 0.3035, 0, 0, 'Priest - Holy Nova Heal Rank 2'), +(23459, 0.3035, 0, 0, 'Priest - Holy Nova Heal Rank 3'), +(27803, 0.3035, 0, 0, 'Priest - Holy Nova Heal Rank 4'), +(27804, 0.3035, 0, 0, 'Priest - Holy Nova Heal Rank 5'), +(27805, 0.3035, 0, 0, 'Priest - Holy Nova Heal Rank 6'), +(25329, 0.3035, 0, 0, 'Priest - Holy Nova Heal Rank 7'), +(8129, 0, 0, 0, 'Priest - Mana Burn'), +(8092, 0.428, 0, 0, 'Priest - Mind Blast'), +(15407, 0.257, 0, 0, 'Priest - Mind Flay'), +(49821, 0.2861, 0, 0, 'Priest - Mind Sear Trigger Rank 1'), +(53022, 0.2861, 0, 0, 'Priest - Mind Sear Trigger Rank 2'), +(47757, 1.6135, 0, 0, 'Priest - Penance (Rank 1'), +(52986, 1.6135, 0, 0, 'Priest - Penance (Rank 2'), +(52987, 1.6135, 0, 0, 'Priest - Penance (Rank 3'), +(52988, 1.6135, 0, 0, 'Priest - Penance (Rank 4'), +(17, 0.8068, 0, 0, 'Priest - Power Word: Shield'), +(596, 0.8068, 0, 0, 'Priest - Prayer of Healing'), +(33110, 0.8068, 0, 0, 'Priest - Prayer of Mending Heal Proc'), +(33619, 0, 0, 0, 'Priest - Reflective Shield'), +(139, 0, 0.376, 0, 'Priest - Renew'), +(32379, 0.4296, 0, 0, 'Priest - Shadow Word: Death'), +(589, 0, 0.1829, 0, 'Priest - Shadow Word: Pain'), +(34433, 0.65, 0, 0, 'Priest - Shadowfiend'), +(585, 0.714, 0, 0, 'Priest - Smite'), +(34914, 0, 0.4, 0, 'Priest - Vampiric Touch'), +(1064, 1.34, 0, 0, 'Shaman - Chain Heal'), +(421, 0.57, 0, 0, 'Shaman - Chain Lightning'), +(974, 0.4762, 0, 0, 'Shaman - Earth Shield'), +(379, 0, 0, 0, 'Shaman - Earth Shield Triggered'), +(8042, 0.3858, 0, 0, 'Shaman - Earth Shock'), +(8443, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 1'), +(8504, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 2'), +(8505, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 3'), +(11310, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 4'), +(11311, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 5'), +(25538, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 6'), +(25539, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 7'), +(61651, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 8'), +(61660, 0.2142, 0, 0, 'Shaman - Fire Nova Totem Casted by Totem Rank 9'), +(8050, 0.2142, 0.1, 0, 'Shaman - Flame Shock'), +(8026, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 1'), +(58788, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 10'), +(8028, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 2'), +(8029, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 3'), +(10445, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 4'), +(16343, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 5'), +(16344, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 6'), +(25488, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 7'), +(58786, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 8'), +(58787, 0.1, 0, 0, 'Shaman - Flametongue Weapon Proc Rank 9'), +(8056, 0.3858, 0, 0, 'Shaman - Frost Shock'), +(8034, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 1'), +(8037, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 2'), +(10458, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 3'), +(16352, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 4'), +(16353, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 5'), +(25501, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 6'), +(58797, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 7'), +(58798, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 8'), +(58799, 0.1, 0, 0, 'Shaman - Frostbrand Attack Rank 9'), +(2645, 0, 0, 0, 'Shaman - Glyph of Ghost Wolf'), +(52042, 0.045, 0, 0, 'Shaman - Healing Stream Totem Triggered Heal'), +(331, 1.6106, 0, 0, 'Shaman - Healing Wave'), +(51505, 0.5714, 0, 0, 'Shaman - Lava Burst'), +(8004, 0.8082, 0, 0, 'Shaman - Lesser Healing Wave'), +(403, 0.7143, 0, 0, 'Shaman - Lightning Bolt'), +(26364, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 1'), +(49278, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 10'), +(49279, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 11'), +(26365, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 2'), +(26366, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 3'), +(26367, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 4'), +(26369, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 5'), +(26370, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 6'), +(26363, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 7'), +(26371, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 8'), +(26372, 0.33, 0, 0, 'Shaman - Lightning Shield Proc Rank 9'), +(8188, 0.1, 0, 0, 'Shaman - Magma Totam Passive Rank 1'), +(10582, 0.1, 0, 0, 'Shaman - Magma Totam Passive Rank 2'), +(10583, 0.1, 0, 0, 'Shaman - Magma Totam Passive Rank 3'), +(10584, 0.1, 0, 0, 'Shaman - Magma Totam Passive Rank 4'), +(25551, 0.1, 0, 0, 'Shaman - Magma Totam Passive Rank 5'), +(58733, 0.1, 0, 0, 'Shaman - Magma Totam Passive Rank 6'), +(58736, 0.1, 0, 0, 'Shaman - Magma Totam Passive Rank 7'), +(61295, 0.4, 0.18, 0, 'Shaman - Riptide'), +(3606, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 1'), +(58702, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 10'), +(6350, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 2'), +(6351, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 3'), +(6352, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 4'), +(10435, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 5'), +(10436, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 6'), +(25530, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 7'), +(58700, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 8'), +(58701, 0.1667, 0, 0, 'Shaman - Searing Totem Attack Rank 9'), +(50796, 0.7139, 0, 0, 'Warlock - Chaos Bolt'), +(17962, 0, 0, 0, 'Warlock - Conflagrate'), +(172, 0, 0.2, 0, 'Warlock - Corruption'), +(980, 0, 0.1, 0, 'Warlock - Curse of Agony'), +(603, 0, 2, 0, 'Warlock - Curse of Doom'), +(18220, 0.96, 0, 0, 'Warlock - Dark Pact Rank 1'), +(18937, 0.96, 0, 0, 'Warlock - Dark Pact Rank 2'), +(18938, 0.96, 0, 0, 'Warlock - Dark Pact Rank 3'), +(27265, 0.96, 0, 0, 'Warlock - Dark Pact Rank 4'), +(59092, 0.96, 0, 0, 'Warlock - Dark Pact Rank 5'), +(6789, 0.214, 0, 0, 'Warlock - Death Coil'), +(689, 0, 0.143, 0, 'Warlock - Drain Life'), +(5138, 0, 0, 0, 'Warlock - Drain Mana'), +(1120, 0, 0.429, 0, 'Warlock - Drain Soul'), +(28176, 0, 0, 0, 'Warlock - Fel Armor'), +(18790, 0, 0, 0, 'Warlock - Fel Stamina'), +(48181, 0.4793, 0, 0, 'Warlock - Haunt'), +(755, 0, 0.4485, 0, 'Warlock - Health Funnel'), +(1949, 0, 0.0949, 0, 'Warlock - Hellfire'), +(5857, 0.145, 0, 0, 'Warlock - Hellfire Effect on Enemy Rank 1'), +(11681, 0.145, 0, 0, 'Warlock - Hellfire Effect on Enemy Rank 2'), +(11682, 0.145, 0, 0, 'Warlock - Hellfire Effect on Enemy Rank 3'), +(27214, 0.145, 0, 0, 'Warlock - Hellfire Effect on Enemy Rank 4'), +(47822, 0.145, 0, 0, 'Warlock - Hellfire Effect on Enemy Rank 5'), +(348, 0.2, 0.2, 0, 'Warlock - Immolate'), +(29722, 0.7139, 0, 0, 'Warlock - Incinerate'), +(42223, 0.286, 0, 0, 'Warlock - Rain of Fire Triggered Rank 1'), +(42224, 0.286, 0, 0, 'Warlock - Rain of Fire Triggered Rank 2'), +(42225, 0.286, 0, 0, 'Warlock - Rain of Fire Triggered Rank 3'), +(42226, 0.286, 0, 0, 'Warlock - Rain of Fire Triggered Rank 4'), +(42218, 0.286, 0, 0, 'Warlock - Rain of Fire Triggered Rank 5'), +(47817, 0.286, 0, 0, 'Warlock - Rain of Fire Triggered Rank 6'), +(47818, 0.286, 0, 0, 'Warlock - Rain of Fire Triggered Rank 7'), +(5676, 0.4293, 0, 0, 'Warlock - Searing Pain'), +(27243, 0.2129, 0.25, 0, 'Warlock - Seed of Corruption'), +(686, 0.8569, 0, 0, 'Warlock - Shadow Bolt'), +(6229, 0.3, 0, 0, 'Warlock - Shadow Ward'), +(17877, 0.4293, 0, 0, 'Warlock - Shadowburn'), +(47960, 0.1064, 0.0667, 0, 'Warlock - Shadowflame Rank 1'), +(61291, 0.1064, 0.0667, 0, 'Warlock - Shadowflame Rank 2'), +(30283, 0.1932, 0, 0, 'Warlock - Shadowfury'), +(63106, 0, 0, 0, 'Warlock - Siphon Life Triggered'), +(6353, 1.15, 0, 0, 'Warlock - Soul Fire'), +(30294, 0, 0, 0, 'Warlock - Soul Leech'), +(30108, 0, 0.2, 0, 'Warlock - Unstable Affliction'), +(31117, 1.8, 0, 0, 'Warlock - Unstable Affliction Dispell'); diff --git a/sql/updates/3.1.3_old/4356_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4356_world_spell_proc_event.sql new file mode 100644 index 0000000..1cfa00e --- /dev/null +++ b/sql/updates/3.1.3_old/4356_world_spell_proc_event.sql @@ -0,0 +1,25 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (28716, 31571, 31572, 55672, 31871, 31872, 33076, 33953, 48110, 48111, 48112, 48113, 33076, 44745, 54787, 47535, 47536, 47537, 51483, 51485, 51486, 56372, 56374, 61356, 41635); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 28716, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0, 0, 0), -- Rejuvenation +( 31571, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Arcane Potency (Rank 1) +( 31572, 0x00, 3, 0x00000000, 0x00000022, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Arcane Potency (Rank 2) +( 31871, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Divine Purpose (Rank 1) +( 31872, 0x00, 10, 0x00000010, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Divine Purpose (Rank 2) +( 33076, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 1) +( 33953, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00044000, 0x00000000, 0, 0, 45), -- Essence of Life +( 48110, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 2) +( 48111, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 3) +( 48112, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 2) +( 48113, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 3) +( 41635, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A22A8, 0x00000000, 0, 0, 0), -- Prayer of Mending (Rank 1) +( 44745, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00004000, 0x00002000, 0, 0, 0), -- Shattered Barrier (Rank 1) +( 54787, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00004000, 0x00002000, 0, 0, 0), -- Shattered Barrier (Rank 2) +( 47535, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00002000, 0, 0, 12), -- Rapture (Rank 1) +( 47536, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00002000, 0, 0, 12), -- Rapture (Rank 2) +( 47537, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00002000, 0, 0, 12), -- Rapture (Rank 3) +(51483, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(51485, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +(51486, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0.000000, 0.000000, 0), +( 56372, 0x00, 3, 0x00000000, 0x00000080, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Glyph of Ice Block +( 56374, 0x00, 3, 0x00000000, 0x00004000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Glyph of Icy Veins +( 61356, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 90); -- Invigorating Earthsiege Diamond Passive diff --git a/sql/updates/3.1.3_old/4360_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4360_world_spell_proc_event.sql new file mode 100644 index 0000000..eef5674 --- /dev/null +++ b/sql/updates/3.1.3_old/4360_world_spell_proc_event.sql @@ -0,0 +1,49 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (65013, 46949, 46945, 64415, 60066, 62115, 62114, 62600, 63245, 18096, 18073, 63280, 63310, 63320, 63335, 63730, 63733, 63737, 63737, 64127, 64129, 64568, 64571, 64440, 64714, 64738, 64742, 64752, 64786, 64792, 64824, 64860, 64867, 64882, 64890, 64908, 64912, 64914, 64928, 64938, 64952, 64964, 65002, 65005, 64999, 65007, 65013, 65020, 65025); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 64914, 0x00, 8, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Rogue T8 2P Bonus +( 64928, 0x00, 11, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Item - Shaman T8 Elemental 4P Bonus +( 64938, 0x00, 4, 0x00200040, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Item - Warrior T8 Melee 2P Bonus +( 64952, 0x00, 7, 0x00000000, 0x00000440, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Druid T8 Feral Relic +( 64964, 0x00, 15, 0x00000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Death Knight T8 Tank Relic +( 65002, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Bonus Mana Regen +( 65005, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Alacrity of the Elements +( 64999, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5, 0, 0), -- Meteoric Inspiration +( 65007, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 5, 0, 0), -- Eye of the Broodmother +( 65013, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Pyrite Infusion +( 65020, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Mjolnir Runestone +( 65025, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Dark Matter +( 46949, 0x00, 4, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Safeguard +( 46945, 0x00, 4, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Safeguard +( 64415, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Val'anyr Hammer of Ancient Kings - Equip Effect +( 60066, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Rage of the Unraveller +( 62115, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Strength of the Titans +( 62114, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Flow of Knowledge +( 62600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Savage Defense +( 63245, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Pyroclasm +( 18096, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Pyroclasm +( 18073, 0x00, 5, 0x00000100, 0x00800000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Pyroclasm +( 63280, 0x00, 11, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Totem of Wrath +( 63310, 0x00, 5, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Shadowflame +( 63320, 0x00, 5, 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Life Tap +( 63335, 0x00, 15, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Howling Blast +( 63730, 0x00, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Serendipity +( 63733, 0x00, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Serendipity +( 63737, 0x00, 6, 0x00000800, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Serendipity +( 64127, 0x00, 6, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Body and Soul +( 64129, 0x00, 6, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Body and Soul +( 64568, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 3), -- Blood Reserve +( 64571, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Blood Draining +( 64440, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 20), -- Blade Warding +( 64714, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Flame of the Heavens +( 64738, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Show of Faith +( 64742, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Pandora's Plea +( 64752, 0x00, 7, 0x00800000, 0x10000100, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Druid T8 Feral 2P Bonus +( 64786, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Comet's Trail +( 64792, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 45), -- Blood of the Old God +( 64824, 0x00, 7, 0x00200000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Druid T8 Balance 4P Bonus +( 64860, 0x00, 9, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Hunter T8 4P Bonus +( 64867, 0x00, 3, 0x20000021, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Mage T8 2P Bonus +( 64882, 0x00, 10, 0x00000000, 0x00100000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Paladin T8 Protection 4P Bonus +( 64890, 0x00, 10, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Item - Paladin T8 Holy 2P Bonus +( 64908, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0, 0, 0), -- Item - Priest T8 Shadow 4P Bonus +( 64912, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Item - Priest T8 Healer 4P Bonus diff --git a/sql/updates/3.1.3_old/4363_world_trinity_string.sql b/sql/updates/3.1.3_old/4363_world_trinity_string.sql new file mode 100644 index 0000000..949b337 --- /dev/null +++ b/sql/updates/3.1.3_old/4363_world_trinity_string.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default` = 'Player%s %s (guid: %u) Account: %s (id: %u) Email: %s GMLevel: %u Last IP: %s Last login: %s Latency: %ums' WHERE `entry` = 548; diff --git a/sql/updates/3.1.3_old/4367_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4367_world_spell_proc_event.sql new file mode 100644 index 0000000..5eeacab --- /dev/null +++ b/sql/updates/3.1.3_old/4367_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (51483, 51485, 51486); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(51483, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0), +(51485, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0), +(51486, 0x00000001, 11, 0x20000000, 0x00000000, 0x00000000, 0x00004000, 0x00000001, 0.000000, 0.000000, 0); diff --git a/sql/updates/3.1.3_old/4371_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/4371_world_spell_linked_spell.sql new file mode 100644 index 0000000..82d64c3 --- /dev/null +++ b/sql/updates/3.1.3_old/4371_world_spell_linked_spell.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (48384, 48395, 48396); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(48384, 50170, 2, 'Improved Moonkin Form'), +(48395, 50171, 2, 'Improved Moonkin Form'), +(48396, 50172, 2, 'Improved Moonkin Form'); diff --git a/sql/updates/3.1.3_old/4377_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4377_world_spell_proc_event.sql new file mode 100644 index 0000000..bc00670 --- /dev/null +++ b/sql/updates/3.1.3_old/4377_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (53709, 53710, 53711); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(53709, 2, 10, 16384, 0, 0, 0, 0, 0, 0, 0), +(53710, 2, 10, 16384, 0, 0, 0, 0, 0, 0, 0), +(53711, 2, 10, 16384, 0, 0, 0, 0, 0, 0, 0); diff --git a/sql/updates/3.1.3_old/4382_8115_world_playercreateinfo_action.sql b/sql/updates/3.1.3_old/4382_8115_world_playercreateinfo_action.sql new file mode 100644 index 0000000..1af313a --- /dev/null +++ b/sql/updates/3.1.3_old/4382_8115_world_playercreateinfo_action.sql @@ -0,0 +1,358 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8112_01_mangos_spell_proc_event required_8115_01_mangos_playercreateinfo_action bit; + +TRUNCATE TABLE `playercreateinfo_action`; +INSERT INTO `playercreateinfo_action` VALUES +(1,1,1,78,0), +(1,1,0,6603,0), +(1,1,11,117,128), +(1,2,2,635,0), +(1,2,0,6603,0), +(1,2,1,21084,0), +(1,2,10,159,128), +(1,2,11,2070,128), +(1,4,1,1752,0), +(1,4,2,2098,0), +(1,4,3,2764,0), +(1,4,0,6603,0), +(1,4,11,2070,128), +(1,5,1,585,0), +(1,5,2,2050,0), +(1,5,0,6603,0), +(1,5,10,159,128), +(1,5,11,2070,128), +(1,6,0,6603,0), +(1,6,1,49576,0), +(1,6,2,45477,0), +(1,6,3,45462,0), +(1,6,4,45902,0), +(1,6,5,47541,0), +(1,6,11,59752,0), +(1,8,1,133,0), +(1,8,2,168,0), +(1,8,0,6603,0), +(1,8,10,159,128), +(1,8,11,2070,128), +(1,9,1,686,0), +(1,9,2,687,0), +(1,9,0,6603,0), +(1,9,10,159,128), +(1,9,11,4604,128), +(2,1,1,78,0), +(2,1,0,6603,0), +(2,1,11,117,128), +(2,3,2,75,0), +(2,3,1,2973,0), +(2,3,0,6603,0), +(2,3,11,117,128), +(2,3,10,159,128), +(2,4,10,0,128), +(2,4,1,1752,0), +(2,4,2,2098,0), +(2,4,0,6603,0), +(2,4,11,117,128), +(2,6,0,6603,0), +(2,6,1,49576,0), +(2,6,2,45477,0), +(2,6,3,45462,0), +(2,6,4,45902,0), +(2,6,5,47541,0), +(2,6,10,20572,0), +(2,7,2,331,0), +(2,7,1,403,0), +(2,7,0,6603,0), +(2,7,11,117,128), +(2,7,10,159,128), +(2,9,1,686,0), +(2,9,2,687,0), +(2,9,0,6603,0), +(2,9,11,117,128), +(2,9,10,159,128), +(3,1,1,78,0), +(3,1,0,6603,0), +(3,1,11,117,128), +(3,2,2,635,0), +(3,2,0,6603,0), +(3,2,1,21084,0), +(3,2,10,159,128), +(3,2,11,4540,128), +(3,3,2,75,0), +(3,3,1,2973,0), +(3,3,0,6603,0), +(3,3,11,117,128), +(3,3,10,159,128), +(3,4,1,1752,0), +(3,4,2,2098,0), +(3,4,3,2764,0), +(3,4,0,6603,0), +(3,4,11,4540,128), +(3,5,1,585,0), +(3,5,2,2050,0), +(3,5,0,6603,0), +(3,5,10,159,128), +(3,5,11,4540,128), +(3,6,0,6603,0), +(3,6,1,49576,0), +(3,6,2,45477,0), +(3,6,3,45462,0), +(3,6,4,45902,0), +(3,6,5,47541,0), +(3,6,10,2481,0), +(4,1,1,78,0), +(4,1,0,6603,0), +(4,1,11,117,128), +(4,3,2,75,0), +(4,3,1,2973,0), +(4,3,0,6603,0), +(4,3,11,117,128), +(4,3,10,159,128), +(4,4,1,1752,0), +(4,4,2,2098,0), +(4,4,3,2764,0), +(4,4,0,6603,0), +(4,4,11,4540,128), +(4,5,1,585,0), +(4,5,2,2050,0), +(4,5,0,6603,0), +(4,5,10,159,128), +(4,5,11,2070,128), +(4,6,0,6603,0), +(4,6,1,49576,0), +(4,6,2,45477,0), +(4,6,3,45462,0), +(4,6,4,45902,0), +(4,6,5,47541,0), +(4,6,10,58984,0), +(4,6,83,58984,0), +(4,11,1,5176,0), +(4,11,2,5185,0), +(4,11,0,6603,0), +(4,11,10,159,128), +(4,11,11,4536,128), +(5,1,11,4604,128), +(5,1,0,6603,0), +(5,1,1,78,0), +(5,4,11,4604,128), +(5,4,3,2764,0), +(5,4,2,2098,0), +(5,4,1,1752,0), +(5,4,0,6603,0), +(5,5,10,159,128), +(5,5,2,2050,0), +(5,5,1,585,0), +(5,5,11,4604,128), +(5,5,0,6603,0), +(5,6,0,6603,0), +(5,6,1,49576,0), +(5,6,2,45477,0), +(5,6,3,45462,0), +(5,6,4,45902,0), +(5,6,5,47541,0), +(5,6,10,20577,0), +(5,8,11,4604,128), +(5,8,10,159,128), +(5,8,2,168,0), +(5,8,1,133,0), +(5,8,0,6603,0), +(5,9,1,686,0), +(5,9,10,159,128), +(5,9,2,687,0), +(5,9,11,4604,128), +(5,9,0,6603,0), +(6,1,1,78,0), +(6,1,2,20549,0), +(6,1,11,4540,128), +(6,1,0,6603,0), +(6,3,1,2973,0), +(6,3,10,159,128), +(6,3,2,75,0), +(6,3,3,20549,0), +(6,3,11,117,128), +(6,3,0,6603,0), +(6,6,0,6603,0), +(6,6,1,49576,0), +(6,6,2,45477,0), +(6,6,3,45462,0), +(6,6,4,45902,0), +(6,6,5,47541,0), +(6,6,10,20549,0), +(6,6,75,20549,0), +(6,7,1,403,0), +(6,7,10,159,128), +(6,7,2,331,0), +(6,7,3,20549,0), +(6,7,11,4604,128), +(6,7,0,6603,0), +(6,11,1,5176,0), +(6,11,10,159,128), +(6,11,2,5185,0), +(6,11,3,20549,0), +(6,11,11,4536,128), +(6,11,0,6603,0), +(7,1,11,117,128), +(7,1,1,78,0), +(7,1,0,6603,0), +(7,4,11,117,128), +(7,4,3,2764,0), +(7,4,1,1752,0), +(7,4,2,2098,0), +(7,4,0,6603,0), +(7,6,0,6603,0), +(7,6,1,49576,0), +(7,6,2,45477,0), +(7,6,3,45462,0), +(7,6,4,45902,0), +(7,6,5,47541,0), +(7,6,10,20589,0), +(7,6,72,6603,0), +(7,6,83,117,128), +(7,6,84,6603,0), +(7,6,96,6603,0), +(7,6,108,6603,0), +(7,8,11,4536,128), +(7,8,1,133,0), +(7,8,2,168,0), +(7,8,10,159,128), +(7,8,0,6603,0), +(7,9,11,4604,128), +(7,9,1,686,0), +(7,9,2,687,0), +(7,9,10,159,128), +(7,9,0,6603,0), +(8,1,11,117,128), +(8,1,1,78,0), +(8,1,3,2764,0), +(8,1,0,6603,0), +(8,3,10,159,128), +(8,3,11,4604,128), +(8,3,1,2973,0), +(8,3,2,75,0), +(8,3,0,6603,0), +(8,4,1,1752,0), +(8,4,3,2764,0), +(8,4,2,2098,0), +(8,4,11,117,128), +(8,4,0,6603,0), +(8,5,1,585,0), +(8,5,10,159,128), +(8,5,2,2050,0), +(8,5,11,4540,128), +(8,5,0,6603,0), +(8,6,0,6603,0), +(8,6,1,49576,0), +(8,6,2,45477,0), +(8,6,3,45462,0), +(8,6,4,45902,0), +(8,6,5,47541,0), +(8,6,10,50621,0), +(8,7,1,403,0), +(8,7,10,159,128), +(8,7,2,331,0), +(8,7,11,117,128), +(8,7,0,6603,0), +(8,8,1,133,0), +(8,8,10,159,128), +(8,8,2,168,0), +(8,8,11,117,128), +(8,8,0,6603,0), +(10,2,0,6603,0), +(10,2,1,21084,0), +(10,2,2,635,0), +(10,2,3,28734,0), +(10,2,4,28730,0), +(10,2,10,159,128), +(10,2,11,20857,128), +(10,3,0,6603,0), +(10,3,1,2973,0), +(10,3,2,75,0), +(10,3,3,28734,0), +(10,3,4,28730,0), +(10,3,10,159,128), +(10,3,11,20857,128), +(10,4,0,6603,0), +(10,4,1,1752,0), +(10,4,2,2098,0), +(10,4,3,2764,0), +(10,4,4,28734,0), +(10,4,5,25046,0), +(10,4,11,20857,128), +(10,5,0,6603,0), +(10,5,1,585,0), +(10,5,2,2050,0), +(10,5,3,28734,0), +(10,5,4,28730,0), +(10,5,10,159,128), +(10,5,11,20857,128), +(10,6,0,6603,0), +(10,6,1,49576,0), +(10,6,2,45477,0), +(10,6,3,45462,0), +(10,6,4,45902,0), +(10,6,5,47541,0), +(10,6,6,50613,0), +(10,8,0,6603,0), +(10,8,1,133,0), +(10,8,2,168,0), +(10,8,3,28734,0), +(10,8,4,28730,0), +(10,8,10,159,128), +(10,8,11,20857,128), +(10,9,11,20857,128), +(10,9,10,159,128), +(10,9,4,28730,0), +(10,9,3,28734,0), +(10,9,2,687,0), +(10,9,1,686,0), +(10,9,0,6603,0), +(11,1,0,6603,0), +(11,1,72,6603,0), +(11,1,73,78,0), +(11,1,74,28880,0), +(11,1,83,4540,128), +(11,1,84,6603,0), +(11,1,96,6603,0), +(11,1,108,6603,0), +(11,2,0,6603,0), +(11,2,1,21084,0), +(11,2,2,635,0), +(11,2,3,59542,0), +(11,2,10,159,128), +(11,2,11,4540,128), +(11,2,83,4540,128), +(11,3,0,6603,0), +(11,3,1,2973,0), +(11,3,2,75,0), +(11,3,3,59543,0), +(11,3,10,159,128), +(11,3,11,4540,128), +(11,3,72,6603,0), +(11,3,73,2973,0), +(11,3,74,75,0), +(11,3,82,159,128), +(11,3,83,4540,128), +(11,5,0,6603,0), +(11,5,1,585,0), +(11,5,2,2050,0), +(11,5,3,59544,0), +(11,5,10,159,128), +(11,5,11,4540,128), +(11,5,83,4540,128), +(11,6,0,6603,0), +(11,6,1,49576,0), +(11,6,2,45477,0), +(11,6,3,45462,0), +(11,6,4,45902,0), +(11,6,5,47541,0), +(11,6,6,59545,0), +(11,7,0,6603,0), +(11,7,1,403,0), +(11,7,2,331,0), +(11,7,3,59547,0), +(11,7,10,159,128), +(11,7,11,4540,128), +(11,8,0,6603,0), +(11,8,1,133,0), +(11,8,2,168,0), +(11,8,3,59548,0), +(11,8,10,159,128), +(11,8,11,4540,128), +(11,8,83,4540,128); diff --git a/sql/updates/3.1.3_old/4392_world.sql b/sql/updates/3.1.3_old/4392_world.sql new file mode 100644 index 0000000..e8a5bbd --- /dev/null +++ b/sql/updates/3.1.3_old/4392_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (20594); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 20594, 65116, 2, 'Stoneform'); diff --git a/sql/updates/3.1.3_old/4393_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4393_world_spell_proc_event.sql new file mode 100644 index 0000000..9d2fb7d --- /dev/null +++ b/sql/updates/3.1.3_old/4393_world_spell_proc_event.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (57470, 57472, 18119, 18120, 35100, 35102); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 57470, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Renewed Hope +( 57472, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Renewed Hope +( 35100, 0x00, 9, 0x00001000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0, 0, 0), -- Concussive Barrage +( 35102, 0x00, 9, 0x00001000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0, 0, 0), -- Concussive Barrage +( 18119, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Aftermath +( 18120, 0x00, 5, 0x00000000, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Aftermath diff --git a/sql/updates/3.1.3_old/4394_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4394_world_spell_proc_event.sql new file mode 100644 index 0000000..babd378 --- /dev/null +++ b/sql/updates/3.1.3_old/4394_world_spell_proc_event.sql @@ -0,0 +1,12 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (13165, 14318, 14319, 14320, 14321, 14322, 25296, 27044, 61846, 61847); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 13165, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14318, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14319, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14320, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14321, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 14322, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 25296, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 27044, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Hawk +( 61846, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0), -- Aspect of the Dragonhawk +( 61847, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0, 0, 0); -- Aspect of the Dragonhawk diff --git a/sql/updates/3.1.3_old/4397_world_playercreateinfo_spell_TDB.sql b/sql/updates/3.1.3_old/4397_world_playercreateinfo_spell_TDB.sql new file mode 100644 index 0000000..5bc5689 --- /dev/null +++ b/sql/updates/3.1.3_old/4397_world_playercreateinfo_spell_TDB.sql @@ -0,0 +1,6 @@ +DELETE FROM `playercreateinfo_spell` WHERE `spell` = 60091; +INSERT INTO `playercreateinfo_spell` (`race`, `class`, `Spell`, `Note`) VALUES +(1, 2, 60091, 'Judgement Anti-Parry/Dodge Passive'), +(3, 2, 60091, 'Judgement Anti-Parry/Dodge Passive'), +(10, 2, 60091, 'Judgement Anti-Parry/Dodge Passive'), +(11, 2, 60091, 'Judgement Anti-Parry/Dodge Passive'); diff --git a/sql/updates/3.1.3_old/4401_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4401_world_spell_proc_event.sql new file mode 100644 index 0000000..c2f993e --- /dev/null +++ b/sql/updates/3.1.3_old/4401_world_spell_proc_event.sql @@ -0,0 +1,13 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (49223, 49599,49188 , 56822, 59057, 55666, 55667, 55668, 55669, 55670, 58616); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 49223, 0x00, 15, 0x00000011, 0x08020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Dirge +( 49599, 0x00, 15, 0x00000011, 0x08020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Dirge +( 49188, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rime +( 56822, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rime +( 59057, 0x00, 15, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Rime +( 55666, 0x00, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Desecration +( 55667, 0x00, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Desecration +( 55668, 0x00, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Desecration +( 55669, 0x00, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Desecration +( 55670, 0x00, 15, 0x00000001, 0x08000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Desecration +( 58616, 0x00, 15, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Glyph of Heart Strike diff --git a/sql/updates/3.1.3_old/4408_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4408_world_spell_proc_event.sql new file mode 100644 index 0000000..108c983 --- /dev/null +++ b/sql/updates/3.1.3_old/4408_world_spell_proc_event.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (16164, 49149, 50115, 49217, 49654, 49655, 49137, 49657, 58620); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 16164, 0x00, 11, 0x901000C3, 0x00001000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Elemental Focus +( 49149, 0x00, 15, 0x00000006, 0x00020002, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Chill of the Grave +( 50115, 0x00, 15, 0x00000006, 0x00020002, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Chill of the Grave +( 49217, 0x00, 15, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0, 0, 1), -- Wandering Plague +( 49654, 0x00, 15, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0, 0, 1), -- Wandering Plague +( 49655, 0x00, 15, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0, 0, 1), -- Wandering Plague +( 49137, 0x00, 15, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Endless Winter +( 49657, 0x00, 15, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Endless Winter +( 58620, 0x00, 15, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Glyph of Chains of Ice diff --git a/sql/updates/3.1.3_old/4409_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4409_world_spell_proc_event.sql new file mode 100644 index 0000000..76184c6 --- /dev/null +++ b/sql/updates/3.1.3_old/4409_world_spell_proc_event.sql @@ -0,0 +1,21 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (31876, 31877, 31878, 34258, 34262, 37195, 40470, 48835, 53380, 53381, 53382, 53486, 53488, 53671, 53673, 54151, 54154, 54155, 63310); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 31876, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Wise (Rank 1) +( 31877, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Wise (Rank 2) +( 31878, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Wise (Rank 3) +( 34258, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Justice +( 34262, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Mercy +( 37195, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgement Group Heal +( 40470, 0x00, 10, 0xC0800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Paladin Tier 6 Trinket +( 48835, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Justice +( 53380, 0x00, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- Righteous Vengeance (Rank 1) +( 53381, 0x00, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- Righteous Vengeance (Rank 2) +( 53382, 0x00, 10, 0x00800000, 0x00020000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- Righteous Vengeance (Rank 3) +( 53486, 0x00, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- The Art of War (Rank 1) +( 53488, 0x00, 10, 0x00800000, 0x00028000, 0x00000000, 0x00000000, 0x00040002, 0, 0, 0), -- The Art of War (Rank 2) +( 53671, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 1) +( 53673, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 2) +( 54151, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 3) +( 54154, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 4) +( 63310, 0x00, 5, 0x00000000, 0x00010000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Glyph of Shadowflame +( 54155, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0); -- Judgements of the Pure (Rank 5) diff --git a/sql/updates/3.1.3_old/4411_world_spell_bonus_data_TDB.sql b/sql/updates/3.1.3_old/4411_world_spell_bonus_data_TDB.sql new file mode 100644 index 0000000..35c2ad5 --- /dev/null +++ b/sql/updates/3.1.3_old/4411_world_spell_bonus_data_TDB.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (54158); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +(54158, 0.25, 0, 0.16, 'Paladin - Jugdement (Seal of Light, Seal of Wisdom, Seal of Justice)'); diff --git a/sql/updates/3.1.3_old/4422_world_script.sql b/sql/updates/3.1.3_old/4422_world_script.sql new file mode 100644 index 0000000..99f8591 --- /dev/null +++ b/sql/updates/3.1.3_old/4422_world_script.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_dark_rider_of_acherus' WHERE `entry` =28654; diff --git a/sql/updates/3.1.3_old/4423_world.sql b/sql/updates/3.1.3_old/4423_world.sql new file mode 100644 index 0000000..638d0d3 --- /dev/null +++ b/sql/updates/3.1.3_old/4423_world.sql @@ -0,0 +1,18 @@ +UPDATE `creature_template` SET `ScriptName`='EventAI', `modelid_A` = 16925,`modelid_H` = 16925, `minmana` = 1000000,`maxmana` = 1000000, `unit_flags` = 33554434 WHERE `entry` IN(29998, 33753, 33752, 33751, 33750); +DELETE FROM `creature_ai_scripts` WHERE `creature_id` IN (29998, 33753, 33752, 33751, 33750); +INSERT INTO `creature_ai_scripts` VALUES +-- Desecration +( 2999801, 29998, 11, 0, 100, 0, 0, 0, 0, 0, 11, 55741, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Desecration'), +( 2999800, 29998, 1, 0, 100, 0, 1, 1, 0, 0, 11, 55671, 0, 2, 11, 55710, 0, 2, 0, 0, 0, 0, 'Desecration'), +-- Desecration +( 3375301, 33753, 11, 0, 100, 0, 0, 0, 0, 0, 11, 55741, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Desecration'), +( 3375300, 33753, 1, 0, 100, 0, 1, 1, 0, 0, 11, 63584, 0, 2, 11, 63580, 0, 2, 0, 0, 0, 0, 'Desecration'), +-- Desecration +( 3375201, 33752, 11, 0, 100, 0, 0, 0, 0, 0, 11, 55741, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Desecration'), +( 3375200, 33752, 1, 0, 100, 0, 1, 1, 0, 0, 11, 63585, 0, 2, 11, 63581, 0, 2, 0, 0, 0, 0, 'Desecration'), +-- Desecration +( 3375101, 33751, 11, 0, 100, 0, 0, 0, 0, 0, 11, 55741, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Desecration'), +( 3375100, 33751, 1, 0, 100, 0, 1, 1, 0, 0, 11, 63586, 0, 2, 11, 63582, 0, 2, 0, 0, 0, 0, 'Desecration'), +-- Desecration +( 3375001, 33750, 11, 0, 100, 0, 0, 0, 0, 0, 11, 55741, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Desecration'), +( 3375000, 33750, 1, 0, 100, 0, 1, 1, 0, 0, 11, 63587, 0, 2, 11, 63583, 0, 2, 0, 0, 0, 0, 'Desecration'); diff --git a/sql/updates/3.1.3_old/4426_world.sql b/sql/updates/3.1.3_old/4426_world.sql new file mode 100644 index 0000000..0db361d --- /dev/null +++ b/sql/updates/3.1.3_old/4426_world.sql @@ -0,0 +1,28 @@ +DELETE FROM `creature_questrelation` WHERE `quest` = 12754; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12754); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12754; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12754); +DELETE FROM `creature_questrelation` WHERE `quest` = 12757; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12757); +DELETE FROM `creature_questrelation` WHERE `quest` = 12754; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12754); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12754; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12754); +DELETE FROM `creature_questrelation` WHERE `quest` = 12755; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12755); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12756; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12756); +DELETE FROM `creature_questrelation` WHERE `quest` = 12757; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12757); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12800; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (31082, 12800); +DELETE FROM `creature_questrelation` WHERE `quest` = 12801; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (31082, 12801); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12801; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (29173, 12801); +UPDATE `quest_template` SET `PrevQuestId`=13166 WHERE `entry`=13188; +UPDATE `quest_template` SET `PrevQuestId`=13166 WHERE `entry`=13189; + +UPDATE `creature` SET `phaseMask`=128 WHERE `id` IN (31082,29173,29199,29204,29200); +-- Citizen of New Avalon +UPDATE creature_template SET unit_flags = 537166336, dynamicflags = 0 WHERE entry = 28942; diff --git a/sql/updates/3.1.3_old/4428_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4428_world_spell_proc_event.sql new file mode 100644 index 0000000..bedb7ca --- /dev/null +++ b/sql/updates/3.1.3_old/4428_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (56342, 56343, 56344, 59725); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 59725, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000800, 0, 0, 0), -- Improved Spell Reflection +( 56342, 0x00, 9, 0x00000018, 0x08000000, 0x00020000, 0x00000000, 0x00000000, 0, 0, 0), -- Lock and Load +( 56343, 0x00, 9, 0x00000018, 0x08000000, 0x00020000, 0x00000000, 0x00000000, 0, 0, 0), -- Lock and Load +( 56344, 0x00, 9, 0x00000018, 0x08000000, 0x00020000, 0x00000000, 0x00000000, 0, 0, 0); -- Lock and Load diff --git a/sql/updates/3.1.3_old/4429_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4429_world_spell_proc_event.sql new file mode 100644 index 0000000..b67c802 --- /dev/null +++ b/sql/updates/3.1.3_old/4429_world_spell_proc_event.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (20210, 20212, 20213, 20214, 20215); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 20210, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 1) +( 20212, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 2) +( 20213, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 3) +( 20214, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Illumination (Rank 4) +( 20215, 0x00, 10, 0xC0000000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0); -- Illumination (Rank 5) diff --git a/sql/updates/3.1.3_old/4431_world_trinity_string.sql b/sql/updates/3.1.3_old/4431_world_trinity_string.sql new file mode 100644 index 0000000..564f465 --- /dev/null +++ b/sql/updates/3.1.3_old/4431_world_trinity_string.sql @@ -0,0 +1,4 @@ +UPDATE `trinity_string` SET `content_default` = 'Active connections: %u (max: %u) Queued connections: %u (max: %u)' WHERE `entry` = 12; + +DELETE FROM `trinity_string` WHERE `entry` = 60; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES (60, 'Online players: %u (max: %u)'); diff --git a/sql/updates/3.1.3_old/4432_world.sql b/sql/updates/3.1.3_old/4432_world.sql new file mode 100644 index 0000000..895ffbb --- /dev/null +++ b/sql/updates/3.1.3_old/4432_world.sql @@ -0,0 +1,58 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_a_special_surprise' WHERE `entry` IN (29032, 29061, 29065, 29067, 29068, 29070, 29074, 29072, 29073, 29071); + +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1609078 AND -1609025; +INSERT INTO `script_texts` (`entry`, `content_default`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1609025,'Come to finish the job, have you?',0,0,0,1,'special_surprise SAY_EXEC_START_1'), +(-1609026,'Come to finish the job, have ye?',0,0,0,1,'special_surprise SAY_EXEC_START_2'), +(-1609027,'Come ta finish da job, mon?',0,0,0,1,'special_surprise SAY_EXEC_START_3'), +(-1609028,'You\'ll look me in the eyes when...',0,0,0,25,'special_surprise SAY_EXEC_PROG_1'), +(-1609029,'Well this son o\' Ironforge would like...',0,0,0,25,'special_surprise SAY_EXEC_PROG_2'), +(-1609030,'Ironic, isn\'t it? To be killed...',0,0,0,25,'special_surprise SAY_EXEC_PROG_3'), +(-1609031,'If you\'d allow me just one...',0,0,0,25,'special_surprise SAY_EXEC_PROG_4'), +(-1609032,'I\'d like to stand for...',0,0,0,25,'special_surprise SAY_EXEC_PROG_5'), +(-1609033,'I want to die like an orc...',0,0,0,25,'special_surprise SAY_EXEC_PROG_6'), +(-1609034,'Dis troll gonna stand for da...',0,0,0,25,'special_surprise SAY_EXEC_PROG_7'), +(-1609035,'$N?',0,0,0,1,'special_surprise SAY_EXEC_NAME_1'), +(-1609036,'$N? Mon?',0,0,0,1,'special_surprise SAY_EXEC_NAME_2'), +(-1609037,'$N, I\'d recognize that face anywhere... What... What have they done to you, $N?',0,0,0,1,'special_surprise SAY_EXEC_RECOG_1'), +(-1609038,'$N, I\'d recognize those face tentacles anywhere... What... What have they done to you, $N?',0,0,0,1,'special_surprise SAY_EXEC_RECOG_2'), +(-1609039,'$N, I\'d recognize that face anywhere... What... What have they done to ye, $Glad:lass;?',0,0,0,1,'special_surprise SAY_EXEC_RECOG_3'), +(-1609040,'$N, I\'d recognize that decay anywhere... What... What have they done to you, $N?',0,0,0,1,'special_surprise SAY_EXEC_RECOG_4'), +(-1609041,'$N, I\'d recognize those horns anywhere... What have they done to you, $N?',0,0,0,1,'special_surprise SAY_EXEC_RECOG_5'), +(-1609042,'$N, I\'d recognize dem tusks anywhere... What... What have dey done ta you, mon?',0,0,0,1,'special_surprise SAY_EXEC_RECOG_6'), +(-1609043,'You don\'t remember me, do you? Blasted Scourge... They\'ve tried to drain you of everything that made you a righteous force of reckoning. Every last ounce of good... Everything that made you a draenei!',0,0,0,1,'special_surprise SAY_EXEC_NOREM_1'), +(-1609044,'Ye don\'t remember me, do ye? Blasted Scourge... They\'ve tried to drain ye o\' everything that made ye a righteous force o\' reckoning. Every last ounce o\' good... Everything that made you a $Gson:daughter; of Ironforge!',0,0,0,1,'special_surprise SAY_EXEC_NOREM_2'), +(-1609045,'You don\'t remember me, do you? We were humans once - long, long ago - until Lordaeron fell to the Scourge. Your transformation to a Scourge zombie came shortly after my own. Not long after that, our minds were freed by the Dark Lady.',0,0,0,1,'special_surprise SAY_EXEC_NOREM_3'), +(-1609046,'You don\'t remember me, do you? Blasted Scourge... They\'ve tried to drain you of everything that made you a pint-sized force of reckoning. Every last ounce of good... Everything that made you a gnome!',0,0,0,1,'special_surprise SAY_EXEC_NOREM_4'), +(-1609047,'You don\'t remember me, do you? Blasted Scourge...They\'ve tried to drain of everything that made you a righteous force of reckoning. Every last ounce of good...Everything that made you a human!',0,0,0,1,'special_surprise SAY_EXEC_NOREM_5'), +(-1609048,'You don\'t remember me? When you were a child your mother would leave you in my care while she served at the Temple of the Moon. I held you in my arms and fed you with honey and sheep\'s milk to calm you until she would return. You were my little angel. Blasted Scourge... What have they done to you, $N?',0,0,0,1,'special_surprise SAY_EXEC_NOREM_6'), +(-1609049,'You don\'t recognize me, do you? Blasted Scourge... They\'ve tried to drain you of everything that made you a righteous force of reckoning. Every last ounce of good... Everything that made you an orc!',0,0,0,1,'special_surprise SAY_EXEC_NOREM_7'), +(-1609050,'You don\'t remember me, do you? Blasted Scourge... They\'ve tried to drain you of everything that made you a righteous force of reckoning. Every last ounce of good... Everything that made you a tauren!',0,0,0,1,'special_surprise SAY_EXEC_NOREM_8'), +(-1609051,'You don\'t remember me, mon? Damn da Scourge! Dey gone ta drain you of everytin dat made ya a mojo masta. Every last ounce of good... Everytin\' dat made ya a troll hero, mon!',0,0,0,1,'special_surprise SAY_EXEC_NOREM_9'), +(-1609052,'A pact was made, $Gbrother:sister;! We vowed vengeance against the Lich King! For what he had done to us! We battled the Scourge as Forsaken, pushing them back into the plaguelands and freeing Tirisfal! You and I were champions of the Forsaken!',0,0,0,1,'special_surprise SAY_EXEC_THINK_1'), +(-1609053,'You must remember the splendor of life, $Gbrother:sister;. You were a champion of the Kaldorei once! This isn\'t you!',0,0,0,1,'special_surprise SAY_EXEC_THINK_2'), +(-1609054,'Think, $N. Think back. Try and remember the majestic halls of Silvermoon City, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the sin\'dorei once! This isn\'t you.',0,0,0,6,'special_surprise SAY_EXEC_THINK_3'), +(-1609055,'Think, $N. Think back. Try and remember the proud mountains of Argus, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the draenei once! This isn\'t you.',0,0,0,6,'special_surprise SAY_EXEC_THINK_4'), +(-1609056,'Think, $N. Think back. Try and remember the snow capped mountains o\' Dun Morogh! Ye were born there, $Glad:lass;. Remember the splendor o\' life, $N! Ye were a champion o\' the dwarves once! This isn\'t ye!',0,0,0,6,'special_surprise SAY_EXEC_THINK_5'), +(-1609057,'Think, $N. Think back. Try and remember Gnomeregan before those damned troggs! Remember the feel of an [arclight spanner] $Gbrother:sister;. You were a champion of gnome-kind once! This isn\'t you.',0,0,0,6,'special_surprise SAY_EXEC_THINK_6'), +(-1609058,'Think, $N. Think back. Try and remember the hills and valleys of Elwynn, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the Alliance once! This isn\'t you.',0,0,0,6,'special_surprise SAY_EXEC_THINK_7'), +(-1609059,'Think, $N. Think back. Try and remember Durotar, $Gbrother:sister;! Remember the sacrifices our heroes made so that we could be free of the blood curse. Harken back to the Valley of Trials, where we were reborn into a world without demonic influence. We found the splendor of life, $N. Together! This isn\'t you. You were a champion of the Horde once!',0,0,0,6,'special_surprise SAY_EXEC_THINK_8'), +(-1609060,'Think, $N. Think back. Try and remember the rolling plains of Mulgore, where you were born. Remember the splendor of life, $Gbrother:sister;. You were a champion of the tauren once! This isn\'t you.',0,0,0,6,'special_surprise SAY_EXEC_THINK_9'), +(-1609061,'TINK $N. Tink back, mon! We be Darkspear, mon! Bruddas and sistas! Remember when we fought the Zalazane and done took he head and freed da Echo Isles? MON! TINK! You was a champion of da Darkspear trolls!',0,0,0,6,'special_surprise SAY_EXEC_THINK_10'), +(-1609062,'Listen to me, $N. You must fight against the Lich King\'s control. He is a monster that wants to see this world - our world - in ruin. Don\'t let him use you to accomplish his goals. You were once a hero and you can be again. Fight, damn you! Fight his control!',0,0,0,5,'special_surprise SAY_EXEC_LISTEN_1'), +(-1609063,'Listen to me, $N Ye must fight against the Lich King\'s control. He\'s a monster that wants to see this world - our world - in ruin. Don\'t let him use ye to accomplish his goals. Ye were once a hero and ye can be again. Fight, damn ye! Fight his control!',0,0,0,5,'special_surprise SAY_EXEC_LISTEN_2'), +(-1609064,'Listen to me, $N. You must fight against the Lich King\'s control. He is a monster that wants to see this world - our world - in ruin. Don\'t let him use you to accomplish his goals AGAIN. You were once a hero and you can be again. Fight, damn you! Fight his control!',0,0,0,5,'special_surprise SAY_EXEC_LISTEN_3'), +(-1609065,'Listen ta me, $Gbrudda:sista;. You must fight against da Lich King\'s control. He be a monstar dat want ta see dis world - our world - be ruined. Don\'t let he use you ta accomplish he goals. You be a hero once and you be a hero again! Fight it, mon! Fight he control!',0,0,0,5,'special_surprise SAY_EXEC_LISTEN_4'), +(-1609066,'What\'s going on in there? What\'s taking so long, $N?',0,1,0,0,'special_surprise SAY_PLAGUEFIST'), +(-1609067,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... Remember Silvermoon. This world is worth saving!',0,0,0,18,'special_surprise SAY_EXEC_TIME_1'), +(-1609068,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... Remember Argus. Don\'t let that happen to this world.',0,0,0,18,'special_surprise SAY_EXEC_TIME_2'), +(-1609069,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both $N... For KHAAAAAAAAZZZ MODAAAAAANNNNNN!!!',0,0,0,18,'special_surprise SAY_EXEC_TIME_3'), +(-1609070,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... Remember Tirisfal! This world is worth saving!',0,0,0,18,'special_surprise SAY_EXEC_TIME_4'), +(-1609071,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... Remember Gnomeregan! This world is worth saving.',0,0,0,18,'special_surprise SAY_EXEC_TIME_5'), +(-1609072,'There... There\'s no more time for me. I\'m done for. FInish me off, $N. Do it or they\'ll kill us both. $N...Remember Elwynn. This world is worth saving.',0,0,0,18,'special_surprise SAY_EXEC_TIME_6'), +(-1609073,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... Remember Teldrassil, our beloved home. This world is worth saving.',0,0,0,18,'special_surprise SAY_EXEC_TIME_7'), +(-1609074,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... For the Horde! This world is worth saving.',0,0,0,18,'special_surprise SAY_EXEC_TIME_8'), +(-1609075,'There... There\'s no more time for me. I\'m done for. Finish me off, $N. Do it or they\'ll kill us both. $N... Remember Mulgore. This world is worth saving.',0,0,0,18,'special_surprise SAY_EXEC_TIME_9'), +(-1609076,'Der... Der\'s no more time for me. I be done for. Finish me off $N. Do it or they\'ll kill us both. $N... Remember Sen\'jin Village, mon! Dis world be worth saving!',0,0,0,18,'special_surprise SAY_EXEC_TIME_10'), +(-1609077,'Do it, $N! Put me out of my misery!',0,0,0,1,'special_surprise SAY_EXEC_WAITING'), +(-1609078,'dies from his wounds.',0,2,0,0,'special_surprise EMOTE_DIES'); diff --git a/sql/updates/3.1.3_old/4445_8158_world_playercreateinfo_action.sql b/sql/updates/3.1.3_old/4445_8158_world_playercreateinfo_action.sql new file mode 100644 index 0000000..c4c1eb9 --- /dev/null +++ b/sql/updates/3.1.3_old/4445_8158_world_playercreateinfo_action.sql @@ -0,0 +1,453 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8140_01_mangos_spell_proc_event required_8158_01_mangos_playercreateinfo_action bit; + +DROP TABLE IF EXISTS `playercreateinfo_action`; +CREATE TABLE `playercreateinfo_action` ( + `race` tinyint(3) unsigned NOT NULL default '0', + `class` tinyint(3) unsigned NOT NULL default '0', + `button` smallint(5) unsigned NOT NULL default '0', + `action` int(11) unsigned NOT NULL default '0', + `type` smallint(5) unsigned NOT NULL default '0', + KEY `playercreateinfo_race_class_index` (`race`,`class`), + PRIMARY KEY (`race`,`class`,`button`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO `playercreateinfo_action` VALUES +(1,1,0,6603,0), +(1,1,11,117,128), +(1,1,72,6603,0), +(1,1,73,78,0), +(1,1,82,59752,0), +(1,1,83,117,128), +(1,1,84,6603,0), +(1,1,96,6603,0), +(1,1,108,6603,0), +(1,2,0,6603,0), +(1,2,1,20154,0), +(1,2,2,635,0), +(1,2,9,59752,0), +(1,2,10,159,128), +(1,2,11,2070,128), +(1,4,0,6603,0), +(1,4,1,1752,0), +(1,4,2,2098,0), +(1,4,3,2764,0), +(1,4,10,59752,0), +(1,4,11,2070,128), +(1,5,0,6603,0), +(1,5,1,585,0), +(1,5,2,2050,0), +(1,5,9,59752,0), +(1,5,10,159,128), +(1,5,11,2070,128), +(1,6,0,6603,0), +(1,6,1,49576,0), +(1,6,2,45477,0), +(1,6,3,45462,0), +(1,6,4,45902,0), +(1,6,5,47541,0), +(1,6,11,59752,0), +(1,8,0,6603,0), +(1,8,1,133,0), +(1,8,2,168,0), +(1,8,9,59752,0), +(1,8,10,159,128), +(1,8,11,2070,128), +(1,9,0,6603,0), +(1,9,1,686,0), +(1,9,2,687,0), +(1,9,9,59752,0), +(1,9,10,159,128), +(1,9,11,4604,128), +(2,1,0,6603,0), +(2,1,72,6603,0), +(2,1,73,78,0), +(2,1,74,20572,0), +(2,1,83,117,128), +(2,1,84,6603,0), +(2,1,96,6603,0), +(2,1,108,6603,0), +(2,3,0,6603,0), +(2,3,1,2973,0), +(2,3,2,75,0), +(2,3,4,20572,0), +(2,3,10,159,128), +(2,3,11,117,128), +(2,4,0,6603,0), +(2,4,1,1752,0), +(2,4,2,2098,0), +(2,4,3,2764,0), +(2,4,4,20572,0), +(2,4,11,117,128), +(2,6,0,6603,0), +(2,6,1,49576,0), +(2,6,2,45477,0), +(2,6,3,45462,0), +(2,6,4,45902,0), +(2,6,5,47541,0), +(2,6,10,20572,0), +(2,7,0,6603,0), +(2,7,1,403,0), +(2,7,2,331,0), +(2,7,3,33697,0), +(2,7,10,159,128), +(2,7,11,117,128), +(2,9,0,6603,0), +(2,9,1,686,0), +(2,9,2,687,0), +(2,9,3,33702,0), +(2,9,10,159,128), +(2,9,11,117,128), +(3,1,0,6603,0), +(3,1,1,78,0), +(3,1,11,117,128), +(3,1,72,6603,0), +(3,1,73,78,0), +(3,1,74,20594,0), +(3,1,75,2481,0), +(3,1,83,117,128), +(3,1,84,6603,0), +(3,1,96,6603,0), +(3,1,108,6603,0), +(3,2,0,6603,0), +(3,2,1,20154,0), +(3,2,2,635,0), +(3,2,3,20594,0), +(3,2,4,2481,0), +(3,2,10,159,128), +(3,2,11,4540,128), +(3,3,0,6603,0), +(3,3,1,2973,0), +(3,3,2,75,0), +(3,3,3,20594,0), +(3,3,4,2481,0), +(3,3,10,159,128), +(3,3,11,117,128), +(3,3,75,20594,0), +(3,3,76,2481,0), +(3,4,0,6603,0), +(3,4,1,1752,0), +(3,4,2,2098,0), +(3,4,3,2764,0), +(3,4,4,20594,0), +(3,4,5,2481,0), +(3,4,11,4540,128), +(3,5,0,6603,0), +(3,5,1,585,0), +(3,5,2,2050,0), +(3,5,3,20594,0), +(3,5,4,2481,0), +(3,5,10,159,128), +(3,5,11,4540,128), +(3,6,0,6603,0), +(3,6,1,49576,0), +(3,6,2,45477,0), +(3,6,3,45462,0), +(3,6,4,45902,0), +(3,6,5,47541,0), +(3,6,10,2481,0), +(4,1,72,6603,0), +(4,1,73,6603,0), +(4,1,74,78,0), +(4,1,83,58984,0), +(4,1,84,117,128), +(4,1,85,6603,0), +(4,1,97,6603,0), +(4,1,109,6603,0), +(4,3,0,6603,0), +(4,3,1,2973,0), +(4,3,2,75,0), +(4,3,3,58984,0), +(4,3,10,159,128), +(4,3,11,117,128), +(4,4,0,6603,0), +(4,4,1,1752,0), +(4,4,2,2098,0), +(4,4,3,2764,0), +(4,4,4,58984,0), +(4,4,11,4540,128), +(4,5,0,6603,0), +(4,5,1,585,0), +(4,5,2,2050,0), +(4,5,3,58984,0), +(4,5,10,159,128), +(4,5,11,2070,128), +(4,6,0,6603,0), +(4,6,1,49576,0), +(4,6,2,45477,0), +(4,6,3,45462,0), +(4,6,4,45902,0), +(4,6,5,47541,0), +(4,6,10,58984,0), +(4,6,83,58984,0), +(4,11,0,6603,0), +(4,11,1,5176,0), +(4,11,2,5185,0), +(4,11,3,58984,0), +(4,11,10,159,128), +(4,11,11,4536,128), +(5,1,0,6603,0), +(5,1,72,6603,0), +(5,1,73,78,0), +(5,1,74,20577,0), +(5,1,83,4604,128), +(5,1,84,6603,0), +(5,1,96,6603,0), +(5,1,108,6603,0), +(5,4,0,6603,0), +(5,4,1,1752,0), +(5,4,2,2098,0), +(5,4,3,2764,0), +(5,4,4,20577,0), +(5,4,11,4604,128), +(5,5,0,6603,0), +(5,5,1,585,0), +(5,5,2,2050,0), +(5,5,3,20577,0), +(5,5,10,159,128), +(5,5,11,4604,128), +(5,6,0,6603,0), +(5,6,1,49576,0), +(5,6,2,45477,0), +(5,6,3,45462,0), +(5,6,4,45902,0), +(5,6,5,47541,0), +(5,6,10,20577,0), +(5,8,0,6603,0), +(5,8,1,133,0), +(5,8,2,168,0), +(5,8,3,20577,0), +(5,8,10,159,128), +(5,8,11,4604,128), +(5,9,0,6603,0), +(5,9,1,686,0), +(5,9,2,687,0), +(5,9,3,20577,0), +(5,9,10,159,128), +(5,9,11,4604,128), +(6,1,0,6603,0), +(6,1,1,78,0), +(6,1,3,20549,0), +(6,1,72,6603,0), +(6,1,73,78,0), +(6,1,74,20549,0), +(6,1,83,4540,128), +(6,1,84,6603,0), +(6,1,96,6603,0), +(6,1,108,6603,0), +(6,3,0,6603,0), +(6,3,1,2973,0), +(6,3,2,75,0), +(6,3,3,20549,0), +(6,3,10,159,128), +(6,3,11,117,128), +(6,3,76,20549,0), +(6,6,0,6603,0), +(6,6,1,49576,0), +(6,6,2,45477,0), +(6,6,3,45462,0), +(6,6,4,45902,0), +(6,6,5,47541,0), +(6,6,10,20549,0), +(6,6,75,20549,0), +(6,7,0,6603,0), +(6,7,1,403,0), +(6,7,2,331,0), +(6,7,3,20549,0), +(6,7,10,159,128), +(6,7,11,4604,128), +(6,7,76,20549,0), +(6,11,0,6603,0), +(6,11,1,5176,0), +(6,11,2,5185,0), +(6,11,3,20549,0), +(6,11,10,159,128), +(6,11,11,4536,128), +(6,11,73,6603,0), +(6,11,76,20549,0), +(6,11,85,6603,0), +(6,11,97,6603,0), +(6,11,109,6603,0), +(7,1,0,6603,0), +(7,1,1,78,0), +(7,1,10,20589,0), +(7,1,11,117,128), +(7,1,72,6603,0), +(7,1,73,78,0), +(7,1,82,20589,0), +(7,1,83,117,128), +(7,1,84,6603,0), +(7,1,96,6603,0), +(7,1,108,6603,0), +(7,4,0,6603,0), +(7,4,1,1752,0), +(7,4,2,2098,0), +(7,4,3,2764,0), +(7,4,10,20589,0), +(7,4,11,117,128), +(7,6,0,6603,0), +(7,6,1,49576,0), +(7,6,2,45477,0), +(7,6,3,45462,0), +(7,6,4,45902,0), +(7,6,5,47541,0), +(7,6,10,20589,0), +(7,6,11,117,128), +(7,6,72,6603,0), +(7,6,83,117,128), +(7,6,84,6603,0), +(7,6,96,6603,0), +(7,6,108,6603,0), +(7,8,0,6603,0), +(7,8,1,133,0), +(7,8,2,168,0), +(7,8,9,20589,0), +(7,8,10,159,128), +(7,8,11,4536,128), +(7,9,0,6603,0), +(7,9,1,686,0), +(7,9,2,687,0), +(7,9,9,20589,0), +(7,9,10,159,128), +(7,9,11,4604,128), +(8,1,0,6603,0), +(8,1,72,6603,0), +(8,1,73,78,0), +(8,1,74,2764,0), +(8,1,75,26296,0), +(8,1,83,117,128), +(8,1,84,6603,0), +(8,1,96,6603,0), +(8,1,108,6603,0), +(8,3,0,6603,0), +(8,3,1,2973,0), +(8,3,2,75,0), +(8,3,10,159,128), +(8,3,11,4604,128), +(8,3,76,20554,0), +(8,4,0,6603,0), +(8,4,1,1752,0), +(8,4,2,2098,0), +(8,4,3,2764,0), +(8,4,11,117,128), +(8,4,76,20554,0), +(8,5,0,6603,0), +(8,5,1,585,0), +(8,5,2,2050,0), +(8,5,10,159,128), +(8,5,11,4540,128), +(8,5,76,20554,0), +(8,6,0,6603,0), +(8,6,1,49576,0), +(8,6,2,45477,0), +(8,6,3,45462,0), +(8,6,4,45902,0), +(8,6,5,47541,0), +(8,6,10,50621,0), +(8,7,0,6603,0), +(8,7,1,403,0), +(8,7,2,331,0), +(8,7,10,159,128), +(8,7,11,117,128), +(8,7,76,20554,0), +(8,8,0,6603,0), +(8,8,1,133,0), +(8,8,2,168,0), +(8,8,10,159,128), +(8,8,11,117,128), +(8,8,76,20554,0), +(10,2,0,6603,0), +(10,2,1,21084,0), +(10,2,2,635,0), +(10,2,3,28730,0), +(10,2,10,159,128), +(10,2,11,20857,128), +(10,3,0,6603,0), +(10,3,1,2973,0), +(10,3,2,75,0), +(10,3,3,28730,0), +(10,3,10,159,128), +(10,3,11,20857,128), +(10,4,0,6603,0), +(10,4,1,1752,0), +(10,4,2,2098,0), +(10,4,3,2764,0), +(10,4,4,25046,0), +(10,4,11,20857,128), +(10,5,0,6603,0), +(10,5,1,585,0), +(10,5,2,2050,0), +(10,5,3,28730,0), +(10,5,10,159,128), +(10,5,11,20857,128), +(10,6,0,6603,0), +(10,6,1,49576,0), +(10,6,2,45477,0), +(10,6,3,45462,0), +(10,6,4,45902,0), +(10,6,5,47541,0), +(10,6,6,50613,0), +(10,8,0,6603,0), +(10,8,1,133,0), +(10,8,2,168,0), +(10,8,3,28730,0), +(10,8,10,159,128), +(10,8,11,20857,128), +(10,9,0,6603,0), +(10,9,1,686,0), +(10,9,2,687,0), +(10,9,3,28730,0), +(10,9,10,159,128), +(10,9,11,20857,128), +(11,1,0,6603,0), +(11,1,72,6603,0), +(11,1,73,78,0), +(11,1,74,28880,0), +(11,1,83,4540,128), +(11,1,84,6603,0), +(11,1,96,6603,0), +(11,1,108,6603,0), +(11,2,0,6603,0), +(11,2,1,21084,0), +(11,2,2,635,0), +(11,2,3,59542,0), +(11,2,10,159,128), +(11,2,11,4540,128), +(11,2,83,4540,128), +(11,3,0,6603,0), +(11,3,1,2973,0), +(11,3,2,75,0), +(11,3,3,59543,0), +(11,3,10,159,128), +(11,3,11,4540,128), +(11,3,72,6603,0), +(11,3,73,2973,0), +(11,3,74,75,0), +(11,3,82,159,128), +(11,3,83,4540,128), +(11,5,0,6603,0), +(11,5,1,585,0), +(11,5,2,2050,0), +(11,5,3,59544,0), +(11,5,10,159,128), +(11,5,11,4540,128), +(11,5,83,4540,128), +(11,6,0,6603,0), +(11,6,1,49576,0), +(11,6,2,45477,0), +(11,6,3,45462,0), +(11,6,4,45902,0), +(11,6,5,47541,0), +(11,6,6,59545,0), +(11,7,0,6603,0), +(11,7,1,403,0), +(11,7,2,331,0), +(11,7,3,59547,0), +(11,7,10,159,128), +(11,7,11,4540,128), +(11,8,0,6603,0), +(11,8,1,133,0), +(11,8,2,168,0), +(11,8,3,59548,0), +(11,8,10,159,128), +(11,8,11,4540,128), +(11,8,83,4540,128); diff --git a/sql/updates/3.1.3_old/4451_world_tmp.sql b/sql/updates/3.1.3_old/4451_world_tmp.sql new file mode 100644 index 0000000..30f1253 --- /dev/null +++ b/sql/updates/3.1.3_old/4451_world_tmp.sql @@ -0,0 +1 @@ +UPDATE creature_template SET `VehicleId`=200, spell1=52264, spell2=52268 WHERE `entry` IN (28605, 28606, 28607); diff --git a/sql/updates/3.1.3_old/4464_world_spell_bonus_data_TDB.sql b/sql/updates/3.1.3_old/4464_world_spell_bonus_data_TDB.sql new file mode 100644 index 0000000..9d7bacd --- /dev/null +++ b/sql/updates/3.1.3_old/4464_world_spell_bonus_data_TDB.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` = '58621'; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES +(58621, 0, 0, 0.08, 'Death Knight - Glyph of Chains of Ice'); diff --git a/sql/updates/3.1.3_old/4481_world_script.sql b/sql/updates/3.1.3_old/4481_world_script.sql new file mode 100644 index 0000000..a3ba626 --- /dev/null +++ b/sql/updates/3.1.3_old/4481_world_script.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_valkyr_battle_maiden' WHERE (`entry`='28534'); +INSERT iGNORE INTO `spell_proc_event` VALUES ( 51915, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0, 100, 600); diff --git a/sql/updates/3.1.3_old/4490_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4490_world_spell_proc_event.sql new file mode 100644 index 0000000..6dfeccb --- /dev/null +++ b/sql/updates/3.1.3_old/4490_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_proc_event` WHERE `entry` =51915; +INSERT IGNORE INTO `spell_proc_event` VALUES ( 51915, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0, 100, 600); diff --git a/sql/updates/3.1.3_old/4495_world_script.sql b/sql/updates/3.1.3_old/4495_world_script.sql new file mode 100644 index 0000000..d552cbb --- /dev/null +++ b/sql/updates/3.1.3_old/4495_world_script.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_mojo' WHERE `entry`='24480'; diff --git a/sql/updates/3.1.3_old/4498_characters_channels.sql b/sql/updates/3.1.3_old/4498_characters_channels.sql new file mode 100644 index 0000000..7f5490d --- /dev/null +++ b/sql/updates/3.1.3_old/4498_characters_channels.sql @@ -0,0 +1,14 @@ +-- ---------------------------- +-- Table structure for channels +-- ---------------------------- +DROP TABLE IF EXISTS `channels`; +CREATE TABLE `channels` ( + `m_name` text NOT NULL, + `m_team` int(10) unsigned NOT NULL, + `m_ownerGUID` int(11) unsigned NOT NULL default '0', + `m_announce` tinyint(1) unsigned NOT NULL default '0', + `m_moderate` tinyint(1) unsigned NOT NULL default '0', + `m_password` text, + `BannedList` longtext, + PRIMARY KEY (`m_name`(10),`m_team`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Channel System'; diff --git a/sql/updates/3.1.3_old/4500_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/4500_world_spell_bonus_data.sql new file mode 100644 index 0000000..0668193 --- /dev/null +++ b/sql/updates/3.1.3_old/4500_world_spell_bonus_data.sql @@ -0,0 +1,245 @@ +DROP TABLE IF EXISTS `spell_bonus_data`; +CREATE TABLE `spell_bonus_data` ( + `entry` smallint(5) unsigned NOT NULL, + `direct_bonus` float NOT NULL default '0', + `dot_bonus` float NOT NULL default '0', + `ap_bonus` float NOT NULL default '0', + `ap_dot_bonus` float NOT NULL default '0', + `comments` varchar(255) default NULL, + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(49941, -1, -1, 0.04, -1, 'Death Knight - Blood Boil'), +(48721, -1, -1, 0.04, -1, 'Death Knight - Blood Boil'), +(55078, -1, -1, -1, 0.055, 'Death Knight - Blood Plague'), +(50444, -1, -1, 0.105, -1, 'Death Knight - Corpse Explosion Triggered'), +(52212, -1, -1, 0.0475, -1, 'Death Knight - Death and Decay'), +(47632, -1, -1, 0.15, -1, 'Death Knight - Death Coil'), +(47633, -1, -1, 0.15, -1, 'Death Knight - Death Coil Heal'), +(55095, -1, -1, -1, 0.055, 'Death Knight - Frost Fever'), +(49184, -1, -1, 0.1, -1, 'Death Knight - Howling Blast'), +(45477, -1, -1, 0.1, -1, 'Death Knight - Icy Touch'), +(56903, 0, 0, 0, 0, 'Death Knight - Lichflame'), +(50842, -1, -1, 0.04, -1, 'Death Knight - Pestilence'), +(50401, 0, 0, 0, 0, 'Death Knight - Razor Frost'), +(47476, -1, -1, 0.06, -1, 'Death Knight - Strangulate'), +(50536, -1, -1, 0.013, -1, 'Death Knight - Unholy Blight (Rank1)'), +(339, -1, 0.1, -1, -1, 'Druid - Entangling Roots'), +(5185, 1.611, -1, -1, -1, 'Druid - Healing Touch'), +(42231, 0.12898, -1, -1, -1, 'Druid - Hurricane Triggered'), +(5570, -1, 0.2, -1, -1, 'Druid - Insect Swarm'), +(33763, 0.6453, 0.09518, -1, -1, 'Druid - Lifebloom'), +(8921, 0.1515, 0.13, -1, -1, 'Druid - Moonfire'), +(50464, 0.67305, -1, -1, -1, 'Druid - Nourish'), +(8936, 0.539, 0.188, -1, -1, 'Druid - Regrowth'), +(774, -1, 0.37604, -1, -1, 'Druid - Rejuvenation'), +(50294, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 1'), +(53188, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 2'), +(53189, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 3'), +(53190, 0.0119, -1, -1, -1, 'Druid - Starfall AOE rank 4'), +(50288, 0.0458, -1, -1, -1, 'Druid - Starfall rank 1'), +(53191, 0.0458, -1, -1, -1, 'Druid - Starfall rank 2'), +(53194, 0.0458, -1, -1, -1, 'Druid - Starfall rank 3'), +(53195, 0.0458, -1, -1, -1, 'Druid - Starfall rank 4'), +(2912, 1, -1, -1, -1, 'Druid - Starfire'), +(18562, 0, 0, 0, 0, 'Druid - Swiftmend'), +(44203, 0.538, -1, -1, -1, 'Druid - Tranquility Triggered'), +(61391, 0.193, -1, -1, -1, 'Druid - Typhoon'), +(48438, -1, 0.11505, -1, -1, 'Druid - Wild Growth'), +(5176, 0.5714, -1, -1, -1, 'Druid - Wrath'), +(55039, 0, 0, 0, 0, 'Item - Gnomish Lightning Generator'), +(44425, 0.7143, -1, -1, -1, 'Mage - Arcane Barrage'), +(30451, 0.7143, -1, -1, -1, 'Mage - Arcane Blast'), +(1449, 0.2128, -1, -1, -1, 'Mage - Arcane Explosion'), +(7268, 0.2857, -1, -1, -1, 'Mage - Arcane Missiles Triggered Spell Rank 1'), +(7269, 0.2857, -1, -1, -1, 'Mage - Arcane Missiles Triggered Spell Rank 2'), +(11113, 0.1936, -1, -1, -1, 'Mage - Blast Wave'), +(42208, 0.1437, -1, -1, -1, 'Mage - Blizzard Triggered Spell'), +(120, 0.214, -1, -1, -1, 'Mage - Cone of Cold'), +(31661, 0.1936, -1, -1, -1, 'Mage - Dragons Breath'), +(133, 1, -1, -1, -1, 'Mage - Fire Ball'), +(2136, 0.4286, -1, -1, -1, 'Mage - Fire Blast'), +(543, 0.1, -1, -1, -1, 'Mage - Fire Ward'), +(2120, 0.2357, 0.122, -1, -1, 'Mage - Flamestrike'), +(116, 0.8143, -1, -1, -1, 'Mage - Frost Bolt'), +(122, 0.193, -1, -1, -1, 'Mage - Frost Nova'), +(6143, 0.1, -1, -1, -1, 'Mage - Frost Ward'), +(44614, 0.8571, -1, -1, -1, 'Mage - Frostfire Bolt'), +(11426, 0.8053, -1, -1, -1, 'Mage - Ice Barrier'), +(30455, 0.1429, -1, -1, -1, 'Mage - Ice Lance'), +(44457, 0.4, 0.2, -1, -1, 'Mage - Living Bomb'), +(1463, 0.8053, -1, -1, -1, 'Mage - Mana Shield'), +(34913, 0, 0, 0, 0, 'Mage - Molten Armor Triggered Rank 1'), +(11366, 1.15, 0.05, -1, -1, 'Mage - Pyroblast'), +(2948, 0.4286, -1, -1, -1, 'Mage - Scorch'), +(31935, 0.07, -1, 0.07, -1, 'Paladin - Avenger Shield'), +(53742, -1, 0.0176, -1, 0.03, 'Paladin - Blood Corruption'), +(26573, -1, 0.04, -1, 0.04, 'Paladin - Consecration'), +(879, 0.15, -1, 0.15, -1, 'Paladin - Exorcism'), +(19750, 1, -1, -1, -1, 'Paladin - Flash of Light'), +(53595, 0, 0, 0, 0, 'Paladin - Hammer of the Righteous'), +(24275, 0.15, -1, 0.15, -1, 'Paladin - Hammer of Wrath'), +(635, 1.66, -1, -1, -1, 'Paladin - Holy Light'), +(20925, 0.09, -1, 0.056, -1, 'Paladin - Holy Shield'), +(25914, 0.81, -1, -1, -1, 'Paladin - Holy Shock Triggered Heal Rank 1'), +(25912, 0.4286, -1, -1, -1, 'Paladin - Holy Shock Triggered Hurt Rank 1'), +(31803, -1, 0.0176, -1, 0.03, 'Paladin - Holy Vengeance'), +(2812, 0.07, -1, 0.07, -1, 'Paladin - Holy Wrath'), +(31898, 0.25, -1, 0.16, -1, 'Paladin - Judgement of Blood Enemy'), +(32220, 0.0833, -1, 0.0533, -1, 'Paladin - Judgement of Blood Self'), +(20467, 0.25, -1, 0.16, -1, 'Paladin - Judgement of Command'), +(53733, 0, 0, 0, 0, 'Paladin - Judgement of Corruption'), +(20267, 0.1, -1, 0.1, -1, 'Paladin - Judgement of Light Proc'), +(20187, 0.4, -1, 0.25, -1, 'Paladin - Judgement of Righteousness'), +(53726, 0.25, -1, 0.16, -1, 'Paladin - Judgement of the Martyr Enemy'), +(53725, 0.0833, -1, 0.0533, -1, 'Paladin - Judgement of the Martyr Self'), +(31804, 0, 0, 0, 0, 'Paladin - Judgement of Vengeance'), +(58597, 0.75, -1, -1, -1, 'Paladin - Sacred Shield'), +(53601, 0.75, -1, -1, -1, 'Paladin - Sacred Shield'), +(31893, 0, 0, 0, 0, 'Paladin - Seal of Blood Proc Enemy'), +(32221, 0, 0, 0, 0, 'Paladin - Seal of Blood Proc Self'), +(20424, 0, 0, 0, 0, 'Paladin - Seal of Command Proc'), +(20167, 0.15, -1, 0.15, -1, 'Paladin - Seal of Light Proc'), +(25742, 0.07, -1, 0.039, -1, 'Paladin - Seal of Righteousness Dummy Proc'), +(53719, 0, 0, 0, 0, 'Paladin - Seal of the Martyr Proc Enemy'), +(53718, 0, 0, 0, 0, 'Paladin - Seal of the Martyr Proc Self'), +(53600, 0, 0, 0, 0, 'Paladin - Shield of Righteousness'), +(32546, 0.8068, -1, -1, -1, 'Priest - Binding Heal'), +(27813, 0, 0, 0, 0, 'Priest - Blessed Recovery Rank 1'), +(34861, 0.402, -1, -1, -1, 'Priest - Circle of Healing'), +(19236, 0.8068, -1, -1, -1, 'Priest - Desperate Prayer'), +(2944, -1, 0.1849, -1, -1, 'Priest - Devouring Plague'), +(2061, 0.8068, -1, -1, -1, 'Priest - Flash Heal'), +(2060, 1.6135, -1, -1, -1, 'Priest - Greater Heal'), +(14914, 0.5711, 0.024, -1, -1, 'Priest - Holy Fire'), +(15237, 0.1606, -1, -1, -1, 'Priest - Holy Nova Damage'), +(23455, 0.3035, -1, -1, -1, 'Priest - Holy Nova Heal Rank 1'), +(8129, 0, 0, 0, 0, 'Priest - Mana Burn'), +(8092, 0.428, -1, -1, -1, 'Priest - Mind Blast'), +(15407, 0.257, -1, -1, -1, 'Priest - Mind Flay'), +(49821, 0.2861, -1, -1, -1, 'Priest - Mind Sear Trigger Rank 1'), +(47757, 1.6135, -1, -1, -1, 'Priest - Penance (Rank 1'), +(52986, 1.6135, -1, -1, -1, 'Priest - Penance (Rank 2'), +(52987, 1.6135, -1, -1, -1, 'Priest - Penance (Rank 3'), +(52988, 1.6135, -1, -1, -1, 'Priest - Penance (Rank 4'), +(17, 0.8068, -1, -1, -1, 'Priest - Power Word: Shield'), +(596, 0.8068, -1, -1, -1, 'Priest - Prayer of Healing'), +(33110, 0.8068, -1, -1, -1, 'Priest - Prayer of Mending Heal Proc'), +(33619, 0, 0, 0, 0, 'Priest - Reflective Shield'), +(139, -1, 0.376, -1, -1, 'Priest - Renew'), +(32379, 0.4296, -1, -1, -1, 'Priest - Shadow Word: Death'), +(589, -1, 0.1829, -1, -1, 'Priest - Shadow Word: Pain'), +(34433, 0.65, -1, -1, -1, 'Priest - Shadowfiend'), +(585, 0.714, -1, -1, -1, 'Priest - Smite'), +(34914, -1, 0.4, -1, -1, 'Priest - Vampiric Touch'), +(1064, 1.34, -1, -1, -1, 'Shaman - Chain Heal'), +(421, 0.57, -1, -1, -1, 'Shaman - Chain Lightning'), +(974, 0.4762, -1, -1, -1, 'Shaman - Earth Shield'), +(379, 0, 0, 0, 0, 'Shaman - Earth Shield Triggered'), +(8042, 0.3858, -1, -1, -1, 'Shaman - Earth Shock'), +(8443, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 1'), +(8504, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 2'), +(8505, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 3'), +(11310, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 4'), +(11311, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 5'), +(25538, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 6'), +(25539, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 7'), +(61651, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 8'), +(61660, 0.2142, -1, -1, -1, 'Shaman - Fire Nova Totem Casted by Totem Rank 9'), +(8050, 0.2142, 0.1, -1, -1, 'Shaman - Flame Shock'), +(8026, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 1'), +(58788, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 10'), +(8028, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 2'), +(8029, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 3'), +(10445, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 4'), +(16343, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 5'), +(16344, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 6'), +(25488, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 7'), +(58786, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 8'), +(58787, 0.1, -1, -1, -1, 'Shaman - Flametongue Weapon Proc Rank 9'), +(8056, 0.3858, -1, -1, -1, 'Shaman - Frost Shock'), +(8034, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 1'), +(8037, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 2'), +(10458, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 3'), +(16352, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 4'), +(16353, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 5'), +(25501, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 6'), +(58797, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 7'), +(58798, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 8'), +(58799, 0.1, -1, -1, -1, 'Shaman - Frostbrand Attack Rank 9'), +(2645, 0, 0, 0, 0, 'Shaman - Glyph of Ghost Wolf'), +(52042, 0.045, -1, -1, -1, 'Shaman - Healing Stream Totem Triggered Heal'), +(331, 1.6106, -1, -1, -1, 'Shaman - Healing Wave'), +(51505, 0.5714, -1, -1, -1, 'Shaman - Lava Burst'), +(8004, 0.8082, -1, -1, -1, 'Shaman - Lesser Healing Wave'), +(403, 0.7143, -1, -1, -1, 'Shaman - Lightning Bolt'), +(26364, 0.33, -1, -1, -1, 'Shaman - Lightning Shield Proc Rank 1'), +(8188, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 1'), +(10582, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 2'), +(10583, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 3'), +(10584, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 4'), +(25551, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 5'), +(58733, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 6'), +(58736, 0.1, -1, -1, -1, 'Shaman - Magma Totam Passive Rank 7'), +(61295, 0.4, 0.18, -1, -1, 'Shaman - Riptide'), +(3606, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 1'), +(58702, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 10'), +(6350, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 2'), +(6351, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 3'), +(6352, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 4'), +(10435, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 5'), +(10436, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 6'), +(25530, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 7'), +(58700, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 8'), +(58701, 0.1667, -1, -1, -1, 'Shaman - Searing Totem Attack Rank 9'), +(50796, 0.7139, -1, -1, -1, 'Warlock - Chaos Bolt'), +(17962, 0, 0, 0, 0, 'Warlock - Conflagrate'), +(172, -1, 0.2, -1, -1, 'Warlock - Corruption'), +(980, -1, 0.1, -1, -1, 'Warlock - Curse of Agony'), +(603, -1, 2, -1, -1, 'Warlock - Curse of Doom'), +(18220, 0.96, -1, -1, -1, 'Warlock - Dark Pact Rank 1'), +(6789, 0.214, -1, -1, -1, 'Warlock - Death Coil'), +(689, -1, 0.143, -1, -1, 'Warlock - Drain Life'), +(5138, 0, 0, 0, 0, 'Warlock - Drain Mana'), +(1120, -1, 0.429, -1, -1, 'Warlock - Drain Soul'), +(28176, 0, 0, 0, 0, 'Warlock - Fel Armor'), +(18790, 0, 0, 0, 0, 'Warlock - Fel Stamina'), +(48181, 0.4793, -1, -1, -1, 'Warlock - Haunt'), +(755, -1, 0.4485, -1, -1, 'Warlock - Health Funnel'), +(1949, -1, 0.0949, -1, -1, 'Warlock - Hellfire'), +(5857, 0.145, -1, -1, -1, 'Warlock - Hellfire Effect on Enemy Rank 1'), +(348, 0.2, 0.2, -1, -1, 'Warlock - Immolate'), +(29722, 0.7139, -1, -1, -1, 'Warlock - Incinerate'), +(42223, 0.286, -1, -1, -1, 'Warlock - Rain of Fire Triggered Rank 1'), +(5676, 0.4293, -1, -1, -1, 'Warlock - Searing Pain'), +(27243, 0.2129, 0.25, -1, -1, 'Warlock - Seed of Corruption'), +(686, 0.8569, -1, -1, -1, 'Warlock - Shadow Bolt'), +(6229, 0.3, -1, -1, -1, 'Warlock - Shadow Ward'), +(17877, 0.4293, -1, -1, -1, 'Warlock - Shadowburn'), +(47960, 0.1064, 0.0667, -1, -1, 'Warlock - Shadowflame Rank 1'), +(61291, 0.1064, 0.0667, -1, -1, 'Warlock - Shadowflame Rank 2'), +(30283, 0.1932, -1, -1, -1, 'Warlock - Shadowfury'), +(63106, 0, 0, 0, 0, 'Warlock - Siphon Life Triggered'), +(6353, 1.15, -1, -1, -1, 'Warlock - Soul Fire'), +(30294, 0, 0, 0, 0, 'Warlock - Soul Leech'), +(30108, -1, 0.2, -1, -1, 'Warlock - Unstable Affliction'), +(31117, 1.8, -1, -1, -1, 'Warlock - Unstable Affliction Dispell'), +(54158, 0.25, -1, 0.16, -1, 'Paladin - Jugdement (Seal of Light, Seal of Wisdom, Seal of Justice)'), +(60089, -1, -1, 0.05, -1, 'Faerie Fire (feral)'), +(58621, -1, -1, 0.08, -1, 'Death Knight - Glyph of Chains of Ice'), +(13797, -1, -1, -1, 0.02, 'Hunter - Immolation Trap($RAP*0.1 / number of ticks)'), +(3674, -1, -1, -1, 0.02, 'Hunter - Black Arrow($RAP*0.1 / number of ticks)'), +(1978, -1, -1, -1, 0.04, 'Hunter - Serpent Sting($RAP*0.2 / number of ticks)'), +(703, -1, -1, -1, 0.02, 'Rogue - Garrote'), +(2818, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 1($AP*0.12 / number of ticks)'), +(2819, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 2($AP*0.12 / number of ticks)'), +(11353, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 3($AP*0.12 / number of ticks)'), +(11354, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 4($AP*0.12 / number of ticks)'), +(25349, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 5($AP*0.12 / number of ticks)'), +(26968, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 6($AP*0.12 / number of ticks)'), +(27187, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 7($AP*0.12 / number of ticks)'), +(57969, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 8($AP*0.12 / number of ticks)'), +(57970, -1, -1, -1, 0.03, 'Rogue - Deadly Poison Rank 9($AP*0.12 / number of ticks)'), +(48628, -1, -1, -1, 0.15, 'Druid - Lock Jaw'), +(1822, -1, -1, 0.01, 0.06, 'Druid - Rake ($AP*0.18 / number of ticks)'), +(33745, -1, -1, -1, 0.01, 'Druid - Lacerate($AP*0.05 / number of ticks)'); diff --git a/sql/updates/3.1.3_old/4501_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/4501_world_spell_bonus_data.sql new file mode 100644 index 0000000..337b293 --- /dev/null +++ b/sql/updates/3.1.3_old/4501_world_spell_bonus_data.sql @@ -0,0 +1,31 @@ +DELETE FROM `spell_bonus_data` where `entry` IN(6572, 57755, 6343, 50256, 1776, 8680, 8685, 8689, 11335, 11336, 11337, 26890, 57964, 57965, 13218, 13222 +, 13223, 13224, 27189, 57974, 57975, 1495, 19306, 3044, 56641, 13812, 20253, 61491); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(6572, -1, -1, 0.207, -1, 'Warrior - Revenge'), +(57755, -1, -1, 0.5, -1, 'Warrior - Heroic Throw'), +(6343, -1, -1, 0.12, -1, 'Warrior - Thunder Clap'), +(50256, -1, -1, 0.08, -1, 'Druid - Swipe'), +(1776, -1, -1, 0.21, -1, 'Rogue - Gouge'), +(8680, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 1'), +(8685, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 2'), +(8689, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 3'), +(11335, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 4'), +(11336, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 5'), +(11337, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 6'), +(26890, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 7'), +(57964, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 8'), +(57965, -1, -1, 0.1, -1, 'Rogue - Instant Poison Rank 9'), +(13218, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 1'), +(13222, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 2'), +(13223, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 3'), +(13224, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 4'), +(27189, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 5'), +(57974, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 6'), +(57975, -1, -1, 0.04, -1, 'Rogue - Wound Poison Rank 7'), +(1495, -1, -1, 0.2, -1, 'Hunter - Mongoose Bite'), +(19306, -1, -1, 0.2, -1, 'Hunter - Counterattack'), +(3044, -1, -1, 0.15, -1, 'Hunter - Arcane Shot'), +(56641, -1, -1, 0.1, -1, 'Hunter - Steady Shot'), +(13812, -1, -1, 0.1, -1, 'Hunter - Explosive Trap Effect'), +(20253, -1, -1, 0.12, -1, 'Warrior - Intercept'), +(61491, -1, -1, 0.12, -1, 'Warrior - Intercept'); diff --git a/sql/updates/3.1.3_old/4509_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/4509_world_spell_linked_spell.sql new file mode 100644 index 0000000..d672b2a --- /dev/null +++ b/sql/updates/3.1.3_old/4509_world_spell_linked_spell.sql @@ -0,0 +1 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (48265, 49772, 48263); diff --git a/sql/updates/3.1.3_old/4510_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/4510_world_spell_linked_spell.sql new file mode 100644 index 0000000..76266d3 --- /dev/null +++ b/sql/updates/3.1.3_old/4510_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (20594); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 20594, 65116, 0, 'Stoneform'); diff --git a/sql/updates/3.1.3_old/4520_8190_world_creature_template.sql b/sql/updates/3.1.3_old/4520_8190_world_creature_template.sql new file mode 100644 index 0000000..7be3a6e --- /dev/null +++ b/sql/updates/3.1.3_old/4520_8190_world_creature_template.sql @@ -0,0 +1,5 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8158_01_mangos_playercreateinfo_action required_8190_01_mangos_creature_template bit; + +ALTER TABLE `creature_template` + CHANGE COLUMN `unk1` `KillCredit1` int(11) unsigned NOT NULL default '0', + CHANGE COLUMN `unk2` `KillCredit2` int(11) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.1.3_old/4524_world_spell_elixir.sql b/sql/updates/3.1.3_old/4524_world_spell_elixir.sql new file mode 100644 index 0000000..66d6098 --- /dev/null +++ b/sql/updates/3.1.3_old/4524_world_spell_elixir.sql @@ -0,0 +1,25 @@ +DELETE FROM `spell_elixir` WHERE `entry` IN +(54452, 60340, 60345, 60341, 60344, 60346, 54494, 53748, 53749, 53746, 60343, 53751, 53764, 60347, 53763, 53747, 53760, 54212, 53758, 53755, 53752, 62380); +INSERT INTO `spell_elixir` (`entry`, `mask`) VALUES +(54452, 0x1), +(60340, 0x1), +(60345, 0x1), +(60341, 0x1), +(60344, 0x1), +(60346, 0x1), +(54494, 0x1), +(53748, 0x1), +(53749, 0x1), +(53746, 0x1), +(60343, 0x2), +(53751, 0x2), +(53764, 0x2), +(60347, 0x2), +(53763, 0x2), +(53747, 0x2), +(53760, 0x3), +(54212, 0x3), +(53758, 0x3), +(53755, 0x3), +(53752, 0x3), +(62380, 0x3); diff --git a/sql/updates/3.1.3_old/4530_world_spell_script_target.sql b/sql/updates/3.1.3_old/4530_world_spell_script_target.sql new file mode 100644 index 0000000..f1bf84d --- /dev/null +++ b/sql/updates/3.1.3_old/4530_world_spell_script_target.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (58836); +INSERT INTO `spell_script_target` VALUES (58836, 1, 31216); +UPDATE `creature_template` SET `ScriptName`='npc_mirror_image' WHERE `entry`=31216; +UPDATE `creature_template` SET `spell1`=59638, `spell2` = 59637 WHERE `entry`=31216; diff --git a/sql/updates/3.1.3_old/4536_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4536_world_spell_proc_event.sql new file mode 100644 index 0000000..875313c --- /dev/null +++ b/sql/updates/3.1.3_old/4536_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (53234, 53237, 53238); +INSERT INTO `spell_proc_event` VALUES +(53234, 0x00, 9, 0x00020000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -- Piercing Shots (Rank 1) +(53237, 0x00, 9, 0x00020000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0.000000, 0.000000, 0), -- Piercing Shots (Rank 2) +(53238, 0x00, 9, 0x00020000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0.000000, 0.000000, 0); -- Piercing Shots (Rank 3) diff --git a/sql/updates/3.1.3_old/4539_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/4539_world_spell_linked_spell.sql new file mode 100644 index 0000000..1be5970 --- /dev/null +++ b/sql/updates/3.1.3_old/4539_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (49039); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 49039, 50397, 2, 'Lichborne - shapeshift'); diff --git a/sql/updates/3.1.3_old/4542_8191_world_spell_affect.sql b/sql/updates/3.1.3_old/4542_8191_world_spell_affect.sql new file mode 100644 index 0000000..74e28a0 --- /dev/null +++ b/sql/updates/3.1.3_old/4542_8191_world_spell_affect.sql @@ -0,0 +1,3 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8190_01_mangos_creature_template required_8191_01_mangos_spell_affect bit; + +DROP TABLE IF EXISTS `spell_affect`; diff --git a/sql/updates/3.1.3_old/4544_world.sql b/sql/updates/3.1.3_old/4544_world.sql new file mode 100644 index 0000000..90f7e19 --- /dev/null +++ b/sql/updates/3.1.3_old/4544_world.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='npc_sinkhole_kill_credit' WHERE (`entry`='26248') or (`entry`='26249'); +UPDATE `item_template` SET `ScriptName`='item_incendiary_explosives' WHERE (`entry`='35704'); +UPDATE `creature_template` SET `flags_extra`='2' WHERE (`entry`='26250'); diff --git a/sql/updates/3.1.3_old/4547_world_scripts.sql b/sql/updates/3.1.3_old/4547_world_scripts.sql new file mode 100644 index 0000000..82f682e --- /dev/null +++ b/sql/updates/3.1.3_old/4547_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `ScriptName`='npc_captured_rageclaw' WHERE (`entry`='29686'); +UPDATE `creature_template` SET `ScriptName`='npc_drakuru_shackles' WHERE (`entry`='29700'); + +DELETE FROM `spell_script_target` WHERE `entry` IN (55083,55223,59951,59952); +INSERT INTO `spell_script_target` VALUES (55083, 1, 29700),(55223, 1, 29686),(59951, 1, 29686),(59952, 1, 29686); diff --git a/sql/updates/3.1.3_old/4549_world_script.sql b/sql/updates/3.1.3_old/4549_world_script.sql new file mode 100644 index 0000000..b020a56 --- /dev/null +++ b/sql/updates/3.1.3_old/4549_world_script.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='npc_khunok_the_behemoth' WHERE (`entry`='25862'); + +-- DB CONTENT -- +UPDATE `quest_template` SET `SrcSpell`='46232' WHERE (`entry`='11878'); diff --git a/sql/updates/3.1.3_old/4572_script_texts.sql b/sql/updates/3.1.3_old/4572_script_texts.sql new file mode 100644 index 0000000..d9c4a64 --- /dev/null +++ b/sql/updates/3.1.3_old/4572_script_texts.sql @@ -0,0 +1,49 @@ +DELETE FROM script_texts WHERE entry BETWEEN -1615042 AND -1615000; +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1615000,'I fear nothing! Least of all you!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14111,1,0,0,'shadron SAY_SHADRON_AGGRO'), +(-1615001,'You are insignificant!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14112,1,0,0,'shadron SAY_SHADRON_SLAY_1'), +(-1615002,'Such mediocre resistance!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14113,1,0,0,'shadron SAY_SHADRON_SLAY_2'), +(-1615003,'We...are superior! How could this...be...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14118,1,0,0,'shadron SAY_SHADRON_DEATH'), +(-1615004,'You are easily bested! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14114,1,0,0,'shadron SAY_SHADRON_BREATH'), +(-1615005,'I will take pity on you Sartharion, just this once.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14117,1,0,0,'shadron SAY_SHADRON_RESPOND'), +(-1615006,'Father tought me well!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14115,1,0,0,'shadron SAY_SHADRON_SPECIAL_1'), +(-1615007,'On your knees!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14116,1,0,0,'shadron SAY_SHADRON_SPECIAL_2'), +(-1615008,'A Shadron Disciple appears in the Twilight!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,5,0,0,'shadron WHISPER_SHADRON_DICIPLE'), + +(-1615009,'You have no place here. Your place is among the departed.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14122,1,0,0,'tenebron SAY_TENEBRON_AGGRO'), +(-1615010,'No contest.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14123,1,0,0,'tenebron SAY_TENEBRON_SLAY_1'), +(-1615011,'Typical... Just as I was having fun.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14124,1,0,0,'tenebron SAY_TENEBRON_SLAY_2'), +(-1615012,'I should not... have held back...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 14129,1,0,0,'tenebron SAY_TENEBRON_DEATH'), +(-1615013,'To darkness I condemn you...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14125,1,0,0,'tenebron SAY_TENEBRON_BREATH'), +(-1615014,'It is amusing to watch you struggle. Very well, witness how it is done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14128,1,0,0,'tenebron SAY_TENEBRON_RESPOND'), +(-1615015,'Arrogant little creatures! To challenge powers you do not yet understand...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14126,1,0,0,'tenebron SAY_TENEBRON_SPECIAL_1'), +(-1615016,'I am no mere dragon! You will find I am much, much, more...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14127,1,0,0,'tenebron SAY_TENEBRON_SPECIAL_2'), +(-1615017,'%s begins to hatch eggs in the twilight!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,5,0,0,'tenebron WHISPER_HATCH_EGGS'), + +(-1615018,'It is my charge to watch over these eggs. I will see you burn before any harm comes to them!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14093,1,0,0,'sartharion SAY_SARTHARION_AGGRO'), +(-1615019,'This pathetic siege ends NOW!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14103,1,0,0,'sartharion SAY_SARTHARION_BERSERK'), +(-1615020,'Burn, you miserable wretches!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14098, 1,0,0,'sartharion SAY_SARTHARION_BREATH'), +(-1615021,'Shadron! Come to me, all is at risk!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14105,1,0,0,'sartharion SARTHARION_CALL_SHADRON'), +(-1615022,'Tenebron! The eggs are yours to protect as well!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14106,1,0,0,'sartharion SAY_SARTHARION_CALL_TENEBRON'), +(-1615023,'Vesperon! The clutch is in danger! Assist me!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14104,1,0,0,'sartharion SAY_SARTHARION_CALL_VESPERON'), +(-1615024,'Such is the price... of failure...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14107,1,0,0,'sartharion SAY_SARTHARION_DEATH'), +(-1615025,'Such flammable little insects....', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14099,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_1'), +(-1615026,'Your charred bones will litter the floor!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14100,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_2'), +(-1615027,'How much heat can you take?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14101,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_3'), +(-1615028,'All will be reduced to ash!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14102,1,0,0,'sartharion SAY_SARTHARION_SPECIAL_4'), +(-1615029,'You will make a fine meal for the hatchlings.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14094,1,0,0,'sartharion SAY_SARTHARION_SLAY_1'), +(-1615030,'You are the grave disadvantage.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14096,1,0,0,'sartharion SAY_SARTHARION_SLAY_2'), +(-1615031,'This is why we call you lesser beeings.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14097,1,0,0,'sartharion SAY_SARTHARION_SLAY_3'), +(-1615032,'The lava surrounding %s churns!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,5,0,0,'sartharion WHISPER_LAVA_CHURN'), + +(-1615033,'You pose no threat, lesser beings...give me your worst!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14133,1,0,0,'vesperon SAY_VESPERON_AGGRO'), +(-1615034,'The least you could do is put up a fight...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14134,1,0,0,'vesperon SAY_VESPERON_SLAY_1'), +(-1615035,'Was that the best you can do?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14135,1,0,0,'vesperon SAY_VESPERON_SLAY_2'), +(-1615036,'I still have some...fight..in...me...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 14140,1,0,0,'vesperon SAY_VESPERON_DEATH'), +(-1615037,'I will pick my teeth with your bones!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14136,1,0,0,'vesperon SAY_VESPERON_BREATH'), +(-1615038,'Father was right about you, Sartharion...You are a weakling!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14139,1,0,0,'vesperon SAY_VESPERON_RESPOND'), +(-1615039,'Aren\'t you tricky...I have a few tricks of my own...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14137,1,0,0,'vesperon SAY_VESPERON_SPECIAL_1'), +(-1615040,'Unlike, I have many talents.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14138,1,0,0,'vesperon SAY_VESPERON_SPECIAL_2'), +(-1615041,'A Vesperon Disciple appears in the Twilight!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,5,0,0,'shadron WHISPER_VESPERON_DICIPLE'), + +(-1615042,'%s begins to open a Twilight Portal!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,5,0,0,'sartharion drake WHISPER_OPEN_PORTAL'); diff --git a/sql/updates/3.1.3_old/4572_world_script.sql b/sql/updates/3.1.3_old/4572_world_script.sql new file mode 100644 index 0000000..f34a407 --- /dev/null +++ b/sql/updates/3.1.3_old/4572_world_script.sql @@ -0,0 +1 @@ +UPDATE instance_template SET script='instance_obsidian_sanctum' WHERE map=615; diff --git a/sql/updates/3.1.3_old/4577_world_scripts.sql b/sql/updates/3.1.3_old/4577_world_scripts.sql new file mode 100644 index 0000000..930ebec --- /dev/null +++ b/sql/updates/3.1.3_old/4577_world_scripts.sql @@ -0,0 +1,10 @@ +UPDATE creature_template SET ScriptName='boss_sartharion' WHERE entry=28860; +UPDATE creature_template SET ScriptName='mob_vesperon' WHERE entry=30449; +UPDATE creature_template SET ScriptName='mob_shadron' WHERE entry=30451; +UPDATE creature_template SET ScriptName='mob_tenebron' WHERE entry=30452; +UPDATE creature_template SET ScriptName='mob_twilight_eggs' WHERE entry=30882; +UPDATE creature_template SET ScriptName='mob_twilight_whelp' WHERE entry IN (30890, 31214); +UPDATE creature_template SET ScriptName='mob_acolyte_of_shadron' WHERE entry=31218; +UPDATE creature_template SET ScriptName='mob_acolyte_of_vesperon' WHERE entry=31219; + +UPDATE gameobject_template SET ScriptName='go_resonite_cask' WHERE entry=178145; diff --git a/sql/updates/3.1.3_old/4583_world_command.sql b/sql/updates/3.1.3_old/4583_world_command.sql new file mode 100644 index 0000000..6c5bc49 --- /dev/null +++ b/sql/updates/3.1.3_old/4583_world_command.sql @@ -0,0 +1 @@ +DELETE FROM `command` WHERE `name` = 'reload spell_affect'; diff --git a/sql/updates/3.1.3_old/4594_world_scripts.sql b/sql/updates/3.1.3_old/4594_world_scripts.sql new file mode 100644 index 0000000..ebdcb7f --- /dev/null +++ b/sql/updates/3.1.3_old/4594_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE `item_template` SET `ScriptName`='item_dart_gun' WHERE `entry`=44222; + +UPDATE `creature_template` SET `ScriptName`='npc_kalecgos' WHERE `entry` IN (24844, 24848); diff --git a/sql/updates/3.1.3_old/4597_world_command.sql b/sql/updates/3.1.3_old/4597_world_command.sql new file mode 100644 index 0000000..374cbb2 --- /dev/null +++ b/sql/updates/3.1.3_old/4597_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('reload creature_linked_respawn', 'npc setlink'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('reload creature_linked_respawn',2,'Syntax: .reload creature_linked_respawn\r\nReload creature_linked_respawn table.'), +('npc setlink',2,'Syntax: .npc setlink $creatureGUID\r\n\r\nLinks respawn of selected creature to the condition that $creatureGUID defined is alive.'); diff --git a/sql/updates/3.1.3_old/4598_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/4598_world_spell_bonus_data.sql new file mode 100644 index 0000000..0127e88 --- /dev/null +++ b/sql/updates/3.1.3_old/4598_world_spell_bonus_data.sql @@ -0,0 +1 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` = 53600; diff --git a/sql/updates/3.1.3_old/4601_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4601_world_spell_proc_event.sql new file mode 100644 index 0000000..0bae1d9 --- /dev/null +++ b/sql/updates/3.1.3_old/4601_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN(47569, 47570); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 50, 0), -- Improved Shadowform (Rank 1) +( 47570, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 100, 0); -- Improved Shadowform (Rank 2) diff --git a/sql/updates/3.1.3_old/4602_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/4602_world_spell_bonus_data.sql new file mode 100644 index 0000000..c10cd0a --- /dev/null +++ b/sql/updates/3.1.3_old/4602_world_spell_bonus_data.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_bonus_data` WHERE `entry`=779; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +('779', '-1', '-1', '0.063', '-1', 'Druid - Swipe (Bear)'); + +DELETE FROM `spell_bonus_data` WHERE `entry`=50256; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(50256, -1, -1, 0.08, -1, 'Pet Skills - Bear (Swipe)'); diff --git a/sql/updates/3.1.3_old/4603_world_tmp.sql b/sql/updates/3.1.3_old/4603_world_tmp.sql new file mode 100644 index 0000000..6a98804 --- /dev/null +++ b/sql/updates/3.1.3_old/4603_world_tmp.sql @@ -0,0 +1,54 @@ +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=11898; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=11899; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=149045; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=149046; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=164871; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=175080; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176080; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176081; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176082; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176083; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176084; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176085; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176086; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176231; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176244; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176310; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=176495; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=177233; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=181056; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=181646; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=183169; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=183177; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=183202; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=183203; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=183407; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=183490; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=183788; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=184330; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20649; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20650; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20651; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20652; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20653; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20654; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20655; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20656; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20657; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=20808; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=210335; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=210336; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=210349; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=211023; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=211024; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=211050; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=211051; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=211052; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=211053; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=4170; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=4171; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=47296; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=47297; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=80022; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=80023; +UPDATE `gameobject_template` SET `flags`=40 WHERE `entry`=85556; diff --git a/sql/updates/3.1.3_old/4610_world.sql b/sql/updates/3.1.3_old/4610_world.sql new file mode 100644 index 0000000..ba05803 --- /dev/null +++ b/sql/updates/3.1.3_old/4610_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_bonus_data` where `entry` IN(62124, 64382); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(62124, 0.085, -1, -1, -1, 'Paladin - Hand of Reckoning'), +(64382, -1, -1, 0.5, -1, 'Warrior - Shattering Throw'); diff --git a/sql/updates/3.1.3_old/4610_world_scripts.sql b/sql/updates/3.1.3_old/4610_world_scripts.sql new file mode 100644 index 0000000..3ea0c27 --- /dev/null +++ b/sql/updates/3.1.3_old/4610_world_scripts.sql @@ -0,0 +1,38 @@ +UPDATE `creature_template` SET `ScriptName`='npc_injured_rainspeaker_oracle' WHERE `entry`=28217; + +DELETE FROM `script_waypoint` WHERE `entry` = 28217; +INSERT INTO `script_waypoint` VALUES +(28217, 0, 5399.96,4509.07,-131.053, 0, ''), +(28217, 1, 5396.95,4514.84,-131.791, 0, ''), +(28217, 2, 5395.16,4524.06,-132.335, 0, ''), +(28217, 3, 5400.15,4526.84,-136.058, 0, ''), +(28217, 4, 5403.53,4527.2,-138.907, 0, ''), +(28217, 5, 5406.51,4527.47,-141.983, 0, ''), +(28217, 6, 5409.16,4526.37,-143.902, 0, ''), +(28217, 7, 5412.04,4523.05,-143.998, 0, ''), +(28217, 8, 5415.23,4521.19,-143.961, 0, ''), +(28217, 9, 5417.74,4519.74,-144.292, 0, ''), +(28217, 10, 5421.77,4519.79,-145.36, 0, ''), +(28217, 11, 5426.75,4520.53,-147.931, 0, ''), +(28217, 12, 5429.06,4521.82,-148.919, 0, ''), +(28217, 13, 5436.52,4534.63,-149.618, 0, ''), +(28217, 14, 5441.52,4542.23,-149.367, 0, ''), +(28217, 15, 5449.06,4553.47,-149.187, 0, ''), +(28217, 16, 5453.5,4565.61,-147.526, 0, ''), +(28217, 17, 5455.04,4578.6,-147.147, 0, ''), +(28217, 18, 5462.32,4591.69,-147.738,0, ''), +(28217, 19, 5470.04,4603.04,-146.044,0, ''), +(28217, 20, 5475.93,4608.86,-143.152, 0, ''), +(28217, 21, 5484.48,4613.78,-139.19, 0, ''), +(28217, 22, 5489.03,4616.56,-137.796, 0, ''), +(28217, 23, 5497.92,4629.89,-135.556, 0, ''), +(28217, 24, 5514.48,4638.82,-136.19, 0, ''), +(28217, 25, 5570,4654.5,-134.947, 0, ''), +(28217, 26, 5578.32,4653.29,-136.896, 0, ''), +(28217, 27, 5596.56,4642.26,-136.593, 0, ''), +(28217, 28, 5634.02,4600.35,-137.291,2000,''); + +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1571000, 'You save me! We thank you. We going to go back to village now. You come too... you can stay with us! Puppy-men kind of mean anyway. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_injured_rainspeaker_oracle SAY_END_IRO'), +(-1571001, 'Let me know when you ready to go, okay?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_injured_rainspeaker_oracle SAY_QUEST_ACCEPT_IRO '), +(-1571002, 'Home time!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_injured_rainspeaker_oracle SAY_START_IRO'); diff --git a/sql/updates/3.1.3_old/4615_world.sql b/sql/updates/3.1.3_old/4615_world.sql new file mode 100644 index 0000000..8b5ad1a --- /dev/null +++ b/sql/updates/3.1.3_old/4615_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN(47585, 64382); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 47585, 60069, 2, 'Dispersion (transform/regen)'), +( 64382, 64380, 0, 'Shattering Throw'), +( 47585, 63230, 2, 'Dispersion (immunity)'); diff --git a/sql/updates/3.1.3_old/4643_world_8237_creature_template.sql b/sql/updates/3.1.3_old/4643_world_8237_creature_template.sql new file mode 100644 index 0000000..d2ac804 --- /dev/null +++ b/sql/updates/3.1.3_old/4643_world_8237_creature_template.sql @@ -0,0 +1,4 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8227_01_mangos_spell_proc_event required_8237_01_mangos_creature_template bit; + +UPDATE creature_template + SET mindmg = ROUND(mindmg + attackpower), maxdmg=ROUND(maxdmg+attackpower); diff --git a/sql/updates/3.1.3_old/4649_world_8250_spell_threat.sql b/sql/updates/3.1.3_old/4649_world_8250_spell_threat.sql new file mode 100644 index 0000000..e71aa25 --- /dev/null +++ b/sql/updates/3.1.3_old/4649_world_8250_spell_threat.sql @@ -0,0 +1,3 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8249_02_mangos_spell_chain required_8250_01_mangos_spell_threat bit; + +DELETE FROM `spell_threat` WHERE `entry` IN (778,9749,9907,14274,15629,15630,15631,15632,17390,17391,17392,26993,27011); diff --git a/sql/updates/3.1.3_old/4663_world.sql b/sql/updates/3.1.3_old/4663_world.sql new file mode 100644 index 0000000..7f63011 --- /dev/null +++ b/sql/updates/3.1.3_old/4663_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` = 50453; +INSERT INTO `spell_proc_event` (`entry`, `procFlags`, `CustomChance`) VALUES ('50453', '0x00000004', '100'); + +DELETE FROM `creature_template_addon` WHERE `entry` = 28017; +INSERT INTO `creature_template_addon` (`entry`, `auras`) VALUES ('28017', '50453 0'); diff --git a/sql/updates/3.1.3_old/4696_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4696_world_spell_proc_event.sql new file mode 100644 index 0000000..2fa4a8b --- /dev/null +++ b/sql/updates/3.1.3_old/4696_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (56636,56637,56638); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 56636, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 1) +( 56637, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 2) +( 56638, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6); -- Taste for Blood (Rank 3) diff --git a/sql/updates/3.1.3_old/4697_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4697_world_spell_proc_event.sql new file mode 100644 index 0000000..d594548 --- /dev/null +++ b/sql/updates/3.1.3_old/4697_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM `spell_proc_event` WHERE `entry` = 50453; diff --git a/sql/updates/3.1.3_old/4705_world_trinity_string.sql b/sql/updates/3.1.3_old/4705_world_trinity_string.sql new file mode 100644 index 0000000..d16ac64 --- /dev/null +++ b/sql/updates/3.1.3_old/4705_world_trinity_string.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry` = 6616; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES ('6616','Silence is ON for %s'); diff --git a/sql/updates/3.1.3_old/4725_world_scripts.sql b/sql/updates/3.1.3_old/4725_world_scripts.sql new file mode 100644 index 0000000..92af321 --- /dev/null +++ b/sql/updates/3.1.3_old/4725_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `minlevel`='80' WHERE (`entry`='22207'); +UPDATE `creature_template` SET `maxlevel`='80' WHERE (`entry`='22207'); +UPDATE `creature_template` SET `faction_A`='14' WHERE (`entry`='22207'); +UPDATE `creature_template` SET `faction_H`='14' WHERE (`entry`='22207'); +UPDATE `creature_template` SET `flags_extra`='128' WHERE (`entry`='22207'); diff --git a/sql/updates/3.1.3_old/4737_world_TDB.sql b/sql/updates/3.1.3_old/4737_world_TDB.sql new file mode 100644 index 0000000..df24155 --- /dev/null +++ b/sql/updates/3.1.3_old/4737_world_TDB.sql @@ -0,0 +1,16 @@ +REPLACE INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `ScriptName`) VALUES +(178365, 1, 5771, 'Alliance Banner', '', '', '', 83, 0, 1, 0, 0, 0, 0, 0, 1479, 196608, 180100, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(178925, 1, 5651, 'Alliance Banner', '', '', '', 83, 0, 1, 0, 0, 0, 0, 0, 1479, 196608, 180421, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(178940, 1, 5653, 'Contested Banner', '', '', '', 83, 0, 1, 0, 0, 0, 0, 0, 1479, 196608, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(178943, 1, 5652, 'Horde Banner', '', '', '', 84, 0, 1, 0, 0, 0, 0, 0, 1479, 196608, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(179286, 1, 5772, 'Contested Banner', '', '', '', 83, 0, 1, 0, 0, 0, 0, 0, 1479, 196608, 180102, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(179287, 1, 5774, 'Contested Banner', '', '', '', 84, 0, 1, 0, 0, 0, 0, 0, 1479, 0, 180102, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(179435, 1, 5654, 'Contested Banner', '', '', '', 84, 0, 1, 0, 0, 0, 0, 0, 1479, 196608, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180100, 6, 2232, 'Alliance Banner Aura', '', '', '', 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180101, 6, 1311, 'Horde Banner Aura', '', '', '', 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180102, 6, 266, 'Neutral Banner Aura', '', '', '', 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180418, 1, 6211, 'Snowfall Banner', '', '', '', 0, 0, 1, 0, 0, 0, 0, 0, 1479, 196608, 180100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180421, 6, 2232, 'Alliance Banner Aura, Large', '', '', '', 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180422, 6, 1311, 'Horde Banner Aura, Large', '', '', '', 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180423, 6, 266, 'Neutral Banner Aura, Large', '', '', '', 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''), +(180424, 0, 3751, 'Alterac Valley Gate', '', '', '', 100, 0, 3.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''); diff --git a/sql/updates/3.1.3_old/4738_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4738_world_spell_proc_event.sql new file mode 100644 index 0000000..27107a1 --- /dev/null +++ b/sql/updates/3.1.3_old/4738_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_proc_event` WHERE (`entry`='56375'); +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`procFlags`) VALUES ('56375','0','3',0x01000000,0x00010000); diff --git a/sql/updates/3.1.3_old/4741_world.sql b/sql/updates/3.1.3_old/4741_world.sql new file mode 100644 index 0000000..8b2a77b --- /dev/null +++ b/sql/updates/3.1.3_old/4741_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` where `entry` IN(1333); +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(1333, 'The Battle for Alterac Valley begins in 2 minutes.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.1.3_old/4742_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/4742_world_spell_bonus_data.sql new file mode 100644 index 0000000..e80a0b0 --- /dev/null +++ b/sql/updates/3.1.3_old/4742_world_spell_bonus_data.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry`=42243; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(42243, -1, -1, 0.07, -1, 'Hunter - Volley'); diff --git a/sql/updates/3.1.3_old/4742_world_spell_proc_event.sql b/sql/updates/3.1.3_old/4742_world_spell_proc_event.sql new file mode 100644 index 0000000..e4a3bcd --- /dev/null +++ b/sql/updates/3.1.3_old/4742_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_proc_event` WHERE (`entry`='64928'); +INSERT INTO `spell_proc_event` (`entry`, `SpellFamilyName`, `SpellFamilyMask0`, `procEx`) VALUES (64928, 11, 0x00000001, 0x00000002); diff --git a/sql/updates/3.1.3_old/4745_world_access_requirement.sql b/sql/updates/3.1.3_old/4745_world_access_requirement.sql new file mode 100644 index 0000000..4dbb66a --- /dev/null +++ b/sql/updates/3.1.3_old/4745_world_access_requirement.sql @@ -0,0 +1,46 @@ +-- BC Dungeons -- +UPDATE `access_requirement` SET `heroic_level_min` = 70 WHERE `id` IN +( + 4404, -- Auchenai Crypts -- + 4405, -- Mana-Tombs -- + 4406, -- Sethekk Halls -- + 4407, -- Shadow Labyrinth -- + 4321, -- Old Hillsbrad Foothills -- + 4320, -- The Black Morass -- + 4365, -- The Slave Pens -- + 4364, -- The Steamvault -- + 4363, -- The Underbog -- + 4150, -- Hellfire Ramparts -- + 4152, -- The Blood Furnace -- + 4151, -- The Shattered Halls -- + 4887, -- Magisters' Terrace -- + 4468, -- The Arcatraz -- + 4467, -- The Botanica -- + 4469 -- The Mechanar -- +); + +-- WOTLK Dungeons -- +UPDATE `access_requirement` SET `heroic_level_min` = 80 WHERE `id` IN +( + 5215, -- Ahn'kahet: The Old Kingdom -- + 5117, -- Azjol-Nerub -- + 5150, -- The Culling of Stratholme -- + 4998, -- Drak'Tharon Keep -- + 5206, -- Gundrak -- + 4983, -- The Nexus -- + 5246, -- The Oculus -- + 5209, -- The Violet Hold -- + 5093, -- Halls of Lightning -- + 5010, -- Halls of Stone -- + 4745, -- Utgarde Keep -- + 4747 -- Utgarde Pinnacle -- +); + +-- WOTLK Raids -- +UPDATE `access_requirement` SET `heroic_level_min` = 80 WHERE `id` IN +( + 4156, -- Naxxramas -- + 5290, -- The Eye of Eternity -- + 5243, -- The Obsidian Sanctum -- + 5379 -- Ulduar -- +); diff --git a/sql/updates/3.1.3_old/4748_world.sql b/sql/updates/3.1.3_old/4748_world.sql new file mode 100644 index 0000000..0083429 --- /dev/null +++ b/sql/updates/3.1.3_old/4748_world.sql @@ -0,0 +1,2 @@ +UPDATE `item_template` SET `ScriptName`='item_mysterious_egg' WHERE `entry` IN(39878); +UPDATE `item_template` SET `ScriptName`='item_disgusting_jar' WHERE `entry` IN(44717); diff --git a/sql/updates/3.1.3_old/4751_world_scripts.sql b/sql/updates/3.1.3_old/4751_world_scripts.sql new file mode 100644 index 0000000..5bedf2d --- /dev/null +++ b/sql/updates/3.1.3_old/4751_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_training_dummy', `flags_extra`='262144', `mechanic_immune_mask`='0', `faction_A`='7', `faction_H`='7' WHERE `entry` IN (17578, 24792, 32543, 32546, 32542, 32545, 30527, 31143, 31144, 31146, 32541, 32666, 32667); diff --git a/sql/updates/3.1.3_old/4753_world.sql b/sql/updates/3.1.3_old/4753_world.sql new file mode 100644 index 0000000..059a642 --- /dev/null +++ b/sql/updates/3.1.3_old/4753_world.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (58836, 48743, 50524, 50515); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(58836, 3, 31216), +(50524, 3, 27829), +(50515, 3, 27829); diff --git a/sql/updates/3.1.3_old/4755_world_scripts.sql b/sql/updates/3.1.3_old/4755_world_scripts.sql new file mode 100644 index 0000000..74e50ef --- /dev/null +++ b/sql/updates/3.1.3_old/4755_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_shrine_of_the_birds' WHERE `entry` IN (185547,185553,185551); diff --git a/sql/updates/3.1.3_old/4756_world.sql b/sql/updates/3.1.3_old/4756_world.sql new file mode 100644 index 0000000..abde52f --- /dev/null +++ b/sql/updates/3.1.3_old/4756_world.sql @@ -0,0 +1,10 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN(54639, 54638, 54637, 61433, 61434, 49467, 50033, 50034); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 54639, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 54638, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 54637, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 61433, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 61434, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north +( 49467, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery +( 50033, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery +( 50034, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Death Rune Mastery diff --git a/sql/updates/3.1.3_old/4759_world.sql b/sql/updates/3.1.3_old/4759_world.sql new file mode 100644 index 0000000..fa1170f --- /dev/null +++ b/sql/updates/3.1.3_old/4759_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN(58872, 58874); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 58872, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0), -- Damage Shield (Rank 1) +( 58874, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000043, 0, 0, 0); -- Damage Shield (Rank 2) diff --git a/sql/updates/3.1.3_old/4761_world.sql b/sql/updates/3.1.3_old/4761_world.sql new file mode 100644 index 0000000..563258f --- /dev/null +++ b/sql/updates/3.1.3_old/4761_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (52173, 60243); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(52173, 3, 28267), +(60243, 3, 11236); diff --git a/sql/updates/3.1.3_old/4762_8294_01_mangos_playercreateinfo_action.sql b/sql/updates/3.1.3_old/4762_8294_01_mangos_playercreateinfo_action.sql new file mode 100644 index 0000000..8a600dd --- /dev/null +++ b/sql/updates/3.1.3_old/4762_8294_01_mangos_playercreateinfo_action.sql @@ -0,0 +1,54 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8254_01_mangos_spell_proc_event required_8294_01_mangos_playercreateinfo_action bit; + +-- Remove Double attack icons for Night Elf Warrior +DELETE FROM playercreateinfo_action WHERE race=4 AND class=1 AND button=73; +-- Move Heroic Strike to correct location for Night Elf Warrior +DELETE FROM playercreateinfo_action WHERE race=4 AND class=1 AND button=74; +INSERT INTO playercreateinfo_action VALUES (4,1,73,78,0); +-- Moved Shadowmeld to correct location for Night Elf Warrior +DELETE FROM playercreateinfo_action WHERE race=4 AND class=1 AND button IN (82,83); +INSERT INTO playercreateinfo_action VALUES (4,1,82,58984,0); +-- Add correct Tough Jerky location for Night elf Warrior +DELETE FROM playercreateinfo_action WHERE race=4 AND class=1 AND button=84; +INSERT INTO playercreateinfo_action VALUES (4,1,83,117,128); + +-- Moved Shadowmeld to correct location for Night Elf Druid +DELETE FROM playercreateinfo_action WHERE race=4 AND class=11 AND button IN (3,9); +INSERT INTO playercreateinfo_action VALUES (4,11,9,58984,0); + +-- Moved Shadowmeld to correct location for Night Elf Rogue +DELETE FROM playercreateinfo_action WHERE race=4 AND class=4 AND button IN (4,10); +INSERT INTO playercreateinfo_action VALUES (4,4,10,58984,0); +-- Add Shadowmeld For Night Elf Rogue Shadow form bar +DELETE FROM playercreateinfo_action WHERE race=4 AND class=4 AND button = 82; +INSERT INTO playercreateinfo_action VALUES (4,4,82,58984,0); + +-- Replace Tough Jerky for Gnome Death Knight Action Bar +DELETE FROM playercreateinfo_action WHERE race=7 AND class=6 AND button IN (11,83); +INSERT INTO playercreateinfo_action VALUES +(7,6,11,41751,128), +(7,6,83,41751,128); + +-- Moved Gift of Naaru to correct location for Draenei Death Knight +DELETE FROM playercreateinfo_action WHERE race=11 AND class=6 AND button IN (6,10); +INSERT INTO playercreateinfo_action VALUES (11,6,10,59545,0); +-- Add Black Mushroom to Draenei Death Knight Action Bar +DELETE FROM playercreateinfo_action WHERE race=11 AND class=6 AND button IN (11); +INSERT INTO playercreateinfo_action VALUES +(11,6,11,41751,128); + +-- Moved Blood Fury to correct action bar location for Orc Hunter +DELETE FROM playercreateinfo_action WHERE race=2 AND class=3 AND button IN (4,9); +INSERT INTO playercreateinfo_action VALUES (2,3,9,20572,0); + +-- Moved Berserking to correct action bar location for Non-Heroic Troll classes +DELETE FROM playercreateinfo_action WHERE race=8 AND class IN (3,5,7,8) AND button IN (3,76); +INSERT INTO playercreateinfo_action VALUES +(8,3,3,20554,0), +(8,5,3,20554,0), +(8,7,3,20554,0), +(8,8,3,20554,0); + +-- Updated and moved Berserking skill for Troll Rogue +DELETE FROM playercreateinfo_action WHERE race=8 AND class=4 AND button IN (4,76); +INSERT INTO playercreateinfo_action VALUES (8,4,4,26297,0); diff --git a/sql/updates/3.1.3_old/4783_world_scripts.sql b/sql/updates/3.1.3_old/4783_world_scripts.sql new file mode 100644 index 0000000..e210346 --- /dev/null +++ b/sql/updates/3.1.3_old/4783_world_scripts.sql @@ -0,0 +1,15 @@ +UPDATE creature_template set ScriptName = 'boss_bjarngrim' where entry =28586; +UPDATE creature_template set ScriptName = 'mob_stormforged_lieutenant' where entry =29240; +DELETE FROM script_texts where entry IN (-1602001,-1602000,-1602002,-1602003,-1602004,-1602005,-1602006,-1602007,-1602008,-1602009,-1602010); +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1602000,'I am the greatest of my father\'s sons! Your end has come!',14149,1,0,0,'bjarngrim SAY_AGGRO'), +(-1602001,'So ends your curse!',14153,1,0,0,'bjarngrim SAY_SLAY_1'), +(-1602002,'Flesh... is... weak!',14154,1,0,0,'bjarngrim SAY_SLAY_2'), +(-1602003,'...',14155,1,0,0,'bjarngrim SAY_SLAY_3'), +(-1602004,'How can it be...? Flesh is not... stronger!',14156,1,0,0,'bjarngrim SAY_DEATH'), +(-1602005,'Defend yourself, for all the good it will do!',14151,1,0,0,'bjarngrim SAY_BATTLE_STANCE'), +(-1602006,'%s switches to Battle Stance!',0,3,0,0,'bjarngrim EMOTE_BATTLE_STANCE'), +(-1602007,'GRAAAAAH! Behold the fury of iron and steel!',14152,1,0,0,'bjarngrim SAY_BERSEKER_STANCE'), +(-1602008,'%s switches to Berserker Stance!',0,3,0,0,'bjarngrim EMOTE_BERSEKER_STANCE'), +(-1602009,'Give me your worst!',14150,1,0,0,'bjarngrim SAY_DEFENSIVE_STANCE'), +(-1602010,'%s switches to Defensive Stance!',0,3,0,0,'bjarngrim EMOTE_DEFENSIVE_STANCE'); diff --git a/sql/updates/3.1.3_old/4787_script_texts.sql b/sql/updates/3.1.3_old/4787_script_texts.sql new file mode 100644 index 0000000..3c879a4 --- /dev/null +++ b/sql/updates/3.1.3_old/4787_script_texts.sql @@ -0,0 +1,23 @@ +UPDATE `script_texts` SET `entry`=`entry`+20 WHERE `entry` IN(-1574001,-1574002,-1574003,-1574004); +UPDATE `script_texts` SET `entry`=-1574001 WHERE `entry`=-1574023; +UPDATE `script_texts` SET `entry`=-1574002 WHERE `entry`=-1574024; +UPDATE `script_texts` SET `entry`=-1574003 WHERE `entry`=-1574021; +UPDATE `script_texts` SET `entry`=-1574004 WHERE `entry`=-1574022; + +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1574005,'I\'ll paint my face with your blood!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13207,1,0,0,'ingvar SAY_AGGRO_FIRST'), +(-1574006,'I return! A second chance to carve out your skull!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13209,1,0,0,'ingvar SAY_AGGRO_SECOND'), +(-1574007,'My life for the... death god!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13213,1,0,0,'ingvar SAY_DEATH_FIRST'), +(-1574008,'No! I can do... better! I can...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13211,1,0,0,'ingvar SAY_DEATH_SECOND'), +(-1574009,'Mjul orm agn gjor!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13212,1,0,0,'ingvar SAY_KILL_FIRST'), +(-1574010,'I am a warrior born!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13214,1,0,0,'ingvar SAY_KILL_SECOND'), +(-1574011,'Dalronn! See if you can muster the nerve to join my attack!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13229,1,0,0,'skarvald YELL_SKARVALD_AGGRO'), +(-1574012,'Not... over... yet.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13230,1,0,0,'skarvald YELL_SKARVALD_DAL_DIED'), +(-1574013,'A warrior\'s death.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13231,1,0,0,'skarvald YELL_SKARVALD_SKA_DIEDFIRST'), +(-1574014,'???', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13232,1,0,0,'skarvald YELL_SKARVALD_KILL'), +(-1574015,'Pagh! What sort of necromancer lets death stop him? I knew you were worthless!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13233,1,0,0,'skarvald YELL_SKARVALD_DAL_DIEDFIRST'), +(-1574016,'By all means, don\'t assess the situation, you halfwit! Just jump into the fray!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13199,1,0,0,'dalronn YELL_DALRONN_AGGRO'), +(-1574017,'See... you... soon.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13200,1,0,0,'dalronn YELL_DALRONN_SKA_DIED'), +(-1574018,'There\'s no... greater... glory.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13201,1,0,0,'dalronn YELL_DALRONN_DAL_DIEDFIRST'), +(-1574019,'You may serve me yet.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13202,1,0,0,'dalronn YELL_DALRONN_KILL'), +(-1574020,'Skarvald, you incompetent slug! Return and make yourself useful!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13203,1,0,0,'dalronn YELL_DALRONN_SKA_DIEDFIRST'); diff --git a/sql/updates/3.1.3_old/4793_world_scripts.sql b/sql/updates/3.1.3_old/4793_world_scripts.sql new file mode 100644 index 0000000..8968f61 --- /dev/null +++ b/sql/updates/3.1.3_old/4793_world_scripts.sql @@ -0,0 +1,16 @@ +UPDATE item_template SET ScriptName='' WHERE entry=34368; +UPDATE item_template SET ScriptName='' WHERE entry=31129; +UPDATE item_template SET ScriptName='' WHERE entry=44222; +UPDATE item_template SET ScriptName='' WHERE entry=22473; +UPDATE item_template SET ScriptName='' WHERE entry IN (9606,9618,9619,9620,9621); +UPDATE item_template SET ScriptName='' WHERE entry=30656; +UPDATE item_template SET ScriptName='' WHERE entry=34255; +UPDATE item_template SET ScriptName='' WHERE entry=32825; +UPDATE item_template SET ScriptName='' WHERE entry=32321; +UPDATE item_template SET ScriptName='' WHERE entry IN (15908,15911,15913,15914,15915,15916,15917,15919,15920,15921,15922,15923,23697,23702,23703,23896,23897,23898); +UPDATE item_template SET ScriptName='' WHERE entry=8149; +UPDATE item_template SET ScriptName='' WHERE entry=30259; +UPDATE item_template SET ScriptName='' WHERE entry=10699; +UPDATE item_template SET ScriptName='' WHERE entry=31463; +UPDATE item_template SET ScriptName='' WHERE entry=22962; +UPDATE item_template SET ScriptName='' WHERE entry=28132; diff --git a/sql/updates/3.1.3_old/4795_world_scripts_converter.sql b/sql/updates/3.1.3_old/4795_world_scripts_converter.sql new file mode 100644 index 0000000..ab0ea35 --- /dev/null +++ b/sql/updates/3.1.3_old/4795_world_scripts_converter.sql @@ -0,0 +1,13 @@ +INSERT INTO creature_template (entry, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8) VALUES +(29987, 55645, 0, 0, 0, 0, 0, 0, 27892), # Unrelenting Trainee (H) +(29985, 27825, 0, 0, 0, 0, 0, 0, 27928), # Unrelenting Death Knight (H) +(29986, 55638, 55608, 0, 0, 0, 0, 0, 27935) # Unrelenting Rider (H) +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +spell2 = VALUES(spell2), +spell3 = VALUES(spell3), +spell4 = VALUES(spell4), +spell5 = VALUES(spell5), +spell6 = VALUES(spell6), +spell7 = VALUES(spell7), +spell8 = VALUES(spell8); diff --git a/sql/updates/3.1.3_old/4803_script_texts.sql b/sql/updates/3.1.3_old/4803_script_texts.sql new file mode 100644 index 0000000..a91fa99 --- /dev/null +++ b/sql/updates/3.1.3_old/4803_script_texts.sql @@ -0,0 +1,3 @@ +DELETE FROM script_texts WHERE entry=-1000431; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000431,'Okay, okay... gimme a minute to rest now. You gone and beat me up good.',0,0,14,1,'calvin SAY_COMPLETE'); diff --git a/sql/updates/3.1.3_old/4806_script_texts.sql b/sql/updates/3.1.3_old/4806_script_texts.sql new file mode 100644 index 0000000..1a3875c --- /dev/null +++ b/sql/updates/3.1.3_old/4806_script_texts.sql @@ -0,0 +1 @@ +UPDATE script_texts SET language=1, emote=14 WHERE entry=-1000431; diff --git a/sql/updates/3.1.3_old/4807_script_texts.sql b/sql/updates/3.1.3_old/4807_script_texts.sql new file mode 100644 index 0000000..573c44b --- /dev/null +++ b/sql/updates/3.1.3_old/4807_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM script_texts WHERE entry IN(-1590000,-1590001,-1590002); +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1590000, 'Emalon the Storm Watcher overcharges a Tempest Minion!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 3, 0, 0, 'emalon EMOTE_OVERCHARGE_TEMPEST_MINION'), +(-1590001, 'A Tempest Minion appears to defend Emalon!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 3, 0, 0, 'emalon EMOTE_MINION_RESPAWN'), +(-1590002, 'Archavon the Stone Watcher goes into a berserker rage!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 2, 0, 0, 'archavon EMOTE_BERSERK'); diff --git a/sql/updates/3.1.3_old/4831_script_texts.sql b/sql/updates/3.1.3_old/4831_script_texts.sql new file mode 100644 index 0000000..5df8d3f --- /dev/null +++ b/sql/updates/3.1.3_old/4831_script_texts.sql @@ -0,0 +1,8 @@ +DELETE FROM script_texts WHERE entry IN(-1609017,-1609018,-1609019,-1609020,-1609021,-1609022); +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1609017,'No potions!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_A'), +(-1609018,'Remember this day, $n, for it is the day that you will be thoroughly owned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_B'), +(-1609019,'I\'m going to tear your heart out, cupcake!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_C'), +(-1609020,'Don\'t make me laugh.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_D'), +(-1609021,'Here come the tears...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_E'), +(-1609022,'You have challenged death itself!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_F'); diff --git a/sql/updates/3.1.3_old/4836_world_announce.sql b/sql/updates/3.1.3_old/4836_world_announce.sql new file mode 100644 index 0000000..1e8920b --- /dev/null +++ b/sql/updates/3.1.3_old/4836_world_announce.sql @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS `autobroadcast`; +CREATE TABLE `autobroadcast` ( +`id` int(11) NOT NULL AUTO_INCREMENT, +`text` longtext NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DELETE FROM `trinity_string` WHERE `entry` = 11000; +INSERT INTO `trinity_string` (entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8) +VALUES (11000, '|cffffff00[|c00077766Autobroadcast|cffffff00]: |cFFF222FF%s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- optional examples +-- insert into `autobroadcast` (`id`, `text`) values('1','All Battlegrounds and Arena's work on this server.'); +-- insert into `autobroadcast` (`id`, `text`) values('2','This server has 2 realms, The other realm is a PVP instant level 70 realm. Try it!'); +-- insert into `autobroadcast` (`id`, `text`) values('3','The Auction House on this server is always full, because we use an AH Bot.'); diff --git a/sql/updates/3.1.3_old/4841_world_scripts.sql b/sql/updates/3.1.3_old/4841_world_scripts.sql new file mode 100644 index 0000000..543e18a --- /dev/null +++ b/sql/updates/3.1.3_old/4841_world_scripts.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='mob_archavon_warder' WHERE `entry`=32353; +UPDATE `creature_template` SET `ScriptName`='boss_emalon' WHERE `entry`=33993; +UPDATE `creature_template` SET `ScriptName`='mob_tempest_minion' WHERE `entry`=33998; +UPDATE `instance_template` SET `script`='instance_archavon' WHERE `map`=624; diff --git a/sql/updates/3.1.3_old/4854_world_scripts.sql b/sql/updates/3.1.3_old/4854_world_scripts.sql new file mode 100644 index 0000000..369d68d --- /dev/null +++ b/sql/updates/3.1.3_old/4854_world_scripts.sql @@ -0,0 +1,35 @@ +UPDATE creature_template SET scriptname = "boss_flame_leviathan" WHERE entry = 33113; +UPDATE creature_template SET scriptname = "boss_flame_leviathan_turret" WHERE entry = 33139; +UPDATE creature_template SET scriptname = "boss_flame_leviathan_seat" WHERE entry = 33114; +UPDATE creature_template SET scriptname = "boss_flame_leviathan_defense_turret" WHERE entry = 33142; +UPDATE creature_template SET scriptname = "boss_flame_leviathan_overload_device" WHERE entry = 33143; +UPDATE creature_template SET scriptname = "boss_razorscale" WHERE entry = 33186; + +INSERT INTO creature_template (entry, vehicleid) VALUES +(33113, 340), # Flame Leviathan +(33114, 341) # Flame Leviathan Seat +ON DUPLICATE KEY UPDATE +vehicleid = VALUES(vehicleid); + +UPDATE creature_template SET flags_extra = 128 WHERE entry IN (33114); + +INSERT INTO creature_template (entry, spell1, spell2, spell3, spell4, spell5, spell6, vehicleid) VALUES +(33062, 62974, 62286, 62299, 64660, 0, 0, 335), # Salvaged Chopper +(33109, 62306, 62490, 62308, 62324, 0, 0, 338), # Salvaged Demolisher +(33167, 62634, 64979, 62479, 62471, 0, 62428, 345), # Salvaged Demolisher Mechanic Seat +(33060, 62345, 62522, 62346, 0, 0, 0, 336), # Salvaged Siege Engine +(33067, 62358, 62359, 64677, 0, 0, 0, 337) # Salvaged Siege Turret +ON DUPLICATE KEY UPDATE +spell1 = VALUES(spell1), +spell2 = VALUES(spell2), +spell3 = VALUES(spell3), +spell4 = VALUES(spell4), +spell5 = VALUES(spell5), +spell6 = VALUES(spell6), +vehicleid = VALUES(vehicleid); + +DELETE FROM `spell_script_target` WHERE `entry` IN (62374,62399); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(62374, 1, 33060), # Pursued +(62374, 1, 33109), +(62399, 1, 33139); # Overload Circuit diff --git a/sql/updates/3.1.3_old/4859_8332_01_realmd_realmcharacters.sql b/sql/updates/3.1.3_old/4859_8332_01_realmd_realmcharacters.sql new file mode 100644 index 0000000..c7adb23 --- /dev/null +++ b/sql/updates/3.1.3_old/4859_8332_01_realmd_realmcharacters.sql @@ -0,0 +1,4 @@ +-- ALTER TABLE realmd_db_version CHANGE COLUMN required_7938_01_realmd_account required_8332_01_realmd_realmcharacters bit; + +ALTER TABLE realmcharacters + ADD KEY (acctid); diff --git a/sql/updates/3.1.3_old/4862_world_linked_spell.sql b/sql/updates/3.1.3_old/4862_world_linked_spell.sql new file mode 100644 index 0000000..a892d0a --- /dev/null +++ b/sql/updates/3.1.3_old/4862_world_linked_spell.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (19574,34471); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES +( 19574, 24395, 2, 'Beast Within'), +( 19574, 24396, 2, 'Beast Within'), +( 19574, 24397, 2, 'Beast Within'), +( 19574, 26592, 2, 'Beast Within'), +( 34471, 24395, 2, 'Beast Within'), +( 34471, 24396, 2, 'Beast Within'), +( 34471, 24397, 2, 'Beast Within'), +( 34471, 26592, 2, 'Beast Within'); diff --git a/sql/updates/3.1.3_old/4868_world_scripts.sql b/sql/updates/3.1.3_old/4868_world_scripts.sql new file mode 100644 index 0000000..660d34e --- /dev/null +++ b/sql/updates/3.1.3_old/4868_world_scripts.sql @@ -0,0 +1,57 @@ +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1043000,'At last! Naralex can be awakened! Come aid me, brave adventurers!',0,1,0,0,'Disciple SAY_AT_LAST'), +(-1043001,'I must make the necessary preparations before the awakening ritual can begin. You must protect me!',0,0,0,0,'Disciple SAY_MAKE_PREPARATIONS'), +(-1043002,'These caverns were once a temple of promise for regrowth in the Barrens. Now, they are the halls of nightmares.',0,0,0,0,'Disciple SAY_TEMPLE_OF_PROMISE'), +(-1043003,'Come. We must continue. There is much to be done before we can pull Naralex from his nightmare.',0,0,0,0,'Disciple SAY_MUST_CONTINUE'), +(-1043004,'Within this circle of fire I must cast the spell to banish the spirits of the slain Fanglords.',0,0,0,0,'Disciple SAY_BANISH_THE_SPIRITS'), +(-1043005,'The caverns have been purified. To Naralex\'s chamber we go!',0,0,0,0,'Disciple SAY_CAVERNS_PURIFIED'), +(-1043006,'Beyond this corridor, Naralex lies in fitful sleep. Let us go awaken him before it is too late.',0,0,0,0,'Disciple SAY_BEYOND_THIS_CORRIDOR'), +(-1043007,'Protect me brave souls as I delve into this Emerald Dream to rescue Naralex and put an end to this corruption!',0,0,0,0,'Disciple SAY_EMERALD_DREAM'), +(-1043008,'%s begins to perform the awakening ritual on Naralex.',0,2,0,0,'Disciple EMOTE_AWAKENING_RITUAL'), +(-1043009,'%s tosses fitfully in troubled sleep.',0,2,0,0,'Naralex EMOTE_TROUBLED_SLEEP'), +(-1043010,'%s writhes in agony. The Disciple seems to be breaking through.',0,2,0,0,'Naralex EMOTE_WRITHE_IN_AGONY'), +(-1043011,'%s dreams up a horrendous vision. Something stirs beneath the murky waters.',0,2,0,0,'Naralex EMOTE_HORRENDOUS_VISION'), +(-1043012,'This Mutanus the Devourer is a minion from Naralex\'s nightmare no doubt!',0,0,0,0,'Disciple SAY_MUTANUS_THE_DEVOURER'), +(-1043013,'I AM AWAKE, AT LAST!',0,1,0,0,'Naralex SAY_I_AM_AWAKE'), +(-1043014,'At last! Naralex awakes from the nightmare.',0,0,0,0,'Disciple SAY_NARALEX_AWAKES'), +(-1043015,'Ah, to be pulled from the dreaded nightmare! I thank you, my loyal Disciple, along with your brave companions.',0,0,0,0,'Naralex SAY_THANK_YOU'), +(-1043016,'We must go and gather with the other Disciples. There is much work to be done before I can make another attempt to restore the Barrens. Farewell, brave souls!',0,0,0,0,'Naralex SAY_FAREWELL'), +(-1043017,'Attacked! Help get this $N off of me!',0,0,0,0,'Disciple SAY_ATTACKED'); + +INSERT INTO creature_ai_scripts (creature_id,event_type,event_chance,event_flags,action1_type,action1_param1,action1_param2,comment) VALUES +(3669,6,100,6,34,1,3,'Lord Cobrahn - Set Inst Data on Death'), +(3670,6,100,6,34,2,3,'Lord Pythas - Set Inst Data on Death'), +(3671,6,100,6,34,3,3,'Lady Anacondra - Set Inst Data on Death'), +(3673,6,100,6,34,4,3,'Lord Serpentis - Set Inst Data on Death'), +(3654,6,100,6,34,9,3,'Mutanus the Devourer - Set Inst Data on Death'); + +DELETE FROM script_waypoint WHERE entry=3678; +INSERT INTO script_waypoint VALUES +(3678, 0, -120.864, 132.825, -79.2972, 5000, 'TYPE_NARALEX_EVENT'), +(3678, 1, -109.944, 155.417, -80.4659, 0, ''), +(3678, 2, -106.104, 198.456, -80.5970, 0, ''), +(3678, 3, -110.246, 214.763, -85.6669, 0, ''), +(3678, 4, -105.609, 236.184, -92.1732, 0, 'TYPE_NARALEX_PART1'), +(3678, 5, -93.5297, 227.956, -90.7522, 0, ''), +(3678, 6, -85.3155, 226.976, -93.1286, 0, ''), +(3678, 7, -62.1510, 206.673, -93.5510, 0, ''), +(3678, 8, -45.0534, 205.580, -96.2435, 0, ''), +(3678, 9, -31.1235, 234.225, -94.0841, 0, ''), +(3678, 10, -49.2158, 269.141, -92.8442, 0, ''), +(3678, 11, -54.1220, 274.717, -92.8442, 31000, 'TYPE_NARALEX_PART2'), +(3678, 12, -58.9650, 282.274, -92.5380, 0, ''), +(3678, 13, -38.3566, 306.239, -90.0192, 0, ''), +(3678, 14, -28.8928, 312.842, -89.2155, 0, ''), +(3678, 15, -1.58198, 296.127, -85.5984, 0, ''), +(3678, 16, 9.89992, 272.008, -85.7759, 0, ''), +(3678, 17, 26.8162, 259.218, -87.3938, 0, ''), +(3678, 18, 49.1166, 227.259, -88.3379, 0, ''), +(3678, 19, 54.4171, 209.316, -90.0000, 1500, 'SAY_BEYOND_THIS_CORRIDOR'), +(3678, 20, 71.0380, 205.404, -93.0422, 0, ''), +(3678, 21, 81.5941, 212.832, -93.0154, 0, ''), +(3678, 22, 94.3376, 236.933, -95.8261, 0, ''), +(3678, 23, 114.619, 235.908, -96.0495, 0, ''), +(3678, 24, 114.777, 237.155, -96.0304, 2500, 'NARALEX_EVENT_FINISHED'); + +UPDATE creature_template SET ScriptName = 'npc_disciple_of_naralex' WHERE entry = 3678; +UPDATE instance_template SET script = 'instance_wailing_caverns' WHERE map = 43; diff --git a/sql/updates/3.1.3_old/4869_world_command.sql b/sql/updates/3.1.3_old/4869_world_command.sql new file mode 100644 index 0000000..1c219fa --- /dev/null +++ b/sql/updates/3.1.3_old/4869_world_command.sql @@ -0,0 +1,2 @@ +DELETE FROM `command` WHERE `name` = 'reload autobroadcast'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES ('reload autobroadcast', 3, 'Syntax: .reload autobroadcast\nReload autobroadcast table.'); diff --git a/sql/updates/3.1.3_old/4872_world_scripts.sql b/sql/updates/3.1.3_old/4872_world_scripts.sql new file mode 100644 index 0000000..0b264f2 --- /dev/null +++ b/sql/updates/3.1.3_old/4872_world_scripts.sql @@ -0,0 +1,11 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_skywing' WHERE `entry` = 22424; + +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','0','-3605.719971','4175.580078','-0.031817','0','START_SKYWING'); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','1','-3602.311279','4253.213867','0.562436','0',''); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','2','-3529.151367','4263.524414','-7.871151','0',''); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','3','-3448.130371','4257.990723','-11.626289','0',''); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','4','-3377.783936','4209.064941','-9.476727','0',''); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','5','-3378.211426','4154.628418','0.366330','0',''); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','6','-3376.920166','4085.501709','14.178538','0',''); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','7','-3399.274658','4055.948975','18.603474','0',''); +replace into `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) values('22424','8','-3432.678223','4054.069824','29.588032','10000',''); diff --git a/sql/updates/3.1.3_old/4875_world_scripts.sql b/sql/updates/3.1.3_old/4875_world_scripts.sql new file mode 100644 index 0000000..be29dea --- /dev/null +++ b/sql/updates/3.1.3_old/4875_world_scripts.sql @@ -0,0 +1,20 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_lightwell' WHERE `entry` IN (31883, 31893, 31894, 31895, 31896, 31897); + +REPLACE INTO `npc_spellclick_spells` (npc_entry, spell_id, quest_start, quest_start_active, quest_end, cast_flags, quest_status) VALUES +(31883, 60123, 0, 0, 0, 2, 0), +(31893, 60123, 0, 0, 0, 2, 0), +(31894, 60123, 0, 0, 0, 2, 0), +(31895, 60123, 0, 0, 0, 2, 0), +(31896, 60123, 0, 0, 0, 2, 0), +(31897, 60123, 0, 0, 0, 2, 0); + +REPLACE INTO `spell_bonus_data` (entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus, comments) VALUES +(7001, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 1'), +(27873, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 2'), +(27874, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 3'), +(28276, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 4'), +(48084, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 5'), +(48085, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 6'); + +REPLACE INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(-59907, 7, 0, 'Lightwell Charges - Suicide'); diff --git a/sql/updates/3.1.3_old/4877_world_scripts.sql b/sql/updates/3.1.3_old/4877_world_scripts.sql new file mode 100644 index 0000000..ed53e97 --- /dev/null +++ b/sql/updates/3.1.3_old/4877_world_scripts.sql @@ -0,0 +1,18 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1602018,-1602019,-1602020,-1602021,-1602022,-1602023,-1602024,-1602025,-1602026,-1602027,-1602028,-1602029,-1602030,-1602031); +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1602018,'What hope is there for you? None!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14162,1,0,0,'loken SAY_AGGRO0'), +(-1602019,'I have witnessed the rise and fall of empires. The birth and extinction of entire species. Over countless millennia the foolishness of mortals has remained beyond a constant. Your presence here confirms this.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14160,1,0,0,'loken SAY_INTRO_1'), +(-1602020,'My master has shown me the future, and you have no place in it. Azeroth will be reborn in darkness. Yogg-Saron shall be released! The Pantheon shall fall!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14162,1,0,0,'loken SAY_INTRO_2'), +(-1602021,'Only mortal...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14166,1,0,0,'loken SAY_SLAY_1'), +(-1602022,'I... am... FOREVER!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14167,1,0,0,'loken SAY_SLAY_2'), +(-1602023,'What little time you had, you wasted!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14168,1,0,0,'loken SAY_SLAY_3'), +(-1602024,'My death... heralds the end of this world.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14172,1,0,0,'loken SAY_DEATH'), +(-1602025,'You cannot hide from fate!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14163,1,0,0,'loken SAY_NOVA_1'), +(-1602026,'Come closer. I will make it quick.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14164,1,0,0,'loken SAY_NOVA_2'), +(-1602027,'Your flesh cannot hold out for long.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14165,1,0,0,'loken SAY_NOVA_3'), +(-1602028,'You stare blindly into the abyss!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14169,1,0,0,'loken SAY_75HEALTH'), +(-1602029,'Your ignorance is profound. Can you not see where this path leads?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14170,1,0,0,'loken SAY_50HEALTH'), +(-1602030,'You cross the precipice of oblivion!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14171,1,0,0,'loken SAY_25HEALTH'), +(-1602031,'%s begins to cast Lightning Nova!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,3,0,0,'loken EMOTE_NOVA'); + +UPDATE `creature_template` SET `ScriptName`='boss_loken' WHERE `entry`=28923; diff --git a/sql/updates/3.1.3_old/4879_world_script_texts.sql b/sql/updates/3.1.3_old/4879_world_script_texts.sql new file mode 100644 index 0000000..e300e3c --- /dev/null +++ b/sql/updates/3.1.3_old/4879_world_script_texts.sql @@ -0,0 +1,12 @@ +UPDATE script_texts SET entry=-1609080 WHERE entry=-1609017; +UPDATE script_texts SET entry=-1609081 WHERE entry=-1609018; +UPDATE script_texts SET entry=-1609082 WHERE entry=-1609019; +UPDATE script_texts SET entry=-1609083 WHERE entry=-1609020; +UPDATE script_texts SET entry=-1609084 WHERE entry=-1609021; +UPDATE script_texts SET entry=-1609085 WHERE entry=-1609022; + +DELETE FROM script_texts WHERE entry IN (-1609086,-1609087,-1609088); +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1609086,'The Lich King will see his true champion on this day!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_G'), +(-1609087,'You\'re going down!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_H'), +(-1609088,'You don\'t stand a chance, $n', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'dk_initiate SAY_DUEL_I'); diff --git a/sql/updates/3.1.3_old/4882_world_scripts.sql b/sql/updates/3.1.3_old/4882_world_scripts.sql new file mode 100644 index 0000000..60e8dc8 --- /dev/null +++ b/sql/updates/3.1.3_old/4882_world_scripts.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_slim' WHERE `entry`=19679; +UPDATE `creature_template` SET `ScriptName`='npc_taxi' WHERE `entry` = 23704; diff --git a/sql/updates/3.1.3_old/4888_world_scripts.sql b/sql/updates/3.1.3_old/4888_world_scripts.sql new file mode 100644 index 0000000..dc932bd --- /dev/null +++ b/sql/updates/3.1.3_old/4888_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_skywing' WHERE `entry` = 22424; diff --git a/sql/updates/3.1.3_old/4892_world_script.sql b/sql/updates/3.1.3_old/4892_world_script.sql new file mode 100644 index 0000000..2c95009 --- /dev/null +++ b/sql/updates/3.1.3_old/4892_world_script.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'containment_sphere' WHERE `entry` IN (188527, 188528, 188526); diff --git a/sql/updates/3.1.3_old/4906_world_scripts.sql b/sql/updates/3.1.3_old/4906_world_scripts.sql new file mode 100644 index 0000000..89370b3 --- /dev/null +++ b/sql/updates/3.1.3_old/4906_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `ScriptName` = 'boss_auriaya' WHERE `entry` = 33515; +UPDATE `creature_template` SET `scriptname`='boss_razorscale' WHERE `entry`=33186; +UPDATE `creature_template` SET `scriptname`='boss_flame_leviathan' WHERE `entry`=33113; +UPDATE `creature_template` SET `scriptname`='boss_xt002' WHERE `entry`=33293; +UPDATE `creature_template` SET `scriptname`='boss_ignis' WHERE `entry`=33118; diff --git a/sql/updates/3.1.3_old/4911_world_scripts.sql b/sql/updates/3.1.3_old/4911_world_scripts.sql new file mode 100644 index 0000000..89370b3 --- /dev/null +++ b/sql/updates/3.1.3_old/4911_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `ScriptName` = 'boss_auriaya' WHERE `entry` = 33515; +UPDATE `creature_template` SET `scriptname`='boss_razorscale' WHERE `entry`=33186; +UPDATE `creature_template` SET `scriptname`='boss_flame_leviathan' WHERE `entry`=33113; +UPDATE `creature_template` SET `scriptname`='boss_xt002' WHERE `entry`=33293; +UPDATE `creature_template` SET `scriptname`='boss_ignis' WHERE `entry`=33118; diff --git a/sql/updates/3.1.3_old/4923_world_scripts.sql b/sql/updates/3.1.3_old/4923_world_scripts.sql new file mode 100644 index 0000000..6e7f6fb --- /dev/null +++ b/sql/updates/3.1.3_old/4923_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_skywing' WHERE entry=22424; +UPDATE `creature_template` SET `ScriptName` = 'boss_flame_leviathan_turret' WHERE entry=33139; +UPDATE `creature_template` SET `ScriptName` = 'boss_flame_leviathan_seat' WHERE entry=33114; +UPDATE `creature_template` SET `ScriptName` = 'boss_flame_leviathan_defense_turret' WHERE entry=33142; +UPDATE `creature_template` SET `ScriptName` = 'boss_flame_leviathan_overload_device' WHERE entry=33143; diff --git a/sql/updates/3.1.3_old/4927_world_scripts_naxx.sql b/sql/updates/3.1.3_old/4927_world_scripts_naxx.sql new file mode 100644 index 0000000..c827e8e --- /dev/null +++ b/sql/updates/3.1.3_old/4927_world_scripts_naxx.sql @@ -0,0 +1,2 @@ +DELETE FROM areatrigger_scripts WHERE entry = 4156; +INSERT INTO areatrigger_scripts VALUES (4156, 'at_naxxramas_frostwyrm_wing'); diff --git a/sql/updates/3.1.3_old/4938_world.sql b/sql/updates/3.1.3_old/4938_world.sql new file mode 100644 index 0000000..a76e3b4 --- /dev/null +++ b/sql/updates/3.1.3_old/4938_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN(53352); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(53352, -1, -1, 0.14, -1, 'Hunter - Explosive Shot (triggered)'); diff --git a/sql/updates/3.1.3_old/4939_world_scripts.sql b/sql/updates/3.1.3_old/4939_world_scripts.sql new file mode 100644 index 0000000..8d832e6 --- /dev/null +++ b/sql/updates/3.1.3_old/4939_world_scripts.sql @@ -0,0 +1,27 @@ +DELETE FROM `script_texts` WHERE `entry` between -1602042 AND -1602032; +DELETE FROM `script_texts` WHERE `entry` between -1602017 AND -1602011; +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1602011,'You wish to confront the master? You must weather the storm!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14453,1,0,0,'ionar SAY_AGGRO'), +(-1602012,'Shocking ... I know!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14456,1,0,0,'ionar SAY_SLAY_1'), +(-1602013,'You atempt the unpossible.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14457,1,0,0,'ionar SAY_SLAY_2'), +(-1602014,'Your spark of light is ... extinguish.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14458,1,0,0,'ionar SAY_SLAY_3'), +(-1602015,'Master... you have guests.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14459,1,0,0,'ionar SAY_DEATH'), +(-1602016,'The slightest spark shall be your undoing.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14454,1,0,0,'ionar SAY_SPLIT_1'), +(-1602017,'No one is safe!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,14455,1,0,0,'ionar SAY_SPLIT_2'), +(-1602032,'It is you who have destroyed my children? You... shall... pay!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13960,1,0,0,'volkhan SAY_AGGRO'), +(-1602033,'The armies of iron will conquer all!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13965, 1,0,0,'volkhan SAY_SLAY_1'), +(-1602034,'Ha, pathetic!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13966,1,0,0,'volkhan SAY_SLAY_2'), +(-1602035,'You have cost me too much work!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13967,1,0,0,'volkhan SAY_SLAY_3'), +(-1602036,'The master was right... to be concerned.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13968,1,0,0,'volkhan SAY_DEATH'), +(-1602037,'I will crush you beneath my boots!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13963,1,0,0,'volkhan SAY_STOMP_1'), +(-1602038,'All my work... undone!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13964,1,0,0,'volkhan SAY_STOMP_2'), +(-1602039,'Life from the lifelessness... death for you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13961,1,0,0,'volkhan SAY_FORGE_1'), +(-1602040,'Nothing is wasted in the process. You will see....', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,13962,1,0,0,'volkhan SAY_FORGE_2'), +(-1602041,'runs to his anvil!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,3,0,0,'volkhan EMOTE_TO_ANVIL'), +(-1602042,'prepares to shatter his Brittle Golems!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,3,0,0,'volkhan EMOTE_SHATTER'); + +UPDATE creature_template SET ScriptName='boss_volkhan' WHERE entry=28587; +UPDATE creature_template SET ScriptName='mob_molten_golem' WHERE entry=28695; +UPDATE creature_template SET ScriptName='npc_volkhan_anvil' WHERE entry=28823; +UPDATE creature_template SET ScriptName='boss_ionar' WHERE entry=28546; +UPDATE creature_template SET ScriptName='mob_spark_of_ionar' WHERE entry=28926; diff --git a/sql/updates/3.1.3_old/4944_world.sql b/sql/updates/3.1.3_old/4944_world.sql new file mode 100644 index 0000000..cc1c26f --- /dev/null +++ b/sql/updates/3.1.3_old/4944_world.sql @@ -0,0 +1,50 @@ +DELETE FROM script_waypoint WHERE entry=11856; +INSERT INTO script_waypoint VALUES +(11856, 0, 113.91, -350.13, 4.55, 0, ''), +(11856, 1, 109.54, -350.08, 3.74, 0, ''), +(11856, 2, 106.95, -353.40, 3.60, 0, ''), +(11856, 3, 100.28, -338.89, 2.97, 0, ''), +(11856, 4, 110.11, -320.26, 3.47, 0, ''), +(11856, 5, 109.78, -287.80, 5.30, 0, ''), +(11856, 6, 105.02, -269.71, 4.71, 0, ''), +(11856, 7, 86.71, -251.81, 5.34, 0, ''), +(11856, 8, 64.10, -246.38, 5.91, 0, ''), +(11856, 9, -2.55, -243.58, 6.3, 0, ''), +(11856, 10, -27.78, -267.53, -1.08, 0, ''), +(11856, 11, -31.27, -283.54, -4.36, 0, ''), +(11856, 12, -28.96, -322.44, -9.19, 0, ''), +(11856, 13, -35.63, -360.03, -16.59, 0, ''), +(11856, 14, -58.30, -412.26, -30.60, 0, ''), +(11856, 15, -58.88, -474.17, -44.54, 0, ''), +(11856, 16, -45.92, -496.57, -46.26, 5000, 'AMBUSH'), +(11856, 17, -40.25, -510.07, -46.05, 0, ''), +(11856, 18, -38.88, -520.72, -46.06, 5000, 'END'); + +DELETE FROM script_waypoint WHERE entry=28912; +INSERT INTO script_waypoint VALUES +(28912, 0, 1653.518, -6038.374, 127.585, 0, 'Jump off'), +(28912, 1, 1653.978, -6034.614, 127.585, 5000, 'To Box'), +(28912, 2, 1653.854, -6034.726, 127.585, 500, 'Equip'), +(28912, 3, 1652.297, -6035.671, 127.585, 3000, 'Recover'), +(28912, 4, 1639.762, -6046.343, 127.948, 0, 'Escape'), +(28912, 5, 1640.963, -6028.119, 134.740, 0, ''), +(28912, 6, 1625.805, -6029.197, 134.740, 0, ''), +(28912, 7, 1626.845, -6015.085, 134.740, 0, ''), +(28912, 8, 1649.150, -6016.975, 133.240, 0, ''), +(28912, 9, 1653.063, -5974.844, 132.652, 5000, 'Mount'), +(28912, 10, 1654.747, -5926.424, 121.191, 0, 'Disappear'); + +UPDATE creature_template SET ScriptName='npc_koltira_deathweaver' WHERE entry=28912; + +DELETE FROM `script_texts` WHERE `entry` between -1609098 AND -1609089; +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1609089, 'I\'ll need to get my runeblade and armor... Just need a little more time.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,399,'koltira SAY_BREAKOUT1'), +(-1609090, 'I\'m still weak, but I think I can get an anti-magic barrier up. Stay inside it or you\'ll be destroyed by their spells.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'koltira SAY_BREAKOUT2'), +(-1609091, 'Maintaining this barrier will require all of my concentration. Kill them all!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,16,'koltira SAY_BREAKOUT3'), +(-1609092, 'There are more coming. Defend yourself! Don\'t fall out of the anti-magic field! They\'ll tear you apart without its protection!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'koltira SAY_BREAKOUT4'), +(-1609093, 'I can\'t keep barrier up much longer... Where is that coward?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'koltira SAY_BREAKOUT5'), +(-1609094, 'The High Inquisitor comes! Be ready, death knight! Do not let him draw you out of the protective bounds of my anti-magic field! Kill him and take his head!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'koltira SAY_BREAKOUT6'), +(-1609095, 'Stay in the anti-magic field! Make them come to you!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'koltira SAY_BREAKOUT7'), +(-1609096, 'The death of the High Inquisitor of New Avalon will not go unnoticed. You need to get out of here at once! Go, before more of them show up. I\'ll be fine on my own.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'koltira SAY_BREAKOUT8'), +(-1609097, 'I\'ll draw their fire, you make your escape behind me.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,0,0,0,'koltira SAY_BREAKOUT9'), +(-1609098, 'Your High Inquisitor is nothing more than a pile of meat, Crusaders! There are none beyond the grasp of the Scourge!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,0,1,0,0,'koltira SAY_BREAKOUT10'); diff --git a/sql/updates/3.1.3_old/4945_mangos_8339_characters.sql b/sql/updates/3.1.3_old/4945_mangos_8339_characters.sql new file mode 100644 index 0000000..e21c6d3 --- /dev/null +++ b/sql/updates/3.1.3_old/4945_mangos_8339_characters.sql @@ -0,0 +1,23 @@ +ALTER TABLE characters DROP COLUMN bgid; +ALTER TABLE characters DROP COLUMN bgteam; +ALTER TABLE characters DROP COLUMN bgmap; +ALTER TABLE characters DROP COLUMN bgx; +ALTER TABLE characters DROP COLUMN bgy; +ALTER TABLE characters DROP COLUMN bgz; +ALTER TABLE characters DROP COLUMN bgo; + +DROP TABLE IF EXISTS `character_battleground_data`; +CREATE TABLE `character_battleground_data` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `instance_id` int(11) unsigned NOT NULL default '0', + `team` int(11) unsigned NOT NULL default '0', + `join_x` float NOT NULL default '0', + `join_y` float NOT NULL default '0', + `join_z` float NOT NULL default '0', + `join_o` float NOT NULL default '0', + `join_map` int(11) NOT NULL default '0', + `taxi_start` int(11) NOT NULL default '0', + `taxi_end` int(11) NOT NULL default '0', + `mount_spell` int(11) NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; diff --git a/sql/updates/3.1.3_old/4959_world.sql b/sql/updates/3.1.3_old/4959_world.sql new file mode 100644 index 0000000..cfcebe7 --- /dev/null +++ b/sql/updates/3.1.3_old/4959_world.sql @@ -0,0 +1,17 @@ +UPDATE creature_template SET ScriptName='' WHERE entry=13936; + +DELETE FROM areatrigger_scripts WHERE entry=3066; +INSERT INTO areatrigger_scripts VALUES (3066,'at_ravenholdt'); + +DELETE FROM script_waypoint WHERE entry=16812; +INSERT INTO script_waypoint VALUES +(16812, 0, -10868.260, -1779.836, 90.476, 2500, 'Open door, begin walking'), +(16812, 1, -10875.585, -1779.581, 90.478, 0, ''), +(16812, 2, -10887.447, -1779.258, 90.476, 0, ''), +(16812, 3, -10894.592, -1780.668, 90.476, 0, ''), +(16812, 4, -10895.015, -1782.036, 90.476, 2500, 'Begin Speech after this'), +(16812, 5, -10894.592, -1780.668, 90.476, 0, 'Resume walking (back to spawn point now) after speech'), +(16812, 6, -10887.447, -1779.258, 90.476, 0, ''), +(16812, 7, -10875.585, -1779.581, 90.478, 0, ''), +(16812, 8, -10868.260, -1779.836, 90.476, 5000, 'close door'), +(16812, 9, -10866.799, -1780.958, 90.470, 2000, 'Summon mobs, open curtains'); diff --git a/sql/updates/3.1.3_old/4968_world_8361_spell_bonus_data.sql b/sql/updates/3.1.3_old/4968_world_8361_spell_bonus_data.sql new file mode 100644 index 0000000..da386bc --- /dev/null +++ b/sql/updates/3.1.3_old/4968_world_8361_spell_bonus_data.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_bonus_data` WHERE `entry`=40293; +INSERT INTO `spell_bonus_data` VALUES +(40293, 0, 0, 0, 0, 'Item - Siphon Essence'); diff --git a/sql/updates/3.1.3_old/4972_world_scripts.sql b/sql/updates/3.1.3_old/4972_world_scripts.sql new file mode 100644 index 0000000..db07cfd --- /dev/null +++ b/sql/updates/3.1.3_old/4972_world_scripts.sql @@ -0,0 +1 @@ +UPDATE gameobject_template SET ScriptName='go_gong_of_bethekk' WHERE entry=180526; diff --git a/sql/updates/3.1.3_old/4982_world_spell_area.sql b/sql/updates/3.1.3_old/4982_world_spell_area.sql new file mode 100644 index 0000000..4b0a8be --- /dev/null +++ b/sql/updates/3.1.3_old/4982_world_spell_area.sql @@ -0,0 +1 @@ +update spell_area set gender=2 where spell in (33836,50426,46023,52693); diff --git a/sql/updates/3.1.3_old/4994_world_script.sql b/sql/updates/3.1.3_old/4994_world_script.sql new file mode 100644 index 0000000..6b13edd --- /dev/null +++ b/sql/updates/3.1.3_old/4994_world_script.sql @@ -0,0 +1,4 @@ +/* Oculus: "Just for the logic, shouldn't be necessary": */ +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=23035 AND `comment` LIKE 'Anzu%Death'; +INSERT INTO `creature_ai_scripts` (`creature_id`,`event_type`,`event_chance`,`event_flags`,`action1_type`,`action1_param1`,`action1_param2`,`comment`) VALUES +(23035,6,100,6,34,2,3,'Anzu - Set Inst Data on Death'); diff --git a/sql/updates/3.1.3_old/4996_script_texts.sql b/sql/updates/3.1.3_old/4996_script_texts.sql new file mode 100644 index 0000000..a5a192f --- /dev/null +++ b/sql/updates/3.1.3_old/4996_script_texts.sql @@ -0,0 +1,2 @@ +DELETE FROM `npc_text` WHERE id IN (30000,30001); +INSERT INTO `npc_text` (`ID`, `text0_0`, `text0_1`, `lang0`, `prob0`, `em0_0`, `em0_1`, `em0_2`, `em0_3`, `em0_4`, `em0_5`, `text1_0`, `text1_1`, `lang1`, `prob1`, `em1_0`, `em1_1`, `em1_2`, `em1_3`, `em1_4`, `em1_5`, `text2_0`, `text2_1`, `lang2`, `prob2`, `em2_0`, `em2_1`, `em2_2`, `em2_3`, `em2_4`, `em2_5`, `text3_0`, `text3_1`, `lang3`, `prob3`, `em3_0`, `em3_1`, `em3_2`, `em3_3`, `em3_4`, `em3_5`, `text4_0`, `text4_1`, `lang4`, `prob4`, `em4_0`, `em4_1`, `em4_2`, `em4_3`, `em4_4`, `em4_5`, `text5_0`, `text5_1`, `lang5`, `prob5`, `em5_0`, `em5_1`, `em5_2`, `em5_3`, `em5_4`, `em5_5`, `text6_0`, `text6_1`, `lang6`, `prob6`, `em6_0`, `em6_1`, `em6_2`, `em6_3`, `em6_4`, `em6_5`, `text7_0`, `text7_1`, `lang7`, `prob7`, `em7_0`, `em7_1`, `em7_2`, `em7_3`, `em7_4`, `em7_5`) VALUES ('30000', 'Here you will find the Inscription Trainer.', 'Here you will find the Inscription Trainer.', '0', '1', '0', '0', '0', '0', '0', '0', 'So you want to be a Inscriber? Well here you will find the trainer.', 'So you want to be a Inscriber? Well here you will find the trainer.', '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0'), ('30001', 'So you are looking for a Inscription Trainer? Well you can\'t find the trainer out here, better head to the nearest city.\r\n', 'So you are looking for a Inscription Trainer? Well you can\'t find the trainer out here, better head to the nearest city.\r\n', '0', '0', '0', '0', '0', '0', '0', '0', 'So you want to be a Inscriber? Well you can\'t find the trainer out here, better head to the nearest city.', 'So you want to be a Inscriber? Well you can\'t find the trainer out here, better head to the nearest city.', '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0', null, null, '0', '0', '0', '0', '0', '0', '0', '0'); diff --git a/sql/updates/3.1.3_old/4999_world_scripts.sql b/sql/updates/3.1.3_old/4999_world_scripts.sql new file mode 100644 index 0000000..b987532 --- /dev/null +++ b/sql/updates/3.1.3_old/4999_world_scripts.sql @@ -0,0 +1,33 @@ +DELETE FROM script_waypoint WHERE entry=10427; +INSERT INTO script_waypoint VALUES +(10427, 0, -5185.463, -1185.927, 45.951, 0, ''), +(10427, 1, -5184.880, -1154.210, 45.035, 0, ''), +(10427, 2, -5175.880, -1126.526, 43.701, 0, ''), +(10427, 3, -5138.651, -1111.874, 44.024, 0, ''), +(10427, 4, -5134.728, -1104.796, 47.365, 0, ''), +(10427, 5, -5129.681, -1097.878, 49.449, 2500, ''), +(10427, 6, -5125.303, -1080.572, 47.033, 0, ''), +(10427, 7, -5146.668, -1053.694, 28.415, 0, ''), +(10427, 8, -5147.463, -1027.539, 13.818, 0, ''), +(10427, 9, -5139.238, -1018.889, 8.220, 0, ''), +(10427, 10, -5121.168, -1013.126, -0.619, 0, ''), +(10427, 11, -5091.919, -1014.205, -4.902, 0, ''), +(10427, 12, -5069.240, -994.299, -4.631, 0, ''), +(10427, 13, -5059.975, -944.112, -5.377, 0, ''), +(10427, 14, -5013.546, -906.184, -5.490, 0, ''), +(10427, 15, -4992.461, -920.983, -4.980, 5000, 'SAY_WYVERN'), +(10427, 16, -4976.355, -1002.997, -5.380, 0, ''), +(10427, 17, -4958.478, -1033.185, -5.433, 0, ''), +(10427, 18, -4953.353, -1052.211, -10.836, 0, ''), +(10427, 19, -4937.447, -1056.351, -22.139, 0, ''), +(10427, 20, -4908.455, -1050.433, -33.458, 0, ''), +(10427, 21, -4905.530, -1056.885, -33.722, 0, ''), +(10427, 22, -4920.830, -1073.284, -45.515, 0, ''), +(10427, 23, -4933.368, -1082.700, -50.186, 0, ''), +(10427, 24, -4935.313, -1092.353, -52.785, 0, ''), +(10427, 25, -4929.553, -1101.268, -50.637, 0, ''), +(10427, 26, -4920.679, -1100.028, -51.944, 10000, 'SAY_COMPLETE'), +(10427, 27, -4920.679, -1100.028, -51.944, 0, 'quest complete'); + +UPDATE `creature_template` SET `ScriptName`='npc_paoka_swiftmountain' WHERE `entry`=10427; +UPDATE `creature_template` SET `ScriptName`='npc_lakota_windsong' WHERE `entry`=10646; diff --git a/sql/updates/3.1.3_old/5001_world_scripts.sql b/sql/updates/3.1.3_old/5001_world_scripts.sql new file mode 100644 index 0000000..37a4a86 --- /dev/null +++ b/sql/updates/3.1.3_old/5001_world_scripts.sql @@ -0,0 +1,112 @@ +UPDATE creature_template SET ScriptName='npc_gilthares' WHERE entry=3465; + +DELETE FROM script_waypoint WHERE entry=3465; +INSERT INTO script_waypoint VALUES +(3465, 0, -2095.840820, -3650.001221, 61.716, 0, ''), +(3465, 1, -2100.193604, -3613.949219, 61.604, 0, ''), +(3465, 2, -2098.549561, -3601.557129, 59.154, 0, ''), +(3465, 3, -2093.796387, -3595.234375, 56.658, 0, ''), +(3465, 4, -2072.575928, -3578.827637, 48.844, 0, ''), +(3465, 5, -2023.858398, -3568.146240, 24.636, 0, ''), +(3465, 6, -2013.576416, -3571.499756, 22.203, 0, ''), +(3465, 7, -2009.813721, -3580.547852, 21.791, 0, ''), +(3465, 8, -2015.296021, -3597.387695, 21.760, 0, ''), +(3465, 9, -2020.677368, -3610.296143, 21.759, 0, ''), +(3465, 10, -2019.990845, -3640.155273, 21.759, 0, ''), +(3465, 11, -2016.110596, -3664.133301, 21.758, 0, ''), +(3465, 12, -1999.397095, -3679.435059, 21.316, 0, ''), +(3465, 13, -1987.455811, -3688.309326, 18.495, 0, ''), +(3465, 14, -1973.966553, -3687.666748, 14.996, 0, ''), +(3465, 15, -1949.163940, -3678.054932, 11.293, 0, ''), +(3465, 16, -1934.091187, -3682.859619, 9.897, 30000, 'SAY_GIL_AT_LAST'), +(3465, 17, -1935.383911, -3682.322021, 10.029, 1500, 'SAY_GIL_PROCEED'), +(3465, 18, -1879.039185, -3699.498047, 6.582, 7500, 'SAY_GIL_FREEBOOTERS'), +(3465, 19, -1852.728149, -3703.778809, 6.875, 0, ''), +(3465, 20, -1812.989990, -3718.500732, 10.572, 0, ''), +(3465, 21, -1788.171265, -3722.867188, 9.663, 0, ''), +(3465, 22, -1767.206665, -3739.923096, 10.082, 0, ''), +(3465, 23, -1750.194580, -3747.392090, 10.390, 0, ''), +(3465, 24, -1729.335571, -3776.665527, 11.779, 0, ''), +(3465, 25, -1715.997925, -3802.404541, 12.618, 0, ''), +(3465, 26, -1690.711548, -3829.262451, 13.905, 0, ''), +(3465, 27, -1674.700684, -3842.398682, 13.872, 0, ''), +(3465, 28, -1632.726318, -3846.109619, 14.401, 0, ''), +(3465, 29, -1592.734497, -3842.225342, 14.981, 0, ''), +(3465, 30, -1561.614746, -3839.320801, 19.118, 0, ''), +(3465, 31, -1544.567627, -3834.393311, 18.761, 0, ''), +(3465, 32, -1512.514404, -3831.715820, 22.914, 0, ''), +(3465, 33, -1486.889771, -3836.639893, 23.964, 0, ''), +(3465, 34, -1434.193604, -3852.702881, 18.843, 0, ''), +(3465, 35, -1405.794678, -3854.488037, 17.276, 0, ''), +(3465, 36, -1366.592041, -3852.383789, 19.273, 0, ''), +(3465, 37, -1337.360962, -3837.827148, 17.352, 2000, 'SAY_GIL_ALMOST'), +(3465, 38, -1299.744507, -3810.691406, 20.801, 0, ''), +(3465, 39, -1277.144409, -3782.785156, 25.918, 0, ''), +(3465, 40, -1263.686768, -3781.251953, 26.447, 0, ''), +(3465, 41, -1243.674438, -3786.328125, 25.281, 0, ''), +(3465, 42, -1221.875488, -3784.124512, 24.051, 0, ''), +(3465, 43, -1204.011230, -3775.943848, 24.437, 0, ''), +(3465, 44, -1181.706787, -3768.934082, 23.368, 0, ''), +(3465, 45, -1156.913818, -3751.559326, 21.074, 0, ''), +(3465, 46, -1138.830688, -3741.809326, 17.843, 0, ''), +(3465, 47, -1080.101196, -3738.780029, 19.805, 0, 'SAY_GIL_SWEET'), +(3465, 48, -1069.065186, -3735.006348, 19.302, 0, ''), +(3465, 49, -1061.941040, -3724.062256, 21.086, 0, ''), +(3465, 50, -1053.593262, -3697.608643, 27.320, 0, ''), +(3465, 51, -1044.110474, -3690.133301, 24.856, 0, ''), +(3465, 52, -1040.260986, -3690.739014, 25.342, 0, ''), +(3465, 53, -1028.146606, -3688.718750, 23.843, 7500, 'SAY_GIL_FREED'); + +DELETE FROM script_waypoint WHERE entry=21027; +INSERT INTO script_waypoint VALUES +(21027, 0, -2714.697266, 1326.879395, 34.306953, 0, ''), +(21027, 1, -2666.364990, 1348.222656, 34.445557, 0, ''), +(21027, 2, -2693.789307, 1336.964966, 34.445557, 0, ''), +(21027, 3, -2715.495361, 1328.054443, 34.106014, 0, ''), +(21027, 4, -2742.530762, 1314.138550, 33.606144, 0, ''), +(21027, 5, -2745.077148, 1311.108765, 33.630898, 0, ''), +(21027, 6, -2749.855225, 1302.737915, 33.475632, 0, ''), +(21027, 7, -2753.639648, 1294.059448, 33.314930, 0, ''), +(21027, 8, -2756.796387, 1285.122192, 33.391262, 0, ''), +(21027, 9, -2750.042969, 1273.661987, 33.188259, 0, ''), +(21027, 10, -2740.378418, 1258.846680, 33.212521, 0, ''), +(21027, 11, -2733.629395, 1248.259766, 33.640598, 0, ''), +(21027, 12, -2727.212646, 1238.606445, 33.520847, 0, ''), +(21027, 13, -2726.377197, 1237.264526, 33.461823, 3000, 'SAY_WIL_PROGRESS1'), +(21027, 14, -2746.383301, 1266.390625, 33.191952, 2000, ''), +(21027, 15, -2746.383301, 1266.390625, 33.191952, 4000, 'SAY_WIL_FIND_EXIT'), +(21027, 16, -2758.927734, 1285.134155, 33.341728, 0, ''), +(21027, 17, -2761.845703, 1292.313599, 33.209042, 0, ''), +(21027, 18, -2758.871826, 1300.677612, 33.285332, 0, ''), +(21027, 19, -2753.928955, 1307.755859, 33.452457, 0, ''), +(21027, 20, -2738.612061, 1316.191284, 33.482975, 0, ''), +(21027, 21, -2727.897461, 1320.013916, 33.381111, 0, ''), +(21027, 22, -2709.458740, 1315.739990, 33.301838, 0, ''), +(21027, 23, -2704.658936, 1301.620361, 32.463303, 0, ''), +(21027, 24, -2704.120117, 1298.922607, 32.768162, 0, ''), +(21027, 25, -2691.798340, 1292.846436, 33.852642, 0, ''), +(21027, 26, -2682.879639, 1288.853882, 32.995399, 0, ''), +(21027, 27, -2661.869141, 1279.682495, 26.686783, 0, ''), +(21027, 28, -2648.943604, 1270.272827, 24.147522, 0, ''), +(21027, 29, -2642.506836, 1262.938721, 23.512444, 0, ''), +(21027, 30, -2636.984863, 1252.429077, 20.418257, 0, ''), +(21027, 31, -2648.113037, 1224.984863, 8.691818, 0, ''), +(21027, 32, -2658.393311, 1200.136719, 5.492243, 0, ''), +(21027, 33, -2668.504395, 1190.450562, 3.127407, 0, ''), +(21027, 34, -2685.930420, 1174.360840, 5.163924, 0, ''), +(21027, 35, -2701.613770, 1160.026367, 5.611311, 0, ''), +(21027, 36, -2714.659668, 1149.980347, 4.342373, 0, ''), +(21027, 37, -2721.443359, 1145.002808, 1.913474, 0, ''), +(21027, 38, -2733.962158, 1143.436279, 2.620415, 0, ''), +(21027, 39, -2757.876709, 1146.937500, 6.184002, 2000, 'SAY_WIL_JUST_AHEAD'), +(21027, 40, -2772.300537, 1166.052734, 6.331811, 0, ''), +(21027, 41, -2790.265381, 1189.941650, 5.207958, 0, ''), +(21027, 42, -2805.448975, 1208.663940, 5.557623, 0, ''), +(21027, 43, -2820.617676, 1225.870239, 6.266103, 0, ''), +(21027, 44, -2831.926758, 1237.725830, 5.808506, 0, ''), +(21027, 45, -2842.578369, 1252.869629, 6.807481, 0, ''), +(21027, 46, -2846.344971, 1258.727295, 7.386168, 0, ''), +(21027, 47, -2847.556396, 1266.771729, 8.208790, 0, ''), +(21027, 48, -2841.654541, 1285.809204, 7.933223, 0, ''), +(21027, 49, -2841.754883, 1289.832520, 6.990304, 0, ''), +(21027, 50, -2871.398438, 1302.348145, 6.807335, 7500, 'SAY_WIL_END'); diff --git a/sql/updates/3.1.3_old/5006_world.sql b/sql/updates/3.1.3_old/5006_world.sql new file mode 100644 index 0000000..e33ed3c --- /dev/null +++ b/sql/updates/3.1.3_old/5006_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (57352); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(57352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00051154, 0x00000000, 0, 0, 45); -- Darkmoon Card: Death diff --git a/sql/updates/3.1.3_old/5009_world.sql b/sql/updates/3.1.3_old/5009_world.sql new file mode 100644 index 0000000..0ce32dd --- /dev/null +++ b/sql/updates/3.1.3_old/5009_world.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_ebon_gargoyle' WHERE `entry`=27829; diff --git a/sql/updates/3.1.3_old/5009_world_TDB.sql b/sql/updates/3.1.3_old/5009_world_TDB.sql new file mode 100644 index 0000000..01d5af6 --- /dev/null +++ b/sql/updates/3.1.3_old/5009_world_TDB.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `spell1`=51963 WHERE `entry`=27829; diff --git a/sql/updates/3.1.3_old/5009_world_scripts.sql b/sql/updates/3.1.3_old/5009_world_scripts.sql new file mode 100644 index 0000000..732614d --- /dev/null +++ b/sql/updates/3.1.3_old/5009_world_scripts.sql @@ -0,0 +1,16 @@ +UPDATE `creature_template` SET `ScriptName`='npc_akuno' WHERE `entry`=22377; + +DELETE FROM `script_waypoint` WHERE `entry`=22377; +INSERT INTO `script_waypoint` VALUES +(22377, 0, -2766.31, 5429.65, -34.53, 0, ''), +(22377, 1, -2769.35, 5416.25, -34.53, 0, ''), +(22377, 2, -2780.07, 5416.06, -34.53, 1000, ''), +(22377, 3, -2812.56, 5415.20, -34.53, 1000, ''), +(22377, 4, -2816.95, 5415.02, -34.52, 0, ''), +(22377, 5, -2827.86, 5414.56, -28.29, 0, ''), +(22377, 6, -2878.32, 5414.11, -28.26, 0, ''), +(22377, 7, -2893.17, 5413.15, -18.59, 0, ''), +(22377, 8, -2896.36, 5409.65, -18.59, 0, ''), +(22377, 9, -2896.50, 5396.76, -8.77, 0, ''), +(22377, 10, -2896.67, 5366.20, -9.59, 0, ''), +(22377, 11, -2888.23, 5330.39, -11.19, 2000, ''); diff --git a/sql/updates/3.1.3_old/5012_world_scripts.sql b/sql/updates/3.1.3_old/5012_world_scripts.sql new file mode 100644 index 0000000..fa3b6e7 --- /dev/null +++ b/sql/updates/3.1.3_old/5012_world_scripts.sql @@ -0,0 +1,18 @@ +DELETE FROM script_waypoint WHERE entry=18731; +INSERT INTO script_waypoint VALUES +(18731, 0, -157.366, 2.177, 8.073, 0, ''), +(18731, 1, -172.266, -18.280, 8.073, 0, ''), +(18731, 2, -171.051, -38.748, 8.073, 0, ''), +(18731, 3, -170.718, -59.436, 8.073, 0, ''), +(18731, 4, -156.659, -72.118, 8.073, 0, ''), +(18731, 5, -142.292, -59.423, 8.073, 0, ''), +(18731, 6, -141.779, -38.972, 8.073, 0, ''), +(18731, 7, -142.922, -18.950, 8.073, 0, ''), +(18731, 8, -157.366, 2.177, 8.073, 0, ''); + +DELETE FROM script_waypoint WHERE entry=2768 AND pointid IN (0, 18); +INSERT INTO script_waypoint VALUES +(2768, 0, -2077.73, -2091.17, 9.49, 0, ''), +(2768, 18, -2077.73, -2091.17, 9.49, 0, ''); + +UPDATE creature_template SET ScriptName='npc_tooga' WHERE entry=5955; diff --git a/sql/updates/3.1.3_old/5015_world_scripts.sql b/sql/updates/3.1.3_old/5015_world_scripts.sql new file mode 100644 index 0000000..db817c5 --- /dev/null +++ b/sql/updates/3.1.3_old/5015_world_scripts.sql @@ -0,0 +1,32 @@ +UPDATE gameobject_template SET ScriptName='go_shadowforge_brazier' WHERE entry IN (174744, 174745); + +UPDATE creature_template SET ScriptName='' WHERE entry IN (9034, 9035, 9036, 9038, 9040); + +UPDATE creature_template SET ScriptName='npc_rinji' WHERE entry=7780; + +DELETE FROM script_waypoint WHERE entry=7780; +INSERT INTO script_waypoint VALUES +(7780, 0, 261.058868, -2757.876221, 122.553, 0, ''), +(7780, 1, 259.812195, -2758.249023, 122.555, 0, 'SAY_RIN_FREE'), +(7780, 2, 253.823441, -2758.619141, 122.562, 0, ''), +(7780, 3, 241.394791, -2769.754883, 123.309, 0, ''), +(7780, 4, 218.915588, -2783.397461, 123.355, 0, ''), +(7780, 5, 209.088196, -2789.676270, 122.001, 0, ''), +(7780, 6, 204.453568, -2792.205811, 120.620, 0, ''), +(7780, 7, 182.012604, -2809.995361, 113.887, 0, 'summon'), +(7780, 8, 164.411591, -2825.162842, 107.779, 0, ''), +(7780, 9, 149.727600, -2833.704346, 106.224, 0, ''), +(7780, 10, 142.448074, -2838.807373, 109.665, 0, ''), +(7780, 11, 133.274963, -2845.135254, 112.606, 0, ''), +(7780, 12, 111.247459, -2861.065674, 116.305, 0, ''), +(7780, 13, 96.104073, -2874.886230, 114.397, 0, 'summon'), +(7780, 14, 73.369942, -2881.184570, 117.666, 0, ''), +(7780, 15, 58.579178, -2889.151611, 116.253, 0, ''), +(7780, 16, 33.214249, -2906.343994, 115.083, 0, ''), +(7780, 17, 19.586519, -2908.712402, 117.276, 7500, 'SAY_RIN_COMPLETE'), +(7780, 18, 10.282522, -2911.607422, 118.394, 0, ''), +(7780, 19, -37.580383, -2942.730225, 117.145, 0, ''), +(7780, 20, -68.599411, -2953.694824, 116.685, 0, ''), +(7780, 21, -102.054253, -2956.965576, 116.677, 0, ''), +(7780, 22, -135.993637, -2955.743652, 115.788, 0, ''), +(7780, 23, -171.561600, -2951.417480, 115.451, 0, ''); diff --git a/sql/updates/3.1.3_old/5016_world_scripts.sql b/sql/updates/3.1.3_old/5016_world_scripts.sql new file mode 100644 index 0000000..c3b928c --- /dev/null +++ b/sql/updates/3.1.3_old/5016_world_scripts.sql @@ -0,0 +1,7 @@ +UPDATE creature_template SET ScriptName='npc_kanati' WHERE entry=10638; + +DELETE FROM script_waypoint WHERE entry=10638; +INSERT INTO script_waypoint VALUES +(10638, 0, -4903.521973, -1368.339844, -52.611, 5000, 'SAY_KAN_START'), +(10638, 1, -4906.004395, -1367.048096, -52.611, 0, ''); + diff --git a/sql/updates/3.1.3_old/5020_world_scripts.sql b/sql/updates/3.1.3_old/5020_world_scripts.sql new file mode 100644 index 0000000..6ce3fe8 --- /dev/null +++ b/sql/updates/3.1.3_old/5020_world_scripts.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName='npc_private_hendel' WHERE entry=4966; diff --git a/sql/updates/3.1.3_old/5021_8364_world_db_version.sql b/sql/updates/3.1.3_old/5021_8364_world_db_version.sql new file mode 100644 index 0000000..b7d4323 --- /dev/null +++ b/sql/updates/3.1.3_old/5021_8364_world_db_version.sql @@ -0,0 +1,2 @@ +ALTER TABLE version + ADD COLUMN cache_id int(10) default '0' AFTER script_version; diff --git a/sql/updates/3.1.3_old/5023_world_scripts.sql b/sql/updates/3.1.3_old/5023_world_scripts.sql new file mode 100644 index 0000000..e753174 --- /dev/null +++ b/sql/updates/3.1.3_old/5023_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE creature_template SET ScriptName='npc_orsonn_and_kodian' WHERE entry IN (27274, 27275); + +UPDATE creature_template SET ScriptName='npc_fizzcrank_fullthrottle' WHERE entry=25590; + +UPDATE creature_template SET ScriptName='npc_arete' WHERE entry=29344; diff --git a/sql/updates/3.1.3_old/5029_world_trinity_string.sql b/sql/updates/3.1.3_old/5029_world_trinity_string.sql new file mode 100644 index 0000000..65817b0 --- /dev/null +++ b/sql/updates/3.1.3_old/5029_world_trinity_string.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default` = 'Race: %s Class: %s Played time: %s Level: %u Money: %ug%us%uc' WHERE `entry` = 549; diff --git a/sql/updates/3.1.3_old/5031_world_scripts_netherspite.sql b/sql/updates/3.1.3_old/5031_world_scripts_netherspite.sql new file mode 100644 index 0000000..c98bedc --- /dev/null +++ b/sql/updates/3.1.3_old/5031_world_scripts_netherspite.sql @@ -0,0 +1,14 @@ +UPDATE `creature_template` SET `ScriptName`='boss_netherspite', `RegenHealth` = '1' WHERE `entry`='15689'; +UPDATE `creature_template` SET `faction_A` = '35', `faction_H` = '35', `modelid_A`='11686', `modelid_H`='11686', `unit_flags` = '33554496', `ScriptName` = '' WHERE `entry` IN ('17367','17368','17369'); +UPDATE `creature_template` SET `minlevel` = '70', `maxlevel` = '70',`flags_extra`= '2', `speed`= '0.0001', `faction_A` = '16', `faction_H` = '16', `ScriptName` = 'mob_eventai' WHERE `entry` = '16697'; +DELETE FROM `creature_ai_scripts` WHERE `creature_id` = '16697'; +INSERT INTO `creature_ai_scripts` +(`id`,`creature_id`,`event_type`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action1_type`,`action1_param1`,`action1_param2`,`action1_param3`,`comment`) VALUES +('1669701', '16697', '0', '100', '3', '3000', '3000', '3000', '3000', '11', '46264', '0', '2','Void Zone - Cast Void Zone Effect'), +('1669702', '16697', '1', '100', '3', '3000', '3000', '3000', '3000', '11', '46264', '0', '2','Void Zone - Cast Void Zone Effect'); +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN ('-30421','-30422','-30423','38637','38638','38639'); +INSERT INTO `spell_linked_spell`(`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +('-30421','38637','0','Netherspite\'s Perseverence'), +('-30422','38638','0','Netherspite\'s Serenity'), +('-30423','38639','0','Netherspite\'s Dominance'); +UPDATE `script_texts` SET `type` = '3' WHERE `entry` IN ('-1532089','-1532090'); diff --git a/sql/updates/3.1.3_old/5036_character_updates_dual_spec.sql b/sql/updates/3.1.3_old/5036_character_updates_dual_spec.sql new file mode 100644 index 0000000..5454204 --- /dev/null +++ b/sql/updates/3.1.3_old/5036_character_updates_dual_spec.sql @@ -0,0 +1,59 @@ + +START TRANSACTION; /* Transaction is used due to the destructive nature of these queries, if anything fails the transaction should abort, and the updates should be applied manually. */ + +CREATE TABLE `character_glyphs` ( + `guid` int(11) unsigned NOT NULL, + `spec` tinyint(3) unsigned NOT NULL DEFAULT '0', + `glyph1` int(11) unsigned NOT NULL DEFAULT '0', + `glyph2` int(11) unsigned DEFAULT '0', + `glyph3` int(11) unsigned DEFAULT '0', + `glyph4` int(11) unsigned DEFAULT '0', + `glyph5` int(11) unsigned DEFAULT '0', + `glyph6` int(11) unsigned DEFAULT '0', + PRIMARY KEY (`guid`,`spec`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Get glyphs from correct field in data blob and insert into character_glyphs as spec = 0 +INSERT INTO `character_glyphs` +SELECT `guid`, 0, +(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1288), ' ', -1) AS UNSIGNED)) AS `glyph1`, +(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1289), ' ', -1) AS UNSIGNED)) AS `glyph2`, +(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1290), ' ', -1) AS UNSIGNED)) AS `glyph3`, +(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1291), ' ', -1) AS UNSIGNED)) AS `glyph4`, +(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1292), ' ', -1) AS UNSIGNED)) AS `glyph5`, +(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1293), ' ', -1) AS UNSIGNED)) AS `glyph6` +FROM `characters`; + +CREATE TABLE `character_talent` ( + `guid` int(11) unsigned NOT NULL, + `spell` int(11) unsigned NOT NULL, + `spec` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`guid`,`spell`,`spec`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/* Drethek - This should be all talents without major rank of learned spells: */ +DELETE FROM `character_spell` WHERE `spell` IN (724,974,1329,5570,5923,5924,5925,5926,5952,9452,9453,9799,10060,11069,11070,11071,11078,11080,11083,11094,11095,11100,11103,11108,11113,11115,11119,11120,11124,11129,11151,11160,11170,11175,11180,11185,11189,11190,11207,11210,11213,11222,11232,11237,11242,11247,11252,11255,11366,11367,11368,11426,11958,12042,12043,12163,12281,12282,12284,12285,12286,12287,12289,12290,12292,12294,12295,12296,12297,12298,12299,12300,12301,12308,12311,12312,12313,12317,12318,12319,12320,12321,12322,12323,12324,12328,12329,12330,12338,12339,12340,12341,12349,12350,12351,12353,12357,12358,12378,12398,12399,12400,12463,12464,12467,12469,12472,12473,12487,12488,12489,12490,12496,12497,12500,12501,12502,12503,12518,12519,12569,12571,12574,12575,12576,12577,12592,12598,12605,12606,12658,12663,12664,12665,12666,12668,12672,12676,12677,12697,12700,12701,12702,12703,12704,12711,12712,12724,12725,12726,12727,12750,12751,12752,12753,12761,12762,12763,12764,12781,12783,12784,12785,12797,12799,12803,12804,12809,12810,12811,12812,12813,12814,12815,12818,12834,12835,12839,12840,12846,12847,12848,12849,12852,12853,12855,12856,12857,12858,12860,12861,12862,12867,12872,12873,12876,12877,12878,12879,12950,12952,12953,12958,12959,12960,12963,12971,12972,12973,12974,12975,12982,12983,12999,13000,13001,13002,13043,13045,13046,13047,13048,13705,13706,13709,13712,13713,13715,13732,13733,13741,13742,13743,13750,13754,13788,13789,13792,13793,13800,13801,13802,13803,13804,13805,13806,13807,13832,13843,13844,13845,13848,13849,13851,13852,13853,13854,13863,13865,13866,13867,13872,13875,13877,13958,13960,13961,13962,13963,13964,13970,13971,13975,13976,13979,13980,13981,13983,14057,14062,14063,14066,14070,14071,14072,14076,14079,14080,14082,14083,14094,14113,14114,14115,14116,14117,14128,14132,14135,14136,14137,14138,14139,14140,14141,14142,14144,14148,14156,14158,14159,14160,14161,14162,14163,14164,14165,14166,14168,14169,14171,14172,14173,14174,14175,14176,14177,14179,14183,14185,14186,14190,14193,14194,14195,14251,14278,14520,14521,14522,14523,14531,14747,14748,14749,14750,14751,14767,14768,14769,14770,14771,14772,14774,14776,14777,14780,14781,14784,14785,14788,14789,14790,14791,14889,14892,14898,14901,14908,14909,14910,14911,14912,14913,14983,15008,15009,15010,15011,15012,15013,15014,15017,15018,15020,15028,15029,15030,15031,15047,15058,15059,15060,15257,15259,15260,15270,15272,15273,15274,15275,15286,15307,15308,15309,15310,15311,15312,15313,15314,15316,15317,15318,15320,15327,15328,15331,15332,15335,15336,15337,15338,15349,15354,15355,15356,15362,15363,15392,15407,15448,15473,15487,16035,16038,16039,16040,16041,16043,16086,16089,16105,16106,16107,16108,16109,16110,16111,16112,16113,16114,16115,16116,16130,16160,16161,16164,16166,16173,16176,16178,16179,16180,16181,16182,16184,16187,16188,16190,16194,16196,16198,16205,16206,16209,16210,16211,16212,16213,16214,16215,16216,16217,16218,16219,16220,16221,16222,16223,16224,16225,16226,16227,16228,16229,16230,16232,16235,16240,16252,16254,16255,16256,16258,16259,16261,16262,16266,16268,16271,16272,16281,16282,16283,16284,16287,16290,16293,16295,16302,16303,16304,16305,16306,16307,16308,16309,16462,16463,16464,16465,16466,16487,16489,16492,16493,16494,16511,16513,16514,16515,16538,16539,16540,16541,16542,16544,16578,16579,16580,16581,16582,16757,16758,16763,16765,16766,16769,16770,16814,16815,16816,16817,16818,16819,16820,16821,16822,16833,16834,16835,16836,16839,16840,16845,16846,16847,16850,16858,16859,16860,16861,16862,16864,16880,16896,16897,16899,16909,16910,16911,16912,16913,16923,16924,16929,16930,16931,16934,16935,16936,16937,16938,16940,16941,16942,16943,16944,16947,16948,16949,16966,16968,16972,16974,16975,16998,16999,17002,17003,17004,17005,17006,17007,17050,17051,17056,17058,17059,17060,17061,17063,17065,17066,17069,17070,17071,17072,17073,17074,17075,17076,17077,17078,17104,17106,17107,17108,17111,17112,17113,17116,17118,17119,17120,17123,17124,17191,17322,17323,17364,17485,17486,17487,17488,17489,17778,17779,17780,17783,17784,17785,17788,17789,17790,17791,17792,17793,17796,17801,17802,17803,17804,17805,17810,17811,17812,17813,17814,17815,17833,17834,17877,17917,17918,17927,17929,17930,17954,17955,17956,17957,17958,17959,17962,18073,18094,18095,18096,18119,18120,18126,18127,18130,18135,18136,18174,18175,18176,18179,18180,18182,18183,18213,18218,18219,18220,18223,18271,18272,18273,18274,18275,18288,18372,18427,18428,18429,18459,18460,18462,18463,18464,18530,18531,18533,18534,18535,18551,18552,18553,18554,18555,18562,18692,18693,18694,18695,18696,18697,18698,18699,18703,18704,18705,18706,18707,18708,18709,18710,18731,18743,18744,18754,18755,18756,18767,18768,18769,18770,18771,18772,18773,18827,18829,19028,19159,19160,19168,19180,19181,19184,19236,19255,19256,19257,19258,19259,19286,19287,19290,19294,19295,19297,19298,19306,19370,19371,19373,19376,19386,19387,19388,19407,19412,19416,19417,19418,19419,19420,19421,19422,19423,19426,19427,19429,19430,19431,19434,19454,19455,19456,19461,19462,19464,19465,19466,19485,19487,19488,19489,19490,19498,19499,19500,19503,19506,19507,19508,19509,19549,19550,19551,19552,19553,19554,19555,19556,19559,19560,19572,19573,19574,19575,19577,19578,19583,19584,19585,19586,19587,19590,19592,19598,19599,19600,19601,19602,19609,19610,19612,19616,19617,19618,19619,19620,19621,19622,19623,19624,19625,20042,20045,20049,20056,20057,20060,20061,20062,20063,20064,20066,20096,20097,20098,20099,20100,20101,20102,20103,20104,20105,20111,20112,20113,20117,20118,20119,20120,20121,20127,20130,20135,20138,20139,20140,20143,20144,20145,20146,20147,20174,20175,20177,20179,20180,20181,20182,20196,20197,20198,20205,20206,20207,20208,20209,20210,20212,20213,20214,20215,20216,20224,20225,20234,20235,20237,20238,20239,20243,20244,20245,20254,20255,20256,20257,20258,20259,20260,20261,20262,20263,20264,20265,20266,20330,20331,20332,20335,20336,20337,20359,20360,20361,20375,20468,20469,20470,20473,20487,20488,20496,20500,20501,20502,20503,20504,20505,20711,20895,20911,20925,23584,23585,23586,23587,23588,23695,23785,23822,23823,23824,23825,23881,23989,24283,24296,24297,24443,24691,24858,24866,24894,24943,24944,24945,24946,24968,24969,24970,24971,24972,25829,25836,25956,25957,25988,26016,26022,26023,27789,27790,27811,27815,27816,27839,27840,27900,27901,27902,27903,27904,28332,28574,28592,28593,28996,28997,28998,28999,29000,29062,29064,29065,29074,29075,29076,29079,29080,29082,29084,29086,29140,29143,29144,29179,29180,29187,29189,29191,29192,29193,29202,29205,29206,29438,29439,29440,29441,29444,29447,29590,29591,29592,29593,29594,29598,29599,29623,29721,29723,29724,29725,29759,29760,29761,29762,29763,29776,29787,29790,29792,29801,29834,29836,29838,29859,29888,29889,30054,30057,30060,30061,30062,30063,30064,30108,30143,30144,30145,30146,30160,30242,30245,30246,30247,30248,30283,30288,30289,30290,30291,30292,30293,30295,30296,30299,30301,30302,30319,30320,30321,30326,30664,30665,30666,30672,30673,30674,30675,30678,30679,30706,30798,30802,30808,30809,30812,30813,30814,30816,30818,30819,30823,30864,30865,30866,30867,30868,30869,30872,30873,30881,30883,30884,30885,30886,30892,30893,30894,30895,30902,30903,30904,30905,30906,30919,30920,31122,31123,31124,31126,31130,31131,31208,31209,31211,31212,31213,31216,31217,31218,31219,31220,31221,31222,31223,31226,31227,31228,31229,31230,31244,31245,31380,31382,31383,31569,31570,31571,31572,31574,31575,31579,31582,31583,31584,31585,31586,31587,31588,31589,31638,31639,31640,31641,31642,31656,31657,31658,31661,31667,31668,31669,31670,31672,31674,31675,31676,31677,31678,31679,31680,31682,31683,31687,31785,31821,31822,31823,31825,31826,31828,31829,31830,31833,31835,31836,31837,31838,31839,31840,31841,31842,31844,31845,31848,31849,31850,31851,31852,31858,31859,31860,31866,31867,31868,31869,31871,31872,31876,31877,31878,31879,31880,31881,31935,32043,32381,32382,32383,32385,32387,32392,32393,32394,32477,32483,32484,32601,33142,33145,33146,33150,33154,33158,33159,33160,33161,33162,33167,33171,33172,33186,33190,33191,33192,33193,33201,33202,33206,33213,33214,33215,33221,33222,33223,33224,33225,33371,33589,33590,33591,33592,33596,33597,33599,33600,33601,33602,33603,33604,33605,33606,33607,33776,33831,33851,33852,33853,33855,33856,33859,33866,33867,33872,33873,33879,33880,33881,33882,33883,33886,33887,33888,33889,33890,33917,33956,33957,34151,34152,34153,34293,34295,34296,34297,34300,34453,34454,34455,34459,34460,34462,34464,34465,34466,34467,34468,34469,34470,34475,34476,34482,34483,34484,34485,34486,34487,34488,34489,34490,34491,34492,34493,34494,34496,34497,34498,34499,34500,34502,34503,34506,34507,34508,34692,34753,34838,34839,34859,34860,34861,34908,34909,34910,34914,34935,34938,34939,34948,34949,34950,34954,35029,35030,35100,35102,35104,35110,35111,35363,35364,35395,35396,35397,35446,35448,35449,35541,35550,35551,35552,35553,35578,35581,35691,35692,35693,36554,37116,37117,43338,44378,44379,44394,44395,44396,44397,44398,44399,44400,44402,44403,44404,44425,44442,44443,44445,44446,44448,44449,44457,44469,44470,44471,44472,44543,44545,44546,44548,44549,44557,44560,44561,44566,44567,44568,44570,44571,44572,44745,45234,45243,45244,46854,46855,46859,46860,46865,46866,46867,46908,46909,46910,46911,46913,46914,46915,46917,46924,46945,46949,46951,46952,46953,46968,47193,47195,47196,47197,47198,47199,47200,47201,47202,47203,47204,47205,47220,47221,47223,47230,47231,47236,47237,47238,47239,47240,47245,47246,47247,47258,47259,47260,47266,47267,47268,47269,47270,47294,47295,47296,47507,47508,47509,47511,47515,47516,47517,47535,47536,47537,47540,47558,47559,47560,47562,47564,47565,47566,47567,47569,47570,47573,47577,47578,47580,47581,47582,47585,47586,47587,47588,47788,48181,48384,48389,48392,48393,48395,48396,48409,48410,48411,48412,48432,48433,48434,48438,48483,48484,48485,48488,48489,48491,48492,48494,48495,48496,48499,48500,48505,48506,48510,48511,48514,48516,48521,48525,48532,48535,48536,48537,48539,48544,48545,48962,48963,48965,48977,48978,48979,48982,48985,48987,48988,48997,49004,49005,49006,49013,49015,49016,49018,49023,49024,49027,49028,49032,49036,49039,49042,49137,49140,49143,49145,49146,49149,49158,49175,49182,49184,49186,49188,49189,49194,49200,49202,49203,49206,49208,49217,49219,49220,49222,49223,49224,49226,49377,49390,49391,49392,49393,49394,49395,49455,49467,49471,49477,49478,49479,49480,49483,49488,49489,49490,49491,49495,49497,49500,49501,49503,49504,49508,49509,49526,49529,49530,49533,49534,49538,49542,49543,49562,49564,49565,49567,49568,49571,49572,49588,49589,49599,49610,49611,49627,49628,49631,49632,49633,49635,49636,49638,49654,49655,49657,49661,49662,49663,49664,49786,49787,49788,49789,49790,49791,49796,50029,50031,50033,50034,50040,50041,50043,50115,50117,50118,50119,50120,50121,50127,50128,50129,50130,50137,50138,50147,50149,50150,50151,50152,50154,50187,50190,50191,50334,50365,50371,50384,50385,50391,50392,50516,50685,50686,50687,50720,50796,50880,50884,50885,50886,50887,51052,51099,51108,51109,51123,51127,51128,51129,51130,51160,51161,51166,51167,51179,51180,51181,51182,51183,51267,51268,51269,51271,51456,51459,51462,51463,51464,51465,51466,51468,51470,51472,51473,51474,51478,51479,51480,51481,51482,51483,51485,51486,51490,51521,51522,51523,51524,51525,51526,51527,51528,51529,51530,51531,51532,51533,51554,51555,51556,51557,51558,51560,51561,51562,51563,51564,51565,51566,51625,51626,51627,51628,51629,51632,51633,51634,51635,51636,51662,51664,51665,51667,51668,51669,51672,51674,51679,51682,51685,51686,51687,51688,51689,51690,51692,51696,51698,51700,51701,51708,51709,51710,51711,51712,51713,51745,51746,51881,51883,51884,51885,51886,52143,52456,52783,52785,52786,52787,52788,52795,52797,52798,52799,52800,52802,52803,53137,53138,53209,53215,53216,53217,53221,53222,53224,53228,53232,53234,53237,53238,53241,53243,53244,53245,53246,53252,53253,53256,53259,53260,53262,53263,53264,53265,53270,53290,53291,53292,53295,53296,53297,53298,53299,53301,53302,53303,53304,53375,53376,53379,53380,53381,53382,53385,53484,53486,53488,53501,53502,53503,53519,53527,53530,53551,53552,53553,53556,53557,53563,53569,53576,53583,53585,53590,53591,53592,53595,53620,53621,53622,53648,53660,53661,53671,53673,53695,53696,53709,53710,53711,53754,53759,54037,54038,54117,54118,54151,54154,54155,54347,54348,54349,54354,54486,54488,54489,54490,54637,54638,54639,54646,54658,54659,54734,54747,54749,54787,55050,55061,55062,55090,55091,55092,55094,55107,55108,55129,55130,55131,55132,55133,55136,55198,55225,55226,55233,55236,55237,55339,55340,55610,55620,55623,55666,55667,56314,56315,56316,56317,56318,56333,56336,56337,56339,56340,56341,56342,56343,56344,56611,56612,56613,56614,56636,56637,56638,56822,56834,56835,56924,56927,56929,56930,56931,56932,57470,57472,57499,57810,57811,57812,57813,57814,57849,57850,57851,57865,57873,57876,57877,57878,57880,57881,58410,58413,58414,58415,58422,58423,58424,58425,58426,58435,58872,58874,59057,59088,59089,59672,59738,59739,59740,59741,60103,60184,60185,60187,60188,60970,61154,61155,61156,61157,61158,61216,61221,61222,61295,61329,61330,61331,61336,61345,61346,62097,62098,62099,62100,62101,62905,62908,63108,63117,63121,63123,63156,63158,63245,63349,63350,63351,63370,63372,63373,63374,63410,63411,63457,63458,63503,63504,63505,63506,63534,63542,63543,63560,63574,63625,63626,63627,63646,63647,63648,63649,63650,63730,63733,63737,64044,64127,64129,64205,64353,64357,64976,65139,65661,66191,66192,66799,66814,66815,66816,66817); + +/* XTElite1 - Talents that teach an initial skill, and you learn higher ranks from a trainer. Here's a cleanup query that will remove all those: */ +DELETE FROM `character_spell` WHERE `spell` IN (12505,12522,12523,12524,12525,12526,13018,13019,13020,13021,13031,13032,13033,16979,17311,17312,17313,17314,17347,17348,18807,18809,18867,18868,18869,18870,18871,18937,18938,19238,19240,19241,19242,19243,20900,20901,20902,20903,20904,20909,20910,21551,21552,21553,24132,24133,24974,24975,24976,24977,25248,25387,25437,26864,27013,27065,27067,27068,27132,27133,27134,27263,27265,27870,27871,28275,30016,30022,30330,30404,30405,30413,30414,30546,32593,32594,33041,33042,33043,33405,33876,33878,33933,33938,33982,33983,33986,33987,34411,34412,34413,34863,34864,34865,34866,34916,34917,42890,42891,42944,42945,42949,42950,43038,43039,44780,44781,47485,47486,47497,47498,47826,47827,47841,47843,47846,47847,48086,48087,48088,48089,48155,48156,48159,48160,48172,48173,48468,48563,48564,48565,48566,48660,48663,48666,48998,48999,49011,49012,49049,49050,49283,49284,49376,53005,53006,53007,53199,53200,53201,53223,53225,53226,53227,53248,53249,53251,55359,55360,57720,57721,57722,59092,59156,59158,59159,59161,59163,59164,59170,59171,59172,60051,60052,60053,61299,61300,61301,61384); + +/* Machiavelli & Nonox - Some missed talents: */ +DELETE FROM `character_spell` WHERE `spell` IN (3674,5420,9800,19263,20927,20928,20929,20930,24905,27174,27179,31904,32699,32700,33072,33891,34123,48359,48824,48825,48826,48827,48951,48952,50170,50171,50172,50306,50536,51373,51374,51375,51376,51378,51379,52881,53640,55265,55270,55271,57019,57224,62795,63668,63669,63670,63671,63672,64299,65139); + +ALTER TABLE `characters` ADD `speccount` tinyint(3) unsigned NOT NULL default 1 AFTER `arena_pending_points`; +ALTER TABLE `characters` ADD `activespec` tinyint(3) unsigned NOT NULL default 0 AFTER `speccount`; + +ALTER TABLE `character_action` RENAME `character_action_old`; +CREATE TABLE `character_action` ( + `guid` int(11) unsigned NOT NULL default '0', + `spec` tinyint(3) unsigned NOT NULL default '0', + `button` tinyint(3) unsigned NOT NULL default '0', + `action` int(11) unsigned NOT NULL default '0', + `type` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`,`spec`,`button`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO `character_action` (`guid`,`button`,`action`,`type`) SELECT `guid`,`button`,`action`,`type` FROM `character_action_old`; +DROP TABLE `character_action_old`; + + +COMMIT; diff --git a/sql/updates/3.1.3_old/5036_world_updates_dual_spec.sql b/sql/updates/3.1.3_old/5036_world_updates_dual_spec.sql new file mode 100644 index 0000000..3aab06f --- /dev/null +++ b/sql/updates/3.1.3_old/5036_world_updates_dual_spec.sql @@ -0,0 +1,3 @@ + +UPDATE `npc_option` SET `id`=52,`action`=19 WHERE `id`=51 AND `action`=18 AND `option_text`='UNIT_NPC_FLAG_OUTDOORPVP'; +INSERT INTO `npc_option` (`id`, `gossip_id`, `npcflag`, `icon`, `action`, `box_money`, `coded`, `option_text`, `box_text`) values('51','0','16','2','18','10000000','0','Purchase a Dual Talent Specialization.','Are you sure you wish to purchase a Dual Talent Specialization?'); diff --git a/sql/updates/3.1.3_old/5071_world_scripts.sql b/sql/updates/3.1.3_old/5071_world_scripts.sql new file mode 100644 index 0000000..dc085cf --- /dev/null +++ b/sql/updates/3.1.3_old/5071_world_scripts.sql @@ -0,0 +1,3 @@ +UPDATE script_texts SET comment='core rager EMOTE_LOWHP' WHERE entry=-1409002; + +UPDATE creature_template SET ScriptName='npc_naladu' WHERE entry=19361; diff --git a/sql/updates/3.1.3_old/5083_world_scripts_dk.sql b/sql/updates/3.1.3_old/5083_world_scripts_dk.sql new file mode 100644 index 0000000..4ef1ed1 --- /dev/null +++ b/sql/updates/3.1.3_old/5083_world_scripts_dk.sql @@ -0,0 +1,10 @@ +DELETE FROM `npc_spellclick_spells` WHERE `spell_id` IN (52447); +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`) VALUES +(28833, 52447, 12701, 1, 12701, 1); -- Scarlet Cannon Master + +UPDATE creature_template SET spell1=52435,spell2=52576,spell5=52588,VehicleId=79,speed=0 WHERE entry = 28833; +UPDATE `creature_template` SET vehicleid=138 WHERE (`entry`='28817'); + +UPDATE `gameobject_template` SET `ScriptName`='go_inconspicuous_mine_car' WHERE (`entry`='190767'); +UPDATE `creature_template` SET `ScriptName`='npc_scarlet_miner_cart' WHERE (`entry`='28817'); +UPDATE `creature_template` SET `ScriptName`='npc_scarlet_miner' WHERE (`entry`='28841'); diff --git a/sql/updates/3.1.3_old/5092_world_scripts.sql b/sql/updates/3.1.3_old/5092_world_scripts.sql new file mode 100644 index 0000000..bd95351 --- /dev/null +++ b/sql/updates/3.1.3_old/5092_world_scripts.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName='npc_tracy_proudwell' WHERE entry=18266; diff --git a/sql/updates/3.1.3_old/5093_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5093_world_spell_proc_event.sql new file mode 100644 index 0000000..8a7fc5e --- /dev/null +++ b/sql/updates/3.1.3_old/5093_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry`IN(44546, 44548, 44549); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 44546, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Brain Freeze (Rank 1) +( 44548, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Brain Freeze (Rank 2) +( 44549, 0x00, 3, 0x00100220, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Brain Freeze (Rank 3) diff --git a/sql/updates/3.1.3_old/5096_world_scripts.sql b/sql/updates/3.1.3_old/5096_world_scripts.sql new file mode 100644 index 0000000..37bf49f --- /dev/null +++ b/sql/updates/3.1.3_old/5096_world_scripts.sql @@ -0,0 +1,12 @@ +UPDATE creature_template SET ScriptName='npc_tapoke_slim_jahn' WHERE entry=4962; +UPDATE creature_template SET ScriptName='npc_mikhail' WHERE entry=4963; + +DELETE FROM script_waypoint WHERE entry=4962; +INSERT INTO script_waypoint VALUES +(4962, 0, -3804.438965, -828.048035, 10.093068, 0, ''), +(4962, 1, -3803.934326, -835.772400, 10.077722, 0, ''), +(4962, 2, -3792.629150, -835.670898, 9.655657, 0, ''), +(4962, 3, -3772.433838, -835.345947, 10.868981, 0, ''), +(4962, 4, -3765.937256, -840.128601, 10.885593, 0, ''), +(4962, 5, -3738.633789, -830.997498, 11.057384, 0, ''), +(4962, 6, -3690.224121, -862.261597, 9.960449, 0, ''); diff --git a/sql/updates/3.1.3_old/5097_character_updates_dual_spec.sql b/sql/updates/3.1.3_old/5097_character_updates_dual_spec.sql new file mode 100644 index 0000000..13f5f4b --- /dev/null +++ b/sql/updates/3.1.3_old/5097_character_updates_dual_spec.sql @@ -0,0 +1,13 @@ + +/* Begin intentional error */ +"Run 5097_character_updates_dual_spec.sql manually, or don't run it at all. This is only intended for people who need to clean up missed skills from r5036. If you never used r5036 - 5096, ignore this. Tell your users to reset their talents (or just switch specs) to fix their talent points."; + +/* + +-- Drethek - This should be all talents without a learned spell as a major rank: +DELETE FROM `character_spell` WHERE `spell` IN (724,974,1329,5570,5923,5924,5925,5926,5952,9452,9453,9799,10060,11069,11070,11071,11078,11080,11083,11094,11095,11100,11103,11108,11113,11115,11119,11120,11124,11129,11151,11160,11170,11175,11180,11185,11189,11190,11207,11210,11213,11222,11232,11237,11242,11247,11252,11255,11366,11367,11368,11426,11958,12042,12043,12163,12281,12282,12284,12285,12286,12287,12289,12290,12292,12294,12295,12296,12297,12298,12299,12300,12301,12308,12311,12312,12313,12317,12318,12319,12320,12321,12322,12323,12324,12328,12329,12330,12338,12339,12340,12341,12349,12350,12351,12353,12357,12358,12378,12398,12399,12400,12463,12464,12467,12469,12472,12473,12487,12488,12489,12490,12496,12497,12500,12501,12502,12503,12518,12519,12569,12571,12574,12575,12576,12577,12592,12598,12605,12606,12658,12663,12664,12665,12666,12668,12672,12676,12677,12697,12700,12701,12702,12703,12704,12711,12712,12724,12725,12726,12727,12750,12751,12752,12753,12761,12762,12763,12764,12781,12783,12784,12785,12797,12799,12803,12804,12809,12810,12811,12812,12813,12814,12815,12818,12834,12835,12839,12840,12846,12847,12848,12849,12852,12853,12855,12856,12857,12858,12860,12861,12862,12867,12872,12873,12876,12877,12878,12879,12950,12952,12953,12958,12959,12960,12963,12971,12972,12973,12974,12975,12982,12983,12999,13000,13001,13002,13043,13045,13046,13047,13048,13705,13706,13709,13712,13713,13715,13732,13733,13741,13742,13743,13750,13754,13788,13789,13792,13793,13800,13801,13802,13803,13804,13805,13806,13807,13832,13843,13844,13845,13848,13849,13851,13852,13853,13854,13863,13865,13866,13867,13872,13875,13877,13958,13960,13961,13962,13963,13964,13970,13971,13975,13976,13979,13980,13981,13983,14057,14062,14063,14066,14070,14071,14072,14076,14079,14080,14082,14083,14094,14113,14114,14115,14116,14117,14128,14132,14135,14136,14137,14138,14139,14140,14141,14142,14144,14148,14156,14158,14159,14160,14161,14162,14163,14164,14165,14166,14168,14169,14171,14172,14173,14174,14175,14176,14177,14179,14183,14185,14186,14190,14193,14194,14195,14251,14278,14520,14521,14522,14523,14531,14747,14748,14749,14750,14751,14767,14768,14769,14770,14771,14772,14774,14776,14777,14780,14781,14784,14785,14788,14789,14790,14791,14889,14892,14898,14901,14908,14909,14910,14911,14912,14913,14983,15008,15009,15010,15011,15012,15013,15014,15017,15018,15020,15028,15029,15030,15031,15047,15058,15059,15060,15257,15259,15260,15270,15272,15273,15274,15275,15286,15307,15308,15309,15310,15311,15312,15313,15314,15316,15317,15318,15320,15327,15328,15331,15332,15335,15336,15337,15338,15349,15354,15355,15356,15362,15363,15392,15407,15448,15473,15487,16035,16038,16039,16040,16041,16043,16086,16089,16105,16106,16107,16108,16109,16110,16111,16112,16113,16114,16115,16116,16130,16160,16161,16164,16166,16173,16176,16178,16179,16180,16181,16182,16184,16187,16188,16190,16194,16196,16198,16205,16206,16209,16210,16211,16212,16213,16214,16215,16216,16217,16218,16219,16220,16221,16222,16223,16224,16225,16226,16227,16228,16229,16230,16232,16235,16240,16252,16254,16255,16256,16258,16259,16261,16262,16266,16268,16271,16272,16281,16282,16283,16284,16287,16290,16293,16295,16302,16303,16304,16305,16306,16307,16308,16309,16462,16463,16464,16465,16466,16487,16489,16492,16493,16494,16511,16513,16514,16515,16538,16539,16540,16541,16542,16544,16578,16579,16580,16581,16582,16757,16758,16763,16765,16766,16769,16770,16814,16815,16816,16817,16818,16819,16820,16821,16822,16833,16834,16835,16836,16839,16840,16845,16846,16847,16850,16858,16859,16860,16861,16862,16864,16880,16896,16897,16899,16909,16910,16911,16912,16913,16923,16924,16929,16930,16931,16934,16935,16936,16937,16938,16940,16941,16942,16943,16944,16947,16948,16949,16966,16968,16972,16974,16975,16998,16999,17002,17003,17004,17005,17006,17007,17050,17051,17056,17058,17059,17060,17061,17063,17065,17066,17069,17070,17071,17072,17073,17074,17075,17076,17077,17078,17104,17106,17107,17108,17111,17112,17113,17116,17118,17119,17120,17123,17124,17191,17322,17323,17364,17485,17486,17487,17488,17489,17778,17779,17780,17783,17784,17785,17788,17789,17790,17791,17792,17793,17796,17801,17802,17803,17804,17805,17810,17811,17812,17813,17814,17815,17833,17834,17877,17917,17918,17927,17929,17930,17954,17955,17956,17957,17958,17959,17962,18073,18094,18095,18096,18119,18120,18126,18127,18130,18135,18136,18174,18175,18176,18179,18180,18182,18183,18213,18218,18219,18220,18223,18271,18272,18273,18274,18275,18288,18372,18427,18428,18429,18459,18460,18462,18463,18464,18530,18531,18533,18534,18535,18551,18552,18553,18554,18555,18562,18692,18693,18694,18695,18696,18697,18698,18699,18703,18704,18705,18706,18707,18708,18709,18710,18731,18743,18744,18754,18755,18756,18767,18768,18769,18770,18771,18772,18773,18827,18829,19028,19159,19160,19168,19180,19181,19184,19236,19255,19256,19257,19258,19259,19286,19287,19290,19294,19295,19297,19298,19306,19370,19371,19373,19376,19386,19387,19388,19407,19412,19416,19417,19418,19419,19420,19421,19422,19423,19426,19427,19429,19430,19431,19434,19454,19455,19456,19461,19462,19464,19465,19466,19485,19487,19488,19489,19490,19498,19499,19500,19503,19506,19507,19508,19509,19549,19550,19551,19552,19553,19554,19555,19556,19559,19560,19572,19573,19574,19575,19577,19578,19583,19584,19585,19586,19587,19590,19592,19598,19599,19600,19601,19602,19609,19610,19612,19616,19617,19618,19619,19620,19621,19622,19623,19624,19625,20042,20045,20049,20056,20057,20060,20061,20062,20063,20064,20066,20096,20097,20098,20099,20100,20101,20102,20103,20104,20105,20111,20112,20113,20117,20118,20119,20120,20121,20127,20130,20135,20138,20139,20140,20143,20144,20145,20146,20147,20174,20175,20177,20179,20180,20181,20182,20196,20197,20198,20205,20206,20207,20208,20209,20210,20212,20213,20214,20215,20216,20224,20225,20234,20235,20237,20238,20239,20243,20244,20245,20254,20255,20256,20257,20258,20259,20260,20261,20262,20263,20264,20265,20266,20330,20331,20332,20335,20336,20337,20359,20360,20361,20375,20468,20469,20470,20473,20487,20488,20496,20500,20501,20502,20503,20504,20505,20711,20895,20911,20925,23584,23585,23586,23587,23588,23695,23785,23822,23823,23824,23825,23881,23989,24283,24296,24297,24443,24691,24858,24866,24894,24943,24944,24945,24946,24968,24969,24970,24971,24972,25829,25836,25956,25957,25988,26016,26022,26023,27789,27790,27811,27815,27816,27839,27840,27900,27901,27902,27903,27904,28332,28574,28592,28593,28996,28997,28998,28999,29000,29062,29064,29065,29074,29075,29076,29079,29080,29082,29084,29086,29140,29143,29144,29179,29180,29187,29189,29191,29192,29193,29202,29205,29206,29438,29439,29440,29441,29444,29447,29590,29591,29592,29593,29594,29598,29599,29623,29721,29723,29724,29725,29759,29760,29761,29762,29763,29776,29787,29790,29792,29801,29834,29836,29838,29859,29888,29889,30054,30057,30060,30061,30062,30063,30064,30108,30143,30144,30145,30146,30160,30242,30245,30246,30247,30248,30283,30288,30289,30290,30291,30292,30293,30295,30296,30299,30301,30302,30319,30320,30321,30326,30664,30665,30666,30672,30673,30674,30675,30678,30679,30706,30798,30802,30808,30809,30812,30813,30814,30816,30818,30819,30823,30864,30865,30866,30867,30868,30869,30872,30873,30881,30883,30884,30885,30886,30892,30893,30894,30895,30902,30903,30904,30905,30906,30919,30920,31122,31123,31124,31126,31130,31131,31208,31209,31211,31212,31213,31216,31217,31218,31219,31220,31221,31222,31223,31226,31227,31228,31229,31230,31244,31245,31380,31382,31383,31569,31570,31571,31572,31574,31575,31579,31582,31583,31584,31585,31586,31587,31588,31589,31638,31639,31640,31641,31642,31656,31657,31658,31661,31667,31668,31669,31670,31672,31674,31675,31676,31677,31678,31679,31680,31682,31683,31687,31785,31821,31822,31823,31825,31826,31828,31829,31830,31833,31835,31836,31837,31838,31839,31840,31841,31842,31844,31845,31848,31849,31850,31851,31852,31858,31859,31860,31866,31867,31868,31869,31871,31872,31876,31877,31878,31879,31880,31881,31935,32043,32381,32382,32383,32385,32387,32392,32393,32394,32477,32483,32484,32601,33142,33145,33146,33150,33154,33158,33159,33160,33161,33162,33167,33171,33172,33186,33190,33191,33192,33193,33201,33202,33206,33213,33214,33215,33221,33222,33223,33224,33225,33371,33589,33590,33591,33592,33596,33597,33599,33600,33601,33602,33603,33604,33605,33606,33607,33776,33831,33851,33852,33853,33855,33856,33859,33866,33867,33872,33873,33879,33880,33881,33882,33883,33886,33887,33888,33889,33890,33917,33956,33957,34151,34152,34153,34293,34295,34296,34297,34300,34453,34454,34455,34459,34460,34462,34464,34465,34466,34467,34468,34469,34470,34475,34476,34482,34483,34484,34485,34486,34487,34488,34489,34490,34491,34492,34493,34494,34496,34497,34498,34499,34500,34502,34503,34506,34507,34508,34692,34753,34838,34839,34859,34860,34861,34908,34909,34910,34914,34935,34938,34939,34948,34949,34950,34954,35029,35030,35100,35102,35104,35110,35111,35363,35364,35395,35396,35397,35446,35448,35449,35541,35550,35551,35552,35553,35578,35581,35691,35692,35693,36554,37116,37117,43338,44378,44379,44394,44395,44396,44397,44398,44399,44400,44402,44403,44404,44425,44442,44443,44445,44446,44448,44449,44457,44469,44470,44471,44472,44543,44545,44546,44548,44549,44557,44560,44561,44566,44567,44568,44570,44571,44572,44745,45234,45243,45244,46854,46855,46859,46860,46865,46866,46867,46908,46909,46910,46911,46913,46914,46915,46917,46924,46945,46949,46951,46952,46953,46968,47193,47195,47196,47197,47198,47199,47200,47201,47202,47203,47204,47205,47220,47221,47223,47230,47231,47236,47237,47238,47239,47240,47245,47246,47247,47258,47259,47260,47266,47267,47268,47269,47270,47294,47295,47296,47507,47508,47509,47511,47515,47516,47517,47535,47536,47537,47540,47558,47559,47560,47562,47564,47565,47566,47567,47569,47570,47573,47577,47578,47580,47581,47582,47585,47586,47587,47588,47788,48181,48384,48389,48392,48393,48395,48396,48409,48410,48411,48412,48432,48433,48434,48438,48483,48484,48485,48488,48489,48491,48492,48494,48495,48496,48499,48500,48505,48506,48510,48511,48514,48516,48521,48525,48532,48535,48536,48537,48539,48544,48545,48962,48963,48965,48977,48978,48979,48982,48985,48987,48988,48997,49004,49005,49006,49013,49015,49016,49018,49023,49024,49027,49028,49032,49036,49039,49042,49137,49140,49143,49145,49146,49149,49158,49175,49182,49184,49186,49188,49189,49194,49200,49202,49203,49206,49208,49217,49219,49220,49222,49223,49224,49226,49377,49390,49391,49392,49393,49394,49395,49455,49467,49471,49477,49478,49479,49480,49483,49488,49489,49490,49491,49495,49497,49500,49501,49503,49504,49508,49509,49526,49529,49530,49533,49534,49538,49542,49543,49562,49564,49565,49567,49568,49571,49572,49588,49589,49599,49610,49611,49627,49628,49631,49632,49633,49635,49636,49638,49654,49655,49657,49661,49662,49663,49664,49786,49787,49788,49789,49790,49791,49796,50029,50031,50033,50034,50040,50041,50043,50115,50117,50118,50119,50120,50121,50127,50128,50129,50130,50137,50138,50147,50149,50150,50151,50152,50154,50187,50190,50191,50334,50365,50371,50384,50385,50391,50392,50516,50685,50686,50687,50720,50796,50880,50884,50885,50886,50887,51052,51099,51108,51109,51123,51127,51128,51129,51130,51160,51161,51166,51167,51179,51180,51181,51182,51183,51267,51268,51269,51271,51456,51459,51462,51463,51464,51465,51466,51468,51470,51472,51473,51474,51478,51479,51480,51481,51482,51483,51485,51486,51490,51521,51522,51523,51524,51525,51526,51527,51528,51529,51530,51531,51532,51533,51554,51555,51556,51557,51558,51560,51561,51562,51563,51564,51565,51566,51625,51626,51627,51628,51629,51632,51633,51634,51635,51636,51662,51664,51665,51667,51668,51669,51672,51674,51679,51682,51685,51686,51687,51688,51689,51690,51692,51696,51698,51700,51701,51708,51709,51710,51711,51712,51713,51745,51746,51881,51883,51884,51885,51886,52143,52456,52783,52785,52786,52787,52788,52795,52797,52798,52799,52800,52802,52803,53137,53138,53209,53215,53216,53217,53221,53222,53224,53228,53232,53234,53237,53238,53241,53243,53244,53245,53246,53252,53253,53256,53259,53260,53262,53263,53264,53265,53270,53290,53291,53292,53295,53296,53297,53298,53299,53301,53302,53303,53304,53375,53376,53379,53380,53381,53382,53385,53484,53486,53488,53501,53502,53503,53519,53527,53530,53551,53552,53553,53556,53557,53563,53569,53576,53583,53585,53590,53591,53592,53595,53620,53621,53622,53648,53660,53661,53671,53673,53695,53696,53709,53710,53711,53754,53759,54037,54038,54117,54118,54151,54154,54155,54347,54348,54349,54354,54486,54488,54489,54490,54637,54638,54639,54646,54658,54659,54734,54747,54749,54787,55050,55061,55062,55090,55091,55092,55094,55107,55108,55129,55130,55131,55132,55133,55136,55198,55225,55226,55233,55236,55237,55339,55340,55610,55620,55623,55666,55667,56314,56315,56316,56317,56318,56333,56336,56337,56339,56340,56341,56342,56343,56344,56611,56612,56613,56614,56636,56637,56638,56822,56834,56835,56924,56927,56929,56930,56931,56932,57470,57472,57499,57810,57811,57812,57813,57814,57849,57850,57851,57865,57873,57876,57877,57878,57880,57881,58410,58413,58414,58415,58422,58423,58424,58425,58426,58435,58872,58874,59057,59088,59089,59672,59738,59739,59740,59741,60103,60184,60185,60187,60188,60970,61154,61155,61156,61157,61158,61216,61221,61222,61295,61329,61330,61331,61336,61345,61346,62097,62098,62099,62100,62101,62905,62908,63108,63117,63121,63123,63156,63158,63245,63349,63350,63351,63370,63372,63373,63374,63410,63411,63457,63458,63503,63504,63505,63506,63534,63542,63543,63560,63574,63625,63626,63627,63646,63647,63648,63649,63650,63730,63733,63737,64044,64127,64129,64205,64353,64357,64976,65139,65661,66191,66192,66799,66814,66815,66816,66817); + +-- XTElite1 - Talents that teach an initial skill, and you learn higher ranks from a trainer. Here's a cleanup query that will remove all those: +DELETE FROM `character_spell` WHERE `spell` IN (12505,12522,12523,12524,12525,12526,13018,13019,13020,13021,13031,13032,13033,16979,17311,17312,17313,17314,17347,17348,18807,18809,18867,18868,18869,18870,18871,18937,18938,19238,19240,19241,19242,19243,20900,20901,20902,20903,20904,20909,20910,21551,21552,21553,24132,24133,24974,24975,24976,24977,25248,25387,25437,26864,27013,27065,27067,27068,27132,27133,27134,27263,27265,27870,27871,28275,30016,30022,30330,30404,30405,30413,30414,30546,32593,32594,33041,33042,33043,33405,33876,33878,33933,33938,33982,33983,33986,33987,34411,34412,34413,34863,34864,34865,34866,34916,34917,42890,42891,42944,42945,42949,42950,43038,43039,44780,44781,47485,47486,47497,47498,47826,47827,47841,47843,47846,47847,48086,48087,48088,48089,48155,48156,48159,48160,48172,48173,48468,48563,48564,48565,48566,48660,48663,48666,48998,48999,49011,49012,49049,49050,49283,49284,49376,53005,53006,53007,53199,53200,53201,53223,53225,53226,53227,53248,53249,53251,55359,55360,57720,57721,57722,59092,59156,59158,59159,59161,59163,59164,59170,59171,59172,60051,60052,60053,61299,61300,61301,61384); + +*/ diff --git a/sql/updates/3.1.3_old/5097_world_scripts.sql b/sql/updates/3.1.3_old/5097_world_scripts.sql new file mode 100644 index 0000000..6a4f6f8 --- /dev/null +++ b/sql/updates/3.1.3_old/5097_world_scripts.sql @@ -0,0 +1,69 @@ +UPDATE creature_template SET ScriptName='npc_00x09hl' WHERE entry=7806; + +DELETE FROM script_waypoint WHERE entry=7806; +INSERT INTO script_waypoint VALUES +(7806, 0, 495.404358, -3478.350830, 114.837, 0, ''), +(7806, 1, 492.704742, -3486.112549, 108.627, 0, ''), +(7806, 2, 487.249756, -3485.764404, 107.890, 0, ''), +(7806, 3, 476.851959, -3489.875977, 99.985, 0, ''), +(7806, 4, 467.212402, -3493.355469, 99.819, 0, ''), +(7806, 5, 460.017029, -3496.984375, 104.481, 0, ''), +(7806, 6, 439.619446, -3500.730225, 110.534, 0, ''), +(7806, 7, 428.326385, -3495.874756, 118.662, 0, ''), +(7806, 8, 424.664032, -3489.381592, 121.999, 0, ''), +(7806, 9, 424.137299, -3470.952637, 124.333, 0, ''), +(7806, 10, 421.791107, -3449.242676, 119.126, 0, ''), +(7806, 11, 404.247070, -3429.376953, 117.644, 0, ''), +(7806, 12, 335.465271, -3430.717773, 116.456, 0, ''), +(7806, 13, 317.160126, -3426.708984, 116.226, 0, ''), +(7806, 14, 331.180115, -3464.002197, 117.143, 0, ''), +(7806, 15, 336.393616, -3501.877441, 118.201, 0, ''), +(7806, 16, 337.251312, -3544.764648, 117.284, 0, ''), +(7806, 17, 337.748932, -3565.415527, 116.797, 0, ''), +(7806, 18, 336.010925, -3597.363037, 118.225, 0, ''), +(7806, 19, 324.619141, -3622.884033, 119.811, 0, ''), +(7806, 20, 308.027466, -3648.600098, 123.047, 0, ''), +(7806, 21, 276.325409, -3685.738525, 128.356, 0, ''), +(7806, 22, 239.981064, -3717.330811, 131.874, 0, ''), +(7806, 23, 224.950974, -3730.169678, 132.125, 0, ''), +(7806, 24, 198.707870, -3768.292725, 129.420, 0, ''), +(7806, 25, 183.758316, -3791.068848, 128.045, 0, ''), +(7806, 26, 178.110657, -3801.575439, 128.370, 3000, 'SAY_OOX_DANGER'), +(7806, 27, 162.215225, -3827.014160, 129.424, 0, ''), +(7806, 28, 141.664734, -3864.519287, 131.419, 0, ''), +(7806, 29, 135.301697, -3880.089111, 132.120, 0, ''), +(7806, 30, 122.461151, -3910.071533, 135.605, 0, ''), +(7806, 31, 103.376175, -3937.725098, 137.342, 0, ''), +(7806, 32, 81.414474, -3958.614258, 138.469, 0, ''), +(7806, 33, 55.378139, -3982.004639, 136.520, 0, ''), +(7806, 34, 13.983131, -4013.952881, 126.903, 0, ''), +(7806, 35, -21.658007, -4048.713623, 118.068, 0, ''), +(7806, 36, -52.443058, -4081.209717, 117.477, 0, ''), +(7806, 37, -102.710854, -4116.760742, 118.666, 0, ''), +(7806, 38, -92.996193, -4135.847168, 119.310, 0, ''), +(7806, 39, -86.391273, -4153.331055, 122.502, 0, ''), +(7806, 40, -85.746086, -4163.600586, 121.892, 0, ''), +(7806, 41, -90.544006, -4183.577637, 117.587, 0, ''), +(7806, 42, -110.223564, -4205.861328, 121.878, 0, ''), +(7806, 43, -115.257607, -4211.962402, 121.878, 3000, 'SAY_OOX_DANGER'), +(7806, 44, -128.594650, -4233.343750, 117.766, 0, ''), +(7806, 45, -135.358917, -4258.120117, 117.562, 0, ''), +(7806, 46, -156.832428, -4258.961914, 120.059, 0, ''), +(7806, 47, -167.119873, -4274.102539, 117.062, 0, ''), +(7806, 48, -176.291016, -4287.594727, 118.721, 0, ''), +(7806, 49, -196.992981, -4315.815430, 117.588, 0, ''), +(7806, 50, -209.329300, -4331.671387, 115.142, 0, ''), +(7806, 51, -232.292236, -4356.015625, 108.543, 0, ''), +(7806, 52, -232.159683, -4370.904297, 102.815, 0, ''), +(7806, 53, -210.271133, -4389.896973, 84.167, 0, ''), +(7806, 54, -187.940186, -4407.532715, 70.987, 0, ''), +(7806, 55, -181.353577, -4418.771973, 64.778, 0, ''), +(7806, 56, -170.529861, -4440.438965, 58.943, 0, ''), +(7806, 57, -141.428543, -4465.323242, 45.963, 0, ''), +(7806, 58, -120.993629, -4487.088379, 32.075, 0, ''), +(7806, 59, -104.134621, -4501.837402, 25.051, 0, ''), +(7806, 60, -84.154663, -4529.436523, 11.952, 0, ''), +(7806, 61, -88.698898, -4544.626465, 9.055, 0, ''), +(7806, 62, -100.603447, -4575.034180, 11.388, 0, ''), +(7806, 63, -106.908669, -4600.407715, 11.046, 0, ''), +(7806, 64, -106.831703, -4620.503418, 11.057, 3000, 'SAY_OOX_COMPLETE'); diff --git a/sql/updates/3.1.3_old/5105_world_scripts.sql b/sql/updates/3.1.3_old/5105_world_scripts.sql new file mode 100644 index 0000000..33a32fc --- /dev/null +++ b/sql/updates/3.1.3_old/5105_world_scripts.sql @@ -0,0 +1,311 @@ +DELETE FROM script_waypoint WHERE entry=3439; +INSERT INTO script_waypoint VALUES +(3439, 0, 1105.090332, -3101.254150, 82.706, 1000, 'SAY_STARTUP1'), +(3439, 1, 1103.204468, -3104.345215, 83.113, 1000, ''), +(3439, 2, 1107.815186, -3106.495361, 82.739, 1000, ''), +(3439, 3, 1104.733276, -3100.830811, 82.747, 1000, ''), +(3439, 4, 1103.242554, -3106.270020, 83.133, 1000, ''), +(3439, 5, 1112.807373, -3106.285400, 82.320, 1000, ''), +(3439, 6, 1112.826782, -3108.908691, 82.377, 1000, ''), +(3439, 7, 1108.053955, -3115.156738, 82.894, 0, ''), +(3439, 8, 1108.355591, -3104.365234, 82.377, 5000, ''), +(3439, 9, 1100.306763, -3097.539063, 83.150, 0, 'SAY_STARTUP2'), +(3439, 10, 1100.562378, -3082.721924, 82.768, 0, ''), +(3439, 11, 1097.512939, -3069.226563, 82.206, 0, ''), +(3439, 12, 1092.964966, -3053.114746, 82.351, 0, ''), +(3439, 13, 1094.010986, -3036.958496, 82.888, 0, ''), +(3439, 14, 1095.623901, -3025.760254, 83.392, 0, ''), +(3439, 15, 1107.656494, -3013.530518, 85.653, 0, ''), +(3439, 16, 1119.647705, -3006.928223, 87.019, 0, ''), +(3439, 17, 1129.991211, -3002.410645, 91.232, 7000, 'SAY_MERCENARY'), +(3439, 18, 1133.328735, -2997.710693, 91.675, 1000, 'SAY_PROGRESS_1'), +(3439, 19, 1131.799316, -2987.948242, 91.976, 1000, ''), +(3439, 20, 1122.028687, -2993.397461, 91.536, 0, ''), +(3439, 21, 1116.614868, -2981.916748, 92.103, 0, ''), +(3439, 22, 1102.239136, -2994.245117, 92.074, 0, ''), +(3439, 23, 1096.366211, -2978.306885, 91.873, 0, ''), +(3439, 24, 1091.971558, -2985.919189, 91.730, 40000, 'SAY_PROGRESS_2'); + +DELETE FROM script_waypoint WHERE entry = 1978; +INSERT INTO script_waypoint VALUES +(1978, 0, 1406.32, 1083.10, 52.55, 0, ''), +(1978, 1, 1400.49, 1080.42, 52.50, 0, 'first say'), +(1978, 2, 1388.48, 1083.10, 52.52, 0, ''), +(1978, 3, 1370.16, 1084.02, 52.30, 0, ''), +(1978, 4, 1359.02, 1080.85, 52.46, 0, ''), +(1978, 5, 1341.43, 1087.39, 52.69, 0, ''), +(1978, 6, 1321.93, 1090.51, 50.66, 0, ''), +(1978, 7, 1312.98, 1095.91, 47.49, 0, ''), +(1978, 8, 1301.09, 1102.94, 47.76, 0, ''), +(1978, 9, 1297.73, 1106.35, 50.18, 0, ''), +(1978, 10, 1295.49, 1124.32, 50.49, 0, ''), +(1978, 11, 1294.84, 1137.25, 51.75, 0, ''), +(1978, 12, 1292.89, 1158.99, 52.65, 0, ''), +(1978, 13, 1290.75, 1168.67, 52.56, 1000, 'complete quest and say last'), +(1978, 14, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 15, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 16, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 17, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 18, 1290.72, 1207.44, 52.69, 0, ''), +(1978, 19, 1297.50, 1207.18, 53.74, 0, ''), +(1978, 20, 1301.32, 1220.90, 53.74, 0, ''), +(1978, 21, 1298.55, 1220.43, 53.74, 0, ''), +(1978, 22, 1297.59, 1211.23, 58.47, 0, ''), +(1978, 23, 1305.01, 1206.10, 58.51, 0, ''), +(1978, 24, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 25, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 26, 1310.51, 1207.36, 58.51, 2000, ''); + +DELETE FROM script_waypoint WHERE entry = 7784; +INSERT INTO script_waypoint VALUES +(7784 ,0, -8843.73, -4374.44, 43.71, 0, ''), +(7784 ,1, -8834.68, -4373.88, 45.71, 0, ''), +(7784 ,2, -8832.93, -4373.85, 45.67, 0, ''), +(7784 ,3, -8829.21, -4373.72, 44.14, 0, ''), +(7784 ,4, -8825.10, -4373.56, 41.44, 0, ''), +(7784 ,5, -8818.88, -4372.75, 36.43, 0, ''), +(7784 ,6, -8803.37, -4369.68, 30.06, 0, ''), +(7784 ,7, -8786.68, -4366.18, 23.91, 0, ''), +(7784 ,8, -8764.97, -4366.94, 25.23, 0, ''), +(7784 ,9, -8745.49, -4363.16, 22.80, 0, ''), +(7784 ,10, -8724.13, -4353.55, 20.72, 0, ''), +(7784 ,11, -8706.77, -4346.14, 16.12, 0, ''), +(7784 ,12, -8688.27, -4372.85, 13.64, 0, ''), +(7784 ,13, -8668.76, -4380.38, 11.69, 0, ''), +(7784 ,14, -8645.19, -4388.62, 12.56, 0, ''), +(7784 ,15, -8614.73, -4398.60, 9.86, 0, ''), +(7784 ,16, -8560.33, -4411.27, 13.17, 0, ''), +(7784 ,17, -8536.45, -4416.49, 11.84, 0, ''), +(7784 ,18, -8503.48, -4423.70, 13.59, 0, ''), +(7784 ,19, -8471.91, -4430.60, 9.56, 0, ''), +(7784 ,20, -8441.36, -4435.31, 9.40, 0, ''), +(7784 ,21, -8403.41, -4441.16, 11.83, 0, ''), +(7784 ,22, -8371.24, -4446.13, 9.47, 0, ''), +(7784 ,23, -8353.96, -4448.79, 10.10, 0, 'Scorpid'), +(7784 ,24, -8336.40, -4446.39, 8.98, 0, ''), +(7784 ,25, -8303.78, -4441.96, 11.89, 0, ''), +(7784 ,26, -8272.20, -4433.31, 9.60, 0, ''), +(7784 ,27, -8224.76, -4419.39, 13.03, 0, ''), +(7784 ,28, -8193.31, -4406.04, 10.17, 0, ''), +(7784 ,29, -8155.65, -4397.74, 8.99, 0, ''), +(7784 ,30, -8129.25, -4394.57, 10.92, 0, ''), +(7784 ,31, -8104.86, -4399.03, 8.93, 0, ''), +(7784 ,32, -8063.15, -4423.40, 10.07, 0, ''), +(7784 ,33, -8032.15, -4443.47, 9.97, 0, ''), +(7784 ,34, -8015.39, -4454.33, 9.39, 0, ''), +(7784 ,35, -7981.64, -4482.44, 10.32, 0, ''), +(7784 ,36, -7958.83, -4503.98, 9.69, 0, ''), +(7784 ,37, -7932.45, -4528.91, 10.08, 0, ''), +(7784 ,38, -7904.09, -4566.67, 12.59, 0, ''), +(7784 ,39, -7883.33, -4593.91, 12.15, 0, ''), +(7784 ,40, -7862.83, -4624.53, 10.21, 0, ''), +(7784 ,41, -7840.79, -4654.26, 9.45, 0, ''), +(7784 ,42, -7826.17, -4673.99, 10.61, 0, ''), +(7784 ,43, -7807.86, -4698.69, 11.24, 0, ''), +(7784 ,44, -7793.88, -4717.55, 10.48, 0, ''), +(7784 ,45, -7778.68, -4738.05, 8.89, 0, ''), +(7784 ,46, -7746.42, -4780.39, 9.84, 0, ''), +(7784 ,47, -7724.11, -4772.75, 10.28, 0, ''), +(7784 ,48, -7697.98, -4763.80, 9.52, 0, ''), +(7784 ,49, -7665.33, -4752.62, 10.56, 0, ''), +(7784 ,50, -7641.47, -4750.33, 8.94, 0, ''), +(7784 ,51, -7620.08, -4753.96, 8.93, 0, ''), +(7784 ,52, -7603.15, -4757.53, 9.06, 0, ''), +(7784 ,53, -7579.43, -4767.07, 8.93, 0, ''), +(7784 ,54, -7558.51, -4779.01, 9.64, 0, ''), +(7784 ,55, -7536.40, -4789.32, 8.92, 0, ''), +(7784 ,56, -7512.07, -4793.50, 9.35, 0, 'Wastewander'), +(7784 ,57, -7490.79, -4788.80, 10.53, 0, ''), +(7784 ,58, -7469.10, -4785.11, 10.42, 0, ''), +(7784 ,59, -7453.18, -4782.41, 9.15, 0, ''), +(7784 ,60, -7426.27, -4777.83, 9.54, 0, ''), +(7784 ,61, -7393.84, -4770.19, 12.57, 0, ''), +(7784 ,62, -7367.25, -4764.17, 11.92, 0, ''), +(7784 ,63, -7341.00, -4752.11, 10.17, 0, ''), +(7784 ,64, -7321.62, -4744.97, 11.58, 0, ''), +(7784 ,65, -7302.35, -4744.35, 11.97, 0, ''), +(7784 ,66, -7281.00, -4743.66, 11.21, 0, ''), +(7784 ,67, -7258.33, -4742.93, 9.64, 0, ''), +(7784 ,68, -7236.70, -4742.24, 10.16, 0, ''), +(7784 ,69, -7217.52, -4743.87, 10.79, 0, ''), +(7784 ,70, -7201.86, -4746.32, 9.58, 0, ''), +(7784 ,71, -7182.01, -4749.41, 9.09, 0, ''), +(7784 ,72, -7159.61, -4752.90, 9.52, 0, ''), +(7784 ,73, -7139.58, -4756.02, 9.53, 0, ''), +(7784 ,74, -7122.60, -4754.91, 9.66, 0, ''), +(7784 ,75, -7101.06, -4753.87, 8.92, 0, ''), +(7784 ,76, -7082.79, -4752.99, 9.97, 0, ''), +(7784 ,77, -7061.81, -4751.98, 9.26, 0, ''), +(7784 ,78, -7035.12, -4754.39, 9.19, 0, ''), +(7784 ,79, -7013.90, -4758.64, 10.28, 0, ''), +(7784 ,80, -7001.71, -4769.73, 10.59, 0, ''), +(7784 ,81, -6984.95, -4788.61, 9.30, 0, ''), +(7784 ,82, -6970.41, -4788.77, 9.42, 0, ''), +(7784 ,83, -6957.16, -4788.92, 6.26, 0, ''), +(7784 ,84, -6951.29, -4802.73, 4.45, 0, ''), +(7784 ,85, -6944.81, -4816.58, 1.60, 0, ''), +(7784 ,86, -6942.06, -4839.40, 0.66, 5000, ''); + +DELETE FROM script_waypoint WHERE entry = 4508; +INSERT INTO script_waypoint VALUES +(4508 ,0, 2194.38, 1791.65, 65.48, 5000, ''), +(4508 ,1, 2188.56, 1805.87, 64.45, 0, ''), +(4508 ,2, 2187, 1843.49, 59.33, 0, ''), +(4508 ,3, 2163.27, 1851.67, 56.73, 5000, ''), +(4508 ,4, 2137.66, 1843.98, 48.08, 5000, ''), +(4508 ,5, 2140.22, 1845.02, 48.32, 0, ''), +(4508 ,6, 2131.5, 1804.29, 46.85, 0, ''), +(4508 ,7, 2096.18, 1789.03, 51.13, 0, ''), +(4508 ,8, 2074.46, 1780.09, 55.64, 3000, ''), +(4508 ,9, 2055.12, 1768.67, 58.46, 5000, ''), +(4508 ,10, 2037.83, 1748.62, 60.27, 0, ''), +(4508 ,11, 2037.51, 1728.94, 60.85, 0, ''), +(4508 ,12, 2044.7, 1711.71, 59.71, 0, ''), +(4508 ,13, 2067.66, 1701.84, 57.77, 3000, ''), +(4508 ,14, 2078.91, 1704.54, 56.77, 3000, ''), +(4508 ,15, 2097.65, 1715.24, 54.74, 0, ''), +(4508 ,16, 2106.44, 1720.98, 54.41, 0, ''), +(4508 ,17, 2123.96, 1732.56, 52.27, 0, ''), +(4508 ,18, 2153.82, 1728.73, 51.92, 0, ''), +(4508 ,19, 2163.49, 1706.33, 54.42, 0, ''), +(4508 ,20, 2158.75, 1695.98, 55.70, 0, ''), +(4508 ,21, 2142.6, 1680.72, 58.24, 0, ''), +(4508 ,22, 2118.31, 1671.54, 59.21, 0, ''), +(4508 ,23, 2086.02, 1672.04, 61.24, 0, ''), +(4508 ,24, 2068.81, 1658.93, 61.24, 0, ''), +(4508 ,25, 2062.82, 1633.31, 64.35, 3000, ''), +(4508 ,26, 2063.05, 1589.16, 63.26, 0, ''), +(4508 ,27, 2063.67, 1577.22, 65.89, 0, ''), +(4508 ,28, 2057.94, 1560.68, 68.40, 0, ''), +(4508 ,29, 2052.56, 1548.05, 73.35, 0, ''), +(4508 ,30, 2045.22, 1543.4, 76.65, 0, ''), +(4508 ,31, 2034.35, 1543.01, 79.70, 0, ''), +(4508 ,32, 2029.95, 1542.94, 80.79, 0, ''), +(4508 ,33, 2021.34, 1538.67, 80.8, 0, ''), +(4508 ,34, 2012.45, 1549.48, 79.93, 0, ''), +(4508 ,35, 2008.05, 1554.92, 80.44, 0, ''), +(4508 ,36, 2006.54, 1562.72, 81.11, 0, ''), +(4508 ,37, 2003.8, 1576.43, 81.57, 0, ''), +(4508 ,38, 2000.57, 1590.06, 80.62, 0, ''), +(4508 ,39, 1998.96, 1596.87, 80.22, 0, ''), +(4508 ,40, 1991.19, 1600.82, 79.39, 0, ''), +(4508 ,41, 1980.71, 1601.44, 79.77, 3000, ''), +(4508 ,42, 1967.22, 1600.18, 80.62, 3000, ''), +(4508 ,43, 1956.43, 1596.97, 81.75, 3000, ''), +(4508 ,44, 1954.87, 1592.02, 82.18, 0, ''), +(4508 ,45, 1948.35, 1571.35, 80.96, 30000, ''), +(4508 ,46, 1947.02, 1566.42, 81.80, 30000, ''); + +DELETE FROM script_waypoint WHERE entry = 9623; +INSERT INTO script_waypoint VALUES +(9623 ,1, -6380.38, -1965.14, -258.292, 5000, ''), +(9623 ,2, -6383.06, -1962.9, -258.936, 0, ''), +(9623 ,3, -6391.09, -1956.13, -260.291, 0, ''), +(9623 ,4, -6395.29, -1933.58, -262.949, 0, ''), +(9623 ,5, -6396.58, -1919.93, -263.838, 0, ''), +(9623 ,6, -6389.01, -1912.64, -260.689, 0, ''), +(9623 ,7, -6369.19, -1892.87, -255.924, 0, ''), +(9623 ,8, -6373.77, -1879.36, -259.268, 0, ''), +(9623 ,9, -6377.55, -1869.56, -260.503, 0, ''), +(9623 ,10, -6376.58, -1860.79, -260.026, 0, ''), +(9623 ,11, -6373.13, -1847.22, -259.249, 0, ''), +(9623 ,12, -6370.54, -1837.04, -260.007, 0, ''), +(9623 ,13, -6372.52, -1829.16, -260.071, 0, ''), +(9623 ,14, -6377.13, -1815.94, -262.632, 0, ''), +(9623 ,15, -6380.27, -1806.95, -265.53, 0, ''), +(9623 ,16, -6386.04, -1790.43, -268.546, 0, ''), +(9623 ,17, -6386.72, -1776.29, -269.851, 0, ''), +(9623 ,18, -6385.92, -1762.31, -271.494, 0, ''), +(9623 ,19, -6384.69, -1744.86, -272.196, 0, ''), +(9623 ,20, -6383.8, -1732.66, -272.222, 0, ''), +(9623 ,21, -6382.66, -1716.96, -272.235, 0, ''), +(9623 ,22, -6381.5, -1703.01, -272.964, 0, ''), +(9623 ,23, -6379.96, -1685.58, -272.842, 0, ''), +(9623 ,24, -6379.34, -1678.61, -272.34, 0, ''), +(9623 ,25, -6364.45, -1636.27, -271.065, 0, ''), +(9623 ,26, -6371.85, -1626.36, -272.188, 0, ''), +(9623 ,27, -6383.5, -1629.01, -272.206, 0, ''), +(9623 ,28, -6388.09, -1635.37, -272.105, 5000, ''), +(9623 ,29, -6375.42, -1637.33, -272.193, 0, ''), +(9623 ,30, -6365.46, -1617.25, -272.141, 0, ''), +(9623 ,31, -6353.79, -1603.48, -271.932, 0, ''), +(9623 ,32, -6340.24, -1592.41, -269.435, 0, ''), +(9623 ,33, -6329.45, -1566.89, -269.895, 0, ''), +(9623 ,34, -6312.2, -1499.06, -269.507, 0, ''), +(9623 ,35, -6304.55, -1468.5, -269.431, 0, ''), +(9623 ,36, -6310.36, -1440.94, -268.427, 0, ''), +(9623 ,37, -6321, -1418.91, -266.525, 0, ''), +(9623 ,38, -6358.76, -1389.97, -267.522, 0, ''), +(9623 ,39, -6378.65, -1375.67, -271.749, 0, ''), +(9623 ,40, -6387.22, -1360.95, -272.109, 0, ''), +(9623 ,41, -6406.95, -1323.87, -271.586, 0, ''), +(9623 ,42, -6405, -1311.92, -271.906, 0, ''), +(9623 ,43, -6395.56, -1303.62, -271.902, 0, ''), +(9623 ,44, -6375.97, -1296.08, -271.865, 0, ''), +(9623 ,45, -6364.39, -1281.23, -269.012, 0, ''), +(9623 ,46, -6353.71, -1263.19, -267.95, 0, ''), +(9623 ,47, -6340.09, -1248.65, -267.441, 0, ''), +(9623 ,48, -6338.21, -1237.11, -267.844, 0, ''), +(9623 ,49, -6336.6, -1219.69, -269.196, 0, ''), +(9623 ,50, -6334.44, -1202.33, -271.527, 0, ''), +(9623 ,51, -6329.56, -1189.82, -270.947, 0, ''), +(9623 ,52, -6324.66, -1179.46, -270.103, 0, ''), +(9623 ,53, -6315.08, -1176.74, -269.735, 0, ''), +(9623 ,54, -6308.49, -1179.12, -269.57, 0, ''), +(9623 ,55, -6302.43, -1181.32, -269.328, 5000, ''), +(9623 ,56, -6298.87, -1185.79, -269.278, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 18760; +INSERT INTO script_waypoint VALUES +(18760 ,0, -2265.21, 3091.14, 13.91, 0, ''), +(18760 ,1, -2266.80, 3091.33, 13.82, 1000, ''), +(18760 ,2, -2268.20, 3091.14, 13.82, 7000, 'progress1'), +(18760 ,3, -2278.32, 3098.98, 13.82, 0, ''), +(18760 ,4, -2294.82, 3110.59, 13.82, 0, ''), +(18760 ,5, -2300.71, 3114.60, 13.82, 20000, 'progress2'), +(18760 ,6, -2300.71, 3114.60, 13.82, 3000, 'progress3'), +(18760 ,7, -2307.36, 3122.76, 13.79, 0, ''), +(18760 ,8, -2312.83, 3130.55, 12.04, 0, ''), +(18760 ,9, -2345.02, 3151.00, 8.38, 0, ''), +(18760 ,10, -2351.97, 3157.61, 6.27, 0, ''), +(18760 ,11, -2360.35, 3171.48, 3.31, 0, ''), +(18760 ,12, -2371.44, 3185.41, 0.89, 0, ''), +(18760 ,13, -2371.21, 3197.92, -0.96, 0, ''), +(18760 ,14, -2380.35, 3210.45, -1.08, 0, ''), +(18760 ,15, -2384.74, 3221.25, -1.17, 0, ''), +(18760 ,16, -2386.15, 3233.39, -1.29, 0, ''), +(18760 ,17, -2383.45, 3247.79, -1.32, 0, ''), +(18760 ,18, -2367.50, 3265.64, -1.33, 0, ''), +(18760 ,19, -2354.90, 3273.30, -1.50, 0, ''), +(18760 ,20, -2348.88, 3280.58, -0.09, 0, ''), +(18760 ,21, -2349.06, 3295.86, -0.95, 0, ''), +(18760 ,22, -2350.43, 3328.27, -2.10, 0, ''), +(18760 ,23, -2346.76, 3356.27, -2.82, 0, ''), +(18760 ,24, -2340.56, 3370.68, -4.02, 0, ''), +(18760 ,25, -2318.84, 3384.60, -7.61, 0, ''), +(18760 ,26, -2313.99, 3398.61, -10.40, 0, ''), +(18760 ,27, -2320.85, 3414.49, -11.49, 0, ''), +(18760 ,28, -2338.26, 3426.06, -11.46, 0, ''), +(18760 ,29, -2342.67, 3439.44, -11.32, 12000, 'progress4'), +(18760 ,30, -2342.67, 3439.44, -11.32, 7000, 'emote bye'), +(18760 ,31, -2342.67, 3439.44, -11.32, 5000, 'cat form'), +(18760 ,32, -2344.60, 3461.27, -10.44, 0, ''), +(18760 ,33, -2396.81, 3517.17, -3.55, 0, ''), +(18760 ,34, -2439.23, 3523.00, -1.05, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 20415; +INSERT INTO script_waypoint VALUES +(20415 ,0, 2488.77, 2184.89, 104.64, 0, ''), +(20415 ,1, 2478.72, 2184.77, 98.58, 0, ''), +(20415 ,2, 2473.52, 2184.71, 99.00, 0, ''), +(20415 ,3, 2453.15, 2184.96, 97.09,4000, ''), +(20415 ,4, 2424.18, 2184.15, 94.11, 0, ''), +(20415 ,5, 2413.18, 2184.15, 93.42, 0, ''), +(20415 ,6, 2402.02, 2183.90, 87.59, 0, ''), +(20415 ,7, 2333.31, 2181.63, 90.03,4000, ''), +(20415 ,8, 2308.73, 2184.34, 92.04, 0, ''), +(20415 ,9, 2303.10, 2196.89, 94.94, 0, ''), +(20415 ,10, 2304.58, 2272.23, 96.67, 0, ''), +(20415 ,11, 2297.09, 2271.40, 95.16, 0, ''), +(20415 ,12, 2297.68, 2266.79, 95.07,4000, ''), +(20415 ,13, 2297.67, 2266.76, 95.07,4000, ''); diff --git a/sql/updates/3.1.3_old/5111_world_scripts.sql b/sql/updates/3.1.3_old/5111_world_scripts.sql new file mode 100644 index 0000000..c0fd22f --- /dev/null +++ b/sql/updates/3.1.3_old/5111_world_scripts.sql @@ -0,0 +1,5 @@ +UPDATE creature_template SET ScriptName='npc_trollbane' WHERE entry=16819; +UPDATE creature_template SET ScriptName='npc_timothy_daniels' WHERE entry=18019; +UPDATE creature_template SET ScriptName='npc_vekjik' WHERE entry=28315; + +UPDATE script_texts SET content_default='Frenzyheart kill you if you come back. You no welcome here no more!', comment='vekjik SAY_TEXTID_VEKJIK1' WHERE entry=-1000208; diff --git a/sql/updates/3.1.3_old/5117_world_npc_option.sql b/sql/updates/3.1.3_old/5117_world_npc_option.sql new file mode 100644 index 0000000..5600108 --- /dev/null +++ b/sql/updates/3.1.3_old/5117_world_npc_option.sql @@ -0,0 +1 @@ +UPDATE `npc_option` SET `icon` = '0' WHERE `id` IN('49','50','51'); diff --git a/sql/updates/3.1.3_old/5118_world_scripts.sql b/sql/updates/3.1.3_old/5118_world_scripts.sql new file mode 100644 index 0000000..26a1710 --- /dev/null +++ b/sql/updates/3.1.3_old/5118_world_scripts.sql @@ -0,0 +1,17 @@ +UPDATE script_texts SET content_default='Emergency power activated! Initializing ambulanory motor! CLUCK!' WHERE entry = -1000287; +UPDATE script_texts SET comment='oox SAY_OOX_START' WHERE entry = -1000287; +UPDATE script_texts SET comment='oox SAY_OOX_AGGRO1' WHERE entry = -1000288; +UPDATE script_texts SET comment='oox SAY_OOX_AGGRO2' WHERE entry = -1000289; +UPDATE script_texts SET comment='oox SAY_OOX_AMBUSH' WHERE entry = -1000290; +UPDATE script_texts SET comment='oox SAY_OOX17_AMBUSH_REPLY' WHERE entry = -1000291; +UPDATE script_texts SET comment='oox SAY_OOX_END' WHERE entry = -1000292; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1060000; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1060001; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1060002; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1060003; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1060004; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1060005; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1000416; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1000417; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1000418; +UPDATE script_texts SET content_default='REUSE', comment='REUSE' WHERE entry = -1000419; diff --git a/sql/updates/3.1.3_old/5119_world.sql b/sql/updates/3.1.3_old/5119_world.sql new file mode 100644 index 0000000..24fb439 --- /dev/null +++ b/sql/updates/3.1.3_old/5119_world.sql @@ -0,0 +1,17 @@ +ALTER TABLE `npc_spellclick_spells` DROP COLUMN `quest_status`; +ALTER TABLE `npc_spellclick_spells` ADD `aura_required` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'player without aura cant click' AFTER `cast_flags`; +ALTER TABLE `npc_spellclick_spells` ADD `aura_forbidden` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'player with aura cant click' AFTER `aura_required`; +ALTER TABLE `npc_spellclick_spells` ADD `user_type` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'relation with summoner: 0-no 1-friendly 2-raid 3-party player can click' AFTER `aura_forbidden`; + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN(31883, 31893, 31894, 31895, 31896, 31897); +INSERT INTO `npc_spellclick_spells` (npc_entry, spell_id, quest_start, quest_start_active, quest_end, cast_flags, aura_required, aura_forbidden, user_type) VALUES +(31883, 60123, 0, 0, 0, 0x2, 0, 48085, 2), +(31893, 60123, 0, 0, 0, 0x2, 0, 48084, 2), +(31894, 60123, 0, 0, 0, 0x2, 0, 28276, 2), +(31895, 60123, 0, 0, 0, 0x2, 0, 27874, 2), +(31896, 60123, 0, 0, 0, 0x2, 0, 27873, 2), +(31897, 60123, 0, 0, 0, 0x2, 0, 7001, 2); + +DELETE FROM `spell_bonus_data` WHERE `entry` IN(7001); +REPLACE INTO `spell_bonus_data` (entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus, comments) VALUES +(7001, -1, 0.3333, -1, -1, 'Priest - Lightwell Renew Rank 1'); diff --git a/sql/updates/3.1.3_old/5126_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5126_world_spell_proc_event.sql new file mode 100644 index 0000000..bf2b62b --- /dev/null +++ b/sql/updates/3.1.3_old/5126_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry`IN(63373,63374); +INSERT INTO `spell_proc_event` (`entry`,`SpellFamilyName`,`SpellFamilyMask0`,`procFlags`) VALUES +(63373,11,0x80000000,0x00010000), -- Frozen Power (Rank 1) +(63374,11,0x80000000,0x00010000); -- Freeze Power (Rank 2) diff --git a/sql/updates/3.1.3_old/5131_world_scripts_dk.sql b/sql/updates/3.1.3_old/5131_world_scripts_dk.sql new file mode 100644 index 0000000..dbfbdc2 --- /dev/null +++ b/sql/updates/3.1.3_old/5131_world_scripts_dk.sql @@ -0,0 +1,47 @@ +UPDATE `creature_template` SET `ScriptName`='npc_crusade_persuaded' WHERE `entry` IN (28939,28940,28610); + +update item_template set spellppmRate_1 = 1 where entry = 39371; -- persuader + + +DELETE FROM script_texts WHERE entry BETWEEN -1609600 AND -1609501; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +-- How To Win Friends And Influence Enemies + (-1609501, 'I\'ll tear the secrets from your soul! Tell me about the "Crimson Dawn" and your life may be spared!',0,0,0,0,'player SAY_PERSUADE1'), + (-1609502, 'Tell me what you know about "Crimson Dawn" or the beatings will continue!',0,0,0,0,'player SAY_PERSUADE2'), + (-1609503, 'I\'m through being courteous with your kind, human! What is the "Crimson Dawn?"',0,0,0,0,'player SAY_PERSUADE3'), + (-1609504, 'Is your life worth so little? Just tell me what I need to know about "Crimson Dawn" and I\'ll end your suffering quickly.',0,0,0,0,'player SAY_PERSUADE4'), + (-1609505, 'I can keep this up for a very long time, Scarlet dog! Tell me about the "Crimson Dawn!"',0,0,0,0,'player SAY_PERSUADE5'), + (-1609506, 'What is the "Crimson Dawn?"',0,0,0,0,'player SAY_PERSUADE6'), + (-1609507, '"Crimson Dawn!" What is it! Speak!',0,0,0,0,'player SAY_PERSUADE7'), + (-1609508, 'You\'ll be hanging in the gallows shortly, Scourge fiend!',0,0,0,0,'crusader SAY_CRUSADER1'), + (-1609509, 'You\'ll have to kill me, monster! I will tell you NOTHING!',0,0,0,0,'crusader SAY_CRUSADER2'), + (-1609510, 'You hit like a girl. Honestly. Is that the best you can do?',0,0,0,0,'crusader SAY_CRUSADER3'), + (-1609511, 'ARGH! You burned my last good tabard!',0,0,0,0,'crusader SAY_CRUSADER4'), + (-1609512, 'Argh... The pain... The pain is almost as unbearable as the lashings I received in grammar school when I was but a child.',0,0,0,0,'crusader SAY_CRUSADER5'), + (-1609513, 'I used to work for Grand Inquisitor Isillien! Your idea of pain is a normal mid-afternoon for me!',0,0,0,0,'crusader SAY_CRUSADER6'), + (-1609514, 'I\'ll tell you everything! STOP! PLEASE!',0,0,0,20,'break crusader SAY_PERSUADED1'), + (-1609515, 'We... We have only been told that the "Crimson Dawn" is an awakening. You see, the Light speaks to the High General. It is the Light...',0,0,0,20,'break crusader SAY_PERSUADED2'), + (-1609516, 'The Light that guides us. The movement was set in motion before you came... We... We do as we are told. It is what must be done.',0,0,0,20,'break crusader SAY_PERSUADED3'), + (-1609517, 'I know very little else... The High General chooses who may go and who must stay behind. There\'s nothing else... You must believe me!',0,0,0,20,'break crusader SAY_PERSUADED4'), + (-1609518, 'LIES! The pain you are about to endure will be talked about for years to come!',0,0,0,0,'break crusader SAY_PERSUADED5'), + (-1609519, 'NO! PLEASE! There is one more thing that I forgot to mention... A courier comes soon... From Hearthglen. It...',0,0,0,20,'break crusader SAY_PERSUADED6'), +-- Ambush At The Overlook + (-1609531, 'Hrm, what a strange tree. I must investigate.',0,0,0,0,'Scarlet Courier SAY_TREE1'), + (-1609532, 'What''s this!? This isn''t a tree at all! Guards! Guards!',0,0,0,0,'Scarlet Courier SAY_TREE2'), +-- Bloody Breakout + (-1609561, 'I\'ll need to get my runeblade and armor... Just need a little more time.',0,0,0,399,'Koltira Deathweaver SAY_BREAKOUT1'), + (-1609562, 'I\'m still weak, but I think I can get an anti-magic barrier up. Stay inside it or you\'ll be destroyed by their spells.',0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT2'), + (-1609563, 'Maintaining this barrier will require all of my concentration. Kill them all!',0,0,0,16,'Koltira Deathweaver SAY_BREAKOUT3'), + (-1609564, 'There are more coming. Defend yourself! Don\'t fall out of the anti-magic field! They\'ll tear you apart without its protection!',0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT4'), + (-1609565, 'I can\'t keep barrier up much longer... Where is that coward?',0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT5'), + (-1609566, 'The High Inquisitor comes! Be ready, death knight! Do not let him draw you out of the protective bounds of my anti-magic field! Kill him and take his head!',0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT6'), + (-1609567, 'Stay in the anti-magic field! Make them come to you!',0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT7'), + (-1609568, 'The death of the High Inquisitor of New Avalon will not go unnoticed. You need to get out of here at once! Go, before more of them show up. I\'ll be fine on my own.',0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT8'), + (-1609569, 'I\'ll draw their fire, you make your escape behind me.',0,0,0,0,'Koltira Deathweaver SAY_BREAKOUT9'), + (-1609570, 'Your High Inquisitor is nothing more than a pile of meat, Crusaders! There are none beyond the grasp of the Scourge!',0,1,0,0,'Koltira Deathweaver SAY_BREAKOUT10'), + (-1609581, 'The Crusade will purge your kind from this world!',0,1,0,0,'High Inquisitor Valroth start'), + (-1609582, 'It seems that I\'ll need to deal with you myself. The High Inquisitor comes for you, Scourge!',0,1,0,0,'High Inquisitor Valroth aggro'), + (-1609583, 'You have come seeking deliverance? I have come to deliver!',0,0,0,0,'High Inquisitor Valroth yell'), + (-1609584, 'LIGHT PURGE YOU!',0,0,0,0,'High Inquisitor Valroth yell'), + (-1609585, 'Coward!',0,0,0,0,'High Inquisitor Valroth yell'), + (-1609586, 'High Inquisitor Valroth\'s remains fall to the ground.',0,2,0,0,'High Inquisitor Valroth death'); diff --git a/sql/updates/3.1.3_old/5136_world_scripts_dk.sql b/sql/updates/3.1.3_old/5136_world_scripts_dk.sql new file mode 100644 index 0000000..b59b0a3 --- /dev/null +++ b/sql/updates/3.1.3_old/5136_world_scripts_dk.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_scarlet_courier' WHERE `entry`='29076'; diff --git a/sql/updates/3.1.3_old/5144_world_TDB.sql b/sql/updates/3.1.3_old/5144_world_TDB.sql new file mode 100644 index 0000000..621e174 --- /dev/null +++ b/sql/updates/3.1.3_old/5144_world_TDB.sql @@ -0,0 +1,27 @@ +-- Distracting Jarven does not depend on taking quest from the guarded barrel, it's available while Bitter Rivals is active +update quest_template set PrevQuestID = -310 where entry = 308; + +-- Make the unguarded barrel appear sooner after Jarven leaves +delete from `quest_end_scripts` where `id` = 308; +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','0','3','0','0','0','-5601.64','-541.38','392.42','0.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','0','0','0','0','2000000077','0','0','0','0'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','2','3','0','0','0','-5597.94','-542.04','392.42','5.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','3','3','0','0','0','-5597.95','-548.43','395.48','4.7'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','3','9','35875','30','0','0','0','0','0'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','7','3','0','0','0','-5605.31','-549.33','399.09','3.1'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','10','3','0','0','0','-5607.55','-546.63','399.09','1.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','14','3','0','0','0','-5597.52','-538.75','399.09','1.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','18','3','0','0','0','-5597.62','-530.24','399.65','3'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','21','3','0','0','0','-5603.67','-529.91','399.65','4.2'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','25','0','0','0','2000000056','0','0','0','0'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','36','3','0','0','0','-5603.67','-529.91','399.65','4.2'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','39','3','0','0','0','-5597.62','-530.24','399.65','3'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','42','3','0','0','0','-5597.52','-538.75','399.09','1.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','45','3','0','0','0','-5607.55','-546.63','399.09','1.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','48','3','0','0','0','-5605.31','-549.33','399.09','3.1'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','51','3','0','0','0','-5597.95','-548.43','395.48','4.7'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','54','3','0','0','0','-5597.94','-542.04','392.42','5.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','55','0','0','0','2000000078','0','0','0','0'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','58','3','0','0','0','-5601.64','-541.38','392.42','0.5'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','60','3','0','0','0','-5605.96','-544.45','392.43','0.9'); +insert into `quest_end_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) values('308','62','0','0','0','2000000079','0','0','0','0'); diff --git a/sql/updates/3.1.3_old/5152_world_scripts_dk.sql b/sql/updates/3.1.3_old/5152_world_scripts_dk.sql new file mode 100644 index 0000000..9e2aebd --- /dev/null +++ b/sql/updates/3.1.3_old/5152_world_scripts_dk.sql @@ -0,0 +1,19 @@ +UPDATE `creature_template` SET `ScriptName`='mob_scarlet_courier' WHERE `entry`='29076'; + +UPDATE `creature_template` SET `ScriptName`='npc_koltira_deathweaver' WHERE `entry`='28912'; +UPDATE `creature_template` SET `ScriptName`='mob_high_inquisitor_valroth' WHERE `entry`='29001'; + + +DELETE FROM script_waypoint WHERE entry=28912; +INSERT INTO script_waypoint VALUES + (28912, 0, 1653.518, -6038.374, 127.585, 1000, 'Jump off'), + (28912, 1, 1653.978, -6034.614, 127.585, 5000, 'To Box'), + (28912, 2, 1653.854, -6034.726, 127.585, 0, 'Equip'), + (28912, 3, 1652.297, -6035.671, 127.585, 1000, 'Recover'), + (28912, 4, 1639.762, -6046.343, 127.948, 0, 'Escape'), + (28912, 5, 1640.963, -6028.119, 134.740, 0, ''), + (28912, 6, 1625.805, -6029.197, 134.740, 0, ''), + (28912, 7, 1626.845, -6015.085, 134.740, 0, ''), + (28912, 8, 1649.150, -6016.975, 133.240, 0, ''), + (28912, 9, 1653.063, -5974.844, 132.652, 5000, 'Mount'), + (28912, 10, 1654.747, -5926.424, 121.191, 0, 'Disappear'); diff --git a/sql/updates/3.1.3_old/5153_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5153_world_spell_proc_event.sql new file mode 100644 index 0000000..7b8b827 --- /dev/null +++ b/sql/updates/3.1.3_old/5153_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` = 54821; +INSERT INTO `spell_proc_event` ( `entry` , `SpellFamilyName` , `SpellFamilyMask0` , `procFlags`) VALUES +(54821, 7, 0x00001000, 0x00000010); -- Glyph of Rake diff --git a/sql/updates/3.1.3_old/5155_world_scripts_dk.sql b/sql/updates/3.1.3_old/5155_world_scripts_dk.sql new file mode 100644 index 0000000..341caa7 --- /dev/null +++ b/sql/updates/3.1.3_old/5155_world_scripts_dk.sql @@ -0,0 +1,18 @@ +DELETE FROM `creature_questrelation` WHERE `quest` = 12754; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12754); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12754; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12754); +DELETE FROM `creature_questrelation` WHERE `quest` = 12755; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12755); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12755; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (29077, 12755); +DELETE FROM `creature_questrelation` WHERE `quest` = 12756; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (29077, 12756); +DELETE FROM `creature_involvedrelation` WHERE `quest` = 12756; +INSERT INTO `creature_involvedrelation` (`id`, `quest`) VALUES (28914, 12756); +DELETE FROM `creature_questrelation` WHERE `quest` = 12757; +INSERT INTO `creature_questrelation` (`id`, `quest`) VALUES (28914, 12757); + +UPDATE `quest_template` SET `PrevQuestId`=12751 WHERE `entry`=12754; + +update spell_area set quest_end = 12756 where spell=53081; diff --git a/sql/updates/3.1.3_old/5159_characters_channels.sql b/sql/updates/3.1.3_old/5159_characters_channels.sql new file mode 100644 index 0000000..4b107a8 --- /dev/null +++ b/sql/updates/3.1.3_old/5159_characters_channels.sql @@ -0,0 +1 @@ +ALTER TABLE `channels` DROP `m_ownerGUID`; diff --git a/sql/updates/3.1.3_old/5169_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/5169_world_spell_linked_spell.sql new file mode 100644 index 0000000..7c35b08 --- /dev/null +++ b/sql/updates/3.1.3_old/5169_world_spell_linked_spell.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_area` where spell in (40216,42016); + +DELETE FROM `spell_linked_spell` WHERE spell_trigger = 40214; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 40214, 40216, 2, 'Dragonmaw Illusion'), +( 40214, 42016, 2, 'Dragonmaw Illusion'); diff --git a/sql/updates/3.1.3_old/5175_world_scripts_dk.sql b/sql/updates/3.1.3_old/5175_world_scripts_dk.sql new file mode 100644 index 0000000..33f62d7 --- /dev/null +++ b/sql/updates/3.1.3_old/5175_world_scripts_dk.sql @@ -0,0 +1,10 @@ +update creature_template set spell1=53117 where entry=29104; +update creature_template set spell1=53348,killcredit1=29150 where entry IN (29102,29103); +update creature_template set scriptname="mob_anti_air" where entry in (29102,29103,29104); + + +DELETE FROM `spell_script_target` WHERE entry IN +(53110); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(53110, 1, 29102), +(53110, 1, 29103); -- Devour Humanoid diff --git a/sql/updates/3.1.3_old/5177_characters.sql b/sql/updates/3.1.3_old/5177_characters.sql new file mode 100644 index 0000000..6b8f85a --- /dev/null +++ b/sql/updates/3.1.3_old/5177_characters.sql @@ -0,0 +1,8 @@ +ALTER TABLE `auctionhousebot` + CHANGE COLUMN `maxstackgrey` `maxstackgrey` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + CHANGE COLUMN `maxstackwhite` `maxstackwhite` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + CHANGE COLUMN `maxstackgreen` `maxstackgreen` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + CHANGE COLUMN `maxstackblue` `maxstackblue` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + CHANGE COLUMN `maxstackpurple` `maxstackpurple` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + CHANGE COLUMN `maxstackorange` `maxstackorange` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.', + CHANGE COLUMN `maxstackyellow` `maxstackyellow` int(11) default '0' COMMENT 'Stack size limits for item qualities - a value of 0 will disable a maximum stack size for that quality, which will allow the bot to create items in stack as large as the item allows.'; diff --git a/sql/updates/3.1.3_old/5185_world_scripts_dk.sql b/sql/updates/3.1.3_old/5185_world_scripts_dk.sql new file mode 100644 index 0000000..b13f331 --- /dev/null +++ b/sql/updates/3.1.3_old/5185_world_scripts_dk.sql @@ -0,0 +1,161 @@ +-- The Light of Dawn (to do) +UPDATE `creature_template` SET `ScriptName`='npc_highlord_darion_mograine' WHERE `entry`='29173'; +UPDATE `creature_template` SET `ScriptName`='npc_the_lich_king_tirion_dawn' WHERE `entry` in (29183,29175); + +DELETE FROM `spell_script_target` WHERE `entry` in (53658, 53679, 53701, 53705, 53706, 53677, 53685); +-- insert into spell_script_target values (53658, 1, 29173); +insert into spell_script_target values (53679, 1, 29183); +insert into spell_script_target values (53701, 1, 29175); +insert into spell_script_target values (53705, 1, 29183); +insert into spell_script_target values (53706, 1, 29183); +insert into spell_script_target values (53677, 1, 29227); +insert into spell_script_target values (53685, 1, 29175); + +UPDATE creature_template SET unit_flags=32768,AIName='EventAI' WHERE entry IN (29199,29204,29200,29174,29182,29186,29190,29219,29206,29176,29178,29179,29180,29177,29181); +DELETE FROM creature_ai_scripts WHERE creature_id IN (29199,29204,29200,29174,29182,29186,29190,29219,29206,29176,29178,29179,29180,29177,29181); +INSERT INTO `creature_ai_scripts` VALUES ('2919901', '29199', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '52374', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Koltira Deathweaver - SPELL_BLOOD_STRIKE1'); +INSERT INTO `creature_ai_scripts` VALUES ('2919902', '29199', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '49576', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Koltira Deathweaver - SPELL_DEATH_GRIP'); +INSERT INTO `creature_ai_scripts` VALUES ('2919903', '29199', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '52372', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Koltira Deathweaver - SPELL_ICY_TOUCH2'); +INSERT INTO `creature_ai_scripts` VALUES ('2919904', '29199', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '50668', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Koltira Deathweaver - SPELL_PLAGUE_STRIKE1'); +INSERT INTO `creature_ai_scripts` VALUES ('2920401', '29204', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '52374', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Orbaz Bloodbane - SPELL_BLOOD_STRIKE1'); +INSERT INTO `creature_ai_scripts` VALUES ('2920402', '29204', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '49576', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Orbaz Bloodbane - SPELL_DEATH_GRIP'); +INSERT INTO `creature_ai_scripts` VALUES ('2920403', '29204', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '52372', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Orbaz Bloodbane - SPELL_ICY_TOUCH2'); +INSERT INTO `creature_ai_scripts` VALUES ('2920404', '29204', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '50668', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Orbaz Bloodbane - SPELL_PLAGUE_STRIKE1'); +INSERT INTO `creature_ai_scripts` VALUES ('2920001', '29200', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '52374', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Thassarian - SPELL_BLOOD_STRIKE1'); +INSERT INTO `creature_ai_scripts` VALUES ('2920002', '29200', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '49576', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Thassarian - SPELL_DEATH_GRIP'); +INSERT INTO `creature_ai_scripts` VALUES ('2920003', '29200', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '52372', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Thassarian - SPELL_ICY_TOUCH2'); +INSERT INTO `creature_ai_scripts` VALUES ('2920004', '29200', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '50668', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Thassarian - SPELL_PLAGUE_STRIKE1'); +INSERT INTO `creature_ai_scripts` VALUES ('2917401', '29174', '14', '0', '100', '3', '10000', '20', '5000', '10000', '11', '29427', '6', '1', '0', '0', '0', '0', '0', '0', '0', '0', 'Defender of the Light - SPELL_HOLY_LIGHT1'); +INSERT INTO `creature_ai_scripts` VALUES ('2917402', '29174', '4', '0', '100', '0', '0', '0', '0', '0', '11', '53625', '1', '5', '0', '0', '0', '0', '0', '0', '0', '0', 'Defender of the Light aggro'); +INSERT INTO `creature_ai_scripts` VALUES ('2917403', '29174', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '53625', '5', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Defender of the Light - SPELL_HEROIC_LEAP'); +INSERT INTO `creature_ai_scripts` VALUES ('2917404', '29174', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '53643', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Defender of the Light - SPELL_HOLY_STRIKE'); +INSERT INTO `creature_ai_scripts` VALUES ('2917405', '29174', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '53638', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Defender of the Light - SPELL_HOLY_WRATH'); +INSERT INTO `creature_ai_scripts` VALUES ('2917406', '29174', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '53629', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Defender of the Light - SPELL_UPPERCUT'); +INSERT INTO `creature_ai_scripts` VALUES ('2918201', '29182', '14', '0', '100', '3', '10000', '20', '5000', '10000', '11', '33642', '6', '1', '0', '0', '0', '0', '0', '0', '0', '0', 'Rimblat Earthshatter - SPELL_CHAIN_HEAL'); +INSERT INTO `creature_ai_scripts` VALUES ('2918202', '29182', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '53630', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Rimblat Earthshatter - SPELL_THUNDER'); +INSERT INTO `creature_ai_scripts` VALUES ('2918601', '29186', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '53633', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Rampaging Abomination - SPELL_CLEAVE1'); +INSERT INTO `creature_ai_scripts` VALUES ('2918602', '29186', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '50335', '5', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Rampaging Abomination - SPELL_SCOURGE_HOOK'); +INSERT INTO `creature_ai_scripts` VALUES ('2919001', '29190', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '53634', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Flesh Behemoth - SPELL_SCOURGE_HOOK'); +INSERT INTO `creature_ai_scripts` VALUES ('2919002', '29190', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '36706', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Flesh Behemoth - SPELL_THUNDERCLAP'); +INSERT INTO `creature_ai_scripts` VALUES ('2919003', '29190', '0', '0', '100', '3', '5000', '10000', '5000', '10000', '11', '53627', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Flesh Behemoth - SPELL_THUNDERCLAP'); +INSERT INTO `creature_ai_scripts` VALUES ('2921901', '29219', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '53632', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Volatile Ghoul - SPELL_GHOULPLOSION'); +INSERT INTO `creature_ai_scripts` VALUES ('2920601', '29206', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '53631', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Warrior of the Frozen Wastes - SPELL_CLEAVE'); +INSERT INTO `creature_ai_scripts` VALUES ('2917601', '29176', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '53631', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Korfax - SPELL_CLEAVE'); +INSERT INTO `creature_ai_scripts` VALUES ('2917602', '29176', '0', '0', '100', '3', '10000', '20000', '10000', '10000', '11', '53625', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Korfax - SPELL_CLEAVE'); +INSERT INTO `creature_ai_scripts` VALUES ('2917701', '29177', '14', '0', '100', '3', '10000', '20', '5000', '10000', '11', '37979', '6', '1', '0', '0', '0', '0', '0', '0', '0', '0', 'Commander Eligor Dawnbringer - SPELL_HOLY_LIGHT2'); +INSERT INTO `creature_ai_scripts` VALUES ('2918101', '29181', '14', '0', '100', '3', '10000', '20', '5000', '10000', '11', '20664', '6', '1', '0', '0', '0', '0', '0', '0', '0', '0', 'Rayne - SPELL_REJUVENATION'); +INSERT INTO `creature_ai_scripts` VALUES ('2918102', '29181', '14', '0', '100', '3', '10000', '20', '5000', '10000', '11', '25817', '6', '1', '0', '0', '0', '0', '0', '0', '0', '0', 'Rayne - SPELL_TRANQUILITY'); +INSERT INTO `creature_ai_scripts` VALUES ('2918103', '29181', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '20678', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Rayne - SPELL_STARFALL'); +INSERT INTO `creature_ai_scripts` VALUES ('2918104', '29181', '0', '0', '100', '3', '10000', '20000', '10000', '20000', '11', '21807', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Rayne - SPELL_WRATH'); + + + + +DELETE FROM script_texts WHERE entry BETWEEN -1609286 AND -1609201; +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +-- The Light of Dawn +-- pre text + (-1609201, 'Soldiers of the Scourge, stand ready! You will soon be able to unleash your fury upon the Argent Dawn!',14677,1,0,0,'Highlord Darion Mograine'), + (-1609202, 'The sky weeps at the devastation of sister earth! Soon, tears of blood will rain down upon us!',14678,1,0,0,'Highlord Darion Mograine'), + (-1609203, 'Death knights of Acherus, the death march begins!',14681,1,0,0,'Highlord Darion Mograine'), +-- intro + (-1609204, 'Soldiers of the Scourge, death knights of Acherus, minions of the darkness: hear the call of the Highlord!',14679,1,0,22,'Highlord Darion Mograine'), + (-1609205, 'RISE!',14680,1,0,15,'Highlord Darion Mograine'), + (-1609206, 'The skies turn red with the blood of the fallen! The Lich King watches over us, minions! Onward! Leave only ashes and misery in your destructive wake!',14682,1,0,25,'Highlord Darion Mograine'), +-- During the fight + (-1609207, 'Scourge armies approach!',0,1,0,0,'Korfax, Champion of the Light'), + (-1609208, 'Stand fast, brothers and sisters! The Light will prevail!',14487,1,0,0,'Lord Maxwell Tyrosus'), + (-1609209, 'Kneel before the Highlord!',14683,0,0,0,'Highlord Darion Mograine'), + (-1609210, 'You stand no chance!',14684,0,0,0,'Highlord Darion Mograine'), + (-1609211, 'The Scourge will destroy this place!',14685,0,0,0,'Highlord Darion Mograine'), + (-1609212, 'Your life is forfeit.',14686,0,0,0,'Highlord Darion Mograine'), + (-1609213, 'Life is meaningless without suffering.',14687,0,0,0,'Highlord Darion Mograine'), + (-1609214, 'How much longer will your forces hold out?',14688,0,0,0,'Highlord Darion Mograine'), + (-1609215, 'The Argent Dawn is finished!"',14689,0,0,0,'Highlord Darion Mograine'), + (-1609216, 'Spare no one!',14690,0,0,0,'Highlord Darion Mograine'), + (-1609217, 'What is this?! My... I cannot strike...',14691,0,0,0,'Highlord Darion Mograine'), + (-1609218, 'Obey me, blade!',14692,1,0,0,'Highlord Darion Mograine'), + (-1609219, 'You will do as I command! I am in control here!',14693,0,0,0,'Highlord Darion Mograine'), + (-1609220, 'I can not... the blade fights me.',14694,0,0,0,'Highlord Darion Mograine'), + (-1609221, 'What is happening to me?',14695,0,0,0,'Highlord Darion Mograine'), + (-1609222, 'Power...wanes...',14696,0,0,0,'Highlord Darion Mograine'), + (-1609223, 'Ashbringer defies me...',14697,0,0,0,'Highlord Darion Mograine'), + (-1609224, 'Minions, come to my aid!',14698,0,0,0,'Highlord Darion Mograine'), +-- After the fight + (-1609225, 'You cannot win, Darion!',14584,1,0,0,'Highlord Tirion Fordring'), + (-1609226, 'Bring them before the chapel!',14585,1,0,0,'Highlord Tirion Fordring'), + (-1609227, 'Stand down, death knights. We have lost... The Light... This place... No hope...',14699,0,0,68,'Highlord Darion Mograine'), + (-1609228, 'Have you learned nothing, boy? You have become all that your father fought against! Like that coward, Arthas, you allowed yourself to be consumed by the darkness...the hate... Feeding upon the misery of those you tortured and killed!',14586,0,0,378,'Highlord Tirion Fordring'), + (-1609229, 'Your master knows what lies beneath the chapel. It is why he dares not show his face! He\'s sent you and your death knights to meet their doom, Darion.',14587,0,0,25,'Highlord Tirion Fordring'), + (-1609230, 'What you are feeling right now is the anguish of a thousand lost souls! Souls that you and your master brought here! The Light will tear you apart, Darion!',14588,0,0,1,'Highlord Tirion Fordring'), + (-1609231, 'Save your breath, old man. It might be the last you ever draw.',14700,0,0,25,'Highlord Darion Mograine'), + (-1609232, 'My son! My dear, beautiful boy!',14493,0,0,0,'Highlord Alexandros Mograine'), + (-1609233, 'Father!',14701,0,0,5,'Highlord Darion Mograine'), + (-1609234, 'Argh...what...is...',14702,0,0,68,'Highlord Darion Mograine'), + (-1609235, 'Father, you have returned!',14703,0,0,0,'Darion Mograine'), + (-1609236, 'You have been gone a long time, father. I thought...',14704,0,0,0,'Darion Mograine'), + (-1609237, 'Nothing could have kept me away from here, Darion. Not from my home and family.',14494,0,0,1,'Highlord Alexandros Mograine'), + (-1609238, 'Father, I wish to join you in the war against the undead. I want to fight! I can sit idle no longer!',14705,0,0,6,'Darion Mograine'), + (-1609239, 'Darion Mograine, you are barely of age to hold a sword, let alone battle the undead hordes of Lordaeron! I couldn\'t bear losing you. Even the thought...',14495,0,0,1,'Highlord Alexandros Mograine'), + (-1609240, 'If I die, father, I would rather it be on my feet, standing in defiance against the undead legions! If I die, father, I die with you!',14706,0,0,6,'Darion Mograine'), + (-1609241, 'My son, there will come a day when you will command the Ashbringer and, with it, mete justice across this land. I have no doubt that when that day finally comes, you will bring pride to our people and that Lordaeron will be a better place because of you. But, my son, that day is not today.',14496,0,0,1,'Highlord Alexandros Mograine'), + (-1609242, 'Do not forget...',14497,0,0,6,'Highlord Alexandros Mograine'), + (-1609243, 'Touching...',14803,1,0,0,'The Lich King'), + (-1609244, 'You have\'ve betrayed me! You betrayed us all you monster! Face the might of Mograine!',14707,1,0,0,'Highlord Darion Mograine'), + (-1609245, 'He\'s mine now...',14805,0,0,0,'The Lich King'), + (-1609246, 'Pathetic...',14804,0,0,0,'The Lich King'), + (-1609247, 'You\'re a damned monster, Arthas!',14589,0,0,25,'Highlord Tirion Fordring'), + (-1609248, 'You were right, Fordring. I did send them in to die. Their lives are meaningless, but yours...',14806,0,0,1,'The Lich King'), + (-1609249, 'How simple it was to draw the great Tirion Fordring out of hiding. You\'ve left yourself exposed, paladin. Nothing will save you...',14807,0,0,1,'The Lich King'), + (-1609250, 'ATTACK!!!',14488,1,0,0,'Lord Maxwell Tyrosus'), + (-1609251, 'APOCALYPSE!',14808,1,0,0,'The Lich King'), + (-1609252, 'That day is not today...',14708,0,0,0,'Highlord Darion Mograine'), + (-1609253, 'Tirion!',14709,1,0,0,'Highlord Darion Mograine'), + (-1609254, 'ARTHAS!!!!',14591,1,0,0,'Highlord Tirion Fordring'), + (-1609255, 'What is this?',14809,1,0,0,'The Lich King'), + (-1609256, 'Your end.',14592,1,0,0,'Highlord Tirion Fordring'), + (-1609257, 'Impossible...',14810,1,0,0,'The Lich King'), + (-1609258, 'This... isn\'t... over...',14811,1,0,25,'The Lich King'), + (-1609259, 'When next we meet it won\'t be on holy ground, paladin.',14812,1,0,1,'The Lich King'), + (-1609260, 'Rise, Darion, and listen...',14593,0,0,0,'Highlord Tirion Fordring'), + (-1609261, 'We have all been witness to a terrible tragedy. The blood of good men has been shed upon this soil! Honorable knights, slain defending their lives - our lives!',14594,0,0,0,'Highlord Tirion Fordring'), + (-1609262, 'And while such things can never be forgotten, we must remain vigilant in our cause!',14595,0,0,0,'Highlord Tirion Fordring'), + (-1609263, 'The Lich King must answer for what he has done and must not be allowed to cause further destruction to our world.',14596,0,0,0,'Highlord Tirion Fordring'), + (-1609264, 'I make a promise to you now, brothers and sisters: The Lich King will be defeated! On this day, I call for a union.',14597,0,0,0,'Highlord Tirion Fordring'), + (-1609265, 'The Argent Dawn and the Order of the Silver Hand will come together as one! We will succeed where so many before us have failed!',14598,0,0,0,'Highlord Tirion Fordring'), + (-1609266, 'We will take the fight to Arthas and tear down the walls of Icecrown!',14599,0,0,15,'Highlord Tirion Fordring'), + (-1609267, 'The Argent Crusade comes for you, Arthas!',14600,1,0,15,'Highlord Tirion Fordring'), + (-1609268, 'So too do the Knights of the Ebon Blade... While our kind has no place in your world, we will fight to bring an end to the Lich King. This I vow!',14710,0,0,1,'Highlord Darion Mograine'), +-- Emotes + (-1609269, 'Thousands of Scourge rise up at the Highlord\'s command.',0,2,0,0,''), + (-1609270, 'The army marches towards Light\'s Hope Chapel.',0,2,0,0,''), + (-1609271, 'After over a hundred Defenders of the Light fall, Highlord Tirion Fordring arrives.',0,2,0,0,''), + (-1609272, 'flee',0,2,0,0,'Orbaz'), + (-1609273, 'kneels in defeat before Tirion Fordring.',0,2,0,0,'Highlord Darion Mograine'), + (-1609274, 'arrives.',0,2,0,0,'Highlord Alexandros Mograine'), + (-1609275, 'becomes a shade of his past, and walks up to his father.',0,2,0,0,'Highlord Darion Mograine'), + (-1609276, 'hugs his father.',0,2,0,0,'Darion Mograine'), + (-1609277, 'disappears, and the Lich King appears.',0,2,0,0,'Alexandros'), + (-1609278, 'becomes himself again...and is now angry.',0,2,0,0,'Highlord Darion Mograine'), + (-1609279, 'casts a spell on Tirion.',0,2,0,0,'The Lich King'), + (-1609280, 'gasps for air.',0,2,0,0,'Highlord Tirion Fordring'), + (-1609281, 'casts a powerful spell, killing the Defenders and knocking back the others.',0,2,0,0,'The Lich King'), + (-1609282, 'throws the Corrupted Ashbringer to Tirion, who catches it. Tirion becomes awash with Light, and the Ashbringer is cleansed.',0,2,0,0,'Highlord Darion Mograine'), + (-1609283, 'collapses.',0,2,0,0,'Highlord Darion Mograine'), + (-1609284, 'charges towards the Lich King, Ashbringer in hand and strikes the Lich King.',0,2,0,0,'Highlord Tirion Fordring'), + (-1609285, 'disappears. Tirion walks over to where Darion lay',0,2,0,0,'The Lich King'), + (-1609286, 'Light washes over the chapel ˇX the Light of Dawn is uncovered.',0,2,0,0,''); + + +DELETE FROM script_waypoint WHERE entry=29173; +INSERT INTO script_waypoint VALUES + (29173, 0, 2431.639, -5137.05, 83.843, 0, 'intro'), + (29173, 1, 2319.242, -5266.486, 82.825, 0, 'summon & on hold'), + (29173, 2, 2318.775, -5266.832, 82.783, 0, 'cast light of dawn'), + (29173, 3, 2280.812, -5284.091, 82.608, 0, 'move to here and start'), + (29173, 4, 2280.727, -5286.839, 82.930, 0, 'move forward to talk'), + (29173, 5, 2280.812, -5284.091, 82.608, 0, 'when baba pop'), + (29173, 6, 2281.461, -5263.014, 81.164, 0, 'charge to lich king'), + (29173, 7, 2257.479, -5296.702, 82.165, 0, 'being kicked by Lich King'), + (29173, 8, 2261.237, -5294.983, 82.167, 0, 'throw'), + (29173, 9, 2259.34, -5294.379, 82.167, 0, 'event end'); diff --git a/sql/updates/3.1.3_old/5188_world_scripts.sql b/sql/updates/3.1.3_old/5188_world_scripts.sql new file mode 100644 index 0000000..c04a3be --- /dev/null +++ b/sql/updates/3.1.3_old/5188_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `mechanic_immune_mask` = 617299803 WHERE `entry` = 24850; diff --git a/sql/updates/3.1.3_old/5189_character_updates_dual_spec.sql b/sql/updates/3.1.3_old/5189_character_updates_dual_spec.sql new file mode 100644 index 0000000..b9790e0 --- /dev/null +++ b/sql/updates/3.1.3_old/5189_character_updates_dual_spec.sql @@ -0,0 +1,10 @@ + +/* Begin intentional error */ +"Run 5189_character_updates_dual_spec.sql manually, or don't run it at all. This is only intended for people who need to clean up missed skills from r5036. If you never used r5036 - 5188, ignore this. Tell your users to reset their talents (or just switch specs) to fix their talent points."; + +/* + +-- Machiavelli & Nonox - Some missed talents: +DELETE FROM `character_spell` WHERE `spell` IN (3674,5420,9800,19263,20927,20928,20929,20930,24905,27174,27179,31904,32699,32700,33072,33891,34123,48359,48824,48825,48826,48827,48951,48952,50170,50171,50172,50306,50536,51373,51374,51375,51376,51378,51379,52881,53640,55265,55270,55271,57019,57224,62795,63668,63669,63670,63671,63672,64299,65139); + +*/ diff --git a/sql/updates/3.1.3_old/5216_world_scripts.sql b/sql/updates/3.1.3_old/5216_world_scripts.sql new file mode 100644 index 0000000..2fb3f58 --- /dev/null +++ b/sql/updates/3.1.3_old/5216_world_scripts.sql @@ -0,0 +1,38 @@ +UPDATE creature_template SET ScriptName='npc_ringo' WHERE entry=9999; +UPDATE creature_template SET ScriptName='npc_kerlonian' WHERE entry=11218; + +UPDATE script_texts SET content_default='Well, I\'m not sure how far I\'ll make it in this state... I\'m feeling kind of faint...', comment='ringo SAY_RIN_START_1' WHERE entry=-1000416; +UPDATE script_texts SET content_default='Remember, if I faint again, the water that Spraggle gave you will revive me.', comment='ringo SAY_RIN_START_2' WHERE entry=-1000417; +UPDATE script_texts SET content_default='The heat... I can\'t take it...', comment='ringo SAY_FAINT_1' WHERE entry=-1000418; +UPDATE script_texts SET content_default='Maybe... you could carry me?', comment='ringo SAY_FAINT_2' WHERE entry=-1000419; + +DELETE FROM script_texts WHERE entry BETWEEN -1000433 AND -1000420; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000420,'Uuuuuuggggghhhhh....',0,0,0,0,'ringo SAY_FAINT_3'), +(-1000421,'I\'m not feeling so well...',0,0,0,0,'ringo SAY_FAINT_4'), +(-1000422,'Where... Where am I?',0,0,0,0,'ringo SAY_WAKE_1'), +(-1000423,'I am feeling a little better now, thank you.',0,0,0,0,'ringo SAY_WAKE_2'), +(-1000424,'Yes, I must go on.',0,0,0,0,'ringo SAY_WAKE_3'), +(-1000425,'How am I feeling? Quite soaked, thank you.',0,0,0,0,'ringo SAY_WAKE_4'), +(-1000426,'Spraggle! I didn\'t think I\'d make it back!',0,0,0,0,'ringo SAY_RIN_END_1'), +(-1000427,'Ringo! You\'re okay!',0,0,0,0,'ringo SAY_SPR_END_2'), +(-1000428,'Oh... I\'m feeling faint...',0,0,0,0,'ringo SAY_RIN_END_3'), +(-1000429,'%s collapses onto the ground.',0,2,0,0,'ringo EMOTE_RIN_END_4'), +(-1000430,'%s stands up after a short pause.',0,2,0,0,'ringo EMOTE_RIN_END_5'), +(-1000431,'Ugh.',0,0,0,0,'ringo SAY_RIN_END_6'), +(-1000432,'Ringo? Wake up! Don\'t worry, I\'ll take care of you.',0,0,0,0,'ringo SAY_SPR_END_7'), +(-1000433,'%s fades away after a long pause.',0,2,0,0,'ringo EMOTE_RIN_END_8'); + +DELETE FROM script_texts WHERE entry BETWEEN -1000444 AND -1000434; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000434,'Liladris has been waiting for me at Maestra\'s Post, so we should make haste, $N.',0,0,0,0,'kerlonian SAY_KER_START'), +(-1000435,'%s looks very sleepy...',0,2,0,0,'kerlonian EMOTE_KER_SLEEP_1'), +(-1000436,'%s suddenly falls asleep',0,2,0,0,'kerlonian EMOTE_KER_SLEEP_2'), +(-1000437,'%s begins to drift off...',0,2,0,0,'kerlonian EMOTE_KER_SLEEP_3'), +(-1000438,'This looks like the perfect place for a nap...',0,0,0,0,'kerlonian SAY_KER_SLEEP_1'), +(-1000439,'Yaaaaawwwwwnnnn...',0,0,0,0,'kerlonian SAY_KER_SLEEP_2'), +(-1000440,'Oh, I am so tired...',0,0,0,0,'kerlonian SAY_KER_SLEEP_3'), +(-1000441,'You don\'t mind if I stop here for a moment, do you?',0,0,0,0,'kerlonian SAY_KER_SLEEP_4'), +(-1000442,'Be on the alert! The Blackwood furbolgs are numerous in the area...',0,0,0,0,'kerlonian SAY_KER_ALERT_1'), +(-1000443,'It\'s quiet... Too quiet...',0,0,0,0,'kerlonian SAY_KER_ALERT_2'), +(-1000444,'Oh, I can see Liladris from here... Tell her I\'m here, won\'t you?',0,0,0,0,'kerlonian SAY_KER_END'); diff --git a/sql/updates/3.1.3_old/5217_world_scripts.sql b/sql/updates/3.1.3_old/5217_world_scripts.sql new file mode 100644 index 0000000..2cc8543 --- /dev/null +++ b/sql/updates/3.1.3_old/5217_world_scripts.sql @@ -0,0 +1,3 @@ +DELETE FROM script_texts WHERE entry=-1000445; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1000445,'%s wakes up!',0,2,0,0,'kerlonian EMOTE_KER_AWAKEN'); diff --git a/sql/updates/3.1.3_old/5230_world_TDB.sql b/sql/updates/3.1.3_old/5230_world_TDB.sql new file mode 100644 index 0000000..40bda3e --- /dev/null +++ b/sql/updates/3.1.3_old/5230_world_TDB.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `npcflag` = `npcflag`|1 WHERE `entry` = 29811; diff --git a/sql/updates/3.1.3_old/5230_world_scripts.sql b/sql/updates/3.1.3_old/5230_world_scripts.sql new file mode 100644 index 0000000..1426ce6 --- /dev/null +++ b/sql/updates/3.1.3_old/5230_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_frostborn_scout' WHERE `entry` = 29811; diff --git a/sql/updates/3.1.3_old/5234_world_scripts.sql b/sql/updates/3.1.3_old/5234_world_scripts.sql new file mode 100644 index 0000000..d7bbfb8 --- /dev/null +++ b/sql/updates/3.1.3_old/5234_world_scripts.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_agnetta_tyrsdottar' WHERE `entry` = 30154; + +INSERT INTO `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(-1571003, 'I\'m not afraid of anything -- bring it on!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'aggro_Agnetta'); diff --git a/sql/updates/3.1.3_old/5237_world_scripts.sql b/sql/updates/3.1.3_old/5237_world_scripts.sql new file mode 100644 index 0000000..9efefa4 --- /dev/null +++ b/sql/updates/3.1.3_old/5237_world_scripts.sql @@ -0,0 +1,6 @@ +UPDATE `creature_template` SET `ScriptName` = 'boss_steelbreaker' WHERE `entry` = '32867'; +UPDATE `creature_template` SET `ScriptName` = 'boss_runemaster_molgeim' WHERE `entry` = '32927'; +UPDATE `creature_template` SET `ScriptName` = 'boss_stormcaller_brundir' WHERE `entry` = '32857'; +UPDATE `creature_template` SET `ScriptName` = 'mob_lightning_elemental' WHERE `entry` = '32958'; +UPDATE `creature_template` SET `ScriptName` = 'mob_rune_of_summoning' WHERE `entry` = '33051'; +UPDATE `instance_template` SET `script` = 'instance_ulduar' WHERE `map` = '603'; diff --git a/sql/updates/3.1.3_old/5246_world_scripts.sql b/sql/updates/3.1.3_old/5246_world_scripts.sql new file mode 100644 index 0000000..5d9ef37 --- /dev/null +++ b/sql/updates/3.1.3_old/5246_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_avatar_of_freya' WHERE `entry`=27801; diff --git a/sql/updates/3.1.3_old/5254_world_scripts.sql b/sql/updates/3.1.3_old/5254_world_scripts.sql new file mode 100644 index 0000000..6b519bc --- /dev/null +++ b/sql/updates/3.1.3_old/5254_world_scripts.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_taxi' WHERE `entry` = 26602; diff --git a/sql/updates/3.1.3_old/5270_world_script_waypoint.sql b/sql/updates/3.1.3_old/5270_world_script_waypoint.sql new file mode 100644 index 0000000..176bab3 --- /dev/null +++ b/sql/updates/3.1.3_old/5270_world_script_waypoint.sql @@ -0,0 +1,28 @@ +DELETE FROM script_waypoint WHERE entry = 24156; +INSERT INTO script_waypoint VALUES +(24156,1,1859.74, -6178.15, 24.3033, 0, ''), +(24156,2,1866.06, -6172.81, 23.9216, 0, ''), +(24156,3,1876.43, -6167.42, 23.7332, 0, ''), +(24156,4,1903.37, -6167.9, 23.312, 0, ''), +(24156,5,1934.43, -6168.46, 23.7148, 0, ''), +(24156,6,1942.38, -6168.21, 23.7133, 0, ''), +(24156,7,1953.48, -6172.4, 24.2785, 0, ''), +(24156,8,1969.21, -6179.69, 23.8501, 0, ''), +(24156,9,1992.18, -6177.24, 21.3992, 0, ''), +(24156,10,2015.73, -6174.73, 15.3766, 0, ''), +(24156,11,2016.99, -6156.39, 12.5927, 0, ''), +(24156,12,2018.14, -6130.62, 6.31995, 0, ''), +(24156,13,2043.73, -6119.18, 5.17474, 0, ''), +(24156,14,2080.99, -6100.03, 7.72235, 0, ''), +(24156,15,2115.47, -6096.21, 5.36958, 0, ''), +(24156,16,2130.36, -6151.59, 1.24893, 0, ''), +(24156,17,2160.5, -6098.78, 3.14191, 0, ''), +(24156,18,2161.26, -6101.38, 2.81571, 0, ''), +(24156,19,2172.54, -6108.54, 2.26422, 0, ''), +(24156,20,2206.69, -6110.46, 0.787735, 0, ''), +(24156,21,2228.23, -6090.02, 1.17018, 0, ''), +(24156,22,2262.76, -6056.79, 1.82852, 0, ''), +(24156,23,2285.54, -6046.96, 1.6305, 0, ''), +(24156,24,2298.05, -6041.56, 2.01465, 0, ''), +(24156,25,2307.53, -6031.23, 2.93796, 0, ''), +(24156,26,2309.46, -6024.45, 3.65369, 5000, ''); diff --git a/sql/updates/3.1.3_old/5270_world_scriptname.sql b/sql/updates/3.1.3_old/5270_world_scriptname.sql new file mode 100644 index 0000000..0328097 --- /dev/null +++ b/sql/updates/3.1.3_old/5270_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName = 'npc_plaguehound_tracker' WHERE entry = 24156; diff --git a/sql/updates/3.1.3_old/5305_world_scriptname.sql b/sql/updates/3.1.3_old/5305_world_scriptname.sql new file mode 100644 index 0000000..0aa6bce --- /dev/null +++ b/sql/updates/3.1.3_old/5305_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_keristrasza' WHERE `entry`=26206; diff --git a/sql/updates/3.1.3_old/5314_world_script_target.sql b/sql/updates/3.1.3_old/5314_world_script_target.sql new file mode 100644 index 0000000..564230f --- /dev/null +++ b/sql/updates/3.1.3_old/5314_world_script_target.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (62427,62374,62399); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(62427, 1, 33109), # Load into Catapult +(62374, 1, 33060), # Pursued +(62374, 1, 33109), +(62399, 1, 33139); # Overload Circuit diff --git a/sql/updates/3.1.3_old/5314_world_scriptname.sql b/sql/updates/3.1.3_old/5314_world_scriptname.sql new file mode 100644 index 0000000..db260cc --- /dev/null +++ b/sql/updates/3.1.3_old/5314_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE creature_template SET scriptname = "spell_pool_of_tar" WHERE entry = 33090; diff --git a/sql/updates/3.1.3_old/5314_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/5314_world_spell_linked_spell.sql new file mode 100644 index 0000000..65f9c1b --- /dev/null +++ b/sql/updates/3.1.3_old/5314_world_spell_linked_spell.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-62475,62427); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(-62475,-62399, 0, 'System Shutdown'), +(-62475, 62472, 0, 'System Shutdown'), #inform, not correct spell +( 62427, 62340, 2, 'Load into Catapult - Passenger Loaded'); diff --git a/sql/updates/3.1.3_old/5321_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5321_world_spell_proc_event.sql new file mode 100644 index 0000000..7403b78 --- /dev/null +++ b/sql/updates/3.1.3_old/5321_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (54815,54845,56800); +INSERT INTO `spell_proc_event` VALUES +( 54815, 0x00, 7, 0x00008000, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Glyph of Shred +( 54845, 0x00, 7, 0x00000004, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Glyph of Starfire +( 56800, 0x00, 8, 0x00800004, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0); -- Glyph of Backstab diff --git a/sql/updates/3.1.3_old/5330_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5330_world_spell_proc_event.sql new file mode 100644 index 0000000..ae05ed2 --- /dev/null +++ b/sql/updates/3.1.3_old/5330_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` = 54832; +INSERT INTO spell_proc_event VALUES +( 54832, 0x00, 7, 0x00000000, 0x00001000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0); -- Glyph of Innervate diff --git a/sql/updates/3.1.3_old/5332_world_ainame.sql b/sql/updates/3.1.3_old/5332_world_ainame.sql new file mode 100644 index 0000000..566cf99 --- /dev/null +++ b/sql/updates/3.1.3_old/5332_world_ainame.sql @@ -0,0 +1,2 @@ +update creature_template set AIName = 'ArchorAI', scriptname='' where entry in (29102,29103); +update creature_template set AIName = 'TurretAI', scriptname='' where entry = 29104; diff --git a/sql/updates/3.1.3_old/5352_world_spell_elixir.sql b/sql/updates/3.1.3_old/5352_world_spell_elixir.sql new file mode 100644 index 0000000..6e225e1 --- /dev/null +++ b/sql/updates/3.1.3_old/5352_world_spell_elixir.sql @@ -0,0 +1,13 @@ +-- mangos rev 8399 +-- ALTER TABLE db_version CHANGE COLUMN required_8397_02_mangos_spell_threat required_8399_01_mangos_spell_elixir bit; + +-- Well Fed (SPELLFAMILY_POTION) +DELETE FROM spell_elixir WHERE entry IN (18191, 18192, 18193, 18194, 18222, 22730, 25661); +INSERT INTO spell_elixir (entry, mask) VALUES +(18191,0x10), +(18192,0x10), +(18193,0x10), +(18194,0x10), +(18222,0x10), +(22730,0x10), +(25661,0x10); diff --git a/sql/updates/3.1.3_old/5353_characters_character_spell.sql b/sql/updates/3.1.3_old/5353_characters_character_spell.sql new file mode 100644 index 0000000..354cb1f --- /dev/null +++ b/sql/updates/3.1.3_old/5353_characters_character_spell.sql @@ -0,0 +1,6 @@ +-- mangos rev 8397 +-- ALTER TABLE character_db_version CHANGE COLUMN required_8339_02_characters_character_battleground_data required_8397_03_characters_character_spell bit; + +UPDATE IGNORE character_spell SET spell=7386 WHERE spell IN (7405,8380,11596,11597,25225,47467); +UPDATE character_spell SET active=1 WHERE spell=7386; +DELETE FROM character_spell WHERE spell IN (7405,8380,11596,11597,25225,47467); diff --git a/sql/updates/3.1.3_old/5353_world_spell_threat.sql b/sql/updates/3.1.3_old/5353_world_spell_threat.sql new file mode 100644 index 0000000..0a3c441 --- /dev/null +++ b/sql/updates/3.1.3_old/5353_world_spell_threat.sql @@ -0,0 +1,4 @@ +-- mangos rev 8397 +-- ALTER TABLE db_version CHANGE COLUMN required_8397_01_mangos_spell_chain required_8397_02_mangos_spell_threat bit; + +DELETE FROM spell_threat WHERE entry IN (7405,8380,11596,11597,25225); diff --git a/sql/updates/3.1.3_old/5354_characters_guild_bank_eventlog.sql b/sql/updates/3.1.3_old/5354_characters_guild_bank_eventlog.sql new file mode 100644 index 0000000..8263b05 --- /dev/null +++ b/sql/updates/3.1.3_old/5354_characters_guild_bank_eventlog.sql @@ -0,0 +1,24 @@ +-- mangos rev 8402 +-- ALTER TABLE character_db_version CHANGE COLUMN required_8402_01_characters_guild_eventlog required_8402_02_characters_guild_bank_eventlog bit; + + +-- THIS SCRIPT DELETES table `guild_bank_eventlog` - MAKE BACKUP, if you need it. + +DROP TABLE IF EXISTS `guild_bank_eventlog`; +CREATE TABLE `guild_bank_eventlog` ( + `guildid` int(11) unsigned NOT NULL default '0' COMMENT 'Guild Identificator', + `LogGuid` int(11) unsigned NOT NULL default '0' COMMENT 'Log record identificator - auxiliary column', + `TabId` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Guild bank TabId', + `EventType` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Event type', + `PlayerGuid` int(11) unsigned NOT NULL default '0', + `ItemOrMoney` int(11) unsigned NOT NULL default '0', + `ItemStackCount` tinyint(3) unsigned NOT NULL default '0', + `DestTabId` tinyint(1) unsigned NOT NULL default '0' COMMENT 'Destination Tab Id', + `TimeStamp` bigint(20) unsigned NOT NULL default '0' COMMENT 'Event UNIX time', + PRIMARY KEY (`guildid`,`LogGuid`,`TabId`), + KEY `guildid_key` (`guildid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- The reason i decided for such dramatic change is that old guild_bank_eventlog table used `TabId` = 0 for Money events and +-- used `LogGuid` from 0 to infinity +-- New system uses `LogGuid` from 0 to number defined in config. diff --git a/sql/updates/3.1.3_old/5354_characters_guild_eventlog.sql b/sql/updates/3.1.3_old/5354_characters_guild_eventlog.sql new file mode 100644 index 0000000..65cfcf1 --- /dev/null +++ b/sql/updates/3.1.3_old/5354_characters_guild_eventlog.sql @@ -0,0 +1,21 @@ +-- mangos rev 8402 +-- ALTER TABLE character_db_version CHANGE COLUMN required_8397_03_characters_character_spell required_8402_01_characters_guild_eventlog bit; + + +-- THIS SCRIPT DELETES table `guild_eventlog` - MAKE BACKUP, if you need it. + +DROP TABLE IF EXISTS `guild_eventlog`; +CREATE TABLE `guild_eventlog` ( + `guildid` int(11) NOT NULL COMMENT 'Guild Identificator', + `LogGuid` int(11) NOT NULL COMMENT 'Log record identificator - auxiliary column', + `EventType` tinyint(1) NOT NULL COMMENT 'Event type', + `PlayerGuid1` int(11) NOT NULL COMMENT 'Player 1', + `PlayerGuid2` int(11) NOT NULL COMMENT 'Player 2', + `NewRank` tinyint(2) NOT NULL COMMENT 'New rank(in case promotion/demotion)', + `TimeStamp` bigint(20) NOT NULL COMMENT 'Event UNIX time', + PRIMARY KEY (`guildid`, `LogGuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'Guild Eventlog'; + +-- The reason i decided for such dramatic change is that old guild_eventlog table didn't have Primary key and +-- used LogGuids from 0 to infinity +-- New system uses LogGuids from 0 to number defined in config. diff --git a/sql/updates/3.1.3_old/5360_characters_guild.sql b/sql/updates/3.1.3_old/5360_characters_guild.sql new file mode 100644 index 0000000..fd6849e --- /dev/null +++ b/sql/updates/3.1.3_old/5360_characters_guild.sql @@ -0,0 +1,18 @@ +-- mangos rev 8409 +-- ALTER TABLE character_db_version CHANGE COLUMN required_8402_02_characters_guild_bank_eventlog required_8409_01_characters_guild bit; + + +-- Change createdate column type from datetime to bigint(20) + +-- add temporary column +ALTER TABLE guild ADD COLUMN created_temp bigint(20) default '0'; +-- update temporary columns data +UPDATE guild SET created_temp = UNIX_TIMESTAMP(createdate); +-- drop current column +ALTER TABLE guild DROP COLUMN createdate; +-- create new column with correct type +ALTER TABLE guild ADD COLUMN createdate bigint(20) NOT NULL default '0' AFTER motd; +-- copy data to new column +UPDATE guild set createdate = created_temp; +-- remove old column +ALTER TABLE guild DROP COLUMN created_temp; diff --git a/sql/updates/3.1.3_old/5361_world_trinity_string.sql b/sql/updates/3.1.3_old/5361_world_trinity_string.sql new file mode 100644 index 0000000..bfacdc8 --- /dev/null +++ b/sql/updates/3.1.3_old/5361_world_trinity_string.sql @@ -0,0 +1,7 @@ +-- mangos rev 8412 +-- ALTER TABLE db_version CHANGE COLUMN required_8399_01_mangos_spell_elixir required_8412_01_mangos_mangos_string bit; + +DELETE FROM trinity_string WHERE entry IN(512,513); +INSERT INTO trinity_string VALUES +(512,'%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0:0|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(513,'%d - |cffffffff|Hquest:%d:%d|h[%s]|h|r %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.1.3_old/5403_world_scriptname.sql b/sql/updates/3.1.3_old/5403_world_scriptname.sql new file mode 100644 index 0000000..08b7792 --- /dev/null +++ b/sql/updates/3.1.3_old/5403_world_scriptname.sql @@ -0,0 +1 @@ +update creature_template set ScriptName = 'boss_kologarn' where entry = 32930; diff --git a/sql/updates/3.1.3_old/5403_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/5403_world_spell_linked_spell.sql new file mode 100644 index 0000000..86c1b19 --- /dev/null +++ b/sql/updates/3.1.3_old/5403_world_spell_linked_spell.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-62475,62427); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(-62475,-62399, 0, 'System Shutdown - Overload Circuit'), +(-62475,-62375, 0, 'System Shutdown - Gathering Speed'), +(-62475, 62472, 0, 'System Shutdown'), #inform, not correct spell +( 62427, 62340, 2, 'Load into Catapult - Passenger Loaded'); diff --git a/sql/updates/3.1.3_old/5410_world_spell_dbc.sql b/sql/updates/3.1.3_old/5410_world_spell_dbc.sql new file mode 100644 index 0000000..31f648d --- /dev/null +++ b/sql/updates/3.1.3_old/5410_world_spell_dbc.sql @@ -0,0 +1,101 @@ +DROP TABLE IF EXISTS `spell_dbc`; +CREATE TABLE `spell_dbc` ( + `Id` INT UNSIGNED NOT NULL, + `Dispel` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `Mechanic` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `Attributes` INT UNSIGNED NOT NULL DEFAULT 0, + `AttributesEx` INT UNSIGNED NOT NULL DEFAULT 0, + `AttributesEx2` INT UNSIGNED NOT NULL DEFAULT 0, + `AttributesEx3` INT UNSIGNED NOT NULL DEFAULT 0, + `AttributesEx4` INT UNSIGNED NOT NULL DEFAULT 0, + `AttributesEx5` INT UNSIGNED NOT NULL DEFAULT 0, + `Targets` INT UNSIGNED NOT NULL DEFAULT 0, + `CastingTimeIndex` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `AuraInterruptFlags` INT UNSIGNED NOT NULL DEFAULT 0, + `ProcFlags` INT UNSIGNED NOT NULL DEFAULT 0, + `ProcChance` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `ProcCharges` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `MaxLevel` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `BaseLevel` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `SpellLevel` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `DurationIndex` SMALLINT UNSIGNED NOT NULL DEFAULT 0, + `RangeIndex` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `StackAmount` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EquippedItemClass` INT NOT NULL DEFAULT -1, + `EquippedItemSubClassMask` INT NOT NULL DEFAULT 0 DEFAULT 0, + `EquippedItemInventoryTypeMask` INT NOT NULL DEFAULT 0 DEFAULT 0, + `Effect1` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `Effect2` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `Effect3` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectDieSides1` INT NOT NULL DEFAULT 0, + `EffectDieSides2` INT NOT NULL DEFAULT 0, + `EffectDieSides3` INT NOT NULL DEFAULT 0, + `EffectBaseDice1` INT NOT NULL DEFAULT 0, + `EffectBaseDice2` INT NOT NULL DEFAULT 0, + `EffectBaseDice3` INT NOT NULL DEFAULT 0, + `EffectDicePerLevel1` FLOAT NOT NULL DEFAULT 0, + `EffectDicePerLevel2` FLOAT NOT NULL DEFAULT 0, + `EffectDicePerLevel3` FLOAT NOT NULL DEFAULT 0, + `EffectRealPointsPerLevel1` FLOAT NOT NULL DEFAULT 0, + `EffectRealPointsPerLevel2` FLOAT NOT NULL DEFAULT 0, + `EffectRealPointsPerLevel3` FLOAT NOT NULL DEFAULT 0, + `EffectBasePoints1` INT NOT NULL DEFAULT 0, + `EffectBasePoints2` INT NOT NULL DEFAULT 0, + `EffectBasePoints3` INT NOT NULL DEFAULT 0, + `EffectMechanic1` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectMechanic2` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectMechanic3` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectImplicitTargetA1` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectImplicitTargetA2` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectImplicitTargetA3` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectImplicitTargetB1` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectImplicitTargetB2` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectImplicitTargetB3` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectRadiusIndex1` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectRadiusIndex2` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectRadiusIndex3` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `EffectApplyAuraName1` SMALLINT UNSIGNED NOT NULL DEFAULT 0, + `EffectApplyAuraName2` SMALLINT UNSIGNED NOT NULL DEFAULT 0, + `EffectApplyAuraName3` SMALLINT UNSIGNED NOT NULL DEFAULT 0, + `EffectAmplitude1` INT NOT NULL DEFAULT 0, + `EffectAmplitude2` INT NOT NULL DEFAULT 0, + `EffectAmplitude3` INT NOT NULL DEFAULT 0, + `EffectMultipleValue1` FLOAT NOT NULL DEFAULT 0, + `EffectMultipleValue2` FLOAT NOT NULL DEFAULT 0, + `EffectMultipleValue3` FLOAT NOT NULL DEFAULT 0, + `EffectMiscValue1` INT NOT NULL DEFAULT 0, + `EffectMiscValue2` INT NOT NULL DEFAULT 0, + `EffectMiscValue3` INT NOT NULL DEFAULT 0, + `EffectMiscValueB1` INT NOT NULL DEFAULT 0, + `EffectMiscValueB2` INT NOT NULL DEFAULT 0, + `EffectMiscValueB3` INT NOT NULL DEFAULT 0, + `EffectTriggerSpell1` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectTriggerSpell2` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectTriggerSpell3` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskA1` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskA2` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskA3` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskB1` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskB2` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskB3` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskC1` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskC2` INT UNSIGNED NOT NULL DEFAULT 0, + `EffectSpellClassMaskC3` INT UNSIGNED NOT NULL DEFAULT 0, + `MaxTargetLevel` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `SpellFamilyName` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `SpellFamilyFlags1` INT UNSIGNED NOT NULL DEFAULT 0, + `SpellFamilyFlags2` INT UNSIGNED NOT NULL DEFAULT 0, + `SpellFamilyFlags3` INT UNSIGNED NOT NULL DEFAULT 0, + `MaxAffectedTargets` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `DmgClass` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `PreventionType` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `DmgMultiplier1` FLOAT NOT NULL DEFAULT 0, + `DmgMultiplier2` FLOAT NOT NULL DEFAULT 0, + `DmgMultiplier3` FLOAT NOT NULL DEFAULT 0, + `AreaGroupId` INT NOT NULL DEFAULT 0, + `SchoolMask` INT UNSIGNED NOT NULL DEFAULT 0, + `Comment` TEXT NOT NULL, + PRIMARY KEY (`id`) +)ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom spell.dbc entries'; + +INSERT INTO `spell_dbc` (`Id`, `DurationIndex`, `Effect1`, `EffectImplicitTargetA1`, `EffectApplyAuraName1`, `Comment`) VALUES (62388, 21, 6, 1, 4, 'Demonic Circle: Teleport(48020) - casterAuraSpell'); diff --git a/sql/updates/3.1.3_old/5416_world_spell_dbc.sql b/sql/updates/3.1.3_old/5416_world_spell_dbc.sql new file mode 100644 index 0000000..15af83e --- /dev/null +++ b/sql/updates/3.1.3_old/5416_world_spell_dbc.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_dbc` WHERE `Id` IN(65142); +INSERT INTO `spell_dbc` (`Id`, `Dispel`, `Mechanic`, `AttributesEx3`, `DurationIndex`, `RangeIndex`, `Effect1`, `EffectImplicitTargetA1`, `EffectApplyAuraName1`, `EffectMiscValue1`, `SpellFamilyName`, `SchoolMask`, `Comment`) VALUES +(65142, 3, 22, 0x00000080, 21, 13, 6, 6, 255, 22, 15, 8, 'Crypt Fever - SPELL_AURA_LINKED'); diff --git a/sql/updates/3.1.3_old/5426_world_spell_learn_spell.sql b/sql/updates/3.1.3_old/5426_world_spell_learn_spell.sql new file mode 100644 index 0000000..235ffeb --- /dev/null +++ b/sql/updates/3.1.3_old/5426_world_spell_learn_spell.sql @@ -0,0 +1,22 @@ +-- mangos rev 8416 +-- ALTER TABLE db_version CHANGE COLUMN required_8412_01_mangos_mangos_string required_8416_01_mangos_spell_learn_spell bit; + +/* All form passives */ +DELETE FROM spell_learn_spell WHERE SpellID in ( +1178, /* Bear Form (Passive) */ +3025, /* Cat Form (Passive) */ +5419, /* Travel Form (Passive) */ +5420, /* Tree of Life _passive_ */ +5421, /* Aquatic Form (Passive) */ +7376, /* Defensive Stance Passive */ +7381, /* Berserker Stance Passive */ +9635, /* Dire Bear Form (Passive) */ +21156, /* Battle Stance Passive */ +21178, /* Bear Form (Passive2) */ +24905, /* Moonkin Form (Passive) */ +34123, /* Tree of Life _pasive_ */ +33948, /* Flight Form (Passive) */ +34764, /* Flight Form (Passive) */ +40121, /* Swift Flight Form (Passive) */ +40122 /* Swift Flight Form (Passive) */ +); diff --git a/sql/updates/3.1.3_old/5435_world_spell_script_target.sql b/sql/updates/3.1.3_old/5435_world_spell_script_target.sql new file mode 100644 index 0000000..c449fca --- /dev/null +++ b/sql/updates/3.1.3_old/5435_world_spell_script_target.sql @@ -0,0 +1,3 @@ +# Chicken Net +DELETE FROM `spell_script_target` WHERE `entry` = '51959'; +INSERT INTO `spell_script_target` ( `entry`, `type`, `targetEntry`) VALUES ('51959', '1', '28161'); diff --git a/sql/updates/3.1.3_old/5441_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/5441_world_spell_bonus_data.sql new file mode 100644 index 0000000..a51c550 --- /dev/null +++ b/sql/updates/3.1.3_old/5441_world_spell_bonus_data.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN(53733, 31804); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(53733, 0.22, -1, 0.14, -1, 'Paladin - Judgement of Corruption'), +(31804, 0.22, -1, 0.14, -1, 'Paladin - Judgement of Vengeance'); diff --git a/sql/updates/3.1.3_old/5445_world_spell_enchant_proc_data.sql b/sql/updates/3.1.3_old/5445_world_spell_enchant_proc_data.sql new file mode 100644 index 0000000..a4d885a --- /dev/null +++ b/sql/updates/3.1.3_old/5445_world_spell_enchant_proc_data.sql @@ -0,0 +1,36 @@ +DELETE FROM `spell_enchant_proc_data` WHERE `entry` IN(803, 912, 1894, 1898, 1899, 1900, 2673, 2675, 3225, 3239, 3241, 3273, 3368, 3369, 3789, 3869); +INSERT INTO spell_enchant_proc_data (`entry`, `customChance`, `PPMChance`,`procEx`) VALUES + -- Fiery Weapon +(803, 0, 6.0,0), + -- Demonslaying +(912, 0, 6.0,0), + -- Icy Weapon +(1894, 0, 3.0,0), + -- Lifestealing +(1898, 0, 6.0,0), + -- Unholy Weapon +(1899, 0, 1.0,0), + -- Crusader +(1900, 0, 1.0,0), + -- Mongoose +(2673, 0, 1.0,0), + -- Battlemaster +(2675, 0, 1.0,0), + -- Executioner +(3225, 0, 1.0,0), + -- Icebreaker Weapon +(3239, 0, 3.0,0), + -- Lifeward +(3241, 0, 3.0,0), + -- Giantslaying +(3251, 0, 3.0,0), + -- Deathfrost +(3273, 0, 3.0,0), + -- Rune of the Fallen Crusader +(3368, 0, 1.0,0), + -- Rune of Cinderglacier +(3369, 0, 1.0,0), + -- Berserking +(3789, 0, 1.0,0), + -- Blade Ward +(3869, 0, 1.0,0); diff --git a/sql/updates/3.1.3_old/5445_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5445_world_spell_proc_event.sql new file mode 100644 index 0000000..eca1f2b --- /dev/null +++ b/sql/updates/3.1.3_old/5445_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN(47569, 47570); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Shadowform (Rank 1) +( 47570, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0); -- Improved Shadowform (Rank 2) diff --git a/sql/updates/3.1.3_old/5447_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/5447_world_spell_linked_spell.sql new file mode 100644 index 0000000..962cb84 --- /dev/null +++ b/sql/updates/3.1.3_old/5447_world_spell_linked_spell.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN(26022, 26023); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 26022, 61417, 2, 'Pursuit of Justice'), +( 26023, 61418, 2, 'Pursuit of Justice'); diff --git a/sql/updates/3.1.3_old/5448_world_spell_script_target.sql b/sql/updates/3.1.3_old/5448_world_spell_script_target.sql new file mode 100644 index 0000000..d1c5ed4 --- /dev/null +++ b/sql/updates/3.1.3_old/5448_world_spell_script_target.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (62056,63985); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(63985, 1, 32934), # Stone Grip +(62056, 1, 32934); diff --git a/sql/updates/3.1.3_old/5450_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5450_world_spell_proc_event.sql new file mode 100644 index 0000000..78bd7fa --- /dev/null +++ b/sql/updates/3.1.3_old/5450_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN(46913, 46914, 46915); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 46913, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Bloodsurge (Rank 1) +( 46914, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Bloodsurge (Rank 2) +( 46915, 0x00, 4, 0x00000040, 0x00000404, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Bloodsurge (Rank 3) diff --git a/sql/updates/3.1.3_old/5472_world_script_texts.sql b/sql/updates/3.1.3_old/5472_world_script_texts.sql new file mode 100644 index 0000000..e144bb8 --- /dev/null +++ b/sql/updates/3.1.3_old/5472_world_script_texts.sql @@ -0,0 +1,5 @@ +-- add missing sentence to Geezle's text & Overgrind's name to flag pickup emote --- Disabled due to script_texts being borked +-- delete from `script_texts` where `entry` in (-1000266,-1000259); +-- insert into `script_texts` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) values +-- ('-1000266','%s picks up the naga flag.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','2','0','0','geezle - EMOTE_SPARK'), +-- ('-1000259','What\'s the big idea, Spark? Why\'d you call for this meeting?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','0','0','geezle - GEEZLE_SAY_1'); diff --git a/sql/updates/3.1.3_old/5475_world_spell_script_target.sql b/sql/updates/3.1.3_old/5475_world_spell_script_target.sql new file mode 100644 index 0000000..8939ee1 --- /dev/null +++ b/sql/updates/3.1.3_old/5475_world_spell_script_target.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (62496); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(62496, 1, 33167); # Liquid Pyrite - Salvaged Demolisher Mechanic Seat diff --git a/sql/updates/3.1.3_old/5524_world_scriptname.sql b/sql/updates/3.1.3_old/5524_world_scriptname.sql new file mode 100644 index 0000000..b2f940a --- /dev/null +++ b/sql/updates/3.1.3_old/5524_world_scriptname.sql @@ -0,0 +1,2 @@ +update creature_template set ScriptName = 'npc_iruk' where entry = 26219; +UPDATE creature_template SET ScriptName = 'npc_corastrasza' WHERE entry = 32548; diff --git a/sql/updates/3.1.3_old/5524_world_spell_script_target.sql b/sql/updates/3.1.3_old/5524_world_spell_script_target.sql new file mode 100644 index 0000000..418a734 --- /dev/null +++ b/sql/updates/3.1.3_old/5524_world_spell_script_target.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_target` WHERE entry = 61245; +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(61245, 1, 32535); diff --git a/sql/updates/3.1.3_old/5532_characters_character_account_data.sql b/sql/updates/3.1.3_old/5532_characters_character_account_data.sql new file mode 100644 index 0000000..1a0e961 --- /dev/null +++ b/sql/updates/3.1.3_old/5532_characters_character_account_data.sql @@ -0,0 +1,17 @@ +-- mangos rev 8433 +-- ALTER TABLE character_db_version CHANGE COLUMN required_8409_01_characters_guild required_8433_01_characters_character_account_data bit; + +DROP TABLE IF EXISTS `character_account_data`; +CREATE TABLE `character_account_data` ( + `guid` int(11) unsigned NOT NULL default '0', + `type` int(11) unsigned NOT NULL default '0', + `time` bigint(11) unsigned NOT NULL default '0', + `data` longtext NOT NULL, + PRIMARY KEY (`guid`,`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO character_account_data +SELECT c.guid as guid, a.type as type, a.time as time, a.data as data +FROM characters c LEFT JOIN account_data a ON c.account = a.account WHERE a.type IN (1, 3, 5, 6, 7); + +DELETE FROM account_data WHERE type IN (1, 3, 5, 6, 7); diff --git a/sql/updates/3.1.3_old/5552_world_trinity_string.sql b/sql/updates/3.1.3_old/5552_world_trinity_string.sql new file mode 100644 index 0000000..3ee506b --- /dev/null +++ b/sql/updates/3.1.3_old/5552_world_trinity_string.sql @@ -0,0 +1,7 @@ +-- mangos rev 8444 +-- ALTER TABLE db_version CHANGE COLUMN required_8416_01_mangos_spell_learn_spell required_8444_01_mangos_mangos_string bit; + +DELETE FROM trinity_string WHERE entry IN(348,522); +INSERT INTO trinity_string VALUES +(348,'Game Object (Entry: %u) have invalid data and can\'t be spawned',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(522,'Game Object (Entry: %u) not found',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.1.3_old/5579_world_trinity_string.sql b/sql/updates/3.1.3_old/5579_world_trinity_string.sql new file mode 100644 index 0000000..fadf756 --- /dev/null +++ b/sql/updates/3.1.3_old/5579_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry`=326; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) +VALUES (326, 'Faction %s (%u) can''nt have reputation.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.1.3_old/5582_world_scriptname.sql b/sql/updates/3.1.3_old/5582_world_scriptname.sql new file mode 100644 index 0000000..84336ba --- /dev/null +++ b/sql/updates/3.1.3_old/5582_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_scarlet_ghoul' WHERE `entry`=28845; diff --git a/sql/updates/3.1.3_old/5595_world_script_texts.sql b/sql/updates/3.1.3_old/5595_world_script_texts.sql new file mode 100644 index 0000000..f99352c --- /dev/null +++ b/sql/updates/3.1.3_old/5595_world_script_texts.sql @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS `script_texts`; +CREATE TABLE `script_texts` ( + `npc_entry` mediumint(8) NOT NULL default '0' COMMENT 'creature_template entry', + `entry` mediumint(8) NOT NULL, + `content_default` text NOT NULL, + `content_loc1` text, + `content_loc2` text, + `content_loc3` text, + `content_loc4` text, + `content_loc5` text, + `content_loc6` text, + `content_loc7` text, + `content_loc8` text, + `sound` mediumint(8) unsigned NOT NULL default '0', + `type` tinyint(3) unsigned NOT NULL default '0', + `language` tinyint(3) unsigned NOT NULL default '0', + `emote` smallint(5) unsigned NOT NULL default '0', + `comment` text, + PRIMARY KEY (`npc_entry`,`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Texts'; + diff --git a/sql/updates/3.1.3_old/5610_world_scriptname.sql b/sql/updates/3.1.3_old/5610_world_scriptname.sql new file mode 100644 index 0000000..afeecbc --- /dev/null +++ b/sql/updates/3.1.3_old/5610_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_shallow_grave' WHERE `entry` IN (128308,128403); diff --git a/sql/updates/3.1.3_old/5612_world_scriptname.sql b/sql/updates/3.1.3_old/5612_world_scriptname.sql new file mode 100644 index 0000000..e98e3f4 --- /dev/null +++ b/sql/updates/3.1.3_old/5612_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_razael_and_lyana' WHERE `entry` IN (23778,23998); diff --git a/sql/updates/3.1.3_old/5613_world_script_texts.sql b/sql/updates/3.1.3_old/5613_world_script_texts.sql new file mode 100644 index 0000000..a99051c --- /dev/null +++ b/sql/updates/3.1.3_old/5613_world_script_texts.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1603000,-1603001,-1603002,-1603003,-1603004,-1603005,-1603006); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (27975,-1603000,'You shouldn''t have come...now you will die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13487,1,0,0,'maiden of grief SAY_AGGRO'), + (27975,-1603001,'Why must it be this way?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13488,1,0,0,'maiden of grief SAY_SLAY_1'), + (27975,-1603002,'You had it coming!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13489,1,0,0,'maiden of grief SAY_SLAY_2'), + (27975,-1603003,'My burden grows heavier.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13490,1,0,0,'maiden of grief SAY_SLAY_3'), + (27975,-1603004,'This is your own fault!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13491,1,0,0,'maiden of grief SAY_SLAY_4'), + (27975,-1603005,'I hope you all rot! I never...wanted...this.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13493,1,0,0,'maiden of grief SAY_DEATH'), + (27975,-1603006,'So much lost time... that you''ll never get back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13492,1,0,0,'maiden of grief SAY_STUN'); diff --git a/sql/updates/3.1.3_old/5613_world_scriptname.sql b/sql/updates/3.1.3_old/5613_world_scriptname.sql new file mode 100644 index 0000000..4333a9c --- /dev/null +++ b/sql/updates/3.1.3_old/5613_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_maiden_of_grief' WHERE `entry`=27975; diff --git a/sql/updates/3.1.3_old/5627_world_scriptname.sql b/sql/updates/3.1.3_old/5627_world_scriptname.sql new file mode 100644 index 0000000..ce3e18c --- /dev/null +++ b/sql/updates/3.1.3_old/5627_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_gymer' WHERE `entry`=29647; diff --git a/sql/updates/3.1.3_old/5628_characters_character_spell.sql b/sql/updates/3.1.3_old/5628_characters_character_spell.sql new file mode 100644 index 0000000..710244b --- /dev/null +++ b/sql/updates/3.1.3_old/5628_characters_character_spell.sql @@ -0,0 +1,21 @@ +-- mangos rev 8433 +-- ALTER TABLE character_db_version CHANGE COLUMN required_8433_01_characters_character_account_data required_8469_01_characters_character_spell bit; + +DELETE FROM character_spell WHERE spell in ( + 1178, /* Bear Form (Passive) */ + 3025, /* Cat Form (Passive) */ + 5419, /* Travel Form (Passive) */ + 5420, /* Tree of Life _passive_ */ + 5421, /* Aquatic Form (Passive) */ + 7376, /* Defensive Stance Passive */ + 7381, /* Berserker Stance Passive */ + 9635, /* Dire Bear Form (Passive) */ + 21156, /* Battle Stance Passive */ + 21178, /* Bear Form (Passive2) */ + 24905, /* Moonkin Form (Passive) */ + 34123, /* Tree of Life _pasive_ */ + 33948, /* Flight Form (Passive) */ + 34764, /* Flight Form (Passive) */ + 40121, /* Swift Flight Form (Passive) */ + 40122 /* Swift Flight Form (Passive) */ +); diff --git a/sql/updates/3.1.3_old/5628_world_creature_ai_texts.sql b/sql/updates/3.1.3_old/5628_world_creature_ai_texts.sql new file mode 100644 index 0000000..a1b9989 --- /dev/null +++ b/sql/updates/3.1.3_old/5628_world_creature_ai_texts.sql @@ -0,0 +1,4 @@ +-- mangos rev 8451 +-- ALTER TABLE db_version CHANGE COLUMN required_8451_01_mangos_spell_proc_event required_8462_01_mangos_creature_ai_texts bit; + +ALTER TABLE creature_ai_texts CHANGE emote emote smallint(5) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.1.3_old/5637_world_scriptname.sql b/sql/updates/3.1.3_old/5637_world_scriptname.sql new file mode 100644 index 0000000..5294f92 --- /dev/null +++ b/sql/updates/3.1.3_old/5637_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_thorim' WHERE `entry`=29445; diff --git a/sql/updates/3.1.3_old/5642_realmd_realmlist.sql b/sql/updates/3.1.3_old/5642_realmd_realmlist.sql new file mode 100644 index 0000000..f1d5575 --- /dev/null +++ b/sql/updates/3.1.3_old/5642_realmd_realmlist.sql @@ -0,0 +1,2 @@ +ALTER TABLE `realmlist` + ADD `gamebuild` int(11) unsigned NOT NULL default '9947' AFTER `population`; \ No newline at end of file diff --git a/sql/updates/3.1.3_old/5670_realmd_uptime.sql b/sql/updates/3.1.3_old/5670_realmd_uptime.sql new file mode 100644 index 0000000..ba69402 --- /dev/null +++ b/sql/updates/3.1.3_old/5670_realmd_uptime.sql @@ -0,0 +1 @@ +ALTER TABLE `uptime` ADD COLUMN `revision` VARCHAR(255) NOT NULL DEFAULT 'Trinitycore' AFTER `maxplayers`; diff --git a/sql/updates/3.1.3_old/5677_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5677_world_spell_proc_event.sql new file mode 100644 index 0000000..e33ed3c --- /dev/null +++ b/sql/updates/3.1.3_old/5677_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (57352); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(57352, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00051154, 0x00000000, 0, 0, 45); -- Darkmoon Card: Death diff --git a/sql/updates/3.1.3_old/5684_world_script_texts.sql b/sql/updates/3.1.3_old/5684_world_script_texts.sql new file mode 100644 index 0000000..33a0350 --- /dev/null +++ b/sql/updates/3.1.3_old/5684_world_script_texts.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000488 AND -1000482; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (18210,-1000482,'Look out!',0,0,0,0,'maghar captive SAY_MAG_START'), + (18210,-1000483,'Don''t let them escape! Kill the strong one first!',0,0,0,0,'maghar captive SAY_MAG_NO_ESCAPE'), + (18210,-1000484,'More of them coming! Watch out!',0,0,0,0,'maghar captive SAY_MAG_MORE'), + (18210,-1000485,'Where do you think you''re going? Kill them all!',0,0,0,0,'maghar captive SAY_MAG_MORE_REPLY'), + (18210,-1000486,'Ride the lightning, filth!',0,0,0,0,'maghar captive SAY_MAG_LIGHTNING'), + (18210,-1000487,'FROST SHOCK!!!',0,0,0,0,'maghar captive SAY_MAG_SHOCK'), + (18210,-1000488,'It is best that we split up now, in case they send more after us. Hopefully one of us will make it back to Garrosh. Farewell stranger.',0,0,0,0,'maghar captive SAY_MAG_COMPLETE'); diff --git a/sql/updates/3.1.3_old/5684_world_script_waypoint.sql b/sql/updates/3.1.3_old/5684_world_script_waypoint.sql new file mode 100644 index 0000000..708ad3c --- /dev/null +++ b/sql/updates/3.1.3_old/5684_world_script_waypoint.sql @@ -0,0 +1,22 @@ +DELETE FROM `script_waypoint` WHERE `entry`=18210; +INSERT INTO `script_waypoint` VALUES + (18210, 0, -1581.410034, 8557.933594, 2.726, 0, ''), + (18210, 1, -1579.908447, 8553.716797, 2.559, 0, ''), + (18210, 2, -1577.829102, 8549.880859, 2.001, 0, ''), + (18210, 3, -1571.161987, 8543.494141, 2.001, 0, ''), + (18210, 4, -1563.944824, 8530.334961, 1.605, 0, ''), + (18210, 5, -1554.565552, 8518.413086, 0.364, 0, ''), + (18210, 6, -1549.239136, 8515.518555, 0.293, 0, ''), + (18210, 7, -1518.490112, 8516.771484, 0.683, 2000, 'SAY_MAG_MORE'), + (18210, 8, -1505.038940, 8513.247070, 0.672, 0, ''), + (18210, 9, -1476.161133, 8496.066406, 2.157, 0, ''), + (18210, 10, -1464.450684, 8492.601563, 3.529, 0, ''), + (18210, 11, -1457.568359, 8492.183594, 4.449, 0, ''), + (18210, 12, -1444.100342, 8499.031250, 6.177, 0, ''), + (18210, 13, -1426.472168, 8510.116211, 7.686, 0, ''), + (18210, 14, -1403.685303, 8524.146484, 9.680, 0, ''), + (18210, 15, -1384.890503, 8542.014648, 11.180, 0, ''), + (18210, 16, -1382.286133, 8539.869141, 11.139, 7500, 'SAY_MAG_COMPLETE'), + (18210, 17, -1361.224609, 8521.440430, 11.144, 0, ''), + (18210, 18, -1324.803589, 8510.688477, 13.050, 0, ''), + (18210, 19, -1312.075439, 8492.709961, 14.235, 0, ''); diff --git a/sql/updates/3.1.3_old/5684_world_scriptname.sql b/sql/updates/3.1.3_old/5684_world_scriptname.sql new file mode 100644 index 0000000..4db8f4f --- /dev/null +++ b/sql/updates/3.1.3_old/5684_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_maghar_captive' WHERE `entry`=18210; diff --git a/sql/updates/3.1.3_old/5688_world_scriptname.sql b/sql/updates/3.1.3_old/5688_world_scriptname.sql new file mode 100644 index 0000000..2274fbf --- /dev/null +++ b/sql/updates/3.1.3_old/5688_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_training_dummy' WHERE `entry`=16111; diff --git a/sql/updates/3.1.3_old/5696_world_areatrigger_scripts.sql b/sql/updates/3.1.3_old/5696_world_areatrigger_scripts.sql new file mode 100644 index 0000000..849bba0 --- /dev/null +++ b/sql/updates/3.1.3_old/5696_world_areatrigger_scripts.sql @@ -0,0 +1,3 @@ +-- *Zum'Rah Area Trigger Script, Zum'Rah should become hostile when approached. By totoro. +DELETE FROM `areatrigger_scripts` WHERE `entry`=962; +INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES('962','at_zumrah'); diff --git a/sql/updates/3.1.3_old/5696_world_creature_addon_waypoint_data.sql b/sql/updates/3.1.3_old/5696_world_creature_addon_waypoint_data.sql new file mode 100644 index 0000000..4f9b4e0 --- /dev/null +++ b/sql/updates/3.1.3_old/5696_world_creature_addon_waypoint_data.sql @@ -0,0 +1,15 @@ +-- *TrullyOne/MeanMachine Waypoint System Restored. Patch by XTElite1. +-- This should be applied to world_script_waypoints.sql ASAP +ALTER TABLE `creature_addon` + ADD `path_id` int(11) unsigned NOT NULL default '0' AFTER `guid`; +ALTER TABLE `creature_template_addon` + ADD `path_id` int(11) unsigned NOT NULL default '0' AFTER `entry`; + +ALTER TABLE `waypoint_data` ADD COLUMN `id_old` int(10) unsigned NOT NULL default '0' COMMENT 'Creature GUID' AFTER `wpguid`; +UPDATE `waypoint_data` SET `id_old`=`id`*0.1; + +REPLACE INTO `creature_addon` ( `guid` ) SELECT `id_old` FROM `waypoint_data`; + +UPDATE `creature_addon`,`waypoint_data` SET `creature_addon`.`path_id` = `waypoint_data`.`id` WHERE `creature_addon`.`guid`=`waypoint_data`.`id_old`; + +ALTER TABLE `waypoint_data` DROP COLUMN `id_old`; diff --git a/sql/updates/3.1.3_old/5696_world_script_texts.sql b/sql/updates/3.1.3_old/5696_world_script_texts.sql new file mode 100644 index 0000000..66a8e6e --- /dev/null +++ b/sql/updates/3.1.3_old/5696_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=17077; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (17077,-1000496,'%s lifts its head into the air, as if listening for something.',0,2,0,0,'ancestral wolf EMOTE_WOLF_LIFT_HEAD'), + (17077,-1000497,'%s lets out a howl that rings across the mountains to the north and motions for you to follow.',0,2,0,0,'ancestral wolf EMOTE_WOLF_HOWL'), + (17077,-1000498,'Welcome, kind spirit. What has brought you to us?',0,0,0,0,'ancestral wolf SAY_WOLF_WELCOME'); diff --git a/sql/updates/3.1.3_old/5696_world_script_waypoint.sql b/sql/updates/3.1.3_old/5696_world_script_waypoint.sql new file mode 100644 index 0000000..f291c3c --- /dev/null +++ b/sql/updates/3.1.3_old/5696_world_script_waypoint.sql @@ -0,0 +1,53 @@ +DELETE FROM `script_waypoint` WHERE `entry`=17077; +INSERT INTO `script_waypoint` VALUES + (17077, 0, -16.950142, 3801.409424, 95.064, 5000, 'EMOTE_WOLF_LIFT_HEAD'), + (17077, 1, -15.577404, 3805.170898, 94.833, 2500, ''), + (17077, 2, -20.011766, 3806.609863, 92.476, 5000, 'EMOTE_WOLF_HOWL'), + (17077, 3, -18.594666, 3816.207764, 91.482, 0, ''), + (17077, 4, -19.293468, 3838.218750, 85.012, 0, ''), + (17077, 5, -16.504408, 3871.034668, 82.327, 0, ''), + (17077, 6, 2.064510, 3898.678711, 85.623, 0, ''), + (17077, 7, 16.403864, 3921.174072, 86.024, 0, ''), + (17077, 8, 47.307926, 3932.001465, 83.302, 0, ''), + (17077, 9, 90.067230, 3942.906250, 77.000, 0, ''), + (17077, 10, 106.886024, 3944.388428, 76.502, 0, ''), + (17077, 11, 139.085480, 3941.897217, 80.617, 0, ''), + (17077, 12, 150.092346, 3942.782959, 80.399, 0, ''), + (17077, 13, 193.511475, 3950.396484, 74.366, 0, ''), + (17077, 14, 226.274948, 3958.003418, 73.257, 0, ''), + (17077, 15, 246.686981, 3963.309326, 76.376, 0, ''), + (17077, 16, 264.206177, 3977.726563, 83.704, 0, ''), + (17077, 17, 279.857422, 3986.417236, 88.245, 0, ''), + (17077, 18, 304.039642, 3998.354004, 95.649, 0, ''), + (17077, 19, 328.071503, 3995.832764, 104.434, 0, ''), + (17077, 20, 347.485229, 3990.817627, 113.608, 0, ''), + (17077, 21, 351.257202, 3954.260254, 125.747, 0, ''), + (17077, 22, 345.625977, 3932.016113, 132.358, 0, ''), + (17077, 23, 347.971893, 3908.549561, 135.520, 0, ''), + (17077, 24, 351.887878, 3891.062744, 139.957, 0, ''), + (17077, 25, 346.116852, 3864.634277, 146.647, 0, ''), + (17077, 26, 330.012360, 3839.859375, 154.148, 0, ''), + (17077, 27, 297.250610, 3811.855225, 166.893, 0, ''), + (17077, 28, 290.783112, 3800.188477, 172.130, 0, ''), + (17077, 29, 288.125427, 3782.474365, 180.825, 0, ''), + (17077, 30, 296.817841, 3771.629639, 184.961, 0, ''), + (17077, 31, 305.256256, 3765.380615, 185.360, 0, ''), + (17077, 32, 311.447906, 3757.902100, 184.312, 0, ''), + (17077, 33, 325.258026, 3730.282227, 184.076, 0, ''), + (17077, 34, 341.158630, 3717.757080, 183.904, 0, ''), + (17077, 35, 365.589020, 3717.200684, 183.902, 0, ''), + (17077, 36, 387.395081, 3731.750732, 183.645, 0, ''), + (17077, 37, 396.574127, 3732.604248, 179.831, 0, ''), + (17077, 38, 404.303192, 3737.313232, 180.151, 0, ''), + (17077, 39, 410.995972, 3742.286865, 183.364, 0, ''), + (17077, 40, 434.904541, 3761.058838, 186.219, 0, ''), + (17077, 41, 460.128815, 3774.436768, 186.348, 0, ''), + (17077, 42, 467.643951, 3788.506104, 186.446, 0, ''), + (17077, 43, 491.551666, 3815.446777, 189.848, 0, ''), + (17077, 44, 496.957855, 3836.875244, 193.078, 0, ''), + (17077, 45, 502.889191, 3855.458740, 194.834, 0, ''), + (17077, 46, 508.208466, 3863.689453, 194.024, 0, ''), + (17077, 47, 528.907593, 3887.348633, 189.762, 0, ''), + (17077, 48, 527.722229, 3890.686523, 189.240, 0, ''), + (17077, 49, 524.637329, 3891.768066, 189.149, 0, ''), + (17077, 50, 519.146057, 3886.701660, 190.128, 60000, 'SAY_WOLF_WELCOME'); diff --git a/sql/updates/3.1.3_old/5696_world_scriptname.sql b/sql/updates/3.1.3_old/5696_world_scriptname.sql new file mode 100644 index 0000000..5f7e8d8 --- /dev/null +++ b/sql/updates/3.1.3_old/5696_world_scriptname.sql @@ -0,0 +1,2 @@ +-- *A Spirit Guide Escort Quest, code from SD2, patch by manuel. +UPDATE `creature_template` SET `ScriptName`='npc_ancestral_wolf' WHERE `entry`=17077; diff --git a/sql/updates/3.1.3_old/5696_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5696_world_spell_proc_event.sql new file mode 100644 index 0000000..280faca --- /dev/null +++ b/sql/updates/3.1.3_old/5696_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +-- *Judgement of Light PPM based, not 100%. By Drevi. +DELETE FROM `spell_proc_event` WHERE `entry`=20185; +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 20185, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 15, 0, 0); -- Judgement of Light diff --git a/sql/updates/3.1.3_old/5698_world_scriptname.sql b/sql/updates/3.1.3_old/5698_world_scriptname.sql new file mode 100644 index 0000000..e2e3fb6 --- /dev/null +++ b/sql/updates/3.1.3_old/5698_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_nerubar_victim' WHERE `entry`=25284; diff --git a/sql/updates/3.1.3_old/5700_characters_game_event_save.sql b/sql/updates/3.1.3_old/5700_characters_game_event_save.sql new file mode 100644 index 0000000..0118921 --- /dev/null +++ b/sql/updates/3.1.3_old/5700_characters_game_event_save.sql @@ -0,0 +1,2 @@ +DELETE `game_event_condition_save` FROM `game_event_condition_save` WHERE `event_id` in (22,75,76,77); +DELETE `game_event_save` FROM `game_event_save` WHERE `event_id` in (22,75,76,77); diff --git a/sql/updates/3.1.3_old/5700_world_areatrigger_scripts.sql b/sql/updates/3.1.3_old/5700_world_areatrigger_scripts.sql new file mode 100644 index 0000000..d4d31b7 --- /dev/null +++ b/sql/updates/3.1.3_old/5700_world_areatrigger_scripts.sql @@ -0,0 +1,6 @@ +DELETE FROM `areatrigger_scripts` WHERE `entry`=4016; +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES (4016,'at_malfurion_stormrage'); + +-- Duskwood (already in world_scripts_full.sql) +DELETE FROM `areatrigger_scripts` WHERE `entry`=4017; +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES (4017,'at_twilight_grove'); diff --git a/sql/updates/3.1.3_old/5700_world_script_texts.sql b/sql/updates/3.1.3_old/5700_world_script_texts.sql new file mode 100644 index 0000000..c2b6c48 --- /dev/null +++ b/sql/updates/3.1.3_old/5700_world_script_texts.sql @@ -0,0 +1,34 @@ +-- Already in world_script_texts.sql +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1350030 AND -1350000; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`type`,`emote`,`comment`) VALUES + (15381,-1350000,'We must act quickly or all shall be lost!',0,1,'ANACHRONOS_SAY_1'), + (15381,-1350001,'NOW, STAGHELM! WE GO NOW! Prepare your magic!',0,81,'ANACHRONOS_SAY_2'), + (15381,-1350002,'Stay close...',0,1,'ANACHRONOS_SAY_3'), + (15381,-1350003,'The sands of time will halt, but only for a moment! I will now conjure the barrier.',0,1,'ANACHRONOS_SAY_4'), + (15381,-1350004,'FINISH THE SPELL STAGHELM! I CANNOT HOLD THE GLYPHS OF WARDING IN PLACE MUCH LONGER! CALL FORTH THE ROOTS!',0,53,'ANACHRONOS_SAY_5'), + (15381,-1350005,'It... It is over, Lord Staghelm. We are victorious. Albeit the cost for this victory was great.',0,1,'ANACHRONOS_SAY_6'), + (15381,-1350006,'There is but one duty that remains...',0,1,'ANACHRONOS_SAY_7'), + (15381,-1350007,'Before I leave this place, I make one final offreing to you, Lord Staghelm. Should a time arise in which you must gain entry to this accursed fortress, use the Scepter of the Shifting Sands on the sacred gong. The magic holding the barrier together will dissipate and the horrors of Ahn''Qiraj will be unleashed upon the world once more.',0,1,'ANACHRONOS_SAY_8'), + (15381,-1350008,'Lord Staghelm, where are you going? You would shatter our bond for the sake of pride?',0,1,'ANACHRONOS_SAY_9'), + (15381,-1350009,'And now you know all that there is to know, mortal...',0,1,'ANACHRONOS_SAY_10'), + (15381,-1350010,'hands the Scepter of the Shifting Sands to Fandral Staghelm.',2,1,'ANACHRONOS_EMOTE_1'), + (15381,-1350011,'shakes his head in dissapointment.',2,274,'ANACHRONOS_EMOTE_2'), + (15381,-1350012,'kneels down to pick up the fragments of the shattered scepter.',2,87,'ANACHRONOS_EMOTE_3'), + (15382,-1350013,'My forces cannot overcome the Qiraji defenses. We will not be able to get close enough to place your precious barrier, dragon.',0,1,'FANDRAL_SAY_1'), + (15382,-1350014,'It is done dragon. Lead the way...',0,1,'FANDRAL_SAY_2'), + (15382,-1350015,'Ancient ones guide my hand... Wake from your slumber! WAKE AND SEAL THIS CURSED PLACE!',0,1,'FANDRAL_SAY_3'), + (15382,-1350016,'After the savagery that my people have witnessed and felt, you expect me to accept another burden, dragon? Surely you are mad.',0,25,'FANDRAL_SAY_4'), + (15382,-1350017,'I want nothing to do with Silithus, the Qiraji and least of all, any damned dragons!',0,1,'FANDRAL_SAY_5'), + (15382,-1350018,'My son''s soul will find no comfort in this hollow victory, dragon. I will have him back.Thought it takes a millennia, I WILL have my son back!',0,254,'FANDRAL_SAY_6'), + (15382,-1350019,'falls to one knee - exhausted.',2,16,'FANDRAL_EMOTE_1'), + (15382,-1350020,'hurls the Scepter of the Shifting Sands into the barrier, shattering it.',2,0,'FANDRAL_EMOTE_2'), + (15379,-1350021,'Aye, Fandral, remember these words: Let not your grief guide your faith. These thoughts you hold... dark places you go, night elf. Absolution cannot be had through misguided vengeance.',0,1,'CAELESTRASZ_SAY_1'), + (15379,-1350022,'Do not forget the sacrifices made on this day, night elf. We have all suffered immensely at the hands of these beasts.',0,1,'CAELESTRASZ_SAY_2'), + (15379,-1350023,'Alexstrasza grant me the resolve to drive our enemies back!',1,53,'CAELESTRASZ_YELL_1'), + (15380,-1350024,'This distraction will give you and the young druid time enough to seal the gate. Do not falter. Now, let us see how they deal with chaotic magic.',0,1,'ARYGOS_SAY_1'), + (15380,-1350025,'Let them feel the wrath of the Blue Flight! May Malygos protect me!',1,53,'ARYGOS_YELL_1'), + (15380,-1350026,'nods knowingly.',2,273,'ARYGOS_EMOTE_1'), + (15378,-1350027,'There is a way...',0,1,'MERITHRA_SAY_1'), + (15378,-1350028,'We will push them back, Anachronos. This I vow. Uphold the end of this task. Let not your hands falter as you seal our fates behind the barrier.',0,1,'MERITHRA_SAY_2'), + (15378,-1350029,'Succumb to the endless dream, little ones. Let it consume you!',1,53,'MERITHRA_YELL_1'), + (15378,-1350030,'glances at her compatriots.',2,2,'MERITHRA_EMOTE_1'); diff --git a/sql/updates/3.1.3_old/5700_world_scriptname.sql b/sql/updates/3.1.3_old/5700_world_scriptname.sql new file mode 100644 index 0000000..efcc289 --- /dev/null +++ b/sql/updates/3.1.3_old/5700_world_scriptname.sql @@ -0,0 +1,12 @@ +-- Sunken temple (already in world_scripts_full.sql) +UPDATE `instance_template` SET `script`='instance_sunken_temple' WHERE `map`=109; +UPDATE `gameobject_template` SET `ScriptName`='go_atalai_statue' WHERE `entry` IN (148830,148831,148832,148833,148834,148835); + +UPDATE `creature_template` SET `ScriptName`='boss_twilight_corrupter' WHERE `entry`=15625; + +-- quest data: A pawn on the eternal board +-- Already in world_scripts_full.sql +UPDATE `gameobject_template` SET `ScriptName`='go_crystalline_tear' WHERE `entry`=180633; +UPDATE `creature_template` SET `ScriptName`='mob_qiraj_war_spawn' WHERE `entry` IN (15414,15422,15424,15423); +UPDATE `creature_template` SET `ScriptName`='npc_anachronos_the_ancient' WHERE `entry`=15381; +UPDATE `creature_template` SET `ScriptName`='npc_anachronos_quest_trigger' WHERE `entry`=15454; diff --git a/sql/updates/3.1.3_old/5701_world_scriptname.sql b/sql/updates/3.1.3_old/5701_world_scriptname.sql new file mode 100644 index 0000000..8ff78ba --- /dev/null +++ b/sql/updates/3.1.3_old/5701_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_fel_crystalforge' WHERE `entry`=185919; +UPDATE `gameobject_template` SET `ScriptName`='go_bashir_crystalforge' WHERE `entry`=185921; diff --git a/sql/updates/3.1.3_old/5702_world_scriptname.sql b/sql/updates/3.1.3_old/5702_world_scriptname.sql new file mode 100644 index 0000000..79dee43 --- /dev/null +++ b/sql/updates/3.1.3_old/5702_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_southfury_moonstone' WHERE `entry`=185566; diff --git a/sql/updates/3.1.3_old/5713_world_script_texts.sql b/sql/updates/3.1.3_old/5713_world_script_texts.sql new file mode 100644 index 0000000..04c1686 --- /dev/null +++ b/sql/updates/3.1.3_old/5713_world_script_texts.sql @@ -0,0 +1,10 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1619028 AND -1619021; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (29308,-1619021,'I will feast on your remains.',0,0,0,0,'prince taldaram SAY_AGGRO'), + (29308,-1619022,'I will drink no blood before it''s time.',0,0,0,0,'prince taldaram SAY_SLAY_1'), + (29308,-1619023,'One final embrace.',0,0,0,0,'prince taldaram SAY_SLAY_2'), + (29308,-1619024,'Still I hunger, still I thirst.',0,0,0,0,'prince taldaram SAY_DEATH'), + (29308,-1619025,'So appetizing.',0,0,0,0,'prince taldaram SAY_FEED1'), + (29308,-1619026,'Fresh, warm blood. It has been too long.',0,0,0,0,'prince taldaram SAY_FEED2'), + (29308,-1619027,'Your heartbeat is music to my ears.',0,0,0,0,'prince taldaram SAY_VANISH1'), + (29308,-1619028,'I am nowhere. I am everywhere. I am the watcher, unseen.',0,0,0,0,'prince taldaram SAY_VANISH2'); diff --git a/sql/updates/3.1.3_old/5713_world_scriptname.sql b/sql/updates/3.1.3_old/5713_world_scriptname.sql new file mode 100644 index 0000000..7b8f0c1 --- /dev/null +++ b/sql/updates/3.1.3_old/5713_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_taldaram' WHERE `entry`=29308; +UPDATE `creature_template` SET `ScriptName`='mob_taldaram_flamesphere' WHERE `entry` IN (30106,31686,31687); +UPDATE `gameobject_template` SET `ScriptName`='prince_taldaram_sphere' WHERE `entry` IN (193093,193094); diff --git a/sql/updates/3.1.3_old/5714_world_scriptname.sql b/sql/updates/3.1.3_old/5714_world_scriptname.sql new file mode 100644 index 0000000..07a8ff5 --- /dev/null +++ b/sql/updates/3.1.3_old/5714_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_volazj' WHERE `entry`=29311; diff --git a/sql/updates/3.1.3_old/5717_world_creature_template.sql b/sql/updates/3.1.3_old/5717_world_creature_template.sql new file mode 100644 index 0000000..827732e --- /dev/null +++ b/sql/updates/3.1.3_old/5717_world_creature_template.sql @@ -0,0 +1,4 @@ +ALTER TABLE `creature_template` CHANGE COLUMN `modelid_A` `modelid1` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `creature_template` CHANGE COLUMN `modelid_A2` `modelid2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `creature_template` CHANGE COLUMN `modelid_H` `modelid3` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE `creature_template` CHANGE COLUMN `modelid_H2` `modelid4` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0; diff --git a/sql/updates/3.1.3_old/5717_world_item_template.sql b/sql/updates/3.1.3_old/5717_world_item_template.sql new file mode 100644 index 0000000..bc81881 --- /dev/null +++ b/sql/updates/3.1.3_old/5717_world_item_template.sql @@ -0,0 +1 @@ +ALTER TABLE `item_template` MODIFY `stackable` int; diff --git a/sql/updates/3.1.3_old/5724_world_scriptname.sql b/sql/updates/3.1.3_old/5724_world_scriptname.sql new file mode 100644 index 0000000..53914d9 --- /dev/null +++ b/sql/updates/3.1.3_old/5724_world_scriptname.sql @@ -0,0 +1,12 @@ +UPDATE `creature_template` SET `ScriptName`='boss_svala_sorrowgrave' WHERE `entry`=26668; +UPDATE `creature_template` SET `ScriptName`='mob_ritual_channeler' WHERE `entry`=27281; +UPDATE `creature_template` SET `ScriptName`='boss_svala' WHERE `entry`=29281; +UPDATE `creature_template` SET `ScriptName`='boss_palehoof' WHERE `entry`=26687; +UPDATE `creature_template` SET `ScriptName`='boss_skadi' WHERE `entry`=26693; +UPDATE `creature_template` SET `ScriptName`='boss_ymiron' WHERE `entry`=26861; +UPDATE `creature_template` SET `ScriptName`='mob_frenzied_worgen' WHERE `entry`=26683; +UPDATE `creature_template` SET `ScriptName`='mob_ravenous_furbolg' WHERE `entry`=26684; +UPDATE `creature_template` SET `ScriptName`='mob_ferocious_rhino' WHERE `entry`=26685; +UPDATE `creature_template` SET `ScriptName`='mob_massive_jormungar' WHERE `entry`=26686; +UPDATE `instance_template` SET `script`='instance_utgarde_pinnacle' WHERE `map`=575; +UPDATE `gameobject_template` SET `ScriptName`='go_palehoof_sphere'WHERE `entry`=188593; diff --git a/sql/updates/3.1.3_old/5727_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5727_world_spell_proc_event.sql new file mode 100644 index 0000000..786a472 --- /dev/null +++ b/sql/updates/3.1.3_old/5727_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +-- *Judgement of Wisdom PPM based, not 100%. By Drevi. +DELETE FROM `spell_proc_event` WHERE `entry`=20186; +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 20186, 0x01, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 15, 0, 0); -- Judgement of Wisdom diff --git a/sql/updates/3.1.3_old/5736_world_script_texts.sql b/sql/updates/3.1.3_old/5736_world_script_texts.sql new file mode 100644 index 0000000..9e681fc --- /dev/null +++ b/sql/updates/3.1.3_old/5736_world_script_texts.sql @@ -0,0 +1,6 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1601003 AND -1601000; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (28684,-1601000, 'This kingdom belongs to the Scourge! Only the dead may enter.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 0, 0, 'SAY_AGGRO boss_krik_thir'), + (28684,-1601001, 'You were foolish to come.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 0, 0, 'SAY_SLAY_1 boss_krik_thir'), + (28684,-1601002, 'As Anub''Arak commands!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 0, 0, 'SAY_SLAY_2 boss_krik_thir'), + (28684,-1601003, 'I should be grateful. But I long ago lost the capacity.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 1, 0, 0, 'SAY_DEATH boss_krik_thir'); diff --git a/sql/updates/3.1.3_old/5736_world_scriptname.sql b/sql/updates/3.1.3_old/5736_world_scriptname.sql new file mode 100644 index 0000000..3330f11 --- /dev/null +++ b/sql/updates/3.1.3_old/5736_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_krik_thir' where `entry`=28684; diff --git a/sql/updates/3.1.3_old/5747_world_script_texts.sql b/sql/updates/3.1.3_old/5747_world_script_texts.sql new file mode 100644 index 0000000..da7658e --- /dev/null +++ b/sql/updates/3.1.3_old/5747_world_script_texts.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1604017 AND -1604010; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (29305,-1604010,'We fought back da Scourge. What chance joo be thinkin'' JOO got?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_AGGRO boss_moorabi'), + (29305,-1604012,'Who gonna stop me; you? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_SLAY_2 boss_moorabi'), + (29305,-1604013,'Not so tough now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_SLAY_3 boss_moorabi'), + (29305,-1604014,'If our gods can die... den so can we... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_DEATH boss_moorabi'), + (29305,-1604015,'Get ready for somethin''... much... BIGGAH! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_TRANSFORM boss_moorabi'), + (29305,-1604016,'Da ground gonna swallow you up',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'SAY_QUAKE boss_moorabi'), + (29305,-1604017,'%s begins to transform!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'EMOTE_TRANSFORM boss_moorabi'); diff --git a/sql/updates/3.1.3_old/5747_world_scriptname.sql b/sql/updates/3.1.3_old/5747_world_scriptname.sql new file mode 100644 index 0000000..f11a2f8 --- /dev/null +++ b/sql/updates/3.1.3_old/5747_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_moorabi' where entry=29305; diff --git a/sql/updates/3.1.3_old/5755_world_scriptname.sql b/sql/updates/3.1.3_old/5755_world_scriptname.sql new file mode 100644 index 0000000..48775ec --- /dev/null +++ b/sql/updates/3.1.3_old/5755_world_scriptname.sql @@ -0,0 +1,9 @@ +UPDATE `creature_template` SET `ScriptName`='boss_slad_ran' WHERE `entry`=29304; +UPDATE `creature_template` SET `ScriptName`='boss_gal_darah' WHERE `entry`=29306; +UPDATE `creature_template` SET `ScriptName`='boss_drakkari_colossus' WHERE `entry`=29307; +UPDATE `creature_template` SET `ScriptName`='mob_slad_ran_viper' WHERE `entry`=29304; +UPDATE `creature_template` SET `ScriptName`='mob_slad_ran_constrictor' WHERE `entry`=29713; +UPDATE `instance_template` SET `script`='instance_gundrak' WHERE `map`=604; +UPDATE `gameobject_template` SET `ScriptName`='go_gundrak_altar' WHERE `entry`=192518; +UPDATE `gameobject_template` SET `ScriptName`='go_gundrak_altar' WHERE `entry`=192519; +UPDATE `gameobject_template` SET `ScriptName`='go_gundrak_altar' WHERE `entry`=192520; diff --git a/sql/updates/3.1.3_old/5761_world_scriptname.sql b/sql/updates/3.1.3_old/5761_world_scriptname.sql new file mode 100644 index 0000000..19986bc --- /dev/null +++ b/sql/updates/3.1.3_old/5761_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='mob_slad_ran_viper' WHERE `entry`=29680; + +/* Eck the Ferocious */ +UPDATE `creature_template` SET `ScriptName`='boss_eck' WHERE `entry`=29932; diff --git a/sql/updates/3.1.3_old/5772_world_scriptname.sql b/sql/updates/3.1.3_old/5772_world_scriptname.sql new file mode 100644 index 0000000..af97f6e --- /dev/null +++ b/sql/updates/3.1.3_old/5772_world_scriptname.sql @@ -0,0 +1,14 @@ +/* GUNDRAK */ +UPDATE `instance_template` SET `script`='instance_gundrak' WHERE `map`=604; +/* Moorabi */ +UPDATE `creature_template` SET `ScriptName`='boss_moorabi' WHERE `entry`=29305; +/* Slad'ran */ +UPDATE `creature_template` SET `ScriptName`='boss_slad_ran' WHERE `entry`=29304; +UPDATE `creature_template` SET `ScriptName`='mob_slad_ran_viper' WHERE `entry`=29680; +UPDATE `creature_template` SET `ScriptName`='mob_slad_ran_constrictor' WHERE `entry`=29713; +/* Gal'darah */ +UPDATE `creature_template` SET `ScriptName`='boss_gal_darah' WHERE `entry`=29306; +/* Drakkari Colossus */ +UPDATE `creature_template` SET `ScriptName`='boss_drakkari_colossus' WHERE `entry`=29307; +/* Eck the Ferocious */ +UPDATE `creature_template` SET `ScriptName`='boss_eck' WHERE `entry`=29932; diff --git a/sql/updates/3.1.3_old/5776_world_command.sql b/sql/updates/3.1.3_old/5776_world_command.sql new file mode 100644 index 0000000..bf4f455 --- /dev/null +++ b/sql/updates/3.1.3_old/5776_world_command.sql @@ -0,0 +1,2 @@ +DELETE FROM `command` WHERE `name` = 'account addon'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES ('account addon', 3, 'Syntax: .account addon #addon\nSet expansion addon level allowed. Addon values: 0 - normal, 1 - tbc, 2 - wotlk.'); diff --git a/sql/updates/3.1.3_old/5776_world_trinity_string.sql b/sql/updates/3.1.3_old/5776_world_trinity_string.sql new file mode 100644 index 0000000..2a23bec --- /dev/null +++ b/sql/updates/3.1.3_old/5776_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry`=61; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(61, 'Up to %u expansion allowed now.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.1.3_old/5795_world_script_texts.sql b/sql/updates/3.1.3_old/5795_world_script_texts.sql new file mode 100644 index 0000000..c74dd00 --- /dev/null +++ b/sql/updates/3.1.3_old/5795_world_script_texts.sql @@ -0,0 +1,66 @@ +-- texts +DELETE FROM `script_texts` WHERE `npc_entry` IN (27977,27978,28070); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +/* Krystallus */ + (27977,-1603007,'Crush....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14176,1,0,0,'krystallus SAY_AGGRO'), + (27977,-1603008,'Ha...ha...ha...ha...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14177,1,0,0,'krystallus SAY_KILL'), + (27977,-1603009,'Uuuuhhhhhhhhhh......',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14179,1,0,0,'krystallus SAY_DEATH'), + (27977,-1603010,'Break.... you....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14178,1,0,0,'krystallus SAY_SHATTER'), +/* Sjonnir */ + (27978,-1603011,'Soft, vulnerable shells. Brief, fragile lives. You can not escape the curse of flesh!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Sjonnir SAY_AGGRO'), + (27978,-1603012,'Flesh is no match for iron!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Sjonnir SAY_SLAY_1'), + (27978,-1603013,'Armies of iron will smother the world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Sjonnir SAY_SLAY_2'), + (27978,-1603015,'Loken will not rest, until the forge is retaken. You changed nothing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Sjonnir SAY_DEATH'), + (28070,-1603012,'Now that''s owning your supper!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14244,1,0,0,'brann SAY_KILL_1'), + (28070,-1603013,'Press on, that''s the way!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14245,1,0,0,'brann SAY_KILL_2'), + (28070,-1603014,'Keep it up now. Plenty of death-dealing for everyone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14246,1,0,0,'brann SAY_KILL_3'), + (28070,-1603015,'I''m all kinds of busted up. Might not... make it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14257,1,0,0,'brann SAY_LOW_HEALTH'), + (28070,-1603016,'Not yet, not... yet-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14258,1,0,0,'brann SAY_DEATH'), + (28070,-1603017,'I''m doing everything I can!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14260,1,0,0,'brann SAY_PLAYER_DEATH_1'), + (28070,-1603018,'Light preserve you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14261,1,0,0,'brann SAY_PLAYER_DEATH_2'), + (28070,-1603019,'I hope this is all worth it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14262,1,0,0,'brann SAY_PLAYER_DEATH_3'), + (28070,-1603020,'Time to get some answers! Let''s get this show on the road!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14259,1,0,0,'brann SAY_ESCORT_START'), + (28070,-1603021,'Don''t worry. Old Brann has got your back. Keep that metal monstrosity busy and I''ll see if I can sweet talk this machine into helping you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14274,1,0,0,'brann SAY_SPAWN_DWARF'), + (28070,-1603022,'This is a wee bit trickier that before... Oh, bloody--incomin''!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14275,1,0,0,'brann SAY_SPAWN_TROGG'), + (28070,-1603023,'What in the name o'' Madoran did THAT do? Oh! Wait: I just about got it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14276,1,0,0,'brann SAY_SPAWN_OOZE'), + (28070,-1603024,'Ha, that did it. Help''s a-coming. Take this you glow-eying brute!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14277,1,0,0,'brann SAY_SPAWN_EARTHEN'), + (28070,-1603025,'Take a moment and relish this with me! Soon all will be revealed! Okay then, let''s do this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14247,1,0,0,'brann SAY_EVENT_INTRO_1'), + (28070,-1603026,'Now keep an eye out! I''ll have this licked in two shakes of a--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14248,1,0,0,'brann SAY_EVENT_INTRO_2'), + (28070,-1603027,'Warning! Life form pattern not recognized. Archival processing terminated. Continued interference will result in targeted response.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13765,1,0,0,'brann SAY_EVENT_INTRO_3_ABED'), + (28070,-1603028,'Oh, that doesn''t sound good. We might have a complication or two...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14249,1,0,0,'brann SAY_EVENT_A_1'), + (28070,-1603029,'Security breach in progress. Analysis of historical archives transferred to lower priority queue. Countermeasures engaged.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13756,1,0,0,'brann SAY_EVENT_A_2_KADD'), + (28070,-1603030,'Ah, you want to play hardball, eh? That''s just my game!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14250,1,0,0,'brann SAY_EVENT_A_3'), + (28070,-1603031,'Couple more minutes and I''ll--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14251,1,0,0,'brann SAY_EVENT_B_1'), + (28070,-1603032,'Threat index threshold exceeded. Celestial archive aborted. Security level heightened.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13761,1,0,0,'brann SAY_EVENT_B_2_MARN'), + (28070,-1603033,'Heightened? What''s the good news?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14252,1,0,0,'brann SAY_EVENT_B_3'), + (28070,-1603034,'So that was the problem? Now I''m makin'' progress...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14253,1,0,0,'brann SAY_EVENT_C_1'), + (28070,-1603035,'Critical threat index. Void analysis diverted. Initiating sanitization protocol.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13767,1,0,0,'brann SAY_EVENT_C_2_ABED'), + (28070,-1603036,'Hang on! Nobody''s gonna'' be sanitized as long as I have a say in it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14254,1,0,0,'brann SAY_EVENT_C_3'), + (28070,-1603037,'Ha! The old magic fingers finally won through! Now let''s get down to-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14255,1,0,0,'brann SAY_EVENT_D_1'), + (28070,-1603038,'Alert! Security fail safes deactivated. Beginning memory purge...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13768,1,0,0,'brann SAY_EVENT_D_2_ABED'), + (28070,-1603039,'Purge? No no no no no! Where did I-- Aha, this should do the trick...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14256,1,0,0,'brann SAY_EVENT_D_3'), + (28070,-1603040,'System online. Life form pattern recognized. Welcome Branbronzan. Query?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13769,1,0,0,'brann SAY_EVENT_D_4_ABED'), + (28070,-1603041,'Query? What do you think I�m here for? Tea and biscuits? Spill the beans already!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14263,1,0,0,'brann SAY_EVENT_END_01'), + (28070,-1603042,'Tell me how that dwarfs came to be! And start at the beginning!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14264,1,0,0,'brann SAY_EVENT_END_02'), + (28070,-1603043,'Accessing prehistoric data. Retrieved. In the beginning Earthen were created to-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13770,1,0,0,'brann SAY_EVENT_END_03_ABED'), + (28070,-1603044,'Right, right! I know that the Earthen were made of stone to shape the deep reaches of the world but what about the anomalies? Matrix non-stabilizing and whatnot.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14265,1,0,0,'brann SAY_EVENT_END_04'), + (28070,-1603045,'Accessing. In the early stages of its development cycle Azeroth suffered infection by parasitic, necrophotic symbiotes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13771,1,0,0,'brann SAY_EVENT_END_05_ABED'), + (28070,-1603046,'Necro-what? Speak bloody common will ya?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14266,1,0,0,'brann SAY_EVENT_END_06'), + (28070,-1603047,'Designation: Old Gods. Old Gods rendered all systems, including Earthen defenseless in order to facilitate assimilation. This matrix destabilization has been termed the Curse of Flesh. Effects of destabilization increased over time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13772,1,0,0,'brann SAY_EVENT_END_07_ABED'), + (28070,-1603048,'Old Gods eh? So they zapped the Earthen with this Curse of Flesh. And then what?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14267,1,0,0,'brann SAY_EVENT_END_08'), + (28070,-1603049,'Accessing. Creators arrived to extirpate symbiotic infection. Assessment revealed that Old God infestation had grown malignant. Excising parasites would result in loss of host.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13757,1,0,0,'brann SAY_EVENT_END_09_KADD'), + (28070,-1603050,'If they killed the Old Gods Azeroth would have been destroyed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14268,1,0,0,'brann SAY_EVENT_END_10'), + (28070,-1603051,'Correct. Creators neutralized parasitic threat and contained it within the host. Forge of Wills and other systems were instituted to create new Earthen. Safeguards were implemented and protectors were appointed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13758,1,0,0,'brann SAY_EVENT_END_11_KADD'), + (28070,-1603052,'What protectors?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14269,1,0,0,'brann SAY_EVENT_END_12'), + (28070,-1603053,'Designations: Aesir and Vanir or in common nomenclator Storm and Earth Giants. Sentinel Loken designated supreme. Dragon Aspects appointed to monitor evolution of Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13759,1,0,0,'brann SAY_EVENT_END_13_KADD'), + (28070,-1603054,'Aesir and Vanir. Okay. So the Forge of Wills started to make new Earthen. But what happened to the old ones?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14270,1,0,0,'brann SAY_EVENT_END_14'), + (28070,-1603055,'Additional background is relevant to your query. Following global combat between-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13762,1,0,0,'brann SAY_EVENT_END_15_MARN'), + (28070,-1603056,'Hold everything! The Aesir and Vanir went to war? Why?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14271,1,0,0,'brann SAY_EVENT_END_16'), + (28070,-1603057,'Unknown. Data suggests that impetus for global combat originated with prime designate Loken who neutralized all remaining Aesir and Vanir affecting termination of conflict. Prime designate Loken then initiated stasis of several seed races including Earthen, Giant and Vrykul at designated holding facilities.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13763,1,0,0,'brann SAY_EVENT_END_17_MARN'), + (28070,-1603058,'This Loken sounds like a nasty character. Glad we don�t have to worry about the likes of him anymore. So if I�m understanding you lads the original Earthen eventually woke up from this statis. And by that time this destabily-whatever had turned them into our brother dwarfs. Or at least dwarf ancestors. Hm?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14272,1,0,0,'brann SAY_EVENT_END_18'), + (28070,-1603059,'Essentially that is correct.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13764,1,0,0,'brann SAY_EVENT_END_19_MARN'), + (28070,-1603060,'Well now. That�s a lot to digest. I�m gonna need some time to take all of this in. Thank you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14273,1,0,0,'brann SAY_EVENT_END_20'), + (28070,-1603061,'Acknowledged Branbronzan. Session terminated.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13773,1,0,0,'brann SAY_EVENT_END_21_ABED'), + (28070,-1603062,'Loken?! That''s downright bothersome... We might''ve neutralized the iron dwarves, but I''d lay odds there''s another machine somewhere else churnin'' out a whole mess o'' these iron vrykul!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14278,1,0,0,'brann SAY_VICTORY_SJONNIR_1'), + (28070,-1603063,'I''ll use the forge to make badtches o'' earthen to stand guard... But our greatest challenge still remains: find and stop Loken!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14279,1,0,0,'brann SAY_VICTORY_SJONNIR_2'), + (28070,-1603064,'I think it''s time to see what''s behind the door near the entrance. I''m going to sneak over there, nice and quiet. Meet me at the door and I''ll get us in.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'brann SAY_ENTRANCE_MEET'); diff --git a/sql/updates/3.1.3_old/5795_world_script_waypoint.sql b/sql/updates/3.1.3_old/5795_world_script_waypoint.sql new file mode 100644 index 0000000..a9436cc --- /dev/null +++ b/sql/updates/3.1.3_old/5795_world_script_waypoint.sql @@ -0,0 +1,25 @@ +-- waypoints +DELETE FROM script_waypoint WHERE `entry`=28070; +INSERT INTO script_waypoint VALUES + (28070, 0, 1053.789795, 476.639343, 207.744, 0, ''), + (28070, 1, 1032.293945, 467.623444, 207.736, 0, ''), + (28070, 2, 1017.908752, 454.765656, 207.719, 0, ''), + (28070, 3, 1004.810120, 441.305115, 207.373, 0, ''), + (28070, 4, 988.694214, 424.422485, 207.425, 0, ''), + (28070, 5, 984.816345, 422.177917, 205.994, 0, ''), + (28070, 6, 977.204468, 420.026917, 205.994, 0, ''), + (28070, 7, 962.388123, 421.983307, 205.994, 0, ''), + (28070, 8, 950.419556, 416.515198, 205.994, 0, ''), + (28070, 9, 943.972290, 403.071228, 205.994, 0, ''), + (28070, 10, 947.921936, 387.683563, 205.994, 0, ''), + (28070, 11, 946.554749, 383.270782, 205.994, 0, ''), + (28070, 12, 944.654724, 380.630859, 207.286, 0, ''), + (28070, 13, 941.101563, 377.373413, 207.421, 0, 'reach tribunal, set pause'), + (28070, 14, 935.217896, 370.557343, 207.421, 0, ''), + (28070, 15, 928.035950, 363.026733, 204.018, 0, ''), + (28070, 16, 909.287292, 344.392792, 203.706, 0, ''), + (28070, 17, 897.946838, 333.634735, 203.706, 0, 'reach panel'), + (28070, 18, 918.914429, 351.312866, 203.706, 0, 'reach floor disc (end event begin)'), + (28070, 19, 928.070068, 363.296326, 204.091, 0, 'stealth'), + (28070, 20, 934.817627, 370.136261, 207.421, 0, ''), + (28070, 21, 941.501465, 377.254456, 207.421, 0, ''); diff --git a/sql/updates/3.1.3_old/5795_world_scriptname.sql b/sql/updates/3.1.3_old/5795_world_scriptname.sql new file mode 100644 index 0000000..90ba203 --- /dev/null +++ b/sql/updates/3.1.3_old/5795_world_scriptname.sql @@ -0,0 +1,19 @@ +-- Azjol-Nerub +UPDATE `instance_template` SET `script`='instance_azjol_nerub' WHERE `map`=601; +-- Krik'thir the Gatewatcher +UPDATE creature_template SET `ScriptName`='npc_watcher_narjil' WHERE `entry`=28729; +UPDATE creature_template SET `ScriptName`='npc_watcher_silthik' WHERE `entry`=28731; +UPDATE creature_template SET `ScriptName`='npc_anub_ar_warrior' WHERE `entry`=28732; +UPDATE creature_template SET `ScriptName`='npc_watcher_gashra' WHERE `entry`=28730; +UPDATE creature_template SET `ScriptName`='boss_krik_thir' WHERE `entry`=28684; +UPDATE creature_template SET `ScriptName`='npc_skittering_infector' WHERE `entry`=28736; +UPDATE creature_template SET `ScriptName`='npc_anub_ar_skirmisher' WHERE `entry`=28734; +UPDATE creature_template SET `ScriptName`='npc_anub_ar_shadowcaster' WHERE `entry`=28733; + +-- Halls of Stone +-- scripts +UPDATE `instance_template` SET `script`='instance_halls_of_stone' WHERE `map`=599; +UPDATE `creature_template` SET `ScriptName`='boss_krystallus' WHERE `entry`=27977; +UPDATE `creature_template` SET `ScriptName`='boss_sjonnir' WHERE `entry`=27978; +UPDATE `creature_template` SET `ScriptName`='mob_tribuna_controller' WHERE `entry`=28234; +UPDATE `creature_template` SET `ScriptName`='npc_brann_hos' WHERE `entry`=28070; diff --git a/sql/updates/3.1.3_old/5804_characters_characters.sql b/sql/updates/3.1.3_old/5804_characters_characters.sql new file mode 100644 index 0000000..73624b9 --- /dev/null +++ b/sql/updates/3.1.3_old/5804_characters_characters.sql @@ -0,0 +1,4 @@ +/* +-- Broken character data blobs lately? Run this! +-- UPDATE `characters` SET `data`=CONCAT(SUBSTRING_INDEX(`data`,' ',1248), ' ',SUBSTRING_INDEX(`data`,' ',-(1295-1248))) WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`,' ',1295+1),' ',-1) IS NOT NULL; +*/ diff --git a/sql/updates/3.1.3_old/5807_world_script_texts.sql b/sql/updates/3.1.3_old/5807_world_script_texts.sql new file mode 100644 index 0000000..cf854a0 --- /dev/null +++ b/sql/updates/3.1.3_old/5807_world_script_texts.sql @@ -0,0 +1,10 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1618028 AND -1618021; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (29308,-1619021,'I will feast on your remains.',0,0,0,0,'prince taldaram SAY_AGGRO'), + (29308,-1619022,'I will drink no blood before it''s time.',0,0,0,0,'prince taldaram SAY_SLAY_1'), + (29308,-1619023,'One final embrace.',0,0,0,0,'prince taldaram SAY_SLAY_2'), + (29308,-1619024,'Still I hunger, still I thirst.',0,0,0,0,'prince taldaram SAY_DEATH'), + (29308,-1619025,'So appetizing.',0,0,0,0,'prince taldaram SAY_FEED1'), + (29308,-1619026,'Fresh, warm blood. It has been too long.',0,0,0,0,'prince taldaram SAY_FEED2'), + (29308,-1619027,'Your heartbeat is music to my ears.',0,0,0,0,'prince taldaram SAY_VANISH1'), + (29308,-1619028,'I am nowhere. I am everywhere. I am the watcher, unseen.',0,0,0,0,'prince taldaram SAY_VANISH2'); diff --git a/sql/updates/3.1.3_old/5813_world_command.sql b/sql/updates/3.1.3_old/5813_world_command.sql new file mode 100644 index 0000000..b9ec2a9 --- /dev/null +++ b/sql/updates/3.1.3_old/5813_world_command.sql @@ -0,0 +1,8 @@ +DELETE FROM `command` WHERE `name` IN ('modify aspeed', 'modify bwalk', 'modify fly', 'modify scale', 'modify speed', 'modify swim'); +INSERT INTO `command` VALUES +('modify aspeed',1,'Syntax: .modify aspeed #rate\r\n\r\nModify all speeds -run,swim,run back,swim back- of the selected player to \"normalbase speed for this move type\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify bwalk',1,'Syntax: .modify bwalk #rate\r\n\r\nModify the speed of the selected player while running backwards to \"normal walk back speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify fly',1,'.modify fly $parameter\nModify the flying speed of the selected player to \"normal flying speed\"*rate. If no player is selected, modify your speed.\n #rate may range from 0.1 to 50.'), +('modify scale',1,'.modify scale $parameter\nModify size of the selected player to \"normal scale\"*rate. If no player is selected, modify your size.\n#rate may range from 0.1 to 10.'), +('modify speed',1,'Syntax: .modify speed #rate\r\n.speed #rate\r\n\r\nModify the running speed of the selected player to \"normal base run speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'), +('modify swim',1,'Syntax: .modify swim #rate\r\n\r\nModify the swim speed of the selected player to \"normal swim speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 50.'); diff --git a/sql/updates/3.1.3_old/5843_world_scriptname.sql b/sql/updates/3.1.3_old/5843_world_scriptname.sql new file mode 100644 index 0000000..63d855a --- /dev/null +++ b/sql/updates/3.1.3_old/5843_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_blackfathom_fire' WHERE `entry` IN (21118,21119,21120,21121); diff --git a/sql/updates/3.1.3_old/5848_world_scriptname.sql b/sql/updates/3.1.3_old/5848_world_scriptname.sql new file mode 100644 index 0000000..80d36b5 --- /dev/null +++ b/sql/updates/3.1.3_old/5848_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `Scriptname`="boss_flame_leviathan_safety_container" WHERE `entry`=33218; diff --git a/sql/updates/3.1.3_old/5860_characters_character_reputation.sql b/sql/updates/3.1.3_old/5860_characters_character_reputation.sql new file mode 100644 index 0000000..c892760 --- /dev/null +++ b/sql/updates/3.1.3_old/5860_characters_character_reputation.sql @@ -0,0 +1,6 @@ +-- Remove watch flag (1) from characters that are watching a faction from the opposing team +-- since r5857, these factions will no longer be flagged for watching if they are from the opposing team +-- all we need to do is clean up the data from when it was still bugged. +-- NOTE: running this may take a while depending on the size of your character database +UPDATE `character_reputation` SET `flags` = `flags` &~ 1 WHERE `guid` IN (SELECT `guid` from `characters` WHERE `race` IN(3,7,1,4,11)) AND `faction` IN(1052,1067,1124,947); +UPDATE `character_reputation` SET `flags` = `flags` &~ 1 WHERE `guid` IN (SELECT `guid` from `characters` WHERE `race` IN(2,6,8,5,10)) AND `faction` IN(1126,946,978); diff --git a/sql/updates/3.1.3_old/5864_world_scriptname.sql b/sql/updates/3.1.3_old/5864_world_scriptname.sql new file mode 100644 index 0000000..740196a --- /dev/null +++ b/sql/updates/3.1.3_old/5864_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_drakkari_colossus' WHERE `entry`=29307; +UPDATE `creature_template` SET `ScriptName`='boss_drakkari_elemental' WHERE `entry`=29573; +UPDATE `creature_template` SET `ScriptName`='npc_living_mojo' WHERE `entry`=29830; diff --git a/sql/updates/3.1.3_old/5868_world_scriptname.sql b/sql/updates/3.1.3_old/5868_world_scriptname.sql new file mode 100644 index 0000000..93aabe1 --- /dev/null +++ b/sql/updates/3.1.3_old/5868_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_matrix_punchograph' WHERE `gameobject_template`.`entry` =142345 LIMIT 1 ; +UPDATE `gameobject_template` SET `ScriptName` = 'go_matrix_punchograph' WHERE `gameobject_template`.`entry` =142475 LIMIT 1 ; +UPDATE `gameobject_template` SET `ScriptName` = 'go_matrix_punchograph' WHERE `gameobject_template`.`entry` =142476 LIMIT 1 ; +UPDATE `gameobject_template` SET `ScriptName` = 'go_matrix_punchograph' WHERE `gameobject_template`.`entry` =142696 LIMIT 1 ; diff --git a/sql/updates/3.1.3_old/5872_world_scriptname.sql b/sql/updates/3.1.3_old/5872_world_scriptname.sql new file mode 100644 index 0000000..3cfc592 --- /dev/null +++ b/sql/updates/3.1.3_old/5872_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_grobbulus_poison_cloud' WHERE `entry`=16363; diff --git a/sql/updates/3.1.3_old/5897_world_scriptname.sql b/sql/updates/3.1.3_old/5897_world_scriptname.sql new file mode 100644 index 0000000..bd06188 --- /dev/null +++ b/sql/updates/3.1.3_old/5897_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `instance_template` SET `script`='instance_drak_tharon' WHERE `map`=600; +UPDATE `creature_template` SET `ScriptName`='boss_novos' WHERE `entry`=26631; +UPDATE `creature_template` SET `ScriptName`='mob_crystal_handler' WHERE `entry`=26627; diff --git a/sql/updates/3.1.3_old/5900_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5900_world_spell_proc_event.sql new file mode 100644 index 0000000..676c7fb --- /dev/null +++ b/sql/updates/3.1.3_old/5900_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (16086,16544,51523,51524); +INSERT INTO `spell_proc_event` VALUES +( 16086, 0x04, 11, 0x00000020, 0x00000000, 0x00000000, 0x00011000, 0x00000000, 0, 0, 0), -- Improved Fire Nova Totem (Rank 1) +( 16544, 0x04, 11, 0x00000020, 0x00000000, 0x00000000, 0x00011000, 0x00000000, 0, 100, 0), -- Improved Fire Nova Totem (Rank 2) +( 51523, 0x08, 11, 0x00000000, 0x00000001, 0x00000000, 0x00011000, 0x00000000, 0, 50, 0), -- Earthen Power (Rank 1) +( 51524, 0x08, 11, 0x00000000, 0x00000001, 0x00000000, 0x00011000, 0x00000000, 0, 100, 0); -- Earthen Power (Rank 2) diff --git a/sql/updates/3.1.3_old/5905_world_scriptname.sql b/sql/updates/3.1.3_old/5905_world_scriptname.sql new file mode 100644 index 0000000..7c7446d --- /dev/null +++ b/sql/updates/3.1.3_old/5905_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_novos_minion' WHERE `entry` IN (27600,27597,27598); diff --git a/sql/updates/3.1.3_old/5907_world_scriptname.sql b/sql/updates/3.1.3_old/5907_world_scriptname.sql new file mode 100644 index 0000000..2ca87ca --- /dev/null +++ b/sql/updates/3.1.3_old/5907_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='mob_malformed_ooze' WHERE `entry`=27981; +UPDATE `creature_template` SET `ScriptName`='mob_iron_sludge' WHERE `entry`=28165; diff --git a/sql/updates/3.1.3_old/5908_world_scriptname.sql b/sql/updates/3.1.3_old/5908_world_scriptname.sql new file mode 100644 index 0000000..29bccbc --- /dev/null +++ b/sql/updates/3.1.3_old/5908_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_apothecary_hanes' WHERE `entry`=23784; diff --git a/sql/updates/3.1.3_old/5917_world_scriptname.sql b/sql/updates/3.1.3_old/5917_world_scriptname.sql new file mode 100644 index 0000000..202bee6 --- /dev/null +++ b/sql/updates/3.1.3_old/5917_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='ulduar_teleporter' WHERE `entry`=194569; diff --git a/sql/updates/3.1.3_old/5920_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/5920_world_spell_bonus_data.sql new file mode 100644 index 0000000..36ec23b --- /dev/null +++ b/sql/updates/3.1.3_old/5920_world_spell_bonus_data.sql @@ -0,0 +1,8 @@ +-- Lifebloom Spell Bonus Data +DELETE FROM `spell_bonus_data` WHERE `entry` IN (33763,33778,48450,48451); + +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(33778, 0.516, 0, 0, 0, 'Druid - Lifebloom final heal'), +(33763, 0, 0.09518, 0, 0, 'Druid - Lifebloom HoT(rank 1)'), +(48450, 0, 0.09518, 0, 0, 'Druid - Lifebloom HoT(rank 2)'), +(48451, 0, 0.09518, 0, 0, 'Druid - Lifebloom HoT(rank 3)'); diff --git a/sql/updates/3.1.3_old/5930_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5930_world_spell_proc_event.sql new file mode 100644 index 0000000..9278514 --- /dev/null +++ b/sql/updates/3.1.3_old/5930_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET `procEx`=0 WHERE `entry` IN(17793,17796,17801,17802,17803); diff --git a/sql/updates/3.1.3_old/5931_world_script_texts.sql b/sql/updates/3.1.3_old/5931_world_script_texts.sql new file mode 100644 index 0000000..04c3ae6 --- /dev/null +++ b/sql/updates/3.1.3_old/5931_world_script_texts.sql @@ -0,0 +1,55 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=28070; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (28070,-1603016,'Now that''s owning your supper!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14244,1,0,0,'brann SAY_KILL_1'), + (28070,-1603017,'Press on, that''s the way!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14245,1,0,0,'brann SAY_KILL_2'), + (28070,-1603018,'Keep it up now. Plenty of death-dealing for everyone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14246,1,0,0,'brann SAY_KILL_3'), + (28070,-1603019,'I''m all kinds of busted up. Might not... make it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14257,1,0,0,'brann SAY_LOW_HEALTH'), + (28070,-1603020,'Not yet, not... yet-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14258,1,0,0,'brann SAY_DEATH'), + (28070,-1603021,'I''m doing everything I can!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14260,1,0,0,'brann SAY_PLAYER_DEATH_1'), + (28070,-1603022,'Light preserve you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14261,1,0,0,'brann SAY_PLAYER_DEATH_2'), + (28070,-1603023,'I hope this is all worth it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14262,1,0,0,'brann SAY_PLAYER_DEATH_3'), + (28070,-1603024,'Time to get some answers! Let''s get this show on the road!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14259,1,0,0,'brann SAY_ESCORT_START'), + (28070,-1603025,'Don''t worry. Old Brann has got your back. Keep that metal monstrosity busy and I''ll see if I can sweet talk this machine into helping you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14274,1,0,0,'brann SAY_SPAWN_DWARF'), + (28070,-1603026,'This is a wee bit trickier that before... Oh, bloody--incomin''!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14275,1,0,0,'brann SAY_SPAWN_TROGG'), + (28070,-1603027,'What in the name o'' Madoran did THAT do? Oh! Wait: I just about got it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14276,1,0,0,'brann SAY_SPAWN_OOZE'), + (28070,-1603028,'Ha, that did it. Help''s a-coming. Take this you glow-eying brute!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14277,1,0,0,'brann SAY_SPAWN_EARTHEN'), + (28070,-1603029,'Take a moment and relish this with me! Soon all will be revealed! Okay then, let''s do this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14247,1,0,0,'brann SAY_EVENT_INTRO_1'), + (28070,-1603030,'Now keep an eye out! I''ll have this licked in two shakes of a--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14248,1,0,0,'brann SAY_EVENT_INTRO_2'), + (28070,-1603031,'Warning! Life form pattern not recognized. Archival processing terminated. Continued interference will result in targeted response.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13765,1,0,0,'brann SAY_EVENT_INTRO_3_ABED'), + (28070,-1603032,'Oh, that doesn''t sound good. We might have a complication or two...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14249,1,0,0,'brann SAY_EVENT_A_1'), + (28070,-1603033,'Security breach in progress. Analysis of historical archives transferred to lower priority queue. Countermeasures engaged.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13756,1,0,0,'brann SAY_EVENT_A_2_KADD'), + (28070,-1603034,'Ah, you want to play hardball, eh? That''s just my game!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14250,1,0,0,'brann SAY_EVENT_A_3'), + (28070,-1603035,'Couple more minutes and I''ll--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14251,1,0,0,'brann SAY_EVENT_B_1'), + (28070,-1603036,'Threat index threshold exceeded. Celestial archive aborted. Security level heightened.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13761,1,0,0,'brann SAY_EVENT_B_2_MARN'), + (28070,-1603037,'Heightened? What''s the good news?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14252,1,0,0,'brann SAY_EVENT_B_3'), + (28070,-1603038,'So that was the problem? Now I''m makin'' progress...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14253,1,0,0,'brann SAY_EVENT_C_1'), + (28070,-1603039,'Critical threat index. Void analysis diverted. Initiating sanitization protocol.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13767,1,0,0,'brann SAY_EVENT_C_2_ABED'), + (28070,-1603040,'Hang on! Nobody''s gonna'' be sanitized as long as I have a say in it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14254,1,0,0,'brann SAY_EVENT_C_3'), + (28070,-1603041,'Ha! The old magic fingers finally won through! Now let''s get down to-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14255,1,0,0,'brann SAY_EVENT_D_1'), + (28070,-1603042,'Alert! Security fail safes deactivated. Beginning memory purge...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13768,1,0,0,'brann SAY_EVENT_D_2_ABED'), + (28070,-1603043,'Purge? No no no no no! Where did I-- Aha, this should do the trick...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14256,1,0,0,'brann SAY_EVENT_D_3'), + (28070,-1603044,'System online. Life form pattern recognized. Welcome Branbronzan. Query?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13769,1,0,0,'brann SAY_EVENT_D_4_ABED'), + (28070,-1603045,'Query? What do you think I�m here for? Tea and biscuits? Spill the beans already!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14263,1,0,0,'brann SAY_EVENT_END_01'), + (28070,-1603046,'Tell me how that dwarfs came to be! And start at the beginning!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14264,1,0,0,'brann SAY_EVENT_END_02'), + (28070,-1603047,'Accessing prehistoric data. Retrieved. In the beginning Earthen were created to-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13770,1,0,0,'brann SAY_EVENT_END_03_ABED'), + (28070,-1603048,'Right, right! I know that the Earthen were made of stone to shape the deep reaches of the world but what about the anomalies? Matrix non-stabilizing and whatnot.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14265,1,0,0,'brann SAY_EVENT_END_04'), + (28070,-1603049,'Accessing. In the early stages of its development cycle Azeroth suffered infection by parasitic, necrophotic symbiotes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13771,1,0,0,'brann SAY_EVENT_END_05_ABED'), + (28070,-1603050,'Necro-what? Speak bloody common will ya?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14266,1,0,0,'brann SAY_EVENT_END_06'), + (28070,-1603051,'Designation: Old Gods. Old Gods rendered all systems, including Earthen defenseless in order to facilitate assimilation. This matrix destabilization has been termed the Curse of Flesh. Effects of destabilization increased over time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13772,1,0,0,'brann SAY_EVENT_END_07_ABED'), + (28070,-1603052,'Old Gods eh? So they zapped the Earthen with this Curse of Flesh. And then what?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14267,1,0,0,'brann SAY_EVENT_END_08'), + (28070,-1603053,'Accessing. Creators arrived to extirpate symbiotic infection. Assessment revealed that Old God infestation had grown malignant. Excising parasites would result in loss of host.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13757,1,0,0,'brann SAY_EVENT_END_09_KADD'), + (28070,-1603054,'If they killed the Old Gods Azeroth would have been destroyed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14268,1,0,0,'brann SAY_EVENT_END_10'), + (28070,-1603055,'Correct. Creators neutralized parasitic threat and contained it within the host. Forge of Wills and other systems were instituted to create new Earthen. Safeguards were implemented and protectors were appointed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13758,1,0,0,'brann SAY_EVENT_END_11_KADD'), + (28070,-1603056,'What protectors?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14269,1,0,0,'brann SAY_EVENT_END_12'), + (28070,-1603057,'Designations: Aesir and Vanir or in common nomenclator Storm and Earth Giants. Sentinel Loken designated supreme. Dragon Aspects appointed to monitor evolution of Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13759,1,0,0,'brann SAY_EVENT_END_13_KADD'), + (28070,-1603058,'Aesir and Vanir. Okay. So the Forge of Wills started to make new Earthen. But what happened to the old ones?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14270,1,0,0,'brann SAY_EVENT_END_14'), + (28070,-1603059,'Additional background is relevant to your query. Following global combat between-',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13762,1,0,0,'brann SAY_EVENT_END_15_MARN'), + (28070,-1603060,'Hold everything! The Aesir and Vanir went to war? Why?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14271,1,0,0,'brann SAY_EVENT_END_16'), + (28070,-1603061,'Unknown. Data suggests that impetus for global combat originated with prime designate Loken who neutralized all remaining Aesir and Vanir affecting termination of conflict. Prime designate Loken then initiated stasis of several seed races including Earthen, Giant and Vrykul at designated holding facilities.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13763,1,0,0,'brann SAY_EVENT_END_17_MARN'), + (28070,-1603062,'This Loken sounds like a nasty character. Glad we don�t have to worry about the likes of him anymore. So if I�m understanding you lads the original Earthen eventually woke up from this statis. And by that time this destabily-whatever had turned them into our brother dwarfs. Or at least dwarf ancestors. Hm?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14272,1,0,0,'brann SAY_EVENT_END_18'), + (28070,-1603063,'Essentially that is correct.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13764,1,0,0,'brann SAY_EVENT_END_19_MARN'), + (28070,-1603064,'Well now. That�s a lot to digest. I�m gonna need some time to take all of this in. Thank you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14273,1,0,0,'brann SAY_EVENT_END_20'), + (28070,-1603065,'Acknowledged Branbronzan. Session terminated.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13773,1,0,0,'brann SAY_EVENT_END_21_ABED'), + (28070,-1603066,'Loken?! That''s downright bothersome... We might''ve neutralized the iron dwarves, but I''d lay odds there''s another machine somewhere else churnin'' out a whole mess o'' these iron vrykul!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14278,1,0,0,'brann SAY_VICTORY_SJONNIR_1'), + (28070,-1603067,'I''ll use the forge to make badtches o'' earthen to stand guard... But our greatest challenge still remains: find and stop Loken!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14279,1,0,0,'brann SAY_VICTORY_SJONNIR_2'), + (28070,-1603068,'I think it''s time to see what''s behind the door near the entrance. I''m going to sneak over there, nice and quiet. Meet me at the door and I''ll get us in.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'brann SAY_ENTRANCE_MEET'); diff --git a/sql/updates/3.1.3_old/5936_world_scriptname.sql b/sql/updates/3.1.3_old/5936_world_scriptname.sql new file mode 100644 index 0000000..a4f44dd --- /dev/null +++ b/sql/updates/3.1.3_old/5936_world_scriptname.sql @@ -0,0 +1,11 @@ +UPDATE `creature_template` SET `ScriptName`='npc_sinclari_vh' WHERE `entry`=30658; +UPDATE `creature_template` SET `ScriptName`='npc_teleportation_portal_vh' WHERE `entry`=31011; +UPDATE `creature_template` SET `ScriptName`='boss_lavanthor' WHERE `entry`=29312; +UPDATE `creature_template` SET `ScriptName`='boss_ichoron' WHERE `entry`=29313; +UPDATE `creature_template` SET `ScriptName`='boss_zuramat' WHERE `entry`=29314; +UPDATE `creature_template` SET `ScriptName`='boss_erekem' WHERE `entry`=29315; +UPDATE `creature_template` SET `ScriptName`='mob_erekem_guard' WHERE `entry`=32226; +UPDATE `creature_template` SET `ScriptName`='boss_moragg' WHERE `entry`=29316; +UPDATE `creature_template` SET `ScriptName`='boss_xevozz' WHERE `entry`=29266; +UPDATE `creature_template` SET `ScriptName`='boss_cyanigosa' WHERE `entry`=31134; +UPDATE `instance_template` SET `script`='instance_violet_hold' WHERE `map`=608; diff --git a/sql/updates/3.1.3_old/5950_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/5950_world_spell_linked_spell.sql new file mode 100644 index 0000000..3794696 --- /dev/null +++ b/sql/updates/3.1.3_old/5950_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`='16857'; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +( 16857, 60089, 0, 'Faerie Fire (Feral)'); diff --git a/sql/updates/3.1.3_old/5962_world_scriptname.sql b/sql/updates/3.1.3_old/5962_world_scriptname.sql new file mode 100644 index 0000000..c52d709 --- /dev/null +++ b/sql/updates/3.1.3_old/5962_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_erekem_guard' WHERE `entry`=29395; diff --git a/sql/updates/3.1.3_old/5966_world_scriptname.sql b/sql/updates/3.1.3_old/5966_world_scriptname.sql new file mode 100644 index 0000000..a3c4551 --- /dev/null +++ b/sql/updates/3.1.3_old/5966_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='mob_massive_jormungar' WHERE `entry`=26685; +UPDATE `creature_template` SET `ScriptName`='mob_ferocious_rhino' WHERE `entry`=26686; +UPDATE `creature_template` SET `ScriptName`='mob_palehoof_orb' WHERE `entry`=26688; diff --git a/sql/updates/3.1.3_old/5970_world_scriptname.sql b/sql/updates/3.1.3_old/5970_world_scriptname.sql new file mode 100644 index 0000000..73a20b0 --- /dev/null +++ b/sql/updates/3.1.3_old/5970_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_amanitar' WHERE `entry`=30258; +UPDATE `creature_template` SET `ScriptName`='mob_amanitar_mushrooms' WHERE `entry` IN (30435,30391); +UPDATE `creature_template` SET `ScriptName`='boss_hadronox' WHERE `entry`=28921; diff --git a/sql/updates/3.1.3_old/5971_world_scriptname.sql b/sql/updates/3.1.3_old/5971_world_scriptname.sql new file mode 100644 index 0000000..6e3985b --- /dev/null +++ b/sql/updates/3.1.3_old/5971_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_nadox_eggs' WHERE `entry` IN (30172,30173); diff --git a/sql/updates/3.1.3_old/5985_world_scriptname.sql b/sql/updates/3.1.3_old/5985_world_scriptname.sql new file mode 100644 index 0000000..665187f --- /dev/null +++ b/sql/updates/3.1.3_old/5985_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='mob_stalagg' WHERE `entry`=15929; +UPDATE `creature_template` SET `ScriptName`='mob_feugen' WHERE `entry`=15930; diff --git a/sql/updates/3.1.3_old/5990_world_scriptname.sql b/sql/updates/3.1.3_old/5990_world_scriptname.sql new file mode 100644 index 0000000..f199530 --- /dev/null +++ b/sql/updates/3.1.3_old/5990_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_anub_arak' WHERE `entry`=29120; diff --git a/sql/updates/3.1.3_old/5994_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/5994_world_spell_bonus_data.sql new file mode 100644 index 0000000..91555ef --- /dev/null +++ b/sql/updates/3.1.3_old/5994_world_spell_bonus_data.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (20187,54158); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(20187, 0, 0, 0, 0, 'Paladin - Judgement of Righteousness'), +(54158, 0, 0, 0, 0, 'Paladin - Judgement (Seal of Light, Seal of Wisdom, Seal of Justice)'); diff --git a/sql/updates/3.1.3_old/5996_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/5996_world_spell_linked_spell.sql new file mode 100644 index 0000000..ce6c02f --- /dev/null +++ b/sql/updates/3.1.3_old/5996_world_spell_linked_spell.sql @@ -0,0 +1,16 @@ +-- Fix removing of Arcane Blast buff caused by Arcane Missiles spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-5143, -5144, -5145, -8416, -8417, -10211, -10212, -25345, -27075, -38699, -38704, -42843, -42846) AND `spell_effect` = -36032; +INSERT INTO `spell_linked_spell` (spell_trigger, spell_effect, type, comment) VALUES +(-5143, -36032, 0, 'Arcane Missiles Rank 1'), +(-5144, -36032, 0, 'Arcane Missiles Rank 2'), +(-5145, -36032, 0, 'Arcane Missiles Rank 3'), +(-8416, -36032, 0, 'Arcane Missiles Rank 4'), +(-8417, -36032, 0, 'Arcane Missiles Rank 5'), +(-10211, -36032, 0, 'Arcane Missiles Rank 6'), +(-10212, -36032, 0, 'Arcane Missiles Rank 7'), +(-25345, -36032, 0, 'Arcane Missiles Rank 8'), +(-27075, -36032, 0, 'Arcane Missiles Rank 9'), +(-38699, -36032, 0, 'Arcane Missiles Rank 10'), +(-38704, -36032, 0, 'Arcane Missiles Rank 11'), +(-42843, -36032, 0, 'Arcane Missiles Rank 12'), +(-42846, -36032, 0, 'Arcane Missiles Rank 13'); diff --git a/sql/updates/3.1.3_old/5996_world_spell_proc_event.sql b/sql/updates/3.1.3_old/5996_world_spell_proc_event.sql new file mode 100644 index 0000000..59c713d --- /dev/null +++ b/sql/updates/3.1.3_old/5996_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +-- Fix spell_proc_event for spell Arcane Blast, remove on Arcane Barrage or Arcane Explosion +DELETE FROM `spell_proc_event` WHERE `entry` = 36032; +INSERT INTO `spell_proc_event` (entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown) VALUES +(36032, 0, 3, 0x1000, 0x8000, 0, 0, 0, 0, 0, 0); diff --git a/sql/updates/3.1.3_old/5997_world_scriptname.sql b/sql/updates/3.1.3_old/5997_world_scriptname.sql new file mode 100644 index 0000000..aeb8f5b --- /dev/null +++ b/sql/updates/3.1.3_old/5997_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_jedoga_shadowseeker' WHERE `entry`='29310'; +UPDATE `creature_template` SET `ScriptName`='mob_jedoga_initiand' WHERE `entry`='30114'; +UPDATE `creature_template` SET `ScriptName`='npc_jedogas_aufseher_trigger' WHERE `entry`='30181'; diff --git a/sql/updates/3.1.3_old/6013_world_scriptname.sql b/sql/updates/3.1.3_old/6013_world_scriptname.sql new file mode 100644 index 0000000..4ed923c --- /dev/null +++ b/sql/updates/3.1.3_old/6013_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_iruxos' WHERE `entry` = 176581; diff --git a/sql/updates/3.1.3_old/6022_world_scriptname.sql b/sql/updates/3.1.3_old/6022_world_scriptname.sql new file mode 100644 index 0000000..7253c07 --- /dev/null +++ b/sql/updates/3.1.3_old/6022_world_scriptname.sql @@ -0,0 +1,6 @@ +UPDATE `creature_template` SET `ScriptName`='boss_kurinnaxx' WHERE `entry`=15348; +UPDATE `creature_template` SET `ScriptName`='boss_rajaxx' WHERE `entry`=15341; +UPDATE `creature_template` SET `ScriptName`='boss_moam' WHERE `entry`=15340; +UPDATE `creature_template` SET `ScriptName`='boss_buru' WHERE `entry`=15370; +UPDATE `creature_template` SET `ScriptName`='boss_ayamiss' WHERE `entry`=15369; +UPDATE `creature_template` SET `ScriptName`='boss_ossirian' WHERE `entry`=15339; diff --git a/sql/updates/3.1.3_old/6030_world_scriptname.sql b/sql/updates/3.1.3_old/6030_world_scriptname.sql new file mode 100644 index 0000000..25a29f5 --- /dev/null +++ b/sql/updates/3.1.3_old/6030_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='pyrewood_ambush' WHERE `entry`=2058; diff --git a/sql/updates/3.1.3_old/6066_world_scriptname.sql b/sql/updates/3.1.3_old/6066_world_scriptname.sql new file mode 100644 index 0000000..655fbaf --- /dev/null +++ b/sql/updates/3.1.3_old/6066_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_goblin_prisioner' WHERE `entry`=29446; +UPDATE `gameobject_template` SET ScriptName = 'go_rusty_cage' WHERE `entry`=191544; diff --git a/sql/updates/3.1.3_old/6071_world_spell_proc_event.sql b/sql/updates/3.1.3_old/6071_world_spell_proc_event.sql new file mode 100644 index 0000000..3fe9472 --- /dev/null +++ b/sql/updates/3.1.3_old/6071_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (44557, 44560, 44561); + +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(44557, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 1) +(44560, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 2) +(44561, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Enduring Winter (Rank 3) diff --git a/sql/updates/3.1.3_old/6074_world_scriptname.sql b/sql/updates/3.1.3_old/6074_world_scriptname.sql new file mode 100644 index 0000000..b7ad154 --- /dev/null +++ b/sql/updates/3.1.3_old/6074_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_goblin_prisoner' WHERE `entry`=29446; diff --git a/sql/updates/3.1.3_old/6077_world_scriptname.sql b/sql/updates/3.1.3_old/6077_world_scriptname.sql new file mode 100644 index 0000000..2f8372e --- /dev/null +++ b/sql/updates/3.1.3_old/6077_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_worshipper' WHERE `entry`=16506; diff --git a/sql/updates/3.1.3_old/6078_world_scriptname.sql b/sql/updates/3.1.3_old/6078_world_scriptname.sql new file mode 100644 index 0000000..4e2387c --- /dev/null +++ b/sql/updates/3.1.3_old/6078_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_goblin_prisoner' WHERE `entry`=29466; +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=29446; diff --git a/sql/updates/3.1.3_old/6079_world_scriptname.sql b/sql/updates/3.1.3_old/6079_world_scriptname.sql new file mode 100644 index 0000000..97d7d19 --- /dev/null +++ b/sql/updates/3.1.3_old/6079_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=16506; diff --git a/sql/updates/3.1.3_old/6091_world_scriptname.sql b/sql/updates/3.1.3_old/6091_world_scriptname.sql new file mode 100644 index 0000000..608acb1 --- /dev/null +++ b/sql/updates/3.1.3_old/6091_world_scriptname.sql @@ -0,0 +1,7 @@ +UPDATE `creature_template` SET `ScriptName`='npc_innkeeper' WHERE `entry` IN +(32418,32411,29926,30308,31433,32413,30005,29963,31115,31557,29971,18649,15397,6806,6778,16542,17553,19046,16739,16553,11116,9501, +6740,2352,6739,1247,3934,6727,7714,15433,16458,295,5111,7733,7737,6928,6929,6734,8931,1464,6272,7731,17630,6930,6747,12196,6736, +6738,11103,6741,6746,5688,6735,6737,2388,9356,7736,11106,5814,7744,6790,16618,11118,6791,23995,24208,6807,14731,16256,15174,16826, +19531,16602,19470,19232,21088,18245,18906,18905,18251,18907,18908,27148,18914,27187,21746,19352,19319,18957,19571,19495,18913,21744, +23731,21110,23143,23937,25278,25245,26596,24149,24033,25036,24057,27950,27042,22922,27066,27027,27052,26709,24342,26985,27125,26680, +29532,28687,28686,27174,28791,29583,26375,28038,29904); diff --git a/sql/updates/3.1.3_old/6097_world_loot_template.sql b/sql/updates/3.1.3_old/6097_world_loot_template.sql new file mode 100644 index 0000000..aada38e --- /dev/null +++ b/sql/updates/3.1.3_old/6097_world_loot_template.sql @@ -0,0 +1,14 @@ +-- Currently utilized in the following tables (1 = default, 0 = disabled) +ALTER TABLE `creature_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `gameobject_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `reference_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; + +-- Currently not utilized in the following tables (1 = enabled, any other value = disabled) +ALTER TABLE `fishing_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `disenchant_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `item_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `milling_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `pickpocketing_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `prospecting_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `skinning_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; +ALTER TABLE `quest_mail_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; diff --git a/sql/updates/3.1.3_old/6109_world_scriptname.sql b/sql/updates/3.1.3_old/6109_world_scriptname.sql new file mode 100644 index 0000000..627e2f3 --- /dev/null +++ b/sql/updates/3.1.3_old/6109_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_scourge_prisoner' WHERE `entry`=25610; +UPDATE `gameobject_template` SET `ScriptName`='go_scourge_cage' WHERE `entry`=187867; diff --git a/sql/updates/3.1.3_old/6110_world_loot_template.sql b/sql/updates/3.1.3_old/6110_world_loot_template.sql new file mode 100644 index 0000000..72f81cb --- /dev/null +++ b/sql/updates/3.1.3_old/6110_world_loot_template.sql @@ -0,0 +1 @@ +ALTER TABLE `spell_loot_template` ADD COLUMN `lootmode` SMALLINT UNSIGNED NOT NULL DEFAULT 1 AFTER `ChanceOrQuestChance`; diff --git a/sql/updates/3.1.3_old/6129_world_scriptname.sql b/sql/updates/3.1.3_old/6129_world_scriptname.sql new file mode 100644 index 0000000..a416edc --- /dev/null +++ b/sql/updates/3.1.3_old/6129_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='boss_trollgore' WHERE `entry`=26630; +UPDATE `creature_template` SET `ScriptName`='boss_tharon_ja' WHERE `entry`=26632; diff --git a/sql/updates/3.1.3_old/6131_world_scriptname.sql b/sql/updates/3.1.3_old/6131_world_scriptname.sql new file mode 100644 index 0000000..1387501 --- /dev/null +++ b/sql/updates/3.1.3_old/6131_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='npc_loklira_crone' WHERE `entry`=29975; +UPDATE `creature_template` SET `ScriptName`='npc_victorious_challenger' WHERE `entry`=30012; +UPDATE `creature_template` SET `ScriptName`='npc_mcgoyver' WHERE `entry`=24040; +UPDATE `creature_template` SET `ScriptName`='npc_jenny' WHERE `entry`=25969; diff --git a/sql/updates/3.1.3_old/6134_world_scriptname.sql b/sql/updates/3.1.3_old/6134_world_scriptname.sql new file mode 100644 index 0000000..861c7ff --- /dev/null +++ b/sql/updates/3.1.3_old/6134_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='npc_drakkari_gutripper' WHERE `entry`=26641; +UPDATE `creature_template` SET `ScriptName`='npc_drakkari_scytheclaw' WHERE `entry`=26628; +UPDATE `creature_template` SET `ScriptName`='boss_dred' WHERE `entry`=27483; diff --git a/sql/updates/3.1.3_old/6142_world_spell_proc_event.sql b/sql/updates/3.1.3_old/6142_world_spell_proc_event.sql new file mode 100644 index 0000000..2dc175f --- /dev/null +++ b/sql/updates/3.1.3_old/6142_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN +(15318,15272,15320); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 15318, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x00002000, 0, 0, 0), -- Shadow Affinity (Rank 1) +( 15272, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x00002000, 0, 0, 0), -- Shadow Affinity (Rank 2) +( 15320, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x00002000, 0, 0, 0); -- Shadow Affinity (Rank 3) diff --git a/sql/updates/3.1.3_old/6156_characters_character_aura.sql b/sql/updates/3.1.3_old/6156_characters_character_aura.sql new file mode 100644 index 0000000..0fee9d9 --- /dev/null +++ b/sql/updates/3.1.3_old/6156_characters_character_aura.sql @@ -0,0 +1,3 @@ +ALTER TABLE `character_aura` MODIFY COLUMN `effect_mask` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0, + MODIFY COLUMN `stackcount` TINYINT(3) UNSIGNED NOT NULL DEFAULT 1, + MODIFY COLUMN `remaincharges` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0; diff --git a/sql/updates/3.1.3_old/6156_characters_pet_aura.sql b/sql/updates/3.1.3_old/6156_characters_pet_aura.sql new file mode 100644 index 0000000..7728762 --- /dev/null +++ b/sql/updates/3.1.3_old/6156_characters_pet_aura.sql @@ -0,0 +1,3 @@ +ALTER TABLE `pet_aura` MODIFY COLUMN `effect_mask` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0, + MODIFY COLUMN `stackcount` TINYINT(3) UNSIGNED NOT NULL DEFAULT 1, + MODIFY COLUMN `remaincharges` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0; diff --git a/sql/updates/3.1.3_old/6156_world_exploration_basexp.sql b/sql/updates/3.1.3_old/6156_world_exploration_basexp.sql new file mode 100644 index 0000000..5505f08 --- /dev/null +++ b/sql/updates/3.1.3_old/6156_world_exploration_basexp.sql @@ -0,0 +1,2 @@ +-- the (4) in TINYINT(4) is kind of useless here, but whatever. This column should be unsigned. +ALTER TABLE `exploration_basexp` MODIFY COLUMN `level` TINYINT(4) UNSIGNED NOT NULL DEFAULT 0; diff --git a/sql/updates/3.1.3_old/6161_world_scriptname.sql b/sql/updates/3.1.3_old/6161_world_scriptname.sql new file mode 100644 index 0000000..6ead256 --- /dev/null +++ b/sql/updates/3.1.3_old/6161_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_training_dummy' WHERE `entry` IN (2674,2673); diff --git a/sql/updates/3.1.3_old/6166_world_trinity_string.sql b/sql/updates/3.1.3_old/6166_world_trinity_string.sql new file mode 100644 index 0000000..fc59c68 --- /dev/null +++ b/sql/updates/3.1.3_old/6166_world_trinity_string.sql @@ -0,0 +1,26 @@ +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES + (756, 'Battle begins!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (757, '%s has successfully defended the fortress!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (758, '%s has taken over the fortress!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (759, 'The %s siege workshop has been damaged by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (760, 'The %s siege workshop has been destroyed by the %s!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (761, 'The %s tower has been damaged!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (762, 'The %s tower has been destroyed!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (763, 'Wintergrasp fortress is under attack!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (764, 'Wintergrasp is now under the control of the %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (765, 'Wintergrasp timer set to %s.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (766, 'Wintergrasp battle started.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (767, 'Wintergrasp battle finished.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (768, 'Wintergrasp info: %s controled. Timer: %s. Wartime: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (769, 'Wintergrasp outdoorPvP is disabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (770, 'Wintergrasp outdoorPvP is enabled.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (771, 'You have reached Rank 1: Corporal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), + (772, 'You have reached Rank 2: First Lieutenant', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO command (name, security, help) VALUES + ('wg', 3, 'Syntax: .wg $subcommand.'), + ('wg enable', 3, 'Syntax: .wg enable [on/off] Enable/Disable Wintergrasp outdoorPvP.'), + ('wg start', 3, 'Syntax: .wg start\r\nForce Wintergrasp battle start.'), + ('wg status', 3, 'Syntax: .wg status\r\nWintergrasp info, defender, timer, wartime.'), + ('wg stop', 3, 'Syntax: .wg stop\r\nForce Wintergrasp battle stop (No rewards).'), + ('wg switch', 3, 'Syntax: .wg switch\r\nSwitchs Wintergrasp defender team.'), + ('wg timer', 3, 'Syntax: .wg timer\r\nChange Wintergrasp current timer (in secs).'); diff --git a/sql/updates/3.1.3_old/6171_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/6171_world_spell_linked_spell.sql new file mode 100644 index 0000000..f3b628e --- /dev/null +++ b/sql/updates/3.1.3_old/6171_world_spell_linked_spell.sql @@ -0,0 +1,5 @@ +INSERT INTO `spell_linked_spell` (spell_trigger, spell_effect, type, comment) VALUES + (-58600, 61243, 0, 'No fly zone - Parachute'), + (-58730, 61243, 0, 'No fly zone - Parachute'); +INSERT INTO `trinity_string` (entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8) VALUES + (816, 'You have entered a No-Fly Zone and are about to be dismounted.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.1.3_old/6173_world_trinity_string.sql b/sql/updates/3.1.3_old/6173_world_trinity_string.sql new file mode 100644 index 0000000..ab31d79 --- /dev/null +++ b/sql/updates/3.1.3_old/6173_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry`=816; +INSERT INTO `trinity_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES +(816, 'Warning: You''ve entered a no-fly zone and are about to be dismounted!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.1.3_old/6176_world_ainame.sql b/sql/updates/3.1.3_old/6176_world_ainame.sql new file mode 100644 index 0000000..d2ecfb4 --- /dev/null +++ b/sql/updates/3.1.3_old/6176_world_ainame.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `AIName` = 'AOEAI' WHERE `entry` IN ('23336','23069','23259'); diff --git a/sql/updates/3.1.3_old/6208_world_scriptname.sql b/sql/updates/3.1.3_old/6208_world_scriptname.sql new file mode 100644 index 0000000..5b7f773 --- /dev/null +++ b/sql/updates/3.1.3_old/6208_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_loatheb_spore' WHERE `entry`=16286; diff --git a/sql/updates/3.1.3_old/6210_world_scriptname.sql b/sql/updates/3.1.3_old/6210_world_scriptname.sql new file mode 100644 index 0000000..02e4014 --- /dev/null +++ b/sql/updates/3.1.3_old/6210_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_faerlina_add' WHERE `entry`=16506; diff --git a/sql/updates/3.1.3_old/6213_world_script_waypoint.sql b/sql/updates/3.1.3_old/6213_world_script_waypoint.sql new file mode 100644 index 0000000..c1cd790 --- /dev/null +++ b/sql/updates/3.1.3_old/6213_world_script_waypoint.sql @@ -0,0 +1,44 @@ +DELETE FROM `script_waypoint` WHERE `entry`=25208; +INSERT INTO `script_waypoint` VALUES + (25208, 0, 4014.01, 6391.91, 29.9735, 17000, ''), + (25208, 1, 4029.05, 6374.1, 28.8288, 0, ''), + (25208, 2, 4039.11, 6370.05, 27.8701, 0, ''), + (25208, 3, 4052.24, 6364.92, 27.2941, 0, ''), + (25208, 4, 4058.31, 6357.79, 26.3543, 0, ''), + (25208, 5, 4062.46, 6346.26, 24.3838, 0, ''), + (25208, 6, 4063.82, 6334.14, 25.3818, 0, ''), + (25208, 7, 4062.66, 6319.39, 24.9775, 0, ''), + (25208, 8, 4061.14, 6307.67, 24.4034, 0, ''), + (25208, 9, 4059.64, 6301.33, 24.5615, 0, ''), + (25208, 10, 4066.46, 6292.12, 24.3167, 0, ''), + (25208, 11, 4078.37, 6280.88, 26.6926, 0, ''), + (25208, 12, 4087.03, 6281.33, 27.4604, 0, ''), + (25208, 13, 4097.8, 6282.47, 25.4414, 0, ''), + (25208, 14, 4107.07, 6279.26, 25.2578, 0, ''), + (25208, 15, 4114.68, 6279.78, 24.7762, 0, ''), + (25208, 16, 4122.9, 6280.34, 26.1671, 0, ''), + (25208, 17, 4127.69, 6280.67, 28.1951, 0, ''), + (25208, 18, 4134.75, 6282.09, 28.9761, 0, ''), + (25208, 19, 4141.62, 6281.92, 29.3518, 0, ''), + (25208, 20, 4152.14, 6281.43, 30.6951, 0, ''), + (25208, 21, 4159.63, 6282.6, 30.2401, 0, ''), + (25208, 22, 4169.82, 6289.25, 24.182, 0, ''), + (25208, 23, 4181.02, 6293.88, 18.035, 0, ''), + (25208, 24, 4189.27, 6295.87, 14.4513, 0, ''), + (25208, 25, 4200.09, 6298.4, 12.7249, 0, ''), + (25208, 26, 4206.46, 6291.56, 10.9628, 0, ''), + (25208, 27, 4211.45, 6282.82, 9.05693, 0, ''), + (25208, 28, 4215.22, 6277.25, 8.54002, 0, ''), + (25208, 29, 4215.28, 6268.57, 8.30674, 0, ''), + (25208, 30, 4224.23, 6269.53, 6.97205, 0, ''), + (25208, 31, 4235.98, 6270.9, 3.27214, 0, ''), + (25208, 32, 4242.67, 6269.45, 1.45579, 0, ''), + (25208, 33, 4250.43, 6262.49, 0.611961, 0, ''), + (25208, 34, 4259.07, 6253.33, -0.0686721, 0, ''), + (25208, 35, 4261.11, 6248.81, -0.112029, 0, ''), + (25208, 36, 4257.58, 6234.09, -0.094803, 0, ''), + (25208, 37, 4252.62, 6224.3, -0.154816, 0, ''), + (25208, 38, 4247.92, 6214.75, -0.221144, 0, ''), + (25208, 39, 4254.04, 6205.58, -0.186623, 0, ''), + (25208, 40, 4262.6, 6194.47, -0.145114, 0, ''), + (25208, 41, 4268.96, 6189.47, 0.0303093, 21000, ''); diff --git a/sql/updates/3.1.3_old/6213_world_scriptname.sql b/sql/updates/3.1.3_old/6213_world_scriptname.sql new file mode 100644 index 0000000..e3f88d0 --- /dev/null +++ b/sql/updates/3.1.3_old/6213_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='npc_lurgglbr' WHERE `entry`=25208; +UPDATE `creature_template` SET `ScriptName`='npc_nexus_drake_hatchling' WHERE `entry`=26127; +UPDATE `creature_template` SET `ScriptName`='npc_nesingwary_trapper' WHERE `entry`=25835; +UPDATE `item_template` SET `ScriptName`='item_pile_fake_furs' WHERE `entry`=35127; diff --git a/sql/updates/3.1.3_old/6221_world_scriptname.sql b/sql/updates/3.1.3_old/6221_world_scriptname.sql new file mode 100644 index 0000000..dd68f4b --- /dev/null +++ b/sql/updates/3.1.3_old/6221_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='npc_death_ravager' WHERE `entry`=17556; +UPDATE `gameobject_template` SET `ScriptName`='go_ravager_cage' WHERE `entry`=181849; +UPDATE `creature_template` SET `ScriptName`='npc_enraged_panther' WHERE `entry`=10992; +UPDATE `gameobject_template` SET `ScriptName`='go_panther_cage' WHERE `entry`=176195; diff --git a/sql/updates/3.1.3_old/6241_world_quest_template.sql b/sql/updates/3.1.3_old/6241_world_quest_template.sql new file mode 100644 index 0000000..bc1fe74 --- /dev/null +++ b/sql/updates/3.1.3_old/6241_world_quest_template.sql @@ -0,0 +1,5 @@ +-- Change column QuestLevel to allowed -1 value. +ALTER TABLE `quest_template` CHANGE `QuestLevel` `QuestLeveltemp` INT(8); +ALTER TABLE `quest_template` ADD `QuestLevel` SMALLINT(3) AFTER `QuestLeveltemp`; +UPDATE `quest_template` SET `QuestLevel` = `QuestLeveltemp`; +ALTER TABLE `quest_template` DROP `QuestLeveltemp`; diff --git a/sql/updates/3.1.3_old/6242_world_scriptname.sql b/sql/updates/3.1.3_old/6242_world_scriptname.sql new file mode 100644 index 0000000..6b78a09 --- /dev/null +++ b/sql/updates/3.1.3_old/6242_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_scourge_cage' WHERE `entry` IN (187854, 187855, 187856, 187857, 187858, 187859, 187860, 187862, 187863, 187864, 187865, 187866, 187867, 187868, 187870, 187871, 187872, 187873, 187874, 187861, 190803); diff --git a/sql/updates/3.1.3_old/6246_world_scriptname.sql b/sql/updates/3.1.3_old/6246_world_scriptname.sql new file mode 100644 index 0000000..9501824 --- /dev/null +++ b/sql/updates/3.1.3_old/6246_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_lunaclaw_spirit' WHERE `entry`=12144; diff --git a/sql/updates/3.1.3_old/6247_world_scriptname.sql b/sql/updates/3.1.3_old/6247_world_scriptname.sql new file mode 100644 index 0000000..e7e4e5b --- /dev/null +++ b/sql/updates/3.1.3_old/6247_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_arcane_prison' WHERE `entry`=187561; diff --git a/sql/updates/3.1.3_old/6253_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/6253_world_spell_linked_spell.sql new file mode 100644 index 0000000..69bb4cc --- /dev/null +++ b/sql/updates/3.1.3_old/6253_world_spell_linked_spell.sql @@ -0,0 +1,62 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` in (33878,33986,33987,48563,48564,33876,33982,33983,48565,48566); + +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(33878, -33876, 1, 'Mangle - Remover'), +(33878, -33982, 1, 'Mangle - Remover'), +(33878, -33983, 1, 'Mangle - Remover'), +(33878, -48565, 1, 'Mangle - Remover'), +(33878, -48566, 1, 'Mangle - Remover'), + +(33986, -33876, 1, 'Mangle - Remover'), +(33986, -33982, 1, 'Mangle - Remover'), +(33986, -33983, 1, 'Mangle - Remover'), +(33986, -48565, 1, 'Mangle - Remover'), +(33986, -48566, 1, 'Mangle - Remover'), + +(33987, -33876, 1, 'Mangle - Remover'), +(33987, -33982, 1, 'Mangle - Remover'), +(33987, -33983, 1, 'Mangle - Remover'), +(33987, -48565, 1, 'Mangle - Remover'), +(33987, -48566, 1, 'Mangle - Remover'), + +(48563, -33876, 1, 'Mangle - Remover'), +(48563, -33982, 1, 'Mangle - Remover'), +(48563, -33983, 1, 'Mangle - Remover'), +(48563, -48565, 1, 'Mangle - Remover'), +(48563, -48566, 1, 'Mangle - Remover'), + +(48564, -33876, 1, 'Mangle - Remover'), +(48564, -33982, 1, 'Mangle - Remover'), +(48564, -33983, 1, 'Mangle - Remover'), +(48564, -48565, 1, 'Mangle - Remover'), +(48564, -48566, 1, 'Mangle - Remover'), + +(33876, -33878, 1, 'Mangle - Remover'), +(33982, -33878, 1, 'Mangle - Remover'), +(33983, -33878, 1, 'Mangle - Remover'), +(48565, -33878, 1, 'Mangle - Remover'), +(48566, -33878, 1, 'Mangle - Remover'), + +(33876, -33986, 1, 'Mangle - Remover'), +(33982, -33986, 1, 'Mangle - Remover'), +(33983, -33986, 1, 'Mangle - Remover'), +(48565, -33986, 1, 'Mangle - Remover'), +(48566, -33986, 1, 'Mangle - Remover'), + +(33876, -33987, 1, 'Mangle - Remover'), +(33982, -33987, 1, 'Mangle - Remover'), +(33983, -33987, 1, 'Mangle - Remover'), +(48565, -33987, 1, 'Mangle - Remover'), +(48566, -33987, 1, 'Mangle - Remover'), + +(33876, -48563, 1, 'Mangle - Remover'), +(33982, -48563, 1, 'Mangle - Remover'), +(33983, -48563, 1, 'Mangle - Remover'), +(48565, -48563, 1, 'Mangle - Remover'), +(48566, -48563, 1, 'Mangle - Remover'), + +(33876, -48564, 1, 'Mangle - Remover'), +(33982, -48564, 1, 'Mangle - Remover'), +(33983, -48564, 1, 'Mangle - Remover'), +(48565, -48564, 1, 'Mangle - Remover'), +(48566, -48564, 1, 'Mangle - Remover'); diff --git a/sql/updates/3.1.3_old/6275_world_trinity_string.sql b/sql/updates/3.1.3_old/6275_world_trinity_string.sql new file mode 100644 index 0000000..f7d897f --- /dev/null +++ b/sql/updates/3.1.3_old/6275_world_trinity_string.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default` = 'Wintergrasp info: %s controlled. Timer: %s. Wartime: %s. Number of Players: (Horde: %u, Alliance: %u)' WHERE `entry` = 768; diff --git a/sql/updates/3.1.3_old/6277_world_scriptname.sql b/sql/updates/3.1.3_old/6277_world_scriptname.sql new file mode 100644 index 0000000..4a91e5d --- /dev/null +++ b/sql/updates/3.1.3_old/6277_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_mageguard_dalaran' WHERE `entry` IN (29254,29255); diff --git a/sql/updates/3.1.3_old/6277_world_spell_target_position.sql b/sql/updates/3.1.3_old/6277_world_spell_target_position.sql new file mode 100644 index 0000000..b63829a --- /dev/null +++ b/sql/updates/3.1.3_old/6277_world_spell_target_position.sql @@ -0,0 +1,5 @@ +-- positions for Dalaran 'Trespasser!' spell +DELETE FROM `spell_target_position` WHERE `id` IN (54028,54029); +INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES +(54028, 571, 5758.79, 678.359, 642.726, 5.572), +(54029, 571, 5849.16, 602.093, 651.13, 2.364); diff --git a/sql/updates/3.1.3_old/6308_world_scriptname.sql b/sql/updates/3.1.3_old/6308_world_scriptname.sql new file mode 100644 index 0000000..367bf8c --- /dev/null +++ b/sql/updates/3.1.3_old/6308_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_blackfathom_altar' WHERE `entry` IN (103015,103016); diff --git a/sql/updates/3.1.3_old/6317_world_scriptname.sql b/sql/updates/3.1.3_old/6317_world_scriptname.sql new file mode 100644 index 0000000..4a3f070 --- /dev/null +++ b/sql/updates/3.1.3_old/6317_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_gelihast' WHERE `entry`=6243; +UPDATE `creature_template` SET `ScriptName`='boss_kelris' WHERE `entry`=4832; +UPDATE `creature_template` SET `ScriptName`='boss_aku_mai' WHERE `entry`=4829; diff --git a/sql/updates/3.1.3_old/6337_world_spell_bonus_data.sql b/sql/updates/3.1.3_old/6337_world_spell_bonus_data.sql new file mode 100644 index 0000000..14ee43c --- /dev/null +++ b/sql/updates/3.1.3_old/6337_world_spell_bonus_data.sql @@ -0,0 +1,11 @@ +DELETE FROM spell_bonus_data WHERE entry IN (47757, 52986, 52987, 52988); -- Old Penance in DB +DELETE FROM spell_bonus_data WHERE entry IN (47750, 52983, 52954, 58985, 47666, 52998, 52999, 53000); +INSERT INTO spell_bonus_data (entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus, comments) VALUES +(47750, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 1)'), +(52983, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 2)'), +(52954, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 3)'), +(58985, 0.5362, -1, -1, -1, 'Priest - Penance Heal (Rank 4)'), +(47666, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 1)'), +(52998, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 2)'), +(52999, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 3)'), +(53000, 0.229, -1, -1, -1, 'Priest - Penance Hurt (Rank 4)'); diff --git a/sql/updates/3.1.3_old/6357_world_scriptname.sql b/sql/updates/3.1.3_old/6357_world_scriptname.sql new file mode 100644 index 0000000..bef418e --- /dev/null +++ b/sql/updates/3.1.3_old/6357_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_blood_filled_orb' WHERE `entry`=182024; diff --git a/sql/updates/3.1.3_old/6372_world_spell_proc_event.sql b/sql/updates/3.1.3_old/6372_world_spell_proc_event.sql new file mode 100644 index 0000000..bd0a1ca --- /dev/null +++ b/sql/updates/3.1.3_old/6372_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +UPDATE spell_proc_event SET entry = 53489 WHERE entry = 53486; +UPDATE spell_proc_event SET entry = 59578 WHERE entry = 53488; diff --git a/sql/updates/3.1.3_old/6374_world_creature_template.sql b/sql/updates/3.1.3_old/6374_world_creature_template.sql new file mode 100644 index 0000000..0de6244 --- /dev/null +++ b/sql/updates/3.1.3_old/6374_world_creature_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `creature_template` ADD `questItem5` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `questItem4`; +ALTER TABLE `creature_template` ADD `questItem6` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `questItem5`; diff --git a/sql/updates/3.1.3_old/6374_world_gameobject_template.sql b/sql/updates/3.1.3_old/6374_world_gameobject_template.sql new file mode 100644 index 0000000..02fd2ae --- /dev/null +++ b/sql/updates/3.1.3_old/6374_world_gameobject_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `gameobject_template` ADD `questItem5` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `questItem4`; +ALTER TABLE `gameobject_template` ADD `questItem6` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `questItem5`; diff --git a/sql/updates/3.1.3_old/6381_world_script_texts.sql b/sql/updates/3.1.3_old/6381_world_script_texts.sql new file mode 100644 index 0000000..e6dbe09 --- /dev/null +++ b/sql/updates/3.1.3_old/6381_world_script_texts.sql @@ -0,0 +1,22 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1571004,-1571005,-1571006,-1571007,-1571008,-1571009,-1571010,-1571011,-1571012,-1571013,-1571014,-1571015,-1571016,-1571017,-1571018,-1571019,-1571020,-1571021,-1571022,-1571022,-1571023); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (25301 ,-1571004,'My liege, the infiltration and control of the Alliance power structure by our cultists is well underway.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26203 ,-1571005,'Your progress in this region has been impressive, Blood Prince. I am pleased...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26203 ,-1571006,'The power you''ve bestowed upon me has allowed me great mental influence over human minds. I bear these offerings as proof of my progress.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170 ,-1571007,'Leryssa!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (26170 ,-1571008,'What have you done to my sister, you motherless elf scum!?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (26203 ,-1571009,'Now this is a surprise, Thassarian. I hadn''t heard from Mograine or the other death knights for months. You''ve come to rejoin the Scourge, I take it?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170 ,-1571010,'I would sooner slit my own throat. You will pay for what you did to your own men, Arthas... for what you did to me! I swear it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25301 ,-1571011,'Allow me to take care of the intruders, lord. I will feed their entrails to the maggots.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26203 ,-1571012,'Do not fail me, San''layn. Return to Icecrown with this fool''s head or do not bother to return.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25301 ,-1571013,'Yes, my lord!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25250 ,-1571014,'What... what happened to me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25250 ,-1571015,'Ugh! My head won''t stop spinning...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25251 ,-1571016,'Thassarian, you''re alive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (26170 ,-1571017,'Leryssa... you... you''re all right!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25251 ,-1571018,'I thought... I thought you were... dead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170 ,-1571019,'I cannot return home with you just yet, Leryssa. I am not quite done with the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25251,-1571020,'Don''t leave me again! You want to fight for your country, but they don''t even want you! They sent you here to die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571021,'You might be right, sister. My obligations to my land and King have been fulfilled. But there is still something that I owe to myself.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571022,'I know that look in your eye... I''m not going to be able to talk you out of this. If you die on me again...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (26170,-1571023,'Do not worry, Leryssa. I will come back to you when I''m done. Nothing in the world will stop me from coming home to the only family that I have left.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''); diff --git a/sql/updates/3.1.3_old/6381_world_script_waypoint.sql b/sql/updates/3.1.3_old/6381_world_script_waypoint.sql new file mode 100644 index 0000000..abfe142 --- /dev/null +++ b/sql/updates/3.1.3_old/6381_world_script_waypoint.sql @@ -0,0 +1,7 @@ +DELETE FROM `script_waypoint` WHERE `entry`=26170; +INSERT INTO `script_waypoint` VALUES + (26170,1, 3700.08, 3574.54, 473.322, 0, ''), + (26170,2, 3705.94, 3573.63, 476.841, 0, ''), + (26170,3, 3714.32, 3572.3, 477.442, 0, ''), + (26170,4, 3720.19,3563.44, 477.441, 0, ''), + (26170,5, 3721.24,3561.95, 477.44, 0, ''); diff --git a/sql/updates/3.1.3_old/6381_world_scriptname.sql b/sql/updates/3.1.3_old/6381_world_scriptname.sql new file mode 100644 index 0000000..75ef3b8 --- /dev/null +++ b/sql/updates/3.1.3_old/6381_world_scriptname.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `ScriptName`='npc_general_arlos' WHERE `entry`=25250; +UPDATE `creature_template` SET `ScriptName`='npc_leryssa' WHERE `entry`=25251; +UPDATE `creature_template` SET `ScriptName`='npc_thassarian' WHERE `entry`=26170; +UPDATE `creature_template` SET `ScriptName`='npc_image_lich_king' WHERE `entry`=26203; +UPDATE `creature_template` SET `ScriptName`='npc_counselor_talbot' WHERE `entry`=25301; diff --git a/sql/updates/3.1.3_old/6389_world_scriptname.sql b/sql/updates/3.1.3_old/6389_world_scriptname.sql new file mode 100644 index 0000000..f05e293 --- /dev/null +++ b/sql/updates/3.1.3_old/6389_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_beryl_sorcerer' WHERE `entry`=25316; diff --git a/sql/updates/3.1.3_old/6397_world_spell_script_target.sql b/sql/updates/3.1.3_old/6397_world_spell_script_target.sql new file mode 100644 index 0000000..2d5ef47 --- /dev/null +++ b/sql/updates/3.1.3_old/6397_world_spell_script_target.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_target` WHERE `entry`=45364 AND `type`=1 AND `targetEntry`=25478; +DELETE FROM `spell_script_target` WHERE `entry`=45634; +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(45634,1,25478); diff --git a/sql/updates/3.1.3_old/6398_world_script_texts.sql b/sql/updates/3.1.3_old/6398_world_script_texts.sql new file mode 100644 index 0000000..6f7cbce --- /dev/null +++ b/sql/updates/3.1.3_old/6398_world_script_texts.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1571024, -1571025, -1571026, -1571027, -1571028, -1571029, -1571030); +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`,`type`, `language`, `emote`, `comment`) VALUES + (25478,-1571024,'Pathetic fool! A servant of malygos would sooner die than aid an emeny...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571025,'Aargh! Do your worst, $C ! I''ll tell you NOTHING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571026,'Aahhhh! Release me! I am of no use to you. I swear it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571027,'Stop! I beg you, please stop. Please...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571028,'Alright! I am beaten. Your previous archmage is held in a prison, elevated and sealed. Even if you manage to reach her, Salrand herself holds the key. Your mission is folly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571029,'I''ve given you the information, $C ! You''re wasting your time....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (25478,-1571030,'Noooo! This tortue is inhumane! You have what you want... why don''t you just kill me?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''); diff --git a/sql/updates/3.1.3_old/6398_world_scriptname.sql b/sql/updates/3.1.3_old/6398_world_scriptname.sql new file mode 100644 index 0000000..07ea998 --- /dev/null +++ b/sql/updates/3.1.3_old/6398_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` ='npc_imprisoned_beryl_sorcerer' WHERE `entry` = 25478; diff --git a/sql/updates/3.1.3_old/6405_world_spell_script_target.sql b/sql/updates/3.1.3_old/6405_world_spell_script_target.sql new file mode 100644 index 0000000..cfafee3 --- /dev/null +++ b/sql/updates/3.1.3_old/6405_world_spell_script_target.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_target` WHERE `entry`=55083; +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(55083, 1, 29700), +(55083, 1, 29686); diff --git a/sql/updates/3.1.3_old/6420_world_script_texts.sql b/sql/updates/3.1.3_old/6420_world_script_texts.sql new file mode 100644 index 0000000..d9e2959 --- /dev/null +++ b/sql/updates/3.1.3_old/6420_world_script_texts.sql @@ -0,0 +1,17 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1000499,-1000450,-1000451,-1000452,-1000453,-1000454,-1000455,-1000456,-1000457,-1000458,-1000459,-1000460,-1000461,-1000462,-1000463); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (8856,-1000499,'By your command!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7766,-1000450,'Wait here. Spybot will make Lescovar come out as soon as possible. Be ready! Attack only after you''ve overheard their conversation.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000451,'Good day to you both. I would speak to Lord Lescovar.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1756,-1000452,'Of course. He awaits you in the library.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000453,'Thank you. The Light be with you both.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000454,'Milord, your guest has arrived. He awaits your presence.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000455,'Ah, thank you kindly. I will leave you to the library while I tend to this small matter.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (8856,-1000456,'I shall use the time wisely, milord. Thank you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000457,'It''s time for my meditation, leave me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1756,-1000458,'Yes, sir!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000459,'There you are. What news from Westfall?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1755,-1000460,'VanCleef sends word that the plans are underway. But he''s hear rumors about someone snooping about.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (1754,-1000461,'Hmm, it could be that meddle Shaw. I will see what I can discover. Be off with you. I''ll contact you again soon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7766,-1000462,'That''s it! That''s what you were waiting for! KILL THEM!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (1755,-1000463,'The Defias shall succeed! No meek adventurer will stop us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''); diff --git a/sql/updates/3.1.3_old/6420_world_script_waypoint.sql b/sql/updates/3.1.3_old/6420_world_script_waypoint.sql new file mode 100644 index 0000000..b9f989c --- /dev/null +++ b/sql/updates/3.1.3_old/6420_world_script_waypoint.sql @@ -0,0 +1,40 @@ +DELETE FROM `script_waypoint` WHERE `entry` = 1754; +INSERT INTO `script_waypoint` VALUES + (1754, 1, -8334.89, 394.130, 122.274, 0, ''), + (1754, 2, -8335.58, 393.519, 122.275, 0, ''), + (1754, 3, -8352.99, 379.932, 122.275, 0, ''), + (1754, 4, -8356.65, 385.247, 122.275, 0, ''), + (1754, 5, -8364.29, 395.317, 122.275, 0, ''), + (1754, 6, -8361.75, 402.852, 122.275, 0, ''), + (1754, 7, -8359.94, 410.92, 122.275, 0, ''), + (1754, 8, -8362.84, 415.409, 122.275, 0, ''), + (1754, 9, -8370.42, 424.6, 122.275, 0, ''), + (1754, 10, -8380.45, 437.115, 122.275, 0, ''), + (1754, 11, -8386.37, 444.906, 122.275, 0, ''), + (1754, 12, -8388.5, 447.314, 123.275, 0, ''), + (1754, 13, -8390.25, 449.247, 124.275, 0, ''), + (1754, 14, -8392.84, 452.397, 123.761, 0, ''), + (1754, 15, -8397.52, 457.326, 123.761, 0, ''), + (1754, 16, -8402.42, 461.646, 123.761, 0, ''), + (1754, 17, -8409.52, 462.677, 123.761, 0, ''); + +DELETE FROM `script_waypoint` WHERE `entry` = 8856; +INSERT INTO `script_waypoint` VALUES + (8856, 1, -8409.34, 453.345, 123.761, 0, ''), + (8856, 2, -8409.52, 462.677, 123.761, 0, ''), + (8856, 3, -8402.42, 461.646, 123.761, 0, ''), + (8856, 4, -8397.52, 457.326, 123.761, 0, ''), + (8856, 5, -8392.84, 452.397, 123.761, 0, ''), + (8856, 6, -8390.25, 449.247, 124.275, 0, ''), + (8856, 7, -8388.5, 447.314, 123.275, 0, ''), + (8856, 8, -8386.37, 444.906, 122.275, 0, ''), + (8856, 9, -8380.45, 437.115, 122.275, 0, ''), + (8856, 10, -8370.42, 424.6, 122.275, 0, ''), + (8856, 11, -8362.84, 415.409, 122.275, 0, ''), + (8856, 12, -8359.94, 410.92, 122.275, 0, ''), + (8856, 13, -8361.75, 402.852, 122.275, 0, ''), + (8856, 14, -8364.29, 395.317, 122.275, 0, ''), + (8856, 15, -8356.65, 385.247, 122.275, 0, ''), + (8856, 16, -8352.99, 379.932, 122.275, 0, ''), + (8856, 17, -8335.58, 393.519, 122.275, 0, ''), + (8856, 18, -8334.89, 394.13, 122.274, 0, ''); diff --git a/sql/updates/3.1.3_old/6420_world_scriptname.sql b/sql/updates/3.1.3_old/6420_world_scriptname.sql new file mode 100644 index 0000000..43b36b2 --- /dev/null +++ b/sql/updates/3.1.3_old/6420_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='npc_tyrion' WHERE `entry`=7766; +UPDATE `creature_template` SET `ScriptName`='npc_tyrion_spybot' WHERE `entry`=8856; +UPDATE `creature_template` SET `ScriptName`='npc_lord_gregor_lescovar' WHERE `entry`=1754; +UPDATE `creature_template` SET `ScriptName`='npc_marzon_silent_blade' WHERE `entry`=1755; diff --git a/sql/updates/3.1.3_old/6421_world_script_texts.sql b/sql/updates/3.1.3_old/6421_world_script_texts.sql new file mode 100644 index 0000000..90bfbc1 --- /dev/null +++ b/sql/updates/3.1.3_old/6421_world_script_texts.sql @@ -0,0 +1,4 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1571031, -1571032); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(30007,-1571031,'This battle must be seen to be believed! Once a mild-mannered tuskarr fisherman, our next fighter turned to the life of a soulless mercenary when his entire family was wiped out by a vicious pack of lion seals and III-tempered penguins! Now he''s just In It for the gold! Ladies and gentlemen, ORINOKO TUSKBREAKER!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13363,1,0,0,''), +(30020,-1571032,'Whisker! Where are you? Assist me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); diff --git a/sql/updates/3.1.3_old/6421_world_scriptname.sql b/sql/updates/3.1.3_old/6421_world_scriptname.sql new file mode 100644 index 0000000..19b67f4 --- /dev/null +++ b/sql/updates/3.1.3_old/6421_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_gurgthock' WHERE `entry`=30007; +UPDATE `creature_template` SET `ScriptName` = 'npc_orinoko_tuskbreaker' WHERE `entry`=30020; diff --git a/sql/updates/3.1.3_old/6424_world_spell_proc_event.sql b/sql/updates/3.1.3_old/6424_world_spell_proc_event.sql new file mode 100644 index 0000000..1108ebc --- /dev/null +++ b/sql/updates/3.1.3_old/6424_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +UPDATE spell_proc_event SET entry = 53486 WHERE entry =53489; +UPDATE spell_proc_event SET entry = 53488 WHERE entry =59578; diff --git a/sql/updates/3.1.3_old/6432_world_command.sql b/sql/updates/3.1.3_old/6432_world_command.sql new file mode 100644 index 0000000..a75f880 --- /dev/null +++ b/sql/updates/3.1.3_old/6432_world_command.sql @@ -0,0 +1 @@ +UPDATE `command` SET `help` = 'Syntax: .wg timer $minutes\r\nChange the current timer. Min value = 1, Max value 60 (Wartime), 1440 (Not Wartime)' WHERE `name` = 'wg timer'; diff --git a/sql/updates/3.1.3_old/6433_world_script_texts.sql b/sql/updates/3.1.3_old/6433_world_script_texts.sql new file mode 100644 index 0000000..ca4c7aa --- /dev/null +++ b/sql/updates/3.1.3_old/6433_world_script_texts.sql @@ -0,0 +1,4 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1571033,-1571034); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(30007,-1571033,'The champion of the Winterax trolls has challenged you, Treeofdoom! I hope you''re ready!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), +(30007,-1571034,'Hailling from the distant mountains of Alterac, one of the fiercest competitors this arena has ever seen: KORRAK THE BLOODRAGER!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13363,1,0,0,''); diff --git a/sql/updates/3.1.3_old/6433_world_scriptname.sql b/sql/updates/3.1.3_old/6433_world_scriptname.sql new file mode 100644 index 0000000..4152ffa --- /dev/null +++ b/sql/updates/3.1.3_old/6433_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_korrak_bloodrager' WHERE `entry`=30023; diff --git a/sql/updates/3.1.3_old/6439_world_spell_linked_spell.sql b/sql/updates/3.1.3_old/6439_world_spell_linked_spell.sql new file mode 100644 index 0000000..5c99fc1 --- /dev/null +++ b/sql/updates/3.1.3_old/6439_world_spell_linked_spell.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-54361, -59743); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(-54361, 54343, 0, 'Void Shift (Normal) - Void Shifted'), +(-59743, 54343, 0, 'Void Shift (Heroic) - Void Shifted'); diff --git a/sql/updates/3.1.3_old/6445_world_scriptname.sql b/sql/updates/3.1.3_old/6445_world_scriptname.sql new file mode 100644 index 0000000..b17889c --- /dev/null +++ b/sql/updates/3.1.3_old/6445_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_ethereal_sphere' WHERE `entry`=29271; diff --git a/sql/updates/3.1.3_old/6447_world_scriptname.sql b/sql/updates/3.1.3_old/6447_world_scriptname.sql new file mode 100644 index 0000000..8dc3242 --- /dev/null +++ b/sql/updates/3.1.3_old/6447_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_ichor_globule' WHERE `entry`=29321; diff --git a/sql/updates/3.1.3_old/6452_world_spell_script_target.sql b/sql/updates/3.1.3_old/6452_world_spell_script_target.sql new file mode 100644 index 0000000..b5ff7f4 --- /dev/null +++ b/sql/updates/3.1.3_old/6452_world_spell_script_target.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_target` WHERE `entry` IN (54160,59474); +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES +(54160, 1, 29266), +(59474, 1, 29266); diff --git a/sql/updates/3.1.3_old/6455_world_scriptname.sql b/sql/updates/3.1.3_old/6455_world_scriptname.sql new file mode 100644 index 0000000..8721eec --- /dev/null +++ b/sql/updates/3.1.3_old/6455_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_yggdras' WHERE `entry`=30014; diff --git a/sql/updates/3.1.3_old/6468_realmd_db_version.sql b/sql/updates/3.1.3_old/6468_realmd_db_version.sql new file mode 100644 index 0000000..cca9e1c --- /dev/null +++ b/sql/updates/3.1.3_old/6468_realmd_db_version.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `realmd_db_version`; diff --git a/sql/updates/3.1.3_old/6477_world_script_texts.sql b/sql/updates/3.1.3_old/6477_world_script_texts.sql new file mode 100644 index 0000000..e17664d --- /dev/null +++ b/sql/updates/3.1.3_old/6477_world_script_texts.sql @@ -0,0 +1,3 @@ +DELETE FROM `script_texts` WHERE `entry`=-1608000; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (30658,-1608000,'Prision guards, we are leaving! These adventurers are taking over! Go go go',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); diff --git a/sql/updates/3.1.3_old/6486_world_item_template.sql b/sql/updates/3.1.3_old/6486_world_item_template.sql new file mode 100644 index 0000000..91c8783 --- /dev/null +++ b/sql/updates/3.1.3_old/6486_world_item_template.sql @@ -0,0 +1,11 @@ +-- item_template update from Malcrom +-- Alter column AllowableClass to allowed max value signed. +ALTER TABLE `item_template` CHANGE `AllowableClass` `AllowableClasstemp` MEDIUMINT(9); +ALTER TABLE `item_template` ADD `AllowableClass` INT SIGNED NOT NULL AFTER `InventoryType`; +UPDATE `item_template` SET `AllowableClass` = `AllowableClasstemp`; +ALTER TABLE `item_template` DROP `AllowableClasstemp`; +-- Alter column AllowableRace to allowed max value signed. +ALTER TABLE `item_template` CHANGE `AllowableRace` `AllowableRacetemp` MEDIUMINT(9); +ALTER TABLE `item_template` ADD `AllowableRace` INT SIGNED NOT NULL AFTER `AllowableClass`; +UPDATE `item_template` SET `AllowableRace` = `AllowableRacetemp`; +ALTER TABLE `item_template` DROP `AllowableRacetemp`; diff --git a/sql/updates/3.1.3_old/6509_characters_character_skills.sql b/sql/updates/3.1.3_old/6509_characters_character_skills.sql new file mode 100644 index 0000000..ce6dd5a --- /dev/null +++ b/sql/updates/3.1.3_old/6509_characters_character_skills.sql @@ -0,0 +1,48 @@ +DROP TABLE IF EXISTS `character_skills`; +CREATE TABLE `character_skills` ( + `guid` int(11) unsigned NOT NULL COMMENT 'Global Unique Identifier', + `skill` mediumint(9) unsigned NOT NULL, + `value` int(11) unsigned NOT NULL, + `max` mediumint(9) unsigned NOT NULL, + i mediumint(9), + PRIMARY KEY (`guid`,`skill`,`i`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; + + +DROP TABLE IF EXISTS temp_skills; +CREATE TABLE temp_skills ( + i int(11) unsigned NOT NULL, + PRIMARY KEY (i) +); + +INSERT INTO temp_skills VALUES +( 0),( 1),( 2),( 3),( 4),( 5),( 6),( 7),( 8),( 9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19), +(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),(30),(31),(32),(33),(34),(35),(36),(37),(38),(39), +(40),(41),(42),(43),(44),(45),(46),(47),(48),(49),(50),(51),(52),(53),(54),(55),(56),(57),(58),(59), +(60),(61),(62),(63),(64),(65),(66),(67),(68),(69),(70),(71),(72),(73),(74),(75),(76),(77),(78),(79), +(80),(81),(82),(83),(84),(85),(86),(87),(88),(89),(90),(91),(92),(93),(94),(95),(96),(97),(98),(99), +(100),(101),(102),(103),(104),(105),(106),(107),(108),(109),(110),(111),(112),(113),(114),(115),(116),(117),(118),(119), +(120),(121),(122),(123),(124),(125),(126),(127); + +INSERT INTO character_skills SELECT +guid, +((SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 610+3*i))+2, length(SUBSTRING_INDEX(data, ' ', 610+3*i+1))- length(SUBSTRING_INDEX(data, ' ', 610+3*i)) - 1)) & 0xFFFF) as skill, +(SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 610+3*i+1))+2, length(SUBSTRING_INDEX(data, ' ', 610+3*i+2))- length(SUBSTRING_INDEX(data, ' ', 610+3*i+1)) - 1)) as value, +(0) as max, +i +FROM characters, temp_skills; + +DELETE FROM character_skills WHERE skill = 0; +DROP TABLE IF EXISTS temp_skills; + +UPDATE character_skills + SET max = ((value & 0xFFFF0000) >> 16); + +UPDATE character_skills + SET value = (value & 0xFFFF); + +ALTER IGNORE TABLE character_skills + CHANGE COLUMN value value mediumint(9) unsigned NOT NULL, + DROP PRIMARY KEY, + ADD PRIMARY KEY (guid,skill), + DROP COLUMN i; diff --git a/sql/updates/3.1.3_old/6518_world_spell_proc_event.sql b/sql/updates/3.1.3_old/6518_world_spell_proc_event.sql new file mode 100644 index 0000000..70e560d --- /dev/null +++ b/sql/updates/3.1.3_old/6518_world_spell_proc_event.sql @@ -0,0 +1,7 @@ +-- Add 20 second cooldown for Bloodworms +DELETE FROM `spell_proc_event` WHERE `entry` IN (49027, 49542, 49543); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(49027, 0, 0, 0, 0, 0, 0, 0, 0, 3, 20), -- Bloodworms rank 1 +(49542, 0, 0, 0, 0, 0, 0, 0, 0, 6, 20), -- Bloodworms rank 2 +(49543, 0, 0, 0, 0, 0, 0, 0, 0, 9, 20); -- Bloodworms rank 3 + diff --git a/sql/updates/3.1.3_old/6521_world_command.sql b/sql/updates/3.1.3_old/6521_world_command.sql new file mode 100644 index 0000000..11bb1c4 --- /dev/null +++ b/sql/updates/3.1.3_old/6521_world_command.sql @@ -0,0 +1 @@ +UPDATE `command` SET `name`='reload mail_loot_template' WHERE `name`='reload quest_mail_loot_template'; \ No newline at end of file diff --git a/sql/updates/3.1.3_old/6521_world_mail_level_reward.sql b/sql/updates/3.1.3_old/6521_world_mail_level_reward.sql new file mode 100644 index 0000000..656bb83 --- /dev/null +++ b/sql/updates/3.1.3_old/6521_world_mail_level_reward.sql @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS `mail_level_reward`; +CREATE TABLE `mail_level_reward` ( + `level` tinyint(3) unsigned NOT NULL default '0', + `raceMask` mediumint(8) unsigned NOT NULL default '0', + `mailTemplateId` mediumint(8) unsigned NOT NULL default '0', + `senderEntry` mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (`level`,`raceMask`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Mail System'; + +INSERT INTO `mail_level_reward` VALUES +(20, 1, 224, 4732),(20, 8, 225, 4753), +(20, 4, 226, 4772),(20, 1024, 227, 20914), +(20, 64, 228, 7954),(20, 32, 229, 3690), +(20, 128, 230, 7953),(20, 2, 231, 4752), +(20, 512, 232, 16280),(20, 16, 233, 4773); \ No newline at end of file diff --git a/sql/updates/3.1.3_old/6521_world_quest_mail_loot_template.sql b/sql/updates/3.1.3_old/6521_world_quest_mail_loot_template.sql new file mode 100644 index 0000000..08ebe03 --- /dev/null +++ b/sql/updates/3.1.3_old/6521_world_quest_mail_loot_template.sql @@ -0,0 +1,4 @@ +RENAME TABLE quest_mail_loot_template TO mail_loot_template; + +UPDATE mail_loot_template, quest_template + SET mail_loot_template.entry = quest_template.RewMailTemplateId WHERE mail_loot_template.entry = quest_template.entry; \ No newline at end of file diff --git a/sql/updates/3.1.3_old/6539_world_spell_proc_event.sql b/sql/updates/3.1.3_old/6539_world_spell_proc_event.sql new file mode 100644 index 0000000..a1d9d17 --- /dev/null +++ b/sql/updates/3.1.3_old/6539_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +-- Fixed Ruthlessness proc from Envenom +UPDATE spell_proc_event SET spellFamilyMask1 = 8 WHERE entry IN (14156, 14160, 14161); \ No newline at end of file diff --git a/sql/updates/3.1.3_old/6549_world_spell_proc_event.sql b/sql/updates/3.1.3_old/6549_world_spell_proc_event.sql new file mode 100644 index 0000000..a7cae2b --- /dev/null +++ b/sql/updates/3.1.3_old/6549_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (16086,16544); +INSERT INTO `spell_proc_event` VALUES +( 16086, 0x04, 11, 0x00000000, 0x00040000, 0x00000000, 0x00030000, 0x00000000, 0, 0, 0), -- Improved Fire Nova Totem (Rank 1) +( 16544, 0x04, 11, 0x00000000, 0x00040000, 0x00000000, 0x00030000, 0x00000000, 0, 0, 0); -- Improved Fire Nova Totem (Rank 2) diff --git a/sql/updates/3.1.3_old/CMakeLists.txt b/sql/updates/3.1.3_old/CMakeLists.txt new file mode 100644 index 0000000..5a99663 --- /dev/null +++ b/sql/updates/3.1.3_old/CMakeLists.txt @@ -0,0 +1,3 @@ +FILE(GLOB _SQL_313 *.sql) + +INSTALL(FILES ${_SQL_313} DESTINATION share/trinity/sql/updates/3.1.3_old) \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_characters_bugreport.sql b/sql/updates/3.2.2a_old/6589_characters_bugreport.sql new file mode 100644 index 0000000..0666ead --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_bugreport.sql @@ -0,0 +1,2 @@ +ALTER TABLE `bugreport` CHANGE `type` `type` LONGTEXT NOT NULL; +ALTER TABLE `bugreport` CHANGE `content` `content` LONGTEXT NOT NULL; \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_characters_character_action.sql b/sql/updates/3.2.2a_old/6589_characters_character_action.sql new file mode 100644 index 0000000..2389c9c --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_character_action.sql @@ -0,0 +1 @@ +DELETE FROM `character_action` WHERE `action` IN (31892, 53720) AND `type`=0; diff --git a/sql/updates/3.2.2a_old/6589_characters_character_aura.sql b/sql/updates/3.2.2a_old/6589_characters_character_aura.sql new file mode 100644 index 0000000..8c7b488 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_character_aura.sql @@ -0,0 +1 @@ +DELETE FROM `character_aura` WHERE `spell` IN (31892, 53720); diff --git a/sql/updates/3.2.2a_old/6589_characters_character_spell_cooldown.sql b/sql/updates/3.2.2a_old/6589_characters_character_spell_cooldown.sql new file mode 100644 index 0000000..6040c61 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_character_spell_cooldown.sql @@ -0,0 +1 @@ +DELETE FROM `character_spell_cooldown` WHERE `spell` IN (31892, 53720); diff --git a/sql/updates/3.2.2a_old/6589_characters_characters.sql b/sql/updates/3.2.2a_old/6589_characters_characters.sql new file mode 100644 index 0000000..6004625 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_characters.sql @@ -0,0 +1,16 @@ +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); + +UPDATE `characters` SET `data` = CONCAT( + SUBSTRING_INDEX(`data`, ' ', 1167 + 1), ' ', + '0 0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1246 + 1), ' ', -1246 + 1168 - 1), ' ', + '0 0 0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1294 + 1), ' ', -1294 + 1247 - 1), ' ', + '0 ' + ) +WHERE length(SUBSTRING_INDEX(data, ' ', 1294)) < length(data) and length(SUBSTRING_INDEX(data, ' ', 1294+1)) >= length(data); + +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); + diff --git a/sql/updates/3.2.2a_old/6589_characters_groups.sql b/sql/updates/3.2.2a_old/6589_characters_groups.sql new file mode 100644 index 0000000..f1d5ba5 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_groups.sql @@ -0,0 +1,2 @@ +ALTER TABLE `groups` + ADD COLUMN `raiddifficulty` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `difficulty`; \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_characters_instance_reset.sql b/sql/updates/3.2.2a_old/6589_characters_instance_reset.sql new file mode 100644 index 0000000..a887d55 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_instance_reset.sql @@ -0,0 +1,4 @@ +ALTER TABLE instance_reset + ADD COLUMN difficulty tinyint(1) unsigned NOT NULL default '0' AFTER mapid, + DROP PRIMARY KEY, + ADD PRIMARY KEY (`mapid`,`difficulty`); \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_characters_spell.sql b/sql/updates/3.2.2a_old/6589_characters_spell.sql new file mode 100644 index 0000000..e173250 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_characters_spell.sql @@ -0,0 +1 @@ +DELETE FROM `character_spell` WHERE `spell` IN (31892, 53720); diff --git a/sql/updates/3.2.2a_old/6589_realmd_realmlist.sql b/sql/updates/3.2.2a_old/6589_realmd_realmlist.sql new file mode 100644 index 0000000..51cc07d --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_realmd_realmlist.sql @@ -0,0 +1 @@ +UPDATE `realmlist` SET `gamebuild`=10505 WHERE `id`=1; \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_world_battleground_template.sql b/sql/updates/3.2.2a_old/6589_world_battleground_template.sql new file mode 100644 index 0000000..e636898 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_battleground_template.sql @@ -0,0 +1,4 @@ +INSERT INTO `battleground_template` ( `id` , `MinPlayersPerTeam` , `MaxPlayersPerTeam` , `MinLvl` , `MaxLvl` , `AllianceStartLoc` , `AllianceStartO` , `HordeStartLoc` , `HordeStartO` ) + VALUES ( 30, 20, 40, 71, 80, 1485, 0, 1486, 0 ) ; +INSERT INTO `battleground_template` ( `id` , `MinPlayersPerTeam` , `MaxPlayersPerTeam` , `MinLvl` , `MaxLvl` , `AllianceStartLoc` , `AllianceStartO` , `HordeStartLoc` , `HordeStartO` ) + VALUES ( 32, 0, 40, 0, 80, 0, 0, 0, 0 ) ; diff --git a/sql/updates/3.2.2a_old/6589_world_creature_template.sql b/sql/updates/3.2.2a_old/6589_world_creature_template.sql new file mode 100644 index 0000000..206cbc6 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_creature_template.sql @@ -0,0 +1,6 @@ +ALTER TABLE `creature_template` + CHANGE COLUMN heroic_entry difficulty_entry_1 mediumint(8) unsigned NOT NULL default '0'; +ALTER TABLE `creature_template` ADD `difficulty_entry_2` MEDIUMINT(8) unsigned + NOT NULL default 0 AFTER `difficulty_entry_1`; +ALTER TABLE `creature_template` ADD `difficulty_entry_3` MEDIUMINT(8) unsigned + NOT NULL default 0 AFTER `difficulty_entry_2`; \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_world_instance_template.sql b/sql/updates/3.2.2a_old/6589_world_instance_template.sql new file mode 100644 index 0000000..a306a67 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_instance_template.sql @@ -0,0 +1,4 @@ +ALTER TABLE `instance_template` + DROP COLUMN maxPlayers, + DROP COLUMN maxPlayersHeroic, + DROP COLUMN reset_delay; diff --git a/sql/updates/3.2.2a_old/6589_world_item_template.sql b/sql/updates/3.2.2a_old/6589_world_item_template.sql new file mode 100644 index 0000000..2a73527 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_item_template.sql @@ -0,0 +1,5 @@ +ALTER TABLE `item_template` + ADD COLUMN `Faction` int(11) UNSIGNED DEFAULT '0' NOT NULL AFTER `Flags`; + +ALTER TABLE item_template + CHANGE COLUMN ItemLevel ItemLevel smallint(5) unsigned NOT NULL DEFAULT 0; \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_world_player_classlevelstats.sql b/sql/updates/3.2.2a_old/6589_world_player_classlevelstats.sql new file mode 100644 index 0000000..674d761 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_player_classlevelstats.sql @@ -0,0 +1,82 @@ +DELETE from `player_classlevelstats` where `class` = 7; +INSERT INTO `player_classlevelstats` (`class`, `level`, `basehp`, `basemana`) VALUES +(7, 1, 40, 85), +(7, 2, 47, 91), +(7, 3, 55, 98), +(7, 4, 62, 106), +(7, 5, 70, 115), +(7, 6, 77, 125), +(7, 7, 85, 136), +(7, 8, 92, 148), +(7, 9, 100, 161), +(7, 10, 107, 175), +(7, 11, 114, 190), +(7, 12, 122, 206), +(7, 13, 129, 223), +(7, 14, 137, 241), +(7, 15, 144, 260), +(7, 16, 152, 280), +(7, 17, 161, 301), +(7, 18, 170, 323), +(7, 19, 181, 346), +(7, 20, 193, 370), +(7, 21, 205, 395), +(7, 22, 219, 421), +(7, 23, 234, 448), +(7, 24, 250, 476), +(7, 25, 257, 505), +(7, 26, 275, 535), +(7, 27, 294, 566), +(7, 28, 315, 598), +(7, 29, 336, 631), +(7, 30, 358, 665), +(7, 31, 371, 699), +(7, 32, 396, 733), +(7, 33, 422, 767), +(7, 34, 448, 786), +(7, 35, 465, 820), +(7, 36, 494, 854), +(7, 37, 524, 888), +(7, 38, 545, 922), +(7, 39, 577, 941), +(7, 40, 610, 975), +(7, 41, 633, 1009), +(7, 42, 669, 1028), +(7, 43, 694, 1062), +(7, 44, 732, 1096), +(7, 45, 760, 1115), +(7, 46, 799, 1149), +(7, 47, 829, 1183), +(7, 48, 871, 1202), +(7, 49, 903, 1236), +(7, 50, 947, 1255), +(7, 51, 981, 1289), +(7, 52, 1027, 1323), +(7, 53, 1064, 1342), +(7, 54, 1101, 1376), +(7, 55, 1150, 1395), +(7, 56, 1190, 1414), +(7, 57, 1231, 1448), +(7, 58, 1283, 1467), +(7, 59, 1326, 1501), +(7, 60, 1423, 1520), +(7, 61, 1528, 1664), +(7, 62, 1694, 1808), +(7, 63, 1883, 1951), +(7, 64, 2067, 2095), +(7, 65, 2262, 2239), +(7, 66, 2465, 2383), +(7, 67, 2679, 2527), +(7, 68, 2903, 2670), +(7, 69, 3136, 2814), +(7, 70, 3380, 2958), +(7, 71, 3633, 3102), +(7, 72, 3903, 3246), +(7, 73, 4194, 3389), +(7, 74, 4507, 3533), +(7, 75, 4843, 3677), +(7, 76, 5203, 3821), +(7, 77, 5592, 3965), +(7, 78, 6009, 4108), +(7, 79, 6457, 4252), +(7, 80, 6939, 4396); \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_world_playercreateinfo_action.sql b/sql/updates/3.2.2a_old/6589_world_playercreateinfo_action.sql new file mode 100644 index 0000000..6a1b0b8 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_playercreateinfo_action.sql @@ -0,0 +1,71 @@ +TRUNCATE `playercreateinfo_action`; +INSERT INTO `playercreateinfo_action` (`race`,`class`,`button`,`action`,`type`) VALUES +(1,1,0,6603,0),(1,1,11,117,128),(1,1,72,6603,0),(1,1,73,78,0),(1,1,82,59752,0),(1,1,83,117,128), +(1,1,84,6603,0),(1,1,96,6603,0),(1,1,108,6603,0),(1,2,0,6603,0),(1,2,1,21084,0),(1,2,2,635,0), +(1,2,9,59752,0),(1,2,10,159,128),(1,2,11,2070,128),(1,4,0,6603,0),(1,4,1,1752,0),(1,4,2,2098,0), +(1,4,3,2764,0),(1,4,10,59752,0),(1,4,11,2070,128),(1,5,0,6603,0),(1,5,1,585,0),(1,5,2,2050,0), +(1,5,9,59752,0),(1,5,10,159,128),(1,5,11,2070,128),(1,6,0,6603,0),(1,6,1,49576,0),(1,6,2,45477,0), +(1,6,3,45462,0),(1,6,4,45902,0),(1,6,5,47541,0),(1,6,11,59752,0),(1,8,0,6603,0),(1,8,1,133,0), +(1,8,2,168,0),(1,8,9,59752,0),(1,8,10,159,128),(1,8,11,2070,128),(1,9,0,6603,0),(1,9,1,686,0), +(1,9,2,687,0),(1,9,9,59752,0),(1,9,10,159,128),(1,9,11,4604,128),(2,1,0,6603,0),(2,1,72,6603,0), +(2,1,73,78,0),(2,1,74,20572,0),(2,1,83,117,128),(2,1,84,6603,0),(2,1,96,6603,0),(2,1,108,6603,0), +(2,3,0,6603,0),(2,3,1,2973,0),(2,3,2,75,0),(2,3,9,20572,0),(2,3,10,159,128),(2,3,11,117,128), +(2,4,0,6603,0),(2,4,1,1752,0),(2,4,2,2098,0),(2,4,3,2764,0),(2,4,4,20572,0),(2,4,11,117,128), +(2,6,0,6603,0),(2,6,1,49576,0),(2,6,2,45477,0),(2,6,3,45462,0),(2,6,4,45902,0),(2,6,5,47541,0), +(2,6,10,20572,0),(2,7,0,6603,0),(2,7,1,403,0),(2,7,2,331,0),(2,7,3,33697,0),(2,7,10,159,128), +(2,7,11,117,128),(2,9,0,6603,0),(2,9,1,686,0),(2,9,2,687,0),(2,9,3,33702,0),(2,9,10,159,128), +(2,9,11,117,128),(3,1,0,6603,0),(3,1,1,78,0),(3,1,11,117,128),(3,1,72,6603,0),(3,1,73,78,0), +(3,1,74,20594,0),(3,1,75,2481,0),(3,1,83,117,128),(3,1,84,6603,0),(3,1,96,6603,0), +(3,1,108,6603,0),(3,2,0,6603,0),(3,2,1,21084,0),(3,2,2,635,0),(3,2,3,20594,0),(3,2,4,2481,0), +(3,2,10,159,128),(3,2,11,4540,128),(3,3,0,6603,0),(3,3,1,2973,0),(3,3,2,75,0),(3,3,3,20594,0), +(3,3,4,2481,0),(3,3,10,159,128),(3,3,11,117,128),(3,3,75,20594,0),(3,3,76,2481,0),(3,4,0,6603,0), +(3,4,1,1752,0),(3,4,2,2098,0),(3,4,3,2764,0),(3,4,4,20594,0),(3,4,5,2481,0),(3,4,11,4540,128), +(3,5,0,6603,0),(3,5,1,585,0),(3,5,2,2050,0),(3,5,3,20594,0),(3,5,4,2481,0),(3,5,10,159,128), +(3,5,11,4540,128),(3,6,0,6603,0),(3,6,1,49576,0),(3,6,2,45477,0),(3,6,3,45462,0),(3,6,4,45902,0), +(3,6,5,47541,0),(3,6,10,2481,0),(4,1,72,6603,0),(4,4,82,58984,0),(4,1,73,78,0),(4,1,82,58984,0), +(4,1,83,117,128),(4,1,85,6603,0),(4,1,97,6603,0),(4,1,109,6603,0),(4,3,0,6603,0),(4,3,1,2973,0), +(4,3,2,75,0),(4,3,3,58984,0),(4,3,10,159,128),(4,3,11,117,128),(4,4,0,6603,0),(4,4,1,1752,0), +(4,4,2,2098,0),(4,4,3,2764,0),(4,4,10,58984,0),(4,4,11,4540,128),(4,5,0,6603,0),(4,5,1,585,0), +(4,5,2,2050,0),(4,5,3,58984,0),(4,5,10,159,128),(4,5,11,2070,128),(4,6,0,6603,0),(4,6,1,49576,0), +(4,6,2,45477,0),(4,6,3,45462,0),(4,6,4,45902,0),(4,6,5,47541,0),(4,6,10,58984,0),(4,6,83,58984,0), +(4,11,0,6603,0),(4,11,1,5176,0),(4,11,2,5185,0),(4,11,9,58984,0),(4,11,10,159,128),(4,11,11,4536,128), +(5,1,0,6603,0),(5,1,72,6603,0),(5,1,73,78,0),(5,1,74,20577,0),(5,1,83,4604,128),(5,1,84,6603,0), +(5,1,96,6603,0),(5,1,108,6603,0),(5,4,0,6603,0),(5,4,1,1752,0),(5,4,2,2098,0),(5,4,3,2764,0), +(5,4,4,20577,0),(5,4,11,4604,128),(5,5,0,6603,0),(5,5,1,585,0),(5,5,2,2050,0),(5,5,3,20577,0), +(5,5,10,159,128),(5,5,11,4604,128),(5,6,0,6603,0),(5,6,1,49576,0),(5,6,2,45477,0),(5,6,3,45462,0), +(5,6,4,45902,0),(5,6,5,47541,0),(5,6,10,20577,0),(5,8,0,6603,0),(5,8,1,133,0),(5,8,2,168,0),(5,8,3,20577,0), +(5,8,10,159,128),(5,8,11,4604,128),(5,9,0,6603,0),(5,9,1,686,0),(5,9,2,687,0),(5,9,3,20577,0),(5,9,10,159,128), +(5,9,11,4604,128),(6,1,0,6603,0),(6,1,1,78,0),(6,1,3,20549,0),(6,1,72,6603,0),(6,1,73,78,0),(6,1,74,20549,0), +(6,1,83,4540,128),(6,1,84,6603,0),(6,1,96,6603,0),(6,1,108,6603,0),(6,3,0,6603,0),(6,3,1,2973,0),(6,3,2,75,0), +(6,3,3,20549,0),(6,3,10,159,128),(6,3,11,117,128),(6,3,76,20549,0),(6,6,0,6603,0),(6,6,1,49576,0),(6,6,2,45477,0), +(6,6,3,45462,0),(6,6,4,45902,0),(6,6,5,47541,0),(6,6,10,20549,0),(6,6,75,20549,0),(6,7,0,6603,0),(6,7,1,403,0), +(6,7,2,331,0),(6,7,3,20549,0),(6,7,10,159,128),(6,7,11,4604,128),(6,7,76,20549,0),(6,11,0,6603,0),(6,11,1,5176,0), +(6,11,2,5185,0),(6,11,3,20549,0),(6,11,10,159,128),(6,11,11,4536,128),(6,11,73,6603,0),(6,11,76,20549,0), +(6,11,85,6603,0),(6,11,97,6603,0),(6,11,109,6603,0),(7,1,0,6603,0),(7,1,1,78,0),(7,1,10,20589,0),(7,1,11,117,128), +(7,1,72,6603,0),(7,1,73,78,0),(7,1,82,20589,0),(7,1,83,117,128),(7,1,84,6603,0),(7,1,96,6603,0),(7,1,108,6603,0), +(7,4,0,6603,0),(7,4,1,1752,0),(7,4,2,2098,0),(7,4,3,2764,0),(7,4,10,20589,0),(7,4,11,117,128),(7,6,0,6603,0), +(7,6,1,49576,0),(7,6,2,45477,0),(7,6,3,45462,0),(7,6,4,45902,0),(7,6,5,47541,0),(7,6,10,20589,0),(7,6,83,41751,128), +(7,6,72,6603,0),(7,6,11,41751,128),(7,6,84,6603,0),(7,6,96,6603,0),(7,6,108,6603,0),(7,8,0,6603,0),(7,8,1,133,0), +(7,8,2,168,0),(7,8,9,20589,0),(7,8,10,159,128),(7,8,11,4536,128),(7,9,0,6603,0),(7,9,1,686,0),(7,9,2,687,0), +(7,9,9,20589,0),(7,9,10,159,128),(7,9,11,4604,128),(8,1,0,6603,0),(8,1,72,6603,0),(8,1,73,78,0),(8,1,74,2764,0), +(8,1,75,26297,0),(8,1,83,117,128),(8,1,84,6603,0),(8,1,96,6603,0),(8,1,108,6603,0),(8,3,0,6603,0),(8,3,1,2973,0), +(8,3,2,75,0),(8,3,10,159,128),(8,3,11,4604,128),(8,8,3,26297,0),(8,4,0,6603,0),(8,4,1,1752,0),(8,4,2,2098,0), +(8,4,3,2764,0),(8,4,11,117,128),(8,4,4,26297,0),(8,5,0,6603,0),(8,5,1,585,0),(8,5,2,2050,0),(8,5,10,159,128), +(8,5,11,4540,128),(8,7,3,26297,0),(8,6,0,6603,0),(8,6,1,49576,0),(8,6,2,45477,0),(8,6,3,45462,0),(8,6,4,45902,0), +(8,6,5,47541,0),(8,6,10,26297,0),(8,7,0,6603,0),(8,7,1,403,0),(8,7,2,331,0),(8,7,10,159,128),(8,7,11,117,128), +(8,5,3,26297,0),(8,8,0,6603,0),(8,8,1,133,0),(8,8,2,168,0),(8,8,10,159,128),(8,8,11,117,128),(8,3,3,26297,0), +(10,2,0,6603,0),(10,2,1,21084,0),(10,2,2,635,0),(10,2,3,28730,0),(10,2,10,159,128),(10,2,11,20857,128), +(10,3,0,6603,0),(10,3,1,2973,0),(10,3,2,75,0),(10,3,3,28730,0),(10,3,10,159,128),(10,3,11,20857,128), +(10,4,0,6603,0),(10,4,1,1752,0),(10,4,2,2098,0),(10,4,3,2764,0),(10,4,4,25046,0),(10,4,11,20857,128), +(10,5,0,6603,0),(10,5,1,585,0),(10,5,2,2050,0),(10,5,3,28730,0),(10,5,10,159,128),(10,5,11,20857,128), +(10,6,0,6603,0),(10,6,1,49576,0),(10,6,2,45477,0),(10,6,3,45462,0),(10,6,4,45902,0),(10,6,5,47541,0), +(10,6,6,50613,0),(10,8,0,6603,0),(10,8,1,133,0),(10,8,2,168,0),(10,8,3,28730,0),(10,8,10,159,128),(10,8,11,20857,128), +(10,9,0,6603,0),(10,9,1,686,0),(10,9,2,687,0),(10,9,3,28730,0),(10,9,10,159,128),(10,9,11,20857,128),(11,1,0,6603,0), +(11,1,72,6603,0),(11,1,73,78,0),(11,1,74,28880,0),(11,1,83,4540,128),(11,1,84,6603,0),(11,1,96,6603,0),(11,1,108,6603,0), +(11,2,0,6603,0),(11,2,1,21084,0),(11,2,2,635,0),(11,2,3,59542,0),(11,2,10,159,128),(11,2,11,4540,128),(11,2,83,4540,128), +(11,3,0,6603,0),(11,3,1,2973,0),(11,3,2,75,0),(11,3,3,59543,0),(11,3,10,159,128),(11,3,11,4540,128),(11,3,72,6603,0), +(11,3,73,2973,0),(11,3,74,75,0),(11,3,82,159,128),(11,3,83,4540,128),(11,5,0,6603,0),(11,5,1,585,0),(11,5,2,2050,0), +(11,5,3,59544,0),(11,5,10,159,128),(11,5,11,4540,128),(11,5,83,4540,128),(11,6,0,6603,0),(11,6,1,49576,0),(11,6,2,45477,0), +(11,6,3,45462,0),(11,6,4,45902,0),(11,6,5,47541,0),(11,6,10,59545,0),(11,7,0,6603,0),(11,7,1,403,0),(11,7,2,331,0), +(11,7,3,59547,0),(11,7,10,159,128),(11,7,11,4540,128),(11,8,0,6603,0),(11,8,1,133,0),(11,8,2,168,0),(11,8,3,59548,0), +(11,8,10,159,128),(11,8,11,4540,128),(11,8,83,4540,128),(11,6,11,41751,128); diff --git a/sql/updates/3.2.2a_old/6589_world_playercreateinfo_spell.sql b/sql/updates/3.2.2a_old/6589_world_playercreateinfo_spell.sql new file mode 100644 index 0000000..f3cd735 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_playercreateinfo_spell.sql @@ -0,0 +1,3 @@ +TRUNCATE `playercreateinfo_spell`; +INSERT INTO `playercreateinfo_spell` (`race`,`class`,`Spell`,`Note`) VALUES +(1,1,78,'Heroic Strike'),(1,1,81,'Dodge'),(1,1,107,'Block'),(1,1,196,'One-Handed Axes'),(1,1,198,'One-Handed Maces'),(1,1,201,'One-Handed Swords'),(1,1,203,'Unarmed'),(1,1,204,'Defense'),(1,1,522,'SPELLDEFENSE (DND)'),(1,1,668,'Language Common'),(1,1,1843,'Disarm'),(1,1,2382,'Generic'),(1,1,2457,'Battle Stance'),(1,1,2479,'Honorless Target'),(1,1,3050,'Detect'),(1,1,3365,'Opening'),(1,1,5301,'Defensive State (DND)'),(1,1,6233,'Closing'),(1,1,6246,'Closing'),(1,1,6247,'Opening'),(1,1,6477,'Opening'),(1,1,6478,'Opening'),(1,1,6603,'Attack'),(1,1,7266,'Duel'),(1,1,7267,'Grovel'),(1,1,7355,'Stuck'),(1,1,8386,'Attacking'),(1,1,8737,'Mail'),(1,1,9077,'Leather'),(1,1,9078,'Cloth'),(1,1,9116,'Shield'),(1,1,9125,'Generic'),(1,1,20597,'Sword Specialization'),(1,1,20598,'The Human Spirit'),(1,1,20599,'Diplomacy'),(1,1,20864,'Mace Specialization'),(1,1,21651,'Opening'),(1,1,21652,'Closing'),(1,1,22027,'Remove Insignia'),(1,1,22810,'Opening - No Text'),(1,1,32215,'Victorious State'),(1,1,45927,'Summon Friend'),(1,1,58985,'Perception'),(1,1,59752,'Every Man for Himself'),(1,1,61437,'Opening'),(1,2,81,'Dodge'),(1,2,107,'Block'),(1,2,198,'One-Handed Maces'),(1,2,199,'Two-Handed Maces'),(1,2,203,'Unarmed'),(1,2,204,'Defense'),(1,2,522,'SPELLDEFENSE (DND)'),(1,2,635,'Holy Light'),(1,2,668,'Language Common'),(1,2,1843,'Disarm'),(1,2,2382,'Generic'),(1,2,2479,'Honorless Target'),(1,2,3050,'Detect'),(1,2,3365,'Opening'),(1,2,6233,'Closing'),(1,2,6246,'Closing'),(1,2,6247,'Opening'),(1,2,6477,'Opening'),(1,2,6478,'Opening'),(1,2,6603,'Attack'),(1,2,7266,'Duel'),(1,2,7267,'Grovel'),(1,2,7355,'Stuck'),(1,2,8386,'Attacking'),(1,2,8737,'Mail'),(1,2,9077,'Leather'),(1,2,9078,'Cloth'),(1,2,9116,'Shield'),(1,2,9125,'Generic'),(1,2,21084,'Seal of Righteousness'),(1,2,20597,'Sword Specialization'),(1,2,20598,'The Human Spirit'),(1,2,20599,'Diplomacy'),(1,2,20864,'Mace Specialization'),(1,2,21651,'Opening'),(1,2,21652,'Closing'),(1,2,22027,'Remove Insignia'),(1,2,22810,'Opening - No Text'),(1,2,27762,'Libram'),(1,2,45927,'Summon Friend'),(1,2,58985,'Perception'),(1,2,59752,'Every Man for Himself'),(1,2,61437,'Opening'),(1,4,81,'Dodge'),(1,4,203,'Unarmed'),(1,4,204,'Defense'),(1,4,522,'SPELLDEFENSE (DND)'),(1,4,668,'Language Common'),(1,4,1180,'Daggers'),(1,4,1752,'Sinister Strike'),(1,4,1843,'Disarm'),(1,4,2098,'Eviscerate'),(1,4,2382,'Generic'),(1,4,2479,'Honorless Target'),(1,4,2567,'Thrown'),(1,4,2764,'Throw'),(1,4,3050,'Detect'),(1,4,3365,'Opening'),(1,4,6233,'Closing'),(1,4,6246,'Closing'),(1,4,6247,'Opening'),(1,4,6477,'Opening'),(1,4,6478,'Opening'),(1,4,6603,'Attack'),(1,4,7266,'Duel'),(1,4,7267,'Grovel'),(1,4,7355,'Stuck'),(1,4,8386,'Attacking'),(1,4,9077,'Leather'),(1,4,9078,'Cloth'),(1,4,9125,'Generic'),(1,4,16092,'Defensive State (DND)'),(1,4,20597,'Sword Specialization'),(1,4,20598,'The Human Spirit'),(1,4,20599,'Diplomacy'),(1,4,20864,'Mace Specialization'),(1,4,21184,'Rogue Passive (DND)'),(1,4,21651,'Opening'),(1,4,21652,'Closing'),(1,4,22027,'Remove Insignia'),(1,4,22810,'Opening - No Text'),(1,4,45927,'Summon Friend'),(1,4,58985,'Perception'),(1,4,59752,'Every Man for Himself'),(1,4,61437,'Opening'),(1,5,81,'Dodge'),(1,5,198,'One-Handed Maces'),(1,5,203,'Unarmed'),(1,5,204,'Defense'),(1,5,522,'SPELLDEFENSE (DND)'),(1,5,585,'Smite'),(1,5,668,'Language Common'),(1,5,1843,'Disarm'),(1,5,2050,'Lesser Heal'),(1,5,2382,'Generic'),(1,5,2479,'Honorless Target'),(1,5,3050,'Detect'),(1,5,3365,'Opening'),(1,5,5009,'Wands'),(1,5,5019,'Shoot'),(1,5,6233,'Closing'),(1,5,6246,'Closing'),(1,5,6247,'Opening'),(1,5,6477,'Opening'),(1,5,6478,'Opening'),(1,5,6603,'Attack'),(1,5,7266,'Duel'),(1,5,7267,'Grovel'),(1,5,7355,'Stuck'),(1,5,8386,'Attacking'),(1,5,9078,'Cloth'),(1,5,9125,'Generic'),(1,5,20597,'Sword Specialization'),(1,5,20598,'The Human Spirit'),(1,5,20599,'Diplomacy'),(1,5,20864,'Mace Specialization'),(1,5,21651,'Opening'),(1,5,21652,'Closing'),(1,5,22027,'Remove Insignia'),(1,5,22810,'Opening - No Text'),(1,5,45927,'Summon Friend'),(1,5,58985,'Perception'),(1,5,59752,'Every Man for Himself'),(1,5,61437,'Opening'),(1,6,81,'Dodge'),(1,6,196,'One-Handed Axes'),(1,6,197,'Two-Handed Axes'),(1,6,200,'Polearms'),(1,6,201,'One-Handed Swords'),(1,6,202,'Two-Handed Swords'),(1,6,203,'Unarmed'),(1,6,204,'Defense'),(1,6,522,'SPELLDEFENSE (DND)'),(1,6,668,'Language Common'),(1,6,674,'Dual Wield'),(1,6,750,'Plate Mail'),(1,6,1843,'Disarm'),(1,6,2382,'Generic'),(1,6,2479,'Honorless Target'),(1,6,3050,'Detect'),(1,6,3127,'Parry'),(1,6,3275,'Linen Bandage'),(1,6,3276,'Heavy Linen Bandage'),(1,6,3277,'Wool Bandage'),(1,6,3278,'Heavy Wool Bandage'),(1,6,3365,'Opening'),(1,6,6233,'Closing'),(1,6,6246,'Closing'),(1,6,6247,'Opening'),(1,6,6477,'Opening'),(1,6,6478,'Opening'),(1,6,6603,'Attack'),(1,6,7266,'Duel'),(1,6,7267,'Grovel'),(1,6,7355,'Stuck'),(1,6,7928,'Silk Bandage'),(1,6,7929,'Heavy Silk Bandage'),(1,6,7934,'Anti-Venom'),(1,6,8386,'Attacking'),(1,6,8737,'Mail'),(1,6,9077,'Leather'),(1,6,9078,'Cloth'),(1,6,9125,'Generic'),(1,6,10840,'Mageweave Bandage'),(1,6,10841,'Heavy Mageweave Bandage'),(1,6,10846,'First Aid'),(1,6,18629,'Runecloth Bandage'),(1,6,18630,'Heavy Runecloth Bandage'),(1,6,20597,'Sword Specialization'),(1,6,20598,'The Human Spirit'),(1,6,20599,'Diplomacy'),(1,6,20864,'Mace Specialization'),(1,6,21651,'Opening'),(1,6,21652,'Closing'),(1,6,22027,'Remove Insignia'),(1,6,22810,'Opening - No Text'),(1,6,33391,'Journeyman Riding'),(1,6,45462,'Plague Strike'),(1,6,45477,'Icy Touch'),(1,6,45902,'Blood Strike'),(1,6,45903,'Offensive State (DND)'),(1,6,45927,'Summon Friend'),(1,6,47541,'Death Coil'),(1,6,48266,'Blood Presence'),(1,6,49410,'Forceful Deflection'),(1,6,49576,'Death Grip'),(1,6,52665,'Sigil'),(1,6,58985,'Perception'),(1,6,59752,'Every Man for Himself'),(1,6,59879,'Blood Plague'),(1,6,59921,'Frost Fever'),(1,6,61437,'Opening'),(1,6,61455,'Runic Focus'),(1,8,81,'Dodge'),(1,8,133,'Fireball'),(1,8,168,'Frost Armor'),(1,8,203,'Unarmed'),(1,8,204,'Defense'),(1,8,227,'Staves'),(1,8,522,'SPELLDEFENSE (DND)'),(1,8,668,'Language Common'),(1,8,1843,'Disarm'),(1,8,2382,'Generic'),(1,8,2479,'Honorless Target'),(1,8,3050,'Detect'),(1,8,3365,'Opening'),(1,8,5009,'Wands'),(1,8,5019,'Shoot'),(1,8,6233,'Closing'),(1,8,6246,'Closing'),(1,8,6247,'Opening'),(1,8,6477,'Opening'),(1,8,6478,'Opening'),(1,8,6603,'Attack'),(1,8,7266,'Duel'),(1,8,7267,'Grovel'),(1,8,7355,'Stuck'),(1,8,8386,'Attacking'),(1,8,9078,'Cloth'),(1,8,9125,'Generic'),(1,8,20597,'Sword Specialization'),(1,8,20598,'The Human Spirit'),(1,8,20599,'Diplomacy'),(1,8,20864,'Mace Specialization'),(1,8,21651,'Opening'),(1,8,21652,'Closing'),(1,8,22027,'Remove Insignia'),(1,8,22810,'Opening - No Text'),(1,8,45927,'Summon Friend'),(1,8,58985,'Perception'),(1,8,59752,'Every Man for Himself'),(1,8,61437,'Opening'),(1,9,81,'Dodge'),(1,9,203,'Unarmed'),(1,9,204,'Defense'),(1,9,522,'SPELLDEFENSE (DND)'),(1,9,668,'Language Common'),(1,9,686,'Shadow Bolt'),(1,9,687,'Demon Skin'),(1,9,1180,'Daggers'),(1,9,1843,'Disarm'),(1,9,2382,'Generic'),(1,9,2479,'Honorless Target'),(1,9,3050,'Detect'),(1,9,3365,'Opening'),(1,9,5009,'Wands'),(1,9,5019,'Shoot'),(1,9,6233,'Closing'),(1,9,6246,'Closing'),(1,9,6247,'Opening'),(1,9,6477,'Opening'),(1,9,6478,'Opening'),(1,9,6603,'Attack'),(1,9,7266,'Duel'),(1,9,7267,'Grovel'),(1,9,7355,'Stuck'),(1,9,8386,'Attacking'),(1,9,9078,'Cloth'),(1,9,9125,'Generic'),(1,9,20597,'Sword Specialization'),(1,9,20598,'The Human Spirit'),(1,9,20599,'Diplomacy'),(1,9,20864,'Mace Specialization'),(1,9,21651,'Opening'),(1,9,21652,'Closing'),(1,9,22027,'Remove Insignia'),(1,9,22810,'Opening - No Text'),(1,9,45927,'Summon Friend'),(5,9,58284,'Chaos Bolt Passive'),(1,9,58985,'Perception'),(1,9,59752,'Every Man for Himself'),(1,9,61437,'Opening'),(2,1,78,'Heroic Strike'),(2,1,81,'Dodge'),(2,1,107,'Block'),(2,1,196,'One-Handed Axes'),(2,1,197,'Two-Handed Axes'),(2,1,201,'One-Handed Swords'),(2,1,203,'Unarmed'),(2,1,204,'Defense'),(2,1,522,'SPELLDEFENSE (DND)'),(2,1,669,'Language Orcish'),(2,1,1843,'Disarm'),(2,1,2382,'Generic'),(2,1,2457,'Battle Stance'),(2,1,2479,'Honorless Target'),(2,1,3050,'Detect'),(2,1,3365,'Opening'),(2,1,5301,'Defensive State (DND)'),(2,1,6233,'Closing'),(2,1,6246,'Closing'),(2,1,6247,'Opening'),(2,1,6477,'Opening'),(2,1,6478,'Opening'),(2,1,6603,'Attack'),(2,1,7266,'Duel'),(2,1,7267,'Grovel'),(2,1,7355,'Stuck'),(2,1,8386,'Attacking'),(2,1,8737,'Mail'),(2,1,9077,'Leather'),(2,1,9078,'Cloth'),(2,1,9116,'Shield'),(2,1,9125,'Generic'),(2,1,20572,'Blood Fury'),(2,1,20573,'Hardiness'),(2,1,20574,'Axe Specialization'),(2,1,21563,'Command'),(2,1,21651,'Opening'),(2,1,21652,'Closing'),(2,1,22027,'Remove Insignia'),(2,1,22810,'Opening - No Text'),(2,1,32215,'Victorious State'),(2,1,45927,'Summon Friend'),(2,1,61437,'Opening'),(2,3,75,'Auto Shot'),(2,3,81,'Dodge'),(2,3,196,'One-Handed Axes'),(2,3,203,'Unarmed'),(2,3,204,'Defense'),(2,3,264,'Bows'),(2,3,522,'SPELLDEFENSE (DND)'),(2,3,669,'Language Orcish'),(2,3,1843,'Disarm'),(2,3,2382,'Generic'),(2,3,2479,'Honorless Target'),(2,3,2973,'Raptor Strike'),(2,3,3050,'Detect'),(2,3,3365,'Opening'),(2,3,6233,'Closing'),(2,3,6246,'Closing'),(2,3,6247,'Opening'),(2,3,6477,'Opening'),(2,3,6478,'Opening'),(2,3,6603,'Attack'),(2,3,7266,'Duel'),(2,3,7267,'Grovel'),(2,3,7355,'Stuck'),(2,3,8386,'Attacking'),(2,3,9077,'Leather'),(2,3,9078,'Cloth'),(2,3,9125,'Generic'),(2,3,13358,'Defensive State (DND)'),(2,3,20572,'Blood Fury'),(2,3,20573,'Hardiness'),(2,3,20574,'Axe Specialization'),(2,3,20576,'Command'),(2,3,21651,'Opening'),(2,3,21652,'Closing'),(2,3,22027,'Remove Insignia'),(2,3,22810,'Opening - No Text'),(2,3,24949,'Defensive State 2 (DND)'),(2,3,34082,'Advantaged State (DND)'),(2,3,45927,'Summon Friend'),(2,3,61437,'Opening'),(2,4,81,'Dodge'),(2,4,203,'Unarmed'),(2,4,204,'Defense'),(2,4,522,'SPELLDEFENSE (DND)'),(2,4,669,'Language Orcish'),(2,4,1180,'Daggers'),(2,4,1752,'Sinister Strike'),(2,4,1843,'Disarm'),(2,4,2098,'Eviscerate'),(2,4,2382,'Generic'),(2,4,2479,'Honorless Target'),(2,4,2567,'Thrown'),(2,4,2764,'Throw'),(2,4,3050,'Detect'),(2,4,3365,'Opening'),(2,4,6233,'Closing'),(2,4,6246,'Closing'),(2,4,6247,'Opening'),(2,4,6477,'Opening'),(2,4,6478,'Opening'),(2,4,6603,'Attack'),(2,4,7266,'Duel'),(2,4,7267,'Grovel'),(2,4,7355,'Stuck'),(2,4,8386,'Attacking'),(2,4,9077,'Leather'),(2,4,9078,'Cloth'),(2,4,9125,'Generic'),(2,4,16092,'Defensive State (DND)'),(2,4,20572,'Blood Fury'),(2,4,20573,'Hardiness'),(2,4,20574,'Axe Specialization'),(2,4,21184,'Rogue Passive (DND)'),(2,4,21563,'Command'),(2,4,21651,'Opening'),(2,4,21652,'Closing'),(2,4,22027,'Remove Insignia'),(2,4,22810,'Opening - No Text'),(2,4,45927,'Summon Friend'),(2,4,61437,'Opening'),(2,6,81,'Dodge'),(2,6,196,'One-Handed Axes'),(2,6,197,'Two-Handed Axes'),(2,6,200,'Polearms'),(2,6,201,'One-Handed Swords'),(2,6,202,'Two-Handed Swords'),(2,6,203,'Unarmed'),(2,6,204,'Defense'),(2,6,522,'SPELLDEFENSE (DND)'),(2,6,669,'Language Orcish'),(2,6,674,'Dual Wield'),(2,6,750,'Plate Mail'),(2,6,1843,'Disarm'),(2,6,2382,'Generic'),(2,6,2479,'Honorless Target'),(2,6,3050,'Detect'),(2,6,3127,'Parry'),(2,6,3275,'Linen Bandage'),(2,6,3276,'Heavy Linen Bandage'),(2,6,3277,'Wool Bandage'),(2,6,3278,'Heavy Wool Bandage'),(2,6,3365,'Opening'),(2,6,6233,'Closing'),(2,6,6246,'Closing'),(2,6,6247,'Opening'),(2,6,6477,'Opening'),(2,6,6478,'Opening'),(2,6,6603,'Attack'),(2,6,7266,'Duel'),(2,6,7267,'Grovel'),(2,6,7355,'Stuck'),(2,6,7928,'Silk Bandage'),(2,6,7929,'Heavy Silk Bandage'),(2,6,7934,'Anti-Venom'),(2,6,8386,'Attacking'),(2,6,8737,'Mail'),(2,6,9077,'Leather'),(2,6,9078,'Cloth'),(2,6,9125,'Generic'),(2,6,10840,'Mageweave Bandage'),(2,6,10841,'Heavy Mageweave Bandage'),(2,6,10846,'First Aid'),(2,6,18629,'Runecloth Bandage'),(2,6,18630,'Heavy Runecloth Bandage'),(2,6,20572,'Blood Fury'),(2,6,20573,'Hardiness'),(2,6,20574,'Axe Specialization'),(2,6,21651,'Opening'),(2,6,21652,'Closing'),(2,6,22027,'Remove Insignia'),(2,6,22810,'Opening - No Text'),(2,6,33391,'Journeyman Riding'),(2,6,45462,'Plague Strike'),(2,6,45477,'Icy Touch'),(2,6,45902,'Blood Strike'),(2,6,45903,'Offensive State (DND)'),(2,6,45927,'Summon Friend'),(2,6,47541,'Death Coil'),(2,6,48266,'Blood Presence'),(2,6,49410,'Forceful Deflection'),(2,6,49576,'Death Grip'),(2,6,52665,'Sigil'),(2,6,54562,'Command'),(2,6,59879,'Blood Plague'),(2,6,59921,'Frost Fever'),(2,6,61437,'Opening'),(2,6,61455,'Runic Focus'),(2,7,81,'Dodge'),(2,7,107,'Block'),(2,7,198,'One-Handed Maces'),(2,7,203,'Unarmed'),(2,7,204,'Defense'),(2,7,227,'Staves'),(2,7,331,'Healing Wave'),(2,7,403,'Lightning Bolt'),(2,7,522,'SPELLDEFENSE (DND)'),(2,7,669,'Language Orcish'),(2,7,1843,'Disarm'),(2,7,2382,'Generic'),(2,7,2479,'Honorless Target'),(2,7,3050,'Detect'),(2,7,3365,'Opening'),(2,7,6233,'Closing'),(2,7,6246,'Closing'),(2,7,6247,'Opening'),(2,7,6477,'Opening'),(2,7,6478,'Opening'),(2,7,6603,'Attack'),(2,7,7266,'Duel'),(2,7,7267,'Grovel'),(2,7,7355,'Stuck'),(2,7,8386,'Attacking'),(2,7,9077,'Leather'),(2,7,9078,'Cloth'),(2,7,9116,'Shield'),(2,7,9125,'Generic'),(2,7,20573,'Hardiness'),(2,7,20574,'Axe Specialization'),(2,7,21563,'Command'),(2,7,21651,'Opening'),(2,7,21652,'Closing'),(2,7,22027,'Remove Insignia'),(2,7,22810,'Opening - No Text'),(2,7,27763,'Totem'),(2,7,33697,'Blood Fury'),(2,7,45927,'Summon Friend'),(2,7,61437,'Opening'),(2,9,81,'Dodge'),(2,9,203,'Unarmed'),(2,9,204,'Defense'),(2,9,522,'SPELLDEFENSE (DND)'),(2,9,669,'Language Orcish'),(2,9,686,'Shadow Bolt'),(2,9,687,'Demon Skin'),(2,9,1180,'Daggers'),(2,9,1843,'Disarm'),(2,9,2382,'Generic'),(2,9,2479,'Honorless Target'),(2,9,3050,'Detect'),(2,9,3365,'Opening'),(2,9,5009,'Wands'),(2,9,5019,'Shoot'),(2,9,6233,'Closing'),(2,9,6246,'Closing'),(2,9,6247,'Opening'),(2,9,6477,'Opening'),(2,9,6478,'Opening'),(2,9,6603,'Attack'),(2,9,7266,'Duel'),(2,9,7267,'Grovel'),(2,9,7355,'Stuck'),(2,9,8386,'Attacking'),(2,9,9078,'Cloth'),(2,9,9125,'Generic'),(2,9,20573,'Hardiness'),(2,9,20574,'Axe Specialization'),(2,9,20575,'Command'),(2,9,21651,'Opening'),(2,9,21652,'Closing'),(2,9,22027,'Remove Insignia'),(2,9,22810,'Opening - No Text'),(2,9,33702,'Blood Fury'),(2,9,45927,'Summon Friend'),(2,9,58284,'Chaos Bolt Passive'),(2,9,61437,'Opening'),(3,1,78,'Heroic Strike'),(3,1,81,'Dodge'),(3,1,107,'Block'),(3,1,196,'One-Handed Axes'),(3,1,197,'Two-Handed Axes'),(3,1,198,'One-Handed Maces'),(3,1,203,'Unarmed'),(3,1,204,'Defense'),(3,1,522,'SPELLDEFENSE (DND)'),(3,1,668,'Language Common'),(3,1,672,'Language Dwarven'),(3,1,1843,'Disarm'),(3,1,2382,'Generic'),(3,1,2457,'Battle Stance'),(3,1,2479,'Honorless Target'),(3,1,2481,'Find Treasure'),(3,1,3050,'Detect'),(3,1,3365,'Opening'),(3,1,5301,'Defensive State (DND)'),(3,1,6233,'Closing'),(3,1,6246,'Closing'),(3,1,6247,'Opening'),(3,1,6477,'Opening'),(3,1,6478,'Opening'),(3,1,6603,'Attack'),(3,1,7266,'Duel'),(3,1,7267,'Grovel'),(3,1,7355,'Stuck'),(3,1,8386,'Attacking'),(3,1,8737,'Mail'),(3,1,9077,'Leather'),(3,1,9078,'Cloth'),(3,1,9116,'Shield'),(3,1,9125,'Generic'),(3,1,20594,'Stoneform'),(3,1,20595,'Gun Specialization'),(3,1,20596,'Frost Resistance'),(3,1,21651,'Opening'),(3,1,21652,'Closing'),(3,1,22027,'Remove Insignia'),(3,1,22810,'Opening - No Text'),(3,1,32215,'Victorious State'),(3,1,45927,'Summon Friend'),(3,1,59224,'Mace Specialization'),(3,1,61437,'Opening'),(3,2,81,'Dodge'),(3,2,107,'Block'),(3,2,198,'One-Handed Maces'),(3,2,199,'Two-Handed Maces'),(3,2,203,'Unarmed'),(3,2,204,'Defense'),(3,2,522,'SPELLDEFENSE (DND)'),(3,2,635,'Holy Light'),(3,2,668,'Language Common'),(3,2,672,'Language Dwarven'),(3,2,1843,'Disarm'),(3,2,2382,'Generic'),(3,2,2479,'Honorless Target'),(3,2,2481,'Find Treasure'),(3,2,3050,'Detect'),(3,2,3365,'Opening'),(3,2,6233,'Closing'),(3,2,6246,'Closing'),(3,2,6247,'Opening'),(3,2,6477,'Opening'),(3,2,6478,'Opening'),(3,2,6603,'Attack'),(3,2,7266,'Duel'),(3,2,7267,'Grovel'),(3,2,7355,'Stuck'),(3,2,8386,'Attacking'),(3,2,8737,'Mail'),(3,2,9077,'Leather'),(3,2,9078,'Cloth'),(3,2,9116,'Shield'),(3,2,9125,'Generic'),(3,2,21084,'Seal of Righteousness'),(3,2,20594,'Stoneform'),(3,2,20595,'Gun Specialization'),(3,2,20596,'Frost Resistance'),(3,2,21651,'Opening'),(3,2,21652,'Closing'),(3,2,22027,'Remove Insignia'),(3,2,22810,'Opening - No Text'),(3,2,27762,'Libram'),(3,2,45927,'Summon Friend'),(3,2,59224,'Mace Specialization'),(3,2,61437,'Opening'),(3,3,75,'Auto Shot'),(3,3,81,'Dodge'),(3,3,196,'One-Handed Axes'),(3,3,203,'Unarmed'),(3,3,204,'Defense'),(3,3,266,'Guns'),(3,3,522,'SPELLDEFENSE (DND)'),(3,3,668,'Language Common'),(3,3,672,'Language Dwarven'),(3,3,1843,'Disarm'),(3,3,2382,'Generic'),(3,3,2479,'Honorless Target'),(3,3,2481,'Find Treasure'),(3,3,2973,'Raptor Strike'),(3,3,3050,'Detect'),(3,3,3365,'Opening'),(3,3,6233,'Closing'),(3,3,6246,'Closing'),(3,3,6247,'Opening'),(3,3,6477,'Opening'),(3,3,6478,'Opening'),(3,3,6603,'Attack'),(3,3,7266,'Duel'),(3,3,7267,'Grovel'),(3,3,7355,'Stuck'),(3,3,8386,'Attacking'),(3,3,9077,'Leather'),(3,3,9078,'Cloth'),(3,3,9125,'Generic'),(3,3,13358,'Defensive State (DND)'),(3,3,20594,'Stoneform'),(3,3,20595,'Gun Specialization'),(3,3,20596,'Frost Resistance'),(3,3,21651,'Opening'),(3,3,21652,'Closing'),(3,3,22027,'Remove Insignia'),(3,3,22810,'Opening - No Text'),(3,3,24949,'Defensive State 2 (DND)'),(3,3,34082,'Advantaged State (DND)'),(3,3,45927,'Summon Friend'),(3,3,59224,'Mace Specialization'),(3,3,61437,'Opening'),(3,4,81,'Dodge'),(3,4,203,'Unarmed'),(3,4,204,'Defense'),(3,4,522,'SPELLDEFENSE (DND)'),(3,4,668,'Language Common'),(3,4,672,'Language Dwarven'),(3,4,1180,'Daggers'),(3,4,1752,'Sinister Strike'),(3,4,1843,'Disarm'),(3,4,2098,'Eviscerate'),(3,4,2382,'Generic'),(3,4,2479,'Honorless Target'),(3,4,2481,'Find Treasure'),(3,4,2567,'Thrown'),(3,4,2764,'Throw'),(3,4,3050,'Detect'),(3,4,3365,'Opening'),(3,4,6233,'Closing'),(3,4,6246,'Closing'),(3,4,6247,'Opening'),(3,4,6477,'Opening'),(3,4,6478,'Opening'),(3,4,6603,'Attack'),(3,4,7266,'Duel'),(3,4,7267,'Grovel'),(3,4,7355,'Stuck'),(3,4,8386,'Attacking'),(3,4,9077,'Leather'),(3,4,9078,'Cloth'),(3,4,9125,'Generic'),(3,4,16092,'Defensive State (DND)'),(3,4,20594,'Stoneform'),(3,4,20595,'Gun Specialization'),(3,4,20596,'Frost Resistance'),(3,4,21184,'Rogue Passive (DND)'),(3,4,21651,'Opening'),(3,4,21652,'Closing'),(3,4,22027,'Remove Insignia'),(3,4,22810,'Opening - No Text'),(3,4,45927,'Summon Friend'),(3,4,59224,'Mace Specialization'),(3,4,61437,'Opening'),(3,5,81,'Dodge'),(3,5,198,'One-Handed Maces'),(3,5,203,'Unarmed'),(3,5,204,'Defense'),(3,5,522,'SPELLDEFENSE (DND)'),(3,5,585,'Smite'),(3,5,668,'Language Common'),(3,5,672,'Language Dwarven'),(3,5,1843,'Disarm'),(3,5,2050,'Lesser Heal'),(3,5,2382,'Generic'),(3,5,2479,'Honorless Target'),(3,5,2481,'Find Treasure'),(3,5,3050,'Detect'),(3,5,3365,'Opening'),(3,5,5009,'Wands'),(3,5,5019,'Shoot'),(3,5,6233,'Closing'),(3,5,6246,'Closing'),(3,5,6247,'Opening'),(3,5,6477,'Opening'),(3,5,6478,'Opening'),(3,5,6603,'Attack'),(3,5,7266,'Duel'),(3,5,7267,'Grovel'),(3,5,7355,'Stuck'),(3,5,8386,'Attacking'),(3,5,9078,'Cloth'),(3,5,9125,'Generic'),(3,5,20594,'Stoneform'),(3,5,20595,'Gun Specialization'),(3,5,20596,'Frost Resistance'),(3,5,21651,'Opening'),(3,5,21652,'Closing'),(3,5,22027,'Remove Insignia'),(3,5,22810,'Opening - No Text'),(3,5,45927,'Summon Friend'),(3,5,59224,'Mace Specialization'),(3,5,61437,'Opening'),(3,6,81,'Dodge'),(3,6,196,'One-Handed Axes'),(3,6,197,'Two-Handed Axes'),(3,6,200,'Polearms'),(3,6,201,'One-Handed Swords'),(3,6,202,'Two-Handed Swords'),(3,6,203,'Unarmed'),(3,6,204,'Defense'),(3,6,522,'SPELLDEFENSE (DND)'),(3,6,668,'Language Common'),(3,6,672,'Language Dwarven'),(3,6,674,'Dual Wield'),(3,6,750,'Plate Mail'),(3,6,1843,'Disarm'),(3,6,2382,'Generic'),(3,6,2479,'Honorless Target'),(3,6,2481,'Find Treasure'),(3,6,3050,'Detect'),(3,6,3127,'Parry'),(3,6,3275,'Linen Bandage'),(3,6,3276,'Heavy Linen Bandage'),(3,6,3277,'Wool Bandage'),(3,6,3278,'Heavy Wool Bandage'),(3,6,3365,'Opening'),(3,6,6233,'Closing'),(3,6,6246,'Closing'),(3,6,6247,'Opening'),(3,6,6477,'Opening'),(3,6,6478,'Opening'),(3,6,6603,'Attack'),(3,6,7266,'Duel'),(3,6,7267,'Grovel'),(3,6,7355,'Stuck'),(3,6,7928,'Silk Bandage'),(3,6,7929,'Heavy Silk Bandage'),(3,6,7934,'Anti-Venom'),(3,6,8386,'Attacking'),(3,6,8737,'Mail'),(3,6,9077,'Leather'),(3,6,9078,'Cloth'),(3,6,9125,'Generic'),(3,6,10840,'Mageweave Bandage'),(3,6,10841,'Heavy Mageweave Bandage'),(3,6,10846,'First Aid'),(3,6,18629,'Runecloth Bandage'),(3,6,18630,'Heavy Runecloth Bandage'),(3,6,20594,'Stoneform'),(3,6,20595,'Gun Specialization'),(3,6,20596,'Frost Resistance'),(3,6,21651,'Opening'),(3,6,21652,'Closing'),(3,6,22027,'Remove Insignia'),(3,6,22810,'Opening - No Text'),(3,6,33391,'Journeyman Riding'),(3,6,45462,'Plague Strike'),(3,6,45477,'Icy Touch'),(3,6,45902,'Blood Strike'),(3,6,45903,'Offensive State (DND)'),(3,6,45927,'Summon Friend'),(3,6,47541,'Death Coil'),(3,6,48266,'Blood Presence'),(3,6,49410,'Forceful Deflection'),(3,6,49576,'Death Grip'),(3,6,52665,'Sigil'),(3,6,59224,'Mace Specialization'),(3,6,59879,'Blood Plague'),(3,6,59921,'Frost Fever'),(3,6,61437,'Opening'),(3,6,61455,'Runic Focus'),(4,1,78,'Heroic Strike'),(4,1,81,'Dodge'),(4,1,107,'Block'),(4,1,198,'One-Handed Maces'),(4,1,201,'One-Handed Swords'),(4,1,203,'Unarmed'),(4,1,204,'Defense'),(4,1,522,'SPELLDEFENSE (DND)'),(4,1,668,'Language Common'),(4,1,671,'Language Darnassian'),(4,1,1180,'Daggers'),(4,1,1843,'Disarm'),(4,1,2382,'Generic'),(4,1,2457,'Battle Stance'),(4,1,2479,'Honorless Target'),(4,1,3050,'Detect'),(4,1,3365,'Opening'),(4,1,5301,'Defensive State (DND)'),(4,1,6233,'Closing'),(4,1,6246,'Closing'),(4,1,6247,'Opening'),(4,1,6477,'Opening'),(4,1,6478,'Opening'),(4,1,6603,'Attack'),(4,1,7266,'Duel'),(4,1,7267,'Grovel'),(4,1,7355,'Stuck'),(4,1,8386,'Attacking'),(4,1,8737,'Mail'),(4,1,9077,'Leather'),(4,1,9078,'Cloth'),(4,1,9116,'Shield'),(4,1,9125,'Generic'),(4,1,20582,'Quickness'),(4,1,20583,'Nature Resistance'),(4,1,20585,'Wisp Spirit'),(4,1,21651,'Opening'),(4,1,21652,'Closing'),(4,1,22027,'Remove Insignia'),(4,1,22810,'Opening - No Text'),(4,1,32215,'Victorious State'),(4,1,45927,'Summon Friend'),(4,1,58984,'Shadowmelt'),(4,1,61437,'Opening'),(4,3,75,'Auto Shot'),(4,3,81,'Dodge'),(4,3,203,'Unarmed'),(4,3,204,'Defense'),(4,3,264,'Bows'),(4,3,522,'SPELLDEFENSE (DND)'),(4,3,668,'Language Common'),(4,3,671,'Language Darnassian'),(4,3,1180,'Daggers'),(4,3,1843,'Disarm'),(4,3,2382,'Generic'),(4,3,2479,'Honorless Target'),(4,3,2973,'Raptor Strike'),(4,3,3050,'Detect'),(4,3,3365,'Opening'),(4,3,6233,'Closing'),(4,3,6246,'Closing'),(4,3,6247,'Opening'),(4,3,6477,'Opening'),(4,3,6478,'Opening'),(4,3,6603,'Attack'),(4,3,7266,'Duel'),(4,3,7267,'Grovel'),(4,3,7355,'Stuck'),(4,3,8386,'Attacking'),(4,3,9077,'Leather'),(4,3,9078,'Cloth'),(4,3,9125,'Generic'),(4,3,13358,'Defensive State (DND)'),(4,3,20582,'Quickness'),(4,3,20583,'Nature Resistance'),(4,3,20585,'Wisp Spirit'),(4,3,21651,'Opening'),(4,3,21652,'Closing'),(4,3,22027,'Remove Insignia'),(4,3,22810,'Opening - No Text'),(4,3,24949,'Defensive State 2 (DND)'),(4,3,34082,'Advantaged State (DND)'),(4,3,45927,'Summon Friend'),(4,3,58984,'Shadowmelt'),(4,3,61437,'Opening'),(4,4,81,'Dodge'),(4,4,203,'Unarmed'),(4,4,204,'Defense'),(4,4,522,'SPELLDEFENSE (DND)'),(4,4,668,'Language Common'),(4,4,671,'Language Darnassian'),(4,4,1180,'Daggers'),(4,4,1752,'Sinister Strike'),(4,4,1843,'Disarm'),(4,4,2098,'Eviscerate'),(4,4,2382,'Generic'),(4,4,2479,'Honorless Target'),(4,4,2567,'Thrown'),(4,4,2764,'Throw'),(4,4,3050,'Detect'),(4,4,3365,'Opening'),(4,4,6233,'Closing'),(4,4,6246,'Closing'),(4,4,6247,'Opening'),(4,4,6477,'Opening'),(4,4,6478,'Opening'),(4,4,6603,'Attack'),(4,4,7266,'Duel'),(4,4,7267,'Grovel'),(4,4,7355,'Stuck'),(4,4,8386,'Attacking'),(4,4,9077,'Leather'),(4,4,9078,'Cloth'),(4,4,9125,'Generic'),(4,4,16092,'Defensive State (DND)'),(4,4,20582,'Quickness'),(4,4,20583,'Nature Resistance'),(4,4,20585,'Wisp Spirit'),(4,4,21184,'Rogue Passive (DND)'),(4,4,21651,'Opening'),(4,4,21652,'Closing'),(4,4,22027,'Remove Insignia'),(4,4,22810,'Opening - No Text'),(4,4,45927,'Summon Friend'),(4,4,58984,'Shadowmelt'),(4,4,61437,'Opening'),(4,5,81,'Dodge'),(4,5,198,'One-Handed Maces'),(4,5,203,'Unarmed'),(4,5,204,'Defense'),(4,5,522,'SPELLDEFENSE (DND)'),(4,5,585,'Smite'),(4,5,668,'Language Common'),(4,5,671,'Language Darnassian'),(4,5,1843,'Disarm'),(4,5,2050,'Lesser Heal'),(4,5,2382,'Generic'),(4,5,2479,'Honorless Target'),(4,5,3050,'Detect'),(4,5,3365,'Opening'),(4,5,5009,'Wands'),(4,5,5019,'Shoot'),(4,5,6233,'Closing'),(4,5,6246,'Closing'),(4,5,6247,'Opening'),(4,5,6477,'Opening'),(4,5,6478,'Opening'),(4,5,6603,'Attack'),(4,5,7266,'Duel'),(4,5,7267,'Grovel'),(4,5,7355,'Stuck'),(4,5,8386,'Attacking'),(4,5,9078,'Cloth'),(4,5,9125,'Generic'),(4,5,20582,'Quickness'),(4,5,20583,'Nature Resistance'),(4,5,20585,'Wisp Spirit'),(4,5,21651,'Opening'),(4,5,21652,'Closing'),(4,5,22027,'Remove Insignia'),(4,5,22810,'Opening - No Text'),(4,5,45927,'Summon Friend'),(4,5,58984,'Shadowmelt'),(4,5,61437,'Opening'),(4,6,81,'Dodge'),(4,6,196,'One-Handed Axes'),(4,6,197,'Two-Handed Axes'),(4,6,200,'Polearms'),(4,6,201,'One-Handed Swords'),(4,6,202,'Two-Handed Swords'),(4,6,203,'Unarmed'),(4,6,204,'Defense'),(4,6,522,'SPELLDEFENSE (DND)'),(4,6,668,'Language Common'),(4,6,671,'Language Darnassian'),(4,6,674,'Dual Wield'),(4,6,750,'Plate Mail'),(4,6,1843,'Disarm'),(4,6,2382,'Generic'),(4,6,2479,'Honorless Target'),(4,6,3050,'Detect'),(4,6,3127,'Parry'),(4,6,3275,'Linen Bandage'),(4,6,3276,'Heavy Linen Bandage'),(4,6,3277,'Wool Bandage'),(4,6,3278,'Heavy Wool Bandage'),(4,6,3365,'Opening'),(4,6,6233,'Closing'),(4,6,6246,'Closing'),(4,6,6247,'Opening'),(4,6,6477,'Opening'),(4,6,6478,'Opening'),(4,6,6603,'Attack'),(4,6,7266,'Duel'),(4,6,7267,'Grovel'),(4,6,7355,'Stuck'),(4,6,7928,'Silk Bandage'),(4,6,7929,'Heavy Silk Bandage'),(4,6,7934,'Anti-Venom'),(4,6,8386,'Attacking'),(4,6,8737,'Mail'),(4,6,9077,'Leather'),(4,6,9078,'Cloth'),(4,6,9125,'Generic'),(4,6,10840,'Mageweave Bandage'),(4,6,10841,'Heavy Mageweave Bandage'),(4,6,10846,'First Aid'),(4,6,18629,'Runecloth Bandage'),(4,6,18630,'Heavy Runecloth Bandage'),(4,6,20582,'Quickness'),(4,6,20583,'Nature Resistance'),(4,6,20585,'Wisp Spirit'),(4,6,21651,'Opening'),(4,6,21652,'Closing'),(4,6,22027,'Remove Insignia'),(4,6,22810,'Opening - No Text'),(4,6,33391,'Journeyman Riding'),(4,6,45462,'Plague Strike'),(4,6,45477,'Icy Touch'),(4,6,45902,'Blood Strike'),(4,6,45903,'Offensive State (DND)'),(4,6,45927,'Summon Friend'),(4,6,47541,'Death Coil'),(4,6,48266,'Blood Presence'),(4,6,49410,'Forceful Deflection'),(4,6,49576,'Death Grip'),(4,6,52665,'Sigil'),(4,6,58984,'Shadowmeld'),(4,6,59879,'Blood Plague'),(4,6,59921,'Frost Fever'),(4,6,61437,'Opening'),(4,6,61455,'Runic Focus'),(4,11,81,'Dodge'),(4,11,203,'Unarmed'),(4,11,204,'Defense'),(4,11,227,'Staves'),(4,11,522,'SPELLDEFENSE (DND)'),(4,11,668,'Language Common'),(4,11,671,'Language Darnassian'),(4,11,1180,'Daggers'),(4,11,1843,'Disarm'),(4,11,2382,'Generic'),(4,11,2479,'Honorless Target'),(4,11,3050,'Detect'),(4,11,3365,'Opening'),(4,11,5176,'Wrath'),(4,11,5185,'Healing Touch'),(4,11,6233,'Closing'),(4,11,6246,'Closing'),(4,11,6247,'Opening'),(4,11,6477,'Opening'),(4,11,6478,'Opening'),(4,11,6603,'Attack'),(4,11,7266,'Duel'),(4,11,7267,'Grovel'),(4,11,7355,'Stuck'),(4,11,8386,'Attacking'),(4,11,9077,'Leather'),(4,11,9078,'Cloth'),(4,11,9125,'Generic'),(4,11,20582,'Quickness'),(4,11,20583,'Nature Resistance'),(4,11,20585,'Wisp Spirit'),(4,11,21651,'Opening'),(4,11,21652,'Closing'),(4,11,22027,'Remove Insignia'),(4,11,22810,'Opening - No Text'),(4,11,27764,'Fetish'),(4,11,45927,'Summon Friend'),(4,11,58984,'Shadowmelt'),(4,11,61437,'Opening'),(5,1,78,'Heroic Strike'),(5,1,81,'Dodge'),(5,1,107,'Block'),(5,1,201,'One-Handed Swords'),(5,1,202,'Two-Handed Swords'),(5,1,203,'Unarmed'),(5,1,204,'Defense'),(5,1,522,'SPELLDEFENSE (DND)'),(5,1,669,'Language Orcish'),(5,1,1180,'Daggers'),(5,1,1843,'Disarm'),(5,1,2382,'Generic'),(5,1,2457,'Battle Stance'),(5,1,2479,'Honorless Target'),(5,1,3050,'Detect'),(5,1,3365,'Opening'),(5,1,5227,'Underwater Breathing'),(5,1,5301,'Defensive State (DND)'),(5,1,6233,'Closing'),(5,1,6246,'Closing'),(5,1,6247,'Opening'),(5,1,6477,'Opening'),(5,1,6478,'Opening'),(5,1,6603,'Attack'),(5,1,7266,'Duel'),(5,1,7267,'Grovel'),(5,1,7355,'Stuck'),(5,1,7744,'Will of the Forsaken'),(5,1,8386,'Attacking'),(5,1,8737,'Mail'),(5,1,9077,'Leather'),(5,1,9078,'Cloth'),(5,1,9116,'Shield'),(5,1,9125,'Generic'),(5,1,17737,'Language Gutterspeak'),(5,1,20577,'Cannibalize'),(5,1,20579,'Shadow Resistance'),(5,1,21651,'Opening'),(5,1,21652,'Closing'),(5,1,22027,'Remove Insignia'),(5,1,22810,'Opening - No Text'),(5,1,32215,'Victorious State'),(5,1,45927,'Summon Friend'),(5,1,61437,'Opening'),(5,4,81,'Dodge'),(5,4,203,'Unarmed'),(5,4,204,'Defense'),(5,4,522,'SPELLDEFENSE (DND)'),(5,4,669,'Language Orcish'),(5,4,1180,'Daggers'),(5,4,1752,'Sinister Strike'),(5,4,1843,'Disarm'),(5,4,2098,'Eviscerate'),(5,4,2382,'Generic'),(5,4,2479,'Honorless Target'),(5,4,2567,'Thrown'),(5,4,2764,'Throw'),(5,4,3050,'Detect'),(5,4,3365,'Opening'),(5,4,5227,'Underwater Breathing'),(5,4,6233,'Closing'),(5,4,6246,'Closing'),(5,4,6247,'Opening'),(5,4,6477,'Opening'),(5,4,6478,'Opening'),(5,4,6603,'Attack'),(5,4,7266,'Duel'),(5,4,7267,'Grovel'),(5,4,7355,'Stuck'),(5,4,7744,'Will of the Forsaken'),(5,4,8386,'Attacking'),(5,4,9077,'Leather'),(5,4,9078,'Cloth'),(5,4,9125,'Generic'),(5,4,16092,'Defensive State (DND)'),(5,4,17737,'Language Gutterspeak'),(5,4,20577,'Cannibalize'),(5,4,20579,'Shadow Resistance'),(5,4,21184,'Rogue Passive (DND)'),(5,4,21651,'Opening'),(5,4,21652,'Closing'),(5,4,22027,'Remove Insignia'),(5,4,22810,'Opening - No Text'),(5,4,45927,'Summon Friend'),(5,4,61437,'Opening'),(5,5,81,'Dodge'),(5,5,198,'One-Handed Maces'),(5,5,203,'Unarmed'),(5,5,204,'Defense'),(5,5,522,'SPELLDEFENSE (DND)'),(5,5,585,'Smite'),(5,5,669,'Language Orcish'),(5,5,1843,'Disarm'),(5,5,2050,'Lesser Heal'),(5,5,2382,'Generic'),(5,5,2479,'Honorless Target'),(5,5,3050,'Detect'),(5,5,3365,'Opening'),(5,5,5009,'Wands'),(5,5,5019,'Shoot'),(5,5,5227,'Underwater Breathing'),(5,5,6233,'Closing'),(5,5,6246,'Closing'),(5,5,6247,'Opening'),(5,5,6477,'Opening'),(5,5,6478,'Opening'),(5,5,6603,'Attack'),(5,5,7266,'Duel'),(5,5,7267,'Grovel'),(5,5,7355,'Stuck'),(5,5,7744,'Will of the Forsaken'),(5,5,8386,'Attacking'),(5,5,9078,'Cloth'),(5,5,9125,'Generic'),(5,5,17737,'Language Gutterspeak'),(5,5,20577,'Cannibalize'),(5,5,20579,'Shadow Resistance'),(5,5,21651,'Opening'),(5,5,21652,'Closing'),(5,5,22027,'Remove Insignia'),(5,5,22810,'Opening - No Text'),(5,5,45927,'Summon Friend'),(5,5,61437,'Opening'),(5,6,81,'Dodge'),(5,6,196,'One-Handed Axes'),(5,6,197,'Two-Handed Axes'),(5,6,200,'Polearms'),(5,6,201,'One-Handed Swords'),(5,6,202,'Two-Handed Swords'),(5,6,203,'Unarmed'),(5,6,204,'Defense'),(5,6,522,'SPELLDEFENSE (DND)'),(5,6,669,'Language Orcish'),(5,6,674,'Dual Wield'),(5,6,750,'Plate Mail'),(5,6,1843,'Disarm'),(5,6,2382,'Generic'),(5,6,2479,'Honorless Target'),(5,6,3050,'Detect'),(5,6,3127,'Parry'),(5,6,3275,'Linen Bandage'),(5,6,3276,'Heavy Linen Bandage'),(5,6,3277,'Wool Bandage'),(5,6,3278,'Heavy Wool Bandage'),(5,6,3365,'Opening'),(5,6,5227,'Underwater Breathing'),(5,6,6233,'Closing'),(5,6,6246,'Closing'),(5,6,6247,'Opening'),(5,6,6477,'Opening'),(5,6,6478,'Opening'),(5,6,6603,'Attack'),(5,6,7266,'Duel'),(5,6,7267,'Grovel'),(5,6,7355,'Stuck'),(5,6,7744,'Will of the Forsaken'),(5,6,7928,'Silk Bandage'),(5,6,7929,'Heavy Silk Bandage'),(5,6,7934,'Anti-Venom'),(5,6,8386,'Attacking'),(5,6,8737,'Mail'),(5,6,9077,'Leather'),(5,6,9078,'Cloth'),(5,6,9125,'Generic'),(5,6,10840,'Mageweave Bandage'),(5,6,10841,'Heavy Mageweave Bandage'),(5,6,10846,'First Aid'),(5,6,17737,'Language Gutterspeak'),(5,6,18629,'Runecloth Bandage'),(5,6,18630,'Heavy Runecloth Bandage'),(5,6,20577,'Cannibalize'),(5,6,20579,'Shadow Resistance'),(5,6,21651,'Opening'),(5,6,21652,'Closing'),(5,6,22027,'Remove Insignia'),(5,6,22810,'Opening - No Text'),(5,6,33391,'Journeyman Riding'),(5,6,45462,'Plague Strike'),(5,6,45477,'Icy Touch'),(5,6,45902,'Blood Strike'),(5,6,45903,'Offensive State (DND)'),(5,6,45927,'Summon Friend'),(5,6,47541,'Death Coil'),(5,6,48266,'Blood Presence'),(5,6,49410,'Forceful Deflection'),(5,6,49576,'Death Grip'),(5,6,52665,'Sigil'),(5,6,59879,'Blood Plague'),(5,6,59921,'Frost Fever'),(5,6,61437,'Opening'),(5,6,61455,'Runic Focus'),(5,8,81,'Dodge'),(5,8,133,'Fireball'),(5,8,168,'Frost Armor'),(5,8,203,'Unarmed'),(5,8,204,'Defense'),(5,8,227,'Staves'),(5,8,522,'SPELLDEFENSE (DND)'),(5,8,669,'Language Orcish'),(5,8,1843,'Disarm'),(5,8,2382,'Generic'),(5,8,2479,'Honorless Target'),(5,8,3050,'Detect'),(5,8,3365,'Opening'),(5,8,5009,'Wands'),(5,8,5019,'Shoot'),(5,8,5227,'Underwater Breathing'),(5,8,6233,'Closing'),(5,8,6246,'Closing'),(5,8,6247,'Opening'),(5,8,6477,'Opening'),(5,8,6478,'Opening'),(5,8,6603,'Attack'),(5,8,7266,'Duel'),(5,8,7267,'Grovel'),(5,8,7355,'Stuck'),(5,8,7744,'Will of the Forsaken'),(5,8,8386,'Attacking'),(5,8,9078,'Cloth'),(5,8,9125,'Generic'),(5,8,17737,'Language Gutterspeak'),(5,8,20577,'Cannibalize'),(5,8,20579,'Shadow Resistance'),(5,8,21651,'Opening'),(5,8,21652,'Closing'),(5,8,22027,'Remove Insignia'),(5,8,22810,'Opening - No Text'),(5,8,45927,'Summon Friend'),(5,8,61437,'Opening'),(5,9,81,'Dodge'),(5,9,203,'Unarmed'),(5,9,204,'Defense'),(5,9,522,'SPELLDEFENSE (DND)'),(5,9,669,'Language Orcish'),(5,9,686,'Shadow Bolt'),(5,9,687,'Demon Skin'),(5,9,1180,'Daggers'),(5,9,1843,'Disarm'),(5,9,2382,'Generic'),(5,9,2479,'Honorless Target'),(5,9,3050,'Detect'),(5,9,3365,'Opening'),(5,9,5009,'Wands'),(5,9,5019,'Shoot'),(5,9,5227,'Underwater Breathing'),(5,9,6233,'Closing'),(5,9,6246,'Closing'),(5,9,6247,'Opening'),(5,9,6477,'Opening'),(5,9,6478,'Opening'),(5,9,6603,'Attack'),(5,9,7266,'Duel'),(5,9,7267,'Grovel'),(5,9,7355,'Stuck'),(5,9,7744,'Will of the Forsaken'),(5,9,8386,'Attacking'),(5,9,9078,'Cloth'),(5,9,9125,'Generic'),(5,9,17737,'Language Gutterspeak'),(5,9,20577,'Cannibalize'),(5,9,20579,'Shadow Resistance'),(5,9,21651,'Opening'),(5,9,21652,'Closing'),(5,9,22027,'Remove Insignia'),(5,9,22810,'Opening - No Text'),(5,9,45927,'Summon Friend'),(1,9,58284,'Chaos Bolt Passive'),(5,9,61437,'Opening'),(6,1,78,'Heroic Strike'),(6,1,81,'Dodge'),(6,1,107,'Block'),(6,1,196,'One-Handed Axes'),(6,1,198,'One-Handed Maces'),(6,1,199,'Two-Handed Maces'),(6,1,203,'Unarmed'),(6,1,204,'Defense'),(6,1,522,'SPELLDEFENSE (DND)'),(6,1,669,'Language Orcish'),(6,1,670,'Language Taurahe'),(6,1,1843,'Disarm'),(6,1,2382,'Generic'),(6,1,2457,'Battle Stance'),(6,1,2479,'Honorless Target'),(6,1,3050,'Detect'),(6,1,3365,'Opening'),(6,1,5301,'Defensive State (DND)'),(6,1,6233,'Closing'),(6,1,6246,'Closing'),(6,1,6247,'Opening'),(6,1,6477,'Opening'),(6,1,6478,'Opening'),(6,1,6603,'Attack'),(6,1,7266,'Duel'),(6,1,7267,'Grovel'),(6,1,7355,'Stuck'),(6,1,8386,'Attacking'),(6,1,8737,'Mail'),(6,1,9077,'Leather'),(6,1,9078,'Cloth'),(6,1,9116,'Shield'),(6,1,9125,'Generic'),(6,1,20549,'War Stomp'),(6,1,20550,'Endurance'),(6,1,20551,'Nature Resistance'),(6,1,20552,'Cultivation'),(6,1,21651,'Opening'),(6,1,21652,'Closing'),(6,1,22027,'Remove Insignia'),(6,1,22810,'Opening - No Text'),(6,1,32215,'Victorious State'),(6,1,45927,'Summon Friend'),(6,1,61437,'Opening'),(6,3,75,'Auto Shot'),(6,3,81,'Dodge'),(6,3,196,'One-Handed Axes'),(6,3,203,'Unarmed'),(6,3,204,'Defense'),(6,3,266,'Guns'),(6,3,522,'SPELLDEFENSE (DND)'),(6,3,669,'Language Orcish'),(6,3,670,'Language Taurahe'),(6,3,1843,'Disarm'),(6,3,2382,'Generic'),(6,3,2479,'Honorless Target'),(6,3,2973,'Raptor Strike'),(6,3,3050,'Detect'),(6,3,3365,'Opening'),(6,3,6233,'Closing'),(6,3,6246,'Closing'),(6,3,6247,'Opening'),(6,3,6477,'Opening'),(6,3,6478,'Opening'),(6,3,6603,'Attack'),(6,3,7266,'Duel'),(6,3,7267,'Grovel'),(6,3,7355,'Stuck'),(6,3,8386,'Attacking'),(6,3,9077,'Leather'),(6,3,9078,'Cloth'),(6,3,9125,'Generic'),(6,3,13358,'Defensive State (DND)'),(6,3,20549,'War Stomp'),(6,3,20550,'Endurance'),(6,3,20551,'Nature Resistance'),(6,3,20552,'Cultivation'),(6,3,21651,'Opening'),(6,3,21652,'Closing'),(6,3,22027,'Remove Insignia'),(6,3,22810,'Opening - No Text'),(6,3,24949,'Defensive State 2 (DND)'),(6,3,34082,'Advantaged State (DND)'),(6,3,45927,'Summon Friend'),(6,3,61437,'Opening'),(6,6,81,'Dodge'),(6,6,196,'One-Handed Axes'),(6,6,197,'Two-Handed Axes'),(6,6,200,'Polearms'),(6,6,201,'One-Handed Swords'),(6,6,202,'Two-Handed Swords'),(6,6,203,'Unarmed'),(6,6,204,'Defense'),(6,6,522,'SPELLDEFENSE (DND)'),(6,6,669,'Language Orcish'),(6,6,670,'Language Taurahe'),(6,6,674,'Dual Wield'),(6,6,750,'Plate Mail'),(6,6,1843,'Disarm'),(6,6,2382,'Generic'),(6,6,2479,'Honorless Target'),(6,6,3050,'Detect'),(6,6,3127,'Parry'),(6,6,3275,'Linen Bandage'),(6,6,3276,'Heavy Linen Bandage'),(6,6,3277,'Wool Bandage'),(6,6,3278,'Heavy Wool Bandage'),(6,6,3365,'Opening'),(6,6,6233,'Closing'),(6,6,6246,'Closing'),(6,6,6247,'Opening'),(6,6,6477,'Opening'),(6,6,6478,'Opening'),(6,6,6603,'Attack'),(6,6,7266,'Duel'),(6,6,7267,'Grovel'),(6,6,7355,'Stuck'),(6,6,7928,'Silk Bandage'),(6,6,7929,'Heavy Silk Bandage'),(6,6,7934,'Anti-Venom'),(6,6,8386,'Attacking'),(6,6,8737,'Mail'),(6,6,9077,'Leather'),(6,6,9078,'Cloth'),(6,6,9125,'Generic'),(6,6,10840,'Mageweave Bandage'),(6,6,10841,'Heavy Mageweave Bandage'),(6,6,10846,'First Aid'),(6,6,18629,'Runecloth Bandage'),(6,6,18630,'Heavy Runecloth Bandage'),(6,6,20549,'War Stomp'),(6,6,20550,'Endurance'),(6,6,20551,'Nature Resistance'),(6,6,20552,'Cultivation'),(6,6,21651,'Opening'),(6,6,21652,'Closing'),(6,6,22027,'Remove Insignia'),(6,6,22810,'Opening - No Text'),(6,6,33391,'Journeyman Riding'),(6,6,45462,'Plague Strike'),(6,6,45477,'Icy Touch'),(6,6,45902,'Blood Strike'),(6,6,45903,'Offensive State (DND)'),(6,6,45927,'Summon Friend'),(6,6,47541,'Death Coil'),(6,6,48266,'Blood Presence'),(6,6,49410,'Forceful Deflection'),(6,6,49576,'Death Grip'),(6,6,52665,'Sigil'),(6,6,59879,'Blood Plague'),(6,6,59921,'Frost Fever'),(6,6,61437,'Opening'),(6,6,61455,'Runic Focus'),(6,7,81,'Dodge'),(6,7,107,'Block'),(6,7,198,'One-Handed Maces'),(6,7,203,'Unarmed'),(6,7,204,'Defense'),(6,7,227,'Staves'),(6,7,331,'Healing Wave'),(6,7,403,'Lightning Bolt'),(6,7,522,'SPELLDEFENSE (DND)'),(6,7,669,'Language Orcish'),(6,7,670,'Language Taurahe'),(6,7,1843,'Disarm'),(6,7,2382,'Generic'),(6,7,2479,'Honorless Target'),(6,7,3050,'Detect'),(6,7,3365,'Opening'),(6,7,6233,'Closing'),(6,7,6246,'Closing'),(6,7,6247,'Opening'),(6,7,6477,'Opening'),(6,7,6478,'Opening'),(6,7,6603,'Attack'),(6,7,7266,'Duel'),(6,7,7267,'Grovel'),(6,7,7355,'Stuck'),(6,7,8386,'Attacking'),(6,7,9077,'Leather'),(6,7,9078,'Cloth'),(6,7,9116,'Shield'),(6,7,9125,'Generic'),(6,7,20549,'War Stomp'),(6,7,20550,'Endurance'),(6,7,20551,'Nature Resistance'),(6,7,20552,'Cultivation'),(6,7,21651,'Opening'),(6,7,21652,'Closing'),(6,7,22027,'Remove Insignia'),(6,7,22810,'Opening - No Text'),(6,7,27763,'Totem'),(6,7,45927,'Summon Friend'),(6,7,61437,'Opening'),(6,11,81,'Dodge'),(6,11,198,'One-Handed Maces'),(6,11,203,'Unarmed'),(6,11,204,'Defense'),(6,11,227,'Staves'),(6,11,522,'SPELLDEFENSE (DND)'),(6,11,669,'Language Orcish'),(6,11,670,'Language Taurahe'),(6,11,1843,'Disarm'),(6,11,2382,'Generic'),(6,11,2479,'Honorless Target'),(6,11,3050,'Detect'),(6,11,3365,'Opening'),(6,11,5176,'Wrath'),(6,11,5185,'Healing Touch'),(6,11,6233,'Closing'),(6,11,6246,'Closing'),(6,11,6247,'Opening'),(6,11,6477,'Opening'),(6,11,6478,'Opening'),(6,11,6603,'Attack'),(6,11,7266,'Duel'),(6,11,7267,'Grovel'),(6,11,7355,'Stuck'),(6,11,8386,'Attacking'),(6,11,9077,'Leather'),(6,11,9078,'Cloth'),(6,11,9125,'Generic'),(6,11,20549,'War Stomp'),(6,11,20550,'Endurance'),(6,11,20551,'Nature Resistance'),(6,11,20552,'Cultivation'),(6,11,21651,'Opening'),(6,11,21652,'Closing'),(6,11,22027,'Remove Insignia'),(6,11,22810,'Opening - No Text'),(6,11,27764,'Fetish'),(6,11,45927,'Summon Friend'),(6,11,61437,'Opening'),(7,1,78,'Heroic Strike'),(7,1,81,'Dodge'),(7,1,107,'Block'),(7,1,198,'One-Handed Maces'),(7,1,201,'One-Handed Swords'),(7,1,203,'Unarmed'),(7,1,204,'Defense'),(7,1,522,'SPELLDEFENSE (DND)'),(7,1,668,'Language Common'),(7,1,1180,'Daggers'),(7,1,1843,'Disarm'),(7,1,2382,'Generic'),(7,1,2457,'Battle Stance'),(7,1,2479,'Honorless Target'),(7,1,3050,'Detect'),(7,1,3365,'Opening'),(7,1,5301,'Defensive State (DND)'),(7,1,6233,'Closing'),(7,1,6246,'Closing'),(7,1,6247,'Opening'),(7,1,6477,'Opening'),(7,1,6478,'Opening'),(7,1,6603,'Attack'),(7,1,7266,'Duel'),(7,1,7267,'Grovel'),(7,1,7340,'Language Gnomish'),(7,1,7355,'Stuck'),(7,1,8386,'Attacking'),(7,1,8737,'Mail'),(7,1,9077,'Leather'),(7,1,9078,'Cloth'),(7,1,9116,'Shield'),(7,1,9125,'Generic'),(7,1,20589,'Escape Artist'),(7,1,20591,'Expansive Mind'),(7,1,20592,'Arcane Resistance'),(7,1,20593,'Engineering Specialization'),(7,1,21651,'Opening'),(7,1,21652,'Closing'),(7,1,22027,'Remove Insignia'),(7,1,22810,'Opening - No Text'),(7,1,32215,'Victorious State'),(7,1,45927,'Summon Friend'),(7,1,61437,'Opening'),(7,4,81,'Dodge'),(7,4,203,'Unarmed'),(7,4,204,'Defense'),(7,4,522,'SPELLDEFENSE (DND)'),(7,4,668,'Language Common'),(7,4,1180,'Daggers'),(7,4,1752,'Sinister Strike'),(7,4,1843,'Disarm'),(7,4,2098,'Eviscerate'),(7,4,2382,'Generic'),(7,4,2479,'Honorless Target'),(7,4,2567,'Thrown'),(7,4,2764,'Throw'),(7,4,3050,'Detect'),(7,4,3365,'Opening'),(7,4,6233,'Closing'),(7,4,6246,'Closing'),(7,4,6247,'Opening'),(7,4,6477,'Opening'),(7,4,6478,'Opening'),(7,4,6603,'Attack'),(7,4,7266,'Duel'),(7,4,7267,'Grovel'),(7,4,7340,'Language Gnomish'),(7,4,7355,'Stuck'),(7,4,8386,'Attacking'),(7,4,9077,'Leather'),(7,4,9078,'Cloth'),(7,4,9125,'Generic'),(7,4,16092,'Defensive State (DND)'),(7,4,20589,'Escape Artist'),(7,4,20591,'Expansive Mind'),(7,4,20592,'Arcane Resistance'),(7,4,20593,'Engineering Specialization'),(7,4,21184,'Rogue Passive (DND)'),(7,4,21651,'Opening'),(7,4,21652,'Closing'),(7,4,22027,'Remove Insignia'),(7,4,22810,'Opening - No Text'),(7,4,45927,'Summon Friend'),(7,4,61437,'Opening'),(7,6,81,'Dodge'),(7,6,196,'One-Handed Axes'),(7,6,197,'Two-Handed Axes'),(7,6,200,'Polearms'),(7,6,201,'One-Handed Swords'),(7,6,202,'Two-Handed Swords'),(7,6,203,'Unarmed'),(7,6,204,'Defense'),(7,6,522,'SPELLDEFENSE (DND)'),(7,6,668,'Language Common'),(7,6,674,'Dual Wield'),(7,6,750,'Plate Mail'),(7,6,1843,'Disarm'),(7,6,2382,'Generic'),(7,6,2479,'Honorless Target'),(7,6,3050,'Detect'),(7,6,3127,'Parry'),(7,6,3275,'Linen Bandage'),(7,6,3276,'Heavy Linen Bandage'),(7,6,3277,'Wool Bandage'),(7,6,3278,'Heavy Wool Bandage'),(7,6,3365,'Opening'),(7,6,6233,'Closing'),(7,6,6246,'Closing'),(7,6,6247,'Opening'),(7,6,6477,'Opening'),(7,6,6478,'Opening'),(7,6,6603,'Attack'),(7,6,7266,'Duel'),(7,6,7267,'Grovel'),(7,6,7340,'Language Gnomish'),(7,6,7355,'Stuck'),(7,6,7928,'Silk Bandage'),(7,6,7929,'Heavy Silk Bandage'),(7,6,7934,'Anti-Venom'),(7,6,8386,'Attacking'),(7,6,8737,'Mail'),(7,6,9077,'Leather'),(7,6,9078,'Cloth'),(7,6,9125,'Generic'),(7,6,10840,'Mageweave Bandage'),(7,6,10841,'Heavy Mageweave Bandage'),(7,6,10846,'First Aid'),(7,6,18629,'Runecloth Bandage'),(7,6,18630,'Heavy Runecloth Bandage'),(7,6,20589,'Escape Artist'),(7,6,20591,'Expansive Mind'),(7,6,20592,'Arcane Resistance'),(7,6,20593,'Engineering Specialization'),(7,6,21651,'Opening'),(7,6,21652,'Closing'),(7,6,22027,'Remove Insignia'),(7,6,22810,'Opening - No Text'),(7,6,33391,'Journeyman Riding'),(7,6,45462,'Plague Strike'),(7,6,45477,'Icy Touch'),(7,6,45902,'Blood Strike'),(7,6,45903,'Offensive State (DND)'),(7,6,45927,'Summon Friend'),(7,6,47541,'Death Coil'),(7,6,48266,'Blood Presence'),(7,6,49410,'Forceful Deflection'),(7,6,49576,'Death Grip'),(7,6,52665,'Sigil'),(7,6,59879,'Blood Plague'),(7,6,59921,'Frost Fever'),(7,6,61437,'Opening'),(7,6,61455,'Runic Focus'),(7,8,81,'Dodge'),(7,8,133,'Fireball'),(7,8,168,'Frost Armor'),(7,8,203,'Unarmed'),(7,8,204,'Defense'),(7,8,227,'Staves'),(7,8,522,'SPELLDEFENSE (DND)'),(7,8,668,'Language Common'),(7,8,1843,'Disarm'),(7,8,2382,'Generic'),(7,8,2479,'Honorless Target'),(7,8,3050,'Detect'),(7,8,3365,'Opening'),(7,8,5009,'Wands'),(7,8,5019,'Shoot'),(7,8,6233,'Closing'),(7,8,6246,'Closing'),(7,8,6247,'Opening'),(7,8,6477,'Opening'),(7,8,6478,'Opening'),(7,8,6603,'Attack'),(7,8,7266,'Duel'),(7,8,7267,'Grovel'),(7,8,7340,'Language Gnomish'),(7,8,7355,'Stuck'),(7,8,8386,'Attacking'),(7,8,9078,'Cloth'),(7,8,9125,'Generic'),(7,8,20589,'Escape Artist'),(7,8,20591,'Expansive Mind'),(7,8,20592,'Arcane Resistance'),(7,8,20593,'Engineering Specialization'),(7,8,21651,'Opening'),(7,8,21652,'Closing'),(7,8,22027,'Remove Insignia'),(7,8,22810,'Opening - No Text'),(7,8,45927,'Summon Friend'),(7,8,61437,'Opening'),(7,9,81,'Dodge'),(7,9,203,'Unarmed'),(7,9,204,'Defense'),(7,9,522,'SPELLDEFENSE (DND)'),(7,9,668,'Language Common'),(7,9,686,'Shadow Bolt'),(7,9,687,'Demon Skin'),(7,9,1180,'Daggers'),(7,9,1843,'Disarm'),(7,9,2382,'Generic'),(7,9,2479,'Honorless Target'),(7,9,3050,'Detect'),(7,9,3365,'Opening'),(7,9,5009,'Wands'),(7,9,5019,'Shoot'),(7,9,6233,'Closing'),(7,9,6246,'Closing'),(7,9,6247,'Opening'),(7,9,6477,'Opening'),(7,9,6478,'Opening'),(7,9,6603,'Attack'),(7,9,7266,'Duel'),(7,9,7267,'Grovel'),(7,9,7340,'Language Gnomish'),(7,9,7355,'Stuck'),(7,9,8386,'Attacking'),(7,9,9078,'Cloth'),(7,9,9125,'Generic'),(7,9,20589,'Escape Artist'),(7,9,20591,'Expansive Mind'),(7,9,20592,'Arcane Resistance'),(7,9,20593,'Engineering Specialization'),(7,9,21651,'Opening'),(7,9,21652,'Closing'),(7,9,22027,'Remove Insignia'),(7,9,22810,'Opening - No Text'),(7,9,45927,'Summon Friend'),(7,9,61437,'Opening'),(8,1,78,'Heroic Strike'),(8,1,81,'Dodge'),(8,1,107,'Block'),(8,1,196,'One-Handed Axes'),(8,1,203,'Unarmed'),(8,1,204,'Defense'),(8,1,522,'SPELLDEFENSE (DND)'),(8,1,669,'Language Orcish'),(8,1,1180,'Daggers'),(8,1,1843,'Disarm'),(8,1,2382,'Generic'),(8,1,2457,'Battle Stance'),(8,1,2479,'Honorless Target'),(8,1,2567,'Thrown'),(8,1,2764,'Throw'),(8,1,3050,'Detect'),(8,1,3365,'Opening'),(8,1,5301,'Defensive State (DND)'),(8,1,6233,'Closing'),(8,1,6246,'Closing'),(8,1,6247,'Opening'),(8,1,6477,'Opening'),(8,1,6478,'Opening'),(8,1,6603,'Attack'),(8,1,7266,'Duel'),(8,1,7267,'Grovel'),(8,1,7341,'Language Troll'),(8,1,7355,'Stuck'),(8,1,8386,'Attacking'),(8,1,8737,'Mail'),(8,1,9077,'Leather'),(8,1,9078,'Cloth'),(8,1,9116,'Shield'),(8,1,9125,'Generic'),(8,1,20555,'Regeneration'),(8,1,20557,'Beast Slaying'),(8,1,20558,'Throwing Specialization'),(8,1,21651,'Opening'),(8,1,21652,'Closing'),(8,1,22027,'Remove Insignia'),(8,1,22810,'Opening - No Text'),(8,1,26290,'Bow Specialization'),(8,1,26297,'Berserking'),(8,1,32215,'Victorious State'),(8,1,45927,'Summon Friend'),(8,1,58943,'Da Voodoo Shuffle'),(8,1,61437,'Opening'),(8,3,75,'Auto Shot'),(8,3,81,'Dodge'),(8,3,196,'One-Handed Axes'),(8,3,203,'Unarmed'),(8,3,204,'Defense'),(8,3,264,'Bows'),(8,3,522,'SPELLDEFENSE (DND)'),(8,3,669,'Language Orcish'),(8,3,1843,'Disarm'),(8,3,2382,'Generic'),(8,3,2479,'Honorless Target'),(8,3,2973,'Raptor Strike'),(8,3,3050,'Detect'),(8,3,3365,'Opening'),(8,3,6233,'Closing'),(8,3,6246,'Closing'),(8,3,6247,'Opening'),(8,3,6477,'Opening'),(8,3,6478,'Opening'),(8,3,6603,'Attack'),(8,3,7266,'Duel'),(8,3,7267,'Grovel'),(8,3,7341,'Language Troll'),(8,3,7355,'Stuck'),(8,3,8386,'Attacking'),(8,3,9077,'Leather'),(8,3,9078,'Cloth'),(8,3,9125,'Generic'),(8,3,13358,'Defensive State (DND)'),(8,3,26297,'Berserking'),(8,3,20555,'Regeneration'),(8,3,20557,'Beast Slaying'),(8,3,20558,'Throwing Specialization'),(8,3,21651,'Opening'),(8,3,21652,'Closing'),(8,3,22027,'Remove Insignia'),(8,3,22810,'Opening - No Text'),(8,3,24949,'Defensive State 2 (DND)'),(8,3,26290,'Bow Specialization'),(8,3,34082,'Advantaged State (DND)'),(8,3,45927,'Summon Friend'),(8,3,58943,'Da Voodoo Shuffle'),(8,3,61437,'Opening'),(8,4,81,'Dodge'),(8,4,203,'Unarmed'),(8,4,204,'Defense'),(8,4,522,'SPELLDEFENSE (DND)'),(8,4,669,'Language Orcish'),(8,4,1180,'Daggers'),(8,4,1752,'Sinister Strike'),(8,4,1843,'Disarm'),(8,4,2098,'Eviscerate'),(8,4,2382,'Generic'),(8,4,2479,'Honorless Target'),(8,4,2567,'Thrown'),(8,4,2764,'Throw'),(8,4,3050,'Detect'),(8,4,3365,'Opening'),(8,4,6233,'Closing'),(8,4,6246,'Closing'),(8,4,6247,'Opening'),(8,4,6477,'Opening'),(8,4,6478,'Opening'),(8,4,6603,'Attack'),(8,4,7266,'Duel'),(8,4,7267,'Grovel'),(8,4,7341,'Language Troll'),(8,4,7355,'Stuck'),(8,4,8386,'Attacking'),(8,4,9077,'Leather'),(8,4,9078,'Cloth'),(8,4,9125,'Generic'),(8,4,16092,'Defensive State (DND)'),(8,4,20555,'Regeneration'),(8,4,20557,'Beast Slaying'),(8,4,20558,'Throwing Specialization'),(8,4,21184,'Rogue Passive (DND)'),(8,4,21651,'Opening'),(8,4,21652,'Closing'),(8,4,22027,'Remove Insignia'),(8,4,22810,'Opening - No Text'),(8,4,26290,'Bow Specialization'),(8,4,26297,'Berserking'),(8,4,45927,'Summon Friend'),(8,4,58943,'Da Voodoo Shuffle'),(8,4,61437,'Opening'),(8,5,81,'Dodge'),(8,5,198,'One-Handed Maces'),(8,5,203,'Unarmed'),(8,5,204,'Defense'),(8,5,522,'SPELLDEFENSE (DND)'),(8,5,585,'Smite'),(8,5,669,'Language Orcish'),(8,5,1843,'Disarm'),(8,5,2050,'Lesser Heal'),(8,5,2382,'Generic'),(8,5,2479,'Honorless Target'),(8,5,3050,'Detect'),(8,5,3365,'Opening'),(8,5,5009,'Wands'),(8,5,5019,'Shoot'),(8,5,6233,'Closing'),(8,5,6246,'Closing'),(8,5,6247,'Opening'),(8,5,6477,'Opening'),(8,5,6478,'Opening'),(8,5,6603,'Attack'),(8,5,7266,'Duel'),(8,5,7267,'Grovel'),(8,5,7341,'Language Troll'),(8,5,7355,'Stuck'),(8,5,8386,'Attacking'),(8,5,9078,'Cloth'),(8,5,9125,'Generic'),(8,5,26297,'Berserking'),(8,5,20555,'Regeneration'),(8,5,20557,'Beast Slaying'),(8,5,20558,'Throwing Specialization'),(8,5,21651,'Opening'),(8,5,21652,'Closing'),(8,5,22027,'Remove Insignia'),(8,5,22810,'Opening - No Text'),(8,5,26290,'Bow Specialization'),(8,5,45927,'Summon Friend'),(8,5,58943,'Da Voodoo Shuffle'),(8,5,61437,'Opening'),(8,6,81,'Dodge'),(8,6,196,'One-Handed Axes'),(8,6,197,'Two-Handed Axes'),(8,6,200,'Polearms'),(8,6,201,'One-Handed Swords'),(8,6,202,'Two-Handed Swords'),(8,6,203,'Unarmed'),(8,6,204,'Defense'),(8,6,522,'SPELLDEFENSE (DND)'),(8,6,669,'Language Orcish'),(8,6,674,'Dual Wield'),(8,6,750,'Plate Mail'),(8,6,1843,'Disarm'),(8,6,2382,'Generic'),(8,6,2479,'Honorless Target'),(8,6,3050,'Detect'),(8,6,3127,'Parry'),(8,6,3275,'Linen Bandage'),(8,6,3276,'Heavy Linen Bandage'),(8,6,3277,'Wool Bandage'),(8,6,3278,'Heavy Wool Bandage'),(8,6,3365,'Opening'),(8,6,6233,'Closing'),(8,6,6246,'Closing'),(8,6,6247,'Opening'),(8,6,6477,'Opening'),(8,6,6478,'Opening'),(8,6,6603,'Attack'),(8,6,7266,'Duel'),(8,6,7267,'Grovel'),(8,6,7341,'Language Troll'),(8,6,7355,'Stuck'),(8,6,7928,'Silk Bandage'),(8,6,7929,'Heavy Silk Bandage'),(8,6,7934,'Anti-Venom'),(8,6,8386,'Attacking'),(8,6,8737,'Mail'),(8,6,9077,'Leather'),(8,6,9078,'Cloth'),(8,6,9125,'Generic'),(8,6,10840,'Mageweave Bandage'),(8,6,10841,'Heavy Mageweave Bandage'),(8,6,10846,'First Aid'),(8,6,18629,'Runecloth Bandage'),(8,6,18630,'Heavy Runecloth Bandage'),(8,6,20555,'Regeneration'),(8,6,20557,'Beast Slaying'),(8,6,20558,'Throwing Specialization'),(8,6,21651,'Opening'),(8,6,21652,'Closing'),(8,6,22027,'Remove Insignia'),(8,6,22810,'Opening - No Text'),(8,6,26290,'Bow Specialization'),(8,6,33391,'Journeyman Riding'),(8,6,45462,'Plague Strike'),(8,6,45477,'Icy Touch'),(8,6,45902,'Blood Strike'),(8,6,45903,'Offensive State (DND)'),(8,6,45927,'Summon Friend'),(8,6,47541,'Death Coil'),(8,6,48266,'Blood Presence'),(8,6,49410,'Forceful Deflection'),(8,6,49576,'Death Grip'),(8,6,26297,'Berserking'),(8,6,52665,'Sigil'),(8,6,58943,'Da Voodoo Shuffle'),(8,6,59879,'Blood Plague'),(8,6,59921,'Frost Fever'),(8,6,61437,'Opening'),(8,6,61455,'Runic Focus'),(8,7,81,'Dodge'),(8,7,107,'Block'),(8,7,198,'One-Handed Maces'),(8,7,203,'Unarmed'),(8,7,204,'Defense'),(8,7,227,'Staves'),(8,7,331,'Healing Wave'),(8,7,403,'Lightning Bolt'),(8,7,522,'SPELLDEFENSE (DND)'),(8,7,669,'Language Orcish'),(8,7,1843,'Disarm'),(8,7,2382,'Generic'),(8,7,2479,'Honorless Target'),(8,7,3050,'Detect'),(8,7,3365,'Opening'),(8,7,6233,'Closing'),(8,7,6246,'Closing'),(8,7,6247,'Opening'),(8,7,6477,'Opening'),(8,7,6478,'Opening'),(8,7,6603,'Attack'),(8,7,7266,'Duel'),(8,7,7267,'Grovel'),(8,7,7341,'Language Troll'),(8,7,7355,'Stuck'),(8,7,8386,'Attacking'),(8,7,9077,'Leather'),(8,7,9078,'Cloth'),(8,7,9116,'Shield'),(8,7,9125,'Generic'),(8,7,26297,'Berserking'),(8,7,20555,'Regeneration'),(8,7,20557,'Beast Slaying'),(8,7,20558,'Throwing Specialization'),(8,7,21651,'Opening'),(8,7,21652,'Closing'),(8,7,22027,'Remove Insignia'),(8,7,22810,'Opening - No Text'),(8,7,26290,'Bow Specialization'),(8,7,27763,'Totem'),(8,7,45927,'Summon Friend'),(8,7,58943,'Da Voodoo Shuffle'),(8,7,61437,'Opening'),(8,8,81,'Dodge'),(8,8,133,'Fireball'),(8,8,168,'Frost Armor'),(8,8,203,'Unarmed'),(8,8,204,'Defense'),(8,8,227,'Staves'),(8,8,522,'SPELLDEFENSE (DND)'),(8,8,669,'Language Orcish'),(8,8,1843,'Disarm'),(8,8,2382,'Generic'),(8,8,2479,'Honorless Target'),(8,8,3050,'Detect'),(8,8,3365,'Opening'),(8,8,5009,'Wands'),(8,8,5019,'Shoot'),(8,8,6233,'Closing'),(8,8,6246,'Closing'),(8,8,6247,'Opening'),(8,8,6477,'Opening'),(8,8,6478,'Opening'),(8,8,6603,'Attack'),(8,8,7266,'Duel'),(8,8,7267,'Grovel'),(8,8,7341,'Language Troll'),(8,8,7355,'Stuck'),(8,8,8386,'Attacking'),(8,8,9078,'Cloth'),(8,8,9125,'Generic'),(8,8,26297,'Berserking'),(8,8,20555,'Regeneration'),(8,8,20557,'Beast Slaying'),(8,8,20558,'Throwing Specialization'),(8,8,21651,'Opening'),(8,8,21652,'Closing'),(8,8,22027,'Remove Insignia'),(8,8,22810,'Opening - No Text'),(8,8,26290,'Bow Specialization'),(8,8,45927,'Summon Friend'),(8,8,58943,'Da Voodoo Shuffle'),(8,8,61437,'Opening'),(10,2,81,'Dodge'),(10,2,107,'Block'),(10,2,201,'One-Handed Swords'),(10,2,202,'Two-Handed Swords'),(10,2,203,'Unarmed'),(10,2,204,'Defense'),(10,2,522,'SPELLDEFENSE (DND)'),(10,2,635,'Holy Light'),(10,2,669,'Language Orcish'),(10,2,813,'Language Thalassian'),(10,2,822,'Magic Resistance'),(10,2,2382,'Generic'),(10,2,2479,'Honorless Target'),(10,2,3050,'Detect'),(10,2,3365,'Opening'),(10,2,6233,'Closing'),(10,2,6246,'Closing'),(10,2,6247,'Opening'),(10,2,6477,'Opening'),(10,2,6478,'Opening'),(10,2,6603,'Attack'),(10,2,7266,'Duel'),(10,2,7267,'Grovel'),(10,2,7355,'Stuck'),(10,2,8386,'Attacking'),(10,2,8737,'Mail'),(10,2,9077,'Leather'),(10,2,9078,'Cloth'),(10,2,9116,'Shield'),(10,2,9125,'Generic'),(10,2,21084,'Seal of Righteousness'),(10,2,21651,'Opening'),(10,2,21652,'Closing'),(10,2,22027,'Remove Insignia'),(10,2,22810,'Opening - No Text'),(10,2,27762,'Libram'),(10,2,28730,'Arcane Torrent'),(10,2,28877,'Arcane Affinity'),(10,3,75,'Auto Shot'),(10,3,81,'Dodge'),(10,3,203,'Unarmed'),(10,3,204,'Defense'),(10,3,264,'Bows'),(10,3,522,'SPELLDEFENSE (DND)'),(10,3,669,'Language Orcish'),(10,3,813,'Language Thalassian'),(10,3,822,'Magic Resistance'),(10,3,1180,'Daggers'),(10,3,2382,'Generic'),(10,3,2479,'Honorless Target'),(10,3,2973,'Raptor Strike'),(10,3,3050,'Detect'),(10,3,3365,'Opening'),(10,3,6233,'Closing'),(10,3,6246,'Closing'),(10,3,6247,'Opening'),(10,3,6477,'Opening'),(10,3,6478,'Opening'),(10,3,6603,'Attack'),(10,3,7266,'Duel'),(10,3,7267,'Grovel'),(10,3,7355,'Stuck'),(10,3,8386,'Attacking'),(10,3,9077,'Leather'),(10,3,9078,'Cloth'),(10,3,9125,'Generic'),(10,3,13358,'Defensive State (DND)'),(10,3,21651,'Opening'),(10,3,21652,'Closing'),(10,3,22027,'Remove Insignia'),(10,3,22810,'Opening - No Text'),(10,3,24949,'Defensive State 2 (DND)'),(10,3,28730,'Arcane Torrent'),(10,3,28877,'Arcane Affinity'),(10,3,34082,'Advantaged State (DND)'),(10,4,81,'Dodge'),(10,4,203,'Unarmed'),(10,4,204,'Defense'),(10,4,522,'SPELLDEFENSE (DND)'),(10,4,669,'Language Orcish'),(10,4,813,'Language Thalassian'),(10,4,822,'Magic Resistance'),(10,4,1180,'Daggers'),(10,4,1752,'Sinister Strike'),(10,4,2098,'Eviscerate'),(10,4,2382,'Generic'),(10,4,2479,'Honorless Target'),(10,4,2567,'Thrown'),(10,4,2764,'Throw'),(10,4,3050,'Detect'),(10,4,3365,'Opening'),(10,4,6233,'Closing'),(10,4,6246,'Closing'),(10,4,6247,'Opening'),(10,4,6477,'Opening'),(10,4,6478,'Opening'),(10,4,6603,'Attack'),(10,4,7266,'Duel'),(10,4,7267,'Grovel'),(10,4,7355,'Stuck'),(10,4,8386,'Attacking'),(10,4,9077,'Leather'),(10,4,9078,'Cloth'),(10,4,9125,'Generic'),(10,4,16092,'Defensive State (DND)'),(10,4,21184,'Rogue Passive (DND)'),(10,4,21651,'Opening'),(10,4,21652,'Closing'),(10,4,22027,'Remove Insignia'),(10,4,22810,'Opening - No Text'),(10,4,25046,'Arcane Torrent'),(10,4,28877,'Arcane Affinity'),(10,5,81,'Dodge'),(10,5,198,'One-Handed Maces'),(10,5,203,'Unarmed'),(10,5,204,'Defense'),(10,5,522,'SPELLDEFENSE (DND)'),(10,5,585,'Smite'),(10,5,669,'Language Orcish'),(10,5,813,'Language Thalassian'),(10,5,822,'Magic Resistance'),(10,5,2050,'Lesser Heal'),(10,5,2382,'Generic'),(10,5,2479,'Honorless Target'),(10,5,3050,'Detect'),(10,5,3365,'Opening'),(10,5,5009,'Wands'),(10,5,5019,'Shoot'),(10,5,6233,'Closing'),(10,5,6246,'Closing'),(10,5,6247,'Opening'),(10,5,6477,'Opening'),(10,5,6478,'Opening'),(10,5,6603,'Attack'),(10,5,7266,'Duel'),(10,5,7267,'Grovel'),(10,5,7355,'Stuck'),(10,5,8386,'Attacking'),(10,5,9078,'Cloth'),(10,5,9125,'Generic'),(10,5,21651,'Opening'),(10,5,21652,'Closing'),(10,5,22027,'Remove Insignia'),(10,5,22810,'Opening - No Text'),(10,5,28730,'Arcane Torrent'),(10,5,28877,'Arcane Affinity'),(10,6,81,'Dodge'),(10,6,196,'One-Handed Axes'),(10,6,197,'Two-Handed Axes'),(10,6,200,'Polearms'),(10,6,201,'One-Handed Swords'),(10,6,202,'Two-Handed Swords'),(10,6,203,'Unarmed'),(10,6,204,'Defense'),(10,6,522,'SPELLDEFENSE (DND)'),(10,6,669,'Language Orcish'),(10,6,674,'Dual Wield'),(10,6,750,'Plate Mail'),(10,6,813,'Language Thalassian'),(10,6,822,'Magic Resistance'),(10,6,1843,'Disarm'),(10,6,2382,'Generic'),(10,6,2479,'Honorless Target'),(10,6,3050,'Detect'),(10,6,3127,'Parry'),(10,6,3275,'Linen Bandage'),(10,6,3276,'Heavy Linen Bandage'),(10,6,3277,'Wool Bandage'),(10,6,3278,'Heavy Wool Bandage'),(10,6,3365,'Opening'),(10,6,6233,'Closing'),(10,6,6246,'Closing'),(10,6,6247,'Opening'),(10,6,6477,'Opening'),(10,6,6478,'Opening'),(10,6,6603,'Attack'),(10,6,7266,'Duel'),(10,6,7267,'Grovel'),(10,6,7355,'Stuck'),(10,6,7928,'Silk Bandage'),(10,6,7929,'Heavy Silk Bandage'),(10,6,7934,'Anti-Venom'),(10,6,8386,'Attacking'),(10,6,8737,'Mail'),(10,6,9077,'Leather'),(10,6,9078,'Cloth'),(10,6,9125,'Generic'),(10,6,10840,'Mageweave Bandage'),(10,6,10841,'Heavy Mageweave Bandage'),(10,6,10846,'First Aid'),(10,6,18629,'Runecloth Bandage'),(10,6,18630,'Heavy Runecloth Bandage'),(10,6,21651,'Opening'),(10,6,21652,'Closing'),(10,6,22027,'Remove Insignia'),(10,6,22810,'Opening - No Text'),(10,6,28877,'Arcane Affinity'),(10,6,33391,'Journeyman Riding'),(10,6,45462,'Plague Strike'),(10,6,45477,'Icy Touch'),(10,6,45902,'Blood Strike'),(10,6,45903,'Offensive State (DND)'),(10,6,45927,'Summon Friend'),(10,6,47541,'Death Coil'),(10,6,48266,'Blood Presence'),(10,6,49410,'Forceful Deflection'),(10,6,49576,'Death Grip'),(10,6,50613,'Arcane Torrent'),(10,6,52665,'Sigil'),(10,6,59879,'Blood Plague'),(10,6,59921,'Frost Fever'),(10,6,61437,'Opening'),(10,6,61455,'Runic Focus'),(10,8,81,'Dodge'),(10,8,133,'Fireball'),(10,8,168,'Frost Armor'),(10,8,203,'Unarmed'),(10,8,204,'Defense'),(10,8,227,'Staves'),(10,8,522,'SPELLDEFENSE (DND)'),(10,8,669,'Language Orcish'),(10,8,813,'Language Thalassian'),(10,8,822,'Magic Resistance'),(10,8,2382,'Generic'),(10,8,2479,'Honorless Target'),(10,8,3050,'Detect'),(10,8,3365,'Opening'),(10,8,5009,'Wands'),(10,8,5019,'Shoot'),(10,8,6233,'Closing'),(10,8,6246,'Closing'),(10,8,6247,'Opening'),(10,8,6477,'Opening'),(10,8,6478,'Opening'),(10,8,6603,'Attack'),(10,8,7266,'Duel'),(10,8,7267,'Grovel'),(10,8,7355,'Stuck'),(10,8,8386,'Attacking'),(10,8,9078,'Cloth'),(10,8,9125,'Generic'),(10,8,21651,'Opening'),(10,8,21652,'Closing'),(10,8,22027,'Remove Insignia'),(10,8,22810,'Opening - No Text'),(10,8,28730,'Arcane Torrent'),(10,8,28877,'Arcane Affinity'),(10,9,81,'Dodge'),(10,9,203,'Unarmed'),(10,9,204,'Defense'),(10,9,522,'SPELLDEFENSE (DND)'),(10,9,669,'Language Orcish'),(10,9,686,'Shadow Bolt'),(10,9,687,'Demon Skin'),(10,9,813,'Language Thalassian'),(10,9,822,'Magic Resistance'),(10,9,1180,'Daggers'),(10,9,2382,'Generic'),(10,9,2479,'Honorless Target'),(10,9,3050,'Detect'),(10,9,3365,'Opening'),(10,9,5009,'Wands'),(10,9,5019,'Shoot'),(10,9,6233,'Closing'),(10,9,6246,'Closing'),(10,9,6247,'Opening'),(10,9,6477,'Opening'),(10,9,6478,'Opening'),(10,9,6603,'Attack'),(10,9,7266,'Duel'),(10,9,7267,'Grovel'),(10,9,7355,'Stuck'),(10,9,8386,'Attacking'),(10,9,9078,'Cloth'),(10,9,9125,'Generic'),(10,9,21651,'Opening'),(10,9,21652,'Closing'),(10,9,22027,'Remove Insignia'),(10,9,22810,'Opening - No Text'),(10,9,28730,'Arcane Torrent'),(10,9,28877,'Arcane Affinity'),(11,1,78,'Heroic Strike'),(11,1,81,'Dodge'),(11,1,107,'Block'),(11,1,198,'One-Handed Maces'),(11,1,201,'One-Handed Swords'),(11,1,202,'Two-Handed Swords'),(11,1,203,'Unarmed'),(11,1,204,'Defense'),(11,1,522,'SPELLDEFENSE (DND)'),(11,1,668,'Language Common'),(11,1,1843,'Disarm'),(11,1,2382,'Generic'),(11,1,2457,'Battle Stance'),(11,1,2479,'Honorless Target'),(11,1,3050,'Detect'),(11,1,3365,'Opening'),(11,1,5301,'Defensive State (DND)'),(11,1,6233,'Closing'),(11,1,6246,'Closing'),(11,1,6247,'Opening'),(11,1,6477,'Opening'),(11,1,6478,'Opening'),(11,1,6562,'Heroic Presence'),(11,1,6603,'Attack'),(11,1,7266,'Duel'),(11,1,7267,'Grovel'),(11,1,7355,'Stuck'),(11,1,8386,'Attacking'),(11,1,8737,'Mail'),(11,1,9077,'Leather'),(11,1,9078,'Cloth'),(11,1,9116,'Shield'),(11,1,9125,'Generic'),(11,1,21651,'Opening'),(11,1,21652,'Closing'),(11,1,22027,'Remove Insignia'),(11,1,22810,'Opening - No Text'),(11,1,28875,'Gemcutting'),(11,1,28880,'Gift of the Naaru'),(11,1,29932,'Language Draenei'),(11,1,32215,'Victorious State'),(11,1,45927,'Summon Friend'),(11,1,59221,'Shadow Resistance'),(11,1,61437,'Opening'),(11,2,81,'Dodge'),(11,2,107,'Block'),(11,2,198,'One-Handed Maces'),(11,2,199,'Two-Handed Maces'),(11,2,203,'Unarmed'),(11,2,204,'Defense'),(11,2,522,'SPELLDEFENSE (DND)'),(11,2,635,'Holy Light'),(11,2,668,'Language Common'),(11,2,1843,'Disarm'),(11,2,2382,'Generic'),(11,2,2479,'Honorless Target'),(11,2,3050,'Detect'),(11,2,3365,'Opening'),(11,2,6233,'Closing'),(11,2,6246,'Closing'),(11,2,6247,'Opening'),(11,2,6477,'Opening'),(11,2,6478,'Opening'),(11,2,6562,'Heroic Presence'),(11,2,6603,'Attack'),(11,2,7266,'Duel'),(11,2,7267,'Grovel'),(11,2,7355,'Stuck'),(11,2,8386,'Attacking'),(11,2,8737,'Mail'),(11,2,9077,'Leather'),(11,2,9078,'Cloth'),(11,2,9116,'Shield'),(11,2,9125,'Generic'),(11,2,21084,'Seal of Righteousness'),(11,2,21651,'Opening'),(11,2,21652,'Closing'),(11,2,22027,'Remove Insignia'),(11,2,22810,'Opening - No Text'),(11,2,27762,'Libram'),(11,2,28875,'Gemcutting'),(11,2,29932,'Language Draenei'),(11,2,45927,'Summon Friend'),(11,2,59221,'Shadow Resistance'),(11,2,59542,'Gift of the Naaru'),(11,2,61437,'Opening'),(11,3,75,'Auto Shot'),(11,3,81,'Dodge'),(11,3,201,'One-Handed Swords'),(11,3,203,'Unarmed'),(11,3,204,'Defense'),(11,3,522,'SPELLDEFENSE (DND)'),(11,3,668,'Language Common'),(11,3,1843,'Disarm'),(11,3,2382,'Generic'),(11,3,2479,'Honorless Target'),(11,3,2973,'Raptor Strike'),(11,3,3050,'Detect'),(11,3,3365,'Opening'),(11,3,5011,'Crossbows'),(11,3,6233,'Closing'),(11,3,6246,'Closing'),(11,3,6247,'Opening'),(11,3,6477,'Opening'),(11,3,6478,'Opening'),(11,3,6562,'Heroic Presence'),(11,3,6603,'Attack'),(11,3,7266,'Duel'),(11,3,7267,'Grovel'),(11,3,7355,'Stuck'),(11,3,8386,'Attacking'),(11,3,9077,'Leather'),(11,3,9078,'Cloth'),(11,3,9125,'Generic'),(11,3,13358,'Defensive State (DND)'),(11,3,21651,'Opening'),(11,3,21652,'Closing'),(11,3,22027,'Remove Insignia'),(11,3,22810,'Opening - No Text'),(11,3,24949,'Defensive State 2 (DND)'),(11,3,28875,'Gemcutting'),(11,3,29932,'Language Draenei'),(11,3,34082,'Advantaged State (DND)'),(11,3,45927,'Summon Friend'),(11,3,59221,'Shadow Resistance'),(11,3,59543,'Gift of the Naaru'),(11,3,61437,'Opening'),(11,5,81,'Dodge'),(11,5,198,'One-Handed Maces'),(11,5,203,'Unarmed'),(11,5,204,'Defense'),(11,5,522,'SPELLDEFENSE (DND)'),(11,5,585,'Smite'),(11,5,668,'Language Common'),(11,5,1843,'Disarm'),(11,5,2050,'Lesser Heal'),(11,5,2382,'Generic'),(11,5,2479,'Honorless Target'),(11,5,3050,'Detect'),(11,5,3365,'Opening'),(11,5,5009,'Wands'),(11,5,5019,'Shoot'),(11,5,6233,'Closing'),(11,5,6246,'Closing'),(11,5,6247,'Opening'),(11,5,6477,'Opening'),(11,5,6478,'Opening'),(11,5,6603,'Attack'),(11,5,7266,'Duel'),(11,5,7267,'Grovel'),(11,5,7355,'Stuck'),(11,5,8386,'Attacking'),(11,5,9078,'Cloth'),(11,5,9125,'Generic'),(11,5,21651,'Opening'),(11,5,21652,'Closing'),(11,5,22027,'Remove Insignia'),(11,5,22810,'Opening - No Text'),(11,5,28875,'Gemcutting'),(11,5,28878,'Inspiring Presence'),(11,5,29932,'Language Draenei'),(11,5,45927,'Summon Friend'),(11,5,59221,'Shadow Resistance'),(11,5,59544,'Gift of the Naaru'),(11,5,61437,'Opening'),(11,6,81,'Dodge'),(11,6,196,'One-Handed Axes'),(11,6,197,'Two-Handed Axes'),(11,6,200,'Polearms'),(11,6,201,'One-Handed Swords'),(11,6,202,'Two-Handed Swords'),(11,6,203,'Unarmed'),(11,6,204,'Defense'),(11,6,522,'SPELLDEFENSE (DND)'),(11,6,668,'Language Common'),(11,6,674,'Dual Wield'),(11,6,750,'Plate Mail'),(11,6,1843,'Disarm'),(11,6,2382,'Generic'),(11,6,2479,'Honorless Target'),(11,6,3050,'Detect'),(11,6,3127,'Parry'),(11,6,3275,'Linen Bandage'),(11,6,3276,'Heavy Linen Bandage'),(11,6,3277,'Wool Bandage'),(11,6,3278,'Heavy Wool Bandage'),(11,6,3365,'Opening'),(11,6,6233,'Closing'),(11,6,6246,'Closing'),(11,6,6247,'Opening'),(11,6,6477,'Opening'),(11,6,6478,'Opening'),(11,6,6562,'Heroic Presence'),(11,6,6603,'Attack'),(11,6,7266,'Duel'),(11,6,7267,'Grovel'),(11,6,7355,'Stuck'),(11,6,7928,'Silk Bandage'),(11,6,7929,'Heavy Silk Bandage'),(11,6,7934,'Anti-Venom'),(11,6,8386,'Attacking'),(11,6,8737,'Mail'),(11,6,9077,'Leather'),(11,6,9078,'Cloth'),(11,6,9125,'Generic'),(11,6,10840,'Mageweave Bandage'),(11,6,10841,'Heavy Mageweave Bandage'),(11,6,10846,'First Aid'),(11,6,18629,'Runecloth Bandage'),(11,6,18630,'Heavy Runecloth Bandage'),(11,6,21651,'Opening'),(11,6,21652,'Closing'),(11,6,22027,'Remove Insignia'),(11,6,22810,'Opening - No Text'),(11,6,28875,'Gemcutting'),(11,6,29932,'Language Draenei'),(11,6,33391,'Journeyman Riding'),(11,6,45462,'Plague Strike'),(11,6,45477,'Icy Touch'),(11,6,45902,'Blood Strike'),(11,6,45903,'Offensive State (DND)'),(11,6,45927,'Summon Friend'),(11,6,47541,'Death Coil'),(11,6,48266,'Blood Presence'),(11,6,49410,'Forceful Deflection'),(11,6,49576,'Death Grip'),(11,6,52665,'Sigil'),(11,6,59221,'Shadow Resistance'),(11,6,59539,'Shadow Resistance'),(11,6,59545,'Gift of the Naaru'),(11,6,59879,'Blood Plague'),(11,6,59921,'Frost Fever'),(11,6,61437,'Opening'),(11,6,61455,'Runic Focus'),(11,7,81,'Dodge'),(11,7,107,'Block'),(11,7,198,'One-Handed Maces'),(11,7,203,'Unarmed'),(11,7,204,'Defense'),(11,7,227,'Staves'),(11,7,331,'Healing Wave'),(11,7,403,'Lightning Bolt'),(11,7,522,'SPELLDEFENSE (DND)'),(11,7,668,'Language Common'),(11,7,1843,'Disarm'),(11,7,2382,'Generic'),(11,7,2479,'Honorless Target'),(11,7,3050,'Detect'),(11,7,3365,'Opening'),(11,7,6233,'Closing'),(11,7,6246,'Closing'),(11,7,6247,'Opening'),(11,7,6477,'Opening'),(11,7,6478,'Opening'),(11,7,6603,'Attack'),(11,7,7266,'Duel'),(11,7,7267,'Grovel'),(11,7,7355,'Stuck'),(11,7,8386,'Attacking'),(11,7,9077,'Leather'),(11,7,9078,'Cloth'),(11,7,9116,'Shield'),(11,7,9125,'Generic'),(11,7,21651,'Opening'),(11,7,21652,'Closing'),(11,7,22027,'Remove Insignia'),(11,7,22810,'Opening - No Text'),(11,7,27763,'Totem'),(11,7,28875,'Gemcutting'),(11,7,28878,'Inspiring Presence'),(11,7,29932,'Language Draenei'),(11,7,45927,'Summon Friend'),(11,7,59221,'Shadow Resistance'),(11,7,59547,'Gift of the Naaru'),(11,7,61437,'Opening'),(11,8,81,'Dodge'),(11,8,133,'Fireball'),(11,8,168,'Frost Armor'),(11,8,203,'Unarmed'),(11,8,204,'Defense'),(11,8,227,'Staves'),(11,8,522,'SPELLDEFENSE (DND)'),(11,8,668,'Language Common'),(11,8,1843,'Disarm'),(11,8,2382,'Generic'),(11,8,2479,'Honorless Target'),(11,8,3050,'Detect'),(11,8,3365,'Opening'),(11,8,5009,'Wands'),(11,8,5019,'Shoot'),(11,8,6233,'Closing'),(11,8,6246,'Closing'),(11,8,6247,'Opening'),(11,8,6477,'Opening'),(11,8,6478,'Opening'),(11,8,6603,'Attack'),(11,8,7266,'Duel'),(11,8,7267,'Grovel'),(11,8,7355,'Stuck'),(11,8,8386,'Attacking'),(11,8,9078,'Cloth'),(11,8,9125,'Generic'),(11,8,21651,'Opening'),(11,8,21652,'Closing'),(11,8,22027,'Remove Insignia'),(11,8,22810,'Opening - No Text'),(11,8,28875,'Gemcutting'),(11,8,28878,'Inspiring Presence'),(11,8,29932,'Language Draenei'),(11,8,45927,'Summon Friend'),(11,8,59221,'Shadow Resistance'),(11,8,59548,'Gift of the Naaru'),(11,8,61437,'Opening'),(7,9,58284,'Chaos Bolt Passive'),(10,9,58284,'Chaos Bolt Passive'),(11,2,60091,'Judgement Anti-Parry/Dodge Passive'),(10,2,60091,'Judgement Anti-Parry/Dodge Passive'),(3,2,60091,'Judgement Anti-Parry/Dodge Passive'),(1,2,60091,'Judgement Anti-Parry/Dodge Passive'),(0,6,56816,'Rune Strike'); diff --git a/sql/updates/3.2.2a_old/6589_world_quest_template.sql b/sql/updates/3.2.2a_old/6589_world_quest_template.sql new file mode 100644 index 0000000..155c615 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_quest_template.sql @@ -0,0 +1,5 @@ +ALTER TABLE `quest_template` + ADD COLUMN `ReqItemId5` mediumint(8) UNSIGNED DEFAULT '0' NOT NULL AFTER `ReqItemId4`, + ADD COLUMN `ReqItemId6` mediumint(8) UNSIGNED DEFAULT '0' NOT NULL AFTER `ReqItemId5`, + ADD COLUMN `ReqItemCount5` smallint(5) UNSIGNED DEFAULT '0' NOT NULL AFTER `ReqItemCount4`, + ADD COLUMN `ReqItemCount6` smallint(5) UNSIGNED DEFAULT '0' NOT NULL AFTER `ReqItemCount5`; \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6589_world_spell_bonus_data.sql b/sql/updates/3.2.2a_old/6589_world_spell_bonus_data.sql new file mode 100644 index 0000000..d9cbe50 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_spell_bonus_data.sql @@ -0,0 +1 @@ +ALTER TABLE `spell_bonus_data` CHANGE COLUMN `entry` `entry` mediumint(8) unsigned NOT NULL DEFAULT '0'; diff --git a/sql/updates/3.2.2a_old/6589_world_spell_elixir.sql b/sql/updates/3.2.2a_old/6589_world_spell_elixir.sql new file mode 100644 index 0000000..340ba49 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_spell_elixir.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_elixir` WHERE `entry` IN (67016,67017,67018); +INSERT INTO `spell_elixir` (`entry`, `mask`) VALUES +(67016,0x3), +(67017,0x3), +(67018,0x3); diff --git a/sql/updates/3.2.2a_old/6589_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6589_world_spell_proc_event.sql new file mode 100644 index 0000000..7e71695 --- /dev/null +++ b/sql/updates/3.2.2a_old/6589_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +ALTER TABLE `spell_proc_event` CHANGE COLUMN `entry` `entry` mediumint(8) unsigned NOT NULL DEFAULT '0'; + +DELETE FROM `spell_proc_event` WHERE `entry` IN +(44401, 58642, 58676, 61433, 61434); diff --git a/sql/updates/3.2.2a_old/6597_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6597_world_spell_proc_event.sql new file mode 100644 index 0000000..03050a5 --- /dev/null +++ b/sql/updates/3.2.2a_old/6597_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (67353, 57989, 65661, 53601); +INSERT INTO `spell_proc_event` VALUES +(67353, 0x00, 7, 0x00008000, 0x00100500, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), +(57989, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0, 0, 0), +(65661, 0x00, 15,0x00400010, 0x20020004, 0x00000000, 0x00000010, 0x00000000, 0, 100, 0), +(53601, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x000A02A8, 0x00000000, 0, 0, 6); \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6643_world_gameobject_template.sql b/sql/updates/3.2.2a_old/6643_world_gameobject_template.sql new file mode 100644 index 0000000..4eda62b --- /dev/null +++ b/sql/updates/3.2.2a_old/6643_world_gameobject_template.sql @@ -0,0 +1,5 @@ +-- Alter data1 column in gameobject_template to allow signed value +ALTER TABLE `gameobject_template` CHANGE `data1` `data1temp` INT(10); +ALTER TABLE `gameobject_template` ADD `data1` INT SIGNED NOT NULL DEFAULT '-1' AFTER `data0`; +UPDATE `gameobject_template` SET `data1` = `data1temp`; +ALTER TABLE `gameobject_template` DROP `data1temp`; diff --git a/sql/updates/3.2.2a_old/6644_world_creature_template.sql b/sql/updates/3.2.2a_old/6644_world_creature_template.sql new file mode 100644 index 0000000..3f4a8df --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_creature_template.sql @@ -0,0 +1 @@ +ALTER TABLE creature_template ADD gossip_menu_id mediumint(8) unsigned NOT NULL default 0 AFTER IconName; diff --git a/sql/updates/3.2.2a_old/6644_world_gossip_menu.sql b/sql/updates/3.2.2a_old/6644_world_gossip_menu.sql new file mode 100644 index 0000000..71d715a --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_gossip_menu.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS gossip_menu; +CREATE TABLE gossip_menu ( + entry smallint(6) unsigned NOT NULL default '0', + text_id mediumint(8) unsigned NOT NULL default '0', + cond_1 tinyint(3) unsigned NOT NULL default '0', + cond_1_val_1 mediumint(8) unsigned NOT NULL default '0', + cond_1_val_2 mediumint(8) unsigned NOT NULL default '0', + cond_2 tinyint(3) unsigned NOT NULL default '0', + cond_2_val_1 mediumint(8) unsigned NOT NULL default '0', + cond_2_val_2 mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (entry, text_id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.2.2a_old/6644_world_gossip_menu_option.sql b/sql/updates/3.2.2a_old/6644_world_gossip_menu_option.sql new file mode 100644 index 0000000..175f741 --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_gossip_menu_option.sql @@ -0,0 +1,46 @@ +DROP TABLE IF EXISTS gossip_menu_option; +CREATE TABLE gossip_menu_option ( + menu_id smallint(6) unsigned NOT NULL default '0', + id smallint(6) unsigned NOT NULL default '0', + option_icon mediumint(8) unsigned NOT NULL default '0', + option_text text, + option_id tinyint(3) unsigned NOT NULL default '0', + npc_option_npcflag int(10) unsigned NOT NULL default '0', + action_menu_id mediumint(8) unsigned NOT NULL default '0', + action_poi_id mediumint(8) unsigned NOT NULL default '0', + action_script_id mediumint(8) unsigned NOT NULL default '0', + box_coded tinyint(3) unsigned NOT NULL default '0', + box_money int(11) unsigned NOT NULL default '0', + box_text text, + cond_1 tinyint(3) unsigned NOT NULL default '0', + cond_1_val_1 mediumint(8) unsigned NOT NULL default '0', + cond_1_val_2 mediumint(8) unsigned NOT NULL default '0', + cond_2 tinyint(3) unsigned NOT NULL default '0', + cond_2_val_1 mediumint(8) unsigned NOT NULL default '0', + cond_2_val_2 mediumint(8) unsigned NOT NULL default '0', + cond_3 tinyint(3) unsigned NOT NULL default '0', + cond_3_val_1 mediumint(8) unsigned NOT NULL default '0', + cond_3_val_2 mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (menu_id, id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +DELETE FROM gossip_menu_option WHERE menu_id=0; +INSERT INTO gossip_menu_option VALUES +(0,0,0,'GOSSIP_OPTION_QUESTGIVER',2,2,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,1,1,'GOSSIP_OPTION_VENDOR',3,128,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,2,2,'GOSSIP_OPTION_TAXIVENDOR',4,8192,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,3,3,'GOSSIP_OPTION_TRAINER',5,16,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,4,4,'GOSSIP_OPTION_SPIRITHEALER',6,16384,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,5,4,'GOSSIP_OPTION_SPIRITGUIDE',7,32768,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,6,5,'GOSSIP_OPTION_INNKEEPER',8,65536,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,7,6,'GOSSIP_OPTION_BANKER',9,131072,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,8,7,'GOSSIP_OPTION_PETITIONER',10,262144,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,9,8,'GOSSIP_OPTION_TABARDDESIGNER',11,524288,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,10,9,'GOSSIP_OPTION_BATTLEFIELD',12,1048576,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,11,6,'GOSSIP_OPTION_AUCTIONEER',13,2097152,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,12,0,'GOSSIP_OPTION_STABLEPET',14,4194304,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,13,1,'GOSSIP_OPTION_ARMORER',15,4096,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,14,2,'GOSSIP_OPTION_UNLEARNTALENTS',16,16,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,15,2,'GOSSIP_OPTION_UNLEARNPETSKILLS',17,16,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0), +(0,16,2,'GOSSIP_OPTION_LEARNDUALSPEC',18,16,0,0,0,0,10000000,NULL,0,0,0,0,0,0,0,0,0), +(0,17,0,'GOSSIP_OPTION_OUTDOORPVP',1,19,536870912,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0); diff --git a/sql/updates/3.2.2a_old/6644_world_gossip_scripts.sql b/sql/updates/3.2.2a_old/6644_world_gossip_scripts.sql new file mode 100644 index 0000000..10a3dcd --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_gossip_scripts.sql @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS `gossip_scripts`; +CREATE TABLE `gossip_scripts` ( + `id` mediumint(8) unsigned NOT NULL default '0', + `delay` int(10) unsigned NOT NULL default '0', + `command` mediumint(8) unsigned NOT NULL default '0', + `datalong` mediumint(8) unsigned NOT NULL default '0', + `datalong2` int(10) unsigned NOT NULL default '0', + `dataint` int(11) NOT NULL default '0', + `x` float NOT NULL default '0', + `y` float NOT NULL default '0', + `z` float NOT NULL default '0', + `o` float NOT NULL default '0' +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.2.2a_old/6644_world_locales_npc_option.sql b/sql/updates/3.2.2a_old/6644_world_locales_npc_option.sql new file mode 100644 index 0000000..969f076 --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_locales_npc_option.sql @@ -0,0 +1,7 @@ +ALTER TABLE locales_npc_option CHANGE COLUMN entry id smallint(6) unsigned NOT NULL default '0'; +ALTER TABLE locales_npc_option ADD menu_id smallint(6) unsigned NOT NULL default '0' FIRST; + +ALTER TABLE locales_npc_option DROP PRIMARY KEY; +ALTER TABLE locales_npc_option ADD PRIMARY KEY (menu_id, id); + +RENAME TABLE locales_npc_option TO locales_gossip_menu_option; diff --git a/sql/updates/3.2.2a_old/6644_world_npc_gossip_textid.sql b/sql/updates/3.2.2a_old/6644_world_npc_gossip_textid.sql new file mode 100644 index 0000000..b6372ac --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_npc_gossip_textid.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS npc_gossip_textid; diff --git a/sql/updates/3.2.2a_old/6644_world_npc_option.sql b/sql/updates/3.2.2a_old/6644_world_npc_option.sql new file mode 100644 index 0000000..44ebe8d --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_npc_option.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS npc_option; diff --git a/sql/updates/3.2.2a_old/6644_world_scriptname.sql b/sql/updates/3.2.2a_old/6644_world_scriptname.sql new file mode 100644 index 0000000..a801b7d --- /dev/null +++ b/sql/updates/3.2.2a_old/6644_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_taxi' WHERE `entry` = 17209; \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6645_world_gameobject_template.sql b/sql/updates/3.2.2a_old/6645_world_gameobject_template.sql new file mode 100644 index 0000000..aca6bc9 --- /dev/null +++ b/sql/updates/3.2.2a_old/6645_world_gameobject_template.sql @@ -0,0 +1,5 @@ +-- Alter data6 column in gameobject_template to allow signed value +ALTER TABLE `gameobject_template` CHANGE `data6` `data6temp` INT(10); +ALTER TABLE `gameobject_template` ADD `data6` INT SIGNED NOT NULL AFTER `data5`; +UPDATE `gameobject_template` SET `data6` = `data6temp`; +ALTER TABLE `gameobject_template` DROP `data6temp`; diff --git a/sql/updates/3.2.2a_old/6649_world_scriptname.sql b/sql/updates/3.2.2a_old/6649_world_scriptname.sql new file mode 100644 index 0000000..470c2e2 --- /dev/null +++ b/sql/updates/3.2.2a_old/6649_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_jotunheim_cage' WHERE `entry`=192135; diff --git a/sql/updates/3.2.2a_old/6655_world_spell_bonus_data.sql b/sql/updates/3.2.2a_old/6655_world_spell_bonus_data.sql new file mode 100644 index 0000000..8a6e0fc --- /dev/null +++ b/sql/updates/3.2.2a_old/6655_world_spell_bonus_data.sql @@ -0,0 +1 @@ +UPDATE `spell_bonus_data` SET `dot_bonus`=1.15 WHERE `entry` IN (55078, 55095); diff --git a/sql/updates/3.2.2a_old/6657_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6657_world_spell_proc_event.sql new file mode 100644 index 0000000..25207e9 --- /dev/null +++ b/sql/updates/3.2.2a_old/6657_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (16952,16954); +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +(16952,0,7,233472,1024,262144,0,2,0,0,0), +(16954,0,7,233472,1024,262144,0,2,0,0,0); diff --git a/sql/updates/3.2.2a_old/6664_world_quest_template.sql b/sql/updates/3.2.2a_old/6664_world_quest_template.sql new file mode 100644 index 0000000..c0f6b5f --- /dev/null +++ b/sql/updates/3.2.2a_old/6664_world_quest_template.sql @@ -0,0 +1,3 @@ +ALTER TABLE `quest_template` ADD `RepObjectiveFaction2` smallint(5) UNSIGNED NOT NULL DEFAULT 0 AFTER `RepObjectiveValue`; +ALTER TABLE `quest_template` ADD `RepObjectiveValue2` mediumint(9) NOT NULL DEFAULT 0 AFTER `RepObjectiveFaction2`; + diff --git a/sql/updates/3.2.2a_old/6665_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/6665_world_creature_classlevelstats.sql new file mode 100644 index 0000000..7d10467 --- /dev/null +++ b/sql/updates/3.2.2a_old/6665_world_creature_classlevelstats.sql @@ -0,0 +1,473 @@ +-- Table structure for table `creature_classlevelstats` + +DROP TABLE IF EXISTS `creature_classlevelstats`; + +CREATE TABLE `creature_classlevelstats` ( + `exp` tinyint(1) NOT NULL, + `class` tinyint(1) NOT NULL, + `level` tinyint(1) NOT NULL, + `basehp` smallint(2) NOT NULL, + `basemana` smallint(2) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `creature_classlevelstats` (`exp`,`class`,`level`,`basehp`,`basemana`) VALUES +(0,1,1,42,0), +(0,1,2,55,0), +(0,1,3,71,0), +(0,1,4,86,0), +(0,1,5,102,0), +(0,1,6,120,0), +(0,1,7,137,0), +(0,1,8,156,0), +(0,1,9,176,0), +(0,1,10,198,0), +(0,1,11,222,0), +(0,1,12,247,0), +(0,1,13,273,0), +(0,1,14,300,0), +(0,1,15,328,0), +(0,1,16,356,0), +(0,1,17,386,0), +(0,1,18,417,0), +(0,1,19,449,0), +(0,1,20,484,0), +(0,1,21,521,0), +(0,1,22,562,0), +(0,1,23,605,0), +(0,1,24,651,0), +(0,1,25,699,0), +(0,1,26,750,0), +(0,1,27,800,0), +(0,1,28,853,0), +(0,1,29,905,0), +(0,1,30,955,0), +(0,1,31,1006,0), +(0,1,32,1057,0), +(0,1,33,1110,0), +(0,1,34,1163,0), +(0,1,35,1220,0), +(0,1,36,1277,0), +(0,1,37,1336,0), +(0,1,38,1395,0), +(0,1,39,1459,0), +(0,1,40,1524,0), +(0,1,41,1585,0), +(0,1,42,1651,0), +(0,1,43,1716,0), +(0,1,44,1782,0), +(0,1,45,1848,0), +(0,1,46,1919,0), +(0,1,47,1990,0), +(0,1,48,2061,0), +(0,1,49,2138,0), +(0,1,50,2215,0), +(0,1,51,2292,0), +(0,1,52,2371,0), +(0,1,53,2453,0), +(0,1,54,2533,0), +(0,1,55,2614,0), +(0,1,56,2699,0), +(0,1,57,2784,0), +(0,1,58,2871,0), +(0,1,59,2961,0), +(0,1,60,3052,0), +(0,1,61,3144,0), +(0,1,62,3237,0), +(0,1,63,3331,0), +(0,1,64,0,0), +(0,1,65,3524,0), +(0,1,66,0,0), +(0,1,67,3728,0), +(0,1,68,3834,0), +(0,1,69,0,0), +(0,1,70,4050,0), +(0,1,71,4163,0), +(0,1,72,4278,0), +(0,1,73,0,0), +(0,1,74,0,0), +(0,1,75,4652,0), +(0,1,76,0,0), +(0,1,77,4916,0), +(0,1,78,5052,0), +(0,1,79,0,0), +(0,1,80,5342,0), +(0,1,81,5496,0), +(0,1,82,0,0), +(0,1,83,5808,0), +(1,1,58,3989,0), +(1,1,59,4142,0), +(1,1,60,4979,0), +(1,1,61,5158,0), +(1,1,62,5341,0), +(1,1,63,5527,0), +(1,1,64,5715,0), +(1,1,65,5914,0), +(1,1,66,6116,0), +(1,1,67,6326,0), +(1,1,68,6542,0), +(1,1,69,6761,0), +(1,1,70,6986,0), +(1,1,71,7181,0), +(1,1,72,7380,0), +(1,1,73,7580,0), +(2,1,68,6986,0), +(2,1,69,7984,0), +(2,1,70,8982,0), +(2,1,71,9291,0), +(2,1,72,9610,0), +(2,1,73,9940,0), +(2,1,74,10282,0), +(2,1,75,10635,0), +(2,1,76,11001,0), +(2,1,77,11379,0), +(2,1,78,11770,0), +(2,1,79,12175,0), +(2,1,80,12600,0), +(2,1,81,13033,0), +(2,1,82,13481,0), +(2,1,83,13945,0), +(0,2,1,41,60), +(0,2,2,54,69), +(0,2,3,69,79), +(0,2,4,83,104), +(0,2,5,98,115), +(0,2,6,115,126), +(0,2,7,131,138), +(0,2,8,148,165), +(0,2,9,166,178), +(0,2,10,186,191), +(0,2,11,208,205), +(0,2,12,230,249), +(0,2,13,253,264), +(0,2,14,276,295), +(0,2,15,301,326), +(0,2,16,325,357), +(0,2,17,350,390), +(0,2,18,377,408), +(0,2,19,404,456), +(0,2,20,433,490), +(0,2,21,464,510), +(0,2,22,498,544), +(0,2,23,533,581), +(0,2,24,571,618), +(0,2,25,610,655), +(0,2,26,651,693), +(0,2,27,690,732), +(0,2,28,732,756), +(0,2,29,773,811), +(0,2,30,811,852), +(0,2,31,850,878), +(0,2,32,888,935), +(0,2,33,928,963), +(0,2,34,967,1007), +(0,2,35,1009,1067), +(0,2,36,1050,1097), +(0,2,37,1093,1142), +(0,2,38,1135,1186), +(0,2,39,1180,1236), +(0,2,40,1226,1283), +(0,2,41,1268,1332), +(0,2,42,1321,1381), +(0,2,43,1373,1432), +(0,2,44,1426,1483), +(0,2,45,1478,1534), +(0,2,46,1535,1587), +(0,2,47,1592,1640), +(0,2,48,1650,1695), +(0,2,49,1710,1750), +(0,2,50,1772,1807), +(0,2,51,1834,1864), +(0,2,52,1897,1923), +(0,2,53,1962,1982), +(0,2,54,2026,2041), +(0,2,55,2091,2117), +(0,2,56,2159,2163), +(0,2,57,2227,2241), +(0,2,58,2297,2289), +(0,2,59,2369,2369), +(0,2,60,2442,2434), +(0,2,61,2515,2486), +(0,2,62,2590,2568), +(0,2,63,2665,2620), +(0,2,64,0,2705), +(0,2,65,2819,2790), +(0,2,66,0,2846), +(0,2,67,2982,2933), +(0,2,68,3067,2991), +(0,2,69,0,3080), +(0,2,70,3240,3155), +(0,2,71,3330,3231), +(0,2,72,3422,3309), +(0,2,73,0,3387), +(0,2,74,0,3466), +(0,2,75,3722,3561), +(0,2,76,0,3643), +(0,2,77,3933,3725), +(0,2,78,4042,3809), +(0,2,79,0,3893), +(0,2,80,4274,3994), +(0,2,81,4394,4081), +(0,2,82,0,4169), +(0,2,83,0,4258), +(1,2,58,3191,2289), +(1,2,59,3314,2369), +(1,2,60,3984,2434), +(1,2,61,4126,2486), +(1,2,62,4274,2568), +(1,2,63,4422,2620), +(1,2,64,4572,2705), +(1,2,65,4731,2790), +(1,2,66,4892,2846), +(1,2,67,5060,2933), +(1,2,68,5233,2991), +(1,2,69,5409,3080), +(1,2,70,5589,3155), +(1,2,71,5744,3231), +(1,2,72,5900,3309), +(1,2,73,6070,3387), +(2,2,68,6986,2991), +(2,2,69,7984,3080), +(2,2,70,8982,3155), +(2,2,71,9291,3231), +(2,2,72,9610,3309), +(2,2,73,9940,3387), +(2,2,74,10282,3466), +(2,2,75,10635,3561), +(2,2,76,11001,3643), +(2,2,77,11379,3725), +(2,2,78,11770,3809), +(2,2,79,12175,3893), +(2,2,80,12600,3994), +(2,2,81,13033,4081), +(2,2,82,13481,4169), +(2,2,83,13945,4258), +(0,4,1,42,0), +(0,4,2,55,0), +(0,4,3,71,0), +(0,4,4,86,0), +(0,4,5,102,0), +(0,4,6,120,0), +(0,4,7,137,0), +(0,4,8,156,0), +(0,4,9,176,0), +(0,4,10,198,0), +(0,4,11,222,0), +(0,4,12,247,0), +(0,4,13,273,0), +(0,4,14,300,0), +(0,4,15,328,0), +(0,4,16,356,0), +(0,4,17,386,0), +(0,4,18,417,0), +(0,4,19,484,0), +(0,4,20,531,0), +(0,4,21,573,0), +(0,4,22,617,0), +(0,4,23,664,0), +(0,4,24,713,0), +(0,4,25,734,0), +(0,4,26,787,0), +(0,4,27,840,0), +(0,4,28,869,0), +(0,4,29,905,0), +(0,4,30,955,0), +(0,4,31,1006,0), +(0,4,32,1057,0), +(0,4,33,1110,0), +(0,4,34,1163,0), +(0,4,35,1220,0), +(0,4,36,1277,0), +(0,4,37,1336,0), +(0,4,38,1395,0), +(0,4,39,1459,0), +(0,4,40,1524,0), +(0,4,41,1585,0), +(0,4,42,1651,0), +(0,4,43,1716,0), +(0,4,44,1782,0), +(0,4,45,1848,0), +(0,4,46,1919,0), +(0,4,47,1990,0), +(0,4,48,2062,0), +(0,4,49,2138,0), +(0,4,50,2215,0), +(0,4,51,2292,0), +(0,4,52,2371,0), +(0,4,53,2453,0), +(0,4,54,2533,0), +(0,4,55,2614,0), +(0,4,56,2699,0), +(0,4,57,2784,0), +(0,4,58,2871,0), +(0,4,59,2961,0), +(0,4,60,3052,0), +(0,4,61,3186,0), +(0,4,62,3237,0), +(0,4,63,3331,0), +(0,4,64,0,0), +(0,4,65,3524,0), +(0,4,66,0,0), +(0,4,67,3728,0), +(0,4,68,3834,0), +(0,4,69,0,0), +(0,4,70,4050,0), +(0,4,71,4163,0), +(0,4,72,4278,0), +(0,4,73,0,0), +(0,4,74,0,0), +(0,4,75,4652,0), +(0,4,76,0,0), +(0,4,77,4916,0), +(0,4,78,5052,0), +(0,4,79,0,0), +(0,4,80,5342,0), +(0,4,81,5496,0), +(0,4,82,0,0), +(0,4,83,0,0), +(1,4,58,3989,0), +(1,4,59,4142,0), +(1,4,60,4979,0), +(1,4,61,5158,0), +(1,4,62,5341,0), +(1,4,63,5527,0), +(1,4,64,5715,0), +(1,4,65,5914,0), +(1,4,66,6116,0), +(1,4,67,6326,0), +(1,4,68,6542,0), +(1,4,69,6761,0), +(1,4,70,6986,0), +(1,4,71,7181,0), +(1,4,72,7380,0), +(1,4,73,7580,0), +(2,4,68,6986,0), +(2,4,69,7984,0), +(2,4,70,8982,0), +(2,4,71,9291,0), +(2,4,72,9610,0), +(2,4,73,9940,0), +(2,4,74,10282,0), +(2,4,75,10635,0), +(2,4,76,11001,0), +(2,4,77,11379,0), +(2,4,78,11770,0), +(2,4,79,12175,0), +(2,4,80,12600,0), +(2,4,81,13033,0), +(2,4,82,13481,0), +(2,4,83,13945,0), +(0,8,1,40,120), +(0,8,2,0,0), +(0,8,3,67,174), +(0,8,4,81,202), +(0,8,5,95,230), +(0,8,6,111,259), +(0,8,7,126,289), +(0,8,8,143,319), +(0,8,9,160,350), +(0,8,10,178,382), +(0,8,11,199,459), +(0,8,12,219,537), +(0,8,13,241,601), +(0,8,14,263,710), +(0,8,15,285,790), +(0,8,16,307,856), +(0,8,17,330,938), +(0,8,18,354,1020), +(0,8,19,379,1118), +(0,8,20,405,1202), +(0,8,21,432,1272), +(0,8,22,463,1357), +(0,8,23,494,1443), +(0,8,24,528,1545), +(0,8,25,562,1633), +(0,8,26,598,1707), +(0,8,27,633,1812), +(0,8,28,669,1977), +(0,8,29,704,2068), +(0,8,30,737,2175), +(0,8,31,770,2253), +(0,8,32,802,2362), +(0,8,33,835,2457), +(0,8,34,867,2553), +(0,8,35,902,2680), +(0,8,36,935,2763), +(0,8,37,970,2861), +(0,8,38,1004,2975), +(0,8,39,1040,3075), +(0,8,40,1077,3191), +(0,8,41,1110,3293), +(0,8,42,1156,3471), +(0,8,43,1201,3575), +(0,8,44,1247,3680), +(0,8,45,1294,3801), +(0,8,46,1343,3923), +(0,8,47,1393,4031), +(0,8,48,1443,4140), +(0,8,49,1497,4281), +(0,8,50,1551,4393), +(0,8,51,1604,4506), +(0,8,52,1660,4650), +(0,8,53,1717,4765), +(0,8,54,1773,4896), +(0,8,55,1830,5013), +(0,8,56,1889,5206), +(0,8,57,1949,5340), +(0,8,58,2010,5461), +(0,8,59,2073,5598), +(0,8,60,2136,5751), +(0,8,61,2201,5875), +(0,8,62,2266,6015), +(0,8,63,2332,6156), +(0,8,64,0,6229), +(0,8,65,2467,6443), +(0,8,66,0,6588), +(0,8,67,2610,6749), +(0,8,68,2684,6882), +(0,8,69,0,7031), +(0,8,70,2835,7196), +(0,8,71,2914,7332), +(0,8,72,2995,7500), +(0,8,73,0,7654), +(0,8,74,0,7809), +(0,8,75,3257,7981), +(0,8,76,0,8139), +(0,8,77,0,8313), +(0,8,78,0,8459), +(0,8,79,0,8636), +(0,8,80,0,8814), +(0,8,81,0,8979), +(0,8,82,0,9160), +(0,8,83,0,9325), +(1,8,58,2793,5461), +(1,8,59,2899,5598), +(1,8,60,3484,5751), +(1,8,61,3611,5875), +(1,8,62,3739,6015), +(1,8,63,3870,6156), +(1,8,64,4000,6229), +(1,8,65,4140,6443), +(1,8,66,4281,6588), +(1,8,67,4429,6749), +(1,8,68,4580,6882), +(1,8,69,4733,7031), +(1,8,70,4890,7196), +(1,8,71,5027,7332), +(1,8,72,5166,7500), +(1,8,73,5311,7654), +(2,8,68,5588,6882), +(2,8,69,6387,7031), +(2,8,70,7185,7196), +(2,8,71,7432,7332), +(2,8,72,7688,7500), +(2,8,73,7952,7654), +(2,8,74,8225,7809), +(2,8,75,8508,7981), +(2,8,76,8800,8139), +(2,8,77,9103,8313), +(2,8,78,9416,8459), +(2,8,79,9740,8636), +(2,8,80,10080,8814), +(2,8,81,10486,8979), +(2,8,82,10784,9160), +(2,8,83,11156,9325); diff --git a/sql/updates/3.2.2a_old/6665_world_creature_template.sql b/sql/updates/3.2.2a_old/6665_world_creature_template.sql new file mode 100644 index 0000000..703da69 --- /dev/null +++ b/sql/updates/3.2.2a_old/6665_world_creature_template.sql @@ -0,0 +1,7 @@ +ALTER TABLE `creature_template` ADD `exp` smallint(2) NOT NULL DEFAULT 0 AFTER `IconName`; +ALTER TABLE `creature_template` DROP `minhealth`; +ALTER TABLE `creature_template` DROP `maxhealth`; +ALTER TABLE `creature_template` DROP `minmana`; +ALTER TABLE `creature_template` DROP `maxmana`; +ALTER TABLE `creature_template` CHANGE `unk16` `Health_mod` FLOAT; +ALTER TABLE `creature_template` CHANGE `unk17` `Mana_mod` FLOAT; diff --git a/sql/updates/3.2.2a_old/6669_world_creature_template.sql b/sql/updates/3.2.2a_old/6669_world_creature_template.sql new file mode 100644 index 0000000..6dac447 --- /dev/null +++ b/sql/updates/3.2.2a_old/6669_world_creature_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `creature_template` DROP `exp`; +ALTER TABLE `creature_template` ADD `exp` smallint(2) NOT NULL DEFAULT 0 AFTER `maxlevel`; diff --git a/sql/updates/3.2.2a_old/6675_world_spell_linked_spell.sql b/sql/updates/3.2.2a_old/6675_world_spell_linked_spell.sql new file mode 100644 index 0000000..78b0d69 --- /dev/null +++ b/sql/updates/3.2.2a_old/6675_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=54850; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(54850, 54851, 1, 'Emerge - Emerge Summon'); diff --git a/sql/updates/3.2.2a_old/6676_world_script_texts.sql b/sql/updates/3.2.2a_old/6676_world_script_texts.sql new file mode 100644 index 0000000..05e679b --- /dev/null +++ b/sql/updates/3.2.2a_old/6676_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1048000,-1048001,-1048002); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (4832,-1048000,'Just...Dust...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5803,1,0,0,''), + (4832,-1048001,'Sleep...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5804,1,0,0,''), + (4832,-1048002,'Who dares disturb my meditation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5805,1,0,0,''); diff --git a/sql/updates/3.2.2a_old/6678_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/6678_world_creature_classlevelstats.sql new file mode 100644 index 0000000..9352232 --- /dev/null +++ b/sql/updates/3.2.2a_old/6678_world_creature_classlevelstats.sql @@ -0,0 +1,16 @@ +UPDATE `creature_classlevelstats` SET `basehp`=3624 WHERE `exp`=0 AND `class`=1 AND `level`=66; +UPDATE `creature_classlevelstats` SET `basehp`=2899 WHERE `exp`=0 AND `class`=2 AND `level`=66; +UPDATE `creature_classlevelstats` SET `basehp`=3624 WHERE `exp`=0 AND `class`=4 AND `level`=66; +UPDATE `creature_classlevelstats` SET `basehp`=2537 WHERE `exp`=0 AND `class`=8 AND `level`=66; +UPDATE `creature_classlevelstats` SET `basehp`=4646 WHERE `exp`=0 AND `class`=2 AND `level`=83; +UPDATE `creature_classlevelstats` SET `basehp`=5808 WHERE `exp`=0 AND `class`=4 AND `level`=83; +UPDATE `creature_classlevelstats` SET `basehp`=4090 WHERE `exp`=0 AND `class`=8 AND `level`=83; +UPDATE `creature_classlevelstats` SET `basehp`=5194 WHERE `exp`=0 AND `class`=1 AND `level`=79; +UPDATE `creature_classlevelstats` SET `basehp`=4155 WHERE `exp`=0 AND `class`=2 AND `level`=79; +UPDATE `creature_classlevelstats` SET `basehp`=5194 WHERE `exp`=0 AND `class`=4 AND `level`=79; +UPDATE `creature_classlevelstats` SET `basehp`=3658 WHERE `exp`=0 AND `class`=8 AND `level`=79; +UPDATE `creature_classlevelstats` SET `basehp`=4781 WHERE `exp`=0 AND `class`=1 AND `level`=76; +UPDATE `creature_classlevelstats` SET `basehp`=3825 WHERE `exp`=0 AND `class`=2 AND `level`=76; +UPDATE `creature_classlevelstats` SET `basehp`=4781 WHERE `exp`=0 AND `class`=4 AND `level`=76; +UPDATE `creature_classlevelstats` SET `basehp`=3367 WHERE `exp`=0 AND `class`=8 AND `level`=76; +UPDATE `creature_classlevelstats` SET `basehp`=1 WHERE `basehp`=0; diff --git a/sql/updates/3.2.2a_old/6686_world_scriptname.sql b/sql/updates/3.2.2a_old/6686_world_scriptname.sql new file mode 100644 index 0000000..7315d1e --- /dev/null +++ b/sql/updates/3.2.2a_old/6686_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_released_offspring_harkoa' WHERE `entry`=28526; diff --git a/sql/updates/3.2.2a_old/6691_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6691_world_spell_proc_event.sql new file mode 100644 index 0000000..80ee580 --- /dev/null +++ b/sql/updates/3.2.2a_old/6691_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +-- Glyph of Seal of Command +DELETE FROM `spell_proc_event` WHERE `entry` IN (54925); +INSERT INTO `spell_proc_event` +(`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +(54925,0x02,10,0x00000000,0x00000208,0x00000000,0x00000000,0x00000000,0,0,0); diff --git a/sql/updates/3.2.2a_old/6694_world_item_template.sql b/sql/updates/3.2.2a_old/6694_world_item_template.sql new file mode 100644 index 0000000..b74dda5 --- /dev/null +++ b/sql/updates/3.2.2a_old/6694_world_item_template.sql @@ -0,0 +1,50 @@ +-- Alter Flags column in item_template to allow signed value +ALTER TABLE `item_template` CHANGE `Flags` `Flagstemp` INT(10); +ALTER TABLE `item_template` ADD `Flags` INT SIGNED NOT NULL AFTER `Quality`; +UPDATE `item_template` SET `Flags` = `Flagstemp`; +ALTER TABLE `item_template` DROP `Flagstemp`; +-- Alter maxcount column in item_template to allow max signed value +ALTER TABLE `item_template` CHANGE `maxcount` `maxcounttemp` smallINT(5); +ALTER TABLE `item_template` ADD `maxcount` INT SIGNED NOT NULL AFTER `RequiredReputationRank`; +UPDATE `item_template` SET `maxcount` = `maxcounttemp`; +ALTER TABLE `item_template` DROP `maxcounttemp`; +-- Alter stackable column in item_template to allow max signed value +ALTER TABLE `item_template` CHANGE `stackable` `stackabletemp` INT(11); +ALTER TABLE `item_template` ADD `stackable` INT SIGNED DEFAULT 1 AFTER `maxcount`; +UPDATE `item_template` SET `stackable` = `stackabletemp`; +ALTER TABLE `item_template` DROP `stackabletemp`; +-- Alter BuyPrice column in item_template to allow max signed value +ALTER TABLE `item_template` CHANGE `BuyPrice` `BuyPricetemp` INT(10); +ALTER TABLE `item_template` ADD `BuyPrice` INT SIGNED NOT NULL AFTER `BuyCount`; +UPDATE `item_template` SET `BuyPrice` = `BuyPricetemp`; +ALTER TABLE `item_template` DROP `BuyPricetemp`; +-- Alter spellid_1 column in item_template to allow signed value +ALTER TABLE `item_template` CHANGE `spellid_1` `spellid_1temp` MEDIUMINT(8); +ALTER TABLE `item_template` ADD `spellid_1` MEDIUMINT(8) SIGNED NOT NULL AFTER `RangedModRange`; +UPDATE `item_template` SET `spellid_1` = `spellid_1temp`; +ALTER TABLE `item_template` DROP `spellid_1temp`; +-- Alter spellid_2 column in item_template to allow signed value +ALTER TABLE `item_template` CHANGE `spellid_2` `spellid_2temp` MEDIUMINT(8); +ALTER TABLE `item_template` ADD `spellid_2` MEDIUMINT(8) SIGNED NOT NULL AFTER `spellcategorycooldown_1`; +UPDATE `item_template` SET `spellid_2` = `spellid_2temp`; +ALTER TABLE `item_template` DROP `spellid_2temp`; +-- Alter spellid_3 column in item_template to allow signed value +ALTER TABLE `item_template` CHANGE `spellid_3` `spellid_3temp` MEDIUMINT(8); +ALTER TABLE `item_template` ADD `spellid_3` MEDIUMINT(8) SIGNED NOT NULL AFTER `spellcategorycooldown_2`; +UPDATE `item_template` SET `spellid_3` = `spellid_3temp`; +ALTER TABLE `item_template` DROP `spellid_3temp`; +-- Alter spellid_4 column in item_template to allow signed value +ALTER TABLE `item_template` CHANGE `spellid_4` `spellid_4temp` MEDIUMINT(8); +ALTER TABLE `item_template` ADD `spellid_4` MEDIUMINT(8) SIGNED NOT NULL AFTER `spellcategorycooldown_3`; +UPDATE `item_template` SET `spellid_4` = `spellid_4temp`; +ALTER TABLE `item_template` DROP `spellid_4temp`; +-- Alter spellid_5 column in item_template to allow signed value +ALTER TABLE `item_template` CHANGE `spellid_5` `spellid_5temp` MEDIUMINT(8); +ALTER TABLE `item_template` ADD `spellid_5` MEDIUMINT(8) SIGNED NOT NULL AFTER `spellcategorycooldown_4`; +UPDATE `item_template` SET `spellid_5` = `spellid_5temp`; +ALTER TABLE `item_template` DROP `spellid_5temp`; +-- Alter RandomProperty column in item_template to allow signed value +ALTER TABLE `item_template` CHANGE `RandomProperty` `RandomPropertytemp` MEDIUMINT(8); +ALTER TABLE `item_template` ADD `RandomProperty` MEDIUMINT(8) SIGNED NOT NULL AFTER `sheath`; +UPDATE `item_template` SET `RandomProperty` = `RandomPropertytemp`; +ALTER TABLE `item_template` DROP `RandomPropertytemp`; diff --git a/sql/updates/3.2.2a_old/6710_realmd_account_access.sql b/sql/updates/3.2.2a_old/6710_realmd_account_access.sql new file mode 100644 index 0000000..3349f2f --- /dev/null +++ b/sql/updates/3.2.2a_old/6710_realmd_account_access.sql @@ -0,0 +1,14 @@ +-- Table structure for `account_access` +DROP TABLE IF EXISTS `account_access`; +CREATE TABLE `account_access` ( + `id` bigint(20) unsigned NOT NULL, + `gmlevel` tinyint(3) unsigned NOT NULL, + `RealmID` int(11) NOT NULL, + PRIMARY KEY (`id`,`RealmID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +-- export current gm account to the new table +-- RealmID -1 = all realms +INSERT INTO `account_access` (id, gmlevel, RealmID) +SELECT `id`, `gmlevel`, -1 FROM `account` WHERE `gmlevel` > 0; +-- Remove the gmlevel field from account +ALTER TABLE account DROP COLUMN `gmlevel`; diff --git a/sql/updates/3.2.2a_old/6710_world_command.sql b/sql/updates/3.2.2a_old/6710_world_command.sql new file mode 100644 index 0000000..cd48931 --- /dev/null +++ b/sql/updates/3.2.2a_old/6710_world_command.sql @@ -0,0 +1,3 @@ +UPDATE command +SET help = 'Syntax: .account set gmlevel [$account] #level [#realmid]\r\n\r\nSet the security level for targeted player (can\'t be used at self) or for account $name to a level of #level on the realm #realmID.\r\n\r\n#level may range from 0 to 3.\r\n\r\n#reamID may be -1 for all realms.' +WHERE name = 'account set gmlevel'; diff --git a/sql/updates/3.2.2a_old/6710_world_trinity_string.sql b/sql/updates/3.2.2a_old/6710_world_trinity_string.sql new file mode 100644 index 0000000..6fac607 --- /dev/null +++ b/sql/updates/3.2.2a_old/6710_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM `trinity_string` WHERE `entry`=11001; +INSERT INTO trinity_string (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`) VALUES +(11001, 'You have not chosen -1 or the current realmID that you are on.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.2.2a_old/6711_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/6711_world_creature_classlevelstats.sql new file mode 100644 index 0000000..57e3d6f --- /dev/null +++ b/sql/updates/3.2.2a_old/6711_world_creature_classlevelstats.sql @@ -0,0 +1,6 @@ +UPDATE `creature_classlevelstats` SET `basehp`=3256 WHERE `exp`=0 AND `class`=8 AND `level`=75; +UPDATE `creature_classlevelstats` SET `basehp`=3739 WHERE `exp`=0 AND `class`=8 AND `level`=80; +UPDATE `creature_classlevelstats` SET `basehp`=4524 WHERE `exp`=0 AND `class`=1 AND `level`=74; +UPDATE `creature_classlevelstats` SET `basehp`=3619 WHERE `exp`=0 AND `class`=2 AND `level`=74; +UPDATE `creature_classlevelstats` SET `basehp`=4524 WHERE `exp`=0 AND `class`=4 AND `level`=74; +UPDATE `creature_classlevelstats` SET `basehp`=3186 WHERE `exp`=0 AND `class`=8 AND `level`=74; diff --git a/sql/updates/3.2.2a_old/6712_realmd_account_access.sql b/sql/updates/3.2.2a_old/6712_realmd_account_access.sql new file mode 100644 index 0000000..40ba7a6 --- /dev/null +++ b/sql/updates/3.2.2a_old/6712_realmd_account_access.sql @@ -0,0 +1 @@ +ALTER TABLE `account_access` CHANGE `id` `id` int(11) UNSIGNED NOT NULL; diff --git a/sql/updates/3.2.2a_old/6739_world_script_waypoints.sql b/sql/updates/3.2.2a_old/6739_world_script_waypoints.sql new file mode 100644 index 0000000..4e90eee --- /dev/null +++ b/sql/updates/3.2.2a_old/6739_world_script_waypoints.sql @@ -0,0 +1,8 @@ +DELETE FROM `script_waypoint` WHERE `entry`=30023; +INSERT INTO `script_waypoint` VALUES + (30023, 1, 5722.558, -2960.685, 286.276, 0, ''), + (30023, 2, 5734.698, -2984.990, 286.276, 0, ''), + (30023, 3, 5737.401, -2991.310, 282.575, 0, ''), + (30023, 4, 5740.416, -2997.536, 277.263, 0, ''), + (30023, 5, 5743.790, -3004.050, 273.570, 0, ''), + (30023, 6, 5764.240, -2993.788, 272.944, 0, ''); diff --git a/sql/updates/3.2.2a_old/6742_world_script_texts.sql b/sql/updates/3.2.2a_old/6742_world_script_texts.sql new file mode 100644 index 0000000..5bc4684 --- /dev/null +++ b/sql/updates/3.2.2a_old/6742_world_script_texts.sql @@ -0,0 +1,3 @@ +DELETE FROM `script_texts` WHERE `entry`=-1571035; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (30007,-1571035,'The battle is about to begin! Am I reading this card right It... It''s the nefarious magnataur lord, STINKBEARD! Yes, folks, STINKBEARD! Chitchat dosen''t stand a chance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13363,1,0,0,''); diff --git a/sql/updates/3.2.2a_old/6742_world_script_waypoints.sql b/sql/updates/3.2.2a_old/6742_world_script_waypoints.sql new file mode 100644 index 0000000..306b6ca --- /dev/null +++ b/sql/updates/3.2.2a_old/6742_world_script_waypoints.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_waypoint` WHERE `entry`=30017; +INSERT INTO `script_waypoint` VALUES + (30017, 1, 5790.975, -2927.297, 286.277, 0, ''), + (30017, 2, 5803.003, -2952.998, 286.277, 0, ''), + (30017, 3, 5805.184, -2958.513, 282.899, 0, ''), + (30017, 4, 5807.038, -2961.449, 280.250, 0, ''), + (30017, 5, 5808.862, -2965.138, 277.089, 0, ''), + (30017, 6, 5811.703, -2970.821, 273.569, 0, ''), + (30017, 7, 5789.979, -2980.250, 273.584, 0, ''); diff --git a/sql/updates/3.2.2a_old/6742_world_scriptname.sql b/sql/updates/3.2.2a_old/6742_world_scriptname.sql new file mode 100644 index 0000000..60b9664 --- /dev/null +++ b/sql/updates/3.2.2a_old/6742_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_stinkbeard' WHERE `entry`=30017; diff --git a/sql/updates/3.2.2a_old/6748_world_command.sql b/sql/updates/3.2.2a_old/6748_world_command.sql new file mode 100644 index 0000000..507e469 --- /dev/null +++ b/sql/updates/3.2.2a_old/6748_world_command.sql @@ -0,0 +1 @@ +DELETE FROM `command` WHERE `name`='reload npc_option'; diff --git a/sql/updates/3.2.2a_old/6751_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/6751_world_creature_classlevelstats.sql new file mode 100644 index 0000000..97ec2dc --- /dev/null +++ b/sql/updates/3.2.2a_old/6751_world_creature_classlevelstats.sql @@ -0,0 +1,462 @@ +TRUNCATE TABLE `creature_classlevelstats`; +INSERT INTO `creature_classlevelstats` (`exp`,`class`,`level`,`basehp`,`basemana`) VALUES +(0,1,1,42,0), +(0,1,2,55,0), +(0,1,3,71,0), +(0,1,4,86,0), +(0,1,5,102,0), +(0,1,6,120,0), +(0,1,7,137,0), +(0,1,8,156,0), +(0,1,9,176,0), +(0,1,10,198,0), +(0,1,11,222,0), +(0,1,12,247,0), +(0,1,13,273,0), +(0,1,14,300,0), +(0,1,15,328,0), +(0,1,16,356,0), +(0,1,17,386,0), +(0,1,18,417,0), +(0,1,19,449,0), +(0,1,20,484,0), +(0,1,21,521,0), +(0,1,22,562,0), +(0,1,23,605,0), +(0,1,24,651,0), +(0,1,25,699,0), +(0,1,26,750,0), +(0,1,27,800,0), +(0,1,28,853,0), +(0,1,29,905,0), +(0,1,30,955,0), +(0,1,31,1006,0), +(0,1,32,1057,0), +(0,1,33,1110,0), +(0,1,34,1163,0), +(0,1,35,1220,0), +(0,1,36,1277,0), +(0,1,37,1336,0), +(0,1,38,1395,0), +(0,1,39,1459,0), +(0,1,40,1524,0), +(0,1,41,1585,0), +(0,1,42,1651,0), +(0,1,43,1716,0), +(0,1,44,1782,0), +(0,1,45,1848,0), +(0,1,46,1919,0), +(0,1,47,1990,0), +(0,1,48,2061,0), +(0,1,49,2138,0), +(0,1,50,2215,0), +(0,1,51,2292,0), +(0,1,52,2371,0), +(0,1,53,2453,0), +(0,1,54,2533,0), +(0,1,55,2614,0), +(0,1,56,2699,0), +(0,1,57,2784,0), +(0,1,58,2871,0), +(0,1,59,2961,0), +(0,1,60,3052,0), +(0,1,61,3144,0), +(0,1,62,3237,0), +(0,1,63,3331,0), +(0,1,64,1,0), -- TODO +(0,1,65,3524,0), +(0,1,66,3624,0), +(0,1,67,3728,0), +(0,1,68,3834,0), +(0,1,69,1,0), -- TODO +(0,1,70,4050,0), +(0,1,71,4163,0), +(0,1,72,4278,0), +(0,1,73,1,0), -- TODO +(0,1,74,4524,0), +(0,1,75,4652,0), +(0,1,76,4781,0), +(0,1,77,4916,0), +(0,1,78,5052,0), +(0,1,79,5194,0), +(0,1,80,5342,0), +(0,1,81,5496,0), +(0,1,82,5647,0), +(0,1,83,5808,0), +(1,1,58,3989,0), +(1,1,59,4142,0), +(1,1,60,4979,0), +(1,1,61,5158,0), +(1,1,62,5341,0), +(1,1,63,5527,0), +(1,1,64,5715,0), +(1,1,65,5914,0), +(1,1,66,6116,0), +(1,1,67,6326,0), +(1,1,68,6542,0), +(1,1,69,6761,0), +(1,1,70,6986,0), +(1,1,71,7181,0), +(1,1,72,7380,0), +(1,1,73,7580,0), +(2,1,68,6986,0), +(2,1,69,7984,0), +(2,1,70,8982,0), +(2,1,71,9291,0), +(2,1,72,9610,0), +(2,1,73,9940,0), +(2,1,74,10282,0), +(2,1,75,10635,0), +(2,1,76,11001,0), +(2,1,77,11379,0), +(2,1,78,11770,0), +(2,1,79,12175,0), +(2,1,80,12600,0), +(2,1,81,13033,0), +(2,1,82,13481,0), +(2,1,83,13945,0), +(0,2,1,41,60), +(0,2,2,54,69), +(0,2,3,69,79), +(0,2,4,83,104), +(0,2,5,98,115), +(0,2,6,115,126), +(0,2,7,131,138), +(0,2,8,148,165), +(0,2,9,166,178), +(0,2,10,186,191), +(0,2,11,208,205), +(0,2,12,230,249), +(0,2,13,253,264), +(0,2,14,276,295), +(0,2,15,301,326), +(0,2,16,325,357), +(0,2,17,350,390), +(0,2,18,377,408), +(0,2,19,404,456), +(0,2,20,433,490), +(0,2,21,464,510), +(0,2,22,498,544), +(0,2,23,533,581), +(0,2,24,571,618), +(0,2,25,610,655), +(0,2,26,651,693), +(0,2,27,690,732), +(0,2,28,732,756), +(0,2,29,773,811), +(0,2,30,811,852), +(0,2,31,850,878), +(0,2,32,888,935), +(0,2,33,928,963), +(0,2,34,967,1007), +(0,2,35,1009,1067), +(0,2,36,1050,1097), +(0,2,37,1093,1142), +(0,2,38,1135,1186), +(0,2,39,1180,1236), +(0,2,40,1226,1283), +(0,2,41,1268,1332), +(0,2,42,1321,1381), +(0,2,43,1373,1432), +(0,2,44,1426,1483), +(0,2,45,1478,1534), +(0,2,46,1535,1587), +(0,2,47,1592,1640), +(0,2,48,1650,1695), +(0,2,49,1710,1750), +(0,2,50,1772,1807), +(0,2,51,1834,1864), +(0,2,52,1897,1923), +(0,2,53,1962,1982), +(0,2,54,2026,2041), +(0,2,55,2091,2117), +(0,2,56,2159,2163), +(0,2,57,2227,2241), +(0,2,58,2297,2289), +(0,2,59,2369,2369), +(0,2,60,2442,2434), +(0,2,61,2515,2486), +(0,2,62,2590,2568), +(0,2,63,2665,2620), +(0,2,64,1,2705), -- TODO +(0,2,65,2819,2790), +(0,2,66,2899,2846), +(0,2,67,2982,2933), +(0,2,68,3067,2991), +(0,2,69,1,3080), -- TODO +(0,2,70,3240,3155), +(0,2,71,3330,3231), +(0,2,72,3422,3309), +(0,2,73,1,3387), -- TODO +(0,2,74,3619,3466), +(0,2,75,3722,3561), +(0,2,76,3825,3643), +(0,2,77,3933,3725), +(0,2,78,4042,3809), +(0,2,79,4155,3893), +(0,2,80,4274,3994), +(0,2,81,4394,4081), +(0,2,82,4518,4169), +(0,2,83,4646,4258), +(1,2,58,3191,2289), +(1,2,59,3314,2369), +(1,2,60,3984,2434), +(1,2,61,4126,2486), +(1,2,62,4274,2568), +(1,2,63,4422,2620), +(1,2,64,4572,2705), +(1,2,65,4731,2790), +(1,2,66,4892,2846), +(1,2,67,5060,2933), +(1,2,68,5233,2991), +(1,2,69,5409,3080), +(1,2,70,5589,3155), +(1,2,71,5744,3231), +(1,2,72,5900,3309), +(1,2,73,6070,3387), +(2,2,68,6986,2991), +(2,2,69,7984,3080), +(2,2,70,8982,3155), +(2,2,71,9291,3231), +(2,2,72,9610,3309), +(2,2,73,9940,3387), +(2,2,74,10282,3466), +(2,2,75,10635,3561), +(2,2,76,11001,3643), +(2,2,77,11379,3725), +(2,2,78,11770,3809), +(2,2,79,12175,3893), +(2,2,80,12600,3994), +(2,2,81,13033,4081), +(2,2,82,13481,4169), +(2,2,83,13945,4258), +(0,4,1,42,0), +(0,4,2,55,0), +(0,4,3,71,0), +(0,4,4,86,0), +(0,4,5,102,0), +(0,4,6,120,0), +(0,4,7,137,0), +(0,4,8,156,0), +(0,4,9,176,0), +(0,4,10,198,0), +(0,4,11,222,0), +(0,4,12,247,0), +(0,4,13,273,0), +(0,4,14,300,0), +(0,4,15,328,0), +(0,4,16,356,0), +(0,4,17,386,0), +(0,4,18,417,0), +(0,4,19,449,0), +(0,4,20,484,0), +(0,4,21,521,0), +(0,4,22,562,0), +(0,4,23,605,0), +(0,4,24,651,0), +(0,4,25,699,0), +(0,4,26,750,0), +(0,4,27,800,0), +(0,4,28,853,0), +(0,4,29,905,0), +(0,4,30,955,0), +(0,4,31,1006,0), +(0,4,32,1057,0), +(0,4,33,1110,0), +(0,4,34,1163,0), +(0,4,35,1220,0), +(0,4,36,1277,0), +(0,4,37,1336,0), +(0,4,38,1395,0), +(0,4,39,1459,0), +(0,4,40,1524,0), +(0,4,41,1585,0), +(0,4,42,1651,0), +(0,4,43,1716,0), +(0,4,44,1782,0), +(0,4,45,1848,0), +(0,4,46,1919,0), +(0,4,47,1990,0), +(0,4,48,2061,0), +(0,4,49,2138,0), +(0,4,50,2215,0), +(0,4,51,2292,0), +(0,4,52,2371,0), +(0,4,53,2453,0), +(0,4,54,2533,0), +(0,4,55,2614,0), +(0,4,56,2699,0), +(0,4,57,2784,0), +(0,4,58,2871,0), +(0,4,59,2961,0), +(0,4,60,3052,0), +(0,4,61,3144,0), +(0,4,62,3237,0), +(0,4,63,3331,0), +(0,4,64,1,0), -- TODO +(0,4,65,3524,0), +(0,4,66,3624,0), +(0,4,67,3728,0), +(0,4,68,3834,0), +(0,4,69,1,0), -- TODO +(0,4,70,4050,0), +(0,4,71,4163,0), +(0,4,72,4278,0), +(0,4,73,1,0), -- TODO +(0,4,74,4524,0), +(0,4,75,4652,0), +(0,4,76,4781,0), +(0,4,77,4916,0), +(0,4,78,5052,0), +(0,4,79,5194,0), +(0,4,80,5342,0), +(0,4,81,5496,0), +(0,4,82,5647,0), +(0,4,83,5808,0), +(1,4,58,3989,0), +(1,4,59,4142,0), +(1,4,60,4979,0), +(1,4,61,5158,0), +(1,4,62,5341,0), +(1,4,63,5527,0), +(1,4,64,5715,0), +(1,4,65,5914,0), +(1,4,66,6116,0), +(1,4,67,6326,0), +(1,4,68,6542,0), +(1,4,69,6761,0), +(1,4,70,6986,0), +(1,4,71,7181,0), +(1,4,72,7380,0), +(1,4,73,7580,0), +(2,4,68,6986,0), +(2,4,69,7984,0), +(2,4,70,8982,0), +(2,4,71,9291,0), +(2,4,72,9610,0), +(2,4,73,9940,0), +(2,4,74,10282,0), +(2,4,75,10635,0), +(2,4,76,11001,0), +(2,4,77,11379,0), +(2,4,78,11770,0), +(2,4,79,12175,0), +(2,4,80,12600,0), +(2,4,81,13033,0), +(2,4,82,13481,0), +(2,4,83,13945,0), +(0,8,1,40,120), +(0,8,2,52,0), +(0,8,3,67,174), +(0,8,4,81,202), +(0,8,5,95,230), +(0,8,6,111,259), +(0,8,7,126,289), +(0,8,8,143,319), +(0,8,9,160,350), +(0,8,10,178,382), +(0,8,11,199,459), +(0,8,12,219,537), +(0,8,13,241,601), +(0,8,14,263,710), +(0,8,15,285,790), +(0,8,16,307,856), +(0,8,17,330,938), +(0,8,18,354,1020), +(0,8,19,379,1118), +(0,8,20,405,1202), +(0,8,21,432,1272), +(0,8,22,463,1357), +(0,8,23,494,1443), +(0,8,24,528,1545), +(0,8,25,562,1633), +(0,8,26,598,1707), +(0,8,27,633,1812), +(0,8,28,669,1977), +(0,8,29,704,2068), +(0,8,30,737,2175), +(0,8,31,770,2253), +(0,8,32,802,2362), +(0,8,33,835,2457), +(0,8,34,867,2553), +(0,8,35,902,2680), +(0,8,36,935,2763), +(0,8,37,970,2861), +(0,8,38,1004,2975), +(0,8,39,1040,3075), +(0,8,40,1077,3191), +(0,8,41,1110,3293), +(0,8,42,1156,3471), +(0,8,43,1201,3575), +(0,8,44,1247,3680), +(0,8,45,1294,3801), +(0,8,46,1343,3923), +(0,8,47,1393,4031), +(0,8,48,1443,4140), +(0,8,49,1497,4281), +(0,8,50,1551,4393), +(0,8,51,1604,4506), +(0,8,52,1660,4650), +(0,8,53,1717,4765), +(0,8,54,1773,4896), +(0,8,55,1830,5013), +(0,8,56,1889,5206), +(0,8,57,1949,5340), +(0,8,58,2010,5461), +(0,8,59,2073,5598), +(0,8,60,2136,5751), +(0,8,61,2201,5875), +(0,8,62,2266,6015), +(0,8,63,2332,6156), +(0,8,64,1,6229), -- TODO +(0,8,65,2467,6443), +(0,8,66,2552,6588), +(0,8,67,2610,6749), +(0,8,68,2684,6882), +(0,8,69,1,7031), -- TODO +(0,8,70,2835,7196), +(0,8,71,2914,7332), +(0,8,72,2995,7500), +(0,8,73,1,7654), -- TODO +(0,8,74,3186,7809), +(0,8,75,3256,7981), +(0,8,76,3367,8139), +(0,8,77,3462,8313), +(0,8,78,3558,8459), +(0,8,79,3658,8636), +(0,8,80,3739,8814), +(0,8,81,3870,8979), +(0,8,82,3977,9160), +(0,8,83,4090,9325), +(1,8,58,2793,5461), +(1,8,59,2899,5598), +(1,8,60,3484,5751), +(1,8,61,3611,5875), +(1,8,62,3739,6015), +(1,8,63,3870,6156), +(1,8,64,4000,6229), +(1,8,65,4140,6443), +(1,8,66,4281,6588), +(1,8,67,4429,6749), +(1,8,68,4580,6882), +(1,8,69,4733,7031), +(1,8,70,4890,7196), +(1,8,71,5027,7332), +(1,8,72,5166,7500), +(1,8,73,5311,7654), +(2,8,68,5588,6882), +(2,8,69,6387,7031), +(2,8,70,7185,7196), +(2,8,71,7432,7332), +(2,8,72,7688,7500), +(2,8,73,7952,7654), +(2,8,74,8225,7809), +(2,8,75,8508,7981), +(2,8,76,8800,8139), +(2,8,77,9103,8313), +(2,8,78,9416,8459), +(2,8,79,9740,8636), +(2,8,80,10080,8814), +(2,8,81,10486,8979), +(2,8,82,10784,9160), +(2,8,83,11156,9325); diff --git a/sql/updates/3.2.2a_old/6771_world_scriptname.sql b/sql/updates/3.2.2a_old/6771_world_scriptname.sql new file mode 100644 index 0000000..6079688 --- /dev/null +++ b/sql/updates/3.2.2a_old/6771_world_scriptname.sql @@ -0,0 +1,13 @@ +-- Trial of the Champion +UPDATE `instance_template` SET `script`='instance_trial_of_the_champion' WHERE `map`=650; +UPDATE `creature_template` SET `Scriptname`='npc_toc5_announcer',`npcflag`=1 WHERE entry IN (35004, 35005); +UPDATE `creature_template` SET `ScriptName`='mob_toc5_warrior' WHERE entry IN (34705, 35572); +UPDATE `creature_template` SET `ScriptName`='mob_toc5_mage' WHERE entry IN (34702, 35569); +UPDATE `creature_template` SET `ScriptName`='mob_toc5_shaman' WHERE entry IN (34701, 35571); +UPDATE `creature_template` SET `ScriptName`='mob_toc5_hunter' WHERE entry IN (34657, 35570); +UPDATE `creature_template` SET `ScriptName`='mob_toc5_rogue' WHERE entry IN (34703, 35617); +UPDATE `creature_template` SET `ScriptName`='npc_risen_ghoul' WHERE `entry` IN (35545,35564); +UPDATE `creature_template` SET `ScriptName`='boss_black_knight' WHERE `entry`=35451; +UPDATE `creature_template` SET `ScriptName`='boss_eadric' WHERE `entry`=35119; +UPDATE `creature_template` SET `ScriptName`='boss_paletress' WHERE `entry`=34928; +UPDATE `creature_template` SET `ScriptName`='npc_memory' WHERE `entry` IN (35052,35041,35033,35046,35043,35047,35044,35039, 35034, 35049, 35030, 34942, 35050, 35042, 35045, 35037, 35031, 35038, 35029,35048,35032,35028,35040,35036,35051); diff --git a/sql/updates/3.2.2a_old/6782_world_scriptname.sql b/sql/updates/3.2.2a_old/6782_world_scriptname.sql new file mode 100644 index 0000000..4b35a3b --- /dev/null +++ b/sql/updates/3.2.2a_old/6782_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_risen_ghoul' WHERE `entry` IN (35545, 35564); diff --git a/sql/updates/3.2.2a_old/6792_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6792_world_spell_proc_event.sql new file mode 100644 index 0000000..b4c82e0 --- /dev/null +++ b/sql/updates/3.2.2a_old/6792_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET SpellFamilyMask0 = 0x04000000, SpellFamilyMask1 = 0x10000000 WHERE entry IN (49208, 56834, 56835); diff --git a/sql/updates/3.2.2a_old/6799_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6799_world_spell_proc_event.sql new file mode 100644 index 0000000..e333883 --- /dev/null +++ b/sql/updates/3.2.2a_old/6799_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET `SchoolMask`=4,`spellFamilyMask0`=146800663,`spellFamilyMask1`=200776 WHERE `entry`=11129; diff --git a/sql/updates/3.2.2a_old/6804_world_spell_linked_spell.sql b/sql/updates/3.2.2a_old/6804_world_spell_linked_spell.sql new file mode 100644 index 0000000..d931c15 --- /dev/null +++ b/sql/updates/3.2.2a_old/6804_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=66680; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(66680,66547,0,'Confess - Confess'); diff --git a/sql/updates/3.2.2a_old/6823_world_spell_linked_spell.sql b/sql/updates/3.2.2a_old/6823_world_spell_linked_spell.sql new file mode 100644 index 0000000..4ff2036 --- /dev/null +++ b/sql/updates/3.2.2a_old/6823_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=66889; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(66889, -66865, 0, 'Remove Vengeance'); diff --git a/sql/updates/3.2.2a_old/6828_world_scriptname.sql b/sql/updates/3.2.2a_old/6828_world_scriptname.sql new file mode 100644 index 0000000..ed6a272 --- /dev/null +++ b/sql/updates/3.2.2a_old/6828_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_eadric' WHERE `entry`=35119; +UPDATE `creature_template` SET `ScriptName`='boss_paletress' WHERE `entry`=34928; +UPDATE `creature_template` SET `ScriptName`='npc_memory' WHERE `entry` IN (35052,35041,35033,35046,35043,35047,35044,35039, 35034, 35049, 35030, 34942, 35050, 35042, 35045, 35037, 35031, 35038, 35029,35048,35032,35028,35040,35036,35051); diff --git a/sql/updates/3.2.2a_old/6840_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6840_world_spell_proc_event.sql new file mode 100644 index 0000000..76f8cfc --- /dev/null +++ b/sql/updates/3.2.2a_old/6840_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +-- Seal of Command +-- Change max procs per minute (ppm) to be read from the dbc +UPDATE spell_proc_event +SET ppmRate = 0 +WHERE entry = 20375; diff --git a/sql/updates/3.2.2a_old/6857_world_scriptname.sql b/sql/updates/3.2.2a_old/6857_world_scriptname.sql new file mode 100644 index 0000000..4a7f540 --- /dev/null +++ b/sql/updates/3.2.2a_old/6857_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='valiant_challenge' WHERE `entry`=33518; diff --git a/sql/updates/3.2.2a_old/6859_world_script_texts.sql b/sql/updates/3.2.2a_old/6859_world_script_texts.sql new file mode 100644 index 0000000..2029fb7 --- /dev/null +++ b/sql/updates/3.2.2a_old/6859_world_script_texts.sql @@ -0,0 +1,10 @@ +DELETE FROM `script_texts` WHERE `npc_entry` IN (25504, 25589); +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(25504, -1750040, 'My father''s aura is quite strong, he cannot be far. Could you be a doll and fight off the monsters wandering throught the mist?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_mootoo_the_younger'), +(25504, -1750041, 'Watch out for the monsters!Which way should we go first? Let''s try this way...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_mootoo_the_younger'), +(25504, -1750042, 'What could this be?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_mootoo_the_younger'), +(25504, -1750043, 'There''s no sign of it ending! Where could my father be?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_mootoo_the_younger'), +(25504, -1750044, 'Father! You''re safe!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'npc_mootoo_the_younger'), +(25589, -1700003, 'I\'ll make you a deal: If you get me out of here alive, you\'ll get a reward larger than you can imagine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','0','0','npc_bonker_togglevolt'), +(25589, -1700002, 'I AM NOT AN APPETIZER!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','0','0','npc_bonker_togglevolt'), +(25589, -1700001, 'Right then, no time to waste. Lets get outa here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','0','0','npc_bonker_togglevolt'); diff --git a/sql/updates/3.2.2a_old/6859_world_script_waypoints.sql b/sql/updates/3.2.2a_old/6859_world_script_waypoints.sql new file mode 100644 index 0000000..aa9b67f --- /dev/null +++ b/sql/updates/3.2.2a_old/6859_world_script_waypoints.sql @@ -0,0 +1,55 @@ +DELETE FROM `script_waypoint` WHERE `entry` IN(25504, 25589); +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`, `location_y`, `location_z`,`waittime`,`point_comment`) VALUES +(25504,1,'2882.26','6734.51','32.8864',0,'Mootoo the Younger'), +(25504,2,'2877.37','6731.59','32.8721',0,'Mootoo the Younger'), +(25504,3,'2874.18','6725.85','30.3087',0,'Mootoo the Younger'), +(25504,4,'2866.36','6726.04','26.7277',0,'Mootoo the Younger'), +(25504,5,'2863.97','6731.91','23.8372',0,'Mootoo the Younger'), +(25504,6,'2869.29','6736.92','20.5227',0,'Mootoo the Younger'), +(25504,7,'2874.16','6731.88','18.5042',0,'Mootoo the Younger'), +(25504,8,'2887.05','6736.39','13.997',0,'Mootoo the Younger'), +(25504,9,'2901.68','6741.25','14.0413',0,'Mootoo the Younger'), +(25504,10,'2919.45','6746.28','13.7325',5000,'Mootoo the Younger'), +(25504,11,'2947.18','6738.71','12.7117',0,'Mootoo the Younger'), +(25504,12,'2982.43','6748.59','10.2755',5000,'Mootoo the Younger'), +(25504,13,'2985.05','6776.05','8.33081',0,'Mootoo the Younger'), +(25504,14,'2978.72','6801.48','5.83056',0,'Mootoo the Younger'), +(25504,15,'2957.81','6818.86','4.7594',0,'Mootoo the Younger'), +(25504,16,'2917.03','6820.55','5.87954',5000,'Mootoo the Younger'), +(25504,17,'2890.04','6825.68','4.11676',0,'Mootoo the Younger'), +(25504,18,'2850.31','6812.35','2.09411',0,'Mootoo the Younger'), +(25504,19,'2821.29','6797.99','4.49696',0,'Mootoo the Younger'), +(25504,20,'2798.25','6770.64','5.0632',1000,'Mootoo the Younger'), +(25504,21,'2807.49','6748.29','8.25933',5000,'Mootoo the Younger'); + +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`, `location_y`, `location_z`,`waittime`) VALUES +(25589, 1,'4462.37','5372.75','-15.2912',0), +(25589, 2,'4478.7','5377.27','-15.0012',5000), +(25589, 3,'4482.25','5390.64','-15.2354',0), +(25589, 4,'4477.09','5405.02','-15.2386',0), +(25589, 5,'4468.71','5416.9','-15.2602',0), +(25589, 6,'4457.24','5426.87','-15.6104',0), +(25589, 7,'4439.7','5433.46','-15.2384',0), +(25589, 8,'4422.63','5432.32','-14.8822',0), +(25589, 9,'4404.71','5422.74','-14.4494',0), +(25589, 10,'4394.68','5406.63','-10.8423',0), +(25589, 11,'4391.99','5392.88','-6.45477',0), +(25589, 12,'4390.65','5370.91','0.504708',0), +(25589, 13,'4393.34','5354.19','3.1859',0), +(25589, 14,'4401.68','5342.78','5.20245',0), +(25589, 15,'4417.98','5335.18','8.31299',0), +(25589, 16,'4431.01','5335.17','11.0135',0), +(25589, 17,'4446.21','5340.58','14.4585',0), +(25589, 18,'4462.73','5350.22','16.8783',0), +(25589, 19,'4475.06','5362.82','19.1229',0), +(25589, 20,'4480.92','5381.72','22.2479',0), +(25589, 21,'4481.31','5394.2','26.2008',0), +(25589, 22,'4476.32','5409.12','29.0811',5000), +(25589, 23,'4466.33','5420.75','31.8093',0), +(25589, 24,'4450.66','5430.03','36.2843',0), +(25589, 25,'4431.24','5433.77','38.2282',0), +(25589, 26,'4417.65','5437.11','40.2429',0), +(25589, 27,'4402.5','5440.94','42.7727',0), +(25589, 28,'4387.11','5450.98','48.6992',0), +(25589, 29,'4364.52','5468.98','48.8229',0), +(25589, 30,'4344.02','5483.26','48.0509',0); diff --git a/sql/updates/3.2.2a_old/6859_world_scriptname.sql b/sql/updates/3.2.2a_old/6859_world_scriptname.sql new file mode 100644 index 0000000..5e53cfe --- /dev/null +++ b/sql/updates/3.2.2a_old/6859_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_mootoo_the_younger' WHERE `entry`=25504; +UPDATE `creature_template` SET `ScriptName`='npc_bonker_togglevolt' WHERE `entry`=25589; diff --git a/sql/updates/3.2.2a_old/6871_world_spell_bonus_data.sql b/sql/updates/3.2.2a_old/6871_world_spell_bonus_data.sql new file mode 100644 index 0000000..b0d18fc --- /dev/null +++ b/sql/updates/3.2.2a_old/6871_world_spell_bonus_data.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_bonus_data` WHERE `entry`=12654; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`,`ap_bonus`, `ap_dot_bonus`, `comments`) VALUES (12654, 0, 0, 0, 0, 'Mage - Ignite'); diff --git a/sql/updates/3.2.2a_old/6873_world_scriptname.sql b/sql/updates/3.2.2a_old/6873_world_scriptname.sql new file mode 100644 index 0000000..3031b9b --- /dev/null +++ b/sql/updates/3.2.2a_old/6873_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE creature_template SET ScriptName = 'npc_shadowfiend' WHERE entry = 19668; diff --git a/sql/updates/3.2.2a_old/6877_world_script_texts.sql b/sql/updates/3.2.2a_old/6877_world_script_texts.sql new file mode 100644 index 0000000..55bec5a --- /dev/null +++ b/sql/updates/3.2.2a_old/6877_world_script_texts.sql @@ -0,0 +1,7 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1000464,-1000465,-1000466,-1000467,-1000468); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (349,-1000464,'My wounds are grave. Forgive my slow pace but my injuries won''t allow me to walk any faster.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000465,'Ah, fresh air, at last! I need a moment to reset.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000466,'The Blackrock infestation is thick in these parts. I will do my best to keep the pace. Let''s go!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000467,'Marshal Marris, sir. Corporal Keeshan of the 12th Sabre Regiment returned from battle and reporting for duty!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (349,-1000468,'Brave adventurer, thank you for rescuing me! I am sure Marshal Marris will reward your kind deed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''); diff --git a/sql/updates/3.2.2a_old/6877_world_script_waypoints.sql b/sql/updates/3.2.2a_old/6877_world_script_waypoints.sql new file mode 100644 index 0000000..428a531 --- /dev/null +++ b/sql/updates/3.2.2a_old/6877_world_script_waypoints.sql @@ -0,0 +1,117 @@ +DELETE FROM `script_waypoint` WHERE `entry`=349; +INSERT INTO `script_waypoint` VALUES +(349,1,-8763.9,-2185.21,141.217,0,''), +(349,2,-8768.76,-2185.94,141.949,0,''), +(349,3,-8772.1,-2189.18,141.443,0,''), +(349,4,-8778.78,-2195.66,140.662,0,''), +(349,5,-8789.74,-2191.46,141.634,0,''), +(349,6,-8802.37,-2185.99,141.96,0,''), +(349,7,-8818,-2184.8,139.153,0,''), +(349,8,-8828.42,-2193.02,138.973,0,''), +(349,9,-8826.45,-2203.82,140.293,0,''), +(349,10,-8822.54,-2211.43,142.884,0,''), +(349,11,-8813.51,-2225.08,143.327,0,''), +(349,12,-8807.5,-2233.92,144.441,0,''), +(349,13,-8801.3,-2239.04,146.476,0,''), +(349,14,-8797.57,-2243.61,146.594,0,''), +(349,15,-8794.38,-2250.83,146.723,0,''), +(349,16,-8788.1,-2255.1,147.309,0,''), +(349,17,-8775.37,-2259.82,149.18,0,''), +(349,18,-8768.09,-2259.54,150.52,0,''), +(349,19,-8754.65,-2255.62,152.253,0,''), +(349,20,-8748.51,-2252.62,153.098,0,''), +(349,21,-8743.2,-2251.67,154.038,0,''), +(349,22,-8738.4,-2250.23,154.028,0,''), +(349,23,-8734.35,-2251.56,154.363,0,''), +(349,24,-8727.41,-2248.64,154.919,0,''), +(349,25,-8717.66,-2246.3,154.926,0,''), +(349,26,-8709.05,-2245.83,154.767,0,''), +(349,27,-8700.13,-2243.28,153.872,0,''), +(349,28,-8690.15,-2242.54,153.733,0,''), +(349,29,-8683.49,-2244.31,155.356,0,''), +(349,30,-8674.53,-2247.89,155.574,0,''), +(349,31,-8669.86,-2252.77,154.854,0,''), +(349,32,-8669.07,-2258.88,156.424,0,''), +(349,33,-8670.56,-2264.69,156.978,0,''), +(349,34,-8673.45,-2269.45,156.007,0,''), +(349,35,-8674.4,-2275.9,155.747,0,''), +(349,36,-8674.82,-2282.75,155.496,0,''), +(349,37,-8675.17,-2289.5,157.049,0,''), +(349,38,-8676.43,-2297.67,156.701,0,''), +(349,39,-8677.59,-2304.85,155.917,0,''), +(349,40,-8682.32,-2312.88,155.928,0,''), +(349,41,-8687.78,-2324.44,156.024,0,''), +(349,42,-8695.71,-2334.87,156.06,0,''), +(349,43,-8705.17,-2345.13,156.021,0,''), +(349,44,-8715.1,-2353.95,156.188,0,''), +(349,45,-8725.8,-2359.17,156.253,0,''), +(349,46,-8735.92,-2363.27,157.151,0,''), +(349,47,-8746.82,-2367.99,158.13,0,''), +(349,48,-8755.38,-2375.72,157.271,0,''), +(349,49,-8765.12,-2388.08,156.092,0,''), +(349,50,-8768.84,-2395.58,155.926,0,''), +(349,51,-8772.85,-2405.27,156.418,0,''), +(349,52,-8776.95,-2414.94,156.388,0,''), +(349,53,-8781.69,-2430.11,153.264,0,''), +(349,54,-8786.76,-2440.34,147.849,0,''), +(349,55,-8792.01,-2453.38,142.746,0,''), +(349,56,-8797.41,-2462.21,138.171,0,''), +(349,57,-8804.78,-2472.43,134.192,0,''), +(349,58,-8815.26,-2478.45,133.079,0,''), +(349,59,-8823.74,-2491.21,132.911,0,''), +(349,60,-8835.25,-2496.44,132.057,0,''), +(349,61,-8841.04,-2503.01,132.199,0,''), +(349,62,-8850.81,-2509.63,132.865,0,''), +(349,63,-8858.64,-2522.29,133.852,0,''), +(349,64,-8862.25,-2527.1,134.279,0,''), +(349,65,-8870.67,-2542.08,131.044,0,''), +(349,66,-8880.4,-2550.79,130.505,0,''), +(349,67,-8892.87,-2560.3,130.558,0,''), +(349,68,-8908.74,-2573.64,131.616,0,''), +(349,69,-8922.05,-2585.31,132.446,0,''), +(349,70,-8935.86,-2591.19,132.446,0,''), +(349,71,-8949.08,-2596.87,132.537,0,''), +(349,72,-8959.17,-2599.72,132.507,0,''), +(349,73,-8969.43,-2601.96,132.471,0,''), +(349,74,-8979.77,-2603.66,132.39,0,''), +(349,75,-8991.61,-2604.16,131.196,0,''), +(349,76,-9000.2,-2602.38,128.954,0,''), +(349,77,-9011.57,-2594.23,127.435,0,''), +(349,78,-9019.77,-2587.67,126.618,0,''), +(349,79,-9028.35,-2582.26,125.787,0,''), +(349,80,-9038.96,-2572.71,124.748,0,''), +(349,81,-9046.92,-2560.64,124.447,0,''), +(349,82,-9059.29,-2550.1,123.756,0,''), +(349,83,-9068.15,-2547.28,122.965,0,''), +(349,84,-9077.54,-2541.67,121.17,0,''), +(349,85,-9085.61,-2532.98,118.85,0,''), +(349,86,-9097.8,-2520.49,117.401,0,''), +(349,87,-9110.18,-2507.01,117.098,0,''), +(349,88,-9119.21,-2498.23,116.627,0,''), +(349,89,-9124.61,-2487.07,115.972,0,''), +(349,90,-9127.42,-2478.53,114.843,0,''), +(349,91,-9133.18,-2465.77,113.029,0,''), +(349,92,-9137.54,-2456.22,111.051,0,''), +(349,93,-9146.73,-2441.6,107.979,0,''), +(349,94,-9155.62,-2430.79,106.251,0,''), +(349,95,-9158.06,-2420.36,104.838,0,''), +(349,96,-9157.25,-2410.2,103.858,0,''), +(349,97,-9152.95,-2401.47,102.679,0,''), +(349,98,-9153.63,-2393.46,100.63,0,''), +(349,99,-9156.48,-2385.68,98.2937,0,''), +(349,100,-9161.01,-2379.87,96.2066,0,''), +(349,101,-9169.08,-2373.14,93.8832,0,''), +(349,102,-9175.61,-2368.72,92.5178,0,''), +(349,103,-9187.1,-2360.52,89.9231,0,''), +(349,104,-9194.27,-2352.89,87.593,0,''), +(349,105,-9201.07,-2344.88,85.8516,0,''), +(349,106,-9205.62,-2339.56,85.0342,0,''), +(349,107,-9212.44,-2331.58,83.8068,0,''), +(349,108,-9219.26,-2323.6,82.29,0,''), +(349,109,-9229.98,-2313.25,79.4506,0,''), +(349,110,-9240.03,-2303.51,76.7841,0,''), +(349,111,-9249.34,-2298.82,74.3911,0,''), +(349,112,-9254.95,-2296.68,72.8144,0,''), +(349,113,-9264.73,-2292.92,70.0089,0,''), +(349,114,-9272.24,-2293.79,68.6096,0,''), +(349,115,-9277.03,-2295.98,68.1135,10000,''); diff --git a/sql/updates/3.2.2a_old/6877_world_scriptname.sql b/sql/updates/3.2.2a_old/6877_world_scriptname.sql new file mode 100644 index 0000000..8c57960 --- /dev/null +++ b/sql/updates/3.2.2a_old/6877_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_corporal_keeshan' WHERE `entry`=349; diff --git a/sql/updates/3.2.2a_old/6881_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6881_world_spell_proc_event.sql new file mode 100644 index 0000000..f78a973 --- /dev/null +++ b/sql/updates/3.2.2a_old/6881_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET procFlags=procFlags|4 WHERE `entry` in (53486,53488); -- Fix Art of War to only proc from Critical Hits diff --git a/sql/updates/3.2.2a_old/6882_world_creature_addon.sql b/sql/updates/3.2.2a_old/6882_world_creature_addon.sql new file mode 100644 index 0000000..6c8c54b --- /dev/null +++ b/sql/updates/3.2.2a_old/6882_world_creature_addon.sql @@ -0,0 +1 @@ +ALTER TABLE `creature_addon` DROP COLUMN `moveflags`; diff --git a/sql/updates/3.2.2a_old/6882_world_creature_template_addon.sql b/sql/updates/3.2.2a_old/6882_world_creature_template_addon.sql new file mode 100644 index 0000000..cd5b3e5 --- /dev/null +++ b/sql/updates/3.2.2a_old/6882_world_creature_template_addon.sql @@ -0,0 +1 @@ +ALTER TABLE `creature_template_addon` DROP COLUMN `moveflags`; diff --git a/sql/updates/3.2.2a_old/6887_world_scriptname.sql b/sql/updates/3.2.2a_old/6887_world_scriptname.sql new file mode 100644 index 0000000..313667c --- /dev/null +++ b/sql/updates/3.2.2a_old/6887_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_blackfathom_deeps_event' WHERE `entry` IN (4823,4825,4977,4978); diff --git a/sql/updates/3.2.2a_old/6889_world_script_texts.sql b/sql/updates/3.2.2a_old/6889_world_script_texts.sql new file mode 100644 index 0000000..4186a4f --- /dev/null +++ b/sql/updates/3.2.2a_old/6889_world_script_texts.sql @@ -0,0 +1,4 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1048003,-1048004); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(6729,-1048003,'Aku''mai is dead! At last, I can leave this wretched place.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(6729,-1048004,'Speak with me to hear my tale',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''); diff --git a/sql/updates/3.2.2a_old/6889_world_script_waypoints.sql b/sql/updates/3.2.2a_old/6889_world_script_waypoints.sql new file mode 100644 index 0000000..c3eb3d3 --- /dev/null +++ b/sql/updates/3.2.2a_old/6889_world_script_waypoints.sql @@ -0,0 +1,7 @@ +DELETE FROM `script_waypoint` WHERE `entry`=6729; +INSERT INTO `script_waypoint` VALUES +(6729,1,-861.803,-460.36,-33.8918,0,''), +(6729,2,-856.168,-464.425,-33.9223,0,''), +(6729,3,-849.964,-469.231,-34.0381,0,''), +(6729,4,-839.838,-473.654,-34.0535,0,''), +(6729,5,-837.417,-473.105,-34.0288,0,''); diff --git a/sql/updates/3.2.2a_old/6889_world_scriptname.sql b/sql/updates/3.2.2a_old/6889_world_scriptname.sql new file mode 100644 index 0000000..7195753 --- /dev/null +++ b/sql/updates/3.2.2a_old/6889_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_morridune' WHERE `entry`=6729; diff --git a/sql/updates/3.2.2a_old/6890_world_scriptname.sql b/sql/updates/3.2.2a_old/6890_world_scriptname.sql new file mode 100644 index 0000000..821ad82 --- /dev/null +++ b/sql/updates/3.2.2a_old/6890_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_table_theka' WHERE `entry`=142715; diff --git a/sql/updates/3.2.2a_old/6896_world_script_texts.sql b/sql/updates/3.2.2a_old/6896_world_script_texts.sql new file mode 100644 index 0000000..c579d22 --- /dev/null +++ b/sql/updates/3.2.2a_old/6896_world_script_texts.sql @@ -0,0 +1,3 @@ +DELETE FROM `script_texts` WHERE `entry`=-1033009; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (4275,-1033009,'Who dares interfere with the Sons of Arugal?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); diff --git a/sql/updates/3.2.2a_old/6896_world_scriptname.sql b/sql/updates/3.2.2a_old/6896_world_scriptname.sql new file mode 100644 index 0000000..32fd50b --- /dev/null +++ b/sql/updates/3.2.2a_old/6896_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_arugal_voidwalker' WHERE `entry`=4627; diff --git a/sql/updates/3.2.2a_old/6898_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6898_world_spell_proc_event.sql new file mode 100644 index 0000000..bad7690 --- /dev/null +++ b/sql/updates/3.2.2a_old/6898_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +DELETE FROM spell_proc_event WHERE entry = 58387; +INSERT INTO spell_proc_event VALUES(58387, 0, 4, 16384, 64, 0, 16, 0, 0, 0, 0); -- Glyph of Sunder Armor diff --git a/sql/updates/3.2.2a_old/6901_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6901_world_spell_proc_event.sql new file mode 100644 index 0000000..6d03c08 --- /dev/null +++ b/sql/updates/3.2.2a_old/6901_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +DELETE FROM spell_proc_event WHERE entry = 58375; +INSERT INTO spell_proc_event VALUES(58375, 0, 4, 0, 0x200, 0, 0x10, 0, 0, 0, 0); -- Glyph of Blocking diff --git a/sql/updates/3.2.2a_old/6903_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6903_world_spell_proc_event.sql new file mode 100644 index 0000000..b15e41e --- /dev/null +++ b/sql/updates/3.2.2a_old/6903_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET customChance = 100 WHERE entry = 33757; diff --git a/sql/updates/3.2.2a_old/6915_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6915_world_spell_proc_event.sql new file mode 100644 index 0000000..ed974e9 --- /dev/null +++ b/sql/updates/3.2.2a_old/6915_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET spellFamilyMask0 = spellFamilyMask0 | 0x100, customChance = 100 WHERE entry IN (16198, 16180, 16196); diff --git a/sql/updates/3.2.2a_old/6922_world_scriptname.sql b/sql/updates/3.2.2a_old/6922_world_scriptname.sql new file mode 100644 index 0000000..54b9e8f --- /dev/null +++ b/sql/updates/3.2.2a_old/6922_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_mr_smite' WHERE `entry`=646; diff --git a/sql/updates/3.2.2a_old/6923_world_trinity_string.sql b/sql/updates/3.2.2a_old/6923_world_trinity_string.sql new file mode 100644 index 0000000..78bf752 --- /dev/null +++ b/sql/updates/3.2.2a_old/6923_world_trinity_string.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry`=5020; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES (5020, 'Phasemask: %u'); diff --git a/sql/updates/3.2.2a_old/6932_characters_character_aura.sql b/sql/updates/3.2.2a_old/6932_characters_character_aura.sql new file mode 100644 index 0000000..9cf36f0 --- /dev/null +++ b/sql/updates/3.2.2a_old/6932_characters_character_aura.sql @@ -0,0 +1,5 @@ +ALTER TABLE `character_aura` + ADD COLUMN `base_amount0` INT(11) NOT NULL DEFAULT '0' AFTER `amount2`, + ADD COLUMN `base_amount1` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount0`, + ADD COLUMN `base_amount2` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount1`, + ADD COLUMN `recalculate_mask` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `effect_mask`; diff --git a/sql/updates/3.2.2a_old/6932_characters_pet_aura.sql b/sql/updates/3.2.2a_old/6932_characters_pet_aura.sql new file mode 100644 index 0000000..fe386e7 --- /dev/null +++ b/sql/updates/3.2.2a_old/6932_characters_pet_aura.sql @@ -0,0 +1,5 @@ +ALTER TABLE `pet_aura` DROP PRIMARY KEY, + ADD COLUMN `base_amount0` INT(11) NOT NULL DEFAULT '0' AFTER `amount2`, + ADD COLUMN `base_amount1` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount0`, + ADD COLUMN `base_amount2` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount1`, + ADD COLUMN `recalculate_mask` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `effect_mask`; diff --git a/sql/updates/3.2.2a_old/6932_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6932_world_spell_proc_event.sql new file mode 100644 index 0000000..8b4dfca --- /dev/null +++ b/sql/updates/3.2.2a_old/6932_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM spell_proc_event WHERE procEx & 0x6000; diff --git a/sql/updates/3.2.2a_old/6941_world_spell_linked_spell.sql b/sql/updates/3.2.2a_old/6941_world_spell_linked_spell.sql new file mode 100644 index 0000000..10c7144 --- /dev/null +++ b/sql/updates/3.2.2a_old/6941_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 19263 AND `spell_effect` = 67801; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +( 19263, 67801, 2, 'Deterrence'); diff --git a/sql/updates/3.2.2a_old/6947_world_scriptname.sql b/sql/updates/3.2.2a_old/6947_world_scriptname.sql new file mode 100644 index 0000000..1de4fa2 --- /dev/null +++ b/sql/updates/3.2.2a_old/6947_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_fezzix_geartwist' WHERE `entry`=25849; diff --git a/sql/updates/3.2.2a_old/6953_world_trinity_string.sql b/sql/updates/3.2.2a_old/6953_world_trinity_string.sql new file mode 100644 index 0000000..c2e6f5f --- /dev/null +++ b/sql/updates/3.2.2a_old/6953_world_trinity_string.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry`=5021; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES (5021, 'Armor: %u'); diff --git a/sql/updates/3.2.2a_old/6960_characters_character_aura.sql b/sql/updates/3.2.2a_old/6960_characters_character_aura.sql new file mode 100644 index 0000000..3122a6b --- /dev/null +++ b/sql/updates/3.2.2a_old/6960_characters_character_aura.sql @@ -0,0 +1,2 @@ +DELETE FROM `character_aura` WHERE `spell` IN (61248, 58105, 61251); + \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6960_characters_pet_aura.sql b/sql/updates/3.2.2a_old/6960_characters_pet_aura.sql new file mode 100644 index 0000000..8488413 --- /dev/null +++ b/sql/updates/3.2.2a_old/6960_characters_pet_aura.sql @@ -0,0 +1,2 @@ +DELETE FROM `pet_aura` WHERE `spell` IN (61248, 58105, 61251); + \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/6964_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/6964_world_creature_classlevelstats.sql new file mode 100644 index 0000000..3280190 --- /dev/null +++ b/sql/updates/3.2.2a_old/6964_world_creature_classlevelstats.sql @@ -0,0 +1,416 @@ +ALTER TABLE `creature_template` ADD COLUMN `Armor_mod` FLOAT NOT NULL DEFAULT '1' AFTER `Mana_mod`; +ALTER TABLE `creature_template` DROP COLUMN `armor`; + +DROP TABLE IF EXISTS `creature_classlevelstats`; + +CREATE TABLE `creature_classlevelstats` ( + `level` tinyint(1) NOT NULL, + `class` tinyint(1) NOT NULL, + `basehp0` smallint(2) NOT NULL, + `basehp1` smallint(2) NOT NULL, + `basehp2` smallint(2) NOT NULL, + `basemana` smallint(2) NOT NULL, + `basearmor` smallint(2) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `creature_classlevelstats` (`class`,`level`,`basehp0`,`basehp1`,`basehp2`,`basemana`,`basearmor`) VALUES +(1,1,42,1,1,0,8), +(1,2,55,1,1,0,20), +(1,3,71,1,1,0,33), +(1,4,86,1,1,0,68), +(1,5,102,1,1,0,111), +(1,6,120,1,1,0,165), +(1,7,137,1,1,0,230), +(1,8,156,1,1,0,306), +(1,9,176,1,1,0,387), +(1,10,198,1,1,0,463), +(1,11,222,1,1,0,528), +(1,12,247,1,1,0,562), +(1,13,273,1,1,0,596), +(1,14,300,1,1,0,630), +(1,15,328,1,1,0,665), +(1,16,356,1,1,0,700), +(1,17,386,1,1,0,734), +(1,18,417,1,1,0,768), +(1,19,449,1,1,0,802), +(1,20,484,1,1,0,836), +(1,21,521,1,1,0,872), +(1,22,562,1,1,0,906), +(1,23,605,1,1,0,940), +(1,24,651,1,1,0,975), +(1,25,699,1,1,0,1008), +(1,26,750,1,1,0,1043), +(1,27,800,1,1,0,1078), +(1,28,853,1,1,0,1111), +(1,29,905,1,1,0,1145), +(1,30,955,1,1,0,1179), +(1,31,1006,1,1,0,1213), +(1,32,1057,1,1,0,1249), +(1,33,1110,1,1,0,1281), +(1,34,1163,1,1,0,1317), +(1,35,1220,1,1,0,1349), +(1,36,1277,1,1,0,1456), +(1,37,1336,1,1,0,1568), +(1,38,1395,1,1,0,1684), +(1,39,1459,1,1,0,1808), +(1,40,1524,1,1,0,1938), +(1,41,1585,1,1,0,2074), +(1,42,1651,1,1,0,2218), +(1,43,1716,1,1,0,2369), +(1,44,1782,1,1,0,2528), +(1,45,1848,1,1,0,2695), +(1,46,1919,1,1,0,2750), +(1,47,1990,1,1,0,2804), +(1,48,2062,1,1,0,2857), +(1,49,2138,1,1,0,2912), +(1,50,2215,1,1,0,2966), +(1,51,2292,1,1,0,3018), +(1,52,2371,1,1,0,3060), +(1,53,2453,1,1,0,3128), +(1,54,2533,1,1,0,3180), +(1,55,2614,1,1,0,3234), +(1,56,2699,1,1,0,3289), +(1,57,2784,1,1,0,3342), +(1,58,2871,3989,1,0,3396), +(1,59,2961,4142,1,0,3449), +(1,60,3052,4979,1,0,3750), +(1,61,3144,5158,1,0,4047), +(1,62,3237,5341,1,0,4344), +(1,63,3331,5527,1,0,4641), +(1,64,3427,5715,1,0,4937), +(1,65,3524,5914,1,0,5234), +(1,66,3624,6116,1,0,5531), +(1,67,3728,6326,1,0,5829), +(1,68,3834,6542,6986,0,6126), +(1,69,3942,6761,7984,0,6423), +(1,70,4050,6986,8982,0,6719), +(1,71,4163,7181,9291,0,7018), +(1,72,4278,7380,9610,0,7318), +(1,73,4399,7588,9940,0,7618), +(1,74,4524,7804,10282,0,7918), +(1,75,4652,8025,10635,0,8219), +(1,76,4781,8247,11001,0,8520), +(1,77,4916,8480,11379,0,8822), +(1,78,5052,0,11770,0,9124), +(1,79,5194,0,12175,0,9426), +(1,80,5342,9215,12600,0,9729), +(1,81,5496,1,13033,0,10033), +(1,82,5647,1,13481,0,10356), +(1,83,5808,1,13945,0,10673), +(1,84,1,1,1,0,1), +(1,85,1,1,1,0,1), +(1,86,1,1,1,0,1), +(1,87,1,1,1,0,1), +(1,88,1,1,1,0,1), +(1,89,1,1,1,0,1), +(1,90,1,1,1,0,1), +(1,91,1,1,1,0,1), +(1,92,1,1,1,0,1), +(1,93,1,1,1,0,1), +(1,94,1,1,1,0,1), +(1,95,1,1,1,0,1), +(1,96,1,1,1,0,1), +(1,97,1,1,1,0,1), +(1,98,1,1,1,0,1), +(1,99,1,1,1,0,1), +(1,100,1,1,1,0,1), +(2,1,41,1,1,60,7), +(2,2,54,1,1,69,19), +(2,3,69,1,1,79,33), +(2,4,83,1,1,104,66), +(2,5,98,1,1,115,109), +(2,6,115,1,1,126,163), +(2,7,131,1,1,138,208), +(2,8,148,1,1,165,303), +(2,9,166,1,1,178,369), +(2,10,186,1,1,191,460), +(2,11,208,1,1,205,526), +(2,12,230,1,1,249,560), +(2,13,253,1,1,264,596), +(2,14,276,1,1,295,630), +(2,15,301,1,1,326,665), +(2,16,325,1,1,357,700), +(2,17,350,1,1,390,734), +(2,18,377,1,1,408,768), +(2,19,404,1,1,456,802), +(2,20,433,1,1,490,836), +(2,21,464,1,1,510,872), +(2,22,498,1,1,545,906), +(2,23,533,1,1,581,940), +(2,24,571,1,1,618,975), +(2,25,610,1,1,655,1008), +(2,26,651,1,1,693,1042), +(2,27,690,1,1,732,1078), +(2,28,732,1,1,756,1110), +(2,29,773,1,1,811,1145), +(2,30,811,1,1,852,1178), +(2,31,850,1,1,878,1213), +(2,32,888,1,1,935,1248), +(2,33,928,1,1,963,1281), +(2,34,967,1,1,1007,1316), +(2,35,1009,1,1,1067,1349), +(2,36,1050,1,1,1097,1455), +(2,37,1093,1,1,1142,1567), +(2,38,1135,1,1,1189,1683), +(2,39,1180,1,1,1236,1807), +(2,40,1226,1,1,1283,1937), +(2,41,1268,1,1,1332,2072), +(2,42,1321,1,1,1381,2216), +(2,43,1373,1,1,1432,2367), +(2,44,1426,1,1,1483,2527), +(2,45,1478,1,1,1534,2692), +(2,46,1535,1,1,1587,2749), +(2,47,1592,1,1,1640,2802), +(2,48,1650,1,1,1695,2855), +(2,49,1710,1,1,1750,2910), +(2,50,1772,1,1,1807,2964), +(2,51,1834,1,1,1864,3017), +(2,52,1897,1,1,1923,3072), +(2,53,1962,1,1,1982,3126), +(2,54,2026,1,1,2041,3178), +(2,55,2091,1,1,2117,3232), +(2,56,2159,1,1,2163,3287), +(2,57,2227,1,1,2241,3340), +(2,58,2297,3191,1,2289,3394), +(2,59,2369,3314,1,2369,3447), +(2,60,2442,3984,1,2434,3748), +(2,61,2515,4126,1,2486,4044), +(2,62,2590,4274,1,2568,4340), +(2,63,2665,4422,1,2620,4637), +(2,64,2740,4572,1,2705,4933), +(2,65,2819,4731,1,2790,5228), +(2,66,2899,4892,6116,2846,5523), +(2,67,2982,5060,1,2933,5821), +(2,68,3067,5233,6986,2991,6116), +(2,69,3153,5409,7984,3080,6412), +(2,70,3240,5589,8982,3155,6708), +(2,71,3330,5744,9291,3231,7007), +(2,72,3422,5903,9610,3309,7305), +(2,73,3519,6070,9940,3387,7604), +(2,74,3619,1,10282,3466,7903), +(2,75,3722,6420,10635,3561,8204), +(2,76,3825,1,11001,3643,8503), +(2,77,3933,1,11379,3725,8803), +(2,78,4042,1,11770,3809,9104), +(2,79,4155,1,12175,3893,9405), +(2,80,4274,1,12600,3994,9706), +(2,81,4394,1,13033,4081,10007), +(2,82,4518,1,13481,4169,10253), +(2,83,4646,1,13945,4258,10573), +(2,84,1,1,1,1,1), +(2,85,1,1,1,1,1), +(2,86,1,1,1,1,1), +(2,87,1,1,1,1,1), +(2,88,1,1,1,1,1), +(2,89,1,1,1,1,1), +(2,90,1,1,1,1,1), +(2,91,1,1,1,1,1), +(2,92,1,1,1,1,1), +(2,93,1,1,1,1,1), +(2,94,1,1,1,1,1), +(2,95,1,1,1,1,1), +(2,96,1,1,1,1,1), +(2,97,1,1,1,1,1), +(2,98,1,1,1,1,1), +(2,99,1,1,1,1,1), +(2,100,1,1,1,1,1), +(4,1,42,1,1,0,6), +(4,2,55,1,1,0,18), +(4,3,71,1,1,0,31), +(4,4,86,1,1,0,63), +(4,5,102,1,1,0,102), +(4,6,120,1,1,0,152), +(4,7,137,1,1,0,212), +(4,8,156,1,1,0,286), +(4,9,176,1,1,0,363), +(4,10,198,1,1,0,443), +(4,11,222,1,1,0,488), +(4,12,247,1,1,0,519), +(4,13,273,1,1,0,553), +(4,14,300,1,1,0,577), +(4,15,328,1,1,0,612), +(4,16,356,1,1,0,645), +(4,17,386,1,1,0,676), +(4,18,417,1,1,0,706), +(4,19,449,1,1,0,738), +(4,20,484,1,1,0,769), +(4,21,521,1,1,0,801), +(4,22,562,1,1,0,833), +(4,23,605,1,1,0,863), +(4,24,651,1,1,0,895), +(4,25,699,1,1,0,926), +(4,26,750,1,1,0,957), +(4,27,800,1,1,0,989), +(4,28,853,1,1,0,1020), +(4,29,905,1,1,0,1051), +(4,30,955,1,1,0,1082), +(4,31,1006,1,1,0,1113), +(4,32,1057,1,1,0,1146), +(4,33,1110,1,1,0,1173), +(4,34,1163,1,1,0,1208), +(4,35,1220,1,1,0,1237), +(4,36,1277,1,1,0,1349), +(4,37,1336,1,1,0,1434), +(4,38,1395,1,1,0,1538), +(4,39,1459,1,1,0,1649), +(4,40,1524,1,1,0,1764), +(4,41,1585,1,1,0,1886), +(4,42,1651,1,1,0,2015), +(4,43,1716,1,1,0,2148), +(4,44,1782,1,1,0,2303), +(4,45,1848,1,1,0,2436), +(4,46,1919,1,1,0,2485), +(4,47,1990,1,1,0,2535), +(4,48,2062,1,1,0,2582), +(4,49,2138,1,1,0,2631), +(4,50,2215,1,1,0,2680), +(4,51,2292,1,1,0,2728), +(4,52,2371,1,1,0,2778), +(4,53,2453,1,1,0,2826), +(4,54,2533,1,1,0,2874), +(4,55,2614,1,1,0,2922), +(4,56,2699,1,1,0,2972), +(4,57,2784,1,1,0,3020), +(4,58,2871,3989,1,0,3068), +(4,59,2961,4142,1,0,3117), +(4,60,3052,4979,1,0,3388), +(4,61,3144,5158,1,0,3655), +(4,62,3237,5341,1,0,3922), +(4,63,3331,5527,1,0,4189), +(4,64,3427,5715,1,0,4457), +(4,65,3524,5914,1,0,4724), +(4,66,3624,6116,1,0,5104), +(4,67,3728,6326,1,0,5326), +(4,68,3834,6542,6986,0,5527), +(4,69,3942,6761,7984,0,5795), +(4,70,4050,6986,8982,0,6062), +(4,71,4163,7181,9291,0,6332), +(4,72,4278,7380,9610,0,6602), +(4,73,4399,7580,9940,0,6872), +(4,74,4524,1,10282,0,7143), +(4,75,4652,1,10635,0,7415), +(4,76,4781,1,11001,0,7686), +(4,77,4916,1,11379,0,7958), +(4,78,5052,1,11770,0,8230), +(4,79,5194,1,12175,0,8503), +(4,80,5342,1,12600,0,8776), +(4,81,5496,1,13033,0,9068), +(4,82,5647,1,13481,0,9348), +(4,83,5808,1,13945,0,9589), +(4,84,1,1,1,0,1), +(4,85,1,1,1,0,1), +(4,86,1,1,1,0,1), +(4,87,1,1,1,0,1), +(4,88,1,1,1,0,1), +(4,89,1,1,1,0,1), +(4,90,1,1,1,0,1), +(4,91,1,1,1,0,1), +(4,92,1,1,1,0,1), +(4,93,1,1,1,0,1), +(4,94,1,1,1,0,1), +(4,95,1,1,1,0,1), +(4,96,1,1,1,0,1), +(4,97,1,1,1,0,1), +(4,98,1,1,1,0,1), +(4,99,1,1,1,0,1), +(4,100,1,1,1,0,1), +(8,1,40,1,1,120,5), +(8,2,52,1,1,147,16), +(8,3,67,1,1,174,28), +(8,4,81,1,1,202,57), +(8,5,95,1,1,230,93), +(8,6,111,1,1,259,139), +(8,7,126,1,1,289,194), +(8,8,143,1,1,319,265), +(8,9,160,1,1,350,339), +(8,10,178,1,1,382,423), +(8,11,199,1,1,459,447), +(8,12,219,1,1,537,475), +(8,13,241,1,1,601,509), +(8,14,263,1,1,710,523), +(8,15,285,1,1,790,559), +(8,16,307,1,1,856,589), +(8,17,330,1,1,938,617), +(8,18,354,1,1,1020,643), +(8,19,379,1,1,1118,674), +(8,20,405,1,1,1202,701), +(8,21,432,1,1,1272,729), +(8,22,463,1,1,1357,759), +(8,23,494,1,1,1443,786), +(8,24,528,1,1,1545,815), +(8,25,562,1,1,1633,843), +(8,26,598,1,1,1707,871), +(8,27,633,1,1,1812,900), +(8,28,669,1,1,1977,928), +(8,29,704,1,1,2068,957), +(8,30,737,1,1,2175,984), +(8,31,770,1,1,2253,1012), +(8,32,802,1,1,2362,1042), +(8,33,835,1,1,2457,1065), +(8,34,867,1,1,2553,1098), +(8,35,902,1,1,2680,1124), +(8,36,935,1,1,2763,1241), +(8,37,970,1,1,2861,1300), +(8,38,1004,1,1,2975,1391), +(8,39,1040,1,1,3075,1489), +(8,40,1077,1,1,3191,1590), +(8,41,1110,1,1,3293,1697), +(8,42,1156,1,1,3471,1811), +(8,43,1201,1,1,3575,1926), +(8,44,1247,1,1,3680,2078), +(8,45,1294,1,1,3801,2177), +(8,46,1343,1,1,3923,2220), +(8,47,1393,1,1,4031,2265), +(8,48,1443,1,1,4140,2307), +(8,49,1497,1,1,4281,2349), +(8,50,1551,1,1,4393,2393), +(8,51,1604,1,1,4506,2437), +(8,52,1660,1,1,4650,2481), +(8,53,1717,1,1,4765,2524), +(8,54,1773,1,1,4896,2567), +(8,55,1830,1,1,5013,2609), +(8,56,1889,1,1,5206,2654), +(8,57,1949,1,1,5340,2698), +(8,58,2010,2793,1,5461,2740), +(8,59,2073,2899,1,5598,2784), +(8,60,2136,3484,1,5751,3025), +(8,61,2201,3611,1,5875,3263), +(8,62,2266,3739,1,6015,3500), +(8,63,2332,3870,1,6156,3736), +(8,64,2399,4000,1,6229,3977), +(8,65,2467,4140,4731,6443,4214), +(8,66,2552,4281,4892,6588,4460), +(8,67,2610,4429,1,6749,4710), +(8,68,2684,4580,5588,6882,4928), +(8,69,2759,4733,6387,7031,5167), +(8,70,2835,4890,7185,7196,5404), +(8,71,2914,5027,7432,7332,5645), +(8,72,2995,5166,7688,7500,5886), +(8,73,3098,5311,7952,7654,6126), +(8,74,3186,1,8225,7809,6368), +(8,75,3256,5617,8508,7981,6610), +(8,76,3367,1,8800,8139,6851), +(8,77,3462,1,9103,8313,7094), +(8,78,3558,1,9416,8459,7335), +(8,79,3658,1,9740,8636,7579), +(8,80,3739,1,10080,8814,7822), +(8,81,3870,1,10486,8979,8102), +(8,82,3977,1,10784,9160,8340), +(8,83,4090,1,11156,9325,8505), +(8,84,1,1,1,1,1), +(8,85,1,1,1,1,1), +(8,86,1,1,1,1,1), +(8,87,1,1,1,1,1), +(8,88,1,1,1,1,1), +(8,89,1,1,1,1,1), +(8,90,1,1,1,1,1), +(8,91,1,1,1,1,1), +(8,92,1,1,1,1,1), +(8,93,1,1,1,1,1), +(8,94,1,1,1,1,1), +(8,95,1,1,1,1,1), +(8,96,1,1,1,1,1), +(8,97,1,1,1,1,1), +(8,98,1,1,1,1,1), +(8,99,1,1,1,1,1), +(8,100,1,1,1,1,1); diff --git a/sql/updates/3.2.2a_old/6966_world_trinity_string.sql b/sql/updates/3.2.2a_old/6966_world_trinity_string.sql new file mode 100644 index 0000000..0650be5 --- /dev/null +++ b/sql/updates/3.2.2a_old/6966_world_trinity_string.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default` = 'Selected object:\n|cffffffff|Hgameobject:%d|h[%s]|h|r GUID: %u ID: %u\nX: %f Y: %f Z: %f MapId: %u\nOrientation: %f\nPhasemask %u' WHERE `entry`=524; diff --git a/sql/updates/3.2.2a_old/6967_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/6967_world_spell_proc_event.sql new file mode 100644 index 0000000..c61b197 --- /dev/null +++ b/sql/updates/3.2.2a_old/6967_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET `procFlags`=139944 WHERE `entry` IN (974,32593,32594,49283,49284); diff --git a/sql/updates/3.2.2a_old/6979_world_scriptname.sql b/sql/updates/3.2.2a_old/6979_world_scriptname.sql new file mode 100644 index 0000000..c4fb669 --- /dev/null +++ b/sql/updates/3.2.2a_old/6979_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_bushwhacker' WHERE `entry`=28317; + diff --git a/sql/updates/3.2.2a_old/6980_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/6980_world_creature_classlevelstats.sql new file mode 100644 index 0000000..76a0082 --- /dev/null +++ b/sql/updates/3.2.2a_old/6980_world_creature_classlevelstats.sql @@ -0,0 +1,2 @@ +UPDATE `creature_classlevelstats` SET `basehp1`=1 WHERE `class`=1 AND `level` IN (78,79); + diff --git a/sql/updates/3.2.2a_old/6984_world_quest_template.sql b/sql/updates/3.2.2a_old/6984_world_quest_template.sql new file mode 100644 index 0000000..1cdef75 --- /dev/null +++ b/sql/updates/3.2.2a_old/6984_world_quest_template.sql @@ -0,0 +1 @@ +ALTER TABLE `quest_template` CHANGE `RewSpellCast` `RewSpellCast` int(11) SIGNED NOT NULL DEFAULT 0; diff --git a/sql/updates/3.2.2a_old/6988_world_scriptname.sql b/sql/updates/3.2.2a_old/6988_world_scriptname.sql new file mode 100644 index 0000000..c7b221e --- /dev/null +++ b/sql/updates/3.2.2a_old/6988_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `scriptname` = 'go_inconspicuous_landmark' WHERE `entry`=142189; + diff --git a/sql/updates/3.2.2a_old/7033_world_script_texts.sql b/sql/updates/3.2.2a_old/7033_world_script_texts.sql new file mode 100644 index 0000000..efb88bd --- /dev/null +++ b/sql/updates/3.2.2a_old/7033_world_script_texts.sql @@ -0,0 +1,33 @@ +DELETE FROM `script_texts` WHERE `npc_entry` IN (7998,7361); +DELETE FROM `script_texts` WHERE `entry` IN (-1090001,-1090002,-1090003,-1090004,-1090005,-1090006,-1090007,-1090008,-1090009,-1090010,-1090011,-1090012,-1090013,-1090014,-1090015,-1090016,-1090017,-1090018,-1090019,-1090020,-1090021,-1090022,-1090023,-1090024,-1090025,-1090026,-1090027,-1090028); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (7998,-1090000,'With your help, I can evaluate these tunnels.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090001,'Let''s see if we can find out where these Troggs are coming from... and put a stop to the invasion!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090002,'Such devastation... what horrible mess...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090003,'It''s quiet here...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090004,'...too quiet.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090005,'Look! Over there at the tunnel wall!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090006,'Trogg incrusion! Defend me while i blast the hole closed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090007,'The charges are set. Get back before they blow!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090008,'Incoming blast in 10 seconds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090009,'Incoming blast in 5 seconds. Clear the tunnel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090010,'FIRE IN THE HOLE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090011,'Well done! Without your help I would have never been able to thwart that wave of troggs.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090012,'Did you hear something?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090013,'I heard something over there.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090014,'More troggs! Ward them off as I prepare the explosives!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090015,'The final charge is set. Stand back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090016,'The final charge is set. Stand back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090017,'Incoming blast in 10 seconds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090018,'Incoming blast in 5 seconds. Clear the tunnel!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090019,'I don''t think one charge is going to cut it. Keep fending them off!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090020,'FIRE IN THE HOLE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090021,'Well done! Without your help I would have never been able to thwart that wave of troggs.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090022,'Did you hear something?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090023,'I heard something over there.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090024,'More troggs! Ward them off as I prepare the explosives!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090025,'The final charge is set. Stand back!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (7998,-1090026,'10 seconds to blast! Stand back!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7998,-1090027,'5 seconds until detonation!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (7361,-1090028,'We come from below! You can never stop us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); + diff --git a/sql/updates/3.2.2a_old/7033_world_script_waypoints.sql b/sql/updates/3.2.2a_old/7033_world_script_waypoints.sql new file mode 100644 index 0000000..3c9f6e7 --- /dev/null +++ b/sql/updates/3.2.2a_old/7033_world_script_waypoints.sql @@ -0,0 +1,17 @@ +DELETE FROM `script_waypoint` WHERE `entry`=7998; +INSERT INTO `script_waypoint` VALUES + (7998,1,-511.065,-134.51,-152.493,0,''), + (7998,2,-511.862,-131.76,-152.932,0,''), + (7998,3,-513.319,-126.733,-156.095,0,''), + (7998,4,-515.969,-118.962,-156.109,0,''), + (7998,5,-518.983,-111.608,-155.923,0,''), + (7998,6,-522.392,-101.145,-155.228,0,''), + (7998,7,-523.941,-96.9487,-154.823,0,''), + (7998,8,-531.938,-104.249,-156.031,0,''), + (7998,9,-533.141,-105.332,-156.017,30000,''), + (7998,10,-541.3,-96.7414,-155.895,30000,''), + (7998,11,-517.556,-106.826,-155.149,0,''), + (7998,12,-508.757,-103.227,-151.742,30000,''), + (7998,13,-512.396,-86.3113,-151.642,30000,''), + (7998,14,-520.928,-117.679,-156.119,0,''), + (7998,15,-521.717,-119.564,-156.114,0,''); diff --git a/sql/updates/3.2.2a_old/7033_world_scriptname.sql b/sql/updates/3.2.2a_old/7033_world_scriptname.sql new file mode 100644 index 0000000..27c83c0 --- /dev/null +++ b/sql/updates/3.2.2a_old/7033_world_scriptname.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `ScriptName`='npc_blastmaster_emi_shortfuse' WHERE `entry`=7998; +UPDATE `creature_template` SET `ScriptName`='boss_grubbis' WHERE `entry`=7361; +UPDATE `instance_template` SET `script`='instance_gnomeregan' WHERE `map`=90; + diff --git a/sql/updates/3.2.2a_old/7037_world_creature_template.sql b/sql/updates/3.2.2a_old/7037_world_creature_template.sql new file mode 100644 index 0000000..f886753 --- /dev/null +++ b/sql/updates/3.2.2a_old/7037_world_creature_template.sql @@ -0,0 +1,7 @@ +-- Usually creature_template changes MUST GO to TDB +-- However, this is the one exception ... the GM waypoint +-- DO NOT REMOVE THIS FROM CORE REPO this is part of the core :) +-- Set Waypoint (Only GM can see it) so health is 1 from levels 1 - 80 +UPDATE `creature_template` SET `maxlevel`=80,`Health_mod`=0.0125 WHERE `entry`=1; +-- Set Waypoint (Only GM can see it) so it can also show altitude +UPDATE `creature_template` SET InhabitType=7 WHERE `entry`=1; diff --git a/sql/updates/3.2.2a_old/7040_world_spell_linked_spell.sql b/sql/updates/3.2.2a_old/7040_world_spell_linked_spell.sql new file mode 100644 index 0000000..1c857f0 --- /dev/null +++ b/sql/updates/3.2.2a_old/7040_world_spell_linked_spell.sql @@ -0,0 +1,4 @@ +-- cast s66747 (Totem of the Earthen Ring) after completing q14100 or q14111 (Relic of the Earthen Ring) +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=66744 AND `spell_effect`=66747; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(66744,66747,0, 'totem of the earthen ring'); diff --git a/sql/updates/3.2.2a_old/7053_world_script_texts.sql b/sql/updates/3.2.2a_old/7053_world_script_texts.sql new file mode 100644 index 0000000..10556df --- /dev/null +++ b/sql/updates/3.2.2a_old/7053_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE entry IN (-1000469,-1000470,-1000471); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (23861,-1000469,'It is too late for us, living one. Take yourself and your friend away from here before you both are... claimed...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (23861,-1000470,'Go away, whoever you are! Witch Hill is mine... mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), + (23861,-1000471,'It was... terrible... the demon...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''); diff --git a/sql/updates/3.2.2a_old/7054_world_script_texts.sql b/sql/updates/3.2.2a_old/7054_world_script_texts.sql new file mode 100644 index 0000000..5e6364a --- /dev/null +++ b/sql/updates/3.2.2a_old/7054_world_script_texts.sql @@ -0,0 +1,4 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1000472,-1000473); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (23864,-1000472,'This land was mine long before your wretched kind set foot here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (23864,-1000473,'All who venture here belong to me, including you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); diff --git a/sql/updates/3.2.2a_old/7054_world_scriptname.sql b/sql/updates/3.2.2a_old/7054_world_scriptname.sql new file mode 100644 index 0000000..9ac294e --- /dev/null +++ b/sql/updates/3.2.2a_old/7054_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_zelfrax' WHERE `entry`=23864; + diff --git a/sql/updates/3.2.2a_old/7059_world_spell_linked_spell.sql b/sql/updates/3.2.2a_old/7059_world_spell_linked_spell.sql new file mode 100644 index 0000000..6a57110 --- /dev/null +++ b/sql/updates/3.2.2a_old/7059_world_spell_linked_spell.sql @@ -0,0 +1,4 @@ +-- add spell trigger for teleport to acherus (quest 12757) +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=53099; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(53099,53098,0, 'trigger teleport to acherus (for quest 12757)'); diff --git a/sql/updates/3.2.2a_old/7060_world_scriptname.sql b/sql/updates/3.2.2a_old/7060_world_scriptname.sql new file mode 100644 index 0000000..452e4ed --- /dev/null +++ b/sql/updates/3.2.2a_old/7060_world_scriptname.sql @@ -0,0 +1,2 @@ +-- Argent Tournament Target Dummies +UPDATE `creature_template` SET `ScriptName`= 'npc_training_dummy' WHERE `entry` IN (33229,33243,33272); diff --git a/sql/updates/3.2.2a_old/7062_world_gossip_menu_option.sql b/sql/updates/3.2.2a_old/7062_world_gossip_menu_option.sql new file mode 100644 index 0000000..9b68d96 --- /dev/null +++ b/sql/updates/3.2.2a_old/7062_world_gossip_menu_option.sql @@ -0,0 +1,17 @@ +-- Converts GOSSIP_OPTION display text from Generic to English +-- Fixes some problems with GOSSIP_OPTION_OUTDOORPVP, the columns were shifted over one for some reason, seems to have been a typo. +UPDATE `gossip_menu_option` SET `option_text`= 'I want to travel fast' WHERE `option_text`= 'GOSSIP_OPTION_TAXIVENDOR'; +UPDATE `gossip_menu_option` SET `option_text`= 'I want to join the Battle Ground' WHERE `option_text`= 'GOSSIP_OPTION_BATTLEFIELD'; +UPDATE `gossip_menu_option` SET `option_text`= 'Bring me back to life' WHERE `option_text`= 'GOSSIP_OPTION_SPIRITGUIDE' OR `option_text`= 'GOSSIP_OPTION_SPIRITHEALER'; +UPDATE `gossip_menu_option` SET `option_text`= 'Make this inn my home' WHERE `option_text`= 'GOSSIP_OPTION_INNKEEPER'; +UPDATE `gossip_menu_option` SET `option_text`= 'Show me my bank' WHERE `option_text`= 'GOSSIP_OPTION_BANKER'; +UPDATE `gossip_menu_option` SET `option_text`= 'I''d like to stable my pet here' WHERE `option_text`= 'GOSSIP_OPTION_STABLEPET'; +UPDATE `gossip_menu_option` SET `option_text`= 'I want to create a guild crest' WHERE `option_text`= 'GOSSIP_OPTION_TABARDDESIGNER'; +UPDATE `gossip_menu_option` SET `option_text`= 'Auction!' WHERE `option_text`= 'GOSSIP_OPTION_AUCTIONEER'; +UPDATE `gossip_menu_option` SET `option_text`= 'Purchase a Dual Talent Specialization' WHERE `option_text`= 'GOSSIP_OPTION_LEARNDUALSPEC'; +UPDATE `gossip_menu_option` SET `option_text`= 'I wish to unlearn my pet''s skills' WHERE `option_text`= 'GOSSIP_OPTION_UNLEARNPETSKILLS'; +UPDATE `gossip_menu_option` SET `option_text`= 'I wish to unlearn my talents' WHERE `option_text`= 'GOSSIP_OPTION_UNLEARNTALENTS'; +UPDATE `gossip_menu_option` SET `option_text`= 'Train me!' WHERE `option_text`= 'GOSSIP_OPTION_TRAINER'; +UPDATE `gossip_menu_option` SET `option_text`= 'I want to browse your goods' WHERE `option_text`= 'GOSSIP_OPTION_VENDOR' OR `option_text`= 'GOSSIP_OPTION_ARMORER'; +UPDATE `gossip_menu_option` SET `option_text`= 'How do I form a guild?' WHERE `option_text`= 'GOSSIP_OPTION_PETITIONER'; +UPDATE `gossip_menu_option` SET `option_id`=19,`npc_option_npcflag`=536870912,`action_menu_id`=0 WHERE `option_text`= 'GOSSIP_OPTION_OUTDOORPVP'; diff --git a/sql/updates/3.2.2a_old/7090_world_scriptname.sql b/sql/updates/3.2.2a_old/7090_world_scriptname.sql new file mode 100644 index 0000000..7f6bf7c --- /dev/null +++ b/sql/updates/3.2.2a_old/7090_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `item_template` SET `ScriptName`='item_petrov_cluster_bombs' WHERE `entry`=33098; diff --git a/sql/updates/3.2.2a_old/7091_world_creature_template.sql b/sql/updates/3.2.2a_old/7091_world_creature_template.sql new file mode 100644 index 0000000..f542985 --- /dev/null +++ b/sql/updates/3.2.2a_old/7091_world_creature_template.sql @@ -0,0 +1,13 @@ +-- Usually creature_template changes MUST GO to TDB +-- creature_template spell1-spell8 are in the exceptions + +-- Unrelenting Trainee +UPDATE `creature_template` SET `spell1` = 55604, `spell8` = 27892 WHERE `entry` = 16124; +UPDATE `creature_template` SET `spell1` = 55645, `spell2` = 0, `spell8` = 27892 where `entry` = 29987; + +-- Unrelenting Death Knight +UPDATE `creature_template` SET `spell1` = 27825, `spell8` = 27928 WHERE `entry` IN (16125, 29985); + +-- Unrelenting Rider +UPDATE `creature_template` SET `spell1` = 27831, `spell2` = 55606, `spell8` = 27935 where `entry` = 16126; +UPDATE `creature_template` SET `spell1` = 55638, `spell2` = 55608, `spell8` = 27935 where `entry` = 29986; diff --git a/sql/updates/3.2.2a_old/7116_world_trinity_string.sql b/sql/updates/3.2.2a_old/7116_world_trinity_string.sql new file mode 100644 index 0000000..280e5e2 --- /dev/null +++ b/sql/updates/3.2.2a_old/7116_world_trinity_string.sql @@ -0,0 +1,2 @@ +-- Remove no longer uses entries from Wintergrasp +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 763 AND 770; diff --git a/sql/updates/3.2.2a_old/7117_world_trinity_string.sql b/sql/updates/3.2.2a_old/7117_world_trinity_string.sql new file mode 100644 index 0000000..832cb23 --- /dev/null +++ b/sql/updates/3.2.2a_old/7117_world_trinity_string.sql @@ -0,0 +1,2 @@ +-- Remove no longer uses entries from Wintergrasp +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 756 AND 772; diff --git a/sql/updates/3.2.2a_old/7118_characters_addons.sql b/sql/updates/3.2.2a_old/7118_characters_addons.sql new file mode 100644 index 0000000..ba857fd --- /dev/null +++ b/sql/updates/3.2.2a_old/7118_characters_addons.sql @@ -0,0 +1,6 @@ +DROP TABLE IF EXISTS `addons`; +CREATE TABLE `addons` ( + `name` varchar(120) NOT NULL default '', + `crc` mediumint(32) unsigned NOT NULL default '0', + PRIMARY KEY (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Addons'; diff --git a/sql/updates/3.2.2a_old/7128_world_command.sql b/sql/updates/3.2.2a_old/7128_world_command.sql new file mode 100644 index 0000000..958c3b5 --- /dev/null +++ b/sql/updates/3.2.2a_old/7128_world_command.sql @@ -0,0 +1,2 @@ +-- Remove Wintergrasp commands from command table +DELETE FROM `command` WHERE `name` LIKE '%wg%'; diff --git a/sql/updates/3.2.2a_old/7134_world_command.sql b/sql/updates/3.2.2a_old/7134_world_command.sql new file mode 100644 index 0000000..528e8d7 --- /dev/null +++ b/sql/updates/3.2.2a_old/7134_world_command.sql @@ -0,0 +1,10 @@ +DELETE FROM command where name IN ('character titles','modify titles','titles add','titles current','titles remove','lookup title'); + +INSERT INTO `command` (`name`, `security`, `help`) +VALUES +('character titles',2,'Syntax: .character titles [$player_name]\r\n\r\nShow known titles list for selected player or player find by $player_name.'), +('titles add',2,'Syntax: .titles add #title\r\nAdd title #title (id or shift-link) to known titles list for selected player.'), +('titles current',2,'Syntax: .titles current #title\r\nSet title #title (id or shift-link) as current selected titl for selected player. If title not in known title list for player then it will be added to list.'), +('titles remove',2,'Syntax: .titles remove #title\r\nRemove title #title (id or shift-link) from known titles list for selected player.'), +('titles setmask',2,'Syntax: .titles setmask #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'), +('lookup title',2,'Syntax: .lookup title $$namepart\r\n\r\nLooks up a title by $namepart, and returns all matches with their title ID\'s and index\'s.'); diff --git a/sql/updates/3.2.2a_old/7134_world_trinity_string.sql b/sql/updates/3.2.2a_old/7134_world_trinity_string.sql new file mode 100644 index 0000000..ea344c1 --- /dev/null +++ b/sql/updates/3.2.2a_old/7134_world_trinity_string.sql @@ -0,0 +1,12 @@ +DELETE FROM trinity_string WHERE entry in (349, 350, 351, 352, 353, 354, 355, 356); + +INSERT INTO trinity_string (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`) +VALUES + (349,'%d (idx:%d) - |cffffffff|Htitle:%d|h[%s %s]|h|r %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (350,'%d (idx:%d) - [%s %s] %s %s ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (351,'No titles found!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (352,'Invalid title id: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (353,'Title %u (%s) added to known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (354,'Title %u (%s) removed from known titles list for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (355,'Title %u (%s) set as current seelcted title for player %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), + (356,'Current selected title for player %s reset as not known now.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.2.2a_old/7147_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/7147_world_creature_classlevelstats.sql new file mode 100644 index 0000000..dff9eb8 --- /dev/null +++ b/sql/updates/3.2.2a_old/7147_world_creature_classlevelstats.sql @@ -0,0 +1,3 @@ +ALTER TABLE `creature_classlevelstats` +DROP COLUMN `basedmg`, +DROP COLUMN `baserangeddmg`; diff --git a/sql/updates/3.2.2a_old/7147_world_creature_template.sql b/sql/updates/3.2.2a_old/7147_world_creature_template.sql new file mode 100644 index 0000000..9c92fa0 --- /dev/null +++ b/sql/updates/3.2.2a_old/7147_world_creature_template.sql @@ -0,0 +1,9 @@ +ALTER TABLE `creature_template` +DROP COLUMN `dmg_Mod`, +DROP COLUMN `rangeddmg_Mod`, +ADD COLUMN `mindmg` float NOT NULL DEFAULT '0' AFTER `rank`, +ADD COLUMN `maxdmg` float NOT NULL DEFAULT '0' AFTER `mindmg`, +ADD COLUMN `attackpower` int(10) unsigned NOT NULL DEFAULT '0' AFTER `dmgschool`, +ADD COLUMN `minrangedmg` float NOT NULL DEFAULT '0' AFTER `trainer_race`, +ADD COLUMN `maxrangedmg` float NOT NULL DEFAULT '0' AFTER `minrangedmg`, +ADD COLUMN `rangedattackpower` smallint(5) unsigned NOT NULL DEFAULT '0' AFTER `maxrangedmg`; diff --git a/sql/updates/3.2.2a_old/7167_world_spell_stack_masks.sql b/sql/updates/3.2.2a_old/7167_world_spell_stack_masks.sql new file mode 100644 index 0000000..2e7d449 --- /dev/null +++ b/sql/updates/3.2.2a_old/7167_world_spell_stack_masks.sql @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS `spell_stack_masks`; + +CREATE TABLE `spell_stack_masks` ( + `id` int(32) unsigned NOT NULL default '0', + `mask` int(64) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.2.2a_old/7217_world_spell_proc_event.sql b/sql/updates/3.2.2a_old/7217_world_spell_proc_event.sql new file mode 100644 index 0000000..c189d5a --- /dev/null +++ b/sql/updates/3.2.2a_old/7217_world_spell_proc_event.sql @@ -0,0 +1,15 @@ +-- Entrapment +DELETE FROM `spell_proc_event` WHERE `entry` IN (19387,19388,19184); +INSERT INTO `spell_proc_event` +(`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +(19184,0x00,9,0x00000010,0x00002000,0x00000000,0x00000000,0x00000000,0,0,0), +(19387,0x00,9,0x00000010,0x00002000,0x00000000,0x00000000,0x00000000,0,0,0), +(19388,0x00,9,0x00000010,0x00002000,0x00000000,0x00000000,0x00000000,0,0,0); + +-- Lock and Load +DELETE FROM `spell_proc_event` WHERE `entry` IN (56342,56343,56344); +INSERT INTO `spell_proc_event` +(`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +(56342,0x00,9,0x00000018,0x08000000,0x00024000,0x00000000,0x00000000,0,0,0), +(56343,0x00,9,0x00000018,0x08000000,0x00024000,0x00000000,0x00000000,0,0,0), +(56344,0x00,9,0x00000018,0x08000000,0x00024000,0x00000000,0x00000000,0,0,0); diff --git a/sql/updates/3.2.2a_old/7229_world_scriptname.sql b/sql/updates/3.2.2a_old/7229_world_scriptname.sql new file mode 100644 index 0000000..c52d709 --- /dev/null +++ b/sql/updates/3.2.2a_old/7229_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='mob_erekem_guard' WHERE `entry`=29395; diff --git a/sql/updates/3.2.2a_old/7236_world_spell_ranks.sql b/sql/updates/3.2.2a_old/7236_world_spell_ranks.sql new file mode 100644 index 0000000..1c44ffe --- /dev/null +++ b/sql/updates/3.2.2a_old/7236_world_spell_ranks.sql @@ -0,0 +1,6905 @@ +DROP TABLE IF EXISTS `spell_ranks`; +CREATE TABLE `spell_ranks` ( + `first_spell_id` INT UNSIGNED NOT NULL DEFAULT 0, + `spell_id` INT UNSIGNED NOT NULL DEFAULT 0, + `rank` TINYINT UNSIGNED NOT NULL DEFAULT 0, + PRIMARY KEY (`first_spell_id`, `rank`), + UNIQUE (`spell_id`) +) ENGINE=MYISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Spell Rank Data'; + +INSERT INTO spell_ranks (`first_spell_id`, `spell_id`, `rank`) VALUES + -- Abomination's Might +(53137, 53137, 1), +(53137, 53138, 2), + -- Absolution +(33167, 33167, 1), +(33167, 33171, 2), +(33167, 33172, 3), + -- Acclimation +(49200, 49200, 1), +(49200, 50151, 2), +(49200, 50152, 3), + -- Acid Spit +(55749, 55749, 1), +(55749, 55750, 2), +(55749, 55751, 3), +(55749, 55752, 4), +(55749, 55753, 5), +(55749, 55754, 6), + -- Aftermath +(18119, 18119, 1), +(18119, 18120, 2), + -- Aggression +(18427, 18427, 1), +(18427, 18428, 2), +(18427, 18429, 3), +(18427, 61330, 4), +(18427, 61331, 5), + -- Agility +(8115, 8115, 1), +(8115, 8116, 2), +(8115, 8117, 3), +(8115, 12174, 4), +(8115, 33077, 5), +(8115, 43194, 6), +(8115, 58450, 7), +(8115, 58451, 8), + -- Aimed Shot +(19434, 19434, 1), +(19434, 20900, 2), +(19434, 20901, 3), +(19434, 20902, 4), +(19434, 20903, 5), +(19434, 20904, 6), +(19434, 27065, 7), +(19434, 49049, 8), +(19434, 49050, 9), + -- Alchemy +(2259, 2259, 1), +(2259, 3101, 2), +(2259, 3464, 3), +(2259, 11611, 4), +(2259, 28596, 5), +(2259, 51304, 6), + -- Ambush +(8676, 8676, 1), +(8676, 8724, 2), +(8676, 8725, 3), +(8676, 11267, 4), +(8676, 11268, 5), +(8676, 11269, 6), +(8676, 27441, 7), +(8676, 48689, 8), +(8676, 48690, 9), +(8676, 48691, 10), + -- Amplify Magic +(1267, 1267, 1), +(1267, 8456, 2), +(1267, 10171, 3), +(1267, 10172, 4), +(1267, 27397, 5), +(1267, 33947, 6), + -- Amplify Magic +(1008, 1008, 1), +(1008, 8455, 2), +(1008, 10169, 3), +(1008, 10170, 4), +(1008, 27130, 5), +(1008, 33946, 6), +(1008, 43017, 7), + -- Ancestral Awakening +(51556, 51556, 1), +(51556, 51557, 2), +(51556, 51558, 3), + -- Ancestral Fortitude +(16177, 16177, 1), +(16177, 16236, 2), +(16177, 16237, 3), + -- Ancestral Healing +(16176, 16176, 1), +(16176, 16235, 2), +(16176, 16240, 3), + -- Ancestral Knowledge +(17485, 17485, 1), +(17485, 17486, 2), +(17485, 17487, 3), +(17485, 17488, 4), +(17485, 17489, 5), + -- Ancestral Spirit +(2008, 2008, 1), +(2008, 20609, 2), +(2008, 20610, 3), +(2008, 20776, 4), +(2008, 20777, 5), +(2008, 25590, 6), +(2008, 49277, 7), + -- Anguish +(33704, 33704, 1), +(33704, 33705, 2), +(33704, 33706, 3), + -- Anguish +(33698, 33698, 1), +(33698, 33699, 2), +(33698, 33700, 3), +(33698, 47993, 4), + -- Animal Handler +(34453, 34453, 1), +(34453, 34454, 2), + -- Annihilation +(51468, 51468, 1), +(51468, 51472, 2), +(51468, 51473, 3), + -- Anticipation +(12297, 12297, 1), +(12297, 12750, 2), +(12297, 12751, 3), +(12297, 12752, 4), +(12297, 12753, 5), + -- Anticipation +(20096, 20096, 1), +(20096, 20097, 2), +(20096, 20098, 3), +(20096, 20099, 4), +(20096, 20100, 5), + -- Anticipation +(16254, 16254, 1), +(16254, 16271, 2), +(16254, 16272, 3), + -- Anticipation +(55129, 55129, 1), +(55129, 55130, 2), +(55129, 55131, 3), +(55129, 55132, 4), +(55129, 55133, 5), + -- Arcane Barrage +(44425, 44425, 1), +(44425, 44780, 2), +(44425, 44781, 3), + -- Arcane Blast +(30451, 30451, 1), +(30451, 42894, 2), +(30451, 42896, 3), +(30451, 42897, 4), + -- Arcane Brilliance +(23028, 23028, 1), +(23028, 27127, 2), +(23028, 43002, 3), + -- Arcane Concentration +(11213, 11213, 1), +(11213, 12574, 2), +(11213, 12575, 3), +(11213, 12576, 4), +(11213, 12577, 5), + -- Arcane Empowerment +(31579, 31579, 1), +(31579, 31582, 2), +(31579, 31583, 3), + -- Arcane Explosion +(1449, 1449, 1), +(1449, 8437, 2), +(1449, 8438, 3), +(1449, 8439, 4), +(1449, 10201, 5), +(1449, 10202, 6), +(1449, 27080, 7), +(1449, 27082, 8), +(1449, 42920, 9), +(1449, 42921, 10), + -- Arcane Flows +(44378, 44378, 1), +(44378, 44379, 2), + -- Arcane Focus +(11222, 11222, 1), +(11222, 12839, 2), +(11222, 12840, 3), + -- Arcane Fortitude +(28574, 28574, 1), +(28574, 54658, 2), +(28574, 54659, 3), + -- Arcane Instability +(15058, 15058, 1), +(15058, 15059, 2), +(15058, 15060, 3), + -- Arcane Intellect +(1459, 1459, 1), +(1459, 1460, 2), +(1459, 1461, 3), +(1459, 10156, 4), +(1459, 10157, 5), +(1459, 27126, 6), +(1459, 42995, 7), + -- Arcane Mastery +(16734, 16734, 1), +(16734, 16735, 2), +(16734, 16736, 3), +(16734, 16737, 4), +(16734, 16738, 5), + -- Arcane Meditation +(18462, 18462, 1), +(18462, 18463, 2), +(18462, 18464, 3), + -- Arcane Mind +(11232, 11232, 1), +(11232, 12500, 2), +(11232, 12501, 3), +(11232, 12502, 4), +(11232, 12503, 5), + -- Arcane Potency +(31571, 31571, 1), +(31571, 31572, 2), + -- Arcane Shielding +(11252, 11252, 1), +(11252, 12605, 2), + -- Arcane Shot +(3044, 3044, 1), +(3044, 14281, 2), +(3044, 14282, 3), +(3044, 14283, 4), +(3044, 14284, 5), +(3044, 14285, 6), +(3044, 14286, 7), +(3044, 14287, 8), +(3044, 27019, 9), +(3044, 49044, 10), +(3044, 49045, 11), + -- Arcane Stability +(11237, 11237, 1), +(11237, 12463, 2), +(11237, 12464, 3), +(11237, 16769, 4), +(11237, 16770, 5), + -- Arcane Subtlety +(11210, 11210, 1), +(11210, 12592, 2), + -- Arctic Reach +(16757, 16757, 1), +(16757, 16758, 2), + -- Arctic Winds +(31674, 31674, 1), +(31674, 31675, 2), +(31674, 31676, 3), +(31674, 31677, 4), +(31674, 31678, 5), + -- Ardent Defender +(31850, 31850, 1), +(31850, 31851, 2), +(31850, 31852, 3), + -- Armor +(8091, 8091, 1), +(8091, 8094, 2), +(8091, 8095, 3), +(8091, 12175, 4), +(8091, 33079, 5), +(8091, 43196, 6), +(8091, 58452, 7), +(8091, 58453, 8), + -- Armored to the Teeth +(61216, 61216, 1), +(61216, 61221, 2), +(61216, 61222, 3), + -- Aspect of the Dragonhawk +(61846, 61846, 1), +(61846, 61847, 2), + -- Aspect of the Hawk +(13165, 13165, 1), +(13165, 14318, 2), +(13165, 14319, 3), +(13165, 14320, 4), +(13165, 14321, 5), +(13165, 14322, 6), +(13165, 25296, 7), +(13165, 27044, 8), + -- Aspect of the Wild +(20043, 20043, 1), +(20043, 20190, 2), +(20043, 27045, 3), +(20043, 49071, 4), + -- Aspiration +(47507, 47507, 1), +(47507, 47508, 2), + -- Astral Shift +(51474, 51474, 1), +(51474, 51478, 2), +(51474, 51479, 3), + -- Avenger's Shield +(31935, 31935, 1), +(31935, 32699, 2), +(31935, 32700, 3), +(31935, 48826, 4), +(31935, 48827, 5), + -- Avoidance +(61680, 61680, 1), +(61680, 61681, 2), +(61680, 52858, 3), + -- Backdraft +(47258, 47258, 1), +(47258, 47259, 2), +(47258, 47260, 3), + -- Backlash +(34935, 34935, 1), +(34935, 34938, 2), +(34935, 34939, 3), + -- Backstab +(53, 53, 1), +(53, 2589, 2), +(53, 2590, 3), +(53, 2591, 4), +(53, 8721, 5), +(53, 11279, 6), +(53, 11280, 7), +(53, 11281, 8), +(53, 25300, 9), +(53, 26863, 10), +(53, 48656, 11), +(53, 48657, 12), + -- Bad Attitude +(50433, 50433, 1), +(50433, 52395, 2), +(50433, 52396, 3), +(50433, 52397, 4), +(50433, 52398, 5), +(50433, 52399, 6), + -- Balance of Power +(33592, 33592, 1), +(33592, 33596, 2), + -- Bane +(17788, 17788, 1), +(17788, 17789, 2), +(17788, 17790, 3), +(17788, 17791, 4), +(17788, 17792, 5), + -- Banish +(710, 710, 1), +(710, 18647, 2), + -- Barrage +(19461, 19461, 1), +(19461, 19462, 2), +(19461, 24691, 3), + -- Bash +(5211, 5211, 1), +(5211, 6798, 2), +(5211, 8983, 3), + -- Battle Shout +(6673, 6673, 1), +(6673, 5242, 2), +(6673, 6192, 3), +(6673, 11549, 4), +(6673, 11550, 5), +(6673, 11551, 6), +(6673, 25289, 7), +(6673, 2048, 8), +(6673, 47436, 9), + -- Benediction +(20101, 20101, 1), +(20101, 20102, 2), +(20101, 20103, 3), +(20101, 20104, 4), +(20101, 20105, 5), + -- Bestial Discipline +(19590, 19590, 1), +(19590, 19592, 2), + -- Bestial Fury +(19603, 19603, 1), +(19603, 19605, 2), +(19603, 19606, 3), +(19603, 19607, 4), +(19603, 19608, 5), + -- Binding Heal +(32546, 32546, 1), +(32546, 48119, 2), +(32546, 48120, 3), + -- Bite +(17254, 17254, 1), +(17254, 17262, 2), +(17254, 17263, 3), +(17254, 17264, 4), +(17254, 17265, 5), +(17254, 17266, 6), +(17254, 17267, 7), +(17254, 17268, 8), +(17254, 27348, 9), + -- Bite +(17253, 17253, 1), +(17253, 17255, 2), +(17253, 17256, 3), +(17253, 17257, 4), +(17253, 17258, 5), +(17253, 17259, 6), +(17253, 17260, 7), +(17253, 17261, 8), +(17253, 27050, 9), +(17253, 52473, 10), +(17253, 52474, 11), + -- Black Arrow +(3674, 3674, 1), +(3674, 63668, 2), +(3674, 63669, 3), +(3674, 63670, 4), +(3674, 63671, 5), +(3674, 63672, 6), + -- Black Ice +(49140, 49140, 1), +(49140, 49661, 2), +(49140, 49662, 3), +(49140, 49663, 4), +(49140, 49664, 5), + -- Blacksmithing +(2018, 2018, 1), +(2018, 3100, 2), +(2018, 3538, 3), +(2018, 9785, 4), +(2018, 29844, 5), +(2018, 51300, 6), + -- Blade Barrier +(51789, 51789, 1), +(51789, 64855, 2), +(51789, 64856, 3), +(51789, 64858, 4), +(51789, 64859, 5), + -- Blade Barrier +(49182, 49182, 1), +(49182, 49500, 2), +(49182, 49501, 3), +(49182, 55225, 4), +(49182, 55226, 5), + -- Blade Twisting +(31124, 31124, 1), +(31124, 31126, 2), + -- Bladed Armor +(48978, 48978, 1), +(48978, 49390, 2), +(48978, 49391, 3), +(48978, 49392, 4), +(48978, 49393, 5), + -- Blast Wave +(11113, 11113, 1), +(11113, 13018, 2), +(11113, 13019, 3), +(11113, 13020, 4), +(11113, 13021, 5), +(11113, 27133, 6), +(11113, 33933, 7), +(11113, 42944, 8), +(11113, 42945, 9), + -- Blazing Speed +(31641, 31641, 1), +(31641, 31642, 2), + -- Blessed Hands +(53660, 53660, 1), +(53660, 53661, 2), + -- Blessed Life +(31828, 31828, 1), +(31828, 31829, 2), +(31828, 31830, 3), + -- Blessing of Might +(19740, 19740, 1), +(19740, 19834, 2), +(19740, 19835, 3), +(19740, 19836, 4), +(19740, 19837, 5), +(19740, 19838, 6), +(19740, 25291, 7), +(19740, 27140, 8), +(19740, 48931, 9), +(19740, 48932, 10), + -- Blessing of the Eternals +(51554, 51554, 1), +(51554, 51555, 2), + -- Blessing of Wisdom +(19742, 19742, 1), +(19742, 19850, 2), +(19742, 19852, 3), +(19742, 19853, 4), +(19742, 19854, 5), +(19742, 25290, 6), +(19742, 27142, 7), +(19742, 48935, 8), +(19742, 48936, 9), + -- Blood Boil +(48721, 48721, 1), +(48721, 49939, 2), +(48721, 49940, 3), +(48721, 49941, 4), + -- Blood Craze +(16487, 16487, 1), +(16487, 16489, 2), +(16487, 16492, 3), + -- Blood Frenzy +(30069, 30069, 1), +(30069, 30070, 2), + -- Blood Frenzy +(29836, 29836, 1), +(29836, 29859, 2), + -- Blood Frenzy +(16952, 16952, 1), +(16952, 16954, 2), + -- Blood of Icewater +(50122, 50122, 1), +(50122, 50123, 2), +(50122, 50124, 3), +(50122, 50125, 4), +(50122, 50126, 5), + -- Blood of the North +(54639, 54639, 1), +(54639, 54638, 2), +(54639, 54637, 3), + -- Blood of the Rhino +(53481, 53481, 1), +(53481, 53482, 2), + -- Blood Pact +(6307, 6307, 1), +(6307, 7804, 2), +(6307, 7805, 3), +(6307, 11766, 4), +(6307, 11767, 5), +(6307, 27268, 6), +(6307, 47982, 7), + -- Blood Spatter +(51632, 51632, 1), +(51632, 51633, 2), + -- Blood-Caked Blade +(49219, 49219, 1), +(49219, 49627, 2), +(49219, 49628, 3), + -- Bloodsurge +(46913, 46913, 1), +(46913, 46914, 2), +(46913, 46915, 3), + -- Bloodthirsty +(53186, 53186, 1), +(53186, 53187, 2), + -- Bloodworms +(49027, 49027, 1), +(49027, 49542, 2), +(49027, 49543, 3), + -- Bloody Strikes +(48977, 48977, 1), +(48977, 49394, 2), +(48977, 49395, 3), + -- Bloody Vengeance +(48988, 48988, 1), +(48988, 49503, 2), +(48988, 49504, 3), + -- Body and Soul +(64127, 64127, 1), +(64127, 64129, 2), + -- Booming Echoes +(63370, 63370, 1), +(63370, 63372, 2), + -- Booming Voice +(12321, 12321, 1), +(12321, 12835, 2), + -- Borrowed Time +(52795, 52795, 1), +(52795, 52797, 2), +(52795, 52798, 3), +(52795, 52799, 4), +(52795, 52800, 5), + -- Brain Freeze +(44546, 44546, 1), +(44546, 44548, 2), +(44546, 44549, 3), + -- Brambles +(16836, 16836, 1), +(16836, 16839, 2), +(16836, 16840, 3), + -- Brutal Impact +(16940, 16940, 1), +(16940, 16941, 2), + -- Burning Determination +(54747, 54747, 1), +(54747, 54749, 2), + -- Burning Soul +(11083, 11083, 1), +(11083, 12351, 2), + -- Burnout +(44449, 44449, 1), +(44449, 44469, 2), +(44449, 44470, 3), +(44449, 44471, 4), +(44449, 44472, 5), + -- Butchery +(48979, 48979, 1), +(48979, 49483, 2), + -- Call of Flame +(16038, 16038, 1), +(16038, 16160, 2), +(16038, 16161, 3), + -- Camouflage +(13975, 13975, 1), +(13975, 14062, 2), +(13975, 14063, 3), + -- Careful Aim +(34482, 34482, 1), +(34482, 34483, 2), +(34482, 34484, 3), + -- Cataclysm +(17778, 17778, 1), +(17778, 17779, 2), +(17778, 17780, 3), + -- Catlike Reflexes +(34462, 34462, 1), +(34462, 34464, 2), +(34462, 34465, 3), + -- Celestial Focus +(16850, 16850, 1), +(16850, 16923, 2), +(16850, 16924, 3), + -- Chain Heal +(1064, 1064, 1), +(1064, 10622, 2), +(1064, 10623, 3), +(1064, 25422, 4), +(1064, 25423, 5), +(1064, 55458, 6), +(1064, 55459, 7), + -- Chaos Bolt +(50796, 50796, 1), +(50796, 59170, 2), +(50796, 59171, 3), +(50796, 59172, 4), + -- Charge +(100, 100, 1), +(100, 6178, 2), +(100, 11578, 3), + -- Charge Rage Bonus Effect +(12695, 12695, 1), +(12695, 12696, 2), + -- Cheat Death +(31228, 31228, 1), +(31228, 31229, 2), +(31228, 31230, 3), + -- Chilblains +(50040, 50040, 1), +(50040, 50041, 2), +(50040, 50043, 3), + -- Chill of the Grave +(49149, 49149, 1), +(49149, 50115, 2), + -- Chilled +(12484, 12484, 1), +(12484, 12485, 2), +(12484, 12486, 3), + -- Chilled to the Bone +(44566, 44566, 1), +(44566, 44567, 2), +(44566, 44568, 3), +(44566, 44570, 4), +(44566, 44571, 5), + -- Circle of Healing +(34861, 34861, 1), +(34861, 34863, 2), +(34861, 34864, 3), +(34861, 34865, 4), +(34861, 34866, 5), +(34861, 48088, 6), +(34861, 48089, 7), + -- Claw +(1082, 1082, 1), +(1082, 3029, 2), +(1082, 5201, 3), +(1082, 9849, 4), +(1082, 9850, 5), +(1082, 27000, 6), +(1082, 48569, 7), +(1082, 48570, 8), + -- Claw +(16827, 16827, 1), +(16827, 16828, 2), +(16827, 16829, 3), +(16827, 16830, 4), +(16827, 16831, 5), +(16827, 16832, 6), +(16827, 3010, 7), +(16827, 3009, 8), +(16827, 27049, 9), +(16827, 52471, 10), +(16827, 52472, 11), + -- Cleave +(30214, 30214, 1), +(30214, 30222, 2), +(30214, 30224, 3), + -- Cleave +(845, 845, 1), +(845, 7369, 2), +(845, 11608, 3), +(845, 11609, 4), +(845, 20569, 5), +(845, 25231, 6), +(845, 47519, 7), +(845, 47520, 8), + -- Cleave +(30213, 30213, 1), +(30213, 30219, 2), +(30213, 30223, 3), +(30213, 47994, 4), + -- Cleave Armor +(5508, 5508, 1), +(5508, 5480, 2), + -- Close Quarters Combat +(13706, 13706, 1), +(13706, 13804, 2), +(13706, 13805, 3), +(13706, 13806, 4), +(13706, 13807, 5), + -- Cobra Reflexes +(61682, 61682, 1), +(61682, 61683, 2), + -- Cobra Strikes +(53256, 53256, 1), +(53256, 53259, 2), +(53256, 53260, 3), + -- Cold as Ice +(55091, 55091, 1), +(55091, 55092, 2), + -- Combat Endurance +(17427, 17427, 1), +(17427, 17428, 2), +(17427, 17429, 3), + -- Combat Experience +(34475, 34475, 1), +(34475, 34476, 2), + -- Combat Expertise +(31858, 31858, 1), +(31858, 31859, 2), +(31858, 31860, 3), + -- Combat Potency +(35542, 35542, 1), +(35542, 35545, 2), +(35542, 35546, 3), +(35542, 35547, 4), +(35542, 35548, 5), + -- Combat Potency +(35541, 35541, 1), +(35541, 35550, 2), +(35541, 35551, 3), +(35541, 35552, 4), +(35541, 35553, 5), + -- Commanding Presence +(12318, 12318, 1), +(12318, 12857, 2), +(12318, 12858, 3), +(12318, 12860, 4), +(12318, 12861, 5), + -- Commanding Shout +(469, 469, 1), +(469, 47439, 2), +(469, 47440, 3), + -- Concussion +(16035, 16035, 1), +(16035, 16105, 2), +(16035, 16106, 3), +(16035, 16107, 4), +(16035, 16108, 5), + -- Concussive Barrage +(35100, 35100, 1), +(35100, 35102, 2), + -- Cone of Cold +(120, 120, 1), +(120, 8492, 2), +(120, 10159, 3), +(120, 10160, 4), +(120, 10161, 5), +(120, 27087, 6), +(120, 42930, 7), +(120, 42931, 8), + -- Conjure Food +(587, 587, 1), +(587, 597, 2), +(587, 990, 3), +(587, 6129, 4), +(587, 10144, 5), +(587, 10145, 6), +(587, 28612, 7), +(587, 33717, 8), + -- Conjure Mana Gem +(759, 759, 1), +(759, 3552, 2), +(759, 10053, 3), +(759, 10054, 4), +(759, 27101, 5), +(759, 42985, 6), + -- Conjure Refreshment +(42955, 42955, 1), +(42955, 42956, 2), + -- Conjure Water +(5504, 5504, 1), +(5504, 5505, 2), +(5504, 5506, 3), +(5504, 6127, 4), +(5504, 10138, 5), +(5504, 10139, 6), +(5504, 10140, 7), +(5504, 37420, 8), +(5504, 27090, 9), + -- Consecration +(26573, 26573, 1), +(26573, 20116, 2), +(26573, 20922, 3), +(26573, 20923, 4), +(26573, 20924, 5), +(26573, 27173, 6), +(26573, 48818, 7), +(26573, 48819, 8), + -- Consume Shadows +(17767, 17767, 1), +(17767, 17850, 2), +(17767, 17851, 3), +(17767, 17852, 4), +(17767, 17853, 5), +(17767, 17854, 6), +(17767, 27272, 7), +(17767, 47987, 8), +(17767, 47988, 9), + -- Contagion +(30060, 30060, 1), +(30060, 30061, 2), +(30060, 30062, 3), +(30060, 30063, 4), +(30060, 30064, 5), + -- Convection +(16039, 16039, 1), +(16039, 16109, 2), +(16039, 16110, 3), +(16039, 16111, 4), +(16039, 16112, 5), + -- Conviction +(20117, 20117, 1), +(20117, 20118, 2), +(20117, 20119, 3), +(20117, 20120, 4), +(20117, 20121, 5), + -- Cooking +(2550, 2550, 1), +(2550, 3102, 2), +(2550, 3413, 3), +(2550, 18260, 4), +(2550, 33359, 5), +(2550, 51296, 6), + -- Cornered +(52234, 52234, 1), +(52234, 53497, 2), + -- Corpse Explosion +(49158, 49158, 1), +(49158, 51325, 2), +(49158, 51326, 3), +(49158, 51327, 4), +(49158, 51328, 5), + -- Corruption +(172, 172, 1), +(172, 6222, 2), +(172, 6223, 3), +(172, 7648, 4), +(172, 11671, 5), +(172, 11672, 6), +(172, 25311, 7), +(172, 27216, 8), +(172, 47812, 9), +(172, 47813, 10), + -- Counterattack +(19306, 19306, 1), +(19306, 20909, 2), +(19306, 20910, 3), +(19306, 27067, 4), +(19306, 48998, 5), +(19306, 48999, 6), + -- Cower +(1747, 1747, 1), +(1747, 1748, 2), +(1747, 1749, 3), +(1747, 1750, 4), +(1747, 1751, 5), +(1747, 16698, 6), +(1747, 27346, 7), + -- Cower +(8998, 8998, 1), +(8998, 9000, 2), +(8998, 9892, 3), +(8998, 31709, 4), +(8998, 27004, 5), +(8998, 48575, 6), + -- Cower +(1742, 1742, 1), +(1742, 1753, 2), +(1742, 1754, 3), +(1742, 1755, 4), +(1742, 1756, 5), +(1742, 16697, 6), +(1742, 27048, 7), + -- Create Firestone +(6366, 6366, 1), +(6366, 17951, 2), +(6366, 17952, 3), +(6366, 17953, 4), +(6366, 27250, 5), +(6366, 60219, 6), +(6366, 60220, 7), + -- Create Healthstone +(6201, 6201, 1), +(6201, 6202, 2), +(6201, 5699, 3), +(6201, 11729, 4), +(6201, 11730, 5), +(6201, 27230, 6), +(6201, 47871, 7), +(6201, 47878, 8), + -- Create Soulstone +(693, 693, 1), +(693, 20752, 2), +(693, 20755, 3), +(693, 20756, 4), +(693, 20757, 5), +(693, 27238, 6), +(693, 47884, 7), + -- Create Spellstone +(2362, 2362, 1), +(2362, 17727, 2), +(2362, 17728, 3), +(2362, 28172, 4), +(2362, 47886, 5), +(2362, 47888, 6), + -- Critical Block +(47294, 47294, 1), +(47294, 47295, 2), +(47294, 47296, 3), + -- Critical Mass +(11115, 11115, 1), +(11115, 11367, 2), +(11115, 11368, 3), + -- Cruelty +(12320, 12320, 1), +(12320, 12852, 2), +(12320, 12853, 3), +(12320, 12855, 4), +(12320, 12856, 5), + -- Crusade +(31866, 31866, 1), +(31866, 31867, 2), +(31866, 31868, 3), + -- Crypt Fever +(49032, 49032, 1), +(49032, 49631, 2), +(49032, 49632, 3), + -- Curse of Agony +(980, 980, 1), +(980, 1014, 2), +(980, 6217, 3), +(980, 11711, 4), +(980, 11712, 5), +(980, 11713, 6), +(980, 27218, 7), +(980, 47863, 8), +(980, 47864, 9), + -- Curse of Doom +(603, 603, 1), +(603, 30910, 2), +(603, 47867, 3), + -- Curse of the Elements +(1490, 1490, 1), +(1490, 11721, 2), +(1490, 11722, 3), +(1490, 27228, 4), +(1490, 47865, 5), + -- Curse of Tongues +(1714, 1714, 1), +(1714, 11719, 2), + -- Curse of Weakness +(702, 702, 1), +(702, 1108, 2), +(702, 6205, 3), +(702, 7646, 4), +(702, 11707, 5), +(702, 11708, 6), +(702, 27224, 7), +(702, 30909, 8), +(702, 50511, 9), + -- Cut to the Chase +(51664, 51664, 1), +(51664, 51665, 2), +(51664, 51667, 3), +(51664, 51668, 4), +(51664, 51669, 5), + -- Damage Shield +(58872, 58872, 1), +(58872, 58874, 2), + -- Dampen Magic +(1266, 1266, 1), +(1266, 8452, 2), +(1266, 8453, 3), +(1266, 10175, 4), +(1266, 10176, 5), + -- Dampen Magic +(604, 604, 1), +(604, 8450, 2), +(604, 8451, 3), +(604, 10173, 4), +(604, 10174, 5), +(604, 33944, 6), +(604, 43015, 7), + -- Dark Conviction +(48987, 48987, 1), +(48987, 49477, 2), +(48987, 49478, 3), +(48987, 49479, 4), +(48987, 49480, 5), + -- Dark Pact +(18220, 18220, 1), +(18220, 18937, 2), +(18220, 18938, 3), +(18220, 27265, 4), +(18220, 59092, 5), + -- Darkness +(15259, 15259, 1), +(15259, 15307, 2), +(15259, 15308, 3), +(15259, 15309, 4), +(15259, 15310, 5), + -- Dash +(1850, 1850, 1), +(1850, 9821, 2), +(1850, 33357, 3), + -- Deadened Nerves +(31380, 31380, 1), +(31380, 31382, 2), +(31380, 31383, 3), + -- Deadliness +(30902, 30902, 1), +(30902, 30903, 2), +(30902, 30904, 3), +(30902, 30905, 4), +(30902, 30906, 5), + -- Deadly Brew +(51625, 51625, 1), +(51625, 51626, 2), + -- Deadly Throw +(26679, 26679, 1), +(26679, 48673, 2), +(26679, 48674, 3), + -- Death and Decay +(43265, 43265, 1), +(43265, 49936, 2), +(43265, 49937, 3), +(43265, 49938, 4), + -- Death Coil +(6789, 6789, 1), +(6789, 17925, 2), +(6789, 17926, 3), +(6789, 27223, 4), +(6789, 47859, 5), +(6789, 47860, 6), + -- Death Coil +(62900, 62900, 1), +(62900, 62901, 2), +(62900, 62902, 3), +(62900, 62903, 4), +(62900, 62904, 5), + -- Death Strike +(49998, 49998, 1), +(49998, 49999, 2), +(49998, 45463, 3), +(49998, 49923, 4), +(49998, 49924, 5), + -- Death's Embrace +(47198, 47198, 1), +(47198, 47199, 2), +(47198, 47200, 3), + -- Decimation +(63156, 63156, 1), +(63156, 63158, 2), + -- Deep Wounds +(12162, 12162, 1), +(12162, 12850, 2), +(12162, 12868, 3), + -- Deep Wounds +(12834, 12834, 1), +(12834, 12849, 2), +(12834, 12867, 3), + -- Defensive Tactics +(29559, 29559, 1), +(29559, 29588, 2), +(29559, 29589, 3), + -- Defiance +(12303, 12303, 1), +(12303, 12788, 2), +(12303, 12789, 3), + -- Deflection +(16462, 16462, 1), +(16462, 16463, 2), +(16462, 16464, 3), +(16462, 16465, 4), +(16462, 16466, 5), + -- Deflection +(13713, 13713, 1), +(13713, 13853, 2), +(13713, 13854, 3), + -- Deflection +(19295, 19295, 1), +(19295, 19297, 2), +(19295, 19298, 3), + -- Deflection +(20060, 20060, 1), +(20060, 20061, 2), +(20060, 20062, 3), +(20060, 20063, 4), +(20060, 20064, 5), + -- Demon Armor +(706, 706, 1), +(706, 1086, 2), +(706, 11733, 3), +(706, 11734, 4), +(706, 11735, 5), +(706, 27260, 6), +(706, 47793, 7), +(706, 47889, 8), + -- Demon Skin +(687, 687, 1), +(687, 696, 2), + -- Demonic Aegis +(30143, 30143, 1), +(30143, 30144, 2), +(30143, 30145, 3), + -- Demonic Brutality +(18705, 18705, 1), +(18705, 18706, 2), +(18705, 18707, 3), + -- Demonic Embrace +(18697, 18697, 1), +(18697, 18698, 2), +(18697, 18699, 3), + -- Demonic Knowledge +(35691, 35691, 1), +(35691, 35692, 2), +(35691, 35693, 3), + -- Demonic Pact +(47236, 47236, 1), +(47236, 47237, 2), +(47236, 47238, 3), +(47236, 47239, 4), +(47236, 47240, 5), + -- Demonic Power +(18126, 18126, 1), +(18126, 18127, 2), + -- Demonic Resilience +(30319, 30319, 1), +(30319, 30320, 2), +(30319, 30321, 3), + -- Demonic Tactics +(30242, 30242, 1), +(30242, 30245, 2), +(30242, 30246, 3), +(30242, 30247, 4), +(30242, 30248, 5), + -- Demoralizing Roar +(99, 99, 1), +(99, 1735, 2), +(99, 9490, 3), +(99, 9747, 4), +(99, 9898, 5), +(99, 26998, 6), +(99, 48559, 7), +(99, 48560, 8), + -- Demoralizing Screech +(24424, 24424, 1), +(24424, 24580, 2), +(24424, 24581, 3), +(24424, 24582, 4), +(24424, 27349, 5), + -- Demoralizing Screech +(24423, 24423, 1), +(24423, 24577, 2), +(24423, 24578, 3), +(24423, 24579, 4), +(24423, 27051, 5), +(24423, 55487, 6), + -- Demoralizing Shout +(1160, 1160, 1), +(1160, 6190, 2), +(1160, 11554, 3), +(1160, 11555, 4), +(1160, 11556, 5), +(1160, 25202, 6), +(1160, 25203, 7), +(1160, 47437, 8), + -- Desperate Prayer +(19236, 19236, 1), +(19236, 19238, 2), +(19236, 19240, 3), +(19236, 19241, 4), +(19236, 19242, 5), +(19236, 19243, 6), +(19236, 25437, 7), +(19236, 48172, 8), +(19236, 48173, 9), + -- Destructive Reach +(17917, 17917, 1), +(17917, 17918, 2), + -- Destructive Soul +(30251, 30251, 1), +(30251, 30256, 2), + -- Devastate +(20243, 20243, 1), +(20243, 30016, 2), +(20243, 30022, 3), +(20243, 47497, 4), +(20243, 47498, 5), + -- Devotion Aura +(465, 465, 1), +(465, 10290, 2), +(465, 643, 3), +(465, 10291, 4), +(465, 1032, 5), +(465, 10292, 6), +(465, 10293, 7), +(465, 27149, 8), +(465, 48941, 9), +(465, 48942, 10), + -- Devour Magic +(19505, 19505, 1), +(19505, 19731, 2), +(19505, 19734, 3), +(19505, 19736, 4), +(19505, 27276, 5), +(19505, 27277, 6), +(19505, 48011, 7), + -- Devouring Plague +(2944, 2944, 1), +(2944, 19276, 2), +(2944, 19277, 3), +(2944, 19278, 4), +(2944, 19279, 5), +(2944, 19280, 6), +(2944, 25467, 7), +(2944, 48299, 8), +(2944, 48300, 9), + -- Dirge +(49223, 49223, 1), +(49223, 49599, 2), + -- Dirty Deeds +(14082, 14082, 1), +(14082, 14083, 2), + -- Dirty Tricks +(14076, 14076, 1), +(14076, 14094, 2), + -- Dispel Magic +(527, 527, 1), +(527, 988, 2), + -- Displacement +(34478, 34478, 1), +(34478, 34479, 2), +(34478, 34481, 3), + -- Dive +(23146, 23146, 1), +(23146, 23149, 2), +(23146, 23150, 3), + -- Divine Aegis +(47509, 47509, 1), +(47509, 47511, 2), +(47509, 47515, 3), + -- Divine Fury +(18530, 18530, 1), +(18530, 18531, 2), +(18530, 18533, 3), +(18530, 18534, 4), +(18530, 18535, 5), + -- Divine Guardian +(53527, 53527, 1), +(53527, 53530, 2), + -- Divine Intellect +(20257, 20257, 1), +(20257, 20258, 2), +(20257, 20259, 3), +(20257, 20260, 4), +(20257, 20261, 5), + -- Divine Providence +(47562, 47562, 1), +(47562, 47564, 2), +(47562, 47565, 3), +(47562, 47566, 4), +(47562, 47567, 5), + -- Divine Purpose +(31871, 31871, 1), +(31871, 31872, 2), + -- Divine Spirit +(14752, 14752, 1), +(14752, 14818, 2), +(14752, 14819, 3), +(14752, 27841, 4), +(14752, 25312, 5), +(14752, 48073, 6), + -- Divine Strength +(20262, 20262, 1), +(20262, 20263, 2), +(20262, 20264, 3), +(20262, 20265, 4), +(20262, 20266, 5), + -- Divinity +(63646, 63646, 1), +(63646, 63647, 2), +(63646, 63648, 3), +(63646, 63649, 4), +(63646, 63650, 5), + -- Dragon's Breath +(31661, 31661, 1), +(31661, 33041, 2), +(31661, 33042, 3), +(31661, 33043, 4), +(31661, 42949, 5), +(31661, 42950, 6), + -- Drain Life +(689, 689, 1), +(689, 699, 2), +(689, 709, 3), +(689, 7651, 4), +(689, 11699, 5), +(689, 11700, 6), +(689, 27219, 7), +(689, 27220, 8), +(689, 47857, 9), + -- Drain Soul +(1120, 1120, 1), +(1120, 8288, 2), +(1120, 8289, 3), +(1120, 11675, 4), +(1120, 27217, 5), +(1120, 47855, 6), + -- Dreamstate +(33597, 33597, 1), +(33597, 33599, 2), +(33597, 33956, 3), + -- Dual Wield Specialization +(13715, 13715, 1), +(13715, 13848, 2), +(13715, 13849, 3), +(13715, 13851, 4), +(13715, 13852, 5), + -- Dual Wield Specialization +(23584, 23584, 1), +(23584, 23585, 2), +(23584, 23586, 3), +(23584, 23587, 4), +(23584, 23588, 5), + -- Dual Wield Specialization +(30816, 30816, 1), +(30816, 30818, 2), +(30816, 30819, 3), + -- Earth and Moon +(48506, 48506, 1), +(48506, 48510, 2), +(48506, 48511, 3), + -- Earth Shield +(974, 974, 1), +(974, 32593, 2), +(974, 32594, 3), +(974, 49283, 4), +(974, 49284, 5), + -- Earth Shock +(8042, 8042, 1), +(8042, 8044, 2), +(8042, 8045, 3), +(8042, 8046, 4), +(8042, 10412, 5), +(8042, 10413, 6), +(8042, 10414, 7), +(8042, 25454, 8), +(8042, 49230, 9), +(8042, 49231, 10), + -- Earthen Power +(51523, 51523, 1), +(51523, 51524, 2), + -- Earthliving +(51945, 51945, 1), +(51945, 51990, 2), +(51945, 51997, 3), +(51945, 51998, 4), +(51945, 51999, 5), +(51945, 52000, 6), + -- Earthliving Weapon +(51730, 51730, 1), +(51730, 51988, 2), +(51730, 51991, 3), +(51730, 51992, 4), +(51730, 51993, 5), +(51730, 51994, 6), + -- Earthliving Weapon (Passive) +(51940, 51940, 1), +(51940, 51989, 2), +(51940, 52004, 3), +(51940, 52005, 4), +(51940, 52007, 5), +(51940, 52008, 6), + -- Earth's Grasp +(16043, 16043, 1), +(16043, 16130, 2), + -- Ebon Plaguebringer +(51099, 51099, 1), +(51099, 51160, 2), +(51099, 51161, 3), + -- Eclipse +(48516, 48516, 1), +(48516, 48521, 2), +(48516, 48525, 3), + -- Efficiency +(19416, 19416, 1), +(19416, 19417, 2), +(19416, 19418, 3), +(19416, 19419, 4), +(19416, 19420, 5), + -- Elemental Absorption +(30701, 30701, 1), +(30701, 30702, 2), +(30701, 30703, 3), +(30701, 30704, 4), +(30701, 30705, 5), + -- Elemental Oath +(51466, 51466, 1), +(51466, 51470, 2), + -- Elemental Precision +(30672, 30672, 1), +(30672, 30673, 2), +(30672, 30674, 3), + -- Elemental Reach +(28999, 28999, 1), +(28999, 29000, 2), + -- Elemental Shields +(30669, 30669, 1), +(30669, 30670, 2), +(30669, 30671, 3), + -- Elemental Warding +(28996, 28996, 1), +(28996, 28997, 2), +(28996, 28998, 3), + -- Elemental Weapons +(16266, 16266, 1), +(16266, 29079, 2), +(16266, 29080, 3), + -- Elusiveness +(13981, 13981, 1), +(13981, 14066, 2), + -- Emberstorm +(17954, 17954, 1), +(17954, 17955, 2), +(17954, 17956, 3), +(17954, 17957, 4), +(17954, 17958, 5), + -- Empowered Corruption +(32381, 32381, 1), +(32381, 32382, 2), +(32381, 32383, 3), + -- Empowered Fire +(31656, 31656, 1), +(31656, 31657, 2), +(31656, 31658, 3), + -- Empowered Frostbolt +(31682, 31682, 1), +(31682, 31683, 2), + -- Empowered Healing +(33158, 33158, 1), +(33158, 33159, 2), +(33158, 33160, 3), +(33158, 33161, 4), +(33158, 33162, 5), + -- Empowered Imp +(47220, 47220, 1), +(47220, 47221, 2), +(47220, 47223, 3), + -- Empowered Rejuvenation +(33886, 33886, 1), +(33886, 33887, 2), +(33886, 33888, 3), +(33886, 33889, 4), +(33886, 33890, 5), + -- Empowered Renew +(63534, 63534, 1), +(63534, 63542, 2), +(63534, 63543, 3), + -- Empowered Touch +(33879, 33879, 1), +(33879, 33880, 2), + -- Enchanting +(7411, 7411, 1), +(7411, 7412, 2), +(7411, 7413, 3), +(7411, 13920, 4), +(7411, 28029, 5), +(7411, 51313, 6), + -- Endless Winter +(49137, 49137, 1), +(49137, 49657, 2), + -- Endurance +(13742, 13742, 1), +(13742, 13872, 2), + -- Endurance Training +(19583, 19583, 1), +(19583, 19584, 2), +(19583, 19585, 3), +(19583, 19586, 4), +(19583, 19587, 5), + -- Enduring Winter +(44557, 44557, 1), +(44557, 44560, 2), +(44557, 44561, 3), + -- Engineering +(4036, 4036, 1), +(4036, 4037, 2), +(4036, 4038, 3), +(4036, 12656, 4), +(4036, 30350, 5), +(4036, 51306, 6), + -- Enhancing Totems +(16259, 16259, 1), +(16259, 16295, 2), +(16259, 52456, 3), + -- Enlightened Judgements +(53556, 53556, 1), +(53556, 53557, 2), + -- Enlightenment +(34908, 34908, 1), +(34908, 34909, 2), +(34908, 34910, 3), + -- Enrage +(12317, 12317, 1), +(12317, 13045, 2), +(12317, 13046, 3), +(12317, 13047, 4), +(12317, 13048, 5), + -- Enslave Demon +(1098, 1098, 1), +(1098, 11725, 2), +(1098, 11726, 3), +(1098, 61191, 4), + -- Entangling Roots +(339, 339, 1), +(339, 1062, 2), +(339, 5195, 3), +(339, 5196, 4), +(339, 9852, 5), +(339, 9853, 6), +(339, 26989, 7), +(339, 53308, 8), + -- Entrapment +(19184, 19184, 1), +(19184, 19387, 2), +(19184, 19388, 3), + -- Enveloping Shadows +(31211, 31211, 1), +(31211, 31212, 2), +(31211, 31213, 3), + -- Envenom +(32645, 32645, 1), +(32645, 32684, 2), +(32645, 57992, 3), +(32645, 57993, 4), + -- Epidemic +(49036, 49036, 1), +(49036, 49562, 2), + -- Eradication +(47195, 47195, 1), +(47195, 47196, 2), +(47195, 47197, 3), + -- Evasion +(5277, 5277, 1), +(5277, 26669, 2), + -- Everlasting Affliction +(47201, 47201, 1), +(47201, 47202, 2), +(47201, 47203, 3), +(47201, 47204, 4), +(47201, 47205, 5), + -- Eviscerate +(2098, 2098, 1), +(2098, 6760, 2), +(2098, 6761, 3), +(2098, 6762, 4), +(2098, 8623, 5), +(2098, 8624, 6), +(2098, 11299, 7), +(2098, 11300, 8), +(2098, 31016, 9), +(2098, 26865, 10), +(2098, 48667, 11), +(2098, 48668, 12), + -- Execute +(5308, 5308, 1), +(5308, 20658, 2), +(5308, 20660, 3), +(5308, 20661, 4), +(5308, 20662, 5), +(5308, 25234, 6), +(5308, 25236, 7), +(5308, 47470, 8), +(5308, 47471, 9), + -- Exorcism +(879, 879, 1), +(879, 5614, 2), +(879, 5615, 3), +(879, 10312, 4), +(879, 10313, 5), +(879, 10314, 6), +(879, 27138, 7), +(879, 48800, 8), +(879, 48801, 9), + -- Explosive Shot +(53301, 53301, 1), +(53301, 60051, 2), +(53301, 60052, 3), +(53301, 60053, 4), + -- Explosive Trap +(13813, 13813, 1), +(13813, 14316, 2), +(13813, 14317, 3), +(13813, 27025, 4), +(13813, 49066, 5), +(13813, 49067, 6), + -- Explosive Trap Effect +(13812, 13812, 1), +(13812, 14314, 2), +(13812, 14315, 3), +(13812, 27026, 4), +(13812, 49064, 5), +(13812, 49065, 6), + -- Expose Weakness +(34500, 34500, 1), +(34500, 34502, 2), +(34500, 34503, 3), + -- Eye of the Storm +(29062, 29062, 1), +(29062, 29064, 2), +(29062, 29065, 3), + -- Faerie Fire +(13424, 13424, 1), +(13424, 13752, 2), + -- Fanaticism +(31879, 31879, 1), +(31879, 31880, 2), +(31879, 31881, 3), + -- Fear +(5782, 5782, 1), +(5782, 6213, 2), +(5782, 6215, 3), + -- Feeding Frenzy +(60096, 60096, 1), +(60096, 60097, 2), + -- Feeding Frenzy +(53511, 53511, 1), +(53511, 53512, 2), + -- Feint +(1966, 1966, 1), +(1966, 6768, 2), +(1966, 8637, 3), +(1966, 11303, 4), +(1966, 25302, 5), +(1966, 27448, 6), +(1966, 48658, 7), +(1966, 48659, 8), + -- Fel Armor +(28176, 28176, 1), +(28176, 28189, 2), +(28176, 47892, 3), +(28176, 47893, 4), + -- Fel Concentration +(17783, 17783, 1), +(17783, 17784, 2), +(17783, 17785, 3), + -- Fel Intelligence +(54424, 54424, 1), +(54424, 57564, 2), +(54424, 57565, 3), +(54424, 57566, 4), +(54424, 57567, 5), + -- Fel Synergy +(47230, 47230, 1), +(47230, 47231, 2), + -- Fel Vitality +(18731, 18731, 1), +(18731, 18743, 2), +(18731, 18744, 3), + -- Feral Aggression +(16858, 16858, 1), +(16858, 16859, 2), +(16858, 16860, 3), +(16858, 16861, 4), +(16858, 16862, 5), + -- Feral Instinct +(16947, 16947, 1), +(16947, 16948, 2), +(16947, 16949, 3), + -- Ferocious Bite +(22568, 22568, 1), +(22568, 22827, 2), +(22568, 22828, 3), +(22568, 22829, 4), +(22568, 31018, 5), +(22568, 24248, 6), +(22568, 48576, 7), +(22568, 48577, 8), + -- Ferocious Dead +(49038, 49038, 1), +(49038, 49595, 2), +(49038, 49596, 3), + -- Ferocious Inspiration +(34455, 34455, 1), +(34455, 34459, 2), +(34455, 34460, 3), + -- Ferocity +(19598, 19598, 1), +(19598, 19599, 2), +(19598, 19600, 3), +(19598, 19601, 4), +(19598, 19602, 5), + -- Ferocity +(16934, 16934, 1), +(16934, 16935, 2), +(16934, 16936, 3), +(16934, 16937, 4), +(16934, 16938, 5), + -- Filthy Tricks +(58414, 58414, 1), +(58414, 58415, 2), + -- Find Weakness +(31234, 31234, 1), +(31234, 31235, 2), +(31234, 31236, 3), + -- Fingers of Frost +(44543, 44543, 1), +(44543, 44545, 2), + -- Fire and Brimstone +(47266, 47266, 1), +(47266, 47267, 2), +(47266, 47268, 3), +(47266, 47269, 4), +(47266, 47270, 5), + -- Fire Blast +(2141, 2141, 1), +(2141, 2142, 2), +(2141, 2143, 3), +(2141, 8414, 4), +(2141, 8415, 5), +(2141, 10198, 6), +(2141, 10200, 7), +(2141, 27378, 8), +(2141, 27379, 9), + -- Fire Blast +(2136, 2136, 1), +(2136, 2137, 2), +(2136, 2138, 3), +(2136, 8412, 4), +(2136, 8413, 5), +(2136, 10197, 6), +(2136, 10199, 7), +(2136, 27078, 8), +(2136, 27079, 9), +(2136, 42872, 10), +(2136, 42873, 11), + -- Fire Breath +(34889, 34889, 1), +(34889, 35323, 2), +(34889, 55482, 3), +(34889, 55483, 4), +(34889, 55484, 5), +(34889, 55485, 6), + -- Fire Nova Totem +(1535, 1535, 1), +(1535, 8498, 2), +(1535, 8499, 3), +(1535, 11314, 4), +(1535, 11315, 5), +(1535, 25546, 6), +(1535, 25547, 7), +(1535, 61649, 8), +(1535, 61657, 9), + -- Fire Power +(11124, 11124, 1), +(11124, 12378, 2), +(11124, 12398, 3), +(11124, 12399, 4), +(11124, 12400, 5), + -- Fire Resistance Aura +(19891, 19891, 1), +(19891, 19899, 2), +(19891, 19900, 3), +(19891, 27153, 4), +(19891, 48947, 5), + -- Fire Resistance Totem +(8184, 8184, 1), +(8184, 10537, 2), +(8184, 10538, 3), +(8184, 25563, 4), +(8184, 58737, 5), +(8184, 58739, 6), + -- Fire Shield +(2947, 2947, 1), +(2947, 8316, 2), +(2947, 8317, 3), +(2947, 11770, 4), +(2947, 11771, 5), +(2947, 27269, 6), +(2947, 47983, 7), + -- Fire Shot +(3011, 3011, 1), +(3011, 6979, 2), +(3011, 6980, 3), + -- Fire Ward +(1035, 1035, 1), +(1035, 8459, 2), +(1035, 8460, 3), +(1035, 10224, 4), +(1035, 10226, 5), +(1035, 27395, 6), + -- Fire Ward +(543, 543, 1), +(543, 8457, 2), +(543, 8458, 3), +(543, 10223, 4), +(543, 10225, 5), +(543, 27128, 6), +(543, 43010, 7), + -- Fireball +(133, 133, 1), +(133, 143, 2), +(133, 145, 3), +(133, 3140, 4), +(133, 8400, 5), +(133, 8401, 6), +(133, 8402, 7), +(133, 10148, 8), +(133, 10149, 9), +(133, 10150, 10), +(133, 10151, 11), +(133, 25306, 12), +(133, 27070, 13), +(133, 38692, 14), +(133, 42832, 15), +(133, 42833, 16), + -- Firebolt +(3110, 3110, 1), +(3110, 7799, 2), +(3110, 7800, 3), +(3110, 7801, 4), +(3110, 7802, 5), +(3110, 11762, 6), +(3110, 11763, 7), +(3110, 27267, 8), +(3110, 47964, 9), + -- Firestarter +(44442, 44442, 1), +(44442, 44443, 2), + -- First Aid +(3273, 3273, 1), +(3273, 3274, 2), +(3273, 7924, 3), +(3273, 10846, 4), +(3273, 27028, 5), +(3273, 45542, 6), + -- Flame Shock +(8050, 8050, 1), +(8050, 8052, 2), +(8050, 8053, 3), +(8050, 10447, 4), +(8050, 10448, 5), +(8050, 29228, 6), +(8050, 25457, 7), +(8050, 49232, 8), +(8050, 49233, 9), + -- Flame Throwing +(11100, 11100, 1), +(11100, 12353, 2), + -- Flamestrike +(2124, 2124, 1), +(2124, 2125, 2), +(2124, 8425, 3), +(2124, 8426, 4), +(2124, 10217, 5), +(2124, 10218, 6), +(2124, 27385, 7), + -- Flamestrike +(2120, 2120, 1), +(2120, 2121, 2), +(2120, 8422, 3), +(2120, 8423, 4), +(2120, 10215, 5), +(2120, 10216, 6), +(2120, 27086, 7), +(2120, 42925, 8), +(2120, 42926, 9), + -- Flametongue Totem +(52109, 52109, 1), +(52109, 52110, 2), +(52109, 52111, 3), +(52109, 52112, 4), +(52109, 52113, 5), +(52109, 58651, 6), +(52109, 58654, 7), +(52109, 58655, 8), + -- Flametongue Totem +(8227, 8227, 1), +(8227, 8249, 2), +(8227, 10526, 3), +(8227, 16387, 4), +(8227, 25557, 5), +(8227, 58649, 6), +(8227, 58652, 7), +(8227, 58656, 8), + -- Flametongue Weapon +(8024, 8024, 1), +(8024, 8027, 2), +(8024, 8030, 3), +(8024, 16339, 4), +(8024, 16341, 5), +(8024, 16342, 6), +(8024, 25489, 7), +(8024, 58785, 8), +(8024, 58789, 9), +(8024, 58790, 10), + -- Flametongue Weapon (Passive) +(10400, 10400, 1), +(10400, 15567, 2), +(10400, 15568, 3), +(10400, 15569, 4), +(10400, 16311, 5), +(10400, 16312, 6), +(10400, 16313, 7), +(10400, 58784, 8), +(10400, 58791, 9), +(10400, 58792, 10), + -- Flametongue Weapon Proc +(8026, 8026, 1), +(8026, 8028, 2), +(8026, 8029, 3), +(8026, 10445, 4), +(8026, 16343, 5), +(8026, 16344, 6), +(8026, 25488, 7), +(8026, 58786, 8), +(8026, 58787, 9), +(8026, 58788, 10), + -- Flash Heal +(2061, 2061, 1), +(2061, 9472, 2), +(2061, 9473, 3), +(2061, 9474, 4), +(2061, 10915, 5), +(2061, 10916, 6), +(2061, 10917, 7), +(2061, 25233, 8), +(2061, 25235, 9), +(2061, 48070, 10), +(2061, 48071, 11), + -- Flash of Light +(19750, 19750, 1), +(19750, 19939, 2), +(19750, 19940, 3), +(19750, 19941, 4), +(19750, 19942, 5), +(19750, 19943, 6), +(19750, 27137, 7), +(19750, 48784, 8), +(19750, 48785, 9), + -- Fleet Footed +(31208, 31208, 1), +(31208, 31209, 2), + -- Flurry +(16257, 16257, 1), +(16257, 16277, 2), +(16257, 16278, 3), +(16257, 16279, 4), +(16257, 16280, 5), + -- Flurry +(16256, 16256, 1), +(16256, 16281, 2), +(16256, 16282, 3), +(16256, 16283, 4), +(16256, 16284, 5), + -- Focused Aim +(53620, 53620, 1), +(53620, 53621, 2), +(53620, 53622, 3), + -- Focused Attacks +(51634, 51634, 1), +(51634, 51635, 2), +(51634, 51636, 3), + -- Focused Casting +(14743, 14743, 1), +(14743, 27828, 2), + -- Focused Fire +(35060, 35060, 1), +(35060, 35061, 2), + -- Focused Fire +(35029, 35029, 1), +(35029, 35030, 2), + -- Focused Mind +(33213, 33213, 1), +(33213, 33214, 2), +(33213, 33215, 3), + -- Focused Mind +(30864, 30864, 1), +(30864, 30865, 2), +(30864, 30866, 3), + -- Focused Power +(33186, 33186, 1), +(33186, 33190, 2), + -- Focused Rage +(29787, 29787, 1), +(29787, 29790, 2), +(29787, 29792, 3), + -- Freezing Trap +(1499, 1499, 1), +(1499, 14310, 2), +(1499, 14311, 3), + -- Freezing Trap Effect +(3355, 3355, 1), +(3355, 14308, 2), +(3355, 14309, 3), + -- Frenzy +(19621, 19621, 1), +(19621, 19622, 2), +(19621, 19623, 3), +(19621, 19624, 4), +(19621, 19625, 5), + -- Frigid Dreadplate +(49186, 49186, 1), +(49186, 51108, 2), +(49186, 51109, 3), + -- Frost Armor +(168, 168, 1), +(168, 7300, 2), +(168, 7301, 3), + -- Frost Channeling +(11160, 11160, 1), +(11160, 12518, 2), +(11160, 12519, 3), + -- Frost Nova +(122, 122, 1), +(122, 865, 2), +(122, 6131, 3), +(122, 10230, 4), +(122, 27088, 5), +(122, 42917, 6), + -- Frost Resistance Aura +(19888, 19888, 1), +(19888, 19897, 2), +(19888, 19898, 3), +(19888, 27152, 4), +(19888, 48945, 5), + -- Frost Resistance Totem +(8181, 8181, 1), +(8181, 10478, 2), +(8181, 10479, 3), +(8181, 25560, 4), +(8181, 58741, 5), +(8181, 58745, 6), + -- Frost Shock +(8056, 8056, 1), +(8056, 8058, 2), +(8056, 10472, 3), +(8056, 10473, 4), +(8056, 25464, 5), +(8056, 49235, 6), +(8056, 49236, 7), + -- Frost Ward +(6144, 6144, 1), +(6144, 8463, 2), +(6144, 8464, 3), +(6144, 10178, 4), +(6144, 27396, 5), +(6144, 32797, 6), + -- Frost Ward +(6143, 6143, 1), +(6143, 8461, 2), +(6143, 8462, 3), +(6143, 10177, 4), +(6143, 28609, 5), +(6143, 32796, 6), +(6143, 43012, 7), + -- Frost Warding +(11189, 11189, 1), +(11189, 28332, 2), + -- Frostbite +(11071, 11071, 1), +(11071, 12496, 2), +(11071, 12497, 3), + -- Frostbolt +(116, 116, 1), +(116, 205, 2), +(116, 837, 3), +(116, 7322, 4), +(116, 8406, 5), +(116, 8407, 6), +(116, 8408, 7), +(116, 10179, 8), +(116, 10180, 9), +(116, 10181, 10), +(116, 25304, 11), +(116, 27071, 12), +(116, 27072, 13), +(116, 38697, 14), +(116, 42841, 15), +(116, 42842, 16), + -- Frostbrand Weapon +(8033, 8033, 1), +(8033, 8038, 2), +(8033, 10456, 3), +(8033, 16355, 4), +(8033, 16356, 5), +(8033, 25500, 6), +(8033, 58794, 7), +(8033, 58795, 8), +(8033, 58796, 9), + -- Frostfire Bolt +(44614, 44614, 1), +(44614, 47610, 2), + -- Froststorm Breath +(54644, 54644, 1), +(54644, 55488, 2), +(54644, 55489, 3), +(54644, 55490, 4), +(54644, 55491, 5), +(54644, 55492, 6), + -- Frozen Core +(31667, 31667, 1), +(31667, 31668, 2), +(31667, 31669, 3), + -- Frozen Power +(63373, 63373, 1), +(63373, 63374, 2), + -- Furious Attacks +(46910, 46910, 1), +(46910, 46911, 2), + -- Furious Howl +(24604, 24604, 1), +(24604, 64491, 2), +(24604, 64492, 3), +(24604, 64493, 4), +(24604, 64494, 5), +(24604, 64495, 6), + -- Furor +(17056, 17056, 1), +(17056, 17058, 2), +(17056, 17059, 3), +(17056, 17060, 4), +(17056, 17061, 5), + -- Gag Order +(12311, 12311, 1), +(12311, 12958, 2), + -- Gale Winds +(48488, 48488, 1), +(48488, 48514, 2), + -- Garrote +(703, 703, 1), +(703, 8631, 2), +(703, 8632, 3), +(703, 8633, 4), +(703, 11289, 5), +(703, 11290, 6), +(703, 26839, 7), +(703, 26884, 8), +(703, 48675, 9), +(703, 48676, 10), + -- Genesis +(57810, 57810, 1), +(57810, 57811, 2), +(57810, 57812, 3), +(57810, 57813, 4), +(57810, 57814, 5), + -- Gift of Nature +(17104, 17104, 1), +(17104, 24943, 2), +(17104, 24944, 3), +(17104, 24945, 4), +(17104, 24946, 5), + -- Gift of the Earthmother +(51179, 51179, 1), +(51179, 51180, 2), +(51179, 51181, 3), +(51179, 51182, 4), +(51179, 51183, 5), + -- Gift of the Wild +(21849, 21849, 1), +(21849, 21850, 2), +(21849, 26991, 3), +(21849, 48470, 4), + -- Glacier Rot +(49471, 49471, 1), +(49471, 49790, 2), +(49471, 49791, 3), + -- Go for the Throat +(34952, 34952, 1), +(34952, 34953, 2), + -- Go for the Throat +(34950, 34950, 1), +(34950, 34954, 2), + -- Gore +(35299, 35299, 1), +(35299, 35300, 2), +(35299, 35302, 3), +(35299, 35303, 4), +(35299, 35304, 5), +(35299, 35305, 6), +(35299, 35306, 7), +(35299, 35307, 8), +(35299, 35308, 9), + -- Gore +(35290, 35290, 1), +(35290, 35291, 2), +(35290, 35292, 3), +(35290, 35293, 4), +(35290, 35294, 5), +(35290, 35295, 6), + -- Grace +(47516, 47516, 1), +(47516, 47517, 2), + -- Grace of the Mantis +(53450, 53450, 1), +(53450, 53451, 2), + -- Great Resistance +(53427, 53427, 1), +(53427, 53429, 2), +(53427, 53430, 3), + -- Great Stamina +(4195, 4195, 1), +(4195, 4196, 2), +(4195, 4197, 3), +(4195, 4198, 4), +(4195, 4199, 5), +(4195, 4200, 6), +(4195, 4201, 7), +(4195, 4202, 8), +(4195, 5048, 9), +(4195, 5049, 10), +(4195, 27364, 11), + -- Great Stamina +(61686, 61686, 1), +(61686, 61687, 2), +(61686, 61688, 3), + -- Greater Blessing of Might +(25782, 25782, 1), +(25782, 25916, 2), +(25782, 27141, 3), +(25782, 48933, 4), +(25782, 48934, 5), + -- Greater Blessing of Wisdom +(25894, 25894, 1), +(25894, 25918, 2), +(25894, 27143, 3), +(25894, 48937, 4), +(25894, 48938, 5), + -- Greater Heal +(2060, 2060, 1), +(2060, 10963, 2), +(2060, 10964, 3), +(2060, 10965, 4), +(2060, 25314, 5), +(2060, 25210, 6), +(2060, 25213, 7), +(2060, 48062, 8), +(2060, 48063, 9), + -- Grim Reach +(18218, 18218, 1), +(18218, 18219, 2), + -- Growl +(1853, 1853, 1), +(1853, 14922, 2), +(1853, 14923, 3), +(1853, 14924, 4), +(1853, 14925, 5), +(1853, 14926, 6), +(1853, 14927, 7), +(1853, 27344, 8), + -- Growl +(2649, 2649, 1), +(2649, 14916, 2), +(2649, 14917, 3), +(2649, 14918, 4), +(2649, 14919, 5), +(2649, 14920, 6), +(2649, 14921, 7), +(2649, 27047, 8), +(2649, 61676, 9), + -- Guard Dog +(53178, 53178, 1), +(53178, 53179, 2), + -- Guarded by the Light +(53583, 53583, 1), +(53583, 53585, 2), + -- Guardian Totems +(16258, 16258, 1), +(16258, 16293, 2), + -- Guardian's Favor +(20174, 20174, 1), +(20174, 20175, 2), + -- Guile of Gorefiend +(50187, 50187, 1), +(50187, 50190, 2), +(50187, 50191, 3), + -- Hack and Slash +(13960, 13960, 1), +(13960, 13961, 2), +(13960, 13962, 3), +(13960, 13963, 4), +(13960, 13964, 5), + -- Hammer of Justice +(853, 853, 1), +(853, 5588, 2), +(853, 5589, 3), +(853, 10308, 4), + -- Hammer of Wrath +(24275, 24275, 1), +(24275, 24274, 2), +(24275, 24239, 3), +(24275, 27180, 4), +(24275, 48805, 5), +(24275, 48806, 6), + -- Hand of Protection +(1022, 1022, 1), +(1022, 5599, 2), +(1022, 10278, 3), + -- Haunt +(48181, 48181, 1), +(48181, 59161, 2), +(48181, 59163, 3), +(48181, 59164, 4), + -- Hawk Eye +(19498, 19498, 1), +(19498, 19499, 2), +(19498, 19500, 3), + -- Heal +(2054, 2054, 1), +(2054, 2055, 2), +(2054, 6063, 3), +(2054, 6064, 4), + -- Healing Focus +(14913, 14913, 1), +(14913, 15012, 2), + -- Healing Focus +(16181, 16181, 1), +(16181, 16230, 2), +(16181, 16232, 3), + -- Healing Grace +(29187, 29187, 1), +(29187, 29189, 2), +(29187, 29191, 3), + -- Healing Light +(20237, 20237, 1), +(20237, 20238, 2), +(20237, 20239, 3), + -- Healing Prayers +(14911, 14911, 1), +(14911, 15018, 2), + -- Healing Stream Totem +(5394, 5394, 1), +(5394, 6375, 2), +(5394, 6377, 3), +(5394, 10462, 4), +(5394, 10463, 5), +(5394, 25567, 6), +(5394, 58755, 7), +(5394, 58756, 8), +(5394, 58757, 9), + -- Healing Touch +(5185, 5185, 1), +(5185, 5186, 2), +(5185, 5187, 3), +(5185, 5188, 4), +(5185, 5189, 5), +(5185, 6778, 6), +(5185, 8903, 7), +(5185, 9758, 8), +(5185, 9888, 9), +(5185, 9889, 10), +(5185, 25297, 11), +(5185, 26978, 12), +(5185, 26979, 13), +(5185, 48377, 14), +(5185, 48378, 15), + -- Healing Wave +(331, 331, 1), +(331, 332, 2), +(331, 547, 3), +(331, 913, 4), +(331, 939, 5), +(331, 959, 6), +(331, 8005, 7), +(331, 10395, 8), +(331, 10396, 9), +(331, 25357, 10), +(331, 25391, 11), +(331, 25396, 12), +(331, 49272, 13), +(331, 49273, 14), + -- Healing Way +(29206, 29206, 1), +(29206, 29205, 2), +(29206, 29202, 3), + -- Health Funnel +(755, 755, 1), +(755, 3698, 2), +(755, 3699, 3), +(755, 3700, 4), +(755, 11693, 5), +(755, 11694, 6), +(755, 11695, 7), +(755, 27259, 8), +(755, 47856, 9), + -- Heart of the Crusader +(21183, 21183, 1), +(21183, 54498, 2), +(21183, 54499, 3), + -- Heart of the Crusader +(20335, 20335, 1), +(20335, 20336, 2), +(20335, 20337, 3), + -- Heart of the Wild +(17003, 17003, 1), +(17003, 17004, 2), +(17003, 17005, 3), +(17003, 17006, 4), +(17003, 24894, 5), + -- Heart Strike +(55050, 55050, 1), +(55050, 55258, 2), +(55050, 55259, 3), +(55050, 55260, 4), +(55050, 55261, 5), +(55050, 55262, 6), + -- Heightened Senses +(30894, 30894, 1), +(30894, 30895, 2), + -- Hellfire +(1949, 1949, 1), +(1949, 11683, 2), +(1949, 11684, 3), +(1949, 27213, 4), +(1949, 47823, 5), + -- Hellfire Effect +(5857, 5857, 1), +(5857, 11681, 2), +(5857, 11682, 3), +(5857, 27214, 4), +(5857, 47822, 5), + -- Hemorrhage +(16511, 16511, 1), +(16511, 17347, 2), +(16511, 17348, 3), +(16511, 26864, 4), +(16511, 48660, 5), + -- Herb Gathering +(2366, 2366, 1), +(2366, 2368, 2), +(2366, 3570, 3), +(2366, 11993, 4), +(2366, 28695, 5), +(2366, 50300, 6), + -- Heroic Strike +(78, 78, 1), +(78, 284, 2), +(78, 285, 3), +(78, 1608, 4), +(78, 11564, 5), +(78, 11565, 6), +(78, 11566, 7), +(78, 11567, 8), +(78, 25286, 9), +(78, 29707, 10), +(78, 30324, 11), +(78, 47449, 12), +(78, 47450, 13), + -- Hibernate +(2637, 2637, 1), +(2637, 18657, 2), +(2637, 18658, 3), + -- Holy Concentration +(34753, 34753, 1), +(34753, 34859, 2), +(34753, 34860, 3), + -- Holy Fire +(14914, 14914, 1), +(14914, 15262, 2), +(14914, 15263, 3), +(14914, 15264, 4), +(14914, 15265, 5), +(14914, 15266, 6), +(14914, 15267, 7), +(14914, 15261, 8), +(14914, 25384, 9), +(14914, 48134, 10), +(14914, 48135, 11), + -- Holy Guidance +(31837, 31837, 1), +(31837, 31838, 2), +(31837, 31839, 3), +(31837, 31840, 4), +(31837, 31841, 5), + -- Holy Light +(635, 635, 1), +(635, 639, 2), +(635, 647, 3), +(635, 1026, 4), +(635, 1042, 5), +(635, 3472, 6), +(635, 10328, 7), +(635, 10329, 8), +(635, 25292, 9), +(635, 27135, 10), +(635, 27136, 11), +(635, 48781, 12), +(635, 48782, 13), + -- Holy Power +(5923, 5923, 1), +(5923, 5924, 2), +(5923, 5925, 3), +(5923, 5926, 4), +(5923, 25829, 5), + -- Holy Reach +(27789, 27789, 1), +(27789, 27790, 2), + -- Holy Shield +(20925, 20925, 1), +(20925, 20927, 2), +(20925, 20928, 3), +(20925, 27179, 4), +(20925, 48951, 5), +(20925, 48952, 6), + -- Holy Specialization +(14889, 14889, 1), +(14889, 15008, 2), +(14889, 15009, 3), +(14889, 15010, 4), +(14889, 15011, 5), + -- Holy Wrath +(2812, 2812, 1), +(2812, 10318, 2), +(2812, 27139, 3), +(2812, 48816, 4), +(2812, 48817, 5), + -- Honor Among Thieves +(51698, 51698, 1), +(51698, 51700, 2), +(51698, 51701, 3), + -- Horn of Winter +(57330, 57330, 1), +(57330, 57623, 2), + -- Hot Streak +(44445, 44445, 1), +(44445, 44446, 2), +(44445, 44448, 3), + -- Howl of Terror +(5484, 5484, 1), +(5484, 17928, 2), + -- Howling Blast +(49184, 49184, 1), +(49184, 51409, 2), +(49184, 51410, 3), +(49184, 51411, 4), + -- Hunter vs. Wild +(56339, 56339, 1), +(56339, 56340, 2), +(56339, 56341, 3), + -- Hunter's Mark +(1130, 1130, 1), +(1130, 14323, 2), +(1130, 14324, 3), +(1130, 14325, 4), +(1130, 53338, 5), + -- Hunting Party +(53290, 53290, 1), +(53290, 53291, 2), +(53290, 53292, 3), + -- Ice Armor +(1214, 1214, 1), +(1214, 1228, 2), +(1214, 10221, 3), +(1214, 10222, 4), +(1214, 27391, 5), + -- Ice Armor +(7302, 7302, 1), +(7302, 7320, 2), +(7302, 10219, 3), +(7302, 10220, 4), +(7302, 27124, 5), +(7302, 43008, 6), + -- Ice Barrier +(11426, 11426, 1), +(11426, 13031, 2), +(11426, 13032, 3), +(11426, 13033, 4), +(11426, 27134, 5), +(11426, 33405, 6), +(11426, 43038, 7), +(11426, 43039, 8), + -- Ice Floes +(31670, 31670, 1), +(31670, 31672, 2), +(31670, 55094, 3), + -- Ice Lance +(30455, 30455, 1), +(30455, 42913, 2), +(30455, 42914, 3), + -- Ice Shards +(11207, 11207, 1), +(11207, 12672, 2), +(11207, 15047, 3), + -- Icy Reach +(55061, 55061, 1), +(55061, 55062, 2), + -- Icy Talons +(50880, 50880, 1), +(50880, 50884, 2), +(50880, 50885, 3), +(50880, 50886, 4), +(50880, 50887, 5), + -- Ignite +(11119, 11119, 1), +(11119, 11120, 2), +(11119, 12846, 3), +(11119, 12847, 4), +(11119, 12848, 5), + -- Illumination +(20210, 20210, 1), +(20210, 20212, 2), +(20210, 20213, 3), +(20210, 20214, 4), +(20210, 20215, 5), + -- Immolate +(348, 348, 1), +(348, 707, 2), +(348, 1094, 3), +(348, 2941, 4), +(348, 11665, 5), +(348, 11667, 6), +(348, 11668, 7), +(348, 25309, 8), +(348, 27215, 9), +(348, 47810, 10), +(348, 47811, 11), + -- Impale +(16493, 16493, 1), +(16493, 16494, 2), + -- Improved Ambush +(14079, 14079, 1), +(14079, 14080, 2), + -- Improved Arcane Shot +(19454, 19454, 1), +(19454, 19455, 2), +(19454, 19456, 3), + -- Improved Aspect of the Hawk +(19552, 19552, 1), +(19552, 19553, 2), +(19552, 19554, 3), +(19552, 19555, 4), +(19552, 19556, 5), + -- Improved Aspect of the Monkey +(19549, 19549, 1), +(19549, 19550, 2), +(19549, 19551, 3), + -- Improved Barkskin +(63410, 63410, 1), +(63410, 63411, 2), + -- Improved Barrage +(35104, 35104, 1), +(35104, 35110, 2), +(35104, 35111, 3), + -- Improved Berserker Rage +(20500, 20500, 1), +(20500, 20501, 2), + -- Improved Berserker Stance +(29759, 29759, 1), +(29759, 29760, 2), +(29759, 29761, 3), +(29759, 29762, 4), +(29759, 29763, 5), + -- Improved Blessing of Might +(20042, 20042, 1), +(20042, 20045, 2), + -- Improved Blessing of Salvation +(20194, 20194, 1), +(20194, 20195, 2), + -- Improved Blessing of Wisdom +(20244, 20244, 1), +(20244, 20245, 2), + -- Improved Blink +(31569, 31569, 1), +(31569, 31570, 2), + -- Improved Blizzard +(11185, 11185, 1), +(11185, 12487, 2), +(11185, 12488, 3), + -- Improved Blood Presence +(50365, 50365, 1), +(50365, 50371, 2), + -- Improved Bloodrage +(12301, 12301, 1), +(12301, 12818, 2), + -- Improved Chain Heal +(30872, 30872, 1), +(30872, 30873, 2), + -- Improved Challenging Shout +(12327, 12327, 1), +(12327, 12886, 2), + -- Improved Charge +(12285, 12285, 1), +(12285, 12697, 2), + -- Improved Cleave +(12329, 12329, 1), +(12329, 12950, 2), +(12329, 20496, 3), + -- Improved Concentration Aura +(20254, 20254, 1), +(20254, 20255, 2), +(20254, 20256, 3), + -- Improved Concussive Shot +(19407, 19407, 1), +(19407, 19412, 2), + -- Improved Cone of Cold +(11190, 11190, 1), +(11190, 12489, 2), +(11190, 12490, 3), + -- Improved Corpse Explosion +(49601, 49601, 1), +(49601, 49602, 2), + -- Improved Corruption +(17810, 17810, 1), +(17810, 17811, 2), +(17810, 17812, 3), +(17810, 17813, 4), +(17810, 17814, 5), + -- Improved Counterspell +(11255, 11255, 1), +(11255, 12598, 2), + -- Improved Cower +(53180, 53180, 1), +(53180, 53181, 2), + -- Improved Curse of Agony +(18827, 18827, 1), +(18827, 18829, 2), + -- Improved Curse of Weakness +(18179, 18179, 1), +(18179, 18180, 2), + -- Improved Death Coil +(30049, 30049, 1), +(30049, 30051, 2), +(30049, 30052, 3), + -- Improved Defensive Stance +(29593, 29593, 1), +(29593, 29594, 2), + -- Improved Demonic Tactics +(54347, 54347, 1), +(54347, 54348, 2), +(54347, 54349, 3), + -- Improved Demoralizing Shout +(12324, 12324, 1), +(12324, 12876, 2), +(12324, 12877, 3), +(12324, 12878, 4), +(12324, 12879, 5), + -- Improved Devotion Aura +(20138, 20138, 1), +(20138, 20139, 2), +(20138, 20140, 3), + -- Improved Devouring Plague +(63625, 63625, 1), +(63625, 63626, 2), +(63625, 63627, 3), + -- Improved Disarm +(12313, 12313, 1), +(12313, 12804, 2), + -- Improved Disciplines +(12312, 12312, 1), +(12312, 12803, 2), + -- Improved Divine Spirit +(33174, 33174, 1), +(33174, 33182, 2), + -- Improved Drain Soul +(18213, 18213, 1), +(18213, 18372, 2), + -- Improved Earth Shield +(51560, 51560, 1), +(51560, 51561, 2), + -- Improved Eviscerate +(14162, 14162, 1), +(14162, 14163, 2), +(14162, 14164, 3), + -- Improved Execute +(20502, 20502, 1), +(20502, 20503, 2), + -- Improved Expose Armor +(14168, 14168, 1), +(14168, 14169, 2), + -- Improved Eyes of the Beast +(19557, 19557, 1), +(19557, 19558, 2), + -- Improved Faerie Fire +(33600, 33600, 1), +(33600, 33601, 2), +(33600, 33602, 3), + -- Improved Fear +(53754, 53754, 1), +(53754, 53759, 2), + -- Improved Felhunter +(54037, 54037, 1), +(54037, 54038, 2), + -- Improved Fire Blast +(11078, 11078, 1), +(11078, 11080, 2), + -- Improved Fire Nova Totem +(16086, 16086, 1), +(16086, 16544, 2), + -- Improved Fireball +(11069, 11069, 1), +(11069, 12338, 2), +(11069, 12339, 3), +(11069, 12340, 4), +(11069, 12341, 5), + -- Improved Flash of Light +(20249, 20249, 1), +(20249, 20250, 2), +(20249, 20251, 3), + -- Improved Frost Presence +(50384, 50384, 1), +(50384, 50385, 2), + -- Improved Frostbolt +(11070, 11070, 1), +(11070, 12473, 2), +(11070, 16763, 3), +(11070, 16765, 4), +(11070, 16766, 5), + -- Improved Ghost Wolf +(16262, 16262, 1), +(16262, 16287, 2), + -- Improved Gouge +(13741, 13741, 1), +(13741, 13793, 2), +(13741, 13792, 3), + -- Improved Hammer of Justice +(20487, 20487, 1), +(20487, 20488, 2), + -- Improved Hamstring +(12289, 12289, 1), +(12289, 12668, 2), +(12289, 23695, 3), + -- Improved Healing +(14912, 14912, 1), +(14912, 15013, 2), +(14912, 15014, 3), + -- Improved Healing Wave +(16182, 16182, 1), +(16182, 16226, 2), +(16182, 16227, 3), +(16182, 16228, 4), +(16182, 16229, 5), + -- Improved Health Funnel +(18703, 18703, 1), +(18703, 18704, 2), + -- Improved Healthstone +(18692, 18692, 1), +(18692, 18693, 2), + -- Improved Heroic Strike +(12282, 12282, 1), +(12282, 12663, 2), +(12282, 12664, 3), + -- Improved Howl of Terror +(30054, 30054, 1), +(30054, 30057, 2), + -- Improved Hunter's Mark +(19421, 19421, 1), +(19421, 19422, 2), +(19421, 19423, 3), + -- Improved Icy Touch +(49175, 49175, 1), +(49175, 50031, 2), +(49175, 51456, 3), + -- Improved Immolate +(17815, 17815, 1), +(17815, 17833, 2), +(17815, 17834, 3), + -- Improved Imp +(18694, 18694, 1), +(18694, 18695, 2), +(18694, 18696, 3), + -- Improved Inner Fire +(14747, 14747, 1), +(14747, 14770, 2), +(14747, 14771, 3), + -- Improved Inner Rage +(12325, 12325, 1), +(12325, 12863, 2), +(12325, 12864, 3), +(12325, 12865, 4), +(12325, 12866, 5), + -- Improved Insect Swarm +(57849, 57849, 1), +(57849, 57850, 2), +(57849, 57851, 3), + -- Improved Intercept +(29888, 29888, 1), +(29888, 29889, 2), + -- Improved Intimidating Shout +(19870, 19870, 1), +(19870, 19871, 2), + -- Improved Judgements +(25956, 25956, 1), +(25956, 25957, 2), + -- Improved Kick +(13754, 13754, 1), +(13754, 13867, 2), + -- Improved Kidney Shot +(14174, 14174, 1), +(14174, 14175, 2), +(14174, 14176, 3), + -- Improved Lay on Hands +(20234, 20234, 1), +(20234, 20235, 2), + -- Improved Leader of the Pack +(34297, 34297, 1), +(34297, 34300, 2), + -- Improved Life Tap +(18182, 18182, 1), +(18182, 18183, 2), + -- Improved Mana Burn +(14750, 14750, 1), +(14750, 14772, 2), + -- Improved Mangle +(48532, 48532, 1), +(48532, 48489, 2), +(48532, 48491, 3), + -- Improved Mark of the Wild +(17050, 17050, 1), +(17050, 17051, 2), + -- Improved Mind Blast +(15273, 15273, 1), +(15273, 15312, 2), +(15273, 15313, 3), +(15273, 15314, 4), +(15273, 15316, 5), + -- Improved Moonfire +(16821, 16821, 1), +(16821, 16822, 2), + -- Improved Moonkin Form +(50170, 50170, 1), +(50170, 50171, 2), +(50170, 50172, 3), + -- Improved Moonkin Form +(48384, 48384, 1), +(48384, 48395, 2), +(48384, 48396, 3), + -- Improved Mortal Strike +(35446, 35446, 1), +(35446, 35448, 2), +(35446, 35449, 3), + -- Improved Overpower +(12290, 12290, 1), +(12290, 12963, 2), + -- Improved Poisons +(14113, 14113, 1), +(14113, 14114, 2), +(14113, 14115, 3), +(14113, 14116, 4), +(14113, 14117, 5), + -- Improved Power Word: Fortitude +(14749, 14749, 1), +(14749, 14767, 2), + -- Improved Power Word: Shield +(14748, 14748, 1), +(14748, 14768, 2), +(14748, 14769, 3), + -- Improved Psychic Scream +(15392, 15392, 1), +(15392, 15448, 2), + -- Improved Reincarnation +(16184, 16184, 1), +(16184, 16209, 2), + -- Improved Rejuvenation +(17111, 17111, 1), +(17111, 17112, 2), +(17111, 17113, 3), + -- Improved Rend +(12286, 12286, 1), +(12286, 12658, 2), + -- Improved Renew +(14908, 14908, 1), +(14908, 15020, 2), +(14908, 17191, 3), + -- Improved Revenge +(12797, 12797, 1), +(12797, 12799, 2), + -- Improved Revive Pet +(24443, 24443, 1), +(24443, 19575, 2), + -- Improved Righteous Fury +(20468, 20468, 1), +(20468, 20469, 2), +(20468, 20470, 3), + -- Improved Rune Tap +(48985, 48985, 1), +(48985, 49488, 2), +(48985, 49489, 3), + -- Improved Scorch +(11095, 11095, 1), +(11095, 12872, 2), +(11095, 12873, 3), + -- Improved Scorpid Sting +(19491, 19491, 1), +(19491, 19493, 2), +(19491, 19494, 3), + -- Improved Searing Pain +(17927, 17927, 1), +(17927, 17929, 2), +(17927, 17930, 3), + -- Improved Shadow Bolt +(17793, 17793, 1), +(17793, 17796, 2), +(17793, 17801, 3), +(17793, 17802, 4), +(17793, 17803, 5), + -- Improved Shadow Word: Pain +(15275, 15275, 1), +(15275, 15317, 2), + -- Improved Shadowform +(47569, 47569, 1), +(47569, 47570, 2), + -- Improved Shields +(16261, 16261, 1), +(16261, 16290, 2), +(16261, 51881, 3), + -- Improved Sinister Strike +(13732, 13732, 1), +(13732, 13863, 2), + -- Improved Slam +(12862, 12862, 1), +(12862, 12330, 2), + -- Improved Slice and Dice +(14165, 14165, 1), +(14165, 14166, 2), + -- Improved Soul Leech +(54117, 54117, 1), +(54117, 54118, 2), + -- Improved Spell Reflection +(59088, 59088, 1), +(59088, 59089, 2), + -- Improved Spirit Tap +(49694, 49694, 1), +(49694, 59000, 2), + -- Improved Spirit Tap +(15337, 15337, 1), +(15337, 15338, 2), + -- Improved Sprint +(13743, 13743, 1), +(13743, 13875, 2), + -- Improved Steady Shot +(53221, 53221, 1), +(53221, 53222, 2), +(53221, 53224, 3), + -- Improved Stings +(19464, 19464, 1), +(19464, 19465, 2), +(19464, 19466, 3), + -- Improved Stormstrike +(51521, 51521, 1), +(51521, 51522, 2), + -- Improved Succubus +(18754, 18754, 1), +(18754, 18755, 2), +(18754, 18756, 3), + -- Improved Thunder Clap +(12287, 12287, 1), +(12287, 12665, 2), +(12287, 12666, 3), + -- Improved Tracking +(52783, 52783, 1), +(52783, 52785, 2), +(52783, 52786, 3), +(52783, 52787, 4), +(52783, 52788, 5), + -- Improved Tranquility +(17123, 17123, 1), +(17123, 17124, 2), + -- Improved Tree of Life +(48535, 48535, 1), +(48535, 48536, 2), +(48535, 48537, 3), + -- Improved Unholy Presence +(50391, 50391, 1), +(50391, 50392, 2), + -- Improved Vampiric Embrace +(27839, 27839, 1), +(27839, 27840, 2), + -- Improved Water Shield +(16180, 16180, 1), +(16180, 16196, 2), +(16180, 16198, 3), + -- Improved Whirlwind +(29721, 29721, 1), +(29721, 29776, 2), + -- Improved Windfury Totem +(29192, 29192, 1), +(29192, 29193, 2), + -- Impurity +(49220, 49220, 1), +(49220, 49633, 2), +(49220, 49635, 3), +(49220, 49636, 4), +(49220, 49638, 5), + -- Incanter's Absorption +(44394, 44394, 1), +(44394, 44395, 2), +(44394, 44396, 3), + -- Incinerate +(29722, 29722, 1), +(29722, 32231, 2), +(29722, 47837, 3), +(29722, 47838, 4), + -- Incineration +(18459, 18459, 1), +(18459, 18460, 2), +(18459, 54734, 3), + -- Incite +(50685, 50685, 1), +(50685, 50686, 2), +(50685, 50687, 3), + -- Infected Wounds +(48483, 48483, 1), +(48483, 48484, 2), +(48483, 48485, 3), + -- Infectious Poisons +(51630, 51630, 1), +(51630, 51631, 2), + -- Inner Fire +(588, 588, 1), +(588, 7128, 2), +(588, 602, 3), +(588, 1006, 4), +(588, 10951, 5), +(588, 10952, 6), +(588, 25431, 7), +(588, 48040, 8), +(588, 48168, 9), + -- Inscription +(45357, 45357, 1), +(45357, 45358, 2), +(45357, 45359, 3), +(45357, 45360, 4), +(45357, 45361, 5), +(45357, 45363, 6), + -- Insect Swarm +(5570, 5570, 1), +(5570, 24974, 2), +(5570, 24975, 3), +(5570, 24976, 4), +(5570, 24977, 5), +(5570, 27013, 6), +(5570, 48468, 7), + -- Inspiration +(14893, 14893, 1), +(14893, 15357, 2), +(14893, 15359, 3), + -- Inspiration +(14892, 14892, 1), +(14892, 15362, 2), +(14892, 15363, 3), + -- Intensify Rage +(46908, 46908, 1), +(46908, 46909, 2), +(46908, 56924, 3), + -- Intensity +(17080, 17080, 1), +(17080, 35358, 2), +(17080, 35359, 3), + -- Intensity +(17106, 17106, 1), +(17106, 17107, 2), +(17106, 17108, 3), + -- Intensity +(18135, 18135, 1), +(18135, 18136, 2), + -- Invigoration +(53252, 53252, 1), +(53252, 53253, 2), + -- Iron Will +(12300, 12300, 1), +(12300, 12959, 2), +(12300, 12960, 3), + -- Jewelcrafting +(25229, 25229, 1), +(25229, 25230, 2), +(25229, 28894, 3), +(25229, 28895, 4), +(25229, 28897, 5), +(25229, 51311, 6), + -- Judgements of the Just +(53695, 53695, 1), +(53695, 53696, 2), + -- Judgements of the Wise +(31876, 31876, 1), +(31876, 31877, 2), +(31876, 31878, 3), + -- Khadgar's Unlocking +(491, 491, 1), +(491, 857, 2), +(491, 10165, 3), +(491, 10166, 4), + -- Kidney Shot +(408, 408, 1), +(408, 8643, 2), + -- Kill Shot +(53351, 53351, 1), +(53351, 61005, 2), +(53351, 61006, 3), + -- Killer Instinct +(19370, 19370, 1), +(19370, 19371, 2), +(19370, 19373, 3), + -- Killing Machine +(51123, 51123, 1), +(51123, 51127, 2), +(51123, 51128, 3), +(51123, 51129, 4), +(51123, 51130, 5), + -- Kindling Soul +(47426, 47426, 1), +(47426, 47427, 2), + -- Kindling Soul +(47261, 47261, 1), +(47261, 47262, 2), + -- Kindred Spirits +(56314, 56314, 1), +(56314, 56315, 2), +(56314, 56316, 3), +(56314, 56317, 4), +(56314, 56318, 5), + -- King of the Jungle +(48492, 48492, 1), +(48492, 48494, 2), +(48492, 48495, 3), + -- Lacerate +(33745, 33745, 1), +(33745, 48567, 2), +(33745, 48568, 3), + -- Lash of Pain +(7814, 7814, 1), +(7814, 7815, 2), +(7814, 7816, 3), +(7814, 11778, 4), +(7814, 11779, 5), +(7814, 11780, 6), +(7814, 27274, 7), +(7814, 47991, 8), +(7814, 47992, 9), + -- Lava Breath +(58604, 58604, 1), +(58604, 58607, 2), +(58604, 58608, 3), +(58604, 58609, 4), +(58604, 58610, 5), +(58604, 58611, 6), + -- Lava Burst +(51505, 51505, 1), +(51505, 60043, 2), + -- Lava Flows +(51480, 51480, 1), +(51480, 51481, 2), +(51480, 51482, 3), + -- Lay on Hands +(633, 633, 1), +(633, 2800, 2), +(633, 10310, 3), +(633, 27154, 4), +(633, 48788, 5), + -- Leatherworking +(2108, 2108, 1), +(2108, 3104, 2), +(2108, 3811, 3), +(2108, 10662, 4), +(2108, 32549, 5), +(2108, 51302, 6), + -- Lesser Heal +(2050, 2050, 1), +(2050, 2052, 2), +(2050, 2053, 3), + -- Lesser Healing Wave +(8004, 8004, 1), +(8004, 8008, 2), +(8004, 8010, 3), +(8004, 10466, 4), +(8004, 10467, 5), +(8004, 10468, 6), +(8004, 25420, 7), +(8004, 49275, 8), +(8004, 49276, 9), + -- Lethal Shots +(19426, 19426, 1), +(19426, 19427, 2), +(19426, 19429, 3), +(19426, 19430, 4), +(19426, 19431, 5), + -- Lethality +(14128, 14128, 1), +(14128, 14132, 2), +(14128, 14135, 3), +(14128, 14136, 4), +(14128, 14137, 5), + -- Life Tap +(1454, 1454, 1), +(1454, 1455, 2), +(1454, 1456, 3), +(1454, 11687, 4), +(1454, 11688, 5), +(1454, 11689, 6), +(1454, 27222, 7), +(1454, 57946, 8), + -- Lifeblood +(55428, 55428, 1), +(55428, 55480, 2), +(55428, 55500, 3), +(55428, 55501, 4), +(55428, 55502, 5), +(55428, 55503, 6), + -- Lifebloom +(33763, 33763, 1), +(33763, 48450, 2), +(33763, 48451, 3), + -- Lightning Breath +(24845, 24845, 1), +(24845, 25013, 2), +(24845, 25014, 3), +(24845, 25015, 4), +(24845, 25016, 5), +(24845, 25017, 6), + -- Lightning Breath +(24844, 24844, 1), +(24844, 25008, 2), +(24844, 25009, 3), +(24844, 25010, 4), +(24844, 25011, 5), +(24844, 25012, 6), + -- Lightning Mastery +(16578, 16578, 1), +(16578, 16579, 2), +(16578, 16580, 3), +(16578, 16581, 4), +(16578, 16582, 5), + -- Lightning Overload +(30675, 30675, 1), +(30675, 30678, 2), +(30675, 30679, 3), + -- Lightning Reflexes +(13712, 13712, 1), +(13712, 13788, 2), +(13712, 13789, 3), + -- Lightning Reflexes +(19168, 19168, 1), +(19168, 19180, 2), +(19168, 19181, 3), +(19168, 24296, 4), +(19168, 24297, 5), + -- Light's Grace +(31833, 31833, 1), +(31833, 31835, 2), +(31833, 31836, 3), + -- Lightwell +(724, 724, 1), +(724, 27870, 2), +(724, 27871, 3), +(724, 28275, 4), +(724, 48086, 5), +(724, 48087, 6), + -- Lightwell Renew +(7001, 7001, 1), +(7001, 27873, 2), +(7001, 27874, 3), +(7001, 28276, 4), +(7001, 48084, 5), +(7001, 48085, 6), + -- Lionhearted +(53409, 53409, 1), +(53409, 53411, 2), + -- Living Seed +(48496, 48496, 1), +(48496, 48499, 2), +(48496, 48500, 3), + -- Living Spirit +(34151, 34151, 1), +(34151, 34152, 2), +(34151, 34153, 3), + -- Lock and Load +(56342, 56342, 1), +(56342, 56343, 2), +(56342, 56344, 3), + -- Lockpicking +(1809, 1809, 1), +(1809, 1810, 2), +(1809, 6460, 3), + -- Longevity +(53262, 53262, 1), +(53262, 53263, 2), +(53262, 53264, 3), + -- Lunar Guidance +(33589, 33589, 1), +(33589, 33590, 2), +(33589, 33591, 3), + -- Mace Specialization +(13709, 13709, 1), +(13709, 13800, 2), +(13709, 13801, 3), +(13709, 13802, 4), +(13709, 13803, 5), + -- Maelstrom Weapon +(51528, 51528, 1), +(51528, 51529, 2), +(51528, 51530, 3), +(51528, 51531, 4), +(51528, 51532, 5), + -- Mage Armor +(6121, 6121, 1), +(6121, 22784, 2), +(6121, 22785, 3), +(6121, 27392, 4), + -- Mage Armor +(6117, 6117, 1), +(6117, 22782, 2), +(6117, 22783, 3), +(6117, 27125, 4), +(6117, 43023, 5), +(6117, 43024, 6), + -- Magic Absorption +(29441, 29441, 1), +(29441, 29444, 2), + -- Magic Attunement +(11247, 11247, 1), +(11247, 12606, 2), + -- Magic Suppression +(49224, 49224, 1), +(49224, 49610, 2), +(49224, 49611, 3), + -- Magma Totem +(8187, 8187, 1), +(8187, 10579, 2), +(8187, 10580, 3), +(8187, 10581, 4), +(8187, 25550, 5), +(8187, 58732, 6), +(8187, 58735, 7), + -- Magma Totem +(8190, 8190, 1), +(8190, 10585, 2), +(8190, 10586, 3), +(8190, 10587, 4), +(8190, 25552, 5), +(8190, 58731, 6), +(8190, 58734, 7), + -- Magma Totem Passive +(8188, 8188, 1), +(8188, 10582, 2), +(8188, 10583, 3), +(8188, 10584, 4), +(8188, 25551, 5), +(8188, 58733, 6), +(8188, 58736, 7), + -- Maim +(22570, 22570, 1), +(22570, 49802, 2), + -- Malediction +(32477, 32477, 1), +(32477, 32483, 2), +(32477, 32484, 3), + -- Malice +(14138, 14138, 1), +(14138, 14139, 2), +(14138, 14140, 3), +(14138, 14141, 4), +(14138, 14142, 5), + -- Mana Shield +(1481, 1481, 1), +(1481, 8496, 2), +(1481, 8497, 3), +(1481, 10194, 4), +(1481, 10195, 5), +(1481, 10196, 6), +(1481, 27398, 7), + -- Mana Shield +(1463, 1463, 1), +(1463, 8494, 2), +(1463, 8495, 3), +(1463, 10191, 4), +(1463, 10192, 5), +(1463, 10193, 6), +(1463, 27131, 7), +(1463, 43019, 8), +(1463, 43020, 9), + -- Mana Spring +(5677, 5677, 1), +(5677, 10491, 2), +(5677, 10493, 3), +(5677, 10494, 4), +(5677, 25569, 5), +(5677, 58775, 6), +(5677, 58776, 7), +(5677, 58777, 8), + -- Mana Spring Totem +(5675, 5675, 1), +(5675, 10495, 2), +(5675, 10496, 3), +(5675, 10497, 4), +(5675, 25570, 5), +(5675, 58771, 6), +(5675, 58773, 7), +(5675, 58774, 8), + -- Mangle (Bear) +(33878, 33878, 1), +(33878, 33986, 2), +(33878, 33987, 3), +(33878, 48563, 4), +(33878, 48564, 5), + -- Mangle (Cat) +(33876, 33876, 1), +(33876, 33982, 2), +(33876, 33983, 3), +(33876, 48565, 4), +(33876, 48566, 5), + -- Mark of the Wild +(1126, 1126, 1), +(1126, 5232, 2), +(1126, 6756, 3), +(1126, 5234, 4), +(1126, 8907, 5), +(1126, 9884, 6), +(1126, 9885, 7), +(1126, 26990, 8), +(1126, 48469, 9), + -- Marked for Death +(53241, 53241, 1), +(53241, 53243, 2), +(53241, 53244, 3), +(53241, 53245, 4), +(53241, 53246, 5), + -- Martyrdom +(14531, 14531, 1), +(14531, 14774, 2), + -- Master Conjuror +(18767, 18767, 1), +(18767, 18768, 2), + -- Master Healer +(14904, 14904, 1), +(14904, 15024, 2), +(14904, 15025, 3), +(14904, 15026, 4), +(14904, 15027, 5), + -- Master Marksman +(34485, 34485, 1), +(34485, 34486, 2), +(34485, 34487, 3), +(34485, 34488, 4), +(34485, 34489, 5), + -- Master of Anatomy +(53125, 53125, 1), +(53125, 53662, 2), +(53125, 53663, 3), +(53125, 53664, 4), +(53125, 53665, 5), +(53125, 53666, 6), + -- Master of Deception +(13958, 13958, 1), +(13958, 13970, 2), +(13958, 13971, 3), + -- Master of Elements +(29074, 29074, 1), +(29074, 29075, 2), +(29074, 29076, 3), + -- Master of Subtlety +(31221, 31221, 1), +(31221, 31222, 2), +(31221, 31223, 3), + -- Master Poisoner +(31226, 31226, 1), +(31226, 31227, 2), +(31226, 58410, 3), + -- Master Summoner +(18709, 18709, 1), +(18709, 18710, 2), + -- Maul +(6807, 6807, 1), +(6807, 6808, 2), +(6807, 6809, 3), +(6807, 8972, 4), +(6807, 9745, 5), +(6807, 9880, 6), +(6807, 9881, 7), +(6807, 26996, 8), +(6807, 48479, 9), +(6807, 48480, 10), + -- Meditation +(14521, 14521, 1), +(14521, 14776, 2), +(14521, 14777, 3), + -- Melee Specialization +(19381, 19381, 1), +(19381, 19382, 2), +(19381, 19383, 3), +(19381, 19384, 4), +(19381, 19385, 5), + -- Melted Mind +(58378, 58378, 1), +(58378, 58379, 2), + -- Mend Pet +(136, 136, 1), +(136, 3111, 2), +(136, 3661, 3), +(136, 3662, 4), +(136, 13542, 5), +(136, 13543, 6), +(136, 13544, 7), +(136, 27046, 8), +(136, 48989, 9), +(136, 48990, 10), + -- Mental Agility +(14520, 14520, 1), +(14520, 14780, 2), +(14520, 14781, 3), + -- Mental Dexterity +(51883, 51883, 1), +(51883, 51884, 2), +(51883, 51885, 3), + -- Mental Quickness +(30812, 30812, 1), +(30812, 30813, 2), +(30812, 30814, 3), + -- Mental Strength +(18551, 18551, 1), +(18551, 18552, 2), +(18551, 18553, 3), +(18551, 18554, 4), +(18551, 18555, 5), + -- Merciless Combat +(49024, 49024, 1), +(49024, 49538, 2), + -- Might of Mograine +(49023, 49023, 1), +(49023, 49533, 2), +(49023, 49534, 3), + -- Mind Blast +(8092, 8092, 1), +(8092, 8102, 2), +(8092, 8103, 3), +(8092, 8104, 4), +(8092, 8105, 5), +(8092, 8106, 6), +(8092, 10945, 7), +(8092, 10946, 8), +(8092, 10947, 9), +(8092, 25372, 10), +(8092, 25375, 11), +(8092, 48126, 12), +(8092, 48127, 13), + -- Mind Flay +(15407, 15407, 1), +(15407, 17311, 2), +(15407, 17312, 3), +(15407, 17313, 4), +(15407, 17314, 5), +(15407, 18807, 6), +(15407, 25387, 7), +(15407, 48155, 8), +(15407, 48156, 9), + -- Mind Mastery +(31584, 31584, 1), +(31584, 31585, 2), +(31584, 31586, 3), +(31584, 31587, 4), +(31584, 31588, 5), + -- Mind Melt +(14910, 14910, 1), +(14910, 33371, 2), + -- Mind Vision +(2096, 2096, 1), +(2096, 10909, 2), + -- Mining +(2575, 2575, 1), +(2575, 2576, 2), +(2575, 3564, 3), +(2575, 10248, 4), +(2575, 29354, 5), +(2575, 50310, 6), + -- Missile Barrage +(44404, 44404, 1), +(44404, 54486, 2), +(44404, 54488, 3), +(44404, 54489, 4), +(44404, 54490, 5), + -- Molten Core +(47245, 47245, 1), +(47245, 47246, 2), +(47245, 47247, 3), + -- Molten Fury +(31679, 31679, 1), +(31679, 31680, 2), + -- Molten Shields +(11094, 11094, 1), +(11094, 13043, 2), + -- Mongoose Bite +(1495, 1495, 1), +(1495, 14269, 2), +(1495, 14270, 3), +(1495, 14271, 4), +(1495, 36916, 5), +(1495, 53339, 6), + -- Monstrous Bite +(54680, 54680, 1), +(54680, 55495, 2), +(54680, 55496, 3), +(54680, 55497, 4), +(54680, 55498, 5), +(54680, 55499, 6), + -- Moonfire +(8921, 8921, 1), +(8921, 8924, 2), +(8921, 8925, 3), +(8921, 8926, 4), +(8921, 8927, 5), +(8921, 8928, 6), +(8921, 8929, 7), +(8921, 9833, 8), +(8921, 9834, 9), +(8921, 9835, 10), +(8921, 26987, 11), +(8921, 26988, 12), +(8921, 48462, 13), +(8921, 48463, 14), + -- Moonfury +(16896, 16896, 1), +(16896, 16897, 2), +(16896, 16899, 3), + -- Moonglow +(16845, 16845, 1), +(16845, 16846, 2), +(16845, 16847, 3), + -- Morbidity +(48963, 48963, 1), +(48963, 49564, 2), +(48963, 49565, 3), + -- Mortal Shots +(19485, 19485, 1), +(19485, 19487, 2), +(19485, 19488, 3), +(19485, 19489, 4), +(19485, 19490, 5), + -- Mortal Strike +(12294, 12294, 1), +(12294, 21551, 2), +(12294, 21552, 3), +(12294, 21553, 4), +(12294, 25248, 5), +(12294, 30330, 6), +(12294, 47485, 7), +(12294, 47486, 8), + -- Multi-Shot +(2643, 2643, 1), +(2643, 14288, 2), +(2643, 14289, 3), +(2643, 14290, 4), +(2643, 25294, 5), +(2643, 27021, 6), +(2643, 49047, 7), +(2643, 49048, 8), + -- Murder +(14158, 14158, 1), +(14158, 14159, 2), + -- Mutilate +(1329, 1329, 1), +(1329, 34411, 2), +(1329, 34412, 3), +(1329, 34413, 4), +(1329, 48663, 5), +(1329, 48666, 6), + -- Natural Armor +(24547, 24547, 1), +(24547, 24556, 2), +(24547, 24557, 3), +(24547, 24558, 4), +(24547, 24559, 5), +(24547, 24560, 6), +(24547, 24561, 7), +(24547, 24562, 8), +(24547, 24631, 9), +(24547, 24632, 10), +(24547, 27362, 11), + -- Natural Armor +(61689, 61689, 1), +(61689, 61690, 2), + -- Natural Perfection +(45281, 45281, 1), +(45281, 45282, 2), +(45281, 45283, 3), + -- Natural Perfection +(33881, 33881, 1), +(33881, 33882, 2), +(33881, 33883, 3), + -- Natural Reaction +(57878, 57878, 1), +(57878, 57880, 2), +(57878, 57881, 3), + -- Natural Shapeshifter +(16833, 16833, 1), +(16833, 16834, 2), +(16833, 16835, 3), + -- Naturalist +(17069, 17069, 1), +(17069, 17070, 2), +(17069, 17071, 3), +(17069, 17072, 4), +(17069, 17073, 5), + -- Nature Resistance Totem +(10595, 10595, 1), +(10595, 10600, 2), +(10595, 10601, 3), +(10595, 25574, 4), +(10595, 58746, 5), +(10595, 58749, 6), + -- Nature's Blessing +(30867, 30867, 1), +(30867, 30868, 2), +(30867, 30869, 3), + -- Nature's Bounty +(17074, 17074, 1), +(17074, 17075, 2), +(17074, 17076, 3), +(17074, 17077, 4), +(17074, 17078, 5), + -- Nature's Focus +(17063, 17063, 1), +(17063, 17065, 2), +(17063, 17066, 3), + -- Nature's Grasp +(16689, 16689, 1), +(16689, 16810, 2), +(16689, 16811, 3), +(16689, 16812, 4), +(16689, 16813, 5), +(16689, 17329, 6), +(16689, 27009, 7), +(16689, 53312, 8), + -- Nature's Guardian +(30881, 30881, 1), +(30881, 30883, 2), +(30881, 30884, 3), +(30881, 30885, 4), +(30881, 30886, 5), + -- Nature's Reach +(16819, 16819, 1), +(16819, 16820, 2), + -- Necrosis +(51459, 51459, 1), +(51459, 51462, 2), +(51459, 51463, 3), +(51459, 51464, 4), +(51459, 51465, 5), + -- Nemesis +(63117, 63117, 1), +(63117, 63121, 2), +(63117, 63123, 3), + -- Nerves of Cold Steel +(49226, 49226, 1), +(49226, 50137, 2), +(49226, 50138, 3), + -- Nerves of Steel +(31130, 31130, 1), +(31130, 31131, 2), + -- Nether Protection +(30299, 30299, 1), +(30299, 30301, 2), +(30299, 30302, 3), + -- Nether Shock +(50479, 50479, 1), +(50479, 53584, 2), +(50479, 53586, 3), +(50479, 53587, 4), +(50479, 53588, 5), +(50479, 53589, 6), + -- Netherwind Presence +(44400, 44400, 1), +(44400, 44402, 2), +(44400, 44403, 3), + -- Night of the Dead +(55620, 55620, 1), +(55620, 55623, 2), + -- Nightfall +(18094, 18094, 1), +(18094, 18095, 2), + -- Noxious Stings +(53295, 53295, 1), +(53295, 53296, 2), +(53295, 53297, 3), + -- Nurturing Instinct +(47179, 47179, 1), +(47179, 47180, 2), + -- Nurturing Instinct +(33872, 33872, 1), +(33872, 33873, 2), + -- One-Handed Weapon Specialization +(16538, 16538, 1), +(16538, 16539, 2), +(16538, 16540, 3), +(16538, 16541, 4), +(16538, 16542, 5), + -- One-Handed Weapon Specialization +(20196, 20196, 1), +(20196, 20197, 2), +(20196, 20198, 3), + -- Opportunity +(14057, 14057, 1), +(14057, 14072, 2), + -- Outbreak +(49013, 49013, 1), +(49013, 55236, 2), +(49013, 55237, 3), + -- Owlkin Frenzy +(48389, 48389, 1), +(48389, 48392, 2), +(48389, 48393, 3), + -- Owl's Focus +(53514, 53514, 1), +(53514, 53516, 2), + -- Pain and Suffering +(47580, 47580, 1), +(47580, 47581, 2), +(47580, 47582, 3), + -- Pathfinding +(19559, 19559, 1), +(19559, 19560, 2), + -- Permafrost +(11175, 11175, 1), +(11175, 12569, 2), +(11175, 12571, 3), + -- Pet Aggression +(6311, 6311, 1), +(6311, 6314, 2), +(6311, 6315, 3), +(6311, 6316, 4), +(6311, 6317, 5), + -- Pet Barding +(53175, 53175, 1), +(53175, 53176, 2), + -- Pet Hardiness +(6280, 6280, 1), +(6280, 6281, 2), +(6280, 6282, 3), +(6280, 6283, 4), +(6280, 6286, 5), + -- Pet Recovery +(6328, 6328, 1), +(6328, 6331, 2), +(6328, 6332, 3), +(6328, 6333, 4), +(6328, 6334, 5), + -- Pet Resistance +(6443, 6443, 1), +(6443, 6444, 2), +(6443, 6445, 3), +(6443, 6446, 4), +(6443, 6447, 5), + -- Piercing Ice +(11151, 11151, 1), +(11151, 12952, 2), +(11151, 12953, 3), + -- Piercing Shots +(53234, 53234, 1), +(53234, 53237, 2), +(53234, 53238, 3), + -- Pin +(50245, 50245, 1), +(50245, 53544, 2), +(50245, 53545, 3), +(50245, 53546, 4), +(50245, 53547, 5), +(50245, 53548, 6), + -- Playing with Fire +(31638, 31638, 1), +(31638, 31639, 2), +(31638, 31640, 3), + -- Point of No Escape +(53298, 53298, 1), +(53298, 53299, 2), + -- Poison Spit +(35388, 35388, 1), +(35388, 35390, 2), +(35388, 35391, 3), + -- Poison Spit +(35387, 35387, 1), +(35387, 35389, 2), +(35387, 35392, 3), +(35387, 55555, 4), +(35387, 55556, 5), +(35387, 55557, 6), + -- Poleaxe Specialization +(12700, 12700, 1), +(12700, 12781, 2), +(12700, 12783, 3), +(12700, 12784, 4), +(12700, 12785, 5), + -- Polymorph +(118, 118, 1), +(118, 12824, 2), +(118, 12825, 3), +(118, 12826, 4), + -- Pounce +(9005, 9005, 1), +(9005, 9823, 2), +(9005, 9827, 3), +(9005, 27006, 4), +(9005, 49803, 5), + -- Pounce Bleed +(9007, 9007, 1), +(9007, 9824, 2), +(9007, 9826, 3), +(9007, 27007, 4), +(9007, 49804, 5), + -- Power Word: Fortitude +(1243, 1243, 1), +(1243, 1244, 2), +(1243, 1245, 3), +(1243, 2791, 4), +(1243, 10937, 5), +(1243, 10938, 6), +(1243, 25389, 7), +(1243, 48161, 8), + -- Power Word: Shield +(17, 17, 1), +(17, 592, 2), +(17, 600, 3), +(17, 3747, 4), +(17, 6065, 5), +(17, 6066, 6), +(17, 10898, 7), +(17, 10899, 8), +(17, 10900, 9), +(17, 10901, 10), +(17, 25217, 11), +(17, 25218, 12), +(17, 48065, 13), +(17, 48066, 14), + -- Prayer of Fortitude +(21562, 21562, 1), +(21562, 21564, 2), +(21562, 25392, 3), +(21562, 48162, 4), + -- Prayer of Healing +(596, 596, 1), +(596, 996, 2), +(596, 10960, 3), +(596, 10961, 4), +(596, 25316, 5), +(596, 25308, 6), +(596, 48072, 7), + -- Prayer of Mending +(41635, 41635, 1), +(41635, 48110, 2), +(41635, 48111, 3), + -- Prayer of Mending +(33076, 33076, 1), +(33076, 48112, 2), +(33076, 48113, 3), + -- Prayer of Shadow Protection +(27683, 27683, 1), +(27683, 39374, 2), +(27683, 48170, 3), + -- Prayer of Spirit +(27681, 27681, 1), +(27681, 32999, 2), +(27681, 48074, 3), + -- Precision +(29438, 29438, 1), +(29438, 29439, 2), +(29438, 29440, 3), + -- Precision +(13705, 13705, 1), +(13705, 13832, 2), +(13705, 13843, 3), +(13705, 13844, 4), +(13705, 13845, 5), + -- Precision +(29590, 29590, 1), +(29590, 29591, 2), +(29590, 29592, 3), + -- Predatory Instincts +(33859, 33859, 1), +(33859, 33866, 2), +(33859, 33867, 3), + -- Predatory Strikes +(16972, 16972, 1), +(16972, 16974, 2), +(16972, 16975, 3), + -- Prey on the Weak +(51685, 51685, 1), +(51685, 51686, 2), +(51685, 51687, 3), +(51685, 51688, 4), +(51685, 51689, 5), + -- Primal Precision +(48409, 48409, 1), +(48409, 48410, 2), + -- Primal Tenacity +(33851, 33851, 1), +(33851, 33852, 2), +(33851, 33957, 3), + -- Prismatic Cloak +(31574, 31574, 1), +(31574, 31575, 2), +(31574, 54354, 3), + -- Protector of the Pack +(57873, 57873, 1), +(57873, 57876, 2), +(57873, 57877, 3), + -- Prowl +(5215, 5215, 1), +(5215, 6783, 2), +(5215, 9913, 3), + -- Prowl +(24450, 24450, 1), +(24450, 24452, 2), +(24450, 24453, 3), + -- Psychic Scream +(8122, 8122, 1), +(8122, 8124, 2), +(8122, 10888, 3), +(8122, 10890, 4), + -- Pummel +(13491, 13491, 1), +(13491, 6554, 2), +(13491, 6555, 3), + -- Puncture +(12308, 12308, 1), +(12308, 12810, 2), +(12308, 12811, 3), + -- Puncturing Wounds +(13733, 13733, 1), +(13733, 13865, 2), +(13733, 13866, 3), + -- Pure of Heart +(31822, 31822, 1), +(31822, 31823, 2), + -- Purge +(370, 370, 1), +(370, 8012, 2), + -- Purification +(16178, 16178, 1), +(16178, 16210, 2), +(16178, 16211, 3), +(16178, 16212, 4), +(16178, 16213, 5), + -- Purifying Power +(31825, 31825, 1), +(31825, 31826, 2), + -- Pursuit of Justice +(61417, 61417, 1), +(61417, 61418, 2), + -- Pursuit of Justice +(26022, 26022, 1), +(26022, 26023, 2), + -- Pyroblast +(11366, 11366, 1), +(11366, 12505, 2), +(11366, 12522, 3), +(11366, 12523, 4), +(11366, 12524, 5), +(11366, 12525, 6), +(11366, 12526, 7), +(11366, 18809, 8), +(11366, 27132, 9), +(11366, 33938, 10), +(11366, 42890, 11), +(11366, 42891, 12), + -- Pyroclasm +(18096, 18096, 1), +(18096, 18073, 2), +(18096, 63245, 3), + -- Pyromaniac +(34293, 34293, 1), +(34293, 34295, 2), +(34293, 34296, 3), + -- Quick Recovery +(31244, 31244, 1), +(31244, 31245, 2), + -- Rage of Rivendare +(50117, 50117, 1), +(50117, 50118, 2), +(50117, 50119, 3), +(50117, 50120, 4), +(50117, 50121, 5), + -- Rake +(1822, 1822, 1), +(1822, 1823, 2), +(1822, 1824, 3), +(1822, 9904, 4), +(1822, 27003, 5), +(1822, 48573, 6), +(1822, 48574, 7), + -- Rake +(59881, 59881, 1), +(59881, 59882, 2), +(59881, 59883, 3), +(59881, 59884, 4), +(59881, 59885, 5), +(59881, 59886, 6), + -- Ranged Weapon Specialization +(19507, 19507, 1), +(19507, 19508, 2), +(19507, 19509, 3), + -- Rapid Recuperation +(53228, 53228, 1), +(53228, 53232, 2), + -- Raptor Strike +(2973, 2973, 1), +(2973, 14260, 2), +(2973, 14261, 3), +(2973, 14262, 4), +(2973, 14263, 5), +(2973, 14264, 6), +(2973, 14265, 7), +(2973, 14266, 8), +(2973, 27014, 9), +(2973, 48995, 10), +(2973, 48996, 11), + -- Rapture +(47535, 47535, 1), +(47535, 47536, 2), +(47535, 47537, 3), + -- Ravage +(6785, 6785, 1), +(6785, 6787, 2), +(6785, 9866, 3), +(6785, 9867, 4), +(6785, 27005, 5), +(6785, 48578, 6), +(6785, 48579, 7), + -- Ravage +(50518, 50518, 1), +(50518, 53558, 2), +(50518, 53559, 3), +(50518, 53560, 4), +(50518, 53561, 5), +(50518, 53562, 6), + -- Ravenous Dead +(48965, 48965, 1), +(48965, 49571, 2), +(48965, 49572, 3), + -- Reaping +(49208, 49208, 1), +(49208, 56834, 2), +(49208, 56835, 3), + -- Rebirth +(20484, 20484, 1), +(20484, 20739, 2), +(20484, 20742, 3), +(20484, 20747, 4), +(20484, 20748, 5), +(20484, 26994, 6), +(20484, 48477, 7), + -- Reckoning +(20177, 20177, 1), +(20177, 20179, 2), +(20177, 20181, 3), +(20177, 20180, 4), +(20177, 20182, 5), + -- Redemption +(7328, 7328, 1), +(7328, 10322, 2), +(7328, 10324, 3), +(7328, 20772, 4), +(7328, 20773, 5), +(7328, 48949, 6), +(7328, 48950, 7), + -- Redoubt +(20127, 20127, 1), +(20127, 20130, 2), +(20127, 20135, 3), + -- Reflective Shield +(33201, 33201, 1), +(33201, 33202, 2), + -- Regeneration +(30799, 30799, 1), +(30799, 30800, 2), +(30799, 30801, 3), + -- Regrowth +(8936, 8936, 1), +(8936, 8938, 2), +(8936, 8939, 3), +(8936, 8940, 4), +(8936, 8941, 5), +(8936, 9750, 6), +(8936, 9856, 7), +(8936, 9857, 8), +(8936, 9858, 9), +(8936, 26980, 10), +(8936, 48442, 11), +(8936, 48443, 12), + -- Rejuvenation +(774, 774, 1), +(774, 1058, 2), +(774, 1430, 3), +(774, 2090, 4), +(774, 2091, 5), +(774, 3627, 6), +(774, 8910, 7), +(774, 9839, 8), +(774, 9840, 9), +(774, 9841, 10), +(774, 25299, 11), +(774, 26981, 12), +(774, 26982, 13), +(774, 48440, 14), +(774, 48441, 15), + -- Relentless Strikes +(14179, 14179, 1), +(14179, 58422, 2), +(14179, 58423, 3), +(14179, 58424, 4), +(14179, 58425, 5), + -- Remorseless +(14143, 14143, 1), +(14143, 14149, 2), + -- Remorseless Attacks +(14144, 14144, 1), +(14144, 14148, 2), + -- Rend +(772, 772, 1), +(772, 6546, 2), +(772, 6547, 3), +(772, 6548, 4), +(772, 11572, 5), +(772, 11573, 6), +(772, 11574, 7), +(772, 25208, 8), +(772, 46845, 9), +(772, 47465, 10), + -- Rend and Tear +(48432, 48432, 1), +(48432, 48433, 2), +(48432, 48434, 3), +(48432, 51268, 4), +(48432, 51269, 5), + -- Renew +(139, 139, 1), +(139, 6074, 2), +(139, 6075, 3), +(139, 6076, 4), +(139, 6077, 5), +(139, 6078, 6), +(139, 10927, 7), +(139, 10928, 8), +(139, 10929, 9), +(139, 25315, 10), +(139, 25221, 11), +(139, 25222, 12), +(139, 48067, 13), +(139, 48068, 14), + -- Renewed Hope +(57470, 57470, 1), +(57470, 57472, 2), + -- Replenish Mana +(5405, 5405, 1), +(5405, 10052, 2), +(5405, 10057, 3), +(5405, 10058, 4), +(5405, 27103, 5), +(5405, 42987, 6), +(5405, 42988, 7), + -- Resourcefulness +(34491, 34491, 1), +(34491, 34492, 2), +(34491, 34493, 3), + -- Restorative Totems +(16187, 16187, 1), +(16187, 16205, 2), +(16187, 16206, 3), + -- Resurrection +(2006, 2006, 1), +(2006, 2010, 2), +(2006, 10880, 3), +(2006, 10881, 4), +(2006, 20770, 5), +(2006, 25435, 6), +(2006, 48171, 7), + -- Retribution Aura +(7294, 7294, 1), +(7294, 10298, 2), +(7294, 10299, 3), +(7294, 10300, 4), +(7294, 10301, 5), +(7294, 27150, 6), +(7294, 54043, 7), + -- Revenge +(6572, 6572, 1), +(6572, 6574, 2), +(6572, 7379, 3), +(6572, 11600, 4), +(6572, 11601, 5), +(6572, 25288, 6), +(6572, 25269, 7), +(6572, 30357, 8), +(6572, 57823, 9), + -- Reverberation +(16040, 16040, 1), +(16040, 16113, 2), +(16040, 16114, 3), +(16040, 16115, 4), +(16040, 16116, 5), + -- Revitalize +(48539, 48539, 1), +(48539, 48544, 2), +(48539, 48545, 3), + -- Revive +(50769, 50769, 1), +(50769, 50768, 2), +(50769, 50767, 3), +(50769, 50766, 4), +(50769, 50765, 5), +(50769, 50764, 6), +(50769, 50763, 7), + -- Righteous Vengeance +(53380, 53380, 1), +(53380, 53381, 2), +(53380, 53382, 3), + -- Rime +(49188, 49188, 1), +(49188, 56822, 2), +(49188, 59057, 3), + -- Rip +(1079, 1079, 1), +(1079, 9492, 2), +(1079, 9493, 3), +(1079, 9752, 4), +(1079, 9894, 5), +(1079, 9896, 6), +(1079, 27008, 7), +(1079, 49799, 8), +(1079, 49800, 9), + -- Riptide +(61295, 61295, 1), +(61295, 61299, 2), +(61295, 61300, 3), +(61295, 61301, 4), + -- Ritual of Refreshment +(43987, 43987, 1), +(43987, 58659, 2), + -- Ritual of Souls +(29893, 29893, 1), +(29893, 58887, 2), + -- Rockbiter Weapon +(8017, 8017, 1), +(8017, 8018, 2), +(8017, 8019, 3), +(8017, 10399, 4), + -- Ruin +(17959, 17959, 1), +(17959, 59738, 2), +(17959, 59739, 3), +(17959, 59740, 4), +(17959, 59741, 5), + -- Runic Power Mastery +(49455, 49455, 1), +(49455, 50147, 2), + -- Rupture +(1943, 1943, 1), +(1943, 8639, 2), +(1943, 8640, 3), +(1943, 11273, 4), +(1943, 11274, 5), +(1943, 11275, 6), +(1943, 26867, 7), +(1943, 48671, 8), +(1943, 48672, 9), + -- Ruthlessness +(14156, 14156, 1), +(14156, 14160, 2), +(14156, 14161, 3), + -- Sacred Cleansing +(53551, 53551, 1), +(53551, 53552, 2), +(53551, 53553, 3), + -- Sacred Duty +(31848, 31848, 1), +(31848, 31849, 2), + -- Sacrifice +(7812, 7812, 1), +(7812, 19438, 2), +(7812, 19440, 3), +(7812, 19441, 4), +(7812, 19442, 5), +(7812, 19443, 6), +(7812, 27273, 7), +(7812, 47985, 8), +(7812, 47986, 9), + -- Sanctified Light +(20359, 20359, 1), +(20359, 20360, 2), +(20359, 20361, 3), + -- Sanctified Wrath +(53375, 53375, 1), +(53375, 53376, 2), + -- Sanctity of Battle +(32043, 32043, 1), +(32043, 35396, 2), +(32043, 35397, 3), + -- Sap +(6770, 6770, 1), +(6770, 2070, 2), +(6770, 11297, 3), +(6770, 51724, 4), + -- Savage Combat +(58684, 58684, 1), +(58684, 58683, 2), + -- Savage Combat +(51682, 51682, 1), +(51682, 58413, 2), + -- Savage Fury +(16998, 16998, 1), +(16998, 16999, 2), + -- Savage Strikes +(19159, 19159, 1), +(19159, 19160, 2), + -- Scare Beast +(1513, 1513, 1), +(1513, 14326, 2), +(1513, 14327, 3), + -- Scent of Blood +(49004, 49004, 1), +(49004, 49508, 2), +(49004, 49509, 3), + -- Scorch +(1811, 1811, 1), +(1811, 8447, 2), +(1811, 8448, 3), +(1811, 8449, 4), +(1811, 10208, 5), +(1811, 10209, 6), +(1811, 10210, 7), +(1811, 27375, 8), +(1811, 27376, 9), + -- Scorch +(2948, 2948, 1), +(2948, 8444, 2), +(2948, 8445, 3), +(2948, 8446, 4), +(2948, 10205, 5), +(2948, 10206, 6), +(2948, 10207, 7), +(2948, 27073, 8), +(2948, 27074, 9), +(2948, 42858, 10), +(2948, 42859, 11), + -- Scorpid Poison +(24641, 24641, 1), +(24641, 24584, 2), +(24641, 24588, 3), +(24641, 24589, 4), +(24641, 27361, 5), + -- Scorpid Poison +(24640, 24640, 1), +(24640, 24583, 2), +(24640, 24586, 3), +(24640, 24587, 4), +(24640, 27060, 5), +(24640, 55728, 6), + -- Scourge Strike +(55090, 55090, 1), +(55090, 55265, 2), +(55090, 55270, 3), +(55090, 55271, 4), + -- Seal Fate +(14186, 14186, 1), +(14186, 14190, 2), +(14186, 14193, 3), +(14186, 14194, 4), +(14186, 14195, 5), + -- Seals of the Pure +(20224, 20224, 1), +(20224, 20225, 2), +(20224, 20330, 3), +(20224, 20331, 4), +(20224, 20332, 5), + -- Searing Light +(14909, 14909, 1), +(14909, 15017, 2), + -- Searing Pain +(5676, 5676, 1), +(5676, 17919, 2), +(5676, 17920, 3), +(5676, 17921, 4), +(5676, 17922, 5), +(5676, 17923, 6), +(5676, 27210, 7), +(5676, 30459, 8), +(5676, 47814, 9), +(5676, 47815, 10), + -- Searing Totem +(2075, 2075, 1), +(2075, 38116, 2), + -- Searing Totem +(3599, 3599, 1), +(3599, 6363, 2), +(3599, 6364, 3), +(3599, 6365, 4), +(3599, 10437, 5), +(3599, 10438, 6), +(3599, 25533, 7), +(3599, 58699, 8), +(3599, 58703, 9), +(3599, 58704, 10), + -- Seed of Corruption +(43991, 43991, 1), +(43991, 47831, 2), +(43991, 47832, 3), + -- Serendipity +(63730, 63730, 1), +(63730, 63733, 2), +(63730, 63737, 3), + -- Serenity Dust +(50318, 50318, 1), +(50318, 52012, 2), +(50318, 52013, 3), +(50318, 52014, 4), +(50318, 52015, 5), +(50318, 52016, 6), + -- Serious Wound +(5597, 5597, 1), +(5597, 5598, 2), + -- Serpent Sting +(1978, 1978, 1), +(1978, 13549, 2), +(1978, 13550, 3), +(1978, 13551, 4), +(1978, 13552, 5), +(1978, 13553, 6), +(1978, 13554, 7), +(1978, 13555, 8), +(1978, 25295, 9), +(1978, 27016, 10), +(1978, 49000, 11), +(1978, 49001, 12), + -- Serpent's Swiftness +(34466, 34466, 1), +(34466, 34467, 2), +(34466, 34468, 3), +(34466, 34469, 4), +(34466, 34470, 5), + -- Serrated Blades +(14171, 14171, 1), +(14171, 14172, 2), +(14171, 14173, 3), + -- Setup +(13983, 13983, 1), +(13983, 14070, 2), +(13983, 14071, 3), + -- Shackle Undead +(9484, 9484, 1), +(9484, 9485, 2), +(9484, 10955, 3), + -- Shadow Affinity +(15318, 15318, 1), +(15318, 15272, 2), +(15318, 15320, 3), + -- Shadow and Flame +(30288, 30288, 1), +(30288, 30289, 2), +(30288, 30290, 3), +(30288, 30291, 4), +(30288, 30292, 5), + -- Shadow Bite +(54049, 54049, 1), +(54049, 54050, 2), +(54049, 54051, 3), +(54049, 54052, 4), +(54049, 54053, 5), + -- Shadow Bolt +(686, 686, 1), +(686, 695, 2), +(686, 705, 3), +(686, 1088, 4), +(686, 1106, 5), +(686, 7641, 6), +(686, 11659, 7), +(686, 11660, 8), +(686, 11661, 9), +(686, 25307, 10), +(686, 27209, 11), +(686, 47808, 12), +(686, 47809, 13), + -- Shadow Embrace +(32385, 32385, 1), +(32385, 32387, 2), +(32385, 32392, 3), +(32385, 32393, 4), +(32385, 32394, 5), + -- Shadow Focus +(15260, 15260, 1), +(15260, 15327, 2), +(15260, 15328, 3), + -- Shadow Mastery +(18271, 18271, 1), +(18271, 18272, 2), +(18271, 18273, 3), +(18271, 18274, 4), +(18271, 18275, 5), + -- Shadow Power +(33221, 33221, 1), +(33221, 33222, 2), +(33221, 33223, 3), +(33221, 33224, 4), +(33221, 33225, 5), + -- Shadow Protection +(976, 976, 1), +(976, 10957, 2), +(976, 10958, 3), +(976, 25433, 4), +(976, 48169, 5), + -- Shadow Reach +(17322, 17322, 1), +(17322, 17323, 2), + -- Shadow Resistance Aura +(19876, 19876, 1), +(19876, 19895, 2), +(19876, 19896, 3), +(19876, 27151, 4), +(19876, 48943, 5), + -- Shadow Ward +(6229, 6229, 1), +(6229, 11739, 2), +(6229, 11740, 3), +(6229, 28610, 4), +(6229, 47890, 5), +(6229, 47891, 6), + -- Shadow Weaving +(15257, 15257, 1), +(15257, 15331, 2), +(15257, 15332, 3), + -- Shadow Word: Death +(32379, 32379, 1), +(32379, 32996, 2), +(32379, 48157, 3), +(32379, 48158, 4), + -- Shadow Word: Pain +(589, 589, 1), +(589, 594, 2), +(589, 970, 3), +(589, 992, 4), +(589, 2767, 5), +(589, 10892, 6), +(589, 10893, 7), +(589, 10894, 8), +(589, 25367, 9), +(589, 25368, 10), +(589, 48124, 11), +(589, 48125, 12), + -- Shadowburn +(17877, 17877, 1), +(17877, 18867, 2), +(17877, 18868, 3), +(17877, 18869, 4), +(17877, 18870, 5), +(17877, 18871, 6), +(17877, 27263, 7), +(17877, 30546, 8), +(17877, 47826, 9), +(17877, 47827, 10), + -- Shadowflame +(47897, 47897, 1), +(47897, 61290, 2), + -- Shadowfury +(30283, 30283, 1), +(30283, 30413, 2), +(30283, 30414, 3), +(30283, 47846, 4), +(30283, 47847, 5), + -- Shamanism +(62097, 62097, 1), +(62097, 62098, 2), +(62097, 62099, 3), +(62097, 62100, 4), +(62097, 62101, 5), + -- Shark Attack +(62759, 62759, 1), +(62759, 62760, 2), + -- Sharpened Claws +(16942, 16942, 1), +(16942, 16943, 2), +(16942, 16944, 3), + -- Shatter +(11170, 11170, 1), +(11170, 12982, 2), +(11170, 12983, 3), + -- Shattered Barrier +(44745, 44745, 1), +(44745, 54787, 2), + -- Sheath of Light +(53501, 53501, 1), +(53501, 53502, 2), +(53501, 53503, 3), + -- Shield Mastery +(29598, 29598, 1), +(29598, 29599, 2), + -- Shield of Righteousness +(53600, 53600, 1), +(53600, 61411, 2), + -- Shield of the Templar +(53709, 53709, 1), +(53709, 53710, 2), +(53709, 53711, 3), + -- Shield Slam +(23922, 23922, 1), +(23922, 23923, 2), +(23922, 23924, 3), +(23922, 23925, 4), +(23922, 25258, 5), +(23922, 30356, 6), +(23922, 47487, 7), +(23922, 47488, 8), + -- Shield Specialization +(12298, 12298, 1), +(12298, 12724, 2), +(12298, 12725, 3), +(12298, 12726, 4), +(12298, 12727, 5), + -- Shield Specialization +(16253, 16253, 1), +(16253, 16298, 2), + -- Shock +(2607, 2607, 1), +(2607, 2606, 2), +(2607, 2608, 3), +(2607, 2609, 4), +(2607, 2610, 5), + -- Shred +(5221, 5221, 1), +(5221, 6800, 2), +(5221, 8992, 3), +(5221, 9829, 4), +(5221, 9830, 5), +(5221, 27001, 6), +(5221, 27002, 7), +(5221, 48571, 8), +(5221, 48572, 9), + -- Shredding Attacks +(16966, 16966, 1), +(16966, 16968, 2), + -- Silenced - Improved Counterspell +(18469, 18469, 1), +(18469, 55021, 2), + -- Silent Hunter +(34472, 34472, 1), +(34472, 34473, 2), +(34472, 34474, 3), + -- Silent Resolve +(14523, 14523, 1), +(14523, 14784, 2), +(14523, 14785, 3), + -- Silverback +(62764, 62764, 1), +(62764, 62765, 2), + -- Sinister Calling +(31216, 31216, 1), +(31216, 31217, 2), +(31216, 31218, 3), +(31216, 31219, 4), +(31216, 31220, 5), + -- Sinister Strike +(1752, 1752, 1), +(1752, 1757, 2), +(1752, 1758, 3), +(1752, 1759, 4), +(1752, 1760, 5), +(1752, 8621, 6), +(1752, 11293, 7), +(1752, 11294, 8), +(1752, 26861, 9), +(1752, 26862, 10), +(1752, 48637, 11), +(1752, 48638, 12), + -- Skinning +(8613, 8613, 1), +(8613, 8617, 2), +(8613, 8618, 3), +(8613, 10768, 4), +(8613, 32678, 5), +(8613, 50305, 6), + -- Slam +(1464, 1464, 1), +(1464, 8820, 2), +(1464, 11604, 3), +(1464, 11605, 4), +(1464, 25241, 5), +(1464, 25242, 6), +(1464, 47474, 7), +(1464, 47475, 8), + -- Slaughter from the Shadows +(51708, 51708, 1), +(51708, 51709, 2), +(51708, 51710, 3), +(51708, 51711, 4), +(51708, 51712, 5), + -- Sleep +(700, 700, 1), +(700, 1090, 2), + -- Sleight of Hand +(30892, 30892, 1), +(30892, 30893, 2), + -- Slice and Dice +(5171, 5171, 1), +(5171, 6774, 2), + -- Slow +(246, 246, 1), +(246, 6146, 2), + -- Smack +(49966, 49966, 1), +(49966, 49967, 2), +(49966, 49968, 3), +(49966, 49969, 4), +(49966, 49970, 5), +(49966, 49971, 6), +(49966, 49972, 7), +(49966, 49973, 8), +(49966, 49974, 9), +(49966, 52475, 10), +(49966, 52476, 11), + -- Smite +(585, 585, 1), +(585, 591, 2), +(585, 598, 3), +(585, 984, 4), +(585, 1004, 5), +(585, 6060, 6), +(585, 10933, 7), +(585, 10934, 8), +(585, 25363, 9), +(585, 25364, 10), +(585, 48122, 11), +(585, 48123, 12), + -- Snatch +(50541, 50541, 1), +(50541, 53537, 2), +(50541, 53538, 3), +(50541, 53540, 4), +(50541, 53542, 5), +(50541, 53543, 6), + -- Sniper Training +(53302, 53302, 1), +(53302, 53303, 2), +(53302, 53304, 3), + -- Sonic Blast +(50519, 50519, 1), +(50519, 53564, 2), +(50519, 53565, 3), +(50519, 53566, 4), +(50519, 53567, 5), +(50519, 53568, 6), + -- Soothe Animal +(2908, 2908, 1), +(2908, 8955, 2), +(2908, 9901, 3), +(2908, 26995, 4), + -- Soothing Kiss +(6360, 6360, 1), +(6360, 7813, 2), +(6360, 11784, 3), +(6360, 11785, 4), +(6360, 27275, 5), + -- Soul Fire +(6353, 6353, 1), +(6353, 17924, 2), +(6353, 27211, 3), +(6353, 30545, 4), +(6353, 47824, 5), +(6353, 47825, 6), + -- Soul Leech +(30293, 30293, 1), +(30293, 30295, 2), +(30293, 30296, 3), + -- Soul Siphon +(17804, 17804, 1), +(17804, 17805, 2), + -- Spark of Nature +(48435, 48435, 1), +(48435, 48436, 2), +(48435, 48437, 3), + -- Spell Deflection +(49145, 49145, 1), +(49145, 49495, 2), +(49145, 49497, 3), + -- Spell Impact +(11242, 11242, 1), +(11242, 12467, 2), +(11242, 12469, 3), + -- Spell Lock +(19244, 19244, 1), +(19244, 19647, 2), + -- Spell Power +(35578, 35578, 1), +(35578, 35581, 2), + -- Spell Warding +(27900, 27900, 1), +(27900, 27901, 2), +(27900, 27902, 3), +(27900, 27903, 4), +(27900, 27904, 5), + -- Spider's Bite +(53203, 53203, 1), +(53203, 53204, 2), +(53203, 53205, 3), + -- Spiked Collar +(53182, 53182, 1), +(53182, 53183, 2), +(53182, 53184, 3), + -- Spirit +(8112, 8112, 1), +(8112, 8113, 2), +(8112, 8114, 3), +(8112, 12177, 4), +(8112, 33080, 5), +(8112, 43197, 6), +(8112, 48103, 7), +(8112, 48104, 8), + -- Spirit Strike +(61193, 61193, 1), +(61193, 61194, 2), +(61193, 61195, 3), +(61193, 61196, 4), +(61193, 61197, 5), +(61193, 61198, 6), + -- Spirit Tap +(15270, 15270, 1), +(15270, 15335, 2), +(15270, 15336, 3), + -- Spiritual Attunement +(31785, 31785, 1), +(31785, 33776, 2), + -- Spiritual Focus +(20205, 20205, 1), +(20205, 20206, 2), +(20205, 20207, 3), +(20205, 20209, 4), +(20205, 20208, 5), + -- Spiritual Guidance +(14901, 14901, 1), +(14901, 15028, 2), +(14901, 15029, 3), +(14901, 15030, 4), +(14901, 15031, 5), + -- Spiritual Healing +(14898, 14898, 1), +(14898, 15349, 2), +(14898, 15354, 3), +(14898, 15355, 4), +(14898, 15356, 5), + -- Spore Cloud +(50274, 50274, 1), +(50274, 53593, 2), +(50274, 53594, 3), +(50274, 53596, 4), +(50274, 53597, 5), +(50274, 53598, 6), + -- Sprint +(2983, 2983, 1), +(2983, 8696, 2), +(2983, 11305, 3), + -- Stampede +(57386, 57386, 1), +(57386, 57389, 2), +(57386, 57390, 3), +(57386, 57391, 4), +(57386, 57392, 5), +(57386, 57393, 6), + -- Starfall +(48505, 48505, 1), +(48505, 53199, 2), +(48505, 53200, 3), +(48505, 53201, 4), + -- Starfire +(2912, 2912, 1), +(2912, 8949, 2), +(2912, 8950, 3), +(2912, 8951, 4), +(2912, 9875, 5), +(2912, 9876, 6), +(2912, 25298, 7), +(2912, 26986, 8), +(2912, 48464, 9), +(2912, 48465, 10), + -- Starlight Wrath +(16814, 16814, 1), +(16814, 16815, 2), +(16814, 16816, 3), +(16814, 16817, 4), +(16814, 16818, 5), + -- Static Shock +(51525, 51525, 1), +(51525, 51526, 2), +(51525, 51527, 3), + -- Steady Shot +(56641, 56641, 1), +(56641, 34120, 2), +(56641, 49051, 3), +(56641, 49052, 4), + -- Stealth +(1784, 1784, 1), +(1784, 1785, 2), +(1784, 1786, 3), +(1784, 1787, 4), + -- Sting +(56626, 56626, 1), +(56626, 56627, 2), +(56626, 56628, 3), +(56626, 56629, 4), +(56626, 56630, 5), +(56626, 56631, 6), + -- Stoicism +(31844, 31844, 1), +(31844, 31845, 2), +(31844, 53519, 3), + -- Stoneclaw Totem +(5730, 5730, 1), +(5730, 6390, 2), +(5730, 6391, 3), +(5730, 6392, 4), +(5730, 10427, 5), +(5730, 10428, 6), +(5730, 25525, 7), +(5730, 58580, 8), +(5730, 58581, 9), +(5730, 58582, 10), + -- Stoneclaw Totem Passive +(5728, 5728, 1), +(5728, 6397, 2), +(5728, 6398, 3), +(5728, 6399, 4), +(5728, 10425, 5), +(5728, 10426, 6), +(5728, 25513, 7), +(5728, 58583, 8), +(5728, 58584, 9), +(5728, 58585, 10), + -- Stoneskin +(8072, 8072, 1), +(8072, 8156, 2), +(8072, 8157, 3), +(8072, 10403, 4), +(8072, 10404, 5), +(8072, 10405, 6), +(8072, 25506, 7), +(8072, 25507, 8), +(8072, 58752, 9), +(8072, 58754, 10), + -- Stoneskin Totem +(8073, 8073, 1), +(8073, 38115, 2), + -- Stoneskin Totem +(8071, 8071, 1), +(8071, 8154, 2), +(8071, 8155, 3), +(8071, 10406, 4), +(8071, 10407, 5), +(8071, 10408, 6), +(8071, 25508, 7), +(8071, 25509, 8), +(8071, 58751, 9), +(8071, 58753, 10), + -- Storm, Earth and Fire +(51483, 51483, 1), +(51483, 51485, 2), +(51483, 51486, 3), + -- Strength +(8118, 8118, 1), +(8118, 8119, 2), +(8118, 8120, 3), +(8118, 12179, 4), +(8118, 33082, 5), +(8118, 43199, 6), +(8118, 58448, 7), +(8118, 58449, 8), + -- Strength of Arms +(46865, 46865, 1), +(46865, 46866, 2), + -- Strength of Earth Totem +(8075, 8075, 1), +(8075, 8160, 2), +(8075, 8161, 3), +(8075, 10442, 4), +(8075, 25361, 5), +(8075, 25528, 6), +(8075, 57622, 7), +(8075, 58643, 8), + -- Student of the Mind +(44397, 44397, 1), +(44397, 44398, 2), +(44397, 44399, 3), + -- Stunning Blast +(5648, 5648, 1), +(5648, 5649, 2), + -- Stunning Blow +(5726, 5726, 1), +(5726, 5727, 2), + -- Subtlety +(17118, 17118, 1), +(17118, 17119, 2), +(17118, 17120, 3), + -- Subversion +(48997, 48997, 1), +(48997, 49490, 2), +(48997, 49491, 3), + -- Sudden Death +(29723, 29723, 1), +(29723, 29725, 2), +(29723, 29724, 3), + -- Sudden Doom +(49018, 49018, 1), +(49018, 49529, 2), +(49018, 49530, 3), + -- Suffering +(17735, 17735, 1), +(17735, 17750, 2), +(17735, 17751, 3), +(17735, 17752, 4), +(17735, 27271, 5), +(17735, 33701, 6), +(17735, 47989, 7), +(17735, 47990, 8), + -- Suppression +(18174, 18174, 1), +(18174, 18175, 2), +(18174, 18176, 3), + -- Surefooted +(19290, 19290, 1), +(19290, 19294, 2), +(19290, 24283, 3), + -- Survival Instincts +(34494, 34494, 1), +(34494, 34496, 2), + -- Survival of the Fittest +(33853, 33853, 1), +(33853, 33855, 2), +(33853, 33856, 3), + -- Survival Tactics +(19286, 19286, 1), +(19286, 19287, 2), + -- Survivalist +(19255, 19255, 1), +(19255, 19256, 2), +(19255, 19257, 3), +(19255, 19258, 4), +(19255, 19259, 5), + -- Swift Retribution +(53379, 53379, 1), +(53379, 53484, 2), +(53379, 53648, 3), + -- Swipe +(50256, 50256, 1), +(50256, 53526, 2), +(50256, 53528, 3), +(50256, 53529, 4), +(50256, 53532, 5), +(50256, 53533, 6), + -- Swipe (Bear) +(779, 779, 1), +(779, 780, 2), +(779, 769, 3), +(779, 9754, 4), +(779, 9908, 5), +(779, 26997, 6), +(779, 48561, 7), +(779, 48562, 8), + -- Sword and Board +(46951, 46951, 1), +(46951, 46952, 2), +(46951, 46953, 3), + -- Sword Specialization +(12281, 12281, 1), +(12281, 12812, 2), +(12281, 12813, 3), +(12281, 12814, 4), +(12281, 12815, 5), + -- T.N.T. +(56333, 56333, 1), +(56333, 56336, 2), +(56333, 56337, 3), + -- Tactical Mastery +(12295, 12295, 1), +(12295, 12676, 2), +(12295, 12677, 3), + -- Tailoring +(3908, 3908, 1), +(3908, 3909, 2), +(3908, 3910, 3), +(3908, 12180, 4), +(3908, 26790, 5), +(3908, 51309, 6), + -- Taste for Blood +(56636, 56636, 1), +(56636, 56637, 2), +(56636, 56638, 3), + -- Tendon Rip +(50271, 50271, 1), +(50271, 53571, 2), +(50271, 53572, 3), +(50271, 53573, 4), +(50271, 53574, 5), +(50271, 53575, 6), + -- Test of Faith +(47558, 47558, 1), +(47558, 47559, 2), +(47558, 47560, 3), + -- Thick Hide +(19609, 19609, 1), +(19609, 19610, 2), +(19609, 19612, 3), + -- Thick Hide +(16929, 16929, 1), +(16929, 16930, 2), +(16929, 16931, 3), + -- Thorns +(467, 467, 1), +(467, 782, 2), +(467, 1075, 3), +(467, 8914, 4), +(467, 9756, 5), +(467, 9910, 6), +(467, 26992, 7), +(467, 53307, 8), + -- Threat of Thassarian +(65661, 65661, 1), +(65661, 66191, 2), +(65661, 66192, 3), + -- Thrill of the Hunt +(34497, 34497, 1), +(34497, 34498, 2), +(34497, 34499, 3), + -- Throwing Specialization +(5952, 5952, 1), +(5952, 51679, 2), + -- Thunder Clap +(6343, 6343, 1), +(6343, 8198, 2), +(6343, 8204, 3), +(6343, 8205, 4), +(6343, 11580, 5), +(6343, 11581, 6), +(6343, 25264, 7), +(6343, 47501, 8), +(6343, 47502, 9), + -- Thundering Strikes +(16255, 16255, 1), +(16255, 16302, 2), +(16255, 16303, 3), +(16255, 16304, 4), +(16255, 16305, 5), + -- Thunderstorm +(51490, 51490, 1), +(51490, 59156, 2), +(51490, 59158, 3), +(51490, 59159, 4), + -- Tidal Focus +(16179, 16179, 1), +(16179, 16214, 2), +(16179, 16215, 3), +(16179, 16216, 4), +(16179, 16217, 5), + -- Tidal Mastery +(16194, 16194, 1), +(16194, 16218, 2), +(16194, 16219, 3), +(16194, 16220, 4), +(16194, 16221, 5), + -- Tidal Waves +(51562, 51562, 1), +(51562, 51563, 2), +(51562, 51564, 3), +(51562, 51565, 4), +(51562, 51566, 5), + -- Tiger's Fury +(5217, 5217, 1), +(5217, 6793, 2), +(5217, 9845, 3), +(5217, 9846, 4), +(5217, 50212, 5), +(5217, 50213, 6), + -- Torment +(3716, 3716, 1), +(3716, 7809, 2), +(3716, 7810, 3), +(3716, 7811, 4), +(3716, 11774, 5), +(3716, 11775, 6), +(3716, 27270, 7), +(3716, 47984, 8), + -- Torment the Weak +(29447, 29447, 1), +(29447, 55339, 2), +(29447, 55340, 3), + -- Torture +(47263, 47263, 1), +(47263, 47264, 2), +(47263, 47265, 3), + -- Totem of Wrath +(30706, 30706, 1), +(30706, 57720, 2), +(30706, 57721, 3), +(30706, 57722, 4), + -- Totemic Focus +(16173, 16173, 1), +(16173, 16222, 2), +(16173, 16223, 3), +(16173, 16224, 4), +(16173, 16225, 5), + -- Touched by the Light +(53590, 53590, 1), +(53590, 53591, 2), +(53590, 53592, 3), + -- Toughness +(53120, 53120, 1), +(53120, 53121, 2), +(53120, 53122, 3), +(53120, 53123, 4), +(53120, 53124, 5), +(53120, 53040, 6), + -- Toughness +(12299, 12299, 1), +(12299, 12761, 2), +(12299, 12762, 3), +(12299, 12763, 4), +(12299, 12764, 5), + -- Toughness +(20143, 20143, 1), +(20143, 20144, 2), +(20143, 20145, 3), +(20143, 20146, 4), +(20143, 20147, 5), + -- Toughness +(16252, 16252, 1), +(16252, 16306, 2), +(16252, 16307, 3), +(16252, 16308, 4), +(16252, 16309, 5), + -- Toughness +(49042, 49042, 1), +(49042, 49786, 2), +(49042, 49787, 3), +(49042, 49788, 4), +(49042, 49789, 5), + -- Tranquil Spirit +(24968, 24968, 1), +(24968, 24969, 2), +(24968, 24970, 3), +(24968, 24971, 4), +(24968, 24972, 5), + -- Trap Mastery +(19376, 19376, 1), +(19376, 63457, 2), +(19376, 63458, 3), + -- Tundra Stalker +(49202, 49202, 1), +(49202, 50127, 2), +(49202, 50128, 3), +(49202, 50129, 4), +(49202, 50130, 5), + -- Turn the Tables +(51627, 51627, 1), +(51627, 51628, 2), +(51627, 51629, 3), + -- Twin Disciplines +(47586, 47586, 1), +(47586, 47587, 2), +(47586, 47588, 3), +(47586, 52802, 4), +(47586, 52803, 5), + -- Twisted Faith +(47573, 47573, 1), +(47573, 47577, 2), +(47573, 47578, 3), +(47573, 51166, 4), +(47573, 51167, 5), + -- Two-Handed Weapon Specialization +(12163, 12163, 1), +(12163, 12711, 2), +(12163, 12712, 3), + -- Two-Handed Weapon Specialization +(20111, 20111, 1), +(20111, 20112, 2), +(20111, 20113, 3), + -- Two-Handed Weapon Specialization +(55107, 55107, 1), +(55107, 55108, 2), + -- Unbreakable Will +(14522, 14522, 1), +(14522, 14788, 2), +(14522, 14789, 3), +(14522, 14790, 4), +(14522, 14791, 5), + -- Unending Fury +(56927, 56927, 1), +(56927, 56929, 2), +(56927, 56930, 3), +(56927, 56931, 4), +(56927, 56932, 5), + -- Unholy Command +(49588, 49588, 1), +(49588, 49589, 2), + -- Unholy Power +(18769, 18769, 1), +(18769, 18770, 2), +(18769, 18771, 3), +(18769, 18772, 4), +(18769, 18773, 5), + -- Unleashed Fury +(19616, 19616, 1), +(19616, 19617, 2), +(19616, 19618, 3), +(19616, 19619, 4), +(19616, 19620, 5), + -- Unrelenting Assault +(46859, 46859, 1), +(46859, 46860, 2), + -- Unrelenting Storm +(30664, 30664, 1), +(30664, 30665, 2), +(30664, 30666, 3), + -- Unstable Affliction +(30108, 30108, 1), +(30108, 30404, 2), +(30108, 30405, 3), +(30108, 47841, 4), +(30108, 47843, 5), + -- Unyielding Faith +(9453, 9453, 1), +(9453, 25836, 2), + -- Vampiric Touch +(34914, 34914, 1), +(34914, 34916, 2), +(34914, 34917, 3), +(34914, 48159, 4), +(34914, 48160, 5), + -- Vanish +(1856, 1856, 1), +(1856, 1857, 2), +(1856, 26889, 3), + -- Veiled Shadows +(15274, 15274, 1), +(15274, 15311, 2), + -- Vendetta +(49015, 49015, 1), +(49015, 50154, 2), +(49015, 55136, 3), + -- Vengeance +(20049, 20049, 1), +(20049, 20056, 2), +(20049, 20057, 3), + -- Vengeance +(16909, 16909, 1), +(16909, 16910, 2), +(16909, 16911, 3), +(16909, 16912, 4), +(16909, 16913, 5), + -- Venom Web Spray +(54706, 54706, 1), +(54706, 55505, 2), +(54706, 55506, 3), +(54706, 55507, 4), +(54706, 55508, 5), +(54706, 55509, 6), + -- Veteran of the Third War +(49006, 49006, 1), +(49006, 49526, 2), +(49006, 50029, 3), + -- Vicious Strikes +(51745, 51745, 1), +(51745, 51746, 2), + -- Vile Poisons +(16513, 16513, 1), +(16513, 16514, 2), +(16513, 16515, 3), + -- Virulence +(48962, 48962, 1), +(48962, 49567, 2), +(48962, 49568, 3), + -- Vitality +(31122, 31122, 1), +(31122, 31123, 2), +(31122, 61329, 3), + -- Vitality +(29140, 29140, 1), +(29140, 29143, 2), +(29140, 29144, 3), + -- Wand Specialization +(14524, 14524, 1), +(14524, 14525, 2), +(14524, 14526, 3), +(14524, 14527, 4), +(14524, 14528, 5), + -- Wandering Plague +(49217, 49217, 1), +(49217, 49654, 2), +(49217, 49655, 3), + -- Water Shield +(52127, 52127, 1), +(52127, 52129, 2), +(52127, 52131, 3), +(52127, 52134, 4), +(52127, 52136, 5), +(52127, 52138, 6), +(52127, 24398, 7), +(52127, 33736, 8), +(52127, 57960, 9), + -- Waylay +(51692, 51692, 1), +(51692, 51696, 2), + -- Weapon Expertise +(30919, 30919, 1), +(30919, 30920, 2), + -- Weapon Mastery +(20504, 20504, 1), +(20504, 20505, 2), + -- Weapon Mastery +(29082, 29082, 1), +(29082, 29084, 2), +(29082, 29086, 3), + -- Wild Growth +(48438, 48438, 1), +(48438, 53248, 2), +(48438, 53249, 3), +(48438, 53251, 4), + -- Wild Hunt +(62758, 62758, 1), +(62758, 62762, 2), + -- Wild Quiver +(53215, 53215, 1), +(53215, 53216, 2), +(53215, 53217, 3), + -- Windfury Weapon +(8232, 8232, 1), +(8232, 8235, 2), +(8232, 10486, 3), +(8232, 16362, 4), +(8232, 25505, 5), +(8232, 58801, 6), +(8232, 58803, 7), +(8232, 58804, 8), + -- Winter's Chill +(11180, 11180, 1), +(11180, 28592, 2), +(11180, 28593, 3), + -- World in Flames +(11108, 11108, 1), +(11108, 12349, 2), +(11108, 12350, 3), + -- Wrath +(5176, 5176, 1), +(5176, 5177, 2), +(5176, 5178, 3), +(5176, 5179, 4), +(5176, 5180, 5), +(5176, 6780, 6), +(5176, 8905, 7), +(5176, 9912, 8), +(5176, 26984, 9), +(5176, 26985, 10), +(5176, 48459, 11), +(5176, 48461, 12), + -- Wrath of Cenarius +(33603, 33603, 1), +(33603, 33604, 2), +(33603, 33605, 3), +(33603, 33606, 4), +(33603, 33607, 5), + -- Wrecking Crew +(46867, 46867, 1), +(46867, 56611, 2), +(46867, 56612, 3), +(46867, 56613, 4), +(46867, 56614, 5), + -- Arcane Brilliance +(23030, 23030, 1), +(23030, 27394, 2), + -- Arcane Explosion +(1467, 1467, 1), +(1467, 8440, 2), +(1467, 8441, 3), +(1467, 8442, 4), +(1467, 10203, 5), +(1467, 10204, 6), +(1467, 27380, 7), +(1467, 27381, 8), + -- Arcane Intellect +(1472, 1472, 1), +(1472, 1473, 2), +(1472, 1474, 3), +(1472, 1475, 4), +(1472, 10158, 5), +(1472, 27393, 6), +(1472, 42999, 7), + -- Arcane Missiles +(5143, 5143, 1), +(5143, 5144, 2), +(5143, 5145, 3), +(5143, 8416, 4), +(5143, 8417, 5), +(5143, 10211, 6), +(5143, 10212, 7), +(5143, 25345, 8), +(5143, 27075, 9), +(5143, 38699, 10), +(5143, 38704, 11), +(5143, 42843, 12), +(5143, 42846, 13), + -- Blessed Recovery +(27811, 27811, 1), +(27811, 27815, 2), +(27811, 27816, 3), + -- Blessed Recovery +(27813, 27813, 1), +(27813, 27817, 2), +(27813, 27818, 3), + -- Blessed Resilience +(33142, 33142, 1), +(33142, 33145, 2), +(33142, 33146, 3), + -- Blizzard +(1196, 1196, 1), +(1196, 6142, 2), +(1196, 8428, 3), +(1196, 10188, 4), +(1196, 10189, 5), +(1196, 10190, 6), +(1196, 27384, 7), + -- Blizzard +(42208, 42208, 1), +(42208, 42209, 2), +(42208, 42210, 3), +(42208, 42211, 4), +(42208, 42212, 5), +(42208, 42213, 6), +(42208, 42198, 7), +(42208, 42937, 8), +(42208, 42938, 9), + -- Blizzard +(10, 10, 1), +(10, 6141, 2), +(10, 8427, 3), +(10, 10185, 4), +(10, 10186, 5), +(10, 10187, 6), +(10, 27085, 7), +(10, 42939, 8), +(10, 42940, 9), + -- Chain Lightning +(421, 421, 1), +(421, 930, 2), +(421, 2860, 3), +(421, 10605, 4), +(421, 25439, 5), +(421, 25442, 6), +(421, 49270, 7), +(421, 49271, 8), + -- Chain Lightning +(45297, 45297, 1), +(45297, 45298, 2), +(45297, 45299, 3), +(45297, 45300, 4), +(45297, 45301, 5), +(45297, 45302, 6), +(45297, 49268, 7), +(45297, 49269, 8), + -- Chains of Ice +(113, 113, 1), +(113, 512, 2), + -- Charge +(7370, 7370, 1), +(7370, 26184, 2), +(7370, 26185, 3), +(7370, 26186, 4), +(7370, 26202, 5), +(7370, 28343, 6), + -- Consume Shadows +(17776, 17776, 1), +(17776, 17855, 2), +(17776, 17856, 3), +(17776, 17857, 4), +(17776, 17859, 5), +(17776, 17860, 6), + -- Consume Shadows +(20387, 20387, 1), +(20387, 20388, 2), +(20387, 20389, 3), +(20387, 20390, 4), +(20387, 20391, 5), +(20387, 20392, 6), +(20387, 27491, 7), +(20387, 48003, 8), +(20387, 48004, 9), + -- Echoes of Lordaeron +(6966, 6966, 1), +(6966, 30880, 2), +(6966, 30683, 3), +(6966, 30682, 4), +(6966, 29520, 5), + -- Echoes of Lordaeron +(6964, 6964, 1), +(6964, 11413, 2), +(6964, 11414, 3), +(6964, 11415, 4), +(6964, 1386, 5), + -- Eye for an Eye +(9799, 9799, 1), +(9799, 25988, 2), + -- Fire Nova +(8350, 8350, 1), +(8350, 8508, 2), +(8350, 8509, 3), +(8350, 11312, 4), +(8350, 11313, 5), +(8350, 25540, 6), +(8350, 25544, 7), +(8350, 61658, 8), +(8350, 61659, 9), + -- Fire Nova +(8443, 8443, 1), +(8443, 8504, 2), +(8443, 8505, 3), +(8443, 11310, 4), +(8443, 11311, 5), +(8443, 25538, 6), +(8443, 25539, 7), +(8443, 61651, 8), +(8443, 61660, 9), + -- Fire Protection +(7230, 7230, 1), +(7230, 7231, 2), +(7230, 7232, 3), +(7230, 7233, 4), +(7230, 7234, 5), + -- Fire Resistance +(24440, 24440, 1), +(24440, 24441, 2), +(24440, 24463, 3), +(24440, 24464, 4), +(24440, 27351, 5), + -- Fire Resistance +(8185, 8185, 1), +(8185, 10534, 2), +(8185, 10535, 3), +(8185, 25562, 4), +(8185, 58738, 5), +(8185, 58740, 6), + -- Fire Shield +(2949, 2949, 1), +(2949, 8318, 2), +(2949, 8319, 3), +(2949, 11772, 4), +(2949, 11773, 5), +(2949, 27486, 6), + -- Fire Shield +(20322, 20322, 1), +(20322, 20323, 2), +(20322, 20324, 3), +(20322, 20326, 4), +(20322, 20327, 5), +(20322, 27489, 6), +(20322, 47998, 7), + -- Flameblade +(7829, 7829, 1), +(7829, 7874, 2), +(7829, 7875, 3), + -- Flameblade +(7806, 7806, 1), +(7806, 7807, 2), +(7806, 7808, 3), + -- Flurry +(12319, 12319, 1), +(12319, 12971, 2), +(12319, 12972, 3), +(12319, 12973, 4), +(12319, 12974, 5), + -- Flurry +(12966, 12966, 1), +(12966, 12967, 2), +(12966, 12968, 3), +(12966, 12969, 4), +(12966, 12970, 5), + -- Focused Will +(45234, 45234, 1), +(45234, 45243, 2), +(45234, 45244, 3), + -- Focused Will +(45237, 45237, 1), +(45237, 45241, 2), +(45237, 45242, 3), + -- Frost Nova +(1194, 1194, 1), +(1194, 1225, 2), +(1194, 6132, 3), +(1194, 10231, 4), +(1194, 27387, 5), + -- Frost Protection +(7240, 7240, 1), +(7240, 7236, 2), +(7240, 7238, 3), +(7240, 7237, 4), +(7240, 7239, 5), + -- Frost Resistance +(24475, 24475, 1), +(24475, 24476, 2), +(24475, 24477, 3), +(24475, 24478, 4), +(24475, 27352, 5), + -- Frost Resistance +(8182, 8182, 1), +(8182, 10476, 2), +(8182, 10477, 3), +(8182, 25559, 4), +(8182, 58742, 5), +(8182, 58744, 6), + -- Frostbrand Attack +(8034, 8034, 1), +(8034, 8037, 2), +(8034, 10458, 3), +(8034, 16352, 4), +(8034, 16353, 5), +(8034, 25501, 6), +(8034, 58797, 7), +(8034, 58798, 8), +(8034, 58799, 9), + -- Healing Stream +(5672, 5672, 1), +(5672, 6371, 2), +(5672, 6372, 3), +(5672, 10460, 4), +(5672, 10461, 5), +(5672, 25566, 6), +(5672, 58763, 7), +(5672, 58764, 8), +(5672, 58765, 9), + -- Holy Nova +(15237, 15237, 1), +(15237, 15430, 2), +(15237, 15431, 3), +(15237, 27799, 4), +(15237, 27800, 5), +(15237, 27801, 6), +(15237, 25331, 7), +(15237, 48077, 8), +(15237, 48078, 9), + -- Holy Nova +(23455, 23455, 1), +(23455, 23458, 2), +(23455, 23459, 3), +(23455, 27803, 4), +(23455, 27804, 5), +(23455, 27805, 6), +(23455, 25329, 7), +(23455, 48075, 8), +(23455, 48076, 9), + -- Holy Protection +(7245, 7245, 1), +(7245, 7246, 2), +(7245, 7247, 3), +(7245, 7248, 4), +(7245, 7249, 5), +(7245, 17545, 6), + -- Holy Shock +(20473, 20473, 1), +(20473, 20929, 2), +(20473, 20930, 3), +(20473, 27174, 4), +(20473, 33072, 5), +(20473, 48824, 6), +(20473, 48825, 7), + -- Holy Shock +(25912, 25912, 1), +(25912, 25911, 2), +(25912, 25902, 3), +(25912, 27176, 4), +(25912, 33073, 5), +(25912, 48822, 6), +(25912, 48823, 7), + -- Holy Shock +(25914, 25914, 1), +(25914, 25913, 2), +(25914, 25903, 3), +(25914, 27175, 4), +(25914, 33074, 5), +(25914, 48820, 6), +(25914, 48821, 7), + -- Hurricane +(16914, 16914, 1), +(16914, 17401, 2), +(16914, 17402, 3), +(16914, 27012, 4), +(16914, 48467, 5), + -- Hurricane +(42231, 42231, 1), +(42231, 42232, 2), +(42231, 42233, 3), +(42231, 42230, 4), +(42231, 48466, 5), + -- Immolation Trap +(13795, 13795, 1), +(13795, 14302, 2), +(13795, 14303, 3), +(13795, 14304, 4), +(13795, 14305, 5), +(13795, 27023, 6), +(13795, 49055, 7), +(13795, 49056, 8), + -- Impact +(11103, 11103, 1), +(11103, 12357, 2), +(11103, 12358, 3), + -- Improved Mend Pet +(19572, 19572, 1), +(19572, 19573, 2), + -- Infusion of Light +(53569, 53569, 1), +(53569, 53576, 2), + -- Initiative +(13976, 13976, 1), +(13976, 13979, 2), +(13976, 13980, 3), + -- Intercept +(30154, 30154, 1), +(30154, 30199, 2), +(30154, 30200, 3), + -- Intercept +(30153, 30153, 1), +(30153, 30195, 2), +(30153, 30197, 3), +(30153, 47995, 4), + -- Intercept +(30151, 30151, 1), +(30151, 30194, 2), +(30151, 30198, 3), +(30151, 47996, 4), + -- Lash of Pain +(7876, 7876, 1), +(7876, 7877, 2), +(7876, 7878, 3), +(7876, 11781, 4), +(7876, 11782, 5), +(7876, 11783, 6), + -- Lay on Hands +(20233, 20233, 1), +(20233, 20236, 2), + -- Lay on Hands +(17233, 17233, 1), +(17233, 9257, 2), + -- Lightning Bolt +(403, 403, 1), +(403, 529, 2), +(403, 548, 3), +(403, 915, 4), +(403, 943, 5), +(403, 6041, 6), +(403, 10391, 7), +(403, 10392, 8), +(403, 15207, 9), +(403, 15208, 10), +(403, 25448, 11), +(403, 25449, 12), +(403, 49237, 13), +(403, 49238, 14), + -- Lightning Bolt +(45284, 45284, 1), +(45284, 45286, 2), +(45284, 45287, 3), +(45284, 45288, 4), +(45284, 45289, 5), +(45284, 45290, 6), +(45284, 45291, 7), +(45284, 45292, 8), +(45284, 45293, 9), +(45284, 45294, 10), +(45284, 45295, 11), +(45284, 45296, 12), +(45284, 49239, 13), +(45284, 49240, 14), + -- Lightning Shield +(324, 324, 1), +(324, 325, 2), +(324, 905, 3), +(324, 945, 4), +(324, 8134, 5), +(324, 10431, 6), +(324, 10432, 7), +(324, 25469, 8), +(324, 25472, 9), +(324, 49280, 10), +(324, 49281, 11), + -- Lightning Shield +(26364, 26364, 1), +(26364, 26365, 2), +(26364, 26366, 3), +(26364, 26367, 4), +(26364, 26369, 5), +(26364, 26370, 6), +(26364, 26363, 7), +(26364, 26371, 8), +(26364, 26372, 9), +(26364, 49278, 10), +(26364, 49279, 11), + -- Living Bomb +(44457, 44457, 1), +(44457, 55359, 2), +(44457, 55360, 3), + -- Living Bomb +(44461, 44461, 1), +(44461, 55361, 2), +(44461, 55362, 3), + -- Mind Sear +(48045, 48045, 1), +(48045, 53023, 2), + -- Mind Sear +(49821, 49821, 1), +(49821, 53022, 2), + -- Molten Armor +(34913, 34913, 1), +(34913, 43043, 2), +(34913, 43044, 3), + -- Molten Armor +(30482, 30482, 1), +(30482, 43045, 2), +(30482, 43046, 3), + -- Nature Protection +(7250, 7250, 1), +(7250, 7251, 2), +(7250, 7252, 3), +(7250, 7253, 4), +(7250, 7254, 5), + -- Nature Resistance +(24494, 24494, 1), +(24494, 24511, 2), +(24494, 24512, 3), +(24494, 24513, 4), +(24494, 27354, 5), + -- Nature Resistance +(10596, 10596, 1), +(10596, 10598, 2), +(10596, 10599, 3), +(10596, 25573, 4), +(10596, 58748, 5), +(10596, 58750, 6), + -- On a Pale Horse +(49146, 49146, 1), +(49146, 51267, 2), + -- Penance +(47540, 47540, 1), +(47540, 53005, 2), +(47540, 53006, 3), +(47540, 53007, 4), + -- Penance +(47750, 47750, 1), +(47750, 52983, 2), +(47750, 52984, 3), +(47750, 52985, 4), + -- Penance +(47666, 47666, 1), +(47666, 52998, 2), +(47666, 52999, 3), +(47666, 53000, 4), + -- Plague Strike +(59133, 59133, 1), +(59133, 66988, 2), +(59133, 66989, 3), +(59133, 66990, 4), +(59133, 66991, 5), +(59133, 66992, 6), + -- Prowl +(24451, 24451, 1), +(24451, 24454, 2), +(24451, 24455, 3), + -- Rain of Fire +(42223, 42223, 1), +(42223, 42224, 2), +(42223, 42225, 3), +(42223, 42226, 4), +(42223, 42218, 5), +(42223, 47817, 6), +(42223, 47818, 7), + -- Rain of Fire +(5740, 5740, 1), +(5740, 6219, 2), +(5740, 11677, 3), +(5740, 11678, 4), +(5740, 27212, 5), +(5740, 47819, 6), +(5740, 47820, 7), + -- Sacrifice +(7885, 7885, 1), +(7885, 19439, 2), +(7885, 19444, 3), +(7885, 19445, 4), +(7885, 19446, 5), +(7885, 19447, 6), + -- Sacrifice +(20381, 20381, 1), +(20381, 20382, 2), +(20381, 20383, 3), +(20381, 20384, 4), +(20381, 20385, 5), +(20381, 20386, 6), +(20381, 27492, 7), +(20381, 48001, 8), +(20381, 48002, 9), + -- Safeguard +(46945, 46945, 1), +(46945, 46949, 2), + -- Safeguard +(46946, 46946, 1), +(46946, 46947, 2), + -- Seed of Corruption +(27285, 27285, 1), +(27285, 47833, 2), +(27285, 47834, 3), + -- Seed of Corruption +(27243, 27243, 1), +(27243, 47835, 2), +(27243, 47836, 3), + -- Shadow Protection +(7235, 7235, 1), +(7235, 7241, 2), +(7235, 7242, 3), +(7235, 7243, 4), +(7235, 7244, 5), + -- Shadow Resistance +(24490, 24490, 1), +(24490, 24514, 2), +(24490, 24515, 3), +(24490, 24516, 4), +(24490, 27353, 5), + -- Soothing Kiss +(6362, 6362, 1), +(6362, 7879, 2), +(6362, 11786, 3), +(6362, 11787, 4), + -- Soothing Kiss +(20403, 20403, 1), +(20403, 20404, 2), +(20403, 20405, 3), +(20403, 20406, 4), +(20403, 27494, 5), + -- Spell Lock +(19648, 19648, 1), +(19648, 19650, 2), + -- Spell Lock +(20433, 20433, 1), +(20433, 20434, 2), + -- Starfall +(50286, 50286, 1), +(50286, 53196, 2), +(50286, 53197, 3), +(50286, 53198, 4), + -- Starfall +(50294, 50294, 1), +(50294, 53188, 2), +(50294, 53189, 3), +(50294, 53190, 4), + -- Starfall +(50288, 50288, 1), +(50288, 53191, 2), +(50288, 53194, 3), +(50288, 53195, 4), + -- Suffering +(17736, 17736, 1), +(17736, 17753, 2), +(17736, 17754, 3), +(17736, 17755, 4), + -- Suffering +(20393, 20393, 1), +(20393, 20394, 2), +(20393, 20395, 3), +(20393, 20396, 4), +(20393, 27500, 5), +(20393, 33703, 6), +(20393, 48005, 7), +(20393, 48006, 8), + -- Surge of Light +(33150, 33150, 1), +(33150, 33154, 2), + -- Tainted Blood +(19661, 19661, 1), +(19661, 19662, 2), +(19661, 19663, 3), +(19661, 19664, 4), + -- Tainted Blood +(20429, 20429, 1), +(20429, 20430, 2), +(20429, 20431, 3), +(20429, 20432, 4), +(20429, 27497, 5), + -- The Art of War +(53486, 53486, 1), +(53486, 53488, 2), + -- Thick Skin +(5364, 5364, 1), +(5364, 5368, 2), +(5364, 5369, 3), +(5364, 5370, 4), + -- Thick Skin +(5363, 5363, 1), +(5363, 5365, 2), +(5363, 5366, 3), +(5363, 5367, 4), + -- Torment +(7881, 7881, 1), +(7881, 7882, 2), +(7881, 7883, 3), +(7881, 7884, 4), +(7881, 11776, 5), +(7881, 11777, 6), + -- Tough Shell +(4112, 4112, 1), +(4112, 4113, 2), +(4112, 4115, 3), +(4112, 4114, 4), + -- Tough Shell +(4107, 4107, 1), +(4107, 4108, 2), +(4107, 4109, 3), +(4107, 4111, 4), + -- Tranquility +(740, 740, 1), +(740, 8918, 2), +(740, 9862, 3), +(740, 9863, 4), +(740, 26983, 5), +(740, 48446, 6), +(740, 48447, 7), + -- Tranquility +(44203, 44203, 1), +(44203, 44205, 2), +(44203, 44206, 3), +(44203, 44207, 4), +(44203, 44208, 5), +(44203, 48444, 6), +(44203, 48445, 7), + -- Typhoon +(61391, 61391, 1), +(61391, 61390, 2), +(61391, 61388, 3), +(61391, 61387, 4), +(61391, 53227, 5), + -- Typhoon +(50516, 50516, 1), +(50516, 53223, 2), +(50516, 53225, 3), +(50516, 53226, 4), +(50516, 61384, 5), + -- Unfair Advantage +(51675, 51675, 1), +(51675, 51677, 2), + -- Unfair Advantage +(51672, 51672, 1), +(51672, 51674, 2), + -- Unleashed Rage +(30802, 30802, 1), +(30802, 30808, 2), +(30802, 30809, 3), + -- Unleashed Rage +(30803, 30803, 1), +(30803, 30804, 2), +(30803, 30805, 3), + -- Vindication +(9452, 9452, 1), +(9452, 26016, 2), + -- Vindication +(67, 67, 1), +(67, 26017, 2), + -- Volley +(42243, 42243, 1), +(42243, 42244, 2), +(42243, 42245, 3), +(42243, 42234, 4), +(42243, 58432, 5), +(42243, 58433, 6), + -- Volley +(1510, 1510, 1), +(1510, 14294, 2), +(1510, 14295, 3), +(1510, 27022, 4), +(1510, 58431, 5), +(1510, 58434, 6), + -- Will of the Necropolis +(52284, 52284, 1), +(52284, 52285, 2), +(52284, 52286, 3), + -- Will of the Necropolis +(49189, 49189, 1), +(49189, 50149, 2), +(49189, 50150, 3), + -- Wyvern Sting +(19386, 19386, 1), +(19386, 24132, 2), +(19386, 24133, 3), +(19386, 27068, 4), +(19386, 49011, 5), +(19386, 49012, 6), + -- First Aid +(746, 746, 1), +(746, 1159, 2), +(746, 3267, 3), +(746, 3268, 4), +(746, 7926, 5), +(746, 7927, 6), +(746, 10838, 7), +(746, 10839, 8), +(746, 18608, 9), +(746, 18610, 10), +(746, 27030, 11), +(746, 27031, 12), +(746, 45543, 13), +(746, 51827, 14), +(746, 45544, 15), +(746, 51803, 16), + -- Frost Strike +(49143, 49143, 1), +(49143, 51416, 2), +(49143, 51417, 3), +(49143, 51418, 4), +(49143, 51419, 5), +(49143, 55268, 6), + -- Intercept +(20253, 20253, 1), +(20253, 20614, 2), +(20253, 20615, 3), +(20253, 25273, 4), +(20253, 25274, 5), + -- Misery +(33191, 33191, 1), +(33191, 33192, 2), +(33191, 33193, 3), + -- Misery +(33196, 33196, 1), +(33196, 33197, 2), +(33196, 33198, 3), + -- Obliterate +(49020, 49020, 1), +(49020, 51423, 2), +(49020, 51424, 3), +(49020, 51425, 4), + -- Penance +(47758, 47758, 1), +(47758, 53001, 2), +(47758, 53002, 3), +(47758, 53003, 4), + -- Penance +(47757, 47757, 1), +(47757, 52986, 2), + -- Savage Rend +(50498, 50498, 1), +(50498, 53578, 2), +(50498, 53579, 3), +(50498, 53580, 4), +(50498, 53581, 5), +(50498, 53582, 6), + -- Spirit Bond +(19578, 19578, 1), +(19578, 20895, 2), + -- Spirit Bond +(19579, 19579, 1), +(19579, 24529, 2), + -- Attack +(3606, 3606, 1), +(3606, 6350, 2), +(3606, 6351, 3), +(3606, 6352, 4), +(3606, 10435, 5), +(3606, 10436, 6), +(3606, 25530, 7), +(3606, 58700, 8), +(3606, 58701, 9), +(3606, 58702, 10), + -- Blood Strike +(45902, 45902, 1), +(45902, 49926, 2), +(45902, 49927, 3), +(45902, 49928, 4), +(45902, 49929, 5), +(45902, 49930, 6), + -- Elemental Devastation +(30160, 30160, 1), +(30160, 29179, 2), +(30160, 29180, 3), + -- Elemental Devastation +(30165, 30165, 1), +(30165, 29177, 2), +(30165, 29178, 3), + -- Fishing +(7620, 7620, 1), +(7620, 7731, 2), +(7620, 7732, 3), +(7620, 18248, 4), +(7620, 33095, 5), +(7620, 51294, 6), + -- Icy Touch +(45477, 45477, 1), +(45477, 49896, 2), +(45477, 49903, 3), +(45477, 49904, 4), +(45477, 49909, 5), + -- Judgements of the Pure +(53671, 53671, 1), +(53671, 53673, 2), +(53671, 54151, 3), +(53671, 54154, 4), +(53671, 54155, 5), + -- Judgements of the Pure +(53655, 53655, 1), +(53655, 53656, 2), +(53655, 53657, 3), +(53655, 54152, 4), +(53655, 54153, 5), + -- Master Tactician +(34506, 34506, 1), +(34506, 34507, 2), +(34506, 34508, 3), +(34506, 34838, 4), +(34506, 34839, 5), + -- Master Tactician +(34833, 34833, 1), +(34833, 34834, 2), +(34833, 34835, 3), +(34833, 34836, 4), +(34833, 34837, 5), + -- Plague Strike +(45462, 45462, 1), +(45462, 49917, 2), +(45462, 49918, 3), +(45462, 49919, 4), +(45462, 49920, 5), +(45462, 49921, 6), + -- Rapid Killing +(34948, 34948, 1), +(34948, 34949, 2), + -- Rapid Killing +(35098, 35098, 1), +(35098, 35099, 2), + -- Second Wind +(29841, 29841, 1), +(29841, 29842, 2), + -- Second Wind +(29834, 29834, 1), +(29834, 29838, 2), + -- Strength of Earth +(8076, 8076, 1), +(8076, 8162, 2), +(8076, 8163, 3), +(8076, 10441, 4), +(8076, 25362, 5), +(8076, 25527, 6), +(8076, 57621, 7), +(8076, 58646, 8), + -- Trauma +(46854, 46854, 1), +(46854, 46855, 2), + -- Trauma +(46856, 46856, 1), +(46856, 46857, 2), + -- Unbridled Wrath +(12322, 12322, 1), +(12322, 12999, 2), +(12322, 13000, 3), +(12322, 13001, 4), +(12322, 13002, 5), + -- Vanish +(11327, 11327, 1), +(11327, 11329, 2), +(11327, 26888, 3), + -- Blood Gorged +(50096, 50096, 1), +(50096, 50108, 2), +(50096, 50109, 3), +(50096, 50110, 4), +(50096, 50111, 5), + -- Blood Gorged +(61274, 61274, 1), +(61274, 61275, 2), +(61274, 61276, 3), +(61274, 61277, 4), +(61274, 61278, 5), + -- Blood Gorged +(61154, 61154, 1), +(61154, 61155, 2), +(61154, 61156, 3), +(61154, 61157, 4), +(61154, 61158, 5), + -- Cone of Cold +(1241, 1241, 1), +(1241, 8493, 2), +(1241, 10162, 3), +(1241, 10163, 4), +(1241, 10164, 5), +(1241, 27386, 6), + -- Anesthetic Poison +(26688, 26688, 1), +(26688, 57981, 2), + -- Anesthetic Poison +(26785, 26785, 1), +(26785, 57982, 2), + -- Apprentice Riding +(33388, 33388, 1), +(33388, 33391, 2), +(33388, 34090, 3), +(33388, 34091, 4), + -- Primal Fury +(16958, 16958, 1), +(16958, 16961, 2), + -- Primal Fury +(37116, 37116, 1), +(37116, 37117, 2), + -- Nature Resist +(4548, 4548, 1), +(4548, 24502, 2), +(4548, 24503, 3), +(4548, 24504, 4), +(4548, 27055, 5), + -- Instant Poison +(8680, 8680, 1), +(8680, 8685, 2), +(8680, 8689, 3), +(8680, 11335, 4), +(8680, 11336, 5), +(8680, 11337, 6), +(8680, 26890, 7), +(8680, 57964, 8), +(8680, 57965, 9), + -- Instant Poison +(8679, 8679, 1), +(8679, 8686, 2), +(8679, 8688, 3), +(8679, 11338, 4), +(8679, 11339, 5), +(8679, 11340, 6), +(8679, 26891, 7), +(8679, 57967, 8), +(8679, 57968, 9), + -- Claw +(2980, 2980, 1), +(2980, 2981, 2), +(2980, 2982, 3), +(2980, 3667, 4), +(2980, 2975, 5), +(2980, 2976, 6), +(2980, 2977, 7), +(2980, 3666, 8), +(2980, 27347, 9), + -- Mace Specialization +(12284, 12284, 1), +(12284, 12701, 2), +(12284, 12702, 3), +(12284, 12703, 4), +(12284, 12704, 5), + -- Deadly Toxin +(11539, 11539, 1), +(11539, 11471, 2), +(11539, 11470, 3), +(11539, 11469, 4), + -- Deadly Poison +(2818, 2818, 1), +(2818, 2819, 2), +(2818, 11353, 3), +(2818, 11354, 4), +(2818, 25349, 5), +(2818, 26968, 6), +(2818, 27187, 7), +(2818, 57969, 8), +(2818, 57970, 9), + -- Deadly Poison +(2823, 2823, 1), +(2823, 2824, 2), +(2823, 11355, 3), +(2823, 11356, 4), +(2823, 25351, 5), +(2823, 26967, 6), +(2823, 27186, 7), +(2823, 57972, 8), +(2823, 57973, 9), + -- On a Pale Horse +(51983, 51983, 1), +(51983, 51986, 2), + -- On a Pale Horse +(51969, 51969, 1), +(51969, 51970, 2), + -- Wound Poison +(13218, 13218, 1), +(13218, 13222, 2), +(13218, 13223, 3), +(13218, 13224, 4), +(13218, 27189, 5), +(13218, 57974, 6), +(13218, 57975, 7), + -- Wound Poison +(13219, 13219, 1), +(13219, 13225, 2), +(13219, 13226, 3), +(13219, 13227, 4), +(13219, 27188, 5), +(13219, 57977, 6), +(13219, 57978, 7), + -- Thunderstomp +(26094, 26094, 1), +(26094, 26189, 2), +(26094, 26190, 3), +(26094, 27366, 4), + -- Obliterate +(66198, 66198, 1), +(66198, 66972, 2), +(66198, 66973, 3), +(66198, 66974, 4), + -- Frost Strike +(66196, 66196, 1), +(66196, 66958, 2), +(66196, 66959, 3), +(66196, 66960, 4), +(66196, 66961, 5), +(66196, 66962, 6), + -- Death Strike +(66188, 66188, 1), +(66188, 66950, 2), +(66188, 66951, 3), +(66188, 66952, 4), +(66188, 66953, 5), + -- Fiery Payback +(44440, 44440, 1), +(44440, 44441, 2), + -- Fiery Payback +(64353, 64353, 1), +(64353, 64357, 2), + -- Improved Flash Heal +(63504, 63504, 1), +(63504, 63505, 2), +(63504, 63506, 3), + -- Elemental Fury +(16089, 16089, 1), +(16089, 60184, 2), +(16089, 60185, 3), +(16089, 60187, 4), +(16089, 60188, 5), + -- Feral Swiftness +(17002, 17002, 1), +(17002, 24866, 2), + -- Master Shapeshifter +(48411, 48411, 1), +(48411, 48412, 2), + -- Nature's Majesty +(35363, 35363, 1), +(35363, 35364, 2), + -- Nature's Grace +(16880, 16880, 1), +(16880, 61345, 2), +(16880, 61346, 3), + -- Molten Skin +(63349, 63349, 1), +(63349, 63350, 2), +(63349, 63351, 3), + -- Master Demonologist +(23785, 23785, 1), +(23785, 23822, 2), +(23785, 23823, 3), +(23785, 23824, 4), +(23785, 23825, 5), + -- Death Rune Mastery +(49467, 49467, 1), +(49467, 50033, 2), +(49467, 50034, 3), + -- Improved Death Strike +(62905, 62905, 1), +(62905, 62908, 2), + -- Desolation +(66799, 66799, 1), +(66799, 66814, 2), +(66799, 66815, 3), +(66799, 66816, 4), +(66799, 66817, 5), + -- Mobility +(53483, 53483, 1), +(53483, 53485, 2), + -- Mobility +(53554, 53554, 1), +(53554, 53555, 2), + -- Arcane Missiles +(7268, 7268, 1), +(7268, 7269, 2), +(7268, 7270, 3), +(7268, 8419, 4), +(7268, 8418, 5), +(7268, 10273, 6), +(7268, 10274, 7), +(7268, 25346, 8), +(7268, 27076, 9), +(7268, 38700, 10), +(7268, 38703, 11), +(7268, 42844, 12), +(7268, 42845, 13), + -- Entangling Roots +(19975, 19975, 1), +(19975, 19974, 2), +(19975, 19973, 3), +(19975, 19972, 4), +(19975, 19971, 5), +(19975, 19970, 6), +(19975, 27010, 7), +(19975, 53313, 8), + -- Fire Nova +(8349, 8349, 1), +(8349, 8502, 2), +(8349, 8503, 3), +(8349, 11306, 4), +(8349, 11307, 5), +(8349, 25535, 6), +(8349, 25537, 7), +(8349, 61650, 8), +(8349, 61654, 9), + -- Death Coil +(47541, 47541, 1), +(47541, 49892, 2), +(47541, 49893, 3), +(47541, 49894, 4), +(47541, 49895, 5), + -- Intellect +(8096, 8096, 1), +(8096, 8097, 2), +(8096, 8098, 3), +(8096, 12176, 4), +(8096, 33078, 5), +(8096, 43195, 6), +(8096, 48099, 7), +(8096, 48100, 8), + -- Stamina +(8099, 8099, 1), +(8099, 8100, 2), +(8099, 8101, 3), +(8099, 12178, 4), +(8099, 33081, 5), +(8099, 48101, 6), +(8099, 48102, 7), +(8099, 43198, 8), + -- Mutilate +(5374, 5374, 1), +(5374, 34414, 2), +(5374, 34416, 3), +(5374, 34419, 4), +(5374, 48662, 5), +(5374, 48665, 6), + -- Mutilate +(27576, 27576, 1), +(27576, 34415, 2), +(27576, 34417, 3), +(27576, 34418, 4), +(27576, 48661, 5), +(27576, 48664, 6), + -- immolation trap +(13797, 13797, 1), +(13797, 14298, 2), +(13797, 14299, 3), +(13797, 14300, 4), +(13797, 14301, 5), +(13797, 27024, 6), +(13797, 49053, 7), +(13797, 49054, 8), + -- Sniper Training +(64418, 64418, 1), +(64418, 64419, 2), +(64418, 64420, 3), + -- Desecration +(55666, 55666, 1), +(55666, 55667, 2), +(55666, 55668, 3), +(55666, 55669, 4), +(55666, 55670, 5), + -- Blood Strike +(66215, 66215, 1), +(66215, 66975, 2), +(66215, 66976, 3), +(66215, 66977, 4), +(66215, 66978, 5), +(66215, 66979, 6), + -- Stoneclaw Totem Effect +(5729, 5729, 1), +(5729, 6393, 2), +(5729, 6394, 3), +(5729, 6395, 4), +(5729, 10423, 5), +(5729, 10424, 6), +(5729, 25512, 7), +(5729, 58586, 8), +(5729, 58587, 9), +(5729, 58588, 10); diff --git a/sql/updates/3.2.2a_old/7246_world_command.sql b/sql/updates/3.2.2a_old/7246_world_command.sql new file mode 100644 index 0000000..7fc9a2e --- /dev/null +++ b/sql/updates/3.2.2a_old/7246_world_command.sql @@ -0,0 +1,8 @@ +-- delete unused command loadscripts +DELETE FROM `command` WHERE `name` = 'loadscripts'; +-- Change the default scurity level for some commands +UPDATE `command` SET `security`=2 WHERE `name` IN ('playall','npc setlink','reload creature_linked_respawn'); -- DB devs command +UPDATE `command` SET `security`=1 WHERE `name` IN ('freeze','listfreeze','unfreeze'); -- Players can be anoying when talking a mod +UPDATE `command` SET `security`=1 WHERE `name` IN ('gmannounce','gmnameannounce','gmnotify'); -- even mods needs to notify things when a higher range staft is not online +UPDATE `command` SET `security`=1 WHERE `name` IN ('ticket assign','ticket close','ticket comment','ticket unassign'); -- Dirty work for slaves +UPDATE `command` SET `security`=1 WHERE `name`='account addon'; -- Server admins uses addon to close northrend diff --git a/sql/updates/3.2.2a_old/7252_world_creature.sql b/sql/updates/3.2.2a_old/7252_world_creature.sql new file mode 100644 index 0000000..1079df7 --- /dev/null +++ b/sql/updates/3.2.2a_old/7252_world_creature.sql @@ -0,0 +1 @@ +ALTER TABLE `creature` AUTO_INCREMENT=250001; diff --git a/sql/updates/3.2.2a_old/7252_world_gameobject.sql b/sql/updates/3.2.2a_old/7252_world_gameobject.sql new file mode 100644 index 0000000..bbd8355 --- /dev/null +++ b/sql/updates/3.2.2a_old/7252_world_gameobject.sql @@ -0,0 +1 @@ +ALTER TABLE `gameobject` AUTO_INCREMENT=200001; diff --git a/sql/updates/3.2.2a_old/7261_world_spell_required.sql b/sql/updates/3.2.2a_old/7261_world_spell_required.sql new file mode 100644 index 0000000..820a95a --- /dev/null +++ b/sql/updates/3.2.2a_old/7261_world_spell_required.sql @@ -0,0 +1,3 @@ +ALTER TABLE spell_required +DROP PRIMARY KEY, +ADD PRIMARY KEY (`spell_id`, `req_spell`); diff --git a/sql/updates/3.2.2a_old/7268_world_spell_proc_item_enchant.sql b/sql/updates/3.2.2a_old/7268_world_spell_proc_item_enchant.sql new file mode 100644 index 0000000..0856d3f --- /dev/null +++ b/sql/updates/3.2.2a_old/7268_world_spell_proc_item_enchant.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `spell_proc_item_enchant`; diff --git a/sql/updates/3.2.2a_old/7273_world_scriptname.sql b/sql/updates/3.2.2a_old/7273_world_scriptname.sql new file mode 100644 index 0000000..00f0c7e --- /dev/null +++ b/sql/updates/3.2.2a_old/7273_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_wormhole' WHERE `entry`='35646'; + diff --git a/sql/updates/3.2.2a_old/7274_world_script_texts.sql b/sql/updates/3.2.2a_old/7274_world_script_texts.sql new file mode 100644 index 0000000..c784aba --- /dev/null +++ b/sql/updates/3.2.2a_old/7274_world_script_texts.sql @@ -0,0 +1,3 @@ +DELETE FROM `script_texts` WHERE `entry` = -1580067; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(25608,-1580067,'Stay on task! Do not waste time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12496,1,0,0,'KJ - SAY_KJ_OFFCOMBAT2'); diff --git a/sql/updates/3.2.2a_old/7279_realmd_account.sql b/sql/updates/3.2.2a_old/7279_realmd_account.sql new file mode 100644 index 0000000..c8981d4 --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_realmd_account.sql @@ -0,0 +1 @@ +ALTER TABLE `account` CHANGE COLUMN `expansion` `expansion` tinyint(3) unsigned NOT NULL DEFAULT '2'; diff --git a/sql/updates/3.2.2a_old/7279_world_creature_template.sql b/sql/updates/3.2.2a_old/7279_world_creature_template.sql new file mode 100644 index 0000000..c866a69 --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_creature_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `creature_template` CHANGE COLUMN `Health_mod` `Health_mod` float NOT NULL DEFAULT '1'; +ALTER TABLE `creature_template` CHANGE COLUMN `Mana_mod` `Mana_mod` float NOT NULL DEFAULT '1'; diff --git a/sql/updates/3.2.2a_old/7279_world_gameobject_template.sql b/sql/updates/3.2.2a_old/7279_world_gameobject_template.sql new file mode 100644 index 0000000..63bf43e --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_gameobject_template.sql @@ -0,0 +1 @@ +ALTER TABLE `gameobject_template` CHANGE COLUMN `data6` `data6` INT(11) SIGNED NOT NULL DEFAULT '-1'; diff --git a/sql/updates/3.2.2a_old/7279_world_item_template.sql b/sql/updates/3.2.2a_old/7279_world_item_template.sql new file mode 100644 index 0000000..335f103 --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_item_template.sql @@ -0,0 +1,11 @@ +ALTER TABLE `item_template` CHANGE COLUMN `AllowableClass` `AllowableClass` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `item_template` CHANGE COLUMN `AllowableRace` `AllowableRace` int(11) NOT NULL DEFAULT '-1'; +ALTER TABLE `item_template` CHANGE COLUMN `Flags` `Flags` bigint(20) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `BuyPrice` `BuyPrice` bigint(20) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `maxcount` `maxcount` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `spellid_1` `spellid_1` mediumint(8) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `spellid_2` `spellid_2` mediumint(8) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `spellid_3` `spellid_3` mediumint(8) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `spellid_4` `spellid_4` mediumint(8) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `spellid_5` `spellid_5` mediumint(8) NOT NULL DEFAULT '0'; +ALTER TABLE `item_template` CHANGE COLUMN `RandomProperty` `RandomProperty` mediumint(8) NOT NULL DEFAULT '0'; diff --git a/sql/updates/3.2.2a_old/7279_world_pool_creature.sql b/sql/updates/3.2.2a_old/7279_world_pool_creature.sql new file mode 100644 index 0000000..e087ad0 --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_pool_creature.sql @@ -0,0 +1,2 @@ +ALTER TABLE `pool_creature` CHANGE COLUMN `comment` `comment` varchar(255) DEFAULT NULL; +ALTER TABLE `pool_creature` CHANGE COLUMN `description` `description` varchar(255) DEFAULT NULL; diff --git a/sql/updates/3.2.2a_old/7279_world_pool_gameobject.sql b/sql/updates/3.2.2a_old/7279_world_pool_gameobject.sql new file mode 100644 index 0000000..c24a4a8 --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_pool_gameobject.sql @@ -0,0 +1 @@ +ALTER TABLE `pool_gameobject` CHANGE COLUMN `description` `description` varchar(255) DEFAULT NULL; diff --git a/sql/updates/3.2.2a_old/7279_world_pool_pool.sql b/sql/updates/3.2.2a_old/7279_world_pool_pool.sql new file mode 100644 index 0000000..ab96f4c --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_pool_pool.sql @@ -0,0 +1 @@ +ALTER TABLE `pool_pool` CHANGE COLUMN `description` `description` varchar(255) DEFAULT NULL; diff --git a/sql/updates/3.2.2a_old/7279_world_pool_template.sql b/sql/updates/3.2.2a_old/7279_world_pool_template.sql new file mode 100644 index 0000000..2ce997b --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_pool_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `pool_template` CHANGE COLUMN `description` `description` varchar(255) DEFAULT NULL; +ALTER TABLE `pool_template` CHANGE COLUMN `comment` `comment` varchar(255) DEFAULT NULL; diff --git a/sql/updates/3.2.2a_old/7279_world_quest_template.sql b/sql/updates/3.2.2a_old/7279_world_quest_template.sql new file mode 100644 index 0000000..ea687b5 --- /dev/null +++ b/sql/updates/3.2.2a_old/7279_world_quest_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `quest_template` CHANGE COLUMN `QuestLevel` `QuestLevel` smallint(3) NOT NULL default '1'; +ALTER TABLE `quest_template` CHANGE COLUMN `RewSpellCast` `RewSpellCast` int(11) NOT NULL DEFAULT '0'; diff --git a/sql/updates/3.2.2a_old/7280_world_command.sql b/sql/updates/3.2.2a_old/7280_world_command.sql new file mode 100644 index 0000000..150370a --- /dev/null +++ b/sql/updates/3.2.2a_old/7280_world_command.sql @@ -0,0 +1,2 @@ +DELETE FROM `command` WHERE `name` = 'reload spell_group'; +INSERT INTO `command` VALUES ('reload spell_group','3','Syntax: .reload spell_group\nReload spell_group table.'); diff --git a/sql/updates/3.2.2a_old/7280_world_spell_elixir.sql b/sql/updates/3.2.2a_old/7280_world_spell_elixir.sql new file mode 100644 index 0000000..e2b2469 --- /dev/null +++ b/sql/updates/3.2.2a_old/7280_world_spell_elixir.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `spell_elixir`; diff --git a/sql/updates/3.2.2a_old/7280_world_spell_group.sql b/sql/updates/3.2.2a_old/7280_world_spell_group.sql new file mode 100644 index 0000000..c3082a6 --- /dev/null +++ b/sql/updates/3.2.2a_old/7280_world_spell_group.sql @@ -0,0 +1,187 @@ +DROP TABLE IF EXISTS `spell_group`; +CREATE TABLE `spell_group` ( + `id` int(11) unsigned NOT NULL DEFAULT 0, + `spell_id` int(11) unsigned NOT NULL DEFAULT 0, + PRIMARY KEY (`id`, `spell_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Spell System'; +INSERT INTO `spell_group` (`id`, `spell_id`) VALUES + -- SPELL_GROUP_ELIXIR_BATTLE +(1, 2367), +(1, 2374), +(1, 3160), +(1, 3164), +(1, 7844), +(1, 8212), +(1, 10667), +(1, 10669), +(1, 11328), +(1, 11334), +(1, 11390), +(1, 11405), +(1, 11406), +(1, 11474), +(1, 16322), +(1, 16323), +(1, 16329), +(1, 17038), +(1, 17537), +(1, 17538), +(1, 17539), +(1, 17624), +(1, 17626), +(1, 17627), +(1, 17628), +(1, 17629), +(1, 21920), +(1, 26276), +(1, 28486), +(1, 28488), +(1, 28490), +(1, 28491), +(1, 28493), +(1, 28497), +(1, 28501), +(1, 28503), +(1, 28518), +(1, 28519), +(1, 28520), +(1, 28521), +(1, 28540), +(1, 33720), +(1, 33721), +(1, 33726), +(1, 38954), +(1, 40567), +(1, 40568), +(1, 40572), +(1, 40573), +(1, 40575), +(1, 40576), +(1, 41608), +(1, 41609), +(1, 41610), +(1, 41611), +(1, 42735), +(1, 45373), +(1, 46837), +(1, 46839), +(1, 53746), +(1, 53748), +(1, 53749), +(1, 53752), +(1, 53755), +(1, 53758), +(1, 53760), +(1, 54212), +(1, 54452), +(1, 54494), +(1, 60340), +(1, 60341), +(1, 60344), +(1, 60345), +(1, 60346), +(1, 62380), +(1, 67016), +(1, 67017), +(1, 67018), + -- SPELL_GROUP_ELIXIR_GUARDIAN +(2, 673), +(2, 2378), +(2, 2380), +(2, 3166), +(2, 3219), +(2, 3220), +(2, 3222), +(2, 3223), +(2, 3593), +(2, 10668), +(2, 10692), +(2, 10693), +(2, 11319), +(2, 11348), +(2, 11349), +(2, 11364), +(2, 11371), +(2, 11396), +(2, 15231), +(2, 15233), +(2, 16321), +(2, 16325), +(2, 16326), +(2, 16327), +(2, 17535), +(2, 17624), +(2, 17626), +(2, 17627), +(2, 17628), +(2, 17629), +(2, 24361), +(2, 24363), +(2, 24382), +(2, 24383), +(2, 24417), +(2, 27652), +(2, 27653), +(2, 28502), +(2, 28509), +(2, 28514), +(2, 28518), +(2, 28519), +(2, 28520), +(2, 28521), +(2, 28540), +(2, 29348), +(2, 39625), +(2, 39626), +(2, 39627), +(2, 39628), +(2, 40567), +(2, 40568), +(2, 40572), +(2, 40573), +(2, 40575), +(2, 40576), +(2, 41608), +(2, 41609), +(2, 41610), +(2, 41611), +(2, 42735), +(2, 46837), +(2, 46839), +(2, 53747), +(2, 53751), +(2, 53752), +(2, 53755), +(2, 53758), +(2, 53760), +(2, 53763), +(2, 53764), +(2, 54212), +(2, 60343), +(2, 60347), +(2, 62380), +(2, 67016), +(2, 67017), +(2, 67018), + -- SPELL_GROUP_ELIXIR_UNSTABLE +(3, 40567), +(3, 40568), +(3, 40572), +(3, 40573), +(3, 40575), +(3, 40576), + -- SPELL_GROUP_ELIXIR_SHATTRATH +(4, 41608), +(4, 41609), +(4, 41610), +(4, 41611), +(4, 46837), +(4, 46839), + -- SPELL_GROUP_WELL_FED +(5, 18191), +(5, 18192), +(5, 18193), +(5, 18194), +(5, 18222), +(5, 22730), +(5, 25661); diff --git a/sql/updates/3.2.2a_old/7283_world_command.sql b/sql/updates/3.2.2a_old/7283_world_command.sql new file mode 100644 index 0000000..86fa40f --- /dev/null +++ b/sql/updates/3.2.2a_old/7283_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` = 'reload spell_group_stack_rules'; +DELETE FROM `command` WHERE `name` = 'reload spell_elixir'; +DELETE FROM `command` WHERE `name` = 'reload spell_stack_masks'; +INSERT INTO `command` VALUES ('reload spell_group_stack_rules','3','Syntax: .reload spell_group\nReload spell_group_stack_rules table.'); diff --git a/sql/updates/3.2.2a_old/7283_world_spell_group.sql b/sql/updates/3.2.2a_old/7283_world_spell_group.sql new file mode 100644 index 0000000..2a059a5 --- /dev/null +++ b/sql/updates/3.2.2a_old/7283_world_spell_group.sql @@ -0,0 +1,126 @@ +ALTER TABLE spell_group +MODIFY spell_id INT(11) NOT NULL DEFAULT 0; +DELETE FROM spell_group WHERE id IN(5, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011); +INSERT INTO spell_group (id, spell_id) VALUES + -- Well Fed +(1001, 19705), +(1001, 19706), +(1001, 19708), +(1001, 19709), +(1001, 19710), +(1001, 19711), +(1001, 24799), +(1001, 24870), +(1001, 25694), +(1001, 25941), +(1001, 33254), +(1001, 33256), +(1001, 33257), +(1001, 33259), +(1001, 33261), +(1001, 33263), +(1001, 33265), +(1001, 33268), +(1001, 33272), +(1001, 35272), +(1001, 40323), +(1001, 42293), +(1001, 43764), +(1001, 43771), +(1001, 44097), +(1001, 44098), +(1001, 44099), +(1001, 44100), +(1001, 44101), +(1001, 44102), +(1001, 44104), +(1001, 44105), +(1001, 44106), +(1001, 45245), +(1001, 45619), +(1001, 46682), +(1001, 46687), +(1001, 46899), +(1001, 53284), +(1001, 57079), +(1001, 57097), +(1001, 57100), +(1001, 57102), +(1001, 57107), +(1001, 57111), +(1001, 57139), +(1001, 57286), +(1001, 57288), +(1001, 57291), +(1001, 57294), +(1001, 57325), +(1001, 57327), +(1001, 57329), +(1001, 57332), +(1001, 57334), +(1001, 57356), +(1001, 57358), +(1001, 57360), +(1001, 57363), +(1001, 57365), +(1001, 57367), +(1001, 57371), +(1001, 57373), +(1001, 57399), +(1001, 58468), +(1001, 58479), +(1001, 59230), +(1001, 59690), +(1001, 59699), +(1001, 62349), +(1001, 64057), +(1001, 65247), +(1001, 65365), +(1001, 65410), +(1001, 65412), +(1001, 65414), +(1001, 65415), +(1001, 65416), +(1001, 66623), +(1001, 66624), +(1001, 69559), +(1001, 18125), +(1001, 18141), +(1001, 23697), + -- Blessing of Might +(1002, 19740), +(1002, 25782), +(1002, 56520), +-- Battle Shout +(1003, 6673), +-- Blessing of Might, Battle Shout +(1004, -1002), +(1004, -1003), +-- Blessing of Wisdom +(1005, 19742), +(1005, 25894), +(1005, 56521), +-- Blessing of Kings +(1006, 20217), +(1006, 25898), +(1006, 43223), +(1006, 56525), +(1006, 58054), +-- Blessing of Sanctuary +(1007, 20911), +(1007, 25899), +-- Blessing of Protection +(1008, 41450), +(1008, 23415), +-- Blessing of Light +(1009, 32770), +-- Blessings +(1010, -1002), +(1010, -1005), +(1010, -1006), +(1010, -1007), +(1010, -1008), +(1010, -1009), +-- Commanding shout, Battle Shout +(1011, 469), +(1011, -1003); diff --git a/sql/updates/3.2.2a_old/7283_world_spell_group_stack_rules.sql b/sql/updates/3.2.2a_old/7283_world_spell_group_stack_rules.sql new file mode 100644 index 0000000..8b316be --- /dev/null +++ b/sql/updates/3.2.2a_old/7283_world_spell_group_stack_rules.sql @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS `spell_group_stack_rules`; +CREATE TABLE `spell_group_stack_rules` ( + `group_id` INT(11) UNSIGNED NOT NULL DEFAULT 0, + `stack_rule` TINYINT(3) NOT NULL DEFAULT 0, + PRIMARY KEY (`group_id`) +)ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO spell_group_stack_rules (group_id, stack_rule) VALUES +(1, 1), +(2, 1), +(1001, 1), +(1002, 1), +(1003, 1), +(1004, 1), +(1005, 1), +(1006, 1), +(1007, 1), +(1008, 1), +(1009, 1), +(1010, 2), +(1011, 1); diff --git a/sql/updates/3.2.2a_old/7283_world_spell_stack_masks.sql b/sql/updates/3.2.2a_old/7283_world_spell_stack_masks.sql new file mode 100644 index 0000000..24cebf1 --- /dev/null +++ b/sql/updates/3.2.2a_old/7283_world_spell_stack_masks.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `spell_stack_masks`; diff --git a/sql/updates/3.2.2a_old/7285_world_script_waypoint.sql b/sql/updates/3.2.2a_old/7285_world_script_waypoint.sql new file mode 100644 index 0000000..ca4b4e3 --- /dev/null +++ b/sql/updates/3.2.2a_old/7285_world_script_waypoint.sql @@ -0,0 +1,12 @@ +DELETE FROM `script_waypoint` WHERE `entry`=35491; +INSERT INTO `script_waypoint` VALUES +(35491,1,754.709,646.999,442.961,0,''), +(35491,2,738.85,637.289,439.134,0,''), +(35491,3,727.272,619.164,438.186,0,''), +(35491,4,733.524,608.939,433.711,0,''), +(35491,5,745.537,605.399,428.795,0,''), +(35491,6,754.46,607.124,426.542,0,''), +(35491,7,763.48,616.796,422.603,0,''), +(35491,8,761.823,625.299,418.482,0,''), +(35491,9,755.923,631.506,413.966,0,''), +(35491,10,744.841,634.505,411.575,0,''); diff --git a/sql/updates/3.2.2a_old/7285_world_scriptname.sql b/sql/updates/3.2.2a_old/7285_world_scriptname.sql new file mode 100644 index 0000000..3f57f64 --- /dev/null +++ b/sql/updates/3.2.2a_old/7285_world_scriptname.sql @@ -0,0 +1,11 @@ +UPDATE `creature_template` SET `ScriptName`='generic_vehicleAI_toc5' WHERE `entry` IN (35637,35633,35768,34658,35636,35638,35635,35640,35641,35634,33298,33416,33297,33414,33301,33408,33300,33409,33418); +UPDATE `creature_template` SET `ScriptName`='boss_warrior_toc5' WHERE `entry` IN (34705,35572); +UPDATE `creature_template` SET `ScriptName`='boss_mage_toc5' WHERE `entry` IN (34702,35569); +UPDATE `creature_template` SET `ScriptName`='boss_shaman_toc5' WHERE `entry` IN (35571,34701); +UPDATE `creature_template` SET `ScriptName`='boss_hunter_toc5' WHERE `entry` IN (35570,34657); +UPDATE `creature_template` SET `ScriptName`='boss_rouge_toc5' WHERE `entry` IN (35617,34703); +UPDATE `creature_template` SET `ScriptName`='npc_announcer_toc5' WHERE `entry`IN (35004,35005); +UPDATE `instance_template` SET `script`='instance_trial_of_the_champion' WHERE `map`=650; +UPDATE `creature_template` SET `ScriptName`='npc_argent_soldier' WHERE `entry` IN (35309,35305,35307); +UPDATE `creature_template` SET `ScriptName`='npc_black_knight_skeletal_gryphon' WHERE `entry`=35491; +UPDATE `creature_template` SET `AIName`='PassiveAI' WHERE `entry` IN (35332,35330,35328,35327,35331,35329,35325,35314,35326,35323); diff --git a/sql/updates/3.2.2a_old/7293_world_scriptname.sql b/sql/updates/3.2.2a_old/7293_world_scriptname.sql new file mode 100644 index 0000000..b978069 --- /dev/null +++ b/sql/updates/3.2.2a_old/7293_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_andorhal_tower' WHERE `entry` in (10902,10903,10904,10905); diff --git a/sql/updates/3.2.2a_old/7295_world_scriptname.sql b/sql/updates/3.2.2a_old/7295_world_scriptname.sql new file mode 100644 index 0000000..596aa60 --- /dev/null +++ b/sql/updates/3.2.2a_old/7295_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName` = 'go_soulwell' WHERE `entry` IN (181621,193169); diff --git a/sql/updates/3.2.2a_old/7295_world_spell_dbc.sql b/sql/updates/3.2.2a_old/7295_world_spell_dbc.sql new file mode 100644 index 0000000..881f2e0 --- /dev/null +++ b/sql/updates/3.2.2a_old/7295_world_spell_dbc.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_dbc` WHERE `Id` IN (34145,58888); +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectBaseDice1`,`EffectBaseDice2`,`EffectBaseDice3`,`EffectDicePerLevel1`,`EffectDicePerLevel2`,`EffectDicePerLevel3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(34145,0,0,0,0,0,0x04000000,0,0,0,1,0,0,101,0,0,80,80,0,1,0,-1,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29886,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,'Ritual of Souls Rank 1 - Trigger Create Soulwell (29886)'), +(58888,0,0,0,0,0,0x04000000,0,0,0,1,0,0,101,0,0,68,68,0,1,0,-1,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58889,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,'Ritual of Souls Rank 2 - Trigger Create Soulwell (58889)'); diff --git a/sql/updates/3.2.2a_old/7296_world_creature_template.sql b/sql/updates/3.2.2a_old/7296_world_creature_template.sql new file mode 100644 index 0000000..82a9121 --- /dev/null +++ b/sql/updates/3.2.2a_old/7296_world_creature_template.sql @@ -0,0 +1,4 @@ +-- Add Spell "Launch Spear" to creature "Ymirheim Spear Gun" +UPDATE `creature_template` SET `spell1`=59894 WHERE `entry`=31280; +-- Add necessary spells for vehicles (for rev 7285). +UPDATE `creature_template` SET `spell1`=68505,`spell2`=62575,`spell3`=68282,`spell4`=66482 WHERE `entry` IN (36558,35644); diff --git a/sql/updates/3.2.2a_old/7300_world_script_texts.sql b/sql/updates/3.2.2a_old/7300_world_script_texts.sql new file mode 100644 index 0000000..5f72220 --- /dev/null +++ b/sql/updates/3.2.2a_old/7300_world_script_texts.sql @@ -0,0 +1,30 @@ +-- Novos +DELETE FROM `script_texts` WHERE `entry` in (-1600000,-1600001,-1600002,-1600003,-1600004,-1600005); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(26631,-1600000,'The chill that you feel is the herald of your doom!',null,null,null,null,null,null,null,null,13173,1,0,0,'novos SAY_AGGRO'), +(26631,-1600001,'Such is the fate of all who oppose the Lich King.',null,null,null,null,null,null,null,null,13175,1,0,0,'novos SAY_KILL'), +(26631,-1600002,'Your efforts... are in vain.',null,null,null,null,null,null,null,null,13174,1,0,0,'novos SAY_DEATH'), +(26631,-1600003,'Bolster my defenses! Hurry, curse you!',null,null,null,null,null,null,null,null,13176,1,0,0,'novos SAY_NECRO_ADD'), +(26631,-1600004,'Surely you can see the futility of it all!',null,null,null,null,null,null,null,null,13177,1,0,0,'novos SAY_REUBBLE_1'), +(26631,-1600005,'Just give up and die already!',null,null,null,null,null,null,null,null,13178,1,0,0,'novos SAY_REUBBLE_2'); + +-- Trollgore +DELETE FROM `script_texts` WHERE `entry` in (-1600006,-1600007,-1600008,-1600009,-1600010); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(26630,-1600006,'More grunts, more glands, more FOOD!',null,null,null,null,null,null,null,null,13181,1,0,0,'trollgore SAY_AGGRO'), +(26630,-1600007,'You have gone, me gonna eat you!',null,null,null,null,null,null,null,null,13185,1,0,0,'trollgore SAY_KILL'), +(26630,-1600008,'So hungry! Must feed!',null,null,null,null,null,null,null,null,13182,1,0,0,'trollgore SAY_CONSUME'), +(26630,-1600009,'Corpse go boom!',null,null,null,null,null,null,null,null,13184,1,0,0,'trollgore SAY_EXPLODE'), +(26630,-1600010,'Aaaargh...',null,null,null,null,null,null,null,null,13183,1,0,0,'trollgore SAY_DEATH'); + +-- Tharon'ja +DELETE FROM `script_texts` WHERE `entry` in (-1600011,-1600012,-1600013,-1600014,-1600015,-1600016,-1600017,-1600018); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(26632,-1600011,'Tharon''ja sees all! The work of mortals shall not end the eternal dynasty!',null,null,null,null,null,null,null,null,13862,1,0,0,'tharon''ja SAY_AGGRO'), +(26632,-1600012,'As Tharon''ja predicted.',null,null,null,null,null,null,null,null,13863,1,0,0,'tharon''ja SAY_KILL_1'), +(26632,-1600013,'As it was written.',null,null,null,null,null,null,null,null,13864,1,0,0,'tharon''ja SAY_KILL_2'), +(26632,-1600014,'Your flesh serves Tharon''ja now!',null,null,null,null,null,null,null,null,13865,1,0,0,'tharon''ja SAY_FLESH_1'), +(26632,-1600015,'Tharon''ja has a use for your mortal shell!',null,null,null,null,null,null,null,null,13866,1,0,0,'tharon''ja SAY_FLESH_2'), +(26632,-1600016,'No! A taste... all too brief!',null,null,null,null,null,null,null,null,13867,1,0,0,'tharon''ja SAY_SKELETON_1'), +(26632,-1600017,'Tharon''ja will have more!',null,null,null,null,null,null,null,null,13868,1,0,0,'tharon''ja SAY_SKELETON_2'), +(26632,-1600018,'I''m... impossible! Tharon''ja is eternal! Tharon''ja... is...',null,null,null,null,null,null,null,null,13869,1,0,0,'tharon''ja SAY_DEATH'); \ No newline at end of file diff --git a/sql/updates/3.2.2a_old/7306_world_trinity_string.sql b/sql/updates/3.2.2a_old/7306_world_trinity_string.sql new file mode 100644 index 0000000..c1b15a3 --- /dev/null +++ b/sql/updates/3.2.2a_old/7306_world_trinity_string.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default` = 'The distance is: (3D) %f (2D) %f (Exact 3D) %f (Exact 2D) %f yards.' WHERE `entry`=503; diff --git a/sql/updates/3.2.2a_old/7312_world_script_texts.sql b/sql/updates/3.2.2a_old/7312_world_script_texts.sql new file mode 100644 index 0000000..893f695 --- /dev/null +++ b/sql/updates/3.2.2a_old/7312_world_script_texts.sql @@ -0,0 +1 @@ +UPDATE `script_texts` SET `npc_entry`=15420 WHERE `entry` IN (-1000209,-1000210); diff --git a/sql/updates/3.2.2a_old/7316_world_script_texts.sql b/sql/updates/3.2.2a_old/7316_world_script_texts.sql new file mode 100644 index 0000000..db46ba9 --- /dev/null +++ b/sql/updates/3.2.2a_old/7316_world_script_texts.sql @@ -0,0 +1,65 @@ +DELETE FROM `script_texts` WHERE `entry` in (-1603045,-1603062,-1603064); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(28070,-1603045,'Query? What do you think I''m here for? Tea and biscuits? Spill the beans already!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14263,1,0,0,'brann SAY_EVENT_END_01'), +(28070,-1603062,'This Loken sounds like a nasty character. Glad we don''t have to worry about the likes of him anymore. So if I''m understanding you lads the original Earthen eventually woke up from this statis. And by that time this destabily-whatever had turned them into our brother dwarfs. Or at least dwarf ancestors. Hm?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14272,1,0,0,'brann SAY_EVENT_END_18'), +(28070,-1603064,'Well now. That''s a lot to digest. I''m gonna need some time to take all of this in. Thank you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14273,1,0,0,'brann SAY_EVENT_END_20'); + +DELETE FROM `script_texts` WHERE `entry`<=-1608000 and `entry`>=-1608045; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +/* Cyanigosa */ +(31134,-1608000,'We finish this now, champions of Kirin Tor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13947,1,0,0,'cyanigosa SAY_AGGRO'), +(31134,-1608001,'I will end the Kirin Tor!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13952,1,0,0,'cyanigosa SAY_SLAY_1'), +(31134,-1608002,'Dalaran will fall!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13953,1,0,0,'cyanigosa SAY_SLAY_2'), +(31134,-1608003,'So ends your defiance of the Spell-Weaver!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13954,1,0,0,'cyanigosa SAY_SLAY_3'), +(31134,-1608004,'Perhaps... we have... underestimated... you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13955,1,0,0,'cyanigosa SAY_DEATH'), +(31134,-1608005,'A valiant defense, but this city must be razed. I will fulfill Malygos''s wishes myself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13946,1,0,0,'cyanigosa SAY_SPAWN'), +(31134,-1608006,'Am I interrupting?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13951,1,0,0,'cyanigosa SAY_DISRUPTION'), +(31134,-1608007,'Shiver and die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13948,1,0,0,'cyanigosa SAY_BREATH_ATTACK'), +(31134,-1608008,'The world has forgotten what true magic is! Let this be a reminder!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13949,1,0,0,'cyanigosa SAY_SPECIAL_ATTACK_1'), +(31134,-1608009,'Who among you can withstand my power?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13950,1,0,0,'cyanigosa SAY_SPECIAL_ATTACK_2'), + +/* Erekem */ +(29315,-1608010,'Not--caww--get in way of--rrak-rrak--flee!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14219,1,0,0,'erekem SAY_AGGRO'), +(29315,-1608011,'Ya ya ya yaaaa',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14222,1,0,0,'erekem SAY_SLAY_1'), +(29315,-1608012,'Preeciouuss life---Ra-aak---Wasted!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14223,1,0,0,'erekem SAY_SLAY_2'), +(29315,-1608013,'Only the strong---Ra-aak---Survive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14224,1,0,0,'erekem SAY_SLAY_3'), +(29315,-1608014,'No--kaw, kaw--flee...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14225,1,0,0,'erekem SAY_DEATH'), +(29315,-1608015,'Free to--mm--fly now. Ra-aak... Not find us--ekh-ekh! Escape!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14218,1,0,0,'erekem SAY_SPAWN'), +(29315,-1608016,'My---raaak--favorite! Awk awk awk! Raa-kaa!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14220,1,0,0,'erekem SAY_ADD_KILLED'), +(29315,-1608017,'Nasty little...A-ak, kaw! Kill! Yes, kill you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14221,1,0,0,'erekem SAY_BOTH_ADDS_KILLED'), + +/* Ichoron */ +(29313,-1608018,'Stand aside, mortals!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14230,1,0,0,'ichoron SAY_AGGRO'), +(29313,-1608019,'I am a force of nature!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14234,1,0,0,'ichoron SAY_SLAY_1'), +(29313,-1608020,'I shall pass!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14235,1,0,0,'ichoron SAY_SLAY_2'), +(29313,-1608021,'You can not stop the tide!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14236,1,0,0,'ichoron SAY_SLAY_3'), +(29313,-1608022,'I... recede.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14237,1,0,0,'ichoron SAY_DEATH'), +(29313,-1608023,'I... am fury... unrestrained!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14229,1,0,0,'ichoron SAY_SPAWN'), +(29313,-1608024,'I shall consume, decimate, devastate, and destroy! Yield now to the wrath of the pounding sea!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14231,1,0,0,'ichoron SAY_ENRAGE'), +(29313,-1608025,'I will not be contained! Ngyah!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14233,1,0,0,'ichoron SAY_SHATTER'), +(29313,-1608026,'Water can hold any form, take any shape... overcome any obstacle.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14232,1,0,0,'ichoron SAY_BUBBLE'), + +/* Xevozz */ +(29266,-1608027,'It seems my freedom must be bought with blood...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14498,1,0,0,'Xevozz SAY_AGGRO'), +(29266,-1608028,'Nothing personal.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14504,1,0,0,'Xevozz SAY_SLAY_1'), +(29266,-1608029,'Business concluded.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14505,1,0,0,'Xevozz SAY_SLAY_2'), +(29266,-1608030,'Profit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14506,1,0,0,'Xevozz SAY_SLAY_3'), +(29266,-1608031,'This is an... unrecoverable... loss.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14507,1,0,0,'Xevozz SAY_DEATH'), +(29266,-1608032,'Back in business! Now to execute an exit strategy.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14498,1,0,0,'Xevozz SAY_SPAWN'), +(29266,-1608033,'It would seem that a renegotiation is in order.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14503,1,0,0,'Xevozz SAY_CHARGED'), +(29266,-1608034,'The air teems with latent energy... quite the harvest!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14501,1,0,0,'Xevozz SAY_REPEAT_SUMMON_1'), +(29266,-1608035,'Plentiful, exploitable resources... primed for acquisition!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14502,1,0,0,'Xevozz SAY_REPEAT_SUMMON_2'), +(29266,-1608036,'Intriguing... a high quantity of arcane energy is near. Time for some prospecting...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14500,1,0,0,'Xevozz SAY_SUMMON_ENERGY'), + +/* Zuramat */ +(29314,-1608037,'Eradicate.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13996,1,0,0,'zuramat SAY_AGGRO'), +(29314,-1608038,'More... energy.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13999,1,0,0,'zuramat SAY_SLAY_1'), +(29314,-1608039,'Relinquish.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14000,1,0,0,'zuramat SAY_SLAY_2'), +(29314,-1608040,'Fall... to shadow.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14001,1,0,0,'zuramat SAY_SLAY_3'), +(29314,-1608041,'Disperse.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14002,1,0,0,'zuramat SAY_DEATH'), +(29314,-1608042,'I am... renewed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13995,1,0,0,'zuramat SAY_SPAWN'), +(29314,-1608043,'Know... my... pain.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13997,1,0,0,'zuramat SAY_SHIELD'), +(29314,-1608044,'Gaze... into the void.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13998,1,0,0,'zuramat SAY_WHISPER'), + +/* Sinclari */ +(30658,-1608045,'Prison guards, we are leaving! These adventurers are taking over! Go go go',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'sinclari SAY_SINCLARI_1'); diff --git a/sql/updates/3.2.2a_old/7327_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/7327_world_creature_classlevelstats.sql new file mode 100644 index 0000000..06e6620 --- /dev/null +++ b/sql/updates/3.2.2a_old/7327_world_creature_classlevelstats.sql @@ -0,0 +1 @@ +UPDATE `creature_classlevelstats` SET `basehp1`=7794 WHERE `level`=82 AND `class`=2; diff --git a/sql/updates/3.2.2a_old/7328_world_creature_classlevelstats.sql b/sql/updates/3.2.2a_old/7328_world_creature_classlevelstats.sql new file mode 100644 index 0000000..b3b826c --- /dev/null +++ b/sql/updates/3.2.2a_old/7328_world_creature_classlevelstats.sql @@ -0,0 +1,12 @@ +-- Update HP Stats +UPDATE `creature_classlevelstats` SET `basehp0`=5492 WHERE `level`=81 AND `class`=1; +UPDATE `creature_classlevelstats` SET `basehp1`=8715 WHERE `level`=78 AND `class`=1; +UPDATE `creature_classlevelstats` SET `basehp1`=8960 WHERE `level`=79 AND `class`=1; +UPDATE `creature_classlevelstats` SET `basehp1`=9474 WHERE `level`=81 AND `class`=1; +UPDATE `creature_classlevelstats` SET `basehp1`=6243 WHERE `level`=74 AND `class`=2; +UPDATE `creature_classlevelstats` SET `basehp1`=6602 WHERE `level`=76 AND `class`=2; +UPDATE `creature_classlevelstats` SET `basehp1`=6784 WHERE `level`=77 AND `class`=2; +UPDATE `creature_classlevelstats` SET `basehp1`=6972 WHERE `level`=78 AND `class`=2; +UPDATE `creature_classlevelstats` SET `basehp1`=7167 WHERE `level`=79 AND `class`=2; +UPDATE `creature_classlevelstats` SET `basehp1`=7373 WHERE `level`=80 AND `class`=2; +UPDATE `creature_classlevelstats` SET `basehp1`=7581 WHERE `level`=81 AND `class`=2; diff --git a/sql/updates/3.2.2a_old/CMakeLists.txt b/sql/updates/3.2.2a_old/CMakeLists.txt new file mode 100644 index 0000000..391d489 --- /dev/null +++ b/sql/updates/3.2.2a_old/CMakeLists.txt @@ -0,0 +1,3 @@ +FILE(GLOB _SQL_322 *.sql) + +INSTALL(FILES ${_SQL_322} DESTINATION share/trinity/sql/updates/3.2.2a_old) \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7332_characters_account_data.sql b/sql/updates/3.3.2_old/7332_characters_account_data.sql new file mode 100644 index 0000000..f014151 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_account_data.sql @@ -0,0 +1 @@ +ALTER table account_data change `data` `data` longblob NOT NULL; diff --git a/sql/updates/3.3.2_old/7332_characters_character_account_data.sql b/sql/updates/3.3.2_old/7332_characters_character_account_data.sql new file mode 100644 index 0000000..8a83b3a --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_character_account_data.sql @@ -0,0 +1 @@ +ALTER table character_account_data change `data` `data` longblob NOT NULL; diff --git a/sql/updates/3.3.2_old/7332_characters_character_spell.sql b/sql/updates/3.3.2_old/7332_characters_character_spell.sql new file mode 100644 index 0000000..08a7c20 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_character_spell.sql @@ -0,0 +1 @@ +DELETE FROM `character_spell` WHERE `spell` IN (6783,9913,1785,1786,1787); diff --git a/sql/updates/3.3.2_old/7332_characters_characters.sql b/sql/updates/3.3.2_old/7332_characters_characters.sql new file mode 100644 index 0000000..6db1a7d --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_characters.sql @@ -0,0 +1,61 @@ +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); +UPDATE `characters` SET `data` = CONCAT( + SUBSTRING_INDEX(`data`, ' ', 161 + 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 1), ' ', -165 + 162 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4 + 1), ' ', -165 - 4 + 162 + 4 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*2 + 1), ' ', -165 - 4*2 + 162 + 4*2 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*3 + 1), ' ', -165 - 4*3 + 162 + 4*3 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*4 + 1), ' ', -165 - 4*4 + 162 + 4*4 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*5 + 1), ' ', -165 - 4*5 + 162 + 4*5 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*6 + 1), ' ', -165 - 4*6 + 162 + 4*6 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*7 + 1), ' ', -165 - 4*7 + 162 + 4*7 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*8 + 1), ' ', -165 - 4*8 + 162 + 4*8 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*9 + 1), ' ', -165 - 4*9 + 162 + 4*9 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*10 + 1), ' ', -165 - 4*10 + 162 + 4*10 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*11 + 1), ' ', -165 - 4*11 + 162 + 4*11 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*12 + 1), ' ', -165 - 4*12 + 162 + 4*12 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*13 + 1), ' ', -165 - 4*13 + 162 + 4*13 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*14 + 1), ' ', -165 - 4*14 + 162 + 4*14 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*15 + 1), ' ', -165 - 4*15 + 162 + 4*15 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*16 + 1), ' ', -165 - 4*16 + 162 + 4*16 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*17 + 1), ' ', -165 - 4*17 + 162 + 4*17 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*18 + 1), ' ', -165 - 4*18 + 162 + 4*18 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*19 + 1), ' ', -165 - 4*19 + 162 + 4*19 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*20 + 1), ' ', -165 - 4*20 + 162 + 4*20 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*21 + 1), ' ', -165 - 4*21 + 162 + 4*21 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*22 + 1), ' ', -165 - 4*22 + 162 + 4*22 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 165 + 4*23 + 1), ' ', -165 - 4*23 + 162 + 4*23 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 298 + 1), ' ', -298 + 162 + 4*24 - 1), ' ', + '0 ', + SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 1300 + 1), ' ', -1300 + 299 - 1), ' ' + ) +WHERE length(SUBSTRING_INDEX(data, ' ', 1300)) < length(data) and length(SUBSTRING_INDEX(data, ' ', 1300+1)) >= length(data); +UPDATE characters SET data = REPLACE(data,' ',' '); +UPDATE characters SET data = CONCAT(TRIM(data),' '); + diff --git a/sql/updates/3.3.2_old/7332_characters_guild.sql b/sql/updates/3.3.2_old/7332_characters_guild.sql new file mode 100644 index 0000000..ddc5c3b --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_guild.sql @@ -0,0 +1,12 @@ +-- add temporary column +ALTER TABLE guild ADD COLUMN created_temp bigint(20) default '0'; +-- update temporary columns data +UPDATE guild SET created_temp = UNIX_TIMESTAMP(createdate); +-- drop current column +ALTER TABLE guild DROP COLUMN createdate; +-- create new column with correct type +ALTER TABLE guild ADD COLUMN createdate bigint(20) NOT NULL default '0' AFTER motd; +-- copy data to new column +UPDATE guild set createdate = created_temp; +-- remove old column +ALTER TABLE guild DROP COLUMN created_temp; diff --git a/sql/updates/3.3.2_old/7332_characters_guild_bank_eventlog.sql b/sql/updates/3.3.2_old/7332_characters_guild_bank_eventlog.sql new file mode 100644 index 0000000..551d58e --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_guild_bank_eventlog.sql @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS `guild_bank_eventlog`; +CREATE TABLE `guild_bank_eventlog` ( + `guildid` int(11) unsigned NOT NULL default '0' COMMENT 'Guild Identificator', + `LogGuid` int(11) unsigned NOT NULL default '0' COMMENT 'Log record identificator - auxiliary column', + `TabId` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Guild bank TabId', + `EventType` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Event type', + `PlayerGuid` int(11) unsigned NOT NULL default '0', + `ItemOrMoney` int(11) unsigned NOT NULL default '0', + `ItemStackCount` tinyint(3) unsigned NOT NULL default '0', + `DestTabId` tinyint(1) unsigned NOT NULL default '0' COMMENT 'Destination Tab Id', + `TimeStamp` bigint(20) unsigned NOT NULL default '0' COMMENT 'Event UNIX time', + PRIMARY KEY (`guildid`,`LogGuid`,`TabId`), + KEY `guildid_key` (`guildid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.3.2_old/7332_characters_guild_eventlog.sql b/sql/updates/3.3.2_old/7332_characters_guild_eventlog.sql new file mode 100644 index 0000000..e471dc8 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_guild_eventlog.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS `guild_eventlog`; +CREATE TABLE `guild_eventlog` ( + `guildid` int(11) NOT NULL COMMENT 'Guild Identificator', + `LogGuid` int(11) NOT NULL COMMENT 'Log record identificator - auxiliary column', + `EventType` tinyint(1) NOT NULL COMMENT 'Event type', + `PlayerGuid1` int(11) NOT NULL COMMENT 'Player 1', + `PlayerGuid2` int(11) NOT NULL COMMENT 'Player 2', + `NewRank` tinyint(2) NOT NULL COMMENT 'New rank(in case promotion/demotion)', + `TimeStamp` bigint(20) NOT NULL COMMENT 'Event UNIX time', + PRIMARY KEY (`guildid`, `LogGuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'Guild Eventlog'; diff --git a/sql/updates/3.3.2_old/7332_characters_guild_rank.sql b/sql/updates/3.3.2_old/7332_characters_guild_rank.sql new file mode 100644 index 0000000..68e296a --- /dev/null +++ b/sql/updates/3.3.2_old/7332_characters_guild_rank.sql @@ -0,0 +1 @@ +UPDATE guild_rank SET BankMoneyPerDay = 4294967295 WHERE rid = 0; diff --git a/sql/updates/3.3.2_old/7332_realmd_realmlist.sql b/sql/updates/3.3.2_old/7332_realmd_realmlist.sql new file mode 100644 index 0000000..63d01a3 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_realmd_realmlist.sql @@ -0,0 +1 @@ +UPDATE `realmlist` SET `gamebuild`=11403 WHERE `id`=1; diff --git a/sql/updates/3.3.2_old/7332_world_creature_template.sql b/sql/updates/3.3.2_old/7332_world_creature_template.sql new file mode 100644 index 0000000..59a5355 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_creature_template.sql @@ -0,0 +1 @@ +ALTER TABLE `creature_template` ADD `WDBVerified` SMALLINT(5) SIGNED DEFAULT 0 AFTER `ScriptName`; diff --git a/sql/updates/3.3.2_old/7332_world_gameobject_template.sql b/sql/updates/3.3.2_old/7332_world_gameobject_template.sql new file mode 100644 index 0000000..8895578 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_gameobject_template.sql @@ -0,0 +1 @@ +ALTER TABLE `gameobject_template` ADD `WDBVerified` SMALLINT(5) SIGNED DEFAULT 0 AFTER `ScriptName`; diff --git a/sql/updates/3.3.2_old/7332_world_item_template.sql b/sql/updates/3.3.2_old/7332_world_item_template.sql new file mode 100644 index 0000000..2ad3845 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_item_template.sql @@ -0,0 +1,8 @@ +-- Resize spellcharge fields in item_template to hold 3.3.0 wdb data +ALTER TABLE `item_template` MODIFY `spellcharges_1` SMALLINT(4); -- Resize make larger +ALTER TABLE `item_template` MODIFY `spellcharges_2` SMALLINT(4); -- Resize make larger +ALTER TABLE `item_template` MODIFY `spellcharges_3` SMALLINT(4); -- Resize make larger +ALTER TABLE `item_template` MODIFY `spellcharges_4` SMALLINT(4); -- Resize make larger +ALTER TABLE `item_template` MODIFY `spellcharges_5` SMALLINT(4); -- Resize make larger + +ALTER TABLE `item_template` ADD `WDBVerified` SMALLINT(5) SIGNED DEFAULT 0 AFTER `maxMoneyLoot`; diff --git a/sql/updates/3.3.2_old/7332_world_npc_text.sql b/sql/updates/3.3.2_old/7332_world_npc_text.sql new file mode 100644 index 0000000..33aad7f --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_npc_text.sql @@ -0,0 +1 @@ +ALTER TABLE `npc_text` ADD `WDBVerified` SMALLINT(5) SIGNED DEFAULT 0 AFTER `em7_5`; diff --git a/sql/updates/3.3.2_old/7332_world_page_text.sql b/sql/updates/3.3.2_old/7332_world_page_text.sql new file mode 100644 index 0000000..b2767bb --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_page_text.sql @@ -0,0 +1 @@ +ALTER TABLE `page_text` ADD `WDBVerified` SMALLINT(5) SIGNED DEFAULT 0 AFTER `next_page`; diff --git a/sql/updates/3.3.2_old/7332_world_playercreateinfo_action.sql b/sql/updates/3.3.2_old/7332_world_playercreateinfo_action.sql new file mode 100644 index 0000000..0a1e771 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_playercreateinfo_action.sql @@ -0,0 +1,326 @@ +TRUNCATE `playercreateinfo_action`; +INSERT INTO `playercreateinfo_action` VALUES ('1', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '1', '82', '59752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '2', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '2', '1', '21084', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '2', '2', '635', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '2', '11', '59752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '4', '11', '59752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '5', '0', '585', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '5', '1', '2050', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '5', '11', '59752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '6', '11', '59752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '8', '0', '133', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '8', '1', '168', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '8', '11', '59752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '9', '0', '686', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '9', '1', '687', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('1', '9', '11', '59752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '1', '74', '20572', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '3', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '3', '1', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '3', '2', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '3', '11', '20572', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '4', '4', '20572', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '6', '10', '20572', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '7', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '7', '1', '403', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '7', '2', '331', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '7', '3', '33697', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '9', '0', '686', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '9', '1', '687', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('2', '9', '2', '33702', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '1', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '74', '20594', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '75', '2481', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '2', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '2', '1', '21084', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '2', '2', '635', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '2', '3', '20594', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '2', '4', '2481', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '3', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '3', '1', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '3', '2', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '3', '3', '20594', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '3', '4', '2481', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '3', '75', '20594', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '3', '76', '2481', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '4', '4', '20594', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '4', '5', '2481', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '5', '0', '585', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '5', '1', '2050', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '5', '2', '20594', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '5', '3', '2481', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('3', '6', '10', '2481', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '4', '82', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '1', '82', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '1', '85', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '1', '97', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '1', '109', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '3', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '3', '1', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '3', '2', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '3', '3', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '4', '11', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '5', '0', '585', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '5', '1', '2050', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '5', '2', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '10', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '6', '83', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '11', '0', '5176', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '11', '1', '5185', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('4', '11', '11', '58984', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '1', '74', '20577', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '4', '4', '20577', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '5', '0', '585', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '5', '1', '2050', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '5', '2', '20577', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '6', '10', '20577', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '8', '0', '133', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '8', '1', '168', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '8', '2', '20577', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '9', '0', '686', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '9', '1', '687', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('5', '9', '2', '20577', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '1', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '3', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '74', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '3', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '3', '1', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '3', '2', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '3', '3', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '3', '76', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '10', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '6', '75', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '7', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '7', '1', '403', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '7', '2', '331', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '7', '3', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '7', '76', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '0', '5176', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '1', '5185', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '2', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '73', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '76', '20549', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '85', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '97', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('6', '11', '109', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '1', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '11', '20589', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '82', '20589', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '4', '11', '20589', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '10', '20589', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '83', '41751', '128'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '11', '41751', '128'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '6', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '8', '0', '133', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '8', '1', '168', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '8', '11', '20589', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '9', '0', '686', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '9', '1', '687', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('7', '9', '11', '20589', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '74', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '75', '26296', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '3', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '3', '1', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '3', '2', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '8', '2', '20554', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '4', '4', '26297', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '5', '0', '585', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '5', '1', '2050', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '7', '3', '20554', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '6', '10', '50621', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '7', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '7', '1', '403', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '7', '2', '331', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '5', '2', '20554', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '8', '0', '133', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '8', '1', '168', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('8', '3', '3', '20554', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '2', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '2', '1', '21084', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '2', '2', '635', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '2', '3', '28730', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '3', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '3', '1', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '3', '2', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '3', '3', '28730', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '4', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '4', '1', '1752', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '4', '2', '2098', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '4', '3', '2764', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '4', '4', '25046', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '5', '0', '585', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '5', '1', '2050', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '5', '2', '28730', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '6', '6', '50613', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '8', '0', '133', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '8', '1', '168', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '8', '2', '28730', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '9', '0', '686', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '9', '1', '687', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('10', '9', '2', '28730', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '1', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '1', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '1', '73', '78', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '1', '74', '28880', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '1', '84', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '1', '96', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '1', '108', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '2', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '2', '1', '21084', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '2', '2', '635', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '2', '3', '59542', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '3', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '3', '1', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '3', '2', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '3', '3', '59543', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '3', '72', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '3', '73', '2973', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '3', '74', '75', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '5', '0', '585', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '5', '1', '2050', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '5', '2', '59544', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '1', '49576', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '2', '45477', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '3', '45462', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '4', '45902', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '5', '47541', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '10', '59545', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '7', '0', '6603', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '7', '1', '403', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '7', '2', '331', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '7', '3', '59547', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '8', '0', '133', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '8', '1', '168', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '8', '2', '59548', '0'); +INSERT INTO `playercreateinfo_action` VALUES ('11', '6', '11', '41751', '128'); diff --git a/sql/updates/3.3.2_old/7332_world_playercreateinfo_spell.sql b/sql/updates/3.3.2_old/7332_world_playercreateinfo_spell.sql new file mode 100644 index 0000000..9735fab --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_playercreateinfo_spell.sql @@ -0,0 +1,54 @@ +-- Add new start weapons as of 3.3 patch + +-- Warrior: Two-Handed Sword +DELETE FROM `playercreateinfo_spell` WHERE `class`=1 AND `Spell`=202; +INSERT INTO `playercreateinfo_spell` (`race`,`class`,`Spell`,`Note`) VALUES +(1,1,202, 'Two-Handed Swords'), +(4,1,202, 'Two-Handed Swords'), +(5,1,202, 'Two-Handed Swords'), +(7,1,202, 'Two-Handed Swords'), +(8,1,202, 'Two-Handed Swords'), +(11,1,202, 'Two-Handed Swords'); + +-- Hunter: Two-Handed Axe +DELETE FROM `playercreateinfo_spell` WHERE `class`=3 AND `Spell`=197; +INSERT INTO `playercreateinfo_spell` (`race`,`class`,`Spell`,`Note`) VALUES +(2,3,197, 'Two-Handed Axes'), +(3,3,197, 'Two-Handed Axes'), +(4,3,197, 'Two-Handed Axes'), +(6,3,197, 'Two-Handed Axes'), +(8,3,197, 'Two-Handed Axes'), +(10,3,197, 'Two-Handed Axes'), +(11,3,197, 'Two-Handed Axes'); + +-- Rogue: Dual Wield +DELETE FROM `playercreateinfo_spell` WHERE `class`=4 AND `Spell`=674; +INSERT INTO `playercreateinfo_spell` (`race`,`class`,`Spell`,`Note`) VALUES +(1,4,674, 'Dual Wield'), +(2,4,674, 'Dual Wield'), +(3,4,674, 'Dual Wield'), +(4,4,674, 'Dual Wield'), +(5,4,674, 'Dual Wield'), +(7,4,674, 'Dual Wield'), +(8,4,674, 'Dual Wield'), +(10,4,674, 'Dual Wield'); + +-- Priest: Staff +DELETE FROM `playercreateinfo_spell` WHERE `class`=5 AND `Spell`=227; +INSERT INTO `playercreateinfo_spell` (`race`,`class`,`Spell`,`Note`) VALUES +(1,5,227, 'Staves'), +(3,5,227, 'Staves'), +(4,5,227, 'Staves'), +(5,5,227, 'Staves'), +(8,5,227, 'Staves'), +(10,5,227, 'Staves'), +(11,5,227, 'Staves'); + +-- Warlock: Staff +DELETE FROM `playercreateinfo_spell` WHERE `class`=9 AND `Spell`=227; +INSERT INTO `playercreateinfo_spell` (`race`,`class`,`Spell`,`Note`) VALUES +(1,9,227, 'Staves'), +(2,9,227, 'Staves'), +(5,9,227, 'Staves'), +(7,9,227, 'Staves'), +(10,9,227, 'Staves'); diff --git a/sql/updates/3.3.2_old/7332_world_quest_poi.sql b/sql/updates/3.3.2_old/7332_world_quest_poi.sql new file mode 100644 index 0000000..d101b77 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_quest_poi.sql @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS `quest_poi`; +CREATE TABLE `quest_poi` ( + `questId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `id` int(10) UNSIGNED NOT NULL DEFAULT '0', + `objIndex` int(10) NOT NULL DEFAULT '0', + `mapid` int(10) UNSIGNED NOT NULL DEFAULT '0', + `WorldMapAreaId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `FloorId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `unk3` int(10) UNSIGNED NOT NULL DEFAULT '0', + `unk4` int(10) UNSIGNED NOT NULL DEFAULT '0', + KEY `questId` (`questId`,`id`), + KEY `id` (`id`,`questId`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; diff --git a/sql/updates/3.3.2_old/7332_world_quest_poi_points.sql b/sql/updates/3.3.2_old/7332_world_quest_poi_points.sql new file mode 100644 index 0000000..4c21abc --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_quest_poi_points.sql @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS `quest_poi_points`; +CREATE TABLE `quest_poi_points` ( + `questId` int(10) UNSIGNED NOT NULL DEFAULT '0', + `id` int(10) UNSIGNED NOT NULL DEFAULT '0', + `x` int(10) NOT NULL DEFAULT '0', + `y` int(10) NOT NULL DEFAULT '0', + KEY `questId_id` (`questId`,`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; diff --git a/sql/updates/3.3.2_old/7332_world_quest_template.sql b/sql/updates/3.3.2_old/7332_world_quest_template.sql new file mode 100644 index 0000000..ae4d729 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_quest_template.sql @@ -0,0 +1,15 @@ +-- Update quest_template table for 3.3.0 +ALTER TABLE `quest_template` ADD `RewXPId` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0' AFTER `NextQuestInChain`; +ALTER TABLE `quest_template` ADD `RewHonorMultiplier` FLOAT NOT NULL DEFAULT '1' AFTER `RewHonorableKills`; +ALTER TABLE `quest_template` ADD `RewardArenaPoints` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `BonusTalents`; +ALTER TABLE `quest_template` ADD `unk0` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0' AFTER `RewHonorMultiplier`; +ALTER TABLE `quest_template` ADD `RewRepValueId1` MEDIUMINT(6) NOT NULL DEFAULT '0' AFTER `RewRepFaction5`; +ALTER TABLE `quest_template` ADD `RewRepValueId2` MEDIUMINT(6) NOT NULL DEFAULT '0' AFTER `RewRepValueId1`; +ALTER TABLE `quest_template` ADD `RewRepValueId3` MEDIUMINT(6) NOT NULL DEFAULT '0' AFTER `RewRepValueId2`; +ALTER TABLE `quest_template` ADD `RewRepValueId4` MEDIUMINT(6) NOT NULL DEFAULT '0' AFTER `RewRepValueId3`; +ALTER TABLE `quest_template` ADD `RewRepValueId5` MEDIUMINT(6) NOT NULL DEFAULT '0' AFTER `RewRepValueId4`; + +ALTER TABLE `quest_template` ADD `CompletionText` TEXT NULL DEFAULT NULL AFTER `EndText`; + +ALTER TABLE `quest_template` ADD `WDBVerified` SMALLINT(5) SIGNED DEFAULT 0 AFTER `CompleteScript`; +ALTER TABLE `quest_template` CHANGE COLUMN `RewHonorableKills` `RewHonorAddition` int(10) NOT NULL default '0'; diff --git a/sql/updates/3.3.2_old/7332_world_scriptname.sql b/sql/updates/3.3.2_old/7332_world_scriptname.sql new file mode 100644 index 0000000..2ca443a --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE creature_template SET ScriptName='boss_algalon' WHERE entry=32871; +UPDATE creature_template SET ScriptName='mob_collapsing_star' WHERE entry=32955; diff --git a/sql/updates/3.3.2_old/7332_world_spell_bonus_data.sql b/sql/updates/3.3.2_old/7332_world_spell_bonus_data.sql new file mode 100644 index 0000000..62a57b0 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_spell_bonus_data.sql @@ -0,0 +1,5 @@ +UPDATE `spell_bonus_data` SET `ap_bonus`=0.15 WHERE `entry`=60089; +DELETE FROM `spell_bonus_data` WHERE `entry`=52042; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES (52042,-1,-1,-1,-1,'Shaman - Healing Stream Totem Triggered Heal'); + +DELETE FROM `spell_bonus_data` WHERE `entry` IN (8443,8504,8505,11310,11311,25538,25539,61651,61660); diff --git a/sql/updates/3.3.2_old/7332_world_spell_proc_event.sql b/sql/updates/3.3.2_old/7332_world_spell_proc_event.sql new file mode 100644 index 0000000..53aef76 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_spell_proc_event.sql @@ -0,0 +1,32 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (49194); +INSERT INTO `spell_proc_event` VALUES +(49194, 0x00, 15, 0x00002000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +DELETE FROM `spell_proc_event` WHERE `entry` IN (31656, 31657, 31658); +INSERT INTO `spell_proc_event` VALUES +(31656, 4, 3, 0x8000000, 0, 0, 0, 0, 0, 0, 0), +(31657, 4, 3, 0x8000000, 0, 0, 0, 0, 0, 0, 0), +(31658, 4, 3, 0x8000000, 0, 0, 0, 0, 0, 0, 0); + +DELETE FROM `spell_proc_event` WHERE entry = 67356; +INSERT INTO `spell_proc_event` VALUES (67356, 8, 7, 0x10, 0, 0, 0, 0, 0, 0, 0); + +DELETE FROM `spell_proc_event` WHERE `entry` IN (47245,47246,47247); +INSERT INTO `spell_proc_event` VALUES +(47245, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0), +(47246, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0), +(47247, 0x00, 5, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0.000000, 0.000000, 0); + +DELETE FROM `spell_proc_event` WHERE `entry` IN +(58631,55668,55669,55670,63320); + +DELETE FROM `spell_proc_event` WHERE `entry` IN (20375,21084,31801); +INSERT INTO `spell_proc_event` VALUES +(20375, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 1), +(21084, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0), +(31801, 0x00000001, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0.000000, 0.000000, 0); + +DELETE FROM `spell_proc_event` WHERE `entry` IN (51524,51523); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES ('51524', '0', '11', '0', '1', '0', '65536', '0', '0', '50', '0'); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES ('51523', '0', '11', '0', '1', '0', '65536', '0', '0', '50', '0'); + diff --git a/sql/updates/3.3.2_old/7332_world_spell_ranks.sql b/sql/updates/3.3.2_old/7332_world_spell_ranks.sql new file mode 100644 index 0000000..93c6c99 --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_spell_ranks.sql @@ -0,0 +1,6857 @@ +TRUNCATE TABLE spell_ranks; +INSERT INTO spell_ranks (`first_spell_id`, `spell_id`, `rank`) VALUES + -- Abomination's Might +(53137, 53137, 1), +(53137, 53138, 2), + -- Absolution +(33167, 33167, 1), +(33167, 33171, 2), +(33167, 33172, 3), + -- Acclimation +(49200, 49200, 1), +(49200, 50151, 2), +(49200, 50152, 3), + -- Acid Spit +(55749, 55749, 1), +(55749, 55750, 2), +(55749, 55751, 3), +(55749, 55752, 4), +(55749, 55753, 5), +(55749, 55754, 6), + -- Aftermath +(18119, 18119, 1), +(18119, 18120, 2), + -- Aggression +(18427, 18427, 1), +(18427, 18428, 2), +(18427, 18429, 3), +(18427, 61330, 4), +(18427, 61331, 5), + -- Agility +(8115, 8115, 1), +(8115, 8116, 2), +(8115, 8117, 3), +(8115, 12174, 4), +(8115, 33077, 5), +(8115, 43194, 6), +(8115, 58450, 7), +(8115, 58451, 8), + -- Aimed Shot +(19434, 19434, 1), +(19434, 20900, 2), +(19434, 20901, 3), +(19434, 20902, 4), +(19434, 20903, 5), +(19434, 20904, 6), +(19434, 27065, 7), +(19434, 49049, 8), +(19434, 49050, 9), + -- Alchemy +(2259, 2259, 1), +(2259, 3101, 2), +(2259, 3464, 3), +(2259, 11611, 4), +(2259, 28596, 5), +(2259, 51304, 6), + -- Ambush +(8676, 8676, 1), +(8676, 8724, 2), +(8676, 8725, 3), +(8676, 11267, 4), +(8676, 11268, 5), +(8676, 11269, 6), +(8676, 27441, 7), +(8676, 48689, 8), +(8676, 48690, 9), +(8676, 48691, 10), + -- Amplify Magic +(1267, 1267, 1), +(1267, 8456, 2), +(1267, 10171, 3), +(1267, 10172, 4), +(1267, 27397, 5), +(1267, 33947, 6), + -- Amplify Magic +(1008, 1008, 1), +(1008, 8455, 2), +(1008, 10169, 3), +(1008, 10170, 4), +(1008, 27130, 5), +(1008, 33946, 6), +(1008, 43017, 7), + -- Ancestral Awakening +(51556, 51556, 1), +(51556, 51557, 2), +(51556, 51558, 3), + -- Ancestral Fortitude +(16177, 16177, 1), +(16177, 16236, 2), +(16177, 16237, 3), + -- Ancestral Healing +(16176, 16176, 1), +(16176, 16235, 2), +(16176, 16240, 3), + -- Ancestral Knowledge +(17485, 17485, 1), +(17485, 17486, 2), +(17485, 17487, 3), +(17485, 17488, 4), +(17485, 17489, 5), + -- Ancestral Spirit +(2008, 2008, 1), +(2008, 20609, 2), +(2008, 20610, 3), +(2008, 20776, 4), +(2008, 20777, 5), +(2008, 25590, 6), +(2008, 49277, 7), + -- Anguish +(33704, 33704, 1), +(33704, 33705, 2), +(33704, 33706, 3), + -- Anguish +(33698, 33698, 1), +(33698, 33699, 2), +(33698, 33700, 3), +(33698, 47993, 4), + -- Animal Handler +(34453, 34453, 1), +(34453, 34454, 2), + -- Annihilation +(51468, 51468, 1), +(51468, 51472, 2), +(51468, 51473, 3), + -- Anticipation +(12297, 12297, 1), +(12297, 12750, 2), +(12297, 12751, 3), +(12297, 12752, 4), +(12297, 12753, 5), + -- Anticipation +(20096, 20096, 1), +(20096, 20097, 2), +(20096, 20098, 3), +(20096, 20099, 4), +(20096, 20100, 5), + -- Anticipation +(16254, 16254, 1), +(16254, 16271, 2), +(16254, 16272, 3), + -- Anticipation +(55129, 55129, 1), +(55129, 55130, 2), +(55129, 55131, 3), +(55129, 55132, 4), +(55129, 55133, 5), + -- Arcane Barrage +(44425, 44425, 1), +(44425, 44780, 2), +(44425, 44781, 3), + -- Arcane Blast +(30451, 30451, 1), +(30451, 42894, 2), +(30451, 42896, 3), +(30451, 42897, 4), + -- Arcane Brilliance +(23028, 23028, 1), +(23028, 27127, 2), +(23028, 43002, 3), + -- Arcane Concentration +(11213, 11213, 1), +(11213, 12574, 2), +(11213, 12575, 3), +(11213, 12576, 4), +(11213, 12577, 5), + -- Arcane Empowerment +(31579, 31579, 1), +(31579, 31582, 2), +(31579, 31583, 3), + -- Arcane Explosion +(1449, 1449, 1), +(1449, 8437, 2), +(1449, 8438, 3), +(1449, 8439, 4), +(1449, 10201, 5), +(1449, 10202, 6), +(1449, 27080, 7), +(1449, 27082, 8), +(1449, 42920, 9), +(1449, 42921, 10), + -- Arcane Flows +(44378, 44378, 1), +(44378, 44379, 2), + -- Arcane Focus +(11222, 11222, 1), +(11222, 12839, 2), +(11222, 12840, 3), + -- Arcane Fortitude +(28574, 28574, 1), +(28574, 54658, 2), +(28574, 54659, 3), + -- Arcane Instability +(15058, 15058, 1), +(15058, 15059, 2), +(15058, 15060, 3), + -- Arcane Intellect +(1459, 1459, 1), +(1459, 1460, 2), +(1459, 1461, 3), +(1459, 10156, 4), +(1459, 10157, 5), +(1459, 27126, 6), +(1459, 42995, 7), + -- Arcane Mastery +(16734, 16734, 1), +(16734, 16735, 2), +(16734, 16736, 3), +(16734, 16737, 4), +(16734, 16738, 5), + -- Arcane Meditation +(18462, 18462, 1), +(18462, 18463, 2), +(18462, 18464, 3), + -- Arcane Mind +(11232, 11232, 1), +(11232, 12500, 2), +(11232, 12501, 3), +(11232, 12502, 4), +(11232, 12503, 5), + -- Arcane Potency +(31571, 31571, 1), +(31571, 31572, 2), + -- Arcane Shielding +(11252, 11252, 1), +(11252, 12605, 2), + -- Arcane Shot +(3044, 3044, 1), +(3044, 14281, 2), +(3044, 14282, 3), +(3044, 14283, 4), +(3044, 14284, 5), +(3044, 14285, 6), +(3044, 14286, 7), +(3044, 14287, 8), +(3044, 27019, 9), +(3044, 49044, 10), +(3044, 49045, 11), + -- Arcane Stability +(11237, 11237, 1), +(11237, 12463, 2), +(11237, 12464, 3), +(11237, 16769, 4), +(11237, 16770, 5), + -- Arcane Subtlety +(11210, 11210, 1), +(11210, 12592, 2), + -- Arctic Reach +(16757, 16757, 1), +(16757, 16758, 2), + -- Arctic Winds +(31674, 31674, 1), +(31674, 31675, 2), +(31674, 31676, 3), +(31674, 31677, 4), +(31674, 31678, 5), + -- Ardent Defender +(31850, 31850, 1), +(31850, 31851, 2), +(31850, 31852, 3), + -- Armor +(8091, 8091, 1), +(8091, 8094, 2), +(8091, 8095, 3), +(8091, 12175, 4), +(8091, 33079, 5), +(8091, 43196, 6), +(8091, 58452, 7), +(8091, 58453, 8), + -- Armored to the Teeth +(61216, 61216, 1), +(61216, 61221, 2), +(61216, 61222, 3), + -- Aspect of the Dragonhawk +(61846, 61846, 1), +(61846, 61847, 2), + -- Aspect of the Hawk +(13165, 13165, 1), +(13165, 14318, 2), +(13165, 14319, 3), +(13165, 14320, 4), +(13165, 14321, 5), +(13165, 14322, 6), +(13165, 25296, 7), +(13165, 27044, 8), + -- Aspect of the Wild +(20043, 20043, 1), +(20043, 20190, 2), +(20043, 27045, 3), +(20043, 49071, 4), + -- Aspiration +(47507, 47507, 1), +(47507, 47508, 2), + -- Astral Shift +(51474, 51474, 1), +(51474, 51478, 2), +(51474, 51479, 3), + -- Avenger's Shield +(31935, 31935, 1), +(31935, 32699, 2), +(31935, 32700, 3), +(31935, 48826, 4), +(31935, 48827, 5), + -- Backdraft +(47258, 47258, 1), +(47258, 47259, 2), +(47258, 47260, 3), + -- Backlash +(34935, 34935, 1), +(34935, 34938, 2), +(34935, 34939, 3), + -- Backstab +(53, 53, 1), +(53, 2589, 2), +(53, 2590, 3), +(53, 2591, 4), +(53, 8721, 5), +(53, 11279, 6), +(53, 11280, 7), +(53, 11281, 8), +(53, 25300, 9), +(53, 26863, 10), +(53, 48656, 11), +(53, 48657, 12), + -- Bad Attitude +(50433, 50433, 1), +(50433, 52395, 2), +(50433, 52396, 3), +(50433, 52397, 4), +(50433, 52398, 5), +(50433, 52399, 6), + -- Balance of Power +(33592, 33592, 1), +(33592, 33596, 2), + -- Bane +(17788, 17788, 1), +(17788, 17789, 2), +(17788, 17790, 3), +(17788, 17791, 4), +(17788, 17792, 5), + -- Banish +(710, 710, 1), +(710, 18647, 2), + -- Barrage +(19461, 19461, 1), +(19461, 19462, 2), +(19461, 24691, 3), + -- Bash +(5211, 5211, 1), +(5211, 6798, 2), +(5211, 8983, 3), + -- Battle Shout +(6673, 6673, 1), +(6673, 5242, 2), +(6673, 6192, 3), +(6673, 11549, 4), +(6673, 11550, 5), +(6673, 11551, 6), +(6673, 25289, 7), +(6673, 2048, 8), +(6673, 47436, 9), + -- Benediction +(20101, 20101, 1), +(20101, 20102, 2), +(20101, 20103, 3), +(20101, 20104, 4), +(20101, 20105, 5), + -- Bestial Discipline +(19590, 19590, 1), +(19590, 19592, 2), + -- Bestial Fury +(19603, 19603, 1), +(19603, 19605, 2), +(19603, 19606, 3), +(19603, 19607, 4), +(19603, 19608, 5), + -- Binding Heal +(32546, 32546, 1), +(32546, 48119, 2), +(32546, 48120, 3), + -- Bite +(17254, 17254, 1), +(17254, 17262, 2), +(17254, 17263, 3), +(17254, 17264, 4), +(17254, 17265, 5), +(17254, 17266, 6), +(17254, 17267, 7), +(17254, 17268, 8), +(17254, 27348, 9), + -- Bite +(17253, 17253, 1), +(17253, 17255, 2), +(17253, 17256, 3), +(17253, 17257, 4), +(17253, 17258, 5), +(17253, 17259, 6), +(17253, 17260, 7), +(17253, 17261, 8), +(17253, 27050, 9), +(17253, 52473, 10), +(17253, 52474, 11), + -- Black Arrow +(3674, 3674, 1), +(3674, 63668, 2), +(3674, 63669, 3), +(3674, 63670, 4), +(3674, 63671, 5), +(3674, 63672, 6), + -- Black Ice +(49140, 49140, 1), +(49140, 49661, 2), +(49140, 49662, 3), +(49140, 49663, 4), +(49140, 49664, 5), + -- Blacksmithing +(2018, 2018, 1), +(2018, 3100, 2), +(2018, 3538, 3), +(2018, 9785, 4), +(2018, 29844, 5), +(2018, 51300, 6), + -- Blade Barrier +(51789, 51789, 1), +(51789, 64855, 2), +(51789, 64856, 3), +(51789, 64858, 4), +(51789, 64859, 5), + -- Blade Barrier +(49182, 49182, 1), +(49182, 49500, 2), +(49182, 49501, 3), +(49182, 55225, 4), +(49182, 55226, 5), + -- Blade Twisting +(31124, 31124, 1), +(31124, 31126, 2), + -- Bladed Armor +(48978, 48978, 1), +(48978, 49390, 2), +(48978, 49391, 3), +(48978, 49392, 4), +(48978, 49393, 5), + -- Blast Wave +(11113, 11113, 1), +(11113, 13018, 2), +(11113, 13019, 3), +(11113, 13020, 4), +(11113, 13021, 5), +(11113, 27133, 6), +(11113, 33933, 7), +(11113, 42944, 8), +(11113, 42945, 9), + -- Blazing Speed +(31641, 31641, 1), +(31641, 31642, 2), + -- Blessed Hands +(53660, 53660, 1), +(53660, 53661, 2), + -- Blessed Life +(31828, 31828, 1), +(31828, 31829, 2), +(31828, 31830, 3), + -- Blessing of Might +(19740, 19740, 1), +(19740, 19834, 2), +(19740, 19835, 3), +(19740, 19836, 4), +(19740, 19837, 5), +(19740, 19838, 6), +(19740, 25291, 7), +(19740, 27140, 8), +(19740, 48931, 9), +(19740, 48932, 10), + -- Blessing of the Eternals +(51554, 51554, 1), +(51554, 51555, 2), + -- Blessing of Wisdom +(19742, 19742, 1), +(19742, 19850, 2), +(19742, 19852, 3), +(19742, 19853, 4), +(19742, 19854, 5), +(19742, 25290, 6), +(19742, 27142, 7), +(19742, 48935, 8), +(19742, 48936, 9), + -- Blood Boil +(48721, 48721, 1), +(48721, 49939, 2), +(48721, 49940, 3), +(48721, 49941, 4), + -- Blood Craze +(16487, 16487, 1), +(16487, 16489, 2), +(16487, 16492, 3), + -- Blood Frenzy +(30069, 30069, 1), +(30069, 30070, 2), + -- Blood Frenzy +(29836, 29836, 1), +(29836, 29859, 2), + -- Blood Frenzy +(16952, 16952, 1), +(16952, 16954, 2), + -- Blood of Icewater +(50122, 50122, 1), +(50122, 50123, 2), +(50122, 50124, 3), +(50122, 50125, 4), +(50122, 50126, 5), + -- Blood of the North +(54639, 54639, 1), +(54639, 54638, 2), +(54639, 54637, 3), + -- Blood of the Rhino +(53481, 53481, 1), +(53481, 53482, 2), + -- Blood Pact +(6307, 6307, 1), +(6307, 7804, 2), +(6307, 7805, 3), +(6307, 11766, 4), +(6307, 11767, 5), +(6307, 27268, 6), +(6307, 47982, 7), + -- Blood Spatter +(51632, 51632, 1), +(51632, 51633, 2), + -- Blood-Caked Blade +(49219, 49219, 1), +(49219, 49627, 2), +(49219, 49628, 3), + -- Bloodsurge +(46913, 46913, 1), +(46913, 46914, 2), +(46913, 46915, 3), + -- Bloodthirsty +(53186, 53186, 1), +(53186, 53187, 2), + -- Bloodworms +(49027, 49027, 1), +(49027, 49542, 2), +(49027, 49543, 3), + -- Bloody Strikes +(48977, 48977, 1), +(48977, 49394, 2), +(48977, 49395, 3), + -- Bloody Vengeance +(48988, 48988, 1), +(48988, 49503, 2), +(48988, 49504, 3), + -- Body and Soul +(64127, 64127, 1), +(64127, 64129, 2), + -- Booming Echoes +(63370, 63370, 1), +(63370, 63372, 2), + -- Booming Voice +(12321, 12321, 1), +(12321, 12835, 2), + -- Borrowed Time +(52795, 52795, 1), +(52795, 52797, 2), +(52795, 52798, 3), +(52795, 52799, 4), +(52795, 52800, 5), + -- Brain Freeze +(44546, 44546, 1), +(44546, 44548, 2), +(44546, 44549, 3), + -- Brambles +(16836, 16836, 1), +(16836, 16839, 2), +(16836, 16840, 3), + -- Brutal Impact +(16940, 16940, 1), +(16940, 16941, 2), + -- Burning Determination +(54747, 54747, 1), +(54747, 54749, 2), + -- Burning Soul +(11083, 11083, 1), +(11083, 12351, 2), + -- Burnout +(44449, 44449, 1), +(44449, 44469, 2), +(44449, 44470, 3), +(44449, 44471, 4), +(44449, 44472, 5), + -- Butchery +(48979, 48979, 1), +(48979, 49483, 2), + -- Call of Flame +(16038, 16038, 1), +(16038, 16160, 2), +(16038, 16161, 3), + -- Camouflage +(13975, 13975, 1), +(13975, 14062, 2), +(13975, 14063, 3), + -- Careful Aim +(34482, 34482, 1), +(34482, 34483, 2), +(34482, 34484, 3), + -- Cataclysm +(17778, 17778, 1), +(17778, 17779, 2), +(17778, 17780, 3), + -- Catlike Reflexes +(34462, 34462, 1), +(34462, 34464, 2), +(34462, 34465, 3), + -- Celestial Focus +(16850, 16850, 1), +(16850, 16923, 2), +(16850, 16924, 3), + -- Chain Heal +(1064, 1064, 1), +(1064, 10622, 2), +(1064, 10623, 3), +(1064, 25422, 4), +(1064, 25423, 5), +(1064, 55458, 6), +(1064, 55459, 7), + -- Chains of Ice +(113, 113, 1), +(113, 512, 2), + -- Chaos Bolt +(50796, 50796, 1), +(50796, 59170, 2), +(50796, 59171, 3), +(50796, 59172, 4), + -- Charge +(100, 100, 1), +(100, 6178, 2), +(100, 11578, 3), + -- Charge Rage Bonus Effect +(12695, 12695, 1), +(12695, 12696, 2), + -- Cheat Death +(31228, 31228, 1), +(31228, 31229, 2), +(31228, 31230, 3), + -- Chilblains +(50040, 50040, 1), +(50040, 50041, 2), +(50040, 50043, 3), + -- Chill of the Grave +(49149, 49149, 1), +(49149, 50115, 2), + -- Chilled +(12484, 12484, 1), +(12484, 12485, 2), +(12484, 12486, 3), + -- Chilled to the Bone +(44566, 44566, 1), +(44566, 44567, 2), +(44566, 44568, 3), +(44566, 44570, 4), +(44566, 44571, 5), + -- Circle of Healing +(34861, 34861, 1), +(34861, 34863, 2), +(34861, 34864, 3), +(34861, 34865, 4), +(34861, 34866, 5), +(34861, 48088, 6), +(34861, 48089, 7), + -- Claw +(1082, 1082, 1), +(1082, 3029, 2), +(1082, 5201, 3), +(1082, 9849, 4), +(1082, 9850, 5), +(1082, 27000, 6), +(1082, 48569, 7), +(1082, 48570, 8), + -- Claw +(16827, 16827, 1), +(16827, 16828, 2), +(16827, 16829, 3), +(16827, 16830, 4), +(16827, 16831, 5), +(16827, 16832, 6), +(16827, 3010, 7), +(16827, 3009, 8), +(16827, 27049, 9), +(16827, 52471, 10), +(16827, 52472, 11), + -- Cleave +(30214, 30214, 1), +(30214, 30222, 2), +(30214, 30224, 3), + -- Cleave +(845, 845, 1), +(845, 7369, 2), +(845, 11608, 3), +(845, 11609, 4), +(845, 20569, 5), +(845, 25231, 6), +(845, 47519, 7), +(845, 47520, 8), + -- Cleave +(30213, 30213, 1), +(30213, 30219, 2), +(30213, 30223, 3), +(30213, 47994, 4), + -- Cleave Armor +(5508, 5508, 1), +(5508, 5480, 2), + -- Close Quarters Combat +(13706, 13706, 1), +(13706, 13804, 2), +(13706, 13805, 3), +(13706, 13806, 4), +(13706, 13807, 5), + -- Cobra Reflexes +(61682, 61682, 1), +(61682, 61683, 2), + -- Cobra Strikes +(53256, 53256, 1), +(53256, 53259, 2), +(53256, 53260, 3), + -- Cold as Ice +(55091, 55091, 1), +(55091, 55092, 2), + -- Combat Endurance +(17427, 17427, 1), +(17427, 17428, 2), +(17427, 17429, 3), + -- Combat Experience +(34475, 34475, 1), +(34475, 34476, 2), + -- Combat Expertise +(31858, 31858, 1), +(31858, 31859, 2), +(31858, 31860, 3), + -- Combat Potency +(35542, 35542, 1), +(35542, 35545, 2), +(35542, 35546, 3), +(35542, 35547, 4), +(35542, 35548, 5), + -- Combat Potency +(35541, 35541, 1), +(35541, 35550, 2), +(35541, 35551, 3), +(35541, 35552, 4), +(35541, 35553, 5), + -- Commanding Presence +(12318, 12318, 1), +(12318, 12857, 2), +(12318, 12858, 3), +(12318, 12860, 4), +(12318, 12861, 5), + -- Commanding Shout +(469, 469, 1), +(469, 47439, 2), +(469, 47440, 3), + -- Concussion +(16035, 16035, 1), +(16035, 16105, 2), +(16035, 16106, 3), +(16035, 16107, 4), +(16035, 16108, 5), + -- Concussive Barrage +(35100, 35100, 1), +(35100, 35102, 2), + -- Cone of Cold +(120, 120, 1), +(120, 8492, 2), +(120, 10159, 3), +(120, 10160, 4), +(120, 10161, 5), +(120, 27087, 6), +(120, 42930, 7), +(120, 42931, 8), + -- Conjure Food +(587, 587, 1), +(587, 597, 2), +(587, 990, 3), +(587, 6129, 4), +(587, 10144, 5), +(587, 10145, 6), +(587, 28612, 7), +(587, 33717, 8), + -- Conjure Mana Gem +(759, 759, 1), +(759, 3552, 2), +(759, 10053, 3), +(759, 10054, 4), +(759, 27101, 5), +(759, 42985, 6), + -- Conjure Refreshment +(42955, 42955, 1), +(42955, 42956, 2), + -- Conjure Water +(5504, 5504, 1), +(5504, 5505, 2), +(5504, 5506, 3), +(5504, 6127, 4), +(5504, 10138, 5), +(5504, 10139, 6), +(5504, 10140, 7), +(5504, 37420, 8), +(5504, 27090, 9), + -- Consecration +(26573, 26573, 1), +(26573, 20116, 2), +(26573, 20922, 3), +(26573, 20923, 4), +(26573, 20924, 5), +(26573, 27173, 6), +(26573, 48818, 7), +(26573, 48819, 8), + -- Consume Shadows +(17767, 17767, 1), +(17767, 17850, 2), +(17767, 17851, 3), +(17767, 17852, 4), +(17767, 17853, 5), +(17767, 17854, 6), +(17767, 27272, 7), +(17767, 47987, 8), +(17767, 47988, 9), + -- Contagion +(30060, 30060, 1), +(30060, 30061, 2), +(30060, 30062, 3), +(30060, 30063, 4), +(30060, 30064, 5), + -- Convection +(16039, 16039, 1), +(16039, 16109, 2), +(16039, 16110, 3), +(16039, 16111, 4), +(16039, 16112, 5), + -- Conviction +(20117, 20117, 1), +(20117, 20118, 2), +(20117, 20119, 3), +(20117, 20120, 4), +(20117, 20121, 5), + -- Cooking +(2550, 2550, 1), +(2550, 3102, 2), +(2550, 3413, 3), +(2550, 18260, 4), +(2550, 33359, 5), +(2550, 51296, 6), + -- Cornered +(52234, 52234, 1), +(52234, 53497, 2), + -- Corpse Explosion +(49158, 49158, 1), +(49158, 51325, 2), +(49158, 51326, 3), +(49158, 51327, 4), +(49158, 51328, 5), + -- Corruption +(172, 172, 1), +(172, 6222, 2), +(172, 6223, 3), +(172, 7648, 4), +(172, 11671, 5), +(172, 11672, 6), +(172, 25311, 7), +(172, 27216, 8), +(172, 47812, 9), +(172, 47813, 10), + -- Counterattack +(19306, 19306, 1), +(19306, 20909, 2), +(19306, 20910, 3), +(19306, 27067, 4), +(19306, 48998, 5), +(19306, 48999, 6), + -- Cower +(8998, 8998, 1), +(8998, 9000, 2), +(8998, 9892, 3), +(8998, 31709, 4), +(8998, 27004, 5), +(8998, 48575, 6), + -- Create Firestone +(6366, 6366, 1), +(6366, 17951, 2), +(6366, 17952, 3), +(6366, 17953, 4), +(6366, 27250, 5), +(6366, 60219, 6), +(6366, 60220, 7), + -- Create Healthstone +(6201, 6201, 1), +(6201, 6202, 2), +(6201, 5699, 3), +(6201, 11729, 4), +(6201, 11730, 5), +(6201, 27230, 6), +(6201, 47871, 7), +(6201, 47878, 8), + -- Create Soulstone +(693, 693, 1), +(693, 20752, 2), +(693, 20755, 3), +(693, 20756, 4), +(693, 20757, 5), +(693, 27238, 6), +(693, 47884, 7), + -- Create Spellstone +(2362, 2362, 1), +(2362, 17727, 2), +(2362, 17728, 3), +(2362, 28172, 4), +(2362, 47886, 5), +(2362, 47888, 6), + -- Critical Block +(47294, 47294, 1), +(47294, 47295, 2), +(47294, 47296, 3), + -- Critical Mass +(11115, 11115, 1), +(11115, 11367, 2), +(11115, 11368, 3), + -- Cruelty +(12320, 12320, 1), +(12320, 12852, 2), +(12320, 12853, 3), +(12320, 12855, 4), +(12320, 12856, 5), + -- Crusade +(31866, 31866, 1), +(31866, 31867, 2), +(31866, 31868, 3), + -- Crypt Fever +(49032, 49032, 1), +(49032, 49631, 2), +(49032, 49632, 3), + -- Culling the Herd +(61680, 61680, 1), +(61680, 61681, 2), +(61680, 52858, 3), + -- Curse of Agony +(980, 980, 1), +(980, 1014, 2), +(980, 6217, 3), +(980, 11711, 4), +(980, 11712, 5), +(980, 11713, 6), +(980, 27218, 7), +(980, 47863, 8), +(980, 47864, 9), + -- Curse of Doom +(603, 603, 1), +(603, 30910, 2), +(603, 47867, 3), + -- Curse of the Elements +(1490, 1490, 1), +(1490, 11721, 2), +(1490, 11722, 3), +(1490, 27228, 4), +(1490, 47865, 5), + -- Curse of Tongues +(1714, 1714, 1), +(1714, 11719, 2), + -- Curse of Weakness +(702, 702, 1), +(702, 1108, 2), +(702, 6205, 3), +(702, 7646, 4), +(702, 11707, 5), +(702, 11708, 6), +(702, 27224, 7), +(702, 30909, 8), +(702, 50511, 9), + -- Cut to the Chase +(51664, 51664, 1), +(51664, 51665, 2), +(51664, 51667, 3), +(51664, 51668, 4), +(51664, 51669, 5), + -- Damage Shield +(58872, 58872, 1), +(58872, 58874, 2), + -- Dampen Magic +(1266, 1266, 1), +(1266, 8452, 2), +(1266, 8453, 3), +(1266, 10175, 4), +(1266, 10176, 5), + -- Dampen Magic +(604, 604, 1), +(604, 8450, 2), +(604, 8451, 3), +(604, 10173, 4), +(604, 10174, 5), +(604, 33944, 6), +(604, 43015, 7), + -- Dark Conviction +(48987, 48987, 1), +(48987, 49477, 2), +(48987, 49478, 3), +(48987, 49479, 4), +(48987, 49480, 5), + -- Dark Pact +(18220, 18220, 1), +(18220, 18937, 2), +(18220, 18938, 3), +(18220, 27265, 4), +(18220, 59092, 5), + -- Darkness +(15259, 15259, 1), +(15259, 15307, 2), +(15259, 15308, 3), +(15259, 15309, 4), +(15259, 15310, 5), + -- Dash +(1850, 1850, 1), +(1850, 9821, 2), +(1850, 33357, 3), + -- Deadened Nerves +(31380, 31380, 1), +(31380, 31382, 2), +(31380, 31383, 3), + -- Deadliness +(30902, 30902, 1), +(30902, 30903, 2), +(30902, 30904, 3), +(30902, 30905, 4), +(30902, 30906, 5), + -- Deadly Brew +(51625, 51625, 1), +(51625, 51626, 2), + -- Deadly Throw +(26679, 26679, 1), +(26679, 48673, 2), +(26679, 48674, 3), + -- Death and Decay +(43265, 43265, 1), +(43265, 49936, 2), +(43265, 49937, 3), +(43265, 49938, 4), + -- Death Coil +(6789, 6789, 1), +(6789, 17925, 2), +(6789, 17926, 3), +(6789, 27223, 4), +(6789, 47859, 5), +(6789, 47860, 6), + -- Death Coil +(62900, 62900, 1), +(62900, 62901, 2), +(62900, 62902, 3), +(62900, 62903, 4), +(62900, 62904, 5), + -- Death Strike +(49998, 49998, 1), +(49998, 49999, 2), +(49998, 45463, 3), +(49998, 49923, 4), +(49998, 49924, 5), + -- Death's Embrace +(47198, 47198, 1), +(47198, 47199, 2), +(47198, 47200, 3), + -- Decimation +(63156, 63156, 1), +(63156, 63158, 2), + -- Deep Wounds +(12162, 12162, 1), +(12162, 12850, 2), +(12162, 12868, 3), + -- Deep Wounds +(12834, 12834, 1), +(12834, 12849, 2), +(12834, 12867, 3), + -- Defensive Tactics +(29559, 29559, 1), +(29559, 29588, 2), +(29559, 29589, 3), + -- Defiance +(12303, 12303, 1), +(12303, 12788, 2), +(12303, 12789, 3), + -- Deflection +(16462, 16462, 1), +(16462, 16463, 2), +(16462, 16464, 3), +(16462, 16465, 4), +(16462, 16466, 5), + -- Deflection +(13713, 13713, 1), +(13713, 13853, 2), +(13713, 13854, 3), + -- Deflection +(19295, 19295, 1), +(19295, 19297, 2), +(19295, 19298, 3), + -- Deflection +(20060, 20060, 1), +(20060, 20061, 2), +(20060, 20062, 3), +(20060, 20063, 4), +(20060, 20064, 5), + -- Demon Armor +(706, 706, 1), +(706, 1086, 2), +(706, 11733, 3), +(706, 11734, 4), +(706, 11735, 5), +(706, 27260, 6), +(706, 47793, 7), +(706, 47889, 8), + -- Demon Skin +(687, 687, 1), +(687, 696, 2), + -- Demonic Aegis +(30143, 30143, 1), +(30143, 30144, 2), +(30143, 30145, 3), + -- Demonic Brutality +(18705, 18705, 1), +(18705, 18706, 2), +(18705, 18707, 3), + -- Demonic Embrace +(18697, 18697, 1), +(18697, 18698, 2), +(18697, 18699, 3), + -- Demonic Knowledge +(35691, 35691, 1), +(35691, 35692, 2), +(35691, 35693, 3), + -- Demonic Pact +(47236, 47236, 1), +(47236, 47237, 2), +(47236, 47238, 3), +(47236, 47239, 4), +(47236, 47240, 5), + -- Demonic Power +(18126, 18126, 1), +(18126, 18127, 2), + -- Demonic Resilience +(30319, 30319, 1), +(30319, 30320, 2), +(30319, 30321, 3), + -- Demonic Tactics +(30242, 30242, 1), +(30242, 30245, 2), +(30242, 30246, 3), +(30242, 30247, 4), +(30242, 30248, 5), + -- Demoralizing Roar +(99, 99, 1), +(99, 1735, 2), +(99, 9490, 3), +(99, 9747, 4), +(99, 9898, 5), +(99, 26998, 6), +(99, 48559, 7), +(99, 48560, 8), + -- Demoralizing Screech +(24424, 24424, 1), +(24424, 24580, 2), +(24424, 24581, 3), +(24424, 24582, 4), +(24424, 27349, 5), + -- Demoralizing Screech +(24423, 24423, 1), +(24423, 24577, 2), +(24423, 24578, 3), +(24423, 24579, 4), +(24423, 27051, 5), +(24423, 55487, 6), + -- Demoralizing Shout +(1160, 1160, 1), +(1160, 6190, 2), +(1160, 11554, 3), +(1160, 11555, 4), +(1160, 11556, 5), +(1160, 25202, 6), +(1160, 25203, 7), +(1160, 47437, 8), + -- Desecration +(55666, 55666, 1), +(55666, 55667, 2), + -- Desperate Prayer +(19236, 19236, 1), +(19236, 19238, 2), +(19236, 19240, 3), +(19236, 19241, 4), +(19236, 19242, 5), +(19236, 19243, 6), +(19236, 25437, 7), +(19236, 48172, 8), +(19236, 48173, 9), + -- Destructive Reach +(17917, 17917, 1), +(17917, 17918, 2), + -- Destructive Soul +(30251, 30251, 1), +(30251, 30256, 2), + -- Devastate +(20243, 20243, 1), +(20243, 30016, 2), +(20243, 30022, 3), +(20243, 47497, 4), +(20243, 47498, 5), + -- Devotion Aura +(465, 465, 1), +(465, 10290, 2), +(465, 643, 3), +(465, 10291, 4), +(465, 1032, 5), +(465, 10292, 6), +(465, 10293, 7), +(465, 27149, 8), +(465, 48941, 9), +(465, 48942, 10), + -- Devour Magic +(19505, 19505, 1), +(19505, 19731, 2), +(19505, 19734, 3), +(19505, 19736, 4), +(19505, 27276, 5), +(19505, 27277, 6), +(19505, 48011, 7), + -- Devouring Plague +(2944, 2944, 1), +(2944, 19276, 2), +(2944, 19277, 3), +(2944, 19278, 4), +(2944, 19279, 5), +(2944, 19280, 6), +(2944, 25467, 7), +(2944, 48299, 8), +(2944, 48300, 9), + -- Dirge +(49223, 49223, 1), +(49223, 49599, 2), + -- Dirty Deeds +(14082, 14082, 1), +(14082, 14083, 2), + -- Dirty Tricks +(14076, 14076, 1), +(14076, 14094, 2), + -- Dispel Magic +(527, 527, 1), +(527, 988, 2), + -- Displacement +(34478, 34478, 1), +(34478, 34479, 2), +(34478, 34481, 3), + -- Dive +(23146, 23146, 1), +(23146, 23149, 2), +(23146, 23150, 3), + -- Divine Aegis +(47509, 47509, 1), +(47509, 47511, 2), +(47509, 47515, 3), + -- Divine Fury +(18530, 18530, 1), +(18530, 18531, 2), +(18530, 18533, 3), +(18530, 18534, 4), +(18530, 18535, 5), + -- Divine Guardian +(53527, 53527, 1), +(53527, 53530, 2), + -- Divine Intellect +(20257, 20257, 1), +(20257, 20258, 2), +(20257, 20259, 3), +(20257, 20260, 4), +(20257, 20261, 5), + -- Divine Providence +(47562, 47562, 1), +(47562, 47564, 2), +(47562, 47565, 3), +(47562, 47566, 4), +(47562, 47567, 5), + -- Divine Purpose +(31871, 31871, 1), +(31871, 31872, 2), + -- Divine Spirit +(14752, 14752, 1), +(14752, 14818, 2), +(14752, 14819, 3), +(14752, 27841, 4), +(14752, 25312, 5), +(14752, 48073, 6), + -- Divine Strength +(20262, 20262, 1), +(20262, 20263, 2), +(20262, 20264, 3), +(20262, 20265, 4), +(20262, 20266, 5), + -- Divinity +(63646, 63646, 1), +(63646, 63647, 2), +(63646, 63648, 3), +(63646, 63649, 4), +(63646, 63650, 5), + -- Dragon's Breath +(31661, 31661, 1), +(31661, 33041, 2), +(31661, 33042, 3), +(31661, 33043, 4), +(31661, 42949, 5), +(31661, 42950, 6), + -- Drain Life +(689, 689, 1), +(689, 699, 2), +(689, 709, 3), +(689, 7651, 4), +(689, 11699, 5), +(689, 11700, 6), +(689, 27219, 7), +(689, 27220, 8), +(689, 47857, 9), + -- Drain Soul +(1120, 1120, 1), +(1120, 8288, 2), +(1120, 8289, 3), +(1120, 11675, 4), +(1120, 27217, 5), +(1120, 47855, 6), + -- Dreamstate +(33597, 33597, 1), +(33597, 33599, 2), +(33597, 33956, 3), + -- Dual Wield Specialization +(13715, 13715, 1), +(13715, 13848, 2), +(13715, 13849, 3), +(13715, 13851, 4), +(13715, 13852, 5), + -- Dual Wield Specialization +(23584, 23584, 1), +(23584, 23585, 2), +(23584, 23586, 3), +(23584, 23587, 4), +(23584, 23588, 5), + -- Dual Wield Specialization +(30816, 30816, 1), +(30816, 30818, 2), +(30816, 30819, 3), + -- Earth and Moon +(48506, 48506, 1), +(48506, 48510, 2), +(48506, 48511, 3), + -- Earth Shield +(974, 974, 1), +(974, 32593, 2), +(974, 32594, 3), +(974, 49283, 4), +(974, 49284, 5), + -- Earth Shock +(8042, 8042, 1), +(8042, 8044, 2), +(8042, 8045, 3), +(8042, 8046, 4), +(8042, 10412, 5), +(8042, 10413, 6), +(8042, 10414, 7), +(8042, 25454, 8), +(8042, 49230, 9), +(8042, 49231, 10), + -- Earthen Power +(51523, 51523, 1), +(51523, 51524, 2), + -- Earthliving +(51945, 51945, 1), +(51945, 51990, 2), +(51945, 51997, 3), +(51945, 51998, 4), +(51945, 51999, 5), +(51945, 52000, 6), + -- Earthliving Weapon +(51730, 51730, 1), +(51730, 51988, 2), +(51730, 51991, 3), +(51730, 51992, 4), +(51730, 51993, 5), +(51730, 51994, 6), + -- Earthliving Weapon (Passive) +(51940, 51940, 1), +(51940, 51989, 2), +(51940, 52004, 3), +(51940, 52005, 4), +(51940, 52007, 5), +(51940, 52008, 6), + -- Earth's Grasp +(16043, 16043, 1), +(16043, 16130, 2), + -- Ebon Plaguebringer +(51099, 51099, 1), +(51099, 51160, 2), +(51099, 51161, 3), + -- Eclipse +(48516, 48516, 1), +(48516, 48521, 2), +(48516, 48525, 3), + -- Efficiency +(19416, 19416, 1), +(19416, 19417, 2), +(19416, 19418, 3), +(19416, 19419, 4), +(19416, 19420, 5), + -- Elemental Absorption +(30701, 30701, 1), +(30701, 30702, 2), +(30701, 30703, 3), +(30701, 30704, 4), +(30701, 30705, 5), + -- Elemental Oath +(51466, 51466, 1), +(51466, 51470, 2), + -- Elemental Precision +(30672, 30672, 1), +(30672, 30673, 2), +(30672, 30674, 3), + -- Elemental Reach +(28999, 28999, 1), +(28999, 29000, 2), + -- Elemental Shields +(30669, 30669, 1), +(30669, 30670, 2), +(30669, 30671, 3), + -- Elemental Warding +(28996, 28996, 1), +(28996, 28997, 2), +(28996, 28998, 3), + -- Elemental Weapons +(16266, 16266, 1), +(16266, 29079, 2), +(16266, 29080, 3), + -- Elusiveness +(13981, 13981, 1), +(13981, 14066, 2), + -- Emberstorm +(17954, 17954, 1), +(17954, 17955, 2), +(17954, 17956, 3), +(17954, 17957, 4), +(17954, 17958, 5), + -- Empowered Corruption +(32381, 32381, 1), +(32381, 32382, 2), +(32381, 32383, 3), + -- Empowered Fire +(31656, 31656, 1), +(31656, 31657, 2), +(31656, 31658, 3), + -- Empowered Frostbolt +(31682, 31682, 1), +(31682, 31683, 2), + -- Empowered Healing +(33158, 33158, 1), +(33158, 33159, 2), +(33158, 33160, 3), +(33158, 33161, 4), +(33158, 33162, 5), + -- Empowered Imp +(47220, 47220, 1), +(47220, 47221, 2), +(47220, 47223, 3), + -- Empowered Rejuvenation +(33886, 33886, 1), +(33886, 33887, 2), +(33886, 33888, 3), +(33886, 33889, 4), +(33886, 33890, 5), + -- Empowered Renew +(63534, 63534, 1), +(63534, 63542, 2), +(63534, 63543, 3), + -- Empowered Touch +(33879, 33879, 1), +(33879, 33880, 2), + -- Enchanting +(7411, 7411, 1), +(7411, 7412, 2), +(7411, 7413, 3), +(7411, 13920, 4), +(7411, 28029, 5), +(7411, 51313, 6), + -- Endless Winter +(49137, 49137, 1), +(49137, 49657, 2), + -- Endurance +(13742, 13742, 1), +(13742, 13872, 2), + -- Endurance Training +(19583, 19583, 1), +(19583, 19584, 2), +(19583, 19585, 3), +(19583, 19586, 4), +(19583, 19587, 5), + -- Enduring Winter +(44557, 44557, 1), +(44557, 44560, 2), +(44557, 44561, 3), + -- Engineering +(4036, 4036, 1), +(4036, 4037, 2), +(4036, 4038, 3), +(4036, 12656, 4), +(4036, 30350, 5), +(4036, 51306, 6), + -- Enhancing Totems +(16259, 16259, 1), +(16259, 16295, 2), +(16259, 52456, 3), + -- Enlightened Judgements +(53556, 53556, 1), +(53556, 53557, 2), + -- Enlightenment +(34908, 34908, 1), +(34908, 34909, 2), +(34908, 34910, 3), + -- Enrage +(12317, 12317, 1), +(12317, 13045, 2), +(12317, 13046, 3), +(12317, 13047, 4), +(12317, 13048, 5), + -- Enslave Demon +(1098, 1098, 1), +(1098, 11725, 2), +(1098, 11726, 3), +(1098, 61191, 4), + -- Entangling Roots +(339, 339, 1), +(339, 1062, 2), +(339, 5195, 3), +(339, 5196, 4), +(339, 9852, 5), +(339, 9853, 6), +(339, 26989, 7), +(339, 53308, 8), + -- Entrapment +(19184, 19184, 1), +(19184, 19387, 2), +(19184, 19388, 3), + -- Enveloping Shadows +(31211, 31211, 1), +(31211, 31212, 2), +(31211, 31213, 3), + -- Envenom +(32645, 32645, 1), +(32645, 32684, 2), +(32645, 57992, 3), +(32645, 57993, 4), + -- Epidemic +(49036, 49036, 1), +(49036, 49562, 2), + -- Eradication +(47195, 47195, 1), +(47195, 47196, 2), +(47195, 47197, 3), + -- Evasion +(5277, 5277, 1), +(5277, 26669, 2), + -- Everlasting Affliction +(47201, 47201, 1), +(47201, 47202, 2), +(47201, 47203, 3), +(47201, 47204, 4), +(47201, 47205, 5), + -- Eviscerate +(2098, 2098, 1), +(2098, 6760, 2), +(2098, 6761, 3), +(2098, 6762, 4), +(2098, 8623, 5), +(2098, 8624, 6), +(2098, 11299, 7), +(2098, 11300, 8), +(2098, 31016, 9), +(2098, 26865, 10), +(2098, 48667, 11), +(2098, 48668, 12), + -- Execute +(5308, 5308, 1), +(5308, 20658, 2), +(5308, 20660, 3), +(5308, 20661, 4), +(5308, 20662, 5), +(5308, 25234, 6), +(5308, 25236, 7), +(5308, 47470, 8), +(5308, 47471, 9), + -- Exorcism +(879, 879, 1), +(879, 5614, 2), +(879, 5615, 3), +(879, 10312, 4), +(879, 10313, 5), +(879, 10314, 6), +(879, 27138, 7), +(879, 48800, 8), +(879, 48801, 9), + -- Explosive Shot +(53301, 53301, 1), +(53301, 60051, 2), +(53301, 60052, 3), +(53301, 60053, 4), + -- Explosive Trap +(13813, 13813, 1), +(13813, 14316, 2), +(13813, 14317, 3), +(13813, 27025, 4), +(13813, 49066, 5), +(13813, 49067, 6), + -- Explosive Trap Effect +(13812, 13812, 1), +(13812, 14314, 2), +(13812, 14315, 3), +(13812, 27026, 4), +(13812, 49064, 5), +(13812, 49065, 6), + -- Expose Weakness +(34500, 34500, 1), +(34500, 34502, 2), +(34500, 34503, 3), + -- Eye of the Storm +(29062, 29062, 1), +(29062, 29064, 2), +(29062, 29065, 3), + -- Faerie Fire +(13424, 13424, 1), +(13424, 13752, 2), + -- Fanaticism +(31879, 31879, 1), +(31879, 31880, 2), +(31879, 31881, 3), + -- Fear +(5782, 5782, 1), +(5782, 6213, 2), +(5782, 6215, 3), + -- Feeding Frenzy +(60096, 60096, 1), +(60096, 60097, 2), + -- Feeding Frenzy +(53511, 53511, 1), +(53511, 53512, 2), + -- Feint +(1966, 1966, 1), +(1966, 6768, 2), +(1966, 8637, 3), +(1966, 11303, 4), +(1966, 25302, 5), +(1966, 27448, 6), +(1966, 48658, 7), +(1966, 48659, 8), + -- Fel Armor +(28176, 28176, 1), +(28176, 28189, 2), +(28176, 47892, 3), +(28176, 47893, 4), + -- Fel Concentration +(17783, 17783, 1), +(17783, 17784, 2), +(17783, 17785, 3), + -- Fel Intelligence +(54424, 54424, 1), +(54424, 57564, 2), +(54424, 57565, 3), +(54424, 57566, 4), +(54424, 57567, 5), + -- Fel Synergy +(47230, 47230, 1), +(47230, 47231, 2), + -- Fel Vitality +(18731, 18731, 1), +(18731, 18743, 2), +(18731, 18744, 3), + -- Feral Aggression +(16858, 16858, 1), +(16858, 16859, 2), +(16858, 16860, 3), +(16858, 16861, 4), +(16858, 16862, 5), + -- Feral Instinct +(16947, 16947, 1), +(16947, 16948, 2), +(16947, 16949, 3), + -- Ferocious Bite +(22568, 22568, 1), +(22568, 22827, 2), +(22568, 22828, 3), +(22568, 22829, 4), +(22568, 31018, 5), +(22568, 24248, 6), +(22568, 48576, 7), +(22568, 48577, 8), + -- Ferocious Dead +(49038, 49038, 1), +(49038, 49595, 2), +(49038, 49596, 3), + -- Ferocious Inspiration +(34455, 34455, 1), +(34455, 34459, 2), +(34455, 34460, 3), + -- Ferocity +(19598, 19598, 1), +(19598, 19599, 2), +(19598, 19600, 3), +(19598, 19601, 4), +(19598, 19602, 5), + -- Ferocity +(16934, 16934, 1), +(16934, 16935, 2), +(16934, 16936, 3), +(16934, 16937, 4), +(16934, 16938, 5), + -- Filthy Tricks +(58414, 58414, 1), +(58414, 58415, 2), + -- Find Weakness +(31234, 31234, 1), +(31234, 31235, 2), +(31234, 31236, 3), + -- Fingers of Frost +(44543, 44543, 1), +(44543, 44545, 2), + -- Fire and Brimstone +(47266, 47266, 1), +(47266, 47267, 2), +(47266, 47268, 3), +(47266, 47269, 4), +(47266, 47270, 5), + -- Fire Blast +(2141, 2141, 1), +(2141, 2142, 2), +(2141, 2143, 3), +(2141, 8414, 4), +(2141, 8415, 5), +(2141, 10198, 6), +(2141, 10200, 7), +(2141, 27378, 8), +(2141, 27379, 9), + -- Fire Blast +(2136, 2136, 1), +(2136, 2137, 2), +(2136, 2138, 3), +(2136, 8412, 4), +(2136, 8413, 5), +(2136, 10197, 6), +(2136, 10199, 7), +(2136, 27078, 8), +(2136, 27079, 9), +(2136, 42872, 10), +(2136, 42873, 11), + -- Fire Breath +(34889, 34889, 1), +(34889, 35323, 2), +(34889, 55482, 3), +(34889, 55483, 4), +(34889, 55484, 5), +(34889, 55485, 6), + -- Fire Power +(11124, 11124, 1), +(11124, 12378, 2), +(11124, 12398, 3), +(11124, 12399, 4), +(11124, 12400, 5), + -- Fire Resistance Aura +(19891, 19891, 1), +(19891, 19899, 2), +(19891, 19900, 3), +(19891, 27153, 4), +(19891, 48947, 5), + -- Fire Resistance Totem +(8184, 8184, 1), +(8184, 10537, 2), +(8184, 10538, 3), +(8184, 25563, 4), +(8184, 58737, 5), +(8184, 58739, 6), + -- Fire Shield +(2947, 2947, 1), +(2947, 8316, 2), +(2947, 8317, 3), +(2947, 11770, 4), +(2947, 11771, 5), +(2947, 27269, 6), +(2947, 47983, 7), + -- Fire Shot +(3011, 3011, 1), +(3011, 6979, 2), +(3011, 6980, 3), + -- Fire Ward +(1035, 1035, 1), +(1035, 8459, 2), +(1035, 8460, 3), +(1035, 10224, 4), +(1035, 10226, 5), +(1035, 27395, 6), + -- Fire Ward +(543, 543, 1), +(543, 8457, 2), +(543, 8458, 3), +(543, 10223, 4), +(543, 10225, 5), +(543, 27128, 6), +(543, 43010, 7), + -- Fireball +(133, 133, 1), +(133, 143, 2), +(133, 145, 3), +(133, 3140, 4), +(133, 8400, 5), +(133, 8401, 6), +(133, 8402, 7), +(133, 10148, 8), +(133, 10149, 9), +(133, 10150, 10), +(133, 10151, 11), +(133, 25306, 12), +(133, 27070, 13), +(133, 38692, 14), +(133, 42832, 15), +(133, 42833, 16), + -- Firebolt +(3110, 3110, 1), +(3110, 7799, 2), +(3110, 7800, 3), +(3110, 7801, 4), +(3110, 7802, 5), +(3110, 11762, 6), +(3110, 11763, 7), +(3110, 27267, 8), +(3110, 47964, 9), + -- Firestarter +(44442, 44442, 1), +(44442, 44443, 2), + -- First Aid +(3273, 3273, 1), +(3273, 3274, 2), +(3273, 7924, 3), +(3273, 10846, 4), +(3273, 27028, 5), +(3273, 45542, 6), + -- Flame Shock +(8050, 8050, 1), +(8050, 8052, 2), +(8050, 8053, 3), +(8050, 10447, 4), +(8050, 10448, 5), +(8050, 29228, 6), +(8050, 25457, 7), +(8050, 49232, 8), +(8050, 49233, 9), + -- Flame Throwing +(11100, 11100, 1), +(11100, 12353, 2), + -- Flamestrike +(2120, 2120, 1), +(2120, 2121, 2), +(2120, 8422, 3), +(2120, 8423, 4), +(2120, 10215, 5), +(2120, 10216, 6), +(2120, 27086, 7), +(2120, 42925, 8), +(2120, 42926, 9), + -- Flametongue Totem +(52109, 52109, 1), +(52109, 52110, 2), +(52109, 52111, 3), +(52109, 52112, 4), +(52109, 52113, 5), +(52109, 58651, 6), +(52109, 58654, 7), +(52109, 58655, 8), + -- Flametongue Totem +(8227, 8227, 1), +(8227, 8249, 2), +(8227, 10526, 3), +(8227, 16387, 4), +(8227, 25557, 5), +(8227, 58649, 6), +(8227, 58652, 7), +(8227, 58656, 8), + -- Flametongue Weapon +(8024, 8024, 1), +(8024, 8027, 2), +(8024, 8030, 3), +(8024, 16339, 4), +(8024, 16341, 5), +(8024, 16342, 6), +(8024, 25489, 7), +(8024, 58785, 8), +(8024, 58789, 9), +(8024, 58790, 10), + -- Flametongue Weapon (Passive) +(10400, 10400, 1), +(10400, 15567, 2), +(10400, 15568, 3), +(10400, 15569, 4), +(10400, 16311, 5), +(10400, 16312, 6), +(10400, 16313, 7), +(10400, 58784, 8), +(10400, 58791, 9), +(10400, 58792, 10), + -- Flametongue Weapon Proc +(8026, 8026, 1), +(8026, 8028, 2), +(8026, 8029, 3), +(8026, 10445, 4), +(8026, 16343, 5), +(8026, 16344, 6), +(8026, 25488, 7), +(8026, 58786, 8), +(8026, 58787, 9), +(8026, 58788, 10), + -- Flash Heal +(2061, 2061, 1), +(2061, 9472, 2), +(2061, 9473, 3), +(2061, 9474, 4), +(2061, 10915, 5), +(2061, 10916, 6), +(2061, 10917, 7), +(2061, 25233, 8), +(2061, 25235, 9), +(2061, 48070, 10), +(2061, 48071, 11), + -- Flash of Light +(19750, 19750, 1), +(19750, 19939, 2), +(19750, 19940, 3), +(19750, 19941, 4), +(19750, 19942, 5), +(19750, 19943, 6), +(19750, 27137, 7), +(19750, 48784, 8), +(19750, 48785, 9), + -- Fleet Footed +(31208, 31208, 1), +(31208, 31209, 2), + -- Flurry +(16257, 16257, 1), +(16257, 16277, 2), +(16257, 16278, 3), +(16257, 16279, 4), +(16257, 16280, 5), + -- Flurry +(16256, 16256, 1), +(16256, 16281, 2), +(16256, 16282, 3), +(16256, 16283, 4), +(16256, 16284, 5), + -- Focused Aim +(53620, 53620, 1), +(53620, 53621, 2), +(53620, 53622, 3), + -- Focused Attacks +(51634, 51634, 1), +(51634, 51635, 2), +(51634, 51636, 3), + -- Focused Casting +(14743, 14743, 1), +(14743, 27828, 2), + -- Focused Fire +(35060, 35060, 1), +(35060, 35061, 2), + -- Focused Fire +(35029, 35029, 1), +(35029, 35030, 2), + -- Focused Mind +(33213, 33213, 1), +(33213, 33214, 2), +(33213, 33215, 3), + -- Focused Mind +(30864, 30864, 1), +(30864, 30865, 2), +(30864, 30866, 3), + -- Focused Power +(33186, 33186, 1), +(33186, 33190, 2), + -- Focused Rage +(29787, 29787, 1), +(29787, 29790, 2), +(29787, 29792, 3), + -- Freezing Trap +(1499, 1499, 1), +(1499, 14310, 2), +(1499, 14311, 3), + -- Freezing Trap Effect +(3355, 3355, 1), +(3355, 14308, 2), +(3355, 14309, 3), + -- Frenzy +(19621, 19621, 1), +(19621, 19622, 2), +(19621, 19623, 3), +(19621, 19624, 4), +(19621, 19625, 5), + -- Frigid Dreadplate +(49186, 49186, 1), +(49186, 51108, 2), +(49186, 51109, 3), + -- Frost Armor +(168, 168, 1), +(168, 7300, 2), +(168, 7301, 3), + -- Frost Channeling +(11160, 11160, 1), +(11160, 12518, 2), +(11160, 12519, 3), + -- Frost Nova +(122, 122, 1), +(122, 865, 2), +(122, 6131, 3), +(122, 10230, 4), +(122, 27088, 5), +(122, 42917, 6), + -- Frost Resistance Aura +(19888, 19888, 1), +(19888, 19897, 2), +(19888, 19898, 3), +(19888, 27152, 4), +(19888, 48945, 5), + -- Frost Resistance Totem +(8181, 8181, 1), +(8181, 10478, 2), +(8181, 10479, 3), +(8181, 25560, 4), +(8181, 58741, 5), +(8181, 58745, 6), + -- Frost Shock +(8056, 8056, 1), +(8056, 8058, 2), +(8056, 10472, 3), +(8056, 10473, 4), +(8056, 25464, 5), +(8056, 49235, 6), +(8056, 49236, 7), + -- Frost Ward +(6144, 6144, 1), +(6144, 8463, 2), +(6144, 8464, 3), +(6144, 10178, 4), +(6144, 27396, 5), +(6144, 32797, 6), + -- Frost Ward +(6143, 6143, 1), +(6143, 8461, 2), +(6143, 8462, 3), +(6143, 10177, 4), +(6143, 28609, 5), +(6143, 32796, 6), +(6143, 43012, 7), + -- Frost Warding +(11189, 11189, 1), +(11189, 28332, 2), + -- Frostbite +(11071, 11071, 1), +(11071, 12496, 2), +(11071, 12497, 3), + -- Frostbolt +(116, 116, 1), +(116, 205, 2), +(116, 837, 3), +(116, 7322, 4), +(116, 8406, 5), +(116, 8407, 6), +(116, 8408, 7), +(116, 10179, 8), +(116, 10180, 9), +(116, 10181, 10), +(116, 25304, 11), +(116, 27071, 12), +(116, 27072, 13), +(116, 38697, 14), +(116, 42841, 15), +(116, 42842, 16), + -- Frostbrand Weapon +(8033, 8033, 1), +(8033, 8038, 2), +(8033, 10456, 3), +(8033, 16355, 4), +(8033, 16356, 5), +(8033, 25500, 6), +(8033, 58794, 7), +(8033, 58795, 8), +(8033, 58796, 9), + -- Frostfire Bolt +(44614, 44614, 1), +(44614, 47610, 2), + -- Froststorm Breath +(54644, 54644, 1), +(54644, 55488, 2), +(54644, 55489, 3), +(54644, 55490, 4), +(54644, 55491, 5), +(54644, 55492, 6), + -- Frozen Core +(31667, 31667, 1), +(31667, 31668, 2), +(31667, 31669, 3), + -- Frozen Power +(63373, 63373, 1), +(63373, 63374, 2), + -- Furious Attacks +(46910, 46910, 1), +(46910, 46911, 2), + -- Furious Howl +(24604, 24604, 1), +(24604, 64491, 2), +(24604, 64492, 3), +(24604, 64493, 4), +(24604, 64494, 5), +(24604, 64495, 6), + -- Furor +(17056, 17056, 1), +(17056, 17058, 2), +(17056, 17059, 3), +(17056, 17060, 4), +(17056, 17061, 5), + -- Gag Order +(12311, 12311, 1), +(12311, 12958, 2), + -- Gale Winds +(48488, 48488, 1), +(48488, 48514, 2), + -- Garrote +(703, 703, 1), +(703, 8631, 2), +(703, 8632, 3), +(703, 8633, 4), +(703, 11289, 5), +(703, 11290, 6), +(703, 26839, 7), +(703, 26884, 8), +(703, 48675, 9), +(703, 48676, 10), + -- Genesis +(57810, 57810, 1), +(57810, 57811, 2), +(57810, 57812, 3), +(57810, 57813, 4), +(57810, 57814, 5), + -- Gift of Nature +(17104, 17104, 1), +(17104, 24943, 2), +(17104, 24944, 3), +(17104, 24945, 4), +(17104, 24946, 5), + -- Gift of the Earthmother +(51179, 51179, 1), +(51179, 51180, 2), +(51179, 51181, 3), +(51179, 51182, 4), +(51179, 51183, 5), + -- Gift of the Wild +(21849, 21849, 1), +(21849, 21850, 2), +(21849, 26991, 3), +(21849, 48470, 4), + -- Glacier Rot +(49471, 49471, 1), +(49471, 49790, 2), +(49471, 49791, 3), + -- Go for the Throat +(34952, 34952, 1), +(34952, 34953, 2), + -- Go for the Throat +(34950, 34950, 1), +(34950, 34954, 2), + -- Gore +(35299, 35299, 1), +(35299, 35300, 2), +(35299, 35302, 3), +(35299, 35303, 4), +(35299, 35304, 5), +(35299, 35305, 6), +(35299, 35306, 7), +(35299, 35307, 8), +(35299, 35308, 9), + -- Gore +(35290, 35290, 1), +(35290, 35291, 2), +(35290, 35292, 3), +(35290, 35293, 4), +(35290, 35294, 5), +(35290, 35295, 6), + -- Grace +(47516, 47516, 1), +(47516, 47517, 2), + -- Grace of the Mantis +(53450, 53450, 1), +(53450, 53451, 2), + -- Great Resistance +(53427, 53427, 1), +(53427, 53429, 2), +(53427, 53430, 3), + -- Great Stamina +(4195, 4195, 1), +(4195, 4196, 2), +(4195, 4197, 3), +(4195, 4198, 4), +(4195, 4199, 5), +(4195, 4200, 6), +(4195, 4201, 7), +(4195, 4202, 8), +(4195, 5048, 9), +(4195, 5049, 10), +(4195, 27364, 11), + -- Great Stamina +(61686, 61686, 1), +(61686, 61687, 2), +(61686, 61688, 3), + -- Greater Blessing of Might +(25782, 25782, 1), +(25782, 25916, 2), +(25782, 27141, 3), +(25782, 48933, 4), +(25782, 48934, 5), + -- Greater Blessing of Wisdom +(25894, 25894, 1), +(25894, 25918, 2), +(25894, 27143, 3), +(25894, 48937, 4), +(25894, 48938, 5), + -- Greater Heal +(2060, 2060, 1), +(2060, 10963, 2), +(2060, 10964, 3), +(2060, 10965, 4), +(2060, 25314, 5), +(2060, 25210, 6), +(2060, 25213, 7), +(2060, 48062, 8), +(2060, 48063, 9), + -- Grim Reach +(18218, 18218, 1), +(18218, 18219, 2), + -- Growl +(1853, 1853, 1), +(1853, 14922, 2), +(1853, 14923, 3), +(1853, 14924, 4), +(1853, 14925, 5), +(1853, 14926, 6), +(1853, 14927, 7), +(1853, 27344, 8), + -- Growl +(2649, 2649, 1), +(2649, 14916, 2), +(2649, 14917, 3), +(2649, 14918, 4), +(2649, 14919, 5), +(2649, 14920, 6), +(2649, 14921, 7), +(2649, 27047, 8), +(2649, 61676, 9), + -- Guard Dog +(53178, 53178, 1), +(53178, 53179, 2), + -- Guarded by the Light +(53583, 53583, 1), +(53583, 53585, 2), + -- Guardian Totems +(16258, 16258, 1), +(16258, 16293, 2), + -- Guardian's Favor +(20174, 20174, 1), +(20174, 20175, 2), + -- Guile of Gorefiend +(50187, 50187, 1), +(50187, 50190, 2), +(50187, 50191, 3), + -- Hack and Slash +(13960, 13960, 1), +(13960, 13961, 2), +(13960, 13962, 3), +(13960, 13963, 4), +(13960, 13964, 5), + -- Hammer of Justice +(853, 853, 1), +(853, 5588, 2), +(853, 5589, 3), +(853, 10308, 4), + -- Hammer of Wrath +(24275, 24275, 1), +(24275, 24274, 2), +(24275, 24239, 3), +(24275, 27180, 4), +(24275, 48805, 5), +(24275, 48806, 6), + -- Hand of Protection +(1022, 1022, 1), +(1022, 5599, 2), +(1022, 10278, 3), + -- Haunt +(48181, 48181, 1), +(48181, 59161, 2), +(48181, 59163, 3), +(48181, 59164, 4), + -- Hawk Eye +(19498, 19498, 1), +(19498, 19499, 2), +(19498, 19500, 3), + -- Heal +(2054, 2054, 1), +(2054, 2055, 2), +(2054, 6063, 3), +(2054, 6064, 4), + -- Healing Focus +(14913, 14913, 1), +(14913, 15012, 2), + -- Healing Focus +(16181, 16181, 1), +(16181, 16230, 2), +(16181, 16232, 3), + -- Healing Grace +(29187, 29187, 1), +(29187, 29189, 2), +(29187, 29191, 3), + -- Healing Light +(20237, 20237, 1), +(20237, 20238, 2), +(20237, 20239, 3), + -- Healing Prayers +(14911, 14911, 1), +(14911, 15018, 2), + -- Healing Stream Totem +(5394, 5394, 1), +(5394, 6375, 2), +(5394, 6377, 3), +(5394, 10462, 4), +(5394, 10463, 5), +(5394, 25567, 6), +(5394, 58755, 7), +(5394, 58756, 8), +(5394, 58757, 9), + -- Healing Touch +(5185, 5185, 1), +(5185, 5186, 2), +(5185, 5187, 3), +(5185, 5188, 4), +(5185, 5189, 5), +(5185, 6778, 6), +(5185, 8903, 7), +(5185, 9758, 8), +(5185, 9888, 9), +(5185, 9889, 10), +(5185, 25297, 11), +(5185, 26978, 12), +(5185, 26979, 13), +(5185, 48377, 14), +(5185, 48378, 15), + -- Healing Wave +(331, 331, 1), +(331, 332, 2), +(331, 547, 3), +(331, 913, 4), +(331, 939, 5), +(331, 959, 6), +(331, 8005, 7), +(331, 10395, 8), +(331, 10396, 9), +(331, 25357, 10), +(331, 25391, 11), +(331, 25396, 12), +(331, 49272, 13), +(331, 49273, 14), + -- Healing Way +(29206, 29206, 1), +(29206, 29205, 2), +(29206, 29202, 3), + -- Health Funnel +(755, 755, 1), +(755, 3698, 2), +(755, 3699, 3), +(755, 3700, 4), +(755, 11693, 5), +(755, 11694, 6), +(755, 11695, 7), +(755, 27259, 8), +(755, 47856, 9), + -- Heart of the Crusader +(21183, 21183, 1), +(21183, 54498, 2), +(21183, 54499, 3), + -- Heart of the Crusader +(20335, 20335, 1), +(20335, 20336, 2), +(20335, 20337, 3), + -- Heart of the Wild +(17003, 17003, 1), +(17003, 17004, 2), +(17003, 17005, 3), +(17003, 17006, 4), +(17003, 24894, 5), + -- Heart Strike +(55050, 55050, 1), +(55050, 55258, 2), +(55050, 55259, 3), +(55050, 55260, 4), +(55050, 55261, 5), +(55050, 55262, 6), + -- Heightened Senses +(30894, 30894, 1), +(30894, 30895, 2), + -- Hellfire +(1949, 1949, 1), +(1949, 11683, 2), +(1949, 11684, 3), +(1949, 27213, 4), +(1949, 47823, 5), + -- Hellfire Effect +(5857, 5857, 1), +(5857, 11681, 2), +(5857, 11682, 3), +(5857, 27214, 4), +(5857, 47822, 5), + -- Hemorrhage +(16511, 16511, 1), +(16511, 17347, 2), +(16511, 17348, 3), +(16511, 26864, 4), +(16511, 48660, 5), + -- Herb Gathering +(2366, 2366, 1), +(2366, 2368, 2), +(2366, 3570, 3), +(2366, 11993, 4), +(2366, 28695, 5), +(2366, 50300, 6), + -- Heroic Strike +(78, 78, 1), +(78, 284, 2), +(78, 285, 3), +(78, 1608, 4), +(78, 11564, 5), +(78, 11565, 6), +(78, 11566, 7), +(78, 11567, 8), +(78, 25286, 9), +(78, 29707, 10), +(78, 30324, 11), +(78, 47449, 12), +(78, 47450, 13), + -- Hibernate +(2637, 2637, 1), +(2637, 18657, 2), +(2637, 18658, 3), + -- Holy Concentration +(34753, 34753, 1), +(34753, 34859, 2), +(34753, 34860, 3), + -- Holy Fire +(14914, 14914, 1), +(14914, 15262, 2), +(14914, 15263, 3), +(14914, 15264, 4), +(14914, 15265, 5), +(14914, 15266, 6), +(14914, 15267, 7), +(14914, 15261, 8), +(14914, 25384, 9), +(14914, 48134, 10), +(14914, 48135, 11), + -- Holy Guidance +(31837, 31837, 1), +(31837, 31838, 2), +(31837, 31839, 3), +(31837, 31840, 4), +(31837, 31841, 5), + -- Holy Light +(635, 635, 1), +(635, 639, 2), +(635, 647, 3), +(635, 1026, 4), +(635, 1042, 5), +(635, 3472, 6), +(635, 10328, 7), +(635, 10329, 8), +(635, 25292, 9), +(635, 27135, 10), +(635, 27136, 11), +(635, 48781, 12), +(635, 48782, 13), + -- Holy Power +(5923, 5923, 1), +(5923, 5924, 2), +(5923, 5925, 3), +(5923, 5926, 4), +(5923, 25829, 5), + -- Holy Reach +(27789, 27789, 1), +(27789, 27790, 2), + -- Holy Shield +(20925, 20925, 1), +(20925, 20927, 2), +(20925, 20928, 3), +(20925, 27179, 4), +(20925, 48951, 5), +(20925, 48952, 6), + -- Holy Specialization +(14889, 14889, 1), +(14889, 15008, 2), +(14889, 15009, 3), +(14889, 15010, 4), +(14889, 15011, 5), + -- Holy Wrath +(2812, 2812, 1), +(2812, 10318, 2), +(2812, 27139, 3), +(2812, 48816, 4), +(2812, 48817, 5), + -- Honor Among Thieves +(51698, 51698, 1), +(51698, 51700, 2), +(51698, 51701, 3), + -- Horn of Winter +(57330, 57330, 1), +(57330, 57623, 2), + -- Hot Streak +(44445, 44445, 1), +(44445, 44446, 2), +(44445, 44448, 3), + -- Howl of Terror +(5484, 5484, 1), +(5484, 17928, 2), + -- Howling Blast +(49184, 49184, 1), +(49184, 51409, 2), +(49184, 51410, 3), +(49184, 51411, 4), + -- Hunter vs. Wild +(56339, 56339, 1), +(56339, 56340, 2), +(56339, 56341, 3), + -- Hunter's Mark +(1130, 1130, 1), +(1130, 14323, 2), +(1130, 14324, 3), +(1130, 14325, 4), +(1130, 53338, 5), + -- Hunting Party +(53290, 53290, 1), +(53290, 53291, 2), +(53290, 53292, 3), + -- Ice Armor +(1214, 1214, 1), +(1214, 1228, 2), +(1214, 10221, 3), +(1214, 10222, 4), +(1214, 27391, 5), + -- Ice Armor +(7302, 7302, 1), +(7302, 7320, 2), +(7302, 10219, 3), +(7302, 10220, 4), +(7302, 27124, 5), +(7302, 43008, 6), + -- Ice Barrier +(11426, 11426, 1), +(11426, 13031, 2), +(11426, 13032, 3), +(11426, 13033, 4), +(11426, 27134, 5), +(11426, 33405, 6), +(11426, 43038, 7), +(11426, 43039, 8), + -- Ice Floes +(31670, 31670, 1), +(31670, 31672, 2), +(31670, 55094, 3), + -- Ice Lance +(30455, 30455, 1), +(30455, 42913, 2), +(30455, 42914, 3), + -- Ice Shards +(11207, 11207, 1), +(11207, 12672, 2), +(11207, 15047, 3), + -- Icy Reach +(55061, 55061, 1), +(55061, 55062, 2), + -- Icy Talons +(50880, 50880, 1), +(50880, 50884, 2), +(50880, 50885, 3), +(50880, 50886, 4), +(50880, 50887, 5), + -- Ignite +(11119, 11119, 1), +(11119, 11120, 2), +(11119, 12846, 3), +(11119, 12847, 4), +(11119, 12848, 5), + -- Illumination +(20210, 20210, 1), +(20210, 20212, 2), +(20210, 20213, 3), +(20210, 20214, 4), +(20210, 20215, 5), + -- Immolate +(348, 348, 1), +(348, 707, 2), +(348, 1094, 3), +(348, 2941, 4), +(348, 11665, 5), +(348, 11667, 6), +(348, 11668, 7), +(348, 25309, 8), +(348, 27215, 9), +(348, 47810, 10), +(348, 47811, 11), + -- Impale +(16493, 16493, 1), +(16493, 16494, 2), + -- Improved Ambush +(14079, 14079, 1), +(14079, 14080, 2), + -- Improved Arcane Shot +(19454, 19454, 1), +(19454, 19455, 2), +(19454, 19456, 3), + -- Improved Aspect of the Hawk +(19552, 19552, 1), +(19552, 19553, 2), +(19552, 19554, 3), +(19552, 19555, 4), +(19552, 19556, 5), + -- Improved Aspect of the Monkey +(19549, 19549, 1), +(19549, 19550, 2), +(19549, 19551, 3), + -- Improved Barkskin +(63410, 63410, 1), +(63410, 63411, 2), + -- Improved Barrage +(35104, 35104, 1), +(35104, 35110, 2), +(35104, 35111, 3), + -- Improved Berserker Rage +(20500, 20500, 1), +(20500, 20501, 2), + -- Improved Berserker Stance +(29759, 29759, 1), +(29759, 29760, 2), +(29759, 29761, 3), +(29759, 29762, 4), +(29759, 29763, 5), + -- Improved Blessing of Might +(20042, 20042, 1), +(20042, 20045, 2), + -- Improved Blessing of Salvation +(20194, 20194, 1), +(20194, 20195, 2), + -- Improved Blessing of Wisdom +(20244, 20244, 1), +(20244, 20245, 2), + -- Improved Blink +(31569, 31569, 1), +(31569, 31570, 2), + -- Improved Blizzard +(11185, 11185, 1), +(11185, 12487, 2), +(11185, 12488, 3), + -- Improved Blood Presence +(50365, 50365, 1), +(50365, 50371, 2), + -- Improved Bloodrage +(12301, 12301, 1), +(12301, 12818, 2), + -- Improved Chain Heal +(30872, 30872, 1), +(30872, 30873, 2), + -- Improved Challenging Shout +(12327, 12327, 1), +(12327, 12886, 2), + -- Improved Charge +(12285, 12285, 1), +(12285, 12697, 2), + -- Improved Cleave +(12329, 12329, 1), +(12329, 12950, 2), +(12329, 20496, 3), + -- Improved Concentration Aura +(20254, 20254, 1), +(20254, 20255, 2), +(20254, 20256, 3), + -- Improved Concussive Shot +(19407, 19407, 1), +(19407, 19412, 2), + -- Improved Cone of Cold +(11190, 11190, 1), +(11190, 12489, 2), +(11190, 12490, 3), + -- Improved Corpse Explosion +(49601, 49601, 1), +(49601, 49602, 2), + -- Improved Corruption +(17810, 17810, 1), +(17810, 17811, 2), +(17810, 17812, 3), +(17810, 17813, 4), +(17810, 17814, 5), + -- Improved Counterspell +(11255, 11255, 1), +(11255, 12598, 2), + -- Improved Cower +(53180, 53180, 1), +(53180, 53181, 2), + -- Improved Curse of Agony +(18827, 18827, 1), +(18827, 18829, 2), + -- Improved Curse of Weakness +(18179, 18179, 1), +(18179, 18180, 2), + -- Improved Death Coil +(30049, 30049, 1), +(30049, 30051, 2), +(30049, 30052, 3), + -- Improved Defensive Stance +(29593, 29593, 1), +(29593, 29594, 2), + -- Improved Demonic Tactics +(54347, 54347, 1), +(54347, 54348, 2), +(54347, 54349, 3), + -- Improved Demoralizing Shout +(12324, 12324, 1), +(12324, 12876, 2), +(12324, 12877, 3), +(12324, 12878, 4), +(12324, 12879, 5), + -- Improved Devotion Aura +(20138, 20138, 1), +(20138, 20139, 2), +(20138, 20140, 3), + -- Improved Devouring Plague +(63625, 63625, 1), +(63625, 63626, 2), +(63625, 63627, 3), + -- Improved Disarm +(12313, 12313, 1), +(12313, 12804, 2), + -- Improved Disciplines +(12312, 12312, 1), +(12312, 12803, 2), + -- Improved Divine Spirit +(33174, 33174, 1), +(33174, 33182, 2), + -- Improved Drain Soul +(18213, 18213, 1), +(18213, 18372, 2), + -- Improved Earth Shield +(51560, 51560, 1), +(51560, 51561, 2), + -- Improved Eviscerate +(14162, 14162, 1), +(14162, 14163, 2), +(14162, 14164, 3), + -- Improved Execute +(20502, 20502, 1), +(20502, 20503, 2), + -- Improved Expose Armor +(14168, 14168, 1), +(14168, 14169, 2), + -- Improved Eyes of the Beast +(19557, 19557, 1), +(19557, 19558, 2), + -- Improved Faerie Fire +(33600, 33600, 1), +(33600, 33601, 2), +(33600, 33602, 3), + -- Improved Fear +(53754, 53754, 1), +(53754, 53759, 2), + -- Improved Felhunter +(54037, 54037, 1), +(54037, 54038, 2), + -- Improved Fire Blast +(11078, 11078, 1), +(11078, 11080, 2), + -- Improved Fire Nova +(16086, 16086, 1), +(16086, 16544, 2), + -- Improved Fireball +(11069, 11069, 1), +(11069, 12338, 2), +(11069, 12339, 3), +(11069, 12340, 4), +(11069, 12341, 5), + -- Improved Flash of Light +(20249, 20249, 1), +(20249, 20250, 2), +(20249, 20251, 3), + -- Improved Frost Presence +(50384, 50384, 1), +(50384, 50385, 2), + -- Improved Frostbolt +(11070, 11070, 1), +(11070, 12473, 2), +(11070, 16763, 3), +(11070, 16765, 4), +(11070, 16766, 5), + -- Improved Ghost Wolf +(16262, 16262, 1), +(16262, 16287, 2), + -- Improved Gouge +(13741, 13741, 1), +(13741, 13793, 2), +(13741, 13792, 3), + -- Improved Hammer of Justice +(20487, 20487, 1), +(20487, 20488, 2), + -- Improved Hamstring +(12289, 12289, 1), +(12289, 12668, 2), +(12289, 23695, 3), + -- Improved Healing +(14912, 14912, 1), +(14912, 15013, 2), +(14912, 15014, 3), + -- Improved Healing Wave +(16182, 16182, 1), +(16182, 16226, 2), +(16182, 16227, 3), +(16182, 16228, 4), +(16182, 16229, 5), + -- Improved Health Funnel +(18703, 18703, 1), +(18703, 18704, 2), + -- Improved Healthstone +(18692, 18692, 1), +(18692, 18693, 2), + -- Improved Heroic Strike +(12282, 12282, 1), +(12282, 12663, 2), +(12282, 12664, 3), + -- Improved Howl of Terror +(30054, 30054, 1), +(30054, 30057, 2), + -- Improved Hunter's Mark +(19421, 19421, 1), +(19421, 19422, 2), +(19421, 19423, 3), + -- Improved Icy Touch +(49175, 49175, 1), +(49175, 50031, 2), +(49175, 51456, 3), + -- Improved Immolate +(17815, 17815, 1), +(17815, 17833, 2), +(17815, 17834, 3), + -- Improved Imp +(18694, 18694, 1), +(18694, 18695, 2), +(18694, 18696, 3), + -- Improved Inner Fire +(14747, 14747, 1), +(14747, 14770, 2), +(14747, 14771, 3), + -- Improved Inner Rage +(12325, 12325, 1), +(12325, 12863, 2), +(12325, 12864, 3), +(12325, 12865, 4), +(12325, 12866, 5), + -- Improved Insect Swarm +(57849, 57849, 1), +(57849, 57850, 2), +(57849, 57851, 3), + -- Improved Intercept +(29888, 29888, 1), +(29888, 29889, 2), + -- Improved Intimidating Shout +(19870, 19870, 1), +(19870, 19871, 2), + -- Improved Judgements +(25956, 25956, 1), +(25956, 25957, 2), + -- Improved Kick +(13754, 13754, 1), +(13754, 13867, 2), + -- Improved Kidney Shot +(14174, 14174, 1), +(14174, 14175, 2), +(14174, 14176, 3), + -- Improved Lay on Hands +(20234, 20234, 1), +(20234, 20235, 2), + -- Improved Leader of the Pack +(34297, 34297, 1), +(34297, 34300, 2), + -- Improved Life Tap +(18182, 18182, 1), +(18182, 18183, 2), + -- Improved Mana Burn +(14750, 14750, 1), +(14750, 14772, 2), + -- Improved Mangle +(48532, 48532, 1), +(48532, 48489, 2), +(48532, 48491, 3), + -- Improved Mark of the Wild +(17050, 17050, 1), +(17050, 17051, 2), + -- Improved Mind Blast +(15273, 15273, 1), +(15273, 15312, 2), +(15273, 15313, 3), +(15273, 15314, 4), +(15273, 15316, 5), + -- Improved Moonfire +(16821, 16821, 1), +(16821, 16822, 2), + -- Improved Moonkin Form +(50170, 50170, 1), +(50170, 50171, 2), +(50170, 50172, 3), + -- Improved Moonkin Form +(48384, 48384, 1), +(48384, 48395, 2), +(48384, 48396, 3), + -- Improved Mortal Strike +(35446, 35446, 1), +(35446, 35448, 2), +(35446, 35449, 3), + -- Improved Overpower +(12290, 12290, 1), +(12290, 12963, 2), + -- Improved Poisons +(14113, 14113, 1), +(14113, 14114, 2), +(14113, 14115, 3), +(14113, 14116, 4), +(14113, 14117, 5), + -- Improved Power Word: Fortitude +(14749, 14749, 1), +(14749, 14767, 2), + -- Improved Power Word: Shield +(14748, 14748, 1), +(14748, 14768, 2), +(14748, 14769, 3), + -- Improved Psychic Scream +(15392, 15392, 1), +(15392, 15448, 2), + -- Improved Reincarnation +(16184, 16184, 1), +(16184, 16209, 2), + -- Improved Rejuvenation +(17111, 17111, 1), +(17111, 17112, 2), +(17111, 17113, 3), + -- Improved Rend +(12286, 12286, 1), +(12286, 12658, 2), + -- Improved Renew +(14908, 14908, 1), +(14908, 15020, 2), +(14908, 17191, 3), + -- Improved Revenge +(12797, 12797, 1), +(12797, 12799, 2), + -- Improved Revive Pet +(24443, 24443, 1), +(24443, 19575, 2), + -- Improved Righteous Fury +(20468, 20468, 1), +(20468, 20469, 2), +(20468, 20470, 3), + -- Improved Rune Tap +(48985, 48985, 1), +(48985, 49488, 2), +(48985, 49489, 3), + -- Improved Scorch +(11095, 11095, 1), +(11095, 12872, 2), +(11095, 12873, 3), + -- Improved Scorpid Sting +(19491, 19491, 1), +(19491, 19493, 2), +(19491, 19494, 3), + -- Improved Searing Pain +(17927, 17927, 1), +(17927, 17929, 2), +(17927, 17930, 3), + -- Improved Shadow Bolt +(17793, 17793, 1), +(17793, 17796, 2), +(17793, 17801, 3), +(17793, 17802, 4), +(17793, 17803, 5), + -- Improved Shadow Word: Pain +(15275, 15275, 1), +(15275, 15317, 2), + -- Improved Shadowform +(47569, 47569, 1), +(47569, 47570, 2), + -- Improved Shields +(16261, 16261, 1), +(16261, 16290, 2), +(16261, 51881, 3), + -- Improved Sinister Strike +(13732, 13732, 1), +(13732, 13863, 2), + -- Improved Slam +(12862, 12862, 1), +(12862, 12330, 2), + -- Improved Slice and Dice +(14165, 14165, 1), +(14165, 14166, 2), + -- Improved Soul Leech +(54117, 54117, 1), +(54117, 54118, 2), + -- Improved Spell Reflection +(59088, 59088, 1), +(59088, 59089, 2), + -- Improved Spirit Tap +(49694, 49694, 1), +(49694, 59000, 2), + -- Improved Spirit Tap +(15337, 15337, 1), +(15337, 15338, 2), + -- Improved Sprint +(13743, 13743, 1), +(13743, 13875, 2), + -- Improved Steady Shot +(53221, 53221, 1), +(53221, 53222, 2), +(53221, 53224, 3), + -- Improved Stings +(19464, 19464, 1), +(19464, 19465, 2), +(19464, 19466, 3), + -- Improved Stormstrike +(51521, 51521, 1), +(51521, 51522, 2), + -- Improved Succubus +(18754, 18754, 1), +(18754, 18755, 2), +(18754, 18756, 3), + -- Improved Thunder Clap +(12287, 12287, 1), +(12287, 12665, 2), +(12287, 12666, 3), + -- Improved Tracking +(52783, 52783, 1), +(52783, 52785, 2), +(52783, 52786, 3), +(52783, 52787, 4), +(52783, 52788, 5), + -- Improved Tranquility +(17123, 17123, 1), +(17123, 17124, 2), + -- Improved Tree of Life +(48535, 48535, 1), +(48535, 48536, 2), +(48535, 48537, 3), + -- Improved Unholy Presence +(50391, 50391, 1), +(50391, 50392, 2), + -- Improved Vampiric Embrace +(27839, 27839, 1), +(27839, 27840, 2), + -- Improved Water Shield +(16180, 16180, 1), +(16180, 16196, 2), +(16180, 16198, 3), + -- Improved Whirlwind +(29721, 29721, 1), +(29721, 29776, 2), + -- Improved Windfury Totem +(29192, 29192, 1), +(29192, 29193, 2), + -- Impurity +(49220, 49220, 1), +(49220, 49633, 2), +(49220, 49635, 3), +(49220, 49636, 4), +(49220, 49638, 5), + -- Incanter's Absorption +(44394, 44394, 1), +(44394, 44395, 2), +(44394, 44396, 3), + -- Incinerate +(29722, 29722, 1), +(29722, 32231, 2), +(29722, 47837, 3), +(29722, 47838, 4), + -- Incineration +(18459, 18459, 1), +(18459, 18460, 2), +(18459, 54734, 3), + -- Incite +(50685, 50685, 1), +(50685, 50686, 2), +(50685, 50687, 3), + -- Infected Wounds +(48483, 48483, 1), +(48483, 48484, 2), +(48483, 48485, 3), + -- Infectious Poisons +(51630, 51630, 1), +(51630, 51631, 2), + -- Inner Fire +(588, 588, 1), +(588, 7128, 2), +(588, 602, 3), +(588, 1006, 4), +(588, 10951, 5), +(588, 10952, 6), +(588, 25431, 7), +(588, 48040, 8), +(588, 48168, 9), + -- Inscription +(45357, 45357, 1), +(45357, 45358, 2), +(45357, 45359, 3), +(45357, 45360, 4), +(45357, 45361, 5), +(45357, 45363, 6), + -- Insect Swarm +(5570, 5570, 1), +(5570, 24974, 2), +(5570, 24975, 3), +(5570, 24976, 4), +(5570, 24977, 5), +(5570, 27013, 6), +(5570, 48468, 7), + -- Inspiration +(14893, 14893, 1), +(14893, 15357, 2), +(14893, 15359, 3), + -- Inspiration +(14892, 14892, 1), +(14892, 15362, 2), +(14892, 15363, 3), + -- Intensify Rage +(46908, 46908, 1), +(46908, 46909, 2), +(46908, 56924, 3), + -- Intensity +(17080, 17080, 1), +(17080, 35358, 2), +(17080, 35359, 3), + -- Intensity +(17106, 17106, 1), +(17106, 17107, 2), +(17106, 17108, 3), + -- Intensity +(18135, 18135, 1), +(18135, 18136, 2), + -- Invigoration +(53252, 53252, 1), +(53252, 53253, 2), + -- Iron Will +(12300, 12300, 1), +(12300, 12959, 2), +(12300, 12960, 3), + -- Jewelcrafting +(25229, 25229, 1), +(25229, 25230, 2), +(25229, 28894, 3), +(25229, 28895, 4), +(25229, 28897, 5), +(25229, 51311, 6), + -- Judgements of the Just +(53695, 53695, 1), +(53695, 53696, 2), + -- Judgements of the Wise +(31876, 31876, 1), +(31876, 31877, 2), +(31876, 31878, 3), + -- Khadgar's Unlocking +(491, 491, 1), +(491, 857, 2), +(491, 10165, 3), +(491, 10166, 4), + -- Kidney Shot +(408, 408, 1), +(408, 8643, 2), + -- Kill Shot +(53351, 53351, 1), +(53351, 61005, 2), +(53351, 61006, 3), + -- Killer Instinct +(19370, 19370, 1), +(19370, 19371, 2), +(19370, 19373, 3), + -- Killing Machine +(51123, 51123, 1), +(51123, 51127, 2), +(51123, 51128, 3), +(51123, 51129, 4), +(51123, 51130, 5), + -- Kindling Soul +(47426, 47426, 1), +(47426, 47427, 2), + -- Kindling Soul +(47261, 47261, 1), +(47261, 47262, 2), + -- Kindred Spirits +(56314, 56314, 1), +(56314, 56315, 2), +(56314, 56316, 3), +(56314, 56317, 4), +(56314, 56318, 5), + -- King of the Jungle +(48492, 48492, 1), +(48492, 48494, 2), +(48492, 48495, 3), + -- Lacerate +(33745, 33745, 1), +(33745, 48567, 2), +(33745, 48568, 3), + -- Lash of Pain +(7814, 7814, 1), +(7814, 7815, 2), +(7814, 7816, 3), +(7814, 11778, 4), +(7814, 11779, 5), +(7814, 11780, 6), +(7814, 27274, 7), +(7814, 47991, 8), +(7814, 47992, 9), + -- Lava Breath +(58604, 58604, 1), +(58604, 58607, 2), +(58604, 58608, 3), +(58604, 58609, 4), +(58604, 58610, 5), +(58604, 58611, 6), + -- Lava Burst +(51505, 51505, 1), +(51505, 60043, 2), + -- Lava Flows +(51480, 51480, 1), +(51480, 51481, 2), +(51480, 51482, 3), + -- Lay on Hands +(633, 633, 1), +(633, 2800, 2), +(633, 10310, 3), +(633, 27154, 4), +(633, 48788, 5), + -- Leatherworking +(2108, 2108, 1), +(2108, 3104, 2), +(2108, 3811, 3), +(2108, 10662, 4), +(2108, 32549, 5), +(2108, 51302, 6), + -- Lesser Heal +(2050, 2050, 1), +(2050, 2052, 2), +(2050, 2053, 3), + -- Lesser Healing Wave +(8004, 8004, 1), +(8004, 8008, 2), +(8004, 8010, 3), +(8004, 10466, 4), +(8004, 10467, 5), +(8004, 10468, 6), +(8004, 25420, 7), +(8004, 49275, 8), +(8004, 49276, 9), + -- Lethal Shots +(19426, 19426, 1), +(19426, 19427, 2), +(19426, 19429, 3), +(19426, 19430, 4), +(19426, 19431, 5), + -- Lethality +(14128, 14128, 1), +(14128, 14132, 2), +(14128, 14135, 3), +(14128, 14136, 4), +(14128, 14137, 5), + -- Life Tap +(1454, 1454, 1), +(1454, 1455, 2), +(1454, 1456, 3), +(1454, 11687, 4), +(1454, 11688, 5), +(1454, 11689, 6), +(1454, 27222, 7), +(1454, 57946, 8), + -- Lifeblood +(55428, 55428, 1), +(55428, 55480, 2), +(55428, 55500, 3), +(55428, 55501, 4), +(55428, 55502, 5), +(55428, 55503, 6), + -- Lifebloom +(33763, 33763, 1), +(33763, 48450, 2), +(33763, 48451, 3), + -- Lightning Breath +(24845, 24845, 1), +(24845, 25013, 2), +(24845, 25014, 3), +(24845, 25015, 4), +(24845, 25016, 5), +(24845, 25017, 6), + -- Lightning Breath +(24844, 24844, 1), +(24844, 25008, 2), +(24844, 25009, 3), +(24844, 25010, 4), +(24844, 25011, 5), +(24844, 25012, 6), + -- Lightning Mastery +(16578, 16578, 1), +(16578, 16579, 2), +(16578, 16580, 3), +(16578, 16581, 4), +(16578, 16582, 5), + -- Lightning Overload +(30675, 30675, 1), +(30675, 30678, 2), +(30675, 30679, 3), + -- Lightning Reflexes +(13712, 13712, 1), +(13712, 13788, 2), +(13712, 13789, 3), + -- Lightning Reflexes +(19168, 19168, 1), +(19168, 19180, 2), +(19168, 19181, 3), +(19168, 24296, 4), +(19168, 24297, 5), + -- Light's Grace +(31833, 31833, 1), +(31833, 31835, 2), +(31833, 31836, 3), + -- Lightwell +(724, 724, 1), +(724, 27870, 2), +(724, 27871, 3), +(724, 28275, 4), +(724, 48086, 5), +(724, 48087, 6), + -- Lightwell Renew +(7001, 7001, 1), +(7001, 27873, 2), +(7001, 27874, 3), +(7001, 28276, 4), +(7001, 48084, 5), +(7001, 48085, 6), + -- Lionhearted +(53409, 53409, 1), +(53409, 53411, 2), + -- Living Seed +(48496, 48496, 1), +(48496, 48499, 2), +(48496, 48500, 3), + -- Living Spirit +(34151, 34151, 1), +(34151, 34152, 2), +(34151, 34153, 3), + -- Lock and Load +(56342, 56342, 1), +(56342, 56343, 2), +(56342, 56344, 3), + -- Lockpicking +(1809, 1809, 1), +(1809, 1810, 2), +(1809, 6460, 3), + -- Longevity +(53262, 53262, 1), +(53262, 53263, 2), +(53262, 53264, 3), + -- Lunar Guidance +(33589, 33589, 1), +(33589, 33590, 2), +(33589, 33591, 3), + -- Mace Specialization +(13709, 13709, 1), +(13709, 13800, 2), +(13709, 13801, 3), +(13709, 13802, 4), +(13709, 13803, 5), + -- Maelstrom Weapon +(51528, 51528, 1), +(51528, 51529, 2), +(51528, 51530, 3), +(51528, 51531, 4), +(51528, 51532, 5), + -- Mage Armor +(6121, 6121, 1), +(6121, 22784, 2), +(6121, 22785, 3), +(6121, 27392, 4), + -- Mage Armor +(6117, 6117, 1), +(6117, 22782, 2), +(6117, 22783, 3), +(6117, 27125, 4), +(6117, 43023, 5), +(6117, 43024, 6), + -- Magic Absorption +(29441, 29441, 1), +(29441, 29444, 2), + -- Magic Attunement +(11247, 11247, 1), +(11247, 12606, 2), + -- Magic Suppression +(49224, 49224, 1), +(49224, 49610, 2), +(49224, 49611, 3), + -- Magma Totem +(8187, 8187, 1), +(8187, 10579, 2), +(8187, 10580, 3), +(8187, 10581, 4), +(8187, 25550, 5), +(8187, 58732, 6), +(8187, 58735, 7), + -- Magma Totem +(8190, 8190, 1), +(8190, 10585, 2), +(8190, 10586, 3), +(8190, 10587, 4), +(8190, 25552, 5), +(8190, 58731, 6), +(8190, 58734, 7), + -- Magma Totem Passive +(8188, 8188, 1), +(8188, 10582, 2), +(8188, 10583, 3), +(8188, 10584, 4), +(8188, 25551, 5), +(8188, 58733, 6), +(8188, 58736, 7), + -- Maim +(22570, 22570, 1), +(22570, 49802, 2), + -- Malediction +(32477, 32477, 1), +(32477, 32483, 2), +(32477, 32484, 3), + -- Malice +(14138, 14138, 1), +(14138, 14139, 2), +(14138, 14140, 3), +(14138, 14141, 4), +(14138, 14142, 5), + -- Mana Shield +(1481, 1481, 1), +(1481, 8496, 2), +(1481, 8497, 3), +(1481, 10194, 4), +(1481, 10195, 5), +(1481, 10196, 6), +(1481, 27398, 7), + -- Mana Shield +(1463, 1463, 1), +(1463, 8494, 2), +(1463, 8495, 3), +(1463, 10191, 4), +(1463, 10192, 5), +(1463, 10193, 6), +(1463, 27131, 7), +(1463, 43019, 8), +(1463, 43020, 9), + -- Mana Spring +(5677, 5677, 1), +(5677, 10491, 2), +(5677, 10493, 3), +(5677, 10494, 4), +(5677, 25569, 5), +(5677, 58775, 6), +(5677, 58776, 7), +(5677, 58777, 8), + -- Mana Spring Totem +(5675, 5675, 1), +(5675, 10495, 2), +(5675, 10496, 3), +(5675, 10497, 4), +(5675, 25570, 5), +(5675, 58771, 6), +(5675, 58773, 7), +(5675, 58774, 8), + -- Mangle (Bear) +(33878, 33878, 1), +(33878, 33986, 2), +(33878, 33987, 3), +(33878, 48563, 4), +(33878, 48564, 5), + -- Mangle (Cat) +(33876, 33876, 1), +(33876, 33982, 2), +(33876, 33983, 3), +(33876, 48565, 4), +(33876, 48566, 5), + -- Mark of the Wild +(1126, 1126, 1), +(1126, 5232, 2), +(1126, 6756, 3), +(1126, 5234, 4), +(1126, 8907, 5), +(1126, 9884, 6), +(1126, 9885, 7), +(1126, 26990, 8), +(1126, 48469, 9), + -- Marked for Death +(53241, 53241, 1), +(53241, 53243, 2), +(53241, 53244, 3), +(53241, 53245, 4), +(53241, 53246, 5), + -- Martyrdom +(14531, 14531, 1), +(14531, 14774, 2), + -- Master Conjuror +(18767, 18767, 1), +(18767, 18768, 2), + -- Master Healer +(14904, 14904, 1), +(14904, 15024, 2), +(14904, 15025, 3), +(14904, 15026, 4), +(14904, 15027, 5), + -- Master Marksman +(34485, 34485, 1), +(34485, 34486, 2), +(34485, 34487, 3), +(34485, 34488, 4), +(34485, 34489, 5), + -- Master of Anatomy +(53125, 53125, 1), +(53125, 53662, 2), +(53125, 53663, 3), +(53125, 53664, 4), +(53125, 53665, 5), +(53125, 53666, 6), + -- Master of Deception +(13958, 13958, 1), +(13958, 13970, 2), +(13958, 13971, 3), + -- Master of Elements +(29074, 29074, 1), +(29074, 29075, 2), +(29074, 29076, 3), + -- Master of Subtlety +(31221, 31221, 1), +(31221, 31222, 2), +(31221, 31223, 3), + -- Master Poisoner +(31226, 31226, 1), +(31226, 31227, 2), +(31226, 58410, 3), + -- Master Summoner +(18709, 18709, 1), +(18709, 18710, 2), + -- Maul +(6807, 6807, 1), +(6807, 6808, 2), +(6807, 6809, 3), +(6807, 8972, 4), +(6807, 9745, 5), +(6807, 9880, 6), +(6807, 9881, 7), +(6807, 26996, 8), +(6807, 48479, 9), +(6807, 48480, 10), + -- Meditation +(14521, 14521, 1), +(14521, 14776, 2), +(14521, 14777, 3), + -- Melee Specialization +(19381, 19381, 1), +(19381, 19382, 2), +(19381, 19383, 3), +(19381, 19384, 4), +(19381, 19385, 5), + -- Melted Mind +(58378, 58378, 1), +(58378, 58379, 2), + -- Mend Pet +(136, 136, 1), +(136, 3111, 2), +(136, 3661, 3), +(136, 3662, 4), +(136, 13542, 5), +(136, 13543, 6), +(136, 13544, 7), +(136, 27046, 8), +(136, 48989, 9), +(136, 48990, 10), + -- Mental Agility +(14520, 14520, 1), +(14520, 14780, 2), +(14520, 14781, 3), + -- Mental Dexterity +(51883, 51883, 1), +(51883, 51884, 2), +(51883, 51885, 3), + -- Mental Quickness +(30812, 30812, 1), +(30812, 30813, 2), +(30812, 30814, 3), + -- Mental Strength +(18551, 18551, 1), +(18551, 18552, 2), +(18551, 18553, 3), +(18551, 18554, 4), +(18551, 18555, 5), + -- Merciless Combat +(49024, 49024, 1), +(49024, 49538, 2), + -- Might of Mograine +(49023, 49023, 1), +(49023, 49533, 2), +(49023, 49534, 3), + -- Mind Blast +(8092, 8092, 1), +(8092, 8102, 2), +(8092, 8103, 3), +(8092, 8104, 4), +(8092, 8105, 5), +(8092, 8106, 6), +(8092, 10945, 7), +(8092, 10946, 8), +(8092, 10947, 9), +(8092, 25372, 10), +(8092, 25375, 11), +(8092, 48126, 12), +(8092, 48127, 13), + -- Mind Flay +(15407, 15407, 1), +(15407, 17311, 2), +(15407, 17312, 3), +(15407, 17313, 4), +(15407, 17314, 5), +(15407, 18807, 6), +(15407, 25387, 7), +(15407, 48155, 8), +(15407, 48156, 9), + -- Mind Mastery +(31584, 31584, 1), +(31584, 31585, 2), +(31584, 31586, 3), +(31584, 31587, 4), +(31584, 31588, 5), + -- Mind Melt +(14910, 14910, 1), +(14910, 33371, 2), + -- Mind Vision +(2096, 2096, 1), +(2096, 10909, 2), + -- Mining +(2575, 2575, 1), +(2575, 2576, 2), +(2575, 3564, 3), +(2575, 10248, 4), +(2575, 29354, 5), +(2575, 50310, 6), + -- Missile Barrage +(44404, 44404, 1), +(44404, 54486, 2), +(44404, 54488, 3), +(44404, 54489, 4), +(44404, 54490, 5), + -- Molten Core +(47245, 47245, 1), +(47245, 47246, 2), +(47245, 47247, 3), + -- Molten Fury +(31679, 31679, 1), +(31679, 31680, 2), + -- Molten Shields +(11094, 11094, 1), +(11094, 13043, 2), + -- Mongoose Bite +(1495, 1495, 1), +(1495, 14269, 2), +(1495, 14270, 3), +(1495, 14271, 4), +(1495, 36916, 5), +(1495, 53339, 6), + -- Monstrous Bite +(54680, 54680, 1), +(54680, 55495, 2), +(54680, 55496, 3), +(54680, 55497, 4), +(54680, 55498, 5), +(54680, 55499, 6), + -- Moonfire +(8921, 8921, 1), +(8921, 8924, 2), +(8921, 8925, 3), +(8921, 8926, 4), +(8921, 8927, 5), +(8921, 8928, 6), +(8921, 8929, 7), +(8921, 9833, 8), +(8921, 9834, 9), +(8921, 9835, 10), +(8921, 26987, 11), +(8921, 26988, 12), +(8921, 48462, 13), +(8921, 48463, 14), + -- Moonfury +(16896, 16896, 1), +(16896, 16897, 2), +(16896, 16899, 3), + -- Moonglow +(16845, 16845, 1), +(16845, 16846, 2), +(16845, 16847, 3), + -- Morbidity +(48963, 48963, 1), +(48963, 49564, 2), +(48963, 49565, 3), + -- Mortal Shots +(19485, 19485, 1), +(19485, 19487, 2), +(19485, 19488, 3), +(19485, 19489, 4), +(19485, 19490, 5), + -- Mortal Strike +(12294, 12294, 1), +(12294, 21551, 2), +(12294, 21552, 3), +(12294, 21553, 4), +(12294, 25248, 5), +(12294, 30330, 6), +(12294, 47485, 7), +(12294, 47486, 8), + -- Multi-Shot +(2643, 2643, 1), +(2643, 14288, 2), +(2643, 14289, 3), +(2643, 14290, 4), +(2643, 25294, 5), +(2643, 27021, 6), +(2643, 49047, 7), +(2643, 49048, 8), + -- Murder +(14158, 14158, 1), +(14158, 14159, 2), + -- Mutilate +(1329, 1329, 1), +(1329, 34411, 2), +(1329, 34412, 3), +(1329, 34413, 4), +(1329, 48663, 5), +(1329, 48666, 6), + -- Natural Armor +(24547, 24547, 1), +(24547, 24556, 2), +(24547, 24557, 3), +(24547, 24558, 4), +(24547, 24559, 5), +(24547, 24560, 6), +(24547, 24561, 7), +(24547, 24562, 8), +(24547, 24631, 9), +(24547, 24632, 10), +(24547, 27362, 11), + -- Natural Armor +(61689, 61689, 1), +(61689, 61690, 2), + -- Natural Perfection +(45281, 45281, 1), +(45281, 45282, 2), +(45281, 45283, 3), + -- Natural Perfection +(33881, 33881, 1), +(33881, 33882, 2), +(33881, 33883, 3), + -- Natural Reaction +(57878, 57878, 1), +(57878, 57880, 2), +(57878, 57881, 3), + -- Natural Shapeshifter +(16833, 16833, 1), +(16833, 16834, 2), +(16833, 16835, 3), + -- Naturalist +(17069, 17069, 1), +(17069, 17070, 2), +(17069, 17071, 3), +(17069, 17072, 4), +(17069, 17073, 5), + -- Nature Resistance Totem +(10595, 10595, 1), +(10595, 10600, 2), +(10595, 10601, 3), +(10595, 25574, 4), +(10595, 58746, 5), +(10595, 58749, 6), + -- Nature's Blessing +(30867, 30867, 1), +(30867, 30868, 2), +(30867, 30869, 3), + -- Nature's Bounty +(17074, 17074, 1), +(17074, 17075, 2), +(17074, 17076, 3), +(17074, 17077, 4), +(17074, 17078, 5), + -- Nature's Focus +(17063, 17063, 1), +(17063, 17065, 2), +(17063, 17066, 3), + -- Nature's Grasp +(16689, 16689, 1), +(16689, 16810, 2), +(16689, 16811, 3), +(16689, 16812, 4), +(16689, 16813, 5), +(16689, 17329, 6), +(16689, 27009, 7), +(16689, 53312, 8), + -- Nature's Guardian +(30881, 30881, 1), +(30881, 30883, 2), +(30881, 30884, 3), +(30881, 30885, 4), +(30881, 30886, 5), + -- Nature's Reach +(16819, 16819, 1), +(16819, 16820, 2), + -- Necrosis +(51459, 51459, 1), +(51459, 51462, 2), +(51459, 51463, 3), +(51459, 51464, 4), +(51459, 51465, 5), + -- Nemesis +(63117, 63117, 1), +(63117, 63121, 2), +(63117, 63123, 3), + -- Nerves of Cold Steel +(49226, 49226, 1), +(49226, 50137, 2), +(49226, 50138, 3), + -- Nerves of Steel +(31130, 31130, 1), +(31130, 31131, 2), + -- Nether Protection +(30299, 30299, 1), +(30299, 30301, 2), +(30299, 30302, 3), + -- Nether Shock +(50479, 50479, 1), +(50479, 53584, 2), +(50479, 53586, 3), +(50479, 53587, 4), +(50479, 53588, 5), +(50479, 53589, 6), + -- Netherwind Presence +(44400, 44400, 1), +(44400, 44402, 2), +(44400, 44403, 3), + -- Night of the Dead +(55620, 55620, 1), +(55620, 55623, 2), + -- Nightfall +(18094, 18094, 1), +(18094, 18095, 2), + -- Noxious Stings +(53295, 53295, 1), +(53295, 53296, 2), +(53295, 53297, 3), + -- Nurturing Instinct +(47179, 47179, 1), +(47179, 47180, 2), + -- Nurturing Instinct +(33872, 33872, 1), +(33872, 33873, 2), + -- One-Handed Weapon Specialization +(16538, 16538, 1), +(16538, 16539, 2), +(16538, 16540, 3), +(16538, 16541, 4), +(16538, 16542, 5), + -- One-Handed Weapon Specialization +(20196, 20196, 1), +(20196, 20197, 2), +(20196, 20198, 3), + -- Opportunity +(14057, 14057, 1), +(14057, 14072, 2), + -- Outbreak +(49013, 49013, 1), +(49013, 55236, 2), +(49013, 55237, 3), + -- Owlkin Frenzy +(48389, 48389, 1), +(48389, 48392, 2), +(48389, 48393, 3), + -- Owl's Focus +(53514, 53514, 1), +(53514, 53516, 2), + -- Pain and Suffering +(47580, 47580, 1), +(47580, 47581, 2), +(47580, 47582, 3), + -- Pathfinding +(19559, 19559, 1), +(19559, 19560, 2), + -- Permafrost +(11175, 11175, 1), +(11175, 12569, 2), +(11175, 12571, 3), + -- Pet Aggression +(6311, 6311, 1), +(6311, 6314, 2), +(6311, 6315, 3), +(6311, 6316, 4), +(6311, 6317, 5), + -- Pet Barding +(53175, 53175, 1), +(53175, 53176, 2), + -- Pet Hardiness +(6280, 6280, 1), +(6280, 6281, 2), +(6280, 6282, 3), +(6280, 6283, 4), +(6280, 6286, 5), + -- Pet Recovery +(6328, 6328, 1), +(6328, 6331, 2), +(6328, 6332, 3), +(6328, 6333, 4), +(6328, 6334, 5), + -- Pet Resistance +(6443, 6443, 1), +(6443, 6444, 2), +(6443, 6445, 3), +(6443, 6446, 4), +(6443, 6447, 5), + -- Piercing Ice +(11151, 11151, 1), +(11151, 12952, 2), +(11151, 12953, 3), + -- Piercing Shots +(53234, 53234, 1), +(53234, 53237, 2), +(53234, 53238, 3), + -- Pin +(50245, 50245, 1), +(50245, 53544, 2), +(50245, 53545, 3), +(50245, 53546, 4), +(50245, 53547, 5), +(50245, 53548, 6), + -- Playing with Fire +(31638, 31638, 1), +(31638, 31639, 2), +(31638, 31640, 3), + -- Point of No Escape +(53298, 53298, 1), +(53298, 53299, 2), + -- Poison Spit +(35388, 35388, 1), +(35388, 35390, 2), +(35388, 35391, 3), + -- Poison Spit +(35387, 35387, 1), +(35387, 35389, 2), +(35387, 35392, 3), +(35387, 55555, 4), +(35387, 55556, 5), +(35387, 55557, 6), + -- Poleaxe Specialization +(12700, 12700, 1), +(12700, 12781, 2), +(12700, 12783, 3), +(12700, 12784, 4), +(12700, 12785, 5), + -- Polymorph +(118, 118, 1), +(118, 12824, 2), +(118, 12825, 3), +(118, 12826, 4), + -- Pounce +(9005, 9005, 1), +(9005, 9823, 2), +(9005, 9827, 3), +(9005, 27006, 4), +(9005, 49803, 5), + -- Pounce Bleed +(9007, 9007, 1), +(9007, 9824, 2), +(9007, 9826, 3), +(9007, 27007, 4), +(9007, 49804, 5), + -- Power Word: Fortitude +(1243, 1243, 1), +(1243, 1244, 2), +(1243, 1245, 3), +(1243, 2791, 4), +(1243, 10937, 5), +(1243, 10938, 6), +(1243, 25389, 7), +(1243, 48161, 8), + -- Power Word: Shield +(17, 17, 1), +(17, 592, 2), +(17, 600, 3), +(17, 3747, 4), +(17, 6065, 5), +(17, 6066, 6), +(17, 10898, 7), +(17, 10899, 8), +(17, 10900, 9), +(17, 10901, 10), +(17, 25217, 11), +(17, 25218, 12), +(17, 48065, 13), +(17, 48066, 14), + -- Prayer of Fortitude +(21562, 21562, 1), +(21562, 21564, 2), +(21562, 25392, 3), +(21562, 48162, 4), + -- Prayer of Healing +(596, 596, 1), +(596, 996, 2), +(596, 10960, 3), +(596, 10961, 4), +(596, 25316, 5), +(596, 25308, 6), +(596, 48072, 7), + -- Prayer of Mending +(41635, 41635, 1), +(41635, 48110, 2), +(41635, 48111, 3), + -- Prayer of Mending +(33076, 33076, 1), +(33076, 48112, 2), +(33076, 48113, 3), + -- Prayer of Shadow Protection +(27683, 27683, 1), +(27683, 39374, 2), +(27683, 48170, 3), + -- Prayer of Spirit +(27681, 27681, 1), +(27681, 32999, 2), +(27681, 48074, 3), + -- Precision +(29438, 29438, 1), +(29438, 29439, 2), +(29438, 29440, 3), + -- Precision +(13705, 13705, 1), +(13705, 13832, 2), +(13705, 13843, 3), +(13705, 13844, 4), +(13705, 13845, 5), + -- Precision +(29590, 29590, 1), +(29590, 29591, 2), +(29590, 29592, 3), + -- Predatory Instincts +(33859, 33859, 1), +(33859, 33866, 2), +(33859, 33867, 3), + -- Predatory Strikes +(16972, 16972, 1), +(16972, 16974, 2), +(16972, 16975, 3), + -- Prey on the Weak +(51685, 51685, 1), +(51685, 51686, 2), +(51685, 51687, 3), +(51685, 51688, 4), +(51685, 51689, 5), + -- Primal Precision +(48409, 48409, 1), +(48409, 48410, 2), + -- Primal Tenacity +(33851, 33851, 1), +(33851, 33852, 2), +(33851, 33957, 3), + -- Prismatic Cloak +(31574, 31574, 1), +(31574, 31575, 2), +(31574, 54354, 3), + -- Protector of the Pack +(57873, 57873, 1), +(57873, 57876, 2), +(57873, 57877, 3), + -- Prowl +(24450, 24450, 1), +(24450, 24452, 2), +(24450, 24453, 3), + -- Psychic Scream +(8122, 8122, 1), +(8122, 8124, 2), +(8122, 10888, 3), +(8122, 10890, 4), + -- Pummel +(13491, 13491, 1), +(13491, 6554, 2), +(13491, 6555, 3), + -- Puncture +(12308, 12308, 1), +(12308, 12810, 2), +(12308, 12811, 3), + -- Puncturing Wounds +(13733, 13733, 1), +(13733, 13865, 2), +(13733, 13866, 3), + -- Pure of Heart +(31822, 31822, 1), +(31822, 31823, 2), + -- Purge +(370, 370, 1), +(370, 8012, 2), + -- Purification +(16178, 16178, 1), +(16178, 16210, 2), +(16178, 16211, 3), +(16178, 16212, 4), +(16178, 16213, 5), + -- Purifying Power +(31825, 31825, 1), +(31825, 31826, 2), + -- Pursuit of Justice +(61417, 61417, 1), +(61417, 61418, 2), + -- Pursuit of Justice +(26022, 26022, 1), +(26022, 26023, 2), + -- Pyroblast +(11366, 11366, 1), +(11366, 12505, 2), +(11366, 12522, 3), +(11366, 12523, 4), +(11366, 12524, 5), +(11366, 12525, 6), +(11366, 12526, 7), +(11366, 18809, 8), +(11366, 27132, 9), +(11366, 33938, 10), +(11366, 42890, 11), +(11366, 42891, 12), + -- Pyroclasm +(18096, 18096, 1), +(18096, 18073, 2), +(18096, 63245, 3), + -- Pyromaniac +(34293, 34293, 1), +(34293, 34295, 2), +(34293, 34296, 3), + -- Quick Recovery +(31244, 31244, 1), +(31244, 31245, 2), + -- Rage of Rivendare +(50117, 50117, 1), +(50117, 50118, 2), +(50117, 50119, 3), +(50117, 50120, 4), +(50117, 50121, 5), + -- Rake +(1822, 1822, 1), +(1822, 1823, 2), +(1822, 1824, 3), +(1822, 9904, 4), +(1822, 27003, 5), +(1822, 48573, 6), +(1822, 48574, 7), + -- Rake +(59881, 59881, 1), +(59881, 59882, 2), +(59881, 59883, 3), +(59881, 59884, 4), +(59881, 59885, 5), +(59881, 59886, 6), + -- Ranged Weapon Specialization +(19507, 19507, 1), +(19507, 19508, 2), +(19507, 19509, 3), + -- Rapid Recuperation +(53228, 53228, 1), +(53228, 53232, 2), + -- Raptor Strike +(2973, 2973, 1), +(2973, 14260, 2), +(2973, 14261, 3), +(2973, 14262, 4), +(2973, 14263, 5), +(2973, 14264, 6), +(2973, 14265, 7), +(2973, 14266, 8), +(2973, 27014, 9), +(2973, 48995, 10), +(2973, 48996, 11), + -- Rapture +(47535, 47535, 1), +(47535, 47536, 2), +(47535, 47537, 3), + -- Ravage +(6785, 6785, 1), +(6785, 6787, 2), +(6785, 9866, 3), +(6785, 9867, 4), +(6785, 27005, 5), +(6785, 48578, 6), +(6785, 48579, 7), + -- Ravage +(50518, 50518, 1), +(50518, 53558, 2), +(50518, 53559, 3), +(50518, 53560, 4), +(50518, 53561, 5), +(50518, 53562, 6), + -- Ravenous Dead +(48965, 48965, 1), +(48965, 49571, 2), +(48965, 49572, 3), + -- Reaping +(49208, 49208, 1), +(49208, 56834, 2), +(49208, 56835, 3), + -- Rebirth +(20484, 20484, 1), +(20484, 20739, 2), +(20484, 20742, 3), +(20484, 20747, 4), +(20484, 20748, 5), +(20484, 26994, 6), +(20484, 48477, 7), + -- Reckoning +(20177, 20177, 1), +(20177, 20179, 2), +(20177, 20181, 3), +(20177, 20180, 4), +(20177, 20182, 5), + -- Redemption +(7328, 7328, 1), +(7328, 10322, 2), +(7328, 10324, 3), +(7328, 20772, 4), +(7328, 20773, 5), +(7328, 48949, 6), +(7328, 48950, 7), + -- Redoubt +(20127, 20127, 1), +(20127, 20130, 2), +(20127, 20135, 3), + -- Reflective Shield +(33201, 33201, 1), +(33201, 33202, 2), + -- Regeneration +(30799, 30799, 1), +(30799, 30800, 2), +(30799, 30801, 3), + -- Regrowth +(8936, 8936, 1), +(8936, 8938, 2), +(8936, 8939, 3), +(8936, 8940, 4), +(8936, 8941, 5), +(8936, 9750, 6), +(8936, 9856, 7), +(8936, 9857, 8), +(8936, 9858, 9), +(8936, 26980, 10), +(8936, 48442, 11), +(8936, 48443, 12), + -- Rejuvenation +(774, 774, 1), +(774, 1058, 2), +(774, 1430, 3), +(774, 2090, 4), +(774, 2091, 5), +(774, 3627, 6), +(774, 8910, 7), +(774, 9839, 8), +(774, 9840, 9), +(774, 9841, 10), +(774, 25299, 11), +(774, 26981, 12), +(774, 26982, 13), +(774, 48440, 14), +(774, 48441, 15), + -- Relentless Strikes +(14179, 14179, 1), +(14179, 58422, 2), +(14179, 58423, 3), +(14179, 58424, 4), +(14179, 58425, 5), + -- Remorseless +(14143, 14143, 1), +(14143, 14149, 2), + -- Remorseless Attacks +(14144, 14144, 1), +(14144, 14148, 2), + -- Rend +(772, 772, 1), +(772, 6546, 2), +(772, 6547, 3), +(772, 6548, 4), +(772, 11572, 5), +(772, 11573, 6), +(772, 11574, 7), +(772, 25208, 8), +(772, 46845, 9), +(772, 47465, 10), + -- Rend and Tear +(48432, 48432, 1), +(48432, 48433, 2), +(48432, 48434, 3), +(48432, 51268, 4), +(48432, 51269, 5), + -- Renew +(139, 139, 1), +(139, 6074, 2), +(139, 6075, 3), +(139, 6076, 4), +(139, 6077, 5), +(139, 6078, 6), +(139, 10927, 7), +(139, 10928, 8), +(139, 10929, 9), +(139, 25315, 10), +(139, 25221, 11), +(139, 25222, 12), +(139, 48067, 13), +(139, 48068, 14), + -- Renewed Hope +(57470, 57470, 1), +(57470, 57472, 2), + -- Replenish Mana +(5405, 5405, 1), +(5405, 10052, 2), +(5405, 10057, 3), +(5405, 10058, 4), +(5405, 27103, 5), +(5405, 42987, 6), +(5405, 42988, 7), + -- Resourcefulness +(34491, 34491, 1), +(34491, 34492, 2), +(34491, 34493, 3), + -- Restorative Totems +(16187, 16187, 1), +(16187, 16205, 2), +(16187, 16206, 3), + -- Resurrection +(2006, 2006, 1), +(2006, 2010, 2), +(2006, 10880, 3), +(2006, 10881, 4), +(2006, 20770, 5), +(2006, 25435, 6), +(2006, 48171, 7), + -- Retribution Aura +(7294, 7294, 1), +(7294, 10298, 2), +(7294, 10299, 3), +(7294, 10300, 4), +(7294, 10301, 5), +(7294, 27150, 6), +(7294, 54043, 7), + -- Revenge +(6572, 6572, 1), +(6572, 6574, 2), +(6572, 7379, 3), +(6572, 11600, 4), +(6572, 11601, 5), +(6572, 25288, 6), +(6572, 25269, 7), +(6572, 30357, 8), +(6572, 57823, 9), + -- Reverberation +(16040, 16040, 1), +(16040, 16113, 2), +(16040, 16114, 3), +(16040, 16115, 4), +(16040, 16116, 5), + -- Revitalize +(48539, 48539, 1), +(48539, 48544, 2), +(48539, 48545, 3), + -- Revive +(50769, 50769, 1), +(50769, 50768, 2), +(50769, 50767, 3), +(50769, 50766, 4), +(50769, 50765, 5), +(50769, 50764, 6), +(50769, 50763, 7), + -- Righteous Vengeance +(53380, 53380, 1), +(53380, 53381, 2), +(53380, 53382, 3), + -- Rime +(49188, 49188, 1), +(49188, 56822, 2), +(49188, 59057, 3), + -- Rip +(1079, 1079, 1), +(1079, 9492, 2), +(1079, 9493, 3), +(1079, 9752, 4), +(1079, 9894, 5), +(1079, 9896, 6), +(1079, 27008, 7), +(1079, 49799, 8), +(1079, 49800, 9), + -- Riptide +(61295, 61295, 1), +(61295, 61299, 2), +(61295, 61300, 3), +(61295, 61301, 4), + -- Ritual of Refreshment +(43987, 43987, 1), +(43987, 58659, 2), + -- Ritual of Souls +(29893, 29893, 1), +(29893, 58887, 2), + -- Rockbiter Weapon +(8017, 8017, 1), +(8017, 8018, 2), +(8017, 8019, 3), +(8017, 10399, 4), + -- Ruin +(17959, 17959, 1), +(17959, 59738, 2), +(17959, 59739, 3), +(17959, 59740, 4), +(17959, 59741, 5), + -- Runic Power Mastery +(49455, 49455, 1), +(49455, 50147, 2), + -- Rupture +(1943, 1943, 1), +(1943, 8639, 2), +(1943, 8640, 3), +(1943, 11273, 4), +(1943, 11274, 5), +(1943, 11275, 6), +(1943, 26867, 7), +(1943, 48671, 8), +(1943, 48672, 9), + -- Ruthlessness +(14156, 14156, 1), +(14156, 14160, 2), +(14156, 14161, 3), + -- Sacred Cleansing +(53551, 53551, 1), +(53551, 53552, 2), +(53551, 53553, 3), + -- Sacred Duty +(31848, 31848, 1), +(31848, 31849, 2), + -- Sacrifice +(7812, 7812, 1), +(7812, 19438, 2), +(7812, 19440, 3), +(7812, 19441, 4), +(7812, 19442, 5), +(7812, 19443, 6), +(7812, 27273, 7), +(7812, 47985, 8), +(7812, 47986, 9), + -- Sanctified Light +(20359, 20359, 1), +(20359, 20360, 2), +(20359, 20361, 3), + -- Sanctified Wrath +(53375, 53375, 1), +(53375, 53376, 2), + -- Sanctity of Battle +(32043, 32043, 1), +(32043, 35396, 2), +(32043, 35397, 3), + -- Sap +(6770, 6770, 1), +(6770, 2070, 2), +(6770, 11297, 3), +(6770, 51724, 4), + -- Savage Combat +(58684, 58684, 1), +(58684, 58683, 2), + -- Savage Combat +(51682, 51682, 1), +(51682, 58413, 2), + -- Savage Fury +(16998, 16998, 1), +(16998, 16999, 2), + -- Savage Strikes +(19159, 19159, 1), +(19159, 19160, 2), + -- Scare Beast +(1513, 1513, 1), +(1513, 14326, 2), +(1513, 14327, 3), + -- Scent of Blood +(49004, 49004, 1), +(49004, 49508, 2), +(49004, 49509, 3), + -- Scorch +(1811, 1811, 1), +(1811, 8447, 2), +(1811, 8448, 3), +(1811, 8449, 4), +(1811, 10208, 5), +(1811, 10209, 6), +(1811, 10210, 7), +(1811, 27375, 8), +(1811, 27376, 9), + -- Scorch +(2948, 2948, 1), +(2948, 8444, 2), +(2948, 8445, 3), +(2948, 8446, 4), +(2948, 10205, 5), +(2948, 10206, 6), +(2948, 10207, 7), +(2948, 27073, 8), +(2948, 27074, 9), +(2948, 42858, 10), +(2948, 42859, 11), + -- Scorpid Poison +(24641, 24641, 1), +(24641, 24584, 2), +(24641, 24588, 3), +(24641, 24589, 4), +(24641, 27361, 5), + -- Scorpid Poison +(24640, 24640, 1), +(24640, 24583, 2), +(24640, 24586, 3), +(24640, 24587, 4), +(24640, 27060, 5), +(24640, 55728, 6), + -- Scourge Strike +(55090, 55090, 1), +(55090, 55265, 2), +(55090, 55270, 3), +(55090, 55271, 4), + -- Seal Fate +(14186, 14186, 1), +(14186, 14190, 2), +(14186, 14193, 3), +(14186, 14194, 4), +(14186, 14195, 5), + -- Seals of the Pure +(20224, 20224, 1), +(20224, 20225, 2), +(20224, 20330, 3), +(20224, 20331, 4), +(20224, 20332, 5), + -- Searing Light +(14909, 14909, 1), +(14909, 15017, 2), + -- Searing Pain +(5676, 5676, 1), +(5676, 17919, 2), +(5676, 17920, 3), +(5676, 17921, 4), +(5676, 17922, 5), +(5676, 17923, 6), +(5676, 27210, 7), +(5676, 30459, 8), +(5676, 47814, 9), +(5676, 47815, 10), + -- Searing Totem +(2075, 2075, 1), +(2075, 38116, 2), + -- Searing Totem +(3599, 3599, 1), +(3599, 6363, 2), +(3599, 6364, 3), +(3599, 6365, 4), +(3599, 10437, 5), +(3599, 10438, 6), +(3599, 25533, 7), +(3599, 58699, 8), +(3599, 58703, 9), +(3599, 58704, 10), + -- Seed of Corruption +(43991, 43991, 1), +(43991, 47831, 2), +(43991, 47832, 3), + -- Serendipity +(63730, 63730, 1), +(63730, 63733, 2), +(63730, 63737, 3), + -- Serenity Dust +(50318, 50318, 1), +(50318, 52012, 2), +(50318, 52013, 3), +(50318, 52014, 4), +(50318, 52015, 5), +(50318, 52016, 6), + -- Serious Wound +(5597, 5597, 1), +(5597, 5598, 2), + -- Serpent Sting +(1978, 1978, 1), +(1978, 13549, 2), +(1978, 13550, 3), +(1978, 13551, 4), +(1978, 13552, 5), +(1978, 13553, 6), +(1978, 13554, 7), +(1978, 13555, 8), +(1978, 25295, 9), +(1978, 27016, 10), +(1978, 49000, 11), +(1978, 49001, 12), + -- Serpent's Swiftness +(34466, 34466, 1), +(34466, 34467, 2), +(34466, 34468, 3), +(34466, 34469, 4), +(34466, 34470, 5), + -- Serrated Blades +(14171, 14171, 1), +(14171, 14172, 2), +(14171, 14173, 3), + -- Setup +(13983, 13983, 1), +(13983, 14070, 2), +(13983, 14071, 3), + -- Shackle Undead +(9484, 9484, 1), +(9484, 9485, 2), +(9484, 10955, 3), + -- Shadow Affinity +(15318, 15318, 1), +(15318, 15272, 2), +(15318, 15320, 3), + -- Shadow and Flame +(30288, 30288, 1), +(30288, 30289, 2), +(30288, 30290, 3), +(30288, 30291, 4), +(30288, 30292, 5), + -- Shadow Bite +(54049, 54049, 1), +(54049, 54050, 2), +(54049, 54051, 3), +(54049, 54052, 4), +(54049, 54053, 5), + -- Shadow Bolt +(686, 686, 1), +(686, 695, 2), +(686, 705, 3), +(686, 1088, 4), +(686, 1106, 5), +(686, 7641, 6), +(686, 11659, 7), +(686, 11660, 8), +(686, 11661, 9), +(686, 25307, 10), +(686, 27209, 11), +(686, 47808, 12), +(686, 47809, 13), + -- Shadow Embrace +(32385, 32385, 1), +(32385, 32387, 2), +(32385, 32392, 3), +(32385, 32393, 4), +(32385, 32394, 5), + -- Shadow Focus +(15260, 15260, 1), +(15260, 15327, 2), +(15260, 15328, 3), + -- Shadow Mastery +(18271, 18271, 1), +(18271, 18272, 2), +(18271, 18273, 3), +(18271, 18274, 4), +(18271, 18275, 5), + -- Shadow Power +(33221, 33221, 1), +(33221, 33222, 2), +(33221, 33223, 3), +(33221, 33224, 4), +(33221, 33225, 5), + -- Shadow Protection +(976, 976, 1), +(976, 10957, 2), +(976, 10958, 3), +(976, 25433, 4), +(976, 48169, 5), + -- Shadow Reach +(17322, 17322, 1), +(17322, 17323, 2), + -- Shadow Resistance Aura +(19876, 19876, 1), +(19876, 19895, 2), +(19876, 19896, 3), +(19876, 27151, 4), +(19876, 48943, 5), + -- Shadow Ward +(6229, 6229, 1), +(6229, 11739, 2), +(6229, 11740, 3), +(6229, 28610, 4), +(6229, 47890, 5), +(6229, 47891, 6), + -- Shadow Weaving +(15257, 15257, 1), +(15257, 15331, 2), +(15257, 15332, 3), + -- Shadow Word: Death +(32379, 32379, 1), +(32379, 32996, 2), +(32379, 48157, 3), +(32379, 48158, 4), + -- Shadow Word: Pain +(589, 589, 1), +(589, 594, 2), +(589, 970, 3), +(589, 992, 4), +(589, 2767, 5), +(589, 10892, 6), +(589, 10893, 7), +(589, 10894, 8), +(589, 25367, 9), +(589, 25368, 10), +(589, 48124, 11), +(589, 48125, 12), + -- Shadowburn +(17877, 17877, 1), +(17877, 18867, 2), +(17877, 18868, 3), +(17877, 18869, 4), +(17877, 18870, 5), +(17877, 18871, 6), +(17877, 27263, 7), +(17877, 30546, 8), +(17877, 47826, 9), +(17877, 47827, 10), + -- Shadowflame +(47897, 47897, 1), +(47897, 61290, 2), + -- Shadowfury +(30283, 30283, 1), +(30283, 30413, 2), +(30283, 30414, 3), +(30283, 47846, 4), +(30283, 47847, 5), + -- Shamanism +(62097, 62097, 1), +(62097, 62098, 2), +(62097, 62099, 3), +(62097, 62100, 4), +(62097, 62101, 5), + -- Shark Attack +(62759, 62759, 1), +(62759, 62760, 2), + -- Sharpened Claws +(16942, 16942, 1), +(16942, 16943, 2), +(16942, 16944, 3), + -- Shatter +(11170, 11170, 1), +(11170, 12982, 2), +(11170, 12983, 3), + -- Shattered Barrier +(44745, 44745, 1), +(44745, 54787, 2), + -- Sheath of Light +(53501, 53501, 1), +(53501, 53502, 2), +(53501, 53503, 3), + -- Shield Mastery +(29598, 29598, 1), +(29598, 29599, 2), + -- Shield of Righteousness +(53600, 53600, 1), +(53600, 61411, 2), + -- Shield of the Templar +(53709, 53709, 1), +(53709, 53710, 2), +(53709, 53711, 3), + -- Shield Slam +(23922, 23922, 1), +(23922, 23923, 2), +(23922, 23924, 3), +(23922, 23925, 4), +(23922, 25258, 5), +(23922, 30356, 6), +(23922, 47487, 7), +(23922, 47488, 8), + -- Shield Specialization +(12298, 12298, 1), +(12298, 12724, 2), +(12298, 12725, 3), +(12298, 12726, 4), +(12298, 12727, 5), + -- Shield Specialization +(16253, 16253, 1), +(16253, 16298, 2), + -- Shock +(2607, 2607, 1), +(2607, 2606, 2), +(2607, 2608, 3), +(2607, 2609, 4), +(2607, 2610, 5), + -- Shred +(5221, 5221, 1), +(5221, 6800, 2), +(5221, 8992, 3), +(5221, 9829, 4), +(5221, 9830, 5), +(5221, 27001, 6), +(5221, 27002, 7), +(5221, 48571, 8), +(5221, 48572, 9), + -- Shredding Attacks +(16966, 16966, 1), +(16966, 16968, 2), + -- Silenced - Improved Counterspell +(18469, 18469, 1), +(18469, 55021, 2), + -- Silent Hunter +(34472, 34472, 1), +(34472, 34473, 2), +(34472, 34474, 3), + -- Silent Resolve +(14523, 14523, 1), +(14523, 14784, 2), +(14523, 14785, 3), + -- Silverback +(62764, 62764, 1), +(62764, 62765, 2), + -- Sinister Calling +(31216, 31216, 1), +(31216, 31217, 2), +(31216, 31218, 3), +(31216, 31219, 4), +(31216, 31220, 5), + -- Sinister Strike +(1752, 1752, 1), +(1752, 1757, 2), +(1752, 1758, 3), +(1752, 1759, 4), +(1752, 1760, 5), +(1752, 8621, 6), +(1752, 11293, 7), +(1752, 11294, 8), +(1752, 26861, 9), +(1752, 26862, 10), +(1752, 48637, 11), +(1752, 48638, 12), + -- Skinning +(8613, 8613, 1), +(8613, 8617, 2), +(8613, 8618, 3), +(8613, 10768, 4), +(8613, 32678, 5), +(8613, 50305, 6), + -- Slam +(1464, 1464, 1), +(1464, 8820, 2), +(1464, 11604, 3), +(1464, 11605, 4), +(1464, 25241, 5), +(1464, 25242, 6), +(1464, 47474, 7), +(1464, 47475, 8), + -- Slaughter from the Shadows +(51708, 51708, 1), +(51708, 51709, 2), +(51708, 51710, 3), +(51708, 51711, 4), +(51708, 51712, 5), + -- Sleep +(700, 700, 1), +(700, 1090, 2), + -- Sleight of Hand +(30892, 30892, 1), +(30892, 30893, 2), + -- Slice and Dice +(5171, 5171, 1), +(5171, 6774, 2), + -- Slow +(246, 246, 1), +(246, 6146, 2), + -- Smack +(49966, 49966, 1), +(49966, 49967, 2), +(49966, 49968, 3), +(49966, 49969, 4), +(49966, 49970, 5), +(49966, 49971, 6), +(49966, 49972, 7), +(49966, 49973, 8), +(49966, 49974, 9), +(49966, 52475, 10), +(49966, 52476, 11), + -- Smite +(585, 585, 1), +(585, 591, 2), +(585, 598, 3), +(585, 984, 4), +(585, 1004, 5), +(585, 6060, 6), +(585, 10933, 7), +(585, 10934, 8), +(585, 25363, 9), +(585, 25364, 10), +(585, 48122, 11), +(585, 48123, 12), + -- Snatch +(50541, 50541, 1), +(50541, 53537, 2), +(50541, 53538, 3), +(50541, 53540, 4), +(50541, 53542, 5), +(50541, 53543, 6), + -- Sniper Training +(53302, 53302, 1), +(53302, 53303, 2), +(53302, 53304, 3), + -- Sonic Blast +(50519, 50519, 1), +(50519, 53564, 2), +(50519, 53565, 3), +(50519, 53566, 4), +(50519, 53567, 5), +(50519, 53568, 6), + -- Soothe Animal +(2908, 2908, 1), +(2908, 8955, 2), +(2908, 9901, 3), +(2908, 26995, 4), + -- Soothing Kiss +(6360, 6360, 1), +(6360, 7813, 2), +(6360, 11784, 3), +(6360, 11785, 4), +(6360, 27275, 5), + -- Soul Fire +(6353, 6353, 1), +(6353, 17924, 2), +(6353, 27211, 3), +(6353, 30545, 4), +(6353, 47824, 5), +(6353, 47825, 6), + -- Soul Leech +(30293, 30293, 1), +(30293, 30295, 2), +(30293, 30296, 3), + -- Soul Siphon +(17804, 17804, 1), +(17804, 17805, 2), + -- Spark of Nature +(48435, 48435, 1), +(48435, 48436, 2), +(48435, 48437, 3), + -- Spell Deflection +(49145, 49145, 1), +(49145, 49495, 2), +(49145, 49497, 3), + -- Spell Impact +(11242, 11242, 1), +(11242, 12467, 2), +(11242, 12469, 3), + -- Spell Lock +(19244, 19244, 1), +(19244, 19647, 2), + -- Spell Power +(35578, 35578, 1), +(35578, 35581, 2), + -- Spell Warding +(27900, 27900, 1), +(27900, 27901, 2), +(27900, 27902, 3), +(27900, 27903, 4), +(27900, 27904, 5), + -- Spider's Bite +(53203, 53203, 1), +(53203, 53204, 2), +(53203, 53205, 3), + -- Spiked Collar +(53182, 53182, 1), +(53182, 53183, 2), +(53182, 53184, 3), + -- Spirit +(8112, 8112, 1), +(8112, 8113, 2), +(8112, 8114, 3), +(8112, 12177, 4), +(8112, 33080, 5), +(8112, 43197, 6), +(8112, 48103, 7), +(8112, 48104, 8), + -- Spirit Strike +(61193, 61193, 1), +(61193, 61194, 2), +(61193, 61195, 3), +(61193, 61196, 4), +(61193, 61197, 5), +(61193, 61198, 6), + -- Spirit Tap +(15270, 15270, 1), +(15270, 15335, 2), +(15270, 15336, 3), + -- Spiritual Attunement +(31785, 31785, 1), +(31785, 33776, 2), + -- Spiritual Focus +(20205, 20205, 1), +(20205, 20206, 2), +(20205, 20207, 3), +(20205, 20209, 4), +(20205, 20208, 5), + -- Spiritual Guidance +(14901, 14901, 1), +(14901, 15028, 2), +(14901, 15029, 3), +(14901, 15030, 4), +(14901, 15031, 5), + -- Spiritual Healing +(14898, 14898, 1), +(14898, 15349, 2), +(14898, 15354, 3), +(14898, 15355, 4), +(14898, 15356, 5), + -- Spore Cloud +(50274, 50274, 1), +(50274, 53593, 2), +(50274, 53594, 3), +(50274, 53596, 4), +(50274, 53597, 5), +(50274, 53598, 6), + -- Sprint +(2983, 2983, 1), +(2983, 8696, 2), +(2983, 11305, 3), + -- Stampede +(57386, 57386, 1), +(57386, 57389, 2), +(57386, 57390, 3), +(57386, 57391, 4), +(57386, 57392, 5), +(57386, 57393, 6), + -- Starfall +(48505, 48505, 1), +(48505, 53199, 2), +(48505, 53200, 3), +(48505, 53201, 4), + -- Starfire +(2912, 2912, 1), +(2912, 8949, 2), +(2912, 8950, 3), +(2912, 8951, 4), +(2912, 9875, 5), +(2912, 9876, 6), +(2912, 25298, 7), +(2912, 26986, 8), +(2912, 48464, 9), +(2912, 48465, 10), + -- Starlight Wrath +(16814, 16814, 1), +(16814, 16815, 2), +(16814, 16816, 3), +(16814, 16817, 4), +(16814, 16818, 5), + -- Static Shock +(51525, 51525, 1), +(51525, 51526, 2), +(51525, 51527, 3), + -- Steady Shot +(56641, 56641, 1), +(56641, 34120, 2), +(56641, 49051, 3), +(56641, 49052, 4), + -- Sting +(56626, 56626, 1), +(56626, 56627, 2), +(56626, 56628, 3), +(56626, 56629, 4), +(56626, 56630, 5), +(56626, 56631, 6), + -- Stoicism +(31844, 31844, 1), +(31844, 31845, 2), +(31844, 53519, 3), + -- Stoneclaw Totem +(5730, 5730, 1), +(5730, 6390, 2), +(5730, 6391, 3), +(5730, 6392, 4), +(5730, 10427, 5), +(5730, 10428, 6), +(5730, 25525, 7), +(5730, 58580, 8), +(5730, 58581, 9), +(5730, 58582, 10), + -- Stoneclaw Totem Passive +(5728, 5728, 1), +(5728, 6397, 2), +(5728, 6398, 3), +(5728, 6399, 4), +(5728, 10425, 5), +(5728, 10426, 6), +(5728, 25513, 7), +(5728, 58583, 8), +(5728, 58584, 9), +(5728, 58585, 10), + -- Stoneskin Totem +(8073, 8073, 1), +(8073, 38115, 2), + -- Stoneskin Totem +(8071, 8071, 1), +(8071, 8154, 2), +(8071, 8155, 3), +(8071, 10406, 4), +(8071, 10407, 5), +(8071, 10408, 6), +(8071, 25508, 7), +(8071, 25509, 8), +(8071, 58751, 9), +(8071, 58753, 10), + -- Storm, Earth and Fire +(51483, 51483, 1), +(51483, 51485, 2), +(51483, 51486, 3), + -- Strength +(8118, 8118, 1), +(8118, 8119, 2), +(8118, 8120, 3), +(8118, 12179, 4), +(8118, 33082, 5), +(8118, 43199, 6), +(8118, 58448, 7), +(8118, 58449, 8), + -- Strength of Arms +(46865, 46865, 1), +(46865, 46866, 2), + -- Strength of Earth Totem +(8075, 8075, 1), +(8075, 8160, 2), +(8075, 8161, 3), +(8075, 10442, 4), +(8075, 25361, 5), +(8075, 25528, 6), +(8075, 57622, 7), +(8075, 58643, 8), + -- Student of the Mind +(44397, 44397, 1), +(44397, 44398, 2), +(44397, 44399, 3), + -- Stunning Blast +(5648, 5648, 1), +(5648, 5649, 2), + -- Stunning Blow +(5726, 5726, 1), +(5726, 5727, 2), + -- Subtlety +(17118, 17118, 1), +(17118, 17119, 2), +(17118, 17120, 3), + -- Subversion +(48997, 48997, 1), +(48997, 49490, 2), +(48997, 49491, 3), + -- Sudden Death +(29723, 29723, 1), +(29723, 29725, 2), +(29723, 29724, 3), + -- Sudden Doom +(49018, 49018, 1), +(49018, 49529, 2), +(49018, 49530, 3), + -- Suffering +(17735, 17735, 1), +(17735, 17750, 2), +(17735, 17751, 3), +(17735, 17752, 4), +(17735, 27271, 5), +(17735, 33701, 6), +(17735, 47989, 7), +(17735, 47990, 8), + -- Suppression +(18174, 18174, 1), +(18174, 18175, 2), +(18174, 18176, 3), + -- Surefooted +(19290, 19290, 1), +(19290, 19294, 2), +(19290, 24283, 3), + -- Survival Instincts +(34494, 34494, 1), +(34494, 34496, 2), + -- Survival of the Fittest +(33853, 33853, 1), +(33853, 33855, 2), +(33853, 33856, 3), + -- Survival Tactics +(19286, 19286, 1), +(19286, 19287, 2), + -- Survivalist +(19255, 19255, 1), +(19255, 19256, 2), +(19255, 19257, 3), +(19255, 19258, 4), +(19255, 19259, 5), + -- Swift Retribution +(53379, 53379, 1), +(53379, 53484, 2), +(53379, 53648, 3), + -- Swipe +(50256, 50256, 1), +(50256, 53526, 2), +(50256, 53528, 3), +(50256, 53529, 4), +(50256, 53532, 5), +(50256, 53533, 6), + -- Swipe (Bear) +(779, 779, 1), +(779, 780, 2), +(779, 769, 3), +(779, 9754, 4), +(779, 9908, 5), +(779, 26997, 6), +(779, 48561, 7), +(779, 48562, 8), + -- Sword and Board +(46951, 46951, 1), +(46951, 46952, 2), +(46951, 46953, 3), + -- Sword Specialization +(12281, 12281, 1), +(12281, 12812, 2), +(12281, 12813, 3), +(12281, 12814, 4), +(12281, 12815, 5), + -- T.N.T. +(56333, 56333, 1), +(56333, 56336, 2), +(56333, 56337, 3), + -- Tactical Mastery +(12295, 12295, 1), +(12295, 12676, 2), +(12295, 12677, 3), + -- Tailoring +(3908, 3908, 1), +(3908, 3909, 2), +(3908, 3910, 3), +(3908, 12180, 4), +(3908, 26790, 5), +(3908, 51309, 6), + -- Taste for Blood +(56636, 56636, 1), +(56636, 56637, 2), +(56636, 56638, 3), + -- Tendon Rip +(50271, 50271, 1), +(50271, 53571, 2), +(50271, 53572, 3), +(50271, 53573, 4), +(50271, 53574, 5), +(50271, 53575, 6), + -- Test of Faith +(47558, 47558, 1), +(47558, 47559, 2), +(47558, 47560, 3), + -- Thick Hide +(19609, 19609, 1), +(19609, 19610, 2), +(19609, 19612, 3), + -- Thick Hide +(16929, 16929, 1), +(16929, 16930, 2), +(16929, 16931, 3), + -- Thorns +(467, 467, 1), +(467, 782, 2), +(467, 1075, 3), +(467, 8914, 4), +(467, 9756, 5), +(467, 9910, 6), +(467, 26992, 7), +(467, 53307, 8), + -- Threat of Thassarian +(65661, 65661, 1), +(65661, 66191, 2), +(65661, 66192, 3), + -- Thrill of the Hunt +(34497, 34497, 1), +(34497, 34498, 2), +(34497, 34499, 3), + -- Throwing Specialization +(5952, 5952, 1), +(5952, 51679, 2), + -- Thunder Clap +(6343, 6343, 1), +(6343, 8198, 2), +(6343, 8204, 3), +(6343, 8205, 4), +(6343, 11580, 5), +(6343, 11581, 6), +(6343, 25264, 7), +(6343, 47501, 8), +(6343, 47502, 9), + -- Thundering Strikes +(16255, 16255, 1), +(16255, 16302, 2), +(16255, 16303, 3), +(16255, 16304, 4), +(16255, 16305, 5), + -- Thunderstorm +(51490, 51490, 1), +(51490, 59156, 2), +(51490, 59158, 3), +(51490, 59159, 4), + -- Tidal Focus +(16179, 16179, 1), +(16179, 16214, 2), +(16179, 16215, 3), +(16179, 16216, 4), +(16179, 16217, 5), + -- Tidal Mastery +(16194, 16194, 1), +(16194, 16218, 2), +(16194, 16219, 3), +(16194, 16220, 4), +(16194, 16221, 5), + -- Tidal Waves +(51562, 51562, 1), +(51562, 51563, 2), +(51562, 51564, 3), +(51562, 51565, 4), +(51562, 51566, 5), + -- Tiger's Fury +(5217, 5217, 1), +(5217, 6793, 2), +(5217, 9845, 3), +(5217, 9846, 4), +(5217, 50212, 5), +(5217, 50213, 6), + -- Torment +(3716, 3716, 1), +(3716, 7809, 2), +(3716, 7810, 3), +(3716, 7811, 4), +(3716, 11774, 5), +(3716, 11775, 6), +(3716, 27270, 7), +(3716, 47984, 8), + -- Torment the Weak +(29447, 29447, 1), +(29447, 55339, 2), +(29447, 55340, 3), + -- Torture +(47263, 47263, 1), +(47263, 47264, 2), +(47263, 47265, 3), + -- Totem of Wrath +(30706, 30706, 1), +(30706, 57720, 2), +(30706, 57721, 3), +(30706, 57722, 4), + -- Totemic Focus +(16173, 16173, 1), +(16173, 16222, 2), +(16173, 16223, 3), +(16173, 16224, 4), +(16173, 16225, 5), + -- Touched by the Light +(53590, 53590, 1), +(53590, 53591, 2), +(53590, 53592, 3), + -- Toughness +(53120, 53120, 1), +(53120, 53121, 2), +(53120, 53122, 3), +(53120, 53123, 4), +(53120, 53124, 5), +(53120, 53040, 6), + -- Toughness +(12299, 12299, 1), +(12299, 12761, 2), +(12299, 12762, 3), +(12299, 12763, 4), +(12299, 12764, 5), + -- Toughness +(20143, 20143, 1), +(20143, 20144, 2), +(20143, 20145, 3), +(20143, 20146, 4), +(20143, 20147, 5), + -- Toughness +(16252, 16252, 1), +(16252, 16306, 2), +(16252, 16307, 3), +(16252, 16308, 4), +(16252, 16309, 5), + -- Toughness +(49042, 49042, 1), +(49042, 49786, 2), +(49042, 49787, 3), +(49042, 49788, 4), +(49042, 49789, 5), + -- Tranquil Spirit +(24968, 24968, 1), +(24968, 24969, 2), +(24968, 24970, 3), +(24968, 24971, 4), +(24968, 24972, 5), + -- Trap Mastery +(19376, 19376, 1), +(19376, 63457, 2), +(19376, 63458, 3), + -- Tundra Stalker +(49202, 49202, 1), +(49202, 50127, 2), +(49202, 50128, 3), +(49202, 50129, 4), +(49202, 50130, 5), + -- Turn the Tables +(51627, 51627, 1), +(51627, 51628, 2), +(51627, 51629, 3), + -- Twin Disciplines +(47586, 47586, 1), +(47586, 47587, 2), +(47586, 47588, 3), +(47586, 52802, 4), +(47586, 52803, 5), + -- Twisted Faith +(47573, 47573, 1), +(47573, 47577, 2), +(47573, 47578, 3), +(47573, 51166, 4), +(47573, 51167, 5), + -- Two-Handed Weapon Specialization +(12163, 12163, 1), +(12163, 12711, 2), +(12163, 12712, 3), + -- Two-Handed Weapon Specialization +(20111, 20111, 1), +(20111, 20112, 2), +(20111, 20113, 3), + -- Two-Handed Weapon Specialization +(55107, 55107, 1), +(55107, 55108, 2), + -- Unbreakable Will +(14522, 14522, 1), +(14522, 14788, 2), +(14522, 14789, 3), +(14522, 14790, 4), +(14522, 14791, 5), + -- Unending Fury +(56927, 56927, 1), +(56927, 56929, 2), +(56927, 56930, 3), +(56927, 56931, 4), +(56927, 56932, 5), + -- Unholy Command +(49588, 49588, 1), +(49588, 49589, 2), + -- Unholy Power +(18769, 18769, 1), +(18769, 18770, 2), +(18769, 18771, 3), +(18769, 18772, 4), +(18769, 18773, 5), + -- Unleashed Fury +(19616, 19616, 1), +(19616, 19617, 2), +(19616, 19618, 3), +(19616, 19619, 4), +(19616, 19620, 5), + -- Unrelenting Assault +(46859, 46859, 1), +(46859, 46860, 2), + -- Unrelenting Storm +(30664, 30664, 1), +(30664, 30665, 2), +(30664, 30666, 3), + -- Unstable Affliction +(30108, 30108, 1), +(30108, 30404, 2), +(30108, 30405, 3), +(30108, 47841, 4), +(30108, 47843, 5), + -- Unyielding Faith +(9453, 9453, 1), +(9453, 25836, 2), + -- Vampiric Touch +(34914, 34914, 1), +(34914, 34916, 2), +(34914, 34917, 3), +(34914, 48159, 4), +(34914, 48160, 5), + -- Vanish +(1856, 1856, 1), +(1856, 1857, 2), +(1856, 26889, 3), + -- Veiled Shadows +(15274, 15274, 1), +(15274, 15311, 2), + -- Vendetta +(49015, 49015, 1), +(49015, 50154, 2), +(49015, 55136, 3), + -- Vengeance +(20049, 20049, 1), +(20049, 20056, 2), +(20049, 20057, 3), + -- Vengeance +(16909, 16909, 1), +(16909, 16910, 2), +(16909, 16911, 3), +(16909, 16912, 4), +(16909, 16913, 5), + -- Venom Web Spray +(54706, 54706, 1), +(54706, 55505, 2), +(54706, 55506, 3), +(54706, 55507, 4), +(54706, 55508, 5), +(54706, 55509, 6), + -- Veteran of the Third War +(49006, 49006, 1), +(49006, 49526, 2), +(49006, 50029, 3), + -- Vicious Strikes +(51745, 51745, 1), +(51745, 51746, 2), + -- Vile Poisons +(16513, 16513, 1), +(16513, 16514, 2), +(16513, 16515, 3), + -- Virulence +(48962, 48962, 1), +(48962, 49567, 2), +(48962, 49568, 3), + -- Vitality +(31122, 31122, 1), +(31122, 31123, 2), +(31122, 61329, 3), + -- Vitality +(29140, 29140, 1), +(29140, 29143, 2), +(29140, 29144, 3), + -- Wand Specialization +(14524, 14524, 1), +(14524, 14525, 2), +(14524, 14526, 3), +(14524, 14527, 4), +(14524, 14528, 5), + -- Wandering Plague +(49217, 49217, 1), +(49217, 49654, 2), +(49217, 49655, 3), + -- Water Shield +(52127, 52127, 1), +(52127, 52129, 2), +(52127, 52131, 3), +(52127, 52134, 4), +(52127, 52136, 5), +(52127, 52138, 6), +(52127, 24398, 7), +(52127, 33736, 8), +(52127, 57960, 9), + -- Waylay +(51692, 51692, 1), +(51692, 51696, 2), + -- Weapon Expertise +(30919, 30919, 1), +(30919, 30920, 2), + -- Weapon Mastery +(20504, 20504, 1), +(20504, 20505, 2), + -- Weapon Mastery +(29082, 29082, 1), +(29082, 29084, 2), +(29082, 29086, 3), + -- Wild Growth +(48438, 48438, 1), +(48438, 53248, 2), +(48438, 53249, 3), +(48438, 53251, 4), + -- Wild Hunt +(62758, 62758, 1), +(62758, 62762, 2), + -- Wild Quiver +(53215, 53215, 1), +(53215, 53216, 2), +(53215, 53217, 3), + -- Windfury Weapon +(8232, 8232, 1), +(8232, 8235, 2), +(8232, 10486, 3), +(8232, 16362, 4), +(8232, 25505, 5), +(8232, 58801, 6), +(8232, 58803, 7), +(8232, 58804, 8), + -- Winter's Chill +(11180, 11180, 1), +(11180, 28592, 2), +(11180, 28593, 3), + -- World in Flames +(11108, 11108, 1), +(11108, 12349, 2), +(11108, 12350, 3), + -- Wrath +(5176, 5176, 1), +(5176, 5177, 2), +(5176, 5178, 3), +(5176, 5179, 4), +(5176, 5180, 5), +(5176, 6780, 6), +(5176, 8905, 7), +(5176, 9912, 8), +(5176, 26984, 9), +(5176, 26985, 10), +(5176, 48459, 11), +(5176, 48461, 12), + -- Wrath of Cenarius +(33603, 33603, 1), +(33603, 33604, 2), +(33603, 33605, 3), +(33603, 33606, 4), +(33603, 33607, 5), + -- Wrecking Crew +(46867, 46867, 1), +(46867, 56611, 2), +(46867, 56612, 3), +(46867, 56613, 4), +(46867, 56614, 5), + -- Arcane Brilliance +(23030, 23030, 1), +(23030, 27394, 2), + -- Arcane Explosion +(1467, 1467, 1), +(1467, 8440, 2), +(1467, 8441, 3), +(1467, 8442, 4), +(1467, 10203, 5), +(1467, 10204, 6), +(1467, 27380, 7), +(1467, 27381, 8), + -- Arcane Intellect +(1472, 1472, 1), +(1472, 1473, 2), +(1472, 1474, 3), +(1472, 1475, 4), +(1472, 10158, 5), +(1472, 27393, 6), +(1472, 42999, 7), + -- Arcane Missiles +(5143, 5143, 1), +(5143, 5144, 2), +(5143, 5145, 3), +(5143, 8416, 4), +(5143, 8417, 5), +(5143, 10211, 6), +(5143, 10212, 7), +(5143, 25345, 8), +(5143, 27075, 9), +(5143, 38699, 10), +(5143, 38704, 11), +(5143, 42843, 12), +(5143, 42846, 13), + -- Blessed Recovery +(27811, 27811, 1), +(27811, 27815, 2), +(27811, 27816, 3), + -- Blessed Recovery +(27813, 27813, 1), +(27813, 27817, 2), +(27813, 27818, 3), + -- Blessed Resilience +(33142, 33142, 1), +(33142, 33145, 2), +(33142, 33146, 3), + -- Blizzard +(1196, 1196, 1), +(1196, 6142, 2), +(1196, 8428, 3), +(1196, 10188, 4), +(1196, 10189, 5), +(1196, 10190, 6), +(1196, 27384, 7), + -- Blizzard +(42208, 42208, 1), +(42208, 42209, 2), +(42208, 42210, 3), +(42208, 42211, 4), +(42208, 42212, 5), +(42208, 42213, 6), +(42208, 42198, 7), +(42208, 42937, 8), +(42208, 42938, 9), + -- Blizzard +(10, 10, 1), +(10, 6141, 2), +(10, 8427, 3), +(10, 10185, 4), +(10, 10186, 5), +(10, 10187, 6), +(10, 27085, 7), +(10, 42939, 8), +(10, 42940, 9), + -- Chain Lightning +(421, 421, 1), +(421, 930, 2), +(421, 2860, 3), +(421, 10605, 4), +(421, 25439, 5), +(421, 25442, 6), +(421, 49270, 7), +(421, 49271, 8), + -- Chain Lightning +(45297, 45297, 1), +(45297, 45298, 2), +(45297, 45299, 3), +(45297, 45300, 4), +(45297, 45301, 5), +(45297, 45302, 6), +(45297, 49268, 7), +(45297, 49269, 8), + -- Charge +(7370, 7370, 1), +(7370, 26184, 2), +(7370, 26185, 3), +(7370, 26186, 4), +(7370, 26202, 5), +(7370, 28343, 6), + -- Consume Shadows +(17776, 17776, 1), +(17776, 17855, 2), +(17776, 17856, 3), +(17776, 17857, 4), +(17776, 17859, 5), +(17776, 17860, 6), + -- Consume Shadows +(20387, 20387, 1), +(20387, 20388, 2), +(20387, 20389, 3), +(20387, 20390, 4), +(20387, 20391, 5), +(20387, 20392, 6), +(20387, 27491, 7), +(20387, 48003, 8), +(20387, 48004, 9), + -- Cower +(1747, 1747, 1), +(1747, 1748, 2), +(1747, 1749, 3), +(1747, 1750, 4), +(1747, 1751, 5), +(1747, 16698, 6), +(1747, 27346, 7), + -- Echoes of Lordaeron +(6966, 6966, 1), +(6966, 30880, 2), +(6966, 30683, 3), +(6966, 30682, 4), +(6966, 29520, 5), + -- Echoes of Lordaeron +(6964, 6964, 1), +(6964, 11413, 2), +(6964, 11414, 3), +(6964, 11415, 4), +(6964, 1386, 5), + -- Eye for an Eye +(9799, 9799, 1), +(9799, 25988, 2), + -- Fire Nova +(1535, 1535, 1), +(1535, 8498, 2), +(1535, 8499, 3), +(1535, 11314, 4), +(1535, 11315, 5), +(1535, 25546, 6), +(1535, 25547, 7), +(1535, 61649, 8), +(1535, 61657, 9), + -- Fire Nova +(8349, 8349, 1), +(8349, 8502, 2), +(8349, 8503, 3), +(8349, 11306, 4), +(8349, 11307, 5), +(8349, 25535, 6), +(8349, 25537, 7), +(8349, 61650, 8), +(8349, 61654, 9), + -- Fire Protection +(7230, 7230, 1), +(7230, 7231, 2), +(7230, 7232, 3), +(7230, 7233, 4), +(7230, 7234, 5), + -- Fire Resistance +(24440, 24440, 1), +(24440, 24441, 2), +(24440, 24463, 3), +(24440, 24464, 4), +(24440, 27351, 5), + -- Fire Resistance +(8185, 8185, 1), +(8185, 10534, 2), +(8185, 10535, 3), +(8185, 25562, 4), +(8185, 58738, 5), +(8185, 58740, 6), + -- Fire Shield +(2949, 2949, 1), +(2949, 8318, 2), +(2949, 8319, 3), +(2949, 11772, 4), +(2949, 11773, 5), +(2949, 27486, 6), + -- Fire Shield +(20322, 20322, 1), +(20322, 20323, 2), +(20322, 20324, 3), +(20322, 20326, 4), +(20322, 20327, 5), +(20322, 27489, 6), +(20322, 47998, 7), + -- Flameblade +(7829, 7829, 1), +(7829, 7874, 2), +(7829, 7875, 3), + -- Flameblade +(7806, 7806, 1), +(7806, 7807, 2), +(7806, 7808, 3), + -- Flurry +(12319, 12319, 1), +(12319, 12971, 2), +(12319, 12972, 3), +(12319, 12973, 4), +(12319, 12974, 5), + -- Flurry +(12966, 12966, 1), +(12966, 12967, 2), +(12966, 12968, 3), +(12966, 12969, 4), +(12966, 12970, 5), + -- Focused Will +(45234, 45234, 1), +(45234, 45243, 2), +(45234, 45244, 3), + -- Focused Will +(45237, 45237, 1), +(45237, 45241, 2), +(45237, 45242, 3), + -- Frost Nova +(1194, 1194, 1), +(1194, 1225, 2), +(1194, 6132, 3), +(1194, 10231, 4), +(1194, 27387, 5), + -- Frost Protection +(7240, 7240, 1), +(7240, 7236, 2), +(7240, 7238, 3), +(7240, 7237, 4), +(7240, 7239, 5), + -- Frost Resistance +(24475, 24475, 1), +(24475, 24476, 2), +(24475, 24477, 3), +(24475, 24478, 4), +(24475, 27352, 5), + -- Frost Resistance +(8182, 8182, 1), +(8182, 10476, 2), +(8182, 10477, 3), +(8182, 25559, 4), +(8182, 58742, 5), +(8182, 58744, 6), + -- Frostbrand Attack +(8034, 8034, 1), +(8034, 8037, 2), +(8034, 10458, 3), +(8034, 16352, 4), +(8034, 16353, 5), +(8034, 25501, 6), +(8034, 58797, 7), +(8034, 58798, 8), +(8034, 58799, 9), + -- Healing Stream +(5672, 5672, 1), +(5672, 6371, 2), +(5672, 6372, 3), +(5672, 10460, 4), +(5672, 10461, 5), +(5672, 25566, 6), +(5672, 58763, 7), +(5672, 58764, 8), +(5672, 58765, 9), + -- Holy Nova +(15237, 15237, 1), +(15237, 15430, 2), +(15237, 15431, 3), +(15237, 27799, 4), +(15237, 27800, 5), +(15237, 27801, 6), +(15237, 25331, 7), +(15237, 48077, 8), +(15237, 48078, 9), + -- Holy Nova +(23455, 23455, 1), +(23455, 23458, 2), +(23455, 23459, 3), +(23455, 27803, 4), +(23455, 27804, 5), +(23455, 27805, 6), +(23455, 25329, 7), +(23455, 48075, 8), +(23455, 48076, 9), + -- Holy Protection +(7245, 7245, 1), +(7245, 7246, 2), +(7245, 7247, 3), +(7245, 7248, 4), +(7245, 7249, 5), +(7245, 17545, 6), + -- Holy Shock +(20473, 20473, 1), +(20473, 20929, 2), +(20473, 20930, 3), +(20473, 27174, 4), +(20473, 33072, 5), +(20473, 48824, 6), +(20473, 48825, 7), + -- Holy Shock +(25912, 25912, 1), +(25912, 25911, 2), +(25912, 25902, 3), +(25912, 27176, 4), +(25912, 33073, 5), +(25912, 48822, 6), +(25912, 48823, 7), + -- Holy Shock +(25914, 25914, 1), +(25914, 25913, 2), +(25914, 25903, 3), +(25914, 27175, 4), +(25914, 33074, 5), +(25914, 48820, 6), +(25914, 48821, 7), + -- Hurricane +(16914, 16914, 1), +(16914, 17401, 2), +(16914, 17402, 3), +(16914, 27012, 4), +(16914, 48467, 5), + -- Hurricane +(42231, 42231, 1), +(42231, 42232, 2), +(42231, 42233, 3), +(42231, 42230, 4), +(42231, 48466, 5), + -- Immolation Trap +(13795, 13795, 1), +(13795, 14302, 2), +(13795, 14303, 3), +(13795, 14304, 4), +(13795, 14305, 5), +(13795, 27023, 6), +(13795, 49055, 7), +(13795, 49056, 8), + -- Impact +(11103, 11103, 1), +(11103, 12357, 2), +(11103, 12358, 3), + -- Improved Mend Pet +(19572, 19572, 1), +(19572, 19573, 2), + -- Infusion of Light +(53569, 53569, 1), +(53569, 53576, 2), + -- Initiative +(13976, 13976, 1), +(13976, 13979, 2), +(13976, 13980, 3), + -- Intercept +(30154, 30154, 1), +(30154, 30199, 2), +(30154, 30200, 3), + -- Intercept +(30153, 30153, 1), +(30153, 30195, 2), +(30153, 30197, 3), +(30153, 47995, 4), + -- Intercept +(30151, 30151, 1), +(30151, 30194, 2), +(30151, 30198, 3), +(30151, 47996, 4), + -- Lash of Pain +(7876, 7876, 1), +(7876, 7877, 2), +(7876, 7878, 3), +(7876, 11781, 4), +(7876, 11782, 5), +(7876, 11783, 6), + -- Lay on Hands +(20233, 20233, 1), +(20233, 20236, 2), + -- Lay on Hands +(17233, 17233, 1), +(17233, 9257, 2), + -- Lightning Bolt +(403, 403, 1), +(403, 529, 2), +(403, 548, 3), +(403, 915, 4), +(403, 943, 5), +(403, 6041, 6), +(403, 10391, 7), +(403, 10392, 8), +(403, 15207, 9), +(403, 15208, 10), +(403, 25448, 11), +(403, 25449, 12), +(403, 49237, 13), +(403, 49238, 14), + -- Lightning Bolt +(45284, 45284, 1), +(45284, 45286, 2), +(45284, 45287, 3), +(45284, 45288, 4), +(45284, 45289, 5), +(45284, 45290, 6), +(45284, 45291, 7), +(45284, 45292, 8), +(45284, 45293, 9), +(45284, 45294, 10), +(45284, 45295, 11), +(45284, 45296, 12), +(45284, 49239, 13), +(45284, 49240, 14), + -- Lightning Shield +(324, 324, 1), +(324, 325, 2), +(324, 905, 3), +(324, 945, 4), +(324, 8134, 5), +(324, 10431, 6), +(324, 10432, 7), +(324, 25469, 8), +(324, 25472, 9), +(324, 49280, 10), +(324, 49281, 11), + -- Lightning Shield +(26364, 26364, 1), +(26364, 26365, 2), +(26364, 26366, 3), +(26364, 26367, 4), +(26364, 26369, 5), +(26364, 26370, 6), +(26364, 26363, 7), +(26364, 26371, 8), +(26364, 26372, 9), +(26364, 49278, 10), +(26364, 49279, 11), + -- Living Bomb +(44457, 44457, 1), +(44457, 55359, 2), +(44457, 55360, 3), + -- Living Bomb +(44461, 44461, 1), +(44461, 55361, 2), +(44461, 55362, 3), + -- Mind Sear +(48045, 48045, 1), +(48045, 53023, 2), + -- Mind Sear +(49821, 49821, 1), +(49821, 53022, 2), + -- Molten Armor +(34913, 34913, 1), +(34913, 43043, 2), +(34913, 43044, 3), + -- Molten Armor +(30482, 30482, 1), +(30482, 43045, 2), +(30482, 43046, 3), + -- Nature Protection +(7250, 7250, 1), +(7250, 7251, 2), +(7250, 7252, 3), +(7250, 7253, 4), +(7250, 7254, 5), + -- Nature Resistance +(24494, 24494, 1), +(24494, 24511, 2), +(24494, 24512, 3), +(24494, 24513, 4), +(24494, 27354, 5), + -- Nature Resistance +(10596, 10596, 1), +(10596, 10598, 2), +(10596, 10599, 3), +(10596, 25573, 4), +(10596, 58748, 5), +(10596, 58750, 6), + -- On a Pale Horse +(49146, 49146, 1), +(49146, 51267, 2), + -- Penance +(47540, 47540, 1), +(47540, 53005, 2), +(47540, 53006, 3), +(47540, 53007, 4), + -- Penance +(47750, 47750, 1), +(47750, 52983, 2), +(47750, 52984, 3), +(47750, 52985, 4), + -- Penance +(47666, 47666, 1), +(47666, 52998, 2), +(47666, 52999, 3), +(47666, 53000, 4), + -- Plague Strike +(59133, 59133, 1), +(59133, 66988, 2), +(59133, 66989, 3), +(59133, 66990, 4), +(59133, 66991, 5), +(59133, 66992, 6), + -- Prowl +(24451, 24451, 1), +(24451, 24454, 2), +(24451, 24455, 3), + -- Rain of Fire +(42223, 42223, 1), +(42223, 42224, 2), +(42223, 42225, 3), +(42223, 42226, 4), +(42223, 42218, 5), +(42223, 47817, 6), +(42223, 47818, 7), + -- Rain of Fire +(5740, 5740, 1), +(5740, 6219, 2), +(5740, 11677, 3), +(5740, 11678, 4), +(5740, 27212, 5), +(5740, 47819, 6), +(5740, 47820, 7), + -- Sacrifice +(7885, 7885, 1), +(7885, 19439, 2), +(7885, 19444, 3), +(7885, 19445, 4), +(7885, 19446, 5), +(7885, 19447, 6), + -- Sacrifice +(20381, 20381, 1), +(20381, 20382, 2), +(20381, 20383, 3), +(20381, 20384, 4), +(20381, 20385, 5), +(20381, 20386, 6), +(20381, 27492, 7), +(20381, 48001, 8), +(20381, 48002, 9), + -- Safeguard +(46945, 46945, 1), +(46945, 46949, 2), + -- Safeguard +(46946, 46946, 1), +(46946, 46947, 2), + -- Seed of Corruption +(27285, 27285, 1), +(27285, 47833, 2), +(27285, 47834, 3), + -- Seed of Corruption +(27243, 27243, 1), +(27243, 47835, 2), +(27243, 47836, 3), + -- Shadow Protection +(7235, 7235, 1), +(7235, 7241, 2), +(7235, 7242, 3), +(7235, 7243, 4), +(7235, 7244, 5), + -- Shadow Resistance +(24490, 24490, 1), +(24490, 24514, 2), +(24490, 24515, 3), +(24490, 24516, 4), +(24490, 27353, 5), + -- Soothing Kiss +(6362, 6362, 1), +(6362, 7879, 2), +(6362, 11786, 3), +(6362, 11787, 4), + -- Soothing Kiss +(20403, 20403, 1), +(20403, 20404, 2), +(20403, 20405, 3), +(20403, 20406, 4), +(20403, 27494, 5), + -- Spell Lock +(19648, 19648, 1), +(19648, 19650, 2), + -- Spell Lock +(20433, 20433, 1), +(20433, 20434, 2), + -- Starfall +(50286, 50286, 1), +(50286, 53196, 2), +(50286, 53197, 3), +(50286, 53198, 4), + -- Starfall +(50294, 50294, 1), +(50294, 53188, 2), +(50294, 53189, 3), +(50294, 53190, 4), + -- Starfall +(50288, 50288, 1), +(50288, 53191, 2), +(50288, 53194, 3), +(50288, 53195, 4), + -- Suffering +(17736, 17736, 1), +(17736, 17753, 2), +(17736, 17754, 3), +(17736, 17755, 4), + -- Suffering +(20393, 20393, 1), +(20393, 20394, 2), +(20393, 20395, 3), +(20393, 20396, 4), +(20393, 27500, 5), +(20393, 33703, 6), +(20393, 48005, 7), +(20393, 48006, 8), + -- Surge of Light +(33150, 33150, 1), +(33150, 33154, 2), + -- Tainted Blood +(19661, 19661, 1), +(19661, 19662, 2), +(19661, 19663, 3), +(19661, 19664, 4), + -- Tainted Blood +(20429, 20429, 1), +(20429, 20430, 2), +(20429, 20431, 3), +(20429, 20432, 4), +(20429, 27497, 5), + -- The Art of War +(53486, 53486, 1), +(53486, 53488, 2), + -- Thick Skin +(5364, 5364, 1), +(5364, 5368, 2), +(5364, 5369, 3), +(5364, 5370, 4), + -- Thick Skin +(5363, 5363, 1), +(5363, 5365, 2), +(5363, 5366, 3), +(5363, 5367, 4), + -- Torment +(7881, 7881, 1), +(7881, 7882, 2), +(7881, 7883, 3), +(7881, 7884, 4), +(7881, 11776, 5), +(7881, 11777, 6), + -- Tough Shell +(4112, 4112, 1), +(4112, 4113, 2), +(4112, 4115, 3), +(4112, 4114, 4), + -- Tough Shell +(4107, 4107, 1), +(4107, 4108, 2), +(4107, 4109, 3), +(4107, 4111, 4), + -- Tranquility +(740, 740, 1), +(740, 8918, 2), +(740, 9862, 3), +(740, 9863, 4), +(740, 26983, 5), +(740, 48446, 6), +(740, 48447, 7), + -- Tranquility +(44203, 44203, 1), +(44203, 44205, 2), +(44203, 44206, 3), +(44203, 44207, 4), +(44203, 44208, 5), +(44203, 48444, 6), +(44203, 48445, 7), + -- Typhoon +(61391, 61391, 1), +(61391, 61390, 2), +(61391, 61388, 3), +(61391, 61387, 4), +(61391, 53227, 5), + -- Typhoon +(50516, 50516, 1), +(50516, 53223, 2), +(50516, 53225, 3), +(50516, 53226, 4), +(50516, 61384, 5), + -- Unfair Advantage +(51675, 51675, 1), +(51675, 51677, 2), + -- Unfair Advantage +(51672, 51672, 1), +(51672, 51674, 2), + -- Unleashed Rage +(30802, 30802, 1), +(30802, 30808, 2), +(30802, 30809, 3), + -- Unleashed Rage +(30803, 30803, 1), +(30803, 30804, 2), +(30803, 30805, 3), + -- Vindication +(9452, 9452, 1), +(9452, 26016, 2), + -- Vindication +(67, 67, 1), +(67, 26017, 2), + -- Volley +(42243, 42243, 1), +(42243, 42244, 2), +(42243, 42245, 3), +(42243, 42234, 4), +(42243, 58432, 5), +(42243, 58433, 6), + -- Volley +(1510, 1510, 1), +(1510, 14294, 2), +(1510, 14295, 3), +(1510, 27022, 4), +(1510, 58431, 5), +(1510, 58434, 6), + -- Will of the Necropolis +(52284, 52284, 1), +(52284, 52285, 2), +(52284, 52286, 3), + -- Will of the Necropolis +(49189, 49189, 1), +(49189, 50149, 2), +(49189, 50150, 3), + -- Wyvern Sting +(19386, 19386, 1), +(19386, 24132, 2), +(19386, 24133, 3), +(19386, 27068, 4), +(19386, 49011, 5), +(19386, 49012, 6), + -- First Aid +(746, 746, 1), +(746, 1159, 2), +(746, 3267, 3), +(746, 3268, 4), +(746, 7926, 5), +(746, 7927, 6), +(746, 10838, 7), +(746, 10839, 8), +(746, 18608, 9), +(746, 18610, 10), +(746, 27030, 11), +(746, 27031, 12), +(746, 45543, 13), +(746, 51827, 14), +(746, 45544, 15), +(746, 51803, 16), + -- Frost Strike +(49143, 49143, 1), +(49143, 51416, 2), +(49143, 51417, 3), +(49143, 51418, 4), +(49143, 51419, 5), +(49143, 55268, 6), + -- Intercept +(20253, 20253, 1), +(20253, 20614, 2), +(20253, 20615, 3), +(20253, 25273, 4), +(20253, 25274, 5), + -- Misery +(33191, 33191, 1), +(33191, 33192, 2), +(33191, 33193, 3), + -- Misery +(33196, 33196, 1), +(33196, 33197, 2), +(33196, 33198, 3), + -- Obliterate +(49020, 49020, 1), +(49020, 51423, 2), +(49020, 51424, 3), +(49020, 51425, 4), + -- Penance +(47758, 47758, 1), +(47758, 53001, 2), +(47758, 53002, 3), +(47758, 53003, 4), + -- Penance +(47757, 47757, 1), +(47757, 52986, 2), + -- Savage Rend +(50498, 50498, 1), +(50498, 53578, 2), +(50498, 53579, 3), +(50498, 53580, 4), +(50498, 53581, 5), +(50498, 53582, 6), + -- Spirit Bond +(19578, 19578, 1), +(19578, 20895, 2), + -- Spirit Bond +(19579, 19579, 1), +(19579, 24529, 2), + -- Stoneskin +(8072, 8072, 1), +(8072, 8156, 2), +(8072, 8157, 3), +(8072, 10403, 4), +(8072, 10404, 5), +(8072, 10405, 6), +(8072, 25506, 7), +(8072, 25507, 8), +(8072, 58752, 9), +(8072, 58754, 10), + -- Attack +(3606, 3606, 1), +(3606, 6350, 2), +(3606, 6351, 3), +(3606, 6352, 4), +(3606, 10435, 5), +(3606, 10436, 6), +(3606, 25530, 7), +(3606, 58700, 8), +(3606, 58701, 9), +(3606, 58702, 10), + -- Blood Strike +(45902, 45902, 1), +(45902, 49926, 2), +(45902, 49927, 3), +(45902, 49928, 4), +(45902, 49929, 5), +(45902, 49930, 6), + -- Elemental Devastation +(30160, 30160, 1), +(30160, 29179, 2), +(30160, 29180, 3), + -- Elemental Devastation +(30165, 30165, 1), +(30165, 29177, 2), +(30165, 29178, 3), + -- Fishing +(7620, 7620, 1), +(7620, 7731, 2), +(7620, 7732, 3), +(7620, 18248, 4), +(7620, 33095, 5), +(7620, 51294, 6), + -- Icy Touch +(45477, 45477, 1), +(45477, 49896, 2), +(45477, 49903, 3), +(45477, 49904, 4), +(45477, 49909, 5), + -- Judgements of the Pure +(53671, 53671, 1), +(53671, 53673, 2), +(53671, 54151, 3), +(53671, 54154, 4), +(53671, 54155, 5), + -- Judgements of the Pure +(53655, 53655, 1), +(53655, 53656, 2), +(53655, 53657, 3), +(53655, 54152, 4), +(53655, 54153, 5), + -- Master Tactician +(34506, 34506, 1), +(34506, 34507, 2), +(34506, 34508, 3), +(34506, 34838, 4), +(34506, 34839, 5), + -- Master Tactician +(34833, 34833, 1), +(34833, 34834, 2), +(34833, 34835, 3), +(34833, 34836, 4), +(34833, 34837, 5), + -- Plague Strike +(45462, 45462, 1), +(45462, 49917, 2), +(45462, 49918, 3), +(45462, 49919, 4), +(45462, 49920, 5), +(45462, 49921, 6), + -- Rapid Killing +(34948, 34948, 1), +(34948, 34949, 2), + -- Rapid Killing +(35098, 35098, 1), +(35098, 35099, 2), + -- Second Wind +(29841, 29841, 1), +(29841, 29842, 2), + -- Second Wind +(29834, 29834, 1), +(29834, 29838, 2), + -- Strength of Earth +(8076, 8076, 1), +(8076, 8162, 2), +(8076, 8163, 3), +(8076, 10441, 4), +(8076, 25362, 5), +(8076, 25527, 6), +(8076, 57621, 7), +(8076, 58646, 8), + -- Trauma +(46854, 46854, 1), +(46854, 46855, 2), + -- Trauma +(46856, 46856, 1), +(46856, 46857, 2), + -- Unbridled Wrath +(12322, 12322, 1), +(12322, 12999, 2), +(12322, 13000, 3), +(12322, 13001, 4), +(12322, 13002, 5), + -- Vanish +(11327, 11327, 1), +(11327, 11329, 2), +(11327, 26888, 3), + -- Blood Gorged +(50096, 50096, 1), +(50096, 50108, 2), +(50096, 50109, 3), +(50096, 50110, 4), +(50096, 50111, 5), + -- Blood Gorged +(61274, 61274, 1), +(61274, 61275, 2), +(61274, 61276, 3), +(61274, 61277, 4), +(61274, 61278, 5), + -- Blood Gorged +(61154, 61154, 1), +(61154, 61155, 2), +(61154, 61156, 3), +(61154, 61157, 4), +(61154, 61158, 5), + -- Cone of Cold +(1241, 1241, 1), +(1241, 8493, 2), +(1241, 10162, 3), +(1241, 10163, 4), +(1241, 10164, 5), +(1241, 27386, 6), + -- Flamestrike +(2124, 2124, 1), +(2124, 2125, 2), +(2124, 8425, 3), +(2124, 8426, 4), +(2124, 10217, 5), +(2124, 10218, 6), +(2124, 27385, 7), + -- Anesthetic Poison +(26688, 26688, 1), +(26688, 57981, 2), + -- Anesthetic Poison +(26785, 26785, 1), +(26785, 57982, 2), + -- Apprentice Riding +(33388, 33388, 1), +(33388, 33391, 2), +(33388, 34090, 3), +(33388, 34091, 4), + -- Primal Fury +(16958, 16958, 1), +(16958, 16961, 2), + -- Primal Fury +(37116, 37116, 1), +(37116, 37117, 2), + -- Nature Resist +(4548, 4548, 1), +(4548, 24502, 2), +(4548, 24503, 3), +(4548, 24504, 4), +(4548, 27055, 5), + -- Instant Poison +(8680, 8680, 1), +(8680, 8685, 2), +(8680, 8689, 3), +(8680, 11335, 4), +(8680, 11336, 5), +(8680, 11337, 6), +(8680, 26890, 7), +(8680, 57964, 8), +(8680, 57965, 9), + -- Instant Poison +(8679, 8679, 1), +(8679, 8686, 2), +(8679, 8688, 3), +(8679, 11338, 4), +(8679, 11339, 5), +(8679, 11340, 6), +(8679, 26891, 7), +(8679, 57967, 8), +(8679, 57968, 9), + -- Claw +(2980, 2980, 1), +(2980, 2981, 2), +(2980, 2982, 3), +(2980, 3667, 4), +(2980, 2975, 5), +(2980, 2976, 6), +(2980, 2977, 7), +(2980, 3666, 8), +(2980, 27347, 9), + -- Mace Specialization +(12284, 12284, 1), +(12284, 12701, 2), +(12284, 12702, 3), +(12284, 12703, 4), +(12284, 12704, 5), + -- Deadly Toxin +(11539, 11539, 1), +(11539, 11471, 2), +(11539, 11470, 3), +(11539, 11469, 4), + -- Deadly Poison +(2818, 2818, 1), +(2818, 2819, 2), +(2818, 11353, 3), +(2818, 11354, 4), +(2818, 25349, 5), +(2818, 26968, 6), +(2818, 27187, 7), +(2818, 57969, 8), +(2818, 57970, 9), + -- Deadly Poison +(2823, 2823, 1), +(2823, 2824, 2), +(2823, 11355, 3), +(2823, 11356, 4), +(2823, 25351, 5), +(2823, 26967, 6), +(2823, 27186, 7), +(2823, 57972, 8), +(2823, 57973, 9), + -- On a Pale Horse +(51983, 51983, 1), +(51983, 51986, 2), + -- On a Pale Horse +(51969, 51969, 1), +(51969, 51970, 2), + -- Wound Poison +(13218, 13218, 1), +(13218, 13222, 2), +(13218, 13223, 3), +(13218, 13224, 4), +(13218, 27189, 5), +(13218, 57974, 6), +(13218, 57975, 7), + -- Wound Poison +(13219, 13219, 1), +(13219, 13225, 2), +(13219, 13226, 3), +(13219, 13227, 4), +(13219, 27188, 5), +(13219, 57977, 6), +(13219, 57978, 7), + -- Thunderstomp +(26094, 26094, 1), +(26094, 26189, 2), +(26094, 26190, 3), +(26094, 27366, 4), + -- Obliterate +(66198, 66198, 1), +(66198, 66972, 2), +(66198, 66973, 3), +(66198, 66974, 4), + -- Frost Strike +(66196, 66196, 1), +(66196, 66958, 2), +(66196, 66959, 3), +(66196, 66960, 4), +(66196, 66961, 5), +(66196, 66962, 6), + -- Death Strike +(66188, 66188, 1), +(66188, 66950, 2), +(66188, 66951, 3), +(66188, 66952, 4), +(66188, 66953, 5), + -- Fiery Payback +(44440, 44440, 1), +(44440, 44441, 2), + -- Fiery Payback +(64353, 64353, 1), +(64353, 64357, 2), + -- Improved Flash Heal +(63504, 63504, 1), +(63504, 63505, 2), +(63504, 63506, 3), + -- Elemental Fury +(16089, 16089, 1), +(16089, 60184, 2), +(16089, 60185, 3), +(16089, 60187, 4), +(16089, 60188, 5), + -- Feral Swiftness +(17002, 17002, 1), +(17002, 24866, 2), + -- Master Shapeshifter +(48411, 48411, 1), +(48411, 48412, 2), + -- Nature's Majesty +(35363, 35363, 1), +(35363, 35364, 2), + -- Nature's Grace +(16880, 16880, 1), +(16880, 61345, 2), +(16880, 61346, 3), + -- Molten Skin +(63349, 63349, 1), +(63349, 63350, 2), +(63349, 63351, 3), + -- Master Demonologist +(23785, 23785, 1), +(23785, 23822, 2), +(23785, 23823, 3), +(23785, 23824, 4), +(23785, 23825, 5), + -- Death Rune Mastery +(49467, 49467, 1), +(49467, 50033, 2), +(49467, 50034, 3), + -- Improved Death Strike +(62905, 62905, 1), +(62905, 62908, 2), + -- Desolation +(66799, 66799, 1), +(66799, 66814, 2), +(66799, 66815, 3), +(66799, 66816, 4), +(66799, 66817, 5), + -- Mobility +(53483, 53483, 1), +(53483, 53485, 2), + -- Mobility +(53554, 53554, 1), +(53554, 53555, 2), + -- Arcane Missiles +(7268, 7268, 1), +(7268, 7269, 2), +(7268, 7270, 3), +(7268, 8419, 4), +(7268, 8418, 5), +(7268, 10273, 6), +(7268, 10274, 7), +(7268, 25346, 8), +(7268, 27076, 9), +(7268, 38700, 10), +(7268, 38703, 11), +(7268, 42844, 12), +(7268, 42845, 13), + -- Entangling Roots +(19975, 19975, 1), +(19975, 19974, 2), +(19975, 19973, 3), +(19975, 19972, 4), +(19975, 19971, 5), +(19975, 19970, 6), +(19975, 27010, 7), +(19975, 53313, 8), + -- Death Coil +(47541, 47541, 1), +(47541, 49892, 2), +(47541, 49893, 3), +(47541, 49894, 4), +(47541, 49895, 5), + -- Intellect +(8096, 8096, 1), +(8096, 8097, 2), +(8096, 8098, 3), +(8096, 12176, 4), +(8096, 33078, 5), +(8096, 43195, 6), +(8096, 48099, 7), +(8096, 48100, 8), + -- Stamina +(8099, 8099, 1), +(8099, 8100, 2), +(8099, 8101, 3), +(8099, 12178, 4), +(8099, 33081, 5), +(8099, 48101, 6), +(8099, 48102, 7), +(8099, 43198, 8), + -- Mutilate +(5374, 5374, 1), +(5374, 34414, 2), +(5374, 34416, 3), +(5374, 34419, 4), +(5374, 48662, 5), +(5374, 48665, 6), + -- Mutilate +(27576, 27576, 1), +(27576, 34415, 2), +(27576, 34417, 3), +(27576, 34418, 4), +(27576, 48661, 5), +(27576, 48664, 6), + -- Immolation trap +(13797, 13797, 1), +(13797, 14298, 2), +(13797, 14299, 3), +(13797, 14300, 4), +(13797, 14301, 5), +(13797, 27024, 6), +(13797, 49053, 7), +(13797, 49054, 8), + -- Sniper Training +(64418, 64418, 1), +(64418, 64419, 2), +(64418, 64420, 3), + -- Blood Strike +(66215, 66215, 1), +(66215, 66975, 2), +(66215, 66976, 3), +(66215, 66977, 4), +(66215, 66978, 5), +(66215, 66979, 6), + -- Stoneclaw Totem Effect +(5729, 5729, 1), +(5729, 6393, 2), +(5729, 6394, 3), +(5729, 6395, 4), +(5729, 10423, 5), +(5729, 10424, 6), +(5729, 25512, 7), +(5729, 58586, 8), +(5729, 58587, 9), +(5729, 58588, 10); diff --git a/sql/updates/3.3.2_old/7332_world_trinity_string.sql b/sql/updates/3.3.2_old/7332_world_trinity_string.sql new file mode 100644 index 0000000..2706e5b --- /dev/null +++ b/sql/updates/3.3.2_old/7332_world_trinity_string.sql @@ -0,0 +1,7 @@ +INSERT INTO `trinity_string` VALUES +(10056,'The battle for Strand of the Ancients begins in 2 minutes.','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL'), +(10057,'The battle for Strand of the Ancients begins in 1 minute.','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL'), +(10058,'The battle for Strand of the Ancients begins in 30 seconds. Prepare yourselves!.','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL'), +(10059,'Let the battle for Strand of the Ancients begin!.','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL'), +(10061,'%s is destroyed!','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL'), +(10060,'%s is under attack!','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL'); diff --git a/sql/updates/3.3.2_old/7349_world_spell_linked_spell.sql b/sql/updates/3.3.2_old/7349_world_spell_linked_spell.sql new file mode 100644 index 0000000..9afd55d --- /dev/null +++ b/sql/updates/3.3.2_old/7349_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +-- Summon Water Elemental +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=31687 AND `spell_effect`=70907; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES (31687, 70907, 0,'Summon Water Elemental'); diff --git a/sql/updates/3.3.2_old/7370_world_spell_linked_spell.sql b/sql/updates/3.3.2_old/7370_world_spell_linked_spell.sql new file mode 100644 index 0000000..2c69105 --- /dev/null +++ b/sql/updates/3.3.2_old/7370_world_spell_linked_spell.sql @@ -0,0 +1,2 @@ +-- Remove hack for glyph of Eternal Water +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=31687 AND `spell_effect`=70907; diff --git a/sql/updates/3.3.2_old/7373_world_scriptname.sql b/sql/updates/3.3.2_old/7373_world_scriptname.sql new file mode 100644 index 0000000..3588b9b --- /dev/null +++ b/sql/updates/3.3.2_old/7373_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `scriptname`='npc_trapped_mammoth_calf' WHERE `entry`=25850; +UPDATE `item_template` SET `scriptname`='item_dehta_trap_smasher' WHERE `entry`=35228; diff --git a/sql/updates/3.3.2_old/7385_world_scriptname.sql b/sql/updates/3.3.2_old/7385_world_scriptname.sql new file mode 100644 index 0000000..67b64e9 --- /dev/null +++ b/sql/updates/3.3.2_old/7385_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `scriptname`='go_tadpole_cage' WHERE `entry`=187373; diff --git a/sql/updates/3.3.2_old/7387_world_script_texts.sql b/sql/updates/3.3.2_old/7387_world_script_texts.sql new file mode 100644 index 0000000..57d8cbf --- /dev/null +++ b/sql/updates/3.3.2_old/7387_world_script_texts.sql @@ -0,0 +1,15 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=26588; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(26588, -1800013, 'Thank you for helping me get back to the camp. Go tell Walter that I''m safe now!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800012, 'Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800011, 'The Ravenous Worg chomps down on Mr. Floppy', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 4, 0, 0, '12027'), +(26588, -1800010, 'Mr. Floppy revives', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 4, 0, 0, '12027'), +(26588, -1800009, 'I think I see the camp! We''re almost home, Mr. Floppy! Let''s go!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800008, 'Mr. Floppy, you''re ok! Thank you so much for saving Mr. Floppy!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800007, 'Don''t go toward the light, Mr. Floppy!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800006, 'Let''s get out of here before more wolves find us!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800005, 'There''s a big meanie attacking Mr. Floppy! Help! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800004, 'He''s gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800003, 'Oh, no! Look, it''s another wolf, and it''s a biiiiiig one!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800002, 'He''s going for Mr. Floppy! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'), +(26588, -1800001, 'Um... I think one of those wolves is back...', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, '12027'); diff --git a/sql/updates/3.3.2_old/7387_world_script_waypoints.sql b/sql/updates/3.3.2_old/7387_world_script_waypoints.sql new file mode 100644 index 0000000..fd77b50 --- /dev/null +++ b/sql/updates/3.3.2_old/7387_world_script_waypoints.sql @@ -0,0 +1,29 @@ +DELETE FROM `script_waypoint` WHERE `entry`=26588; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(26588, 1, 4333.18, -3688.4, 263.857, 0, '0'), +(26588, 2, 4341.38, -3683.77, 257.422, 0, '0'), +(26588, 3, 4342.67, -3683.21, 257.218, 0, '0'), +(26588, 4, 4346.22, -3688.72, 257.065, 0, '0'), +(26588, 5, 4343.8, -3695.27, 257.124, 0, '0'), +(26588, 6, 4337.74, -3707.2, 257.628, 0, '0'), +(26588, 7, 4317.58, -3722.8, 256.941, 0, '0'), +(26588, 8, 4306.64, -3736.46, 258.304, 0, '0'), +(26588, 9, 4299.96, -3760.02, 254.959, 0, '0'), +(26588, 10, 4294.21, -3777.34, 249.139, 1000, '0'), +(26588, 11, 4294.37, -3776.97, 249.259, 10000, '0'), +(26588, 12, 4300.22, -3794.61, 240.107, 2000, '0'), +(26588, 13, 4307.25, -3817.76, 231.414, 2000, '0'), +(26588, 14, 4326.31, -3883.31, 208.457, 2000, '0'), +(26588, 15, 4346.19, -3905.41, 198.805, 2000, '0'), +(26588, 16, 4347.39, -3916.43, 196.716, 5000, '0'), +(26588, 17, 4350.17, -3935.03, 191.824, 1000, '0'), +(26588, 18, 4347.24, -3939.54, 191.445, 2000, '0'), +(26588, 19, 4347.24, -3939.54, 191.445, 2000, '0'), +(26588, 20, 4347.24, -3939.54, 191.445, 5000, '0'), +(26588, 21, 4347.24, -3939.54, 191.445, 7000, '0'), +(26588, 22, 4347.24, -3939.54, 191.445, 5000, '0'), +(26588, 23, 4347.24, -3939.54, 191.445, 5000, '0'), +(26588, 24, 4347.24, -3939.54, 191.445, 0, '0'), +(26588, 25, 4353.72, -3965.61, 190.154, 0, '0'), +(26588, 26, 4363.12, -3995.61, 183.327, 0, '0'), +(26588, 27, 4371.99, -4010.97, 181.33, 0, '0'); diff --git a/sql/updates/3.3.2_old/7387_world_scriptname.sql b/sql/updates/3.3.2_old/7387_world_scriptname.sql new file mode 100644 index 0000000..2ea5865 --- /dev/null +++ b/sql/updates/3.3.2_old/7387_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_emily' WHERE `entry`=26588; +UPDATE `creature_template` SET `ScriptName` = 'npc_mrfloppy' WHERE `entry`=26589; diff --git a/sql/updates/3.3.2_old/7390_world_scriptname.sql b/sql/updates/3.3.2_old/7390_world_scriptname.sql new file mode 100644 index 0000000..43f681d --- /dev/null +++ b/sql/updates/3.3.2_old/7390_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_gong' WHERE `entry`=148917; +UPDATE `creature_template` SET `ScriptName`='npc_tomb_creature' WHERE `entry` IN (7351,7349); +UPDATE `instance_template` SET `script`='instance_razorfen_downs' WHERE `map`=129; diff --git a/sql/updates/3.3.2_old/7394_world_spell_bonus_data.sql b/sql/updates/3.3.2_old/7394_world_spell_bonus_data.sql new file mode 100644 index 0000000..a6f7717 --- /dev/null +++ b/sql/updates/3.3.2_old/7394_world_spell_bonus_data.sql @@ -0,0 +1,17 @@ +-- Some spell bonus data mostly for DK spells and trinket spells +DELETE FROM `spell_bonus_data` WHERE `entry` IN (63544,54181,55078,55095,50536,52212,51460,48721,45477,54757,45055,60203,60488,45429); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(63544, 0, -1, -1, -1, 'Priest - Empowered Renew'), +(54181, 0, -1, -1, -1, 'Warlock - Fel Synergy'), +(55078, 0, 0, -1, 0.06325, 'Death Knight - Blood Plague'), +(55095, -1, 0, -1, 0.06325, 'Death Knight - Frost Fever'), +(50536, -1, 0, -1, -1, 'Death Knight - Unholy Blight (Rank 1)'), +(52212, 0, -1, 0.0475, -1, 'Death Knight - Death and Decay'), +(51460, 0, -1, -1, -1, 'Death Knight - Necrosis'), +(48721, 0, -1, 0.04, -1, 'Death Knight - Blood Boil'), +(45477, 0, -1, 0.1, -1, 'Death Knight - Icy Touch'), +(54757, 0, -1, -1, -1, 'Hand-Mounted Pyro Rocket - Pyro Rocket'), +(45055, 0, -1, -1, -1, 'Timbal\'s Focusing Crystal - Shadow Bolt'), +(60203, 0, -1, -1, -1, 'Darkmoon Card: Death'), +(60488, 0, -1, -1, -1, 'Extract of Necromatic Power'), +(45429, 0, -1, -1, -1, 'Shattered Sun Pendant of Acumen - Arcane Bolt'); diff --git a/sql/updates/3.3.2_old/7402_world_spell_group_stack_rules.sql b/sql/updates/3.3.2_old/7402_world_spell_group_stack_rules.sql new file mode 100644 index 0000000..4db195d --- /dev/null +++ b/sql/updates/3.3.2_old/7402_world_spell_group_stack_rules.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_group_stack_rules` WHERE `group_id` IN (1011); +INSERT INTO `spell_group_stack_rules` (`group_id`, `stack_rule`) VALUES (1011, 2); diff --git a/sql/updates/3.3.2_old/7406_world_scriptname.sql b/sql/updates/3.3.2_old/7406_world_scriptname.sql new file mode 100644 index 0000000..2f0fbb1 --- /dev/null +++ b/sql/updates/3.3.2_old/7406_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_dragonflayer_cage' WHERE entry IN (186566,186567,186568,186569,186570,186571,186572,186573,186574,186575); + diff --git a/sql/updates/3.3.2_old/7410_world_scriptname.sql b/sql/updates/3.3.2_old/7410_world_scriptname.sql new file mode 100644 index 0000000..9f137f5 --- /dev/null +++ b/sql/updates/3.3.2_old/7410_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_lazy_peon' WHERE `entry`=10556; + diff --git a/sql/updates/3.3.2_old/7417_characters_channels.sql b/sql/updates/3.3.2_old/7417_characters_channels.sql new file mode 100644 index 0000000..f61a810 --- /dev/null +++ b/sql/updates/3.3.2_old/7417_characters_channels.sql @@ -0,0 +1 @@ +ALTER TABLE channels ADD COLUMN m_public tinyint(1) NOT NULL DEFAULT 1 AFTER m_moderate; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7417_world_trinity_string.sql b/sql/updates/3.3.2_old/7417_world_trinity_string.sql new file mode 100644 index 0000000..fd8297c --- /dev/null +++ b/sql/updates/3.3.2_old/7417_world_trinity_string.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry`=5022; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES (5022, 'Channel password not changed due to channel being marked public. GM Powers required.'); diff --git a/sql/updates/3.3.2_old/7421_world_scriptname.sql b/sql/updates/3.3.2_old/7421_world_scriptname.sql new file mode 100644 index 0000000..ce0dbec --- /dev/null +++ b/sql/updates/3.3.2_old/7421_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_magmoth_crusher' WHERE `entry`=25434; diff --git a/sql/updates/3.3.2_old/7422_world_scriptname.sql b/sql/updates/3.3.2_old/7422_world_scriptname.sql new file mode 100644 index 0000000..d643cfa --- /dev/null +++ b/sql/updates/3.3.2_old/7422_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_black_cage' WHERE `entry`=195310; diff --git a/sql/updates/3.3.2_old/7423_world_areatrigger_scripts.sql b/sql/updates/3.3.2_old/7423_world_areatrigger_scripts.sql new file mode 100644 index 0000000..8f63ca6 --- /dev/null +++ b/sql/updates/3.3.2_old/7423_world_areatrigger_scripts.sql @@ -0,0 +1,2 @@ +-- delete naxxramas areatrigger to get to frostwyrm wing (no longer needed in 3.3.2) +DELETE FROM areatrigger_scripts WHERE `entry`=4156; diff --git a/sql/updates/3.3.2_old/7430_world_command.sql b/sql/updates/3.3.2_old/7430_world_command.sql new file mode 100644 index 0000000..54fd0f2 --- /dev/null +++ b/sql/updates/3.3.2_old/7430_world_command.sql @@ -0,0 +1,2 @@ +DELETE FROM `command` WHERE name='channel set public'; +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('channel set public', 3, 'Syntax: .channel set public $channel $public\r\n\r\nChange password-changing ability for a channel. 1 for possible, 0 for GM only.'); diff --git a/sql/updates/3.3.2_old/7430_world_trinity_string.sql b/sql/updates/3.3.2_old/7430_world_trinity_string.sql new file mode 100644 index 0000000..92867fb --- /dev/null +++ b/sql/updates/3.3.2_old/7430_world_trinity_string.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry`=5023; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES (5023, 'Channel: %s publicity set to: %u'); diff --git a/sql/updates/3.3.2_old/7432_world_access_requirement.sql b/sql/updates/3.3.2_old/7432_world_access_requirement.sql new file mode 100644 index 0000000..d7ad350 --- /dev/null +++ b/sql/updates/3.3.2_old/7432_world_access_requirement.sql @@ -0,0 +1 @@ +ALTER TABLE `access_requirement` ADD COLUMN `status` TINYINT(3) UNSIGNED DEFAULT 15 COMMENT 'instance status (open/close)'; diff --git a/sql/updates/3.3.2_old/7432_world_trinity_string.sql b/sql/updates/3.3.2_old/7432_world_trinity_string.sql new file mode 100644 index 0000000..9148a57 --- /dev/null +++ b/sql/updates/3.3.2_old/7432_world_trinity_string.sql @@ -0,0 +1,2 @@ +DELETE FROM `trinity_string` WHERE `entry`=5008; +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES (5008,'This instance is closed.'); diff --git a/sql/updates/3.3.2_old/7436_world_scriptname.sql b/sql/updates/3.3.2_old/7436_world_scriptname.sql new file mode 100644 index 0000000..673303c --- /dev/null +++ b/sql/updates/3.3.2_old/7436_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_dame_evniki_kapsalis' WHERE `entry`=34885; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7437_world_script_texts.sql b/sql/updates/3.3.2_old/7437_world_script_texts.sql new file mode 100644 index 0000000..a5b1f58 --- /dev/null +++ b/sql/updates/3.3.2_old/7437_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1571036,-1571037,-1571038); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`type`,`language`,`comment`) VALUES +(28090,-1571036, 'We''ll cleanse this place! Arthas beware!',0,0, 'crusade recruit RECRUIT_SAY1'), +(28090,-1571037, 'Your''re right! We can do this!',0,0, 'crusade recruit RECRUIT_SAY2'), +(28090,-1571038, 'Your''re right! What was I thinking? Bring on the Scourge!',0,0, 'crusade recruit RECRUIT_SAY3'); diff --git a/sql/updates/3.3.2_old/7437_world_scriptname.sql b/sql/updates/3.3.2_old/7437_world_scriptname.sql new file mode 100644 index 0000000..44550d1 --- /dev/null +++ b/sql/updates/3.3.2_old/7437_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_crusade_recruit' WHERE `entry`=28090; diff --git a/sql/updates/3.3.2_old/7441_world_scriptname.sql b/sql/updates/3.3.2_old/7441_world_scriptname.sql new file mode 100644 index 0000000..7f1bec9 --- /dev/null +++ b/sql/updates/3.3.2_old/7441_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='npc_squire_david' WHERE `entry`=33447; +UPDATE `creature_template` SET `ScriptName`='npc_argent_valiant' WHERE `entry`=33448; +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry`=33518; diff --git a/sql/updates/3.3.2_old/7446_world_areatrigger_scripts.sql b/sql/updates/3.3.2_old/7446_world_areatrigger_scripts.sql new file mode 100644 index 0000000..ff25dc6 --- /dev/null +++ b/sql/updates/3.3.2_old/7446_world_areatrigger_scripts.sql @@ -0,0 +1,3 @@ +-- areatrigger for Kelthuzad chamber center +DELETE FROM `areatrigger_scripts` WHERE `entry`=4112; +INSERT INTO `areatrigger_scripts`(`entry`,`ScriptName`) VALUES(4112,'at_kelthuzad_center'); diff --git a/sql/updates/3.3.2_old/7464_world_scriptname.sql b/sql/updates/3.3.2_old/7464_world_scriptname.sql new file mode 100644 index 0000000..df1304a --- /dev/null +++ b/sql/updates/3.3.2_old/7464_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_warmage_violetstand' WHERE `entry` IN (32369,32371,32372); diff --git a/sql/updates/3.3.2_old/7465_world_command.sql b/sql/updates/3.3.2_old/7465_world_command.sql new file mode 100644 index 0000000..3f682bf --- /dev/null +++ b/sql/updates/3.3.2_old/7465_world_command.sql @@ -0,0 +1,2 @@ +DELETE FROM `command` WHERE `name`='gobject info'; +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('gobject info', 2, 'Syntax: .gobject info [$object_entry]\r\n\r\nQuery Gameobject information for selected gameobject or given entry.'); diff --git a/sql/updates/3.3.2_old/7465_world_trinity_string.sql b/sql/updates/3.3.2_old/7465_world_trinity_string.sql new file mode 100644 index 0000000..10ff8de --- /dev/null +++ b/sql/updates/3.3.2_old/7465_world_trinity_string.sql @@ -0,0 +1,6 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (5024,5025,5026,5027); +INSERT INTO trinity_string (`entry`, `content_default`) VALUES +(5024, 'Entry: %u'), +(5025, 'Type: %u'), +(5026, 'DisplayID: %u'), +(5027, 'Name: %s'); diff --git a/sql/updates/3.3.2_old/7469_world_locales_quest.sql b/sql/updates/3.3.2_old/7469_world_locales_quest.sql new file mode 100644 index 0000000..b582670 --- /dev/null +++ b/sql/updates/3.3.2_old/7469_world_locales_quest.sql @@ -0,0 +1,8 @@ +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc1 text AFTER EndText_loc8; +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc2 text AFTER CompletedText_loc1; +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc3 text AFTER CompletedText_loc2; +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc4 text AFTER CompletedText_loc3; +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc5 text AFTER CompletedText_loc4; +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc6 text AFTER CompletedText_loc5; +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc7 text AFTER CompletedText_loc6; +ALTER TABLE locales_quest ADD COLUMN CompletedText_loc8 text AFTER CompletedText_loc7; diff --git a/sql/updates/3.3.2_old/7469_world_quest_template.sql b/sql/updates/3.3.2_old/7469_world_quest_template.sql new file mode 100644 index 0000000..5a48ff5 --- /dev/null +++ b/sql/updates/3.3.2_old/7469_world_quest_template.sql @@ -0,0 +1 @@ +ALTER TABLE quest_template CHANGE CompletionText CompletedText TEXT NULL DEFAULT NULL; diff --git a/sql/updates/3.3.2_old/7472_characters_characters.sql b/sql/updates/3.3.2_old/7472_characters_characters.sql new file mode 100644 index 0000000..4cb83f0 --- /dev/null +++ b/sql/updates/3.3.2_old/7472_characters_characters.sql @@ -0,0 +1,63 @@ +ALTER TABLE characters + ADD COLUMN `arenaPoints` int(10) UNSIGNED NOT NULL default '0' AFTER arena_pending_points, + ADD COLUMN `totalHonorPoints` int(10) UNSIGNED NOT NULL default '0' AFTER arenaPoints, + ADD COLUMN `todayHonorPoints` int(10) UNSIGNED NOT NULL default '0' AFTER totalHonorPoints, + ADD COLUMN `yesterdayHonorPoints` int(10) UNSIGNED NOT NULL default '0' AFTER todayHonorPoints, + ADD COLUMN `totalKills` int(10) UNSIGNED NOT NULL default '0' AFTER yesterdayHonorPoints, + ADD COLUMN `todayKills` smallint(5) UNSIGNED NOT NULL default '0' AFTER totalKills, + ADD COLUMN `yesterdayKills` smallint(5) UNSIGNED NOT NULL default '0' AFTER todayKills, + ADD COLUMN `chosenTitle` int(10) UNSIGNED NOT NULL default '0' AFTER yesterdayKills, + ADD COLUMN `knownCurrencies` bigint(20) UNSIGNED NOT NULL default '0' AFTER chosenTitle, + ADD COLUMN `watchedFaction` bigint(10) NOT NULL default '0' AFTER knownCurrencies, + ADD COLUMN `drunk` smallint(5) UNSIGNED NOT NULL default '0' AFTER watchedFaction, + ADD COLUMN `health` int(10) UNSIGNED NOT NULL default '0' AFTER drunk, + ADD COLUMN `power1` int(10) UNSIGNED NOT NULL default '0' AFTER health, + ADD COLUMN `power2` int(10) UNSIGNED NOT NULL default '0' AFTER power1, + ADD COLUMN `power3` int(10) UNSIGNED NOT NULL default '0' AFTER power2, + ADD COLUMN `power4` int(10) UNSIGNED NOT NULL default '0' AFTER power3, + ADD COLUMN `power5` int(10) UNSIGNED NOT NULL default '0' AFTER power4, + ADD COLUMN `power6` int(10) UNSIGNED NOT NULL default '0' AFTER power5, + ADD COLUMN `power7` int(10) UNSIGNED NOT NULL default '0' AFTER power6; + +UPDATE characters SET + arenaPoints = arena_pending_points + + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1278))+2, length(SUBSTRING_INDEX(data, ' ', 1278+1))- length(SUBSTRING_INDEX(data, ' ', 1278)) - 1), + totalHonorPoints = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1277))+2, length(SUBSTRING_INDEX(data, ' ', 1277+1))- length(SUBSTRING_INDEX(data, ' ', 1277)) - 1), + todayHonorPoints = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1226))+2, length(SUBSTRING_INDEX(data, ' ', 1226+1))- length(SUBSTRING_INDEX(data, ' ', 1226)) - 1), + yesterdayHonorPoints = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1227))+2, length(SUBSTRING_INDEX(data, ' ', 1227+1))- length(SUBSTRING_INDEX(data, ' ', 1227)) - 1), + totalKills = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1228))+2, length(SUBSTRING_INDEX(data, ' ', 1228+1))- length(SUBSTRING_INDEX(data, ' ', 1228)) - 1), + todayKills = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1225))+2, length(SUBSTRING_INDEX(data, ' ', 1225+1))- length(SUBSTRING_INDEX(data, ' ', 1225)) - 1) & 0x0000FFFF, + yesterdayKills = + (SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1225))+2, length(SUBSTRING_INDEX(data, ' ', 1225+1))- length(SUBSTRING_INDEX(data, ' ', 1225)) - 1) & 0xFFFF0000) >> 16, + chosenTitle = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 321))+2, length(SUBSTRING_INDEX(data, ' ', 321+1))- length(SUBSTRING_INDEX(data, ' ', 321)) - 1), + knownCurrencies = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 632))+2, length(SUBSTRING_INDEX(data, ' ', 632+1))- length(SUBSTRING_INDEX(data, ' ', 632)) - 1), + watchedFaction = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1230))+2, length(SUBSTRING_INDEX(data, ' ', 1230+1))- length(SUBSTRING_INDEX(data, ' ', 1230)) - 1), + drunk = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 155))+2, length(SUBSTRING_INDEX(data, ' ', 155+1))- length(SUBSTRING_INDEX(data, ' ', 155)) - 1) & 0xFFFE, + health = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 23))+2, length(SUBSTRING_INDEX(data, ' ', 23+1))- length(SUBSTRING_INDEX(data, ' ', 23)) - 1), + power1 = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 24))+2, length(SUBSTRING_INDEX(data, ' ', 24+1))- length(SUBSTRING_INDEX(data, ' ', 24)) - 1), + power2 = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 25))+2, length(SUBSTRING_INDEX(data, ' ', 25+1))- length(SUBSTRING_INDEX(data, ' ', 25)) - 1), + power3 = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 26))+2, length(SUBSTRING_INDEX(data, ' ', 26+1))- length(SUBSTRING_INDEX(data, ' ', 26)) - 1), + power4 = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 27))+2, length(SUBSTRING_INDEX(data, ' ', 27+1))- length(SUBSTRING_INDEX(data, ' ', 27)) - 1), + power5 = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 28))+2, length(SUBSTRING_INDEX(data, ' ', 28+1))- length(SUBSTRING_INDEX(data, ' ', 28)) - 1), + power6 = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 29))+2, length(SUBSTRING_INDEX(data, ' ', 29+1))- length(SUBSTRING_INDEX(data, ' ', 29)) - 1), + power7 = + SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 30))+2, length(SUBSTRING_INDEX(data, ' ', 30+1))- length(SUBSTRING_INDEX(data, ' ', 30)) - 1); + +ALTER TABLE characters + DROP COLUMN arena_pending_points; diff --git a/sql/updates/3.3.2_old/7500_world_scriptname.sql b/sql/updates/3.3.2_old/7500_world_scriptname.sql new file mode 100644 index 0000000..9188d61 --- /dev/null +++ b/sql/updates/3.3.2_old/7500_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName`= 'go_amberpine_outhouse' WHERE `entry`=188666; +UPDATE `creature_template` SET `ScriptName`= 'npc_outhouse_bunny' WHERE `entry`=27326; diff --git a/sql/updates/3.3.2_old/7508_world_trinity_string.sql b/sql/updates/3.3.2_old/7508_world_trinity_string.sql new file mode 100644 index 0000000..b7f66d5 --- /dev/null +++ b/sql/updates/3.3.2_old/7508_world_trinity_string.sql @@ -0,0 +1,11 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (6604,6605,6606,6607,6608,6609,6610,6611,6612); +INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES +(6604, 'You cannot say, yell or emote until you become level %d.'), +(6605, 'You cannot whisper until you become level %d.'), +(6606, 'You cannot write to channels until you become level %d.'), +(6607, 'You cannot use auction until you become level %d.'), +(6608, 'You cannot write tickets until you become level %d.'), +(6609, 'You cannot trade until you become level %d.'), +(6610, 'You cannot trade with characters lower than level %d.'), +(6611, 'You cannot send mail until you become level %d.'), +(6612, 'You cannot send mail to characters lower than level %d.'); diff --git a/sql/updates/3.3.2_old/7509_world_command.sql b/sql/updates/3.3.2_old/7509_world_command.sql new file mode 100644 index 0000000..942c364 --- /dev/null +++ b/sql/updates/3.3.2_old/7509_world_command.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name`='server shutdown'; +INSERT INTO `command` (`name`,`security`,`help`) VALUES ('server shutdown','3','Syntax: .server shutdown #delay [#exit_code]\r\n\r\nShut the server down after #delay seconds. Use #exit_code or 0 as program exit code.'); + diff --git a/sql/updates/3.3.2_old/7515_characters_group_member.sql b/sql/updates/3.3.2_old/7515_characters_group_member.sql new file mode 100644 index 0000000..e2ffafb --- /dev/null +++ b/sql/updates/3.3.2_old/7515_characters_group_member.sql @@ -0,0 +1,2 @@ +ALTER TABLE `group_member` +CHANGE `assistant` `memberFlags` tinyint(2) NOT NULL DEFAULT '0'; diff --git a/sql/updates/3.3.2_old/7515_characters_groups.sql b/sql/updates/3.3.2_old/7515_characters_groups.sql new file mode 100644 index 0000000..cf8f714 --- /dev/null +++ b/sql/updates/3.3.2_old/7515_characters_groups.sql @@ -0,0 +1,3 @@ +ALTER TABLE `groups` +DROP COLUMN `mainTank`, +DROP COLUMN `mainAssistant`; diff --git a/sql/updates/3.3.2_old/7547_world_vehicle_accessory.sql b/sql/updates/3.3.2_old/7547_world_vehicle_accessory.sql new file mode 100644 index 0000000..e929114 --- /dev/null +++ b/sql/updates/3.3.2_old/7547_world_vehicle_accessory.sql @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS `vehicle_accessory`; +CREATE TABLE `vehicle_accessory` ( + `entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, + `accessory_entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, + `seat_id` TINYINT(1) SIGNED NOT NULL DEFAULT 0, + `minion` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, + `description` TEXT NOT NULL, + PRIMARY KEY (`entry`, `seat_id`) +) +COLLATE=utf8_general_ci +ENGINE=MyISAM +ROW_FORMAT=FIXED +AVG_ROW_LENGTH=0; + +INSERT INTO `vehicle_accessory` (`entry`,`accessory_entry`,`seat_id`,`minion`,`description`) VALUES +(28782,28768,0,0, 'Acherus Deathcharger'), +(28312,28319,7,1, 'Wintergrasp Siege Engine'), +(32627,32629,7,1, 'Wintergrasp Siege Engine'), +(32930,32933,0,1, 'Kologarn'), +(32930,32934,1,1, 'Kologarn'), +(33109,33167,1,1, 'Salvaged Demolisher'), +(33060,33067,7,1, 'Salvaged Siege Engine'), +(33113,33114,0,1, 'Flame Leviathan'), +(33113,33114,1,1, 'Flame Leviathan'), +(33113,33114,2,1, 'Flame Leviathan'), +(33113,33114,3,1, 'Flame Leviathan'), +(33113,33139,7,1, 'Flame Leviathan'), +(33114,33142,1,1, 'Overload Control Device'), +(33114,33143,2,1, 'Leviathan Defense Turret'), +(33214,33218,1,1, 'Mechanolift 304-A'), +(35637,34705,0,0, 'Marshal Jacob Alerius'' Mount'), +(35633,34702,0,0, 'Ambrose Boltspark''s Mount'), +(35768,34701,0,0, 'Colosos'' Mount'), +(34658,34657,0,0, 'Jaelyne Evensong''s Mount'), +(35636,34703,0,0, 'Lana Stouthammer''s Mount'), +(35638,35572,0,0, 'Mokra the Skullcrusher''s Mount'), +(35635,35569,0,0, 'Eressea Dawnsinger''s Mount'), +(35640,35571,0,0, 'Runok Wildmane''s Mount'), +(35641,35570,0,0, 'Zul''tore''s Mount'), +(35634,35617,0,0, 'Deathstalker Visceri''s Mount'); diff --git a/sql/updates/3.3.2_old/7549_world_trinity_string.sql b/sql/updates/3.3.2_old/7549_world_trinity_string.sql new file mode 100644 index 0000000..793df94 --- /dev/null +++ b/sql/updates/3.3.2_old/7549_world_trinity_string.sql @@ -0,0 +1,6 @@ +DELETE FROM `trinity_string` WHERE `entry` in (2017,2022,2023,2024); +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(2017, '|cffaaffaaTicket|r:|cffaaccff %d.|r '), +(2022, '|cff00ff00Ticket Message|r: [%s]|r'), +(2023, '|cff00ff00GM Comment|r: [%s]|r'), +(2024, '|cff00ccff%s|r |cff00ff00Added comment|r: [%s]|r'); diff --git a/sql/updates/3.3.2_old/7551_world_trinity_string.sql b/sql/updates/3.3.2_old/7551_world_trinity_string.sql new file mode 100644 index 0000000..153fc4b --- /dev/null +++ b/sql/updates/3.3.2_old/7551_world_trinity_string.sql @@ -0,0 +1,6 @@ +DELETE FROM `trinity_string` WHERE `entry` in (1010,1012,1013,1015); +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(1010, '-[ Account][ Character][ IP][Map][Zone][Exp][GMLev]-'), +(1012, '-==================================================================-'), +(1013, '-[%16s][%12s][%15s][%3d][%4d][%d][%d]-'), +(1015, '-======================== Characters Online =======================-'); diff --git a/sql/updates/3.3.2_old/7552_world_battleground_template.sql b/sql/updates/3.3.2_old/7552_world_battleground_template.sql new file mode 100644 index 0000000..4283a7e --- /dev/null +++ b/sql/updates/3.3.2_old/7552_world_battleground_template.sql @@ -0,0 +1,5 @@ +-- Add disable column to allow battlegrounds to be disabled. +ALTER TABLE `battleground_template` ADD COLUMN disable TINYINT(1) NOT NULL DEFAULT '0'; + +-- Disable wtlk arenas by default +UPDATE `battleground_template` SET `disable`=1 WHERE `id` in (10,11); diff --git a/sql/updates/3.3.2_old/7552_world_trinity_string.sql b/sql/updates/3.3.2_old/7552_world_trinity_string.sql new file mode 100644 index 0000000..a8ff290 --- /dev/null +++ b/sql/updates/3.3.2_old/7552_world_trinity_string.sql @@ -0,0 +1,5 @@ +-- Add text for disabled bg/arenas. +DELETE FROM `trinity_string` WHERE `entry` in (747,748); +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(747, 'This Battleground have been disabled. You can''t join the queue.'), +(748, 'Arenas have been disabled. You can''t join the queue.'); diff --git a/sql/updates/3.3.2_old/7577_characters_addons.sql b/sql/updates/3.3.2_old/7577_characters_addons.sql new file mode 100644 index 0000000..6fc7ad3 --- /dev/null +++ b/sql/updates/3.3.2_old/7577_characters_addons.sql @@ -0,0 +1 @@ +ALTER TABLE `addons` CHANGE `crc` `crc` int(32) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.3.2_old/7581_world_spell_dbc.sql b/sql/updates/3.3.2_old/7581_world_spell_dbc.sql new file mode 100644 index 0000000..e49e1c3 --- /dev/null +++ b/sql/updates/3.3.2_old/7581_world_spell_dbc.sql @@ -0,0 +1,3 @@ +-- spell 61988 +DELETE FROM `spell_dbc` WHERE `id`=61988; +INSERT INTO `spell_dbc` (`Id`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `Targets`, `CastingTimeIndex`, `AuraInterruptFlags`, `ProcFlags`, `ProcChance`, `ProcCharges`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `RangeIndex`, `StackAmount`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `Effect1`, `Effect2`, `Effect3`, `EffectDieSides1`, `EffectDieSides2`, `EffectDieSides3`, `EffectBaseDice1`, `EffectBaseDice2`, `EffectBaseDice3`, `EffectDicePerLevel1`, `EffectDicePerLevel2`, `EffectDicePerLevel3`, `EffectRealPointsPerLevel1`, `EffectRealPointsPerLevel2`, `EffectRealPointsPerLevel3`, `EffectBasePoints1`, `EffectBasePoints2`, `EffectBasePoints3`, `EffectMechanic1`, `EffectMechanic2`, `EffectMechanic3`, `EffectImplicitTargetA1`, `EffectImplicitTargetA2`, `EffectImplicitTargetA3`, `EffectImplicitTargetB1`, `EffectImplicitTargetB2`, `EffectImplicitTargetB3`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectRadiusIndex3`, `EffectApplyAuraName1`, `EffectApplyAuraName2`, `EffectApplyAuraName3`, `EffectAmplitude1`, `EffectAmplitude2`, `EffectAmplitude3`, `EffectMultipleValue1`, `EffectMultipleValue2`, `EffectMultipleValue3`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectMiscValue3`, `EffectMiscValueB1`, `EffectMiscValueB2`, `EffectMiscValueB3`, `EffectTriggerSpell1`, `EffectTriggerSpell2`, `EffectTriggerSpell3`, `EffectSpellClassMaskA1`, `EffectSpellClassMaskA2`, `EffectSpellClassMaskA3`, `EffectSpellClassMaskB1`, `EffectSpellClassMaskB2`, `EffectSpellClassMaskB3`, `EffectSpellClassMaskC1`, `EffectSpellClassMaskC2`, `EffectSpellClassMaskC3`, `MaxTargetLevel`, `SpellFamilyName`, `SpellFamilyFlags1`, `SpellFamilyFlags2`, `SpellFamilyFlags3`, `MaxAffectedTargets`, `DmgClass`, `PreventionType`, `DmgMultiplier1`, `DmgMultiplier2`, `DmgMultiplier3`, `AreaGroupId`, `SchoolMask`, `Comment`) VALUES (61988, 0, 0, 0x28000180, 0x10000400, 0x4, 0x10100000, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 9, 13, 0, '-1', 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Divine Shield Exclude Aura - 61988'); diff --git a/sql/updates/3.3.2_old/7587_world_script_texts.sql b/sql/updates/3.3.2_old/7587_world_script_texts.sql new file mode 100644 index 0000000..1a044fc --- /dev/null +++ b/sql/updates/3.3.2_old/7587_world_script_texts.sql @@ -0,0 +1,74 @@ +-- set Halls of Stone text entry to correct range +-- Maiden of Grief +UPDATE `script_texts` SET `entry`=-1599000 WHERE `npc_entry`=27975 and `entry`=-1603000; +UPDATE `script_texts` SET `entry`=-1599001 WHERE `npc_entry`=27975 and `entry`=-1603001; +UPDATE `script_texts` SET `entry`=-1599002 WHERE `npc_entry`=27975 and `entry`=-1603002; +UPDATE `script_texts` SET `entry`=-1599003 WHERE `npc_entry`=27975 and `entry`=-1603003; +UPDATE `script_texts` SET `entry`=-1599004 WHERE `npc_entry`=27975 and `entry`=-1603004; +UPDATE `script_texts` SET `entry`=-1599005 WHERE `npc_entry`=27975 and `entry`=-1603005; +UPDATE `script_texts` SET `entry`=-1599006 WHERE `npc_entry`=27975 and `entry`=-1603006; +-- Krystallus +UPDATE `script_texts` SET `entry`=-1599007 WHERE `npc_entry`=27977 and `entry`=-1603007; +UPDATE `script_texts` SET `entry`=-1599008 WHERE `npc_entry`=27977 and `entry`=-1603008; +UPDATE `script_texts` SET `entry`=-1599009 WHERE `npc_entry`=27977 and `entry`=-1603009; +UPDATE `script_texts` SET `entry`=-1599010 WHERE `npc_entry`=27977 and `entry`=-1603010; +-- Sjonnir +UPDATE `script_texts` SET `entry`=-1599011,`sound`=14180 WHERE `npc_entry`=27978 and `entry`=-1603011; +UPDATE `script_texts` SET `entry`=-1599012,`sound`=14182 WHERE `npc_entry`=27978 and `entry`=-1603012; +UPDATE `script_texts` SET `entry`=-1599013,`sound`=14183 WHERE `npc_entry`=27978 and `entry`=-1603013; +UPDATE `script_texts` SET `entry`=-1599015,`sound`=14184 WHERE `npc_entry`=27978 and `entry`=-1603015; + +-- Brann and Tribunal Event +UPDATE `script_texts` SET `entry`=-1599016 WHERE `npc_entry`=28070 and `entry`=-1603016; +UPDATE `script_texts` SET `entry`=-1599017 WHERE `npc_entry`=28070 and `entry`=-1603017; +UPDATE `script_texts` SET `entry`=-1599018 WHERE `npc_entry`=28070 and `entry`=-1603018; +UPDATE `script_texts` SET `entry`=-1599019 WHERE `npc_entry`=28070 and `entry`=-1603019; +UPDATE `script_texts` SET `entry`=-1599020 WHERE `npc_entry`=28070 and `entry`=-1603020; +UPDATE `script_texts` SET `entry`=-1599021 WHERE `npc_entry`=28070 and `entry`=-1603021; +UPDATE `script_texts` SET `entry`=-1599022 WHERE `npc_entry`=28070 and `entry`=-1603022; +UPDATE `script_texts` SET `entry`=-1599023 WHERE `npc_entry`=28070 and `entry`=-1603023; +UPDATE `script_texts` SET `entry`=-1599024 WHERE `npc_entry`=28070 and `entry`=-1603024; +UPDATE `script_texts` SET `entry`=-1599025 WHERE `npc_entry`=28070 and `entry`=-1603025; +UPDATE `script_texts` SET `entry`=-1599026 WHERE `npc_entry`=28070 and `entry`=-1603026; +UPDATE `script_texts` SET `entry`=-1599027 WHERE `npc_entry`=28070 and `entry`=-1603027; +UPDATE `script_texts` SET `entry`=-1599028 WHERE `npc_entry`=28070 and `entry`=-1603028; +UPDATE `script_texts` SET `entry`=-1599029 WHERE `npc_entry`=28070 and `entry`=-1603029; +UPDATE `script_texts` SET `entry`=-1599030 WHERE `npc_entry`=28070 and `entry`=-1603030; +UPDATE `script_texts` SET `entry`=-1599031 WHERE `npc_entry`=28070 and `entry`=-1603031; +UPDATE `script_texts` SET `entry`=-1599032 WHERE `npc_entry`=28070 and `entry`=-1603032; +UPDATE `script_texts` SET `entry`=-1599033 WHERE `npc_entry`=28070 and `entry`=-1603033; +UPDATE `script_texts` SET `entry`=-1599034 WHERE `npc_entry`=28070 and `entry`=-1603034; +UPDATE `script_texts` SET `entry`=-1599035 WHERE `npc_entry`=28070 and `entry`=-1603035; +UPDATE `script_texts` SET `entry`=-1599036 WHERE `npc_entry`=28070 and `entry`=-1603036; +UPDATE `script_texts` SET `entry`=-1599037 WHERE `npc_entry`=28070 and `entry`=-1603037; +UPDATE `script_texts` SET `entry`=-1599038 WHERE `npc_entry`=28070 and `entry`=-1603038; +UPDATE `script_texts` SET `entry`=-1599039 WHERE `npc_entry`=28070 and `entry`=-1603039; +UPDATE `script_texts` SET `entry`=-1599040 WHERE `npc_entry`=28070 and `entry`=-1603040; +UPDATE `script_texts` SET `entry`=-1599041 WHERE `npc_entry`=28070 and `entry`=-1603041; +UPDATE `script_texts` SET `entry`=-1599042 WHERE `npc_entry`=28070 and `entry`=-1603042; +UPDATE `script_texts` SET `entry`=-1599043 WHERE `npc_entry`=28070 and `entry`=-1603043; +UPDATE `script_texts` SET `entry`=-1599044 WHERE `npc_entry`=28070 and `entry`=-1603044; +UPDATE `script_texts` SET `entry`=-1599045 WHERE `npc_entry`=28070 and `entry`=-1603045; +UPDATE `script_texts` SET `entry`=-1599046 WHERE `npc_entry`=28070 and `entry`=-1603046; +UPDATE `script_texts` SET `entry`=-1599047 WHERE `npc_entry`=28070 and `entry`=-1603047; +UPDATE `script_texts` SET `entry`=-1599048 WHERE `npc_entry`=28070 and `entry`=-1603048; +UPDATE `script_texts` SET `entry`=-1599049 WHERE `npc_entry`=28070 and `entry`=-1603049; +UPDATE `script_texts` SET `entry`=-1599050 WHERE `npc_entry`=28070 and `entry`=-1603050; +UPDATE `script_texts` SET `entry`=-1599051 WHERE `npc_entry`=28070 and `entry`=-1603051; +UPDATE `script_texts` SET `entry`=-1599052 WHERE `npc_entry`=28070 and `entry`=-1603052; +UPDATE `script_texts` SET `entry`=-1599053 WHERE `npc_entry`=28070 and `entry`=-1603053; +UPDATE `script_texts` SET `entry`=-1599054 WHERE `npc_entry`=28070 and `entry`=-1603054; +UPDATE `script_texts` SET `entry`=-1599055 WHERE `npc_entry`=28070 and `entry`=-1603055; +UPDATE `script_texts` SET `entry`=-1599056 WHERE `npc_entry`=28070 and `entry`=-1603056; +UPDATE `script_texts` SET `entry`=-1599057 WHERE `npc_entry`=28070 and `entry`=-1603057; +UPDATE `script_texts` SET `entry`=-1599058 WHERE `npc_entry`=28070 and `entry`=-1603058; +UPDATE `script_texts` SET `entry`=-1599059 WHERE `npc_entry`=28070 and `entry`=-1603059; +UPDATE `script_texts` SET `entry`=-1599060 WHERE `npc_entry`=28070 and `entry`=-1603060; +UPDATE `script_texts` SET `entry`=-1599061 WHERE `npc_entry`=28070 and `entry`=-1603061; +UPDATE `script_texts` SET `entry`=-1599062 WHERE `npc_entry`=28070 and `entry`=-1603062; +UPDATE `script_texts` SET `entry`=-1599063 WHERE `npc_entry`=28070 and `entry`=-1603063; +UPDATE `script_texts` SET `entry`=-1599064 WHERE `npc_entry`=28070 and `entry`=-1603064; +UPDATE `script_texts` SET `entry`=-1599065 WHERE `npc_entry`=28070 and `entry`=-1603065; +UPDATE `script_texts` SET `entry`=-1599066 WHERE `npc_entry`=28070 and `entry`=-1603066; +UPDATE `script_texts` SET `entry`=-1599067 WHERE `npc_entry`=28070 and `entry`=-1603067; +UPDATE `script_texts` SET `entry`=-1599068 WHERE `npc_entry`=28070 and `entry`=-1603068; diff --git a/sql/updates/3.3.2_old/7591_world_spell_dbc.sql b/sql/updates/3.3.2_old/7591_world_spell_dbc.sql new file mode 100644 index 0000000..33c2f0a --- /dev/null +++ b/sql/updates/3.3.2_old/7591_world_spell_dbc.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_dbc` WHERE `Id` = 200000; +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectBaseDice1`,`EffectBaseDice2`,`EffectBaseDice3`,`EffectDicePerLevel1`,`EffectDicePerLevel2`,`EffectDicePerLevel3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(200000,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,8,1,0,-1,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,1,1,1,0,1,'Drain Soul increased damage - serverside spell'); diff --git a/sql/updates/3.3.2_old/7597_world_scriptname.sql b/sql/updates/3.3.2_old/7597_world_scriptname.sql new file mode 100644 index 0000000..0c7e429 --- /dev/null +++ b/sql/updates/3.3.2_old/7597_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`= 'npc_argent_tournament_post' WHERE `entry`=35473; diff --git a/sql/updates/3.3.2_old/7598_world_scriptname.sql b/sql/updates/3.3.2_old/7598_world_scriptname.sql new file mode 100644 index 0000000..8c2d0ea --- /dev/null +++ b/sql/updates/3.3.2_old/7598_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`= 'npc_tallhorn_stag' WHERE `entry`=26363; +UPDATE `creature_template` SET `ScriptName`= 'npc_amberpine_woodsman' WHERE `entry`=27293; diff --git a/sql/updates/3.3.2_old/7604_characters_item_refund_instance.sql b/sql/updates/3.3.2_old/7604_characters_item_refund_instance.sql new file mode 100644 index 0000000..810d2fa --- /dev/null +++ b/sql/updates/3.3.2_old/7604_characters_item_refund_instance.sql @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS `item_refund_instance`; +CREATE TABLE `item_refund_instance` ( +`item_guid` int(11) unsigned NOT NULL COMMENT 'Item GUID', +`player_guid` int(11) unsigned NOT NULL COMMENT 'Player GUID', +`paidMoney` int(11) unsigned NOT NULL DEFAULT '0', +`paidHonor` int(11) unsigned NOT NULL DEFAULT '0', +`paidArena` int(11) unsigned NOT NULL DEFAULT '0', +`paidItem_1` mediumint(6) unsigned NOT NULL DEFAULT '0' COMMENT 'item_template.entry', +`paidItemCount_1` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItem_2` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItemCount_2` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItem_3` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItemCount_3` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItem_4` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItemCount_4` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItem_5` mediumint(6) unsigned NOT NULL DEFAULT '0', +`paidItemCount_5` mediumint(6) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`item_guid`, `player_guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.3.2_old/7609_world_spell_proc_event.sql b/sql/updates/3.3.2_old/7609_world_spell_proc_event.sql new file mode 100644 index 0000000..2111d9b --- /dev/null +++ b/sql/updates/3.3.2_old/7609_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (42370); +INSERT INTO `spell_proc_event` +(`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) +VALUES ( 42370, 0x00, 11, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Merciless Totem of the Third Wind diff --git a/sql/updates/3.3.2_old/7610_world_scriptname.sql b/sql/updates/3.3.2_old/7610_world_scriptname.sql new file mode 100644 index 0000000..89b005f --- /dev/null +++ b/sql/updates/3.3.2_old/7610_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`= 'npc_seaforium_depth_charge' WHERE `entry`=25401; diff --git a/sql/updates/3.3.2_old/7611_characters_item_refund_instance.sql b/sql/updates/3.3.2_old/7611_characters_item_refund_instance.sql new file mode 100644 index 0000000..cd859a4 --- /dev/null +++ b/sql/updates/3.3.2_old/7611_characters_item_refund_instance.sql @@ -0,0 +1,14 @@ +ALTER TABLE `item_refund_instance` +DROP COLUMN `paidHonor`, +DROP COLUMN `paidArena`, +DROP COLUMN `paidItem_1`, +DROP COLUMN `paidItemCount_1`, +DROP COLUMN `paidItem_2`, +DROP COLUMN `paidItemCount_2`, +DROP COLUMN `paidItem_3`, +DROP COLUMN `paidItemCount_3`, +DROP COLUMN `paidItem_4`, +DROP COLUMN `paidItemCount_4`, +DROP COLUMN `paidItem_5`, +DROP COLUMN `paidItemCount_5`, +ADD COLUMN `paidExtendedCost` int(11) unsigned NOT NULL DEFAULT '0'; diff --git a/sql/updates/3.3.2_old/7625_world_scriptname.sql b/sql/updates/3.3.2_old/7625_world_scriptname.sql new file mode 100644 index 0000000..ac0de69 --- /dev/null +++ b/sql/updates/3.3.2_old/7625_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `instance_template` SET `script`='instance_zulfarrak' WHERE `map`=209; diff --git a/sql/updates/3.3.2_old/7646_world_scriptname.sql b/sql/updates/3.3.2_old/7646_world_scriptname.sql new file mode 100644 index 0000000..f9dbb6d --- /dev/null +++ b/sql/updates/3.3.2_old/7646_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `creature_template` SET `ScriptName`='boss_drakos' WHERE `entry`=27654; +UPDATE `creature_template` SET `ScriptName`='npc_oculus_drake' WHERE `entry` IN (27657,27658,27659); +UPDATE `instance_template` SET `script`='instance_oculus' WHERE `map`=578; diff --git a/sql/updates/3.3.2_old/7655_world_script_texts.sql b/sql/updates/3.3.2_old/7655_world_script_texts.sql new file mode 100644 index 0000000..a7213b1 --- /dev/null +++ b/sql/updates/3.3.2_old/7655_world_script_texts.sql @@ -0,0 +1,233 @@ +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1603999 AND -1603000; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +-- Algalon +(32871,-1603000,'Your actions are illogical. All possible results for this encounter have been calculated. The Pantheon will receive the Observer''s message regardless of outcome.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15386,1,0,0,'algalon SAY_AGGRO'), +(32871,-1603001,'Loss of life, unavoidable.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15387,1,0,0,'algalon SAY_SLAY_1'), +(32871,-1603002,'I do what I must.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15388,1,0,0,'algalon SAY_SLAY_2'), +(32871,-1603003,'See your world through my eyes: A universe so vast as to be immeasurable - incomprehensible even to your greatest minds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15390,1,0,0,'algalon SAY_ENGADED_FOR_FIRTS_TIME'), +(32871,-1603004,'Beware!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15391,1,0,0,'algalon SAY_PHASE_2'), +(32871,-1603005,'The stars come to my aid.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15392,1,0,0,'algalon SAY_SUMMON_COLLAPSING_STAR'), +(32871,-1603006,'I have seen worlds bathed in the Makers'' flames. Their denizens fading without so much as a whimper. Entire planetary systems born and raised in the time that it takes your mortal hearts to beat once. Yet all throughout, my own heart, devoid of emotion... of empathy. I... have... felt... NOTHING! A million, million lives wasted. Had they all held within them your tenacity? Had they all loved life as you do?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15393,1,0,0,'algalon SAY_DEATH_1'), +(32871,-1603007,'Perhaps it is your imperfection that which grants you free will. That allows you to persevere against cosmically calculated odds. You prevailed where the Titans'' own perfect creations have failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15401,1,0,0,'algalon SAY_DEATH_2'), +(32871,-1603008,'I''ve rearranged the reply code. Your planet will be spared. I cannot be certain of my own calculations anymore.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15402,1,0,0,'algalon SAY_DEATH_3'), +(32871,-1603009,'I lack the strength to transmit the signal. You must hurry. Find a place of power close to the skies.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15403,1,0,0,'algalon SAY_DEATH_4'), +(32871,-1603010,'Do not worry about my fate $N. If the signal is not transmitted in time re-origination will proceed regardless. Save. Your. World.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15404,1,0,0,'algalon SAY_DEATH_5'), +(32871,-1603011,'You are... out of time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15394,1,0,0,'algalon SAY_BERSERK'), +(32871,-1603012,'Witness the fury of cosmos!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15396,1,0,0,'algalon SAY_BIGBANG_1'), +(32871,-1603013,'Behold the tools of creation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15397,1,0,0,'algalon SAY_BIGBANG_2'), +(32871,-1603014,'Analysis complete. There is partial corruption in the planet''s life-support systems as well as complete corruption in most of the planet''s defense mechanisms.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15398,1,0,0,'algalon SAY_TIMER_1'), +(32871,-1603015,'Begin uplink: Reply Code: ''Omega''. Planetary re-origination requested.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15399,1,0,0,'algalon SAY_TIMER_2'), +(32871,-1603016,'Farewell, mortals. Your bravery is admirable, for such flawed creatures.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15400,1,0,0,'algalon SAY_TIMER_3'), +(32871,-1603017,'Trans-location complete. Commencing planetary analysis of Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15405,1,0,0,'algalon SAY_SUMMON_1'), +(32871,-1603018,'Stand back, mortals. I am not here to fight you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15406,1,0,0,'algalon SAY_SUMMON_2'), +(32871,-1603019,'It is in the universe''s best interest to re-originate this planet should my analysis find systemic corruption. Do not interfere.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15407,1,0,0,'algalon SAY_SUMMON_3'), + +-- Assembly of Iron - Stellbreaker +(32867,-1603020,'You will not defeat the Assembly of Iron so easily, invaders!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15674,1,0,0,'steelbreaker SAY_AGGRO'), +(32867,-1603021,'So fragile and weak!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15675,1,0,0,'steelbreaker SAY_SLAY_1'), +(32867,-1603022,'Flesh... such a hindrance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15676,1,0,0,'steelbreaker SAY_SLAY_2'), +(32867,-1603023,'You seek the secrets of Ulduar? Then take them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15677,1,0,0,'steelbreaker SAY_POWER'), +(32867,-1603024,'My death only serves to hasten your demise.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15678,1,0,0,'steelbreaker SAY_DEATH_1'), +(32867,-1603025,'Impossible!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15679,1,0,0,'steelbreaker SAY_DEATH_2'), +(32867,-1603026,'This meeting of the Assembly of Iron is adjourned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15680,1,0,0,'steelbreaker SAY_BERSERK'), + +-- Assembly of Iron - Runemaster Molgeim +(32927,-1603030,'Nothing short of total decimation will suffice.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15657,1,0,0,'Molgeim SAY_AGGRO'), +(32927,-1603031,'The world suffers yet another insignificant loss.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15658,1,0,0,'Molgeim SAY_SLAY_1'), +(32927,-1603032,'Death is the price of your arrogance.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15659,1,0,0,'Molgeim SAY_SLAY_2'), +(32927,-1603033,'Decipher this!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15660,1,0,0,'Molgeim SAY_RUNE_DEATH'), +(32927,-1603034,'Face the lightning surge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15661,1,0,0,'Molgeim SAY_SUMMON'), +(32927,-1603035,'The legacy of storms shall not be undone.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15662,1,0,0,'Molgeim SAY_DEATH_1'), +(32927,-1603036,'What have you gained from my defeat? You are no less doomed, mortals!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15663,1,0,0,'Molgeim SAY_DEATH_2'), +(32927,-1603037,'This meeting of the Assembly of Iron is adjourned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15664,1,0,0,'Molgeim SAY_BERSERK'), + +-- Assembly of Iron - Stormcaller Brundir +(32857,-1603040,'Whether the world''s greatest gnats or the world''s greatest heroes, you''re still only mortal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15684,1,0,0,'Brundir SAY_AGGRO'), +(32857,-1603041,'A merciful kill!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15685,1,0,0,'Brundir SAY_SLAY_1'), +(32857,-1603042,'HAH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15686,1,0,0,'Brundir SAY_SLAY_2'), +(32857,-1603043,'Stand still and stare into the light!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15687,1,0,0,'Brundir SAY_SPECIAL'), +(32857,-1603044,'Let the storm clouds rise and rain down death from above!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15688,1,0,0,'Brundir SAY_FLIGHT'), +(32857,-1603045,'The power of the storm lives on...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15689,1,0,0,'Brundir SAY_DEATH_1'), +(32857,-1603046,'You rush headlong into the maw of madness!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15690,1,0,0,'Brundir SAY_DEATH_2'), +(32857,-1603047,'This meeting of the Assembly of Iron is adjourned!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15691,1,0,0,'Brundir SAY_BERSERK'), + +-- Auriaya +(33515,-1603050,'Some things are better left alone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15473,1,0,0,'Auriaya SAY_AGGRO'), +(33515,-1603051,'The secret dies with you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15474,1,0,0,'Auriaya SAY_SLAY_1'), +(33515,-1603052,'There is no escape!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15475,1,0,0,'Auriaya SAY_SLAY_2'), +(33515,-1603053,'Auriaya screams in agony.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,6,0,15476,'Auriaya SAY_DEATH'), +(33515,-1603054,'You waste my time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15477,1,0,0,'Auriaya SAY_BERSERK'), + +-- Flame Leviathan +(33113,-1603060,'Hostile entities detected. Threat assessment protocol active. Primary target engaged. Time minus thirty seconds to re-evaluation.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15506,1,0,0,'Flame Leviathan SAY_AGGRO'), +(33113,-1603061,'Threat assessment routine modified. Current target threat level: zero. Acquiring new target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15521,1,0,0,'Flame Leviathan SAY_SLAY'), +(33113,-1603062,'Total systems failure. Defense protocols breached. Leviathan Unit shutting down.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15520,1,0,0,'Flame Leviathan SAY_DEATH'), +(33113,-1603063,'Threat re-evaluated. Target assessment complete. Changing course.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15507,1,0,0,'Flame Leviathan SAY_TARGET_1'), +(33113,-1603064,'Pursuit objective modified. Changing course.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15508,1,0,0,'Flame Leviathan SAY_TARGET_2'), +(33113,-1603065,'Hostile entity stratagem predicted. Rerouting battle function. Changing course.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15509,1,0,0,'Flame Leviathan SAY_TARGET_3'), +(33113,-1603066,'Orbital countermeasures enabled.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15510,1,0,0,'Flame Leviathan SAY_HARDMODE'), +(33113,-1603067,'Alert! Static defense system failure. Orbital countermeasures disabled.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15511,1,0,0,'Flame Leviathan SAY_TOWER_NONE'), +(33113,-1603068,'''Hodir''s Fury'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15512,1,0,0,'Flame Leviathan SAY_TOWER_FROST'), +(33113,-1603069,'''Mimiron''s Inferno'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15513,1,0,0,'Flame Leviathan SAY_TOWER_FLAME'), +(33113,-1603070,'''Freya''s Ward'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15514,1,0,0,'Flame Leviathan SAY_TOWER_NATURE'), +(33113,-1603071,'''Thorim''s Hammer'' online. Acquiring target.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15515,1,0,0,'Flame Leviathan SAY_TOWER_STORM'), +(33113,-1603072,'Unauthorized entity attempting circuit overload. Activating anti-personnel countermeasures.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15516,1,0,0,'Flame Leviathan SAY_PLAYER_RIDING'), +(33113,-1603073,'System malfunction. Diverting power to support systems.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15517,1,0,0,'Flame Leviathan SAY_OVERLOAD_1'), +(33113,-1603074,'Combat matrix overload. Powering do-o-o-own...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15518,1,0,0,'Flame Leviathan SAY_OVERLOAD_2'), +(33113,-1603075,'System restart required. Deactivating weapon systems.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15519,1,0,0,'Flame Leviathan SAY_OVERLOAD_3'), +-- reserve 1603076-1603179 to implement other texts related to flame leviathan encounter + +-- Freya +(32906,-1603180,'The Conservatory must be protected!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15526,1,0,0,'Freya SAY_AGGRO'), +(32906,-1603181,'Elders, grant me your strength!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15527,1,0,0,'Freya SAY_AGGRO_WITH_ELDER'), +(32906,-1603182,'Forgive me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15529,1,0,0,'Freya SAY_SLAY_1'), +(32906,-1603183,'From your death springs life anew!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15530,1,0,0,'Freya SAY_SLAY_2'), +(32906,-1603184,'His hold on me dissipates. I can see clearly once more. Thank you, heroes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15531,1,0,0,'Freya SAY_DEATH'), +(32906,-1603185,'You have strayed too far, wasted too much time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15532,1,0,0,'Freya SAY_BERSERK'), +(32906,-1603186,'Eonar, your servant requires aid!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15528,1,0,0,'Freya SAY_SUMMON_CONSERVATOR'), +(32906,-1603187,'Children, assist me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15331,1,0,0,'Freya SAY_SUMMON_TRIO'), +(32906,-1603188,'The swarm of the elements shall overtake you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15534,1,0,0,'Freya SAY_SUMMON_LASHERS'), +(32906,-1603189,'Eonar, your servant calls for your blessing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15535,1,0,0,'Freya SAY_YS_HELP'), + +-- Elder Brightleaf +(32915,-1603190,'Matron, the Conservatory has been breached!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15483,1,0,0,'Elder Brightleaf SAY_AGGRO'), +(32915,-1603191,'Fertilizer.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15485,1,0,0,'Elder Brightleaf SAY_SLAY_1'), +(32915,-1603192,'Your corpse will nourish the soil!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15486,1,0,0,'Elder Brightleaf SAY_SLAY_2'), +(32915,-1603193,'Matron, one has fallen!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15487,1,0,0,'Elder Brightleaf SAY_DEATH'), + +-- Elder Ironbranch +(32913,-1603194,'Mortals have no place here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15493,1,0,0,'Elder Ironbranch SAY_AGGRO'), +(32913,-1603195,'I return you whence you came!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15494,1,0,0,'Elder Ironbranch SAY_SLAY_1'), +(32913,-1603196,'BEGONE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15495,1,0,0,'Elder Ironbranch SAY_SLAY_2'), +(32913,-1603197,'Freya! They come for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15496,1,0,0,'Elder Ironbranch SAY_DEATH'), + +-- Elder Stonebark +(32914,-1603198,'This place will serve as your graveyard.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15500,1,0,0,'Elder Stonebark SAY_AGGRO'), +(32914,-1603199,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15501,1,0,0,'Elder Stonebark SAY_SLAY_1'), +(32914,-1603200,'Such a waste.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15502,1,0,0,'Elder Stonebark SAY_SLAY_2'), +(32914,-1603201,'Matron, flee! They are ruthless....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15503,1,0,0,'Elder Stonebark SAY_DEATH'), + +-- Hodir +(32845,-1603210,'You will suffer for this trespass!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15552,1,0,0,'Hodir SAY_AGGRO'), +(32845,-1603211,'Tragic. To come so far, only to fail.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15553,1,0,0,'Hodir SAY_SLAY_1'), +(32845,-1603212,'Welcome to the endless winter.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15554,1,0,0,'Hodir SAY_SLAY_2'), +(32845,-1603213,'Winds of the north consume you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15555,1,0,0,'Hodir SAY_FLASH_FREEZE'), +(32845,-1603214,'Hodir roars furious.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15556,6,0,0,'Hodir SAY_STALACTITE'), +(32845,-1603215,'I... I am released from his grasp... at last.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15557,1,0,0,'Hodir SAY_DEATH'), +(32845,-1603216,'Enough! This ends now!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15558,1,0,0,'Hodir SAY_BERSERK'), +(32845,-1603217,'The veil of winter will protect you, champions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15559,1,0,0,'Hodir SAY_YS_HELP'), +(32845,-1603218,'Hodir shatters the Rare Cache of Hodir!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,6,0,0,'Hodir SAY_HARD_MODE_MISSED'), + +-- Ignis +(33118,-1603220,'Insolent whelps! Your blood will temper the weapons used to reclaim this world!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15564,1,0,0,'Ignis SAY_AGGRO'), +(33118,-1603221,'More scraps for the scrapheap!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15569,1,0,0,'Ignis SAY_SLAY_1'), +(33118,-1603222,'Your bones will serve as kindling!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15570,1,0,0,'Ignis SAY_SLAY_2'), +(33118,-1603223,'I. Have. Failed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15572,1,0,0,'Ignis SAY_DEATH'), +(33118,-1603224,'Arise, soldiers of the Iron Crucible! The Makers'' will be done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15565,1,0,0,'Ignis SAY_SUMMON'), +(33118,-1603225,'I will burn away your impurities!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15566,1,0,0,'Ignis SAY_SLAG_POT'), +(33118,-1603226,'Let the inferno consume you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15567,1,0,0,'Ignis SAY_SCORCH_1'), +(33118,-1603227,'BURN! Burn in the makers fire!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15568,1,0,0,'Ignis SAY_SCORCH_2'), +(33118,-1603228,'Let it be finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15571,1,0,0,'Ignis SAY_BERSERK'), + +-- Kologarn +(32930,-1603230,'None shall pass!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15586,1,0,0,'Kologarn SAY_AGGRO'), +(32930,-1603231,'KOL-THARISH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15587,1,0,0,'Kologarn SAY_SLAY_1'), +(32930,-1603232,'YOU FAIL!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15588,1,0,0,'Kologarn SAY_SLAY_2'), +(32930,-1603233,'Just a scratch!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15589,1,0,0,'Kologarn SAY_LEFT_ARM_GONE'), +(32930,-1603234,'Only a flesh wound!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15590,1,0,0,'Kologarn SAY_RIGHT_ARM_GONE'), +(32930,-1603235,'OBLIVION!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15591,1,0,0,'Kologarn SAY_SHOCKWAVE'), +(32930,-1603236,'I will squeeze the life from you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15592,1,0,0,'Kologarn SAY_GRAB_PLAYER'), +(32930,-1603237,'Master, they come...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15593,1,0,0,'Kologarn SAY_DEATH'), +(32930,-1603238,'I am invincible!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15594,1,0,0,'Kologarn SAY_BERSERK'), + +-- Mimiron +(33350,-1603240,'Oh, my! I wasn''t expecting company! The workshop is such a mess! How embarrassing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15611,1,0,0,'Mimiron SAY_AGGRO'), +(33350,-1603241,'Now why would you go and do something like that? Didn''t you see the sign that said ''DO NOT PUSH THIS BUTTON!''? How will we finish testing with the self-destruct mechanism active?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15629,1,0,0,'Mimiron SAY_HARDMODE_ON'), +(33350,-1603242,'We haven''t much time, friends! You''re going to help me test out my latest and greatest creation. Now, before you change your minds, remember, that you kind of owe it to me after the mess you made with the XT-002.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15612,1,0,0,'Mimiron SAY_MKII_ACTIVATE'), +(33350,-1603243,'MEDIC!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15613,1,0,0,'Mimiron SAY_MKII_SLAY_1'), +(33350,-1603244,'I can fix that... or, maybe not! Sheesh, what a mess...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15614,1,0,0,'Mimiron SAY_MKII_SLAY_2'), +(33350,-1603245,'WONDERFUL! Positively marvelous results! Hull integrity at 98.9 percent! Barely a dent! Moving right along.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15615,1,0,0,'Mimiron SAY_MKII_DEATH'), +(33350,-1603246,'Behold the VX-001 Anti-personnel Assault Cannon! You might want to take cover.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15616,1,0,0,'Mimiron SAY_VX001_ACTIVATE'), +(33350,-1603247,'Fascinating. I think they call that a "clean kill".',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15617,1,0,0,'Mimiron SAY_VX001_SLAY_1'), +(33350,-1603248,'Note to self: Cannon highly effective against flesh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15618,1,0,0,'Mimiron SAY_VX001_SLAY_2'), +(33350,-1603249,'Thank you, friends! Your efforts have yielded some fantastic data! Now, where did I put-- oh, there it is!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15619,1,0,0,'Mimiron SAY_VX001_DEATH'), +(33350,-1603250,'Isn''t it beautiful? I call it the magnificent aerial command unit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15620,1,0,0,'Mimiron SAY_AERIAL_ACTIVATE'), +(33350,-1603251,'Outplayed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15621,1,0,0,'Mimiron SAY_AERIAL_SLAY_1'), +(33350,-1603252,'You can do better than that!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15622,1,0,0,'Mimiron SAY_AERIAL_SLAY_2'), +(33350,-1603253,'Preliminary testing phase complete. Now comes the true test!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15623,1,0,0,'Mimiron SAY_AERIAL_DEATH'), +(33350,-1603254,'Gaze upon its magnificence! Bask in its glorious, um, glory! I present you... V-07-TR-0N!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15624,1,0,0,'Mimiron SAY_V07TRON_ACTIVATE'), +(33350,-1603255,'Prognosis: Negative!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15625,1,0,0,'Mimiron SAY_V07TRON_SLAY_1'), +(33350,-1603256,'You''re not going to get up from that one, friend.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15626,1,0,0,'Mimiron SAY_V07TRON_SLAY_2'), +(33350,-1603257,'It would appear that I''ve made a slight miscalculation. I allowed my mind to be corrupted by the fiend in the prison, overriding my primary directive. All systems seem to be functional now. Clear.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15627,1,0,0,'Mimiron SAY_V07TRON_DEATH'), +(33350,-1603258,'Oh, my! It would seem that we are out of time, my friends!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15628,1,0,0,'Mimiron SAY_BERSERK'), +(33350,-1603259,'Combat matrix enhanced. Behold wonderous rapidity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15630,1,0,0,'Mimiron SAY_YS_HELP'), + +-- Razorscale encounter +(33210,-1603260,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15647,1,0,0,'Exp. Commander SAY_INTRO'), +(33210,-1603261,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15648,1,0,0,'Exp. Commander SAY_GROUND'), + +-- Thorim +(33413,-1603270,'Interlopers! You mortals who dare to interfere with my sport will pay... Wait--you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15733,1,0,0,'Thorim SAY_AGGRO_1'), +(33413,-1603271,'I remember you... In the mountains... But you... what is this? Where am--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15734,1,0,0,'Thorim SAY_AGGRO_2'), +(33413,-1603272,'Behold the power of the storms and despair!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15735,1,0,0,'Thorim SAY_SPECIAL_1'), +(33413,-1603273,'Do not hold back! Destroy them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15736,1,0,0,'Thorim SAY_SPECIAL_2'), +(33413,-1603274,'Have you begun to regret your intrusion?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15737,1,0,0,'Thorim SAY_SPECIAL_3'), +(33413,-1603275,'Impertinent whelps! You dare challenge me atop my pedestal! I will crush you myself!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15738,1,0,0,'Thorim SAY_JUMPDOWN'), +(33413,-1603276,'Can''t you at least put up a fight!?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15739,1,0,0,'Thorim SAY_SLAY_1'), +(33413,-1603277,'Pathetic!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15740,1,0,0,'Thorim SAY_SLAY_2'), +(33413,-1603278,'My patience has reached its limit!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15741,1,0,0,'Thorim SAY_BERSERK'), +(33413,-1603279,'Failures! Weaklings!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15742,1,0,0,'Thorim SAY_WIPE'), +(33413,-1603280,'Stay your arms! I yield!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15743,1,0,0,'Thorim SAY_DEATH'), +(33413,-1603281,'I feel as though I am awakening from a nightmare, but the shadows in this place yet linger.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15744,1,0,0,'Thorim SAY_END_NORMAL_1'), +(33413,-1603282,'Sif... was Sif here? Impossible--she died by my brother''s hand. A dark nightmare indeed....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15745,1,0,0,'Thorim SAY_END_NORMAL_2'), +(33413,-1603283,'I need time to reflect.... I will aid your cause if you should require it. I owe you at least that much. Farewell.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15746,1,0,0,'Thorim SAY_END_NORMAL_3'), +(33413,-1603284,'You! Fiend! You are not my beloved! Be gone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15747,1,0,0,'Thorim SAY_END_HARD_1'), +(33413,-1603285,'Behold the hand behind all the evil that has befallen Ulduar! Left my kingdom in ruins, corrupted my brother and slain my wife!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15748,1,0,0,'Thorim SAY_END_HARD_2'), +(33413,-1603286,'And now it falls to you, champions, to avenge us all! The task before you is great, but I will lend you my aid as I am able. You must prevail!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15749,1,0,0,'Thorim SAY_END_HARD_3'), +(33413,-1603287,'Golganneth, lend me your strengh! Grant my mortal allies the power of thunder!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15750,1,0,0,'Thorim SAY_YS_HELP'), + +-- General Vezax +(33271,-1603290,'Your destruction will herald a new age of suffering!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15542,1,0,0,'Vezax SAY_AGGRO'), +(33271,-1603291,'You thought to stand before the legions of death... and survive?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15543,1,0,0,'Vezax SAY_SLAY_1'), +(33271,-1603292,'Defiance... a flaw of mortality.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15544,1,0,0,'Vezax SAY_SLAY_2'), +(33271,-1603293,'The black blood of Yogg-Saron courses through me! I. AM. UNSTOPPABLE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15545,1,0,0,'Vezax SAY_SURGE_DARKNESS'), +(33271,-1603294,'Oh, what horrors await....',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15546,1,0,0,'Vezax SAY_DEATH'), +(33271,-1603295,'Your defeat was inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15547,1,0,0,'Vezax SAY_BERSERK'), +(33271,-1603296,'Behold, now! Terror, absolute!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15548,1,0,0,'Vezax SAY_HARDMODE_ON'), + +-- XT002 +(33293,-1603300,'New toys? For me? I promise I won''t break them this time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15724,1,0,0,'XT002 SAY_AGGRO'), +(33293,-1603301,'So tired. I will rest for just a moment!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15725,1,0,0,'XT002 SAY_HEART_OPENED'), +(33293,-1603302,'I''m ready to play!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15726,1,0,0,'XT002 SAY_HEART_CLOSED'), +(33293,-1603303,'NO! NO! NO! NO! NO!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15727,1,0,0,'XT002 SAY_TYMPANIC_TANTRUM'), +(33293,-1603304,'I... I think I broke it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15728,1,0,0,'XT002 SAY_SLAY_1'), +(33293,-1603305,'I guess it doesn''t bend that way.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15729,1,0,0,'XT002 SAY_SLAY_2'), +(33293,-1603306,'I''m tired of these toys. I don''t want to play anymore!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15730,1,0,0,'XT002 SAY_BERSERK'), +(33293,-1603307,'You are bad... Toys... Very... Baaaaad!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15731,1,0,0,'XT002 SAY_DEATH'), +(33293,-1603308,'Time for a new game! My old toys will fight my new toys!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15732,1,0,0,'XT002 SAY_SUMMON'), + +-- Sara (YS) +(33134,-1603310,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15771,1,0,0,'Sara SAY_PREFIGHT_1'), +(33134,-1603311,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15772,1,0,0,'Sara SAY_PREFIGHT_2'), +(33134,-1603312,'The time to strike at the head of the beast will soon be upon us! Focus your anger and hatred on his minions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15775,1,0,0,'Sara SAY_AGGRO_1'), +(33134,-1603313,'Yes! YES! Show them no mercy! Give no pause to your attacks!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15773,1,0,0,'Sara SAY_AGGRO_2'), +(33134,-1603314,'Let hatred and rage guide your blows!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15774,1,0,0,'Sara SAY_AGGRO_3'), +(33134,-1603315,'Powerless to act...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15778,1,0,0,'Sara SAY_SLAY_1'), +(33134,-1603316,'Could they have been saved?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15779,1,0,0,'Sara SAY_SLAY_2'), +(33134,-1603317,'Weak-minded fools!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15780,5,0,0,'Sara WHISP_INSANITY'), +(33134,-1603318,'Suffocate upon your own hate!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15776,1,0,0,'Sara SAY_PHASE2_1'), +(33134,-1603319,'Tremble, mortals, before the coming of the end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15777,1,0,0,'Sara SAY_PHASE2_2'), + +-- YoggSaron +(33288,-1603330,'I am the lucid dream.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15754,1,0,0,'YoggSaron SAY_PHASE2_1'), -- sound 15754 contains the 5 texts +(33288,-1603331,'The monster in your nightmares.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_2'), +(33288,-1603332,'The fiend of a thousand faces.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_3'), +(33288,-1603333,'Cower before my true form.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_4'), +(33288,-1603334,'BOW DOWN BEFORE THE GOD OF DEATH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'YoggSaron SAY_PHASE2_5'), +(33288,-1603335,'Look upon the true face of death and know that your end comes soon!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15755,1,0,0,'YoggSaron SAY_PHASE3'), +(33288,-1603336,'MADNESS WILL CONSUME YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15756,1,0,0,'YoggSaron SAY_VISION'), +(33288,-1603337,'Hoohehehahahaha... AHAHAHAHAHAHA!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15757,1,0,0,'YoggSaron SAY_SLAY_1'), +(33288,-1603338,'Eternal suffering awaits!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15758,1,0,0,'YoggSaron SAY_SLAY_2'), +(33288,-1603339,'Your will is no longer you own...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15759,5,0,0,'YoggSaron WHISP_INSANITY_1'), +(33288,-1603340,'Destroy them minion, your master commands it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15760,5,0,0,'YoggSaron WHISP_INSANITY_2'), +(33288,-1603341,'Your fate is sealed. The end of days is finally upon you and ALL who inhabit this miserable little seedling. Uulwi ifis halahs gag erh''ongg w''ssh.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15761,1,0,0,'YoggSaron SAY_DEATH'); diff --git a/sql/updates/3.3.2_old/7655_world_scriptname.sql b/sql/updates/3.3.2_old/7655_world_scriptname.sql new file mode 100644 index 0000000..12bb45c --- /dev/null +++ b/sql/updates/3.3.2_old/7655_world_scriptname.sql @@ -0,0 +1,6 @@ +UPDATE `creature_template` SET `ScriptName`='mob_xt002_heart' WHERE `entry`=33329; +UPDATE `creature_template` SET `ScriptName`='mob_scrapbot' WHERE `entry`=33343; +UPDATE `creature_template` SET `ScriptName`='mob_pummeller' WHERE `entry`=33344; +UPDATE `creature_template` SET `ScriptName`='mob_boombot' WHERE `entry`=33346; +UPDATE `creature_template` SET `ScriptName`='mob_void_zone' WHERE `entry`=34001; +UPDATE `creature_template` SET `ScriptName`='mob_life_spark' WHERE `entry`=34004; diff --git a/sql/updates/3.3.2_old/7656_world_instance_template.sql b/sql/updates/3.3.2_old/7656_world_instance_template.sql new file mode 100644 index 0000000..54d50b0 --- /dev/null +++ b/sql/updates/3.3.2_old/7656_world_instance_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `instance_template` ADD COLUMN `allowMount` tinyint(1) NOT NULL DEFAULT '0'; + diff --git a/sql/updates/3.3.2_old/7658_world_scriptname.sql b/sql/updates/3.3.2_old/7658_world_scriptname.sql new file mode 100644 index 0000000..69bace7 --- /dev/null +++ b/sql/updates/3.3.2_old/7658_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_twilight_fissure' WHERE `entry`=30641; +UPDATE `creature_template` SET `ScriptName`='npc_flame_tsunami' WHERE `entry`=30616; diff --git a/sql/updates/3.3.2_old/7660_world_creature_template.sql b/sql/updates/3.3.2_old/7660_world_creature_template.sql new file mode 100644 index 0000000..e987add --- /dev/null +++ b/sql/updates/3.3.2_old/7660_world_creature_template.sql @@ -0,0 +1,3 @@ +ALTER TABLE creature_template ADD COLUMN speed_run float NOT NULL default '1.14286' COMMENT 'Result of 8.0/7.0, most common value' AFTER speed; +UPDATE creature_template SET speed=1 WHERE speed IS NULL; +ALTER TABLE creature_template CHANGE COLUMN speed speed_walk FLOAT NOT NULL DEFAULT '1' COMMENT 'Result of 2.5/2.5, most common value'; diff --git a/sql/updates/3.3.2_old/7665_world_scriptname.sql b/sql/updates/3.3.2_old/7665_world_scriptname.sql new file mode 100644 index 0000000..d049751 --- /dev/null +++ b/sql/updates/3.3.2_old/7665_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_unstable_sphere' WHERE `entry`=28166; diff --git a/sql/updates/3.3.2_old/7666_world_script_texts.sql b/sql/updates/3.3.2_old/7666_world_script_texts.sql new file mode 100644 index 0000000..ec6a760 --- /dev/null +++ b/sql/updates/3.3.2_old/7666_world_script_texts.sql @@ -0,0 +1,3 @@ +DELETE FROM `script_texts` WHERE `entry`=-1603187; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(32906,-1603187,'Children, assist me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,15533,1,0,0,'Freya SAY_SUMMON_TRIO'); diff --git a/sql/updates/3.3.2_old/7668_world_scriptname.sql b/sql/updates/3.3.2_old/7668_world_scriptname.sql new file mode 100644 index 0000000..0dd91ff --- /dev/null +++ b/sql/updates/3.3.2_old/7668_world_scriptname.sql @@ -0,0 +1,6 @@ +UPDATE `creature_template` SET `ScriptName`='boss_koralon' WHERE `entry`=35013; +UPDATE `creature_template` SET `ScriptName`='mob_flame_warder' WHERE `entry`=35143; +UPDATE `creature_template` SET `ScriptName`='boss_toravon' WHERE `entry`=38433; +UPDATE `creature_template` SET `ScriptName`='mob_frost_warder' WHERE `entry`=38482; +UPDATE `creature_template` SET `ScriptName`='mob_frozen_orb_stalker' WHERE `entry`=38461; +UPDATE `creature_template` SET `ScriptName`='mob_frozen_orb' WHERE `entry`=38456; diff --git a/sql/updates/3.3.2_old/7672_world_scriptname.sql b/sql/updates/3.3.2_old/7672_world_scriptname.sql new file mode 100644 index 0000000..b9451e7 --- /dev/null +++ b/sql/updates/3.3.2_old/7672_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_ruins_dweller' WHERE `entry`=29920; diff --git a/sql/updates/3.3.2_old/7677_realmd_realmlist.sql b/sql/updates/3.3.2_old/7677_realmd_realmlist.sql new file mode 100644 index 0000000..cddab25 --- /dev/null +++ b/sql/updates/3.3.2_old/7677_realmd_realmlist.sql @@ -0,0 +1 @@ +ALTER TABLE `realmlist` CHANGE COLUMN `gamebuild` `gamebuild` int(11) unsigned NOT NULL default '11403'; diff --git a/sql/updates/3.3.2_old/7680_world_quest_template.sql b/sql/updates/3.3.2_old/7680_world_quest_template.sql new file mode 100644 index 0000000..296f2d5 --- /dev/null +++ b/sql/updates/3.3.2_old/7680_world_quest_template.sql @@ -0,0 +1 @@ +ALTER TABLE `quest_template` ADD COLUMN `MaxLevel` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `MinLevel`; diff --git a/sql/updates/3.3.2_old/7691_world_creature_template.sql b/sql/updates/3.3.2_old/7691_world_creature_template.sql new file mode 100644 index 0000000..9487f5f --- /dev/null +++ b/sql/updates/3.3.2_old/7691_world_creature_template.sql @@ -0,0 +1,2 @@ +-- Spells for Wintergarde Gryphon +UPDATE `creature_template` SET `spell1`=48363,`spell2`=48397,`spell3`=54170 WHERE `entry`=27258; diff --git a/sql/updates/3.3.2_old/7691_world_spell_dbc.sql b/sql/updates/3.3.2_old/7691_world_spell_dbc.sql new file mode 100644 index 0000000..79b55b7 --- /dev/null +++ b/sql/updates/3.3.2_old/7691_world_spell_dbc.sql @@ -0,0 +1,10 @@ +-- Add serverside spells place holders for future development +DELETE FROM `spell_dbc` WHERE `Id` IN (42876,44987,48803,68496,72958,32780,45453); +INSERT INTO `spell_dbc` (`Id`,`Comment`) VALUES +(42876, 'Quest 9275 reward serverside spell'), +(44987, 'Quest 11521 reward serverside spell'), +(48803, 'Quest 12214 reward serverside spell'), +(68496, 'Item_template serverside spell'), +(72958, 'Item_template serverside spell'), +(32780, 'Quest 10040 reward serverside spell'), +(45453, 'Quest 11587 reward serverside spell'); diff --git a/sql/updates/3.3.2_old/7694_world_creature_template.sql b/sql/updates/3.3.2_old/7694_world_creature_template.sql new file mode 100644 index 0000000..a094f2c --- /dev/null +++ b/sql/updates/3.3.2_old/7694_world_creature_template.sql @@ -0,0 +1 @@ +ALTER TABLE `creature_template` CHANGE COLUMN `WDBVerified` `WDBVerified` smallint(5) signed DEFAULT '1'; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7694_world_gameobject_template.sql b/sql/updates/3.3.2_old/7694_world_gameobject_template.sql new file mode 100644 index 0000000..8e9e5cb --- /dev/null +++ b/sql/updates/3.3.2_old/7694_world_gameobject_template.sql @@ -0,0 +1 @@ +ALTER TABLE `gameobject_template` CHANGE COLUMN `WDBVerified` `WDBVerified` smallint(5) signed DEFAULT '1'; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7694_world_item_template.sql b/sql/updates/3.3.2_old/7694_world_item_template.sql new file mode 100644 index 0000000..cab268a --- /dev/null +++ b/sql/updates/3.3.2_old/7694_world_item_template.sql @@ -0,0 +1 @@ +ALTER TABLE `item_template` CHANGE COLUMN `WDBVerified` `WDBVerified` smallint(5) signed DEFAULT '1'; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7694_world_npc_text.sql b/sql/updates/3.3.2_old/7694_world_npc_text.sql new file mode 100644 index 0000000..adcb38b --- /dev/null +++ b/sql/updates/3.3.2_old/7694_world_npc_text.sql @@ -0,0 +1 @@ +ALTER TABLE `npc_text` CHANGE COLUMN `WDBVerified` `WDBVerified` smallint(5) signed DEFAULT '1'; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7694_world_page_text.sql b/sql/updates/3.3.2_old/7694_world_page_text.sql new file mode 100644 index 0000000..ccbe669 --- /dev/null +++ b/sql/updates/3.3.2_old/7694_world_page_text.sql @@ -0,0 +1 @@ +ALTER TABLE `page_text` CHANGE COLUMN `WDBVerified` `WDBVerified` smallint(5) signed DEFAULT '1'; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7694_world_quest_template.sql b/sql/updates/3.3.2_old/7694_world_quest_template.sql new file mode 100644 index 0000000..1c0cb7d --- /dev/null +++ b/sql/updates/3.3.2_old/7694_world_quest_template.sql @@ -0,0 +1 @@ +ALTER TABLE `quest_template` CHANGE COLUMN `WDBVerified` `WDBVerified` smallint(5) signed DEFAULT '1'; \ No newline at end of file diff --git a/sql/updates/3.3.2_old/7697_world_npc_trainer.sql b/sql/updates/3.3.2_old/7697_world_npc_trainer.sql new file mode 100644 index 0000000..0e79b01 --- /dev/null +++ b/sql/updates/3.3.2_old/7697_world_npc_trainer.sql @@ -0,0 +1,2 @@ +ALTER TABLE `npc_trainer` MODIFY COLUMN `spell` MEDIUMINT(8) NOT NULL DEFAULT 0; + diff --git a/sql/updates/3.3.2_old/7697_world_npc_vendor.sql b/sql/updates/3.3.2_old/7697_world_npc_vendor.sql new file mode 100644 index 0000000..e2fcff7 --- /dev/null +++ b/sql/updates/3.3.2_old/7697_world_npc_vendor.sql @@ -0,0 +1,2 @@ +ALTER TABLE `npc_vendor` MODIFY COLUMN `item` MEDIUMINT(8) NOT NULL DEFAULT 0; + diff --git a/sql/updates/3.3.2_old/7701_world_spell_dbc.sql b/sql/updates/3.3.2_old/7701_world_spell_dbc.sql new file mode 100644 index 0000000..e5bcc19 --- /dev/null +++ b/sql/updates/3.3.2_old/7701_world_spell_dbc.sql @@ -0,0 +1 @@ +UPDATE `spell_dbc` SET `DurationIndex` = 4, `EffectImplicitTargetA1` = 25 WHERE `Id` = 61988; diff --git a/sql/updates/3.3.2_old/7705_characters_worldstates.sql b/sql/updates/3.3.2_old/7705_characters_worldstates.sql new file mode 100644 index 0000000..39e731b --- /dev/null +++ b/sql/updates/3.3.2_old/7705_characters_worldstates.sql @@ -0,0 +1,9 @@ +ALTER TABLE `saved_variables` CHANGE `NextArenaPointDistributionTime` `value` bigint(40) UNSIGNED NOT NULL DEFAULT '0', +ADD COLUMN `entry` mediumint(11) UNSIGNED NOT NULL DEFAULT '0' FIRST, +ADD COLUMN `comment` text NOT NULL, +ADD PRIMARY KEY (`entry`), +RENAME `worldstates`, +ROW_FORMAT=DYNAMIC; + +-- Only posible value is NextArenaPointDistributionTime so make the conversion to custom worldstate +UPDATE `worldstates` SET `entry`=20001, `comment`='NextArenaPointDistributionTime'; diff --git a/sql/updates/3.3.2_old/7707_world_spell_dbc.sql b/sql/updates/3.3.2_old/7707_world_spell_dbc.sql new file mode 100644 index 0000000..215d757 --- /dev/null +++ b/sql/updates/3.3.2_old/7707_world_spell_dbc.sql @@ -0,0 +1 @@ +UPDATE `spell_dbc` SET `DurationIndex` = 25 WHERE `Id` = 61988; diff --git a/sql/updates/3.3.2_old/7721_world_script_texts.sql b/sql/updates/3.3.2_old/7721_world_script_texts.sql new file mode 100644 index 0000000..5b349bb --- /dev/null +++ b/sql/updates/3.3.2_old/7721_world_script_texts.sql @@ -0,0 +1,129 @@ +DELETE FROM `script_texts` WHERE `entry` <= -1595000 and `entry` >= -1595999; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +-- Chrono Lord Epoch +(26532,-1595000,'Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13408,1,0,0,'epoch SAY_INTRO | culling SAY_PHASE314'), +(26532,-1595001,'We''ll see about that, young prince.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13409,1,0,0,'epoch SAY_AGGRO'), +(26532,-1595002,'Tick tock, tick tock...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13410,1,0,0,'epoch SAY_TIME_WARP_1'), +(26532,-1595003,'Not quick enough!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13411,1,0,0,'epoch SAY_TIME_WARP_2'), +(26532,-1595004,'Let''s get this over with. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13412,1,0,0,'epoch SAY_TIME_WARP_3'), +(26532,-1595005,'There is no future for you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13413,1,0,0,'epoch SAY_SLAY_1'), +(26532,-1595006,'This is the hour of our greatest triumph!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13414,1,0,0,'epoch SAY_SLAY_2'), +(26532,-1595007,'You were destined to fail.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13415,1,0,0,'epoch SAY_SLAY_3'), +(26532,-1595008,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13416,0,0,0,'epoch SAY_DEATH'), +-- Mal'Ganis +(26533,-1595009,'Yes, this is the beginning. I''ve been waiting for you, young prince. I am Mal''Ganis.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14410,0,0,1,'mal_ganis SAY_INTRO_1 | culling SAY_PHASE206'), +(26533,-1595010,'As you can see, your people are now mine. I will now turn this city household by household, until the flame of life has been snuffed out... forever.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14411,0,0,1,'mal_ganis SAY_INTRO_2 | culling SAY_PHASE207'), +(26533,-1595011,'This will be a fine test...Prince Arthas...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14413,1,0,0,'mal_ganis SAY_AGGRO'), +(26533,-1595012,'All too easy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14416,1,0,0,'mal_ganis SAY_KILL_1'), +(26533,-1595013,'The dark lord is displeased with your interference...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14417,1,0,0,'mal_ganis SAY_KILL_2'), +(26533,-1595014,'It is Prince Arthas I want... not you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14418,1,0,0,'mal_ganis SAY_KILL_3'), +(26533,-1595015,'Anak''Keri...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14422,1,0,0,'mal_ganis SAY_SLAY_1'), +(26533,-1595016,'My onslaught will wash over the Lich King''s forces...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14423,1,0,0,'mal_ganis SAY_SLAY_2'), +(26533,-1595017,'Your death is in vain, tiny mortal...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14424,1,0,0,'mal_ganis SAY_SLAY_3'), +(26533,-1595018,'Your time has come to an end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14425,1,0,0,'mal_ganis SAY_SLAY_4'), +(26533,-1595019,'Time out...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14414,1,0,0,'mal_ganis SAY_SLEEP_1'), +(26533,-1595020,'You seem...tired...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14415,1,0,0,'mal_ganis SAY_SLEEP_2'), +(26533,-1595021,'I spent too much time in that weak little shell...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14426,1,0,0,'mal_ganis SAY_30HEALTH'), +(26533,-1595022,'(Eredun) I AM MAL''GANIS! I AM ETERNAL!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14427,1,0,0,'mal_ganis SAY_15HEALTH'), +(26533,-1595023,'ENOUGH! I waste my time here...I must gather my strength on the home world...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14428,1,0,0,'mal_ganis SAY_ESCAPE_SPEECH_1'), +(26533,-1595024,'You''ll never defeat the Lich King without my forces! I''ll have my revenge...on him, AND you...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14429,1,0,0,'mal_ganis SAY_ESCAPE_SPEECH_2'), +(26533,-1595025,'Your journey has just begun, young prince. Gather your forces and meet me in the artic land of Northrend. It is there that we shall settle the score between us. It is there that your true destiny will unfold.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14412,1,0,1,'mal_ganis SAY_OUTRO'), +-- Meathook +(26529,-1595026,'Play time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13428,1,0,0,'meathook SAY_AGGRO'), +(26529,-1595027,'Boring...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13430,1,0,0,'meathook SAY_SLAY_1'), +(26529,-1595028,'Why you stop moving?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13431,1,0,0,'meathook SAY_SLAY_2'), +(26529,-1595029,'Get up! Me not done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13432,1,0,0,'meathook SAY_SLAY_3'), +(26529,-1595030,'New toys!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13429,1,0,0,'meathook SAY_SPAWN'), +(26529,-1595031,'This... not fun...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13433,1,0,0,'meathook SAY_DEATH'), +-- Salramm the Fleshcrafter +(26530,-1595032,'Ah, the entertainment has arrived!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13472,1,0,0,'salramm SAY_AGGRO'), +(26530,-1595033,'You are too late, champion of Lordaeron. The dead shall have their day.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13471,1,0,0,'salramm SAY_SPAWN'), +(26530,-1595034,'The fun is just beginning!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13473,1,0,0,'salramm SAY_SLAY_1'), +(26530,-1595035,'Aah, quality materials!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13474,1,0,0,'salramm SAY_SLAY_2'), +(26530,-1595036,'Don''t worry, I''ll make good use of you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13475,1,0,0,'salramm SAY_SLAY_3'), +(26530,-1595037,'You only advance... the master''s plan...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13483,1,0,0,'salramm SAY_DEATH'), +(26530,-1595038,'BOOM! Hahahahah...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13478,1,0,0,'salramm SAY_EXPLODE_GHOUL_1'), +(26530,-1595039,'Blood... destruction... EXHILARATING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13479,1,0,0,'salramm SAY_EXPLODE_GHOUL_2'), +(26530,-1595040,'I want a sample...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13480,1,0,0,'salramm SAY_STEAL_FLESH_1'), +(26530,-1595041,'Such strength... it must be mine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13481,1,0,0,'salramm SAY_STEAL_FLESH_2'), +(26530,-1595042,'Your flesh betrays you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13482,1,0,0,'salramm SAY_STEAL_FLESH_3'), +(26530,-1595043,'Say hello to some friends of mine.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13476,1,0,0,'salramm SAY_SUMMON_GHOULS_1'), +(26530,-1595044,'Come, citizen of Stratholme! Meet your saviors.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13477,1,0,0,'salramm SAY_SUMMON_GHOULS_2'), +-- The Infinite Corruptor +-- Couldn't find the value from the audios for `sound` column, not added. +(32273,-1595045,'How dare you interfere with our work here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'infinite SAY_AGGRO'), +(32273,-1595046,'My work here is finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'infinite SAY_FAIL'), +(32273,-1595047,'My time... has run out...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'infinite SAY_DEATH'), +-- First Act - Uther and Jaina Dialog +-- Outside the city, Arthas, Uther and Jaina dialog +(26499,-1595070,'Glad you could make it, Uther.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12828,0,0,1,'culling SAY_PHASE101'), +(26528,-1595071,'Watch your tone with me, boy. You may be the prince, but I''m still your superior as a paladin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12839,0,0,25,'culling SAY_PHASE102'), +(26499,-1595072,'As if I could forget. Listen, Uther, there''s something about the plague you should know... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12829,0,0,0,'culling SAY_PHASE103'), +(26499,-1595073,'Oh, no. We''re too late. These people have all been infected! They may look fine now, but it''s just a matter of time before they turn into the undead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12830,0,0,1,'culling SAY_PHASE104'), +(26528,-1595074,'What?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12840,0,0,5,'culling SAY_PHASE105'), +(26499,-1595075,'This entire city must be purged.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12831,0,0,1,'culling SAY_PHASE106'), +(26528,-1595076,'How can you even consider that? There''s got to be some other way.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12841,0,0,1,'culling SAY_PHASE107'), +(26499,-1595077,'Damn it, Uther! As your future king, I order you to purge this city!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12832,1,0,5,'culling SAY_PHASE108'), +(26528,-1595078,'You are not my king yet, boy! Nor would I obey that command even if you were!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12842,1,0,22,'culling SAY_PHASE109'), +(26499,-1595079,'Then I must consider this an act of treason.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12833,0,0,0,'culling SAY_PHASE110'), +(26528,-1595080,'Treason? Have you lost your mind, Arthas?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12843,0,0,5,'culling SAY_PHASE111'), +(26499,-1595081,'Have I? Lord Uther, by my right of succession and the sovereignty of my crown, I hereby relieve you of your command and suspend your paladins from service.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12834,0,0,1,'culling SAY_PHASE112'), +(26497,-1595082,'Arthas! You can''t just--',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12837,0,0,1,'culling SAY_PHASE113'), +(26499,-1595083,'It''s done! Those of you who have the will to save this land, follow me! The rest of you... get out of my sight!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12835,0,0,0,'culling SAY_PHASE114'), +(26528,-1595084,'You''ve just crossed a terrible threshold, Arthas.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12844,0,0,25,'culling SAY_PHASE115'), +(26499,-1595085,'Jaina?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12836,0,0,1,'culling SAY_PHASE116'), +(26497,-1595086,'I''m sorry, Arthas. I can''t watch you do this.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,12838,0,0,1,'culling SAY_PHASE117'), +(26499,-1595087,'Take position here, and I will lead a small force inside Stratholme to begin the culling. We must contain and purge the infected for the sake of all Lordaeron!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14327,0,0,1,'culling SAY_PHASE118'), +-- Second Act - City Streets +-- Arthas enters the city and dialog with Mal'Ganis +-- After defeating 2 bosses he runs to Town Hall +(26499,-1595088,'Everyone looks ready. Remember, these people are all infected with the plague and will die soon. We must purge Stratholme to protect the remainder of Lordaeron from the Scourge. Let''s go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14293,0,0,1,'culling SAY_PHASE201'), +(0,-1595089,'Prince Arthas, may the light be praised! Many people in the town have begun to fall seriously ill, can you help us?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'culling SAY_PHASE202'), +(26499,-1595090,'I can only help you with a clean death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14294,0,0,0,'culling SAY_PHASE203'), +(0,-1595091,'What? This can''t be!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'culling SAY_PHASE204'), +(26499,-1595092,'That was just the beginning.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14295,0,0,1,'culling SAY_PHASE205'), +(26499,-1595093,'I won''t allow it, Mal''Ganis! Better that these people die by my hand than serve as your slaves in death!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14296,0,0,5,'culling SAY_PHASE208'), +(26499,-1595094,'Mal''ganis will send out some of his Scourge minions to interfere with us. Those of you with the strongest steel and magic shall go forth and destroy them. I will lead the rest of my forces in purging Stratholme of the infected.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14885,0,0,1,'culling SAY_PHASE209'), +(26499,-1595095,'Champions, meet me at town hall at once! We must take the fight to Mal''Ganis.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14297,0,0,1,'culling SAY_PHASE210'), +-- Third Act - Town Hall +(26499,-1595096,'Follow me. I know the way trought.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14298,0,0,1,'culling SAY_PHASE301'), +(0,-1595097,'Ah, you''ve finally arrived Prince Arthas. You''re just in the nick of time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,1,'culling SAY_PHASE302'), +(26499,-1595098,'Yes, I''m glad i could get you before the plague.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14299,0,0,1,'culling SAY_PHASE303'), +(26499,-1595099,'What is this sorcery?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14300,0,0,0,'culling SAY_PHASE304'), +(0,-1595100,'There''s no need for you to understand, Arthas. All you need to do is die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'culling SAY_PHASE305'), +(26499,-1595101,'Mal''Ganis appears to have more than scourge in his arsenal. We should make haste.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14301,0,0,0,'culling SAY_PHASE306'), +(26499,-1595102,'More vile sorcery! Be ready for anything.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14302,0,0,0,'culling SAY_PHASE307'), +(26499,-1595103,'Let''s move on.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14303,0,0,0,'culling SAY_PHASE308'), +(26499,-1595104,'Watch your backs... they have us surrounded in this hall.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14304,0,0,0,'culling SAY_PHASE309'), +(26499,-1595105,'One less obstacle to deal with.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'culling SAY_PHASE310'), +(26499,-1595106,'Mal''Ganis is not making this easy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14305,0,0,0,'culling SAY_PHASE311'), +(26499,-1595107,'They''re very persistent.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14306,0,0,0,'culling SAY_PHASE312'), +(26499,-1595108,'What else can be put in my way?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14307,0,0,0,'culling SAY_PHASE313'), +(26499,-1595109,'I do what i must for Lordaeron. And neither your words nor your actions will stop me.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14309,0,0,5,'culling SAY_PHASE315'), +-- Fourth Act - Fire Corridor +(26499,-1595110,'The quickest path to Mal''Ganis lays behind that bookshelf ahead.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14308,0,0,0,'culling SAY_PHASE401'), +(26499,-1595111,'This will only take a moment.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14310,0,0,0,'culling SAY_PHASE402'), +(26499,-1595112,'I believe that secret passage still works!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14311,0,0,0,'culling SAY_PHASE403'), +(26499,-1595113,'Let''s move trought here as quickly as possible. If the undead don''t kill us the fires might.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14312,0,0,0,'culling SAY_PHASE404'), +(26499,-1595114,'Rest a moment and clear your lungs. But we must move again soon.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14313,0,0,0,'culling SAY_PHASE405'), +(26499,-1595115,'That''s enough, we must move again. Mal''Ganis awaits.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14314,0,0,0,'culling SAY_PHASE406'), +(26499,-1595116,'At last some good luck, Market Row has not caught fire yet. Mal''Ganis is supposed to be on Crusader Square which is just ahead. Tell me when you''re ready to move forth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14315,0,0,0,'culling SAY_PHASE407'), +-- Fifth Act - Mal'Ganis Fight +(26499,-1595117,'Justice will be done!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14316,0,0,0,'culling SAY_PHASE501'), +(26499,-1595118,'We''re going to finish this right now Mal''Ganis... just you and me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14317,0,0,0,'culling SAY_PHASE502'), +(26499,-1595119,'I''ll hunt you to the ends of the earth if I have to! Do you hear me? To the ends of the earth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14318,1,0,5,'culling SAY_PHASE503'), +(26499,-1595120,'You performed well this day. Anything that Mal''Ganis has left behind is yours. Take it as your reward. I must now begin plans for an expedition to Northrend.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,14319,0,0,5,'culling SAY_PHASE504'); + +-- script_texts for boss_epoch_hunter have wrong comment (epoch instead of epoch_hunter) +-- This generates ambiguities with boss_epoch script_texts just introduced +-- The following queries eliminate script_texts comment conflict from boss_epoch and boss_epoch_hunter +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_ENTER1' WHERE `entry`=-1560013; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_ENTER2' WHERE `entry`=-1560014; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_ENTER3' WHERE `entry`=-1560015; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_AGGRO1' WHERE `entry`=-1560016; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_AGGRO2' WHERE `entry`=-1560017; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_SLAY1' WHERE `entry`=-1560018; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_SLAY2' WHERE `entry`=-1560019; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_BREATH1' WHERE `entry`=-1560020; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_BREATH2' WHERE `entry`=-1560021; +UPDATE `script_texts` SET `comment`= 'epoch_hunter SAY_DEATH' WHERE `entry`=-1560022; diff --git a/sql/updates/3.3.2_old/7721_world_script_waypoints.sql b/sql/updates/3.3.2_old/7721_world_script_waypoints.sql new file mode 100644 index 0000000..a8d99dc --- /dev/null +++ b/sql/updates/3.3.2_old/7721_world_script_waypoints.sql @@ -0,0 +1,60 @@ +-- script_waypoints for Arthas movements inside Culling +DELETE FROM `script_waypoint` WHERE `entry`=26499; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(26499,0,1903.167,1291.573,143.32,0, 'culling Bridge WP1'), +(26499,1,1911.087,1314.263,150.026,0, 'culling Bridge WP2'), +(26499,2,1902.959,1295.127,143.388,10000, 'culling Bridge WP3'), +(26499,3,1913.726,1287.407,141.927,0, 'culling Bridge WP4'), +(26499,4,1990.833,1293.391,145.467,0, 'culling Bridge WP5'), +(26499,5,1997.003,1317.776,142.963,0, 'culling Bridge WP6'), +(26499,6,2019.631,1326.084,142.929,0, 'culling Bridge WP7'), +(26499,7,2026.469,1287.088,143.596,0, 'culling Bridge WP8'), +(26499,8,2050.660,1287.333,142.671,0, 'culling Bridge WP9'), +(26499,9,2081.447,1287.770,141.324,0, 'culling Streets WP1'), +(26499,10,2087.689,1280.344,140.730,0, 'culling Streets WP2'), +(26499,11,2092.154,1276.645,140.520,0, 'culling Streets WP3'), +(26499,12,2099.876,1280.21,138.55,0, 'culling Streets WP4'), +(26499,13,2120.757,1286.97,136.343,0, 'culling Streets WP5'), +(26499,14,2165.073,1279.338,133.40,0, 'culling Streets WP6'), +(26499,15,2186.441,1234.445,136.524,0, 'culling Streets WP7'), +(26499,16,2210.385,1207.550,136.259,0, 'culling Streets WP8'), +(26499,17,2243.594,1177.705,137.144,0, 'culling Streets WP9'), +(26499,18,2286.883,1177.262,137.631,0, 'culling Streets WP10'), +(26499,19,2320.374,1179.954,133.926,0, 'culling Streets WP11'), +(26499,20,2365.626,1194.838,131.974,0, 'culling Streets WP12'), +(26499,21,2366.559,1197.759,132.382,0, 'culling House WP1'), +(26499,22,2394.011,1205.148,134.125,0, 'culling House WP2'), +(26499,23,2395.854,1206.345,134.039,0, 'culling House WP3'), +(26499,24,2442.023,1219.205,133.999,0, 'culling House WP3'), +(26499,25,2447.105,1191.182,148.076,0, 'culling House WP4'), +(26499,26,2444.250,1190.510,148.076,0, 'culling House WP5'), +(26499,27,2418.487,1196.059,148.076,0, 'culling House WP6'), +(26499,28,2401.221,1191.705,148.076,0, 'culling House WP7'), +(26499,29,2409.205,1157.425,148.190,0, 'culling House WP8'), +(26499,30,2417.584,1121.026,148.082,0, 'culling House WP9'), +(26499,31,2423.123,1119.431,148.076,0, 'culling House WP10'), +(26499,32,2447.833,1112.714,148.076,0, 'culling House WP11'), +(26499,33,2457.133,1120.941,150.008,0, 'culling House WP12'), +(26499,34,2459.694,1127.012,150.008,0, 'culling House WP13'), +(26499,35,2469.617,1122.274,150.008,0, 'culling House WP14'), +(26499,36,2470.437,1122.794,150.008,3000, 'culling House WP15'), +(26499,37,2471.662,1123.077,150.035,3000, 'culling House WP16'), +(26499,38,2483.183,1125.042,149.905,0, 'culling Secret WP1'), +(26499,39,2487.867,1099.760,144.858,0, 'culling Secret WP2'), +(26499,40,2498.270,1101.929,144.599,0, 'culling Secret WP3'), +(26499,41,2492.114,1128.238,139.967,0, 'culling Secret WP4'), +(26499,42,2500.286,1130.183,139.982,0, 'culling Room WP1'), +(26499,43,2503.010,1119.241,139.978,0, 'culling Room WP2'), +(26499,44,2517.820,1122.645,132.066,0, 'culling Room WP3'), +(26499,45,2540.479,1129.061,130.868,7000, 'culling Fire Street WP1'), +(26499,46,2568.619,1157.794,126.906,0, 'culling Fire Street WP2'), +(26499,47,2556.074,1222.058,125.412,20000, 'culling Fire Street WP3'), +(26499,48,2521.531,1295.209,130.573,0, 'culling Fire Street WP4'), +(26499,49,2504.362,1348.667,132.944,0, 'culling Fire Street WP5'), +(26499,50,2450.594,1431.544,131.361,0, 'culling Fire Street WP6'), +(26499,51,2353.485,1404.839,128.531,0, 'culling Market WP1'), +(26499,52,2329.882,1406.273,128.013,0, 'culling Market WP2'), +(26499,53,2329.882,1406.273,128.013,12000, 'culling Market WP3'), +(26499,54,2327.391,1412.475,127.692,0, 'culling Market WP4'), +(26499,55,2303.016,1480.070,128.139,0, 'culling Crusader WP1'), +(26499,56,2296.665,1502.362,128.362,0, 'culling Crusader WP2'); diff --git a/sql/updates/3.3.2_old/7721_world_scriptname.sql b/sql/updates/3.3.2_old/7721_world_scriptname.sql new file mode 100644 index 0000000..ec1f13c --- /dev/null +++ b/sql/updates/3.3.2_old/7721_world_scriptname.sql @@ -0,0 +1,7 @@ +UPDATE `instance_template` SET `script`='instance_culling_of_stratholme' WHERE `map`=595; +UPDATE `creature_template` SET `Scriptname`='npc_arthas' WHERE `entry`=26499; +UPDATE `creature_template` SET `Scriptname`='boss_salramm' WHERE `entry`=26530; +UPDATE `creature_template` SET `Scriptname`='boss_meathook' WHERE `entry`=26529; +UPDATE `creature_template` SET `Scriptname`='boss_epoch' WHERE `entry`=26532; +UPDATE `creature_template` SET `Scriptname`='boss_mal_ganis' WHERE `entry`=26533; +UPDATE `creature_template` SET `Scriptname`='boss_infinite_corruptor' WHERE `entry`=32273; diff --git a/sql/updates/3.3.2_old/7739_world_scriptname.sql b/sql/updates/3.3.2_old/7739_world_scriptname.sql new file mode 100644 index 0000000..4074664 --- /dev/null +++ b/sql/updates/3.3.2_old/7739_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_hira_snowdawn' WHERE `entry`=31238; diff --git a/sql/updates/3.3.2_old/7748_world_scriptname.sql b/sql/updates/3.3.2_old/7748_world_scriptname.sql new file mode 100644 index 0000000..55649c1 --- /dev/null +++ b/sql/updates/3.3.2_old/7748_world_scriptname.sql @@ -0,0 +1,10 @@ +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (5284,5285,5286,5287,4871,4872,4873,5108); +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES +(5284, 'at_aldurthar_gate'), +(5285, 'at_aldurthar_gate'), +(5286, 'at_aldurthar_gate'), +(5287, 'at_aldurthar_gate'), +(4871, 'at_warsong_farms'), +(4872, 'at_warsong_farms'), +(4873, 'at_warsong_farms'), +(5108, 'at_stormwright_shelf'); diff --git a/sql/updates/3.3.2_old/7751_world_script_texts.sql b/sql/updates/3.3.2_old/7751_world_script_texts.sql new file mode 100644 index 0000000..1b2ef44 --- /dev/null +++ b/sql/updates/3.3.2_old/7751_world_script_texts.sql @@ -0,0 +1,63 @@ +DELETE FROM `script_texts` WHERE `entry` <= -1658000 and `entry` >= -1658999; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +-- Garfrost +(36494,-1658001,'Tiny creatures under feet, you bring Garfrost something good to eat!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16912,1,0,0,'garfrost SAY_AGGRO'), +(36494,-1658002,'Will save for snack. For later.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16913,1,0,0,'garfrost SAY_SLAY_1'), +(36494,-1658003,'That one maybe not so good to eat now. Stupid Garfrost! BAD! BAD!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16914,1,0,0,'garfrost SAY_SLAY_2'), +(36494,-1658004,'Garfrost hope giant underpants clean. Save boss great shame. For later.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16915,1,0,0,'garfrost SAY_DEATH'), +(36494,-1658005,'Axe too weak. Garfrost make better and CRUSH YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16916,1,0,0,'garfrost SAY_PHASE2'), +(36494,-1658006,'Garfrost tired of puny mortals. Now your bones will freeze!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16917,1,0,0,'garfrost SAY_PHASE3'), +(36658,-1658007,'Another shall take his place. You waste your time.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16752,1,0,0,'Tyrannus SAY_TYRANNUS_DEATH'), + +-- Krick +(36477,-1658010,'Our work must not be interrupted! Ick! Take care of them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16926,1,0,0,'Krick SAY_AGGRO'), +(36477,-1658011,'Ooh...We could probably use these parts!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16927,1,0,0,'Krick SAY_SLAY_1'), +(36477,-1658012,'Arms and legs are in short supply...Thanks for your contribution!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16928,1,0,0,'Krick SAY_SLAY_2'), +(36477,-1658013,'Enough moving around! Hold still while I blow them all up!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16929,1,0,0,'Krick SAY_BARRAGE_1'), +(36477,-1658014,'Krick begins rapidly conjuring explosive mines!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Krick SAY_BARRAGE_2'), +(36477,-1658015,'Quickly! Poison them all while they''re still close!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16930,1,0,0,'Krick SAY_POISON_NOVA'), +(36477,-1658016,'No! That one! That one! Get that one!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16931,1,0,0,'Krick SAY_CHASE_1'), +(36477,-1658017,'I''ve changed my mind...go get that one instead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16932,1,0,0,'Krick SAY_CHASE_2'), +(36477,-1658018,'What are you attacking him for? The dangerous one is over there,fool!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16933,1,0,0,'Krick SAY_CHASE_3'), + +-- Ick +(36476,-1658020,'Ick begins to unleash a toxic poison cloud!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Ick SAY_ICK_POISON_NOVA'), +(36476,-1658021,'Ick is chasing you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Ick SAY_ICK_CHASE_1'), + +-- Krick OUTRO +(36477,-1658030,'Wait! Stop! Don''t kill me, please! I''ll tell you everything!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16934,1,0,0,'Krick SAY_KRICK_OUTRO_1'), +(36993,-1658031,'I''m not so naive as to believe your appeal for clemency, but I will listen.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16611,1,0,0,'Jaina SAY_JAINA_OUTRO_2'), +(36990,-1658032,'Why should the Banshee Queen spare your miserable life?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17033,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_2'), +(36477,-1658033,'What you seek is in the master''s lair, but you must destroy Tyrannus to gain entry. Within the Halls of Reflection you will find Frostmourne. It... it holds the truth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16935,1,0,0,'Krick SAY_KRICK_OUTRO_3'), +(36993,-1658034,'Frostmourne lies unguarded? Impossible!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16612,1,0,0,'Jaina SAY_JAINA_OUTRO_4'), +(36990,-1658035,'Frostmourne? The Lich King is never without his blade! If you are lying to me...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17034,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_4'), +(36477,-1658036,'I swear it is true! Please, don''t kill me!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16936,1,0,0,'Krick SAY_KRICK_OUTRO_5'), +(36658,-1658037,'Worthless gnat! Death is all that awaits you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16753,1,0,0,'Tyrannus SAY_TYRANNUS_OUTRO_7'), +(36477,-1658038,'Urg... no!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16937,1,0,0,'Krick SAY_KRICK_OUTRO_8'), +(36658,-1658039,'Do not think that I shall permit you entry into my master''s sanctum so easily. Pursue me if you dare.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16754,1,0,0,'Tyrannus SAY_TYRANNUS_OUTRO_9'), +(36993,-1658040,'What a cruel end. Come, heroes. We must see if the gnome''s story is true. If we can separate Arthas from Frostmourne, we might have a chance at stopping him.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16613,1,0,0,'Jaina SAY_JAINA_OUTRO_10'), +(36990,-1658041,'A fitting end for a traitor. Come, we must free the slaves and see what is within the Lich King''s chamber for ourselves.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17035,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_10'), + +-- Tyrannus +(36658,-1658050,'Your pursuit shall be in vain, adventurers, for the Lich King has placed an army of undead at my command! Behold!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16755,1,0,0,'Tyrannus SAY_AMBUSH_1'), +(36658,-1658051,'Persistent whelps! You will not reach the entrance of my lord''s lair! Soldiers, destroy them!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16756,1,0,0,'Tyrannus SAY_AMBUSH_2'), +(36658,-1658052,'Rimefang! Trap them within the tunnel! Bury them alive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16757,1,0,0,'Tyrannus SAY_GAUNTLET_START'), +(36658,-1658053,'Alas, brave, brave adventurers, your meddling has reached its end. Do you hear the clatter of bone and steel coming up the tunnel behind you? That is the sound of your impending demise.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16758,1,0,0,'Tyrannus SAY_INTRO_1'), +(36658,-1658054,'Ha, such an amusing gesture from the rabble. When I have finished with you, my master''s blade will feast upon your souls. Die!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16759,1,0,0,'Tyrannus SAY_INTRO_2'), + +(36658,-1658055,'I shall not fail The Lich King! Come and meet your end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16760,1,0,0,'Tyrannus SAY_AGGRO'), +(36658,-1658056,'Such a shameful display... You are better off dead!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16761,1,0,0,'Tyrannus SAY_SLAY_1'), +(36658,-1658057,'Perhaps you should have stayed in the mountains!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16762,1,0,0,'Tyrannus SAY_SLAY_2'), +(36658,-1658058,'Impossible! Rimefang... Warn...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16763,1,0,0,'Tyrannus SAY_DEATH'), +(36658,-1658059,'Rimefang, destroy this fool!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16764,1,0,0,'Tyrannus SAY_MARK_RIMEFANG_1'), +(36658,-1658060,'The frostwyrm Rimefang gazes at $N and readies an icy attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Tyrannus SAY_MARK_RIMEFANG_2'), +(36658,-1658061,'Power... overwhelming!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16765,1,0,0,'Tyrannus SAY_DARK_MIGHT_1'), +(36658,-1658062,'Scourgelord Tyrannus roars and swells with dark might!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Tyrannus SAY_DARK_MIGHT_2'), + +(37592,-1658063,'Brave champions, we owe you our lives, our freedom... Though it be a tiny gesture in the face of this enormous debt, I pledge that from this day forth, all will know of your deeds, and the blazing path of light you cut through the shadow of this dark citadel.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Gorkun SAY_GORKUN_OUTRO_1'), +(37592,-1658064,'This day will stand as a testament not only to your valor, but to the fact that no foe, not even the Lich King himself, can stand when Alliance and Horde set aside their differences and ---',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,'Gorkun SAY_GORKUN_OUTRO_2'), +(36993,-1658065,'Heroes, to me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16614,1,0,0,'Jaina SAY_JAYNA_OUTRO_3'), +(36990,-1658066,'Take cover behind me! Quickly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17037,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_3'), +(36993,-1658067,'The Frost Queen is gone. We must keep moving - our objective is near.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16615,0,0,0,'Jaina SAY_JAYNA_OUTRO_4'), +(36990,-1658068,'I thought he''d never shut up. At last, Sindragosa silenced that long-winded fool. To the Halls of Reflection, champions! Our objective is near... I can sense it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17036,0,0,0,'Sylvanas SAY_SYLVANAS_OUTRO_4'), +(36993,-1658069,'I... I could not save them... Damn you, Arthas! DAMN YOU!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16616,0,0,0,'Jaina SAY_JAYNA_OUTRO_5'); diff --git a/sql/updates/3.3.2_old/7751_world_scriptname.sql b/sql/updates/3.3.2_old/7751_world_scriptname.sql new file mode 100644 index 0000000..15d161c --- /dev/null +++ b/sql/updates/3.3.2_old/7751_world_scriptname.sql @@ -0,0 +1,23 @@ +UPDATE `instance_template` SET `script`='instance_pit_of_saron' WHERE `map`=658; +UPDATE `creature_template` SET `Scriptname`='boss_garfrost' WHERE `entry`=36494; +UPDATE `creature_template` SET `Scriptname`='boss_ick' WHERE `entry`=36476; +UPDATE `creature_template` SET `Scriptname`='boss_krick' WHERE `entry`=36477; +UPDATE `creature_template` SET `Scriptname`='boss_tyrannus' WHERE `entry`=36658; +UPDATE `creature_template` SET `Scriptname`='boss_rimefang' WHERE `entry`=36661; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_wrathbringer' WHERE `entry`=36840; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_skycaller' WHERE `entry`=31260; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_flamebearer' WHERE `entry`=36893; +UPDATE `creature_template` SET `Scriptname`='mob_ymirjar_deathbringer' WHERE `entry`=36892; +UPDATE `creature_template` SET `Scriptname`='mob_wrathbone_laborer' WHERE `entry`=36830; +UPDATE `creature_template` SET `Scriptname`='mob_wrathbone_coldwraith' WHERE `entry`=36842; +UPDATE `creature_template` SET `Scriptname`='mob_wrathbone_sorcerer' WHERE `entry`=37728; +UPDATE `creature_template` SET `Scriptname`='mob_stonespine_gargoyle' WHERE `entry`=36896; +UPDATE `creature_template` SET `Scriptname`='mob_plagueborn_horror' WHERE `entry`=36879; +UPDATE `creature_template` SET `Scriptname`='mob_iceborn_protodrake' WHERE `entry`=36891; +UPDATE `creature_template` SET `Scriptname`='mob_hungering_ghoul' WHERE `entry`=37711; +UPDATE `creature_template` SET `Scriptname`='mob_fallen_warrior' WHERE `entry`=38487; +UPDATE `creature_template` SET `Scriptname`='mob_fallen_warrior' WHERE `entry`=36841; +UPDATE `creature_template` SET `Scriptname`='mob_deathwhisper_torturer' WHERE `entry`=37713; +UPDATE `creature_template` SET `Scriptname`='mob_deathwhisper_shadowcaster' WHERE `entry`=37712; +UPDATE `creature_template` SET `Scriptname`='mob_deathwhisper_necrolyte' WHERE `entry`=36788; +UPDATE `creature_template` SET `Scriptname`='mob_geist_ambusher' WHERE `entry`=36886; diff --git a/sql/updates/3.3.2_old/7753_world_scriptname.sql b/sql/updates/3.3.2_old/7753_world_scriptname.sql new file mode 100644 index 0000000..e8d072f --- /dev/null +++ b/sql/updates/3.3.2_old/7753_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`= 'npc_valiance_keep_cannoneer' WHERE `entry`=25306; diff --git a/sql/updates/3.3.2_old/7760_world_spell_group.sql b/sql/updates/3.3.2_old/7760_world_spell_group.sql new file mode 100644 index 0000000..628c688 --- /dev/null +++ b/sql/updates/3.3.2_old/7760_world_spell_group.sql @@ -0,0 +1,203 @@ +DELETE FROM `spell_group` WHERE id > 1011 AND id < 1107; + +-- Minors +INSERT INTO `spell_group` (`id`,`spell_id`) VALUES +-- Armor Debuff (Major) +(1012,55749), -- Acid Spit +(1013,8647), -- Exposed Armor +(1014,7386), -- sunder Armor +-- Armor Debuff (Minor) +(1016,770), -- Faerie Fire +(1016,16857), -- Faerie Fire +(1017,56626), -- Sting +(1018,16231), -- Curse of Recklessness +-- Melee Haste Buff +(1020,55610), -- Improved Icy Talons +(1021,8515), -- windfury totem +-- Melee Critical Strike Chance Buff +(1023,17007), -- Leader of the Pack +(1024,29801), -- Rampage +-- Attack Power Buff (Multiplier) +(1026,53137), -- Abomination's Might +(1027,19506), -- Trueshot Aura +(1028,30802), -- Unleashed Rage +-- Bleed Damage Increase Debuff +(1030,33878), -- Mangle (Bear) +(1031,33876), -- Mangle (Cat) +(1032,46854), -- Trauma +-- Spell Critical Strike Chance Buff +(1034,24907), -- moonkng aura +(1035,51466), -- elemental oath +-- Spell Critical Strike Chance Debuff +(1037,11095), -- improved scorch +(1038,11180), -- Winter's Chill +-- Increased Spell Damage Taken Debuff +(1040,51099), -- Ebon Plaguebringer +(1041,48506), -- Earth and Moon +(1042,1490), -- Curse of the Elements +-- Increased Spell Power Buff +(1044,54646), -- Focus Magic +(1045,52109), -- Flametongue Totem +(1046,63283), -- Totem of Wrath +(1046,57658), -- Totem of Wrath +(1046,57660), -- Totem of Wrath +(1046,57662), -- Totem of Wrath +(1046,57663), -- Totem of Wrath +(1046,30708), -- Totem of Wrath +(1047,53646), -- Demonic Pact +-- Increased Spell Hit Chance Taken Debuff +(1049,33600), -- Improved Faerie Fire +(1050,33191), -- Misery +-- Percentage Haste Increase (All Types) +(1052,48384), -- Improved Moonkin Form +(1053,53379), -- Swift Retribution +-- Percentage Damage Increase +(1055,75593), -- Ferocious Inspiration +(1056,31869), -- Sanctified Retribution +-- Critical Strike Chance Taken Debuff (All types) +(1058,20335), -- Heart of the Crusader +-- totem of wrath 1046 CHECK IT! +-- Melee Attack Speed Slow Debuff +(1060,45477), -- Icy Touch +(1061,48483), -- Infected Wounds +(1062,53695), -- Judgements of the Just +(1063,6343), -- Thunder Clap +-- Melee Hit Chance Reduction Debuff +(1066,5570), -- Insect Swarm +(1067,3043), -- Scorpid Sting +-- Healing Debuff +(1070,13218), -- Wound Posion +(1071,19434), -- Aimed Shot +(1072,12294), -- Mortal Strike +(1073,46910), -- Furious Attacks +-- Attack Power Debuff +(1076,99), -- Demoralizing Roar +(1077,702), -- Curse of Weakness +(1078,1160), -- Demoralizing Shout +-- Agility and Strength Buff +(1080,8076), -- Strength of Earth +(1081,57330), -- Horn of Winter +-- Health Buff +(1083,469), -- Commanding Shout +(1084,6307), -- Blood Pact +-- Intellect Buff +(1086,1459), -- Arcane Intellect +(1104,23028), -- Arcane Brilliance +(1087,54424), -- Fel Intelligence +-- Spirit Buff +-- fel intelegencegoes here +(1105,14752), -- Divine Spirit +(1106,27681), -- Prayer of Spirit +-- Damage Reduction Percentage Buff +(1091,47930), -- Grace +(1092,20911), -- Blessing of Sanctuary +-- Percentage Increase Healing Received Buff +(1094,34123), -- tree of life aura +(1095,20138), -- Improved Devotion Aura +-- Armor Increase Percentage Buff +(1097,14892), -- Inspiration +(1098,16176), -- Ancestral Healing +-- Cast Speed Slow +(1100,1714), -- Curse of Tongues +(1101,31589), -- Slow +(1102,5760); -- Mind-numbing Poison + +-- Mothers +INSERT INTO `spell_group` (`id`,`spell_id`) VALUES +-- Armor Debuff (Major) +(1015,-1012), +(1015,-1013), +(1015,-1014), +-- Armor Debuff (Minor) +(1019,-1016), +(1019,-1017), +(1019,-1018), +-- Melee Haste Buff +(1022,-1020), +(1022,-1021), +-- Melee Critical Strike Chance Buff +(1025,-1023), +(1025,-1024), +-- Attack Power Buff (Multiplier) +(1029,-1026), +(1029,-1027), +(1029,-1028), +-- Bleed Damage Increase Debuff +(1033,-1030), +(1033,-1031), +(1033,-1032), +-- Spell Critical Strike Chance Buff +(1036,-1034), +(1036,-1035), +-- Spell Critical Strike Chance Debuff +(1039,-1037), +(1039,-1038), +-- Increased Spell Damage Taken Debuff +(1043,-1040), +(1043,-1041), +(1043,-1042), +-- Increased Spell Power Buff +(1048,-1044), +(1048,-1045), +(1048,-1046), +(1048,-1047), +-- Increased Spell Hit Chance Taken Debuff +(1051,-1049), +(1051,-1050), +-- Percentage Haste Increase (All Types) +(1054,-1052), +(1054,-1053), +-- Percentage Damage Increase +(1057,-1055), +(1057,-1056), +-- Critical Strike Chance Taken Debuff (All types) +(1059,-1058), +(1059,-1046), +-- Melee Attack Speed Slow Debuff +(1064,-1060), +(1064,-1061), +(1064,-1062), +(1064,-1063), +-- Melee Hit Chance Reduction Debuff +(1068,-1066), +(1068,-1067), +-- Healing Debuff +(1074,-1070), +(1074,-1071), +(1074,-1072), +(1074,-1073), +-- Attack Power Debuff +(1079,-1076), +(1079,-1077), +(1079,-1078), +-- Agility and Strength Buff +(1082,-1080), +(1082,-1081), +-- Health Buff +(1085,-1083), +(1085,-1084), +-- Intellect Buff +(1088,-1086), +(1088,-1104), +(1088,-1087), +-- Spirit Buff +(1090,-1087), +(1090,-1105), +(1090,-1106), +-- Damage Reduction Percentage Buff +(1093,-1091), +(1093,-1092), +-- Percentage Increase Healing Received Buff +(1096,-1094), +(1096,-1095), +-- Armor Increase Percentage Buff +(1099,-1097), +(1099,-1098), +-- Cast Speed Slow +(1103,-1100), +(1103,-1001), +(1103,-1002); + +-- corrections +DELETE FROM `spell_group` WHERE `id`=1011 AND `spell_id`=469; +INSERT INTO `spell_group` (`id`,`spell_id`) VALUES (1011,-1083); diff --git a/sql/updates/3.3.2_old/7760_world_spell_group_stack_rules.sql b/sql/updates/3.3.2_old/7760_world_spell_group_stack_rules.sql new file mode 100644 index 0000000..d5c3807 --- /dev/null +++ b/sql/updates/3.3.2_old/7760_world_spell_group_stack_rules.sql @@ -0,0 +1,29 @@ +DELETE FROM `spell_group_stack_rules` WHERE `group_id` IN (1015,1016,1019,1022,1025,1029,1033,1036,1043,1048,1051,1054,1057,1059,1064,1068,1074,1079,1082,1085,1088,1090,1093,1096,1099,1103,1046); +INSERT INTO `spell_group_stack_rules` (`group_id`,`stack_rule`) VALUES +(1015,1), +(1016,1), +(1019,1), +(1022,1), +(1025,1), +(1029,1), +(1033,1), +(1036,1), +(1043,1), +(1048,1), +(1051,1), +(1054,1), +(1057,1), +(1059,1), +(1064,1), +(1068,1), +(1074,1), +(1079,1), +(1082,1), +(1085,1), +(1088,1), +(1090,1), +(1093,1), +(1096,1), +(1099,1), +(1103,1), +(1046,1); diff --git a/sql/updates/3.3.2_old/7767_world_spell_group.sql b/sql/updates/3.3.2_old/7767_world_spell_group.sql new file mode 100644 index 0000000..ca8640e --- /dev/null +++ b/sql/updates/3.3.2_old/7767_world_spell_group.sql @@ -0,0 +1 @@ +UPDATE `spell_group` SET `spell_id`=34455 WHERE `id`=1055; diff --git a/sql/updates/3.3.2_old/7778_world_item_required_target.sql b/sql/updates/3.3.2_old/7778_world_item_required_target.sql new file mode 100644 index 0000000..ff92608 --- /dev/null +++ b/sql/updates/3.3.2_old/7778_world_item_required_target.sql @@ -0,0 +1,3 @@ +ALTER TABLE `item_required_target` +DROP `maxPercentHealth`; + diff --git a/sql/updates/3.3.2_old/7780_world_scriptname.sql b/sql/updates/3.3.2_old/7780_world_scriptname.sql new file mode 100644 index 0000000..25cdec2 --- /dev/null +++ b/sql/updates/3.3.2_old/7780_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`= 'npc_warmage_coldarra' WHERE `entry` IN (27173,27904,27906); diff --git a/sql/updates/3.3.2_old/7786_world_scriptname.sql b/sql/updates/3.3.2_old/7786_world_scriptname.sql new file mode 100644 index 0000000..76c093b --- /dev/null +++ b/sql/updates/3.3.2_old/7786_world_scriptname.sql @@ -0,0 +1,8 @@ +-- Alterac Valley +-- ScriptName update to bosses, marshals and warmasters +UPDATE `creature_template` SET `ScriptName`= 'boss_drekthar' WHERE `entry`=11946; +UPDATE `creature_template` SET `ScriptName`= 'boss_vanndar' WHERE `entry`=11948; +UPDATE `creature_template` SET `ScriptName`= 'boss_balinda' WHERE `entry`=11949; +UPDATE `creature_template` SET `ScriptName`= 'mob_water_elemental' WHERE `entry`=25040; +UPDATE `creature_template` SET `ScriptName`= 'boss_galvangar' WHERE `entry`=11947; +UPDATE `creature_template` SET `ScriptName`= 'mob_av_marshal_or_warmaster' WHERE `entry` IN (14762,14763,14764,14765,14772,14773,14776,14777); diff --git a/sql/updates/3.3.2_old/7797_world_scriptname.sql b/sql/updates/3.3.2_old/7797_world_scriptname.sql new file mode 100644 index 0000000..a68aaa4 --- /dev/null +++ b/sql/updates/3.3.2_old/7797_world_scriptname.sql @@ -0,0 +1,3 @@ +UPDATE `instance_template` SET `script`='instance_blackrock_spire' WHERE `map`=229; +UPDATE `creature_template` SET `ScriptName`='npc_rookey_whelp' WHERE `entry`=10161; +UPDATE `gameobject_template` SET `ScriptName`='go_rookey_egg' WHERE `entry`=175124; diff --git a/sql/updates/3.3.2_old/7812_world_creature_template.sql b/sql/updates/3.3.2_old/7812_world_creature_template.sql new file mode 100644 index 0000000..033d6f1 --- /dev/null +++ b/sql/updates/3.3.2_old/7812_world_creature_template.sql @@ -0,0 +1,4 @@ +-- Bone Gryphon +UPDATE `creature_template` SET `spell1`=48766,`spell2`=54469,`spell3`=54467,`spell4`=55214,`spell5`=54422,`VehicleId`=166 WHERE `entry`=29414; +-- Make the chopper mount usable as multimount, horde(i=41505) and ally(i=44413) version +UPDATE `creature_template` SET `vehicleid`=318 WHERE `entry` IN (29929,32286); diff --git a/sql/updates/3.3.2_old/7812_world_spell_dbc.sql b/sql/updates/3.3.2_old/7812_world_spell_dbc.sql new file mode 100644 index 0000000..1c91401 --- /dev/null +++ b/sql/updates/3.3.2_old/7812_world_spell_dbc.sql @@ -0,0 +1,11 @@ +-- Add serverside spells place holders for future development +DELETE FROM `spell_dbc` WHERE `Id` IN (25347,45315,43236,43459,43499,44275,64689,50574); +INSERT INTO `spell_dbc` (`Id`,`Comment`) VALUES +(25347, 'Item_template serverside spell'), +(45315, 'Quest 11566 reward serverside spell'), +(43236, 'Quest 11288 reward serverside spell'), +(43459, 'Quest 11332 reward serverside spell'), +(43499, 'Quest 11250 reward serverside spell'), +(44275, 'Quest 11432 reward serverside spell'), +(64689, 'Quest 13854 and 13862 reward serverside spell'), +(50574, 'Quest 12597 reward serverside spell'); diff --git a/sql/updates/3.3.2_old/7813_world_script_texts.sql b/sql/updates/3.3.2_old/7813_world_script_texts.sql new file mode 100644 index 0000000..019ad4e --- /dev/null +++ b/sql/updates/3.3.2_old/7813_world_script_texts.sql @@ -0,0 +1,50 @@ +DELETE FROM `script_texts` WHERE `entry` <= -1632000 and `entry` >= -1632999; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +-- Bronjham +(36497,-1632001,'Finally...a captive audience!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16595,1,0,0,'Bronjham SAY_AGGRO'), +(36497,-1632002,'Fodder for the engine!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16596,1,0,0,'Bronjham SAY_SLAY_1'), +(36497,-1632003,'Another soul to strengthen the host!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16597,1,0,0,'Bronjham SAY_SLAY_2'), +(36497,-1632004,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16598,1,0,0,'Bronjham SAY_DEATH'), +(36497,-1632005,'The vortex of the harvested calls to you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16599,1,0,0,'Bronjham SAY_SOUL_STORM'), +(36497,-1632006,'I will sever the soul from your body!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16600,1,0,0,'Bronjham SAY_CORRUPT_SOUL'), + +-- Devourer of Souls +(36502,-1632010,'You dare look upon the host of souls? I SHALL DEVOUR YOU WHOLE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16884,1,0,0,'Devoureur SAY_FACE_ANGER_AGGRO'), +(36502,-1632011,'You dare look upon the host of souls? I SHALL DEVOUR YOU WHOLE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16890,1,0,0,'Devoureur SAY_FACE_DESIRE_AGGRO'), +(36502,-1632012,'Damnation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16885,1,0,0,'Devoureur SAY_FACE_ANGER_SLAY_1'), +(36502,-1632013,'Damnation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16896,1,0,0,'Devoureur SAY_FACE_SORROW_SLAY_1'), +(36502,-1632014,'Damnation!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16891,1,0,0,'Devoureur SAY_FACE_DESIRE_SLAY_1'), +(36502,-1632015,'Doomed for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16886,1,0,0,'Devoureur SAY_FACE_ANGER_SLAY_2'), +(36502,-1632016,'Doomed for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16897,1,0,0,'Devoureur SAY_FACE_SORROW_SLAY_2'), +(36502,-1632017,'Doomed for eternity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16892,1,0,0,'Devoureur SAY_FACE_DESIRE_SLAY_2'), +(36502,-1632018,'The swell of souls will not be abated! You only delay the inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16887,1,0,0,'Devoureur SAY_FACE_ANGER_DEATH'), +(36502,-1632019,'The swell of souls will not be abated! You only delay the inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16898,1,0,0,'Devoureur SAY_FACE_SORROW_DEATH'), +(36502,-1632020,'The swell of souls will not be abated! You only delay the inevitable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16893,1,0,0,'Devoureur SAY_FACE_DESIRE_DEATH'), +(36502,-1632021,'Devourer of Souls begins to cast Mirrored Soul!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Devoureur EMOTE_MIRRORED_SOUL'), +(36502,-1632022,'Devourer of Souls begins to Unleash Souls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Devoureur EMOTE_UNLEASH_SOUL'), +(36502,-1632023,'SUFFERING! ANGUISH! CHAOS! RISE AND FEED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16888,1,0,0,'Devoureur SAY_FACE_ANGER_UNLEASH_SOUL'), +(36502,-1632024,'SUFFERING! ANGUISH! CHAOS! RISE AND FEED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16899,1,0,0,'Devoureur SAY_FACE_SORROW_UNLEASH_SOUL'), +(36502,-1632025,'SUFFERING! ANGUISH! CHAOS! RISE AND FEED!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16894,1,0,0,'Devoureur SAY_FACE_DESIRE_UNLEASH_SOUL'), +(36502,-1632026,'Devourer of Souls begins to cast Wailing Souls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,'Devoureur EMOTE_WAILING_SOUL'), +(36502,-1632027,'Stare into the abyss, and see your end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16889,1,0,0,'Devoureur SAY_FACE_ANGER_WAILING_SOUL'), +(36502,-1632028,'Stare into the abyss, and see your end!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16895,1,0,0,'Devoureur SAY_FACE_DESIRE_WAILING_SOUL'), +(38160,-1632029,'Excellent work, champions! We shall set up our base camp in these chambers. My mages will get the Scourge transport device working shortly. Step inside it when you''re ready for your next mission. I will meet you on the other side.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16625,1,0,0,'Jaina SAY_JAINA_OUTRO'), +(38161,-1632030,'Excellent work, champions! We shall set up our base camp in these chambers. My mages will get the Scourge transport device working shortly. Step inside when you are ready for your next mission. I will meet you on the other side.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17044,1,0,0,'Sylvanas SAY_SYLVANAS_OUTRO'), + +-- Jaina +(37597,-1632040,'Thank the light for seeing you here safely. We have much work to do if we are to defeat the Lich King and put an end to the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16617,0,0,0,'Jaina SAY_INTRO_1'), +(37597,-1632041,'Our allies within the Argent Crusade and the Knights of the Ebon Blade have broken through the front gate of Icecrown and are attempting to establish a foothold within the Citadel.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16618,0,0,0,'Jaina SAY_INTRO_2'), +(37597,-1632042,'Their success hinges upon what we discover in these cursed halls. Although our mission is a wrought with peril, we must persevere!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16619,0,0,0,'Jaina SAY_INTRO_3'), +(37597,-1632043,'With the attention of the Lich King drawn toward the front gate, we will be working our way through the side in search of information that will enable us to defeat the Scourge - once and for all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16620,0,0,0,'Jaina SAY_INTRO_4'), +(37597,-1632044,'King Varian''s SI7 agents have gathered information about a private sanctum of the Lich King''s deep within a place called the Halls of Reflection.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16621,0,0,0,'Jaina SAY_INTRO_5'), +(37597,-1632045,'We will carve a path through this wretched place and find a way to enter the Halls of Reflection. I sense powerful magic hidden away within those walls... Magic that could be the key to destroy the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16622,0,0,0,'Jaina SAY_INTRO_6'), +(37597,-1632046,'Your first mission is to destroy the machines of death within this malevolent engine of souls, and clear a path for our soldiers.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16623,0,0,0,'Jaina SAY_INTRO_7'), +(37597,-1632047,'Make haste, champions! I will prepare the troops to fall in behind you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16624,0,0,0,'Jaina SAY_INTRO_8'), + +-- Sylvanas +(37596,-1632050,'The Argent Crusade and the Knights of the Ebon Blade have assaulted the gates of Icecrown Citadel and are preparing for a massive attack upon the Scourge. Our missition is a bit more subtle, but equally as important.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17038,0,0,0,'Sylvanas SAY_INTRO_1'), +(37596,-1632051,'With the attention of the Lich King turned towards the front gate, we''ll be working our way through the side in search of information that will enable us to defeat the Lich King - once and for all.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17039,0,0,0,'Sylvanas SAY_INTRO_2'), +(37596,-1632052,'Our scouts have reported that the Lich King has a private chamber, outside of the Frozen Throne, deep within a place called the Halls of Reflection. That is our target, champions.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17040,0,0,0,'Sylvanas SAY_INTRO_3'), +(37596,-1632053,'We will cut a swath of destruction through this cursed place and find a way to enter the Halls of Reflection. If there is anything of value to be found here, it will be found in the Halls.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17041,0,0,0,'Sylvanas SAY_INTRO_4'), +(37596,-1632054,'Your first mission is to destroy the machines of death within this wretched engine of souls, and clear a path for our soldiers.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17042,0,0,0,'Sylvanas SAY_INTRO_5'), +(37596,-1632055,'The Dark Lady watches over you. Make haste!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17043,0,0,0,'Sylvanas SAY_INTRO_6'); diff --git a/sql/updates/3.3.2_old/7813_world_scriptname.sql b/sql/updates/3.3.2_old/7813_world_scriptname.sql new file mode 100644 index 0000000..1d24aaf --- /dev/null +++ b/sql/updates/3.3.2_old/7813_world_scriptname.sql @@ -0,0 +1,14 @@ +UPDATE `instance_template` SET `script`='instance_forge_of_souls' WHERE `map`=632; +UPDATE `creature_template` SET `Scriptname`='boss_devourer_of_souls' WHERE `entry`=36502; +UPDATE `creature_template` SET `Scriptname`='boss_bronjahm' WHERE `entry`=36497; +UPDATE `creature_template` SET `Scriptname`='npc_jaina_fos' WHERE `entry`=37597; +UPDATE `creature_template` SET `Scriptname`='npc_sylvanas_fos' WHERE `entry`=37596; +UPDATE `creature_template` SET `Scriptname`='mob_soul_horror' WHERE `entry`=36522; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_adept' WHERE `entry`=36620; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_animator' WHERE `entry`=36516; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_bonecaster' WHERE `entry`=36564; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_reaper' WHERE `entry`=36499; +UPDATE `creature_template` SET `Scriptname`='mob_soulguard_watchman' WHERE `entry`=36478; +UPDATE `creature_template` SET `Scriptname`='mob_spectral_warden' WHERE `entry`=36666; +UPDATE `creature_template` SET `Scriptname`='mob_spiteful_apparition' WHERE `entry`=36551; +UPDATE `creature_template` SET `Scriptname`='mob_corrupted_soul_fragment' WHERE `entry`=36535; diff --git a/sql/updates/3.3.2_old/7815_world_spelldifficulty_dbc.sql b/sql/updates/3.3.2_old/7815_world_spelldifficulty_dbc.sql new file mode 100644 index 0000000..b6fb3ce --- /dev/null +++ b/sql/updates/3.3.2_old/7815_world_spelldifficulty_dbc.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS `spelldifficulty_dbc`; +CREATE TABLE `spelldifficulty_dbc` ( + `id` int(11) unsigned NOT NULL DEFAULT '0', + `spellid0` int(11) unsigned NOT NULL DEFAULT '0', + `spellid1` int(11) unsigned NOT NULL DEFAULT '0', + `spellid2` int(11) unsigned NOT NULL DEFAULT '0', + `spellid3` int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.3.2_old/7816_world_spelldifficulty_dbc.sql b/sql/updates/3.3.2_old/7816_world_spelldifficulty_dbc.sql new file mode 100644 index 0000000..b069bab --- /dev/null +++ b/sql/updates/3.3.2_old/7816_world_spelldifficulty_dbc.sql @@ -0,0 +1,5 @@ +-- Add examples for spell difficulties +DELETE FROM `spelldifficulty_dbc` WHERE `id` IN (3000,3001); +INSERT INTO `spelldifficulty_dbc` (`id`,`spellid0`,`spellid1`,`spellid2`,`spellid3`) VALUES +(3000, 47772, 56935, 0, 0), +(3001, 47773, 56934, 0, 0); diff --git a/sql/updates/3.3.2_old/7823_world_spelldifficulty_dbc.sql b/sql/updates/3.3.2_old/7823_world_spelldifficulty_dbc.sql new file mode 100644 index 0000000..94e4a38 --- /dev/null +++ b/sql/updates/3.3.2_old/7823_world_spelldifficulty_dbc.sql @@ -0,0 +1,195 @@ +DELETE FROM `spelldifficulty_dbc` WHERE `id` BETWEEN 3002 AND 3194; +INSERT INTO `spelldifficulty_dbc` (`id`,`spellid0`,`spellid1`,`spellid2`,`spellid3`) VALUES +(3002, 44189, 46164, 0, 0), -- SPELL_FIREBALL_NORMAL / SPELL_FIREBALL_HEROIC +(3003, 44190, 46163, 0, 0), -- SPELL_FLAMESTRIKE1_NORMAL / SPELL_FLAMESTRIKE1_HEROIC +(3004, 44174, 46192, 0, 0), -- SPELL_RENEW_NORMAL / SPELL_RENEW_HEROIC +(3005, 14032, 15654, 0, 0), -- SPELL_SW_PAIN_NORMAL / SPELL_SW_PAIN_HEROIC +(3006, 44318, 46380, 0, 0), -- SPELL_CHAIN_LIGHTNING / SPELL_H_CHAIN_LIGHTNING +(3007, 44319, 46381, 0, 0), -- SPELL_ARCANE_SHOCK / SPELL_H_ARCANE_SHOCK +(3008, 52771, 58830, 0, 0), -- SPELL_WOUNDING_STRIKE / H_SPELL_WOUNDING_STRIKE +(3009, 52720, 58852, 0, 0), -- SPELL_CARRION_SWARM / H_SPELL_CARRION_SWARM +(3010, 52722, 58850, 0, 0), -- SPELL_MIND_BLAST / H_SPELL_MIND_BLAST +(3011, 52721, 58849, 0, 0), -- SPELL_SLEEP / H_SPELL_SLEEP +(3012, 52666, 58824, 0, 0), -- SPELL_DISEASE_EXPULSION / H_SPELL_DISEASE_EXPULSION +(3013, 52696, 58823, 0, 0), -- SPELL_CONSTRICTING_CHAINS / H_SPELL_CONSTRICTING_CHAINS +(3014, 57725, 58828, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3015, 52445, 58822, 0, 0), -- SPELL_EXORCISM_N / SPELL_EXORCISM_H +(3016, 31473, 39049, 0, 0), -- SPELL_SAND_BREATH / H_SPELL_SAND_BREATH +(3017, 31457, 38538, 0, 0), -- SPELL_ARCANE_BLAST / H_SPELL_ARCANE_BLAST +(3018, 31472, 38539, 0, 0), -- SPELL_ARCANE_DISCHARGE / H_SPELL_ARCANE_DISCHARGE +(3019, 31475, 38593, 0, 0), -- SPELL_WING_BUFFET / H_SPELL_WING_BUFFET +(3020, 56130, 59467, 0, 0), -- SPELL_BROOD_PLAGUE / H_SPELL_BROOD_PLAGUE +(3021, 57941, 59974, 0, 0), -- SPELL_MIND_FLAY / H_SPELL_MIND_FLAY +(3022, 57942, 59975, 0, 0), -- SPELL_SHADOW_BOLT_VOLLEY / H_SPELL_SHADOW_BOLT_VOLLEY +(3023, 57949, 59978, 0, 0), -- SPELL_SHIVER / H_SPELL_SHIVER +(3024, 56855, 60030, 0, 0), -- SPELL_CYCLONE_STRIKE / SPELL_CYCLONE_STRIKE_H +(3025, 55959, 59513, 0, 0), -- SPELL_EMBRACE_OF_THE_VAMPYR / H_SPELL_EMBRACE_OF_THE_VAMPYR +(3026, 55926, 59508, 0, 0), -- SPELL_FLAME_SPHERE_PERIODIC / H_SPELL_FLAME_SPHERE_PERIODIC +(3027, 53472, 59433, 0, 0), -- SPELL_POUND / H_SPELL_POUND +(3028, 53400, 59419, 0, 0), -- SPELL_ACID_CLOUD / H_SPELL_ACID_CLOUD +(3029, 53030, 59417, 0, 0), -- SPELL_LEECH_POISON / H_SPELL_LEECH_POISON +(3030, 57731, 59421, 0, 0), -- SPELL_WEB_GRAB / H_SPELL_WEB_GRAB +(3031, 52586, 59367, 0, 0), -- SPELL_MIND_FLAY / H_SPELL_MIND_FLAY +(3032, 52592, 59368, 0, 0), -- SPELL_CURSE_OF_FATIGUE / H_SPELL_CURSE_OF_FATIGUE +(3033, 52592, 59368, 0, 0), -- SPELL_CURSE_OF_FATIGUE / H_SPELL_CURSE_OF_FATIGUE +(3034, 59363, 52446, 0, 0), -- SPELL_ACID_SPLASH / H_SPELL_ACID_SPLASH +(3035, 52534, 59357, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3036, 52535, 59358, 0, 0), -- SPELL_SHADOW_NOVA / H_SPELL_SHADOW_NOVA +(3037, 52469, 59364, 0, 0), -- SPELL_INFECTED_BITE / H_SPELL_INFECTED_BITE +(3038, 52469, 59364, 0, 0), -- SPELL_INFECTED_BITE / H_SPELL_INFECTED_BITE +(3039, 52524, 59365, 0, 0), -- SPELL_BLINDING_WEBS / H_SPELL_BLINDING_WEBS +(3040, 52469, 59364, 0, 0), -- SPELL_INFECTED_BITE / H_SPELL_INFECTED_BITE +(3041, 52493, 59366, 0, 0), -- SPELL_POSION_SPRAY / H_SPELL_POSION_SPRAY +(3042, 66538, 67676, 0, 0), -- SPELL_HOLY_FIRE / SPELL_HOLY_FIRE_H +(3043, 66536, 67674, 0, 0), -- SPELL_SMITE / SPELL_SMITE_H +(3044, 66537, 67675, 0, 0), -- SPELL_RENEW / SPELL_RENEW_H +(3045, 66537, 67675, 0, 0), -- SPELL_RENEW / SPELL_RENEW_H +(3046, 66620, 67679, 0, 0), -- SPELL_OLD_WOUNDS / SPELL_OLD_WOUNDS_H +(3047, 66552, 67677, 0, 0), -- SPELL_WAKING_NIGHTMARE / SPELL_WAKING_NIGHTMARE_H +(3048, 66619, 67678, 0, 0), -- SPELL_SHADOWS_PAST / SPELL_SHADOWS_PAST_H +(3049, 67881, 67718, 0, 0), -- SPELL_ICY_TOUCH / SPELL_ICY_TOUCH_H +(3050, 67881, 67718, 0, 0), -- SPELL_ICY_TOUCH / SPELL_ICY_TOUCH_H +(3051, 67883, 67725, 0, 0), -- SPELL_OBLITERATE / SPELL_OBLITERATE_H +(3052, 67875, 67808, 0, 0), -- SPELL_DEATH_BITE / SPELL_DEATH_BITE_H +(3053, 67749, 67880, 0, 0), -- SPELL_LEAP / SPELL_LEAP_H +(3054, 68783, 68784, 0, 0), -- SPELL_MORTAL_STRIKE / SPELL_MORTAL_STRIKE_H +(3055, 66042, 68310, 0, 0), -- SPELL_FIREBALL / SPELL_FIREBALL_H +(3056, 66042, 68310, 0, 0), -- SPELL_FIREBALL / SPELL_FIREBALL_H +(3057, 66043, 68311, 0, 0), -- SPELL_POLYMORPH / SPELL_POLYMORPH_H +(3058, 66044, 68312, 0, 0), -- SPELL_BLAST_WAVE / SPELL_BLAST_WAVE_H +(3059, 67529, 68319, 0, 0), -- SPELL_CHAIN_LIGHTNING / SPELL_CHAIN_LIGHTNING_H +(3060, 67528, 68318, 0, 0), -- SPELL_HEALING_WAVE / SPELL_HEALING_WAVE_H +(3061, 67528, 68318, 0, 0), -- SPELL_HEALING_WAVE / SPELL_HEALING_WAVE_H +(3062, 65868, 67988, 0, 0), -- SPELL_SHOOT / SPELL_SHOOT_H +(3063, 67709, 68317, 0, 0), -- SPELL_EVISCERATE / SPELL_EVISCERATE_H +(3064, 48849, 59422, 0, 0), -- SPELL_FEARSOME_ROAR / H_SPELL_FEARSOME_ROAR +(3065, 49527, 59972, 0, 0), -- SPELL_CURSE_OF_LIFE / H_SPELL_CURSE_OF_LIFE +(3066, 49528, 59973, 0, 0), -- SPELL_SHADOW_VOLLEY / H_SPELL_SHADOW_VOLLEY +(3067, 49518, 59971, 0, 0), -- SPELL_RAIN_OF_FIRE / H_SPELL_RAIN_OF_FIRE +(3068, 49537, 59963, 0, 0), -- SPELL_LIGHTNING_BREATH / H_SPELL_LIGHTNING_BREATH +(3069, 49544, 59965, 0, 0), -- SPELL_EYE_BEAM / H_SPELL_EYE_BEAM +(3070, 49548, 59969, 0, 0), -- SPELL_POISON_CLOUD / H_SPELL_POISON_CLOUD +(3071, 59803, 49381, 0, 0), -- SPELL_CONSUME / H_SPELL_CONSUME +(3072, 49555, 59807, 0, 0), -- SPELL_CORPSE_EXPLODE / H_SPELL_CORPSE_EXPLODE +(3073, 68793, 69050, 0, 0), -- SPELL_MAGIC_S_BANE / H_SPELL_MAGIC_S_BANE +(3074, 68858, 69047, 0, 0), -- SPELL_CONSUME_SOUL / H_SPELL_CONSUME_SOUL +(3075, 68982, 70322, 0, 0), -- SPELL_PHANTOM_BLAST / H_SPELL_PHANTOM_BLAST +(3076, 68895, 70212, 0, 0), -- SPELL_SPITE / H_SPELL_SPITE +(3077, 69148, 70210, 0, 0), -- SPELL_WAIL_OF_SOULS / H_SPELL_WAIL_OF_SOULS +(3078, 69060, 70209, 0, 0), -- SPELL_FROST_NOVA / H_SPELL_FROST_NOVA +(3079, 69080, 70206, 0, 0), -- SPELL_BONE_VOLLEY / H_SPELL_BONE_VOLLEY +(3080, 69069, 70207, 0, 0), -- SPELL_SHIELD_OF_BONES / H_SPELL_SHIELD_OF_BONES +(3081, 69068, 70208, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3082, 69068, 70208, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3083, 69066, 70213, 0, 0), -- SPELL_DRAIN_LIFE / H_SPELL_DRAIN_LIFE +(3084, 69564, 70205, 0, 0), -- SPELL_SHADOW_MEND / H_SPELL_SHADOW_MEND +(3085, 69088, 70211, 0, 0), -- SPELL_SOUL_STRIKE / H_SPELL_SOUL_STRIKE +(3086, 68774, 70334, 0, 0), -- SPELL_FORGE_BLADE / H_SPELL_FORGE_BLADE +(3087, 68785, 70335, 0, 0), -- SPELL_FORGE_MACE / H_SPELL_FORGE_MACE +(3088, 70381, 72930, 0, 0), -- SPELL_DEEP_FREEZE / H_SPELL_DEEP_FREEZE +(3089, 68778, 70333, 0, 0), -- SPELL_CHILLING_WAVE / H_SPELL_CHILLING_WAVE +(3090, 68989, 70434, 0, 0), -- SPELL_POISON_NOVA / H_SPELL_POISON_NOVA +(3091, 69024, 70436, 0, 0), -- SPELL_TOXIC_WASTE / H_SPELL_TOXIC_WASTE +(3092, 69155, 69627, 0, 0), -- SPELL_FORCEFUL_SMASH / H_SPELL_FORCEFUL_SMASH +(3093, 69167, 69629, 0, 0), -- SPELL_DARK_MIGHT / H_SPELL_DARK_MIGHT +(3094, 69233, 69646, 0, 0), -- SPELL_ICY_BLAST / H_SPELL_ICY_BLAST +(3095, 69238, 69628, 0, 0), -- SPELL_ICY_BLAST_2 / H_SPELL_ICY_BLAST_2 +(3096, 55626, 58993, 0, 0), -- SPELL_MOJO_WAVE / H_SPELL_MOJO_WAVE +(3097, 55627, 58994, 0, 0), -- SPELL_MOJO_PUDDLE / H_SPELL_MOJO_PUDDLE +(3098, 55250, 59824, 0, 0), -- SPELL_WHIRLING_SLASH / H_SPELL_WHIRLING_SLASH +(3099, 55276, 59826, 0, 0), -- SPELL_PUNCTURE / H_SPELL_PUNCTURE +(3100, 55285, 59828, 0, 0), -- SPELL_ENRAGE / H_SPELL_ENRAGE +(3101, 55292, 59829, 0, 0), -- SPELL_STOMP / H_SPELL_STOMP +(3102, 54956, 59827, 0, 0), -- SPELL_IMPALING_CHARGE / H_SPELL_IMPALING_CHARGE +(3103, 55102, 59444, 0, 0), -- SPELL_DETERMINED_GORE / H_SPELL_DETERMINED_GORE +(3104, 55081, 59842, 0, 0), -- SPELL_POISON_NOVA / H_SPELL_POISON_NOVA +(3105, 48287, 59840, 0, 0), -- SPELL_POWERFULL_BITE / H_SPELL_POWERFULL_BITE +(3106, 54970, 59839, 0, 0), -- SPELL_VENOM_BOLT / H_SPELL_VENOM_BOLT +(3107, 54987, 58996, 0, 0), -- SPELL_VENOMOUS_BITE / H_SPELL_VENOMOUS_BITE +(3108, 47751, 57062, 0, 0), -- SPELL_SPARK / H_SPELL_SPARK +(3109, 48096, 57091, 0, 0), -- SPELL_CRYSTALFIRE_BREATH / H_SPELL_CRYSTALFIRE_BREATH +(3110, 48016, 57066, 0, 0), -- SPELL_TRAMPLE / H_SPELL_TRAMPLE +(3111, 47944, 57067, 0, 0), -- SPELL_CRYSTALL_SPIKE_DAMAGE / H_SPELL_CRYSTALL_SPIKE_DAMAGE +(3112, 50774, 59370, 0, 0), -- SPELL_THUNDERING_STOMP / SPELL_THUNDERING_STOMP_H +(3113, 52774, 59160, 0, 0), -- SPELL_RENEW_STEEL_N / SPELL_RENEW_STEEL_H +(3114, 52658, 59795, 0, 0), -- SPELL_STATIC_OVERLOAD / H_SPELL_STATIC_OVERLOAD +(3115, 52780, 59800, 0, 0), -- SPELL_BALL_LIGHTNING / H_SPELL_BALL_LIGHTNING +(3116, 52961, 59836, 0, 0), -- SPELL_PULSING_SHOCKWAVE_N / SPELL_PULSING_SHOCKWAVE_H +(3117, 52960, 59835, 0, 0), -- SPELL_LIGHTNING_NOVA_N / SPELL_LIGHTNING_NOVA_H +(3118, 52237, 59529, 0, 0), -- SPELL_SHATTERING_STOMP_N / SPELL_SHATTERING_STOMP_H +(3119, 52433, 59530, 0, 0), -- SPELL_IMMOLATION_STRIKE_N / SPELL_IMMOLATION_STRIKE_H +(3120, 50843, 59742, 0, 0), -- SPELL_BOULDER_TOSS / H_SPELL_BOULDER_TOSS +(3121, 48131, 59744, 0, 0), -- SPELL_STOMP / H_SPELL_STOMP +(3122, 50810, 61546, 0, 0), -- SPELL_SHATTER / H_SPELL_SHATTER +(3123, 50752, 59772, 0, 0), -- SPELL_STORM_OF_GRIEF_N / SPELL_STORM_OF_GRIEF_H +(3124, 50760, 59726, 0, 0), -- SPELL_SHOCK_OF_SORROW_N / SPELL_SHOCK_OF_SORROW_H +(3125, 50761, 59727, 0, 0), -- SPELL_PILLAR_OF_WOE_N / SPELL_PILLAR_OF_WOE_H +(3126, 50761, 59727, 0, 0), -- SPELL_PILLAR_OF_WOE_N / SPELL_PILLAR_OF_WOE_H +(3127, 50830, 59844, 0, 0), -- SPELL_CHAIN_LIGHTING / H_SPELL_CHAIN_LIGHTING +(3128, 50831, 59845, 0, 0), -- SPELL_LIGHTING_SHIELD / H_SPELL_LIGHTING_SHIELD +(3129, 50834, 59846, 0, 0), -- SPELL_STATIC_CHARGE / H_SPELL_STATIC_CHARGE +(3130, 51849, 59861, 0, 0), -- SPELL_LIGHTING_RING / H_SPELL_LIGHTING_RING +(3131, 42730, 59735, 0, 0), -- SPELL_WOE_STRIKE / H_SPELL_WOE_STRIKE +(3132, 42669, 59706, 0, 0), -- SPELL_SMASH / H_SPELL_SMASH +(3133, 42705, 59707, 0, 0), -- SPELL_ENRAGE / H_SPELL_ENRAGE +(3134, 42729, 59734, 0, 0), -- SPELL_DREADFUL_ROAR / H_SPELL_DREADFUL_ROAR +(3135, 42708, 59708, 0, 0), -- SPELL_STAGGERING_ROAR / H_SPELL_STAGGERING_ROAR +(3136, 42750, 59719, 0, 0), -- SPELL_SHADOW_AXE_DAMAGE / H_SPELL_SHADOW_AXE_DAMAGE +(3137, 43649, 59575, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3138, 48261, 59268, 0, 0), -- SPELL_IMPALE / H_SPELL_IMPALE +(3139, 48256, 59267, 0, 0), -- SPELL_WITHERING_ROAR / H_SPELL_WITHERING_ROAR +(3140, 48140, 59273, 0, 0), -- SPELL_CHAIN_LIGHTING / H_SPELL_CHAIN_LIGHTING +(3141, 48137, 59265, 0, 0), -- SPELL_MORTAL_WOUND / H_SPELL_MORTAL_WOUND +(3142, 48130, 59264, 0, 0), -- SPELL_GORE / H_SPELL_GORE +(3143, 48105, 59263, 0, 0), -- SPELL_GRIEVOUS_WOUND / H_SPELL_GRIEVOUS_WOUND +(3144, 48133, 59271, 0, 0), -- SPELL_POISON_BREATH / H_SPELL_POISON_BREATH +(3145, 48133, 59271, 0, 0), -- SPELL_POISON_BREATH / H_SPELL_POISON_BREATH +(3146, 50234, 59330, 0, 0), -- SPELL_CRUSH / H_SPELL_CRUSH +(3147, 50225, 59331, 0, 0), -- SPELL_POISONED_SPEAR / H_SPELL_POISONED_SPEAR +(3148, 15667, 59409, 0, 0), -- SPELL_SINSTER_STRIKE / H_SPELL_SINSTER_STRIKE +(3149, 48294, 59301, 0, 0), -- SPELL_BANE / H_SPELL_BANE +(3150, 48291, 59300, 0, 0), -- SPELL_FETID_ROT / H_SPELL_FETID_ROT +(3151, 48423, 59304, 0, 0), -- SPELL_SPIRIT_STRIKE / H_SPELL_SPIRIT_STRIKE +(3152, 48529, 59305, 0, 0), -- SPELL_SPIRIT_BURST / H_SPELL_SPIRIT_BURST +(3153, 58693, 59369, 0, 0), -- SPELL_BLIZZARD / H_SPELL_BLIZZARD +(3154, 58690, 59283, 0, 0), -- SPELL_TAIL_SWEEP / H_SPELL_TAIL_SWEEP +(3155, 58688, 59281, 0, 0), -- SPELL_UNCONTROLLABLE_ENERGY / H_SPELL_UNCONTROLLABLE_ENERGY +(3156, 54479, 59471, 0, 0), -- SPELL_EARTH_SHIELD / H_SPELL_EARTH_SHIELD +(3157, 54479, 59471, 0, 0), -- SPELL_EARTH_SHIELD / H_SPELL_EARTH_SHIELD +(3158, 54481, 59473, 0, 0), -- SPELL_CHAIN_HEAL / H_SPELL_CHAIN_HEAL +(3159, 54312, 59522, 0, 0), -- SPELL_FRENZY / SPELL_FRENZY_H +(3160, 54237, 59520, 0, 0), -- SPELL_WATER_BLAST / SPELL_WATER_BLAST_H +(3161, 54241, 59521, 0, 0), -- SPELL_WATER_BOLT_VOLLEY / SPELL_WATER_BOLT_VOLLEY_H +(3162, 54235, 59468, 0, 0), -- SPELL_FIREBOLT / H_SPELL_FIREBOLT +(3163, 54282, 59469, 0, 0), -- SPELL_FLAME_BREATH / H_SPELL_FLAME_BREATH +(3164, 54249, 59594, 0, 0), -- SPELL_LAVA_BURN / H_SPELL_LAVA_BURN +(3165, 54202, 59483, 0, 0), -- SPELL_ARCANE_BARRAGE_VOLLEY / SPELL_ARCANE_BARRAGE_VOLLEY_H +(3166, 54226, 59485, 0, 0), -- SPELL_ARCANE_BUFFET / SPELL_ARCANE_BUFFET_H +(3167, 54160, 59474, 0, 0), -- SPELL_ARCANE_POWER / H_SPELL_ARCANE_POWER +(3168, 54361, 59743, 0, 0), -- SPELL_VOID_SHIFT / H_SPELL_VOID_SHIFT +(3169, 54524, 59745, 0, 0), -- SPELL_SHROUD_OF_DARKNESS / H_SPELL_SHROUD_OF_DARKNESS +(3170, 54342, 59747, 0, 0), -- SPELL_ZURAMAT_ADD_2 / H_SPELL_ZURAMAT_ADD_2 +(3171, 32325, 38760, 0, 0), -- SPELL_VOID_BLAST / H_SPELL_VOID_BLAST +(3172, 32358, 38759, 0, 0), -- SPELL_DARK_SHELL / H_SPELL_DARK_SHELL +(3173, 38197, 40425, 0, 0), -- SPELL_ARCANE_EXPLOSION / H_SPELL_ARCANE_EXPLOSION +(3174, 35059, 40424, 0, 0), -- SPELL_ARCANE_VOLLEY / H_SPELL_ARCANE_VOLLEY +(3175, 38245, 43309, 0, 0), -- SPELL_POLYMORPH / H_SPELL_POLYMORPH +(3176, 33617, 39363, 0, 0), -- SPELL_RAIN_OF_FIRE / H_SPELL_RAIN_OF_FIRE +(3177, 34449, 37924, 0, 0), -- SPELL_WATER_BOLT_VOLLEY / H_SPELL_WATER_BOLT_VOLLEY +(3178, 31532, 37936, 0, 0), -- SPELL_REPAIR / H_SPELL_REPAIR +(3179, 33132, 37371, 0, 0), -- SPELL_FIRE_NOVA / H_SPELL_FIRE_NOVA +(3180, 28599, 40070, 0, 0), -- SPELL_SHADOW_BOLT_VOLLEY / H_SPELL_SHADOW_BOLT_VOLLEY +(3181, 49381, 59805, 0, 0), -- SPELL_CONSUME_AURA / H_SPELL_CONSUME_AURA +(3182, 30695, 37566, 0, 0), -- SPELL_TREACHEROUS_AURA / H_SPELL_BANE_OF_TREACHERY +(3183, 30686, 39297, 0, 0), -- SPELL_SHADOW_BOLT / H_SPELL_SHADOW_BOLT +(3184, 30641, 36814, 0, 0), -- SPELL_MORTAL_WOUND / H_SPELL_MORTAL_WOUND +(3185, 30495, 35953, 0, 0), -- SPELL_SHADOW_CLEAVE / H_SPELL_SHADOW_SLAM +(3186, 30598, 36056, 0, 0), -- SPELL_BURNING_MAUL / H_SPELL_BURNING_MAUL +(3187, 36924, 39017, 0, 0), -- SPELL_MIND_REND / H_SPELL_MIND_REND +(3188, 36924, 39017, 0, 0), -- SPELL_MIND_REND / H_SPELL_MIND_REND +(3189, 37162, 39019, 0, 0), -- SPELL_DOMINATION / H_SPELL_DOMINATION +(3190, 37162, 39019, 0, 0), -- SPELL_DOMINATION / H_SPELL_DOMINATION +(3191, 35322, 39193, 0, 0), -- SPELL_SHADOW_POWER / H_SPELL_SHADOW_POWER +(3192, 35327, 39194, 0, 0), -- SPELL_JACKHAMMER / H_SPELL_JACKHAMMER +(3193, 35275, 39084, 0, 0), -- SPELL_SUMMON_RAGIN_FLAMES / H_SPELL_SUMMON_RAGIN_FLAMES +(3194, 35268, 39346, 0, 0); -- SPELL_INFERNO / H_SPELL_INFERNO diff --git a/sql/updates/3.3.2_old/7827_world_script_texts.sql b/sql/updates/3.3.2_old/7827_world_script_texts.sql new file mode 100644 index 0000000..eae0a06 --- /dev/null +++ b/sql/updates/3.3.2_old/7827_world_script_texts.sql @@ -0,0 +1,29 @@ +DELETE FROM `script_texts` WHERE `entry` <= -1601000 and `entry` >= -1601022; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + +-- Anub'arak +('29120', '-1601000', 'Eternal aggony awaits you!', null, null, null, null, null, null, null, null, '14054', '1', '0', '0', ''), +('29120', '-1601001', 'Soon, the Master\'s voice will call to you.', null, null, null, null, null, null, null, null, '14057', '1', '0', '0', ''), +('29120', '-1601002', 'You have made your choice.', null, null, null, null, null, null, null, null, '14056', '1', '0', '0', ''), +('29120', '-1601003', 'You shall experience my torment, first-hand!', null, null, null, null, null, null, null, null, '14055', '1', '0', '0', ''), +('29120', '-1601004', 'Ahhh... RAAAAAGH! Never thought... I would be free of him...', null, null, null, null, null, null, null, null, '14069', '1', '0', '0', ''), +('29120', '-1601005', 'Your armor is useless againts my locusts.', null, null, null, null, null, null, null, null, '14060', '1', '0', '0', ''), +('29120', '-1601006', 'Uunak-hissss tik-k-k-k-k!', null, null, null, null, null, null, null, null, '14067', '1', '0', '0', ''), +('29120', '-1601007', 'The pestilence upon you!', null, null, null, null, null, null, null, null, '14068', '1', '0', '0', ''), +('29120', '-1601008', 'Auum na-l ak-k-k-k, isshhh.', null, null, null, null, null, null, null, null, '14058', '1', '0', '0', ''), +('29120', '-1601009', 'Come forth my brethren! Feast on their flesh.', null, null, null, null, null, null, null, null, '14059', '1', '0', '0', ''), +('29120', '-1601010', 'I was king of this empire once\, long ago. In life I stood as champion. In death I returned as conqueror. Now I protect the kingdom once more. Ironic\, yes? ', null, null, null, null, null, null, null, null, '14053', '1', '0', '0', ''), + +-- Kirkthir +('28684', '-1601011', 'This kingdom belongs to the Scourge! Only the dead may enter.', null, null, null, null, null, null, null, null, '14075', '1', '0', '0', ''), +('28684', '-1601012', 'You were foolish to come.', null, null, null, null, null, null, null, null, '14077', '1', '0', '0', ''), +('28684', '-1601013', 'As Anub\'Arak commands!', null, null, null, null, null, null, null, null, '14078', '1', '0', '0', ''), +('28684', '-1601014', 'I should be grateful. But I long ago lost the capacity.', null, null, null, null, null, null, null, null, '14087', '1', '0', '0', ''), +('28684', '-1601015', 'They hunger.', null, null, null, null, null, null, null, null, '14085', '1', '0', '0', ''), +('28684', '-1601016', 'Dinner time\, my pets.', null, null, null, null, null, null, null, null, '14086', '1', '0', '0', ''), +('28684', '-1601017', 'Keep an eye on the tunnel. We must not let anyone through!', null, null, null, null, null, null, null, null, '14082', '1', '0', '0', ''), +('28684', '-1601018', 'I hear footsteps. Be on your guard.', null, null, null, null, null, null, null, null, '14083', '1', '0', '0', ''), +('28684', '-1601019', 'I sense the living. Be ready.', null, null, null, null, null, null, null, null, '14084', '1', '0', '0', ''), +('28684', '-1601020', 'We are besieged. Strike out and bring back their corpses!', null, null, null, null, null, null, null, null, '14079', '1', '0', '0', ''), +('28684', '-1601021', 'We must hold the gate. Attack! Tear them limb from limb!', null, null, null, null, null, null, null, null, '14080', '1', '0', '0', ''), +('28684', '-1601022', 'The gate must be protected at all costs. Rip them to shreds!', null, null, null, null, null, null, null, null, '14081', '1', '0', '0', ''); diff --git a/sql/updates/3.3.2_old/CMakeLists.txt b/sql/updates/3.3.2_old/CMakeLists.txt new file mode 100644 index 0000000..75f051d --- /dev/null +++ b/sql/updates/3.3.2_old/CMakeLists.txt @@ -0,0 +1,3 @@ +FILE(GLOB _SQL_332 *.sql) + +INSTALL(FILES ${_SQL_332} DESTINATION share/trinity/sql/updates/3.3.2_old) \ No newline at end of file diff --git a/sql/updates/3.3.3a_old/7834_characters_characters.sql b/sql/updates/3.3.3a_old/7834_characters_characters.sql new file mode 100644 index 0000000..694010b --- /dev/null +++ b/sql/updates/3.3.3a_old/7834_characters_characters.sql @@ -0,0 +1,22 @@ +ALTER TABLE characters + ADD COLUMN `exploredZones` longtext AFTER activeSpec, + ADD COLUMN `equipmentCache` longtext AFTER exploredZones, + ADD COLUMN `ammoId` int(10) UNSIGNED NOT NULL default '0' AFTER equipmentCache, + ADD COLUMN `knownTitles` longtext AFTER ammoId; + +UPDATE characters SET +exploredZones = SUBSTRING(data, +length(SUBSTRING_INDEX(data, ' ', 1041))+2, +length(SUBSTRING_INDEX(data, ' ', 1168+1))- length(SUBSTRING_INDEX(data, ' ', 1041)) - 1), +equipmentCache = SUBSTRING(data, +length(SUBSTRING_INDEX(data, ' ', 283))+2, +length(SUBSTRING_INDEX(data, ' ', 320+1))- length(SUBSTRING_INDEX(data, ' ', 283)) - 1), +ammoId = SUBSTRING(data, +length(SUBSTRING_INDEX(data, ' ', 1198))+2, +length(SUBSTRING_INDEX(data, ' ', 1198+1))- length(SUBSTRING_INDEX(data, ' ', 1198)) - 1), +knownTitles = SUBSTRING(data, +length(SUBSTRING_INDEX(data, ' ', 626))+2, +length(SUBSTRING_INDEX(data, ' ', 631+1))- length(SUBSTRING_INDEX(data, ' ', 626)) - 1); + +ALTER TABLE characters + DROP COLUMN data; diff --git a/sql/updates/3.3.3a_old/7845_characters_mail.sql b/sql/updates/3.3.3a_old/7845_characters_mail.sql new file mode 100644 index 0000000..1243223 --- /dev/null +++ b/sql/updates/3.3.3a_old/7845_characters_mail.sql @@ -0,0 +1,5 @@ +ALTER TABLE `mail` ADD COLUMN `body` longtext CHARSET utf8 COLLATE utf8_general_ci NULL after `subject`; + +UPDATE `mail` LEFT JOIN `item_text` ON `mail`.`itemtextid` = `item_text`.`id` SET `mail`.`body`=`item_text`.`text`; +DELETE item_text FROM mail, item_text WHERE mail.itemtextid = item_text.id; +ALTER TABLE `mail` DROP COLUMN `itemtextid`; diff --git a/sql/updates/3.3.3a_old/7846_world_spell_dbc.sql b/sql/updates/3.3.3a_old/7846_world_spell_dbc.sql new file mode 100644 index 0000000..0173fb0 --- /dev/null +++ b/sql/updates/3.3.3a_old/7846_world_spell_dbc.sql @@ -0,0 +1,6 @@ +ALTER TABLE spell_dbc DROP EffectBaseDice1; +ALTER TABLE spell_dbc DROP EffectBaseDice2; +ALTER TABLE spell_dbc DROP EffectBaseDice3; +ALTER TABLE spell_dbc DROP EffectDicePerLevel1; +ALTER TABLE spell_dbc DROP EffectDicePerLevel2; +ALTER TABLE spell_dbc DROP EffectDicePerLevel3; diff --git a/sql/updates/3.3.3a_old/7849_realmd_realmlist.sql b/sql/updates/3.3.3a_old/7849_realmd_realmlist.sql new file mode 100644 index 0000000..da0fa67 --- /dev/null +++ b/sql/updates/3.3.3a_old/7849_realmd_realmlist.sql @@ -0,0 +1 @@ +UPDATE `realmlist` SET `gamebuild`=11723 WHERE `id`=1; diff --git a/sql/updates/3.3.3a_old/7854_world_spell_goup.sql b/sql/updates/3.3.3a_old/7854_world_spell_goup.sql new file mode 100644 index 0000000..5d663ef --- /dev/null +++ b/sql/updates/3.3.3a_old/7854_world_spell_goup.sql @@ -0,0 +1 @@ +DELETE FROM `spell_group` WHERE `spell_id` IN (61417, 61418); diff --git a/sql/updates/3.3.3a_old/7854_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/7854_world_spell_proc_event.sql new file mode 100644 index 0000000..b50127b --- /dev/null +++ b/sql/updates/3.3.3a_old/7854_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (58642, 58676, 61433, 61434, 33174, 33182, 51470, 44396, 29801, 30802, 30803, 30804, 30805, 30808, 30809, 49137, 49657, 51466, 53137, 53138, 44394, 44395, 44396, 34457); diff --git a/sql/updates/3.3.3a_old/7854_world_spell_ranks.sql b/sql/updates/3.3.3a_old/7854_world_spell_ranks.sql new file mode 100644 index 0000000..eb9be8c --- /dev/null +++ b/sql/updates/3.3.3a_old/7854_world_spell_ranks.sql @@ -0,0 +1 @@ +DELETE FROM `spell_ranks` WHERE `first_spell_id` IN (30803, 33174, 61417, 9736, 15742); diff --git a/sql/updates/3.3.3a_old/7857_realmd_realmlist.sql b/sql/updates/3.3.3a_old/7857_realmd_realmlist.sql new file mode 100644 index 0000000..c71c299 --- /dev/null +++ b/sql/updates/3.3.3a_old/7857_realmd_realmlist.sql @@ -0,0 +1 @@ +ALTER TABLE `realmlist` CHANGE COLUMN `gamebuild` `gamebuild` int(11) unsigned NOT NULL default '11723'; diff --git a/sql/updates/3.3.3a_old/7873_world_scriptname.sql b/sql/updates/3.3.3a_old/7873_world_scriptname.sql new file mode 100644 index 0000000..8ae0970 --- /dev/null +++ b/sql/updates/3.3.3a_old/7873_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_stillpine_cage' WHERE `entry`=181714; diff --git a/sql/updates/3.3.3a_old/7881_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/7881_world_spell_linked_spell.sql new file mode 100644 index 0000000..af419be --- /dev/null +++ b/sql/updates/3.3.3a_old/7881_world_spell_linked_spell.sql @@ -0,0 +1 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_effect` IN (24395,24396,24397,26592,61417,61418); diff --git a/sql/updates/3.3.3a_old/7884_world_spell_dbc.sql b/sql/updates/3.3.3a_old/7884_world_spell_dbc.sql new file mode 100644 index 0000000..0fde674 --- /dev/null +++ b/sql/updates/3.3.3a_old/7884_world_spell_dbc.sql @@ -0,0 +1,11 @@ +-- Add serverside spells place holders for future development +DELETE FROM `spell_dbc` WHERE `Id` IN (71356,71803,72111,72125,70816,72233,72234,72235); +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(71356, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2108 spellid0 serverside spell'), +(71803, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2108 spellid1 serverside spell'), +(72111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2136 spellid0 serverside spell'), +(72125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2136 spellid1 serverside spell'), +(70816, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid0 serverside spell'), +(72233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid1 serverside spell'), +(72234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid2 serverside spell'), +(72235, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spelldifficulty_dbc id:2146 spellid3 serverside spell'); diff --git a/sql/updates/3.3.3a_old/7884_world_spelldifficulty_dbc.sql b/sql/updates/3.3.3a_old/7884_world_spelldifficulty_dbc.sql new file mode 100644 index 0000000..1cbbadf --- /dev/null +++ b/sql/updates/3.3.3a_old/7884_world_spelldifficulty_dbc.sql @@ -0,0 +1 @@ +UPDATE `spelldifficulty_dbc` SET `spellid1`=58827 WHERE `id`=3014; diff --git a/sql/updates/3.3.3a_old/7893_characters_item_instance.sql b/sql/updates/3.3.3a_old/7893_characters_item_instance.sql new file mode 100644 index 0000000..3dea7f9 --- /dev/null +++ b/sql/updates/3.3.3a_old/7893_characters_item_instance.sql @@ -0,0 +1,10 @@ +UPDATE item_instance SET data = REPLACE(data,' ',' '); +UPDATE item_instance SET data = CONCAT(TRIM(data),' '); + +UPDATE `item_instance` SET `data` = CONCAT( + SUBSTRING_INDEX(`data`, ' ', 59 + 1), ' ', + SUBSTRING_INDEX(`data`, ' ', -3 -1), '0 ') +WHERE length(SUBSTRING_INDEX(data, ' ', 64)) < length(data) and length(SUBSTRING_INDEX(data, ' ', 64+1)) >= length(data); + +UPDATE item_instance SET data = REPLACE(data,' ',' '); +UPDATE item_instance SET data = CONCAT(TRIM(data),' '); diff --git a/sql/updates/3.3.3a_old/7904_characters_item_instance.sql b/sql/updates/3.3.3a_old/7904_characters_item_instance.sql new file mode 100644 index 0000000..95cd7bc --- /dev/null +++ b/sql/updates/3.3.3a_old/7904_characters_item_instance.sql @@ -0,0 +1 @@ +ALTER TABLE `item_instance` ADD COLUMN `text` longtext AFTER `data`; diff --git a/sql/updates/3.3.3a_old/7904_characters_item_text.sql b/sql/updates/3.3.3a_old/7904_characters_item_text.sql new file mode 100644 index 0000000..517a4a0 --- /dev/null +++ b/sql/updates/3.3.3a_old/7904_characters_item_text.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `item_text`; diff --git a/sql/updates/3.3.3a_old/7905_characters_character_equipmentsets.sql b/sql/updates/3.3.3a_old/7905_characters_character_equipmentsets.sql new file mode 100644 index 0000000..1617c61 --- /dev/null +++ b/sql/updates/3.3.3a_old/7905_characters_character_equipmentsets.sql @@ -0,0 +1 @@ +ALTER TABLE `character_equipmentsets` ADD INDEX `Idx_setindex` (`setindex`); diff --git a/sql/updates/3.3.3a_old/7905_characters_corpse.sql b/sql/updates/3.3.3a_old/7905_characters_corpse.sql new file mode 100644 index 0000000..061c90e --- /dev/null +++ b/sql/updates/3.3.3a_old/7905_characters_corpse.sql @@ -0,0 +1,2 @@ +ALTER TABLE `corpse` ADD INDEX `Idx_player`(`player`); +ALTER TABLE `corpse` ADD INDEX `Idx_time`(`time`); diff --git a/sql/updates/3.3.3a_old/7905_characters_group_member.sql b/sql/updates/3.3.3a_old/7905_characters_group_member.sql new file mode 100644 index 0000000..7c7c3ea --- /dev/null +++ b/sql/updates/3.3.3a_old/7905_characters_group_member.sql @@ -0,0 +1 @@ +ALTER TABLE `group_member` ADD INDEX `Idx_memberGuid`(`memberGuid`); diff --git a/sql/updates/3.3.3a_old/7905_characters_guild.sql b/sql/updates/3.3.3a_old/7905_characters_guild.sql new file mode 100644 index 0000000..451df66 --- /dev/null +++ b/sql/updates/3.3.3a_old/7905_characters_guild.sql @@ -0,0 +1,7 @@ +ALTER TABLE `guild_eventlog` ADD INDEX `Idx_PlayerGuid1`(`PlayerGuid1`); +ALTER TABLE `guild_eventlog` ADD INDEX `Idx_PlayerGuid2`(`PlayerGuid2`); +ALTER TABLE `guild_eventlog` ADD INDEX `Idx_LogGuid`(`LogGuid`); +ALTER TABLE `guild_bank_eventlog` ADD INDEX `Idx_PlayerGuid`(`PlayerGuid`); +ALTER TABLE `guild_bank_eventlog` ADD INDEX `Idx_LogGuid`(`LogGuid`); +ALTER TABLE `guild_bank_item` ADD INDEX `Idx_item_guid`(`item_guid`); +ALTER TABLE `guild_rank` ADD INDEX `Idx_rid`(`rid`); diff --git a/sql/updates/3.3.3a_old/7905_characters_petition.sql b/sql/updates/3.3.3a_old/7905_characters_petition.sql new file mode 100644 index 0000000..844f2d0 --- /dev/null +++ b/sql/updates/3.3.3a_old/7905_characters_petition.sql @@ -0,0 +1,2 @@ +ALTER TABLE `petition_sign` ADD INDEX `Idx_playerguid`(`playerguid`); +ALTER TABLE `petition_sign` ADD INDEX `Idx_ownerguid`(`ownerguid`); diff --git a/sql/updates/3.3.3a_old/7906_characters_character_stats.sql b/sql/updates/3.3.3a_old/7906_characters_character_stats.sql new file mode 100644 index 0000000..82aebbb --- /dev/null +++ b/sql/updates/3.3.3a_old/7906_characters_character_stats.sql @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS `character_stats`; +CREATE TABLE `character_stats` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier, Low part', + `maxhealth` int(10) UNSIGNED NOT NULL default '0', + `maxpower1` int(10) UNSIGNED NOT NULL default '0', + `maxpower2` int(10) UNSIGNED NOT NULL default '0', + `maxpower3` int(10) UNSIGNED NOT NULL default '0', + `maxpower4` int(10) UNSIGNED NOT NULL default '0', + `maxpower5` int(10) UNSIGNED NOT NULL default '0', + `maxpower6` int(10) UNSIGNED NOT NULL default '0', + `maxpower7` int(10) UNSIGNED NOT NULL default '0', + `strength` int(10) UNSIGNED NOT NULL default '0', + `agility` int(10) UNSIGNED NOT NULL default '0', + `stamina` int(10) UNSIGNED NOT NULL default '0', + `intellect` int(10) UNSIGNED NOT NULL default '0', + `spirit` int(10) UNSIGNED NOT NULL default '0', + `armor` int(10) UNSIGNED NOT NULL default '0', + `resHoly` int(10) UNSIGNED NOT NULL default '0', + `resFire` int(10) UNSIGNED NOT NULL default '0', + `resNature` int(10) UNSIGNED NOT NULL default '0', + `resFrost` int(10) UNSIGNED NOT NULL default '0', + `resShadow` int(10) UNSIGNED NOT NULL default '0', + `resArcane` int(10) UNSIGNED NOT NULL default '0', + `blockPct` float UNSIGNED NOT NULL default '0', + `dodgePct` float UNSIGNED NOT NULL default '0', + `parryPct` float UNSIGNED NOT NULL default '0', + `critPct` float UNSIGNED NOT NULL default '0', + `rangedCritPct` float UNSIGNED NOT NULL default '0', + `spellCritPct` float UNSIGNED NOT NULL default '0', + `attackPower` int(10) UNSIGNED NOT NULL default '0', + `rangedAttackPower` int(10) UNSIGNED NOT NULL default '0', + `spellPower` int(10) UNSIGNED NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.3.3a_old/7909_world_scriptname.sql b/sql/updates/3.3.3a_old/7909_world_scriptname.sql new file mode 100644 index 0000000..824c090 --- /dev/null +++ b/sql/updates/3.3.3a_old/7909_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_pet_trainer' WHERE `entry` IN (10090,3698,17484,4320,3545,16712,3622,16675,3620,10086,2879,3306,543,2878,3688,10089,16271,10088,3624); diff --git a/sql/updates/3.3.3a_old/7914_characters_character_queststatus_weekly.sql b/sql/updates/3.3.3a_old/7914_characters_character_queststatus_weekly.sql new file mode 100644 index 0000000..1bced54 --- /dev/null +++ b/sql/updates/3.3.3a_old/7914_characters_character_queststatus_weekly.sql @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS `character_queststatus_weekly`; +CREATE TABLE `character_queststatus_weekly` ( + `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', + `quest` int(11) unsigned NOT NULL default '0' COMMENT 'Quest Identifier', + PRIMARY KEY (`guid`,`quest`), + KEY `idx_guid` (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; diff --git a/sql/updates/3.3.3a_old/7914_characters_worldstates.sql b/sql/updates/3.3.3a_old/7914_characters_worldstates.sql new file mode 100644 index 0000000..5b15051 --- /dev/null +++ b/sql/updates/3.3.3a_old/7914_characters_worldstates.sql @@ -0,0 +1 @@ +ALTER TABLE `worldstates` ADD COLUMN `NextWeeklyQuestResetTime` bigint(40) unsigned NOT NULL default '0' AFTER `value`; diff --git a/sql/updates/3.3.3a_old/7915_characters_worldstates.sql b/sql/updates/3.3.3a_old/7915_characters_worldstates.sql new file mode 100644 index 0000000..ffa573b --- /dev/null +++ b/sql/updates/3.3.3a_old/7915_characters_worldstates.sql @@ -0,0 +1,2 @@ +ALTER TABLE `worldstates` DROP COLUMN `NextWeeklyQuestResetTime`; +INSERT INTO `worldstates` (`entry`,`value`, `comment`) VALUES (20002, 0, 'NextWeeklyQuestResetTime'); diff --git a/sql/updates/3.3.3a_old/7919_characters_worldstates.sql b/sql/updates/3.3.3a_old/7919_characters_worldstates.sql new file mode 100644 index 0000000..b265aeb --- /dev/null +++ b/sql/updates/3.3.3a_old/7919_characters_worldstates.sql @@ -0,0 +1,4 @@ +DELETE FROM `worldstates` WHERE `entry` IN (20001,20002); +INSERT INTO `worldstates` (`entry`,`value`, `comment`) VALUES +(20001, 0, 'NextArenaPointDistributionTime'), +(20002, 0, 'NextWeeklyQuestResetTime'); diff --git a/sql/updates/3.3.3a_old/7921_characters_worldstates.sql b/sql/updates/3.3.3a_old/7921_characters_worldstates.sql new file mode 100644 index 0000000..f2e0862 --- /dev/null +++ b/sql/updates/3.3.3a_old/7921_characters_worldstates.sql @@ -0,0 +1 @@ +ALTER TABLE `worldstates` CHANGE COLUMN `comment` `comment` text; diff --git a/sql/updates/3.3.3a_old/7922_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/7922_world_spell_proc_event.sql new file mode 100644 index 0000000..d7ab91f --- /dev/null +++ b/sql/updates/3.3.3a_old/7922_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (66191,66192); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(66191, 0x00, 15, 0x00400010, 0x20020004, 0x00000000, 0x00000010, 0x00000000, 0, 100, 0), -- Threat of Thassarian (Rank 2) +(66192, 0x00, 15, 0x00400010, 0x20020004, 0x00000000, 0x00000010, 0x00000000, 0, 100, 0); -- Threat of Thassarian (Rank 3) + diff --git a/sql/updates/3.3.3a_old/7923_characters_characters.sql b/sql/updates/3.3.3a_old/7923_characters_characters.sql new file mode 100644 index 0000000..a9fe488 --- /dev/null +++ b/sql/updates/3.3.3a_old/7923_characters_characters.sql @@ -0,0 +1,2 @@ +ALTER TABLE characters + ADD COLUMN `actionBars` tinyint(3) UNSIGNED NOT NULL default '0' AFTER knownTitles; diff --git a/sql/updates/3.3.3a_old/7928_world_quest_template.sql b/sql/updates/3.3.3a_old/7928_world_quest_template.sql new file mode 100644 index 0000000..dbfceef --- /dev/null +++ b/sql/updates/3.3.3a_old/7928_world_quest_template.sql @@ -0,0 +1 @@ +ALTER TABLE `quest_template` CHANGE COLUMN `QuestFlags` `QuestFlags` int(6) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.3.3a_old/7930_world_scriptname.sql b/sql/updates/3.3.3a_old/7930_world_scriptname.sql new file mode 100644 index 0000000..c94162e --- /dev/null +++ b/sql/updates/3.3.3a_old/7930_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`= 'npc_alorah_and_grimmin' WHERE `entry` IN (36101,36102); \ No newline at end of file diff --git a/sql/updates/3.3.3a_old/7963_world_scriptname.sql b/sql/updates/3.3.3a_old/7963_world_scriptname.sql new file mode 100644 index 0000000..8a6136c --- /dev/null +++ b/sql/updates/3.3.3a_old/7963_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_locksmith' WHERE `entry` IN (29665,29725,29728); diff --git a/sql/updates/3.3.3a_old/7973_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/7973_world_spell_proc_event.sql new file mode 100644 index 0000000..9092729 --- /dev/null +++ b/sql/updates/3.3.3a_old/7973_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (67771,67702); +INSERT INTO `spell_proc_event` VALUES (67771,1,0,0,0,0,0x0851154,0x03,0,35,45), (67702,1,0,0,0,0,0x0851154,0x03,0,35,45); diff --git a/sql/updates/3.3.3a_old/7974_characters_character_aura.sql b/sql/updates/3.3.3a_old/7974_characters_character_aura.sql new file mode 100644 index 0000000..3ea3fcb --- /dev/null +++ b/sql/updates/3.3.3a_old/7974_characters_character_aura.sql @@ -0,0 +1,2 @@ +ALTER TABLE `character_aura` DROP PRIMARY KEY, +ADD PRIMARY KEY (`guid`,`caster_guid`,`spell`,`effect_mask`); diff --git a/sql/updates/3.3.3a_old/7981_world_season_linked_event.sql b/sql/updates/3.3.3a_old/7981_world_season_linked_event.sql new file mode 100644 index 0000000..b61d9f0 --- /dev/null +++ b/sql/updates/3.3.3a_old/7981_world_season_linked_event.sql @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS `season_linked_event`; +CREATE TABLE `season_linked_event` ( + `season` int(3) UNSIGNED NOT NULL default '0', + `event` int(8) UNSIGNED NOT NULL default '0', + PRIMARY KEY (`season`), + UNIQUE (`season`,`event`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.3.3a_old/7982_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/7982_world_spell_proc_event.sql new file mode 100644 index 0000000..0f21c88 --- /dev/null +++ b/sql/updates/3.3.3a_old/7982_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +-- Make Divine Guardian proc on Divine Sacrifice only +DELETE FROM `spell_proc_event` WHERE `entry`=53530; +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +(53530,1,10,0x0000,0x0000,0x0004,0x0400,0x0001,0,100,0); diff --git a/sql/updates/3.3.3a_old/7988_world_scriptname.sql b/sql/updates/3.3.3a_old/7988_world_scriptname.sql new file mode 100644 index 0000000..1b90f91 --- /dev/null +++ b/sql/updates/3.3.3a_old/7988_world_scriptname.sql @@ -0,0 +1,6 @@ +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (5332,5338,5334,5340); +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES +(5332,'at_last_rites'), +(5338,'at_last_rites'), +(5334,'at_last_rites'), +(5340,'at_last_rites'); diff --git a/sql/updates/3.3.3a_old/8004_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8004_world_spell_proc_event.sql new file mode 100644 index 0000000..9af9a15 --- /dev/null +++ b/sql/updates/3.3.3a_old/8004_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` in (67365,53527,54925); +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +(67365,2,10,0,0x0800,0,0x040000,0,0,70,6), +(53527,1,10,0,0,0x0004,0x0400,0x0001,0,100,0), +(54925,2,10,0,0x0200,0,0,0,0,0,0); diff --git a/sql/updates/3.3.3a_old/8006_world_quest_template.sql b/sql/updates/3.3.3a_old/8006_world_quest_template.sql new file mode 100644 index 0000000..0a85d50 --- /dev/null +++ b/sql/updates/3.3.3a_old/8006_world_quest_template.sql @@ -0,0 +1 @@ +ALTER TABLE `quest_template` CHANGE COLUMN `QuestFlags` `QuestFlags` int(10) unsigned NOT NULL default '0'; diff --git a/sql/updates/3.3.3a_old/8020_characters_item_refund_instance.sql b/sql/updates/3.3.3a_old/8020_characters_item_refund_instance.sql new file mode 100644 index 0000000..1c79d39 --- /dev/null +++ b/sql/updates/3.3.3a_old/8020_characters_item_refund_instance.sql @@ -0,0 +1,2 @@ +ALTER TABLE `item_refund_instance` +ADD `count` int(10) UNSIGNED NOT NULL DEFAULT 1 AFTER `item_guid`; diff --git a/sql/updates/3.3.3a_old/8041_world_scriptname.sql b/sql/updates/3.3.3a_old/8041_world_scriptname.sql new file mode 100644 index 0000000..b08f7db --- /dev/null +++ b/sql/updates/3.3.3a_old/8041_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_tabard_vendor' WHERE `entry`=28776; diff --git a/sql/updates/3.3.3a_old/8044_world_script_texts.sql b/sql/updates/3.3.3a_old/8044_world_script_texts.sql new file mode 100644 index 0000000..cb46719 --- /dev/null +++ b/sql/updates/3.3.3a_old/8044_world_script_texts.sql @@ -0,0 +1,30 @@ +DELETE FROM `script_texts` WHERE `npc_entry` IN (27316,27577); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2` ,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(27316,-1800041, 'Let''s you and I have a chat about some things,Godfrey.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800040, 'Return to Halford with the information the good mayor was kind enough to submit,$N,I will finish here and squeeze whatever else this wretch might know about Thel''zan. Now,I will show Godfrey the rarely shown "option three." ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800039, 'You let us worry about how we kill the bastard,Godfrey. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800036, 'What? There is a mausoleum beneath the old village? What fools we are to not have noticed. We will find and strike down your master now,Godfrey. We will end this nightmare. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800033, 'RUBBISH! Godfrey do you take me for a fool? Do not spew your Scourge propaganda at a man of the Light,heathen! Speak now or I will have the peasants craft a holy water bath and dip you into it like a dog with fleas! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800031, 'I thought you would see the Light,Godfrey... Now speak quickly,fiend. What does it say? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800030, 'The power of the Lich King pales in comparison to the glory of the Light! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800029, 'LIGHT TAKE YOU,BEAST! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800027, 'LET THE LIGHT IN,GODFREY GODDARD! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800026, 'May the power of Light compel you! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800024, 'LET THE LIGHT IN,GODFREY GODDARD! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800023, 'Let the sermon begin.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800022, 'I say a prayer for you now,lost soul. May the Light take you gracefully. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800021, 'Then it is option two. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800016, 'Good,I have your attention,then,Godfrey? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800015, 'GODFREY! Hear me,fiend! Hear me,for I am the Light,here to deliver you from evil! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800014, 'Stand back,$N,the beast might lash out and harm you. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27316,-1800017, 'We can do this in one of two ways,Godfrey. First,I will simply ask you to tell me what the unholy markings etched upon the pages of this tome mean. What say you? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800038, 'You cannot stop Thel''zan! He bears the dark gift,bestowed upon him by the Lich King himself! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800037, 'How? Humans truly are stupid,yes? Thel''zan the Duskbringer! Thel''zan the Lich! He who is born of human flesh and bone,sacrificed all power,protected by the Lich King! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800035, 'Humans... Beneath the earth of Wintergarde Village you built a mausoleum! Why do you think Naxxramas attacked that spot? Thel''zan hides deep in your own crypt and sends a thousand-thousand corpses at you! Perish you will... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800034, 'NOOOO!!! I tell you! I tell you everything! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800032, 'It tells of the coming apocalypse. How this world will burn and be reborn from death. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800028, 'Never felt hurt like this! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800025, 'IT BURNSSSSS! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800020, 'The book is your salvation,yes... but nothing will you know. NOTHING I SAY! NOTHING! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800019, 'What can you do to me that Kel''Thuzad has not? That the Lich King will not? ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL), +(27577,-1800018, 'Tell you nothing,preacher. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,NULL); diff --git a/sql/updates/3.3.3a_old/8044_world_script_waypoints.sql b/sql/updates/3.3.3a_old/8044_world_script_waypoints.sql new file mode 100644 index 0000000..a052751 --- /dev/null +++ b/sql/updates/3.3.3a_old/8044_world_script_waypoints.sql @@ -0,0 +1,29 @@ +DELETE FROM `script_waypoint` WHERE `entry`=27316; +INSERT INTO `script_waypoint` (`entry`,`pointid`,`location_x`,`location_y`,`location_z`,`waittime`,`point_comment`) VALUES +(27316,1,3801.11,-678.964,213.753,5000, ''), +(27316,2,3801.11,-678.964,213.753,5000, ''), +(27316,3,3801.11,-678.964,213.753,5000, ''), +(27316,4,3801.11,-678.964,213.753,5000, ''), +(27316,5,3801.11,-678.964,213.753,5000, ''), +(27316,6,3801.11,-678.964,213.753,5000, ''), +(27316,7,3801.11,-678.964,213.753,5000, ''), +(27316,8,3801.11,-678.964,213.753,5000, ''), +(27316,9,3801.11,-678.964,213.753,5000, ''), +(27316,10,3801.11,-678.964,213.753,5000, ''), +(27316,11,3801.11,-678.964,213.753,5000, ''), +(27316,12,3801.11,-678.964,213.753,5000, ''), +(27316,13,3801.11,-678.964,213.753,5000, ''), +(27316,14,3801.11,-678.964,213.753,5000, ''), +(27316,15,3801.11,-678.964,213.753,5000, ''), +(27316,16,3801.11,-678.964,213.753,5000, ''), +(27316,17,3801.11,-678.964,213.753,5000, ''), +(27316,18,3801.11,-678.964,213.753,5000, ''), +(27316,19,3801.11,-678.964,213.753,5000, ''), +(27316,20,3801.11,-678.964,213.753,5000, ''), +(27316,21,3801.11,-678.964,213.753,5000, ''), +(27316,22,3801.11,-678.964,213.753,5000, ''), +(27316,23,3801.11,-678.964,213.753,5000, ''), +(27316,24,3801.11,-678.964,213.753,5000, ''), +(27316,25,3801.11,-678.964,213.753,5000, ''), +(27316,26,3801.11,-678.964,213.753,5000, ''), +(27316,27,3801.11,-678.964,213.753,10000, ''); diff --git a/sql/updates/3.3.3a_old/8044_world_scriptname.sql b/sql/updates/3.3.3a_old/8044_world_scriptname.sql new file mode 100644 index 0000000..04e3635 --- /dev/null +++ b/sql/updates/3.3.3a_old/8044_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_inquisitor_hallard' WHERE `entry`=27316; diff --git a/sql/updates/3.3.3a_old/8048_characters_item_refund_instance.sql b/sql/updates/3.3.3a_old/8048_characters_item_refund_instance.sql new file mode 100644 index 0000000..c873fc4 --- /dev/null +++ b/sql/updates/3.3.3a_old/8048_characters_item_refund_instance.sql @@ -0,0 +1 @@ +ALTER TABLE `item_refund_instance` DROP COLUMN `count`; diff --git a/sql/updates/3.3.3a_old/8049_world_npc_vendor.sql b/sql/updates/3.3.3a_old/8049_world_npc_vendor.sql new file mode 100644 index 0000000..c09d579 --- /dev/null +++ b/sql/updates/3.3.3a_old/8049_world_npc_vendor.sql @@ -0,0 +1,2 @@ +ALTER TABLE npc_vendor DROP PRIMARY KEY, +ADD PRIMARY KEY (`entry`,`item`,`ExtendedCost`); diff --git a/sql/updates/3.3.3a_old/8049_world_trinity_strings.sql b/sql/updates/3.3.3a_old/8049_world_trinity_strings.sql new file mode 100644 index 0000000..e04e776 --- /dev/null +++ b/sql/updates/3.3.3a_old/8049_world_trinity_strings.sql @@ -0,0 +1,3 @@ +DELETE FROM trinity_string WHERE entry in (210); +INSERT INTO trinity_string VALUES +(210,'Item ''%i'' (with extended cost %u) already in vendor list', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/3.3.3a_old/8051_world_script_texts.sql b/sql/updates/3.3.3a_old/8051_world_script_texts.sql new file mode 100644 index 0000000..ca1a8d5 --- /dev/null +++ b/sql/updates/3.3.3a_old/8051_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=27463; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(27463, -1800046, 'Thank you. $Class!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'RANDOM_SAY_3'), +(27463, -1800045, 'Whoa.. i nearly died there. Thank you, $Race!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'RANDOM_SAY_2'), +(27463, -1800044, 'Ahh..better..', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 'RANDOM_SAY_1'); diff --git a/sql/updates/3.3.3a_old/8051_world_scriptname.sql b/sql/updates/3.3.3a_old/8051_world_scriptname.sql new file mode 100644 index 0000000..6e6656d --- /dev/null +++ b/sql/updates/3.3.3a_old/8051_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_wounded_skirmisher' WHERE `entry`=27463; diff --git a/sql/updates/3.3.3a_old/8052_world_script_texts.sql b/sql/updates/3.3.3a_old/8052_world_script_texts.sql new file mode 100644 index 0000000..986e385 --- /dev/null +++ b/sql/updates/3.3.3a_old/8052_world_script_texts.sql @@ -0,0 +1,4 @@ +DELETE FROM `script_texts` WHERE `npc_entry`= 29434; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +('29434', '-1800042', 'Let me know when you''re ready. I''d prefer sooner than later... what with the slowly dying from poison and all. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '0', '0', '0', 'injured goblin SAY_QUEST_START'), +('29434', '-1800043', 'I''m going to bring the venom sack to Ricket... and then... you know... collapse. Thank you for helping me! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '0', '0', '0', 'injured goblin SAY_END_WP_REACHED'); diff --git a/sql/updates/3.3.3a_old/8052_world_script_waypoint.sql b/sql/updates/3.3.3a_old/8052_world_script_waypoint.sql new file mode 100644 index 0000000..3771317 --- /dev/null +++ b/sql/updates/3.3.3a_old/8052_world_script_waypoint.sql @@ -0,0 +1,29 @@ +DELETE FROM `script_waypoint` WHERE `entry` =29434; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(29434, 1, 6645.47, -1263.66, 396.938, 0, ''), +(29434, 2, 6662.06, -1274.13, 397.319, 0, ''), +(29434, 3, 6666.29, -1254.59, 396.11, 0, ''), +(29434, 4, 6669.33, -1240.06, 397.789, 0, ''), +(29434, 5, 6654.31, -1205.01, 399.823, 0, ''), +(29434, 6, 6657.03, -1170.15, 398.755, 0, ''), +(29434, 7, 6667.33, -1146.28, 399.014, 0, ''), +(29434, 8, 6670.9, -1138.68, 397.125, 0, ''), +(29434, 9, 6685.09, -1103.95, 396.828, 0, ''), +(29434, 10, 6688.71, -1094.32, 395.019, 0, ''), +(29434, 11, 6684.75, -1084.31, 396.916, 0, ''), +(29434, 12, 6679.3, -1074.4, 404.284, 0, ''), +(29434, 13, 6691.91, -1051.96, 407.983, 0, ''), +(29434, 14, 6696.28, -1016.54, 414.823, 0, ''), +(29434, 15, 6675.32, -1005.06, 414.844, 0, ''), +(29434, 16, 6661.01, -1007.41, 414.946, 0, ''), +(29434, 17, 6643.75, -1010.24, 420.508, 0, ''), +(29434, 18, 6620.76, -1012.59, 424.378, 0, ''), +(29434, 19, 6610.33, -996.992, 428.116, 0, ''), +(29434, 20, 6581.3, -1005.9, 434.257, 0, ''), +(29434, 21, 6570.74, -1013, 434.076, 0, ''), +(29434, 22, 6551.68, -1012.38, 433.218, 0, ''), +(29434, 23, 6530.83, -1024.99, 433.04, 0, ''), +(29434, 24, 6510.05, -1031.23, 435.824, 0, ''), +(29434, 25, 6491.5, -1032.46, 434.226, 0, ''), +(29434, 26, 6475.58, -1023.13, 434.759, 0, ''), +(29434, 27, 6451.81, -1025.43, 431.502, 10000, ''); diff --git a/sql/updates/3.3.3a_old/8052_world_scriptname.sql b/sql/updates/3.3.3a_old/8052_world_scriptname.sql new file mode 100644 index 0000000..4121d15 --- /dev/null +++ b/sql/updates/3.3.3a_old/8052_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_injured_goblin' WHERE `entry`=29434; diff --git a/sql/updates/3.3.3a_old/8054_world_script_waypoint.sql b/sql/updates/3.3.3a_old/8054_world_script_waypoint.sql new file mode 100644 index 0000000..d87926d --- /dev/null +++ b/sql/updates/3.3.3a_old/8054_world_script_waypoint.sql @@ -0,0 +1,28 @@ +DELETE FROM `script_waypoint` WHERE `entry`=17238; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(17238, 1, 953.061, -1432.52, 63.2255, 0, ''), +(17238, 2, 969.607, -1438.15, 65.3669, 0, ''), +(17238, 3, 980.073, -1441.5, 65.3997, 0, ''), +(17238, 4, 995.001, -1450.47, 61.3227, 0, ''), +(17238, 5, 1032.7, -1473.49, 63.7699, 0, ''), +(17238, 6, 1039.69, -1491.42, 65.2801, 0, ''), +(17238, 7, 1038.8, -1523.32, 64.4661, 0, ''), +(17238, 8, 1035.43, -1572.97, 61.5412, 0, ''), +(17238, 9, 1034.45, -1612.83, 61.6186, 0, ''), +(17238, 10, 1040.12, -1663.41, 60.923, 0, ''), +(17238, 11, 1059.75, -1703.75, 60.5768, 0, ''), +(17238, 12, 1091.83, -1735.24, 60.8057, 0, ''), +(17238, 13, 1131.75, -1755.32, 61.0073, 0, ''), +(17238, 14, 1159.77, -1762.64, 60.5699, 0, ''), +(17238, 15, 1153.79, -1772, 60.6475, 0, ''), +(17238, 16, 1115.4, -1787.21, 61.0759, 0, ''), +(17238, 17, 1091.88, -1799.06, 61.6055, 0, ''), +(17238, 18, 1056.22, -1805.65, 71.8112, 0, ''), +(17238, 19, 1024.03, -1807.93, 77.025, 0, ''), +(17238, 20, 1012.74, -1811.67, 77.5636, 0, ''), +(17238, 21, 1006.74, -1813.59, 80.4872, 0, ''), +(17238, 22, 983.15, -1823.05, 80.4872, 0, ''), +(17238, 23, 974.954, -1825.33, 81.3482, 5000, ''), +(17238, 24, 974.954, -1825.33, 81.3482, 5000, ''), +(17238, 25, 974.954, -1825.33, 81.3482, 5000, ''), +(17238, 26, 974.954, -1825.33, 81.3482, 5000, ''); diff --git a/sql/updates/3.3.3a_old/8054_world_scriptname.sql b/sql/updates/3.3.3a_old/8054_world_scriptname.sql new file mode 100644 index 0000000..8dc37bb --- /dev/null +++ b/sql/updates/3.3.3a_old/8054_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_anchorite_truuen' WHERE `entry`=17238; diff --git a/sql/updates/3.3.3a_old/8057_world_game_event_npc_vendor.sql b/sql/updates/3.3.3a_old/8057_world_game_event_npc_vendor.sql new file mode 100644 index 0000000..9292339 --- /dev/null +++ b/sql/updates/3.3.3a_old/8057_world_game_event_npc_vendor.sql @@ -0,0 +1,2 @@ +ALTER TABLE `game_event_npc_vendor` ADD `slot` SMALLINT(6) NOT NULL DEFAULT '0' AFTER `guid`; +ALTER TABLE `game_event_npc_vendor` ADD INDEX (`slot`); diff --git a/sql/updates/3.3.3a_old/8057_world_npc_vendor.sql b/sql/updates/3.3.3a_old/8057_world_npc_vendor.sql new file mode 100644 index 0000000..7703e03 --- /dev/null +++ b/sql/updates/3.3.3a_old/8057_world_npc_vendor.sql @@ -0,0 +1,2 @@ +ALTER TABLE `npc_vendor` ADD `slot` SMALLINT(6) NOT NULL DEFAULT '0' AFTER `entry`; +ALTER TABLE `npc_vendor` ADD INDEX (`slot`); diff --git a/sql/updates/3.3.3a_old/8058_world_scriptname.sql b/sql/updates/3.3.3a_old/8058_world_scriptname.sql new file mode 100644 index 0000000..9238001 --- /dev/null +++ b/sql/updates/3.3.3a_old/8058_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `item_template` SET `ScriptName`='item_Trident_of_Nazjan' WHERE `entry`=35850; diff --git a/sql/updates/3.3.3a_old/8060_world_script_waypoint.sql b/sql/updates/3.3.3a_old/8060_world_script_waypoint.sql new file mode 100644 index 0000000..a9b7e8e --- /dev/null +++ b/sql/updates/3.3.3a_old/8060_world_script_waypoint.sql @@ -0,0 +1,18 @@ +DELETE FROM `script_waypoint` WHERE `entry`=5644; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(5644, 1, -339.679, 1752.04, 139.482, 0, ''), +(5644, 2, -328.957, 1734.95, 139.327, 0, ''), +(5644, 3, -350.747, 1731.12, 139.338, 0, ''), +(5644, 4, -365.064, 1739.04, 139.376, 0, ''), +(5644, 5, -371.105, 1746.03, 139.374, 0, ''), +(5644, 6, -383.141, 1738.62, 138.93, 0, ''), +(5644, 7, -390.445, 1733.98, 136.353, 0, ''), +(5644, 8, -401.368, 1726.77, 131.071, 0, ''), +(5644, 9, -416.016, 1721.19, 129.807, 0, ''), +(5644, 10, -437.139, 1709.82, 126.342, 0, ''), +(5644, 11, -459.862, 1687.92, 116.059, 0, ''), +(5644, 12, -460.686, 1679.55, 111.976, 0, ''), +(5644, 13, -461.485, 1670.94, 109.033, 0, ''), +(5644, 14, -468.53, 1645.51, 102.811, 0, ''), +(5644, 15, -474.529, 1615.97, 97.228, 0, ''), +(5644, 16, -474.329, 1590.01, 94.4982, 0, ''); diff --git a/sql/updates/3.3.3a_old/8060_world_scriptname.sql b/sql/updates/3.3.3a_old/8060_world_scriptname.sql new file mode 100644 index 0000000..d7653f5 --- /dev/null +++ b/sql/updates/3.3.3a_old/8060_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_dalinda' WHERE `entry`=5644; diff --git a/sql/updates/3.3.3a_old/8062_world_script_texts.sql b/sql/updates/3.3.3a_old/8062_world_script_texts.sql new file mode 100644 index 0000000..e9c9083 --- /dev/null +++ b/sql/updates/3.3.3a_old/8062_world_script_texts.sql @@ -0,0 +1,9 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=28787; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(28787, -1800047, 'Let''s get the hell out of here', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), +(28787, -1800048, 'Listen up, Venture Company goons! Rule #1: Never keep the prisoner near the explosives.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), +(28787, -1800049, 'Or THIS is what you get. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), +(28787, -1800050, 'It''s getting a little hot over here. Shall we move on? ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), +(28787, -1800051, 'Oh, look, it''s another cartload of explosives! Let''s help them dispose of it. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), +(28787, -1800052, 'You really shouldn''t play with this stuff. Someone could get hurt.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL), +(28787, -1800053, 'We made it! Thank you for getting me out of that hell hole. Tell Hemet to expect me! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL); diff --git a/sql/updates/3.3.3a_old/8062_world_script_waypoint.sql b/sql/updates/3.3.3a_old/8062_world_script_waypoint.sql new file mode 100644 index 0000000..45a5bed --- /dev/null +++ b/sql/updates/3.3.3a_old/8062_world_script_waypoint.sql @@ -0,0 +1,16 @@ +DELETE FROM `script_waypoint` WHERE `entry` =28787; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(28787, 0, 5919.43, 5374.88, -98.8816, 5000, ''), +(28787, 1, 5919.43, 5374.88, -98.8816, 5000, ''), +(28787, 2, 5925.17, 5372.37, -98.8815, 0, ''), +(28787, 3, 5928.32, 5377, -99.0266, 0, ''), +(28787, 4, 5917.24, 5383.36, -106.31, 0, ''), +(28787, 5, 5907.49, 5389.62, -106.31, 0, ''), +(28787, 6, 5899.66, 5405.25, -96.5535, 0, ''), +(28787, 7, 5890.27, 5395.42, -95.5519, 0, ''), +(28787, 8, 5887.57, 5384.4, -95.4326, 5000, ''), +(28787, 9, 5878.52, 5384.61, -93.3333, 0, ''), +(28787, 10, 5873.17, 5360.43, -98.4124, 0, ''), +(28787, 11, 5859.23, 5353.29, -98.8777, 0, ''), +(28787, 12, 5841.27, 5334.14, -100.446, 0, ''), +(28787, 13, 5819.81, 5300.27, -96.8567, 0, ''); diff --git a/sql/updates/3.3.3a_old/8062_world_scriptname.sql b/sql/updates/3.3.3a_old/8062_world_scriptname.sql new file mode 100644 index 0000000..b8d2309 --- /dev/null +++ b/sql/updates/3.3.3a_old/8062_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_engineer_helice' WHERE `entry`=28787; diff --git a/sql/updates/3.3.3a_old/8063_world_scriptname.sql b/sql/updates/3.3.3a_old/8063_world_scriptname.sql new file mode 100644 index 0000000..cc52638 --- /dev/null +++ b/sql/updates/3.3.3a_old/8063_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_ogre_brute' WHERE `entry`=19995; +UPDATE `creature_template` SET `ScriptName`='npc_bloodmaul_brutebane' WHERE `entry`=21241; diff --git a/sql/updates/3.3.3a_old/8073_world_scriptname.sql b/sql/updates/3.3.3a_old/8073_world_scriptname.sql new file mode 100644 index 0000000..e341a45 --- /dev/null +++ b/sql/updates/3.3.3a_old/8073_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_scourge_enclosure' WHERE `entry`=191548; diff --git a/sql/updates/3.3.3a_old/8088_world_scriptname.sql b/sql/updates/3.3.3a_old/8088_world_scriptname.sql new file mode 100644 index 0000000..149ee5a --- /dev/null +++ b/sql/updates/3.3.3a_old/8088_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_hive_pod' WHERE `entry`=178553; diff --git a/sql/updates/3.3.3a_old/8089_world_script_texts.sql b/sql/updates/3.3.3a_old/8089_world_script_texts.sql new file mode 100644 index 0000000..39807df --- /dev/null +++ b/sql/updates/3.3.3a_old/8089_world_script_texts.sql @@ -0,0 +1,12 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=12717; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +(12717, -1800054, 'Are you sure that you are ready? If we do not have a group of your allies to aid us, we will surely fail.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_START1'), +(12717, -1800055, 'This will be a though fight, $N. Follow me closely.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_START2'), +(12717, -1800056, 'This is the brazier, $N. Put it out. Vorsha is a beast, worthy of praise from no one!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_BRAZIER'), +(12717, -1800057, 'Now we must wait. It won''t be long before the naga realize what we have done.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_BRAZIER_WAIT'), +(12717, -1800058, 'Be on your guard, $N!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_ON_GUARD'), +(12717, -1800059, 'Perhaps we will get a moment to rest. But I will not give up until we have faced off against Vorsha!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_REST'), +(12717, -1800060, 'We have done it!', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_DONE'), +(12717, -1800061, 'You have my deepest gratitude. I thank you.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_GRATITUDE'), +(12717, -1800062, 'I am going to patrol the area for a while longer and ensure that things are truly safe.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_PATROL'), +(12717, -1800063, 'Please return to Zoram''gar and report our success to the Warsong runner.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 1, 0, 'muglash SAY_MUG_RETURN'); diff --git a/sql/updates/3.3.3a_old/8089_world_script_waypoint.sql b/sql/updates/3.3.3a_old/8089_world_script_waypoint.sql new file mode 100644 index 0000000..7cd2f1a --- /dev/null +++ b/sql/updates/3.3.3a_old/8089_world_script_waypoint.sql @@ -0,0 +1,32 @@ +DELETE FROM `script_waypoint` WHERE `entry`=12717; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`,`location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(12717, 0, 3346.25, 1007.88, 3.59, 0, 'SAY_MUG_START2'), +(12717, 1, 3367.39, 1011.51, 3.72, 0, ''), +(12717, 2, 3418.64, 1013.96, 2.905, 0, ''), +(12717, 3, 3426.84, 1015.1, 3.449, 0, ''), +(12717, 4, 3437.03, 1020.79, 2.742, 0, ''), +(12717, 5, 3460.56, 1024.26, 1.353, 0, ''), +(12717, 6, 3479.87, 1037.96, 1.023, 0, ''), +(12717, 7, 3490.53, 1043.35, 3.338, 0, ''), +(12717, 8, 3504.28, 1047.77, 8.205, 0, ''), +(12717, 9, 3510.73, 1049.79, 12.143, 0, ''), +(12717, 10, 3514.41, 1051.17, 13.235, 0, ''), +(12717, 11, 3516.94, 1052.91, 12.918, 0, ''), +(12717, 12, 3523.64, 1056.3, 7.563, 0, ''), +(12717, 13, 3531.94, 1059.86, 6.175, 0, ''), +(12717, 14, 3535.48, 1069.96, 1.697, 0, ''), +(12717, 15, 3546.98, 1093.49, 0.68, 0, ''), +(12717, 16, 3549.73, 1101.88, -1.123, 0, ''), +(12717, 17, 3555.14, 1116.99, -4.326, 0, ''), +(12717, 18, 3571.94, 1132.18, -0.634, 0, ''), +(12717, 19, 3574.28, 1137.58, 3.684, 0, ''), +(12717, 20, 3579.31, 1137.25, 8.205, 0, ''), +(12717, 21, 3590.22, 1143.65, 8.291, 0, ''), +(12717, 22, 3595.97, 1145.83, 6.773, 0, ''), +(12717, 23, 3603.65, 1146.92, 9.763, 0, ''), +(12717, 24, 3607.08, 1146.01, 10.692, 5000, 'SAY_MUG_BRAZIER'), +(12717, 25, 3614.52, 1142.63, 10.248, 0, ''), +(12717, 26, 3616.66, 1140.84, 10.682, 3000, 'SAY_MUG_PATROL'), +(12717, 27, 3621.08, 1138.11, 10.369, 0, 'SAY_MUG_RETURN'), +(12717, 28, 3615.48, 1145.53, 9.614, 0, ''), +(12717, 29, 3607.19, 1152.72, 8.871, 0, ''); diff --git a/sql/updates/3.3.3a_old/8089_world_scriptname.sql b/sql/updates/3.3.3a_old/8089_world_scriptname.sql new file mode 100644 index 0000000..7797758 --- /dev/null +++ b/sql/updates/3.3.3a_old/8089_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_naga_brazier' WHERE `entry`=178247; +UPDATE `creature_template` SET `ScriptName`='npc_muglash' WHERE `entry`=12717; diff --git a/sql/updates/3.3.3a_old/8109_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8109_world_spell_proc_event.sql new file mode 100644 index 0000000..6776cf4 --- /dev/null +++ b/sql/updates/3.3.3a_old/8109_world_spell_proc_event.sql @@ -0,0 +1,6 @@ +-- Arcane Empowerment proc event +DELETE FROM spell_proc_event WHERE entry IN (31583, 31582, 31579); +INSERT INTO spell_proc_event (entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown) VALUES +(31583,0,3,0x20201000,0x8000,0x0,0x00010000,0x0000002,0,0,0), +(31582,0,3,0x20201000,0x8000,0x0,0x00010000,0x0000002,0,0,0), +(31579,0,3,0x20201000,0x8000,0x0,0x00010000,0x0000002,0,0,0); diff --git a/sql/updates/3.3.3a_old/8111_realmd_account_access.sql b/sql/updates/3.3.3a_old/8111_realmd_account_access.sql new file mode 100644 index 0000000..82f9811 --- /dev/null +++ b/sql/updates/3.3.3a_old/8111_realmd_account_access.sql @@ -0,0 +1 @@ +ALTER TABLE `account_access` CHANGE `RealmID` `RealmID` INT(11) NOT NULL DEFAULT '-1'; diff --git a/sql/updates/3.3.3a_old/8116_characters_groups.sql b/sql/updates/3.3.3a_old/8116_characters_groups.sql new file mode 100644 index 0000000..a75bb27 --- /dev/null +++ b/sql/updates/3.3.3a_old/8116_characters_groups.sql @@ -0,0 +1,2 @@ +ALTER TABLE `groups` CHANGE `isRaid` `groupType` MEDIUMINT(8) UNSIGNED NOT NULL; +UPDATE `groups` SET `groupType`=2 where `groupType`=1; diff --git a/sql/updates/3.3.3a_old/8122_world_scriptname.sql b/sql/updates/3.3.3a_old/8122_world_scriptname.sql new file mode 100644 index 0000000..b5ee816 --- /dev/null +++ b/sql/updates/3.3.3a_old/8122_world_scriptname.sql @@ -0,0 +1,17 @@ +DELETE FROM `areatrigger_scripts` WHERE `entry` BETWEEN 1726 AND 1740; +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES +(1726, 'at_scent_larkorwi'), +(1727, 'at_scent_larkorwi'), +(1728, 'at_scent_larkorwi'), +(1729, 'at_scent_larkorwi'), +(1730, 'at_scent_larkorwi'), +(1731, 'at_scent_larkorwi'), +(1732, 'at_scent_larkorwi'), +(1733, 'at_scent_larkorwi'), +(1734, 'at_scent_larkorwi'), +(1735, 'at_scent_larkorwi'), +(1736, 'at_scent_larkorwi'), +(1737, 'at_scent_larkorwi'), +(1738, 'at_scent_larkorwi'), +(1739, 'at_scent_larkorwi'), +(1740, 'at_scent_larkorwi'); diff --git a/sql/updates/3.3.3a_old/8136_01_characters_groups.sql b/sql/updates/3.3.3a_old/8136_01_characters_groups.sql new file mode 100644 index 0000000..af0f6cb --- /dev/null +++ b/sql/updates/3.3.3a_old/8136_01_characters_groups.sql @@ -0,0 +1,5 @@ +-- Create guid column and make it new pk +ALTER TABLE `groups` ADD `guid` INT(11) NOT NULL FIRST; +SET @a := 0; +UPDATE `groups` SET `guid` = @a := @a+1; +ALTER TABLE `groups` DROP PRIMARY KEY, ADD PRIMARY KEY (`guid`); diff --git a/sql/updates/3.3.3a_old/8136_02_characters_group_member.sql b/sql/updates/3.3.3a_old/8136_02_characters_group_member.sql new file mode 100644 index 0000000..7300e34 --- /dev/null +++ b/sql/updates/3.3.3a_old/8136_02_characters_group_member.sql @@ -0,0 +1,8 @@ +-- Create guid column +ALTER TABLE `group_member` ADD `guid` INT(11) NOT NULL FIRST; +-- populate column +UPDATE `group_member` SET `guid`=(SELECT `groups`.`guid` FROM `groups` WHERE `leaderGuid`=`group_member`.`leaderGuid`); +-- Remove index that will be same as pk +ALTER TABLE `group_member` DROP INDEX `Idx_memberGuid` ; +-- NOTE: if this one fails then u have a problem in your DB. Have a member in 2 groups, so fix it yourself and then re-run this one +ALTER TABLE `group_member` DROP `leaderGuid`; diff --git a/sql/updates/3.3.3a_old/8136_03_characters_group_instance.sql b/sql/updates/3.3.3a_old/8136_03_characters_group_instance.sql new file mode 100644 index 0000000..78601c1 --- /dev/null +++ b/sql/updates/3.3.3a_old/8136_03_characters_group_instance.sql @@ -0,0 +1,8 @@ +-- Create guid column +ALTER TABLE `group_instance` ADD `guid` INT(11) NOT NULL FIRST; +-- populate column +UPDATE `group_instance` SET `guid`=(SELECT `groups`.`guid` FROM `groups` WHERE `leaderGuid`=`group_instance`.`leaderGuid`); +-- Update pk +ALTER TABLE `group_instance` DROP PRIMARY KEY, ADD PRIMARY KEY (`guid`, `instance`); +-- Remove unused column leaderguid +ALTER TABLE `group_instance` DROP `leaderGuid`; diff --git a/sql/updates/3.3.3a_old/8140_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8140_world_spell_proc_event.sql new file mode 100644 index 0000000..1d569aa --- /dev/null +++ b/sql/updates/3.3.3a_old/8140_world_spell_proc_event.sql @@ -0,0 +1,2 @@ +-- Undo 8109 +DELETE FROM `spell_proc_event` WHERE `entry` IN (31583,31582,31579); diff --git a/sql/updates/3.3.3a_old/8156_world_scriptname.sql b/sql/updates/3.3.3a_old/8156_world_scriptname.sql new file mode 100644 index 0000000..e998312 --- /dev/null +++ b/sql/updates/3.3.3a_old/8156_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_experience'WHERE `entry` IN (35364,35365); diff --git a/sql/updates/3.3.3a_old/8179_world_script_texts.sql b/sql/updates/3.3.3a_old/8179_world_script_texts.sql new file mode 100644 index 0000000..877bdd4 --- /dev/null +++ b/sql/updates/3.3.3a_old/8179_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1571039,-1571040,-1571041); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (30014,-1571039,'Yggdras emerges!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0,''), + (30017,-1571040,'Stinkbeard comin'' for you, little ones!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (30007,-1571041,'Do you fell that folks? The air is cracking with energy! Than can only mean one thing...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); diff --git a/sql/updates/3.3.3a_old/8179_world_scriptname.sql b/sql/updates/3.3.3a_old/8179_world_scriptname.sql new file mode 100644 index 0000000..4ecf2ec --- /dev/null +++ b/sql/updates/3.3.3a_old/8179_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_elemental_lord' WHERE `entry` IN (30024,30025,30019,30026); +UPDATE `creature_template` SET `ScriptName`='npc_fiend_elemental' WHERE `entry` IN (30044,30042,30043,30045); diff --git a/sql/updates/3.3.3a_old/8191_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8191_world_spell_proc_event.sql new file mode 100644 index 0000000..5b1fac4 --- /dev/null +++ b/sql/updates/3.3.3a_old/8191_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM spell_proc_event WHERE entry = 63320; +INSERT INTO spell_proc_event (entry, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags) VALUES +(63320, 5, 0x80040000, 0x00000000, 0x00008000, 0x00000400); -- Life Tap, Dark Pact diff --git a/sql/updates/3.3.3a_old/8197_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8197_world_spell_bonus_data.sql new file mode 100644 index 0000000..2a6deb4 --- /dev/null +++ b/sql/updates/3.3.3a_old/8197_world_spell_bonus_data.sql @@ -0,0 +1,3 @@ +DELETE FROM spell_bonus_data WHERE entry = 52042; +INSERT INTO spell_bonus_data (entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus, comments) VALUES +(52042, 0.0445, 0.0445, -1, -1, 'Shaman - Healing Stream Totem Triggered Heal'); diff --git a/sql/updates/3.3.3a_old/8198_world_quest_template.sql b/sql/updates/3.3.3a_old/8198_world_quest_template.sql new file mode 100644 index 0000000..73ab5c2 --- /dev/null +++ b/sql/updates/3.3.3a_old/8198_world_quest_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `quest_template` CHANGE COLUMN `SkillOrClass` `SkillOrClassMask` mediumint(8) NOT NULL DEFAULT '0'; +UPDATE `quest_template` SET `SkillOrClassMask`=-(1<<(-`SkillOrClassMask`-1)) WHERE `SkillOrClassMask`<0; diff --git a/sql/updates/3.3.3a_old/8212_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8212_world_spell_proc_event.sql new file mode 100644 index 0000000..7d9e4f3 --- /dev/null +++ b/sql/updates/3.3.3a_old/8212_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET procEx = 0x00000070 WHERE entry IN (12298, 12724, 12725, 12726, 12727); -- Shield Specialization diff --git a/sql/updates/3.3.3a_old/8213_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8213_world_spell_proc_event.sql new file mode 100644 index 0000000..75c07b9 --- /dev/null +++ b/sql/updates/3.3.3a_old/8213_world_spell_proc_event.sql @@ -0,0 +1 @@ +DELETE FROM spell_proc_event WHERE entry = 23602; diff --git a/sql/updates/3.3.3a_old/8214_world_command.sql b/sql/updates/3.3.3a_old/8214_world_command.sql new file mode 100644 index 0000000..91fe023 --- /dev/null +++ b/sql/updates/3.3.3a_old/8214_world_command.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name` IN ('reload creature_template'); +INSERT INTO `command` VALUES +('reload creature_template','3','Syntax: .reload creature_template $entry\r\nReload the specified creature''s template.'); diff --git a/sql/updates/3.3.3a_old/8214_world_trinity_string.sql b/sql/updates/3.3.3a_old/8214_world_trinity_string.sql new file mode 100644 index 0000000..49156ee --- /dev/null +++ b/sql/updates/3.3.3a_old/8214_world_trinity_string.sql @@ -0,0 +1,4 @@ +DELETE FROM `trinity_string` WHERE `entry` IN (817,818); +INSERT INTO `trinity_string` VALUES +(817,'Entry %u not found in creature_template table.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(818,'Entry %u not found in sCreatureStorage. Possible new line in creature_template, but you can not add new creatures without restarting. Only modifing is allowed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.3.3a_old/8215_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8215_world_spell_bonus_data.sql new file mode 100644 index 0000000..7bdf1bc --- /dev/null +++ b/sql/updates/3.3.3a_old/8215_world_spell_bonus_data.sql @@ -0,0 +1,3 @@ +DELETE FROM spell_bonus_data WHERE entry = 63675; +INSERT INTO spell_bonus_data (entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus, comments) VALUES +(63675, 0, 0, 0, 0, 'Priest - Improved Devouring Plague'); diff --git a/sql/updates/3.3.3a_old/8216_world_spell_group.sql b/sql/updates/3.3.3a_old/8216_world_spell_group.sql new file mode 100644 index 0000000..5c0c749 --- /dev/null +++ b/sql/updates/3.3.3a_old/8216_world_spell_group.sql @@ -0,0 +1,5 @@ +DELETE FROM spell_group WHERE id = 1107; +INSERT INTO spell_group (id, spell_id) VALUES +(1107, 122), -- Frost Nova +(1107, 33395), -- Freeze +(1107, 55080); -- Shattered Barrier diff --git a/sql/updates/3.3.3a_old/8216_world_spell_group_stack_rules.sql b/sql/updates/3.3.3a_old/8216_world_spell_group_stack_rules.sql new file mode 100644 index 0000000..fa3ff80 --- /dev/null +++ b/sql/updates/3.3.3a_old/8216_world_spell_group_stack_rules.sql @@ -0,0 +1,2 @@ +DELETE FROM spell_group_stack_rules WHERE group_id = 1107; +INSERT INTO spell_group_stack_rules (group_id, stack_rule) VALUES (1107, 1); diff --git a/sql/updates/3.3.3a_old/8231_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8231_world_spell_dbc.sql new file mode 100644 index 0000000..0c243d0 --- /dev/null +++ b/sql/updates/3.3.3a_old/8231_world_spell_dbc.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_dbc` WHERE `Id` = 58428; +INSERT INTO `spell_dbc` +(`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) +VALUES +(58428,0,0,671089024,0,0,0,0,0,0,1,0,0,100,0,0,0,0,18,1,0,-1,0,0,6,0,0,1,0,0,0,0,0,9,0,0,0,0,0,1,0,0,0,0,0,0,0,0,226,0,0,20000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,1,1,1,0,1,'Overkill - aura remove spell'); diff --git a/sql/updates/3.3.3a_old/8232_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8232_world_spell_dbc.sql new file mode 100644 index 0000000..c5a97e1 --- /dev/null +++ b/sql/updates/3.3.3a_old/8232_world_spell_dbc.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_dbc` WHERE `Id` = 56817; +INSERT INTO `spell_dbc` +(`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) +VALUES +(56817,0,0,384,0,0,0,0,0,0,1,0,16,101,1,0,67,67,1,1,0,-1,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,'Rune strike proc'); diff --git a/sql/updates/3.3.3a_old/8237_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8237_world_spell_linked_spell.sql new file mode 100644 index 0000000..f2a5d86 --- /dev/null +++ b/sql/updates/3.3.3a_old/8237_world_spell_linked_spell.sql @@ -0,0 +1,2 @@ +DELETE FROM spell_linked_spell WHERE spell_trigger = 45524; +INSERT INTO spell_linked_spell VALUES (45524, 55095, 0, 'Chains of Ice - Frost Fever'); diff --git a/sql/updates/3.3.3a_old/8239_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8239_world_spell_proc_event.sql new file mode 100644 index 0000000..3ac8f14 --- /dev/null +++ b/sql/updates/3.3.3a_old/8239_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET SpellFamilyMask1 = 0x00000006 WHERE entry IN (14186, 14190, 14193, 14194, 14195); -- Seal Fate diff --git a/sql/updates/3.3.3a_old/8241_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8241_world_spell_proc_event.sql new file mode 100644 index 0000000..9508dfc --- /dev/null +++ b/sql/updates/3.3.3a_old/8241_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET Cooldown = 1 WHERE entry IN (14186, 14190, 14193, 14194, 14195); -- Seal Fate diff --git a/sql/updates/3.3.3a_old/8242_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8242_world_spell_proc_event.sql new file mode 100644 index 0000000..17bf0d5 --- /dev/null +++ b/sql/updates/3.3.3a_old/8242_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET SpellFamilyMask0 = 0x00400000, SpellFamilyMask1 = 0x00010000 WHERE entry IN (49208, 56834, 56835); -- Reaping diff --git a/sql/updates/3.3.3a_old/8244_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8244_world_spell_dbc.sql new file mode 100644 index 0000000..b0b8123 --- /dev/null +++ b/sql/updates/3.3.3a_old/8244_world_spell_dbc.sql @@ -0,0 +1,4 @@ +DELETE FROM spell_dbc WHERE Id IN (24899, 24900); +INSERT INTO spell_dbc (Id, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, Targets, CastingTimeIndex, AuraInterruptFlags, ProcFlags, ProcChance, ProcCharges, MaxLevel, BaseLevel, SpellLevel, DurationIndex, RangeIndex, StackAmount, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectSpellClassMaskA1, EffectSpellClassMaskA2, EffectSpellClassMaskA3, EffectSpellClassMaskB1, EffectSpellClassMaskB2, EffectSpellClassMaskB3, EffectSpellClassMaskC1, EffectSpellClassMaskC2, EffectSpellClassMaskC3, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags1, SpellFamilyFlags2, SpellFamilyFlags3, MaxAffectedTargets, DmgClass, PreventionType, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, AreaGroupId, SchoolMask, Comment) VALUES +(24899, 0, 0, 400, 1024, 0, 0, 2097152, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 21, 1, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 137, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'Heart of the Wild Bear Effect'), +(24900, 0, 0, 400, 1024, 0, 0, 2097152, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 21, 1, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'Heart of the Wild Cat Effect'); diff --git a/sql/updates/3.3.3a_old/8246_world_script_texts.sql b/sql/updates/3.3.3a_old/8246_world_script_texts.sql new file mode 100644 index 0000000..051a761 --- /dev/null +++ b/sql/updates/3.3.3a_old/8246_world_script_texts.sql @@ -0,0 +1,60 @@ +DELETE FROM `script_texts` WHERE `entry` <= -1668000 and `entry` >= -1668999; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +-- INTRO +(37221,-1668001,'The chill of this place... Brr... I can feel my blood freezing.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16631,1,0,0,'Jaina SAY_JAINA_INTRO_1'), +(37221,-1668002,'What is that? Up ahead! Could it be... ? Heroes at my side!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16632,1,0,0,'Jaina SAY_JAINA_INTRO_2'), +(37221,-1668003,'Frostmourne! The blade that destroyed our kingdom...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16633,1,0,0,'Jaina SAY_JAINA_INTRO_3'), +(37221,-1668004,'Stand back! Touch that blade and your soul will be scarred for all eternity! I must attempt to commune with the spirits locked away within Frostmourne. Give me space, back up please!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16634,1,0,0,'Jaina SAY_JAINA_INTRO_4'), +(37225,-1668005,'Jaina! Could it truly be you?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16666,1,0,0,'Uther SAY_UTHER_INTRO_A2_1'), +(37221,-1668006,'Uther! Dear Uther! ... I... I''m so sorry.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16635,0,0,0,'Jaina SAY_JAINA_INTRO_5'), +(37225,-1668007,'Jaina you haven''t much time. The Lich King sees what the sword sees. He will be here shortly!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16667,0,0,0,'Uther SAY_UTHER_INTRO_A2_2'), +(37221,-1668008,'Arthas is here? Maybe I...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16636,0,0,0,'Jaina SAY_JAINA_INTRO_6'), +(37225,-1668009,'No, girl. Arthas is not here. Arthas is merely a presence within the Lich King''s mind. A dwindling presence...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16668,0,0,0,'Uther SAY_UTHER_INTRO_A2_3'), +(37221,-1668010,'But Uther, if there''s any hope of reaching Arthas. I... I must try.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16637,0,0,0,'Jaina SAY_JAINA_INTRO_7'), +(37225,-1668011,'Jaina, listen to me. You must destroy the Lich King. You cannot reason with him. He will kill you and your allies and raise you all as powerful soldiers of the Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16669,0,0,0,'Uther SAY_UTHER_INTRO_A2_4'), +(37221,-1668012,'Tell me how, Uther? How do I destroy my prince? My...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16638,0,0,0,'Jaina SAY_JAINA_INTRO_8'), +(37225,-1668013,'Snap out of it, girl. You must destroy the Lich King at the place where he merged with Ner''zhul - atop the spire, at the Frozen Throne. It is the only way.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16670,0,0,0,'Uther SAY_UTHER_INTRO_A2_5'), +(37221,-1668014,'You''re right, Uther. Forgive me. I... I don''t know what got a hold of me. We will deliver this information to the King and the knights that battle the Scourge within Icecrown Citadel.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16639,0,0,0,'Jaina SAY_JAINA_INTRO_9'), +(37225,-1668015,'There is... something else that you should know about the Lich King. Control over the Scourge must never be lost. Even if you were to strike down the Lich King, another would have to take his place. For without the control of its master, the Scourge would run rampant across the world - destroying all living things.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16671,0,0,0,'Uther SAY_UTHER_INTRO_A2_6'), +(37225,-1668016,'A grand sacrifice by a noble soul...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16672,0,0,0,'Uther SAY_UTHER_INTRO_A2_7'), +(37221,-1668017,'Who could bear such a burden?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16640,0,0,0,'Jaina SAY_JAINA_INTRO_10'), +(37225,-1668018,'I do not know, Jaina. I suspect that the piece of Arthas that might be left inside the Lich King is all that holds the Scourge from annihilating Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16673,0,0,0,'Uther SAY_UTHER_INTRO_A2_8'), +(37221,-1668019,'Then maybe there is still hope...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16641,0,0,0,'Jaina SAY_JAINA_INTRO_11'), +(37225,-1668020,'No, Jaina! Aargh! He... He is coming! You... You must...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16674,0,0,0,'Uther SAY_UTHER_INTRO_A2_9'), +(37223,-1668021,'I... I don''t believe it! Frostmourne stands before us, unguarded! Just as the Gnome claimed. Come, heroes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17049,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_1'), +(37223,-1668022,'Standing this close to the blade that ended my life... The pain... It is renewed.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17050,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_2'), +(37223,-1668023,'I dare not touch it. Stand back! Stand back as I attempt to commune with the blade! Perhaps our salvation lies within...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17051,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_3'), +(37225,-1668024,'Careful, girl. I''ve heard talk of that cursed blade saving us before. Look around you and see what has been born of Frostmourne.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16659,0,0,0,'Uther SAY_UTHER_INTRO_H2_1'), +(37223,-1668025,'Uther...Uther the Lightbringer. How...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17052,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_4'), +(37225,-1668026,'You haven''t much time. The Lich King sees what the sword sees. He will be here shortly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16660,0,0,0,'Uther SAY_UTHER_INTRO_H2_2'), +(37223,-1668027,'The Lich King is here? Then my destiny shall be fulfilled today!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17053,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_5'), +(37225,-1668028,'You cannot defeat the Lich King. Not here. You would be a fool to try. He will kill those who follow you and raise them as powerful servants of the Scourge. But for you, Sylvanas, his reward for you would be worse than the last.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16661,0,0,0,'Uther SAY_UTHER_INTRO_H2_3'), +(37223,-1668029,'There must be a way... ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17054,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_6'), +(37225,-1668030,'Perhaps, but know this: there must always be a Lich King. Even if you were to strike down Arthas, another would have to take his place, for without the control of the Lich King, the Scourge would wash over this world like locusts, destroying all that they touched.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16662,0,0,0,'Uther SAY_UTHER_INTRO_H2_4'), +(37223,-1668031,'Who could bear such a burden?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17055,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_7'), +(37225,-1668032,'I do not know, Banshee Queen. I suspect that the piece of Arthas that might be left inside the Lich King is all that holds the Scourge from annihilating Azeroth.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16663,0,0,0,'Uther SAY_UTHER_INTRO_H2_5'), +(37225,-1668033,'Alas, the only way to defeat the Lich King is to destroy him at the place he was created.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16664,0,0,0,'Uther SAY_UTHER_INTRO_H2_6'), +(37223,-1668034,'The Frozen Throne...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17056,0,0,0,'Sylvanas SAY_SYLVANAS_INTRO_8'), +(37225,-1668035,'I... Aargh... He... He is coming... You... You must...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16665,0,0,0,'Uther SAY_UTHER_INTRO_H2_7'), +(37226,-1668036,'SILENCE, PALADIN!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17225,1,0,0,'Lich King SAY_LK_INTRO_1'), +(37226,-1668037,'So you wish to commune with the dead? You shall have your wish.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17226,1,0,0,'Lich King SAY_LK_INTRO_2'), +(37226,-1668038,'Falric. Marwyn. Bring their corpses to my chamber when you are through.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17227,1,0,0,'Lich King SAY_LK_INTRO_3'), +(38112,-1668039,'As you wish, my lord.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16717,1,0,0,'Falric SAY_FALRIC_INTRO_1'), +(38113,-1668040,'As you wish, my lord.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16741,1,0,0,'Marwyn SAY_MARWYN_INTRO_1'), +(38112,-1668041,'Soldiers of Lordaeron, rise to meet your master''s call!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16714,1,0,0,'Falric SAY_FALRIC_INTRO_2'), +(37221,-1668042,'You won''t deny me this Arthas! I must know! I must find out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16642,1,0,0,'Jaina SAY_JAINA_INTRO_END'), +(37223,-1668043,'You will not escape me that easily, Arthas! I will have my vengeance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17057,1,0,0,'Sylvanas SAY_SYLVANAS_INTRO_END'), +-- Falric +(38112,-1668050,'Men, women and children... None were spared the master''s wrath. Your death will be no different.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16710,1,0,0,'Falric SAY_AGGRO'), +(38112,-1668051,'Sniveling maggot!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16711,1,0,0,'Falric SAY_SLAY_1'), +(38112,-1668052,'The children of Stratholme fought with more ferocity!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16712,1,0,0,'Falric SAY_SLAY_2'), +(38112,-1668053,'Marwyn, finish them...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16713,1,0,0,'Falric SAY_DEATH'), +(38112,-1668054,'Despair... so delicious...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16715,1,0,0,'Falric SAY_IMPENDING_DESPAIR'), +(38112,-1668055,'Fear... so exhilarating...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16716,1,0,0,'Falric SAY_DEFILING_HORROR'), +-- Marwyn +(38113,-1668060,'Death is all that you will find here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16734,1,0,0,'Marwyn SAY_AGGRO'), +(38113,-1668061,'I saw the same look in his eyes when he died. Terenas could hardly believe it. Hahahaha!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16735,1,0,0,'Marwyn SAY_SLAY_1'), +(38113,-1668062,'Choke on your suffering!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16736,1,0,0,'Marwyn SAY_SLAY_2'), +(38113,-1668063,'Yes... Run... Run to meet your destiny... Its bitter, cold embrace, awaits you.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16737,1,0,0,'Marwyn SAY_DEATH'), +(38113,-1668064,'Your flesh has decayed before your very eyes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16739,1,0,0,'Marwyn SAY_CORRUPTED_FLESH_1'), +(38113,-1668065,'Waste away into nothingness!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16740,1,0,0,'Marwyn SAY_CORRUPTED_FLESH_2'); diff --git a/sql/updates/3.3.3a_old/8246_world_scriptname.sql b/sql/updates/3.3.3a_old/8246_world_scriptname.sql new file mode 100644 index 0000000..fc1f182 --- /dev/null +++ b/sql/updates/3.3.3a_old/8246_world_scriptname.sql @@ -0,0 +1,11 @@ +UPDATE `instance_template` SET `script`='instance_halls_of_reflection' WHERE `map`=668; +UPDATE `creature_template` SET `Scriptname`='boss_falric' WHERE `entry`=38112; +UPDATE `creature_template` SET `Scriptname`='boss_marwyn' WHERE `entry`=38113; +UPDATE `creature_template` SET `Scriptname`='npc_jaina_hor_part1' WHERE `entry`=37221; +UPDATE `creature_template` SET `Scriptname`='npc_sylvanas_hor_part1' WHERE `entry`=37223; +UPDATE `creature_template` SET `Scriptname`='npc_ghostly_priest' WHERE `entry`=38175; +UPDATE `creature_template` SET `Scriptname`='npc_phantom_mage' WHERE `entry`=38172; +UPDATE `creature_template` SET `Scriptname`='npc_phantom_hallucination' WHERE `entry`=38567; +UPDATE `creature_template` SET `Scriptname`='npc_shadowy_mercenary' WHERE `entry`=38177; +UPDATE `creature_template` SET `Scriptname`='npc_spectral_footman' WHERE `entry`=38173; +UPDATE `creature_template` SET `Scriptname`='npc_tortured_rifleman' WHERE `entry`=38176; diff --git a/sql/updates/3.3.3a_old/8248_world_script_texts.sql b/sql/updates/3.3.3a_old/8248_world_script_texts.sql new file mode 100644 index 0000000..73524d3 --- /dev/null +++ b/sql/updates/3.3.3a_old/8248_world_script_texts.sql @@ -0,0 +1,7 @@ +DELETE FROM `script_texts` WHERE `entry` IN (-1578000,-1578001,-1578002,-1578003,-1578004); +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES + (27655,-1578000,'What do we have here... those that would defy the Spell-Weaver? Those without foresight our understanding. How can i make you see? Malygos is saving the world from itself! Bah! You are hardly worth my time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578001,'Clearly my pets failed. Perhaps another demonstration is in order.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578002,'Still you fight. Still you cling to misguided principles. If you survive, you''ll find me in the center ring.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578003,'Poor blind fools!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), + (27655,-1578004,'A taste... just a small taste... of the Spell-Weaver''s power!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); diff --git a/sql/updates/3.3.3a_old/8248_world_scriptname.sql b/sql/updates/3.3.3a_old/8248_world_scriptname.sql new file mode 100644 index 0000000..b844c7a --- /dev/null +++ b/sql/updates/3.3.3a_old/8248_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='boss_urom' WHERE `entry`=27655; diff --git a/sql/updates/3.3.3a_old/8255_world_item_template.sql b/sql/updates/3.3.3a_old/8255_world_item_template.sql new file mode 100644 index 0000000..7fc29b2 --- /dev/null +++ b/sql/updates/3.3.3a_old/8255_world_item_template.sql @@ -0,0 +1 @@ +ALTER TABLE `item_template` CHANGE `Faction` `FlagsExtra` INT(10) UNSIGNED NOT NULL DEFAULT '0'; diff --git a/sql/updates/3.3.3a_old/8259_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8259_world_spell_proc_event.sql new file mode 100644 index 0000000..a1b8b3e --- /dev/null +++ b/sql/updates/3.3.3a_old/8259_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET `SpellFamilyMask1`=192 WHERE `entry` in (63156,63158); diff --git a/sql/updates/3.3.3a_old/8263_world_script_texts.sql b/sql/updates/3.3.3a_old/8263_world_script_texts.sql new file mode 100644 index 0000000..3eb5328 --- /dev/null +++ b/sql/updates/3.3.3a_old/8263_world_script_texts.sql @@ -0,0 +1,13 @@ +-- King Ymiron voice by SnakeIce +DELETE FROM `script_texts` WHERE `npc_entry`=26861; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(26861,-1575028, 'You invade my home and then dare to challenge me? I will tear the hearts from your chests and offer them as gifts to the death god! Rualg nja gaborr!' ,13609,1,0,0, 'King Ymirom - SAY_AGGRO'), +(26861,-1575029, 'Your death is only the beginning!' ,13614,1,0,0, 'King Ymirom - SAY_SLAY_1'), +(26861,-1575030, 'You have failed your people!' ,13615,1,0,0, 'King Ymirom - SAY_SLAY_2'), +(26861,-1575031, 'There is a reason I am king!' ,13616,1,0,0, 'King Ymirom - SAY_SLAY_3'), +(26861,-1575032, 'Bleed no more!' ,13617,1,0,0, 'King Ymirom - SAY_SLAY_4'), +(26861,-1575033, 'What... awaits me... now?' ,13618,1,0,0, 'King Ymirom - SAY_DEATH'), +(26861,-1575034, 'Bjorn of the Black Storm! Honor me now with your presence!' ,13610,1,0,0, 'King Ymirom - SAY_SUMMON_BJORN'), +(26861,-1575035, 'Haldor of the Rocky Cliffs, grant me your strength!' ,13611,1,0,0, 'King Ymirom - SAY_SUMMON_HALDOR'), +(26861,-1575036, 'Ranulf of the Screaming Abyss, snuff these maggots with darkest night! ' ,13612,1,0,0, 'King Ymirom - SAY_SUMMON_RANULF'), +(26861,-1575037, 'Tor of the Brutal Siege! Bestow your might upon me!' ,13613,1,0,0, 'King Ymirom - SAY_SUMMON_TORGYN'); diff --git a/sql/updates/3.3.3a_old/8265_world_script_texts.sql b/sql/updates/3.3.3a_old/8265_world_script_texts.sql new file mode 100644 index 0000000..8f21b86 --- /dev/null +++ b/sql/updates/3.3.3a_old/8265_world_script_texts.sql @@ -0,0 +1 @@ +UPDATE `script_texts` SET `type`=3,`content_default`='%s takes in a deep breath...' WHERE `entry`=-1249004; diff --git a/sql/updates/3.3.3a_old/8265_world_scriptname.sql b/sql/updates/3.3.3a_old/8265_world_scriptname.sql new file mode 100644 index 0000000..339365a --- /dev/null +++ b/sql/updates/3.3.3a_old/8265_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `instance_template` SET `script`='instance_onyxias_lair' WHERE `map`=249; diff --git a/sql/updates/3.3.3a_old/8271_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8271_world_spell_dbc.sql new file mode 100644 index 0000000..f8c6c8c --- /dev/null +++ b/sql/updates/3.3.3a_old/8271_world_spell_dbc.sql @@ -0,0 +1,4 @@ +-- Add serverside spells place holders for future development +DELETE FROM `spell_dbc` WHERE `Id`=43503; +INSERT INTO `spell_dbc` (`Id`,`Comment`) VALUES +(43503, 'Quest 11261 reward serverside spell'); diff --git a/sql/updates/3.3.3a_old/8277_world_scriptname.sql b/sql/updates/3.3.3a_old/8277_world_scriptname.sql new file mode 100644 index 0000000..a45ac65 --- /dev/null +++ b/sql/updates/3.3.3a_old/8277_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName` = 'npc_fel_guard_hound' WHERE `entry`=21847; diff --git a/sql/updates/3.3.3a_old/8280_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8280_world_spell_dbc.sql new file mode 100644 index 0000000..ccd3da0 --- /dev/null +++ b/sql/updates/3.3.3a_old/8280_world_spell_dbc.sql @@ -0,0 +1,4 @@ +-- Add serverside spells place holders for future development +DELETE FROM `spell_dbc` WHERE `Id`=39613; +INSERT INTO `spell_dbc` (`Id`,`Comment`) VALUES +(39613, 'Quest 10967 reward serverside spell'); diff --git a/sql/updates/3.3.3a_old/8287_world_script_texts.sql b/sql/updates/3.3.3a_old/8287_world_script_texts.sql new file mode 100644 index 0000000..4d3c551 --- /dev/null +++ b/sql/updates/3.3.3a_old/8287_world_script_texts.sql @@ -0,0 +1,14 @@ +UPDATE `script_texts` SET `content_default`='%s flee' WHERE `entry`='-1609272'; +UPDATE `script_texts` SET `content_default`='%s kneels in defeat before Tirion Fordring.' WHERE `entry`='-1609273'; +UPDATE `script_texts` SET `content_default`='%s arrives.' WHERE `entry`='-1609274'; +UPDATE `script_texts` SET `content_default`='%s becomes a shade of his past, and walks up to his father.' WHERE `entry`='-1609275'; +UPDATE `script_texts` SET `content_default`='%s hugs his father.' WHERE `entry`='-1609276'; +UPDATE `script_texts` SET `content_default`='%s disappears, and the Lich King appears.' WHERE `entry`='-1609277'; +UPDATE `script_texts` SET `content_default`='%s becomes himself again...and is now angry.' WHERE `entry`='-1609278'; +UPDATE `script_texts` SET `content_default`='%s casts a spell on Tirion.' WHERE `entry`='-1609279'; +UPDATE `script_texts` SET `content_default`='%s gasps for air.' WHERE `entry`='-1609280'; +UPDATE `script_texts` SET `content_default`='%s casts a powerful spell, killing the Defenders and knocking back the others.' WHERE `entry`='-1609281'; +UPDATE `script_texts` SET `content_default`='%s throws the Corrupted Ashbringer to Tirion, who catches it. Tirion becomes awash with Light, and the Ashbringer is cleansed.' WHERE `entry`='-1609282'; +UPDATE `script_texts` SET `content_default`='%s collapses.' WHERE `entry`='-1609283'; +UPDATE `script_texts` SET `content_default`='%s charges towards the Lich King, Ashbringer in hand and strikes the Lich King.' WHERE `entry`='-1609284'; +UPDATE `script_texts` SET `content_default`='%s disappears. Tirion walks over to where Darion lay' WHERE `entry`='-1609285'; diff --git a/sql/updates/3.3.3a_old/8292_world_creature.sql b/sql/updates/3.3.3a_old/8292_world_creature.sql new file mode 100644 index 0000000..fe90527 --- /dev/null +++ b/sql/updates/3.3.3a_old/8292_world_creature.sql @@ -0,0 +1 @@ +ALTER TABLE `creature` CHANGE `spawndist` `spawndist` FLOAT NOT NULL DEFAULT '0'; diff --git a/sql/updates/3.3.3a_old/8293_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8293_world_spell_dbc.sql new file mode 100644 index 0000000..8bfabc4 --- /dev/null +++ b/sql/updates/3.3.3a_old/8293_world_spell_dbc.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_dbc` WHERE `id`IN (34448,34452); +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(34448,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Serverside spell orb of translocation (gobjid=180911)' ), +(34452,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Serverside spell orb of translocation (gobjid=180912)' ); diff --git a/sql/updates/3.3.3a_old/8300_characters_character_battleground_random.sql b/sql/updates/3.3.3a_old/8300_characters_character_battleground_random.sql new file mode 100644 index 0000000..780374d --- /dev/null +++ b/sql/updates/3.3.3a_old/8300_characters_character_battleground_random.sql @@ -0,0 +1,5 @@ +DROP TABLE IF EXISTS `character_battleground_random`; +CREATE TABLE `character_battleground_random` ( + `guid` int(11) unsigned NOT NULL default '0', + PRIMARY KEY (`guid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/updates/3.3.3a_old/8300_characters_worldstates.sql b/sql/updates/3.3.3a_old/8300_characters_worldstates.sql new file mode 100644 index 0000000..764fadb --- /dev/null +++ b/sql/updates/3.3.3a_old/8300_characters_worldstates.sql @@ -0,0 +1,3 @@ +DELETE FROM `worldstates` WHERE `entry` IN (20003); +INSERT INTO `worldstates` (`entry`,`value`, `comment`) VALUES +(20003, 0, 'NextBGRandomDailyResetTime'); diff --git a/sql/updates/3.3.3a_old/8300_world_battleground_template.sql b/sql/updates/3.3.3a_old/8300_world_battleground_template.sql new file mode 100644 index 0000000..880fe66 --- /dev/null +++ b/sql/updates/3.3.3a_old/8300_world_battleground_template.sql @@ -0,0 +1 @@ +UPDATE `battleground_template` SET `MinPlayersPerTeam`=10, `MaxPlayersPerTeam`=10 WHERE `id`=32; diff --git a/sql/updates/3.3.3a_old/8306_world_scriptname.sql b/sql/updates/3.3.3a_old/8306_world_scriptname.sql new file mode 100644 index 0000000..7578cfd --- /dev/null +++ b/sql/updates/3.3.3a_old/8306_world_scriptname.sql @@ -0,0 +1,44 @@ +-- +-- Update basic NPC guards to use a common AI - gossip now handled in database +-- +-- guard_azuremyst -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (18038); +-- guard_bluffwatcher -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (3084); +-- guard_contested -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (3502,4624,9460,11190,15184); +-- guard_darnassus -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (4262); +-- guard_dunmorogh -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (727,13076); +-- guard_durotar -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (5953); +-- guard_elwynnforest -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (1423); +-- guard_eversong -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (16221); +-- guard_exodar -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (16733); +-- guard_ironforge -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (5595); +-- guard_mulgore -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (3212,3215,3217,3218,3219,3220,3221,3222,3223,3224); +-- guard_shattrath -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (19687); +-- guard_silvermoon -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (16222); +-- guard_teldrassil -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (3571); +-- guard_tirisfal -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (1735,1738,1742,1743,1744,1745,1746,2209,2210,5725); +-- guard_undercity -> guard_generic +UPDATE `creature_template` SET `ScriptName` = 'guard_generic' WHERE `entry` IN (5624); +-- +-- Update (remove) scripts from NPCs that had gossip - gossip now handled in database (AI removed) +-- +-- NPC Surristrasz +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` IN (24795); +-- NPC Tiare +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` IN (30051); +-- NPC Fizzcrank Fullthrottle +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` IN (25590); diff --git a/sql/updates/3.3.3a_old/8312_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8312_world_spell_proc_event.sql new file mode 100644 index 0000000..775ad64 --- /dev/null +++ b/sql/updates/3.3.3a_old/8312_world_spell_proc_event.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (71519,71562); +INSERT INTO `spell_proc_event` (`entry`, `Cooldown`) VALUES +(71519, 105), +(71562, 105); diff --git a/sql/updates/3.3.3a_old/8313_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8313_world_spell_bonus_data.sql new file mode 100644 index 0000000..7121fd8 --- /dev/null +++ b/sql/updates/3.3.3a_old/8313_world_spell_bonus_data.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` = 25997; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES (25997, 0, 0, 0, 0, 'Paladin - Eye for an Eye'); diff --git a/sql/updates/3.3.3a_old/8315_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8315_world_spell_bonus_data.sql new file mode 100644 index 0000000..6a95716 --- /dev/null +++ b/sql/updates/3.3.3a_old/8315_world_spell_bonus_data.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` = 20267; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES (20267, 0, 0, 0, 0, 'Paladin - Judgement of Light Proc'); diff --git a/sql/updates/3.3.3a_old/8316_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8316_world_spell_bonus_data.sql new file mode 100644 index 0000000..bad80f0 --- /dev/null +++ b/sql/updates/3.3.3a_old/8316_world_spell_bonus_data.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (59638, 59637); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(59638, 0.3, -1, 0, -1, 'Mage - Mirror Image Frostbolt'), +(59637, 0.3, -1, 0, -1, 'Mage - Mirror Image Fire Blast'); diff --git a/sql/updates/3.3.3a_old/8318_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8318_world_spell_bonus_data.sql new file mode 100644 index 0000000..c262f5e --- /dev/null +++ b/sql/updates/3.3.3a_old/8318_world_spell_bonus_data.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_bonus_data` WHERE `entry`=59637; +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES (59637, 0.15, -1, 0, -1, 'Mage - Mirror Image Fire Blast'); diff --git a/sql/updates/3.3.3a_old/8319_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8319_world_spell_linked_spell.sql new file mode 100644 index 0000000..5c8db78 --- /dev/null +++ b/sql/updates/3.3.3a_old/8319_world_spell_linked_spell.sql @@ -0,0 +1 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=50720; diff --git a/sql/updates/3.3.3a_old/8327_world_scriptname.sql b/sql/updates/3.3.3a_old/8327_world_scriptname.sql new file mode 100644 index 0000000..be75f81 --- /dev/null +++ b/sql/updates/3.3.3a_old/8327_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_colossus' WHERE `entry`=33237; diff --git a/sql/updates/3.3.3a_old/8330_world_playercreateinfo_spell.sql b/sql/updates/3.3.3a_old/8330_world_playercreateinfo_spell.sql new file mode 100644 index 0000000..c79731a --- /dev/null +++ b/sql/updates/3.3.3a_old/8330_world_playercreateinfo_spell.sql @@ -0,0 +1,2 @@ +DELETE FROM `playercreateinfo_spell` WHERE `Spell`=75461; +INSERT INTO `playercreateinfo_spell` VALUES (0,7,75461,'Flame Shock Passive'); diff --git a/sql/updates/3.3.3a_old/8334_world_scriptname.sql b/sql/updates/3.3.3a_old/8334_world_scriptname.sql new file mode 100644 index 0000000..abd905d --- /dev/null +++ b/sql/updates/3.3.3a_old/8334_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_guardian_pavilion' WHERE `entry` IN (33543,33643); diff --git a/sql/updates/3.3.3a_old/8348_world_script_texts.sql b/sql/updates/3.3.3a_old/8348_world_script_texts.sql new file mode 100644 index 0000000..af3d17c --- /dev/null +++ b/sql/updates/3.3.3a_old/8348_world_script_texts.sql @@ -0,0 +1,13 @@ +-- Skadi the Ruthless voice +DELETE FROM `script_texts` WHERE `npc_entry`=26693; +INSERT INTO `script_texts` VALUES +(26693,-1575004, "What mongrels dare intrude here? Look alive, my brothers! A feast for the one that brings me their heads!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13497,1,0,0, "Skadi - SAY_AGGRO"), +(26693,-1575005, "Not so brash now, are you?" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13504,1,0,0, "Skadi - SAY_KILL_1"), +(26693,-1575006, "I'll mount your skull from the highest tower!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13505,1,0,0, "Skadi - SAY_KILL_2"), +(26693,-1575007, "%s in within range of the harpoon launchers!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0, "Skadi - EMOTE_RANGE"), +(26693,-1575008, "ARGH! You call that... an attack? I'll... show... aghhhh..." ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13506,1,0,0, "Skadi - SAY_DEATH"), +(26693,-1575009, "%s in within range of the harpoon launchers!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,3,0,0, "Skadi - EMOTE_RANGE"), +(26693,-1575010, "You motherless knaves! Your corpses will make fine morsels for my new drake!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13507,1,0,0, "Skadi - SAY_DRAKE_DEATH"), +(26693,-1575011, "Sear them to the bone!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13498,1,0,0, "Skadi - SAY_DRAKE_BREATH_1"), +(26693,-1575012, "Go now! Leave nothing but ash in your wake!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13499,1,0,0, "Skadi - SAY_DRAKE_BREATH_2"), +(26693,-1575013, "Cleanse our sacred halls with flame!" ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,13500,1,0,0, "Skadi - SAY_DRAKE_BREATH_3"); diff --git a/sql/updates/3.3.3a_old/8348_world_scriptname.sql b/sql/updates/3.3.3a_old/8348_world_scriptname.sql new file mode 100644 index 0000000..42fbaed --- /dev/null +++ b/sql/updates/3.3.3a_old/8348_world_scriptname.sql @@ -0,0 +1,2 @@ +-- Skadi Harpoon Launchers +UPDATE `gameobject_template` SET `ScriptName`='go_harpoon_launcher' WHERE `entry` IN (192175,192176,192177); diff --git a/sql/updates/3.3.3a_old/8352_world_scriptname.sql b/sql/updates/3.3.3a_old/8352_world_scriptname.sql new file mode 100644 index 0000000..d3e350f --- /dev/null +++ b/sql/updates/3.3.3a_old/8352_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_massive_seaforium_charge' WHERE `entry` = 190752; diff --git a/sql/updates/3.3.3a_old/8352_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8352_world_spell_linked_spell.sql new file mode 100644 index 0000000..9feca78 --- /dev/null +++ b/sql/updates/3.3.3a_old/8352_world_spell_linked_spell.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_effect` IN (52418, -52418); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(52415, 52418, 0, 'Carrying Seaforium - Add'), +(52410, -52418, 0, 'Carrying Seaforium - Remove'); diff --git a/sql/updates/3.3.3a_old/8358_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8358_world_spell_linked_spell.sql new file mode 100644 index 0000000..f86328d --- /dev/null +++ b/sql/updates/3.3.3a_old/8358_world_spell_linked_spell.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (69381,69378,69377); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(69381, 72588, 1, 'Drums of the Wild'), +(69378, 72586, 1, 'Drums of the Forgotten Kings'), +(69377, 72590, 1, 'Runescroll of Fortitude'); diff --git a/sql/updates/3.3.3a_old/8361_world_trinity_string.sql b/sql/updates/3.3.3a_old/8361_world_trinity_string.sql new file mode 100644 index 0000000..f8bf096 --- /dev/null +++ b/sql/updates/3.3.3a_old/8361_world_trinity_string.sql @@ -0,0 +1,20 @@ +DELETE FROM `trinity_string` WHERE `entry` BETWEEN 10056 AND 10073; +INSERT INTO `trinity_string` VALUES +(10056,'The battle for Strand of the Ancients begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10057,'The battle for Strand of the Ancients begins in 1 minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10058,'The battle for Strand of the Ancients begins in 30 seconds. Prepare yourselves!.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10059,'Let the battle for Strand of the Ancients begin!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10060,'The %s is under attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10061,'The %s was destroyed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10062,'Round 1 - finished!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10063,'The Alliance captured the titan portal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10064,'The Horde captured the titan portal!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10065,'Round 2 of the Battle for the Strand of the Ancients begins in 1 minute.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10066,'Round 2 begins in 30 seconds. Prepare yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10067,'The chamber has been breached! The titan relic is vulnerable!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10068,'The Alliance captured the South Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10069,'The Alliance captured the West Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10070,'The Alliance captured the East Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10071,'The Horde captured the South Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10072,'The Horde captured the West Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(10073,'The Horde captured the East Graveyard!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.3.3a_old/8371_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8371_world_spell_bonus_data.sql new file mode 100644 index 0000000..5b72884 --- /dev/null +++ b/sql/updates/3.3.3a_old/8371_world_spell_bonus_data.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (56131,56160,52725,55533); +INSERT INTO `spell_bonus_data` (`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `ap_dot_bonus`, `comments`) VALUES +(56131, 0, 0, 0, 0, 'Priest - Glyph of Dispel Magic'), +(56160, 0, 0, 0, 0, 'Priest - Glyph of Power Word: Shield'), +(52752, 0, 0, 0, 0, 'Ancestral Awakening'), +(55533, 0, 0, 0, 0, 'Shaman - Glyph of Healing Wave'); diff --git a/sql/updates/3.3.3a_old/8372_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8372_world_spell_proc_event.sql new file mode 100644 index 0000000..0f07232 --- /dev/null +++ b/sql/updates/3.3.3a_old/8372_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (57870); +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +( 57870, 0x00, 9, 0x00800000, 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0, 0, 0); -- Glyph of Mend Pet diff --git a/sql/updates/3.3.3a_old/8373_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8373_world_spell_proc_event.sql new file mode 100644 index 0000000..20f87b3 --- /dev/null +++ b/sql/updates/3.3.3a_old/8373_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (70807); +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +( 70807, 0, 11, 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0, 100, 0); -- Item - Shaman T10 Restoration 2P Bonus diff --git a/sql/updates/3.3.3a_old/8374_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8374_world_spell_proc_event.sql new file mode 100644 index 0000000..2ee60a1 --- /dev/null +++ b/sql/updates/3.3.3a_old/8374_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (67667); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 67667, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 45); -- Item - Coliseum Healer Trinket 5men diff --git a/sql/updates/3.3.3a_old/8375_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8375_world_spell_proc_event.sql new file mode 100644 index 0000000..6270048 --- /dev/null +++ b/sql/updates/3.3.3a_old/8375_world_spell_proc_event.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (67672,67670,67653); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +( 67672, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00800154, 0x00000000, 0, 0, 45), -- Item - Coliseum Melee Trinket 5men +( 67670, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 45), -- Item - Coliseum Caster Trinket 5men +( 67653, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00400028, 0x00000000, 0, 0, 45); -- Item - Coliseum Tank Trinket 5men diff --git a/sql/updates/3.3.3a_old/8391_world_conditions.sql b/sql/updates/3.3.3a_old/8391_world_conditions.sql new file mode 100644 index 0000000..fb5cc9f --- /dev/null +++ b/sql/updates/3.3.3a_old/8391_world_conditions.sql @@ -0,0 +1,72 @@ +-- ---------------------------- +-- Table structure for conditions +-- ---------------------------- +DROP TABLE IF EXISTS `conditions`; +CREATE TABLE `conditions` ( + `SourceTypeOrReferenceId` mediumint(8) NOT NULL DEFAULT '0', + `SourceGroup` mediumint(8) unsigned NOT NULL DEFAULT '0', + `SourceEntry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ElseGroup` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ConditionTypeOrReference` mediumint(8) NOT NULL DEFAULT '0', + `ConditionValue1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ConditionValue2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ConditionValue3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `ErrorTextId` mediumint(8) unsigned NOT NULL DEFAULT '0', + `Comment` varchar(255) DEFAULT NULL, + PRIMARY KEY (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Condition System'; + +-- convert loot conditions +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 1,creature_loot_template.entry,creature_loot_template.item,creature_loot_template.lootcondition,creature_loot_template.condition_value1,creature_loot_template.condition_value2 FROM creature_loot_template WHERE creature_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 2,disenchant_loot_template.entry,disenchant_loot_template.item,disenchant_loot_template.lootcondition,disenchant_loot_template.condition_value1,disenchant_loot_template.condition_value2 FROM disenchant_loot_template WHERE disenchant_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 3,fishing_loot_template.entry,fishing_loot_template.item,fishing_loot_template.lootcondition,fishing_loot_template.condition_value1,fishing_loot_template.condition_value2 FROM fishing_loot_template WHERE fishing_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 4,gameobject_loot_template.entry,gameobject_loot_template.item,gameobject_loot_template.lootcondition,gameobject_loot_template.condition_value1,gameobject_loot_template.condition_value2 FROM gameobject_loot_template WHERE gameobject_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 5,item_loot_template.entry,item_loot_template.item,item_loot_template.lootcondition,item_loot_template.condition_value1,item_loot_template.condition_value2 FROM item_loot_template WHERE item_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 6,mail_loot_template.entry,mail_loot_template.item,mail_loot_template.lootcondition,mail_loot_template.condition_value1,mail_loot_template.condition_value2 FROM mail_loot_template WHERE mail_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 7,milling_loot_template.entry,milling_loot_template.item,milling_loot_template.lootcondition,milling_loot_template.condition_value1,milling_loot_template.condition_value2 FROM milling_loot_template WHERE milling_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 8,pickpocketing_loot_template.entry,pickpocketing_loot_template.item,pickpocketing_loot_template.lootcondition,pickpocketing_loot_template.condition_value1,pickpocketing_loot_template.condition_value2 FROM pickpocketing_loot_template WHERE pickpocketing_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 9,prospecting_loot_template.entry,prospecting_loot_template.item,prospecting_loot_template.lootcondition,prospecting_loot_template.condition_value1,prospecting_loot_template.condition_value2 FROM prospecting_loot_template WHERE prospecting_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 10,reference_loot_template.entry,reference_loot_template.item,reference_loot_template.lootcondition,reference_loot_template.condition_value1,reference_loot_template.condition_value2 FROM reference_loot_template WHERE reference_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 11,skinning_loot_template.entry,skinning_loot_template.item,skinning_loot_template.lootcondition,skinning_loot_template.condition_value1,skinning_loot_template.condition_value2 FROM skinning_loot_template WHERE skinning_loot_template.lootcondition>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 12,spell_loot_template.entry,spell_loot_template.item,spell_loot_template.lootcondition,spell_loot_template.condition_value1,spell_loot_template.condition_value2 FROM spell_loot_template WHERE spell_loot_template.lootcondition>0; + +-- convert spell script targets +INSERT INTO conditions (SourceTypeOrReferenceId,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 13,spell_script_target.entry,18,spell_script_target.type,spell_script_target.targetEntry FROM spell_script_target; + +-- convert gossip menu conditions +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 14,gossip_menu.entry,gossip_menu.text_id,gossip_menu.cond_1,gossip_menu.cond_1_val_1,gossip_menu.cond_1_val_2 FROM gossip_menu WHERE gossip_menu.cond_1>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 14,gossip_menu.entry,gossip_menu.text_id,gossip_menu.cond_2,gossip_menu.cond_2_val_1,gossip_menu.cond_2_val_2 FROM gossip_menu WHERE gossip_menu.cond_2>0; + +-- convert gossip menu options conditions +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 15,gossip_menu_option.menu_id,gossip_menu_option.id,gossip_menu_option.cond_1,gossip_menu_option.cond_1_val_1,gossip_menu_option.cond_1_val_2 FROM gossip_menu_option WHERE gossip_menu_option.cond_1>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 15,gossip_menu_option.menu_id,gossip_menu_option.id,gossip_menu_option.cond_2,gossip_menu_option.cond_2_val_1,gossip_menu_option.cond_2_val_2 FROM gossip_menu_option WHERE gossip_menu_option.cond_2>0; +INSERT INTO conditions (SourceTypeOrReferenceId,SourceGroup,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 15,gossip_menu_option.menu_id,gossip_menu_option.id,gossip_menu_option.cond_3,gossip_menu_option.cond_3_val_1,gossip_menu_option.cond_3_val_2 FROM gossip_menu_option WHERE gossip_menu_option.cond_3>0; + +-- convert item required target +INSERT INTO conditions (SourceTypeOrReferenceId,SourceEntry,ConditionTypeOrReference,ConditionValue1,ConditionValue2) SELECT 18,item_required_target.entry,24,item_required_target.type,item_required_target.targetEntry FROM item_required_target; + +-- drop no more needed condition fields + +-- drop not used loot conditions +ALTER TABLE creature_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE disenchant_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE fishing_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE gameobject_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE item_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE mail_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE milling_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE pickpocketing_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE prospecting_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE reference_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE skinning_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; +ALTER TABLE spell_loot_template DROP COLUMN lootcondition,DROP COLUMN condition_value1,DROP COLUMN condition_value2; + +-- drop spell_script_target table, it is built into conditions +DROP TABLE IF EXISTS `spell_script_target`; + +-- drop item_required_target table, it is built into conditions +DROP TABLE IF EXISTS `item_required_target`; + +-- drop not used gossip conditions +ALTER TABLE gossip_menu DROP COLUMN cond_1,DROP COLUMN cond_1_val_1,DROP COLUMN cond_1_val_2,DROP COLUMN cond_2,DROP COLUMN cond_2_val_1,DROP COLUMN cond_2_val_2; +ALTER TABLE gossip_menu_option DROP COLUMN cond_1,DROP COLUMN cond_1_val_1,DROP COLUMN cond_1_val_2,DROP COLUMN cond_2,DROP COLUMN cond_2_val_1,DROP COLUMN cond_2_val_2; diff --git a/sql/updates/3.3.3a_old/8397_world_command.sql b/sql/updates/3.3.3a_old/8397_world_command.sql new file mode 100644 index 0000000..f90f37e --- /dev/null +++ b/sql/updates/3.3.3a_old/8397_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('instance open','instance close'); +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('instance open', 3, 'Syntax: .instance open mapid [normal|heroic|10normal|10heroic|25normal|25heroic]'), +('instance close', 3, 'Syntax: .instance close mapid [normal|heroic|10normal|10heroic|25normal|25heroic]'); diff --git a/sql/updates/3.3.3a_old/8510_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8510_world_spell_proc_event.sql new file mode 100644 index 0000000..c9d0a9c --- /dev/null +++ b/sql/updates/3.3.3a_old/8510_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET SpellFamilyMask0 = SpellFamilyMask0 | 0x40000000, procEx = ProcEx | 0x0000001 WHERE entry IN(53569,53576); diff --git a/sql/updates/3.3.3a_old/8511_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8511_world_spell_proc_event.sql new file mode 100644 index 0000000..91cc784 --- /dev/null +++ b/sql/updates/3.3.3a_old/8511_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE spell_proc_event SET procEx = 0x0 WHERE entry IN(53569,53576); diff --git a/sql/updates/3.3.3a_old/8512_world_command.sql b/sql/updates/3.3.3a_old/8512_world_command.sql new file mode 100644 index 0000000..6293503 --- /dev/null +++ b/sql/updates/3.3.3a_old/8512_world_command.sql @@ -0,0 +1,3 @@ +DELETE FROM `command` WHERE `name`='reload creature_onkill_reputation'; +INSERT INTO `command` VALUES +('reload creature_onkill_reputation','3','Syntax: .reload creature_onkill_reputation\r\nReload creature_onkill_reputation table.'); diff --git a/sql/updates/3.3.3a_old/8565_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8565_world_spell_proc_event.sql new file mode 100644 index 0000000..b4a378e --- /dev/null +++ b/sql/updates/3.3.3a_old/8565_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry`=70761; +INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES +( 70761, 0x00, 10, 0x00000000, 0x80004000, 0x00000001, 0x00000400, 0x00000000, 0, 0, 0); -- Item - Paladin T10 Protection 4P Bonus diff --git a/sql/updates/3.3.3a_old/8568_world_npc_vendor.sql b/sql/updates/3.3.3a_old/8568_world_npc_vendor.sql new file mode 100644 index 0000000..6364584 --- /dev/null +++ b/sql/updates/3.3.3a_old/8568_world_npc_vendor.sql @@ -0,0 +1 @@ +ALTER TABLE npc_vendor CHANGE COLUMN `ExtendedCost` `ExtendedCost` mediumint(8) NOT NULL default '0' COMMENT 'negative if cost must exclude normal money cost'; diff --git a/sql/updates/3.3.3a_old/8568_world_trinity_string.sql b/sql/updates/3.3.3a_old/8568_world_trinity_string.sql new file mode 100644 index 0000000..c4fdc2f --- /dev/null +++ b/sql/updates/3.3.3a_old/8568_world_trinity_string.sql @@ -0,0 +1,3 @@ +DELETE FROM trinity_string WHERE entry IN (210); +INSERT INTO trinity_string VALUES +(210,'Item \'%i\' (with extended cost %i) already in vendor list.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/3.3.3a_old/8575_world_command.sql b/sql/updates/3.3.3a_old/8575_world_command.sql new file mode 100644 index 0000000..8175ad3 --- /dev/null +++ b/sql/updates/3.3.3a_old/8575_world_command.sql @@ -0,0 +1,2 @@ +DELETE FROM command WHERE name = 'reload conditions'; +INSERT INTO command (name, security, help) VALUES ('reload conditions', 3, 'Reload conditions table.'); diff --git a/sql/updates/3.3.3a_old/8576_world_command.sql b/sql/updates/3.3.3a_old/8576_world_command.sql new file mode 100644 index 0000000..4512dfe --- /dev/null +++ b/sql/updates/3.3.3a_old/8576_world_command.sql @@ -0,0 +1 @@ +DELETE FROM command WHERE name = 'reload spell_script_target'; diff --git a/sql/updates/3.3.3a_old/8586_world_command.sql b/sql/updates/3.3.3a_old/8586_world_command.sql new file mode 100644 index 0000000..b554755 --- /dev/null +++ b/sql/updates/3.3.3a_old/8586_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('reload item_set_names','reload locales_item_set_name'); +INSERT INTO `command` VALUES +('reload item_set_names',3,'Syntax: .reload item_set_names\nReload item_set_names table.'), +('reload locales_item_set_name',3,'Syntax: .reload locales_item_set_name\nReload locales_item_set_name table.'); diff --git a/sql/updates/3.3.3a_old/8586_world_item_set_names.sql b/sql/updates/3.3.3a_old/8586_world_item_set_names.sql new file mode 100644 index 0000000..f62df79 --- /dev/null +++ b/sql/updates/3.3.3a_old/8586_world_item_set_names.sql @@ -0,0 +1,14 @@ +-- +-- Table structure for table `item_set_names` +-- + +DROP TABLE IF EXISTS `item_set_names`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `item_set_names` ( + `entry` mediumint(8) unsigned NOT NULL, + `name` varchar(255) character set utf8 NOT NULL default '', + `InventoryType` tinyint(3) unsigned NOT NULL default '0', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/sql/updates/3.3.3a_old/8586_world_locales_item_set_name.sql b/sql/updates/3.3.3a_old/8586_world_locales_item_set_name.sql new file mode 100644 index 0000000..30d39f9 --- /dev/null +++ b/sql/updates/3.3.3a_old/8586_world_locales_item_set_name.sql @@ -0,0 +1,20 @@ +-- +-- Table structure for table `locales_item_set_name` +-- + +DROP TABLE IF EXISTS `locales_item_set_name`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `locales_item_set_name` ( + `entry` mediumint(8) unsigned NOT NULL DEFAULT '0', + `name_loc1` varchar(100) NOT NULL DEFAULT '', + `name_loc2` varchar(100) NOT NULL DEFAULT '', + `name_loc3` varchar(100) NOT NULL DEFAULT '', + `name_loc4` varchar(100) NOT NULL DEFAULT '', + `name_loc5` varchar(100) NOT NULL DEFAULT '', + `name_loc6` varchar(100) NOT NULL DEFAULT '', + `name_loc7` varchar(100) NOT NULL DEFAULT '', + `name_loc8` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`entry`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; diff --git a/sql/updates/3.3.3a_old/8589_world_item_set_names.sql b/sql/updates/3.3.3a_old/8589_world_item_set_names.sql new file mode 100644 index 0000000..2edcc16 --- /dev/null +++ b/sql/updates/3.3.3a_old/8589_world_item_set_names.sql @@ -0,0 +1 @@ +ALTER TABLE `item_set_names` ADD COLUMN `WDBVerified` smallint(5) signed NOT NULL DEFAULT '1'; diff --git a/sql/updates/3.3.3a_old/8602_world_spell_proc_event.sql b/sql/updates/3.3.3a_old/8602_world_spell_proc_event.sql new file mode 100644 index 0000000..ce7873f --- /dev/null +++ b/sql/updates/3.3.3a_old/8602_world_spell_proc_event.sql @@ -0,0 +1 @@ +UPDATE `spell_proc_event` SET `Cooldown`=30 WHERE `entry` IN (30886, 30885, 30884, 30883, 30881); diff --git a/sql/updates/3.3.3a_old/8605_world_playercreateinfo_item.sql b/sql/updates/3.3.3a_old/8605_world_playercreateinfo_item.sql new file mode 100644 index 0000000..c5d423c --- /dev/null +++ b/sql/updates/3.3.3a_old/8605_world_playercreateinfo_item.sql @@ -0,0 +1 @@ +ALTER TABLE `playercreateinfo_item` CHANGE `amount` `amount` tinyint(3) NOT NULL DEFAULT '1'; diff --git a/sql/updates/3.3.3a_old/8607_world_pool_creature.sql b/sql/updates/3.3.3a_old/8607_world_pool_creature.sql new file mode 100644 index 0000000..400e54c --- /dev/null +++ b/sql/updates/3.3.3a_old/8607_world_pool_creature.sql @@ -0,0 +1,2 @@ +UPDATE `pool_creature` SET `description` = `comment` WHERE `comment` <> '' AND `comment` IS NOT NULL AND (`description` = '' OR `description` IS NULL); +ALTER TABLE `pool_creature` DROP COLUMN `comment`; diff --git a/sql/updates/3.3.3a_old/8607_world_pool_template.sql b/sql/updates/3.3.3a_old/8607_world_pool_template.sql new file mode 100644 index 0000000..ac1cbf7 --- /dev/null +++ b/sql/updates/3.3.3a_old/8607_world_pool_template.sql @@ -0,0 +1,2 @@ +UPDATE `pool_template` SET `description` = `comment` WHERE `comment` <> '' AND `comment` IS NOT NULL AND (`description` = '' OR `description` IS NULL); +ALTER TABLE `pool_template` DROP COLUMN `comment`; diff --git a/sql/updates/3.3.3a_old/8625_world_pool_creature.sql b/sql/updates/3.3.3a_old/8625_world_pool_creature.sql new file mode 100644 index 0000000..ade35ef --- /dev/null +++ b/sql/updates/3.3.3a_old/8625_world_pool_creature.sql @@ -0,0 +1 @@ +ALTER TABLE `pool_creature` DROP PRIMARY KEY, ADD PRIMARY KEY (`guid`); diff --git a/sql/updates/3.3.3a_old/8625_world_pool_gameobject.sql b/sql/updates/3.3.3a_old/8625_world_pool_gameobject.sql new file mode 100644 index 0000000..720fbb7 --- /dev/null +++ b/sql/updates/3.3.3a_old/8625_world_pool_gameobject.sql @@ -0,0 +1 @@ +ALTER TABLE `pool_gameobject` DROP PRIMARY KEY, ADD PRIMARY KEY (`guid`); diff --git a/sql/updates/3.3.3a_old/8625_world_pool_pool.sql b/sql/updates/3.3.3a_old/8625_world_pool_pool.sql new file mode 100644 index 0000000..1c8b9f3 --- /dev/null +++ b/sql/updates/3.3.3a_old/8625_world_pool_pool.sql @@ -0,0 +1 @@ +ALTER TABLE `pool_pool` DROP PRIMARY KEY, ADD PRIMARY KEY (`pool_id`); diff --git a/sql/updates/3.3.3a_old/8638_world_scriptname.sql b/sql/updates/3.3.3a_old/8638_world_scriptname.sql new file mode 100644 index 0000000..d3f357f --- /dev/null +++ b/sql/updates/3.3.3a_old/8638_world_scriptname.sql @@ -0,0 +1,12 @@ +update `creature_template` SET `scriptname`='mob_azure_invader' WHERE `entry`=30661; -- Azure Invader 1 +update `creature_template` SET `scriptname`='mob_azure_spellbreaker' WHERE `entry`=30662; -- Azure Spellbreaker +update `creature_template` SET `scriptname`='mob_azure_binder' WHERE `entry`=30663; -- Azure Binder 1 +update `creature_template` SET `scriptname`='mob_azure_mage_slayer' WHERE `entry`=30664; -- Azure Mage Slayer 1 +update `creature_template` SET `scriptname`='mob_azure_captain' WHERE `entry`=30666; -- Azure Captain +update `creature_template` SET `scriptname`='mob_azure_sorceror' WHERE `entry`=30667; -- Azure Sorceror +update `creature_template` SET `scriptname`='mob_azure_raider' WHERE `entry`=30668; -- Azure Raider +update `creature_template` SET `scriptname`='mob_azure_stalker' WHERE `entry`=32191; -- Azure Stalker +update `creature_template` SET `scriptname`='mob_azure_invader' WHERE `entry`=30961; -- Azure Invader 2 +update `creature_template` SET `scriptname`='mob_azure_spellbreaker' WHERE `entry`=30962; -- Azure Spellbreaker +update `creature_template` SET `scriptname`='mob_azure_binder' WHERE `entry`=30918; -- Azure Binder 2 +update `creature_template` SET `scriptname`='mob_azure_mage_slayer' WHERE `entry`=30963; -- Azure Mage Sl diff --git a/sql/updates/3.3.3a_old/8658_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8658_world_spell_linked_spell.sql new file mode 100644 index 0000000..59e96ca --- /dev/null +++ b/sql/updates/3.3.3a_old/8658_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=20066; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(20066, -61840, 0, 'Repentance'); diff --git a/sql/updates/3.3.3a_old/8671_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8671_world_spell_linked_spell.sql new file mode 100644 index 0000000..d257272 --- /dev/null +++ b/sql/updates/3.3.3a_old/8671_world_spell_linked_spell.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (54861,55004)AND `spell_effect` IN (-23335,-23333); +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(54861,-23335,0, 'Drop Flag on Nitro Boost WSG'), +(54861,-23333,0, 'Drop Flag on Nitro Boost WSG'), +(55004,-23335,0, 'Drop Flag on Nitro Boost WSG'), +(55004,-23333,0, 'Drop Flag on Nitro Boost WSG'); diff --git a/sql/updates/3.3.3a_old/8672_world_gossip_menu_option.sql b/sql/updates/3.3.3a_old/8672_world_gossip_menu_option.sql new file mode 100644 index 0000000..2ba8695 --- /dev/null +++ b/sql/updates/3.3.3a_old/8672_world_gossip_menu_option.sql @@ -0,0 +1,2 @@ +-- Drop forgotten fields after condition implementation +ALTER TABLE gossip_menu_option DROP COLUMN cond_3,DROP COLUMN cond_3_val_1,DROP COLUMN cond_3_val_2; diff --git a/sql/updates/3.3.3a_old/8674_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8674_world_spell_dbc.sql new file mode 100644 index 0000000..e1e9e8d --- /dev/null +++ b/sql/updates/3.3.3a_old/8674_world_spell_dbc.sql @@ -0,0 +1,4 @@ +-- Add serverside spells place holders for future development +DELETE FROM `spell_dbc` WHERE `Id`=39616; +INSERT INTO `spell_dbc` (`Id`,`Comment`) VALUES +(39616, 'Quest 10966 reward serverside spell'); diff --git a/sql/updates/3.3.3a_old/8674_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8674_world_spell_linked_spell.sql new file mode 100644 index 0000000..1333c72 --- /dev/null +++ b/sql/updates/3.3.3a_old/8674_world_spell_linked_spell.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (54861,55004)AND `spell_effect` IN (-34976); +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +( 54861,-34976, 0, 'Drop Flag on Nitro Boost EOS'), +( 55004,-34976, 0, 'Drop Flag on Nitro Boost EOS'); diff --git a/sql/updates/3.3.3a_old/8694_world_transport_events.sql b/sql/updates/3.3.3a_old/8694_world_transport_events.sql new file mode 100644 index 0000000..0e8786f --- /dev/null +++ b/sql/updates/3.3.3a_old/8694_world_transport_events.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `transport_events`; diff --git a/sql/updates/3.3.3a_old/8752_world_scriptname.sql b/sql/updates/3.3.3a_old/8752_world_scriptname.sql new file mode 100644 index 0000000..03bc1bb --- /dev/null +++ b/sql/updates/3.3.3a_old/8752_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `scriptname`='mob_azure_saboteur' WHERE `entry`=31079; -- Azure Saboteur diff --git a/sql/updates/3.3.3a_old/8770_world_areatrigger_scripts.sql b/sql/updates/3.3.3a_old/8770_world_areatrigger_scripts.sql new file mode 100644 index 0000000..044725b --- /dev/null +++ b/sql/updates/3.3.3a_old/8770_world_areatrigger_scripts.sql @@ -0,0 +1,4 @@ +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (5369,5423); +INSERT INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES +(5369, 'at_RX_214_repair_o_matic_station'), +(5423, 'at_RX_214_repair_o_matic_station'); diff --git a/sql/updates/3.3.3a_old/8770_world_script_waypoints.sql b/sql/updates/3.3.3a_old/8770_world_script_waypoints.sql new file mode 100644 index 0000000..c2418f6 --- /dev/null +++ b/sql/updates/3.3.3a_old/8770_world_script_waypoints.sql @@ -0,0 +1,9 @@ +-- Waypoints for Mimron Inferno +DELETE FROM `script_waypoint` WHERE `entry`=33370; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(33370, 1, 331.674, -68.6878, 409.804, 0, '0'), +(33370, 2, 274.578, -92.1829, 409.804, 0, '0'), +(33370, 3, 226.433, -66.6652, 409.793, 0, '0'), +(33370, 4, 206.092, -34.7447, 409.801, 0, '0'), +(33370, 5, 240.208, 1.10346, 409.802, 0, '0'), +(33370, 6, 337.199, 11.7051, 409.802, 0, '0'); diff --git a/sql/updates/3.3.3a_old/8770_world_scriptname.sql b/sql/updates/3.3.3a_old/8770_world_scriptname.sql new file mode 100644 index 0000000..e173f7e --- /dev/null +++ b/sql/updates/3.3.3a_old/8770_world_scriptname.sql @@ -0,0 +1,12 @@ +UPDATE `creature_template` SET `ScriptName`= 'npc_thorims_hammer' WHERE `entry`=33365; +UPDATE `creature_template` SET `ScriptName`= 'npc_mimirons_inferno' WHERE `entry`=33370; +UPDATE `creature_template` SET `ScriptName`= 'npc_hodirs_fury' WHERE `entry`=33312; +UPDATE `creature_template` SET `ScriptName`= 'npc_freyas_ward' WHERE `entry`=33367; +UPDATE `creature_template` SET `ScriptName`= 'npc_lorekeeper' WHERE `entry`=33686; +UPDATE `creature_template` SET `ScriptName`= 'npc_brann_bronzebeard' WHERE `entry`=33579; +UPDATE `creature_template` SET `ScriptName`= 'npc_freya_ward_summon' WHERE `entry`=34275; +UPDATE `creature_template` SET `ScriptName`= 'npc_mechanolift' WHERE `entry`=33214; +UPDATE `gameobject_template` SET `ScriptName`= 'go_ulduar_tower' WHERE `entry`=194375; +UPDATE `gameobject_template` SET `ScriptName`= 'go_ulduar_tower' WHERE `entry`=194371; +UPDATE `gameobject_template` SET `ScriptName`= 'go_ulduar_tower' WHERE `entry`=194370; +UPDATE `gameobject_template` SET `ScriptName`= 'go_ulduar_tower' WHERE `entry`=194377; diff --git a/sql/updates/3.3.3a_old/8790_world_locales_item_set_names.sql b/sql/updates/3.3.3a_old/8790_world_locales_item_set_names.sql new file mode 100644 index 0000000..4f6015a --- /dev/null +++ b/sql/updates/3.3.3a_old/8790_world_locales_item_set_names.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS `locales_item_set_names`; +RENAME TABLE `locales_item_set_name` TO `locales_item_set_names`; diff --git a/sql/updates/3.3.3a_old/8816_world_spell_bonus_data.sql b/sql/updates/3.3.3a_old/8816_world_spell_bonus_data.sql new file mode 100644 index 0000000..67d01d1 --- /dev/null +++ b/sql/updates/3.3.3a_old/8816_world_spell_bonus_data.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (45284,45297); +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES +(45284,0.357,-1,-1,-1,'Shaman - LO Lightning Bolt'), +(45297,0.285,-1,-1,-1,'Shaman - LO Chain Lightning'); diff --git a/sql/updates/3.3.3a_old/8821_world_spell_dbc.sql b/sql/updates/3.3.3a_old/8821_world_spell_dbc.sql new file mode 100644 index 0000000..903a932 --- /dev/null +++ b/sql/updates/3.3.3a_old/8821_world_spell_dbc.sql @@ -0,0 +1,8 @@ +-- Add serverside spells place holders for future development +DELETE FROM `spell_dbc` WHERE `Id` IN (11202,25359,40145,45767,71098); +INSERT INTO `spell_dbc` (`Id`,`Comment`) VALUES +(11202, 'Item 3776 spellid_1 serverside spell'), +(25359, 'Item 21293 spellid_2 serverside spell'), +(40145, 'Quest 11000 RewSpellCast serverside spell'), +(45767, 'Quest 11670 RewSpellCast serverside spell'), +(71098, 'Quest 24451 RewSpellCast serverside spell'); diff --git a/sql/updates/3.3.3a_old/8836_world_spell_linked_spell.sql b/sql/updates/3.3.3a_old/8836_world_spell_linked_spell.sql new file mode 100644 index 0000000..64c3c66 --- /dev/null +++ b/sql/updates/3.3.3a_old/8836_world_spell_linked_spell.sql @@ -0,0 +1,3 @@ +-- Make the Ardent Defender heal (66235) trigger the visuals (66233) +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=66235; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES (66235,66233,0, 'Ardent Defender Visuals'); diff --git a/sql/updates/3.3.3a_old/8842_world_script_texts.sql b/sql/updates/3.3.3a_old/8842_world_script_texts.sql new file mode 100644 index 0000000..617b61a --- /dev/null +++ b/sql/updates/3.3.3a_old/8842_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM script_texts where entry IN (-1000474, -1000475, -1000476); +INSERT INTO script_texts (`npc_entry`, `entry`, `content_default`, `type`, `language`, `comment`) VALUE +(17375, -1000474, '[Fulborg] The Stillpine furbolgs will not soon forget your bravery!', 0, 0, 'Stillpine Capitive free say text 1'), +(17375, -1000475, '[Fulborg] Thank you, $N', 0, 0, 'Stillpine Capitive free say text 2'), +(17375, -1000476, '[Fulborg] Those remaining at Stillpine Hold will welcome you as a hero!', 0, 0, 'Stillpine Capitive free say text 3'); diff --git a/sql/updates/3.3.3a_old/8842_world_scriptname.sql b/sql/updates/3.3.3a_old/8842_world_scriptname.sql new file mode 100644 index 0000000..5ef8e4b --- /dev/null +++ b/sql/updates/3.3.3a_old/8842_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `ScriptName`='npc_stillpine_capitive' where `entry`=17375; +UPDATE `gameobject_template` SET `ScriptName`='go_stillpine_cage' WHERE `entry`=181714; diff --git a/sql/updates/3.3.3a_old/8843_world_scriptname.sql b/sql/updates/3.3.3a_old/8843_world_scriptname.sql new file mode 100644 index 0000000..4517544 --- /dev/null +++ b/sql/updates/3.3.3a_old/8843_world_scriptname.sql @@ -0,0 +1,2 @@ +UPDATE `gameobject_template` SET `ScriptName`='go_bristlelimb_cage' WHERE `entry`=181714; + diff --git a/sql/updates/3.3.3a_old/CMakeLists.txt b/sql/updates/3.3.3a_old/CMakeLists.txt new file mode 100644 index 0000000..8557b4d --- /dev/null +++ b/sql/updates/3.3.3a_old/CMakeLists.txt @@ -0,0 +1,3 @@ +FILE(GLOB _SQL_333 *.sql) + +INSTALL(FILES ${_SQL_333} DESTINATION share/trinity/sql/updates/3.3.3a_old) \ No newline at end of file diff --git a/sql/updates/3.3.5a_old/8861_auth_realmlist.sql b/sql/updates/3.3.5a_old/8861_auth_realmlist.sql new file mode 100644 index 0000000..c6622d5 --- /dev/null +++ b/sql/updates/3.3.5a_old/8861_auth_realmlist.sql @@ -0,0 +1,3 @@ +UPDATE `realmlist` SET `gamebuild`=12340 WHERE `id`=1; +ALTER TABLE `realmlist` CHANGE COLUMN `gamebuild` `gamebuild` int(11) unsigned NOT NULL default '12340'; + diff --git a/sql/updates/3.3.5a_old/CMakeLists.txt b/sql/updates/3.3.5a_old/CMakeLists.txt new file mode 100644 index 0000000..63cb6ea --- /dev/null +++ b/sql/updates/3.3.5a_old/CMakeLists.txt @@ -0,0 +1,3 @@ +FILE(GLOB _SQL_335 *.sql) + +INSTALL(FILES ${_SQL_333} DESTINATION share/trinity/sql/updates/3.3.5a_old) diff --git a/sql/updates/8890_world_spell_dbc.sql b/sql/updates/8890_world_spell_dbc.sql new file mode 100644 index 0000000..a5e0927 --- /dev/null +++ b/sql/updates/8890_world_spell_dbc.sql @@ -0,0 +1,3 @@ +ALTER TABLE `spell_dbc` + ADD COLUMN `Stances` int(10) unsigned NOT NULL DEFAULT '0' AFTER `AttributesEx5`, + ADD COLUMN `StancesNot` int(10) unsigned NOT NULL DEFAULT '0' AFTER `Stances`; diff --git a/sql/updates/8891_world_spell_dbc.sql b/sql/updates/8891_world_spell_dbc.sql new file mode 100644 index 0000000..6adb4e5 --- /dev/null +++ b/sql/updates/8891_world_spell_dbc.sql @@ -0,0 +1,2 @@ +UPDATE `spell_dbc` SET `Stances`=0x90 WHERE `Id`=24899; +UPDATE `spell_dbc` SET `Stances`=0x1 WHERE `Id`=24900; diff --git a/sql/updates/8897_world_npc_vendor.sql b/sql/updates/8897_world_npc_vendor.sql new file mode 100644 index 0000000..0e1c793 --- /dev/null +++ b/sql/updates/8897_world_npc_vendor.sql @@ -0,0 +1,5 @@ +-- Restore negative ExtendedCost, we now use FlagsExtra value instead +UPDATE `npc_vendor` SET `ExtendedCost`=-`ExtendedCost` WHERE `ExtendedCost`<0; + +-- Set field type to unsigned +ALTER TABLE npc_vendor CHANGE COLUMN `ExtendedCost` `ExtendedCost` mediumint(8) UNSIGNED NOT NULL default '0' COMMENT ''; diff --git a/sql/updates/8897_world_trinity_string.sql b/sql/updates/8897_world_trinity_string.sql new file mode 100644 index 0000000..691b072 --- /dev/null +++ b/sql/updates/8897_world_trinity_string.sql @@ -0,0 +1,2 @@ +-- UPDATE so we don't kill customized locale strings if user has any +UPDATE `trinity_string` SET `content_default`='Item ''%u'' (with extended cost %u) already in vendor list.' WHERE `entry`=210; diff --git a/sql/updates/8905_world_spell_proc_event.sql b/sql/updates/8905_world_spell_proc_event.sql new file mode 100644 index 0000000..7429a6a --- /dev/null +++ b/sql/updates/8905_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN(67758); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(67758,0,0,0,0,0,0,2,0,0,2); diff --git a/sql/updates/8906_world_spell_proc_event.sql b/sql/updates/8906_world_spell_proc_event.sql new file mode 100644 index 0000000..2d5c35c --- /dev/null +++ b/sql/updates/8906_world_spell_proc_event.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_proc_event` WHERE `entry` IN (47201,47202,47203,47204,47205); +INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES +(47201,0,5,0x00004009,0x00040000,0x00000000,0x00000000,0x0000000,0,0,0), +(47202,0,5,0x00004009,0x00040000,0x00000000,0x00000000,0x0000000,0,0,0), +(47203,0,5,0x00004009,0x00040000,0x00000000,0x00000000,0x0000000,0,0,0), +(47204,0,5,0x00004009,0x00040000,0x00000000,0x00000000,0x0000000,0,0,0), +(47205,0,5,0x00004009,0x00040000,0x00000000,0x00000000,0x0000000,0,0,0); \ No newline at end of file diff --git a/sql/updates/8915_world_trinity_string.sql b/sql/updates/8915_world_trinity_string.sql new file mode 100644 index 0000000..49676b0 --- /dev/null +++ b/sql/updates/8915_world_trinity_string.sql @@ -0,0 +1,4 @@ +-- UPDATE so we don't kill customized locale strings if user has any +UPDATE `trinity_string` SET `content_default`='The old password is wrong' WHERE `entry`=27; +-- INSERT as this string has not been used before +INSERT INTO `trinity_string` VALUES (62, 'One on more parameters have incorrect values', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/CMakeLists.txt b/sql/updates/CMakeLists.txt new file mode 100644 index 0000000..fca7e74 --- /dev/null +++ b/sql/updates/CMakeLists.txt @@ -0,0 +1,11 @@ +add_subdirectory(2.4.3_old) +add_subdirectory(3.0.9_old) +add_subdirectory(3.1.3_old) +add_subdirectory(3.2.2a_old) +add_subdirectory(3.3.2_old) +add_subdirectory(3.3.3a_old) +add_subdirectory(3.3.5a_old) + +FILE(GLOB _SQL_UPDATES *.sql) + +INSTALL(FILES ${_SQL_UPDATES} DESTINATION share/trinity/sql/updates) diff --git a/sql/wow_ro/13_world_player_factionchange.sql b/sql/wow_ro/13_world_player_factionchange.sql new file mode 100644 index 0000000..6bf284c --- /dev/null +++ b/sql/wow_ro/13_world_player_factionchange.sql @@ -0,0 +1,57 @@ +SET FOREIGN_KEY_CHECKS=0; +-- ---------------------------- +-- Table structure for `player_factionchange_reputations` +-- ---------------------------- +DROP TABLE IF EXISTS `player_factionchange_reputations`; +CREATE TABLE `player_factionchange_reputations` ( + `alliance_id` int(8) NOT NULL, + `horde_id` int(8) NOT NULL, + PRIMARY KEY (`alliance_id`,`horde_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Records of player_factionchange_reputations +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `player_factionchange_spells` +-- ---------------------------- +DROP TABLE IF EXISTS `player_factionchange_spells`; +CREATE TABLE `player_factionchange_spells` ( + `alliance_id` int(8) NOT NULL, + `horde_id` int(8) NOT NULL, + PRIMARY KEY (`alliance_id`,`horde_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Records of player_factionchange_spells +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `player_factionchange_items` +-- ---------------------------- +DROP TABLE IF EXISTS `player_factionchange_items`; +CREATE TABLE `player_factionchange_items` ( + `alliance_id` int(8) NOT NULL, + `horde_id` int(8) NOT NULL, + PRIMARY KEY (`alliance_id`,`horde_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Records of player_factionchange_items +-- ---------------------------- + +-- ---------------------------- +-- Table structure for `player_factionchange_achievements` +-- ---------------------------- +DROP TABLE IF EXISTS `player_factionchange_achievements`; +CREATE TABLE `player_factionchange_achievements` ( + `alliance_id` int(8) NOT NULL, + `horde_id` int(8) NOT NULL, + PRIMARY KEY (`alliance_id`,`horde_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Records of player_factionchange_achievements +-- ---------------------------- + diff --git a/sql/wow_ro/19_quest_template.sql b/sql/wow_ro/19_quest_template.sql new file mode 100644 index 0000000..57c9f0d --- /dev/null +++ b/sql/wow_ro/19_quest_template.sql @@ -0,0 +1,15 @@ +-- Temp fix for some quests + +-- Death Knight Starting Zone +-- Into the Realm of Shadows +UPDATE `quest_template` SET `method`='0' WHERE `entry`='12687'; +-- Behind Scarlet Lines +UPDATE `quest_template` SET `PrevQuestId`='-12720' WHERE `entry`='12723'; +-- The Battle For The Ebon Hold +UPDATE `quest_template` SET `method`='0' WHERE `entry`='13166'; +-- Into the Realm of Shadows +UPDATE `quest_template` SET `method`='0' WHERE `entry`='12687'; +-- Massacre At Light's Point +UPDATE `quest_template` SET `method`='0' WHERE `entry`='12701'; +-- An End To All Things +UPDATE `quest_template` SET `method`='0' WHERE `entry`='12779'; \ No newline at end of file diff --git a/sql/wow_ro/1_boss_spell_table.sql b/sql/wow_ro/1_boss_spell_table.sql new file mode 100644 index 0000000..c3988b0 --- /dev/null +++ b/sql/wow_ro/1_boss_spell_table.sql @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS `boss_spell_table`; +CREATE TABLE IF NOT EXISTS `boss_spell_table` ( + `entry` mediumint(8) NOT NULL DEFAULT '0' COMMENT 'Creature entry', + `spellID_N10` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Spell ID for 10 normal', + `spellID_N25` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Spell ID for 25 normal', + `spellID_H10` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Spell ID for 10 heroic', + `spellID_H25` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Spell ID for 25 heroic', + `timerMin_N10` mediumint(8) unsigned NOT NULL DEFAULT '15000' COMMENT 'Minimum timer for this spell (in ms.) for 10 normal', + `timerMin_N25` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Minimum timer for this spell (in ms.) for 25 normal', + `timerMin_H10` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Minimum timer for this spell (in ms.) for 10 heroic', + `timerMin_H25` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Minimum timer for this spell (in ms.) for 25 heroic', + `timerMax_N10` mediumint(8) unsigned NOT NULL DEFAULT '30000' COMMENT 'Maximum timer for this spell (in ms.) for 10 normal', + `timerMax_N25` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Maximum timer for this spell (in ms.) for 25 normal', + `timerMax_H10` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Maximum timer for this spell (in ms.) for 10 heroic', + `timerMax_H25` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Maximum timer for this spell (in ms.) for 25 heroic', + `data1` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Various INT data for this spell or summon for 10 normal', + `data2` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Various INT data for this spell for 25 normal', + `data3` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Various INT data for this spell for 10 heroic', + `data4` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT 'Various INT data for this spell for 25 heroic', + `locData_x` float NOT NULL DEFAULT '0' COMMENT 'Location X data for this spell', + `locData_y` float NOT NULL DEFAULT '0' COMMENT 'Location Y data for this spell', + `locData_z` float NOT NULL DEFAULT '0' COMMENT 'Location Z data for this spell', + `varData` mediumint(8) NOT NULL DEFAULT '0' COMMENT 'Special data field for this spell (basepoint for Aura, for example)', + `StageMask_N` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Stage mask for this spell (don\'t used now)', + `StageMask_H` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Stage mask for this spell - heroic mode (don\'t used now)', + `CastType` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Type of cast (by enum BossSpellTableParameters)', + `isVisualEffect` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Is spell is Visual effect only', + `isBugged` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Is spell bugged and need override', + `textEntry` mediumint(8) NOT NULL DEFAULT '0' COMMENT 'Text from script_texts for this spell casting', + `comment` text, + PRIMARY KEY (`entry`,`spellID_N10`,`CastType`), + INDEX `idx_entry`(`entry`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT 'Boss spell table by /dev/rsa'; \ No newline at end of file diff --git a/sql/wow_ro/1_spell_bonus_data.sql b/sql/wow_ro/1_spell_bonus_data.sql new file mode 100644 index 0000000..8ec2f24 --- /dev/null +++ b/sql/wow_ro/1_spell_bonus_data.sql @@ -0,0 +1 @@ +DELETE FROM `spell_bonus_data` WHERE `entry` IN (20187,54158); \ No newline at end of file diff --git a/sql/wow_ro/20_characters_armory_patch.sql b/sql/wow_ro/20_characters_armory_patch.sql new file mode 100644 index 0000000..be28f64 --- /dev/null +++ b/sql/wow_ro/20_characters_armory_patch.sql @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS `armory_character_stats`; +CREATE TABLE `armory_character_stats` ( + `guid` int(11) NOT NULL, + `data` longtext NOT NULL, + PRIMARY KEY (`guid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='World of Warcraft Armory table'; + +DROP TABLE IF EXISTS `character_feed_log`; +CREATE TABLE `character_feed_log` ( + `guid` int(11) NOT NULL, + `type` smallint(1) NOT NULL, + `data` int(11) NOT NULL, + `date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `counter` int(11) NOT NULL, + PRIMARY KEY (`guid`,`type`,`data`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/sql/wow_ro/21_fix_heart_of_the_wild_spell.sql b/sql/wow_ro/21_fix_heart_of_the_wild_spell.sql new file mode 100644 index 0000000..f41fd12 --- /dev/null +++ b/sql/wow_ro/21_fix_heart_of_the_wild_spell.sql @@ -0,0 +1,16 @@ +#Fix Spell Heart of the Wild +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` in ('-5487', '-9634', '-768'); +INSERT INTO `spell_linked_spell` VALUES +(-5487,-24899,0, 'Heart of the Wild removed if not in Bear Form'), +(-9634,-24899,0, 'Heart of the Wild removed if not in Dire Bear Form'), +(-768,-24900,0, 'Heart of the Wild removed if not in Cat Form'); + +DELETE FROM `spell_dbc` WHERE `id` in ('24899', '24900'); +INSERT INTO spell_dbc VALUES +(24899, 0, 0, 400, 1024, 0, 0, 2097152, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 21, 1, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, -1, +0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 137, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'Heart of the Wild Bear Effect'), +(24900, 0, 0, 400, 1024, 0, 0, 2097152, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 21, 1, +0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, +0, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 'Heart of the Wild Cat Effect'); \ No newline at end of file diff --git a/sql/wow_ro/22_fix_priest_glyphs.sql b/sql/wow_ro/22_fix_priest_glyphs.sql new file mode 100644 index 0000000..86aa2e3 --- /dev/null +++ b/sql/wow_ro/22_fix_priest_glyphs.sql @@ -0,0 +1,4 @@ +DELETE FROM spell_bonus_data WHERE entry IN (56160,56131); +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES +(56160, 0, 0, 0, 0, 'Priest Glyph of Power Word: Shield'), +(56131, 0, 0, 0, 0, 'Priest Glyph of Dispel Magic'); \ No newline at end of file diff --git a/sql/wow_ro/23_gag_order_fix.sql b/sql/wow_ro/23_gag_order_fix.sql new file mode 100644 index 0000000..9aa334c --- /dev/null +++ b/sql/wow_ro/23_gag_order_fix.sql @@ -0,0 +1,6 @@ +-- (12311) Gag Order (Rank 1) +DELETE FROM `spell_proc_event` WHERE `entry` IN (12311); +INSERT INTO `spell_proc_event` VALUES (12311, 0x01, 0, 0x00000800, 0x00000001, 0x00000000, 0x00020220, 0x00000207, 0, 50, 0); +-- (12958) Gag Order (Rank 2) +DELETE FROM `spell_proc_event` WHERE `entry` IN (12958); +INSERT INTO `spell_proc_event` VALUES (12958, 0x01, 0, 0x00000800, 0x00000001, 0x00000000, 0x00020220, 0x00000207, 0, 100, 0); \ No newline at end of file diff --git a/sql/wow_ro/24_battleground_template.sql b/sql/wow_ro/24_battleground_template.sql new file mode 100644 index 0000000..5ff73f0 --- /dev/null +++ b/sql/wow_ro/24_battleground_template.sql @@ -0,0 +1,2 @@ +ALTER TABLE `battleground_template` +ADD COLUMN `honor_mod` float NOT NULL DEFAULT 1 AFTER `disable`; diff --git a/sql/wow_ro/25_acherus_teleporter.sql b/sql/wow_ro/25_acherus_teleporter.sql new file mode 100644 index 0000000..b9e0b74 --- /dev/null +++ b/sql/wow_ro/25_acherus_teleporter.sql @@ -0,0 +1,13 @@ +-- Patch acherus +REPLACE INTO `creature_template` VALUES ('438700', '0', '0', '0', '0', '0', '18', '0', '18', '0', 'Acherus_porter', null, null, '0', '80', '80', '0', '35', '35', '0', '1', '1', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '', '0', '3', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '', '0', '0'); +UPDATE `creature_template` SET `faction_A`=2082 WHERE `entry`=438700; +UPDATE `creature_template` SET `faction_H`=2082 WHERE `entry`=438700; +UPDATE `creature_template` SET `npcflag`=1 WHERE `entry`=438700; +UPDATE `creature_template` SET `unit_flags`=33554432 WHERE `entry`=438700; +UPDATE `creature_template` SET `flags_extra`=130 WHERE `entry`=438700; +DELETE FROM `creature` WHERE `id`=438700; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +('@GUID+1', 438700, 0, 1, 256, 0, 0, 2390.19, -5641.09, 378.069, 0.760892, 300, 0, 0, 5342, 0, 0, 0), +('@GUID+1', 438700, 609, 1, 1, 0, 0, 2386.42, -5643.42, 420.97, 0.629104, 300, 0, 0, 5342, 0, 0, 0), +('@GUID+1', 438700, 609, 1, 1, 0, 0, 2392.36, -5639.5, 377.518, 0.616926, 300, 0, 0, 5342, 0, 0, 0), +('@GUID+1', 438700, 0, 1, 65535, 0, 0, 2386.39, -5643.9, 421.156, 3.57475, 25, 0, 0, 12, 12, 0, 0); \ No newline at end of file diff --git a/sql/wow_ro/26_areatrigger_teleport.sql b/sql/wow_ro/26_areatrigger_teleport.sql new file mode 100644 index 0000000..f75184f --- /dev/null +++ b/sql/wow_ro/26_areatrigger_teleport.sql @@ -0,0 +1,3 @@ +-- Delete an areatrigger teleport to Frozen Throne located in The Spire. Only if you use CTDB. + +DELETE FROM `areatrigger_teleport` WHERE (`id`='5718'); \ No newline at end of file diff --git a/sql/wow_ro/27_fix_shadowmourne_proc.sql b/sql/wow_ro/27_fix_shadowmourne_proc.sql new file mode 100644 index 0000000..777f555 --- /dev/null +++ b/sql/wow_ro/27_fix_shadowmourne_proc.sql @@ -0,0 +1,4 @@ +REPLACE INTO item_template + (`entry`, `class`, `subclass`, `unk0`, `name`, `displayid`, `Quality`, `Flags`, `FlagsExtra`, `BuyCount`, `BuyPrice`, `SellPrice`, `InventoryType`, `AllowableClass`, `AllowableRace`, `ItemLevel`, `RequiredLevel`, `RequiredSkill`, `RequiredSkillRank`, `requiredspell`, `requiredhonorrank`, `RequiredCityRank`, `RequiredReputationFaction`, `RequiredReputationRank`, `maxcount`, `stackable`, `ContainerSlots`, `StatsCount`, `stat_type1`, `stat_value1`, `stat_type2`, `stat_value2`, `stat_type3`, `stat_value3`, `stat_type4`, `stat_value4`, `stat_type5`, `stat_value5`, `stat_type6`, `stat_value6`, `stat_type7`, `stat_value7`, `stat_type8`, `stat_value8`, `stat_type9`, `stat_value9`, `stat_type10`, `stat_value10`, `ScalingStatDistribution`, `ScalingStatValue`, `dmg_min1`, `dmg_max1`, `dmg_type1`, `dmg_min2`, `dmg_max2`, `dmg_type2`, `armor`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `delay`, `ammo_type`, `RangedModRange`, `spellid_1`, `spelltrigger_1`, `spellcharges_1`, `spellppmRate_1`, `spellcooldown_1`, `spellcategory_1`, `spellcategorycooldown_1`, `spellid_2`, `spelltrigger_2`, `spellcharges_2`, `spellppmRate_2`, `spellcooldown_2`, `spellcategory_2`, `spellcategorycooldown_2`, `spellid_3`, `spelltrigger_3`, `spellcharges_3`, `spellppmRate_3`, `spellcooldown_3`, `spellcategory_3`, `spellcategorycooldown_3`, `spellid_4`, `spelltrigger_4`, `spellcharges_4`, `spellppmRate_4`, `spellcooldown_4`, `spellcategory_4`, `spellcategorycooldown_4`, `spellid_5`, `spelltrigger_5`, `spellcharges_5`, `spellppmRate_5`, `spellcooldown_5`, `spellcategory_5`, `spellcategorycooldown_5`, `bonding`, `description`, `PageText`, `LanguageID`, `PageMaterial`, `startquest`, `lockid`, `Material`, `sheath`, `RandomProperty`, `RandomSuffix`, `block`, `itemset`, `MaxDurability`, `area`, `Map`, `BagFamily`, `TotemCategory`, `socketColor_1`, `socketContent_1`, `socketColor_2`, `socketContent_2`, `socketColor_3`, `socketContent_3`, `socketBonus`, `GemProperties`, `RequiredDisenchantSkill`, `ArmorDamageModifier`, `Duration`, `ItemLimitCategory`, `HolidayId`, `ScriptName`, `DisenchantID`, `FoodType`, `minMoneyLoot`, `maxMoneyLoot`, `WDBVerified`) +VALUES + (49623, 2, 1, -1, 'Shadowmourne', 65153, 5, 0, 0, 1, 2523810, 504762, 17, 260643, 8388607, 284, 80, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 4, 4, 223, 7, 198, 32, 114, 44, 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 954, 1592, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3700, 0, 0, 71903, 2, 0, 0, -1, 0, -1, 0, 1, 0, 0, -1, 0, -1, 0, 1, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 1, '', 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 145, 0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 3312, 0, -1, 0, 0, 0, 0, '', 0, 0, 0, 0, 11723); \ No newline at end of file diff --git a/sql/wow_ro/28_naxxramas_drop_and_script_ai.sql b/sql/wow_ro/28_naxxramas_drop_and_script_ai.sql new file mode 100644 index 0000000..ff2eaea --- /dev/null +++ b/sql/wow_ro/28_naxxramas_drop_and_script_ai.sql @@ -0,0 +1,837 @@ +-- some naxx loot and script_ai + +DELETE FROM `creature_loot_template` WHERE (`entry`=16017); +INSERT INTO `creature_loot_template` VALUES +(16017, 33470, 33, 1, 0, 2, 7), +(16017, 43852, 17, 1, 0, 1, 1), +(16017, 35947, 7, 1, 0, 1, 1), +(16017, 33445, 4, 1, 0, 1, 1), +(16017, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29347); +INSERT INTO `creature_loot_template` VALUES +(29347, 33470, 33, 1, 0, 2, 7), +(29347, 43852, 17, 1, 0, 1, 1), +(29347, 35947, 7, 1, 0, 1, 1), +(29347, 33445, 4, 1, 0, 1, 1), +(29347, 40412, 1.5, 1, 1, 1, 1), +(29347, 40409, 1.5, 1, 1, 1, 1), +(29347, 40408, 1.5, 1, 1, 1, 1), +(29347, 40406, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16018); +INSERT INTO `creature_loot_template` VALUES +(16018, 33470, 33, 1, 0, 2, 7), +(16018, 43852, 17, 1, 0, 1, 1), +(16018, 35947, 7, 1, 0, 1, 1), +(16018, 33445, 4, 1, 0, 1, 1), +(16018, 33447, 2, 1, 0, 1, 1), +(16018, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29353); +INSERT INTO `creature_loot_template` VALUES +(29353, 33470, 33, 1, 0, 2, 7), +(29353, 43852, 17, 1, 0, 1, 1), +(29353, 35947, 7, 1, 0, 1, 1), +(29353, 33445, 4, 1, 0, 1, 1), +(29353, 40412, 1.5, 1, 1, 1, 1), +(29353, 40409, 1.5, 1, 1, 1, 1), +(29353, 40414, 1.5, 1, 1, 1, 1), +(29353, 40410, 1.5, 1, 1, 1, 1), +(29353, 40406, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16029); +INSERT INTO `creature_loot_template` VALUES +(16029, 33470, 33, 1, 0, 2, 7), +(16029, 43852, 17, 1, 0, 1, 1), +(16029, 35947, 7, 1, 0, 1, 1), +(16029, 33445, 4, 1, 0, 1, 1), +(16029, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29356); +INSERT INTO `creature_loot_template` VALUES +(29356, 33470, 33, 1, 0, 2, 7), +(29356, 43852, 17, 1, 0, 1, 1), +(29356, 35947, 7, 1, 0, 1, 1), +(29356, 33445, 4, 1, 0, 1, 1), +(29356, 40412, 1.5, 1, 1, 1, 1), +(29356, 40406, 1.5, 1, 1, 1, 1), +(29356, 40408, 1.5, 1, 1, 1, 1), +(29356, 40407, 1.5, 1, 1, 1, 1), +(29356, 40410, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16020); +INSERT INTO `creature_loot_template` VALUES +(16020, 33470, 33, 1, 0, 2, 7), +(16020, 43852, 17, 1, 0, 1, 1), +(16020, 35947, 7, 1, 0, 1, 1), +(16020, 33445, 4, 1, 0, 1, 1), +(16020, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29362); +INSERT INTO `creature_loot_template` VALUES +(29362, 33470, 33, 1, 0, 2, 7), +(29362, 43852, 17, 1, 0, 1, 1), +(29362, 35947, 7, 1, 0, 1, 1), +(29362, 33445, 4, 1, 0, 1, 1), +(29362, 40409, 1.5, 1, 1, 1, 1), +(29362, 40412, 1.5, 1, 1, 1, 1), +(29362, 40414, 1.5, 1, 1, 1, 1), +(29362, 40407, 1.5, 1, 1, 1, 1), +(29362, 40408, 1.5, 1, 1, 1, 1), +(29362, 40410, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16022); +INSERT INTO `creature_loot_template` VALUES +(16022, 33470, 33, 1, 0, 2, 7), +(16022, 43852, 17, 1, 0, 1, 1), +(16022, 35947, 7, 1, 0, 1, 1), +(16022, 33445, 4, 1, 0, 1, 1), +(16022, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29363); +INSERT INTO `creature_loot_template` VALUES +(29363, 33470, 33, 1, 0, 2, 7), +(29363, 43852, 17, 1, 0, 1, 1), +(29363, 35947, 7, 1, 0, 1, 1), +(29363, 33445, 4, 1, 0, 1, 1), +(29363, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16021); +INSERT INTO `creature_loot_template` VALUES +(16021, 33470, 33, 1, 0, 2, 7), +(16021, 43852, 17, 1, 0, 1, 1), +(16021, 35947, 7, 1, 0, 1, 1), +(16021, 33445, 4, 1, 0, 1, 1), +(16021, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29359); +INSERT INTO `creature_loot_template` VALUES +(29359, 33470, 33, 1, 0, 2, 7), +(29359, 43852, 17, 1, 0, 1, 1), +(29359, 35947, 7, 1, 0, 1, 1), +(29359, 33445, 4, 1, 0, 1, 1), +(29359, 40409, 1.5, 1, 1, 1, 1), +(29359, 40412, 1.5, 1, 1, 1, 1), +(29359, 40407, 1.5, 1, 1, 1, 1), +(29359, 40406, 1.5, 1, 1, 1, 1), +(29359, 40414, 1.5, 1, 1, 1, 1); + + +DELETE FROM `creature_loot_template` WHERE (`entry`=16025); +INSERT INTO `creature_loot_template` VALUES +(16025, 33470, 33, 1, 0, 2, 7), +(16025, 43852, 17, 1, 0, 1, 1), +(16025, 35947, 7, 1, 0, 1, 1), +(16025, 33445, 4, 1, 0, 1, 1), +(16025, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29371); +INSERT INTO `creature_loot_template` VALUES +(29371, 33470, 33, 1, 0, 2, 7), +(29371, 43852, 17, 1, 0, 1, 1), +(29371, 35947, 7, 1, 0, 1, 1), +(29371, 33445, 4, 1, 0, 1, 1), +(29371, 33447, 2, 1, 0, 1, 1), +(29371, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=30071); +INSERT INTO `creature_loot_template` VALUES +(30071, 33470, 33, 1, 0, 2, 7), +(30071, 43852, 17, 1, 0, 1, 1), +(30071, 35947, 7, 1, 0, 1, 1), +(30071, 33445, 4, 1, 0, 1, 1), +(30071, 33447, 2, 1, 0, 1, 1), +(30071, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=30075); +INSERT INTO `creature_loot_template` VALUES +(30075, 33470, 33, 1, 0, 2, 7), +(30075, 43852, 17, 1, 0, 1, 1), +(30075, 35947, 7, 1, 0, 1, 1), +(30075, 33445, 4, 1, 0, 1, 1), +(30075, 40412, 1.5, 1, 1, 1, 1), +(30075, 40406, 1.5, 1, 1, 1, 1), +(30075, 40408, 1.5, 1, 1, 1, 1), +(30075, 40407, 1.5, 1, 1, 1, 1), +(30075, 40410, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16146); +INSERT INTO `creature_loot_template` VALUES +(16146, 33470, 33, 1, 0, 2, 7), +(16146, 43852, 17, 1, 0, 1, 1), +(16146, 35947, 7, 1, 0, 1, 1), +(16146, 33445, 4, 1, 0, 1, 1), +(16146, 33447, 2, 1, 0, 1, 1), +(16146, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29823); +INSERT INTO `creature_loot_template` VALUES +(29823, 33470, 33, 1, 0, 2, 7), +(29823, 43852, 17, 1, 0, 1, 1), +(29823, 35947, 7, 1, 0, 1, 1), +(29823, 33445, 4, 1, 0, 1, 1), +(29823, 33447, 2, 1, 0, 1, 1), +(29823, 40406, 1.5, 1, 2, 1, 1), +(29823, 40412, 1.5, 1, 2, 1, 1), +(29823, 40414, 1.5, 1, 2, 1, 1), +(29823, 40409, 1.5, 1, 2, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16165); +INSERT INTO `creature_loot_template` VALUES +(16165, 33470, 33, 1, 0, 2, 7), +(16165, 43852, 17, 1, 0, 1, 1), +(16165, 35947, 7, 1, 0, 1, 1), +(16165, 33445, 4, 1, 0, 1, 1), +(16165, 33447, 2, 1, 0, 1, 1), +(16165, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29828); +INSERT INTO `creature_loot_template` VALUES +(29828, 33470, 33, 1, 0, 2, 7), +(29828, 43852, 17, 1, 0, 1, 1), +(29828, 35947, 7, 1, 0, 1, 1), +(29828, 33445, 4, 1, 0, 1, 1), +(29828, 33447, 2, 1, 0, 1, 1), +(29828, 40408, 1.5, 1, 2, 1, 1), +(29828, 40412, 1.5, 1, 2, 1, 1), +(29828, 40414, 1.5, 1, 2, 1, 1), +(29828, 40407, 1.5, 1, 2, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16164); +INSERT INTO `creature_loot_template` VALUES +(16164, 33470, 33, 1, 0, 2, 7), +(16164, 43852, 17, 1, 0, 1, 1), +(16164, 35947, 7, 1, 0, 1, 1), +(16164, 33445, 4, 1, 0, 1, 1), +(16164, 33447, 2, 1, 0, 1, 1), +(16164, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29825); +INSERT INTO `creature_loot_template` VALUES +(29825, 33470, 33, 1, 0, 2, 7), +(29825, 43852, 17, 1, 0, 1, 1), +(29825, 35947, 7, 1, 0, 1, 1), +(29825, 33445, 4, 1, 0, 1, 1), +(29825, 33447, 2, 1, 0, 1, 1), +(29825, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16145); +INSERT INTO `creature_loot_template` VALUES +(16145, 33470, 33, 1, 0, 2, 7), +(16145, 43852, 17, 1, 0, 1, 1), +(16145, 35947, 7, 1, 0, 1, 1), +(16145, 33445, 4, 1, 0, 1, 1), +(16145, 33447, 2, 1, 0, 1, 1), +(16145, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29824); +INSERT INTO `creature_loot_template` VALUES +(29824, 33470, 33, 1, 0, 2, 7), +(29824, 43852, 17, 1, 0, 1, 1), +(29824, 35947, 7, 1, 0, 1, 1), +(29824, 33445, 4, 1, 0, 1, 1), +(29824, 33447, 2, 1, 0, 1, 1), +(29824, 40408, 1.5, 1, 2, 1, 1), +(29824, 40412, 1.5, 1, 2, 1, 1), +(29824, 40414, 1.5, 1, 2, 1, 1), +(29824, 40410, 1.5, 1, 2, 1, 1), +(29824, 40407, 1.5, 1, 2, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16167); +INSERT INTO `creature_loot_template` VALUES +(16167, 33470, 33, 1, 0, 2, 7), +(16167, 43852, 17, 1, 0, 1, 1), +(16167, 35947, 7, 1, 0, 1, 1), +(16167, 33445, 4, 1, 0, 1, 1), +(16167, 33447, 2, 1, 0, 1, 1), +(16167, 33448, 1.5, 1, 0, 1, 1), +(16167, 39427, 1.1, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29835); +INSERT INTO `creature_loot_template` VALUES +(29835, 33470, 33, 1, 0, 2, 7), +(29835, 43852, 17, 1, 0, 1, 1), +(29835, 35947, 7, 1, 0, 1, 1), +(29835, 33445, 4, 1, 0, 1, 1), +(29835, 33447, 2, 1, 0, 1, 1), +(29835, 33448, 1.5, 1, 0, 1, 1), +(29835, 40407, 1.1, 1, 0, 1, 1), +(29835, 40410, 1.1, 1, 0, 1, 1), +(29835, 40406, 1.1, 1, 0, 1, 1), +(29835, 43510, 1.1, 1, 0, 1, 1), +(29835, 39152, 1.1, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16193); +INSERT INTO `creature_loot_template` VALUES +(16193, 33470, 33, 1, 0, 2, 7), +(16193, 43852, 17, 1, 0, 1, 1), +(16193, 35947, 7, 1, 0, 1, 1), +(16193, 33445, 4, 1, 0, 1, 1), +(16193, 33447, 2, 1, 0, 1, 1), +(16193, 40409, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29837); +INSERT INTO `creature_loot_template` VALUES +(29837, 33470, 33, 1, 0, 2, 7), +(29837, 43852, 17, 1, 0, 1, 1), +(29837, 35947, 7, 1, 0, 1, 1), +(29837, 33445, 4, 1, 0, 1, 1), +(29837, 33447, 2, 1, 0, 1, 1), +(29837, 40408, 1.5, 1, 2, 1, 1), +(29837, 40412, 1.5, 1, 2, 1, 1), +(29837, 40414, 1.5, 1, 2, 1, 1), +(29837, 40410, 1.5, 1, 2, 1, 1), +(29837, 40407, 1.5, 1, 2, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16163); +INSERT INTO `creature_loot_template` VALUES +(16163, 33470, 33, 1, 0, 2, 7), +(16163, 43852, 17, 1, 0, 1, 1), +(16163, 35947, 7, 1, 0, 1, 1), +(16163, 33445, 4, 1, 0, 1, 1), +(16163, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29842); +INSERT INTO `creature_loot_template` VALUES +(29842, 33470, 33, 1, 0, 2, 7), +(29842, 43852, 17, 1, 0, 1, 1), +(29842, 35947, 7, 1, 0, 1, 1), +(29842, 33445, 4, 1, 0, 1, 1), +(29842, 33447, 2, 1, 0, 1, 1), +(29842, 40408, 1.5, 1, 2, 1, 1), +(29842, 40412, 1.5, 1, 2, 1, 1), +(29842, 40414, 1.5, 1, 2, 1, 1), +(29842, 40410, 1.5, 1, 2, 1, 1), +(29842, 40407, 1.5, 1, 2, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16067); +INSERT INTO `creature_loot_template` VALUES +(16067, 33470, 33, 1, 0, 2, 7), +(16067, 43852, 17, 1, 0, 1, 1), +(16067, 35947, 7, 1, 0, 1, 1), +(16067, 33445, 4, 1, 0, 1, 1), +(16067, 39468, 1.5, 1, 0, 1, 1), +(16067, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29852); +INSERT INTO `creature_loot_template` VALUES +(29852, 33470, 33, 1, 0, 2, 7), +(29852, 43852, 17, 1, 0, 1, 1), +(29852, 35947, 7, 1, 0, 1, 1), +(29852, 33445, 4, 1, 0, 1, 1), +(29852, 39468, 1.5, 1, 0, 1, 1), +(29852, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16154); +INSERT INTO `creature_loot_template` VALUES +(16154, 33470, 33, 1, 0, 2, 7), +(16154, 43852, 17, 1, 0, 1, 1), +(16154, 35947, 7, 1, 0, 1, 1), +(16154, 33445, 4, 1, 0, 1, 1), +(16154, 39467, 1.5, 1, 1, 1, 1), +(16154, 39472, 1.5, 1, 1, 1, 1), +(16154, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29831); +INSERT INTO `creature_loot_template` VALUES +(29831, 33470, 33, 1, 0, 2, 7), +(29831, 43852, 17, 1, 0, 1, 1), +(29831, 35947, 7, 1, 0, 1, 1), +(29831, 33445, 4, 1, 0, 1, 1), +(29831, 40408, 1.5, 1, 1, 1, 1), +(29831, 40407, 1.5, 1, 1, 1, 1), +(29831, 40410, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16194); +INSERT INTO `creature_loot_template` VALUES +(16194, 33470, 33, 1, 0, 2, 7), +(16194, 43852, 17, 1, 0, 1, 1), +(16194, 35947, 7, 1, 0, 1, 1), +(16194, 33445, 4, 1, 0, 1, 1), +(16194, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29898); +INSERT INTO `creature_loot_template` VALUES +(29898, 33470, 33, 1, 0, 2, 7), +(29898, 43852, 17, 1, 0, 1, 1), +(29898, 35947, 7, 1, 0, 1, 1), +(29898, 33445, 4, 1, 0, 1, 1), +(29898, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16215); +INSERT INTO `creature_loot_template` VALUES +(16215, 33470, 33, 1, 0, 2, 7), +(16215, 43852, 17, 1, 0, 1, 1), +(16215, 35947, 7, 1, 0, 1, 1), +(16215, 33445, 4, 1, 0, 1, 1), +(16215, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29899); +INSERT INTO `creature_loot_template` VALUES +(29899, 33470, 33, 1, 0, 2, 7), +(29899, 43852, 17, 1, 0, 1, 1), +(29899, 35947, 7, 1, 0, 1, 1), +(29899, 33445, 4, 1, 0, 1, 1), +(29899, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16216); +INSERT INTO `creature_loot_template` VALUES +(16216, 33470, 33, 1, 0, 2, 7), +(16216, 43852, 17, 1, 0, 1, 1), +(16216, 35947, 7, 1, 0, 1, 1), +(16216, 33445, 4, 1, 0, 1, 1), +(16216, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29900); +INSERT INTO `creature_loot_template` VALUES +(29900, 33470, 33, 1, 0, 2, 7), +(29900, 43852, 17, 1, 0, 1, 1), +(29900, 35947, 7, 1, 0, 1, 1), +(29900, 33445, 4, 1, 0, 1, 1), +(29900, 33447, 2, 1, 0, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=15974); +INSERT INTO `creature_loot_template` VALUES +(15974, 44758, 70, 1, 0, 2, 4), +(15974, 42253, 30, 1, 1, 1, 3), +(15974, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29242); +INSERT INTO `creature_loot_template` VALUES +(29242, 44758, 70, 1, 0, 2, 4), +(29242, 42253, 30, 1, 1, 1, 3), +(29242, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=15975); +INSERT INTO `creature_loot_template` VALUES +(15975, 44758, 70, 1, 0, 2, 4), +(15975, 42253, 30, 1, 1, 1, 3), +(15975, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29241); +INSERT INTO `creature_loot_template` VALUES +(29241, 44758, 70, 1, 0, 2, 4), +(29241, 42253, 30, 1, 1, 1, 3), +(29241, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=15976); +INSERT INTO `creature_loot_template` VALUES +(15976, 44758, 70, 1, 0, 2, 4), +(15976, 42253, 30, 1, 1, 1, 3), +(15976, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29243); +INSERT INTO `creature_loot_template` VALUES +(29243, 44758, 70, 1, 0, 2, 4), +(29243, 42253, 30, 1, 1, 1, 3), +(29243, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=15978); +INSERT INTO `creature_loot_template` VALUES +(15978, 44758, 70, 1, 0, 2, 4), +(15978, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=30389); +INSERT INTO `creature_loot_template` VALUES +(30389, 44758, 70, 1, 0, 2, 4), +(30389, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=15980); +INSERT INTO `creature_loot_template` VALUES +(15980, 33470, 40, 1, 0, 2, 7), +(15980, 43852, 17, 1, 0, 1, 1), +(15980, 35947, 7, 1, 0, 1, 1), +(15980, 33445, 4, 1, 0, 1, 1), +(15980, 33447, 2, 1, 0, 1, 1), +(15980, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29247); +INSERT INTO `creature_loot_template` VALUES +(29247, 33470, 40, 1, 0, 2, 7), +(29247, 43852, 17, 1, 0, 1, 1), +(29247, 35947, 7, 1, 0, 1, 1), +(29247, 33445, 4, 1, 0, 1, 1), +(29247, 33447, 2, 1, 0, 1, 1), +(29247, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=15981); +INSERT INTO `creature_loot_template` VALUES +(15981, 33470, 40, 1, 0, 2, 7), +(15981, 43852, 17, 1, 0, 1, 1), +(15981, 35947, 7, 1, 0, 1, 1), +(15981, 33445, 4, 1, 0, 1, 1), +(15981, 33447, 2, 1, 0, 1, 1), +(15981, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29248); +INSERT INTO `creature_loot_template` VALUES +(29248, 33470, 40, 1, 0, 2, 7), +(29248, 43852, 17, 1, 0, 1, 1), +(29248, 35947, 7, 1, 0, 1, 1), +(29248, 33445, 4, 1, 0, 1, 1), +(29248, 33447, 2, 1, 0, 1, 1), +(29248, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=15979); +INSERT INTO `creature_loot_template` VALUES +(15979, 44758, 70, 1, 0, 2, 4), +(15979, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29286); +INSERT INTO `creature_loot_template` VALUES +(29286, 44758, 70, 1, 0, 2, 4), +(29286, 44759, 15, 1, 0, 2, 3); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16244); +INSERT INTO `creature_loot_template` VALUES +(16244, 33470, 40, 1, 0, 2, 7), +(16244, 43852, 17, 1, 0, 1, 1), +(16244, 35947, 7, 1, 0, 1, 1), +(16244, 33445, 4, 1, 0, 1, 1), +(16244, 33447, 2, 1, 0, 1, 1), +(16244, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29574); +INSERT INTO `creature_loot_template` VALUES +(29574, 33470, 33, 1, 0, 2, 7), +(29574, 43852, 17, 1, 0, 1, 1), +(29574, 35947, 7, 1, 0, 1, 1), +(29574, 33445, 4, 1, 0, 1, 1), +(29574, 40412, 1.5, 1, 1, 1, 1), +(29574, 40409, 1.5, 1, 1, 1, 1), +(29574, 40414, 1.5, 1, 1, 1, 1), +(29574, 40410, 1.5, 1, 1, 1, 1), +(29574, 40406, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16243); +INSERT INTO `creature_loot_template` VALUES +(16243, 33470, 40, 1, 0, 2, 7), +(16243, 43852, 17, 1, 0, 1, 1), +(16243, 35947, 7, 1, 0, 1, 1), +(16243, 33445, 4, 1, 0, 1, 1), +(16243, 33447, 2, 1, 0, 1, 1), +(16243, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29575); +INSERT INTO `creature_loot_template` VALUES +(29575, 33470, 33, 1, 0, 2, 7), +(29575, 43852, 17, 1, 0, 1, 1), +(29575, 35947, 7, 1, 0, 1, 1), +(29575, 33445, 4, 1, 0, 1, 1), +(29575, 40412, 1.5, 1, 1, 1, 1), +(29575, 40409, 1.5, 1, 1, 1, 1), +(29575, 40414, 1.5, 1, 1, 1, 1), +(29575, 40410, 1.5, 1, 1, 1, 1), +(29575, 40406, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16168); +INSERT INTO `creature_loot_template` VALUES +(16168, 33470, 40, 1, 0, 2, 7), +(16168, 43852, 17, 1, 0, 1, 1), +(16168, 35947, 7, 1, 0, 1, 1), +(16168, 33445, 4, 1, 0, 1, 1), +(16168, 33447, 2, 1, 0, 1, 1), +(16168, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29576); +INSERT INTO `creature_loot_template` VALUES +(29576, 33470, 33, 1, 0, 2, 7), +(29576, 43852, 17, 1, 0, 1, 1), +(29576, 35947, 7, 1, 0, 1, 1), +(29576, 33445, 4, 1, 0, 1, 1), +(29576, 40412, 1.5, 1, 1, 1, 1), +(29576, 40409, 1.5, 1, 1, 1, 1), +(29576, 40414, 1.5, 1, 1, 1, 1), +(29576, 40410, 1.5, 1, 1, 1, 1), +(29576, 40406, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16297); +INSERT INTO `creature_loot_template` VALUES +(16297, 33470, 40, 1, 0, 2, 7), +(16297, 43852, 17, 1, 0, 1, 1), +(16297, 35947, 7, 1, 0, 1, 1), +(16297, 33445, 4, 1, 0, 1, 1), +(16297, 33447, 2, 1, 0, 1, 1), +(16297, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29601); +INSERT INTO `creature_loot_template` VALUES +(29601, 33470, 33, 1, 0, 2, 7), +(29601, 43852, 17, 1, 0, 1, 1), +(29601, 35947, 7, 1, 0, 1, 1), +(29601, 33445, 4, 1, 0, 1, 1), +(29601, 40412, 1.5, 1, 1, 1, 1), +(29601, 40409, 1.5, 1, 1, 1, 1), +(29601, 40414, 1.5, 1, 1, 1, 1), +(29601, 40410, 1.5, 1, 1, 1, 1), +(29601, 40406, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16036); +INSERT INTO `creature_loot_template` VALUES +(16036, 33470, 40, 1, 0, 2, 7), +(16036, 43852, 17, 1, 0, 1, 1), +(16036, 35947, 7, 1, 0, 1, 1), +(16036, 33445, 4, 1, 0, 1, 1), +(16036, 33447, 2, 1, 0, 1, 1), +(16036, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29608); +INSERT INTO `creature_loot_template` VALUES +(29608, 33470, 33, 1, 0, 2, 7), +(29608, 43852, 17, 1, 0, 1, 1), +(29608, 35947, 7, 1, 0, 1, 1), +(29608, 33445, 4, 1, 0, 1, 1), +(29608, 40412, 1.5, 1, 1, 1, 1), +(29608, 40409, 1.5, 1, 1, 1, 1), +(29608, 40414, 1.5, 1, 1, 1, 1), +(29608, 40410, 1.5, 1, 1, 1, 1), +(29608, 40406, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=16034); +INSERT INTO `creature_loot_template` VALUES +(16034, 33470, 40, 1, 0, 2, 7), +(16034, 43852, 17, 1, 0, 1, 1), +(16034, 35947, 7, 1, 0, 1, 1), +(16034, 33445, 4, 1, 0, 1, 1), +(16034, 33447, 2, 1, 0, 1, 1), +(16034, 39470, 1.5, 1, 1, 1, 1); + +DELETE FROM `creature_loot_template` WHERE (`entry`=29609); +INSERT INTO `creature_loot_template` VALUES +(29609, 33470, 33, 1, 0, 2, 7), +(29609, 43852, 17, 1, 0, 1, 1), +(29609, 35947, 7, 1, 0, 1, 1), +(29609, 33445, 4, 1, 0, 1, 1); + +DELETE FROM `creature_ai_scripts` WHERE (`id`=16427020); +INSERT INTO `creature_ai_scripts` VALUES +(16427020, 16236, 0, 0, 100, 3, 1000, 3000, 3000, 6000, 11, 29407, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spell N'); +DELETE FROM `creature_ai_scripts` WHERE (`id`=16427021); +INSERT INTO `creature_ai_scripts` VALUES +(16427021, 16236, 0, 0, 100, 5, 1000, 3000, 3000, 6000, 11, 54805, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Spell H'); + +DELETE FROM `creature_loot_template` WHERE `item` IN (39467, 39472, 39470, 39427, 39468, 39473); +INSERT INTO `creature_loot_template` VALUES +(16017, 39467, 1.5, 1, 1, 1, 1), +(16017, 39472, 1.5, 1, 1, 1, 1), +(16017, 39470, 1.5, 1, 1, 1, 1), +(16017, 39427, 1.5, 1, 1, 1, 1), +(16017, 39468, 1.5, 1, 1, 1, 1), +(16017, 39473, 1.5, 1, 1, 1, 1), +(16018, 39467, 1.5, 1, 1, 1, 1), +(16018, 39472, 1.5, 1, 1, 1, 1), +(16018, 39470, 1.5, 1, 1, 1, 1), +(16018, 39427, 1.5, 1, 1, 1, 1), +(16018, 39468, 1.5, 1, 1, 1, 1), +(16018, 39473, 1.5, 1, 1, 1, 1), +(16029, 39467, 1.5, 1, 1, 1, 1), +(16029, 39472, 1.5, 1, 1, 1, 1), +(16029, 39470, 1.5, 1, 1, 1, 1), +(16029, 39427, 1.5, 1, 1, 1, 1), +(16029, 39468, 1.5, 1, 1, 1, 1), +(16029, 39473, 1.5, 1, 1, 1, 1), +(16020, 39467, 1.5, 1, 1, 1, 1), +(16020, 39472, 1.5, 1, 1, 1, 1), +(16020, 39470, 1.5, 1, 1, 1, 1), +(16020, 39427, 1.5, 1, 1, 1, 1), +(16020, 39468, 1.5, 1, 1, 1, 1), +(16020, 39473, 1.5, 1, 1, 1, 1), +(16021, 39467, 1.5, 1, 1, 1, 1), +(16021, 39472, 1.5, 1, 1, 1, 1), +(16021, 39470, 1.5, 1, 1, 1, 1), +(16021, 39427, 1.5, 1, 1, 1, 1), +(16021, 39468, 1.5, 1, 1, 1, 1), +(16021, 39473, 1.5, 1, 1, 1, 1), +(16025, 39467, 1.5, 1, 1, 1, 1), +(16025, 39472, 1.5, 1, 1, 1, 1), +(16025, 39470, 1.5, 1, 1, 1, 1), +(16025, 39427, 1.5, 1, 1, 1, 1), +(16025, 39468, 1.5, 1, 1, 1, 1), +(16025, 39473, 1.5, 1, 1, 1, 1), +(30071, 39467, 1.5, 1, 1, 1, 1), +(30071, 39472, 1.5, 1, 1, 1, 1), +(30071, 39470, 1.5, 1, 1, 1, 1), +(30071, 39427, 1.5, 1, 1, 1, 1), +(30071, 39468, 1.5, 1, 1, 1, 1), +(30071, 39473, 1.5, 1, 1, 1, 1), +(16146, 39467, 1.5, 1, 1, 1, 1), +(16146, 39472, 1.5, 1, 1, 1, 1), +(16146, 39470, 1.5, 1, 1, 1, 1), +(16146, 39427, 1.5, 1, 1, 1, 1), +(16146, 39468, 1.5, 1, 1, 1, 1), +(16146, 39473, 1.5, 1, 1, 1, 1), +(16165, 39467, 1.5, 1, 1, 1, 1), +(16165, 39472, 1.5, 1, 1, 1, 1), +(16165, 39470, 1.5, 1, 1, 1, 1), +(16165, 39427, 1.5, 1, 1, 1, 1), +(16165, 39468, 1.5, 1, 1, 1, 1), +(16165, 39473, 1.5, 1, 1, 1, 1), +(16164, 39467, 1.5, 1, 1, 1, 1), +(16164, 39472, 1.5, 1, 1, 1, 1), +(16164, 39470, 1.5, 1, 1, 1, 1), +(16164, 39427, 1.5, 1, 1, 1, 1), +(16164, 39468, 1.5, 1, 1, 1, 1), +(16164, 39473, 1.5, 1, 1, 1, 1), +(16145, 39467, 1.5, 1, 1, 1, 1), +(16145, 39472, 1.5, 1, 1, 1, 1), +(16145, 39470, 1.5, 1, 1, 1, 1), +(16145, 39427, 1.5, 1, 1, 1, 1), +(16145, 39468, 1.5, 1, 1, 1, 1), +(16145, 39473, 1.5, 1, 1, 1, 1), +(16167, 39467, 1.5, 1, 1, 1, 1), +(16167, 39472, 1.5, 1, 1, 1, 1), +(16167, 39470, 1.5, 1, 1, 1, 1), +(16167, 39427, 1.5, 1, 1, 1, 1), +(16167, 39468, 1.5, 1, 1, 1, 1), +(16167, 39473, 1.5, 1, 1, 1, 1), +(16193, 39467, 1.5, 1, 1, 1, 1), +(16193, 39472, 1.5, 1, 1, 1, 1), +(16193, 39470, 1.5, 1, 1, 1, 1), +(16193, 39427, 1.5, 1, 1, 1, 1), +(16193, 39468, 1.5, 1, 1, 1, 1), +(16193, 39473, 1.5, 1, 1, 1, 1), +(16163, 39467, 1.5, 1, 1, 1, 1), +(16163, 39472, 1.5, 1, 1, 1, 1), +(16163, 39470, 1.5, 1, 1, 1, 1), +(16163, 39427, 1.5, 1, 1, 1, 1), +(16163, 39468, 1.5, 1, 1, 1, 1), +(16163, 39473, 1.5, 1, 1, 1, 1), +(16067, 39467, 1.5, 1, 1, 1, 1), +(16067, 39472, 1.5, 1, 1, 1, 1), +(16067, 39470, 1.5, 1, 1, 1, 1), +(16067, 39427, 1.5, 1, 1, 1, 1), +(16067, 39468, 1.5, 1, 1, 1, 1), +(16067, 39473, 1.5, 1, 1, 1, 1), +(16154, 39467, 1.5, 1, 1, 1, 1), +(16154, 39472, 1.5, 1, 1, 1, 1), +(16154, 39470, 1.5, 1, 1, 1, 1), +(16154, 39427, 1.5, 1, 1, 1, 1), +(16154, 39468, 1.5, 1, 1, 1, 1), +(16154, 39473, 1.5, 1, 1, 1, 1), +(16194, 39467, 1.5, 1, 1, 1, 1), +(16194, 39472, 1.5, 1, 1, 1, 1), +(16194, 39470, 1.5, 1, 1, 1, 1), +(16194, 39427, 1.5, 1, 1, 1, 1), +(16194, 39468, 1.5, 1, 1, 1, 1), +(16194, 39473, 1.5, 1, 1, 1, 1), +(16215, 39467, 1.5, 1, 1, 1, 1), +(16215, 39472, 1.5, 1, 1, 1, 1), +(16215, 39470, 1.5, 1, 1, 1, 1), +(16215, 39427, 1.5, 1, 1, 1, 1), +(16215, 39468, 1.5, 1, 1, 1, 1), +(16215, 39473, 1.5, 1, 1, 1, 1), +(16216, 39467, 1.5, 1, 1, 1, 1), +(16216, 39472, 1.5, 1, 1, 1, 1), +(16216, 39470, 1.5, 1, 1, 1, 1), +(16216, 39427, 1.5, 1, 1, 1, 1), +(16216, 39468, 1.5, 1, 1, 1, 1), +(16216, 39473, 1.5, 1, 1, 1, 1), +(15974, 39467, 1.5, 1, 1, 1, 1), +(15974, 39472, 1.5, 1, 1, 1, 1), +(15974, 39470, 1.5, 1, 1, 1, 1), +(15974, 39427, 1.5, 1, 1, 1, 1), +(15974, 39468, 1.5, 1, 1, 1, 1), +(15974, 39473, 1.5, 1, 1, 1, 1), +(15975, 39467, 1.5, 1, 1, 1, 1), +(15975, 39472, 1.5, 1, 1, 1, 1), +(15975, 39470, 1.5, 1, 1, 1, 1), +(15975, 39427, 1.5, 1, 1, 1, 1), +(15975, 39468, 1.5, 1, 1, 1, 1), +(15975, 39473, 1.5, 1, 1, 1, 1), +(15976, 39467, 1.5, 1, 1, 1, 1), +(15976, 39472, 1.5, 1, 1, 1, 1), +(15976, 39470, 1.5, 1, 1, 1, 1), +(15976, 39427, 1.5, 1, 1, 1, 1), +(15976, 39468, 1.5, 1, 1, 1, 1), +(15976, 39473, 1.5, 1, 1, 1, 1), +(15978, 39467, 1.5, 1, 1, 1, 1), +(15978, 39472, 1.5, 1, 1, 1, 1), +(15978, 39470, 1.5, 1, 1, 1, 1), +(15978, 39427, 1.5, 1, 1, 1, 1), +(15978, 39468, 1.5, 1, 1, 1, 1), +(15978, 39473, 1.5, 1, 1, 1, 1), +(15980, 39467, 1.5, 1, 1, 1, 1), +(15980, 39472, 1.5, 1, 1, 1, 1), +(15980, 39470, 1.5, 1, 1, 1, 1), +(15980, 39427, 1.5, 1, 1, 1, 1), +(15980, 39468, 1.5, 1, 1, 1, 1), +(15980, 39473, 1.5, 1, 1, 1, 1), +(15981, 39467, 1.5, 1, 1, 1, 1), +(15981, 39472, 1.5, 1, 1, 1, 1), +(15981, 39470, 1.5, 1, 1, 1, 1), +(15981, 39427, 1.5, 1, 1, 1, 1), +(15981, 39468, 1.5, 1, 1, 1, 1), +(15981, 39473, 1.5, 1, 1, 1, 1), +(15979, 39467, 1.5, 1, 1, 1, 1), +(15979, 39472, 1.5, 1, 1, 1, 1), +(15979, 39470, 1.5, 1, 1, 1, 1), +(15979, 39427, 1.5, 1, 1, 1, 1), +(15979, 39468, 1.5, 1, 1, 1, 1), +(15979, 39473, 1.5, 1, 1, 1, 1), +(16244, 39467, 1.5, 1, 1, 1, 1), +(16244, 39472, 1.5, 1, 1, 1, 1), +(16244, 39470, 1.5, 1, 1, 1, 1), +(16244, 39427, 1.5, 1, 1, 1, 1), +(16244, 39468, 1.5, 1, 1, 1, 1), +(16244, 39473, 1.5, 1, 1, 1, 1), +(16243, 39467, 1.5, 1, 1, 1, 1), +(16243, 39472, 1.5, 1, 1, 1, 1), +(16243, 39470, 1.5, 1, 1, 1, 1), +(16243, 39427, 1.5, 1, 1, 1, 1), +(16243, 39468, 1.5, 1, 1, 1, 1), +(16243, 39473, 1.5, 1, 1, 1, 1), +(16168, 39467, 1.5, 1, 1, 1, 1), +(16168, 39472, 1.5, 1, 1, 1, 1), +(16168, 39470, 1.5, 1, 1, 1, 1), +(16168, 39427, 1.5, 1, 1, 1, 1), +(16168, 39468, 1.5, 1, 1, 1, 1), +(16168, 39473, 1.5, 1, 1, 1, 1), +(16297, 39467, 1.5, 1, 1, 1, 1), +(16297, 39472, 1.5, 1, 1, 1, 1), +(16297, 39470, 1.5, 1, 1, 1, 1), +(16297, 39427, 1.5, 1, 1, 1, 1), +(16297, 39468, 1.5, 1, 1, 1, 1), +(16297, 39473, 1.5, 1, 1, 1, 1), +(16036, 39467, 1.5, 1, 1, 1, 1), +(16036, 39472, 1.5, 1, 1, 1, 1), +(16036, 39470, 1.5, 1, 1, 1, 1), +(16036, 39427, 1.5, 1, 1, 1, 1), +(16036, 39468, 1.5, 1, 1, 1, 1), +(16036, 39473, 1.5, 1, 1, 1, 1), +(16034, 39467, 1.5, 1, 1, 1, 1), +(16034, 39472, 1.5, 1, 1, 1, 1), +(16034, 39470, 1.5, 1, 1, 1, 1), +(16034, 39427, 1.5, 1, 1, 1, 1), +(16034, 39468, 1.5, 1, 1, 1, 1), +(16034, 39473, 1.5, 1, 1, 1, 1); + + + +-- http://www.wowhead.com/npc=16211 +UPDATE `creature_template` SET `unit_flags` = 131074 WHERE `entry` = 16211; + + +-- some scripts_ai +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=29256); +INSERT INTO `creature_ai_scripts` VALUES +( 100000100, 29256, 0, 0, 100, 2, 0, 0, 0, 0, 11, 28969, 4, 32, 0, 0, 0, 0, 0, 0, 0, 0, 'Crypt Guard (Normal) - Cast Acid Spit on Aggro'), +( 100000101, 29256, 0, 0, 100, 4, 0, 0, 0, 0, 11, 56098, 4, 32, 0, 0, 0, 0, 0, 0, 0, 0, 'Crypt Guard (Heroic) - Cast Acid Spit on Aggro'), +( 100000102, 29256, 0, 0, 100, 3, 4000, 6000, 4000, 7000, 11, 28969, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Crypt Guard (Normal) - Cast Acid Spit'), +( 100000104, 29256, 0, 0, 100, 5, 4000, 6000, 4000, 7000, 11, 56098, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Crypt Guard (Heroic) - Cast Acid Spit'), +( 100000105, 29256, 0, 0, 100, 7, 7000, 9000, 7000, 9000, 11, 40504, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Crypt Guard - Cast Cleave'), +( 100000106, 29256, 2, 0, 100, 7, 30, 0, 120000, 120000, 11, 8269, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Crypt Guard - Cast Frenzy at 30% HP'), +(100000107, 29256, 6, 0, 100, 0, 0, 0, 0, 0, 11, 28864, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Crypt Guard - Summon Corpse Scarabs'); + +UPDATE `creature_template` SET `spell1` = 55765, `AIName` = 'EventAI' WHERE `entry` = 16429; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=16429); +INSERT INTO `creature_ai_scripts` VALUES +(100000108, 16429, 9, 0, 100, 3, 0, 3, 500, 1000, 11, 55765, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Wail of Souls - Normal'), +(100000109, 16429, 9, 0, 100, 5, 0, 3, 500, 1000, 11, 55765, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Wail of Souls - Hero'); + + +UPDATE `creature_template` SET `spell1` = 28457, `AIName` = 'EventAI', `spell2` = 55714 WHERE `entry` = 16427; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=16427); +INSERT INTO `creature_ai_scripts` VALUES +(100000110, 16427, 9, 0, 100, 3, 0, 3, 0, 0, 11, 28457, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Explode - Normal'), +(100000111, 16427, 9, 0, 100, 5, 0, 3, 0, 0, 11, 55714, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Explode - Hero'); \ No newline at end of file diff --git a/sql/wow_ro/29_argent_tournament_script_names_npc.sql b/sql/wow_ro/29_argent_tournament_script_names_npc.sql new file mode 100644 index 0000000..589d516 --- /dev/null +++ b/sql/wow_ro/29_argent_tournament_script_names_npc.sql @@ -0,0 +1,17 @@ +-- Argent Tournament +UPDATE gameobject SET state = 0 WHERE id = 194618; +DELETE FROM `gameobject_loot_template` WHERE entry = 194618; +INSERT INTO `gameobject_loot_template` VALUES( +194618, 46070, 100, 1, 0, 1, 1); +UPDATE quest_template SET QuestFlags = 0 WHERE entry = 13678; +UPDATE quest_template SET NextQuestId = 0 WHERE NextQuestId = 13678; +UPDATE quest_template SET ReqCreatureOrGOId1 = 24108 WHERE entry = 13679; +UPDATE quest_template SET NextQuestId = 0 WHERE NextQuestId = 13672; +UPDATE creature_template SET mindmg = 500, maxdmg = 800 WHERE entry = 33448; +UPDATE creature_template SET ScriptName = 'npc_squire_danny' WHERE entry = 33518; +UPDATE creature_template SET mindmg = 650, maxdmg = 1000, ScriptName = 'npc_argent_champion' WHERE entry = 33707; +UPDATE quest_template SET PrevQuestId = 13680 WHERE PrevQuestId = 13687; +UPDATE quest_template SET PrevQuestId = 13679 WHERE PrevQuestId = 13686; +UPDATE quest_template SET ReqSourceId2 = 0, ReqSourceCount2 = 0 WHERE ReqSourceId2 = 45000; +UPDATE item_template SET maxcount = 1 WHERE entry = 45005; +UPDATE creature_template SET ScriptName = 'npc_argent_valiant' WHERE entry = 33448; \ No newline at end of file diff --git a/sql/wow_ro/30_boreal_tundra_script_names_npc.sql b/sql/wow_ro/30_boreal_tundra_script_names_npc.sql new file mode 100644 index 0000000..beb0091 --- /dev/null +++ b/sql/wow_ro/30_boreal_tundra_script_names_npc.sql @@ -0,0 +1,7 @@ +-- script boreal tundra +-- Fizzcrank Fullthrottle +UPDATE creature_template SET ScriptName = 'npc_fizzcrank_fullthrottle' WHERE entry = 25590; +-- Surristrasz +UPDATE creature_template SET ScriptName = 'npc_surristrasz' WHERE entry =24795; +-- Librarian Tiare +UPDATE creature_template SET ScriptName = 'npc_tiare' WHERE entry =30051; \ No newline at end of file diff --git a/sql/wow_ro/31_auth_db_version.sql b/sql/wow_ro/31_auth_db_version.sql new file mode 100644 index 0000000..857d7d4 --- /dev/null +++ b/sql/wow_ro/31_auth_db_version.sql @@ -0,0 +1,19 @@ +-- +-- Table structure for table `realmd_db_version` +-- + +DROP TABLE IF EXISTS `realmd_db_version`; +CREATE TABLE `realmd_db_version` ( + `required_31_auth_db_version` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; + +-- +-- Dumping data for table `realmd_db_version` +-- + +LOCK TABLES `realmd_db_version` WRITE; +/*!40000 ALTER TABLE `realmd_db_version` DISABLE KEYS */; +INSERT INTO `realmd_db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `realmd_db_version` ENABLE KEYS */; +UNLOCK TABLES; \ No newline at end of file diff --git a/sql/wow_ro/31_characters_db_version.sql b/sql/wow_ro/31_characters_db_version.sql new file mode 100644 index 0000000..32ed231 --- /dev/null +++ b/sql/wow_ro/31_characters_db_version.sql @@ -0,0 +1,19 @@ +-- +-- Table structure for table `character_db_version` +-- + +DROP TABLE IF EXISTS `character_db_version`; +CREATE TABLE `character_db_version` ( + `required_31_characters_db_version` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; + +-- +-- Dumping data for table `character_db_version` +-- + +LOCK TABLES `character_db_version` WRITE; +/*!40000 ALTER TABLE `character_db_version` DISABLE KEYS */; +INSERT INTO `character_db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `character_db_version` ENABLE KEYS */; +UNLOCK TABLES; \ No newline at end of file diff --git a/sql/wow_ro/31_world_db_version.sql b/sql/wow_ro/31_world_db_version.sql new file mode 100644 index 0000000..f4698e1 --- /dev/null +++ b/sql/wow_ro/31_world_db_version.sql @@ -0,0 +1,19 @@ +-- +-- Table structure for table `db_version` +-- + +DROP TABLE IF EXISTS `db_version`; +CREATE TABLE `db_version` ( + `required_31_world_db_version` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; + +-- +-- Dumping data for table `db_version` +-- + +LOCK TABLES `db_version` WRITE; +/*!40000 ALTER TABLE `db_version` DISABLE KEYS */; +INSERT INTO `db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `db_version` ENABLE KEYS */; +UNLOCK TABLES; \ No newline at end of file diff --git a/sql/wow_ro/8806_spell_script_target.sql b/sql/wow_ro/8806_spell_script_target.sql new file mode 100644 index 0000000..5e16f32 --- /dev/null +++ b/sql/wow_ro/8806_spell_script_target.sql @@ -0,0 +1,5 @@ +-- Limit Flame Tsunami buff to Lava Blazes only +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=60430; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`) VALUES +(13,60430,18,1,30643), +(13,60430,18,1,31317); diff --git a/sql/wow_ro/IcecrownCitadel/icecrown_citadel.sql b/sql/wow_ro/IcecrownCitadel/icecrown_citadel.sql new file mode 100644 index 0000000..8f937cb --- /dev/null +++ b/sql/wow_ro/IcecrownCitadel/icecrown_citadel.sql @@ -0,0 +1,356 @@ +#Icecrown Citadel +#Cleanup first + +UPDATE `creature_template` SET `ScriptName`='' WHERE `entry` IN (37813,38508,36626,36855,38222,36672,36612,38711,36678,37697,36853,36597,38995,36633,36609,37695,38757,36701,36725,37011,36724,37012,37007,36811,36807,36829,36844,36808,38135,37949,36627,36897,36899,37973,37970,37972,36789,38429,38068,38369,38332,38454,38422,38451); +UPDATE `gameobject_template` SET `ScriptName`='' WHERE `entry` IN (202235,202242,202244,202243,202245,202246,202182,202181); +DELETE FROM `creature` WHERE `id`=38995; + +# GameObject +UPDATE `gameobject_template` SET `ScriptName` = 'icecrown_teleporter' WHERE `entry` IN (202223,202235,202242,202243,202244,202245,202246); +UPDATE `gameobject_template` SET `flags` = 32 WHERE `entry` = 202223; +UPDATE `gameobject_template` SET `flags` = 32 WHERE `entry` = 202242; + +# Boss +UPDATE `creature_template` SET `ScriptName`='boss_blood_queen_lanathel' WHERE (`entry`='37955'); +UPDATE `creature_template` SET `ScriptName`='boss_festergut' WHERE (`entry`='36626'); +UPDATE `creature_template` SET `ScriptName`='boss_saurfang' WHERE (`entry`='37813'); +UPDATE `creature_template` SET `ScriptName`='boss_lady_deathwisper' WHERE (`entry`='36855'); +UPDATE `creature_template` SET `ScriptName`='boss_professor_putricide' WHERE (`entry`='36678'); +UPDATE `creature_template` SET `ScriptName`='boss_blood_elf_valanar_icc' WHERE `entry` = 37970; +UPDATE `creature_template` SET `ScriptName`='boss_blood_elf_keleset_icc' WHERE `entry` = 37972; +UPDATE `creature_template` SET `ScriptName`='boss_blood_elf_taldaram_icc' WHERE `entry` = 37973; +UPDATE `creature_template` SET `ScriptName`='boss_sindragosa' WHERE (`entry`='36853'); +UPDATE `creature_template` SET `ScriptName`='boss_valithria' WHERE `entry` = 36789; +UPDATE `creature_template` SET `ScriptName`='boss_the_lich_king' WHERE (`entry`='36597'); +UPDATE `creature_template` SET `ScriptName`='boss_rotface' WHERE `entry`= 36627; +UPDATE `creature_template` SET `ScriptName`='boss_lord_marrowgar' WHERE (`entry`='36612'); + +# Mobs +UPDATE `creature_template` SET `ScriptName`='npc_tirion_icc' WHERE (`entry`='38995'); +UPDATE `creature_template` SET `ScriptName`='npc_swarming_shadows' WHERE (`entry`='38163'); +UPDATE `creature_template` SET `ScriptName`='npc_bloodbeast' WHERE (`entry`='38508'); +UPDATE `creature_template` SET `ScriptName`='npc_cold_flame' WHERE (`entry`='36672'); +UPDATE `creature_template` SET `ScriptName`='npc_bone_spike' WHERE (`entry`='38711'); +UPDATE `creature_template` SET `ScriptName`='npc_volatile_ooze' WHERE (`entry`='37697'); +UPDATE `creature_template` SET `ScriptName`='npc_ice_puls_icc' WHERE (`entry`='36633'); +UPDATE `creature_template` SET `ScriptName`='npc_valkyr_icc' WHERE (`entry`='36609'); +UPDATE `creature_template` SET `ScriptName`='npc_ghoul_icc' WHERE (`entry`='37695'); +UPDATE `creature_template` SET `ScriptName`='npc_defile_icc' WHERE (`entry`='38757'); +UPDATE `creature_template` SET `ScriptName`='npc_raging_spirit_icc' WHERE (`entry`='36701'); +UPDATE `creature_template` SET `ScriptName`='npc_ooze_little' WHERE `entry`= 36897; +UPDATE `creature_template` SET `ScriptName`='npc_ooze_big' WHERE `entry`= 36899; +UPDATE `creature_template` SET `ScriptName`='npc_nerubar_brood_keeper' WHERE `entry` = 36725; +UPDATE `creature_template` SET `ScriptName`='npc_the_damned' WHERE `entry` = 37011; +UPDATE `creature_template` SET `ScriptName`='npc_servant_of_the_throne' WHERE `entry` = 36724; +UPDATE `creature_template` SET `ScriptName`='npc_ancient_skeletal_soldier' WHERE `entry` = 37012; +UPDATE `creature_template` SET `ScriptName`='npc_death_bound_ward' WHERE `entry` = 37007; +UPDATE `creature_template` SET `ScriptName`='npc_death_speaker_attedant' WHERE `entry` = 36811; +UPDATE `creature_template` SET `ScriptName`='npc_death_speaker_disciple' WHERE `entry` = 36807; +UPDATE `creature_template` SET `ScriptName`='npc_death_speaker_high_priest' WHERE `entry` = 36829; +UPDATE `creature_template` SET `ScriptName`='npc_death_speaker_servant' WHERE `entry` = 36844; +UPDATE `creature_template` SET `ScriptName`='npc_death_speaker_zealot' WHERE `entry` = 36808; +UPDATE `creature_template` SET `ScriptName`='npc_cult_fanatic' WHERE `entry` = 38135; +UPDATE `creature_template` SET `ScriptName`='npc_cult_adherent' WHERE `entry` = 37949; +UPDATE `creature_template` SET `ScriptName`='npc_shade' WHERE `entry` = 38222; +UPDATE `creature_template` SET `ScriptName`='npc_skellmage_icc' WHERE `entry` = 37868; +UPDATE `creature_template` SET `ScriptName`='npc_fireskell_icc' WHERE `entry` = 36791; +UPDATE `creature_template` SET `ScriptName`='npc_suppressor_icc' WHERE `entry` = 37863; +UPDATE `creature_template` SET `ScriptName`='npc_manavoid_icc' WHERE `entry` = 38068; +UPDATE `creature_template` SET `ScriptName`='npc_glutabomination_icc' WHERE `entry` = 37886; +UPDATE `creature_template` SET `ScriptName`='npc_blistzombie_icc' WHERE `entry` = 37934; +UPDATE `creature_template` SET `ScriptName`='npc_dreamcloud_icc' WHERE `entry` = 37985; +UPDATE `creature_template` SET `ScriptName`='npc_dreamportal_icc' WHERE `entry` = 37945; +UPDATE `creature_template` set `minlevel` = 80,`maxlevel` = 80,`faction_A` = 16,`Faction_H` = 16,`unit_flags` = 2 where `entry` in (36672); +UPDATE creature_template SET ScriptName='npc_nucleus_icc' WHERE entry=38369; +UPDATE creature_template SET ScriptName='npc_fireball_icc' WHERE entry=38332; +UPDATE creature_template SET ScriptName='npc_bomb_icc' WHERE entry=38454; +UPDATE creature_template SET ScriptName='npc_vortex_icc' WHERE entry=38422; +UPDATE creature_template SET ScriptName='npc_empfireball_icc' WHERE entry=38451; + +# Other +UPDATE `creature_template` SET `faction_A` = '35', `faction_H` = '35', `unit_flags` = '8', `type_flags` = '67113038' WHERE `entry` IN(36789,10067,10068,10069); + +-- Fix crash until get properly fixed +UPDATE `creature_template` SET `VehicleId` = 0 WHERE `entry` IN (37813,13106,13107,13108); +-- UPDATE `creature_template` SET `VehicleId` = 639 WHERE `entry` IN (37813,13106,13107,13108); + +UPDATE `creature_template` SET `vehicleId` = 0 WHERE `entry` = 36609; +-- UPDATE `creature_template` SET `vehicleId` = 318 WHERE `entry` = 36609; + +# Instance +UPDATE `instance_template` SET `script`='instance_icecrown_citadel' WHERE (`map`='631'); + +# Script Texts + +DELETE FROM script_texts WHERE entry <= -1665892 AND entry >= -1666080; +DELETE FROM script_texts WHERE entry <= -1810001 AND entry >= -1810031; + +# 1 +INSERT INTO `script_texts` VALUES ('36612', '-1665892', 'This is the beginning AND the end, mortals. None may enter the master''s sanctum!', '', '', '', '', '', '', '', '', '16950', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('36612', '-1665893', 'The Scourge will wash over this world as a swarm of death and destruction!', '', '', '', '', '', '', '', '', '16941', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('36612', '-1665894', 'BONE STORM!', '', '', '', '', '', '', '', '', '16946', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('36612', '-1665895', 'Bound by bone!', '', '', '', '', '', '', '', '', '16947', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36612', '-1665896', 'Stick Around!', '', '', '', '', '', '', '', '', '16948', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36612', '-1665897', 'The only escape is death!', '', '', '', '', '', '', '', '', '16949', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36612', '-1665898', 'More bones for the offering!', '', '', '', '', '', '', '', '', '16942', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36612', '-1665899', 'Languish in damnation!', '', '', '', '', '', '', '', '', '16943', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36612', '-1665900', 'I see... only darkness...', '', '', '', '', '', '', '', '', '16944', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36612', '-1665901', 'THE MASTER''S RAGE COURSES THROUGH ME!', '', '', '', '', '', '', '', '', '16945', '1', '0', '0', ''); + +# 2 +INSERT INTO `script_texts` VALUES ('36855', '-1665902', 'You have found your way here, because you are among the few gifted with true vision in a world cursed with blindness!', '', '', '', '', '', '', '', '', '17272', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665903', 'You can see through the fog that hangs over this world like a shroud and grasp where true power lies!', '', '', '', '', '', '', '', '', '17273', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665904', 'Fix your eyes upon your crude hands! The sinew, the soft meat, the dark blood coursing within!', '', '', '', '', '', '', '', '', '16878', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665905', 'It is a weakness! A crippling flaw! A joke played by the creators upon their own creations!', '', '', '', '', '', '', '', '', '17268', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665906', 'The sooner you come to accept your condition as a defect, the sooner you will find yourselves in a position to transcend it!', '', '', '', '', '', '', '', '', '17269', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665907', 'Through our master all things are possible! His power is without limit, and his will unbending!', '', '', '', '', '', '', '', '', '17270', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665908', 'Those who oppose him will be destroyed utterly! And those who serve, who serve wholly, unquestioningly, with utter devotion of mind and soul? Elevated! To heights beyond your ken!', '', '', '', '', '', '', '', '', '17271', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665909', 'What is this disturbance?! You dare trespass upon this hallowed ground? This shall be your final resting place.', '', '', '', '', '', '', '', '', '16868', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665910', 'Enough! I see I must take matters into my own hands!', '', '', '', '', '', '', '', '', '16877', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665911', 'Take this blessing and show these intruders a taste of our master''s power.', '', '', '', '', '', '', '', '', '16873', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665912', 'I release you from the curse of flesh!', '', '', '', '', '', '', '', '', '16874', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665913', 'Arise and exalt in your pure form!', '', '', '', '', '', '', '', '', '16875', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665914', 'You are weak, powerless to resist my will!', '', '', '', '', '', '', '', '', '16876', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665915', 'This charade has gone on long enough.', '', '', '', '', '', '', '', '', '16872', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665916', 'All part of the masters plan! Your end is... inevitable!', '', '', '', '', '', '', '', '', '16871', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665917', 'Do you yet grasp of the futility of your actions?', '', '', '', '', '', '', '', '', '16869', '1', '0', '0', ''); +INSERT INTO `script_texts` VALUES ('36855', '-1665918', 'Embrace the darkness... Darkness eternal!', '', '', '', '', '', '', '', '', '16870', '1', '0', '0', ''); + +# 3 +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1665919,'Thank the spirits for you, brothers and sisters. The Skybreaker has already left. Quickly now, to Orgrim''s Hammer! If you leave soon, you may be able to catch them.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), +(0,-1665920,'This should be helpin''ya!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,''), +(0,-1665921,'Aka''Magosh, brave warriors. The alliance is in great number here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665922,'Captain Saurfang will be pleased to see you aboard Orgrim''s Hammer. Make haste, we will secure the area until you are ready for take-off.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665923,'A screeching cry pierces the air above!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665924,'A Spire Frostwyrm lands just before Orgrim''s Hammer.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665925,'Rise up, sons and daughters of the Horde! Today we battle a hated enemy of the Horde! LOK''TAR OGAR! Kor''kron, take us out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665926,'What is that?! Something approaching in the distance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665927,'ALLIANCE GUNSHIP! ALL HANDS ON DECK!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665928,'Move yer jalopy or we''ll blow it out of the sky, orc! The Horde''s got no business here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665929,'You will know our business soon! KOR''KRON, ANNIHILATE THEM!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665930,'Marines, Sergeants, attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665931,'You DARE board my ship? Your death will come swiftly.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665932,'Riflemen, shoot faster!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665933,'Mortar team, reload!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665934,'We''re taking hull damage, get a sorcerer out here to shut down those cannons!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665935,'The Alliance falter. Onward to the Lich King!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665936,'Damage control! Put those fires out! You haven''t seen the last of the Horde!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665937,'Thank goodness you arrived when you did, heroes. Orgrim''s Hammer has already left. Quickly now, to The Skybreaker! If you leave soon, you may be able to catch them.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665938,'This ought to help!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665939,'Skybreaker Sorcerer summons a Skybreaker Battle Standard.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665940,'You have my thanks. We were outnumbered until you arrived.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665941,'Captain Muradin is waiting aboard The Skybreaker. We''ll secure the area until you are ready for take off.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665942,'Skybreaker infantry, hold position!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665943,'A screeching cry pierces the air above!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665944,'A Spire Frostwyrm lands just before The Skybreaker. ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665945,'Fire up the engines! We got a meetin with destiny, lads!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665946,'Hold on to yer hats!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665947,'What in the world is that? Grab me spyglass, crewman!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665948,'By me own beard! HORDE SAILIN IN FAST N HOT!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665949,'EVASIVE ACTION! MAN THE GUNS!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665950,'Cowardly dogs! Ye blindsighted us!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665951,'This is not your battle, dwarf. Back down or we will be forced to destroy your ship.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665952,'Not me battle? I dunnae who ye? think ye are, mister, but I got a score to settle with Arthas and yer not gettin in me way! FIRE ALL GUNS! FIRE! FIRE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665953,'Reavers, Sergeants, attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665954,'What''s this then?! Ye won''t be takin this son o Ironforge''s vessel without a fight!.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665955,'Axethrowers, hurl faster!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665956,'Rocketeers, reload!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665957,'We''re taking hull damage, get a battle-mage out here to shut down those cannons!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665958,'Don''t say I didn''t warn ya, scoundrels! Onward, brothers and sisters!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665959,'Captain Bartlett, get us out of here! We''re taken too much damage to stay afloat!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); + +# 4 +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1665960,'For every Horde soldier that you killed, for every Alliance dog that fell, the Lich King''s armies grew. Even now the Val''kyr work to raise your fallen... As Scourge.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665961,'Things are about to get much worse. Come, taste the power that the Lich King has bestowed upon me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665962,'A lone orc, against the might of the Alliance? Charge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665963,'Hahahaha! Dwarves.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665964,'Kor''kron, move out! Champions, watch your backs! The Scourge have been...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665965,'Join me, father. Join me and we will crush this world in the name of the Scourge. For the glory of the Lich King!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665966,'My boy died at the Wrathgate. I am here only to collect his body!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665967,'Stubborn and old. What chance do you have? I am stronger and more powerful than you ever were!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665968,'We named him Dranosh. It means "Heart of Draenor" in Orcish. I would not let the warlocks take him. My boy would be safe, hidden away by the elders of Garadar.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665969,'I made a promise to his mother before she died: that I would cross the Dark Portal alone - whether I lived or died, my son would be safe. Untainted...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665970,'Today, I fulfill that promise.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665971,'High Overlord Saurfang charges!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665972,'Pathetic old orc. Come then heroes, come and face the might of the Scourge!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665973,'BY THE MIGHT OF THE LICH KING!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16694,1,0,0,''), +(0,-1665974,'The ground runs red with your blood!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16699,1,0,0,''), +(0,-1665975,'Feast, my minions!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16700,1,0,0,''), +(0,-1665976,'You are nothing!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16695,1,0,0,''), +(0,-1665977,'Your soul will find no redemption here!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16696,1,0,0,''), +(0,-1665978,'I have become...DEATH!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16698,1,0,0,''), +(0,-1665979,'I... Am... Released.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16697,1,0,0,''), +(0,-1665980,'Muradin Bronzebeard gasps for air.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665981,'That was Saurfang''s boy - the Horde commander at the Wrath Gate. Such a tragic end...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665982,'What in the... There, in the distance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665983,'A Horde Zeppelin flies up to the rise',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665984,'Soldiers, fall in! Looks like the Horde are comin in to take another shot!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665985,'The Zeppelin docks, and High Overlord Saurfang hops out, confronting the Alliance soldiers and Muradin',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665986,'Don''t force my hand, orc. We can''t let you pass.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665987,'Behind you lies the body of my only son. Nothing will keep me from him.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665988,'He... I can''t do it. Get back on your ship and we''ll spare your life.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665989,'Stand down, Muradin. Let a grieving father pass.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665990,'High Overlord Saurfang kneels over his son''s body.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665991,'[Orcish] No''ku kil zil''nok ha tar.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665992,'Higher Overlord Saurfang picks up the body of his son and walks over towards Varian',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665993,'I will not forget this kindess. I thank you, highness.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665994,'I... I was not at the Wrathgate. But the soldiers who survived told me much of what happened. Your son fought with honor. He died a hero''s death. He deserves a hero''s burial.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665995,'Lady Jaina Proudmoore cries.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665996,'Jaina, why are you crying?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665997,'It was nothing, your majesty. Just... I''m proud of my king.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665998,'Muradin, secure the deck and prepare our soldiers for an assault on the Upper Citadel. I''ll send out another regiment from Stormwind.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1665999,'Let''s get the move then. Move out!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666000,'High Overlord Saurfang coughs.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666001,'High Overlord Saurfang weeps over the corpse of his son.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666002,'You will have a proper ceremony in Nagrand next to the pyres of your mother and ancestors.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666003,'Honor, young heroes... no matter how dire the battle... Never forsake it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); + +# 5 +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1666004,'NOOOO! You kill Stinky! You pay!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16907,1,0,0,''), +(0,-1666005,'Fun time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16901,1,0,0,''), +(0,-1666006,'Just an ordinary gas cloud. But watch out, because that''s no ordinary gas cloud!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666007,'Festergut farts.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16911,4,0,0,''), +(0,-1666008,'Gyah! Uhhh, I not feel so good...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16906,1,0,0,''), +(0,-1666009,'Festergut vomits.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666010,'Daddy, I did it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16902,1,0,0,''), +(0,-1666011,'Dead, dead, dead! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16903,1,0,0,''), +(0,-1666012,'Fun time over!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16905,1,0,0,''), +(0,-1666013,'Da...Daddy...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16904,1,0,0,''), +(0,-1666014,'Oh, Festergut. You were always my favorite. Next to Rotface. The good news is you left behind so much gas, I can practically taste it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); + +# 6 +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1666015,'What? Precious? Noooooooooo!!!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16993,1,0,0,''), +(0,-1666016,'WEEEEEE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16986,1,0,0,''), +(0,-1666017,'Icky sticky.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16991,1,0,0,''), +(0,-1666018,'I think I made an angry poo-poo. It gonna blow! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16992,1,0,0,''), +(0,-1666019,'Great news, everyone! The slime is flowing again!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666020,'Good news, everyone! I''ve fixed the poison slime pipes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666021,'Daddy make toys out of you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16988,1,0,0,''), +(0,-1666022,'I brokes-ded it...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16987,1,0,0,''), +(0,-1666023,'Sleepy Time!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16990,1,0,0,''), +(0,-1666024,'Bad news daddy.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16989,1,0,0,''), +(0,-1666025,' Terrible news, everyone, Rotface is dead! But great news everyone, he left behind plenty of ooze for me to use! Whaa...? I''m a poet, and I didn''t know it? Astounding!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); + +# 7 +INSERT INTO `script_texts`(`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1666026,'Good news, everyone! I think I perfected a plague that will destroy all life on Azeroth!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666027,'You can''t come in here all dirty like that! You need that nasty flesh scrubbed off first!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666028,'Two oozes, one room! So many delightful possibilities...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666029,'Hmm. I don''t feel a thing. Whaa...? Where''d those come from?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666030,'Tastes like... Cherry! Oh! Excuse me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666031,'Hmm... Interesting...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666032,'That was unexpected!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666033,'Great news, everyone!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666034,'Bad news, everyone! I don''t think I''m going to make it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); + +# 8 +INSERT INTO `script_texts`(`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1666035,'Foolish mortals. You thought us defeated so easily? The San''layn are the Lich King''s immortal soldiers! Now you shall face their might combined!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666036,'Rise up, brothers, and destroy our enemies.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666037,'Such wondrous power! The Darkfallen Orb has made me INVINCIBLE!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666038,'Blood will flow!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666039,'Were you ever a threat?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666040,'Truth is found in death.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666041,'Prince Keleseth cackles maniacally!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), +(0,-1666042,'My queen... they come...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666043,'Tremble before Taldaram, mortals, for the power of the orb flows through me!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666044,'Delight in the pain!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666045,'Worm food.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666046,'Beg for mercy!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666047,'Prince Taldaram laughs.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), +(0,-1666048,'Prince Taldaram gurgles and dies.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), +(0,-1666049,'Naxxanar was merely a setback! With the power of the orb, Valanar will have his vengeance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666050,'Dinner... is served.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666051,'Do you see NOW the power of the Darkfallen?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666052,'BOW DOWN BEFORE THE SAN''LAYN!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666053,'...why...?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''); + +# 9 +INSERT INTO `script_texts`(`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1666054,'You have made an... unwise... decision.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16782,1,0,0,''), +(0,-1666055,'Just a taste...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16783,1,0,0,''), +(0,-1666056,'Know my hunger!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16784,1,0,0,''), +(0,-1666057,'SUFFER!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16787,1,0,0,''), +(0,-1666058,'Can you handle this?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16787,1,0,0,''), +(0,-1666059,'Yes... feed my precious one! You''re mine now! ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16790,1,0,0,''), +(0,-1666060,'Here it comes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666061,'THIS ENDS NOW!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16793,1,0,0,''), +(0,-1666062,'But... we were getting along... so well...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,16794,1,0,0,''); + +# 10 +INSERT INTO `script_texts`(`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1666063,'Heroes, lend me your aid! I... I cannot hold them off much longer! You must heal my wounds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17064,1,0,0,''), +(0,-1666064,'I have opened a portal into the Emerald Dream. Your salvation lies within, heroes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,''), +(0,-1666065,'My strength is returning! Press on, heroes!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17070,1,0,0,''), +(0,-1666066,'I will not last much longer!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17069,1,0,0,''), +(0,-1666067,'Forgive me for what I do! I... cannot... stop... ONLY NIGHTMARES REMAIN!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17072,1,0,0,''), +(0,-1666068,'A tragic loss...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17066,1,0,0,''), +(0,-1666069,'FAILURES!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17067,1,0,0,''), +(0,-1666070,'I am renewed! Ysera grants me the favor to lay these foul creatures to rest!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17071,1,0,0,''); + +# 11 +INSERT INTO `script_texts`(`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1666071,'You are fools who have come to this place! The icy winds of Northrend will consume your souls!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17007,1,0,0,''), +(0,-1666072,'Suffer, mortals, as your pathetic magic betrays you!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17014,1,0,0,''), +(0,-1666073,'Can you feel the cold hand of death upon your heart?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17013,1,0,0,''), +(0,-1666074,'Aaah! It burns! What sorcery is this?!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17015,1,0,0,''), +(0,-1666075,'Your incursion ends here! None shall survive!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17012,1,0,0,''), +(0,-1666076,'Now feel my master''s limitless power and despair!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17016,1,0,0,''), +(0,-1666077,'Perish!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17008,1,0,0,''), +(0,-1666078,'A flaw of mortality...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17009,1,0,0,''), +(0,-1666079,'Enough! I tire of these games!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17011,1,0,0,''), +(0,-1666080,'Free...at last...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,17010,1,0,0,''); + +# 12 +INSERT INTO script_texts (entry,content_default,content_loc1,content_loc2,content_loc3,content_loc4,content_loc5,content_loc6,content_loc7,content_loc8,sound,type,language,emote,comment)VALUES +(-1810001, 'So...the Light''s vaunted justice has finally arrived. Shall I lay down Frostmourne and throw myself at your mercy, Fordring?',null,null,null,null,null,null,null,null,17349,1,0,0,''), +(-1810002, 'We will grant you a swift death, Arthas. More than can be said for the thousands you''ve tortured and slain.',null,null,null,null,null,null,null,null,17390,1,0,0,''), +(-1810003, 'You will learn of that first hand. When my work is complete, you will beg for mercy -- and I will deny you. Your anguished cries will be testament to my unbridled power.',null,null,null,null,null,null,null,null,17350,1,0,0,''), +(-1810004, 'So be it. Champions, attack!',null,null,null,null,null,null,null,null,17391,1,0,0,''), +(-1810005, 'I''ll keep you alive to witness the end, Fordring. I would not want the Light''s greatest champion to miss seeing this wretched world remade in my image.',null,null,null,null,null,null,null,null,17351,1,0,0,''), +(-1810006, 'Come then champions, feed me your rage!',null,null,null,null,null,null,null,null,17352,1,0,0,''), +(-1810007, 'I will freeze you from within until all that remains is an icy husk!',null,null,null,null,null,null,null,null,17369,1,0,0,''), +(-1810008, 'Apocalypse!',null,null,null,null,null,null,null,null,17371,1,0,0,''), +(-1810009, 'Bow down before your lord and master!',null,null,null,null,null,null,null,null,17372,1,0,0,''), +(-1810010, 'Hope wanes!',null,null,null,null,null,null,null,null,17363,1,0,0,''), +(-1810011, 'The end has come!',null,null,null,null,null,null,null,null,17364,1,0,0,''), +(-1810012, 'Face now your tragic end!',null,null,null,null,null,null,null,null,17365,1,0,0,''), +(-1810013, 'No question remains unanswered. No doubts linger. You are Azeroth''s greatest champions! You overcame every challenge I laid before you. My mightiest servants have fallen before your relentless onslaught, your unbridled fury... Is it truly righteousness that drives you? I wonder.',null,null,null,null,null,null,null,null,17353,1,0,0,''), +(-1810014, 'You trained them well, Fordring. You delivered the greatest fighting force this world has ever known... right into my hands -- exactly as I intended. You shall be rewarded for your unwitting sacrifice.',null,null,null,null,null,null,null,null,17355,1,0,0,''), +(-1810015, 'Watch now as I raise them from the dead to become masters of the Scourge. They will shroud this world in chaos and destruction. Azeroth''s fall will come at their hands -- and you will be the first to die.',null,null,null,null,null,null,null,null,17356,1,0,0,''), +(-1810016, 'I delight in the irony.',null,null,null,null,null,null,null,null,17357,1,0,0,''), +(-1810017, 'LIGHT, GRANT ME ONE FINAL BLESSING. GIVE ME THE STRENGTH... TO SHATTER THESE BONDS!',null,null,null,null,null,null,null,null,17392,1,0,0,''), +(-1810018, 'Impossible...',null,null,null,null,null,null,null,null,17358,1,0,0,''), +(-1810019, '',null,null,null,null,null,null,null,null,17360,1,0,0,''), +(-1810020, 'No more, Arthas! No more lives will be consumed by your hatred!',null,null,null,null,null,null,null,null,17393,1,0,0,''), +(-1810021, 'Free at last! It is over, my son. This is the moment of reckoning.',null,null,null,null,null,null,null,null,17397,1,0,0,''), +(-1810022, 'The Lich King must fall!',null,null,null,null,null,null,null,null,17389,1,0,0,''), +(-1810023, 'Rise up, champions of the Light!',null,null,null,null,null,null,null,null,17398,1,0,0,''), +(-1810024, 'Now I stand, the lion before the lambs... and they do not fear.',null,null,null,null,null,null,null,null,17361,1,0,0,''), +(-1810025, 'They cannot fear.',null,null,null,null,null,null,null,null,17362,1,0,0,''), +(-1810026, 'Argh... Frostmourne, obey me!',null,null,null,null,null,null,null,null,17367,1,0,0,''), +(-1810027, 'Frostmourne hungers...',null,null,null,null,null,null,null,null,17366,1,0,0,''), +(-1810028, 'Frostmourne feeds on the soul of your fallen ally!',null,null,null,null,null,null,null,null,17368,1,0,0,''), +(-1810029, 'Val''kyr, your master calls!',null,null,null,null,null,null,null,null,17373,1,0,0,''), +(-1810030, 'Watch as the world around you collapses!',null,null,null,null,null,null,null,null,17370,1,0,0,''), +(-1810031, 'You gnats actually hurt me! Perhaps I''ve toyed with you long enough, now taste the vengeance of the grave!',null,null,null,null,null,null,null,null,17359,1,0,0,''); + +DELETE FROM `gameobject_scripts` WHERE `id`=201584; +INSERT INTO `gameobject_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`) VALUES +(201584, 0, 15, 70308, 0, 'Transformation'), +(201584, 5000, 15, 70311, 0, 'Transformation End'), +(201584, 5000, 13, 201584, 0, 'Spawn'); + +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (38285, 0, 0, 0, 0, 0, 31008, 0, 31008, 0, 'Mutated Abomination', '', '', 0, 82, 82, 0, 35, 35, 0, 1, 1, 488, 642, 0, 782, 8.5, 2000, 2000, 1, 0, 0, 0, 0, 0, 0, 0, 363, 521, 121, 6, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72508, 72527, 70539, 70542, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 167.345, 1, 0, 0, 0, 0, 0, 0, 0, 170, 1, 0, 609320197, 0, ''); +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (37672, 0, 38285, 0, 0, 0, 31008, 0, 31008, 0, 'Mutated Abomination', '', '', 0, 80, 80, 2, 35, 35, 0, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 0, 0, 0, 0, 0, 0, 0, 345, 509, 103, 6, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72508, 72527, 70539, 70542, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 108.471, 1, 0, 0, 0, 0, 0, 0, 0, 170, 1, 0, 609320197, 0, ''); +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (38159, 0, 0, 0, 0, 0, 1126, 27823, 1126, 0, 'Choking Gas Bomb', '', '', 0, 80, 80, 2, 2068, 2068, 0, 1, 0, 422, 586, 0, 642, 1.4, 2000, 2000, 1, 0, 0, 0, 0, 0, 0, 0, 345, 509, 103, 10, 16778240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'EventAI', 0, 3, 4.71733, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 'npc_choke_bomb'); +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (37006, 0, 0, 0, 0, 0, 1126, 11686, 1126, 0, 'Sticky Ooze', '', '', 0, 1, 1, 0, 16, 16, 0, 1, 0, 2, 2, 0, 24, 1, 2000, 2000, 1, 0, 8, 0, 0, 0, 0, 0, 1, 1, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 201786289, 0, 'npc_sticky_ooze'); +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (37013, 0, 0, 0, 0, 0, 1126, 11686, 1126, 0, 'Puddle Stalker', '', '', 0, 1, 1, 0, 14, 14, 0, 1, 0, 2, 2, 0, 24, 1, 2000, 2000, 1, 33554432, 8, 0, 0, 0, 0, 0, 1, 1, 100, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2067619643, 0, 'npc_flood_ooze'); +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (37985, 0, 0, 0, 0, 0, 30877, 169, 30877, 0, 'Dream Cloud', '', '', 0, 80, 80, 0, 16, 16, 0, 1, 0, 1, 2, 0, 0, 1, 2000, 2000, 1, 0, 8, 0, 0, 0, 0, 0, 1, 1, 1, 10, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 400, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2128592795, 0, 'npc_dreamcloud_icc'); +REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES (38068, 0, 0, 0, 0, 0, 169, 11686, 169, 0, 'Mana Void', '', '', 0, 80, 80, 0, 16, 16, 0, 1, 0, 307, 459, 0, 115, 1, 2000, 2000, 1, 0, 8, 0, 0, 0, 0, 0, 246, 367, 92, 10, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71085, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100677675, 0, 'npc_manavoid_icc'); + +INSERT INTO spell_linked_spell VALUES (-69290, 72103, 0, 'Festergut: Spores end => Inoculated'); \ No newline at end of file diff --git a/sql/wow_ro/Nexus/EyeOfEternity/eye_of_eternity.sql b/sql/wow_ro/Nexus/EyeOfEternity/eye_of_eternity.sql new file mode 100644 index 0000000..e386447 --- /dev/null +++ b/sql/wow_ro/Nexus/EyeOfEternity/eye_of_eternity.sql @@ -0,0 +1,114 @@ +UPDATE instance_template SET script = 'instance_eye_of_eternity' WHERE map = 616; +UPDATE creature_template SET VehicleId=264 WHERE entry = 30248; +UPDATE `gameobject_template` SET `ScriptName` = 'go_malygos_iris' WHERE `entry` IN (193960,193958); + +UPDATE gameobject_template SET flags = 4, data0 = 43 WHERE gameobject_template.entry in (193967, 193905); +UPDATE creature_template SET ScriptName = 'boss_malygos' WHERE entry = 28859; +UPDATE creature_template SET ScriptName = 'mob_nexus_lord' WHERE entry = 30245; +UPDATE creature_template SET ScriptName = 'mob_scion_of_eternity' WHERE entry = 30249; +UPDATE creature_template SET ScriptName = 'mob_power_spark' WHERE entry = 30084; +UPDATE creature_template SET ScriptName = 'npc_arcane_overload' WHERE entry = 30282; + +UPDATE creature_template SET unit_flags = 1 WHERE entry = 28859; + +UPDATE creature_template SET mindmg = 3684, maxdmg = 4329, dmg_multiplier = 7.5, mechanic_immune_mask = 1072918979 WHERE entry = 30245; -- Nexus Lord +UPDATE creature_template SET mindmg = 3684, maxdmg = 4329, dmg_multiplier = 13, mechanic_immune_mask = 1072918979 WHERE entry = 31750; -- Nexus Lord (1) +UPDATE creature_template SET mechanic_immune_mask = 1072918979 WHERE entry IN (30249, 31751); +UPDATE creature_template SET faction_A = 14, faction_H = 14 WHERE entry IN (31750, 31751); + +DELETE FROM creature WHERE id = 33224; +INSERT INTO creature (`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(33224, 571, 1, 1, 0, 0, 3730.57, -4302.91, 182.097, 2.35789, 300, 0, 0, 40, 120, 0, 0), +(33224, 571, 1, 1, 0, 0, 3726.49, -4312.76, 179.671, 1.68559, 300, 0, 0, 40, 120, 0, 0), +(33224, 571, 1, 1, 0, 0, 3714.32, -4311.07, 181.014, 0.81772, 300, 0, 0, 40, 120, 0, 0), +(33224, 571, 1, 1, 0, 0, 3715.14, -4305.41, 182.313, 1.36436, 300, 0, 0, 40, 120, 0, 0), +(33224, 571, 1, 1, 0, 0, 3723.58, -4306.54, 182.245, 1.89215, 300, 0, 0, 40, 120, 0, 0); + +UPDATE `gameobject_template` SET `data10` = 26572 WHERE `entry`=180912; +UPDATE `gameobject_template` SET `data10` = 26566 WHERE `entry`=180911; +-- drake +UPDATE creature_template SET dynamicflags = 8 WHERE entry = 28859; + +DELETE FROM achievement_criteria_data WHERE criteria_id = 1400; +INSERT INTO achievement_criteria_data VALUES +(1400, 1, 28859, 0); -- Realm First Magic Seeker + +UPDATE creature_template SET flags_extra = flags_extra | 2 WHERE entry = 30090; -- Vortex 'Arcane Overload', 'Hover Disk'); +UPDATE creature_template SET flags_extra = flags_extra | 2, faction_A = 35, faction_H = 35, VehicleId = 165 WHERE entry IN (30234, 30248); -- Hover Disk +UPDATE creature_template SET flags_extra = flags_extra | 2, faction_A = 35, faction_H = 35 WHERE entry = 30118; -- Portal (Malygos) +UPDATE creature_template SET flags_extra = flags_extra | 2 WHERE entry = 30282; -- Arcane Overload +UPDATE creature_template SET mindmg = 1, maxdmg = 1, dmg_multiplier = 1 WHERE entry = 30592; -- Static Field +UPDATE creature_template SET modelid1 = 11686, modelid2 = 11686 WHERE entry = 22517; -- Some world trigger +-- Wyrmest Drake Spell & mount +UPDATE creature_template SET spell1 = 56091, spell2 = 56092, spell3 = 57090, spell4 = 57143, spell5 = 57108, spell6 = 57403, VehicleId = 165 WHERE entry IN (30161, 31752); +-- heroic version +DELETE FROM creature_template WHERE entry = 50000; +INSERT INTO creature_template (entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, +modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, +rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, +trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, +skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, +spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, +questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName, WDBVerified) VALUES +(50000, 0, 0, 0, 0, 0, 26752, 0, 0, 0, 'Malygos', '', '', 0, 83, 83, 2, 16, 16, 0, 1, 1.14286, 1, 3, 496, 674, 0, 783, 35, 2000, 0, 2, 64, 8, 0, 0, 0, 0, 0, 365, 529, 98, 2, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 5, 500, 50, 1, 0, 44650, 0, 0, 0, 0, 0, 227, 1, 0, 0, 1, 'boss_malygos', 1); +UPDATE creature_template SET mindmg = 4602, maxdmg = 5502, dmg_multiplier = 13, Health_mod = 1400, questItem1 = 44651, mechanic_immune_mask = 617299803 WHERE entry = 50000; +-- update malygos +UPDATE creature_template SET mindmg = 4602, maxdmg = 5502, dmg_multiplier = 7.5, difficulty_entry_1 = 50000, mechanic_immune_mask = 617299803 WHERE entry = 28859; +UPDATE creature_template SET flags_extra = flags_extra | 1 WHERE entry IN (28859, 50000); +-- add de malygos & gameobject +UPDATE gameobject_template SET flags = 4, data0 = 43 WHERE entry in (193967, 193905); +UPDATE creature_template SET ScriptName = 'boss_malygos', unit_flags = unit_flags & ~256 WHERE entry = 28859; +UPDATE creature SET MovementType = 0, spawndist = 0 WHERE id = 28859; -- Malygos, don't move +UPDATE creature_template SET ScriptName = 'mob_nexus_lord' WHERE entry = 30245; -- Nexus Lord +UPDATE creature_template SET ScriptName = 'mob_scion_of_eternity' WHERE entry = 30249; -- Scion of Eternity +UPDATE creature_template SET faction_A = 14, faction_H = 14, ScriptName = 'mob_power_spark' WHERE entry = 30084; -- Power Spark +UPDATE creature_template SET faction_A = 14, faction_H = 14 WHERE entry = 32187; -- Power Spark (1) +UPDATE creature_template SET ScriptName = 'npc_arcane_overload' WHERE entry = 30282; -- Arcane Overload + +-- Aggro Malygos +UPDATE creature_model_info SET combat_reach = '30' WHERE modelid = 26752; + +UPDATE `gameobject_template` SET `ScriptName` = 'go_malygos_iris' WHERE `entry` IN (193960,193958); + +-- drakes_disks +UPDATE creature_template SET InhabitType = 4, VehicleId = 223 WHERE entry IN (30234, 30248); +UPDATE creature_template SET spell6 = 57092, spell7 = 57403 WHERE entry IN (30161, 31752); + + + +-- script_texts +DELETE FROM script_texts WHERE entry BETWEEN -1616034 AND -1616000; +INSERT INTO script_texts (npc_entry, entry, content_default, sound, type, language, emote, comment) VALUES +(28859, -1616000, 'Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!', 14512, 1, 0, 0, 'Malygos INTRO 1'), +(28859, -1616001, 'None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths.', 14513, 1, 0, 0, 'Malygos INTRO 2'), +(28859, -1616002, 'What could you hope to accomplish, to storm brazenly into my domain? To employ MAGIC? Against ME?', 14514, 1, 0, 0, 'Malygos INTRO 3'), +(28859, -1616003, 'I am without limits here... the rules of your cherished reality do not apply... In this realm, I am in control...', 14515, 1, 0, 0, 'Malygos INTRO 4'), +(28859, -1616004, 'I give you one chance. Pledge fealty to me, and perhaps I won\'t slaughter you for your insolence!', 14516, 1, 0, 0, 'Malygos INTRO 5'), +(28859, -1616005, 'My patience has reached its limit, I WILL BE RID OF YOU!', 14517, 1, 0, 0, 'Malygos AGGRO 1'), +(28859, -1616006, 'Watch helplessly as your hopes are swept away...', 14525, 1, 0, 0, 'Malygos VORTEX'), +(28859, -1616007, 'I AM UNSTOPPABLE!', 14533, 1, 0, 0, 'Malygos SPARK BUFF'), +(28859, -1616008, 'Your stupidity has finally caught up to you!', 14519, 1, 0, 0, 'Malygos SLAY 1-1'), +(28859, -1616009, 'More artifacts to confiscate...', 14520, 1, 0, 0, 'Malygos SLAY 1-2'), +(28859, -1616010, 'How very... naive...', 14521, 1, 0, 0, 'Malygos SLAY 1-3'), +(28859, -1616012, 'I had hoped to end your lives quickly, but you have proven more...resilient then I had anticipated. Nonetheless, your efforts are in vain, it is you reckless, careless mortals who are to blame for this war! I do what I must...And if it means your...extinction...THEN SO BE IT!', 14522, 1, 0, 0, 'Malygos PHASEEND 1'), +(28859, -1616013, 'Few have experienced the pain I will now inflict upon you!', 14523, 1, 0, 0, 'Malygos AGGRO 2'), +(28859, -1616014, 'YOU WILL NOT SUCCEED WHILE I DRAW BREATH!', 14518, 1, 0, 0, 'Malygos DEEP BREATH'), +(28859, -1616016, 'I will teach you IGNORANT children just how little you know of magic...', 14524, 1, 0, 0, 'Malygos ARCANE OVERLOAD'), +(28859, -1616020, 'Your energy will be put to good use!', 14526, 1, 0, 0, 'Malygos SLAY 2-1'), +(28859, -1616021, 'I AM THE SPELL-WEAVER! My power is INFINITE!', 14527, 1, 0, 0, 'Malygos SLAY 2-2'), +(28859, -1616022, 'Your spirit will linger here forever!', 14528, 1, 0, 0, 'Malygos SLAY 2-3'), +(28859, -1616017, 'ENOUGH! If you intend to reclaim Azeroth\'s magic, then you shall have it...', 14529, 1, 0, 0, 'Malygos PHASEEND 2'), +(28859, -1616018, 'Now your benefactors make their appearance...But they are too late. The powers contained here are sufficient to destroy the world ten times over! What do you think they will do to you?', 14530, 1, 0, 0, 'Malygos PHASE 3 INTRO'), +(28859, -1616019, 'SUBMIT!', 14531, 1, 0, 0, 'Malygos AGGRO 3'), +(28859, -1616026, 'The powers at work here exceed anything you could possibly imagine!', 14532, 1, 0, 0, 'Malygos STATIC FIELD'), +(28859, -1616023, 'Alexstrasza! Another of your brood falls!', 14534, 1, 0, 0, 'Malygos SLAY 3-1'), +(28859, -1616024, 'Little more then gnats!', 14535, 1, 0, 0, 'Malygos SLAY 3-2'), +(28859, -1616025, 'Your red allies will share your fate...', 14536, 1, 0, 0, 'Malygos SLAY 3-3'), +(28859, -1616027, 'Still standing? Not for long...', 14537, 1, 0, 0, 'Malygos SPELL 1'), +(28859, -1616028, 'Your cause is lost!', 14538, 1, 0, 0, 'Malygos SPELL 1'), +(28859, -1616029, 'Your fragile mind will be shattered!', 14539, 1, 0, 0, 'Malygos SPELL 1'), +(28859, -1616030, 'UNTHINKABLE! The mortals will destroy... e-everything... my sister... what have you-', 14540, 1, 0, 0, 'Malygos DEATH'), +(32295, -1616031, 'I did what I had to, brother. You gave me no alternative.', 14406, 1, 0, 0, 'Alexstrasza OUTRO 1'), +(32295, -1616032, 'And so ends the Nexus War.', 14407, 1, 0, 0, 'Alexstrasza OUTRO 2'), +(32295, -1616033, 'This resolution pains me deeply, but the destruction, the monumental loss of life had to end. Regardless of Malygos\' recent transgressions, I will mourn his loss. He was once a guardian, a protector. This day, one of the world\'s mightiest has fallen.', 14408, 1, 0, 0, 'Alexstrasza OUTRO 3'), +(32295, -1616034, 'The red dragonflight will take on the burden of mending the devastation wrought on Azeroth. Return home to your people and rest. Tomorrow will bring you new challenges, and you must be ready to face them. Life...goes on.', 14409, 1, 0, 0, 'Alexstrasza OUTRO 4'); \ No newline at end of file diff --git a/sql/wow_ro/Nexus/TheOculus/oculus.sql b/sql/wow_ro/Nexus/TheOculus/oculus.sql new file mode 100644 index 0000000..10d2e98 --- /dev/null +++ b/sql/wow_ro/Nexus/TheOculus/oculus.sql @@ -0,0 +1,153 @@ +UPDATE `instance_template` SET `script`='instance_oculus' WHERE `map`=578; +UPDATE `creature_template` SET `ScriptName`='npc_unstable_sphere' WHERE `entry`=28166; +UPDATE `creature_template` SET `ScriptName`='npc_oculus_drake' WHERE `entry` IN (27657,27658,27659); + +-- Ruby drake +UPDATE creature_template SET mindmg = 422, maxdmg = 586, attackpower = 642, dynamicflags = 8, minrangedmg = 345, maxrangedmg = 509, rangedattackpower = 103, spell1 = 50232, spell2 = 50248, spell3 = 50240, spell4 = 50253, spell5 = 53112, VehicleId = 70 WHERE entry = 27756; +-- Amber Drake +UPDATE creature_template SET mindmg = 422, maxdmg = 586, attackpower = 642, dynamicflags = 8, minrangedmg = 345, maxrangedmg = 509, rangedattackpower = 103, spell1 = 49840, spell2 = 49838, spell3 = 49592, spell4 = 0, spell5 = 53112, VehicleId = 70 WHERE entry = 27755; +-- Emerald Drake +UPDATE creature_template SET mindmg = 422, maxdmg = 586, attackpower = 642, dynamicflags = 8, minrangedmg = 345, maxrangedmg = 509, rangedattackpower = 103, spell1 = 50328, spell2 = 50341, spell3 = 50344, spell4 = 0, spell5 = 53112, VehicleId = 70 WHERE entry = 27692; + +UPDATE creature_template SET npcflag=1 WHERE entry IN (27657,27658,27659); + +UPDATE creature_template SET ScriptName='boss_drakos' WHERE entry = 27654; + +UPDATE creature_template SET ScriptName='boss_urom' WHERE entry = 27655; + +UPDATE creature_template SET ScriptName='mob_centrifige_construct' WHERE entry = 27641; + +UPDATE creature_template SET ScriptName='boss_varos' WHERE entry = 27447; + +UPDATE creature_template SET ScriptName='boss_eregos' WHERE entry = 27656; + +-- Planar anomaly +UPDATE creature_template SET InhabitType = 5, modelid1 = 28107, modelid3 = 28107 WHERE entry=30879; + +-- Unstable Sphere + +UPDATE creature_template SET minlevel = 80, maxlevel = 80, mindmg = 422, maxdmg = 586, faction_A = 16, faction_H = 16, attackpower = 642, dmg_multiplier = 1, minrangedmg = 345, maxrangedmg = 509, rangedattackpower = 103 WHERE entry = 28166; +-- Drakos the Interrogator + +DELETE FROM `script_texts` WHERE npc_entry='27654'; + +INSERT INTO `script_texts` VALUES ('27654', -1578000, 'The prisoners shall not go free. The word of Malygos is law!','', '', '', '', '', '', '', '', 13594,1,0,0, 'drakos SAY_AGGRO'); + +INSERT INTO `script_texts` VALUES ('27654', -1578001, 'A fitting punishment!','', '', '', '', '', '', '', '', 13602, 1,0,0, 'drakos SAY_KILL_1'); + +INSERT INTO `script_texts` VALUES ('27654', -1578002, 'Sentence: executed!','', '', '', '', '', '', '', '', 13603,1,0,0, 'drakos SAY_KILL_2'); + +INSERT INTO `script_texts` VALUES ('27654', -1578003, 'Another casualty of war!','', '', '', '', '', '', '', '', 13604, 1,0,0, 'drakos SAY_KILL_3'); + +INSERT INTO `script_texts` VALUES ('27654', -1578004, 'The war... goes on.','', '', '', '', '', '', '', '', 13605,1,0,0, 'drakos SPELL_DEATH'); + +INSERT INTO `script_texts` VALUES ('27654', -1578005, 'It is too late to run!','', '', '', '', '', '', '', '', 13598, 1,0,0, 'drakos SAY_PULL_1'); + +INSERT INTO `script_texts` VALUES ('27654', -1578006, 'Gather \'round! ','', '', '', '', '', '', '', '', 13599, 1,0,0, 'drakos SAY_PULL_2'); + +INSERT INTO `script_texts` VALUES ('27654', -1578007, 'None shall escape!','', '', '', '', '', '', '', '', 13600, 1,0,0, 'drakos SAY_PULL_3'); + +INSERT INTO `script_texts` VALUES ('27654', -1578008, 'I condemn you to death!','', '', '', '', '', '', '', '', 13601,1,0,0, 'drakos SAY_PULL_4'); + +INSERT INTO `script_texts` VALUES ('27654', -1578009, 'Tremble, worms!','', '', '', '', '', '', '', '', 13595,1,0,0, 'drakos SAY_STOMP_1'); + +INSERT INTO `script_texts` VALUES ('27654', -1578010, 'I will crush you!', '', '', '', '', '', '', '', '', 13596, 1,0,0, 'drakos SAY_STOMP_2'); + +INSERT INTO `script_texts` VALUES ('27654', -1578011, 'Can you fly?', '', '', '', '', '', '', '', '', 13597, 1,0,0, 'drakos SAY_STOMP_3'); +-- Mage-Lord Urom + +DELETE FROM `script_texts` WHERE npc_entry= '27655'; + +INSERT INTO `script_texts` VALUES ('27655', -1578012, 'Poor blind fools!','', '', '', '', '', '', '', '', 13638,1,0,0, 'urom SAY_AGGRO'); + +INSERT INTO `script_texts` VALUES ('27655', -1578013, 'If only you understood!','', '', '', '', '', '', '', '', 13641,1,0,0, 'urom SAY_KILL_1'); + +INSERT INTO `script_texts` VALUES ('27655', -1578014, 'Now, do you see? DO YOU?!','', '', '', '', '', '', '', '', 13642,1,0,0, 'urom SAY_KILL_2'); + +INSERT INTO `script_texts` VALUES ('27655', -1578015, 'Unfortunate, but necessary.','', '', '', '', '', '', '', '', 13643,1,0,0, 'urom SAY_KILL_3'); + +INSERT INTO `script_texts` VALUES ('27655', -1578016, 'Everything I\'ve done... has been for Azeroth...','', '', '', '', '', '', '', '', 13644,1,0,0, 'urom SAY_DEATH'); + +INSERT INTO `script_texts` VALUES ('27655', -1578017, 'A taste... just a small taste... of the Spell-Weaver\'s power!','', '', '', '', '', '', '', '', 13639,1,0,0, 'urom SAY_EXPLOSION_1'); + +INSERT INTO `script_texts` VALUES ('27655', -1578018, 'So much unstable energy... but worth the risk to destroy you!','', '', '', '', '', '', '', '', 13640,1,0,0, 'urom SAY_EXPLOSION_2'); + +INSERT INTO `script_texts` VALUES ('27655', -1578019, 'What do we have here... those would defy the Spell-Weaver? Those without foresight or understanding. How could I make you see? Malygos is saving the world from itself! Bah! You are hardly worth my time!','', '', '', '', '', '', '', '', 13635,1,0,0, 'urom SAY_SUMMON_1'); + +INSERT INTO `script_texts` VALUES ('27655', -1578020, 'Clearly my pets failed. Perhaps another demonstration is in order.','', '', '', '', '', '', '', '', 13636,1,0,0, 'urom SAY_SUMMON_2'); + +INSERT INTO `script_texts` VALUES ('27655', -1578021, 'Still you fight. Still you cling to misguided principles. If you survive, you\'ll find me in the center ring.','', '', '', '', '', '', '', '', 13637,1,0,0, 'urom SAY_SUMMON_3'); + +-- Varos Cloudstrider + +DELETE FROM `script_texts` WHERE npc_entry = '27447'; + +INSERT INTO `script_texts` VALUES ('27447', -1578022, 'There will be no mercy!','', '', '', '', '', '', '', '', 13649,1,0,0, 'varos SAY_AGGRO'); + +INSERT INTO `script_texts` VALUES ('27447', -1578023, 'You were warned.','', '', '', '', '', '', '', '', 13653,1,0,0, 'varos SAY_KILL_1'); + +INSERT INTO `script_texts` VALUES ('27447', -1578024, 'The Oculus is ours.','', '', '', '', '', '', '', '', 13654,1,0,0, 'varos SAY_KILL_2'); + +INSERT INTO `script_texts` VALUES ('27447', -1578025, 'They are... too strong! Underestimated their... fortitude.','', '', '', '', '', '', '', '', 13655,1,0,0, 'varos SAY_DEATH'); + +INSERT INTO `script_texts` VALUES ('27447', -1578026, 'Blast them! Destroy them!','', '', '', '', '', '', '', '', 13650,1,0,0, 'varos SAY_STRIKE_1'); + +INSERT INTO `script_texts` VALUES ('27447', -1578027, 'Take no prisoners! Attack!','', '', '', '', '', '', '', '', 13651,1,0,0, 'varos SAY_STRIKE_2'); + +INSERT INTO `script_texts` VALUES ('27447', -1578028, 'Strike now! Obliterate them!','', '', '', '', '', '', '', '', 13652,1,0,0, 'varos SAY_STRIKE_3'); + +-- Varos says when Drakos dies + +INSERT INTO `script_texts` VALUES ('27447', -1578029, 'Intruders, your victory will be short-lived. I am Commander Varos Cloudstrider. My drakes control the skies and protest this conduit. I will see to it personally that the Oculus does not fall into your hands!','', '', '', '', '', '', '', '', 13648,1,0,0, 'varos SAY_SPAWN'); + + +UPDATE gameobject_template SET flags=4 where entry IN (189986,193995); + +-- 8276 +-- Fix Arcane Beam npc +UPDATE creature SET phaseMask = 0 WHERE id = 28239; +-- Fix Centrifuge Core npc +UPDATE creature SET phaseMask = 0 WHERE id = 28183; +-- Fix fazione Arcane beam +UPDATE creature_template SET faction_A = 35, faction_H = 35 WHERE entry = 28239; +-- Planar Anomaly +UPDATE creature_template SET InhabitType = 5, modelid1 = 28107, modelid3 = 28107 WHERE entry = 30879; + + +-- Gob +UPDATE gameobject_template set data17 = 0 where entry = 193908; -- Exit portal + +-- 8380 +-- Reputazione a Oculus +DELETE FROM `creature_onkill_reputation` WHERE creature_id IN (27654, 27656, 27655, 27447, 27633, 27636, 28236, 27638, 27635, 27641, 28276, 27650, 27645, 27651, 27642, 27649, 27648, 27647, 27653, 27644, 30879, 27640, 27639, 28153); +INSERT INTO `creature_onkill_reputation` (`creature_id`, `RewOnKillRepFaction1`, `RewOnKillRepFaction2`, `MaxStanding1`, `IsTeamAward1`, `RewOnKillRepValue1`, `MaxStanding2`, `IsTeamAward2`, `RewOnKillRepValue2`, `TeamDependent`) VALUES +(27654, 1037, 1052, 7, 0, 250, 7, 0, 250, 1), -- Drakos the interrogator +(27656, 1037, 1052, 7, 0, 250, 7, 0, 250, 1), -- Ley Guardian Eregos +(27655, 1037, 1052, 7, 0, 250, 7, 0, 250, 1), -- Mage lord urom +(27447, 1037, 1052, 7, 0, 250, 7, 0, 250, 1), -- Varos cloudstrider +-- Trash +(27633, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27636, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(28236, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27638, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27635, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27641, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(28276, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27650, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27645, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27651, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27642, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(27649, 1037, 1052, 7, 0, 25, 7, 0, 25, 1), +(27648, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(27647, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(27653, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(27644, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(30879, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(27640, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(27639, 1037, 1052, 7, 0, 5, 7, 0, 5, 1), +(28153, 1037, 1052, 7, 0, 5, 7, 0, 5, 1); +-- Planar Anomlay di Eregos +UPDATE creature_template SET ScriptName = 'npc_planar_anomaly' WHERE entry = 30879; +-- Arcane beam +DELETE FROM creature WHERE id = 28239; +UPDATE creature_template SET modelid3 = 0 WHERE entry = 30879; \ No newline at end of file diff --git a/sql/wow_ro/ObsidianSanctum/obsidian_sanctum.sql b/sql/wow_ro/ObsidianSanctum/obsidian_sanctum.sql new file mode 100644 index 0000000..8ef35f5 --- /dev/null +++ b/sql/wow_ro/ObsidianSanctum/obsidian_sanctum.sql @@ -0,0 +1,58 @@ +-- +-- Obsidian Sanctum +-- +UPDATE `instance_template` SET `script`='instance_obsidian_sanctum' WHERE `map`=615; +UPDATE `creature_template` SET `ScriptName`='boss_sartharion' WHERE `entry`=28860; +UPDATE `creature_template` SET `ScriptName`='mob_vesperon' WHERE `entry`=30449; +UPDATE `creature_template` SET `ScriptName`='mob_shadron' WHERE `entry`=30451; +UPDATE `creature_template` SET `ScriptName`='mob_tenebron' WHERE `entry`=30452; +UPDATE `creature_template` SET `ScriptName`='mob_acolyte_of_shadron' WHERE `entry`=31218; +UPDATE `creature_template` SET `ScriptName`='mob_acolyte_of_vesperon' WHERE `entry`=31219; +-- flametsunami +UPDATE creature_template SET minlevel=83, maxlevel=83, faction_A=14, faction_H=14, unit_flags=0x02000000, flags_extra=0x00000002, ScriptName="npc_flame_tsunami" WHERE entry=30616; + +UPDATE creature_template SET ScriptName="npc_twilight_fissure" WHERE entry=30641; +UPDATE creature_template SET ScriptName="npc_flame_tsunami" WHERE entry=30616; + +-- safezone flag +UPDATE creature_template SET flags_extra = 0x00000002 WHERE entry=30494; + +-- sartharion door +UPDATE `gameobject_template` SET `flags` = 4 WHERE `entry` = 181247; + + +-- Add Twilight Portals +DELETE FROM gameobject WHERE id=193988; +INSERT INTO gameobject (id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES +(193988, 615, 3, 1, 3137.26, 501.08, 87.9118, 0.846795, 0, 0, 0.41086, 0.911698, -30, 0, 1), +(193988, 615, 3, 1, 3238.37, 518.595, 58.9057, 0.739184, 0, 0, 0.361235, 0.932475, -30, 0, 1), +(193988, 615, 3, 1, 3362.01, 553.726, 95.7068, 4.56818, 0, 0, 0.756211, -0.654328, -30, 0, 1), +(193988, 615, 3, 1, 3219.67, 656.795, 87.2898, 5.92596, 0, 0, 0.177664, -0.984091, 25, 0, 1); + +-- Set creature data to creatures used in Sartharion encounter +UPDATE creature_template SET flags_extra = flags_extra | 2 WHERE entry = 31103; -- Twilight Egg (Cosmetic) +UPDATE creature_template SET unit_flags = unit_flags | 4, faction_A = 103, faction_H = 103, flags_extra = 2 WHERE entry = 30648; -- Fire Cyclone +UPDATE creature SET spawndist = 0 WHERE id = 30648; -- Fire Cyclone +UPDATE creature_template SET ScriptName = 'npc_twilight_fissure' WHERE entry = 30641; +UPDATE creature_template SET ScriptName = 'npc_flame_tsunami' WHERE entry = 30616; +UPDATE creature_template SET ScriptName = 'mob_twilight_eggs' WHERE entry IN (30882, 31204); +UPDATE creature_template SET ScriptName = 'mob_twilight_whelp' WHERE entry IN (30890, 31540, 31214, 31548); +UPDATE creature_template SET faction_A = 103, faction_H = 103, minlevel = 81, maxlevel = 81, mindmg = 1857, maxdmg = 2703 WHERE entry IN (30890, 31214); +UPDATE creature_template SET faction_A = 103, faction_H = 103, minlevel = 81, maxlevel = 81, mindmg = 3032, maxdmg = 5194 WHERE entry IN (31540, 31548); +UPDATE creature_template SET faction_A = 103, faction_H = 103, minlevel = 81, maxlevel = 81 WHERE entry IN (30882, 31539); -- Twilight Egg +UPDATE creature_template SET faction_A = 103, faction_H = 103, minlevel = 81, maxlevel = 81 WHERE entry IN (31204, 31547); -- Sartharion Twilight Egg +UPDATE creature_template SET faction_A = 103, faction_H = 103, minlevel = 81, maxlevel = 81, flags_extra = 2, scale = 0.75 WHERE entry IN (30641, 31521); -- Twilight Fissure +UPDATE creature_template SET faction_A = 14, faction_H = 14, minlevel = 81, maxlevel = 81, mindmg = 693, maxdmg = 963, attackpower = 1567, dmg_multiplier = 1 WHERE entry = 30643; -- Lava Blaze +UPDATE creature_template SET faction_A = 14, faction_H = 14, minlevel = 81, maxlevel = 81, mindmg = 894, maxdmg = 1203, attackpower = 3134, dmg_multiplier = 1 WHERE entry = 31317; -- Lava Blaze (1) +UPDATE creature_template SET faction_A = 14, faction_H = 14, minlevel = 81, maxlevel = 81, flags_extra = 2 WHERE entry = 30616; -- Flame Tsunami +UPDATE creature_template SET faction_A = 103, faction_H = 103, mindmg = 409, maxdmg = 502, attackpower = 780, dmg_multiplier = 35, mechanic_immune_mask = 617299803, minlevel = 81, maxlevel = 81 WHERE entry IN (31218, 31219); -- Acolytes of Vesperon/Shandron +-- twilight fissure +UPDATE creature_template SET flags_extra = 0 WHERE entry IN (30641, 31521); +UPDATE creature_template SET modelid1 = 29038 WHERE entry IN (30641, 31521); + +-- mob obsidian +UPDATE creature_template SET unit_flags = 33554434 WHERE entry IN (30641, 31521, 31103); + +-- disciple of vesperon +UPDATE creature_template SET faction_H = 16, faction_A = 16, ScriptName = 'npc_disciple_of_vesperon' WHERE entry = 30858; +UPDATE gameobject SET spawntimesecs = -60 WHERE id = 193988; \ No newline at end of file diff --git a/sql/wow_ro/RubySanctum/ruby_sanctum.sql b/sql/wow_ro/RubySanctum/ruby_sanctum.sql new file mode 100644 index 0000000..a20bab0 --- /dev/null +++ b/sql/wow_ro/RubySanctum/ruby_sanctum.sql @@ -0,0 +1,110 @@ +-- Game Objects +SET @GUID = 750000; +INSERT INTO `gameobject` VALUES +(@GUID+1, 202347, 724, 15, 1, 3286.8, 533.392, 98.5718, 0, 0, 0, 0, 0, 100, 100, 1), +(@GUID+2, 202348, 724, 15, 1, 3286.8, 533.392, 98.5718, 0, 0, 0, 0, 0, 100, 100, 1), +(@GUID+3, 202349, 724, 15, 1, 3286.8, 533.392, 98.5718, 0, 0, 0, 0, 0, 100, 100, 1), +(@GUID+4, 202350, 724, 15, 1, 3286.8, 533.392, 98.5718, 0, 0, 0, 0, 0, 100, 100, 1), +(@GUID+5, 202347, 571, 15, 1, 3608.19, 186.17, -100.0, 2.1, 0, 0, 0, 0, 100, 100, 1), +(@GUID+6, 202348, 571, 15, 1, 3608.19, 186.17, -100.0, 2.1, 0, 0, 0, 0, 100, 100, 1), +(@GUID+7, 202349, 571, 15, 1, 3608.19, 186.17, -100.0, 2.1, 0, 0, 0, 0, 100, 100, 1), +(@GUID+8, 202350, 571, 15, 1, 3608.19, 186.17, -100.0, 2.1, 0, 0, 0, 0, 100, 100, 1); + +DELETE FROM `gameobject_template` WHERE `entry` IN (202794, 203003,203004,203005,203006,203007,203034,203035,203036,203037,203079,203624,203080,203959,203960,203961,203962,204051,204052,204053,204054); +INSERT INTO `gameobject_template` + (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`) +VALUES + (202794, 10, 1327, 'Twilight Portal', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75074, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0), + (203003, 10, 7398, 'Red Dragon Egg', '', '', '', 0, 0, 0, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.5, 0, 0, 0, 0, 0, 0), + (203004, 10, 9483, 'Broken Red Dragon Egg', '', '', '',0, 0, 0, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.5, 0, 0, 0, 0, 0, 0), + (203005, 0, 9484, 'Fire Field', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), + (203006, 0, 9485, 'Flame Walls', '', '', '', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), + (203007, 0, 9482, 'Ruby Sanctum Halion Flame Ring', '', '', '', 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.6, 0, 0, 0, 0, 0, 0), + (203034, 1, 9490, 'Burning Tree', '', '', '', 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.2, 0, 0, 0, 0, 0, 0), + (203035, 1, 9490, 'Burning Tree', '', '', '', 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.2, 0, 0, 0, 0, 0, 0), + (203036, 1, 9490, 'Burning Tree', '', '', '', 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.2, 0, 0, 0, 0, 0, 0), + (203037, 1, 9490, 'Burning Tree', '', '', '', 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.2, 0, 0, 0, 0, 0, 0), + (203079, 10, 7398, 'Red Dragon Egg (Large)', '', '', '', 0, 0, 0, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.75, 0, 0, 0, 0, 0, 0), + (203080, 10, 9483, 'Broken Red Dragon Egg (Large)', '', '', '', 0, 0, 0, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.75, 0, 0, 0, 0, 0, 0), + (203624, 0, 9624, 'Halion Twilight Ring', '', '', '', 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.6, 0, 0, 0, 0, 0, 0), + (203959, 31, 9041, 'Doodad_InstancePortal_Green_10Man01', '', '', '', 724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.73945, 0, 0, 0, 0, 0, 0), + (203960, 31, 9040, 'Doodad_InstancePortal_Green_10Man_Heroic01', '', '', '', 724, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.73945, 0, 0, 0, 0, 0, 0), + (203961, 31, 9042, 'Doodad_InstancePortal_Green_25Man01', '', '', '', 724, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.73945, 0, 0, 0, 0, 0, 0), + (203962, 31, 9043, 'Doodad_InstancePortal_Green_25Man_Heroic01', '', '', '', 724, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.73945, 0, 0, 0, 0, 0, 0), + (204051, 31, 9041, 'Doodad_InstancePortal_Green_10Man01', '', '', '', 724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.59985, 0, 0, 0, 0, 0, 0), + (204052, 31, 9040, 'Doodad_InstancePortal_Green_10Man_Heroic01', '', '', '', 724, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.59985, 0, 0, 0, 0, 0, 0), + (204053, 31, 9042, 'Doodad_InstancePortal_Green_25Man01', '', '', '', 724, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.59985, 0, 0, 0, 0, 0, 0), + (204054, 31, 9043, 'Doodad_InstancePortal_Green_25Man_Heroic01', '', '','', 724, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.59985, 0, 0, 0, 0, 0, 0); + +-- Instance Entry +DELETE FROM `instance_template` WHERE `map` = 724; +INSERT INTO `instance_template` VALUES (724, 0, 5690, 3273, 534, 89, NULL, 'instance_ruby_sanctum', 1); +INSERT INTO `access_requirement` VALUES +(5690, 80, 80, 0, 0, 0, 0, 0, 0, '', 0, '', 'Ruby Sactum', 15); +DELETE FROM areatrigger_teleport WHERE id IN (5869,5872); +INSERT INTO areatrigger_teleport VALUES +(5869, 'Kammer der Aspekte, Rubin Sanktum(Eingang)', 5690, 724, 3267.97, 533.6, 87.65, 3.047), +(5872, 'Kammer der Aspekte, Rubin Sanktum(Ausgang)', 0, 571, 3597.65, 201.19, -115.05, 0); + +-- Quests +DELETE FROM `quest_template` WHERE `entry` IN (26012,26013,26034); +INSERT INTO quest_template + (`entry`, `Method`, `QuestLevel`, `MinLevel`, `ZoneOrSort`, `Type`, `SuggestedPlayers`, `RepObjectiveFaction`, `RepObjectiveValue`, `RepObjectiveFaction2`, `RepObjectiveValue2`, `NextQuestInChain`, `RewXPId`, `RewOrReqMoney`, `RewMoneyMaxLevel`, `RewSpell`, `RewSpellCast`, `RewHonorAddition`, `RewHonorMultiplier`, `SrcItemId`, `QuestFlags`, `CharTitleId`, `PlayersSlain`, `BonusTalents`, `RewardArenaPoints`, `unk0`, `RewItemId1`, `RewItemCount1`, `RewItemId2`, `RewItemCount2`, `RewItemId3`, `RewItemCount3`, `RewItemId4`, `RewItemCount4`, `RewChoiceItemId1`, `RewChoiceItemCount1`, `RewChoiceItemId2`, `RewChoiceItemCount2`, `RewChoiceItemId3`, `RewChoiceItemCount3`, `RewChoiceItemId4`, `RewChoiceItemCount4`, `RewChoiceItemId5`, `RewChoiceItemCount5`, `RewChoiceItemId6`, `RewChoiceItemCount6`, `RewRepFaction1`, `RewRepFaction2`, `RewRepFaction3`, `RewRepFaction4`, `RewRepFaction5`, `RewRepValueId1`, `RewRepValueId2`, `RewRepValueId3`, `RewRepValueId4`, `RewRepValueId5`, `RewRepValue1`, `RewRepValue2`, `RewRepValue3`, `RewRepValue4`, `RewRepValue5`, `PointMapId`, `PointX`, `PointY`, `PointOpt`, `Title`, `Objectives`, `Details`, `EndText`, `CompletedText`, `ReqCreatureOrGOId1`, `ReqCreatureOrGOCount1`, `ReqSourceId1`, `ReqSourceCount1`, `ReqCreatureOrGOId2`, `ReqCreatureOrGOCount2`, `ReqSourceId2`, `ReqSourceCount2`, `ReqCreatureOrGOId3`, `ReqCreatureOrGOCount3`, `ReqSourceId3`, `ReqSourceCount3`, `ReqCreatureOrGOId4`, `ReqCreatureOrGOCount4`, `ReqSourceId4`, `ReqSourceCount4`, `ReqItemId1`, `ReqItemCount1`, `ReqItemId2`, `ReqItemCount2`, `ReqItemId3`, `ReqItemCount3`, `ReqItemId4`, `ReqItemCount4`, `ReqItemId5`, `ReqItemCount5`, `ReqItemId6`, `ReqItemCount6`, `ObjectiveText1`, `ObjectiveText2`, `ObjectiveText3`, `ObjectiveText4`) +VALUES + (26012, 2, 82, 80, 4987, 62, 0, 0, 0, 0, 0, 26013, 1, 8000, 13500, 0, 0, 0, 0, 0, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Trouble at Wyrmrest', 'Speak with Krasus at Wyrmrest Temple in Dragonblight.', 'My old friend Krasus sends word of dire happenings at Wyrmrest, in Dragonblight. His missive was brief, but it seems that there has been some sort of attack on the Ruby Sanctum beneath the Temple.$B$BPressing business here in Dalaran keeps me from attending to the matter personally, but I have heard word of your exploits in the Lich King\'s Citadel and you are doubtless up to the task -- perhaps you could assist Krasus in my stead?', '', 'Speak with Krasus at Wyrmrest Temple in Dragonblight.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', ''), + + (26013, 2, 82, 80, 4987, 62, 0, 0, 0, 0, 0, 26034, 5, 80000, 135000, 0, 0, 0, 0, 0, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Assault on the Sanctum', 'Investigate the Ruby Sanctum beneath Wyrmrest Temple.', '$R, something terrible has transpired within the Ruby Sanctum beneath the Temple.$B$BThe entry to the Sanctum is in ruins, and its guardians violently slain. We sent scouts to investigate, but they have not returned. I cannot help but fear the worst.$B$BEnter the Ruby Sanctum and discover what has befallen the home of my flight. Once we have more information, we can plan our next steps accordingly.', '', 'Investigate the Ruby Sanctum beneath Wyrmrest Temple.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', ''), + (26034, 2, 82, 80, 4987, 62, 0, 0, 0, 0, 0, 0, 7, 240000, 202500, 0, 0, 0, 0, 0, 200, 0, 0, 0, 0, 0, 49426, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'The Twilight Destroyer', 'Defeat Halion and repel the invasion of the Ruby Sanctum.', 'This was no reckless attack, but rather a carefully orchestrated strike against the heart of the Red Dragonflight.$B$BZarithrian, on the bluff over there, is overseeing the assault, but the true leader of this force is a brash and powerful Twilight dragon named Halion. Not since Dargonax has a full-grown spawn of Sinestra\'s twisted experiments been seen.$B$BSlay him, $N, and then when the invasion has been fully repelled, report to Krasus regarding all you have seen here.', '', 'Report back to Krasus atop Wyrmrest Temple.', 39863, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', ''); + +-- Scripts +REPLACE INTO script_texts (`entry`, `content_default`, `npc_entry`, `content_loc3`, `sound`, `type`, `language`) VALUES +('-1752008', '', '0', 'Help I\'m caught in that tree! Help me!', '17490', '1', '7'), +('-1752009', '', '0', 'Thank you', '17491', '1', '7'), +('-1752010', '', '0', 'We believed the Sanctum is well appreciated but this type of attack we were not prepared ...', '17492', '0', '7'), +('-1752011', '', '0', 'The Black Dragonkin appeared from nowhere and attacked us to respond before we could ...', '17493', '0', '7'), +('-1752012', '', '0', 'We had no chance ... While my brothers died, I could retire here and the entrance block.', '17494', '0', '7'), +('-1752013', '', '0', 'They slaughtered us with cold efficiency ... But their wares goal seemed to be the eggs which are located in the Sanctum.', '17495', '0', '7'), +('-1752014', '', '0', 'The commander of ground troops is a cruel beast called Zarithrian. But I fear greater powers are at work ...', '17496', '0', '7'), +('-1752015', '', '0', 'I saw in their attack shortly their true leader ... a terrible twilight adult dragon.', '17497', '0', '7'), +('-1752016', '', '0', 'I know their exact plans but I know one thing: They may not be successful!', '17498', '0', '7'), + +( -1752001, "Ah, the entertainment has arrived.", 0, "Ahh...Die Unterhaltung ist eingetroffen!", 17520, 1, 7), +( -1752002, "Baltharus leaves nobody alive!", 0, "Baltharus lasst niemanden am Leben!", 17521, 1, 7), +( -1752003, "This world has enough heroes.", 0, "Diese Welt hat genug Helden!", 17522, 1, 7), +( -1752004, "I..don't saw...that coming...", 0, "Das...habe ich...nicht..kommen sehen...", 17523, 1, 7), +( -1752005, "Twice the pain and half the fun.", 0, "Doppelter Schmerz, Halb so viel Spa?!", 17524, 1, 7), +( -1752006, "", 0, "Eure Macht schwindet, Uralte! Balt folgt ihr euren Freunden!", 17525, 1, 7), + +( -1752017, "Alexstrasza has chosen capable allies... A pity that I must END YOU!", 0, "Alextrasza hat fahige Verbundete... Zu Schade, dass es hier mit euch ENDET!", 17512, 1, 7), +( -1752018, "You thought you stood a chance?", 0, "Ihr dachtet ihr konntet bestehen?", 17513, 1, 7), +( -1752019, "It's for the best.", 0, "Es ist zu eurem Besten.", 17514, 1, 7), +( -1752020, "HALION! I...", 0, "HALION! Ich...", 17515, 1, 7), +( -1752021, "Turn them to ashes, minions!", 0, "Aschert sie ein, Lakeien!", 17516, 1, 7), + +( -1752022, "You will sssuffer for this intrusion!", 0, "Fur dieses Eindringen werdet ihr leiden!", 17528, 1, 7), +( -1752023, "As it should be...", 0, "Wie es sich gehort...", 17529, 1, 7), +( -1752024, "Halion will be pleased", 0, "Halion wird erfreut sein...", 17530, 1, 7), +( -1752025, "HHrr...Grr..", 0, "HHrr...Grr..", 17531, 1, 7), +( -1752026, "Burn in the master's flame!", 0, "Brennt in der Flamme des Meisters!", 17532, 1, 7), + +('-1752027', '', '0', 'annoying insects! You\'re too late! The Ruby Sanctum is lost ...', '17499', '1', '7'), +('-1752028', '', '0', 'Your world is in the balance. You all will be witnesses of the beginning of a new age of destruction', '17500', '1', '7'), +('-1752029', '', '0', 'Another hero is gone!', '17501', '1', '7'), +('-1752030', '', '0', 'Hrrhahaha!', '17502', '1', '7'), +('-1752031', '', '0', 'Enjoy your victory, mortals for it was your Last! On the return of the master will burn this world ...', '17499', '1', '7'), +('-1752032', '', '0', 'Not good enough.', '17504', '1', '7'), +('-1752033', '', '0', 'Burn The Sky!', '17505', '1', '7'), +('-1752033', '', '0', 'Beware the shadows!', '17506', '1', '7'), +('-1752033', '', '0', 'You will find only in the realm of twilight suffering. Come in if you dare!', '17507', '1', '7'), +('-1752033', '', '0', 'I am the light and darkness. Tremble mortals before the herald Deathwing!', '17508', '1', '7'); + +-- Scriptnames +UPDATE `creature_template` SET `ScriptName` = 'boss_baltharus' WHERE `entry` = '39751'; +UPDATE `creature_template` SET `ScriptName` = 'boss_baltharus_clone' WHERE `entry` = '39899'; +UPDATE `creature_template` SET `ScriptName` = 'npc_xerestrasza' WHERE `entry` = '40429'; +UPDATE `creature_template` SET `ScriptName` = 'boss_zarithrian' WHERE `entry` = '39746'; +UPDATE `creature_template` SET `ScriptName` = 'boss_ragefire' WHERE `entry` = '39747'; +UPDATE `creature_template` SET `ScriptName` = 'boss_halion' WHERE `entry`= '39863'; +UPDATE `creature_template` SET `ScriptName` = 'boss_twilight_halion' WHERE `entry` = '40142'; +UPDATE `creature_template` SET `ScriptName` = 'npc_onyx_flamecaller' WHERE `entry` = '39814'; +UPDATE `gameobject_template` SET `ScriptName` = 'go_firefield' WHERE `entry` = '203005'; \ No newline at end of file diff --git a/sql/wow_ro/TrialOfTheChampion/trial_of_the_champion.sql b/sql/wow_ro/TrialOfTheChampion/trial_of_the_champion.sql new file mode 100644 index 0000000..32fcbb8 --- /dev/null +++ b/sql/wow_ro/TrialOfTheChampion/trial_of_the_champion.sql @@ -0,0 +1,568 @@ +UPDATE `instance_template` SET `script`='instance_trial_of_the_champion' WHERE `map`=650; +UPDATE `creature_template` SET `ScriptName`='npc_announcer_toc5' WHERE `entry`IN (35004,35005); + +-- Moturas +DELETE FROM `vehicle_accessory` WHERE `entry` in (35491,33299,33418,33409,33300,33408,33301,33414,33297,33416,33298); +INSERT INTO `vehicle_accessory` (`entry`,`accessory_entry`,`seat_id`,`minion`,`description`) VALUES +(35491,35451,0,0, 'Black Knight'), +(33299,35323,0,1, 'Darkspear Raptor'), +(33418,35326,0,1, 'Silvermoon Hawkstrider'), +(33409,35314,0,1, 'Orgrimmar Wolf'), +(33300,35325,0,1, 'Thunder Bluff Kodo'), +(33408,35329,0,1, 'Ironforge Ram'), +(33301,35331,0,1, 'Gnomeregan Mechanostrider'), +(33414,35327,0,1, 'Forsaken Warhorse'), +(33297,35328,0,1, 'Stormwind Steed'), +(33416,35330,0,1, 'Exodar Elekk'), +(33298,35332,0,1, 'Darnassian Nightsaber'); + + +-- Textos originales. +DELETE FROM `script_texts` WHERE `entry` <= -1999926 and `entry` >= -1999956; +INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`sound`,`type`,`language`,`emote`,`comment`) VALUES +(0,-1999926, 'Coming out of the gate Grand Champions other faction. ' ,0,0,0,1, 'SAY_START' ), +(0,-1999927, 'Good work! You can get your award from Crusader\'s Coliseum chest!. ' ,0,1,0,1, 'Win' ), +(0,-1999928, 'You spoiled my grand entrance. Rat.' ,16256,1,0,5, 'SAY_AGGRO' ), +(0,-1999929, 'Did you honestly think an agent if the Kich King would be bested on the field of your pathetic little tournament?' ,16257,1,0,5, 'SAY_AGGRO_1' ), +(0,-1999930, 'I have come to finish my task ' ,16258,1,0,5, 'SAY_AGGRO_2' ), +(0,-1999931, 'This farce ends here!' ,16259,1,0,5, 'SAY_AGGRO_3' ), +(0,-1999932, '[Zombie]Brains.... .... ....' ,0,1,0,5, 'SAY_SLAY' ), +(0,-1999933, 'My roting flash was just getting in the way!' ,16262,1,0,5, 'SAY_DEATH_1' ), +(0,-1999934, 'I have no need for bones to best you!' ,16263,1,0,5, 'SAY_DEATH_2' ), +(0,-1999935, 'No! I must not fail...again...' ,16264,1,0,5, 'SAY_DEATH_3' ), +(0,-1999936, 'What\'s that. up near the rafters ?' ,0,1,0,5, 'detected' ), +(0,-1999937, 'Please change your weapon! Next battle will be start now!' ,0,3,0,5, 'nx' ), +(0,-1999939, 'Excellent work!' ,0,1,0,1, 'work' ), +(0,-1999940, 'Coming out of the gate Crusader\'s Coliseum Champion.' ,0,0,0,1, 'SAY_START3' ), +(0,-1999941, 'Excellent work! You are win Argent champion!' ,0,3,0,0, 'win' ), +(0,-1999942, 'The Sunreavers are proud to present their representatives in this trial by combat.' ,0,0,0,1, 'an1' ), +(0,-1999943, 'Welcome, champions. Today, before the eyes of your leeders and peers, you will prove youselves worthy combatants.' ,0,0,0,1, 'an2' ), +(0,-1999944, 'Fight well, Horde! Lok\'tar Ogar!' ,0,1,0,5, 'Thrall' ), +(0,-1999945, 'Finally, a fight worth watching.' ,0,1,0,5, 'Garrosh' ), +(0,-1999946, 'I did not come here to watch animals tear at each other senselessly, Tirion' ,0,1,0,5, 'King' ), +(0,-1999947, 'You will first be facing three of the Grand Champions of the Tournament! These fierce contenders have beaten out all others to reach the pinnacle of skill in the joust.' ,0,1,0,5, 'Hightlord' ), +(0,-1999948, 'Will tought! You next challenge comes from the Crusade\'s own ranks. You will be tested against their consederable prowess.' ,0,1,0,5, 'Hightlord2' ), +(0,-1999949, 'You may begin!' ,0,0,0,5, 'text' ), +(0,-1999950, 'Well, then. Let us begin.' ,0,1,0,5, 'pal agro' ), +(0,-1999951, 'Take this time to consider your past deeds.' ,16248,1,0,5, 'palsum' ), +(0,-1999952, 'What is the meaning of this?' ,0,1,0,5, 'dk_hightlord' ), +(0,-1999953, 'No...I\'m still too young' ,0,1,0,5, 'die' ), +(0,-1999954, 'Excellent work! You are win Argent champion!' ,0,3,0,0, 'win' ); + + +-- actualización nueva de todos los npc relacionado a prueba del campeón +-- Update mob's stats +-- Memory's Stats +-- Health, mana, vehicle id, etc... +-- Equipment +-- Faction for Vehicle + +DELETE FROM `creature_template` WHERE `entry` IN +(12000, 12001, 12002, 12003, 12004, 12005, 12006, 12007, 12008, 12009, 12010, 12011, 12012, +12436, 12437, 12438, 12439, 12440, 12441, 12442, 12443, 12444, 12445, 12446, 12447, 12448, 12449,12450, 12451, 12452, 12453, 12454, 12455, 12456, +12482, 12483, 12484, 12485, 12486, 12487, 12488, 12725, +33297, 33298, 33299, 33300, 33301, 33408, 33409, 33414, 33416, 33418, 34657, 34658, 34701,34702, 34703, 34705, +34928,34942, 35028, 35029, 35030, 35031, 35032, 35033, 35034, 35035, 35036, 35037, 35038, 35039, 35040, +35041, 35042, 35043, 35044, 35045, 35046, 35047, 35048, 35049, 35050, 35051, 35052, 35119, +35305, 35307, 35309, 35314, 35323, 35325, 35326, 35327, 35328, 35329, 35330, 35331, 35332, 35451, +35545, 35564, 35569, 35570, 35571, 35572, 35590, 35617, 35633, 35634, 35635, 35636, 35637, 35638, 35640, 35641, 35644, 35768,36558); + + +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES +('12000','0','0','0','0','0','28586','0','28586','0','Ambrose Boltspark','Grand Champion of Gnomeregan','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','15.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','64','0','0','0','0','0','0','0','0','0','68312','68310','66045','68311','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','0','617297499','1','','1'), +('12001','0','0','0','0','0','28736','0','28736','0','Colosos','Grand Champion of the Exodar','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','17','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','68319','67530','68318','67534','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2096','617297499','1','','1'), +('12002','0','0','0','0','0','28735','0','28735','0','Jaelyne Evensong','Grand Champion of Darnassus','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','15.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','68340','66083','66081','66079','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2095','617297499','1','','1'), +('12003','0','0','0','0','0','28564','0','28564','0','Lana Stouthammer','Grand Champion of Ironforge','','0','80','80','0','1802','1802','0','1','1','1','1','420','630','0','158','15.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','35.38','20','1','0','0','0','0','0','0','0','441','1','2093','617297499','1','','1'), +('12004','0','0','0','0','0','28560','0','28560','0','Marshal Jacob Alerius','Grand Champion of Stormwind','','0','80','80','0','1802','1802','0','1','1','1','1','420','630','0','158','15.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','35.38','20','1','0','0','0','0','0','0','0','0','1','2092','617297499','1','','1'), +('12005','0','0','0','0','0','28637','0','28637','0','Eressea Dawnsinger','Grand Champion of Silvermoon','','0','80','80','2','1801','1801','0','1','1','1','1','420','630','0','158','15.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','68312','68310','66045','68311','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2021','617297499','1','','1'), +('12006','0','0','0','0','0','28597','0','28597','0','Runok Wildmane','Grand Champion of the Thunder Bluff','','0','80','80','2','1801','1801','0','1','1','1','1','420','630','0','158','15.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','68319','67530','67528','67534','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2025','617297499','1','','1'), +('12007','0','0','0','0','0','28588','0','28588','0','Zul\'tore','Grand Champion of Sen\'jin','','0','80','80','0','1801','1801','0','1','1','1','1','420','630','0','158','15.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','68340','66083','66081','66079','0','0','0','0','0','0','0','0','','0','3','35.38','20','1','0','0','0','0','0','0','0','0','1','2019','617297499','1','','1'), +('12008','0','0','0','0','0','28589','0','28589','0','Deathstalker Visceri','Grand Champion of Undercity','','0','80','80','0','1801','1801','0','1','1','1','1','420','630','0','158','15.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','67709','67706','67701','0','0','0','0','0','0','0','0','0','','0','3','35.38','20','1','0','0','0','0','0','0','0','0','1','2020','617297499','1','','1'), +('12009','0','0','0','0','0','28587','0','28587','0','Mokra the Skullcrusher','Grand Champion of Orgrimmar','','0','80','80','0','1801','1801','0','1','1','1','1','420','630','0','158','15.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','35.38','20','1','0','0','0','0','0','0','0','441','1','2018','617297499','1','','1'), +('12010','0','0','0','0','0','29490','0','29490','0','Argent Confessor Paletress','','','0','82','82','2','14','14','0','1','1','1','1','452','678','0','170','22.4','2000','2000','2','0','0','0','0','0','0','0','362','542','136','7','104','0','0','0','0','0','0','0','0','0','66546','67674','66515','67675','0','0','0','0','0','0','0','0','','0','3','8','20','1','0','0','0','0','0','0','0','151','1','235','805257215','1','','1'), +('12011','0','0','0','0','0','29616','0','29616','0','Eadric the Pure','Grand Champion of the Argent Crusade','','0','82','82','2','14','14','0','1','1','1','1','452','678','0','170','22.4','2000','2000','2','0','0','0','0','0','0','0','362','542','136','7','104','0','0','0','0','0','0','0','0','0','66865','66863','66867','66935','0','0','0','0','0','0','0','0','','0','3','42.5','20','1','0','0','0','0','0','0','0','151','1','834','805257215','1','','1'), +('12012','0','0','0','0','0','29837','0','29837','0','The Black Knight','','','0','80','80','0','14','14','0','1','1','1','1','420','630','0','158','17.6','2000','2000','1','0','0','0','0','0','0','0','336','504','126','6','72','12012','0','0','0','0','0','0','0','0','67884','68306','67881','67883','0','0','0','0','0','0','10700','10700','','0','3','37.7387','1','1','0','0','0','0','0','0','0','0','1','0','805257215','1','','1'), +('12436','0','0','0','0','0','25528','0','25528','0','Risen Arelas Brightstar','Black Knight\'s Minion','','0','80','80','0','14','14','0','1','1','1','0','420','630','0','158','1.4','2000','2000','1','0','0','0','0','0','0','0','336','504','126','6','72','0','0','0','0','0','0','0','0','0','67879','67886','67880','0','0','0','0','0','0','0','0','0','','0','3','9.43467','1','1','0','0','0','0','0','0','0','0','1','0','0','0','','1'), +('12437','0','0','0','0','0','29542','0','29542','0','Memory of Kalithresh','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66552','66620','66619','0','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12438','0','0','0','0','0','14367','0','14367','0','Memory of Chromaggus','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','2','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12439','0','0','0','0','0','29762','29763','29762','0','Argent Lightwielder','','','0','80','80','2','14','14','0','1','1','1','1','420','630','0','158','12.6','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','8','0','0','0','0','0','0','0','0','0','67247','67290','15284','67237','0','0','0','0','0','0','7651','7651','','0','3','8','5','1','0','0','0','0','0','0','0','0','1','0','0','0','','1'), +('12440','0','0','0','0','0','23428','0','23428','0','Memory of Entropius','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12441','0','0','0','0','0','29562','0','29562','0','Memory of Lucifron','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','66619','66552','0','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12442','0','0','0','0','0','29547','0','29547','0','Memory of Illidan','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','3','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12443','0','0','0','0','0','29541','0','29541','0','Memory of Vek\'nilash','','','0','82','82','0','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12444','0','0','0','0','0','24996','24999','24997','0','Risen Champion','Black Knight\'s Minion','','0','80','80','0','14','14','0','1','1','1','0','420','630','0','158','1.4','2000','2000','1','0','0','0','0','0','0','0','336','504','126','6','72','0','0','0','0','0','0','0','0','0','67774','67879','67729','67886','0','0','0','0','0','0','0','0','','0','3','7.076','1','1','0','0','0','0','0','0','0','0','1','0','0','0','','1'), +('12445','0','0','0','0','0','29543','0','29543','0','Memory of Malchezaar','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','3','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12446','0','0','0','0','0','29553','0','29553','0','Memory of Algalon','','','0','82','82','0','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','4','72','0','0','0','0','0','0','0','0','0','67679','67678','67677','0','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12447','0','0','0','0','0','29556','0','29556','0','Memory of Mutanus','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12448','0','0','0','0','0','29760','29761','29760','0','Argent Priestess','','','0','80','80','2','14','14','0','1','1','1','1','420','630','0','158','8.5','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','8','0','0','0','0','0','0','0','0','0','67194','36176','67289','67229','0','0','0','0','0','0','7653','7653','','0','3','10','8','1','0','0','0','0','0','0','0','0','1','0','0','0','','1'), +('12449','0','0','0','0','0','21401','0','21401','0','Memory of Onyxia','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','2','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12450','0','0','0','0','0','29185','0','29185','0','Memory of Ignis','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','5','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12451','0','0','0','0','0','29549','0','29549','0','Memory of Cyanigosa','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','2','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12452','0','0','0','0','0','29545','0','29545','0','Memory of Vashj','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12453','0','0','0','0','0','29540','0','29540','0','Memory of Hakkar','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12454','0','0','0','0','0','29537','0','29537','0','Memory of Herod','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12455','0','0','0','0','0','29557','0','29557','0','Memory of Heigan','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','6','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12456','0','0','0','0','0','26644','0','26644','0','Memory of Eck','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12482','0','0','0','0','0','18699','0','18699','0','Memory of Delrissa','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12483','0','0','0','0','0','29558','0','29558','0','Memory of Ingvar','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','6','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12484','0','0','0','0','0','29525','0','29525','0','Memory of Hogger','','','0','82','82','0','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12485','0','0','0','0','0','29536','0','29536','0','Memory of VanCleef','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12486','0','0','0','0','0','29546','0','29546','0','Memory of Archimonde','','','0','82','82','0','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','3','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12487','0','0','0','0','0','28548','0','28548','0','Memory of Vezax','','','0','82','82','0','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('12488','0','0','0','0','0','29758','29759','29758','0','Argent Monk','','','0','80','80','0','14','14','0','1','1','1','1','420','630','0','158','12','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','8','0','0','0','0','0','0','0','0','0','67251','67255','67233','67235','0','0','0','0','0','0','7661','7661','','0','3','23.5867','1','1','0','0','0','0','0','0','0','0','1','0','0','0','','1'), +('12725','0','0','0','0','0','18698','0','18698','0','Memory of Gruul','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','122.031','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','','1'), +('33297','0','0','0','0','0','28912','0','0','0','Stormwind Steed','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','1'), +('33298','0','0','0','0','0','29256','0','0','0','Darnassian Nightsaber','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','11723'), +('33299','0','0','0','0','0','29261','0','0','0','Darkspear Raptor','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','11159'), +('33300','0','0','0','0','0','29259','0','0','0','Thunder Bluff Kodo','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','11159'), +('33301','0','0','0','0','0','28571','0','0','0','Gnomeregan Mechanostrider','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','1'), +('33408','0','0','0','0','0','29258','0','0','0','Ironforge Ram','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','1'), +('33409','0','0','0','0','0','29260','0','0','0','Orgrimmar Wolf','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','11159'), +('33414','0','0','0','0','0','29257','0','0','0','Forsaken Warhorse','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','11159'), +('33416','0','0','0','0','0','29255','0','0','0','Exodar Elekk','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','11403'), +('33418','0','0','0','0','0','29262','0','0','0','Silvermoon Hawkstrider','','','0','80','80','0','14','14','0','1','1.14286','1','0','20000','30000','0','24','1','2000','0','1','0','8','0','0','0','0','0','1','1','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','140','1','0','0','0','generic_vehicleAI_toc5','1'), +('34657','12002','0','0','0','0','28735','0','28735','0','Jaelyne Evensong','Grand Champion of Darnassus','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','10.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','68340','66083','66081','66079','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2095','617297499','0','boss_hunter_toc5','1'), +('34658','0','0','0','0','0','9991','0','0','0','Jaelyne Evensong\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('34701','12001','0','0','0','0','28736','0','28736','0','Colosos','Grand Champion of the Exodar','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','10.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','67529','67530','67528','67534','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2096','617297499','0','boss_shaman_toc5','1'), +('34702','12000','0','0','0','0','28586','0','28586','0','Ambrose Boltspark','Grand Champion of Gnomeregan','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','10.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','64','0','0','0','0','0','0','0','0','0','66044','66042','66045','66043','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','0','617297499','0','boss_mage_toc5','1'), +('34703','12003','0','0','0','0','28564','0','28564','0','Lana Stouthammer','Grand Champion of Ironforge','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','10.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','67709','67706','67701','0','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','441','1','2093','617297499','0','boss_rouge_toc5','1'), +('34705','12004','0','0','0','0','28560','0','28560','0','Marshal Jacob Alerius','Grand Champion of Stormwind','','0','80','80','2','1802','1802','0','1','1','1','1','420','630','0','158','10.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2092','617297499','0','boss_warrior_toc5','1'), +('34928','12010','0','0','0','0','29490','0','29490','0','Argent Confessor Paletress','','','0','82','82','2','14','14','0','1','1','1','1','452','678','0','170','14.5','2000','2000','2','0','0','0','0','0','0','0','362','542','136','7','104','0','0','0','0','0','0','0','0','0','66546','66536','66515','66537','0','0','0','0','0','0','0','0','','0','3','8','20','1','0','0','0','0','0','0','0','151','1','235','805257215','0','boss_paletress','1'), +('34942','12484','0','0','0','0','29525','0','29525','0','Memory of Hogger','','','0','82','82','2','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35028','12485','0','0','0','0','29536','0','29536','0','Memory of VanCleef','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35029','12447','0','0','0','0','29556','0','29556','0','Memory of Mutanus','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35030','12454','0','0','0','0','29537','0','29537','0','Memory of Herod','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35031','12441','0','0','0','0','29562','0','29562','0','Memory of Lucifron','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','66619','66552','0','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35032','0','0','0','0','0','14992','0','14992','0','Memory of Thunderaan','','','0','82','82','0','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35033','12438','0','0','0','0','14367','0','14367','0','Memory of Chromaggus','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','2','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35034','12453','0','0','0','0','29540','0','29540','0','Memory of Hakkar','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35035','0','0','0','0','0','29888','0','0','0','Barrett Ramsey','Argent Coliseum Master','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','768','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','','11723'), +('35036','12443','0','0','0','0','29541','0','29541','0','Memory of Vek\'nilash','','','0','82','82','2','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35037','12437','0','0','0','0','29542','0','29542','0','Memory of Kalithresh','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66552','66620','66619','0','0','0','0','0','0','0','0','0','','0','3','29.2313','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35038','12445','0','0','0','0','29543','0','29543','0','Memory of Malchezaar','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','3','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35039','12725','0','0','0','0','18698','0','18698','0','Memory of Gruul','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35040','12452','0','0','0','0','29545','0','0','0','Memory of Vashj','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35041','12486','0','0','0','0','29546','0','29546','0','Memory of Archimonde','','','0','82','82','2','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','3','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35042','12442','0','0','0','0','29547','0','29547','0','Memory of Illidan','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','3','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35043','12482','0','0','0','0','18699','0','18699','0','Memory of Delrissa','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35044','12440','0','0','0','0','23428','0','23428','0','Memory of Entropius','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35045','12483','0','0','0','0','29558','0','29558','0','Memory of Ingvar','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','6','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35046','12451','0','0','0','0','29549','0','29549','0','Memory of Cyanigosa','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','2','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35047','12456','0','0','0','0','26644','0','26644','0','Memory of Eck','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','7','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35048','12449','0','0','0','0','21401','0','21401','0','Memory of Onyxia','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','2','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35049','12455','0','0','0','0','29557','0','29557','0','Memory of Heigan','','','0','82','82','2','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','6','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35050','12450','0','0','0','0','29185','0','29185','0','Memory of Ignis','','','0','82','82','0','14','14','0','1','1','0.5','1','452','678','0','170','15','2000','2000','1','0','0','0','0','0','0','0','362','542','136','5','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35051','12487','0','0','0','0','28548','0','28548','0','Memory of Vezax','','','0','82','82','0','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','10','72','0','0','0','0','0','0','0','0','0','66620','67679','66619','67678','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35052','12446','0','0','0','0','29553','0','29553','0','Memory of Algalon','','','0','82','82','2','14','14','0','1','1','0.5','1','330','495','0','124','20.5','2000','2000','8','0','0','0','0','0','0','0','264','396','99','4','72','0','0','0','0','0','0','0','0','0','67679','67678','67677','0','0','0','0','0','0','0','0','0','','0','3','29','25','1','0','0','0','0','0','0','0','150','1','0','617297499','0','npc_memory','1'), +('35119','12011','0','0','0','0','29616','0','29616','0','Eadric the Pure','Grand Champion of the Argent Crusade','','0','82','82','2','14','14','0','1','1','1','1','452','678','0','170','14.5','2000','2000','2','0','0','0','0','0','0','0','362','542','136','7','104','0','0','0','0','0','0','0','0','0','66865','66863','66867','66935','0','0','0','0','0','0','0','0','','0','3','42.5','20','1','0','0','0','0','0','0','0','151','1','834','805257215','0','boss_eadric','1'), +('35305','12488','0','0','0','0','29758','29759','29758','0','Argent Monk','','','0','80','80','2','14','14','0','1','1','1','1','420','630','0','158','8','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','8','0','0','0','0','0','0','0','0','0','67251','67255','67233','67235','0','0','0','0','0','0','7661','7661','','0','3','8','1','1','0','0','0','0','0','0','0','0','1','0','0','0','npc_argent_soldier','1'), +('35307','12448','0','0','0','0','29760','29761','29760','0','Argent Priestess','','','0','80','80','2','14','14','0','1','1','1','1','420','630','0','158','5.5','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','8','0','0','0','0','0','0','0','0','0','67194','36176','67289','67229','0','0','0','0','0','0','7653','7653','','0','3','8','8','1','0','0','0','0','0','0','0','0','1','0','0','0','npc_argent_soldier','1'), +('35309','12439','0','0','0','0','29762','29763','29762','0','Argent Lightwielder','','','0','80','80','2','14','14','0','1','1','1','1','420','630','0','158','8.4','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','8','0','0','0','0','0','0','0','0','0','67247','67290','15284','67237','0','0','0','0','0','0','7651','7651','','0','3','8','5','1','0','0','0','0','0','0','0','0','1','0','0','0','npc_argent_soldier','1'), +('35314','0','0','0','0','0','29090','0','0','0','Orgrimmar Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35323','0','0','0','0','0','28702','0','0','0','Sen\'jin Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35325','0','0','0','0','0','28864','0','0','0','Thunder Bluff Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','35325','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35326','0','0','0','0','0','28862','0','0','0','Silvermoon Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35327','0','0','0','0','0','28865','0','0','0','Undercity Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35328','0','0','0','0','0','28863','0','0','0','Stormwind Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35329','0','0','0','0','0','28860','0','0','0','Ironforge Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35330','0','0','0','0','0','28858','0','0','0','Exodar Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35331','0','0','0','0','0','28859','0','0','0','Gnomeregan Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35332','0','0','0','0','0','28857','0','0','0','Darnassus Champion','','','0','80','80','2','35','35','0','1','1.14286','1','1','422','586','0','642','7.5','0','0','1','33554432','8','0','0','0','0','0','345','509','103','7','2048','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','PassiveAI','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','2049','0','0','','11723'), +('35451','12012','0','0','0','0','29837','0','29837','0','The Black Knight','','','0','80','80','2','14','14','0','1','1','1','1','420','630','0','158','11.8','2000','2000','1','0','0','0','0','0','0','0','336','504','126','6','72','35451','0','0','0','0','0','0','0','0','67724','67745','67718','67725','0','0','0','0','0','0','9530','9530','','0','3','5.95238','1','1','0','0','0','0','0','0','0','0','1','0','805257215','0','boss_black_knight','1'), +('35545','0','0','0','0','0','25528','0','25528','0','Risen Jaeren Sunsworn','Black Knight\'s Minion','','0','80','80','2','14','14','0','1','1','1','0','420','630','0','158','1.4','2000','2000','1','0','0','0','0','0','0','0','336','504','126','6','72','0','0','0','0','0','0','0','0','0','67774','67879','67729','67886','0','0','0','0','0','0','0','0','','0','3','2.5','1','1','0','0','0','0','0','0','0','0','1','0','0','0','npc_risen_ghoul','1'), +('35564','12436','0','0','0','0','25528','0','25528','0','Risen Arelas Brightstar','Black Knight\'s Minion','','0','80','80','2','14','14','0','1','1','1','0','420','630','0','158','1.4','2000','2000','1','0','0','0','0','0','0','0','336','504','126','6','72','0','0','0','0','0','0','0','0','0','67774','67879','67729','67886','0','0','0','0','0','0','0','0','','0','3','2.5','1','1','0','0','0','0','0','0','0','0','1','0','0','0','npc_risen_ghoul','1'), +('35569','12005','0','0','0','0','28637','0','28637','0','Eressea Dawnsinger','Grand Champion of Silvermoon','','0','80','80','2','1801','1801','0','1','1','1','1','420','630','0','158','10.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','66044','66042','66045','66043','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2021','617297499','0','boss_mage_toc5','1'), +('35570','12007','0','0','0','0','28588','0','28588','0','Zul\'tore','Grand Champion of Sen\'jin','','0','80','80','2','1801','1801','0','1','1','1','1','420','630','0','158','10.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','68340','66083','66081','66079','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2019','617297499','0','boss_hunter_toc5','1'), +('35571','12006','0','0','0','0','28597','0','28597','0','Runok Wildmane','Grand Champion of the Thunder Bluff','','0','80','80','2','1801','1801','0','1','1','1','1','420','630','0','158','10.2','2000','2000','2','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','67529','67530','67528','67534','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2025','617297499','0','boss_shaman_toc5','1'), +('35572','12009','0','0','0','0','28587','0','28587','0','Mokra the Skullcrusher','Grand Champion of Orgrimmar','','0','80','80','2','1801','1801','0','1','1','1','1','420','630','0','158','10.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','441','1','2018','617297499','0','boss_warrior_toc5','1'), +('35590','12444','0','0','0','0','24996','24999','24997','0','Risen Champion','Black Knight\'s Minion','','0','80','80','2','14','14','0','1','1','1','0','420','630','0','158','1','2000','2000','1','0','0','0','0','0','0','0','336','504','126','6','72','0','0','0','0','0','0','0','0','0','67774','67879','67729','67886','0','0','0','0','0','0','0','0','','0','3','1.5','1','1','0','0','0','0','0','0','0','0','1','0','0','0','','1'), +('35617','12008','0','0','0','0','28589','0','28589','0','Deathstalker Visceri','Grand Champion of Undercity','','0','80','80','2','1801','1801','0','1','1','1','1','420','630','0','158','10.2','2000','2000','1','0','0','0','0','0','0','0','336','504','126','7','0','0','0','0','0','0','0','0','0','0','67709','67706','67701','0','0','0','0','0','0','0','0','0','','0','3','15','20','1','0','0','0','0','0','0','0','0','1','2020','617297499','0','boss_rouge_toc5','1'), +('35633','0','0','0','0','0','28571','0','0','0','Ambrose Boltspark\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35634','0','0','0','0','0','10718','0','0','0','Deathstalker Visceri\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35635','0','0','0','0','0','28607','0','0','0','Eressea Dawnsinger\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35636','0','0','0','0','0','2787','0','0','0','Lana Stouthammer\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35637','0','0','0','0','0','29284','0','0','0','Marshal Jacob Alerius\' Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35638','0','0','0','0','0','29879','0','0','0','Mokra the Skullcrusher\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35640','0','0','0','0','0','29880','0','0','0','Runok Wildmane\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35641','0','0','0','0','0','29261','0','0','0','Zul\'tore\'s Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('35644','0','0','0','0','0','28918','0','0','0','Argent Warhorse','','vehichleCursor','0','80','80','2','35','35','0','1','2','1','0','10000','20000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','10','0','0','0','0','0','0','0','0','0','0','62544','62575','63010','66482','0','0','0','0','0','486','0','0','','0','3','40','1','1','0','0','0','0','0','0','0','157','1','0','0','0','','11723'), +('35768','0','0','0','0','0','29255','0','0','0','Colosos\' Mount','','','0','80','80','2','14','14','0','1','1.14286','1','0','20000','30000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','7','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','486','0','0','','0','3','10','1','1','0','0','0','0','0','0','0','0','1','0','0','0','generic_vehicleAI_toc5','11723'), +('36558','0','0','0','0','0','29283','0','0','0','Argent Battleworg','','vehichleCursor','0','80','80','2','35','35','0','1','2','1','0','10000','20000','0','642','1','0','0','1','0','8','0','0','0','0','0','345','509','103','10','0','0','0','0','0','0','0','0','0','0','62544','62575','63010','66482','0','0','0','0','0','486','0','0','','0','3','40','1','1','0','0','0','0','0','0','0','157','1','0','0','0','','11723'); + +-- Anuncios al comienzo del evento. +DELETE FROM `creature_template` WHERE `entry` in (35591,35592); +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES +(35591, 0, 0, 0, 0, 0, 29894, 0, 0, 0, 'Jaeren Sunsworn', '', '', 0, 75, 75, 2, 14, 14, 0, 1, 1, 0, 0, 0, 0, 0, 1, 2000, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 'npc_anstart'), +(35592, 0, 0, 0, 0, 0, 29893, 0, 0, 0, 'Arelas Brightstar', '', '', 0, 75, 75, 2, 14, 14, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 'npc_anstart'); + + +-- Fountain of Light +DELETE FROM `creature_template` WHERE `entry`=35311; +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES +(35311, 0, 0, 0, 0, 0, 27769, 0, 0, 0, 'Fountain of Light', '', '', 0, 79, 80, 0, 14, 14, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 1024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, ''); + + +-- Grifo esquelético del Caballero Negro http://es.wowhead.com/npc=35491 +DELETE FROM `creature_template` WHERE `entry`=35491; +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES +(35491, 0, 0, 0, 0, 0, 29842, 0, 0, 0, 'Black Knight\'s Skeletal Gryphon', '', '', 0, 80, 80, 2, 35, 35, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 33554432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1048576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 486, 0, 0, '', 0, 4, 15, 1, 0, 0, 0, 0, 0, 0, 0, 164, 1, 0, 0, 0, 'npc_black_knight_skeletal_gryphon'); +DELETE FROM `script_waypoint` WHERE `entry`=35491; +INSERT INTO `script_waypoint` VALUES +(35491,1,781.513062, 657.989624, 466.821472,0,''), +(35491,2,759.004639, 665.142029, 462.540771,0,''), +(35491,3,732.936646, 657.163879, 452.678284,0,''), +(35491,4,717.490967, 646.008545, 440.136902,0,''), +(35491,5,707.570129, 628.978455, 431.128632,0,''), +(35491,6,705.164063, 603.628418, 422.956635,0,''), +(35491,7,716.350891, 588.489746, 420.801666,0,''), +(35491,8,741.702881, 580.167725, 420.523010,0,''), +(35491,9,761.634033, 586.382690, 422.206207,0,''), +(35491,10,775.982666, 601.991943, 423.606079,0,''), +(35491,11,769.051025, 624.686157, 420.035126,0,''), +(35491,12,756.582214, 631.692322, 412.529785,0,''), +(35491,13,744.841,634.505,411.575,0,''); +-- Grifo esquelético del Caballero Negro antes de comenzar la batalla +DELETE FROM `creature_template` WHERE `entry` in (35492); +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES +(35492, 0, 0, 0, 0, 0, 29842, 0, 0, 0, 'Black Knight\'s Skeletal Gryphon', '', '', 0, 80, 80, 2, 35, 35, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 33554432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1048576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 486, 0, 0, '', 0, 3, 15, 1, 0, 0, 0, 0, 0, 0, 0, 164, 1, 0, 0, 0, 'npc_gr'); +DELETE FROM `script_waypoint` WHERE `entry`=35492; +INSERT INTO `script_waypoint` VALUES +(35492,1,741.067078, 634.471558, 411.569366,0,''), +(35492,2,735.726196, 639.247498, 414.725555,0,''), +(35492,3,730.187256, 653.250977, 418.913269,0,''), +(35492,4,734.517700, 666.071350, 426.259247,0,''), +(35492,5,739.638489, 675.339417, 438.226776,0,''), +(35492,6,741.833740, 698.797302, 456.986328,0,''), +(35492,7,734.647339, 711.084778, 467.165314,0,''), +(35492,8,715.388489, 723.820862, 470.333588,0,''), +(35492,9,687.178711, 730.140503, 470.569336,0,''); + + + +-- Spawn Announcer in normal/heroic mode +DELETE FROM `creature` WHERE `id`=35004; +DELETE FROM `creature` WHERE `guid`=130961; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(130961, 35004, 650, 3, 1, 0, 0, 746.626, 618.54, 411.09, 4.63158, 86400, 0, 0, 10635, 0, 0, 0); + +-- Dańo +UPDATE `creature_template` SET `dmg_multiplier`= (dmg_multiplier*1.40) WHERE `entry` IN (SELECT `id` FROM creature WHERE `map`=650); +-- El Caballero Negro 35451 11.8 - 12012 17.6p +UPDATE `creature_template` SET `dmg_multiplier`= (dmg_multiplier*2) WHERE `entry`= 35451; +UPDATE `creature_template` SET `dmg_multiplier`= (dmg_multiplier*2) WHERE `entry`= 12012; + +-- CREATURES SPAWN TRIAL OF CHAMPION MAP 650 +DELETE FROM `creature` WHERE `map`=650; +SET @GUID := 500000; +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `DeathState`, `MovementType`) VALUES +(@GUID,36558,650,3,1,0,0,726.826,661.201,412.472,4.66003,86400,0,0,1,0,0,0), +(@GUID+1,36558,650,3,1,0,0,716.665,573.495,412.475,0.977384,86400,0,0,1,0,0,0), +(@GUID+2,36558,650,3,1,0,0,705.497,583.944,412.476,0.698132,86400,0,0,1,0,0,0), +(@GUID+3,36558,650,3,1,0,0,770.486,571.552,412.475,2.05949,86400,0,0,1,0,0,0), +(@GUID+4,36558,650,3,1,0,0,717.443,660.646,412.467,4.92183,86400,0,0,1,0,0,0), +(@GUID+5,36558,650,3,1,0,0,700.531,591.927,412.475,0.523599,86400,0,0,1,0,0,0), +(@GUID+6,36558,650,3,1,0,0,790.177,589.059,412.475,2.56563,86400,0,0,1,0,0,0), +(@GUID+7,36558,650,3,1,0,0,702.165,647.267,412.475,5.68977,86400,0,0,1,0,0,0), +(@GUID+8,36558,650,3,1,0,0,773.097,660.733,412.467,4.45059,86400,0,0,1,0,0,0), +(@GUID+9,36558,650,3,1,0,0,793.052,642.851,412.474,3.63029,86400,0,0,1,0,0,0), +(@GUID+10,36558,650,3,1,0,0,778.741,576.049,412.476,2.23402,86400,0,0,1,0,0,0), +(@GUID+11,36558,650,3,1,0,0,788.016,650.788,412.475,3.80482,86400,0,0,1,0,0,0), +(@GUID+12,35644,650,3,1,0,0,704.943,651.33,412.475,5.60251,86400,0,0,1,0,0,0), +(@GUID+13,35644,650,3,1,0,0,774.898,573.736,412.475,2.14675,86400,0,0,1,0,0,0), +(@GUID+14,35644,650,3,1,0,0,699.943,643.37,412.474,5.77704,86400,0,0,1,0,0,0), +(@GUID+15,35644,650,3,1,0,0,712.594,576.26,412.476,0.890118,86400,0,0,1,0,0,0), +(@GUID+16,35644,650,3,1,0,0,793.009,592.667,412.475,2.6529,86400,0,0,1,0,0,0), +(@GUID+17,35644,650,3,1,0,0,702.967,587.649,412.475,0.610865,86400,0,0,1,0,0,0), +(@GUID+18,35644,650,3,1,0,0,768.255,661.606,412.47,4.55531,86400,0,0,1,0,0,0), +(@GUID+19,35644,650,3,1,0,0,720.569,571.285,412.475,1.06465,86400,0,0,1,0,0,0), +(@GUID+20,35644,650,3,1,0,0,787.439,584.969,412.476,2.47837,86400,0,0,1,0,0,0), +(@GUID+21,35644,650,3,1,0,0,722.363,660.745,412.468,4.83456,86400,0,0,1,0,0,0), +(@GUID+22,35644,650,3,1,0,0,790.49,646.533,412.474,3.71755,86400,0,0,1,0,0,0), +(@GUID+23,35644,650,3,1,0,0,777.564,660.3,412.467,4.34587,86400,0,0,1,0,0,0), +(@GUID+24,35591,650,3,1,0,0,746.626,618.54,411.09,4.63158,86400,0,0,10635,0,0,0), +(@GUID+25,35016,650,3,1,0,0,702.274,638.76,412.47,0,120,0,0,1,0,0,0), +(@GUID+26,35016,650,3,1,0,0,697.285,618.253,412.476,0,120,0,0,1,0,0,0), +(@GUID+27,35016,650,3,1,0,0,714.486,581.722,412.476,0,120,0,0,1,0,0,0), +(@GUID+28,35016,650,3,1,0,0,703.884,596.601,412.474,0,120,0,0,1,0,0,0), +(@GUID+29,35016,650,3,1,0,0,712.413,653.931,412.474,0,120,0,0,1,0,0,0), +(@GUID+30,34977,650,3,1,0,0,733.809,545.215,442.075,1.41372,120,0,0,1,0,0,0), +(@GUID+31,34977,650,3,1,0,0,730.998,552.719,438.812,1.3439,120,0,0,1,0,0,0), +(@GUID+32,34977,650,3,1,0,0,734.411,560.158,435.501,1.37881,120,0,0,1,0,0,0), +(@GUID+33,34977,650,3,1,0,0,726.38,557.151,436.978,1.25664,120,0,0,1,0,0,0), +(@GUID+34,34979,650,3,1,0,0,709.576,570.106,435.504,0.942478,120,0,0,1,0,0,0), +(@GUID+35,34979,650,3,1,0,0,712.873,563.172,436.967,1.02974,120,0,0,1,0,0,0), +(@GUID+36,34979,650,3,1,0,0,714.34,553.708,440.223,1.11701,120,0,0,1,0,0,0), +(@GUID+37,34979,650,3,1,0,0,700.273,559.224,442.08,0.925025,120,0,0,1,0,0,0), +(@GUID+38,34966,650,3,1,0,0,718.917,564.078,435.504,1.11701,120,0,0,1,0,0,0), +(@GUID+39,34966,650,3,1,0,0,721.971,548.191,442.072,1.23918,120,0,0,1,0,0,0), +(@GUID+40,34966,650,3,1,0,0,718.405,555.92,438.803,1.15192,120,0,0,1,0,0,0), +(@GUID+41,34966,650,3,1,0,0,725.661,560.835,435.503,1.23918,120,0,0,1,0,0,0), +(@GUID+42,34858,650,3,1,0,0,697.241,583.858,435.504,0.628319,120,0,0,1,0,0,0), +(@GUID+43,34858,650,3,1,0,0,689.635,582.823,438.819,0.558505,120,0,0,1,0,0,0), +(@GUID+44,34858,650,3,1,0,0,696.26,577.507,436.966,0.698132,120,0,0,1,0,0,0), +(@GUID+45,34858,650,3,1,0,0,682.856,586.2,440.243,0.471239,120,0,0,1,0,0,0), +(@GUID+46,34858,650,3,1,0,0,688.012,573.852,442.074,0.663225,120,0,0,1,0,0,0), +(@GUID+47,34860,650,3,1,0,0,699.005,654.894,435.504,5.53269,120,0,0,1,0,0,0), +(@GUID+48,34860,650,3,1,0,0,693.635,654.892,436.963,5.60251,120,0,0,1,0,0,0), +(@GUID+49,34860,650,3,1,0,0,690.486,661.661,440.209,5.55015,120,0,0,1,0,0,0), +(@GUID+50,34860,650,3,1,0,0,684.069,656.681,442.074,5.68977,120,0,0,1,0,0,0), +(@GUID+52,34860,650,3,1,0,0,686.866,650.837,438.779,5.75959,120,0,0,1,0,0,0), +(@GUID+53,34861,650,3,1,0,0,677.17,640.74,442.069,6.00393,120,0,0,1,0,0,0), +(@GUID+54,34861,650,3,1,0,0,689.436,639.259,435.503,5.95157,120,0,0,1,0,0,0), +(@GUID+55,34861,650,3,1,0,0,679.981,648.878,440.198,5.86431,120,0,0,1,0,0,0), +(@GUID+56,34861,650,3,1,0,0,686.392,643.351,436.973,5.88176,120,0,0,1,0,0,0), +(@GUID+57,34861,650,3,1,0,0,692.406,644.87,435.504,5.8294,120,0,0,1,0,0,0), +(@GUID+58,34970,650,3,1,0,0,769.951,547.875,442.072,1.79769,120,0,0,1,0,0,0), +(@GUID+59,34970,650,3,1,0,0,761.217,549.142,440.246,1.58825,120,0,0,1,0,0,0), +(@GUID+60,34970,650,3,1,0,0,764.08,553.434,438.828,1.8675,120,0,0,1,0,0,0), +(@GUID+61,34857,650,3,1,0,0,675.281,589.988,442.081,0.383972,120,0,0,1,0,0,0), +(@GUID+62,34857,650,3,1,0,0,675.115,597.719,442.073,0.279253,120,0,0,1,0,0,0), +(@GUID+63,34857,650,3,1,0,0,692.854,590.632,435.504,0.471239,120,0,0,1,0,0,0), +(@GUID+64,34857,650,3,1,0,0,689.623,598.045,435.503,0.331613,120,0,0,1,0,0,0), +(@GUID+65,34857,650,3,1,0,0,684.964,591.017,438.848,0.418879,120,0,0,1,0,0,0), +(@GUID+66,34975,650,3,1,0,0,779.997,550.694,442.077,2.05949,120,0,0,1,0,0,0), +(@GUID+67,34975,650,3,1,0,0,773.502,555.516,438.825,1.95477,120,0,0,1,0,0,0), +(@GUID+68,34859,650,3,1,0,0,687.965,629.611,435.498,6.19592,120,0,0,1,0,0,0), +(@GUID+69,34859,650,3,1,0,0,688.731,604.689,435.501,0.20944,120,0,0,1,0,0,0), +(@GUID+70,34859,650,3,1,0,0,677.986,634.102,440.245,5.78437,120,0,0,1,0,0,0), +(@GUID+71,34859,650,3,1,0,0,680.599,603.986,438.794,0.191986,120,0,0,1,0,0,0), +(@GUID+72,34859,650,3,1,0,0,685.113,600.431,436.97,0.279253,120,0,0,1,0,0,0), +(@GUID+73,34859,650,3,1,0,0,685.118,634.405,436.976,6.0912,120,0,0,1,0,0,0), +(@GUID+74,34868,650,3,1,0,0,806.488,574.615,442.076,2.49582,120,0,0,1,0,0,0), +(@GUID+75,34868,650,3,1,0,0,799.194,575.25,438.801,2.37365,120,0,0,1,0,0,0), +(@GUID+76,34974,650,3,1,0,0,790.608,559.269,442.073,2.40855,120,0,0,1,0,0,0), +(@GUID+77,34869,650,3,1,0,0,813.502,644.877,440.254,3.49066,120,0,0,1,0,0,0), +(@GUID+78,34869,650,3,1,0,0,818.512,640.599,442.078,3.38594,120,0,0,1,0,0,0), +(@GUID+79,34869,650,3,1,0,0,813.3,650.717,442.073,3.49066,120,0,0,1,0,0,0), +(@GUID+80,34856,650,3,1,0,0,813.635,587.592,442.069,2.70526,120,0,0,1,0,0,0), +(@GUID+81,34856,650,3,1,0,0,814.332,597.781,440.261,2.89725,120,0,0,1,0,0,0), +(@GUID+82,34856,650,3,1,0,0,808.924,586.035,440.295,2.63545,120,0,0,1,0,0,0), +(@GUID+83,34870,650,3,1,0,0,818.163,607.13,440.209,2.94961,120,0,0,1,0,0,0), +(@GUID+84,34870,650,3,1,0,0,818.134,626.964,440.218,3.28122,120,0,0,1,0,0,0), +(@GUID+85,34871,650,3,1,0,0,810.608,659.83,442.086,3.68265,120,0,0,1,0,0,0), +(@GUID+86,34871,650,3,1,0,0,800.194,660.729,438.769,3.82227,120,0,0,1,0,0,0), +(@GUID+87,34871,650,3,1,0,0,805.472,648.721,436.927,3.50811,120,0,0,1,0,0,0), +(@GUID+88,34905,650,3,1,0,0,696.359,653.587,435.504,5.53252,120,0,0,1,0,0,0), +(@GUID+89,34903,650,3,1,0,0,697.116,583.052,435.504,0.628319,120,0,0,1,0,0,0), +(@GUID+90,34902,650,3,1,0,0,689.196,597,435.503,0.349066,120,0,0,1,0,0,0), +(@GUID+91,34883,650,3,1,0,0,687.83,617.649,435.493,1.58825,120,0,0,1,0,0,0), +(@GUID+92,34901,650,3,1,0,0,687.16,618.132,435.489,0,120,0,0,1,0,0,0), +(@GUID+93,34904,650,3,1,0,0,690.596,642,435.504,5.88176,120,0,0,1,0,0,0); + + +-- cajas que las spawnea el core +DELETE FROM `gameobject_template` WHERE `entry` IN (195709, 195374, 195323); -- modo normal +DELETE FROM `gameobject_template` WHERE `entry` IN (195710, 195375, 195324); -- modo heroico +INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `ScriptName`, `WDBVerified`) VALUES +('195323','3','9069','Confessor\'s Cache','','','','0','0','2','0','0','0','0','0','0','1634','27327','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11723'), +('195324','3','9069','Confessor\'s Cache','','','','0','0','2','0','0','0','0','0','0','1634','27417','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11723'), +('195374','3','9069','Eadric\'s Cache','','','','0','0','2','0','0','0','0','0','0','1634','27325','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11723'), +('195375','3','9069','Eadric\'s Cache','','','','0','0','2','0','0','0','0','0','0','1634','27416','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11723'), +('195709','3','9069','Champion\'s Cache','','','','0','0','2','0','0','0','0','0','0','1634','27321','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11723'), +('195710','3','9069','Champion\'s Cache','','','','0','0','2','0','0','0','0','0','0','1634','27414','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11723'); + +-- GAMEOBJECTS SPAWN TRIAL OF CHAMPION MAP 650 +DELETE FROM `gameobject` WHERE `map`=650; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES +('150063','196398','650','3','1','801.663','624.806','412.344','-1.3439','0','0','0','0','0','0','0'), +('150064','196398','650','3','1','784.533','660.238','412.389','-0.715585','0','0','0','0','0','0','0'), +('150065','196398','650','3','1','710.325','660.708','412.387','0.698132','0','0','0','0','0','0','0'), +('150066','196398','650','3','1','692.127','610.575','412.347','1.85005','0','0','0','0','0','0','0'), +('150067','195477','650','3','1','813.13','617.632','413.039','0','0','0','0','0','0','0','0'), +('150068','195486','650','3','1','813.12','617.59','413.031','0','0','0','0','0','0','0','0'), +('150069','195481','650','3','1','746.156','549.464','412.881','1.5708','0','0','0','0','0','0','0'), +('150070','195480','650','3','1','746.156','549.464','412.881','1.5708','0','0','0','0','0','0','0'), +('150071','195479','650','3','1','746.156','549.464','412.881','1.5708','0','0','0','0','0','0','0'), +('150072','195478','650','3','1','746.156','549.464','412.881','1.5708','0','0','0','0','0','0','0'), +('150075','195485','650','3','1','844.685','623.408','159.109','0','0','0','0','0','0','0','0'), +('150081','195647','650','3','1','746.698','677.469','412.339','1.5708','0','0','1','0','0','0','1'), +('150074','195649','650','3','65535','685.625','617.977','412.285','6.28137','0','0','0.000909718','-1','25','0','1'), +('150078','180723','650','3','1','779.951','655.656','421.818','-2.35619','0','0','0','0','0','0','0'), +('150079','180723','650','3','1','782.309','582.892','421.546','2.25147','0','0','0','0','0','0','0'), +('150073','195648','650','3','65535','746.561','557.002','412.393','1.57292','0','0','0.707856','0.706357','25','0','1'), +('150076','195650','650','3','65535','807.66','618.091','412.394','3.12015','0','0','0.999943','0.0107224','25','0','0'), +('150082','180708','650','3','1','712.521','655.648','424.593','-0.767944','0','0','0','0','0','0','0'), +('150083','180708','650','3','1','704.793','600.736','429.519','0.436332','0','0','0','0','0','0','0'), +('150084','180708','650','3','1','704.302','636.326','425.136','-0.418879','0','0','0','0','0','0','0'), +('150085','180703','650','3','1','712.521','655.648','424.593','-0.767944','0','0','0','0','0','0','0'), +('150086','180703','650','3','1','714.158','585.533','425.579','0.715585','0','0','0','0','0','0','0'), +('150087','180703','650','3','1','704.793','600.736','429.519','0.436332','0','0','0','0','0','0','0'), +('150088','180730','650','3','1','714.158','585.533','425.579','0.715585','0','0','0','0','0','0','0'), +('150089','180730','650','3','1','704.793','600.736','429.519','0.436332','0','0','0','0','0','0','0'), +('150090','180736','650','3','1','792.309','598.457','424.636','2.70526','0','0','0','0','0','0','0'), +('150091','180736','650','3','1','794.441','638.306','425.7','-2.77507','0','0','0','0','0','0','0'), +('150092','180736','650','3','1','779.951','655.656','421.818','-2.35619','0','0','0','0','0','0','0'), +('150093','180736','650','3','1','782.309','582.892','421.546','2.25147','0','0','0','0','0','0','0'), +('150094','180720','650','3','1','779.951','655.656','421.818','-2.35619','0','0','0','0','0','0','0'), +('150095','180720','650','3','1','782.309','582.892','421.546','2.25147','0','0','0','0','0','0','0'), +('150096','180738','650','3','1','794.441','638.306','425.7','-2.77507','0','0','0','0','0','0','0'), +('150097','180738','650','3','1','782.309','582.892','421.546','2.25147','0','0','0','0','0','0','0'), +('150098','180728','650','3','1','704.302','636.326','425.136','-0.418879','0','0','0','0','0','0','0'), +('150099','180728','650','3','1','714.158','585.533','425.579','0.715585','0','0','0','0','0','0','0'), +('150100','180728','650','3','1','712.521','655.648','424.593','-0.767944','0','0','0','0','0','0','0'); +DELETE FROM `gameobject` WHERE `id` IN (195709, 195374, 195323, 195710, 195375, 195324); -- objetos spawneados en ctdb, no deberian estar + + +-- The Black Knight +-- http://www.wowhead.com/npc=35451/el-caballero-negro#drops:mode=normal:0+1-15 +-- Normal +-- Fix drops rates +DELETE FROM `creature_loot_template` WHERE (`entry`=35451); +INSERT INTO `creature_loot_template` VALUES +(35451, 43228, 28, 1, 0, 3, 3), +(35451, 47231, 16.666, 1, 1, 1, 1), +(35451, 47230, 16.666, 1, 1, 1, 1), +(35451, 47220, 16.666, 1, 1, 1, 1), +(35451, 47228, 16.666, 1, 1, 1, 1), +(35451, 47221, 16.666, 1, 1, 1, 1), +(35451, 47222, 16.666, 1, 1, 1, 1), +(35451, 47232, 16.666, 1, 2, 1, 1), +(35451, 47229, 16.666, 1, 2, 1, 1), +(35451, 47227, 16.666, 1, 2, 1, 1), +(35451, 47226, 16.666, 1, 2, 1, 1), +(35451, 47215, 16.666, 1, 2, 1, 1), +(35451, 47216, 16.666, 1, 2, 1, 1); + +-- http://www.wowhead.com/npc=35451/el-caballero-negro#drops:mode=heroic:0+1-15 +-- Hero +-- Fix rates and drops and some missing +DELETE FROM `creature_loot_template` WHERE (`entry`=12012); +INSERT INTO `creature_loot_template` VALUES +(12012, 34057, 1.3, 1, 0, 1, 2), +(12012, 44990, 47, 1, 0, 1, 1), +(12012, 47241, 100, 1, 0, 1, 1), +(12012, 48418, -100, 1, 0, 1, 1), +(12012, 43102, 100, 1, 0, 1, 1), +(12012, 43228, 2, 1, 0, 4, 4), +(12012, 47527, 16.666, 1, 1, 1, 1), +(12012, 47563, 16.666, 1, 1, 1, 1), +(12012, 47561, 16.666, 1, 1, 1, 1), +(12012, 47529, 16.666, 1, 1, 1, 1), +(12012, 47562, 16.666, 1, 1, 1, 1), +(12012, 47566, 16.666, 1, 1, 1, 1), +(12012, 49682, 14.285, 1, 2, 1, 1), +(12012, 47560, 14.285, 1, 2, 1, 1), +(12012, 47567, 14.285, 1, 2, 1, 1), +(12012, 47564, 14.285, 1, 2, 1, 1), +(12012, 47569, 14.285, 1, 2, 1, 1), +(12012, 47568, 14.285, 1, 2, 1, 1), +(12012, 47565, 14.285, 1, 2, 1, 1); + +-- Confessor's Cache +-- http://www.wowhead.com/object=195323#contains:mode=normal:0+1-15 +-- Normal (Entry: 195323) +-- fix drops rates and groups +DELETE FROM `gameobject_loot_template` WHERE (`entry`=27327); +INSERT INTO `gameobject_loot_template` VALUES +(27327, 43228, 100, 1, 0, 3, 3), +(27327, 47176, 8.333, 1, 1, 1, 1), +(27327, 47177, 8.333, 1, 1, 1, 1), +(27327, 47178, 8.333, 1, 1, 1, 1), +(27327, 47181, 8.333, 1, 1, 1, 1), +(27327, 47185, 8.333, 1, 1, 1, 1), +(27327, 47211, 8.333, 1, 1, 1, 1), +(27327, 47212, 8.333, 1, 1, 1, 1), +(27327, 47213, 8.333, 1, 1, 1, 1), +(27327, 47214, 8.333, 1, 1, 1, 1), +(27327, 47217, 8.333, 1, 1, 1, 1), +(27327, 47218, 8.333, 1, 1, 1, 1), +(27327, 47219, 8.333, 1, 1, 1, 1); + +-- http://www.wowhead.com/object=195323#contains:mode=heroic:0+1-15 +-- Heroic (Entry: 195324) +-- Fix rates and groups +UPDATE `gameobject_template` SET `data1`='21417' WHERE entry='195324'; +DELETE FROM `gameobject_loot_template` WHERE (`entry`=21417); +INSERT INTO `gameobject_loot_template` VALUES +(21417, 34057, 1.3, 1, 0, 1, 2), +(21417, 43228, 23, 1, 0, 4, 4), +(21417, 44990, 40, 1, 0, 1, 1), +(21417, 47241, 100, 1, 0, 1, 1), +(21417, 47494, 8.333, 1, 1, 1, 1), +(21417, 47495, 8.333, 1, 1, 1, 1), +(21417, 47496, 8.333, 1, 1, 1, 1), +(21417, 47497, 8.333, 1, 1, 1, 1), +(21417, 47498, 8.333, 1, 1, 1, 1), +(21417, 47522, 8.333, 1, 1, 1, 1), +(21417, 47245, 8.333, 1, 1, 1, 1), +(21417, 47500, 8.333, 1, 1, 1, 1), +(21417, 47510, 8.333, 1, 1, 1, 1), +(21417, 47511, 8.333, 1, 1, 1, 1), +(21417, 47512, 8.333, 1, 1, 1, 1), +(21417, 47514, 8.333, 1, 1, 1, 1); + +-- Eadric's Cache +-- http://www.wowhead.com/object=195374#contains:mode=normal:0+1-15 +-- Normal (entry: 195374) +-- Fix groups and drops +DELETE FROM `gameobject_loot_template` WHERE (`entry`=27325); +INSERT INTO `gameobject_loot_template` VALUES +(27325, 43228, 21, 1, 0, 3, 3), +(27325, 47213, 8.333, 1, 1, 1, 1), +(27325, 47181, 8.333, 1, 1, 1, 1), +(27325, 47201, 8.333, 1, 1, 1, 1), +(27325, 47176, 8.333, 1, 1, 1, 1), +(27325, 47178, 8.333, 1, 1, 1, 1), +(27325, 47197, 8.333, 1, 1, 1, 1), +(27325, 47177, 8.333, 1, 1, 1, 1), +(27325, 47199, 8.333, 1, 1, 1, 1), +(27325, 47202, 8.333, 1, 1, 1, 1), +(27325, 47185, 8.333, 1, 1, 1, 1), +(27325, 47210, 8.333, 1, 1, 1, 1), +(27325, 47200, 8.333, 1, 1, 1, 1); + +-- http://www.wowhead.com/object=195374#contains:mode=heroic:0+1-15 +-- Hero (Entry: 195375) +-- Fix groups and rates +DELETE FROM `gameobject_loot_template` WHERE (`entry`=27416); +INSERT INTO `gameobject_loot_template` VALUES +(27416, 34057, 1.3, 1, 0, 1, 2), +(27416, 43228, 23, 1, 0, 4, 4), +(27416, 44990, 40, 1, 0, 1, 1), +(27416, 47241, 100, 1, 0, 1, 1), +(27416, 47494, 8.333, 1, 1, 1, 1), +(27416, 47495, 8.333, 1, 1, 1, 1), +(27416, 47496, 8.333, 1, 1, 1, 1), +(27416, 47497, 8.333, 1, 1, 1, 1), +(27416, 47498, 8.333, 1, 1, 1, 1), +(27416, 47500, 8.333, 1, 1, 1, 1), +(27416, 47501, 8.333, 1, 1, 1, 1), +(27416, 47502, 8.333, 1, 1, 1, 1), +(27416, 47503, 8.333, 1, 1, 1, 1), +(27416, 47504, 8.333, 1, 1, 1, 1), +(27416, 47508, 8.333, 1, 1, 1, 1), +(27416, 47509, 8.333, 1, 1, 1, 1); + +-- Champion's Cache +-- http://www.wowhead.com/object=195709#contains:mode=normal:0+1-15 +-- Normal (Entry: 195709) +-- Fix rates +DELETE FROM `gameobject_loot_template` WHERE (`entry`=27321); +INSERT INTO `gameobject_loot_template` VALUES +(27321, 43228, 24, 1, 0, 3, 3), +(27321, 47170, 16.666, 1, 1, 1, 1), +(27321, 47174, 16.666, 1, 1, 1, 1), +(27321, 47173, 16.666, 1, 1, 1, 1), +(27321, 47172, 16.666, 1, 1, 1, 1), +(27321, 47171, 16.666, 1, 1, 1, 1), +(27321, 47175, 16.666, 1, 1, 1, 1); + +-- http://www.wowhead.com/object=195709#contains:mode=heroic:0+1-15 +-- (Entry: 195710) +-- Fix rates +DELETE FROM `gameobject_loot_template` WHERE (`entry`=27414); +INSERT INTO `gameobject_loot_template` VALUES +(27414, 43228, 24, 1, 0, 4, 4), +(27414, 44990, 43, 1, 0, 1, 1), +(27414, 47241, 100, 1, 0, 1, 1), +(27414, 34057, 1.3, 1, 0, 1, 1), +(27414, 47243, 16.666, 1, 1, 1, 1), +(27414, 47244, 16.666, 1, 1, 1, 1), +(27414, 47248, 16.666, 1, 1, 1, 1), +(27414, 47249, 16.666, 1, 1, 1, 1), +(27414, 47250, 16.666, 1, 1, 1, 1), +(27414, 47493, 16.666, 1, 1, 1, 1); + + +-- Acceso a la estancia +UPDATE `access_requirement` SET `level_min`=80, `heroic_level_min`=80 WHERE `id`= 5503; \ No newline at end of file diff --git a/sql/wow_ro/TrialOfTheCrusader/trial_of_the_crusader.sql b/sql/wow_ro/TrialOfTheCrusader/trial_of_the_crusader.sql new file mode 100644 index 0000000..5201c86 --- /dev/null +++ b/sql/wow_ro/TrialOfTheCrusader/trial_of_the_crusader.sql @@ -0,0 +1,140 @@ +UPDATE `instance_template` SET `script`='instance_trial_of_the_crussader' WHERE (`map`='649'); + +UPDATE `creature_template` SET `ScriptName`='npc_tcrus_announcer' WHERE (`entry`='34816'); +UPDATE `creature_template` SET `ScriptName`='npc_tcrus_fizzlebang' WHERE (`entry`='35458'); +UPDATE `creature_template` SET `ScriptName`='npc_tcrus_tirion' WHERE (`entry`='34996'); +UPDATE `creature_template` SET `ScriptName`='npc_LichKing' WHERE (`entry`='35877'); +UPDATE `creature_template` SET `ScriptName`='npc_Garrosh' WHERE (`entry`='34995'); +UPDATE `creature_template` SET `ScriptName`='npc_KingVyrn' WHERE (`entry`='34990'); + +-- Faction Champions Horde +UPDATE `creature_template` SET `ScriptName`='boss_gorgrim_shadowcleave' WHERE (`entry`='34458'); +UPDATE `creature_template` SET `ScriptName`='boss_birana_stormhoof' WHERE (`entry`='34451'); +UPDATE `creature_template` SET `ScriptName`='boss_erin_misthoof' WHERE (`entry`='34459'); +UPDATE `creature_template` SET `ScriptName`='boss_rujkah' WHERE (`entry`='34448'); +UPDATE `creature_template` SET `ScriptName`='boss_ginselle_blightslinger' WHERE (`entry`='34449'); +UPDATE `creature_template` SET `ScriptName`='boss_liandra_suncaller' WHERE (`entry`='34445'); +UPDATE `creature_template` SET `ScriptName`='boss_malithas_brightblader' WHERE (`entry`='34456'); +UPDATE `creature_template` SET `ScriptName`='boss_caiphus_the_stern' WHERE (`entry`='34447'); +UPDATE `creature_template` SET `ScriptName`='boss_vivienne_blackwhisper' WHERE (`entry`='34441'); +UPDATE `creature_template` SET `ScriptName`='boss_mazdinah' WHERE (`entry`='34454'); +UPDATE `creature_template` SET `ScriptName`='boss_broln_stouthorn' WHERE (`entry`='34455'); +UPDATE `creature_template` SET `ScriptName`='boss_thrakgar' WHERE (`entry`='34444'); +UPDATE `creature_template` SET `ScriptName`='boss_harkzog' WHERE (`entry`='34450'); +UPDATE `creature_template` SET `ScriptName`='boss_narrhok_steelbreaker' WHERE (`entry`='34453'); + +-- Faction Champions Alliance +UPDATE `creature_template` SET `ScriptName`='boss_tyrius_duskblade' WHERE (`entry`='34461'); +UPDATE `creature_template` SET `ScriptName`='boss_kavina_grovesong' WHERE (`entry`='34460'); +UPDATE `creature_template` SET `ScriptName`='boss_melador_valestrider' WHERE (`entry`='34469'); +UPDATE `creature_template` SET `ScriptName`='boss_alyssia_moonstalker' WHERE (`entry`='34467'); +UPDATE `creature_template` SET `ScriptName`='boss_noozle_whizzlestick' WHERE (`entry`='34468'); +UPDATE `creature_template` SET `ScriptName`='boss_velanaa' WHERE (`entry`='34465'); +UPDATE `creature_template` SET `ScriptName`='boss_baelnor_lightbearer' WHERE (`entry`='34471'); +UPDATE `creature_template` SET `ScriptName`='boss_anthar_forgemender' WHERE (`entry`='34466'); +UPDATE `creature_template` SET `ScriptName`='boss_brienna_nightfell' WHERE (`entry`='34473'); +UPDATE `creature_template` SET `ScriptName`='boss_irieth_shadowstepe' WHERE (`entry`='34472'); +UPDATE `creature_template` SET `ScriptName`='boss_shaabad' WHERE (`entry`='34463'); +UPDATE `creature_template` SET `ScriptName`='boss_saamul' WHERE (`entry`='34470'); +UPDATE `creature_template` SET `ScriptName`='boss_serissa_grimdabbler' WHERE (`entry`='34474'); +UPDATE `creature_template` SET `ScriptName`='boss_shocuul' WHERE (`entry`='34475'); + +-- Spell DBC +INSERT INTO `spelldifficulty_dbc` VALUES ('6000', '66331', '67478', '67477', '67479'); -- Gormok Impale +INSERT INTO `spelldifficulty_dbc` VALUES ('6001', '66330', '67647', '67648', '67649'); -- Gormok Staggering Stomp +INSERT INTO `spelldifficulty_dbc` VALUES ('6002', '66689', '67650', '67651', '67652'); -- Icehowl Artic Breath +INSERT INTO `spelldifficulty_dbc` VALUES ('6003', '66683', '67660', '67660', '67662'); -- Icehowl Massic Crash +INSERT INTO `spelldifficulty_dbc` VALUES ('6004', '67345', '67663', '67663', '67665'); -- Icehowl Whirl +INSERT INTO `spelldifficulty_dbc` VALUES ('6005', '66770', '67655', '67654', '67656'); -- Icehowl Ferocious Butt +INSERT INTO `spelldifficulty_dbc` VALUES ('6006', '66879', '67624', '67625', '67626'); -- Dreadscale Burning Bite +INSERT INTO `spelldifficulty_dbc` VALUES ('6007', '66820', '67636', '67635', '67637'); -- Dreadscale Molten Spew +INSERT INTO `spelldifficulty_dbc` VALUES ('6020', '66237', '67049', '67050', '67051'); -- Jaraxxus Incinerate Flesh +INSERT INTO `spelldifficulty_dbc` VALUES ('6021', '66528', '67029', '67030', '67031'); -- Jaraxxus Fel Lighting +INSERT INTO `spelldifficulty_dbc` VALUES ('6022', '68124', '68126', '68127', '68128'); -- Jaraxxus Legion Flame +INSERT INTO `spelldifficulty_dbc` VALUES ('6023', '66532', '66963', '66964', '66965'); -- Jaraxxus Fel Fireball +INSERT INTO `spelldifficulty_dbc` VALUES ('6024', '66258', '66258', '67903', '67903'); -- Jaraxxus Summon Volcan +INSERT INTO `spelldifficulty_dbc` VALUES ('6025', '67103', '67103', '67104', '67105'); -- Portal Summon Guardian + +UPDATE `creature_template` SET `ScriptName`='Boss_Jaraxxus' WHERE (`entry`='34780'); +UPDATE `creature_template` SET `ScriptName`='Mob_Vulcan' WHERE `entry`=34813; +UPDATE `creature_template` SET `ScriptName`='Mob_FireTrigger' WHERE `entry`=34784; +UPDATE `creature_template` SET `ScriptName`='Mob_Netherportal' WHERE `entry`=34825; +UPDATE `creature_template` SET `scale`='2' WHERE `entry`=34825; +UPDATE `creature_template` SET `ScriptName`='Mob_MistressOfPain' WHERE `entry`=34826; +INSERT INTO `creature_template` VALUES ('41000', '0', '0', '0', '0', '0', '169', '11686', '169', '0', 'Wilfred Portal Trigger', '', '', '0', '1', '1', '0', '14', '14', '0', '1', '1', '0', '1', '2', '0', '0', '1', '2000', '2000', '1', '0', '0', '0', '0', '0', '0', '0', '1', '2', '0', '10', '1049600', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '', '0', '3', '0.0238095', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '2', '', '', '11159'); + +-- Gormok +UPDATE `creature_template` SET `ScriptName`='boss_gormok_impaler' WHERE (`entry`='34796'); +UPDATE `creature_template` SET `scale`='1.5', `faction_A`='16', `faction_H`='16', `ScriptName`='mob_firebomb_trigger' WHERE (`entry`='34854'); + +-- Acidmaw & Dreadscale +UPDATE `creature_template` SET `ScriptName`='boss_acidmaw' WHERE (`entry`='35144'); +UPDATE `creature_template` SET `ScriptName`='boss_dreadscale' WHERE (`entry`='34799'); + +-- IceHowl +UPDATE `creature_template` SET `ScriptName`='boss_icehowl' WHERE (`entry`='34797'); + + +UPDATE `creature_template` SET `AIName`='', `ScriptName`='boss_eydis' WHERE `entry`=34496; +UPDATE `creature_template` SET `AIName`='', `ScriptName`='boss_fjola' WHERE `entry`=34497; +UPDATE `creature_template` SET `AIName`='', `ScriptName`='mob_valkyr_orb' WHERE `entry` IN (34628, 34630); +UPDATE `creature_template` SET unit_flags= 33554434, faction_A =14, faction_H=14 WHERE `entry` IN (34628, 34630); +INSERT INTO `npc_spellclick_spells` VALUES (34567, 65684, 0, 0, 0, 1, 0, 0, 0), (34568, 65686, 0, 0, 0, 1, 0, 0, 0); -- dark/light "portals" +-- INSERT INTO `spell_script_target` VALUES (65875, 1, 34497), (65876, 1, 34496); + +UPDATE `creature_template` SET `ScriptName`='Boss_Raid_Anubarak' WHERE (`entry`='34564'); +UPDATE `creature_template` SET `ScriptName`='Mob_NerubianTrigger' WHERE (`entry`='34862'); +UPDATE `creature_template` SET `ScriptName`='mob_swarm_scarab' WHERE (`entry`='34605'); +UPDATE `creature_template` SET `ScriptName`='nerubian_burrower' WHERE (`entry`='34607'); +UPDATE `creature_template` SET `ScriptName`='frost_sphere' WHERE (`entry`='34606'); +UPDATE `creature_template` SET `ScriptName`='creature_impale' WHERE (`entry`='29184'); + +INSERT INTO `script_texts` VALUES ('0', '-1600205', 'Welcome champions, you have heard the call of the Argent Crusade, and you have boldly answered. It is here, in the Crusader\'s Coliseum, that you will face your greatest challenges. Those of you, who survive the rigors of the coliseum will join the Argent Crusade on it\'s march to Icecrown Citadel.', null, null, 'Willkommen, Champions! Ihr habt den Ruf des Argentumkreuzzugs vernommen und seid ihm mutig gefolgt! Hier, im Kolosseum der Kreuzfahrer, werdet Ihr auf Eure größten Herausforderungen treffen.Die jenigen unter Euch, welche die Gefahren des Kolosseums überleben, werden den Kreuzzug bei seinem Marsch auf die Eiskronenzitadelle begleiten.', null, null, null, null, null, '16036', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600206', 'Hailing from the deepest, darkest carverns of the storm peaks, Gormok the Impaler! Battle on, heroes!', null, null, 'Er kommt aus den tiefsten, dunkelsten Höhlen der Sturmgifpel - Gormok der Pfähler! Voran, Helden!', null, null, null, null, null, '16038', '1', '0', '0', null); +REPLACE INTO `script_texts` VALUES ('0', '-1600207', 'Let the games begin!', '', null, 'Lasst die Spiele beginnen.', null, null, null, null, null, '16037', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600208', ' I have seen more worthy challenges in the ring of blood, you waste our time paladin!', null, null, 'Im Ring des Blutes habe ich würdigere Kämpfer gesehen. Ihr verschwendet unsere Zeit, Paladin!', null, null, null, null, null, '16026', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600209', 'Steel yourselves, heroes, for the twin terrors Acidmaw and Dreadscale. Enter the arena!', null, null, 'Stellt euch Helden, den die Zwillingsschrecken Ätschlund und Schreckensmaul erscheinen in der Arena.', null, null, null, null, null, '16039', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600210', 'The air freezes with the introduction of our next combatant, Icehowl! Kill or be killed, champions!', null, null, 'Mit der Ankündigung unseres nächsten Kämpers gefriert die Luft selbst: Eisheuler! Tötet oder werdet getötet, Champions!', null, null, null, null, null, '16040', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600211', 'Grand Warlock Wilfred Fizzlebang will summon forth your next challenge. Stand by for his entry!', null, null, 'Großhexenmeister Wilfred Zischknall wird Eure nächste Herausforderung beschwören. Harrt seiner Ankunft.', null, null, null, null, null, '16043', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600212', 'Thank you, Highlord! Now challengers, I will begin the ritual of summoning! When I am done, a fearsome Doomguard will appear!', null, null, 'Danke. Hochlord. Nun, Champions, werde ich mit dem Beschwörungsritual beginnen. Sobald es beendet ist, wird eine fürchterliche Verdammniswache erscheinen!', null, null, null, null, null, '16268', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600213', 'Prepare for oblivion!', null, null, 'Bereitet euch auf den Untergang vor!', null, null, null, null, null, '16269', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600214', 'Ah ha! Behold the absolute power of Wilfred Fizzlebang, master summoner! You are bound to ME, demon!', null, null, 'A-HA! Ich hab es vollbracht! Bestaunt die gerenzenlose Macht von Wilfred Zischknall, Meisterbeschwörer! Du bist an mich gebunden, Dämon!', null, null, null, null, null, '16270', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600215', 'Trifling gnome, your arrogance will be your undoing!', null, null, 'Unbedeutener Gnom! Deine Arroganz wird dir zum Verhängnis!', null, null, null, null, null, '16143', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600216', 'But I\'m in charge her-', null, null, 'aber ich hab hier die Kontrolle ahh......', null, null, null, null, null, '16271', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600217', 'Quickly, heroes! Destroy the demon lord before it can open a portal to its twisted demonic realm!', null, null, 'Schnell, Helden, Zerstört den Dämonenlord, bevor er ein Portal zu seiner verzerrten Welt öffnen kann!', null, null, null, null, null, '16044', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600218', 'You face Jaraxxus, eredar lord of the Burning Legion!', null, null, null, null, null, null, null, null, '16144', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600219', 'FLESH FROM BONE!', null, null, null, null, null, null, null, null, '16149', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600220', 'Come forth, sister! Your master calls!', null, null, null, null, null, null, null, null, '16150', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600221', 'INFERNO!', null, null, null, null, null, null, null, null, '16151', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600222', 'Insignificant gnat!', null, null, null, null, null, null, null, null, '16145', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600223', 'Banished to the Nether!', null, null, null, null, null, null, null, null, '16146', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600224', 'Another will take my place. Your world is doomed.', null, null, null, null, null, null, null, null, '16147', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600229', 'The next battle will be against the Argent Crusade\'s most powerful knights! Only by defeating them will you be deemed worthy...', null, null, null, null, null, null, null, null, '0', '1', '0', '0', null); +-- 1600229 - 1600233 Todo Texte +INSERT INTO `script_texts` VALUES ('0', '-1600234', 'The next battle will be against the Argent Crusade\'s most powerful knights! Only by defeating them will you be deemed worthy...', null, null, null, null, null, null, null, null, '16047', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600235', 'Our honor has been besmirched! They make wild claims and false accusations against us. I demand justice! Allow my champions to fight in place of your knights, Tirion. We challenge the Horde!', null, null, null, null, null, null, null, null, '16066', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600236', 'Very well, I will allow it. Fight with honor!', null, null, null, null, null, null, null, null, '16048', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600237', 'Fight for the glory of the Alliance, heroes! Honor your king and your people!', null, null, null, null, null, null, null, null, '16065', '1', '0', '0', null); +-- 1600238 Horde Spawn +INSERT INTO `script_texts` VALUES ('0', '-1600239', 'Only by working together will you overcome the final challenge. From the depths of Icecrown come to of the Scourge\'s most powerful lieutenants: fearsome val\'kyr, winged harbingers of the Lich King!', null, null, null, null, null, null, null, null, '16050', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600240', 'A mighty blow has been dealt to the Lich King! You have proven yourselves able bodied champions of the Argent Crusade. Together we will strike at Icecrown Citadel and destroy what remains of the Scourge! There is no challenge that we cannot face united!', null, null, 'Dem Lichtkönig wurde ein schwerer Schlag versetzt! Ihr habt Euch als würdige Champions erwiesen. Gemeinsam werden wir den Angriff auf die Eiskronenzitadelle durchführen und den Rest der Geißel zerstören! Gemeinsam meistern wir alles!', null, null, null, null, null, '16051', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600241', 'You will have your challenge, Fordring.', null, null, 'Ihr werdet Eure Herausforderung bekommen, Fordring.', null, null, null, null, null, '16321', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600242', 'Arthas! You are hopelessly outnumbered! Lay down Frostmourne and I will grant you a just death.', null, null, 'Arthas! Wir sind Euch zahlenmäßig überlegen! Legt Frostgram nieder und ich werde Euch einen gerechten Tod gewähren.', null, null, null, null, null, '16052', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600243', 'The Nerubians built an empire beneath the frozen wastes of Northrend. An empire that you so foolishly built your structures upon. MY EMPIRE.', null, null, 'Die Neruber erbauten ein Königreich unter den gefrorenen Einöden Nordens. Ein Königreich, auf dem Ihr so töricht Euren Spielplatz aufgebaut habt, AUF MEINEM KÖNIGREICH.', null, null, null, null, null, '16322', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600244', 'The souls of your fallen champions will be mine, Fordring.', null, null, 'Die Seelen Eurer gefallenen Champions werden mir gehören, Fordering.', null, null, null, null, null, '16323', '1', '0', '0', null); +-- 1600245 Anubarak Intro +INSERT INTO `script_texts` VALUES ('0', '-1600246', 'The loss of Wilfred Fizzlebang, while unfortunate, should be a lesson to those that dare dabble in dark magic. Alas, you are victorious and must now face the next challenge. ', null, null, 'Der Verlust von Wilfred Fizzlebang sollte jeden unter euch eine Lehre sein, die es wagen mit den dunklen künsten herumzuspielen. Jedoch ihr seid Siegreich und ihr müsst nun die nächste Herausforderung antreten.', null, null, null, null, null, '16045', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600247', 'Treacherous Alliance dogs! You summon a demon lord against warriors of the Horde!? Your deaths will be swift! ', null, null, 'Hinterhältige Allianz Hunde! Ihr beschwört einen Dämonenlord gegen die Krieger der Horde! Ihr werdet einen schnellen Tot finden.', null, null, null, null, null, '16021', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600248', 'The Alliance doesn\'t need the help of a demon lord to deal with Horde filth. Come, pig! ', null, null, 'Die Allianz braucht keinen Dämon zur unterstützung gegen Hordendreck! Komm her Schwein!', null, null, null, null, null, '16064', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600249', 'Everyone, calm down! Compose yourselves! There is no conspiracy at play here. The warlock acted on his own volition - outside of influences from the Alliance. The tournament must go on! ', null, null, 'Ihr alle beruhigt euch. Hier ist keine Verschwörung ingange der Hexenmeister handelte aus eigenen willen heraus unabhängig von der Allianz! Das Tunier muss weitergehen.', null, null, null, null, null, '16046', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600250', 'A shallow and tragic victory. We are weaker as a whole from the losses suffered today. Who but the Lich King could benefit from such foolishness? Great warriors have lost their lives. And for what? The true threat looms ahead - the Lich King awaits us all in death.', null, null, null, null, null, null, null, null, '16049', '1', '0', '0', null); +-- -1600251 Northrend Beast Wipe +INSERT INTO `script_texts` VALUES ('0', '-1600252', 'In the name of our dark master. For the Lich King. You. Will. Die.', null, null, null, null, null, null, null, null, '16272', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600253', 'CHAOS!', null, null, null, null, null, null, null, null, '16274', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600254', 'The Scourge cannot be stopped...', null, null, null, null, null, null, null, null, '16275', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600255', 'UNWORTHY!', null, null, null, null, null, null, null, null, '16276', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600256', 'You have been measured, and found wanting!', null, null, null, null, null, null, null, null, '16277', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600257', 'Let the dark consume you!', null, null, null, null, null, null, null, null, '16278', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('0', '-1600258', 'Let the light consume you!', null, null, null, null, null, null, null, null, '16279', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('34564', '-1713554', 'Ahhh... Our guests arrived, just as the master promised.', null, null, null, null, null, null, null, null, '16235', '1', '0', '0', null); +INSERT INTO `script_texts` VALUES ('34564', '-1713555', 'This place will serve as your tomb!', null, null, null, null, null, null, null, null, '16234', '1', '0', '0', null); diff --git a/sql/wow_ro/Ulduar/ulduar.sql b/sql/wow_ro/Ulduar/ulduar.sql new file mode 100644 index 0000000..e889167 --- /dev/null +++ b/sql/wow_ro/Ulduar/ulduar.sql @@ -0,0 +1,1392 @@ +-- Some cleanup +UPDATE `creature_template` SET `ScriptName`= '' WHERE `entry` IN (33365,33370,33312,33367,33686,33579,34275,33214); +UPDATE `gameobject_template` SET `ScriptName`= '' WHERE `entry` IN (194375,194371,194370,194377); +DELETE FROM `areatrigger_scripts` WHERE `entry` IN (5369,5423); +DELETE FROM `script_waypoint` WHERE `entry`=33370; + +DELETE FROM areatrigger_scripts WHERE `entry`=4156; +INSERT INTO areatrigger_scripts VALUES (4156,'at_naxxramas_frostwyrm_wing'); + +-- Ulduar for CTDB_012 in base of bllodycore scripts +-- thanks bloodycore +-- 7560_leviathan_crashfix +-- Ulduar crash fixes +UPDATE `instance_template` SET `script`='instance_ulduar' WHERE `map`=603; +UPDATE `creature_template` SET `ScriptName`='boss_auriaya' WHERE `entry`=33515; +UPDATE `creature_template` SET `ScriptName`='boss_flame_leviathan' WHERE `entry`=33113; +UPDATE `creature_template` SET `AIName`='TurretAI',`ScriptName`='' WHERE `entry`=33139; +UPDATE `creature_template` SET `ScriptName`='boss_flame_leviathan_seat' WHERE `entry`=33114; +UPDATE `creature_template` SET `ScriptName`='boss_flame_leviathan_defense_turret' WHERE `entry`=33142; +UPDATE `creature_template` SET `ScriptName`='boss_flame_leviathan_overload_device' WHERE `entry`=33143; +UPDATE `creature_template` SET `ScriptName`='spell_pool_of_tar' WHERE `entry`=33090; +UPDATE `creature_template` SET `ScriptName`='boss_ignis' WHERE `entry`=33118; +UPDATE `creature_template` SET `ScriptName`='boss_razorscale' WHERE `entry`=33186; +UPDATE `creature_template` SET `ScriptName`='boss_xt002' WHERE `entry`=33293; +UPDATE `creature_template` SET `ScriptName`='mob_xt002_heart' WHERE `entry`=33329; +UPDATE `creature_template` SET `ScriptName`='mob_scrapbot' WHERE `entry`=33343; +UPDATE `creature_template` SET `ScriptName`='mob_pummeller' WHERE `entry`=33344; +UPDATE `creature_template` SET `ScriptName`='mob_boombot' WHERE `entry`=33346; +UPDATE `creature_template` SET `ScriptName`='mob_void_zone' WHERE `entry`=34001; +UPDATE `creature_template` SET `ScriptName`='mob_life_spark' WHERE `entry`=34004; +UPDATE `creature_template` SET `ScriptName`='mob_rune_of_summoning' WHERE `entry`=33051; +UPDATE `creature_template` SET `ScriptName`='boss_algalon' WHERE `entry`=32871; +UPDATE `creature_template` SET `ScriptName`='mob_collapsing_star' WHERE `entry`=32955; +UPDATE `gameobject_template` SET `ScriptName`='ulduar_teleporter' WHERE `entry`=194569; +UPDATE `creature_template` SET `spell1`=62402 WHERE `entry`=33142; +UPDATE `creature_template` SET `spell1`=62402 WHERE `entry`=33139; +UPDATE `creature_template` SET `spell1`=62402 WHERE `entry`=34111; +UPDATE `creature_template` SET `spell1`=62402 WHERE `entry`=34224; + +-- Leviathan Torret 33139 +UPDATE `creature_template` SET `minlevel`=80,`maxlevel`=83,`exp`=2,`unit_class`=1 WHERE `entry` IN (33139, 34111); +-- Leviathan Torret 33142 +UPDATE `creature_template` SET `minlevel`=80,`maxlevel`=83,`exp`=2,`unit_class`=1 WHERE `entry` IN (33142); + +-- 7770_ignis_vehicleid +UPDATE `creature_template` SET `vehicleId` = 318 WHERE `entry` = 33118; + +-- 7792 +DELETE FROM `creature_template` WHERE `entry` IN (33119); +INSERT INTO `creature_template` VALUES +('33119','0','0','0','0','0','13069','0','0','0','Scorch trigger','',NULL,'0','83','83','2','16','16','0','2','2','85','3','0','0','0','0','0','0','0','8','34340934','0','0','0','0','0','0','0','0','0','7','0','0','0','0','0','0','0','0','0','0','62548','0','0','0','0','0','0','0','0','0','1305000','1595000','EventAI','0','3','310','30','1','0','0','0','0','0','0','0','169','1','0','617299803','1','trigger_periodic','0'); + +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33119); +INSERT INTO `creature_ai_scripts` VALUES +( 10033119, 33119, 0, 0, 100, 3, 1000, 1000, 1000, 1000, 11, 62548, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Scorch Ground'); + +UPDATE `creature_template` SET `faction_A` = 35, `faction_H` = 35, `unit_flags` = 33554434, `ScriptName` = 'mob_iron_construct', `flags_extra` = 0 WHERE `entry` = 33121; + +-- 7796_xt002_vehicleid +UPDATE `creature_template` SET `vehicleId` = 332 WHERE `entry` = 33293; + +-- 7930_leviathan_trigger +DELETE FROM `creature_template` WHERE `entry` IN (33115); +INSERT INTO `creature_template` VALUES +('33115','0','0','0','0','0','13069','0','0','0','Leviathan trigger','',NULL,'0','83','83','2','16','16','0','2','2','1','3','0','0','0','0','0','0','0','8','34340934','0','0','0','0','0','0','0','0','0','7','0','0','0','0','0','0','0','0','0','0','62548','0','0','0','0','0','0','0','0','0','1305000','1595000','','0','3','310','30','1','0','0','0','0','0','0','0','169','1','0','617299803','1','flame_leviathan_trigger','0'); + +DELETE FROM creature WHERE `id` IN (33115, 33060, 33062, 33109); +INSERT INTO `creature` (`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES (33115,603,1,1,0,0,-784.969,-135.608,429.774,0.351076,480000,0,0,3458360,279750,0,0); + +-- 8042_boss_leviathan +DELETE FROM `creature_template` WHERE `entry` IN (33240); +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES('33240','33240','0','0','0','0','28517','0','0','0','Ulduar Colossus','','','0','80','80','2','1692','1692','0','1.2','1.14286','1','1','422','586','0','642','7.5','2000','0','1','32832','0','0','0','0','0','0','345','509','103','5','524352','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','125','1','1','0','0','0','0','0','0','0','124','1','0','0','0','mob_colossus','11403'); +-- ubicaciĂłn Leviathan +DELETE FROM `creature` WHERE `id`=33113; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(94374, 33113, 603, 1, 1, 0, 0, 435.89, -8.417, 409.886, 3.12723, 480000, 0, 0, 23009250, 0, 0, 0); +-- Refuerzo orbital +UPDATE `creature_template` SET `unit_flags` = 33685510, `type_flags` = 0 WHERE `entry` = 34286; + +-- 8047_ignis_scorchground +DELETE FROM `creature_template` WHERE `entry` IN (33119); +INSERT INTO `creature_template` VALUES +('33119','0','0','0','0','0','13069','0','0','0','Scorch trigger','','','0','80','80','2','16','16','0','1','1.14286','85','1','0','0','0','0','1','2000','0','1','0','0','0','0','0','0','0','0','0','0','4','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','4','1','1','0','0','0','0','0','0','0','94','1','0','0','0','mob_scorch_ground','11159'); + +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33119); + +-- 8086_razorscale_event +UPDATE `creature_template` SET `ScriptName` = 'mob_darkrune_watcher' WHERE `entry` = 33453; +UPDATE `creature_template` SET `ScriptName` = 'mob_darkrune_sentinel' WHERE `entry` = 33846; +UPDATE `creature_template` SET `ScriptName` = 'mob_darkrune_guardian' WHERE `entry` = 33388; +UPDATE `creature_template` SET `ScriptName` = 'mob_devouring_flame' WHERE `entry` = 34188; +UPDATE `creature_template` SET `ScriptName` = 'npc_expedition_commander_ulduar' WHERE `entry` = 33210; +UPDATE `creature_template` SET `ScriptName` = 'mole_machine_trigger' WHERE `entry` = 33282; +UPDATE `creature_template` SET `unit_flags` = 33685506 WHERE `entry` IN (33245,33233); +DELETE FROM `creature` WHERE `id`=33186; + +-- 8093_razorscale_triggers +DELETE FROM `creature` WHERE `id`=33282; +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` IN (33233,33259); + +-- 8098_kologarn_event +DELETE FROM `creature` WHERE `id` IN (33632, 33802); +UPDATE `creature_template` SET `unit_flags` = 33685510 WHERE `entry` = 33809; +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` = 33661; +UPDATE `creature_template` SET `faction_A` = 16, `faction_H` = 16, `ScriptName` = 'mob_focused_eyebeam' WHERE `entry` IN (33632, 33802); +UPDATE `creature_template` SET `ScriptName` = 'mob_left_arm' WHERE `entry` = 32933; +UPDATE `creature_template` SET `ScriptName` = 'mob_right_arm' WHERE `entry` = 32934; + +/* +-- 8117_ignis_heat +DELETE FROM spell_script_target WHERE entry = 62343; +INSERT INTO spell_script_target VALUES (62343, 1, 33121); +*/ +UPDATE `creature_template` SET `unit_flags` = 33947654 WHERE `entry` = 33121; + +-- 8119_assembly_iron +UPDATE `creature_template` SET `ScriptName` = 'boss_steelbreaker' WHERE `entry` = 32867; +UPDATE `creature_template` SET `ScriptName` = 'boss_runemaster_molgeim' WHERE `entry` = 32927; +UPDATE `creature_template` SET `ScriptName` = 'boss_stormcaller_brundir' WHERE `entry` = 32857; + +UPDATE `creature_template` SET `faction_A` = 16, `faction_H` = 16 WHERE `entry` IN (33051, 33691, 33689); +UPDATE creature_template SET faction_A=16, faction_H=16, scriptname='mob_rune_of_power' WHERE entry = 33705; +UPDATE creature_template SET faction_A=16, faction_H=16, scriptname='mob_lightning_elemental', difficulty_entry_1 = 33689 WHERE entry = 32958; + +-- 8124_auriaya_event +DELETE FROM `creature` WHERE id = 34014; +UPDATE `creature_template` SET `unit_flags` = 0, `type_flags` = 0 WHERE `entry` = 33515; +UPDATE `creature_template` SET `equipment_id` = 2500 WHERE `entry` = 33515; + +UPDATE `creature_template` SET `faction_A` = 16, `faction_H` = 16, `ScriptName` = 'feral_defender_trigger' WHERE `entry` = 34096; +UPDATE `creature_template` SET `ScriptName` = 'mob_feral_defender' WHERE `entry` = 34035; +UPDATE `creature_template` SET `ScriptName` = 'mob_sanctum_sentry' WHERE `entry` = 34014; +UPDATE `creature_template` SET `ScriptName` = 'seeping_trigger' WHERE `entry` = 34098; + +DELETE FROM `creature_equip_template` WHERE entry = 2500; +INSERT INTO `creature_equip_template` VALUES ('2500','45315','0','0'); + +DELETE FROM `creature_addon` WHERE guid = 137496; +INSERT INTO `creature_addon` VALUES ('137496','1033515','0','0','0','0','0'); + +DELETE FROM `waypoint_data` WHERE id = 1033515; +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `delay`, `move_flag`, `action`, `action_chance`, `wpguid`) VALUES +('1033515','1','1968.46','51.75','417.72','0','0','0','100','0'), +('1033515','2','1956.75','49.22','411.35','0','0','0','100','0'), +('1033515','3','1938.90','42.09','411.35','3000','0','0','100','0'), +('1033515','4','1956.75','49.22','411.35','0','0','0','100','0'), +('1033515','5','1968.46','51.75','417.72','0','0','0','100','0'), +('1033515','6','2011.43','44.91','417.72','0','0','0','100','0'), +('1033515','7','2022.65','37.74','411.36','0','0','0','100','0'), +('1033515','8','2046.65','9.61','411.36','0','0','0','100','0'), +('1033515','9','2053.4','-8.65','421.68','0','0','0','100','0'), +('1033515','10','2053.14','-39.8','421.66','0','0','0','100','0'), +('1033515','11','2046.26','-57.96','411.35','0','0','0','100','0'), +('1033515','12','2022.42','-86.39','411.35','0','0','0','100','0'), +('1033515','13','2011.26','-92.95','417.71','0','0','0','100','0'), +('1033515','14','1969.43','-100.02','417.72','0','0','0','100','0'), +('1033515','15','1956.66','-97.4','411.35','0','0','0','100','0'), +('1033515','16','1939.18','-90.90','411.35','3000','0','0','100','0'), +('1033515','17','1956.66','-97.4','411.35','0','0','0','100','0'), +('1033515','18','1969.43','-100.02','417.72','0','0','0','100','0'), +('1033515','19','2011.26','-92.95','417.71','0','0','0','100','0'), +('1033515','20','2022.42','-86.39','411.35','0','0','0','100','0'), +('1033515','21','2046.26','-57.96','411.35','0','0','0','100','0'), +('1033515','22','2053.14','-39.8','421.66','0','0','0','100','0'), +('1033515','23','2053.4','-8.65','421.68','0','0','0','100','0'), +('1033515','24','2046.65','9.61','411.36','0','0','0','100','0'), +('1033515','25','2022.65','37.74','411.36','0','0','0','100','0'), +('1033515','26','2011.43','44.91','417.72','0','0','0','100','0'); + +-- 9130_auriaya_fix +UPDATE `creature` SET `MovementType` = 2 WHERE `id` = 33515; + +-- 8137_leviathan_vehiclesystem +UPDATE `creature_template` SET `unit_flags` = 0, `ScriptName` = 'npc_keeper_norgannon' WHERE `entry` = 33686; +DELETE FROM `creature_template` WHERE `entry`=33115; +DELETE FROM creature WHERE `id`=33115; + +-- 8148_boss_hodir +UPDATE `creature_template` SET `unit_flags` = 0, `type_flags` = 0, `ScriptName` = 'boss_hodir' WHERE `entry` = 32845; + +UPDATE `creature_template` SET `modelid1` = 11686, `modelid2` = 0 WHERE `entry` IN (34188, 33632, 33802, 34096, 34098); +UPDATE `creature_template` SET `modelid1` = 25865, `modelid2` = 0, `flags_extra` = 0, `ScriptName` = 'mob_flash_freeze' WHERE `entry` = 32938; +UPDATE `creature_template` SET `modelid1` = 28470, `modelid2` = 0, `ScriptName` = 'mob_icicle' WHERE `entry` = 33169; +UPDATE `creature_template` SET `modelid1` = 28470, `modelid2` = 0, `ScriptName` = 'mob_icicle_snowdrift' WHERE `entry` = 33173; +UPDATE `creature_template` SET `modelid1` = 15880, `modelid2` = 0 WHERE `entry` = 33174; +UPDATE `gameobject_template` SET `flags` = 4 WHERE `entry` = 194173; + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 61990; +INSERT INTO `spell_linked_spell` VALUES +(61990, -62457, 2, "Ice Shards Immunity (Hodir)"), +(61990, -65370, 2, "Ice Shards Immunity (Hodir)"); + +UPDATE `creature_template` SET `unit_flags` = 33817094 WHERE `entry` = 33174; +UPDATE `creature_template` SET `mechanic_immune_mask` = 612581215 WHERE `entry` = 32938; +UPDATE `creature_template` SET `unit_flags` = 0 WHERE `entry` = 32941; +UPDATE `creature_template` SET `unit_flags` = 33686016, `flags_extra` = 2 WHERE `entry` = 30298; + +DELETE FROM `creature` WHERE `id` = 32938; + +-- 8153_razorscale_event +DELETE FROM `creature` WHERE `id`=33186; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(94373, 33186, 603, 1, 1, 0, 0, 587.073, -203.205, 441.237, 1.60532, 604800, 0, 0, 3555975, 0, 0, 0); + +UPDATE `creature_template` SET `unit_flags` = 33554438 WHERE `entry` = 33184; + +-- 8155_hodir_npcs +UPDATE `creature_template` SET `unit_flags` = 393220, `ScriptName` = '' WHERE `entry` = 32938; +UPDATE `creature_template` SET `unit_flags` = 33948166 WHERE `entry` = 33174; + +DELETE FROM `creature` WHERE `id` IN (32941, 33333, 33332, 32950, 33331, 32946, 32948, 33330); + +UPDATE `creature_template` SET `faction_A` = 1665, `faction_H` = 1665, `unit_flags` = 32768 WHERE `entry` IN (33325, 32901, 33328, 32901, 32893, 33327, 32897, 33326, 32941, 33333, 33332, 32950, 33331, 32946, 32948, 33330); +UPDATE `creature_template` SET `ScriptName` = 'mob_hodir_priest' WHERE `entry` IN (32897, 33326, 32948, 33330); +UPDATE `creature_template` SET `ScriptName` = 'mob_hodir_shaman' WHERE `entry` IN (33328, 32901, 33332, 32950); +UPDATE `creature_template` SET `ScriptName` = 'mob_hodir_druid' WHERE `entry` IN (33325, 32900, 32941, 33333); +UPDATE `creature_template` SET `ScriptName` = 'mob_hodir_mage' WHERE `entry` IN (32893, 33327, 33331, 32946); +UPDATE `creature_template` SET `modelid1` = 15880, `modelid2` = 0, `ScriptName` = 'toasty_fire' WHERE `entry` = 33342; + +-- 8164_ulduar_immunities +UPDATE `creature_template` SET `mechanic_immune_mask` = 650854235 WHERE `entry` IN (33113, 33118, 33186, 33293, 32867, 32927, 32930, 33515, 32906, 32845, 33350, 32865, 33271, 33288, 32871); +UPDATE `creature_template` SET `mechanic_immune_mask` = 617299547 WHERE `entry` = 32857; + +UPDATE `script_texts` SET `content_default` = "Welcome, champions! All of our attempts at grounding her have failed. We could use a hand in bring her down with these harpoon guns.", `type` = 0 WHERE `entry` = -1603260; +UPDATE `script_texts` SET `content_default` = "Move! Quickly! She won’t remain grounded for long.", `type` = 1 WHERE `entry` = -1603261; +UPDATE `script_texts` SET `type` = 2 WHERE `entry` = -1603053; +UPDATE `script_texts` SET `type` = 2 WHERE `entry` = -1603214; + +-- 8166_hodir_flashfreeze +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (61990, -61990); +INSERT INTO `spell_linked_spell` VALUES +(61990, 7940, 2, "Hodir Flash Freeze immunity"); + +-- 8172_freya_elders +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_brightleaf' WHERE `entry` =32915; +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_ironbranch' WHERE `entry` =32913; +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_stonebark' WHERE `entry` =32914; +UPDATE `creature_template` SET `ScriptName` = 'creature_sun_beam', `unit_flags` = 33685510, `modelid1` = 11686, `modelid2` = 0 WHERE `entry` =33170; +UPDATE `creature_template` SET `faction_A` = 16, `faction_H` = 16, `unit_flags` = 393220, `ScriptName` = 'creature_iron_roots' WHERE `entry` = 33168; + +DELETE FROM `spell_linked_spell` WHERE `spell_effect` = -62243; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(62217, -62243, 1, 'cancels the effects of Unstable Sun Beam'), +(62922, -62243, 1, 'cancels the effects of Unstable Sun Beam'); + +-- 8178_boss_freya +UPDATE `creature_template` SET `ScriptName` = 'boss_freya' WHERE `entry` =32906; +UPDATE `creature_template` SET `unit_flags` = 393220, `ScriptName` = 'creature_eonars_gift' WHERE `entry` =33228; +UPDATE `creature_template` SET `modelid1` = 11686, `modelid2` = 0, `unit_flags` = 33685508, `ScriptName` = 'creature_nature_bomb' WHERE `entry` =34129; +UPDATE `creature_template` SET `unit_class` = 2, `ScriptName` = 'creature_detonating_lasher' WHERE `entry` =32918; +UPDATE `creature_template` SET `ScriptName` = 'creature_ancient_conservator' WHERE `entry` =33203; +UPDATE `creature_template` SET `unit_flags` = 33686022, `ScriptName` = 'creature_healthy_spore' WHERE `entry` =33215; +UPDATE `creature_template` SET `ScriptName` = 'creature_storm_lasher' WHERE `entry` =32919; +UPDATE `creature_template` SET `ScriptName` = 'creature_snaplasher' WHERE `entry` =32916; +UPDATE `creature_template` SET `ScriptName` = 'creature_ancient_water_spirit' WHERE `entry` =33202; + +DELETE FROM `creature` WHERE `guid` = 136607; + +DELETE FROM `spell_linked_spell` WHERE `spell_effect` = -62532; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(64321, -62532, 1, 'Potent Pheromones ward off the Conservator''s Grip'), +(62619, -62532, 1, 'Pheromones ward off the Conservator''s Grip'); + +-- 8195_freya_event +UPDATE `creature_template` SET `modelid1` = 11686, `modelid2` = 0, `unit_flags` = 33686022, `ScriptName` = 'creature_unstable_sun_beam' WHERE `entry` = 33050; + +-- 8199_ulduar_cleanup +DELETE FROM `gameobject` WHERE `id` = '194905'; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES +('270000','194905','603','1','1','401.308','-13.8236','409.524','3.14159','0','0','0','1','180','255','0'); + +UPDATE `creature_template` SET `speed_walk` = 0.5 WHERE `entry` = 33113; +UPDATE `creature_template` SET `unit_flags` = 0, `type_flags` = 8, `ScriptName` = 'boss_thorim' WHERE `entry` = 32865; + +-- 8228_ignis_scorch +UPDATE `creature_template` SET `modelid1` = 16925, `modelid2` = 0, `ScriptName` = 'mob_scorch_ground' WHERE `entry` = 33221; +DELETE FROM `creature_template` WHERE `entry` = 33119; + +-- 8241_thorim_gate +DELETE FROM `gameobject_scripts` WHERE `id`=55194; +INSERT INTO `gameobject_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES +(55194, 0, 11, 34155, 15, '0', 0, 0, 0, 0); + +UPDATE `gameobject` SET `id` = 101855, `rotation2` = 1, `rotation3` = 0, `spawntimesecs` = 7200, `animprogress` = 100 WHERE `guid` = 55194; + +-- 8252_boss_thorim +UPDATE `creature_template` SET `faction_A` = 14, `faction_H` = 14, `ScriptName` = 'mob_pre_phase' WHERE `entry` IN (32882, 32908, 32885, 33110); +UPDATE `creature_template` SET `unit_flags` = 0, `faction_A` = 14, `faction_H` = 14, `ScriptName` = 'mob_arena_phase' WHERE `entry` IN (32876, 32904, 32878, 32877, 32874, 32875); + +UPDATE `creature` SET `spawndist` = 0 WHERE `id` = 32865; +UPDATE `creature` SET `position_x` = 2135.078, `position_y` = -298.758, `orientation` = 1.61 WHERE `id` = 32865; + +DELETE FROM `creature` WHERE `id` IN (32882, 32908, 32885, 32879, 33140, 33141); + +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` IN (32892, 32879, 32780, 33140, 33141); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=62042; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +('62042','62470','1','Thorim: Deafening Thunder'); + +UPDATE `creature_template` SET `unit_flags` = 33686020 WHERE `entry` = 33378; + +DELETE FROM `creature` WHERE `id` IN (33378, 32892); +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(131835, 33378, 603, 1, 1, 16925, 0, 2104.99, -233.484, 433.573, 5.49779, 604800, 0, 0, 12600, 0, 0, 1), +(131836, 33378, 603, 1, 1, 16925, 0, 2092.64, -262.594, 433.576, 6.26573, 604800, 0, 0, 12600, 0, 0, 1), +(131837, 33378, 603, 1, 1, 16925, 0, 2104.76, -292.719, 433.181, 0.785398, 604800, 0, 0, 12600, 0, 0, 1), +(131839, 33378, 603, 1, 1, 16925, 0, 2164.97, -293.375, 433.526, 2.35619, 604800, 0, 0, 12600, 0, 0, 1), +(131840, 33378, 603, 1, 1, 16925, 0, 2164.58, -233.333, 433.892, 3.90954, 604800, 0, 0, 12600, 0, 0, 1), +(131841, 33378, 603, 1, 1, 16925, 0, 2145.8, -222.196, 433.293, 4.45059, 604800, 0, 0, 12600, 0, 0, 1), +(131842, 33378, 603, 1, 1, 16925, 0, 2123.91, -222.443, 433.375, 4.97419, 604800, 0, 0, 12600, 0, 0, 1); + +/* +DELETE FROM `spell_script_target` WHERE `entry`=62016; +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES('62016','1','33378'); +*/ +UPDATE `creature_template` SET `unit_flags` = 0, `ScriptName` = 'mob_runic_colossus' WHERE `entry` = 32872; +UPDATE `creature_template` SET `unit_flags` = 0, `ScriptName` = 'mob_rune_giant' WHERE `entry` = 32873; +UPDATE `creature_template` SET `modelid1` = 16925, `modelid2` = 0, `ScriptName` = 'thorim_trap_bunny' WHERE `entry` IN (33725, 33282); +UPDATE `creature_template` SET `flags_extra` = 0, `ScriptName` = 'thorim_energy_source' WHERE `entry` = 32892; +UPDATE `creature_template` SET `ScriptName` = 'boss_thorim' WHERE `entry` = 32865; + +-- 8262_thorim_event +DELETE FROM `creature` WHERE `id` IN (33378, 32892); +UPDATE `creature_template` SET `modelid1` = 16925, `modelid2` = 0 WHERE `entry`IN (33378, 32892); + +DELETE FROM `creature` WHERE `id` IN (32922, 32923, 32925); +SET @GUID := 200400; +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `DeathState`, `MovementType`) values +(@GUID,32922,603,1,1,25984,0,2110.24,-213.923,436.857,5.16617,604800,0,0,80886,0,0,0), +(@GUID+1,32922,603,1,1,25984,0,2095.97,-213.634,445.036,5.37561,604800,0,0,80886,0,0,0), +(@GUID+2,32922,603,1,1,25984,0,2076.95,-244.528,442.998,5.96903,604800,0,0,80886,0,0,0), +(@GUID+3,32922,603,1,1,25984,0,2077.98,-272.724,438.925,0.191986,604800,0,0,80886,0,0,0), +(@GUID+4,32922,603,1,1,25984,0,2087.4,-301.326,443.005,0.698132,604800,0,0,80886,0,0,0), +(@GUID+5,32922,603,1,1,25984,0,2091.17,-286.804,430.781,0.523599,604800,0,0,80886,0,0,0), +(@GUID+6,32922,603,1,1,25984,0,2177.83,-295.005,434.846,2.35619,604800,0,0,80886,0,0,0), +(@GUID+7,32922,603,1,1,25984,0,2189.87,-278.583,438.928,2.87979,604800,0,0,80886,0,0,0), +(@GUID+8,32922,603,1,1,25984,0,2197.19,-256.436,445.037,3.24631,604800,0,0,80886,0,0,0), +(@GUID+9,32922,603,1,1,25984,0,2185.87,-254.436,432.798,3.29867,604800,0,0,80886,0,0,0), +(@GUID+10,32922,603,1,1,25984,0,2179.62,-227.25,442.009,3.89208,604800,0,0,80886,0,0,0), +(@GUID+11,32922,603,1,1,25984,0,2161.18,-218.451,432.811,4.17134,604800,0,0,80886,0,0,0), +(@GUID+12,32923,603,1,1,28580,0,2193.75,-292.545,449.069,3.21141,180,0,0,18900,0,0,0), +(@GUID+13,32923,603,1,1,28580,0,2178.55,-286.8,430.795,2.51327,180,0,0,18900,0,0,0), +(@GUID+14,32923,603,1,1,28580,0,2178.61,-299.455,438.917,2.30383,180,0,0,18900,0,0,0), +(@GUID+15,32923,603,1,1,28580,0,2186.39,-292.184,440.98,2.51327,180,0,0,18900,0,0,0), +(@GUID+16,32923,603,1,1,28580,0,2184.1,-304.141,447.037,2.32129,180,0,0,18900,0,0,0), +(@GUID+17,32923,603,1,1,28580,0,2185.45,-274.37,432.804,2.93215,180,0,0,18900,0,0,0), +(@GUID+18,32923,603,1,1,28580,0,2189.09,-274.368,436.838,2.94961,180,0,0,18900,0,0,0), +(@GUID+19,32923,603,1,1,28580,0,2193.43,-266.823,440.96,3.08923,180,0,0,18900,0,0,0), +(@GUID+20,32923,603,1,1,28580,0,2192.18,-282.637,442.998,2.82743,180,0,0,18900,0,0,0), +(@GUID+21,32923,603,1,1,28580,0,2199.59,-279.142,449.1,2.9147,180,0,0,18900,0,0,0), +(@GUID+22,32923,603,1,1,28580,0,2199.07,-267.828,447.077,3.07178,180,0,0,18900,0,0,0), +(@GUID+23,32923,603,1,1,28580,0,2184.24,-269.38,430.788,3.01942,180,0,0,18900,0,0,0), +(@GUID+24,32923,603,1,1,28580,0,2185.79,-278.182,434.833,2.86234,180,0,0,18900,0,0,0), +(@GUID+25,32923,603,1,1,28580,0,2191.54,-269.729,438.919,3.03687,180,0,0,18900,0,0,0), +(@GUID+26,32923,603,1,1,28580,0,2194.43,-276.351,442.961,2.93215,180,0,0,18900,0,0,0), +(@GUID+27,32923,603,1,1,28580,0,2196.2,-281.951,447.042,2.86234,180,0,0,18900,0,0,0), +(@GUID+28,32923,603,1,1,28580,0,2200.95,-267.306,449.114,3.08923,180,0,0,18900,0,0,0), +(@GUID+29,32923,603,1,1,28580,0,2181.97,-248.535,430.753,3.4383,180,0,0,18900,0,0,0), +(@GUID+30,32923,603,1,1,28580,0,2185.63,-247.405,434.837,3.4383,180,0,0,18900,0,0,0), +(@GUID+31,32923,603,1,1,28580,0,2189.51,-258.295,436.863,3.22886,180,0,0,18900,0,0,0), +(@GUID+32,32923,603,1,1,28580,0,2200.71,-251.84,449.088,3.29867,180,0,0,18900,0,0,0), +(@GUID+33,32923,603,1,1,28580,0,2194.08,-243.276,445.031,3.45575,180,0,0,18900,0,0,0), +(@GUID+34,32923,603,1,1,28580,0,2195.15,-251.153,442.98,3.33358,180,0,0,18900,0,0,0), +(@GUID+35,32923,603,1,1,28580,0,2178.26,-234.068,439.581,3.49066,180,0,0,18900,0,0,0), +(@GUID+36,32923,603,1,1,28580,0,2181.94,-238.58,434.834,3.61283,180,0,0,18900,0,0,0), +(@GUID+37,32923,603,1,1,28580,0,2182.5,-234.925,445.771,3.66519,180,0,0,18900,0,0,0), +(@GUID+38,32923,603,1,1,28580,0,2187.5,-232.918,456.92,3.38594,180,0,0,18900,0,0,0), +(@GUID+39,32923,603,1,1,28580,0,2184.62,-222.366,457.92,4.2237,180,0,0,18900,0,0,0), +(@GUID+40,32923,603,1,1,28580,0,2191.95,-229.319,468.174,3.54302,180,0,0,18900,0,0,0), +(@GUID+41,32923,603,1,1,28580,0,2161.32,-222.722,428.718,4.24115,180,0,0,18900,0,0,0), +(@GUID+42,32923,603,1,1,28580,0,2165.7,-216.552,437.482,4.11898,180,0,0,18900,0,0,0), +(@GUID+43,32923,603,1,1,28580,0,2172.48,-215.681,446.296,4.03171,180,0,0,18900,0,0,0), +(@GUID+44,32923,603,1,1,28580,0,2170.81,-208.646,447.254,4.11898,180,0,0,18900,0,0,0), +(@GUID+45,32923,603,1,1,28580,0,2164.44,-204.417,449.036,4.2237,180,0,0,18900,0,0,0), +(@GUID+46,32923,603,1,1,28580,0,2109.83,-216.211,434.81,5.20108,180,0,0,18900,0,0,0), +(@GUID+47,32923,603,1,1,28580,0,2100.14,-217.783,438.879,5.35816,180,0,0,18900,0,0,0), +(@GUID+48,32923,603,1,1,28580,0,2101.65,-211.524,442.959,5.2709,180,0,0,18900,0,0,0), +(@GUID+49,32923,603,1,1,28580,0,2105.1,-204.009,449.074,5.16617,180,0,0,18900,0,0,0), +(@GUID+50,32923,603,1,1,28580,0,2105.72,-213.887,438.883,5.23599,180,0,0,18900,0,0,0), +(@GUID+51,32923,603,1,1,28580,0,2093.1,-235.128,430.762,5.70723,180,0,0,18900,0,0,0), +(@GUID+52,32923,603,1,1,28580,0,2086.43,-236.845,436.861,5.79449,180,0,0,18900,0,0,0), +(@GUID+53,32923,603,1,1,28580,0,2090.16,-227.646,438.9,5.61996,180,0,0,18900,0,0,0), +(@GUID+54,32923,603,1,1,28580,0,2083.78,-233.255,440.947,5.75959,180,0,0,18900,0,0,0), +(@GUID+55,32923,603,1,1,28580,0,2082.41,-227.753,444.991,5.68977,180,0,0,18900,0,0,0), +(@GUID+56,32923,603,1,1,28580,0,2083.46,-220.87,449.11,5.32325,180,0,0,18900,0,0,0), +(@GUID+57,32923,603,1,1,28580,0,2085.77,-278.108,432.796,0.314159,180,0,0,18900,0,0,0), +(@GUID+58,32923,603,1,1,28580,0,2082.43,-279.181,436.843,0.314159,180,0,0,18900,0,0,0), +(@GUID+59,32923,603,1,1,28580,0,2080.09,-268.561,436.861,0.122173,180,0,0,18900,0,0,0), +(@GUID+60,32923,603,1,1,28580,0,2076.67,-281.238,443.013,0.314159,180,0,0,18900,0,0,0), +(@GUID+61,32923,603,1,1,28580,0,2070.95,-275.786,447.029,0.314159,180,0,0,18900,0,0,0), +(@GUID+62,32923,603,1,1,28580,0,2073.01,-269.083,444.984,0.10472,180,0,0,18900,0,0,0), +(@GUID+63,32923,603,1,1,28580,0,2085.04,-249.688,432.797,6.02139,180,0,0,18900,0,0,0), +(@GUID+64,32923,603,1,1,28580,0,2081.76,-248.184,436.858,6.00393,180,0,0,18900,0,0,0), +(@GUID+65,32923,603,1,1,28580,0,2076.05,-253.313,440.97,6.10865,180,0,0,18900,0,0,0), +(@GUID+66,32923,603,1,1,28580,0,2072.73,-250.245,445.018,6.07375,180,0,0,18900,0,0,0), +(@GUID+67,32923,603,1,1,28580,0,2071.74,-242.53,449.109,5.98648,180,0,0,18900,0,0,0), +(@GUID+68,32923,603,1,1,28580,0,2086.54,-289.927,436.879,0.523599,180,0,0,18900,0,0,0), +(@GUID+69,32923,603,1,1,28580,0,2096.15,-293.986,430.76,0.698132,180,0,0,18900,0,0,0), +(@GUID+70,32923,603,1,1,28580,0,2090.54,-299.068,438.92,0.698132,180,0,0,18900,0,0,0), +(@GUID+71,32923,603,1,1,28580,0,2082.36,-289.917,440.969,0.488692,180,0,0,18900,0,0,0), +(@GUID+72,32923,603,1,1,28580,0,2091.47,-291.981,432.8,0.610865,180,0,0,18900,0,0,0), +(@GUID+73,32923,603,1,1,28580,0,2081.7,-300.628,447.058,0.628319,180,0,0,18900,0,0,0), +(@GUID+74,32925,603,1,1,28581,0,2187.69,-270.488,434.832,3.01942,604800,0,0,40443,4169,0,0), +(@GUID+75,32925,603,1,1,28581,0,2193.33,-257.943,440.949,3.22886,604800,0,0,40443,4169,0,0), +(@GUID+76,32925,603,1,1,28581,0,2191.72,-247.573,440.946,3.40339,604800,0,0,40443,4169,0,0), +(@GUID+77,32925,603,1,1,28581,0,2181.61,-224.316,447.512,3.82227,604800,0,0,40443,4169,0,0), +(@GUID+78,32925,603,1,1,28581,0,2178.52,-240.156,430.756,3.61283,604800,0,0,40443,4169,0,0), +(@GUID+79,32925,603,1,1,28581,0,2162.94,-207.222,445.019,4.24115,604800,0,0,40443,4169,0,0), +(@GUID+80,32925,603,1,1,28581,0,2169.97,-218.059,441.236,4.03171,604800,0,0,40443,4169,0,0), +(@GUID+81,32925,603,1,1,28581,0,2108.07,-208.596,442.986,5.16617,604800,0,0,40443,4169,0,0), +(@GUID+82,32925,603,1,1,28581,0,2102.01,-220.66,434.848,5.35816,604800,0,0,40443,4169,0,0), +(@GUID+83,32925,603,1,1,28581,0,2077.76,-232.818,447.073,5.79449,604800,0,0,40443,4169,0,0), +(@GUID+84,32925,603,1,1,28581,0,2089.41,-225.486,440.96,5.67232,604800,0,0,40443,4169,0,0), +(@GUID+85,32925,603,1,1,28581,0,2089.53,-238.313,432.82,5.79449,604800,0,0,40443,4169,0,0), +(@GUID+86,32925,603,1,1,28581,0,2079.95,-256.325,436.876,6.16101,604800,0,0,40443,4169,0,0), +(@GUID+87,32925,603,1,1,28581,0,2070.53,-254.7,447.074,0.436332,604800,0,0,40443,4169,0,0), +(@GUID+88,32925,603,1,1,28581,0,2068.65,-270.917,449.112,0.226893,604800,0,0,40443,4169,0,0), +(@GUID+89,32925,603,1,1,28581,0,2079.16,-291.637,445.029,0.488692,604800,0,0,40443,4169,0,0), +(@GUID+90,32925,603,1,1,28581,0,2093.31,-296.653,434.853,0.698132,604800,0,0,40443,4169,0,0), +(@GUID+91,32925,603,1,1,28581,0,2188.81,-295.889,445.046,2.49582,604800,0,0,40443,4169,0,0), +(@GUID+92,32925,603,1,1,28581,0,2197.29,-272.726,445.048,3.00197,604800,0,0,40443,4169,0,0); + +DELETE FROM `gameobject_template` WHERE `entry`=194265; +INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `ScriptName`, `WDBVerified`) VALUES +('194265','1','295','Lever','','','','0','16','3','0','0','0','0','0','0','0','0','6000','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','11403'); +DELETE FROM `gameobject` WHERE `id`=194265; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(2002365, 194265, 603, 1, 64, 2173.24, -252.985, 420.146, 5.27078, 0, 0, 1, 0, 7200, 100, 1); + +UPDATE `gameobject` SET `id` = 194265, `rotation2` = 1, `rotation3` = 0, `spawntimesecs` = 7200, `animprogress` = 100 WHERE `guid` = 2002365; + +DELETE FROM `creature` WHERE `guid`=131934; +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `DeathState`, `MovementType`) VALUES +('131934','33725','603','1','1','16925','0','2134.93','-339.696','437.311','0','604800','0','0','12600','0','0','0'); + +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 33725; +UPDATE `creature_template` SET `flags_extra` = 2, `ScriptName` = 'thorim_phase_trigger' WHERE `entry` = 32892; + +DELETE FROM `creature_addon` WHERE `guid`IN (131817, 131934); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES +('131817','0','0','0','1','0','40775 0'), +('131934','0','0','0','1','0','40775 0'); + +-- 8264_thorim_preadds +UPDATE `creature_template` SET `mindmg` = 488, `maxdmg` = 642, `attackpower` = 682, `dmg_multiplier` = 7.5, `equipment_id` = 1852 WHERE `entry` = 32908; +UPDATE `creature_template` SET `mindmg` = 488, `maxdmg` = 642, `attackpower` = 482, `dmg_multiplier` = 7.5, `equipment_id` = 1847 WHERE `entry` = 32885; +UPDATE `creature_template` SET `ScriptName` = 'mob_pre_phase' WHERE `entry` IN (32907, 32883); + +-- 8265_thorim_chest +DELETE FROM `gameobject` WHERE `id`=194314; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(7143, 194314, 603, 1, 1, 2134.58, -286.908, 419.495, 1.55988, 0, 0, 0.703237, 0.710955, -604800, 0, 1); + +-- 8266_thorim_hardmode +DELETE FROM creature_template WHERE `entry` IN (33196, 33234); +INSERT INTO `creature_template` values +('33196','33234','0','0','0','0','28488','0','0','0','Sif','','','0','83','83','2','16','16','0','1','1.14286','1','3','370','531','4','343','35','2000','0','8','33587202','8','0','0','0','0','0','365','542','84','7','4','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','350','1','1','0','0','0','0','0','0','0','0','1','850','0','0','npc_sif','11159'), +('33234','0','0','0','0','0','28488','0','0','0','Sif (1)','','','0','83','83','2','35','35','0','1','1.14286','1','3','370','531','0','343','70','2000','0','8','0','8','0','0','0','0','0','365','542','84','7','4','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','3','350','1','1','0','0','0','0','0','0','0','0','1','0','0','0','','1'); + +-- 8270_razorscale_triggers +UPDATE `creature_template` SET `modelid1` = 16925, `modelid2` = 0, `flags_extra` = 2, `ScriptName` = 'mole_machine_trigger' WHERE `entry` = 33282; + +-- 8274_thorim_tram +UPDATE `gameobject_template` SET `flags` = 32, `data2` = 3000, `ScriptName` = 'go_call_tram' WHERE `entry` IN (194914, 194912, 194437); +DELETE FROM gameobject WHERE id = '194437'; +INSERT INTO `gameobject` (`guid`,`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES +(' 270010','194437','603','1','1','2306.87','274.237','424.288','1.52255','0','0','0.689847','0.723956','300','0','1'); + +-- 8275_tram_packets +DELETE FROM gameobject_template WHERE entry = '194438'; +INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `faction`, `flags`, `size`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `data0`, `data1`, `data2`, `data3`, `data4`, `data5`, `data6`, `data7`, `data8`, `data9`, `data10`, `data11`, `data12`, `data13`, `data14`, `data15`, `data16`, `data17`, `data18`, `data19`, `data20`, `data21`, `data22`, `data23`, `ScriptName`, `WDBVerified`) VALUES +('194438','1','8504','Activate Tram','','','','0','32','1','0','0','0','0','0','0','0','0','3000','0','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','go_call_tram','11159'); +DELETE FROM gameobject WHERE id = '194438'; +INSERT INTO `gameobject` (`guid`,`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES +(270011, 194438, 603, 1,1,2306.99, 2589.35, 424.382, 4.71676, 0, 0, 0.705559, -0.708651, 300, 0, 1); + +-- 8277_ignis_vehicle +UPDATE `creature_template` SET `vehicleid` = 342 WHERE `entry` = 33118; + +-- 8281_xt002_adds +UPDATE `creature_template` SET `vehicleid` = 353 WHERE `entry` = 33293; +UPDATE `creature_template` SET `speed_walk` = 0.5, `speed_run` = 0.5, `faction_A` = 16, `faction_H` = 16 WHERE `entry` IN (33343, 33346); +UPDATE `creature_template` SET `modelid1` = 19139, `modelid2` = 0, `modelid3` = 0, `dmg_multiplier` = 35 WHERE `entry` = 33346; + +-- 8282_razorscale_event +UPDATE `creature_template` SET `modelid1` = 11686, `modelid2` = 0, `flags_extra` = 2, `ScriptName` = 'mole_machine_trigger' WHERE `entry` = 33245; +UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 33282; + +-- 8289_kologarn_arms +DELETE FROM `creature_model_info` WHERE `modelid` IN (28638, 28821, 28822); +INSERT INTO `creature_model_info` (`modelid`, `bounding_radius`, `combat_reach`, `gender`, `modelid_other_gender`) VALUES +(28638, 0.15, 20, 2, 0), +(28821, 0.35, 20, 2, 0), +(28822, 0.35, 20, 2, 0); + +-- 8291_hodir_adds_resistance +UPDATE `creature_template` SET `resistance4` = 1000 WHERE `entry` IN (33325, 32901, 33328, 32900, 32893, 33327, 32897, 33326, 32941, 33333, 33332, 32950, 33331, 32946, 32948, 33330); + +-- 8297_mimiron_phase1 +UPDATE `creature_template` SET `vehicleId` = 336 WHERE `entry` = 33432; -- Leviathan Mk II +DELETE FROM creature WHERE id = 34071; +DELETE FROM vehicle_accessory WHERE entry = 33432; +INSERT INTO vehicle_accessory VALUE (33432, 34071, 7, 1, 'Leviathan Mk II turret'); +UPDATE creature_template SET ScriptName = 'boss_mimiron' WHERE entry = 33350; +UPDATE creature_template SET ScriptName = 'boss_leviathan_mk' WHERE entry = 33432; +UPDATE creature_template SET ScriptName = 'boss_leviathan_mk_turret' WHERE entry = 34071; +UPDATE creature_template SET ScriptName = 'mob_proximity_mine' WHERE entry = 34362; +DELETE FROM `creature_model_info` WHERE `modelid`=28831; +INSERT INTO `creature_model_info` (`modelid`, `bounding_radius`, `combat_reach`, `gender`, `modelid_other_gender`) VALUES +(28831, 0.5, 7, 2, 0); + +-- 8320 mimiron_encounter +DELETE FROM `creature_model_info` WHERE `modelid`=28831; +INSERT INTO `creature_model_info` (`modelid`, `bounding_radius`, `combat_reach`, `gender`, `modelid_other_gender`) VALUES +(28831, 0, 0, 2, 0); +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` IN (33856, 34143, 34050); +UPDATE `creature_template` SET `unit_flags` = 33686018 WHERE `entry` = 34050; +UPDATE `creature` SET `position_x` = 2736.92, `position_y` = 2572.30, `orientation` = 5.723 WHERE `guid` = 137630; +UPDATE `creature_template` SET `ScriptName` = 'boss_vx_001', `unit_flags` = 0, `vehicleid` = 371, `Health_mod` = 375 WHERE `entry` = 33651; +UPDATE `creature_template` SET `ScriptName` = 'boss_aerial_unit', `unit_flags` = 0, `vehicleid` = 388, `Health_mod` = 250 WHERE `entry` = 33670; +UPDATE `creature_template` SET `vehicleid` = 370, `Health_mod` = 156.185 WHERE `entry` = 33432; +UPDATE `creature_template` SET `Health_mod` = 156.185 WHERE `entry` = 34071; + +DELETE FROM vehicle_accessory WHERE entry = 33432; +INSERT INTO vehicle_accessory VALUE (33432, 34071, 3, 1, 'Leviathan Mk II turret'); +UPDATE `creature_template` SET `modelid1` = 17188, `modelid2` = 0 WHERE `entry` = 25171; +UPDATE `creature_template` SET `speed_walk` = 0.5, `speed_run` = 0.5, `ScriptName` = 'mob_boom_bot' WHERE `entry` = 33836; + +DELETE FROM `creature` WHERE `id`=33651; +INSERT INTO `creature` (`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(33651, 603, 1, 1, 28841, 0, 2744.65, 2569.46, 364.397, 3.14159, 604800, 0, 0, 1742400, 0, 0, 0); +UPDATE `creature_template` SET `unit_flags` = 33686020, `flags_extra` = 2, `ScriptName` = 'rocket_strike' WHERE `entry` = 34047; + +DELETE FROM `creature` WHERE `id`=33670; +INSERT INTO `creature` (`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(33670, 603, 1, 1, 28979, 0, 2744.65, 2569.46, 380.040, 3.14159, 604800, 0, 0, 1742400, 0, 0, 0); + +UPDATE `creature_template` SET `unit_flags` = 33686020, `type_flags` = 0, `flags_extra` = 2, `ScriptName` = 'magnetic_core' WHERE `entry` = 34068; +-- 8334_mimiron_chest +UPDATE `gameobject_template` SET `size` = 1.5 WHERE `entry` = 194956; +DELETE FROM `gameobject` WHERE `id`=194956; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(5868, 194956, 603, 1, 1, 2744.65, 2569.46, 364.397, 3.14159, 0, 0, 0.703237, 0.710955, -604800, 0, 1); + +UPDATE `creature_template` SET `mechanic_immune_mask` = 650854235, `flags_extra` = 1 WHERE `entry` IN (33432, 33651, 33670); + +-- 8338_ulduar_teleports +DELETE FROM `gameobject` WHERE `id`=194569; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(21679, 194569, 603, 1, 1, 2086.26, -23.9948, 421.316, 0, 0, 0, 0, 1, 180, 255, 0), +(21684, 194569, 603, 1, 1, 1498.05, -24.3509, 420.966, 0, 0, 0, 0, 1, 180, 255, 0), +(49422, 194569, 603, 1, 1, 1859.65, -24.9121, 448.811, 0, 0, 0, 0, 1, 180, 255, 0), +(49423, 194569, 603, 1, 1, 2518.16, 2569.03, 412.299, 0, 0, 0, 0, 1, 180, 255, 0), +(49424, 194569, 603, 1, 1, 1854.82, -11.5608, 334.175, 0, 0, 0, 0, 1, 180, 255, 0), +(73286, 194569, 603, 1, 1, -706.122, -92.6024, 429.876, 0, 0, 0, 0, 1, 180, 255, 0), +(73327, 194569, 603, 1, 1, 553.233, -12.3247, 409.679, 0, 0, 0, 0, 1, 180, 255, 0), +(73322, 194569, 603, 1, 1, 131.248, -35.3802, 409.804, 0, 0, 0, 0, 1, 180, 255, 0), +(73340, 194569, 603, 1, 1, 926.292, -11.4635, 418.595, 0, 0, 0, 0, 1, 180, 255, 0); +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` = 33184; + +-- 8353_ulduar_evenai +-- Runeforged Sentry +UPDATE `creature_template` SET `spell1` = 64852, `spell2` = 64870, `spell3` = 64847, `AIName` = 'EventAI' WHERE `entry` = 34234; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34234); +INSERT INTO `creature_ai_scripts` VALUES +(3423401, 34234, 0, 0, 100, 3, 2000, 2000, 10000, 10000, 11, 64852, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Runeforged Sentry - Cast Flaming Rune 10'), +(3423402, 34234, 0, 0, 100, 5, 2000, 2000, 10000, 10000, 11, 64852, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Runeforged Sentry - Cast Flaming Rune 25'), +(3423403, 34234, 0, 0, 100, 3, 3000, 5000, 5000, 7000, 11, 64870, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Runeforged Sentry - Cast Lava Burst 10'), +(3423404, 34234, 0, 0, 100, 5, 3000, 5000, 5000, 7000, 11, 64870, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Runeforged Sentry - Cast Lava Burst 25'), +(3423405, 34234, 0, 0, 100, 3, 2500, 3000, 12000, 15000, 11, 64847, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Runeforged Sentry - Cast Runed Flame Jets 10'), +(3423406, 34234, 0, 0, 100, 5, 2500, 3000, 12000, 15000, 11, 64847, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Runeforged Sentry - Cast Runed Flame Jets 25'); + +-- Steelforged Defender +UPDATE `creature_template` SET `spell1` = 62845, `spell2` = 57780, `spell3` = 50370, `AIName` = 'EventAI' WHERE `entry` = 33236; +UPDATE `creature` SET `spawntimesecs` = 604800 WHERE `id` IN (33236, 33838); +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33236); +INSERT INTO `creature_ai_scripts` VALUES +(3323601, 33236, 0, 0, 100, 3, 4000, 6000, 15000, 20000, 11, 62845, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Steelforged Defender - Cast Hamstring 10'), +(3323602, 33236, 0, 0, 100, 5, 4000, 6000, 15000, 20000, 11, 62845, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Steelforged Defender - Cast Hamstring 25'), +(3323603, 33236, 0, 0, 100, 3, 0, 4000, 6000, 8000, 11, 57780, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Steelforged Defender - Cast Lightning Bolt 10'), +(3323604, 33236, 0, 0, 100, 5, 0, 4000, 6000, 8000, 11, 57780, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Steelforged Defender - Cast Lightning Bolt 25'), +(3323605, 33236, 0, 0, 100, 3, 5000, 6000, 4000, 6000, 11, 50370, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Steelforged Defender - Cast Sunder Armor 10'), +(3323606, 33236, 0, 0, 100, 5, 5000, 6000, 4000, 6000, 11, 50370, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Steelforged Defender - Cast Sunder Armor 25'); + +-- Mechagnome Battletank +UPDATE `creature_template` SET `spell1` = 64693, `spell2` = 64953, `mindmg` = 417, `maxdmg` = 582, `attackpower` = 968, `minrangedmg` = 341, `maxrangedmg` = 506, `AIName` = 'EventAI' WHERE `entry` = 34164; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34164); +INSERT INTO `creature_ai_scripts` VALUES +(3416401, 34164, 0, 0, 100, 3, 3000, 4000, 6000, 8000, 11, 64693, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mechagnome Battletank - Cast Flame Cannon 10'), +(3416402, 34164, 0, 0, 100, 5, 3000, 4000, 6000, 8000, 11, 64693, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mechagnome Battletank - Cast Flame Cannon 25'), +(3416403, 34164, 0, 0, 100, 3, 10000, 10000, 15000, 20000, 11, 64953, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mechagnome Battletank - Cast Jump Attack 10'), +(3416404, 34164, 0, 0, 100, 5, 10000, 10000, 15000, 20000, 11, 64953, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mechagnome Battletank - Cast Jump Attack 25'); + +-- Ulduar Colossus +UPDATE `creature_template` SET `spell1` = 62625, `attackpower` = 987, `AIName` = 'EventAI' WHERE `entry` = 33237; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33237); +INSERT INTO `creature_ai_scripts` VALUES +(3323701, 33237, 0, 0, 100, 3, 8000, 10000, 20000, 25000, 11, 62625, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Ulduar Colossus - Cast Ground Slam 10'), +(3323702, 33237, 0, 0, 100, 5, 8000, 10000, 20000, 25000, 11, 62625, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Ulduar Colossus - Cast Ground Slam 25'); + +-- invisible triggers +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` IN (33377, 33742, 34286, 33500); + +-- Molten Colossus +UPDATE `creature_template` SET `spell1` = 64697, `spell2` = 64698, `attackpower` = 982, `dmg_multiplier` = 30, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34069; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34069); +INSERT INTO `creature_ai_scripts` VALUES +(3406901, 34069, 0, 0, 100, 3, 6000, 10000, 10000, 12000, 11, 64697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Molten Colossus - Cast Earthquake 10'), +(3406902, 34069, 0, 0, 100, 5, 6000, 10000, 10000, 12000, 11, 64697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Molten Colossus - Cast Earthquake 25'), +(3406903, 34069, 0, 0, 100, 3, 2000, 4000, 6000, 9000, 11, 64698, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Molten Colossus - Cast Pyroblast 10'), +(3406904, 34069, 0, 0, 100, 5, 2000, 4000, 6000, 9000, 11, 64698, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Molten Colossus - Cast Pyroblast 25'); + +-- Magma Rager +UPDATE `creature_template` SET `spell1` = 64773, `spell2` = 64746, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34086; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34086); +INSERT INTO `creature_ai_scripts` VALUES +(3408601, 34086, 0, 0, 100, 3, 2000, 40000, 6000, 8000, 11, 64773, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Magma Rager - Cast Fire Blast 10'), +(3408602, 34086, 0, 0, 100, 5, 2000, 40000, 6000, 8000, 11, 64773, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Magma Rager - Cast Fire Blast 25'), +(3408603, 34086, 0, 0, 100, 3, 8000, 16000, 15000, 25000, 11, 64746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Magma Rager - Cast Superheated winds 10'), +(3408604, 34086, 0, 0, 100, 5, 8000, 16000, 15000, 25000, 11, 64746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Magma Rager - Cast Superheated winds 25'); +UPDATE `creature_template` SET `unit_flags` = 33718790, modelid1 = 11686, modelid2 = 0, `spell1` = 64724, `AIName` = 'EventAI' WHERE `entry` = 34194; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34194); +INSERT INTO `creature_ai_scripts` VALUES +(3419401, 34194, 0, 0, 100, 3, 0, 0, 10000, 10000, 11, 64724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Superheated Winds'), +(3419402, 34194, 0, 0, 100, 5, 0, 0, 10000, 10000, 11, 64724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Superheated Winds'); + +-- Forge Construct +UPDATE `creature_template` SET `spell1` = 64719, `spell2` = 64720, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34085; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34085); +INSERT INTO `creature_ai_scripts` VALUES +(3408501, 34085, 0, 0, 100, 3, 8000, 12000, 10000, 15000, 11, 64719, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Forge Construct - Cast Charge 10'), +(3408502, 34085, 0, 0, 100, 5, 8000, 12000, 10000, 15000, 11, 64719, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Forge Construct - Cast Charge 25'), +(3408503, 34085, 0, 0, 100, 3, 2000, 6000, 6000, 9000, 11, 64720, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Forge Construct - Cast Flame Emission 10'), +(3408504, 34085, 0, 0, 100, 5, 2000, 6000, 6000, 9000, 11, 64721, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Forge Construct - Cast Flame Emission 25'); + +-- XB-488 Disposalbot +UPDATE `creature_template` SET `spell1` = 65080, `spell2` = 65084, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34273; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34273); +INSERT INTO `creature_ai_scripts` VALUES +(3427301, 34273, 2, 0, 100, 3, 30, 20, 0, 0, 11, 65084, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'XB-488 Disposalbot - Cast Self Destruct 10'), +(3427302, 34273, 2, 0, 100, 5, 30, 20, 0, 0, 11, 65084, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'XB-488 Disposalbot - Cast Self Destruct 25'), +(3427303, 34273, 0, 0, 100, 3, 2000, 6000, 10000, 15000, 11, 65080, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'XB-488 Disposalbot - Cast Cut Scrap Metal 10'), +(3427304, 34273, 0, 0, 100, 5, 2000, 6000, 10000, 15000, 11, 65104, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'XB-488 Disposalbot - Cast Cut Scrap Metal 25'); + +-- Parts Recovery Technician +UPDATE `creature_template` SET `spell1` = 65071, `spell2` = 65070, `dmg_multiplier` = 15, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554432, `AIName` = 'EventAI' WHERE `entry` = 34267; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34267); +INSERT INTO `creature_ai_scripts` VALUES +(3426701, 34267, 0, 0, 100, 3, 8000, 12000, 10000, 15000, 11, 65071, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Parts Recovery Technician - Cast Mechano Kick 10'), +(3426702, 34267, 0, 0, 100, 5, 8000, 12000, 10000, 15000, 11, 65071, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Parts Recovery Technician - Cast Mechano Kick 25'), +(3426703, 34267, 0, 0, 100, 3, 6000, 8000, 25000, 30000, 11, 65070, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Parts Recovery Technician - Cast Defense Matrix 10'), +(3426704, 34267, 0, 0, 100, 5, 6000, 8000, 25000, 30000, 11, 65070, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Parts Recovery Technician - Cast Defense Matrix 25'); + +-- XD-175 Compactobot +UPDATE `creature_template` SET `spell1` = 65073, `spell2` = 65106, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34271; +UPDATE `creature_template` SET `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600 WHERE `entry` = 34269; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34271); +INSERT INTO `creature_ai_scripts` VALUES +(3427101, 34271, 0, 0, 100, 3, 8000, 12000, 15000, 20000, 11, 65073, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'XD-175 Compactobot - Cast Trash Compactor 10'), +(3427102, 34271, 0, 0, 100, 5, 8000, 12000, 15000, 20000, 11, 65106, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'XD-175 Compactobot - Cast Trash Compactor 25'); + +-- Lightning Charged Iron Dwarf +UPDATE `creature_template` SET `spell1` = 64889, `spell2` = 64975, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34199; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34199); +INSERT INTO `creature_ai_scripts` VALUES +(3419901, 34199, 0, 0, 100, 3, 0, 0, 10000, 15000, 11, 64889, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lightning Charged Iron Dwarf - Cast Lightning Charged 10'), +(3419902, 34199, 0, 0, 100, 5, 0, 0, 10000, 15000, 11, 64975, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Lightning Charged Iron Dwarf - Cast Lightning Charged 25'); + +-- Hardened Iron Golem +UPDATE `creature_template` SET `spell1` = 64877, `spell2` = 64874, `dmg_multiplier` = 25, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 34190; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34190); +INSERT INTO `creature_ai_scripts` VALUES +(3419001, 34190, 0, 0, 100, 3, 4000, 8000, 25000, 30000, 11, 64877, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Hardened Iron Golem - Cast Harden Fists 10'), +(3419002, 34190, 0, 0, 100, 5, 4000, 8000, 25000, 30000, 11, 64877, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Hardened Iron Golem - Cast Harden Fists 25'), +(3419003, 34190, 0, 0, 100, 3, 5000, 7000, 20000, 30000, 11, 64874, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Hardened Iron Golem - Cast Rune Punch 10'), +(3419004, 34190, 0, 0, 100, 5, 5000, 7000, 20000, 30000, 11, 64967, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Hardened Iron Golem - Cast Rune Punch 25'); + +-- Iron Mender +UPDATE `creature_template` SET `spell1` = 64918, `spell2` = 64903, `spell3` = 64897, `dmg_multiplier` = 25, `mechanic_immune_mask` = 33554496, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34198; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34198); +INSERT INTO `creature_ai_scripts` VALUES +(3419801, 34198, 0, 0, 100, 3, 2000, 4000, 4000, 6000, 11, 64918, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Iron Mender - Cast Electro Shock 10'), +(3419802, 34198, 0, 0, 100, 5, 2000, 4000, 4000, 6000, 11, 64971, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Iron Mender - Cast Electro Shock 25'), +(3419803, 34198, 0, 0, 100, 3, 3000, 6000, 10000, 15000, 11, 64903, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Iron Mender - Cast Fuse Lightning 10'), +(3419804, 34198, 0, 0, 100, 5, 3000, 6000, 10000, 15000, 11, 64970, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Iron Mender - Cast Fuse Lightning 25'), +(3419805, 34198, 0, 0, 100, 3, 10000, 25000, 30000, 45000, 11, 64897, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Iron Mender - Cast Fuse Metal 10'), +(3419806, 34198, 0, 0, 100, 5, 10000, 25000, 30000, 45000, 11, 64968, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Iron Mender - Cast Fuse Metal 25'); + +-- Rune Etched Sentry +UPDATE `creature_template` SET `spell1` = 64852, `spell2` = 64870, `spell3` = 64847, `mechanic_immune_mask` = 33554496, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34196; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34196); +INSERT INTO `creature_ai_scripts` VALUES +(3419601, 34196, 0, 0, 100, 3, 2000, 2000, 10000, 10000, 11, 64852, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Rune Etched Sentry - Cast Flaming Rune 10'), +(3419602, 34196, 0, 0, 100, 5, 2000, 2000, 10000, 10000, 11, 64852, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Rune Etched Sentry - Cast Flaming Rune 25'), +(3419603, 34196, 0, 0, 100, 3, 3000, 5000, 5000, 7000, 11, 64870, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Rune Etched Sentry - Cast Lava Burst 10'), +(3419604, 34196, 0, 0, 100, 5, 3000, 5000, 5000, 7000, 11, 64870, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Rune Etched Sentry - Cast Lava Burst 25'), +(3419605, 34196, 0, 0, 100, 3, 2500, 3000, 12000, 15000, 11, 64847, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Rune Etched Sentry - Cast Runed Flame Jets 10'), +(3419606, 34196, 0, 0, 100, 5, 2500, 3000, 12000, 15000, 11, 64847, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Rune Etched Sentry - Cast Runed Flame Jets 25'); + +-- Chamber Overseer +UPDATE `creature_template` SET `spell1` = 64820, `spell2` = 64825, `dmg_multiplier` = 55, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 34197; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34197); +INSERT INTO `creature_ai_scripts` VALUES +(3419701, 34197, 0, 0, 100, 3, 4000, 8000, 6000, 9000, 11, 64820, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Chamber Overseer - Cast Devastating Leap 10'), +(3419702, 34197, 0, 0, 100, 5, 4000, 8000, 6000, 9000, 11, 64943, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Chamber Overseer - Cast Devastating Leap 25'), +(3419703, 34197, 0, 0, 100, 3, 10000, 12000, 8000, 12000, 11, 64825, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Chamber Overseer - Cast Staggering Roar 10'), +(3419704, 34197, 0, 0, 100, 5, 10000, 12000, 8000, 12000, 11, 64944, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Chamber Overseer - Cast Staggering Roar 25'); + +-- Storm Tempered Keeper +UPDATE `creature_template` SET `spell1` = 63541, `spell2` = 63630, `dmg_multiplier` = 45, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 33722; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33722); +INSERT INTO `creature_ai_scripts` VALUES +(3372201, 33722, 0, 0, 100, 3, 120000, 120000, 120000, 150000, 11, 63630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Vengeful Surge 10'), +(3372202, 33722, 0, 0, 100, 5, 120000, 120000, 120000, 150000, 11, 63630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Vengeful Surge 25'), +(3372203, 33722, 0, 0, 100, 3, 3000, 6000, 10000, 15000, 11, 63541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Forked Lightning 10'), +(3372204, 33722, 0, 0, 100, 5, 3000, 6000, 10000, 15000, 11, 63541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Forked Lightning 25'); + +-- Storm Tempered Keeper +UPDATE `creature_template` SET `spell1` = 63541, `spell2` = 63630, `dmg_multiplier` = 45, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 33699; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33699); +INSERT INTO `creature_ai_scripts` VALUES +(3369901, 33699, 0, 0, 100, 3, 120000, 120000, 120000, 150000, 11, 63630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Vengeful Surge 10'), +(3369902, 33699, 0, 0, 100, 5, 120000, 120000, 120000, 150000, 11, 63630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Vengeful Surge 25'), +(3369903, 33699, 0, 0, 100, 3, 3000, 6000, 10000, 15000, 11, 63541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Forked Lightning 10'), +(3369904, 33699, 0, 0, 100, 5, 3000, 6000, 10000, 15000, 11, 63541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Storm Tempered Keeper - Cast Forked Lightning 25'); + +-- Champion of Hodir +UPDATE `creature_template` SET `spell1` = 64639, `dmg_multiplier` = 55, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34133; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34133); +INSERT INTO `creature_ai_scripts` VALUES +(3413301, 34133, 0, 0, 100, 3, 3000, 6000, 12000, 16000, 11, 64639, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Champion of Hodir - Cast Stomp 10'), +(3413302, 34133, 0, 0, 100, 5, 3000, 6000, 12000, 16000, 11, 64652, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Champion of Hodir - Cast Stomp 25'); +DELETE FROM `creature` WHERE `guid` IN (136293, 136294, 136295, 136292, 136313, 136314, 136312, 136321, 136319, 136320, 136322, 136346, 136343, 136536, 136533, 137563); + +-- Winter Jormungar +UPDATE `creature_template` SET `spell1` = 64638, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34137; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34137); +INSERT INTO `creature_ai_scripts` VALUES +(3413701, 34137, 0, 0, 100, 3, 3000, 6000, 6000, 9000, 11, 64638, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Jormungar - Cast Acidic Bite 10'), +(3413702, 34137, 0, 0, 100, 5, 3000, 6000, 6000, 9000, 11, 64638, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Jormungar - Cast Acidic Bite 25'); +UPDATE `creature` SET `spawndist` = 2 WHERE `id` = 34137; + +-- Winter Revenant +UPDATE `creature_template` SET `spell1` = 64642, `spell2` = 64643, `spell3` = 64644, `mechanic_immune_mask` = 33554496, `dmg_multiplier` = 25, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 34134; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34134); +INSERT INTO `creature_ai_scripts` VALUES +(3413401, 34134, 0, 0, 100, 3, 8000, 12000, 15000, 20000, 11, 64642, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Revenant - Cast Blizzard 10'), +(3413402, 34134, 0, 0, 100, 5, 8000, 12000, 15000, 20000, 11, 64653, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Revenant - Cast Blizzard 25'), +(3413403, 34134, 0, 0, 100, 3, 3000, 5000, 10000, 12000, 11, 64643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Revenant - Cast Whirling Strike 10'), +(3413404, 34134, 0, 0, 100, 5, 3000, 5000, 10000, 12000, 11, 64643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Revenant - Cast Whirling Strike 25'), +(3413405, 34134, 0, 0, 100, 3, 15000, 20000, 60000, 75000, 11, 64644, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Revenant - Cast Shield of the Winter Revenant 10'), +(3413406, 34134, 0, 0, 100, 5, 15000, 20000, 60000, 75000, 11, 64644, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Revenant - Cast Shield of the Winter Revenant 25'); + +-- Winter Rumbler +UPDATE `creature_template` SET `spell1` = 64645, `spell2` = 64647, `dmg_multiplier` = 15, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 34135; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34135); +INSERT INTO `creature_ai_scripts` VALUES +(3413501, 34135, 0, 0, 100, 3, 6000, 12000, 10000, 16000, 11, 64645, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Rumbler - Cast Cone of Cold 10'), +(3413502, 34135, 0, 0, 100, 5, 6000, 12000, 10000, 16000, 11, 64655, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Rumbler - Cast Cone of Cold 25'), +(3413503, 34135, 0, 0, 100, 3, 3000, 6000, 8000, 12000, 11, 64647, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Rumbler - Cast Snow Blindness 10'), +(3413504, 34135, 0, 0, 100, 5, 3000, 6000, 8000, 12000, 11, 64654, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Winter Rumbler - Cast Snow Blindness 25'); + +-- Guardian Lasher +UPDATE `creature_template` SET `spell1` = 63007, `spell2` = 63047, `dmg_multiplier` = 25, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 33430; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33430); +INSERT INTO `creature_ai_scripts` VALUES +(3343001, 33430, 4, 0, 100, 3, 0, 0, 0, 0, 11, 63007, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Guardian Lasher - Cast Guardian Pheromones 10'), +(3343002, 33430, 4, 0, 100, 5, 0, 0, 0, 0, 11, 63007, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Guardian Lasher - Cast Guardian Pheromones 25'), +(3343003, 33430, 0, 0, 100, 3, 3000, 6000, 10000, 14000, 11, 63047, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Guardian Lasher - Cast Guardian''s Lash 10'), +(3343004, 33430, 0, 0, 100, 5, 3000, 6000, 10000, 14000, 11, 63550, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Guardian Lasher - Cast Guardian''s Lash 25'); + +-- Forest Swarmer +UPDATE `creature_template` SET `spell1` = 63059, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33431; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33431); +INSERT INTO `creature_ai_scripts` VALUES +(3343101, 33431, 0, 0, 100, 3, 3000, 9000, 10000, 20000, 11, 63059, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Forest Swarmer - Cast Pollinate 10'), +(3343102, 33431, 0, 0, 100, 5, 3000, 9000, 10000, 20000, 11, 63059, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Forest Swarmer - Cast Pollinate 25'); +/* +DELETE FROM `spell_script_target` WHERE `entry`=63059; +INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES('63059','1','33430'); +*/ + +-- Guardian of Life +UPDATE `creature_template` SET `spell1` = 63226, `mingold` = 7100, `maxgold` = 7600, `dmg_multiplier` = 15, `AIName` = 'EventAI' WHERE `entry` = 33528; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33528); +INSERT INTO `creature_ai_scripts` VALUES +(3352801, 33528, 0, 0, 100, 3, 3000, 9000, 15000, 20000, 11, 63226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Guardian of Life - Cast Poison Breath 10'), +(3352802, 33528, 0, 0, 100, 5, 3000, 9000, 15000, 20000, 11, 63551, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Guardian of Life - Cast Poison Breath 25'); + +-- Nature's Blade +UPDATE `creature_template` SET `spell1` = 63247, `mingold` = 7100, `maxgold` = 7600, `dmg_multiplier` = 25, `AIName` = 'EventAI' WHERE `entry` = 33527; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33527); + +-- Ironroot Lasher +UPDATE `creature_template` SET `spell1` = 63240, `mingold` = 7100, `maxgold` = 7600, `dmg_multiplier` = 15, `AIName` = 'EventAI' WHERE `entry` = 33526; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33526); +INSERT INTO `creature_ai_scripts` VALUES +(3352601, 33526, 0, 0, 100, 3, 3000, 8000, 12000, 16000, 11, 63240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Ironroot Lasher - Cast Ironroot Thorns 10'), +(3352602, 33526, 0, 0, 100, 5, 3000, 8000, 12000, 16000, 11, 63553, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Ironroot Lasher - Cast Ironroot Thorns 25'); + +-- Mangrove Ent +UPDATE `creature_template` SET `spell1` = 63272, `spell2` = 63242, `spell3` = 63241, `dmg_multiplier` = 15, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33525; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33525); +INSERT INTO `creature_ai_scripts` VALUES +(3352501, 33525, 0, 0, 100, 3, 8000, 12000, 25000, 30000, 11, 63272, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mangrove Ent - Cast Hurricane 10'), +(3352502, 33525, 0, 0, 100, 5, 8000, 12000, 25000, 30000, 11, 63272, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mangrove Ent - Cast Hurricane 25'), +(3352503, 33525, 0, 0, 100, 3, 12000, 16000, 12000, 16000, 11, 63242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mangrove Ent - Cast Nourish 10'), +(3352504, 33525, 0, 0, 100, 5, 12000, 16000, 12000, 16000, 11, 63556, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mangrove Ent - Cast Nourish 25'), +(3352505, 33525, 0, 0, 100, 3, 25000, 30000, 25000, 30000, 11, 63241, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mangrove Ent - Cast Tranquility 10'), +(3352506, 33525, 0, 0, 100, 5, 25000, 30000, 25000, 30000, 11, 63554, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Mangrove Ent - Cast Tranquility 25'); + +-- Misguided Nymph +UPDATE `creature_template` SET `spell1` = 63082, `spell2` = 63111, `spell3` = 63136, `dmg_multiplier` = 15, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33355; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33355); +INSERT INTO `creature_ai_scripts` VALUES +(3335501, 33355, 0, 0, 100, 3, 8000, 12000, 25000, 30000, 11, 63082, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Misguided Nymph - Cast Bind Life 10'), +(3335502, 33355, 0, 0, 100, 5, 8000, 12000, 25000, 30000, 11, 63559, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Misguided Nymph - Cast Bind Life 25'), +(3335503, 33355, 0, 0, 100, 3, 4000, 6000, 12000, 16000, 11, 63111, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Misguided Nymph - Cast Frost Spear 10'), +(3335504, 33355, 0, 0, 100, 5, 4000, 6000, 12000, 16000, 11, 63562, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Misguided Nymph - Cast Frost Spear 25'), +(3335505, 33355, 0, 0, 100, 3, 15000, 20000, 15000, 20000, 11, 63136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Misguided Nymph - Cast Winter''s Embrace 10'), +(3335506, 33355, 0, 0, 100, 5, 15000, 20000, 15000, 20000, 11, 63564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Misguided Nymph - Cast Winter''s Embrace 25'); + +-- Corrupted Servitor +UPDATE `creature_template` SET `spell1` = 63169, `spell2` = 63149, `dmg_multiplier` = 25, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 33354; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33354); +INSERT INTO `creature_ai_scripts` VALUES +(3335401, 33354, 0, 0, 100, 3, 2000, 4000, 20000, 25000, 11, 63169, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Corrupted Servitor - Cast Petrify Joints 10'), +(3335402, 33354, 0, 0, 100, 5, 2000, 4000, 20000, 25000, 11, 63549, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Corrupted Servitor - Cast Petrify Joints 25'), +(3335403, 33354, 0, 0, 100, 3, 6000, 8000, 12000, 16000, 11, 63149, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Corrupted Servitor - Cast Violent Earth 10'), +(3335404, 33354, 0, 0, 100, 5, 6000, 8000, 12000, 16000, 11, 63149, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Corrupted Servitor - Cast Violent Earth 25'); + +-- Dark Rune +UPDATE `creature_template` SET `dmg_multiplier` = 55, `mingold` = 7100, `maxgold` = 7600 WHERE `entry` IN (33754, 33755); + +-- Freya's Elders +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` IN (33406, 33575); +UPDATE `creature_template` SET `dmg_multiplier` = 45, `mechanic_immune_mask` = 650854235 WHERE `entry` IN (32913, 32915, 32914); + +-- Arachnopod Destroyer +UPDATE `creature_template` SET `spell1` = 64717, `spell2` = 64776, `dmg_multiplier` = 30, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 34183; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34183); +INSERT INTO `creature_ai_scripts` VALUES +(3418301, 34183, 0, 0, 100, 3, 2000, 4000, 12000, 16000, 11, 64717, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Arachnopod Destroyer - Cast Flame Spray 10'), +(3418302, 34183, 0, 0, 100, 5, 2000, 4000, 12000, 16000, 11, 64717, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Arachnopod Destroyer - Cast Flame Spray 25'), +(3418303, 34183, 0, 0, 100, 3, 8000, 10000, 12000, 16000, 11, 64776, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Arachnopod Destroyer - Cast Machine Gun 10'), +(3418304, 34183, 0, 0, 100, 5, 8000, 10000, 12000, 16000, 11, 64776, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Arachnopod Destroyer - Cast Machine Gun 25'); + +-- Clockwork Mechanic +UPDATE `creature_template` SET `dmg_multiplier` = 20, `mingold` = 1720000, `maxgold` = 1760000 WHERE `entry` = 34184; + +-- Trash +UPDATE `creature_template` SET `dmg_multiplier` = 10 WHERE `entry` = 34191; + +-- Boomer XP-500 +UPDATE `creature_template` SET `spell1` = 55714, `dmg_multiplier` = 15, `AIName` = 'EventAI' WHERE `entry` = 34192; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34192); +INSERT INTO `creature_ai_scripts` VALUES +(3419201, 34192, 9, 0, 100, 3, 0, 3, 0, 0, 11, 55714, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Boomer XP-500 - Explode 10'), +(3419202, 34192, 9, 0, 100, 5, 0, 3, 0, 0, 11, 55714, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Boomer XP-500 - Explode 25'); + +-- Clockwork Sapper +UPDATE `creature_template` SET `spell1` = 64740, `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 20, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112, `mingold` = 7100, `maxgold` = 7600, `mechanic_immune_mask` = 33554496, `AIName` = 'EventAI' WHERE `entry` = 34193; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=34193); +INSERT INTO `creature_ai_scripts` VALUES +(3419301, 34193, 0, 0, 100, 3, 2000, 6000, 12000, 16000, 11, 64740, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Clockwork Sapper - Cast Energy Sap 10'), +(3419302, 34193, 0, 0, 100, 5, 2000, 6000, 12000, 16000, 11, 64740, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Clockwork Sapper - Cast Energy Sap 25'); + +-- Twilight Adherent +UPDATE `creature_template` SET `spell1` = 64663, `spell2` = 63760, `spell3` = 13704, `equipment_id` = 1848, `mechanic_immune_mask` = 33554513, `unit_class` = 2, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33818; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33818); +INSERT INTO `creature_ai_scripts` VALUES +(3381801, 33818, 0, 0, 100, 3, 10000, 16000, 20000, 25000, 11, 64663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Adherent - Cast Arcane Burst 10'), +(3381802, 33818, 0, 0, 100, 5, 10000, 16000, 20000, 25000, 11, 64663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Adherent - Cast Arcane Burst 25'), +(3381803, 33818, 0, 0, 100, 3, 18000, 24000, 20000, 24000, 11, 63760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Adherent - Cast Greater Heal 10'), +(3381804, 33818, 0, 0, 100, 5, 18000, 24000, 20000, 24000, 11, 63760, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Adherent - Cast Greater Heal 25'), +(3381805, 33818, 0, 0, 100, 3, 2000, 4000, 10000, 16000, 11, 13704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Adherent - Cast Psychic Scream 10'), +(3381806, 33818, 0, 0, 100, 5, 2000, 4000, 10000, 16000, 11, 13704, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Adherent - Cast Psychic Scream 25'); + +-- Twilight Guardian +UPDATE `creature_template` SET `spell1` = 52719, `spell2` = 62317, `spell3` = 63757, `mechanic_immune_mask` = 33554513, `equipment_id` = 1852, `dmg_multiplier` = 40, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33822; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33822); +INSERT INTO `creature_ai_scripts` VALUES +(3382201, 33822, 0, 0, 100, 3, 6000, 10000, 8000, 10000, 11, 52719, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Guardian - Cast Concussion Blow 10'), +(3382202, 33822, 0, 0, 100, 5, 6000, 10000, 8000, 10000, 11, 52719, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Guardian - Cast Concussion Blow 25'), +(3382203, 33822, 0, 0, 100, 3, 2000, 3000, 3000, 6000, 11, 62317, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Guardian - Cast Devastate 10'), +(3382204, 33822, 0, 0, 100, 5, 2000, 3000, 3000, 6000, 11, 62317, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Guardian - Cast Devastate 25'), +(3382205, 33822, 0, 0, 100, 3, 16000, 18000, 14000, 16000, 11, 63757, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Guardian - Cast Thunderclap 10'), +(3382206, 33822, 0, 0, 100, 5, 16000, 18000, 14000, 16000, 11, 63757, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Guardian - Cast Thunderclap 25'); + +-- Twilight Shadowblade +UPDATE `creature_template` SET `spell1` = 63753, `mechanic_immune_mask` = 33554513, `equipment_id` = 1862, `dmg_multiplier` = 25, `baseattacktime` = 1000, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33824; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33824); +INSERT INTO `creature_ai_scripts` VALUES +(3382401, 33824, 0, 0, 100, 3, 6000, 8000, 14000, 16000, 11, 63753, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Shadowblade - Cast Fan of Knives 10'), +(3382402, 33824, 0, 0, 100, 5, 6000, 8000, 14000, 16000, 11, 63753, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Shadowblade - Cast Fan of Knives 25'); + +-- Twilight Slayer +UPDATE `creature_template` SET `spell1` = 63784, `spell2` = 35054, `mechanic_immune_mask` = 33554513, `equipment_id` = 1847, `dmg_multiplier` = 50, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33823; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33823); +INSERT INTO `creature_ai_scripts` VALUES +(3382301, 33823, 0, 0, 100, 3, 3000, 5000, 16000, 20000, 11, 35054, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Slayer - Cast Mortal Strike 10'), +(3382302, 33823, 0, 0, 100, 5, 3000, 5000, 8000, 10000, 11, 35054, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Slayer - Cast Mortal Strike 25'), +(3382303, 33823, 0, 0, 100, 3, 9000, 12000, 28000, 34000, 11, 63784, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Slayer - Cast Bladestorm 10'), +(3382304, 33823, 0, 0, 100, 5, 9000, 12000, 28000, 34000, 11, 63784, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Slayer - Cast Bladestorm 25'); + +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112 WHERE `entry` IN (33818, 33822, 33823, 33824, 33772, 33819, 33820, 33838); +UPDATE `creature_template` SET `equipment_id` = 1849 WHERE `entry` = 32885; +UPDATE `creature_template` SET `equipment_id` = 1850 WHERE `entry` = 32908; + +-- Faceless Horror +UPDATE `creature_template` SET `spell1` = 64429, `spell2` = 63722, `spell3` = 63710, `spell4` = 63703, `mechanic_immune_mask` = 33554513, `dmg_multiplier` = 65, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33772; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33772); +INSERT INTO `creature_ai_scripts` VALUES +(3377201, 33772, 0, 0, 100, 3, 18000, 22000, 15000, 20000, 11, 64429, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faceless Horror - Cast Death Grip 10'), +(3377202, 33772, 0, 0, 100, 5, 18000, 22000, 15000, 20000, 11, 64429, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faceless Horror - Cast Death Grip 25'), +(3377203, 33772, 0, 0, 100, 3, 2000, 4000, 10000, 12000, 11, 63722, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faceless Horror - Cast Shadow Crash 10'), +(3377204, 33772, 0, 0, 100, 5, 2000, 4000, 10000, 12000, 11, 63722, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faceless Horror - Cast Shadow Crash 25'), +(3377205, 33772, 4, 0, 100, 3, 0, 0, 0, 0, 11, 63703, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faceless Horror - Cast Void Wave 10'), +(3377206, 33772, 4, 0, 100, 5, 0, 0, 0, 0, 11, 63703, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Faceless Horror - Cast Void Wave 25'); + +-- Twilight Frost Mage +UPDATE `creature_template` SET `spell1` = 64663, `spell2` = 63758, `spell3` = 63912, `spell4` = 63913, `equipment_id` = 1849, `mechanic_immune_mask` = 33554513, `unit_class` = 2, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33819; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33819); +INSERT INTO `creature_ai_scripts` VALUES +(3381901, 33819, 0, 0, 100, 3, 10000, 16000, 20000, 25000, 11, 64663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Arcane Burst 10'), +(3381902, 33819, 0, 0, 100, 5, 10000, 16000, 20000, 25000, 11, 64663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Arcane Burst 25'), +(3381903, 33819, 0, 0, 100, 3, 1000, 2000, 6000, 8000, 11, 63913, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Frostbolt 10'), +(3381904, 33819, 0, 0, 100, 5, 1000, 2000, 6000, 8000, 11, 63913, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Frostbolt 25'), +(3381905, 33819, 0, 0, 100, 3, 2000, 4000, 10000, 16000, 11, 63758, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Frost Bolt Volley 10'), +(3381906, 33819, 0, 0, 100, 5, 2000, 4000, 10000, 16000, 11, 63758, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Frost Bolt Volley 25'), +(3381907, 33819, 0, 0, 100, 3, 8000, 10000, 12000, 16000, 11, 63912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Frost Nova 10'), +(3381908, 33819, 0, 0, 100, 5, 8000, 10000, 12000, 16000, 11, 63912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Frost Mage - Cast Frost Nova 25'); + +-- Twilight Pyromancer +UPDATE `creature_template` SET `spell1` = 64663, `spell2` = 63789, `spell3` = 63775, `equipment_id` = 1848, `mechanic_immune_mask` = 33554513, `unit_class` = 2, `dmg_multiplier` = 20, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33820; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33820); +INSERT INTO `creature_ai_scripts` VALUES +(3382001, 33820, 0, 0, 100, 3, 10000, 16000, 20000, 25000, 11, 64663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Pyromancer - Cast Arcane Burst 10'), +(3382002, 33820, 0, 0, 100, 5, 10000, 16000, 20000, 25000, 11, 64663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Pyromancer - Cast Arcane Burst 25'), +(3382003, 33820, 0, 0, 100, 3, 1000, 2000, 6000, 8000, 11, 63789, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Pyromancer - Cast Fireball 10'), +(3382004, 33820, 0, 0, 100, 5, 1000, 2000, 6000, 8000, 11, 63789, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Pyromancer - Cast Fireball 25'), +(3382005, 33820, 0, 0, 100, 3, 2000, 4000, 10000, 16000, 11, 63775, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Pyromancer - Cast Flamestrike 10'), +(3382006, 33820, 0, 0, 100, 5, 2000, 4000, 10000, 16000, 11, 63775, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Twilight Pyromancer - Cast Flamestrike 25'); + +-- Enslaved Fire Elemental +UPDATE `creature_template` SET `spell1` = 38064, `spell2` = 63778, `mechanic_immune_mask` = 33554513, `dmg_multiplier` = 15, `mingold` = 7100, `maxgold` = 7600, `AIName` = 'EventAI' WHERE `entry` = 33838; +DELETE FROM `creature_ai_scripts` WHERE (`creature_id`=33838); +INSERT INTO `creature_ai_scripts` VALUES +(3383801, 33838, 0, 0, 100, 3, 4000, 8000, 12000, 14000, 11, 38064, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Enslaved Fire Elemental - Cast Blast Wave 10'), +(3383802, 33838, 0, 0, 100, 5, 4000, 8000, 12000, 14000, 11, 38064, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Enslaved Fire Elemental - Cast Blast Wave 25'), +(3383803, 33838, 4, 0, 100, 3, 0, 0, 0, 0, 11, 63778, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Enslaved Fire Elemental - Cast Fire Shield 10'), +(3383804, 33838, 4, 0, 100, 5, 0, 0, 0, 0, 11, 63778, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Enslaved Fire Elemental - Cast Fire Shield 25'); + + + +-- Flame Leviathan +UPDATE `creature_template` SET `dmg_multiplier` = 40, `mingold` = 1720000, `maxgold` = 1760000 WHERE `entry` = 33118; + +-- Ignis +UPDATE `creature_template` SET `dmg_multiplier` = 45, `mingold` = 1720000, `maxgold` = 1760000 WHERE `entry` = 33118; +UPDATE `creature_template` SET `dmg_multiplier` = 21 WHERE `entry` = 33121; + +-- Razorscale +UPDATE `creature_template` SET `dmg_multiplier` = 45, `mingold` = 1720000, `maxgold` = 1760000 WHERE `entry` = 33186; +UPDATE `creature_template` SET `dmg_multiplier` = 15 WHERE `entry` IN (33453, 33388); +UPDATE `creature_template` SET `dmg_multiplier` = 23 WHERE `entry` = 33846; + +-- XT-002 +UPDATE `creature_template` SET `dmg_multiplier` = 80, `mingold` = 1720000, `maxgold` = 1760000 WHERE `entry` = 33293; + +-- Assembly of Iron +UPDATE `creature_template` SET `dmg_multiplier` = 95, `AIName` = '' WHERE `entry` = 32867; +UPDATE `creature_template` SET `dmg_multiplier` = 60, `AIName` = '' WHERE `entry` = 32927; +UPDATE `creature_template` SET `AIName` = '' WHERE `entry` = 32857; + +-- Kologarn +UPDATE `creature_template` SET `dmg_multiplier` = 65 WHERE `entry` = 32930; + +-- Hodir +UPDATE `creature_template` SET `dmg_multiplier` = 60 WHERE `entry` = 32845; + +-- Auriaya +UPDATE `creature_template` SET `dmg_multiplier` = 65, `unit_class` = 1, `mingold` = 1720000, `maxgold` = 1760000, `mechanic_immune_mask` = 617299803 WHERE `entry` = 33515; +UPDATE `creature_template` SET `speed_walk` = 2, `speed_run` = 2, `dmg_multiplier` = 3 WHERE `entry` = 34035; + +-- Freya +UPDATE `creature_template` SET `dmg_multiplier` = 50 WHERE `entry` = 32906; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 7.5, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112 WHERE `entry` = 32918; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 40, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112, `mechanic_immune_mask` = 650854235 WHERE `entry` = 33203; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 25, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112 WHERE `entry` = 33202; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 10, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112 WHERE `entry` = 32919; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 45, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112 WHERE `entry` = 32916; + +-- Thorim +UPDATE `creature_template` SET `dmg_multiplier` = 60 WHERE `entry` = 32865; +UPDATE `creature_template` SET `dmg_multiplier` = 35 WHERE `entry` IN (32882, 32872, 32873); +UPDATE `creature_template` SET `dmg_multiplier` = 20 WHERE `entry` IN (32908, 32876, 32877, 32874, 33125); +UPDATE `creature_template` SET `dmg_multiplier` = 15 WHERE `entry` IN (32885, 33110, 32878); +UPDATE `creature_template` SET `dmg_multiplier` = 10 WHERE `entry` = 32904; + +-- Mimiron +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 75, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112 WHERE `entry` = 33432; + +-- Vezax +UPDATE `creature_template` SET `dmg_multiplier` = 65, `mingold` = 1720000, `maxgold` = 1760000 WHERE `entry` = 33271; + +-- 8362_boss_vezax +UPDATE `creature_template` SET `mechanic_immune_mask` = 617299803, `flags_extra` = 257, `ScriptName` = 'boss_general_vezax' WHERE `entry` = 33271; +UPDATE `creature_template` SET `faction_A` = 14, `faction_H` = 14, `mechanic_immune_mask` = 650854235, `ScriptName` = 'mob_saronite_vapors' WHERE `entry` = 33488; +UPDATE `creature_template` SET `faction_A` = 14, `faction_H` = 14, `mechanic_immune_mask` = 650854235, `ScriptName` = 'mob_saronite_animus' WHERE `entry` = 33524; + +-- 8378_ulduar_modelid +-- XT-002 +UPDATE `creature_model_info` SET `bounding_radius` = 0.465, `combat_reach` = 10 WHERE `modelid` = 28611; +UPDATE `creature_template` SET `dmg_multiplier` = 70 WHERE `entry` = 33293; +-- Assembly of Iron +UPDATE `creature_model_info` SET `bounding_radius` = 0.45, `combat_reach` = 25 WHERE `modelid` = 28313; +UPDATE `creature_model_info` SET `bounding_radius` = 0.45, `combat_reach` = 6 WHERE `modelid` = 28344; +UPDATE `creature_template` SET `mechanic_immune_mask` = 617299547 WHERE `entry` = 32857; +UPDATE `creature_template` SET `dmg_multiplier` = 60 WHERE `entry` = 32867; +UPDATE `creature_template` SET `dmg_multiplier` = 45 WHERE `entry` = 32927; +-- Kologarn +UPDATE `creature_model_info` SET `bounding_radius` = 0.465, `combat_reach` = 15 WHERE `modelid` = 28638; +UPDATE `creature_model_info` SET `bounding_radius` = 0.35, `combat_reach` = 15 WHERE `modelid` = 28821; +UPDATE `creature_model_info` SET `bounding_radius` = 0.35, `combat_reach` = 15 WHERE `modelid` = 28822; +UPDATE `creature_template` SET `baseattacktime` = 1800 WHERE `entry` = 32930; +-- Auriaya +UPDATE `creature_model_info` SET `bounding_radius` = 0.775, `combat_reach` = 5 WHERE `modelid` = 28651; +UPDATE `creature_template` SET `dmg_multiplier` = 60 WHERE `entry` = 33515; +-- Freya +UPDATE `creature_template` SET `baseattacktime` = 1500 WHERE `entry` = 32906; +-- Mimiron +UPDATE `creature_model_info` SET `bounding_radius` = 0.775, `combat_reach` = 7 WHERE `modelid` = 28831; +UPDATE `creature_model_info` SET `bounding_radius` = 0.775, `combat_reach` = 5 WHERE `modelid` = 28841; +UPDATE `creature_model_info` SET `bounding_radius` = 0.775, `combat_reach` = 4 WHERE `modelid` = 28979; +-- Genaral Vezax +UPDATE `creature_template` SET `baseattacktime` = 1800, `dmg_multiplier` = 45 WHERE `entry` = 33271; +UPDATE `creature_model_info` SET `bounding_radius` = 0.62, `combat_reach` = 12 WHERE `modelid` = 28548; +UPDATE `creature` SET `spawntimesecs` = 604800 WHERE `id` = 33838; + +-- 8406_emalon +UPDATE creature_template SET lootid = 33993, mindmg = 509, maxdmg = 683, attackpower = 805, dmg_multiplier = 35 WHERE entry = 33993; +UPDATE creature_template SET lootid = 33994, mindmg = 509, maxdmg = 683, attackpower = 805, dmg_multiplier = 70 WHERE entry = 33994; + +-- 8407_voa&emalon +UPDATE creature SET spawnMask = 1 WHERE id = 33993; +UPDATE creature_template SET faction_A = 16, faction_H = 16 WHERE entry = 33994; +UPDATE creature_template SET mindmg = 422, maxdmg = 586, attackpower = 642, dmg_multiplier = 7.5, minrangedmg = 345, maxrangedmg = 509, rangedattackpower = 103 WHERE entry = 33998; + +-- 8422 ulduar_loots_hardmode +UPDATE `creature_template` SET `unit_flags` = 2 WHERE `entry` = 33686; +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` = 33779; +DELETE FROM `creature_template` WHERE entry = 33115; +DELETE FROM creature WHERE id = 33115; + +-- Emblem of Valor +UPDATE creature_loot_template SET item = 40753 WHERE entry IN (33113, 33186, 33118, 33293, 32927, 32857, 33515, 33271) AND item = 45624; +UPDATE gameobject_loot_template SET item = 40753 WHERE entry IN (27061, 26963, 27078, 27081, 26955, 26946, 27068) AND item = 40752; + +-- Flame Leviathan +UPDATE `creature_template` SET `mechanic_immune_mask` = 617299803 WHERE `entry` = 33113; + +-- XT-002 Hardmode loot + +DELETE FROM `creature_loot_template` WHERE `entry`=33293; +INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('33293','40753','100','1','0','1','1'), +('33293','1','100','1','0','-34121','2'), +('33293','45867','0','2','2','1','1'), +('33293','45868','0','2','2','1','1'), +('33293','45869','0','2','2','1','1'), +('33293','45870','0','2','2','1','1'), +('33293','45871','0','2','2','1','1'); + +DELETE FROM `reference_loot_template` WHERE `entry`=34121; +INSERT INTO `reference_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('34121','45675','0','1','1','1','1'), +('34121','45676','0','1','1','1','1'), +('34121','45677','0','1','1','1','1'), +('34121','45679','0','1','1','1','1'), +('34121','45680','0','1','1','1','1'), +('34121','45682','0','1','1','1','1'), +('34121','45685','0','1','1','1','1'), +('34121','45686','0','1','1','1','1'), +('34121','45687','0','1','1','1','1'), +('34121','45694','0','1','1','1','1'); + +-- Assembly of Iron Hardmode loot + +DELETE FROM `creature_loot_template` WHERE `entry` IN (32857, 32927, 32867); +INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('32857','40753','100','1','0','1','1'), +('32857','1','100','1','0','-34122','2'), +('32927','40753','100','1','0','2','2'), +('32927','1','100','1','0','-34122','3'), +('32867','45624','100','1','0','1','1'), +('32867','1','100','1','0','-34122','2'), +('32867','45447','0','2','2','1','1'), +('32867','45448','0','2','2','1','1'), +('32867','45449','0','2','2','1','1'), +('32867','45455','0','2','2','1','1'), +('32867','45456','0','2','2','1','1'); + +DELETE FROM `reference_loot_template` WHERE `entry`=34122; +INSERT INTO `reference_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('34122','45322','0','1','1','1','1'), +('34122','45324','0','1','1','1','1'), +('34122','45329','0','1','1','1','1'), +('34122','45330','0','1','1','1','1'), +('34122','45331','0','1','1','1','1'), +('34122','45332','0','1','1','1','1'), +('34122','45333','0','1','1','1','1'), +('34122','45378','0','1','1','1','1'), +('34122','45418','0','1','1','1','1'), +('34122','45423','0','1','1','1','1'); + +-- Freya Hardmode loot + +UPDATE `creature_template` SET `mechanic_immune_mask` = 650853979 WHERE `entry` = 33203; +UPDATE `creature_template` SET `flags_extra` = 2 WHERE `entry` = 33215; +DELETE FROM `gameobject_loot_template` WHERE `entry` IN (27078, 27079, 27080, 27081); +INSERT INTO `gameobject_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('27078','1','100','1','0','-34125','1'), +('27078','2','100','1','0','-34105','1'), +('27078','40753','100','1','0','1','1'), +('27078','45087','100','1','0','1','1'), +('27078','45644','0','1','1','1','1'), +('27078','45645','0','1','1','1','1'), +('27078','45646','0','1','1','1','1'), +('27078','46110','100','1','0','1','1'), +('27079','1','100','1','0','-34125','2'), +('27079','2','100','1','0','-34105','1'), +('27079','40753','100','1','0','1','1'), +('27079','45087','100','1','0','1','1'), +('27079','45644','0','1','1','1','1'), +('27079','45645','0','1','1','1','1'), +('27079','45646','0','1','1','1','1'), +('27079','46110','100','1','0','1','1'), +('27080','1','100','1','0','-34125','2'), +('27080','2','100','1','0','-34105','1'), +('27080','40753','100','1','0','2','2'), +('27080','45087','100','1','0','1','1'), +('27080','45644','0','1','1','1','1'), +('27080','45645','0','1','1','1','1'), +('27080','45646','0','1','1','1','1'), +('27080','46110','100','1','0','1','1'), +('27081','1','100','1','0','-34125','1'), +('27081','2','100','1','0','-34105','1'), +('27081','45943','0','1','2','1','1'), +('27081','45945','0','1','2','1','1'), +('27081','45946','0','1','2','1','1'), +('27081','45294','0','1','2','1','1'), +('27081','45947','0','1','2','1','1'), +('27081','45624','100','1','0','1','1'), +('27081','45087','100','1','0','1','1'), +('27081','45644','0','1','1','1','1'), +('27081','45645','0','1','1','1','1'), +('27081','45646','0','1','1','1','1'), +('27081','45788','-100','1','0','1','1'), +('27081','46110','100','1','0','1','1'); + +DELETE FROM `gameobject_template` WHERE entry = 194326; +INSERT INTO `gameobject_template` VALUES('194326','3','8628','Freya\'s Gift','','','','0','0','2','0','0','0','0','0','0','1634','27080','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11159'); + +DELETE FROM `reference_loot_template` WHERE `entry`=34125; +INSERT INTO `reference_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('34125','45934','0','1','1','1','1'), +('34125','45935','0','1','1','1','1'), +('34125','45936','0','1','1','1','1'), +('34125','45940','0','1','1','1','1'), +('34125','45941','0','1','1','1','1'); + +-- Hodir Harmode loot + +UPDATE script_texts SET `type` = 2 WHERE entry = -1603218; +DELETE FROM `gameobject` WHERE `id`=194200; +INSERT INTO `gameobject` (`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(194200, 603, 1, 1, 2038.29, -200.702, 432.687, 3.12232, 0, 0, 1, 0, 300, 0, 1); + +DELETE FROM `gameobject_loot_template` WHERE entry=27069; +INSERT INTO `gameobject_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('27069','45624','100','1','0','1','1'), +('27069','45888','0','1','1','1','1'), +('27069','45886','0','1','1','1','1'), +('27069','45887','0','1','1','1','1'), +('27069','45877','0','1','1','1','1'), +('27069','45876','0','1','1','1','1'), +('27069','45786','-100','1','0','1','1'); + +-- Thorim Hardmode loot + +DELETE FROM `gameobject` WHERE `id`=194314; +UPDATE `gameobject_template` SET `faction` = 0, `flags` = 0 WHERE `entry` IN (194312, 194313); + +DELETE FROM `gameobject_loot_template` WHERE entry IN (27073, 27074); +INSERT INTO `gameobject_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('27073','40753','100','1','0','1','1'), +('27073','1','100','1','0','-34130','1'), +('27073','45659','0','1','1','1','1'), +('27073','45660','0','1','1','1','1'), +('27073','45661','0','1','1','1','1'), +('27074','45624','100','1','0','1','1'), +('27074','1','100','1','0','-34130','1'), +('27074','45928','0','1','2','1','1'), +('27074','45929','0','1','2','1','1'), +('27074','45930','0','1','2','1','1'), +('27074','45931','0','1','2','1','1'), +('27074','45933','0','1','2','1','1'), +('27074','45659','0','1','1','1','1'), +('27074','45660','0','1','1','1','1'), +('27074','45661','0','1','1','1','1'), +('27074','45784','-100','3','0','1','1'); + +DELETE FROM `reference_loot_template` WHERE entry = 34130; +INSERT INTO `reference_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('34130','45892','0','1','1','1','1'), +('34130','45893','0','1','1','1','1'), +('34130','45894','0','1','1','1','1'), +('34130','45895','0','1','1','1','1'), +('34130','45927','0','1','1','1','1'); + +-- Mimiron Hardmode loot + +DELETE FROM `gameobject` WHERE `id`=194956; +DELETE FROM `gameobject_template` WHERE entry = 194790; +INSERT INTO `gameobject_template` VALUES ('194790','3','8686','Cache of Innovation','','','','0','0','1.5','0','0','0','0','0','0','1634','27086','0','1','0','0','0','0','0','0','0','1','0','1','0','1','0','0','0','0','0','0','0','0','','11159'); + +DELETE FROM `gameobject_loot_template` WHERE entry IN (27085, 27086); +INSERT INTO `gameobject_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('27085','40753','100','1','0','1','1'), +('27085','1','100','1','0','-34129','1'), +('27085','45647','0','1','1','1','1'), +('27085','45648','0','1','1','1','1'), +('27085','45649','0','1','1','1','1'), +('27086','45624','100','1','0','1','1'), +('27086','1','100','1','0','-34129','1'), +('27086','45982','0','1','2','1','1'), +('27086','45988','0','1','2','1','1'), +('27086','45989','0','1','2','1','1'), +('27086','45990','0','1','2','1','1'), +('27086','45993','0','1','2','1','1'), +('27086','45647','0','1','1','1','1'), +('27086','45648','0','1','1','1','1'), +('27086','45649','0','1','1','1','1'), +('27086','45787','-100','1','0','1','1'); + +DELETE FROM `reference_loot_template` WHERE entry = 34129; +INSERT INTO `reference_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('34129','45972','0','1','1','1','1'), +('34129','45973','0','1','1','1','1'), +('34129','45974','0','1','1','1','1'), +('34129','45975','0','1','1','1','1'), +('34129','45976','0','1','1','1','1'); + +-- General Vezax Hardmode loot + +DELETE FROM `creature_loot_template` WHERE entry = 33271; +INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('33271','40753','100','1','0','1','1'), +('33271','1','100','1','0','-34131','2'), +('33271','46032','0','2','2','1','1'), +('33271','46033','0','2','2','1','1'), +('33271','46034','0','2','2','1','1'), +('33271','46035','0','2','2','1','1'), +('33271','46036','0','2','2','1','1'); + +DELETE FROM `reference_loot_template` WHERE entry = 34131; +INSERT INTO `reference_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +('34131','45996','0','1','1','1','1'), +('34131','45997','0','1','1','1','1'), +('34131','46008','0','1','1','1','1'), +('34131','46009','0','1','1','1','1'), +('34131','46010','0','1','1','1','1'), +('34131','46011','0','1','1','1','1'), +('34131','46012','0','1','1','1','1'), +('34131','46013','0','1','1','1','1'), +('34131','46014','0','1','1','1','1'), +('34131','46015','0','1','1','1','1'); + +-- 8410_vezax_animus +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 25, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112 WHERE `entry` = 33524; +UPDATE `creature_model_info` SET `bounding_radius` = 0.62, `combat_reach` = 10 WHERE `modelid` = 28992; + +-- mimiron_hardmode +UPDATE `gameobject_template` SET `type` = 1, `flags` = 32, `ScriptName` = 'not_push_button' WHERE `entry` = 194739; +UPDATE `creature_template` SET `unit_flags` = 33554946, `speed_walk` = 0.15, `speed_run` = 0.15, `ScriptName` = 'mob_mimiron_flame' WHERE `entry` = 34363; +UPDATE `creature_template` SET `faction_A` = 14, `faction_H` = 14, `ScriptName` = 'mob_frost_bomb' WHERE `entry` = 34149; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 7.5, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112, `ScriptName` = 'mob_junk_bot' WHERE `entry` = 33855; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 15, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112, `ScriptName` = 'mob_assault_bot' WHERE `entry` = 34057; +UPDATE `creature_template` SET `mindmg` = 464, `maxdmg` = 604, `attackpower` = 708, `dmg_multiplier` = 10, `minrangedmg` = 353, `maxrangedmg` = 512, `rangedattackpower` = 112, `ScriptName` = 'mob_boom_bot' WHERE `entry` = 33836; +UPDATE `creature_template` SET `faction_A` = 14, `faction_H` = 14, `ScriptName` = 'mob_emergency_bot' WHERE `entry` = 34147; + +-- 8407_emalon +UPDATE creature SET spawnMask = 1 WHERE id = 33993; +UPDATE creature_template SET faction_A = 16, faction_H = 16 WHERE entry = 33994; +UPDATE creature_template SET mindmg = 422, maxdmg = 586, attackpower = 642, dmg_multiplier = 7.5, minrangedmg = 345, maxrangedmg = 509, rangedattackpower = 103 WHERE entry = 33998; + +-- 8429_leviathan_encounter +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=62475; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +('62475','9032','2','System Shutdown'); + +DELETE FROM areatrigger_scripts WHERE entry IN (5369, 5423); +INSERT INTO areatrigger_scripts VALUES +(5369,'at_RX_214_repair_o_matic_station'), +(5423,'at_RX_214_repair_o_matic_station'); + +-- 8436_dalaran_teleporter +UPDATE `gameobject_template` SET `type` = 22, `data0` = 53141, `data2` = 1, `data3` = 1 WHERE `entry` = 194481; + +-- 8440_achievement_antechamber +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (10578, 10579, 10580, 10581); +INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`) VALUES +(10578, 12, 0, 0), +(10580, 12, 0, 0), +(10579, 12, 1, 0), +(10581, 12, 1, 0); + +-- 8441_bind +UPDATE `creature_template` SET Health_mod = 50 WHERE `entry` = 33109; +UPDATE `creature_template` SET Health_mod = 90 WHERE `entry` = 33060; +UPDATE `creature_template` SET Health_mod = 40 WHERE `entry` = 33062; + +UPDATE `creature_template` SET `dmg_multiplier` = 55, `flags_extra` = 9 WHERE `entry` = 33118; +UPDATE `creature_template` SET `dmg_multiplier` = 50, flags_extra = 1 WHERE `entry` = 33186; +UPDATE `creature_template` SET `dmg_multiplier` = 75, flags_extra = 1 WHERE `entry` = 33293; +UPDATE `creature_template` SET flags_extra = 257 WHERE entry IN (33113, 33271); +UPDATE `creature_template` SET flags_extra = 1 WHERE entry IN (32867, 32927, 32857, 32930, 33515, 32906, 32845, 33350, 33432, 33651, 33670, 32865, 33288); + +-- 8441_achievement_keepers +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (10598, 10599, 10559, 10444, 10563, 10455, 10558, 10438, 10561, 10454, 10408, 10560, 10453, 10562); +INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`) VALUES +-- Freya +(10559, 12, 0, 0), +(10444, 12, 0, 0), +(10563, 12, 1, 0), +(10455, 12, 1, 0), +-- Thorim +(10558, 12, 0, 0), +(10438, 12, 0, 0), +(10561, 12, 1, 0), +(10454, 12, 1, 0), +-- Hodir +(10408, 12, 0, 0), +(10560, 12, 0, 0), +(10453, 12, 1, 0), +(10562, 12, 1, 0); + +-- 8447 +-- dalaran portal +UPDATE `gameobject_template` SET `faction` = 2007, `data0` = 53141, `data2` = 0 WHERE `entry` = 194481; + +-- 8444_ulduar_bind +UPDATE `creature_template` SET Health_mod = 50 WHERE `entry` = 33109; +UPDATE `creature_template` SET Health_mod = 90 WHERE `entry` = 33060; +UPDATE `creature_template` SET Health_mod = 40 WHERE `entry` = 33062; + +UPDATE `creature_template` SET `dmg_multiplier` = 55, `flags_extra` = 9 WHERE `entry` = 33118; +UPDATE `creature_template` SET `dmg_multiplier` = 50, flags_extra = 1 WHERE `entry` = 33186; +UPDATE `creature_template` SET `dmg_multiplier` = 75, flags_extra = 1 WHERE `entry` = 33293; +UPDATE `creature_template` SET flags_extra = 257 WHERE entry IN (33113, 33271); +UPDATE `creature_template` SET flags_extra = 1 WHERE entry IN (32867, 32927, 32857, 32930, 33515, 32906, 32845, 33350, 33432, 33651, 33670, 32865, 33288); + +-- 8451_vehicle_regen +-- Ulduar vehicle regen and Freya's Healthy Spores +UPDATE `creature_template` SET `flags_extra` = 0 WHERE `entry` = 33215; +UPDATE `creature_template` SET `RegenHealth` = 0 WHERE `entry` IN (33060, 33062, 33109); + +-- 8452_keepers_images +-- Ulduar Keepers Images +DELETE FROM `creature` WHERE `id` IN (33213, 33241, 33242, 33244); +INSERT INTO `creature` (`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`DeathState`,`MovementType`) VALUES +(33241, 603, 1, 1, 0, 0, 2057.81, -24.0768, 421.532, 3.12904, 604800, 0, 0, 14433075, 0, 0, 0), +(33242, 603, 1, 1, 0, 0, 2036.81, -73.7053, 411.353, 2.43575, 604800, 0, 0, 14433075, 0, 0, 0), +(33244, 603, 1, 1, 0, 0, 2036.74, 25.4642, 411.357, 3.81412, 604800, 0, 0, 14433075, 0, 0, 0), +(33213, 603, 1, 1, 0, 0, 1939.29, -90.6994, 411.357, 1.02595, 604800, 0, 0, 14433075, 0, 0, 0); + +UPDATE `creature_template` SET `faction_A` = 35, `faction_H` = 35, `npcflag` = 1, `flags_extra` = 2, `ScriptName` = 'npc_keeper_image' WHERE `entry` IN (33213, 33241, 33242, 33244); + +-- 8453_razorscale_yell +-- razorscale yell fix +UPDATE `script_texts` SET `content_default` = "Move! Quickly! She won't remain grounded for long.", `type` = 1 WHERE `entry` = -1603261; + + + +-- script names faltantes +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_ironbranch' WHERE `entry` =32913; +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_stonebark' WHERE `entry` =32914; +UPDATE `creature_template` SET `ScriptName` = 'boss_elder_brightleaf' WHERE `entry` =32195; +UPDATE `creature_template` SET `ScriptName` = 'creature_iron_roots' WHERE `entry` =33088; +UPDATE `creature_template` SET `ScriptName` = 'creature_sun_beam' WHERE `entry` =33170; \ No newline at end of file diff --git a/sql/wow_ro/Wintergrasp/world_command.sql b/sql/wow_ro/Wintergrasp/world_command.sql new file mode 100644 index 0000000..746e12d --- /dev/null +++ b/sql/wow_ro/Wintergrasp/world_command.sql @@ -0,0 +1,8 @@ +DELETE FROM `command` WHERE name IN ('wg','wg enable','wg start','wg status','wg stop','wg switch','wg timer'); +INSERT INTO `command` VALUES ('wg', '3', 'Syntax: .wg $subcommand.'); +INSERT INTO `command` VALUES ('wg enable', '3', 'Syntax: .wg enable [on/off] Enable/Disable Wintergrasp outdoorPvP.'); +INSERT INTO `command` VALUES ('wg start', '3', 'Syntax: .wg start\r\nForce Wintergrasp battle start.'); +INSERT INTO `command` VALUES ('wg status', '3', 'Syntax: .wg status\r\nWintergrasp info, defender, timer, wartime.'); +INSERT INTO `command` VALUES ('wg stop', '3', 'Syntax: .wg stop\r\nForce Wintergrasp battle stop (No rewards).'); +INSERT INTO `command` VALUES ('wg switch', '3', 'Syntax: .wg switch\r\nSwitchs Wintergrasp defender team.'); +INSERT INTO `command` VALUES ('wg timer', '3', 'Syntax: .wg timer $minutes\r\nChange the current timer. Min value = 1, Max value 60 (Wartime), 1440 (Not Wartime)'); diff --git a/sql/wow_ro/Wintergrasp/world_gameobject.sql b/sql/wow_ro/Wintergrasp/world_gameobject.sql new file mode 100644 index 0000000..ef6ac71 --- /dev/null +++ b/sql/wow_ro/Wintergrasp/world_gameobject.sql @@ -0,0 +1,6 @@ +/* Temp removed gameobject stopping you getting to the relic +* 60070 - [Wintergrasp Keep Collision Wall X:5396.209961 Y:2840.010010 Z:432.268005 MapId:571 +* 60476 - [Doodad_WG_Keep_Door01_collision01 X:5397.109863 Y:2841.540039 Z:425.901001 MapId:571]*/ +DELETE FROM gameobject WHERE guid = '60070'; +DELETE FROM gameobject WHERE guid = '60476'; + diff --git a/sql/wow_ro/Wintergrasp/world_gameobject_template.sql b/sql/wow_ro/Wintergrasp/world_gameobject_template.sql new file mode 100644 index 0000000..71e5955 --- /dev/null +++ b/sql/wow_ro/Wintergrasp/world_gameobject_template.sql @@ -0,0 +1,2 @@ +/* Change incorrect spells used by Defender's Portal's */ +UPDATE `gameobject_template` SET `data0`=54643 WHERE `entry` in(190763,192819); diff --git a/sql/wow_ro/Wintergrasp/world_trinity_string.sql b/sql/wow_ro/Wintergrasp/world_trinity_string.sql new file mode 100644 index 0000000..35280e3 --- /dev/null +++ b/sql/wow_ro/Wintergrasp/world_trinity_string.sql @@ -0,0 +1,22 @@ +DELETE FROM `trinity_string` WHERE entry IN (756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,780,781); +INSERT INTO `trinity_string` VALUES ('756', 'Battle begins!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('757', '%s has successfully defended the fortress!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('758', '%s has taken over the fortress!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('759', 'The %s siege workshop has been damaged by the %s!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('760', 'The %s siege workshop has been destroyed by the %s!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('761', 'The %s tower has been damaged!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('762', 'The %s tower has been destroyed!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('763', 'Wintergrasp fortress is under attack!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('764', 'Wintergrasp is now under the control of the %s.', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('765', 'Wintergrasp timer set to %s.', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('766', 'Wintergrasp battle started.', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('767', 'Wintergrasp battle finished.', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('768', 'Wintergrasp info: %s controlled. Timer: %s. Wartime: %s. Number of Players: (Horde: %u, Alliance: %u)', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('769', 'Wintergrasp outdoorPvP is disabled.', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('770', 'Wintergrasp outdoorPvP is enabled.', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('771', 'You have reached Rank 1: Corporal', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('772', 'You have reached Rank 2: First Lieutenant', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('773', 'Not enough players to begin the battle.', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('780', '30 minutes left before the battle of Wintergrasp!', '', '', '', '', '', '', '', ''); +INSERT INTO `trinity_string` VALUES ('781', '10 minutes left before the battle of Wintergrasp!', '', '', '', '', '', '', '', ''); + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..b640a62 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,16 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +add_subdirectory(server) +add_subdirectory(tools/git_id) +if(DO_TOOLS) + add_subdirectory(tools) +endif(DO_TOOLS) + diff --git a/src/genrevision/genrevision.cpp b/src/genrevision/genrevision.cpp new file mode 100644 index 0000000..71ca155 --- /dev/null +++ b/src/genrevision/genrevision.cpp @@ -0,0 +1,515 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include + +#pragma warning(disable:4996) + +std::string build_directive; + +struct RawData +{ + char hash_str[200]; + char rev_str[200]; + char date_str[200]; + char time_str[200]; +}; + +void extractDataFromSvn(FILE* EntriesFile, bool url, RawData& data) +{ + char buf[200]; + + char repo_str[200]; + char num_str[200]; + + fgets(buf,200,EntriesFile); + fgets(buf,200,EntriesFile); + fgets(buf,200,EntriesFile); + fgets(buf,200,EntriesFile); sscanf(buf,"%s",num_str); + fgets(buf,200,EntriesFile); sscanf(buf,"%s",repo_str); + fgets(buf,200,EntriesFile); + fgets(buf,200,EntriesFile); + fgets(buf,200,EntriesFile); + fgets(buf,200,EntriesFile); + fgets(buf,200,EntriesFile); sscanf(buf,"%10sT%8s",data.date_str,data.time_str); + + if(url) + sprintf(data.rev_str,"%s at %s",num_str,repo_str); + else + strcpy(data.rev_str,num_str); +} + +void extractDataFromHG(FILE* EntriesFile, std::string path, bool url, RawData& data) +{ + char buf[200]; + + char hash_str[200]; + char revision_str[200]; + + bool found = false; + while(fgets(buf,200,EntriesFile)) + { + if(sscanf(buf,"%s %s",hash_str,revision_str)==2) + { + found = true; + break; + } + } + + if(!found) + { + strcpy(data.hash_str,"*"); + strcpy(data.rev_str,"*"); + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); + return; + } + + char thash_str[200]; + for (int i = 11; i >= 0; --i) + { + thash_str[i] = hash_str[i]; + } + thash_str[12] = '\0'; + + strcpy(data.hash_str,thash_str); + strcpy(data.rev_str,revision_str); + + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); +} + +void extractDataFromArchive(FILE* EntriesFile, std::string path, bool url, RawData& data) +{ + char buf[200]; + + char hash_str[200]; + char revision_str[200]; + + bool found = false; + fgets(buf,200,EntriesFile); + while(fgets(buf,200,EntriesFile)) + { + if(sscanf(buf,"%s %s",revision_str,hash_str)==2) + { + found = true; + break; + } + } + + if(!found) + { + strcpy(data.hash_str,"*"); + strcpy(data.rev_str,"*"); + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); + return; + } + + char thash_str[200]; + for (int i = 11; i >= 0; --i) + { + thash_str[i] = hash_str[i]; + } + thash_str[12] = '\0'; + + strcpy(data.hash_str,thash_str); + strcpy(data.rev_str,"Archive"); + + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); +} + +void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& data) +{ + char buf[200]; + + char hash_str[200]; + char branch_str[200]; + char url_str[200]; + + bool found = false; + while(fgets(buf,200,EntriesFile)) + { + if(sscanf(buf,"%s\t\tbranch %s of %s",hash_str,branch_str,url_str)==3) + { + found = true; + break; + } + } + + if(!found) + { + strcpy(data.hash_str,"*"); + strcpy(data.rev_str,"*"); + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); + return; + } + + if(url) + { + char* host_str = NULL; + char* acc_str = NULL; + char* repo_str = NULL; + + // parse URL like git@github.com:mangos/mangos + char url_buf[200]; + int res = sscanf(url_str,"git@%s",url_buf); + if(res) + { + host_str = strtok(url_buf,":"); + acc_str = strtok(NULL,"/"); + repo_str = strtok(NULL," "); + } + else + { + res = sscanf(url_str,"git://%s",url_buf); + if(res) + { + host_str = strtok(url_buf,"/"); + acc_str = strtok(NULL,"/"); + repo_str = strtok(NULL,"."); + } + } + + // can generate nice link + if(res) + sprintf(data.rev_str,"http://%s/%s/%s/commit/%s",host_str,acc_str,repo_str,hash_str); + // unknonw URL format, use as-is + else + sprintf(data.rev_str,"%s at %s",hash_str,url_str); + } + else + strcpy(data.rev_str,hash_str); + strcpy(data.hash_str,"*"); + + + time_t rev_time = 0; + // extracting date/time + FILE* LogFile = fopen((path+".git/logs/HEAD").c_str(), "r"); + if(LogFile) + { + while(fgets(buf,200,LogFile)) + { + char buf2[200]; + char new_hash[200]; + int unix_time = 0; + int res2 = sscanf(buf,"%s %s %s %s %i",buf2,new_hash,buf2,buf2,&unix_time); + if(res2!=5) + continue; + + if(strcmp(hash_str,new_hash)) + continue; + + rev_time = unix_time; + break; + } + + fclose(LogFile); + + if(rev_time) + { + tm* aTm = localtime(&rev_time); + // YYYY year + // MM month (2 digits 01-12) + // DD day (2 digits 01-31) + // HH hour (2 digits 00-23) + // MM minutes (2 digits 00-59) + // SS seconds (2 digits 00-59) + sprintf(data.date_str,"%04d-%02d-%02d",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday); + sprintf(data.time_str,"%02d:%02d:%02d",aTm->tm_hour,aTm->tm_min,aTm->tm_sec); + } + else + { + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); + } + } + else + { + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); + } +} + +bool extractDataFromSvn(std::string filename, bool url, RawData& data) +{ + FILE* EntriesFile = fopen(filename.c_str(), "r"); + if(!EntriesFile) + return false; + + extractDataFromSvn(EntriesFile,url,data); + fclose(EntriesFile); + return true; +} + +bool extractDataFromGit(std::string filename, std::string path, bool url, RawData& data) +{ + FILE* EntriesFile = fopen(filename.c_str(), "r"); + if(!EntriesFile) + return false; + + extractDataFromGit(EntriesFile,path,url,data); + fclose(EntriesFile); + return true; +} + +bool extractDataFromHG(std::string filename, std::string path, bool url, RawData& data) +{ + FILE* EntriesFile = fopen(filename.c_str(), "r"); + if(!EntriesFile) + return false; + + extractDataFromHG(EntriesFile,path,url,data); + fclose(EntriesFile); + return true; +} + +bool extractDataFromArchive(std::string filename, std::string path, bool url, RawData& data) +{ + FILE* EntriesFile = fopen(filename.c_str(), "r"); + if(!EntriesFile) + return false; + + extractDataFromArchive(EntriesFile,path,url,data); + fclose(EntriesFile); + return true; +} + +std::string generateHeader(char const* rev_str, char const* date_str, char const* time_str, char const* hash_str) +{ + std::ostringstream newData; + newData << "#ifndef __REVISION_H__" << std::endl; + newData << "#define __REVISION_H__" << std::endl; + newData << " #define _BUILD_DIRECTIVE \"" << build_directive << "\"" << std::endl; + newData << " #define _REVISION \"" << rev_str << "\"" << std::endl; + newData << " #define _HASH \"" << hash_str << "\"" << std::endl; + newData << " #define _REVISION_DATE \"" << date_str << "\"" << std::endl; + newData << " #define _REVISION_TIME \"" << time_str << "\""<< std::endl; + if (!strcmp(rev_str,"Archive") || !strcmp(rev_str,"*")) + { + newData << " #define FILEVER 0,0,0,0"<< std::endl; + newData << " #define PRODUCTVER 0,0,0,0"<< std::endl; + } + else + { + newData << " #define FILEVER 0,0," << rev_str << ",0"<< std::endl; + newData << " #define PRODUCTVER 0,0," << rev_str << ",0"<< std::endl; + } + newData << " #define STRFILEVER \"0, 0, " << rev_str << ", " << hash_str << "\""<< std::endl; + newData << " #define STRPRODUCTVER \"0, 0, " << rev_str << ", " << hash_str << "\""<< std::endl; + newData << "#endif // __REVISION_H__" << std::endl; + + return newData.str(); +} + +int main(int argc, char **argv) +{ + bool use_url = false; + bool hg_prefered = true; + bool git_prefered = false; + bool svn_prefered = false; + bool debug = false; + std::string path; + + // Call: tool {options} [path] + // -h use hg prefered (default) + // -g use git prefered + // -s use svn prefered + // -r use only revision (without repo URL) (default) + // -u include repositire URL as commit URL or "rev at URL" + // -d compile directive debug + for (int k = 1; k <= argc; ++k) + { + if(!argv[k] || !*argv[k]) + break; + + if(argv[k][0]!='-') + { + path = argv[k]; + if(path.size() > 0 && (path[path.size()-1]!='/' || path[path.size()-1]!='\\')) + path += '/'; + break; + } + + switch(argv[k][1]) + { + case 'h': + hg_prefered = true; + git_prefered = false; + svn_prefered = false; + continue; + case 'g': + hg_prefered = false; + git_prefered = true; + svn_prefered = false; + continue; + case 'r': + use_url = false; + continue; + case 's': + hg_prefered = false; + git_prefered = false; + svn_prefered = true; + continue; + case 'u': + use_url = true; + continue; + case 'd': + debug = true; + continue; + default: + printf("Unknown option %s",argv[k]); + return 1; + } + } + + if (debug) + build_directive = "Debug"; + else + build_directive = "Release"; + + /// new data extraction + std::string newData; + + { + RawData data; + + bool res = false; + + if(svn_prefered) + { + /// SVN data + res = extractDataFromSvn(path+".svn/entries",use_url,data); + if (!res) + res = extractDataFromSvn(path+"_svn/entries",use_url,data); + // HG data + if (!res) + res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+".hg/branch.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branch.cache",path,use_url,data); + // GIT data + if (!res) + res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data); + if (!res) + res = extractDataFromGit(path+"_git/FETCH_HEAD",path,use_url,data); + // Archive data + if (!res) + res = extractDataFromArchive(path+".hg_archival.txt",path,use_url,data); + if (!res) + res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data); + } + else if(git_prefered) + { + // GIT data + res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data); + if (!res) + res = extractDataFromGit(path+"_git/FETCH_HEAD",path,use_url,data); + // HG data + if (!res) + res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+".hg/branch.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branch.cache",path,use_url,data); + /// SVN data + if (!res) + res = extractDataFromSvn(path+".svn/entries",use_url,data); + if (!res) + res = extractDataFromSvn(path+"_svn/entries",use_url,data); + // Archive data + if (!res) + res = extractDataFromArchive(path+".hg_archival.txt",path,use_url,data); + if (!res) + res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data); + } + + + else if(hg_prefered) + { + // HG data + res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+".hg/branch.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branch.cache",path,use_url,data); + /// SVN data + if (!res) + res = extractDataFromSvn(path+".svn/entries",use_url,data); + if (!res) + res = extractDataFromSvn(path+"_svn/entries",use_url,data); + // GIT data + if (!res) + res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data); + if (!res) + res = extractDataFromGit(path+"_git/FETCH_HEAD",path,use_url,data); + // Archive data + if (!res) + res = extractDataFromArchive(path+".hg_archival.txt",path,use_url,data); + if (!res) + res = extractDataFromArchive(path+"_hg_archival.txt",path,use_url,data); + } + + if(res) + newData = generateHeader(data.rev_str,data.date_str,data.time_str,data.hash_str); + else + newData = generateHeader("*", "*", "*", "*"); + } + + /// get existed header data for compare + std::string oldData; + + if(FILE* HeaderFile = fopen("revision.h","rb")) + { + while(!feof(HeaderFile)) + { + int c = fgetc(HeaderFile); + if(c < 0) + break; + oldData += (char)c; + } + + fclose(HeaderFile); + } + + /// update header only if different data + if(newData != oldData) + { + if(FILE* OutputFile = fopen("revision.h","wb")) + { + fprintf(OutputFile,"%s",newData.c_str()); + fclose(OutputFile); + } + } + + return 0; +} + diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt new file mode 100644 index 0000000..5d9b3b2 --- /dev/null +++ b/src/server/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +if(DO_WORLDSERVER) + add_subdirectory(shared) + add_subdirectory(game) + add_subdirectory(collision) + if(DO_SCRIPTS) + add_subdirectory(scripts) + endif() + add_subdirectory(worldserver) +else() + if(DO_TOOLS) + add_subdirectory(collision) + endif() +endif() + +if (DO_AUTHSERVER) + if(NOT DO_WORLDSERVER) + add_subdirectory(shared) + endif() + add_subdirectory(authserver) +endif() diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp new file mode 100644 index 0000000..812949e --- /dev/null +++ b/src/server/authserver/Authentication/AuthCodes.cpp @@ -0,0 +1,37 @@ +#include "AuthCodes.h" + +namespace AuthHelper +{ + +bool IsPreBCAcceptedClientBuild(int build) +{ + int accepted_versions[] = PRE_BC_ACCEPTED_CLIENT_BUILD; + for (int i = 0; accepted_versions[i]; ++i) + { + if (build == accepted_versions[i]) + { + return true; + } + } + return false; +} + +bool IsPostBCAcceptedClientBuild(int build) +{ + int accepted_versions[] = POST_BC_ACCEPTED_CLIENT_BUILD; + for (int i = 0; accepted_versions[i]; ++i) + { + if (build == accepted_versions[i]) + { + return true; + } + } + return false; +} + +bool IsAcceptedClientBuild(int build) +{ + return (IsPostBCAcceptedClientBuild(build) || IsPreBCAcceptedClientBuild(build)); +} + +}; diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h new file mode 100644 index 0000000..802b7b7 --- /dev/null +++ b/src/server/authserver/Authentication/AuthCodes.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd +*/ + +#ifndef _AUTHCODES_H +#define _AUTHCODES_H + +enum AuthResult +{ + WOW_SUCCESS = 0x00, + WOW_FAIL_UNKNOWN0 = 0x01, ///< ? Unable to connect + WOW_FAIL_UNKNOWN1 = 0x02, ///< ? Unable to connect + WOW_FAIL_BANNED = 0x03, ///< This account has been closed and is no longer available for use. Please go to /banned.html for further information. + WOW_FAIL_UNKNOWN_ACCOUNT = 0x04, ///< The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password, see for more information + WOW_FAIL_INCORRECT_PASSWORD = 0x05, ///< The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password, see for more information + WOW_FAIL_ALREADY_ONLINE = 0x06, ///< This account is already logged into . Please check the spelling and try again. + WOW_FAIL_NO_TIME = 0x07, ///< You have used up your prepaid time for this account. Please purchase more to continue playing + WOW_FAIL_DB_BUSY = 0x08, ///< Could not log in to at this time. Please try again later. + WOW_FAIL_VERSION_INVALID = 0x09, ///< Unable to validate game version. This may be caused by file corruption or interference of another program. Please visit for more information and possible solutions to this issue. + WOW_FAIL_VERSION_UPDATE = 0x0A, ///< Downloading + WOW_FAIL_INVALID_SERVER = 0x0B, ///< Unable to connect + WOW_FAIL_SUSPENDED = 0x0C, ///< This account has been temporarily suspended. Please go to /banned.html for further information + WOW_FAIL_FAIL_NOACCESS = 0x0D, ///< Unable to connect + WOW_SUCCESS_SURVEY = 0x0E, ///< Connected. + WOW_FAIL_PARENTCONTROL = 0x0F, ///< Access to this account has been blocked by parental controls. Your settings may be changed in your account preferences at + WOW_FAIL_LOCKED_ENFORCED = 0x10, ///< You have applied a lock to your account. You can change your locked status by calling your account lock phone number. + WOW_FAIL_TRIAL_ENDED = 0x11, ///< Your trial subscription has expired. Please visit to upgrade your account. + WOW_FAIL_USE_BATTLENET = 0x12, ///< WOW_FAIL_OTHER This account is now attached to a Battle.net account. Please login with your Battle.net account email address and password. +}; + +enum LoginResult +{ + LOGIN_OK = 0x00, + LOGIN_FAILED = 0x01, + LOGIN_FAILED2 = 0x02, + LOGIN_BANNED = 0x03, + LOGIN_UNKNOWN_ACCOUNT = 0x04, + LOGIN_UNKNOWN_ACCOUNT3 = 0x05, + LOGIN_ALREADYONLINE = 0x06, + LOGIN_NOTIME = 0x07, + LOGIN_DBBUSY = 0x08, + LOGIN_BADVERSION = 0x09, + LOGIN_DOWNLOAD_FILE = 0x0A, + LOGIN_FAILED3 = 0x0B, + LOGIN_SUSPENDED = 0x0C, + LOGIN_FAILED4 = 0x0D, + LOGIN_CONNECTED = 0x0E, + LOGIN_PARENTALCONTROL = 0x0F, + LOGIN_LOCKED_ENFORCED = 0x10, +}; + +//multirealm supported versions: +//1.12.1 build 5875 +//1.12.2 build 6005 +//2.4.3 build 8606 +//3.1.3 build 9947 +//3.1.3 build 10146 Chinese build +//3.2.2a build 10505 +//3.3.0a build 11159 +//3.3.2 build 11403 +//3.3.3a build 11723 + +#define POST_BC_ACCEPTED_CLIENT_BUILD {12340, 11723, 11403, 11159, 10571, 10505, 10146, 9947, 8606, 0} +#define PRE_BC_ACCEPTED_CLIENT_BUILD {5875, 6005, 0} + +#define POST_BC_EXP_FLAG 0x2 +#define PRE_BC_EXP_FLAG 0x1 +#define NO_VALID_EXP_FLAG 0x0 + +namespace AuthHelper +{ + bool IsAcceptedClientBuild(int build); + bool IsPostBCAcceptedClientBuild(int build); + bool IsPreBCAcceptedClientBuild(int build); +}; + +#endif diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt new file mode 100644 index 0000000..82b36c8 --- /dev/null +++ b/src/server/authserver/CMakeLists.txt @@ -0,0 +1,88 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +########### authserver ############### + +set(authserver_SRCS + Authentication/AuthCodes.cpp + Realms/RealmList.cpp + Server/AuthSocket.cpp + Server/RealmSocket.cpp + Main.cpp +) + +include_directories( + ${ACE_INCLUDE_DIR} + ${MYSQL_INCLUDE_DIR} + ${OPENSSL_INCLUDE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/src/server/shared + ${CMAKE_SOURCE_DIR}/src/server/shared/Database + ${CMAKE_SOURCE_DIR}/src/server/shared/Packets + ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography + ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication + ${CMAKE_SOURCE_DIR}/src/server/shared/Logging + ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities + ${CMAKE_SOURCE_DIR}/src/server/authserver + ${CMAKE_SOURCE_DIR}/src/server/authserver/Authentication + ${CMAKE_SOURCE_DIR}/src/server/authserver/Realms + ${CMAKE_SOURCE_DIR}/src/server/authserver/Server +) + +set(authserver_LINK_FLAGS "") + +add_executable(authserver + ${authserver_SRCS} +) + +add_dependencies(authserver revision.h) + +if( NOT WIN32 ) + add_definitions(-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/authserver.conf"') +endif() + +if( UNIX ) + set(authserver_LINK_FLAGS "-pthread ${authserver_LINK_FLAGS}") +endif() + +if( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) + set(authserver_LINK_FLAGS "-framework Carbon ${authserver_LINK_FLAGS}") +endif() + +set_target_properties(authserver PROPERTIES LINK_FLAGS "${authserver_LINK_FLAGS}") + +if( WIN32 ) + target_link_libraries( + authserver + shared + trinitydatabase + trinityauth + trinityconfig + ${MYSQL_LIBRARY} + ${OPENSSL_LIBRARIES} + ${OPENSSL_EXTRA_LIBRARIES} + ) +else() + target_link_libraries( + authserver + shared + trinitydatabase + trinityauth + trinityconfig + ${MYSQL_LIBRARY} + ${OPENSSL_LIBRARIES} + ${OSX_LIBS} + ) +endif() + +if( UNIX ) + install(TARGETS authserver DESTINATION bin) + install(FILES authserver.conf.dist DESTINATION etc) +endif() diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp new file mode 100644 index 0000000..b6ffcd6 --- /dev/null +++ b/src/server/authserver/Main.cpp @@ -0,0 +1,361 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/// \addtogroup realmd Realm Daemon +/// @{ +/// \file + +#include "Common.h" +#include "Database/DatabaseEnv.h" +#include "Database/PreparedStatements.h" + +#include "Configuration/ConfigEnv.h" +#include "Log.h" +#include "SystemConfig.h" +#include "revision_sql.h" +#include "Util.h" +#include "SignalHandler.h" +#include "RealmList.h" +#include "RealmAcceptor.h" + +#include +#include +#include +#include + +#include +#include + +#ifndef _TRINITY_REALM_CONFIG +# define _TRINITY_REALM_CONFIG "authserver.conf" +#endif //_TRINITY_REALM_CONFIG + +#ifdef _WIN32 +#include "ServiceWin32.h" +char serviceName[] = "TrinityRealm"; +char serviceLongName[] = "Trinity realm service"; +char serviceDescription[] = "Massive Network Game Object Server"; +/* + * -1 - not in service mode + * 0 - stopped + * 1 - running + * 2 - paused + */ +int m_ServiceStatus = -1; +#endif + +bool StartDB(); + +bool stopEvent = false; ///< Setting it to true stops the server + +DatabaseType LoginDatabase; ///< Accessor to the realm server database + +/// Handle realmd's termination signals +class RealmdSignalHandler : public Trinity::SignalHandler +{ + public: + virtual void HandleSignal(int SigNum) + { + switch (SigNum) + { + case SIGINT: + case SIGTERM: + stopEvent = true; + break; + #ifdef _WIN32 + case SIGBREAK: + if (m_ServiceStatus != 1) + stopEvent = true; + break; + #endif /* _WIN32 */ + } + } +}; + +/// Print out the usage string for this program on the console. +void usage(const char *prog) +{ + sLog.outString("Usage: \n %s []\n" + " -c config_file use config_file as configuration file\n\r" + #ifdef _WIN32 + " Running as service functions:\n\r" + " --service run as service\n\r" + " -s install install service\n\r" + " -s uninstall uninstall service\n\r" + #endif + ,prog); +} + +/// Launch the realm server +extern int main(int argc, char **argv) +{ + sLog.SetLogDB(false); + ///- Command line parsing to get the configuration file name + char const* cfg_file = _TRINITY_REALM_CONFIG; + int c=1; + while(c < argc) + { + if (strcmp(argv[c],"-c") == 0) + { + if (++c >= argc) + { + sLog.outError("Runtime-Error: -c option requires an input argument"); + usage(argv[0]); + return 1; + } + else + cfg_file = argv[c]; + } + + #ifdef _WIN32 + //////////// + //Services// + //////////// + if (strcmp(argv[c],"-s") == 0) + { + if (++c >= argc) + { + sLog.outError("Runtime-Error: -s option requires an input argument"); + usage(argv[0]); + return 1; + } + if (strcmp(argv[c],"install") == 0) + { + if (WinServiceInstall()) + sLog.outString("Installing service"); + return 1; + } + else if (strcmp(argv[c],"uninstall") == 0) + { + if (WinServiceUninstall()) + sLog.outString("Uninstalling service"); + return 1; + } + else + { + sLog.outError("Runtime-Error: unsupported option %s",argv[c]); + usage(argv[0]); + return 1; + } + } + if (strcmp(argv[c],"--service") == 0) + { + WinServiceRun(); + } + //// + #endif + ++c; + } + + if (!sConfig.SetSource(cfg_file)) + { + sLog.outError("Could not find configuration file %s.", cfg_file); + return 1; + } + sLog.Initialize(); + + sLog.outString("%s (realm-daemon)", _FULLVERSION); + sLog.outString(" to stop.\n"); + sLog.outString("Using configuration file %s.", cfg_file); + + sLog.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + +#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) + ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); +#else + ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true); +#endif + + sLog.outBasic("Max allowed open files is %d", ACE::max_handles()); + + /// realmd PID file creation + std::string pidfile = sConfig.GetStringDefault("PidFile", ""); + if (!pidfile.empty()) + { + uint32 pid = CreatePIDFile(pidfile); + if (!pid) + { + sLog.outError("Cannot create PID file %s.\n", pidfile.c_str()); + return 1; + } + + sLog.outString("Daemon PID: %u\n", pid); + } + + ///- Initialize the database connection + if (!StartDB()) + return 1; + + ///- Initialize the log database + sLog.SetLogDBLater(sConfig.GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished. + sLog.SetLogDB(false); + sLog.SetRealmID(0); // ensure we've set realm to 0 (realmd realmid) + + ///- Get the list of realms for the server + sRealmList->Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20)); + if (sRealmList->size() == 0) + { + sLog.outError("No valid realms specified."); + return 1; + } + + ///- Launch the listening network socket + RealmAcceptor acceptor; + + uint16 rmport = sConfig.GetIntDefault("RealmServerPort", DEFAULT_REALMSERVER_PORT); + std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0"); + + ACE_INET_Addr bind_addr(rmport, bind_ip.c_str()); + + if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) + { + sLog.outError("Trinity realm can not bind to %s:%d", bind_ip.c_str(), rmport); + return 1; + } + + // Initialise the signal handlers + RealmdSignalHandler SignalINT, SignalTERM; + #ifdef _WIN32 + RealmdSignalHandler SignalBREAK; + #endif /* _WIN32 */ + + // Register realmd's signal handlers + ACE_Sig_Handler Handler; + Handler.register_handler(SIGINT, &SignalINT); + Handler.register_handler(SIGTERM, &SignalTERM); + #ifdef _WIN32 + Handler.register_handler(SIGBREAK, &SignalBREAK); + #endif /* _WIN32 */(); + + ///- Handle affinity for multiple processors and process priority on Windows + #ifdef _WIN32 + { + HANDLE hProcess = GetCurrentProcess(); + + uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0); + if (Aff > 0) + { + ULONG_PTR appAff; + ULONG_PTR sysAff; + + if (GetProcessAffinityMask(hProcess,&appAff,&sysAff)) + { + ULONG_PTR curAff = Aff & appAff; // remove non accessible processors + + if (!curAff) + { + sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for realmd. Accessible processors bitmask (hex): %x",Aff,appAff); + } + else + { + if (SetProcessAffinityMask(hProcess,curAff)) + sLog.outString("Using processors (bitmask, hex): %x", curAff); + else + sLog.outError("Can't set used processors (hex): %x", curAff); + } + } + sLog.outString(); + } + + bool Prio = sConfig.GetBoolDefault("ProcessPriority", false); + + if (Prio) + { + if (SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS)) + sLog.outString("TrinityRealm process priority class set to HIGH"); + else + sLog.outError("ERROR: Can't set realmd process priority class."); + sLog.outString(); + } + } + #endif + + // maximum counter for next ping + uint32 numLoops = (sConfig.GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000)); + uint32 loopCounter = 0; + + // possibly enable db logging; avoid massive startup spam by doing it here. + if (sLog.GetLogDBLater()) + { + sLog.outString("Enabling database logging..."); + sLog.SetLogDBLater(false); + // login db needs thread for logging + sLog.SetLogDB(true); + } + else + sLog.SetLogDB(false); + + ///- Wait for termination signal + while (!stopEvent) + { + // dont move this outside the loop, the reactor will modify it + ACE_Time_Value interval(0, 100000); + + if (ACE_Reactor::instance()->run_reactor_event_loop(interval) == -1) + break; + + if ((++loopCounter) == numLoops) + { + loopCounter = 0; + sLog.outDetail("Ping MySQL to keep connection alive"); + sPreparedStatement.Query(&LoginDatabase, "auth_ping"); + } +#ifdef _WIN32 + if (m_ServiceStatus == 0) stopEvent = true; + while (m_ServiceStatus == 2) Sleep(1000); +#endif + } + + ///- Wait for the delay thread to exit + LoginDatabase.ThreadEnd(); + LoginDatabase.HaltDelayThread(); + + sLog.outString("Halting process..."); + return 0; +} + +/// Initialize connection to the database +bool StartDB() +{ + std::string dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", ""); + if (dbstring.empty()) + { + sLog.outError("Database not specified"); + return false; + } + + if (!LoginDatabase.Initialize(dbstring.c_str())) + { + sLog.outError("Cannot connect to database"); + return false; + } + if(!LoginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD)) + return false; + + LoginDatabase.ThreadStart(); + + uint32 count = 0; + sPreparedStatement.LoadAuthserver(&LoginDatabase, count); + sLog.outString("Loaded %u prepared MySQL statements for auth DB.", count); + + return true; +} + +/// @} diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp new file mode 100644 index 0000000..1e989c3 --- /dev/null +++ b/src/server/authserver/Realms/RealmList.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd +*/ + +#include "Common.h" +#include "RealmList.h" +#include "Database/DatabaseEnv.h" + + +extern DatabaseType LoginDatabase; + +RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) +{ +} + +/// Load the realm list from the database +void RealmList::Initialize(uint32 updateInterval) +{ + m_UpdateInterval = updateInterval; + + ///- Get the content of the realmlist table in the database + UpdateRealms(true); +} + +void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build) +{ + ///- Create new if not exist or update existed + Realm& realm = m_realms[name]; + + realm.m_ID = ID; + realm.name = name; + realm.icon = icon; + realm.color = color; + realm.timezone = timezone; + realm.allowedSecurityLevel = allowedSecurityLevel; + realm.populationLevel = popu; + + ///- Append port to IP address. + std::ostringstream ss; + ss << address << ":" << port; + realm.address = ss.str(); + realm.gamebuild = build; +} + +void RealmList::UpdateIfNeed() +{ + // maybe disabled or updated recently + if (!m_UpdateInterval || m_NextUpdateTime > time(NULL)) + return; + + m_NextUpdateTime = time(NULL) + m_UpdateInterval; + + // Clears Realm list + m_realms.clear(); + + // Get the content of the realmlist table in the database + UpdateRealms(false); +} + +void RealmList::UpdateRealms(bool init) +{ + sLog.outDetail("Updating Realm List..."); + + QueryResult_AutoPtr result = LoginDatabase.Query("SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE color <> 3 ORDER BY name"); + + ///- Circle through results and add them to the realm map + if (result) + { + do + { + Field *fields = result->Fetch(); + + uint8 allowedSecurityLevel = fields[7].GetUInt8(); + + UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat(), fields[9].GetUInt32()); + if (init) + sLog.outString("Added realm \"%s\".", fields[1].GetString()); + } while(result->NextRow()); + } +} diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h new file mode 100644 index 0000000..b29b561 --- /dev/null +++ b/src/server/authserver/Realms/RealmList.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/// \addtogroup realmd +/// @{ +/// \file + +#ifndef _REALMLIST_H +#define _REALMLIST_H + +#include +#include +#include "Common.h" + +/// Storage object for a realm +struct Realm +{ + std::string address; + std::string name; + uint8 icon; + uint8 color; + uint8 timezone; + uint32 m_ID; + AccountTypes allowedSecurityLevel; + float populationLevel; + uint32 gamebuild; +}; + +/// Storage object for the list of realms on the server +class RealmList +{ + public: + // Null_Mutex is safe because the singleton initialized before the acceptor initialized(another place where the singleton called) + static RealmList* instance() { return ACE_Singleton::instance(); } + + typedef std::map RealmMap; + + RealmList(); + ~RealmList() {} + + void Initialize(uint32 updateInterval); + + void UpdateIfNeed(); + + void AddRealm(Realm NewRealm) {m_realms[NewRealm.name] = NewRealm;} + + RealmMap::const_iterator begin() const { return m_realms.begin(); } + RealmMap::const_iterator end() const { return m_realms.end(); } + uint32 size() const { return m_realms.size(); } + private: + void UpdateRealms(bool init); + void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, uint32 build); + private: + RealmMap m_realms; ///< Internal map of realms + uint32 m_UpdateInterval; + time_t m_NextUpdateTime; +}; + +#define sRealmList RealmList::instance() + +#endif +/// @} diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp new file mode 100644 index 0000000..c33f84a --- /dev/null +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -0,0 +1,1069 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd +*/ + +#include "Common.h" +#include "Database/DatabaseEnv.h" +#include "ByteBuffer.h" +#include "Configuration/ConfigEnv.h" +#include "Log.h" +#include "RealmList.h" +#include "AuthSocket.h" +#include "AuthCodes.h" +#include +#include "SHA1.h" +//#include "Util.h" -- for commented utf8ToUpperOnlyLatin + +extern DatabaseType LoginDatabase; + +#define ChunkSize 2048 + +enum eAuthCmd +{ + //AUTH_NO_CMD = 0xFF, + AUTH_LOGON_CHALLENGE = 0x00, + AUTH_LOGON_PROOF = 0x01, + AUTH_RECONNECT_CHALLENGE = 0x02, + AUTH_RECONNECT_PROOF = 0x03, + //update srv =4 + REALM_LIST = 0x10, + XFER_INITIATE = 0x30, + XFER_DATA = 0x31, + XFER_ACCEPT = 0x32, + XFER_RESUME = 0x33, + XFER_CANCEL = 0x34 +}; + +enum eStatus +{ + STATUS_CONNECTED = 0, + STATUS_AUTHED +}; + +// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some paltform +#if defined(__GNUC__) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + +typedef struct AUTH_LOGON_CHALLENGE_C +{ + uint8 cmd; + uint8 error; + uint16 size; + uint8 gamename[4]; + uint8 version1; + uint8 version2; + uint8 version3; + uint16 build; + uint8 platform[4]; + uint8 os[4]; + uint8 country[4]; + uint32 timezone_bias; + uint32 ip; + uint8 I_len; + uint8 I[1]; +} sAuthLogonChallenge_C; + +typedef struct AUTH_LOGON_PROOF_C +{ + uint8 cmd; + uint8 A[32]; + uint8 M1[20]; + uint8 crc_hash[20]; + uint8 number_of_keys; + uint8 securityFlags; // 0x00-0x04 +} sAuthLogonProof_C; + +typedef struct AUTH_LOGON_PROOF_S +{ + uint8 cmd; + uint8 error; + uint8 M2[20]; + uint32 unk1; + uint32 unk2; + uint16 unk3; +} sAuthLogonProof_S; + +typedef struct AUTH_LOGON_PROOF_S_OLD +{ + uint8 cmd; + uint8 error; + uint8 M2[20]; + //uint32 unk1; + uint32 unk2; + //uint16 unk3; +} sAuthLogonProof_S_Old; + +typedef struct AUTH_RECONNECT_PROOF_C +{ + uint8 cmd; + uint8 R1[16]; + uint8 R2[20]; + uint8 R3[20]; + uint8 number_of_keys; +} sAuthReconnectProof_C; + +typedef struct XFER_INIT +{ + uint8 cmd; // XFER_INITIATE + uint8 fileNameLen; // strlen(fileName); + uint8 fileName[5]; // fileName[fileNameLen] + uint64 file_size; // file size (bytes) + uint8 md5[MD5_DIGEST_LENGTH]; // MD5 +} XFER_INIT; + +typedef struct XFER_DATA +{ + uint8 opcode; + uint16 data_size; + uint8 data[ChunkSize]; +} XFER_DATA_STRUCT; + +typedef struct AuthHandler +{ + eAuthCmd cmd; + uint32 status; + bool (AuthSocket::*handler)(void); +} AuthHandler; + +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some paltform +#if defined(__GNUC__) +#pragma pack() +#else +#pragma pack(pop) +#endif + +/// Launch a thread to transfer a patch to the client +class PatcherRunnable: public ACE_Based::Runnable +{ + public: + PatcherRunnable(class AuthSocket *); + void run(); + + private: + AuthSocket * mySocket; +}; + +typedef struct PATCH_INFO +{ + uint8 md5[MD5_DIGEST_LENGTH]; +} PATCH_INFO; + +/// Caches MD5 hash of client patches present on the server +class Patcher +{ + public: + typedef std::map Patches; + ~Patcher(); + Patcher(); + Patches::const_iterator begin() const { return _patches.begin(); } + Patches::const_iterator end() const { return _patches.end(); } + void LoadPatchMD5(char*); + bool GetHash(char * pat,uint8 mymd5[16]); + + private: + void LoadPatchesInfo(); + Patches _patches; +}; + +const AuthHandler table[] = +{ + { AUTH_LOGON_CHALLENGE, STATUS_CONNECTED, &AuthSocket::_HandleLogonChallenge }, + { AUTH_LOGON_PROOF, STATUS_CONNECTED, &AuthSocket::_HandleLogonProof }, + { AUTH_RECONNECT_CHALLENGE, STATUS_CONNECTED, &AuthSocket::_HandleReconnectChallenge}, + { AUTH_RECONNECT_PROOF, STATUS_CONNECTED, &AuthSocket::_HandleReconnectProof }, + { REALM_LIST, STATUS_AUTHED, &AuthSocket::_HandleRealmList }, + { XFER_ACCEPT, STATUS_CONNECTED, &AuthSocket::_HandleXferAccept }, + { XFER_RESUME, STATUS_CONNECTED, &AuthSocket::_HandleXferResume }, + { XFER_CANCEL, STATUS_CONNECTED, &AuthSocket::_HandleXferCancel } +}; + +#define AUTH_TOTAL_COMMANDS sizeof(table)/sizeof(AuthHandler) + +///Holds the MD5 hash of client patches present on the server +Patcher PatchesCache; + +/// Constructor - set the N and g values for SRP6 +AuthSocket::AuthSocket(RealmSocket& socket) : socket_(socket) +{ + N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); + g.SetDword(7); + _authed = false; + _accountSecurityLevel = SEC_PLAYER; +} + +/// Close patch file descriptor before leaving +AuthSocket::~AuthSocket(void) +{ +} + +/// Accept the connection and set the s random value for SRP6 +void AuthSocket::OnAccept(void) +{ + sLog.outBasic("Accepting connection from '%s'", socket().get_remote_address().c_str()); +} + +void AuthSocket::OnClose(void) +{ + sLog.outDebug("AuthSocket::OnClose"); +} + +/// Read the packet from the client +void AuthSocket::OnRead() +{ + uint8 _cmd; + while (1) + { + if (!socket().recv_soft((char *)&_cmd, 1)) + return; + + size_t i; + + ///- Circle through known commands and call the correct command handler + for (i = 0; i < AUTH_TOTAL_COMMANDS; ++i) + { + if ((uint8)table[i].cmd == _cmd && + (table[i].status == STATUS_CONNECTED || + (_authed && table[i].status == STATUS_AUTHED))) + { + DEBUG_LOG("[Auth] got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + + if (!(*this.*table[i].handler)()) + { + DEBUG_LOG("Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + return; + } + break; + } + } + + // Report unknown packets in the error log + if (i == AUTH_TOTAL_COMMANDS) + { + sLog.outError("[Auth] got unknown packet from '%s'", socket().get_remote_address().c_str()); + socket().shutdown(); + return; + } + } +} + +/// Make the SRP6 calculation from hash in dB +void AuthSocket::_SetVSFields(const std::string& rI) +{ + s.SetRand(s_BYTE_SIZE * 8); + + BigNumber I; + I.SetHexStr(rI.c_str()); + + // In case of leading zeros in the rI hash, restore them + uint8 mDigest[SHA_DIGEST_LENGTH]; + memset(mDigest, 0, SHA_DIGEST_LENGTH); + if (I.GetNumBytes() <= SHA_DIGEST_LENGTH) + memcpy(mDigest, I.AsByteArray(), I.GetNumBytes()); + + std::reverse(mDigest, mDigest + SHA_DIGEST_LENGTH); + + Sha1Hash sha; + sha.UpdateData(s.AsByteArray(), s.GetNumBytes()); + sha.UpdateData(mDigest, SHA_DIGEST_LENGTH); + sha.Finalize(); + BigNumber x; + x.SetBinary(sha.GetDigest(), sha.GetLength()); + v = g.ModExp(x, N); + // No SQL injection (username escaped) + const char *v_hex, *s_hex; + v_hex = v.AsHexStr(); + s_hex = s.AsHexStr(); + LoginDatabase.PExecute("UPDATE account SET v = '%s', s = '%s' WHERE username = '%s'", v_hex, s_hex, _safelogin.c_str()); + OPENSSL_free((void*)v_hex); + OPENSSL_free((void*)s_hex); +} + +/// Logon Challenge command handler +bool AuthSocket::_HandleLogonChallenge() +{ + DEBUG_LOG("Entering _HandleLogonChallenge"); + if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) + return false; + + ///- Read the first 4 bytes (header) to get the length of the remaining of the packet + std::vector buf; + buf.resize(4); + + socket().recv((char *)&buf[0], 4); + + EndianConvert(*((uint16*)(buf[0]))); + uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; + DEBUG_LOG("[AuthChallenge] got header, body is %#04x bytes", remaining); + + if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) + return false; + + //No big fear of memory outage (size is int16, i.e. < 65536) + buf.resize(remaining + buf.size() + 1); + buf[buf.size() - 1] = 0; + sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; + + ///- Read the remaining of the packet + socket().recv((char *)&buf[4], remaining); + DEBUG_LOG("[AuthChallenge] got full packet, %#04x bytes", ch->size); + DEBUG_LOG("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); + + // BigEndian code, nop in little endian case + // size already converted + EndianConvert(*((uint32*)(&ch->gamename[0]))); + EndianConvert(ch->build); + EndianConvert(*((uint32*)(&ch->platform[0]))); + EndianConvert(*((uint32*)(&ch->os[0]))); + EndianConvert(*((uint32*)(&ch->country[0]))); + EndianConvert(ch->timezone_bias); + EndianConvert(ch->ip); + + ByteBuffer pkt; + + _login = (const char*)ch->I; + _build = ch->build; + _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) + (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG); + + ///- Normalize account name + //utf8ToUpperOnlyLatin(_login); -- client already send account in expected form + + //Escape the user login to avoid further SQL injection + //Memory will be freed on AuthSocket object destruction + _safelogin = _login; + LoginDatabase.escape_string(_safelogin); + + _build = ch->build; + + pkt << (uint8) AUTH_LOGON_CHALLENGE; + pkt << (uint8) 0x00; + + ///- Verify that this IP is not in the ip_banned table + // No SQL injection possible (paste the IP address as passed by the socket) + LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); + + std::string address(socket().get_remote_address().c_str()); + LoginDatabase.escape_string(address); + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT * FROM ip_banned WHERE ip = '%s'",address.c_str()); + if (result) + { + pkt << (uint8)WOW_FAIL_BANNED; + sLog.outBasic("[AuthChallenge] Banned ip %s tries to login!", address.c_str ()); + } + else + { + ///- Get the account details from the account table + // No SQL injection (escaped user name) + + result = LoginDatabase.PQuery("SELECT a.sha_pass_hash,a.id,a.locked,a.last_ip,aa.gmlevel,a.v,a.s " + "FROM account a " + "LEFT JOIN account_access aa " + "ON (a.id = aa.id) " + "WHERE a.username = '%s'",_safelogin.c_str ()); + if (result) + { + ///- If the IP is 'locked', check that the player comes indeed from the correct IP address + bool locked = false; + if ((*result)[2].GetUInt8() == 1) // if ip is locked + { + DEBUG_LOG("[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), (*result)[3].GetString()); + DEBUG_LOG("[AuthChallenge] Player address is '%s'", socket().get_remote_address().c_str()); + if (strcmp((*result)[3].GetString(),socket().get_remote_address().c_str())) + { + DEBUG_LOG("[AuthChallenge] Account IP differs"); + pkt << (uint8) WOW_FAIL_SUSPENDED; + locked=true; + } + else + DEBUG_LOG("[AuthChallenge] Account IP matches"); + } + else + DEBUG_LOG("[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); + + if (!locked) + { + //set expired bans to inactive + LoginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); + ///- If the account is banned, reject the logon attempt + QueryResult_AutoPtr banresult = LoginDatabase.PQuery("SELECT bandate,unbandate FROM account_banned WHERE id = %u AND active = 1", (*result)[1].GetUInt32()); + if (banresult) + { + if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64()) + { + pkt << (uint8) WOW_FAIL_BANNED; + sLog.outBasic("[AuthChallenge] Banned account %s tries to login!",_login.c_str ()); + } + else + { + pkt << (uint8) WOW_FAIL_SUSPENDED; + sLog.outBasic("[AuthChallenge] Temporarily banned account %s tries to login!",_login.c_str ()); + } + } + else + { + ///- Get the password from the account table, upper it, and make the SRP6 calculation + std::string rI = (*result)[0].GetCppString(); + + ///- Don't calculate (v, s) if there are already some in the database + std::string databaseV = (*result)[5].GetCppString(); + std::string databaseS = (*result)[6].GetCppString(); + + sLog.outDebug("database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); + + // multiply with 2, bytes are stored as hexstring + if (databaseV.size() != s_BYTE_SIZE*2 || databaseS.size() != s_BYTE_SIZE*2) + _SetVSFields(rI); + else + { + s.SetHexStr(databaseS.c_str()); + v.SetHexStr(databaseV.c_str()); + } + + b.SetRand(19 * 8); + BigNumber gmod = g.ModExp(b, N); + B = ((v * 3) + gmod) % N; + + ASSERT(gmod.GetNumBytes() <= 32); + + BigNumber unk3; + unk3.SetRand(16 * 8); + + ///- Fill the response packet with the result + pkt << uint8(WOW_SUCCESS); + + // B may be calculated < 32B so we force minimal length to 32B + pkt.append(B.AsByteArray(32), 32); // 32 bytes + pkt << uint8(1); + pkt.append(g.AsByteArray(), 1); + pkt << uint8(32); + pkt.append(N.AsByteArray(32), 32); + pkt.append(s.AsByteArray(), s.GetNumBytes()); // 32 bytes + pkt.append(unk3.AsByteArray(16), 16); + uint8 securityFlags = 0; + pkt << uint8(securityFlags); // security flags (0x0...0x04) + + if (securityFlags & 0x01) // PIN input + { + pkt << uint32(0); + pkt << uint64(0) << uint64(0); // 16 bytes hash? + } + + if (securityFlags & 0x02) // Matrix input + { + pkt << uint8(0); + pkt << uint8(0); + pkt << uint8(0); + pkt << uint8(0); + pkt << uint64(0); + } + + if (securityFlags & 0x04) // Security token input + pkt << uint8(1); + + uint8 secLevel = (*result)[4].GetUInt8(); + _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; + + _localizationName.resize(4); + for (int i = 0; i < 4; ++i) + _localizationName[i] = ch->country[4-i-1]; + + sLog.outBasic("[AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)); + } + } + } + else //no account + { + pkt<< (uint8) WOW_FAIL_UNKNOWN_ACCOUNT; + } + } + + socket().send((char const*)pkt.contents(), pkt.size()); + return true; +} + +/// Logon Proof command handler +bool AuthSocket::_HandleLogonProof() +{ + DEBUG_LOG("Entering _HandleLogonProof"); + ///- Read the packet + sAuthLogonProof_C lp; + + if (!socket().recv((char *)&lp, sizeof(sAuthLogonProof_C))) + return false; + + ///

+ + ///- Continue the SRP6 calculation based on data received from the client + BigNumber A; + + A.SetBinary(lp.A, 32); + + // SRP safeguard: abort if A==0 + if (A.isZero()) + { + socket().shutdown(); + return true; + } + + Sha1Hash sha; + sha.UpdateBigNumbers(&A, &B, NULL); + sha.Finalize(); + BigNumber u; + u.SetBinary(sha.GetDigest(), 20); + BigNumber S = (A * (v.ModExp(u, N))).ModExp(b, N); + + uint8 t[32]; + uint8 t1[16]; + uint8 vK[40]; + memcpy(t, S.AsByteArray(32), 32); + for (int i = 0; i < 16; ++i) + { + t1[i] = t[i * 2]; + } + sha.Initialize(); + sha.UpdateData(t1, 16); + sha.Finalize(); + for (int i = 0; i < 20; ++i) + { + vK[i * 2] = sha.GetDigest()[i]; + } + for (int i = 0; i < 16; ++i) + { + t1[i] = t[i * 2 + 1]; + } + sha.Initialize(); + sha.UpdateData(t1, 16); + sha.Finalize(); + for (int i = 0; i < 20; ++i) + { + vK[i * 2 + 1] = sha.GetDigest()[i]; + } + K.SetBinary(vK, 40); + + uint8 hash[20]; + + sha.Initialize(); + sha.UpdateBigNumbers(&N, NULL); + sha.Finalize(); + memcpy(hash, sha.GetDigest(), 20); + sha.Initialize(); + sha.UpdateBigNumbers(&g, NULL); + sha.Finalize(); + for (int i = 0; i < 20; ++i) + { + hash[i] ^= sha.GetDigest()[i]; + } + BigNumber t3; + t3.SetBinary(hash, 20); + + sha.Initialize(); + sha.UpdateData(_login); + sha.Finalize(); + uint8 t4[SHA_DIGEST_LENGTH]; + memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH); + + sha.Initialize(); + sha.UpdateBigNumbers(&t3, NULL); + sha.UpdateData(t4, SHA_DIGEST_LENGTH); + sha.UpdateBigNumbers(&s, &A, &B, &K, NULL); + sha.Finalize(); + BigNumber M; + M.SetBinary(sha.GetDigest(), 20); + + ///- Check if SRP6 results match (password is correct), else send an error + if (!memcmp(M.AsByteArray(), lp.M1, 20)) + { + sLog.outBasic("User '%s' successfully authenticated", _login.c_str()); + + ///- Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account + // No SQL injection (escaped user name) and IP address as received by socket + const char* K_hex = K.AsHexStr(); + LoginDatabase.PExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = '%u', failed_logins = 0 WHERE username = '%s'", K_hex, socket().get_remote_address().c_str(), GetLocaleByName(_localizationName), _safelogin.c_str()); + OPENSSL_free((void*)K_hex); + + ///- Finish SRP6 and send the final result to the client + sha.Initialize(); + sha.UpdateBigNumbers(&A, &M, &K, NULL); + sha.Finalize(); + + if (_expversion & POST_BC_EXP_FLAG)//2.4.3 and 3.1.3 clients (10146 is Chinese build for 3.1.3) + { + sAuthLogonProof_S proof; + memcpy(proof.M2, sha.GetDigest(), 20); + proof.cmd = AUTH_LOGON_PROOF; + proof.error = 0; + proof.unk1 = 0x00800000; + proof.unk2 = 0x00; + proof.unk3 = 0x00; + socket().send((char *)&proof, sizeof(proof)); + } + else + { + sAuthLogonProof_S_Old proof; + memcpy(proof.M2, sha.GetDigest(), 20); + proof.cmd = AUTH_LOGON_PROOF; + proof.error = 0; + //proof.unk1 = 0x00800000; + proof.unk2 = 0x00; + //proof.unk3 = 0x00; + socket().send((char *)&proof, sizeof(proof)); + } + + ///- Set _authed to true! + _authed = true; + } + else + { + char data[4]= { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0}; + socket().send(data, sizeof(data)); + sLog.outBasic("[AuthChallenge] account %s tried to login with wrong password!",_login.c_str ()); + + uint32 MaxWrongPassCount = sConfig.GetIntDefault("WrongPass.MaxCount", 0); + if (MaxWrongPassCount > 0) + { + //Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP + LoginDatabase.PExecute("UPDATE account SET failed_logins = failed_logins + 1 WHERE username = '%s'",_safelogin.c_str()); + + if (QueryResult_AutoPtr loginfail = LoginDatabase.PQuery("SELECT id, failed_logins FROM account WHERE username = '%s'", _safelogin.c_str())) + { + Field* fields = loginfail->Fetch(); + uint32 failed_logins = fields[1].GetUInt32(); + + if (failed_logins >= MaxWrongPassCount) + { + uint32 WrongPassBanTime = sConfig.GetIntDefault("WrongPass.BanTime", 600); + bool WrongPassBanType = sConfig.GetBoolDefault("WrongPass.BanType", false); + + if (WrongPassBanType) + { + uint32 acc_id = fields[0].GetUInt32(); + LoginDatabase.PExecute("INSERT INTO account_banned VALUES ('%u',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','Trinity realmd','Failed login autoban',1)", + acc_id, WrongPassBanTime); + sLog.outBasic("[AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", + _login.c_str(), WrongPassBanTime, failed_logins); + } + else + { + std::string current_ip(socket().get_remote_address().c_str()); + LoginDatabase.escape_string(current_ip); + LoginDatabase.PExecute("INSERT INTO ip_banned VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','Trinity realmd','Failed login autoban')", + current_ip.c_str(), WrongPassBanTime); + sLog.outBasic("[AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", + current_ip.c_str(), WrongPassBanTime, _login.c_str(), failed_logins); + } + } + } + } + } + + return true; +} + +/// Reconnect Challenge command handler +bool AuthSocket::_HandleReconnectChallenge() +{ + DEBUG_LOG("Entering _HandleReconnectChallenge"); + if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) + return false; + + ///- Read the first 4 bytes (header) to get the length of the remaining of the packet + std::vector buf; + buf.resize(4); + + socket().recv((char *)&buf[0], 4); + + EndianConvert(*((uint16*)(buf[0]))); + uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; + DEBUG_LOG("[ReconnectChallenge] got header, body is %#04x bytes", remaining); + + if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) + return false; + + //No big fear of memory outage (size is int16, i.e. < 65536) + buf.resize(remaining + buf.size() + 1); + buf[buf.size() - 1] = 0; + sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; + + ///- Read the remaining of the packet + socket().recv((char *)&buf[4], remaining); + DEBUG_LOG("[ReconnectChallenge] got full packet, %#04x bytes", ch->size); + DEBUG_LOG("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); + + _login = (const char*)ch->I; + _safelogin = _login; + + QueryResult_AutoPtr result = LoginDatabase.PQuery ("SELECT sessionkey FROM account WHERE username = '%s'", _safelogin.c_str ()); + + // Stop if the account is not found + if (!result) + { + sLog.outError("[ERROR] user %s tried to login and we cannot find his session key in the database.", _login.c_str()); + socket().shutdown(); + return false; + } + + Field* fields = result->Fetch (); + K.SetHexStr (fields[0].GetString ()); + + ///- Sending response + ByteBuffer pkt; + pkt << (uint8) AUTH_RECONNECT_CHALLENGE; + pkt << (uint8) 0x00; + _reconnectProof.SetRand(16 * 8); + pkt.append(_reconnectProof.AsByteArray(16), 16); // 16 bytes random + pkt << (uint64) 0x00 << (uint64) 0x00; // 16 bytes zeros + socket().send((char const*)pkt.contents(), pkt.size()); + return true; +} + +/// Reconnect Proof command handler +bool AuthSocket::_HandleReconnectProof() +{ + DEBUG_LOG("Entering _HandleReconnectProof"); + ///- Read the packet + sAuthReconnectProof_C lp; + if (!socket().recv((char *)&lp, sizeof(sAuthReconnectProof_C))) + return false; + + if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) + return false; + + BigNumber t1; + t1.SetBinary(lp.R1, 16); + + Sha1Hash sha; + sha.Initialize(); + sha.UpdateData(_login); + sha.UpdateBigNumbers(&t1, &_reconnectProof, &K, NULL); + sha.Finalize(); + + if (!memcmp(sha.GetDigest(), lp.R2, SHA_DIGEST_LENGTH)) + { + ///- Sending response + ByteBuffer pkt; + pkt << (uint8) AUTH_RECONNECT_PROOF; + pkt << (uint8) 0x00; + pkt << (uint16) 0x00; // 2 bytes zeros + socket().send((char const*)pkt.contents(), pkt.size()); + + ///- Set _authed to true! + _authed = true; + + return true; + } + else + { + sLog.outError("[ERROR] user %s tried to login, but session invalid.", _login.c_str()); + socket().shutdown(); + return false; + } +} + +/// %Realm List command handler +bool AuthSocket::_HandleRealmList() +{ + DEBUG_LOG("Entering _HandleRealmList"); + if (socket().recv_len() < 5) + return false; + + socket().recv_skip(5); + + ///- Get the user id (else close the connection) + // No SQL injection (escaped user name) + + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'",_safelogin.c_str()); + if (!result) + { + sLog.outError("[ERROR] user %s tried to login and we cannot find him in the database.",_login.c_str()); + socket().shutdown(); + return false; + } + + uint32 id = (*result)[0].GetUInt32(); + + ///- Update realm list if need + sRealmList->UpdateIfNeed(); + + ///- Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) + ByteBuffer pkt; + + size_t RealmListSize = 0; + for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i) + { + // don't work with realms which not compatible with the client + if (_expversion & POST_BC_EXP_FLAG) // 2.4.3 and 3.1.3 cliens + { + if (i->second.gamebuild != _build) + continue; + } + else if (_expversion & PRE_BC_EXP_FLAG) // 1.12.1 and 1.12.2 clients are compatible with eachother + { + if (!AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild)) + continue; + } + + uint8 AmountOfCharacters; + + // No SQL injection. id of realm is controlled by the database. + result = LoginDatabase.PQuery("SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'",i->second.m_ID,id); + if (result) + { + Field *fields = result->Fetch(); + AmountOfCharacters = fields[0].GetUInt8(); + } + else + AmountOfCharacters = 0; + + uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; + + pkt << i->second.icon; // realm type + if ( _expversion & POST_BC_EXP_FLAG )//only 2.4.3 and 3.1.3 cliens + pkt << lock; // if 1, then realm locked + pkt << i->second.color; // if 2, then realm is offline + pkt << i->first; + pkt << i->second.address; + pkt << i->second.populationLevel; + pkt << AmountOfCharacters; + pkt << i->second.timezone; // realm category + if ( _expversion & POST_BC_EXP_FLAG )//2.4.3 and 3.1.3 clients + pkt << (uint8) 0x2C; // unk, may be realm number/id? + else + pkt << (uint8) 0x0; //1.12.1 and 1.12.2 clients + + ++RealmListSize; + } + + if ( _expversion & POST_BC_EXP_FLAG )//2.4.3 and 3.1.3 cliens + { + pkt << (uint8) 0x10; + pkt << (uint8) 0x00; + }else{//1.12.1 and 1.12.2 clients + pkt << (uint8) 0x00; + pkt << (uint8) 0x02; + } + + // make a ByteBuffer which stores the RealmList's size + ByteBuffer RealmListSizeBuffer; + RealmListSizeBuffer << (uint32)0; + if (_expversion & POST_BC_EXP_FLAG) // only 2.4.3 and 3.1.3 cliens + RealmListSizeBuffer << (uint16)RealmListSize; + else + RealmListSizeBuffer << (uint32)RealmListSize; + + ByteBuffer hdr; + hdr << (uint8) REALM_LIST; + hdr << (uint16)(pkt.size() + RealmListSizeBuffer.size()); + hdr.append(RealmListSizeBuffer); // append RealmList's size buffer + hdr.append(pkt); // append realms in the realmlist + + socket().send((char const*)hdr.contents(), hdr.size()); + + return true; +} + +/// Resume patch transfer +bool AuthSocket::_HandleXferResume() +{ + DEBUG_LOG("Entering _HandleXferResume"); + ///- Check packet length and patch existence + if (socket().recv_len() < 9 || !pPatch) + { + sLog.outError("Error while resuming patch transfer (wrong packet)"); + return false; + } + + ///- Launch a PatcherRunnable thread starting at given patch file offset + uint64 start; + socket().recv_skip(1); + socket().recv((char*)&start,sizeof(start)); + fseek(pPatch, start, 0); + + ACE_Based::Thread u(new PatcherRunnable(this)); + return true; +} + +/// Cancel patch transfer +bool AuthSocket::_HandleXferCancel() +{ + DEBUG_LOG("Entering _HandleXferCancel"); + + ///- Close and delete the socket + socket().recv_skip(1); //clear input buffer + + socket().shutdown(); + + return true; +} + +/// Accept patch transfer +bool AuthSocket::_HandleXferAccept() +{ + DEBUG_LOG("Entering _HandleXferAccept"); + + ///- Check packet length and patch existence + if (!pPatch) + { + sLog.outError("Error while accepting patch transfer (wrong packet)"); + return false; + } + + ///- Launch a PatcherRunnable thread, starting at the beginning of the patch file + socket().recv_skip(1); // clear input buffer + fseek(pPatch, 0, 0); + + ACE_Based::Thread u(new PatcherRunnable(this)); + return true; +} + +PatcherRunnable::PatcherRunnable(class AuthSocket * as) +{ + mySocket = as; +} + +/// Send content of patch file to the client +void PatcherRunnable::run() +{ +} + +/// Preload MD5 hashes of existing patch files on server +#ifndef _WIN32 +#include +#include +void Patcher::LoadPatchesInfo() +{ + DIR * dirp; + //int errno; + struct dirent * dp; + dirp = opendir("./patches/"); + if (!dirp) + return; + while (dirp) + { + errno = 0; + if ((dp = readdir(dirp)) != NULL) + { + int l = strlen(dp->d_name); + if (l < 8) + continue; + if (!memcmp(&dp->d_name[l-4],".mpq",4)) + LoadPatchMD5(dp->d_name); + } + else + { + if (errno != 0) + { + closedir(dirp); + return; + } + break; + } + } + + if (dirp) + closedir(dirp); +} + +#else +void Patcher::LoadPatchesInfo() +{ + WIN32_FIND_DATA fil; + HANDLE hFil=FindFirstFile("./patches/*.mpq", &fil); + if (hFil == INVALID_HANDLE_VALUE) + return; // no patches were found + + do + { + LoadPatchMD5(fil.cFileName); + } + while(FindNextFile(hFil, &fil)); +} +#endif + +/// Calculate and store MD5 hash for a given patch file +void Patcher::LoadPatchMD5(char * szFileName) +{ + ///- Try to open the patch file + std::string path = "./patches/"; + path += szFileName; + FILE *pPatch = fopen(path.c_str(), "rb"); + sLog.outDebug("Loading patch info from %s\n", path.c_str()); + if (!pPatch) + { + sLog.outError("Error loading patch %s\n", path.c_str()); + return; + } + + ///- Calculate the MD5 hash + MD5_CTX ctx; + MD5_Init(&ctx); + uint8* buf = new uint8[512*1024]; + + while (!feof(pPatch)) + { + size_t read = fread(buf, 1, 512*1024, pPatch); + MD5_Update(&ctx, buf, read); + } + delete [] buf; + fclose(pPatch); + + ///- Store the result in the internal patch hash map + _patches[path] = new PATCH_INFO; + MD5_Final((uint8 *)&_patches[path]->md5, &ctx); +} + +/// Get cached MD5 hash for a given patch file +bool Patcher::GetHash(char * pat, uint8 mymd5[16]) +{ + for (Patches::iterator i = _patches.begin(); i != _patches.end(); ++i) + if (!stricmp(pat, i->first.c_str())) + { + memcpy(mymd5, i->second->md5, 16); + return true; + } + + return false; +} + +/// Launch the patch hashing mechanism on object creation +Patcher::Patcher() +{ + LoadPatchesInfo(); +} + +/// Empty and delete the patch map on termination +Patcher::~Patcher() +{ + for (Patches::iterator i = _patches.begin(); i != _patches.end(); ++i) + delete i->second; +} diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h new file mode 100644 index 0000000..0ad40b6 --- /dev/null +++ b/src/server/authserver/Server/AuthSocket.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/// \addtogroup realmd +/// @{ +/// \file + +#ifndef _AUTHSOCKET_H +#define _AUTHSOCKET_H + +#include "Common.h" +#include "BigNumber.h" + +#include "RealmSocket.h" + +enum RealmFlags +{ + REALM_FLAG_NONE = 0x00, + REALM_FLAG_INVALID = 0x01, + REALM_FLAG_OFFLINE = 0x02, + REALM_FLAG_SPECIFYBUILD = 0x04, // client will show realm version in RealmList screen in form "RealmName (major.minor.revision.build)" + REALM_FLAG_UNK1 = 0x08, + REALM_FLAG_UNK2 = 0x10, + REALM_FLAG_RECOMMENDED = 0x20, // client checks pop == 600f + REALM_FLAG_NEW = 0x40, // client checks pop == 200f + REALM_FLAG_FULL = 0x80 // client checks pop == 400f +}; + +/// Handle login commands +class AuthSocket: public RealmSocket::Session +{ + public: + const static int s_BYTE_SIZE = 32; + + AuthSocket(RealmSocket& socket); + virtual ~AuthSocket(void); + + virtual void OnRead(void); + virtual void OnAccept(void); + virtual void OnClose(void); + + bool _HandleLogonChallenge(); + bool _HandleLogonProof(); + bool _HandleReconnectChallenge(); + bool _HandleReconnectProof(); + bool _HandleRealmList(); + //data transfer handle for patch + + bool _HandleXferResume(); + bool _HandleXferCancel(); + bool _HandleXferAccept(); + + void _SetVSFields(const std::string& rI); + + FILE *pPatch; + ACE_Thread_Mutex patcherLock; + + private: + RealmSocket& socket_; + RealmSocket& socket(void) { return socket_; } + + BigNumber N, s, g, v; + BigNumber b, B; + BigNumber K; + BigNumber _reconnectProof; + + bool _authed; + + std::string _login; + std::string _safelogin; + + // Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ + // between enUS and enGB, which is important for the patch system + std::string _localizationName; + uint16 _build; + uint8 _expversion; + AccountTypes _accountSecurityLevel; +}; +#endif +/// @} diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h new file mode 100644 index 0000000..5e243ea --- /dev/null +++ b/src/server/authserver/Server/RealmAcceptor.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd + */ + +#ifndef __REALMACCEPTOR_H__ +#define __REALMACCEPTOR_H__ + +#include +#include + +#include "RealmSocket.h" +#include "AuthSocket.h" + +class RealmAcceptor : public ACE_Acceptor +{ + public: + RealmAcceptor(void) { } + virtual ~RealmAcceptor(void) { } + + protected: + virtual int make_svc_handler(RealmSocket *&sh) + { + if (sh == 0) + ACE_NEW_RETURN(sh, RealmSocket, -1); + + sh->reactor(reactor()); + sh->set_session(new AuthSocket(*sh)); + return 0; + } +}; + +#endif /* __REALMACCEPTOR_H__ */ diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp new file mode 100644 index 0000000..7eb96cb --- /dev/null +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -0,0 +1,324 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd + */ + +#include "RealmSocket.h" + +#include "Log.h" + +#include +#include +#include + +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + +RealmSocket::Session::Session(void) +{ +} + +RealmSocket::Session::~Session(void) +{ +} + +RealmSocket::RealmSocket(void): + session_(NULL), + input_buffer_(4096), + remote_address_() +{ + reference_counting_policy().value( + ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + msg_queue()->high_water_mark(8*1024*1024); + msg_queue()->low_water_mark(8*1024*1024); + +} + +RealmSocket::~RealmSocket(void) +{ + if (msg_queue()) + msg_queue()->close(); + + // delete RealmSocketObject must never be called from our code. + closing_ = true; + + if (session_) + delete session_; + + peer().close(); +} + +int RealmSocket::open(void * arg) +{ + ACE_INET_Addr addr; + + if (peer ().get_remote_addr (addr) == -1) + { + sLog.outError ("RealmSocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror (errno)); + return -1; + } + + remote_address_ = addr.get_host_addr(); + + // Register with ACE Reactor + if (Base::open(arg) == -1) + return -1; + + if (session_ != NULL) + { + session_->OnAccept(); + } + + // reactor takes care of the socket from now on + remove_reference(); + + return 0; +} + +int RealmSocket::close(int) +{ + shutdown(); + + closing_ = true; + + remove_reference(); + + return 0; +} + +const ACE_CString& RealmSocket::get_remote_address(void) const +{ + return remote_address_; +} + +size_t RealmSocket::recv_len(void) const +{ + return input_buffer_.length(); +} + +bool RealmSocket::recv_soft(char *buf, size_t len) +{ + if (input_buffer_.length() < len) + return false; + + ACE_OS::memcpy(buf, input_buffer_.rd_ptr(), len); + + return true; +} + +bool RealmSocket::recv(char *buf, size_t len) +{ + bool ret = recv_soft(buf, len); + + if (ret) + recv_skip(len); + + return ret; +} + +void RealmSocket::recv_skip(size_t len) +{ + input_buffer_.rd_ptr(len); +} + +ssize_t RealmSocket::noblk_send(ACE_Message_Block &message_block) +{ + const size_t len = message_block.length(); + + if (len == 0) + return -1; + + // Try to send the message directly. + ssize_t n = peer().send(message_block.rd_ptr(), len, MSG_NOSIGNAL); + + if (n < 0) + { + if (errno == EWOULDBLOCK) + // Blocking signal + return 0; + else + // Error happened + return -1; + } + else if (n == 0) + { + // Can this happen ? + return -1; + } + + // return bytes transmitted + return n; +} + +bool RealmSocket::send(const char *buf, size_t len) +{ + if (buf == NULL || len == 0) + return true; + + ACE_Data_Block db( + len, + ACE_Message_Block::MB_DATA, + (const char*)buf, + 0, + 0, + ACE_Message_Block::DONT_DELETE, + 0); + + ACE_Message_Block message_block( + &db, + ACE_Message_Block::DONT_DELETE, + 0); + + message_block.wr_ptr(len); + + if (msg_queue()->is_empty()) + { + // Try to send it directly. + ssize_t n = noblk_send(message_block); + + if (n < 0) + return false; + else if (n == len) + return true; + + // fall down + message_block.rd_ptr((size_t)n); + } + + ACE_Message_Block *mb = message_block.clone(); + + if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + { + mb->release(); + return false; + } + + if (reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1) + return false; + + return true; +} + +int RealmSocket::handle_output(ACE_HANDLE /*= ACE_INVALID_HANDLE*/) +{ + if (closing_) + return -1; + + ACE_Message_Block *mb = 0; + + if (msg_queue()->is_empty()) + { + reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK); + return 0; + } + + if (msg_queue()->dequeue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + return -1; + + ssize_t n = noblk_send(*mb); + + if (n < 0) + { + mb->release(); + return -1; + } + else if (n == mb->length()) + { + mb->release(); + return 1; + } + else + { + mb->rd_ptr(n); + + if (msg_queue()->enqueue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + { + mb->release(); + return -1; + } + + return 0; + } + + ACE_NOTREACHED(return -1); +} + +int RealmSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask /*m*/) +{ + // As opposed to WorldSocket::handle_close, we don't need locks here. + + closing_ = true; + + if (h == ACE_INVALID_HANDLE) + peer ().close_writer (); + + if (session_ != NULL) + { + session_->OnClose(); + } + + return 0; +} + +int RealmSocket::handle_input(ACE_HANDLE /*= ACE_INVALID_HANDLE*/) +{ + if (closing_) + return -1; + + const ssize_t space = input_buffer_.space(); + + ssize_t n = peer().recv(input_buffer_.wr_ptr(), space); + + if (n < 0) + { + return errno == EWOULDBLOCK ? 0 : -1; + } + else if (n == 0) + { + // EOF + return -1; + } + + input_buffer_.wr_ptr((size_t)n); + + if (session_ != NULL) + { + session_->OnRead(); + + input_buffer_.crunch(); + } + + // return 1 in case there is more data to read from OS + return n == space ? 1 : 0; +} + + +void RealmSocket::set_session(Session* session) +{ + if (session_ != NULL) + delete session_; + + session_ = session; +} + diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h new file mode 100644 index 0000000..8749fba --- /dev/null +++ b/src/server/authserver/Server/RealmSocket.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** \file + \ingroup realmd + */ + +#ifndef __REALMSOCKET_H__ +#define __REALMSOCKET_H__ + +#include +#include +#include +#include +#include + +class RealmSocket : public ACE_Svc_Handler +{ + private: + typedef ACE_Svc_Handler Base; + + public: + class Session + { + public: + Session(void); + virtual ~Session(void); + + virtual void OnRead(void) = 0; + virtual void OnAccept(void) = 0; + virtual void OnClose(void) = 0; + }; + + RealmSocket(void); + virtual ~RealmSocket(void); + + size_t recv_len(void) const; + bool recv_soft(char *buf, size_t len); + bool recv(char *buf, size_t len); + void recv_skip(size_t len); + + bool send(const char *buf, size_t len); + + const ACE_CString& get_remote_address(void) const; + + virtual int open(void *); + + virtual int close(int); + + virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE); + virtual int handle_output(ACE_HANDLE = ACE_INVALID_HANDLE); + + virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + + void set_session(Session* session); + + private: + ssize_t noblk_send(ACE_Message_Block &message_block); + + private: + ACE_Message_Block input_buffer_; + Session* session_; + ACE_CString remote_address_; +}; + +#endif /* __REALMSOCKET_H__ */ diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist new file mode 100644 index 0000000..33e2db4 --- /dev/null +++ b/src/server/authserver/authserver.conf.dist @@ -0,0 +1,146 @@ +########################################## +# Trinity Core realmd configuration file # +########################################## +# Note to devs, line breaks should be at column 80 +############################################################################### +# REALMD SETTINGS +# +# LoginDatabaseInfo +# Database connection settings for the realm server. +# Default: +# hostname;port;username;password;database +# .;somenumber;username;password;database +# - use named pipes in Windows +# Named pipes: mySQL required adding +# "enable-named-pipe" to [mysqld] section my.ini +# .;/path/to/unix_socket;username;password;database +# - use Unix sockets in Unix/Linux +# +# LogsDir +# Logs directory setting. +# Important: Logs dir must exists, or all logs need to be disabled +# Default: "" - no log directory prefix, if used log names isn't +# absolute path then logs will be stored in current directory. +# +# MaxPingTime +# Settings for maximum database-ping interval (minutes between pings) +# +# RealmServerPort +# Default RealmServerPort +# +# BindIP +# Bind Realm Server to IP/hostname +# +# PidFile +# Realmd daemon PID file +# Default: "" - do not create PID file +# "./realmd.pid" - create PID file (recommended name) +# +# LogLevel +# Server console level of logging +# Default: 0 = Minimum +# 1 = Basic +# 2 = Detail +# 3 = Full/Debug +# +# LogFile +# Logfile name +# Default: "realmd.log" +# "" - Empty name disable creating log file +# +# LogTimestamp +# Logfile with timestamp of server start in name +# in form Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext +# Default: 0 - no timestamp in name +# 1 - add timestamp in name +# +# LogFileLevel +# Server file level of logging +# Default: 0 = Minimum +# 1 = Basic +# 2 = Detail +# 3 = Full/Debug +# +# LogColors +# Color for messages (format "normal basic detail debug") +# Default: "" - no colors +# Colors: 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5" +# +# EnableLogDB +# Enable/disable logging to database (LogDatabaseInfo). +# Default: 0 - disabled +# 1 - enabled +# +# DBLogLevel +# Log level of DB logging. +# 0 = Minimum +# Default: 1 = Basic +# 2 = Detail +# 3 = Full/Debug +# +# UseProcessors +# Processors mask for multi-processor system (Used only in Windows) +# Default: 0 (selected by OS) +# number (bitmask value of selected processors) +# +# ProcessPriority +# Process proirity setting (Used only at Windows) +# Default: 1 (HIGH) +# 0 (Normal) +# +# RealmsStateUpdateDelay +# Realm list Update up delay +# (updated at realm list request if delay expired). +# Default: 20 +# 0 (Disabled) +# +# WrongPass.MaxCount +# Number of login attemps with wrong password +# before the account or IP is banned +# Default: 0 (Never ban) +# +# WrongPass.BanTime +# Duration of the ban in seconds (0 means permanent ban) +# Default: 600 +# +# WrongPass.BanType +# Ban the IP or account on which login is attempted +# Default: 0 (Ban IP) +# 1 (Ban Account) +# +############################################################################### + +LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" +LogsDir = "" +MaxPingTime = 30 +RealmServerPort = 3724 +BindIP = "0.0.0.0" +PidFile = "" +LogLevel = 0 +LogFile = "auth.log" +LogTimestamp = 0 +LogFileLevel = 0 +LogColors = "" +EnableLogDB = 0 +DBLogLevel = 1 +UseProcessors = 0 +ProcessPriority = 1 +RealmsStateUpdateDelay = 20 +WrongPass.MaxCount = 0 +WrongPass.BanTime = 600 +WrongPass.BanType = 0 diff --git a/src/server/authserver/authserver.ico b/src/server/authserver/authserver.ico new file mode 100644 index 0000000..da318f4 Binary files /dev/null and b/src/server/authserver/authserver.ico differ diff --git a/src/server/authserver/authserver.rc b/src/server/authserver/authserver.rc new file mode 100644 index 0000000..74ce7f4 --- /dev/null +++ b/src/server/authserver/authserver.rc @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "resource.h" +#include "../shared/revision.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "windows.h" //"afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APPICON ICON "authserver.ico" + +///////////////////////////////////////////////////////////////////////////// +// Neutre (Par défaut systčme) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD) +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION FILEVER + PRODUCTVERSION PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x0L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080004b0" + BEGIN + VALUE "FileDescription", "authserver" + VALUE "FileVersion", STRFILEVER + VALUE "InternalName", "authserver" + VALUE "LegalCopyright", "Copyright (C) 2008-2010" + VALUE "OriginalFilename", "authserver.exe" + VALUE "ProductName", "authserver" + VALUE "ProductVersion", STRPRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x800, 1200 + END +END +#endif diff --git a/src/server/authserver/resource.h b/src/server/authserver/resource.h new file mode 100644 index 0000000..7dc5cb9 --- /dev/null +++ b/src/server/authserver/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by TrinityCore.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp new file mode 100644 index 0000000..7bb44a9 --- /dev/null +++ b/src/server/collision/BoundingIntervalHierarchy.cpp @@ -0,0 +1,304 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BoundingIntervalHierarchy.h" + +void BIH::buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats) +{ + // create space for the first node + tempTree.push_back(3 << 30); // dummy leaf + tempTree.insert(tempTree.end(), 2, 0); + //tempTree.add(0); + + // seed bbox + AABound gridBox = { bounds.low(), bounds.high() }; + AABound nodeBox = gridBox; + // seed subdivide function + subdivide(0, dat.numPrims - 1, tempTree, dat, gridBox, nodeBox, 0, 1, stats); +} + +void BIH::subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats) +{ + if ((right - left + 1) <= dat.maxPrims || depth >= MAX_STACK_SIZE) + { + // write leaf node + stats.updateLeaf(depth, right - left + 1); + createNode(tempTree, nodeIndex, left, right); + return; + } + // calculate extents + int axis = -1, prevAxis, rightOrig; + float clipL = G3D::fnan(), clipR = G3D::fnan(), prevClip = G3D::fnan(); + float split = G3D::fnan(), prevSplit; + bool wasLeft = true; + while (true) + { + prevAxis = axis; + prevSplit = split; + // perform quick consistency checks + Vector3 d( gridBox.hi - gridBox.lo ); + if (d.x < 0 || d.y < 0 || d.z < 0) + throw std::logic_error("negative node extents"); + for (int i = 0; i < 3; i++) + { + if (nodeBox.hi[i] < gridBox.lo[i] || nodeBox.lo[i] > gridBox.hi[i]) + { + //UI.printError(Module.ACCEL, "Reached tree area in error - discarding node with: %d objects", right - left + 1); + throw std::logic_error("invalid node overlap"); + } + } + // find longest axis + axis = d.primaryAxis(); + split = 0.5f * (gridBox.lo[axis] + gridBox.hi[axis]); + // partition L/R subsets + clipL = -G3D::inf(); + clipR = G3D::inf(); + rightOrig = right; // save this for later + float nodeL = G3D::inf(); + float nodeR = -G3D::inf(); + for (int i = left; i <= right;) + { + int obj = dat.indices[i]; + float minb = dat.primBound[obj].low()[axis]; + float maxb = dat.primBound[obj].high()[axis]; + float center = (minb + maxb) * 0.5f; + if (center <= split) + { + // stay left + i++; + if (clipL < maxb) + clipL = maxb; + } + else + { + // move to the right most + int t = dat.indices[i]; + dat.indices[i] = dat.indices[right]; + dat.indices[right] = t; + right--; + if (clipR > minb) + clipR = minb; + } + nodeL = std::min(nodeL, minb); + nodeR = std::max(nodeR, maxb); + } + // check for empty space + if (nodeL > nodeBox.lo[axis] && nodeR < nodeBox.hi[axis]) + { + float nodeBoxW = nodeBox.hi[axis] - nodeBox.lo[axis]; + float nodeNewW = nodeR - nodeL; + // node box is too big compare to space occupied by primitives? + if (1.3f * nodeNewW < nodeBoxW) + { + stats.updateBVH2(); + int nextIndex = tempTree.size(); + // allocate child + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + // write bvh2 clip node + stats.updateInner(); + tempTree[nodeIndex + 0] = (axis << 30) | (1 << 29) | nextIndex; + tempTree[nodeIndex + 1] = floatToRawIntBits(nodeL); + tempTree[nodeIndex + 2] = floatToRawIntBits(nodeR); + // update nodebox and recurse + nodeBox.lo[axis] = nodeL; + nodeBox.hi[axis] = nodeR; + subdivide(left, rightOrig, tempTree, dat, gridBox, nodeBox, nextIndex, depth + 1, stats); + return; + } + } + // ensure we are making progress in the subdivision + if (right == rightOrig) + { + // all left + if (prevAxis == axis && prevSplit == split) { + // we are stuck here - create a leaf + stats.updateLeaf(depth, right - left + 1); + createNode(tempTree, nodeIndex, left, right); + return; + } + if (clipL <= split) { + // keep looping on left half + gridBox.hi[axis] = split; + prevClip = clipL; + wasLeft = true; + continue; + } + gridBox.hi[axis] = split; + prevClip = G3D::fnan(); + } + else if (left > right) + { + // all right + if (prevAxis == axis && prevSplit == split) { + // we are stuck here - create a leaf + stats.updateLeaf(depth, right - left + 1); + createNode(tempTree, nodeIndex, left, right); + return; + } + right = rightOrig; + if (clipR >= split) { + // keep looping on right half + gridBox.lo[axis] = split; + prevClip = clipR; + wasLeft = false; + continue; + } + gridBox.lo[axis] = split; + prevClip = G3D::fnan(); + } + else + { + // we are actually splitting stuff + if (prevAxis != -1 && !isnan(prevClip)) + { + // second time through - lets create the previous split + // since it produced empty space + int nextIndex = tempTree.size(); + // allocate child node + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + if (wasLeft) { + // create a node with a left child + // write leaf node + stats.updateInner(); + tempTree[nodeIndex + 0] = (prevAxis << 30) | nextIndex; + tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip); + tempTree[nodeIndex + 2] = floatToRawIntBits(G3D::inf()); + } else { + // create a node with a right child + // write leaf node + stats.updateInner(); + tempTree[nodeIndex + 0] = (prevAxis << 30) | (nextIndex - 3); + tempTree[nodeIndex + 1] = floatToRawIntBits(-G3D::inf()); + tempTree[nodeIndex + 2] = floatToRawIntBits(prevClip); + } + // count stats for the unused leaf + depth++; + stats.updateLeaf(depth, 0); + // now we keep going as we are, with a new nodeIndex: + nodeIndex = nextIndex; + } + break; + } + } + // compute index of child nodes + int nextIndex = tempTree.size(); + // allocate left node + int nl = right - left + 1; + int nr = rightOrig - (right + 1) + 1; + if (nl > 0) { + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + } else + nextIndex -= 3; + // allocate right node + if (nr > 0) { + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + } + // write leaf node + stats.updateInner(); + tempTree[nodeIndex + 0] = (axis << 30) | nextIndex; + tempTree[nodeIndex + 1] = floatToRawIntBits(clipL); + tempTree[nodeIndex + 2] = floatToRawIntBits(clipR); + // prepare L/R child boxes + AABound gridBoxL(gridBox), gridBoxR(gridBox); + AABound nodeBoxL(nodeBox), nodeBoxR(nodeBox); + gridBoxL.hi[axis] = gridBoxR.lo[axis] = split; + nodeBoxL.hi[axis] = clipL; + nodeBoxR.lo[axis] = clipR; + // recurse + if (nl > 0) + subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats); + else + stats.updateLeaf(depth + 1, 0); + if (nr > 0) + subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats); + else + stats.updateLeaf(depth + 1, 0); +} + +bool BIH::writeToFile(FILE *wf) const +{ + uint32 treeSize = tree.size(); + uint32 check=0, count=0; + check += fwrite(&bounds.low(), sizeof(float), 3, wf); + check += fwrite(&bounds.high(), sizeof(float), 3, wf); + check += fwrite(&treeSize, sizeof(uint32), 1, wf); + check += fwrite(&tree[0], sizeof(uint32), treeSize, wf); + count = objects.size(); + check += fwrite(&count, sizeof(uint32), 1, wf); + check += fwrite(&objects[0], sizeof(uint32), count, wf); + return check == (3 + 3 + 2 + treeSize + count); +} + +bool BIH::readFromFile(FILE *rf) +{ + uint32 treeSize; + Vector3 lo, hi; + uint32 check=0, count=0; + check += fread(&lo, sizeof(float), 3, rf); + check += fread(&hi, sizeof(float), 3, rf); + bounds = AABox(lo, hi); + check += fread(&treeSize, sizeof(uint32), 1, rf); + tree.resize(treeSize); + check += fread(&tree[0], sizeof(uint32), treeSize, rf); + check += fread(&count, sizeof(uint32), 1, rf); + objects.resize(count); // = new uint32[nObjects]; + check += fread(&objects[0], sizeof(uint32), count, rf); + return check == (3 + 3 + 2 + treeSize + count); +} + +void BIH::BuildStats::updateLeaf(int depth, int n) +{ + numLeaves++; + minDepth = std::min(depth, minDepth); + maxDepth = std::max(depth, maxDepth); + sumDepth += depth; + minObjects = std::min(n, minObjects); + maxObjects = std::max(n, maxObjects); + sumObjects += n; + int nl = std::min(n, 5); + ++numLeavesN[nl]; +} + +void BIH::BuildStats::printStats() +{ + printf("Tree stats:\n"); + printf(" * Nodes: %d\n", numNodes); + printf(" * Leaves: %d\n", numLeaves); + printf(" * Objects: min %d\n", minObjects); + printf(" avg %.2f\n", (float) sumObjects / numLeaves); + printf(" avg(n>0) %.2f\n", (float) sumObjects / (numLeaves - numLeavesN[0])); + printf(" max %d\n", maxObjects); + printf(" * Depth: min %d\n", minDepth); + printf(" avg %.2f\n", (float) sumDepth / numLeaves); + printf(" max %d\n", maxDepth); + printf(" * Leaves w/: N=0 %3d%%\n", 100 * numLeavesN[0] / numLeaves); + printf(" N=1 %3d%%\n", 100 * numLeavesN[1] / numLeaves); + printf(" N=2 %3d%%\n", 100 * numLeavesN[2] / numLeaves); + printf(" N=3 %3d%%\n", 100 * numLeavesN[3] / numLeaves); + printf(" N=4 %3d%%\n", 100 * numLeavesN[4] / numLeaves); + printf(" N>4 %3d%%\n", 100 * numLeavesN[5] / numLeaves); + printf(" * BVH2 nodes: %d (%3d%%)\n", numBVH2, 100 * numBVH2 / (numNodes + numLeaves - 2 * numBVH2)); +} diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h new file mode 100644 index 0000000..1e19556 --- /dev/null +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -0,0 +1,395 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _BIH_H +#define _BIH_H + +#include "G3D/Vector3.h" +#include "G3D/Ray.h" +#include "G3D/AABox.h" + +#include "Define.h" + +#include +#include +#include +#include +#include + +#define MAX_STACK_SIZE 64 + +#ifdef _MSC_VER + #define isnan(x) _isnan(x) +#endif + +using G3D::Vector3; +using G3D::AABox; +using G3D::Ray; + +static inline uint32 floatToRawIntBits(float f) +{ + union + { + uint32 ival; + float fval; + } temp; + temp.fval=f; + return temp.ival; +} + +static inline float intBitsToFloat(uint32 i) +{ + union + { + uint32 ival; + float fval; + } temp; + temp.ival=i; + return temp.fval; +} + +struct AABound +{ + Vector3 lo, hi; +}; + +/** Bounding Interval Hierarchy Class. + Building and Ray-Intersection functions based on BIH from + Sunflow, a Java Raytracer, released under MIT/X11 License + http://sunflow.sourceforge.net/ + Copyright (c) 2003-2007 Christopher Kulla +*/ + +class BIH +{ + public: + BIH() {}; + template< class T, class BoundsFunc > + void build(const std::vector &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) + { + if(primitives.size() == 0) + return; + buildData dat; + dat.maxPrims = leafSize; + dat.numPrims = primitives.size(); + dat.indices = new uint32[dat.numPrims]; + dat.primBound = new AABox[dat.numPrims]; + getBounds(primitives[0], bounds); + for (uint32 i=0; i tempTree; + BuildStats stats; + buildHierarchy(tempTree, dat, stats); + if (printStats) + stats.printStats(); + + objects.resize(dat.numPrims); + for (uint32 i=0; i + void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const + { + float intervalMin = -1.f; + float intervalMax = -1.f; + Vector3 org = r.origin(); + Vector3 dir = r.direction(); + Vector3 invDir; + for (int i=0; i<3; ++i) + { + invDir[i] = 1.f / dir[i]; + if (dir[i] != 0.f) + { + float t1 = (bounds.low()[i] - org[i]) * invDir[i]; + float t2 = (bounds.high()[i] - org[i]) * invDir[i]; + if (t1 > t2) + std::swap(t1, t2); + if (t1 > intervalMin) + intervalMin = t1; + if (t2 < intervalMax || intervalMax < 0.f) + intervalMax = t2; + // intervalMax can only become smaller for other axis, + // and intervalMin only larger respectively, so stop early + if (intervalMax <= 0 || intervalMin >= maxDist) + return; + } + } + + if (intervalMin > intervalMax) + return; + intervalMin = std::max(intervalMin, 0.f); + intervalMax = std::min(intervalMax, maxDist); + + uint32 offsetFront[3]; + uint32 offsetBack[3]; + uint32 offsetFront3[3]; + uint32 offsetBack3[3]; + // compute custom offsets from direction sign bit + + for(int i=0; i<3; ++i) + { + offsetFront[i] = floatToRawIntBits(dir[i]) >> 31; + offsetBack[i] = offsetFront[i] ^ 1; + offsetFront3[i] = offsetFront[i] * 3; + offsetBack3[i] = offsetBack[i] * 3; + + // avoid always adding 1 during the inner loop + ++offsetFront[i]; + ++offsetBack[i]; + } + + StackNode stack[MAX_STACK_SIZE]; + int stackPos = 0; + int node = 0; + + while (true) { + while (true) + { + uint32 tn = tree[node]; + uint32 axis = (tn & (3 << 30)) >> 30; + bool BVH2 = tn & (1 << 29); + int offset = tn & ~(7 << 29); + if (!BVH2) + { + if (axis < 3) + { + // "normal" interior node + float tf = (intBitsToFloat(tree[node + offsetFront[axis]]) - org[axis]) * invDir[axis]; + float tb = (intBitsToFloat(tree[node + offsetBack[axis]]) - org[axis]) * invDir[axis]; + // ray passes between clip zones + if (tf < intervalMin && tb > intervalMax) + break; + int back = offset + offsetBack3[axis]; + node = back; + // ray passes through far node only + if (tf < intervalMin) { + intervalMin = (tb >= intervalMin) ? tb : intervalMin; + continue; + } + node = offset + offsetFront3[axis]; // front + // ray passes through near node only + if (tb > intervalMax) { + intervalMax = (tf <= intervalMax) ? tf : intervalMax; + continue; + } + // ray passes through both nodes + // push back node + stack[stackPos].node = back; + stack[stackPos].tnear = (tb >= intervalMin) ? tb : intervalMin; + stack[stackPos].tfar = intervalMax; + stackPos++; + // update ray interval for front node + intervalMax = (tf <= intervalMax) ? tf : intervalMax; + continue; + } + else + { + // leaf - test some objects + int n = tree[node + 1]; + while (n > 0) { + bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst); + if(stopAtFirst && hit) return; + --n; + ++offset; + } + break; + } + } + else + { + if (axis>2) + return; // should not happen + float tf = (intBitsToFloat(tree[node + offsetFront[axis]]) - org[axis]) * invDir[axis]; + float tb = (intBitsToFloat(tree[node + offsetBack[axis]]) - org[axis]) * invDir[axis]; + node = offset; + intervalMin = (tf >= intervalMin) ? tf : intervalMin; + intervalMax = (tb <= intervalMax) ? tb : intervalMax; + if (intervalMin > intervalMax) + break; + continue; + } + } // traversal loop + do + { + // stack is empty? + if (stackPos == 0) + return; + // move back up the stack + stackPos--; + intervalMin = stack[stackPos].tnear; + if (maxDist < intervalMin) + continue; + node = stack[stackPos].node; + intervalMax = stack[stackPos].tfar; + break; + } while (true); + } + } + + template + void intersectPoint(const Vector3 &p, IsectCallback& intersectCallback) const + { + if (!bounds.contains(p)) + return; + + StackNode stack[MAX_STACK_SIZE]; + int stackPos = 0; + int node = 0; + + while (true) { + while (true) + { + uint32 tn = tree[node]; + uint32 axis = (tn & (3 << 30)) >> 30; + bool BVH2 = tn & (1 << 29); + int offset = tn & ~(7 << 29); + if (!BVH2) + { + if (axis < 3) + { + // "normal" interior node + float tl = intBitsToFloat(tree[node + 1]); + float tr = intBitsToFloat(tree[node + 2]); + // point is between clip zones + if (tl < p[axis] && tr > p[axis]) + break; + int right = offset + 3; + node = right; + // point is in right node only + if (tl < p[axis]) { + continue; + } + node = offset; // left + // point is in left node only + if (tr > p[axis]) { + continue; + } + // point is in both nodes + // push back right node + stack[stackPos].node = right; + stackPos++; + continue; + } + else + { + // leaf - test some objects + int n = tree[node + 1]; + while (n > 0) { + intersectCallback(p, objects[offset]); // !!! + --n; + ++offset; + } + break; + } + } + else // BVH2 node (empty space cut off left and right) + { + if (axis>2) + return; // should not happen + float tl = intBitsToFloat(tree[node + 1]); + float tr = intBitsToFloat(tree[node + 2]); + node = offset; + if (tl > p[axis] || tr < p[axis]) + break; + continue; + } + } // traversal loop + + // stack is empty? + if (stackPos == 0) + return; + // move back up the stack + stackPos--; + node = stack[stackPos].node; + } + } + + bool writeToFile(FILE *wf) const; + bool readFromFile(FILE *rf); + + protected: + std::vector tree; + std::vector objects; + AABox bounds; + + struct buildData + { + uint32 *indices; + AABox *primBound; + uint32 numPrims; + int maxPrims; + }; + struct StackNode + { + uint32 node; + float tnear; + float tfar; + }; + + class BuildStats + { + private: + int numNodes; + int numLeaves; + int sumObjects; + int minObjects; + int maxObjects; + int sumDepth; + int minDepth; + int maxDepth; + int numLeavesN[6]; + int numBVH2; + + public: + BuildStats(): + numNodes(0), numLeaves(0), sumObjects(0), minObjects(0x0FFFFFFF), + maxObjects(0xFFFFFFFF), sumDepth(0), minDepth(0x0FFFFFFF), + maxDepth(0xFFFFFFFF), numBVH2(0) + { + for(int i=0; i<6; ++i) numLeavesN[i] = 0; + } + + void updateInner() { numNodes++; } + void updateBVH2() { numBVH2++; } + void updateLeaf(int depth, int n); + void printStats(); + }; + + void buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats); + + void createNode(std::vector &tempTree, int nodeIndex, uint32 left, uint32 right) { + // write leaf node + tempTree[nodeIndex + 0] = (3 << 30) | left; + tempTree[nodeIndex + 1] = right - left + 1; + } + + void subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats); +}; + +#endif // _BIH_H diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt new file mode 100644 index 0000000..4749d88 --- /dev/null +++ b/src/server/collision/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +########### collision ############### + +set(collision_STAT_SRCS + BoundingIntervalHierarchy.cpp + Maps/MapTree.cpp + Maps/TileAssembler.cpp + Models/ModelInstance.cpp + Models/WorldModel.cpp + Management/VMapFactory.cpp + Management/VMapManager2.cpp +) + +include_directories( + ${ACE_INCLUDE_DIR} + ${CMAKE_SOURCE_DIR}/externals/g3dlite + ${CMAKE_SOURCE_DIR}/externals/mysql + ${CMAKE_SOURCE_DIR}/src/server/shared + ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging + ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic + ${CMAKE_SOURCE_DIR}/src/server/shared/Logging + ${CMAKE_SOURCE_DIR}/src/server/collision + ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/collision/Maps + ${CMAKE_SOURCE_DIR}/src/server/collision/Models + ${CMAKE_BINARY_DIR} +) + +add_library(collision STATIC ${collision_STAT_SRCS}) diff --git a/src/server/collision/Management/IVMapManager.h b/src/server/collision/Management/IVMapManager.h new file mode 100644 index 0000000..6a0e717 --- /dev/null +++ b/src/server/collision/Management/IVMapManager.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _IVMAPMANAGER_H +#define _IVMAPMANAGER_H + +#include +#include "Define.h" + +//=========================================================== + +/** +This is the minimum interface to the VMapMamager. +*/ + +namespace VMAP +{ + + enum VMAP_LOAD_RESULT + { + VMAP_LOAD_RESULT_ERROR, + VMAP_LOAD_RESULT_OK, + VMAP_LOAD_RESULT_IGNORED, + }; + + #define VMAP_INVALID_HEIGHT -100000.0f // for check + #define VMAP_INVALID_HEIGHT_VALUE -200000.0f // real assigned value in unknown height case + + //=========================================================== + class IVMapManager + { + private: + bool iEnableLineOfSightCalc; + bool iEnableHeightCalc; + + public: + IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) {} + + virtual ~IVMapManager(void) {} + + virtual int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0; + + virtual bool existsMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0; + + virtual void unloadMap(unsigned int pMapId, int x, int y) = 0; + virtual void unloadMap(unsigned int pMapId) = 0; + + virtual bool isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) = 0; + virtual float getHeight(unsigned int pMapId, float x, float y, float z) = 0; + /** + test if we hit an object. return true if we hit one. rx,ry,rz will hold the hit position or the dest position, if no intersection was found + return a position, that is pReduceDist closer to the origin + */ + virtual bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist) = 0; + /** + send debug commands + */ + virtual bool processCommand(char *pCommand)= 0; + + /** + Enable/disable LOS calculation + It is enabled by default. If it is enabled in mid game the maps have to loaded manualy + */ + void setEnableLineOfSightCalc(bool pVal) { iEnableLineOfSightCalc = pVal; } + /** + Enable/disable model height calculation + It is enabled by default. If it is enabled in mid game the maps have to loaded manualy + */ + void setEnableHeightCalc(bool pVal) { iEnableHeightCalc = pVal; } + + bool isLineOfSightCalcEnabled() const { return(iEnableLineOfSightCalc); } + bool isHeightCalcEnabled() const { return(iEnableHeightCalc); } + bool isMapLoadingEnabled() const { return(iEnableLineOfSightCalc || iEnableHeightCalc ); } + + virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const =0; + /** + Block maps from being used. + parameter: String of map ids. Delimiter = "," + e.g.: "0,1,530" + */ + virtual void preventMapsFromBeingUsed(const char* pMapIdString) =0; + /** + Query world model area info. + \param z gets adjusted to the ground height for which this are info is valid + */ + virtual bool getAreaInfo(unsigned int pMapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const=0; + virtual bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float &level, float &floor, uint32 &type) const=0; + }; + +} +#endif diff --git a/src/server/collision/Management/VMapFactory.cpp b/src/server/collision/Management/VMapFactory.cpp new file mode 100644 index 0000000..561bf0d --- /dev/null +++ b/src/server/collision/Management/VMapFactory.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include "VMapFactory.h" +#include "VMapManager2.h" + +using namespace G3D; + +namespace VMAP +{ + void chompAndTrim(std::string& str) + { + while(str.length() >0) + { + char lc = str[str.length()-1]; + if(lc == '\r' || lc == '\n' || lc == ' ' || lc == '"' || lc == '\'') + { + str = str.substr(0,str.length()-1); + } + else + { + break; + } + } + while(str.length() >0) + { + char lc = str[0]; + if(lc == ' ' || lc == '"' || lc == '\'') + { + str = str.substr(1,str.length()-1); + } + else + { + break; + } + } + } + + IVMapManager *gVMapManager = 0; + Table* iIgnoreSpellIds=0; + + //=============================================== + // result false, if no more id are found + + bool getNextId(const std::string& pString, unsigned int& pStartPos, unsigned int& pId) + { + bool result = false; + unsigned int i; + for(i=pStartPos;ipStartPos) + { + std::string idString = pString.substr(pStartPos, i-pStartPos); + pStartPos = i+1; + chompAndTrim(idString); + pId = atoi(idString.c_str()); + result = true; + } + return(result); + } + + //=============================================== + /** + parameter: String of map ids. Delimiter = "," + */ + + void VMapFactory::preventSpellsFromBeingTestedForLoS(const char* pSpellIdString) + { + if(!iIgnoreSpellIds) + iIgnoreSpellIds = new Table(); + if(pSpellIdString != NULL) + { + unsigned int pos =0; + unsigned int id; + std::string confString(pSpellIdString); + chompAndTrim(confString); + while(getNextId(confString, pos, id)) + { + iIgnoreSpellIds->set(id, true); + } + } + } + + //=============================================== + + bool VMapFactory::checkSpellForLoS(unsigned int pSpellId) + { + return(!iIgnoreSpellIds->containsKey(pSpellId)); + } + + //=============================================== + // just return the instance + IVMapManager* VMapFactory::createOrGetVMapManager() + { + if(gVMapManager == 0) + gVMapManager= new VMapManager2(); // should be taken from config ... Please change if you like :-) + return gVMapManager; + } + + //=============================================== + // delete all internal data structures + void VMapFactory::clear() + { + delete iIgnoreSpellIds; + iIgnoreSpellIds = NULL; + + delete gVMapManager; + gVMapManager = NULL; + } +} diff --git a/src/server/collision/Management/VMapFactory.h b/src/server/collision/Management/VMapFactory.h new file mode 100644 index 0000000..8dc2c01 --- /dev/null +++ b/src/server/collision/Management/VMapFactory.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VMAPFACTORY_H +#define _VMAPFACTORY_H + +#include "IVMapManager.h" + +/** +This is the access point to the VMapManager. +*/ + +namespace VMAP +{ + //=========================================================== + + class VMapFactory + { + public: + static IVMapManager* createOrGetVMapManager(); + static void clear(); + + static void preventSpellsFromBeingTestedForLoS(const char* pSpellIdString); + static bool checkSpellForLoS(unsigned int pSpellId); + }; + +} +#endif diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp new file mode 100644 index 0000000..61b202c --- /dev/null +++ b/src/server/collision/Management/VMapManager2.cpp @@ -0,0 +1,338 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * 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, see . + */ + +#include +#include +#include +#include +#include "VMapManager2.h" +#include "MapTree.h" +#include "ModelInstance.h" +#include "WorldModel.h" +#include "VMapDefinitions.h" +#include "Log.h" + +using G3D::Vector3; + +namespace VMAP +{ + + //========================================================= + + VMapManager2::VMapManager2() + { + } + + //========================================================= + + VMapManager2::~VMapManager2(void) + { + for (InstanceTreeMap::iterator i = iInstanceMapTrees.begin(); i != iInstanceMapTrees.end(); ++i) + { + delete i->second; + } + for (ModelFileMap::iterator i = iLoadedModelFiles.begin(); i != iLoadedModelFiles.end(); ++i) + { + delete i->second.getModel(); + } + } + + //========================================================= + + Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const + { + Vector3 pos; + const float mid = 0.5f * 64.0f * 533.33333333f; + pos.x = mid - x; + pos.y = mid - y; + pos.z = z; + + return pos; + } + + //========================================================= + + Vector3 VMapManager2::convertPositionToMangosRep(float x, float y, float z) const + { + Vector3 pos; + const float mid = 0.5f * 64.0f * 533.33333333f; + pos.x = mid - x; + pos.y = mid - y; + pos.z = z; + + return pos; + } + //========================================================= + + // move to MapTree too? + std::string VMapManager2::getMapFileName(unsigned int pMapId) + { + std::stringstream fname; + fname.width(3); + fname << std::setfill('0') << pMapId << std::string(MAP_FILENAME_EXTENSION2); + return fname.str(); + } + + //========================================================= + /** + Block maps from being used. + parameter: String of map ids. Delimiter = "," + e.g.: "0,1,590" + */ + + void VMapManager2::preventMapsFromBeingUsed(const char* pMapIdString) + { + iIgnoreMapIds.clear(); + if (pMapIdString != NULL) + { + std::string map_str; + std::stringstream map_ss; + map_ss.str(std::string(pMapIdString)); + while (std::getline(map_ss, map_str, ',')) + { + std::stringstream ss2(map_str); + int map_num = -1; + ss2 >> map_num; + if (map_num >= 0) + { + sLog.outDebug("Ignoring Map %i for VMaps", map_num); + iIgnoreMapIds[map_num] = true; + // unload map in case it is loaded + unloadMap(map_num); + } + } + } + } + + //========================================================= + + int VMapManager2::loadMap(const char* pBasePath, unsigned int pMapId, int x, int y) + { + int result = VMAP_LOAD_RESULT_IGNORED; + if (isMapLoadingEnabled() && !iIgnoreMapIds.count(pMapId)) + { + if (_loadMap(pMapId, pBasePath, x, y)) + result = VMAP_LOAD_RESULT_OK; + else + result = VMAP_LOAD_RESULT_ERROR; + } + return result; + } + + //========================================================= + // load one tile (internal use only) + + bool VMapManager2::_loadMap(unsigned int pMapId, const std::string &basePath, uint32 tileX, uint32 tileY) + { + InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree == iInstanceMapTrees.end()) + { + std::string mapFileName = getMapFileName(pMapId); + StaticMapTree *newTree = new StaticMapTree(pMapId, basePath); + if (!newTree->InitMap(mapFileName, this)) + return false; + instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(pMapId, newTree)).first; + } + return instanceTree->second->LoadMapTile(tileX, tileY, this); + } + + //========================================================= + + void VMapManager2::unloadMap(unsigned int pMapId) + { + InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree != iInstanceMapTrees.end()) + { + instanceTree->second->UnloadMap(this); + if (instanceTree->second->numLoadedTiles() == 0) + { + delete instanceTree->second; + iInstanceMapTrees.erase(pMapId); + } + } + } + + //========================================================= + + void VMapManager2::unloadMap(unsigned int pMapId, int x, int y) + { + InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree != iInstanceMapTrees.end()) + { + instanceTree->second->UnloadMapTile(x, y, this); + if (instanceTree->second->numLoadedTiles() == 0) + { + delete instanceTree->second; + iInstanceMapTrees.erase(pMapId); + } + } + } + + //========================================================== + + bool VMapManager2::isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) + { + if (!isLineOfSightCalcEnabled()) return true; + bool result = true; + InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree != iInstanceMapTrees.end()) + { + Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1); + Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2); + if (pos1 != pos2) + { + result = instanceTree->second->isInLineOfSight(pos1, pos2); + } + } + return result; + } + //========================================================= + /** + get the hit position and return true if we hit something + otherwise the result pos will be the dest pos + */ + bool VMapManager2::getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist) + { + bool result = false; + rx=x2; + ry=y2; + rz=z2; + if (isLineOfSightCalcEnabled()) + { + InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree != iInstanceMapTrees.end()) + { + Vector3 pos1 = convertPositionToInternalRep(x1,y1,z1); + Vector3 pos2 = convertPositionToInternalRep(x2,y2,z2); + Vector3 resultPos; + result = instanceTree->second->getObjectHitPos(pos1, pos2, resultPos, pModifyDist); + resultPos = convertPositionToMangosRep(resultPos.x,resultPos.y,resultPos.z); + rx = resultPos.x; + ry = resultPos.y; + rz = resultPos.z; + } + } + return result; + } + + //========================================================= + /** + get height or INVALID_HEIGHT if no height available + */ + + float VMapManager2::getHeight(unsigned int pMapId, float x, float y, float z) + { + float height = VMAP_INVALID_HEIGHT_VALUE; //no height + if (isHeightCalcEnabled()) + { + InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree != iInstanceMapTrees.end()) + { + Vector3 pos = convertPositionToInternalRep(x,y,z); + height = instanceTree->second->getHeight(pos); + if (!(height < G3D::inf())) + { + height = VMAP_INVALID_HEIGHT_VALUE; //no height + } + } + } + return height; + } + + //========================================================= + + bool VMapManager2::getAreaInfo(unsigned int pMapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const + { + bool result=false; + InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree != iInstanceMapTrees.end()) + { + Vector3 pos = convertPositionToInternalRep(x, y, z); + result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId); + // z is not touched by convertPositionToMangosRep(), so just copy + z = pos.z; + } + return(result); + } + + bool VMapManager2::GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float &level, float &floor, uint32 &type) const + { + InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(pMapId); + if (instanceTree != iInstanceMapTrees.end()) + { + LocationInfo info; + Vector3 pos = convertPositionToInternalRep(x, y, z); + if (instanceTree->second->GetLocationInfo(pos, info)) + { + floor = info.ground_Z; + ASSERT(floor < std::numeric_limits::max()); + type = info.hitModel->GetLiquidType(); + if (ReqLiquidType && !(type & ReqLiquidType)) + return false; + if (info.hitInstance->GetLiquidLevel(pos, info, level)) + return true; + } + } + return false; + } + + //========================================================= + + WorldModel* VMapManager2::acquireModelInstance(const std::string &basepath, const std::string &filename) + { + ModelFileMap::iterator model = iLoadedModelFiles.find(filename); + if (model == iLoadedModelFiles.end()) + { + WorldModel *worldmodel = new WorldModel(); + if (!worldmodel->readFile(basepath + filename + ".vmo")) + { + sLog.outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str()); + delete worldmodel; + return NULL; + } + sLog.outDebug("VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str()); + model = iLoadedModelFiles.insert(std::pair(filename, ManagedModel())).first; + model->second.setModel(worldmodel); + } + model->second.incRefCount(); + return model->second.getModel(); + } + + void VMapManager2::releaseModelInstance(const std::string &filename) + { + ModelFileMap::iterator model = iLoadedModelFiles.find(filename); + if (model == iLoadedModelFiles.end()) + { + sLog.outError("VMapManager2: trying to unload non-loaded file '%s'", filename.c_str()); + return; + } + if( model->second.decRefCount() == 0) + { + sLog.outDebug("VMapManager2: unloading file '%s'", filename.c_str()); + delete model->second.getModel(); + iLoadedModelFiles.erase(model); + } + } + //========================================================= + + bool VMapManager2::existsMap(const char* pBasePath, unsigned int pMapId, int x, int y) + { + return StaticMapTree::CanLoadMap(std::string(pBasePath), pMapId, x, y); + } + +} // namespace VMAP diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h new file mode 100644 index 0000000..953a8f1 --- /dev/null +++ b/src/server/collision/Management/VMapManager2.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VMAPMANAGER2_H +#define _VMAPMANAGER2_H + +#include "IVMapManager.h" +#include "Dynamic/UnorderedMap.h" +#include "Define.h" +#include + +//=========================================================== + +#define MAP_FILENAME_EXTENSION2 ".vmtree" + +#define FILENAMEBUFFER_SIZE 500 + +/** +This is the main Class to manage loading and unloading of maps, line of sight, height calculation and so on. +For each map or map tile to load it reads a directory file that contains the ModelContainer files used by this map or map tile. +Each global map or instance has its own dynamic BSP-Tree. +The loaded ModelContainers are included in one of these BSP-Trees. +Additionally a table to match map ids and map names is used. +*/ + +//=========================================================== + +namespace VMAP +{ + class StaticMapTree; + class WorldModel; + + class ManagedModel + { + public: + ManagedModel(): iModel(0), iRefCount(0) {} + void setModel(WorldModel *model) { iModel = model; } + WorldModel *getModel() { return iModel; } + void incRefCount() { ++iRefCount; } + int decRefCount() { return --iRefCount; } + protected: + WorldModel *iModel; + int iRefCount; + }; + + typedef UNORDERED_MAP InstanceTreeMap; + typedef UNORDERED_MAP ModelFileMap; + + class VMapManager2 : public IVMapManager + { + protected: + // Tree to check collision + ModelFileMap iLoadedModelFiles; + InstanceTreeMap iInstanceMapTrees; + // UNORDERED_MAP iMapsSplitIntoTiles; + UNORDERED_MAP iIgnoreMapIds; + + bool _loadMap(uint32 pMapId, const std::string &basePath, uint32 tileX, uint32 tileY); + /* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */ + + public: + // public for debug + G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const; + G3D::Vector3 convertPositionToMangosRep(float x, float y, float z) const; + static std::string getMapFileName(unsigned int pMapId); + + VMapManager2(); + ~VMapManager2(void); + + int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y); + + void unloadMap(unsigned int pMapId, int x, int y); + void unloadMap(unsigned int pMapId); + + bool isInLineOfSight(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2) ; + /** + fill the hit pos and return true, if an object was hit + */ + bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float pModifyDist); + float getHeight(unsigned int pMapId, float x, float y, float z); + + bool processCommand(char *pCommand) { return false; } // for debug and extensions + + void preventMapsFromBeingUsed(const char* pMapIdString); + bool getAreaInfo(unsigned int pMapId, float x, float y, float &z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const; + bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float &level, float &floor, uint32 &type) const; + + WorldModel* acquireModelInstance(const std::string &basepath, const std::string &filename); + void releaseModelInstance(const std::string &filename); + + // what's the use of this? o.O + virtual std::string getDirFileName(unsigned int pMapId, int x, int y) const + { + return getMapFileName(pMapId); + } + virtual bool existsMap(const char* pBasePath, unsigned int pMapId, int x, int y); + }; +} +#endif diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp new file mode 100644 index 0000000..b47e34b --- /dev/null +++ b/src/server/collision/Maps/MapTree.cpp @@ -0,0 +1,479 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * 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, see . + */ + +#include "MapTree.h" +#include "ModelInstance.h" +#include "VMapManager2.h" +#include "VMapDefinitions.h" +#include "Log.h" + +#include +#include +#include +#include + +#ifndef NO_CORE_FUNCS + #include "Errors.h" +#else + #define ASSERT(x) +#endif + +using G3D::Vector3; + +namespace VMAP +{ + + class MapRayCallback + { + public: + MapRayCallback(ModelInstance *val): prims(val), hit(false) {} + bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit=true) + { + bool result = prims[entry].intersectRay(ray, distance, pStopAtFirstHit); + if (result) + hit = true; + return result; + } + bool didHit() { return hit; } + protected: + ModelInstance *prims; + bool hit; + }; + + class AreaInfoCallback + { + public: + AreaInfoCallback(ModelInstance *val): prims(val) {} + void operator()(const Vector3& point, uint32 entry) + { +#ifdef VMAP_DEBUG + sLog.outDebug("AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); +#endif + prims[entry].intersectPoint(point, aInfo); + } + + ModelInstance *prims; + AreaInfo aInfo; + }; + + class LocationInfoCallback + { + public: + LocationInfoCallback(ModelInstance *val, LocationInfo &info): prims(val), locInfo(info), result(false) {} + void operator()(const Vector3& point, uint32 entry) + { +#ifdef VMAP_DEBUG + sLog.outDebug("LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); +#endif + if (prims[entry].GetLocationInfo(point, locInfo)) + result = true; + } + + ModelInstance *prims; + LocationInfo &locInfo; + bool result; + }; + + + //========================================================= + + std::string StaticMapTree::getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY) + { + std::stringstream tilefilename; + tilefilename.fill('0'); + tilefilename << std::setw(3) << mapID << "_"; + //tilefilename << std::setw(2) << tileX << "_" << std::setw(2) << tileY << ".vmtile"; + tilefilename << std::setw(2) << tileY << "_" << std::setw(2) << tileX << ".vmtile"; + return tilefilename.str(); + } + + bool StaticMapTree::getAreaInfo(Vector3 &pos, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const + { + AreaInfoCallback intersectionCallBack(iTreeValues); + iTree.intersectPoint(pos, intersectionCallBack); + if (intersectionCallBack.aInfo.result) + { + flags = intersectionCallBack.aInfo.flags; + adtId = intersectionCallBack.aInfo.adtId; + rootId = intersectionCallBack.aInfo.rootId; + groupId = intersectionCallBack.aInfo.groupId; + pos.z = intersectionCallBack.aInfo.ground_Z; + return true; + } + return false; + } + + bool StaticMapTree::GetLocationInfo(const Vector3 &pos, LocationInfo &info) const + { + LocationInfoCallback intersectionCallBack(iTreeValues, info); + iTree.intersectPoint(pos, intersectionCallBack); + return intersectionCallBack.result; + } + + StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath): + iMapID(mapID), iTreeValues(0), iBasePath(basePath) + { + if (iBasePath.length() > 0 && (iBasePath[iBasePath.length()-1] != '/' || iBasePath[iBasePath.length()-1] != '\\')) + { + iBasePath.append("/"); + } + } + + //========================================================= + //! Make sure to call unloadMap() to unregister acquired model references before destroying + StaticMapTree::~StaticMapTree() + { + delete[] iTreeValues; + } + + //========================================================= + /** + If intersection is found within pMaxDist, sets pMaxDist to intersection distance and returns true. + Else, pMaxDist is not modified and returns false; + */ + + bool StaticMapTree::getIntersectionTime(const G3D::Ray& pRay, float &pMaxDist, bool pStopAtFirstHit) const + { + float distance = pMaxDist; + MapRayCallback intersectionCallBack(iTreeValues); + iTree.intersectRay(pRay, intersectionCallBack, distance, pStopAtFirstHit); + if (intersectionCallBack.didHit()) + pMaxDist = distance; + return intersectionCallBack.didHit(); + } + //========================================================= + + bool StaticMapTree::isInLineOfSight(const Vector3& pos1, const Vector3& pos2) const + { + float maxDist = (pos2 - pos1).magnitude(); + // valid map coords should *never ever* produce float overflow, but this would produce NaNs too + ASSERT(maxDist < std::numeric_limits::max()); + // prevent NaN values which can cause BIH intersection to enter infinite loop + if (maxDist < 1e-10f) + return true; + // direction with length of 1 + G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1)/maxDist); + if (getIntersectionTime(ray, maxDist, true)) + return false; + + return true; + } + //========================================================= + /** + When moving from pos1 to pos2 check if we hit an object. Return true and the position if we hit one + Return the hit pos or the original dest pos + */ + + bool StaticMapTree::getObjectHitPos(const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const + { + bool result=false; + float maxDist = (pPos2 - pPos1).magnitude(); + // valid map coords should *never ever* produce float overflow, but this would produce NaNs too + ASSERT(maxDist < std::numeric_limits::max()); + // prevent NaN values which can cause BIH intersection to enter infinite loop + if (maxDist < 1e-10f) + { + pResultHitPos = pPos2; + return false; + } + Vector3 dir = (pPos2 - pPos1)/maxDist; // direction with length of 1 + G3D::Ray ray(pPos1, dir); + float dist = maxDist; + if (getIntersectionTime(ray, dist, false)) + { + pResultHitPos = pPos1 + dir * dist; + if (pModifyDist < 0) + { + if ((pResultHitPos - pPos1).magnitude() > -pModifyDist) + { + pResultHitPos = pResultHitPos + dir*pModifyDist; + } + else + { + pResultHitPos = pPos1; + } + } + else + { + pResultHitPos = pResultHitPos + dir*pModifyDist; + } + result = true; + } + else + { + pResultHitPos = pPos2; + result = false; + } + return result; + } + + //========================================================= + + float StaticMapTree::getHeight(const Vector3& pPos) const + { + float height = G3D::inf(); + Vector3 dir = Vector3(0,0,-1); + G3D::Ray ray(pPos, dir); // direction with length of 1 + float maxDist = VMapDefinitions::getMaxCanFallDistance(); + if (getIntersectionTime(ray, maxDist, false)) + { + height = pPos.z - maxDist; + } + return(height); + } + + //========================================================= + + bool StaticMapTree::CanLoadMap(const std::string &vmapPath, uint32 mapID, uint32 tileX, uint32 tileY) + { + std::string basePath = vmapPath; + if (basePath.length() > 0 && (basePath[basePath.length()-1] != '/' || basePath[basePath.length()-1] != '\\')) + basePath.append("/"); + std::string fullname = basePath + VMapManager2::getMapFileName(mapID); + bool success = true; + FILE *rf = fopen(fullname.c_str(), "rb"); + if (!rf) + return false; + // TODO: check magic number when implemented... + char tiled; + char chunk[8]; + if (!readChunk(rf, chunk, VMAP_MAGIC, 8) || fread(&tiled, sizeof(char), 1, rf) != 1) + { + fclose(rf); + return false; + } + if (tiled) + { + std::string tilefile = basePath + getTileFileName(mapID, tileX, tileY); + FILE* tf = fopen(tilefile.c_str(), "rb"); + if (!tf) + success = false; + else + { + if (!readChunk(tf, chunk, VMAP_MAGIC, 8)) + success = false; + fclose(tf); + } + } + fclose(rf); + return success; + } + + //========================================================= + + bool StaticMapTree::InitMap(const std::string &fname, VMapManager2 *vm) + { + sLog.outDebug("StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str()); + bool success = true; + std::string fullname = iBasePath + fname; + FILE *rf = fopen(fullname.c_str(), "rb"); + if (!rf) + return false; + else + { + char chunk[8]; + //general info + if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) success = false; + char tiled; + if (success && fread(&tiled, sizeof(char), 1, rf) != 1) success = false; + iIsTiled = bool(tiled); + // Nodes + if (success && !readChunk(rf, chunk, "NODE", 4)) success = false; + if (success) success = iTree.readFromFile(rf); + if (success) + { + iNTreeValues = iTree.primCount(); + iTreeValues = new ModelInstance[iNTreeValues]; + } + + if (success && !readChunk(rf, chunk, "GOBJ", 4)) success = false; + // global model spawns + // only non-tiled maps have them, and if so exactly one (so far at least...) + ModelSpawn spawn; +#ifdef VMAP_DEBUG + sLog.outDebug("StaticMapTree::InitMap() : map isTiled: %u", static_cast(iIsTiled)); +#endif + if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) + { + WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name); + sLog.outDebug("StaticMapTree::InitMap() : loading %s", spawn.name.c_str()); + if (model) + { + // assume that global model always is the first and only tree value (could be improved...) + iTreeValues[0] = ModelInstance(spawn, model); + iLoadedSpawns[0] = 1; + } + else + { + success = false; + sLog.outError("StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str()); + } + } + + fclose(rf); + } + return success; + } + + //========================================================= + + void StaticMapTree::UnloadMap(VMapManager2 *vm) + { + for (loadedSpawnMap::iterator i = iLoadedSpawns.begin(); i != iLoadedSpawns.end(); ++i) + { + iTreeValues[i->first].setUnloaded(); + for (uint32 refCount = 0; refCount < i->second; ++refCount) + vm->releaseModelInstance(iTreeValues[i->first].name); + } + iLoadedSpawns.clear(); + iLoadedTiles.clear(); + } + + //========================================================= + + bool StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm) + { + if (!iIsTiled) + { + // currently, core creates grids for all maps, whether it has terrain tiles or not + // so we need "fake" tile loads to know when we can unload map geometry + iLoadedTiles[packTileID(tileX, tileY)] = false; + return true; + } + if (!iTreeValues) + { + sLog.outError("StaticMapTree::LoadMapTile() : tree has not been initialized [%u,%u]", tileX, tileY); + return false; + } + bool result = true; + + std::string tilefile = iBasePath + getTileFileName(iMapID, tileX, tileY); + FILE* tf = fopen(tilefile.c_str(), "rb"); + if (tf) + { + char chunk[8]; + + if (!readChunk(tf, chunk, VMAP_MAGIC, 8)) + result = false; + uint32 numSpawns; + if (result && fread(&numSpawns, sizeof(uint32), 1, tf) != 1) + result = false; + for (uint32 i=0; iacquireModelInstance(iBasePath, spawn.name); + if (!model) + sLog.outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u,%u]", tileX, tileY); + + // update tree + uint32 referencedVal; + + fread(&referencedVal, sizeof(uint32), 1, tf); + if (!iLoadedSpawns.count(referencedVal)) + { +#ifdef VMAP_DEBUG + if (referencedVal > iNTreeValues) + { + sLog.outDebug("StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues); + continue; + } +#endif + iTreeValues[referencedVal] = ModelInstance(spawn, model); + iLoadedSpawns[referencedVal] = 1; + } + else + { + ++iLoadedSpawns[referencedVal]; +#ifdef VMAP_DEBUG + if (iTreeValues[referencedVal].ID != spawn.ID) + sLog.outDebug("StaticMapTree::LoadMapTile() : trying to load wrong spawn in node"); + else if (iTreeValues[referencedVal].name != spawn.name) + sLog.outDebug("StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID); +#endif + } + } + } + iLoadedTiles[packTileID(tileX, tileY)] = true; + fclose(tf); + } + else + iLoadedTiles[packTileID(tileX, tileY)] = false; + return result; + } + + //========================================================= + + void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm) + { + uint32 tileID = packTileID(tileX, tileY); + loadedTileMap::iterator tile = iLoadedTiles.find(tileID); + if (tile == iLoadedTiles.end()) + { + sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY); + return; + } + if (tile->second) // file associated with tile + { + std::string tilefile = iBasePath + getTileFileName(iMapID, tileX, tileY); + FILE* tf = fopen(tilefile.c_str(), "rb"); + if (tf) + { + bool result=true; + char chunk[8]; + if (!readChunk(tf, chunk, VMAP_MAGIC, 8)) + result = false; + uint32 numSpawns; + if (fread(&numSpawns, sizeof(uint32), 1, tf) != 1) + result = false; + for (uint32 i=0; ireleaseModelInstance(spawn.name); + + // update tree + uint32 referencedNode; + + fread(&referencedNode, sizeof(uint32), 1, tf); + if (!iLoadedSpawns.count(referencedNode)) + { + sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); + } + else if (--iLoadedSpawns[referencedNode] == 0) + { + iTreeValues[referencedNode].setUnloaded(); + iLoadedSpawns.erase(referencedNode); + } + } + } + fclose(tf); + } + } + iLoadedTiles.erase(tile); + } + +} diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h new file mode 100644 index 0000000..8f2242d --- /dev/null +++ b/src/server/collision/Maps/MapTree.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _MAPTREE_H +#define _MAPTREE_H + +#include "Define.h" +#include "Dynamic/UnorderedMap.h" +#include "BoundingIntervalHierarchy.h" + +namespace VMAP +{ + class ModelInstance; + class GroupModel; + class VMapManager2; + + struct LocationInfo + { + LocationInfo(): hitInstance(0), hitModel(0), ground_Z(-G3D::inf()) {}; + const ModelInstance *hitInstance; + const GroupModel *hitModel; + float ground_Z; + }; + + class StaticMapTree + { + typedef UNORDERED_MAP loadedTileMap; + typedef UNORDERED_MAP loadedSpawnMap; + private: + uint32 iMapID; + bool iIsTiled; + BIH iTree; + ModelInstance *iTreeValues; // the tree entries + uint32 iNTreeValues; + + // Store all the map tile idents that are loaded for that map + // some maps are not splitted into tiles and we have to make sure, not removing the map before all tiles are removed + // empty tiles have no tile file, hence map with bool instead of just a set (consistency check) + loadedTileMap iLoadedTiles; + // stores to invalidate tree values, unload map, and to be able to report errors + loadedSpawnMap iLoadedSpawns; + std::string iBasePath; + + private: + bool getIntersectionTime(const G3D::Ray& pRay, float &pMaxDist, bool pStopAtFirstHit) const; + //bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); } + public: + static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY); + static uint32 packTileID(uint32 tileX, uint32 tileY) { return tileX<<16 | tileY; } + static void unpackTileID(uint32 ID, uint32 &tileX, uint32 &tileY) { tileX = ID>>16; tileY = ID&0xFF; } + static bool CanLoadMap(const std::string &basePath, uint32 mapID, uint32 tileX, uint32 tileY); + + StaticMapTree(uint32 mapID, const std::string &basePath); + ~StaticMapTree(); + + bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) const; + bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const; + float getHeight(const G3D::Vector3& pPos) const; + bool getAreaInfo(G3D::Vector3 &pos, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const; + bool GetLocationInfo(const Vector3 &pos, LocationInfo &info) const; + + bool InitMap(const std::string &fname, VMapManager2 *vm); + void UnloadMap(VMapManager2 *vm); + bool LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm); + void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm); + bool isTiled() const { return iIsTiled; } + uint32 numLoadedTiles() const { return iLoadedTiles.size(); } + }; + + struct AreaInfo + { + AreaInfo(): result(false), ground_Z(-G3D::inf()) {}; + bool result; + float ground_Z; + uint32 flags; + int32 adtId; + int32 rootId; + int32 groupId; + }; +} // VMAP + +#endif // _MAPTREE_H diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp new file mode 100644 index 0000000..c6798e7 --- /dev/null +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -0,0 +1,496 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * 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, see . + */ + +#include "WorldModel.h" +#include "TileAssembler.h" +#include "MapTree.h" +#include "BoundingIntervalHierarchy.h" +#include "VMapDefinitions.h" + +#include +#include +#include +#include + +using G3D::Vector3; +using G3D::AABox; +using G3D::inf; +using std::pair; + +template<> struct BoundsTrait +{ + static void getBounds(const VMAP::ModelSpawn* const &obj, G3D::AABox& out) { out = obj->getBounds(); } +}; + +namespace VMAP +{ + bool readChunk(FILE *rf, char *dest, const char *compare, uint32 len) + { + if (fread(dest, sizeof(char), len, rf) != len) return false; + return memcmp(dest, compare, len) == 0; + } + + Vector3 ModelPosition::transform(const Vector3& pIn) const + { + Vector3 out = pIn * iScale; + out = iRotation * out; + return(out); + } + + //================================================================= + + TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName) + { + iCurrentUniqueNameId = 0; + iFilterMethod = NULL; + iSrcDir = pSrcDirName; + iDestDir = pDestDirName; + //mkdir(iDestDir); + //init(); + } + + TileAssembler::~TileAssembler() + { + //delete iCoordModelMapping; + } + + bool TileAssembler::convertWorld2() + { + std::set spawnedModelFiles; + bool success = readMapSpawns(); + if (!success) + return false; + + // export Map data + for (MapData::iterator map_iter = mapData.begin(); map_iter != mapData.end() && success; ++map_iter) + { + // build global map tree + std::vector mapSpawns; + UniqueEntryMap::iterator entry; + printf("Calculating model bounds for map %u...\n", map_iter->first); + for (entry = map_iter->second->UniqueEntries.begin(); entry != map_iter->second->UniqueEntries.end(); ++entry) + { + // M2 models don't have a bound set in WDT/ADT placement data, i still think they're not used for LoS at all on retail + if (entry->second.flags & MOD_M2) + { + if (!calculateTransformedBound(entry->second)) + break; + } + else if (entry->second.flags & MOD_WORLDSPAWN) // WMO maps and terrain maps use different origin, so we need to adapt :/ + { + // TODO: remove extractor hack and uncomment below line: + //entry->second.iPos += Vector3(533.33333f*32, 533.33333f*32, 0.f); + entry->second.iBound = entry->second.iBound + Vector3(533.33333f*32, 533.33333f*32, 0.f); + } + mapSpawns.push_back(&(entry->second)); + spawnedModelFiles.insert(entry->second.name); + } + + printf("Creating map tree...\n", map_iter->first); + BIH pTree; + pTree.build(mapSpawns, BoundsTrait::getBounds); + + // ===> possibly move this code to StaticMapTree class + std::map modelNodeIdx; + for (uint32 i=0; i(mapSpawns[i]->ID, i)); + + // write map tree file + std::stringstream mapfilename; + mapfilename << iDestDir << "/" << std::setfill('0') << std::setw(3) << map_iter->first << ".vmtree"; + FILE *mapfile = fopen(mapfilename.str().c_str(), "wb"); + if (!mapfile) + { + success = false; + printf("Cannot open %s\n", mapfilename.str().c_str()); + break; + } + + //general info + if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8) success = false; + uint32 globalTileID = StaticMapTree::packTileID(65, 65); + pair globalRange = map_iter->second->TileEntries.equal_range(globalTileID); + char isTiled = globalRange.first == globalRange.second; // only maps without terrain (tiles) have global WMO + if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1) success = false; + // Nodes + if (success && fwrite("NODE", 4, 1, mapfile) != 1) success = false; + if (success) success = pTree.writeToFile(mapfile); + // global map spawns (WDT), if any (most instances) + if (success && fwrite("GOBJ", 4, 1, mapfile) != 1) success = false; + + for (TileMap::iterator glob=globalRange.first; glob != globalRange.second && success; ++glob) + { + success = ModelSpawn::writeToFile(mapfile, map_iter->second->UniqueEntries[glob->second]); + } + + fclose(mapfile); + + // <==== + + // write map tile files, similar to ADT files, only with extra BSP tree node info + TileMap &tileEntries = map_iter->second->TileEntries; + TileMap::iterator tile; + for (tile = tileEntries.begin(); tile != tileEntries.end(); ++tile) + { + const ModelSpawn &spawn = map_iter->second->UniqueEntries[tile->second]; + if (spawn.flags & MOD_WORLDSPAWN) // WDT spawn, saved as tile 65/65 currently... + continue; + uint32 nSpawns = tileEntries.count(tile->first); + std::stringstream tilefilename; + tilefilename.fill('0'); + tilefilename << iDestDir << "/" << std::setw(3) << map_iter->first << "_"; + uint32 x, y; + StaticMapTree::unpackTileID(tile->first, x, y); + tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile"; + FILE *tilefile = fopen(tilefilename.str().c_str(), "wb"); + // file header + if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) success = false; + // write number of tile spawns + if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) success = false; + // write tile spawns + for (uint32 s=0; ssecond->UniqueEntries[tile->second]; + success = success && ModelSpawn::writeToFile(tilefile, spawn2); + // MapTree nodes to update when loading tile: + std::map::iterator nIdx = modelNodeIdx.find(spawn2.ID); + if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1) success = false; + } + fclose(tilefile); + } + // break; //test, extract only first map; TODO: remvoe this line + } + + // export objects + std::cout << "\nConverting Model Files" << std::endl; + for (std::set::iterator mfile = spawnedModelFiles.begin(); mfile != spawnedModelFiles.end(); ++mfile) + { + std::cout << "Converting " << *mfile << std::endl; + if (!convertRawFile(*mfile)) + { + std::cout << "error converting " << *mfile << std::endl; + success = false; + break; + } + } + + //cleanup: + for (MapData::iterator map_iter = mapData.begin(); map_iter != mapData.end(); ++map_iter) + { + delete map_iter->second; + } + return success; + } + + bool TileAssembler::readMapSpawns() + { + std::string fname = iSrcDir + "/dir_bin"; + FILE *dirf = fopen(fname.c_str(), "rb"); + if (!dirf) + { + printf("Could not read dir_bin file!\n"); + return false; + } + printf("Read coordinate mapping...\n"); + uint32 mapID, tileX, tileY, check=0; + G3D::Vector3 v1, v2; + ModelSpawn spawn; + while (!feof(dirf)) + { + check = 0; + // read mapID, tileX, tileY, Flags, adtID, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name + check += fread(&mapID, sizeof(uint32), 1, dirf); + if (check == 0) // EoF... + break; + check += fread(&tileX, sizeof(uint32), 1, dirf); + check += fread(&tileY, sizeof(uint32), 1, dirf); + if (!ModelSpawn::readFromFile(dirf, spawn)) + break; + + MapSpawns *current; + MapData::iterator map_iter = mapData.find(mapID); + if (map_iter == mapData.end()) + { + printf("spawning Map %d\n", mapID); + mapData[mapID] = current = new MapSpawns(); + } + else current = (*map_iter).second; + current->UniqueEntries.insert(pair(spawn.ID, spawn)); + current->TileEntries.insert(pair(StaticMapTree::packTileID(tileX, tileY), spawn.ID)); + } + bool success = (ferror(dirf) == 0); + fclose(dirf); + return success; + } + + bool TileAssembler::calculateTransformedBound(ModelSpawn &spawn) + { + std::string modelFilename = iSrcDir + "/" + spawn.name; + ModelPosition modelPosition; + modelPosition.iDir = spawn.iRot; + modelPosition.iScale = spawn.iScale; + modelPosition.init(); + + FILE *rf = fopen(modelFilename.c_str(), "rb"); + if (!rf) + { + printf("ERROR: Can't open model file: %s\n", modelFilename.c_str()); + return false; + } + + AABox modelBound; + bool boundEmpty=true; + char ident[8]; + + int readOperation = 1; + + // temporary use defines to simplify read/check code (close file and return at fail) + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++; + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); } + + READ_OR_RETURN(&ident, 8); + CMP_OR_RETURN(ident, "VMAP003"); + + // we have to read one int. This is needed during the export and we have to skip it here + uint32 tempNVectors; + READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); + + uint32 groups, wmoRootId; + char blockId[5]; + blockId[4] = 0; + int blocksize; + float *vectorarray = 0; + + READ_OR_RETURN(&groups, sizeof(uint32)); + READ_OR_RETURN(&wmoRootId, sizeof(uint32)); + if (groups != 1) printf("Warning: '%s' does not seem to be a M2 model!\n", modelFilename.c_str()); + + for (uint32 g=0; g0) + { + vectorarray = new float[nvectors*3]; + READ_OR_RETURN(vectorarray, nvectors*sizeof(float)*3); + } + else + { + std::cout << "error: model '" << spawn.name << "' has no geometry!" << std::endl; + return false; + } + + for (uint32 i=0, indexNo=0; indexNo0) + filename.append("/"); + filename.append(pModelFilename); + FILE *rf = fopen(filename.c_str(), "rb"); + + if (!rf) + { + printf("ERROR: Can't open model file in form: %s",pModelFilename.c_str()); + printf("... or form: %s",filename.c_str() ); + return false; + } + + char ident[8]; + + int readOperation = 1; + + // temporary use defines to simplify read/check code (close file and return at fail) + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++; + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); } + + READ_OR_RETURN(&ident, 8); + CMP_OR_RETURN(ident, "VMAP003"); + + // we have to read one int. This is needed during the export and we have to skip it here + uint32 tempNVectors; + READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); + + uint32 groups; + uint32 RootWMOID; + char blockId[5]; + blockId[4] = 0; + int blocksize; + + READ_OR_RETURN(&groups, sizeof(uint32)); + READ_OR_RETURN(&RootWMOID, sizeof(uint32)); + + std::vector groupsArray; + + for (uint32 g=0; g triangles; + std::vector vertexArray; + + uint32 mogpflags, GroupWMOID; + READ_OR_RETURN(&mogpflags, sizeof(uint32)); + READ_OR_RETURN(&GroupWMOID, sizeof(uint32)); + + float bbox1[3], bbox2[3]; + READ_OR_RETURN(bbox1, sizeof(float)*3); + READ_OR_RETURN(bbox2, sizeof(float)*3); + + uint32 liquidflags; + READ_OR_RETURN(&liquidflags, sizeof(uint32)); + + // will this ever be used? what is it good for anyway?? + uint32 branches; + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "GRP "); + READ_OR_RETURN(&blocksize, sizeof(int)); + READ_OR_RETURN(&branches, sizeof(uint32)); + for (uint32 b=0; b0) + { + uint16 *indexarray = new uint16[nindexes]; + READ_OR_RETURN(indexarray, nindexes*sizeof(uint16)); + for (uint32 i=0; i0) + { + float *vectorarray = new float[nvectors*3]; + READ_OR_RETURN(vectorarray, nvectors*sizeof(float)*3); + for (uint32 i=0; iGetHeightStorage(), size*sizeof(float)); + size = hlq.xtiles*hlq.ytiles; + READ_OR_RETURN(liquid->GetFlagsStorage(), size); + } + + groupsArray.push_back(GroupModel(mogpflags, GroupWMOID, AABox(Vector3(bbox1), Vector3(bbox2)))); + groupsArray.back().setMeshData(vertexArray, triangles); + groupsArray.back().setLiquidData(liquid); + + // drop of temporary use defines + #undef READ_OR_RETURN + #undef CMP_OR_RETURN + + } + fclose(rf); + + // write WorldModel + WorldModel model; + model.setRootWmoID(RootWMOID); + if (groupsArray.size()) + { + model.setGroupModels(groupsArray); + success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo"); + } + + //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; + return success; + } +} diff --git a/src/server/collision/Maps/TileAssembler.h b/src/server/collision/Maps/TileAssembler.h new file mode 100644 index 0000000..b267357 --- /dev/null +++ b/src/server/collision/Maps/TileAssembler.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _TILEASSEMBLER_H_ +#define _TILEASSEMBLER_H_ + +#include +#include +#include + +#include "ModelInstance.h" + +namespace VMAP +{ + /** + This Class is used to convert raw vector data into balanced BSP-Trees. + To start the conversion call convertWorld(). + */ + //=============================================== + + class ModelPosition + { + private: + G3D::Matrix3 iRotation; + public: + G3D::Vector3 iPos; + G3D::Vector3 iDir; + float iScale; + void init() + { + iRotation = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi()*iDir.y/180.f, G3D::pi()*iDir.x/180.f, G3D::pi()*iDir.z/180.f); + } + G3D::Vector3 transform(const G3D::Vector3& pIn) const; + void moveToBasePos(const G3D::Vector3& pBasePos) { iPos -= pBasePos; } + }; + + typedef std::map UniqueEntryMap; + typedef std::multimap TileMap; + + struct MapSpawns + { + UniqueEntryMap UniqueEntries; + TileMap TileEntries; + }; + + typedef std::map MapData; + //=============================================== + + class TileAssembler + { + private: + std::string iDestDir; + std::string iSrcDir; + bool (*iFilterMethod)(char *pName); + G3D::Table iUniqueNameIds; + unsigned int iCurrentUniqueNameId; + MapData mapData; + + public: + TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName); + virtual ~TileAssembler(); + + bool convertWorld2(); + bool readMapSpawns(); + bool calculateTransformedBound(ModelSpawn &spawn); + + bool convertRawFile(const std::string& pModelFilename); + void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; } + std::string getDirEntryNameFromModName(unsigned int pMapId, const std::string& pModPosName); + unsigned int getUniqueNameId(const std::string pName); + }; + +} // VMAP +#endif /*_TILEASSEMBLER_H_*/ diff --git a/src/server/collision/Models/ModelInstance.cpp b/src/server/collision/Models/ModelInstance.cpp new file mode 100644 index 0000000..1ab6b36 --- /dev/null +++ b/src/server/collision/Models/ModelInstance.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * 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, see . + */ + +#include "ModelInstance.h" +#include "WorldModel.h" +#include "MapTree.h" +#include "VMapDefinitions.h" + +using G3D::Vector3; +using G3D::Ray; + +namespace VMAP +{ + ModelInstance::ModelInstance(const ModelSpawn &spawn, WorldModel *model): ModelSpawn(spawn), iModel(model) + { + iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi()*iRot.y/180.f, G3D::pi()*iRot.x/180.f, G3D::pi()*iRot.z/180.f).inverse(); + iInvScale = 1.f/iScale; + } + + bool ModelInstance::intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const + { + if (!iModel) + { + //std::cout << "\n"; + return false; + } + float time = pRay.intersectionTime(iBound); + if (time == G3D::inf()) + { +// std::cout << "Ray does not hit '" << name << "'\n"; + + return false; + } +// std::cout << "Ray crosses bound of '" << name << "'\n"; +/* std::cout << "ray from:" << pRay.origin().x << ", " << pRay.origin().y << ", " << pRay.origin().z + << " dir:" << pRay.direction().x << ", " << pRay.direction().y << ", " << pRay.direction().z + << " t/tmax:" << time << "/" << pMaxDist; + std::cout << "\nBound lo:" << iBound.low().x << ", " << iBound.low().y << ", " << iBound.low().z << " hi: " + << iBound.high().x << ", " << iBound.high().y << ", " << iBound.high().z << std::endl; */ + // child bounds are defined in object space: + Vector3 p = iInvRot * (pRay.origin() - iPos) * iInvScale; + Ray modRay(p, iInvRot * pRay.direction()); + float distance = pMaxDist * iInvScale; + bool hit = iModel->IntersectRay(modRay, distance, pStopAtFirstHit); + if(hit) + { + distance *= iScale; + pMaxDist = distance; + } + return hit; + } + + void ModelInstance::intersectPoint(const G3D::Vector3& p, AreaInfo &info) const + { + if (!iModel) + { +#ifdef VMAP_DEBUG + std::cout << "\n"; +#endif + return; + } + + // M2 files don't contain area info, only WMO files + if (flags & MOD_M2) + return; + if (!iBound.contains(p)) + return; + // child bounds are defined in object space: + Vector3 pModel = iInvRot * (p - iPos) * iInvScale; + Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f); + float zDist; + if (iModel->IntersectPoint(pModel, zDirModel, zDist, info)) + { + Vector3 modelGround = pModel + zDist * zDirModel; + // Transform back to world space. Note that: + // Mat * vec == vec * Mat.transpose() + // and for rotation matrices: Mat.inverse() == Mat.transpose() + float world_Z = ((modelGround * iInvRot) * iScale + iPos).z; + if (info.ground_Z < world_Z) + { + info.ground_Z = world_Z; + info.adtId = adtId; + } + } + } + + bool ModelInstance::GetLocationInfo(const G3D::Vector3& p, LocationInfo &info) const + { + if (!iModel) + { +#ifdef VMAP_DEBUG + std::cout << "\n"; +#endif + return false; + } + + // M2 files don't contain area info, only WMO files + if (flags & MOD_M2) + return false; + if (!iBound.contains(p)) + return false; + // child bounds are defined in object space: + Vector3 pModel = iInvRot * (p - iPos) * iInvScale; + Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f); + float zDist; + if (iModel->GetLocationInfo(pModel, zDirModel, zDist, info)) + { + Vector3 modelGround = pModel + zDist * zDirModel; + // Transform back to world space. Note that: + // Mat * vec == vec * Mat.transpose() + // and for rotation matrices: Mat.inverse() == Mat.transpose() + float world_Z = ((modelGround * iInvRot) * iScale + iPos).z; + if (info.ground_Z < world_Z) // hm...could it be handled automatically with zDist at intersection? + { + info.ground_Z = world_Z; + info.hitInstance = this; + return true; + } + } + return false; + } + + bool ModelInstance::GetLiquidLevel(const G3D::Vector3& p, LocationInfo &info, float &liqHeight) const + { + // child bounds are defined in object space: + Vector3 pModel = iInvRot * (p - iPos) * iInvScale; + //Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f); + float zDist; + if (info.hitModel->GetLiquidLevel(pModel, zDist)) + { + // calculate world height (zDist in model coords): + // assume WMO not tilted (wouldn't make much sense anyway) + liqHeight = zDist * iScale + iPos.z; + return true; + } + return false; + } + + bool ModelSpawn::readFromFile(FILE *rf, ModelSpawn &spawn) + { + uint32 check=0, nameLen; + check += fread(&spawn.flags, sizeof(uint32), 1, rf); + // EoF? + if (!check) + { + if (ferror(rf)) + std::cout << "Error reading ModelSpawn!\n"; + return false; + } + check += fread(&spawn.adtId, sizeof(uint16), 1, rf); + check += fread(&spawn.ID, sizeof(uint32), 1, rf); + check += fread(&spawn.iPos, sizeof(float), 3, rf); + check += fread(&spawn.iRot, sizeof(float), 3, rf); + check += fread(&spawn.iScale, sizeof(float), 1, rf); + bool has_bound = (spawn.flags & MOD_HAS_BOUND); + if (has_bound) // only WMOs have bound in MPQ, only available after computation + { + Vector3 bLow, bHigh; + check += fread(&bLow, sizeof(float), 3, rf); + check += fread(&bHigh, sizeof(float), 3, rf); + spawn.iBound = G3D::AABox(bLow, bHigh); + } + check += fread(&nameLen, sizeof(uint32), 1, rf); + if(check != (has_bound ? 17 : 11)) + { + std::cout << "Error reading ModelSpawn!\n"; + return false; + } + char nameBuff[500]; + if (nameLen>500) // file names should never be that long, must be file error + { + std::cout << "Error reading ModelSpawn, file name too long!\n"; + return false; + } + check = fread(nameBuff, sizeof(char), nameLen, rf); + if (check != nameLen) + { + std::cout << "Error reading ModelSpawn!\n"; + return false; + } + spawn.name = std::string(nameBuff, nameLen); + return true; + } + + bool ModelSpawn::writeToFile(FILE *wf, const ModelSpawn &spawn) + { + uint32 check=0; + check += fwrite(&spawn.flags, sizeof(uint32), 1, wf); + check += fwrite(&spawn.adtId, sizeof(uint16), 1, wf); + check += fwrite(&spawn.ID, sizeof(uint32), 1, wf); + check += fwrite(&spawn.iPos, sizeof(float), 3, wf); + check += fwrite(&spawn.iRot, sizeof(float), 3, wf); + check += fwrite(&spawn.iScale, sizeof(float), 1, wf); + bool has_bound = (spawn.flags & MOD_HAS_BOUND); + if(has_bound) // only WMOs have bound in MPQ, only available after computation + { + check += fwrite(&spawn.iBound.low(), sizeof(float), 3, wf); + check += fwrite(&spawn.iBound.high(), sizeof(float), 3, wf); + } + uint32 nameLen = spawn.name.length(); + check += fwrite(&nameLen, sizeof(uint32), 1, wf); + if(check != (has_bound ? 17 : 11)) return false; + check = fwrite(spawn.name.c_str(), sizeof(char), nameLen, wf); + if(check != nameLen) return false; + return true; + } + +} diff --git a/src/server/collision/Models/ModelInstance.h b/src/server/collision/Models/ModelInstance.h new file mode 100644 index 0000000..42b92c8 --- /dev/null +++ b/src/server/collision/Models/ModelInstance.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _MODELINSTANCE_H_ +#define _MODELINSTANCE_H_ + +#include +#include +#include +#include + +#include "Define.h" + +namespace VMAP +{ + class WorldModel; + struct AreaInfo; + struct LocationInfo; + + enum ModelFlags + { + MOD_M2 = 1, + MOD_WORLDSPAWN = 1<<1, + MOD_HAS_BOUND = 1<<2 + }; + + class ModelSpawn + { + public: + //mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name + uint32 flags; + uint16 adtId; + uint32 ID; + G3D::Vector3 iPos; + G3D::Vector3 iRot; + float iScale; + G3D::AABox iBound; + std::string name; + bool operator==(const ModelSpawn &other) const { return ID == other.ID; } + //uint32 hashCode() const { return ID; } + // temp? + const G3D::AABox& getBounds() const { return iBound; } + + + static bool readFromFile(FILE *rf, ModelSpawn &spawn); + static bool writeToFile(FILE *rw, const ModelSpawn &spawn); + }; + + class ModelInstance: public ModelSpawn + { + public: + ModelInstance(): iModel(0) {} + ModelInstance(const ModelSpawn &spawn, WorldModel *model); + void setUnloaded() { iModel = 0; } + bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const; + void intersectPoint(const G3D::Vector3& p, AreaInfo &info) const; + bool GetLocationInfo(const G3D::Vector3& p, LocationInfo &info) const; + bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo &info, float &liqHeight) const; + protected: + G3D::Matrix3 iInvRot; + float iInvScale; + WorldModel *iModel; + }; +} // namespace VMAP + +#endif // _MODELINSTANCE diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp new file mode 100644 index 0000000..0bd156f --- /dev/null +++ b/src/server/collision/Models/WorldModel.cpp @@ -0,0 +1,568 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * 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, see . + */ + +#include "WorldModel.h" +#include "VMapDefinitions.h" +#include "MapTree.h" + +using G3D::Vector3; +using G3D::Ray; + +template<> struct BoundsTrait +{ + static void getBounds(const VMAP::GroupModel& obj, G3D::AABox& out) { out = obj.GetBound(); } +}; + + +namespace VMAP +{ + bool IntersectTriangle(const MeshTriangle &tri, std::vector::const_iterator points, const G3D::Ray &ray, float &distance) + { + static const float EPS = 1e-5f; + + // See RTR2 ch. 13.7 for the algorithm. + + const Vector3 e1 = points[tri.idx1] - points[tri.idx0]; + const Vector3 e2 = points[tri.idx2] - points[tri.idx0]; + const Vector3 p(ray.direction().cross(e2)); + const float a = e1.dot(p); + + if (abs(a) < EPS) { + // Determinant is ill-conditioned; abort early + return false; + } + + const float f = 1.0f / a; + const Vector3 s(ray.origin() - points[tri.idx0]); + const float u = f * s.dot(p); + + if ((u < 0.0f) || (u > 1.0f)) { + // We hit the plane of the m_geometry, but outside the m_geometry + return false; + } + + const Vector3 q(s.cross(e1)); + const float v = f * ray.direction().dot(q); + + if ((v < 0.0f) || ((u + v) > 1.0f)) { + // We hit the plane of the triangle, but outside the triangle + return false; + } + + const float t = f * e2.dot(q); + + if ((t > 0.0f) && (t < distance)) + { + // This is a new hit, closer than the previous one + distance = t; + + /* baryCoord[0] = 1.0 - u - v; + baryCoord[1] = u; + baryCoord[2] = v; */ + + return true; + } + // This hit is after the previous hit, so ignore it + return false; + } + + class TriBoundFunc + { + public: + TriBoundFunc(std::vector &vert): vertices(vert.begin()) {} + void operator()(const MeshTriangle &tri, G3D::AABox &out) const + { + G3D::Vector3 lo = vertices[tri.idx0]; + G3D::Vector3 hi = lo; + + lo = (lo.min(vertices[tri.idx1])).min(vertices[tri.idx2]); + hi = (hi.max(vertices[tri.idx1])).max(vertices[tri.idx2]); + + out = G3D::AABox(lo, hi); + } + protected: + const std::vector::const_iterator vertices; + }; + + // ===================== WmoLiquid ================================== + + WmoLiquid::WmoLiquid(uint32 width, uint32 height, const Vector3 &corner, uint32 type): + iTilesX(width), iTilesY(height), iCorner(corner), iType(type) + { + iHeight = new float[(width+1)*(height+1)]; + iFlags = new uint8[width*height]; + } + + WmoLiquid::WmoLiquid(const WmoLiquid &other): iHeight(0), iFlags(0) + { + *this = other; // use assignment operator... + } + + WmoLiquid::~WmoLiquid() + { + delete[] iHeight; + delete[] iFlags; + } + + WmoLiquid& WmoLiquid::operator=(const WmoLiquid &other) + { + if (this == &other) + return *this; + iTilesX = other.iTilesX; + iTilesY = other.iTilesY; + iCorner = other.iCorner; + iType = other.iType; + delete iHeight; + delete iFlags; + if (other.iHeight) + { + iHeight = new float[(iTilesX+1)*(iTilesY+1)]; + memcpy(iHeight, other.iHeight, (iTilesX+1)*(iTilesY+1)*sizeof(float)); + } + else + iHeight = 0; + if (other.iFlags) + { + iFlags = new uint8[iTilesX * iTilesY]; + memcpy(iFlags, other.iFlags, iTilesX * iTilesY); + } + else + iFlags = 0; + return *this; + } + + bool WmoLiquid::GetLiquidHeight(const Vector3 &pos, float &liqHeight) const + { + float tx_f = (pos.x - iCorner.x)/LIQUID_TILE_SIZE; + uint32 tx = uint32(tx_f); + if (tx<0 || tx >= iTilesX) return false; + float ty_f = (pos.y - iCorner.y)/LIQUID_TILE_SIZE; + uint32 ty = uint32(ty_f); + if (ty<0 || ty >= iTilesY) return false; + + // check if tile shall be used for liquid level + // checking for 0x08 *might* be enough, but disabled tiles always are 0x?F: + if ((iFlags[tx + ty*iTilesX] & 0x0F) == 0x0F) + return false; + + // (dx, dy) coordinates inside tile, in [0,1]^2 + float dx = tx_f - (float)tx; + float dy = ty_f - (float)ty; + + /* Tesselate tile to two triangles (not sure if client does it exactly like this) + + ^ dy + | + 1 x---------x (1,1) + | (b) / | + | / | + | / | + | / (a) | + x---------x---> dx + 0 1 + */ + + const uint32 rowOffset = iTilesX + 1; + if (dx > dy) // case (a) + { + float sx = iHeight[tx+1 + ty * rowOffset] - iHeight[tx + ty * rowOffset]; + float sy = iHeight[tx+1 + (ty+1) * rowOffset] - iHeight[tx+1 + ty * rowOffset]; + liqHeight = iHeight[tx + ty * rowOffset] + dx * sx + dy * sy; + } + else // case (b) + { + float sx = iHeight[tx+1 + (ty+1) * rowOffset] - iHeight[tx + (ty+1) * rowOffset]; + float sy = iHeight[tx + (ty+1) * rowOffset] - iHeight[tx + ty * rowOffset]; + liqHeight = iHeight[tx + ty * rowOffset] + dx * sx + dy * sy; + } + return true; + } + + uint32 WmoLiquid::GetFileSize() + { + return 2 * sizeof(uint32) + + sizeof(Vector3) + + (iTilesX + 1)*(iTilesY + 1) * sizeof(float) + + iTilesX * iTilesY; + } + + bool WmoLiquid::writeToFile(FILE *wf) + { + bool result = true; + if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1) result = false; + if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1) result = false; + uint32 size = (iTilesX + 1)*(iTilesY + 1); + if (result && fwrite(iHeight, sizeof(float), size, wf) != size) result = false; + size = iTilesX*iTilesY; + if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size) result = false; + return result; + } + + bool WmoLiquid::readFromFile(FILE *rf, WmoLiquid *&out) + { + bool result = true; + WmoLiquid *liquid = new WmoLiquid(); + if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1) result = false; + if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1) result = false; + if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1) result = false; + if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1) result = false; + uint32 size = (liquid->iTilesX + 1)*(liquid->iTilesY + 1); + liquid->iHeight = new float[size]; + if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size) result = false; + size = liquid->iTilesX * liquid->iTilesY; + liquid->iFlags = new uint8[size]; + if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size) result = false; + if (!result) + delete liquid; + out = liquid; + return result; + } + + // ===================== GroupModel ================================== + + GroupModel::GroupModel(const GroupModel &other): + iBound(other.iBound), iMogpFlags(other.iMogpFlags), iGroupWMOID(other.iGroupWMOID), + vertices(other.vertices), triangles(other.triangles), meshTree(other.meshTree), iLiquid(0) + { + if (other.iLiquid) + iLiquid = new WmoLiquid(*other.iLiquid); + } + + void GroupModel::setMeshData(std::vector &vert, std::vector &tri) + { + vertices.swap(vert); + triangles.swap(tri); + TriBoundFunc bFunc(vertices); + meshTree.build(triangles, bFunc); + } + + bool GroupModel::writeToFile(FILE *wf) + { + bool result = true; + uint32 chunkSize, count; + + if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1) result = false; + if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1) result = false; + + // write vertices + if (result && fwrite("VERT", 1, 4, wf) != 4) result = false; + count = vertices.size(); + chunkSize = sizeof(uint32)+ sizeof(Vector3)*count; + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) result = false; + if (!count) // models without (collision) geometry end here, unsure if they are useful + return result; + if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count) result = false; + + // write triangle mesh + if (result && fwrite("TRIM", 1, 4, wf) != 4) result = false; + count = triangles.size(); + chunkSize = sizeof(uint32)+ sizeof(MeshTriangle)*count; + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count) result = false; + + // write mesh BIH + if (result && fwrite("MBIH", 1, 4, wf) != 4) result = false; + if (result) result = meshTree.writeToFile(wf); + + // write liquid data + if (result && fwrite("LIQU", 1, 4, wf) != 4) result = false; + if (!iLiquid) + { + chunkSize = 0; + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; + return result; + } + chunkSize = iLiquid->GetFileSize(); + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; + if (result) result = iLiquid->writeToFile(wf); + + return result; + } + + bool GroupModel::readFromFile(FILE *rf) + { + char chunk[8]; + bool result = true; + uint32 chunkSize, count; + triangles.clear(); + vertices.clear(); + delete iLiquid; + iLiquid = 0; + + if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) result = false; + if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) result = false; + if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1) result = false; + + // read vertices + if (result && !readChunk(rf, chunk, "VERT", 4)) result = false; + if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false; + if (result && fread(&count, sizeof(uint32), 1, rf) != 1) result = false; + if (!count) // models without (collision) geometry end here, unsure if they are useful + return result; + if (result) vertices.resize(count); + if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count) result = false; + + // read triangle mesh + if (result && !readChunk(rf, chunk, "TRIM", 4)) result = false; + if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false; + if (result && fread(&count, sizeof(uint32), 1, rf) != 1) result = false; + if (result) triangles.resize(count); + if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count) result = false; + + // read mesh BIH + if (result && !readChunk(rf, chunk, "MBIH", 4)) result = false; + if (result) result = meshTree.readFromFile(rf); + + // write liquid data + if (result && !readChunk(rf, chunk, "LIQU", 4)) result = false; + if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false; + if (result && chunkSize > 0) + result = WmoLiquid::readFromFile(rf, iLiquid); + return result; + } + + struct GModelRayCallback + { + GModelRayCallback(const std::vector &tris, const std::vector &vert): + vertices(vert.begin()), triangles(tris.begin()), hit(false) {} + bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit) + { + bool result = IntersectTriangle(triangles[entry], vertices, ray, distance); + if (result) hit=true; + return hit; + } + std::vector::const_iterator vertices; + std::vector::const_iterator triangles; + bool hit; + }; + + bool GroupModel::IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const + { + if (!triangles.size()) + return false; + GModelRayCallback callback(triangles, vertices); + meshTree.intersectRay(ray, callback, distance, stopAtFirstHit); + return callback.hit; + } + + bool GroupModel::IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const + { + if (!triangles.size() || !iBound.contains(pos)) + return false; + GModelRayCallback callback(triangles, vertices); + Vector3 rPos = pos - 0.1f * down; + float dist = G3D::inf(); + G3D::Ray ray(rPos, down); + bool hit = IntersectRay(ray, dist, false); + if (hit) + z_dist = dist - 0.1f; + return hit; + } + + bool GroupModel::GetLiquidLevel(const Vector3 &pos, float &liqHeight) const + { + if (iLiquid) + return iLiquid->GetLiquidHeight(pos, liqHeight); + return false; + } + + uint32 GroupModel::GetLiquidType() const + { + // convert to type mask, matching MAP_LIQUID_TYPE_* defines in Map.h + if (iLiquid) + return (1 << iLiquid->GetType()); + return 0; + } + + // ===================== WorldModel ================================== + + void WorldModel::setGroupModels(std::vector &models) + { + groupModels.swap(models); + groupTree.build(groupModels, BoundsTrait::getBounds, 1); + } + + struct WModelRayCallBack + { + WModelRayCallBack(const std::vector &mod): models(mod.begin()), hit(false) {} + bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit) + { + bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit); + if (result) hit=true; + return hit; + } + std::vector::const_iterator models; + bool hit; + }; + + bool WorldModel::IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const + { + // small M2 workaround, maybe better make separate class with virtual intersection funcs + // in any case, there's no need to use a bound tree if we only have one submodel + if (groupModels.size() == 1) + return groupModels[0].IntersectRay(ray, distance, stopAtFirstHit); + + WModelRayCallBack isc(groupModels); + groupTree.intersectRay(ray, isc, distance, stopAtFirstHit); + return isc.hit; + } + + class WModelAreaCallback { + public: + WModelAreaCallback(const std::vector &vals, const Vector3 &down): + prims(vals.begin()), hit(vals.end()), minVol(G3D::inf()), zDist(G3D::inf()), zVec(down) {} + std::vector::const_iterator prims; + std::vector::const_iterator hit; + float minVol; + float zDist; + Vector3 zVec; + void operator()(const Vector3& point, uint32 entry) + { + float group_Z; + //float pVol = prims[entry].GetBound().volume(); + //if(pVol < minVol) + //{ + /* if (prims[entry].iBound.contains(point)) */ + if (prims[entry].IsInsideObject(point, zVec, group_Z)) + { + //minVol = pVol; + //hit = prims + entry; + if (group_Z < zDist) + { + zDist = group_Z; + hit = prims + entry; + } +#ifdef VMAP_DEBUG + const GroupModel &gm = prims[entry]; + printf("%10u %8X %7.3f,%7.3f,%7.3f | %7.3f,%7.3f,%7.3f | z=%f, p_z=%f\n", gm.GetWmoID(), gm.GetMogpFlags(), + gm.GetBound().low().x, gm.GetBound().low().y, gm.GetBound().low().z, + gm.GetBound().high().x, gm.GetBound().high().y, gm.GetBound().high().z, group_Z, point.z); +#endif + } + //} + //std::cout << "trying to intersect '" << prims[entry].name << "'\n"; + } + }; + + bool WorldModel::IntersectPoint(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, AreaInfo &info) const + { + if (!groupModels.size()) + return false; + WModelAreaCallback callback(groupModels, down); + groupTree.intersectPoint(p, callback); + if (callback.hit != groupModels.end()) + { + info.rootId = RootWMOID; + info.groupId = callback.hit->GetWmoID(); + info.flags = callback.hit->GetMogpFlags(); + info.result = true; + dist = callback.zDist; + return true; + } + return false; + } + + bool WorldModel::GetLocationInfo(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, LocationInfo &info) const + { + if (!groupModels.size()) + return false; + WModelAreaCallback callback(groupModels, down); + groupTree.intersectPoint(p, callback); + if (callback.hit != groupModels.end()) + { + info.hitModel = &(*callback.hit); + dist = callback.zDist; + return true; + } + return false; + } + + bool WorldModel::writeFile(const std::string &filename) + { + FILE *wf = fopen(filename.c_str(), "wb"); + if (!wf) + return false; + + bool result = true; + uint32 chunkSize, count; + result = fwrite(VMAP_MAGIC,1,8,wf) == 8; + if (result && fwrite("WMOD", 1, 4, wf) != 4) result = false; + chunkSize = sizeof(uint32) + sizeof(uint32); + if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1) result = false; + + // write group models + count=groupModels.size(); + if (count) + { + if (result && fwrite("GMOD", 1, 4, wf) != 4) result = false; + //chunkSize = sizeof(uint32)+ sizeof(GroupModel)*count; + //if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false; + if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) result = false; + for (uint32 i=0; i + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _WORLDMODEL_H +#define _WORLDMODEL_H + +#include +#include +#include +#include +#include "BoundingIntervalHierarchy.h" + +#include "Define.h" + +namespace VMAP +{ + class TreeNode; + struct AreaInfo; + struct LocationInfo; + + class MeshTriangle + { + public: + MeshTriangle(){}; + MeshTriangle(uint32 na, uint32 nb, uint32 nc): idx0(na), idx1(nb), idx2(nc) {}; + + uint32 idx0; + uint32 idx1; + uint32 idx2; + }; + + class WmoLiquid + { + public: + WmoLiquid(uint32 width, uint32 height, const Vector3 &corner, uint32 type); + WmoLiquid(const WmoLiquid &other); + ~WmoLiquid(); + WmoLiquid& operator=(const WmoLiquid &other); + bool GetLiquidHeight(const Vector3 &pos, float &liqHeight) const; + uint32 GetType() const { return iType; } + float *GetHeightStorage() { return iHeight; } + uint8 *GetFlagsStorage() { return iFlags; } + uint32 GetFileSize(); + bool writeToFile(FILE *wf); + static bool readFromFile(FILE *rf, WmoLiquid *&liquid); + private: + WmoLiquid(): iHeight(0), iFlags(0) {}; + uint32 iTilesX; //!< number of tiles in x direction, each + uint32 iTilesY; + Vector3 iCorner; //!< the lower corner + uint32 iType; //!< liquid type + float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values + uint8 *iFlags; //!< info if liquid tile is used + }; + + /*! holding additional info for WMO group files */ + class GroupModel + { + public: + GroupModel(): iLiquid(0) {} + GroupModel(const GroupModel &other); + GroupModel(uint32 mogpFlags, uint32 groupWMOID, const AABox &bound): + iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) {} + ~GroupModel() { delete iLiquid; } + + //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! + void setMeshData(std::vector &vert, std::vector &tri); + void setLiquidData(WmoLiquid *liquid) { iLiquid = liquid; } + bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const; + bool IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const; + bool GetLiquidLevel(const Vector3 &pos, float &liqHeight) const; + uint32 GetLiquidType() const; + bool writeToFile(FILE *wf); + bool readFromFile(FILE *rf); + const G3D::AABox& GetBound() const { return iBound; } + uint32 GetMogpFlags() const { return iMogpFlags; } + uint32 GetWmoID() const { return iGroupWMOID; } + protected: + G3D::AABox iBound; + uint32 iMogpFlags;// 0x8 outdor; 0x2000 indoor + uint32 iGroupWMOID; + std::vector vertices; + std::vector triangles; + BIH meshTree; + WmoLiquid *iLiquid; + }; + /*! Holds a model (converted M2 or WMO) in its original coordinate space */ + class WorldModel + { + public: + WorldModel(): RootWMOID(0) {} + + //! pass group models to WorldModel and create BIH. Passed vector is swapped with old geometry! + void setGroupModels(std::vector &models); + void setRootWmoID(uint32 id) { RootWMOID = id; } + bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const; + bool IntersectPoint(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, AreaInfo &info) const; + bool GetLocationInfo(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, LocationInfo &info) const; + bool writeFile(const std::string &filename); + bool readFile(const std::string &filename); + protected: + uint32 RootWMOID; + std::vector groupModels; + BIH groupTree; + }; +} // namespace VMAP + +#endif // _WORLDMODEL_H diff --git a/src/server/collision/VMapDefinitions.h b/src/server/collision/VMapDefinitions.h new file mode 100644 index 0000000..5f4a976 --- /dev/null +++ b/src/server/collision/VMapDefinitions.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2008-YYYY TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * 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, see . + */ + +#ifndef _VMAPDEFINITIONS_H +#define _VMAPDEFINITIONS_H +#include + +#define LIQUID_TILE_SIZE (533.333f / 128.f) + +namespace VMAP +{ + //===================================== + #define MAX_CAN_FALL_DISTANCE 10.0f + const char VMAP_MAGIC[] = "VMAP_3.0"; + + class VMapDefinitions + { + public: + static float getMaxCanFallDistance() { return MAX_CAN_FALL_DISTANCE; } + }; + + //====================================== + + // defined in TileAssembler.cpp currently... + bool readChunk(FILE *rf, char *dest, const char *compare, uint32 len); +} +#endif diff --git a/src/server/collision/VMapTools.h b/src/server/collision/VMapTools.h new file mode 100644 index 0000000..dbbd9af --- /dev/null +++ b/src/server/collision/VMapTools.h @@ -0,0 +1,150 @@ +/* +* Copyright (C) 2005-2010 MaNGOS +* +* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _VMAPTOOLS_H +#define _VMAPTOOLS_H + +#include +#include + +#include "NodeValueAccess.h" + +/** +The Class is mainly taken from G3D/AABSPTree.h but modified to be able to use our internal data structure. +This is an iterator that helps us analysing the BSP-Trees. +The collision detection is modified to return true, if we are inside an object. +*/ + +namespace VMAP +{ + template + class IntersectionCallBack { + public: + TValue* closestEntity; + G3D::Vector3 hitLocation; + G3D::Vector3 hitNormal; + + void operator()(const G3D::Ray& ray, const TValue* entity, bool pStopAtFirstHit, float& distance) { + entity->intersect(ray, distance, pStopAtFirstHit, hitLocation, hitNormal); + } + }; + + //============================================================== + //============================================================== + //============================================================== + + class MyCollisionDetection + { + private: + public: + + static bool collisionLocationForMovingPointFixedAABox( + const G3D::Vector3& origin, + const G3D::Vector3& dir, + const G3D::AABox& box, + G3D::Vector3& location, + bool& Inside) + { + + // Integer representation of a floating-point value. +#define IR(x) (reinterpret_cast(x)) + + Inside = true; + const G3D::Vector3& MinB = box.low(); + const G3D::Vector3& MaxB = box.high(); + G3D::Vector3 MaxT(-1.0f, -1.0f, -1.0f); + + // Find candidate planes. + for (int i = 0; i < 3; ++i) + { + if (origin[i] < MinB[i]) + { + location[i] = MinB[i]; + Inside = false; + + // Calculate T distances to candidate planes + if (IR(dir[i])) + { + MaxT[i] = (MinB[i] - origin[i]) / dir[i]; + } + } + else if (origin[i] > MaxB[i]) + { + location[i] = MaxB[i]; + Inside = false; + + // Calculate T distances to candidate planes + if (IR(dir[i])) + { + MaxT[i] = (MaxB[i] - origin[i]) / dir[i]; + } + } + } + + if (Inside) + { + // definite hit + location = origin; + return true; + } + + // Get largest of the maxT's for final choice of intersection + int WhichPlane = 0; + if (MaxT[1] > MaxT[WhichPlane]) + { + WhichPlane = 1; + } + + if (MaxT[2] > MaxT[WhichPlane]) + { + WhichPlane = 2; + } + + // Check final candidate actually inside box + if (IR(MaxT[WhichPlane]) & 0x80000000) + { + // Miss the box + return false; + } + + for (int i = 0; i < 3; ++i) + { + if (i != WhichPlane) + { + location[i] = origin[i] + MaxT[WhichPlane] * dir[i]; + if ((location[i] < MinB[i]) || + (location[i] > MaxB[i])) + { + // On this plane we're outside the box extents, so + // we miss the box + return false; + } + } + } + /* + // Choose the normal to be the plane normal facing into the ray + normal = G3D::Vector3::zero(); + normal[WhichPlane] = (dir[WhichPlane] > 0) ? -1.0 : 1.0; + */ + return true; + +#undef IR + } + }; +} +#endif diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp new file mode 100644 index 0000000..0d0ff17 --- /dev/null +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -0,0 +1,370 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "CombatAI.h" +#include "SpellMgr.h" +#include "Vehicle.h" + +int AggressorAI::Permissible(const Creature *creature) +{ + // have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight + if (!creature->isCivilian() && !creature->IsNeutralToAll()) + return PERMIT_BASE_PROACTIVE; + + return PERMIT_BASE_NO; +} + +void AggressorAI::UpdateAI(const uint32 /*diff*/) +{ + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); +} + +// some day we will delete these useless things +int CombatAI::Permissible(const Creature * /*creature*/) +{ + return PERMIT_BASE_NO; +} + +int ArchorAI::Permissible(const Creature * /*creature*/) +{ + return PERMIT_BASE_NO; +} + +int TurretAI::Permissible(const Creature * /*creature*/) +{ + return PERMIT_BASE_NO; +} + +int AOEAI::Permissible(const Creature * /*creature*/) +{ + return PERMIT_BASE_NO; +} + +int VehicleAI::Permissible(const Creature * /*creature*/) +{ + return PERMIT_BASE_NO; +} + +void CombatAI::InitializeAI() +{ + for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) + if (me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i])) + spells.push_back(me->m_spells[i]); + + CreatureAI::InitializeAI(); +} + +void CombatAI::Reset() +{ + events.Reset(); +} + +void CombatAI::JustDied(Unit *killer) +{ + for (SpellVct::iterator i = spells.begin(); i != spells.end(); ++i) + if (AISpellInfo[*i].condition == AICOND_DIE) + me->CastSpell(killer, *i, true); +} + +void CombatAI::EnterCombat(Unit *who) +{ + for (SpellVct::iterator i = spells.begin(); i != spells.end(); ++i) + { + if (AISpellInfo[*i].condition == AICOND_AGGRO) + me->CastSpell(who, *i, false); + else if (AISpellInfo[*i].condition == AICOND_COMBAT) + events.ScheduleEvent(*i, AISpellInfo[*i].cooldown + rand()%AISpellInfo[*i].cooldown); + } +} + +void CombatAI::UpdateAI(const uint32 diff) +{ + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + if (uint32 spellId = events.ExecuteEvent()) + { + DoCast(spellId); + events.ScheduleEvent(spellId, AISpellInfo[spellId].cooldown + rand()%AISpellInfo[spellId].cooldown); + } + else + DoMeleeAttackIfReady(); +} + +///////////////// +//CasterAI +///////////////// + +void CasterAI::InitializeAI() +{ + CombatAI::InitializeAI(); + + float m_attackDist = 30.0f; + for (SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr) + if (AISpellInfo[*itr].condition == AICOND_COMBAT && m_attackDist > GetAISpellInfo(*itr)->maxRange) + m_attackDist = GetAISpellInfo(*itr)->maxRange; + if (m_attackDist == 30.0f) + m_attackDist = MELEE_RANGE; +} + +void CasterAI::EnterCombat(Unit *who) +{ + if (spells.empty()) + return; + + uint32 spell = rand()%spells.size(); + uint32 count = 0; + for (SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr, ++count) + { + if (AISpellInfo[*itr].condition == AICOND_AGGRO) + me->CastSpell(who, *itr, false); + else if (AISpellInfo[*itr].condition == AICOND_COMBAT) + { + uint32 cooldown = GetAISpellInfo(*itr)->realCooldown; + if (count == spell) + { + DoCast(spells[spell]); + cooldown += me->GetCurrentSpellCastTime(*itr); + } + events.ScheduleEvent(*itr, cooldown); + } + } +} + +void CasterAI::UpdateAI(const uint32 diff) +{ + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + if (uint32 spellId = events.ExecuteEvent()) + { + DoCast(spellId); + uint32 casttime = me->GetCurrentSpellCastTime(spellId); + events.ScheduleEvent(spellId, (casttime ? casttime : 500) + GetAISpellInfo(spellId)->realCooldown); + } +} + +////////////// +//ArchorAI +////////////// + +ArchorAI::ArchorAI(Creature *c) : CreatureAI(c) +{ + if (!me->m_spells[0]) + sLog.outError("ArchorAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); + + m_minRange = GetSpellMinRange(me->m_spells[0], false); + if (!m_minRange) + m_minRange = MELEE_RANGE; + me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false); + me->m_SightDistance = me->m_CombatDistance; +} + +void ArchorAI::AttackStart(Unit *who) +{ + if (!who) + return; + + if (me->IsWithinCombatRange(who, m_minRange)) + { + if (me->Attack(who, true) && !who->IsFlying()) + me->GetMotionMaster()->MoveChase(who); + } + else + { + if (me->Attack(who, false) && !who->IsFlying()) + me->GetMotionMaster()->MoveChase(who, me->m_CombatDistance); + } + + if (who->IsFlying()) + me->GetMotionMaster()->MoveIdle(); +} + +void ArchorAI::UpdateAI(const uint32 /*diff*/) +{ + if (!UpdateVictim()) + return; + + if (!me->IsWithinCombatRange(me->getVictim(), m_minRange)) + DoSpellAttackIfReady(me->m_spells[0]); + else + DoMeleeAttackIfReady(); +} + +////////////// +//TurretAI +////////////// + +TurretAI::TurretAI(Creature *c) : CreatureAI(c) +{ + if (!me->m_spells[0]) + sLog.outError("TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); + + m_minRange = GetSpellMinRange(me->m_spells[0], false); + me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false); + me->m_SightDistance = me->m_CombatDistance; +} + +bool TurretAI::CanAIAttack(const Unit * /*who*/) const +{ + // TODO: use one function to replace it + if (!me->IsWithinCombatRange(me->getVictim(), me->m_CombatDistance) + || m_minRange && me->IsWithinCombatRange(me->getVictim(), m_minRange)) + return false; + return true; +} + +void TurretAI::AttackStart(Unit *who) +{ + if (who) + me->Attack(who, false); +} + +void TurretAI::UpdateAI(const uint32 /*diff*/) +{ + if (!UpdateVictim()) + return; + + DoSpellAttackIfReady(me->m_spells[0]); +} + +////////////// +//AOEAI +////////////// + +AOEAI::AOEAI(Creature *c) : CreatureAI(c) +{ + if (!me->m_spells[0]) + sLog.outError("AOEAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); + + me->SetVisibility(VISIBILITY_ON);//visible to see all spell anims + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);//can't be targeted + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1);//can't be damaged + me->SetDisplayId(11686);//invisible model,around a size of a player +} + +bool AOEAI::CanAIAttack(const Unit * /*who*/) const +{ + return false; +} + +void AOEAI::AttackStart(Unit * /*who*/) +{ +} + +void AOEAI::UpdateAI(const uint32 /*diff*/) +{ + if (!me->HasAura(me->m_spells[0])) + me->CastSpell(me, me->m_spells[0],false); +} + +////////////// +//VehicleAI +////////////// + +VehicleAI::VehicleAI(Creature *c) : CreatureAI(c), m_vehicle(c->GetVehicleKit()), m_IsVehicleInUse(false), m_ConditionsTimer(VEHICLE_CONDITION_CHECK_TIME) +{ + LoadConditions(); + m_DoDismiss = false; + m_DismissTimer = VEHICLE_DISMISS_TIME; +} + + +//NOTE: VehicleAI::UpdateAI runs even while the vehicle is mounted +void VehicleAI::UpdateAI(const uint32 diff) +{ + CheckConditions(diff); + + if (m_DoDismiss) + { + if (m_DismissTimer < diff) + { + m_DoDismiss = false; + me->SetVisibility(VISIBILITY_OFF); + me->ForcedDespawn(); + }else m_DismissTimer -= diff; + } +} + +void VehicleAI::Reset() +{ + me->SetVisibility(VISIBILITY_ON); + + m_vehicle->Reset(); +} + +void VehicleAI::OnCharmed(bool apply) +{ + if (m_IsVehicleInUse && !apply && !conditions.empty())//was used and has conditions + { + m_DoDismiss = true;//needs reset + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + } + else if (apply) + m_DoDismiss = false;//in use again + m_DismissTimer = VEHICLE_DISMISS_TIME;//reset timer + m_IsVehicleInUse = apply; +} + +void VehicleAI::LoadConditions() +{ + conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry()); + if (!conditions.empty()) + { + sLog.outDebug("VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size())); + } +} + +void VehicleAI::CheckConditions(const uint32 diff) +{ + if(m_ConditionsTimer < diff) + { + if (!conditions.empty()) + { + for (SeatMap::iterator itr = m_vehicle->m_Seats.begin(); itr != m_vehicle->m_Seats.end(); ++itr) + if (Unit *passenger = itr->second.passenger) + { + if (Player* plr = passenger->ToPlayer()) + { + if (!sConditionMgr.IsPlayerMeetToConditions(plr, conditions)) + { + plr->ExitVehicle(); + return;//check other pessanger in next tick + } + } + } + } + m_ConditionsTimer = VEHICLE_CONDITION_CHECK_TIME; + } else m_ConditionsTimer -= diff; +} \ No newline at end of file diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h new file mode 100644 index 0000000..8626b38 --- /dev/null +++ b/src/server/game/AI/CoreAI/CombatAI.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_COMBATAI_H +#define TRINITY_COMBATAI_H + +#include "CreatureAI.h" +#include "CreatureAIImpl.h" +#include "ConditionMgr.h" + +class Creature; + +class AggressorAI : public CreatureAI +{ + public: + explicit AggressorAI(Creature *c) : CreatureAI(c) {} + + void UpdateAI(const uint32); + static int Permissible(const Creature *); +}; + +typedef std::vector SpellVct; + +class CombatAI : public CreatureAI +{ + public: + explicit CombatAI(Creature *c) : CreatureAI(c) {} + + void InitializeAI(); + void Reset(); + void EnterCombat(Unit* who); + void JustDied(Unit *killer); + void UpdateAI(const uint32 diff); + static int Permissible(const Creature *); + protected: + EventMap events; + SpellVct spells; +}; + +class CasterAI : public CombatAI +{ + public: + explicit CasterAI(Creature *c) : CombatAI(c) { m_attackDist = MELEE_RANGE; } + void InitializeAI(); + void AttackStart(Unit * victim) { AttackStartCaster(victim, m_attackDist); } + void UpdateAI(const uint32 diff); + void EnterCombat(Unit * /*who*/); + private: + float m_attackDist; +}; + +struct ArchorAI : public CreatureAI +{ + public: + explicit ArchorAI(Creature *c); + void AttackStart(Unit *who); + void UpdateAI(const uint32 diff); + + static int Permissible(const Creature *); + protected: + float m_minRange; +}; + +struct TurretAI : public CreatureAI +{ + public: + explicit TurretAI(Creature *c); + bool CanAIAttack(const Unit *who) const; + void AttackStart(Unit *who); + void UpdateAI(const uint32 diff); + + static int Permissible(const Creature *); + protected: + float m_minRange; +}; + +struct AOEAI : public CreatureAI +{ + public: + explicit AOEAI(Creature *c); + bool CanAIAttack(const Unit *who) const; + void AttackStart(Unit *who); + void UpdateAI(const uint32 diff); + + static int Permissible(const Creature *); +}; +#define VEHICLE_CONDITION_CHECK_TIME 1000 +#define VEHICLE_DISMISS_TIME 5000 +struct VehicleAI : public CreatureAI +{ + public: + explicit VehicleAI(Creature *c); + + void UpdateAI(const uint32 diff); + static int Permissible(const Creature *); + void Reset(); + void MoveInLineOfSight(Unit *) {} + void AttackStart(Unit *) {} + void OnCharmed(bool apply); + + private: + Vehicle* m_vehicle; + bool m_IsVehicleInUse; + void LoadConditions(); + void CheckConditions(const uint32 diff); + ConditionList conditions; + uint32 m_ConditionsTimer; + bool m_DoDismiss; + uint32 m_DismissTimer; +}; + +#endif diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp new file mode 100644 index 0000000..19d5b5d --- /dev/null +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "GuardAI.h" +#include "Errors.h" +#include "Player.h" +#include "ObjectAccessor.h" +#include "World.h" +#include "CreatureAIImpl.h" + +int GuardAI::Permissible(const Creature *creature) +{ + if (creature->isGuard()) + return PERMIT_BASE_SPECIAL; + + return PERMIT_BASE_NO; +} + +GuardAI::GuardAI(Creature *c) : CreatureAI(c), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK) +{ +} + +void GuardAI::MoveInLineOfSight(Unit *u) +{ + // Ignore Z for flying creatures + if (!me->canFly() && me->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE) + return; + + if (!me->getVictim() && me->canAttack(u) && + (u->IsHostileToPlayers() || me->IsHostileTo(u) /*|| u->getVictim() && me->IsFriendlyTo(u->getVictim())*/) && + u->isInAccessiblePlaceFor(me)) + { + float attackRadius = me->GetAttackDistance(u); + if (me->IsWithinDistInMap(u,attackRadius)) + { + //Need add code to let guard support player + AttackStart(u); + //u->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + } + } +} + +void GuardAI::EnterEvadeMode() +{ + if (!me->isAlive()) + { + DEBUG_LOG("Creature stopped attacking because he is dead [guid=%u]", me->GetGUIDLow()); + me->GetMotionMaster()->MoveIdle(); + + i_state = STATE_NORMAL; + + i_victimGuid = 0; + me->CombatStop(true); + me->DeleteThreatList(); + return; + } + + Unit* victim = ObjectAccessor::GetUnit(*me, i_victimGuid); + + if (!victim) + { + DEBUG_LOG("Creature stopped attacking because victim does not exist [guid=%u]", me->GetGUIDLow()); + } + else if (!victim ->isAlive()) + { + DEBUG_LOG("Creature stopped attacking because victim is dead [guid=%u]", me->GetGUIDLow()); + } + else if (victim ->HasStealthAura()) + { + DEBUG_LOG("Creature stopped attacking because victim is using stealth [guid=%u]", me->GetGUIDLow()); + } + else if (victim ->isInFlight()) + { + DEBUG_LOG("Creature stopped attacking because victim is flying away [guid=%u]", me->GetGUIDLow()); + } + else + { + DEBUG_LOG("Creature stopped attacking because victim outran him [guid=%u]", me->GetGUIDLow()); + } + + me->RemoveAllAuras(); + me->DeleteThreatList(); + i_victimGuid = 0; + me->CombatStop(true); + i_state = STATE_NORMAL; + + // Remove TargetedMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + me->GetMotionMaster()->MoveTargetedHome(); +} + +void GuardAI::UpdateAI(const uint32 /*diff*/) +{ + // update i_victimGuid if me->getVictim() !=0 and changed + if (!UpdateVictim()) + return; + + i_victimGuid = me->getVictim()->GetGUID(); + + if (me->isAttackReady()) + { + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + } +} + +bool GuardAI::IsVisible(Unit *pl) const +{ + return me->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_GUARDER)) + && pl->isVisibleForOrDetect(me,true); +} + +void GuardAI::JustDied(Unit *killer) +{ + if (Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) + me->SendZoneUnderAttackMessage(pkiller); +} diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h new file mode 100644 index 0000000..73e3692 --- /dev/null +++ b/src/server/game/AI/CoreAI/GuardAI.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_GUARDAI_H +#define TRINITY_GUARDAI_H + +#include "CreatureAI.h" +#include "Timer.h" + +class Creature; + +class GuardAI : public CreatureAI +{ + enum GuardState + { + STATE_NORMAL = 1, + STATE_LOOK_AT_VICTIM = 2 + }; + + public: + + explicit GuardAI(Creature *c); + + void MoveInLineOfSight(Unit *); + void EnterEvadeMode(); + void JustDied(Unit *); + bool IsVisible(Unit *) const; + + void UpdateAI(const uint32); + static int Permissible(const Creature *); + + private: + uint64 i_victimGuid; + GuardState i_state; + TimeTracker i_tracker; +}; +#endif + diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp new file mode 100644 index 0000000..5ceda53 --- /dev/null +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "PassiveAI.h" +#include "Creature.h" +#include "TemporarySummon.h" + +PassiveAI::PassiveAI(Creature *c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); } +PossessedAI::PossessedAI(Creature *c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); } +NullCreatureAI::NullCreatureAI(Creature *c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); } + +void PassiveAI::UpdateAI(const uint32) +{ + if (me->isInCombat() && me->getAttackers().empty()) + EnterEvadeMode(); +} + +void PossessedAI::AttackStart(Unit *target) +{ + me->Attack(target, true); +} + +void PossessedAI::UpdateAI(const uint32 /*diff*/) +{ + if (me->getVictim()) + { + if (!me->canAttack(me->getVictim())) + me->AttackStop(); + else + DoMeleeAttackIfReady(); + } +} + +void PossessedAI::JustDied(Unit * /*u*/) +{ + // We died while possessed, disable our loot + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); +} + +void PossessedAI::KilledUnit(Unit* victim) +{ + // We killed a creature, disable victim's loot + if (victim->GetTypeId() == TYPEID_UNIT && !((Creature*)victim)->IsDamageEnoughForLootingAndReward()) //Damage control necessary to enable loot for Razuvious + victim->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); +} + +void CritterAI::DamageTaken(Unit * /*done_by*/, uint32 &) +{ + if (!me->hasUnitState(UNIT_STAT_FLEEING)) + me->SetControlled(true, UNIT_STAT_FLEEING); +} + +void CritterAI::EnterEvadeMode() +{ + if (me->hasUnitState(UNIT_STAT_FLEEING)) + me->SetControlled(false, UNIT_STAT_FLEEING); + CreatureAI::EnterEvadeMode(); +} + +void TriggerAI::IsSummonedBy(Unit *summoner) +{ + if (me->m_spells[0]) + me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner->GetGUID()); +} diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h new file mode 100644 index 0000000..c13e2d1 --- /dev/null +++ b/src/server/game/AI/CoreAI/PassiveAI.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_PASSIVEAI_H +#define TRINITY_PASSIVEAI_H + +#include "CreatureAI.h" +//#include "CreatureAIImpl.h" + +class PassiveAI : public CreatureAI +{ + public: + explicit PassiveAI(Creature *c); + + void MoveInLineOfSight(Unit *) {} + void AttackStart(Unit *) {} + void UpdateAI(const uint32); + + static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; } +}; + +class PossessedAI : public CreatureAI +{ + public: + explicit PossessedAI(Creature *c); + + void MoveInLineOfSight(Unit *) {} + void AttackStart(Unit *target); + void UpdateAI(const uint32); + void EnterEvadeMode() {} + + void JustDied(Unit*); + void KilledUnit(Unit* victim); + + static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; } +}; + +class NullCreatureAI : public CreatureAI +{ + public: + explicit NullCreatureAI(Creature *c); + + void MoveInLineOfSight(Unit *) {} + void AttackStart(Unit *) {} + void UpdateAI(const uint32) {} + void EnterEvadeMode() {} + void OnCharmed(bool /*apply*/) {} + + static int Permissible(const Creature *) { return PERMIT_BASE_IDLE; } +}; + +class CritterAI : public PassiveAI +{ + public: + explicit CritterAI(Creature *c) : PassiveAI(c) {} + + void DamageTaken(Unit *done_by, uint32 & /*damage*/); + void EnterEvadeMode(); +}; + +class TriggerAI : public NullCreatureAI +{ + public: + explicit TriggerAI(Creature *c) : NullCreatureAI(c) {} + void IsSummonedBy(Unit *summoner); +}; + +#endif + diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp new file mode 100644 index 0000000..cae5066 --- /dev/null +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -0,0 +1,471 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "PetAI.h" +#include "Errors.h" +#include "Pet.h" +#include "Player.h" +#include "DBCStores.h" +#include "Spell.h" +#include "ObjectAccessor.h" +#include "SpellMgr.h" +#include "Creature.h" +#include "World.h" +#include "Util.h" + +int PetAI::Permissible(const Creature *creature) +{ + if (creature->isPet()) + return PERMIT_BASE_SPECIAL; + + return PERMIT_BASE_NO; +} + +PetAI::PetAI(Creature *c) : CreatureAI(c), i_tracker(TIME_INTERVAL_LOOK) +{ + m_AllySet.clear(); + UpdateAllies(); +} + +void PetAI::EnterEvadeMode() +{ +} + +bool PetAI::_needToStop() const +{ + // This is needed for charmed creatures, as once their target was reset other effects can trigger threat + if (me->isCharmed() && me->getVictim() == me->GetCharmer()) + return true; + + return !me->canAttack(me->getVictim()); +} + +void PetAI::_stopAttack() +{ + if (!me->isAlive()) + { + DEBUG_LOG("Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow()); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->CombatStop(); + me->getHostileRefManager().deleteReferences(); + + return; + } + + me->AttackStop(); + me->GetCharmInfo()->SetIsCommandAttack(false); + HandleReturnMovement(); +} + +void PetAI::UpdateAI(const uint32 diff) +{ + if (!me->isAlive()) + return; + + Unit* owner = me->GetCharmerOrOwner(); + + if (m_updateAlliesTimer <= diff) + // UpdateAllies self set update timer + UpdateAllies(); + else + m_updateAlliesTimer -= diff; + + // me->getVictim() can't be used for check in case stop fighting, me->getVictim() clear at Unit death etc. + if (me->getVictim()) + { + if (_needToStop()) + { + DEBUG_LOG("Pet AI stoped attacking [guid=%u]", me->GetGUIDLow()); + _stopAttack(); + return; + } + + DoMeleeAttackIfReady(); + } + else if (owner && me->GetCharmInfo()) //no victim + { + Unit *nextTarget = SelectNextTarget(); + + if (nextTarget) + AttackStart(nextTarget); + else + HandleReturnMovement(); + } + else if (owner && !me->hasUnitState(UNIT_STAT_FOLLOW)) // no charm info and no victim + me->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST, me->GetFollowAngle()); + + if (!me->GetCharmInfo()) + return; + + // Autocast (casted only in combat or persistent spells in any state) + if (me->GetGlobalCooldown() == 0 && !me->hasUnitState(UNIT_STAT_CASTING)) + { + typedef std::vector > TargetSpellList; + TargetSpellList targetSpellStore; + + for (uint8 i = 0; i < me->GetPetAutoSpellSize(); ++i) + { + uint32 spellID = me->GetPetAutoSpellOnPos(i); + if (!spellID) + continue; + + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID); + if (!spellInfo) + continue; + + // ignore some combinations of combat state and combat/noncombat spells + if (!me->getVictim()) + { + // ignore attacking spells, and allow only self/around spells + if (!IsPositiveSpell(spellInfo->Id)) + continue; + + // non combat spells allowed + // only pet spells have IsNonCombatSpell and not fit this reqs: + // Consume Shadows, Lesser Invisibility, so ignore checks for its + if (!IsNonCombatSpell(spellInfo)) + { + // allow only spell without spell cost or with spell cost but not duration limit + int32 duration = GetSpellDuration(spellInfo); + if ((spellInfo->manaCost || spellInfo->ManaCostPercentage || spellInfo->manaPerSecond) && duration > 0) + continue; + + // allow only spell without cooldown > duration + int32 cooldown = GetSpellRecoveryTime(spellInfo); + if (cooldown >= 0 && duration >= 0 && cooldown > duration) + continue; + } + } + else + { + // just ignore non-combat spells + if (IsNonCombatSpell(spellInfo)) + continue; + } + + Spell *spell = new Spell(me, spellInfo, false, 0); + + // Fix to allow pets on STAY to autocast + if (me->getVictim() && _CanAttack(me->getVictim()) && spell->CanAutoCast(me->getVictim())) + { + targetSpellStore.push_back(std::make_pair(me->getVictim(), spell)); + continue; + } + else + { + bool spellUsed = false; + for (std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) + { + Unit* Target = ObjectAccessor::GetUnit(*me,*tar); + + //only buff targets that are in combat, unless the spell can only be cast while out of combat + if (!Target) + continue; + + if (spell->CanAutoCast(Target)) + { + targetSpellStore.push_back(std::make_pair(Target, spell)); + spellUsed = true; + break; + } + } + if (!spellUsed) + delete spell; + } + } + + //found units to cast on to + if (!targetSpellStore.empty()) + { + uint32 index = urand(0, targetSpellStore.size() - 1); + + Spell* spell = targetSpellStore[index].second; + Unit* target = targetSpellStore[index].first; + + targetSpellStore.erase(targetSpellStore.begin() + index); + + SpellCastTargets targets; + targets.setUnitTarget(target); + + if (!me->HasInArc(M_PI, target)) + { + me->SetInFront(target); + if (target && target->GetTypeId() == TYPEID_PLAYER) + me->SendUpdateToPlayer(target->ToPlayer()); + + if (owner && owner->GetTypeId() == TYPEID_PLAYER) + me->SendUpdateToPlayer(owner->ToPlayer()); + } + + me->AddCreatureSpellCooldown(spell->m_spellInfo->Id); + + spell->prepare(&targets); + } + + // deleted cached Spell objects + for (TargetSpellList::const_iterator itr = targetSpellStore.begin(); itr != targetSpellStore.end(); ++itr) + delete itr->second; + } +} + +void PetAI::UpdateAllies() +{ + Unit* owner = me->GetCharmerOrOwner(); + Group *pGroup = NULL; + + m_updateAlliesTimer = 10*IN_MILLISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance + + if (!owner) + return; + else if (owner->GetTypeId() == TYPEID_PLAYER) + pGroup = owner->ToPlayer()->GetGroup(); + + //only pet and owner/not in group->ok + if (m_AllySet.size() == 2 && !pGroup) + return; + //owner is in group; group members filled in already (no raid -> subgroupcount = whole count) + if (pGroup && !pGroup->isRaidGroup() && m_AllySet.size() == (pGroup->GetMembersCount() + 2)) + return; + + m_AllySet.clear(); + m_AllySet.insert(me->GetGUID()); + if (pGroup) //add group + { + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* Target = itr->getSource(); + if (!Target || !pGroup->SameSubGroup((Player*)owner, Target)) + continue; + + if (Target->GetGUID() == owner->GetGUID()) + continue; + + m_AllySet.insert(Target->GetGUID()); + } + } + else //remove group + m_AllySet.insert(owner->GetGUID()); +} + +void PetAI::KilledUnit(Unit *victim) +{ + // Called from Unit::Kill() in case where pet or owner kills something + // if owner killed this victim, pet may still be attacking something else + if (me->getVictim() && me->getVictim() != victim) + return; + + // Clear target just in case. May help problem where health / focus / mana + // regen gets stuck. Also resets attack command. + // Can't use _stopAttack() because that activates movement handlers and ignores + // next target selection + me->AttackStop(); + me->GetCharmInfo()->SetIsCommandAttack(false); + + Unit *nextTarget = SelectNextTarget(); + + if (nextTarget) + AttackStart(nextTarget); + else + HandleReturnMovement(); // Return +} + +void PetAI::AttackStart(Unit *target) +{ + // Overrides Unit::AttackStart to correctly evaluate Pet states + + // Check all pet states to decide if we can attack this target + if (!_CanAttack(target)) + return; + + // We can attack, should we chase or not? + if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW)) + DoAttack(target,true); // FOLLOW, attack with chase + else + { + if (me->GetCharmInfo()->IsCommandAttack()) + DoAttack(target,true); // STAY or FOLLOW, player clicked "attack" so attack with chase + else + DoAttack(target,false); // STAY, target in range, attack not clicked so attack without chase + } +} + +Unit *PetAI::SelectNextTarget() +{ + // Provides next target selection after current target death + + // Passive pets don't do next target selection + if (me->HasReactState(REACT_PASSIVE)) + return NULL; + + // Check pet's attackers first to prevent dragging mobs back + // to owner + if (me->getAttackerForHelper()) + return me->getAttackerForHelper(); + + // Check owner's attackers if pet didn't have any + if (me->GetCharmerOrOwner()->getAttackerForHelper()) + return me->GetCharmerOrOwner()->getAttackerForHelper(); + + // 3.0.2 - Pets now start attacking their owners target in defensive mode as soon as the hunter does + if (me->GetCharmerOrOwner()->getVictim()) + return me->GetCharmerOrOwner()->getVictim(); + + // Default + return NULL; +} + +void PetAI::HandleReturnMovement() +{ + // Handles moving the pet back to stay or owner + + if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY)) + { + if (!me->GetCharmInfo()->IsAtStay() && !me->GetCharmInfo()->IsReturning()) + { + // Return to previous position where stay was clicked + if (!me->GetCharmInfo()->IsCommandAttack()) + { + float x,y,z; + + me->GetCharmInfo()->GetStayPosition(x, y, z); + me->GetCharmInfo()->SetIsReturning(true); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(me->GetGUIDLow(),x,y,z); + } + } + } + else // COMMAND_FOLLOW + { + if (!me->GetCharmInfo()->IsFollowing() && !me->GetCharmInfo()->IsReturning()) + { + if (!me->GetCharmInfo()->IsCommandAttack()) + { + me->GetCharmInfo()->SetIsReturning(true); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveFollow(me->GetCharmerOrOwner(), PET_FOLLOW_DIST, me->GetFollowAngle()); + } + } + } + +} + +void PetAI::DoAttack(Unit *target, bool chase) +{ + // Handles attack with or without chase and also resets all + // PetAI flags for next update / creature kill + + // me->GetCharmInfo()->SetIsCommandAttack(false); + + // The following conditions are true if chase == true + // (Follow && (Aggressive || Defensive)) + // ((Stay || Follow) && (Passive && player clicked attack)) + + if (chase) + { + if (me->Attack(target,true)) + { + me->GetCharmInfo()->SetIsAtStay(false); + me->GetCharmInfo()->SetIsFollowing(false); + me->GetCharmInfo()->SetIsReturning(false); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(target); + } + } + else // (Stay && ((Aggressive || Defensive) && In Melee Range))) + { + me->GetCharmInfo()->SetIsAtStay(true); + me->GetCharmInfo()->SetIsFollowing(false); + me->GetCharmInfo()->SetIsReturning(false); + me->Attack(target,true); + } +} + +void PetAI::MovementInform(uint32 moveType, uint32 data) +{ + // Receives notification when pet reaches stay or follow owner + switch (moveType) + { + case POINT_MOTION_TYPE: + { + // Pet is returning to where stay was clicked. data should be + // pet's GUIDLow since we set that as the waypoint ID + if (data == me->GetGUIDLow() && me->GetCharmInfo()->IsReturning()) + { + me->GetCharmInfo()->SetIsAtStay(true); + me->GetCharmInfo()->SetIsReturning(false); + me->GetCharmInfo()->SetIsFollowing(false); + me->GetCharmInfo()->SetIsCommandAttack(false); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + } + } + break; + + case TARGETED_MOTION_TYPE: + { + // If data is owner's GUIDLow then we've reached follow point, + // otherwise we're probably chasing a creature + if (me->GetCharmerOrOwner() && me->GetCharmInfo() && data == me->GetCharmerOrOwner()->GetGUIDLow() && me->GetCharmInfo()->IsReturning()) + { + me->GetCharmInfo()->SetIsAtStay(false); + me->GetCharmInfo()->SetIsReturning(false); + me->GetCharmInfo()->SetIsFollowing(true); + me->GetCharmInfo()->SetIsCommandAttack(false); + me->addUnitState(UNIT_STAT_FOLLOW); + } + } + break; + + default: + break; + } +} + +bool PetAI::_CanAttack(Unit *target) +{ + // Evaluates wether a pet can attack a specific + // target based on CommandState, ReactState and other flags + + // Returning - check first since pets returning ignore attacks + if (me->GetCharmInfo()->IsReturning()) + return false; + + // Passive - check now so we don't have to worry about passive in later checks + if (me->HasReactState(REACT_PASSIVE)) + return me->GetCharmInfo()->IsCommandAttack(); + + // Pets commanded to attack should not stop their approach if attacked by another creature + if (me->getVictim() && (me->getVictim() != target)) + return !me->GetCharmInfo()->IsCommandAttack(); + + // From this point on, pet will always be either aggressive or defensive + + // Stay - can attack if target is within range or commanded to + if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY)) + return (me->IsWithinMeleeRange(target, MIN_MELEE_REACH) || me->GetCharmInfo()->IsCommandAttack()); + + // Follow + if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW)) + return true; + + // default, though we shouldn't ever get here + return false; +} diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h new file mode 100644 index 0000000..f6087a1 --- /dev/null +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_PETAI_H +#define TRINITY_PETAI_H + +#include "CreatureAI.h" +#include "Timer.h" + +class Creature; +class Spell; + +class PetAI : public CreatureAI +{ + public: + + explicit PetAI(Creature *c); + + void EnterEvadeMode(); + void JustDied(Unit * /*who*/) { _stopAttack(); } + + void UpdateAI(const uint32); + static int Permissible(const Creature *); + + void KilledUnit(Unit * /*victim*/); + void AttackStart(Unit *target); + void MovementInform(uint32 moveType, uint32 data); + + private: + bool _isVisible(Unit *) const; + bool _needToStop(void) const; + void _stopAttack(void); + + void UpdateAllies(); + + TimeTracker i_tracker; + bool inCombat; + std::set m_AllySet; + uint32 m_updateAlliesTimer; + + Unit *SelectNextTarget(); + void HandleReturnMovement(); + void DoAttack(Unit *target, bool chase); + bool _CanAttack(Unit *target); +}; +#endif + diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp new file mode 100644 index 0000000..fdca631 --- /dev/null +++ b/src/server/game/AI/CoreAI/ReactorAI.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ByteBuffer.h" +#include "ReactorAI.h" +#include "Errors.h" +#include "Log.h" +#include "ObjectAccessor.h" +#include "CreatureAIImpl.h" + +#define REACTOR_VISIBLE_RANGE (26.46f) + +int +ReactorAI::Permissible(const Creature *creature) +{ + if (creature->isCivilian() || creature->IsNeutralToAll()) + return PERMIT_BASE_REACTIVE; + + return PERMIT_BASE_NO; +} + +void +ReactorAI::MoveInLineOfSight(Unit *) +{ +} + +void +ReactorAI::UpdateAI(const uint32 /*time_diff*/) +{ + // update i_victimGuid if me->getVictim() !=0 and changed + if (!UpdateVictim()) + return; + + if (me->isAttackReady()) + { + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + } +} diff --git a/src/server/game/AI/CoreAI/ReactorAI.h b/src/server/game/AI/CoreAI/ReactorAI.h new file mode 100644 index 0000000..ae4e640 --- /dev/null +++ b/src/server/game/AI/CoreAI/ReactorAI.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_REACTORAI_H +#define TRINITY_REACTORAI_H + +#include "CreatureAI.h" + +class Unit; + +class ReactorAI : public CreatureAI +{ + public: + + explicit ReactorAI(Creature *c) : CreatureAI(c) {} + + void MoveInLineOfSight(Unit *); + + void UpdateAI(const uint32); + static int Permissible(const Creature *); +}; +#endif + diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp new file mode 100644 index 0000000..a6464f1 --- /dev/null +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "TotemAI.h" +#include "Totem.h" +#include "Creature.h" +#include "DBCStores.h" +#include "ObjectAccessor.h" +#include "SpellMgr.h" + +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "CellImpl.h" + +int +TotemAI::Permissible(const Creature *creature) +{ + if (creature->isTotem()) + return PERMIT_BASE_PROACTIVE; + + return PERMIT_BASE_NO; +} + +TotemAI::TotemAI(Creature *c) : CreatureAI(c), i_victimGuid(0) +{ + assert(c->isTotem()); +} + +void +TotemAI::MoveInLineOfSight(Unit *) +{ +} + +void TotemAI::EnterEvadeMode() +{ + me->CombatStop(true); +} + +void +TotemAI::UpdateAI(const uint32 /*diff*/) +{ + if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE) + return; + + if (!me->isAlive() || me->IsNonMeleeSpellCasted(false)) + return; + + // Search spell + SpellEntry const *spellInfo = sSpellStore.LookupEntry(me->ToTotem()->GetSpell()); + if (!spellInfo) + return; + + // Get spell range + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + float max_range = GetSpellMaxRangeForHostile(srange); + + // SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems + + // pointer to appropriate target if found any + Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL; + + // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) + if (!victim || + !victim->isTargetableForAttack() || !me->IsWithinDistInMap(victim, max_range) || + me->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(me,false)) + { + victim = NULL; + Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range); + Trinity::UnitLastSearcher checker(me, victim, u_check); + me->VisitNearbyObject(max_range, checker); + } + + // If have target + if (victim) + { + // remember + i_victimGuid = victim->GetGUID(); + + // attack + me->SetInFront(victim); // client change orientation by self + me->CastSpell(victim, me->ToTotem()->GetSpell(), false); + } + else + i_victimGuid = 0; +} + +void +TotemAI::AttackStart(Unit *) +{ + // Sentry totem sends ping on attack + if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER) + { + WorldPacket data(MSG_MINIMAP_PING, (8+4+4)); + data << me->GetGUID(); + data << me->GetPositionX(); + data << me->GetPositionY(); + ((Player*)me->GetOwner())->GetSession()->SendPacket(&data); + } +} diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h new file mode 100644 index 0000000..34f4dfa --- /dev/null +++ b/src/server/game/AI/CoreAI/TotemAI.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_TOTEMAI_H +#define TRINITY_TOTEMAI_H + +#include "CreatureAI.h" +#include "Timer.h" + +class Creature; +class Totem; + +class TotemAI : public CreatureAI +{ + public: + + explicit TotemAI(Creature *c); + + void MoveInLineOfSight(Unit *); + void AttackStart(Unit *); + void EnterEvadeMode(); + + void UpdateAI(const uint32); + static int Permissible(const Creature *); + + private: + uint64 i_victimGuid; +}; +#endif + diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp new file mode 100644 index 0000000..a156ec5 --- /dev/null +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -0,0 +1,327 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "UnitAI.h" +#include "Player.h" +#include "Creature.h" +#include "SpellAuras.h" +#include "SpellAuraEffects.h" +#include "SpellMgr.h" +#include "CreatureAIImpl.h" + +void UnitAI::AttackStart(Unit *victim) +{ + if (victim && me->Attack(victim, true)) + me->GetMotionMaster()->MoveChase(victim); +} + +void UnitAI::AttackStartCaster(Unit *victim, float dist) +{ + if (victim && me->Attack(victim, false)) + me->GetMotionMaster()->MoveChase(victim, dist); +} + +void UnitAI::DoMeleeAttackIfReady() +{ + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + //Make sure our attack is ready and we aren't currently casting before checking distance + if (me->isAttackReady()) + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + } + if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->AttackerStateUpdate(me->getVictim(), OFF_ATTACK); + me->resetAttackTimer(OFF_ATTACK); + } + } +} + +bool UnitAI::DoSpellAttackIfReady(uint32 spell) +{ + if (me->hasUnitState(UNIT_STAT_CASTING)) + return true; + + if (me->isAttackReady()) + { + if (me->IsWithinCombatRange(me->getVictim(), GetSpellMaxRange(spell, false))) + { + me->CastSpell(me->getVictim(), spell, false); + me->resetAttackTimer(); + } + else + return false; + } + return true; +} + +// default predicate function to select target based on distance, player and/or aura criteria +struct DefaultTargetSelector : public std::unary_function +{ + const Unit *me; + float m_dist; + bool m_playerOnly; + int32 m_aura; + + // pUnit: the reference unit + // dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit + // playerOnly: self explaining + // aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura + DefaultTargetSelector(const Unit *pUnit, float dist, bool playerOnly, int32 aura) : me(pUnit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) {} + + bool operator() (const Unit *pTarget) + { + if (!me) + return false; + + if (!pTarget) + return false; + + if (m_playerOnly && (pTarget->GetTypeId() != TYPEID_PLAYER)) + return false; + + if (m_dist > 0.0f && !me->IsWithinCombatRange(pTarget, m_dist)) + return false; + + if (m_dist < 0.0f && me->IsWithinCombatRange(pTarget, -m_dist)) + return false; + + if (m_aura) + { + if (m_aura > 0) + { + if (!pTarget->HasAura(m_aura)) + return false; + } + else + { + if (pTarget->HasAura(m_aura)) + return false; + } + } + + return true; + } +}; + +Unit* UnitAI::SelectTarget(SelectAggroTarget targetType, uint32 position, float dist, bool playerOnly, int32 aura) +{ + return SelectTarget(targetType, position, DefaultTargetSelector(me, dist, playerOnly, aura)); +} + +void UnitAI::SelectTargetList(std::list &targetList, uint32 num, SelectAggroTarget targetType, float dist, bool playerOnly, int32 aura) +{ + const std::list &threatlist = me->getThreatManager().getThreatList(); + + if (threatlist.empty()) + return; + + DefaultTargetSelector targetSelector(me, dist,playerOnly, aura); + for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + if (targetSelector((*itr)->getTarget())) + targetList.push_back((*itr)->getTarget()); + + if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST) + targetList.sort(Trinity::ObjectDistanceOrderPred(me)); + + if (targetType == SELECT_TARGET_FARTHEST || targetType == SELECT_TARGET_BOTTOMAGGRO) + targetList.reverse(); + + if (targetList.size() < num) + return; + + if (targetType == SELECT_TARGET_RANDOM) + { + while (num < targetList.size()) { + std::list::iterator itr = targetList.begin(); + advance(itr, urand(0, targetList.size()-1)); + targetList.erase(itr); + } + } + else + targetList.resize(num); +} + +float UnitAI::DoGetSpellMaxRange(uint32 spellId, bool positive) +{ + return GetSpellMaxRange(spellId, positive); +} + +void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid) +{ + if (me->isInCombat()) + { + std::list& threatlist = me->getThreatManager().getThreatList(); + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + { + if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid())) + if (pTemp->GetTypeId() == TYPEID_PLAYER) + me->AddAura(spellid, pTemp); + } + }else + return; +} + +void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered) +{ + if (me->isInCombat()) + { + std::list& threatlist = me->getThreatManager().getThreatList(); + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + { + if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid())) + if (pTemp->GetTypeId() == TYPEID_PLAYER) + me->CastSpell(pTemp, spellid, triggered); + } + }else + return; +} + +void UnitAI::DoCast(uint32 spellId) +{ + Unit *target = NULL; + //sLog.outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target); + switch(AISpellInfo[spellId].target) + { + default: + case AITARGET_SELF: target = me; break; + case AITARGET_VICTIM: target = me->getVictim(); break; + case AITARGET_ENEMY: + { + const SpellEntry * spellInfo = GetSpellStore()->LookupEntry(spellId); + bool playerOnly = spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY; + //float range = GetSpellMaxRange(spellInfo, false); + target = SelectTarget(SELECT_TARGET_RANDOM, 0, GetSpellMaxRange(spellInfo, false), playerOnly); + break; + } + case AITARGET_ALLY: target = me; break; + case AITARGET_BUFF: target = me; break; + case AITARGET_DEBUFF: + { + const SpellEntry * spellInfo = GetSpellStore()->LookupEntry(spellId); + bool playerOnly = spellInfo->AttributesEx3 & SPELL_ATTR_EX3_PLAYERS_ONLY; + float range = GetSpellMaxRange(spellInfo, false); + + DefaultTargetSelector targetSelector(me, range, playerOnly, -(int32)spellId); + if (!(spellInfo->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) + && !(spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_VICTIM) + && targetSelector(me->getVictim())) + target = me->getVictim(); + else + target = SelectTarget(SELECT_TARGET_RANDOM, 0, targetSelector); + break; + } + } + + if (target) + me->CastSpell(target, spellId, false); +} + +#define UPDATE_TARGET(a) {if (AIInfo->targettarget=a;} + +void UnitAI::FillAISpellInfo() +{ + AISpellInfo = new AISpellInfoType[GetSpellStore()->GetNumRows()]; + + AISpellInfoType *AIInfo = AISpellInfo; + const SpellEntry * spellInfo; + + for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i, ++AIInfo) + { + spellInfo = GetSpellStore()->LookupEntry(i); + if (!spellInfo) + continue; + + if (spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD) + AIInfo->condition = AICOND_DIE; + else if (IsPassiveSpell(i) || GetSpellDuration(spellInfo) == -1) + AIInfo->condition = AICOND_AGGRO; + else + AIInfo->condition = AICOND_COMBAT; + + if (AIInfo->cooldown < spellInfo->RecoveryTime) + AIInfo->cooldown = spellInfo->RecoveryTime; + + if (!GetSpellMaxRange(spellInfo, false)) + UPDATE_TARGET(AITARGET_SELF) + else + { + for (uint32 j = 0; j < 3; ++j) + { + uint32 targetType = spellInfo->EffectImplicitTargetA[j]; + + if (targetType == TARGET_UNIT_TARGET_ENEMY + || targetType == TARGET_DST_TARGET_ENEMY) + UPDATE_TARGET(AITARGET_VICTIM) + else if (targetType == TARGET_UNIT_AREA_ENEMY_DST) + UPDATE_TARGET(AITARGET_ENEMY) + + if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) + { + if (targetType == TARGET_UNIT_TARGET_ENEMY) + UPDATE_TARGET(AITARGET_DEBUFF) + else if (IsPositiveSpell(i)) + UPDATE_TARGET(AITARGET_BUFF) + } + } + } + AIInfo->realCooldown = spellInfo->RecoveryTime + spellInfo->StartRecoveryTime; + SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); + if (srange) + AIInfo->maxRange = srange->maxRangeHostile * 3 / 4; + } +} + +//Enable PlayerAI when charmed +void PlayerAI::OnCharmed(bool apply) { me->IsAIEnabled = apply; } + +void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/) +{ + Creature *charmer = me->GetCharmer()->ToCreature(); + + //kill self if charm aura has infinite duration + if (charmer->IsInEvadeMode()) + { + Unit::AuraEffectList const& auras = me->GetAuraEffectsByType(SPELL_AURA_MOD_CHARM); + for (Unit::AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter) + if ((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent()) + { + charmer->Kill(me); + return; + } + } + + if (!charmer->isInCombat()) + me->GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, me->GetFollowAngle()); + + Unit *target = me->getVictim(); + if (!target || !charmer->canAttack(target)) + AttackStart(charmer->SelectNearestTargetInAttackDistance()); +} diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h new file mode 100644 index 0000000..3033f05 --- /dev/null +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_UNITAI_H +#define TRINITY_UNITAI_H + +#include "Define.h" +#include +#include "Unit.h" + +class Unit; +class Player; +struct AISpellInfoType; + +//Selection method used by SelectTarget +enum SelectAggroTarget +{ + SELECT_TARGET_RANDOM = 0, //Just selects a random target + SELECT_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom + SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top + SELECT_TARGET_NEAREST, + SELECT_TARGET_FARTHEST, +}; + +class UnitAI +{ + protected: + Unit * const me; + public: + explicit UnitAI(Unit *u) : me(u) {} + virtual ~UnitAI() {} + + virtual bool CanAIAttack(const Unit * /*who*/) const { return true; } + virtual void AttackStart(Unit *); + virtual void UpdateAI(const uint32 diff) = 0; + + virtual void InitializeAI() { if (!me->isDead()) Reset(); } + + virtual void Reset() {}; + + // Called when unit is charmed + virtual void OnCharmed(bool apply) = 0; + + // Pass parameters between AI + virtual void DoAction(const int32 /*param*/ = 0) {} + virtual uint32 GetData(uint32 /*id = 0*/) { return 0; } + virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} + virtual void SetGUID(const uint64 &/*guid*/, int32 /*id*/ = 0) {} + virtual uint64 GetGUID(int32 /*id*/ = 0) { return 0; } + + Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); + void SelectTargetList(std::list &targetList, uint32 num, SelectAggroTarget targetType, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); + + // Select the targets satifying the predicate. + // predicate shall extend std::unary_function + template Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE predicate) + { + const std::list &threatlist = me->getThreatManager().getThreatList(); + std::list targetList; + + if (position >= threatlist.size()) + return NULL; + + for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + { + HostileReference* ref = (*itr); + if (predicate(ref->getTarget())) + targetList.push_back(ref->getTarget()); + } + + if (position >= targetList.size()) + return NULL; + + if (targetType == SELECT_TARGET_NEAREST || targetType == SELECT_TARGET_FARTHEST) + targetList.sort(Trinity::ObjectDistanceOrderPred(me)); + + switch(targetType) + { + case SELECT_TARGET_NEAREST: + case SELECT_TARGET_TOPAGGRO: + { + std::list::iterator itr = targetList.begin(); + advance(itr, position); + return *itr; + } + break; + + case SELECT_TARGET_FARTHEST: + case SELECT_TARGET_BOTTOMAGGRO: + { + std::list::reverse_iterator ritr = targetList.rbegin(); + advance(ritr, position); + return *ritr; + } + break; + + case SELECT_TARGET_RANDOM: + { + std::list::iterator itr = targetList.begin(); + advance(itr, urand(position, targetList.size()-1)); + return *itr; + } + break; + } + + return NULL; + } + + void AttackStartCaster(Unit *victim, float dist); + + void DoAddAuraToAllHostilePlayers(uint32 spellid); + void DoCast(uint32 spellId); + void DoCast(Unit* victim, uint32 spellId, bool triggered = false); + void DoCastToAllHostilePlayers(uint32 spellid, bool triggered = false); + void DoCastVictim(uint32 spellId, bool triggered = false); + void DoCastAOE(uint32 spellId, bool triggered = false); + + float DoGetSpellMaxRange(uint32 spellId, bool positive = false); + + void DoMeleeAttackIfReady(); + bool DoSpellAttackIfReady(uint32 spell); + + static AISpellInfoType *AISpellInfo; + static void FillAISpellInfo(); +}; + +class PlayerAI : public UnitAI +{ + protected: + Player* const me; + public: + explicit PlayerAI(Player *p) : UnitAI((Unit*)p), me(p) {} + + void OnCharmed(bool apply); +}; + +class SimpleCharmedAI : public PlayerAI +{ + public: + void UpdateAI(const uint32 diff); + SimpleCharmedAI(Player *p): PlayerAI(p) {} +}; + +#endif diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp new file mode 100644 index 0000000..fb8f37a --- /dev/null +++ b/src/server/game/AI/CreatureAI.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "CreatureAI.h" +#include "CreatureAIImpl.h" +#include "Creature.h" +#include "World.h" +#include "SpellMgr.h" +#include "Vehicle.h" + +//Disable CreatureAI when charmed +void CreatureAI::OnCharmed(bool /*apply*/) +{ + //me->IsAIEnabled = !apply;*/ + me->NeedChangeAI = true; + me->IsAIEnabled = false; +} + +AISpellInfoType * UnitAI::AISpellInfo; + AISpellInfoType * GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; } + +void CreatureAI::DoZoneInCombat(Creature* creature) +{ + if (!creature) + creature = me; + + if (!creature->CanHaveThreatList()) + return; + + Map *map = creature->GetMap(); + if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated + { + sLog.outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0); + return; + } + + if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim()) + { + if (Unit *target = creature->SelectNearestTarget(50)) + creature->AI()->AttackStart(target); + else if (creature->isSummon()) + { + if (Unit *summoner = creature->ToTempSummon()->GetSummoner()) + { + Unit *target = summoner->getAttackerForHelper(); + if (!target && summoner->CanHaveThreatList() && !summoner->getThreatManager().isThreatListEmpty()) + target = summoner->getThreatManager().getHostilTarget(); + if (target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target))) + creature->AI()->AttackStart(target); + } + } + } + + if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim()) + { + sLog.outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry()); + return; + } + + Map::PlayerList const &PlList = map->GetPlayers(); + + if (PlList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + { + if (Player* pPlayer = i->getSource()) + { + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) + { + creature->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(creature); + creature->AddThreat(pPlayer, 0.0f); + } + + /* Causes certain things to never leave the threat list (Priest Lightwell, etc): + for (Unit::ControlList::const_iterator itr = pPlayer->m_Controlled.begin(); itr != pPlayer->m_Controlled.end(); ++itr) + { + creature->SetInCombatWith(*itr); + (*itr)->SetInCombatWith(creature); + creature->AddThreat(*itr, 0.0f); + }*/ + } + } +} + +// scripts does not take care about MoveInLineOfSight loops +// MoveInLineOfSight can be called inside another MoveInLineOfSight and cause stack overflow +void CreatureAI::MoveInLineOfSight_Safe(Unit *who) +{ + if (m_MoveInLineOfSight_locked == true) + return; + m_MoveInLineOfSight_locked = true; + MoveInLineOfSight(who); + m_MoveInLineOfSight_locked = false; +} + +void CreatureAI::MoveInLineOfSight(Unit *who) +{ + if (me->getVictim()) + return; + + if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) // non-combat pets should just stand there and look good;) + return; + + if (me->canStartAttack(who, false)) + AttackStart(who); + //else if (who->getVictim() && me->IsFriendlyTo(who) + // && me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)) + // && me->canStartAttack(who->getVictim(), true)) // TODO: if we use true, it will not attack it when it arrives + // me->GetMotionMaster()->MoveChase(who->getVictim()); +} + +void CreatureAI::EnterEvadeMode() +{ + if (!_EnterEvadeMode()) + return; + + sLog.outDebug("Creature %u enters evade mode.", me->GetEntry()); + + if (!me->GetVehicle()) // otherwise me will be in evade mode forever + { + if (Unit *owner = me->GetCharmerOrOwner()) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } + else + me->GetMotionMaster()->MoveTargetedHome(); + } + + Reset(); + + if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons! + me->GetVehicleKit()->Reset(); +} + +/*void CreatureAI::AttackedBy(Unit* attacker) +{ + if (!me->getVictim()) + AttackStart(attacker); +}*/ diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h new file mode 100644 index 0000000..c03d3dd --- /dev/null +++ b/src/server/game/AI/CreatureAI.h @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_CREATUREAI_H +#define TRINITY_CREATUREAI_H + +#include "UnitAI.h" +#include "Common.h" + +class WorldObject; +class Unit; +class Creature; +class Player; +struct SpellEntry; + +#define TIME_INTERVAL_LOOK 5000 +#define VISIBILITY_RANGE 10000 + +//Spell targets used by SelectSpell +enum SelectTargetType +{ + SELECT_TARGET_DONTCARE = 0, //All target types allowed + + SELECT_TARGET_SELF, //Only Self casting + + SELECT_TARGET_SINGLE_ENEMY, //Only Single Enemy + SELECT_TARGET_AOE_ENEMY, //Only AoE Enemy + SELECT_TARGET_ANY_ENEMY, //AoE or Single Enemy + + SELECT_TARGET_SINGLE_FRIEND, //Only Single Friend + SELECT_TARGET_AOE_FRIEND, //Only AoE Friend + SELECT_TARGET_ANY_FRIEND, //AoE or Single Friend +}; + +//Spell Effects used by SelectSpell +enum SelectEffect +{ + SELECT_EFFECT_DONTCARE = 0, //All spell effects allowed + SELECT_EFFECT_DAMAGE, //Spell does damage + SELECT_EFFECT_HEALING, //Spell does healing + SELECT_EFFECT_AURA, //Spell applies an aura +}; + +enum SCEquip +{ + EQUIP_NO_CHANGE = -1, + EQUIP_UNEQUIP = 0 +}; + +class CreatureAI : public UnitAI +{ + protected: + Creature * const me; + + bool UpdateVictim(); + bool UpdateVictimWithGaze(); + bool UpdateCombatState(); + + void SetGazeOn(Unit *target); + + Creature *DoSummon(uint32 uiEntry, const Position &pos, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); + Creature *DoSummon(uint32 uiEntry, WorldObject *obj, float fRadius = 5.0f, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); + Creature *DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float fZ, float fRadius = 5.0f, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); + + public: + explicit CreatureAI(Creature *c) : UnitAI((Unit*)c), me(c), m_MoveInLineOfSight_locked(false) {} + + virtual ~CreatureAI() {} + + /// == Reactions At ================================= + + // Called if IsVisible(Unit *who) is true at each *who move, reaction at visibility zone enter + void MoveInLineOfSight_Safe(Unit *who); + + // Called for reaction at stopping attack at no attackers or targets + virtual void EnterEvadeMode(); + + // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) + virtual void EnterCombat(Unit* /*enemy*/) {} + + // Called at any Damage from any attacker (before damage apply) + // Note: it for recalculation damage or special reaction at damage + // for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also + virtual void DamageTaken(Unit * /*done_by*/, uint32 & /*damage*/) {} + + // Called when the creature is killed + virtual void JustDied(Unit *) {} + + // Called when the creature kills a unit + virtual void KilledUnit(Unit *) {} + + // Called when the creature summon successfully other creature + virtual void JustSummoned(Creature*) {} + virtual void IsSummonedBy(Unit * /*summoner*/) {} + + virtual void SummonedCreatureDespawn(Creature* /*unit*/) {} + + // Called when hit by a spell + virtual void SpellHit(Unit*, const SpellEntry*) {} + + // Called when spell hits a target + virtual void SpellHitTarget(Unit* /*target*/, const SpellEntry*) {} + + // Called to get trigger target for aura effect + virtual Unit * GetAuraEffectTriggerTarget(uint32 /*spellId*/, uint8 /*effIndex*/) {return NULL;} + + // Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc) + //virtual void AttackedBy(Unit* attacker); + virtual bool IsEscorted() { return false; } + + // Called when creature is spawned or respawned (for reseting variables) + virtual void JustRespawned() { Reset(); } + + // Called at waypoint reached or point movement finished + virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {} + + void OnCharmed(bool apply); + + //virtual void SpellClick(Player *player) {} + + // Called at reaching home after evade + virtual void JustReachedHome() {} + + void DoZoneInCombat(Creature* pUnit = NULL); + + // Called at text emote receive from player + virtual void ReceiveEmote(Player* /*pPlayer*/, uint32 /*text_emote*/) {} + + /// == Triggered Actions Requested ================== + + // Called when creature attack expected (if creature can and no have current victim) + // Note: for reaction at hostile action must be called AttackedBy function. + //virtual void AttackStart(Unit *) {} + + // Called at World update tick + //virtual void UpdateAI(const uint32 /*diff*/) {} + + /// == State checks ================================= + + // Is unit visible for MoveInLineOfSight + //virtual bool IsVisible(Unit *) const { return false; } + + // called when the corpse of this creature gets removed + virtual void CorpseRemoved(uint32 & /*respawnDelay*/) {} + + // Called when victim entered water and creature can not enter water + //virtual bool canReachByRangeAttack(Unit*) { return false; } + + /// == Fields ======================================= + + // Pointer to controlled by AI creature + //Creature* const me; + + virtual void PassengerBoarded(Unit * /*who*/, int8 /*seatId*/, bool /*apply*/) {} + + protected: + virtual void MoveInLineOfSight(Unit *); + + bool _EnterEvadeMode(); + + private: + bool m_MoveInLineOfSight_locked; +}; + +enum Permitions +{ + PERMIT_BASE_NO = -1, + PERMIT_BASE_IDLE = 1, + PERMIT_BASE_REACTIVE = 100, + PERMIT_BASE_PROACTIVE = 200, + PERMIT_BASE_FACTION_SPECIFIC = 400, + PERMIT_BASE_SPECIAL = 800 +}; + +#endif diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h new file mode 100644 index 0000000..bc3b962 --- /dev/null +++ b/src/server/game/AI/CreatureAIFactory.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef TRINITY_CREATUREAIFACTORY_H +#define TRINITY_CREATUREAIFACTORY_H + +//#include "Policies/Singleton.h" +#include "ObjectRegistry.h" +#include "FactoryHolder.h" + +struct SelectableAI : public FactoryHolder, public Permissible +{ + SelectableAI(const char *id) : FactoryHolder(id) {} +}; + +template +struct CreatureAIFactory : public SelectableAI +{ + CreatureAIFactory(const char *name) : SelectableAI(name) {} + + CreatureAI* Create(void *) const; + + int Permit(const Creature *c) const { return REAL_AI::Permissible(c); } +}; + +template +inline CreatureAI* +CreatureAIFactory::Create(void *data) const +{ + Creature* creature = reinterpret_cast(data); + return (new REAL_AI(creature)); +} + +typedef FactoryHolder CreatureAICreator; +typedef FactoryHolder::FactoryHolderRegistry CreatureAIRegistry; +typedef FactoryHolder::FactoryHolderRepository CreatureAIRepository; +#endif diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h new file mode 100644 index 0000000..0f05d23 --- /dev/null +++ b/src/server/game/AI/CreatureAIImpl.h @@ -0,0 +1,638 @@ +/* + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef CREATUREAIIMPL_H +#define CREATUREAIIMPL_H + +#include "Common.h" +#include "Define.h" +#include "TemporarySummon.h" +#include "CreatureAI.h" +#include "SpellMgr.h" + +template +inline +const T& RAND(const T& v1, const T& v2) +{ + return (urand(0,1)) ? v1 : v2; +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3) +{ + switch (urand(0,2)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4) +{ + switch (urand(0,3)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) +{ + switch (urand(0,4)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6) +{ + switch (urand(0,5)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7) +{ + switch (urand(0,6)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8) +{ + switch (urand(0,7)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9) +{ + switch (urand(0,8)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9, const T& v10) +{ + switch (urand(0,9)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + case 9: return v10; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9, const T& v10, const T& v11) +{ + switch (urand(0,10)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + case 9: return v10; + case 10: return v11; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9, const T& v10, const T& v11, const T& v12) +{ + switch (urand(0,11)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + case 9: return v10; + case 10: return v11; + case 11: return v12; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9, const T& v10, const T& v11, const T& v12, const T& v13) +{ + switch (urand(0,12)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + case 9: return v10; + case 10: return v11; + case 11: return v12; + case 12: return v13; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9, const T& v10, const T& v11, const T& v12, const T& v13, const T& v14) +{ + switch (urand(0,13)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + case 9: return v10; + case 10: return v11; + case 11: return v12; + case 12: return v13; + case 13: return v14; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9, const T& v10, const T& v11, const T& v12, const T& v13, const T& v14, const T& v15) +{ + switch (urand(0,14)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + case 9: return v10; + case 10: return v11; + case 11: return v12; + case 12: return v13; + case 13: return v14; + case 14: return v15; + } +} + +template +inline +const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5, const T& v6, const T& v7, const T& v8, + const T& v9, const T& v10, const T& v11, const T& v12, const T& v13, const T& v14, const T& v15, const T& v16) +{ + switch (urand(0,15)) + { + default: + case 0: return v1; + case 1: return v2; + case 2: return v3; + case 3: return v4; + case 4: return v5; + case 5: return v6; + case 6: return v7; + case 7: return v8; + case 8: return v9; + case 9: return v10; + case 10: return v11; + case 11: return v12; + case 12: return v13; + case 13: return v14; + case 14: return v15; + case 15: return v16; + } +} + +class EventMap : private std::map +{ + private: + uint32 m_time, m_phase; + public: + explicit EventMap() : m_phase(0), m_time(0) {} + + uint32 GetTimer() const { return m_time; } + + void Reset() { clear(); m_time = 0; m_phase = 0; } + + void Update(uint32 time) { m_time += time; } + + void SetPhase(uint32 phase) + { + if (phase && phase < 9) + m_phase = (1 << (phase + 24)); + } + + void ScheduleEvent(uint32 eventId, uint32 time, uint32 gcd = 0, uint32 phase = 0) + { + time += m_time; + if (gcd && gcd < 9) + eventId |= (1 << (gcd + 16)); + if (phase && phase < 9) + eventId |= (1 << (phase + 24)); + iterator itr = find(time); + while (itr != end()) + { + ++time; + itr = find(time); + } + insert(std::make_pair(time, eventId)); + } + + void RescheduleEvent(uint32 eventId, uint32 time, uint32 gcd = 0, uint32 phase = 0) + { + CancelEvent(eventId); + ScheduleEvent(eventId, time, gcd, phase); + } + + void RepeatEvent(uint32 time) + { + if (empty()) + return; + uint32 eventId = begin()->second; + erase(begin()); + time += m_time; + iterator itr = find(time); + while (itr != end()) + { + ++time; + itr = find(time); + } + insert(std::make_pair(time, eventId)); + } + + void PopEvent() + { + erase(begin()); + } + + uint32 ExecuteEvent() + { + while (!empty()) + { + if (begin()->first > m_time) + return 0; + else if (m_phase && (begin()->second & 0xFF000000) && !(begin()->second & m_phase)) + erase(begin()); + else + { + uint32 eventId = (begin()->second & 0x0000FFFF); + erase(begin()); + return eventId; + } + } + return 0; + } + + uint32 GetEvent() + { + while (!empty()) + { + if (begin()->first > m_time) + return 0; + else if (m_phase && (begin()->second & 0xFF000000) && !(begin()->second & m_phase)) + erase(begin()); + else + return (begin()->second & 0x0000FFFF); + } + return 0; + } + + // Delay all events + void DelayEvents(uint32 delay) + { + if (delay < m_time) + m_time -= delay; + else + m_time = 0; + } + + // Delay all events having the specified Global Cooldown. + void DelayEvents(uint32 delay, uint32 gcd) + { + uint32 nextTime = m_time + delay; + gcd = (1 << (gcd + 16)); + for (iterator itr = begin(); itr != end() && itr->first < nextTime;) + { + if (itr->second & gcd) + { + ScheduleEvent(itr->second, itr->first-m_time+delay); + erase(itr); + itr = begin(); + } + else + ++itr; + } + } + + void CancelEvent(uint32 eventId) + { + for (iterator itr = begin(); itr != end();) + { + if (eventId == (itr->second & 0x0000FFFF)) + { + erase(itr); + itr = begin(); + } + else + ++itr; + } + } + + void CancelEventsByGCD(uint32 gcd) + { + gcd = (1 << (gcd + 16)); + + for (iterator itr = begin(); itr != end();) + { + if (itr->second & gcd) + { + erase(itr); + itr = begin(); + } + else + ++itr; + } + } +}; + +enum AITarget +{ + AITARGET_SELF, + AITARGET_VICTIM, + AITARGET_ENEMY, + AITARGET_ALLY, + AITARGET_BUFF, + AITARGET_DEBUFF, +}; + +enum AICondition +{ + AICOND_AGGRO, + AICOND_COMBAT, + AICOND_DIE, +}; + +#define AI_DEFAULT_COOLDOWN 5000 + +struct AISpellInfoType +{ + AISpellInfoType() : target(AITARGET_SELF), condition(AICOND_COMBAT) + , cooldown(AI_DEFAULT_COOLDOWN), realCooldown(0), maxRange(0.0f){} + AITarget target; + AICondition condition; + uint32 cooldown; + uint32 realCooldown; + float maxRange; +}; + + AISpellInfoType * GetAISpellInfo(uint32 i); + +inline void CreatureAI::SetGazeOn(Unit *target) +{ + if (me->canAttack(target)) + { + AttackStart(target); + me->SetReactState(REACT_PASSIVE); + } +} + +inline bool CreatureAI::UpdateVictimWithGaze() +{ + if (!me->isInCombat()) + return false; + + if (me->HasReactState(REACT_PASSIVE)) + { + if (me->getVictim()) + return true; + else + me->SetReactState(REACT_AGGRESSIVE); + } + + if (Unit *victim = me->SelectVictim()) + AttackStart(victim); + return me->getVictim(); +} + +inline bool CreatureAI::UpdateCombatState() +{ + if (!me->isInCombat()) + return false; + + if (!me->HasReactState(REACT_PASSIVE)) + { + if (Unit *victim = me->SelectVictim()) + AttackStart(victim); + return me->getVictim(); + } + else if (me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return false; + } + + return true; +} + +inline bool CreatureAI::UpdateVictim() +{ + if (!me->isInCombat()) + return false; + + if (!me->HasReactState(REACT_PASSIVE)) + { + if (Unit *victim = me->SelectVictim()) + AttackStart(victim); + return me->getVictim(); + } + else if (me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return false; + } + + return true; +} + +/* +inline bool CreatureAI::UpdateVictim() +{ + if (!me->isInCombat()) + return false; + if (Unit *victim = me->SelectVictim()) + AttackStart(victim); + return me->getVictim(); +} +*/ + +inline bool CreatureAI::_EnterEvadeMode() +{ + if (!me->isAlive()) + return false; + + // sometimes bosses stuck in combat? + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->LoadCreaturesAddon(); + me->SetLootRecipient(NULL); + me->ResetPlayerDamageReq(); + + if (me->IsInEvadeMode()) + return false; + + return true; +} + +inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered) +{ + if (!victim || (me->hasUnitState(UNIT_STAT_CASTING) && !triggered)) + return; + + me->CastSpell(victim, spellId, triggered); +} + +inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered) +{ + me->CastSpell(me->getVictim(), spellId, triggered); +} + +inline void UnitAI::DoCastAOE(uint32 spellId, bool triggered) +{ + if (!triggered && me->hasUnitState(UNIT_STAT_CASTING)) + return; + + me->CastSpell((Unit*)NULL, spellId, triggered); +} + +inline Creature *CreatureAI::DoSummon(uint32 uiEntry, const Position &pos, uint32 uiDespawntime, TempSummonType uiType) +{ + return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); +} + +inline Creature *CreatureAI::DoSummon(uint32 uiEntry, WorldObject* obj, float fRadius, uint32 uiDespawntime, TempSummonType uiType) +{ + Position pos; + obj->GetRandomNearPosition(pos, fRadius); + return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); +} + +inline Creature *CreatureAI::DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float _fZ, float fRadius, uint32 uiDespawntime, TempSummonType uiType) +{ + Position pos; + obj->GetRandomNearPosition(pos, fRadius); + pos.m_positionZ += _fZ; + return me->SummonCreature(uiEntry, pos, uiType, uiDespawntime); +} + +#endif + diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp new file mode 100644 index 0000000..9db30a0 --- /dev/null +++ b/src/server/game/AI/CreatureAIRegistry.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "PassiveAI.h" +#include "ReactorAI.h" +#include "CombatAI.h" +#include "GuardAI.h" +#include "PetAI.h" +#include "TotemAI.h" +#include "CreatureEventAI.h" +#include "RandomMovementGenerator.h" +#include "MovementGeneratorImpl.h" +#include "CreatureAIRegistry.h" +#include "WaypointMovementGenerator.h" +#include "CreatureAIFactory.h" + +//#include "CreatureAIImpl.h" +namespace AIRegistry +{ + void Initialize() + { + (new CreatureAIFactory("NullCreatureAI"))->RegisterSelf(); + (new CreatureAIFactory("TriggerAI"))->RegisterSelf(); + (new CreatureAIFactory("AggressorAI"))->RegisterSelf(); + (new CreatureAIFactory("ReactorAI"))->RegisterSelf(); + (new CreatureAIFactory("PassiveAI"))->RegisterSelf(); + (new CreatureAIFactory("CritterAI"))->RegisterSelf(); + (new CreatureAIFactory("GuardAI"))->RegisterSelf(); + (new CreatureAIFactory("PetAI"))->RegisterSelf(); + (new CreatureAIFactory("TotemAI"))->RegisterSelf(); + (new CreatureAIFactory("CombatAI"))->RegisterSelf(); + (new CreatureAIFactory("ArchorAI"))->RegisterSelf(); + (new CreatureAIFactory("TurretAI"))->RegisterSelf(); + (new CreatureAIFactory("EventAI"))->RegisterSelf(); + (new CreatureAIFactory("AOEAI"))->RegisterSelf(); + (new CreatureAIFactory("VehicleAI"))->RegisterSelf(); + + (new MovementGeneratorFactory >(RANDOM_MOTION_TYPE))->RegisterSelf(); + (new MovementGeneratorFactory >(WAYPOINT_MOTION_TYPE))->RegisterSelf(); + } +} + diff --git a/src/server/game/AI/CreatureAIRegistry.h b/src/server/game/AI/CreatureAIRegistry.h new file mode 100644 index 0000000..0d83d29 --- /dev/null +++ b/src/server/game/AI/CreatureAIRegistry.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_CREATUREAIREGISTRY_H +#define TRINITY_CREATUREAIREGISTRY_H + +namespace AIRegistry +{ + void Initialize(void); +} +#endif + diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp new file mode 100644 index 0000000..8283baf --- /dev/null +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Creature.h" +#include "CreatureAISelector.h" +#include "PassiveAI.h" + +#include "MovementGenerator.h" +#include "Pet.h" +#include "TemporarySummon.h" +#include "CreatureAIFactory.h" +#include "ScriptMgr.h" + +namespace FactorySelector +{ + CreatureAI* selectAI(Creature *creature) + { + const CreatureAICreator *ai_factory = NULL; + CreatureAIRegistry& ai_registry(*CreatureAIRepository::instance()); + + if (creature->isPet()) + ai_factory = ai_registry.GetRegistryItem("PetAI"); + + //scriptname in db + if (!ai_factory) + if (CreatureAI* scriptedAI = sScriptMgr.GetAI(creature)) + return scriptedAI; + + // AIname in db + std::string ainame=creature->GetAIName(); + if (!ai_factory && !ainame.empty()) + ai_factory = ai_registry.GetRegistryItem(ainame.c_str()); + + // select by NPC flags + if (!ai_factory) + { + if (creature->IsVehicle()) + ai_factory = ai_registry.GetRegistryItem("VehicleAI"); + else if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER) + ai_factory = ai_registry.GetRegistryItem("PetAI"); + else if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK)) + ai_factory = ai_registry.GetRegistryItem("NullCreatureAI"); + else if (creature->isGuard()) + ai_factory = ai_registry.GetRegistryItem("GuardAI"); + else if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN)) + ai_factory = ai_registry.GetRegistryItem("PetAI"); + else if (creature->isTotem()) + ai_factory = ai_registry.GetRegistryItem("TotemAI"); + else if (creature->isTrigger()) + { + if (creature->m_spells[0]) + ai_factory = ai_registry.GetRegistryItem("TriggerAI"); + else + ai_factory = ai_registry.GetRegistryItem("NullCreatureAI"); + } + else if (creature->GetCreatureType() == CREATURE_TYPE_CRITTER && !creature->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) + ai_factory = ai_registry.GetRegistryItem("CritterAI"); + } + + // select by permit check + if (!ai_factory) + { + int best_val = -1; + typedef CreatureAIRegistry::RegistryMapType RMT; + RMT const &l = ai_registry.GetRegisteredItems(); + for (RMT::const_iterator iter = l.begin(); iter != l.end(); ++iter) + { + const CreatureAICreator *factory = iter->second; + const SelectableAI *p = dynamic_cast(factory); + assert(p != NULL); + int val = p->Permit(creature); + if (val > best_val) + { + best_val = val; + ai_factory = p; + } + } + } + + // select NullCreatureAI if not another cases + ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key(); + + DEBUG_LOG("Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str()); + return (ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature)); + } + + MovementGenerator* selectMovementGenerator(Creature *creature) + { + MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance()); + assert(creature->GetCreatureInfo() != NULL); + const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType()); + + /* if (mv_factory == NULL) + { + int best_val = -1; + std::vector l; + mv_registry.GetRegisteredItems(l); + for (std::vector::iterator iter = l.begin(); iter != l.end(); ++iter) + { + const MovementGeneratorCreator *factory = mv_registry.GetRegistryItem((*iter).c_str()); + const SelectableMovement *p = dynamic_cast(factory); + assert(p != NULL); + int val = p->Permit(creature); + if (val > best_val) + { + best_val = val; + mv_factory = p; + } + } + }*/ + + return (mv_factory == NULL ? NULL : mv_factory->Create(creature)); + + } +} + diff --git a/src/server/game/AI/CreatureAISelector.h b/src/server/game/AI/CreatureAISelector.h new file mode 100644 index 0000000..98eeee8 --- /dev/null +++ b/src/server/game/AI/CreatureAISelector.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_CREATUREAISELECTOR_H +#define TRINITY_CREATUREAISELECTOR_H + +class CreatureAI; +class Creature; +class MovementGenerator; + +namespace FactorySelector +{ + CreatureAI* selectAI(Creature *); + MovementGenerator* selectMovementGenerator(Creature *); +} +#endif + diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp new file mode 100644 index 0000000..c70f471 --- /dev/null +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -0,0 +1,1384 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "CreatureEventAI.h" +#include "CreatureEventAIMgr.h" +#include "ObjectMgr.h" +#include "Spell.h" +#include "World.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GameEventMgr.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "InstanceData.h" +#include "SpellMgr.h" +#include "CreatureAIImpl.h" +#include "ConditionMgr.h" + +bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax) +{ + if (repeatMin == repeatMax) + Time = repeatMin; + else if (repeatMax > repeatMin) + Time = urand(repeatMin, repeatMax); + else + { + sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type); + Enabled = false; + return false; + } + + return true; +} + +int CreatureEventAI::Permissible(const Creature *creature) +{ + if (creature->GetAIName() == "EventAI") + return PERMIT_BASE_SPECIAL; + return PERMIT_BASE_NO; +} + +CreatureEventAI::CreatureEventAI(Creature *c) : CreatureAI(c) +{ + // Need make copy for filter unneeded steps and safe in case table reload + CreatureEventAI_Event_Map::const_iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(me->GetEntry()); + if (CreatureEvents != CreatureEAI_Mgr.GetCreatureEventAIMap().end()) + { + std::vector::const_iterator i; + for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i) + { + + //Debug check + #ifndef TRINITY_DEBUG + if ((*i).event_flags & EFLAG_DEBUG_ONLY) + continue; + #endif + if (me->GetMap()->IsDungeon()) + { + if ((1 << (me->GetMap()->GetSpawnMode()+1)) & (*i).event_flags) + { + //event flagged for instance mode + CreatureEventAIList.push_back(CreatureEventAIHolder(*i)); + } + continue; + } + CreatureEventAIList.push_back(CreatureEventAIHolder(*i)); + } + //EventMap had events but they were not added because they must be for instance + if (CreatureEventAIList.empty()) + sLog.outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry()); + } + else + sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry()); + + bEmptyList = CreatureEventAIList.empty(); + Phase = 0; + CombatMovementEnabled = true; + MeleeEnabled = true; + AttackDistance = 0.0f; + AttackAngle = 0.0f; + + InvinceabilityHpLevel = 0; + + //Handle Spawned Events + if (!bEmptyList) + { + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + if (SpawnedEventConditionsCheck((*i).Event)) + ProcessEvent(*i); + } +} + +bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker /*=NULL*/) +{ + if (!pHolder.Enabled || pHolder.Time) + return false; + + //Check the inverse phase mask (event doesn't trigger if current phase bit is set in mask) + if (pHolder.Event.event_inverse_phase_mask & (1 << Phase)) + return false; + + CreatureEventAI_Event const& event = pHolder.Event; + + //Check event conditions based on the event type, also reset events + switch (event.event_type) + { + case EVENT_T_TIMER: + if (!me->isInCombat()) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.timer.repeatMin,event.timer.repeatMax); + break; + case EVENT_T_TIMER_OOC: + if (me->isInCombat()) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.timer.repeatMin,event.timer.repeatMax); + break; + case EVENT_T_HP: + { + if (!me->isInCombat() || !me->GetMaxHealth()) + return false; + + uint32 perc = (me->GetHealth()*100) / me->GetMaxHealth(); + + if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax); + break; + } + case EVENT_T_MANA: + { + if (!me->isInCombat() || !me->GetMaxPower(POWER_MANA)) + return false; + + uint32 perc = (me->GetPower(POWER_MANA)*100) / me->GetMaxPower(POWER_MANA); + + if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax); + break; + } + case EVENT_T_AGGRO: + break; + case EVENT_T_KILL: + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.kill.repeatMin,event.kill.repeatMax); + break; + case EVENT_T_DEATH: + case EVENT_T_EVADE: + break; + case EVENT_T_SPELLHIT: + //Spell hit is special case, param1 and param2 handled within CreatureEventAI::SpellHit + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.spell_hit.repeatMin,event.spell_hit.repeatMax); + break; + case EVENT_T_RANGE: + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.range.repeatMin,event.range.repeatMax); + break; + case EVENT_T_OOC_LOS: + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.ooc_los.repeatMin,event.ooc_los.repeatMax); + break; + case EVENT_T_RESET: + case EVENT_T_SPAWNED: + break; + case EVENT_T_TARGET_HP: + { + if (!me->isInCombat() || !me->getVictim() || !me->getVictim()->GetMaxHealth()) + return false; + + uint32 perc = (me->getVictim()->GetHealth()*100) / me->getVictim()->GetMaxHealth(); + + if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax); + break; + } + case EVENT_T_TARGET_CASTING: + if (!me->isInCombat() || !me->getVictim() || !me->getVictim()->IsNonMeleeSpellCasted(false, false, true)) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.target_casting.repeatMin,event.target_casting.repeatMax); + break; + case EVENT_T_FRIENDLY_HP: + { + if (!me->isInCombat()) + return false; + + Unit* pUnit = DoSelectLowestHpFriendly(event.friendly_hp.radius, event.friendly_hp.hpDeficit); + if (!pUnit) + return false; + + pActionInvoker = pUnit; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.friendly_hp.repeatMin,event.friendly_hp.repeatMax); + break; + } + case EVENT_T_FRIENDLY_IS_CC: + { + if (!me->isInCombat()) + return false; + + std::list pList; + DoFindFriendlyCC(pList, event.friendly_is_cc.radius); + + //List is empty + if (pList.empty()) + return false; + + //We don't really care about the whole list, just return first available + pActionInvoker = *(pList.begin()); + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.friendly_is_cc.repeatMin,event.friendly_is_cc.repeatMax); + break; + } + case EVENT_T_FRIENDLY_MISSING_BUFF: + { + std::list pList; + DoFindFriendlyMissingBuff(pList, event.friendly_buff.radius, event.friendly_buff.spellId); + + //List is empty + if (pList.empty()) + return false; + + //We don't really care about the whole list, just return first available + pActionInvoker = *(pList.begin()); + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.friendly_buff.repeatMin,event.friendly_buff.repeatMax); + break; + } + case EVENT_T_SUMMONED_UNIT: + { + //Prevent event from occuring on no unit or non creatures + if (!pActionInvoker || pActionInvoker->GetTypeId() != TYPEID_UNIT) + return false; + + //Creature id doesn't match up + if (pActionInvoker->ToCreature()->GetEntry() != event.summon_unit.creatureId) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.summon_unit.repeatMin,event.summon_unit.repeatMax); + break; + } + case EVENT_T_TARGET_MANA: + { + if (!me->isInCombat() || !me->getVictim() || !me->getVictim()->GetMaxPower(POWER_MANA)) + return false; + + uint32 perc = (me->getVictim()->GetPower(POWER_MANA)*100) / me->getVictim()->GetMaxPower(POWER_MANA); + + if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax); + break; + } + case EVENT_T_REACHED_HOME: + case EVENT_T_RECEIVE_EMOTE: + break; + case EVENT_T_BUFFED: + { + //Note: checked only aura for effect 0, if need check aura for effect 1/2 then + // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx) + Aura const * aura = me->GetAura(event.buffed.spellId); + if (!aura || aura->GetStackAmount() < event.buffed.amount) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.buffed.repeatMin,event.buffed.repeatMax); + break; + } + case EVENT_T_TARGET_BUFFED: + { + //Prevent event from occuring on no unit + if (!pActionInvoker) + return false; + + //Note: checked only aura for effect 0, if need check aura for effect 1/2 then + // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx) + Aura const * aura = pActionInvoker->GetAura(event.buffed.spellId); + if (!aura || aura->GetStackAmount() < event.buffed.amount) + return false; + + //Repeat Timers + pHolder.UpdateRepeatTimer(me,event.buffed.repeatMin,event.buffed.repeatMax); + break; + } + default: + sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type); + break; + } + + //Disable non-repeatable events + if (!(pHolder.Event.event_flags & EFLAG_REPEATABLE)) + pHolder.Enabled = false; + + //Store random here so that all random actions match up + uint32 rnd = rand(); + + //Return if chance for event is not met + if (pHolder.Event.event_chance <= rnd % 100) + return false; + + //Process actions + for (uint8 j = 0; j < MAX_ACTIONS; ++j) + ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker); + + return true; +} + +void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker) +{ + switch (action.type) + { + case ACTION_T_TEXT: + { + if (!action.text.TextId1) + return; + + int32 temp = 0; + + if (action.text.TextId2 && action.text.TextId3) + temp = RAND(action.text.TextId1,action.text.TextId2,action.text.TextId3); + else if (action.text.TextId2 && urand(0,1)) + temp = action.text.TextId2; + else + temp = action.text.TextId1; + + if (temp) + { + Unit* target = NULL; + + if (pActionInvoker) + { + if (pActionInvoker->GetTypeId() == TYPEID_PLAYER) + target = pActionInvoker; + else if (Unit* owner = pActionInvoker->GetOwner()) + { + if (owner->GetTypeId() == TYPEID_PLAYER) + target = owner; + } + } + else + { + target = me->getVictim(); + if (target && target->GetTypeId() != TYPEID_PLAYER) + if (Unit* owner = target->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) + target = owner; + } + + DoScriptText(temp, me, target); + } + break; + } + case ACTION_T_SET_FACTION: + { + if (action.set_faction.factionId) + me->setFaction(action.set_faction.factionId); + else + { + if (CreatureInfo const* ci = GetCreatureTemplateStore(me->GetEntry())) + { + //if no id provided, assume reset and then use default + if (me->getFaction() != ci->faction_A) + me->setFaction(ci->faction_A); + } + } + break; + } + case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: + { + if (action.morph.creatureId || action.morph.modelId) + { + //set model based on entry from creature_template + if (action.morph.creatureId) + { + if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatureId)) + { + uint32 display_id = objmgr.ChooseDisplayId(0,ci); + me->SetDisplayId(display_id); + } + } + //if no param1, then use value from param2 (modelId) + else + me->SetDisplayId(action.morph.modelId); + } + else + me->DeMorph(); + break; + } + case ACTION_T_SOUND: + me->PlayDirectSound(action.sound.soundId); + break; + case ACTION_T_EMOTE: + me->HandleEmoteCommand(action.emote.emoteId); + break; + case ACTION_T_RANDOM_SOUND: + { + int32 temp = GetRandActionParam(rnd, action.random_sound.soundId1, action.random_sound.soundId2, action.random_sound.soundId3); + if (temp >= 0) + me->PlayDirectSound(temp); + break; + } + case ACTION_T_RANDOM_EMOTE: + { + int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3); + if (temp >= 0) + me->HandleEmoteCommand(temp); + break; + } + case ACTION_T_CAST: + { + Unit* target = GetTargetByType(action.cast.target, pActionInvoker); + Unit* caster = me; + + if (!target) + return; + + if (action.cast.castFlags & CAST_FORCE_TARGET_SELF) + caster = target; + + //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered + bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS)); + + // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them + if (action.cast.castFlags & CAST_AURA_NOT_PRESENT) + { + if (target->HasAura(action.cast.spellId)) + return; + } + + if (canCast) + { + const SpellEntry* tSpell = GetSpellStore()->LookupEntry(action.cast.spellId); + + //Verify that spell exists + if (tSpell) + { + //Check if cannot cast spell + if (!(action.cast.castFlags & (CAST_FORCE_TARGET_SELF | CAST_FORCE_CAST)) && + !CanCast(target, tSpell, (action.cast.castFlags & CAST_TRIGGERED))) + { + //Melee current victim if flag not set + if (!(action.cast.castFlags & CAST_NO_MELEE_IF_OOM)) + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + { + AttackDistance = 0.0f; + AttackAngle = 0.0f; + + me->GetMotionMaster()->MoveChase(me->getVictim(), AttackDistance, AttackAngle); + } + } + + } + else + { + //Interrupt any previous spell + if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTERRUPT_PREVIOUS) + caster->InterruptNonMeleeSpells(false); + + caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED)); + } + + } + else + sLog.outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", EventId, me->GetEntry(), action.cast.spellId); + } + break; + } + case ACTION_T_SUMMON: + { + Unit* target = GetTargetByType(action.summon.target, pActionInvoker); + + Creature* pCreature = NULL; + + if (action.summon.duration) + pCreature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration); + else + pCreature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + + if (!pCreature) + sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, me->GetEntry()); + else if (action.summon.target != TARGET_T_SELF && target) + pCreature->AI()->AttackStart(target); + break; + } + case ACTION_T_THREAT_SINGLE_PCT: + if (Unit* target = GetTargetByType(action.threat_single_pct.target, pActionInvoker)) + me->getThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent); + break; + case ACTION_T_THREAT_ALL_PCT: + { + std::list& threatList = me->getThreatManager().getThreatList(); + for (std::list::iterator i = threatList.begin(); i != threatList.end(); ++i) + if (Unit* Temp = Unit::GetUnit(*me,(*i)->getUnitGuid())) + me->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); + break; + } + case ACTION_T_QUEST_EVENT: + if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker)) + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->AreaExploredOrEventHappens(action.quest_event.questId); + break; + case ACTION_T_CAST_EVENT: + if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker)) + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->CastedCreatureOrGO(action.cast_event.creatureId, me->GetGUID(), action.cast_event.spellId); + break; + case ACTION_T_SET_UNIT_FIELD: + { + Unit* target = GetTargetByType(action.set_unit_field.target, pActionInvoker); + + // not allow modify important for integrity object fields + if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) + return; + + if (target) + target->SetUInt32Value(action.set_unit_field.field, action.set_unit_field.value); + + break; + } + case ACTION_T_SET_UNIT_FLAG: + if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker)) + target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); + break; + case ACTION_T_REMOVE_UNIT_FLAG: + if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker)) + target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); + break; + case ACTION_T_AUTO_ATTACK: + MeleeEnabled = action.auto_attack.state != 0; + break; + case ACTION_T_COMBAT_MOVEMENT: + // ignore no affect case + if (CombatMovementEnabled == (action.combat_movement.state != 0)) + return; + + CombatMovementEnabled = action.combat_movement.state != 0; + + //Allow movement (create new targeted movement gen only if idle) + if (CombatMovementEnabled) + { + Unit* victim = me->getVictim(); + if (me->isInCombat() && victim) + { + if (action.combat_movement.melee) + { + me->addUnitState(UNIT_STAT_MELEE_ATTACKING); + me->SendMeleeAttackStart(victim); + } + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE) + me->GetMotionMaster()->MoveChase(victim, AttackDistance, AttackAngle); // Targeted movement generator will start melee automatically, no need to send it explicitly + } + } + else + { + if (me->isInCombat()) + { + Unit* victim = me->getVictim(); + if (action.combat_movement.melee && victim) + { + me->clearUnitState(UNIT_STAT_MELEE_ATTACKING); + me->SendMeleeAttackStop(victim); + } + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + me->GetMotionMaster()->MoveIdle(); + } + } + break; + case ACTION_T_SET_PHASE: + Phase = action.set_phase.phase; + break; + case ACTION_T_INC_PHASE: + { + int32 new_phase = int32(Phase)+action.set_inc_phase.step; + if (new_phase < 0) + { + sLog.outErrorDb("CreatureEventAI: Event %d decrease Phase under 0. CreatureEntry = %d", EventId, me->GetEntry()); + Phase = 0; + } + else if (new_phase >= MAX_PHASE) + { + sLog.outErrorDb("CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry()); + Phase = MAX_PHASE-1; + } + else + Phase = new_phase; + + break; + } + case ACTION_T_EVADE: + EnterEvadeMode(); + break; + case ACTION_T_FLEE_FOR_ASSIST: + me->DoFleeToGetAssistance(); + break; + case ACTION_T_QUEST_EVENT_ALL: + if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER) + { + if (Unit* Temp = Unit::GetUnit(*me,pActionInvoker->GetGUID())) + if (Temp->GetTypeId() == TYPEID_PLAYER) + Temp->ToPlayer()->GroupEventHappens(action.quest_event_all.questId,me); + } + break; + case ACTION_T_CAST_EVENT_ALL: + { + std::list& threatList = me->getThreatManager().getThreatList(); + for (std::list::iterator i = threatList.begin(); i != threatList.end(); ++i) + if (Unit* Temp = Unit::GetUnit(*me,(*i)->getUnitGuid())) + if (Temp->GetTypeId() == TYPEID_PLAYER) + Temp->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, me->GetGUID(), action.cast_event_all.spellId); + break; + } + case ACTION_T_REMOVEAURASFROMSPELL: + if (Unit* target = GetTargetByType(action.remove_aura.target, pActionInvoker)) + target->RemoveAurasDueToSpell(action.remove_aura.spellId); + break; + case ACTION_T_RANGED_MOVEMENT: + AttackDistance = (float)action.ranged_movement.distance; + AttackAngle = action.ranged_movement.angle/180.0f*M_PI; + + if (CombatMovementEnabled) + { + me->GetMotionMaster()->MoveChase(me->getVictim(), AttackDistance, AttackAngle); + } + break; + case ACTION_T_RANDOM_PHASE: + Phase = GetRandActionParam(rnd, action.random_phase.phase1, action.random_phase.phase2, action.random_phase.phase3); + break; + case ACTION_T_RANDOM_PHASE_RANGE: + if (action.random_phase_range.phaseMin <= action.random_phase_range.phaseMax) + Phase = urand(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax); + else + sLog.outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", EventId, me->GetEntry()); + break; + case ACTION_T_SUMMON_ID: + { + Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker); + + CreatureEventAI_Summon_Map::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId); + if (i == CreatureEAI_Mgr.GetCreatureEventAISummonMap().end()) + { + sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, me->GetEntry()); + return; + } + + Creature* pCreature = NULL; + if ((*i).second.SpawnTimeSecs) + pCreature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs); + else + pCreature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + + if (!pCreature) + sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, me->GetEntry()); + else if (action.summon_id.target != TARGET_T_SELF && target) + pCreature->AI()->AttackStart(target); + + break; + } + case ACTION_T_KILLED_MONSTER: + //first attempt player who tapped creature + if (Player* pPlayer = me->GetLootRecipient()) + pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, me); + else + { + //if not available, use pActionInvoker + if (Unit* pTarget = GetTargetByType(action.killed_monster.target, pActionInvoker)) + if (Player* pPlayer2 = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, me); + } + break; + case ACTION_T_SET_INST_DATA: + { + InstanceData* pInst = (InstanceData*)me->GetInstanceData(); + if (!pInst) + { + sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", EventId, me->GetEntry()); + return; + } + + pInst->SetData(action.set_inst_data.field, action.set_inst_data.value); + break; + } + case ACTION_T_SET_INST_DATA64: + { + Unit* target = GetTargetByType(action.set_inst_data64.target, pActionInvoker); + if (!target) + { + sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, me->GetEntry()); + return; + } + + InstanceData* pInst = (InstanceData*)me->GetInstanceData(); + if (!pInst) + { + sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", EventId, me->GetEntry()); + return; + } + + pInst->SetData64(action.set_inst_data64.field, target->GetGUID()); + break; + } + case ACTION_T_UPDATE_TEMPLATE: + if (me->GetEntry() == action.update_template.creatureId) + { + + sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, me->GetEntry()); + return; + } + + me->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE); + break; + case ACTION_T_DIE: + if (me->isDead()) + { + + sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, me->GetEntry()); + return; + } + me->Kill(me); + break; + case ACTION_T_ZONE_COMBAT_PULSE: + { + me->SetInCombatWithZone(); + break; + } + case ACTION_T_CALL_FOR_HELP: + { + me->CallForHelp(action.call_for_help.radius); + break; + } + break; + + // TRINITY ONLY + case ACTION_T_MOVE_RANDOM_POINT: //dosen't work in combat + { + float x,y,z; + me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, action.raw.param1); + me->GetMotionMaster()->MovePoint(0,x,y,z); + break; + } + case ACTION_T_SET_STAND_STATE: + me->SetStandState(UnitStandStateType(action.raw.param1)); + break; + case ACTION_T_SET_PHASE_MASK: + me->SetPhaseMask(action.raw.param1, true); + break; + case ACTION_T_SET_VISIBILITY: + me->SetVisibility(UnitVisibility(action.raw.param1)); + break; + case ACTION_T_SET_ACTIVE: + me->setActive(action.raw.param1 ? true : false); + break; + case ACTION_T_SET_AGGRESSIVE: + me->SetReactState(ReactStates(action.raw.param1)); + break; + case ACTION_T_ATTACK_START_PULSE: + AttackStart(me->SelectNearestTarget((float)action.raw.param1)); + break; + case ACTION_T_SUMMON_GO: + { + GameObject* pObject = NULL; + + float x,y,z; + me->GetPosition(x,y,z); + pObject = me->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2); + if (!pObject) + { + sLog.outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, EventId, me->GetEntry()); + } + break; + } + + case ACTION_T_SET_SHEATH: + { + me->SetSheath(SheathState(action.set_sheath.sheath)); + break; + } + case ACTION_T_FORCE_DESPAWN: + { + me->ForcedDespawn(action.forced_despawn.msDelay); + break; + } + case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: + { + if (action.invincibility_hp_level.is_percent) + InvinceabilityHpLevel = me->GetMaxHealth()*action.invincibility_hp_level.hp_level/100; + else + InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; + break; + } + } +} + +void CreatureEventAI::JustRespawned() +{ + Reset(); + + if (bEmptyList) + return; + + //Handle Spawned Events + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + if (SpawnedEventConditionsCheck((*i).Event)) + ProcessEvent(*i); +} + +void CreatureEventAI::Reset() +{ + EventUpdateTime = EVENT_UPDATE_TIME; + EventDiff = 0; + + if (bEmptyList) + return; + + + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + if ((*i).Event.event_type == EVENT_T_RESET) + ProcessEvent(*i); + } + + + //Reset all events to enabled + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + CreatureEventAI_Event const& event = (*i).Event; + switch (event.event_type) + { + //Reset all out of combat timers + case EVENT_T_TIMER_OOC: + { + if ((*i).UpdateRepeatTimer(me,event.timer.initialMin,event.timer.initialMax)) + (*i).Enabled = true; + break; + } + //default: + //TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void EnterCombat() + //(*i).Enabled = true; + //(*i).Time = 0; + //break; + } + } +} + +void CreatureEventAI::JustReachedHome() +{ + me->LoadCreaturesAddon(); + + if (!bEmptyList) + { + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + if ((*i).Event.event_type == EVENT_T_REACHED_HOME) + ProcessEvent(*i); + } + } + + Reset(); +} + +void CreatureEventAI::EnterEvadeMode() +{ + CreatureAI::EnterEvadeMode(); + + if (bEmptyList) + return; + + //Handle Evade events + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + if ((*i).Event.event_type == EVENT_T_EVADE) + ProcessEvent(*i); + } +} + +void CreatureEventAI::JustDied(Unit* killer) +{ + Reset(); + + if (bEmptyList) + return; + + //Handle Evade events + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + if ((*i).Event.event_type == EVENT_T_DEATH) + ProcessEvent(*i, killer); + } + + // reset phase after any death state events + Phase = 0; +} + +void CreatureEventAI::KilledUnit(Unit* victim) +{ + if (bEmptyList || victim->GetTypeId() != TYPEID_PLAYER) + return; + + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + if ((*i).Event.event_type == EVENT_T_KILL) + ProcessEvent(*i, victim); + } +} + +void CreatureEventAI::JustSummoned(Creature* pUnit) +{ + if (bEmptyList || !pUnit) + return; + + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + if ((*i).Event.event_type == EVENT_T_SUMMONED_UNIT) + ProcessEvent(*i, pUnit); + } +} + +void CreatureEventAI::EnterCombat(Unit *enemy) +{ + //Check for on combat start events + if (!bEmptyList) + { + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + CreatureEventAI_Event const& event = (*i).Event; + switch (event.event_type) + { + case EVENT_T_AGGRO: + (*i).Enabled = true; + ProcessEvent(*i, enemy); + break; + //Reset all in combat timers + case EVENT_T_TIMER: + if ((*i).UpdateRepeatTimer(me,event.timer.initialMin,event.timer.initialMax)) + (*i).Enabled = true; + break; + //All normal events need to be re-enabled and their time set to 0 + default: + (*i).Enabled = true; + (*i).Time = 0; + break; + } + } + } + + EventUpdateTime = EVENT_UPDATE_TIME; + EventDiff = 0; +} + +void CreatureEventAI::AttackStart(Unit *who) +{ + if (!who) + return; + + if (me->Attack(who, MeleeEnabled)) + { + if (CombatMovementEnabled) + { + me->GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle); + } + else + { + me->GetMotionMaster()->MoveIdle(); + } + } +} + +void CreatureEventAI::MoveInLineOfSight(Unit *who) +{ + if (me->getVictim()) + return; + + //Check for OOC LOS Event + if (!bEmptyList) + { + for (std::list::iterator itr = CreatureEventAIList.begin(); itr != CreatureEventAIList.end(); ++itr) + { + if ((*itr).Event.event_type == EVENT_T_OOC_LOS) + { + //can trigger if closer than fMaxAllowedRange + float fMaxAllowedRange = (*itr).Event.ooc_los.maxRange; + + //if range is ok and we are actually in LOS + if (me->IsWithinDistInMap(who, fMaxAllowedRange) && me->IsWithinLOSInMap(who)) + { + //if friendly event&&who is not hostile OR hostile event&&who is hostile + if (((*itr).Event.ooc_los.noHostile && !me->IsHostileTo(who)) || + ((!(*itr).Event.ooc_los.noHostile) && me->IsHostileTo(who))) + ProcessEvent(*itr, who); + } + } + } + } + + CreatureAI::MoveInLineOfSight(who); +} + +void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell) +{ + + if (bEmptyList) + return; + + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + if ((*i).Event.event_type == EVENT_T_SPELLHIT) + //If spell id matches (or no spell id) & if spell school matches (or no spell school) + if (!(*i).Event.spell_hit.spellId || pSpell->Id == (*i).Event.spell_hit.spellId) + if (pSpell->SchoolMask & (*i).Event.spell_hit.schoolMask) + ProcessEvent(*i, pUnit); +} + +void CreatureEventAI::UpdateAI(const uint32 diff) +{ + //Check if we are in combat (also updates calls threat update code) + bool Combat = UpdateVictim(); + + if (!bEmptyList) + { + //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events + if (EventUpdateTime <= diff) + { + EventDiff += diff; + + //Check for time based events + for (std::list::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i) + { + //Decrement Timers + if ((*i).Time) + { + if (EventDiff <= (*i).Time) + { + //Do not decrement timers if event cannot trigger in this phase + if (!((*i).Event.event_inverse_phase_mask & (1 << Phase))) + (*i).Time -= EventDiff; + + //Skip processing of events that have time remaining + continue; + } + else (*i).Time = 0; + } + + //Events that are updated every EVENT_UPDATE_TIME + switch ((*i).Event.event_type) + { + case EVENT_T_TIMER_OOC: + ProcessEvent(*i); + break; + case EVENT_T_TIMER: + case EVENT_T_MANA: + case EVENT_T_HP: + case EVENT_T_TARGET_HP: + case EVENT_T_TARGET_CASTING: + case EVENT_T_FRIENDLY_HP: + if (me->getVictim()) + ProcessEvent(*i); + break; + case EVENT_T_RANGE: + if (me->getVictim()) + if (me->IsInMap(me->getVictim())) + if (me->IsInRange(me->getVictim(),(float)(*i).Event.range.minDist,(float)(*i).Event.range.maxDist)) + ProcessEvent(*i); + break; + } + } + + EventDiff = 0; + EventUpdateTime = EVENT_UPDATE_TIME; + } + else + { + EventDiff += diff; + EventUpdateTime -= diff; + } + } + + //Melee Auto-Attack + if (Combat && MeleeEnabled) + DoMeleeAttackIfReady(); +} + +inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3) +{ + switch (rnd % 3) + { + case 0: return param1; + case 1: return param2; + case 2: return param3; + } + return 0; +} + +inline int32 CreatureEventAI::GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3) +{ + switch (rnd % 3) + { + case 0: return param1; + case 1: return param2; + case 2: return param3; + } + return 0; +} + +inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoker) +{ + switch (Target) + { + case TARGET_T_SELF: + return me; + case TARGET_T_HOSTILE: + return me->getVictim(); + case TARGET_T_HOSTILE_SECOND_AGGRO: + return SelectTarget(SELECT_TARGET_TOPAGGRO,1); + case TARGET_T_HOSTILE_LAST_AGGRO: + return SelectTarget(SELECT_TARGET_BOTTOMAGGRO,0); + case TARGET_T_HOSTILE_RANDOM: + return SelectTarget(SELECT_TARGET_RANDOM,0); + case TARGET_T_HOSTILE_RANDOM_NOT_TOP: + return SelectTarget(SELECT_TARGET_RANDOM,1); + case TARGET_T_ACTION_INVOKER: + return pActionInvoker; + default: + return NULL; + }; +} + +Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff) +{ + CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Unit* pUnit = NULL; + + Trinity::MostHPMissingInRange u_check(me, range, MinHPDiff); + Trinity::UnitLastSearcher searcher(me, pUnit, u_check); + + /* + typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes; + This means that if we only search grid then we cannot possibly return pets or players so this is safe + */ + TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); + + cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, range); + return pUnit; +} + +void CreatureEventAI::DoFindFriendlyCC(std::list& _list, float range) +{ + CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::FriendlyCCedInRange u_check(me, range); + Trinity::CreatureListSearcher searcher(me, _list, u_check); + + TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); + + cell.Visit(p, grid_creature_searcher, *me->GetMap()); +} + +void CreatureEventAI::DoFindFriendlyMissingBuff(std::list& _list, float range, uint32 spellid) +{ + CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::FriendlyMissingBuffInRange u_check(me, range, spellid); + Trinity::CreatureListSearcher searcher(me, _list, u_check); + + TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); + + cell.Visit(p, grid_creature_searcher, *me->GetMap()); +} + +//********************************* +//*** Functions used globally *** + +void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) +{ + if (!pSource) + { + sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i, invalid Source pointer.",textEntry); + return; + } + + if (textEntry >= 0) + { + sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); + return; + } + + CreatureEventAI_TextMap::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAITextMap().find(textEntry); + + if (i == CreatureEAI_Mgr.GetCreatureEventAITextMap().end()) + { + sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); + return; + } + + sLog.outDebug("CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote); + + if ((*i).second.SoundId) + { + if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) + pSource->PlayDirectSound((*i).second.SoundId); + else + sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId); + } + + if ((*i).second.Emote) + { + if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) + { + ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); + } + else + sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); + } + + switch((*i).second.Type) + { + case CHAT_TYPE_SAY: + pSource->MonsterSay(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); + break; + case CHAT_TYPE_YELL: + pSource->MonsterYell(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); + break; + case CHAT_TYPE_TEXT_EMOTE: + pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0); + break; + case CHAT_TYPE_BOSS_EMOTE: + pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0, true); + break; + case CHAT_TYPE_WHISPER: + { + if (target && target->GetTypeId() == TYPEID_PLAYER) + pSource->MonsterWhisper(textEntry, target->GetGUID()); + else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); + }break; + case CHAT_TYPE_BOSS_WHISPER: + { + if (target && target->GetTypeId() == TYPEID_PLAYER) + pSource->MonsterWhisper(textEntry, target->GetGUID(), true); + else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); + }break; + case CHAT_TYPE_ZONE_YELL: + pSource->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); + break; + } +} + +bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered) +{ + //No target so we can't cast + if (!Target || !Spell) + return false; + + //Silenced so we can't cast + if (!Triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) + return false; + + //Check for power + if (!Triggered && me->GetPower((Powers)Spell->powerType) < CalculatePowerCost(Spell, me, GetSpellSchoolMask(Spell))) + return false; + + SpellRangeEntry const *TempRange = NULL; + + TempRange = GetSpellRangeStore()->LookupEntry(Spell->rangeIndex); + + //Spell has invalid range store so we can't use it + if (!TempRange) + return false; + + //Unit is out of range of this spell + if (!me->IsInRange(Target,TempRange->minRangeHostile,TempRange->maxRangeHostile)) + return false; + + return true; +} + +void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote) +{ + if (bEmptyList) + return; + + for (std::list::iterator itr = CreatureEventAIList.begin(); itr != CreatureEventAIList.end(); ++itr) + { + if ((*itr).Event.event_type == EVENT_T_RECEIVE_EMOTE) + { + if ((*itr).Event.receive_emote.emoteId != text_emote) + return; + + Condition cond; + cond.mConditionType = ConditionType((*itr).Event.receive_emote.condition); + cond.mConditionValue1 = (*itr).Event.receive_emote.conditionValue1; + cond.mConditionValue2 = (*itr).Event.receive_emote.conditionValue2; + + if (cond.Meets(pPlayer)) + { + sLog.outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing"); + ProcessEvent(*itr, pPlayer); + } + } + } +} + +void CreatureEventAI::DamageTaken(Unit* /*done_by*/, uint32& damage) +{ + if (InvinceabilityHpLevel > 0 && me->GetHealth() < InvinceabilityHpLevel+damage) + { + if (me->GetHealth() <= InvinceabilityHpLevel) + damage = 0; + else + damage = me->GetHealth() - InvinceabilityHpLevel; + } +} + +bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event) +{ + if (event.event_type != EVENT_T_SPAWNED) + return false; + + switch (event.spawned.condition) + { + case SPAWNED_EVENT_ALWAY: + // always + return true; + case SPAWNED_EVENT_MAP: + // map ID check + return me->GetMapId() == event.spawned.conditionValue1; + case SPAWNED_EVENT_ZONE: + { + // zone ID check + uint32 zone, area; + me->GetZoneAndAreaId(zone,area); + return zone == event.spawned.conditionValue1 || area == event.spawned.conditionValue1; + } + default: + break; + } + + return false; +} diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h new file mode 100644 index 0000000..1400d66 --- /dev/null +++ b/src/server/game/AI/EventAI/CreatureEventAI.h @@ -0,0 +1,627 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_CREATURE_EAI_H +#define TRINITY_CREATURE_EAI_H + +#include "Common.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "Unit.h" + +class Player; +class WorldObject; + +#define EVENT_UPDATE_TIME 500 +#define MAX_ACTIONS 3 +#define MAX_PHASE 32 + +enum EventAI_Type +{ + EVENT_T_TIMER = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax + EVENT_T_TIMER_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax + EVENT_T_HP = 2, // HPMax%, HPMin%, RepeatMin, RepeatMax + EVENT_T_MANA = 3, // ManaMax%,ManaMin% RepeatMin, RepeatMax + EVENT_T_AGGRO = 4, // NONE + EVENT_T_KILL = 5, // RepeatMin, RepeatMax + EVENT_T_DEATH = 6, // NONE + EVENT_T_EVADE = 7, // NONE + EVENT_T_SPELLHIT = 8, // SpellID, School, RepeatMin, RepeatMax + EVENT_T_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax + EVENT_T_OOC_LOS = 10, // NoHostile, MaxRnage, RepeatMin, RepeatMax + EVENT_T_SPAWNED = 11, // Condition, CondValue1 + EVENT_T_TARGET_HP = 12, // HPMax%, HPMin%, RepeatMin, RepeatMax + EVENT_T_TARGET_CASTING = 13, // RepeatMin, RepeatMax + EVENT_T_FRIENDLY_HP = 14, // HPDeficit, Radius, RepeatMin, RepeatMax + EVENT_T_FRIENDLY_IS_CC = 15, // DispelType, Radius, RepeatMin, RepeatMax + EVENT_T_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax + EVENT_T_SUMMONED_UNIT = 17, // CreatureId, RepeatMin, RepeatMax + EVENT_T_TARGET_MANA = 18, // ManaMax%, ManaMin%, RepeatMin, RepeatMax + EVENT_T_QUEST_ACCEPT = 19, // QuestID + EVENT_T_QUEST_COMPLETE = 20, // + EVENT_T_REACHED_HOME = 21, // NONE + EVENT_T_RECEIVE_EMOTE = 22, // EmoteId, Condition, CondValue1, CondValue2 + EVENT_T_BUFFED = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max + EVENT_T_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max + EVENT_T_RESET = 35, // Is it called after combat, when the creature respawn and spawn. -- TRINITY ONLY + + EVENT_T_END, +}; + +enum EventAI_ActionType +{ + ACTION_T_NONE = 0, // No action + ACTION_T_TEXT = 1, // TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values. + ACTION_T_SET_FACTION = 2, // FactionId (or 0 for default) + ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph) + ACTION_T_SOUND = 4, // SoundId + ACTION_T_EMOTE = 5, // EmoteId + ACTION_T_RANDOM_SAY = 6, // UNUSED + ACTION_T_RANDOM_YELL = 7, // UNUSED + ACTION_T_RANDOM_TEXTEMOTE = 8, // UNUSED + ACTION_T_RANDOM_SOUND = 9, // SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field) + ACTION_T_RANDOM_EMOTE = 10, // EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field) + ACTION_T_CAST = 11, // SpellId, Target, CastFlags + ACTION_T_SUMMON = 12, // CreatureID, Target, Duration in ms + ACTION_T_THREAT_SINGLE_PCT = 13, // Threat%, Target + ACTION_T_THREAT_ALL_PCT = 14, // Threat% + ACTION_T_QUEST_EVENT = 15, // QuestID, Target + ACTION_T_CAST_EVENT = 16, // QuestID, SpellId, Target - must be removed as hack? + ACTION_T_SET_UNIT_FIELD = 17, // Field_Number, Value, Target + ACTION_T_SET_UNIT_FLAG = 18, // Flags (may be more than one field OR'd together), Target + ACTION_T_REMOVE_UNIT_FLAG = 19, // Flags (may be more than one field OR'd together), Target + ACTION_T_AUTO_ATTACK = 20, // AllowAttackState (0 = stop attack, anything else means continue attacking) + ACTION_T_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking) + ACTION_T_SET_PHASE = 22, // Phase + ACTION_T_INC_PHASE = 23, // Value (may be negative to decrement phase, should not be 0) + ACTION_T_EVADE = 24, // No Params + ACTION_T_FLEE_FOR_ASSIST = 25, // No Params + ACTION_T_QUEST_EVENT_ALL = 26, // QuestID + ACTION_T_CAST_EVENT_ALL = 27, // CreatureId, SpellId + ACTION_T_REMOVEAURASFROMSPELL = 28, // Target, Spellid + ACTION_T_RANGED_MOVEMENT = 29, // Distance, Angle + ACTION_T_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3 + ACTION_T_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax + ACTION_T_SUMMON_ID = 32, // CreatureId, Target, SpawnId + ACTION_T_KILLED_MONSTER = 33, // CreatureId, Target + ACTION_T_SET_INST_DATA = 34, // Field, Data + ACTION_T_SET_INST_DATA64 = 35, // Field, Target + ACTION_T_UPDATE_TEMPLATE = 36, // Entry, Team + ACTION_T_DIE = 37, // No Params + ACTION_T_ZONE_COMBAT_PULSE = 38, // No Params + ACTION_T_CALL_FOR_HELP = 39, // Radius + ACTION_T_SET_SHEATH = 40, // Sheath (0-passive,1-melee,2-ranged) + ACTION_T_FORCE_DESPAWN = 41, // No Params + ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue, format(0-flat,1-percent from max health) + + ACTION_T_SET_PHASE_MASK = 97, + ACTION_T_SET_STAND_STATE = 98, + ACTION_T_MOVE_RANDOM_POINT = 99, + ACTION_T_SET_VISIBILITY = 100, + ACTION_T_SET_ACTIVE = 101, //Apply + ACTION_T_SET_AGGRESSIVE = 102, //Apply + ACTION_T_ATTACK_START_PULSE = 103, //Distance + ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms + + ACTION_T_END = 105, +}; + +enum Target +{ + //Self (me) + TARGET_T_SELF = 0, //Self cast + + //Hostile targets (if pet then returns pet owner) + TARGET_T_HOSTILE, //Our current target (ie: highest aggro) + TARGET_T_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) + TARGET_T_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) + TARGET_T_HOSTILE_RANDOM, //Just any random target on our threat list + TARGET_T_HOSTILE_RANDOM_NOT_TOP, //Any random target except top threat + + //Invoker targets (if pet then returns pet owner) + TARGET_T_ACTION_INVOKER, //Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF) + + //Hostile targets (including pets) + TARGET_T_HOSTILE_WPET, //Current target (can be a pet) + TARGET_T_HOSTILE_WPET_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) + TARGET_T_HOSTILE_WPET_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) + TARGET_T_HOSTILE_WPET_RANDOM, //Just any random target on our threat list + TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, //Any random target except top threat + + TARGET_T_ACTION_INVOKER_WPET, + + TARGET_T_END +}; + +enum EventFlags +{ + EFLAG_REPEATABLE = 0x01, //Event repeats + EFLAG_DIFFICULTY_0 = 0x02, //Event only occurs in instance difficulty 0 + EFLAG_DIFFICULTY_1 = 0x04, //Event only occurs in instance difficulty 1 + EFLAG_DIFFICULTY_2 = 0x08, //Event only occurs in instance difficulty 2 + EFLAG_DIFFICULTY_3 = 0x10, //Event only occurs in instance difficulty 3 + EFLAG_RESERVED_5 = 0x20, + EFLAG_RESERVED_6 = 0x40, + EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build + + EFLAG_DIFFICULTY_ALL = (EFLAG_DIFFICULTY_0|EFLAG_DIFFICULTY_1|EFLAG_DIFFICULTY_2|EFLAG_DIFFICULTY_3) +}; + +enum SpawnedEventMode +{ + SPAWNED_EVENT_ALWAY = 0, + SPAWNED_EVENT_MAP = 1, + SPAWNED_EVENT_ZONE = 2 +}; + +// String text additional data, used in (CreatureEventAI) +struct StringTextData +{ + uint32 SoundId; + uint8 Type; + uint32 Language; + uint32 Emote; +}; +// Text Maps +typedef UNORDERED_MAP CreatureEventAI_TextMap; + +struct CreatureEventAI_Action +{ + EventAI_ActionType type: 16; + union + { + // ACTION_T_TEXT = 1 + struct + { + int32 TextId1; + int32 TextId2; + int32 TextId3; + } text; + // ACTION_T_SET_FACTION = 2 + struct + { + uint32 factionId; // faction or 0 for default) + } set_faction; + // ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3 + struct + { + uint32 creatureId; // set one from fields (or 0 for both to demorph) + uint32 modelId; + } morph; + // ACTION_T_SOUND = 4 + struct + { + uint32 soundId; + } sound; + // ACTION_T_EMOTE = 5 + struct + { + uint32 emoteId; + } emote; + // ACTION_T_RANDOM_SOUND = 9 + struct + { + int32 soundId1; // (-1 in any field means no output if randomed that field) + int32 soundId2; + int32 soundId3; + } random_sound; + // ACTION_T_RANDOM_EMOTE = 10 + struct + { + int32 emoteId1; // (-1 in any field means no output if randomed that field) + int32 emoteId2; + int32 emoteId3; + } random_emote; + // ACTION_T_CAST = 11 + struct + { + uint32 spellId; + uint32 target; + uint32 castFlags; + } cast; + // ACTION_T_SUMMON = 12 + struct + { + uint32 creatureId; + uint32 target; + uint32 duration; + } summon; + // ACTION_T_THREAT_SINGLE_PCT = 13 + struct + { + int32 percent; + uint32 target; + } threat_single_pct; + // ACTION_T_THREAT_ALL_PCT = 14 + struct + { + int32 percent; + } threat_all_pct; + // ACTION_T_QUEST_EVENT = 15 + struct + { + uint32 questId; + uint32 target; + } quest_event; + // ACTION_T_CAST_EVENT = 16 + struct + { + uint32 creatureId; + uint32 spellId; + uint32 target; + } cast_event; + // ACTION_T_SET_UNIT_FIELD = 17 + struct + { + uint32 field; + uint32 value; + uint32 target; + } set_unit_field; + // ACTION_T_SET_UNIT_FLAG = 18, // value provided mask bits that will be set + // ACTION_T_REMOVE_UNIT_FLAG = 19, // value provided mask bits that will be clear + struct + { + uint32 value; + uint32 target; + } unit_flag; + // ACTION_T_AUTO_ATTACK = 20 + struct + { + uint32 state; // 0 = stop attack, anything else means continue attacking + } auto_attack; + // ACTION_T_COMBAT_MOVEMENT = 21 + struct + { + uint32 state; // 0 = stop combat based movement, anything else continue attacking + uint32 melee; // if set: at stop send melee combat stop if in combat, use for terminate melee fighting state for switch to ranged + } combat_movement; + // ACTION_T_SET_PHASE = 22 + struct + { + uint32 phase; + } set_phase; + // ACTION_T_INC_PHASE = 23 + struct + { + int32 step; + } set_inc_phase; + // ACTION_T_QUEST_EVENT_ALL = 26 + struct + { + uint32 questId; + } quest_event_all; + // ACTION_T_CAST_EVENT_ALL = 27 + struct + { + uint32 creatureId; + uint32 spellId; + } cast_event_all; + // ACTION_T_REMOVEAURASFROMSPELL = 28 + struct + { + uint32 target; + uint32 spellId; + } remove_aura; + // ACTION_T_RANGED_MOVEMENT = 29 + struct + { + uint32 distance; + int32 angle; + } ranged_movement; + // ACTION_T_RANDOM_PHASE = 30 + struct + { + uint32 phase1; + uint32 phase2; + uint32 phase3; + } random_phase; + // ACTION_T_RANDOM_PHASE_RANGE = 31 + struct + { + uint32 phaseMin; + uint32 phaseMax; + } random_phase_range; + // ACTION_T_SUMMON_ID = 32 + struct + { + uint32 creatureId; + uint32 target; + uint32 spawnId; + } summon_id; + // ACTION_T_KILLED_MONSTER = 33 + struct + { + uint32 creatureId; + uint32 target; + } killed_monster; + // ACTION_T_SET_INST_DATA = 34 + struct + { + uint32 field; + uint32 value; + } set_inst_data; + // ACTION_T_SET_INST_DATA64 = 35 + struct + { + uint32 field; + uint32 target; + } set_inst_data64; + // ACTION_T_UPDATE_TEMPLATE = 36 + struct + { + uint32 creatureId; + uint32 team; + } update_template; + // ACTION_T_CALL_FOR_HELP = 39 + struct + { + uint32 radius; + } call_for_help; + // ACTION_T_SET_SHEATH = 40 + struct + { + uint32 sheath; + } set_sheath; + // ACTION_T_FORCE_DESPAWN = 41 + struct + { + uint32 msDelay; + } forced_despawn; + // ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42 + struct + { + uint32 hp_level; + uint32 is_percent; + } invincibility_hp_level; + // RAW + struct + { + uint32 param1; + uint32 param2; + uint32 param3; + } raw; + }; +}; + +struct CreatureEventAI_Event +{ + uint32 event_id; + + uint32 creature_id; + + uint32 event_inverse_phase_mask; + + EventAI_Type event_type : 16; + uint8 event_chance : 8; + uint8 event_flags : 8; + + union + { + // EVENT_T_TIMER = 0 + // EVENT_T_TIMER_OOC = 1 + struct + { + uint32 initialMin; + uint32 initialMax; + uint32 repeatMin; + uint32 repeatMax; + } timer; + // EVENT_T_HP = 2 + // EVENT_T_MANA = 3 + // EVENT_T_TARGET_HP = 12 + // EVENT_T_TARGET_MANA = 18 + struct + { + uint32 percentMax; + uint32 percentMin; + uint32 repeatMin; + uint32 repeatMax; + } percent_range; + // EVENT_T_KILL = 5 + struct + { + uint32 repeatMin; + uint32 repeatMax; + } kill; + // EVENT_T_SPELLHIT = 8 + struct + { + uint32 spellId; + uint32 schoolMask; // -1 ( == 0xffffffff) is ok value for full mask, or must be more limited mask like (0 < 1) = 1 for normal/physical school + uint32 repeatMin; + uint32 repeatMax; + } spell_hit; + // EVENT_T_RANGE = 9 + struct + { + uint32 minDist; + uint32 maxDist; + uint32 repeatMin; + uint32 repeatMax; + } range; + // EVENT_T_OOC_LOS = 10 + struct + { + uint32 noHostile; + uint32 maxRange; + uint32 repeatMin; + uint32 repeatMax; + } ooc_los; + // EVENT_T_SPAWNED = 11 + struct + { + uint32 condition; + uint32 conditionValue1; + } spawned; + // EVENT_T_TARGET_CASTING = 13 + struct + { + uint32 repeatMin; + uint32 repeatMax; + } target_casting; + // EVENT_T_FRIENDLY_HP = 14 + struct + { + uint32 hpDeficit; + uint32 radius; + uint32 repeatMin; + uint32 repeatMax; + } friendly_hp; + // EVENT_T_FRIENDLY_IS_CC = 15 + struct + { + uint32 dispelType; // unused ? + uint32 radius; + uint32 repeatMin; + uint32 repeatMax; + } friendly_is_cc; + // EVENT_T_FRIENDLY_MISSING_BUFF = 16 + struct + { + uint32 spellId; + uint32 radius; + uint32 repeatMin; + uint32 repeatMax; + } friendly_buff; + // EVENT_T_SUMMONED_UNIT = 17 + struct + { + uint32 creatureId; + uint32 repeatMin; + uint32 repeatMax; + } summon_unit; + // EVENT_T_QUEST_ACCEPT = 19 + // EVENT_T_QUEST_COMPLETE = 20 + struct + { + uint32 questId; + } quest; + // EVENT_T_RECEIVE_EMOTE = 22 + struct + { + uint32 emoteId; + uint32 condition; + uint32 conditionValue1; + uint32 conditionValue2; + } receive_emote; + // EVENT_T_BUFFED = 23 + // EVENT_T_TARGET_BUFFED = 24 + struct + { + uint32 spellId; + uint32 amount; + uint32 repeatMin; + uint32 repeatMax; + } buffed; + + // RAW + struct + { + uint32 param1; + uint32 param2; + uint32 param3; + uint32 param4; + } raw; + }; + + CreatureEventAI_Action action[MAX_ACTIONS]; +}; +//Event_Map +typedef UNORDERED_MAP > CreatureEventAI_Event_Map; + +struct CreatureEventAI_Summon +{ + uint32 id; + + float position_x; + float position_y; + float position_z; + float orientation; + uint32 SpawnTimeSecs; +}; + +//EventSummon_Map +typedef UNORDERED_MAP CreatureEventAI_Summon_Map; + +struct CreatureEventAIHolder +{ + CreatureEventAIHolder(CreatureEventAI_Event p) : Event(p), Time(0), Enabled(true){} + + CreatureEventAI_Event Event; + uint32 Time; + bool Enabled; + + // helper + bool UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax); +}; + +class CreatureEventAI : public CreatureAI +{ + + public: + explicit CreatureEventAI(Creature *c); + ~CreatureEventAI() + { + CreatureEventAIList.clear(); + } + void JustRespawned(); + void Reset(); + void JustReachedHome(); + void EnterCombat(Unit *enemy); + void EnterEvadeMode(); + void JustDied(Unit* /*killer*/); + void KilledUnit(Unit* victim); + void JustSummoned(Creature* pUnit); + void AttackStart(Unit *who); + void MoveInLineOfSight(Unit *who); + void SpellHit(Unit* pUnit, const SpellEntry* pSpell); + void DamageTaken(Unit* done_by, uint32& damage); + void UpdateAI(const uint32 diff); + void ReceiveEmote(Player* pPlayer, uint32 text_emote); + static int Permissible(const Creature *); + + bool ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker = NULL); + void ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker); + inline uint32 GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3); + inline int32 GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3); + inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker); + + void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target); + bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered); + + bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event); + + Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff); + void DoFindFriendlyMissingBuff(std::list& _list, float range, uint32 spellid); + void DoFindFriendlyCC(std::list& _list, float range); + + //Holder for events (stores enabled, time, and eventid) + std::list CreatureEventAIList; + uint32 EventUpdateTime; //Time between event updates + uint32 EventDiff; //Time between the last event call + bool bEmptyList; + + //Variables used by Events themselves + uint8 Phase; // Current phase, max 32 phases + bool CombatMovementEnabled; // If we allow targeted movment gen (movement twoards top threat) + bool MeleeEnabled; // If we allow melee auto attack + float AttackDistance; // Distance to attack from + float AttackAngle; // Angle of attack + uint32 InvinceabilityHpLevel; // Minimal health level allowed at damage apply +}; +#endif diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp new file mode 100644 index 0000000..9f41050 --- /dev/null +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -0,0 +1,742 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "DatabaseEnv.h" +#include "SQLStorage.h" +#include "CreatureEventAI.h" +#include "CreatureEventAIMgr.h" +#include "ObjectMgr.h" +#include "ProgressBar.h" +#include "ObjectDefines.h" +#include "GridDefines.h" +#include "ConditionMgr.h" + +// ------------------- +void CreatureEventAIMgr::LoadCreatureEventAI_Texts() +{ + // Drop Existing Text Map, only done once and we are ready to add data from multiple sources. + m_CreatureEventAI_TextMap.clear(); + + // Load EventAI Text + objmgr.LoadTrinityStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID); + + // Gather Additional data from EventAI Texts + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts"); + + sLog.outString("Loading EventAI Texts additional data..."); + if (result) + { + barGoLink bar(result->GetRowCount()); + uint32 count = 0; + + do + { + bar.step(); + Field* fields = result->Fetch(); + StringTextData temp; + + int32 i = fields[0].GetInt32(); + temp.SoundId = fields[1].GetInt32(); + temp.Type = fields[2].GetInt32(); + temp.Language = fields[3].GetInt32(); + temp.Emote = fields[4].GetInt32(); + + // range negative + if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID) + { + sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)",i,MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID); + continue; + } + + // range negative (don't must be happen, loaded from same table) + if (!objmgr.GetTrinityStringLocale(i)) + { + sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found",i); + continue; + } + + if (temp.SoundId) + { + if (!sSoundEntriesStore.LookupEntry(temp.SoundId)) + sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.",i,temp.SoundId); + } + + if (!GetLanguageDescByID(temp.Language)) + sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language); + + if (temp.Type > CHAT_TYPE_ZONE_YELL) + sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type); + + if (temp.Emote) + { + if (!sEmotesStore.LookupEntry(temp.Emote)) + sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.",i,temp.Emote); + } + + m_CreatureEventAI_TextMap[i] = temp; + ++count; + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count); + } + else + { + barGoLink bar(1); + bar.step(); + sLog.outString(); + sLog.outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); + } + +} + +// ------------------- +void CreatureEventAIMgr::LoadCreatureEventAI_Summons() +{ + + //Drop Existing EventSummon Map + m_CreatureEventAI_Summon_Map.clear(); + + // Gather additional data for EventAI + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons"); + if (result) + { + barGoLink bar(result->GetRowCount()); + uint32 Count = 0; + + do + { + bar.step(); + Field *fields = result->Fetch(); + + CreatureEventAI_Summon temp; + + uint32 i = fields[0].GetUInt32(); + temp.position_x = fields[1].GetFloat(); + temp.position_y = fields[2].GetFloat(); + temp.position_z = fields[3].GetFloat(); + temp.orientation = fields[4].GetFloat(); + temp.SpawnTimeSecs = fields[5].GetUInt32(); + + if (!Trinity::IsValidMapCoord(temp.position_x,temp.position_y,temp.position_z,temp.orientation)) + { + sLog.outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f,%f,%f,%f), skipping.", i,temp.position_x,temp.position_y,temp.position_z,temp.orientation); + continue; + } + + //Add to map + m_CreatureEventAI_Summon_Map[i] = temp; + ++Count; + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count); + } + else + { + barGoLink bar(1); + bar.step(); + sLog.outString(); + sLog.outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty."); + } + +} + +// ------------------- +void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() +{ + //Drop Existing EventAI List + m_CreatureEventAI_Event_Map.clear(); + + // Gather event data + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, " + "event_param1, event_param2, event_param3, event_param4, " + "action1_type, action1_param1, action1_param2, action1_param3, " + "action2_type, action2_param1, action2_param2, action2_param3, " + "action3_type, action3_param1, action3_param2, action3_param3 " + "FROM creature_ai_scripts"); + if (result) + { + barGoLink bar(result->GetRowCount()); + uint32 Count = 0; + + do + { + bar.step(); + Field *fields = result->Fetch(); + + CreatureEventAI_Event temp; + temp.event_id = EventAI_Type(fields[0].GetUInt32()); + uint32 i = temp.event_id; + + temp.creature_id = fields[1].GetUInt32(); + uint32 creature_id = temp.creature_id; + + uint32 e_type = fields[2].GetUInt32(); + //Report any errors in event + if (e_type >= EVENT_T_END) + { + sLog.outErrorDb("CreatureEventAI: Event %u have wrong type (%u), skipping.", i,e_type); + continue; + } + temp.event_type = EventAI_Type(e_type); + + temp.event_inverse_phase_mask = fields[3].GetUInt32(); + temp.event_chance = fields[4].GetUInt8(); + temp.event_flags = fields[5].GetUInt8(); + temp.raw.param1 = fields[6].GetUInt32(); + temp.raw.param2 = fields[7].GetUInt32(); + temp.raw.param3 = fields[8].GetUInt32(); + temp.raw.param4 = fields[9].GetUInt32(); + + //Creature does not exist in database + if (!sCreatureStorage.LookupEntry(temp.creature_id)) + { + sLog.outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, temp.creature_id); + continue; + } + + //No chance of this event occuring + if (temp.event_chance == 0) + sLog.outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i); + //Chance above 100, force it to be 100 + else if (temp.event_chance > 100) + { + sLog.outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); + temp.event_chance = 100; + } + + //Individual event checks + switch (temp.event_type) + { + case EVENT_T_TIMER: + case EVENT_T_TIMER_OOC: + if (temp.timer.initialMax < temp.timer.initialMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); + if (temp.timer.repeatMax < temp.timer.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_HP: + case EVENT_T_MANA: + case EVENT_T_TARGET_HP: + case EVENT_T_TARGET_MANA: + if (temp.percent_range.percentMax > 100) + sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); + + if (temp.percent_range.percentMax <= temp.percent_range.percentMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); + + if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax) + { + sLog.outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); + temp.event_flags &= ~EFLAG_REPEATABLE; + } + break; + case EVENT_T_SPELLHIT: + if (temp.spell_hit.spellId) + { + SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId); + if (!pSpell) + { + sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); + continue; + } + + if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask) + sLog.outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i); + } + + if (!temp.spell_hit.schoolMask) + sLog.outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); + + if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_RANGE: + if (temp.range.maxDist < temp.range.minDist) + sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i); + if (temp.range.repeatMax < temp.range.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_OOC_LOS: + if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_SPAWNED: + switch(temp.spawned.condition) + { + case SPAWNED_EVENT_ALWAY: + break; + case SPAWNED_EVENT_MAP: + if (!sMapStore.LookupEntry(temp.spawned.conditionValue1)) + sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); + break; + case SPAWNED_EVENT_ZONE: + if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1)) + sLog.outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); + default: + sLog.outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition); + break; + } + break; + case EVENT_T_FRIENDLY_HP: + if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_FRIENDLY_IS_CC: + if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_FRIENDLY_MISSING_BUFF: + { + SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId); + if (!pSpell) + { + sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); + continue; + } + if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + } + case EVENT_T_KILL: + if (temp.kill.repeatMax < temp.kill.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_TARGET_CASTING: + if (temp.target_casting.repeatMax < temp.target_casting.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_SUMMONED_UNIT: + if (!sCreatureStorage.LookupEntry(temp.summon_unit.creatureId)) + sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId); + if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + case EVENT_T_QUEST_ACCEPT: + case EVENT_T_QUEST_COMPLETE: + if (!objmgr.GetQuestTemplate(temp.quest.questId)) + sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); + sLog.outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i); + continue; + + case EVENT_T_AGGRO: + case EVENT_T_DEATH: + case EVENT_T_EVADE: + case EVENT_T_REACHED_HOME: + { + if (temp.event_flags & EFLAG_REPEATABLE) + { + sLog.outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); + temp.event_flags &= ~EFLAG_REPEATABLE; + } + + break; + } + + case EVENT_T_RECEIVE_EMOTE: + { + if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId)) + { + sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.",temp.creature_id, i, temp.receive_emote.emoteId); + continue; + } + if (temp.receive_emote.condition) + { + Condition cond; + cond.mConditionType = ConditionType(temp.receive_emote.condition); + cond.mConditionValue1 = temp.receive_emote.conditionValue1; + cond.mConditionValue2 = temp.receive_emote.conditionValue2; + if (!sConditionMgr.isConditionTypeValid(&cond)) + { + sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition); + continue; + } + } + + if (!(temp.event_flags & EFLAG_REPEATABLE)) + { + sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i); + temp.event_flags |= EFLAG_REPEATABLE; + } + + break; + } + + case EVENT_T_BUFFED: + case EVENT_T_TARGET_BUFFED: + { + SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId); + if (!pSpell) + { + sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); + continue; + } + if (temp.buffed.repeatMax < temp.buffed.repeatMin) + sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); + break; + } + + default: + sLog.outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i); + break; + } + + for (uint32 j = 0; j < MAX_ACTIONS; j++) + { + uint16 action_type = fields[10+(j*4)].GetUInt16(); + if (action_type >= ACTION_T_END) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type); + temp.action[j].type = ACTION_T_NONE; + continue; + } + + CreatureEventAI_Action& action = temp.action[j]; + + action.type = EventAI_ActionType(action_type); + action.raw.param1 = fields[11+(j*4)].GetUInt32(); + action.raw.param2 = fields[12+(j*4)].GetUInt32(); + action.raw.param3 = fields[13+(j*4)].GetUInt32(); + + //Report any errors in actions + switch (action.type) + { + case ACTION_T_NONE: + break; + case ACTION_T_TEXT: + { + if (action.text.TextId1 < 0) + { + if (m_CreatureEventAI_TextMap.find(action.text.TextId1) == m_CreatureEventAI_TextMap.end()) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1); + } + if (action.text.TextId2 < 0) + { + if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end()) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1); + + if (!action.text.TextId1) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1); + } + if (action.text.TextId3 < 0) + { + if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end()) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1); + + if (!action.text.TextId1 || !action.text.TextId2) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1); + } + break; + } + case ACTION_T_SET_FACTION: + if (action.set_faction.factionId !=0 && !sFactionStore.LookupEntry(action.set_faction.factionId)) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId); + action.set_faction.factionId = 0; + } + break; + case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: + if (action.morph.creatureId !=0 || action.morph.modelId !=0) + { + if (action.morph.creatureId && !sCreatureStorage.LookupEntry(action.morph.creatureId)) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId); + action.morph.creatureId = 0; + } + + if (action.morph.modelId) + { + if (action.morph.creatureId) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId,action.morph.creatureId); + action.morph.modelId = 0; + } + else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId)) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId); + action.morph.modelId = 0; + } + } + } + break; + case ACTION_T_SOUND: + if (!sSoundEntriesStore.LookupEntry(action.sound.soundId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId); + break; + case ACTION_T_EMOTE: + if (!sEmotesStore.LookupEntry(action.emote.emoteId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId); + break; + case ACTION_T_RANDOM_SOUND: + if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1); + if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2); + if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3); + break; + case ACTION_T_RANDOM_EMOTE: + if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1); + if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2); + if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3); + break; + case ACTION_T_CAST: + { + const SpellEntry *spell = sSpellStore.LookupEntry(action.cast.spellId); + if (!spell) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId); + /* FIXME: temp.raw.param3 not have event tipes with recovery time in it.... + else + { + if (spell->RecoveryTime > 0 && temp.event_flags & EFLAG_REPEATABLE) + { + //output as debug for now, also because there's no general rule all spells have RecoveryTime + if (temp.event_param3 < spell->RecoveryTime) + sLog.outDebug("CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1,action.cast.spellId, spell->RecoveryTime, temp.event_param3); + } + } + */ + + //Cast is always triggered if target is forced to cast on self + if (action.cast.castFlags & CAST_FORCE_TARGET_SELF) + action.cast.castFlags |= CAST_TRIGGERED; + + if (action.cast.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + } + case ACTION_T_SUMMON: + if (!sCreatureStorage.LookupEntry(action.summon.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId); + + if (action.summon.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_THREAT_SINGLE_PCT: + if (std::abs(action.threat_single_pct.percent) > 100) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent); + if (action.threat_single_pct.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_THREAT_ALL_PCT: + if (std::abs(action.threat_all_pct.percent) > 100) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent); + break; + case ACTION_T_QUEST_EVENT: + if (Quest const* qid = objmgr.GetQuestTemplate(action.quest_event.questId)) + { + if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId); + } + else + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId); + + if (action.quest_event.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + + break; + case ACTION_T_CAST_EVENT: + if (!sCreatureStorage.LookupEntry(action.cast_event.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId); + if (!sSpellStore.LookupEntry(action.cast_event.spellId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId); + if (action.cast_event.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_SET_UNIT_FIELD: + if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1); + if (action.set_unit_field.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_SET_UNIT_FLAG: + case ACTION_T_REMOVE_UNIT_FLAG: + if (action.unit_flag.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_SET_PHASE: + if (action.set_phase.phase >= MAX_PHASE) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + break; + case ACTION_T_INC_PHASE: + if (action.set_inc_phase.step == 0) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1); + else if (std::abs(action.set_inc_phase.step) > MAX_PHASE-1) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step); + break; + case ACTION_T_QUEST_EVENT_ALL: + if (Quest const* qid = objmgr.GetQuestTemplate(action.quest_event_all.questId)) + { + if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId); + } + else + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId); + break; + case ACTION_T_CAST_EVENT_ALL: + if (!sCreatureStorage.LookupEntry(action.cast_event_all.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId); + if (!sSpellStore.LookupEntry(action.cast_event_all.spellId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId); + break; + case ACTION_T_REMOVEAURASFROMSPELL: + if (!sSpellStore.LookupEntry(action.remove_aura.spellId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId); + if (action.remove_aura.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_RANDOM_PHASE: //PhaseId1, PhaseId2, PhaseId3 + if (action.random_phase.phase1 >= MAX_PHASE) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + if (action.random_phase.phase2 >= MAX_PHASE) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + if (action.random_phase.phase3 >= MAX_PHASE) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + break; + case ACTION_T_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax + if (action.random_phase_range.phaseMin >= MAX_PHASE) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + if (action.random_phase_range.phaseMin >= MAX_PHASE) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); + if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1); + std::swap(action.random_phase_range.phaseMin,action.random_phase_range.phaseMax); + // equal case processed at call + } + break; + case ACTION_T_SUMMON_ID: + if (!sCreatureStorage.LookupEntry(action.summon_id.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId); + if (action.summon_id.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end()) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId); + break; + case ACTION_T_KILLED_MONSTER: + if (!sCreatureStorage.LookupEntry(action.killed_monster.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId); + if (action.killed_monster.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_SET_INST_DATA: + if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); + if (action.set_inst_data.value > 4/*SPECIAL*/) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1); + break; + case ACTION_T_SET_INST_DATA64: + if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); + if (action.set_inst_data64.target >= TARGET_T_END) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); + break; + case ACTION_T_UPDATE_TEMPLATE: + if (!sCreatureStorage.LookupEntry(action.update_template.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId); + break; + case ACTION_T_SET_SHEATH: + if (action.set_sheath.sheath >= MAX_SHEATH_STATE) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath); + action.set_sheath.sheath = SHEATH_STATE_UNARMED; + } + break; + case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: + if (action.invincibility_hp_level.is_percent) + { + if (action.invincibility_hp_level.hp_level > 100) + { + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level); + action.invincibility_hp_level.hp_level = 100; + } + } + break; + case ACTION_T_EVADE: //No Params + case ACTION_T_FLEE_FOR_ASSIST: //No Params + case ACTION_T_DIE: //No Params + case ACTION_T_ZONE_COMBAT_PULSE: //No Params + case ACTION_T_FORCE_DESPAWN: //No Params + case ACTION_T_AUTO_ATTACK: //AllowAttackState (0 = stop attack, anything else means continue attacking) + case ACTION_T_COMBAT_MOVEMENT: //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking) + case ACTION_T_RANGED_MOVEMENT: //Distance, Angle + case ACTION_T_CALL_FOR_HELP: //Distance + break; + + case ACTION_T_RANDOM_SAY: + case ACTION_T_RANDOM_YELL: + case ACTION_T_RANDOM_TEXTEMOTE: + sLog.outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1); + break; + + case ACTION_T_MOVE_RANDOM_POINT: + case ACTION_T_SET_STAND_STATE: + case ACTION_T_SET_PHASE_MASK: + case ACTION_T_SET_VISIBILITY: + case ACTION_T_SET_ACTIVE: + case ACTION_T_SET_AGGRESSIVE: + case ACTION_T_ATTACK_START_PULSE: + case ACTION_T_SUMMON_GO: + break; + + default: + sLog.outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, temp.action[j].type); + break; + } + } + + //Add to list + m_CreatureEventAI_Event_Map[creature_id].push_back(temp); + ++Count; + + if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(temp.creature_id)) + { + if (!cInfo->AIName || !cInfo->AIName[0]) + { + //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but its AIName is empty. Set to EventAI as default.", cInfo->Entry); + size_t len = strlen("EventAI")+1; + const_cast(cInfo)->AIName = new char[len]; + strncpy(const_cast(cInfo->AIName), "EventAI", len); + } + if (strcmp(cInfo->AIName, "EventAI")) + { + //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it has AIName %s. EventAI script will be overriden.", cInfo->Entry, cInfo->AIName); + } + if (cInfo->ScriptID) + { + //sLog.outErrorDb("CreatureEventAI: Creature Entry %u has EventAI script but it also has C++ script. EventAI script will be overriden.", cInfo->Entry); + } + } + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u CreatureEventAI scripts", Count); + } + else + { + barGoLink bar(1); + bar.step(); + sLog.outString(); + sLog.outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); + } +} diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.h b/src/server/game/AI/EventAI/CreatureEventAIMgr.h new file mode 100644 index 0000000..3c8181e --- /dev/null +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_CREATURE_EAI_MGR_H +#define TRINITY_CREATURE_EAI_MGR_H + +#include "Common.h" +#include "CreatureEventAI.h" + +class CreatureEventAIMgr +{ + friend class ACE_Singleton; + CreatureEventAIMgr(){}; + public: + ~CreatureEventAIMgr(){}; + + void LoadCreatureEventAI_Texts(); + void LoadCreatureEventAI_Summons(); + void LoadCreatureEventAI_Scripts(); + + CreatureEventAI_Event_Map const& GetCreatureEventAIMap() const { return m_CreatureEventAI_Event_Map; } + CreatureEventAI_Summon_Map const& GetCreatureEventAISummonMap() const { return m_CreatureEventAI_Summon_Map; } + CreatureEventAI_TextMap const& GetCreatureEventAITextMap() const { return m_CreatureEventAI_TextMap; } + + private: + CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map; + CreatureEventAI_Summon_Map m_CreatureEventAI_Summon_Map; + CreatureEventAI_TextMap m_CreatureEventAI_TextMap; +}; + +#define CreatureEAI_Mgr (*ACE_Singleton::instance()) +#endif diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp new file mode 100644 index 0000000..9ab9e06 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -0,0 +1,740 @@ +/* Copyright (C) 2008-2010 Trinity + * + * Thanks to the original authors: ScriptDev2 + * + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#include "ScriptPCH.h" +#include "Item.h" +#include "Spell.h" +#include "ObjectMgr.h" +#include "TemporarySummon.h" + +// Spell summary for ScriptedAI::SelectSpell +struct TSpellSummary +{ + uint8 Targets; // set of enum SelectTarget + uint8 Effects; // set of enum SelectEffect +} *SpellSummary; + +void SummonList::DoZoneInCombat(uint32 entry) +{ + for (iterator i = begin(); i != end();) + { + Creature *summon = Unit::GetCreature(*me, *i); + ++i; + if (summon && summon->IsAIEnabled + && (!entry || summon->GetEntry() == entry)) + summon->AI()->DoZoneInCombat(); + } +} + +void SummonList::DoAction(uint32 entry, uint32 info) +{ + for (iterator i = begin(); i != end();) + { + Creature *summon = Unit::GetCreature(*me, *i); + ++i; + if (summon && summon->IsAIEnabled + && (!entry || summon->GetEntry() == entry)) + summon->AI()->DoAction(info); + } +} + +void SummonList::DespawnEntry(uint32 entry) +{ + for (iterator i = begin(); i != end();) + { + Creature *summon = Unit::GetCreature(*me, *i); + if (!summon) + erase(i++); + else if (summon->GetEntry() == entry) + { + erase(i++); + summon->setDeathState(JUST_DIED); + summon->RemoveCorpse(); + } + else + ++i; + } +} + +void SummonList::DespawnAll() +{ + while (!empty()) + { + Creature *summon = Unit::GetCreature(*me, *begin()); + if (!summon) + erase(begin()); + else + { + erase(begin()); + if (summon->isSummon()) + { + summon->DestroyForNearbyPlayers(); + CAST_SUM(summon)->UnSummon(); + } + else + summon->DisappearAndDie(); + } + } +} + +ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), + me(pCreature), + IsFleeing(false), + m_bCombatMovement(true), + m_uiEvadeCheckCooldown(2500) +{ + m_heroicMode = me->GetMap()->IsHeroic(); + m_difficulty = Difficulty(me->GetMap()->GetSpawnMode()); +} + +void ScriptedAI::AttackStartNoMove(Unit* pWho) +{ + if (!pWho) + return; + + if (me->Attack(pWho, false)) + DoStartNoMovement(pWho); +} + +void ScriptedAI::UpdateAI(const uint32 /*uiDiff*/) +{ + //Check if we have a current target + if (!UpdateVictim()) + return; + + if (me->isAttackReady()) + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + } +} + +void ScriptedAI::DoStartMovement(Unit* pVictim, float fDistance, float fAngle) +{ + if (pVictim) + me->GetMotionMaster()->MoveChase(pVictim, fDistance, fAngle); +} + +void ScriptedAI::DoStartNoMovement(Unit* pVictim) +{ + if (!pVictim) + return; + + me->GetMotionMaster()->MoveIdle(); +} + +void ScriptedAI::DoStopAttack() +{ + if (me->getVictim()) + me->AttackStop(); +} + +void ScriptedAI::DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered) +{ + if (!pTarget || me->IsNonMeleeSpellCasted(false)) + return; + + me->StopMoving(); + me->CastSpell(pTarget, pSpellInfo, bTriggered); +} + +void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId) +{ + if (!pSource) + return; + + if (!GetSoundEntriesStore()->LookupEntry(uiSoundId)) + { + sLog.outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUIDLow()); + return; + } + + pSource->PlayDirectSound(uiSoundId); +} + +Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime) +{ + return me->SummonCreature(uiId, me->GetPositionX()+fX, me->GetPositionY()+fY, me->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime); +} + +Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition) +{ + //ThreatList m_threatlist; + std::list& threatlist = me->getThreatManager().getThreatList(); + std::list::iterator itr = threatlist.begin(); + std::list::reverse_iterator ritr = threatlist.rbegin(); + + if (uiPosition >= threatlist.size() || !threatlist.size()) + return NULL; + + switch (pTarget) + { + case SELECT_TARGET_RANDOM: + advance (itr , uiPosition + (rand() % (threatlist.size() - uiPosition))); + return Unit::GetUnit((*me),(*itr)->getUnitGuid()); + break; + + case SELECT_TARGET_TOPAGGRO: + advance (itr , uiPosition); + return Unit::GetUnit((*me),(*itr)->getUnitGuid()); + break; + + case SELECT_TARGET_BOTTOMAGGRO: + advance (ritr , uiPosition); + return Unit::GetUnit((*me),(*ritr)->getUnitGuid()); + break; + + default: + return UnitAI::SelectTarget(pTarget, uiPosition); + } +} + +SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, uint32 uiSchool, uint32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects) +{ + //No target so we can't cast + if (!pTarget) + return false; + + //Silenced so we can't cast + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) + return false; + + //Using the extended script system we first create a list of viable spells + SpellEntry const* apSpell[CREATURE_MAX_SPELLS]; + memset(apSpell, 0, sizeof(SpellEntry*)*CREATURE_MAX_SPELLS); + + uint32 uiSpellCount = 0; + + SpellEntry const* pTempSpell; + SpellRangeEntry const* pTempRange; + + //Check if each spell is viable(set it to null if not) + for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++) + { + pTempSpell = GetSpellStore()->LookupEntry(me->m_spells[i]); + + //This spell doesn't exist + if (!pTempSpell) + continue; + + // Targets and Effects checked first as most used restrictions + //Check the spell targets if specified + if (selectTargets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (selectTargets-1)))) + continue; + + //Check the type of spell if we are looking for a specific spell type + if (selectEffects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (selectEffects-1)))) + continue; + + //Check for school if specified + if (uiSchool && (pTempSpell->SchoolMask & uiSchool) == 0) + continue; + + //Check for spell mechanic if specified + if (uiMechanic && pTempSpell->Mechanic != uiMechanic) + continue; + + //Make sure that the spell uses the requested amount of power + if (uiPowerCostMin && pTempSpell->manaCost < uiPowerCostMin) + continue; + + if (uiPowerCostMax && pTempSpell->manaCost > uiPowerCostMax) + continue; + + //Continue if we don't have the mana to actually cast this spell + if (pTempSpell->manaCost > me->GetPower((Powers)pTempSpell->powerType)) + continue; + + //Get the Range + pTempRange = GetSpellRangeStore()->LookupEntry(pTempSpell->rangeIndex); + + //Spell has invalid range store so we can't use it + if (!pTempRange) + continue; + + //Check if the spell meets our range requirements + if (fRangeMin && me->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin) + continue; + if (fRangeMax && me->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax) + continue; + + //Check if our target is in range + if (me->IsWithinDistInMap(pTarget, me->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !me->IsWithinDistInMap(pTarget, me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) + continue; + + //All good so lets add it to the spell list + apSpell[uiSpellCount] = pTempSpell; + ++uiSpellCount; + } + + //We got our usable spells so now lets randomly pick one + if (!uiSpellCount) + return NULL; + + return apSpell[rand()%uiSpellCount]; +} + +bool ScriptedAI::CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered) +{ + //No target so we can't cast + if (!pTarget || !pSpell) + return false; + + //Silenced so we can't cast + if (!bTriggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) + return false; + + //Check for power + if (!bTriggered && me->GetPower((Powers)pSpell->powerType) < pSpell->manaCost) + return false; + + SpellRangeEntry const* pTempRange = GetSpellRangeStore()->LookupEntry(pSpell->rangeIndex); + + //Spell has invalid range store so we can't use it + if (!pTempRange) + return false; + + //Unit is out of range of this spell + if (me->IsInRange(pTarget, me->GetSpellMinRangeForTarget(pTarget, pTempRange), me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) + return false; + + return true; +} + +void FillSpellSummary() +{ + SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()]; + + SpellEntry const* pTempSpell; + + for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) + { + SpellSummary[i].Effects = 0; + SpellSummary[i].Targets = 0; + + pTempSpell = GetSpellStore()->LookupEntry(i); + //This spell doesn't exist + if (!pTempSpell) + continue; + + for (uint32 j = 0; j < 3; ++j) + { + //Spell targets self + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER) + SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1); + + //Spell targets a single enemy + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY || + pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY) + SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1); + + //Spell targets AoE at enemy + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST || + pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || + pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY) + SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1); + + //Spell targets an enemy + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY || + pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST || + pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER || + pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY) + SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1); + + //Spell targets a single friend(or self) + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY) + SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1); + + //Spell targets aoe friends + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET || + pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER) + SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1); + + //Spell targets any friend(or self) + if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER || + pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_TARGET || + pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER) + SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1); + + //Make sure that this spell includes a damage effect + if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || + pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL || + pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE || + pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH) + SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1); + + //Make sure that this spell includes a healing effect (or an apply aura with a periodic heal) + if (pTempSpell->Effect[j] == SPELL_EFFECT_HEAL || + pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH || + pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL || + (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j] == 8)) + SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1); + + //Make sure that this spell applies an aura + if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA) + SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1); + } + } +} + +void ScriptedAI::DoResetThreat() +{ + if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty()) + { + sLog.outError("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry()); + return; + } + + std::list& threatlist = me->getThreatManager().getThreatList(); + + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + + if (pUnit && DoGetThreat(pUnit)) + DoModifyThreatPercent(pUnit, -100); + } +} + +float ScriptedAI::DoGetThreat(Unit* pUnit) +{ + if (!pUnit) return 0.0f; + return me->getThreatManager().getThreat(pUnit); +} + +void ScriptedAI::DoModifyThreatPercent(Unit* pUnit, int32 pct) +{ + if (!pUnit) return; + me->getThreatManager().modifyThreatPercent(pUnit, pct); +} + +void ScriptedAI::DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime) +{ + me->Relocate(fX, fY, fZ); + me->SendMonsterMove(fX, fY, fZ, uiTime); +} + +void ScriptedAI::DoTeleportTo(const float fPos[4]) +{ + me->NearTeleportTo(fPos[0], fPos[1], fPos[2], fPos[3]); +} + +void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO) +{ + if (!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER) + { + if (pUnit) + sLog.outError("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO); + return; + } + + CAST_PLR(pUnit)->TeleportTo(pUnit->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT); +} + +void ScriptedAI::DoTeleportAll(float fX, float fY, float fZ, float fO) +{ + Map *map = me->GetMap(); + if (!map->IsDungeon()) + return; + + Map::PlayerList const &PlayerList = map->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* i_pl = i->getSource()) + if (i_pl->isAlive()) + i_pl->TeleportTo(me->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT); +} + +Unit* ScriptedAI::DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff) +{ + Unit* pUnit = NULL; + Trinity::MostHPMissingInRange u_check(me, fRange, uiMinHPDiff); + Trinity::UnitLastSearcher searcher(me, pUnit, u_check); + me->VisitNearbyObject(fRange, searcher); + + return pUnit; +} + +std::list ScriptedAI::DoFindFriendlyCC(float fRange) +{ + std::list pList; + Trinity::FriendlyCCedInRange u_check(me, fRange); + Trinity::CreatureListSearcher searcher(me, pList, u_check); + me->VisitNearbyObject(fRange, searcher); + return pList; +} + +std::list ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellid) +{ + std::list pList; + Trinity::FriendlyMissingBuffInRange u_check(me, fRange, uiSpellid); + Trinity::CreatureListSearcher searcher(me, pList, u_check); + me->VisitNearbyObject(fRange, searcher); + return pList; +} + +Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange) +{ + Player* pPlayer = NULL; + + CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY())); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::PlayerAtMinimumRangeAway check(me, fMinimumRange); + Trinity::PlayerSearcher searcher(me, pPlayer, check); + TypeContainerVisitor, GridTypeMapContainer> visitor(searcher); + + cell.Visit(pair, visitor, *(me->GetMap())); + + return pPlayer; +} + +void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 uiOffHand, int32 uiRanged) +{ + if (bLoadDefault) + { + if (CreatureInfo const* pInfo = GetCreatureTemplateStore(me->GetEntry())) + me->LoadEquipment(pInfo->equipmentId,true); + + return; + } + + if (uiMainHand >= 0) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand)); + + if (uiOffHand >= 0) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand)); + + if (uiRanged >= 0) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged)); +} + +void ScriptedAI::SetCombatMovement(bool bCombatMove) +{ + m_bCombatMovement = bCombatMove; +} + +enum eNPCs +{ + NPC_BROODLORD = 12017, + NPC_VOID_REAVER = 19516, + NPC_JAN_ALAI = 23578, + NPC_SARTHARION = 28860 +}; + +// Hacklike storage used for misc creatures that are expected to evade of outside of a certain area. +// It is assumed the information is found elswehere and can be handled by the core. So far no luck finding such information/way to extract it. +bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) +{ + if (m_uiEvadeCheckCooldown <= uiDiff) + m_uiEvadeCheckCooldown = 2500; + else + { + m_uiEvadeCheckCooldown -= uiDiff; + return false; + } + + if (me->IsInEvadeMode() || !me->getVictim()) + return false; + + float fX = me->GetPositionX(); + float fY = me->GetPositionY(); + float fZ = me->GetPositionZ(); + + switch(me->GetEntry()) + { + case NPC_BROODLORD: // broodlord (not move down stairs) + if (fZ > 448.60f) + return false; + break; + case NPC_VOID_REAVER: // void reaver (calculate from center of room) + if (me->GetDistance2d(432.59f, 371.93f) < 105.0f) + return false; + break; + case NPC_JAN_ALAI: // jan'alai (calculate by Z) + if (fZ > 12.0f) + return false; + break; + case NPC_SARTHARION: // sartharion (calculate box) + if (fX > 3218.86f && fX < 3275.69f && fY < 572.40f && fY > 484.68f) + return false; + break; + default: + sLog.outError("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", me->GetEntry()); + return false; + } + + EnterEvadeMode(); + return true; +} + +void Scripted_NoMovementAI::AttackStart(Unit* pWho) +{ + if (!pWho) + return; + + if (me->Attack(pWho, true)) + { + DoStartNoMovement(pWho); + } +} + +BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c) +, bossId(id), summons(me), instance(c->GetInstanceData()) +, boundary(instance ? instance->GetBossBoundary(id) : NULL) +{ +} + +void BossAI::_Reset() +{ + if (!me->isAlive()) + return; + + events.Reset(); + summons.DespawnAll(); + if (instance) + instance->SetBossState(bossId, NOT_STARTED); +} + +void BossAI::_JustDied() +{ + events.Reset(); + summons.DespawnAll(); + if (instance) + { + instance->SetBossState(bossId, DONE); + instance->SaveToDB(); + } +} + +void BossAI::_EnterCombat() +{ + me->setActive(true); + DoZoneInCombat(); + if (instance) + instance->SetBossState(bossId, IN_PROGRESS); +} + +void BossAI::TeleportCheaters() +{ + float x, y, z; + me->GetPosition(x, y, z); + std::list &m_threatlist = me->getThreatManager().getThreatList(); + for (std::list::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) + if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget())) + (*itr)->getTarget()->NearTeleportTo(x, y, z, 0); +} + +bool BossAI::CheckBoundary(Unit *who) +{ + if (!boundary || !who) + return true; + + for (BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr) + { + switch (itr->first) + { + case BOUNDARY_N: + if (me->GetPositionX() > itr->second) + return false; + break; + case BOUNDARY_S: + if (me->GetPositionX() < itr->second) + return false; + break; + case BOUNDARY_E: + if (me->GetPositionY() < itr->second) + return false; + break; + case BOUNDARY_W: + if (me->GetPositionY() > itr->second) + return false; + break; + case BOUNDARY_NW: + if (me->GetPositionX() + me->GetPositionY() > itr->second) + return false; + break; + case BOUNDARY_SE: + if (me->GetPositionX() + me->GetPositionY() < itr->second) + return false; + break; + case BOUNDARY_NE: + if (me->GetPositionX() - me->GetPositionY() > itr->second) + return false; + break; + case BOUNDARY_SW: + if (me->GetPositionX() - me->GetPositionY() < itr->second) + return false; + break; + } + } + + return true; +} + +void BossAI::JustSummoned(Creature *summon) +{ + summons.Summon(summon); + if (me->isInCombat()) + DoZoneInCombat(summon); +} + +void BossAI::SummonedCreatureDespawn(Creature *summon) +{ + summons.Despawn(summon); +} + +#define GOBJECT(x) (const_cast(GetGameObjectInfo(x))) + +void LoadOverridenSQLData() +{ + GameObjectInfo *goInfo; + + // Sunwell Plateau : Kalecgos : Spectral Rift + goInfo = GOBJECT(187055); + if (goInfo) + if (goInfo->type == GAMEOBJECT_TYPE_GOOBER) + goInfo->goober.lockId = 57; // need LOCKTYPE_QUICK_OPEN + + // Naxxramas : Sapphiron Birth + goInfo = GOBJECT(181356); + if (goInfo) + if (goInfo->type == GAMEOBJECT_TYPE_TRAP) + goInfo->trap.radius = 50; +} + +// SD2 grid searchers. +Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive) +{ + return pSource->FindNearestCreature(uiEntry, fMaxSearchRange, bAlive); +} +GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange) +{ + return pSource->FindNearestGameObject(uiEntry, fMaxSearchRange); +} +void GetCreatureListWithEntryInGrid(std::list& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange) +{ + return pSource->GetCreatureListWithEntryInGrid(lList, uiEntry, fMaxSearchRange); +} +void GetGameObjectListWithEntryInGrid(std::list& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange) +{ + return pSource->GetGameObjectListWithEntryInGrid(lList, uiEntry, fMaxSearchRange); +} diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h new file mode 100644 index 0000000..a7b8b53 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -0,0 +1,290 @@ +/* Copyright (C) 2008-2010 Trinity + * + * Thanks to the original authors: ScriptDev2 + * + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_CREATURE_H +#define SC_CREATURE_H + +#include "Creature.h" +#include "CreatureAI.h" +#include "CreatureAIImpl.h" +#include "InstanceData.h" + +#define SCRIPT_CAST_TYPE dynamic_cast +//#define SCRIPT_CAST_TYPE static_cast + +#define CAST_PLR(a) (SCRIPT_CAST_TYPE(a)) +#define CAST_CRE(a) (SCRIPT_CAST_TYPE(a)) +#define CAST_SUM(a) (SCRIPT_CAST_TYPE(a)) +#define CAST_PET(a) (SCRIPT_CAST_TYPE(a)) +#define CAST_AI(a,b) (SCRIPT_CAST_TYPE(b)) + +#define GET_SPELL(a) (const_cast(GetSpellStore()->LookupEntry(a))) + +class ScriptedInstance; + +class SummonList : public std::list +{ + public: + explicit SummonList(Creature* creature) : me(creature) {} + void Summon(Creature *summon) { push_back(summon->GetGUID()); } + void Despawn(Creature *summon) { remove(summon->GetGUID()); } + void DespawnEntry(uint32 entry); + void DespawnAll(); + void DoAction(uint32 entry, uint32 info); + void DoZoneInCombat(uint32 entry = 0); + private: + Creature *me; +}; + +struct ScriptedAI : public CreatureAI +{ + explicit ScriptedAI(Creature* pCreature); + virtual ~ScriptedAI() {} + + //************* + //CreatureAI Functions + //************* + + void AttackStartNoMove(Unit *pTarget); + + // Called at any Damage from any attacker (before damage apply) + void DamageTaken(Unit* /*pDone_by*/, uint32& /*uiDamage*/) {} + + //Called at World update tick + void UpdateAI(const uint32); + + //Called at creature death + void JustDied(Unit* /*who*/){} + + //Called at creature killing another unit + void KilledUnit(Unit* /*who*/){} + + // Called when the creature summon successfully other creature + void JustSummoned(Creature*) {} + + // Called when a summoned creature is despawned + void SummonedCreatureDespawn(Creature*) {} + + // Called when hit by a spell + void SpellHit(Unit* /*caster*/, const SpellEntry * /*spell*/) {} + + // Called when spell hits a target + void SpellHitTarget(Unit * /*pTarget*/, const SpellEntry * /*spell*/) {} + + //Called at waypoint reached or PointMovement end + void MovementInform(uint32 /*type*/, uint32 /*id*/){} + + // Called when AI is temporarily replaced or put back when possess is applied or removed + void OnPossess(bool /*apply*/) {} + + //************* + // Variables + //************* + + //Pointer to creature we are manipulating + Creature* me; + + //For fleeing + bool IsFleeing; + + //************* + //Pure virtual functions + //************* + + //Called at creature reset either by death or evade + void Reset() {} + + //Called at creature aggro either by MoveInLOS or Attack Start + void EnterCombat(Unit* /*who*/) {} + + //************* + //AI Helper Functions + //************* + + //Start movement toward victim + void DoStartMovement(Unit* pVictim, float fDistance = 0, float fAngle = 0); + + //Start no movement on victim + void DoStartNoMovement(Unit* pVictim); + + //Stop attack of current victim + void DoStopAttack(); + + //Cast spell by spell info + void DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered = false); + + //Plays a sound to all nearby players + void DoPlaySoundToSet(WorldObject* pSource, uint32 sound); + + //Drops all threat to 0%. Does not remove players from the threat list + void DoResetThreat(); + + float DoGetThreat(Unit* u); + void DoModifyThreatPercent(Unit* pUnit, int32 pct); + + void DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime = 0); + void DoTeleportTo(const float pos[4]); + + void DoAction(const int32 /*param*/) {} + + //Teleports a player without dropping threat (only teleports to same map) + void DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO); + void DoTeleportAll(float fX, float fY, float fZ, float fO); + + //Returns friendly unit with the most amount of hp missing from max hp + Unit* DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff = 1); + + //Returns a list of friendly CC'd units within range + std::list DoFindFriendlyCC(float fRange); + + //Returns a list of all friendly units missing a specific buff within range + std::list DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellId); + + //Return a player with at least minimumRange from me + Player* GetPlayerAtMinimumRange(float fMinimumRange); + + //Spawns a creature relative to me + Creature* DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime); + + //Selects a unit from the creature's current aggro list + Unit* SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition); + + bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < me->GetMaxHealth() * pct; } + + //Returns spells that meet the specified criteria from the creatures spell list + SpellEntry const* SelectSpell(Unit* Target, uint32 School, uint32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect); + + //Checks if you can cast the specified spell + bool CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered = false); + + void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE); + + //Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims + void SetCombatMovement(bool CombatMove); + bool IsCombatMovement() { return m_bCombatMovement; } + + bool EnterEvadeIfOutOfCombatArea(const uint32 uiDiff); + + // return true for heroic mode. i.e. + // - for dungeon in mode 10-heroic, + // - for raid in mode 10-Heroic + // - for raid in mode 25-heroic + // DO NOT USE to check raid in mode 25-normal. + bool IsHeroic() { return m_heroicMode; } + + // return the dungeon or raid difficulty + Difficulty getDifficulty() { return m_difficulty; } + + template inline + const T& DUNGEON_MODE(const T& normal5, const T& heroic10) + { + switch(m_difficulty) + { + case DUNGEON_DIFFICULTY_NORMAL: + return normal5; + case DUNGEON_DIFFICULTY_HEROIC: + return heroic10; + } + + return heroic10; + } + + template inline + const T& RAID_MODE(const T& normal10, const T& normal25) + { + switch(m_difficulty) + { + case RAID_DIFFICULTY_10MAN_NORMAL: + return normal10; + case RAID_DIFFICULTY_25MAN_NORMAL: + return normal25; + } + + return normal25; + } + + template inline + const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25) + { + switch(m_difficulty) + { + case RAID_DIFFICULTY_10MAN_NORMAL: + return normal10; + case RAID_DIFFICULTY_25MAN_NORMAL: + return normal25; + case RAID_DIFFICULTY_10MAN_HEROIC: + return heroic10; + case RAID_DIFFICULTY_25MAN_HEROIC: + return heroic25; + } + + return heroic25; + } + + private: + bool m_bCombatMovement; + uint32 m_uiEvadeCheckCooldown; + + bool m_heroicMode; + Difficulty m_difficulty; +}; + +struct Scripted_NoMovementAI : public ScriptedAI +{ + Scripted_NoMovementAI(Creature* creature) : ScriptedAI(creature) {} + virtual ~Scripted_NoMovementAI() {} + + //Called at each attack of me by any victim + void AttackStart(Unit* who); +}; + +struct BossAI : public ScriptedAI +{ + BossAI(Creature *c, uint32 id); + virtual ~BossAI() {} + + const uint32 bossId; + EventMap events; + SummonList summons; + InstanceData * const instance; + const BossBoundaryMap * const boundary; + + void JustSummoned(Creature *summon); + void SummonedCreatureDespawn(Creature *summon); + + void UpdateAI(const uint32 diff) = 0; + + void Reset() { _Reset(); } + void EnterCombat(Unit * /*who*/) { _EnterCombat(); } + void JustDied(Unit * /*killer*/) { _JustDied(); } + void JustReachedHome() { me->setActive(false); } + + protected: + void _Reset(); + void _EnterCombat(); + void _JustDied(); + void _JustReachedHome() { me->setActive(false); } + + bool CheckInRoom() + { + if (CheckBoundary(me)) + return true; + EnterEvadeMode(); + return false; + } + bool CheckBoundary(Unit *who); + void TeleportCheaters(); +}; + +// SD2 grid searchers. +Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive = true); +GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange); +void GetCreatureListWithEntryInGrid(std::list& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange); +void GetGameObjectListWithEntryInGrid(std::list& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange); + +#endif + diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp new file mode 100644 index 0000000..84e2cff --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -0,0 +1,506 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +/* ScriptData +SDName: Npc_EscortAI +SD%Complete: 100 +SDComment: +SDCategory: Npc +EndScriptData */ + +#include "ScriptPCH.h" +#include "ScriptedEscortAI.h" + +enum ePoints +{ + POINT_LAST_POINT = 0xFFFFFF, + POINT_HOME = 0xFFFFFE +}; + +npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), + m_uiPlayerGUID(0), + MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), + m_uiPlayerCheckTimer(1000), + m_uiWPWaitTimer(2500), + m_uiEscortState(STATE_ESCORT_NONE), + m_bIsActiveAttacker(true), + m_bIsRunning(false), + DespawnAtEnd(true), + DespawnAtFar(true), + m_pQuestForEscort(NULL), + m_bCanInstantRespawn(false), + m_bCanReturnToStart(false), + ScriptWP(false) +{} + +void npc_escortAI::AttackStart(Unit* pWho) +{ + if (!pWho) + return; + + if (me->Attack(pWho, true)) + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); + + if (IsCombatMovement()) + me->GetMotionMaster()->MoveChase(pWho); + } +} + +//see followerAI +bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) +{ + if (!pWho || !pWho->getVictim()) + return false; + + //experimental (unknown) flag not present + if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13)) + return false; + + //not a player + if (!pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) + return false; + + //never attack friendly + if (me->IsFriendlyTo(pWho)) + return false; + + //too far away and no free sight? + if (me->IsWithinDistInMap(pWho, GetMaxPlayerDistance()) && me->IsWithinLOSInMap(pWho)) + { + //already fighting someone? + if (!me->getVictim()) + { + AttackStart(pWho); + return true; + } + else + { + pWho->SetInCombatWith(me); + me->AddThreat(pWho, 0.0f); + return true; + } + } + + return false; +} + +void npc_escortAI::MoveInLineOfSight(Unit* pWho) +{ + if (!me->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(me)) + { + if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(pWho)) + return; + + if (!me->canFly() && me->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE) + return; + + if (me->IsHostileTo(pWho)) + { + float fAttackRadius = me->GetAttackDistance(pWho); + if (me->IsWithinDistInMap(pWho, fAttackRadius) && me->IsWithinLOSInMap(pWho)) + { + if (!me->getVictim()) + { + pWho->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + AttackStart(pWho); + } + else if (me->GetMap()->IsDungeon()) + { + pWho->SetInCombatWith(me); + me->AddThreat(pWho, 0.0f); + } + } + } + } +} + +void npc_escortAI::JustDied(Unit* /*pKiller*/) +{ + if (!HasEscortState(STATE_ESCORT_ESCORTING) || !m_uiPlayerGUID || !m_pQuestForEscort) + return; + + if (Player* pPlayer = GetPlayerForEscort()) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + if (Player* pMember = pRef->getSource()) + { + if (pMember->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pMember->FailQuest(m_pQuestForEscort->GetQuestId()); + } + } + } + else + { + if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForEscort->GetQuestId()); + } + } +} + +void npc_escortAI::JustRespawned() +{ + m_uiEscortState = STATE_ESCORT_NONE; + + if (!IsCombatMovement()) + SetCombatMovement(true); + + //add a small delay before going to first waypoint, normal in near all cases + m_uiWPWaitTimer = 2500; + + if (me->getFaction() != me->GetCreatureInfo()->faction_A) + me->RestoreFaction(); + + Reset(); +} + +void npc_escortAI::ReturnToLastPoint() +{ + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z); +} + +void npc_escortAI::EnterEvadeMode() +{ + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->SetLootRecipient(NULL); + + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + AddEscortState(STATE_ESCORT_RETURNING); + ReturnToLastPoint(); + sLog.outDebug("TSCR: EscortAI has left combat and is now returning to last point"); + } + else + { + me->GetMotionMaster()->MoveTargetedHome(); + Reset(); + } +} + +bool npc_escortAI::IsPlayerOrGroupInRange() +{ + if (Player* pPlayer = GetPlayerForEscort()) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && me->IsWithinDistInMap(pMember, GetMaxPlayerDistance())) + { + return true; + break; + } + } + } + else + { + if (me->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance())) + return true; + } + } + return false; +} + +void npc_escortAI::UpdateAI(const uint32 uiDiff) +{ + //Waypoint Updating + if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->getVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING)) + { + if (m_uiWPWaitTimer <= uiDiff) + { + //End of the line + if (CurrentWP == WaypointList.end()) + { + if (DespawnAtEnd) + { + sLog.outDebug("TSCR: EscortAI reached end of waypoints"); + + if (m_bCanReturnToStart) + { + float fRetX, fRetY, fRetZ; + me->GetRespawnCoord(fRetX, fRetY, fRetZ); + + me->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ); + + m_uiWPWaitTimer = 0; + + sLog.outDebug("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); + return; + } + + if (m_bCanInstantRespawn) + { + me->setDeathState(JUST_DIED); + me->Respawn(); + } + else + me->ForcedDespawn(); + + return; + } + else + { + sLog.outDebug("TSCR: EscortAI reached end of waypoints with Despawn off"); + + return; + } + } + + if (!HasEscortState(STATE_ESCORT_PAUSED)) + { + me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + sLog.outDebug("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + + WaypointStart(CurrentWP->id); + + m_uiWPWaitTimer = 0; + } + } + else + m_uiWPWaitTimer -= uiDiff; + } + + //Check if player or any member of his group is within range + if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !me->getVictim() && !HasEscortState(STATE_ESCORT_RETURNING)) + { + if (m_uiPlayerCheckTimer <= uiDiff) + { + if (DespawnAtFar && !IsPlayerOrGroupInRange()) + { + sLog.outDebug("TSCR: EscortAI failed because player/group was to far away or not found"); + + if (m_bCanInstantRespawn) + { + me->setDeathState(JUST_DIED); + me->Respawn(); + } + else + me->ForcedDespawn(); + + return; + } + + m_uiPlayerCheckTimer = 1000; + } + else + m_uiPlayerCheckTimer -= uiDiff; + } + + UpdateEscortAI(uiDiff); +} + +void npc_escortAI::UpdateEscortAI(const uint32 /*uiDiff*/) +{ + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); +} + +void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId) +{ + if (uiMoveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + //Combat start position reached, continue waypoint movement + if (uiPointId == POINT_LAST_POINT) + { + sLog.outDebug("TSCR: EscortAI has returned to original position before combat"); + + if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else if (!m_bIsRunning && !me->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) + me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + + RemoveEscortState(STATE_ESCORT_RETURNING); + + if (!m_uiWPWaitTimer) + m_uiWPWaitTimer = 1; + } + else if (uiPointId == POINT_HOME) + { + sLog.outDebug("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list."); + + CurrentWP = WaypointList.begin(); + m_uiWPWaitTimer = 1; + } + else + { + //Make sure that we are still on the right waypoint + if (CurrentWP->id != uiPointId) + { + sLog.outError("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", uiPointId, CurrentWP->id, me->GetEntry()); + return; + } + + sLog.outDebug("TSCR: EscortAI Waypoint %u reached", CurrentWP->id); + + //Call WP function + WaypointReached(CurrentWP->id); + + m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1; + + ++CurrentWP; + } +} + +/* +void npc_escortAI::OnPossess(bool apply) +{ + // We got possessed in the middle of being escorted, store the point + // where we left off to come back to when possess is removed + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + if (apply) + me->GetPosition(LastPos.x, LastPos.y, LastPos.z); + else + { + Returning = true; + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z); + } + } +} +*/ + +void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs) +{ + Escort_Waypoint t(id, x, y, z, WaitTimeMs); + + WaypointList.push_back(t); + + // i think SD2 no longer uses this function + ScriptWP = true; + /*PointMovement wp; + wp.m_uiCreatureEntry = me->GetEntry(); + wp.m_uiPointId = id; + wp.m_fX = x; + wp.m_fY = y; + wp.m_fZ = z; + wp.m_uiWaitTime = WaitTimeMs; + PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/ +} + +void npc_escortAI::FillPointMovementListForCreature() +{ + std::vector const &pPointsEntries = pSystemMgr.GetPointMoveList(me->GetEntry()); + + if (pPointsEntries.empty()) + return; + + std::vector::const_iterator itr; + + for (itr = pPointsEntries.begin(); itr != pPointsEntries.end(); ++itr) + { + Escort_Waypoint pPoint(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime); + WaypointList.push_back(pPoint); + } +} + +void npc_escortAI::SetRun(bool bRun) +{ + if (bRun) + { + if (!m_bIsRunning) + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else + sLog.outDebug("TSCR: EscortAI attempt to set run mode, but is already running."); + } + else + { + if (m_bIsRunning) + me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else + sLog.outDebug("TSCR: EscortAI attempt to set walk mode, but is already walking."); + } + m_bIsRunning = bRun; +} + +//TODO: get rid of this many variables passed in function. +void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath) +{ + if (me->getVictim()) + { + sLog.outError("TSCR ERROR: EscortAI attempt to Start while in combat. Scriptname: %s, creature entry: %u", me->GetScriptName().c_str(), me->GetEntry()); + return; + } + + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + sLog.outError("TSCR: EscortAI attempt to Start while already escorting."); + return; + } + + if (!ScriptWP) // sd2 never adds wp in script, but tc does + { + + if (!WaypointList.empty()) + WaypointList.clear(); + + FillPointMovementListForCreature(); + + } + + if (WaypointList.empty()) + { + sLog.outErrorDb("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", pQuest ? pQuest->GetQuestId() : 0); + return; + } + + //set variables + m_bIsActiveAttacker = bIsActiveAttacker; + m_bIsRunning = bRun; + + m_uiPlayerGUID = uiPlayerGUID; + m_pQuestForEscort = pQuest; + + m_bCanInstantRespawn = bInstantRespawn; + m_bCanReturnToStart = bCanLoopPath; + + if (m_bCanReturnToStart && m_bCanInstantRespawn) + sLog.outDebug("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); + + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + { + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); + sLog.outDebug("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); + } + + //disable npcflags + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + + sLog.outDebug("TSCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); + + CurrentWP = WaypointList.begin(); + + //Set initial speed + if (m_bIsRunning) + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else + me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + + AddEscortState(STATE_ESCORT_ESCORTING); +} + +void npc_escortAI::SetEscortPaused(bool bPaused) +{ + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (bPaused) + AddEscortState(STATE_ESCORT_PAUSED); + else + RemoveEscortState(STATE_ESCORT_PAUSED); +} diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h new file mode 100644 index 0000000..807a564 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -0,0 +1,116 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_ESCORTAI_H +#define SC_ESCORTAI_H + +#include "ScriptSystem.h" + +#define DEFAULT_MAX_PLAYER_DISTANCE 50 + +struct Escort_Waypoint +{ + Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w) + { + id = _id; + x = _x; + y = _y; + z = _z; + WaitTimeMs = _w; + } + + uint32 id; + float x; + float y; + float z; + uint32 WaitTimeMs; +}; + +enum eEscortState +{ + STATE_ESCORT_NONE = 0x000, //nothing in progress + STATE_ESCORT_ESCORTING = 0x001, //escort are in progress + STATE_ESCORT_RETURNING = 0x002, //escort is returning after being in combat + STATE_ESCORT_PAUSED = 0x004 //will not proceed with waypoints before state is removed +}; + +struct npc_escortAI : public ScriptedAI +{ + public: + explicit npc_escortAI(Creature* pCreature); + ~npc_escortAI() {} + + // CreatureAI functions + void AttackStart(Unit* who); + + void MoveInLineOfSight(Unit* who); + + void JustDied(Unit*); + + void JustRespawned(); + + void ReturnToLastPoint(); + + void EnterEvadeMode(); + + void UpdateAI(const uint32); //the "internal" update, calls UpdateEscortAI() + virtual void UpdateEscortAI(const uint32); //used when it's needed to add code in update (abilities, scripted events, etc) + + void MovementInform(uint32, uint32); + + // EscortAI functions + void AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs = 0); + + virtual void WaypointReached(uint32 uiPointId) = 0; + virtual void WaypointStart(uint32 /*uiPointId*/) {} + + void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); + + void SetRun(bool bRun = true); + void SetEscortPaused(bool uPaused); + + bool HasEscortState(uint32 uiEscortState) { return (m_uiEscortState & uiEscortState); } + virtual bool IsEscorted() { return (m_uiEscortState & STATE_ESCORT_ESCORTING); } + + void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } + float GetMaxPlayerDistance() { return MaxPlayerDistance; } + + void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; } + void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } + bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override + void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } + uint64 GetEventStarterGUID() { return m_uiPlayerGUID; } + + protected: + Player* GetPlayerForEscort() { return (Player*)Unit::GetUnit(*me, m_uiPlayerGUID); } + + private: + bool AssistPlayerInCombat(Unit* pWho); + bool IsPlayerOrGroupInRange(); + void FillPointMovementListForCreature(); + + void AddEscortState(uint32 uiEscortState) { m_uiEscortState |= uiEscortState; } + void RemoveEscortState(uint32 uiEscortState) { m_uiEscortState &= ~uiEscortState; } + + uint64 m_uiPlayerGUID; + uint32 m_uiWPWaitTimer; + uint32 m_uiPlayerCheckTimer; + uint32 m_uiEscortState; + float MaxPlayerDistance; + + const Quest* m_pQuestForEscort; //generally passed in Start() when regular escort script. + + std::list WaypointList; + std::list::iterator CurrentWP; + + bool m_bIsActiveAttacker; //obsolete, determined by faction. + bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK) + bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used) + bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests. + bool DespawnAtEnd; + bool DespawnAtFar; + bool ScriptWP; +}; +#endif + diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp new file mode 100644 index 0000000..499e461 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -0,0 +1,387 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +/* ScriptData +SDName: FollowerAI +SD%Complete: 50 +SDComment: This AI is under development +SDCategory: Npc +EndScriptData */ + +#include "ScriptPCH.h" +#include "ScriptedFollowerAI.h" + +const float MAX_PLAYER_DISTANCE = 100.0f; + +enum ePoints +{ + POINT_COMBAT_START = 0xFFFFFF +}; + +FollowerAI::FollowerAI(Creature* pCreature) : ScriptedAI(pCreature), + m_uiLeaderGUID(0), + m_pQuestForFollow(NULL), + m_uiUpdateFollowTimer(2500), + m_uiFollowState(STATE_FOLLOW_NONE) +{} + +void FollowerAI::AttackStart(Unit* pWho) +{ + if (!pWho) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + + if (me->hasUnitState(UNIT_STAT_FOLLOW)) + me->clearUnitState(UNIT_STAT_FOLLOW); + + if (IsCombatMovement()) + me->GetMotionMaster()->MoveChase(pWho); + } +} + +//This part provides assistance to a player that are attacked by pWho, even if out of normal aggro range +//It will cause me to attack pWho that are attacking _any_ player (which has been confirmed may happen also on offi) +//The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate. +bool FollowerAI::AssistPlayerInCombat(Unit* pWho) +{ + if (!pWho || !pWho->getVictim()) + return false; + + //experimental (unknown) flag not present + if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13)) + return false; + + //not a player + if (!pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) + return false; + + //never attack friendly + if (me->IsFriendlyTo(pWho)) + return false; + + //too far away and no free sight? + if (me->IsWithinDistInMap(pWho, MAX_PLAYER_DISTANCE) && me->IsWithinLOSInMap(pWho)) + { + //already fighting someone? + if (!me->getVictim()) + { + AttackStart(pWho); + return true; + } + else + { + pWho->SetInCombatWith(me); + me->AddThreat(pWho, 0.0f); + return true; + } + } + + return false; +} + +void FollowerAI::MoveInLineOfSight(Unit* pWho) +{ + if (!me->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(me)) + { + if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(pWho)) + return; + + if (!me->canFly() && me->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE) + return; + + if (me->IsHostileTo(pWho)) + { + float fAttackRadius = me->GetAttackDistance(pWho); + if (me->IsWithinDistInMap(pWho, fAttackRadius) && me->IsWithinLOSInMap(pWho)) + { + if (!me->getVictim()) + { + pWho->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + AttackStart(pWho); + } + else if (me->GetMap()->IsDungeon()) + { + pWho->SetInCombatWith(me); + me->AddThreat(pWho, 0.0f); + } + } + } + } +} + +void FollowerAI::JustDied(Unit* /*pKiller*/) +{ + if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || !m_uiLeaderGUID || !m_pQuestForFollow) + return; + + //TODO: need a better check for quests with time limit. + if (Player* pPlayer = GetLeaderForFollower()) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + if (Player* pMember = pRef->getSource()) + { + if (pMember->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pMember->FailQuest(m_pQuestForFollow->GetQuestId()); + } + } + } + else + { + if (pPlayer->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForFollow->GetQuestId()); + } + } +} + +void FollowerAI::JustRespawned() +{ + m_uiFollowState = STATE_FOLLOW_NONE; + + if (!IsCombatMovement()) + SetCombatMovement(true); + + if (me->getFaction() != me->GetCreatureInfo()->faction_A) + me->setFaction(me->GetCreatureInfo()->faction_A); + + Reset(); +} + +void FollowerAI::EnterEvadeMode() +{ + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->SetLootRecipient(NULL); + + if (HasFollowState(STATE_FOLLOW_INPROGRESS)) + { + sLog.outDebug("TSCR: FollowerAI left combat, returning to CombatStartPosition."); + + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + { + float fPosX, fPosY, fPosZ; + me->GetPosition(fPosX, fPosY, fPosZ); + me->GetMotionMaster()->MovePoint(POINT_COMBAT_START, fPosX, fPosY, fPosZ); + } + } + else + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + me->GetMotionMaster()->MoveTargetedHome(); + } + + Reset(); +} + +void FollowerAI::UpdateAI(const uint32 uiDiff) +{ + if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !me->getVictim()) + { + if (m_uiUpdateFollowTimer <= uiDiff) + { + if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT)) + { + sLog.outDebug("TSCR: FollowerAI is set completed, despawns."); + me->ForcedDespawn(); + return; + } + + bool bIsMaxRangeExceeded = true; + + if (Player* pPlayer = GetLeaderForFollower()) + { + if (HasFollowState(STATE_FOLLOW_RETURNING)) + { + sLog.outDebug("TSCR: FollowerAI is returning to leader."); + + RemoveFollowState(STATE_FOLLOW_RETURNING); + me->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + return; + } + + if (Group* pGroup = pPlayer->GetGroup()) + { + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && me->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) + { + bIsMaxRangeExceeded = false; + break; + } + } + } + else + { + if (me->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE)) + bIsMaxRangeExceeded = false; + } + } + + if (bIsMaxRangeExceeded) + { + sLog.outDebug("TSCR: FollowerAI failed because player/group was to far away or not found"); + me->ForcedDespawn(); + return; + } + + m_uiUpdateFollowTimer = 1000; + } + else + m_uiUpdateFollowTimer -= uiDiff; + } + + UpdateFollowerAI(uiDiff); +} + +void FollowerAI::UpdateFollowerAI(const uint32 /*uiDiff*/) +{ + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); +} + +void FollowerAI::MovementInform(uint32 uiMotionType, uint32 uiPointId) +{ + if (uiMotionType != POINT_MOTION_TYPE || !HasFollowState(STATE_FOLLOW_INPROGRESS)) + return; + + if (uiPointId == POINT_COMBAT_START) + { + if (GetLeaderForFollower()) + { + if (!HasFollowState(STATE_FOLLOW_PAUSED)) + AddFollowState(STATE_FOLLOW_RETURNING); + } + else + me->ForcedDespawn(); + } +} + +void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const Quest* pQuest) +{ + if (me->getVictim()) + { + sLog.outDebug("TSCR: FollowerAI attempt to StartFollow while in combat."); + return; + } + + if (HasFollowState(STATE_FOLLOW_INPROGRESS)) + { + sLog.outError("TSCR: FollowerAI attempt to StartFollow while already following."); + return; + } + + //set variables + m_uiLeaderGUID = pLeader->GetGUID(); + + if (uiFactionForFollower) + me->setFaction(uiFactionForFollower); + + m_pQuestForFollow = pQuest; + + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + sLog.outDebug("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle."); + } + + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + + AddFollowState(STATE_FOLLOW_INPROGRESS); + + me->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + + sLog.outDebug("TSCR: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID); +} + +Player* FollowerAI::GetLeaderForFollower() +{ + if (Player* pLeader = Unit::GetPlayer(m_uiLeaderGUID)) + { + if (pLeader->isAlive()) + return pLeader; + else + { + if (Group* pGroup = pLeader->GetGroup()) + { + for (GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && pMember->isAlive() && me->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) + { + sLog.outDebug("TSCR: FollowerAI GetLeader changed and returned new leader."); + m_uiLeaderGUID = pMember->GetGUID(); + return pMember; + break; + } + } + } + } + } + + sLog.outDebug("TSCR: FollowerAI GetLeader can not find suitable leader."); + return NULL; +} + +void FollowerAI::SetFollowComplete(bool bWithEndEvent) +{ + if (me->hasUnitState(UNIT_STAT_FOLLOW)) + { + me->clearUnitState(UNIT_STAT_FOLLOW); + + me->StopMoving(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + } + + if (bWithEndEvent) + AddFollowState(STATE_FOLLOW_POSTEVENT); + else + { + if (HasFollowState(STATE_FOLLOW_POSTEVENT)) + RemoveFollowState(STATE_FOLLOW_POSTEVENT); + } + + AddFollowState(STATE_FOLLOW_COMPLETE); +} + +void FollowerAI::SetFollowPaused(bool bPaused) +{ + if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || HasFollowState(STATE_FOLLOW_COMPLETE)) + return; + + if (bPaused) + { + AddFollowState(STATE_FOLLOW_PAUSED); + + if (me->hasUnitState(UNIT_STAT_FOLLOW)) + { + me->clearUnitState(UNIT_STAT_FOLLOW); + + me->StopMoving(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + } + } + else + { + RemoveFollowState(STATE_FOLLOW_PAUSED); + + if (Player* pLeader = GetLeaderForFollower()) + me->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } +} diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h new file mode 100644 index 0000000..d352141 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_FOLLOWERAI_H +#define SC_FOLLOWERAI_H + +#include "ScriptSystem.h" + +enum eFollowState +{ + STATE_FOLLOW_NONE = 0x000, + STATE_FOLLOW_INPROGRESS = 0x001, //must always have this state for any follow + STATE_FOLLOW_RETURNING = 0x002, //when returning to combat start after being in combat + STATE_FOLLOW_PAUSED = 0x004, //disables following + STATE_FOLLOW_COMPLETE = 0x008, //follow is completed and may end + STATE_FOLLOW_PREEVENT = 0x010, //not implemented (allow pre event to run, before follow is initiated) + STATE_FOLLOW_POSTEVENT = 0x020 //can be set at complete and allow post event to run +}; + +class FollowerAI : public ScriptedAI +{ + public: + explicit FollowerAI(Creature* pCreature); + ~FollowerAI() {} + + //virtual void WaypointReached(uint32 uiPointId) = 0; + + void MovementInform(uint32 uiMotionType, uint32 uiPointId); + + void AttackStart(Unit*); + + void MoveInLineOfSight(Unit*); + + void EnterEvadeMode(); + + void JustDied(Unit*); + + void JustRespawned(); + + void UpdateAI(const uint32); //the "internal" update, calls UpdateFollowerAI() + virtual void UpdateFollowerAI(const uint32); //used when it's needed to add code in update (abilities, scripted events, etc) + + void StartFollow(Player* pPlayer, uint32 uiFactionForFollower = 0, const Quest* pQuest = NULL); + + void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow + void SetFollowComplete(bool bWithEndEvent = false); + + bool HasFollowState(uint32 uiFollowState) { return (m_uiFollowState & uiFollowState); } + + protected: + Player* GetLeaderForFollower(); + + private: + void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; } + void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; } + + bool AssistPlayerInCombat(Unit* pWho); + + uint64 m_uiLeaderGUID; + uint32 m_uiUpdateFollowTimer; + uint32 m_uiFollowState; + + const Quest* m_pQuestForFollow; //normally we have a quest +}; + +#endif diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.h b/src/server/game/AI/ScriptedAI/ScriptedGossip.h new file mode 100644 index 0000000..6f1da29 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.h @@ -0,0 +1,187 @@ +/* Copyright (C) 2008-2010 Trinity + * + * Thanks to the original authors: ScriptDev2 + * + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_GOSSIP_H +#define SC_GOSSIP_H + +#include "Player.h" +#include "GossipDef.h" +#include "QuestDef.h" + +// Gossip Item Text +#define GOSSIP_TEXT_BROWSE_GOODS "I'd like to browse your goods." +#define GOSSIP_TEXT_TRAIN "Train me!" + +#define GOSSIP_TEXT_BANK "The bank" +#define GOSSIP_TEXT_IRONFORGE_BANK "The bank of Ironforge" +#define GOSSIP_TEXT_STORMWIND_BANK "The bank of Stormwind" +#define GOSSIP_TEXT_WINDRIDER "The wind rider master" +#define GOSSIP_TEXT_GRYPHON "The gryphon master" +#define GOSSIP_TEXT_BATHANDLER "The bat handler" +#define GOSSIP_TEXT_HIPPOGRYPH "The hippogryph master" +#define GOSSIP_TEXT_ZEPPLINMASTER "The zeppelin master" +#define GOSSIP_TEXT_DEEPRUNTRAM "The Deeprun Tram" +#define GOSSIP_TEXT_FERRY "The Rut'theran Ferry" +#define GOSSIP_TEXT_FLIGHTMASTER "The flight master" +#define GOSSIP_TEXT_AUCTIONHOUSE "The auction house" +#define GOSSIP_TEXT_GUILDMASTER "The guild master" +#define GOSSIP_TEXT_INN "The inn" +#define GOSSIP_TEXT_MAILBOX "The mailbox" +#define GOSSIP_TEXT_STABLEMASTER "The stable master" +#define GOSSIP_TEXT_WEAPONMASTER "The weapon master" +#define GOSSIP_TEXT_OFFICERS "The officers' lounge" +#define GOSSIP_TEXT_BATTLEMASTER "The battlemaster" +#define GOSSIP_TEXT_BARBER "Barber" +#define GOSSIP_TEXT_CLASSTRAINER "A class trainer" +#define GOSSIP_TEXT_PROFTRAINER "A profession trainer" +#define GOSSIP_TEXT_LEXICON "Lexicon of Power" + +#define GOSSIP_TEXT_ALTERACVALLEY "Alterac Valley" +#define GOSSIP_TEXT_ARATHIBASIN "Arathi Basin" +#define GOSSIP_TEXT_WARSONGULCH "Warsong Gulch" +#define GOSSIP_TEXT_ARENA "Arena" +#define GOSSIP_TEXT_EYEOFTHESTORM "Eye of The Storm" +#define GOSSIP_TEXT_STRANDOFANCIENT "Strand of the Ancients" + +#define GOSSIP_TEXT_DEATH_KNIGHT "Death Knight" +#define GOSSIP_TEXT_DRUID "Druid" +#define GOSSIP_TEXT_HUNTER "Hunter" +#define GOSSIP_TEXT_PRIEST "Priest" +#define GOSSIP_TEXT_ROGUE "Rogue" +#define GOSSIP_TEXT_WARRIOR "Warrior" +#define GOSSIP_TEXT_PALADIN "Paladin" +#define GOSSIP_TEXT_SHAMAN "Shaman" +#define GOSSIP_TEXT_MAGE "Mage" +#define GOSSIP_TEXT_WARLOCK "Warlock" + +#define GOSSIP_TEXT_ALCHEMY "Alchemy" +#define GOSSIP_TEXT_BLACKSMITHING "Blacksmithing" +#define GOSSIP_TEXT_COOKING "Cooking" +#define GOSSIP_TEXT_ENCHANTING "Enchanting" +#define GOSSIP_TEXT_ENGINEERING "Engineering" +#define GOSSIP_TEXT_FIRSTAID "First Aid" +#define GOSSIP_TEXT_HERBALISM "Herbalism" +#define GOSSIP_TEXT_INSCRIPTION "Inscription" +#define GOSSIP_TEXT_JEWELCRAFTING "Jewelcrafting" +#define GOSSIP_TEXT_LEATHERWORKING "Leatherworking" +#define GOSSIP_TEXT_TAILORING "Tailoring" +#define GOSSIP_TEXT_MINING "Mining" +#define GOSSIP_TEXT_FISHING "Fishing" +#define GOSSIP_TEXT_SKINNING "Skinning" + +enum eTradeskill +{ +// Skill defines + TRADESKILL_ALCHEMY = 1, + TRADESKILL_BLACKSMITHING = 2, + TRADESKILL_COOKING = 3, + TRADESKILL_ENCHANTING = 4, + TRADESKILL_ENGINEERING = 5, + TRADESKILL_FIRSTAID = 6, + TRADESKILL_HERBALISM = 7, + TRADESKILL_LEATHERWORKING = 8, + TRADESKILL_POISONS = 9, + TRADESKILL_TAILORING = 10, + TRADESKILL_MINING = 11, + TRADESKILL_FISHING = 12, + TRADESKILL_SKINNING = 13, + TRADESKILL_JEWLCRAFTING = 14, + TRADESKILL_INSCRIPTION = 15, + + TRADESKILL_LEVEL_NONE = 0, + TRADESKILL_LEVEL_APPRENTICE = 1, + TRADESKILL_LEVEL_JOURNEYMAN = 2, + TRADESKILL_LEVEL_EXPERT = 3, + TRADESKILL_LEVEL_ARTISAN = 4, + TRADESKILL_LEVEL_MASTER = 5, + TRADESKILL_LEVEL_GRAND_MASTER = 6, + +// Gossip defines + GOSSIP_ACTION_TRADE = 1, + GOSSIP_ACTION_TRAIN = 2, + GOSSIP_ACTION_TAXI = 3, + GOSSIP_ACTION_GUILD = 4, + GOSSIP_ACTION_BATTLE = 5, + GOSSIP_ACTION_BANK = 6, + GOSSIP_ACTION_INN = 7, + GOSSIP_ACTION_HEAL = 8, + GOSSIP_ACTION_TABARD = 9, + GOSSIP_ACTION_AUCTION = 10, + GOSSIP_ACTION_INN_INFO = 11, + GOSSIP_ACTION_UNLEARN = 12, + GOSSIP_ACTION_INFO_DEF = 1000, + + GOSSIP_SENDER_MAIN = 1, + GOSSIP_SENDER_INN_INFO = 2, + GOSSIP_SENDER_INFO = 3, + GOSSIP_SENDER_SEC_PROFTRAIN = 4, + GOSSIP_SENDER_SEC_CLASSTRAIN = 5, + GOSSIP_SENDER_SEC_BATTLEINFO = 6, + GOSSIP_SENDER_SEC_BANK = 7, + GOSSIP_SENDER_SEC_INN = 8, + GOSSIP_SENDER_SEC_MAILBOX = 9, + GOSSIP_SENDER_SEC_STABLEMASTER = 10 +}; + +extern uint32 GetSkillLevel(Player *player,uint32 skill); + +// Defined fuctions to use with player. + +// This fuction add's a menu item, +// a - Icon Id +// b - Text +// c - Sender(this is to identify the current Menu with this item) +// d - Action (identifys this Menu Item) +// e - Text to be displayed in pop up box +// f - Money value in pop up box +#define ADD_GOSSIP_ITEM(a,b,c,d) PlayerTalkClass->GetGossipMenu().AddMenuItem(a,b,c,d,"",0) +#define ADD_GOSSIP_ITEM_EXTENDED(a,b,c,d,e,f,g) PlayerTalkClass->GetGossipMenu().AddMenuItem(a,b,c,d,e,f,g) + +// This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32) , b - npc guid(uint64) +#define SEND_GOSSIP_MENU(a,b) PlayerTalkClass->SendGossipMenu(a,b) + +// This fuction shows POI(point of interest) to client. +// a - position X +// b - position Y +// c - Icon Id +// d - Flags +// e - Data +// f - Location Name +#define SEND_POI(a,b,c,d,e,f) PlayerTalkClass->SendPointOfInterest(a,b,c,d,e,f) + +// Closes the Menu +#define CLOSE_GOSSIP_MENU() PlayerTalkClass->CloseGossip() + +// Fuction to tell to client the details +// a - quest object +// b - npc guid(uint64) +// c - Activate accept(bool) +#define SEND_QUEST_DETAILS(a,b,c) PlayerTalkClass->SendQuestDetails(a,b,c) + +// Fuction to tell to client the requested items to complete quest +// a - quest object +// b - npc guid(uint64) +// c - Iscompletable(bool) +// d - close at cancel(bool) - in case single incomplite ques +#define SEND_REQUESTEDITEMS(a,b,c,d) PlayerTalkClass->SendRequestedItems(a,b,c,d) + +// Fuctions to send NPC lists, a - is always the npc guid(uint64) +#define SEND_VENDORLIST(a) GetSession()->SendListInventory(a) +#define SEND_TRAINERLIST(a) GetSession()->SendTrainerList(a) + +// Ressurect's the player if is dead. +#define SEND_SPRESURRECT() GetSession()->SendSpiritResurrect() + +// Get the player's honor rank. +#define GET_HONORRANK() GetHonorRank() +// ----------------------------------- + +// defined fuctions to use with Creature + +#define QUEST_DIALOG_STATUS(a,b,c) GetSession()->getDialogStatus(a,b,c) +#endif + diff --git a/src/server/game/AI/ScriptedAI/ScriptedGuardAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedGuardAI.cpp new file mode 100644 index 0000000..4dd1954 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedGuardAI.cpp @@ -0,0 +1,194 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Guard_AI +SD%Complete: 90 +SDComment: +SDCategory: Guards +EndScriptData */ + +#include "ScriptPCH.h" +#include "ScriptedGuardAI.h" + +// **** This script is for use within every single guard to save coding time **** + +#define GENERIC_CREATURE_COOLDOWN 5000 + +#define SAY_GUARD_SIL_AGGRO1 -1070001 +#define SAY_GUARD_SIL_AGGRO2 -1070002 +#define SAY_GUARD_SIL_AGGRO3 -1070003 + +guardAI::guardAI(Creature* pCreature) : ScriptedAI(pCreature), + GlobalCooldown(0), + BuffTimer(0) +{} + +void guardAI::Reset() +{ + GlobalCooldown = 0; + BuffTimer = 0; //Rebuff as soon as we can +} + +void guardAI::EnterCombat(Unit *who) +{ + if (me->GetEntry() == 15184) + DoScriptText(RAND(SAY_GUARD_SIL_AGGRO1,SAY_GUARD_SIL_AGGRO2,SAY_GUARD_SIL_AGGRO3), me, who); + + if (SpellEntry const *spell = me->reachWithSpellAttack(who)) + DoCastSpell(who, spell); +} + +void guardAI::JustDied(Unit *Killer) +{ + //Send Zone Under Attack message to the LocalDefense and WorldDefense Channels + if (Player* pKiller = Killer->GetCharmerOrOwnerPlayerOrPlayerItself()) + me->SendZoneUnderAttackMessage(pKiller); +} + +void guardAI::UpdateAI(const uint32 diff) +{ + //Always decrease our global cooldown first + if (GlobalCooldown > diff) + GlobalCooldown -= diff; + else GlobalCooldown = 0; + + //Buff timer (only buff when we are alive and not in combat + if (me->isAlive() && !me->isInCombat()) + if (BuffTimer <= diff) + { + //Find a spell that targets friendly and applies an aura (these are generally buffs) + SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + + if (info && !GlobalCooldown) + { + //Cast the buff spell + DoCastSpell(me, info); + + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + + //Set our timer to 10 minutes before rebuff + BuffTimer = 600000; + } //Try again in 30 seconds + else BuffTimer = 30000; + } else BuffTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + // Make sure our attack is ready and we arn't currently casting + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + bool Healing = false; + SpellEntry const *info = NULL; + + //Select a healing spell if less than 30% hp + if (me->GetHealth()*100 / me->GetMaxHealth() < 30) + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + + //No healing spell available, select a hostile spell + if (info) Healing = true; + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); + + //20% chance to replace our white hit with a spell + if (info && rand() % 5 == 0 && !GlobalCooldown) + { + //Cast the spell + if (Healing)DoCastSpell(me, info); + else DoCastSpell(me->getVictim(), info); + + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + } + else me->AttackerStateUpdate(me->getVictim()); + + me->resetAttackTimer(); + } + } + else + { + //Only run this code if we arn't already casting + if (!me->IsNonMeleeSpellCasted(false)) + { + bool Healing = false; + SpellEntry const *info = NULL; + + //Select a healing spell if less than 30% hp ONLY 33% of the time + if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0) + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + + //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) + if (info) Healing = true; + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); + + //Found a spell, check if we arn't on cooldown + if (info && !GlobalCooldown) + { + //If we are currently moving stop us and set the movement generator + if ((*me).GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) + { + (*me).GetMotionMaster()->Clear(false); + (*me).GetMotionMaster()->MoveIdle(); + } + + //Cast spell + if (Healing) DoCastSpell(me,info); + else DoCastSpell(me->getVictim(),info); + + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + + } //If no spells available and we arn't moving run to target + else if ((*me).GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + { + //Cancel our current spell and then mutate new movement generator + me->InterruptNonMeleeSpells(false); + (*me).GetMotionMaster()->Clear(false); + (*me).GetMotionMaster()->MoveChase(me->getVictim()); + } + } + } +} + +void guardAI::DoReplyToTextEmote(uint32 em) +{ + switch(em) + { + case TEXTEMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; + case TEXTEMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; + case TEXTEMOTE_SALUTE: me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); break; + case TEXTEMOTE_SHY: me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); break; + case TEXTEMOTE_RUDE: + case TEXTEMOTE_CHICKEN: me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); break; + } +} + +void guardAI_orgrimmar::ReceiveEmote(Player* pPlayer, uint32 text_emote) +{ + if (pPlayer->GetTeam() == HORDE) + DoReplyToTextEmote(text_emote); +} + +void guardAI_stormwind::ReceiveEmote(Player* pPlayer, uint32 text_emote) +{ + if (pPlayer->GetTeam() == ALLIANCE) + DoReplyToTextEmote(text_emote); +} diff --git a/src/server/game/AI/ScriptedAI/ScriptedGuardAI.h b/src/server/game/AI/ScriptedAI/ScriptedGuardAI.h new file mode 100644 index 0000000..d28f612 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedGuardAI.h @@ -0,0 +1,45 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_GUARDAI_H +#define SC_GUARDAI_H + +#define GENERIC_CREATURE_COOLDOWN 5000 + +struct guardAI : public ScriptedAI +{ + public: + explicit guardAI(Creature* pCreature); + ~guardAI() {} + + uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) + uint32 BuffTimer; //This variable keeps track of buffs + + void Reset(); + + void EnterCombat(Unit * /*who*/); + + void JustDied(Unit *Killer); + + void UpdateAI(const uint32 diff); + + //common used for guards in main cities + void DoReplyToTextEmote(uint32 em); +}; + +struct guardAI_orgrimmar : public guardAI +{ + guardAI_orgrimmar(Creature *c) : guardAI(c) {} + + void ReceiveEmote(Player *player, uint32 text_emote); +}; + +struct guardAI_stormwind : public guardAI +{ + guardAI_stormwind(Creature *c) : guardAI(c) {} + + void ReceiveEmote(Player *player, uint32 text_emote); +}; +#endif + diff --git a/src/server/game/AI/ScriptedAI/ScriptedInstance.h b/src/server/game/AI/ScriptedAI/ScriptedInstance.h new file mode 100644 index 0000000..8a9b8c4 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedInstance.h @@ -0,0 +1,20 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 +* This program is free software licensed under GPL version 2 +* Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_INSTANCE_H +#define SC_INSTANCE_H + +#include "InstanceData.h" +#include "Map.h" + +#define OUT_SAVE_INST_DATA sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA_COMPLETE sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA(a) sLog.outDebug("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) +#define OUT_LOAD_INST_DATA_COMPLETE sLog.outDebug("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA_FAIL sLog.outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) + +#define ScriptedInstance InstanceData + +#endif + diff --git a/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.cpp new file mode 100644 index 0000000..7d86c8e --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.cpp @@ -0,0 +1,278 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 +* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* ScriptData +SDName: SimpleAI +SD%Complete: 100 +SDComment: Base Class for SimpleAI creatures +SDCategory: Creatures +EndScriptData */ + +#include "ScriptPCH.h" +#include "ScriptedSimpleAI.h" + +SimpleAI::SimpleAI(Creature *c) : ScriptedAI(c) +{ + //Clear all data + Aggro_TextId[0] = 0; + Aggro_TextId[1] = 0; + Aggro_TextId[2] = 0; + Aggro_Sound[0] = 0; + Aggro_Sound[1] = 0; + Aggro_Sound[2] = 0; + + Death_TextId[0] = 0; + Death_TextId[1] = 0; + Death_TextId[2] = 0; + Death_Sound[0] = 0; + Death_Sound[1] = 0; + Death_Sound[2] = 0; + Death_Spell = 0; + Death_Target_Type = 0; + + Kill_TextId[0] = 0; + Kill_TextId[1] = 0; + Kill_TextId[2] = 0; + Kill_Sound[0] = 0; + Kill_Sound[1] = 0; + Kill_Sound[2] = 0; + Kill_Spell = 0; + Kill_Target_Type = 0; + + memset(Spell,0,sizeof(Spell)); + + EnterEvadeMode(); +} + +void SimpleAI::Reset() +{ +} + +void SimpleAI::EnterCombat(Unit *who) +{ + //Reset cast timers + if (Spell[0].First_Cast >= 0) + Spell_Timer[0] = Spell[0].First_Cast; + else Spell_Timer[0] = 1000; + if (Spell[1].First_Cast >= 0) + Spell_Timer[1] = Spell[1].First_Cast; + else Spell_Timer[1] = 1000; + if (Spell[2].First_Cast >= 0) + Spell_Timer[2] = Spell[2].First_Cast; + else Spell_Timer[2] = 1000; + if (Spell[3].First_Cast >= 0) + Spell_Timer[3] = Spell[3].First_Cast; + else Spell_Timer[3] = 1000; + if (Spell[4].First_Cast >= 0) + Spell_Timer[4] = Spell[4].First_Cast; + else Spell_Timer[4] = 1000; + if (Spell[5].First_Cast >= 0) + Spell_Timer[5] = Spell[5].First_Cast; + else Spell_Timer[5] = 1000; + if (Spell[6].First_Cast >= 0) + Spell_Timer[6] = Spell[6].First_Cast; + else Spell_Timer[6] = 1000; + if (Spell[7].First_Cast >= 0) + Spell_Timer[7] = Spell[7].First_Cast; + else Spell_Timer[7] = 1000; + if (Spell[8].First_Cast >= 0) + Spell_Timer[8] = Spell[8].First_Cast; + else Spell_Timer[8] = 1000; + if (Spell[9].First_Cast >= 0) + Spell_Timer[9] = Spell[9].First_Cast; + else Spell_Timer[9] = 1000; + + uint8 random_text = urand(0,2); + + //Random text + if (Aggro_TextId[random_text]) + DoScriptText(Aggro_TextId[random_text], me, who); + + //Random sound + if (Aggro_Sound[random_text]) + DoPlaySoundToSet(me, Aggro_Sound[random_text]); +} + +void SimpleAI::KilledUnit(Unit *victim) +{ + uint8 random_text = urand(0,2); + + //Random yell + if (Kill_TextId[random_text]) + DoScriptText(Kill_TextId[random_text], me, victim); + + //Random sound + if (Kill_Sound[random_text]) + DoPlaySoundToSet(me, Kill_Sound[random_text]); + + if (!Kill_Spell) + return; + + Unit *pTarget = NULL; + + switch (Kill_Target_Type) + { + case CAST_SELF: + pTarget = me; + break; + case CAST_HOSTILE_TARGET: + pTarget = me->getVictim(); + break; + case CAST_HOSTILE_SECOND_AGGRO: + pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); + break; + case CAST_HOSTILE_LAST_AGGRO: + pTarget = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0); + break; + case CAST_HOSTILE_RANDOM: + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + break; + case CAST_KILLEDUNIT_VICTIM: + pTarget = victim; + break; + } + + //Target is ok, cast a spell on it + if (pTarget) + DoCast(pTarget, Kill_Spell); +} + +void SimpleAI::DamageTaken(Unit *killer, uint32 &damage) +{ + //Return if damage taken won't kill us + if (me->GetHealth() > damage) + return; + + uint8 random_text = urand(0,2); + + //Random yell + if (Death_TextId[random_text]) + DoScriptText(Death_TextId[random_text], me, killer); + + //Random sound + if (Death_Sound[random_text]) + DoPlaySoundToSet(me, Death_Sound[random_text]); + + if (!Death_Spell) + return; + + Unit *pTarget = NULL; + + switch (Death_Target_Type) + { + case CAST_SELF: + pTarget = me; + break; + case CAST_HOSTILE_TARGET: + pTarget = me->getVictim(); + break; + case CAST_HOSTILE_SECOND_AGGRO: + pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); + break; + case CAST_HOSTILE_LAST_AGGRO: + pTarget = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0); + break; + case CAST_HOSTILE_RANDOM: + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + break; + case CAST_JUSTDIED_KILLER: + pTarget = killer; + break; + } + + //Target is ok, cast a spell on it + if (pTarget) + DoCast(pTarget, Death_Spell); +} + +void SimpleAI::UpdateAI(const uint32 diff) +{ + //Return since we have no target + if (!UpdateVictim()) + return; + + //Spells + for (uint32 i = 0; i < 10; ++i) + { + //Spell not valid + if (!Spell[i].Enabled || !Spell[i].Spell_Id) + continue; + + if (Spell_Timer[i] <= diff) + { + //Check if this is a percentage based + if (Spell[i].First_Cast < 0 && Spell[i].First_Cast > -100 && me->GetHealth()*100 / me->GetMaxHealth() > -Spell[i].First_Cast) + continue; + + //Check Current spell + if (!(Spell[i].InterruptPreviousCast && me->IsNonMeleeSpellCasted(false))) + { + Unit *pTarget = NULL; + + switch (Spell[i].Cast_Target_Type) + { + case CAST_SELF: + pTarget = me; + break; + case CAST_HOSTILE_TARGET: + pTarget = me->getVictim(); + break; + case CAST_HOSTILE_SECOND_AGGRO: + pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); + break; + case CAST_HOSTILE_LAST_AGGRO: + pTarget = SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0); + break; + case CAST_HOSTILE_RANDOM: + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + break; + } + + //Target is ok, cast a spell on it and then do our random yell + if (pTarget) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + DoCast(pTarget, Spell[i].Spell_Id); + + //Yell and sound use the same number so that you can make + //the Creature yell with the correct sound effect attached + uint8 random_text = urand(0,2); + + //Random yell + if (Spell[i].TextId[random_text]) + DoScriptText(Spell[i].TextId[random_text], me, pTarget); + + //Random sound + if (Spell[i].Text_Sound[random_text]) + DoPlaySoundToSet(me, Spell[i].Text_Sound[random_text]); + } + + } + + //Spell will cast agian when the cooldown is up + if (Spell[i].CooldownRandomAddition) + Spell_Timer[i] = Spell[i].Cooldown + (rand() % Spell[i].CooldownRandomAddition); + else Spell_Timer[i] = Spell[i].Cooldown; + + } else Spell_Timer[i] -= diff; + + } + + DoMeleeAttackIfReady(); +} + diff --git a/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.h b/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.h new file mode 100644 index 0000000..c4689ff --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedSimpleAI.h @@ -0,0 +1,71 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 +* This program is free software licensed under GPL version 2 +* Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_SIMPLEAI_H +#define SC_SIMPLEAI_H + +enum CastTarget +{ + CAST_SELF = 0, //Self cast + CAST_HOSTILE_TARGET, //Our current target (ie: highest aggro) + CAST_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) + CAST_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) + CAST_HOSTILE_RANDOM, //Just any random target on our threat list + CAST_FRIENDLY_RANDOM, //NOT YET IMPLEMENTED + + //Special cases + CAST_KILLEDUNIT_VICTIM, //Only works within KilledUnit function + CAST_JUSTDIED_KILLER, //Only works within JustDied function +}; + +struct SimpleAI : public ScriptedAI +{ + SimpleAI(Creature *c);// : ScriptedAI(c); + + void Reset(); + + void EnterCombat(Unit * /*who*/); + + void KilledUnit(Unit * /*victim*/); + + void DamageTaken(Unit *killer, uint32 &damage); + + void UpdateAI(const uint32 diff); + +public: + + int32 Aggro_TextId[3]; + uint32 Aggro_Sound[3]; + + int32 Death_TextId[3]; + uint32 Death_Sound[3]; + uint32 Death_Spell; + uint32 Death_Target_Type; + + int32 Kill_TextId[3]; + uint32 Kill_Sound[3]; + uint32 Kill_Spell; + uint32 Kill_Target_Type; + + struct SimpleAI_Spell + { + uint32 Spell_Id; //Spell ID to cast + int32 First_Cast; //Delay for first cast + uint32 Cooldown; //Cooldown between casts + uint32 CooldownRandomAddition; //Random addition to cooldown (in range from 0 - CooldownRandomAddition) + uint32 Cast_Target_Type; //Target type (note that certain spells may ignore this) + bool InterruptPreviousCast; //Interrupt a previous cast if this spell needs to be cast + bool Enabled; //Spell enabled or disabled (default: false) + + //3 texts to many? + int32 TextId[3]; + uint32 Text_Sound[3]; + }Spell[10]; + +protected: + uint32 Spell_Timer[10]; +}; + +#endif + diff --git a/src/server/game/AI/ScriptedAI/ScriptedSmartAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedSmartAI.cpp new file mode 100644 index 0000000..c5c11d5 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedSmartAI.cpp @@ -0,0 +1,8 @@ +/* Copyright (C) 2008-2010 Trinity + * + * Thanks to the original authors: ScriptDev2 + * + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#include "ScriptedSmartAI.h" \ No newline at end of file diff --git a/src/server/game/AI/ScriptedAI/ScriptedSmartAI.h b/src/server/game/AI/ScriptedAI/ScriptedSmartAI.h new file mode 100644 index 0000000..a1e10a0 --- /dev/null +++ b/src/server/game/AI/ScriptedAI/ScriptedSmartAI.h @@ -0,0 +1,8 @@ +/* Copyright (C) 2008-2010 Trinity + * + * Thanks to the original authors: ScriptDev2 + * + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#include "Creature.h" \ No newline at end of file diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp new file mode 100644 index 0000000..54f8011 --- /dev/null +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -0,0 +1,244 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "DatabaseEnv.h" + + +#include "AccountMgr.h" +#include "ObjectAccessor.h" +#include "Player.h" +#include "Util.h" +#include "SHA1.h" + +extern DatabaseType LoginDatabase; + +AccountMgr::AccountMgr() +{} + +AccountMgr::~AccountMgr() +{} + +AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password) +{ + if (utf8length(username) > MAX_ACCOUNT_STR) + return AOR_NAME_TOO_LONG; // username's too long + + normalizeString(username); + normalizeString(password); + + if (GetId(username)) + { + return AOR_NAME_ALREDY_EXIST; // username does already exist + } + + if (!LoginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str())) + return AOR_DB_INTERNAL_ERROR; // unexpected error + LoginDatabase.Execute("INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist,account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL"); + + return AOR_OK; // everything's fine +} + +AccountOpResult AccountMgr::DeleteAccount(uint32 accid) +{ + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid); + if (!result) + return AOR_NAME_NOT_EXIST; // account doesn't exist + + result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%d'",accid); + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 guidlo = fields[0].GetUInt32(); + uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER); + + // kick if player currently + if (Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL)) + { + WorldSession* s = p->GetSession(); + s->KickPlayer(); // mark session to remove at next session list update + s->LogoutPlayer(false); // logout player without waiting next session list update + } + + Player::DeleteFromDB(guid, accid, false); // no need to update realm characters + } while (result->NextRow()); + } + + // table realm specific but common for all characters of account for realm + CharacterDatabase.PExecute("DELETE FROM character_tutorial WHERE account = '%u'",accid); + CharacterDatabase.PExecute("DELETE FROM account_data WHERE account = '%u'",accid); + + LoginDatabase.BeginTransaction(); + + bool res = + LoginDatabase.PExecute("DELETE FROM account WHERE id='%d'", accid) && + LoginDatabase.PExecute("DELETE FROM account_access WHERE id ='%d'", accid) && + LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%d'", accid); + + LoginDatabase.CommitTransaction(); + + if (!res) + return AOR_DB_INTERNAL_ERROR; // unexpected error; + + return AOR_OK; +} + +AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd) +{ + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid); + if (!result) + return AOR_NAME_NOT_EXIST; // account doesn't exist + + if (utf8length(new_uname) > MAX_ACCOUNT_STR) + return AOR_NAME_TOO_LONG; + + if (utf8length(new_passwd) > MAX_ACCOUNT_STR) + return AOR_PASS_TOO_LONG; + + normalizeString(new_uname); + normalizeString(new_passwd); + + std::string safe_new_uname = new_uname; + LoginDatabase.escape_string(safe_new_uname); + + if (!LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(), + CalculateShaPassHash(new_uname, new_passwd).c_str(), accid)) + return AOR_DB_INTERNAL_ERROR; // unexpected error + + return AOR_OK; +} + +AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd) +{ + std::string username; + + if (!GetName(accid, username)) + return AOR_NAME_NOT_EXIST; // account doesn't exist + + if (utf8length(new_passwd) > MAX_ACCOUNT_STR) + return AOR_PASS_TOO_LONG; + + normalizeString(username); + normalizeString(new_passwd); + + // also reset s and v to force update at next realmd login + if (!LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'", + CalculateShaPassHash(username, new_passwd).c_str(), accid)) + return AOR_DB_INTERNAL_ERROR; // unexpected error + + return AOR_OK; +} + +uint32 AccountMgr::GetId(std::string username) +{ + LoginDatabase.escape_string(username); + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str()); + if (!result) + return 0; + else + { + uint32 id = (*result)[0].GetUInt32(); + return id; + } +} + +uint32 AccountMgr::GetSecurity(uint32 acc_id) +{ + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", acc_id); + if (result) + { + uint32 sec = (*result)[0].GetUInt32(); + return sec; + } + + return 0; +} + +uint32 AccountMgr::GetSecurity(uint32 acc_id, int32 realm_id) +{ + QueryResult_AutoPtr result = (realm_id == -1) + ? LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND RealmID = '%d'", acc_id, realm_id) + : LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", acc_id, realm_id); + if (result) + { + uint32 sec = (*result)[0].GetUInt32(); + return sec; + } + + return 0; +} + +bool AccountMgr::GetName(uint32 acc_id, std::string &name) +{ + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id); + if (result) + { + name = (*result)[0].GetCppString(); + return true; + } + + return false; +} + +bool AccountMgr::CheckPassword(uint32 accid, std::string passwd) +{ + std::string username; + if (!GetName(accid, username)) + return false; + + normalizeString(username); + normalizeString(passwd); + + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str()); + if (result) + return true; + + return false; +} + +bool AccountMgr::normalizeString(std::string& utf8str) +{ + wchar_t wstr_buf[MAX_ACCOUNT_STR+1]; + + size_t wstr_len = MAX_ACCOUNT_STR; + if (!Utf8toWStr(utf8str,wstr_buf,wstr_len)) + return false; + + std::transform(&wstr_buf[0], wstr_buf+wstr_len, &wstr_buf[0], wcharToUpperOnlyLatin); + + return WStrToUtf8(wstr_buf,wstr_len,utf8str); +} + +std::string AccountMgr::CalculateShaPassHash(std::string& name, std::string& password) +{ + Sha1Hash sha; + sha.Initialize(); + sha.UpdateData(name); + sha.UpdateData(":"); + sha.UpdateData(password); + sha.Finalize(); + + std::string encoded; + hexEncodeByteArray(sha.GetDigest(), sha.GetLength(), encoded); + + return encoded; +} + diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h new file mode 100644 index 0000000..a0e181c --- /dev/null +++ b/src/server/game/Accounts/AccountMgr.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _ACCMGR_H +#define _ACCMGR_H + +#include + +#include "Common.h" + +enum AccountOpResult +{ + AOR_OK, + AOR_NAME_TOO_LONG, + AOR_PASS_TOO_LONG, + AOR_NAME_ALREDY_EXIST, + AOR_NAME_NOT_EXIST, + AOR_DB_INTERNAL_ERROR +}; + +#define MAX_ACCOUNT_STR 16 + +class AccountMgr +{ + public: + AccountMgr(); + ~AccountMgr(); + + AccountOpResult CreateAccount(std::string username, std::string password); + AccountOpResult DeleteAccount(uint32 accid); + AccountOpResult ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd); + AccountOpResult ChangePassword(uint32 accid, std::string new_passwd); + bool CheckPassword(uint32 accid, std::string passwd); + + uint32 GetId(std::string username); + uint32 GetSecurity(uint32 acc_id); + uint32 GetSecurity(uint32 acc_id, int32 realm_id); + bool GetName(uint32 acc_id, std::string &name); + std::string CalculateShaPassHash(std::string& name, std::string& password); + + static bool normalizeString(std::string& utf8str); +}; + +#define accmgr (*ACE_Singleton::instance()) +#endif + diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp new file mode 100644 index 0000000..8718340 --- /dev/null +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -0,0 +1,2419 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "DBCEnums.h" +#include "ObjectMgr.h" +#include "World.h" +#include "WorldPacket.h" +#include "DatabaseEnv.h" + + +#include "AchievementMgr.h" +#include "ArenaTeam.h" +#include "CellImpl.h" +#include "GameEventMgr.h" +#include "GridNotifiersImpl.h" +#include "Guild.h" +#include "Language.h" +#include "Player.h" +#include "ProgressBar.h" +#include "SpellMgr.h" + +#include "MapManager.h" +#include "BattleGround.h" +#include "BattleGroundAB.h" +#include "Map.h" +#include "InstanceData.h" + +namespace Trinity +{ + class AchievementChatBuilder + { + public: + AchievementChatBuilder(Player const& pl, ChatMsg msgtype, int32 textId, uint32 ach_id) + : i_player(pl), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {} + void operator()(WorldPacket& data, int32 loc_idx) + { + char const* text = objmgr.GetTrinityString(i_textId,loc_idx); + + data << uint8(i_msgtype); + data << uint32(LANG_UNIVERSAL); + data << uint64(i_player.GetGUID()); + data << uint32(5); + data << uint64(i_player.GetGUID()); + data << uint32(strlen(text)+1); + data << text; + data << uint8(0); + data << uint32(i_achievementId); + } + + private: + Player const& i_player; + ChatMsg i_msgtype; + int32 i_textId; + uint32 i_achievementId; + }; +} // namespace Trinity + +bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) +{ + if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE) + { + sLog.outErrorDb("Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID,dataType); + return false; + } + + switch(criteria->requiredType) + { + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: + case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: + case ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING: + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: // only hardcoded list + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: + case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: + case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: + case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL: + case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT: + break; + default: + sLog.outErrorDb("Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType); + return false; + } + + switch(dataType) + { + case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE: + case ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE: + case ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED: + case ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT: + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE: + if (!creature.id || !objmgr.GetCreatureTemplate(creature.id)) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,creature.id); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE: + if (!classRace.class_id && !classRace.race_id) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.", + criteria->ID, criteria->requiredType,dataType); + return false; + } + if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing class in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,classRace.class_id); + return false; + } + if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing race in value2 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,classRace.race_id); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH: + if (health.percent < 1 || health.percent > 100) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,health.percent); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD: + if (player_dead.own_team_flag > 1) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).", + criteria->ID, criteria->requiredType,dataType,player_dead.own_team_flag); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA: + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA: + { + SpellEntry const* spellEntry = sSpellStore.LookupEntry(aura.spell_id); + if (!spellEntry) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,(dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id); + return false; + } + if (aura.effect_idx >= 3) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.", + criteria->ID, criteria->requiredType,(dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.effect_idx); + return false; + } + if (!spellEntry->EffectApplyAuraName[aura.effect_idx]) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.", + criteria->ID, criteria->requiredType,(dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id,aura.effect_idx); + return false; + } + return true; + } + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA: + if (!GetAreaEntryByAreaID(area.id)) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,area.id); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL: + if (level.minlevel < 0 || level.minlevel > STRONG_MAX_LEVEL) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,level.minlevel); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER: + if (gender.gender > GENDER_NONE) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,gender.gender); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: + if (difficulty.difficulty >= MAX_DIFFICULTY) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,difficulty.difficulty); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT: + if (map_players.maxcount <= 0) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,map_players.maxcount); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM: + if (team.team != ALLIANCE && team.team != HORDE) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,team.team); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK: + if (drunk.state >= MAX_DRUNKEN) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,drunk.state); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY: + if (!sHolidaysStore.LookupEntry(holiday.id)) + { + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,holiday.id); + return false; + } + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_BG_LOSS_TEAM_SCORE: + return true; // not check correctness node indexes + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM: + if (equipped_item.item_quality >= MAX_ITEM_QUALITY) + { + sLog.outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.", + criteria->ID, criteria->requiredType,dataType,equipped_item.item_quality); + return false; + } + return true; + default: + sLog.outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType,dataType); + return false; + } +} + +bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Unit const* target, uint32 miscvalue1 /*= 0*/) const +{ + switch(dataType) + { + case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE: + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE: + if (!target || target->GetTypeId() != TYPEID_UNIT) + return false; + return target->GetEntry() == creature.id; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE: + if (!target || target->GetTypeId() != TYPEID_PLAYER) + return false; + if (classRace.class_id && classRace.class_id != target->ToPlayer()->getClass()) + return false; + if (classRace.race_id && classRace.race_id != target->ToPlayer()->getRace()) + return false; + return true; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH: + if (!target || target->GetTypeId() != TYPEID_PLAYER) + return false; + return target->GetHealth()*100 <= health.percent*target->GetMaxHealth(); + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD: + if (!target || target->GetTypeId() != TYPEID_PLAYER || target->isAlive() || target->ToPlayer()->GetDeathTimer() == 0) + return false; + // flag set == must be same team, not set == different team + return (target->ToPlayer()->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0); + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA: + return source->HasAuraEffect(aura.spell_id,aura.effect_idx); + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA: + { + uint32 zone_id,area_id; + source->GetZoneAndAreaId(zone_id,area_id); + return area.id == zone_id || area.id == area_id; + } + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA: + return target && target->HasAuraEffect(aura.spell_id,aura.effect_idx); + case ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE: + return miscvalue1 >= value.minvalue; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL: + if (!target) + return false; + return target->getLevel() >= level.minlevel; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER: + if (!target) + return false; + return target->getGender() == gender.gender; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED: + return false; // always fail + case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: + return source->GetMap()->GetSpawnMode() == difficulty.difficulty; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT: + return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM: + if (!target || target->GetTypeId() != TYPEID_PLAYER) + return false; + return target->ToPlayer()->GetTeam() == team.team; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK: + return Player::GetDrunkenstateByValue(source->GetDrunkValue()) >= drunk.state; + case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY: + return IsHolidayActive(HolidayIds(holiday.id)); + case ACHIEVEMENT_CRITERIA_DATA_TYPE_BG_LOSS_TEAM_SCORE: + { + BattleGround* bg = source->GetBattleGround(); + if (!bg) + return false; + return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE,bg_loss_team_score.min_score,bg_loss_team_score.max_score); + } + case ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT: + { + if (!source->IsInWorld()) + return false; + Map* map = source->GetMap(); + if (!map->IsDungeon()) + { + sLog.outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u", + ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); + return false; + } + InstanceData* data = ((InstanceMap*)map)->GetInstanceData(); + if (!data) + { + sLog.outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", + ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); + return false; + } + return data->CheckAchievementCriteriaMeet(criteria_id, source, target, miscvalue1); + } + case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM: + { + ItemPrototype const *pProto = objmgr.GetItemPrototype(miscvalue1); + if (!pProto) + return false; + return pProto->ItemLevel >= equipped_item.item_level && pProto->Quality >= equipped_item.item_quality; + } + } + return false; +} + +bool AchievementCriteriaDataSet::Meets(Player const* source, Unit const* target, uint32 miscvalue /*= 0*/) const +{ + for (Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr) + if (!itr->Meets(criteria_id, source, target, miscvalue)) + return false; + + return true; +} + +AchievementMgr::AchievementMgr(Player *player) +{ + m_player = player; +} + +AchievementMgr::~AchievementMgr() +{ +} + +void AchievementMgr::Reset() +{ + for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter) + { + WorldPacket data(SMSG_ACHIEVEMENT_DELETED,4); + data << uint32(iter->first); + m_player->SendDirectMessage(&data); + } + + for (CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter != m_criteriaProgress.end(); ++iter) + { + WorldPacket data(SMSG_CRITERIA_DELETED,4); + data << uint32(iter->first); + m_player->SendDirectMessage(&data); + } + + m_completedAchievements.clear(); + m_criteriaProgress.clear(); + DeleteFromDB(m_player->GetGUIDLow()); + + // re-fill data + CheckAllAchievementCriteria(); +} + +void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2) +{ + if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES) == 0) + sLog.outDetail("AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2); + + if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER) + return; + + AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type); + for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i) + { + AchievementCriteriaEntry const *achievementCriteria = (*i); + + AchievementEntry const *achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); + if (!achievement) + continue; + + // don't update already completed criteria + if (IsCompletedCriteria(achievementCriteria,achievement)) + continue; + + switch (type) + { + case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE: // have total statistic also not expected to be reset + case ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE: // have total statistic also not expected to be reset + if (achievementCriteria->healing_done.flag == miscvalue1 && + achievementCriteria->healing_done.mapid == miscvalue2) + SetCriteriaProgress(achievementCriteria, 0, PROGRESS_SET); + break; + case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: // have total statistic also not expected to be reset + // reset only the criteria having the miscvalue1 condition + if (achievementCriteria->win_rated_arena.flag == miscvalue1) + SetCriteriaProgress(achievementCriteria, 0, PROGRESS_SET); + break; + default: // reset all cases + break; + } + } +} + +void AchievementMgr::DeleteFromDB(uint32 lowguid) +{ + CharacterDatabase.BeginTransaction (); + CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE guid = %u",lowguid); + CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE guid = %u",lowguid); + CharacterDatabase.CommitTransaction (); +} + +void AchievementMgr::SaveToDB() +{ + if (!m_completedAchievements.empty()) + { + bool need_execute = false; + std::ostringstream ssdel; + std::ostringstream ssins; + for (CompletedAchievementMap::iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter) + { + if (!iter->second.changed) + continue; + + /// first new/changed record prefix + if (!need_execute) + { + ssdel << "DELETE FROM character_achievement WHERE guid = " << GetPlayer()->GetGUIDLow() << " AND achievement IN ("; + ssins << "INSERT INTO character_achievement (guid, achievement, date) VALUES "; + need_execute = true; + } + /// next new/changed record prefix + else + { + ssdel << ", "; + ssins << ", "; + } + + // new/changed record data + ssdel << iter->first; + ssins << "("<GetGUIDLow() << ", " << iter->first << ", " << uint64(iter->second.date) << ")"; + + /// mark as saved in db + iter->second.changed = false; + } + + if (need_execute) + ssdel << ")"; + + if (need_execute) + { + CharacterDatabase.Execute(ssdel.str().c_str()); + CharacterDatabase.Execute(ssins.str().c_str()); + } + } + + if (!m_criteriaProgress.empty()) + { + /// prepare deleting and insert + bool need_execute_del = false; + bool need_execute_ins = false; + std::ostringstream ssdel; + std::ostringstream ssins; + for (CriteriaProgressMap::iterator iter = m_criteriaProgress.begin(); iter != m_criteriaProgress.end(); ++iter) + { + if (!iter->second.changed) + continue; + + // deleted data (including 0 progress state) + { + /// first new/changed record prefix (for any counter value) + if (!need_execute_del) + { + ssdel << "DELETE FROM character_achievement_progress WHERE guid = " << GetPlayer()->GetGUIDLow() << " AND criteria IN ("; + need_execute_del = true; + } + /// next new/changed record prefix + else + ssdel << ", "; + + // new/changed record data + ssdel << iter->first; + } + + // store data only for real progress + if (iter->second.counter != 0) + { + /// first new/changed record prefix + if (!need_execute_ins) + { + ssins << "INSERT INTO character_achievement_progress (guid, criteria, counter, date) VALUES "; + need_execute_ins = true; + } + /// next new/changed record prefix + else + ssins << ", "; + + // new/changed record data + ssins << "(" << GetPlayer()->GetGUIDLow() << ", " << iter->first << ", " << iter->second.counter << ", " << iter->second.date << ")"; + } + + /// mark as updated in db + iter->second.changed = false; + } + + if (need_execute_del) // DELETE ... IN (.... _)_ + ssdel << ")"; + + if (need_execute_del || need_execute_ins) + { + if (need_execute_del) + CharacterDatabase.Execute(ssdel.str().c_str()); + if (need_execute_ins) + CharacterDatabase.Execute(ssins.str().c_str()); + } + } +} + +void AchievementMgr::LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResult_AutoPtr criteriaResult) +{ + if (achievementResult) + { + do + { + Field *fields = achievementResult->Fetch(); + + uint32 achievement_id = fields[0].GetUInt32(); + + // don't must happen: cleanup at server startup in achievementmgr.LoadCompletedAchievements() + if (!sAchievementStore.LookupEntry(achievement_id)) + continue; + + CompletedAchievementData& ca = m_completedAchievements[achievement_id]; + ca.date = time_t(fields[1].GetUInt64()); + ca.changed = false; + } while (achievementResult->NextRow()); + } + + if (criteriaResult) + { + do + { + Field *fields = criteriaResult->Fetch(); + + uint32 id = fields[0].GetUInt32(); + uint32 counter = fields[1].GetUInt32(); + time_t date = time_t(fields[2].GetUInt64()); + + AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id); + if (!criteria) + { + // we will remove not existed criteria for all characters + sLog.outError("Non-existing achievement criteria %u data removed from table `character_achievement_progress`.",id); + CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE criteria = %u",id); + continue; + } + + if (criteria->timeLimit && time_t(date + criteria->timeLimit) < time(NULL)) + continue; + + CriteriaProgress& progress = m_criteriaProgress[id]; + progress.counter = counter; + progress.date = date; + progress.changed = false; + } while (criteriaResult->NextRow()); + } + +} + +void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) +{ + if (GetPlayer()->GetSession()->PlayerLoading()) + return; + + // Don't send for achievements with ACHIEVEMENT_FLAG_TRACKING + if (achievement->flags & ACHIEVEMENT_FLAG_TRACKING) + return; + + #ifdef TRINITY_DEBUG + if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES) == 0) + sLog.outDebug("AchievementMgr::SendAchievementEarned(%u)", achievement->ID); + #endif + + if (Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId())) + { + Trinity::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID); + Trinity::LocalizedPacketDo say_do(say_builder); + guild->BroadcastWorker(say_do,GetPlayer()); + } + + if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL|ACHIEVEMENT_FLAG_REALM_FIRST_REACH)) + { + // broadcast realm first reached + WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, strlen(GetPlayer()->GetName())+1+8+4+4); + data << GetPlayer()->GetName(); + data << uint64(GetPlayer()->GetGUID()); + data << uint32(achievement->ID); + data << uint32(0); // 1=link supplied string as player name, 0=display plain string + sWorld.SendGlobalMessage(&data); + } + // if player is in world he can tell his friends about new achievement + else if (GetPlayer()->IsInWorld()) + { + CellPair p = Trinity::ComputeCellPair(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); + + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::AchievementChatBuilder say_builder(*GetPlayer(), CHAT_MSG_ACHIEVEMENT, LANG_ACHIEVEMENT_EARNED,achievement->ID); + Trinity::LocalizedPacketDo say_do(say_builder); + Trinity::PlayerDistWorker > say_worker(GetPlayer(),sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do); + TypeContainerVisitor >, WorldTypeMapContainer > message(say_worker); + cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY)); + } + + WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8); + data.append(GetPlayer()->GetPackGUID()); + data << uint32(achievement->ID); + data << uint32(secsToTimeBitFields(time(NULL))); + data << uint32(0); + GetPlayer()->SendMessageToSetInRange(&data, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY), true); +} + +void AchievementMgr::SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted) +{ + WorldPacket data(SMSG_CRITERIA_UPDATE, 8+4+8); + data << uint32(entry->ID); + + // the counter is packed like a packed Guid + data.appendPackGUID(progress->counter); + + data.append(GetPlayer()->GetPackGUID()); + if (!entry->timeLimit) + data << uint32(0); + else + data << uint32(timedCompleted ? 0 : 1); // this are some flags, 1 is for keeping the counter at 0 in client + data << uint32(secsToTimeBitFields(progress->date)); + data << uint32(timeElapsed); // time elapsed in seconds + data << uint32(0); // unk + GetPlayer()->SendDirectMessage(&data); +} + +/** + * called at player login. The player might have fulfilled some achievements when the achievement system wasn't working yet + */ +void AchievementMgr::CheckAllAchievementCriteria() +{ + // suppress sending packets + for (uint32 i=0; iGetSession()->GetSecurity() > SEC_PLAYER) + return; + + AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetAchievementCriteriaByType(type); + for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i) + { + AchievementCriteriaEntry const *achievementCriteria = (*i); + + AchievementEntry const *achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); + if (!achievement) + continue; + + if ((achievement->factionFlag == ACHIEVEMENT_FACTION_HORDE && GetPlayer()->GetTeam() != HORDE) || + (achievement->factionFlag == ACHIEVEMENT_FACTION_ALLIANCE && GetPlayer()->GetTeam() != ALLIANCE)) + continue; + + // don't update already completed criteria + if (IsCompletedCriteria(achievementCriteria,achievement)) + continue; + + switch (type) + { + // std. case: increment at 1 + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST: + case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: + case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: + case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION: + case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS: /* FIXME: for online player only currently */ + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: + case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED: + case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN: + case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + // std case: increment at miscvalue1 + case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS: + case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL: + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:/* FIXME: for online player only currently */ + case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED: + case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE); + break; + // std case: high value at miscvalue1 + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD: /* FIXME: for online player only currently */ + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_HIGHEST); + break; + + // specialized cases + + case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: + { + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + if (achievementCriteria->win_bg.bgMapID != GetPlayer()->GetMapId()) + continue; + + if (achievementCriteria->win_bg.additionalRequirement1_type) + { + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(),unit)) + continue; + } + // some hardcoded requirements + else + { + BattleGround* bg = GetPlayer()->GetBattleGround(); + if (!bg) + continue; + + switch(achievementCriteria->referredAchievement) + { + case 161: // AB, Overcome a 500 resource disadvantage + { + if (bg->GetTypeID(true) != BATTLEGROUND_AB) + continue; + if (!((BattleGroundAB*)bg)->IsTeamScores500Disadvantage(GetPlayer()->GetTeam())) + continue; + break; + } + case 156: // AB, win while controlling all 5 flags (all nodes) + case 784: // EY, win while holding 4 bases (all nodes) + { + if (!bg->IsAllNodesConrolledByTeam(GetPlayer()->GetTeam())) + continue; + break; + } + case 1762: // SA, win without losing any siege vehicles + case 2192: // SA, win without losing any siege vehicles + continue; // not implemented + } + } + + SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: + { + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + if (achievementCriteria->kill_creature.creatureID != miscvalue1) + continue; + + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(),unit)) + continue; + + SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL: + SetCriteriaProgress(achievementCriteria, GetPlayer()->getLevel()); + break; + case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: + // update at loading or specific skill update + if (miscvalue1 && miscvalue1 != achievementCriteria->reach_skill_level.skillID) + continue; + if (uint32 skillvalue = GetPlayer()->GetBaseSkillValue(achievementCriteria->reach_skill_level.skillID)) + SetCriteriaProgress(achievementCriteria, skillvalue); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: + // update at loading or specific skill update + if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_level.skillID) + continue; + if (uint32 maxSkillvalue = GetPlayer()->GetPureMaxSkillValue(achievementCriteria->learn_skill_level.skillID)) + SetCriteriaProgress(achievementCriteria, maxSkillvalue); + break; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: + if (m_completedAchievements.find(achievementCriteria->complete_achievement.linkedAchievement) != m_completedAchievements.end()) + SetCriteriaProgress(achievementCriteria, 1); + break; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT: + { + uint32 counter =0; + for (QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr != GetPlayer()->getQuestStatusMap().end(); itr++) + if (itr->second.m_rewarded) + counter++; + SetCriteriaProgress(achievementCriteria, counter); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY: + { + time_t nextDailyResetTime = sWorld.GetNextDailyQuestsResetTime(); + CriteriaProgress *progress = GetCriteriaProgress(achievementCriteria); + + if (!miscvalue1) // Login case. + { + // reset if player missed one day. + if (progress && progress->date < (nextDailyResetTime - 2 * DAY)) + SetCriteriaProgress(achievementCriteria, 0, PROGRESS_SET); + continue; + } + + ProgressType progressType; + if (!progress) + // 1st time. Start count. + progressType = PROGRESS_SET; + else if (progress->date < (nextDailyResetTime - 2 * DAY)) + // last progress is older than 2 days. Player missed 1 day => Retart count. + progressType = PROGRESS_SET; + else if (progress->date < (nextDailyResetTime - DAY)) + // last progress is between 1 and 2 days. => 1st time of the day. + progressType = PROGRESS_ACCUMULATE; + else + // last progress is within the day before the reset => Already counted today. + continue; + + SetCriteriaProgress(achievementCriteria, 1, progressType); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: + { + // speedup for non-login case + if (miscvalue1 && miscvalue1 != achievementCriteria->complete_quests_in_zone.zoneID) + continue; + + uint32 counter =0; + for (QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr != GetPlayer()->getQuestStatusMap().end(); itr++) + { + Quest const* quest = objmgr.GetQuestTemplate(itr->first); + if (itr->second.m_rewarded && quest && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID) + counter++; + } + SetCriteriaProgress(achievementCriteria, counter); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + if (GetPlayer()->GetMapId() != achievementCriteria->complete_battleground.mapID) + continue; + SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + if (GetPlayer()->GetMapId() != achievementCriteria->death_at_map.mapID) + continue; + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_DEATH: + { + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + // skip wrong arena achievements, if not achievIdByArenaSlot then normal total death counter + bool notfit = false; + for (int j = 0; j < MAX_ARENA_SLOT; ++j) + { + if (achievIdByArenaSlot[j] == achievement->ID) + { + BattleGround* bg = GetPlayer()->GetBattleGround(); + if (!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j) + notfit = true; + + break; + } + } + if (notfit) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON: + { + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + + Map const* map = GetPlayer()->IsInWorld() ? GetPlayer()->GetMap() : sMapMgr.FindMap(GetPlayer()->GetMapId(), GetPlayer()->GetInstanceId()); + if (!map || !map->IsDungeon()) + continue; + + // search case + bool found = false; + for (int j = 0; achievIdForDangeon[j][0]; ++j) + { + if (achievIdForDangeon[j][0] == achievement->ID) + { + if (map->IsRaid()) + { + // if raid accepted (ignore difficulty) + if (!achievIdForDangeon[j][2]) + break; // for + } + else if (GetPlayer()->GetDungeonDifficulty() == DUNGEON_DIFFICULTY_NORMAL) + { + // dungeon in normal mode accepted + if (!achievIdForDangeon[j][1]) + break; // for + } + else + { + // dungeon in heroic mode accepted + if (!achievIdForDangeon[j][3]) + break; // for + } + + found = true; + break; // for + } + } + if (!found) + continue; + + //FIXME: work only for instances where max == min for players + if (((InstanceMap*)map)->GetMaxPlayers() != achievementCriteria->death_in_dungeon.manLimit) + continue; + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + + } + case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + if (miscvalue1 != achievementCriteria->killed_by_creature.creatureEntry) + continue; + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + + // if team check required: must kill by opposition faction + if (achievement->ID == 318 && miscvalue2 == GetPlayer()->GetTeam()) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING: + { + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(),unit)) + continue; + + // miscvalue1 is the ingame fallheight*100 as stored in dbc + SetCriteriaProgress(achievementCriteria, miscvalue1); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + if (miscvalue2 != achievementCriteria->death_from.type) + continue; + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: + { + // if miscvalues != 0, it contains the questID. + if (miscvalue1) + { + if (miscvalue1 != achievementCriteria->complete_quest.questID) + continue; + } + else + { + // login case. + if (!GetPlayer()->GetQuestRewardStatus(achievementCriteria->complete_quest.questID)) + continue; + } + + // exist many achievements with this criteria, use at this moment hardcoded check to skil simple case + switch(achievement->ID) + { + case 31: + case 1275: + case 1276: + case 1277: + case 1282: + case 1789: + { + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(),unit)) + continue; + break; + } + default: + break; + } + + SetCriteriaProgress(achievementCriteria, 1); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: + { + if (!miscvalue1 || miscvalue1 != achievementCriteria->be_spell_target.spellID) + continue; + + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data) + continue; + + if (!data->Meets(GetPlayer(),unit)) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: + { + if (!miscvalue1 || miscvalue1 != achievementCriteria->cast_spell.spellID) + continue; + + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data) + continue; + + if (!data->Meets(GetPlayer(),unit)) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: + if (miscvalue1 && miscvalue1 != achievementCriteria->learn_spell.spellID) + continue; + + if (GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID)) + SetCriteriaProgress(achievementCriteria, 1); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + { + // miscvalue1=loot_type (note: 0 = LOOT_CORSPE and then it ignored) + // miscvalue2=count of item loot + if (!miscvalue1 || !miscvalue2) + continue; + if (miscvalue1 != achievementCriteria->loot_type.lootType) + continue; + + // zone specific + if (achievementCriteria->loot_type.lootTypeCount == 1) + { + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(),unit)) + continue; + } + + SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: + // speedup for non-login case + if (miscvalue1 && achievementCriteria->own_item.itemID != miscvalue1) + continue; + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetItemCount(achievementCriteria->own_item.itemID, true)); + break; + case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: + // miscvalue1 contains the personal rating + if (!miscvalue1) // no update at login + continue; + + // additional requirements + if (achievementCriteria->win_rated_arena.flag == ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE) + { + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(),unit,miscvalue1)) + { + // reset the progress as we have a win without the requirement. + SetCriteriaProgress(achievementCriteria, 0); + continue; + } + } + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + if (achievementCriteria->use_item.itemID != miscvalue1) + continue; + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: + // You _have_ to loot that item, just owning it when logging in does _not_ count! + if (!miscvalue1) + continue; + if (miscvalue1 != achievementCriteria->own_item.itemID) + continue; + SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA: + { + WorldMapOverlayEntry const* worldOverlayEntry = sWorldMapOverlayStore.LookupEntry(achievementCriteria->explore_area.areaReference); + if (!worldOverlayEntry) + break; + + bool matchFound = false; + for (int j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j) + { + uint32 area_id = worldOverlayEntry->areatableID[j]; + if (!area_id) // array have 0 only in empty tail + break; + + int32 exploreFlag = GetAreaFlagByAreaID(area_id); + if (exploreFlag < 0) + continue; + + uint32 playerIndexOffset = uint32(exploreFlag) / 32; + uint32 mask = 1<< (uint32(exploreFlag) % 32); + + if (GetPlayer()->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + playerIndexOffset) & mask) + { + matchFound = true; + break; + } + } + + if (matchFound) + SetCriteriaProgress(achievementCriteria, 1); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT: + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetBankBagSlotCount()); + break; + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: + { + // skip faction check only at loading + if (miscvalue1 && miscvalue1 != achievementCriteria->gain_reputation.factionID) + continue; + + int32 reputation = GetPlayer()->GetReputationMgr().GetReputation(achievementCriteria->gain_reputation.factionID); + if (reputation > 0) + SetCriteriaProgress(achievementCriteria, reputation); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION: + { + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetExaltedFactionCount()); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP: + { + // skip for login case + if (!miscvalue1) + continue; + SetCriteriaProgress(achievementCriteria, 1); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: + { + // miscvalue1 = itemid + // miscvalue2 = itemSlot + if (!miscvalue1) + continue; + + if (miscvalue2 != achievementCriteria->equip_epic_item.itemSlot) + continue; + + // check item level and quality via achievement_criteria_data + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(), 0, miscvalue1)) + continue; + + SetCriteriaProgress(achievementCriteria, 1); + break; + } + + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT: + { + // miscvalue1 = itemid + // miscvalue2 = diced value + if (!miscvalue1) + continue; + if (miscvalue2 != achievementCriteria->roll_greed_on_loot.rollValue) + continue; + + ItemPrototype const *pProto = objmgr.GetItemPrototype(miscvalue1); + if (!pProto) + continue; + + // check item level via achievement_criteria_data + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(), 0, pProto->ItemLevel)) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: + { + // miscvalue1 = emote + if (!miscvalue1) + continue; + if (miscvalue1 != achievementCriteria->do_emote.emoteID) + continue; + if (achievementCriteria->do_emote.count) + { + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data || !data->Meets(GetPlayer(),unit)) + continue; + } + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE: + case ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE: + { + if (!miscvalue1) + continue; + + if (achievementCriteria->healing_done.flag == ACHIEVEMENT_CRITERIA_CONDITION_MAP) + { + if (GetPlayer()->GetMapId() != achievementCriteria->healing_done.mapid) + continue; + + // map specific case (BG in fact) expected player targeted damage/heal + if (!unit || unit->GetTypeId() != TYPEID_PLAYER) + continue; + } + + SetCriteriaProgress(achievementCriteria, miscvalue1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: + // miscvalue1 = item_id + if (!miscvalue1) + continue; + if (miscvalue1 != achievementCriteria->equip_item.itemID) + continue; + + SetCriteriaProgress(achievementCriteria, 1); + break; + case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: + // miscvalue1 = go entry + if (!miscvalue1) + continue; + if (miscvalue1 != achievementCriteria->use_gameobject.goEntry) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: + if (!miscvalue1) + continue; + if (miscvalue1 != achievementCriteria->fish_in_gameobject.goEntry) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: + { + if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skillline_spell.skillLine) + continue; + + uint32 spellCount = 0; + for (PlayerSpellMap::const_iterator spellIter = GetPlayer()->GetSpellMap().begin(); + spellIter != GetPlayer()->GetSpellMap().end(); + ++spellIter) + { + SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellIter->first); + for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter) + { + if (skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine) + spellCount++; + } + } + SetCriteriaProgress(achievementCriteria, spellCount); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + + if (achievementCriteria->win_duel.duelCount) + { + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if (!data) + continue; + + if (!data->Meets(GetPlayer(),unit)) + continue; + } + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION: + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetReveredFactionCount()); + break; + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION: + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetHonoredFactionCount()); + break; + case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS: + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetReputationMgr().GetVisibleFactionCount()); + break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM: + { + // AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case + if (!miscvalue1) + continue; + ItemPrototype const* proto = ObjectMgr::GetItemPrototype(miscvalue1); + if (!proto || proto->Quality < ITEM_QUALITY_EPIC) + continue; + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: + { + if (miscvalue1 && miscvalue1 != achievementCriteria->learn_skill_line.skillLine) + continue; + + uint32 spellCount = 0; + for (PlayerSpellMap::const_iterator spellIter = GetPlayer()->GetSpellMap().begin(); + spellIter != GetPlayer()->GetSpellMap().end(); + ++spellIter) + { + SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(spellIter->first); + for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter) + if (skillIter->second->skillId == achievementCriteria->learn_skill_line.skillLine) + spellCount++; + } + SetCriteriaProgress(achievementCriteria, spellCount); + break; + } + case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL: + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS)); + break; + case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: + if (!miscvalue1 || miscvalue1 != achievementCriteria->hk_class.classID) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: + if (!miscvalue1 || miscvalue1 != achievementCriteria->hk_race.raceID) + continue; + + SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + break; + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED: + SetCriteriaProgress(achievementCriteria, GetPlayer()->GetMoney(), PROGRESS_HIGHEST); + break; + // std case: not exist in DBC, not triggered in code as result + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING: + break; + // FIXME: not triggered in code as result, need to implement + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID: + case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE: + case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA: + case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA: + case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA: + case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING: + case ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING: + case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK: + case ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS: + case ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL: + case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE: + case ACHIEVEMENT_CRITERIA_TYPE_TOTAL: + case ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS: + case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS: + break; // Not implemented yet :( + } + if (IsCompletedCriteria(achievementCriteria,achievement)) + CompletedCriteriaFor(achievement); + + // check again the completeness for SUMM and REQ COUNT achievements, + // as they don't depend on the completed criteria but on the sum of the progress of each individual criteria + if (achievement->flags & ACHIEVEMENT_FLAG_SUMM) + { + if (IsCompletedAchievement(achievement)) + CompletedAchievement(achievement); + } + + if (AchievementEntryList const* achRefList = achievementmgr.GetAchievementByReferencedId(achievement->ID)) + { + for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) + if (IsCompletedAchievement(*itr)) + CompletedAchievement(*itr); + } + } +} + +static const uint32 achievIdByClass[MAX_CLASSES] = { 0, 459, 465 , 462, 458, 464, 461, 467, 460, 463, 0, 466 }; +static const uint32 achievIdByRace[MAX_RACES] = { 0, 1408, 1410, 1407, 1409, 1413, 1411, 1404, 1412, 0, 1405, 1406 }; + +bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement) +{ + // counter can never complete + if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER) + return false; + + if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL)) + { + // someone on this realm has already completed that achievement + if (achievementmgr.IsRealmCompleted(achievement)) + return false; + } + + CriteriaProgress const* progress = GetCriteriaProgress(achievementCriteria); + if (!progress) + return false; + + + switch(achievementCriteria->requiredType) + { + case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: + return progress->counter >= achievementCriteria->win_bg.winCount; + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: + return progress->counter >= achievementCriteria->kill_creature.creatureCount; + case ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL: + { + // skip wrong class achievements + for (int i = 1; i < MAX_CLASSES; ++i) + if (achievIdByClass[i] == achievement->ID && i != GetPlayer()->getClass()) + return false; + + // skip wrong race achievements + for (int i = 1; i < MAX_RACES; ++i) + if (achievIdByRace[i] == achievement->ID && i != GetPlayer()->getRace()) + return false; + + // appropriate class/race or not class/race specific + return progress->counter >= achievementCriteria->reach_level.level; + } + case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: + return progress->counter >= achievementCriteria->reach_skill_level.skillLevel; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: + return progress->counter >= 1; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT: + return progress->counter >= achievementCriteria->complete_quest_count.totalQuestCount; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY: + return progress->counter >= achievementCriteria->complete_daily_quest_daily.numberOfDays; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: + return progress->counter >= achievementCriteria->complete_quests_in_zone.questCount; + case ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE: + case ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE: + return progress->counter >= achievementCriteria->healing_done.count; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST: + return progress->counter >= achievementCriteria->complete_daily_quest.questCount; + case ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING: + return progress->counter >= achievementCriteria->fall_without_dying.fallHeight; + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: + return progress->counter >= 1; + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: + return progress->counter >= achievementCriteria->be_spell_target.spellCount; + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: + return progress->counter >= achievementCriteria->cast_spell.castCount; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: + return progress->counter >= 1; + case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: + return progress->counter >= achievementCriteria->own_item.itemCount; + case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: + return progress->counter >= achievementCriteria->win_rated_arena.count; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: + return progress->counter >= (achievementCriteria->learn_skill_level.skillLevel * 75); + case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: + return progress->counter >= achievementCriteria->use_item.itemCount; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: + return progress->counter >= achievementCriteria->loot_item.itemCount; + case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA: + return progress->counter >= 1; + case ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT: + return progress->counter >= achievementCriteria->buy_bank_slot.numberOfSlots; + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: + return progress->counter >= achievementCriteria->gain_reputation.reputationAmount; + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION: + return progress->counter >= achievementCriteria->gain_exalted_reputation.numberOfExaltedFactions; + case ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP: + return progress->counter >= achievementCriteria->visit_barber.numberOfVisits; + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: + return progress->counter >= achievementCriteria->equip_epic_item.count; + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT: + return progress->counter >= achievementCriteria->roll_greed_on_loot.count; + case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS: + return progress->counter >= achievementCriteria->hk_class.count; + case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE: + return progress->counter >= achievementCriteria->hk_race.count; + case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: + return progress->counter >= achievementCriteria->do_emote.count; + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: + return progress->counter >= achievementCriteria->equip_item.count; + case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD: + return progress->counter >= achievementCriteria->quest_reward_money.goldInCopper; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY: + return progress->counter >= achievementCriteria->loot_money.goldInCopper; + case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: + return progress->counter >= achievementCriteria->use_gameobject.useCount; + case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT: + return progress->counter >= achievementCriteria->fish_in_gameobject.lootCount; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS: + return progress->counter >= achievementCriteria->learn_skillline_spell.spellCount; + case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: + return progress->counter >= achievementCriteria->win_duel.duelCount; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + return progress->counter >= achievementCriteria->loot_type.lootTypeCount; + case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE: + return progress->counter >= achievementCriteria->learn_skill_line.spellCount; + case ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL: + return progress->counter >= achievementCriteria->honorable_kill.killCount; + // handle all statistic-only criteria here + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND: + case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP: + case ACHIEVEMENT_CRITERIA_TYPE_DEATH: + case ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON: + case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE: + case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER: + case ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM: + case ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS: + case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL: + case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: + case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS: + case ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED: + case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS: + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION: + case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION: + case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS: + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER: + case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR: + case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED: + case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN: + case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS: + return false; + } + return false; +} + +void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement) +{ + // counter can never complete + if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER) + return; + + // already completed and stored + if (HasAchieved(achievement)) + return; + + if (IsCompletedAchievement(achievement)) + CompletedAchievement(achievement); +} + +bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry) +{ + // counter can never complete + if (entry->flags & ACHIEVEMENT_FLAG_COUNTER) + return false; + + // for achievement with referenced achievement criterias get from referenced and counter from self + uint32 achievmentForTestId = entry->refAchievement ? entry->refAchievement : entry->ID; + uint32 achievmentForTestCount = entry->count; + + AchievementCriteriaEntryList const* cList = achievementmgr.GetAchievementCriteriaByAchievement(achievmentForTestId); + if (!cList) + return false; + uint32 count = 0; + + // For SUMM achievements, we have to count the progress of each criteria of the achievement. + // Oddly, the target count is NOT countained in the achievement, but in each individual criteria + if (entry->flags & ACHIEVEMENT_FLAG_SUMM) + { + for (AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr) + { + AchievementCriteriaEntry const* criteria = *itr; + + CriteriaProgress const* progress = GetCriteriaProgress(criteria); + if (!progress) + continue; + + count += progress->counter; + + // for counters, field4 contains the main count requirement + if (count >= criteria->raw.count) + return true; + } + return false; + } + + // Default case - need complete all or + bool completed_all = true; + for (AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr) + { + AchievementCriteriaEntry const* criteria = *itr; + + bool completed = IsCompletedCriteria(criteria,entry); + + // found an uncompleted criteria, but DONT return false yet - there might be a completed criteria with ACHIEVEMENT_CRITERIA_COMPLETE_FLAG_ALL + if (completed) + ++count; + else + completed_all = false; + + // completed as have req. count of completed criterias + if (achievmentForTestCount > 0 && achievmentForTestCount <= count) + return true; + } + + // all criterias completed requirement + if (completed_all && achievmentForTestCount == 0) + return true; + + return false; +} + +CriteriaProgress* AchievementMgr::GetCriteriaProgress(AchievementCriteriaEntry const* entry) +{ + CriteriaProgressMap::iterator iter = m_criteriaProgress.find(entry->ID); + + if (iter == m_criteriaProgress.end()) + return NULL; + + return &(iter->second); +} + +void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype) +{ + // Don't allow to cheat - doing timed achievements without timer active + TimedAchievementMap::iterator timedIter = m_timedAchievements.find(entry->ID); + if (entry->timeLimit && timedIter == m_timedAchievements.end()) + return; + + if ((sLog.getLogFilter() & LOG_FILTER_ACHIEVEMENT_UPDATES) == 0) + sLog.outDetail("AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow()); + + CriteriaProgress* progress = GetCriteriaProgress(entry); + if (!progress) + { + // not create record for 0 counter but allow it for timed achievements + // we will need to send 0 progress to client to start the timer + if (changeValue == 0 && !entry->timeLimit) + return; + + progress = &m_criteriaProgress[entry->ID]; + progress->counter = changeValue; + } + else + { + uint32 newValue = 0; + switch(ptype) + { + case PROGRESS_SET: + newValue = changeValue; + break; + case PROGRESS_ACCUMULATE: + { + // avoid overflow + uint32 max_value = std::numeric_limits::max(); + newValue = max_value - progress->counter > changeValue ? progress->counter + changeValue : max_value; + break; + } + case PROGRESS_HIGHEST: + newValue = progress->counter < changeValue ? changeValue : progress->counter; + break; + } + + // not update (not mark as changed) if counter will have same value + if (progress->counter == newValue && !entry->timeLimit) + return; + + progress->counter = newValue; + } + + progress->changed = true; + progress->date = time(NULL); // set the date to the latest update. + + uint32 timeElapsed = 0; + bool timedCompleted = false; + + if (entry->timeLimit) + { + //has to exist else we wouldn't be here + timedCompleted = IsCompletedCriteria(entry, sAchievementStore.LookupEntry(entry->referredAchievement)); + // Client expects this in packet + timeElapsed = entry->timeLimit - (timedIter->second/IN_MILLISECONDS); + + // Remove the timer, we wont need it anymore + if (timedCompleted) + m_timedAchievements.erase(timedIter); + } + + SendCriteriaUpdate(entry, progress, timeElapsed, timedCompleted); +} + +void AchievementMgr::UpdateTimedAchievements(uint32 timeDiff) +{ + if (!m_timedAchievements.empty()) + { + for (TimedAchievementMap::iterator itr = m_timedAchievements.begin(); itr != m_timedAchievements.end();) + { + // Time is up, remove timer and reset progress + if (itr->second <= timeDiff) + { + AchievementCriteriaEntry const *entry = sAchievementCriteriaStore.LookupEntry(itr->first); + SetCriteriaProgress(entry, 0, PROGRESS_SET); + m_timedAchievements.erase(itr++); + } + else + { + itr->second -= timeDiff; + ++itr; + } + } + } +} + +void AchievementMgr::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) +{ + AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetTimedAchievementCriteriaByType(type); + for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i) + { + if ((*i)->timerStartEvent != entry) + continue; + + AchievementEntry const *achievement = sAchievementStore.LookupEntry((*i)->referredAchievement); + if (m_timedAchievements.find((*i)->ID) == m_timedAchievements.end() && !IsCompletedCriteria(*i, achievement)) + { + // Start the timer + m_timedAchievements[(*i)->ID] = (*i)->timeLimit * IN_MILLISECONDS; + + // and at client too + SetCriteriaProgress(*i, 0, PROGRESS_SET); + } + } +} + +void AchievementMgr::RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) +{ + AchievementCriteriaEntryList const& achievementCriteriaList = achievementmgr.GetTimedAchievementCriteriaByType(type); + for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i!=achievementCriteriaList.end(); ++i) + { + if ((*i)->timerStartEvent != entry) + continue; + + TimedAchievementMap::iterator timedIter = m_timedAchievements.find((*i)->ID); + // We don't have timer for this achievement + if (timedIter == m_timedAchievements.end()) + continue; + + // 0 the progress to avoid saving to db + SetCriteriaProgress(*i, 0, PROGRESS_SET); + + // Remove the timer + m_timedAchievements.erase(timedIter); + } +} + +void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) +{ + sLog.outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID); + + if (!sWorld.getConfig(CONFIG_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER) + return; + + if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER || HasAchieved(achievement)) + return; + + /* WowArmory Feed Log */ + GetPlayer()->WriteWowArmoryDatabaseLog(1, achievement->ID); + SendAchievementEarned(achievement); + CompletedAchievementData& ca = m_completedAchievements[achievement->ID]; + ca.date = time(NULL); + ca.changed = true; + + // don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement + // TODO: where do set this instead? + if (!(achievement->flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL)) + achievementmgr.SetRealmCompleted(achievement); + + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT); + + // reward items and titles if any + AchievementReward const* reward = achievementmgr.GetAchievementReward(achievement); + + // no rewards + if (!reward) + return; + + // titles + if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == ALLIANCE ? 0 : 1]) + { + if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) + GetPlayer()->SetTitle(titleEntry); + } + + // mail + if (reward->sender) + { + Item* item = reward->itemId ? Item::CreateItem(reward->itemId,1,GetPlayer ()) : NULL; + + int loc_idx = GetPlayer()->GetSession()->GetSessionDbLocaleIndex(); + + // subject and text + std::string subject = reward->subject; + std::string text = reward->text; + if (loc_idx >= 0) + { + if (AchievementRewardLocale const* loc = achievementmgr.GetAchievementRewardLocale(achievement)) + { + if (loc->subject.size() > size_t(loc_idx) && !loc->subject[loc_idx].empty()) + subject = loc->subject[loc_idx]; + if (loc->text.size() > size_t(loc_idx) && !loc->text[loc_idx].empty()) + text = loc->text[loc_idx]; + } + } + + MailDraft draft(subject, text); + + if (item) + { + // save new item before send + item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted + + // item + draft.AddItem(item); + } + + draft.SendMailTo(GetPlayer(), MailSender(MAIL_CREATURE, reward->sender)); + } +} + +void AchievementMgr::SendAllAchievementData() +{ + WorldPacket data(SMSG_ALL_ACHIEVEMENT_DATA, m_completedAchievements.size()*8+4+m_criteriaProgress.size()*38+4); + BuildAllDataPacket(&data); + GetPlayer()->GetSession()->SendPacket(&data); +} + +void AchievementMgr::SendRespondInspectAchievements(Player* player) +{ + WorldPacket data(SMSG_RESPOND_INSPECT_ACHIEVEMENTS, 9+m_completedAchievements.size()*8+4+m_criteriaProgress.size()*38+4); + data.append(GetPlayer()->GetPackGUID()); + BuildAllDataPacket(&data); + player->GetSession()->SendPacket(&data); +} + +/** + * used by SMSG_RESPOND_INSPECT_ACHIEVEMENT and SMSG_ALL_ACHIEVEMENT_DATA + */ +void AchievementMgr::BuildAllDataPacket(WorldPacket *data) +{ + AchievementEntry const *achievement; + for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter) + { + // Skip tracking - they bug client UI + achievement = sAchievementStore.LookupEntry(iter->first); + if (achievement->flags & ACHIEVEMENT_FLAG_TRACKING) + continue; + + *data << uint32(iter->first); + *data << uint32(secsToTimeBitFields(iter->second.date)); + } + *data << int32(-1); + + for (CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter != m_criteriaProgress.end(); ++iter) + { + *data << uint32(iter->first); + data->appendPackGUID(iter->second.counter); + data->append(GetPlayer()->GetPackGUID()); + *data << uint32(0); + *data << uint32(secsToTimeBitFields(iter->second.date)); + *data << uint32(0); + *data << uint32(0); + } + + *data << int32(-1); +} + +bool AchievementMgr::HasAchieved(AchievementEntry const* achievement) const +{ + return m_completedAchievements.find(achievement->ID) != m_completedAchievements.end(); +} + +//========================================================== +AchievementCriteriaEntryList const& AchievementGlobalMgr::GetAchievementCriteriaByType(AchievementCriteriaTypes type) +{ + return m_AchievementCriteriasByType[type]; +} + +AchievementCriteriaEntryList const& AchievementGlobalMgr::GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type) +{ + return m_AchievementCriteriasByTimedType[type]; +} + +void AchievementGlobalMgr::LoadAchievementCriteriaList() +{ + if (sAchievementCriteriaStore.GetNumRows() == 0) + { + barGoLink bar(1); + bar.step(); + + sLog.outString(); + sLog.outErrorDb(">> Loaded 0 achievement criteria."); + return; + } + + barGoLink bar(sAchievementCriteriaStore.GetNumRows()); + for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId) + { + bar.step(); + + AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId); + if (!criteria) + continue; + + m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria); + m_AchievementCriteriaListByAchievement[criteria->referredAchievement].push_back(criteria); + + if (criteria->timeLimit) + m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria); + } + + sLog.outString(); + sLog.outString(">> Loaded %lu achievement criteria.",(unsigned long)m_AchievementCriteriasByType->size()); +} + +void AchievementGlobalMgr::LoadAchievementReferenceList() +{ + if (sAchievementStore.GetNumRows() == 0) + { + barGoLink bar(1); + bar.step(); + + sLog.outString(); + sLog.outErrorDb(">> Loaded 0 achievement references."); + return; + } + + uint32 count = 0; + barGoLink bar(sAchievementStore.GetNumRows()); + for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId) + { + bar.step(); + + AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId); + if (!achievement || !achievement->refAchievement) + continue; + + m_AchievementListByReferencedId[achievement->refAchievement].push_back(achievement); + ++count; + } + + sLog.outString(); + sLog.outString(">> Loaded %u achievement references.",count); +} + +void AchievementGlobalMgr::LoadAchievementCriteriaData() +{ + m_criteriaDataMap.clear(); // need for reload case + + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_data"); + + if (!result) + { + barGoLink bar(1); + bar.step(); + + sLog.outString(); + sLog.outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); + return; + } + + uint32 count = 0; + uint32 disabled_count = 0; + barGoLink bar(result->GetRowCount()); + do + { + bar.step(); + Field *fields = result->Fetch(); + uint32 criteria_id = fields[0].GetUInt32(); + + AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(criteria_id); + + if (!criteria) + { + sLog.outErrorDb("Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id); + continue; + } + + AchievementCriteriaData data(fields[1].GetUInt32(),fields[2].GetUInt32(),fields[3].GetUInt32()); + + if (!data.IsValid(criteria)) + { + continue; + } + + // this will allocate empty data set storage + AchievementCriteriaDataSet& dataSet = m_criteriaDataMap[criteria_id]; + dataSet.SetCriteriaId(criteria_id); + + if (data.dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED) + ++disabled_count; + + // add real data only for not NONE data types + if (data.dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE) + dataSet.Add(data); + + // counting data by and data types + ++count; + } while (result->NextRow()); + + // post loading checks + for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId) + { + AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId); + if (!criteria) + continue; + + switch(criteria->requiredType) + { + case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: + if (!criteria->win_bg.additionalRequirement1_type) + continue; + break; + case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: + break; // any cases + case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: + { + AchievementEntry const* achievement = sAchievementStore.LookupEntry(criteria->referredAchievement); + if (!achievement) + continue; + + // exist many achievements with this criteria, use at this moment hardcoded check to skil simple case + switch(achievement->ID) + { + case 31: + case 1275: + case 1276: + case 1277: + case 1282: + case 1789: + break; + default: + continue; + } + } + case ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING: + break; // any cases + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET: // any cases + break; + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: // any cases + break; + case ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA: // need skip generic cases + if (criteria->win_rated_arena.flag != ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE) + continue; + break; + case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: // any cases + break; + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT: + break; // any cases + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT: + break; // any cases + case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases + if (criteria->do_emote.count == 0) + continue; + break; + case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2: + break; // any cases + case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: // skip statistics + if (criteria->win_duel.duelCount == 0) + continue; + break; + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: // any cases + break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: // need skip generic cases + if (criteria->loot_type.lootTypeCount != 1) + continue; + break; + default: // type not use DB data, ignore + continue; + } + + if (!GetCriteriaDataSet(criteria)) + sLog.outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); + } + + sLog.outString(); + sLog.outString(">> Loaded %u additional achievement criteria data (%u disabled).",count,disabled_count); +} + +void AchievementGlobalMgr::LoadCompletedAchievements() +{ + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement"); + + if (!result) + { + barGoLink bar(1); + bar.step(); + + sLog.outString(); + sLog.outString(">> Loaded 0 realm completed achievements . DB table `character_achievement` is empty."); + return; + } + + barGoLink bar(result->GetRowCount()); + do + { + bar.step(); + Field *fields = result->Fetch(); + + uint32 achievement_id = fields[0].GetUInt32(); + if (!sAchievementStore.LookupEntry(achievement_id)) + { + // we will remove not existed achievement for all characters + sLog.outError("Non-existing achievement %u data removed from table `character_achievement`.",achievement_id); + CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE achievement = %u",achievement_id); + continue; + } + + m_allCompletedAchievements.insert(achievement_id); + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %lu realm completed achievements.",(unsigned long)m_allCompletedAchievements.size()); +} + +void AchievementGlobalMgr::LoadRewards() +{ + m_achievementRewards.clear(); // need for reload case + + // 0 1 2 3 4 5 6 + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward"); + + if (!result) + { + barGoLink bar(1); + + bar.step(); + + sLog.outString(); + sLog.outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); + return; + } + + uint32 count = 0; + barGoLink bar(result->GetRowCount()); + + do + { + bar.step(); + + Field *fields = result->Fetch(); + uint32 entry = fields[0].GetUInt32(); + const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry); + if (!pAchievement) + { + sLog.outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry); + continue; + } + + AchievementReward reward; + reward.titleId[0] = fields[1].GetUInt32(); + reward.titleId[1] = fields[2].GetUInt32(); + reward.itemId = fields[3].GetUInt32(); + reward.sender = fields[4].GetUInt32(); + reward.subject = fields[5].GetCppString(); + reward.text = fields[6].GetCppString(); + + // must be title or mail at least + if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender) + { + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry); + continue; + } + + if (pAchievement->factionFlag == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0))) + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]); + + if (reward.titleId[0]) + { + CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]); + if (!titleEntry) + { + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]); + reward.titleId[0] = 0; + } + } + + if (reward.titleId[1]) + { + CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]); + if (!titleEntry) + { + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]); + reward.titleId[1] = 0; + } + } + + //check mail data before item for report including wrong item case + if (reward.sender) + { + if (!objmgr.GetCreatureTemplate(reward.sender)) + { + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); + reward.sender = 0; + } + } + else + { + if (reward.itemId) + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry); + + if (!reward.subject.empty()) + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry); + + if (!reward.text.empty()) + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry); + } + + if (reward.itemId) + { + if (!objmgr.GetItemPrototype(reward.itemId)) + { + sLog.outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId); + reward.itemId = 0; + } + } + + m_achievementRewards[entry] = reward; + ++count; + + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u achievement rewards", count); +} + +void AchievementGlobalMgr::LoadRewardLocales() +{ + m_achievementRewardLocales.clear(); // need for reload case + + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8 FROM locales_achievement_reward"); + + if (!result) + { + barGoLink bar(1); + + bar.step(); + + sLog.outString(); + sLog.outString(">> Loaded 0 achievement reward locale strings."); + sLog.outString(">> DB table `locales_achievement_reward` is empty."); + return; + } + + barGoLink bar(result->GetRowCount()); + + do + { + Field *fields = result->Fetch(); + bar.step(); + + uint32 entry = fields[0].GetUInt32(); + + if (m_achievementRewards.find(entry) == m_achievementRewards.end()) + { + sLog.outErrorDb("Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry); + continue; + } + + AchievementRewardLocale& data = m_achievementRewardLocales[entry]; + + for (int i = 1; i < MAX_LOCALE; ++i) + { + std::string str = fields[1+2*(i-1)].GetCppString(); + if (!str.empty()) + { + int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i)); + if (idx >= 0) + { + if (data.subject.size() <= size_t(idx)) + data.subject.resize(idx+1); + + data.subject[idx] = str; + } + } + str = fields[1+2*(i-1)+1].GetCppString(); + if (!str.empty()) + { + int idx = objmgr.GetOrNewIndexForLocale(LocaleConstant(i)); + if (idx >= 0) + { + if (data.text.size() <= size_t(idx)) + data.text.resize(idx+1); + + data.text[idx] = str; + } + } + } + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %lu achievement reward locale strings", (unsigned long)m_achievementRewardLocales.size()); +} diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h new file mode 100644 index 0000000..0eedf97 --- /dev/null +++ b/src/server/game/Achievements/AchievementMgr.h @@ -0,0 +1,347 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TRINITY_ACHIEVEMENTMGR_H +#define __TRINITY_ACHIEVEMENTMGR_H + +#include +#include + +#include "Common.h" +#include "ace/Singleton.h" +#include "DatabaseEnv.h" +#include "DBCEnums.h" +#include "DBCStores.h" + +typedef std::list AchievementCriteriaEntryList; +typedef std::list AchievementEntryList; + +typedef std::map AchievementCriteriaListByAchievement; +typedef std::map AchievementListByReferencedId; + +struct CriteriaProgress +{ + uint32 counter; + time_t date; // latest update time. + bool changed; +}; + +enum AchievementCriteriaDataType +{ // value1 value2 comment + ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0, // 0 0 + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE = 1, // creature_id 0 + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE = 2, // class_id race_id + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH= 3, // health_percent 0 + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD = 4, // own_team 0 not corpse (not released body), own_team == false if enemy team expected + ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA = 5, // spell_id effect_idx + ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA = 6, // area id 0 + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA = 7, // spell_id effect_idx + ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE = 8, // minvalue value provided with achievement update must be not less that limit + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL = 9, // minlevel minlevel of target + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER = 10,// gender 0=male; 1=female + ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11,// used to prevent achievement creteria complete if not all requirement implemented and listed in table + ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY = 12,// difficulty normal/heroic difficulty for current event map + ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT = 13,// count "with less than %u people in the zone" + ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM = 14,// team HORDE(67), ALLIANCE(469) + ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK = 15,// drunken_state 0 (enum DrunkenState) of player + ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY = 16,// holiday_id 0 event in holiday time + ACHIEVEMENT_CRITERIA_DATA_TYPE_BG_LOSS_TEAM_SCORE = 17,// min_score max_score player's team win bg and opposition team have team score in range + ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT = 18,// 0 0 maker instance script call for check current criteria requirements fit + ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM = 19,// item_level item_quality for equipped item in slot to check item level and quality +}; + +#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 20 // maximum value in AchievementCriteriaDataType enum + +class Player; +class Unit; + +struct AchievementCriteriaData +{ + AchievementCriteriaDataType dataType; + union + { + // ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0 (no data) + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE = 1 + struct + { + uint32 id; + } creature; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE = 2 + struct + { + uint32 class_id; + uint32 race_id; + } classRace; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH = 3 + struct + { + uint32 percent; + } health; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD = 4 + struct + { + uint32 own_team_flag; + } player_dead; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA = 5 + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA = 7 + struct + { + uint32 spell_id; + uint32 effect_idx; + } aura; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA = 6 + struct + { + uint32 id; + } area; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE = 8 + struct + { + uint32 minvalue; + } value; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL = 9 + struct + { + uint32 minlevel; + } level; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER = 10 + struct + { + uint32 gender; + } gender; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11 (no data) + // ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY = 12 + struct + { + uint32 difficulty; + } difficulty; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT = 13 + struct + { + uint32 maxcount; + } map_players; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM = 14 + struct + { + uint32 team; + } team; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK = 15 + struct + { + uint32 state; + } drunk; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY = 16 + struct + { + uint32 id; + } holiday; + // ACHIEVEMENT_CRITERIA_DATA_TYPE_BG_LOSS_TEAM_SCORE= 17 + struct + { + uint32 min_score; + uint32 max_score; + } bg_loss_team_score; + // ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT = 18 (no data) + // ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM = 19 + struct + { + uint32 item_level; + uint32 item_quality; + } equipped_item; + // ... + struct + { + uint32 value1; + uint32 value2; + } raw; + }; + + AchievementCriteriaData() : dataType(ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE) + { + raw.value1 = 0; + raw.value2 = 0; + } + + AchievementCriteriaData(uint32 _dataType, uint32 _value1, uint32 _value2) : dataType(AchievementCriteriaDataType(_dataType)) + { + raw.value1 = _value1; + raw.value2 = _value2; + } + + bool IsValid(AchievementCriteriaEntry const* criteria); + bool Meets(uint32 criteria_id, Player const* source, Unit const* target, uint32 miscvalue1 = 0) const; +}; + +struct AchievementCriteriaDataSet +{ + AchievementCriteriaDataSet() : criteria_id(0) {} + typedef std::vector Storage; + void Add(AchievementCriteriaData const& data) { storage.push_back(data); } + bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const; + void SetCriteriaId(uint32 id) {criteria_id = id;} + private: + uint32 criteria_id; + Storage storage; +}; + +typedef std::map AchievementCriteriaDataMap; + +struct AchievementReward +{ + uint32 titleId[2]; + uint32 itemId; + uint32 sender; + std::string subject; + std::string text; +}; + +typedef std::map AchievementRewards; + +struct AchievementRewardLocale +{ + std::vector subject; + std::vector text; +}; + +typedef std::map AchievementRewardLocales; + +struct CompletedAchievementData +{ + time_t date; + bool changed; +}; + +typedef UNORDERED_MAP CriteriaProgressMap; +typedef UNORDERED_MAP CompletedAchievementMap; + +class Unit; +class Player; +class WorldPacket; + +class AchievementMgr +{ + public: + AchievementMgr(Player* pl); + ~AchievementMgr(); + + void Reset(); + static void DeleteFromDB(uint32 lowguid); + void LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResult_AutoPtr criteriaResult); + void SaveToDB(); + void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0); + void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0); + void CompletedAchievement(AchievementEntry const* entry); + void CheckAllAchievementCriteria(); + void SendAllAchievementData(); + void SendRespondInspectAchievements(Player* player); + bool HasAchieved(AchievementEntry const* achievement) const; + Player* GetPlayer() { return m_player; } + void UpdateTimedAchievements(uint32 timeDiff); + void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); + void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements + + private: + enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST }; + void SendAchievementEarned(AchievementEntry const* achievement); + void SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted); + CriteriaProgress* GetCriteriaProgress(AchievementCriteriaEntry const* entry); + void SetCriteriaProgress(AchievementCriteriaEntry const* entry, uint32 changeValue, ProgressType ptype = PROGRESS_SET); + void CompletedCriteriaFor(AchievementEntry const* achievement); + bool IsCompletedCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement); + bool IsCompletedAchievement(AchievementEntry const* entry); + void CompleteAchievementsWithRefs(AchievementEntry const* entry); + void BuildAllDataPacket(WorldPacket *data); + + Player* m_player; + CriteriaProgressMap m_criteriaProgress; + CompletedAchievementMap m_completedAchievements; + typedef std::map TimedAchievementMap; + TimedAchievementMap m_timedAchievements; // Criteria id/time left in MS +}; + +class AchievementGlobalMgr +{ + public: + AchievementCriteriaEntryList const& GetAchievementCriteriaByType(AchievementCriteriaTypes type); + AchievementCriteriaEntryList const& GetTimedAchievementCriteriaByType(AchievementCriteriaTimedTypes type); + AchievementCriteriaEntryList const* GetAchievementCriteriaByAchievement(uint32 id) + { + AchievementCriteriaListByAchievement::const_iterator itr = m_AchievementCriteriaListByAchievement.find(id); + return itr != m_AchievementCriteriaListByAchievement.end() ? &itr->second : NULL; + } + + AchievementEntryList const* GetAchievementByReferencedId(uint32 id) const + { + AchievementListByReferencedId::const_iterator itr = m_AchievementListByReferencedId.find(id); + return itr != m_AchievementListByReferencedId.end() ? &itr->second : NULL; + } + + AchievementReward const* GetAchievementReward(AchievementEntry const* achievement) const + { + AchievementRewards::const_iterator iter = m_achievementRewards.find(achievement->ID); + return iter != m_achievementRewards.end() ? &iter->second : NULL; + } + + AchievementRewardLocale const* GetAchievementRewardLocale(AchievementEntry const* achievement) const + { + AchievementRewardLocales::const_iterator iter = m_achievementRewardLocales.find(achievement->ID); + return iter != m_achievementRewardLocales.end() ? &iter->second : NULL; + } + + AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const *achievementCriteria) + { + AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID); + return iter != m_criteriaDataMap.end() ? &iter->second : NULL; + } + + bool IsRealmCompleted(AchievementEntry const* achievement) const + { + return m_allCompletedAchievements.find(achievement->ID) != m_allCompletedAchievements.end(); + } + + void SetRealmCompleted(AchievementEntry const* achievement) + { + m_allCompletedAchievements.insert(achievement->ID); + } + + void LoadAchievementCriteriaList(); + void LoadAchievementCriteriaData(); + void LoadAchievementReferenceList(); + void LoadCompletedAchievements(); + void LoadRewards(); + void LoadRewardLocales(); + private: + AchievementCriteriaDataMap m_criteriaDataMap; + + // store achievement criterias by type to speed up lookup + AchievementCriteriaEntryList m_AchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL]; + AchievementCriteriaEntryList m_AchievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX]; + // store achievement criterias by achievement to speed up lookup + AchievementCriteriaListByAchievement m_AchievementCriteriaListByAchievement; + // store achievements by referenced achievement id to speed up lookup + AchievementListByReferencedId m_AchievementListByReferencedId; + + typedef std::set AllCompletedAchievements; + AllCompletedAchievements m_allCompletedAchievements; + + AchievementRewards m_achievementRewards; + AchievementRewardLocales m_achievementRewardLocales; +}; + +#define achievementmgr (*ACE_Singleton::instance()) + +#endif diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp new file mode 100644 index 0000000..830d439 --- /dev/null +++ b/src/server/game/Addons/AddonMgr.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2008-2010 Trinity + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "DatabaseEnv.h" + + +#include "AddonMgr.h" +#include "ObjectAccessor.h" +#include "Player.h" +#include "Util.h" +#include "SHA1.h" +#include "ProgressBar.h" + +extern DatabaseType LoginDatabase; + +AddonMgr::AddonMgr() +{ +} + +AddonMgr::~AddonMgr() +{ +} + +void AddonMgr::LoadFromDB() +{ + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT name, crc FROM addons"); + if (!result) + { + sLog.outErrorDb("The table `addons` is empty"); + return; + } + + barGoLink bar(result->GetRowCount()); + uint32 count = 0; + Field *fields; + + do + { + fields = result->Fetch(); + bar.step(); + count++; + + std::string name = fields[0].GetCppString(); + uint32 crc = fields[1].GetUInt32(); + + SavedAddon addon(name, crc); + m_knownAddons.push_back(addon); + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u known addons", count); +} + +void AddonMgr::SaveAddon(AddonInfo const& addon) +{ + std::string name = addon.Name; + CharacterDatabase.escape_string(name); + CharacterDatabase.PExecute("INSERT INTO addons (name, crc) VALUES ('%s', %u)", name.c_str(), addon.CRC); + + SavedAddon newAddon(addon.Name, addon.CRC); + m_knownAddons.push_back(newAddon); +} + +SavedAddon const* AddonMgr::GetAddonInfo(const std::string& name) const +{ + for (SavedAddonsList::const_iterator it = m_knownAddons.begin(); it != m_knownAddons.end(); ++it) + { + SavedAddon const& addon = (*it); + if (addon.Name == name) + return &addon; + } + + return NULL; +} diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h new file mode 100644 index 0000000..112415e --- /dev/null +++ b/src/server/game/Addons/AddonMgr.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2008-2010 Trinity + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _ADDONMGR_H +#define _ADDONMGR_H + +#include "Common.h" +#include "ace/Singleton.h" + +#include + +class WorldSession; + +struct AddonInfo +{ + AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey) + { + Name = name; + Enabled = enabled; + CRC = crc; + State = state; + UsePublicKeyOrCRC = crcOrPubKey; + } + + std::string Name; + uint8 Enabled; + uint32 CRC; + uint8 State; + bool UsePublicKeyOrCRC; +}; + +struct SavedAddon +{ + SavedAddon(const std::string& name, uint32 crc) + { + Name = name; + CRC = crc; + } + + std::string Name; + uint32 CRC; +}; + +// List of client addons (for WorldSession). +typedef std::list AddonsList; + +// List of saved addons (in DB). +typedef std::list SavedAddonsList; + +#define STANDARD_ADDON_CRC 0x4c1c776d + +class AddonMgr +{ + friend class ACE_Singleton; + AddonMgr(); + public: + + ~AddonMgr(); + + void LoadFromDB(); + void SaveAddon(AddonInfo const& addon); + + SavedAddon const* GetAddonInfo(const std::string& name) const; + + private: + + SavedAddonsList m_knownAddons; // Known addons. +}; + +#define sAddonMgr (*ACE_Singleton::instance()) + +#endif + diff --git a/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp new file mode 100644 index 0000000..0a4b6c3 --- /dev/null +++ b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp @@ -0,0 +1,1878 @@ +/* + * Copyright (C) 2008-2010 Trinity + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ObjectMgr.h" +#include "AuctionHouseMgr.h" +#include "AuctionHouseBot.h" +#include + +using namespace std; +vector npcItems; +vector lootItems; +vector greyTradeGoodsBin; +vector whiteTradeGoodsBin; +vector greenTradeGoodsBin; +vector blueTradeGoodsBin; +vector purpleTradeGoodsBin; +vector orangeTradeGoodsBin; +vector yellowTradeGoodsBin; +vector greyItemsBin; +vector whiteItemsBin; +vector greenItemsBin; +vector blueItemsBin; +vector purpleItemsBin; +vector orangeItemsBin; +vector yellowItemsBin; + +AuctionHouseBot::AuctionHouseBot() +{ + debug_Out = false; + debug_Out_Filters = false; + AHBSeller = false; + AHBBuyer = false; + + //Begin Filters + + Vendor_Items = false; + Loot_Items = false; + Other_Items = false; + Vendor_TGs = false; + Loot_TGs = false; + Other_TGs = false; + + No_Bind = false; + Bind_When_Picked_Up = false; + Bind_When_Equipped = false; + Bind_When_Use = false; + Bind_Quest_Item = false; + + DisableBeta_PTR_Unused = false; + DisablePermEnchant = false; + DisableConjured = false; + DisableGems = false; + DisableMoney = false; + DisableMoneyLoot = false; + DisableLootable = false; + DisableKeys = false; + DisableDuration = false; + DisableBOP_Or_Quest_NoReqLevel = false; + + DisableWarriorItems = false; + DisablePaladinItems = false; + DisableHunterItems = false; + DisableRogueItems = false; + DisablePriestItems = false; + DisableDKItems = false; + DisableShamanItems = false; + DisableMageItems = false; + DisableWarlockItems = false; + DisableUnusedClassItems = false; + DisableDruidItems = false; + + DisableItemsBelowLevel = 0; + DisableItemsAboveLevel = 0; + DisableTGsBelowLevel = 0; + DisableTGsAboveLevel = 0; + DisableItemsBelowGUID = 0; + DisableItemsAboveGUID = 0; + DisableTGsBelowGUID = 0; + DisableTGsAboveGUID = 0; + DisableItemsBelowReqLevel = 0; + DisableItemsAboveReqLevel = 0; + DisableTGsBelowReqLevel = 0; + DisableTGsAboveReqLevel = 0; + DisableItemsBelowReqSkillRank = 0; + DisableItemsAboveReqSkillRank = 0; + DisableTGsBelowReqSkillRank = 0; + DisableTGsAboveReqSkillRank = 0; + + //End Filters + + _lastrun_a = time(NULL); + _lastrun_h = time(NULL); + _lastrun_n = time(NULL); + + AllianceConfig = AHBConfig(2); + HordeConfig = AHBConfig(6); + NeutralConfig = AHBConfig(7); +} + +AuctionHouseBot::~AuctionHouseBot() +{ +} + +void AuctionHouseBot::addNewAuctions(Player *AHBplayer, AHBConfig *config) +{ + if (!AHBSeller) + { + if (debug_Out) sLog.outError("AHSeller: Disabled"); + return; + } + + uint32 minItems = config->GetMinItems(); + uint32 maxItems = config->GetMaxItems(); + + if (maxItems == 0) + { + //if (debug_Out) sLog.outString("AHSeller: Auctions disabled"); + return; + } + + AuctionHouseEntry const* ahEntry = auctionmgr.GetAuctionHouseEntry(config->GetAHFID()); + if (!ahEntry) + { + return; + } + AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); + if (!auctionHouse) + { + return; + } + + uint32 auctions = auctionHouse->Getcount(); + + if (auctions >= minItems) + { + //if (debug_Out) sLog.outString("AHSeller: Auctions above minimum"); + return; + } + + if (auctions >= maxItems) + { + //if (debug_Out) sLog.outString("AHSeller: Auctions at or above maximum"); + return; + } + + uint32 items = 0; + if ((maxItems - auctions) >= ItemsPerCycle) + items = ItemsPerCycle; + else + items = (maxItems - auctions); + + if (debug_Out) sLog.outString("AHSeller: Adding %u Auctions", items); + + uint32 AuctioneerGUID = 0; + + switch (config->GetAHID()) + { + case 2: + AuctioneerGUID = 79707; //Human in stormwind. + break; + case 6: + AuctioneerGUID = 4656; //orc in Orgrimmar + break; + case 7: + AuctioneerGUID = 23442; //goblin in GZ + break; + default: + if (debug_Out) sLog.outError("AHSeller: GetAHID() - Default switch reached"); + AuctioneerGUID = 23442; //default to neutral 7 + break; + } + + if (debug_Out) sLog.outString("AHSeller: Current Auctineer GUID is %u", AuctioneerGUID); + + uint32 greyTGcount = config->GetPercents(AHB_GREY_TG); + uint32 whiteTGcount = config->GetPercents(AHB_WHITE_TG); + uint32 greenTGcount = config->GetPercents(AHB_GREEN_TG); + uint32 blueTGcount = config->GetPercents(AHB_BLUE_TG); + uint32 purpleTGcount = config->GetPercents(AHB_PURPLE_TG); + uint32 orangeTGcount = config->GetPercents(AHB_ORANGE_TG); + uint32 yellowTGcount = config->GetPercents(AHB_YELLOW_TG); + uint32 greyIcount = config->GetPercents(AHB_GREY_I); + uint32 whiteIcount = config->GetPercents(AHB_WHITE_I); + uint32 greenIcount = config->GetPercents(AHB_GREEN_I); + uint32 blueIcount = config->GetPercents(AHB_BLUE_I); + uint32 purpleIcount = config->GetPercents(AHB_PURPLE_I); + uint32 orangeIcount = config->GetPercents(AHB_ORANGE_I); + uint32 yellowIcount = config->GetPercents(AHB_YELLOW_I); +/* uint32 total = greyTGcount + whiteTGcount + greenTGcount + blueTGcount + + purpleTGcount + orangeTGcount + yellowTGcount + + whiteIcount + greenIcount + blueIcount + purpleIcount + + orangeIcount + yellowIcount; +*/ + uint32 greyTGoods = config->GetItemCounts(AHB_GREY_TG); + uint32 whiteTGoods = config->GetItemCounts(AHB_WHITE_TG); + uint32 greenTGoods = config->GetItemCounts(AHB_GREEN_TG); + uint32 blueTGoods = config->GetItemCounts(AHB_BLUE_TG); + uint32 purpleTGoods = config->GetItemCounts(AHB_PURPLE_TG); + uint32 orangeTGoods = config->GetItemCounts(AHB_ORANGE_TG); + uint32 yellowTGoods = config->GetItemCounts(AHB_YELLOW_TG); + + uint32 greyItems = config->GetItemCounts(AHB_GREY_I); + uint32 whiteItems = config->GetItemCounts(AHB_WHITE_I); + uint32 greenItems = config->GetItemCounts(AHB_GREEN_I); + uint32 blueItems = config->GetItemCounts(AHB_BLUE_I); + uint32 purpleItems = config->GetItemCounts(AHB_PURPLE_I); + uint32 orangeItems = config->GetItemCounts(AHB_ORANGE_I); + uint32 yellowItems = config->GetItemCounts(AHB_YELLOW_I); + if (debug_Out) sLog.outString("AHSeller: %u items", items); + + // only insert a few at a time, so as not to peg the processor + for (uint32 cnt = 1; cnt <= items; cnt++) + { + if (debug_Out) sLog.outString("AHSeller: %u count", cnt); + uint32 itemID = 0; + uint32 itemColor = 99; + uint32 loopbreaker = 0; + while (itemID == 0 && loopbreaker <= 50) + { + ++loopbreaker; + uint32 choice = urand(0, 13); + itemColor = choice; + switch (choice) + { + case 0: + { + if ((greyItemsBin.size() > 0) && (greyItems < greyIcount)) + itemID = greyItemsBin[urand(0, greyItemsBin.size() - 1)]; + else continue; + break; + } + case 1: + { + if ((whiteItemsBin.size() > 0) && (whiteItems < whiteIcount)) + itemID = whiteItemsBin[urand(0, whiteItemsBin.size() - 1)]; + else continue; + break; + } + case 2: + { + if ((greenItemsBin.size() > 0) && (greenItems < greenIcount)) + itemID = greenItemsBin[urand(0, greenItemsBin.size() - 1)]; + else continue; + break; + } + case 3: + { + if ((blueItemsBin.size() > 0) && (blueItems < blueIcount)) + itemID = blueItemsBin[urand(0, blueItemsBin.size() - 1)]; + else continue; + break; + } + case 4: + { + if ((purpleItemsBin.size() > 0) && (purpleItems < purpleIcount)) + itemID = purpleItemsBin[urand(0, purpleItemsBin.size() - 1)]; + else continue; + break; + } + case 5: + { + if ((orangeItemsBin.size() > 0) && (orangeItems < orangeIcount)) + itemID = orangeItemsBin[urand(0, orangeItemsBin.size() - 1)]; + else continue; + break; + } + case 6: + { + if ((yellowItemsBin.size() > 0) && (yellowItems < yellowIcount)) + itemID = yellowItemsBin[urand(0, yellowItemsBin.size() - 1)]; + else continue; + break; + } + case 7: + { + if ((greyTradeGoodsBin.size() > 0) && (greyTGoods < greyTGcount)) + itemID = greyTradeGoodsBin[urand(0, greyTradeGoodsBin.size() - 1)]; + else continue; + break; + } + case 8: + { + if ((whiteTradeGoodsBin.size() > 0) && (whiteTGoods < whiteTGcount)) + itemID = whiteTradeGoodsBin[urand(0, whiteTradeGoodsBin.size() - 1)]; + else continue; + break; + } + case 9: + { + if ((greenTradeGoodsBin.size() > 0) && (greenTGoods < greenTGcount)) + itemID = greenTradeGoodsBin[urand(0, greenTradeGoodsBin.size() - 1)]; + else continue; + break; + } + case 10: + { + if ((blueTradeGoodsBin.size() > 0) && (blueTGoods < blueTGcount)) + itemID = blueTradeGoodsBin[urand(0, blueTradeGoodsBin.size() - 1)]; + else continue; + break; + } + case 11: + { + if ((purpleTradeGoodsBin.size() > 0) && (purpleTGoods < purpleTGcount)) + itemID = purpleTradeGoodsBin[urand(0, purpleTradeGoodsBin.size() - 1)]; + else continue; + break; + } + case 12: + { + if ((orangeTradeGoodsBin.size() > 0) && (orangeTGoods < orangeTGcount)) + itemID = orangeTradeGoodsBin[urand(0, orangeTradeGoodsBin.size() - 1)]; + else continue; + break; + } + case 13: + { + if ((yellowTradeGoodsBin.size() > 0) && (yellowTGoods < yellowTGcount)) + itemID = yellowTradeGoodsBin[urand(0, yellowTradeGoodsBin.size() - 1)]; + else continue; + break; + } + default: + { + if (debug_Out) sLog.outError("AHSeller: itemID Switch - Default Reached"); + break; + } + } + + if (itemID == 0) + { + if (debug_Out) sLog.outError("AHSeller: Item::CreateItem() - ItemID is 0"); + continue; + } + + ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID); + if (prototype == NULL) + { + if (debug_Out) sLog.outError("AHSeller: Huh?!?! prototype == NULL"); + continue; + } + + Item* item = Item::CreateItem(itemID, 1, AHBplayer); + if (item == NULL) + { + if (debug_Out) sLog.outError("AHSeller: Item::CreateItem() returned NULL"); + break; + } + item->AddToUpdateQueueOf(AHBplayer); + + uint32 randomPropertyId = Item::GenerateItemRandomPropertyId(itemID); + if (randomPropertyId != 0) + item->SetItemRandomProperties(randomPropertyId); + + uint64 buyoutPrice = 0; + uint64 bidPrice = 0; + uint32 stackCount = 1; + + switch (SellMethod) + { + case 0: + buyoutPrice = prototype->SellPrice; + break; + case 1: + buyoutPrice = prototype->BuyPrice; + break; + } + + if ((prototype->Quality >= 0) && (prototype->Quality <= AHB_MAX_QUALITY)) + { + if (config->GetMaxStack(prototype->Quality) > 1 && item->GetMaxStackCount() > 1) + stackCount = urand(1, minValue(item->GetMaxStackCount(), config->GetMaxStack(prototype->Quality))); + else if (config->GetMaxStack(prototype->Quality) == 0 && item->GetMaxStackCount() > 1) + stackCount = urand(1, item->GetMaxStackCount()); + else + stackCount = 1; + buyoutPrice *= urand(config->GetMinPrice(prototype->Quality), config->GetMaxPrice(prototype->Quality)); + buyoutPrice /= 100; + bidPrice = buyoutPrice * urand(config->GetMinBidPrice(prototype->Quality), config->GetMaxBidPrice(prototype->Quality)); + bidPrice /= 100; + } + else + { + // quality is something it shouldn't be, let's get out of here + if (debug_Out) sLog.outError("AHBuyer: Quality %u not Supported", prototype->Quality); + item->RemoveFromUpdateQueueOf(AHBplayer); + continue; + } + + uint32 etime = urand(1,3); + switch(etime) + { + case 1: + etime = 43200; + break; + case 2: + etime = 86400; + break; + case 3: + etime = 172800; + break; + default: + etime = 86400; + break; + } + item->SetCount(stackCount); + + uint32 dep = auctionmgr.GetAuctionDeposit(ahEntry, etime, item); + + AuctionEntry* auctionEntry = new AuctionEntry; + auctionEntry->Id = objmgr.GenerateAuctionID(); + auctionEntry->auctioneer = AuctioneerGUID; + auctionEntry->item_guidlow = item->GetGUIDLow(); + auctionEntry->item_template = item->GetEntry(); + auctionEntry->owner = AHBplayer->GetGUIDLow(); + auctionEntry->startbid = bidPrice * stackCount; + auctionEntry->buyout = buyoutPrice * stackCount; + auctionEntry->bidder = 0; + auctionEntry->bid = 0; + auctionEntry->deposit = dep; + auctionEntry->expire_time = (time_t) etime + time(NULL); + auctionEntry->auctionHouseEntry = ahEntry; + item->SaveToDB(); + item->RemoveFromUpdateQueueOf(AHBplayer); + auctionmgr.AddAItem(item); + auctionHouse->AddAuction(auctionEntry); + auctionEntry->SaveToDB(); + + switch(itemColor) + { + case 0: + ++greyItems; + break; + case 1: + ++whiteItems; + break; + case 2: + ++greenItems; + break; + case 3: + ++blueItems; + break; + case 4: + ++purpleItems; + break; + case 5: + ++orangeItems; + break; + case 6: + ++yellowItems; + break; + case 7: + ++greyTGoods; + break; + case 8: + ++whiteTGoods; + break; + case 9: + ++greenTGoods; + break; + case 10: + ++blueTGoods; + break; + case 11: + ++purpleTGoods; + break; + case 12: + ++orangeTGoods; + break; + case 13: + ++yellowTGoods; + break; + default: + break; + } + } + } +} +void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session) +{ + if (!AHBBuyer) + { + if (debug_Out) sLog.outError("AHBuyer: Disabled"); + return; + } + + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE itemowner<>%u AND buyguid<>%u", AHBplayerGUID, AHBplayerGUID); + + if (!result) + return; + + if (result->GetRowCount() == 0) + return; + + // Fetches content of selected AH + AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); + vector possibleBids; + + do + { + uint32 tmpdata = result->Fetch()->GetUInt32(); + possibleBids.push_back(tmpdata); + }while (result->NextRow()); + + for (uint32 count = 1; count <= config->GetBidsPerInterval(); ++count) + { + // Do we have anything to bid? If not, stop here. + if (possibleBids.empty()) + { + //if (debug_Out) sLog.outString("AHBuyer: I have no items to bid on."); + count = config->GetBidsPerInterval(); + continue; + } + + // Choose random auction from possible auctions + uint32 vectorPos = urand(0, possibleBids.size() - 1); + vector::iterator iter = possibleBids.begin(); + advance(iter, vectorPos); + + // from auctionhousehandler.cpp, creates auction pointer & player pointer + AuctionEntry* auction = auctionHouse->GetAuction(*iter); + + // Erase the auction from the vector to prevent bidding on item in next iteration. + possibleBids.erase(iter); + + if (!auction) + continue; + + // get exact item information + Item *pItem = auctionmgr.GetAItem(auction->item_guidlow); + if (!pItem) + { + if (debug_Out) sLog.outError("AHBuyer: Item %u doesn't exist, perhaps bought already?", auction->item_guidlow); + continue; + } + + // get item prototype + ItemPrototype const* prototype = objmgr.GetItemPrototype(auction->item_template); + + // check which price we have to use, startbid or if it is bidded already + uint32 currentprice; + if (auction->bid) + currentprice = auction->bid; + else + currentprice = auction->startbid; + + // Prepare portion from maximum bid + double bidrate = static_cast(urand(1, 100)) / 100; + long double bidMax = 0; + + // check that bid has acceptable value and take bid based on vendorprice, stacksize and quality + switch (BuyMethod) + { + case 0: + { + if ((prototype->Quality >= 0) && (prototype->Quality <= AHB_MAX_QUALITY)) + { + if (currentprice < prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality)) + bidMax = prototype->SellPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality); + } + else + { + // quality is something it shouldn't be, let's get out of here + if (debug_Out) sLog.outError("AHBuyer: Quality %u not Supported", prototype->Quality); + continue; + } + break; + } + case 1: + { + if ((prototype->Quality >= 0) && (prototype->Quality <= AHB_MAX_QUALITY)) + { + if (currentprice < prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality)) + bidMax = prototype->BuyPrice * pItem->GetCount() * config->GetBuyerPrice(prototype->Quality); + } + else + { + // quality is something it shouldn't be, let's get out of here + if (debug_Out) sLog.outError("AHBuyer: Quality %u not Supported", prototype->Quality); + continue; + } + break; + } + } + + // check some special items, and do recalculating to their prices + switch (prototype->Class) + { + // ammo + case 6: + bidMax = 0; + break; + default: + break; + } + + if (bidMax == 0) + { + // quality check failed to get bidmax, let's get out of here + continue; + } + + // Calculate our bid + long double bidvalue = currentprice + ((bidMax - currentprice) * bidrate); + // Convert to uint32 + uint32 bidprice = static_cast(bidvalue); + + // Check our bid is high enough to be valid. If not, correct it to minimum. + if ((currentprice + auction->GetAuctionOutBid()) > bidprice) + bidprice = currentprice + auction->GetAuctionOutBid(); + + if (debug_Out) + { + sLog.outString("-------------------------------------------------"); + sLog.outString("AHBuyer: Info for Auction #%u:", auction->Id); + sLog.outString("AHBuyer: AuctionHouse: %u", auction->GetHouseId()); + sLog.outString("AHBuyer: Auctioneer: %u", auction->auctioneer); + sLog.outString("AHBuyer: Owner: %u", auction->owner); + sLog.outString("AHBuyer: Bidder: %u", auction->bidder); + sLog.outString("AHBuyer: Starting Bid: %u", auction->startbid); + sLog.outString("AHBuyer: Current Bid: %u", currentprice); + sLog.outString("AHBuyer: Buyout: %u", auction->buyout); + sLog.outString("AHBuyer: Deposit: %u", auction->deposit); + sLog.outString("AHBuyer: Expire Time: %u", auction->expire_time); + sLog.outString("AHBuyer: Bid Rate: %f", bidrate); + sLog.outString("AHBuyer: Bid Max: %f", bidMax); + sLog.outString("AHBuyer: Bid Value: %f", bidvalue); + sLog.outString("AHBuyer: Bid Price: %u", bidprice); + sLog.outString("AHBuyer: Item GUID: %u", auction->item_guidlow); + sLog.outString("AHBuyer: Item Template: %u", auction->item_template); + sLog.outString("AHBuyer: Item Info:"); + sLog.outString("AHBuyer: Item ID: %u", prototype->ItemId); + sLog.outString("AHBuyer: Buy Price: %u", prototype->BuyPrice); + sLog.outString("AHBuyer: Sell Price: %u", prototype->SellPrice); + sLog.outString("AHBuyer: Bonding: %u", prototype->Bonding); + sLog.outString("AHBuyer: Quality: %u", prototype->Quality); + sLog.outString("AHBuyer: Item Level: %u", prototype->ItemLevel); + sLog.outString("AHBuyer: Ammo Type: %u", prototype->AmmoType); + sLog.outString("-------------------------------------------------"); + } + + // Check whether we do normal bid, or buyout + if ((bidprice < auction->buyout) || (auction->buyout == 0)) + { + + if (auction->bidder > 0) + { + if (auction->bidder == AHBplayer->GetGUIDLow()) + { + //pl->ModifyMoney(-int32(price - auction->bid)); + } + else + { + // mail to last bidder and return money + session->SendAuctionOutbiddedMail(auction , bidprice); + //pl->ModifyMoney(-int32(price)); + } + } + + auction->bidder = AHBplayer->GetGUIDLow(); + auction->bid = bidprice; + + // Saving auction into database + CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id); + } + else + { + //buyout + if ((auction->bidder) && (AHBplayer->GetGUIDLow() != auction->bidder)) + { + session->SendAuctionOutbiddedMail(auction, auction->buyout); + } + auction->bidder = AHBplayer->GetGUIDLow(); + auction->bid = auction->buyout; + + // Send mails to buyer & seller + auctionmgr.SendAuctionSalePendingMail(auction); + auctionmgr.SendAuctionSuccessfulMail(auction); + auctionmgr.SendAuctionWonMail(auction); + auction->DeleteFromDB(); + uint32 item_template = auction->item_template; + auctionmgr.RemoveAItem(auction->item_guidlow); + auctionHouse->RemoveAuction(auction, item_template); + } + } +} + +void AuctionHouseBot::Update() +{ + time_t _newrun = time(NULL); + if ((!AHBSeller) && (!AHBBuyer)) + return; + + WorldSession _session(AHBplayerAccount, NULL, SEC_PLAYER, true, 0, LOCALE_enUS); + Player _AHBplayer(&_session); + _AHBplayer.Initialize(AHBplayerGUID); + sObjectAccessor.AddObject(&_AHBplayer); + + // Add New Bids + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + { + addNewAuctions(&_AHBplayer, &AllianceConfig); + if (((_newrun - _lastrun_a) >= (AllianceConfig.GetBiddingInterval() * MINUTE)) && (AllianceConfig.GetBidsPerInterval() > 0)) + { + //if (debug_Out) sLog.outString("AHBuyer: %u seconds have passed since last bid", (_newrun - _lastrun_a)); + //if (debug_Out) sLog.outString("AHBuyer: Bidding on Alliance Auctions"); + addNewAuctionBuyerBotBid(&_AHBplayer, &AllianceConfig, &_session); + _lastrun_a = _newrun; + } + + addNewAuctions(&_AHBplayer, &HordeConfig); + if (((_newrun - _lastrun_h) >= (HordeConfig.GetBiddingInterval() * MINUTE)) && (HordeConfig.GetBidsPerInterval() > 0)) + { + //if (debug_Out) sLog.outString("AHBuyer: %u seconds have passed since last bid", (_newrun - _lastrun_h)); + //if (debug_Out) sLog.outString("AHBuyer: Bidding on Horde Auctions"); + addNewAuctionBuyerBotBid(&_AHBplayer, &HordeConfig, &_session); + _lastrun_h = _newrun; + } + } + + addNewAuctions(&_AHBplayer, &NeutralConfig); + if (((_newrun - _lastrun_n) >= (NeutralConfig.GetBiddingInterval() * MINUTE)) && (NeutralConfig.GetBidsPerInterval() > 0)) + { + //if (debug_Out) sLog.outString("AHBuyer: %u seconds have passed since last bid", (_newrun - _lastrun_n)); + //if (debug_Out) sLog.outString("AHBuyer: Bidding on Neutral Auctions"); + addNewAuctionBuyerBotBid(&_AHBplayer, &NeutralConfig, &_session); + _lastrun_n = _newrun; + } + sObjectAccessor.RemoveObject(&_AHBplayer); +} + +void AuctionHouseBot::Initialize() +{ + debug_Out = sConfig.GetBoolDefault("AuctionHouseBot.DEBUG", false); + debug_Out_Filters = sConfig.GetBoolDefault("AuctionHouseBot.DEBUG_FILTERS", false); + + AHBSeller = sConfig.GetBoolDefault("AuctionHouseBot.EnableSeller", false); + AHBBuyer = sConfig.GetBoolDefault("AuctionHouseBot.EnableBuyer", false); + SellMethod = sConfig.GetBoolDefault("AuctionHouseBot.UseBuyPriceForSeller", false); + BuyMethod = sConfig.GetBoolDefault("AuctionHouseBot.UseBuyPriceForBuyer", false); + + AHBplayerAccount = sConfig.GetIntDefault("AuctionHouseBot.Account", 0); + AHBplayerGUID = sConfig.GetIntDefault("AuctionHouseBot.GUID", 0); + ItemsPerCycle = sConfig.GetIntDefault("AuctionHouseBot.ItemsPerCycle", 200); + + //Begin Filters + + Vendor_Items = sConfig.GetBoolDefault("AuctionHouseBot.VendorItems", false); + Loot_Items = sConfig.GetBoolDefault("AuctionHouseBot.LootItems", true); + Other_Items = sConfig.GetBoolDefault("AuctionHouseBot.OtherItems", false); + Vendor_TGs = sConfig.GetBoolDefault("AuctionHouseBot.VendorTradeGoods", false); + Loot_TGs = sConfig.GetBoolDefault("AuctionHouseBot.LootTradeGoods", true); + Other_TGs = sConfig.GetBoolDefault("AuctionHouseBot.OtherTradeGoods", false); + + No_Bind = sConfig.GetBoolDefault("AuctionHouseBot.No_Bind", true); + Bind_When_Picked_Up = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Picked_Up", false); + Bind_When_Equipped = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Equipped", true); + Bind_When_Use = sConfig.GetBoolDefault("AuctionHouseBot.Bind_When_Use", true); + Bind_Quest_Item = sConfig.GetBoolDefault("AuctionHouseBot.Bind_Quest_Item", false); + + DisableBeta_PTR_Unused = sConfig.GetBoolDefault("AuctionHouseBot.DisableBeta_PTR_Unused", false); + DisablePermEnchant = sConfig.GetBoolDefault("AuctionHouseBot.DisablePermEnchant", false); + DisableConjured = sConfig.GetBoolDefault("AuctionHouseBot.DisableConjured", false); + DisableGems = sConfig.GetBoolDefault("AuctionHouseBot.DisableGems", false); + DisableMoney = sConfig.GetBoolDefault("AuctionHouseBot.DisableMoney", false); + DisableMoneyLoot = sConfig.GetBoolDefault("AuctionHouseBot.DisableMoneyLoot", false); + DisableLootable = sConfig.GetBoolDefault("AuctionHouseBot.DisableLootable", false); + DisableKeys = sConfig.GetBoolDefault("AuctionHouseBot.DisableKeys", false); + DisableDuration = sConfig.GetBoolDefault("AuctionHouseBot.DisableDuration", false); + DisableBOP_Or_Quest_NoReqLevel = sConfig.GetBoolDefault("AuctionHouseBot.DisableBOP_Or_Quest_NoReqLevel", false); + + DisableWarriorItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableWarriorItems", false); + DisablePaladinItems = sConfig.GetBoolDefault("AuctionHouseBot.DisablePaladinItems", false); + DisableHunterItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableHunterItems", false); + DisableRogueItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableRogueItems", false); + DisablePriestItems = sConfig.GetBoolDefault("AuctionHouseBot.DisablePriestItems", false); + DisableDKItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableDKItems", false); + DisableShamanItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableShamanItems", false); + DisableMageItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableMageItems", false); + DisableWarlockItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableWarlockItems", false); + DisableUnusedClassItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableUnusedClassItems", false); + DisableDruidItems = sConfig.GetBoolDefault("AuctionHouseBot.DisableDruidItems", false); + + DisableItemsBelowLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsBelowLevel", 0); + DisableItemsAboveLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsAboveLevel", 0); + DisableTGsBelowLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsBelowLevel", 0); + DisableTGsAboveLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsAboveLevel", 0); + DisableItemsBelowGUID = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsBelowGUID", 0); + DisableItemsAboveGUID = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsAboveGUID", 0); + DisableTGsBelowGUID = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsBelowGUID", 0); + DisableTGsAboveGUID = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsAboveGUID", 0); + DisableItemsBelowReqLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsBelowReqLevel", 0); + DisableItemsAboveReqLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsAboveReqLevel", 0); + DisableTGsBelowReqLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsBelowReqLevel", 0); + DisableTGsAboveReqLevel = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsAboveReqLevel", 0); + DisableItemsBelowReqSkillRank = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsBelowReqSkillRank", 0); + DisableItemsAboveReqSkillRank = sConfig.GetIntDefault("AuctionHouseBot.DisableItemsAboveReqSkillRank", 0); + DisableTGsBelowReqSkillRank = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsBelowReqSkillRank", 0); + DisableTGsAboveReqSkillRank = sConfig.GetIntDefault("AuctionHouseBot.DisableTGsAboveReqSkillRank", 0); + + //End Filters + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + { + LoadValues(&AllianceConfig); + LoadValues(&HordeConfig); + } + LoadValues(&NeutralConfig); + + // + // check if the AHBot account/GUID in the config actually exists + // + + if ((AHBplayerAccount != 0) || (AHBplayerGUID != 0)) + { + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE account = %u AND guid = %u", AHBplayerAccount, AHBplayerGUID); + if (!result) + { + sLog.outError("AuctionHouseBot: The account/GUID-information set for your AHBot is incorrect (account: %u guid: %u)", AHBplayerAccount, AHBplayerGUID); + return; + } + } + + if (AHBSeller) + { + QueryResult_AutoPtr results = QueryResult_AutoPtr(NULL); + char npcQuery[] = "SELECT distinct item FROM npc_vendor"; + results = WorldDatabase.Query(npcQuery); + if (results != NULL) + { + do + { + Field* fields = results->Fetch(); + npcItems.push_back(fields[0].GetUInt32()); + + } while (results->NextRow()); + } + else + { + if (debug_Out) sLog.outString("AuctionHouseBot: \"%s\" failed", npcQuery); + } + + char lootQuery[] = "SELECT item FROM creature_loot_template UNION " + "SELECT item FROM reference_loot_template UNION " + "SELECT item FROM disenchant_loot_template UNION " + "SELECT item FROM fishing_loot_template UNION " + "SELECT item FROM gameobject_loot_template UNION " + "SELECT item FROM item_loot_template UNION " + "SELECT item FROM milling_loot_template UNION " + "SELECT item FROM pickpocketing_loot_template UNION " + "SELECT item FROM prospecting_loot_template UNION " + "SELECT item FROM skinning_loot_template"; + + results = WorldDatabase.Query(lootQuery); + if (results != NULL) + { + do + { + Field* fields = results->Fetch(); + lootItems.push_back(fields[0].GetUInt32()); + + } while (results->NextRow()); + } + else + { + if (debug_Out) sLog.outString("AuctionHouseBot: \"%s\" failed", lootQuery); + } + + for (uint32 itemID = 0; itemID < sItemStorage.MaxEntry; itemID++) + { + ItemPrototype const* prototype = objmgr.GetItemPrototype(itemID); + + if (prototype == NULL) + continue; + + switch (prototype->Bonding) + { + case NO_BIND: + if (!No_Bind) + continue; + break; + case BIND_WHEN_PICKED_UP: + if (!Bind_When_Picked_Up) + continue; + break; + case BIND_WHEN_EQUIPED: + if (!Bind_When_Equipped) + continue; + break; + case BIND_WHEN_USE: + if (!Bind_When_Use) + continue; + break; + case BIND_QUEST_ITEM: + if (!Bind_Quest_Item) + continue; + break; + default: + continue; + break; + } + + switch (SellMethod) + { + case 0: + if (prototype->SellPrice == 0) + continue; + break; + case 1: + if (prototype->BuyPrice == 0) + continue; + break; + } + + if ((prototype->Quality < 0) || (prototype->Quality > 6)) + continue; + + if ((Vendor_Items == 0) && !(prototype->Class == ITEM_CLASS_TRADE_GOODS)) + { + bool isVendorItem = false; + + for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) + { + if (itemID == npcItems[i]) + isVendorItem = true; + } + + if (isVendorItem) + continue; + } + + if ((Vendor_TGs == 0) && (prototype->Class == ITEM_CLASS_TRADE_GOODS)) + { + bool isVendorTG = false; + + for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorTG); i++) + { + if (itemID == npcItems[i]) + isVendorTG = true; + } + + if (isVendorTG) + continue; + } + + if ((Loot_Items == 0) && !(prototype->Class == ITEM_CLASS_TRADE_GOODS)) + { + bool isLootItem = false; + + for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++) + { + if (itemID == lootItems[i]) + isLootItem = true; + } + + if (isLootItem) + continue; + } + + if ((Loot_TGs == 0) && (prototype->Class == ITEM_CLASS_TRADE_GOODS)) + { + bool isLootTG = false; + + for (unsigned int i = 0; (i < lootItems.size()) && (!isLootTG); i++) + { + if (itemID == lootItems[i]) + isLootTG = true; + } + + if (isLootTG) + continue; + } + + if ((Other_Items == 0) && !(prototype->Class == ITEM_CLASS_TRADE_GOODS)) + { + bool isVendorItem = false; + bool isLootItem = false; + + for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorItem); i++) + { + if (itemID == npcItems[i]) + isVendorItem = true; + } + for (unsigned int i = 0; (i < lootItems.size()) && (!isLootItem); i++) + { + if (itemID == lootItems[i]) + isLootItem = true; + } + if ((!isLootItem) && (!isVendorItem)) + continue; + } + + if ((Other_TGs == 0) && (prototype->Class == ITEM_CLASS_TRADE_GOODS)) + { + bool isVendorTG = false; + bool isLootTG = false; + + for (unsigned int i = 0; (i < npcItems.size()) && (!isVendorTG); i++) + { + if (itemID == npcItems[i]) + isVendorTG = true; + } + for (unsigned int i = 0; (i < lootItems.size()) && (!isLootTG); i++) + { + if (itemID == lootItems[i]) + isLootTG = true; + } + if ((!isLootTG) && (!isVendorTG)) + continue; + } + + //TODO:Make list of items and create a vector + // Disable PTR/Beta/Unused items + if ((DisableBeta_PTR_Unused) && ((prototype->ItemId == 21878) || (prototype->ItemId == 27774) || (prototype->ItemId == 27811) || (prototype->ItemId == 28117) || (prototype->ItemId == 28112))) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (PTR/Beta/Unused Item)", prototype->ItemId); + continue; + } + + // Disable permanent enchants items + if ((DisablePermEnchant) && (prototype->Class == ITEM_CLASS_PERMANENT)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Permanent Enchant Item)", prototype->ItemId); + continue; + } + + // Disable conjured items + if ((DisableConjured) && (prototype->IsConjuredConsumable())) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Conjured Consumable)", prototype->ItemId); + continue; + } + + // Disable gems + if ((DisableGems) && (prototype->Class == ITEM_CLASS_GEM)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Gem)", prototype->ItemId); + continue; + } + + // Disable money + if ((DisableMoney) && (prototype->Class == ITEM_CLASS_MONEY)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Money)", prototype->ItemId); + continue; + } + + // Disable moneyloot + if ((DisableMoneyLoot) && (prototype->MinMoneyLoot > 0)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (MoneyLoot)", prototype->ItemId); + continue; + } + + // Disable lootable items + if ((DisableLootable) && (prototype->Flags & 4)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Lootable Item)", prototype->ItemId); + continue; + } + + // Disable Keys + if ((DisableKeys) && (prototype->Class == ITEM_CLASS_KEY)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Quest Item)", prototype->ItemId); + continue; + } + + // Disable items with duration + if ((DisableDuration) && (prototype->Duration > 0)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Has a Duration)", prototype->ItemId); + continue; + } + + // Disable items which are BOP or Quest Items and have a required level lower than the item level + if ((DisableBOP_Or_Quest_NoReqLevel) && ((prototype->Bonding == BIND_WHEN_PICKED_UP || prototype->Bonding == BIND_QUEST_ITEM) && (prototype->RequiredLevel < prototype->ItemLevel))) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (BOP or BQI and Required Level is less than Item Level)", prototype->ItemId); + continue; + } + + // Disable items specifically for Warrior + if ((DisableWarriorItems) && (prototype->AllowableClass == 1)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Warrior Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Paladin + if ((DisablePaladinItems) && (prototype->AllowableClass == 2)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Paladin Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Hunter + if ((DisableHunterItems) && (prototype->AllowableClass == 4)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Hunter Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Rogue + if ((DisableRogueItems) && (prototype->AllowableClass == 8)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Rogue Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Priest + if ((DisablePriestItems) && (prototype->AllowableClass == 16)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Priest Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for DK + if ((DisableDKItems) && (prototype->AllowableClass == 32)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (DK Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Shaman + if ((DisableShamanItems) && (prototype->AllowableClass == 64)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Shaman Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Mage + if ((DisableMageItems) && (prototype->AllowableClass == 128)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Mage Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Warlock + if ((DisableWarlockItems) && (prototype->AllowableClass == 256)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Warlock Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Unused Class + if ((DisableUnusedClassItems) && (prototype->AllowableClass == 512)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Unused Item)", prototype->ItemId); + continue; + } + + // Disable items specifically for Druid + if ((DisableDruidItems) && (prototype->AllowableClass == 1024)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Druid Item)", prototype->ItemId); + continue; + } + + // Disable Items below level X + if ((DisableItemsBelowLevel) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel < DisableItemsBelowLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Items above level X + if ((DisableItemsAboveLevel) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel > DisableItemsAboveLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Trade Goods below level X + if ((DisableTGsBelowLevel) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel < DisableTGsBelowLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Trade Goods above level X + if ((DisableTGsAboveLevel) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemLevel > DisableTGsAboveLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Items below GUID X + if ((DisableItemsBelowGUID) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId < DisableItemsBelowGUID)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Items above GUID X + if ((DisableItemsAboveGUID) && (prototype->Class != ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId > DisableItemsAboveGUID)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Item Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Trade Goods below GUID X + if ((DisableTGsBelowGUID) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId < DisableTGsBelowGUID)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Trade Goods above GUID X + if ((DisableTGsAboveGUID) && (prototype->Class == ITEM_CLASS_TRADE_GOODS) && (prototype->ItemId > DisableTGsAboveGUID)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (Trade Good Level = %u)", prototype->ItemId, prototype->ItemLevel); + continue; + } + + // Disable Items for level lower than X + if ((DisableItemsBelowReqLevel) && (prototype->RequiredLevel < DisableItemsBelowReqLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); + continue; + } + + // Disable Items for level higher than X + if ((DisableItemsAboveReqLevel) && (prototype->RequiredLevel > DisableItemsAboveReqLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); + continue; + } + + // Disable Trade Goods for level lower than X + if ((DisableTGsBelowReqLevel) && (prototype->RequiredLevel < DisableTGsBelowReqLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); + continue; + } + + // Disable Trade Goods for level higher than X + if ((DisableTGsAboveReqLevel) && (prototype->RequiredLevel > DisableTGsAboveReqLevel)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Trade Good %u disabled (RequiredLevel = %u)", prototype->ItemId, prototype->RequiredLevel); + continue; + } + + // Disable Items that require skill lower than X + if ((DisableItemsBelowReqSkillRank) && (prototype->RequiredSkillRank < DisableItemsBelowReqSkillRank)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); + continue; + } + + // Disable Items that require skill higher than X + if ((DisableItemsAboveReqSkillRank) && (prototype->RequiredSkillRank > DisableItemsAboveReqSkillRank)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); + continue; + } + + // Disable Trade Goods that require skill lower than X + if ((DisableTGsBelowReqSkillRank) && (prototype->RequiredSkillRank < DisableTGsBelowReqSkillRank)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); + continue; + } + + // Disable Trade Goods that require skill higher than X + if ((DisableTGsAboveReqSkillRank) && (prototype->RequiredSkillRank > DisableTGsAboveReqSkillRank)) + { + if (debug_Out_Filters) sLog.outString("AuctionHouseBot: Item %u disabled (RequiredSkillRank = %u)", prototype->ItemId, prototype->RequiredSkillRank); + continue; + } + + switch (prototype->Quality) + { + case AHB_GREY: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + greyTradeGoodsBin.push_back(itemID); + else + greyItemsBin.push_back(itemID); + break; + + case AHB_WHITE: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + whiteTradeGoodsBin.push_back(itemID); + else + whiteItemsBin.push_back(itemID); + break; + + case AHB_GREEN: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + greenTradeGoodsBin.push_back(itemID); + else + greenItemsBin.push_back(itemID); + break; + + case AHB_BLUE: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + blueTradeGoodsBin.push_back(itemID); + else + blueItemsBin.push_back(itemID); + break; + + case AHB_PURPLE: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + purpleTradeGoodsBin.push_back(itemID); + else + purpleItemsBin.push_back(itemID); + break; + + case AHB_ORANGE: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + orangeTradeGoodsBin.push_back(itemID); + else + orangeItemsBin.push_back(itemID); + break; + + case AHB_YELLOW: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + yellowTradeGoodsBin.push_back(itemID); + else + yellowItemsBin.push_back(itemID); + break; + } + } + + if ((greyTradeGoodsBin.size() == 0) && + (whiteTradeGoodsBin.size() == 0) && + (greenTradeGoodsBin.size() == 0) && + (blueTradeGoodsBin.size() == 0) && + (purpleTradeGoodsBin.size() == 0) && + (orangeTradeGoodsBin.size() == 0) && + (yellowTradeGoodsBin.size() == 0) && + (greyItemsBin.size() == 0) && + (whiteItemsBin.size() == 0) && + (greenItemsBin.size() == 0) && + (blueItemsBin.size() == 0) && + (purpleItemsBin.size() == 0) && + (orangeItemsBin.size() == 0) && + (yellowItemsBin.size() == 0)) + { + sLog.outError("AuctionHouseBot: No items"); + AHBSeller = 0; + } + + sLog.outString("AuctionHouseBot:"); + sLog.outString("loaded %u grey trade goods", greyTradeGoodsBin.size()); + sLog.outString("loaded %u white trade goods", whiteTradeGoodsBin.size()); + sLog.outString("loaded %u green trade goods", greenTradeGoodsBin.size()); + sLog.outString("loaded %u blue trade goods", blueTradeGoodsBin.size()); + sLog.outString("loaded %u purple trade goods", purpleTradeGoodsBin.size()); + sLog.outString("loaded %u orange trade goods", orangeTradeGoodsBin.size()); + sLog.outString("loaded %u yellow trade goods", yellowTradeGoodsBin.size()); + sLog.outString("loaded %u grey items", greyItemsBin.size()); + sLog.outString("loaded %u white items", whiteItemsBin.size()); + sLog.outString("loaded %u green items", greenItemsBin.size()); + sLog.outString("loaded %u blue items", blueItemsBin.size()); + sLog.outString("loaded %u purple items", purpleItemsBin.size()); + sLog.outString("loaded %u orange items", orangeItemsBin.size()); + sLog.outString("loaded %u yellow items", yellowItemsBin.size()); + } + sLog.outString("AuctionHouseBot and AuctionHouseBuyer have been loaded."); +} + +void AuctionHouseBot::IncrementItemCounts(AuctionEntry* ah) +{ + // from auctionhousehandler.cpp, creates auction pointer & player pointer + + // get exact item information + Item *pItem = auctionmgr.GetAItem(ah->item_guidlow); + if (!pItem) + { + if (debug_Out) sLog.outError("AHBot: Item %u doesn't exist, perhaps bought already?", ah->item_guidlow); + return; + } + + // get item prototype + ItemPrototype const* prototype = objmgr.GetItemPrototype(ah->item_template); + + AHBConfig *config; + + FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(ah->GetHouseFaction()); + if (!u_entry) + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Neutral", ah->GetHouseFaction()); + config = &NeutralConfig; + } + else if (u_entry->ourMask & FACTION_MASK_ALLIANCE) + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Alliance", ah->GetHouseFaction()); + config = &AllianceConfig; + } + else if (u_entry->ourMask & FACTION_MASK_HORDE) + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Horde", ah->GetHouseFaction()); + config = &HordeConfig; + } + else + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Neutral", ah->GetHouseFaction()); + config = &NeutralConfig; + } + + config->IncItemCounts(prototype->Class, prototype->Quality); +} + +void AuctionHouseBot::DecrementItemCounts(AuctionEntry* ah, uint32 item_template) +{ + // get item prototype + ItemPrototype const* prototype = objmgr.GetItemPrototype(item_template); + + AHBConfig *config; + + FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(ah->GetHouseFaction()); + if (!u_entry) + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Neutral", ah->GetHouseFaction()); + config = &NeutralConfig; + } + else if (u_entry->ourMask & FACTION_MASK_ALLIANCE) + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Alliance", ah->GetHouseFaction()); + config = &AllianceConfig; + } + else if (u_entry->ourMask & FACTION_MASK_HORDE) + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Horde", ah->GetHouseFaction()); + config = &HordeConfig; + } + else + { + if (debug_Out) sLog.outError("AHBot: %u returned as House Faction. Neutral", ah->GetHouseFaction()); + config = &NeutralConfig; + } + + config->DecItemCounts(prototype->Class, prototype->Quality); +} + +void AuctionHouseBot::Commands(uint32 command, uint32 ahMapID, uint32 col, char* args) +{ + AHBConfig *config = NULL; + switch (ahMapID) + { + case 2: + config = &AllianceConfig; + break; + case 6: + config = &HordeConfig; + break; + case 7: + config = &NeutralConfig; + break; + } + std::string color; + switch (col) + { + case AHB_GREY: + color = "grey"; + break; + case AHB_WHITE: + color = "white"; + break; + case AHB_GREEN: + color = "green"; + break; + case AHB_BLUE: + color = "blue"; + break; + case AHB_PURPLE: + color = "purple"; + break; + case AHB_ORANGE: + color = "orange"; + break; + case AHB_YELLOW: + color = "yellow"; + break; + default: + break; + } + switch (command) + { + case 0: //ahexpire + { + AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); + + AuctionHouseObject::AuctionEntryMap::iterator itr; + itr = auctionHouse->GetAuctionsBegin(); + + while (itr != auctionHouse->GetAuctionsEnd()) + { + if (itr->second->owner == AHBplayerGUID) + { + itr->second->expire_time = sWorld.GetGameTime(); + uint32 id = itr->second->Id; + uint32 expire_time = itr->second->expire_time; + CharacterDatabase.PExecute("UPDATE auctionhouse SET time = '%u' WHERE id = '%u'", expire_time, id); + } + ++itr; + } + } + break; + case 1: //min items + { + char * param1 = strtok(args, " "); + uint32 minItems = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET minitems = '%u' WHERE auctionhouse = '%u'", minItems, ahMapID); + config->SetMinItems(minItems); + } + break; + case 2: //max items + { + char * param1 = strtok(args, " "); + uint32 maxItems = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxitems = '%u' WHERE auctionhouse = '%u'", maxItems, ahMapID); + config->SetMaxItems(maxItems); + config->CalculatePercents(); + } + break; + case 3: //min time Deprecated (Place holder for future commands) + break; + case 4: //max time Deprecated (Place holder for future commands) + break; + case 5: //percentages + { + char * param1 = strtok(args, " "); + char * param2 = strtok(NULL, " "); + char * param3 = strtok(NULL, " "); + char * param4 = strtok(NULL, " "); + char * param5 = strtok(NULL, " "); + char * param6 = strtok(NULL, " "); + char * param7 = strtok(NULL, " "); + char * param8 = strtok(NULL, " "); + char * param9 = strtok(NULL, " "); + char * param10 = strtok(NULL, " "); + char * param11 = strtok(NULL, " "); + char * param12 = strtok(NULL, " "); + char * param13 = strtok(NULL, " "); + char * param14 = strtok(NULL, " "); + uint32 greytg = (uint32) strtoul(param1, NULL, 0); + uint32 whitetg = (uint32) strtoul(param2, NULL, 0); + uint32 greentg = (uint32) strtoul(param3, NULL, 0); + uint32 bluetg = (uint32) strtoul(param4, NULL, 0); + uint32 purpletg = (uint32) strtoul(param5, NULL, 0); + uint32 orangetg = (uint32) strtoul(param6, NULL, 0); + uint32 yellowtg = (uint32) strtoul(param7, NULL, 0); + uint32 greyi = (uint32) strtoul(param8, NULL, 0); + uint32 whitei = (uint32) strtoul(param9, NULL, 0); + uint32 greeni = (uint32) strtoul(param10, NULL, 0); + uint32 bluei = (uint32) strtoul(param11, NULL, 0); + uint32 purplei = (uint32) strtoul(param12, NULL, 0); + uint32 orangei = (uint32) strtoul(param13, NULL, 0); + uint32 yellowi = (uint32) strtoul(param14, NULL, 0); + + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreytradegoods = '%u' WHERE auctionhouse = '%u'", greytg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhitetradegoods = '%u' WHERE auctionhouse = '%u'", whitetg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreentradegoods = '%u' WHERE auctionhouse = '%u'", greentg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentbluetradegoods = '%u' WHERE auctionhouse = '%u'", bluetg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpletradegoods = '%u' WHERE auctionhouse = '%u'", purpletg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentorangetradegoods = '%u' WHERE auctionhouse = '%u'", orangetg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentyellowtradegoods = '%u' WHERE auctionhouse = '%u'", yellowtg, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreyitems = '%u' WHERE auctionhouse = '%u'", greyi, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentwhiteitems = '%u' WHERE auctionhouse = '%u'", whitei, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentgreenitems = '%u' WHERE auctionhouse = '%u'", greeni, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentblueitems = '%u' WHERE auctionhouse = '%u'", bluei, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentpurpleitems = '%u' WHERE auctionhouse = '%u'", purplei, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentorangeitems = '%u' WHERE auctionhouse = '%u'", orangei, ahMapID); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET percentyellowitems = '%u' WHERE auctionhouse = '%u'", yellowi, ahMapID); + CharacterDatabase.CommitTransaction(); + config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi); + } + break; + case 6: //min prices + { + char * param1 = strtok(args, " "); + uint32 minPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET minprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minPrice, ahMapID); + config->SetMinPrice(col, minPrice); + } + break; + case 7: //max prices + { + char * param1 = strtok(args, " "); + uint32 maxPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxPrice, ahMapID); + config->SetMaxPrice(col, maxPrice); + } + break; + case 8: //min bid price + { + char * param1 = strtok(args, " "); + uint32 minBidPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET minbidprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), minBidPrice, ahMapID); + config->SetMinBidPrice(col, minBidPrice); + } + break; + case 9: //max bid price + { + char * param1 = strtok(args, " "); + uint32 maxBidPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxbidprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxBidPrice, ahMapID); + config->SetMaxBidPrice(col, maxBidPrice); + } + break; + case 10: //max stacks + { + char * param1 = strtok(args, " "); + uint32 maxStack = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET maxstack%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), maxStack, ahMapID); + config->SetMaxStack(col, maxStack); + } + break; + case 11: //buyer bid prices + { + char * param1 = strtok(args, " "); + uint32 buyerPrice = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerprice%s = '%u' WHERE auctionhouse = '%u'",color.c_str(), buyerPrice, ahMapID); + config->SetBuyerPrice(col, buyerPrice); + } + break; + case 12: //buyer bidding interval + { + char * param1 = strtok(args, " "); + uint32 bidInterval = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerbiddinginterval = '%u' WHERE auctionhouse = '%u'", bidInterval, ahMapID); + config->SetBiddingInterval(bidInterval); + } + break; + case 13: //buyer bids per interval + { + char * param1 = strtok(args, " "); + uint32 bidsPerInterval = (uint32) strtoul(param1, NULL, 0); + CharacterDatabase.PExecute("UPDATE auctionhousebot SET buyerbidsperinterval = '%u' WHERE auctionhouse = '%u'", bidsPerInterval, ahMapID); + config->SetBidsPerInterval(bidsPerInterval); + } + break; + default: + break; + } +} + +void AuctionHouseBot::LoadValues(AHBConfig *config) +{ + if (debug_Out) sLog.outString("Start Settings for %s Auctionhouses:", CharacterDatabase.PQuery("SELECT name FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetString()); + if (AHBSeller) + { + //load min and max items + config->SetMinItems(CharacterDatabase.PQuery("SELECT minitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxItems(CharacterDatabase.PQuery("SELECT maxitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + //load percentages + uint32 greytg = CharacterDatabase.PQuery("SELECT percentgreytradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 whitetg = CharacterDatabase.PQuery("SELECT percentwhitetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 greentg = CharacterDatabase.PQuery("SELECT percentgreentradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 bluetg = CharacterDatabase.PQuery("SELECT percentbluetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 purpletg = CharacterDatabase.PQuery("SELECT percentpurpletradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 orangetg = CharacterDatabase.PQuery("SELECT percentorangetradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 yellowtg = CharacterDatabase.PQuery("SELECT percentyellowtradegoods FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 greyi = CharacterDatabase.PQuery("SELECT percentgreyitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 whitei = CharacterDatabase.PQuery("SELECT percentwhiteitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 greeni = CharacterDatabase.PQuery("SELECT percentgreenitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 bluei = CharacterDatabase.PQuery("SELECT percentblueitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 purplei = CharacterDatabase.PQuery("SELECT percentpurpleitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 orangei = CharacterDatabase.PQuery("SELECT percentorangeitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + uint32 yellowi = CharacterDatabase.PQuery("SELECT percentyellowitems FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32(); + config->SetPercentages(greytg, whitetg, greentg, bluetg, purpletg, orangetg, yellowtg, greyi, whitei, greeni, bluei, purplei, orangei, yellowi); + //load min and max prices + config->SetMinPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT minpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT maxpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT minpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT minpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT minpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT minpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT minpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + //load min and max bid prices + config->SetMinBidPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT minbidpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxBidPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT maxbidpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinBidPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT minbidpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxBidPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxbidpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinBidPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT minbidpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxBidPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxbidpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinBidPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT minbidpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxBidPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxbidpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinBidPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT minbidpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxBidPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxbidpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinBidPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT minbidpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxBidPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxbidpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMinBidPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT minbidpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxBidPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxbidpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + //load max stacks + config->SetMaxStack(AHB_GREY, CharacterDatabase.PQuery("SELECT maxstackgrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxStack(AHB_WHITE, CharacterDatabase.PQuery("SELECT maxstackwhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxStack(AHB_GREEN, CharacterDatabase.PQuery("SELECT maxstackgreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxStack(AHB_BLUE, CharacterDatabase.PQuery("SELECT maxstackblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxStack(AHB_PURPLE, CharacterDatabase.PQuery("SELECT maxstackpurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxStack(AHB_ORANGE, CharacterDatabase.PQuery("SELECT maxstackorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetMaxStack(AHB_YELLOW, CharacterDatabase.PQuery("SELECT maxstackyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if (debug_Out) + { + sLog.outString("minItems = %u", config->GetMinItems()); + sLog.outString("maxItems = %u", config->GetMaxItems()); + sLog.outString("percentGreyTradeGoods = %u", config->GetPercentages(AHB_GREY_TG)); + sLog.outString("percentWhiteTradeGoods = %u", config->GetPercentages(AHB_WHITE_TG)); + sLog.outString("percentGreenTradeGoods = %u", config->GetPercentages(AHB_GREEN_TG)); + sLog.outString("percentBlueTradeGoods = %u", config->GetPercentages(AHB_BLUE_TG)); + sLog.outString("percentPurpleTradeGoods = %u", config->GetPercentages(AHB_PURPLE_TG)); + sLog.outString("percentOrangeTradeGoods = %u", config->GetPercentages(AHB_ORANGE_TG)); + sLog.outString("percentYellowTradeGoods = %u", config->GetPercentages(AHB_YELLOW_TG)); + sLog.outString("percentGreyItems = %u", config->GetPercentages(AHB_GREY_I)); + sLog.outString("percentWhiteItems = %u", config->GetPercentages(AHB_WHITE_I)); + sLog.outString("percentGreenItems = %u", config->GetPercentages(AHB_GREEN_I)); + sLog.outString("percentBlueItems = %u", config->GetPercentages(AHB_BLUE_I)); + sLog.outString("percentPurpleItems = %u", config->GetPercentages(AHB_PURPLE_I)); + sLog.outString("percentOrangeItems = %u", config->GetPercentages(AHB_ORANGE_I)); + sLog.outString("percentYellowItems = %u", config->GetPercentages(AHB_YELLOW_I)); + sLog.outString("minPriceGrey = %u", config->GetMinPrice(AHB_GREY)); + sLog.outString("maxPriceGrey = %u", config->GetMaxPrice(AHB_GREY)); + sLog.outString("minPriceWhite = %u", config->GetMinPrice(AHB_WHITE)); + sLog.outString("maxPriceWhite = %u", config->GetMaxPrice(AHB_WHITE)); + sLog.outString("minPriceGreen = %u", config->GetMinPrice(AHB_GREEN)); + sLog.outString("maxPriceGreen = %u", config->GetMaxPrice(AHB_GREEN)); + sLog.outString("minPriceBlue = %u", config->GetMinPrice(AHB_BLUE)); + sLog.outString("maxPriceBlue = %u", config->GetMaxPrice(AHB_BLUE)); + sLog.outString("minPricePurple = %u", config->GetMinPrice(AHB_PURPLE)); + sLog.outString("maxPricePurple = %u", config->GetMaxPrice(AHB_PURPLE)); + sLog.outString("minPriceOrange = %u", config->GetMinPrice(AHB_ORANGE)); + sLog.outString("maxPriceOrange = %u", config->GetMaxPrice(AHB_ORANGE)); + sLog.outString("minPriceYellow = %u", config->GetMinPrice(AHB_YELLOW)); + sLog.outString("maxPriceYellow = %u", config->GetMaxPrice(AHB_YELLOW)); + sLog.outString("minBidPriceGrey = %u", config->GetMinBidPrice(AHB_GREY)); + sLog.outString("maxBidPriceGrey = %u", config->GetMaxBidPrice(AHB_GREY)); + sLog.outString("minBidPriceWhite = %u", config->GetMinBidPrice(AHB_WHITE)); + sLog.outString("maxBidPriceWhite = %u", config->GetMaxBidPrice(AHB_WHITE)); + sLog.outString("minBidPriceGreen = %u", config->GetMinBidPrice(AHB_GREEN)); + sLog.outString("maxBidPriceGreen = %u", config->GetMaxBidPrice(AHB_GREEN)); + sLog.outString("minBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE)); + sLog.outString("maxBidPriceBlue = %u", config->GetMinBidPrice(AHB_BLUE)); + sLog.outString("minBidPricePurple = %u", config->GetMinBidPrice(AHB_PURPLE)); + sLog.outString("maxBidPricePurple = %u", config->GetMaxBidPrice(AHB_PURPLE)); + sLog.outString("minBidPriceOrange = %u", config->GetMinBidPrice(AHB_ORANGE)); + sLog.outString("maxBidPriceOrange = %u", config->GetMaxBidPrice(AHB_ORANGE)); + sLog.outString("minBidPriceYellow = %u", config->GetMinBidPrice(AHB_YELLOW)); + sLog.outString("maxBidPriceYellow = %u", config->GetMaxBidPrice(AHB_YELLOW)); + sLog.outString("maxStackGrey = %u", config->GetMaxStack(AHB_GREY)); + sLog.outString("maxStackWhite = %u", config->GetMaxStack(AHB_WHITE)); + sLog.outString("maxStackGreen = %u", config->GetMaxStack(AHB_GREEN)); + sLog.outString("maxStackBlue = %u", config->GetMaxStack(AHB_BLUE)); + sLog.outString("maxStackPurple = %u", config->GetMaxStack(AHB_PURPLE)); + sLog.outString("maxStackOrange = %u", config->GetMaxStack(AHB_ORANGE)); + sLog.outString("maxStackYellow = %u", config->GetMaxStack(AHB_YELLOW)); + } + //AuctionHouseEntry const* ahEntry = auctionmgr.GetAuctionHouseEntry(config->GetAHFID()); + AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID()); + + config->ResetItemCounts(); + uint32 auctions = auctionHouse->Getcount(); + + if (auctions) + { + for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr) + { + AuctionEntry *Aentry = itr->second; + Item *item = auctionmgr.GetAItem(Aentry->item_guidlow); + if (item) + { + ItemPrototype const *prototype = item->GetProto(); + if (prototype) + { + switch (prototype->Quality) + { + case 0: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + config->IncItemCounts(AHB_GREY_TG); + else + config->IncItemCounts(AHB_GREY_I); + break; + case 1: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + config->IncItemCounts(AHB_WHITE_TG); + else + config->IncItemCounts(AHB_WHITE_I); + break; + case 2: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + config->IncItemCounts(AHB_GREEN_TG); + else + config->IncItemCounts(AHB_GREEN_I); + break; + case 3: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + config->IncItemCounts(AHB_BLUE_TG); + else + config->IncItemCounts(AHB_BLUE_I); + break; + case 4: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + config->IncItemCounts(AHB_PURPLE_TG); + else + config->IncItemCounts(AHB_PURPLE_I); + break; + case 5: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + config->IncItemCounts(AHB_ORANGE_TG); + else + config->IncItemCounts(AHB_ORANGE_I); + break; + case 6: + if (prototype->Class == ITEM_CLASS_TRADE_GOODS) + config->IncItemCounts(AHB_YELLOW_TG); + else + config->IncItemCounts(AHB_YELLOW_I); + break; + } + } + } + } + } + if (debug_Out) + { + sLog.outString("Current Items in %s Auctionhouses:", CharacterDatabase.PQuery("SELECT name FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetString()); + sLog.outString("Grey Trade Goods\t%u\tGrey Items\t%u", config->GetItemCounts(AHB_GREY_TG), config->GetItemCounts(AHB_GREY_I)); + sLog.outString("White Trade Goods\t%u\tWhite Items\t%u", config->GetItemCounts(AHB_WHITE_TG), config->GetItemCounts(AHB_WHITE_I)); + sLog.outString("Green Trade Goods\t%u\tGreen Items\t%u", config->GetItemCounts(AHB_GREEN_TG), config->GetItemCounts(AHB_GREEN_I)); + sLog.outString("Blue Trade Goods\t%u\tBlue Items\t%u", config->GetItemCounts(AHB_BLUE_TG), config->GetItemCounts(AHB_BLUE_I)); + sLog.outString("Purple Trade Goods\t%u\tPurple Items\t%u", config->GetItemCounts(AHB_PURPLE_TG), config->GetItemCounts(AHB_PURPLE_I)); + sLog.outString("Orange Trade Goods\t%u\tOrange Items\t%u", config->GetItemCounts(AHB_ORANGE_TG), config->GetItemCounts(AHB_ORANGE_I)); + sLog.outString("Yellow Trade Goods\t%u\tYellow Items\t%u", config->GetItemCounts(AHB_YELLOW_TG), config->GetItemCounts(AHB_YELLOW_I)); + } + } + if (AHBBuyer) + { + //load buyer bid prices + config->SetBuyerPrice(AHB_GREY, CharacterDatabase.PQuery("SELECT buyerpricegrey FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_WHITE, CharacterDatabase.PQuery("SELECT buyerpricewhite FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_GREEN, CharacterDatabase.PQuery("SELECT buyerpricegreen FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_BLUE, CharacterDatabase.PQuery("SELECT buyerpriceblue FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_PURPLE, CharacterDatabase.PQuery("SELECT buyerpricepurple FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_ORANGE, CharacterDatabase.PQuery("SELECT buyerpriceorange FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + config->SetBuyerPrice(AHB_YELLOW, CharacterDatabase.PQuery("SELECT buyerpriceyellow FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + //load bidding interval + config->SetBiddingInterval(CharacterDatabase.PQuery("SELECT buyerbiddinginterval FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + //load bids per interval + config->SetBidsPerInterval(CharacterDatabase.PQuery("SELECT buyerbidsperinterval FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetUInt32()); + if (debug_Out) + { + sLog.outString("buyerPriceGrey = %u", config->GetBuyerPrice(AHB_GREY)); + sLog.outString("buyerPriceWhite = %u", config->GetBuyerPrice(AHB_WHITE)); + sLog.outString("buyerPriceGreen = %u", config->GetBuyerPrice(AHB_GREEN)); + sLog.outString("buyerPriceBlue = %u", config->GetBuyerPrice(AHB_BLUE)); + sLog.outString("buyerPricePurple = %u", config->GetBuyerPrice(AHB_PURPLE)); + sLog.outString("buyerPriceOrange = %u", config->GetBuyerPrice(AHB_ORANGE)); + sLog.outString("buyerPriceYellow = %u", config->GetBuyerPrice(AHB_YELLOW)); + sLog.outString("buyerBiddingInterval = %u", config->GetBiddingInterval()); + sLog.outString("buyerBidsPerInterval = %u", config->GetBidsPerInterval()); + } + } + if (debug_Out) sLog.outString("End Settings for %s Auctionhouses:", CharacterDatabase.PQuery("SELECT name FROM auctionhousebot WHERE auctionhouse = %u",config->GetAHID())->Fetch()->GetString()); +} diff --git a/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.h b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.h new file mode 100644 index 0000000..d1cec5f --- /dev/null +++ b/src/server/game/AuctionHouse/AuctionHouseBot/AuctionHouseBot.h @@ -0,0 +1,1247 @@ +/* + * Copyright (C) 2008-2010 Trinity + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef AUCTION_HOUSE_BOT_H +#define AUCTION_HOUSE_BOT_H + +#include "World.h" +#include "ConfigEnv.h" +#include "ItemPrototype.h" + +#define AHB_GREY 0 +#define AHB_WHITE 1 +#define AHB_GREEN 2 +#define AHB_BLUE 3 +#define AHB_PURPLE 4 +#define AHB_ORANGE 5 +#define AHB_YELLOW 6 +#define AHB_MAX_QUALITY 6 +#define AHB_GREY_TG 0 +#define AHB_WHITE_TG 1 +#define AHB_GREEN_TG 2 +#define AHB_BLUE_TG 3 +#define AHB_PURPLE_TG 4 +#define AHB_ORANGE_TG 5 +#define AHB_YELLOW_TG 6 +#define AHB_GREY_I 7 +#define AHB_WHITE_I 8 +#define AHB_GREEN_I 9 +#define AHB_BLUE_I 10 +#define AHB_PURPLE_I 11 +#define AHB_ORANGE_I 12 +#define AHB_YELLOW_I 13 + +class AHBConfig +{ +private: + uint32 AHID; + uint32 AHFID; + uint32 minItems; + uint32 maxItems; + uint32 percentGreyTradeGoods; + uint32 percentWhiteTradeGoods; + uint32 percentGreenTradeGoods; + uint32 percentBlueTradeGoods; + uint32 percentPurpleTradeGoods; + uint32 percentOrangeTradeGoods; + uint32 percentYellowTradeGoods; + uint32 percentGreyItems; + uint32 percentWhiteItems; + uint32 percentGreenItems; + uint32 percentBlueItems; + uint32 percentPurpleItems; + uint32 percentOrangeItems; + uint32 percentYellowItems; + uint32 minPriceGrey; + uint32 maxPriceGrey; + uint32 minBidPriceGrey; + uint32 maxBidPriceGrey; + uint32 maxStackGrey; + uint32 minPriceWhite; + uint32 maxPriceWhite; + uint32 minBidPriceWhite; + uint32 maxBidPriceWhite; + uint32 maxStackWhite; + uint32 minPriceGreen; + uint32 maxPriceGreen; + uint32 minBidPriceGreen; + uint32 maxBidPriceGreen; + uint32 maxStackGreen; + uint32 minPriceBlue; + uint32 maxPriceBlue; + uint32 minBidPriceBlue; + uint32 maxBidPriceBlue; + uint32 maxStackBlue; + uint32 minPricePurple; + uint32 maxPricePurple; + uint32 minBidPricePurple; + uint32 maxBidPricePurple; + uint32 maxStackPurple; + uint32 minPriceOrange; + uint32 maxPriceOrange; + uint32 minBidPriceOrange; + uint32 maxBidPriceOrange; + uint32 maxStackOrange; + uint32 minPriceYellow; + uint32 maxPriceYellow; + uint32 minBidPriceYellow; + uint32 maxBidPriceYellow; + uint32 maxStackYellow; + + uint32 buyerPriceGrey; + uint32 buyerPriceWhite; + uint32 buyerPriceGreen; + uint32 buyerPriceBlue; + uint32 buyerPricePurple; + uint32 buyerPriceOrange; + uint32 buyerPriceYellow; + uint32 buyerBiddingInterval; + uint32 buyerBidsPerInterval; + + uint32 greytgp; + uint32 whitetgp; + uint32 greentgp; + uint32 bluetgp; + uint32 purpletgp; + uint32 orangetgp; + uint32 yellowtgp; + uint32 greyip; + uint32 whiteip; + uint32 greenip; + uint32 blueip; + uint32 purpleip; + uint32 orangeip; + uint32 yellowip; + + uint32 greyTGoods; + uint32 whiteTGoods; + uint32 greenTGoods; + uint32 blueTGoods; + uint32 purpleTGoods; + uint32 orangeTGoods; + uint32 yellowTGoods; + + uint32 greyItems; + uint32 whiteItems; + uint32 greenItems; + uint32 blueItems; + uint32 purpleItems; + uint32 orangeItems; + uint32 yellowItems; + +public: + AHBConfig(uint32 ahid) + { + AHID = ahid; + switch(ahid) + { + case 2: + AHFID = 55; + break; + case 6: + AHFID = 29; + break; + case 7: + AHFID = 120; + break; + default: + AHFID = 120; + break; + } + } + AHBConfig() + { + } + uint32 GetAHID() + { + return AHID; + } + uint32 GetAHFID() + { + return AHFID; + } + void SetMinItems(uint32 value) + { + minItems = value; + } + uint32 GetMinItems() + { + if ((minItems == 0) && (maxItems)) + return maxItems; + else if ((maxItems) && (minItems > maxItems)) + return maxItems; + else + return minItems; + } + void SetMaxItems(uint32 value) + { + maxItems = value; + // CalculatePercents() needs to be called, but only if + // SetPercentages() has been called at least once already. + } + uint32 GetMaxItems() + { + return maxItems; + } + void SetPercentages(uint32 greytg, uint32 whitetg, uint32 greentg, uint32 bluetg, uint32 purpletg, uint32 orangetg, uint32 yellowtg, uint32 greyi, uint32 whitei, uint32 greeni, uint32 bluei, uint32 purplei, uint32 orangei, uint32 yellowi) + { + uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi; + + if (totalPercent == 0) + { + maxItems = 0; + } + else if (totalPercent != 100) + { + greytg = 0; + whitetg = 27; + greentg = 12; + bluetg = 10; + purpletg = 1; + orangetg = 0; + yellowtg = 0; + greyi = 0; + whitei = 10; + greeni = 30; + bluei = 8; + purplei = 2; + orangei = 0; + yellowi = 0; + } + percentGreyTradeGoods = greytg; + percentWhiteTradeGoods = whitetg; + percentGreenTradeGoods = greentg; + percentBlueTradeGoods = bluetg; + percentPurpleTradeGoods = purpletg; + percentOrangeTradeGoods = orangetg; + percentYellowTradeGoods = yellowtg; + percentGreyItems = greyi; + percentWhiteItems = whitei; + percentGreenItems = greeni; + percentBlueItems = bluei; + percentPurpleItems = purplei; + percentOrangeItems = orangei; + percentYellowItems = yellowi; + CalculatePercents(); + } + uint32 GetPercentages(uint32 color) + { + switch(color) + { + case AHB_GREY_TG: + return percentGreyTradeGoods; + break; + case AHB_WHITE_TG: + return percentWhiteTradeGoods; + break; + case AHB_GREEN_TG: + return percentGreenTradeGoods; + break; + case AHB_BLUE_TG: + return percentBlueTradeGoods; + break; + case AHB_PURPLE_TG: + return percentPurpleTradeGoods; + break; + case AHB_ORANGE_TG: + return percentOrangeTradeGoods; + break; + case AHB_YELLOW_TG: + return percentYellowTradeGoods; + break; + case AHB_GREY_I: + return percentGreyItems; + break; + case AHB_WHITE_I: + return percentWhiteItems; + break; + case AHB_GREEN_I: + return percentGreenItems; + break; + case AHB_BLUE_I: + return percentBlueItems; + break; + case AHB_PURPLE_I: + return percentPurpleItems; + break; + case AHB_ORANGE_I: + return percentOrangeItems; + break; + case AHB_YELLOW_I: + return percentYellowItems; + break; + default: + return 0; + break; + } + } + void SetMinPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + minPriceGrey = value; + break; + case AHB_WHITE: + minPriceWhite = value; + break; + case AHB_GREEN: + minPriceGreen = value; + break; + case AHB_BLUE: + minPriceBlue = value; + break; + case AHB_PURPLE: + minPricePurple = value; + break; + case AHB_ORANGE: + minPriceOrange = value; + break; + case AHB_YELLOW: + minPriceYellow = value; + break; + default: + break; + } + } + uint32 GetMinPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + if (minPriceGrey == 0) + return 100; + else if (minPriceGrey > maxPriceGrey) + return maxPriceGrey; + else + return minPriceGrey; + break; + } + case AHB_WHITE: + { + if (minPriceWhite == 0) + return 150; + else if (minPriceWhite > maxPriceWhite) + return maxPriceWhite; + else + return minPriceWhite; + break; + } + case AHB_GREEN: + { + if (minPriceGreen == 0) + return 200; + else if (minPriceGreen > maxPriceGreen) + return maxPriceGreen; + else + return minPriceGreen; + break; + } + case AHB_BLUE: + { + if (minPriceBlue == 0) + return 250; + else if (minPriceBlue > maxPriceBlue) + return maxPriceBlue; + else + return minPriceBlue; + break; + } + case AHB_PURPLE: + { + if (minPricePurple == 0) + return 300; + else if (minPricePurple > maxPricePurple) + return maxPricePurple; + else + return minPricePurple; + break; + } + case AHB_ORANGE: + { + if (minPriceOrange == 0) + return 400; + else if (minPriceOrange > maxPriceOrange) + return maxPriceOrange; + else + return minPriceOrange; + break; + } + case AHB_YELLOW: + { + if (minPriceYellow == 0) + return 500; + else if (minPriceYellow > maxPriceYellow) + return maxPriceYellow; + else + return minPriceYellow; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMaxPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + maxPriceGrey = value; + break; + case AHB_WHITE: + maxPriceWhite = value; + break; + case AHB_GREEN: + maxPriceGreen = value; + break; + case AHB_BLUE: + maxPriceBlue = value; + break; + case AHB_PURPLE: + maxPricePurple = value; + break; + case AHB_ORANGE: + maxPriceOrange = value; + break; + case AHB_YELLOW: + maxPriceYellow = value; + break; + default: + break; + } + } + uint32 GetMaxPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + if (maxPriceGrey == 0) + return 150; + else + return maxPriceGrey; + break; + } + case AHB_WHITE: + { + if (maxPriceWhite == 0) + return 250; + else + return maxPriceWhite; + break; + } + case AHB_GREEN: + { + if (maxPriceGreen == 0) + return 300; + else + return maxPriceGreen; + break; + } + case AHB_BLUE: + { + if (maxPriceBlue == 0) + return 350; + else + return maxPriceBlue; + break; + } + case AHB_PURPLE: + { + if (maxPricePurple == 0) + return 450; + else + return maxPricePurple; + break; + } + case AHB_ORANGE: + { + if (maxPriceOrange == 0) + return 550; + else + return maxPriceOrange; + break; + } + case AHB_YELLOW: + { + if (maxPriceYellow == 0) + return 650; + else + return maxPriceYellow; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMinBidPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + minBidPriceGrey = value; + break; + case AHB_WHITE: + minBidPriceWhite = value; + break; + case AHB_GREEN: + minBidPriceGreen = value; + break; + case AHB_BLUE: + minBidPriceBlue = value; + break; + case AHB_PURPLE: + minBidPricePurple = value; + break; + case AHB_ORANGE: + minBidPriceOrange = value; + break; + case AHB_YELLOW: + minBidPriceYellow = value; + break; + default: + break; + } + } + uint32 GetMinBidPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + if (minBidPriceGrey > 100) + return 100; + else + return minBidPriceGrey; + break; + } + case AHB_WHITE: + { + if (minBidPriceWhite > 100) + return 100; + else + return minBidPriceWhite; + break; + } + case AHB_GREEN: + { + if (minBidPriceGreen > 100) + return 100; + else + return minBidPriceGreen; + break; + } + case AHB_BLUE: + { + if (minBidPriceBlue > 100) + return 100; + else + return minBidPriceBlue; + break; + } + case AHB_PURPLE: + { + if (minBidPricePurple > 100) + return 100; + else + return minBidPricePurple; + break; + } + case AHB_ORANGE: + { + if (minBidPriceOrange > 100) + return 100; + else + return minBidPriceOrange; + break; + } + case AHB_YELLOW: + { + if (minBidPriceYellow > 100) + return 100; + else + return minBidPriceYellow; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMaxBidPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + maxBidPriceGrey = value; + break; + case AHB_WHITE: + maxBidPriceWhite = value; + break; + case AHB_GREEN: + maxBidPriceGreen = value; + break; + case AHB_BLUE: + maxBidPriceBlue = value; + break; + case AHB_PURPLE: + maxBidPricePurple = value; + break; + case AHB_ORANGE: + maxBidPriceOrange = value; + break; + case AHB_YELLOW: + maxBidPriceYellow = value; + break; + default: + break; + } + } + uint32 GetMaxBidPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + if (maxBidPriceGrey > 100) + return 100; + else + return maxBidPriceGrey; + break; + } + case AHB_WHITE: + { + if (maxBidPriceWhite > 100) + return 100; + else + return maxBidPriceWhite; + break; + } + case AHB_GREEN: + { + if (maxBidPriceGreen > 100) + return 100; + else + return maxBidPriceGreen; + break; + } + case AHB_BLUE: + { + if (maxBidPriceBlue > 100) + return 100; + else + return maxBidPriceBlue; + break; + } + case AHB_PURPLE: + { + if (maxBidPricePurple > 100) + return 100; + else + return maxBidPricePurple; + break; + } + case AHB_ORANGE: + { + if (maxBidPriceOrange > 100) + return 100; + else + return maxBidPriceOrange; + break; + } + case AHB_YELLOW: + { + if (maxBidPriceYellow > 100) + return 100; + else + return maxBidPriceYellow; + break; + } + default: + { + return 0; + break; + } + } + } + void SetMaxStack(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + maxStackGrey = value; + break; + case AHB_WHITE: + maxStackWhite = value; + break; + case AHB_GREEN: + maxStackGreen = value; + break; + case AHB_BLUE: + maxStackBlue = value; + break; + case AHB_PURPLE: + maxStackPurple = value; + break; + case AHB_ORANGE: + maxStackOrange = value; + break; + case AHB_YELLOW: + maxStackYellow = value; + break; + default: + break; + } + } + uint32 GetMaxStack(uint32 color) + { + switch(color) + { + case AHB_GREY: + { + return maxStackGrey; + break; + } + case AHB_WHITE: + { + return maxStackWhite; + break; + } + case AHB_GREEN: + { + return maxStackGreen; + break; + } + case AHB_BLUE: + { + return maxStackBlue; + break; + } + case AHB_PURPLE: + { + return maxStackPurple; + break; + } + case AHB_ORANGE: + { + return maxStackOrange; + break; + } + case AHB_YELLOW: + { + return maxStackYellow; + break; + } + default: + { + return 0; + break; + } + } + } + void SetBuyerPrice(uint32 color, uint32 value) + { + switch(color) + { + case AHB_GREY: + buyerPriceGrey = value; + break; + case AHB_WHITE: + buyerPriceWhite = value; + break; + case AHB_GREEN: + buyerPriceGreen = value; + break; + case AHB_BLUE: + buyerPriceBlue = value; + break; + case AHB_PURPLE: + buyerPricePurple = value; + break; + case AHB_ORANGE: + buyerPriceOrange = value; + break; + case AHB_YELLOW: + buyerPriceYellow = value; + break; + default: + break; + } + } + uint32 GetBuyerPrice(uint32 color) + { + switch(color) + { + case AHB_GREY: + return buyerPriceGrey; + break; + case AHB_WHITE: + return buyerPriceWhite; + break; + case AHB_GREEN: + return buyerPriceGreen; + break; + case AHB_BLUE: + return buyerPriceBlue; + break; + case AHB_PURPLE: + return buyerPricePurple; + break; + case AHB_ORANGE: + return buyerPriceOrange; + break; + case AHB_YELLOW: + return buyerPriceYellow; + break; + default: + return 0; + break; + } + } + void SetBiddingInterval(uint32 value) + { + buyerBiddingInterval = value; + } + uint32 GetBiddingInterval() + { + return buyerBiddingInterval; + } + void CalculatePercents() + { + greytgp = (uint32) (((double)percentGreyTradeGoods / 100.0) * maxItems); + whitetgp = (uint32) (((double)percentWhiteTradeGoods / 100.0) * maxItems); + greentgp = (uint32) (((double)percentGreenTradeGoods / 100.0) * maxItems); + bluetgp = (uint32) (((double)percentBlueTradeGoods / 100.0) * maxItems); + purpletgp = (uint32) (((double)percentPurpleTradeGoods / 100.0) * maxItems); + orangetgp = (uint32) (((double)percentOrangeTradeGoods / 100.0) * maxItems); + yellowtgp = (uint32) (((double)percentYellowTradeGoods / 100.0) * maxItems); + greyip = (uint32) (((double)percentGreyItems / 100.0) * maxItems); + whiteip = (uint32) (((double)percentWhiteItems / 100.0) * maxItems); + greenip = (uint32) (((double)percentGreenItems / 100.0) * maxItems); + blueip = (uint32) (((double)percentBlueItems / 100.0) * maxItems); + purpleip = (uint32) (((double)percentPurpleItems / 100.0) * maxItems); + orangeip = (uint32) (((double)percentOrangeItems / 100.0) * maxItems); + yellowip = (uint32) (((double)percentYellowItems / 100.0) * maxItems); + uint32 total = greytgp + whitetgp + greentgp + bluetgp + purpletgp + orangetgp + yellowtgp + greyip + whiteip + greenip + blueip + purpleip + orangeip + yellowip; + int32 diff = (maxItems - total); + if (diff < 0) + { + if ((whiteip - diff) > 0) + whiteip -= diff; + else if ((greenip - diff) > 0) + greenip -= diff; + } + else if (diff < 0) + { + whiteip += diff; + } + } + uint32 GetPercents(uint32 color) + { + switch(color) + { + case AHB_GREY_TG: + return greytgp; + break; + case AHB_WHITE_TG: + return whitetgp; + break; + case AHB_GREEN_TG: + return greentgp; + break; + case AHB_BLUE_TG: + return bluetgp; + break; + case AHB_PURPLE_TG: + return purpletgp; + break; + case AHB_ORANGE_TG: + return orangetgp; + break; + case AHB_YELLOW_TG: + return yellowtgp; + break; + case AHB_GREY_I: + return greyip; + break; + case AHB_WHITE_I: + return whiteip; + break; + case AHB_GREEN_I: + return greenip; + break; + case AHB_BLUE_I: + return blueip; + break; + case AHB_PURPLE_I: + return purpleip; + break; + case AHB_ORANGE_I: + return orangeip; + break; + case AHB_YELLOW_I: + return yellowip; + break; + default: + return 0; + break; + } + } + + void DecItemCounts(uint32 Class, uint32 Quality) + { + switch(Class) + { + case ITEM_CLASS_TRADE_GOODS: + DecItemCounts(Quality); + break; + default: + DecItemCounts(Quality + 7); + break; + } + } + + void DecItemCounts(uint32 color) + { + switch(color) + { + case AHB_GREY_TG: + --greyTGoods; + break; + case AHB_WHITE_TG: + --whiteTGoods; + break; + case AHB_GREEN_TG: + --greenTGoods; + break; + case AHB_BLUE_TG: + --blueTGoods; + break; + case AHB_PURPLE_TG: + --purpleTGoods; + break; + case AHB_ORANGE_TG: + --orangeTGoods; + break; + case AHB_YELLOW_TG: + --yellowTGoods; + break; + case AHB_GREY_I: + --greyItems; + break; + case AHB_WHITE_I: + --whiteItems; + break; + case AHB_GREEN_I: + --greenItems; + break; + case AHB_BLUE_I: + --blueItems; + break; + case AHB_PURPLE_I: + --purpleItems; + break; + case AHB_ORANGE_I: + --orangeItems; + break; + case AHB_YELLOW_I: + --yellowItems; + break; + default: + break; + } + } + + void IncItemCounts(uint32 Class, uint32 Quality) + { + switch(Class) + { + case ITEM_CLASS_TRADE_GOODS: + IncItemCounts(Quality); + break; + default: + IncItemCounts(Quality + 7); + break; + } + } + + void IncItemCounts(uint32 color) + { + switch(color) + { + case AHB_GREY_TG: + ++greyTGoods; + break; + case AHB_WHITE_TG: + ++whiteTGoods; + break; + case AHB_GREEN_TG: + ++greenTGoods; + break; + case AHB_BLUE_TG: + ++blueTGoods; + break; + case AHB_PURPLE_TG: + ++purpleTGoods; + break; + case AHB_ORANGE_TG: + ++orangeTGoods; + break; + case AHB_YELLOW_TG: + ++yellowTGoods; + break; + case AHB_GREY_I: + ++greyItems; + break; + case AHB_WHITE_I: + ++whiteItems; + break; + case AHB_GREEN_I: + ++greenItems; + break; + case AHB_BLUE_I: + ++blueItems; + break; + case AHB_PURPLE_I: + ++purpleItems; + break; + case AHB_ORANGE_I: + ++orangeItems; + break; + case AHB_YELLOW_I: + ++yellowItems; + break; + default: + break; + } + } + + void ResetItemCounts() + { + greyTGoods = 0; + whiteTGoods = 0; + greenTGoods = 0; + blueTGoods = 0; + purpleTGoods = 0; + orangeTGoods = 0; + yellowTGoods = 0; + + greyItems = 0; + whiteItems = 0; + greenItems = 0; + blueItems = 0; + purpleItems = 0; + orangeItems = 0; + yellowItems = 0; + } + + uint32 TotalItemCounts() + { + return( + greyTGoods + + whiteTGoods + + greenTGoods + + blueTGoods + + purpleTGoods + + orangeTGoods + + yellowTGoods + + + greyItems + + whiteItems + + greenItems + + blueItems + + purpleItems + + orangeItems + + yellowItems); + } + + uint32 GetItemCounts(uint32 color) + { + switch(color) + { + case AHB_GREY_TG: + return greyTGoods; + break; + case AHB_WHITE_TG: + return whiteTGoods; + break; + case AHB_GREEN_TG: + return greenTGoods; + break; + case AHB_BLUE_TG: + return blueTGoods; + break; + case AHB_PURPLE_TG: + return purpleTGoods; + break; + case AHB_ORANGE_TG: + return orangeTGoods; + break; + case AHB_YELLOW_TG: + return yellowTGoods; + break; + case AHB_GREY_I: + return greyItems; + break; + case AHB_WHITE_I: + return whiteItems; + break; + case AHB_GREEN_I: + return greenItems; + break; + case AHB_BLUE_I: + return blueItems; + break; + case AHB_PURPLE_I: + return purpleItems; + break; + case AHB_ORANGE_I: + return orangeItems; + break; + case AHB_YELLOW_I: + return yellowItems; + break; + default: + return 0; + break; + } + } + void SetBidsPerInterval(uint32 value) + { + buyerBidsPerInterval = value; + } + uint32 GetBidsPerInterval() + { + return buyerBidsPerInterval; + } + ~AHBConfig() + { + } +}; +class AuctionHouseBot +{ +private: + + bool debug_Out; + bool debug_Out_Filters; + + bool AHBSeller; + bool AHBBuyer; + bool BuyMethod; + bool SellMethod; + + uint32 AHBplayerAccount; + uint32 AHBplayerGUID; + uint32 ItemsPerCycle; + + //Begin Filters + + bool Vendor_Items; + bool Loot_Items; + bool Other_Items; + bool Vendor_TGs; + bool Loot_TGs; + bool Other_TGs; + + bool No_Bind; + bool Bind_When_Picked_Up; + bool Bind_When_Equipped; + bool Bind_When_Use; + bool Bind_Quest_Item; + + bool DisableBeta_PTR_Unused; + bool DisablePermEnchant; + bool DisableConjured; + bool DisableGems; + bool DisableMoney; + bool DisableMoneyLoot; + bool DisableLootable; + bool DisableKeys; + bool DisableDuration; + bool DisableBOP_Or_Quest_NoReqLevel; + + bool DisableWarriorItems; + bool DisablePaladinItems; + bool DisableHunterItems; + bool DisableRogueItems; + bool DisablePriestItems; + bool DisableDKItems; + bool DisableShamanItems; + bool DisableMageItems; + bool DisableWarlockItems; + bool DisableUnusedClassItems; + bool DisableDruidItems; + + uint32 DisableItemsBelowLevel; + uint32 DisableItemsAboveLevel; + uint32 DisableTGsBelowLevel; + uint32 DisableTGsAboveLevel; + uint32 DisableItemsBelowGUID; + uint32 DisableItemsAboveGUID; + uint32 DisableTGsBelowGUID; + uint32 DisableTGsAboveGUID; + uint32 DisableItemsBelowReqLevel; + uint32 DisableItemsAboveReqLevel; + uint32 DisableTGsBelowReqLevel; + uint32 DisableTGsAboveReqLevel; + uint32 DisableItemsBelowReqSkillRank; + uint32 DisableItemsAboveReqSkillRank; + uint32 DisableTGsBelowReqSkillRank; + uint32 DisableTGsAboveReqSkillRank; + + //End Filters + + AHBConfig AllianceConfig; + AHBConfig HordeConfig; + AHBConfig NeutralConfig; + + time_t _lastrun_a; + time_t _lastrun_h; + time_t _lastrun_n; + + inline uint32 minValue(uint32 a, uint32 b) { return a <= b ? a : b; }; + void addNewAuctions(Player *AHBplayer, AHBConfig *config); + void addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *config, WorldSession *session); + + friend class ACE_Singleton; + AuctionHouseBot(); + +public: + ~AuctionHouseBot(); + void Update(); + void Initialize(); + void LoadValues(AHBConfig*); + void DecrementItemCounts(AuctionEntry* ah, uint32 item_template); + void IncrementItemCounts(AuctionEntry* ah); + void Commands(uint32, uint32, uint32, char*); + uint32 GetAHBplayerGUID() { return AHBplayerGUID; }; +}; + +#define auctionbot (*ACE_Singleton::instance()) + +#endif diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp new file mode 100644 index 0000000..95e1fb5 --- /dev/null +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -0,0 +1,752 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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, see . + */ + +#include "Common.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" +#include "DatabaseEnv.h" +#include "SQLStorage.h" + +#include "DBCStores.h" + +#include "AccountMgr.h" +#include "AuctionHouseMgr.h" +#include "Item.h" +#include "Language.h" +#include "Logging/Log.h" +#include "ProgressBar.h" +#include + +using namespace std; + +AuctionHouseMgr::AuctionHouseMgr() +{ +} + +AuctionHouseMgr::~AuctionHouseMgr() +{ + for (ItemMap::const_iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr) + delete itr->second; +} + +AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) +{ + if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + return &mNeutralAuctions; + + // team have linked auction houses + FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId); + if (!u_entry) + return &mNeutralAuctions; + else if (u_entry->ourMask & FACTION_MASK_ALLIANCE) + return &mAllianceAuctions; + else if (u_entry->ourMask & FACTION_MASK_HORDE) + return &mHordeAuctions; + else + return &mNeutralAuctions; +} + +uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem) +{ + uint32 MSV = pItem->GetProto()->SellPrice; + int32 deposit; + uint32 timeHr = (((time / 60) / 60) / 12); + + if (MSV > 0) + deposit = (int32)floor((double)MSV * (((double)(entry->depositPercent * 3) / 100.0f * (double)sWorld.getRate(RATE_AUCTION_DEPOSIT) * (double)pItem->GetCount()))) * timeHr; + else + deposit = 0; + + sLog.outDebug("Sellprice: %u / Depositpercent: %f / AT1: %u / AT2: %u / AT3: %u / Count: %u", MSV, ((double)entry->depositPercent / 100.0f), time, MIN_AUCTION_TIME, timeHr, pItem->GetCount() ); + if (deposit > 0) + { + sLog.outDebug("Deposit: %u", deposit); + return deposit; + } + else + { + sLog.outDebug("Deposit: 0"); + return 0; + } +} + +//does not clear ram +void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) +{ + Item *pItem = GetAItem(auction->item_guidlow); + if (!pItem) + return; + + uint32 bidder_accId = 0; + uint32 bidder_security = 0; + uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); + Player *bidder = objmgr.GetPlayer(bidder_guid); + // data for gm.log + if (sWorld.getConfig(CONFIG_GM_LOG_TRADE)) + { + std::string bidder_name; + if (bidder) + { + bidder_accId = bidder->GetSession()->GetAccountId(); + bidder_security = bidder->GetSession()->GetSecurity(); + bidder_name = bidder->GetName(); + } + else + { + bidder_accId = objmgr.GetPlayerAccountIdByGUID(bidder_guid); + bidder_security = accmgr.GetSecurity(bidder_accId); + + if (bidder_security > SEC_PLAYER) // not do redundant DB requests + { + if (!objmgr.GetPlayerNameByGUID(bidder_guid,bidder_name)) + bidder_name = objmgr.GetTrinityStringForDBCLocale(LANG_UNKNOWN); + } + } + if (bidder_security > SEC_PLAYER) + { + std::string owner_name; + if (!objmgr.GetPlayerNameByGUID(auction->owner,owner_name)) + owner_name = objmgr.GetTrinityStringForDBCLocale(LANG_UNKNOWN); + + uint32 owner_accid = objmgr.GetPlayerAccountIdByGUID(auction->owner); + + sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)", + bidder_name.c_str(),bidder_accId,pItem->GetProto()->Name1,pItem->GetEntry(),pItem->GetCount(),auction->bid,owner_name.c_str(),owner_accid); + } + } + + // receiver exist + if (bidder || bidder_accId) + { + std::ostringstream msgAuctionWonSubject; + msgAuctionWonSubject << auction->item_template << ":0:" << AUCTION_WON; + + std::ostringstream msgAuctionWonBody; + msgAuctionWonBody.width(16); + msgAuctionWonBody << std::right << std::hex << auction->owner; + msgAuctionWonBody << std::dec << ":" << auction->bid << ":" << auction->buyout; + sLog.outDebug("AuctionWon body string : %s", msgAuctionWonBody.str().c_str()); + + // set owner to bidder (to prevent delete item with sender char deleting) + // owner in `data` will set at mail receive and item extracting + CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'",auction->bidder,pItem->GetGUIDLow()); + + if (bidder) + { + bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template); + // FIXME: for offline player need also + bidder->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1); + } + + MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str()) + .AddItem(pItem) + .SendMailTo(MailReceiver(bidder,auction->bidder), auction, MAIL_CHECK_MASK_COPIED); + } +} + +void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction) +{ + uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); + Player *owner = objmgr.GetPlayer(owner_guid); + uint32 owner_accId = objmgr.GetPlayerAccountIdByGUID(owner_guid); + // owner exist (online or offline) + if (owner || owner_accId) + { + std::ostringstream msgAuctionSalePendingSubject; + msgAuctionSalePendingSubject << auction->item_template << ":0:" << AUCTION_SALE_PENDING; + + std::ostringstream msgAuctionSalePendingBody; + uint32 auctionCut = auction->GetAuctionCut(); + + time_t distrTime = time(NULL) + sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY); + + msgAuctionSalePendingBody.width(16); + msgAuctionSalePendingBody << std::right << std::hex << auction->bidder; + msgAuctionSalePendingBody << std::dec << ":" << auction->bid << ":" << auction->buyout; + msgAuctionSalePendingBody << ":" << auction->deposit << ":" << auctionCut << ":0:"; + msgAuctionSalePendingBody << secsToTimeBitFields(distrTime); + + sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); + + MailDraft(msgAuctionSalePendingSubject.str(), msgAuctionSalePendingBody.str()) + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED); + } +} + +//call this method to send mail to auction owner, when auction is successful, it does not clear ram +void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction) +{ + uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); + Player *owner = objmgr.GetPlayer(owner_guid); + uint32 owner_accId = objmgr.GetPlayerAccountIdByGUID(owner_guid); + // owner exist + if (owner || owner_accId) + { + std::ostringstream msgAuctionSuccessfulSubject; + msgAuctionSuccessfulSubject << auction->item_template << ":0:" << AUCTION_SUCCESSFUL; + + std::ostringstream auctionSuccessfulBody; + uint32 auctionCut = auction->GetAuctionCut(); + + auctionSuccessfulBody.width(16); + auctionSuccessfulBody << std::right << std::hex << auction->bidder; + auctionSuccessfulBody << std::dec << ":" << auction->bid << ":" << auction->buyout; + auctionSuccessfulBody << ":" << auction->deposit << ":" << auctionCut; + + sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); + + uint32 profit = auction->bid + auction->deposit - auctionCut; + + //FIXME: what do if owner offline + if (owner && owner->GetGUIDLow() != auctionbot.GetAHBplayerGUID()) + { + owner->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS, profit); + owner->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid); + //send auction owner notification, bidder must be current! + owner->GetSession()->SendAuctionOwnerNotification(auction); + } + MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str()) + .AddMoney(profit) + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY)); + } +} + +//does not clear ram +void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction) +{ //return an item in auction to its owner by mail + Item *pItem = GetAItem(auction->item_guidlow); + if (!pItem) + return; + + uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); + Player *owner = objmgr.GetPlayer(owner_guid); + uint32 owner_accId = objmgr.GetPlayerAccountIdByGUID(owner_guid); + // owner exist + if (owner || owner_accId) + { + std::ostringstream subject; + subject << auction->item_template << ":0:" << AUCTION_EXPIRED << ":0:0"; + + if (owner && owner->GetGUIDLow() != auctionbot.GetAHBplayerGUID()) + owner->GetSession()->SendAuctionOwnerNotification(auction); + + MailDraft(subject.str(), "") // TODO: fix body + .AddItem(pItem) + .SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED); + } +} + +void AuctionHouseMgr::LoadAuctionItems() +{ + // data needs to be at first place for Item::LoadFromDB + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT data, text, itemguid, item_template FROM auctionhouse JOIN item_instance ON itemguid = guid"); + + if (!result) + { + barGoLink bar(1); + bar.step(); + sLog.outString(); + sLog.outString(">> Loaded 0 auction items"); + return; + } + + barGoLink bar(result->GetRowCount()); + + uint32 count = 0; + + Field *fields; + do + { + bar.step(); + + fields = result->Fetch(); + uint32 item_guid = fields[2].GetUInt32(); + uint32 item_template = fields[3].GetUInt32(); + + ItemPrototype const *proto = objmgr.GetItemPrototype(item_template); + + if (!proto) + { + sLog.outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid,item_template); + continue; + } + + Item *item = NewItemOrBag(proto); + + if (!item->LoadFromDB(item_guid,0, result)) + { + delete item; + continue; + } + AddAItem(item); + + ++count; + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u auction items", count); +} + +void AuctionHouseMgr::LoadAuctions() +{ + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse"); + if (!result) + { + barGoLink bar(1); + bar.step(); + sLog.outString(); + sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); + return; + } + + Field *fields = result->Fetch(); + uint32 AuctionCount=fields[0].GetUInt32(); + + if (!AuctionCount) + { + barGoLink bar(1); + bar.step(); + sLog.outString(); + sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); + return; + } + + result = CharacterDatabase.Query("SELECT id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit FROM auctionhouse"); + if (!result) + { + barGoLink bar(1); + bar.step(); + sLog.outString(); + sLog.outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty."); + return; + } + + barGoLink bar(AuctionCount); + + AuctionEntry *aItem; + + do + { + fields = result->Fetch(); + + bar.step(); + + aItem = new AuctionEntry; + aItem->Id = fields[0].GetUInt32(); + aItem->auctioneer = fields[1].GetUInt32(); + aItem->item_guidlow = fields[2].GetUInt32(); + aItem->item_template = fields[3].GetUInt32(); + aItem->owner = fields[4].GetUInt32(); + aItem->buyout = fields[5].GetUInt32(); + aItem->expire_time = fields[6].GetUInt32(); + aItem->bidder = fields[7].GetUInt32(); + aItem->bid = fields[8].GetUInt32(); + aItem->startbid = fields[9].GetUInt32(); + aItem->deposit = fields[10].GetUInt32(); + + CreatureData const* auctioneerData = objmgr.GetCreatureData(aItem->auctioneer); + if (!auctioneerData) + { + aItem->DeleteFromDB(); + sLog.outError("Auction %u has not a existing auctioneer (GUID : %u)", aItem->Id, aItem->auctioneer); + delete aItem; + continue; + } + + CreatureInfo const* auctioneerInfo = objmgr.GetCreatureTemplate(auctioneerData->id); + if (!auctioneerInfo) + { + aItem->DeleteFromDB(); + sLog.outError("Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", aItem->Id, aItem->auctioneer,auctioneerData->id); + delete aItem; + continue; + } + + aItem->auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(auctioneerInfo->faction_A); + if (!aItem->auctionHouseEntry) + { + aItem->DeleteFromDB(); + sLog.outError("Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", + aItem->Id, aItem->auctioneer,auctioneerData->id,auctioneerInfo->faction_A); + delete aItem; + continue; + } + + // check if sold item exists for guid + // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems) + if (!GetAItem(aItem->item_guidlow)) + { + aItem->DeleteFromDB(); + sLog.outError("Auction %u has not a existing item : %u", aItem->Id, aItem->item_guidlow); + delete aItem; + continue; + } + + GetAuctionsMap(auctioneerInfo->faction_A)->AddAuction(aItem); + + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u auctions", AuctionCount); +} + +void AuctionHouseMgr::AddAItem(Item* it) +{ + ASSERT(it); + ASSERT(mAitems.find(it->GetGUIDLow()) == mAitems.end()); + mAitems[it->GetGUIDLow()] = it; +} + +bool AuctionHouseMgr::RemoveAItem(uint32 id) +{ + ItemMap::iterator i = mAitems.find(id); + if (i == mAitems.end()) + return false; + + mAitems.erase(i); + return true; +} + +void AuctionHouseMgr::Update() +{ + mHordeAuctions.Update(); + mAllianceAuctions.Update(); + mNeutralAuctions.Update(); +} + +AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId) +{ + uint32 houseid = 7; // goblin auction house + + if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + { + //FIXME: found way for proper auctionhouse selection by another way + // AuctionHouse.dbc have faction field with _player_ factions associated with auction house races. + // but no easy way convert creature faction to player race faction for specific city + switch(factionTemplateId) + { + case 12: houseid = 1; break; // human + case 29: houseid = 6; break; // orc, and generic for horde + case 55: houseid = 2; break; // dwarf, and generic for alliance + case 68: houseid = 4; break; // undead + case 80: houseid = 3; break; // n-elf + case 104: houseid = 5; break; // trolls + case 120: houseid = 7; break; // booty bay, neutral + case 474: houseid = 7; break; // gadgetzan, neutral + case 855: houseid = 7; break; // everlook, neutral + case 1604: houseid = 6; break; // b-elfs, + default: // for unknown case + { + FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId); + if (!u_entry) + houseid = 7; // goblin auction house + else if (u_entry->ourMask & FACTION_MASK_ALLIANCE) + houseid = 1; // human auction house + else if (u_entry->ourMask & FACTION_MASK_HORDE) + houseid = 6; // orc auction house + else + houseid = 7; // goblin auction house + break; + } + } + } + + return sAuctionHouseStore.LookupEntry(houseid); +} + void AuctionHouseObject::AddAuction(AuctionEntry *ah) + { + ASSERT(ah); + AuctionsMap[ah->Id] = ah; + auctionbot.IncrementItemCounts(ah); + } + + bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 item_template) + { + auctionbot.DecrementItemCounts(auction, item_template); + bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false; + + // we need to delete the entry, it is not referenced any more + delete auction; + return wasInMap; + } + +void AuctionHouseObject::Update() +{ + time_t curTime = sWorld.GetGameTime(); + ///- Handle expired auctions + + // If storage is empty, no need to update. next == NULL in this case. + if (AuctionsMap.empty()) + return; + + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE time <= %u ORDER BY TIME ASC", (uint32)curTime+60); + + if (!result) + return; + + if (result->GetRowCount() == 0) + return; + + vector expiredAuctions; + + do + { + uint32 tmpdata = result->Fetch()->GetUInt32(); + expiredAuctions.push_back(tmpdata); + } while (result->NextRow()); + + while (!expiredAuctions.empty()) + { + vector::iterator iter = expiredAuctions.begin(); + + // from auctionhousehandler.cpp, creates auction pointer & player pointer + AuctionEntry* auction = GetAuction(*iter); + + // Erase the auction from the vector. + expiredAuctions.erase(iter); + + if (!auction) + continue; + + ///- Either cancel the auction if there was no bidder + if (auction->bidder == 0) + auctionmgr.SendAuctionExpiredMail(auction); + ///- Or perform the transaction + else + { + //we should send an "item sold" message if the seller is online + //we send the item to the winner + //we send the money to the seller + auctionmgr.SendAuctionSuccessfulMail(auction); + auctionmgr.SendAuctionWonMail(auction); + } + + ///- In any case clear the auction + CharacterDatabase.BeginTransaction(); + auction->DeleteFromDB(); + uint32 item_template = auction->item_template; + auctionmgr.RemoveAItem(auction->item_guidlow); + RemoveAuction(auction, item_template); + CharacterDatabase.CommitTransaction(); + } +} + +void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount) +{ + for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) + { + AuctionEntry *Aentry = itr->second; + if (Aentry && Aentry->bidder == player->GetGUIDLow()) + { + if (itr->second->BuildAuctionInfo(data)) + ++count; + + ++totalcount; + } + } +} + +void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount) +{ + for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) + { + AuctionEntry *Aentry = itr->second; + if (Aentry && Aentry->owner == player->GetGUIDLow()) + { + if (Aentry->BuildAuctionInfo(data)) + ++count; + + ++totalcount; + } + } +} + +void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player, + std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, + uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, + uint32& count, uint32& totalcount) +{ + int loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); + int locdbc_idx = player->GetSession()->GetSessionDbcLocale(); + + for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) + { + AuctionEntry *Aentry = itr->second; + Item *item = auctionmgr.GetAItem(Aentry->item_guidlow); + if (!item) + continue; + + ItemPrototype const *proto = item->GetProto(); + + if (itemClass != 0xffffffff && proto->Class != itemClass) + continue; + + if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass) + continue; + + if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType) + continue; + + if (quality != 0xffffffff && proto->Quality != quality) + continue; + + if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax))) + continue; + + if (usable != 0x00 && player->CanUseItem(item) != EQUIP_ERR_OK) + continue; + + // Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey) + // No need to do any of this if no search term was entered + if (!wsearchedname.empty()) + { + std::string name = proto->Name1; + if (name.empty()) + continue; + + // local name + if (loc_idx >= 0) + { + ItemLocale const *il = objmgr.GetItemLocale(proto->ItemId); + if (il) + { + if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty()) + name = il->Name[loc_idx]; + } + } + + // DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result + // that matches the search but it may not equal item->GetItemRandomPropertyId() + // used in BuildAuctionInfo() which then causes wrong items to be listed + int32 propRefID = item->GetItemRandomPropertyId(); + + if (propRefID) + { + // Append the suffix to the name (ie: of the Monkey) if one exists + // These are found in ItemRandomProperties.dbc, not ItemRandomSuffix.dbc + // even though the DBC names seem misleading + const ItemRandomPropertiesEntry *itemRandProp = sItemRandomPropertiesStore.LookupEntry(propRefID); + + if (itemRandProp) + { + char* const* temp = itemRandProp->nameSuffix; + //char* temp = itemRandProp->nameSuffix; + + // dbc local name + if (temp) + { + if (locdbc_idx >= 0) + { + // Append the suffix (ie: of the Monkey) to the name using localization + name += " "; + name += temp[locdbc_idx]; + } + else + { + // Invalid localization? Append the suffix using default enUS + name += " "; + name += temp[LOCALE_enUS]; + } + } + } + } + + // Perform the search (with or without suffix) + if (!Utf8FitTo(name, wsearchedname)) + continue; + } + + // Add the item if no search term or if entered search term was found + if (count < 50 && totalcount >= listfrom) + { + ++count; + Aentry->BuildAuctionInfo(data); + } + ++totalcount; + } +} + +//this function inserts to WorldPacket auction's data +bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const +{ + Item *pItem = auctionmgr.GetAItem(item_guidlow); + if (!pItem) + { + sLog.outError("auction to item, that doesn't exist !!!!"); + return false; + } + data << uint32(Id); + data << uint32(pItem->GetEntry()); + + for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; ++i) + { + data << uint32(pItem->GetEnchantmentId(EnchantmentSlot(i))); + data << uint32(pItem->GetEnchantmentDuration(EnchantmentSlot(i))); + data << uint32(pItem->GetEnchantmentCharges(EnchantmentSlot(i))); + } + + data << int32(pItem->GetItemRandomPropertyId()); //random item property id + data << uint32(pItem->GetItemSuffixFactor()); //SuffixFactor + data << uint32(pItem->GetCount()); //item->count + data << uint32(pItem->GetSpellCharges()); //item->charge FFFFFFF + data << uint32(0); //Unknown + data << uint64(owner); //Auction->owner + data << uint32(startbid); //Auction->startbid (not sure if useful) + data << uint32(bid ? GetAuctionOutBid() : 0); + //minimal outbid + data << uint32(buyout); //auction->buyout + data << uint32((expire_time-time(NULL))*IN_MILLISECONDS);//time left + data << uint64(bidder) ; //auction->bidder current + data << uint32(bid); //current bid + return true; +} + +uint32 AuctionEntry::GetAuctionCut() const +{ + int32 cut = int32(((double)auctionHouseEntry->cutPercent / 100.0f) * (double)sWorld.getRate(RATE_AUCTION_CUT)) * bid; + if (cut > 0) + return cut; + else + return 0; +} + +/// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c +uint32 AuctionEntry::GetAuctionOutBid() const +{ + uint32 outbid = (uint32)((double)bid / 100.0f) * 5; + if (!outbid) + outbid = 1; + return outbid; +} + +void AuctionEntry::DeleteFromDB() const +{ + //No SQL injection (Id is integer) + CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",Id); +} + +void AuctionEntry::SaveToDB() const +{ + //No SQL injection (no strings) + CharacterDatabase.PExecute("INSERT INTO auctionhouse (id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit) " + "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u')", + Id, auctioneer, item_guidlow, item_template, owner, buyout, (uint64)expire_time, bidder, bid, startbid, deposit); +} diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h new file mode 100644 index 0000000..24c954a --- /dev/null +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2008-2010 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * 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, see . + */ + +#ifndef _AUCTION_HOUSE_MGR_H +#define _AUCTION_HOUSE_MGR_H + +#include "ace/Singleton.h" + +#include "SharedDefines.h" + +#include "AuctionHouseBot.h" + +class Item; +class Player; +class WorldPacket; + +#define MIN_AUCTION_TIME (12*HOUR) + +enum AuctionError +{ + AUCTION_OK = 0, + AUCTION_INTERNAL_ERROR = 2, + AUCTION_NOT_ENOUGHT_MONEY = 3, + AUCTION_ITEM_NOT_FOUND = 4, + CANNOT_BID_YOUR_AUCTION_ERROR = 10 +}; + +enum AuctionAction +{ + AUCTION_SELL_ITEM = 0, + AUCTION_CANCEL = 1, + AUCTION_PLACE_BID = 2 +}; + +struct AuctionEntry +{ + uint32 Id; + uint32 auctioneer; // creature low guid + uint32 item_guidlow; + uint32 item_template; + uint32 owner; + uint32 startbid; //maybe useless + uint32 bid; + uint32 buyout; + time_t expire_time; + uint32 bidder; + uint32 deposit; //deposit can be calculated only when creating auction + AuctionHouseEntry const* auctionHouseEntry; // in AuctionHouse.dbc + + // helpers + uint32 GetHouseId() const { return auctionHouseEntry->houseId; } + uint32 GetHouseFaction() const { return auctionHouseEntry->faction; } + uint32 GetAuctionCut() const; + uint32 GetAuctionOutBid() const; + bool BuildAuctionInfo(WorldPacket & data) const; + void DeleteFromDB() const; + void SaveToDB() const; +}; + +//this class is used as auctionhouse instance +class AuctionHouseObject +{ + public: + // Initialize storage + AuctionHouseObject() { next = AuctionsMap.begin(); } + ~AuctionHouseObject() + { + for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) + delete itr->second; + } + + typedef std::map AuctionEntryMap; + + uint32 Getcount() { return AuctionsMap.size(); } + + AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();} + AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();} + + AuctionEntry* GetAuction(uint32 id) const + { + AuctionEntryMap::const_iterator itr = AuctionsMap.find(id); + return itr != AuctionsMap.end() ? itr->second : NULL; + } + + void AddAuction(AuctionEntry *ah); + + bool RemoveAuction(AuctionEntry *auction, uint32 item_template); + + void Update(); + + void BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount); + void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount); + void BuildListAuctionItems(WorldPacket& data, Player* player, + std::wstring const& searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable, + uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, + uint32& count, uint32& totalcount); + + private: + AuctionEntryMap AuctionsMap; + + // storage for "next" auction item for next Update() + AuctionEntryMap::const_iterator next; +}; + +class AuctionHouseMgr +{ + friend class ACE_Singleton; + AuctionHouseMgr(); + + public: + ~AuctionHouseMgr(); + + typedef UNORDERED_MAP ItemMap; + + AuctionHouseObject* GetAuctionsMap(uint32 factionTemplateId); + AuctionHouseObject* GetBidsMap(uint32 factionTemplateId); + + Item* GetAItem(uint32 id) + { + ItemMap::const_iterator itr = mAitems.find(id); + if (itr != mAitems.end()) + { + return itr->second; + } + return NULL; + } + + //auction messages + void SendAuctionWonMail(AuctionEntry * auction); + void SendAuctionSalePendingMail(AuctionEntry * auction); + void SendAuctionSuccessfulMail(AuctionEntry * auction); + void SendAuctionExpiredMail(AuctionEntry * auction); + static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem); + static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId); + + public: + //load first auction items, because of check if item exists, when loading + void LoadAuctionItems(); + void LoadAuctions(); + + void AddAItem(Item* it); + bool RemoveAItem(uint32 id); + + void Update(); + + private: + AuctionHouseObject mHordeAuctions; + AuctionHouseObject mAllianceAuctions; + AuctionHouseObject mNeutralAuctions; + + ItemMap mAitems; +}; + +#define auctionmgr (*ACE_Singleton::instance()) + +#endif diff --git a/src/server/game/BattleGrounds/ArenaTeam.cpp b/src/server/game/BattleGrounds/ArenaTeam.cpp new file mode 100644 index 0000000..4224ff6 --- /dev/null +++ b/src/server/game/BattleGrounds/ArenaTeam.cpp @@ -0,0 +1,764 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ObjectMgr.h" +#include "WorldPacket.h" + +#include "ArenaTeam.h" +#include "World.h" + +void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot) +{ + if (int32(personal_rating) + mod < 0) + personal_rating = 0; + else + personal_rating += mod; + if (plr) + plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating); +} + +ArenaTeam::ArenaTeam() +{ + m_TeamId = 0; + m_Type = 0; + m_Name = ""; + m_CaptainGuid = 0; + m_BackgroundColor = 0; // background + m_EmblemStyle = 0; // icon + m_EmblemColor = 0; // icon color + m_BorderStyle = 0; // border + m_BorderColor = 0; // border color + m_stats.games_week = 0; + m_stats.games_season = 0; + m_stats.rank = 0; + if (sWorld.getConfig(CONFIG_ARENA_START_RATING) >= 0) + m_stats.rating = sWorld.getConfig(CONFIG_ARENA_START_RATING); + else if (sWorld.getConfig(CONFIG_ARENA_SEASON_ID) >= 6) + m_stats.rating = 0; + else + m_stats.rating = 1500; + m_stats.wins_week = 0; + m_stats.wins_season = 0; +} + +ArenaTeam::~ArenaTeam() +{ +} + +bool ArenaTeam::Create(uint64 captainGuid, uint32 type, std::string ArenaTeamName) +{ + if (!objmgr.GetPlayer(captainGuid)) // player not exist + return false; + if (objmgr.GetArenaTeamByName(ArenaTeamName)) // arena team with this name already exist + return false; + + sLog.outDebug("GUILD: creating arena team %s to leader: %u", ArenaTeamName.c_str(), GUID_LOPART(captainGuid)); + + m_CaptainGuid = captainGuid; + m_Name = ArenaTeamName; + m_Type = type; + + m_TeamId = objmgr.GenerateArenaTeamId(); + + // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB + CharacterDatabase.escape_string(ArenaTeamName); + + CharacterDatabase.BeginTransaction(); + // CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid='%u'", m_TeamId); - MAX(arenateam)+1 not exist + CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid='%u'", m_TeamId); + CharacterDatabase.PExecute("INSERT INTO arena_team (arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor) " + "VALUES('%u','%s','%u','%u','%u','%u','%u','%u','%u')", + m_TeamId, ArenaTeamName.c_str(), GUID_LOPART(m_CaptainGuid), m_Type, m_BackgroundColor, m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor); + CharacterDatabase.PExecute("INSERT INTO arena_team_stats (arenateamid, rating, games, wins, played, wins2, rank) VALUES " + "('%u', '%u', '%u', '%u', '%u', '%u', '%u')", m_TeamId, m_stats.rating, m_stats.games_week, m_stats.wins_week, m_stats.games_season, m_stats.wins_season, m_stats.rank); + + CharacterDatabase.CommitTransaction(); + + AddMember(m_CaptainGuid); + sLog.outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain GUID: %u]", GetId(), GetType(), GetCaptain()); + return true; +} + +bool ArenaTeam::AddMember(const uint64& PlayerGuid) +{ + std::string plName; + uint8 plClass; + + // arena team is full (can't have more than type * 2 players!) + if (GetMembersSize() >= GetType() * 2) + return false; + + Player *pl = objmgr.GetPlayer(PlayerGuid); + if (pl) + { + if (pl->GetArenaTeamId(GetSlot())) + { + sLog.outError("Arena::AddMember() : player already in this sized team"); + return false; + } + + plClass = pl->getClass(); + plName = pl->GetName(); + } + else + { + // 0 1 + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid)); + if (!result) + return false; + + plName = (*result)[0].GetCppString(); + plClass = (*result)[1].GetUInt8(); + + // check if player already in arenateam of that size + if (Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0) + { + sLog.outError("Arena::AddMember() : player already in this sized team"); + return false; + } + } + + // remove all player signs from another petitions + // this will be prevent attempt joining player to many arenateams and corrupt arena team data integrity + Player::RemovePetitionsAndSigns(PlayerGuid, GetType()); + + ArenaTeamMember newmember; + newmember.name = plName; + newmember.guid = PlayerGuid; + newmember.Class = plClass; + newmember.games_season = 0; + newmember.games_week = 0; + newmember.wins_season = 0; + newmember.wins_week = 0; + newmember.personal_rating = 0; + + if (sWorld.getConfig(CONFIG_ARENA_START_PERSONAL_RATING) > 0) + newmember.personal_rating = sWorld.getConfig(CONFIG_ARENA_START_PERSONAL_RATING); + else + { + if (sWorld.getConfig(CONFIG_ARENA_SEASON_ID) < 6) + newmember.personal_rating = 1500; + else + if (GetRating() >= 1000) + newmember.personal_rating = 1000; + } + + m_members.push_back(newmember); + + CharacterDatabase.PExecute("INSERT INTO arena_team_member (arenateamid, guid, personal_rating) VALUES ('%u', '%u', '%u')", m_TeamId, GUID_LOPART(newmember.guid), newmember.personal_rating); + + if (pl) + { + pl->SetInArenaTeam(m_TeamId, GetSlot(), GetType()); + pl->SetArenaTeamIdInvited(0); + pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_PERSONAL_RATING, newmember.personal_rating); + + // hide promote/remove buttons + if (m_CaptainGuid != PlayerGuid) + pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); + sLog.outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", pl->GetName(), pl->GetGUIDLow(), GetType(), GetId()); + } + return true; +} + +bool ArenaTeam::LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult) +{ + if (!arenaTeamDataResult) + return false; + + Field *fields = arenaTeamDataResult->Fetch(); + + m_TeamId = fields[0].GetUInt32(); + m_Name = fields[1].GetCppString(); + m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER); + m_Type = fields[3].GetUInt32(); + m_BackgroundColor = fields[4].GetUInt32(); + m_EmblemStyle = fields[5].GetUInt32(); + m_EmblemColor = fields[6].GetUInt32(); + m_BorderStyle = fields[7].GetUInt32(); + m_BorderColor = fields[8].GetUInt32(); + //load team stats + m_stats.rating = fields[9].GetUInt32(); + m_stats.games_week = fields[10].GetUInt32(); + m_stats.wins_week = fields[11].GetUInt32(); + m_stats.games_season = fields[12].GetUInt32(); + m_stats.wins_season = fields[13].GetUInt32(); + m_stats.rank = fields[14].GetUInt32(); + + return true; +} + +bool ArenaTeam::LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult) +{ + if (!arenaTeamMembersResult) + return false; + + bool captainPresentInTeam = false; + + do + { + Field *fields = arenaTeamMembersResult->Fetch(); + //prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members + if (!fields) + break; + uint32 arenaTeamId = fields[0].GetUInt32(); + if (arenaTeamId < m_TeamId) + { + //there is in table arena_team_member record which doesn't have arenateamid in arena_team table, report error + sLog.outErrorDb("ArenaTeam %u does not exist but it has record in arena_team_member table, deleting it!", arenaTeamId); + CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", arenaTeamId); + continue; + } + + if (arenaTeamId > m_TeamId) + //we loaded all members for this arena_team already, break cycle + break; + + ArenaTeamMember newmember; + newmember.guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); + newmember.games_week = fields[2].GetUInt32(); + newmember.wins_week = fields[3].GetUInt32(); + newmember.games_season = fields[4].GetUInt32(); + newmember.wins_season = fields[5].GetUInt32(); + newmember.personal_rating = fields[6].GetUInt32(); + newmember.name = fields[7].GetCppString(); + newmember.Class = fields[8].GetUInt8(); + + //check if member exists in characters table + if (newmember.name.empty()) + { + sLog.outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newmember.guid)); + this->DelMember(newmember.guid); + continue; + } + + if (newmember.guid == GetCaptain()) + captainPresentInTeam = true; + + m_members.push_back(newmember); + }while (arenaTeamMembersResult->NextRow()); + + if (Empty() || !captainPresentInTeam) + { + // arena team is empty or captain is not in team, delete from db + sLog.outErrorDb("ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", m_TeamId); + return false; + } + + return true; +} + +void ArenaTeam::SetCaptain(const uint64& guid) +{ + // disable remove/promote buttons + Player *oldcaptain = objmgr.GetPlayer(GetCaptain()); + if (oldcaptain) + oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); + + // set new captain + m_CaptainGuid = guid; + + // update database + CharacterDatabase.PExecute("UPDATE arena_team SET captainguid = '%u' WHERE arenateamid = '%u'", GUID_LOPART(guid), GetId()); + + // enable remove/promote buttons + Player *newcaptain = objmgr.GetPlayer(guid); + if (newcaptain) + { + newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); + sLog.outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldcaptain->GetName(), oldcaptain->GetGUIDLow(), newcaptain->GetName(), newcaptain->GetGUIDLow(), GetId(), GetType()); + } +} + +void ArenaTeam::DelMember(uint64 guid) +{ + for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + if (itr->guid == guid) + { + m_members.erase(itr); + break; + } + + if (Player *player = objmgr.GetPlayer(guid)) + { + player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0); + // delete all info regarding this team + for (uint32 i = 0; i < ARENA_TEAM_END; ++i) + player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); + sLog.outArena("Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + } + CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), GUID_LOPART(guid)); +} + +void ArenaTeam::Disband(WorldSession *session) +{ + // event + if (session) + // probably only 1 string required... + BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); + + while (!m_members.empty()) + // Removing from members is done in DelMember. + DelMember(m_members.front().guid); + + if (session) + if (Player *player = session->GetPlayer()) + sLog.outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("DELETE FROM arena_team WHERE arenateamid = '%u'", m_TeamId); + CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u'", m_TeamId); //< this should be alredy done by calling DelMember(memberGuids[j]); for each member + CharacterDatabase.PExecute("DELETE FROM arena_team_stats WHERE arenateamid = '%u'", m_TeamId); + CharacterDatabase.CommitTransaction(); + objmgr.RemoveArenaTeam(m_TeamId); +} + +void ArenaTeam::Roster(WorldSession *session) +{ + Player *pl = NULL; + + uint8 unk308 = 0; + + WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100); + data << uint32(GetId()); // team id + data << uint8(unk308); // 308 unknown value but affect packet structure + data << uint32(GetMembersSize()); // members count + data << uint32(GetType()); // arena team type? + + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + pl = objmgr.GetPlayer(itr->guid); + + data << uint64(itr->guid); // guid + data << uint8((pl ? 1 : 0)); // online flag + data << itr->name; // member name + data << uint32((itr->guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member + data << uint8((pl ? pl->getLevel() : 0)); // unknown, level? + data << uint8(itr->Class); // class + data << uint32(itr->games_week); // played this week + data << uint32(itr->wins_week); // wins this week + data << uint32(itr->games_season); // played this season + data << uint32(itr->wins_season); // wins this season + data << uint32(itr->personal_rating); // personal rating + if (unk308) + { + data << float(0.0); // 308 unk + data << float(0.0); // 308 unk + } + } + + session->SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_ROSTER"); +} + +void ArenaTeam::Query(WorldSession *session) +{ + WorldPacket data(SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+GetName().size()+1); + data << uint32(GetId()); // team id + data << GetName(); // team name + data << uint32(GetType()); // arena team type (2=2x2, 3=3x3 or 5=5x5) + data << uint32(m_BackgroundColor); // background color + data << uint32(m_EmblemStyle); // emblem style + data << uint32(m_EmblemColor); // emblem color + data << uint32(m_BorderStyle); // border style + data << uint32(m_BorderColor); // border color + session->SendPacket(&data); + sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); +} + +void ArenaTeam::Stats(WorldSession *session) +{ + WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7); + data << uint32(GetId()); // team id + data << uint32(m_stats.rating); // rating + data << uint32(m_stats.games_week); // games this week + data << uint32(m_stats.wins_week); // wins this week + data << uint32(m_stats.games_season); // played this season + data << uint32(m_stats.wins_season); // wins this season + data << uint32(m_stats.rank); // rank + session->SendPacket(&data); +} + +void ArenaTeam::NotifyStatsChanged() +{ + // this is called after a rated match ended + // updates arena team stats for every member of the team (not only the ones who participated!) + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + Player * plr = objmgr.GetPlayer(itr->guid); + if (plr) + Stats(plr->GetSession()); + } +} + +void ArenaTeam::InspectStats(WorldSession *session, uint64 guid) +{ + ArenaTeamMember* member = GetMember(guid); + if (!member) + return; + + WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8+1+4*6); + data << uint64(guid); // player guid + data << uint8(GetSlot()); // slot (0...2) + data << uint32(GetId()); // arena team id + data << uint32(m_stats.rating); // rating + data << uint32(m_stats.games_season); // season played + data << uint32(m_stats.wins_season); // season wins + data << uint32(member->games_season); // played (count of all games, that the inspected member participated...) + data << uint32(member->personal_rating); // personal rating + session->SendPacket(&data); +} + +void ArenaTeam::SetEmblem(uint32 backgroundColor, uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor) +{ + m_BackgroundColor = backgroundColor; + m_EmblemStyle = emblemStyle; + m_EmblemColor = emblemColor; + m_BorderStyle = borderStyle; + m_BorderColor = borderColor; + + CharacterDatabase.PExecute("UPDATE arena_team SET BackgroundColor='%u', EmblemStyle='%u', EmblemColor='%u', BorderStyle='%u', BorderColor='%u' WHERE arenateamid='%u'", m_BackgroundColor, m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_TeamId); +} + +void ArenaTeam::SetStats(uint32 stat_type, uint32 value) +{ + switch(stat_type) + { + case STAT_TYPE_RATING: + m_stats.rating = value; + CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u' WHERE arenateamid = '%u'", value, GetId()); + break; + case STAT_TYPE_GAMES_WEEK: + m_stats.games_week = value; + CharacterDatabase.PExecute("UPDATE arena_team_stats SET games = '%u' WHERE arenateamid = '%u'", value, GetId()); + break; + case STAT_TYPE_WINS_WEEK: + m_stats.wins_week = value; + CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins = '%u' WHERE arenateamid = '%u'", value, GetId()); + break; + case STAT_TYPE_GAMES_SEASON: + m_stats.games_season = value; + CharacterDatabase.PExecute("UPDATE arena_team_stats SET played = '%u' WHERE arenateamid = '%u'", value, GetId()); + break; + case STAT_TYPE_WINS_SEASON: + m_stats.wins_season = value; + CharacterDatabase.PExecute("UPDATE arena_team_stats SET wins2 = '%u' WHERE arenateamid = '%u'", value, GetId()); + break; + case STAT_TYPE_RANK: + m_stats.rank = value; + CharacterDatabase.PExecute("UPDATE arena_team_stats SET rank = '%u' WHERE arenateamid = '%u'", value, GetId()); + break; + default: + sLog.outDebug("unknown stat type in ArenaTeam::SetStats() %u", stat_type); + break; + } +} + +void ArenaTeam::BroadcastPacket(WorldPacket *packet) +{ + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + Player *player = objmgr.GetPlayer(itr->guid); + if (player) + player->GetSession()->SendPacket(packet); + } +} + +void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3) +{ + WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1); + data << uint8(event); + data << uint8(strCount); + switch (strCount) + { + case 0: + break; + case 1: + data << str1; + break; + case 2: + data << str1 << str2; + break; + case 3: + data << str1 << str2 << str3; + break; + default: + sLog.outError("Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); + return; + } + + if (guid) + data << uint64(guid); + + BroadcastPacket(&data); + + sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_EVENT"); +} + +uint8 ArenaTeam::GetSlotByType(uint32 type) +{ + switch(type) + { + case ARENA_TEAM_2v2: return 0; + case ARENA_TEAM_3v3: return 1; + case ARENA_TEAM_5v5: return 2; + default: + break; + } + sLog.outError("FATAL: Unknown arena team type %u for some arena team", type); + return 0xFF; +} + +bool ArenaTeam::HaveMember(const uint64& guid) const +{ + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + if (itr->guid == guid) + return true; + + return false; +} + +uint32 ArenaTeam::GetPoints(uint32 MemberRating) +{ + // returns how many points would be awarded with this team type with this rating + float points; + + uint32 rating = MemberRating + 150 < m_stats.rating ? MemberRating : m_stats.rating; + + if (rating <= 1500) + { + if (sWorld.getConfig(CONFIG_ARENA_SEASON_ID) < 6) + points = (float)rating * 0.22f + 14.0f; + else + points = 344; + } + else + points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating)); + + // type penalties for <5v5 teams + if (m_Type == ARENA_TEAM_2v2) + points *= 0.76f; + else if (m_Type == ARENA_TEAM_3v3) + points *= 0.88f; + + return (uint32) points; +} + +float ArenaTeam::GetChanceAgainst(uint32 own_rating, uint32 enemy_rating) +{ + // returns the chance to win against a team with the given rating, used in the rating adjustment calculation + // ELO system + + if (sWorld.getConfig(CONFIG_ARENA_SEASON_ID) >= 6) + if (enemy_rating < 1000) + enemy_rating = 1000; + return 1.0f/(1.0f+exp(log(10.0f)*(float)((float)enemy_rating - (float)own_rating)/400.0f)); +} + +void ArenaTeam::FinishGame(int32 mod) +{ + if (int32(m_stats.rating) + mod < 0) + m_stats.rating = 0; + else + m_stats.rating += mod; + + m_stats.games_week += 1; + m_stats.games_season += 1; + // update team's rank + m_stats.rank = 1; + ObjectMgr::ArenaTeamMap::const_iterator i = objmgr.GetArenaTeamMapBegin(); + for (; i != objmgr.GetArenaTeamMapEnd(); ++i) + { + if (i->second->GetType() == m_Type && i->second->GetStats().rating > m_stats.rating) + ++m_stats.rank; + } +} + +int32 ArenaTeam::WonAgainst(uint32 againstRating) +{ + // called when the team has won + // 'chance' calculation - to beat the opponent + float chance = GetChanceAgainst(m_stats.rating, againstRating); + float K = (m_stats.rating < 1000) ? 48.0f : 32.0f; + // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) + int32 mod = (int32)floor(K* (1.0f - chance)); + + // modify the team stats accordingly + FinishGame(mod); + m_stats.wins_week += 1; + m_stats.wins_season += 1; + + // return the rating change, used to display it on the results screen + return mod; +} + +int32 ArenaTeam::LostAgainst(uint32 againstRating) +{ + // called when the team has lost + //'chance' calculation - to loose to the opponent + float chance = GetChanceAgainst(m_stats.rating, againstRating); + if (m_stats.rating < 1000) + { + FinishGame(0); + return 0; + } + + float K = 32.0f; + int32 mod = (int32)ceil(K * (0.0f - chance)); + // modify the team stats accordingly + FinishGame(mod); + + // return the rating change, used to display it on the results screen + return mod; +} + +void ArenaTeam::MemberLost(Player * plr, uint32 againstRating) +{ + // called for each participant of a match after losing + for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + if (itr->guid == plr->GetGUID()) + { + // update personal rating + float chance = GetChanceAgainst(itr->personal_rating, againstRating); + float K = (itr->personal_rating < 1000) ? 48.0f : 32.0f; + // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) + int32 mod = (int32)ceil(K * (0.0f - chance)); + itr->ModifyPersonalRating(plr, mod, GetSlot()); + // update personal played stats + itr->games_week +=1; + itr->games_season +=1; + // update the unit fields + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week); + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season); + return; + } + } +} + +void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating) +{ + // called for offline player after ending rated arena match! + for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + if (itr->guid == guid) + { + // update personal rating + float chance = GetChanceAgainst(itr->personal_rating, againstRating); + float K = (itr->personal_rating < 1000) ? 48.0f : 32.0f; + // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) + int32 mod = (int32)ceil(K * (0.0f - chance)); + if (int32(itr->personal_rating) + mod < 0) + itr->personal_rating = 0; + else + itr->personal_rating += mod; + // update personal played stats + itr->games_week +=1; + itr->games_season +=1; + return; + } + } +} + +void ArenaTeam::MemberWon(Player * plr, uint32 againstRating) +{ + // called for each participant after winning a match + for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + if (itr->guid == plr->GetGUID()) + { + // update personal rating + float chance = GetChanceAgainst(itr->personal_rating, againstRating); + float K = (itr->personal_rating < 1000) ? 48.0f : 32.0f; + // calculate the rating modification (ELO system with k=32 or k=48 if rating<1000) + int32 mod = (int32)floor(K* (1.0f - chance)); + itr->ModifyPersonalRating(plr, mod, GetSlot()); + // update personal stats + itr->games_week +=1; + itr->games_season +=1; + itr->wins_season += 1; + itr->wins_week += 1; + // update unit fields + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_WEEK, itr->games_week); + plr->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_GAMES_SEASON, itr->games_season); + return; + } + } +} + +void ArenaTeam::UpdateArenaPointsHelper(std::map& PlayerPoints) +{ + // called after a match has ended and the stats are already modified + // helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons) + // 10 played games per week is a minimum + if (m_stats.games_week < 10) + return; + // to get points, a player has to participate in at least 30% of the matches + uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3); + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + // the player participated in enough games, update his points + uint32 points_to_add = 0; + if (itr->games_week >= min_plays) + points_to_add = GetPoints(itr->personal_rating); + // OBSOLETE : CharacterDatabase.PExecute("UPDATE arena_team_member SET points_to_add = '%u' WHERE arenateamid = '%u' AND guid = '%u'", points_to_add, m_TeamId, itr->guid); + + std::map::iterator plr_itr = PlayerPoints.find(GUID_LOPART(itr->guid)); + if (plr_itr != PlayerPoints.end()) + { + //check if there is already more points + if (plr_itr->second < points_to_add) + PlayerPoints[GUID_LOPART(itr->guid)] = points_to_add; + } + else + PlayerPoints[GUID_LOPART(itr->guid)] = points_to_add; + } +} + +void ArenaTeam::SaveToDB() +{ + // save team and member stats to db + // called after a match has ended, or when calculating arena_points + CharacterDatabase.BeginTransaction(); + CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u',games = '%u',played = '%u',rank = '%u',wins = '%u',wins2 = '%u' WHERE arenateamid = '%u'", m_stats.rating, m_stats.games_week, m_stats.games_season, m_stats.rank, m_stats.wins_week, m_stats.wins_season, GetId()); + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + CharacterDatabase.PExecute("UPDATE arena_team_member SET played_week = '%u', wons_week = '%u', played_season = '%u', wons_season = '%u', personal_rating = '%u' WHERE arenateamid = '%u' AND guid = '%u'", itr->games_week, itr->wins_week, itr->games_season, itr->wins_season, itr->personal_rating, m_TeamId, GUID_LOPART(itr->guid)); + } + CharacterDatabase.CommitTransaction(); +} + +void ArenaTeam::FinishWeek() +{ + m_stats.games_week = 0; // played this week + m_stats.wins_week = 0; // wins this week + for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { + itr->games_week = 0; + itr->wins_week = 0; + } +} + +bool ArenaTeam::IsFighting() const +{ + for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + if (Player *p = objmgr.GetPlayer(itr->guid)) + if (p->GetMap()->IsBattleArena()) + return true; + return false; +} diff --git a/src/server/game/BattleGrounds/ArenaTeam.h b/src/server/game/BattleGrounds/ArenaTeam.h new file mode 100644 index 0000000..e6f85cf --- /dev/null +++ b/src/server/game/BattleGrounds/ArenaTeam.h @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITYCORE_ARENATEAM_H +#define TRINITYCORE_ARENATEAM_H + +enum ArenaTeamCommandTypes +{ + ERR_ARENA_TEAM_CREATE_S = 0x00, + ERR_ARENA_TEAM_INVITE_SS = 0x01, + ERR_ARENA_TEAM_QUIT_S = 0x03, + ERR_ARENA_TEAM_FOUNDER_S = 0x0E +}; + +enum ArenaTeamCommandErrors +{ + ERR_ARENA_TEAM_INTERNAL = 0x01, + ERR_ALREADY_IN_ARENA_TEAM = 0x02, + ERR_ALREADY_IN_ARENA_TEAM_S = 0x03, + ERR_INVITED_TO_ARENA_TEAM = 0x04, + ERR_ALREADY_INVITED_TO_ARENA_TEAM_S = 0x05, + ERR_ARENA_TEAM_NAME_INVALID = 0x06, + ERR_ARENA_TEAM_NAME_EXISTS_S = 0x07, + ERR_ARENA_TEAM_LEADER_LEAVE_S = 0x08, + ERR_ARENA_TEAM_PERMISSIONS = 0x08, + ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM = 0x09, + ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM_SS = 0x0A, + ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S = 0x0B, + ERR_ARENA_TEAM_NOT_ALLIED = 0x0C, + ERR_ARENA_TEAM_IGNORING_YOU_S = 0x13, + ERR_ARENA_TEAM_TARGET_TOO_LOW_S = 0x15, + ERR_ARENA_TEAM_TARGET_TOO_HIGH_S = 0x16, + ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S = 0x17, + ERR_ARENA_TEAM_NOT_FOUND = 0x1B, + ERR_ARENA_TEAMS_LOCKED = 0x1E +}; + +enum ArenaTeamEvents +{ + ERR_ARENA_TEAM_JOIN_SS = 3, // player name + arena team name + ERR_ARENA_TEAM_LEAVE_SS = 4, // player name + arena team name + ERR_ARENA_TEAM_REMOVE_SSS = 5, // player name + arena team name + captain name + ERR_ARENA_TEAM_LEADER_IS_SS = 6, // player name + arena team name + ERR_ARENA_TEAM_LEADER_CHANGED_SSS = 7, // old captain + new captain + arena team name + ERR_ARENA_TEAM_DISBANDED_S = 8 // captain name + arena team name +}; + +/* +need info how to send these ones: +ERR_ARENA_TEAM_YOU_JOIN_S - client show it automatically when accept invite +ERR_ARENA_TEAM_TARGET_TOO_LOW_S +ERR_ARENA_TEAM_TOO_MANY_MEMBERS_S +ERR_ARENA_TEAM_LEVEL_TOO_LOW_I +*/ + +enum ArenaTeamStatTypes +{ + STAT_TYPE_RATING = 0, + STAT_TYPE_GAMES_WEEK = 1, + STAT_TYPE_WINS_WEEK = 2, + STAT_TYPE_GAMES_SEASON = 3, + STAT_TYPE_WINS_SEASON = 4, + STAT_TYPE_RANK = 5 +}; + +enum ArenaTeamTypes +{ + ARENA_TEAM_2v2 = 2, + ARENA_TEAM_3v3 = 3, + ARENA_TEAM_5v5 = 5 +}; + +struct ArenaTeamMember +{ + uint64 guid; + std::string name; + uint8 Class; + uint32 games_week; + uint32 wins_week; + uint32 games_season; + uint32 wins_season; + uint32 personal_rating; + + void ModifyPersonalRating(Player* plr, int32 mod, uint32 slot); +}; + +struct ArenaTeamStats +{ + uint32 rating; + uint32 games_week; + uint32 wins_week; + uint32 games_season; + uint32 wins_season; + uint32 rank; +}; + +#define MAX_ARENA_SLOT 3 // 0..2 slots + +class ArenaTeam +{ + public: + ArenaTeam(); + ~ArenaTeam(); + + bool Create(uint64 captainGuid, uint32 type, std::string ArenaTeamName); + void Disband(WorldSession *session); + + typedef std::list MemberList; + + uint32 GetId() const { return m_TeamId; } + uint32 GetType() const { return m_Type; } + uint8 GetSlot() const { return GetSlotByType(GetType()); } + static uint8 GetSlotByType(uint32 type); + const uint64& GetCaptain() const { return m_CaptainGuid; } + std::string GetName() const { return m_Name; } + const ArenaTeamStats& GetStats() const { return m_stats; } + void SetStats(uint32 stat_type, uint32 value); + uint32 GetRating() const { return m_stats.rating; } + + uint32 GetEmblemStyle() const { return m_EmblemStyle; } + uint32 GetEmblemColor() const { return m_EmblemColor; } + uint32 GetBorderStyle() const { return m_BorderStyle; } + uint32 GetBorderColor() const { return m_BorderColor; } + uint32 GetBackgroundColor() const { return m_BackgroundColor; } + + void SetCaptain(const uint64& guid); + bool AddMember(const uint64& PlayerGuid); + + // Shouldn't be const uint64& ed, because than can reference guid from members on Disband + // and this method removes given record from list. So invalid reference can happen. + void DelMember(uint64 guid); + + void SetEmblem(uint32 backgroundColor, uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor); + + size_t GetMembersSize() const { return m_members.size(); } + bool Empty() const { return m_members.empty(); } + MemberList::iterator m_membersBegin() { return m_members.begin(); } + MemberList::iterator m_membersEnd() { return m_members.end(); } + bool HaveMember(const uint64& guid) const; + + ArenaTeamMember* GetMember(const uint64& guid) + { + for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + if (itr->guid == guid) + return &(*itr); + + return NULL; + } + + ArenaTeamMember* GetMember(const std::string& name) + { + for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + if (itr->name == name) + return &(*itr); + + return NULL; + } + + bool IsFighting() const; + + bool LoadArenaTeamFromDB(QueryResult_AutoPtr arenaTeamDataResult); + bool LoadMembersFromDB(QueryResult_AutoPtr arenaTeamMembersResult); + void LoadStatsFromDB(uint32 ArenaTeamId); + + void SaveToDB(); + + void BroadcastPacket(WorldPacket *packet); + void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3); + + void Roster(WorldSession *session); + void Query(WorldSession *session); + void Stats(WorldSession *session); + void InspectStats(WorldSession *session, uint64 guid); + + uint32 GetPoints(uint32 MemberRating); + float GetChanceAgainst(uint32 own_rating, uint32 enemy_rating); + int32 WonAgainst(uint32 againstRating); + void MemberWon(Player * plr, uint32 againstRating); + int32 LostAgainst(uint32 againstRating); + void MemberLost(Player * plr, uint32 againstRating); + void OfflineMemberLost(uint64 guid, uint32 againstRating); + + void UpdateArenaPointsHelper(std::map & PlayerPoints); + + void NotifyStatsChanged(); + + void FinishWeek(); + void FinishGame(int32 mod); + + protected: + + uint32 m_TeamId; + uint32 m_Type; + std::string m_Name; + uint64 m_CaptainGuid; + + uint32 m_BackgroundColor; // ARGB format + uint32 m_EmblemStyle; // icon id + uint32 m_EmblemColor; // ARGB format + uint32 m_BorderStyle; // border image id + uint32 m_BorderColor; // ARGB format + + MemberList m_members; + ArenaTeamStats m_stats; +}; +#endif + diff --git a/src/server/game/BattleGrounds/BattleGround.cpp b/src/server/game/BattleGrounds/BattleGround.cpp new file mode 100644 index 0000000..267d9a4 --- /dev/null +++ b/src/server/game/BattleGrounds/BattleGround.cpp @@ -0,0 +1,1967 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Player.h" +#include "ObjectMgr.h" +#include "World.h" +#include "WorldPacket.h" + +#include "ArenaTeam.h" +#include "BattleGround.h" +#include "BattleGroundMgr.h" +#include "Creature.h" +#include "Formulas.h" +#include "GridNotifiersImpl.h" +#include "Group.h" +#include "Language.h" +#include "MapManager.h" +#include "Object.h" +#include "SpellAuras.h" +#include "SpellAuraEffects.h" +#include "Util.h" + +namespace Trinity +{ + class BattleGroundChatBuilder + { + public: + BattleGroundChatBuilder(ChatMsg msgtype, int32 textId, Player const* source, va_list* args = NULL) + : i_msgtype(msgtype), i_textId(textId), i_source(source), i_args(args) {} + void operator()(WorldPacket& data, int32 loc_idx) + { + char const* text = objmgr.GetTrinityString(i_textId,loc_idx); + + if (i_args) + { + // we need copy va_list before use or original va_list will corrupted + va_list ap; + va_copy(ap,*i_args); + + char str [2048]; + vsnprintf(str,2048,text, ap); + va_end(ap); + + do_helper(data,&str[0]); + } + else + do_helper(data,text); + } + private: + void do_helper(WorldPacket& data, char const* text) + { + uint64 target_guid = i_source ? i_source ->GetGUID() : 0; + + data << uint8(i_msgtype); + data << uint32(LANG_UNIVERSAL); + data << uint64(target_guid); // there 0 for BG messages + data << uint32(0); // can be chat msg group or something + data << uint64(target_guid); + data << uint32(strlen(text)+1); + data << text; + data << uint8(i_source ? i_source->chatTag() : uint8(0)); + } + + ChatMsg i_msgtype; + int32 i_textId; + Player const* i_source; + va_list* i_args; + }; + + class BattleGround2ChatBuilder + { + public: + BattleGround2ChatBuilder(ChatMsg msgtype, int32 textId, Player const* source, int32 arg1, int32 arg2) + : i_msgtype(msgtype), i_textId(textId), i_source(source), i_arg1(arg1), i_arg2(arg2) {} + void operator()(WorldPacket& data, int32 loc_idx) + { + char const* text = objmgr.GetTrinityString(i_textId,loc_idx); + char const* arg1str = i_arg1 ? objmgr.GetTrinityString(i_arg1,loc_idx) : ""; + char const* arg2str = i_arg2 ? objmgr.GetTrinityString(i_arg2,loc_idx) : ""; + + char str [2048]; + snprintf(str,2048,text, arg1str, arg2str); + + uint64 target_guid = i_source ? i_source ->GetGUID() : 0; + + data << uint8(i_msgtype); + data << uint32(LANG_UNIVERSAL); + data << uint64(target_guid); // there 0 for BG messages + data << uint32(0); // can be chat msg group or something + data << uint64(target_guid); + data << uint32(strlen(str)+1); + data << str; + data << uint8(i_source ? i_source->chatTag() : uint8(0)); + } + private: + + ChatMsg i_msgtype; + int32 i_textId; + Player const* i_source; + int32 i_arg1; + int32 i_arg2; + }; +} // namespace Trinity + +template +void BattleGround::BroadcastWorker(Do& _do) +{ + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) + _do(plr); +} + +BattleGround::BattleGround() +{ + m_TypeID = BattleGroundTypeId(0); + m_RandomTypeID = BattleGroundTypeId(0); + m_InstanceID = 0; + m_Status = STATUS_NONE; + m_ClientInstanceID = 0; + m_EndTime = 0; + m_LastResurrectTime = 0; + m_BracketId = BG_BRACKET_ID_FIRST; + m_InvitedAlliance = 0; + m_InvitedHorde = 0; + m_ArenaType = 0; + m_IsArena = false; + m_Winner = 2; + m_StartTime = 0; + m_Events = 0; + m_IsRated = false; + m_BuffChange = false; + m_IsRandom = false; + m_Name = ""; + m_LevelMin = 0; + m_LevelMax = 0; + m_InBGFreeSlotQueue = false; + m_SetDeleteThis = false; + + m_MaxPlayersPerTeam = 0; + m_MaxPlayers = 0; + m_MinPlayersPerTeam = 0; + m_MinPlayers = 0; + + m_MapId = 0; + m_Map = NULL; + + m_TeamStartLocX[BG_TEAM_ALLIANCE] = 0; + m_TeamStartLocX[BG_TEAM_HORDE] = 0; + + m_TeamStartLocY[BG_TEAM_ALLIANCE] = 0; + m_TeamStartLocY[BG_TEAM_HORDE] = 0; + + m_TeamStartLocZ[BG_TEAM_ALLIANCE] = 0; + m_TeamStartLocZ[BG_TEAM_HORDE] = 0; + + m_TeamStartLocO[BG_TEAM_ALLIANCE] = 0; + m_TeamStartLocO[BG_TEAM_HORDE] = 0; + + m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0; + m_ArenaTeamIds[BG_TEAM_HORDE] = 0; + + m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0; + m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0; + + m_BgRaids[BG_TEAM_ALLIANCE] = NULL; + m_BgRaids[BG_TEAM_HORDE] = NULL; + + m_PlayersCount[BG_TEAM_ALLIANCE] = 0; + m_PlayersCount[BG_TEAM_HORDE] = 0; + + m_TeamScores[BG_TEAM_ALLIANCE] = 0; + m_TeamScores[BG_TEAM_HORDE] = 0; + + m_PrematureCountDown = false; + m_PrematureCountDown = 0; + + m_HonorMode = BG_NORMAL; + + m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_2M; + m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M; + m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; + m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + //we must set to some default existing values + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + honor_mod = 1; +} + +BattleGround::~BattleGround() +{ + // remove objects and creatures + // (this is done automatically in mapmanager update, when the instance is reset after the reset time) + int size = m_BgCreatures.size(); + for (int i = 0; i < size; ++i) + DelCreature(i); + + size = m_BgObjects.size(); + for (int i = 0; i < size; ++i) + DelObject(i); + + if (GetInstanceID()) // not spam by useless queries in case BG templates + { + // delete creature and go respawn times + WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE instance = '%u'",GetInstanceID()); + WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'",GetInstanceID()); + // delete instance from db + CharacterDatabase.PExecute("DELETE FROM instance WHERE id = '%u'",GetInstanceID()); + // remove from battlegrounds + } + + sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID()); + // unload map + if (m_Map) + m_Map->SetUnload(); + // remove from bg free slot queue + this->RemoveFromBGFreeSlotQueue(); + + for (BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) + delete itr->second; +} + +void BattleGround::Update(uint32 diff) +{ + if (!GetPlayersSize()) + { + //BG is empty + // if there are no players invited, delete BG + // this will delete arena or bg object, where any player entered + // [[ but if you use battleground object again (more battles possible to be played on 1 instance) + // then this condition should be removed and code: + // if (!GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE)) + // this->AddToFreeBGObjectsQueue(); // not yet implemented + // should be used instead of current + // ]] + // BattleGround Template instance cannot be updated, because it would be deleted + if (!GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE)) + m_SetDeleteThis = true; + return; + } + + // remove offline players from bg after 5 minutes + if (!m_OfflineQueue.empty()) + { + BattleGroundPlayerMap::iterator itr = m_Players.find(*(m_OfflineQueue.begin())); + if (itr != m_Players.end()) + { + if (itr->second.OfflineRemoveTime <= sWorld.GetGameTime()) + { + RemovePlayerAtLeave(itr->first, true, true);// remove player from BG + m_OfflineQueue.pop_front(); // remove from offline queue + //do not use itr for anything, because it is erased in RemovePlayerAtLeave() + } + } + } + + /*********************************************************/ + /*** BATTLEGROUND RESSURECTION SYSTEM ***/ + /*********************************************************/ + + //this should be handled by spell system + m_LastResurrectTime += diff; + if (m_LastResurrectTime >= RESURRECTION_INTERVAL) + { + if (GetReviveQueueSize()) + { + for (std::map >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) + { + Creature *sh = NULL; + for (std::vector::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) + { + Player *plr = objmgr.GetPlayer(*itr2); + if (!plr) + continue; + + if (!sh && plr->IsInWorld()) + { + sh = plr->GetMap()->GetCreature(itr->first); + // only for visual effect + if (sh) + // Spirit Heal, effect 117 + sh->CastSpell(sh, SPELL_SPIRIT_HEAL, true); + } + + // Resurrection visual + plr->CastSpell(plr, SPELL_RESURRECTION_VISUAL, true); + m_ResurrectQueue.push_back(*itr2); + } + (itr->second).clear(); + } + + m_ReviveQueue.clear(); + m_LastResurrectTime = 0; + } + else + // queue is clear and time passed, just update last resurrection time + m_LastResurrectTime = 0; + } + else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC + { + for (std::vector::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) + { + Player *plr = objmgr.GetPlayer(*itr); + if (!plr) + continue; + plr->ResurrectPlayer(1.0f); + plr->CastSpell(plr, 6962, true); + plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true); + sObjectAccessor.ConvertCorpseForPlayer(*itr); + } + m_ResurrectQueue.clear(); + } + + /*********************************************************/ + /*** BATTLEGROUND BALLANCE SYSTEM ***/ + /*********************************************************/ + + // if less then minimum players are in on one side, then start premature finish timer + if (GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam())) + { + if (!m_PrematureCountDown) + { + m_PrematureCountDown = true; + m_PrematureCountDownTimer = sBattleGroundMgr.GetPrematureFinishTime(); + } + else if (m_PrematureCountDownTimer < diff) + { + // time's up! + uint32 winner = 0; + if (GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam()) + winner = ALLIANCE; + else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam()) + winner = HORDE; + + EndBattleGround(winner); + m_PrematureCountDown = false; + } + else if (!sBattleGroundMgr.isTesting()) + { + uint32 newtime = m_PrematureCountDownTimer - diff; + // announce every minute + if (newtime > (MINUTE * IN_MILLISECONDS)) + { + if (newtime / (MINUTE * IN_MILLISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)) + PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))); + } + else + { + //announce every 15 seconds + if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS)) + PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS)); + } + m_PrematureCountDownTimer = newtime; + } + } + else if (m_PrematureCountDown) + m_PrematureCountDown = false; + + /*********************************************************/ + /*** BATTLEGROUND STARTING SYSTEM ***/ + /*********************************************************/ + + if (GetStatus() == STATUS_WAIT_JOIN && GetPlayersSize()) + { + ModifyStartDelayTime(diff); + + if (!(m_Events & BG_STARTING_EVENT_1)) + { + m_Events |= BG_STARTING_EVENT_1; + + // setup here, only when at least one player has ported to the map + if (!SetupBattleGround()) + { + EndNow(); + return; + } + + StartingEventCloseDoors(); + SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FIRST]); + //first start warning - 2 or 1 minute + SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); + } + // After 1 minute or 30 seconds, warning is signalled + else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) + { + m_Events |= BG_STARTING_EVENT_2; + SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); + } + // After 30 or 15 seconds, warning is signalled + else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) + { + m_Events |= BG_STARTING_EVENT_3; + SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); + } + // delay expired (atfer 2 or 1 minute) + else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) + { + m_Events |= BG_STARTING_EVENT_4; + + StartingEventOpenDoors(); + + SendWarningToAll(m_StartMessageIds[BG_STARTING_EVENT_FOURTH]); + SetStatus(STATUS_IN_PROGRESS); + SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FOURTH]); + + //remove preparation + if (isArena()) + { + //TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START); + + for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (Player *plr = objmgr.GetPlayer(itr->first)) + { + plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); + // remove auras with duration lower than 30s + Unit::AuraApplicationMap & auraMap = plr->GetAppliedAuras(); + for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();) + { + AuraApplication * aurApp = iter->second; + Aura * aura = aurApp->GetBase(); + if (!aura->IsPermanent() + && aura->GetDuration() <= 30*IN_MILLISECONDS + && aurApp->IsPositive() + && (!(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)) + && (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY))) + plr->RemoveAura(iter); + else + ++iter; + } + } + + CheckArenaWinConditions(); + } + else + { + + PlaySoundToAll(SOUND_BG_START); + + for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + if (Player* plr = objmgr.GetPlayer(itr->first)) + plr->RemoveAurasDueToSpell(SPELL_PREPARATION); + //Announce BG starting + if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) + { + sWorld.SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel()); + } + } + } + } + + /*********************************************************/ + /*** BATTLEGROUND ENDING SYSTEM ***/ + /*********************************************************/ + + if (GetStatus() == STATUS_WAIT_LEAVE) + { + // remove all players from battleground after 2 minutes + m_EndTime -= diff; + if (m_EndTime <= 0) + { + m_EndTime = 0; + BattleGroundPlayerMap::iterator itr, next; + for (itr = m_Players.begin(); itr != m_Players.end(); itr = next) + { + next = itr; + ++next; + //itr is erased here! + RemovePlayerAtLeave(itr->first, true, true);// remove player from BG + // do not change any battleground's private variables + } + } + } + + //update start time + m_StartTime += diff; +} + +void BattleGround::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O) +{ + BattleGroundTeamId idx = GetTeamIndexByTeamId(TeamID); + m_TeamStartLocX[idx] = X; + m_TeamStartLocY[idx] = Y; + m_TeamStartLocZ[idx] = Z; + m_TeamStartLocO[idx] = O; +} + +void BattleGround::SendPacketToAll(WorldPacket *packet) +{ + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (itr->second.OfflineRemoveTime) + continue; + Player *plr = objmgr.GetPlayer(itr->first); + if (plr) + plr->GetSession()->SendPacket(packet); + else + sLog.outError("BattleGround:SendPacketToAll: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + } +} + +void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender, bool self) +{ + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (itr->second.OfflineRemoveTime) + continue; + Player *plr = objmgr.GetPlayer(itr->first); + if (!plr) + { + sLog.outError("BattleGround:SendPacketToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + continue; + } + + if (!self && sender == plr) + continue; + + uint32 team = itr->second.Team; + if (!team) team = plr->GetTeam(); + + if (team == TeamID) + plr->GetSession()->SendPacket(packet); + } +} + +void BattleGround::PlaySoundToAll(uint32 SoundID) +{ + WorldPacket data; + sBattleGroundMgr.BuildPlaySoundPacket(&data, SoundID); + SendPacketToAll(&data); +} + +void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) +{ + WorldPacket data; + + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (itr->second.OfflineRemoveTime) + continue; + Player *plr = objmgr.GetPlayer(itr->first); + + if (!plr) + { + sLog.outError("BattleGround:PlaySoundToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + continue; + } + + uint32 team = itr->second.Team; + if (!team) team = plr->GetTeam(); + + if (team == TeamID) + { + sBattleGroundMgr.BuildPlaySoundPacket(&data, SoundID); + plr->GetSession()->SendPacket(&data); + } + } +} + +void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) +{ + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (itr->second.OfflineRemoveTime) + continue; + Player *plr = objmgr.GetPlayer(itr->first); + + if (!plr) + { + sLog.outError("BattleGround:CastSpellOnTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + continue; + } + + uint32 team = itr->second.Team; + if (!team) team = plr->GetTeam(); + + if (team == TeamID) + plr->CastSpell(plr, SpellID, true); + } +} + +void BattleGround::YellToAll(Creature* creature, const char* text, uint32 language) +{ + for (std::map::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + WorldPacket data(SMSG_MESSAGECHAT, 200); + Player *plr = objmgr.GetPlayer(itr->first); + if (!plr) + { + sLog.outError("BattleGround: Player " UI64FMTD " not found!", itr->first); + continue; + } + creature->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,text,language,creature->GetName(),itr->first); + plr->GetSession()->SendPacket(&data); + } +} + +void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) +{ + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (itr->second.OfflineRemoveTime) + continue; + Player *plr = objmgr.GetPlayer(itr->first); + + if (!plr) + { + sLog.outError("BattleGround:RewardHonorToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + continue; + } + + uint32 team = itr->second.Team; + if (!team) team = plr->GetTeam(); + + if (team == TeamID) + UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor); + } +} + +void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID) +{ + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); + + if (!factionEntry) + return; + + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (itr->second.OfflineRemoveTime) + continue; + Player *plr = objmgr.GetPlayer(itr->first); + + if (!plr) + { + sLog.outError("BattleGround:RewardReputationToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + continue; + } + + uint32 team = itr->second.Team; + if (!team) team = plr->GetTeam(); + + if (team == TeamID) + plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation); + } +} + +void BattleGround::UpdateWorldState(uint32 Field, uint32 Value) +{ + WorldPacket data; + sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, Field, Value); + SendPacketToAll(&data); +} + +void BattleGround::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source) +{ + WorldPacket data; + sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, Field, Value); + Source->GetSession()->SendPacket(&data); +} + +void BattleGround::EndBattleGround(uint32 winner) +{ + this->RemoveFromBGFreeSlotQueue(); + + ArenaTeam * winner_arena_team = NULL; + ArenaTeam * loser_arena_team = NULL; + uint32 loser_rating = 0; + uint32 winner_rating = 0; + WorldPacket data; + int32 winmsg_id = 0; + + if (winner == ALLIANCE) + { + winmsg_id = isBattleGround() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; + + PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound + + SetWinner(WINNER_ALLIANCE); + } + else if (winner == HORDE) + { + winmsg_id = isBattleGround() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS; + + PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound + + SetWinner(WINNER_HORDE); + } + else + { + SetWinner(3); + } + + SetStatus(STATUS_WAIT_LEAVE); + //we must set it this way, because end time is sent in packet! + m_EndTime = TIME_TO_AUTOREMOVE; + + // arena rating calculation + if (isArena() && isRated()) + { + winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner)); + loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner))); + if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) + { + loser_rating = loser_arena_team->GetStats().rating; + winner_rating = winner_arena_team->GetStats().rating; + int32 winner_change = winner_arena_team->WonAgainst(loser_rating); + int32 loser_change = loser_arena_team->LostAgainst(winner_rating); + sLog.outDebug("--- Winner rating: %u, Loser rating: %u, Winner change: %u, Losser change: %u ---", winner_rating, loser_rating, winner_change, loser_change); + SetArenaTeamRatingChangeForTeam(winner, winner_change); + SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change); + sLog.outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. RatingChange: %i.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change); + } + else + { + SetArenaTeamRatingChangeForTeam(ALLIANCE, 0); + SetArenaTeamRatingChangeForTeam(HORDE, 0); + } + } + + for (BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + uint32 team = itr->second.Team; + + if (itr->second.OfflineRemoveTime) + { + //if rated arena match - make member lost! + if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) + { + if (team == winner) + winner_arena_team->OfflineMemberLost(itr->first, loser_rating); + else + loser_arena_team->OfflineMemberLost(itr->first, winner_rating); + } + continue; + } + Player *plr = objmgr.GetPlayer(itr->first); + if (!plr) + { + sLog.outError("BattleGround:EndBattleGround Player (GUID: %u) not found!", GUID_LOPART(itr->first)); + continue; + } + + // should remove spirit of redemption + if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + + if (!plr->isAlive()) + { + plr->ResurrectPlayer(1.0f); + plr->SpawnCorpseBones(); + } + else + { + //needed cause else in av some creatures will kill the players at the end + plr->CombatStop(); + plr->getHostileRefManager().deleteReferences(); + } + + //this line is obsolete - team is set ALWAYS + //if (!team) team = plr->GetTeam(); + + // per player calculation + if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) + { + if (team == winner) + { + // update achievement BEFORE personal rating update + ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetGUID()); + if (member) + plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->personal_rating); + + winner_arena_team->MemberWon(plr,loser_rating); + } + else + { + loser_arena_team->MemberLost(plr,winner_rating); + + // Arena lost => reset the win_rated_arena having the "no_loose" condition + plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE); + } + } + + uint32 win_kills = plr->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST; + uint32 loos_kills = plr->GetRandomWinner() ? BG_REWARD_LOOSER_HONOR_LAST : BG_REWARD_LOOSER_HONOR_FIRST; + uint32 win_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST; + + // Reward winner team + if (team == winner) + { + if (IsRandom() || BattleGroundMgr::IsBGWeekend(GetTypeID())) + { + UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(win_kills)); + plr->ModifyArenaPoints(win_arena); + if (!plr->GetRandomWinner()) + plr->SetRandomWinner(true); + } + + plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1); + } + else + { + if (IsRandom() || BattleGroundMgr::IsBGWeekend(GetTypeID())) + UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loos_kills)); + } + + + plr->SetHealth(plr->GetMaxHealth()); + plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA)); + plr->CombatStopWithPets(true); + + BlockMovement(plr); + + sBattleGroundMgr.BuildPvpLogDataPacket(&data, this); + plr->GetSession()->SendPacket(&data); + + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType()); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType()); + plr->GetSession()->SendPacket(&data); + plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1); + } + + if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) + { + // update arena points only after increasing the player's match count! + //obsolete: winner_arena_team->UpdateArenaPointsHelper(); + //obsolete: loser_arena_team->UpdateArenaPointsHelper(); + // save the stat changes + winner_arena_team->SaveToDB(); + loser_arena_team->SaveToDB(); + // send updated arena team stats to players + // this way all arena team members will get notified, not only the ones who participated in this match + winner_arena_team->NotifyStatsChanged(); + loser_arena_team->NotifyStatsChanged(); + } + + if (winmsg_id) + SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL); +} + +uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const +{ + //variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill) + uint32 maxLevel = (GetMaxLevel() < 80) ? GetMaxLevel() : 80; + return Trinity::Honor::hk_honor_at_level(maxLevel, kills); +} + +uint32 BattleGround::GetBattlemasterEntry() const +{ + switch(GetTypeID(true)) + { + case BATTLEGROUND_AV: return 15972; + case BATTLEGROUND_WS: return 14623; + case BATTLEGROUND_AB: return 14879; + case BATTLEGROUND_EY: return 22516; + case BATTLEGROUND_NA: return 20200; + default: return 0; + } +} + +void BattleGround::BlockMovement(Player *plr) +{ + plr->SetClientControl(plr, 0); // movement disabled NOTE: the effect will be automatically removed by client when the player is teleported from the battleground, so no need to send with uint8(1) in RemovePlayerAtLeave() +} + +void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket) +{ + uint32 team = GetPlayerTeam(guid); + bool participant = false; + // Remove from lists/maps + BattleGroundPlayerMap::iterator itr = m_Players.find(guid); + if (itr != m_Players.end()) + { + UpdatePlayersCountByTeam(team, true); // -1 player + m_Players.erase(itr); + // check if the player was a participant of the match, or only entered through gm command (goname) + participant = true; + } + + BattleGroundScoreMap::iterator itr2 = m_PlayerScores.find(guid); + if (itr2 != m_PlayerScores.end()) + { + delete itr2->second; // delete player's score + m_PlayerScores.erase(itr2); + } + + RemovePlayerFromResurrectQueue(guid); + + Player *plr = objmgr.GetPlayer(guid); + + // should remove spirit of redemption + if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + + if (plr && !plr->isAlive()) // resurrect on exit + { + plr->ResurrectPlayer(1.0f); + plr->SpawnCorpseBones(); + } + + RemovePlayer(plr, guid); // BG subclass specific code + + if (participant) // if the player was a match participant, remove auras, calc rating, update queue + { + BattleGroundTypeId bgTypeId = GetTypeID(); + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType()); + if (plr) + { + plr->ClearAfkReports(); + + if (!team) team = plr->GetTeam(); + + // if arena, remove the specific arena auras + if (isArena()) + { + plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out + bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing) + + // unsummon current and summon old pet if there was one and there isn't a current pet + plr->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT); + plr->ResummonPetTemporaryUnSummonedIfAny(); + + if (isRated() && GetStatus() == STATUS_IN_PROGRESS) + { + //left a rated match while the encounter was in progress, consider as loser + ArenaTeam * winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); + ArenaTeam * loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team)); + if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) + loser_arena_team->MemberLost(plr,winner_arena_team->GetRating()); + } + } + if (SendPacket) + { + WorldPacket data; + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0); + plr->GetSession()->SendPacket(&data); + } + + // this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg + plr->RemoveBattleGroundQueueId(bgQueueTypeId); + } + else + // removing offline participant + { + if (isRated() && GetStatus() == STATUS_IN_PROGRESS) + { + //left a rated match while the encounter was in progress, consider as loser + ArenaTeam * others_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); + ArenaTeam * players_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team)); + if (others_arena_team && players_arena_team) + players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating()); + } + } + + // remove from raid group if player is member + if (Group *group = GetBgRaid(team)) + { + if (!group->RemoveMember(guid, 0)) // group was disbanded + { + SetBgRaid(team, NULL); + delete group; + } + } + DecreaseInvitedCount(team); + //we should update battleground queue, but only if bg isn't ending + if (isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE) + { + // a player has left the battleground, so there are free slots -> add to queue + AddToBGFreeSlotQueue(); + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, GetBracketId()); + } + // Let others know + WorldPacket data; + sBattleGroundMgr.BuildPlayerLeftBattleGroundPacket(&data, guid); + SendPacketToTeam(team, &data, plr, false); + } + + if (plr) + { + // Do next only if found in battleground + plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG. + // reset destination bg team + plr->SetBGTeam(0); + + if (Transport) + plr->TeleportToBGEntryPoint(); + + sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName()); + } + + //battleground object will be deleted next BattleGround::Update() call +} + +// this method is called when no players remains in battleground +void BattleGround::Reset() +{ + SetWinner(WINNER_NONE); + SetStatus(STATUS_WAIT_QUEUE); + SetStartTime(0); + SetEndTime(0); + SetLastResurrectTime(0); + SetArenaType(0); + SetRated(false); + + m_Events = 0; + + if (m_InvitedAlliance > 0 || m_InvitedHorde > 0) + sLog.outError("BattleGround system: bad counter, m_InvitedAlliance: %d, m_InvitedHorde: %d", m_InvitedAlliance, m_InvitedHorde); + + m_InvitedAlliance = 0; + m_InvitedHorde = 0; + m_InBGFreeSlotQueue = false; + + m_Players.clear(); + + for (BattleGroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) + delete itr->second; + m_PlayerScores.clear(); + + ResetBGSubclass(); +} + +void BattleGround::StartBattleGround() +{ + SetStartTime(0); + SetLastResurrectTime(0); + // add BG to free slot queue + AddToBGFreeSlotQueue(); + + // add bg to update list + // This must be done here, because we need to have already invited some players when first BG::Update() method is executed + // and it doesn't matter if we call StartBattleGround() more times, because m_BattleGrounds is a map and instance id never changes + sBattleGroundMgr.AddBattleGround(GetInstanceID(), GetTypeID(), this); + if (m_IsRated) + sLog.outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); +} + +void BattleGround::AddPlayer(Player *plr) +{ + // remove afk from player + if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK)) + plr->ToggleAFK(); + + // score struct must be created in inherited class + + uint64 guid = plr->GetGUID(); + uint32 team = plr->GetBGTeam(); + + BattleGroundPlayer bp; + bp.OfflineRemoveTime = 0; + bp.Team = team; + + // Add to list/maps + m_Players[guid] = bp; + + UpdatePlayersCountByTeam(team, false); // +1 player + + WorldPacket data; + sBattleGroundMgr.BuildPlayerJoinedBattleGroundPacket(&data, plr); + SendPacketToTeam(team, &data, plr, false); + + // BG Status packet + WorldPacket status; + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(m_TypeID, GetArenaType()); + uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&status, this, queueSlot, STATUS_IN_PROGRESS, 0, GetStartTime(), GetArenaType()); + plr->GetSession()->SendPacket(&status); + + plr->RemoveAurasByType(SPELL_AURA_MOUNTED); + + // add arena specific auras + if (isArena()) + { + plr->RemoveArenaSpellCooldowns(); + plr->RemoveArenaAuras(); + plr->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT); + if (team == ALLIANCE) // gold + { + if (plr->GetTeam() == HORDE) + plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true); + else + plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG,true); + } + else // green + { + if (plr->GetTeam() == HORDE) + plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG,true); + else + plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true); + } + + plr->DestroyConjuredItems(true); + plr->UnsummonPetTemporaryIfAny(); + + if (GetStatus() == STATUS_WAIT_JOIN) // not started yet + { + plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true); + + plr->SetHealth(plr->GetMaxHealth()); + plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA)); + } + } + else + { + if (GetStatus() == STATUS_WAIT_JOIN) // not started yet + plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells. + } + + plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_MAP, GetMapId()); + plr->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_MAP, GetMapId()); + + // setup BG group membership + PlayerAddedToBGCheckIfBGIsRunning(plr); + AddOrSetPlayerToCorrectBgGroup(plr, guid, team); + + // Log + sLog.outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName()); +} + +/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */ +void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team) +{ + Group* group = GetBgRaid(team); + if (!group) // first player joined + { + group = new Group; + SetBgRaid(team, group); + group->Create(plr_guid, plr->GetName()); + } + else // raid already exist + { + if (group->IsMember(plr_guid)) + { + uint8 subgroup = group->GetMemberGroup(plr_guid); + plr->SetBattleGroundRaid(group, subgroup); + } + else + { + group->AddMember(plr_guid, plr->GetName()); + if (Group* originalGroup = plr->GetOriginalGroup()) + if (originalGroup->IsLeader(plr_guid)) + group->ChangeLeader(plr_guid); + } + } +} + +// This method should be called when player logs into running battleground +void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid) +{ + // player is correct pointer + for (std::deque::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr) + { + if (*itr == plr_guid) + { + m_OfflineQueue.erase(itr); + break; + } + } + m_Players[plr_guid].OfflineRemoveTime = 0; + PlayerAddedToBGCheckIfBGIsRunning(player); + // if battleground is starting, then add preparation aura + // we don't have to do that, because preparation aura isn't removed when player logs out +} + +// This method should be called when player logs out from running battleground +void BattleGround::EventPlayerLoggedOut(Player* player) +{ + // player is correct pointer, it is checked in WorldSession::LogoutPlayer() + m_OfflineQueue.push_back(player->GetGUID()); + m_Players[player->GetGUID()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME; + if (GetStatus() == STATUS_IN_PROGRESS) + { + // drop flag and handle other cleanups + RemovePlayer(player, player->GetGUID()); + + // 1 player is logging out, if it is the last, then end arena! + if (isArena()) + if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam()))) + EndBattleGround(GetOtherTeam(player->GetTeam())); + } + + player->LeaveBattleground(); +} + +/* This method should be called only once ... it adds pointer to queue */ +void BattleGround::AddToBGFreeSlotQueue() +{ + // make sure to add only once + if (!m_InBGFreeSlotQueue && isBattleGround()) + { + sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].push_front(this); + m_InBGFreeSlotQueue = true; + } +} + +/* This method removes this battleground from free queue - it must be called when deleting battleground - not used now*/ +void BattleGround::RemoveFromBGFreeSlotQueue() +{ + // set to be able to re-add if needed + m_InBGFreeSlotQueue = false; + // uncomment this code when battlegrounds will work like instances + for (BGFreeSlotQueueType::iterator itr = sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].begin(); itr != sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].end(); ++itr) + { + if ((*itr)->GetInstanceID() == m_InstanceID) + { + sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].erase(itr); + return; + } + } +} + +// get the number of free slots for team +// returns the number how many players can join battleground to MaxPlayersPerTeam +uint32 BattleGround::GetFreeSlotsForTeam(uint32 Team) const +{ + //if BG is starting ... invite anyone + if (GetStatus() == STATUS_WAIT_JOIN) + return (GetInvitedCount(Team) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(Team) : 0; + //if BG is already started .. do not allow to join too much players of one faction + uint32 otherTeam; + uint32 otherIn; + if (Team == ALLIANCE) + { + otherTeam = GetInvitedCount(HORDE); + otherIn = GetPlayersCountByTeam(HORDE); + } + else + { + otherTeam = GetInvitedCount(ALLIANCE); + otherIn = GetPlayersCountByTeam(ALLIANCE); + } + if (GetStatus() == STATUS_IN_PROGRESS) + { + // difference based on ppl invited (not necessarily entered battle) + // default: allow 0 + uint32 diff = 0; + // allow join one person if the sides are equal (to fill up bg to minplayersperteam) + if (otherTeam == GetInvitedCount(Team)) + diff = 1; + // allow join more ppl if the other side has more players + else if (otherTeam > GetInvitedCount(Team)) + diff = otherTeam - GetInvitedCount(Team); + + // difference based on max players per team (don't allow inviting more) + uint32 diff2 = (GetInvitedCount(Team) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(Team) : 0; + // difference based on players who already entered + // default: allow 0 + uint32 diff3 = 0; + // allow join one person if the sides are equal (to fill up bg minplayersperteam) + if (otherIn == GetPlayersCountByTeam(Team)) + diff3 = 1; + // allow join more ppl if the other side has more players + else if (otherIn > GetPlayersCountByTeam(Team)) + diff3 = otherIn - GetPlayersCountByTeam(Team); + // or other side has less than minPlayersPerTeam + else if (GetInvitedCount(Team) <= GetMinPlayersPerTeam()) + diff3 = GetMinPlayersPerTeam() - GetInvitedCount(Team) + 1; + + // return the minimum of the 3 differences + + // min of diff and diff 2 + diff = diff < diff2 ? diff : diff2; + // min of diff, diff2 and diff3 + return diff < diff3 ? diff : diff3 ; + } + return 0; +} + +bool BattleGround::HasFreeSlots() const +{ + return GetPlayersSize() < GetMaxPlayers(); +} + +void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor) +{ + //this procedure is called from virtual function implemented in bg subclass + BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID()); + + if (itr == m_PlayerScores.end()) // player not found... + return; + + switch(type) + { + case SCORE_KILLING_BLOWS: // Killing blows + itr->second->KillingBlows += value; + break; + case SCORE_DEATHS: // Deaths + itr->second->Deaths += value; + break; + case SCORE_HONORABLE_KILLS: // Honorable kills + itr->second->HonorableKills += value; + break; + case SCORE_BONUS_HONOR: // Honor bonus + // do not add honor in arenas + if (isBattleGround()) + { + value = value * honor_mod; + // reward honor instantly + if (doAddHonor) + { + Source->RewardHonor(NULL, 1, value);//RewardHonor calls UpdatePlayerScore with doAddHonor = false + }else itr->second->BonusHonor += value; + } + break; + //used only in EY, but in MSG_PVP_LOG_DATA opcode + case SCORE_DAMAGE_DONE: // Damage Done + itr->second->DamageDone += value; + break; + case SCORE_HEALING_DONE: // Healing Done + itr->second->HealingDone += value; + break; + default: + sLog.outError("BattleGround: Unknown player score type %u", type); + break; + } +} + +void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid) +{ + m_ReviveQueue[npc_guid].push_back(player_guid); + + Player *plr = objmgr.GetPlayer(player_guid); + if (!plr) + return; + + plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true); +} + +void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid) +{ + for (std::map >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) + { + for (std::vector::iterator itr2 =(itr->second).begin(); itr2 != (itr->second).end(); ++itr2) + { + if (*itr2 == player_guid) + { + (itr->second).erase(itr2); + + Player *plr = objmgr.GetPlayer(player_guid); + if (!plr) + return; + + plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); + + return; + } + } + } +} + +bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/) +{ + Map *map = GetBgMap(); + if (!map) + return false; + // must be created this way, adding to godatamap would add it to the base map of the instance + // and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created + // so we must create it specific for this instance + GameObject * go = new GameObject; + if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(), + PHASEMASK_NORMAL, x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY)) + { + sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry); + sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry); + delete go; + return false; + } +/* + uint32 guid = go->GetGUIDLow(); + + // without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata + // iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed + GameObjectData& data = objmgr.NewGOData(guid); + + data.id = entry; + data.mapid = GetMapId(); + data.posX = x; + data.posY = y; + data.posZ = z; + data.orientation = o; + data.rotation0 = rotation0; + data.rotation1 = rotation1; + data.rotation2 = rotation2; + data.rotation3 = rotation3; + data.spawntimesecs = respawnTime; + data.spawnMask = 1; + data.animprogress = 100; + data.go_state = 1; +*/ + // add to world, so it can be later looked up from HashMapHolder + map->Add(go); + m_BgObjects[type] = go->GetGUID(); + return true; +} + +//some doors aren't despawned so we cannot handle their closing in gameobject::update() +//it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code +void BattleGround::DoorClose(uint32 type) +{ + GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]); + if (obj) + { + //if doors are open, close it + if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY) + { + //change state to allow door to be closed + obj->SetLootState(GO_READY); + obj->UseDoorOrButton(RESPAWN_ONE_DAY); + } + } + else + { + sLog.outError("BattleGround: Door object not found (cannot close doors)"); + } +} + +void BattleGround::DoorOpen(uint32 type) +{ + GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]); + if (obj) + { + //change state to be sure they will be opened + obj->SetLootState(GO_READY); + obj->UseDoorOrButton(RESPAWN_ONE_DAY); + } + else + { + sLog.outError("BattleGround: Door object not found! - doors will be closed."); + } +} + +GameObject* BattleGround::GetBGObject(uint32 type) +{ + GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]); + if (!obj) + sLog.outError("couldn't get gameobject %i",type); + return obj; +} + +Creature* BattleGround::GetBGCreature(uint32 type) +{ + Creature *creature = GetBgMap()->GetCreature(m_BgCreatures[type]); + if (!creature) + sLog.outError("couldn't get creature %i",type); + return creature; +} + +void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime) +{ + Map * map = GetBgMap(); + if (!map) + return; + if (respawntime == 0) + { + GameObject *obj = map->GetGameObject(m_BgObjects[type]); + if (obj) + { + //we need to change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again + if (obj->getLootState() == GO_JUST_DEACTIVATED) + obj->SetLootState(GO_READY); + obj->SetRespawnTime(0); + map->Add(obj); + } + } + else + { + GameObject *obj = map->GetGameObject(m_BgObjects[type]); + if (obj) + { + map->Add(obj); + obj->SetRespawnTime(respawntime); + obj->SetLootState(GO_JUST_DEACTIVATED); + } + } +} + +Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime) +{ + Map * map = GetBgMap(); + if (!map) + return NULL; + + Creature* pCreature = new Creature; + if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) + { + sLog.outError("Can't create creature entry: %u",entry); + delete pCreature; + return NULL; + } + + pCreature->SetHomePosition(x, y, z, o); + + CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(entry); + if (!cinfo) + { + sLog.outErrorDb("BattleGround::AddCreature: entry %u does not exist.", entry); + return NULL; + } + //force using DB speeds + pCreature->SetSpeed(MOVE_WALK, cinfo->speed_walk); + pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); + + map->Add(pCreature); + m_BgCreatures[type] = pCreature->GetGUID(); + + if (respawntime) + pCreature->SetRespawnDelay(respawntime); + + return pCreature; +} +/* +void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime) +{ + Map * map = sMapMgr.FindMap(GetMapId(),GetInstanceId()); + if (!map) + return false; + + if (respawntime == 0) + { + Creature *obj = HashMapHolder::Find(m_BgCreatures[type]); + if (obj) + { + //obj->Respawn(); // bugged + obj->SetRespawnTime(0); + objmgr.SaveCreatureRespawnTime(obj->GetGUIDLow(), GetInstanceID(), 0); + map->Add(obj); + } + } + else + { + Creature *obj = HashMapHolder::Find(m_BgCreatures[type]); + if (obj) + { + obj->setDeathState(DEAD); + obj->SetRespawnTime(respawntime); + map->Add(obj); + } + } +} +*/ +bool BattleGround::DelCreature(uint32 type) +{ + if (!m_BgCreatures[type]) + return true; + + Creature *cr = GetBgMap()->GetCreature(m_BgCreatures[type]); + if (!cr) + { + sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type])); + return false; + } + cr->AddObjectToRemoveList(); + m_BgCreatures[type] = 0; + return true; +} + +bool BattleGround::DelObject(uint32 type) +{ + if (!m_BgObjects[type]) + return true; + + GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]); + if (!obj) + { + sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type])); + return false; + } + obj->SetRespawnTime(0); // not save respawn time + obj->Delete(); + m_BgObjects[type] = 0; + return true; +} + +bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team) +{ + uint32 entry = 0; + + if (team == ALLIANCE) + entry = BG_CREATURE_ENTRY_A_SPIRITGUIDE; + else + entry = BG_CREATURE_ENTRY_H_SPIRITGUIDE; + + Creature* pCreature = AddCreature(entry,type,team,x,y,z,o); + if (!pCreature) + { + sLog.outError("Can't create Spirit guide. BattleGround not created!"); + EndNow(); + return false; + } + + pCreature->setDeathState(DEAD); + + pCreature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pCreature->GetGUID()); + // aura + //TODO: Fix display here + //pCreature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL); + // casting visual effect + pCreature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL); + // correct cast speed + pCreature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); + + //pCreature->CastSpell(pCreature, SPELL_SPIRIT_HEAL_CHANNEL, true); + + return true; +} + +void BattleGround::SendMessageToAll(int32 entry, ChatMsg type, Player const* source) +{ + Trinity::BattleGroundChatBuilder bg_builder(type, entry, source); + Trinity::LocalizedPacketDo bg_do(bg_builder); + BroadcastWorker(bg_do); +} + +void BattleGround::PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...) +{ + va_list ap; + va_start(ap, source); + + Trinity::BattleGroundChatBuilder bg_builder(type, entry, source, &ap); + Trinity::LocalizedPacketDo bg_do(bg_builder); + BroadcastWorker(bg_do); + + va_end(ap); +} + +void BattleGround::SendWarningToAll(int32 entry, ...) +{ + const char *format = objmgr.GetTrinityStringForDBCLocale(entry); + va_list ap; + char str [1024]; + va_start(ap, entry); + vsnprintf(str,1024,format, ap); + va_end(ap); + std::string msg = (std::string)str; + + WorldPacket data(SMSG_MESSAGECHAT, 200); + + data << (uint8)CHAT_MSG_RAID_BOSS_EMOTE; + data << (uint32)LANG_UNIVERSAL; + data << (uint64)0; + data << (uint32)0; // 2.1.0 + data << (uint32)1; + data << (uint8)0; + data << (uint64)0; + data << (uint32)(strlen(msg.c_str())+1); + data << msg.c_str(); + data << (uint8)0; + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) + if (plr->GetSession()) + plr->GetSession()->SendPacket(&data); +} + +void BattleGround::SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 arg1, int32 arg2) +{ + Trinity::BattleGround2ChatBuilder bg_builder(type, entry, source, arg1, arg2); + Trinity::LocalizedPacketDo bg_do(bg_builder); + BroadcastWorker(bg_do); +} + +void BattleGround::EndNow() +{ + RemoveFromBGFreeSlotQueue(); + SetStatus(STATUS_WAIT_LEAVE); + SetEndTime(0); +} + +//to be removed +const char *BattleGround::GetTrinityString(int32 entry) +{ + // FIXME: now we have different DBC locales and need localized message for each target client + return objmgr.GetTrinityStringForDBCLocale(entry); +} + +/* +important notice: +buffs aren't spawned/despawned when players captures anything +buffs are in their positions when battleground starts +*/ +void BattleGround::HandleTriggerBuff(uint64 const& go_guid) +{ + GameObject *obj = GetBgMap()->GetGameObject(go_guid); + if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned()) + return; + + //change buff type, when buff is used: + int32 index = m_BgObjects.size() - 1; + while (index >= 0 && m_BgObjects[index] != go_guid) + index--; + if (index < 0) + { + sLog.outError("BattleGround (Type: %u) has buff gameobject (Guid: %u Entry: %u Type:%u) but it hasn't that object in its internal data",GetTypeID(true),GUID_LOPART(go_guid),obj->GetEntry(),obj->GetGoType()); + return; + } + + //randomly select new buff + uint8 buff = urand(0, 2); + uint32 entry = obj->GetEntry(); + if (m_BuffChange && entry != Buff_Entries[buff]) + { + //despawn current buff + SpawnBGObject(index, RESPAWN_ONE_DAY); + //set index for new one + for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex) + if (entry == Buff_Entries[currBuffTypeIndex]) + { + index -= currBuffTypeIndex; + index += buff; + } + } + + SpawnBGObject(index, BUFF_RESPAWN_TIME); +} + +void BattleGround::HandleKillPlayer(Player *player, Player *killer) +{ + //keep in mind that for arena this will have to be changed a bit + + // add +1 deaths + UpdatePlayerScore(player, SCORE_DEATHS, 1); + // add +1 kills to group and +1 killing_blows to killer + if (killer) + { + UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1); + UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1); + + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + Player *plr = objmgr.GetPlayer(itr->first); + + if (!plr || plr == killer) + continue; + + if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player)) + UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1); + } + } + + // to be able to remove insignia -- ONLY IN BattleGrounds + // give xp only in BattleGrounds + if (!isArena()) + { + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); + RewardXPAtKill(killer, player); + } +} + +// return the player's team based on battlegroundplayer info +// used in same faction arena matches mainly +uint32 BattleGround::GetPlayerTeam(uint64 guid) +{ + BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid); + if (itr != m_Players.end()) + return itr->second.Team; + return 0; +} + +uint32 BattleGround::GetOtherTeam(uint32 teamId) +{ + return (teamId) ? ((teamId == ALLIANCE) ? HORDE : ALLIANCE) : 0; +} + +bool BattleGround::IsPlayerInBattleGround(uint64 guid) +{ + BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid); + if (itr != m_Players.end()) + return true; + return false; +} + +void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr) +{ + if (GetStatus() != STATUS_WAIT_LEAVE) + return; + + WorldPacket data; + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType()); + + BlockMovement(plr); + + sBattleGroundMgr.BuildPvpLogDataPacket(&data, this); + plr->GetSession()->SendPacket(&data); + + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, GetEndTime(), GetStartTime(), GetArenaType()); + plr->GetSession()->SendPacket(&data); +} + +uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const +{ + int count = 0; + for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (itr->second.Team == Team) + { + Player * pl = objmgr.GetPlayer(itr->first); + if (pl && pl->isAlive() && !pl->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION)) + ++count; + } + } + return count; +} + +void BattleGround::SetHoliday(bool is_holiday) +{ + if (is_holiday) + m_HonorMode = BG_HOLIDAY; + else + m_HonorMode = BG_NORMAL; +} + +int32 BattleGround::GetObjectType(uint64 guid) +{ + for (uint32 i = 0; i < m_BgObjects.size(); ++i) + if (m_BgObjects[i] == guid) + return i; + sLog.outError("BattleGround: cheating? a player used a gameobject which isnt supposed to be a usable object!"); + return -1; +} + +void BattleGround::HandleKillUnit(Creature * /*creature*/, Player * /*killer*/) +{ +} + +void BattleGround::CheckArenaWinConditions() +{ + if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE)) + EndBattleGround(HORDE); + else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE)) + EndBattleGround(ALLIANCE); +} + +void BattleGround::UpdateArenaWorldState() +{ + UpdateWorldState(0xe10, GetAlivePlayersCountByTeam(HORDE)); + UpdateWorldState(0xe11, GetAlivePlayersCountByTeam(ALLIANCE)); +} + +void BattleGround::SetBgRaid(uint32 TeamID, Group *bg_raid) +{ + Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; + if (old_raid) old_raid->SetBattlegroundGroup(NULL); + if (bg_raid) bg_raid->SetBattlegroundGroup(this); + old_raid = bg_raid; +} + +WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard(Player* player) +{ + return objmgr.GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam()); +} + +bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const +{ + BattleGroundTeamId team_idx = GetTeamIndexByTeamId(team); + uint32 score = (m_TeamScores[team_idx] < 0) ? 0 : uint32(m_TeamScores[team_idx]); + return score >= minScore && score <= maxScore; +} + +void BattleGround::SetBracket(PvPDifficultyEntry const* bracketEntry) +{ + m_BracketId = bracketEntry->GetBracketId(); + SetLevelRange(bracketEntry->minLevel,bracketEntry->maxLevel); +} + +void BattleGround::RewardXPAtKill(Player* plr, Player* victim) +{ + if (!sWorld.getConfig(CONFIG_BG_XP_FOR_KILL) || !plr || !victim) + return; + + uint32 xp = 0; + uint32 count = 0; + uint32 sum_level = 0; + Player* member_with_max_level = NULL; + Player* not_gray_member_with_max_level = NULL; + + if (Group *pGroup = plr->GetGroup())//should be always in a raid group while in any bg + { + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* member = itr->getSource(); + if (!member || !member->isAlive()) // only for alive + continue; + + if (!member->IsAtGroupRewardDistance(victim)) // at req. distance + continue; + + ++count; + sum_level += member->getLevel(); + if (!member_with_max_level || member_with_max_level->getLevel() < member->getLevel()) + member_with_max_level = member; + + uint32 gray_level = Trinity::XP::GetGrayLevel(member->getLevel()); + if (victim->getLevel() > gray_level && (!not_gray_member_with_max_level + || not_gray_member_with_max_level->getLevel() < member->getLevel())) + not_gray_member_with_max_level = member; + } + + if (member_with_max_level) + { + xp = !not_gray_member_with_max_level ? 0 : Trinity::XP::Gain(not_gray_member_with_max_level, victim); + + if (!xp) + return; + + float group_rate = 1.0f; + + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupGuy = itr->getSource(); + if (!pGroupGuy) + continue; + + if (!pGroupGuy->IsAtGroupRewardDistance(victim)) + continue; // member (alive or dead) or his corpse at req. distance + + float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level; + + // XP updated only for alive group member + if (pGroupGuy->isAlive() && not_gray_member_with_max_level && pGroupGuy->getLevel() <= not_gray_member_with_max_level->getLevel()) + { + uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1); + + // handle SPELL_AURA_MOD_XP_PCT auras + Unit::AuraEffectList const& ModXPPctAuras = plr->GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT); + for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i) + itr_xp = uint32(itr_xp*(1.0f + (*i)->GetAmount() / 100.0f)); + + pGroupGuy->GiveXP(itr_xp, victim); + if (Pet* pet = pGroupGuy->GetPet()) + pet->GivePetXP(itr_xp/2); + } + } + } + } + else//should be always in a raid group while in any BG, but you never know... + { + xp = Trinity::XP::Gain(plr, victim); + + if (!xp) + return; + + // handle SPELL_AURA_MOD_XP_PCT auras + Unit::AuraEffectList const& ModXPPctAuras = plr->GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT); + for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i) + xp = uint32(xp*(1.0f + (*i)->GetAmount() / 100.0f)); + + plr->GiveXP(xp, victim); + + if (Pet* pet = plr->GetPet()) + pet->GivePetXP(xp); + } +} diff --git a/src/server/game/BattleGrounds/BattleGround.h b/src/server/game/BattleGrounds/BattleGround.h new file mode 100644 index 0000000..5c2e99e --- /dev/null +++ b/src/server/game/BattleGrounds/BattleGround.h @@ -0,0 +1,666 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUND_H +#define __BATTLEGROUND_H + +#include "Common.h" +#include "SharedDefines.h" +#include "DBCEnums.h" + +class Creature; +class GameObject; +class Group; +class Player; +class WorldPacket; +class BattleGroundMap; + +struct PvPDifficultyEntry; +struct WorldSafeLocsEntry; + +enum BattleGroundSounds +{ + SOUND_HORDE_WINS = 8454, + SOUND_ALLIANCE_WINS = 8455, + SOUND_BG_START = 3439, + SOUND_BG_START_L70ETC = 11803, +}; + +enum BattleGroundQuests +{ + SPELL_WS_QUEST_REWARD = 43483, + SPELL_AB_QUEST_REWARD = 43484, + SPELL_AV_QUEST_REWARD = 43475, + SPELL_AV_QUEST_KILLED_BOSS = 23658, + SPELL_EY_QUEST_REWARD = 43477, + SPELL_SA_QUEST_REWARD = 61213, + SPELL_AB_QUEST_REWARD_4_BASES = 24061, + SPELL_AB_QUEST_REWARD_5_BASES = 24064 +}; + +enum BattleGroundMarks +{ + SPELL_WS_MARK_LOSER = 24950, + SPELL_WS_MARK_WINNER = 24951, + SPELL_AB_MARK_LOSER = 24952, + SPELL_AB_MARK_WINNER = 24953, + SPELL_AV_MARK_LOSER = 24954, + SPELL_AV_MARK_WINNER = 24955, + SPELL_SA_MARK_WINNER = 61160, + SPELL_SA_MARK_LOSER = 61159, + ITEM_AV_MARK_OF_HONOR = 20560, + ITEM_WS_MARK_OF_HONOR = 20558, + ITEM_AB_MARK_OF_HONOR = 20559, + ITEM_EY_MARK_OF_HONOR = 29024, + ITEM_SA_MARK_OF_HONOR = 42425 +}; + +enum BattleGroundMarksCount +{ + ITEM_WINNER_COUNT = 3, + ITEM_LOSER_COUNT = 1 +}; + +enum BattleGroundCreatures +{ + BG_CREATURE_ENTRY_A_SPIRITGUIDE = 13116, // alliance + BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117, // horde +}; + +enum BattleGroundSpells +{ + SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect + SPELL_SPIRIT_HEAL_CHANNEL = 22011, // Spirit Heal Channel + SPELL_SPIRIT_HEAL = 22012, // Spirit Heal + SPELL_RESURRECTION_VISUAL = 24171, // Resurrection Impact Visual + SPELL_ARENA_PREPARATION = 32727, // use this one, 32728 not correct + SPELL_ALLIANCE_GOLD_FLAG = 32724, + SPELL_ALLIANCE_GREEN_FLAG = 32725, + SPELL_HORDE_GOLD_FLAG = 35774, + SPELL_HORDE_GREEN_FLAG = 35775, + SPELL_PREPARATION = 44521, // Preparation + SPELL_SPIRIT_HEAL_MANA = 44535, // Spirit Heal + SPELL_RECENTLY_DROPPED_FLAG = 42792, // Recently Dropped Flag + SPELL_AURA_PLAYER_INACTIVE = 43681, // Inactive + SPELL_HONORABLE_DEFENDER_25Y = 68652, // +50% honor when standing at a capture point that you control, 25yards radius (added in 3.2) + SPELL_HONORABLE_DEFENDER_60Y = 66157 // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds +}; + +enum BattleGroundTimeIntervals +{ + RESURRECTION_INTERVAL = 30000, // ms + //REMIND_INTERVAL = 10000, // ms + INVITATION_REMIND_TIME = 20000, // ms + INVITE_ACCEPT_WAIT_TIME = 40000, // ms + TIME_TO_AUTOREMOVE = 120000, // ms + MAX_OFFLINE_TIME = 300, // secs + RESPAWN_ONE_DAY = 86400, // secs + RESPAWN_IMMEDIATELY = 0, // secs + BUFF_RESPAWN_TIME = 180, // secs +}; + +enum BattleGroundStartTimeIntervals +{ + BG_START_DELAY_2M = 120000, // ms (2 minutes) + BG_START_DELAY_1M = 60000, // ms (1 minute) + BG_START_DELAY_30S = 30000, // ms (30 seconds) + BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena + BG_START_DELAY_NONE = 0, // ms +}; + +enum BattleGroundBuffObjects +{ + BG_OBJECTID_SPEEDBUFF_ENTRY = 179871, + BG_OBJECTID_REGENBUFF_ENTRY = 179904, + BG_OBJECTID_BERSERKERBUFF_ENTRY = 179905 +}; + +enum BattleGroundRandomRewards +{ + BG_REWARD_WINNER_HONOR_FIRST = 30, + BG_REWARD_WINNER_ARENA_FIRST = 25, + BG_REWARD_WINNER_HONOR_LAST = 15, + BG_REWARD_WINNER_ARENA_LAST = 0, + BG_REWARD_LOOSER_HONOR_FIRST = 5, + BG_REWARD_LOOSER_HONOR_LAST = 5 +}; + +const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY }; + +enum BattleGroundStatus +{ + STATUS_NONE = 0, // first status, should mean bg is not instance + STATUS_WAIT_QUEUE = 1, // means bg is empty and waiting for queue + STATUS_WAIT_JOIN = 2, // this means, that BG has already started and it is waiting for more players + STATUS_IN_PROGRESS = 3, // means bg is running + STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending +}; + +struct BattleGroundPlayer +{ + time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes + uint32 Team; // Player's team +}; + +struct BattleGroundObjectInfo +{ + BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {} + + GameObject *object; + int32 timer; + uint32 spellid; +}; + +// handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time +enum BattleGroundQueueTypeId +{ + BATTLEGROUND_QUEUE_NONE = 0, + BATTLEGROUND_QUEUE_AV = 1, + BATTLEGROUND_QUEUE_WS = 2, + BATTLEGROUND_QUEUE_AB = 3, + BATTLEGROUND_QUEUE_EY = 4, + BATTLEGROUND_QUEUE_SA = 5, + BATTLEGROUND_QUEUE_IC = 6, + BATTLEGROUND_QUEUE_RB = 7, + BATTLEGROUND_QUEUE_2v2 = 8, + BATTLEGROUND_QUEUE_3v3 = 9, + BATTLEGROUND_QUEUE_5v5 = 10, + MAX_BATTLEGROUND_QUEUE_TYPES +}; + +enum ScoreType +{ + SCORE_KILLING_BLOWS = 1, + SCORE_DEATHS = 2, + SCORE_HONORABLE_KILLS = 3, + SCORE_BONUS_HONOR = 4, + //EY, but in MSG_PVP_LOG_DATA opcode! + SCORE_DAMAGE_DONE = 5, + SCORE_HEALING_DONE = 6, + //WS + SCORE_FLAG_CAPTURES = 7, + SCORE_FLAG_RETURNS = 8, + //AB + SCORE_BASES_ASSAULTED = 9, + SCORE_BASES_DEFENDED = 10, + //AV + SCORE_GRAVEYARDS_ASSAULTED = 11, + SCORE_GRAVEYARDS_DEFENDED = 12, + SCORE_TOWERS_ASSAULTED = 13, + SCORE_TOWERS_DEFENDED = 14, + SCORE_MINES_CAPTURED = 15, + SCORE_LEADERS_KILLED = 16, + SCORE_SECONDARY_OBJECTIVES = 17, + //SOTA + SCORE_DESTROYED_DEMOLISHER = 18, + SCORE_DESTROYED_WALL = 19 +}; + +enum ArenaType +{ + ARENA_TYPE_2v2 = 2, + ARENA_TYPE_3v3 = 3, + ARENA_TYPE_5v5 = 5 +}; + +enum BattleGroundType +{ + TYPE_BATTLEGROUND = 3, + TYPE_ARENA = 4 +}; + +enum BattleGroundWinner +{ + WINNER_HORDE = 0, + WINNER_ALLIANCE = 1, + WINNER_NONE = 2 +}; + +enum BattleGroundTeamId +{ + BG_TEAM_ALLIANCE = 0, + BG_TEAM_HORDE = 1 +}; +#define BG_TEAMS_COUNT 2 + +enum BattleGroundStartingEvents +{ + BG_STARTING_EVENT_NONE = 0x00, + BG_STARTING_EVENT_1 = 0x01, + BG_STARTING_EVENT_2 = 0x02, + BG_STARTING_EVENT_3 = 0x04, + BG_STARTING_EVENT_4 = 0x08 +}; + +enum BattleGroundStartingEventsIds +{ + BG_STARTING_EVENT_FIRST = 0, + BG_STARTING_EVENT_SECOND = 1, + BG_STARTING_EVENT_THIRD = 2, + BG_STARTING_EVENT_FOURTH = 3 +}; +#define BG_STARTING_EVENT_COUNT 4 + +enum BG_OBJECT_DMG_HIT_TYPE +{ + BG_OBJECT_DMG_HIT_TYPE_JUST_DAMAGED = 0, + BG_OBJECT_DMG_HIT_TYPE_DAMAGED = 1, + BG_OBJECT_DMG_HIT_TYPE_JUST_HIGH_DAMAGED = 2, + BG_OBJECT_DMG_HIT_TYPE_HIGH_DAMAGED = 3, + BG_OBJECT_DMG_HIT_TYPE_JUST_DESTROYED = 4 +}; + +enum GroupJoinBattlegroundResult +{ + // positive values are indexes in BattlemasterList.dbc + ERR_GROUP_JOIN_BATTLEGROUND_FAIL = 0, // Your group has joined a battleground queue, but you are not eligible (showed for non existing BattlemasterList.dbc indexes) + ERR_BATTLEGROUND_NONE = -1, // not show anything + ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS = -2, // You cannot join the battleground yet because you or one of your party members is flagged as a Deserter. + ERR_ARENA_TEAM_PARTY_SIZE = -3, // Incorrect party size for this arena. + ERR_BATTLEGROUND_TOO_MANY_QUEUES = -4, // You can only be queued for 2 battles at once + ERR_BATTLEGROUND_CANNOT_QUEUE_FOR_RATED = -5, // You cannot queue for a rated match while queued for other battles + ERR_BATTLEDGROUND_QUEUED_FOR_RATED = -6, // You cannot queue for another battle while queued for a rated arena match + ERR_BATTLEGROUND_TEAM_LEFT_QUEUE = -7, // Your team has left the arena queue + ERR_BATTLEGROUND_NOT_IN_BATTLEGROUND = -8, // You can't do that in a battleground. + ERR_BATTLEGROUND_JOIN_XP_GAIN = -9, // wtf, doesn't exist in client... + ERR_BATTLEGROUND_JOIN_RANGE_INDEX = -10, // Cannot join the queue unless all members of your party are in the same battleground level range. + ERR_BATTLEGROUND_JOIN_TIMED_OUT = -11, // %s was unavailable to join the queue. (uint64 guid exist in client cache) + ERR_BATTLEGROUND_JOIN_FAILED = -12, // Join as a group failed (uint64 guid doesn't exist in client cache) + ERR_LFG_CANT_USE_BATTLEGROUND = -13, // You cannot queue for a battleground or arena while using the dungeon system. + ERR_IN_RANDOM_BG = -14, // Can't do that while in a Random Battleground queue. + ERR_IN_NON_RANDOM_BG = -15, // Can't queue for Random Battleground while in another Battleground queue. +}; + +class BattleGroundScore +{ + public: + BattleGroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0), + BonusHonor(0), DamageDone(0), HealingDone(0) + {} + virtual ~BattleGroundScore() {} //virtual destructor is used when deleting score from scores map + + uint32 KillingBlows; + uint32 Deaths; + uint32 HonorableKills; + uint32 BonusHonor; + uint32 DamageDone; + uint32 HealingDone; +}; + +enum BGHonorMode +{ + BG_NORMAL = 0, + BG_HOLIDAY, + BG_HONOR_MODE_NUM +}; + +/* +This class is used to: +1. Add player to battleground +2. Remove player from battleground +3. some certain cases, same for all battlegrounds +4. It has properties same for all battlegrounds +*/ +class BattleGround +{ + friend class BattleGroundMgr; + + public: + /* Construction */ + BattleGround(); + /*BattleGround(const BattleGround& bg);*/ + virtual ~BattleGround(); + virtual void Update(uint32 diff); // must be implemented in BG subclass of BG specific update code, but must in begginning call parent version + virtual bool SetupBattleGround() // must be implemented in BG subclass + { + return true; + } + virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass + virtual void StartingEventCloseDoors() {} + virtual void StartingEventOpenDoors() {} + virtual void ResetBGSubclass() // must be implemented in BG subclass + { + } + + virtual void DestroyGate(Player* pl, GameObject* go, uint32 destroyedEvent) {} + + /* achievement req. */ + virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; } + bool IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const; + + /* Battleground */ + // Get methods: + char const* GetName() const { return m_Name; } + BattleGroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; } + BattleGroundBracketId GetBracketId() const { return m_BracketId; } + uint32 GetInstanceID() const { return m_InstanceID; } + BattleGroundStatus GetStatus() const { return m_Status; } + uint32 GetClientInstanceID() const { return m_ClientInstanceID; } + uint32 GetStartTime() const { return m_StartTime; } + uint32 GetEndTime() const { return m_EndTime; } + uint32 GetLastResurrectTime() const { return m_LastResurrectTime; } + uint32 GetMaxPlayers() const { return m_MaxPlayers; } + uint32 GetMinPlayers() const { return m_MinPlayers; } + + uint32 GetMinLevel() const { return m_LevelMin; } + uint32 GetMaxLevel() const { return m_LevelMax; } + + uint32 GetMaxPlayersPerTeam() const { return m_MaxPlayersPerTeam; } + uint32 GetMinPlayersPerTeam() const { return m_MinPlayersPerTeam; } + + int32 GetStartDelayTime() const { return m_StartDelayTime; } + uint8 GetArenaType() const { return m_ArenaType; } + uint8 GetWinner() const { return m_Winner; } + uint32 GetBattlemasterEntry() const; + uint32 GetBonusHonorFromKill(uint32 kills) const; + bool IsRandom() { return m_IsRandom; } + + // Set methods: + void SetName(char const* Name) { m_Name = Name; } + void SetHonorMod(float mod) { honor_mod = mod; } + void SetTypeID(BattleGroundTypeId TypeID) { m_TypeID = TypeID; } + void SetRandomTypeID(BattleGroundTypeId TypeID) { m_RandomTypeID = TypeID; } + //here we can count minlevel and maxlevel for players + void SetBracket(PvPDifficultyEntry const* bracketEntry); + void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; } + void SetStatus(BattleGroundStatus Status) { m_Status = Status; } + void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; } + void SetStartTime(uint32 Time) { m_StartTime = Time; } + void SetEndTime(uint32 Time) { m_EndTime = Time; } + void SetLastResurrectTime(uint32 Time) { m_LastResurrectTime = Time; } + void SetMaxPlayers(uint32 MaxPlayers) { m_MaxPlayers = MaxPlayers; } + void SetMinPlayers(uint32 MinPlayers) { m_MinPlayers = MinPlayers; } + void SetLevelRange(uint32 min, uint32 max) { m_LevelMin = min; m_LevelMax = max; } + void SetRated(bool state) { m_IsRated = state; } + void SetArenaType(uint8 type) { m_ArenaType = type; } + void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; } + void SetWinner(uint8 winner) { m_Winner = winner; } + + void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; } + void SetStartDelayTime(int Time) { m_StartDelayTime = Time; } + + void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; } + void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; } + + void AddToBGFreeSlotQueue(); //this queue will be useful when more battlegrounds instances will be available + void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available + + void DecreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? --m_InvitedAlliance : --m_InvitedHorde; } + void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; } + + void SetRandom(bool isRandom) { m_IsRandom = isRandom; } + uint32 GetInvitedCount(uint32 team) const + { + if (team == ALLIANCE) + return m_InvitedAlliance; + else + return m_InvitedHorde; + } + bool HasFreeSlots() const; + uint32 GetFreeSlotsForTeam(uint32 Team) const; + + bool isArena() const { return m_IsArena; } + bool isBattleGround() const { return !m_IsArena; } + bool isRated() const { return m_IsRated; } + + typedef std::map BattleGroundPlayerMap; + BattleGroundPlayerMap const& GetPlayers() const { return m_Players; } + uint32 GetPlayersSize() const { return m_Players.size(); } + + typedef std::map BattleGroundScoreMap; + BattleGroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); } + BattleGroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); } + uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); } + + uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); } + + void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); + void RemovePlayerFromResurrectQueue(uint64 player_guid); + + void StartBattleGround(); + + GameObject* GetBGObject(uint32 type); + Creature* GetBGCreature(uint32 type); + /* Location */ + void SetMapId(uint32 MapID) { m_MapId = MapID; } + uint32 GetMapId() const { return m_MapId; } + + /* Map pointers */ + void SetBgMap(BattleGroundMap* map) { m_Map = map; } + BattleGroundMap* GetBgMap() + { + ASSERT(m_Map); + return m_Map; + } + + void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O); + void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const + { + BattleGroundTeamId idx = GetTeamIndexByTeamId(TeamID); + X = m_TeamStartLocX[idx]; + Y = m_TeamStartLocY[idx]; + Z = m_TeamStartLocZ[idx]; + O = m_TeamStartLocO[idx]; + } + + /* Packet Transfer */ + // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) + virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} + void SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender = NULL, bool self = true); + void SendPacketToAll(WorldPacket *packet); + void YellToAll(Creature* creature, const char* text, uint32 language); + + template + void BroadcastWorker(Do& _do); + + void PlaySoundToTeam(uint32 SoundID, uint32 TeamID); + void PlaySoundToAll(uint32 SoundID); + void CastSpellOnTeam(uint32 SpellID, uint32 TeamID); + void RewardHonorToTeam(uint32 Honor, uint32 TeamID); + void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID); + void UpdateWorldState(uint32 Field, uint32 Value); + void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source); + void EndBattleGround(uint32 winner); + void BlockMovement(Player *plr); + + void SendWarningToAll(int32 entry, ...); + void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL); + void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...); + + // specialized version with 2 string id args + void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0); + + /* Raid Group */ + Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; } + void SetBgRaid(uint32 TeamID, Group *bg_raid); + + virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + + static BattleGroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; } + uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; } + uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases + void UpdatePlayersCountByTeam(uint32 Team, bool remove) + { + if (remove) + --m_PlayersCount[GetTeamIndexByTeamId(Team)]; + else + ++m_PlayersCount[GetTeamIndexByTeamId(Team)]; + } + + // used for rated arena battles + void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(Team)] = ArenaTeamId; } + uint32 GetArenaTeamIdForTeam(uint32 Team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(Team)]; } + void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange) { m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)] = RatingChange; } + int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; } + void CheckArenaWinConditions(); + void UpdateArenaWorldState(); + + /* Triggers handle */ + // must be implemented in BG subclass + virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {} + // must be implemented in BG subclass if need AND call base class generic code + virtual void HandleKillPlayer(Player *player, Player *killer); + virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/); + + /* Battleground events */ + virtual void EventPlayerDroppedFlag(Player* /*player*/) {} + virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {} + virtual void EventPlayerCapturedFlag(Player* /*player*/) {} + void EventPlayerLoggedIn(Player* player, uint64 plr_guid); + void EventPlayerLoggedOut(Player* player); + virtual void EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent) {} + virtual void EventPlayerUsedGO(Player* /*player*/, GameObject* /*go*/){} + + /* Death related */ + virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + + virtual void AddPlayer(Player *plr); // must be implemented in BG subclass + + void AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team); + + virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket); + // can be extended in in BG subclass + + void HandleTriggerBuff(uint64 const& go_guid); + void SetHoliday(bool is_holiday); + + // TODO: make this protected: + typedef std::vector BGObjects; + typedef std::vector BGCreatures; + BGObjects m_BgObjects; + BGCreatures m_BgCreatures; + void SpawnBGObject(uint32 type, uint32 respawntime); + bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); +// void SpawnBGCreature(uint32 type, uint32 respawntime); + Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime = 0); + bool DelCreature(uint32 type); + bool DelObject(uint32 type); + bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team); + int32 GetObjectType(uint64 guid); + + void DoorOpen(uint32 type); + void DoorClose(uint32 type); + //to be removed + const char *GetTrinityString(int32 entry); + + virtual bool HandlePlayerUnderMap(Player * /*plr*/) { return false; } + + // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player + uint32 GetPlayerTeam(uint64 guid); + uint32 GetOtherTeam(uint32 teamId); + bool IsPlayerInBattleGround(uint64 guid); + + void SetDeleteThis() {m_SetDeleteThis = true;} + + /* virtual score-array - get's used in bg-subclasses */ + int32 m_TeamScores[BG_TEAMS_COUNT]; + + void RewardXPAtKill(Player* plr, Player* victim); + + protected: + //this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends BattleGround + void EndNow(); + void PlayerAddedToBGCheckIfBGIsRunning(Player* plr); + + /* Scorekeeping */ + + BattleGroundScoreMap m_PlayerScores; // Player scores + // must be implemented in BG subclass + virtual void RemovePlayer(Player * /*player*/, uint64 /*guid*/) {} + + /* Player lists, those need to be accessible by inherited classes */ + BattleGroundPlayerMap m_Players; + // Spirit Guide guid + Player list GUIDS + std::map > m_ReviveQueue; + + /* + these are important variables used for starting messages + */ + uint8 m_Events; + BattleGroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT]; + //this must be filled in constructors! + uint32 m_StartMessageIds[BG_STARTING_EVENT_COUNT]; + + bool m_BuffChange; + bool m_IsRandom; + + BGHonorMode m_HonorMode; + private: + /* Battleground */ + BattleGroundTypeId m_TypeID; + BattleGroundTypeId m_RandomTypeID; + uint32 m_InstanceID; //BattleGround Instance's GUID! + BattleGroundStatus m_Status; + uint32 m_ClientInstanceID; //the instance-id which is sent to the client and without any other internal use + uint32 m_StartTime; + int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself + uint32 m_LastResurrectTime; + BattleGroundBracketId m_BracketId; + uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5 + bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque + bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave + bool m_IsArena; + uint8 m_Winner; // 0=alliance, 1=horde, 2=none + int32 m_StartDelayTime; + bool m_IsRated; // is this battle rated? + bool m_PrematureCountDown; + uint32 m_PrematureCountDownTimer; + char const *m_Name; + + /* Player lists */ + std::vector m_ResurrectQueue; // Player GUID + std::deque m_OfflineQueue; // Player GUID + + /* Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction */ + /* Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG */ + /* Invited players counters*/ + uint32 m_InvitedAlliance; + uint32 m_InvitedHorde; + + /* Raid Group */ + Group *m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde + + /* Players count by team */ + uint32 m_PlayersCount[BG_TEAMS_COUNT]; + + /* Arena team ids by team */ + uint32 m_ArenaTeamIds[BG_TEAMS_COUNT]; + + int32 m_ArenaTeamRatingChanges[BG_TEAMS_COUNT]; + + /* Limits */ + uint32 m_LevelMin; + uint32 m_LevelMax; + uint32 m_MaxPlayersPerTeam; + uint32 m_MaxPlayers; + uint32 m_MinPlayersPerTeam; + uint32 m_MinPlayers; + + /* Start location */ + uint32 m_MapId; + BattleGroundMap* m_Map; + float m_TeamStartLocX[BG_TEAMS_COUNT]; + float m_TeamStartLocY[BG_TEAMS_COUNT]; + float m_TeamStartLocZ[BG_TEAMS_COUNT]; + float m_TeamStartLocO[BG_TEAMS_COUNT]; + float honor_mod; +}; +#endif + diff --git a/src/server/game/BattleGrounds/BattleGroundMgr.cpp b/src/server/game/BattleGrounds/BattleGroundMgr.cpp new file mode 100644 index 0000000..8ff4e06 --- /dev/null +++ b/src/server/game/BattleGrounds/BattleGroundMgr.cpp @@ -0,0 +1,2246 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "ObjectMgr.h" +#include "World.h" +#include "WorldPacket.h" + + +#include "ArenaTeam.h" +#include "BattleGroundMgr.h" +#include "BattleGroundAV.h" +#include "BattleGroundAB.h" +#include "BattleGroundEY.h" +#include "BattleGroundWS.h" +#include "BattleGroundNA.h" +#include "BattleGroundBE.h" +#include "BattleGroundAA.h" +#include "BattleGroundRL.h" +#include "BattleGroundSA.h" +#include "BattleGroundDS.h" +#include "BattleGroundRV.h" +#include "BattleGroundIC.h" +#include "BattleGroundRB.h" +#include "Chat.h" +#include "Map.h" +#include "MapInstanced.h" +#include "MapManager.h" +#include "Player.h" +#include "GameEventMgr.h" +#include "ProgressBar.h" +#include "SharedDefines.h" +#include "Formulas.h" + +/*********************************************************/ +/*** BATTLEGROUND QUEUE SYSTEM ***/ +/*********************************************************/ + +BattleGroundQueue::BattleGroundQueue() +{ + for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i) + { + for (uint32 j = 0; j < MAX_BATTLEGROUND_BRACKETS; ++j) + { + m_SumOfWaitTimes[i][j] = 0; + m_WaitTimeLastPlayer[i][j] = 0; + for (uint32 k = 0; k < COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; ++k) + m_WaitTimes[i][j][k] = 0; + } + } +} + +BattleGroundQueue::~BattleGroundQueue() +{ + m_QueuedPlayers.clear(); + for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i) + { + for (uint32 j = 0; j < BG_QUEUE_GROUP_TYPES_COUNT; ++j) + { + for (GroupsQueueType::iterator itr = m_QueuedGroups[i][j].begin(); itr!= m_QueuedGroups[i][j].end(); ++itr) + delete (*itr); + m_QueuedGroups[i][j].clear(); + } + } +} + +/*********************************************************/ +/*** BATTLEGROUND QUEUE SELECTION POOLS ***/ +/*********************************************************/ + +// selection pool initialization, used to clean up from prev selection +void BattleGroundQueue::SelectionPool::Init() +{ + SelectedGroups.clear(); + PlayerCount = 0; +} + +// remove group info from selection pool +// returns true when we need to try to add new group to selection pool +// returns false when selection pool is ok or when we kicked smaller group than we need to kick +// sometimes it can be called on empty selection pool +bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size) +{ + //find maxgroup or LAST group with size == size and kick it + bool found = false; + GroupsQueueType::iterator groupToKick = SelectedGroups.begin(); + for (GroupsQueueType::iterator itr = groupToKick; itr != SelectedGroups.end(); ++itr) + { + if (abs((int32)((*itr)->Players.size() - size)) <= 1) + { + groupToKick = itr; + found = true; + } + else if (!found && (*itr)->Players.size() >= (*groupToKick)->Players.size()) + groupToKick = itr; + } + //if pool is empty, do nothing + if (GetPlayerCount()) + { + //update player count + GroupQueueInfo* ginfo = (*groupToKick); + SelectedGroups.erase(groupToKick); + PlayerCount -= ginfo->Players.size(); + //return false if we kicked smaller group or there are enough players in selection pool + if (ginfo->Players.size() <= size + 1) + return false; + } + return true; +} + +// add group to selection pool +// used when building selection pools +// returns true if we can invite more players, or when we added group to selection pool +// returns false when selection pool is full +bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount) +{ + //if group is larger than desired count - don't allow to add it to pool + if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size()) + { + SelectedGroups.push_back(ginfo); + // increase selected players count + PlayerCount += ginfo->Players.size(); + return true; + } + if (PlayerCount < desiredCount) + return true; + return false; +} + +/*********************************************************/ +/*** BATTLEGROUND QUEUES ***/ +/*********************************************************/ + +// add group or player (grp == NULL) to bg queue with the given leader and bg specifications +GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid) +{ + BattleGroundBracketId bracketId = backetEntry->GetBracketId(); + + // create new ginfo + GroupQueueInfo* ginfo = new GroupQueueInfo; + ginfo->BgTypeId = BgTypeId; + ginfo->ArenaType = ArenaType; + ginfo->ArenaTeamId = arenateamid; + ginfo->IsRated = isRated; + ginfo->IsInvitedToBGInstanceGUID = 0; + ginfo->JoinTime = getMSTime(); + ginfo->RemoveInviteTime = 0; + ginfo->Team = leader->GetTeam(); + ginfo->ArenaTeamRating = arenaRating; + ginfo->OpponentsTeamRating = 0; + + ginfo->Players.clear(); + + //compute index (if group is premade or joined a rated match) to queues + uint32 index = 0; + if (!isRated && !isPremade) + index += BG_TEAMS_COUNT; + if (ginfo->Team == HORDE) + index++; + sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index); + + uint32 lastOnlineTime = getMSTime(); + + //announce world (this don't need mutex) + if (isRated && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)) + { + ArenaTeam *Team = objmgr.GetArenaTeamById(arenateamid); + if (Team) + sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, Team->GetName().c_str(), ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating); + } + + //add players from group to ginfo + { + //ACE_Guard guard(m_Lock); + if (grp) + { + for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player *member = itr->getSource(); + if (!member) + continue; // this should never happen + PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()]; + pl_info.LastOnlineTime = lastOnlineTime; + pl_info.GroupInfo = ginfo; + // add the pinfo to ginfo's list + ginfo->Players[member->GetGUID()] = &pl_info; + } + } + else + { + PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()]; + pl_info.LastOnlineTime = lastOnlineTime; + pl_info.GroupInfo = ginfo; + ginfo->Players[leader->GetGUID()] = &pl_info; + } + + //add GroupInfo to m_QueuedGroups + m_QueuedGroups[bracketId][index].push_back(ginfo); + + //announce to world, this code needs mutex + if (!isRated && !isPremade && sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) + { + if (BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId)) + { + char const* bgName = bg->GetName(); + uint32 MinPlayers = bg->GetMinPlayersPerTeam(); + uint32 qHorde = 0; + uint32 qAlliance = 0; + uint32 q_min_level = backetEntry->minLevel; + uint32 q_max_level = backetEntry->maxLevel; + GroupsQueueType::const_iterator itr; + for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr) + if (!(*itr)->IsInvitedToBGInstanceGUID) + qAlliance += (*itr)->Players.size(); + for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr) + if (!(*itr)->IsInvitedToBGInstanceGUID) + qHorde += (*itr)->Players.size(); + + // Show queue status to player only (when joining queue) + if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) + { + ChatHandler(leader).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level, + qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); + } + // System message + else + { + sWorld.SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_max_level, + qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); + } + } + } + //release mutex + } + + return ginfo; +} + +void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id) +{ + uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime()); + uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas! + if (!ginfo->ArenaType) + { + if (ginfo->Team == HORDE) + team_index = BG_TEAM_HORDE; + } + else + { + if (ginfo->IsRated) + team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE + } + + //store pointer to arrayindex of player that was added first + uint32* lastPlayerAddedPointer = &(m_WaitTimeLastPlayer[team_index][bracket_id]); + //remove his time from sum + m_SumOfWaitTimes[team_index][bracket_id] -= m_WaitTimes[team_index][bracket_id][(*lastPlayerAddedPointer)]; + //set average time to new + m_WaitTimes[team_index][bracket_id][(*lastPlayerAddedPointer)] = timeInQueue; + //add new time to sum + m_SumOfWaitTimes[team_index][bracket_id] += timeInQueue; + //set index of last player added to next one + (*lastPlayerAddedPointer)++; + (*lastPlayerAddedPointer) %= COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME; +} + +uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id) +{ + uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas! + if (!ginfo->ArenaType) + { + if (ginfo->Team == HORDE) + team_index = BG_TEAM_HORDE; + } + else + { + if (ginfo->IsRated) + team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE + } + //check if there is enought values(we always add values > 0) + if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1]) + return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME); + else + //if there aren't enough values return 0 - not available + return 0; +} + +//remove player from queue and from group info, if group info is empty then remove it too +void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount) +{ + //Player *plr = objmgr.GetPlayer(guid); + + int32 bracket_id = -1; // signed for proper for-loop finish + QueuedPlayersMap::iterator itr; + + //remove player from map, if he's there + itr = m_QueuedPlayers.find(guid); + if (itr == m_QueuedPlayers.end()) + { + sLog.outError("BattleGroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid)); + return; + } + + GroupQueueInfo* group = itr->second.GroupInfo; + GroupsQueueType::iterator group_itr, group_itr_tmp; + // mostly people with the highest levels are in battlegrounds, thats why + // we count from MAX_BATTLEGROUND_QUEUES - 1 to 0 + // variable index removes useless searching in other team's queue + uint32 index = (group->Team == HORDE) ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE; + + for (int32 bracket_id_tmp = MAX_BATTLEGROUND_BRACKETS - 1; bracket_id_tmp >= 0 && bracket_id == -1; --bracket_id_tmp) + { + //we must check premade and normal team's queue - because when players from premade are joining bg, + //they leave groupinfo so we can't use its players size to find out index + for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_QUEUE_NORMAL_ALLIANCE) + { + for (group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp) + { + if ((*group_itr_tmp) == group) + { + bracket_id = bracket_id_tmp; + group_itr = group_itr_tmp; + //we must store index to be able to erase iterator + index = j; + break; + } + } + } + } + //player can't be in queue without group, but just in case + if (bracket_id == -1) + { + sLog.outError("BattleGroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid)); + return; + } + sLog.outDebug("BattleGroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id); + + // ALL variables are correctly set + // We can ignore leveling up in queue - it should not cause crash + // remove player from group + // if only one player there, remove group + + // remove player queue info from group queue info + std::map::iterator pitr = group->Players.find(guid); + if (pitr != group->Players.end()) + group->Players.erase(pitr); + + // if invited to bg, and should decrease invited count, then do it + if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID) + { + BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId); + if (bg) + bg->DecreaseInvitedCount(group->Team); + } + + // remove player queue info + m_QueuedPlayers.erase(itr); + + // announce to world if arena team left queue for rated match, show only once + if (group->ArenaType && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)) + { + ArenaTeam *Team = objmgr.GetArenaTeamById(group->ArenaTeamId); + if (Team) + sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, Team->GetName().c_str(), group->ArenaType, group->ArenaType, group->ArenaTeamRating); + } + + //if player leaves queue and he is invited to rated arena match, then he have to loose + if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount) + { + ArenaTeam * at = objmgr.GetArenaTeamById(group->ArenaTeamId); + if (at) + { + sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating); + Player *plr = objmgr.GetPlayer(guid); + if (plr) + at->MemberLost(plr, group->OpponentsTeamRating); + else + at->OfflineMemberLost(guid, group->OpponentsTeamRating); + at->SaveToDB(); + } + } + + // remove group queue info if needed + if (group->Players.empty()) + { + m_QueuedGroups[bracket_id][index].erase(group_itr); + delete group; + } + // if group wasn't empty, so it wasn't deleted, and player have left a rated + // queue -> everyone from the group should leave too + // don't remove recursively if already invited to bg! + else if (!group->IsInvitedToBGInstanceGUID && group->IsRated) + { + // remove next player, this is recursive + // first send removal information + if (Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first)) + { + BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId); + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType); + uint32 queueSlot = plr2->GetBattleGroundQueueIndex(bgQueueTypeId); + plr2->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to + // queue->removeplayer, it causes bugs + WorldPacket data; + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); + plr2->GetSession()->SendPacket(&data); + } + // then actually delete, this may delete the group as well! + RemovePlayer(group->Players.begin()->first, decreaseInvitedCount); + } +} + +//returns true when player pl_guid is in queue and is invited to bgInstanceGuid +bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime) +{ + QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid); + return (qItr != m_QueuedPlayers.end() + && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == bgInstanceGuid + && qItr->second.GroupInfo->RemoveInviteTime == removeTime); +} + +bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo) +{ + QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid); + if (qItr == m_QueuedPlayers.end()) + return false; + *ginfo = *(qItr->second.GroupInfo); + return true; +} + +bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side) +{ + // set side if needed + if (side) + ginfo->Team = side; + + if (!ginfo->IsInvitedToBGInstanceGUID) + { + // not yet invited + // set invitation + ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID(); + BattleGroundTypeId bgTypeId = bg->GetTypeID(); + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, bg->GetArenaType()); + BattleGroundBracketId bracket_id = bg->GetBracketId(); + + // set ArenaTeamId for rated matches + if (bg->isArena() && bg->isRated()) + bg->SetArenaTeamIdForTeam(ginfo->Team, ginfo->ArenaTeamId); + + ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME; + + // loop through the players + for (std::map::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr) + { + // get the player + Player* plr = objmgr.GetPlayer(itr->first); + // if offline, skip him, this should not happen - player is removed from queue when he logs out + if (!plr) + continue; + + // invite the player + PlayerInvitedToBGUpdateAverageWaitTime(ginfo, bracket_id); + //sBattleGroundMgr.InvitePlayer(plr, bg, ginfo->Team); + + // set invited player counters + bg->IncreaseInvitedCount(ginfo->Team); + + plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID); + + // create remind invite events + BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime); + plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME)); + // create automatic remove events + BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime); + plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME)); + + WorldPacket data; + + uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); + + sLog.outDebug("Battleground: invited plr %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.",plr->GetName(),plr->GetGUIDLow(),bg->GetInstanceID(),queueSlot,bg->GetTypeID()); + + // send status packet + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType); + plr->GetSession()->SendPacket(&data); + } + return true; + } + + return false; +} + +/* +This function is inviting players to already running battlegrounds +Invitation type is based on config file +large groups are disadvantageous, because they will be kicked first if invitation type = 1 +*/ +void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId bracket_id) +{ + int32 hordeFree = bg->GetFreeSlotsForTeam(HORDE); + int32 aliFree = bg->GetFreeSlotsForTeam(ALLIANCE); + + //iterator for iterating through bg queue + GroupsQueueType::const_iterator Ali_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); + //count of groups in queue - used to stop cycles + uint32 aliCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].size(); + //index to queue which group is current + uint32 aliIndex = 0; + for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree); aliIndex++) + ++Ali_itr; + //the same thing for horde + GroupsQueueType::const_iterator Horde_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].begin(); + uint32 hordeCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].size(); + uint32 hordeIndex = 0; + for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), hordeFree); hordeIndex++) + ++Horde_itr; + + //if ofc like BG queue invitation is set in config, then we are happy + if (sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) == 0) + return; + + /* + if we reached this code, then we have to solve NP - complete problem called Subset sum problem + So one solution is to check all possible invitation subgroups, or we can use these conditions: + 1. Last time when BattleGroundQueue::Update was executed we invited all possible players - so there is only small possibility + that we will invite now whole queue, because only 1 change has been made to queues from the last BattleGroundQueue::Update call + 2. Other thing we should consider is group order in queue + */ + + // At first we need to compare free space in bg and our selection pool + int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()); + int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); + while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0)) + { + //each cycle execution we need to kick at least 1 group + if (diffAli < diffHorde) + { + //kick alliance group, add to pool new group if needed + if (m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffHorde - diffAli)) + { + for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); aliIndex++) + ++Ali_itr; + } + //if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break; + if (!m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()) + { + if (aliFree <= diffHorde + 1) + break; + m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffHorde - diffAli); + } + } + else + { + //kick horde group, add to pool new group if needed + if (m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffAli - diffHorde)) + { + for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); hordeIndex++) + ++Horde_itr; + } + if (!m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) + { + if (hordeFree <= diffAli + 1) + break; + m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffAli - diffHorde); + } + } + //count diffs after small update + diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()); + diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); + } +} + +// this method checks if premade versus premade battleground is possible +// then after 30 mins (default) in queue it moves premade group to normal queue +// it tries to invite as much players as it can - to MaxPlayersPerTeam, because premade groups have more than MinPlayersPerTeam players +bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam) +{ + //check match + if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty()) + { + //start premade match + //if groups aren't invited + GroupsQueueType::const_iterator ali_group, horde_group; + for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group) + if (!(*ali_group)->IsInvitedToBGInstanceGUID) + break; + for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group) + if (!(*horde_group)->IsInvitedToBGInstanceGUID) + break; + + if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end()) + { + m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam); + m_SelectionPools[BG_TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam); + //add groups/players from normal queue to size of bigger group + uint32 maxPlayers = std::min(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()); + GroupsQueueType::const_iterator itr; + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + { + for (itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr) + { + //if itr can join BG and player count is less that maxPlayers, then add group to selectionpool + if (!(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers)) + break; + } + } + //premade selection pools are set + return true; + } + } + // now check if we can move group from Premade queue to normal queue (timer has expired) or group size lowered!! + // this could be 2 cycles but i'm checking only first team in queue - it can cause problem - + // if first is invited to BG and seconds timer expired, but we can ignore it, because players have only 80 seconds to click to enter bg + // and when they click or after 80 seconds the queue info is removed from queue + uint32 time_before = getMSTime() - sWorld.getConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH); + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + { + if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty()) + { + GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].begin(); + if (!(*itr)->IsInvitedToBGInstanceGUID && ((*itr)->JoinTime < time_before || (*itr)->Players.size() < MinPlayersPerTeam)) + { + //we must insert group to normal queue and erase pointer from premade queue + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].push_front((*itr)); + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].erase(itr); + } + } + } + //selection pools are not set + return false; +} + +// this method tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam +bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers) +{ + GroupsQueueType::const_iterator itr_team[BG_TEAMS_COUNT]; + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + { + itr_team[i] = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); + for (; itr_team[i] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++(itr_team[i])) + { + if (!(*(itr_team[i]))->IsInvitedToBGInstanceGUID) + { + m_SelectionPools[i].AddGroup(*(itr_team[i]), maxPlayers); + if (m_SelectionPools[i].GetPlayerCount() >= minPlayers) + break; + } + } + } + //try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg + uint32 j = BG_TEAM_ALLIANCE; + if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()) + j = BG_TEAM_HORDE; + if (sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0 + && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers) + { + //we will try to invite more groups to team with less players indexed by j + ++(itr_team[j]); //this will not cause a crash, because for cycle above reached break; + for (; itr_team[j] != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j])) + { + if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID) + if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount())) + break; + } + // do not allow to start bg with more than 2 players more on 1 faction + if (abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2) + return false; + } + //allow 1v0 if debug bg + if (sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())) + return true; + //return true if there are enough players in selection pools - enable to work .debug bg command correctly + return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers; +} + +// this method will check if we can invite players to same faction skirmish match +bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam) +{ + if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam) + return false; + uint32 teamIndex = BG_TEAM_ALLIANCE; + uint32 otherTeam = BG_TEAM_HORDE; + uint32 otherTeamId = HORDE; + if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam) + { + teamIndex = BG_TEAM_HORDE; + otherTeam = BG_TEAM_ALLIANCE; + otherTeamId = ALLIANCE; + } + //clear other team's selection + m_SelectionPools[otherTeam].Init(); + //store last ginfo pointer + GroupQueueInfo* ginfo = m_SelectionPools[teamIndex].SelectedGroups.back(); + //set itr_team to group that was added to selection pool latest + GroupsQueueType::iterator itr_team = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].begin(); + for (; itr_team != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team) + if (ginfo == *itr_team) + break; + if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end()) + return false; + GroupsQueueType::iterator itr_team2 = itr_team; + ++itr_team2; + //invite players to other selection pool + for (; itr_team2 != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team2) + { + //if selection pool is full then break; + if (!(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeam].AddGroup(*itr_team2, minPlayersPerTeam)) + break; + } + if (m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam) + return false; + + //here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue + for (GroupsQueueType::iterator itr = m_SelectionPools[otherTeam].SelectedGroups.begin(); itr != m_SelectionPools[otherTeam].SelectedGroups.end(); ++itr) + { + //set correct team + (*itr)->Team = otherTeamId; + //add team to other queue + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + otherTeam].push_front(*itr); + //remove team from old queue + GroupsQueueType::iterator itr2 = itr_team; + ++itr2; + for (; itr2 != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr2) + { + if (*itr2 == *itr) + { + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].erase(itr2); + break; + } + } + } + return true; +} + +/* +this method is called when group is inserted, or player / group is removed from BG Queue - there is only one player's status changed, so we don't use while (true) cycles to invite whole queue +it must be called after fully adding the members of a group to ensure group joining +should be called from BattleGround::RemovePlayer function in some cases +*/ +void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating) +{ + //if no players in queue - do nothing + if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() && + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() && + m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty()) + return; + + //battleground with free slot for player should be always in the beggining of the queue + // maybe it would be better to create bgfreeslotqueue for each bracket_id + BGFreeSlotQueueType::iterator itr, next; + for (itr = sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].begin(); itr != sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].end(); itr = next) + { + next = itr; + ++next; + // DO NOT allow queue manager to invite new player to arena + if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id && + (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE) + { + BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!) + // and iterator is invalid + + // clear selection pools + m_SelectionPools[BG_TEAM_ALLIANCE].Init(); + m_SelectionPools[BG_TEAM_HORDE].Init(); + + // call a function that does the job for us + FillPlayersToBG(bg, bracket_id); + + // now everything is set, invite players + for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg, (*citr)->Team); + for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg, (*citr)->Team); + + if (!bg->HasFreeSlots()) + { + // remove BG from BGFreeSlotQueue + bg->RemoveFromBGFreeSlotQueue(); + } + } + } + + // finished iterating through the bgs with free slots, maybe we need to create a new bg + + BattleGround * bg_template = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); + if (!bg_template) + { + sLog.outError("Battleground: Update: bg template not found for %u", bgTypeId); + return; + } + + PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg_template->GetMapId(),bracket_id); + if (!bracketEntry) + { + sLog.outError("Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id); + return; + } + + // get the min. players per team, properly for larger arenas as well. (must have full teams for arena matches!) + uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam(); + uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam(); + if (sBattleGroundMgr.isTesting()) + MinPlayersPerTeam = 1; + if (bg_template->isArena()) + { + if (sBattleGroundMgr.isArenaTesting()) + { + MaxPlayersPerTeam = 1; + MinPlayersPerTeam = 1; + } + else + { + //this switch can be much shorter + MaxPlayersPerTeam = arenaType; + MinPlayersPerTeam = arenaType; + /*switch(arenaType) + { + case ARENA_TYPE_2v2: + MaxPlayersPerTeam = 2; + MinPlayersPerTeam = 2; + break; + case ARENA_TYPE_3v3: + MaxPlayersPerTeam = 3; + MinPlayersPerTeam = 3; + break; + case ARENA_TYPE_5v5: + MaxPlayersPerTeam = 5; + MinPlayersPerTeam = 5; + break; + }*/ + } + } + + m_SelectionPools[BG_TEAM_ALLIANCE].Init(); + m_SelectionPools[BG_TEAM_HORDE].Init(); + + if (bg_template->isBattleGround()) + { + //check if there is premade against premade match + if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam)) + { + //create new battleground + BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, 0, false); + if (!bg2) + { + sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId); + return; + } + //invite those selection pools + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg2, (*citr)->Team); + //start bg + bg2->StartBattleGround(); + //clear structures + m_SelectionPools[BG_TEAM_ALLIANCE].Init(); + m_SelectionPools[BG_TEAM_HORDE].Init(); + } + } + + // now check if there are in queues enough players to start new game of (normal battleground, or non-rated arena) + if (!isRated) + { + // if there are enough players in pools, start new battleground or non rated arena + if (CheckNormalMatch(bg_template, bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam) + || (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam))) + { + // we successfully created a pool + BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false); + if (!bg2) + { + sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId); + return; + } + + // invite those selection pools + for (uint32 i = 0; i < BG_TEAMS_COUNT; i++) + for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr) + InviteGroupToBG((*citr), bg2, (*citr)->Team); + // start bg + bg2->StartBattleGround(); + } + } + else if (bg_template->isArena()) + { + // found out the minimum and maximum ratings the newly added team should battle against + // arenaRating is the rating of the latest joined team, or 0 + // 0 is on (automatic update call) and we must set it to team's with longest wait time + if (!arenaRating) + { + GroupQueueInfo* front1 = NULL; + GroupQueueInfo* front2 = NULL; + if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty()) + { + front1 = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].front(); + arenaRating = front1->ArenaTeamRating; + } + if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty()) + { + front2 = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].front(); + arenaRating = front2->ArenaTeamRating; + } + if (front1 && front2) + { + if (front1->JoinTime < front2->JoinTime) + arenaRating = front1->ArenaTeamRating; + } + else if (!front1 && !front2) + return; //queues are empty + } + + //set rating range + uint32 arenaMinRating = (arenaRating <= sBattleGroundMgr.GetMaxRatingDifference()) ? 0 : arenaRating - sBattleGroundMgr.GetMaxRatingDifference(); + uint32 arenaMaxRating = arenaRating + sBattleGroundMgr.GetMaxRatingDifference(); + // if max rating difference is set and the time past since server startup is greater than the rating discard time + // (after what time the ratings aren't taken into account when making teams) then + // the discard time is current_time - time_to_discard, teams that joined after that, will have their ratings taken into account + // else leave the discard time on 0, this way all ratings will be discarded + uint32 discardTime = getMSTime() - sBattleGroundMgr.GetRatingDiscardTimer(); + + // we need to find 2 teams which will play next game + + GroupsQueueType::iterator itr_team[BG_TEAMS_COUNT]; + + //optimalization : --- we dont need to use selection_pools - each update we select max 2 groups + + for (uint32 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++) + { + // take the group that joined first + itr_team[i] = m_QueuedGroups[bracket_id][i].begin(); + for (; itr_team[i] != m_QueuedGroups[bracket_id][i].end(); ++(itr_team[i])) + { + // if group match conditions, then add it to pool + if (!(*itr_team[i])->IsInvitedToBGInstanceGUID + && (((*itr_team[i])->ArenaTeamRating >= arenaMinRating && (*itr_team[i])->ArenaTeamRating <= arenaMaxRating) + || (*itr_team[i])->JoinTime < discardTime)) + { + m_SelectionPools[i].AddGroup((*itr_team[i]), MaxPlayersPerTeam); + // break for cycle to be able to start selecting another group from same faction queue + break; + } + } + } + // now we are done if we have 2 groups - ali vs horde! + // if we don't have, we must try to continue search in same queue + // tmp variables are correctly set + // this code isn't much userfriendly - but it is supposed to continue search for mathing group in HORDE queue + if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) + { + itr_team[BG_TEAM_ALLIANCE] = itr_team[BG_TEAM_HORDE]; + ++itr_team[BG_TEAM_ALLIANCE]; + for (; itr_team[BG_TEAM_ALLIANCE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++(itr_team[BG_TEAM_ALLIANCE])) + { + if (!(*itr_team[BG_TEAM_ALLIANCE])->IsInvitedToBGInstanceGUID + && (((*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_ALLIANCE])->ArenaTeamRating <= arenaMaxRating) + || (*itr_team[BG_TEAM_ALLIANCE])->JoinTime < discardTime)) + { + m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*itr_team[BG_TEAM_ALLIANCE]), MaxPlayersPerTeam); + break; + } + } + } + // this code isn't much userfriendly - but it is supposed to continue search for mathing group in ALLIANCE queue + if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount()) + { + itr_team[BG_TEAM_HORDE] = itr_team[BG_TEAM_ALLIANCE]; + ++itr_team[BG_TEAM_HORDE]; + for (; itr_team[BG_TEAM_HORDE] != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++(itr_team[BG_TEAM_HORDE])) + { + if (!(*itr_team[BG_TEAM_HORDE])->IsInvitedToBGInstanceGUID + && (((*itr_team[BG_TEAM_HORDE])->ArenaTeamRating >= arenaMinRating && (*itr_team[BG_TEAM_HORDE])->ArenaTeamRating <= arenaMaxRating) + || (*itr_team[BG_TEAM_HORDE])->JoinTime < discardTime)) + { + m_SelectionPools[BG_TEAM_HORDE].AddGroup((*itr_team[BG_TEAM_HORDE]), MaxPlayersPerTeam); + break; + } + } + } + + //if we have 2 teams, then start new arena and invite players! + if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) + { + BattleGround* arena = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, true); + if (!arena) + { + sLog.outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!"); + return; + } + + (*(itr_team[BG_TEAM_ALLIANCE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_HORDE]))->ArenaTeamRating; + sLog.outDebug("setting oposite teamrating for team %u to %u", (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamId, (*(itr_team[BG_TEAM_ALLIANCE]))->OpponentsTeamRating); + (*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamRating; + sLog.outDebug("setting oposite teamrating for team %u to %u", (*(itr_team[BG_TEAM_HORDE]))->ArenaTeamId, (*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating); + // now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer + if ((*(itr_team[BG_TEAM_ALLIANCE]))->Team != ALLIANCE) + { + // add to alliance queue + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(*(itr_team[BG_TEAM_ALLIANCE])); + // erase from horde queue + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_team[BG_TEAM_ALLIANCE]); + itr_team[BG_TEAM_ALLIANCE] = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); + } + if ((*(itr_team[BG_TEAM_HORDE]))->Team != HORDE) + { + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(*(itr_team[BG_TEAM_HORDE])); + m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_team[BG_TEAM_HORDE]); + itr_team[BG_TEAM_HORDE] = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); + } + + InviteGroupToBG(*(itr_team[BG_TEAM_ALLIANCE]), arena, ALLIANCE); + InviteGroupToBG(*(itr_team[BG_TEAM_HORDE]), arena, HORDE); + + sLog.outDebug("Starting rated arena match!"); + + arena->StartBattleGround(); + } + } +} + +/*********************************************************/ +/*** BATTLEGROUND QUEUE EVENTS ***/ +/*********************************************************/ + +bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) +{ + Player* plr = objmgr.GetPlayer(m_PlayerGuid); + // player logged off (we should do nothing, he is correctly removed from queue in another procedure) + if (!plr) + return true; + + BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId); + //if battleground ended and its instance deleted - do nothing + if (!bg) + return true; + + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType()); + uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); + if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground + { + // check if player is invited to this bg + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime)) + { + WorldPacket data; + //we must send remaining time in queue + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType); + plr->GetSession()->SendPacket(&data); + } + } + return true; //event will be deleted +} + +void BGQueueInviteEvent::Abort(uint64 /*e_time*/) +{ + //do nothing +} + +/* + this event has many possibilities when it is executed: + 1. player is in battleground (he clicked enter on invitation window) + 2. player left battleground queue and he isn't there any more + 3. player left battleground queue and he joined it again and IsInvitedToBGInstanceGUID = 0 + 4. player left queue and he joined again and he has been invited to same battleground again -> we should not remove him from queue yet + 5. player is invited to bg and he didn't choose what to do and timer expired - only in this condition we should call queue::RemovePlayer + we must remove player in the 5. case even if battleground object doesn't exist! +*/ +bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) +{ + Player* plr = objmgr.GetPlayer(m_PlayerGuid); + if (!plr) + // player logged off (we should do nothing, he is correctly removed from queue in another procedure) + return true; + + BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId); + //battleground can be deleted already when we are removing queue info + //bg pointer can be NULL! so use it carefully! + + uint32 queueSlot = plr->GetBattleGroundQueueIndex(m_BgQueueTypeId); + if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground + { + // check if player is in queue for this BG and if we are removing his invite event + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId]; + if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime)) + { + sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID); + + plr->RemoveBattleGroundQueueId(m_BgQueueTypeId); + bgQueue.RemovePlayer(m_PlayerGuid, true); + //update queues if battleground isn't ended + if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE) + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId()); + + WorldPacket data; + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); + plr->GetSession()->SendPacket(&data); + } + } + + //event will be deleted + return true; +} + +void BGQueueRemoveEvent::Abort(uint64 /*e_time*/) +{ + //do nothing +} + +/*********************************************************/ +/*** BATTLEGROUND MANAGER ***/ +/*********************************************************/ + +BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false) +{ + for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++) + m_BattleGrounds[i].clear(); + m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); + m_Testing=false; +} + +BattleGroundMgr::~BattleGroundMgr() +{ + DeleteAllBattleGrounds(); +} + +void BattleGroundMgr::DeleteAllBattleGrounds() +{ + for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i) + { + for (BattleGroundSet::iterator itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end();) + { + BattleGround * bg = itr->second; + m_BattleGrounds[i].erase(itr++); + if (!m_ClientBattleGroundIds[i][bg->GetBracketId()].empty()) + m_ClientBattleGroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID()); + delete bg; + } + } + + // destroy template battlegrounds that listed only in queues (other already terminated) + for (uint32 bgTypeId = 0; bgTypeId < MAX_BATTLEGROUND_TYPE_ID; ++bgTypeId) + { + // ~BattleGround call unregistring BG from queue + while (!BGFreeSlotQueue[bgTypeId].empty()) + delete BGFreeSlotQueue[bgTypeId].front(); + } +} + +// used to update running battlegrounds, and delete finished ones +void BattleGroundMgr::Update(uint32 diff) +{ + BattleGroundSet::iterator itr, next; + for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i) + { + itr = m_BattleGrounds[i].begin(); + // skip updating battleground template + if (itr != m_BattleGrounds[i].end()) + ++itr; + for (; itr != m_BattleGrounds[i].end(); itr = next) + { + next = itr; + ++next; + itr->second->Update(diff); + // use the SetDeleteThis variable + // direct deletion caused crashes + if (itr->second->m_SetDeleteThis) + { + BattleGround * bg = itr->second; + m_BattleGrounds[i].erase(itr); + if (!m_ClientBattleGroundIds[i][bg->GetBracketId()].empty()) + m_ClientBattleGroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID()); + delete bg; + } + } + } + + // update scheduled queues + if (!m_QueueUpdateScheduler.empty()) + { + std::vector scheduled; + { + //copy vector and clear the other + scheduled = std::vector(m_QueueUpdateScheduler); + m_QueueUpdateScheduler.clear(); + //release lock + } + + for (uint8 i = 0; i < scheduled.size(); i++) + { + uint32 arenaRating = scheduled[i] >> 32; + uint8 arenaType = scheduled[i] >> 24 & 255; + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16 & 255); + BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] >> 8) & 255); + BattleGroundBracketId bracket_id = BattleGroundBracketId(scheduled[i] & 255); + m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, bracket_id, arenaType, arenaRating > 0, arenaRating); + } + } + + // if rating difference counts, maybe force-update queues + if (sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER)) + { + // it's time to force update + if (m_NextRatingDiscardUpdate < diff) + { + // forced update for rated arenas (scan all, but skipped non rated) + sLog.outDebug("BattleGroundMgr: UPDATING ARENA QUEUES"); + for (int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype) + for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket) + m_BattleGroundQueues[qtype].Update( + BATTLEGROUND_AA, BattleGroundBracketId(bracket), + BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId(qtype)), true, 0); + + m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); + } + else + m_NextRatingDiscardUpdate -= diff; + } + if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS)) + { + if (m_AutoDistributionTimeChecker < diff) + { + if (time(NULL) > m_NextAutoDistributionTime) + { + DistributeArenaPoints(); + m_NextAutoDistributionTime = m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); + sWorld.setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime)); + } + m_AutoDistributionTimeChecker = 600000; // check 10 minutes + } + else + m_AutoDistributionTimeChecker -= diff; + } +} + +void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype) +{ + // we can be in 2 queues in same time... + + if (StatusID == 0 || !bg) + { + data->Initialize(SMSG_BATTLEFIELD_STATUS, 4+8); + *data << uint32(QueueSlot); // queue id (0...1) + *data << uint64(0); + return; + } + + data->Initialize(SMSG_BATTLEFIELD_STATUS, (4+8+1+1+4+1+4+4+4)); + *data << uint32(QueueSlot); // queue id (0...1) - player can be in 2 queues in time + // The following segment is read as uint64 in client but can be appended as their original type. + *data << uint8(arenatype); + sLog.outDebug("BattleGroundMgr::BuildBattleGroundStatusPacket: arenatype = %u for bg instanceID %u, TypeID %u.", arenatype, bg->GetClientInstanceID(), bg->GetTypeID()); + *data << uint8(bg->isArena() ? 0xC : 0x2); + *data << uint32(bg->GetTypeID()); + *data << uint16(0x1F90); + // End of uint64 segment, decomposed this way for simplicity + *data << uint8(0); // 3.3.0, some level, only saw 80... + *data << uint8(0); // 3.3.0, some level, only saw 80... + *data << uint32(bg->GetClientInstanceID()); + // alliance/horde for BG and skirmish/rated for Arenas + // following displays the minimap-icon 0 = faction icon 1 = arenaicon + *data << uint8(bg->isRated()); // 1 for rated match, 0 for bg or non rated match + + *data << uint32(StatusID); // status + switch(StatusID) + { + case STATUS_WAIT_QUEUE: // status_in_queue + *data << uint32(Time1); // average wait time, milliseconds + *data << uint32(Time2); // time in queue, updated every minute!, milliseconds + break; + case STATUS_WAIT_JOIN: // status_invite + *data << uint32(bg->GetMapId()); // map id + *data << uint64(0); // 3.3.5, unknown + *data << uint32(Time1); // time to remove from queue, milliseconds + break; + case STATUS_IN_PROGRESS: // status_in_progress + *data << uint32(bg->GetMapId()); // map id + *data << uint64(0); // 3.3.5, unknown + *data << uint32(Time1); // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds + *data << uint32(Time2); // time from bg start, milliseconds + *data << uint8(/*bg->isArena() ? 0 :*/ 1); // unk, possibly 0 == preparation phase, 1 == battle + break; + default: + sLog.outError("Unknown BG status!"); + break; + } +} + +void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) +{ + uint8 type = (bg->isArena() ? 1 : 0); + // last check on 3.0.3 + data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize())); + *data << uint8(type); // type (battleground=0/arena=1) + + if (type) // arena + { + // it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H + for (int i = 1; i >= 0; --i) + { + uint32 pointsLost = bg->m_ArenaTeamRatingChanges[i] < 0 ? abs(bg->m_ArenaTeamRatingChanges[i]) : 0; + uint32 pointsGained = bg->m_ArenaTeamRatingChanges[i] > 0 ? bg->m_ArenaTeamRatingChanges[i] : 0; + + *data << uint32(pointsLost); // Rating Lost + *data << uint32(pointsGained); // Rating gained + *data << uint32(0); // Matchmaking Value + sLog.outDebug("rating change: %d", bg->m_ArenaTeamRatingChanges[i]); + } + for (int i = 1; i >= 0; --i) + { + uint32 at_id = bg->m_ArenaTeamIds[i]; + ArenaTeam * at = objmgr.GetArenaTeamById(at_id); + if (at) + *data << at->GetName(); + else + *data << (uint8)0; + } + } + + if (bg->GetStatus() != STATUS_WAIT_LEAVE) + { + *data << uint8(0); // bg not ended + } + else + { + *data << uint8(1); // bg ended + *data << uint8(bg->GetWinner()); // who win + } + + *data << (int32)(bg->GetPlayerScoresSize()); + + for (BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr) + { + *data << (uint64)itr->first; + *data << (int32)itr->second->KillingBlows; + if (type == 0) + { + *data << (int32)itr->second->HonorableKills; + *data << (int32)itr->second->Deaths; + *data << (int32)(itr->second->BonusHonor); + } + else + { + Player *plr = objmgr.GetPlayer(itr->first); + uint32 team = bg->GetPlayerTeam(itr->first); + if (!team && plr) + team = plr->GetBGTeam(); + *data << uint8(team == ALLIANCE ? 1 : 0); // green or yellow + + } + *data << (int32)itr->second->DamageDone; // damage done + *data << (int32)itr->second->HealingDone; // healing done + switch(bg->GetTypeID(true)) // battleground specific things + { + case BATTLEGROUND_RB: + switch(bg->GetMapId()) + { + case 489: + *data << (uint32)0x00000002; // count of next fields + *data << (uint32)((BattleGroundWGScore*)itr->second)->FlagCaptures; // flag captures + *data << (uint32)((BattleGroundWGScore*)itr->second)->FlagReturns; // flag returns + break; + case 566: + *data << (uint32)0x00000001; // count of next fields + *data << (uint32)((BattleGroundEYScore*)itr->second)->FlagCaptures; // flag captures + break; + case 529: + *data << (uint32)0x00000002; // count of next fields + *data << (uint32)((BattleGroundABScore*)itr->second)->BasesAssaulted; // bases asssulted + *data << (uint32)((BattleGroundABScore*)itr->second)->BasesDefended; // bases defended + break; + case 30: + *data << (uint32)0x00000005; // count of next fields + *data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted; // GraveyardsAssaulted + *data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsDefended; // GraveyardsDefended + *data << (uint32)((BattleGroundAVScore*)itr->second)->TowersAssaulted; // TowersAssaulted + *data << (uint32)((BattleGroundAVScore*)itr->second)->TowersDefended; // TowersDefended + *data << (uint32)((BattleGroundAVScore*)itr->second)->MinesCaptured; // MinesCaptured + break; + case 607: + *data << uint32(2); + *data << uint32(((BattleGroundSAScore*)itr->second)->demolishers_destroyed); + *data << uint32(((BattleGroundSAScore*)itr->second)->gates_destroyed); + break; + default: + *data << (int32)0; // 0 + break; + } + case BATTLEGROUND_AV: + *data << (uint32)0x00000005; // count of next fields + *data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted; // GraveyardsAssaulted + *data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsDefended; // GraveyardsDefended + *data << (uint32)((BattleGroundAVScore*)itr->second)->TowersAssaulted; // TowersAssaulted + *data << (uint32)((BattleGroundAVScore*)itr->second)->TowersDefended; // TowersDefended + *data << (uint32)((BattleGroundAVScore*)itr->second)->MinesCaptured; // MinesCaptured + break; + case BATTLEGROUND_WS: + *data << (uint32)0x00000002; // count of next fields + *data << (uint32)((BattleGroundWGScore*)itr->second)->FlagCaptures; // flag captures + *data << (uint32)((BattleGroundWGScore*)itr->second)->FlagReturns; // flag returns + break; + case BATTLEGROUND_AB: + *data << (uint32)0x00000002; // count of next fields + *data << (uint32)((BattleGroundABScore*)itr->second)->BasesAssaulted; // bases asssulted + *data << (uint32)((BattleGroundABScore*)itr->second)->BasesDefended; // bases defended + break; + case BATTLEGROUND_EY: + *data << (uint32)0x00000001; // count of next fields + *data << (uint32)((BattleGroundEYScore*)itr->second)->FlagCaptures; // flag captures + break; + case BATTLEGROUND_NA: + case BATTLEGROUND_BE: + case BATTLEGROUND_AA: + case BATTLEGROUND_RL: + case BATTLEGROUND_SA: + *data << uint32(2); + *data << uint32(((BattleGroundSAScore*)itr->second)->demolishers_destroyed); + *data << uint32(((BattleGroundSAScore*)itr->second)->gates_destroyed); + break; + case BATTLEGROUND_DS: // wotlk + case BATTLEGROUND_RV: // wotlk + case BATTLEGROUND_IC: // wotlk + *data << (int32)0; // 0 + break; + default: + sLog.outDebug("Unhandled MSG_PVP_LOG_DATA for BG id %u", bg->GetTypeID()); + *data << (int32)0; + break; + } + } +} + +void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result) +{ + data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4); + *data << int32(result); + if (result == ERR_BATTLEGROUND_JOIN_TIMED_OUT || result == ERR_BATTLEGROUND_JOIN_FAILED) + *data << uint64(0); // player guid +} + +void BattleGroundMgr::BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value) +{ + data->Initialize(SMSG_UPDATE_WORLD_STATE, 4+4); + *data << uint32(field); + *data << uint32(value); +} + +void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid) +{ + data->Initialize(SMSG_PLAY_SOUND, 4); + *data << uint32(soundid); +} + +void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid) +{ + data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8); + *data << uint64(guid); +} + +void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr) +{ + data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8); + *data << uint64(plr->GetGUID()); +} + +BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId) +{ + //cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from + //SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id + BattleGround* bg = GetBattleGroundTemplate(bgTypeId); + if (!bg) + return NULL; + + if (bg->isArena()) + return GetBattleGround(instanceId, bgTypeId); + + for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr) + { + if (itr->second->GetClientInstanceID() == instanceId) + return itr->second; + } + return NULL; +} + +BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId) +{ + if (!InstanceID) + return NULL; + //search if needed + BattleGroundSet::iterator itr; + if (bgTypeId == BATTLEGROUND_TYPE_NONE) + { + for (uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++) + { + itr = m_BattleGrounds[i].find(InstanceID); + if (itr != m_BattleGrounds[i].end()) + return itr->second; + } + return NULL; + } + itr = m_BattleGrounds[bgTypeId].find(InstanceID); + return ((itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL); +} + +BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId) +{ + //map is sorted and we can be sure that lowest instance id has only BG template + return m_BattleGrounds[bgTypeId].empty() ? NULL : m_BattleGrounds[bgTypeId].begin()->second; +} + +uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id) +{ + if (IsArenaType(bgTypeId)) + return 0; //arenas don't have client-instanceids + + // we create here an instanceid, which is just for + // displaying this to the client and without any other use.. + // the client-instanceIds are unique for each battleground-type + // the instance-id just needs to be as low as possible, beginning with 1 + // the following works, because std::set is default ordered with "<" + // the optimalization would be to use as bitmask std::vector - but that would only make code unreadable + uint32 lastId = 0; + for (std::set::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracket_id].end();) + { + if ((++lastId) != *itr) //if there is a gap between the ids, we will break.. + break; + lastId = *itr; + } + m_ClientBattleGroundIds[bgTypeId][bracket_id].insert(lastId + 1); + return lastId + 1; +} + +// create a new battleground that will really be used to play +BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated) +{ + // get the template BG + BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId); + BattleGroundTypeIdList *enabledBGsOrArenas = NULL; + + if (!bg_template) + { + sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId); + return NULL; + } + bool isRandom = false; + + if (bg_template->isArena()) + enabledBGsOrArenas = &m_EnabledArenas; + else if (bgTypeId == BATTLEGROUND_RB) + { + enabledBGsOrArenas = &m_EnabledBGs; + isRandom = true; + } + + if (enabledBGsOrArenas) + { + if (!enabledBGsOrArenas->size()) + return NULL; + uint8 size = enabledBGsOrArenas->size() - 1; + bgTypeId = enabledBGsOrArenas->at(urand(0,size)); + bg_template = GetBattleGroundTemplate(bgTypeId); + if (!bg_template) + { + sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId); + return NULL; + } + } + + BattleGround *bg = NULL; + // create a copy of the BG template + switch(bgTypeId) + { + case BATTLEGROUND_AV: + bg = new BattleGroundAV(*(BattleGroundAV*)bg_template); + break; + case BATTLEGROUND_WS: + bg = new BattleGroundWS(*(BattleGroundWS*)bg_template); + break; + case BATTLEGROUND_AB: + bg = new BattleGroundAB(*(BattleGroundAB*)bg_template); + break; + case BATTLEGROUND_NA: + bg = new BattleGroundNA(*(BattleGroundNA*)bg_template); + break; + case BATTLEGROUND_BE: + bg = new BattleGroundBE(*(BattleGroundBE*)bg_template); + break; + case BATTLEGROUND_AA: + bg = new BattleGroundAA(*(BattleGroundAA*)bg_template); + break; + case BATTLEGROUND_EY: + bg = new BattleGroundEY(*(BattleGroundEY*)bg_template); + break; + case BATTLEGROUND_RL: + bg = new BattleGroundRL(*(BattleGroundRL*)bg_template); + break; + case BATTLEGROUND_SA: + bg = new BattleGroundSA(*(BattleGroundSA*)bg_template); + break; + case BATTLEGROUND_DS: + bg = new BattleGroundDS(*(BattleGroundDS*)bg_template); + break; + case BATTLEGROUND_RV: + bg = new BattleGroundRV(*(BattleGroundRV*)bg_template); + break; + case BATTLEGROUND_IC: + bg = new BattleGroundIC(*(BattleGroundIC*)bg_template); + break; + case BATTLEGROUND_RB: + bg = new BattleGroundRB(*(BattleGroundRB*)bg_template); + break; + default: + //error, but it is handled few lines above + return 0; + } + + // set battelground difficulty before initialization + bg->SetBracket(bracketEntry); + + // generate a new instance id + bg->SetInstanceID(sMapMgr.GenerateInstanceId()); // set instance id + bg->SetClientInstanceID(CreateClientVisibleInstanceId(isRandom ? BATTLEGROUND_RB : bgTypeId, bracketEntry->GetBracketId())); + + // reset the new bg (set status to status_wait_queue from status_none) + bg->Reset(); + + // start the joining of the bg + bg->SetStatus(STATUS_WAIT_JOIN); + bg->SetArenaType(arenaType); + bg->SetRated(isRated); + bg->SetRandom(isRandom); + bg->SetTypeID(isRandom ? BATTLEGROUND_RB : bgTypeId); + bg->SetRandomTypeID(bgTypeId); + + return bg; +} + +// used to create the BG templates +uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, float honor_mod) +{ + // Create the BG + BattleGround *bg = NULL; + switch(bgTypeId) + { + case BATTLEGROUND_AV: bg = new BattleGroundAV; break; + case BATTLEGROUND_WS: bg = new BattleGroundWS; break; + case BATTLEGROUND_AB: bg = new BattleGroundAB; break; + case BATTLEGROUND_NA: bg = new BattleGroundNA; break; + case BATTLEGROUND_BE: bg = new BattleGroundBE; break; + case BATTLEGROUND_AA: bg = new BattleGroundAA; break; + case BATTLEGROUND_EY: bg = new BattleGroundEY; break; + case BATTLEGROUND_RL: bg = new BattleGroundRL; break; + case BATTLEGROUND_SA: bg = new BattleGroundSA; break; + case BATTLEGROUND_DS: bg = new BattleGroundDS; break; + case BATTLEGROUND_RV: bg = new BattleGroundRV; break; + case BATTLEGROUND_IC: bg = new BattleGroundIC; break; + case BATTLEGROUND_RB: bg = new BattleGroundRB; break; + default: + bg = new BattleGround; + break; + } + + bg->SetMapId(MapID); + bg->SetTypeID(bgTypeId); + bg->SetInstanceID(0); + bg->SetArenaorBGType(IsArena); + bg->SetMinPlayersPerTeam(MinPlayersPerTeam); + bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam); + bg->SetMinPlayers(MinPlayersPerTeam * 2); + bg->SetMaxPlayers(MaxPlayersPerTeam * 2); + bg->SetName(BattleGroundName); + bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO); + bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO); + bg->SetLevelRange(LevelMin, LevelMax); + bg->SetHonorMod(honor_mod); + + // add bg to update list + AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg); + + // return some not-null value, bgTypeId is good enough for me + return bgTypeId; +} + +void BattleGroundMgr::CreateInitialBattleGrounds() +{ + float AStartLoc[4]; + float HStartLoc[4]; + float honor_mod; + uint32 MaxPlayersPerTeam, MinPlayersPerTeam, MinLvl, MaxLvl, start1, start2; + BattlemasterListEntry const *bl; + WorldSafeLocsEntry const *start; + bool IsArena; + + uint32 count = 0; + + // 0 1 2 3 4 5 6 7 8 9 + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO,honor_mod FROM battleground_template WHERE disable = 0"); + + if (!result) + { + barGoLink bar(1); + + bar.step(); + + sLog.outString(); + sLog.outErrorDb(">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); + return; + } + + barGoLink bar(result->GetRowCount()); + + do + { + Field *fields = result->Fetch(); + bar.step(); + + uint32 bgTypeID_ = fields[0].GetUInt32(); + + // can be overwrite by values from DB + bl = sBattlemasterListStore.LookupEntry(bgTypeID_); + if (!bl) + { + sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_); + continue; + } + + BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_); + + IsArena = (bl->type == TYPE_ARENA); + MinPlayersPerTeam = fields[1].GetUInt32(); + MaxPlayersPerTeam = fields[2].GetUInt32(); + MinLvl = fields[3].GetUInt32(); + MaxLvl = fields[4].GetUInt32(); + honor_mod = fields[9].GetFloat(); + //check values from DB + if (MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam) + { + MinPlayersPerTeam = 0; // by default now expected strong full bg requirement + MaxPlayersPerTeam = 40; + } + if (MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl) + { + //TO-DO: FIX ME + MinLvl = 0;//bl->minlvl; + MaxLvl = 80;//bl->maxlvl; + } + + start1 = fields[5].GetUInt32(); + + start = sWorldSafeLocsStore.LookupEntry(start1); + if (start) + { + AStartLoc[0] = start->x; + AStartLoc[1] = start->y; + AStartLoc[2] = start->z; + AStartLoc[3] = fields[6].GetFloat(); + } + else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_RB) + { + AStartLoc[0] = 0; + AStartLoc[1] = 0; + AStartLoc[2] = 0; + AStartLoc[3] = fields[6].GetFloat(); + } + else + { + sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", bgTypeID, start1); + continue; + } + + start2 = fields[7].GetUInt32(); + + start = sWorldSafeLocsStore.LookupEntry(start2); + if (start) + { + HStartLoc[0] = start->x; + HStartLoc[1] = start->y; + HStartLoc[2] = start->z; + HStartLoc[3] = fields[8].GetFloat(); + } + else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_RB) + { + HStartLoc[0] = 0; + HStartLoc[1] = 0; + HStartLoc[2] = 0; + HStartLoc[3] = fields[8].GetFloat(); + } + else + { + sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", bgTypeID, start2); + continue; + } + + //sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl); + if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3], honor_mod)) + continue; + + if (IsArena) + { + if (bgTypeID != BATTLEGROUND_AA) + m_EnabledArenas.push_back(bgTypeID); + } + else if (bgTypeID != BATTLEGROUND_RB) + m_EnabledBGs.push_back(bgTypeID); + ++count; + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u battlegrounds", count); +} + +void BattleGroundMgr::InitAutomaticArenaPointDistribution() +{ + if (!sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS)) + return; + + uint64 wstime = sWorld.getWorldState(WS_ARENA_DISTRIBUTION_TIME); + time_t curtime = time(NULL); + sLog.outDebug("Initializing Automatic Arena Point Distribution"); + if (wstime < curtime) + { + m_NextAutoDistributionTime = curtime; // reset will be called in the next update + sLog.outDebug("Battleground: Next arena point distribution time in the past, reseting it now."); + } + else + m_NextAutoDistributionTime = time_t(wstime); + sLog.outDebug("Automatic Arena Point Distribution initialized."); +} + +void BattleGroundMgr::DistributeArenaPoints() +{ + // used to distribute arena points based on last week's stats + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_START); + + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START); + + //temporary structure for storing maximum points to add values for all players + std::map PlayerPoints; + + //at first update all points for all team members + for (ObjectMgr::ArenaTeamMap::iterator team_itr = objmgr.GetArenaTeamMapBegin(); team_itr != objmgr.GetArenaTeamMapEnd(); ++team_itr) + if (ArenaTeam * at = team_itr->second) + at->UpdateArenaPointsHelper(PlayerPoints); + + //cycle that gives points to all players + for (std::map::iterator plr_itr = PlayerPoints.begin(); plr_itr != PlayerPoints.end(); ++plr_itr) + { + //update to database + CharacterDatabase.PExecute("UPDATE characters SET arenaPoints = arenaPoints + '%u' WHERE guid = '%u'", plr_itr->second, plr_itr->first); + + //add points to player if online + Player* pl = objmgr.GetPlayer(plr_itr->first); + if (pl) + pl->ModifyArenaPoints(plr_itr->second); + } + + PlayerPoints.clear(); + + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END); + + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START); + for (ObjectMgr::ArenaTeamMap::iterator titr = objmgr.GetArenaTeamMapBegin(); titr != objmgr.GetArenaTeamMapEnd(); ++titr) + { + if (ArenaTeam * at = titr->second) + { + at->FinishWeek(); // set played this week etc values to 0 in memory, too + at->SaveToDB(); // save changes + at->NotifyStatsChanged(); // notify the players of the changes + } + } + + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END); + + sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_END); +} + +void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere) +{ + if (!plr) + return; + + uint32 win_kills = plr->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST; + uint32 win_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST; + uint32 loos_kills = plr->GetRandomWinner() ? BG_REWARD_LOOSER_HONOR_LAST : BG_REWARD_LOOSER_HONOR_FIRST; + + win_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), win_kills); + loos_kills = Trinity::Honor::hk_honor_at_level(plr->getLevel(), loos_kills); + + data->Initialize(SMSG_BATTLEFIELD_LIST); + *data << uint64(guid); // battlemaster guid + *data << uint8(fromWhere); // from where you joined + *data << uint32(bgTypeId); // battleground id + *data << uint8(0); // unk + *data << uint8(0); // unk + + // Rewards + *data << uint8(plr->GetRandomWinner()); // 3.3.3 hasWin + *data << uint32(win_kills); // 3.3.3 winHonor + *data << uint32(win_arena); // 3.3.3 winArena + *data << uint32(loos_kills); // 3.3.3 lossHonor + + uint8 isRandom = bgTypeId == BATTLEGROUND_RB; + + *data << uint8(isRandom); // 3.3.3 isRandom + if (isRandom) + { + // Rewards (random) + *data << uint8(plr->GetRandomWinner()); // 3.3.3 hasWin_Random + *data << uint32(win_kills); // 3.3.3 winHonor_Random + *data << uint32(win_arena); // 3.3.3 winArena_Random + *data << uint32(loos_kills); // 3.3.3 lossHonor_Random + } + + if (bgTypeId == BATTLEGROUND_AA) // arena + { + *data << uint32(0); // unk (count?) + } + else // battleground + { + size_t count_pos = data->wpos(); + uint32 count = 0; + *data << uint32(0); // number of bg instances + + if (BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)) + { + // expected bracket entry + if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel())) + { + BattleGroundBracketId bracketId = bracketEntry->GetBracketId(); + for (std::set::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracketId].end();++itr) + { + *data << uint32(*itr); + ++count; + } + data->put(count_pos , count); + } + } + } +} + +void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGroundTypeId bgTypeId) +{ + BattleGround *bg = GetBattleGround(instanceId, bgTypeId); + if (bg) + { + uint32 mapid = bg->GetMapId(); + float x, y, z, O; + uint32 team = pl->GetBGTeam(); + if (team == 0) + team = pl->GetTeam(); + bg->GetTeamStartLoc(team, x, y, z, O); + + sLog.outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O); + pl->TeleportTo(mapid, x, y, z, O); + } + else + { + sLog.outError("player %u trying to port to non-existent bg instance %u",pl->GetGUIDLow(), instanceId); + } +} + +void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid) +{ + WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); + uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds + if (time_ == uint32(-1)) + time_ = 0; + data << guid << time_; + pl->GetSession()->SendPacket(&data); +} + +bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId) +{ + return (bgTypeId == BATTLEGROUND_AA || + bgTypeId == BATTLEGROUND_BE || + bgTypeId == BATTLEGROUND_NA || + bgTypeId == BATTLEGROUND_DS || + bgTypeId == BATTLEGROUND_RV || + bgTypeId == BATTLEGROUND_RL || + bgTypeId == BATTLEGROUND_DS); +} + +BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType) +{ + switch(bgTypeId) + { + case BATTLEGROUND_WS: + return BATTLEGROUND_QUEUE_WS; + case BATTLEGROUND_AB: + return BATTLEGROUND_QUEUE_AB; + case BATTLEGROUND_AV: + return BATTLEGROUND_QUEUE_AV; + case BATTLEGROUND_EY: + return BATTLEGROUND_QUEUE_EY; + case BATTLEGROUND_SA: + return BATTLEGROUND_QUEUE_SA; + case BATTLEGROUND_IC: + return BATTLEGROUND_QUEUE_IC; + case BATTLEGROUND_RB: + return BATTLEGROUND_QUEUE_RB; + case BATTLEGROUND_AA: + case BATTLEGROUND_NA: + case BATTLEGROUND_RL: + case BATTLEGROUND_BE: + case BATTLEGROUND_DS: + case BATTLEGROUND_RV: + switch(arenaType) + { + case ARENA_TYPE_2v2: + if (sWorld.getConfig(CONFIG_ARENA_2v2_TEAM_ENABLE) == 1) + return BATTLEGROUND_QUEUE_2v2; + else + return BATTLEGROUND_QUEUE_NONE; + case ARENA_TYPE_3v3: + if (sWorld.getConfig(CONFIG_ARENA_3v3_TEAM_ENABLE) == 1) + return BATTLEGROUND_QUEUE_3v3; + else + return BATTLEGROUND_QUEUE_NONE; + case ARENA_TYPE_5v5: + if (sWorld.getConfig(CONFIG_ARENA_5v5_TEAM_ENABLE) == 1) + return BATTLEGROUND_QUEUE_5v5; + else + return BATTLEGROUND_QUEUE_NONE; + default: + return BATTLEGROUND_QUEUE_NONE; + } + default: + return BATTLEGROUND_QUEUE_NONE; + } +} + +BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId) +{ + switch(bgQueueTypeId) + { + case BATTLEGROUND_QUEUE_WS: + return BATTLEGROUND_WS; + case BATTLEGROUND_QUEUE_AB: + return BATTLEGROUND_AB; + case BATTLEGROUND_QUEUE_AV: + return BATTLEGROUND_AV; + case BATTLEGROUND_QUEUE_EY: + return BATTLEGROUND_EY; + case BATTLEGROUND_QUEUE_SA: + return BATTLEGROUND_SA; + case BATTLEGROUND_QUEUE_IC: + return BATTLEGROUND_IC; + case BATTLEGROUND_QUEUE_RB: + return BATTLEGROUND_RB; + case BATTLEGROUND_QUEUE_2v2: + case BATTLEGROUND_QUEUE_3v3: + case BATTLEGROUND_QUEUE_5v5: + return BATTLEGROUND_AA; + default: + return BattleGroundTypeId(0); // used for unknown template (it existed and do nothing) + } +} + +uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId) +{ + switch(bgQueueTypeId) + { + case BATTLEGROUND_QUEUE_2v2: + return ARENA_TYPE_2v2; + case BATTLEGROUND_QUEUE_3v3: + return ARENA_TYPE_3v3; + case BATTLEGROUND_QUEUE_5v5: + return ARENA_TYPE_5v5; + default: + return 0; + } +} + +void BattleGroundMgr::ToggleTesting() +{ + m_Testing = !m_Testing; + if (m_Testing) + sWorld.SendWorldText(LANG_DEBUG_BG_ON); + else + sWorld.SendWorldText(LANG_DEBUG_BG_OFF); +} + +void BattleGroundMgr::ToggleArenaTesting() +{ + m_ArenaTesting = !m_ArenaTesting; + if (m_ArenaTesting) + sWorld.SendWorldText(LANG_DEBUG_ARENA_ON); + else + sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF); +} + +void BattleGroundMgr::SetHolidayWeekends(uint32 mask) +{ + for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype) + { + if (BattleGround * bg = GetBattleGroundTemplate(BattleGroundTypeId(bgtype))) + { + bg->SetHoliday(mask & (1 << bgtype)); + } + } +} + +void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id) +{ + //This method must be atomic, TODO add mutex + //we will use only 1 number created of bgTypeId and bracket_id + uint64 schedule_id = ((uint64)arenaRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | bracket_id; + bool found = false; + for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++) + { + if (m_QueueUpdateScheduler[i] == schedule_id) + { + found = true; + break; + } + } + if (!found) + m_QueueUpdateScheduler.push_back(schedule_id); +} + +uint32 BattleGroundMgr::GetMaxRatingDifference() const +{ + // this is for stupid people who can't use brain and set max rating difference to 0 + uint32 diff = sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE); + if (diff == 0) + diff = 5000; + return diff; +} + +uint32 BattleGroundMgr::GetRatingDiscardTimer() const +{ + return sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); +} + +uint32 BattleGroundMgr::GetPrematureFinishTime() const +{ + return sWorld.getConfig(CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER); +} + +void BattleGroundMgr::LoadBattleMastersEntry() +{ + mBattleMastersMap.clear(); // need for reload case + + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry"); + + uint32 count = 0; + + if (!result) + { + barGoLink bar(1); + bar.step(); + + sLog.outString(); + sLog.outString(">> Loaded 0 battlemaster entries - table is empty!"); + return; + } + + barGoLink bar(result->GetRowCount()); + + do + { + ++count; + bar.step(); + + Field *fields = result->Fetch(); + + uint32 entry = fields[0].GetUInt32(); + uint32 bgTypeId = fields[1].GetUInt32(); + if (!sBattlemasterListStore.LookupEntry(bgTypeId)) + { + sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.",entry,bgTypeId); + continue; + } + + mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId); + + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u battlemaster entries", count); +} + +HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId) +{ + switch (bgTypeId) + { + case BATTLEGROUND_AV: return HOLIDAY_CALL_TO_ARMS_AV; + case BATTLEGROUND_EY: return HOLIDAY_CALL_TO_ARMS_EY; + case BATTLEGROUND_WS: return HOLIDAY_CALL_TO_ARMS_WS; + case BATTLEGROUND_SA: return HOLIDAY_CALL_TO_ARMS_SA; + default: return HOLIDAY_NONE; + } +} + +BattleGroundTypeId BattleGroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday) +{ + switch (holiday) + { + case HOLIDAY_CALL_TO_ARMS_AV: return BATTLEGROUND_AV; + case HOLIDAY_CALL_TO_ARMS_EY: return BATTLEGROUND_EY; + case HOLIDAY_CALL_TO_ARMS_WS: return BATTLEGROUND_WS; + case HOLIDAY_CALL_TO_ARMS_SA: return BATTLEGROUND_SA; + default: return BATTLEGROUND_TYPE_NONE; + } +} + +bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId) +{ + return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId)); +} + +void BattleGroundMgr::DoCompleteAchievement(uint32 achievement, Player * player) +{ + AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement); + + if (!player) + { + //Map::PlayerList const &PlayerList = this->GetPlayers(); + //GroupsQueueType::iterator group = SelectedGroups.begin(); + + //if (!PlayerList.isEmpty()) + //for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + // for (GroupsQueueType::iterator itr = group; itr != SelectedGroups.end(); ++itr) + // if (Player *pPlayer = itr->getSource()) + // pPlayer->CompletedAchievement(AE); + } + else + { + player->CompletedAchievement(AE); + } +} diff --git a/src/server/game/BattleGrounds/BattleGroundMgr.h b/src/server/game/BattleGrounds/BattleGroundMgr.h new file mode 100644 index 0000000..a082de8 --- /dev/null +++ b/src/server/game/BattleGrounds/BattleGroundMgr.h @@ -0,0 +1,279 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDMGR_H +#define __BATTLEGROUNDMGR_H + +#include "Common.h" +#include "ace/Singleton.h" + +#include "DBCEnums.h" +#include "BattleGround.h" + +typedef std::map BattleGroundSet; + +//this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears +typedef std::list BGFreeSlotQueueType; + +typedef UNORDERED_MAP BattleMastersMap; + +#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day +#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10 +#define WS_ARENA_DISTRIBUTION_TIME 20001 // Custom worldstate + +struct GroupQueueInfo; // type predefinition +struct PlayerQueueInfo // stores information for players in queue +{ + uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes + GroupQueueInfo * GroupInfo; // pointer to the associated groupqueueinfo +}; + +struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!) +{ + std::map Players; // player queue info map + uint32 Team; // Player team (ALLIANCE/HORDE) + BattleGroundTypeId BgTypeId; // battleground type id + bool IsRated; // rated + uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG + uint32 ArenaTeamId; // team id if rated match + uint32 JoinTime; // time when group was added + uint32 RemoveInviteTime; // time when we will remove invite for players in group + uint32 IsInvitedToBGInstanceGUID; // was invited to certain BG + uint32 ArenaTeamRating; // if rated match, inited to the rating of the team + uint32 OpponentsTeamRating; // for rated arena matches +}; + +enum BattleGroundQueueGroupTypes +{ + BG_QUEUE_PREMADE_ALLIANCE = 0, + BG_QUEUE_PREMADE_HORDE = 1, + BG_QUEUE_NORMAL_ALLIANCE = 2, + BG_QUEUE_NORMAL_HORDE = 3 +}; +#define BG_QUEUE_GROUP_TYPES_COUNT 4 + +class BattleGround; +class BattleGroundQueue +{ + public: + BattleGroundQueue(); + ~BattleGroundQueue(); + + void Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0); + + void FillPlayersToBG(BattleGround* bg, BattleGroundBracketId bracket_id); + bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam); + bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers); + bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam); + GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); + void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); + bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); + bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo); + void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id); + uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id); + + typedef std::map QueuedPlayersMap; + QueuedPlayersMap m_QueuedPlayers; + + //we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well + typedef std::list GroupsQueueType; + + /* + This two dimensional array is used to store All queued groups + First dimension specifies the bgTypeId + Second dimension specifies the player's group types - + BG_QUEUE_PREMADE_ALLIANCE is used for premade alliance groups and alliance rated arena teams + BG_QUEUE_PREMADE_HORDE is used for premade horde groups and horde rated arena teams + BG_QUEUE_NORMAL_ALLIANCE is used for normal (or small) alliance groups or non-rated arena matches + BG_QUEUE_NORMAL_HORDE is used for normal (or small) horde groups or non-rated arena matches + */ + GroupsQueueType m_QueuedGroups[MAX_BATTLEGROUND_BRACKETS][BG_QUEUE_GROUP_TYPES_COUNT]; + + // class to select and invite groups to bg + class SelectionPool + { + public: + void Init(); + bool AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount); + bool KickGroup(uint32 size); + uint32 GetPlayerCount() const {return PlayerCount;} + public: + GroupsQueueType SelectedGroups; + private: + uint32 PlayerCount; + }; + + //one selection pool for horde, other one for alliance + SelectionPool m_SelectionPools[BG_TEAMS_COUNT]; + + private: + + bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side); + uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME]; + uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS]; + uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS]; +}; + +/* + This class is used to invite player to BG again, when minute lasts from his first invitation + it is capable to solve all possibilities +*/ +class BGQueueInviteEvent : public BasicEvent +{ + public: + BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) : + m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime) + { + }; + virtual ~BGQueueInviteEvent() {}; + + virtual bool Execute(uint64 e_time, uint32 p_time); + virtual void Abort(uint64 e_time); + private: + uint64 m_PlayerGuid; + uint32 m_BgInstanceGUID; + BattleGroundTypeId m_BgTypeId; + uint8 m_ArenaType; + uint32 m_RemoveTime; +}; + +/* + This class is used to remove player from BG queue after 1 minute 20 seconds from first invitation + We must store removeInvite time in case player left queue and joined and is invited again + We must store bgQueueTypeId, because battleground can be deleted already, when player entered it +*/ +class BGQueueRemoveEvent : public BasicEvent +{ + public: + BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime) + : m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId) + {} + + virtual ~BGQueueRemoveEvent() {} + + virtual bool Execute(uint64 e_time, uint32 p_time); + virtual void Abort(uint64 e_time); + private: + uint64 m_PlayerGuid; + uint32 m_BgInstanceGUID; + uint32 m_RemoveTime; + BattleGroundTypeId m_BgTypeId; + BattleGroundQueueTypeId m_BgQueueTypeId; +}; + +class BattleGroundMgr +{ + /// Todo: Thread safety? + /* Construction */ + friend class ACE_Singleton; + BattleGroundMgr(); + + public: + ~BattleGroundMgr(); + void Update(uint32 diff); + + /* Packet Building */ + void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr); + void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid); + void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, BattleGroundTypeId bgTypeId, uint8 fromWhere); + void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result); + void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value); + void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg); + void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype); + void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid); + void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid); + + /* Battlegrounds */ + BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId); + BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown + + BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); + BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated); + + uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, float honor_mod); + + void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; }; + void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); } + uint32 CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id); + + void CreateInitialBattleGrounds(); + void DeleteAllBattleGrounds(); + + void SendToBattleGround(Player *pl, uint32 InstanceID, BattleGroundTypeId bgTypeId); + + /* Battleground queues */ + //these queues are instantiated when creating BattlegroundMrg + BattleGroundQueue m_BattleGroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code + + BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID]; + + void ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id); + uint32 GetMaxRatingDifference() const; + uint32 GetRatingDiscardTimer() const; + uint32 GetPrematureFinishTime() const; + + void InitAutomaticArenaPointDistribution(); + void DistributeArenaPoints(); + void ToggleArenaTesting(); + void ToggleTesting(); + + void SetHolidayWeekends(uint32 mask); + void LoadBattleMastersEntry(); + BattleGroundTypeId GetBattleMasterBG(uint32 entry) const + { + BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry); + if (itr != mBattleMastersMap.end()) + return itr->second; + return BATTLEGROUND_WS; + } + + bool isArenaTesting() const { return m_ArenaTesting; } + bool isTesting() const { return m_Testing; } + + static bool IsArenaType(BattleGroundTypeId bgTypeId); + static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); } + static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType); + static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId); + static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId); + + static HolidayIds BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId); + static BattleGroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday); + static bool IsBGWeekend(BattleGroundTypeId bgTypeId); + void DoCompleteAchievement(uint32 achievement, Player * player = NULL); + private: + BattleMastersMap mBattleMastersMap; + + typedef std::vector BattleGroundTypeIdList; + /* Battlegrounds */ + BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; + BattleGroundTypeIdList m_EnabledArenas; + BattleGroundTypeIdList m_EnabledBGs; + std::vector m_QueueUpdateScheduler; + std::set m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client + uint32 m_NextRatingDiscardUpdate; + time_t m_NextAutoDistributionTime; + uint32 m_AutoDistributionTimeChecker; + bool m_ArenaTesting; + bool m_Testing; +}; + +#define sBattleGroundMgr (*ACE_Singleton::instance()) +#endif + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundAA.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundAA.cpp new file mode 100644 index 0000000..56cf3eb --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundAA.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundAA.h" +#include "Language.h" +#include "Player.h" + +BattleGroundAA::BattleGroundAA() +{ + + m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; + m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; + m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; + m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + //we must set messageIds + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; +} + +BattleGroundAA::~BattleGroundAA() +{ + +} + +void BattleGroundAA::Update(uint32 diff) +{ + BattleGround::Update(diff); +} + +void BattleGroundAA::StartingEventCloseDoors() +{ +} + +void BattleGroundAA::StartingEventOpenDoors() +{ +} + +void BattleGroundAA::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundAAScore* sc = new BattleGroundAAScore; + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundAA::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +{ +} + +void BattleGroundAA::HandleKillPlayer(Player* player, Player* killer) +{ + BattleGround::HandleKillPlayer(player, killer); +} + +void BattleGroundAA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) +{ +} + +bool BattleGroundAA::SetupBattleGround() +{ + return true; +} + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundAA.h b/src/server/game/BattleGrounds/Zones/BattleGroundAA.h new file mode 100644 index 0000000..a138336 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundAA.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BATTLEGROUNDAA_H +#define __BATTLEGROUNDAA_H + +class BattleGround; + +class BattleGroundAAScore : public BattleGroundScore +{ + public: + BattleGroundAAScore() {}; + virtual ~BattleGroundAAScore() {}; + //TODO fix me +}; + +class BattleGroundAA : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundAA(); + ~BattleGroundAA(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr, uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + void HandleKillPlayer(Player* player, Player *killer); +}; +#endif + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundAB.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundAB.cpp new file mode 100644 index 0000000..38671e8 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundAB.cpp @@ -0,0 +1,715 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "World.h" +#include "WorldPacket.h" +#include "ObjectMgr.h" +#include "BattleGroundMgr.h" +#include "BattleGround.h" +#include "BattleGroundAB.h" +#include "Creature.h" +#include "Language.h" +#include "Object.h" +#include "Player.h" +#include "Util.h" + +// these variables aren't used outside of this file, so declare them only here +uint32 BG_AB_HonorScoreTicks[BG_HONOR_MODE_NUM] = { + 330, // normal honor + 200 // holiday +}; + +uint32 BG_AB_ReputationScoreTicks[BG_HONOR_MODE_NUM] = { + 200, // normal honor + 150 // holiday +}; + +BattleGroundAB::BattleGroundAB() +{ + m_BuffChange = true; + m_BgObjects.resize(BG_AB_OBJECT_MAX); + m_BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers + + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; +} + +BattleGroundAB::~BattleGroundAB() +{ +} + +void BattleGroundAB::Update(uint32 diff) +{ + BattleGround::Update(diff); + + if (GetStatus() == STATUS_IN_PROGRESS) + { + int team_points[BG_TEAMS_COUNT] = { 0, 0 }; + + for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) + { + // 3 sec delay to spawn new banner instead previous despawned one + if (m_BannerTimers[node].timer) + { + if (m_BannerTimers[node].timer > diff) + m_BannerTimers[node].timer -= diff; + else + { + m_BannerTimers[node].timer = 0; + _CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false); + } + } + + // 1-minute to occupy a node from contested state + if (m_NodeTimers[node]) + { + if (m_NodeTimers[node] > diff) + m_NodeTimers[node] -= diff; + else + { + m_NodeTimers[node] = 0; + // Change from contested to occupied ! + uint8 teamIndex = m_Nodes[node]-1; + m_prevNodes[node] = m_Nodes[node]; + m_Nodes[node] += 2; + // burn current contested banner + _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex); + // create new occupied banner + _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); + _SendNodeUpdate(node); + _NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE); + // Message to chatlog + + if (teamIndex == 0) + { + // FIXME: team and node names not localized + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node)); + PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE); + } + else + { + // FIXME: team and node names not localized + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_AB_HORDE,_GetNodeNameId(node)); + PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE); + } + } + } + + for (int team = 0; team < BG_TEAMS_COUNT; ++team) + if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED) + ++team_points[team]; + } + + // Accumulate points + for (int team = 0; team < BG_TEAMS_COUNT; ++team) + { + int points = team_points[team]; + if (!points) + continue; + m_lastTick[team] += diff; + if (m_lastTick[team] > BG_AB_TickIntervals[points]) + { + m_lastTick[team] -= BG_AB_TickIntervals[points]; + m_TeamScores[team] += BG_AB_TickPoints[points]; + m_HonorScoreTics[team] += BG_AB_TickPoints[points]; + m_ReputationScoreTics[team] += BG_AB_TickPoints[points]; + if (m_ReputationScoreTics[team] >= m_ReputationTics) + { + (team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE); + m_ReputationScoreTics[team] -= m_ReputationTics; + } + if (m_HonorScoreTics[team] >= m_HonorTics) + { + RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE); + m_HonorScoreTics[team] -= m_HonorTics; + } + if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE) + { + if (team == BG_TEAM_ALLIANCE) + SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + else + SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY); + m_IsInformedNearVictory = true; + } + + if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE) + m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE; + if (team == BG_TEAM_ALLIANCE) + UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]); + if (team == BG_TEAM_HORDE) + UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]); + // update achievement flags + // we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources + uint8 otherTeam = (team + 1) % BG_TEAMS_COUNT; + if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500) + m_TeamScores500Disadvantage[otherTeam] = true; + } + } + + // Test win condition + if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE) + EndBattleGround(ALLIANCE); + if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE) + EndBattleGround(HORDE); + } +} + +void BattleGroundAB::StartingEventCloseDoors() +{ + // despawn banners, auras and buffs + for (int obj = BG_AB_OBJECT_BANNER_NEUTRAL; obj < BG_AB_DYNAMIC_NODES_COUNT * 8; ++obj) + SpawnBGObject(obj, RESPAWN_ONE_DAY); + for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT * 3; ++i) + SpawnBGObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + i, RESPAWN_ONE_DAY); + + // Starting doors + DoorClose(BG_AB_OBJECT_GATE_A); + DoorClose(BG_AB_OBJECT_GATE_H); + SpawnBGObject(BG_AB_OBJECT_GATE_A, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_AB_OBJECT_GATE_H, RESPAWN_IMMEDIATELY); + + // Starting base spirit guides + _NodeOccupied(BG_AB_SPIRIT_ALIANCE,ALLIANCE); + _NodeOccupied(BG_AB_SPIRIT_HORDE,HORDE); +} + +void BattleGroundAB::StartingEventOpenDoors() +{ + // spawn neutral banners + for (int banner = BG_AB_OBJECT_BANNER_NEUTRAL, i = 0; i < 5; banner += 8, ++i) + SpawnBGObject(banner, RESPAWN_IMMEDIATELY); + for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + { + //randomly select buff to spawn + uint8 buff = urand(0, 2); + SpawnBGObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + buff + i * 3, RESPAWN_IMMEDIATELY); + } + DoorOpen(BG_AB_OBJECT_GATE_A); + DoorOpen(BG_AB_OBJECT_GATE_H); +} + +void BattleGroundAB::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in the constructor + BattleGroundABScore* sc = new BattleGroundABScore; + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +{ + +} + +void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + switch(Trigger) + { + case 3948: // Arathi Basin Alliance Exit. + if (Source->GetTeam() != ALLIANCE) + Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal"); + else + Source->LeaveBattleground(); + break; + case 3949: // Arathi Basin Horde Exit. + if (Source->GetTeam() != HORDE) + Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal"); + else + Source->LeaveBattleground(); + break; + case 3866: // Stables + case 3869: // Gold Mine + case 3867: // Farm + case 3868: // Lumber Mill + case 3870: // Black Smith + case 4020: // Unk1 + case 4021: // Unk2 + //break; + default: + //sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + //Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } +} + +/* type: 0-neutral, 1-contested, 3-occupied + teamIndex: 0-ally, 1-horde */ +void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay) +{ + // Just put it into the queue + if (delay) + { + m_BannerTimers[node].timer = 2000; + m_BannerTimers[node].type = type; + m_BannerTimers[node].teamIndex = teamIndex; + return; + } + + uint8 obj = node*8 + type + teamIndex; + + SpawnBGObject(obj, RESPAWN_IMMEDIATELY); + + // handle aura with banner + if (!type) + return; + obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7); + SpawnBGObject(obj, RESPAWN_IMMEDIATELY); +} + +void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex) +{ + uint8 obj = node*8 + type + teamIndex; + SpawnBGObject(obj, RESPAWN_ONE_DAY); + + // handle aura with banner + if (!type) + return; + obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7); + SpawnBGObject(obj, RESPAWN_ONE_DAY); +} + +int32 BattleGroundAB::_GetNodeNameId(uint8 node) +{ + switch (node) + { + case BG_AB_NODE_STABLES: return LANG_BG_AB_NODE_STABLES; + case BG_AB_NODE_BLACKSMITH: return LANG_BG_AB_NODE_BLACKSMITH; + case BG_AB_NODE_FARM: return LANG_BG_AB_NODE_FARM; + case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL; + case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE; + default: + ASSERT(0); + } + return 0; +} + +void BattleGroundAB::FillInitialWorldStates(WorldPacket& data) +{ + const uint8 plusArray[] = {0, 2, 3, 0, 1}; + + // Node icons + for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) + data << uint32(BG_AB_OP_NODEICONS[node]) << uint32((m_Nodes[node] == 0)?1:0); + + // Node occupied states + for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) + for (uint8 i = 1; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + data << uint32(BG_AB_OP_NODESTATES[node] + plusArray[i]) << uint32((m_Nodes[node] == i)?1:0); + + // How many bases each team owns + uint8 ally = 0, horde = 0; + for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) + if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) + ++ally; + else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) + ++horde; + + data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally); + data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(horde); + + // Team scores + data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE); + data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE); + data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]); + data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]); + + // other unknown + data << uint32(0x745) << uint32(0x2); // 37 1861 unk +} + +void BattleGroundAB::_SendNodeUpdate(uint8 node) +{ + // Send node owner state update to refresh map icons on client + const uint8 plusArray[] = {0, 2, 3, 0, 1}; + + if (m_prevNodes[node]) + UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0); + else + UpdateWorldState(BG_AB_OP_NODEICONS[node], 0); + + UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], 1); + + // How many bases each team owns + uint8 ally = 0, horde = 0; + for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) + ++ally; + else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) + ++horde; + + UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally); + UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde); +} + +void BattleGroundAB::_NodeOccupied(uint8 node,Team team) +{ + if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team)) + sLog.outError("Failed to spawn spirit guide! point: %u, team: %u,", node, team); + + uint8 capturedNodes = 0; + for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + { + if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i]) + ++capturedNodes; + } + if (capturedNodes >= 5) + CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team); + if (capturedNodes >= 4) + CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team); + + if(node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points + return; + Creature* trigger = GetBGCreature(node+7);//0-6 spirit guides + if (!trigger) + trigger = AddCreature(WORLD_TRIGGER,node+7,team,BG_AB_NodePositions[node][0],BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2],BG_AB_NodePositions[node][3]); + + //add bonus honor aura trigger creature when node is accupied + //cast bonus aura (+50% honor in 25yards) + //aura should only apply to players who have accupied the node, set correct faction for trigger + if (trigger) + { + trigger->setFaction(team == ALLIANCE ? 84 : 83); + trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false); + } +} + +void BattleGroundAB::_NodeDeOccupied(uint8 node) +{ + if (node >= BG_AB_DYNAMIC_NODES_COUNT) + return; + + //remove bonus honor aura trigger creature when node is lost + if(node < BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points + DelCreature(node+7);//NULL checks are in DelCreature! 0-6 spirit guides + + // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard + std::vector ghost_list = m_ReviveQueue[m_BgCreatures[node]]; + if (!ghost_list.empty()) + { + WorldSafeLocsEntry const *ClosestGrave = NULL; + for (std::vector::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) + { + Player* plr = objmgr.GetPlayer(*itr); + if (!plr) + continue; + + if (!ClosestGrave) // cache + ClosestGrave = GetClosestGraveYard(plr); + + if (ClosestGrave) + plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + } + } + + if (m_BgCreatures[node]) + DelCreature(node); + + // buff object isn't despawned +} + +/* Invoked if a player used a banner as a gameobject */ +void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + uint8 node = BG_AB_NODE_STABLES; + GameObject* obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+7]); + while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10)))) + { + ++node; + obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); + } + + if (node == BG_AB_DYNAMIC_NODES_COUNT) + { + // this means our player isn't close to any of banners - maybe cheater ?? + return; + } + + BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam()); + + // Check if player really could use this banner, not cheated + if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2)) + return; + + source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); + uint32 sound = 0; + // If node is neutral, change to contested + if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL) + { + UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); + m_prevNodes[node] = m_Nodes[node]; + m_Nodes[node] = teamIndex + 1; + // burn current neutral banner + _DelBanner(node, BG_AB_NODE_TYPE_NEUTRAL, 0); + // create new contested banner + _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); + _SendNodeUpdate(node); + m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; + + // FIXME: team and node names not localized + if (teamIndex == 0) + SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY); + else + SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE); + + sound = BG_AB_SOUND_NODE_CLAIMED; + } + // If node is contested + else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED)) + { + // If last state is NOT occupied, change node to enemy-contested + if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED) + { + UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); + m_prevNodes[node] = m_Nodes[node]; + m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; + // burn current contested banner + _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex); + // create new contested banner + _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); + _SendNodeUpdate(node); + m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; + + // FIXME: node names not localized + if (teamIndex == BG_TEAM_ALLIANCE) + SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + else + SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + } + // If contested, change back to occupied + else + { + UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); + m_prevNodes[node] = m_Nodes[node]; + m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED; + // burn current contested banner + _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex); + // create new occupied banner + _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); + _SendNodeUpdate(node); + m_NodeTimers[node] = 0; + _NodeOccupied(node,(teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE); + + // FIXME: node names not localized + if (teamIndex == BG_TEAM_ALLIANCE) + SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + else + SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + } + sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; + } + // If node is occupied, change to enemy-contested + else + { + UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); + m_prevNodes[node] = m_Nodes[node]; + m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; + // burn current occupied banner + _DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex); + // create new contested banner + _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); + _SendNodeUpdate(node); + _NodeDeOccupied(node); + m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; + + // FIXME: node names not localized + if (teamIndex == BG_TEAM_ALLIANCE) + SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + else + SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + + sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; + } + + // If node is occupied again, send "X has taken the Y" msg. + if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) + { + // FIXME: team and node names not localized + if (teamIndex == BG_TEAM_ALLIANCE) + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node)); + else + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node)); + } + PlaySoundToAll(sound); +} + +bool BattleGroundAB::SetupBattleGround() +{ + for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + { + if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i,BG_AB_OBJECTID_BANNER_CONT_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i,BG_AB_OBJECTID_BANNER_CONT_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i,BG_AB_OBJECTID_BANNER_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i,BG_AB_OBJECTID_BANNER_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i,BG_AB_OBJECTID_AURA_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i,BG_AB_OBJECTID_AURA_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i,BG_AB_OBJECTID_AURA_C,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY) +) + { + sLog.outErrorDb("BatteGroundAB: Failed to spawn some object BattleGround not created!"); + return false; + } + } + if (!AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY) + || !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY) +) + { + sLog.outErrorDb("BatteGroundAB: Failed to spawn door object BattleGround not created!"); + return false; + } + //buffs + for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + { + if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) +) + sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!"); + } + + return true; +} + +void BattleGroundAB::Reset() +{ + //call parent's class reset + BattleGround::Reset(); + + m_TeamScores[BG_TEAM_ALLIANCE] = 0; + m_TeamScores[BG_TEAM_HORDE] = 0; + m_lastTick[BG_TEAM_ALLIANCE] = 0; + m_lastTick[BG_TEAM_HORDE] = 0; + m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0; + m_HonorScoreTics[BG_TEAM_HORDE] = 0; + m_ReputationScoreTics[BG_TEAM_ALLIANCE] = 0; + m_ReputationScoreTics[BG_TEAM_HORDE] = 0; + m_IsInformedNearVictory = false; + bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID()); + m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks; + m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks; + m_TeamScores500Disadvantage[BG_TEAM_ALLIANCE] = false; + m_TeamScores500Disadvantage[BG_TEAM_HORDE] = false; + + for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + { + m_Nodes[i] = 0; + m_prevNodes[i] = 0; + m_NodeTimers[i] = 0; + m_BannerTimers[i].timer = 0; + } + + for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT + 5; ++i)//+5 for aura triggers + if (m_BgCreatures[i]) + DelCreature(i); +} + +void BattleGroundAB::EndBattleGround(uint32 winner) +{ + //win reward + if (winner == ALLIANCE) + RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); + if (winner == HORDE) + RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); + //complete map_end rewards (even if no team wins) + RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); + RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); + + BattleGround::EndBattleGround(winner); +} + +WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) +{ + BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam()); + + // Is there any occupied node for this team? + std::vector nodes; + for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + if (m_Nodes[i] == teamIndex + 3) + nodes.push_back(i); + + WorldSafeLocsEntry const* good_entry = NULL; + // If so, select the closest node to place ghost on + if (!nodes.empty()) + { + float plr_x = player->GetPositionX(); + float plr_y = player->GetPositionY(); + + float mindist = 999999.0f; + for (uint8 i = 0; i < nodes.size(); ++i) + { + WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]); + if (!entry) + continue; + float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y); + if (mindist > dist) + { + mindist = dist; + good_entry = entry; + } + } + nodes.clear(); + } + // If not, place ghost on starting location + if (!good_entry) + good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex+5]); + + return good_entry; +} + +void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor) +{ + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + if (itr == m_PlayerScores.end()) // player not found... + return; + + switch(type) + { + case SCORE_BASES_ASSAULTED: + ((BattleGroundABScore*)itr->second)->BasesAssaulted += value; + break; + case SCORE_BASES_DEFENDED: + ((BattleGroundABScore*)itr->second)->BasesDefended += value; + break; + default: + BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor); + break; + } +} + +bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const +{ + uint32 count = 0; + for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) || + (team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)) + ++count; + + return count == BG_AB_DYNAMIC_NODES_COUNT; +} diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundAB.h b/src/server/game/BattleGrounds/Zones/BattleGroundAB.h new file mode 100644 index 0000000..3072f8b --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundAB.h @@ -0,0 +1,301 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BATTLEGROUNDAB_H +#define __BATTLEGROUNDAB_H + +class BattleGround; + +enum BG_AB_WorldStates +{ + BG_AB_OP_OCCUPIED_BASES_HORDE = 1778, + BG_AB_OP_OCCUPIED_BASES_ALLY = 1779, + BG_AB_OP_RESOURCES_ALLY = 1776, + BG_AB_OP_RESOURCES_HORDE = 1777, + BG_AB_OP_RESOURCES_MAX = 1780, + BG_AB_OP_RESOURCES_WARNING = 1955 +/* + BG_AB_OP_STABLE_ICON = 1842, //Stable map icon (NONE) + BG_AB_OP_STABLE_STATE_ALIENCE = 1767, //Stable map state (ALIENCE) + BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE) + BG_AB_OP_STABLE_STATE_CON_ALI = 1769, //Stable map state (CON ALIENCE) + BG_AB_OP_STABLE_STATE_CON_HOR = 1770, //Stable map state (CON HORDE) + BG_AB_OP_FARM_ICON = 1845, //Farm map icon (NONE) + BG_AB_OP_FARM_STATE_ALIENCE = 1772, //Farm state (ALIENCE) + BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE) + BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE) + BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE) + + BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE) + BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE) + BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE) + BG_AB_OP_BLACKSMITH_STATE_CON_ALI = 1784, //Blacksmith map state (CON ALIENCE) + BG_AB_OP_BLACKSMITH_STATE_CON_HOR = 1785, //Blacksmith map state (CON HORDE) + BG_AB_OP_LUMBERMILL_ICON = 1844, //Lumber Mill map icon (NONE) + BG_AB_OP_LUMBERMILL_STATE_ALIENCE = 1792, //Lumber Mill map state (ALIENCE) + BG_AB_OP_LUMBERMILL_STATE_HORDE = 1793, //Lumber Mill map state (HORDE) + BG_AB_OP_LUMBERMILL_STATE_CON_ALI = 1794, //Lumber Mill map state (CON ALIENCE) + BG_AB_OP_LUMBERMILL_STATE_CON_HOR = 1795, //Lumber Mill map state (CON HORDE) + BG_AB_OP_GOLDMINE_ICON = 1843, //Gold Mine map icon (NONE) + BG_AB_OP_GOLDMINE_STATE_ALIENCE = 1787, //Gold Mine map state (ALIENCE) + BG_AB_OP_GOLDMINE_STATE_HORDE = 1788, //Gold Mine map state (HORDE) + BG_AB_OP_GOLDMINE_STATE_CON_ALI = 1789, //Gold Mine map state (CON ALIENCE + BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE) +*/ +}; + +const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787}; + +const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843}; + +/* Note: code uses that these IDs follow each other */ +enum BG_AB_NodeObjectId +{ + BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner + BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner + BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner + BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner + BG_AB_OBJECTID_NODE_BANNER_4 = 180091 // Gold mine banner +}; + +enum BG_AB_ObjectType +{ + // for all 5 node points 8*5=40 objects + BG_AB_OBJECT_BANNER_NEUTRAL = 0, + BG_AB_OBJECT_BANNER_CONT_A = 1, + BG_AB_OBJECT_BANNER_CONT_H = 2, + BG_AB_OBJECT_BANNER_ALLY = 3, + BG_AB_OBJECT_BANNER_HORDE = 4, + BG_AB_OBJECT_AURA_ALLY = 5, + BG_AB_OBJECT_AURA_HORDE = 6, + BG_AB_OBJECT_AURA_CONTESTED = 7, + //gates + BG_AB_OBJECT_GATE_A = 40, + BG_AB_OBJECT_GATE_H = 41, + //buffs + BG_AB_OBJECT_SPEEDBUFF_STABLES = 42, + BG_AB_OBJECT_REGENBUFF_STABLES = 43, + BG_AB_OBJECT_BERSERKBUFF_STABLES = 44, + BG_AB_OBJECT_SPEEDBUFF_BLACKSMITH = 45, + BG_AB_OBJECT_REGENBUFF_BLACKSMITH = 46, + BG_AB_OBJECT_BERSERKBUFF_BLACKSMITH = 47, + BG_AB_OBJECT_SPEEDBUFF_FARM = 48, + BG_AB_OBJECT_REGENBUFF_FARM = 49, + BG_AB_OBJECT_BERSERKBUFF_FARM = 50, + BG_AB_OBJECT_SPEEDBUFF_LUMBER_MILL = 51, + BG_AB_OBJECT_REGENBUFF_LUMBER_MILL = 52, + BG_AB_OBJECT_BERSERKBUFF_LUMBER_MILL = 53, + BG_AB_OBJECT_SPEEDBUFF_GOLD_MINE = 54, + BG_AB_OBJECT_REGENBUFF_GOLD_MINE = 55, + BG_AB_OBJECT_BERSERKBUFF_GOLD_MINE = 56, + BG_AB_OBJECT_MAX = 57, +}; + +/* Object id templates from DB */ +enum BG_AB_ObjectTypes +{ + BG_AB_OBJECTID_BANNER_A = 180058, + BG_AB_OBJECTID_BANNER_CONT_A = 180059, + BG_AB_OBJECTID_BANNER_H = 180060, + BG_AB_OBJECTID_BANNER_CONT_H = 180061, + + BG_AB_OBJECTID_AURA_A = 180100, + BG_AB_OBJECTID_AURA_H = 180101, + BG_AB_OBJECTID_AURA_C = 180102, + + BG_AB_OBJECTID_GATE_A = 180255, + BG_AB_OBJECTID_GATE_H = 180256 +}; + +enum BG_AB_Timers +{ + BG_AB_FLAG_CAPTURING_TIME = 60000, +}; + +enum BG_AB_Score +{ + BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400, + BG_AB_MAX_TEAM_SCORE = 1600 +}; + +/* do NOT change the order, else wrong behaviour */ +enum BG_AB_BattleGroundNodes +{ + BG_AB_NODE_STABLES = 0, + BG_AB_NODE_BLACKSMITH = 1, + BG_AB_NODE_FARM = 2, + BG_AB_NODE_LUMBER_MILL = 3, + BG_AB_NODE_GOLD_MINE = 4, + + BG_AB_DYNAMIC_NODES_COUNT = 5, // dynamic nodes that can be captured + + BG_AB_SPIRIT_ALIANCE = 5, + BG_AB_SPIRIT_HORDE = 6, + + BG_AB_ALL_NODES_COUNT = 7, // all nodes (dynamic and static) +}; + +enum BG_AB_NodeStatus +{ + BG_AB_NODE_TYPE_NEUTRAL = 0, + BG_AB_NODE_TYPE_CONTESTED = 1, + BG_AB_NODE_STATUS_ALLY_CONTESTED = 1, + BG_AB_NODE_STATUS_HORDE_CONTESTED = 2, + BG_AB_NODE_TYPE_OCCUPIED = 3, + BG_AB_NODE_STATUS_ALLY_OCCUPIED = 3, + BG_AB_NODE_STATUS_HORDE_OCCUPIED = 4 +}; + +enum BG_AB_Sounds +{ + BG_AB_SOUND_NODE_CLAIMED = 8192, + BG_AB_SOUND_NODE_CAPTURED_ALLIANCE = 8173, + BG_AB_SOUND_NODE_CAPTURED_HORDE = 8213, + BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE = 8212, + BG_AB_SOUND_NODE_ASSAULTED_HORDE = 8174, + BG_AB_SOUND_NEAR_VICTORY = 8456 +}; + +#define BG_AB_NotABBGWeekendHonorTicks 330 +#define BG_AB_ABBGWeekendHonorTicks 200 +#define BG_AB_NotABBGWeekendReputationTicks 200 +#define BG_AB_ABBGWeekendReputationTicks 150 + +// x, y, z, o +const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { + {1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables + {977.0156f, 1046.616f, -44.80923f, -2.600541f}, // blacksmith + {806.1821f, 874.2723f, -55.99371f, -2.303835f}, // farm + {856.1419f, 1148.902f, 11.18469f, -2.303835f}, // lumber mill + {1146.923f, 848.1782f, -110.917f, -0.7330382f} // gold mine +}; + +// x, y, z, o, rot0, rot1, rot2, rot3 +const float BG_AB_DoorPositions[2][8] = { + {1284.597f, 1281.167f, -15.97792f, 0.7068594f, 0.012957f, -0.060288f, 0.344959f, 0.93659f}, + {708.0903f, 708.4479f, -17.8342f, -2.391099f, 0.050291f, 0.015127f, 0.929217f, -0.365784f} +}; + +// Tick intervals and given points: case 0,1,2,3,4,5 captured nodes +const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000}; +const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30}; + +// WorldSafeLocs ids for 5 nodes, and for ally, and horde starting location +const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899}; + +// x, y, z, o +const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = { + {1185.71f, 1185.24f, -56.36f, 2.56f}, // stables + {990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith + {817.66f, 843.34f, -56.54f, 3.01f}, // farm + {807.46f, 1189.16f, 11.92f, 5.44f}, // lumber mill + {1146.62f, 816.94f, -98.49f, 6.14f} // gold mine +}; + +// x, y, z, o +const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = { + {1200.03f, 1171.09f, -56.47f, 5.15f}, // stables + {1017.43f, 960.61f, -42.95f, 4.88f}, // blacksmith + {833.00f, 793.00f, -57.25f, 5.27f}, // farm + {775.17f, 1206.40f, 15.79f, 1.90f}, // lumber mill + {1207.48f, 787.00f, -83.36f, 5.51f}, // gold mine + {1354.05f, 1275.48f, -11.30f, 4.77f}, // alliance starting base + {714.61f, 646.15f, -10.87f, 4.34f} // horde starting base +}; + +struct BG_AB_BannerTimer +{ + uint32 timer; + uint8 type; + uint8 teamIndex; +}; + +class BattleGroundABScore : public BattleGroundScore +{ + public: + BattleGroundABScore(): BasesAssaulted(0), BasesDefended(0) {}; + virtual ~BattleGroundABScore() {}; + uint32 BasesAssaulted; + uint32 BasesDefended; +}; + +class BattleGroundAB : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundAB(); + ~BattleGroundAB(); + + void Update(uint32 diff); + void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + void RemovePlayer(Player *plr,uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + virtual bool SetupBattleGround(); + virtual void Reset(); + void EndBattleGround(uint32 winner); + virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + + /* Scorekeeping */ + virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + + virtual void FillInitialWorldStates(WorldPacket& data); + + /* Nodes occupying */ + virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); + + /* achievement req. */ + bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited + bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; } + private: + /* Gameobject spawning/despawning */ + void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay); + void _DelBanner(uint8 node, uint8 type, uint8 teamIndex); + void _SendNodeUpdate(uint8 node); + + /* Creature spawning/despawning */ + // TODO: working, scripted peons spawning + void _NodeOccupied(uint8 node,Team team); + void _NodeDeOccupied(uint8 node); + + int32 _GetNodeNameId(uint8 node); + + /* Nodes info: + 0: neutral + 1: ally contested + 2: horde contested + 3: ally occupied + 4: horde occupied */ + uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]; + uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]; + BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]; + uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]; + uint32 m_lastTick[BG_TEAMS_COUNT]; + uint32 m_HonorScoreTics[BG_TEAMS_COUNT]; + uint32 m_ReputationScoreTics[BG_TEAMS_COUNT]; + bool m_IsInformedNearVictory; + uint32 m_HonorTics; + uint32 m_ReputationTics; + // need for achievements + bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]; +}; +#endif + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundAV.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundAV.cpp new file mode 100644 index 0000000..b477d67 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundAV.cpp @@ -0,0 +1,1490 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ObjectMgr.h" +#include "WorldPacket.h" + +#include "BattleGround.h" +#include "BattleGroundAV.h" +#include "Miscellaneous/Formulas.h" +#include "GameObject.h" +#include "Miscellaneous/Language.h" +#include "Player.h" +#include "SpellAuras.h" + +BattleGroundAV::BattleGroundAV() +{ + m_BgObjects.resize(BG_AV_OBJECT_MAX); + m_BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX); + + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; +} + +BattleGroundAV::~BattleGroundAV() +{ +} + +const uint16 BattleGroundAV::GetBonusHonor(uint8 kills) //TODO: move this function to Battleground.cpp (needs to find a way to get m_MaxLevel) +{ + return Trinity::Honor::hk_honor_at_level(m_MaxLevel, kills); +} + +void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + BattleGround::HandleKillPlayer(player, killer); + UpdateScore(player->GetTeam(),-1); +} + +void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer) +{ + sLog.outDebug("bg_av HandleKillUnit %i",unit->GetEntry()); + if (GetStatus() != STATUS_IN_PROGRESS) + return; + uint32 entry = unit->GetEntry(); + /* + uint32 triggerSpawnID = 0; + if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0]) + triggerSpawnID = AV_CPLACE_TRIGGER16; + else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0]) + triggerSpawnID = AV_CPLACE_TRIGGER17; + else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0]) + triggerSpawnID = AV_CPLACE_TRIGGER18; + else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0]) + triggerSpawnID = AV_CPLACE_TRIGGER19; + */ + if (entry == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0]) + { + CastSpellOnTeam(23658,HORDE); //this is a spell which finishes a quest where a player has to kill the boss + RewardReputationToTeam(729,BG_AV_REP_BOSS,HORDE); + RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),HORDE); + EndBattleGround(HORDE); + DelCreature(AV_CPLACE_TRIGGER17); + } + else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0]) + { + CastSpellOnTeam(23658,ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss + RewardReputationToTeam(730,BG_AV_REP_BOSS,ALLIANCE); + RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),ALLIANCE); + EndBattleGround(ALLIANCE); + DelCreature(AV_CPLACE_TRIGGER19); + } + else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0]) + { + if (!m_CaptainAlive[0]) + { + sLog.outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); + return; + } + m_CaptainAlive[0]=false; + RewardReputationToTeam(729,BG_AV_REP_CAPTAIN,HORDE); + RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_CAPTAIN),HORDE); + UpdateScore(ALLIANCE,(-1)*BG_AV_RES_CAPTAIN); + //spawn destroyed aura + for (uint8 i=0; i <= 9; i++) + SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+i,RESPAWN_IMMEDIATELY); + Creature* creature = GetBGCreature(AV_CPLACE_HERALD); + if (creature) + YellToAll(creature,GetTrinityString(LANG_BG_AV_A_CAPTAIN_DEAD),LANG_UNIVERSAL); + DelCreature(AV_CPLACE_TRIGGER16); + } + else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0]) + { + if (!m_CaptainAlive[1]) + { + sLog.outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); + return; + } + m_CaptainAlive[1]=false; + RewardReputationToTeam(730,BG_AV_REP_CAPTAIN,ALLIANCE); + RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_CAPTAIN),ALLIANCE); + UpdateScore(HORDE,(-1)*BG_AV_RES_CAPTAIN); + //spawn destroyed aura + for (uint8 i=0; i <= 9; i++) + SpawnBGObject(BG_AV_OBJECT_BURN_BUILDING_HORDE+i,RESPAWN_IMMEDIATELY); + Creature* creature = GetBGCreature(AV_CPLACE_HERALD); + if (creature) + YellToAll(creature,GetTrinityString(LANG_BG_AV_H_CAPTAIN_DEAD),LANG_UNIVERSAL); + DelCreature(AV_CPLACE_TRIGGER18); + } + else if (entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4][0]) + ChangeMineOwner(AV_NORTH_MINE,killer->GetTeam()); + else if (entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_N_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_A_4][0] || entry == BG_AV_CreatureInfo[AV_NPC_S_MINE_H_4][0]) + ChangeMineOwner(AV_SOUTH_MINE,killer->GetTeam()); +} + +void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return;//maybe we should log this, cause this must be a cheater or a big bug + uint8 team = GetTeamIndexByTeamId(player->GetTeam()); + //TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor + sLog.outDebug("BG_AV Quest %i completed",questid); + switch(questid) + { + case AV_QUEST_A_SCRAPS1: + case AV_QUEST_A_SCRAPS2: + case AV_QUEST_H_SCRAPS1: + case AV_QUEST_H_SCRAPS2: + m_Team_QuestStatus[team][0]+=20; + if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25,50,75 turn ins + { + sLog.outDebug("BG_AV Quest %i completed starting with unit upgrading..",questid); + for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) + if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED) + { + DePopulateNode(i); + PopulateNode(i); + //maybe this is bad, because it will instantly respawn all creatures on every grave.. + } + } + break; + case AV_QUEST_A_COMMANDER1: + case AV_QUEST_H_COMMANDER1: + m_Team_QuestStatus[team][1]++; + RewardReputationToTeam(team,1,player->GetTeam()); + if (m_Team_QuestStatus[team][1] == 30) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + break; + case AV_QUEST_A_COMMANDER2: + case AV_QUEST_H_COMMANDER2: + m_Team_QuestStatus[team][2]++; + RewardReputationToTeam(team,1,player->GetTeam()); + if (m_Team_QuestStatus[team][2] == 60) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + break; + case AV_QUEST_A_COMMANDER3: + case AV_QUEST_H_COMMANDER3: + m_Team_QuestStatus[team][3]++; + RewardReputationToTeam(team,1,player->GetTeam()); + if (m_Team_QuestStatus[team][1] == 120) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + break; + case AV_QUEST_A_BOSS1: + case AV_QUEST_H_BOSS1: + m_Team_QuestStatus[team][4] += 9; //you can turn in 10 or 1 item.. + case AV_QUEST_A_BOSS2: + case AV_QUEST_H_BOSS2: + m_Team_QuestStatus[team][4]++; + if (m_Team_QuestStatus[team][4] >= 200) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + break; + case AV_QUEST_A_NEAR_MINE: + case AV_QUEST_H_NEAR_MINE: + m_Team_QuestStatus[team][5]++; + if (m_Team_QuestStatus[team][5] == 28) + { + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + if (m_Team_QuestStatus[team][6] == 7) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - ground assault ready",questid); + } + break; + case AV_QUEST_A_OTHER_MINE: + case AV_QUEST_H_OTHER_MINE: + m_Team_QuestStatus[team][6]++; + if (m_Team_QuestStatus[team][6] == 7) + { + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + if (m_Team_QuestStatus[team][5] == 20) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - ground assault ready",questid); + } + break; + case AV_QUEST_A_RIDER_HIDE: + case AV_QUEST_H_RIDER_HIDE: + m_Team_QuestStatus[team][7]++; + if (m_Team_QuestStatus[team][7] == 25) + { + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + if (m_Team_QuestStatus[team][8] == 25) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - rider assault ready",questid); + } + break; + case AV_QUEST_A_RIDER_TAME: + case AV_QUEST_H_RIDER_TAME: + m_Team_QuestStatus[team][8]++; + if (m_Team_QuestStatus[team][8] == 25) + { + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here",questid); + if (m_Team_QuestStatus[team][7] == 25) + sLog.outDebug("BG_AV Quest %i completed (need to implement some events here - rider assault ready",questid); + } + break; + default: + sLog.outDebug("BG_AV Quest %i completed but is not interesting at all",questid); + return; //was no interesting quest at all + break; + } +} + +void BattleGroundAV::UpdateScore(uint16 team, int16 points) +{ //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive + assert(team == ALLIANCE || team == HORDE); + uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde + m_Team_Scores[teamindex] += points; + + UpdateWorldState(((teamindex == BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]); + if (points < 0) + { + if (m_Team_Scores[teamindex] < 1) + { + m_Team_Scores[teamindex]=0; + EndBattleGround(((teamindex == BG_TEAM_HORDE)?ALLIANCE:HORDE)); + } + else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE) + { + SendMessageToAll(teamindex == BG_TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex == BG_TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE); + PlaySoundToAll(AV_SOUND_NEAR_VICTORY); + m_IsInformedNearVictory[teamindex] = true; + } + } +} + +Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type) +{ + uint8 level; + bool isStatic = false; + Creature* creature = NULL; + assert(type <= AV_CPLACE_MAX + AV_STATICCPLACE_MAX); + if (type >= AV_CPLACE_MAX) //static + { + type -= AV_CPLACE_MAX; + cinfoid=uint16(BG_AV_StaticCreaturePos[type][4]); + creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0],(type+AV_CPLACE_MAX),BG_AV_StaticCreatureInfo[cinfoid][1],BG_AV_StaticCreaturePos[type][0],BG_AV_StaticCreaturePos[type][1],BG_AV_StaticCreaturePos[type][2],BG_AV_StaticCreaturePos[type][3]); + level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3]) ? BG_AV_StaticCreatureInfo[cinfoid][2] : urand(BG_AV_StaticCreatureInfo[cinfoid][2],BG_AV_StaticCreatureInfo[cinfoid][3]); + isStatic = true; + } + else + { + creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0],type,BG_AV_CreatureInfo[cinfoid][1],BG_AV_CreaturePos[type][0],BG_AV_CreaturePos[type][1],BG_AV_CreaturePos[type][2],BG_AV_CreaturePos[type][3]); + level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3]) ? BG_AV_CreatureInfo[cinfoid][2] : urand(BG_AV_CreatureInfo[cinfoid][2],BG_AV_CreatureInfo[cinfoid][3]); + } + if (!creature) + return NULL; + if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0] || creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0]) + creature->SetRespawnDelay(RESPAWN_ONE_DAY); // TODO: look if this can be done by database + also add this for the wingcommanders + + if ((isStatic && cinfoid >= 10 && cinfoid <= 14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) || + (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))) + { + if (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) + || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))) + { + CreatureData &data = objmgr.NewOrExistCreatureData(creature->GetDBTableGUIDLow()); + data.spawndist = 5; + } + //else spawndist will be 15, so creatures move maximum=10 + //creature->SetDefaultMovementType(RANDOM_MOTION_TYPE); + creature->GetMotionMaster()->Initialize(); + creature->setDeathState(JUST_DIED); + creature->Respawn(); + //TODO: find a way to add a motionmaster without killing the creature (i + //just copied this code from a gm-command + } + + if (level != 0) + level += m_MaxLevel - 60; //maybe we can do this more generic for custom level-range.. actually it's blizzlike + creature->SetLevel(level); + + uint32 triggerSpawnID = 0; + uint32 newFaction = 0; + if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0]) + { + triggerSpawnID = AV_CPLACE_TRIGGER16; + newFaction = 84; + } + else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS][0]) + { + triggerSpawnID = AV_CPLACE_TRIGGER17; + newFaction = 84; + } + else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN][0]) + { + triggerSpawnID = AV_CPLACE_TRIGGER18; + newFaction = 83; + } + else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0]) + { + triggerSpawnID = AV_CPLACE_TRIGGER19; + newFaction = 83; + } + if (triggerSpawnID && newFaction) + { + if (Creature* trigger = AddCreature(WORLD_TRIGGER,triggerSpawnID,BG_AV_CreatureInfo[creature->GetEntry()][1],BG_AV_CreaturePos[triggerSpawnID][0],BG_AV_CreaturePos[triggerSpawnID][1],BG_AV_CreaturePos[triggerSpawnID][2],BG_AV_CreaturePos[triggerSpawnID][3])) + { + trigger->setFaction(newFaction); + trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false); + } + } + + return creature; +} + +void BattleGroundAV::Update(uint32 diff) +{ + BattleGround::Update(diff); + + if (GetStatus() == STATUS_IN_PROGRESS) + { + for (uint8 i=0; i <= 1; i++)//0=alliance, 1=horde + { + if (!m_CaptainAlive[i]) + continue; + if (m_CaptainBuffTimer[i] > diff) + m_CaptainBuffTimer[i] -= diff; + else + { + if (i == 0) + { + CastSpellOnTeam(AV_BUFF_A_CAPTAIN,ALLIANCE); + Creature* creature = GetBGCreature(AV_CPLACE_MAX + 61); + if (creature) + YellToAll(creature,LANG_BG_AV_A_CAPTAIN_BUFF,LANG_COMMON); + } + else + { + CastSpellOnTeam(AV_BUFF_H_CAPTAIN,HORDE); + Creature* creature = GetBGCreature(AV_CPLACE_MAX + 59); //TODO: make the captains a dynamic creature + if (creature) + YellToAll(creature,LANG_BG_AV_H_CAPTAIN_BUFF,LANG_ORCISH); + } + m_CaptainBuffTimer[i] = 120000 + urand(0,4)* 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times + } + } + //add points from mine owning, and look if he neutral team wanrts to reclaim the mine + m_Mine_Timer -=diff; + for (uint8 mine=0; mine <2; mine++) + { + if (m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE) + { + if (m_Mine_Timer <= 0) + UpdateScore(m_Mine_Owner[mine],1); + + if (m_Mine_Reclaim_Timer[mine] > diff) + m_Mine_Reclaim_Timer[mine] -= diff; + else{ //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0 + ChangeMineOwner(mine,AV_NEUTRAL_TEAM); + } + } + } + if (m_Mine_Timer <= 0) + m_Mine_Timer=AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines + + //looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team + for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this + { + if (m_Nodes[i].Timer > diff) + m_Nodes[i].Timer -= diff; + else + EventPlayerDestroyedPoint(i); + } + } +} + +void BattleGroundAV::StartingEventCloseDoors() +{ + DoorClose(BG_AV_OBJECT_DOOR_A); + DoorClose(BG_AV_OBJECT_DOOR_H); +} + +void BattleGroundAV::StartingEventOpenDoors() +{ + sLog.outDebug("BG_AV: start spawning mine stuff"); + for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_N_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_N_MAX; i++) + SpawnBGObject(i,RESPAWN_IMMEDIATELY); + for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_S_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_S_MAX; i++) + SpawnBGObject(i,RESPAWN_IMMEDIATELY); + for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population + ChangeMineOwner(mine, AV_NEUTRAL_TEAM,true); + + UpdateWorldState(AV_SHOW_H_SCORE, 1); + UpdateWorldState(AV_SHOW_A_SCORE, 1); + + DoorOpen(BG_AV_OBJECT_DOOR_H); + DoorOpen(BG_AV_OBJECT_DOOR_A); +} + +void BattleGroundAV::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundAVScore* sc = new BattleGroundAVScore; + m_PlayerScores[plr->GetGUID()] = sc; + if (m_MaxLevel == 0) + m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information.. + +} + +void BattleGroundAV::EndBattleGround(uint32 winner) +{ + //calculate bonuskills for both teams: + //first towers: + uint8 kills[2]={0,0}; //0=ally 1=horde + uint8 rep[2]={0,0}; //0=ally 1=horde + for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) + { + if (m_Nodes[i].State == POINT_CONTROLED) + { + if (m_Nodes[i].Owner == ALLIANCE) + { + rep[0] += BG_AV_REP_SURVIVING_TOWER; + kills[0] += BG_AV_KILL_SURVIVING_TOWER; + } + else + { + rep[0] += BG_AV_KILL_SURVIVING_TOWER; + kills[1] += BG_AV_KILL_SURVIVING_TOWER; + } + } + } + + for (int i=0; i <= 1; i++) //0=ally 1=horde + { + if (m_CaptainAlive[i]) + { + kills[i] += BG_AV_KILL_SURVIVING_CAPTAIN; + rep[i] += BG_AV_REP_SURVIVING_CAPTAIN; + } + if (rep[i] != 0) + RewardReputationToTeam((i == 0)?730:729,rep[i],(i == 0)?ALLIANCE:HORDE); + if (kills[i] != 0) + RewardHonorToTeam(GetBonusHonor(kills[i]),(i == 0)?ALLIANCE:HORDE); + } + + //TODO add enterevademode for all attacking creatures + BattleGround::EndBattleGround(winner); +} + +void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/) +{ + if (!plr) + { + sLog.outError("bg_AV no player at remove"); + return; + } + //TODO search more buffs + plr->RemoveAurasDueToSpell(AV_BUFF_ARMOR); + plr->RemoveAurasDueToSpell(AV_BUFF_A_CAPTAIN); + plr->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN); +} + +void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + uint32 SpellId = 0; + switch(Trigger) + { + case 95: + case 2608: + if (Source->GetTeam() != ALLIANCE) + Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal"); + else + Source->LeaveBattleground(); + break; + case 2606: + if (Source->GetTeam() != HORDE) + Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal"); + else + Source->LeaveBattleground(); + break; + case 3326: + case 3327: + case 3328: + case 3329: + case 3330: + case 3331: + //Source->Unmount(); + break; + default: + sLog.outDebug("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); +// Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } + + if (SpellId) + Source->CastSpell(Source, SpellId, true); +} + +void BattleGroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) +{ + + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + if (itr == m_PlayerScores.end()) // player not found... + return; + + switch(type) + { + case SCORE_GRAVEYARDS_ASSAULTED: + ((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted += value; + break; + case SCORE_GRAVEYARDS_DEFENDED: + ((BattleGroundAVScore*)itr->second)->GraveyardsDefended += value; + break; + case SCORE_TOWERS_ASSAULTED: + ((BattleGroundAVScore*)itr->second)->TowersAssaulted += value; + break; + case SCORE_TOWERS_DEFENDED: + ((BattleGroundAVScore*)itr->second)->TowersDefended += value; + break; + case SCORE_MINES_CAPTURED: + ((BattleGroundAVScore*)itr->second)->MinesCaptured += value; + break; + case SCORE_LEADERS_KILLED: + ((BattleGroundAVScore*)itr->second)->LeadersKilled += value; + break; + case SCORE_SECONDARY_OBJECTIVES: + ((BattleGroundAVScore*)itr->second)->SecondaryObjectives += value; + break; + default: + BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor); + break; + } +} + +void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) +{ + + uint32 object = GetObjectThroughNode(node); + sLog.outDebug("bg_av: player destroyed point node %i object %i",node,object); + + //despawn banner + SpawnBGObject(object, RESPAWN_ONE_DAY); + DestroyNode(node); + UpdateNodeWorldState(node); + + uint32 owner = m_Nodes[node].Owner; + if (IsTower(node)) + { + uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH; + //despawn marshal + if (m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp]) + DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp); + else + sLog.outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist",AV_CPLACE_A_MARSHAL_SOUTH + tmp); + //spawn destroyed aura + for (uint8 i=0; i <= 9; i++) + SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10),RESPAWN_IMMEDIATELY); + + UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, (-1)*BG_AV_RES_TOWER); + RewardReputationToTeam((owner == ALLIANCE)?730:729,BG_AV_REP_TOWER,owner); + RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER),owner); + + SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp),RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp),RESPAWN_ONE_DAY); + } + else + { + if (owner == ALLIANCE) + SpawnBGObject(object-11, RESPAWN_IMMEDIATELY); + else + SpawnBGObject(object+11, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node,RESPAWN_IMMEDIATELY); + PopulateNode(node); + if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy + { + for (uint8 i = 0; i < 4; i++) + { + SpawnBGObject(((owner == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i,RESPAWN_ONE_DAY); + SpawnBGObject(((owner == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i,RESPAWN_IMMEDIATELY); + } + } + } + //send a nice message to all :) + char buf[256]; + if (IsTower(node)) + sprintf(buf, GetTrinityString(LANG_BG_AV_TOWER_TAKEN) , GetNodeName(node),(owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + else + sprintf(buf, GetTrinityString(LANG_BG_AV_GRAVE_TAKEN) , GetNodeName(node),(owner == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) :GetTrinityString(LANG_BG_AV_HORDE)); + + Creature* creature = GetBGCreature(AV_CPLACE_HERALD); + if (creature) + YellToAll(creature,buf,LANG_UNIVERSAL); +} + +void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) +{ //mine=0 northmine mine=1 southmin +//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them + assert(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE); + if (team != ALLIANCE && team != HORDE) + team = AV_NEUTRAL_TEAM; + else + PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD); + + if (m_Mine_Owner[mine] == team && !initial) + return; + m_Mine_PrevOwner[mine] = m_Mine_Owner[mine]; + m_Mine_Owner[mine] = team; + + if (!initial) + { + sLog.outDebug("bg_av depopulating mine %i (0=north,1=south)",mine); + if (mine == AV_SOUTH_MINE) + for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++) + if (m_BgCreatures[i]) + DelCreature(i); //TODO just set the respawntime to 999999 + for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++) + if (m_BgCreatures[i]) + DelCreature(i); //TODO here also + } + SendMineWorldStates(mine); + + sLog.outDebug("bg_av populating mine %i (0=north,1=south)",mine); + uint16 miner; + //also neutral team exists.. after a big time, the neutral team tries to conquer the mine + if (mine == AV_NORTH_MINE) + { + if (team == ALLIANCE) + miner = AV_NPC_N_MINE_A_1; + else if (team == HORDE) + miner = AV_NPC_N_MINE_H_1; + else + miner = AV_NPC_N_MINE_N_1; + } + else + { + uint16 cinfo; + if (team == ALLIANCE) + miner = AV_NPC_S_MINE_A_1; + else if (team == HORDE) + miner = AV_NPC_S_MINE_H_1; + else + miner = AV_NPC_S_MINE_N_1; + //vermin + sLog.outDebug("spawning vermin"); + if (team == ALLIANCE) + cinfo = AV_NPC_S_MINE_A_3; + else if (team == HORDE) + cinfo = AV_NPC_S_MINE_H_3; + else + cinfo = AV_NPC_S_MINE_N_S; + for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++) + AddAVCreature(cinfo,i); + } + for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MAX:AV_CPLACE_MINE_S_1_MAX); i++) + AddAVCreature(miner,i); + //the next chooses randomly between 2 cretures + for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MIN:AV_CPLACE_MINE_S_2_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MAX:AV_CPLACE_MINE_S_2_MAX); i++) + AddAVCreature(miner+(urand(1,2)),i); + AddAVCreature(miner+3,(mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); + //because the gameobjects in this mine have changed, update all surrounding players: +// for (uint16 i = ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MIN:BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i <= ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MAX:BG_AV_OBJECT_MINE_SUPPLY_N_MAX); i++) +// { + //TODO: add gameobject-update code +// } + if (team == ALLIANCE || team == HORDE) + { + m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER; + char buf[256]; + sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + Creature* creature = GetBGCreature(AV_CPLACE_HERALD); + if (creature) + YellToAll(creature,buf,LANG_UNIVERSAL); + } + else + { + if (mine == AV_SOUTH_MINE) //i think this gets called all the time + { + Creature* creature = GetBGCreature(AV_CPLACE_MINE_S_3); + YellToAll(creature,LANG_BG_AV_S_MINE_BOSS_CLAIMS,LANG_UNIVERSAL); + } + } + return; +} + +bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team) +{ + if (GOId == BG_AV_OBJECTID_MINE_N) + return (m_Mine_Owner[AV_NORTH_MINE] == team); + if (GOId == BG_AV_OBJECTID_MINE_S) + return (m_Mine_Owner[AV_SOUTH_MINE] == team); + return true; //cause it's no mine'object it is ok if this is true +} + +void BattleGroundAV::PopulateNode(BG_AV_Nodes node) +{ + uint32 owner = m_Nodes[node].Owner; + assert(owner); + + uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node); + uint32 creatureid; + if (IsTower(node)) + creatureid=(owner == ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE; + else + { + uint8 team2 = GetTeamIndexByTeamId(owner); + if (m_Team_QuestStatus[team2][0] < 500) + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0; + else if (m_Team_QuestStatus[team2][0] < 1000) + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1; + else if (m_Team_QuestStatus[team2][0] < 1500) + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2; + else + creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3; + //spiritguide + if (m_BgCreatures[node]) + DelCreature(node); + if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) + sLog.outError("AV: couldn't spawn spiritguide at node %i",node); + + } + for (uint8 i=0; i<4; i++) + AddAVCreature(creatureid,c_place+i); + + if (node >= BG_AV_NODES_MAX)//fail safe + return; + Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures + if (!trigger) + trigger = AddCreature(WORLD_TRIGGER,node + 302,owner,BG_AV_CreaturePos[node + 302][0],BG_AV_CreaturePos[node + 302][1],BG_AV_CreaturePos[node + 302][2],BG_AV_CreaturePos[node + 302][3]); + + //add bonus honor aura trigger creature when node is accupied + //cast bonus aura (+50% honor in 25yards) + //aura should only apply to players who have accupied the node, set correct faction for trigger + if (trigger) + { + if (owner != ALLIANCE && owner != HORDE)//node can be neutral, remove trigger + { + DelCreature(node + 302); + return; + } + trigger->setFaction(owner == ALLIANCE ? 84 : 83); + trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false); + } +} +void BattleGroundAV::DePopulateNode(BG_AV_Nodes node) +{ + uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node); + for (uint8 i=0; i<4; i++) + if (m_BgCreatures[c_place+i]) + DelCreature(c_place+i); + //spiritguide + if (!IsTower(node) && m_BgCreatures[node]) + DelCreature(node); + + //remove bonus honor aura trigger creature when node is lost + if(node < BG_AV_NODES_MAX)//fail safe + DelCreature(node + 302);//NULL checks are in DelCreature! 0-302 spirit guides +} + +const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object) +{ + sLog.outDebug("bg_AV getnodethroughobject %i",object); + if (object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER) + return BG_AV_Nodes(object); + if (object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT) + return BG_AV_Nodes(object - 11); + if (object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER) + return BG_AV_Nodes(object - 7); + if (object <= BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER) + return BG_AV_Nodes(object -22); + if (object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT) + return BG_AV_Nodes(object - 33); + if (object <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER) + return BG_AV_Nodes(object - 29); + if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) + return BG_AV_NODES_SNOWFALL_GRAVE; + sLog.outError("BattleGroundAV: ERROR! GetPlace got a wrong object :("); + assert(false); + return BG_AV_Nodes(0); +} + +const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node) +{ //this function is the counterpart to GetNodeThroughObject() + sLog.outDebug("bg_AV GetObjectThroughNode %i",node); + if (m_Nodes[node].Owner == ALLIANCE) + { + if (m_Nodes[node].State == POINT_ASSAULTED) + { + if (node <= BG_AV_NODES_FROSTWOLF_HUT) + return node+11; + if (node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER) + return node+7; + } + else if (m_Nodes[node].State == POINT_CONTROLED) + if (node <= BG_AV_NODES_STONEHEART_BUNKER) + return node; + } + else if (m_Nodes[node].Owner == HORDE) + { + if (m_Nodes[node].State == POINT_ASSAULTED) + if (node <= BG_AV_NODES_STONEHEART_BUNKER) + return node+22; + else if (m_Nodes[node].State == POINT_CONTROLED) + { + if (node <= BG_AV_NODES_FROSTWOLF_HUT) + return node+33; + if (node >= BG_AV_NODES_ICEBLOOD_TOWER && node <= BG_AV_NODES_FROSTWOLF_WTOWER) + return node+29; + } + } + else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM) + return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; + sLog.outError("BattleGroundAV: Error! GetPlaceNode couldn't resolve node %i",node); + assert(false); + return 0; +} + +//called when using banner + +void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + int32 object = GetObjectType(target_obj->GetGUID()); + sLog.outDebug("BG_AV using gameobject %i with type %i",target_obj->GetEntry(),object); + if (object < 0) + return; + switch(target_obj->GetEntry()) + { + case BG_AV_OBJECTID_BANNER_A: + case BG_AV_OBJECTID_BANNER_A_B: + case BG_AV_OBJECTID_BANNER_H: + case BG_AV_OBJECTID_BANNER_H_B: + case BG_AV_OBJECTID_BANNER_SNOWFALL_N: + EventPlayerAssaultsPoint(source, object); + break; + case BG_AV_OBJECTID_BANNER_CONT_A: + case BG_AV_OBJECTID_BANNER_CONT_A_B: + case BG_AV_OBJECTID_BANNER_CONT_H: + case BG_AV_OBJECTID_BANNER_CONT_H_B: + EventPlayerDefendsPoint(source, object); + break; + default: + break; + } +} + +void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) +{ + assert(GetStatus() == STATUS_IN_PROGRESS); + BG_AV_Nodes node = GetNodeThroughObject(object); + + uint32 owner = m_Nodes[node].Owner; //maybe should name it prevowner + uint32 team = player->GetTeam(); + + if (owner == player->GetTeam() || m_Nodes[node].State != POINT_ASSAULTED) + return; + if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) + { //until snowfall doesn't belong to anyone it is better handled in assault-code + assert(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave + EventPlayerAssaultsPoint(player,object); + return; + } + sLog.outDebug("player defends point object: %i node: %i",object,node); + if (m_Nodes[node].PrevOwner != team) + { + sLog.outError("BG_AV: player defends point which doesn't belong to his team %i",node); + return; + } + + //spawn new go :) + if (m_Nodes[node].Owner == ALLIANCE) + SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); //spawn horde banner + else + SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); //spawn alliance banner + + if (!IsTower(node)) + { + SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(team)+3*node,RESPAWN_IMMEDIATELY); + } + // despawn old go + SpawnBGObject(object, RESPAWN_ONE_DAY); + + DefendNode(node,team); + PopulateNode(node); + UpdateNodeWorldState(node); + + if (IsTower(node)) + { + //spawn big flag+aura on top of tower + SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + } + else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy + { + for (uint8 i = 0; i < 4; i++) + { + SpawnBGObject(((owner == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_PH)+i,RESPAWN_ONE_DAY); + SpawnBGObject(((team == ALLIANCE)?BG_AV_OBJECT_SNOW_EYECANDY_A : BG_AV_OBJECT_SNOW_EYECANDY_H)+i,RESPAWN_IMMEDIATELY); + } + } + //send a nice message to all :) + char buf[256]; + sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),(team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + Creature* creature = GetBGCreature(AV_CPLACE_HERALD); + if (creature) + YellToAll(creature,buf,LANG_UNIVERSAL); + //update the statistic for the defending player + UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1); + if (IsTower(node)) + PlaySoundToAll(AV_SOUND_BOTH_TOWER_DEFEND); + else + PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD); +} + +void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) +{ + assert(GetStatus() == STATUS_IN_PROGRESS); + + BG_AV_Nodes node = GetNodeThroughObject(object); + uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner + uint32 team = player->GetTeam(); + sLog.outDebug("bg_av: player assaults point object %i node %i",object,node); + if (owner == team || team == m_Nodes[node].TotalOwner) + return; //surely a gm used this object + + if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff + { + if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping + { + assert(owner == AV_NEUTRAL_TEAM && m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM); + if (team == ALLIANCE) + SpawnBGObject(BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY); + else + SpawnBGObject(BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_IMMEDIATELY); //neutral aura spawn + } + else if (m_Nodes[node].TotalOwner == AV_NEUTRAL_TEAM) //recapping, when no team owns this node realy + { + assert(m_Nodes[node].State != POINT_CONTROLED); + if (team == ALLIANCE) + SpawnBGObject(object-11, RESPAWN_IMMEDIATELY); + else + SpawnBGObject(object+11, RESPAWN_IMMEDIATELY); + } + //eyecandy + uint32 spawn,despawn; + if (team == ALLIANCE) + { + despawn = (m_Nodes[node].State == POINT_ASSAULTED)?BG_AV_OBJECT_SNOW_EYECANDY_PH : BG_AV_OBJECT_SNOW_EYECANDY_H; + spawn = BG_AV_OBJECT_SNOW_EYECANDY_PA; + } + else + { + despawn = (m_Nodes[node].State == POINT_ASSAULTED)?BG_AV_OBJECT_SNOW_EYECANDY_PA : BG_AV_OBJECT_SNOW_EYECANDY_A; + spawn = BG_AV_OBJECT_SNOW_EYECANDY_PH; + } + for (uint8 i = 0; i < 4; i++) + { + SpawnBGObject(despawn+i,RESPAWN_ONE_DAY); + SpawnBGObject(spawn+i,RESPAWN_IMMEDIATELY); + } + } + + //if snowfall gots capped it can be handled like all other graveyards + if (m_Nodes[node].TotalOwner != AV_NEUTRAL_TEAM) + { + assert(m_Nodes[node].Owner != AV_NEUTRAL_TEAM); + if (team == ALLIANCE) + SpawnBGObject(object-22, RESPAWN_IMMEDIATELY); + else + SpawnBGObject(object+22, RESPAWN_IMMEDIATELY); + if (IsTower(node)) + { //spawning/despawning of bigflag+aura + SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == ALLIANCE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + SpawnBGObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(node-BG_AV_NODES_DUNBALDAR_SOUTH)),(team == HORDE)? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); + } + else + { + //spawning/despawning of aura + SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node,RESPAWN_IMMEDIATELY); //neutral aura spawn + SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node,RESPAWN_ONE_DAY); //teeamaura despawn + // Those who are waiting to resurrect at this object are taken to the closest own object's graveyard + std::vector ghost_list = m_ReviveQueue[m_BgCreatures[node]]; + if (!ghost_list.empty()) + { + Player *plr; + WorldSafeLocsEntry const *ClosestGrave = NULL; + for (std::vector::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) + { + plr = objmgr.GetPlayer(*ghost_list.begin()); + if (!plr) + continue; + if (!ClosestGrave) + ClosestGrave = GetClosestGraveYard(plr); + else + plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation()); + } + m_ReviveQueue[m_BgCreatures[node]].clear(); + } + } + DePopulateNode(node); + } + + SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner + AssaultNode(node,team); + UpdateNodeWorldState(node); + + //send a nice message to all :) + char buf[256]; + sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE)); + Creature* creature = GetBGCreature(AV_CPLACE_HERALD); + if (creature) + YellToAll(creature,buf,LANG_UNIVERSAL); + //update the statistic for the assaulting player + UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1); + PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS); +} + +void BattleGroundAV::FillInitialWorldStates(WorldPacket& data) +{ + bool stateok; + //graveyards + for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; i++) + { + for (uint8 j =1; j <= 3; j+=2) + {//j=1=assaulted j=3=controled + stateok = (m_Nodes[i].State == j); + data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,ALLIANCE)]) << uint32((m_Nodes[i].Owner == ALLIANCE && stateok)?1:0); + data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0); + } + } + + //towers + for (uint8 i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_MAX; i++) + for (uint8 j =1; j <= 3; j+=2) + {//j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll + stateok = (m_Nodes[i].State == j || (m_Nodes[i].State == POINT_DESTROYED && j == 3)); + data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,ALLIANCE)]) << uint32((m_Nodes[i].Owner == ALLIANCE && stateok)?1:0); + data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j,HORDE)]) << uint32((m_Nodes[i].Owner == HORDE && stateok)?1:0); + } + if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM) //cause neutral teams aren't handled generic + data << uint32(AV_SNOWFALL_N) << uint32(1); + data << uint32(AV_Alliance_Score) << uint32(m_Team_Scores[0]); + data << uint32(AV_Horde_Score) << uint32(m_Team_Scores[1]); + if (GetStatus() == STATUS_IN_PROGRESS){ //only if game started the teamscores are displayed + data << uint32(AV_SHOW_A_SCORE) << uint32(1); + data << uint32(AV_SHOW_H_SCORE) << uint32(1); + } + else + { + data << uint32(AV_SHOW_A_SCORE) << uint32(0); + data << uint32(AV_SHOW_H_SCORE) << uint32(0); + } + SendMineWorldStates(AV_NORTH_MINE); + SendMineWorldStates(AV_SOUTH_MINE); +} + +const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used for node worldstates and returns values which fit good into the worldstatesarray +{ + //neutral stuff cant get handled (currently its only snowfall) + assert(team != AV_NEUTRAL_TEAM); + //a_c a_a h_c h_a the positions in worldstate-array + if (team == ALLIANCE) + { + if (state == POINT_CONTROLED || state == POINT_DESTROYED) + return 0; + if (state == POINT_ASSAULTED) + return 1; + } + if (team == HORDE) + { + if (state == POINT_DESTROYED || state == POINT_CONTROLED) + return 2; + if (state == POINT_ASSAULTED) + return 3; + } + sLog.outError("BG_AV: should update a strange worldstate state:%i team:%i",state,team); + return 5; //this will crash the game, but i want to know if something is wrong here +} + +void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node) +{ + UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State,m_Nodes[node].Owner)],1); + if (m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node + UpdateWorldState(AV_SNOWFALL_N,0); + else + UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)],0); +} + +void BattleGroundAV::SendMineWorldStates(uint32 mine) +{ + assert(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE); +// currently i'm sure, that this works (: +// assert(m_Mine_PrevOwner[mine] == ALLIANCE || m_Mine_PrevOwner[mine] == HORDE || m_Mine_PrevOwner[mine] == AV_NEUTRAL_TEAM); +// assert(m_Mine_Owner[mine] == ALLIANCE || m_Mine_Owner[mine] == HORDE || m_Mine_Owner[mine] == AV_NEUTRAL_TEAM); + + uint8 owner,prevowner,mine2; //those variables are needed to access the right worldstate in the BG_AV_MineWorldStates array + mine2 = (mine == AV_NORTH_MINE)?0:1; + if (m_Mine_PrevOwner[mine] == ALLIANCE) + prevowner = 0; + else if (m_Mine_PrevOwner[mine] == HORDE) + prevowner = 2; + else + prevowner = 1; + if (m_Mine_Owner[mine] == ALLIANCE) + owner = 0; + else if (m_Mine_Owner[mine] == HORDE) + owner = 2; + else + owner = 1; + + UpdateWorldState(BG_AV_MineWorldStates[mine2][owner],1); + if (prevowner != owner) + UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner],0); +} + +WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player) +{ + WorldSafeLocsEntry const* pGraveyard = NULL; + WorldSafeLocsEntry const* entry = NULL; + float dist = 0; + float minDist = 0; + float x, y; + + player->GetPosition(x, y); + + pGraveyard = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[GetTeamIndexByTeamId(player->GetTeam())+7]); + minDist = (pGraveyard->x - x)*(pGraveyard->x - x)+(pGraveyard->y - y)*(pGraveyard->y - y); + + for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) + if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED) + { + entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]); + if (entry) + { + dist = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y); + if (dist < minDist) + { + minDist = dist; + pGraveyard = entry; + } + } + } + return pGraveyard; +} + +bool BattleGroundAV::SetupBattleGround() +{ + // Create starting objects + if ( + // alliance gates + !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0],BG_AV_DoorPositons[0][1],BG_AV_DoorPositons[0][2],BG_AV_DoorPositons[0][3],0,0,sin(BG_AV_DoorPositons[0][3]/2),cos(BG_AV_DoorPositons[0][3]/2),RESPAWN_IMMEDIATELY) + // horde gates + || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0],BG_AV_DoorPositons[1][1],BG_AV_DoorPositons[1][2],BG_AV_DoorPositons[1][3],0,0,sin(BG_AV_DoorPositons[1][3]/2),cos(BG_AV_DoorPositons[1][3]/2),RESPAWN_IMMEDIATELY)) + { + sLog.outErrorDb("BatteGroundAV: Failed to spawn some object BattleGround not created!1"); + return false; + } + + //spawn node-objects + for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i) + { + if (i <= BG_AV_NODES_FROSTWOLF_HUT) + { + if (!AddObject(i,BG_AV_OBJECTID_BANNER_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(i+11,BG_AV_OBJECTID_BANNER_CONT_A_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(i+33,BG_AV_OBJECTID_BANNER_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H_B,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + //aura + || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3,BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3,BG_AV_OBJECTID_AURA_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3,BG_AV_OBJECTID_AURA_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!2"); + return false; + } + } + else //towers + { + if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers + { + if (!AddObject(i,BG_AV_OBJECTID_BANNER_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(i+22,BG_AV_OBJECTID_BANNER_CONT_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_A,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_A,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_PH,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!3"); + return false; + } + } + else //horde towers + { + if (!AddObject(i+7,BG_AV_OBJECTID_BANNER_CONT_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(i+29,BG_AV_OBJECTID_BANNER_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_N,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_AURA_H,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_PA,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_H,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!4"); + return false; + } + } + for (uint8 j=0; j <= 9; j++) //burning aura + { + if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!5.%i",i); + return false; + } + } + } + } + for (uint8 i=0; i<2; i++) //burning aura for buildings + { + for (uint8 j=0; j <= 9; j++) + { + if (j<5) + { + if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_SMOKE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!6.%i",i); + return false; + } + } + else + { + if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!7.%i",i); + return false; + } + } + } + } + for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++) + { + if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,BG_AV_OBJECTID_MINE_N,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.5.%i",i); + return false; + } + } + for (uint16 i= 0 ; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++) + { + if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,BG_AV_OBJECTID_MINE_S,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.6.%i",i); + return false; + } + } + + if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!8"); + return false; + } + for (uint8 i = 0; i < 4; i++) + { + if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY) + || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)) + { + sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!9.%i",i); + return false; + } + } + + uint16 i; + sLog.outDebug("Alterac Valley: entering state STATUS_WAIT_JOIN ..."); + // Initial Nodes + for (i = 0; i < BG_AV_OBJECT_MAX; i++) + SpawnBGObject(i, RESPAWN_ONE_DAY); + for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE ; i++){ + SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+3*i,RESPAWN_IMMEDIATELY); + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + } + for (i = BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER ; i++) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ; i++){ + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + if (i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT) + SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+3*GetNodeThroughObject(i),RESPAWN_IMMEDIATELY); + } + for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i+=2) + { + SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag + SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura + } + for (i = BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER; i <= BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER; i+=2) + { + SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag + SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura + } + //snowfall and the doors + for (i = BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; i <= BG_AV_OBJECT_DOOR_A; i++) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE,RESPAWN_IMMEDIATELY); + + //creatures + sLog.outDebug("BG_AV start poputlating nodes"); + for (BG_AV_Nodes i= BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + { + if (m_Nodes[i].Owner) + PopulateNode(i); + } + //all creatures which don't get despawned through the script are static + sLog.outDebug("BG_AV: start spawning static creatures"); + for (i=0; i < AV_STATICCPLACE_MAX; i++) + AddAVCreature(0,i+AV_CPLACE_MAX); + //mainspiritguides: + sLog.outDebug("BG_AV: start spawning spiritguides creatures"); + AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE); + AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE); + //spawn the marshals (those who get deleted, if a tower gets destroyed) + sLog.outDebug("BG_AV: start spawning marshal creatures"); + for (i=AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++) + AddAVCreature(i,AV_CPLACE_A_MARSHAL_SOUTH+(i-AV_NPC_A_MARSHAL_SOUTH)); + AddAVCreature(AV_NPC_HERALD,AV_CPLACE_HERALD); + return true; +} + +const char* BattleGroundAV::GetNodeName(BG_AV_Nodes node) +{ + switch (node) + { + case BG_AV_NODES_FIRSTAID_STATION: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_STORM_AID); + case BG_AV_NODES_DUNBALDAR_SOUTH: return GetTrinityString(LANG_BG_AV_NODE_TOWER_DUN_S); + case BG_AV_NODES_DUNBALDAR_NORTH: return GetTrinityString(LANG_BG_AV_NODE_TOWER_DUN_N); + case BG_AV_NODES_STORMPIKE_GRAVE: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_STORMPIKE); + case BG_AV_NODES_ICEWING_BUNKER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_ICEWING); + case BG_AV_NODES_STONEHEART_GRAVE: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_STONE); + case BG_AV_NODES_STONEHEART_BUNKER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_STONE); + case BG_AV_NODES_SNOWFALL_GRAVE: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_SNOW); + case BG_AV_NODES_ICEBLOOD_TOWER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_ICE); + case BG_AV_NODES_ICEBLOOD_GRAVE: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_ICE); + case BG_AV_NODES_TOWER_POINT: return GetTrinityString(LANG_BG_AV_NODE_TOWER_POINT); + case BG_AV_NODES_FROSTWOLF_GRAVE: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_FROST); + case BG_AV_NODES_FROSTWOLF_ETOWER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_FROST_E); + case BG_AV_NODES_FROSTWOLF_WTOWER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_FROST_W); + case BG_AV_NODES_FROSTWOLF_HUT: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_FROST_HUT); + default: + { + sLog.outError("tried to get name for node %u%",node); + return "Unknown"; + break; + } + } +} + +void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint16 team) +{ + if (m_Nodes[node].TotalOwner == team) + { + sLog.outCrash("Assaulting team is TotalOwner of node"); + assert (false); + } + if (m_Nodes[node].Owner == team) + { + sLog.outCrash("Assaulting team is owner of node"); + assert (false); + } + if (m_Nodes[node].State == POINT_DESTROYED) + { + sLog.outCrash("Destroyed node is being assaulted"); + assert (false); + } + if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists + { + sLog.outCrash("Assault on an not assaulted node with total owner"); + assert (false); + } + //the timer gets another time, if the previous owner was 0 == Neutral + m_Nodes[node].Timer = (m_Nodes[node].PrevOwner)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP; + m_Nodes[node].PrevOwner = m_Nodes[node].Owner; + m_Nodes[node].Owner = team; + m_Nodes[node].PrevState = m_Nodes[node].State; + m_Nodes[node].State = POINT_ASSAULTED; +} + +void BattleGroundAV::DestroyNode(BG_AV_Nodes node) +{ + assert(m_Nodes[node].State == POINT_ASSAULTED); + + m_Nodes[node].TotalOwner = m_Nodes[node].Owner; + m_Nodes[node].PrevOwner = m_Nodes[node].Owner; + m_Nodes[node].PrevState = m_Nodes[node].State; + m_Nodes[node].State = (m_Nodes[node].Tower)? POINT_DESTROYED : POINT_CONTROLED; + m_Nodes[node].Timer = 0; +} + +void BattleGroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower) +{ + m_Nodes[node].TotalOwner = team; + m_Nodes[node].Owner = team; + m_Nodes[node].PrevOwner = 0; + m_Nodes[node].State = POINT_CONTROLED; + m_Nodes[node].PrevState = m_Nodes[node].State; + m_Nodes[node].State = POINT_CONTROLED; + m_Nodes[node].Timer = 0; + m_Nodes[node].Tower = tower; +} + +void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint16 team) +{ + assert(m_Nodes[node].TotalOwner == team); + assert(m_Nodes[node].Owner != team); + assert(m_Nodes[node].State != POINT_CONTROLED && m_Nodes[node].State != POINT_DESTROYED); + m_Nodes[node].PrevOwner = m_Nodes[node].Owner; + m_Nodes[node].Owner = team; + m_Nodes[node].PrevState = m_Nodes[node].State; + m_Nodes[node].State = POINT_CONTROLED; + m_Nodes[node].Timer = 0; +} + +void BattleGroundAV::ResetBGSubclass() +{ + m_MaxLevel=0; + for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south + { + for (uint8 j=0; j<9; j++) + m_Team_QuestStatus[i][j]=0; + m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS; + m_IsInformedNearVictory[i]=false; + m_CaptainAlive[i] = true; + m_CaptainBuffTimer[i] = 120000 + urand(0,4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times + m_Mine_Owner[i] = AV_NEUTRAL_TEAM; + m_Mine_PrevOwner[i] = m_Mine_Owner[i]; + } + for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves + InitNode(i,ALLIANCE,false); + for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers + InitNode(i,ALLIANCE,true); + for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) //horde graves + InitNode(i,HORDE,false); + for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) //horde towers + InitNode(i,HORDE,true); + InitNode(BG_AV_NODES_SNOWFALL_GRAVE,AV_NEUTRAL_TEAM,false); //give snowfall neutral owner + + m_Mine_Timer=AV_MINE_TICK_TIMER; + for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++) + if (m_BgCreatures[i]) + DelCreature(i); + +} + + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundAV.h b/src/server/game/BattleGrounds/Zones/BattleGroundAV.h new file mode 100644 index 0000000..6d95c7b --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundAV.h @@ -0,0 +1,1614 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDAV_H +#define __BATTLEGROUNDAV_H + +class BattleGround; + +#define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!" +#define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!" +#define LANG_BG_AV_S_MINE_BOSS_CLAIMS "Snivvle is here! Snivvle claims the Coldtooth Mine!" + +#define BG_AV_CAPTIME 240000 //4:00 +#define BG_AV_SNOWFALL_FIRSTCAP 300000 //5:00 but i also have seen 4:05 + +#define BG_AV_SCORE_INITIAL_POINTS 600 +#define SEND_MSG_NEAR_LOSE 120 + +#define BG_AV_KILL_BOSS 4 +#define BG_AV_REP_BOSS 350 + +#define BG_AV_KILL_CAPTAIN 3 +#define BG_AV_REP_CAPTAIN 125 +#define BG_AV_RES_CAPTAIN 100 + +#define BG_AV_KILL_TOWER 3 +#define BG_AV_REP_TOWER 12 +#define BG_AV_RES_TOWER 75 + +#define BG_AV_GET_COMMANDER 1 //for a safely returned wingcommander +//bonushonor at the end +#define BG_AV_KILL_SURVIVING_TOWER 2 +#define BG_AV_REP_SURVIVING_TOWER 12 + +#define BG_AV_KILL_SURVIVING_CAPTAIN 2 +#define BG_AV_REP_SURVIVING_CAPTAIN 125 + +enum BG_AV_Sounds +{ //TODO: get out if there comes a sound when neutral team captures mine + +/* +8212: + alliance grave assault + alliance tower assault + drek "mlanzenabschaum! In meiner Burg?! Toetet sie all" - nicht immer der sound +8333: + galv "sterbt fuer euch ist kein platz hier" + +8332: + bal "Verschwinde, dreckiger Abschaum! Die Allianz wird im Alteractal " +8174: + horde tower assault + horde grave assault + van "es Sturmlanzenklans, euer General wird angegriffen! Ich fordere Unterst" +8173: + ally grave capture/defend + tower destroy + mine capture + ally wins +8192: + ally tower destroy(only iceblood - found a bug^^) + ally tower defend + horde tower defend +8213 +horde: + grave defend/capture + tower destroy + mine capture + horde wins + */ + + AV_SOUND_NEAR_VICTORY = 8456, //not confirmed yet + + AV_SOUND_ALLIANCE_ASSAULTS = 8212, //tower,grave + enemy boss if someone tries to attack him + AV_SOUND_HORDE_ASSAULTS = 8174, + AV_SOUND_ALLIANCE_GOOD = 8173, //if something good happens for the team: wins(maybe only through killing the boss), captures mine or grave, destroys tower and defends grave + AV_SOUND_HORDE_GOOD = 8213, + AV_SOUND_BOTH_TOWER_DEFEND = 8192, + + AV_SOUND_ALLIANCE_CAPTAIN = 8232, //gets called when someone attacks them and at the beginning after 3min+rand(x)*10sec (maybe buff) + AV_SOUND_HORDE_CAPTAIN = 8333, + +}; + +enum BG_AV_OTHER_VALUES +{ + AV_STATICCPLACE_MAX = 123, + AV_NORTH_MINE = 0, + AV_SOUTH_MINE = 1, + AV_MINE_TICK_TIMER = 45000, + AV_MINE_RECLAIM_TIMER = 1200000, //TODO: get the right value.. this is currently 20 minutes + AV_NEUTRAL_TEAM = 0 //this is the neutral owner of snowfall +}; +enum BG_AV_ObjectIds +{ + //cause the mangos-system is a bit different, we don't use the right go-ids for every node.. if we want to be 100% like another big server, we must take one object for every node + //snowfall 4flags as eyecandy 179424 (alliance neutral) + //Banners - stolen from battleground_AB.h ;-) + BG_AV_OBJECTID_BANNER_A = 178925, // can only be used by horde + BG_AV_OBJECTID_BANNER_H = 178943, // can only be used by alliance + BG_AV_OBJECTID_BANNER_CONT_A = 178940, // can only be used by horde + BG_AV_OBJECTID_BANNER_CONT_H = 179435, // can only be used by alliance + + BG_AV_OBJECTID_BANNER_A_B = 178365, + BG_AV_OBJECTID_BANNER_H_B = 178364, + BG_AV_OBJECTID_BANNER_CONT_A_B = 179286, + BG_AV_OBJECTID_BANNER_CONT_H_B = 179287, + BG_AV_OBJECTID_BANNER_SNOWFALL_N = 180418, + + //snowfall eyecandy banner: + BG_AV_OBJECTID_SNOWFALL_CANDY_A = 179044, + BG_AV_OBJECTID_SNOWFALL_CANDY_PA = 179424, + BG_AV_OBJECTID_SNOWFALL_CANDY_H = 179064, + BG_AV_OBJECTID_SNOWFALL_CANDY_PH = 179425, + + //banners on top of towers: + BG_AV_OBJECTID_TOWER_BANNER_A = 178927, //[PH] Alliance A1 Tower Banner BIG + BG_AV_OBJECTID_TOWER_BANNER_H = 178955, //[PH] Horde H1 Tower Banner BIG + BG_AV_OBJECTID_TOWER_BANNER_PA = 179446, //[PH] Alliance H1 Tower Pre-Banner BIG + BG_AV_OBJECTID_TOWER_BANNER_PH = 179436, //[PH] Horde A1 Tower Pre-Banner BIG + + //Auras + BG_AV_OBJECTID_AURA_A = 180421, + BG_AV_OBJECTID_AURA_H = 180422, + BG_AV_OBJECTID_AURA_N = 180423, + BG_AV_OBJECTID_AURA_A_S = 180100, + BG_AV_OBJECTID_AURA_H_S = 180101, + BG_AV_OBJECTID_AURA_N_S = 180102, + + BG_AV_OBJECTID_GATE_A = 180424, + BG_AV_OBJECTID_GATE_H = 180424, + + //mine supplies + BG_AV_OBJECTID_MINE_N = 178785, + BG_AV_OBJECTID_MINE_S = 178784, + + BG_AV_OBJECTID_FIRE = 179065, + BG_AV_OBJECTID_SMOKE = 179066 +}; + +enum BG_AV_Nodes +{ + BG_AV_NODES_FIRSTAID_STATION = 0, + BG_AV_NODES_STORMPIKE_GRAVE = 1, + BG_AV_NODES_STONEHEART_GRAVE = 2, + BG_AV_NODES_SNOWFALL_GRAVE = 3, + BG_AV_NODES_ICEBLOOD_GRAVE = 4, + BG_AV_NODES_FROSTWOLF_GRAVE = 5, + BG_AV_NODES_FROSTWOLF_HUT = 6, + BG_AV_NODES_DUNBALDAR_SOUTH = 7, + BG_AV_NODES_DUNBALDAR_NORTH = 8, + BG_AV_NODES_ICEWING_BUNKER = 9, + BG_AV_NODES_STONEHEART_BUNKER = 10, + BG_AV_NODES_ICEBLOOD_TOWER = 11, + BG_AV_NODES_TOWER_POINT = 12, + BG_AV_NODES_FROSTWOLF_ETOWER = 13, + BG_AV_NODES_FROSTWOLF_WTOWER = 14, + + BG_AV_NODES_MAX = 15 +}; + +enum BG_AV_ObjectTypes +{ + BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION = 0, + BG_AV_OBJECT_FLAG_A_STORMPIKE_GRAVE = 1, + BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE = 2, + BG_AV_OBJECT_FLAG_A_SNOWFALL_GRAVE = 3, + BG_AV_OBJECT_FLAG_A_ICEBLOOD_GRAVE = 4, + BG_AV_OBJECT_FLAG_A_FROSTWOLF_GRAVE = 5, + BG_AV_OBJECT_FLAG_A_FROSTWOLF_HUT = 6, + BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH = 7, + BG_AV_OBJECT_FLAG_A_DUNBALDAR_NORTH = 8, + BG_AV_OBJECT_FLAG_A_ICEWING_BUNKER = 9, + BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER = 10, + + BG_AV_OBJECT_FLAG_C_A_FIRSTAID_STATION = 11, + BG_AV_OBJECT_FLAG_C_A_STORMPIKE_GRAVE = 12, + BG_AV_OBJECT_FLAG_C_A_STONEHEART_GRAVE = 13, + BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE = 14, + BG_AV_OBJECT_FLAG_C_A_ICEBLOOD_GRAVE = 15, + BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_GRAVE = 16, + BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT = 17, + BG_AV_OBJECT_FLAG_C_A_ICEBLOOD_TOWER = 18, + BG_AV_OBJECT_FLAG_C_A_TOWER_POINT = 19, + BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_ETOWER = 20, + BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER = 21, + + BG_AV_OBJECT_FLAG_C_H_FIRSTAID_STATION = 22, + BG_AV_OBJECT_FLAG_C_H_STORMPIKE_GRAVE = 23, + BG_AV_OBJECT_FLAG_C_H_STONEHEART_GRAVE = 24, + BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE = 25, + BG_AV_OBJECT_FLAG_C_H_ICEBLOOD_GRAVE = 26, + BG_AV_OBJECT_FLAG_C_H_FROSTWOLF_GRAVE = 27, + BG_AV_OBJECT_FLAG_C_H_FROSTWOLF_HUT = 28, + BG_AV_OBJECT_FLAG_C_H_DUNBALDAR_SOUTH = 29, + BG_AV_OBJECT_FLAG_C_H_DUNBALDAR_NORTH = 30, + BG_AV_OBJECT_FLAG_C_H_ICEWING_BUNKER = 31, + BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER = 32, + + BG_AV_OBJECT_FLAG_H_FIRSTAID_STATION = 33, + BG_AV_OBJECT_FLAG_H_STORMPIKE_GRAVE = 34, + BG_AV_OBJECT_FLAG_H_STONEHEART_GRAVE = 35, + BG_AV_OBJECT_FLAG_H_SNOWFALL_GRAVE = 36, + BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE = 37, + BG_AV_OBJECT_FLAG_H_FROSTWOLF_GRAVE = 38, + BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT = 39, + BG_AV_OBJECT_FLAG_H_ICEBLOOD_TOWER = 40, + BG_AV_OBJECT_FLAG_H_TOWER_POINT = 41, + BG_AV_OBJECT_FLAG_H_FROSTWOLF_ETOWER = 42, + BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER = 43, + + BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE = 44, + + BG_AV_OBJECT_DOOR_H = 45, + BG_AV_OBJECT_DOOR_A = 46, +//auras for graveyards (3auras per graveyard neutral,alliance,horde) + BG_AV_OBJECT_AURA_N_FIRSTAID_STATION = 47, + BG_AV_OBJECT_AURA_A_FIRSTAID_STATION = 48, + BG_AV_OBJECT_AURA_H_FIRSTAID_STATION = 49, + BG_AV_OBJECT_AURA_N_STORMPIKE_GRAVE = 50, + BG_AV_OBJECT_AURA_A_STORMPIKE_GRAVE = 51, + BG_AV_OBJECT_AURA_H_STORMPIKE_GRAVE = 52, + BG_AV_OBJECT_AURA_N_STONEHEART_GRAVE = 53, + BG_AV_OBJECT_AURA_A_STONEHEART_GRAVE = 54, + BG_AV_OBJECT_AURA_H_STONEHEART_GRAVE = 55, + BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE = 56, + BG_AV_OBJECT_AURA_A_SNOWFALL_GRAVE = 57, + BG_AV_OBJECT_AURA_H_SNOWFALL_GRAVE = 58, + BG_AV_OBJECT_AURA_N_ICEBLOOD_GRAVE = 59, + BG_AV_OBJECT_AURA_A_ICEBLOOD_GRAVE = 60, + BG_AV_OBJECT_AURA_H_ICEBLOOD_GRAVE = 61, + BG_AV_OBJECT_AURA_N_FROSTWOLF_GRAVE = 62, + BG_AV_OBJECT_AURA_A_FROSTWOLF_GRAVE = 63, + BG_AV_OBJECT_AURA_H_FROSTWOLF_GRAVE = 64, + BG_AV_OBJECT_AURA_N_FROSTWOLF_HUT = 65, + BG_AV_OBJECT_AURA_A_FROSTWOLF_HUT = 66, + BG_AV_OBJECT_AURA_H_FROSTWOLF_HUT = 67, + + //big flags on top of towers 2 flags on each (contested,(alliance | horde)) + 2 auras + BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH = 67, + BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH = 68, + BG_AV_OBJECT_TFLAG_A_DUNBALDAR_NORTH = 69, + BG_AV_OBJECT_TFLAG_H_DUNBALDAR_NORTH = 70, + BG_AV_OBJECT_TFLAG_A_ICEWING_BUNKER = 71, + BG_AV_OBJECT_TFLAG_H_ICEWING_BUNKER = 72, + BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER = 73, + BG_AV_OBJECT_TFLAG_H_STONEHEART_BUNKER = 74, + BG_AV_OBJECT_TFLAG_A_ICEBLOOD_TOWER = 75, + BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER = 76, + BG_AV_OBJECT_TFLAG_A_TOWER_POINT = 77, + BG_AV_OBJECT_TFLAG_H_TOWER_POINT = 78, + BG_AV_OBJECT_TFLAG_A_FROSTWOLF_ETOWER = 79, + BG_AV_OBJECT_TFLAG_H_FROSTWOLF_ETOWER = 80, + BG_AV_OBJECT_TFLAG_A_FROSTWOLF_WTOWER = 81, + BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER = 82, + BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH = 83, + BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH = 84, + BG_AV_OBJECT_TAURA_A_DUNBALDAR_NORTH = 85, + BG_AV_OBJECT_TAURA_H_DUNBALDAR_NORTH = 86, + BG_AV_OBJECT_TAURA_A_ICEWING_BUNKER = 87, + BG_AV_OBJECT_TAURA_H_ICEWING_BUNKER = 88, + BG_AV_OBJECT_TAURA_A_STONEHEART_BUNKER = 89, + BG_AV_OBJECT_TAURA_H_STONEHEART_BUNKER = 90, + BG_AV_OBJECT_TAURA_A_ICEBLOOD_TOWER = 91, + BG_AV_OBJECT_TAURA_H_ICEBLOOD_TOWER = 92, + BG_AV_OBJECT_TAURA_A_TOWER_POINT = 93, + BG_AV_OBJECT_TAURA_H_TOWER_POINT = 94, + BG_AV_OBJECT_TAURA_A_FROSTWOLF_ETOWER = 95, + BG_AV_OBJECT_TAURA_H_FROSTWOLF_ETOWER = 96, + BG_AV_OBJECT_TAURA_A_FROSTWOLF_WTOWER = 97, + BG_AV_OBJECT_TAURA_H_FROSTWOLF_WTOWER = 98, + + BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH = 99, + BG_AV_OBJECT_BURN_DUNBALDAR_NORTH = 109, + BG_AV_OBJECT_BURN_ICEWING_BUNKER = 119, + BG_AV_OBJECT_BURN_STONEHEART_BUNKER = 129, + BG_AV_OBJECT_BURN_ICEBLOOD_TOWER = 139, + BG_AV_OBJECT_BURN_TOWER_POINT = 149, + BG_AV_OBJECT_BURN_FROSTWOLF_ETWOER = 159, + BG_AV_OBJECT_BURN_FROSTWOLF_WTOWER = 169, + BG_AV_OBJECT_BURN_BUILDING_ALLIANCE = 179, + BG_AV_OBJECT_BURN_BUILDING_HORDE = 189, + BG_AV_OBJECT_SNOW_EYECANDY_A = 199, + BG_AV_OBJECT_SNOW_EYECANDY_PA = 203, + BG_AV_OBJECT_SNOW_EYECANDY_H = 207, + BG_AV_OBJECT_SNOW_EYECANDY_PH = 211, + BG_AV_OBJECT_MINE_SUPPLY_N_MIN = 215, + BG_AV_OBJECT_MINE_SUPPLY_N_MAX = 224, + BG_AV_OBJECT_MINE_SUPPLY_S_MIN = 225, + BG_AV_OBJECT_MINE_SUPPLY_S_MAX = 236, + + BG_AV_OBJECT_MAX = 237 +}; + +enum BG_AV_OBJECTS +{ + AV_OPLACE_FIRSTAID_STATION = 0, + AV_OPLACE_STORMPIKE_GRAVE = 1, + AV_OPLACE_STONEHEART_GRAVE = 2, + AV_OPLACE_SNOWFALL_GRAVE = 3, + AV_OPLACE_ICEBLOOD_GRAVE = 4, + AV_OPLACE_FROSTWOLF_GRAVE = 5, + AV_OPLACE_FROSTWOLF_HUT = 6, + AV_OPLACE_DUNBALDAR_SOUTH = 7, + AV_OPLACE_DUNBALDAR_NORTH = 8, + AV_OPLACE_ICEWING_BUNKER = 9, + AV_OPLACE_STONEHEART_BUNKER = 10, + AV_OPLACE_ICEBLOOD_TOWER = 11, + AV_OPLACE_TOWER_POINT = 12, + AV_OPLACE_FROSTWOLF_ETOWER = 13, + AV_OPLACE_FROSTWOLF_WTOWER = 14, + AV_OPLACE_BIGBANNER_DUNBALDAR_SOUTH = 15, + AV_OPLACE_BIGBANNER_DUNBALDAR_NORTH = 16, + AV_OPLACE_BIGBANNER_ICEWING_BUNKER = 17, + AV_OPLACE_BIGBANNER_STONEHEART_BUNKER = 18, + AV_OPLACE_BIGBANNER_ICEBLOOD_TOWER = 19, + AV_OPLACE_BIGBANNER_TOWER_POINT = 20, + AV_OPLACE_BIGBANNER_FROSTWOLF_ETOWER = 21, + AV_OPLACE_BIGBANNER_FROSTWOLF_WTOWER = 22, + + AV_OPLACE_BURN_DUNBALDAR_SOUTH = 23, + AV_OPLACE_BURN_DUNBALDAR_NORTH = 33, + AV_OPLACE_BURN_ICEWING_BUNKER = 43, + AV_OPLACE_BURN_STONEHEART_BUNKER = 53, + AV_OPLACE_BURN_ICEBLOOD_TOWER = 63, + AV_OPLACE_BURN_TOWER_POINT = 73, + AV_OPLACE_BURN_FROSTWOLF_ETOWER = 83, + AV_OPLACE_BURN_FROSTWOLF_WTOWER = 93, + AV_OPLACE_BURN_BUILDING_A = 103, + AV_OPLACE_BURN_BUILDING_H = 113, + AV_OPLACE_SNOW_1 = 123, + AV_OPLACE_SNOW_2 = 124, + AV_OPLACE_SNOW_3 = 125, + AV_OPLACE_SNOW_4 = 126, + AV_OPLACE_MINE_SUPPLY_N_MIN = 127, + AV_OPLACE_MINE_SUPPLY_N_MAX = 136, + AV_OPLACE_MINE_SUPPLY_S_MIN = 137, + AV_OPLACE_MINE_SUPPLY_S_MAX = 148, + + AV_OPLACE_MAX = 149 +}; +const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] = { + {638.592f,-32.422f,46.0608f,-1.62316f },//firstaid station + {669.007f,-294.078f,30.2909f,2.77507f },//stormpike + {77.8013f,-404.7f,46.7549f,-0.872665f },//stone grave + {-202.581f,-112.73f,78.4876f,-0.715585f },//snowfall + {-611.962f,-396.17f,60.8351f,2.53682f}, //iceblood grave + {-1082.45f,-346.823f,54.9219f,-1.53589f },//frostwolf grave + {-1402.21f,-307.431f,89.4424f,0.191986f },//frostwolf hut + {553.779f,-78.6566f,51.9378f,-1.22173f }, //dunnbaldar south + {674.001f,-143.125f,63.6615f,0.994838f }, //dunbaldar north + {203.281f,-360.366f,56.3869f,-0.925024f }, //icew + {-152.437f,-441.758f,40.3982f,-1.95477f }, //stone + {-571.88f,-262.777f,75.0087f,-0.802851f }, //ice tower + {-768.907f,-363.71f,90.8949f,1.07991f}, //tower point + {-1302.9f,-316.981f,113.867f,2.00713f }, //frostwolf etower + {-1297.5f,-266.767f,114.15f,3.31044f}, //frostwolf wtower + //bigbanner: + {555.848f,-84.4151f,64.4397f,3.12414f }, //duns + {679.339f,-136.468f,73.9626f,-2.16421f }, //dunn + {208.973f,-365.971f,66.7409f,-0.244346f }, //icew + {-155.832f,-449.401f,52.7306f,0.610865f }, //stone + {-572.329f,-262.476f,88.6496f,-0.575959f }, //icetower + {-768.199f,-363.105f,104.537f,0.10472f }, //towerp + {-1302.84f,-316.582f,127.516f,0.122173f }, //etower + {-1297.87f,-266.762f,127.796f,0.0698132f }, //wtower + //burning auras towers have 9*179065 captain-buildings have 5*179066+5*179065 + //dunns + {562.632f,-88.1815f,61.993f,0.383972f }, + {562.523f,-74.5028f,37.9474f,-0.0523599f }, + {558.097f,-70.9842f,52.4876f,0.820305f }, + {578.167f,-71.8191f,38.1514f,2.72271f }, + {556.028f,-94.9242f,44.8191f,3.05433f }, + {572.451f,-94.3655f,37.9443f,-1.72788f }, + {549.263f,-79.3645f,44.8191f,0.436332f }, + {543.513f,-94.4006f,52.4819f,0.0349066f }, + {572.149f,-93.7862f,52.5726f,0.541052f }, + {582.162f,-81.2375f,37.9216f,0.0872665f }, + //dunn + {664.797f,-143.65f,64.1784f,-0.453786f}, + {664.505f,-139.452f,49.6696f,-0.0349067f}, + {676.067f,-124.319f,49.6726f,-1.01229f}, + {693.004f,-144.025f,64.1755f,2.44346f}, + {661.175f,-117.691f,49.645f,1.91986f}, + {684.423f,-146.582f,63.6662f,0.994838f}, + {682.791f,-127.769f,62.4155f,1.09956f}, + {674.576f,-147.101f,56.5425f,-1.6057f}, + {655.719f,-126.673f,49.8138f,2.80998f}, + {0,0,0,0}, + //icew + {231.503f,-356.688f,42.3704f,0.296706f}, + {224.989f,-348.175f,42.5607f,1.50098f}, + {205.782f,-351.335f,56.8998f,1.01229f}, + {196.605f,-369.187f,56.3914f,2.46091f}, + {210.619f,-376.938f,49.2677f,2.86234f}, + {209.647f,-352.632f,42.3959f,-0.698132f}, + {220.65f,-368.132f,42.3978f,-0.2618f}, + {224.682f,-374.031f,57.0679f,0.541052f}, + {200.26f,-359.968f,49.2677f,-2.89725f}, + {196.619f,-378.016f,56.9131f,1.01229f}, + //stone + {-155.488f,-437.356f,33.2796f,2.60054f}, + {-163.441f,-454.188f,33.2796f,1.93732f}, + {-143.977f,-445.148f,26.4097f,-1.8675f}, + {-135.764f,-464.708f,26.3823f,2.25147f}, + {-154.076f,-466.929f,41.0636f,-1.8675f}, + {-149.908f,-460.332f,26.4083f,-2.09439f}, + {-151.638f,-439.521f,40.3797f,0.436332f}, + {-131.301f,-454.905f,26.5771f,2.93215f}, + {-171.291f,-444.684f,40.9211f,2.30383f}, + {-143.591f,-439.75f,40.9275f,-1.72788f}, + //iceblood + {-572.667f,-267.923f,56.8542f,2.35619f}, + {-561.021f,-262.689f,68.4589f,1.37881f}, + {-572.538f,-262.649f,88.6197f,1.8326f}, + {-574.77f,-251.45f,74.9422f,-1.18682f}, + {-578.625f,-267.571f,68.4696f,0.506145f}, + {-571.476f,-257.234f,63.3223f,3.10669f}, + {-566.035f,-273.907f,52.9582f,-0.890118f}, + {-580.948f,-259.77f,68.4696f,1.46608f}, + {-568.318f,-267.1f,75.0008f,1.01229f}, + {-559.621f,-268.597f,52.8986f,0.0523599f}, + //towerp + {-776.072f,-368.046f,84.3558f,2.63545f}, + {-777.564f,-368.521f,90.6701f,1.72788f}, + {-765.461f,-357.711f,90.888f,0.314159f}, + {-768.763f,-362.735f,104.612f,1.81514f}, + {-760.356f,-358.896f,84.3558f,2.1293f}, + {-771.967f,-352.838f,84.3484f,1.74533f}, + {-773.333f,-364.653f,79.2351f,-1.64061f}, + {-764.109f,-366.069f,70.0934f,0.383972f}, + {-767.103f,-350.737f,68.7933f,2.80998f}, + {-760.115f,-353.845f,68.8633f,1.79769f}, + //froste + {-1304.87f,-304.525f,91.8366f,-0.680679f}, + {-1301.77f,-310.974f,95.8252f,0.907571f}, + {-1305.58f,-320.625f,102.166f,-0.558505f}, + {-1294.27f,-323.468f,113.893f,-1.67552f}, + {-1302.65f,-317.192f,127.487f,2.30383f}, + {-1293.89f,-313.478f,107.328f,1.6057f}, + {-1312.41f,-312.999f,107.328f,1.5708f}, + {-1311.57f,-308.08f,91.7666f,-1.85005f}, + {-1314.7f,-322.131f,107.36f,0.645772f}, + {-1304.6f,-310.754f,113.859f,-0.401426f}, + //frostw + {-1308.24f,-273.26f,92.0514f,-0.139626f}, + {-1302.26f,-262.858f,95.9269f,0.418879f}, + {-1297.28f,-267.773f,126.756f,2.23402f}, + {-1299.08f,-256.89f,114.108f,-2.44346f}, + {-1303.41f,-268.237f,114.151f,-1.23918f}, + {-1304.43f,-273.682f,107.612f,0.244346f}, + {-1309.53f,-265.951f,92.1418f,-2.49582f}, + {-1295.55f,-263.865f,105.033f,0.925024f}, + {-1294.71f,-281.466f,107.664f,-1.50098f}, + {-1289.69f,-259.521f,107.612f,-2.19912f}, + + //the two buildings of the captains + //alliance + {-64.4987f,-289.33f,33.4616f,-2.82743f}, + {-5.98025f,-326.144f,38.8538f,0}, + {-2.67893f,-306.998f,33.4165f,0}, + {-60.25f,-309.232f,50.2408f,-1.46608f}, + {-48.7941f,-266.533f,47.7916f,2.44346f}, + {-3.40929f,-306.288f,33.34f,0}, + {-48.619f,-266.917f,47.8168f,0}, + {-62.9474f,-286.212f,66.7288f,0}, + {-5.05132f,-325.323f,38.8536f,0}, + {-64.2677f,-289.412f,33.469f,0}, +//horde + {-524.276f,-199.6f,82.8733f,-1.46608f}, + {-518.196f,-173.085f,102.43f,0}, + {-500.732f,-145.358f,88.5337f,2.44346f}, + {-501.084f,-150.784f,80.8506f,0}, + {-518.309f,-163.963f,102.521f,2.96706f}, + {-517.053f,-200.429f,80.759f,0}, + {-514.361f,-163.864f,104.163f,0}, + {-568.04f,-188.707f,81.55f,0}, + {-501.775f,-151.581f,81.2027f,0}, + {-509.975f,-191.652f,83.2978f,0}, + +//snowfall eyecandy + {-191.153f,-129.868f,78.5595f,-1.25664f }, + {-201.282f,-134.319f,78.6753f,-0.942478f }, + {-215.981f,-91.4101f,80.8702f,-1.74533f }, + {-200.465f,-96.418f,79.7587f,1.36136f }, + //mine supplies + //irondeep + {870.899f,-388.434f,61.6406f,-1.22173f}, + {825.214f,-320.174f,63.712f,-2.82743f}, + {837.117f,-452.556f,47.2331f,-3.12414f}, + {869.755f,-448.867f,52.5448f,-0.855212f}, + {949.877f,-458.198f,56.4874f,0.314159f}, + {900.35f,-479.024f,58.3553f,0.122173f}, + {854.449f,-442.255f,50.6589f,0.401426f}, + {886.685f,-442.358f,54.6962f,-1.22173f}, + {817.509f,-457.331f,48.4666f,2.07694f}, + {793.411f,-326.281f,63.1117f,-2.79253f}, + //coldtooth + {-934.212f,-57.3517f,80.277f,-0.0174535f}, + {-916.281f,-36.8579f,77.0227f,0.122173f}, + {-902.73f,-103.868f,75.4378f,-1.58825f}, + {-900.514f,-143.527f,75.9686f,1.8675f}, + {-862.882f,-0.353299f,72.1526f,-2.51327f}, + {-854.932f,-85.9184f,68.6056f,-2.04204f}, + {-851.833f,-118.959f,63.8672f,-0.0698131f}, + {-849.832f,-20.8421f,70.4672f,-1.81514f}, + {-844.25f,-60.0374f,72.1031f,-2.19912f}, + {-820.644f,-136.043f,63.1977f,2.40855f}, + {-947.642f,-208.807f,77.0101f,1.36136f}, + {-951.394f,-193.695f,67.634f,0.802851f} +}; + +const float BG_AV_DoorPositons[2][4] = { + {780.487f, -493.024f, 99.9553f, 3.0976f}, //alliance + {-1375.193f, -538.981f, 55.2824f, 0.72178f} //horde +}; + +//creaturestuff starts here +//is related to BG_AV_CreaturePos +enum BG_AV_CreaturePlace +{ + AV_CPLACE_SPIRIT_STORM_AID = 0, + AV_CPLACE_SPIRIT_STORM_GRAVE = 1, + AV_CPLACE_SPIRIT_STONE_GRAVE = 2, + AV_CPLACE_SPIRIT_SNOWFALL = 3, + AV_CPLACE_SPIRIT_ICE_GRAVE = 4, + AV_CPLACE_SPIRIT_FROSTWOLF = 5, + AV_CPLACE_SPIRIT_FROST_HUT = 6, + AV_CPLACE_SPIRIT_MAIN_ALLIANCE = 7, + AV_CPLACE_SPIRIT_MAIN_HORDE = 8, +//i don't will add for all 4 positions a variable.. i think one is enough to compute the rest + AV_CPLACE_DEFENSE_STORM_AID = 9, + AV_CPLACE_DEFEMSE_STORM_GRAVE = 13, + AV_CPLACE_DEFENSE_STONE_GRAVE = 17, + AV_CPLACE_DEFENSE_SNOWFALL = 21, + AV_CPLACE_DEFENSE_FROSTWOLF = 25, + AV_CPLACE_DEFENSE_ICE_GRAVE = 29, + AV_CPLACE_DEFENSE_FROST_HUT = 33, + + AV_CPLACE_DEFENSE_DUN_S = 37, + AV_CPLACE_DEFENSE_DUN_N = 41, + AV_CPLACE_DEFENSE_ICEWING = 45, + AV_CPLACE_DEFENSE_STONE_TOWER = 49, + AV_CPLACE_DEFENSE_ICE_TOWER = 53, + AV_CPLACE_DEFENSE_TOWERPOINT = 57, + AV_CPLACE_DEFENSE_FROST_E = 61, + AV_CPLACE_DEFENSE_FROST_t = 65, + + AV_CPLACE_A_MARSHAL_SOUTH = 69, + AV_CPLACE_A_MARSHAL_NORTH = 70, + AV_CPLACE_A_MARSHAL_ICE = 71, + AV_CPLACE_A_MARSHAL_STONE = 72, + AV_CPLACE_H_MARSHAL_ICE = 73, + AV_CPLACE_H_MARSHAL_TOWER = 74, + AV_CPLACE_H_MARSHAL_ETOWER = 75, + AV_CPLACE_H_MARSHAL_WTOWER = 76, + //irondeep + //miner: + AV_CPLACE_MINE_N_1_MIN = 77, + AV_CPLACE_MINE_N_1_MAX = 136, + //special types + AV_CPLACE_MINE_N_2_MIN = 137, + AV_CPLACE_MINE_N_2_MAX = 192, + //boss + AV_CPLACE_MINE_N_3 = 193, + //coldtooth + //miner: + AV_CPLACE_MINE_S_1_MIN = 194, + AV_CPLACE_MINE_S_1_MAX = 250, + //special types + AV_CPLACE_MINE_S_2_MIN = 251, + AV_CPLACE_MINE_S_2_MAX = 289, + //vermin + AV_CPLACE_MINE_S_S_MIN = 290, + AV_CPLACE_MINE_S_S_MAX = 299, + //boss + AV_CPLACE_MINE_S_3 = 300, + + //herald + AV_CPLACE_HERALD = 301, + + //node aura triggers + AV_CPLACE_TRIGGER01 = 302, + AV_CPLACE_TRIGGER02 = 303, + AV_CPLACE_TRIGGER03 = 304, + AV_CPLACE_TRIGGER04 = 305, + AV_CPLACE_TRIGGER05 = 306, + AV_CPLACE_TRIGGER06 = 307, + AV_CPLACE_TRIGGER07 = 308, + AV_CPLACE_TRIGGER08 = 309, + AV_CPLACE_TRIGGER09 = 310, + AV_CPLACE_TRIGGER10 = 311, + AV_CPLACE_TRIGGER11 = 312, + AV_CPLACE_TRIGGER12 = 313, + AV_CPLACE_TRIGGER13 = 314, + AV_CPLACE_TRIGGER14 = 315, + AV_CPLACE_TRIGGER15 = 316, + + //boss,captain triggers + AV_CPLACE_TRIGGER16 = 317, + AV_CPLACE_TRIGGER17 = 318, + AV_CPLACE_TRIGGER18 = 319, + AV_CPLACE_TRIGGER19 = 320, + + AV_CPLACE_MAX = 321 +}; + +//x, y, z, o +const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] = { + //spiritguides + {643.000000f,44.000000f,69.740196f,-0.001854f}, + {676.000000f,-374.000000f,30.000000f,-0.001854f}, + {73.417755f,-496.433105f,48.731918f,-0.001854f}, + {-157.409195f,31.206272f,77.050598f,-0.001854f}, + {-531.217834f,-405.231384f,49.551376f,-0.001854f}, + {-1090.476807f,-253.308670f,57.672371f,-0.001854f}, + {-1496.065063f,-333.338409f,101.134804f,-0.001854f}, + {873.001770f,-491.283630f,96.541931f,-0.001854f}, + {-1437.670044f,-610.088989f,51.161900f,-0.001854f}, + //grave + //firstaid + {635.17f,-29.5594f,46.5056f,4.81711f}, + {642.488f,-32.9437f,46.365f,4.67748f}, + {642.326f,-27.9442f,46.9211f,4.59022f}, + {635.945f,-33.6171f,45.7164f,4.97419f}, + //stormpike + {669.272f,-297.304f,30.291f,4.66604f}, + {674.08f,-292.328f,30.4817f,0.0918785f}, + {667.01f,-288.532f,29.8809f,1.81583f}, + {664.153f,-294.042f,30.2851f,3.28531f}, + //stone + {81.7027f,-406.135f,47.7843f,0.598464f}, + {78.1431f,-409.215f,48.0401f,5.05953f}, + {73.4135f,-407.035f,46.7527f,3.34736f}, + {78.2258f,-401.859f,46.4202f,2.05852f}, + //snowfall + {-207.412f,-110.616f,78.7959f,2.43251f}, + {-197.95f,-112.205f,78.5686f,6.22441f}, + {-202.709f,-116.829f,78.4358f,5.13742f}, + {-202.059f,-108.314f,78.5783f,5.91968f}, + //ice + {-615.501f,-393.802f,60.4299f,3.06147f}, + {-608.513f,-392.717f,62.5724f,2.06323f}, + {-609.769f,-400.072f,60.7174f,5.22367f}, + {-616.093f,-398.293f,60.5628f,3.73613f}, + //frost + {-1077.7f,-340.21f,55.4682f,6.25569f}, + {-1082.74f,-333.821f,54.7962f,2.05459f}, + {-1090.66f,-341.267f,54.6768f,3.27746f}, + {-1081.58f,-344.63f,55.256f,4.75636f}, + //frost hut + {-1408.95f,-311.69f,89.2536f,4.49954f}, + {-1407.15f,-305.323f,89.1993f,2.86827f}, + {-1400.64f,-304.3f,89.7008f,1.0595f}, + {-1400.4f,-311.35f,89.3028f,4.99434f}, + //towers + //dun south - OK + {569.395f,-101.064f,52.8296f,2.34974f}, + {574.85f,-92.9842f,52.5869f,3.09325f}, + {575.411f,-83.597f,52.3626f,6.26573f}, + {571.352f,-75.6582f,52.479f,0.523599f}, + //dun north - OK + {668.60f,-122.53f,64.12f,2.34f}, //not 100% ok + {662.253f,-129.105f,64.1794f,2.77507f}, + {661.209f,-138.877f,64.2251f,3.38594f}, + {665.481f,-146.857f,64.1271f,3.75246f}, + //icewing - OK + {225.228f,-368.909f,56.9983f,6.23806f}, + {191.36f,-369.899f,57.1524f,3.24631f}, + {215.518f,-384.019f,56.9889f,5.09636f}, + {199.625f,-382.177f,56.8691f,4.08407f}, + //stone + {-172.851f,-452.366f,40.8725f,3.31829f}, + {-147.147f,-435.053f,40.8022f,0.599238f}, + {-169.456f,-440.325f,40.985f,2.59101f}, + {-163.494f,-434.904f,41.0725f,1.84174f}, + //ice - OK + {-573.522f,-271.854f,75.0078f,3.9619f}, + {-565.616f,-269.051f,74.9952f,5.02655f}, + {-562.825f,-261.087f,74.9898f,5.95157f}, + {-569.176f,-254.446f,74.8771f,0.820305f}, + //towerpoint + {-763.04f,-371.032f,90.7933f,5.25979f}, + {-759.764f,-358.264f,90.8681f,0.289795f}, + {-768.808f,-353.056f,90.8811f,1.52601f}, + {-775.944f,-362.639f,90.8949f,2.59573f}, + //frost etower + {-1294.13f,-313.045f,107.328f,0.270162f}, + {-1306.5f,-308.105f,113.767f,1.78755f}, + {-1294.78f,-319.966f,113.79f,5.94545f}, + {-1294.83f,-312.241f,113.799f,0.295293f}, + //frost wtower + {-1300.96f,-275.111f,114.058f,4.12804f}, + {-1302.41f,-259.256f,114.065f,1.67602f}, + {-1287.97f,-262.087f,114.165f,6.18264f}, + {-1291.59f,-271.166f,114.151f,5.28257f}, + + //alliance marshall + {721.104f,-7.64155f,50.7046f,3.45575f},// south + {723.058f,-14.1548f,50.7046f,3.40339f},// north + {715.691f,-4.72233f,50.2187f,3.47321f},// icewing + {720.046f,-19.9413f,50.2187f,3.36849f},// stone +//horde (coords not 100% ok) + {-1363.99f,-221.99f,98.4053f,4.93012f}, + {-1370.96f,-223.532f,98.4266f,4.93012f}, + {-1378.37f,-228.614f,99.3546f,5.38565f}, + {-1358.02f,-228.998f,98.868f,3.87768f}, + + //irondeep mine + //Irondeep Trogg + {971.671f,-442.657f,57.6951f,3.1765f}, + {969.979f,-457.148f,58.1119f,4.5204f}, + {958.692f,-333.477f,63.2276f,5.77704f}, + {957.113f,-325.92f,61.7589f,1.13446f}, + {948.25f,-448.268f,56.9009f,5.60251f}, + {934.727f,-385.802f,63.0344f,3.75246f}, + {931.751f,-403.458f,59.6737f,5.63741f}, + {931.146f,-359.666f,66.0294f,3.9619f}, + {929.702f,-412.401f,56.8776f,5.89921f}, + {926.849f,-379.074f,63.5286f,2.0944f}, + {921.972f,-358.597f,66.4313f,2.93215f}, + {921.449f,-341.981f,67.1264f,3.4383f}, + {921.1f,-395.812f,60.4615f,2.71695f}, + {919.274f,-394.986f,60.3478f,2.71696f}, + {916.852f,-393.891f,60.1726f,2.71695f}, + {914.568f,-326.21f,66.1733f,2.25147f}, + {913.064f,-395.773f,60.1364f,4.41568f}, + {909.246f,-474.576f,58.2067f,0.226893f}, + {909.246f,-474.576f,58.2901f,0.226893f}, + {907.209f,-428.267f,59.8065f,1.8675f}, + {905.973f,-459.528f,58.7594f,1.37189f}, + {905.067f,-396.074f,60.2085f,5.07891f}, + {901.809f,-457.709f,59.0116f,3.52557f}, + {900.962f,-427.44f,59.0842f,1.50098f}, + {897.929f,-471.742f,59.7729f,2.54818f}, + {893.376f,-343.171f,68.1499f,5.35816f}, + {890.584f,-406.049f,61.1925f,5.67232f}, + {888.208f,-332.564f,68.148f,1.93732f}, + {887.647f,-391.537f,61.8734f,1.37881f}, + {885.109f,-343.338f,67.0867f,3.78979f}, + {881.618f,-419.948f,53.5228f,0.593412f}, + {878.675f,-345.36f,66.1052f,3.45651f}, + {877.127f,-351.8f,66.5296f,5.74213f}, + {876.778f,-345.97f,65.7724f,3.45262f}, + {874.577f,-414.786f,52.7817f,1.67552f}, + {868.247f,-343.136f,64.9894f,1.6057f}, + {859.03f,-367.231f,47.4655f,0.0174533f}, + {857.513f,-351.817f,65.1867f,4.39823f}, + {852.632f,-372.416f,48.1657f,3.66519f}, + {849.86f,-340.944f,66.2447f,0.401426f}, + {847.99f,-386.287f,60.9277f,2.32374f}, + {847.601f,-423.072f,50.0852f,4.57276f}, + {847.135f,-411.307f,50.2106f,1.5708f}, + {835.077f,-379.418f,48.2755f,5.93412f}, + {834.87f,-453.304f,47.9075f,0.226893f}, + {834.634f,-365.981f,62.8801f,1.32645f}, + {834.354f,-355.526f,48.1491f,6.07375f}, + {833.702f,-327.506f,65.0439f,0.331613f}, + {833.151f,-374.228f,63.0938f,3.66519f}, + {831.711f,-346.785f,47.2975f,0.226893f}, + {827.874f,-413.624f,48.5818f,1.49241f}, + {827.728f,-415.483f,48.5593f,1.49238f}, + {827.016f,-424.543f,48.2856f,1.49236f}, + {823.222f,-334.283f,65.6306f,4.88692f}, + {821.892f,-464.723f,48.9451f,4.66003f}, + {821.006f,-387.635f,49.0728f,3.15905f}, + {817.26f,-447.432f,49.4308f,2.18166f}, + {805.399f,-320.146f,52.7712f,0.296706f}, + {801.405f,-328.055f,53.0195f,4.31096f}, + //irondeep skullthumber irondeep shaman + {955.812f,-440.302f,55.3411f,3.19395f}, + {937.378f,-377.816f,65.3919f,3.56047f}, + {925.059f,-331.347f,65.7564f,3.66519f}, + {922.918f,-396.634f,60.3942f,2.71695f}, + {909.99f,-462.154f,59.0811f,3.7001f}, + {907.893f,-388.787f,61.7923f,5.74213f}, + {898.801f,-437.105f,58.5266f,0.959931f}, + {884.237f,-407.597f,61.566f,0.820305f}, + {880.744f,-344.683f,66.4086f,3.4644f}, + {876.047f,-341.857f,65.8743f,4.45059f}, + {874.674f,-402.077f,61.7573f,0.26341f}, + {871.914f,-404.209f,62.1269f,6.06163f}, + {871.606f,-403.665f,62.0795f,0.765774f}, + {871.561f,-404.114f,62.1297f,0.00981727f}, + {871.528f,-404.248f,62.1455f,0.498032f}, + {871.493f,-404.122f,62.1331f,5.65727f}, + {871.282f,-403.843f,62.1108f,0.788382f}, + {868.294f,-392.395f,61.4772f,4.38685f}, + {868.256f,-392.363f,61.4803f,0.732738f}, + {867.804f,-392.51f,61.5089f,2.30167f}, + {867.612f,-392.371f,61.524f,2.86149f}, + {858.593f,-439.614f,50.2184f,0.872665f}, + {851.471f,-362.52f,47.314f,4.06662f}, + {846.939f,-347.279f,66.2876f,0.942478f}, + {842.08f,-421.775f,48.2659f,1.0821f}, + {838.358f,-371.212f,63.3299f,4.04916f}, + {827.57f,-417.483f,48.4538f,1.49237f}, + {827.012f,-457.397f,48.9331f,2.35619f}, + {825.535f,-322.373f,63.9357f,4.76475f}, + {867.635f,-443.605f,51.3347f,1.38626f}, + {957.293f,-455.039f,56.7395f,5.79449f}, + {950.077f,-326.672f,61.6552f,5.48033f}, + {936.692f,-356.78f,65.9835f,2.75762f}, + {926.475f,-419.345f,56.1833f,2.0944f}, + {924.729f,-397.453f,60.213f,2.71695f}, + {902.195f,-475.891f,58.312f,1.39626f}, + {897.464f,-338.758f,68.1715f,2.94961f}, + {884.237f,-407.597f,61.566f,0.820305f}, + {882.517f,-344.111f,66.7887f,3.46962f}, + {881.437f,-400.254f,61.2028f,0.263427f}, + {880.156f,-400.678f,61.3113f,3.41373f}, + {877.989f,-418.051f,52.9753f,4.46804f}, + {871.212f,-404.12f,62.1433f,3.6554f}, + {871.036f,-404.119f,62.2237f,4.50295f}, + {857.396f,-395.766f,61.263f,4.78684f}, + {857.276f,-395.395f,61.2418f,0.0845553f}, + {857.231f,-394.577f,61.2174f,1.96817f}, + {857.108f,-395.682f,61.2317f,4.87022f}, + {856.709f,-395.28f,61.1814f,2.54913f}, + {850.922f,-390.399f,60.8771f,2.85405f}, + {847.556f,-388.228f,60.9438f,2.56872f}, + {842.031f,-384.663f,61.6028f,2.56871f}, + {832.035f,-389.301f,47.5567f,2.11185f}, + {827.415f,-419.468f,48.3322f,1.49232f}, + {826.402f,-349.454f,47.2722f,1.51844f}, + {817.83f,-455.715f,48.4207f,0.925025f}, + {808.953f,-325.964f,52.4043f,3.01942f}, + // Morloch + {865.554f,-438.735f,50.7333f,2.12431f}, + //coldtooth mine + //miner/digger + {-917.648f,-46.8922f,77.0872f,5.27089f}, + {-912.689f,-45.4494f,76.2277f,4.60767f}, + {-905.455f,-84.5179f,75.3642f,3.29867f}, + {-904.332f,-111.509f,75.5925f,2.47837f}, + {-904.27f,-160.419f,61.9876f,3.61192f}, + {-904.023f,-90.4558f,75.3706f,3.40339f}, + {-978.678f,-37.3136f,75.8364f,2.84489f}, + {-973.076f,-36.5013f,77.5047f,1.0821f}, + {-963.951f,-87.734f,81.5555f,0.575959f}, + {-961.941f,-90.7252f,81.6629f,0.820305f}, + {-957.623f,-186.582f,66.6021f,1.95477f}, + {-952.476f,-179.778f,78.6771f,4.5204f}, + {-950.427f,-115.007f,79.6127f,3.68264f}, + {-950.25f,-151.95f,79.4598f,-1.81423f}, + {-950.169f,-188.099f,66.6184f,5.55015f}, + {-949.944f,-142.977f,80.5382f,2.70526f}, + {-947.854f,-170.5f,79.7618f,0.942478f}, + {-946.738f,-139.567f,80.0904f,2.3911f}, + {-945.503f,-65.0654f,79.7907f,5.02655f}, + {-943.678f,-110.986f,80.2557f,0.959931f}, + {-942.993f,-56.9881f,79.8915f,5.65487f}, + {-938.197f,-155.838f,61.3111f,1.65806f}, + {-930.488f,-214.524f,72.1431f,2.1236f}, + {-929.947f,-154.449f,61.5084f,1.67552f}, + {-927.412f,-135.313f,61.1987f,3.29867f}, + {-920.677f,-156.859f,62.8033f,3.15306f}, + {-916.75f,-136.094f,62.2357f,0.0698132f}, + {-915.319f,-132.718f,62.562f,1.16984f}, + {-913.589f,-146.794f,76.9366f,1.8675f}, + {-907.572f,-148.937f,76.6898f,4.76475f}, + {-902.02f,-64.6174f,73.9707f,1.19169f}, + {-899.489f,-61.7252f,73.2498f,5.09636f}, + {-894.792f,-127.141f,75.3834f,6.14356f}, + {-892.408f,-162.525f,64.1212f,2.69884f}, + {-892.326f,-123.158f,76.0318f,5.5676f}, + {-888.468f,-148.462f,61.8012f,1.65806f}, + {-883.268f,-159.738f,63.5311f,5.20108f}, + {-877.76f,-118.07f,65.215f,2.94961f}, + {-876.792f,-128.646f,64.1045f,3.40339f}, + {-874.901f,-36.6579f,69.4246f,2.00713f}, + {-874.856f,-151.351f,62.7537f,3.57875f}, + {-872.135f,-150.08f,62.7513f,3.57201f}, + {-870.288f,-149.217f,62.5413f,3.56624f}, + {-870.03f,-6.27443f,70.3867f,2.3911f}, + {-869.023f,-82.2118f,69.5848f,3.22886f}, + {-866.354f,-40.2455f,70.842f,0.0698132f}, + {-865.305f,-152.302f,63.5044f,4.86947f}, + {-861.926f,-79.0519f,71.4178f,0.20944f}, + {-857.292f,-152.277f,63.2114f,4.18879f}, + {-853.357f,-0.696194f,72.0655f,0.994838f}, + {-850.685f,-14.2596f,70.2298f,0.20944f}, + {-839.987f,-67.7695f,72.7916f,4.93928f}, + {-839.199f,-57.0558f,73.4891f,1.67552f}, + {-836.963f,-153.224f,63.3821f,4.46804f}, + {-832.721f,-67.7555f,72.9062f,4.99164f}, + {-821.496f,-143.095f,63.1292f,0.541052f}, + {-818.829f,-153.004f,62.1757f,6.12611f}, + //special + {-954.622f,-110.958f,80.7911f,6.24828f}, + {-951.477f,-53.9647f,80.0235f,5.32325f}, + {-946.812f,-126.04f,78.8601f,5.15265f}, + {-940.689f,-140.707f,79.9225f,2.79253f}, + {-933.954f,-159.632f,60.778f,2.56563f}, + {-922.537f,-130.291f,61.3756f,4.95674f}, + {-915.862f,-151.74f,76.9427f,0.942478f}, + {-888.321f,-159.831f,62.5303f,1.20428f}, + {-874.361f,-42.4751f,69.4316f,0.785398f}, + {-873.19f,-50.4899f,70.0568f,-2.41288f}, + {-868.511f,-148.386f,62.3547f,3.57875f}, + {-868.44f,-121.649f,64.5056f,3.33358f}, + {-868.324f,-77.7196f,71.4768f,5.41052f}, + {-859.846f,-19.6549f,70.7304f,1.97222f}, + {-828.05f,-150.508f,62.2019f,2.14675f}, + {-826.254f,-58.6911f,72.0041f,3.68264f}, + {-976.086f,-44.1775f,76.029f,1.46608f}, + {-971.864f,-87.4223f,81.4954f,5.8294f}, + {-966.551f,-74.1111f,80.0243f,4.2129f}, + {-958.509f,-173.652f,77.9013f,6.24828f}, + {-951.511f,-181.242f,65.529f,4.39823f}, + {-940.967f,-186.243f,77.698f,1.28164f}, + {-930.004f,-65.0898f,79.077f,0.0581657f}, + {-920.864f,-40.2009f,78.256f,5.16617f}, + {-919.089f,-148.021f,62.0317f,2.59327f}, + {-901.516f,-116.329f,75.6876f,0.471239f}, + {-897.864f,-84.4348f,74.083f,3.00197f}, + {-897.617f,-52.0457f,71.9503f,4.36332f}, + {-894.891f,-153.951f,61.6827f,3.23569f}, + {-893.933f,-111.625f,75.6591f,4.22536f}, + {-883.265f,-152.854f,61.8384f,0.0941087f}, + {-868.293f,-147.243f,62.1097f,3.2056f}, + {-867.501f,-11.8709f,70.018f,6.14356f}, + {-866.699f,-147.54f,62.1646f,3.57878f}, + {-866.566f,-91.1916f,67.4414f,4.56707f}, + {-857.272f,-141.142f,61.7356f,4.17134f}, + {-847.446f,-98.0061f,68.5131f,3.24631f}, + {-837.026f,-140.729f,62.5141f,5.51524f}, + {-824.204f,-65.053f,72.3381f,3.01942f}, + //vermin (s.th special for this mine) + {-951.955f,-197.5f,77.212f,5.63741f}, + {-944.837f,-199.608f,77.0737f,4.97419f}, + {-933.494f,-209.063f,73.7803f,5.88176f}, + {-929.666f,-201.308f,73.7032f,5.02655f}, + {-978.997f,-249.356f,65.4345f,5.05464f}, + {-974.565f,-224.828f,69.5858f,4.88846f}, + {-946.514f,-259.239f,66.0874f,3.78132f}, + {-918.402f,-250.439f,69.5271f,2.21352f}, + {-910.14f,-229.959f,72.9279f,0.27677f}, + {-851.563f,-88.6527f,68.5983f,3.61896f}, + //boss + {-848.902f,-92.931f,68.6325f,3.33350}, + //herald + {-48.459f,-288.802f,55.47f,1.0}, + //triggers + {637.083,-32.6603,45.9715,1.14353}, //firstaid_station + {669.007f,-294.078f,30.2909f,2.77507f}, //stormpike_grave + {77.8013f,-404.7f,46.7549f,-0.872665f}, //stoneheart_grave + {-202.581f,-112.73f,78.4876f,-0.715585f}, //snowfall_grave + {-611.962f,-396.17f,60.8351f,2.53682f}, //iceblood_grave + {-1082.45f,-346.823f,54.9219f,-1.53589f}, //frostwolf_grave + {-1402.21f,-307.431f,89.4424f,0.191986f}, //frostwolf_hut + {553.779f,-78.6566f,51.9378f,-1.22173f}, //dunbaldar_south + {674.001f,-143.125f,63.6615f,0.994838f}, //dunbaldar_north + {203.281f,-360.366f,56.3869f,-0.925024}, //icewing_bunker + {-152.437f,-441.758f,40.3982f,-1.95477f}, //stoneheart_bunker + {-571.88f,-262.777f,75.0087f,-0.802851f}, //iceblood_tower + {-768.907f,-363.71f,90.8949f,1.07991f}, //tower_point + {-1302.9f,-316.981f,113.867f,2.00713f}, //frostwolf_etower + {-1297.5f,-266.767f,114.15f,3.31044f}, //frostwolf_wtower + {-57.7891f,-286.597f,15.6479f,6.02139f}, //AV_NPC_A_CAPTAIN balinda + {722.43f,-10.9982f,50.7046f,3.42085f}, //AV_NPC_A_BOSS vanndar + {-545.23f,-165.35f,57.7886f,3.01145f}, //AV_NPC_H_CAPTAIN galvangar + {-1370.9f,-219.793f,98.4258f,5.04381f} //AV_NPC_H_BOSS drek thar +}; + +enum BG_AV_CreatureIds +{ + + AV_NPC_A_GRAVEDEFENSE0 = 0, // stormpike Defender + AV_NPC_A_GRAVEDEFENSE1 = 1, // seasoned defender + AV_NPC_A_GRAVEDEFENSE2 = 2, // veteran defender + AV_NPC_A_GRAVEDEFENSE3 = 3, // champion defender + AV_NPC_A_TOWERDEFENSE = 4, // stormpike bowman + AV_NPC_A_CAPTAIN = 5, // balinda + AV_NPC_A_BOSS = 6, // vanndar + + AV_NPC_H_GRAVEDEFENSE0 = 7, // frostwolf guardian + AV_NPC_H_GRAVEDEFENSE1 = 8, // seasoned guardian + AV_NPC_H_GRAVEDEFENSE2 = 9, // veteran guardian + AV_NPC_H_GRAVEDEFENSE3 = 10, // champion guardian + AV_NPC_H_TOWERDEFENSE = 11, // frostwolf bowman + AV_NPC_H_CAPTAIN = 12, // galvangar + AV_NPC_H_BOSS = 13, // drek thar + + AV_NPC_A_MARSHAL_SOUTH = 14, + AV_NPC_MARSHAL_NORTH = 15, + AV_NPC_A_MARSHAL_ICE = 16, + AV_NPC_A_MARSHAL_STONE = 17, + AV_NPC_H_MARSHAL_ICE = 18, + AV_NPC_H_MARSHAL_TOWER = 19, + AV_NPC_MARSHAL_ETOWER = 20, + AV_NPC_H_MARSHAL_WTOWER= 21, + AV_NPC_N_MINE_N_1 = 22, + AV_NPC_N_MINE_N_2 = 23, + AV_NPC_N_MINE_N_3 = 24, + AV_NPC_N_MINE_N_4 = 25, + AV_NPC_N_MINE_A_1 = 26, + AV_NPC_N_MINE_A_2 = 27, + AV_NPC_N_MINE_A_3 = 28, + AV_NPC_N_MINE_A_4 = 29, + AV_NPC_N_MINE_H_1 = 30, + AV_NPC_N_MINE_H_2 = 31, + AV_NPC_N_MINE_H_3 = 32, + AV_NPC_N_MINE_H_4 = 33, + AV_NPC_S_MINE_N_1 = 34, + AV_NPC_S_MINE_N_2 = 35, + AV_NPC_S_MINE_N_3 = 36, + AV_NPC_S_MINE_N_4 = 37, + AV_NPC_S_MINE_N_S = 38, + AV_NPC_S_MINE_A_1 = 39, + AV_NPC_S_MINE_A_2 = 40, + AV_NPC_S_MINE_A_3 = 41, + AV_NPC_S_MINE_A_4 = 42, + AV_NPC_S_MINE_H_1 = 43, + AV_NPC_S_MINE_H_2 = 44, + AV_NPC_S_MINE_H_3 = 45, + AV_NPC_S_MINE_H_4 = 46, + AV_NPC_HERALD = 47, + AV_NPC_INFO_MAX = 48 + +}; + +//entry, team, minlevel, maxlevel +//TODO this array should be removed, the only needed things are the entrys (for spawning(?) and handlekillunit) +const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = { + { 12050, 1216, 58, 58 }, //Stormpike Defender + { 13326, 1216, 59, 59 }, //Seasoned Defender + { 13331, 1216, 60, 60 }, //Veteran Defender + { 13422, 1216, 61, 61 }, //Champion Defender + { 13358, 1216, 59, 60 }, //Stormpike Bowman //i think its 60,61 and 69,70.. but this is until now not possible TODO look if this is ok + { 11949,469,0,0},//not spawned with this data, but used for handlekillunit + { 11948,469,0,0},//not spawned with this data, but used for handlekillunit + { 12053, 1214, 58, 58 }, //Frostwolf Guardian + { 13328, 1214, 59, 59 }, //Seasoned Guardian + { 13332, 1214, 60, 60 }, //Veteran Guardian + { 13421, 1214, 61, 61 }, //Champion Guardian + { 13359, 1214, 59, 60 }, //Frostwolf Bowman + { 11947,67,0,0}, //not spawned with this data, but used for handlekillunit + { 11946,67,0,0}, //not spawned with this data, but used for handlekillunit + { 14763, 1534, 60, 60 }, //Dun Baldar South Marshal + { 14762, 1534, 60, 60 }, //Dun Baldar North Marshal + { 14764, 1534, 60, 60 }, //Icewing Marshal + { 14765, 1534, 60, 60 }, //Stonehearth Marshal + + { 14773, 1214, 60, 60 }, //Iceblood Warmaster + { 14776, 1214, 60, 60 }, //Tower Point Warmaster + { 14772, 1214, 60, 60 }, //East Frostwolf Warmaster + { 14777, 1214, 60, 60 }, //West Frostwolf Warmaster + + { 10987, 59, 52, 53 }, //Irondeep Trogg + { 11600, 59, 53, 54 }, //Irondeep Shaman + { 11602, 59, 54, 55 }, //Irondeep Skullthumper + { 11657, 59, 58, 58 }, //Morloch + + {13396,469,52,53}, //irondeep alliance TODO: get the right ids + {13080,469,53,54}, + {13098,469,54,55}, + {13078,469,58,58}, + + {13397,67,52,53}, //irondeep horde + {13099,67,53,54}, + {13081,67,54,55}, + {13079,67,58,58}, + + { 11603, 59, 52, 53 }, //south mine neutral + { 11604, 59, 53, 54 }, + { 11605, 59, 54, 55 }, + { 11677, 59, 58, 58 }, + { 10982, 59, 52, 53 }, //vermin + + {13317,469,52,53}, //alliance + {13096,469,54,55}, //explorer + {13087,469,54,55}, //invader + {13086,469,58,58}, + + {13316,67,52,53}, //horde + {13097,67,54,55}, //surveypr + {13089,67,54,55}, //guard + {13088,67,58,58}, + {14848,67,58,58} //Herald + +}; + +//x,y,z,o,static_creature_info-id +const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] = { //static creatures + {-1235.31f,-340.777f,60.5088f,3.31613f,0 },//2225 - Zora Guthrek + {-1244.02f,-323.795f,61.0485f,5.21853f,1 },//3343 - Grelkor + {-1235.16f,-332.302f,60.2985f,2.96706f,2 },//3625 - Rarck + {587.303f,-42.8257f,37.5615f,5.23599f,3 },//4255 - Brogus Thunderbrew + {643.635f,-58.3987f,41.7405f,4.72984f,4 },//4257 - Lana Thunderbrew + {591.464f,-44.452f,37.6166f,5.65487f,5 },//5134 - Jonivera Farmountain + {608.515f,-33.3935f,42.0003f,5.41052f,6 },//5135 - Svalbrad Farmountain + {617.656f,-32.0701f,42.7168f,4.06662f,7 },//5139 - Kurdrum Barleybeard + {-1183.76f,-268.295f,72.8233f,3.28122f,8 },//10364 - Yaelika Farclaw + {-1187.86f,-275.31f,73.0481f,3.63028f,9 },//10367 - Shrye Ragefist + {-1008.42f,-368.006f,55.3426f,5.95647f,10 },//10981 - Frostwolf + {-1091.92f,-424.28f,53.0139f,2.93958f,10 },//10981 - Frostwolf + {-558.455f,-198.768f,58.1755f,4.97946f,10 },//10981 - Frostwolf + {-861.247f,-312.51f,55.1427f,3.35382f,10 },//10981 - Frostwolf + {-1003.81f,-395.913f,50.4736f,2.85631f,10 },//10981 - Frostwolf + {-904.5f,-289.815f,65.1222f,5.7847f,10 },//10981 - Frostwolf + {-1064.41f,-438.839f,51.3614f,1.88857f,10 },//10981 - Frostwolf + {258.814f,76.2017f,18.6468f,6.19052f,11 },//10986 - Snowblind Harpy + {265.838f,-315.846f,-16.5429f,3.15917f,11 },//10986 - Snowblind Harpy + {426.485f,-51.1927f,-5.66286f,1.60347f,11 },//10986 - Snowblind Harpy + {452.044f,-33.9594f,-0.044651f,2.72815f,11 },//10986 - Snowblind Harpy + {266.032f,-315.639f,-16.5429f,4.67962f,11 },//10986 - Snowblind Harpy + {532.64f,-54.5863f,20.7024f,2.93215f,11 },//10986 - Snowblind Harpy + {295.183f,-299.908f,-34.6123f,0.135851f,12 },//10990 - Alterac Ram + {421.08f,-225.006f,-23.73f,0.166754f,12 },//10990 - Alterac Ram + {-55.7766f,-192.498f,20.4352f,6.12221f,12 },//10990 - Alterac Ram + {527.887f,-477.223f,62.3559f,0.170935f,12 },//10990 - Alterac Ram + {389.144f,-346.508f,-30.334f,4.14117f,12 },//10990 - Alterac Ram + {108.121f,-322.248f,37.5655f,4.46788f,12 },//10990 - Alterac Ram + {507.479f,-67.9403f,10.3571f,3.26304f,12 },//10990 - Alterac Ram + {329.071f,-185.016f,-29.1542f,0.356943f,12 },//10990 - Alterac Ram + {252.449f,-422.313f,35.1404f,4.53771f,12 },//10990 - Alterac Ram + {358.882f,-118.061f,-24.9119f,2.29257f,12 },//10990 - Alterac Ram + {487.151f,-174.229f,14.7558f,4.73192f,12 },//10990 - Alterac Ram + {449.652f,-123.561f,6.14273f,6.12029f,12 },//10990 - Alterac Ram + {272.419f,-261.802f,-41.8835f,3.66559f,12 },//10990 - Alterac Ram + {359.021f,-210.954f,-29.3483f,4.31339f,12 },//10990 - Alterac Ram + {450.598f,-318.048f,-37.7548f,0.655219f,12 },//10990 - Alterac Ram + {509.333f,-218.2f,3.05439f,3.66292f,12 },//10990 - Alterac Ram + {485.771f,-223.613f,-1.53f,2.04862f,12 },//10990 - Alterac Ram + {486.636f,-452.172f,39.6592f,2.3341f,12 },//10990 - Alterac Ram + {702.783f,-257.494f,25.9777f,1.68329f,12 },//10990 - Alterac Ram + {460.942f,-199.263f,-6.0149f,0.380506f,12 },//10990 - Alterac Ram + {483.108f,-115.307f,10.1056f,3.69701f,12 },//10990 - Alterac Ram + {471.601f,-154.174f,14.0702f,5.5807f,12 },//10990 - Alterac Ram + {213.938f,-420.793f,41.2549f,5.71394f,12 },//10990 - Alterac Ram + {289.387f,-294.685f,-33.9073f,0.555494f,12 },//10990 - Alterac Ram + {155.649f,-402.891f,43.3915f,5.94838f,12 },//10990 - Alterac Ram + {517.184f,-295.105f,-9.78195f,6.05668f,12 },//10990 - Alterac Ram + {102.334f,-332.165f,38.9812f,3.31445f,12 },//10990 - Alterac Ram + {320.244f,-107.793f,-42.6357f,-1.00311f,12 },//10990 - Alterac Ram + {217.976f,110.774f,15.7603f,4.56793f,13 },//11675 - Snowblind Windcaller + {269.872f,6.66684f,20.7592f,0.381212f,13 },//11675 - Snowblind Windcaller + {313.528f,-319.041f,-27.2373f,0.554098f,13 },//11675 - Snowblind Windcaller + {435.441f,-39.9289f,-0.169651f,0.549454f,13 },//11675 - Snowblind Windcaller + {315.115f,-317.62f,-29.1123f,0.90111f,13 },//11675 - Snowblind Windcaller + {428.091f,-122.731f,3.40332f,6.05901f,14 },//11678 - Snowblind Ambusher + {235.05f,85.5705f,18.3079f,-0.914255f,14 },//11678 - Snowblind Ambusher + {-1553.04f,-344.342f,64.4163f,6.09933f,15 },//11839 - Wildpaw Brute + {-545.23f,-165.35f,57.7886f,3.01145f,16 },//11947 - Captain Galvangar + {722.43f,-10.9982f,50.7046f,3.42085f,17 },//11948 - Vanndar Stormpike + {-57.7891f,-286.597f,15.6479f,6.02139f,18 },//11949 - Captain Balinda Stonehearth + {930.498f,-520.755f,93.7334f,1.8326f,19 },//11997 - Stormpike Herald + {-776.092f,-345.161f,67.4092f,1.89257f,20 },//12051 - Frostwolf Legionnaire + {-1224.63f,-308.144f,65.0087f,4.01139f,20 },//12051 - Frostwolf Legionnaire + {-713.039f,-442.515f,82.8638f,0.68724f,20 },//12051 - Frostwolf Legionnaire + {-711.783f,-444.061f,82.7039f,0.683494f,20 },//12051 - Frostwolf Legionnaire + {587.633f,-45.9816f,37.5438f,5.81195f,21 },//12096 - Stormpike Quartermaster + {-1293.79f,-194.407f,72.4398f,5.84685f,22 },//12097 - Frostwolf Quartermaster + {446.163f,-377.119f,-1.12725f,0.209526f,23 },//12127 - Stormpike Guardsman + {549.348f,-399.254f,53.3537f,3.24729f,23 },//12127 - Stormpike Guardsman + {549.801f,-401.217f,53.8305f,3.24729f,23 },//12127 - Stormpike Guardsman + {192.704f,-406.874f,42.9183f,6.10696f,23 },//12127 - Stormpike Guardsman + {441.305f,-435.765f,28.2385f,2.14472f,23 },//12127 - Stormpike Guardsman + {192.982f,-404.891f,43.0132f,6.1061f,23 },//12127 - Stormpike Guardsman + {355.342f,-391.989f,-0.486707f,3.00643f,23 },//12127 - Stormpike Guardsman + {446.035f,-375.104f,-1.12725f,0.21033f,23 },//12127 - Stormpike Guardsman + {697.864f,-433.238f,62.7914f,1.65776f,23 },//12127 - Stormpike Guardsman + {610.74f,-331.585f,30.8021f,5.14253f,23 },//12127 - Stormpike Guardsman + {609.815f,-329.775f,30.9271f,-2.38829f,23 },//12127 - Stormpike Guardsman + {695.874f,-433.434f,62.8543f,1.65776f,23 },//12127 - Stormpike Guardsman + {443.337f,-435.283f,28.6842f,2.13768f,23 },//12127 - Stormpike Guardsman + {-1251.5f,-316.327f,62.6565f,5.02655f,24 },//13176 - Smith Regzar + {-1332.0f,-331.243f,91.2631f,1.50098f,25 },//13179 - Wing Commander Guse + {569.983f,-94.9992f,38.0325f,1.39626f,26 },//13216 - Gaelden Hammersmith + {-1244.92f,-308.916f,63.2525f,1.62316f,27 },//13218 - Grunnda Wolfheart + {-1319.56f,-342.675f,60.3404f,1.20428f,28 },//13236 - Primalist Thurloga + {647.61f,-61.1548f,41.7405f,4.24115f,29 },//13257 - Murgot Deepforge + {-1321.64f,-343.73f,60.4833f,1.01229f,30 },//13284 - Frostwolf Shaman + {-1317.61f,-342.853f,60.3726f,2.47837f,30 },//13284 - Frostwolf Shaman + {-1319.31f,-344.475f,60.3825f,1.72788f,30 },//13284 - Frostwolf Shaman + {569.963f,-42.0218f,37.7581f,4.27606f,31 },//13438 - Wing Commander Slidore + {729.2f,-78.812f,51.6335f,3.97935f,32 },//13442 - Arch Druid Renferal + {729.118f,-82.8713f,51.6335f,2.53073f,33 },//13443 - Druid of the Grove + {725.554f,-79.4973f,51.6335f,5.27089f,33 },//13443 - Druid of the Grove + {724.768f,-84.1642f,51.6335f,0.733038f,33 },//13443 - Druid of the Grove + {596.68f,-83.0633f,39.0051f,6.24828f,34 },//13447 - Corporal Noreg Stormpike + {600.032f,-2.92475f,42.0788f,5.00909f,35 },//13577 - Stormpike Ram Rider Commander + {610.239f,-21.8454f,43.272f,4.90438f,36 },//13617 - Stormpike Stable Master + {613.422f,-150.764f,33.4517f,5.55015f,37 },//13797 - Mountaineer Boombellow + {-1213.91f,-370.619f,56.4455f,0.837758f,38 },//13798 - Jotek + {704.35f,-22.9071f,50.2187f,0.785398f,39 },//13816 - Prospector Stonehewer + {-1271.24f,-335.766f,62.3971f,5.75959f,40 },//14185 - Najak Hexxen + {-1268.64f,-332.688f,62.6171f,5.28835f,41 },//14186 - Ravak Grimtotem + {648.363f,-65.2233f,41.7405f,3.12414f,42 },//14187 - Athramanis + {648.238f,-67.8931f,41.7405f,2.60054f,43 },//14188 - Dirk Swindle + {-1223.44f,-309.833f,64.9331f,4.0131f,44 },//14282 - Frostwolf Bloodhound + {-1226.4f,-307.136f,64.9706f,4.0145f,44 },//14282 - Frostwolf Bloodhound + {356.001f,-389.969f,-0.438796f,3.0334f,45 },//14283 - Stormpike Owl + {355.835f,-394.005f,-0.60149f,3.02498f,45 },//14283 - Stormpike Owl + {882.266f,-496.378f,96.7707f,4.83248f,45 },//14283 - Stormpike Owl + {878.649f,-495.917f,96.6171f,4.67693f,45 },//14283 - Stormpike Owl + {932.851f,-511.017f,93.6748f,3.61004f,45 },//14283 - Stormpike Owl + {935.806f,-513.983f,93.7436f,3.61788f,45 },//14283 - Stormpike Owl + {947.412f,-509.982f,95.1098f,2.82743f,46 },//14284 - Stormpike Battleguard + {934.557f,-512.395f,93.662f,3.61004f,46 },//14284 - Stormpike Battleguard + {939.42f,-502.777f,94.5887f,5.14872f,46 },//14284 - Stormpike Battleguard + {854.276f,-494.241f,96.8017f,5.44543f,46 },//14284 - Stormpike Battleguard + {776.621f,-487.775f,99.4049f,3.50811f,46 },//14284 - Stormpike Battleguard + {880.169f,-495.699f,96.6204f,4.8325f,46 },//14284 - Stormpike Battleguard + {773.651f,-497.482f,99.0408f,2.11185f,46 },//14284 - Stormpike Battleguard + {949.1f,-506.913f,95.4237f,3.31613f,46 },//14284 - Stormpike Battleguard + {-1370.9f,-219.793f,98.4258f,5.04381f,47}, //drek thar + +}; + +const uint32 BG_AV_StaticCreatureInfo[51][4] = { + { 2225, 1215, 55, 55 }, //Zora Guthrek + { 3343, 1215, 55, 55 }, //Grelkor + { 3625, 1215, 55, 55 }, //Rarck + { 4255, 1217, 55, 55 }, //Brogus Thunderbrew + { 4257, 1217, 55, 55 }, //Lana Thunderbrew + { 5134, 1217, 55, 55 }, //Jonivera Farmountain + { 5135, 1217, 55, 55 }, //Svalbrad Farmountain + { 5139, 1217, 55, 55 }, //Kurdrum Barleybeard + { 10364, 1215, 55, 55 }, //Yaelika Farclaw + { 10367, 1215, 55, 55 }, //Shrye Ragefist + { 10981, 38, 50, 51 }, //Frostwolf + { 10986, 514, 52, 53 }, //Snowblind Harpy + { 10990, 1274, 50, 51 }, //Alterac Ram + { 11675, 514, 53, 53 }, //Snowblind Windcaller + { 11678, 14, 52, 53 }, //Snowblind Ambusher + { 11839, 39, 56, 56 }, //Wildpaw Brute + { 11947, 1214, 61, 61 }, //Captain Galvangar --TODO: doubled + { 11948, 1216, 63, 63 }, //Vanndar Stormpike + { 11949, 1216, 61, 61 }, //Captain Balinda Stonehearth + { 11997, 1334, 60, 60 }, //Stormpike Herald + { 12051, 1214, 57, 57 }, //Frostwolf Legionnaire + { 12096, 1217, 55, 55 }, //Stormpike Quartermaster + { 12097, 1215, 55, 55 }, //Frostwolf Quartermaster + { 12127, 1216, 57, 57 }, //Stormpike Guardsman + { 13176, 1215, 60, 60 }, //Smith Regzar + { 13179, 1215, 59, 59 }, //Wing Commander Guse + { 13216, 1217, 58, 58 }, //Gaelden Hammersmith + { 13218, 1215, 58, 58 }, //Grunnda Wolfheart + { 13236, 1214, 60, 60 }, //Primalist Thurloga + { 13257, 1216, 60, 60 }, //Murgot Deepforge + { 13284, 1214, 58, 58 }, //Frostwolf Shaman + { 13438, 1217, 58, 58 }, //Wing Commander Slidore + { 13442, 1216, 60, 60 }, //Arch Druid Renferal + { 13443, 1216, 60, 60 }, //Druid of the Grove + { 13447, 1216, 58, 58 }, //Corporal Noreg Stormpike + { 13577, 1216, 60, 60 }, //Stormpike Ram Rider Commander + { 13617, 1216, 60, 60 }, //Stormpike Stable Master + { 13797, 32, 60, 61 }, //Mountaineer Boombellow + { 13798, 1214, 60, 61 }, //Jotek + { 13816, 1216, 61, 61 }, //Prospector Stonehewer + { 14185, 877, 59, 59 }, //Najak Hexxen + { 14186, 105, 60, 60 }, //Ravak Grimtotem + { 14187, 1594, 60, 60 }, //Athramanis + { 14188, 57, 59, 59 }, //Dirk Swindle + { 14282, 1214, 53, 54 }, //Frostwolf Bloodhound + { 14283, 1216, 53, 54 }, //Stormpike Owl + { 14284, 1216, 61, 61 }, //Stormpike Battleguard + { 11946, 1214, 63, 63 }, //Drek'Thar //TODO: make the levels right (boss=0 maybe) + { 11948, 1216, 63, 63 }, //Vanndar Stormpike + { 11947, 1214, 61, 61 }, //Captain Galvangar + { 11949, 1216, 61, 61 } //Captain Balinda Stonehearth +}; + +enum BG_AV_Graveyards +{ + AV_GRAVE_STORM_AID = 751, + AV_GRAVE_STORM_GRAVE = 689, + AV_GRAVE_STONE_GRAVE = 729, + AV_GRAVE_SNOWFALL = 169, + AV_GRAVE_ICE_GRAVE = 749, + AV_GRAVE_FROSTWOLF = 690, + AV_GRAVE_FROST_HUT = 750, + AV_GRAVE_MAIN_ALLIANCE = 611, + AV_GRAVE_MAIN_HORDE = 610 +}; + +const uint32 BG_AV_GraveyardIds[9]= { + AV_GRAVE_STORM_AID, + AV_GRAVE_STORM_GRAVE, + AV_GRAVE_STONE_GRAVE, + AV_GRAVE_SNOWFALL, + AV_GRAVE_ICE_GRAVE, + AV_GRAVE_FROSTWOLF, + AV_GRAVE_FROST_HUT, + AV_GRAVE_MAIN_ALLIANCE, + AV_GRAVE_MAIN_HORDE +}; + +enum BG_AV_BUFF +{ //TODO add all other buffs here + AV_BUFF_ARMOR = 21163, + AV_BUFF_A_CAPTAIN = 23693, //the buff which the alliance captain does + AV_BUFF_H_CAPTAIN = 22751 //the buff which the horde captain does +}; +enum BG_AV_States +{ + POINT_NEUTRAL = 0, + POINT_ASSAULTED = 1, + POINT_DESTROYED = 2, + POINT_CONTROLED = 3 +}; + +enum BG_AV_WorldStates +{ + AV_Alliance_Score = 3127, + AV_Horde_Score = 3128, + AV_SHOW_H_SCORE = 3133, + AV_SHOW_A_SCORE = 3134, + +/* + //the comments behind the state shows which icon overlaps the other.. but is, until now, unused and maybe not a good solution (but give few performance (:) + +// Graves + + // Alliance + //Stormpike first aid station + AV_AID_A_C = 1325, + AV_AID_A_A = 1326, + AV_AID_H_C = 1327, + AV_AID_H_A = 1328, + //Stormpike Graveyard + AV_PIKEGRAVE_A_C = 1333, + AV_PIKEGRAVE_A_A = 1335, + AV_PIKEGRAVE_H_C = 1334, + AV_PIKEGRAVE_H_A = 1336, + //Stoneheart Grave + AV_STONEHEART_A_C = 1302, + AV_STONEHEART_A_A = 1304, //over hc + AV_STONEHEART_H_C = 1301, //over ac + AV_STONEHEART_H_A = 1303, //over aa + //Neutral + //Snowfall Grave +*/ + AV_SNOWFALL_N = 1966, //over aa +/* + AV_SNOWFALL_A_C = 1341, //over hc + AV_SNOWFALL_A_A = 1343, //over ha + AV_SNOWFALL_H_C = 1342, + AV_SNOWFALL_H_A = 1344, //over ac + //Horde + //Iceblood grave + AV_ICEBLOOD_A_C = 1346, //over hc + AV_ICEBLOOD_A_A = 1348, //over ac + AV_ICEBLOOD_H_C = 1347, + AV_ICEBLOOD_H_A = 1349, //over aa + //Frostwolf Grave + AV_FROSTWOLF_A_C = 1337, //over hc + AV_FROSTWOLF_A_A = 1339, //over ac + AV_FROSTWOLF_H_C = 1338, + AV_FROSTWOLF_H_A = 1340, //over aa + //Frostwolf Hut + AV_FROSTWOLFHUT_A_C = 1329, //over hc + AV_FROSTWOLFHUT_A_A = 1331, //over ha + AV_FROSTWOLFHUT_H_C = 1330, + AV_FROSTWOLFHUT_H_A = 1332, //over ac + +//Towers + //Alliance + //Dunbaldar South Bunker + AV_DUNS_CONTROLLED = 1361, + AV_DUNS_DESTROYED = 1370, + AV_DUNS_ASSAULTED = 1378, + //Dunbaldar North Bunker + AV_DUNN_CONTROLLED = 1362, + AV_DUNN_DESTROYED = 1371, + AV_DUNN_ASSAULTED = 1379, + //Icewing Bunker + AV_ICEWING_CONTROLLED = 1363, + AV_ICEWING_DESTROYED = 1372, + AV_ICEWING_ASSAULTED = 1380, + //Stoneheart Bunker + AV_STONEH_CONTROLLED = 1364, + AV_STONEH_DESTROYED = 1373, + AV_STONEH_ASSAULTED = 1381, + //Horde + //Iceblood Tower + AV_ICEBLOOD_CONTROLLED = 1385, + AV_ICEBLOOD_DESTROYED = 1368, + AV_ICEBLOOD_ASSAULTED = 1390, + //Tower Point + AV_TOWERPOINT_CONTROLLED = 1384, + AV_TOWERPOINT_DESTROYED = 1367, //goes over controlled + AV_TOWERPOINT_ASSAULTED = 1389, //goes over destroyed + //Frostwolf West + AV_FROSTWOLFW_CONTROLLED = 1382, + AV_FROSTWOLFW_DESTROYED = 1365, //over controlled + AV_FROSTWOLFW_ASSAULTED = 1387, //over destroyed + //Frostwolf East + AV_FROSTWOLFE_CONTROLLED = 1383, + AV_FROSTWOLFE_DESTROYED = 1366, + AV_FROSTWOLFE_ASSAULTED = 1388, + +//mines + + AV_N_MINE_N = 1360, + AV_N_MINE_A = 1358, + AV_N_MINE_H = 1359, + + AV_S_MINE_N = 1357, + AV_S_MINE_A = 1355, + AV_S_MINE_H = 1356, + +//towers assaulted by own team (unused) + AV_STONEH_UNUSED = 1377, + AV_ICEWING_UNUSED = 1376, + AV_DUNS_UNUSED = 1375, + AV_DUNN_UNUSED = 1374, + + AV_ICEBLOOD_UNUSED = 1395, + AV_TOWERPOINT_UNUSED = 1394, + AV_FROSTWOLFE_UNUSED = 1393, + AV_FROSTWOLFW_UNUSED = 1392 +*/ + +}; + +//alliance_control neutral_control horde_control +const uint32 BG_AV_MineWorldStates[2][3] = { + {1358, 1360,1359}, + {1355, 1357,1356} +}; + +//alliance_control alliance_assault h_control h_assault +const uint32 BG_AV_NodeWorldStates[16][4] = { + //Stormpike first aid station + {1325, 1326,1327,1328}, + //Stormpike Graveyard + {1333,1335,1334,1336}, + //Stoneheart Grave + {1302,1304,1301,1303}, + //Snowfall Grave + {1341,1343,1342,1344}, + //Iceblood grave + {1346,1348,1347,1349}, + //Frostwolf Grave + {1337,1339,1338,1340}, + //Frostwolf Hut + {1329,1331,1330,1332}, + //Dunbaldar South Bunker + {1361,1375,1370,1378}, + //Dunbaldar North Bunker + {1362,1374,1371,1379}, + //Icewing Bunker + {1363,1376,1372,1380}, + //Stoneheart Bunker + {1364,1377,1373,1381}, + //Iceblood Tower + {1368,1390,1385,1395}, + //Tower Point + {1367,1389,1384,1394}, + //Frostwolf East + {1366,1388,1383,1393}, + //Frostwolf West + {1365,1387,1382,1392}, +}; + +enum BG_AV_QuestIds +{ + AV_QUEST_A_SCRAPS1 = 7223, + AV_QUEST_A_SCRAPS2 = 6781, + AV_QUEST_H_SCRAPS1 = 7224, + AV_QUEST_H_SCRAPS2 = 6741, + AV_QUEST_A_COMMANDER1 = 6942, //soldier + AV_QUEST_H_COMMANDER1 = 6825, + AV_QUEST_A_COMMANDER2 = 6941, //leutnant + AV_QUEST_H_COMMANDER2 = 6826, + AV_QUEST_A_COMMANDER3 = 6943, //commander + AV_QUEST_H_COMMANDER3 = 6827, + AV_QUEST_A_BOSS1 = 7386, // 5 cristal/blood + AV_QUEST_H_BOSS1 = 7385, + AV_QUEST_A_BOSS2 = 6881, // 1 + AV_QUEST_H_BOSS2 = 6801, + AV_QUEST_A_NEAR_MINE = 5892, //the mine near start location of team + AV_QUEST_H_NEAR_MINE = 5893, + AV_QUEST_A_OTHER_MINE = 6982, //the other mine ;) + AV_QUEST_H_OTHER_MINE = 6985, + AV_QUEST_A_RIDER_HIDE = 7026, + AV_QUEST_H_RIDER_HIDE = 7002, + AV_QUEST_A_RIDER_TAME = 7027, + AV_QUEST_H_RIDER_TAME = 7001 +}; + +struct BG_AV_NodeInfo +{ + uint16 TotalOwner; + uint16 Owner; + uint16 PrevOwner; + BG_AV_States State; + BG_AV_States PrevState; + int Timer; + bool Tower; +}; + +inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); } + +class BattleGroundAVScore : public BattleGroundScore +{ + public: + BattleGroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) {}; + virtual ~BattleGroundAVScore() {}; + uint32 GraveyardsAssaulted; + uint32 GraveyardsDefended; + uint32 TowersAssaulted; + uint32 TowersDefended; + uint32 MinesCaptured; + uint32 LeadersKilled; + uint32 SecondaryObjectives; +}; + +class BattleGroundAV : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundAV(); + ~BattleGroundAV(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr,uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + virtual void ResetBGSubclass(); + + /*general stuff*/ + void UpdateScore(uint16 team, int16 points); + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + + /*handlestuff*/ //these are functions which get called from extern + virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); + void HandleKillPlayer(Player* player, Player *killer); + void HandleKillUnit(Creature *unit, Player *killer); + void HandleQuestComplete(uint32 questid, Player *player); + bool PlayerCanDoMineQuest(int32 GOId,uint32 team); + + void EndBattleGround(uint32 winner); + + virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + + private: + /* Nodes occupying */ + void EventPlayerAssaultsPoint(Player* player, uint32 object); + void EventPlayerDefendsPoint(Player* player, uint32 object); + void EventPlayerDestroyedPoint(BG_AV_Nodes node); + + void AssaultNode(BG_AV_Nodes node,uint16 team); + void DestroyNode(BG_AV_Nodes node); + void InitNode(BG_AV_Nodes node, uint16 team, bool tower); + void DefendNode(BG_AV_Nodes node, uint16 team); + + void PopulateNode(BG_AV_Nodes node); + void DePopulateNode(BG_AV_Nodes node); + + const BG_AV_Nodes GetNodeThroughObject(uint32 object); + const uint32 GetObjectThroughNode(BG_AV_Nodes node); + const char* GetNodeName(BG_AV_Nodes node); + const bool IsTower(BG_AV_Nodes node) { return m_Nodes[node].Tower; } + + /*mine*/ + void ChangeMineOwner(uint8 mine, uint32 team, bool initial=false); + + /*worldstates*/ + void FillInitialWorldStates(WorldPacket& data); + const uint8 GetWorldStateType(uint8 state, uint16 team); + void SendMineWorldStates(uint32 mine); + void UpdateNodeWorldState(BG_AV_Nodes node); + + /*general */ + Creature* AddAVCreature(uint16 cinfoid, uint16 type); + const uint16 GetBonusHonor(uint8 kills); //TODO remove this when the core handles this right + + /*variables */ + int32 m_Team_Scores[2]; + uint32 m_Team_QuestStatus[2][9]; //[x][y] x=team y=questcounter + + BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX]; + + uint32 m_Mine_Owner[2]; + uint32 m_Mine_PrevOwner[2]; //only for worldstates needed + int32 m_Mine_Timer; //ticks for both teams + uint32 m_Mine_Reclaim_Timer[2]; + uint32 m_CaptainBuffTimer[2]; + bool m_CaptainAlive[2]; + + uint8 m_MaxLevel; //TODO remove this when battleground-getmaxlevel() returns something usefull + bool m_IsInformedNearVictory[2]; + +}; + +#endif + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundBE.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundBE.cpp new file mode 100644 index 0000000..d6debe4 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundBE.cpp @@ -0,0 +1,201 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundBE.h" +#include "Language.h" +#include "Object.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "WorldPacket.h" + +BattleGroundBE::BattleGroundBE() +{ + m_BgObjects.resize(BG_BE_OBJECT_MAX); + + m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; + m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; + m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; + m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + //we must set messageIds + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; +} + +BattleGroundBE::~BattleGroundBE() +{ + +} + +void BattleGroundBE::Update(uint32 diff) +{ + BattleGround::Update(diff); + + /*if (GetStatus() == STATUS_IN_PROGRESS) + { + // update something + }*/ +} + +void BattleGroundBE::StartingEventCloseDoors() +{ + for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + + for (uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i) + SpawnBGObject(i, RESPAWN_ONE_DAY); +} + +void BattleGroundBE::StartingEventOpenDoors() +{ + for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; ++i) + DoorOpen(i); + + for (uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i) + SpawnBGObject(i, 60); +} + +void BattleGroundBE::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundBEScore* sc = new BattleGroundBEScore; + + m_PlayerScores[plr->GetGUID()] = sc; + + UpdateArenaWorldState(); +} + +void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) +{ + if (GetStatus() == STATUS_WAIT_LEAVE) + return; + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + if (!killer) + { + sLog.outError("Killer player not found"); + return; + } + + BattleGround::HandleKillPlayer(player,killer); + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +bool BattleGroundBE::HandlePlayerUnderMap(Player *player) +{ + player->TeleportTo(GetMapId(),6238.930176,262.963470,0.889519,player->GetOrientation(),false); + return true; +} + +void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + //uint32 SpellId = 0; + //uint64 buff_guid = 0; + switch(Trigger) + { + case 4538: // buff trigger? + //buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1]; + break; + case 4539: // buff trigger? + //buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_2]; + break; + default: + sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } + + //if (buff_guid) + // HandleTriggerBuff(buff_guid,Source); +} + +void BattleGroundBE::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(0x9f3) << uint32(1); // 9 + UpdateArenaWorldState(); +} + +void BattleGroundBE::Reset() +{ + //call parent's class reset + BattleGround::Reset(); +} + +bool BattleGroundBE::SetupBattleGround() +{ + // gates + if (!AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_BE_OBJECT_DOOR_2, BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_BE_OBJECT_DOOR_3, BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_BE_OBJECT_DOOR_4, BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY) + // buffs + || !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120) + || !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)) + { + sLog.outErrorDb("BatteGroundBE: Failed to spawn some object!"); + return false; + } + + return true; +} + +void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) +{ + + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + if (itr == m_PlayerScores.end()) // player not found... + return; + + //there is nothing special in this score + BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor); + +} + +/* +21:45:46 id:231310 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86 +0000: 32 02 00 00 76 0e 00 00 00 00 00 00 09 00 f3 09 | 2...v........... +0010: 00 00 01 00 00 00 f1 09 00 00 01 00 00 00 f0 09 | ................ +0020: 00 00 02 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................ +0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................ +0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................ +0050: 00 00 00 00 00 00 | ...... + +spell 32724 - Gold Team +spell 32725 - Green Team +35774 Gold Team +35775 Green Team +*/ diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundBE.h b/src/server/game/BattleGrounds/Zones/BattleGroundBE.h new file mode 100644 index 0000000..760d4d2 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundBE.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BATTLEGROUNDBE_H +#define __BATTLEGROUNDBE_H + +class BattleGround; + +enum BattleGroundBEObjectTypes +{ + BG_BE_OBJECT_DOOR_1 = 0, + BG_BE_OBJECT_DOOR_2 = 1, + BG_BE_OBJECT_DOOR_3 = 2, + BG_BE_OBJECT_DOOR_4 = 3, + BG_BE_OBJECT_BUFF_1 = 4, + BG_BE_OBJECT_BUFF_2 = 5, + BG_BE_OBJECT_MAX = 6 +}; + +enum BattleGroundBEObjects +{ + BG_BE_OBJECT_TYPE_DOOR_1 = 183971, + BG_BE_OBJECT_TYPE_DOOR_2 = 183973, + BG_BE_OBJECT_TYPE_DOOR_3 = 183970, + BG_BE_OBJECT_TYPE_DOOR_4 = 183972, + BG_BE_OBJECT_TYPE_BUFF_1 = 184663, + BG_BE_OBJECT_TYPE_BUFF_2 = 184664 +}; + +class BattleGroundBEScore : public BattleGroundScore +{ + public: + BattleGroundBEScore() {}; + virtual ~BattleGroundBEScore() {}; +}; + +class BattleGroundBE : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundBE(); + ~BattleGroundBE(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr, uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + virtual void Reset(); + virtual void FillInitialWorldStates(WorldPacket &d); + void HandleKillPlayer(Player* player, Player *killer); + bool HandlePlayerUnderMap(Player * plr); + + /* Scorekeeping */ + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundDS.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundDS.cpp new file mode 100644 index 0000000..9036ef8 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundDS.cpp @@ -0,0 +1,182 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundDS.h" +#include "Language.h" +#include "Player.h" +#include "Object.h" +#include "ObjectMgr.h" +#include "WorldPacket.h" + +BattleGroundDS::BattleGroundDS() +{ + m_BgObjects.resize(BG_DS_OBJECT_MAX); + + m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; + m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; + m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; + m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + //we must set messageIds + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; +} + +BattleGroundDS::~BattleGroundDS() +{ + +} + +void BattleGroundDS::Update(uint32 diff) +{ + BattleGround::Update(diff); + if (getWaterFallTimer() < diff) + { + if (isWaterFallActive()) + { + setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); + for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) + SpawnBGObject(i, getWaterFallTimer()); + setWaterFallActive(false); + } + else + { + setWaterFallTimer(BG_DS_WATERFALL_DURATION); + for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + setWaterFallActive(true); + } + } + else + setWaterFallTimer(getWaterFallTimer() - diff); +} + +void BattleGroundDS::StartingEventCloseDoors() +{ + for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); +} + +void BattleGroundDS::StartingEventOpenDoors() +{ + for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i) + DoorOpen(i); + + for (uint32 i = BG_DS_OBJECT_BUFF_1; i <= BG_DS_OBJECT_BUFF_2; ++i) + SpawnBGObject(i, 60); + + setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); + setWaterFallActive(false); + + for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) + SpawnBGObject(i, getWaterFallTimer()); +} + +void BattleGroundDS::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundDSScore* sc = new BattleGroundDSScore; + + m_PlayerScores[plr->GetGUID()] = sc; + + UpdateArenaWorldState(); +} + +void BattleGroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +{ + if (GetStatus() == STATUS_WAIT_LEAVE) + return; + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +void BattleGroundDS::HandleKillPlayer(Player* player, Player* killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + if (!killer) + { + sLog.outError("BattleGroundDS: Killer player not found"); + return; + } + + BattleGround::HandleKillPlayer(player,killer); + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +void BattleGroundDS::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + switch(Trigger) + { + case 5347: + case 5348: + break; + default: + sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } +} + +bool BattleGroundDS::HandlePlayerUnderMap(Player *player) +{ + player->TeleportTo(GetMapId(), 1299.046, 784.825, 9.338, 2.422, false); + return true; +} + +void BattleGroundDS::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(3610) << uint32(1); // 9 show + UpdateArenaWorldState(); +} + +void BattleGroundDS::Reset() +{ + //call parent's class reset + BattleGround::Reset(); +} + + +bool BattleGroundDS::SetupBattleGround() +{ + // gates + if (!AddObject(BG_DS_OBJECT_DOOR_1, BG_DS_OBJECT_TYPE_DOOR_1, 1350.95, 817.2, 20.8096, 3.15, 0, 0, 0.99627, 0.0862864, RESPAWN_IMMEDIATELY) + || !AddObject(BG_DS_OBJECT_DOOR_2, BG_DS_OBJECT_TYPE_DOOR_2, 1232.65, 764.913, 20.0729, 6.3, 0, 0, 0.0310211, -0.999519, RESPAWN_IMMEDIATELY) + // water + || !AddObject(BG_DS_OBJECT_WATER_1, BG_DS_OBJECT_TYPE_WATER_1, 1291.56, 790.837, 7.1, 3.14238, 0, 0, 0.694215, -0.719768, 120) + || !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56, 790.837, 7.1, 3.14238, 0, 0, 0.694215, -0.719768, 120) + // buffs + || !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7, 813.424, 7.11472, 4.64562, 0, 0, 0.730314, -0.683111, 120) + || !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7, 768.911, 7.11472, 1.55194, 0, 0, 0.700409, 0.713742, 120)) + { + sLog.outErrorDb("BatteGroundDS: Failed to spawn some object!"); + return false; + } + + return true; +} diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundDS.h b/src/server/game/BattleGrounds/Zones/BattleGroundDS.h new file mode 100644 index 0000000..2ced5c8 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundDS.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BATTLEGROUNDDS_H +#define __BATTLEGROUNDDS_H + +class BattleGround; + +enum BattleGroundDSObjectTypes +{ + BG_DS_OBJECT_DOOR_1 = 0, + BG_DS_OBJECT_DOOR_2 = 1, + BG_DS_OBJECT_WATER_1 = 2, + BG_DS_OBJECT_WATER_2 = 3, + BG_DS_OBJECT_BUFF_1 = 4, + BG_DS_OBJECT_BUFF_2 = 5, + BG_DS_OBJECT_MAX = 6 +}; + +enum BattleGroundDSObjects +{ + BG_DS_OBJECT_TYPE_DOOR_1 = 192642, + BG_DS_OBJECT_TYPE_DOOR_2 = 192643, + BG_DS_OBJECT_TYPE_WATER_1 = 194395, + BG_DS_OBJECT_TYPE_WATER_2 = 191877, + BG_DS_OBJECT_TYPE_BUFF_1 = 184663, + BG_DS_OBJECT_TYPE_BUFF_2 = 184664 +}; + +enum BattleGroundDSData +{ // These values are NOT blizzlike... need the correct data! + BG_DS_WATERFALL_TIMER_MIN = 30000, + BG_DS_WATERFALL_TIMER_MAX = 60000, + BG_DS_WATERFALL_DURATION = 10000, +}; + +class BattleGroundDSScore : public BattleGroundScore +{ + public: + BattleGroundDSScore() {}; + virtual ~BattleGroundDSScore() {}; + //TODO fix me +}; + +class BattleGroundDS : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundDS(); + ~BattleGroundDS(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr, uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + virtual void Reset(); + virtual void FillInitialWorldStates(WorldPacket &d); + void HandleKillPlayer(Player* player, Player *killer); + bool HandlePlayerUnderMap(Player * plr); + private: + uint32 m_waterTimer; + bool m_waterfallActive; + protected: + bool isWaterFallActive() { return m_waterfallActive; }; + void setWaterFallActive(bool active) { m_waterfallActive = active; }; + void setWaterFallTimer(uint32 timer) { m_waterTimer = timer; }; + uint32 getWaterFallTimer() { return m_waterTimer; }; +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundEY.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundEY.cpp new file mode 100644 index 0000000..20f023e --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundEY.cpp @@ -0,0 +1,938 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ObjectMgr.h" +#include "World.h" +#include "WorldPacket.h" +#include "BattleGroundMgr.h" +#include "BattleGround.h" +#include "BattleGroundEY.h" +#include "Creature.h" +#include "Language.h" +#include "Object.h" +#include "Player.h" +#include "Util.h" + +// these variables aren't used outside of this file, so declare them only here +uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = { + 330, // normal honor + 200 // holiday +}; + +BattleGroundEY::BattleGroundEY() +{ + m_BuffChange = true; + m_BgObjects.resize(BG_EY_OBJECT_MAX); + m_BgCreatures.resize(BG_EY_CREATURES_MAX); + m_Points_Trigger[FEL_REALVER] = TR_FEL_REALVER_BUFF; + m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF; + m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; + m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; + + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; +} + +BattleGroundEY::~BattleGroundEY() +{ +} + +void BattleGroundEY::Update(uint32 diff) +{ + BattleGround::Update(diff); + + if (GetStatus() == STATUS_IN_PROGRESS) + { + m_PointAddingTimer -= diff; + if (m_PointAddingTimer <= 0) + { + m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME; + if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0) + AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_ALLIANCE] - 1]); + if (m_TeamPointsCount[BG_TEAM_HORDE] > 0) + AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]); + } + + if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND) + { + m_FlagsTimer -= diff; + + if (m_FlagsTimer < 0) + { + m_FlagsTimer = 0; + if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN) + RespawnFlag(true); + else + RespawnFlagAfterDrop(); + } + } + + m_TowerCapCheckTimer -= diff; + if (m_TowerCapCheckTimer <= 0) + { + //check if player joined point + /*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times + but we can count of players on current point in CheckSomeoneLeftPoint + */ + this->CheckSomeoneJoinedPoint(); + //check if player left point + this->CheckSomeoneLeftPoint(); + this->UpdatePointStatuses(); + m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME; + } + } +} + +void BattleGroundEY::StartingEventCloseDoors() +{ + SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_IMMEDIATELY); + + for (uint32 i = BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER; i < BG_EY_OBJECT_MAX; ++i) + SpawnBGObject(i, RESPAWN_ONE_DAY); +} + +void BattleGroundEY::StartingEventOpenDoors() +{ + SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_ONE_DAY); + SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_ONE_DAY); + + for (uint32 i = BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER; i <= BG_EY_OBJECT_FLAG_NETHERSTORM; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + for (uint32 i = 0; i < EY_POINTS_MAX; ++i) + { + //randomly spawn buff + uint8 buff = urand(0, 2); + SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + buff + i * 3, RESPAWN_IMMEDIATELY); + } +} + +void BattleGroundEY::AddPoints(uint32 Team, uint32 Points) +{ + BattleGroundTeamId team_index = GetTeamIndexByTeamId(Team); + m_TeamScores[team_index] += Points; + m_HonorScoreTics[team_index] += Points; + if (m_HonorScoreTics[team_index] >= m_HonorTics) + { + RewardHonorToTeam(GetBonusHonorFromKill(1), Team); + m_HonorScoreTics[team_index] -= m_HonorTics; + } + UpdateTeamScore(Team); +} + +void BattleGroundEY::CheckSomeoneJoinedPoint() +{ + GameObject *obj = NULL; + for (uint8 i = 0; i < EY_POINTS_MAX; ++i) + { + obj = HashMapHolder::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REALVER + i]); + if (obj) + { + uint8 j = 0; + while (j < m_PlayersNearPoint[EY_POINTS_MAX].size()) + { + Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); + if (!plr) + { + sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); + ++j; + continue; + } + if (plr->CanCaptureTowerPoint() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS)) + { + //player joined point! + //show progress bar + UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, plr); + UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], plr); + UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, plr); + //add player to point + m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[EY_POINTS_MAX][j]); + //remove player from "free space" + m_PlayersNearPoint[EY_POINTS_MAX].erase(m_PlayersNearPoint[EY_POINTS_MAX].begin() + j); + } + else + ++j; + } + } + } +} + +void BattleGroundEY::CheckSomeoneLeftPoint() +{ + //reset current point counts + for (uint8 i = 0; i < 2*EY_POINTS_MAX; ++i) + m_CurrentPointPlayersCount[i] = 0; + GameObject *obj = NULL; + for (uint8 i = 0; i < EY_POINTS_MAX; ++i) + { + obj = HashMapHolder::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REALVER + i]); + if (obj) + { + uint8 j = 0; + while (j < m_PlayersNearPoint[i].size()) + { + Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[i][j]); + if (!plr) + { + sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); + //move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug + m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); + m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); + ++j; + continue; + } + if (!plr->CanCaptureTowerPoint() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS)) + //move player out of point (add him to players that are out of points + { + m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); + m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); + this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr); + } + else + { + //player is neat flag, so update count: + m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(plr->GetTeam())]++; + ++j; + } + } + } + } +} + +void BattleGroundEY::UpdatePointStatuses() +{ + for (uint8 point = 0; point < EY_POINTS_MAX; ++point) + { + if (m_PlayersNearPoint[point].empty()) + continue; + //count new point bar status: + m_PointBarStatus[point] += (m_CurrentPointPlayersCount[2 * point] - m_CurrentPointPlayersCount[2 * point + 1] < BG_EY_POINT_MAX_CAPTURERS_COUNT) ? m_CurrentPointPlayersCount[2 * point] - m_CurrentPointPlayersCount[2 * point + 1] : BG_EY_POINT_MAX_CAPTURERS_COUNT; + + if (m_PointBarStatus[point] > BG_EY_PROGRESS_BAR_ALI_CONTROLLED) + //point is fully alliance's + m_PointBarStatus[point] = BG_EY_PROGRESS_BAR_ALI_CONTROLLED; + if (m_PointBarStatus[point] < BG_EY_PROGRESS_BAR_HORDE_CONTROLLED) + //point is fully horde's + m_PointBarStatus[point] = BG_EY_PROGRESS_BAR_HORDE_CONTROLLED; + + uint32 pointOwnerTeamId = 0; + //find which team should own this point + if (m_PointBarStatus[point] <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW) + pointOwnerTeamId = HORDE; + else if (m_PointBarStatus[point] >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH) + pointOwnerTeamId = ALLIANCE; + else + pointOwnerTeamId = EY_POINT_NO_OWNER; + + for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i) + { + Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]); + if (plr) + { + this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); + //if point owner changed we must evoke event! + if (pointOwnerTeamId != m_PointOwnedByTeam[point]) + { + //point was uncontrolled and player is from team which captured point + if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId) + this->EventTeamCapturedPoint(plr, point); + + //point was under control and player isn't from team which controlled it + if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point]) + this->EventTeamLostPoint(plr, point); + } + } + } + } +} + +void BattleGroundEY::UpdateTeamScore(uint32 Team) +{ + uint32 score = GetTeamScore(Team); + //TODO there should be some sound played when one team is near victory!! - and define variables + /*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE) + { + if (Team == ALLIANCE) + SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + else + SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + PlaySoundToAll(BG_EY_SOUND_NEAR_VICTORY); + m_IsInformedNearVictory = true; + }*/ + + if (score >= BG_EY_MAX_TEAM_SCORE) + { + score = BG_EY_MAX_TEAM_SCORE; + EndBattleGround(Team); + } + + if (Team == ALLIANCE) + UpdateWorldState(EY_ALLIANCE_RESOURCES, score); + else + UpdateWorldState(EY_HORDE_RESOURCES, score); +} + +void BattleGroundEY::EndBattleGround(uint32 winner) +{ + //win reward + if (winner == ALLIANCE) + RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); + if (winner == HORDE) + RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); + //complete map reward + RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); + RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); + + BattleGround::EndBattleGround(winner); +} + +void BattleGroundEY::UpdatePointsCount(uint32 Team) +{ + if (Team == ALLIANCE) + UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]); + else + UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]); +} + +void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point) +{ + //we MUST firstly send 0, after that we can send 1!!! + if (m_PointState[Point] == EY_POINT_UNDER_CONTROL) + { + UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 0); + if (Team == ALLIANCE) + UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 1); + else + UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 1); + } + else + { + if (Team == ALLIANCE) + UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 0); + else + UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 0); + UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 1); + } +} + +void BattleGroundEY::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map + BattleGroundEYScore* sc = new BattleGroundEYScore; + + m_PlayersNearPoint[EY_POINTS_MAX].push_back(plr->GetGUID()); + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) +{ + // sometimes flag aura not removed :( + for (int j = EY_POINTS_MAX; j >= 0; --j) + { + for (size_t i = 0; i < m_PlayersNearPoint[j].size(); ++i) + if (m_PlayersNearPoint[j][i] == guid) + m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i); + } + if (IsFlagPickedup()) + { + if (m_FlagKeeper == guid) + { + if (plr) + EventPlayerDroppedFlag(plr); + else + { + SetFlagPicker(0); + RespawnFlag(true); + } + } + } +} + +void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + if (!Source->isAlive()) //hack code, must be removed later + return; + + switch(Trigger) + { + case TR_BLOOD_ELF_POINT: + if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam()) + if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_BLOOD_ELF); + break; + case TR_FEL_REALVER_POINT: + if (m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam()) + if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_FEL_REALVER); + break; + case TR_MAGE_TOWER_POINT: + if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam()) + if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_MAGE_TOWER); + break; + case TR_DRAENEI_RUINS_POINT: + if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam()) + if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID()) + EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_DRAENEI_RUINS); + break; + case 4512: + case 4515: + case 4517: + case 4519: + case 4530: + case 4531: + case 4568: + case 4569: + case 4570: + case 4571: + case 5866: + break; + default: + sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } +} + +bool BattleGroundEY::SetupBattleGround() +{ + // doors + if (!AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_EY_OBJECT_DOOR_H, BG_OBJECT_H_DOOR_EY_ENTRY, 1803.21f, 1539.49f, 1261.09f, 3.14159f, 0.173648f, 0, 0.984808f, 0, RESPAWN_IMMEDIATELY) + // banners (alliance) + || !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2047.19f, 1349.19f, 1189.0f, -1.62316f, 0, 0, 0.725374f, -0.688354f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_BLOOD_ELF_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2074.32f, 1385.78f, 1194.72f, 0.488692f, 0, 0, 0.241922f, 0.970296f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_BLOOD_ELF_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2025.13f, 1386.12f, 1192.74f, 2.3911f, 0, 0, 0.930418f, 0.366501f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2276.8f, 1400.41f, 1196.33f, 2.44346f, 0, 0, 0.939693f, 0.34202f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2305.78f, 1404.56f, 1199.38f, 1.74533f, 0, 0, 0.766044f, 0.642788f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2245.4f, 1366.41f, 1195.28f, 2.21657f, 0, 0, 0.894934f, 0.446198f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY) + // banners (horde) + || !AddObject(BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_FEL_REALVER_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_FEL_REALVER_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2047.19f, 1349.19f, 1189.0f, -1.62316f, 0, 0, 0.725374f, -0.688354f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_BLOOD_ELF_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2074.32f, 1385.78f, 1194.72f, 0.488692f, 0, 0, 0.241922f, 0.970296f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_BLOOD_ELF_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2025.13f, 1386.12f, 1192.74f, 2.3911f, 0, 0, 0.930418f, 0.366501f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2276.8f, 1400.41f, 1196.33f, 2.44346f, 0, 0, 0.939693f, 0.34202f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2305.78f, 1404.56f, 1199.38f, 1.74533f, 0, 0, 0.766044f, 0.642788f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2245.4f, 1366.41f, 1195.28f, 2.21657f, 0, 0, 0.894934f, 0.446198f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY) + // banners (natural) + || !AddObject(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_FEL_REALVER_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_FEL_REALVER_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2047.19f, 1349.19f, 1189.0f, -1.62316f, 0, 0, 0.725374f, -0.688354f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2074.32f, 1385.78f, 1194.72f, 0.488692f, 0, 0, 0.241922f, 0.970296f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2025.13f, 1386.12f, 1192.74f, 2.3911f, 0, 0, 0.930418f, 0.366501f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2276.8f, 1400.41f, 1196.33f, 2.44346f, 0, 0, 0.939693f, 0.34202f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2305.78f, 1404.56f, 1199.38f, 1.74533f, 0, 0, 0.766044f, 0.642788f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2245.4f, 1366.41f, 1195.28f, 2.21657f, 0, 0, 0.894934f, 0.446198f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY) + // flags + || !AddObject(BG_EY_OBJECT_FLAG_NETHERSTORM, BG_OBJECT_FLAG2_EY_ENTRY, 2174.782227f, 1569.054688f, 1160.361938f, -1.448624f, 0, 0, 0.662620f, -0.748956f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_FLAG_FEL_REALVER, BG_OBJECT_FLAG1_EY_ENTRY, 2044.28f, 1729.68f, 1189.96f, -0.017453f, 0, 0, 0.008727f, -0.999962f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_FLAG_BLOOD_ELF, BG_OBJECT_FLAG1_EY_ENTRY, 2048.83f, 1393.65f, 1194.49f, 0.20944f, 0, 0, 0.104528f, 0.994522f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_FLAG_DRAENEI_RUINS, BG_OBJECT_FLAG1_EY_ENTRY, 2286.56f, 1402.36f, 1197.11f, 3.72381f, 0, 0, 0.957926f, -0.287016f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_FLAG_MAGE_TOWER, BG_OBJECT_FLAG1_EY_ENTRY, 2284.48f, 1731.23f, 1189.99f, 2.89725f, 0, 0, 0.992546f, 0.121869f, RESPAWN_ONE_DAY) + // tower cap + || !AddObject(BG_EY_OBJECT_TOWER_CAP_FEL_REALVER, BG_OBJECT_FR_TOWER_CAP_EY_ENTRY, 2024.600708f, 1742.819580f, 1195.157715f, 2.443461f, 0, 0, 0.939693f, 0.342020f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_TOWER_CAP_BLOOD_ELF, BG_OBJECT_BE_TOWER_CAP_EY_ENTRY, 2050.493164f, 1372.235962f, 1194.563477f, 1.710423f, 0, 0, 0.754710f, 0.656059f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_TOWER_CAP_DRAENEI_RUINS, BG_OBJECT_DR_TOWER_CAP_EY_ENTRY, 2301.010498f, 1386.931641f, 1197.183472f, 1.570796f, 0, 0, 0.707107f, 0.707107f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY) +) + { + sLog.outErrorDb("BatteGroundEY: Failed to spawn some object BattleGround not created!"); + return false; + } + + //buffs + for (int i = 0; i < EY_POINTS_MAX; ++i) + { + AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]); + if (!at) + { + sLog.outError("BattleGroundEY: Unknown trigger: %u", m_Points_Trigger[i]); + continue; + } + if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) + || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) +) + sLog.outError("BattleGroundEY: Cannot spawn buff"); + } + + WorldSafeLocsEntry const *sg = NULL; + sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE); + if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) + { + sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!"); + return false; + } + + sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE); + if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) + { + sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!"); + return false; + } + + return true; +} + +void BattleGroundEY::Reset() +{ + //call parent's class reset + BattleGround::Reset(); + + m_TeamScores[BG_TEAM_ALLIANCE] = 0; + m_TeamScores[BG_TEAM_HORDE] = 0; + m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0; + m_TeamPointsCount[BG_TEAM_HORDE] = 0; + m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0; + m_HonorScoreTics[BG_TEAM_HORDE] = 0; + m_FlagState = BG_EY_FLAG_STATE_ON_BASE; + m_FlagCapturedBgObjectType = 0; + m_FlagKeeper = 0; + m_DroppedFlagGUID = 0; + m_PointAddingTimer = 0; + m_TowerCapCheckTimer = 0; + bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID()); + m_HonorTics = (isBGWeekend) ? BG_EY_EYWeekendHonorTicks : BG_EY_NotEYWeekendHonorTicks; + + for (uint8 i = 0; i < EY_POINTS_MAX; ++i) + { + m_PointOwnedByTeam[i] = EY_POINT_NO_OWNER; + m_PointState[i] = EY_POINT_STATE_UNCONTROLLED; + m_PointBarStatus[i] = BG_EY_PROGRESS_BAR_STATE_MIDDLE; + m_PlayersNearPoint[i].clear(); + m_PlayersNearPoint[i].reserve(15); //tip size + } + m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].clear(); + m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].reserve(30); +} + +void BattleGroundEY::RespawnFlag(bool send_message) +{ + if (m_FlagCapturedBgObjectType > 0) + SpawnBGObject(m_FlagCapturedBgObjectType, RESPAWN_ONE_DAY); + + m_FlagCapturedBgObjectType = 0; + m_FlagState = BG_EY_FLAG_STATE_ON_BASE; + SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_IMMEDIATELY); + + if (send_message) + { + SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL); + PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound... + } + + UpdateWorldState(NETHERSTORM_FLAG, 1); +} + +void BattleGroundEY::RespawnFlagAfterDrop() +{ + RespawnFlag(true); + + GameObject *obj = HashMapHolder::Find(GetDroppedFlagGUID()); + if (obj) + obj->Delete(); + else + sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID())); + + SetDroppedFlagGUID(0); +} + +void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + BattleGround::HandleKillPlayer(player, killer); + EventPlayerDroppedFlag(player); +} + +void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + { + // if not running, do not cast things at the dropper player, neither send unnecessary messages + // just take off the aura + if (IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID()) + { + SetFlagPicker(0); + Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); + } + return; + } + + if (!IsFlagPickedup()) + return; + + if (GetFlagPickerGUID() != Source->GetGUID()) + return; + + SetFlagPicker(0); + Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); + m_FlagState = BG_EY_FLAG_STATE_ON_GROUND; + m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; + Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true); + Source->CastSpell(Source, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true); + //this does not work correctly :((it should remove flag carrier name) + UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN); + UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN); + + if (Source->GetTeam() == ALLIANCE) + SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL); + else + SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL); +} + +void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) +{ + if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) + return; + + if (Source->GetTeam() == ALLIANCE) + { + UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER); + PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE); + } + else + { + UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_ON_PLAYER); + PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_HORDE); + } + + if (m_FlagState == BG_EY_FLAG_STATE_ON_BASE) + UpdateWorldState(NETHERSTORM_FLAG, 0); + m_FlagState = BG_EY_FLAG_STATE_ON_PLAYER; + + SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY); + SetFlagPicker(Source->GetGUID()); + //get flag aura on player + Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true); + Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); + + if (Source->GetTeam() == ALLIANCE) + PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName()); + else + PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName()); +} + +void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + //Natural point + uint32 Team = m_PointOwnedByTeam[Point]; + + if (!Team) + return; + + if (Team == ALLIANCE) + { + m_TeamPointsCount[BG_TEAM_ALLIANCE]--; + SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance, RESPAWN_ONE_DAY); + SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance + 1, RESPAWN_ONE_DAY); + SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance + 2, RESPAWN_ONE_DAY); + } + else + { + m_TeamPointsCount[BG_TEAM_HORDE]--; + SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde, RESPAWN_ONE_DAY); + SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 1, RESPAWN_ONE_DAY); + SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 2, RESPAWN_ONE_DAY); + } + + SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType, RESPAWN_IMMEDIATELY); + SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType + 1, RESPAWN_IMMEDIATELY); + SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType + 2, RESPAWN_IMMEDIATELY); + + //buff isn't despawned + + m_PointOwnedByTeam[Point] = EY_POINT_NO_OWNER; + m_PointState[Point] = EY_POINT_NO_OWNER; + + if (Team == ALLIANCE) + SendMessageToAll(m_LoosingPointTypes[Point].MessageIdAlliance,CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); + else + SendMessageToAll(m_LoosingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source); + + UpdatePointsIcons(Team, Point); + UpdatePointsCount(Team); + + //remove bonus honor aura trigger creature when node is lost + if (Point < EY_POINTS_MAX) + DelCreature(Point + 6);//NULL checks are in DelCreature! 0-5 spirit guides +} + +void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + uint32 Team = Source->GetTeam(); + + SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType, RESPAWN_ONE_DAY); + SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, RESPAWN_ONE_DAY); + SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 2, RESPAWN_ONE_DAY); + + if (Team == ALLIANCE) + { + m_TeamPointsCount[BG_TEAM_ALLIANCE]++; + SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY); + SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY); + SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY); + } + else + { + m_TeamPointsCount[BG_TEAM_HORDE]++; + SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY); + SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY); + SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY); + } + + //buff isn't respawned + + m_PointOwnedByTeam[Point] = Team; + m_PointState[Point] = EY_POINT_UNDER_CONTROL; + + if (Team == ALLIANCE) + SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance,CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); + else + SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source); + + if (m_BgCreatures[Point]) + DelCreature(Point); + + WorldSafeLocsEntry const *sg = NULL; + sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); + if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team)) + sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", + Point, Team, m_CapturingPointTypes[Point].GraveYardId); + +// SpawnBGCreature(Point,RESPAWN_IMMEDIATELY); + + UpdatePointsIcons(Team, Point); + UpdatePointsCount(Team); + + if (Point >= EY_POINTS_MAX) + return; + + Creature* trigger = GetBGCreature(Point + 6);//0-5 spirit guides + if (!trigger) + trigger = AddCreature(WORLD_TRIGGER,Point+6,Team,BG_EY_TriggerPositions[Point][0],BG_EY_TriggerPositions[Point][1],BG_EY_TriggerPositions[Point][2],BG_EY_TriggerPositions[Point][3]); + + //add bonus honor aura trigger creature when node is accupied + //cast bonus aura (+50% honor in 25yards) + //aura should only apply to players who have accupied the node, set correct faction for trigger + if (trigger) + { + trigger->setFaction(Team == ALLIANCE ? 84 : 83); + trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false); + } +} + +void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType) +{ + if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID()) + return; + + SetFlagPicker(0); + m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN; + Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL); + + Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); + + if (Source->GetTeam() == ALLIANCE) + PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE); + else + PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE); + + SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY); + + m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; + m_FlagCapturedBgObjectType = BgObjectType; + + uint8 team_id = 0; + if (Source->GetTeam() == ALLIANCE) + { + team_id = BG_TEAM_ALLIANCE; + SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); + } + else + { + team_id = BG_TEAM_HORDE; + SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source); + } + + if (m_TeamPointsCount[team_id] > 0) + AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]); + + UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); +} + +void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor) +{ + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + if (itr == m_PlayerScores.end()) // player not found + return; + + switch(type) + { + case SCORE_FLAG_CAPTURES: // flags captured + ((BattleGroundEYScore*)itr->second)->FlagCaptures += value; + break; + default: + BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor); + break; + } +} + +void BattleGroundEY::FillInitialWorldStates(WorldPacket& data) +{ + data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_HORDE]); + data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_ALLIANCE]); + data << uint32(0xab6) << uint32(0x0); + data << uint32(0xab5) << uint32(0x0); + data << uint32(0xab4) << uint32(0x0); + data << uint32(0xab3) << uint32(0x0); + data << uint32(0xab2) << uint32(0x0); + data << uint32(0xab1) << uint32(0x0); + data << uint32(0xab0) << uint32(0x0); + data << uint32(0xaaf) << uint32(0x0); + + data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); + + data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); + + data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL); + + data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); + + data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); + + data << uint32(MAGE_TOWER_UNCONTROL) << uint32(m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL); + + data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == HORDE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); + + data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == ALLIANCE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL); + + data << uint32(FEL_REAVER_UNCONTROL) << uint32(m_PointState[FEL_REALVER] != EY_POINT_UNDER_CONTROL); + + data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); + + data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); + + data << uint32(BLOOD_ELF_UNCONTROL) << uint32(m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL); + + data << uint32(NETHERSTORM_FLAG) << uint32(m_FlagState == BG_EY_FLAG_STATE_ON_BASE); + + data << uint32(0xad2) << uint32(0x1); + data << uint32(0xad1) << uint32(0x1); + data << uint32(0xabe) << uint32(GetTeamScore(HORDE)); + data << uint32(0xabd) << uint32(GetTeamScore(ALLIANCE)); + data << uint32(0xa05) << uint32(0x8e); + data << uint32(0xaa0) << uint32(0x0); + data << uint32(0xa9f) << uint32(0x0); + data << uint32(0xa9e) << uint32(0x0); + data << uint32(0xc0d) << uint32(0x17b); +} + +WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player) +{ + uint32 g_id = 0; + + switch(player->GetTeam()) + { + case ALLIANCE: g_id = EY_GRAVEYARD_MAIN_ALLIANCE; break; + case HORDE: g_id = EY_GRAVEYARD_MAIN_HORDE; break; + default: return NULL; + } + + float distance, nearestDistance; + + WorldSafeLocsEntry const* entry = NULL; + WorldSafeLocsEntry const* nearestEntry = NULL; + entry = sWorldSafeLocsStore.LookupEntry(g_id); + nearestEntry = entry; + + if (!entry) + { + sLog.outError("BattleGroundEY: Not found the main team graveyard. Graveyard system isn't working!"); + return NULL; + } + + float plr_x = player->GetPositionX(); + float plr_y = player->GetPositionY(); + float plr_z = player->GetPositionZ(); + + distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z); + nearestDistance = distance; + + for (uint8 i = 0; i < EY_POINTS_MAX; ++i) + { + if (m_PointOwnedByTeam[i] == player->GetTeam() && m_PointState[i] == EY_POINT_UNDER_CONTROL) + { + entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId); + if (!entry) + sLog.outError("BattleGroundEY: Not found graveyard: %u",m_CapturingPointTypes[i].GraveYardId); + else + { + distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z); + if (distance < nearestDistance) + { + nearestDistance = distance; + nearestEntry = entry; + } + } + } + } + + return nearestEntry; +} + +bool BattleGroundEY::IsAllNodesConrolledByTeam(uint32 team) const +{ + uint32 count = 0; + for (int i = 0; i < EY_POINTS_MAX; ++i) + if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EY_POINT_UNDER_CONTROL) + ++count; + + return count == EY_POINTS_MAX; +} diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundEY.h b/src/server/game/BattleGrounds/Zones/BattleGroundEY.h new file mode 100644 index 0000000..6b1ec6c --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundEY.h @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDEY_H +#define __BATTLEGROUNDEY_H + +#include "Language.h" + +class BattleGround; + +#define BG_EY_FLAG_RESPAWN_TIME (8*IN_MILLISECONDS) //8 seconds +#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILLISECONDS) //2 seconds + +enum BG_EY_WorldStates +{ + EY_ALLIANCE_RESOURCES = 2749, + EY_HORDE_RESOURCES = 2750, + EY_ALLIANCE_BASE = 2752, + EY_HORDE_BASE = 2753, + DRAENEI_RUINS_HORDE_CONTROL = 2733, + DRAENEI_RUINS_ALLIANCE_CONTROL = 2732, + DRAENEI_RUINS_UNCONTROL = 2731, + MAGE_TOWER_ALLIANCE_CONTROL = 2730, + MAGE_TOWER_HORDE_CONTROL = 2729, + MAGE_TOWER_UNCONTROL = 2728, + FEL_REAVER_HORDE_CONTROL = 2727, + FEL_REAVER_ALLIANCE_CONTROL = 2726, + FEL_REAVER_UNCONTROL = 2725, + BLOOD_ELF_HORDE_CONTROL = 2724, + BLOOD_ELF_ALLIANCE_CONTROL = 2723, + BLOOD_ELF_UNCONTROL = 2722, + PROGRESS_BAR_PERCENT_GREY = 2720, //100 = empty (only grey), 0 = blue|red (no grey) + PROGRESS_BAR_STATUS = 2719, //50 init!, 48 ... hordak bere .. 33 .. 0 = full 100% hordacky , 100 = full alliance + PROGRESS_BAR_SHOW = 2718, //1 init, 0 druhy send - bez messagu, 1 = controlled aliance + NETHERSTORM_FLAG = 2757, + //set to 2 when flag is picked up, and to 1 if it is dropped + NETHERSTORM_FLAG_STATE_ALLIANCE = 2769, + NETHERSTORM_FLAG_STATE_HORDE = 2770 +}; + +enum BG_EY_ProgressBarConsts +{ + BG_EY_POINT_MAX_CAPTURERS_COUNT = 5, + BG_EY_POINT_RADIUS = 70, + BG_EY_PROGRESS_BAR_DONT_SHOW = 0, + BG_EY_PROGRESS_BAR_SHOW = 1, + BG_EY_PROGRESS_BAR_PERCENT_GREY = 40, + BG_EY_PROGRESS_BAR_STATE_MIDDLE = 50, + BG_EY_PROGRESS_BAR_HORDE_CONTROLLED = 0, + BG_EY_PROGRESS_BAR_NEUTRAL_LOW = 30, + BG_EY_PROGRESS_BAR_NEUTRAL_HIGH = 70, + BG_EY_PROGRESS_BAR_ALI_CONTROLLED = 100 +}; + +enum BG_EY_Sounds +{ + //strange ids, but sure about them + BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE = 8212, + BG_EY_SOUND_FLAG_CAPTURED_HORDE = 8213, + BG_EY_SOUND_FLAG_PICKED_UP_HORDE = 8174, + BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE = 8173, + BG_EY_SOUND_FLAG_RESET = 8192 +}; + +enum BG_EY_Spells +{ + BG_EY_NETHERSTORM_FLAG_SPELL = 34976, + BG_EY_PLAYER_DROPPED_FLAG_SPELL = 34991 +}; + +enum EYBattleGroundObjectEntry +{ + BG_OBJECT_A_DOOR_EY_ENTRY = 184719, //Alliance door + BG_OBJECT_H_DOOR_EY_ENTRY = 184720, //Horde door + BG_OBJECT_FLAG1_EY_ENTRY = 184493, //Netherstorm flag (generic) + BG_OBJECT_FLAG2_EY_ENTRY = 184141, //Netherstorm flag (flagstand) + BG_OBJECT_FLAG3_EY_ENTRY = 184142, //Netherstorm flag (flagdrop) + BG_OBJECT_A_BANNER_EY_ENTRY = 184381, //Visual Banner (Alliance) + BG_OBJECT_H_BANNER_EY_ENTRY = 184380, //Visual Banner (Horde) + BG_OBJECT_N_BANNER_EY_ENTRY = 184382, //Visual Banner (Neutral) + BG_OBJECT_BE_TOWER_CAP_EY_ENTRY = 184080, //BE Tower Cap Pt + BG_OBJECT_FR_TOWER_CAP_EY_ENTRY = 184081, //Fel Reaver Cap Pt + BG_OBJECT_HU_TOWER_CAP_EY_ENTRY = 184082, //Human Tower Cap Pt + BG_OBJECT_DR_TOWER_CAP_EY_ENTRY = 184083 //Draenei Tower Cap Pt +}; + +enum EYBattleGroundPointsTrigger +{ + TR_BLOOD_ELF_POINT = 4476, + TR_FEL_REALVER_POINT = 4514, + TR_MAGE_TOWER_POINT = 4516, + TR_DRAENEI_RUINS_POINT = 4518, + TR_BLOOD_ELF_BUFF = 4568, + TR_FEL_REALVER_BUFF = 4569, + TR_MAGE_TOWER_BUFF = 4570, + TR_DRAENEI_RUINS_BUFF = 4571 +}; + +enum EYBattleGroundGaveyards +{ + EY_GRAVEYARD_MAIN_ALLIANCE = 1103, + EY_GRAVEYARD_MAIN_HORDE = 1104, + EY_GRAVEYARD_FEL_REALVER = 1105, + EY_GRAVEYARD_BLOOD_ELF = 1106, + EY_GRAVEYARD_DRAENEI_RUINS = 1107, + EY_GRAVEYARD_MAGE_TOWER = 1108 +}; + +enum EYBattleGroundPoints +{ + FEL_REALVER = 0, + BLOOD_ELF = 1, + DRAENEI_RUINS = 2, + MAGE_TOWER = 3, + + EY_PLAYERS_OUT_OF_POINTS = 4, + EY_POINTS_MAX = 4 +}; + +enum EYBattleGroundCreaturesTypes +{ + EY_SPIRIT_FEL_REALVER = 0, + EY_SPIRIT_BLOOD_ELF = 1, + EY_SPIRIT_DRAENEI_RUINS = 2, + EY_SPIRIT_MAGE_TOWER = 3, + EY_SPIRIT_MAIN_ALLIANCE = 4, + EY_SPIRIT_MAIN_HORDE = 5, + + EY_TRIGGER_FEL_REALVER = 6, + EY_TRIGGER_BLOOD_ELF = 7, + EY_TRIGGER_DRAENEI_RUINS = 8, + EY_TRIGGER_MAGE_TOWER = 9, + + BG_EY_CREATURES_MAX = 10 +}; + +enum EYBattleGroundObjectTypes +{ + BG_EY_OBJECT_DOOR_A = 0, + BG_EY_OBJECT_DOOR_H = 1, + BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER = 2, + BG_EY_OBJECT_A_BANNER_FEL_REALVER_LEFT = 3, + BG_EY_OBJECT_A_BANNER_FEL_REALVER_RIGHT = 4, + BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER = 5, + BG_EY_OBJECT_A_BANNER_BLOOD_ELF_LEFT = 6, + BG_EY_OBJECT_A_BANNER_BLOOD_ELF_RIGHT = 7, + BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER = 8, + BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_LEFT = 9, + BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_RIGHT = 10, + BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER = 11, + BG_EY_OBJECT_A_BANNER_MAGE_TOWER_LEFT = 12, + BG_EY_OBJECT_A_BANNER_MAGE_TOWER_RIGHT = 13, + BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER = 14, + BG_EY_OBJECT_H_BANNER_FEL_REALVER_LEFT = 15, + BG_EY_OBJECT_H_BANNER_FEL_REALVER_RIGHT = 16, + BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER = 17, + BG_EY_OBJECT_H_BANNER_BLOOD_ELF_LEFT = 18, + BG_EY_OBJECT_H_BANNER_BLOOD_ELF_RIGHT = 19, + BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER = 20, + BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_LEFT = 21, + BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_RIGHT = 22, + BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER = 23, + BG_EY_OBJECT_H_BANNER_MAGE_TOWER_LEFT = 24, + BG_EY_OBJECT_H_BANNER_MAGE_TOWER_RIGHT = 25, + BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER = 26, + BG_EY_OBJECT_N_BANNER_FEL_REALVER_LEFT = 27, + BG_EY_OBJECT_N_BANNER_FEL_REALVER_RIGHT = 28, + BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER = 29, + BG_EY_OBJECT_N_BANNER_BLOOD_ELF_LEFT = 30, + BG_EY_OBJECT_N_BANNER_BLOOD_ELF_RIGHT = 31, + BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER = 32, + BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_LEFT = 33, + BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_RIGHT = 34, + BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER = 35, + BG_EY_OBJECT_N_BANNER_MAGE_TOWER_LEFT = 36, + BG_EY_OBJECT_N_BANNER_MAGE_TOWER_RIGHT = 37, + BG_EY_OBJECT_TOWER_CAP_FEL_REALVER = 38, + BG_EY_OBJECT_TOWER_CAP_BLOOD_ELF = 39, + BG_EY_OBJECT_TOWER_CAP_DRAENEI_RUINS = 40, + BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER = 41, + BG_EY_OBJECT_FLAG_NETHERSTORM = 42, + BG_EY_OBJECT_FLAG_FEL_REALVER = 43, + BG_EY_OBJECT_FLAG_BLOOD_ELF = 44, + BG_EY_OBJECT_FLAG_DRAENEI_RUINS = 45, + BG_EY_OBJECT_FLAG_MAGE_TOWER = 46, + //buffs + BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER = 47, + BG_EY_OBJECT_REGENBUFF_FEL_REALVER = 48, + BG_EY_OBJECT_BERSERKBUFF_FEL_REALVER = 49, + BG_EY_OBJECT_SPEEDBUFF_BLOOD_ELF = 50, + BG_EY_OBJECT_REGENBUFF_BLOOD_ELF = 51, + BG_EY_OBJECT_BERSERKBUFF_BLOOD_ELF = 52, + BG_EY_OBJECT_SPEEDBUFF_DRAENEI_RUINS = 53, + BG_EY_OBJECT_REGENBUFF_DRAENEI_RUINS = 54, + BG_EY_OBJECT_BERSERKBUFF_DRAENEI_RUINS = 55, + BG_EY_OBJECT_SPEEDBUFF_MAGE_TOWER = 56, + BG_EY_OBJECT_REGENBUFF_MAGE_TOWER = 57, + BG_EY_OBJECT_BERSERKBUFF_MAGE_TOWER = 58, + BG_EY_OBJECT_MAX = 59 +}; + +#define BG_EY_NotEYWeekendHonorTicks 330 +#define BG_EY_EYWeekendHonorTicks 200 + +enum BG_EY_Score +{ + BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400, + BG_EY_MAX_TEAM_SCORE = 1600 +}; + +enum BG_EY_FlagState +{ + BG_EY_FLAG_STATE_ON_BASE = 0, + BG_EY_FLAG_STATE_WAIT_RESPAWN = 1, + BG_EY_FLAG_STATE_ON_PLAYER = 2, + BG_EY_FLAG_STATE_ON_GROUND = 3 +}; + +enum EYBattleGroundPointState +{ + EY_POINT_NO_OWNER = 0, + EY_POINT_STATE_UNCONTROLLED = 0, + EY_POINT_UNDER_CONTROL = 3 +}; + +struct BattleGroundEYPointIconsStruct +{ + BattleGroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex) + : WorldStateControlIndex(_WorldStateControlIndex), WorldStateAllianceControlledIndex(_WorldStateAllianceControlledIndex), WorldStateHordeControlledIndex(_WorldStateHordeControlledIndex) {} + uint32 WorldStateControlIndex; + uint32 WorldStateAllianceControlledIndex; + uint32 WorldStateHordeControlledIndex; +}; + +// x, y, z, o +const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] = { + {2044.28f, 1729.68f, 1189.96f, -0.017453f}, // FEL_REALVER center + {2048.83f, 1393.65f, 1194.49f, 0.20944f}, // BLOOD_ELF center + {2286.56f, 1402.36f, 1197.11f, 3.72381f}, // DRAENEI_RUINS center + {2284.48f, 1731.23f, 1189.99f, 2.89725f} // MAGE_TOWER center +}; + +struct BattleGroundEYLoosingPointStruct +{ + BattleGroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde) + : SpawnNeutralObjectType(_SpawnNeutralObjectType), + DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), + DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde) + {} + + uint32 SpawnNeutralObjectType; + uint32 DespawnObjectTypeAlliance; + uint32 MessageIdAlliance; + uint32 DespawnObjectTypeHorde; + uint32 MessageIdHorde; +}; + +struct BattleGroundEYCapturingPointStruct +{ + BattleGroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId) + : DespawnNeutralObjectType(_DespawnNeutralObjectType), + SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), + SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde), + GraveYardId(_GraveYardId) + {} + + uint32 DespawnNeutralObjectType; + uint32 SpawnObjectTypeAlliance; + uint32 MessageIdAlliance; + uint32 SpawnObjectTypeHorde; + uint32 MessageIdHorde; + uint32 GraveYardId; +}; + +const uint8 BG_EY_TickPoints[EY_POINTS_MAX] = {1, 2, 5, 10}; +const uint32 BG_EY_FlagPoints[EY_POINTS_MAX] = {75, 85, 100, 500}; + +//constant arrays: +const BattleGroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] = +{ + BattleGroundEYPointIconsStruct(FEL_REAVER_UNCONTROL, FEL_REAVER_ALLIANCE_CONTROL, FEL_REAVER_HORDE_CONTROL), + BattleGroundEYPointIconsStruct(BLOOD_ELF_UNCONTROL, BLOOD_ELF_ALLIANCE_CONTROL, BLOOD_ELF_HORDE_CONTROL), + BattleGroundEYPointIconsStruct(DRAENEI_RUINS_UNCONTROL, DRAENEI_RUINS_ALLIANCE_CONTROL, DRAENEI_RUINS_HORDE_CONTROL), + BattleGroundEYPointIconsStruct(MAGE_TOWER_UNCONTROL, MAGE_TOWER_ALLIANCE_CONTROL, MAGE_TOWER_HORDE_CONTROL) +}; +const BattleGroundEYLoosingPointStruct m_LoosingPointTypes[EY_POINTS_MAX] = +{ + BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_H_F_RUINS), + BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_H_B_TOWER), + BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_H_D_RUINS), + BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_H_M_TOWER) +}; +const BattleGroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] = +{ + BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REALVER), + BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, EY_GRAVEYARD_BLOOD_ELF), + BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS), + BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER) +}; + +class BattleGroundEYScore : public BattleGroundScore +{ + public: + BattleGroundEYScore () : FlagCaptures(0) {}; + virtual ~BattleGroundEYScore() {}; + uint32 FlagCaptures; +}; + +class BattleGroundEY : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundEY(); + ~BattleGroundEY(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + /* BG Flags */ + uint64 GetFlagPickerGUID() const { return m_FlagKeeper; } + void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; } + bool IsFlagPickedup() const { return m_FlagKeeper != 0; } + uint8 GetFlagState() const { return m_FlagState; } + void RespawnFlag(bool send_message); + void RespawnFlagAfterDrop(); + + void RemovePlayer(Player *plr,uint64 guid); + void HandleBuffUse(uint64 const& buff_guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + void HandleKillPlayer(Player *player, Player *killer); + virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + virtual bool SetupBattleGround(); + virtual void Reset(); + void UpdateTeamScore(uint32 Team); + void EndBattleGround(uint32 winner); + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + virtual void FillInitialWorldStates(WorldPacket& data); + void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;} + uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} + + /* Battleground Events */ + virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); + virtual void EventPlayerDroppedFlag(Player *Source); + + /* achievement req. */ + bool IsAllNodesConrolledByTeam(uint32 team) const; + private: + void EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType); + void EventTeamCapturedPoint(Player *Source, uint32 Point); + void EventTeamLostPoint(Player *Source, uint32 Point); + void UpdatePointsCount(uint32 Team); + void UpdatePointsIcons(uint32 Team, uint32 Point); + + /* Point status updating procedures */ + void CheckSomeoneLeftPoint(); + void CheckSomeoneJoinedPoint(); + void UpdatePointStatuses(); + + /* Scorekeeping */ + uint32 GetTeamScore(uint32 Team) const { return m_TeamScores[GetTeamIndexByTeamId(Team)]; } + void AddPoints(uint32 Team, uint32 Points); + + void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; } + void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; } + + uint32 m_HonorScoreTics[2]; + uint32 m_TeamPointsCount[2]; + + uint32 m_Points_Trigger[EY_POINTS_MAX]; + + uint64 m_FlagKeeper; // keepers guid + uint64 m_DroppedFlagGUID; + uint32 m_FlagCapturedBgObjectType; // type that should be despawned when flag is captured + uint8 m_FlagState; // for checking flag state + int32 m_FlagsTimer; + int32 m_TowerCapCheckTimer; + + uint32 m_PointOwnedByTeam[EY_POINTS_MAX]; + uint8 m_PointState[EY_POINTS_MAX]; + int32 m_PointBarStatus[EY_POINTS_MAX]; + typedef std::vector PlayersNearPointType; + PlayersNearPointType m_PlayersNearPoint[EY_POINTS_MAX + 1]; + uint8 m_CurrentPointPlayersCount[2*EY_POINTS_MAX]; + + int32 m_PointAddingTimer; + uint32 m_HonorTics; +}; +#endif + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundIC.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundIC.cpp new file mode 100644 index 0000000..8dbcc81 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundIC.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Player.h" +#include "BattleGround.h" +#include "BattleGroundIC.h" +#include "Language.h" + +BattleGroundIC::BattleGroundIC() +{ + m_BgCreatures.resize(2); + m_BgObjects.resize(5); + //TODO FIX ME! + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; +} + +BattleGroundIC::~BattleGroundIC() +{ + +} + +void BattleGroundIC::Update(uint32 diff) +{ + BattleGround::Update(diff); +} + +void BattleGroundIC::StartingEventCloseDoors() +{ +} + +void BattleGroundIC::StartingEventOpenDoors() +{ +} + +void BattleGroundIC::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundICScore* sc = new BattleGroundICScore; + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +{ + +} + +void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; +} + +void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) +{ + + std::map::iterator itr = m_PlayerScores.find(Source->GetGUID()); + + if (itr == m_PlayerScores.end()) // player not found... + return; + + BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor); +} + +bool BattleGroundIC::SetupBattleGround() +{ + AddObject(0, 195157, 459.72f, -419.93f, 42.55f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE); + AddObject(1, 195158, 797.72f, -1009.48f, 138.52f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE); + AddObject(2, 195338, 418.98f, -838.33f, 51.09f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE); + AddObject(3, 195343, 1267.45f, -390.88f, 24.23f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE); + AddObject(4, 195333, 769.27f, -833.53f, 9.57f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE); + SpawnLeader(ALLIANCE); + SpawnLeader(HORDE); + return true; +} + +void BattleGroundIC::SpawnLeader(uint32 teamid) +{ + if (teamid == ALLIANCE) + AddCreature(34924, 0, ALLIANCE, 307.03f, -833.04f, 48.91f, 6.23f, 10*MINUTE); + else + AddCreature(34922, 1, HORDE, 1264.42f, -766.80f, 48.91f, 3.28f, 10*MINUTE); +} + +void BattleGroundIC::HandleKillUnit(Creature *unit, Player * /*killer*/) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + uint32 entry = unit->GetEntry(); + if (entry == 34924) + { + RewardHonorToTeam(500,HORDE); + EndBattleGround(HORDE); + } + else if (entry == 34922) + { + RewardHonorToTeam(500,ALLIANCE); + EndBattleGround(ALLIANCE); + } +} + +void BattleGroundIC::EndBattleGround(uint32 winner) +{ + BattleGround::EndBattleGround(winner); +} + +void BattleGroundIC::EventPlayerClickedOnFlag(Player * /*source*/, GameObject* /*target_obj*/) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; +} diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundIC.h b/src/server/game/BattleGrounds/Zones/BattleGroundIC.h new file mode 100644 index 0000000..e49ea01 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundIC.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDIC_H +#define __BATTLEGROUNDIC_H + +class BattleGround; + +enum Buffs +{ + OIL_REFINERY = 68719, + QUARRY = 68720 +}; + +class BattleGroundICScore : public BattleGroundScore +{ + public: + BattleGroundICScore() {}; + virtual ~BattleGroundICScore() {}; +}; + +class BattleGroundIC : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundIC(); + ~BattleGroundIC(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr,uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + void SpawnLeader(uint32 teamid); + void HandleKillUnit(Creature *unit, Player *killer); + void EndBattleGround(uint32 winner); + void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/); + + /* Scorekeeping */ + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + + private: +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundNA.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundNA.cpp new file mode 100644 index 0000000..793cf13 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundNA.cpp @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundNA.h" +#include "Language.h" +#include "Object.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "WorldPacket.h" + +BattleGroundNA::BattleGroundNA() +{ + m_BgObjects.resize(BG_NA_OBJECT_MAX); + + m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; + m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; + m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; + m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + //we must set messageIds + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; +} + +BattleGroundNA::~BattleGroundNA() +{ + +} + +void BattleGroundNA::Update(uint32 diff) +{ + BattleGround::Update(diff); + + /*if (GetStatus() == STATUS_IN_PROGRESS) + { + // update something + }*/ +} + +void BattleGroundNA::StartingEventCloseDoors() +{ + for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); +} + +void BattleGroundNA::StartingEventOpenDoors() +{ + for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i) + DoorOpen(i); + + for (uint32 i = BG_NA_OBJECT_BUFF_1; i <= BG_NA_OBJECT_BUFF_2; ++i) + SpawnBGObject(i, 60); +} + +void BattleGroundNA::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundNAScore* sc = new BattleGroundNAScore; + + m_PlayerScores[plr->GetGUID()] = sc; + + UpdateArenaWorldState(); +} + +void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) +{ + if (GetStatus() == STATUS_WAIT_LEAVE) + return; + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + if (!killer) + { + sLog.outError("BattleGroundNA: Killer player not found"); + return; + } + + BattleGround::HandleKillPlayer(player,killer); + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +bool BattleGroundNA::HandlePlayerUnderMap(Player *player) +{ + player->TeleportTo(GetMapId(),4055.504395,2919.660645,13.611241,player->GetOrientation(),false); + return true; +} + +void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + //uint32 SpellId = 0; + //uint64 buff_guid = 0; + switch(Trigger) + { + case 4536: // buff trigger? + case 4537: // buff trigger? + break; + default: + sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } + + //if (buff_guid) + // HandleTriggerBuff(buff_guid,Source); +} + +void BattleGroundNA::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(0xa11) << uint32(1); // 9 + UpdateArenaWorldState(); +} + +void BattleGroundNA::Reset() +{ + //call parent's class reset + BattleGround::Reset(); +} + +bool BattleGroundNA::SetupBattleGround() +{ + // gates + if (!AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY) + || !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179, 2874.97, 12.39171, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY) + || !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709, 2981.777, 10.70117, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY) + || !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064, 2858.438, 10.23631, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY) + // buffs + || !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941, 2895.250000, 13.052700, -1.448624, 0, 0, 0.6626201, -0.7489557, 120) + || !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078, 2946.350098, 13.051300, -0.06981307, 0, 0, 0.03489945, -0.9993908, 120)) + { + sLog.outErrorDb("BatteGroundNA: Failed to spawn some object!"); + return false; + } + + return true; +} + +/* +20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86 +0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r........... +0010: 00 00 01 00 00 00 0f 0a 00 00 00 00 00 00 10 0a | ................ +0020: 00 00 00 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................ +0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................ +0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................ +0050: 00 00 00 00 00 00 | ...... +*/ diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundNA.h b/src/server/game/BattleGrounds/Zones/BattleGroundNA.h new file mode 100644 index 0000000..a11d311 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundNA.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BATTLEGROUNDNA_H +#define __BATTLEGROUNDNA_H + +class BattleGround; + +enum BattleGroundNAObjectTypes +{ + BG_NA_OBJECT_DOOR_1 = 0, + BG_NA_OBJECT_DOOR_2 = 1, + BG_NA_OBJECT_DOOR_3 = 2, + BG_NA_OBJECT_DOOR_4 = 3, + BG_NA_OBJECT_BUFF_1 = 4, + BG_NA_OBJECT_BUFF_2 = 5, + BG_NA_OBJECT_MAX = 6 +}; + +enum BattleGroundNAObjects +{ + BG_NA_OBJECT_TYPE_DOOR_1 = 183978, + BG_NA_OBJECT_TYPE_DOOR_2 = 183980, + BG_NA_OBJECT_TYPE_DOOR_3 = 183977, + BG_NA_OBJECT_TYPE_DOOR_4 = 183979, + BG_NA_OBJECT_TYPE_BUFF_1 = 184663, + BG_NA_OBJECT_TYPE_BUFF_2 = 184664 +}; + +class BattleGroundNAScore : public BattleGroundScore +{ + public: + BattleGroundNAScore() {}; + virtual ~BattleGroundNAScore() {}; + //TODO fix me +}; + +class BattleGroundNA : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundNA(); + ~BattleGroundNA(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr, uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + virtual void Reset(); + virtual void FillInitialWorldStates(WorldPacket &d); + void HandleKillPlayer(Player* player, Player *killer); + bool HandlePlayerUnderMap(Player * plr); +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundRB.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundRB.cpp new file mode 100644 index 0000000..cf22154 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundRB.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Player.h" +#include "BattleGround.h" +#include "BattleGroundRB.h" +#include "Language.h" + +BattleGroundRB::BattleGroundRB() +{ + //TODO FIX ME! + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; +} + +BattleGroundRB::~BattleGroundRB() +{ + +} + +void BattleGroundRB::Update(uint32 diff) +{ + BattleGround::Update(diff); +} + +void BattleGroundRB::StartingEventCloseDoors() +{ +} + +void BattleGroundRB::StartingEventOpenDoors() +{ +} + +void BattleGroundRB::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundRBScore* sc = new BattleGroundRBScore; + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundRB::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +{ +} + +void BattleGroundRB::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; +} + +void BattleGroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) +{ + std::map::iterator itr = m_PlayerScores.find(Source->GetGUID()); + + if (itr == m_PlayerScores.end()) // player not found... + return; + + BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor); +} diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundRB.h b/src/server/game/BattleGrounds/Zones/BattleGroundRB.h new file mode 100644 index 0000000..a40ade5 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundRB.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDRB_H +#define __BATTLEGROUNDRB_H + +class BattleGround; + +class BattleGroundRBScore : public BattleGroundScore +{ + public: + BattleGroundRBScore() {}; + virtual ~BattleGroundRBScore() {}; +}; + +class BattleGroundRB : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundRB(); + ~BattleGroundRB(); + void Update(uint32 diff); + + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr,uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + + /* Scorekeeping */ + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + + private: +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundRL.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundRL.cpp new file mode 100644 index 0000000..ef2ec3c --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundRL.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundRL.h" +#include "Language.h" +#include "Object.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "WorldPacket.h" + +BattleGroundRL::BattleGroundRL() +{ + m_BgObjects.resize(BG_RL_OBJECT_MAX); + + m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; + m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; + m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; + m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + //we must set messageIds + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; +} + +BattleGroundRL::~BattleGroundRL() +{ + +} + +void BattleGroundRL::Update(uint32 diff) +{ + BattleGround::Update(diff); + + /*if (GetStatus() == STATUS_IN_PROGRESS) + { + // update something + }*/ +} + +void BattleGroundRL::StartingEventCloseDoors() +{ + for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); +} + +void BattleGroundRL::StartingEventOpenDoors() +{ + for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i) + DoorOpen(i); + + for (uint32 i = BG_RL_OBJECT_BUFF_1; i <= BG_RL_OBJECT_BUFF_2; ++i) + SpawnBGObject(i, 60); +} + +void BattleGroundRL::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundRLScore* sc = new BattleGroundRLScore; + + m_PlayerScores[plr->GetGUID()] = sc; + + UpdateArenaWorldState(); +} + +void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/) +{ + if (GetStatus() == STATUS_WAIT_LEAVE) + return; + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + if (!killer) + { + sLog.outError("Killer player not found"); + return; + } + + BattleGround::HandleKillPlayer(player,killer); + + UpdateArenaWorldState(); + CheckArenaWinConditions(); +} + +bool BattleGroundRL::HandlePlayerUnderMap(Player *player) +{ + player->TeleportTo(GetMapId(),1285.810547,1667.896851,39.957642,player->GetOrientation(),false); + return true; +} + +void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + //uint32 SpellId = 0; + //uint64 buff_guid = 0; + switch(Trigger) + { + case 4696: // buff trigger? + case 4697: // buff trigger? + break; + default: + sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } + + //if (buff_guid) + // HandleTriggerBuff(buff_guid,Source); +} + +void BattleGroundRL::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(0xbba) << uint32(1); // 9 + UpdateArenaWorldState(); +} + +void BattleGroundRL::Reset() +{ + //call parent's reset + BattleGround::Reset(); +} + +bool BattleGroundRL::SetupBattleGround() +{ + // gates + if (!AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648, 1730.557, 31.60557, 1.684245, 0, 0, 0.7460582, 0.6658807, RESPAWN_IMMEDIATELY) + // buffs + || !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971, 1632.719971, 36.730400, -1.448624, 0, 0, 0.6626201, -0.7489557, 120) + || !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049, 1699.170044, 34.872601, -0.06981307, 0, 0, 0.03489945, -0.9993908, 120)) + { + sLog.outErrorDb("BatteGroundRL: Failed to spawn some object!"); + return false; + } + + return true; +} + +/* +Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86 +0000: 3C 02 00 00 80 0F 00 00 00 00 00 00 09 00 BA 0B | <............... +0010: 00 00 01 00 00 00 B9 0B 00 00 02 00 00 00 B8 0B | ................ +0020: 00 00 00 00 00 00 D8 08 00 00 00 00 00 00 D7 08 | ................ +0030: 00 00 00 00 00 00 D6 08 00 00 00 00 00 00 D5 08 | ................ +0040: 00 00 00 00 00 00 D3 08 00 00 00 00 00 00 D4 08 | ................ +0050: 00 00 00 00 00 00 | ...... +*/ diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundRL.h b/src/server/game/BattleGrounds/Zones/BattleGroundRL.h new file mode 100644 index 0000000..3b4c10a --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundRL.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BATTLEGROUNDRL_H +#define __BATTLEGROUNDRL_H + +class BattleGround; + +enum BattleGroundRLObjectTypes +{ + BG_RL_OBJECT_DOOR_1 = 0, + BG_RL_OBJECT_DOOR_2 = 1, + BG_RL_OBJECT_BUFF_1 = 2, + BG_RL_OBJECT_BUFF_2 = 3, + BG_RL_OBJECT_MAX = 4 +}; + +enum BattleGroundRLObjects +{ + BG_RL_OBJECT_TYPE_DOOR_1 = 185918, + BG_RL_OBJECT_TYPE_DOOR_2 = 185917, + BG_RL_OBJECT_TYPE_BUFF_1 = 184663, + BG_RL_OBJECT_TYPE_BUFF_2 = 184664 +}; + +class BattleGroundRLScore : public BattleGroundScore +{ + public: + BattleGroundRLScore() {}; + virtual ~BattleGroundRLScore() {}; + //TODO fix me +}; + +class BattleGroundRL : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundRL(); + ~BattleGroundRL(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void Reset(); + virtual void FillInitialWorldStates(WorldPacket &d); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + void RemovePlayer(Player *plr, uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + void HandleKillPlayer(Player* player, Player *killer); + bool HandlePlayerUnderMap(Player * plr); +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundRV.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundRV.cpp new file mode 100644 index 0000000..fcc53db --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundRV.cpp @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundRV.h" +#include "ObjectAccessor.h" +#include "Language.h" +#include "Player.h" +#include "WorldPacket.h" +#include "GameObject.h" + +BattleGroundRV::BattleGroundRV() +{ + m_BgObjects.resize(BG_RV_OBJECT_MAX); + + m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; + m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; + m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; + m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + //we must set messageIds + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; +} + +BattleGroundRV::~BattleGroundRV() +{ + +} + +void BattleGroundRV::Update(uint32 diff) +{ + BattleGround::Update(diff); + + if (getTimer() < diff) + { + uint32 i; + switch(getState()) + { + case BG_RV_STATE_OPEN_FENCES: + { + setTimer(BG_RV_PILAR_TO_FIRE_TIMER); + setState(BG_RV_STATE_CLOSE_FIRE); + break; + } + case BG_RV_STATE_CLOSE_FIRE: + for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i) + DoorClose(i); + setTimer(BG_RV_FIRE_TO_PILAR_TIMER); + setState(BG_RV_STATE_OPEN_PILARS); + break; + case BG_RV_STATE_OPEN_PILARS: + for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) + DoorOpen(i); + setTimer(BG_RV_PILAR_TO_FIRE_TIMER); + setState(BG_RV_STATE_OPEN_FIRE); + break; + case BG_RV_STATE_OPEN_FIRE: + for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i) + DoorOpen(i); + setTimer(BG_RV_FIRE_TO_PILAR_TIMER); + setState(BG_RV_STATE_CLOSE_PILARS); + break; + case BG_RV_STATE_CLOSE_PILARS: + uint32 i; + for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) + DoorOpen(i); + setTimer(BG_RV_PILAR_TO_FIRE_TIMER); + setState(BG_RV_STATE_CLOSE_FIRE); + break; + } + } + else + setTimer(getTimer() - diff); +} + +void BattleGroundRV::StartingEventCloseDoors() +{ +} + +void BattleGroundRV::StartingEventOpenDoors() +{ + // Buff respawn + SpawnBGObject(BG_RV_OBJECT_BUFF_1, 90); + SpawnBGObject(BG_RV_OBJECT_BUFF_2, 90); + // Open fences + DoorOpen(BG_RV_OBJECT_FENCE_1); + DoorOpen(BG_RV_OBJECT_FENCE_2); + // Elevators + DoorOpen(BG_RV_OBJECT_ELEVATOR_1); + DoorOpen(BG_RV_OBJECT_ELEVATOR_2); + + setState(BG_RV_STATE_OPEN_FENCES); + setTimer(BG_RV_FIRST_TIMER); +} + +void BattleGroundRV::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundRVScore* sc = new BattleGroundRVScore; + + m_PlayerScores[plr->GetGUID()] = sc; + + UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE)); + UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE)); +} + +void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/) +{ + if (GetStatus() == STATUS_WAIT_LEAVE) + return; + + UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE)); + UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE)); + + CheckArenaWinConditions(); +} + +void BattleGroundRV::HandleKillPlayer(Player *player, Player *killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + if (!killer) + { + sLog.outError("BattleGroundRV: Killer player not found"); + return; + } + + BattleGround::HandleKillPlayer(player, killer); + + UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE)); + UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE)); + + CheckArenaWinConditions(); +} + +bool BattleGroundRV::HandlePlayerUnderMap(Player *player) +{ + player->TeleportTo(GetMapId(), 763.5, -284, 28.276, 2.422, false); + return true; +} + + +void BattleGroundRV::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + switch(Trigger) + { + case 5224: + case 5226: + break; + default: + sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } +} + +void BattleGroundRV::FillInitialWorldStates(WorldPacket &data) +{ + data << uint32(BG_RV_WORLD_STATE_A) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); + data << uint32(BG_RV_WORLD_STATE_H) << uint32(GetAlivePlayersCountByTeam(HORDE)); + data << uint32(BG_RV_WORLD_STATE) << uint32(1); +} + +void BattleGroundRV::Reset() +{ + //call parent's class reset + BattleGround::Reset(); +} + +bool BattleGroundRV::SetupBattleGround() +{ + // Fence + if (!AddObject(BG_RV_OBJECT_FENCE_1, BG_RV_OBJECT_TYPE_FENCE_1, 763.432373, -274.058197, 28.276695, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_FENCE_2, BG_RV_OBJECT_TYPE_FENCE_2, 763.432373, -294.419464, 28.276684, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + // elevators + || !AddObject(BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_TYPE_ELEVATOR_1, 763.536377, -294.535767, 0.505383, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_ELEVATOR_2, BG_RV_OBJECT_TYPE_ELEVATOR_2, 763.506348, -273.873352, 0.505383, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) + // buffs + || !AddObject(BG_RV_OBJECT_BUFF_1, BG_RV_OBJECT_TYPE_BUFF_1, 735.551819, -284.794678, 28.276682, 0.034906, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_BUFF_2, BG_RV_OBJECT_TYPE_BUFF_2, 791.224487, -284.794464, 28.276682, 2.600535, 0, 0, 0, RESPAWN_IMMEDIATELY) + // fire + || !AddObject(BG_RV_OBJECT_FIRE_1, BG_RV_OBJECT_TYPE_FIRE_1, 743.543457, -283.799469, 28.286655, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_FIRE_2, BG_RV_OBJECT_TYPE_FIRE_2, 782.971802, -283.799469, 28.286655, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_FIREDOOR_1, BG_RV_OBJECT_TYPE_FIREDOOR_1, 743.711060, -284.099609, 27.542587, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_FIREDOOR_2, BG_RV_OBJECT_TYPE_FIREDOOR_2, 783.221252, -284.133362, 27.535686, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) + // Gear + || !AddObject(BG_RV_OBJECT_GEAR_1, BG_RV_OBJECT_TYPE_GEAR_1, 763.664551, -261.872986, 26.686588, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_GEAR_2, BG_RV_OBJECT_TYPE_GEAR_2, 763.578979, -306.146149, 26.665222, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + // Pulley + || !AddObject(BG_RV_OBJECT_PULLEY_1, BG_RV_OBJECT_TYPE_PULLEY_1, 700.722290, -283.990662, 39.517582, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_PULLEY_2, BG_RV_OBJECT_TYPE_PULLEY_2, 826.303833, -283.996429, 39.517582, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) + // Pilars + || !AddObject(BG_RV_OBJECT_PILAR_1, BG_RV_OBJECT_TYPE_PILAR_1, 763.632385, -306.162384, 25.909504, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_PILAR_2, BG_RV_OBJECT_TYPE_PILAR_2, 723.644287, -284.493256, 24.648525, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_PILAR_3, BG_RV_OBJECT_TYPE_PILAR_3, 763.611145, -261.856750, 25.909504, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_TYPE_PILAR_4, 802.211609, -284.493256, 24.648525, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) +/* + // Pilars Collision - Fixme: Use the collision pilars - should make u break LoS + || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_1, BG_RV_OBJECT_TYPE_PILAR_COLLISION_1, 763.632385, -306.162384, 30.639660, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_2, BG_RV_OBJECT_TYPE_PILAR_COLLISION_2, 723.644287, -284.493256, 32.382710, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_3, BG_RV_OBJECT_TYPE_PILAR_COLLISION_3, 763.611145, -261.856750, 30.639660, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY) + || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_4, BG_RV_OBJECT_TYPE_PILAR_COLLISION_4, 802.211609, -284.493256, 32.382710, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY) +*/ +) + { + sLog.outErrorDb("BatteGroundRV: Failed to spawn some object!"); + return false; + } + return true; +} diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundRV.h b/src/server/game/BattleGrounds/Zones/BattleGroundRV.h new file mode 100644 index 0000000..bf06478 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundRV.h @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __BATTLEGROUNDRV_H +#define __BATTLEGROUNDRV_H + +class BattleGround; + +enum BattleGroundRVObjectTypes +{ + BG_RV_OBJECT_BUFF_1, + BG_RV_OBJECT_BUFF_2, + BG_RV_OBJECT_FIRE_1, + BG_RV_OBJECT_FIRE_2, + BG_RV_OBJECT_FIREDOOR_1, + BG_RV_OBJECT_FIREDOOR_2, + + BG_RV_OBJECT_PILAR_1, + BG_RV_OBJECT_PILAR_3, + BG_RV_OBJECT_GEAR_1, + BG_RV_OBJECT_GEAR_2, + + BG_RV_OBJECT_PILAR_2, + BG_RV_OBJECT_PILAR_4, + BG_RV_OBJECT_PULLEY_1, + BG_RV_OBJECT_PULLEY_2, +/* + BG_RV_OBJECT_PILAR_COLLISION_1, + BG_RV_OBJECT_PILAR_COLLISION_2, + BG_RV_OBJECT_PILAR_COLLISION_3, + BG_RV_OBJECT_PILAR_COLLISION_4, +*/ + BG_RV_OBJECT_ELEVATOR_1, + BG_RV_OBJECT_ELEVATOR_2, + BG_RV_OBJECT_FENCE_1, + BG_RV_OBJECT_FENCE_2, + BG_RV_OBJECT_MAX, +}; + +enum BattleGroundRVObjects +{ + BG_RV_OBJECT_TYPE_BUFF_1 = 184663, + BG_RV_OBJECT_TYPE_BUFF_2 = 184664, + BG_RV_OBJECT_TYPE_FIRE_1 = 192704, + BG_RV_OBJECT_TYPE_FIRE_2 = 192705, + + BG_RV_OBJECT_TYPE_FIREDOOR_2 = 192387, + BG_RV_OBJECT_TYPE_FIREDOOR_1 = 192388, + BG_RV_OBJECT_TYPE_PULLEY_1 = 192389, + BG_RV_OBJECT_TYPE_PULLEY_2 = 192390, + BG_RV_OBJECT_TYPE_FENCE_1 = 192391, + BG_RV_OBJECT_TYPE_FENCE_2 = 192392, + BG_RV_OBJECT_TYPE_GEAR_1 = 192393, + BG_RV_OBJECT_TYPE_GEAR_2 = 192394, + BG_RV_OBJECT_TYPE_ELEVATOR_1 = 194582, + BG_RV_OBJECT_TYPE_ELEVATOR_2 = 194586, +/* + BG_RV_OBJECT_TYPE_PILAR_COLLISION_1 = 194580, // axe + BG_RV_OBJECT_TYPE_PILAR_COLLISION_2 = 194579, // arena + BG_RV_OBJECT_TYPE_PILAR_COLLISION_3 = 194581, // lightning + BG_RV_OBJECT_TYPE_PILAR_COLLISION_4 = 194578, // ivory +*/ + BG_RV_OBJECT_TYPE_PILAR_1 = 194583, // axe + BG_RV_OBJECT_TYPE_PILAR_2 = 194584, // arena + BG_RV_OBJECT_TYPE_PILAR_3 = 194585, // lightning + BG_RV_OBJECT_TYPE_PILAR_4 = 194587, // ivory +}; + +enum BattleGroundRVData +{ + BG_RV_STATE_OPEN_FENCES, + BG_RV_STATE_OPEN_PILARS, + BG_RV_STATE_CLOSE_PILARS, + BG_RV_STATE_OPEN_FIRE, + BG_RV_STATE_CLOSE_FIRE, + BG_RV_FIRE_TO_PILAR_TIMER = 20000, + BG_RV_PILAR_TO_FIRE_TIMER = 5000, + BG_RV_FIRST_TIMER = 20133, + BG_RV_WORLD_STATE_A = 0xe10, + BG_RV_WORLD_STATE_H = 0xe11, + BG_RV_WORLD_STATE = 0xe1a, +}; + +class BattleGroundRVScore : public BattleGroundScore +{ + public: + BattleGroundRVScore() {}; + virtual ~BattleGroundRVScore() {}; +}; + +class BattleGroundRV : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundRV(); + ~BattleGroundRV(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + virtual void Reset(); + virtual void FillInitialWorldStates(WorldPacket &d); + + void RemovePlayer(Player *plr, uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + bool SetupBattleGround(); + void HandleKillPlayer(Player* player, Player *killer); + bool HandlePlayerUnderMap(Player * plr); + + private: + uint32 Timer; + uint32 State; + + protected: + uint32 getTimer() { return Timer; }; + void setTimer(uint32 timer) { Timer = timer; }; + + uint32 getState() { return State; }; + void setState(uint32 state) { State = state; }; +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundSA.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundSA.cpp new file mode 100644 index 0000000..ccde43c --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundSA.cpp @@ -0,0 +1,822 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundSA.h" +#include "Language.h" +#include "Player.h" +#include "GameObject.h" +#include "ObjectMgr.h" +#include "WorldPacket.h" + + +BattleGroundSA::BattleGroundSA() +{ + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_SA_HAS_BEGUN; + m_BgObjects.resize(BG_SA_MAXOBJ); + m_BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY); + TimerEnabled = false; + UpdateWaitTimer = 0; + SignaledRoundTwo = false; + SignaledRoundTwoHalfMin = false; + InitSecondRound = false; +} + +BattleGroundSA::~BattleGroundSA() +{ +} + +void BattleGroundSA::Reset() +{ + TotalTime = 0; + attackers = ((urand(0,1)) ? TEAM_ALLIANCE : TEAM_HORDE); + for (uint8 i = 0; i <= 5; i++) + GateStatus[i] = BG_SA_GATE_OK; + ShipsStarted = false; + status = BG_SA_WARMUP; +} + +bool BattleGroundSA::SetupBattleGround() +{ + return ResetObjs(); +} + +bool BattleGroundSA::ResetObjs() +{ + uint32 atF = BG_SA_Factions[attackers]; + uint32 defF = BG_SA_Factions[attackers ? TEAM_ALLIANCE : TEAM_HORDE]; + + + for (uint8 i = 0; i SetUInt32Value(GAMEOBJECT_FACTION, defF); + } + + GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, atF); + GetBGObject(BG_SA_TITAN_RELIC)->Refresh(); + + for (uint8 i = 0; i <= 5; i++) + GateStatus[i] = BG_SA_GATE_OK; + + // MAD props for Kiper for discovering those values - 4 hours of his work. + GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f); + GetBGObject(BG_SA_BOAT_TWO)->UpdateRotationFields(1.0f, 0.00001f); + SpawnBGObject(BG_SA_BOAT_ONE, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_SA_BOAT_TWO, RESPAWN_IMMEDIATELY); + + TotalTime = 0; + ShipsStarted = false; + + //Graveyards! + for (uint8 i = 0;i < BG_SA_MAX_GY; i++) + { + WorldSafeLocsEntry const *sg = NULL; + sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + + if (!sg) + { + sLog.outError("SOTA: Can't find GY entry %u",BG_SA_GYEntries[i]); + return false; + } + + if (i == BG_SA_BEACH_GY) + { + GraveyardStatus[i] = attackers; + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE)? HORDE : ALLIANCE)); + } + else + { + GraveyardStatus[i] = ((attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE); + if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE)? ALLIANCE : HORDE))) + sLog.outError("SOTA: couldn't spawn GY: %u",i); + } + } + + //GY capture points + for (uint8 i = BG_SA_CENTRAL_FLAG; i < BG_SA_MAXOBJ; i++) + { + AddObject(i, BG_SA_ObjEntries[(i + (attackers == TEAM_ALLIANCE ? 3:0))], + BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], + BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3], + 0,0,0,0,RESPAWN_ONE_DAY); + GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF); + } + + //Player may enter BEFORE we set up bG - lets update his worldstates anyway... + UpdateWorldState(BG_SA_RIGHT_GY_HORDE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + UpdateWorldState(BG_SA_LEFT_GY_HORDE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + UpdateWorldState(BG_SA_CENTER_GY_HORDE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0); + + UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + + if (attackers == TEAM_ALLIANCE) + { + UpdateWorldState(BG_SA_ALLY_ATTACKS, 1); + UpdateWorldState(BG_SA_HORDE_ATTACKS, 0); + + UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_ALL, 1); + UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_ALL, 1); + UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_HRD, 0); + UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_HRD, 0); + + UpdateWorldState(BG_SA_HORDE_DEFENCE_TOKEN,1); + UpdateWorldState(BG_SA_ALLIANCE_DEFENCE_TOKEN,0); + } + else + { + UpdateWorldState(BG_SA_HORDE_ATTACKS, 1); + UpdateWorldState(BG_SA_ALLY_ATTACKS, 0); + + UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_ALL, 0); + UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_ALL, 0); + UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_HRD, 1); + UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_HRD, 1); + + UpdateWorldState(BG_SA_HORDE_DEFENCE_TOKEN,0); + UpdateWorldState(BG_SA_ALLIANCE_DEFENCE_TOKEN,1); + } + + UpdateWorldState(BG_SA_PURPLE_GATEWS, 1); + UpdateWorldState(BG_SA_RED_GATEWS, 1); + UpdateWorldState(BG_SA_BLUE_GATEWS, 1); + UpdateWorldState(BG_SA_GREEN_GATEWS, 1); + UpdateWorldState(BG_SA_YELLOW_GATEWS, 1); + UpdateWorldState(BG_SA_ANCIENT_GATEWS, 1); + + TeleportPlayers(); + return true; +} + +void BattleGroundSA::StartShips() +{ + if (ShipsStarted) + return; + + DoorOpen(BG_SA_BOAT_ONE); + DoorOpen(BG_SA_BOAT_TWO); + + for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++) + { + for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++) + { + if (Player* p = objmgr.GetPlayer(itr->first)) + { + if (p->GetTeamId() != attackers) + continue; + + UpdateData data; + WorldPacket pkt; + GetBGObject(i)->BuildValuesUpdateBlockForPlayer(&data, p); + data.BuildPacket(&pkt); + p->GetSession()->SendPacket(&pkt); + } + } + } + ShipsStarted = true; +} + +void BattleGroundSA::Update(uint32 diff) +{ + if (InitSecondRound) + { + if (UpdateWaitTimer < diff) + { + if (!SignaledRoundTwo) + { + SignaledRoundTwo = true; + InitSecondRound = false; + SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); + } + }else + { + UpdateWaitTimer -= diff; + return; + } + } + BattleGround::Update(diff); + TotalTime += diff; + + if (status == BG_SA_WARMUP ) + { + BG_SA_ENDROUNDTIME = BG_SA_ROUNDLENGTH; + if (TotalTime >= BG_SA_WARMUPLENGTH) + { + TotalTime = 0; + ToggleTimer(); + DemolisherStartState(false); + status = BG_SA_ROUND_ONE; + } + if (TotalTime >= BG_SA_BOAT_START) + StartShips(); + return; + } + else if (status == BG_SA_SECOND_WARMUP) + { + if (RoundScores[0].time= 60000) + { + SendWarningToAll(LANG_BG_SA_HAS_BEGUN); + TotalTime = 0; + ToggleTimer(); + DemolisherStartState(false); + status = BG_SA_ROUND_TWO; + } + if (TotalTime >= 30000) + { + if (!SignaledRoundTwoHalfMin) + { + SignaledRoundTwoHalfMin = true; + SendMessageToAll(LANG_BG_SA_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); + } + } + StartShips(); + return; + } + else if (GetStatus() == STATUS_IN_PROGRESS) + { + if (status == BG_SA_ROUND_ONE) + { + if (TotalTime >= BG_SA_ROUNDLENGTH) + { + RoundScores[0].winner = attackers; + RoundScores[0].time = BG_SA_ROUNDLENGTH; + TotalTime = 0; + status = BG_SA_SECOND_WARMUP; + attackers = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE; + status = BG_SA_SECOND_WARMUP; + ToggleTimer(); + ResetObjs(); + return; + } + } + else if (status == BG_SA_ROUND_TWO) + { + if (TotalTime >= BG_SA_ENDROUNDTIME) + { + RoundScores[1].time = BG_SA_ROUNDLENGTH; + RoundScores[1].winner = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE; + + if (RoundScores[0].time == RoundScores[1].time) + EndBattleGround(NULL); + else if (RoundScores[0].time < RoundScores[1].time) + EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE); + else + EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE); + return; + } + } + if (status == BG_SA_ROUND_ONE || status == BG_SA_ROUND_TWO) + { + SendTime(); + UpdateDemolisherSpawns(); + } + } +} + +void BattleGroundSA::StartingEventCloseDoors() +{ +} + +void BattleGroundSA::StartingEventOpenDoors() +{ +} + +void BattleGroundSA::FillInitialWorldStates(WorldPacket& data) +{ + uint32 ally_attacks = uint32(attackers == TEAM_ALLIANCE ? 1 : 0); + uint32 horde_attacks = uint32(attackers == TEAM_HORDE ? 1 : 0); + + data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(GateStatus[BG_SA_ANCIENT_GATE]); + data << uint32(BG_SA_YELLOW_GATEWS) << uint32(GateStatus[BG_SA_YELLOW_GATE]); + data << uint32(BG_SA_GREEN_GATEWS) << uint32(GateStatus[BG_SA_GREEN_GATE]); + data << uint32(BG_SA_BLUE_GATEWS) << uint32(GateStatus[BG_SA_BLUE_GATE]); + data << uint32(BG_SA_RED_GATEWS) << uint32(GateStatus[BG_SA_RED_GATE]); + data << uint32(BG_SA_PURPLE_GATEWS) << uint32(GateStatus[BG_SA_PURPLE_GATE]); + + data << uint32(BG_SA_BONUS_TIMER) << uint32(0); + + data << uint32(BG_SA_HORDE_ATTACKS)<< horde_attacks; + data << uint32(BG_SA_ALLY_ATTACKS) << ally_attacks; + + //Time will be sent on first update... + data << uint32(BG_SA_ENABLE_TIMER) << ((TimerEnabled) ? uint32(1) : uint32(0)); + data << uint32(BG_SA_TIMER_MINS) << uint32(0); + data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0); + data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0); + + data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0); + data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0); + + data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0); + + data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks; + data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks; + + data << uint32(BG_SA_LEFT_ATT_TOKEN_HRD) << horde_attacks; + data << uint32(BG_SA_RIGHT_ATT_TOKEN_HRD) << horde_attacks; + data << uint32(BG_SA_RIGHT_ATT_TOKEN_ALL) << ally_attacks; + data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks; +} + +void BattleGroundSA::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundSAScore* sc = new BattleGroundSAScore; + + if (!ShipsStarted) + { + if (plr->GetTeamId() == attackers) + { + plr->CastSpell(plr,12438,true);//Without this player falls before boat loads... + + if (urand(0,1)) + plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0); + else + plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0); + + } + else + plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); + } + else + { + if (plr->GetTeamId() == attackers) + plr->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0); + else + plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); + } + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/) +{ +} + +void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; +} + +void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) +{ + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + if (itr == m_PlayerScores.end()) // player not found... + return; + + if (type == SCORE_DESTROYED_DEMOLISHER) + ((BattleGroundSAScore*)itr->second)->demolishers_destroyed += value; + else if (type == SCORE_DESTROYED_WALL) + ((BattleGroundSAScore*)itr->second)->gates_destroyed += value; + else + BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor); +} + +void BattleGroundSA::TeleportPlayers() +{ + for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + { + if (Player *plr = objmgr.GetPlayer(itr->first)) + { + // should remove spirit of redemption + if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT); + + if (!plr->isAlive()) + { + plr->ResurrectPlayer(1.0f); + plr->SpawnCorpseBones(); + } + + plr->SetHealth(plr->GetMaxHealth()); + plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA)); + plr->CombatStopWithPets(true); + + if (plr->GetTeamId() == attackers) + { + plr->CastSpell(plr,12438,true); //Without this player falls before boat loads... + + if (urand(0,1)) + plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0); + else + plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0); + } + else + plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); + } + } +} + +void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent) +{ + if (!go || !go->GetGOInfo()) + return; + + switch(hitType) + { + case BG_OBJECT_DMG_HIT_TYPE_JUST_DAMAGED://under attack + SendWarningToAll(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name); + break; + case BG_OBJECT_DMG_HIT_TYPE_DAMAGED: + break; + case BG_OBJECT_DMG_HIT_TYPE_JUST_HIGH_DAMAGED: + { + uint32 i = GetGateIDFromDestroyEventID(destroyedEvent); + GateStatus[i] = BG_SA_GATE_DAMAGED; + uint32 uws = GetWorldStateFromGateID(i); + if (uws) + UpdateWorldState(uws, GateStatus[i]); + break; + } + case BG_OBJECT_DMG_HIT_TYPE_HIGH_DAMAGED: + break; + case BG_OBJECT_DMG_HIT_TYPE_JUST_DESTROYED://handled at DestroyGate() + if (destroyedEvent == 19837) + SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED); + else + SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name); + break; + } +} + +void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer) +{ + if (!unit) + return; + + if (unit->GetEntry() == 28781) //Demolisher + UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1); +} + +/* + You may ask what the fuck does it do? + Prevents owner overwriting guns faction with own. + */ +void BattleGroundSA::OverrideGunFaction() +{ + if (!m_BgCreatures[0]) + return; + + for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++) + { + if (Creature* gun = GetBGCreature(i)) + gun->setFaction(BG_SA_Factions[attackers? TEAM_ALLIANCE : TEAM_HORDE]); + } + + for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++) + { + if (Creature* dem = GetBGCreature(i)) + dem->setFaction(BG_SA_Factions[attackers]); + } +} + +void BattleGroundSA::DemolisherStartState(bool start) +{ + if (!m_BgCreatures[0]) + return; + + for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) + { + if (Creature* dem = GetBGCreature(i)) + { + if (start) + dem->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + else + dem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + } + } +} + +void BattleGroundSA::DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent) +{ + uint32 i = GetGateIDFromDestroyEventID(destroyedEvent); + if (!GateStatus[i]) + return; + + if (GameObject* g = GetBGObject(i)) + { + if (g->GetGOValue()->building.health == 0) + { + GateStatus[i] = BG_SA_GATE_DESTROYED; + uint32 uws = GetWorldStateFromGateID(i); + if (uws) + UpdateWorldState(uws, GateStatus[i]); + bool rewardHonor = true; + switch(i) + { + case BG_SA_GREEN_GATE: + if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED) + rewardHonor = false; + break; + case BG_SA_BLUE_GATE: + if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED) + rewardHonor = false; + break; + case BG_SA_RED_GATE: + if (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED) + rewardHonor = false; + break; + case BG_SA_PURPLE_GATE: + if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED) + rewardHonor = false; + break; + } + + if (i < 5) + DelObject(i+9); + UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1); + if (rewardHonor) + UpdatePlayerScore(pl,SCORE_BONUS_HONOR,(GetBonusHonorFromKill(1))); + } + } +} + +WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player) +{ + uint32 safeloc = 0; + WorldSafeLocsEntry const* ret; + WorldSafeLocsEntry const* closest; + float dist, nearest; + float x,y,z; + + player->GetPosition(x,y,z); + + if (player->GetTeamId() == attackers) + safeloc = BG_SA_GYEntries[BG_SA_BEACH_GY]; + else + safeloc = BG_SA_GYEntries[BG_SA_DEFENDER_LAST_GY]; + + closest = sWorldSafeLocsStore.LookupEntry(safeloc); + nearest = sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y)+(closest->z - z)*(closest->z - z)); + + for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++) + { + if (GraveyardStatus[i] != player->GetTeamId()) + continue; + + ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y)+(ret->z - z)*(ret->z - z)); + if (dist < nearest) + { + closest = ret; + nearest = dist; + } + } + + return closest; +} + +void BattleGroundSA::SendTime() +{ + uint32 end_of_round = (BG_SA_ENDROUNDTIME - TotalTime); + UpdateWorldState(BG_SA_TIMER_MINS, end_of_round/60000); + UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round%60000)/10000); + UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000); +} + +void BattleGroundSA::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) +{ + switch(target_obj->GetEntry()) + { + case 191307: + case 191308: + if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED) + CaptureGraveyard(BG_SA_LEFT_CAPTURABLE_GY, Source); + break; + case 191305: + case 191306: + if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED) + CaptureGraveyard(BG_SA_RIGHT_CAPTURABLE_GY, Source); + break; + case 191310: + case 191309: + if ((GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED) && (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED)) + CaptureGraveyard(BG_SA_CENTRAL_CAPTURABLE_GY, Source); + break; + default: + return; + }; +} + +void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source) +{ + DelCreature(BG_SA_MAXNPC + i); + GraveyardStatus[i] = Source->GetTeamId(); + WorldSafeLocsEntry const *sg = NULL; + sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); + AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE)); + uint32 npc = 0; + uint32 flag = 0; + + switch(i) + { + case BG_SA_LEFT_CAPTURABLE_GY: + flag = BG_SA_LEFT_FLAG; + DelObject(flag); + AddObject(flag,BG_SA_ObjEntries[(flag + (Source->GetTeamId() == TEAM_ALLIANCE ? 0:3))], + BG_SA_ObjSpawnlocs[flag][0],BG_SA_ObjSpawnlocs[flag][1], + BG_SA_ObjSpawnlocs[flag][2],BG_SA_ObjSpawnlocs[flag][3],0,0,0,0,RESPAWN_ONE_DAY); + + npc = BG_SA_NPC_RIGSPARK; + AddCreature(BG_SA_NpcEntries[npc], npc, attackers, + BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1], + BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]); + + UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0)); + UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1)); + if (Source->GetTeamId() == TEAM_ALLIANCE) + SendWarningToAll(LANG_BG_SA_A_GY_WEST); + else + SendWarningToAll(LANG_BG_SA_H_GY_WEST); + break; + case BG_SA_RIGHT_CAPTURABLE_GY: + flag = BG_SA_RIGHT_FLAG; + DelObject(flag); + AddObject(flag,BG_SA_ObjEntries[(flag + (Source->GetTeamId() == TEAM_ALLIANCE ? 0:3))], + BG_SA_ObjSpawnlocs[flag][0],BG_SA_ObjSpawnlocs[flag][1], + BG_SA_ObjSpawnlocs[flag][2],BG_SA_ObjSpawnlocs[flag][3],0,0,0,0,RESPAWN_ONE_DAY); + + npc = BG_SA_NPC_SPARKLIGHT; + AddCreature(BG_SA_NpcEntries[npc], npc, attackers, + BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1], + BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]); + + UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0)); + UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1)); + if (Source->GetTeamId() == TEAM_ALLIANCE) + SendWarningToAll(LANG_BG_SA_A_GY_EAST); + else + SendWarningToAll(LANG_BG_SA_H_GY_EAST); + break; + case BG_SA_CENTRAL_CAPTURABLE_GY: + flag = BG_SA_CENTRAL_FLAG; + DelObject(flag); + AddObject(flag,BG_SA_ObjEntries[(flag + (Source->GetTeamId() == TEAM_ALLIANCE ? 0:3))], + BG_SA_ObjSpawnlocs[flag][0],BG_SA_ObjSpawnlocs[flag][1], + BG_SA_ObjSpawnlocs[flag][2],BG_SA_ObjSpawnlocs[flag][3],0,0,0,0,RESPAWN_ONE_DAY); + + UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0)); + UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1)); + if (Source->GetTeamId() == TEAM_ALLIANCE) + SendWarningToAll(LANG_BG_SA_A_GY_SOUTH); + else + SendWarningToAll(LANG_BG_SA_H_GY_SOUTH); + break; + default: + ASSERT(0); + break; + }; +} + +void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object) +{ + if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC] && GateStatus[BG_SA_ANCIENT_GATE] == BG_SA_GATE_DESTROYED) + { + if (Source->GetTeamId() == attackers) + { + if (Source->GetTeamId() == ALLIANCE) + SendMessageToAll(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); + else SendMessageToAll(LANG_BG_SA_HORDE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); + + if (status == BG_SA_ROUND_ONE) + { + RoundScores[0].winner = attackers; + RoundScores[0].time = TotalTime; + attackers = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE; + status = BG_SA_SECOND_WARMUP; + TotalTime = 0; + ToggleTimer(); + SendWarningToAll(LANG_BG_SA_ROUND_ONE_END); + UpdateWaitTimer = 5000; + SignaledRoundTwo = false; + SignaledRoundTwoHalfMin = false; + InitSecondRound = true; + ResetObjs(); + } + else if (status == BG_SA_ROUND_TWO) + { + RoundScores[1].winner = attackers; + RoundScores[1].time = TotalTime;ToggleTimer(); + if (RoundScores[0].time == RoundScores[1].time) + EndBattleGround(NULL); + else if (RoundScores[0].time < RoundScores[1].time) + EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE); + else + EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE); + } + } + } +} + +void BattleGroundSA::ToggleTimer() +{ + TimerEnabled = !TimerEnabled; + UpdateWorldState(BG_SA_ENABLE_TIMER, (TimerEnabled) ? 1 : 0); +} + +void BattleGroundSA::EndBattleGround(uint32 winner) +{ + //honor reward for winning + if (winner == ALLIANCE) + RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE); + else if (winner == HORDE) + RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE); + + //complete map_end rewards (even if no team wins) + RewardHonorToTeam(GetBonusHonorFromKill(2), ALLIANCE); + RewardHonorToTeam(GetBonusHonorFromKill(2), HORDE); + + BattleGround::EndBattleGround(winner); +} + +void BattleGroundSA::UpdateDemolisherSpawns() +{ + for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) + { + if (m_BgCreatures[i]) + { + if (Creature *Demolisher = GetBGCreature(i)) + { + if (Demolisher->isDead()) + { + uint8 gy = (i >= BG_SA_DEMOLISHER_3 ? 3 : 2); + if (GraveyardStatus[gy] == attackers) + Demolisher->Relocate(BG_SA_NpcSpawnlocs[i + 6][0], BG_SA_NpcSpawnlocs[i + 6][1], + BG_SA_NpcSpawnlocs[i + 6][2], BG_SA_NpcSpawnlocs[i + 6][3]); + else + Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1], + BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]); + + Demolisher->Respawn(); + } + } + } + } +} + + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundSA.h b/src/server/game/BattleGrounds/Zones/BattleGroundSA.h new file mode 100644 index 0000000..f1299fb --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundSA.h @@ -0,0 +1,384 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDSA_H +#define __BATTLEGROUNDSA_H + +class BattleGround; + +class BattleGroundSAScore : public BattleGroundScore +{ + public: + BattleGroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) {}; + virtual ~BattleGroundSAScore() {}; + uint8 demolishers_destroyed; + uint8 gates_destroyed; +}; + +#define BG_SA_FLAG_AMOUNT 3 +#define BG_SA_DEMOLISHER_AMOUNT 4 + +enum BG_SA_Status + { + BG_SA_NOTSTARTED = 0, + BG_SA_WARMUP, + BG_SA_ROUND_ONE, + BG_SA_SECOND_WARMUP, + BG_SA_ROUND_TWO, + BG_SA_BONUS_ROUND + }; + +enum BG_SA_GateState + { + BG_SA_GATE_OK = 1, + BG_SA_GATE_DAMAGED = 2, + BG_SA_GATE_DESTROYED = 3 + }; + +enum BG_SA_Timers + { + BG_SA_BOAT_START = 60000, + BG_SA_WARMUPLENGTH = 120000, + BG_SA_ROUNDLENGTH = 600000 + }; + +enum BG_SA_WorldStates + { + BG_SA_TIMER_MINS = 3559, + BG_SA_TIMER_SEC_TENS = 3560, + BG_SA_TIMER_SEC_DECS = 3561, + BG_SA_ALLY_ATTACKS = 4352, + BG_SA_HORDE_ATTACKS = 4353, + + BG_SA_PURPLE_GATEWS = 3614, + BG_SA_RED_GATEWS = 3617, + BG_SA_BLUE_GATEWS = 3620, + BG_SA_GREEN_GATEWS = 3623, + BG_SA_YELLOW_GATEWS = 3638, + BG_SA_ANCIENT_GATEWS = 3849, + + + BG_SA_LEFT_GY_ALLIANCE = 3635, + BG_SA_RIGHT_GY_ALLIANCE = 3636, + BG_SA_CENTER_GY_ALLIANCE = 3637, + + BG_SA_RIGHT_ATT_TOKEN_ALL = 3627, + BG_SA_LEFT_ATT_TOKEN_ALL = 3626, + + BG_SA_LEFT_ATT_TOKEN_HRD = 3629, + BG_SA_RIGHT_ATT_TOKEN_HRD = 3628, + + BG_SA_HORDE_DEFENCE_TOKEN = 3631, + BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630, + + BG_SA_RIGHT_GY_HORDE = 3632, + BG_SA_LEFT_GY_HORDE = 3633, + BG_SA_CENTER_GY_HORDE = 3634, + + BG_SA_BONUS_TIMER = 0xdf3, + BG_SA_ENABLE_TIMER = 3564, + }; + +enum BG_SA_NPCs + { + BG_SA_GUN_1 = 0, + BG_SA_GUN_2, + BG_SA_GUN_3, + BG_SA_GUN_4, + BG_SA_GUN_5, + BG_SA_GUN_6, + BG_SA_GUN_7, + BG_SA_GUN_8, + BG_SA_GUN_9, + BG_SA_GUN_10, + BG_SA_DEMOLISHER_1, + BG_SA_DEMOLISHER_2, + BG_SA_DEMOLISHER_3, + BG_SA_DEMOLISHER_4, + BG_SA_NPC_SPARKLIGHT, + BG_SA_NPC_RIGSPARK, + BG_SA_MAXNPC + }; + +const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] = + { + 27894, + 27894, + 27894, + 27894, + 27894, + 27894, + 27894, + 27894, + 27894, + 27894, + //4 beach demolishers + 28781, + 28781, + 28781, + 28781, + //Fizzle Sparklight, or whatever his name was + 29260, + 29262, + }; + +const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] = + { + //Cannons + { 1436.429f, 110.05f, 41.407f, 5.4f }, + { 1404.9023f, 84.758f, 41.183f, 5.46f }, + { 1068.693f, -86.951f, 93.81f, 0.02f }, + { 1068.83f, -127.56f, 96.45f, 0.0912f }, + { 1422.115f, -196.433f, 42.1825f, 1.0222f }, + { 1454.887f, -220.454f, 41.956f, 0.9627f }, + { 1232.345f, -187.517f, 66.945f, 0.45f }, + { 1249.634f, -224.189f, 66.72f, 0.635f }, + { 1236.213f, 92.287f, 64.965f, 5.751f }, + { 1215.11f, 57.772f, 64.739f, 5.78f } , + //Demolishers + { 1611.597656,-117.270073,8.719355,2.513274}, + { 1575.562500,-158.421875,5.024450,2.129302}, + { 1618.047729,61.424641,7.248210,3.979351}, + { 1575.103149,98.873344,2.830360,3.752458}, + //Npcs + { 1348.644165, -298.786469, 31.080130, 1.710423}, + { 1358.191040, 195.527786, 31.018187, 4.171337}, + //Demolishers2 + { 1371.055786, -317.071136, 35.007359, 1.947460}, + { 1424.034912, -260.195190, 31.084425, 2.820013}, + { 1353.139893, 223.745438, 35.265411, 4.343684}, + { 1404.809570, 197.027237, 32.046032, 3.605401}, + }; + +enum BG_SA_Objects + { + BG_SA_GREEN_GATE = 0, + BG_SA_YELLOW_GATE, + BG_SA_BLUE_GATE, + BG_SA_RED_GATE, + BG_SA_PURPLE_GATE, + BG_SA_ANCIENT_GATE, + BG_SA_TITAN_RELIC, + BG_SA_BOAT_ONE, + BG_SA_BOAT_TWO, + BG_SA_SIGIL_1, + BG_SA_SIGIL_2, + BG_SA_SIGIL_3, + BG_SA_SIGIL_4, + BG_SA_SIGIL_5, + BG_SA_CENTRAL_FLAGPOLE, + BG_SA_RIGHT_FLAGPOLE, + BG_SA_LEFT_FLAGPOLE, + BG_SA_CENTRAL_FLAG, + BG_SA_RIGHT_FLAG, + BG_SA_LEFT_FLAG, + BG_SA_MAXOBJ + }; + +const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = + { + { 1411.57f, 108.163f, 28.692f, 5.441f }, + { 1055.452f, -108.1f, 82.134f, 0.034f }, + { 1431.3413f, -219.437f, 30.893f, 0.9736f }, + { 1227.667f, -212.555f, 55.372f, 0.5023f }, + { 1214.681f, 81.21f, 53.413f, 5.745f }, + { 878.555f, -108.2f, 117.845f, 0.0f }, + { 836.5f, -108.8f, 120.219f, 0.0f }, + //Ships + { 2679.696777, -826.891235, 3.712860, 5.78367f}, //rot2 1 rot3 0.0002 + { 2574.003662, 981.261475, 2.603424, 0.807696}, + //Sigils + { 1414.054f, 106.72f, 41.442f, 5.441f }, + { 1060.63f, -107.8f, 94.7f, 0.034f }, + { 1433.383f, -216.4f, 43.642f, 0.9736f }, + { 1230.75f, -210.724f, 67.611f, 0.5023f }, + { 1217.8f, 79.532f, 66.58f, 5.745f }, + //Flagpoles + { 1215.114258,-65.711861,70.084267,-3.124123}, + {1338.863892,-153.336533,30.895121,-2.530723}, + {1309.124268,9.410645,30.893402,-1.623156}, + //Flags + { 1215.108032,-65.715767,70.084267,-3.124123}, + { 1338.859253,-153.327316,30.895077,-2.530723}, + { 1309.192017,9.416233,30.893402,1.518436}, + }; + +/* Ships: + * 193182 - ally + * 193183 - horde + * 193184 - horde + * 193185 - ally + * Banners: + * 191308 - left one, + * 191306 - right one, + * 191310 - central, + * Ally ones, substract 1 + * to get horde ones. + */ + +const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = + { + 190722, + 190727, + 190724, + 190726, + 190723, + 192549, + 192834, + 193182, + 193185, + 192687, + 192685, + 192689, + 192690, + 192691, + 191311, + 191311, + 191311, + 191310, + 191306, + 191308, + 191309, + 191305, + 191307, + }; + +const uint32 BG_SA_Factions[2] = + { + 1732, + 1735, + }; + +enum BG_SA_Graveyards + { + BG_SA_BEACH_GY = 0, + BG_SA_DEFENDER_LAST_GY, + BG_SA_RIGHT_CAPTURABLE_GY, + BG_SA_LEFT_CAPTURABLE_GY, + BG_SA_CENTRAL_CAPTURABLE_GY, + BG_SA_MAX_GY + }; + +const uint32 BG_SA_GYEntries[BG_SA_MAX_GY] = + { + 1350, + 1349, + 1347, + 1346, + 1348, + }; + +const float BG_SA_GYOrientation[BG_SA_MAX_GY] = + { + 6.202f, + 1.926f, //right capturable GY + 3.917f, //left capturable GY + 3.104f, //center, capturable + 6.148f, //defender last GY + }; + +struct BG_SA_RoundScore +{ + TeamId winner; + uint32 time; +}; + +class BattleGroundSA : public BattleGround +{ + friend class BattleGroundMgr; + + public: + BattleGroundSA(); + ~BattleGroundSA(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + virtual bool SetupBattleGround(); + virtual void Reset(); + virtual void FillInitialWorldStates(WorldPacket& data); + virtual void EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent); + virtual void HandleKillUnit(Creature* unit, Player* killer); + virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); + virtual void EventPlayerUsedGO(Player* Source, GameObject* object); + uint32 GetGateIDFromDestroyEventID(uint32 id) + { + uint32 i = 0; + switch(id) + { + case 19046: i = BG_SA_GREEN_GATE; break; //Green gate destroyed + case 19045: i = BG_SA_BLUE_GATE; break; //blue gate + case 19047: i = BG_SA_RED_GATE; break; //red gate + case 19048: i = BG_SA_PURPLE_GATE; break; //purple gate + case 19049: i = BG_SA_YELLOW_GATE; break; //yellow gate + case 19837: i = BG_SA_ANCIENT_GATE; break; //ancient gate + } + return i; + } + uint32 GetWorldStateFromGateID(uint32 id) + { + uint32 uws = 0; + switch(id) + { + case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break; + case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break; + case BG_SA_BLUE_GATE: uws = BG_SA_BLUE_GATEWS; break; + case BG_SA_RED_GATE: uws = BG_SA_RED_GATEWS; break; + case BG_SA_PURPLE_GATE: uws = BG_SA_PURPLE_GATEWS; break; + case BG_SA_ANCIENT_GATE: uws = BG_SA_ANCIENT_GATEWS; break; + } + return uws; + } + void EndBattleGround(uint32 winner); + + void RemovePlayer(Player *plr,uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + + + /* Scorekeeping */ + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + + private: + bool ResetObjs(); + void StartShips(); + void TeleportPlayers(); + void OverrideGunFaction(); + void DemolisherStartState(bool start); + void DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent); + void SendTime(); + void CaptureGraveyard(BG_SA_Graveyards i, Player *Source); + void ToggleTimer(); + void UpdateDemolisherSpawns(); + TeamId attackers; + uint32 TotalTime; + uint32 BG_SA_ENDROUNDTIME; + bool ShipsStarted; + BG_SA_GateState GateStatus[6]; + BG_SA_Status status; + TeamId GraveyardStatus[BG_SA_MAX_GY]; + BG_SA_RoundScore RoundScores[2]; + bool TimerEnabled; + uint32 UpdateWaitTimer;//5secs before starting the 1min countdown for second round + bool SignaledRoundTwo; + bool SignaledRoundTwoHalfMin; + bool InitSecondRound; +}; +#endif diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundWS.cpp b/src/server/game/BattleGrounds/Zones/BattleGroundWS.cpp new file mode 100644 index 0000000..2521e93 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundWS.cpp @@ -0,0 +1,841 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BattleGround.h" +#include "BattleGroundWS.h" +#include "Creature.h" +#include "GameObject.h" +#include "Language.h" +#include "Object.h" +#include "ObjectMgr.h" +#include "BattleGroundMgr.h" +#include "Player.h" +#include "World.h" +#include "WorldPacket.h" + +// these variables aren't used outside of this file, so declare them only here +enum BG_WSG_Rewards +{ + BG_WSG_WIN = 0, + BG_WSG_FLAG_CAP, + BG_WSG_MAP_COMPLETE, + BG_WSG_REWARD_NUM +}; + +uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { + {20,40,40}, // normal honor + {60,40,80} // holiday +}; + +uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { + {0,35,0}, // normal honor + {0,45,0} // holiday +}; + +BattleGroundWS::BattleGroundWS() +{ + m_BgObjects.resize(BG_WS_OBJECT_MAX); + m_BgCreatures.resize(BG_CREATURES_MAX_WS); + + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; + m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; +} + +BattleGroundWS::~BattleGroundWS() +{ +} + +void BattleGroundWS::Update(uint32 diff) +{ + BattleGround::Update(diff); + + if (GetStatus() == STATUS_IN_PROGRESS) + { + if (GetStartTime() >= 25*MINUTE*IN_MILLISECONDS) + { + if (GetTeamScore(ALLIANCE) == 0) + { + if (GetTeamScore(HORDE) == 0) // No one scored - result is tie + EndBattleGround(NULL); + else // Horde has more points and thus wins + EndBattleGround(HORDE); + } + + else if (GetTeamScore(HORDE) == 0) + EndBattleGround(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins + + else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag + EndBattleGround(m_LastFlagCaptureTeam); + + else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score + EndBattleGround(HORDE); + else + EndBattleGround(ALLIANCE); + } + else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILLISECONDS) + { + ++m_minutesElapsed; + UpdateWorldState(BG_WS_STATE_TIMER, 25-m_minutesElapsed); + } + + if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) + { + m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff; + + if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0) + { + m_FlagsTimer[BG_TEAM_ALLIANCE] = 0; + RespawnFlag(ALLIANCE, true); + } + } + if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) + { + m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff; + + if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0) + { + m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0; + RespawnFlagAfterDrop(ALLIANCE); + m_BothFlagsKept = false; + } + } + if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) + { + m_FlagsTimer[BG_TEAM_HORDE] -= diff; + + if (m_FlagsTimer[BG_TEAM_HORDE] < 0) + { + m_FlagsTimer[BG_TEAM_HORDE] = 0; + RespawnFlag(HORDE, true); + } + } + if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) + { + m_FlagsDropTimer[BG_TEAM_HORDE] -= diff; + + if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0) + { + m_FlagsDropTimer[BG_TEAM_HORDE] = 0; + RespawnFlagAfterDrop(HORDE); + m_BothFlagsKept = false; + } + } + if (m_BothFlagsKept) + { + m_FlagSpellForceTimer += diff; + if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes + { + if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0])) + plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true); + if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1])) + plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true); + m_FlagDebuffState = 1; + } + else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes + { + if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0])) + { + plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true); + } + if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1])) + { + plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true); + } + m_FlagDebuffState = 2; + } + } + else + { + m_FlagSpellForceTimer = 0; //reset timer. + m_FlagDebuffState = 0; + } + } +} + +void BattleGroundWS::StartingEventCloseDoors() +{ + for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i) + { + DoorClose(i); + SpawnBGObject(i, RESPAWN_IMMEDIATELY); + } + for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) + SpawnBGObject(i, RESPAWN_ONE_DAY); + + UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1); + UpdateWorldState(BG_WS_STATE_TIMER, 25); +} + +void BattleGroundWS::StartingEventOpenDoors() +{ + for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i) + DoorOpen(i); + for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; ++i) + DoorOpen(i); + + SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY); + SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY); + SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY); + SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); + + for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) + SpawnBGObject(i, RESPAWN_IMMEDIATELY); +} + +void BattleGroundWS::AddPlayer(Player *plr) +{ + BattleGround::AddPlayer(plr); + //create score and add it to map, default values are set in constructor + BattleGroundWGScore* sc = new BattleGroundWGScore; + + m_PlayerScores[plr->GetGUID()] = sc; +} + +void BattleGroundWS::RespawnFlag(uint32 Team, bool captured) +{ + if (Team == ALLIANCE) + { + sLog.outDebug("Respawn Alliance flag"); + m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + } + else + { + sLog.outDebug("Respawn Horde flag"); + m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + } + + if (captured) + { + //when map_update will be allowed for battlegrounds this code will be useless + SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); + SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); + PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound... + } + m_BothFlagsKept = false; +} + +void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + RespawnFlag(team,false); + if (team == ALLIANCE) + { + SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); + SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); + } + else + { + SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); + SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); + } + + PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); + + GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)); + if (obj) + obj->Delete(); + else + sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team))); + + SetDroppedFlagGUID(0,team); + m_BothFlagsKept = false; +} + +void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + uint32 winner = 0; + + Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); + if (Source->GetTeam() == ALLIANCE) + { + if (!this->IsHordeFlagPickedup()) + return; + SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time + // horde flag in base (but not respawned yet) + m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; + // Drop Horde Flag from Player + Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); + if (m_FlagDebuffState == 1) + Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + if (m_FlagDebuffState == 2) + Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); + if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE) + AddPoint(ALLIANCE, 1); + PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE); + RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE); + } + else + { + if (!this->IsAllianceFlagPickedup()) + return; + SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time + // alliance flag in base (but not respawned yet) + m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; + // Drop Alliance Flag from Player + Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); + if (m_FlagDebuffState == 1) + Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + if (m_FlagDebuffState == 2) + Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); + if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE) + AddPoint(HORDE, 1); + PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE); + RewardReputationToTeam(889, m_ReputationCapture, HORDE); + } + //for flag capture is reward 2 honorable kills + RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam()); + + SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME); + SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME); + + if (Source->GetTeam() == ALLIANCE) + SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); + else + SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source); + + UpdateFlagState(Source->GetTeam(), 1); // flag state none + UpdateTeamScore(Source->GetTeam()); + // only flag capture should be updated + UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures + + // update last flag capture to be used if teamscore is equal + SetLastFlagCapture(Source->GetTeam()); + + if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE) + winner = ALLIANCE; + + if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE) + winner = HORDE; + + if (winner) + { + UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0); + UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0); + UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1); + UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); + UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0); + + RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner); + EndBattleGround(winner); + } + else + { + m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; + } +} + +void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + { + // if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages + // just take off the aura + if (Source->GetTeam() == ALLIANCE) + { + if (!this->IsHordeFlagPickedup()) + return; + if (GetHordeFlagPickerGUID() == Source->GetGUID()) + { + SetHordeFlagPicker(0); + Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); + } + } + else + { + if (!this->IsAllianceFlagPickedup()) + return; + if (GetAllianceFlagPickerGUID() == Source->GetGUID()) + { + SetAllianceFlagPicker(0); + Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); + } + } + return; + } + + bool set = false; + + if (Source->GetTeam() == ALLIANCE) + { + if (!IsHordeFlagPickedup()) + return; + if (GetHordeFlagPickerGUID() == Source->GetGUID()) + { + SetHordeFlagPicker(0); + Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); + if (m_FlagDebuffState == 1) + Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + if (m_FlagDebuffState == 2) + Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); + m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; + Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); + set = true; + } + } + else + { + if (!IsAllianceFlagPickedup()) + return; + if (GetAllianceFlagPickerGUID() == Source->GetGUID()) + { + SetAllianceFlagPicker(0); + Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); + if (m_FlagDebuffState == 1) + Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + if (m_FlagDebuffState == 2) + Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); + m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; + Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); + set = true; + } + } + + if (set) + { + Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true); + UpdateFlagState(Source->GetTeam(), 1); + + if (Source->GetTeam() == ALLIANCE) + { + SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source); + UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); + } + else + { + SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); + UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); + } + + m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; + } +} + +void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + int32 message_id = 0; + ChatMsg type = CHAT_MSG_BG_SYSTEM_NEUTRAL; + + //alliance flag picked up from base + if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE + && this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) + { + message_id = LANG_BG_WS_PICKEDUP_AF; + type = CHAT_MSG_BG_SYSTEM_HORDE; + PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); + SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); + SetAllianceFlagPicker(Source->GetGUID()); + m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; + //update world state to show correct flag carrier + UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER); + UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); + Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true); + if (m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER) + m_BothFlagsKept = true; + } + + //horde flag picked up from base + if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE + && this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) + { + message_id = LANG_BG_WS_PICKEDUP_HF; + type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); + SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); + SetHordeFlagPicker(Source->GetGUID()); + m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; + //update world state to show correct flag carrier + UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); + UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); + Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true); + if (m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER) + m_BothFlagsKept = true; + } + + //Alliance flag on ground(not in base) (returned or picked up again from ground!) + if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + { + if (Source->GetTeam() == ALLIANCE) + { + message_id = LANG_BG_WS_RETURNED_AF; + type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + UpdateFlagState(HORDE, BG_WS_FLAG_STATE_WAIT_RESPAWN); + RespawnFlag(ALLIANCE, false); + SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); + PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); + UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1); + m_BothFlagsKept = false; + } + else + { + message_id = LANG_BG_WS_PICKEDUP_AF; + type = CHAT_MSG_BG_SYSTEM_HORDE; + PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); + SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); + SetAllianceFlagPicker(Source->GetGUID()); + Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true); + m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; + UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER); + if (m_FlagDebuffState == 1) + Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true); + if (m_FlagDebuffState == 2) + Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true); + UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); + } + //called in HandleGameObjectUseOpcode: + //target_obj->Delete(); + } + + //Horde flag on ground(not in base) (returned or picked up again) + if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + { + if (Source->GetTeam() == HORDE) + { + message_id = LANG_BG_WS_RETURNED_HF; + type = CHAT_MSG_BG_SYSTEM_HORDE; + UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN); + RespawnFlag(HORDE, false); + SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); + PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); + UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1); + m_BothFlagsKept = false; + } + else + { + message_id = LANG_BG_WS_PICKEDUP_HF; + type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); + SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); + SetHordeFlagPicker(Source->GetGUID()); + Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true); + m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; + UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); + if (m_FlagDebuffState == 1) + Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true); + if (m_FlagDebuffState == 2) + Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true); + UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); + } + //called in HandleGameObjectUseOpcode: + //target_obj->Delete(); + } + + if (!message_id) + return; + + SendMessageToAll(message_id, type, Source); + Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); +} + +void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) +{ + // sometimes flag aura not removed :( + if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid) + { + if (!plr) + { + sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); + this->SetAllianceFlagPicker(0); + this->RespawnFlag(ALLIANCE, false); + } + else + this->EventPlayerDroppedFlag(plr); + } + if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid) + { + if (!plr) + { + sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); + this->SetHordeFlagPicker(0); + this->RespawnFlag(HORDE, false); + } + else + this->EventPlayerDroppedFlag(plr); + } +} + +void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value) +{ + if (team == ALLIANCE) + UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value); + else + UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value); +} + +void BattleGroundWS::UpdateTeamScore(uint32 team) +{ + if (team == ALLIANCE) + UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team)); + else + UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team)); +} + +void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger) +{ + // this is wrong way to implement these things. On official it done by gameobject spell cast. + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + //uint32 SpellId = 0; + //uint64 buff_guid = 0; + switch(Trigger) + { + case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update(). + //buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1]; + break; + case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update(). + //buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_2]; + break; + case 3706: // Alliance elixir of regeneration spawn + //buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_1]; + break; + case 3708: // Horde elixir of regeneration spawn + //buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_2]; + break; + case 3707: // Alliance elixir of berserk spawn + //buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_1]; + break; + case 3709: // Horde elixir of berserk spawn + //buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2]; + break; + case 3646: // Alliance Flag spawn + if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE]) + if (GetHordeFlagPickerGUID() == Source->GetGUID()) + EventPlayerCapturedFlag(Source); + break; + case 3647: // Horde Flag spawn + if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE]) + if (GetAllianceFlagPickerGUID() == Source->GetGUID()) + EventPlayerCapturedFlag(Source); + break; + case 3649: // unk1 + case 3688: // unk2 + case 4628: // unk3 + case 4629: // unk4 + break; + default: + sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); + Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger); + break; + } + + //if (buff_guid) + // HandleTriggerBuff(buff_guid,Source); +} + +bool BattleGroundWS::SetupBattleGround() +{ + // flags + if (!AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000) + || !AddObject(BG_WS_OBJECT_H_FLAG, BG_OBJECT_H_FLAG_WS_ENTRY, 916.0226f, 1434.405f, 345.413f, 0.01745329f, 0, 0, 0.008726535f, 0.9999619f, BG_WS_FLAG_RESPAWN_TIME/1000) + // buffs + || !AddObject(BG_WS_OBJECT_SPEEDBUFF_1, BG_OBJECTID_SPEEDBUFF_ENTRY, 1449.93f, 1470.71f, 342.6346f, -1.64061f, 0, 0, 0.7313537f, -0.6819983f, BUFF_RESPAWN_TIME) + || !AddObject(BG_WS_OBJECT_SPEEDBUFF_2, BG_OBJECTID_SPEEDBUFF_ENTRY, 1005.171f, 1447.946f, 335.9032f, 1.64061f, 0, 0, 0.7313537f, 0.6819984f, BUFF_RESPAWN_TIME) + || !AddObject(BG_WS_OBJECT_REGENBUFF_1, BG_OBJECTID_REGENBUFF_ENTRY, 1317.506f, 1550.851f, 313.2344f, -0.2617996f, 0, 0, 0.1305263f, -0.9914448f, BUFF_RESPAWN_TIME) + || !AddObject(BG_WS_OBJECT_REGENBUFF_2, BG_OBJECTID_REGENBUFF_ENTRY, 1110.451f, 1353.656f, 316.5181f, -0.6806787f, 0, 0, 0.333807f, -0.9426414f, BUFF_RESPAWN_TIME) + || !AddObject(BG_WS_OBJECT_BERSERKBUFF_1, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1320.09f, 1378.79f, 314.7532f, 1.186824f, 0, 0, 0.5591929f, 0.8290376f, BUFF_RESPAWN_TIME) + || !AddObject(BG_WS_OBJECT_BERSERKBUFF_2, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1139.688f, 1560.288f, 306.8432f, -2.443461f, 0, 0, 0.9396926f, -0.3420201f, BUFF_RESPAWN_TIME) + // alliance gates + || !AddObject(BG_WS_OBJECT_DOOR_A_1, BG_OBJECT_DOOR_A_1_WS_ENTRY, 1503.335f, 1493.466f, 352.1888f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_A_2, BG_OBJECT_DOOR_A_2_WS_ENTRY, 1492.478f, 1457.912f, 342.9689f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_A_3, BG_OBJECT_DOOR_A_3_WS_ENTRY, 1468.503f, 1494.357f, 351.8618f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_A_4, BG_OBJECT_DOOR_A_4_WS_ENTRY, 1471.555f, 1458.778f, 362.6332f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_A_5, BG_OBJECT_DOOR_A_5_WS_ENTRY, 1492.347f, 1458.34f, 342.3712f, -0.03490669f, 0, 0, 0.01745246f, -0.9998477f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_A_6, BG_OBJECT_DOOR_A_6_WS_ENTRY, 1503.466f, 1493.367f, 351.7352f, -0.03490669f, 0, 0, 0.01745246f, -0.9998477f, RESPAWN_IMMEDIATELY) + // horde gates + || !AddObject(BG_WS_OBJECT_DOOR_H_1, BG_OBJECT_DOOR_H_1_WS_ENTRY, 949.1663f, 1423.772f, 345.6241f, -0.5756807f, -0.01673368f, -0.004956111f, -0.2839723f, 0.9586737f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_H_2, BG_OBJECT_DOOR_H_2_WS_ENTRY, 953.0507f, 1459.842f, 340.6526f, -1.99662f, -0.1971825f, 0.1575096f, -0.8239487f, 0.5073641f, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_H_3, BG_OBJECT_DOOR_H_3_WS_ENTRY, 949.9523f, 1422.751f, 344.9273f, 0.0f, 0, 0, 0, 1, RESPAWN_IMMEDIATELY) + || !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY) +) + { + sLog.outErrorDb("BatteGroundWS: Failed to spawn some object BattleGround not created!"); + return false; + } + + WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); + if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) + { + sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!"); + return false; + } + + sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); + if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) + { + sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!"); + return false; + } + + sLog.outDebug("BatteGroundWS: BG objects and spirit guides spawned"); + + return true; +} + +void BattleGroundWS::Reset() +{ + //call parent's class reset + BattleGround::Reset(); + + m_FlagKeepers[BG_TEAM_ALLIANCE] = 0; + m_FlagKeepers[BG_TEAM_HORDE] = 0; + m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; + m_DroppedFlagGUID[BG_TEAM_HORDE] = 0; + m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + m_TeamScores[BG_TEAM_ALLIANCE] = 0; + m_TeamScores[BG_TEAM_HORDE] = 0; + bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID()); + m_ReputationCapture = (isBGWeekend) ? 45 : 35; + m_HonorWinKills = (isBGWeekend) ? 3 : 1; + m_HonorEndKills = (isBGWeekend) ? 4 : 2; + // For WorldState + m_minutesElapsed = 0; + m_LastFlagCaptureTeam = 0; + + /* Spirit nodes is static at this BG and then not required deleting at BG reset. + if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE]) + DelCreature(WS_SPIRIT_MAIN_ALLIANCE); + if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE]) + DelCreature(WS_SPIRIT_MAIN_HORDE); + */ +} + +void BattleGroundWS::EndBattleGround(uint32 winner) +{ + //win reward + if (winner == ALLIANCE) + RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE); + if (winner == HORDE) + RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE); + //complete map_end rewards (even if no team wins) + RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE); + RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE); + + BattleGround::EndBattleGround(winner); +} + +void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer) +{ + if (GetStatus() != STATUS_IN_PROGRESS) + return; + + EventPlayerDroppedFlag(player); + + BattleGround::HandleKillPlayer(player, killer); +} + +void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor) +{ + + BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); + if (itr == m_PlayerScores.end()) // player not found + return; + + switch(type) + { + case SCORE_FLAG_CAPTURES: // flags captured + ((BattleGroundWGScore*)itr->second)->FlagCaptures += value; + break; + case SCORE_FLAG_RETURNS: // flags returned + ((BattleGroundWGScore*)itr->second)->FlagReturns += value; + break; + default: + BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor); + break; + } +} + +WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player) +{ + //if status in progress, it returns main graveyards with spiritguides + //else it will return the graveyard in the flagroom - this is especially good + //if a player dies in preparation phase - then the player can't cheat + //and teleport to the graveyard outside the flagroom + //and start running around, while the doors are still closed + if (player->GetTeam() == ALLIANCE) + { + if (GetStatus() == STATUS_IN_PROGRESS) + return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); + else + return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE); + } + else + { + if (GetStatus() == STATUS_IN_PROGRESS) + return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); + else + return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE); + } +} + +void BattleGroundWS::FillInitialWorldStates(WorldPacket& data) +{ + data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE)); + data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE)); + + if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) + data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1); + else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) + data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1); + else + data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0); + + if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) + data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1); + else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) + data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1); + else + data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0); + + data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE); + + if (GetStatus() == STATUS_IN_PROGRESS) + { + data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1); + data << uint32(BG_WS_STATE_TIMER) << uint32(25-m_minutesElapsed); + } + else + data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0); + + if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) + data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2); + else + data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1); + + if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) + data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2); + else + data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1); + +} + diff --git a/src/server/game/BattleGrounds/Zones/BattleGroundWS.h b/src/server/game/BattleGrounds/Zones/BattleGroundWS.h new file mode 100644 index 0000000..ff3a3c8 --- /dev/null +++ b/src/server/game/BattleGrounds/Zones/BattleGroundWS.h @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __BATTLEGROUNDWS_H +#define __BATTLEGROUNDWS_H + +#include "BattleGround.h" + +enum BG_WS_TimerOrScore +{ + BG_WS_MAX_TEAM_SCORE = 3, + BG_WS_FLAG_RESPAWN_TIME = 23000, + BG_WS_FLAG_DROP_TIME = 10000, + BG_WS_SPELL_FORCE_TIME = 600000, + BG_WS_SPELL_BRUTAL_TIME = 900000 +}; + +enum BG_WS_Sound +{ + BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173, + BG_WS_SOUND_FLAG_CAPTURED_HORDE = 8213, + BG_WS_SOUND_FLAG_PLACED = 8232, + BG_WS_SOUND_FLAG_RETURNED = 8192, + BG_WS_SOUND_HORDE_FLAG_PICKED_UP = 8212, + BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP = 8174, + BG_WS_SOUND_FLAGS_RESPAWNED = 8232 +}; + +enum BG_WS_SpellId +{ + BG_WS_SPELL_WARSONG_FLAG = 23333, + BG_WS_SPELL_WARSONG_FLAG_DROPPED = 23334, + BG_WS_SPELL_SILVERWING_FLAG = 23335, + BG_WS_SPELL_SILVERWING_FLAG_DROPPED = 23336, + BG_WS_SPELL_FOCUSED_ASSAULT = 46392, + BG_WS_SPELL_BRUTAL_ASSAULT = 46393 +}; + +enum BG_WS_WorldStates +{ + BG_WS_FLAG_UNK_ALLIANCE = 1545, + BG_WS_FLAG_UNK_HORDE = 1546, +// FLAG_UNK = 1547, + BG_WS_FLAG_CAPTURES_ALLIANCE = 1581, + BG_WS_FLAG_CAPTURES_HORDE = 1582, + BG_WS_FLAG_CAPTURES_MAX = 1601, + BG_WS_FLAG_STATE_HORDE = 2338, + BG_WS_FLAG_STATE_ALLIANCE = 2339, + BG_WS_STATE_TIMER = 4248, + BG_WS_STATE_TIMER_ACTIVE = 4247 +}; + +enum BG_WS_ObjectTypes +{ + BG_WS_OBJECT_DOOR_A_1 = 0, + BG_WS_OBJECT_DOOR_A_2 = 1, + BG_WS_OBJECT_DOOR_A_3 = 2, + BG_WS_OBJECT_DOOR_A_4 = 3, + BG_WS_OBJECT_DOOR_A_5 = 4, + BG_WS_OBJECT_DOOR_A_6 = 5, + BG_WS_OBJECT_DOOR_H_1 = 6, + BG_WS_OBJECT_DOOR_H_2 = 7, + BG_WS_OBJECT_DOOR_H_3 = 8, + BG_WS_OBJECT_DOOR_H_4 = 9, + BG_WS_OBJECT_A_FLAG = 10, + BG_WS_OBJECT_H_FLAG = 11, + BG_WS_OBJECT_SPEEDBUFF_1 = 12, + BG_WS_OBJECT_SPEEDBUFF_2 = 13, + BG_WS_OBJECT_REGENBUFF_1 = 14, + BG_WS_OBJECT_REGENBUFF_2 = 15, + BG_WS_OBJECT_BERSERKBUFF_1 = 16, + BG_WS_OBJECT_BERSERKBUFF_2 = 17, + BG_WS_OBJECT_MAX = 18 +}; + +enum BG_WS_ObjectEntry +{ + BG_OBJECT_DOOR_A_1_WS_ENTRY = 179918, + BG_OBJECT_DOOR_A_2_WS_ENTRY = 179919, + BG_OBJECT_DOOR_A_3_WS_ENTRY = 179920, + BG_OBJECT_DOOR_A_4_WS_ENTRY = 179921, + BG_OBJECT_DOOR_A_5_WS_ENTRY = 180322, + BG_OBJECT_DOOR_A_6_WS_ENTRY = 180322, + BG_OBJECT_DOOR_H_1_WS_ENTRY = 179916, + BG_OBJECT_DOOR_H_2_WS_ENTRY = 179917, + BG_OBJECT_DOOR_H_3_WS_ENTRY = 180322, + BG_OBJECT_DOOR_H_4_WS_ENTRY = 180322, + BG_OBJECT_A_FLAG_WS_ENTRY = 179830, + BG_OBJECT_H_FLAG_WS_ENTRY = 179831, + BG_OBJECT_A_FLAG_GROUND_WS_ENTRY = 179785, + BG_OBJECT_H_FLAG_GROUND_WS_ENTRY = 179786 +}; + +enum BG_WS_FlagState +{ + BG_WS_FLAG_STATE_ON_BASE = 0, + BG_WS_FLAG_STATE_WAIT_RESPAWN = 1, + BG_WS_FLAG_STATE_ON_PLAYER = 2, + BG_WS_FLAG_STATE_ON_GROUND = 3 +}; + +enum BG_WS_Graveyards +{ + WS_GRAVEYARD_FLAGROOM_ALLIANCE = 769, + WS_GRAVEYARD_FLAGROOM_HORDE = 770, + WS_GRAVEYARD_MAIN_ALLIANCE = 771, + WS_GRAVEYARD_MAIN_HORDE = 772 +}; + +enum BG_WS_CreatureTypes +{ + WS_SPIRIT_MAIN_ALLIANCE = 0, + WS_SPIRIT_MAIN_HORDE = 1, + + BG_CREATURES_MAX_WS = 2 +}; + +enum BG_WS_CarrierDebuffs +{ + WS_SPELL_FOCUSED_ASSAULT = 46392, + WS_SPELL_BRUTAL_ASSAULT = 46393 +}; + +class BattleGroundWGScore : public BattleGroundScore +{ + public: + BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {}; + virtual ~BattleGroundWGScore() {}; + uint32 FlagCaptures; + uint32 FlagReturns; +}; + +class BattleGroundWS : public BattleGround +{ + friend class BattleGroundMgr; + + public: + /* Construction */ + BattleGroundWS(); + ~BattleGroundWS(); + void Update(uint32 diff); + + /* inherited from BattlegroundClass */ + virtual void AddPlayer(Player *plr); + virtual void StartingEventCloseDoors(); + virtual void StartingEventOpenDoors(); + + /* BG Flags */ + uint64 GetAllianceFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_ALLIANCE]; } + uint64 GetHordeFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_HORDE]; } + void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; } + void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; } + bool IsAllianceFlagPickedup() const { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; } + bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; } + void RespawnFlag(uint32 Team, bool captured); + void RespawnFlagAfterDrop(uint32 Team); + uint8 GetFlagState(uint32 team) { return m_FlagState[GetTeamIndexByTeamId(team)]; } + void AddTimedAura(uint32 aura); + void RemoveTimedAura(uint32 aura); + bool IsBrutalTimerDone; + bool IsForceTimerDone; + + /* Battleground Events */ + virtual void EventPlayerDroppedFlag(Player *Source); + virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); + virtual void EventPlayerCapturedFlag(Player *Source); + + void RemovePlayer(Player *plr, uint64 guid); + void HandleAreaTrigger(Player *Source, uint32 Trigger); + void HandleKillPlayer(Player *player, Player *killer); + bool SetupBattleGround(); + virtual void Reset(); + void EndBattleGround(uint32 winner); + virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); + + void UpdateFlagState(uint32 team, uint32 value); + void SetLastFlagCapture(uint32 team) { m_LastFlagCaptureTeam = team; } + void UpdateTeamScore(uint32 team); + void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;} + uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} + virtual void FillInitialWorldStates(WorldPacket& data); + + /* Scorekeeping */ + uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; } + void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; } + void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; } + void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; } + private: + uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde + uint64 m_DroppedFlagGUID[2]; + uint8 m_FlagState[2]; // for checking flag state + int32 m_FlagsTimer[2]; + int32 m_FlagsDropTimer[2]; + uint32 m_LastFlagCaptureTeam; // Winner is based on this if score is equal + + uint32 m_ReputationCapture; + uint32 m_HonorWinKills; + uint32 m_HonorEndKills; + int32 m_FlagSpellForceTimer; + bool m_BothFlagsKept; + uint8 m_FlagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault + uint8 m_minutesElapsed; +}; +#endif + diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt new file mode 100644 index 0000000..4435d77 --- /dev/null +++ b/src/server/game/CMakeLists.txt @@ -0,0 +1,302 @@ +# Copyright (C) 2008-2010 Trinity +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +######## game ######## + +# Enable precompiled headers when using the GCC compiler. +if(DO_PCH) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) +endif() + +# Create game-libary +set(game_STAT_SRCS + Accounts/AccountMgr.cpp + Achievements/AchievementMgr.cpp + Addons/AddonMgr.cpp + AI/CoreAI/CombatAI.cpp + AI/CoreAI/GuardAI.cpp + AI/CoreAI/PassiveAI.cpp + AI/CoreAI/PetAI.cpp + AI/CoreAI/ReactorAI.cpp + AI/CoreAI/TotemAI.cpp + AI/CoreAI/UnitAI.cpp + AI/EventAI/CreatureEventAI.cpp + AI/EventAI/CreatureEventAIMgr.cpp + AI/ScriptedAI/ScriptedSmartAI.cpp + AI/CreatureAIRegistry.cpp + AI/CreatureAISelector.cpp + AI/CreatureAI.cpp + AuctionHouse/AuctionHouseMgr.cpp + AuctionHouse/AuctionHouseBot/AuctionHouseBot.cpp + BattleGrounds/ArenaTeam.cpp + BattleGrounds/Zones/BattleGroundAA.cpp + BattleGrounds/Zones/BattleGroundAB.cpp + BattleGrounds/Zones/BattleGroundRB.cpp + BattleGrounds/Zones/BattleGroundAV.cpp + BattleGrounds/Zones/BattleGroundBE.cpp + BattleGrounds/Zones/BattleGroundDS.cpp + BattleGrounds/Zones/BattleGroundEY.cpp + BattleGrounds/Zones/BattleGroundIC.cpp + BattleGrounds/Zones/BattleGroundNA.cpp + BattleGrounds/Zones/BattleGroundRL.cpp + BattleGrounds/Zones/BattleGroundRV.cpp + BattleGrounds/Zones/BattleGroundSA.cpp + BattleGrounds/Zones/BattleGroundWS.cpp + BattleGrounds/BattleGround.cpp + BattleGrounds/BattleGroundMgr.cpp + Calendar/Calendar.cpp + Chat/Channels/Channel.cpp + Chat/Channels/ChannelMgr.cpp + Chat/Commands/Debugcmds.cpp + Chat/Commands/Level0.cpp + Chat/Commands/Level1.cpp + Chat/Commands/Level2.cpp + Chat/Commands/Level3.cpp + Chat/Chat.cpp + Combat/HostileRefManager.cpp + Combat/ThreatManager.cpp + Conditions/ConditionMgr.cpp + DataStores/DBCStores.cpp + DungeonFinding/LFGMgr.cpp + Entities/Corpse/Corpse.cpp + Entities/Creature/Creature.cpp + Entities/Creature/CreatureGroups.cpp + Entities/Creature/GossipDef.cpp + Entities/Creature/TemporarySummon.cpp + Entities/DynamicObject/DynamicObject.cpp + Entities/GameObject/GameObject.cpp + Entities/Item/Container/Bag.cpp + Entities/Item/Item.cpp + Entities/Item/ItemEnchantmentMgr.cpp + Entities/Object/Updates/UpdateData.cpp + Entities/Object/Object.cpp + Entities/Object/ObjectPosSelector.cpp + Entities/Pet/Pet.cpp + Entities/Player/Player.cpp + Entities/Player/SocialMgr.cpp + Entities/Unit/StatSystem.cpp + Entities/Unit/Unit.cpp + Entities/Totem/Totem.cpp + Entities/Transport/Transport.cpp + Entities/Vehicle/Vehicle.cpp + Events/GameEventMgr.cpp + Globals/GlobalEvents.cpp + Globals/ObjectAccessor.cpp + Globals/ObjectMgr.cpp + Grids/Notifiers/GridNotifiers.cpp + Grids/GridStates.cpp + Grids/ObjectGridLoader.cpp + Groups/Group.cpp + Groups/GroupReference.cpp + Guilds/Guild.cpp + Instances/InstanceData.cpp + Instances/InstanceSaveMgr.cpp + Loot/LootMgr.cpp + Mails/Mail.cpp + Maps/Map.cpp + Maps/MapInstanced.cpp + Maps/MapManager.cpp + Maps/MapUpdater.cpp + Movement/MovementGenerators/ConfusedMovementGenerator.cpp + Movement/MovementGenerators/FleeingMovementGenerator.cpp + Movement/MovementGenerators/HomeMovementGenerator.cpp + Movement/MovementGenerators/IdleMovementGenerator.cpp + Movement/MovementGenerators/PointMovementGenerator.cpp + Movement/MovementGenerators/RandomMovementGenerator.cpp + Movement/MovementGenerators/TargetedMovementGenerator.cpp + Movement/MovementGenerators/WaypointMovementGenerator.cpp + Movement/Waypoints/WaypointManager.cpp + Movement/DestinationHolder.cpp + Movement/FollowerReference.cpp + Movement/MotionMaster.cpp + Movement/MovementGenerator.cpp + OutdoorPvP/Zones/OutdoorPvPEP.cpp + OutdoorPvP/Zones/OutdoorPvPHP.cpp + OutdoorPvP/Zones/OutdoorPvPNA.cpp + OutdoorPvP/Zones/OutdoorPvPSI.cpp + OutdoorPvP/Zones/OutdoorPvPTF.cpp + OutdoorPvP/Zones/OutdoorPvPZM.cpp + OutdoorPvP/Zones/OutdoorPvPWG.cpp + OutdoorPvP/OutdoorPvP.cpp + OutdoorPvP/OutdoorPvPMgr.cpp + Pools/PoolMgr.cpp + Quests/QuestDef.cpp + Reputation/ReputationMgr.cpp + Scripting/ScriptLoader.cpp + Scripting/ScriptMgr.cpp + Scripting/ScriptSystem.cpp + Scripting/sc_boss_spell_worker.cpp + Server/Protocol/Handlers/AddonHandler.cpp + Server/Protocol/Handlers/ArenaTeamHandler.cpp + Server/Protocol/Handlers/AuctionHouseHandler.cpp + Server/Protocol/Handlers/BattleGroundHandler.cpp + Server/Protocol/Handlers/CalendarHandler.cpp + Server/Protocol/Handlers/ChannelHandler.cpp + Server/Protocol/Handlers/CharacterHandler.cpp + Server/Protocol/Handlers/ChatHandler.cpp + Server/Protocol/Handlers/CombatHandler.cpp + Server/Protocol/Handlers/DuelHandler.cpp + Server/Protocol/Handlers/GroupHandler.cpp + Server/Protocol/Handlers/GuildHandler.cpp + Server/Protocol/Handlers/ItemHandler.cpp + Server/Protocol/Handlers/LFGHandler.cpp + Server/Protocol/Handlers/LootHandler.cpp + Server/Protocol/Handlers/MiscHandler.cpp + Server/Protocol/Handlers/MovementHandler.cpp + Server/Protocol/Handlers/NPCHandler.cpp + Server/Protocol/Handlers/PetHandler.cpp + Server/Protocol/Handlers/PetitionsHandler.cpp + Server/Protocol/Handlers/QueryHandler.cpp + Server/Protocol/Handlers/QuestHandler.cpp + Server/Protocol/Handlers/SkillHandler.cpp + Server/Protocol/Handlers/SpellHandler.cpp + Server/Protocol/Handlers/TaxiHandler.cpp + Server/Protocol/Handlers/TicketHandler.cpp + Server/Protocol/Handlers/TradeHandler.cpp + Server/Protocol/Handlers/VoiceChatHandler.cpp + Server/Protocol/Opcodes.cpp + Server/Protocol/WorldLog.cpp + Server/WorldSession.cpp + Server/WorldSocket.cpp + Server/WorldSocketMgr.cpp + Skills/SkillDiscovery.cpp + Skills/SkillExtraItems.cpp + Spells/Auras/SpellAuras.cpp + Spells/Auras/SpellAuraEffects.cpp + Spells/Auras/SpellEffects.cpp + Spells/Spell.cpp + Spells/SpellMgr.cpp + Tools/PlayerDump.cpp + Tools/Tools.cpp + Weather/Weather.cpp + World/World.cpp +) + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/externals/mersennetwister + ${CMAKE_SOURCE_DIR}/externals/zlib + ${CMAKE_SOURCE_DIR}/src/server/collision + ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/shared + ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration + ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography + ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography/Authentication + ${CMAKE_SOURCE_DIR}/src/server/shared/Database + ${CMAKE_SOURCE_DIR}/src/server/shared/DataStores + ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging + ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/CountedReference + ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference + ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic + ${CMAKE_SOURCE_DIR}/src/server/shared/Logging + ${CMAKE_SOURCE_DIR}/src/server/shared/Packets + ${CMAKE_SOURCE_DIR}/src/server/shared/Policies + ${CMAKE_SOURCE_DIR}/src/server/shared/Threading + ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities + ${CMAKE_SOURCE_DIR}/src/server/game + ${CMAKE_SOURCE_DIR}/src/server/game/Accounts + ${CMAKE_SOURCE_DIR}/src/server/game/Achievements + ${CMAKE_SOURCE_DIR}/src/server/game/Addons + ${CMAKE_SOURCE_DIR}/src/server/game/AI + ${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI + ${CMAKE_SOURCE_DIR}/src/server/game/AI/EventAI + ${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI + ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse + ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot + ${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds + ${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds/Zones + ${CMAKE_SOURCE_DIR}/src/server/game/Calendar + ${CMAKE_SOURCE_DIR}/src/server/game/Chat + ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels + ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Commands + ${CMAKE_SOURCE_DIR}/src/server/game/Combat + ${CMAKE_SOURCE_DIR}/src/server/game/Conditions + ${CMAKE_SOURCE_DIR}/src/server/game/DataStores + ${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding + ${CMAKE_SOURCE_DIR}/src/server/game/Entities + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport + ${CMAKE_SOURCE_DIR}/src/server/game/Events + ${CMAKE_SOURCE_DIR}/src/server/game/Globals + ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells + ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers + ${CMAKE_SOURCE_DIR}/src/server/game/Grids + ${CMAKE_SOURCE_DIR}/src/server/game/Groups + ${CMAKE_SOURCE_DIR}/src/server/game/Guilds + ${CMAKE_SOURCE_DIR}/src/server/game/Instances + ${CMAKE_SOURCE_DIR}/src/server/game/Loot + ${CMAKE_SOURCE_DIR}/src/server/game/Mails + ${CMAKE_SOURCE_DIR}/src/server/game/Maps + ${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous + ${CMAKE_SOURCE_DIR}/src/server/game/Movement + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints + ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP + ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP/Zones + ${CMAKE_SOURCE_DIR}/src/server/game/Pools + ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders + ${CMAKE_SOURCE_DIR}/src/server/game/Quests + ${CMAKE_SOURCE_DIR}/src/server/game/Reputation + ${CMAKE_SOURCE_DIR}/src/server/game/Scripting + ${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol + ${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol/Handlers + ${CMAKE_SOURCE_DIR}/src/server/game/Server + ${CMAKE_SOURCE_DIR}/src/server/game/Skills + ${CMAKE_SOURCE_DIR}/src/server/game/Spells + ${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras + ${CMAKE_SOURCE_DIR}/src/server/game/Tools + ${CMAKE_SOURCE_DIR}/src/server/game/Weather + ${CMAKE_SOURCE_DIR}/src/server/game/World + ${MYSQL_INCLUDE_DIR} + ${ACE_INCLUDE_DIR} +) + +if(NOT DO_SCRIPTS) + set(game_STAT_SRCS + ${game_STAT_SRCS} + AI/ScriptedAI/ScriptedEscortAI.cpp + AI/ScriptedAI/ScriptedCreature.cpp + AI/ScriptedAI/ScriptedFollowerAI.cpp + AI/ScriptedAI/ScriptedGuardAI.cpp + AI/ScriptedAI/ScriptedSimpleAI.cpp + ) + message("-- Added basic scriptAI-engines to GAME library") +endif() + +# Add gamePCH.cpp to project on Windows +if(MSVC) + set(game_STAT_SRCS + PrecompiledHeaders/gamePCH.cpp + ${game_STAT_SRCS}) +endif() + +add_library(game STATIC ${game_STAT_SRCS}) +add_dependencies(game revision.h) + +# Generate precompiled header +if(DO_PCH) + if(CMAKE_COMPILER_IS_GNUCXX) + add_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH.h) + elseif(MSVC) + add_native_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH) + endif() +endif() diff --git a/src/server/game/Calendar/Calendar.cpp b/src/server/game/Calendar/Calendar.cpp new file mode 100644 index 0000000..0c1efb2 --- /dev/null +++ b/src/server/game/Calendar/Calendar.cpp @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ diff --git a/src/server/game/Calendar/Calendar.h b/src/server/game/Calendar/Calendar.h new file mode 100644 index 0000000..2d35a6c --- /dev/null +++ b/src/server/game/Calendar/Calendar.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_CALENDAR_H +#define TRINITY_CALENDAR_H + +class Calendar +{ + +}; +#endif diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp new file mode 100644 index 0000000..bb70e54 --- /dev/null +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -0,0 +1,1110 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Channel.h" +#include "Chat.h" +#include "ObjectMgr.h" +#include "SocialMgr.h" +#include "World.h" + +Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) + : m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0), m_Team(Team) +{ + // set special flags if built-in channel + ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id); + if (ch) // it's built-in channel + { + channel_id = ch->ChannelID; // built-in channel + m_announce = false; // no join/leave announces + + m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels + + if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel + m_flags |= CHANNEL_FLAG_TRADE; + + if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels + m_flags |= CHANNEL_FLAG_CITY; + + if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel + m_flags |= CHANNEL_FLAG_LFG; + else // for all other channels + m_flags |= CHANNEL_FLAG_NOT_LFG; + m_IsSaved = false; + } + else // it's custom channel + { + m_flags |= CHANNEL_FLAG_CUSTOM; + //load not built in channel if saved + std::string _name(name); + CharacterDatabase.escape_string(_name); + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT m_announce, m_moderate, m_public, m_password, BannedList FROM channels WHERE m_name = '%s' AND m_team = '%u'", _name.c_str(), m_Team); + if (result)//load + { + Field *fields = result->Fetch(); + m_announce = fields[0].GetBool(); + m_moderate = fields[1].GetBool(); + m_public = fields[2].GetBool(); + m_password = fields[3].GetString(); + const char* db_BannedList = fields[4].GetString(); + + m_IsSaved = true; + + if (db_BannedList) + { + Tokens tokens = StrSplit(db_BannedList, " "); + Tokens::iterator iter; + for (iter = tokens.begin(); iter != tokens.end(); ++iter) + { + uint64 banned_guid = atol((*iter).c_str()); + if (banned_guid) + { + sLog.outDebug("Channel(%s) loaded banned guid: %u",name.c_str(), banned_guid); + banned.insert(banned_guid); + } + } + } + } + else // save + { + // _name is already escaped at this point. + if (CharacterDatabase.PExecute("INSERT INTO channels (m_name, m_team, m_announce, m_moderate, m_public, m_password) " + "VALUES ('%s', '%u', '1', '0', '1', '')", _name.c_str(), m_Team)) + { + sLog.outDebug("New Channel(%s) saved", name.c_str()); + m_IsSaved = true; + } + } + } +} + +bool Channel::_UpdateStringInDB(const std::string& colName, const std::string& colValue) const +{ + // Prevent SQL-injection + std::string _name(m_name); + std::string _colValue(colValue); + CharacterDatabase.escape_string(_colValue); + CharacterDatabase.escape_string(_name); + return CharacterDatabase.PExecute("UPDATE channels SET %s = '%s' WHERE m_name = '%s' AND m_team = '%u'", + colName.c_str(), _colValue.c_str(), _name.c_str(), m_Team); +} + +bool Channel::_UpdateIntInDB(const std::string& colName, int colValue) const +{ + // Prevent SQL-injection + std::string _name(m_name); + CharacterDatabase.escape_string(_name); + return CharacterDatabase.PExecute("UPDATE channels SET %s = '%u' WHERE m_name = '%s' AND m_team = '%u'", + colName.c_str(), colValue, _name.c_str(), m_Team); +} + +void Channel::_UpdateBanListInDB() const +{ + // save banlist + if (m_IsSaved) + { + std::ostringstream banlist; + BannedList::const_iterator iter; + for (iter = banned.begin(); iter != banned.end(); ++iter) + banlist << (*iter) << " "; + std::string banListStr = banlist.str(); + if (_UpdateStringInDB("BannedList", banListStr)) + sLog.outDebug("Channel(%s) BannedList saved", m_name.c_str()); + } +} + +void Channel::Join(uint64 p, const char *pass) +{ + WorldPacket data; + if (IsOn(p)) + { + if (!IsConstant()) // non send error message for built-in channels + { + MakePlayerAlreadyMember(&data, p); + SendToOne(&data, p); + } + return; + } + + if (IsBanned(p)) + { + MakeBanned(&data); + SendToOne(&data, p); + return; + } + + if (m_password.length() > 0 && strcmp(pass, m_password.c_str())) + { + MakeWrongPassword(&data); + SendToOne(&data, p); + return; + } + + Player *plr = objmgr.GetPlayer(p); + + if (plr) + { + if (HasFlag(CHANNEL_FLAG_LFG) && + sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && plr->GetGroup()) + { + MakeNotInLfg(&data); + SendToOne(&data, p); + return; + } + + if (plr->GetGuildId() && (GetFlags() == 0x38)) + return; + + plr->JoinedChannel(this); + } + + if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + { + MakeJoined(&data, p); + SendToAll(&data); + } + + data.clear(); + + PlayerInfo pinfo; + pinfo.player = p; + pinfo.flags = MEMBER_FLAG_NONE; + players[p] = pinfo; + + MakeYouJoined(&data); + SendToOne(&data, p); + + JoinNotify(p); + + // if no owner first logged will become + if (!IsConstant() && !m_ownerGUID) + { + SetOwner(p, (players.size() > 1 ? true : false)); + players[p].SetModerator(true); + } + /* + else if (!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID())) + { + SetOwner(p, (players.size() > 1 ? true : false)); + players[p].SetModerator(true); + }*/ +} + +void Channel::Leave(uint64 p, bool send) +{ + if (!IsOn(p)) + { + if (send) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + } + else + { + Player *plr = objmgr.GetPlayer(p); + + if (send) + { + WorldPacket data; + MakeYouLeft(&data); + SendToOne(&data, p); + if (plr) + plr->LeftChannel(this); + data.clear(); + } + + bool changeowner = players[p].IsOwner(); + + players.erase(p); + if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + { + WorldPacket data; + MakeLeft(&data, p); + SendToAll(&data); + } + + LeaveNotify(p); + + if (changeowner) + { + uint64 newowner = !players.empty() ? players.begin()->second.player : 0; + players[newowner].SetModerator(true); + SetOwner(newowner); + } + } +} + +void Channel::KickOrBan(uint64 good, const char *badname, bool ban) +{ + AccountTypes sec = SEC_PLAYER; + Player *gplr = objmgr.GetPlayer(good); + if (gplr) + sec = gplr->GetSession()->GetSecurity(); + + if (!IsOn(good)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, good); + } + else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, good); + } + else + { + Player *bad = objmgr.GetPlayer(badname); + if (bad == NULL || !IsOn(bad->GetGUID())) + { + WorldPacket data; + MakePlayerNotFound(&data, badname); + SendToOne(&data, good); + } + else if (sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID) + { + WorldPacket data; + MakeNotOwner(&data); + SendToOne(&data, good); + } + else + { + bool changeowner = (m_ownerGUID == bad->GetGUID()); + + WorldPacket data; + + if (ban && !IsBanned(bad->GetGUID())) + { + banned.insert(bad->GetGUID()); + MakePlayerBanned(&data, bad->GetGUID(), good); + _UpdateBanListInDB(); + + } + else + MakePlayerKicked(&data, bad->GetGUID(), good); + + SendToAll(&data); + players.erase(bad->GetGUID()); + bad->LeftChannel(this); + + if (changeowner) + { + uint64 newowner = !players.empty() ? good : false; + players[newowner].SetModerator(true); + SetOwner(newowner); + } + } + } +} + +void Channel::UnBan(uint64 good, const char *badname) +{ + uint32 sec = 0; + Player *gplr = objmgr.GetPlayer(good); + if (gplr) + sec = gplr->GetSession()->GetSecurity(); + + if (!IsOn(good)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, good); + } + else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, good); + } + else + { + Player *bad = objmgr.GetPlayer(badname); + if (bad == NULL || !IsBanned(bad->GetGUID())) + { + WorldPacket data; + MakePlayerNotFound(&data, badname); + SendToOne(&data, good); + } + else + { + banned.erase(bad->GetGUID()); + + WorldPacket data; + MakePlayerUnbanned(&data, bad->GetGUID(), good); + SendToAll(&data); + //save banlist + _UpdateBanListInDB(); + } + } +} + +void Channel::Password(uint64 p, const char *pass) +{ + std::string plName; + uint32 sec = 0; + Player *plr = objmgr.GetPlayer(p); + if (plr) + sec = plr->GetSession()->GetSecurity(); + + ChatHandler chat(plr); + + if (!m_public && sec <= SEC_MODERATOR) + { + chat.PSendSysMessage(LANG_CHANNEL_NOT_PUBLIC); + return; + } + + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, p); + } + else + { + m_password = pass; + + WorldPacket data; + MakePasswordChanged(&data, p); + SendToAll(&data); + if (m_IsSaved && _UpdateStringInDB("m_password", m_password)) + sLog.outDebug("Channel(%s) password saved", m_name.c_str()); + } +} + +void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) +{ + Player *plr = objmgr.GetPlayer(p); + if (!plr) + return; + + uint32 sec = plr->GetSession()->GetSecurity(); + + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, p); + } + else + { + Player *newp = objmgr.GetPlayer(p2n); + if (!newp) + { + WorldPacket data; + MakePlayerNotFound(&data, p2n); + SendToOne(&data, p); + return; + } + + if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod) + return; + + if (!IsOn(newp->GetGUID())) + { + WorldPacket data; + MakePlayerNotFound(&data, p2n); + SendToOne(&data, p); + return; + } + + // allow make moderator from another team only if both is GMs + // at this moment this only way to show channel post for GM from another team + if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) && + plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + { + WorldPacket data; + MakePlayerNotFound(&data, p2n); + SendToOne(&data, p); + return; + } + + if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p) + { + WorldPacket data; + MakeNotOwner(&data); + SendToOne(&data, p); + return; + } + + if (mod) + SetModerator(newp->GetGUID(), set); + else + SetMute(newp->GetGUID(), set); + } +} + +void Channel::SetOwner(uint64 p, const char *newname) +{ + Player *plr = objmgr.GetPlayer(p); + if (!plr) + return; + + uint32 sec = plr->GetSession()->GetSecurity(); + + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + return; + } + + if (sec < SEC_GAMEMASTER && p != m_ownerGUID) + { + WorldPacket data; + MakeNotOwner(&data); + SendToOne(&data, p); + return; + } + + Player *newp = objmgr.GetPlayer(newname); + if (newp == NULL || !IsOn(newp->GetGUID())) + { + WorldPacket data; + MakePlayerNotFound(&data, newname); + SendToOne(&data, p); + return; + } + + if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + { + WorldPacket data; + MakePlayerNotFound(&data, newname); + SendToOne(&data, p); + return; + } + + players[newp->GetGUID()].SetModerator(true); + SetOwner(newp->GetGUID()); +} + +void Channel::SendWhoOwner(uint64 p) +{ + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + else + { + WorldPacket data; + MakeChannelOwner(&data); + SendToOne(&data, p); + } +} + +void Channel::List(Player* player) +{ + uint64 p = player->GetGUID(); + + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + else + { + WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+players.size()*(8+1)); + data << uint8(1); // channel type? + data << GetName(); // channel name + data << uint8(GetFlags()); // channel flags? + + size_t pos = data.wpos(); + data << uint32(0); // size of list, placeholder + + uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST); + + uint32 count = 0; + for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + { + Player *plr = objmgr.GetPlayer(i->first); + + // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters + // MODERATOR, GAME MASTER, ADMINISTRATOR can see all + if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) && + plr->IsVisibleGloballyFor(player)) + { + data << uint64(i->first); + data << uint8(i->second.flags); // flags seems to be changed... + ++count; + } + } + + data.put(pos,count); + + SendToOne(&data, p); + } +} + +void Channel::Announce(uint64 p) +{ + uint32 sec = 0; + Player *plr = objmgr.GetPlayer(p); + if (plr) + sec = plr->GetSession()->GetSecurity(); + + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, p); + } + else + { + m_announce = !m_announce; + + WorldPacket data; + if (m_announce) + MakeAnnouncementsOn(&data, p); + else + MakeAnnouncementsOff(&data, p); + SendToAll(&data); + if (m_IsSaved && _UpdateIntInDB("m_announce", m_announce ? 1 : 0)) + sLog.outDebug("Channel(%s) announce saved", m_name.c_str()); + + } +} + +void Channel::Moderate(uint64 p) +{ + uint32 sec = 0; + Player *plr = objmgr.GetPlayer(p); + if (plr) + sec = plr->GetSession()->GetSecurity(); + + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, p); + } + else + { + m_moderate = !m_moderate; + + WorldPacket data; + if (m_moderate) + MakeModerationOn(&data, p); + else + MakeModerationOff(&data, p); + SendToAll(&data); + if (m_IsSaved && _UpdateIntInDB("m_announce", m_announce ? 1 : 0)) + sLog.outDebug("Channel(%s) announce saved", m_name.c_str()); + } +} + +void Channel::Say(uint64 p, const char *what, uint32 lang) +{ + if (!what) + return; + if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + lang = LANG_UNIVERSAL; + + uint32 sec = 0; + Player *plr = objmgr.GetPlayer(p); + if (plr) + sec = plr->GetSession()->GetSecurity(); + + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + } + else if (players[p].IsMuted()) + { + WorldPacket data; + MakeMuted(&data); + SendToOne(&data, p); + } + else if (m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER) + { + WorldPacket data; + MakeNotModerator(&data); + SendToOne(&data, p); + } + else + { + uint32 messageLength = strlen(what) + 1; + + WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+m_name.size()+1+8+4+messageLength+1); + data << (uint8)CHAT_MSG_CHANNEL; + data << (uint32)lang; + data << p; // 2.1.0 + data << uint32(0); // 2.1.0 + data << m_name; + data << p; + data << messageLength; + data << what; + data << uint8(plr ? plr->chatTag() : 0); + + SendToAll(&data, !players[p].IsModerator() ? p : false); + } +} + +void Channel::Invite(uint64 p, const char *newname) +{ + if (!IsOn(p)) + { + WorldPacket data; + MakeNotMember(&data); + SendToOne(&data, p); + return; + } + + Player *newp = objmgr.GetPlayer(newname); + if (!newp) + { + WorldPacket data; + MakePlayerNotFound(&data, newname); + SendToOne(&data, p); + return; + } + + if (IsBanned(newp->GetGUID())) + { + WorldPacket data; + MakePlayerInviteBanned(&data, newname); + SendToOne(&data, p); + return; + } + + Player *plr = objmgr.GetPlayer(p); + if (!plr) + return; + + if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + { + WorldPacket data; + MakeInviteWrongFaction(&data); + SendToOne(&data, p); + return; + } + + if (IsOn(newp->GetGUID())) + { + WorldPacket data; + MakePlayerAlreadyMember(&data, newp->GetGUID()); + SendToOne(&data, p); + return; + } + + WorldPacket data; + if (!newp->GetSocial()->HasIgnore(GUID_LOPART(p))) + { + MakeInvite(&data, p); + SendToOne(&data, newp->GetGUID()); + data.clear(); + } + MakePlayerInvited(&data, newp->GetName()); + SendToOne(&data, p); +} + +void Channel::SetOwner(uint64 guid, bool exclaim) +{ + if (m_ownerGUID) + { + // [] will re-add player after it possible removed + PlayerList::iterator p_itr = players.find(m_ownerGUID); + if (p_itr != players.end()) + p_itr->second.SetOwner(false); + } + + m_ownerGUID = guid; + if (m_ownerGUID) + { + uint8 oldFlag = GetPlayerFlags(m_ownerGUID); + players[m_ownerGUID].SetModerator(true); + players[m_ownerGUID].SetOwner(true); + + WorldPacket data; + MakeModeChange(&data, m_ownerGUID, oldFlag); + SendToAll(&data); + + if (exclaim) + { + MakeOwnerChanged(&data, m_ownerGUID); + SendToAll(&data); + } + if (m_IsSaved && _UpdateIntInDB("m_moderate", m_moderate ? 1 : 0)) + sLog.outDebug("Channel(%s) moderate saved", m_name.c_str()); + + } +} + +void Channel::SendToAll(WorldPacket *data, uint64 p) +{ + for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + { + Player *plr = objmgr.GetPlayer(i->first); + if (plr) + { + if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p))) + plr->GetSession()->SendPacket(data); + } + } +} + +void Channel::SendToAllButOne(WorldPacket *data, uint64 who) +{ + for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + { + if (i->first != who) + { + Player *plr = objmgr.GetPlayer(i->first); + if (plr) + plr->GetSession()->SendPacket(data); + } + } +} + +void Channel::SendToOne(WorldPacket *data, uint64 who) +{ + Player *plr = objmgr.GetPlayer(who); + if (plr) + plr->GetSession()->SendPacket(data); +} + +void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/) +{ + +} + +void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/) +{ + +} + +// done +void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type) +{ + data->Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1); + *data << uint8(notify_type); + *data << m_name; +} + +// done 0x00 +void Channel::MakeJoined(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_JOINED_NOTICE); + *data << uint64(guid); +} + +// done 0x01 +void Channel::MakeLeft(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_LEFT_NOTICE); + *data << uint64(guid); +} + +// done 0x02 +void Channel::MakeYouJoined(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_YOU_JOINED_NOTICE); + *data << uint8(GetFlags()); + *data << uint32(GetChannelId()); + *data << uint32(0); +} + +// done 0x03 +void Channel::MakeYouLeft(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE); + *data << uint32(GetChannelId()); + *data << uint8(0); // can be 0x00 and 0x01 +} + +// done 0x04 +void Channel::MakeWrongPassword(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE); +} + +// done 0x05 +void Channel::MakeNotMember(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE); +} + +// done 0x06 +void Channel::MakeNotModerator(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE); +} + +// done 0x07 +void Channel::MakePasswordChanged(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE); + *data << uint64(guid); +} + +// done 0x08 +void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE); + *data << uint64(guid); +} + +// done 0x09 +void Channel::MakePlayerNotFound(WorldPacket *data, const std::string& name) +{ + MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE); + *data << name; +} + +// done 0x0A +void Channel::MakeNotOwner(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE); +} + +// done 0x0B +void Channel::MakeChannelOwner(WorldPacket *data) +{ + std::string name = ""; + + if (!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty()) + name = "PLAYER_NOT_FOUND"; + + MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE); + *data << ((IsConstant() || !m_ownerGUID) ? "Nobody" : name); +} + +// done 0x0C +void Channel::MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags) +{ + MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE); + *data << uint64(guid); + *data << uint8(oldflags); + *data << uint8(GetPlayerFlags(guid)); +} + +// done 0x0D +void Channel::MakeAnnouncementsOn(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE); + *data << uint64(guid); +} + +// done 0x0E +void Channel::MakeAnnouncementsOff(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE); + *data << uint64(guid); +} + +// done 0x0F +void Channel::MakeModerationOn(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE); + *data << uint64(guid); +} + +// done 0x10 +void Channel::MakeModerationOff(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE); + *data << uint64(guid); +} + +// done 0x11 +void Channel::MakeMuted(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_MUTED_NOTICE); +} + +// done 0x12 +void Channel::MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good) +{ + MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE); + *data << uint64(bad); + *data << uint64(good); +} + +// done 0x13 +void Channel::MakeBanned(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_BANNED_NOTICE); +} + +// done 0x14 +void Channel::MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good) +{ + MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE); + *data << uint64(bad); + *data << uint64(good); +} + +// done 0x15 +void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good) +{ + MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE); + *data << uint64(bad); + *data << uint64(good); +} + +// done 0x16 +void Channel::MakePlayerNotBanned(WorldPacket *data, const std::string &name) +{ + MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE); + *data << name; +} + +// done 0x17 +void Channel::MakePlayerAlreadyMember(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE); + *data << uint64(guid); +} + +// done 0x18 +void Channel::MakeInvite(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_INVITE_NOTICE); + *data << uint64(guid); +} + +// done 0x19 +void Channel::MakeInviteWrongFaction(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE); +} + +// done 0x1A +void Channel::MakeWrongFaction(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE); +} + +// done 0x1B +void Channel::MakeInvalidName(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE); +} + +// done 0x1C +void Channel::MakeNotModerated(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE); +} + +// done 0x1D +void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name) +{ + MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE); + *data << name; +} + +// done 0x1E +void Channel::MakePlayerInviteBanned(WorldPacket *data, const std::string& name) +{ + MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE); + *data << name; +} + +// done 0x1F +void Channel::MakeThrottled(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE); +} + +// done 0x20 +void Channel::MakeNotInArea(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE); +} + +// done 0x21 +void Channel::MakeNotInLfg(WorldPacket *data) +{ + MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE); +} + +// done 0x22 +void Channel::MakeVoiceOn(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE); + *data << uint64(guid); +} + +// done 0x23 +void Channel::MakeVoiceOff(WorldPacket *data, uint64 guid) +{ + MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE); + *data << uint64(guid); +} + +void Channel::JoinNotify(uint64 guid) +{ + WorldPacket data; + + if (IsConstant()) + data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1); + else + data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1); + + data << uint64(guid); + data << uint8(GetPlayerFlags(guid)); + data << uint8(GetFlags()); + data << uint32(GetNumPlayers()); + data << GetName(); + SendToAll(&data); +} + +void Channel::LeaveNotify(uint64 guid) +{ + WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+GetName().size()+1); + data << uint64(guid); + data << uint8(GetFlags()); + data << uint32(GetNumPlayers()); + data << GetName(); + SendToAll(&data); +} + diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h new file mode 100644 index 0000000..a52a697 --- /dev/null +++ b/src/server/game/Chat/Channels/Channel.h @@ -0,0 +1,292 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _CHANNEL_H +#define _CHANNEL_H + +#include +#include +#include + +#include "Common.h" + +#include "Opcodes.h" +#include "Player.h" +#include "WorldPacket.h" + +enum ChatNotify +{ + CHAT_JOINED_NOTICE = 0x00, //+ "%s joined channel."; + CHAT_LEFT_NOTICE = 0x01, //+ "%s left channel."; + //CHAT_SUSPENDED_NOTICE = 0x01, // "%s left channel."; + CHAT_YOU_JOINED_NOTICE = 0x02, //+ "Joined Channel: [%s]"; -- You joined + //CHAT_YOU_CHANGED_NOTICE = 0x02, // "Changed Channel: [%s]"; + CHAT_YOU_LEFT_NOTICE = 0x03, //+ "Left Channel: [%s]"; -- You left + CHAT_WRONG_PASSWORD_NOTICE = 0x04, //+ "Wrong password for %s."; + CHAT_NOT_MEMBER_NOTICE = 0x05, //+ "Not on channel %s."; + CHAT_NOT_MODERATOR_NOTICE = 0x06, //+ "Not a moderator of %s."; + CHAT_PASSWORD_CHANGED_NOTICE = 0x07, //+ "[%s] Password changed by %s."; + CHAT_OWNER_CHANGED_NOTICE = 0x08, //+ "[%s] Owner changed to %s."; + CHAT_PLAYER_NOT_FOUND_NOTICE = 0x09, //+ "[%s] Player %s was not found."; + CHAT_NOT_OWNER_NOTICE = 0x0A, //+ "[%s] You are not the channel owner."; + CHAT_CHANNEL_OWNER_NOTICE = 0x0B, //+ "[%s] Channel owner is %s."; + CHAT_MODE_CHANGE_NOTICE = 0x0C, //? + CHAT_ANNOUNCEMENTS_ON_NOTICE = 0x0D, //+ "[%s] Channel announcements enabled by %s."; + CHAT_ANNOUNCEMENTS_OFF_NOTICE = 0x0E, //+ "[%s] Channel announcements disabled by %s."; + CHAT_MODERATION_ON_NOTICE = 0x0F, //+ "[%s] Channel moderation enabled by %s."; + CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s."; + CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak."; + CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s."; + CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are banned from that channel."; + CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s banned by %s."; + CHAT_PLAYER_UNBANNED_NOTICE = 0x15, //? "[%s] Player %s unbanned by %s."; + CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not banned."; + CHAT_PLAYER_ALREADY_MEMBER_NOTICE = 0x17, //+ "[%s] Player %s is already on the channel."; + CHAT_INVITE_NOTICE = 0x18, //+ "%2$s has invited you to join the channel '%1$s'."; + CHAT_INVITE_WRONG_FACTION_NOTICE = 0x19, //+ "Target is in the wrong alliance for %s."; + CHAT_WRONG_FACTION_NOTICE = 0x1A, //+ "Wrong alliance for %s."; + CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name"; + CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated"; + CHAT_PLAYER_INVITED_NOTICE = 0x1D, //+ "[%s] You invited %s to join the channel"; + CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been banned."; + CHAT_THROTTLED_NOTICE = 0x1F, //+ "[%s] The number of messages that can be sent to this channel is limited, please wait to send another message."; + CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone. + CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels. + CHAT_VOICE_ON_NOTICE = 0x22, //+ "[%s] Channel voice enabled by %s."; + CHAT_VOICE_OFF_NOTICE = 0x23, //+ "[%s] Channel voice disabled by %s."; +}; + +enum ChannelFlags +{ + CHANNEL_FLAG_NONE = 0x00, + CHANNEL_FLAG_CUSTOM = 0x01, + // 0x02 + CHANNEL_FLAG_TRADE = 0x04, + CHANNEL_FLAG_NOT_LFG = 0x08, + CHANNEL_FLAG_GENERAL = 0x10, + CHANNEL_FLAG_CITY = 0x20, + CHANNEL_FLAG_LFG = 0x40, + CHANNEL_FLAG_VOICE = 0x80 + // General 0x18 = 0x10 | 0x08 + // Trade 0x3C = 0x20 | 0x10 | 0x08 | 0x04 + // LocalDefence 0x18 = 0x10 | 0x08 + // GuildRecruitment 0x38 = 0x20 | 0x10 | 0x08 + // LookingForGroup 0x50 = 0x40 | 0x10 +}; + +enum ChannelDBCFlags +{ + CHANNEL_DBC_FLAG_NONE = 0x00000, + CHANNEL_DBC_FLAG_INITIAL = 0x00001, // General, Trade, LocalDefense, LFG + CHANNEL_DBC_FLAG_ZONE_DEP = 0x00002, // General, Trade, LocalDefense, GuildRecruitment + CHANNEL_DBC_FLAG_GLOBAL = 0x00004, // WorldDefense + CHANNEL_DBC_FLAG_TRADE = 0x00008, // Trade + CHANNEL_DBC_FLAG_CITY_ONLY = 0x00010, // Trade, GuildRecruitment + CHANNEL_DBC_FLAG_CITY_ONLY2 = 0x00020, // Trade, GuildRecruitment + CHANNEL_DBC_FLAG_DEFENSE = 0x10000, // LocalDefense, WorldDefense + CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment + CHANNEL_DBC_FLAG_LFG = 0x40000 // LookingForGroup +}; + +enum ChannelMemberFlags +{ + MEMBER_FLAG_NONE = 0x00, + MEMBER_FLAG_OWNER = 0x01, + MEMBER_FLAG_MODERATOR = 0x02, + MEMBER_FLAG_VOICED = 0x04, + MEMBER_FLAG_MUTED = 0x08, + MEMBER_FLAG_CUSTOM = 0x10, + MEMBER_FLAG_MIC_MUTED = 0x20, + // 0x40 + // 0x80 +}; + +class Channel +{ + struct PlayerInfo + { + uint64 player; + uint8 flags; + + bool HasFlag(uint8 flag) { return flags & flag; } + void SetFlag(uint8 flag) { if (!HasFlag(flag)) flags |= flag; } + bool IsOwner() { return flags & MEMBER_FLAG_OWNER; } + void SetOwner(bool state) + { + if (state) flags |= MEMBER_FLAG_OWNER; + else flags &= ~MEMBER_FLAG_OWNER; + } + bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; } + void SetModerator(bool state) + { + if (state) flags |= MEMBER_FLAG_MODERATOR; + else flags &= ~MEMBER_FLAG_MODERATOR; + } + bool IsMuted() { return flags & MEMBER_FLAG_MUTED; } + void SetMuted(bool state) + { + if (state) flags |= MEMBER_FLAG_MUTED; + else flags &= ~MEMBER_FLAG_MUTED; + } + }; + + typedef std::map PlayerList; + PlayerList players; + typedef std::set BannedList; + BannedList banned; + bool m_announce; + bool m_moderate; + bool m_public; + std::string m_name; + std::string m_password; + uint8 m_flags; + uint32 m_channelId; + uint64 m_ownerGUID; + bool m_IsSaved; + + private: + // initial packet data (notify type and channel name) + void MakeNotifyPacket(WorldPacket *data, uint8 notify_type); + // type specific packet data + void MakeJoined(WorldPacket *data, uint64 guid); //+ 0x00 + void MakeLeft(WorldPacket *data, uint64 guid); //+ 0x01 + void MakeYouJoined(WorldPacket *data); //+ 0x02 + void MakeYouLeft(WorldPacket *data); //+ 0x03 + void MakeWrongPassword(WorldPacket *data); //? 0x04 + void MakeNotMember(WorldPacket *data); //? 0x05 + void MakeNotModerator(WorldPacket *data); //? 0x06 + void MakePasswordChanged(WorldPacket *data, uint64 guid); //+ 0x07 + void MakeOwnerChanged(WorldPacket *data, uint64 guid); //? 0x08 + void MakePlayerNotFound(WorldPacket *data, const std::string& name); //+ 0x09 + void MakeNotOwner(WorldPacket *data); //? 0x0A + void MakeChannelOwner(WorldPacket *data); //? 0x0B + void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C + void MakeAnnouncementsOn(WorldPacket *data, uint64 guid); //+ 0x0D + void MakeAnnouncementsOff(WorldPacket *data, uint64 guid); //+ 0x0E + void MakeModerationOn(WorldPacket *data, uint64 guid); //+ 0x0F + void MakeModerationOff(WorldPacket *data, uint64 guid); //+ 0x10 + void MakeMuted(WorldPacket *data); //? 0x11 + void MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good); //? 0x12 + void MakeBanned(WorldPacket *data); //? 0x13 + void MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x14 + void MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x15 + void MakePlayerNotBanned(WorldPacket *data, const std::string& name); //? 0x16 + void MakePlayerAlreadyMember(WorldPacket *data, uint64 guid); //+ 0x17 + void MakeInvite(WorldPacket *data, uint64 guid); //? 0x18 + void MakeInviteWrongFaction(WorldPacket *data); //? 0x19 + void MakeWrongFaction(WorldPacket *data); //? 0x1A + void MakeInvalidName(WorldPacket *data); //? 0x1B + void MakeNotModerated(WorldPacket *data); //? 0x1C + void MakePlayerInvited(WorldPacket *data, const std::string& name); //+ 0x1D + void MakePlayerInviteBanned(WorldPacket *data, const std::string &name);//? 0x1E + void MakeThrottled(WorldPacket *data); //? 0x1F + void MakeNotInArea(WorldPacket *data); //? 0x20 + void MakeNotInLfg(WorldPacket *data); //? 0x21 + void MakeVoiceOn(WorldPacket *data, uint64 guid); //+ 0x22 + void MakeVoiceOff(WorldPacket *data, uint64 guid); //+ 0x23 + + void SendToAll(WorldPacket *data, uint64 p = 0); + void SendToAllButOne(WorldPacket *data, uint64 who); + void SendToOne(WorldPacket *data, uint64 who); + + bool IsOn(uint64 who) const { return players.find(who) != players.end(); } + bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); } + + bool _UpdateStringInDB(const std::string& colName, const std::string& colValue) const; + bool _UpdateIntInDB(const std::string& colName, int colValue) const; + void _UpdateBanListInDB() const; + + uint8 GetPlayerFlags(uint64 p) const + { + PlayerList::const_iterator p_itr = players.find(p); + if (p_itr == players.end()) + return 0; + + return p_itr->second.flags; + } + + void SetModerator(uint64 p, bool set) + { + if (players[p].IsModerator() != set) + { + uint8 oldFlag = GetPlayerFlags(p); + players[p].SetModerator(set); + + WorldPacket data; + MakeModeChange(&data, p, oldFlag); + SendToAll(&data); + } + } + + void SetMute(uint64 p, bool set) + { + if (players[p].IsMuted() != set) + { + uint8 oldFlag = GetPlayerFlags(p); + players[p].SetMuted(set); + + WorldPacket data; + MakeModeChange(&data, p, oldFlag); + SendToAll(&data); + } + } + + public: + uint32 m_Team; + Channel(const std::string& name, uint32 channel_id, uint32 Team = 0); + std::string GetName() const { return m_name; } + uint32 GetChannelId() const { return m_channelId; } + bool IsConstant() const { return m_channelId != 0; } + bool IsAnnounce() const { return m_announce; } + bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; } + std::string GetPassword() const { return m_password; } + void SetPassword(const std::string& npassword) { m_password = npassword; } + void SetAnnounce(bool nannounce) { m_announce = nannounce; } + uint32 GetNumPlayers() const { return players.size(); } + uint8 GetFlags() const { return m_flags; } + bool HasFlag(uint8 flag) { return m_flags & flag; } + + void Join(uint64 p, const char *pass); + void Leave(uint64 p, bool send = true); + void KickOrBan(uint64 good, const char *badname, bool ban); + void Kick(uint64 good, const char *badname) { KickOrBan(good, badname, false); } + void Ban(uint64 good, const char *badname) { KickOrBan(good, badname, true); } + void UnBan(uint64 good, const char *badname); + void Password(uint64 p, const char *pass); + void SetMode(uint64 p, const char *p2n, bool mod, bool set); + void SetOwner(uint64 p, bool exclaim = true); + void SetOwner(uint64 p, const char *newname); + void SendWhoOwner(uint64 p); + void SetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, true); } + void UnsetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, false); } + void SetMute(uint64 p, const char *newname) { SetMode(p, newname, false, true); } + void UnsetMute(uint64 p, const char *newname) { SetMode(p, newname, false, false); } + void List(Player* p); + void Announce(uint64 p); + void Moderate(uint64 p); + void Say(uint64 p, const char *what, uint32 lang); + void Invite(uint64 p, const char *newp); + void Voice(uint64 guid1, uint64 guid2); + void DeVoice(uint64 guid1, uint64 guid2); + void JoinNotify(uint64 guid); // invisible notify + void LeaveNotify(uint64 guid); // invisible notify +}; +#endif + diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp new file mode 100644 index 0000000..b72a269 --- /dev/null +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ChannelMgr.h" + +#include "World.h" + +ChannelMgr* channelMgr(uint32 team) +{ + if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + return ACE_Singleton::instance(); // cross-faction + + if (team == ALLIANCE) + return ACE_Singleton::instance(); + if (team == HORDE) + return ACE_Singleton::instance(); + + return NULL; +} + +ChannelMgr::~ChannelMgr() +{ + for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr) + delete itr->second; + + channels.clear(); +} + +Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) +{ + std::wstring wname; + Utf8toWStr(name,wname); + wstrToLower(wname); + + if (channels.find(wname) == channels.end()) + { + Channel *nchan = new Channel(name,channel_id, team); + channels[wname] = nchan; + return nchan; + } + + return channels[wname]; +} + +Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt) +{ + std::wstring wname; + Utf8toWStr(name,wname); + wstrToLower(wname); + + ChannelMap::const_iterator i = channels.find(wname); + + if (i == channels.end()) + { + if (pkt) + { + WorldPacket data; + MakeNotOnPacket(&data,name); + p->GetSession()->SendPacket(&data); + } + + return NULL; + } + else + return i->second; +} + +void ChannelMgr::LeftChannel(std::string name) +{ + std::wstring wname; + Utf8toWStr(name,wname); + wstrToLower(wname); + + ChannelMap::const_iterator i = channels.find(wname); + + if (i == channels.end()) + return; + + Channel* channel = i->second; + + if (channel->GetNumPlayers() == 0 && !channel->IsConstant()) + { + channels.erase(wname); + delete channel; + } +} + +void ChannelMgr::MakeNotOnPacket(WorldPacket *data, std::string name) +{ + data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size + (*data) << (uint8)0x05 << name; +} diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h new file mode 100644 index 0000000..c4e872d --- /dev/null +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __TRINITY_CHANNELMGR_H +#define __TRINITY_CHANNELMGR_H + +#include "Common.h" +#include "Channel.h" +#include "ace/Singleton.h" + +#include +#include + +#include "World.h" + +class ChannelMgr +{ + public: + uint32 team; + typedef std::map ChannelMap; + ChannelMgr() {team = 0;} + ~ChannelMgr(); + + Channel *GetJoinChannel(std::string name, uint32 channel_id); + Channel *GetChannel(std::string name, Player *p, bool pkt = true); + void LeftChannel(std::string name); + private: + ChannelMap channels; + void MakeNotOnPacket(WorldPacket *data, std::string name); +}; + +class AllianceChannelMgr : public ChannelMgr {}; +class HordeChannelMgr : public ChannelMgr {}; + +ChannelMgr* channelMgr(uint32 team); + +#endif + diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp new file mode 100644 index 0000000..0bd13f8 --- /dev/null +++ b/src/server/game/Chat/Chat.cpp @@ -0,0 +1,2476 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "ObjectMgr.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" +#include "DatabaseEnv.h" + +#include "AccountMgr.h" +#include "CellImpl.h" +#include "Chat.h" +#include "GridNotifiersImpl.h" +#include "Language.h" +#include "Log.h" +#include "Opcodes.h" +#include "Player.h" +#include "UpdateMask.h" +#include "SpellMgr.h" + +// Supported shift-links (client generated and server side) +// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r +// - client, item icon shift click, not used in server currently +// |color|Harea:area_id|h[name]|h|r +// |color|Hcreature:creature_guid|h[name]|h|r +// |color|Hcreature_entry:creature_id|h[name]|h|r +// |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r - client, at shift click in recipes list dialog +// |color|Hgameevent:id|h[name]|h|r +// |color|Hgameobject:go_guid|h[name]|h|r +// |color|Hgameobject_entry:go_id|h[name]|h|r +// |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r - client, at shift click in glyphs dialog, GlyphSlot.dbc, GlyphProperties.dbc +// |color|Hitem:item_id:perm_ench_id:gem1:gem2:gem3:0:0:0:0:reporter_level|h[name]|h|r +// - client, item icon shift click +// |color|Hitemset:itemset_id|h[name]|h|r +// |color|Hplayer:name|h[name]|h|r - client, in some messages, at click copy only name instead link +// |color|Hquest:quest_id:quest_level|h[name]|h|r - client, quest list name shift-click +// |color|Hskill:skill_id|h[name]|h|r +// |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell icon shift-click +// |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click +// |color|Htaxinode:id|h[name]|h|r +// |color|Htele:id|h[name]|h|r +// |color|Htitle:id|h[name]|h|r +// |color|Htrade:spell_id,cur_value,max_value,unk3int,unk3str|h[name]|h|r - client, spellbook profession icon shift-click + +bool ChatHandler::load_command_table = true; + +ChatCommand * ChatHandler::getCommandTable() +{ + static ChatCommand accountSetCommandTable[] = + { + { "addon", SEC_ADMINISTRATOR, true, &ChatHandler::HandleAccountSetAddonCommand, "", NULL }, + { "gmlevel", SEC_CONSOLE, true, &ChatHandler::HandleAccountSetGmLevelCommand, "", NULL }, + { "password", SEC_CONSOLE, true, &ChatHandler::HandleAccountSetPasswordCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand accountCommandTable[] = + { + { "addon", SEC_MODERATOR, false, &ChatHandler::HandleAccountAddonCommand, "", NULL }, + { "create", SEC_CONSOLE, true, &ChatHandler::HandleAccountCreateCommand, "", NULL }, + { "delete", SEC_CONSOLE, true, &ChatHandler::HandleAccountDeleteCommand, "", NULL }, + { "onlinelist", SEC_CONSOLE, true, &ChatHandler::HandleAccountOnlineListCommand, "", NULL }, + { "lock", SEC_PLAYER, false, &ChatHandler::HandleAccountLockCommand, "", NULL }, + { "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable }, + { "password", SEC_PLAYER, false, &ChatHandler::HandleAccountPasswordCommand, "", NULL }, + { "", SEC_PLAYER, false, &ChatHandler::HandleAccountCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand banCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand baninfoCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanInfoIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand banlistCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleBanListIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand castCommandTable[] = + { + { "back", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastBackCommand, "", NULL }, + { "dist", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastDistCommand, "", NULL }, + { "self", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastSelfCommand, "", NULL }, + { "target", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastTargetCommand, "", NULL }, + { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCastCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand characterCommandTable[] = + { + { "customize", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterCustomizeCommand, "", NULL }, + { "delete", SEC_CONSOLE, true, &ChatHandler::HandleCharacterDeleteCommand, "", NULL }, + { "changefaction", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterChangeFactionCommand, "", NULL }, + { "changerace", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterChangeRaceCommand, "", NULL }, + { "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleCharacterLevelCommand, "", NULL }, + { "rename", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterRenameCommand, "", NULL }, + { "reputation", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterReputationCommand, "", NULL }, + { "titles", SEC_GAMEMASTER, true, &ChatHandler::HandleCharacterTitlesCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand channelSetCommandTable[] = + { + { "public", SEC_ADMINISTRATOR, true, &ChatHandler::HandleChannelSetPublic, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand channelCommandTable[] = + { + { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand debugPlayCommandTable[] = + { + { "cinematic", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayCinematicCommand, "", NULL }, + { "movie", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayMovieCommand, "", NULL }, + { "sound", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlaySoundCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand debugSendCommandTable[] = + { + { "buyerror", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendBuyErrorCommand, "", NULL }, + { "channelnotify", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendChannelNotifyCommand, "", NULL }, + { "chatmmessage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendChatMsgCommand, "", NULL }, + { "equiperror", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendEquipErrorCommand, "", NULL }, + { "largepacket", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendLargePacketCommand, "", NULL }, + { "opcode", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendOpcodeCommand, "", NULL }, + { "poi", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendPoiCommand, "", NULL }, + { "qpartymsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestPartyMsgCommand, "", NULL }, + { "qinvalidmsg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendQuestInvalidMsgCommand, "", NULL }, + { "sellerror", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendSellErrorCommand, "", NULL }, + { "setphaseshift", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendSetPhaseShiftCommand, "", NULL }, + { "spellfail", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSendSpellFailCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand debugCommandTable[] = + { + { "setbit", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSet32Bit, "", NULL }, + { "threat", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugThreatList, "", NULL }, + { "hostil", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugHostileRefList, "", NULL }, + { "anim", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugAnimCommand, "", NULL }, + { "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL }, + { "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL }, + { "getitemstate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetItemStateCommand, "", NULL }, + { "lootrecipient", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugGetLootRecipientCommand, "", NULL }, + { "getvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetValueCommand, "", NULL }, + { "getitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetItemValueCommand, "", NULL }, + { "Mod32Value", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugMod32ValueCommand, "", NULL }, + { "play", SEC_MODERATOR, false, NULL, "", debugPlayCommandTable }, + { "send", SEC_ADMINISTRATOR, false, NULL, "", debugSendCommandTable }, + { "setaurastate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetAuraStateCommand, "", NULL }, + { "setitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemValueCommand, "", NULL }, + { "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetValueCommand, "", NULL }, + { "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpawnVehicle, "", NULL }, + { "setvid", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetVehicleId, "", NULL }, + { "entervehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugEnterVehicle, "", NULL }, + { "uws", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateWorldStateCommand, "", NULL }, + { "update", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateCommand, "", NULL }, + { "itemexpire", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugItemExpireCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand eventCommandTable[] = + { + { "activelist", SEC_GAMEMASTER, true, &ChatHandler::HandleEventActiveListCommand, "", NULL }, + { "start", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStartCommand, "", NULL }, + { "stop", SEC_GAMEMASTER, true, &ChatHandler::HandleEventStopCommand, "", NULL }, + { "", SEC_GAMEMASTER, true, &ChatHandler::HandleEventInfoCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand gmCommandTable[] = + { + { "chat", SEC_MODERATOR, false, &ChatHandler::HandleGMChatCommand, "", NULL }, + { "fly", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGMFlyCommand, "", NULL }, + { "ingame", SEC_PLAYER, true, &ChatHandler::HandleGMListIngameCommand, "", NULL }, + { "list", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMListFullCommand, "", NULL }, + { "visible", SEC_MODERATOR, false, &ChatHandler::HandleGMVisibleCommand, "", NULL }, + { "", SEC_MODERATOR, false, &ChatHandler::HandleGMCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand goCommandTable[] = + { + { "creature", SEC_MODERATOR, false, &ChatHandler::HandleGoCreatureCommand, "", NULL }, + { "graveyard", SEC_MODERATOR, false, &ChatHandler::HandleGoGraveyardCommand, "", NULL }, + { "grid", SEC_MODERATOR, false, &ChatHandler::HandleGoGridCommand, "", NULL }, + { "object", SEC_MODERATOR, false, &ChatHandler::HandleGoObjectCommand, "", NULL }, + { "taxinode", SEC_MODERATOR, false, &ChatHandler::HandleGoTaxinodeCommand, "", NULL }, + { "trigger", SEC_MODERATOR, false, &ChatHandler::HandleGoTriggerCommand, "", NULL }, + { "zonexy", SEC_MODERATOR, false, &ChatHandler::HandleGoZoneXYCommand, "", NULL }, + { "xy", SEC_MODERATOR, false, &ChatHandler::HandleGoXYCommand, "", NULL }, + { "xyz", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, + { "ticket", SEC_MODERATOR, false, &ChatHandler::HandleGoTicketCommand, "", NULL }, + { "", SEC_MODERATOR, false, &ChatHandler::HandleGoXYZCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand gobjectCommandTable[] = + { + { "activate", SEC_GAMEMASTER, false, &ChatHandler::HandleActivateObjectCommand, "", NULL }, + { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectAddCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectDeleteCommand, "", NULL }, + { "info", SEC_GAMEMASTER, false, &ChatHandler::HandleGOInfoCommand, "", NULL }, + { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectMoveCommand, "", NULL }, + { "near", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectNearCommand, "", NULL }, + { "state", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectStateCommand, "", NULL }, + { "setphase", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectPhaseCommand, "", NULL }, + { "target", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectTargetCommand, "", NULL }, + { "tempadd", SEC_GAMEMASTER, false, &ChatHandler::HandleTempGameObjectCommand, "", NULL }, + { "turn", SEC_GAMEMASTER, false, &ChatHandler::HandleGameObjectTurnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand groupCommandTable[] = + { + { "leader", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupLeaderCommand, "", NULL }, + { "disband", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupDisbandCommand, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGroupRemoveCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand guildCommandTable[] = + { + { "create", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildCreateCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildDeleteCommand, "", NULL }, + { "invite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildInviteCommand, "", NULL }, + { "uninvite", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildUninviteCommand, "", NULL }, + { "rank", SEC_GAMEMASTER, true, &ChatHandler::HandleGuildRankCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand honorCommandTable[] = + { + { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorAddCommand, "", NULL }, + { "addkill", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorAddKillCommand, "", NULL }, + { "update", SEC_GAMEMASTER, false, &ChatHandler::HandleHonorUpdateCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand instanceCommandTable[] = + { + { "listbinds", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceListBindsCommand, "", NULL }, + { "unbind", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceUnbindCommand, "", NULL }, + { "stats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleInstanceStatsCommand, "", NULL }, + { "savedata", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceSaveDataCommand, "", NULL }, + { "open", SEC_ADMINISTRATOR, true, &ChatHandler::HandleInstanceOpenCommand, "", NULL }, + { "close", SEC_ADMINISTRATOR, true, &ChatHandler::HandleInstanceCloseCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand learnCommandTable[] = + { + { "all", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllCommand, "", NULL }, + { "all_gm", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllGMCommand, "", NULL }, + { "all_crafts", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllCraftsCommand, "", NULL }, + { "all_default", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllDefaultCommand, "", NULL }, + { "all_lang", SEC_MODERATOR, false, &ChatHandler::HandleLearnAllLangCommand, "", NULL }, + { "all_myclass", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyClassCommand, "", NULL }, + { "all_mypettalents",SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyPetTalentsCommand,"", NULL }, + { "all_myspells", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMySpellsCommand, "", NULL }, + { "all_mytalents", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnAllMyTalentsCommand, "", NULL }, + { "all_recipes", SEC_GAMEMASTER, false, &ChatHandler::HandleLearnAllRecipesCommand, "", NULL }, + { "", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLearnCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand listCommandTable[] = + { + { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListCreatureCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListItemCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleListObjectCommand, "", NULL }, + { "auras", SEC_ADMINISTRATOR, false, &ChatHandler::HandleListAurasCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand lookupPlayerCommandTable[] = + { + { "ip", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerIpCommand, "", NULL }, + { "account", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerAccountCommand, "", NULL }, + { "email", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupPlayerEmailCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand lookupCommandTable[] = + { + { "area", SEC_MODERATOR, true, &ChatHandler::HandleLookupAreaCommand, "", NULL }, + { "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupCreatureCommand, "", NULL }, + { "event", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupEventCommand, "", NULL }, + { "faction", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupFactionCommand, "", NULL }, + { "item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemCommand, "", NULL }, + { "itemset", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupItemSetCommand, "", NULL }, + { "object", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupObjectCommand, "", NULL }, + { "quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupQuestCommand, "", NULL }, + { "player", SEC_GAMEMASTER, true, NULL, "", lookupPlayerCommandTable }, + { "skill", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSkillCommand, "", NULL }, + { "spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupSpellCommand, "", NULL }, + { "taxinode", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupTaxiNodeCommand, "", NULL }, + { "tele", SEC_MODERATOR, true, &ChatHandler::HandleLookupTeleCommand, "", NULL }, + { "title", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupTitleCommand, "", NULL }, + { "map", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupMapCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand modifyCommandTable[] = + { + { "hp", SEC_MODERATOR, false, &ChatHandler::HandleModifyHPCommand, "", NULL }, + { "mana", SEC_MODERATOR, false, &ChatHandler::HandleModifyManaCommand, "", NULL }, + { "rage", SEC_MODERATOR, false, &ChatHandler::HandleModifyRageCommand, "", NULL }, + { "runicpower", SEC_MODERATOR, false, &ChatHandler::HandleModifyRunicPowerCommand, "", NULL }, + { "energy", SEC_MODERATOR, false, &ChatHandler::HandleModifyEnergyCommand, "", NULL }, + { "money", SEC_MODERATOR, false, &ChatHandler::HandleModifyMoneyCommand, "", NULL }, + { "speed", SEC_MODERATOR, false, &ChatHandler::HandleModifySpeedCommand, "", NULL }, + { "swim", SEC_MODERATOR, false, &ChatHandler::HandleModifySwimCommand, "", NULL }, + { "scale", SEC_MODERATOR, false, &ChatHandler::HandleModifyScaleCommand, "", NULL }, + { "bit", SEC_MODERATOR, false, &ChatHandler::HandleModifyBitCommand, "", NULL }, + { "bwalk", SEC_MODERATOR, false, &ChatHandler::HandleModifyBWalkCommand, "", NULL }, + { "fly", SEC_MODERATOR, false, &ChatHandler::HandleModifyFlyCommand, "", NULL }, + { "aspeed", SEC_MODERATOR, false, &ChatHandler::HandleModifyASpeedCommand, "", NULL }, + { "faction", SEC_MODERATOR, false, &ChatHandler::HandleModifyFactionCommand, "", NULL }, + { "spell", SEC_MODERATOR, false, &ChatHandler::HandleModifySpellCommand, "", NULL }, + { "tp", SEC_MODERATOR, false, &ChatHandler::HandleModifyTalentCommand, "", NULL }, + { "mount", SEC_MODERATOR, false, &ChatHandler::HandleModifyMountCommand, "", NULL }, + { "honor", SEC_MODERATOR, false, &ChatHandler::HandleModifyHonorCommand, "", NULL }, + { "rep", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyRepCommand, "", NULL }, + { "arena", SEC_MODERATOR, false, &ChatHandler::HandleModifyArenaCommand, "", NULL }, + { "drunk", SEC_MODERATOR, false, &ChatHandler::HandleModifyDrunkCommand, "", NULL }, + { "standstate", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyStandStateCommand, "", NULL }, + { "morph", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyMorphCommand, "", NULL }, + { "phase", SEC_ADMINISTRATOR, false, &ChatHandler::HandleModifyPhaseCommand, "", NULL }, + { "gender", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyGenderCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand npcCommandTable[] = + { + { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddCommand, "", NULL }, + { "additem", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddVendorItemCommand, "", NULL }, + { "addmove", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcAddMoveCommand, "", NULL }, + { "allowmove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcAllowMovementCommand, "", NULL }, + { "changeentry", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcChangeEntryCommand, "", NULL }, + { "changelevel", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcChangeLevelCommand, "", NULL }, + { "delete", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcDeleteCommand, "", NULL }, + { "delitem", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcDelVendorItemCommand, "", NULL }, + { "factionid", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFactionIdCommand, "", NULL }, + { "flag", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFlagCommand, "", NULL }, + { "follow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcFollowCommand, "", NULL }, + { "info", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcInfoCommand, "", NULL }, + { "move", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcMoveCommand, "", NULL }, + { "playemote", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcPlayEmoteCommand, "", NULL }, + { "setmodel", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetModelCommand, "", NULL }, + { "setmovetype", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetMoveTypeCommand, "", NULL }, + { "setphase", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetPhaseCommand, "", NULL }, + { "spawndist", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnDistCommand, "", NULL }, + { "spawntime", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSpawnTimeCommand, "", NULL }, + { "say", SEC_MODERATOR, false, &ChatHandler::HandleNpcSayCommand, "", NULL }, + { "textemote", SEC_MODERATOR, false, &ChatHandler::HandleNpcTextEmoteCommand, "", NULL }, + { "unfollow", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcUnFollowCommand, "", NULL }, + { "whisper", SEC_MODERATOR, false, &ChatHandler::HandleNpcWhisperCommand, "", NULL }, + { "yell", SEC_MODERATOR, false, &ChatHandler::HandleNpcYellCommand, "", NULL }, + { "tempadd", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL }, + { "tame", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcTameCommand, "", NULL }, + { "setdeathstate", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetDeathStateCommand, "", NULL }, + { "addformation", SEC_MODERATOR, false, &ChatHandler::HandleNpcAddFormationCommand, "", NULL }, + { "setlink", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSetLinkCommand, "", NULL }, + + //{ TODO: fix or remove this commands + { "addweapon", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNpcAddWeaponCommand, "", NULL }, + { "name", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcNameCommand, "", NULL }, + { "subname", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcSubNameCommand, "", NULL }, + //} + + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand petCommandTable[] = + { + { "create", SEC_GAMEMASTER, false, &ChatHandler::HandleCreatePetCommand, "", NULL }, + { "learn", SEC_GAMEMASTER, false, &ChatHandler::HandlePetLearnCommand, "", NULL }, + { "unlearn", SEC_GAMEMASTER, false, &ChatHandler::HandlePetUnlearnCommand, "", NULL }, + { "tp", SEC_GAMEMASTER, false, &ChatHandler::HandlePetTpCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand pdumpCommandTable[] = + { + { "load", SEC_ADMINISTRATOR, true, &ChatHandler::HandlePDumpLoadCommand, "", NULL }, + { "write", SEC_ADMINISTRATOR, true, &ChatHandler::HandlePDumpWriteCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand questCommandTable[] = + { + { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestAdd, "", NULL }, + { "complete", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestComplete, "", NULL }, + { "remove", SEC_ADMINISTRATOR, false, &ChatHandler::HandleQuestRemove, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand reloadCommandTable[] = + { + { "all", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllCommand, "", NULL }, + { "all_achievement",SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllAchievementCommand,"", NULL }, + { "all_area", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllAreaCommand, "", NULL }, + { "all_eventai", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllEventAICommand, "", NULL }, + { "all_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllItemCommand, "", NULL }, + { "all_locales", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllLocalesCommand, "", NULL }, + { "all_loot", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllLootCommand, "", NULL }, + { "all_npc", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllNpcCommand, "", NULL }, + { "all_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllQuestCommand, "", NULL }, + { "all_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllScriptsCommand, "", NULL }, + { "all_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllSpellCommand, "", NULL }, + + { "config", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadConfigCommand, "", NULL }, + + { "access_requirement", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAccessRequirementCommand, "", NULL }, + { "achievement_criteria_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAchievementCriteriaDataCommand, "", NULL }, + { "achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAchievementRewardCommand, "", NULL }, + { "areatrigger_involvedrelation",SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestAreaTriggersCommand, "", NULL }, + { "areatrigger_tavern", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTavernCommand, "", NULL }, + { "areatrigger_teleport", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTeleportCommand, "", NULL }, + { "autobroadcast", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAutobroadcastCommand, "", NULL }, + { "command", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCommandCommand, "", NULL }, + { "conditions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadConditions, "", NULL }, + { "creature_ai_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventAIScriptsCommand, "", NULL }, + { "creature_ai_summons", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventAISummonsCommand, "", NULL }, + { "creature_ai_texts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventAITextsCommand, "", NULL }, + { "creature_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestInvRelationsCommand,"",NULL }, + { "creature_linked_respawn", SEC_GAMEMASTER, true, &ChatHandler::HandleReloadCreatureLinkedRespawnCommand, "", NULL }, + { "creature_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand, "", NULL }, + { "creature_onkill_reputation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadOnKillReputationCommand, "", NULL }, + { "creature_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL }, + { "creature_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureTemplateCommand, "", NULL }, + //{ "db_script_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDbScriptStringCommand, "", NULL }, + { "disenchant_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesDisenchantCommand, "", NULL }, + { "event_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventScriptsCommand, "", NULL }, + { "fishing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesFishingCommand, "", NULL }, + { "game_graveyard_zone", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameGraveyardZoneCommand, "", NULL }, + { "game_tele", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameTeleCommand, "", NULL }, + { "gameobject_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestInvRelationsCommand, "", NULL }, + { "gameobject_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand, "", NULL }, + { "gameobject_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL }, + { "gameobject_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL }, + { "gossip_menu", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuCommand, "", NULL }, + { "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuOptionCommand, "", NULL }, + { "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL }, + { "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL }, + { "item_set_names", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemSetNamesCommand, "", NULL }, + { "locales_achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesAchievementRewardCommand,"", NULL }, + { "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL }, + { "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL }, + { "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL }, + { "locales_item_set_name", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemSetNameCommand, "", NULL }, + { "locales_npc_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesNpcTextCommand, "", NULL }, + { "locales_page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPageTextCommand, "", NULL }, + { "locales_points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesPointsOfInterestCommand, "", NULL }, + { "locales_quest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesQuestCommand, "", NULL }, +// { "auctions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAuctionsCommand, "", NULL }, + { "mail_level_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadMailLevelRewardCommand, "", NULL }, + { "mail_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesMailCommand, "", NULL }, + { "milling_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesMillingCommand, "", NULL }, + { "npc_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL }, + { "npc_spellclick_spells", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellClickSpellsCommand, "",NULL}, + { "npc_trainer", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL }, + { "npc_vendor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL }, + { "page_text", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPageTextsCommand, "", NULL }, + { "pickpocketing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand,"",NULL}, + { "points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPointsOfInterestCommand, "",NULL}, + { "prospecting_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesProspectingCommand,"", NULL }, + { "quest_end_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestEndScriptsCommand, "", NULL }, + { "quest_start_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestStartScriptsCommand, "", NULL }, + { "quest_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestTemplateCommand, "", NULL }, + { "reference_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesReferenceCommand, "", NULL }, + { "reserved_name", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadReservedNameCommand, "", NULL }, + { "skill_discovery_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillDiscoveryTemplateCommand, "", NULL }, + { "skill_extra_item_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillExtraItemTemplateCommand, "", NULL }, + { "skill_fishing_base_level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillFishingBaseLevelCommand, "", NULL }, + { "skinning_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesSkinningCommand, "", NULL }, + { "spell_required", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellRequiredCommand, "", NULL }, + { "spell_area", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellAreaCommand, "", NULL }, + { "spell_bonus_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellBonusesCommand, "", NULL }, + { "spell_group", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellGroupsCommand, "", NULL }, + { "spell_learn_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellLearnSpellCommand, "", NULL }, + { "spell_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesSpellCommand, "", NULL }, + { "spell_linked_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellLinkedSpellCommand, "", NULL }, + { "spell_pet_auras", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellPetAurasCommand, "", NULL }, + { "spell_proc_event", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellProcEventCommand, "", NULL }, + { "spell_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL }, + { "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL }, + { "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL }, + { "spell_disabled", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellDisabledCommand, "", NULL }, + { "spell_group_stack_rules", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellGroupStackRulesCommand, "", NULL }, + { "trinity_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadTrinityStringCommand, "", NULL }, + { "auctions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAuctionsCommand, "", NULL }, + { "waypoint_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadWpScriptsCommand, "", NULL }, + { "gm_tickets", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMTicketReloadCommand, "", NULL }, + + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand resetCommandTable[] = + { + { "achievements", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAchievementsCommand, "", NULL }, + { "honor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetHonorCommand, "", NULL }, + { "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetLevelCommand, "", NULL }, + { "spells", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetSpellsCommand, "", NULL }, + { "stats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetStatsCommand, "", NULL }, + { "talents", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetTalentsCommand, "", NULL }, + { "all", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAllCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand sendCommandTable[] = + { + { "items", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendItemsCommand, "", NULL }, + { "mail", SEC_MODERATOR, true, &ChatHandler::HandleSendMailCommand, "", NULL }, + { "message", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMessageCommand, "", NULL }, + { "money", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMoneyCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverIdleRestartCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleRestartCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverIdleShutdownCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerIdleShutDownCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverRestartCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerRestartCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverShutdownCommandTable[] = + { + { "cancel", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCancelCommand,"", NULL }, + { "" , SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerShutDownCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverSetCommandTable[] = + { + { "difftime", SEC_CONSOLE, true, &ChatHandler::HandleServerSetDiffTimeCommand, "", NULL }, + { "loglevel", SEC_CONSOLE, true, &ChatHandler::HandleServerSetLogLevelCommand, "", NULL }, + { "logfilelevel", SEC_CONSOLE, true, &ChatHandler::HandleServerSetLogFileLevelCommand, "", NULL }, + { "motd", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetMotdCommand, "", NULL }, + { "closed", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetClosedCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand serverCommandTable[] = + { + { "corpses", SEC_GAMEMASTER, true, &ChatHandler::HandleServerCorpsesCommand, "", NULL }, + { "exit", SEC_CONSOLE, true, &ChatHandler::HandleServerExitCommand, "", NULL }, + { "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable }, + { "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, + { "info", SEC_PLAYER, true, &ChatHandler::HandleServerInfoCommand, "", NULL }, + { "motd", SEC_PLAYER, true, &ChatHandler::HandleServerMotdCommand, "", NULL }, + { "plimit", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerPLimitCommand, "", NULL }, + { "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable }, + { "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable }, + { "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand teleCommandTable[] = + { + { "add", SEC_ADMINISTRATOR, false, &ChatHandler::HandleTeleAddCommand, "", NULL }, + { "del", SEC_ADMINISTRATOR, true, &ChatHandler::HandleTeleDelCommand, "", NULL }, + { "name", SEC_MODERATOR, true, &ChatHandler::HandleTeleNameCommand, "", NULL }, + { "group", SEC_MODERATOR, false, &ChatHandler::HandleTeleGroupCommand, "", NULL }, + { "", SEC_MODERATOR, false, &ChatHandler::HandleTeleCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand titlesCommandTable[] = + { + { "add", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesAddCommand, "", NULL }, + { "current", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesCurrentCommand, "", NULL }, + { "remove", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesRemoveCommand, "", NULL }, + { "setmask", SEC_GAMEMASTER, false, &ChatHandler::HandleTitlesSetMaskCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand unbanCommandTable[] = + { + { "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL }, + { "character", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanCharacterCommand, "", NULL }, + { "ip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanIPCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand wintergraspCommandTable[] = + { + { "status", SEC_ADMINISTRATOR, false, &ChatHandler::HandleWintergraspStatusCommand, "", NULL }, + { "enable", SEC_ADMINISTRATOR, false, &ChatHandler::HandleWintergraspEnableCommand, "", NULL }, + { "start", SEC_ADMINISTRATOR, false, &ChatHandler::HandleWintergraspStartCommand, "", NULL }, + { "stop", SEC_ADMINISTRATOR, false, &ChatHandler::HandleWintergraspStopCommand, "", NULL }, + { "switch", SEC_ADMINISTRATOR, false, &ChatHandler::HandleWintergraspSwitchTeamCommand, "", NULL }, + { "timer", SEC_ADMINISTRATOR, false, &ChatHandler::HandleWintergraspTimerCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + static ChatCommand wpCommandTable[] = + { + { "show", SEC_GAMEMASTER, false, &ChatHandler::HandleWpShowCommand, "", NULL }, + { "addwp", SEC_GAMEMASTER, false, &ChatHandler::HandleWpAddCommand, "", NULL }, + { "load", SEC_GAMEMASTER, false, &ChatHandler::HandleWpLoadPathCommand, "", NULL }, + { "modify", SEC_GAMEMASTER, false, &ChatHandler::HandleWpModifyCommand, "", NULL }, + { "event", SEC_GAMEMASTER, false, &ChatHandler::HandleWpEventCommand, "", NULL }, + { "unload", SEC_GAMEMASTER, false, &ChatHandler::HandleWpUnLoadPathCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand ticketCommandTable[] = + { + { "list", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListCommand, "", NULL }, + { "onlinelist", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListOnlineCommand, "", NULL }, + { "viewname", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketGetByNameCommand, "", NULL }, + { "viewid", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketGetByIdCommand, "", NULL }, + { "close", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketCloseByIdCommand, "", NULL }, + { "closedlist", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketListClosedCommand, "", NULL }, + { "delete", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGMTicketDeleteByIdCommand, "", NULL }, + { "assign", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketAssignToCommand, "", NULL }, + { "unassign", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketUnAssignCommand, "", NULL }, + { "comment", SEC_MODERATOR, false, &ChatHandler::HandleGMTicketCommentCommand, "", NULL }, + { NULL, 0, false, NULL, "", NULL } + }; + + static ChatCommand commandTable[] = + { + { "account", SEC_PLAYER, true, NULL, "", accountCommandTable }, + { "gm", SEC_MODERATOR, true, NULL, "", gmCommandTable }, + { "npc", SEC_MODERATOR, false, NULL, "", npcCommandTable }, + { "go", SEC_MODERATOR, false, NULL, "", goCommandTable }, + { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable }, + { "modify", SEC_MODERATOR, false, NULL, "", modifyCommandTable }, + { "debug", SEC_MODERATOR, true, NULL, "", debugCommandTable }, + { "tele", SEC_MODERATOR, true, NULL, "", teleCommandTable }, + { "character", SEC_GAMEMASTER, false, NULL, "", characterCommandTable}, + { "event", SEC_GAMEMASTER, false, NULL, "", eventCommandTable }, + { "gobject", SEC_GAMEMASTER, false, NULL, "", gobjectCommandTable }, + { "honor", SEC_GAMEMASTER, false, NULL, "", honorCommandTable }, + { "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable }, + { "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable }, + { "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable }, + { "reload", SEC_ADMINISTRATOR, true, NULL, "", reloadCommandTable }, + { "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable }, + { "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable }, + { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable }, + { "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable }, + { "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable }, + { "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable }, + { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, + { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, + + { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable }, + + { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, + { "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL }, + { "ahbotoptions", SEC_GAMEMASTER, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL }, + { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable }, + + { "aura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuraCommand, "", NULL }, + { "unaura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnAuraCommand, "", NULL }, + { "nameannounce", SEC_MODERATOR, false, &ChatHandler::HandleNameAnnounceCommand, "", NULL }, + { "gmnameannounce", SEC_MODERATOR, false, &ChatHandler::HandleGMNameAnnounceCommand, "", NULL }, + { "announce", SEC_MODERATOR, true, &ChatHandler::HandleAnnounceCommand, "", NULL }, + { "gmannounce", SEC_MODERATOR, true, &ChatHandler::HandleGMAnnounceCommand, "", NULL }, + { "notify", SEC_MODERATOR, true, &ChatHandler::HandleNotifyCommand, "", NULL }, + { "gmnotify", SEC_MODERATOR, true, &ChatHandler::HandleGMNotifyCommand, "", NULL }, + { "goname", SEC_MODERATOR, false, &ChatHandler::HandleGonameCommand, "", NULL }, + { "namego", SEC_MODERATOR, false, &ChatHandler::HandleNamegoCommand, "", NULL }, + { "groupgo", SEC_MODERATOR, false, &ChatHandler::HandleGroupgoCommand, "", NULL }, + { "commands", SEC_PLAYER, true, &ChatHandler::HandleCommandsCommand, "", NULL }, + { "demorph", SEC_GAMEMASTER, false, &ChatHandler::HandleDeMorphCommand, "", NULL }, + { "die", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDieCommand, "", NULL }, + { "revive", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReviveCommand, "", NULL }, + { "dismount", SEC_PLAYER, false, &ChatHandler::HandleDismountCommand, "", NULL }, + { "gps", SEC_MODERATOR, false, &ChatHandler::HandleGPSCommand, "", NULL }, + { "guid", SEC_GAMEMASTER, false, &ChatHandler::HandleGUIDCommand, "", NULL }, + { "help", SEC_PLAYER, true, &ChatHandler::HandleHelpCommand, "", NULL }, + { "itemmove", SEC_GAMEMASTER, false, &ChatHandler::HandleItemMoveCommand, "", NULL }, + { "cooldown", SEC_ADMINISTRATOR, false, &ChatHandler::HandleCooldownCommand, "", NULL }, + { "unlearn", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnLearnCommand, "", NULL }, + { "distance", SEC_ADMINISTRATOR, false, &ChatHandler::HandleGetDistanceCommand, "", NULL }, + { "recall", SEC_MODERATOR, false, &ChatHandler::HandleRecallCommand, "", NULL }, + { "save", SEC_PLAYER, false, &ChatHandler::HandleSaveCommand, "", NULL }, + { "saveall", SEC_MODERATOR, true, &ChatHandler::HandleSaveAllCommand, "", NULL }, + { "kick", SEC_GAMEMASTER, true, &ChatHandler::HandleKickPlayerCommand, "", NULL }, + { "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable }, + { "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable }, + { "baninfo", SEC_ADMINISTRATOR, false, NULL, "", baninfoCommandTable }, + { "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable }, + { "start", SEC_PLAYER, false, &ChatHandler::HandleStartCommand, "", NULL }, + { "taxicheat", SEC_MODERATOR, false, &ChatHandler::HandleTaxiCheatCommand, "", NULL }, + { "linkgrave", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLinkGraveCommand, "", NULL }, + { "neargrave", SEC_ADMINISTRATOR, false, &ChatHandler::HandleNearGraveCommand, "", NULL }, + { "explorecheat", SEC_ADMINISTRATOR, false, &ChatHandler::HandleExploreCheatCommand, "", NULL }, + { "hover", SEC_ADMINISTRATOR, false, &ChatHandler::HandleHoverCommand, "", NULL }, + { "levelup", SEC_ADMINISTRATOR, false, &ChatHandler::HandleLevelUpCommand, "", NULL }, + { "showarea", SEC_ADMINISTRATOR, false, &ChatHandler::HandleShowAreaCommand, "", NULL }, + { "hidearea", SEC_ADMINISTRATOR, false, &ChatHandler::HandleHideAreaCommand, "", NULL }, + { "additem", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddItemCommand, "", NULL }, + { "additemset", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAddItemSetCommand, "", NULL }, + { "bank", SEC_ADMINISTRATOR, false, &ChatHandler::HandleBankCommand, "", NULL }, + { "wchange", SEC_ADMINISTRATOR, false, &ChatHandler::HandleChangeWeather, "", NULL }, + { "maxskill", SEC_ADMINISTRATOR, false, &ChatHandler::HandleMaxSkillCommand, "", NULL }, + { "setskill", SEC_ADMINISTRATOR, false, &ChatHandler::HandleSetSkillCommand, "", NULL }, + { "whispers", SEC_MODERATOR, false, &ChatHandler::HandleWhispersCommand, "", NULL }, + { "pinfo", SEC_GAMEMASTER, true, &ChatHandler::HandlePInfoCommand, "", NULL }, + { "respawn", SEC_ADMINISTRATOR, false, &ChatHandler::HandleRespawnCommand, "", NULL }, + { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable }, + { "mute", SEC_MODERATOR, true, &ChatHandler::HandleMuteCommand, "", NULL }, + { "unmute", SEC_MODERATOR, true, &ChatHandler::HandleUnmuteCommand, "", NULL }, + { "movegens", SEC_ADMINISTRATOR, false, &ChatHandler::HandleMovegensCommand, "", NULL }, + { "cometome", SEC_ADMINISTRATOR, false, &ChatHandler::HandleComeToMeCommand, "", NULL }, + { "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL }, + { "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL }, + { "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL }, + { "repairitems", SEC_GAMEMASTER, true, &ChatHandler::HandleRepairitemsCommand, "", NULL }, + { "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL }, + + { "freeze", SEC_MODERATOR, false, &ChatHandler::HandleFreezeCommand, "", NULL }, + { "unfreeze", SEC_MODERATOR, false, &ChatHandler::HandleUnFreezeCommand, "", NULL }, + { "listfreeze", SEC_MODERATOR, false, &ChatHandler::HandleListFreezeCommand, "", NULL }, + + { "possess", SEC_ADMINISTRATOR, false, &ChatHandler::HandlePossessCommand, "", NULL }, + { "unpossess", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnPossessCommand, "", NULL }, + { "bindsight", SEC_ADMINISTRATOR, false, &ChatHandler::HandleBindSightCommand, "", NULL }, + { "unbindsight", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnbindSightCommand, "", NULL }, + { "playall", SEC_GAMEMASTER, false, &ChatHandler::HandlePlayAllCommand, "", NULL }, + { "wg", SEC_ADMINISTRATOR, false, NULL, "", wintergraspCommandTable }, + { NULL, 0, false, NULL, "", NULL } + }; + + if (load_command_table) + { + load_command_table = false; + + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT name,security,help FROM command"); + if (result) + { + do + { + Field *fields = result->Fetch(); + std::string name = fields[0].GetCppString(); + + SetDataForCommandInTable(commandTable, name.c_str(), fields[1].GetUInt16(), fields[2].GetCppString(), name); + + } while (result->NextRow()); + } + } + + return commandTable; +} + +const char *ChatHandler::GetTrinityString(int32 entry) const +{ + return m_session->GetTrinityString(entry); +} + +bool ChatHandler::isAvailable(ChatCommand const& cmd) const +{ + // check security level only for simple command (without child commands) + return m_session->GetSecurity() >= cmd.SecurityLevel; +} + +bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong) +{ + WorldSession* target_session = NULL; + uint32 target_account = 0; + + if (target) + target_session = target->GetSession(); + else if (guid) + target_account = objmgr.GetPlayerAccountIdByGUID(guid); + + if (!target_session && !target_account) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return true; + } + + return HasLowerSecurityAccount(target_session,target_account,strong); +} + +bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_account, bool strong) +{ + uint32 target_sec; + + // allow everything from console and RA console + if (!m_session) + return false; + + // ignore only for non-players for non strong checks (when allow apply command at least to same sec level) + if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld.getConfig(CONFIG_GM_LOWER_SECURITY)) + return false; + + if (target) + target_sec = target->GetSecurity(); + else if (target_account) + target_sec = accmgr.GetSecurity(target_account); + else + return true; // caller must report error for (target == NULL && target_account == 0) + + if (m_session->GetSecurity() < target_sec || (strong && m_session->GetSecurity() <= target_sec)) + { + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); + SetSentErrorMessage(true); + return true; + } + + return false; +} + +bool ChatHandler::hasStringAbbr(const char* name, const char* part) +{ + // non "" command + if (*name) + { + // "" part from non-"" command + if (!*part) + return false; + + for (;;) + { + if (!*part) + return true; + else if (!*name) + return false; + else if (tolower(*name) != tolower(*part)) + return false; + ++name; ++part; + } + } + // allow with any for "" + + return true; +} + +void ChatHandler::SendSysMessage(const char *str) +{ + WorldPacket data; + + // need copy to prevent corruption by strtok call in LineFromMessage original string + char* buf = strdup(str); + char* pos = buf; + + while (char* line = LineFromMessage(pos)) + { + FillSystemMessageData(&data, line); + m_session->SendPacket(&data); + } + + free(buf); +} + +void ChatHandler::SendGlobalSysMessage(const char *str) +{ + // Chat output + WorldPacket data; + + // need copy to prevent corruption by strtok call in LineFromMessage original string + char* buf = strdup(str); + char* pos = buf; + + while (char* line = LineFromMessage(pos)) + { + FillSystemMessageData(&data, line); + sWorld.SendGlobalMessage(&data); + } + + free(buf); +} + +void ChatHandler::SendGlobalGMSysMessage(const char *str) +{ + // Chat output + WorldPacket data; + + // need copy to prevent corruption by strtok call in LineFromMessage original string + char* buf = strdup(str); + char* pos = buf; + + while (char* line = LineFromMessage(pos)) + { + FillSystemMessageData(&data, line); + sWorld.SendGlobalGMMessage(&data); + } + free(buf); +} + +void ChatHandler::SendSysMessage(int32 entry) +{ + SendSysMessage(GetTrinityString(entry)); +} + +void ChatHandler::PSendSysMessage(int32 entry, ...) +{ + const char *format = GetTrinityString(entry); + va_list ap; + char str [2048]; + va_start(ap, entry); + vsnprintf(str,2048,format, ap); + va_end(ap); + SendSysMessage(str); +} + +void ChatHandler::PSendSysMessage(const char *format, ...) +{ + va_list ap; + char str [2048]; + va_start(ap, format); + vsnprintf(str,2048,format, ap); + va_end(ap); + SendSysMessage(str); +} + +bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcmd) +{ + char const* oldtext = text; + std::string cmd = ""; + + while (*text != ' ' && *text != '\0') + { + cmd += *text; + ++text; + } + + while (*text == ' ') ++text; + + for (uint32 i = 0; table[i].Name != NULL; ++i) + { + if (!hasStringAbbr(table[i].Name, cmd.c_str())) + continue; + + // select subcommand from child commands list + if (table[i].ChildCommands != NULL) + { + if (!ExecuteCommandInTable(table[i].ChildCommands, text, fullcmd)) + { + if (text && text[0] != '\0') + SendSysMessage(LANG_NO_SUBCMD); + else + SendSysMessage(LANG_CMD_SYNTAX); + + ShowHelpForCommand(table[i].ChildCommands,text); + } + + return true; + } + + // must be available and have handler + if (!table[i].Handler || !isAvailable(table[i])) + continue; + + SetSentErrorMessage(false); + // table[i].Name == "" is special case: send original command to handler + if ((this->*(table[i].Handler))(strlen(table[i].Name) != 0 ? text : oldtext)) + { + if (table[i].SecurityLevel > SEC_PLAYER) + { + // chat case + if (m_session) + { + Player* p = m_session->GetPlayer(); + uint64 sel_guid = p->GetSelection(); + sLog.outCommand(m_session->GetAccountId(),"Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected: %s (GUID: %u)]", + fullcmd.c_str(),p->GetName(),m_session->GetAccountId(),p->GetPositionX(),p->GetPositionY(),p->GetPositionZ(),p->GetMapId(), + GetLogNameForGuid(sel_guid),GUID_LOPART(sel_guid)); + } + } + } + // some commands have custom error messages. Don't send the default one in these cases. + else if (!sentErrorMessage) + { + if (!table[i].Help.empty()) + SendSysMessage(table[i].Help.c_str()); + else + SendSysMessage(LANG_CMD_SYNTAX); + } + + return true; + } + + return false; +} + +bool ChatHandler::SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand) +{ + std::string cmd = ""; + + while (*text != ' ' && *text != '\0') + { + cmd += *text; + ++text; + } + + while (*text == ' ') ++text; + + for (uint32 i = 0; table[i].Name != NULL; i++) + { + // for data fill use full explicit command names + if (table[i].Name != cmd) + continue; + + // select subcommand from child commands list (including "") + if (table[i].ChildCommands != NULL) + { + if (SetDataForCommandInTable(table[i].ChildCommands, text, security, help, fullcommand)) + return true; + else if (*text) + return false; + + // fail with "" subcommands, then use normal level up command instead + } + // expected subcommand by full name DB content + else if (*text) + { + sLog.outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.",text,fullcommand.c_str()); + return false; + } + + if (table[i].SecurityLevel != security) + sLog.outDetail("Table `command` overwrite for command '%s' default security (%u) by %u",fullcommand.c_str(),table[i].SecurityLevel,security); + + table[i].SecurityLevel = security; + table[i].Help = help; + return true; + } + + // in case "" command let process by caller + if (!cmd.empty()) + { + if (table == getCommandTable()) + sLog.outErrorDb("Table `command` have not existed command '%s', skip.",cmd.c_str()); + else + sLog.outErrorDb("Table `command` have not existed subcommand '%s' in command '%s', skip.",cmd.c_str(),fullcommand.c_str()); + } + + return false; +} + +int ChatHandler::ParseCommands(const char* text) +{ + ASSERT(text); + ASSERT(*text); + + std::string fullcmd = text; + + if (m_session && m_session->GetSecurity() <= SEC_PLAYER && sWorld.getConfig(CONFIG_ALLOW_PLAYER_COMMANDS) == 0) + return 0; + + if (m_session && !m_session->HandleOnPlayerChat(text)) + return 0; + + /// chat case (.command or !command format) + if (m_session) + { + if (text[0] != '!' && text[0] != '.') + return 0; + } + + /// ignore single . and ! in line + if (strlen(text) < 2) + return 0; + // original `text` can't be used. It content destroyed in command code processing. + + /// ignore messages staring from many dots. + if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!')) + return 0; + + /// skip first . or ! (in console allowed use command with . and ! and without its) + if (text[0] == '!' || text[0] == '.') + ++text; + + if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) + { + if (m_session && m_session->GetSecurity() == SEC_PLAYER) + return 0; + SendSysMessage(LANG_NO_CMD); + } + return 1; +} + +bool ChatHandler::isValidChatMessage(const char* message) +{ +/* + +valid examples: +|cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r +|cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r +|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r +|cff4e96f7|Htalent:2232:-1|h[Taste for Blood]|h|r +|cff71d5ff|Hspell:21563|h[Command]|h|r +|cffffd000|Henchant:3919|h[Engineering: Rough Dynamite]|h|r +|cffffff00|Hachievement:546:0000000000000001:0:0:0:-1:0:0:0:0|h[Safe Deposit]|h|r +|cff66bbff|Hglyph:21:762|h[Glyph of Bladestorm]|h|r + +| will be escaped to || +*/ + + if (strlen(message) > 255) + return false; + + const char validSequence[6] = "cHhhr"; + const char* validSequenceIterator = validSequence; + + // more simple checks + if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) < 3) + { + const std::string validCommands = "cHhr|"; + + while (*message) + { + // find next pipe command + message = strchr(message, '|'); + + if (!message) + return true; + + ++message; + char commandChar = *message; + if (validCommands.find(commandChar) == std::string::npos) + return false; + + ++message; + // validate sequence + if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) == 2) + { + if (commandChar == *validSequenceIterator) + { + if (validSequenceIterator == validSequence+4) + validSequenceIterator = validSequence; + else + ++validSequenceIterator; + } + else + return false; + } + } + return true; + } + + std::istringstream reader(message); + char buffer[256]; + + uint32 color; + + ItemPrototype const* linkedItem; + Quest const* linkedQuest; + SpellEntry const *linkedSpell; + AchievementEntry const* linkedAchievement; + ItemRandomPropertiesEntry const* itemProperty; + ItemRandomSuffixEntry const* itemSuffix; + + while (!reader.eof()) + { + if (validSequence == validSequenceIterator) + { + linkedItem = NULL; + linkedQuest = NULL; + linkedSpell = NULL; + linkedAchievement = NULL; + itemProperty = NULL; + itemSuffix = NULL; + + reader.ignore(255, '|'); + } + else if (reader.get() != '|') + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage sequence aborted unexpectedly"); +#endif + return false; + } + + // pipe has always to be followed by at least one char + if (reader.peek() == '\0') + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage pipe followed by \\0"); +#endif + return false; + } + + // no further pipe commands + if (reader.eof()) + break; + + char commandChar; + reader >> commandChar; + + // | in normal messages is escaped by || + if (commandChar != '|') + { + if (commandChar == *validSequenceIterator) + { + if (validSequenceIterator == validSequence+4) + validSequenceIterator = validSequence; + else + ++validSequenceIterator; + } + else + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage invalid sequence, expected %c but got %c", *validSequenceIterator, commandChar); +#endif + return false; + } + } + else if (validSequence != validSequenceIterator) + { + // no escaped pipes in sequences +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage got escaped pipe in sequence"); +#endif + return false; + } + + switch (commandChar) + { + case 'c': + color = 0; + // validate color, expect 8 hex chars + for (int i=0; i<8; i++) + { + char c; + reader >> c; + if (!c) + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage got \\0 while reading color in |c command"); +#endif + return false; + } + + color <<= 4; + // check for hex char + if (c >= '0' && c <= '9') + { + color |= c-'0'; + continue; + } + if (c >= 'a' && c <= 'f') + { + color |= 10+c-'a'; + continue; + } +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage got non hex char '%c' while reading color", c); +#endif + return false; + } + break; + case 'H': + // read chars up to colon = link type + reader.getline(buffer, 256, ':'); + + if (strcmp(buffer, "item") == 0) + { + // read item entry + reader.getline(buffer, 256, ':'); + + linkedItem= objmgr.GetItemPrototype(atoi(buffer)); + if (!linkedItem) + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage got invalid itemID %u in |item command", atoi(buffer)); +#endif + return false; + } + + if (color != ItemQualityColors[linkedItem->Quality]) + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage linked item has color %u, but user claims %u", ItemQualityColors[linkedItem->Quality], + color); +#endif + return false; + } + + // the itementry is followed by several integers which describe an instance of this item + + // position relative after itemEntry + const uint8 randomPropertyPosition = 6; + + int32 propertyId = 0; + bool negativeNumber = false; + char c; + for (uint8 i=0; i='0' && c <= '9') + { + propertyId*=10; + propertyId += c-'0'; + } else if (c == '-') + negativeNumber = true; + else + return false; + } + } + if (negativeNumber) + propertyId *= -1; + + if (propertyId > 0) + { + itemProperty = sItemRandomPropertiesStore.LookupEntry(propertyId); + if (!itemProperty) + return false; + } + else if (propertyId < 0) + { + itemSuffix = sItemRandomSuffixStore.LookupEntry(-propertyId); + if (!itemSuffix) + return false; + } + + // ignore other integers + while ((c >='0' && c <= '9') || c == ':') + { + reader.ignore(1); + c = reader.peek(); + } + } + else if (strcmp(buffer, "quest") == 0) + { + // no color check for questlinks, each client will adapt it anyway + uint32 questid= 0; + // read questid + char c = reader.peek(); + while (c >='0' && c <= '9') + { + reader.ignore(1); + questid *= 10; + questid += c-'0'; + c = reader.peek(); + } + + linkedQuest = objmgr.GetQuestTemplate(questid); + + if (!linkedQuest) + { +#ifdef MANOGS_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage Questtemplate %u not found", questid); +#endif + return false; + } + c = reader.peek(); + // level + while (c !='|' && c != '\0') + { + reader.ignore(1); + c = reader.peek(); + } + } + else if (strcmp(buffer, "trade") == 0) + { + if (color != CHAT_LINK_COLOR_TRADE) + return false; + + // read spell entry + reader.getline(buffer, 256, ':'); + linkedSpell = sSpellStore.LookupEntry(atoi(buffer)); + if (!linkedSpell) + return false; + + char c = reader.peek(); + // base64 encoded stuff + while (c !='|' && c != '\0') + { + reader.ignore(1); + c = reader.peek(); + } + } + else if (strcmp(buffer, "talent") == 0) + { + // talent links are always supposed to be blue + if (color != CHAT_LINK_COLOR_TALENT) + return false; + + // read talent entry + reader.getline(buffer, 256, ':'); + TalentEntry const *talentInfo = sTalentStore.LookupEntry(atoi(buffer)); + if (!talentInfo) + return false; + + linkedSpell = sSpellStore.LookupEntry(talentInfo->RankID[0]); + if (!linkedSpell) + return false; + + char c = reader.peek(); + // skillpoints? whatever, drop it + while (c !='|' && c != '\0') + { + reader.ignore(1); + c = reader.peek(); + } + } + else if (strcmp(buffer, "spell") == 0) + { + if (color != CHAT_LINK_COLOR_SPELL) + return false; + + uint32 spellid = 0; + // read spell entry + char c = reader.peek(); + while (c >='0' && c <= '9') + { + reader.ignore(1); + spellid *= 10; + spellid += c-'0'; + c = reader.peek(); + } + linkedSpell = sSpellStore.LookupEntry(spellid); + if (!linkedSpell) + return false; + } + else if (strcmp(buffer, "enchant") == 0) + { + if (color != CHAT_LINK_COLOR_ENCHANT) + return false; + + uint32 spellid = 0; + // read spell entry + char c = reader.peek(); + while (c >='0' && c <= '9') + { + reader.ignore(1); + spellid *= 10; + spellid += c-'0'; + c = reader.peek(); + } + linkedSpell = sSpellStore.LookupEntry(spellid); + if (!linkedSpell) + return false; + } + else if (strcmp(buffer, "achievement") == 0) + { + if (color != CHAT_LINK_COLOR_ACHIEVEMENT) + return false; + reader.getline(buffer, 256, ':'); + uint32 achievementId = atoi(buffer); + linkedAchievement = sAchievementStore.LookupEntry(achievementId); + + if (!linkedAchievement) + return false; + + char c = reader.peek(); + // skip progress + while (c !='|' && c != '\0') + { + reader.ignore(1); + c = reader.peek(); + } + } + else if (strcmp(buffer, "glyph") == 0) + { + if (color != CHAT_LINK_COLOR_GLYPH) + return false; + + // first id is slot, drop it + reader.getline(buffer, 256, ':'); + uint32 glyphId = 0; + char c = reader.peek(); + while (c >= '0' && c <= '9') + { + glyphId *= 10; + glyphId += c-'0'; + reader.ignore(1); + c = reader.peek(); + } + GlyphPropertiesEntry const* glyph = sGlyphPropertiesStore.LookupEntry(glyphId); + if (!glyph) + return false; + + linkedSpell = sSpellStore.LookupEntry(glyph->SpellId); + + if (!linkedSpell) + return false; + } + else + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage user sent unsupported link type '%s'", buffer); +#endif + return false; + } + break; + case 'h': + // if h is next element in sequence, this one must contain the linked text :) + if (*validSequenceIterator == 'h') + { + // links start with '[' + if (reader.get() != '[') + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage link caption doesn't start with '['"); +#endif + return false; + } + reader.getline(buffer, 256, ']'); + + // verify the link name + if (linkedSpell) + { + // spells with that flag have a prefix of "$PROFESSION: " + if (linkedSpell->Attributes & SPELL_ATTR_TRADESPELL) + { + // lookup skillid + SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(linkedSpell->Id); + if (bounds.first == bounds.second) + { + return false; + } + + SkillLineAbilityEntry const *skillInfo = bounds.first->second; + + if (!skillInfo) + { + return false; + } + + SkillLineEntry const *skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); + if (!skillLine) + { + return false; + } + + for (uint8 i=0; iname[i]); + if (skillLineNameLength > 0 && strncmp(skillLine->name[i], buffer, skillLineNameLength) == 0) + { + // found the prefix, remove it to perform spellname validation below + // -2 = strlen(": ") + uint32 spellNameLength = strlen(buffer)-skillLineNameLength-2; + memmove(buffer, buffer+skillLineNameLength+2, spellNameLength+1); + } + } + } + bool foundName = false; + for (uint8 i=0; iSpellName[i] && strcmp(linkedSpell->SpellName[i], buffer) == 0) + { + foundName = true; + break; + } + } + if (!foundName) + return false; + } + else if (linkedQuest) + { + if (linkedQuest->GetTitle() != buffer) + { + QuestLocale const *ql = objmgr.GetQuestLocale(linkedQuest->GetQuestId()); + + if (!ql) + { +#ifdef MANOGS_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage default questname didn't match and there is no locale"); +#endif + return false; + } + + bool foundName = false; + for (uint8 i=0; iTitle.size(); i++) + { + if (ql->Title[i] == buffer) + { + foundName = true; + break; + } + } + if (!foundName) + { +#ifdef MANOGS_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage no quest locale title matched") +#endif + return false; + } + } + } + else if (linkedItem) + { + char* const* suffix = itemSuffix?itemSuffix->nameSuffix:(itemProperty?itemProperty->nameSuffix:NULL); + + std::string expectedName = std::string(linkedItem->Name1); + if (suffix) + { + expectedName += " "; + expectedName += suffix[LOCALE_enUS]; + } + + if (expectedName != buffer) + { + ItemLocale const *il = objmgr.GetItemLocale(linkedItem->ItemId); + + bool foundName = false; + for (uint8 i=LOCALE_koKR; i= il->Name.size()) + // using strange database/client combinations can lead to this case + expectedName = linkedItem->Name1; + else + expectedName = il->Name[dbIndex]; + if (suffix) + { + expectedName += " "; + expectedName += suffix[i]; + } + if (expectedName == buffer) + { + foundName = true; + break; + } + } + if (!foundName) + { +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage linked item name wasn't found in any localization"); +#endif + return false; + } + } + } + else if (linkedAchievement) + { + bool foundName = false; + for (uint8 i=0; iname[i] && strcmp(linkedAchievement->name[i], buffer) == 0) + { + foundName = true; + break; + } + } + if (!foundName) + return false; + } + // that place should never be reached - if nothing linked has been set in |H + // it will return false before + else + return false; + } + break; + case 'r': + case '|': + // no further payload + break; + default: +#ifdef TRINITY_DEBUG + sLog.outBasic("ChatHandler::isValidChatMessage got invalid command |%c", commandChar); +#endif + return false; + } + } + + // check if every opened sequence was also closed properly +#ifdef TRINITY_DEBUG + if (validSequence != validSequenceIterator) + sLog.outBasic("ChatHandler::isValidChatMessage EOF in active sequence"); +#endif + return validSequence == validSequenceIterator; +} + +bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd) +{ + std::string list; + for (uint32 i = 0; table[i].Name != NULL; ++i) + { + // must be available (ignore handler existence for show command with possibe avalable subcomands + if (!isAvailable(table[i])) + continue; + + /// for empty subcmd show all available + if (*subcmd && !hasStringAbbr(table[i].Name, subcmd)) + continue; + + if (m_session) + list += "\n "; + else + list += "\n\r "; + + list += table[i].Name; + + if (table[i].ChildCommands) + list += " ..."; + } + + if (list.empty()) + return false; + + if (table == getCommandTable()) + { + SendSysMessage(LANG_AVIABLE_CMD); + PSendSysMessage("%s",list.c_str()); + } + else + PSendSysMessage(LANG_SUBCMDS_LIST,cmd,list.c_str()); + + return true; +} + +bool ChatHandler::ShowHelpForCommand(ChatCommand *table, const char* cmd) +{ + if (*cmd) + { + for (uint32 i = 0; table[i].Name != NULL; ++i) + { + // must be available (ignore handler existence for show command with possibe avalable subcomands + if (!isAvailable(table[i])) + continue; + + if (!hasStringAbbr(table[i].Name, cmd)) + continue; + + // have subcommand + char const* subcmd = (*cmd) ? strtok(NULL, " ") : ""; + + if (table[i].ChildCommands && subcmd && *subcmd) + { + if (ShowHelpForCommand(table[i].ChildCommands, subcmd)) + return true; + } + + if (!table[i].Help.empty()) + SendSysMessage(table[i].Help.c_str()); + + if (table[i].ChildCommands) + if (ShowHelpForSubCommands(table[i].ChildCommands,table[i].Name,subcmd ? subcmd : "")) + return true; + + return !table[i].Help.empty(); + } + } + else + { + for (uint32 i = 0; table[i].Name != NULL; ++i) + { + // must be available (ignore handler existence for show command with possibe avalable subcomands + if (!isAvailable(table[i])) + continue; + + if (strlen(table[i].Name)) + continue; + + if (!table[i].Help.empty()) + SendSysMessage(table[i].Help.c_str()); + + if (table[i].ChildCommands) + if (ShowHelpForSubCommands(table[i].ChildCommands,"","")) + return true; + + return !table[i].Help.empty(); + } + } + + return ShowHelpForSubCommands(table,"",cmd); +} + +//Note: target_guid used only in CHAT_MSG_WHISPER_INFORM mode (in this case channelName ignored) +void ChatHandler::FillMessageData(WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker) +{ + uint32 messageLength = (message ? strlen(message) : 0) + 1; + + data->Initialize(SMSG_MESSAGECHAT, 100); // guess size + *data << uint8(type); + if ((type != CHAT_MSG_CHANNEL && type != CHAT_MSG_WHISPER) || language == LANG_ADDON) + *data << uint32(language); + else + *data << uint32(LANG_UNIVERSAL); + + switch(type) + { + case CHAT_MSG_SAY: + case CHAT_MSG_PARTY: + case CHAT_MSG_PARTY_LEADER: + case CHAT_MSG_RAID: + case CHAT_MSG_GUILD: + case CHAT_MSG_OFFICER: + case CHAT_MSG_YELL: + case CHAT_MSG_WHISPER: + case CHAT_MSG_CHANNEL: + case CHAT_MSG_RAID_LEADER: + case CHAT_MSG_RAID_WARNING: + case CHAT_MSG_BG_SYSTEM_NEUTRAL: + case CHAT_MSG_BG_SYSTEM_ALLIANCE: + case CHAT_MSG_BG_SYSTEM_HORDE: + case CHAT_MSG_BATTLEGROUND: + case CHAT_MSG_BATTLEGROUND_LEADER: + target_guid = session ? session->GetPlayer()->GetGUID() : 0; + break; + case CHAT_MSG_MONSTER_SAY: + case CHAT_MSG_MONSTER_PARTY: + case CHAT_MSG_MONSTER_YELL: + case CHAT_MSG_MONSTER_WHISPER: + case CHAT_MSG_MONSTER_EMOTE: + case CHAT_MSG_RAID_BOSS_WHISPER: + case CHAT_MSG_RAID_BOSS_EMOTE: + case CHAT_MSG_BATTLENET: + { + *data << uint64(speaker->GetGUID()); + *data << uint32(0); // 2.1.0 + *data << uint32(strlen(speaker->GetName()) + 1); + *data << speaker->GetName(); + uint64 listener_guid = 0; + *data << uint64(listener_guid); + if (listener_guid && !IS_PLAYER_GUID(listener_guid)) + { + *data << uint32(1); // string listener_name_length + *data << uint8(0); // string listener_name + } + *data << uint32(messageLength); + *data << message; + *data << uint8(0); + return; + } + default: + if (type != CHAT_MSG_WHISPER_INFORM && type != CHAT_MSG_IGNORED && type != CHAT_MSG_DND && type != CHAT_MSG_AFK) + target_guid = 0; // only for CHAT_MSG_WHISPER_INFORM used original value target_guid + break; + } + + *data << uint64(target_guid); // there 0 for BG messages + *data << uint32(0); // can be chat msg group or something + + if (type == CHAT_MSG_CHANNEL) + { + ASSERT(channelName); + *data << channelName; + } + + *data << uint64(target_guid); + *data << uint32(messageLength); + *data << message; + if (session != 0 && type != CHAT_MSG_WHISPER_INFORM && type != CHAT_MSG_DND && type != CHAT_MSG_AFK) + *data << uint8(session->GetPlayer()->chatTag()); + else + *data << uint8(0); +} + +Player * ChatHandler::getSelectedPlayer() +{ + if (!m_session) + return NULL; + + uint64 guid = m_session->GetPlayer()->GetSelection(); + + if (guid == 0) + return m_session->GetPlayer(); + + return objmgr.GetPlayer(guid); +} + +Unit* ChatHandler::getSelectedUnit() +{ + if (!m_session) + return NULL; + + uint64 guid = m_session->GetPlayer()->GetSelection(); + + if (guid == 0) + return m_session->GetPlayer(); + + return ObjectAccessor::GetUnit(*m_session->GetPlayer(),guid); +} + +WorldObject *ChatHandler::getSelectedObject() +{ + if (!m_session) + return NULL; + + uint64 guid = m_session->GetPlayer()->GetSelection(); + + if (guid == 0) + return GetNearbyGameObject(); + + return ObjectAccessor::GetUnit(*m_session->GetPlayer(),guid); +} + +Creature* ChatHandler::getSelectedCreature() +{ + if (!m_session) + return NULL; + + return ObjectAccessor::GetCreatureOrPetOrVehicle(*m_session->GetPlayer(),m_session->GetPlayer()->GetSelection()); +} + +char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** something1) +{ + // skip empty + if (!text) + return NULL; + + // skip spaces + while (*text == ' '||*text == '\t'||*text == '\b') + ++text; + + if (!*text) + return NULL; + + // return non link case + if (text[0] != '|') + return strtok(text, " "); + + // [name] Shift-click form |color|linkType:key|h[name]|h|r + // or + // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r + + char* check = strtok(text, "|"); // skip color + if (!check) + return NULL; // end of data + + char* cLinkType = strtok(NULL, ":"); // linktype + if (!cLinkType) + return NULL; // end of data + + if (strcmp(cLinkType,linkType) != 0) + { + strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after retturn from function + SendSysMessage(LANG_WRONG_LINK_TYPE); + return NULL; + } + + char* cKeys = strtok(NULL, "|"); // extract keys and values + char* cKeysTail = strtok(NULL, ""); + + char* cKey = strtok(cKeys, ":|"); // extract key + if (something1) + *something1 = strtok(NULL, ":|"); // extract something + + strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces + strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function + return cKey; +} + +char* ChatHandler::extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1) +{ + // skip empty + if (!text) + return NULL; + + // skip spaces + while (*text == ' '||*text == '\t'||*text == '\b') + ++text; + + if (!*text) + return NULL; + + // return non link case + if (text[0] != '|') + return strtok(text, " "); + + // [name] Shift-click form |color|linkType:key|h[name]|h|r + // or + // [name] Shift-click form |color|linkType:key:something1:...:somethingN|h[name]|h|r + // or + // [name] Shift-click form |linkType:key|h[name]|h|r + + char* tail; + + if (text[1] == 'c') + { + char* check = strtok(text, "|"); // skip color + if (!check) + return NULL; // end of data + + tail = strtok(NULL, ""); // tail + } + else + tail = text+1; // skip first | + + char* cLinkType = strtok(tail, ":"); // linktype + if (!cLinkType) + return NULL; // end of data + + for (int i = 0; linkTypes[i]; ++i) + { + if (strcmp(cLinkType,linkTypes[i]) == 0) + { + char* cKeys = strtok(NULL, "|"); // extract keys and values + char* cKeysTail = strtok(NULL, ""); + + char* cKey = strtok(cKeys, ":|"); // extract key + if (something1) + *something1 = strtok(NULL, ":|"); // extract something + + strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces + strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function + if (found_idx) + *found_idx = i; + return cKey; + } + } + + strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function + SendSysMessage(LANG_WRONG_LINK_TYPE); + return NULL; +} + +char const *fmtstring(char const *format, ...) +{ + va_list argptr; + #define MAX_FMT_STRING 32000 + static char temp_buffer[MAX_FMT_STRING]; + static char string[MAX_FMT_STRING]; + static int index = 0; + char *buf; + int len; + + va_start(argptr, format); + vsnprintf(temp_buffer,MAX_FMT_STRING, format, argptr); + va_end(argptr); + + len = strlen(temp_buffer); + + if (len >= MAX_FMT_STRING) + return "ERROR"; + + if (len + index >= MAX_FMT_STRING-1) + { + index = 0; + } + + buf = &string[index]; + memcpy(buf, temp_buffer, len+1); + + index += len + 1; + + return buf; +} + +GameObject* ChatHandler::GetNearbyGameObject() +{ + if (!m_session) + return NULL; + + Player* pl = m_session->GetPlayer(); + GameObject* obj = NULL; + Trinity::NearestGameObjectCheck check(*pl); + Trinity::GameObjectLastSearcher searcher(pl, obj, check); + pl->VisitNearbyGridObject(999, searcher); + return obj; +} + +GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry) +{ + if (!m_session) + return NULL; + + Player* pl = m_session->GetPlayer(); + + GameObject* obj = pl->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid, entry, HIGHGUID_GAMEOBJECT)); + + if (!obj && objmgr.GetGOData(lowguid)) // guid is DB guid of object + { + // search near player then + CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + + Trinity::GameObjectWithDbGUIDCheck go_check(*pl,lowguid); + Trinity::GameObjectSearcher checker(pl,obj,go_check); + + TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); + cell.Visit(p, object_checker, *pl->GetMap()); + } + + return obj; +} + +enum SpellLinkType +{ + SPELL_LINK_SPELL = 0, + SPELL_LINK_TALENT = 1, + SPELL_LINK_ENCHANT = 2, + SPELL_LINK_TRADE = 3, + SPELL_LINK_GLYPH = 4 +}; + +static char const* const spellKeys[] = +{ + "Hspell", // normal spell + "Htalent", // talent spell + "Henchant", // enchanting recipe spell + "Htrade", // profession/skill spell + "Hglyph", // glyph + 0 +}; + +uint32 ChatHandler::extractSpellIdFromLink(char* text) +{ + // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r + // number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r + // number or [name] Shift-click form |color|Htalent:talent_id,rank|h[name]|h|r + // number or [name] Shift-click form |color|Htrade:spell_id,skill_id,max_value,cur_value|h[name]|h|r + int type = 0; + char* param1_str = NULL; + char* idS = extractKeyFromLink(text,spellKeys,&type,¶m1_str); + if (!idS) + return 0; + + uint32 id = (uint32)atol(idS); + + switch(type) + { + case SPELL_LINK_SPELL: + return id; + case SPELL_LINK_TALENT: + { + // talent + TalentEntry const* talentEntry = sTalentStore.LookupEntry(id); + if (!talentEntry) + return 0; + + int32 rank = param1_str ? (uint32)atol(param1_str) : 0; + if (rank >= MAX_TALENT_RANK) + return 0; + + if (rank < 0) + rank = 0; + + return talentEntry->RankID[rank]; + } + case SPELL_LINK_ENCHANT: + case SPELL_LINK_TRADE: + return id; + case SPELL_LINK_GLYPH: + { + uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0; + + GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id); + if (!glyphPropEntry) + return 0; + + return glyphPropEntry->SpellId; + } + } + + // unknown type? + return 0; +} + +GameTele const* ChatHandler::extractGameTeleFromLink(char* text) +{ + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r + char* cId = extractKeyFromLink(text,"Htele"); + if (!cId) + return false; + + // id case (explicit or from shift link) + if (cId[0] >= '0' || cId[0] >= '9') + if (uint32 id = atoi(cId)) + return objmgr.GetGameTele(id); + + return objmgr.GetGameTele(cId); +} + +enum GuidLinkType +{ + SPELL_LINK_PLAYER = 0, // must be first for selection in not link case + SPELL_LINK_CREATURE = 1, + SPELL_LINK_GAMEOBJECT = 2 +}; + +static char const* const guidKeys[] = +{ + "Hplayer", + "Hcreature", + "Hgameobject", + 0 +}; + +uint64 ChatHandler::extractGuidFromLink(char* text) +{ + int type = 0; + + // |color|Hcreature:creature_guid|h[name]|h|r + // |color|Hgameobject:go_guid|h[name]|h|r + // |color|Hplayer:name|h[name]|h|r + char* idS = extractKeyFromLink(text,guidKeys,&type); + if (!idS) + return 0; + + switch(type) + { + case SPELL_LINK_PLAYER: + { + std::string name = idS; + if (!normalizePlayerName(name)) + return 0; + + if (Player* player = objmgr.GetPlayer(name.c_str())) + return player->GetGUID(); + + if (uint64 guid = objmgr.GetPlayerGUIDByName(name)) + return guid; + + return 0; + } + case SPELL_LINK_CREATURE: + { + uint32 lowguid = (uint32)atol(idS); + + if (CreatureData const* data = objmgr.GetCreatureData(lowguid)) + return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_UNIT); + else + return 0; + } + case SPELL_LINK_GAMEOBJECT: + { + uint32 lowguid = (uint32)atol(idS); + + if (GameObjectData const* data = objmgr.GetGOData(lowguid)) + return MAKE_NEW_GUID(lowguid,data->id,HIGHGUID_GAMEOBJECT); + else + return 0; + } + } + + // unknown type? + return 0; +} + +std::string ChatHandler::extractPlayerNameFromLink(char* text) +{ + // |color|Hplayer:name|h[name]|h|r + char* name_str = extractKeyFromLink(text,"Hplayer"); + if (!name_str) + return ""; + + std::string name = name_str; + if (!normalizePlayerName(name)) + return ""; + + return name; +} + +bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/,std::string* player_name /*= NULL*/) +{ + if (args && *args) + { + std::string name = extractPlayerNameFromLink(args); + if (name.empty()) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + Player* pl = objmgr.GetPlayer(name.c_str()); + + // if allowed player pointer + if (player) + *player = pl; + + // if need guid value from DB (in name case for check player existence) + uint64 guid = !pl && (player_guid || player_name) ? objmgr.GetPlayerGUIDByName(name) : 0; + + // if allowed player guid (if no then only online players allowed) + if (player_guid) + *player_guid = pl ? pl->GetGUID() : guid; + + if (player_name) + *player_name = pl || guid ? name : ""; + } + else + { + Player* pl = getSelectedPlayer(); + // if allowed player pointer + if (player) + *player = pl; + // if allowed player guid (if no then only online players allowed) + if (player_guid) + *player_guid = pl ? pl->GetGUID() : 0; + + if (player_name) + *player_name = pl ? pl->GetName() : ""; + } + + // some from req. data must be provided (note: name is empty if player not exist) + if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty())) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + return true; +} + +void ChatHandler::extractOptFirstArg(char* args, char** arg1, char** arg2) +{ + char* p1 = strtok(args, " "); + char* p2 = strtok(NULL, " "); + + if (!p2) + { + p2 = p1; + p1 = NULL; + } + + if (arg1) + *arg1 = p1; + + if (arg2) + *arg2 = p2; +} + +char* ChatHandler::extractQuotedArg(char* args) +{ + if (!*args) + return NULL; + + if (*args == '"') + return strtok(args+1, "\""); + else + { + char* space = strtok(args, "\""); + if (!space) + return false; + return strtok(NULL, "\""); + } +} + +bool ChatHandler::needReportToTarget(Player* chr) const +{ + Player* pl = m_session->GetPlayer(); + return pl != chr && pl->IsVisibleGloballyFor(chr); +} + +LocaleConstant ChatHandler::GetSessionDbcLocale() const +{ + return m_session->GetSessionDbcLocale(); +} + +int ChatHandler::GetSessionDbLocaleIndex() const +{ + return m_session->GetSessionDbLocaleIndex(); +} + +const char *CliHandler::GetTrinityString(int32 entry) const +{ + return objmgr.GetTrinityStringForDBCLocale(entry); +} + +bool CliHandler::isAvailable(ChatCommand const& cmd) const +{ + // skip non-console commands in console case + return cmd.AllowConsole; +} + +void CliHandler::SendSysMessage(const char *str) +{ + m_print(str); + m_print("\r\n"); +} + +std::string CliHandler::GetNameLink() const +{ + return GetTrinityString(LANG_CONSOLE_COMMAND); +} + +bool CliHandler::needReportToTarget(Player* /*chr*/) const +{ + return true; +} + +bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline) +{ + plr = NULL; + guid = 0; + + if (cname) + { + std::string name = cname; + if (!name.empty()) + { + if (!normalizePlayerName(name)) + { + PSendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + plr = objmgr.GetPlayer(name.c_str()); + if (offline) + guid = objmgr.GetPlayerGUIDByName(name.c_str()); + } + } + + if (plr) + { + group = plr->GetGroup(); + if (!guid || !offline) + guid = plr->GetGUID(); + } + else + { + if (getSelectedPlayer()) + plr = getSelectedPlayer(); + else + plr = m_session->GetPlayer(); + + if (!guid || !offline) + guid = plr->GetGUID(); + group = plr->GetGroup(); + } + + return true; +} + +LocaleConstant CliHandler::GetSessionDbcLocale() const +{ + return sWorld.GetDefaultDbcLocale(); +} + +int CliHandler::GetSessionDbLocaleIndex() const +{ + return objmgr.GetDBCLocaleIndex(); +} diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h new file mode 100644 index 0000000..3e78e87 --- /dev/null +++ b/src/server/game/Chat/Chat.h @@ -0,0 +1,666 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITYCORE_CHAT_H +#define TRINITYCORE_CHAT_H + +#include "SharedDefines.h" + +class ChatHandler; +class WorldSession; +class Creature; +class Player; +class Unit; +struct GameTele; + +class ChatCommand +{ + public: + const char * Name; + uint32 SecurityLevel; // function pointer required correct align (use uint32) + bool AllowConsole; + bool (ChatHandler::*Handler)(const char* args); + std::string Help; + ChatCommand * ChildCommands; +}; + +class ChatHandler +{ + public: + explicit ChatHandler(WorldSession* session) : m_session(session) {} + explicit ChatHandler(Player* player) : m_session(player->GetSession()) {} + ~ChatHandler() {} + + static void FillMessageData(WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker); + + void FillMessageData(WorldPacket *data, uint8 type, uint32 language, uint64 target_guid, const char* message) + { + FillMessageData(data, m_session, type, language, NULL, target_guid, message, NULL); + } + + void FillSystemMessageData(WorldPacket *data, const char* message) + { + FillMessageData(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, message); + } + + static char* LineFromMessage(char*& pos) { char* start = strtok(pos,"\n"); pos = NULL; return start; } + + // function with different implementation for chat/console + virtual const char *GetTrinityString(int32 entry) const; + virtual void SendSysMessage(const char *str); + + void SendSysMessage(int32 entry); + void PSendSysMessage(const char *format, ...) ATTR_PRINTF(2,3); + void PSendSysMessage(int32 entry, ...); + std::string PGetParseString(int32 entry, ...); + + int ParseCommands(const char* text); + + static ChatCommand* getCommandTable(); + + bool isValidChatMessage(const char* msg); + void SendGlobalSysMessage(const char *str); + protected: + explicit ChatHandler() : m_session(NULL) {} // for CLI subclass + + bool hasStringAbbr(const char* name, const char* part); + + // function with different implementation for chat/console + virtual bool isAvailable(ChatCommand const& cmd) const; + virtual std::string GetNameLink() const { return GetNameLink(m_session->GetPlayer()); } + virtual bool needReportToTarget(Player* chr) const; + virtual LocaleConstant GetSessionDbcLocale() const; + virtual int GetSessionDbLocaleIndex() const; + + bool HasLowerSecurity(Player* target, uint64 guid, bool strong = false); + bool HasLowerSecurityAccount(WorldSession* target, uint32 account, bool strong = false); + + void SendGlobalGMSysMessage(const char *str); + + static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand); + bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcommand); + bool ShowHelpForCommand(ChatCommand *table, const char* cmd); + bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd); + + bool HandleAccountCommand(const char* args); + bool HandleAccountAddonCommand(const char* args); + bool HandleAccountCreateCommand(const char* args); + bool HandleAccountDeleteCommand(const char* args); + bool HandleAccountLockCommand(const char* args); + bool HandleAccountOnlineListCommand(const char* args); + bool HandleAccountPasswordCommand(const char* args); + bool HandleAccountSetAddonCommand(const char* args); + bool HandleAccountSetGmLevelCommand(const char* args); + bool HandleAccountSetPasswordCommand(const char* args); + + bool HandleAHBotOptionsCommand(const char * args); + bool HandleNameAnnounceCommand(const char* args); + bool HandleGMNameAnnounceCommand(const char* args); + bool HandleGMAnnounceCommand(const char* args); + bool HandleGMNotifyCommand(const char* args); + + bool HandleBanAccountCommand(const char* args); + bool HandleBanCharacterCommand(const char* args); + bool HandleBanIPCommand(const char* args); + bool HandleBanInfoAccountCommand(const char* args); + bool HandleBanInfoCharacterCommand(const char* args); + bool HandleBanInfoIPCommand(const char* args); + bool HandleBanListAccountCommand(const char* args); + bool HandleBanListCharacterCommand(const char* args); + bool HandleBanListIPCommand(const char* args); + + bool HandleCastCommand(const char *args); + bool HandleCastBackCommand(const char *args); + bool HandleCastDistCommand(const char *args); + bool HandleCastSelfCommand(const char *args); + bool HandleCastTargetCommand(const char *args); + + bool HandleCharacterCustomizeCommand(const char * args); + bool HandleCharacterChangeFactionCommand(const char* args); + bool HandleCharacterChangeRaceCommand(const char* args); + bool HandleCharacterDeleteCommand(const char* args); + bool HandleCharacterLevelCommand(const char* args); + bool HandleCharacterRenameCommand(const char * args); + bool HandleCharacterReputationCommand(const char* args); + bool HandleCharacterTitlesCommand(const char* args); + + bool HandleChannelSetPublic(const char *args); + + bool HandleDebugAnimCommand(const char* args); + bool HandleDebugArenaCommand(const char * args); + bool HandleDebugBattlegroundCommand(const char * args); + bool HandleDebugGetItemStateCommand(const char * args); + bool HandleDebugGetLootRecipientCommand(const char * args); + bool HandleDebugGetValueCommand(const char* args); + bool HandleDebugGetItemValueCommand(const char* args); + bool HandleDebugMod32ValueCommand(const char* args); + bool HandleDebugSetAuraStateCommand(const char * args); + bool HandleDebugSetItemValueCommand(const char * args); + bool HandleDebugItemExpireCommand(const char * args); + bool HandleDebugSetVehicleId(const char * args); + bool HandleDebugEnterVehicle(const char * args); + bool HandleDebugSetValueCommand(const char* args); + bool HandleDebugSpawnVehicle(const char * args); + bool HandleDebugSpellCheckCommand(const char* args); + bool HandleDebugUpdateCommand(const char* args); + bool HandleDebugUpdateWorldStateCommand(const char* args); + + bool HandleDebugSet32Bit(const char* args); + bool HandleDebugThreatList(const char * args); + bool HandleDebugHostileRefList(const char * args); + bool HandlePossessCommand(const char* args); + bool HandleUnPossessCommand(const char* args); + bool HandleBindSightCommand(const char* args); + bool HandleUnbindSightCommand(const char* args); + + bool HandleDebugPlayCinematicCommand(const char* args); + bool HandleDebugPlayMovieCommand(const char* args); + bool HandleDebugPlaySoundCommand(const char* args); + + bool HandleDebugSendBuyErrorCommand(const char* args); + bool HandleDebugSendChannelNotifyCommand(const char* args); + bool HandleDebugSendChatMsgCommand(const char* args); + bool HandleDebugSendEquipErrorCommand(const char* args); + bool HandleDebugSendLargePacketCommand(const char * args); + bool HandleDebugSendOpcodeCommand(const char* args); + bool HandleDebugSendPoiCommand(const char* args); + bool HandleDebugSendQuestPartyMsgCommand(const char* args); + bool HandleDebugSendQuestInvalidMsgCommand(const char* args); + bool HandleDebugSendSellErrorCommand(const char* args); + bool HandleDebugSendSetPhaseShiftCommand(const char * args); + bool HandleDebugSendSpellFailCommand(const char* args); + + bool HandleEventActiveListCommand(const char* args); + bool HandleEventStartCommand(const char* args); + bool HandleEventStopCommand(const char* args); + bool HandleEventInfoCommand(const char* args); + + bool HandleGameObjectAddCommand(const char* args); + bool HandleGameObjectDeleteCommand(const char* args); + bool HandleGOInfoCommand(const char* args); + bool HandleGameObjectMoveCommand(const char* args); + bool HandleGameObjectNearCommand(const char* args); + bool HandleGameObjectPhaseCommand(const char* args); + bool HandleGameObjectStateCommand(const char* args); + bool HandleGameObjectTargetCommand(const char* args); + bool HandleGameObjectTurnCommand(const char* args); + + bool HandleGMCommand(const char* args); + bool HandleGMChatCommand(const char* args); + bool HandleGMFlyCommand(const char* args); + bool HandleGMListFullCommand(const char* args); + bool HandleGMListIngameCommand(const char* args); + bool HandleGMVisibleCommand(const char* args); + + bool HandleGoCommand(const char* args); + bool HandleGoCreatureCommand(const char* args); + bool HandleGoGraveyardCommand(const char* args); + bool HandleGoGridCommand(const char* args); + bool HandleGoObjectCommand(const char* args); + bool HandleGoTaxinodeCommand(const char* args); + bool HandleGoTriggerCommand(const char* args); + bool HandleGoXYCommand(const char* args); + bool HandleGoXYZCommand(const char* args); + bool HandleGoZoneXYCommand(const char* args); + + bool HandleGoTicketCommand(const char* args); + + bool HandleGuildCreateCommand(const char* args); + bool HandleGuildInviteCommand(const char* args); + bool HandleGuildUninviteCommand(const char* args); + bool HandleGuildRankCommand(const char* args); + bool HandleGuildDeleteCommand(const char* args); + + bool HandleHonorAddCommand(const char* args); + bool HandleHonorAddKillCommand(const char* args); + bool HandleHonorUpdateCommand(const char* args); + + bool HandleInstanceListBindsCommand(const char* args); + bool HandleInstanceUnbindCommand(const char* args); + bool HandleInstanceStatsCommand(const char* args); + bool HandleInstanceSaveDataCommand(const char * args); + bool HandleInstanceOpenCommand(const char * args); + bool HandleInstanceCloseCommand(const char * args); + bool HandleInstanceOpenCloseCommand(const char * args, bool open); + + bool HandleLearnCommand(const char* args); + bool HandleLearnAllCommand(const char* args); + bool HandleLearnAllGMCommand(const char* args); + bool HandleLearnAllCraftsCommand(const char* args); + bool HandleLearnAllRecipesCommand(const char* args); + bool HandleLearnAllDefaultCommand(const char* args); + bool HandleLearnAllLangCommand(const char* args); + bool HandleLearnAllMyClassCommand(const char* args); + bool HandleLearnAllMyPetTalentsCommand(const char* args); + bool HandleLearnAllMySpellsCommand(const char* args); + bool HandleLearnAllMyTalentsCommand(const char* args); + + bool HandleListAurasCommand(const char * args); + bool HandleListCreatureCommand(const char* args); + bool HandleListItemCommand(const char* args); + bool HandleListObjectCommand(const char* args); + + bool HandleLookupAreaCommand(const char* args); + bool HandleLookupCreatureCommand(const char* args); + bool HandleLookupEventCommand(const char* args); + bool HandleLookupFactionCommand(const char * args); + bool HandleLookupItemCommand(const char * args); + bool HandleLookupItemSetCommand(const char * args); + bool HandleLookupObjectCommand(const char* args); + bool HandleLookupPlayerIpCommand(const char* args); + bool HandleLookupPlayerAccountCommand(const char* args); + bool HandleLookupPlayerEmailCommand(const char* args); + bool HandleLookupQuestCommand(const char* args); + bool HandleLookupSkillCommand(const char* args); + bool HandleLookupSpellCommand(const char* args); + bool HandleLookupTaxiNodeCommand(const char * args); + bool HandleLookupTeleCommand(const char * args); + bool HandleLookupMapCommand(const char* args); + bool HandleLookupTitleCommand(const char * args); + + bool HandleModifyHPCommand(const char* args); + bool HandleModifyManaCommand(const char* args); + bool HandleModifyRageCommand(const char* args); + bool HandleModifyRunicPowerCommand(const char* args); + bool HandleModifyEnergyCommand(const char* args); + bool HandleModifyMoneyCommand(const char* args); + bool HandleModifyASpeedCommand(const char* args); + bool HandleModifySpeedCommand(const char* args); + bool HandleModifyBWalkCommand(const char* args); + bool HandleModifyFlyCommand(const char* args); + bool HandleModifySwimCommand(const char* args); + bool HandleModifyScaleCommand(const char* args); + bool HandleModifyMountCommand(const char* args); + bool HandleModifyBitCommand(const char* args); + bool HandleModifyFactionCommand(const char* args); + bool HandleModifySpellCommand(const char* args); + bool HandleModifyTalentCommand (const char* args); + bool HandleModifyHonorCommand (const char* args); + bool HandleModifyRepCommand(const char* args); + bool HandleModifyArenaCommand(const char* args); + bool HandleModifyPhaseCommand(const char* args); + bool HandleModifyGenderCommand(const char* args); + + //-----------------------Npc Commands----------------------- + bool HandleNpcAddCommand(const char* args); + bool HandleNpcAddMoveCommand(const char* args); + bool HandleNpcAddVendorItemCommand(const char* args); + bool HandleNpcAllowMovementCommand(const char* args); + bool HandleNpcChangeEntryCommand(const char *args); + bool HandleNpcChangeLevelCommand(const char* args); + bool HandleNpcDeleteCommand(const char* args); + bool HandleNpcDelVendorItemCommand(const char* args); + bool HandleNpcFactionIdCommand(const char* args); + bool HandleNpcFlagCommand(const char* args); + bool HandleNpcFollowCommand(const char* args); + bool HandleNpcInfoCommand(const char* args); + bool HandleNpcMoveCommand(const char* args); + bool HandleNpcPlayEmoteCommand(const char* args); + bool HandleNpcSayCommand(const char* args); + bool HandleNpcSetDeathStateCommand(const char* args); + bool HandleNpcSetModelCommand(const char* args); + bool HandleNpcSetMoveTypeCommand(const char* args); + bool HandleNpcSetPhaseCommand(const char* args); + bool HandleNpcSpawnDistCommand(const char* args); + bool HandleNpcSpawnTimeCommand(const char* args); + bool HandleNpcTameCommand(const char* args); + bool HandleNpcTextEmoteCommand(const char* args); + bool HandleNpcUnFollowCommand(const char* args); + bool HandleNpcWhisperCommand(const char* args); + bool HandleNpcYellCommand(const char* args); + bool HandleNpcAddFormationCommand(const char* args); + bool HandleNpcSetLinkCommand(const char* args); + + //TODO: NpcCommands that needs to be fixed : + bool HandleNpcAddWeaponCommand(const char* args); + bool HandleNpcNameCommand(const char* args); + bool HandleNpcSubNameCommand(const char* args); + //---------------------------------------------------------- + + bool HandlePDumpLoadCommand(const char *args); + bool HandlePDumpWriteCommand(const char *args); + + bool HandleQuestAdd(const char * args); + bool HandleQuestRemove(const char * args); + bool HandleQuestComplete(const char * args); + + bool HandleReloadAllCommand(const char* args); + bool HandleReloadAllAchievementCommand(const char* args); + bool HandleReloadAllAreaCommand(const char* args); + bool HandleReloadAllItemCommand(const char* args); + bool HandleReloadAllLootCommand(const char* args); + bool HandleReloadAllNpcCommand(const char* args); + bool HandleReloadAllQuestCommand(const char* args); + bool HandleReloadAllScriptsCommand(const char* args); + bool HandleReloadAllEventAICommand(const char* args); + bool HandleReloadAllSpellCommand(const char* args); + bool HandleReloadAllLocalesCommand(const char* args); + + bool HandleReloadConfigCommand(const char* args); + + bool HandleReloadAccessRequirementCommand(const char* args); + bool HandleReloadAchievementCriteriaDataCommand(const char* args); + bool HandleReloadAchievementRewardCommand(const char* args); + bool HandleReloadAreaTriggerTavernCommand(const char* args); + bool HandleReloadAreaTriggerTeleportCommand(const char* args); + bool HandleReloadAutobroadcastCommand(const char* args); + bool HandleReloadEventScriptsCommand(const char* args); + bool HandleReloadEventAITextsCommand(const char* args); + bool HandleReloadEventAISummonsCommand(const char* args); + bool HandleReloadEventAIScriptsCommand(const char* args); + bool HandleReloadCommandCommand(const char* args); + bool HandleReloadOnKillReputationCommand(const char* args); + bool HandleReloadCreatureTemplateCommand(const char* args); + bool HandleReloadCreatureQuestRelationsCommand(const char* args); + bool HandleReloadCreatureQuestInvRelationsCommand(const char* args); + bool HandleReloadCreatureLinkedRespawnCommand(const char* args); + bool HandleReloadDbScriptStringCommand(const char* args); + bool HandleReloadGameGraveyardZoneCommand(const char* args); + bool HandleReloadGameObjectScriptsCommand(const char* args); + bool HandleReloadGameTeleCommand(const char* args); + bool HandleReloadGossipMenuCommand(const char* args); + bool HandleReloadGossipMenuOptionCommand(const char* args); + bool HandleReloadGOQuestRelationsCommand(const char* args); + bool HandleReloadGOQuestInvRelationsCommand(const char* args); + bool HandleReloadItemEnchantementsCommand(const char* args); + bool HandleReloadItemSetNamesCommand(const char* args); + bool HandleReloadLocalesAchievementRewardCommand(const char* args); + bool HandleReloadLocalesCreatureCommand(const char* args); + bool HandleReloadLocalesGameobjectCommand(const char* args); + bool HandleReloadLocalesItemCommand(const char* args); + bool HandleReloadLocalesItemSetNameCommand(const char* args); + bool HandleReloadLocalesNpcTextCommand(const char* args); + bool HandleReloadLocalesPageTextCommand(const char* args); + bool HandleReloadLocalesPointsOfInterestCommand(const char* args); + bool HandleReloadLocalesQuestCommand(const char* args); +// bool HandleReloadAuctionsCommand(const char* args); + bool HandleReloadLootTemplatesCreatureCommand(const char* args); + bool HandleReloadLootTemplatesDisenchantCommand(const char* args); + bool HandleReloadLootTemplatesFishingCommand(const char* args); + bool HandleReloadLootTemplatesGameobjectCommand(const char* args); + bool HandleReloadLootTemplatesItemCommand(const char* args); + bool HandleReloadLootTemplatesMailCommand(const char* args); + bool HandleReloadMailLevelRewardCommand(const char* args); + bool HandleReloadLootTemplatesMillingCommand(const char* args); + bool HandleReloadLootTemplatesPickpocketingCommand(const char* args); + bool HandleReloadLootTemplatesProspectingCommand(const char* args); + bool HandleReloadLootTemplatesReferenceCommand(const char* args); + bool HandleReloadLootTemplatesSkinningCommand(const char* args); + bool HandleReloadLootTemplatesSpellCommand(const char* args); + bool HandleReloadTrinityStringCommand(const char* args); + bool HandleReloadNpcGossipCommand(const char* args); + bool HandleReloadNpcTrainerCommand(const char* args); + bool HandleReloadNpcVendorCommand(const char* args); + bool HandleReloadPageTextsCommand(const char* args); + bool HandleReloadPointsOfInterestCommand(const char* args); + bool HandleReloadSpellClickSpellsCommand(const char* args); + bool HandleReloadQuestAreaTriggersCommand(const char* args); + bool HandleReloadQuestEndScriptsCommand(const char* args); + bool HandleReloadQuestStartScriptsCommand(const char* args); + bool HandleReloadQuestTemplateCommand(const char* args); + bool HandleReloadReservedNameCommand(const char*); + bool HandleReloadSkillDiscoveryTemplateCommand(const char* args); + bool HandleReloadSkillExtraItemTemplateCommand(const char* args); + bool HandleReloadSkillFishingBaseLevelCommand(const char* args); + bool HandleReloadSpellRequiredCommand(const char* args); + bool HandleReloadSpellAreaCommand(const char* args); + bool HandleReloadSpellGroupsCommand(const char* args); + bool HandleReloadSpellLearnSpellCommand(const char* args); + bool HandleReloadSpellLinkedSpellCommand(const char* args); + bool HandleReloadSpellProcEventCommand(const char* args); + bool HandleReloadSpellBonusesCommand(const char* args); + bool HandleReloadSpellScriptsCommand(const char* args); + bool HandleReloadSpellTargetPositionCommand(const char* args); + bool HandleReloadSpellThreatsCommand(const char* args); + bool HandleReloadSpellPetAurasCommand(const char* args); + bool HandleReloadSpellDisabledCommand(const char* args); + bool HandleReloadSpellGroupStackRulesCommand(const char* args); + bool HandleReloadAuctionsCommand(const char* args); + bool HandleReloadWpScriptsCommand(const char* args); + bool HandleReloadConditions(const char* args); + + bool HandleResetAchievementsCommand(const char * args); + bool HandleResetAllCommand(const char * args); + bool HandleResetHonorCommand(const char * args); + bool HandleResetLevelCommand(const char * args); + bool HandleResetSpellsCommand(const char * args); + bool HandleResetStatsCommand(const char * args); + bool HandleResetTalentsCommand(const char * args); + + bool HandleSendItemsCommand(const char* args); + bool HandleSendMailCommand(const char* args); + bool HandleSendMessageCommand(const char * args); + bool HandleSendMoneyCommand(const char* args); + + bool HandleServerCorpsesCommand(const char* args); + bool HandleServerExitCommand(const char* args); + bool HandleServerIdleRestartCommand(const char* args); + bool HandleServerIdleShutDownCommand(const char* args); + bool HandleServerInfoCommand(const char* args); + bool HandleServerMotdCommand(const char* args); + bool HandleServerPLimitCommand(const char* args); + bool HandleServerRestartCommand(const char* args); + bool HandleServerSetLogLevelCommand(const char* args); + bool HandleServerSetMotdCommand(const char* args); + bool HandleServerShutDownCommand(const char* args); + bool HandleServerShutDownCancelCommand(const char* args); + bool HandleServerSetClosedCommand(const char* args); + + bool HandleServerSetLogFileLevelCommand(const char* args); + bool HandleServerSetDiffTimeCommand(const char* args); + + bool HandleTeleCommand(const char * args); + bool HandleTeleAddCommand(const char * args); + bool HandleTeleDelCommand(const char * args); + bool HandleTeleGroupCommand(const char* args); + bool HandleTeleNameCommand(const char* args); + + bool HandleTitlesAddCommand(const char* args); + bool HandleTitlesCurrentCommand(const char* args); + bool HandleTitlesRemoveCommand(const char* args); + bool HandleTitlesSetMaskCommand(const char* args); + + bool HandleUnBanAccountCommand(const char* args); + bool HandleUnBanCharacterCommand(const char* args); + bool HandleUnBanIPCommand(const char* args); + + bool HandleWpAddCommand(const char* args); + bool HandleWpLoadPathCommand(const char* args); + bool HandleWpUnLoadPathCommand(const char* args); + bool HandleWpModifyCommand(const char* args); + bool HandleWpEventCommand(const char* args); + bool HandleWpShowCommand(const char* args); + bool HandleReloadAllPaths(const char *args); + + bool HandleWintergraspStatusCommand(const char *args); + bool HandleWintergraspStartCommand(const char *args); + bool HandleWintergraspStopCommand(const char *args); + bool HandleWintergraspEnableCommand(const char *args); + bool HandleWintergraspSwitchTeamCommand(const char *args); + bool HandleWintergraspTimerCommand(const char *args); + + bool HandleHelpCommand(const char* args); + bool HandleCommandsCommand(const char* args); + bool HandleStartCommand(const char* args); + bool HandleDismountCommand(const char* args); + bool HandleSaveCommand(const char* args); + + bool HandleNamegoCommand(const char* args); + bool HandleGonameCommand(const char* args); + bool HandleGroupgoCommand(const char* args); + bool HandleRecallCommand(const char* args); + bool HandleAnnounceCommand(const char* args); + bool HandleNotifyCommand(const char* args); + bool HandleGPSCommand(const char* args); + bool HandleTaxiCheatCommand(const char* args); + bool HandleWhispersCommand(const char* args); + bool HandleModifyDrunkCommand(const char* args); + + bool HandleGUIDCommand(const char* args); + bool HandleItemMoveCommand(const char* args); + bool HandleDeMorphCommand(const char* args); + bool HandlePInfoCommand(const char* args); + bool HandleMuteCommand(const char* args); + bool HandleUnmuteCommand(const char* args); + bool HandleMovegensCommand(const char* args); + bool HandleFreezeCommand(const char *args); + bool HandleUnFreezeCommand(const char *args); + bool HandleListFreezeCommand(const char* args); + + bool HandleCooldownCommand(const char* args); + bool HandleUnLearnCommand(const char* args); + bool HandleGetDistanceCommand(const char* args); + bool HandleModifyStandStateCommand(const char* args); + bool HandleDieCommand(const char* args); + bool HandleDamageCommand(const char *args); + bool HandleReviveCommand(const char* args); + bool HandleModifyMorphCommand(const char* args); + bool HandleAuraCommand(const char* args); + bool HandleUnAuraCommand(const char* args); + bool HandleLinkGraveCommand(const char* args); + bool HandleNearGraveCommand(const char* args); + bool HandleActivateObjectCommand(const char* args); + bool HandleSpawnTransportCommand(const char* args); + bool HandleExploreCheatCommand(const char* args); + bool HandleHoverCommand(const char* args); + bool HandleWaterwalkCommand(const char* args); + bool HandleLevelUpCommand(const char* args); + bool HandleShowAreaCommand(const char* args); + bool HandleHideAreaCommand(const char* args); + bool HandleAddItemCommand(const char* args); + bool HandleAddItemSetCommand(const char* args); + bool HandlePetTpCommand(const char* args); + bool HandlePetUnlearnCommand(const char* args); + bool HandlePetLearnCommand(const char* args); + bool HandleCreatePetCommand(const char* args); + + bool HandleGroupLeaderCommand(const char* args); + bool HandleGroupDisbandCommand(const char* args); + bool HandleGroupRemoveCommand(const char* args); + + bool HandleBankCommand(const char* args); + bool HandleChangeWeather(const char* args); + bool HandleKickPlayerCommand(const char * args); + + // GM ticket command handlers + bool HandleGMTicketListCommand(const char* args); + bool HandleGMTicketListOnlineCommand(const char* args); + bool HandleGMTicketListClosedCommand(const char* args); + bool HandleGMTicketGetByIdCommand(const char* args); + bool HandleGMTicketGetByNameCommand(const char* args); + bool HandleGMTicketCloseByIdCommand(const char* args); + bool HandleGMTicketAssignToCommand(const char* args); + bool HandleGMTicketUnAssignCommand(const char* args); + bool HandleGMTicketCommentCommand(const char* args); + bool HandleGMTicketDeleteByIdCommand(const char* args); + bool HandleGMTicketReloadCommand(const char*); + + bool HandleMaxSkillCommand(const char* args); + bool HandleSetSkillCommand(const char* args); + bool HandleRespawnCommand(const char* args); + bool HandleComeToMeCommand(const char *args); + bool HandleCombatStopCommand(const char *args); + + /*bool HandleCharDeleteCommand(const char *args); + bool HandleSendMessageCommand(const char * args);*/ + + bool HandleFlushArenaPointsCommand(const char *args); + bool HandlePlayAllCommand(const char* args); + bool HandleRepairitemsCommand(const char* args); + + bool HandleTempGameObjectCommand(const char* args); + bool HandleTempAddSpwCommand(const char* args); + + //! Development Commands + + /*bool HandleQuestAdd(const char * args); + bool HandleQuestRemove(const char * args); + bool HandleQuestComplete(const char * args);*/ + + //bool HandleSet32Bit(const char* args); + bool HandleSaveAllCommand(const char* args); + + Player* getSelectedPlayer(); + Creature* getSelectedCreature(); + Unit* getSelectedUnit(); + WorldObject* getSelectedObject(); + + char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL); + char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL); + + // if args have single value then it return in arg2 and arg1 == NULL + void extractOptFirstArg(char* args, char** arg1, char** arg2); + char* extractQuotedArg(char* args); + + uint32 extractSpellIdFromLink(char* text); + uint64 extractGuidFromLink(char* text); + GameTele const* extractGameTeleFromLink(char* text); + bool GetPlayerGroupAndGUIDByName(const char* cname, Player* &plr, Group* &group, uint64 &guid, bool offline = false); + std::string extractPlayerNameFromLink(char* text); + // select by arg (name/link) or in-game selection online/offline player + bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL); + + std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; } + std::string GetNameLink(Player* chr) const { return playerLink(chr->GetName()); } + + GameObject* GetNearbyGameObject(); + GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry); + + // Utility methods for commands + bool LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit); + bool HandleBanListHelper(QueryResult_AutoPtr result); + bool HandleBanHelper(BanMode mode,char const* args); + bool HandleBanInfoHelper(uint32 accountid, char const* accountname); + bool HandleUnBanHelper(BanMode mode,char const* args); + void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel); + void HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id); + + void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; + private: + WorldSession * m_session; // != NULL for chat command call and NULL for CLI command + + // common global flag + static bool load_command_table; + bool sentErrorMessage; +}; + +class CliHandler : public ChatHandler +{ + public: + typedef void Print(char const*); + explicit CliHandler(Print* zprint) : m_print(zprint) {} + + // overwrite functions + const char *GetTrinityString(int32 entry) const; + bool isAvailable(ChatCommand const& cmd) const; + void SendSysMessage(const char *str); + std::string GetNameLink() const; + bool needReportToTarget(Player* chr) const; + LocaleConstant GetSessionDbcLocale() const; + int GetSessionDbLocaleIndex() const; + + private: + Print* m_print; +}; + +char const *fmtstring(char const *format, ...); + +#endif + diff --git a/src/server/game/Chat/Commands/Debugcmds.cpp b/src/server/game/Chat/Commands/Debugcmds.cpp new file mode 100644 index 0000000..a6c973e --- /dev/null +++ b/src/server/game/Chat/Commands/Debugcmds.cpp @@ -0,0 +1,1127 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "DatabaseEnv.h" +#include "WorldPacket.h" +#include "Vehicle.h" +#include "Player.h" +#include "Opcodes.h" +#include "Chat.h" +#include "Log.h" +#include "Unit.h" +#include "GossipDef.h" +#include "Language.h" +#include "BattleGroundMgr.h" +#include +#include "ObjectMgr.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "SpellMgr.h" +#include "ScriptMgr.h" + +bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args) +{ + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + if (!px) + return false; + + uint8 failnum = (uint8)atoi(px); + if (failnum == 0 && *px != '0') + return false; + + char* p1 = strtok(NULL, " "); + uint8 failarg1 = p1 ? (uint8)atoi(p1) : 0; + + char* p2 = strtok(NULL, " "); + uint8 failarg2 = p2 ? (uint8)atoi(p2) : 0; + + WorldPacket data(SMSG_CAST_FAILED, 5); + data << uint8(0); + data << uint32(133); + data << uint8(failnum); + if (p1 || p2) + data << uint32(failarg1); + if (p2) + data << uint32(failarg2); + + m_session->SendPacket(&data); + + return true; +} + +bool ChatHandler::HandleDebugSendPoiCommand(const char* args) +{ + if (!*args) + return false; + + Player *pPlayer = m_session->GetPlayer(); + Unit* target = getSelectedUnit(); + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + return true; + } + + char* icon_text = strtok((char*)args, " "); + char* flags_text = strtok(NULL, " "); + if (!icon_text || !flags_text) + return false; + + uint32 icon = atol(icon_text); + uint32 flags = atol(flags_text); + + sLog.outDetail("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon,flags); + pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI"); + return true; +} + +bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args) +{ + if (!*args) + return false; + + uint8 msg = atoi(args); + m_session->GetPlayer()->SendEquipError(msg, 0, 0); + return true; +} + +bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args) +{ + if (!*args) + return false; + + uint8 msg = atoi(args); + m_session->GetPlayer()->SendSellError(msg, 0, 0, 0); + return true; +} + +bool ChatHandler::HandleDebugSendBuyErrorCommand(const char* args) +{ + if (!*args) + return false; + + uint8 msg = atoi(args); + m_session->GetPlayer()->SendBuyError(msg, 0, 0, 0); + return true; +} + +bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/) +{ + Unit *unit = getSelectedUnit(); + Player *player = NULL; + if (!unit || (unit->GetTypeId() != TYPEID_PLAYER)) + player = m_session->GetPlayer(); + else + player = (Player*)unit; + if (!unit) unit = player; + + std::ifstream ifs("opcode.txt"); + if (ifs.bad()) + return false; + + uint32 opcode; + ifs >> opcode; + + WorldPacket data(opcode, 0); + + while (!ifs.eof()) + { + std::string type; + ifs >> type; + + if (type == "") + break; + + if (type == "uint8") + { + uint16 val1; + ifs >> val1; + data << uint8(val1); + } + else if (type == "uint16") + { + uint16 val2; + ifs >> val2; + data << val2; + } + else if (type == "uint32") + { + uint32 val3; + ifs >> val3; + data << val3; + } + else if (type == "uint64") + { + uint64 val4; + ifs >> val4; + data << val4; + } + else if (type == "float") + { + float val5; + ifs >> val5; + data << val5; + } + else if (type == "string") + { + std::string val6; + ifs >> val6; + data << val6; + } + else if (type == "appitsguid") + { + data.append(unit->GetPackGUID()); + } + else if (type == "appmyguid") + { + data.append(player->GetPackGUID()); + } + else if (type == "appgoguid") + { + GameObject *obj = GetNearbyGameObject(); + if (!obj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0); + SetSentErrorMessage(true); + ifs.close(); + return false; + } + data.append(obj->GetPackGUID()); + } + else if (type == "goguid") + { + GameObject *obj = GetNearbyGameObject(); + if (!obj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, 0); + SetSentErrorMessage(true); + ifs.close(); + return false; + } + data << uint64(obj->GetGUID()); + } + else if (type == "myguid") + { + data << uint64(player->GetGUID()); + } + else if (type == "itsguid") + { + data << uint64(unit->GetGUID()); + } + else if (type == "pos") + { + data << unit->GetPositionX(); + data << unit->GetPositionY(); + data << unit->GetPositionZ(); + } + else if (type == "mypos") + { + data << player->GetPositionX(); + data << player->GetPositionY(); + data << player->GetPositionZ(); + } + else + { + sLog.outDebug("Sending opcode: unknown type '%s'", type.c_str()); + break; + } + } + ifs.close(); + sLog.outDebug("Sending opcode %u", data.GetOpcode()); + data.hexlike(); + player->GetSession()->SendPacket(&data); + PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName()); + return true; +} + +bool ChatHandler::HandleDebugUpdateWorldStateCommand(const char* args) +{ + char* w = strtok((char*)args, " "); + char* s = strtok(NULL, " "); + + if (!w || !s) + return false; + + uint32 world = (uint32)atoi(w); + uint32 state = (uint32)atoi(s); + m_session->GetPlayer()->SendUpdateWorldState(world, state); + return true; +} + +bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args) +{ + // USAGE: .debug play cinematic #cinematicid + // #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column) + if (!*args) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + uint32 dwId = atoi((char*)args); + + if (!sCinematicSequencesStore.LookupEntry(dwId)) + { + PSendSysMessage(LANG_CINEMATIC_NOT_EXIST, dwId); + SetSentErrorMessage(true); + return false; + } + + m_session->GetPlayer()->SendCinematicStart(dwId); + return true; +} + +bool ChatHandler::HandleDebugPlayMovieCommand(const char* args) +{ + // USAGE: .debug play movie #movieid + // #movieid - ID decimal number from Movie.dbc (1st column) + if (!*args) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + uint32 dwId = atoi((char*)args); + + if (!sMovieStore.LookupEntry(dwId)) + { + PSendSysMessage(LANG_MOVIE_NOT_EXIST, dwId); + SetSentErrorMessage(true); + return false; + } + + m_session->GetPlayer()->SendMovieStart(dwId); + return true; +} + +//Play sound +bool ChatHandler::HandleDebugPlaySoundCommand(const char* args) +{ + // USAGE: .debug playsound #soundid + // #soundid - ID decimal number from SoundEntries.dbc (1st column) + if (!*args) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + uint32 dwSoundId = atoi((char*)args); + + if (!sSoundEntriesStore.LookupEntry(dwSoundId)) + { + PSendSysMessage(LANG_SOUND_NOT_EXIST, dwSoundId); + SetSentErrorMessage(true); + return false; + } + + Unit* unit = getSelectedUnit(); + if (!unit) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (m_session->GetPlayer()->GetSelection()) + unit->PlayDistanceSound(dwSoundId,m_session->GetPlayer()); + else + unit->PlayDirectSound(dwSoundId,m_session->GetPlayer()); + + PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId); + return true; +} + +//Send notification in channel +bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args) +{ + if (!*args) + return false; + + const char *name = "test"; + uint8 code = atoi(args); + + WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10)); + data << code; // notify type + data << name; // channel name + data << uint32(0); + data << uint32(0); + m_session->SendPacket(&data); + return true; +} + +//Send notification in chat +bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args) +{ + if (!*args) + return false; + + const char *msg = "testtest"; + uint8 type = atoi(args); + WorldPacket data; + ChatHandler::FillMessageData(&data, m_session, type, 0, "chan", m_session->GetPlayer()->GetGUID(), msg, m_session->GetPlayer()); + m_session->SendPacket(&data); + return true; +} + +bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(const char* args) +{ + uint32 msg = atol((char*)args); + m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg); + return true; +} + +bool ChatHandler::HandleDebugGetLootRecipientCommand(const char* /*args*/) +{ + Creature* target = getSelectedCreature(); + if (!target) + return false; + + PSendSysMessage("loot recipient: %s", target->hasLootRecipient()?(target->GetLootRecipient()?target->GetLootRecipient()->GetName():"offline"):"no loot recipient"); + return true; +} + +bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(const char* args) +{ + uint32 msg = atol((char*)args); + m_session->GetPlayer()->SendCanTakeQuestResponse(msg); + return true; +} + +bool ChatHandler::HandleDebugGetItemStateCommand(const char* args) +{ + if (!*args) + return false; + + std::string state_str = args; + + ItemUpdateState state = ITEM_UNCHANGED; + bool list_queue = false, check_all = false; + if (state_str == "unchanged") state = ITEM_UNCHANGED; + else if (state_str == "changed") state = ITEM_CHANGED; + else if (state_str == "new") state = ITEM_NEW; + else if (state_str == "removed") state = ITEM_REMOVED; + else if (state_str == "queue") list_queue = true; + else if (state_str == "check_all") check_all = true; + else return false; + + Player* player = getSelectedPlayer(); + if (!player) player = m_session->GetPlayer(); + + if (!list_queue && !check_all) + { + state_str = "The player has the following " + state_str + " items: "; + SendSysMessage(state_str.c_str()); + for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) + { + if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) + continue; + + Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (!item) continue; + if (!item->IsBag()) + { + if (item->GetState() == state) + PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID())); + } + else + { + Bag *bag = (Bag*)item; + for (uint8 j = 0; j < bag->GetBagSize(); ++j) + { + Item* item2 = bag->GetItemByPos(j); + if (item2 && item2->GetState() == state) + PSendSysMessage("bag: 255 slot: %d guid: %d owner: %d", item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID())); + } + } + } + } + + if (list_queue) + { + std::vector &updateQueue = player->GetItemUpdateQueue(); + for (size_t i = 0; i < updateQueue.size(); ++i) + { + Item *item = updateQueue[i]; + if (!item) continue; + + Bag *container = item->GetContainer(); + uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); + + std::string st; + switch(item->GetState()) + { + case ITEM_UNCHANGED: st = "unchanged"; break; + case ITEM_CHANGED: st = "changed"; break; + case ITEM_NEW: st = "new"; break; + case ITEM_REMOVED: st = "removed"; break; + } + + PSendSysMessage("bag: %d slot: %d guid: %d - state: %s", bag_slot, item->GetSlot(), item->GetGUIDLow(), st.c_str()); + } + if (updateQueue.empty()) + PSendSysMessage("updatequeue empty"); + } + + if (check_all) + { + bool error = false; + std::vector &updateQueue = player->GetItemUpdateQueue(); + for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) + { + if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) + continue; + + Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + if (!item) continue; + + if (item->GetSlot() != i) + { + PSendSysMessage("item at slot %d, guid %d has an incorrect slot value: %d", i, item->GetGUIDLow(), item->GetSlot()); + error = true; continue; + } + + if (item->GetOwnerGUID() != player->GetGUID()) + { + PSendSysMessage("for the item at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", item->GetSlot(), item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + error = true; continue; + } + + if (Bag *container = item->GetContainer()) + { + PSendSysMessage("item at slot: %d guid: %d has a container (slot: %d, guid: %d) but shouldnt!", item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); + error = true; continue; + } + + if (item->IsInUpdateQueue()) + { + uint16 qp = item->GetQueuePos(); + if (qp > updateQueue.size()) + { + PSendSysMessage("item at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", item->GetSlot(), item->GetGUIDLow(), qp); + error = true; continue; + } + + if (updateQueue[qp] == NULL) + { + PSendSysMessage("item at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", item->GetSlot(), item->GetGUIDLow(), qp); + error = true; continue; + } + + if (updateQueue[qp] != item) + { + PSendSysMessage("item at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", item->GetSlot(), item->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); + error = true; continue; + } + } + else if (item->GetState() != ITEM_UNCHANGED) + { + PSendSysMessage("item at slot: %d guid: %d is not in queue but should be (state: %d)!", item->GetSlot(), item->GetGUIDLow(), item->GetState()); + error = true; continue; + } + + if (item->IsBag()) + { + Bag *bag = (Bag*)item; + for (uint8 j = 0; j < bag->GetBagSize(); ++j) + { + Item* item2 = bag->GetItemByPos(j); + if (!item2) continue; + + if (item2->GetSlot() != j) + { + PSendSysMessage("the item in bag %d slot %d, guid %d has an incorrect slot value: %d", bag->GetSlot(), j, item2->GetGUIDLow(), item2->GetSlot()); + error = true; continue; + } + + if (item2->GetOwnerGUID() != player->GetGUID()) + { + PSendSysMessage("for the item in bag %d at slot %d and itemguid %d, owner's guid (%d) and player's guid (%d) don't match!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), GUID_LOPART(item2->GetOwnerGUID()), player->GetGUIDLow()); + error = true; continue; + } + + Bag *container = item2->GetContainer(); + if (!container) + { + PSendSysMessage("the item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow()); + error = true; continue; + } + + if (container != bag) + { + PSendSysMessage("the item in bag %d at slot %d with guid %d has a different container(slot %d guid %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); + error = true; continue; + } + + if (item2->IsInUpdateQueue()) + { + uint16 qp = item2->GetQueuePos(); + if (qp > updateQueue.size()) + { + PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) larger than the update queue size! ", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); + error = true; continue; + } + + if (updateQueue[qp] == NULL) + { + PSendSysMessage("item in bag: %d at slot: %d guid: %d has a queuepos (%d) that points to NULL in the queue!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp); + error = true; continue; + } + + if (updateQueue[qp] != item2) + { + PSendSysMessage("item in bag: %d at slot: %d guid: %d has has a queuepos (%d) that points to another item in the queue (bag: %d, slot: %d, guid: %d)", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), qp, updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot(), updateQueue[qp]->GetGUIDLow()); + error = true; continue; + } + } + else if (item2->GetState() != ITEM_UNCHANGED) + { + PSendSysMessage("item in bag: %d at slot: %d guid: %d is not in queue but should be (state: %d)!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow(), item2->GetState()); + error = true; continue; + } + } + } + } + + for (size_t i = 0; i < updateQueue.size(); ++i) + { + Item *item = updateQueue[i]; + if (!item) continue; + + if (item->GetOwnerGUID() != player->GetGUID()) + { + PSendSysMessage("queue(" SIZEFMTD "): for the an item (guid %d), the owner's guid (%d) and player's guid (%d) don't match!", i, item->GetGUIDLow(), GUID_LOPART(item->GetOwnerGUID()), player->GetGUIDLow()); + error = true; continue; + } + + if (item->GetQueuePos() != i) + { + PSendSysMessage("queue(" SIZEFMTD "): for the an item (guid %d), the queuepos doesn't match it's position in the queue!", i, item->GetGUIDLow()); + error = true; continue; + } + + if (item->GetState() == ITEM_REMOVED) continue; + Item *test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); + + if (test == NULL) + { + PSendSysMessage("queue(" SIZEFMTD "): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the player doesn't have an item at that position!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow()); + error = true; continue; + } + + if (test != item) + { + PSendSysMessage("queue(" SIZEFMTD "): the bag(%d) and slot(%d) values for the item with guid %d are incorrect, the item with guid %d is there instead!", i, item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); + error = true; continue; + } + } + if (!error) + SendSysMessage("All OK!"); + } + + return true; +} + +bool ChatHandler::HandleDebugBattlegroundCommand(const char * /*args*/) +{ + sBattleGroundMgr.ToggleTesting(); + return true; +} + +bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/) +{ + sBattleGroundMgr.ToggleArenaTesting(); + return true; +} + +bool ChatHandler::HandleDebugThreatList(const char * /*args*/) +{ + Creature* target = getSelectedCreature(); + if (!target || target->isTotem() || target->isPet()) + return false; + + std::list& tlist = target->getThreatManager().getThreatList(); + std::list::iterator itr; + uint32 cnt = 0; + PSendSysMessage("Threat list of %s (guid %u)",target->GetName(), target->GetGUIDLow()); + for (itr = tlist.begin(); itr != tlist.end(); ++itr) + { + Unit* unit = (*itr)->getTarget(); + if (!unit) + continue; + ++cnt; + PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat()); + } + SendSysMessage("End of threat list."); + return true; +} + +bool ChatHandler::HandleDebugHostileRefList(const char * /*args*/) +{ + Unit* target = getSelectedUnit(); + if (!target) + target = m_session->GetPlayer(); + HostileReference* ref = target->getHostileRefManager().getFirst(); + uint32 cnt = 0; + PSendSysMessage("Hostil reference list of %s (guid %u)",target->GetName(), target->GetGUIDLow()); + while (ref) + { + if (Unit * unit = ref->getSource()->getOwner()) + { + ++cnt; + PSendSysMessage(" %u. %s (guid %u) - threat %f",cnt,unit->GetName(), unit->GetGUIDLow(), ref->getThreat()); + } + ref = ref->next(); + } + SendSysMessage("End of hostil reference list."); + return true; +} + +bool ChatHandler::HandleDebugSetVehicleId(const char *args) +{ + Unit* target = getSelectedUnit(); + if (!target || target->IsVehicle()) + return false; + + if (!args) + return false; + + char* i = strtok((char*)args, " "); + if (!i) + return false; + + uint32 id = (uint32)atoi(i); + //target->SetVehicleId(id); + PSendSysMessage("Vehicle id set to %u", id); + return true; +} + +bool ChatHandler::HandleDebugEnterVehicle(const char * args) +{ + Unit* target = getSelectedUnit(); + if (!target || !target->IsVehicle()) + return false; + + if (!args) + return false; + + char* i = strtok((char*)args, " "); + if (!i) + return false; + + char* j = strtok(NULL, " "); + + uint32 entry = (uint32)atoi(i); + int8 seatId = j ? (int8)atoi(j) : -1; + + if (!entry) + m_session->GetPlayer()->EnterVehicle(target, seatId); + else + { + Creature *passenger = NULL; + Trinity::AllCreaturesOfEntryInRange check(m_session->GetPlayer(), entry, 20.0f); + Trinity::CreatureSearcher searcher(m_session->GetPlayer(), passenger, check); + m_session->GetPlayer()->VisitNearbyObject(30.0f, searcher); + if (!passenger || passenger == target) + return false; + passenger->EnterVehicle(target, seatId); + } + + PSendSysMessage("Unit %u entered vehicle %d", entry, (int32)seatId); + return true; +} + +bool ChatHandler::HandleDebugSpawnVehicle(const char* args) +{ + if (!*args) + return false; + + char* e = strtok((char*)args, " "); + char* i = strtok(NULL, " "); + + if (!e) + return false; + + uint32 entry = (uint32)atoi(e); + + float x, y, z, o = m_session->GetPlayer()->GetOrientation(); + m_session->GetPlayer()->GetClosePoint(x, y, z, m_session->GetPlayer()->GetObjectSize()); + + if (!i) + return m_session->GetPlayer()->SummonCreature(entry, x, y, z, o); + + uint32 id = (uint32)atoi(i); + + CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry); + + if (!ci) + return false; + + VehicleEntry const *ve = sVehicleStore.LookupEntry(id); + + if (!ve) + return false; + + Creature *v = new Creature; + + Map *map = m_session->GetPlayer()->GetMap(); + + if (!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o)) + { + delete v; + return false; + } + + map->Add(v->ToCreature()); + + return true; +} + +bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/) +{ + const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; + std::ostringstream ss; + while (ss.str().size() < 128000) + ss << stuffingString; + SendSysMessage(ss.str().c_str()); + return true; +} + +bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args) +{ + if (!*args) + return false; + + uint32 PhaseShift = atoi(args); + m_session->SendSetPhaseShift(PhaseShift); + return true; +} + +bool ChatHandler::HandleDebugGetItemValueCommand(const char* args) +{ + if (!*args) + return false; + + char* e = strtok((char*)args, " "); + char* f = strtok(NULL, " "); + + if (!e || !f) + return false; + + uint32 guid = (uint32)atoi(e); + uint32 index = (uint32)atoi(f); + + Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + + if (!i) + return false; + + if (index >= i->GetValuesCount()) + return false; + + uint32 value = i->GetUInt32Value(index); + + PSendSysMessage("Item %u: value at %u is %u", guid, index, value); + + return true; +} + +bool ChatHandler::HandleDebugSetItemValueCommand(const char* args) +{ + if (!*args) + return false; + + char* e = strtok((char*)args, " "); + char* f = strtok(NULL, " "); + char* g = strtok(NULL, " "); + + if (!e || !f || !g) + return false; + + uint32 guid = (uint32)atoi(e); + uint32 index = (uint32)atoi(f); + uint32 value = (uint32)atoi(g); + + Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + + if (!i) + return false; + + if (index >= i->GetValuesCount()) + return false; + + i->SetUInt32Value(index, value); + + return true; +} + +bool ChatHandler::HandleDebugItemExpireCommand(const char* args) +{ + if (!*args) + return false; + + char* e = strtok((char*)args, " "); + if (!e) + return false; + + uint32 guid = (uint32)atoi(e); + + Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM)); + + if (!i) + return false; + + m_session->GetPlayer()->DestroyItem(i->GetBagSlot(),i->GetSlot(), true); + sScriptMgr.ItemExpire(m_session->GetPlayer(),i->GetProto()); + + return true; +} + +//show animation +bool ChatHandler::HandleDebugAnimCommand(const char* args) +{ + if (!*args) + return false; + + uint32 anim_id = atoi((char*)args); + m_session->GetPlayer()->HandleEmoteCommand(anim_id); + return true; +} + +bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args) +{ + if (!*args) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Unit* unit = getSelectedUnit(); + if (!unit) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + int32 state = atoi((char*)args); + if (!state) + { + // reset all states + for (int i = 1; i <= 32; ++i) + unit->ModifyAuraState(AuraState(i),false); + return true; + } + + unit->ModifyAuraState(AuraState(abs(state)),state > 0); + return true; +} + +bool ChatHandler::HandleDebugSetValueCommand(const char* args) +{ + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + char* pz = strtok(NULL, " "); + + if (!px || !py) + return false; + + WorldObject* target = getSelectedObject(); + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + uint64 guid = target->GetGUID(); + + uint32 Opcode = (uint32)atoi(px); + if (Opcode >= target->GetValuesCount()) + { + PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount()); + return false; + } + uint32 iValue; + float fValue; + bool isint32 = true; + if (pz) + isint32 = (bool)atoi(pz); + if (isint32) + { + iValue = (uint32)atoi(py); + sLog.outDebug(GetTrinityString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue); + target->SetUInt32Value(Opcode , iValue); + PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode,iValue); + } + else + { + fValue = (float)atof(py); + sLog.outDebug(GetTrinityString(LANG_SET_FLOAT), GUID_LOPART(guid), Opcode, fValue); + target->SetFloatValue(Opcode , fValue); + PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode,fValue); + } + + return true; +} + +bool ChatHandler::HandleDebugGetValueCommand(const char* args) +{ + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + char* pz = strtok(NULL, " "); + + if (!px) + return false; + + Unit* target = getSelectedUnit(); + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + uint64 guid = target->GetGUID(); + + uint32 Opcode = (uint32)atoi(px); + if (Opcode >= target->GetValuesCount()) + { + PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount()); + return false; + } + uint32 iValue; + float fValue; + bool isint32 = true; + if (pz) + isint32 = (bool)atoi(pz); + + if (isint32) + { + iValue = target->GetUInt32Value(Opcode); + sLog.outDebug(GetTrinityString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue); + PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue); + } + else + { + fValue = target->GetFloatValue(Opcode); + sLog.outDebug(GetTrinityString(LANG_GET_FLOAT), GUID_LOPART(guid), Opcode, fValue); + PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue); + } + + return true; +} + +bool ChatHandler::HandleDebugMod32ValueCommand(const char* args) +{ + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + + if (!px || !py) + return false; + + uint32 Opcode = (uint32)atoi(px); + int Value = atoi(py); + + if (Opcode >= m_session->GetPlayer()->GetValuesCount()) + { + PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, m_session->GetPlayer()->GetGUIDLow(), m_session->GetPlayer()->GetValuesCount()); + return false; + } + + sLog.outDebug(GetTrinityString(LANG_CHANGE_32BIT), Opcode, Value); + + int CurrentValue = (int)m_session->GetPlayer()->GetUInt32Value(Opcode); + + CurrentValue += Value; + m_session->GetPlayer()->SetUInt32Value(Opcode , (uint32)CurrentValue); + + PSendSysMessage(LANG_CHANGE_32BIT_FIELD, Opcode,CurrentValue); + + return true; +} + +bool ChatHandler::HandleDebugUpdateCommand(const char* args) +{ + if (!*args) + return false; + + uint32 updateIndex; + uint32 value; + + char* pUpdateIndex = strtok((char*)args, " "); + + Unit* chr = getSelectedUnit(); + if (chr == NULL) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (!pUpdateIndex) + { + return true; + } + updateIndex = atoi(pUpdateIndex); + //check updateIndex + if (chr->GetTypeId() == TYPEID_PLAYER) + { + if (updateIndex >= PLAYER_END) return true; + } + else + { + if (updateIndex >= UNIT_END) return true; + } + + char* pvalue = strtok(NULL, " "); + if (!pvalue) + { + value=chr->GetUInt32Value(updateIndex); + + PSendSysMessage(LANG_UPDATE, chr->GetGUIDLow(),updateIndex,value); + return true; + } + + value=atoi(pvalue); + + PSendSysMessage(LANG_UPDATE_CHANGE, chr->GetGUIDLow(),updateIndex,value); + + chr->SetUInt32Value(updateIndex,value); + + return true; +} diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp new file mode 100644 index 0000000..43607f9 --- /dev/null +++ b/src/server/game/Chat/Commands/Level0.cpp @@ -0,0 +1,306 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "DatabaseEnv.h" +#include "World.h" +#include "Player.h" +#include "Opcodes.h" +#include "Chat.h" +#include "ObjectAccessor.h" +#include "Language.h" +#include "AccountMgr.h" +#include "SystemConfig.h" +#include "revision.h" +#include "revision_nr.h" +#include "Util.h" + +bool ChatHandler::HandleHelpCommand(const char* args) +{ + char* cmd = strtok((char*)args, " "); + if (!cmd) + { + ShowHelpForCommand(getCommandTable(), "help"); + ShowHelpForCommand(getCommandTable(), ""); + } + else + { + if (!ShowHelpForCommand(getCommandTable(), cmd)) + SendSysMessage(LANG_NO_HELP_CMD); + } + + return true; +} + +bool ChatHandler::HandleCommandsCommand(const char* /*args*/) +{ + ShowHelpForCommand(getCommandTable(), ""); + return true; +} + +bool ChatHandler::HandleAccountCommand(const char* /*args*/) +{ + AccountTypes gmlevel = m_session->GetSecurity(); + PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel)); + return true; +} + +bool ChatHandler::HandleStartCommand(const char* /*args*/) +{ + Player *chr = m_session->GetPlayer(); + + if (chr->isInFlight()) + { + SendSysMessage(LANG_YOU_IN_FLIGHT); + SetSentErrorMessage(true); + return false; + } + + if (chr->isInCombat()) + { + SendSysMessage(LANG_YOU_IN_COMBAT); + SetSentErrorMessage(true); + return false; + } + + if ((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))) + { + // if player is dead and stuck, send ghost to graveyard + chr->RepopAtGraveyard(); + return true; + } + + // cast spell Stuck + chr->CastSpell(chr, 7355, false); + return true; +} + +bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) +{ + uint32 PlayersNum = sWorld.GetPlayerCount(); + uint32 MaxPlayersNum = sWorld.GetMaxPlayerCount(); + uint32 activeClientsNum = sWorld.GetActiveSessionCount(); + uint32 queuedClientsNum = sWorld.GetQueuedSessionCount(); + uint32 maxActiveClientsNum = sWorld.GetMaxActiveSessionCount(); + uint32 maxQueuedClientsNum = sWorld.GetMaxQueuedSessionCount(); + std::string uptime = secsToTimeString(sWorld.GetUptime()); + uint32 updateTime = sWorld.GetUpdateTime(); + +// PSendSysMessage(_FULLVERSION); + PSendSysMessage("Created For Romanian Best Private Server: www.wow-romania.ro"); + PSendSysMessage("Core Revision:" REVISION_NR); + PSendSysMessage(LANG_CONNECTED_PLAYERS, PlayersNum, MaxPlayersNum); + PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum); + PSendSysMessage(LANG_UPTIME, uptime.c_str()); + PSendSysMessage("Update time diff: %u.", updateTime); + + return true; +} + +bool ChatHandler::HandleDismountCommand(const char* /*args*/) +{ + //If player is not mounted, so go out :) + if (!m_session->GetPlayer()->IsMounted()) + { + SendSysMessage(LANG_CHAR_NON_MOUNTED); + SetSentErrorMessage(true); + return false; + } + + if (m_session->GetPlayer()->isInFlight()) + { + SendSysMessage(LANG_YOU_IN_FLIGHT); + SetSentErrorMessage(true); + return false; + } + + m_session->GetPlayer()->Unmount(); + m_session->GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED); + return true; +} + +bool ChatHandler::HandleSaveCommand(const char* /*args*/) +{ + Player *player = m_session->GetPlayer(); + + // save GM account without delay and output message + if (m_session->GetSecurity() > SEC_PLAYER) + { + player->SaveToDB(); + SendSysMessage(LANG_PLAYER_SAVED); + return true; + } + + // save if the player has last been saved over 20 seconds ago + uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE); + if ((save_interval == 0 || save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS)) + player->SaveToDB(); + + return true; +} + +bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) +{ + bool first = true; + + ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder::GetLock(), true); + HashMapHolder::MapType &m = sObjectAccessor.GetPlayers(); + for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) + { + AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); + if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) && + (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer()))) + { + if (first) + { + SendSysMessage(LANG_GMS_ON_SRV); + first = false; + } + + SendSysMessage(GetNameLink(itr->second).c_str()); + } + } + + if (first) + SendSysMessage(LANG_GMS_NOT_LOGGED); + + return true; +} + +bool ChatHandler::HandleAccountPasswordCommand(const char* args) +{ + if (!*args) + { + SendSysMessage(LANG_CMD_SYNTAX); + SetSentErrorMessage(true); + return false; + } + + char *old_pass = strtok((char*)args, " "); + char *new_pass = strtok(NULL, " "); + char *new_pass_c = strtok(NULL, " "); + + if (!old_pass || !new_pass || !new_pass_c) + { + SendSysMessage(LANG_CMD_SYNTAX); + SetSentErrorMessage(true); + return false; + } + + std::string password_old = old_pass; + std::string password_new = new_pass; + std::string password_new_c = new_pass_c; + + if (!accmgr.CheckPassword(m_session->GetAccountId(), password_old)) + { + SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); + SetSentErrorMessage(true); + return false; + } + + if (strcmp(new_pass, new_pass_c) != 0) + { + SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH); + SetSentErrorMessage(true); + return false; + } + + AccountOpResult result = accmgr.ChangePassword(m_session->GetAccountId(), password_new); + switch(result) + { + case AOR_OK: + SendSysMessage(LANG_COMMAND_PASSWORD); + break; + case AOR_PASS_TOO_LONG: + SendSysMessage(LANG_PASSWORD_TOO_LONG); + SetSentErrorMessage(true); + return false; + default: + SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); + SetSentErrorMessage(true); + return false; + } + + return true; +} + +bool ChatHandler::HandleAccountAddonCommand(const char* args) +{ + if (!*args) + { + SendSysMessage(LANG_CMD_SYNTAX); + SetSentErrorMessage(true); + return false; + } + + char *szExp = strtok((char*)args, " "); + + uint32 account_id = m_session->GetAccountId(); + + int expansion = atoi(szExp); //get int anyway (0 if error) + if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION)) + { + SendSysMessage(LANG_IMPROPER_VALUE); + SetSentErrorMessage(true); + return false; + } + + // No SQL injection + LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id); + PSendSysMessage(LANG_ACCOUNT_ADDON, expansion); + return true; +} + +bool ChatHandler::HandleAccountLockCommand(const char* args) +{ + if (!*args) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + std::string argstr = (char*)args; + if (argstr == "on") + { + LoginDatabase.PExecute("UPDATE account SET locked = '1' WHERE id = '%d'",m_session->GetAccountId()); + PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED); + return true; + } + + if (argstr == "off") + { + LoginDatabase.PExecute("UPDATE account SET locked = '0' WHERE id = '%d'",m_session->GetAccountId()); + PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); + return true; + } + + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; +} + +/// Display the 'Message of the day' for the realm +bool ChatHandler::HandleServerMotdCommand(const char* /*args*/) +{ + PSendSysMessage(LANG_MOTD_CURRENT, sWorld.GetMotd()); + return true; +} + diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp new file mode 100644 index 0000000..7713396 --- /dev/null +++ b/src/server/game/Chat/Commands/Level1.cpp @@ -0,0 +1,2960 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "DatabaseEnv.h" +#include "WorldPacket.h" +#include "WorldSession.h" +#include "World.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "AccountMgr.h" +#include "Opcodes.h" +#include "Chat.h" +#include "Log.h" +#include "MapManager.h" +#include "ObjectAccessor.h" +#include "Language.h" +#include "CellImpl.h" +#include "InstanceSaveMgr.h" +#include "Util.h" + +#ifdef _DEBUG_VMAPS +#include "VMapFactory.h" +#endif + +//-----------------------Npc Commands----------------------- +bool ChatHandler::HandleNpcSayCommand(const char* args) +{ + if (!*args) + return false; + + Creature* pCreature = getSelectedCreature(); + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pCreature->MonsterSay(args, LANG_UNIVERSAL, 0); + + // make some emotes + char lastchar = args[strlen(args) - 1]; + switch(lastchar) + { + case '?': pCreature->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION); break; + case '!': pCreature->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); break; + default: pCreature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break; + } + + return true; +} + +bool ChatHandler::HandleNpcYellCommand(const char* args) +{ + if (!*args) + return false; + + Creature* pCreature = getSelectedCreature(); + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pCreature->MonsterYell(args, LANG_UNIVERSAL, 0); + + // make an emote + pCreature->HandleEmoteCommand(EMOTE_ONESHOT_SHOUT); + + return true; +} + +//show text emote by creature in chat +bool ChatHandler::HandleNpcTextEmoteCommand(const char* args) +{ + if (!*args) + return false; + + Creature* pCreature = getSelectedCreature(); + + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pCreature->MonsterTextEmote(args, 0); + + return true; +} + +// make npc whisper to player +bool ChatHandler::HandleNpcWhisperCommand(const char* args) +{ + if (!*args) + return false; + + char* receiver_str = strtok((char*)args, " "); + char* text = strtok(NULL, ""); + + uint64 guid = m_session->GetPlayer()->GetSelection(); + Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(guid); + + if (!pCreature || !receiver_str || !text) + { + return false; + } + + uint64 receiver_guid= atol(receiver_str); + + // check online security + if (HasLowerSecurity(objmgr.GetPlayer(receiver_guid), 0)) + return false; + + pCreature->MonsterWhisper(text,receiver_guid); + + return true; +} +//---------------------------------------------------------- + +bool ChatHandler::HandleNameAnnounceCommand(const char* args) +{ + WorldPacket data; + if (!*args) + return false; + + sWorld.SendWorldText(LANG_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args); + return true; +} + +bool ChatHandler::HandleGMNameAnnounceCommand(const char* args) +{ + WorldPacket data; + if (!*args) + return false; + + sWorld.SendGMText(LANG_GM_ANNOUNCE_COLOR, m_session->GetPlayer()->GetName(), args); + return true; +} + +// global announce +bool ChatHandler::HandleAnnounceCommand(const char* args) +{ + if (!*args) + return false; + + sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args); + return true; +} + +// announce to logged in GMs +bool ChatHandler::HandleGMAnnounceCommand(const char* args) +{ + if (!*args) + return false; + + sWorld.SendGMText(LANG_GM_BROADCAST,args); + return true; +} + +//notification player at the screen +bool ChatHandler::HandleNotifyCommand(const char* args) +{ + if (!*args) + return false; + + std::string str = GetTrinityString(LANG_GLOBAL_NOTIFY); + str += args; + + WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); + data << str; + sWorld.SendGlobalMessage(&data); + + return true; +} + +//notification GM at the screen +bool ChatHandler::HandleGMNotifyCommand(const char* args) +{ + if (!*args) + return false; + + std::string str = GetTrinityString(LANG_GM_NOTIFY); + str += args; + + WorldPacket data(SMSG_NOTIFICATION, (str.size()+1)); + data << str; + sWorld.SendGlobalGMMessage(&data); + + return true; +} + +//Enable\Dissable GM Mode +bool ChatHandler::HandleGMCommand(const char* args) +{ + if (!*args) + { + if (m_session->GetPlayer()->isGameMaster()) + m_session->SendNotification(LANG_GM_ON); + else + m_session->SendNotification(LANG_GM_OFF); + return true; + } + + std::string argstr = (char*)args; + + if (argstr == "on") + { + m_session->GetPlayer()->SetGameMaster(true); + m_session->SendNotification(LANG_GM_ON); + m_session->GetPlayer()->UpdateTriggerVisibility(); + #ifdef _DEBUG_VMAPS + VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); + vMapManager->processCommand("stoplog"); + #endif + return true; + } + + if (argstr == "off") + { + m_session->GetPlayer()->SetGameMaster(false); + m_session->SendNotification(LANG_GM_OFF); + m_session->GetPlayer()->UpdateTriggerVisibility(); + #ifdef _DEBUG_VMAPS + VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); + vMapManager->processCommand("startlog"); + #endif + return true; + } + + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; +} + +// Enables or disables hiding of the staff badge +bool ChatHandler::HandleGMChatCommand(const char* args) +{ + if (!*args) + { + if (m_session->GetPlayer()->isGMChat()) + m_session->SendNotification(LANG_GM_CHAT_ON); + else + m_session->SendNotification(LANG_GM_CHAT_OFF); + return true; + } + + std::string argstr = (char*)args; + + if (argstr == "on") + { + m_session->GetPlayer()->SetGMChat(true); + m_session->SendNotification(LANG_GM_CHAT_ON); + return true; + } + + if (argstr == "off") + { + m_session->GetPlayer()->SetGMChat(false); + m_session->SendNotification(LANG_GM_CHAT_OFF); + return true; + } + + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; +} + +std::string ChatHandler::PGetParseString(int32 entry, ...) +{ + const char *format = GetTrinityString(entry); + va_list ap; + char str [1024]; + va_start(ap, entry); + vsnprintf(str,1024,format, ap); + va_end(ap); + return (std::string)str; +} + +bool ChatHandler::HandleGMTicketListCommand(const char* /*args*/) +{ + SendSysMessage(LANG_COMMAND_TICKETSHOWLIST); + for (GmTicketList::iterator itr = objmgr.m_GMTicketList.begin(); itr != objmgr.m_GMTicketList.end(); ++itr) + { + if ((*itr)->closed != 0) + continue; + std::string gmname; + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str()); + if (objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + } + SendSysMessage(ss.str().c_str()); + } + return true; +} + +bool ChatHandler::HandleGMTicketListOnlineCommand(const char* /*args*/) +{ + SendSysMessage(LANG_COMMAND_TICKETSHOWONLINELIST); + for (GmTicketList::iterator itr = objmgr.m_GMTicketList.begin(); itr != objmgr.m_GMTicketList.end(); ++itr) + { + if ((*itr)->closed != 0 || !objmgr.GetPlayer((*itr)->playerGuid)) + continue; + + std::string gmname; + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str()); + if (objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + } + SendSysMessage(ss.str().c_str()); + } + return true; +} + +bool ChatHandler::HandleGMTicketListClosedCommand(const char* /*args*/) +{ + SendSysMessage(LANG_COMMAND_TICKETSHOWCLOSEDLIST); + for (GmTicketList::iterator itr = objmgr.m_GMTicketList.begin(); itr != objmgr.m_GMTicketList.end(); ++itr) + { + if ((*itr)->closed == 0) + continue; + + std::string gmname; + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, (*itr)->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, (*itr)->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - (*itr)->createtime, true, false)).c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - (*itr)->timestamp, true, false)).c_str()); + if (objmgr.GetPlayerNameByGUID((*itr)->assignedToGM, gmname)) + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + } + SendSysMessage(ss.str().c_str()); + } + return true; +} + +bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args) +{ + if (!*args) + return false; + + uint64 tguid = atoi(args); + GM_Ticket *ticket = objmgr.GetGMTicket(tguid); + if (!ticket || ticket->closed != 0) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + std::string gmname; + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - ticket->createtime, true, false)).c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str()); + if (objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + } + ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str()); + if (ticket->comment != "") + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str()); + } + SendSysMessage(ss.str().c_str()); + return true; +} + +bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args) +{ + if (!*args) + return false; + + std::string name = (char*)args; + normalizePlayerName(name); + + Player *plr = objmgr.GetPlayer(name.c_str()); + if (!plr) + { + SendSysMessage(LANG_NO_PLAYERS_FOUND); + return true; + } + + GM_Ticket *ticket = objmgr.GetGMTicketByPlayer(plr->GetGUID()); + if (!ticket) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + std::string gmname; + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGECREATE, (secsToTimeString(time(NULL) - ticket->createtime, true, false)).c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTAGE, (secsToTimeString(time(NULL) - ticket->timestamp, true, false)).c_str()); + if (objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + } + ss << PGetParseString(LANG_COMMAND_TICKETLISTMESSAGE, ticket->message.c_str()); + if (ticket->comment != "") + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTCOMMENT, ticket->comment.c_str()); + } + SendSysMessage(ss.str().c_str()); + return true; +} + +bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args) +{ + if (!*args) + return false; + + uint64 tguid = atoi(args); + GM_Ticket *ticket = objmgr.GetGMTicket(tguid); + if (!ticket || ticket->closed != 0) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if (ticket && ticket->assignedToGM != 0 && ticket->assignedToGM != m_session->GetPlayer()->GetGUID()) + { + PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->guid); + return true; + } + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETCLOSED, m_session->GetPlayer()->GetName()); + SendGlobalGMSysMessage(ss.str().c_str()); + Player *plr = objmgr.GetPlayer(ticket->playerGuid); + objmgr.RemoveGMTicket(ticket, m_session->GetPlayer()->GetGUID()); + + if (!plr || !plr->IsInWorld()) + return true; + + // send abandon ticket + WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); + data << uint32(9); + plr->GetSession()->SendPacket(&data); + return true; +} + +bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) +{ + if (!*args) + return false; + + char* tguid = strtok((char*)args, " "); + uint64 ticketGuid = atoi(tguid); + char* targetgm = strtok(NULL, " "); + + if (!targetgm) + return false; + + std::string targm = targetgm; + if (!normalizePlayerName(targm)) + return false; + + Player *cplr = m_session->GetPlayer(); + GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid); + + if (!ticket || ticket->closed != 0) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + uint64 tarGUID = objmgr.GetPlayerGUIDByName(targm.c_str()); + uint64 accid = objmgr.GetPlayerAccountIdByGUID(tarGUID); + uint32 gmlevel = accmgr.GetSecurity(accid, realmID); + + if (!tarGUID || gmlevel == SEC_PLAYER) + { + SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); + return true; + } + + if (ticket->assignedToGM == tarGUID) + { + PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->guid); + return true; + } + + std::string gmname; + objmgr.GetPlayerNameByGUID(tarGUID, gmname); + if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID()) + { + PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid, gmname.c_str()); + return true; + } + + ticket->assignedToGM = tarGUID; + objmgr.AddOrUpdateGMTicket(*ticket); + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + SendGlobalGMSysMessage(ss.str().c_str()); + return true; +} + +bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args) +{ + if (!*args) + return false; + + uint64 ticketGuid = atoi(args); + Player *cplr = m_session->GetPlayer(); + GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid); + + if (!ticket|| ticket->closed != 0) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if (ticket->assignedToGM == 0) + { + PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->guid); + return true; + } + + std::string gmname; + objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname); + Player *plr = objmgr.GetPlayer(ticket->assignedToGM); + if (plr && plr->IsInWorld() && plr->GetSession()->GetSecurity() > cplr->GetSession()->GetSecurity()) + { + SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY); + return true; + } + + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETLISTUNASSIGNED, cplr->GetName()); + SendGlobalGMSysMessage(ss.str().c_str()); + ticket->assignedToGM = 0; + objmgr.AddOrUpdateGMTicket(*ticket); + return true; +} + +bool ChatHandler::HandleGMTicketCommentCommand(const char* args) +{ + if (!*args) + return false; + + char* tguid = strtok((char*)args, " "); + uint64 ticketGuid = atoi(tguid); + char* comment = strtok(NULL, "\n"); + + if (!comment) + return false; + + Player *cplr = m_session->GetPlayer(); + GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid); + + if (!ticket || ticket->closed != 0) + { + PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if (ticket->assignedToGM != 0 && ticket->assignedToGM != cplr->GetGUID()) + { + PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->guid); + return true; + } + + std::string gmname; + objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname); + ticket->comment = comment; + objmgr.AddOrUpdateGMTicket(*ticket); + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); + if (objmgr.GetPlayerNameByGUID(ticket->assignedToGM, gmname)) + { + ss << PGetParseString(LANG_COMMAND_TICKETLISTASSIGNEDTO, gmname.c_str()); + } + ss << PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, cplr->GetName(), ticket->comment.c_str()); + SendGlobalGMSysMessage(ss.str().c_str()); + return true; +} + +bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args) +{ + if (!*args) + return false; + uint64 ticketGuid = atoi(args); + GM_Ticket *ticket = objmgr.GetGMTicket(ticketGuid); + + if (!ticket) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + if (ticket->closed == 0) + { + SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST); + return true; + } + + std::stringstream ss; + ss << PGetParseString(LANG_COMMAND_TICKETLISTGUID, ticket->guid); + ss << PGetParseString(LANG_COMMAND_TICKETLISTNAME, ticket->name.c_str()); + ss << PGetParseString(LANG_COMMAND_TICKETDELETED, m_session->GetPlayer()->GetName()); + SendGlobalGMSysMessage(ss.str().c_str()); + Player *plr = objmgr.GetPlayer(ticket->playerGuid); + objmgr.RemoveGMTicket(ticket, -1, true); + if (plr && plr->IsInWorld()) + { + // Force abandon ticket + WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4); + data << uint32(9); + plr->GetSession()->SendPacket(&data); + } + + ticket = NULL; + return true; +} + +bool ChatHandler::HandleGMTicketReloadCommand(const char*) +{ + objmgr.LoadGMTickets(); + return true; +} + +//Enable\Dissable Invisible mode +bool ChatHandler::HandleGMVisibleCommand(const char* args) +{ + if (!*args) + { + PSendSysMessage(LANG_YOU_ARE, m_session->GetPlayer()->isGMVisible() ? GetTrinityString(LANG_VISIBLE) : GetTrinityString(LANG_INVISIBLE)); + return true; + } + + std::string argstr = (char*)args; + + if (argstr == "on") + { + m_session->GetPlayer()->SetGMVisible(true); + m_session->SendNotification(LANG_INVISIBLE_VISIBLE); + return true; + } + + if (argstr == "off") + { + m_session->SendNotification(LANG_INVISIBLE_INVISIBLE); + m_session->GetPlayer()->SetGMVisible(false); + return true; + } + + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; +} + +bool ChatHandler::HandleGPSCommand(const char* args) +{ + WorldObject *obj = NULL; + if (*args) + { + uint64 guid = extractGuidFromLink((char*)args); + if (guid) + obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + + if (!obj) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + } + else + { + obj = getSelectedUnit(); + + if (!obj) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + } + CellPair cell_val = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); + Cell cell(cell_val); + + uint32 zone_id, area_id; + obj->GetZoneAndAreaId(zone_id,area_id); + + MapEntry const* mapEntry = sMapStore.LookupEntry(obj->GetMapId()); + AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zone_id); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(area_id); + + float zone_x = obj->GetPositionX(); + float zone_y = obj->GetPositionY(); + + Map2ZoneCoordinates(zone_x,zone_y,zone_id); + + Map const *map = obj->GetMap(); + float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); + float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); + + GridPair p = Trinity::ComputeGridPair(obj->GetPositionX(), obj->GetPositionY()); + + int gx=63-p.x_coord; + int gy=63-p.y_coord; + + uint32 have_map = Map::ExistMap(obj->GetMapId(),gx,gy) ? 1 : 0; + uint32 have_vmap = Map::ExistVMap(obj->GetMapId(),gx,gy) ? 1 : 0; + + if(have_vmap) + { + if(map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ())) + PSendSysMessage("You are outdoors"); + else + PSendSysMessage("You are indoor"); + } + else PSendSysMessage("no VMAP available for area info"); + + PSendSysMessage(LANG_MAP_POSITION, + obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : ""), + zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : ""), + area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : ""), + obj->GetPhaseMask(), + obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(), + cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(), + zone_x, zone_y, ground_z, floor_z, have_map, have_vmap); + + sLog.outDebug("Player %s GPS call for %s '%s' (%s: %u):", + m_session ? GetNameLink().c_str() : GetTrinityString(LANG_CONSOLE_COMMAND), + (obj->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), obj->GetName(), + (obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry())); + sLog.outDebug(GetTrinityString(LANG_MAP_POSITION), + obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : ""), + zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : ""), + area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : ""), + obj->GetPhaseMask(), + obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(), + cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(), + zone_x, zone_y, ground_z, floor_z, have_map, have_vmap); + + LiquidData liquid_status; + ZLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status); + if (res) + { + PSendSysMessage(LANG_LIQUID_STATUS, liquid_status.level, liquid_status.depth_level, liquid_status.type, res); + } + return true; +} + +//Summon Player +bool ChatHandler::HandleNamegoCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + Player* _player = m_session->GetPlayer(); + if (target == _player || target_guid == _player->GetGUID()) + { + PSendSysMessage(LANG_CANT_TELEPORT_SELF); + SetSentErrorMessage(true); + return false; + } + + if (target) + { + std::string nameLink = playerLink(target_name); + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + Map* pMap = m_session->GetPlayer()->GetMap(); + + if (pMap->IsBattleGroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,nameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (target->GetBattleGroundId() && m_session->GetPlayer()->GetBattleGroundId() != target->GetBattleGroundId()) + { + target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff + //PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,nameLink.c_str()); + //SetSentErrorMessage(true); + //return false; + } + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + target->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId(), m_session->GetPlayer()->GetBattleGroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!target->GetMap()->IsBattleGroundOrArena()) + target->SetBattleGroundEntryPoint(); + } + else if (pMap->IsDungeon()) + { + Map* cMap = target->GetMap(); + if (cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId()) + { + target->UnbindInstance(pMap->GetInstanceId(), target->GetDungeonDifficulty(), true); + // cannot summon from instance to instance + //PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str()); + //SetSentErrorMessage(true); + //return false; + } + + // we are in instance, and can summon only player in our group with us as lead + if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() || + (target->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) || + (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID())) + // the last check is a bit excessive, but let it be, just in case + { + PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + } + + PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),""); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, playerLink(_player->GetName()).c_str()); + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + target->SaveRecallPosition(); + + // before GM + float x,y,z; + m_session->GetPlayer()->GetClosePoint(x,y,z,target->GetObjectSize()); + target->TeleportTo(m_session->GetPlayer()->GetMapId(),x,y,z,target->GetOrientation()); + target->SetPhaseMask(m_session->GetPlayer()->GetPhaseMask(), true); + } + else + { + // check offline security + if (HasLowerSecurity(NULL, target_guid)) + return false; + + std::string nameLink = playerLink(target_name); + + PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),GetTrinityString(LANG_OFFLINE)); + + // in point where GM stay + Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(), + m_session->GetPlayer()->GetPositionX(), + m_session->GetPlayer()->GetPositionY(), + m_session->GetPlayer()->GetPositionZ(), + m_session->GetPlayer()->GetOrientation(), + m_session->GetPlayer()->GetZoneId(), + target_guid); + } + + return true; +} + +//Teleport to Player +bool ChatHandler::HandleGonameCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + Player* _player = m_session->GetPlayer(); + if (target == _player || target_guid == _player->GetGUID()) + { + SendSysMessage(LANG_CANT_TELEPORT_SELF); + SetSentErrorMessage(true); + return false; + } + + if (target) + { + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + std::string chrNameLink = playerLink(target_name); + + Map* cMap = target->GetMap(); + if (cMap->IsBattleGroundOrArena()) + { + // only allow if gm mode is on + if (!_player->isGameMaster()) + { + PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + // if both players are in different bgs + else if (_player->GetBattleGroundId() && _player->GetBattleGroundId() != target->GetBattleGroundId()) + { + _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff + //PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,chrNameLink.c_str()); + //SetSentErrorMessage(true); + //return false; + } + // all's well, set bg id + // when porting out from the bg, it will be reset to 0 + _player->SetBattleGroundId(target->GetBattleGroundId(), target->GetBattleGroundTypeId()); + // remember current position as entry point for return at bg end teleportation + if (!_player->GetMap()->IsBattleGroundOrArena()) + _player->SetBattleGroundEntryPoint(); + } + else if (cMap->IsDungeon()) + { + //Map* pMap = _player->GetMap(); + + // we have to go to instance, and can go to player only if: + // 1) we are in his group (either as leader or as member) + // 2) we are not bound to any group and have GM mode on + if (_player->GetGroup()) + { + // we are in group, we can go only if we are in the player group + if (_player->GetGroup() != target->GetGroup()) + { + PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY,chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + } + else + { + // we are not in group, let's verify our GM mode + if (!_player->isGameMaster()) + { + PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM,chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + } + + // if the player or the player's group is bound to another instance + // the player will not be bound to another one + InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid())); + if (!pBind) + { + Group *group = _player->GetGroup(); + // if no bind exists, create a solo bind + InstanceGroupBind *gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind + if (!gBind) + if (InstanceSave *save = sInstanceSaveManager.GetInstanceSave(target->GetInstanceId())) + _player->BindToInstance(save, !save->CanReset()); + } + + if (cMap->IsRaid()) + _player->SetRaidDifficulty(target->GetRaidDifficulty()); + else + _player->SetDungeonDifficulty(target->GetDungeonDifficulty()); + } + + PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str()); + //if (needReportToTarget(target)) + // ChatHandler(target).PSendSysMessage(LANG_APPEARING_TO, GetNameLink().c_str()); + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + // to point to see at target with same orientation + float x,y,z; + target->GetContactPoint(_player,x,y,z); + + _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); + _player->SetPhaseMask(target->GetPhaseMask(), true); + } + else + { + // check offline security + if (HasLowerSecurity(NULL, target_guid)) + return false; + + std::string nameLink = playerLink(target_name); + + PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str()); + + // to point where player stay (if loaded) + float x,y,z,o; + uint32 map; + bool in_flight; + if (!Player::LoadPositionFromDB(map,x,y,z,o,in_flight,target_guid)) + return false; + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(map, x, y, z,_player->GetOrientation()); + } + + return true; +} + +// Teleport player to last position +bool ChatHandler::HandleRecallCommand(const char* args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + if (target->IsBeingTeleported()) + { + PSendSysMessage(LANG_IS_TELEPORTED, GetNameLink(target).c_str()); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + + target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO); + return true; +} + +//Edit Player HP +bool ChatHandler::HandleModifyHPCommand(const char* args) +{ + if (!*args) + return false; + + int32 hp = atoi((char*)args); + int32 hpm = atoi((char*)args); + + if (hp < 1 || hpm < 1 || hpm < hp) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_CHANGE_HP, GetNameLink(chr).c_str(), hp, hpm); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_HP_CHANGED, GetNameLink().c_str(), hp, hpm); + + chr->SetMaxHealth(hpm); + chr->SetHealth(hp); + + return true; +} + +//Edit Player Mana +bool ChatHandler::HandleModifyManaCommand(const char* args) +{ + if (!*args) + return false; + + // char* pmana = strtok((char*)args, " "); + // if (!pmana) + // return false; + + // char* pmanaMax = strtok(NULL, " "); + // if (!pmanaMax) + // return false; + + // int32 manam = atoi(pmanaMax); + // int32 mana = atoi(pmana); + int32 mana = atoi((char*)args); + int32 manam = atoi((char*)args); + + if (mana <= 0 || manam <= 0 || manam < mana) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_CHANGE_MANA, GetNameLink(chr).c_str(), mana, manam); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_MANA_CHANGED, GetNameLink().c_str(), mana, manam); + + chr->SetMaxPower(POWER_MANA,manam); + chr->SetPower(POWER_MANA, mana); + + return true; +} + +//Edit Player Energy +bool ChatHandler::HandleModifyEnergyCommand(const char* args) +{ + if (!*args) + return false; + + // char* pmana = strtok((char*)args, " "); + // if (!pmana) + // return false; + + // char* pmanaMax = strtok(NULL, " "); + // if (!pmanaMax) + // return false; + + // int32 manam = atoi(pmanaMax); + // int32 mana = atoi(pmana); + + int32 energy = atoi((char*)args)*10; + int32 energym = atoi((char*)args)*10; + + if (energy <= 0 || energym <= 0 || energym < energy) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (!chr) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_CHANGE_ENERGY, GetNameLink(chr).c_str(), energy/10, energym/10); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, GetNameLink().c_str(), energy/10, energym/10); + + chr->SetMaxPower(POWER_ENERGY,energym); + chr->SetPower(POWER_ENERGY, energy); + + sLog.outDetail(GetTrinityString(LANG_CURRENT_ENERGY),chr->GetMaxPower(POWER_ENERGY)); + + return true; +} + +//Edit Player Rage +bool ChatHandler::HandleModifyRageCommand(const char* args) +{ + if (!*args) + return false; + + // char* pmana = strtok((char*)args, " "); + // if (!pmana) + // return false; + + // char* pmanaMax = strtok(NULL, " "); + // if (!pmanaMax) + // return false; + + // int32 manam = atoi(pmanaMax); + // int32 mana = atoi(pmana); + + int32 rage = atoi((char*)args)*10; + int32 ragem = atoi((char*)args)*10; + + if (rage <= 0 || ragem <= 0 || ragem < rage) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_CHANGE_RAGE, GetNameLink(chr).c_str(), rage/10, ragem/10); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, GetNameLink().c_str(), rage/10, ragem/10); + + chr->SetMaxPower(POWER_RAGE,ragem); + chr->SetPower(POWER_RAGE, rage); + + return true; +} + +// Edit Player Runic Power +bool ChatHandler::HandleModifyRunicPowerCommand(const char* args) +{ + if (!*args) + return false; + + int32 rune = atoi((char*)args)*10; + int32 runem = atoi((char*)args)*10; + + if (rune <= 0 || runem <= 0 || runem < rune) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_YOU_CHANGE_RUNIC_POWER, GetNameLink(chr).c_str(), rune/10, runem/10); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, GetNameLink().c_str(), rune/10, runem/10); + + chr->SetMaxPower(POWER_RUNIC_POWER,runem); + chr->SetPower(POWER_RUNIC_POWER, rune); + + return true; +} + +//Edit Player Faction +bool ChatHandler::HandleModifyFactionCommand(const char* args) +{ + if (!*args) + return false; + + char* pfactionid = extractKeyFromLink((char*)args,"Hfaction"); + + Creature* chr = getSelectedCreature(); + if (!chr) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (!pfactionid) + { + if (chr) + { + uint32 factionid = chr->getFaction(); + uint32 flag = chr->GetUInt32Value(UNIT_FIELD_FLAGS); + uint32 npcflag = chr->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 dyflag = chr->GetUInt32Value(UNIT_DYNAMIC_FLAGS); + PSendSysMessage(LANG_CURRENT_FACTION,chr->GetGUIDLow(),factionid,flag,npcflag,dyflag); + } + return true; + } + + if (!chr) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + uint32 factionid = atoi(pfactionid); + uint32 flag; + + char *pflag = strtok(NULL, " "); + if (!pflag) + flag = chr->GetUInt32Value(UNIT_FIELD_FLAGS); + else + flag = atoi(pflag); + + char* pnpcflag = strtok(NULL, " "); + + uint32 npcflag; + if (!pnpcflag) + npcflag = chr->GetUInt32Value(UNIT_NPC_FLAGS); + else + npcflag = atoi(pnpcflag); + + char* pdyflag = strtok(NULL, " "); + + uint32 dyflag; + if (!pdyflag) + dyflag = chr->GetUInt32Value(UNIT_DYNAMIC_FLAGS); + else + dyflag = atoi(pdyflag); + + if (!sFactionTemplateStore.LookupEntry(factionid)) + { + PSendSysMessage(LANG_WRONG_FACTION, factionid); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_YOU_CHANGE_FACTION, chr->GetGUIDLow(),factionid,flag,npcflag,dyflag); + + chr->setFaction(factionid); + chr->SetUInt32Value(UNIT_FIELD_FLAGS,flag); + chr->SetUInt32Value(UNIT_NPC_FLAGS,npcflag); + chr->SetUInt32Value(UNIT_DYNAMIC_FLAGS,dyflag); + + return true; +} + +//Edit Player Spell +bool ChatHandler::HandleModifySpellCommand(const char* args) +{ + if (!*args) return false; + char* pspellflatid = strtok((char*)args, " "); + if (!pspellflatid) + return false; + + char* pop = strtok(NULL, " "); + if (!pop) + return false; + + char* pval = strtok(NULL, " "); + if (!pval) + return false; + + uint16 mark; + + char* pmark = strtok(NULL, " "); + + uint8 spellflatid = atoi(pspellflatid); + uint8 op = atoi(pop); + uint16 val = atoi(pval); + if (!pmark) + mark = 65535; + else + mark = atoi(pmark); + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, GetNameLink().c_str(), spellflatid, val, mark); + + WorldPacket data(SMSG_SET_FLAT_SPELL_MODIFIER, (1+1+2+2)); + data << uint8(spellflatid); + data << uint8(op); + data << uint16(val); + data << uint16(mark); + chr->GetSession()->SendPacket(&data); + + return true; +} + +//Edit Player TP +bool ChatHandler::HandleModifyTalentCommand (const char* args) +{ + if (!*args) + return false; + + int tp = atoi((char*)args); + if (tp < 0) + return false; + + Unit* target = getSelectedUnit(); + if (!target) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + // check online security + if (HasLowerSecurity((Player*)target, 0)) + return false; + target->ToPlayer()->SetFreeTalentPoints(tp); + target->ToPlayer()->SendTalentsInfoData(false); + return true; + } + else if (target->ToCreature()->isPet()) + { + Unit *owner = target->GetOwner(); + if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor(owner->ToPlayer())) + { + // check online security + if (HasLowerSecurity((Player*)owner, 0)) + return false; + ((Pet *)target)->SetFreeTalentPoints(tp); + owner->ToPlayer()->SendTalentsInfoData(true); + return true; + } + } + + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; +} + +//Enable On\OFF all taxi paths +bool ChatHandler::HandleTaxiCheatCommand(const char* args) +{ + if (!*args) + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + std::string argstr = (char*)args; + + Player *chr = getSelectedPlayer(); + if (!chr) + { + chr=m_session->GetPlayer(); + } + + // check online security + else if (HasLowerSecurity(chr, 0)) + return false; + + if (argstr == "on") + { + chr->SetTaxiCheater(true); + PSendSysMessage(LANG_YOU_GIVE_TAXIS, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetNameLink().c_str()); + return true; + } + + if (argstr == "off") + { + chr->SetTaxiCheater(false); + PSendSysMessage(LANG_YOU_REMOVE_TAXIS, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetNameLink().c_str()); + + return true; + } + + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; +} + +//Edit Player Aspeed +bool ChatHandler::HandleModifyASpeedCommand(const char* args) +{ + if (!*args) + return false; + + float ASpeed = (float)atof((char*)args); + + if (ASpeed > 50.0f || ASpeed < 0.1f) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + std::string chrNameLink = GetNameLink(chr); + + if (chr->isInFlight()) + { + PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_YOU_CHANGE_ASPEED, ASpeed, chrNameLink.c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, GetNameLink().c_str(), ASpeed); + + chr->SetSpeed(MOVE_WALK, ASpeed,true); + chr->SetSpeed(MOVE_RUN, ASpeed,true); + chr->SetSpeed(MOVE_SWIM, ASpeed,true); + //chr->SetSpeed(MOVE_TURN, ASpeed,true); + chr->SetSpeed(MOVE_FLIGHT, ASpeed,true); + return true; +} + +//Edit Player Speed +bool ChatHandler::HandleModifySpeedCommand(const char* args) +{ + if (!*args) + return false; + + float Speed = (float)atof((char*)args); + + if (Speed > 50.0f || Speed < 0.1f) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + std::string chrNameLink = GetNameLink(chr); + + if (chr->isInFlight()) + { + PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_YOU_CHANGE_SPEED, Speed, chrNameLink.c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, GetNameLink().c_str(), Speed); + + chr->SetSpeed(MOVE_RUN,Speed,true); + + return true; +} + +//Edit Player Swim Speed +bool ChatHandler::HandleModifySwimCommand(const char* args) +{ + if (!*args) + return false; + + float Swim = (float)atof((char*)args); + + if (Swim > 50.0f || Swim < 0.1f) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + std::string chrNameLink = GetNameLink(chr); + + if (chr->isInFlight()) + { + PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, Swim, chrNameLink.c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, GetNameLink().c_str(), Swim); + + chr->SetSpeed(MOVE_SWIM,Swim,true); + + return true; +} + +//Edit Player Walk Speed +bool ChatHandler::HandleModifyBWalkCommand(const char* args) +{ + if (!*args) + return false; + + float BSpeed = (float)atof((char*)args); + + if (BSpeed > 50.0f || BSpeed < 0.1f) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + std::string chrNameLink = GetNameLink(chr); + + if (chr->isInFlight()) + { + PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, BSpeed, chrNameLink.c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetNameLink().c_str(), BSpeed); + + chr->SetSpeed(MOVE_RUN_BACK,BSpeed,true); + + return true; +} + +//Edit Player Fly +bool ChatHandler::HandleModifyFlyCommand(const char* args) +{ + if (!*args) + return false; + + float FSpeed = (float)atof((char*)args); + + if (FSpeed > 50.0f || FSpeed < 0.1f) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), FSpeed); + + chr->SetSpeed(MOVE_FLIGHT,FSpeed,true); + + return true; +} + +//Edit Player Scale +bool ChatHandler::HandleModifyScaleCommand(const char* args) +{ + if (!*args) + return false; + + float Scale = (float)atof((char*)args); + if (Scale > 10.0f || Scale < 0.1f) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, GetNameLink().c_str(), Scale); + + chr->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale); + + return true; +} + +//Enable Player mount +bool ChatHandler::HandleModifyMountCommand(const char* args) +{ + if (!*args) + return false; + + uint16 mId = 1147; + float speed = (float)15; + uint32 num = 0; + + num = atoi((char*)args); + switch(num) + { + case 1: + mId=14340; + break; + case 2: + mId=4806; + break; + case 3: + mId=6471; + break; + case 4: + mId=12345; + break; + case 5: + mId=6472; + break; + case 6: + mId=6473; + break; + case 7: + mId=10670; + break; + case 8: + mId=10719; + break; + case 9: + mId=10671; + break; + case 10: + mId=10672; + break; + case 11: + mId=10720; + break; + case 12: + mId=14349; + break; + case 13: + mId=11641; + break; + case 14: + mId=12244; + break; + case 15: + mId=12242; + break; + case 16: + mId=14578; + break; + case 17: + mId=14579; + break; + case 18: + mId=14349; + break; + case 19: + mId=12245; + break; + case 20: + mId=14335; + break; + case 21: + mId=207; + break; + case 22: + mId=2328; + break; + case 23: + mId=2327; + break; + case 24: + mId=2326; + break; + case 25: + mId=14573; + break; + case 26: + mId=14574; + break; + case 27: + mId=14575; + break; + case 28: + mId=604; + break; + case 29: + mId=1166; + break; + case 30: + mId=2402; + break; + case 31: + mId=2410; + break; + case 32: + mId=2409; + break; + case 33: + mId=2408; + break; + case 34: + mId=2405; + break; + case 35: + mId=14337; + break; + case 36: + mId=6569; + break; + case 37: + mId=10661; + break; + case 38: + mId=10666; + break; + case 39: + mId=9473; + break; + case 40: + mId=9476; + break; + case 41: + mId=9474; + break; + case 42: + mId=14374; + break; + case 43: + mId=14376; + break; + case 44: + mId=14377; + break; + case 45: + mId=2404; + break; + case 46: + mId=2784; + break; + case 47: + mId=2787; + break; + case 48: + mId=2785; + break; + case 49: + mId=2736; + break; + case 50: + mId=2786; + break; + case 51: + mId=14347; + break; + case 52: + mId=14346; + break; + case 53: + mId=14576; + break; + case 54: + mId=9695; + break; + case 55: + mId=9991; + break; + case 56: + mId=6448; + break; + case 57: + mId=6444; + break; + case 58: + mId=6080; + break; + case 59: + mId=6447; + break; + case 60: + mId=4805; + break; + case 61: + mId=9714; + break; + case 62: + mId=6448; + break; + case 63: + mId=6442; + break; + case 64: + mId=14632; + break; + case 65: + mId=14332; + break; + case 66: + mId=14331; + break; + case 67: + mId=8469; + break; + case 68: + mId=2830; + break; + case 69: + mId=2346; + break; + default: + SendSysMessage(LANG_NO_MOUNT); + SetSentErrorMessage(true); + return false; + } + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + PSendSysMessage(LANG_YOU_GIVE_MOUNT, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_MOUNT_GIVED, GetNameLink().c_str()); + + chr->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); + chr->Mount(mId); + + WorldPacket data(SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4)); + data.append(chr->GetPackGUID()); + data << (uint32)0; + data << (uint8)0; //new 2.1.0 + data << float(speed); + chr->SendMessageToSet(&data, true); + + data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, (8+4+4)); + data.append(chr->GetPackGUID()); + data << (uint32)0; + data << float(speed); + chr->SendMessageToSet(&data, true); + + return true; +} + +//Edit Player money +bool ChatHandler::HandleModifyMoneyCommand(const char* args) +{ + if (!*args) + return false; + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(chr, 0)) + return false; + + int32 addmoney = atoi((char*)args); + + uint32 moneyuser = chr->GetMoney(); + + if (addmoney < 0) + { + int32 newmoney = int32(moneyuser) + addmoney; + + sLog.outDetail(GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney); + if (newmoney <= 0) + { + PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_ALL_MONEY_GONE, GetNameLink().c_str()); + + chr->SetMoney(0); + } + else + { + if (newmoney > MAX_MONEY_AMOUNT) + newmoney = MAX_MONEY_AMOUNT; + + PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), abs(addmoney)); + chr->SetMoney(newmoney); + } + } + else + { + PSendSysMessage(LANG_YOU_GIVE_MONEY, addmoney, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetNameLink().c_str(), addmoney); + + if (addmoney >=MAX_MONEY_AMOUNT) + chr->SetMoney(MAX_MONEY_AMOUNT); + else + chr->ModifyMoney(addmoney); + } + + sLog.outDetail(GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney()); + + return true; +} + +//Edit Unit field +bool ChatHandler::HandleModifyBitCommand(const char* args) +{ + if (!*args) + return false; + + Unit *unit = getSelectedUnit(); + if (!unit) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (unit->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity(unit->ToPlayer(), 0)) + return false; + + char* pField = strtok((char*)args, " "); + if (!pField) + return false; + + char* pBit = strtok(NULL, " "); + if (!pBit) + return false; + + uint16 field = atoi(pField); + uint32 bit = atoi(pBit); + + if (field < OBJECT_END || field >= unit->GetValuesCount()) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + if (bit < 1 || bit > 32) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + if (unit->HasFlag(field, (1<<(bit-1)))) + { + unit->RemoveFlag(field, (1<<(bit-1))); + PSendSysMessage(LANG_REMOVE_BIT, bit, field); + } + else + { + unit->SetFlag(field, (1<<(bit-1))); + PSendSysMessage(LANG_SET_BIT, bit, field); + } + return true; +} + +bool ChatHandler::HandleModifyHonorCommand (const char* args) +{ + if (!*args) + return false; + + Player *target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + int32 amount = (uint32)atoi(args); + + target->ModifyHonorPoints(amount); + + PSendSysMessage(LANG_COMMAND_MODIFY_HONOR, GetNameLink(target).c_str(), target->GetHonorPoints()); + + return true; +} + +bool ChatHandler::HandleTeleCommand(const char * args) +{ + if (!*args) + return false; + + Player* _player = m_session->GetPlayer(); + + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r + GameTele const* tele = extractGameTeleFromLink((char*)args); + + if (!tele) + { + SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); + SetSentErrorMessage(true); + return false; + } + + if (_player->isInCombat()) + { + SendSysMessage(LANG_YOU_IN_COMBAT); + SetSentErrorMessage(true); + return false; + } + + MapEntry const * me = sMapStore.LookupEntry(tele->mapId); + if (!me || me->IsBattleGroundOrArena()) + { + SendSysMessage(LANG_CANNOT_TELE_TO_BG); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); + return true; +} + +bool ChatHandler::HandleLookupAreaCommand(const char* args) +{ + if (!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + if (!Utf8toWStr (namepart,wnamepart)) + return false; + + bool found = false; + + // converting string that we try to find to lower case + wstrToLower (wnamepart); + + // Search in AreaTable.dbc + for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag) + { + AreaTableEntry const *areaEntry = sAreaStore.LookupEntry (areaflag); + if (areaEntry) + { + int loc = GetSessionDbcLocale (); + std::string name = areaEntry->area_name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo (name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale ()) + continue; + + name = areaEntry->area_name[loc]; + if (name.empty ()) + continue; + + if (Utf8FitTo (name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + // send area in "id - [name]" format + std::ostringstream ss; + if (m_session) + ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r"; + else + ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; + + SendSysMessage (ss.str ().c_str()); + + if (!found) + found = true; + } + } + } + + if (!found) + SendSysMessage (LANG_COMMAND_NOAREAFOUND); + + return true; +} + +//Find tele in game_tele order by name +bool ChatHandler::HandleLookupTeleCommand(const char * args) +{ + if (!*args) + { + SendSysMessage(LANG_COMMAND_TELE_PARAMETER); + SetSentErrorMessage(true); + return false; + } + + char const* str = strtok((char*)args, " "); + if (!str) + return false; + + std::string namepart = str; + std::wstring wnamepart; + + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wnamepart); + + std::ostringstream reply; + + GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); + for (GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) + { + GameTele const* tele = &itr->second; + + if (tele->wnameLow.find(wnamepart) == std::wstring::npos) + continue; + + if (m_session) + reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n"; + else + reply << " " << itr->first << " " << tele->name << "\n"; + } + + if (reply.str().empty()) + SendSysMessage(LANG_COMMAND_TELE_NOLOCATION); + else + PSendSysMessage(LANG_COMMAND_TELE_LOCATION,reply.str().c_str()); + + return true; +} + +//Enable\Dissable accept whispers (for GM) +bool ChatHandler::HandleWhispersCommand(const char* args) +{ + if (!*args) + { + PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF)); + return true; + } + + std::string argstr = (char*)args; + // whisper on + if (argstr == "on") + { + m_session->GetPlayer()->SetAcceptWhispers(true); + SendSysMessage(LANG_COMMAND_WHISPERON); + return true; + } + + // whisper off + if (argstr == "off") + { + m_session->GetPlayer()->SetAcceptWhispers(false); + SendSysMessage(LANG_COMMAND_WHISPEROFF); + return true; + } + + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; +} + +//Save all players in the world +bool ChatHandler::HandleSaveAllCommand(const char* /*args*/) +{ + sObjectAccessor.SaveAllPlayers(); + SendSysMessage(LANG_PLAYERS_SAVED); + return true; +} + +//Send mail by command +bool ChatHandler::HandleSendMailCommand(const char* args) +{ + // format: name "subject text" "mail text" + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char* msgSubject = extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char* msgText = extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + MailDraft(subject, text) + .SendMailTo(MailReceiver(target,GUID_LOPART(target_guid)),sender); + + std::string nameLink = playerLink(target_name); + PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; +} + +// teleport player to given game_tele.entry +bool ChatHandler::HandleTeleNameCommand(const char * args) +{ + char* nameStr; + char* teleStr; + extractOptFirstArg((char*)args,&nameStr,&teleStr); + if (!teleStr) + return false; + + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name)) + return false; + + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r + GameTele const* tele = extractGameTeleFromLink(teleStr); + if (!tele) + { + SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); + SetSentErrorMessage(true); + return false; + } + +/* MapEntry const * me = sMapStore.LookupEntry(tele->mapId); + if (!me || me->IsBattleGroundOrArena()) + { + SendSysMessage(LANG_CANNOT_TELE_TO_BG); + SetSentErrorMessage(true); + return false; + } + + Player *chr = objmgr.GetPlayer(name.c_str());*/ + + if (target) + { + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + std::string chrNameLink = playerLink(target_name); + + if (target->IsBeingTeleported() == true) + { + PSendSysMessage(LANG_IS_TELEPORTED, chrNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_TELEPORTING_TO, chrNameLink.c_str(),"", tele->name.c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetNameLink().c_str()); + + // stop flight if need + if (target->isInFlight()) + { + target->GetMotionMaster()->MovementExpired(); + target->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + target->SaveRecallPosition(); + + target->TeleportTo(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation); + } + else + { + // check offline security + if (HasLowerSecurity(NULL, target_guid)) + return false; + + std::string nameLink = playerLink(target_name); + + PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetTrinityString(LANG_OFFLINE), tele->name.c_str()); + Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation, + sMapMgr.GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid); + } + + return true; +} + +//Teleport group to given game_tele.entry +bool ChatHandler::HandleTeleGroupCommand(const char * args) +{ + if (!*args) + return false; + + Player *player = getSelectedPlayer(); + if (!player) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(player, 0)) + return false; + + // id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r + GameTele const* tele = extractGameTeleFromLink((char*)args); + if (!tele) + { + SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); + SetSentErrorMessage(true); + return false; + } + + MapEntry const * me = sMapStore.LookupEntry(tele->mapId); + if (!me || me->IsBattleGroundOrArena()) + { + SendSysMessage(LANG_CANNOT_TELE_TO_BG); + SetSentErrorMessage(true); + return false; + } + + std::string nameLink = GetNameLink(player); + + Group *grp = player->GetGroup(); + if (!grp) + { + PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player *pl = itr->getSource(); + + if (!pl || !pl->GetSession()) + continue; + + // check online security + if (HasLowerSecurity(pl, 0)) + return false; + + std::string plNameLink = GetNameLink(pl); + + if (pl->IsBeingTeleported()) + { + PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); + continue; + } + + PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(),"", tele->name.c_str()); + if (needReportToTarget(pl)) + ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str()); + + // stop flight if need + if (pl->isInFlight()) + { + pl->GetMotionMaster()->MovementExpired(); + pl->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + pl->SaveRecallPosition(); + + pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation); + } + + return true; +} + +//Summon group of player +bool ChatHandler::HandleGroupgoCommand(const char* args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + Group *grp = target->GetGroup(); + + std::string nameLink = GetNameLink(target); + + if (!grp) + { + PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + Map* gmMap = m_session->GetPlayer()->GetMap(); + bool to_instance = gmMap->Instanceable(); + + // we are in instance, and can summon only player in our group with us as lead + if (to_instance && ( + !m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) || + (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()))) + // the last check is a bit excessive, but let it be, just in case + { + SendSysMessage(LANG_CANNOT_SUMMON_TO_INST); + SetSentErrorMessage(true); + return false; + } + + for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player *pl = itr->getSource(); + + if (!pl || pl == m_session->GetPlayer() || !pl->GetSession()) + continue; + + // check online security + if (HasLowerSecurity(pl, 0)) + return false; + + std::string plNameLink = GetNameLink(pl); + + if (pl->IsBeingTeleported() == true) + { + PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + if (to_instance) + { + Map* plMap = pl->GetMap(); + + if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId()) + { + // cannot summon from instance to instance + PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,plNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + } + + PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(),""); + if (needReportToTarget(pl)) + ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str()); + + // stop flight if need + if (pl->isInFlight()) + { + pl->GetMotionMaster()->MovementExpired(); + pl->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + pl->SaveRecallPosition(); + + // before GM + float x,y,z; + m_session->GetPlayer()->GetClosePoint(x,y,z,pl->GetObjectSize()); + pl->TeleportTo(m_session->GetPlayer()->GetMapId(),x,y,z,pl->GetOrientation()); + } + + return true; +} + +bool ChatHandler::HandleGoTaxinodeCommand(const char* args) +{ + Player* _player = m_session->GetPlayer(); + + if (!*args) + return false; + + char* cNodeId = extractKeyFromLink((char*)args,"Htaxinode"); + if (!cNodeId) + return false; + + int32 i_nodeId = atoi(cNodeId); + if (!i_nodeId) + return false; + + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i_nodeId); + if (!node) + { + PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND,i_nodeId); + SetSentErrorMessage(true); + return false; + } + + if ((node->x == 0.0f && node->y == 0.0f && node->z == 0.0f) || + !MapManager::IsValidMapCoord(node->map_id,node->x,node->y,node->z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,node->x,node->y,node->map_id); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(node->map_id, node->x, node->y, node->z, _player->GetOrientation()); + return true; +} + +//teleport at coordinates +bool ChatHandler::HandleGoXYCommand(const char* args) +{ + if (!*args) + return false; + + Player* _player = m_session->GetPlayer(); + + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + char* pmapid = strtok(NULL, " "); + + if (!px || !py) + return false; + + float x = (float)atof(px); + float y = (float)atof(py); + uint32 mapid; + if (pmapid) + mapid = (uint32)atoi(pmapid); + else mapid = _player->GetMapId(); + + if (!MapManager::IsValidMapCoord(mapid,x,y)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + Map const *map = sMapMgr.CreateBaseMap(mapid); + float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); + + _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); + + return true; +} + +//teleport at coordinates, including Z +bool ChatHandler::HandleGoXYZCommand(const char* args) +{ + if (!*args) + return false; + + Player* _player = m_session->GetPlayer(); + + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + char* pz = strtok(NULL, " "); + char* pmapid = strtok(NULL, " "); + + if (!px || !py || !pz) + return false; + + float x = (float)atof(px); + float y = (float)atof(py); + float z = (float)atof(pz); + uint32 mapid; + if (pmapid) + mapid = (uint32)atoi(pmapid); + else + mapid = _player->GetMapId(); + + if (!MapManager::IsValidMapCoord(mapid,x,y,z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); + + return true; +} + +//teleport at coordinates +bool ChatHandler::HandleGoZoneXYCommand(const char* args) +{ + if (!*args) + return false; + + Player* _player = m_session->GetPlayer(); + + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + char* tail = strtok(NULL,""); + + char* cAreaId = extractKeyFromLink(tail,"Harea"); // string or [name] Shift-click form |color|Harea:area_id|h[name]|h|r + + if (!px || !py) + return false; + + float x = (float)atof(px); + float y = (float)atof(py); + + // prevent accept wrong numeric args + if ((x == 0.0f && *px != '0') || (y == 0.0f && *py != '0')) + return false; + + uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId(); + + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid); + + if (x<0 || x>100 || y<0 || y>100 || !areaEntry) + { + PSendSysMessage(LANG_INVALID_ZONE_COORD,x,y,areaid); + SetSentErrorMessage(true); + return false; + } + + // update to parent zone if exist (client map show only zones without parents) + AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; + + Map const *map = sMapMgr.CreateBaseMap(zoneEntry->mapid); + + if (map->Instanceable()) + { + PSendSysMessage(LANG_INVALID_ZONE_MAP,areaEntry->ID,areaEntry->area_name[GetSessionDbcLocale()],map->GetId(),map->GetMapName()); + SetSentErrorMessage(true); + return false; + } + + Zone2MapCoordinates(x,y,zoneEntry->ID); + + if (!MapManager::IsValidMapCoord(zoneEntry->mapid,x,y)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,zoneEntry->mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); + _player->TeleportTo(zoneEntry->mapid, x, y, z, _player->GetOrientation()); + + return true; +} + +//teleport to grid +bool ChatHandler::HandleGoGridCommand(const char* args) +{ + if (!*args) return false; + Player* _player = m_session->GetPlayer(); + + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + char* pmapid = strtok(NULL, " "); + + if (!px || !py) + return false; + + float grid_x = (float)atof(px); + float grid_y = (float)atof(py); + uint32 mapid; + if (pmapid) + mapid = (uint32)atoi(pmapid); + else mapid = _player->GetMapId(); + + // center of grid + float x = (grid_x-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS; + float y = (grid_y-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS; + + if (!MapManager::IsValidMapCoord(mapid,x,y)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + Map const *map = sMapMgr.CreateBaseMap(mapid); + float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); + _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); + + return true; +} + +bool ChatHandler::HandleModifyDrunkCommand(const char* args) +{ + if (!*args) return false; + + uint32 drunklevel = (uint32)atoi(args); + if (drunklevel > 100) + drunklevel = 100; + + uint16 drunkMod = drunklevel * 0xFFFF / 100; + + m_session->GetPlayer()->SetDrunkValue(drunkMod); + + return true; +} + diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp new file mode 100644 index 0000000..49a618a --- /dev/null +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -0,0 +1,4728 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" +#include "DatabaseEnv.h" +#include "DBCStores.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "Item.h" +#include "GameObject.h" +#include "Opcodes.h" +#include "Chat.h" +#include "MapManager.h" +#include "Language.h" +#include "World.h" +#include "GameEventMgr.h" +#include "SpellMgr.h" +#include "PoolMgr.h" +#include "AccountMgr.h" +#include "WaypointManager.h" +#include "Util.h" +#include +#include +#include +#include +#include "GlobalEvents.h" +#include "OutdoorPvPWG.h" +#include "OutdoorPvPMgr.h" + +#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand +#include "CreatureGroups.h" + +//mute player for some times +bool ChatHandler::HandleMuteCommand(const char* args) +{ + char* nameStr; + char* delayStr; + extractOptFirstArg((char*)args,&nameStr,&delayStr); + if (!delayStr) + return false; + + char *mutereason = strtok(NULL, "\r"); + std::string mutereasonstr = "No reason"; + if (mutereason != NULL) + mutereasonstr = mutereason; + + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name)) + return false; + + uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld.FindSession(account_id)) + target = session->GetPlayer(); + + uint32 notspeaktime = (uint32) atoi(delayStr); + + // must have strong lesser security level + if (HasLowerSecurity (target,target_guid,true)) + return false; + + time_t mutetime = time(NULL) + notspeaktime*60; + + if (target) + target->GetSession()->m_muteTime = mutetime; + + LoginDatabase.PExecute("UPDATE account SET mutetime = " UI64FMTD " WHERE id = '%u'",uint64(mutetime), account_id); + + if (target) + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str()); + + std::string nameLink = playerLink(target_name); + + PSendSysMessage(LANG_YOU_DISABLE_CHAT, nameLink.c_str(), notspeaktime, mutereasonstr.c_str()); + + return true; +} + +//unmute player +bool ChatHandler::HandleUnmuteCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid); + + // find only player from same account if any + if (!target) + if (WorldSession* session = sWorld.FindSession(account_id)) + target = session->GetPlayer(); + + // must have strong lesser security level + if (HasLowerSecurity (target,target_guid,true)) + return false; + + if (target) + { + if (target->CanSpeak()) + { + SendSysMessage(LANG_CHAT_ALREADY_ENABLED); + SetSentErrorMessage(true); + return false; + } + + target->GetSession()->m_muteTime = 0; + } + + LoginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id); + + if (target) + ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED); + + std::string nameLink = playerLink(target_name); + + PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str()); + return true; +} + +bool ChatHandler::HandleGoTicketCommand(const char * args) +{ + if (!*args) + return false; + + char *cstrticket_id = strtok((char*)args, " "); + + if (!cstrticket_id) + return false; + + uint64 ticket_id = atoi(cstrticket_id); + if (!ticket_id) + return false; + + GM_Ticket *ticket = objmgr.GetGMTicket(ticket_id); + if (!ticket) + { + SendSysMessage(LANG_COMMAND_TICKETNOTEXIST); + return true; + } + + float x, y, z; + int mapid; + + x = ticket->pos_x; + y = ticket->pos_y; + z = ticket->pos_z; + mapid = ticket->map; + + Player* _player = m_session->GetPlayer(); + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + else + _player->SaveRecallPosition(); + + _player->TeleportTo(mapid, x, y, z, 1, 0); + return true; +} + +bool ChatHandler::HandleGoTriggerCommand(const char* args) +{ + Player* _player = m_session->GetPlayer(); + + if (!*args) + return false; + + char *atId = strtok((char*)args, " "); + if (!atId) + return false; + + int32 i_atId = atoi(atId); + + if (!i_atId) + return false; + + AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(i_atId); + if (!at) + { + PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND,i_atId); + SetSentErrorMessage(true); + return false; + } + + if (!MapManager::IsValidMapCoord(at->mapid,at->x,at->y,at->z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,at->x,at->y,at->mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(at->mapid, at->x, at->y, at->z, _player->GetOrientation()); + return true; +} + +bool ChatHandler::HandleGoGraveyardCommand(const char* args) +{ + Player* _player = m_session->GetPlayer(); + + if (!*args) + return false; + + char *gyId = strtok((char*)args, " "); + if (!gyId) + return false; + + int32 i_gyId = atoi(gyId); + + if (!i_gyId) + return false; + + WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(i_gyId); + if (!gy) + { + PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST,i_gyId); + SetSentErrorMessage(true); + return false; + } + + if (!MapManager::IsValidMapCoord(gy->map_id,gy->x,gy->y,gy->z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,gy->x,gy->y,gy->map_id); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(gy->map_id, gy->x, gy->y, gy->z, _player->GetOrientation()); + return true; +} + +/** \brief Teleport the GM to the specified creature +* +* .gocreature --> TP using creature.guid +* .gocreature azuregos --> TP player to the mob with this name +* Warning: If there is more than one mob with this name +* you will be teleported to the first one that is found. +* .gocreature id 6109 --> TP player to the mob, that has this creature_template.entry +* Warning: If there is more than one mob with this "id" +* you will be teleported to the first one that is found. +*/ +//teleport to creature +bool ChatHandler::HandleGoCreatureCommand(const char* args) +{ + if (!*args) + return false; + Player* _player = m_session->GetPlayer(); + + // "id" or number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r + char* pParam1 = extractKeyFromLink((char*)args,"Hcreature"); + if (!pParam1) + return false; + + std::ostringstream whereClause; + + // User wants to teleport to the NPC's template entry + if (strcmp(pParam1, "id") == 0) + { + //sLog.outError("DEBUG: ID found"); + + // Get the "creature_template.entry" + // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r + char* tail = strtok(NULL,""); + if (!tail) + return false; + char* cId = extractKeyFromLink(tail,"Hcreature_entry"); + if (!cId) + return false; + + int32 tEntry = atoi(cId); + //sLog.outError("DEBUG: ID value: %d", tEntry); + if (!tEntry) + return false; + + whereClause << "WHERE id = '" << tEntry << "'"; + } + else + { + //sLog.outError("DEBUG: ID *not found*"); + + int32 guid = atoi(pParam1); + + // Number is invalid - maybe the user specified the mob's name + if (!guid) + { + std::string name = pParam1; + WorldDatabase.escape_string(name); + whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << "'"; + } + else + { + whereClause << "WHERE guid = '" << guid << "'"; + } + } + //sLog.outError("DEBUG: %s", whereClause.c_str()); + + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM creature %s", whereClause.str().c_str()); + if (!result) + { + SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND); + SetSentErrorMessage(true); + return false; + } + if (result->GetRowCount() > 1) + SendSysMessage(LANG_COMMAND_GOCREATMULTIPLE); + + Field *fields = result->Fetch(); + float x = fields[0].GetFloat(); + float y = fields[1].GetFloat(); + float z = fields[2].GetFloat(); + float ort = fields[3].GetFloat(); + int mapid = fields[4].GetUInt16(); + + if (!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(mapid, x, y, z, ort); + return true; +} + +//teleport to gameobject +bool ChatHandler::HandleGoObjectCommand(const char* args) +{ + if (!*args) + return false; + + Player* _player = m_session->GetPlayer(); + + // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if (!cId) + return false; + + int32 guid = atoi(cId); + if (!guid) + return false; + + float x, y, z, ort; + int mapid; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(guid)) + { + x = go_data->posX; + y = go_data->posY; + z = go_data->posZ; + ort = go_data->orientation; + mapid = go_data->mapid; + } + else + { + SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND); + SetSentErrorMessage(true); + return false; + } + + if (!MapManager::IsValidMapCoord(mapid,x,y,z,ort)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid); + SetSentErrorMessage(true); + return false; + } + + // stop flight if need + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->CleanupAfterTaxiFlight(); + } + // save only in non-flight case + else + _player->SaveRecallPosition(); + + _player->TeleportTo(mapid, x, y, z, ort); + return true; +} + +bool ChatHandler::HandleGameObjectTargetCommand(const char* args) +{ + Player* pl = m_session->GetPlayer(); + QueryResult_AutoPtr result; + GameEventMgr::ActiveEvents const& activeEventsList = gameeventmgr.GetActiveEventList(); + if (*args) + { + // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry"); + if (!cId) + return false; + + uint32 id = atol(cId); + + if (id) + result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(),id); + else + { + std::string name = cId; + WorldDatabase.escape_string(name); + result = WorldDatabase.PQuery( + "SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ " + "FROM gameobject,gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'")" ORDER BY order_ ASC LIMIT 1", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(),name.c_str()); + } + } + else + { + std::ostringstream eventFilter; + eventFilter << " AND (event IS NULL "; + bool initString = true; + + for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr) + { + if (initString) + { + eventFilter << "OR event IN (" <<*itr; + initString =false; + } + else + eventFilter << "," << *itr; + } + + if (!initString) + eventFilter << "))"; + else + eventFilter << ")"; + + result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, phaseMask, " + "(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject " + "LEFT OUTER JOIN game_event_gameobject on gameobject.guid=game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10", + m_session->GetPlayer()->GetPositionX(), m_session->GetPlayer()->GetPositionY(), m_session->GetPlayer()->GetPositionZ(), m_session->GetPlayer()->GetMapId(),eventFilter.str().c_str()); + } + + if (!result) + { + SendSysMessage(LANG_COMMAND_TARGETOBJNOTFOUND); + return true; + } + + bool found = false; + float x, y, z, o; + uint32 lowguid, id; + uint16 mapid, pool_id, phase; + + do + { + Field *fields = result->Fetch(); + lowguid = fields[0].GetUInt32(); + id = fields[1].GetUInt32(); + x = fields[2].GetFloat(); + y = fields[3].GetFloat(); + z = fields[4].GetFloat(); + o = fields[5].GetFloat(); + mapid = fields[6].GetUInt16(); + phase = fields[7].GetUInt16(); + pool_id = poolhandler.IsPartOfAPool(lowguid); + if (!pool_id || poolhandler.IsSpawnedObject(lowguid)) + found = true; + } while (result->NextRow() && (!found)); + + if (!found) + { + PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id); + return false; + } + + GameObjectInfo const* goI = objmgr.GetGameObjectInfo(id); + + if (!goI) + { + PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id); + return false; + } + + GameObject* target = m_session->GetPlayer()->GetMap()->GetGameObject(MAKE_NEW_GUID(lowguid,id,HIGHGUID_GAMEOBJECT)); + + PSendSysMessage(LANG_GAMEOBJECT_DETAIL, lowguid, goI->name, lowguid, id, x, y, z, mapid, o, phase); + + if (target) + { + int32 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); + if (curRespawnDelay < 0) + curRespawnDelay = 0; + + std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay,true); + std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(),true); + + PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(),curRespawnDelayStr.c_str()); + } + return true; +} + +//delete object by selection or guid +bool ChatHandler::HandleGameObjectDeleteCommand(const char* args) +{ + // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if (!cId) + return false; + + uint32 lowguid = atoi(cId); + if (!lowguid) + return false; + + GameObject* obj = NULL; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + + if (!obj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + + uint64 owner_guid = obj->GetOwnerGUID(); + if (owner_guid) + { + Unit* owner = ObjectAccessor::GetUnit(*m_session->GetPlayer(),owner_guid); + if (!owner || !IS_PLAYER_GUID(owner_guid)) + { + PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow()); + SetSentErrorMessage(true); + return false; + } + + owner->RemoveGameObject(obj,false); + } + + obj->SetRespawnTime(0); // not save respawn time + obj->Delete(); + obj->DeleteFromDB(); + + PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow()); + + return true; +} + +//turn selected object +bool ChatHandler::HandleGameObjectTurnCommand(const char* args) +{ + // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if (!cId) + return false; + + uint32 lowguid = atoi(cId); + if (!lowguid) + return false; + + GameObject* obj = NULL; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + + if (!obj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + + char* po = strtok(NULL, " "); + float o; + + if (po) + { + o = (float)atof(po); + } + else + { + Player *chr = m_session->GetPlayer(); + o = chr->GetOrientation(); + } + + obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o); + obj->UpdateRotationFields(); + obj->DestroyForNearbyPlayers(); + obj->UpdateObjectVisibility(); + + obj->SaveToDB(); + obj->Refresh(); + + PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow(), o); + + return true; +} + +//move selected object +bool ChatHandler::HandleGameObjectMoveCommand(const char* args) +{ + // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if (!cId) + return false; + + uint32 lowguid = atoi(cId); + if (!lowguid) + return false; + + GameObject* obj = NULL; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + + if (!obj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + + char* px = strtok(NULL, " "); + char* py = strtok(NULL, " "); + char* pz = strtok(NULL, " "); + + if (!px) + { + Player *chr = m_session->GetPlayer(); + obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation()); + obj->DestroyForNearbyPlayers(); + obj->UpdateObjectVisibility(); + } + else + { + if (!py || !pz) + return false; + + float x = (float)atof(px); + float y = (float)atof(py); + float z = (float)atof(pz); + + if (!MapManager::IsValidMapCoord(obj->GetMapId(),x,y,z)) + { + PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,obj->GetMapId()); + SetSentErrorMessage(true); + return false; + } + + obj->Relocate(x, y, z, obj->GetOrientation()); + obj->DestroyForNearbyPlayers(); + obj->UpdateObjectVisibility(); + } + + obj->SaveToDB(); + obj->Refresh(); + + PSendSysMessage(LANG_COMMAND_MOVEOBJMESSAGE, obj->GetGUIDLow(), obj->GetGOInfo()->name, obj->GetGUIDLow()); + + return true; +} + +//spawn go +bool ChatHandler::HandleGameObjectAddCommand(const char* args) +{ + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry"); + if (!cId) + return false; + + uint32 id = atol(cId); + if (!id) + return false; + + char* spawntimeSecs = strtok(NULL, " "); + + const GameObjectInfo *gInfo = objmgr.GetGameObjectInfo(id); + + if (!gInfo) + { + PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id); + SetSentErrorMessage(true); + return false; + } + + if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) + { + // report to DB errors log as in loading case + sLog.outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.",id, gInfo->type, gInfo->displayId); + PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA,id); + SetSentErrorMessage(true); + return false; + } + + Player *chr = m_session->GetPlayer(); + float x = float(chr->GetPositionX()); + float y = float(chr->GetPositionY()); + float z = float(chr->GetPositionZ()); + float o = float(chr->GetOrientation()); + Map *map = chr->GetMap(); + + GameObject* pGameObj = new GameObject; + uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); + + if (!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) + { + delete pGameObj; + return false; + } + + if (spawntimeSecs) + { + uint32 value = atoi((char*)spawntimeSecs); + pGameObj->SetRespawnTime(value); + //sLog.outDebug("*** spawntimeSecs: %d", value); + } + + // fill the gameobject data and save to the db + pGameObj->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()),chr->GetPhaseMaskForSpawn()); + + // this will generate a new guid if the object is in an instance + if (!pGameObj->LoadFromDB(db_lowGUID, map)) + { + delete pGameObj; + return false; + } + + sLog.outDebug(GetTrinityString(LANG_GAMEOBJECT_CURRENT), gInfo->name, db_lowGUID, x, y, z, o); + + map->Add(pGameObj); + + // TODO: is it really necessary to add both the real and DB table guid here ? + objmgr.AddGameobjectToGrid(db_lowGUID, objmgr.GetGOData(db_lowGUID)); + + PSendSysMessage(LANG_GAMEOBJECT_ADD,id,gInfo->name,db_lowGUID,x,y,z); + return true; +} + +//set pahsemask for selected object +bool ChatHandler::HandleGameObjectPhaseCommand(const char* args) +{ + // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if (!cId) + return false; + + uint32 lowguid = atoi(cId); + if (!lowguid) + return false; + + GameObject* obj = NULL; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + + if (!obj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + + char* phaseStr = strtok (NULL, " "); + uint32 phasemask = phaseStr? atoi(phaseStr) : 0; + if (phasemask == 0) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + obj->SetPhaseMask(phasemask,true); + obj->SaveToDB(); + return true; +} + +bool ChatHandler::HandleGameObjectNearCommand(const char* args) +{ + float distance = (!*args) ? 10 : atol(args); + uint32 count = 0; + + Player* pl = m_session->GetPlayer(); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, " + "(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ " + "FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), + pl->GetMapId(),pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),distance*distance); + + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + uint32 entry = fields[1].GetUInt32(); + float x = fields[2].GetFloat(); + float y = fields[3].GetFloat(); + float z = fields[4].GetFloat(); + int mapid = fields[5].GetUInt16(); + + GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(entry); + + if (!gInfo) + continue; + + PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid); + + ++count; + } while (result->NextRow()); + } + + PSendSysMessage(LANG_COMMAND_NEAROBJMESSAGE,distance,count); + return true; +} + +bool ChatHandler::HandleGUIDCommand(const char* /*args*/) +{ + uint64 guid = m_session->GetPlayer()->GetSelection(); + + if (guid == 0) + { + SendSysMessage(LANG_NO_SELECTION); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid)); + return true; +} + +bool ChatHandler::HandleModifyRepCommand(const char * args) +{ + if (!*args) return false; + + Player* target = NULL; + target = getSelectedPlayer(); + + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + char* factionTxt = extractKeyFromLink((char*)args,"Hfaction"); + if (!factionTxt) + return false; + + uint32 factionId = atoi(factionTxt); + + int32 amount = 0; + char *rankTxt = strtok(NULL, " "); + if (!factionTxt || !rankTxt) + return false; + + amount = atoi(rankTxt); + if ((amount == 0) && (rankTxt[0] != '-') && !isdigit(rankTxt[0])) + { + std::string rankStr = rankTxt; + std::wstring wrankStr; + if (!Utf8toWStr(rankStr,wrankStr)) + return false; + wstrToLower(wrankStr); + + int r = 0; + amount = -42000; + for (; r < MAX_REPUTATION_RANK; ++r) + { + std::string rank = GetTrinityString(ReputationRankStrIndex[r]); + if (rank.empty()) + continue; + + std::wstring wrank; + if (!Utf8toWStr(rank,wrank)) + continue; + + wstrToLower(wrank); + + if (wrank.substr(0,wrankStr.size()) == wrankStr) + { + char *deltaTxt = strtok(NULL, " "); + if (deltaTxt) + { + int32 delta = atoi(deltaTxt); + if ((delta < 0) || (delta > ReputationMgr::PointsInRank[r] -1)) + { + PSendSysMessage(LANG_COMMAND_FACTION_DELTA, (ReputationMgr::PointsInRank[r]-1)); + SetSentErrorMessage(true); + return false; + } + amount += delta; + } + break; + } + amount += ReputationMgr::PointsInRank[r]; + } + if (r >= MAX_REPUTATION_RANK) + { + PSendSysMessage(LANG_COMMAND_FACTION_INVPARAM, rankTxt); + SetSentErrorMessage(true); + return false; + } + } + + FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionId); + + if (!factionEntry) + { + PSendSysMessage(LANG_COMMAND_FACTION_UNKNOWN, factionId); + SetSentErrorMessage(true); + return false; + } + + if (factionEntry->reputationListID < 0) + { + PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name[GetSessionDbcLocale()], factionId); + SetSentErrorMessage(true); + return false; + } + + target->GetReputationMgr().SetReputation(factionEntry,amount); + PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[GetSessionDbcLocale()], factionId, + GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry)); + return true; +} + +//-----------------------Npc Commands----------------------- +//add spawn of creature +bool ChatHandler::HandleNpcAddCommand(const char* args) +{ + if (!*args) + return false; + char* charID = extractKeyFromLink((char*)args,"Hcreature_entry"); + if (!charID) + return false; + + char* team = strtok(NULL, " "); + int32 teamval = 0; + if (team) { teamval = atoi(team); } + if (teamval < 0) { teamval = 0; } + + uint32 id = atoi(charID); + + Player *chr = m_session->GetPlayer(); + float x = chr->GetPositionX(); + float y = chr->GetPositionY(); + float z = chr->GetPositionZ(); + float o = chr->GetOrientation(); + Map *map = chr->GetMap(); + + Creature* pCreature = new Creature; + if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o)) + { + delete pCreature; + return false; + } + + pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + + uint32 db_guid = pCreature->GetDBTableGUIDLow(); + + // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); + pCreature->LoadFromDB(db_guid, map); + + map->Add(pCreature); + objmgr.AddCreatureToGrid(db_guid, objmgr.GetCreatureData(db_guid)); + return true; +} + +//add item in vendorlist +bool ChatHandler::HandleNpcAddVendorItemCommand(const char* args) +{ + if (!*args) + return false; + + char* pitem = extractKeyFromLink((char*)args,"Hitem"); + if (!pitem) + { + SendSysMessage(LANG_COMMAND_NEEDITEMSEND); + SetSentErrorMessage(true); + return false; + } + + uint32 itemId = atol(pitem); + + char* fmaxcount = strtok(NULL, " "); //add maxcount, default: 0 + uint32 maxcount = 0; + if (fmaxcount) + maxcount = atol(fmaxcount); + + char* fincrtime = strtok(NULL, " "); //add incrtime, default: 0 + uint32 incrtime = 0; + if (fincrtime) + incrtime = atol(fincrtime); + + char* fextendedcost = strtok(NULL, " "); //add ExtendedCost, default: 0 + uint32 extendedcost = fextendedcost ? atol(fextendedcost) : 0; + + Creature* vendor = getSelectedCreature(); + + uint32 vendor_entry = vendor ? vendor->GetEntry() : 0; + + if (!objmgr.IsVendorItemValid(vendor_entry,itemId,maxcount,incrtime,extendedcost,m_session->GetPlayer())) + { + SetSentErrorMessage(true); + return false; + } + + objmgr.AddVendorItem(vendor_entry,itemId,maxcount,incrtime,extendedcost); + + ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); + + PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime,extendedcost); + return true; +} + +//del item from vendor list +bool ChatHandler::HandleNpcDelVendorItemCommand(const char* args) +{ + if (!*args) + return false; + + Creature* vendor = getSelectedCreature(); + if (!vendor || !vendor->isVendor()) + { + SendSysMessage(LANG_COMMAND_VENDORSELECTION); + SetSentErrorMessage(true); + return false; + } + + char* pitem = extractKeyFromLink((char*)args,"Hitem"); + if (!pitem) + { + SendSysMessage(LANG_COMMAND_NEEDITEMSEND); + SetSentErrorMessage(true); + return false; + } + uint32 itemId = atol(pitem); + + if (!objmgr.RemoveVendorItem(vendor->GetEntry(),itemId)) + { + PSendSysMessage(LANG_ITEM_NOT_IN_LIST,itemId); + SetSentErrorMessage(true); + return false; + } + + ItemPrototype const* pProto = objmgr.GetItemPrototype(itemId); + + PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST,itemId,pProto->Name1); + return true; +} + +//add move for creature +bool ChatHandler::HandleNpcAddMoveCommand(const char* args) +{ + if (!*args) + return false; + + char* guid_str = strtok((char*)args, " "); + char* wait_str = strtok((char*)NULL, " "); + + uint32 lowguid = atoi((char*)guid_str); + + Creature* pCreature = NULL; + + /* FIXME: impossible without entry + if (lowguid) + pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT)); + */ + + // attempt check creature existence by DB data + if (!pCreature) + { + CreatureData const* data = objmgr.GetCreatureData(lowguid); + if (!data) + { + PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + } + else + { + // obtain real GUID for DB operations + lowguid = pCreature->GetDBTableGUIDLow(); + } + + int wait = wait_str ? atoi(wait_str) : 0; + + if (wait < 0) + wait = 0; + + //Player* player = m_session->GetPlayer(); + + //WaypointMgr.AddLastNode(lowguid, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), wait, 0); + + // update movement type + WorldDatabase.PExecuteLog("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE,lowguid); + if (pCreature && pCreature->GetWaypointPath()) + { + pCreature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); + pCreature->GetMotionMaster()->Initialize(); + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + { + pCreature->setDeathState(JUST_DIED); + pCreature->Respawn(true); + } + pCreature->SaveToDB(); + } + + SendSysMessage(LANG_WAYPOINT_ADDED); + + return true; +} + +//change level of creature or pet +bool ChatHandler::HandleNpcChangeLevelCommand(const char* args) +{ + if (!*args) + return false; + + uint8 lvl = (uint8) atoi((char*)args); + if (lvl < 1 || lvl > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) + 3) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Creature* pCreature = getSelectedCreature(); + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (pCreature->isPet()) + { + if (((Pet*)pCreature)->getPetType() == HUNTER_PET) + { + pCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(lvl)/4); + pCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); + } + ((Pet*)pCreature)->GivePetLevel(lvl); + } + else + { + pCreature->SetMaxHealth(100 + 30*lvl); + pCreature->SetHealth(100 + 30*lvl); + pCreature->SetLevel(lvl); + pCreature->SaveToDB(); + } + + return true; +} + +//set npcflag of creature +bool ChatHandler::HandleNpcFlagCommand(const char* args) +{ + if (!*args) + return false; + + uint32 npcFlags = (uint32) atoi((char*)args); + + Creature* pCreature = getSelectedCreature(); + + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pCreature->SetUInt32Value(UNIT_NPC_FLAGS, npcFlags); + + WorldDatabase.PExecuteLog("UPDATE creature_template SET npcflag = '%u' WHERE entry = '%u'", npcFlags, pCreature->GetEntry()); + + SendSysMessage(LANG_VALUE_SAVED_REJOIN); + + return true; +} + +bool ChatHandler::HandleNpcDeleteCommand(const char* args) +{ + Creature* unit = NULL; + + if (*args) + { + // number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hcreature"); + if (!cId) + return false; + + uint32 lowguid = atoi(cId); + if (!lowguid) + return false; + + if (CreatureData const* cr_data = objmgr.GetCreatureData(lowguid)) + unit = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + } + else + unit = getSelectedCreature(); + + if (!unit || unit->isPet() || unit->isTotem()) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + // Delete the creature + unit->CombatStop(); + unit->DeleteFromDB(); + unit->AddObjectToRemoveList(); + + SendSysMessage(LANG_COMMAND_DELCREATMESSAGE); + + return true; +} + +//move selected creature +bool ChatHandler::HandleNpcMoveCommand(const char* args) +{ + uint32 lowguid = 0; + + Creature* pCreature = getSelectedCreature(); + + if (!pCreature) + { + // number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hcreature"); + if (!cId) + return false; + + lowguid = atoi(cId); + + /* FIXME: impossibel without entry + if (lowguid) + pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT)); + */ + + // Attempting creature load from DB data + if (!pCreature) + { + CreatureData const* data = objmgr.GetCreatureData(lowguid); + if (!data) + { + PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + + uint32 map_id = data->mapid; + + if (m_session->GetPlayer()->GetMapId() != map_id) + { + PSendSysMessage(LANG_COMMAND_CREATUREATSAMEMAP, lowguid); + SetSentErrorMessage(true); + return false; + } + } + else + { + lowguid = pCreature->GetDBTableGUIDLow(); + } + } + else + { + lowguid = pCreature->GetDBTableGUIDLow(); + } + + float x = m_session->GetPlayer()->GetPositionX(); + float y = m_session->GetPlayer()->GetPositionY(); + float z = m_session->GetPlayer()->GetPositionZ(); + float o = m_session->GetPlayer()->GetOrientation(); + + if (pCreature) + { + if (CreatureData const* data = objmgr.GetCreatureData(pCreature->GetDBTableGUIDLow())) + { + const_cast(data)->posX = x; + const_cast(data)->posY = y; + const_cast(data)->posZ = z; + const_cast(data)->orientation = o; + } + pCreature->GetMap()->CreatureRelocation(pCreature,x, y, z,o); + pCreature->GetMotionMaster()->Initialize(); + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + { + pCreature->setDeathState(JUST_DIED); + pCreature->Respawn(); + } + } + + WorldDatabase.PExecuteLog("UPDATE creature SET position_x = '%f', position_y = '%f', position_z = '%f', orientation = '%f' WHERE guid = '%u'", x, y, z, o, lowguid); + PSendSysMessage(LANG_COMMAND_CREATUREMOVED); + return true; +} + +/**HandleNpcSetMoveTypeCommand + * Set the movement type for an NPC.
+ *
+ * Valid movement types are: + *
    + *
  • stay - NPC wont move
  • + *
  • random - NPC will move randomly according to the spawndist
  • + *
  • way - NPC will move with given waypoints set
  • + *
+ * additional parameter: NODEL - so no waypoints are deleted, if you + * change the movement type + */ +bool ChatHandler::HandleNpcSetMoveTypeCommand(const char* args) +{ + if (!*args) + return false; + + // 3 arguments: + // GUID (optional - you can also select the creature) + // stay|random|way (determines the kind of movement) + // NODEL (optional - tells the system NOT to delete any waypoints) + // this is very handy if you want to do waypoints, that are + // later switched on/off according to special events (like escort + // quests, etc) + char* guid_str = strtok((char*)args, " "); + char* type_str = strtok((char*)NULL, " "); + char* dontdel_str = strtok((char*)NULL, " "); + + bool doNotDelete = false; + + if (!guid_str) + return false; + + uint32 lowguid = 0; + Creature* pCreature = NULL; + + if (dontdel_str) + { + //sLog.outError("DEBUG: All 3 params are set"); + + // All 3 params are set + // GUID + // type + // doNotDEL + if (stricmp(dontdel_str, "NODEL") == 0) + { + //sLog.outError("DEBUG: doNotDelete = true;"); + doNotDelete = true; + } + } + else + { + // Only 2 params - but maybe NODEL is set + if (type_str) + { + sLog.outError("DEBUG: Only 2 params "); + if (stricmp(type_str, "NODEL") == 0) + { + //sLog.outError("DEBUG: type_str, NODEL "); + doNotDelete = true; + type_str = NULL; + } + } + } + + if (!type_str) // case .setmovetype $move_type (with selected creature) + { + type_str = guid_str; + pCreature = getSelectedCreature(); + if (!pCreature || pCreature->isPet()) + return false; + lowguid = pCreature->GetDBTableGUIDLow(); + } + else // case .setmovetype #creature_guid $move_type (with selected creature) + { + lowguid = atoi((char*)guid_str); + + /* impossible without entry + if (lowguid) + pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT)); + */ + + // attempt check creature existence by DB data + if (!pCreature) + { + CreatureData const* data = objmgr.GetCreatureData(lowguid); + if (!data) + { + PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + } + else + { + lowguid = pCreature->GetDBTableGUIDLow(); + } + } + + // now lowguid is low guid really existed creature + // and pCreature point (maybe) to this creature or NULL + + MovementGeneratorType move_type; + + std::string type = type_str; + + if (type == "stay") + move_type = IDLE_MOTION_TYPE; + else if (type == "random") + move_type = RANDOM_MOTION_TYPE; + else if (type == "way") + move_type = WAYPOINT_MOTION_TYPE; + else + return false; + + // update movement type + //if (doNotDelete == false) + // WaypointMgr.DeletePath(lowguid); + + if (pCreature) + { + // update movement type + if (doNotDelete == false) + pCreature->LoadPath(0); + + pCreature->SetDefaultMovementType(move_type); + pCreature->GetMotionMaster()->Initialize(); + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + { + pCreature->setDeathState(JUST_DIED); + pCreature->Respawn(); + } + pCreature->SaveToDB(); + } + if (doNotDelete == false) + { + PSendSysMessage(LANG_MOVE_TYPE_SET,type_str); + } + else + { + PSendSysMessage(LANG_MOVE_TYPE_SET_NODEL,type_str); + } + + return true; +} + +//set model of creature +bool ChatHandler::HandleNpcSetModelCommand(const char* args) +{ + if (!*args) + return false; + + uint32 displayId = (uint32) atoi((char*)args); + + Creature *pCreature = getSelectedCreature(); + + if (!pCreature || pCreature->isPet()) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pCreature->SetDisplayId(displayId); + pCreature->SetNativeDisplayId(displayId); + + pCreature->SaveToDB(); + + return true; +} +//set faction of creature +bool ChatHandler::HandleNpcFactionIdCommand(const char* args) +{ + if (!*args) + return false; + + uint32 factionId = (uint32) atoi((char*)args); + + if (!sFactionTemplateStore.LookupEntry(factionId)) + { + PSendSysMessage(LANG_WRONG_FACTION, factionId); + SetSentErrorMessage(true); + return false; + } + + Creature* pCreature = getSelectedCreature(); + + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pCreature->setFaction(factionId); + + // faction is set in creature_template - not inside creature + + // update in memory + if (CreatureInfo const *cinfo = pCreature->GetCreatureInfo()) + { + const_cast(cinfo)->faction_A = factionId; + const_cast(cinfo)->faction_H = factionId; + } + + // and DB + WorldDatabase.PExecuteLog("UPDATE creature_template SET faction_A = '%u', faction_H = '%u' WHERE entry = '%u'", factionId, factionId, pCreature->GetEntry()); + + return true; +} +//set spawn dist of creature +bool ChatHandler::HandleNpcSpawnDistCommand(const char* args) +{ + if (!*args) + return false; + + float option = atof((char*)args); + if (option < 0.0f) + { + SendSysMessage(LANG_BAD_VALUE); + return false; + } + + MovementGeneratorType mtype = IDLE_MOTION_TYPE; + if (option >0.0f) + mtype = RANDOM_MOTION_TYPE; + + Creature *pCreature = getSelectedCreature(); + uint32 u_guidlow = 0; + + if (pCreature) + u_guidlow = pCreature->GetDBTableGUIDLow(); + else + return false; + + pCreature->SetRespawnRadius((float)option); + pCreature->SetDefaultMovementType(mtype); + pCreature->GetMotionMaster()->Initialize(); + if (pCreature->isAlive()) // dead creature will reset movement generator at respawn + { + pCreature->setDeathState(JUST_DIED); + pCreature->Respawn(); + } + + WorldDatabase.PExecuteLog("UPDATE creature SET spawndist=%f, MovementType=%i WHERE guid=%u",option,mtype,u_guidlow); + PSendSysMessage(LANG_COMMAND_SPAWNDIST,option); + return true; +} +//spawn time handling +bool ChatHandler::HandleNpcSpawnTimeCommand(const char* args) +{ + if (!*args) + return false; + + char* stime = strtok((char*)args, " "); + + if (!stime) + return false; + + int i_stime = atoi((char*)stime); + + if (i_stime < 0) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Creature *pCreature = getSelectedCreature(); + uint32 u_guidlow = 0; + + if (pCreature) + u_guidlow = pCreature->GetDBTableGUIDLow(); + else + return false; + + WorldDatabase.PExecuteLog("UPDATE creature SET spawntimesecs=%i WHERE guid=%u",i_stime,u_guidlow); + pCreature->SetRespawnDelay((uint32)i_stime); + PSendSysMessage(LANG_COMMAND_SPAWNTIME,i_stime); + + return true; +} +//npc follow handling +bool ChatHandler::HandleNpcFollowCommand(const char* /*args*/) +{ + Player *player = m_session->GetPlayer(); + Creature *creature = getSelectedCreature(); + + if (!creature) + { + PSendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + // Follow player - Using pet's default dist and angle + creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, creature->GetFollowAngle()); + + PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName()); + return true; +} +//npc unfollow handling +bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/) +{ + Player *player = m_session->GetPlayer(); + Creature *creature = getSelectedCreature(); + + if (!creature) + { + PSendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (/*creature->GetMotionMaster()->empty() ||*/ + creature->GetMotionMaster()->GetCurrentMovementGeneratorType () != TARGETED_MOTION_TYPE) + { + PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName()); + SetSentErrorMessage(true); + return false; + } + + TargetedMovementGenerator const* mgen + = static_cast const*>((creature->GetMotionMaster()->top())); + + if (mgen->GetTarget() != player) + { + PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName()); + SetSentErrorMessage(true); + return false; + } + + // reset movement + creature->GetMotionMaster()->MovementExpired(true); + + PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName()); + return true; +} +//npc tame handling +bool ChatHandler::HandleNpcTameCommand(const char* /*args*/) +{ + Creature *creatureTarget = getSelectedCreature (); + if (!creatureTarget || creatureTarget->isPet ()) + { + PSendSysMessage (LANG_SELECT_CREATURE); + SetSentErrorMessage (true); + return false; + } + + Player *player = m_session->GetPlayer (); + + if (player->GetPetGUID ()) + { + SendSysMessage (LANG_YOU_ALREADY_HAVE_PET); + SetSentErrorMessage (true); + return false; + } + + CreatureInfo const* cInfo = creatureTarget->GetCreatureInfo(); + + if (!cInfo->isTameable (player->CanTameExoticPets())) + { + PSendSysMessage (LANG_CREATURE_NON_TAMEABLE,cInfo->Entry); + SetSentErrorMessage (true); + return false; + } + + // Everything looks OK, create new pet + Pet* pet = player->CreateTamedPetFrom (creatureTarget); + if (!pet) + { + PSendSysMessage (LANG_CREATURE_NON_TAMEABLE,cInfo->Entry); + SetSentErrorMessage (true); + return false; + } + + // place pet before player + float x,y,z; + player->GetClosePoint (x,y,z,creatureTarget->GetObjectSize (),CONTACT_DISTANCE); + pet->Relocate (x,y,z,M_PI-player->GetOrientation ()); + + // set pet to defensive mode by default (some classes can't control controlled pets in fact). + pet->SetReactState(REACT_DEFENSIVE); + + // calculate proper level + uint8 level = (creatureTarget->getLevel() < (player->getLevel() - 5)) ? (player->getLevel() - 5) : creatureTarget->getLevel(); + + // prepare visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1); + + // add to world + pet->GetMap()->Add(pet->ToCreature()); + + // visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL, level); + + // caster have pet now + player->SetMinion(pet, true); + + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + player->PetSpellInitialize(); + + return true; +} +//npc phasemask handling +//change phasemask of creature or pet +bool ChatHandler::HandleNpcSetPhaseCommand(const char* args) +{ + if (!*args) + return false; + + uint32 phasemask = (uint32) atoi((char*)args); + if (phasemask == 0) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + Creature* pCreature = getSelectedCreature(); + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pCreature->SetPhaseMask(phasemask,true); + + if (!pCreature->isPet()) + pCreature->SaveToDB(); + + return true; +} +//npc deathstate handling +bool ChatHandler::HandleNpcSetDeathStateCommand(const char* args) +{ + if (!*args) + return false; + + Creature* pCreature = getSelectedCreature(); + if (!pCreature || pCreature->isPet()) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (strncmp(args, "on", 3) == 0) + pCreature->SetDeadByDefault(true); + else if (strncmp(args, "off", 4) == 0) + pCreature->SetDeadByDefault(false); + else + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } + + pCreature->SaveToDB(); + pCreature->Respawn(); + + return true; +} + +//TODO: NpcCommands that need to be fixed : + +bool ChatHandler::HandleNpcNameCommand(const char* /*args*/) +{ + /* Temp. disabled + if (!*args) + return false; + + if (strlen((char*)args)>75) + { + PSendSysMessage(LANG_TOO_LONG_NAME, strlen((char*)args)-75); + return true; + } + + for (uint8 i = 0; i < strlen(args); ++i) + { + if (!isalpha(args[i]) && args[i] != ' ') + { + SendSysMessage(LANG_CHARS_ONLY); + return false; + } + } + + uint64 guid; + guid = m_session->GetPlayer()->GetSelection(); + if (guid == 0) + { + SendSysMessage(LANG_NO_SELECTION); + return true; + } + + Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid); + + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + return true; + } + + pCreature->SetName(args); + uint32 idname = objmgr.AddCreatureTemplate(pCreature->GetName()); + pCreature->SetUInt32Value(OBJECT_FIELD_ENTRY, idname); + + pCreature->SaveToDB(); + */ + + return true; +} + +bool ChatHandler::HandleNpcSubNameCommand(const char* /*args*/) +{ + /* Temp. disabled + + if (!*args) + args = ""; + + if (strlen((char*)args)>75) + { + + PSendSysMessage(LANG_TOO_LONG_SUBNAME, strlen((char*)args)-75); + return true; + } + + for (uint8 i = 0; i < strlen(args); i++) + { + if (!isalpha(args[i]) && args[i] != ' ') + { + SendSysMessage(LANG_CHARS_ONLY); + return false; + } + } + uint64 guid; + guid = m_session->GetPlayer()->GetSelection(); + if (guid == 0) + { + SendSysMessage(LANG_NO_SELECTION); + return true; + } + + Creature* pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid); + + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + return true; + } + + uint32 idname = objmgr.AddCreatureSubName(pCreature->GetName(),args,pCreature->GetUInt32Value(UNIT_FIELD_DISPLAYID)); + pCreature->SetUInt32Value(OBJECT_FIELD_ENTRY, idname); + + pCreature->SaveToDB(); + */ + return true; +} + +//move item to other slot +bool ChatHandler::HandleItemMoveCommand(const char* args) +{ + if (!*args) + return false; + uint8 srcslot, dstslot; + + char* pParam1 = strtok((char*)args, " "); + if (!pParam1) + return false; + + char* pParam2 = strtok(NULL, " "); + if (!pParam2) + return false; + + srcslot = (uint8)atoi(pParam1); + dstslot = (uint8)atoi(pParam2); + + if (srcslot == dstslot) + return true; + + if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,srcslot)) + return false; + + if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0,dstslot)) + return false; + + uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot); + uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot); + + m_session->GetPlayer()->SwapItem(src, dst); + + return true; +} + +//demorph player or unit +bool ChatHandler::HandleDeMorphCommand(const char* /*args*/) +{ + Unit *target = getSelectedUnit(); + if (!target) + target = m_session->GetPlayer(); + + // check online security + else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0)) + return false; + + target->DeMorph(); + + return true; +} + +//morph creature or player +bool ChatHandler::HandleModifyMorphCommand(const char* args) +{ + if (!*args) + return false; + + uint16 display_id = (uint16)atoi((char*)args); + + Unit *target = getSelectedUnit(); + if (!target) + target = m_session->GetPlayer(); + + // check online security + else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0)) + return false; + + target->SetDisplayId(display_id); + + return true; +} + +//kick player +bool ChatHandler::HandleKickPlayerCommand(const char *args) +{ +/* const char* kickName = strtok((char*)args, " "); + char* kickReason = strtok(NULL, "\n"); + std::string reason = "No Reason"; + std::string kicker = "Console"; + if (kickReason) + reason = kickReason; + if (m_session) + kicker = m_session->GetPlayer()->GetName(); + + if (!kickName) + { + Player* player = getSelectedPlayer(); + if (!player) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + if (player == m_session->GetPlayer()) + { + SendSysMessage(LANG_COMMAND_KICKSELF); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(player, 0)) + return false; + + if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) + { + sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str()); + } + else + { + PSendSysMessage(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str()); + } + + player->GetSession()->KickPlayer(); + } + else + { + std::string name = extractPlayerNameFromLink((char*)kickName); + if (name.empty()) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + if (m_session && name == m_session->GetPlayer()->GetName()) + { + SendSysMessage(LANG_COMMAND_KICKSELF); + SetSentErrorMessage(true); + return false; + } + + Player* player = objmgr.GetPlayer(kickName); + if (!player) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + if (HasLowerSecurity(player, 0)) + { + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on + SetSentErrorMessage(true); + return false; + } + + std::string nameLink = playerLink(name); + + if (sWorld.KickPlayer(name)) + { + if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) + { + sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, nameLink.c_str(), kicker.c_str(), reason.c_str()); + } + else + { + PSendSysMessage(LANG_COMMAND_KICKMESSAGE,nameLink.c_str()); + } + } + else + { + PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER,nameLink.c_str()); + return false; + } + }*/ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + if (m_session && target == m_session->GetPlayer()) + { + SendSysMessage(LANG_COMMAND_KICKSELF); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + // send before target pointer invalidate + PSendSysMessage(LANG_COMMAND_KICKMESSAGE,GetNameLink(target).c_str()); + target->GetSession()->KickPlayer(); + return true; +} + +//set temporary phase mask for player +bool ChatHandler::HandleModifyPhaseCommand(const char* args) +{ + if (!*args) + return false; + + uint32 phasemask = (uint32)atoi((char*)args); + + Unit *target = getSelectedUnit(); + if (!target) + target = m_session->GetPlayer(); + + // check online security + else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0)) + return false; + + target->SetPhaseMask(phasemask,true); + + return true; +} +//show info of gameobject +bool ChatHandler::HandleGOInfoCommand(const char* args) +{ + uint32 entry = 0; + uint32 type = 0; + uint32 displayid = 0; + std::string name; + + if (!*args) + { + if (WorldObject * obj = getSelectedObject()) + entry = obj->GetEntry(); + } + else + entry = atoi((char*)args); + + GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(entry); + + if (!goinfo) + return false; + + type = goinfo->type; + displayid = goinfo->displayId; + name = goinfo->name; + + PSendSysMessage(LANG_GOINFO_ENTRY, entry); + PSendSysMessage(LANG_GOINFO_TYPE, type); + PSendSysMessage(LANG_GOINFO_DISPLAYID, displayid); + PSendSysMessage(LANG_GOINFO_NAME, name.c_str()); + + return true; +} + +//show info of player +bool ChatHandler::HandlePInfoCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + uint32 accId = 0; + uint32 money = 0; + uint32 total_player_time = 0; + uint8 level = 0; + uint32 latency = 0; + uint8 race; + uint8 Class; + + // get additional information from Player object + if (target) + { + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + accId = target->GetSession()->GetAccountId(); + money = target->GetMoney(); + total_player_time = target->GetTotalPlayedTime(); + level = target->getLevel(); + latency = target->GetSession()->GetLatency(); + race = target->getRace(); + Class = target->getClass(); + } + // get additional information from DB + else + { + // check offline security + if (HasLowerSecurity(NULL, target_guid)) + return false; + + // 0 1 2 3 4 5 + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT totaltime, level, money, account, race, class FROM characters WHERE guid = '%u'", GUID_LOPART(target_guid)); + if (!result) + return false; + + Field *fields = result->Fetch(); + total_player_time = fields[0].GetUInt32(); + level = fields[1].GetUInt32(); + money = fields[2].GetUInt32(); + accId = fields[3].GetUInt32(); + race = fields[4].GetUInt8(); + Class = fields[5].GetUInt8(); + } + + std::string username = GetTrinityString(LANG_ERROR); + std::string email = GetTrinityString(LANG_ERROR); + std::string last_ip = GetTrinityString(LANG_ERROR); + uint32 security = 0; + std::string last_login = GetTrinityString(LANG_ERROR); + + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT a.username,aa.gmlevel,a.email,a.last_ip,a.last_login " + "FROM account a " + "LEFT JOIN account_access aa " + "ON (a.id = aa.id) " + "WHERE a.id = '%u'",accId); + if (result) + { + Field* fields = result->Fetch(); + username = fields[0].GetCppString(); + security = fields[1].GetUInt32(); + email = fields[2].GetCppString(); + + if (email.empty()) + email = "-"; + + if (!m_session || m_session->GetSecurity() >= security) + { + last_ip = fields[3].GetCppString(); + last_login = fields[4].GetCppString(); + } + else + { + last_ip = "-"; + last_login = "-"; + } + } + + std::string nameLink = playerLink(target_name); + + PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency); + + std::string race_s, Class_s; + switch(race) + { + case RACE_HUMAN: race_s = "Human"; break; + case RACE_ORC: race_s = "Orc"; break; + case RACE_DWARF: race_s = "Dwarf"; break; + case RACE_NIGHTELF: race_s = "Night Elf"; break; + case RACE_UNDEAD_PLAYER: race_s = "Undead"; break; + case RACE_TAUREN: race_s = "Tauren"; break; + case RACE_GNOME: race_s = "Gnome"; break; + case RACE_TROLL: race_s = "Troll"; break; + case RACE_BLOODELF: race_s = "Blood Elf"; break; + case RACE_DRAENEI: race_s = "Draenei"; break; + } + switch(Class) + { + case CLASS_WARRIOR: Class_s = "Warrior"; break; + case CLASS_PALADIN: Class_s = "Paladin"; break; + case CLASS_HUNTER: Class_s = "Hunter"; break; + case CLASS_ROGUE: Class_s = "Rogue"; break; + case CLASS_PRIEST: Class_s = "Priest"; break; + case CLASS_DEATH_KNIGHT: Class_s = "Death Knight"; break; + case CLASS_SHAMAN: Class_s = "Shaman"; break; + case CLASS_MAGE: Class_s = "Mage"; break; + case CLASS_WARLOCK: Class_s = "Warlock"; break; + case CLASS_DRUID: Class_s = "Druid"; break; + } + + std::string timeStr = secsToTimeString(total_player_time,true,true); + uint32 gold = money /GOLD; + uint32 silv = (money % GOLD) / SILVER; + uint32 copp = (money % GOLD) % SILVER; + PSendSysMessage(LANG_PINFO_LEVEL, race_s.c_str(), Class_s.c_str(), timeStr.c_str(), level, gold, silv, copp); + + return true; +} + +/////WAYPOINT COMMANDS + +/** + * Add a waypoint to a creature. + * + * The user can either select an npc or provide its GUID. + * + * The user can even select a visual waypoint - then the new waypoint + * is placed *after* the selected one - this makes insertion of new + * waypoints possible. + * + * eg: + * .wp add 12345 + * -> adds a waypoint to the npc with the GUID 12345 + * + * .wp add + * -> adds a waypoint to the currently selected creature + * + * + * @param args if the user did not provide a GUID, it is NULL + * + * @return true - command did succeed, false - something went wrong + */ +bool ChatHandler::HandleWpAddCommand(const char* args) +{ + sLog.outDebug("DEBUG: HandleWpAddCommand"); + + // optional + char* path_number = NULL; + uint32 pathid = 0; + + if (*args) + path_number = strtok((char*)args, " "); + + uint32 point = 0; + Creature* target = getSelectedCreature(); + + if (!path_number) + { + if (target) + pathid = target->GetWaypointPath(); + else + { + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT MAX(id) FROM waypoint_data"); + uint32 maxpathid = result->Fetch()->GetInt32(); + pathid = maxpathid+1; + sLog.outDebug("DEBUG: HandleWpAddCommand - New path started."); + PSendSysMessage("%s%s|r", "|cff00ff00", "New path started."); + } + } + else + pathid = atoi(path_number); + + // path_id -> ID of the Path + // point -> number of the waypoint (if not 0) + + if (!pathid) + { + sLog.outDebug("DEBUG: HandleWpAddCommand - Current creature haven't loaded path."); + PSendSysMessage("%s%s|r", "|cffff33ff", "Current creature haven't loaded path."); + return true; + } + + sLog.outDebug("DEBUG: HandleWpAddCommand - point == 0"); + + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid); + + if (result) + point = (*result)[0].GetUInt32(); + + Player* player = m_session->GetPlayer(); + //Map *map = player->GetMap(); + + WorldDatabase.PExecuteLog("INSERT INTO waypoint_data (id, point, position_x, position_y, position_z) VALUES ('%u','%u','%f', '%f', '%f')", + pathid, point+1, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + + PSendSysMessage("%s%s%u%s%u%s|r", "|cff00ff00", "PathID: |r|cff00ffff", pathid, "|r|cff00ff00: Waypoint |r|cff00ffff", point+1,"|r|cff00ff00 created. "); + return true; +} // HandleWpAddCommand + +bool ChatHandler::HandleWpLoadPathCommand(const char *args) +{ + if (!*args) + return false; + + // optional + char* path_number = NULL; + + if (*args) + path_number = strtok((char*)args, " "); + + uint32 pathid = 0; + uint32 guidlow = 0; + Creature* target = getSelectedCreature(); + + // Did player provide a path_id? + if (!path_number) + sLog.outDebug("DEBUG: HandleWpLoadPathCommand - No path number provided"); + + if (!target) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (target->GetEntry() == 1) + { + PSendSysMessage("%s%s|r", "|cffff33ff", "You want to load path to a waypoint? Aren't you?"); + SetSentErrorMessage(true); + return false; + } + + pathid = atoi(path_number); + + if (!pathid) + { + PSendSysMessage("%s%s|r", "|cffff33ff", "No vallid path number provided."); + return true; + } + + guidlow = target->GetDBTableGUIDLow(); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow); + + if (result) + WorldDatabase.PExecute("UPDATE creature_addon SET path_id = '%u' WHERE guid = '%u'", pathid, guidlow); + else + WorldDatabase.PExecute("INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid); + + WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", WAYPOINT_MOTION_TYPE, guidlow); + + target->LoadPath(pathid); + target->SetDefaultMovementType(WAYPOINT_MOTION_TYPE); + target->GetMotionMaster()->Initialize(); + target->MonsterSay("Path loaded.",0,0); + + return true; +} + +bool ChatHandler::HandleReloadAllPaths(const char* args) +{ + if (!*args) + return false; + + uint32 id = atoi(args); + + if (!id) + return false; + + PSendSysMessage("%s%s|r|cff00ffff%u|r", "|cff00ff00", "Loading Path: ", id); + sWaypointMgr->UpdatePath(id); + return true; +} + +bool ChatHandler::HandleWpUnLoadPathCommand(const char * /*args*/) +{ + uint32 guidlow = 0; + Creature* target = getSelectedCreature(); + + if (!target) + { + PSendSysMessage("%s%s|r", "|cff33ffff", "You must select target."); + return true; + } + + if (target->GetCreatureAddon()) + { + if (target->GetCreatureAddon()->path_id != 0) + { + WorldDatabase.PExecute("DELETE FROM creature_addon WHERE guid = %u", target->GetGUIDLow()); + target->UpdateWaypointID(0); + WorldDatabase.PExecute("UPDATE creature SET MovementType = '%u' WHERE guid = '%u'", IDLE_MOTION_TYPE, guidlow); + target->LoadPath(0); + target->SetDefaultMovementType(IDLE_MOTION_TYPE); + target->GetMotionMaster()->MoveTargetedHome(); + target->GetMotionMaster()->Initialize(); + target->MonsterSay("Path unloaded.",0,0); + return true; + } + PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path."); + } + return true; +} + +bool ChatHandler::HandleWpEventCommand(const char* args) +{ + if (!*args) + return false; + + char* show_str = strtok((char*)args, " "); + std::string show = show_str; + + // Check + if ((show != "add") && (show != "mod") && (show != "del") && (show != "listid")) return false; + + char* arg_id = strtok(NULL, " "); + uint32 id = 0; + + if (show == "add") + { + if (arg_id) + id = atoi(arg_id); + + if (id) + { + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid = %u", id); + + if (!result) + { + WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id); + PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: ", id); + } + else + PSendSysMessage("|cff00ff00Wp Event: You have choosed an existing waypoint script guid: %u|r", id); + } + else + { + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT MAX(guid) FROM waypoint_scripts"); + id = result->Fetch()->GetUInt32(); + WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id+1); + PSendSysMessage("%s%s%u|r", "|cff00ff00","Wp Event: New waypoint event added: |r|cff00ffff", id+1); + } + + return true; + } + + if (show == "listid") + { + if (!arg_id) + { + PSendSysMessage("%s%s|r", "|cff33ffff","Wp Event: You must provide waypoint script id."); + return true; + } + + id = atoi(arg_id); + + uint32 a2, a3, a4, a5, a6; + float a8, a9, a10, a11; + char const* a7; + + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u", id); + + if (!result) + { + PSendSysMessage("%s%s%u|r", "|cff33ffff", "Wp Event: No waypoint scripts found on id: ", id); + return true; + } + + Field *fields; + + do + { + fields = result->Fetch(); + a2 = fields[0].GetUInt32(); + a3 = fields[1].GetUInt32(); + a4 = fields[2].GetUInt32(); + a5 = fields[3].GetUInt32(); + a6 = fields[4].GetUInt32(); + a7 = fields[5].GetString(); + a8 = fields[6].GetFloat(); + a9 = fields[7].GetFloat(); + a10 = fields[8].GetFloat(); + a11 = fields[9].GetFloat(); + + PSendSysMessage("|cffff33ffid:|r|cff00ffff %u|r|cff00ff00, guid: |r|cff00ffff%u|r|cff00ff00, delay: |r|cff00ffff%u|r|cff00ff00, command: |r|cff00ffff%u|r|cff00ff00, datalong: |r|cff00ffff%u|r|cff00ff00, datalong2: |r|cff00ffff%u|r|cff00ff00, datatext: |r|cff00ffff%s|r|cff00ff00, posx: |r|cff00ffff%f|r|cff00ff00, posy: |r|cff00ffff%f|r|cff00ff00, posz: |r|cff00ffff%f|r|cff00ff00, orientation: |r|cff00ffff%f|r", id, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + while (result->NextRow()); + } + + if (show == "del") + { + id = atoi(arg_id); + + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM waypoint_scripts WHERE guid = %u", id); + + if (result) + { + WorldDatabase.PExecuteLog("DELETE FROM waypoint_scripts WHERE guid = %u", id); + PSendSysMessage("%s%s%u|r","|cff00ff00","Wp Event: Waypoint script removed: ", id); + } + else + PSendSysMessage("|cffff33ffWp Event: ERROR: you have selected a non existing script: %u|r", id); + + return true; + } + + if (show == "mod") + { + if (!arg_id) + { + SendSysMessage("|cffff33ffERROR: Waypoint script guid not present.|r"); + return true; + } + + id = atoi(arg_id); + + if (!id) + { + SendSysMessage("|cffff33ffERROR: No vallid waypoint script id not present.|r"); + return true; + } + + char* arg_2 = strtok(NULL," "); + + if (!arg_2) + { + SendSysMessage("|cffff33ffERROR: No argument present.|r"); + return true; + } + + std::string arg_string = arg_2; + + if ((arg_string != "setid") && (arg_string != "delay") && (arg_string != "command") + && (arg_string != "datalong") && (arg_string != "datalong2") && (arg_string != "dataint") && (arg_string != "posx") + && (arg_string != "posy") && (arg_string != "posz") && (arg_string != "orientation")) + { + SendSysMessage("|cffff33ffERROR: No valid argument present.|r"); + return true; + } + + char* arg_3; + std::string arg_str_2 = arg_2; + arg_3 = strtok(NULL," "); + + if (!arg_3) + { + SendSysMessage("|cffff33ffERROR: No additional argument present.|r"); + return true; + } + + float coord; + + if (arg_str_2 == "setid") + { + uint32 newid = atoi(arg_3); + PSendSysMessage("%s%s|r|cff00ffff%u|r|cff00ff00%s|r|cff00ffff%u|r","|cff00ff00","Wp Event: Wypoint scipt guid: ", newid," id changed: ", id); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET id='%u' WHERE guid='%u'", + newid, id); return true; + } + else + { + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid='%u'",id); + + if (!result) + { + SendSysMessage("|cffff33ffERROR: You have selected an non existing waypoint script guid.|r"); + return true; + } + + if (arg_str_2 == "posx") + { + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET x='%f' WHERE guid='%u'", + coord, id); + PSendSysMessage("|cff00ff00Waypoint script:|r|cff00ffff %u|r|cff00ff00 position_x updated.|r", id); + return true; + } + else if (arg_str_2 == "posy") + { + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET y='%f' WHERE guid='%u'", + coord, id); + PSendSysMessage("|cff00ff00Waypoint script: %u position_y updated.|r", id); + return true; + } + else if (arg_str_2 == "posz") + { + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET z='%f' WHERE guid='%u'", + coord, id); + PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 position_z updated.|r", id); + return true; + } + else if (arg_str_2 == "orientation") + { + coord = atof(arg_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET o='%f' WHERE guid='%u'", + coord, id); + PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 orientation updated.|r", id); + return true; + } + else if (arg_str_2 == "dataint") + { + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET %s='%u' WHERE guid='%u'", + arg_2, atoi(arg_3), id); + PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 dataint updated.|r", id); + return true; + } + else + { + std::string arg_str_3 = arg_3; + WorldDatabase.escape_string(arg_str_3); + WorldDatabase.PExecuteLog("UPDATE waypoint_scripts SET %s='%s' WHERE guid='%u'", + arg_2, arg_str_3.c_str(), id); + } + } + PSendSysMessage("%s%s|r|cff00ffff%u:|r|cff00ff00 %s %s|r","|cff00ff00","Waypoint script:", id, arg_2,"updated."); + } + return true; +} + +bool ChatHandler::HandleWpModifyCommand(const char* args) +{ + sLog.outDebug("DEBUG: HandleWpModifyCommand"); + + if (!*args) + return false; + + // first arg: add del text emote spell waittime move + char* show_str = strtok((char*)args, " "); + if (!show_str) + { + return false; + } + + std::string show = show_str; + // Check + // Remember: "show" must also be the name of a column! + if ((show != "delay") && (show != "action") && (show != "action_chance") + && (show != "move_flag") && (show != "del") && (show != "move") && (show != "wpadd") +) + { + return false; + } + + // Next arg is: + char* arg_str = NULL; + + // Did user provide a GUID + // or did the user select a creature? + // -> variable lowguid is filled with the GUID of the NPC + uint32 pathid = 0; + uint32 point = 0; + uint32 wpGuid = 0; + Creature* target = getSelectedCreature(); + + if (!target || target->GetEntry() != VISUAL_WAYPOINT) + { + SendSysMessage("|cffff33ffERROR: You must select a waypoint.|r"); + return false; + } + + sLog.outDebug("DEBUG: HandleWpModifyCommand - User did select an NPC"); + // The visual waypoint + Creature* wpCreature = NULL; + wpGuid = target->GetGUIDLow(); + + // Did the user select a visual spawnpoint? + if (wpGuid) + wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + // attempt check creature existence by DB data + else + { + PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, wpGuid); + return false; + } + // User did select a visual waypoint? + // Check the creature + if (wpCreature->GetEntry() == VISUAL_WAYPOINT) + { + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid); + + if (!result) + { + sLog.outDebug("DEBUG: HandleWpModifyCommand - No waypoint found - used 'wpguid'"); + + PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUIDLow()); + // Select waypoint number from database + // Since we compare float values, we have to deal with + // some difficulties. + // Here we search for all waypoints that only differ in one from 1 thousand + // (0.001) - There is no other way to compare C++ floats with mySQL floats + // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html + const char* maxDIFF = "0.01"; + result = WorldDatabase.PQuery("SELECT id, point FROM waypoint_data WHERE (abs(position_x - %f) <= %s) and (abs(position_y - %f) <= %s) and (abs(position_z - %f) <= %s)", + wpCreature->GetPositionX(), maxDIFF, wpCreature->GetPositionY(), maxDIFF, wpCreature->GetPositionZ(), maxDIFF); + if (!result) + { + PSendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM, wpGuid); + return true; + } + } + sLog.outDebug("DEBUG: HandleWpModifyCommand - After getting wpGuid"); + + do + { + Field *fields = result->Fetch(); + pathid = fields[0].GetUInt32(); + point = fields[1].GetUInt32(); + } + while (result->NextRow()); + + // We have the waypoint number and the GUID of the "master npc" + // Text is enclosed in "<>", all other arguments not + arg_str = strtok((char*)NULL, " "); + } + + sLog.outDebug("DEBUG: HandleWpModifyCommand - Parameters parsed - now execute the command"); + + // Check for argument + if (show != "del" && show != "move" && arg_str == NULL) + { + PSendSysMessage(LANG_WAYPOINT_ARGUMENTREQ, show_str); + return false; + } + + if (show == "del" && target) + { + PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid); + + // wpCreature + Creature* wpCreature = NULL; + + if (wpGuid != 0) + { + wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + wpCreature->CombatStop(); + wpCreature->DeleteFromDB(); + wpCreature->AddObjectToRemoveList(); + } + + WorldDatabase.PExecuteLog("DELETE FROM waypoint_data WHERE id='%u' AND point='%u'", + pathid, point); + WorldDatabase.PExecuteLog("UPDATE waypoint_data SET point=point-1 WHERE id='%u' AND point>'%u'", + pathid, point); + + PSendSysMessage(LANG_WAYPOINT_REMOVED); + return true; + } // del + + if (show == "move" && target) + { + PSendSysMessage("|cff00ff00DEBUG: wp move, PathID: |r|cff00ffff%u|r", pathid); + + Player *chr = m_session->GetPlayer(); + Map *map = chr->GetMap(); + { + // wpCreature + Creature* wpCreature = NULL; + // What to do: + // Move the visual spawnpoint + // Respawn the owner of the waypoints + if (wpGuid != 0) + { + wpCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); + wpCreature->CombatStop(); + wpCreature->DeleteFromDB(); + wpCreature->AddObjectToRemoveList(); + // re-create + Creature* wpCreature2 = new Creature; + if (!wpCreature2->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) + { + PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); + delete wpCreature2; + return false; + } + + wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); + wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map); + map->Add(wpCreature2); + //sMapMgr.GetMap(npcCreature->GetMapId())->Add(wpCreature2); + } + + WorldDatabase.PExecuteLog("UPDATE waypoint_data SET position_x = '%f',position_y = '%f',position_z = '%f' where id = '%u' AND point='%u'", + chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), pathid, point); + + PSendSysMessage(LANG_WAYPOINT_CHANGED); + } + return true; + } // move + + const char *text = arg_str; + + if (text == 0) + { + // show_str check for present in list of correct values, no sql injection possible + WorldDatabase.PExecuteLog("UPDATE waypoint_data SET %s=NULL WHERE id='%u' AND point='%u'", + show_str, pathid, point); + } + else + { + // show_str check for present in list of correct values, no sql injection possible + std::string text2 = text; + WorldDatabase.escape_string(text2); + WorldDatabase.PExecuteLog("UPDATE waypoint_data SET %s='%s' WHERE id='%u' AND point='%u'", + show_str, text2.c_str(), pathid, point); + } + + PSendSysMessage(LANG_WAYPOINT_CHANGED_NO, show_str); + return true; +} + +bool ChatHandler::HandleWpShowCommand(const char* args) +{ + sLog.outDebug("DEBUG: HandleWpShowCommand"); + + if (!*args) + return false; + + // first arg: on, off, first, last + char* show_str = strtok((char*)args, " "); + if (!show_str) + return false; + + // second arg: GUID (optional, if a creature is selected) + char* guid_str = strtok((char*)NULL, " "); + sLog.outDebug("DEBUG: HandleWpShowCommand: show_str: %s guid_str: %s", show_str, guid_str); + + uint32 pathid = 0; + Creature* target = getSelectedCreature(); + + // Did player provide a PathID? + + if (!guid_str) + { + sLog.outDebug("DEBUG: HandleWpShowCommand: !guid_str"); + // No PathID provided + // -> Player must have selected a creature + + if (!target) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + pathid = target->GetWaypointPath(); + } + else + { + sLog.outDebug("|cff00ff00DEBUG: HandleWpShowCommand: PathID provided|r"); + // PathID provided + // Warn if player also selected a creature + // -> Creature selection is ignored <- + if (target) + SendSysMessage(LANG_WAYPOINT_CREATSELECTED); + + pathid = atoi((char*)guid_str); + } + + sLog.outDebug("DEBUG: HandleWpShowCommand: danach"); + + std::string show = show_str; + uint32 Maxpoint; + + sLog.outDebug("DEBUG: HandleWpShowCommand: PathID: %u", pathid); + + //PSendSysMessage("wpshow - show: %s", show); + + // Show info for the selected waypoint + if (show == "info") + { + // Check if the user did specify a visual waypoint + if (target->GetEntry() != VISUAL_WAYPOINT) + { + PSendSysMessage(LANG_WAYPOINT_VP_SELECT); + SetSentErrorMessage(true); + return false; + } + + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow()); + + if (!result) + { + SendSysMessage(LANG_WAYPOINT_NOTFOUNDDBPROBLEM); + return true; + } + + SendSysMessage("|cff00ffffDEBUG: wp show info:|r"); + do + { + Field *fields = result->Fetch(); + pathid = fields[0].GetUInt32(); + uint32 point = fields[1].GetUInt32(); + uint32 delay = fields[2].GetUInt32(); + uint32 flag = fields[3].GetUInt32(); + uint32 ev_id = fields[4].GetUInt32(); + uint32 ev_chance = fields[5].GetUInt32(); + + PSendSysMessage("|cff00ff00Show info: for current point: |r|cff00ffff%u|r|cff00ff00, Path ID: |r|cff00ffff%u|r", point, pathid); + PSendSysMessage("|cff00ff00Show info: delay: |r|cff00ffff%u|r", delay); + PSendSysMessage("|cff00ff00Show info: Move flag: |r|cff00ffff%u|r", flag); + PSendSysMessage("|cff00ff00Show info: Waypoint event: |r|cff00ffff%u|r", ev_id); + PSendSysMessage("|cff00ff00Show info: Event chance: |r|cff00ffff%u|r", ev_chance); + } + while (result->NextRow()); + + return true; + } + + if (show == "on") + { + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT point, position_x,position_y,position_z FROM waypoint_data WHERE id = '%u'", pathid); + + if (!result) + { + SendSysMessage("|cffff33ffPath no found.|r"); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage("|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid); + + // Delete all visuals for this NPC + QueryResult_AutoPtr result2 = WorldDatabase.PQuery("SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid); + + if (result2) + { + bool hasError = false; + do + { + Field *fields = result2->Fetch(); + uint32 wpguid = fields[0].GetUInt32(); + Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid,VISUAL_WAYPOINT,HIGHGUID_UNIT)); + + if (!pCreature) + { + PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpguid); + hasError = true; + WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", wpguid); + } + else + { + pCreature->CombatStop(); + pCreature->DeleteFromDB(); + pCreature->AddObjectToRemoveList(); + } + + } + while (result2->NextRow()); + + if (hasError) + { + PSendSysMessage(LANG_WAYPOINT_TOOFAR1); + PSendSysMessage(LANG_WAYPOINT_TOOFAR2); + PSendSysMessage(LANG_WAYPOINT_TOOFAR3); + } + } + + do + { + Field *fields = result->Fetch(); + uint32 point = fields[0].GetUInt32(); + float x = fields[1].GetFloat(); + float y = fields[2].GetFloat(); + float z = fields[3].GetFloat(); + + uint32 id = VISUAL_WAYPOINT; + + Player *chr = m_session->GetPlayer(); + Map *map = chr->GetMap(); + float o = chr->GetOrientation(); + + Creature* wpCreature = new Creature; + if (!wpCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) + { + PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); + delete wpCreature; + return false; + } + + sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u"); + // set "wpguid" column to the visual waypoint + WorldDatabase.PExecuteLog("UPDATE waypoint_data SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), pathid, point); + + wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); + wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(),map); + map->Add(wpCreature); + + if (target) + { + wpCreature->SetDisplayId(target->GetDisplayId()); + wpCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + wpCreature->SetLevel(point > MAX_LEVEL ? MAX_LEVEL : point); + } + } + while (result->NextRow()); + + SendSysMessage("|cff00ff00Showing the current creature's path.|r"); + return true; + } + + if (show == "first") + { + PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid); + + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z FROM waypoint_data WHERE point='1' AND id = '%u'",pathid); + if (!result) + { + PSendSysMessage(LANG_WAYPOINT_NOTFOUND, pathid); + SetSentErrorMessage(true); + return false; + } + + Field *fields = result->Fetch(); + float x = fields[0].GetFloat(); + float y = fields[1].GetFloat(); + float z = fields[2].GetFloat(); + uint32 id = VISUAL_WAYPOINT; + + Player *chr = m_session->GetPlayer(); + float o = chr->GetOrientation(); + Map *map = chr->GetMap(); + + Creature* pCreature = new Creature; + if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT),map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) + { + PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); + delete pCreature; + return false; + } + + pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); + map->Add(pCreature); + + if (target) + { + pCreature->SetDisplayId(target->GetDisplayId()); + pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + } + + return true; + } + + if (show == "last") + { + PSendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid); + + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid); + if (result) + Maxpoint = (*result)[0].GetUInt32(); + else + Maxpoint = 0; + + result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z FROM waypoint_data WHERE point ='%u' AND id = '%u'",Maxpoint, pathid); + if (!result) + { + PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid); + SetSentErrorMessage(true); + return false; + } + Field *fields = result->Fetch(); + float x = fields[0].GetFloat(); + float y = fields[1].GetFloat(); + float z = fields[2].GetFloat(); + uint32 id = VISUAL_WAYPOINT; + + Player *chr = m_session->GetPlayer(); + float o = chr->GetOrientation(); + Map *map = chr->GetMap(); + + Creature* pCreature = new Creature; + if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) + { + PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); + delete pCreature; + return false; + } + + pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); + map->Add(pCreature); + + if (target) + { + pCreature->SetDisplayId(target->GetDisplayId()); + pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + } + + return true; + } + + if (show == "off") + { + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%u'", 1); + if (!result) + { + SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND); + SetSentErrorMessage(true); + return false; + } + bool hasError = false; + do + { + Field *fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid,VISUAL_WAYPOINT,HIGHGUID_UNIT)); + if (!pCreature) + { + PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid); + hasError = true; + WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid = '%u'", guid); + } + else + { + pCreature->CombatStop(); + pCreature->DeleteFromDB(); + pCreature->AddObjectToRemoveList(); + } + } + while (result->NextRow()); + // set "wpguid" column to "empty" - no visual waypoint spawned + WorldDatabase.PExecuteLog("UPDATE waypoint_data SET wpguid = '0'"); + //WorldDatabase.PExecuteLog("UPDATE creature_movement SET wpguid = '0' WHERE wpguid <> '0'"); + + if (hasError) + { + PSendSysMessage(LANG_WAYPOINT_TOOFAR1); + PSendSysMessage(LANG_WAYPOINT_TOOFAR2); + PSendSysMessage(LANG_WAYPOINT_TOOFAR3); + } + + SendSysMessage(LANG_WAYPOINT_VP_ALLREMOVED); + return true; + } + + PSendSysMessage("|cffff33ffDEBUG: wpshow - no valid command found|r"); + return true; +} + +//////////// WAYPOINT COMMANDS // + +//rename characters +bool ChatHandler::HandleCharacterRenameCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + if (target) + { + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + PSendSysMessage(LANG_RENAME_PLAYER, GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_RENAME); + } + else + { + // check offline security + if (HasLowerSecurity(NULL, target_guid)) + return false; + + std::string oldNameLink = playerLink(target_name); + + PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid)); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(target_guid)); + } + + return true; +} + +// customize characters +bool ChatHandler::HandleCharacterCustomizeCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + if (target) + { + PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", target->GetGUIDLow()); + } + else + { + std::string oldNameLink = playerLink(target_name); + + PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid)); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", GUID_LOPART(target_guid)); + } + + return true; +} + +// change player faction +bool ChatHandler::HandleCharacterChangeFactionCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + if(target) + { + // TODO : add text into database + PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '64' WHERE guid = '%u'", target->GetGUIDLow()); + } + else + { + std::string oldNameLink = playerLink(target_name); + + // TODO : add text into database + PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid)); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '64' WHERE guid = '%u'", GUID_LOPART(target_guid)); + } + + return true; +} + +// change player race +bool ChatHandler::HandleCharacterChangeRaceCommand(const char* args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + if(target) + { + // TODO : add text into database + PSendSysMessage(LANG_CUSTOMIZE_PLAYER, GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '128' WHERE guid = '%u'", target->GetGUIDLow()); + } + else + { + std::string oldNameLink = playerLink(target_name); + + // TODO : add text into database + PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid)); + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '128' WHERE guid = '%u'", GUID_LOPART(target_guid)); + } + + return true; +} + +bool ChatHandler::HandleCharacterReputationCommand(const char* args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + LocaleConstant loc = GetSessionDbcLocale(); + + FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList(); + for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr) + { + FactionEntry const *factionEntry = sFactionStore.LookupEntry(itr->second.ID); + char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#"; + ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); + std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]); + std::ostringstream ss; + if (m_session) + ss << itr->second.ID << " - |cffffffff|Hfaction:" << itr->second.ID << "|h[" << factionName << " " << localeNames[loc] << "]|h|r"; + else + ss << itr->second.ID << " - " << factionName << " " << localeNames[loc]; + + ss << " " << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ")"; + + if (itr->second.Flags & FACTION_FLAG_VISIBLE) + ss << GetTrinityString(LANG_FACTION_VISIBLE); + if (itr->second.Flags & FACTION_FLAG_AT_WAR) + ss << GetTrinityString(LANG_FACTION_ATWAR); + if (itr->second.Flags & FACTION_FLAG_PEACE_FORCED) + ss << GetTrinityString(LANG_FACTION_PEACE_FORCED); + if (itr->second.Flags & FACTION_FLAG_HIDDEN) + ss << GetTrinityString(LANG_FACTION_HIDDEN); + if (itr->second.Flags & FACTION_FLAG_INVISIBLE_FORCED) + ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); + if (itr->second.Flags & FACTION_FLAG_INACTIVE) + ss << GetTrinityString(LANG_FACTION_INACTIVE); + + SendSysMessage(ss.str().c_str()); + } + return true; +} + +//change standstate +bool ChatHandler::HandleModifyStandStateCommand(const char* args) +{ + if (!*args) + return false; + + uint32 anim_id = atoi((char*)args); + m_session->GetPlayer()->SetUInt32Value(UNIT_NPC_EMOTESTATE , anim_id); + + return true; +} + +bool ChatHandler::HandleHonorAddCommand(const char* args) +{ + if (!*args) + return false; + + Player *target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + uint32 amount = (uint32)atoi(args); + target->RewardHonor(NULL, 1, amount); + return true; +} + +bool ChatHandler::HandleHonorAddKillCommand(const char* /*args*/) +{ + Unit *target = getSelectedUnit(); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target, 0)) + return false; + + m_session->GetPlayer()->RewardHonor(target, 1); + return true; +} + +bool ChatHandler::HandleHonorUpdateCommand(const char* /*args*/) +{ + Player *target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + target->UpdateHonorFields(); + return true; +} + +bool ChatHandler::HandleLookupEventCommand(const char* args) +{ + if (!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + wstrToLower(wnamepart); + + bool found = false; + + GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + + for (uint32 id = 0; id < events.size(); ++id) + { + GameEventData const& eventData = events[id]; + + std::string descr = eventData.description; + if (descr.empty()) + continue; + + if (Utf8FitTo(descr, wnamepart)) + { + char const* active = activeEvents.find(id) != activeEvents.end() ? GetTrinityString(LANG_ACTIVE) : ""; + + if (m_session) + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,id,id,eventData.description.c_str(),active); + else + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,id,eventData.description.c_str(),active); + + if (!found) + found = true; + } + } + + if (!found) + SendSysMessage(LANG_NOEVENTFOUND); + + return true; +} + +bool ChatHandler::HandleEventActiveListCommand(const char* /*args*/) +{ + uint32 counter = 0; + + GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + + char const* active = GetTrinityString(LANG_ACTIVE); + + for (GameEventMgr::ActiveEvents::const_iterator itr = activeEvents.begin(); itr != activeEvents.end(); ++itr) + { + uint32 event_id = *itr; + GameEventData const& eventData = events[event_id]; + + if (m_session) + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT,event_id,event_id,eventData.description.c_str(),active); + else + PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE,event_id,eventData.description.c_str(),active); + + ++counter; + } + + if (counter == 0) + SendSysMessage(LANG_NOEVENTFOUND); + + return true; +} + +bool ChatHandler::HandleEventInfoCommand(const char* args) +{ + if (!*args) + return false; + + // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameevent"); + if (!cId) + return false; + + uint32 event_id = atoi(cId); + + GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + + if (event_id >=events.size()) + { + SendSysMessage(LANG_EVENT_NOT_EXIST); + SetSentErrorMessage(true); + return false; + } + + GameEventData const& eventData = events[event_id]; + if (!eventData.isValid()) + { + SendSysMessage(LANG_EVENT_NOT_EXIST); + SetSentErrorMessage(true); + return false; + } + + GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + bool active = activeEvents.find(event_id) != activeEvents.end(); + char const* activeStr = active ? GetTrinityString(LANG_ACTIVE) : ""; + + std::string startTimeStr = TimeToTimestampStr(eventData.start); + std::string endTimeStr = TimeToTimestampStr(eventData.end); + + uint32 delay = gameeventmgr.NextCheck(event_id); + time_t nextTime = time(NULL)+delay; + std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(NULL)+delay) : "-"; + + std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE); + std::string lengthStr = secsToTimeString(eventData.length * MINUTE); + + PSendSysMessage(LANG_EVENT_INFO,event_id,eventData.description.c_str(),activeStr, + startTimeStr.c_str(),endTimeStr.c_str(),occurenceStr.c_str(),lengthStr.c_str(), + nextStr.c_str()); + return true; +} + +bool ChatHandler::HandleEventStartCommand(const char* args) +{ + if (!*args) + return false; + + // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameevent"); + if (!cId) + return false; + + int32 event_id = atoi(cId); + + GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + + if (event_id < 1 || event_id >=events.size()) + { + SendSysMessage(LANG_EVENT_NOT_EXIST); + SetSentErrorMessage(true); + return false; + } + + GameEventData const& eventData = events[event_id]; + if (!eventData.isValid()) + { + SendSysMessage(LANG_EVENT_NOT_EXIST); + SetSentErrorMessage(true); + return false; + } + + GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + if (activeEvents.find(event_id) != activeEvents.end()) + { + PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE,event_id); + SetSentErrorMessage(true); + return false; + } + + gameeventmgr.StartEvent(event_id,true); + return true; +} + +bool ChatHandler::HandleEventStopCommand(const char* args) +{ + if (!*args) + return false; + + // id or [name] Shift-click form |color|Hgameevent:id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameevent"); + if (!cId) + return false; + + int32 event_id = atoi(cId); + + GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + + if (event_id < 1 || event_id >=events.size()) + { + SendSysMessage(LANG_EVENT_NOT_EXIST); + SetSentErrorMessage(true); + return false; + } + + GameEventData const& eventData = events[event_id]; + if (!eventData.isValid()) + { + SendSysMessage(LANG_EVENT_NOT_EXIST); + SetSentErrorMessage(true); + return false; + } + + GameEventMgr::ActiveEvents const& activeEvents = gameeventmgr.GetActiveEventList(); + + if (activeEvents.find(event_id) == activeEvents.end()) + { + PSendSysMessage(LANG_EVENT_NOT_ACTIVE,event_id); + SetSentErrorMessage(true); + return false; + } + + gameeventmgr.StopEvent(event_id,true); + return true; +} + +bool ChatHandler::HandleCombatStopCommand(const char* args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + target->CombatStop(); + target->getHostileRefManager().deleteReferences(); + return true; +} + +void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) +{ + uint32 classmask = player->getClassMask(); + + for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + { + SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); + if (!skillLine) + continue; + + // wrong skill + if (skillLine->skillId != skill_id) + continue; + + // not high rank + if (skillLine->forward_spellid) + continue; + + // skip racial skills + if (skillLine->racemask != 0) + continue; + + // skip wrong class skills + if (skillLine->classmask && (skillLine->classmask & classmask) == 0) + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,player,false)) + continue; + + player->learnSpell(skillLine->spellId, false); + } +} + +bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) +{ + + for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) + { + SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); + if (!skillInfo) + continue; + + if ((skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) && + skillInfo->canLink) // only prof. with recipes have + { + HandleLearnSkillRecipesHelper(m_session->GetPlayer(),skillInfo->id); + } + } + + SendSysMessage(LANG_COMMAND_LEARN_ALL_CRAFT); + return true; +} + +bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) +{ + // Learns all recipes of specified profession and sets skill to max + // Example: .learn all_recipes enchanting + + Player* target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + return false; + } + + if (!*args) + return false; + + std::wstring wnamepart; + + if (!Utf8toWStr(args,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wnamepart); + + std::string name; + + SkillLineEntry const *targetSkillInfo = NULL; + for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) + { + SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); + if (!skillInfo) + continue; + + if ((skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && + skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) || + !skillInfo->canLink) // only prof with recipes have set + continue; + + int loc = GetSessionDbcLocale(); + name = skillInfo->name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale()) + continue; + + name = skillInfo->name[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + targetSkillInfo = skillInfo; + break; + } + } + + if (!targetSkillInfo) + return false; + + HandleLearnSkillRecipesHelper(target,targetSkillInfo->id); + + uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->id); + target->SetSkill(targetSkillInfo->id, target->GetSkillStep(targetSkillInfo->id), maxLevel, maxLevel); + PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); + return true; +} + +bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) +{ + + if (!*args) + return false; + + std::string ip = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; + + LoginDatabase.escape_string (ip); + + QueryResult_AutoPtr result = LoginDatabase.PQuery ("SELECT id,username FROM account WHERE last_ip = '%s'", ip.c_str ()); + + return LookupPlayerSearchCommand (result,limit); +} + +bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) +{ + if (!*args) + return false; + + std::string account = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; + + if (!AccountMgr::normalizeString (account)) + return false; + + LoginDatabase.escape_string (account); + + QueryResult_AutoPtr result = LoginDatabase.PQuery ("SELECT id,username FROM account WHERE username = '%s'", account.c_str ()); + + return LookupPlayerSearchCommand (result,limit); +} + +bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) +{ + + if (!*args) + return false; + + std::string email = strtok ((char*)args, " "); + char* limit_str = strtok (NULL, " "); + int32 limit = limit_str ? atoi (limit_str) : -1; + + LoginDatabase.escape_string (email); + + QueryResult_AutoPtr result = LoginDatabase.PQuery ("SELECT id,username FROM account WHERE email = '%s'", email.c_str ()); + + return LookupPlayerSearchCommand (result,limit); +} + +bool ChatHandler::LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit) +{ + if (!result) + { + PSendSysMessage(LANG_NO_PLAYERS_FOUND); + SetSentErrorMessage(true); + return false; + } + + int i =0; + do + { + Field* fields = result->Fetch(); + uint32 acc_id = fields[0].GetUInt32(); + std::string acc_name = fields[1].GetCppString(); + + QueryResult_AutoPtr chars = CharacterDatabase.PQuery("SELECT guid,name FROM characters WHERE account = '%u'", acc_id); + if (chars) + { + PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT,acc_name.c_str(),acc_id); + + uint64 guid = 0; + std::string name; + + do + { + Field* charfields = chars->Fetch(); + guid = charfields[0].GetUInt64(); + name = charfields[1].GetCppString(); + + PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER,name.c_str(),guid); + ++i; + + } while (chars->NextRow() && (limit == -1 || i < limit)); + } + } while (result->NextRow()); + + if (i == 0) // empty accounts only + { + PSendSysMessage(LANG_NO_PLAYERS_FOUND); + SetSentErrorMessage(true); + return false; + } + + return true; +} + +/// Triggering corpses expire check in world +bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/) +{ + CorpsesErase(); + return true; +} + +bool ChatHandler::HandleRepairitemsCommand(const char* args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + // Repair items + target->DurabilityRepairAll(false, 0, false); + + PSendSysMessage(LANG_YOU_REPAIR_ITEMS, GetNameLink(target).c_str()); + if (needReportToTarget(target)) + ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetNameLink().c_str()); + return true; +} + +bool ChatHandler::HandleWaterwalkCommand(const char* args) +{ + if (!*args) + return false; + + Player *player = getSelectedPlayer(); + + if (!player) + { + PSendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(player, 0)) + return false; + + if (strncmp(args, "on", 3) == 0) + player->SetMovement(MOVE_WATER_WALK); // ON + else if (strncmp(args, "off", 4) == 0) + player->SetMovement(MOVE_LAND_WALK); // OFF + else + { + SendSysMessage(LANG_USE_BOL); + return false; + } + + PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str()); + if (needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, GetNameLink().c_str()); + return true; +} + +bool ChatHandler::HandleCreatePetCommand(const char* /*args*/) +{ + Player *player = m_session->GetPlayer(); + Creature *creatureTarget = getSelectedCreature(); + + if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) + { + PSendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creatureTarget->GetEntry()); + // Creatures with family 0 crashes the server + if (cInfo->family == 0) + { + PSendSysMessage("This creature cannot be tamed. (family id: 0)."); + SetSentErrorMessage(true); + return false; + } + + if (player->GetPetGUID()) + { + PSendSysMessage("You already have a pet"); + SetSentErrorMessage(true); + return false; + } + + // Everything looks OK, create new pet + Pet* pet = new Pet(player, HUNTER_PET); + + if (!pet) + return false; + + if (!pet->CreateBaseAtCreature(creatureTarget)) + { + delete pet; + PSendSysMessage("Error 1"); + return false; + } + + creatureTarget->setDeathState(JUST_DIED); + creatureTarget->RemoveCorpse(); + creatureTarget->SetHealth(0); // just for nice GM-mode view + + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); + + if (!pet->InitStatsForLevel(creatureTarget->getLevel())) + { + sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + PSendSysMessage("Error 2"); + delete pet; + return false; + } + + // prepare visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1); + + pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); + // this enables pet details window (Shift+P) + pet->InitPetCreateSpells(); + pet->SetHealth(pet->GetMaxHealth()); + + pet->GetMap()->Add(pet->ToCreature()); + + // visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()); + + player->SetMinion(pet, true); + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + player->PetSpellInitialize(); + + return true; +} + +bool ChatHandler::HandlePetLearnCommand(const char* args) +{ + if (!*args) + return false; + + Player *plr = m_session->GetPlayer(); + Pet *pet = plr->GetPet(); + + if (!pet) + { + PSendSysMessage("You have no pet"); + SetSentErrorMessage(true); + return false; + } + + uint32 spellId = extractSpellIdFromLink((char*)args); + + if (!spellId || !sSpellStore.LookupEntry(spellId)) + return false; + + // Check if pet already has it + if (pet->HasSpell(spellId)) + { + PSendSysMessage("Pet already has spell: %u", spellId); + SetSentErrorMessage(true); + return false; + } + + // Check if spell is valid + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo)) + { + PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spellId); + SetSentErrorMessage(true); + return false; + } + + pet->learnSpell(spellId); + + PSendSysMessage("Pet has learned spell %u", spellId); + return true; +} + +bool ChatHandler::HandlePetUnlearnCommand(const char *args) +{ + if (!*args) + return false; + + Player *plr = m_session->GetPlayer(); + Pet *pet = plr->GetPet(); + + if (!pet) + { + PSendSysMessage("You have no pet"); + SetSentErrorMessage(true); + return false; + } + + uint32 spellId = extractSpellIdFromLink((char*)args); + + if (pet->HasSpell(spellId)) + pet->removeSpell(spellId, false); + else + PSendSysMessage("Pet doesn't have that spell"); + + return true; +} + +bool ChatHandler::HandlePetTpCommand(const char *args) +{ + if (!*args) + return false; + + Player *plr = m_session->GetPlayer(); + Pet *pet = plr->GetPet(); + + if (!pet) + { + PSendSysMessage("You have no pet"); + SetSentErrorMessage(true); + return false; + } + + uint32 tp = atol(args); + + //pet->SetTP(tp); + + PSendSysMessage("Pet's tp changed to %u", tp); + return true; +} + +bool ChatHandler::HandleActivateObjectCommand(const char *args) +{ + if (!*args) + return false; + + char* cId = extractKeyFromLink((char*)args,"Hgameobject"); + if (!cId) + return false; + + uint32 lowguid = atoi(cId); + if (!lowguid) + return false; + + GameObject* obj = NULL; + + // by DB guid + if (GameObjectData const* go_data = objmgr.GetGOData(lowguid)) + obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + + if (!obj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + + // Activate + obj->SetLootState(GO_READY); + obj->UseDoorOrButton(10000); + + PSendSysMessage("Object activated!"); + + return true; +} + +// add creature, temp only +bool ChatHandler::HandleTempAddSpwCommand(const char* args) +{ + if (!*args) + return false; + char* charID = strtok((char*)args, " "); + if (!charID) + return false; + + Player *chr = m_session->GetPlayer(); + + uint32 id = atoi(charID); + if (!id) + return false; + + chr->SummonCreature(id, *chr, TEMPSUMMON_CORPSE_DESPAWN, 120); + + return true; +} + +// add go, temp only +bool ChatHandler::HandleTempGameObjectCommand(const char* args) +{ + if (!*args) + return false; + char* charID = strtok((char*)args, " "); + if (!charID) + return false; + + Player *chr = m_session->GetPlayer(); + + char* spawntime = strtok(NULL, " "); + uint32 spawntm = 300; + + if (spawntime) + spawntm = atoi((char*)spawntime); + + float x = chr->GetPositionX(); + float y = chr->GetPositionY(); + float z = chr->GetPositionZ(); + float ang = chr->GetOrientation(); + + float rot2 = sin(ang/2); + float rot3 = cos(ang/2); + + uint32 id = atoi(charID); + + chr->SummonGameObject(id,x,y,z,ang,0,0,rot2,rot3,spawntm); + + return true; +} + +bool ChatHandler::HandleNpcAddFormationCommand(const char* args) +{ + if (!*args) + return false; + + uint32 leaderGUID = (uint32) atoi((char*)args); + Creature *pCreature = getSelectedCreature(); + + if (!pCreature || !pCreature->GetDBTableGUIDLow()) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + uint32 lowguid = pCreature->GetDBTableGUIDLow(); + if (pCreature->GetFormation()) + { + PSendSysMessage("Selected creature is already member of group %u", pCreature->GetFormation()->GetId()); + return false; + } + + if (!lowguid) + return false; + + Player *chr = m_session->GetPlayer(); + FormationInfo *group_member; + + group_member = new FormationInfo; + group_member->follow_angle = (pCreature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI; + group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - pCreature->GetPositionX(),int(2))+pow(chr->GetPositionY()-pCreature->GetPositionY(),int(2))); + group_member->leaderGUID = leaderGUID; + group_member->groupAI = 0; + + CreatureGroupMap[lowguid] = group_member; + pCreature->SearchFormation(); + + WorldDatabase.PExecuteLog("INSERT INTO creature_formations (leaderGUID, memberGUID, dist, angle, groupAI) VALUES ('%u','%u','%f', '%f', '%u')", + leaderGUID, lowguid, group_member->follow_dist, group_member->follow_angle, group_member->groupAI); + + PSendSysMessage("Creature %u added to formation with leader %u", lowguid, leaderGUID); + + return true; + } + +bool ChatHandler::HandleNpcSetLinkCommand(const char* args) +{ + if (!*args) + return false; + + uint32 linkguid = (uint32) atoi((char*)args); + + Creature* pCreature = getSelectedCreature(); + + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (!pCreature->GetDBTableGUIDLow()) + { + PSendSysMessage("Selected creature isn't in creature table", pCreature->GetGUIDLow()); + SetSentErrorMessage(true); + return false; + } + + if (!objmgr.SetCreatureLinkedRespawn(pCreature->GetDBTableGUIDLow(), linkguid)) + { + PSendSysMessage("Selected creature can't link with guid '%u'", linkguid); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, pCreature->GetDBTableGUIDLow()); + return true; +} + +bool ChatHandler::HandleWintergraspStatusCommand(const char* args) +{ + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); + + if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) + { + SendSysMessage(LANG_BG_WG_DISABLE); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_BG_WG_STATUS, objmgr.GetTrinityStringForDBCLocale( + pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE), + secsToTimeString(pvpWG->GetTimer(), true).c_str(), + pvpWG->isWarTime() ? "Yes" : "No", + pvpWG->GetNumPlayersH(), + pvpWG->GetNumPlayersA()); + return true; +} + +bool ChatHandler::HandleWintergraspStartCommand(const char* args) +{ + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); + + if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) + { + SendSysMessage(LANG_BG_WG_DISABLE); + SetSentErrorMessage(true); + return false; + } + pvpWG->forceStartBattle(); + PSendSysMessage(LANG_BG_WG_BATTLE_FORCE_START); + return true; +} + +bool ChatHandler::HandleWintergraspStopCommand(const char* args) +{ + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); + + if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) + { + SendSysMessage(LANG_BG_WG_DISABLE); + SetSentErrorMessage(true); + return false; + } + pvpWG->forceStopBattle(); + PSendSysMessage(LANG_BG_WG_BATTLE_FORCE_STOP); + return true; +} + +bool ChatHandler::HandleWintergraspEnableCommand(const char* args) +{ + if(!*args) + return false; + + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); + + if (!pvpWG || !sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) + { + SendSysMessage(LANG_BG_WG_DISABLE); + SetSentErrorMessage(true); + return false; + } + + if (!strncmp(args, "on", 3)) + { + if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) + { + pvpWG->forceStopBattle(); + sWorld.setConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED, true); + } + PSendSysMessage(LANG_BG_WG_ENABLE); + return true; + } + else if (!strncmp(args, "off", 4)) + { + if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) + { + pvpWG->forceStopBattle(); + sWorld.setConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED, false); + } + PSendSysMessage(LANG_BG_WG_DISABLE); + return true; + } + else + { + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; + } +} + +bool ChatHandler::HandleWintergraspTimerCommand(const char* args) +{ + if(!*args) + return false; + + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); + + if (!pvpWG) + { + SendSysMessage(LANG_BG_WG_DISABLE); + SetSentErrorMessage(true); + return false; + } + + int32 time = atoi (args); + + // Min value 1 min + if (1 > time) + time = 1; + // Max value during wartime = 60. No wartime = 1440 (day) + if (pvpWG->isWarTime()) + { + if (60 < time) + return false; + } + else + if (1440 < time) + return false; + time *= MINUTE * IN_MILLISECONDS; + + pvpWG->setTimer((uint32)time); + + PSendSysMessage(LANG_BG_WG_CHANGE_TIMER, secsToTimeString(pvpWG->GetTimer(), true).c_str()); + return true; +} + +bool ChatHandler::HandleWintergraspSwitchTeamCommand(const char* args) +{ + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); + + if (!pvpWG) + { + SendSysMessage(LANG_BG_WG_DISABLE); + SetSentErrorMessage(true); + return false; + } + uint32 timer = pvpWG->GetTimer(); + pvpWG->forceChangeTeam(); + pvpWG->setTimer(timer); + PSendSysMessage(LANG_BG_WG_SWITCH_FACTION, GetTrinityString(pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE)); + return true; +} + +bool ChatHandler::HandleLookupTitleCommand(const char* args) +{ + if (!*args) + return false; + + // can be NULL in console call + Player* target = getSelectedPlayer(); + + // title name have single string arg for player name + char const* targetName = target ? target->GetName() : "NAME"; + + std::string namepart = args; + std::wstring wnamepart; + + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wnamepart); + + uint32 counter = 0; // Counter for figure out that we found smth. + + // Search in CharTitles.dbc + for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) + { + CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id); + if (titleInfo) + { + int loc = GetSessionDbcLocale(); + std::string name = titleInfo->name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale()) + continue; + + name = titleInfo->name[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + char const* knownStr = target && target->HasTitle(titleInfo) ? GetTrinityString(LANG_KNOWN) : ""; + + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index + ? GetTrinityString(LANG_ACTIVE) + : ""; + + char titleNameStr[80]; + snprintf(titleNameStr,80,name.c_str(),targetName); + + // send title in "id (idx:idx) - [namedlink locale]" format + if (m_session) + PSendSysMessage(LANG_TITLE_LIST_CHAT,id,titleInfo->bit_index,id,titleNameStr,localeNames[loc],knownStr,activeStr); + else + PSendSysMessage(LANG_TITLE_LIST_CONSOLE,id,titleInfo->bit_index,titleNameStr,localeNames[loc],knownStr,activeStr); + + ++counter; + } + } + } + if (counter == 0) // if counter == 0 then we found nth + SendSysMessage(LANG_COMMAND_NOTITLEFOUND); + return true; +} + +bool ChatHandler::HandleTitlesAddCommand(const char* args) +{ + // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r + char* id_p = extractKeyFromLink((char*)args,"Htitle"); + if (!id_p) + return false; + + int32 id = atoi(id_p); + if (id <= 0) + { + PSendSysMessage(LANG_INVALID_TITLE_ID, id); + SetSentErrorMessage(true); + return false; + } + + Player * target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + if (!titleInfo) + { + PSendSysMessage(LANG_INVALID_TITLE_ID, id); + SetSentErrorMessage(true); + return false; + } + + std::string tNameLink = GetNameLink(target); + + char const* targetName = target->GetName(); + char titleNameStr[80]; + snprintf(titleNameStr,80,titleInfo->name[GetSessionDbcLocale()],targetName); + + target->SetTitle(titleInfo); + PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str()); + + return true; +} + +bool ChatHandler::HandleTitlesRemoveCommand(const char* args) +{ + // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r + char* id_p = extractKeyFromLink((char*)args,"Htitle"); + if (!id_p) + return false; + + int32 id = atoi(id_p); + if (id <= 0) + { + PSendSysMessage(LANG_INVALID_TITLE_ID, id); + SetSentErrorMessage(true); + return false; + } + + Player * target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + if (!titleInfo) + { + PSendSysMessage(LANG_INVALID_TITLE_ID, id); + SetSentErrorMessage(true); + return false; + } + + target->SetTitle(titleInfo,true); + + std::string tNameLink = GetNameLink(target); + + char const* targetName = target->GetName(); + char titleNameStr[80]; + snprintf(titleNameStr,80,titleInfo->name[GetSessionDbcLocale()],targetName); + + PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str()); + + if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE))) + { + target->SetUInt32Value(PLAYER_CHOSEN_TITLE,0); + PSendSysMessage(LANG_CURRENT_TITLE_RESET, tNameLink.c_str()); + } + + return true; +} + +//Edit Player KnownTitles +bool ChatHandler::HandleTitlesSetMaskCommand(const char* args) +{ + if (!*args) + return false; + + uint64 titles = 0; + + sscanf((char*)args, UI64FMTD, &titles); + + Player *target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + uint64 titles2 = titles; + + for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i) + if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i)) + titles2 &= ~(uint64(1) << tEntry->bit_index); + + titles &= ~titles2; // remove not existed titles + + target->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, titles); + SendSysMessage(LANG_DONE); + + if (!target->HasTitle(target->GetInt32Value(PLAYER_CHOSEN_TITLE))) + { + target->SetUInt32Value(PLAYER_CHOSEN_TITLE,0); + PSendSysMessage(LANG_CURRENT_TITLE_RESET,GetNameLink(target).c_str()); + } + + return true; +} + +bool ChatHandler::HandleCharacterTitlesCommand(const char* args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + LocaleConstant loc = GetSessionDbcLocale(); + char const* targetName = target->GetName(); + char const* knownStr = GetTrinityString(LANG_KNOWN); + + // Search in CharTitles.dbc + for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) + { + CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id); + if (titleInfo && target->HasTitle(titleInfo)) + { + std::string name = titleInfo->name[loc]; + if (name.empty()) + continue; + + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index + ? GetTrinityString(LANG_ACTIVE) + : ""; + + char titleNameStr[80]; + snprintf(titleNameStr,80,name.c_str(),targetName); + + // send title in "id (idx:idx) - [namedlink locale]" format + if (m_session) + PSendSysMessage(LANG_TITLE_LIST_CHAT,id,titleInfo->bit_index,id,titleNameStr,localeNames[loc],knownStr,activeStr); + else + PSendSysMessage(LANG_TITLE_LIST_CONSOLE,id,titleInfo->bit_index,name.c_str(),localeNames[loc],knownStr,activeStr); + } + } + return true; +} + +bool ChatHandler::HandleTitlesCurrentCommand(const char* args) +{ + // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r + char* id_p = extractKeyFromLink((char*)args,"Htitle"); + if (!id_p) + return false; + + int32 id = atoi(id_p); + if (id <= 0) + { + PSendSysMessage(LANG_INVALID_TITLE_ID, id); + SetSentErrorMessage(true); + return false; + } + + Player * target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // check online security + if (HasLowerSecurity(target, 0)) + return false; + + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); + if (!titleInfo) + { + PSendSysMessage(LANG_INVALID_TITLE_ID, id); + SetSentErrorMessage(true); + return false; + } + + std::string tNameLink = GetNameLink(target); + + target->SetTitle(titleInfo); // to be sure that title now known + target->SetUInt32Value(PLAYER_CHOSEN_TITLE,titleInfo->bit_index); + + PSendSysMessage(LANG_TITLE_CURRENT_RES, id, titleInfo->name[GetSessionDbcLocale()], tNameLink.c_str()); + + return true; +} diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp new file mode 100644 index 0000000..3ddf9b8 --- /dev/null +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -0,0 +1,7805 @@ +/* +* Copyright (C) 2005-2009 MaNGOS +* +* Copyright (C) 2008-2010 Trinity +* +* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "Common.h" +#include "DatabaseEnv.h" +#include "WorldPacket.h" +#include "WorldSession.h" +#include "World.h" +#include "ObjectMgr.h" +#include "AuctionHouseMgr.h" +#include "AccountMgr.h" +#include "PlayerDump.h" +#include "SpellMgr.h" +#include "Player.h" +#include "Opcodes.h" +#include "GameObject.h" +#include "Chat.h" +#include "Log.h" +#include "Guild.h" +#include "ObjectAccessor.h" +#include "MapManager.h" +#include "Language.h" +#include "GridNotifiersImpl.h" +#include "CellImpl.h" +#include "Weather.h" +#include "PointMovementGenerator.h" +#include "TargetedMovementGenerator.h" +#include "SkillDiscovery.h" +#include "SkillExtraItems.h" +#include "SystemConfig.h" +#include "ConfigEnv.h" +#include "Util.h" +#include "ItemEnchantmentMgr.h" +#include "BattleGroundMgr.h" +#include "InstanceSaveMgr.h" +#include "InstanceData.h" +#include "AuctionHouseBot.h" +#include "CreatureEventAIMgr.h" +#include "SpellAuraEffects.h" +#include "DBCEnums.h" +#include "ConditionMgr.h" + +bool ChatHandler::HandleAHBotOptionsCommand(const char *args) +{ + uint32 ahMapID = 0; + char * opt = strtok((char*)args, " "); + char * ahMapIdStr = strtok(NULL, " "); + if (ahMapIdStr) + { + ahMapID = (uint32) strtoul(ahMapIdStr, NULL, 0); + switch (ahMapID) + { + case 2: + case 6: + case 7: + break; + default: + opt = NULL; + break; + } + } + if (!opt) + { + PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter"); + PSendSysMessage("Try ahbotoptions help to see a list of options."); + return false; + } + int l = strlen(opt); + + if (strncmp(opt,"help",l) == 0) + { + PSendSysMessage("AHBot commands:"); + PSendSysMessage("ahexpire"); + PSendSysMessage("minitems"); + PSendSysMessage("maxitems"); + //PSendSysMessage(""); + //PSendSysMessage(""); + PSendSysMessage("percentages"); + PSendSysMessage("minprice"); + PSendSysMessage("maxprice"); + PSendSysMessage("minbidprice"); + PSendSysMessage("maxbidprice"); + PSendSysMessage("maxstack"); + PSendSysMessage("buyerprice"); + PSendSysMessage("bidinterval"); + PSendSysMessage("bidsperinterval"); + return true; + } + else if (strncmp(opt,"ahexpire",l) == 0) + { + if (!ahMapIdStr) + { + PSendSysMessage("Syntax is: ahbotoptions ahexpire $ahMapID (2, 6 or 7)"); + return false; + } + auctionbot.Commands(0, ahMapID, NULL, NULL); + } + else if (strncmp(opt,"minitems",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions minitems $ahMapID (2, 6 or 7) $minItems"); + return false; + } + auctionbot.Commands(1, ahMapID, NULL, param1); + } + else if (strncmp(opt,"maxitems",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions maxitems $ahMapID (2, 6 or 7) $maxItems"); + return false; + } + auctionbot.Commands(2, ahMapID, NULL, param1); + } + else if (strncmp(opt,"mintime",l) == 0) + { + PSendSysMessage("ahbotoptions mintime has been deprecated"); + return false; + /* + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions mintime $ahMapID (2, 6 or 7) $mintime"); + return false; + } + auctionbot.Commands(3, ahMapID, NULL, param1); + */ + } + else if (strncmp(opt,"maxtime",l) == 0) + { + PSendSysMessage("ahbotoptions maxtime has been deprecated"); + return false; + /* + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions maxtime $ahMapID (2, 6 or 7) $maxtime"); + return false; + } + auctionbot.Commands(4, ahMapID, NULL, param1); + */ + } + else if (strncmp(opt,"percentages",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + char * param3 = strtok(NULL, " "); + char * param4 = strtok(NULL, " "); + char * param5 = strtok(NULL, " "); + char * param6 = strtok(NULL, " "); + char * param7 = strtok(NULL, " "); + char * param8 = strtok(NULL, " "); + char * param9 = strtok(NULL, " "); + char * param10 = strtok(NULL, " "); + char * param11 = strtok(NULL, " "); + char * param12 = strtok(NULL, " "); + char * param13 = strtok(NULL, " "); + char * param14 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param14)) + { + PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14"); + PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods"); + PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems"); + PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems"); + PSendSysMessage("The total must add up to 100%"); + return false; + } + uint32 greytg = (uint32) strtoul(param1, NULL, 0); + uint32 whitetg = (uint32) strtoul(param2, NULL, 0); + uint32 greentg = (uint32) strtoul(param3, NULL, 0); + uint32 bluetg = (uint32) strtoul(param3, NULL, 0); + uint32 purpletg = (uint32) strtoul(param5, NULL, 0); + uint32 orangetg = (uint32) strtoul(param6, NULL, 0); + uint32 yellowtg = (uint32) strtoul(param7, NULL, 0); + uint32 greyi = (uint32) strtoul(param8, NULL, 0); + uint32 whitei = (uint32) strtoul(param9, NULL, 0); + uint32 greeni = (uint32) strtoul(param10, NULL, 0); + uint32 bluei = (uint32) strtoul(param11, NULL, 0); + uint32 purplei = (uint32) strtoul(param12, NULL, 0); + uint32 orangei = (uint32) strtoul(param13, NULL, 0); + uint32 yellowi = (uint32) strtoul(param14, NULL, 0); + uint32 totalPercent = greytg + whitetg + greentg + bluetg + purpletg + orangetg + yellowtg + greyi + whitei + greeni + bluei + purplei + orangei + yellowi; + if ((totalPercent == 0) || (totalPercent != 100)) + { + PSendSysMessage("Syntax is: ahbotoptions percentages $ahMapID (2, 6 or 7) $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14"); + PSendSysMessage("1 GreyTradeGoods 2 WhiteTradeGoods 3 GreenTradeGoods 4 BlueTradeGoods 5 PurpleTradeGoods"); + PSendSysMessage("6 OrangeTradeGoods 7 YellowTradeGoods 8 GreyItems 9 WhiteItems 10 GreenItems 11 BlueItems"); + PSendSysMessage("12 PurpleItems 13 OrangeItems 14 YellowItems"); + PSendSysMessage("The total must add up to 100%"); + return false; + } + char param[100]; + param[0] = '\0'; + strcat(param, param1); + strcat(param, " "); + strcat(param, param2); + strcat(param, " "); + strcat(param, param3); + strcat(param, " "); + strcat(param, param4); + strcat(param, " "); + strcat(param, param5); + strcat(param, " "); + strcat(param, param6); + strcat(param, " "); + strcat(param, param7); + strcat(param, " "); + strcat(param, param8); + strcat(param, " "); + strcat(param, param9); + strcat(param, " "); + strcat(param, param10); + strcat(param, " "); + strcat(param, param11); + strcat(param, " "); + strcat(param, param12); + strcat(param, " "); + strcat(param, param13); + strcat(param, " "); + strcat(param, param14); + auctionbot.Commands(5, ahMapID, NULL, param); + } + else if (strncmp(opt,"minprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + if (strncmp(param1,"grey",l) == 0) + { + auctionbot.Commands(6, ahMapID, AHB_GREY, param2); + } + else if (strncmp(param1,"white",l) == 0) + { + auctionbot.Commands(6, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + auctionbot.Commands(6, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + auctionbot.Commands(6, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + auctionbot.Commands(6, ahMapID, AHB_PURPLE, param2); + } + else if (strncmp(param1,"orange",l) == 0) + { + auctionbot.Commands(6, ahMapID, AHB_ORANGE, param2); + } + else if (strncmp(param1,"yellow",l) == 0) + { + auctionbot.Commands(6, ahMapID, AHB_YELLOW, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions minprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + } + else if (strncmp(opt,"maxprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + if (strncmp(param1,"grey",l) == 0) + { + auctionbot.Commands(7, ahMapID, AHB_GREY, param2); + } + else if (strncmp(param1,"white",l) == 0) + { + auctionbot.Commands(7, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + auctionbot.Commands(7, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + auctionbot.Commands(7, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + auctionbot.Commands(7, ahMapID, AHB_PURPLE, param2); + } + else if (strncmp(param1,"orange",l) == 0) + { + auctionbot.Commands(7, ahMapID, AHB_ORANGE, param2); + } + else if (strncmp(param1,"yellow",l) == 0) + { + auctionbot.Commands(7, ahMapID, AHB_YELLOW, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions maxprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + } + else if (strncmp(opt,"minbidprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + uint32 minBidPrice = (uint32) strtoul(param2, NULL, 0); + if ((minBidPrice < 1) || (minBidPrice > 100)) + { + PSendSysMessage("The min bid price multiplier must be between 1 and 100"); + return false; + } + if (strncmp(param1,"grey",l) == 0) + { + auctionbot.Commands(8, ahMapID, AHB_GREY, param2); + } + else if (strncmp(param1,"white",l) == 0) + { + auctionbot.Commands(8, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + auctionbot.Commands(8, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + auctionbot.Commands(8, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + auctionbot.Commands(8, ahMapID, AHB_PURPLE, param2); + } + else if (strncmp(param1,"orange",l) == 0) + { + auctionbot.Commands(8, ahMapID, AHB_ORANGE, param2); + } + else if (strncmp(param1,"yellow",l) == 0) + { + auctionbot.Commands(8, ahMapID, AHB_YELLOW, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions minbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + } + else if (strncmp(opt,"maxbidprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions maxbidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + uint32 maxBidPrice = (uint32) strtoul(param2, NULL, 0); + if ((maxBidPrice < 1) || (maxBidPrice > 100)) + { + PSendSysMessage("The max bid price multiplier must be between 1 and 100"); + return false; + } + if (strncmp(param1,"grey",l) == 0) + { + auctionbot.Commands(9, ahMapID, AHB_GREY, param2); + } + else if (strncmp(param1,"white",l) == 0) + { + auctionbot.Commands(9, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + auctionbot.Commands(9, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + auctionbot.Commands(9, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + auctionbot.Commands(9, ahMapID, AHB_PURPLE, param2); + } + else if (strncmp(param1,"orange",l) == 0) + { + auctionbot.Commands(9, ahMapID, AHB_ORANGE, param2); + } + else if (strncmp(param1,"yellow",l) == 0) + { + auctionbot.Commands(9, ahMapID, AHB_YELLOW, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions max bidprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $price"); + return false; + } + } + else if (strncmp(opt,"maxstack",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $value"); + return false; + } + uint32 maxStack = (uint32) strtoul(param2, NULL, 0); + if (maxStack < 0) + { + PSendSysMessage("maxstack can't be a negative number."); + return false; + } + if (strncmp(param1,"grey",l) == 0) + { + auctionbot.Commands(10, ahMapID, AHB_GREY, param2); + } + else if (strncmp(param1,"white",l) == 0) + { + auctionbot.Commands(10, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + auctionbot.Commands(10, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + auctionbot.Commands(10, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + auctionbot.Commands(10, ahMapID, AHB_PURPLE, param2); + } + else if (strncmp(param1,"orange",l) == 0) + { + auctionbot.Commands(10, ahMapID, AHB_ORANGE, param2); + } + else if (strncmp(param1,"yellow",l) == 0) + { + auctionbot.Commands(10, ahMapID, AHB_YELLOW, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions maxstack $ahMapID (2, 6 or 7) $color (grey, white, green, blue, purple, orange or yellow) $value"); + return false; + } + } + else if (strncmp(opt,"buyerprice",l) == 0) + { + char * param1 = strtok(NULL, " "); + char * param2 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1) || (!param2)) + { + PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price"); + return false; + } + if (strncmp(param1,"grey",l) == 0) + { + auctionbot.Commands(11, ahMapID, AHB_GREY, param2); + } + else if (strncmp(param1,"white",l) == 0) + { + auctionbot.Commands(11, ahMapID, AHB_WHITE, param2); + } + else if (strncmp(param1,"green",l) == 0) + { + auctionbot.Commands(11, ahMapID, AHB_GREEN, param2); + } + else if (strncmp(param1,"blue",l) == 0) + { + auctionbot.Commands(11, ahMapID, AHB_BLUE, param2); + } + else if (strncmp(param1,"purple",l) == 0) + { + auctionbot.Commands(11, ahMapID, AHB_PURPLE, param2); + } + else if (strncmp(param1,"orange",l) == 0) + { + auctionbot.Commands(11, ahMapID, AHB_ORANGE, param2); + } + else if (strncmp(param1,"yellow",l) == 0) + { + auctionbot.Commands(11, ahMapID, AHB_YELLOW, param2); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions buyerprice $ahMapID (2, 6 or 7) $color (grey, white, green, blue or purple) $price"); + return false; + } + } + else if (strncmp(opt,"bidinterval",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions bidinterval $ahMapID (2, 6 or 7) $interval(in minutes)"); + return false; + } + auctionbot.Commands(12, ahMapID, NULL, param1); + } + else if (strncmp(opt,"bidsperinterval",l) == 0) + { + char * param1 = strtok(NULL, " "); + if ((!ahMapIdStr) || (!param1)) + { + PSendSysMessage("Syntax is: ahbotoptions bidsperinterval $ahMapID (2, 6 or 7) $bids"); + return false; + } + auctionbot.Commands(13, ahMapID, NULL, param1); + } + else + { + PSendSysMessage("Syntax is: ahbotoptions $option $ahMapID (2, 6 or 7) $parameter"); + PSendSysMessage("Try ahbotoptions help to see a list of options."); + return false; + } + return true; +} + +//reload commands +bool ChatHandler::HandleReloadAllCommand(const char*) +{ + HandleReloadSkillFishingBaseLevelCommand(""); + + HandleReloadAllAchievementCommand(""); + HandleReloadAllAreaCommand(""); + HandleReloadAllEventAICommand(""); + HandleReloadAllLootCommand(""); + HandleReloadAllNpcCommand(""); + HandleReloadAllQuestCommand(""); + HandleReloadAllSpellCommand(""); + HandleReloadAllItemCommand(""); + HandleReloadAllLocalesCommand(""); + + HandleReloadAccessRequirementCommand(""); + HandleReloadMailLevelRewardCommand(""); + HandleReloadCommandCommand(""); + HandleReloadReservedNameCommand(""); + HandleReloadTrinityStringCommand(""); + HandleReloadGameTeleCommand(""); + + HandleReloadAutobroadcastCommand(""); + return true; +} + +bool ChatHandler::HandleReloadAllAchievementCommand(const char*) +{ + HandleReloadAchievementCriteriaDataCommand(""); + HandleReloadAchievementRewardCommand(""); + return true; +} + +bool ChatHandler::HandleReloadAllAreaCommand(const char*) +{ + //HandleReloadQuestAreaTriggersCommand(""); -- reloaded in HandleReloadAllQuestCommand + HandleReloadAreaTriggerTeleportCommand(""); + HandleReloadAreaTriggerTavernCommand(""); + HandleReloadGameGraveyardZoneCommand(""); + return true; +} + +bool ChatHandler::HandleReloadAllLootCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables..."); + LoadLootTables(); + SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadAllNpcCommand(const char* /*args*/) +{ + HandleReloadNpcGossipCommand("a"); + HandleReloadNpcTrainerCommand("a"); + HandleReloadNpcVendorCommand("a"); + HandleReloadPointsOfInterestCommand("a"); + HandleReloadSpellClickSpellsCommand("a"); + return true; +} + +bool ChatHandler::HandleReloadAllQuestCommand(const char* /*args*/) +{ + HandleReloadQuestAreaTriggersCommand("a"); + HandleReloadQuestTemplateCommand("a"); + + sLog.outString("Re-Loading Quests Relations..."); + objmgr.LoadQuestRelations(); + SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAllScriptsCommand(const char*) +{ + if (sWorld.IsScriptScheduled()) + { + PSendSysMessage("DB scripts used currently, please attempt reload later."); + SetSentErrorMessage(true); + return false; + } + + sLog.outString("Re-Loading Scripts..."); + HandleReloadGameObjectScriptsCommand("a"); + HandleReloadEventScriptsCommand("a"); + HandleReloadQuestEndScriptsCommand("a"); + HandleReloadQuestStartScriptsCommand("a"); + HandleReloadSpellScriptsCommand("a"); + SendGlobalGMSysMessage("DB tables `*_scripts` reloaded."); + HandleReloadDbScriptStringCommand("a"); + HandleReloadWpScriptsCommand("a"); + return true; +} + +bool ChatHandler::HandleReloadAllEventAICommand(const char*) +{ + HandleReloadEventAITextsCommand("a"); + HandleReloadEventAISummonsCommand("a"); + HandleReloadEventAIScriptsCommand("a"); + return true; +} + +bool ChatHandler::HandleReloadAllSpellCommand(const char*) +{ + HandleReloadSkillDiscoveryTemplateCommand("a"); + HandleReloadSkillExtraItemTemplateCommand("a"); + HandleReloadSpellRequiredCommand("a"); + HandleReloadSpellAreaCommand("a"); + HandleReloadSpellGroupsCommand("a"); + HandleReloadSpellLearnSpellCommand("a"); + HandleReloadSpellLinkedSpellCommand("a"); + HandleReloadSpellProcEventCommand("a"); + HandleReloadSpellBonusesCommand("a"); + HandleReloadSpellTargetPositionCommand("a"); + HandleReloadSpellThreatsCommand("a"); + HandleReloadSpellGroupStackRulesCommand("a"); + HandleReloadSpellPetAurasCommand("a"); + HandleReloadSpellDisabledCommand("a"); + return true; +} + +bool ChatHandler::HandleReloadAllItemCommand(const char*) +{ + HandleReloadPageTextsCommand("a"); + HandleReloadItemEnchantementsCommand("a"); + return true; +} + +bool ChatHandler::HandleReloadAllLocalesCommand(const char* /*args*/) +{ + HandleReloadLocalesAchievementRewardCommand("a"); + HandleReloadLocalesCreatureCommand("a"); + HandleReloadLocalesGameobjectCommand("a"); + HandleReloadLocalesItemCommand("a"); + HandleReloadLocalesNpcTextCommand("a"); + HandleReloadLocalesPageTextCommand("a"); + HandleReloadLocalesPointsOfInterestCommand("a"); + HandleReloadLocalesQuestCommand("a"); + return true; +} + +bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) +{ + sLog.outString("Re-Loading config settings..."); + sWorld.LoadConfigSettings(true); + sMapMgr.InitializeVisibilityDistanceInfo(); + SendGlobalGMSysMessage("World config settings reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAccessRequirementCommand(const char*) +{ + sLog.outString("Re-Loading Access Requirement definitions..."); + objmgr.LoadAccessRequirements(); + SendGlobalGMSysMessage("DB table `access_requirement` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAchievementCriteriaDataCommand(const char*) +{ + sLog.outString("Re-Loading Additional Achievement Criteria Data..."); + achievementmgr.LoadAchievementCriteriaData(); + SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAchievementRewardCommand(const char*) +{ + sLog.outString("Re-Loading Achievement Reward Data..."); + achievementmgr.LoadRewards(); + SendGlobalGMSysMessage("DB table `achievement_reward` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAreaTriggerTavernCommand(const char*) +{ + sLog.outString("Re-Loading Tavern Area Triggers..."); + objmgr.LoadTavernAreaTriggers(); + SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAreaTriggerTeleportCommand(const char*) +{ + sLog.outString("Re-Loading AreaTrigger teleport definitions..."); + objmgr.LoadAreaTriggerTeleports(); + SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAutobroadcastCommand(const char*) +{ + sLog.outString("Re-Loading Autobroadcast..."); + sWorld.LoadAutobroadcasts(); + SendGlobalGMSysMessage("DB table `autobroadcast` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadCommandCommand(const char*) +{ + load_command_table = true; + SendGlobalGMSysMessage("DB table `command` will be reloaded at next chat command use."); + return true; +} + +bool ChatHandler::HandleReloadOnKillReputationCommand(const char*) +{ + sLog.outString("Re-Loading creature award reputation definitions..."); + objmgr.LoadReputationOnKill(); + SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args) +{ + if (!*args) + return false; + + uint32 entry = (uint32) atoi((char*)args); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT difficulty_entry_1,difficulty_entry_2,difficulty_entry_3,KillCredit1,KillCredit2,modelid1,modelid2,modelid3,modelid4,name,subname,IconName,gossip_menu_id,minlevel,maxlevel,exp,faction_A,faction_H,npcflag,speed_walk,speed_run,scale,rank,mindmg,maxdmg,dmgschool,attackpower,dmg_multiplier,baseattacktime,rangeattacktime,unit_class,unit_flags,dynamicflags,family,trainer_type,trainer_spell,trainer_class,trainer_race,minrangedmg,maxrangedmg,rangedattackpower,type,type_flags,lootid,pickpocketloot,skinloot,resistance1,resistance2,resistance3,resistance4,resistance5,resistance6,spell1,spell2,spell3,spell4,spell5,spell6,spell7,spell8,PetSpellDataId,VehicleId,mingold,maxgold,AIName,MovementType,InhabitType,Health_mod,Mana_mod,Armor_mod,RacialLeader,questItem1,questItem2,questItem3,questItem4,questItem5,questItem6,movementId,RegenHealth,equipment_id,mechanic_immune_mask,flags_extra,ScriptName FROM creature_template WHERE entry = %u", entry); + if (!result) + { + PSendSysMessage(LANG_COMMAND_CREATURETEMPLATE_NOTFOUND, entry); + SetSentErrorMessage(true); + return false; + } + + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(entry); + if (!cInfo) + { + PSendSysMessage(LANG_COMMAND_CREATURESTORAGE_NOTFOUND, entry); + SetSentErrorMessage(true); + return false; + } + + sLog.outString("Reloading creature template entry %u", entry); + + Field *fields = result->Fetch(); + + const_cast(cInfo)->DifficultyEntry[0] = fields[0].GetUInt32(); + const_cast(cInfo)->DifficultyEntry[1] = fields[1].GetUInt32(); + const_cast(cInfo)->DifficultyEntry[2] = fields[2].GetUInt32(); + const_cast(cInfo)->KillCredit[0] = fields[3].GetUInt32(); + const_cast(cInfo)->KillCredit[1] = fields[4].GetUInt32(); + const_cast(cInfo)->Modelid1 = fields[5].GetUInt32(); + const_cast(cInfo)->Modelid2 = fields[6].GetUInt32(); + const_cast(cInfo)->Modelid3 = fields[7].GetUInt32(); + const_cast(cInfo)->Modelid4 = fields[8].GetUInt32(); + size_t len = 0; + if (const char* temp = fields[9].GetString()) + { + delete[] cInfo->Name; + len = strlen(temp)+1; + const_cast(cInfo)->Name = new char[len]; + strncpy(cInfo->Name, temp, len); + } + if (const char* temp = fields[10].GetString()) + { + delete[] cInfo->SubName; + len = strlen(temp)+1; + const_cast(cInfo)->SubName = new char[len]; + strncpy(cInfo->SubName, temp, len); + } + if (const char* temp = fields[11].GetString()) + { + delete[] cInfo->IconName; + len = strlen(temp)+1; + const_cast(cInfo)->IconName = new char[len]; + strncpy(cInfo->IconName, temp, len); + } + const_cast(cInfo)->GossipMenuId = fields[12].GetUInt32(); + const_cast(cInfo)->minlevel = fields[13].GetUInt32(); + const_cast(cInfo)->maxlevel = fields[14].GetUInt32(); + const_cast(cInfo)->expansion = fields[15].GetUInt32(); + const_cast(cInfo)->faction_A = fields[16].GetUInt32(); + const_cast(cInfo)->faction_H = fields[17].GetUInt32(); + const_cast(cInfo)->npcflag = fields[18].GetUInt32(); + const_cast(cInfo)->speed_walk = fields[19].GetFloat(); + const_cast(cInfo)->speed_run = fields[20].GetFloat(); + const_cast(cInfo)->scale = fields[21].GetFloat(); + const_cast(cInfo)->rank = fields[22].GetUInt32(); + const_cast(cInfo)->mindmg = fields[23].GetFloat(); + const_cast(cInfo)->maxdmg = fields[24].GetFloat(); + const_cast(cInfo)->dmgschool = fields[25].GetUInt32(); + const_cast(cInfo)->attackpower = fields[26].GetUInt32(); + const_cast(cInfo)->dmg_multiplier = fields[27].GetFloat(); + const_cast(cInfo)->baseattacktime = fields[28].GetUInt32(); + const_cast(cInfo)->rangeattacktime = fields[29].GetUInt32(); + const_cast(cInfo)->unit_class = fields[30].GetUInt32(); + const_cast(cInfo)->unit_flags = fields[31].GetUInt32(); + const_cast(cInfo)->dynamicflags = fields[32].GetUInt32(); + const_cast(cInfo)->family = fields[33].GetUInt32(); + const_cast(cInfo)->trainer_type = fields[34].GetUInt32(); + const_cast(cInfo)->trainer_spell = fields[35].GetUInt32(); + const_cast(cInfo)->trainer_class = fields[36].GetUInt32(); + const_cast(cInfo)->trainer_race = fields[37].GetUInt32(); + const_cast(cInfo)->minrangedmg = fields[38].GetFloat(); + const_cast(cInfo)->maxrangedmg = fields[39].GetFloat(); + const_cast(cInfo)->rangedattackpower = fields[40].GetUInt32(); + const_cast(cInfo)->type = fields[41].GetUInt32(); + const_cast(cInfo)->type_flags = fields[42].GetUInt32(); + const_cast(cInfo)->lootid = fields[43].GetUInt32(); + const_cast(cInfo)->pickpocketLootId = fields[44].GetUInt32(); + const_cast(cInfo)->SkinLootId = fields[45].GetUInt32(); + const_cast(cInfo)->resistance1 = fields[46].GetUInt32(); + const_cast(cInfo)->resistance2 = fields[47].GetUInt32(); + const_cast(cInfo)->resistance3 = fields[48].GetUInt32(); + const_cast(cInfo)->resistance4 = fields[49].GetUInt32(); + const_cast(cInfo)->resistance5 = fields[50].GetUInt32(); + const_cast(cInfo)->resistance6 = fields[51].GetUInt32(); + const_cast(cInfo)->spells[0] = fields[52].GetUInt32(); + const_cast(cInfo)->spells[1] = fields[53].GetUInt32(); + const_cast(cInfo)->spells[2] = fields[54].GetUInt32(); + const_cast(cInfo)->spells[3] = fields[55].GetUInt32(); + const_cast(cInfo)->spells[4] = fields[56].GetUInt32(); + const_cast(cInfo)->spells[5] = fields[57].GetUInt32(); + const_cast(cInfo)->spells[6] = fields[58].GetUInt32(); + const_cast(cInfo)->spells[7] = fields[59].GetUInt32(); + const_cast(cInfo)->PetSpellDataId = fields[60].GetUInt32(); + const_cast(cInfo)->VehicleId = fields[61].GetUInt32(); + const_cast(cInfo)->mingold = fields[62].GetUInt32(); + const_cast(cInfo)->maxgold = fields[63].GetUInt32(); + if (const char* temp = fields[64].GetString()) + { + delete[] cInfo->AIName; + len = strlen(temp)+1; + const_cast(cInfo)->AIName = new char[len]; + strncpy(const_cast(cInfo->AIName), temp, len); + } + const_cast(cInfo)->MovementType = fields[65].GetUInt32(); + const_cast(cInfo)->InhabitType = fields[66].GetUInt32(); + const_cast(cInfo)->ModHealth = fields[67].GetFloat(); + const_cast(cInfo)->ModMana = fields[68].GetFloat(); + const_cast(cInfo)->ModArmor = fields[69].GetFloat(); + const_cast(cInfo)->RacialLeader = fields[70].GetBool(); + const_cast(cInfo)->questItems[0] = fields[71].GetUInt32(); + const_cast(cInfo)->questItems[1] = fields[72].GetUInt32(); + const_cast(cInfo)->questItems[2] = fields[73].GetUInt32(); + const_cast(cInfo)->questItems[3] = fields[74].GetUInt32(); + const_cast(cInfo)->questItems[4] = fields[75].GetUInt32(); + const_cast(cInfo)->questItems[5] = fields[76].GetUInt32(); + const_cast(cInfo)->movementId = fields[77].GetUInt32(); + const_cast(cInfo)->RegenHealth = fields[78].GetBool(); + const_cast(cInfo)->equipmentId = fields[79].GetUInt32(); + const_cast(cInfo)->MechanicImmuneMask = fields[80].GetUInt32(); + const_cast(cInfo)->flags_extra = fields[81].GetUInt32(); + const_cast(cInfo)->ScriptID = objmgr.GetScriptId(fields[82].GetString()); + + objmgr.CheckCreatureTemplate(cInfo); + + SendGlobalGMSysMessage("Creature template reloaded."); + return true; +} + +bool ChatHandler::HandleReloadCreatureQuestRelationsCommand(const char*) +{ + sLog.outString("Loading Quests Relations... (`creature_questrelation`)"); + objmgr.LoadCreatureQuestRelations(); + SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadCreatureLinkedRespawnCommand(const char * /*args*/) +{ + sLog.outString("Loading Linked Respawns... (`creature_linked_respawn`)"); + objmgr.LoadCreatureLinkedRespawn(); + SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadCreatureQuestInvRelationsCommand(const char*) +{ + sLog.outString("Loading Quests Relations... (`creature_involvedrelation`)"); + objmgr.LoadCreatureInvolvedRelations(); + SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadGossipMenuCommand(const char*) +{ + sLog.outString("Re-Loading `gossip_menu` Table!"); + objmgr.LoadGossipMenu(); + SendGlobalGMSysMessage("DB table `gossip_menu` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadGossipMenuOptionCommand(const char*) +{ + sLog.outString("Re-Loading `gossip_menu_option` Table!"); + objmgr.LoadGossipMenuItems(); + SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadGOQuestRelationsCommand(const char*) +{ + sLog.outString("Loading Quests Relations... (`gameobject_questrelation`)"); + objmgr.LoadGameobjectQuestRelations(); + SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadGOQuestInvRelationsCommand(const char*) +{ + sLog.outString("Loading Quests Relations... (`gameobject_involvedrelation`)"); + objmgr.LoadGameobjectInvolvedRelations(); + SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadQuestAreaTriggersCommand(const char*) +{ + sLog.outString("Re-Loading Quest Area Triggers..."); + objmgr.LoadQuestAreaTriggers(); + SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadQuestTemplateCommand(const char*) +{ + sLog.outString("Re-Loading Quest Templates..."); + objmgr.LoadQuests(); + SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded."); + + /// dependent also from `gameobject` but this table not reloaded anyway + sLog.outString("Re-Loading GameObjects for quests..."); + objmgr.LoadGameObjectForQuests(); + SendGlobalGMSysMessage("Data GameObjects for quests reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesCreatureCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`creature_loot_template`)"); + LoadLootTemplates_Creature(); + LootTemplates_Creature.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesDisenchantCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`disenchant_loot_template`)"); + LoadLootTemplates_Disenchant(); + LootTemplates_Disenchant.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesFishingCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`fishing_loot_template`)"); + LoadLootTemplates_Fishing(); + LootTemplates_Fishing.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesGameobjectCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`gameobject_loot_template`)"); + LoadLootTemplates_Gameobject(); + LootTemplates_Gameobject.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesItemCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`item_loot_template`)"); + LoadLootTemplates_Item(); + LootTemplates_Item.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `item_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesMillingCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`milling_loot_template`)"); + LoadLootTemplates_Milling(); + LootTemplates_Milling.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesPickpocketingCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); + LoadLootTemplates_Pickpocketing(); + LootTemplates_Pickpocketing.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesProspectingCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`prospecting_loot_template`)"); + LoadLootTemplates_Prospecting(); + LootTemplates_Prospecting.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesMailCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`mail_loot_template`)"); + LoadLootTemplates_Mail(); + LootTemplates_Mail.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesReferenceCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`reference_loot_template`)"); + LoadLootTemplates_Reference(); + SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesSkinningCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`skinning_loot_template`)"); + LoadLootTemplates_Skinning(); + LootTemplates_Skinning.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadLootTemplatesSpellCommand(const char*) +{ + sLog.outString("Re-Loading Loot Tables... (`spell_loot_template`)"); + LoadLootTemplates_Spell(); + LootTemplates_Spell.CheckLootRefs(); + SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded."); + sConditionMgr.LoadConditions(true); + return true; +} + +bool ChatHandler::HandleReloadTrinityStringCommand(const char*) +{ + sLog.outString("Re-Loading trinity_string Table!"); + objmgr.LoadTrinityStrings(); + SendGlobalGMSysMessage("DB table `trinity_string` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadNpcGossipCommand(const char*) +{ + sLog.outString("Re-Loading `npc_gossip` Table!"); + objmgr.LoadNpcTextId(); + SendGlobalGMSysMessage("DB table `npc_gossip` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadNpcTrainerCommand(const char*) +{ + sLog.outString("Re-Loading `npc_trainer` Table!"); + objmgr.LoadTrainerSpell(); + SendGlobalGMSysMessage("DB table `npc_trainer` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadNpcVendorCommand(const char*) +{ + sLog.outString("Re-Loading `npc_vendor` Table!"); + objmgr.LoadVendors(); + SendGlobalGMSysMessage("DB table `npc_vendor` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadPointsOfInterestCommand(const char*) +{ + sLog.outString("Re-Loading `points_of_interest` Table!"); + objmgr.LoadPointsOfInterest(); + SendGlobalGMSysMessage("DB table `points_of_interest` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellClickSpellsCommand(const char*) +{ + sLog.outString("Re-Loading `npc_spellclick_spells` Table!"); + objmgr.LoadNPCSpellClickSpells(); + SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadReservedNameCommand(const char*) +{ + sLog.outString("Loading ReservedNames... (`reserved_name`)"); + objmgr.LoadReservedPlayersNames(); + SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSkillDiscoveryTemplateCommand(const char* /*args*/) +{ + sLog.outString("Re-Loading Skill Discovery Table..."); + LoadSkillDiscoveryTable(); + SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSkillExtraItemTemplateCommand(const char* /*args*/) +{ + sLog.outString("Re-Loading Skill Extra Item Table..."); + LoadSkillExtraItemTable(); + SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/) +{ + sLog.outString("Re-Loading Skill Fishing base level requirements..."); + objmgr.LoadFishingBaseSkillLevel(); + SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellAreaCommand(const char*) +{ + sLog.outString("Re-Loading SpellArea Data..."); + spellmgr.LoadSpellAreas(); + SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellRequiredCommand(const char*) +{ + sLog.outString("Re-Loading Spell Required Data... "); + spellmgr.LoadSpellRequired(); + SendGlobalGMSysMessage("DB table `spell_required` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellGroupsCommand(const char*) +{ + sLog.outString("Re-Loading Spell Groups..."); + spellmgr.LoadSpellGroups(); + SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellLearnSpellCommand(const char*) +{ + sLog.outString("Re-Loading Spell Learn Spells..."); + spellmgr.LoadSpellLearnSpells(); + SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellLinkedSpellCommand(const char*) +{ + sLog.outString("Re-Loading Spell Linked Spells..."); + spellmgr.LoadSpellLinked(); + SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellProcEventCommand(const char*) +{ + sLog.outString("Re-Loading Spell Proc Event conditions..."); + spellmgr.LoadSpellProcEvents(); + SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellBonusesCommand(const char*) +{ + sLog.outString("Re-Loading Spell Bonus Data..."); + spellmgr.LoadSpellBonusess(); + SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellTargetPositionCommand(const char*) +{ + sLog.outString("Re-Loading Spell target coordinates..."); + spellmgr.LoadSpellTargetPositions(); + SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellThreatsCommand(const char*) +{ + sLog.outString("Re-Loading Aggro Spells Definitions..."); + spellmgr.LoadSpellThreats(); + SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellGroupStackRulesCommand(const char*) +{ + sLog.outString("Re-Loading Spell Group Stack Rules..."); + spellmgr.LoadSpellGroupStackRules(); + SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded."); + return true; +} + +bool ChatHandler::HandleReloadSpellPetAurasCommand(const char*) +{ + sLog.outString("Re-Loading Spell pet auras..."); + spellmgr.LoadSpellPetAuras(); + SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadPageTextsCommand(const char*) +{ + sLog.outString("Re-Loading Page Texts..."); + objmgr.LoadPageTexts(); + SendGlobalGMSysMessage("DB table `page_texts` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadItemEnchantementsCommand(const char*) +{ + sLog.outString("Re-Loading Item Random Enchantments Table..."); + LoadRandomEnchantmentsTable(); + SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadItemSetNamesCommand(const char*) +{ + sLog.outString("Re-Loading Item set names..."); + LoadRandomEnchantmentsTable(); + SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadGameObjectScriptsCommand(const char* arg) +{ + if (sWorld.IsScriptScheduled()) + { + SendSysMessage("DB scripts used currently, please attempt reload later."); + SetSentErrorMessage(true); + return false; + } + + if (*arg != 'a') + sLog.outString("Re-Loading Scripts from `gameobject_scripts`..."); + + objmgr.LoadGameObjectScripts(); + + if (*arg != 'a') + SendGlobalGMSysMessage("DB table `gameobject_scripts` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadEventScriptsCommand(const char* arg) +{ + if (sWorld.IsScriptScheduled()) + { + SendSysMessage("DB scripts used currently, please attempt reload later."); + SetSentErrorMessage(true); + return false; + } + + if (*arg != 'a') + sLog.outString("Re-Loading Scripts from `event_scripts`..."); + + objmgr.LoadEventScripts(); + + if (*arg != 'a') + SendGlobalGMSysMessage("DB table `event_scripts` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadWpScriptsCommand(const char* arg) +{ + if (sWorld.IsScriptScheduled()) + { + SendSysMessage("DB scripts used currently, please attempt reload later."); + SetSentErrorMessage(true); + return false; + } + + if (*arg != 'a') + sLog.outString("Re-Loading Scripts from `waypoint_scripts`..."); + + objmgr.LoadWaypointScripts(); + + if (*arg != 'a') + SendGlobalGMSysMessage("DB table `waypoint_scripts` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadEventAITextsCommand(const char* /*args*/) +{ + + sLog.outString("Re-Loading Texts from `creature_ai_texts`..."); + CreatureEAI_Mgr.LoadCreatureEventAI_Texts(); + SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadEventAISummonsCommand(const char* /*args*/) +{ + sLog.outString("Re-Loading Summons from `creature_ai_summons`..."); + CreatureEAI_Mgr.LoadCreatureEventAI_Summons(); + SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadEventAIScriptsCommand(const char* /*args*/) +{ + sLog.outString("Re-Loading Scripts from `creature_ai_scripts`..."); + CreatureEAI_Mgr.LoadCreatureEventAI_Scripts(); + SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadQuestEndScriptsCommand(const char* arg) +{ + if (sWorld.IsScriptScheduled()) + { + SendSysMessage("DB scripts used currently, please attempt reload later."); + SetSentErrorMessage(true); + return false; + } + + if (*arg != 'a') + sLog.outString("Re-Loading Scripts from `quest_end_scripts`..."); + + objmgr.LoadQuestEndScripts(); + + if (*arg != 'a') + SendGlobalGMSysMessage("DB table `quest_end_scripts` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadQuestStartScriptsCommand(const char* arg) +{ + if (sWorld.IsScriptScheduled()) + { + SendSysMessage("DB scripts used currently, please attempt reload later."); + SetSentErrorMessage(true); + return false; + } + + if (*arg != 'a') + sLog.outString("Re-Loading Scripts from `quest_start_scripts`..."); + + objmgr.LoadQuestStartScripts(); + + if (*arg != 'a') + SendGlobalGMSysMessage("DB table `quest_start_scripts` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadSpellScriptsCommand(const char* arg) +{ + if (sWorld.IsScriptScheduled()) + { + SendSysMessage("DB scripts used currently, please attempt reload later."); + SetSentErrorMessage(true); + return false; + } + + if (*arg != 'a') + sLog.outString("Re-Loading Scripts from `spell_scripts`..."); + + objmgr.LoadSpellScripts(); + + if (*arg != 'a') + SendGlobalGMSysMessage("DB table `spell_scripts` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadDbScriptStringCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Script strings from `db_script_string`..."); + objmgr.LoadDbScriptStrings(); + SendGlobalGMSysMessage("DB table `db_script_string` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadGameGraveyardZoneCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Graveyard-zone links..."); + + objmgr.LoadGraveyardZones(); + + SendGlobalGMSysMessage("DB table `game_graveyard_zone` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadGameTeleCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Game Tele coordinates..."); + + objmgr.LoadGameTele(); + + SendGlobalGMSysMessage("DB table `game_tele` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading spell disabled table..."); + + objmgr.LoadSpellDisabledEntrys(); + + SendGlobalGMSysMessage("DB table `spell_disabled` reloaded."); + + return true; +} + +bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*) +{ + sLog.outString("Re-Loading Locales Achievement Reward Data..."); + achievementmgr.LoadRewardLocales(); + SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales Creature ..."); + objmgr.LoadCreatureLocales(); + SendGlobalGMSysMessage("DB table `locales_creature` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesGameobjectCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales Gameobject ... "); + objmgr.LoadGameObjectLocales(); + SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesItemCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales Item ... "); + objmgr.LoadItemLocales(); + SendGlobalGMSysMessage("DB table `locales_item` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesItemSetNameCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales Item set name... "); + objmgr.LoadItemSetNameLocales(); + SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesNpcTextCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales NPC Text ... "); + objmgr.LoadNpcTextLocales(); + SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesPageTextCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales Page Text ... "); + objmgr.LoadPageTextLocales(); + SendGlobalGMSysMessage("DB table `locales_page_text` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesPointsOfInterestCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales Points Of Interest ... "); + objmgr.LoadPointOfInterestLocales(); + SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadLocalesQuestCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Locales Quest ... "); + objmgr.LoadQuestLocales(); + SendGlobalGMSysMessage("DB table `locales_quest` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadMailLevelRewardCommand(const char* /*arg*/) +{ + sLog.outString("Re-Loading Player level dependent mail rewards..."); + objmgr.LoadMailLevelRewards(); + SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded."); + return true; +} + +bool ChatHandler::HandleReloadAuctionsCommand(const char * /*args*/) +{ + ///- Reload dynamic data tables from the database + sLog.outString("Re-Loading Auctions..."); + auctionmgr.LoadAuctionItems(); + auctionmgr.LoadAuctions(); + SendGlobalGMSysMessage("Auctions reloaded."); + return true; +} + +bool ChatHandler::HandleReloadConditions(const char* args) +{ + sLog.outString("Re-Loading Conditions..."); + sConditionMgr.LoadConditions(true); + SendGlobalGMSysMessage("Conditions reloaded."); + return true; +} + +bool ChatHandler::HandleAccountSetGmLevelCommand(const char *args) +{ + if (!*args) + return false; + + std::string targetAccountName; + uint32 targetAccountId = 0; + uint32 targetSecurity = 0; + uint32 gm = 0; + char* arg1 = strtok((char*)args, " "); + char* arg2 = strtok(NULL, " "); + char* arg3 = strtok(NULL, " "); + bool isAccountNameGiven = true; + + if (arg1 && !arg3) + { + if (!getSelectedPlayer()) + return false; + isAccountNameGiven = false; + } + + // Check for second parameter + if (!isAccountNameGiven && !arg2) + return false; + + // Check for account + if (isAccountNameGiven) + { + targetAccountName = arg1; + if (!AccountMgr::normalizeString(targetAccountName)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,targetAccountName.c_str()); + SetSentErrorMessage(true); + return false; + } + } + + // Check for invalid specified GM level. + gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1); + if (gm < SEC_PLAYER) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + // m_session == NULL only for console + targetAccountId = (isAccountNameGiven) ? accmgr.GetId(targetAccountName) : getSelectedPlayer()->GetSession()->GetAccountId(); + int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2); + uint32 plSecurity = m_session ? accmgr.GetSecurity(m_session->GetAccountId(), gmRealmID) : SEC_CONSOLE; + + // can set security level only for target with less security and to less security that we have + // This is also reject self apply in fact + targetSecurity = accmgr.GetSecurity(targetAccountId, gmRealmID); + if (targetSecurity >= plSecurity || gm >= plSecurity) + { + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); + SetSentErrorMessage(true); + return false; + } + + // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 + if (gmRealmID == -1) + { + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm); + if (result) + { + SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); + SetSentErrorMessage(true); + return false; + } + } + + // Check if provided realmID has a negative value other than -1 + if (gmRealmID < -1) + { + SendSysMessage(LANG_INVALID_REALMID); + SetSentErrorMessage(true); + return false; + } + + // If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID + if (gmRealmID == -1) + LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u'", targetAccountId); + else + LoginDatabase.PExecute("DELETE FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", targetAccountId, realmID); + + if (gm != 0) + LoginDatabase.PExecute("INSERT INTO account_access VALUES ('%u','%d','%d')", targetAccountId, gm, realmID); + PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm); + return true; +} + +/// Set password for account +bool ChatHandler::HandleAccountSetPasswordCommand(const char *args) +{ + if (!*args) + return false; + + ///- Get the command line arguments + char *szAccount = strtok ((char*)args," "); + char *szPassword1 = strtok (NULL," "); + char *szPassword2 = strtok (NULL," "); + + if (!szAccount||!szPassword1 || !szPassword2) + return false; + + std::string account_name = szAccount; + if (!AccountMgr::normalizeString(account_name)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + + uint32 targetAccountId = accmgr.GetId(account_name); + if (!targetAccountId) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + + /// can set password only for target with less security + /// This is also reject self apply in fact + if (HasLowerSecurityAccount (NULL,targetAccountId,true)) + return false; + + if (strcmp(szPassword1,szPassword2)) + { + SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH); + SetSentErrorMessage (true); + return false; + } + + AccountOpResult result = accmgr.ChangePassword(targetAccountId, szPassword1); + + switch (result) + { + case AOR_OK: + SendSysMessage(LANG_COMMAND_PASSWORD); + break; + case AOR_NAME_NOT_EXIST: + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + case AOR_PASS_TOO_LONG: + SendSysMessage(LANG_PASSWORD_TOO_LONG); + SetSentErrorMessage(true); + return false; + default: + SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD); + SetSentErrorMessage(true); + return false; + } + + return true; +} + +bool ChatHandler::HandleMaxSkillCommand(const char* /*args*/) +{ + Player* SelectedPlayer = getSelectedPlayer(); + if (!SelectedPlayer) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // each skills that have max skill value dependent from level seted to current level max skill value + SelectedPlayer->UpdateSkillsToMaxSkillsForLevel(); + return true; +} + +bool ChatHandler::HandleSetSkillCommand(const char *args) +{ + // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r + char* skill_p = extractKeyFromLink((char*)args,"Hskill"); + if (!skill_p) + return false; + + char *level_p = strtok (NULL, " "); + + if (!level_p) + return false; + + char *max_p = strtok (NULL, " "); + + int32 skill = atoi(skill_p); + if (skill <= 0) + { + PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + SetSentErrorMessage(true); + return false; + } + + int32 level = atol (level_p); + + Player * target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + SkillLineEntry const* sl = sSkillLineStore.LookupEntry(skill); + if (!sl) + { + PSendSysMessage(LANG_INVALID_SKILL_ID, skill); + SetSentErrorMessage(true); + return false; + } + + std::string tNameLink = GetNameLink(target); + + if (!target->GetSkillValue(skill)) + { + PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[GetSessionDbcLocale()]); + SetSentErrorMessage(true); + return false; + } + + int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill); + + if (level <= 0 || level > max || max <= 0) + return false; + + target->SetSkill(skill, target->GetSkillStep(skill), level, max); + PSendSysMessage(LANG_SET_SKILL, skill, sl->name[GetSessionDbcLocale()], tNameLink.c_str(), level, max); + + return true; +} + +bool ChatHandler::HandleUnLearnCommand(const char *args) +{ + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r + uint32 spell_id = extractSpellIdFromLink((char*)args); + if (!spell_id) + return false; + + char const* allStr = strtok(NULL," "); + bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; + + Player* target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + if (allRanks) + spell_id = spellmgr.GetFirstSpellInChain (spell_id); + + if (target->HasSpell(spell_id)) + target->removeSpell(spell_id,false,!allRanks); + else + SendSysMessage(LANG_FORGET_SPELL); + + if (GetTalentSpellCost(spell_id)) + target->SendTalentsInfoData(false); + + return true; +} + +bool ChatHandler::HandleCooldownCommand(const char *args) +{ + Player* target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + std::string tNameLink = GetNameLink(target); + + if (!*args) + { + target->RemoveAllSpellCooldown(); + PSendSysMessage(LANG_REMOVEALL_COOLDOWN, tNameLink.c_str()); + } + else + { + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spell_id = extractSpellIdFromLink((char*)args); + if (!spell_id) + return false; + + if (!sSpellStore.LookupEntry(spell_id)) + { + PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str()); + SetSentErrorMessage(true); + return false; + } + + target->RemoveSpellCooldown(spell_id,true); + PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str()); + } + return true; +} + +bool ChatHandler::HandleLearnAllCommand(const char* /*args*/) +{ + static const char *allSpellList[] = + { + "3365", + "6233", + "6247", + "6246", + "6477", + "6478", + "22810", + "8386", + "21651", + "21652", + "522", + "7266", + "8597", + "2479", + "22027", + "6603", + "5019", + "133", + "168", + "227", + "5009", + "9078", + "668", + "203", + "20599", + "20600", + "81", + "20597", + "20598", + "20864", + "1459", + "5504", + "587", + "5143", + "118", + "5505", + "597", + "604", + "1449", + "1460", + "2855", + "1008", + "475", + "5506", + "1463", + "12824", + "8437", + "990", + "5145", + "8450", + "1461", + "759", + "8494", + "8455", + "8438", + "6127", + "8416", + "6129", + "8451", + "8495", + "8439", + "3552", + "8417", + "10138", + "12825", + "10169", + "10156", + "10144", + "10191", + "10201", + "10211", + "10053", + "10173", + "10139", + "10145", + "10192", + "10170", + "10202", + "10054", + "10174", + "10193", + "12826", + "2136", + "143", + "145", + "2137", + "2120", + "3140", + "543", + "2138", + "2948", + "8400", + "2121", + "8444", + "8412", + "8457", + "8401", + "8422", + "8445", + "8402", + "8413", + "8458", + "8423", + "8446", + "10148", + "10197", + "10205", + "10149", + "10215", + "10223", + "10206", + "10199", + "10150", + "10216", + "10207", + "10225", + "10151", + "116", + "205", + "7300", + "122", + "837", + "10", + "7301", + "7322", + "6143", + "120", + "865", + "8406", + "6141", + "7302", + "8461", + "8407", + "8492", + "8427", + "8408", + "6131", + "7320", + "10159", + "8462", + "10185", + "10179", + "10160", + "10180", + "10219", + "10186", + "10177", + "10230", + "10181", + "10161", + "10187", + "10220", + "2018", + "2663", + "12260", + "2660", + "3115", + "3326", + "2665", + "3116", + "2738", + "3293", + "2661", + "3319", + "2662", + "9983", + "8880", + "2737", + "2739", + "7408", + "3320", + "2666", + "3323", + "3324", + "3294", + "22723", + "23219", + "23220", + "23221", + "23228", + "23338", + "10788", + "10790", + "5611", + "5016", + "5609", + "2060", + "10963", + "10964", + "10965", + "22593", + "22594", + "596", + "996", + "499", + "768", + "17002", + "1448", + "1082", + "16979", + "1079", + "5215", + "20484", + "5221", + "15590", + "17007", + "6795", + "6807", + "5487", + "1446", + "1066", + "5421", + "3139", + "779", + "6811", + "6808", + "1445", + "5216", + "1737", + "5222", + "5217", + "1432", + "6812", + "9492", + "5210", + "3030", + "1441", + "783", + "6801", + "20739", + "8944", + "9491", + "22569", + "5226", + "6786", + "1433", + "8973", + "1828", + "9495", + "9006", + "6794", + "8993", + "5203", + "16914", + "6784", + "9635", + "22830", + "20722", + "9748", + "6790", + "9753", + "9493", + "9752", + "9831", + "9825", + "9822", + "5204", + "5401", + "22831", + "6793", + "9845", + "17401", + "9882", + "9868", + "20749", + "9893", + "9899", + "9895", + "9832", + "9902", + "9909", + "22832", + "9828", + "9851", + "9883", + "9869", + "17406", + "17402", + "9914", + "20750", + "9897", + "9848", + "3127", + "107", + "204", + "9116", + "2457", + "78", + "18848", + "331", + "403", + "2098", + "1752", + "11278", + "11288", + "11284", + "6461", + "2344", + "2345", + "6463", + "2346", + "2352", + "775", + "1434", + "1612", + "71", + "2468", + "2458", + "2467", + "7164", + "7178", + "7367", + "7376", + "7381", + "21156", + "5209", + "3029", + "5201", + "9849", + "9850", + "20719", + "22568", + "22827", + "22828", + "22829", + "6809", + "8972", + "9005", + "9823", + "9827", + "6783", + "9913", + "6785", + "6787", + "9866", + "9867", + "9894", + "9896", + "6800", + "8992", + "9829", + "9830", + "780", + "769", + "6749", + "6750", + "9755", + "9754", + "9908", + "20745", + "20742", + "20747", + "20748", + "9746", + "9745", + "9880", + "9881", + "5391", + "842", + "3025", + "3031", + "3287", + "3329", + "1945", + "3559", + "4933", + "4934", + "4935", + "4936", + "5142", + "5390", + "5392", + "5404", + "5420", + "6405", + "7293", + "7965", + "8041", + "8153", + "9033", + "9034", + //"9036", problems with ghost state + "16421", + "21653", + "22660", + "5225", + "9846", + "2426", + "5916", + "6634", + //"6718", phasing stealth, annoying for learn all case. + "6719", + "8822", + "9591", + "9590", + "10032", + "17746", + "17747", + "8203", + "11392", + "12495", + "16380", + "23452", + "4079", + "4996", + "4997", + "4998", + "4999", + "5000", + "6348", + "6349", + "6481", + "6482", + "6483", + "6484", + "11362", + "11410", + "11409", + "12510", + "12509", + "12885", + "13142", + "21463", + "23460", + "11421", + "11416", + "11418", + "1851", + "10059", + "11423", + "11417", + "11422", + "11419", + "11424", + "11420", + "27", + "31", + "33", + "34", + "35", + "15125", + "21127", + "22950", + "1180", + "201", + "12593", + "16770", + "6057", + "12051", + "18468", + "12606", + "12605", + "18466", + "12502", + "12043", + "15060", + "12042", + "12341", + "12848", + "12344", + "12353", + "18460", + "11366", + "12350", + "12352", + "13043", + "11368", + "11113", + "12400", + "11129", + "16766", + "12573", + "12580", + "12472", + "12953", + "12488", + "11189", + "12985", + "12519", + "16758", + "11958", + "12490", + "11426", + "3565", + "3562", + "18960", + "3567", + "3561", + "3566", + "3563", + "1953", + "2139", + "12505", + "13018", + "12522", + "12523", + "5146", + "5144", + "5148", + "8419", + "8418", + "10213", + "10212", + "10157", + "12524", + "13019", + "12525", + "13020", + "12526", + "13021", + "18809", + "13031", + "13032", + "13033", + "4036", + "3920", + "3919", + "3918", + "7430", + "3922", + "3923", + "7411", + "7418", + "7421", + "13262", + "7412", + "7415", + "7413", + "7416", + "13920", + "13921", + "7745", + "7779", + "7428", + "7457", + "7857", + "7748", + "7426", + "13421", + "7454", + "13378", + "7788", + "14807", + "14293", + "7795", + "6296", + "20608", + "755", + "444", + "427", + "428", + "442", + "447", + "3578", + "3581", + "19027", + "3580", + "665", + "3579", + "3577", + "6755", + "3576", + "2575", + "2577", + "2578", + "2579", + "2580", + "2656", + "2657", + "2576", + "3564", + "10248", + "8388", + "2659", + "14891", + "3308", + "3307", + "10097", + "2658", + "3569", + "16153", + "3304", + "10098", + "4037", + "3929", + "3931", + "3926", + "3924", + "3930", + "3977", + "3925", + "136", + "228", + "5487", + "43", + "202", + "0" + }; + + int loop = 0; + while (strcmp(allSpellList[loop], "0")) + { + uint32 spell = atol((char*)allSpellList[loop++]); + + if (m_session->GetPlayer()->HasSpell(spell)) + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer())) + { + PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell); + continue; + } + + m_session->GetPlayer()->learnSpell(spell, false); + } + + SendSysMessage(LANG_COMMAND_LEARN_MANY_SPELLS); + + return true; +} + +bool ChatHandler::HandleLearnAllGMCommand(const char* /*args*/) +{ + static const char *gmSpellList[] = + { + "24347", // Become A Fish, No Breath Bar + "35132", // Visual Boom + "38488", // Attack 4000-8000 AOE + "38795", // Attack 2000 AOE + Slow Down 90% + "15712", // Attack 200 + "1852", // GM Spell Silence + "31899", // Kill + "31924", // Kill + "29878", // Kill My Self + "26644", // More Kill + + "28550", //Invisible 24 + "23452", //Invisible + Target + "0" + }; + + uint16 gmSpellIter = 0; + while (strcmp(gmSpellList[gmSpellIter], "0")) + { + uint32 spell = atol((char*)gmSpellList[gmSpellIter++]); + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer())) + { + PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell); + continue; + } + + m_session->GetPlayer()->learnSpell(spell, false); + } + + SendSysMessage(LANG_LEARNING_GM_SKILLS); + return true; +} + +bool ChatHandler::HandleLearnAllMyClassCommand(const char* /*args*/) +{ + HandleLearnAllMySpellsCommand(""); + HandleLearnAllMyTalentsCommand(""); + return true; +} + +bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/) +{ + ChrClassesEntry const* clsEntry = sChrClassesStore.LookupEntry(m_session->GetPlayer()->getClass()); + if (!clsEntry) + return true; + uint32 family = clsEntry->spellfamily; + + for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) + { + SpellEntry const *spellInfo = sSpellStore.LookupEntry(i); + if (!spellInfo) + continue; + + // skip server-side/triggered spells + if (spellInfo->spellLevel == 0) + continue; + + // skip wrong class/race skills + if (!m_session->GetPlayer()->IsSpellFitByClassAndRace(spellInfo->Id)) + continue; + + // skip other spell families + if (spellInfo->SpellFamilyName != family) + continue; + + // skip spells with first rank learned as talent (and all talents then also) + uint32 first_rank = spellmgr.GetFirstSpellInChain(spellInfo->Id); + if (GetTalentSpellCost(first_rank) > 0) + continue; + + // skip broken spells + if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) + continue; + + m_session->GetPlayer()->learnSpell(i, false); + } + + SendSysMessage(LANG_COMMAND_LEARN_CLASS_SPELLS); + return true; +} + +bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/) +{ + Player* player = m_session->GetPlayer(); + uint32 classMask = player->getClassMask(); + + for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) + { + TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + if (!talentInfo) + continue; + + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + if (!talentTabInfo) + continue; + + if ((classMask & talentTabInfo->ClassMask) == 0) + continue; + + // search highest talent rank + uint32 spellId = 0; + for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank) + { + if (talentInfo->RankID[rank] != 0) + { + spellId = talentInfo->RankID[rank]; + break; + } + } + + if (!spellId) // ??? none spells in talent + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) + continue; + + // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree) + player->learnSpellHighRank(spellId); + player->AddTalent(spellId, player->GetActiveSpec(), true); + } + + player->SetFreeTalentPoints(0); + + SendSysMessage(LANG_COMMAND_LEARN_CLASS_TALENTS); + return true; +} + +bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/) +{ + Player* player = m_session->GetPlayer(); + + Pet* pet = player->GetPet(); + if (!pet) + { + SendSysMessage(LANG_NO_PET_FOUND); + SetSentErrorMessage(true); + return false; + } + + CreatureInfo const *ci = pet->GetCreatureInfo(); + if (!ci) + { + SendSysMessage(LANG_WRONG_PET_TYPE); + SetSentErrorMessage(true); + return false; + } + + CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); + if (!pet_family) + { + SendSysMessage(LANG_WRONG_PET_TYPE); + SetSentErrorMessage(true); + return false; + } + + if (pet_family->petTalentType < 0) // not hunter pet + { + SendSysMessage(LANG_WRONG_PET_TYPE); + SetSentErrorMessage(true); + return false; + } + + for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) + { + TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + if (!talentInfo) + continue; + + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + if (!talentTabInfo) + continue; + + // prevent learn talent for different family (cheating) + if (((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask) == 0) + continue; + + // search highest talent rank + uint32 spellid = 0; + + for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank) + { + if (talentInfo->RankID[rank] != 0) + { + spellid = talentInfo->RankID[rank]; + break; + } + } + + if (!spellid) // ??? none spells in talent + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) + continue; + + // learn highest rank of talent and learn all non-talent spell ranks (recursive by tree) + pet->learnSpellHighRank(spellid); + } + + pet->SetFreeTalentPoints(0); + + SendSysMessage(LANG_COMMAND_LEARN_PET_TALENTS); + return true; +} + +bool ChatHandler::HandleLearnAllLangCommand(const char* /*args*/) +{ + // skipping UNIVERSAL language (0) + for (uint8 i = 1; i < LANGUAGES_COUNT; ++i) + m_session->GetPlayer()->learnSpell(lang_description[i].spell_id, false); + + SendSysMessage(LANG_COMMAND_LEARN_ALL_LANG); + return true; +} + +bool ChatHandler::HandleLearnAllDefaultCommand(const char *args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + target->learnDefaultSpells(); + target->learnQuestRewardedSpells(); + + PSendSysMessage(LANG_COMMAND_LEARN_ALL_DEFAULT_AND_QUEST,GetNameLink(target).c_str()); + return true; +} + +bool ChatHandler::HandleLearnCommand(const char *args) +{ + Player* targetPlayer = getSelectedPlayer(); + + if (!targetPlayer) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spell = extractSpellIdFromLink((char*)args); + if (!spell || !sSpellStore.LookupEntry(spell)) + return false; + + char const* allStr = strtok(NULL," "); + bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer())) + { + PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell); + SetSentErrorMessage(true); + return false; + } + + if (!allRanks && targetPlayer->HasSpell(spell)) + { + if (targetPlayer == m_session->GetPlayer()) + SendSysMessage(LANG_YOU_KNOWN_SPELL); + else + PSendSysMessage(LANG_TARGET_KNOWN_SPELL,GetNameLink(targetPlayer).c_str()); + SetSentErrorMessage(true); + return false; + } + + if (allRanks) + targetPlayer->learnSpellHighRank(spell); + else + targetPlayer->learnSpell(spell, false); + + uint32 first_spell = spellmgr.GetFirstSpellInChain(spell); + if (GetTalentSpellCost(first_spell)) + targetPlayer->SendTalentsInfoData(false); + + return true; +} + +bool ChatHandler::HandleAddItemCommand(const char *args) +{ + if (!*args) + return false; + + uint32 itemId = 0; + + if (args[0] == '[') // [name] manual form + { + char* citemName = strtok((char*)args, "]"); + + if (citemName && citemName[0]) + { + std::string itemName = citemName+1; + WorldDatabase.escape_string(itemName); + QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str()); + if (!result) + { + PSendSysMessage(LANG_COMMAND_COULDNOTFIND, citemName+1); + SetSentErrorMessage(true); + return false; + } + itemId = result->Fetch()->GetUInt16(); + } + else + return false; + } + else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r + { + char* cId = extractKeyFromLink((char*)args,"Hitem"); + if (!cId) + return false; + itemId = atol(cId); + } + + char* ccount = strtok(NULL, " "); + + int32 count = 1; + + if (ccount) + count = strtol(ccount, NULL, 10); + + if (count == 0) + count = 1; + + Player* pl = m_session->GetPlayer(); + Player* plTarget = getSelectedPlayer(); + if (!plTarget) + plTarget = pl; + + sLog.outDetail(GetTrinityString(LANG_ADDITEM), itemId, count); + + ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId); + if (!pProto) + { + PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); + SetSentErrorMessage(true); + return false; + } + + //Subtract + if (count < 0) + { + plTarget->DestroyItemCount(itemId, -count, true, false); + PSendSysMessage(LANG_REMOVEITEM, itemId, -count, GetNameLink(plTarget).c_str()); + return true; + } + + //Adding items + uint32 noSpaceForCount = 0; + + // check space and find places + ItemPosCountVec dest; + uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) // convert to possible store amount + count -= noSpaceForCount; + + if (count == 0 || dest.empty()) // can't add any + { + PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + SetSentErrorMessage(true); + return false; + } + + Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId)); + + // remove binding (let GM give it to another player later) + if (pl == plTarget) + for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) + if (Item* item1 = pl->GetItemByPos(itr->pos)) + item1->SetBinding(false); + + if (count > 0 && item) + { + pl->SendNewItem(item,count,false,true); + if (pl != plTarget) + plTarget->SendNewItem(item,count,true,false); + } + + if (noSpaceForCount > 0) + PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount); + + return true; +} + +bool ChatHandler::HandleAddItemSetCommand(const char *args) +{ + if (!*args) + return false; + + char* cId = extractKeyFromLink((char*)args,"Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r + if (!cId) + return false; + + uint32 itemsetId = atol(cId); + + // prevent generation all items with itemset field value '0' + if (itemsetId == 0) + { + PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND,itemsetId); + SetSentErrorMessage(true); + return false; + } + + Player* pl = m_session->GetPlayer(); + Player* plTarget = getSelectedPlayer(); + if (!plTarget) + plTarget = pl; + + sLog.outDetail(GetTrinityString(LANG_ADDITEMSET), itemsetId); + + bool found = false; + for (uint32 id = 0; id < sItemStorage.MaxEntry; id++) + { + ItemPrototype const *pProto = sItemStorage.LookupEntry(id); + if (!pProto) + continue; + + if (pProto->ItemSet == itemsetId) + { + found = true; + ItemPosCountVec dest; + uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pProto->ItemId, 1); + if (msg == EQUIP_ERR_OK) + { + Item* item = plTarget->StoreNewItem(dest, pProto->ItemId, true); + + // remove binding (let GM give it to another player later) + if (pl == plTarget) + item->SetBinding(false); + + pl->SendNewItem(item,1,false,true); + if (pl != plTarget) + plTarget->SendNewItem(item,1,true,false); + } + else + { + pl->SendEquipError(msg, NULL, NULL); + PSendSysMessage(LANG_ITEM_CANNOT_CREATE, pProto->ItemId, 1); + } + } + } + + if (!found) + { + PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND,itemsetId); + + SetSentErrorMessage(true); + return false; + } + + return true; +} + +bool ChatHandler::HandleListItemCommand(const char *args) +{ + if (!*args) + return false; + + char* cId = extractKeyFromLink((char*)args,"Hitem"); + if (!cId) + return false; + + uint32 item_id = atol(cId); + if (!item_id) + { + PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); + SetSentErrorMessage(true); + return false; + } + + ItemPrototype const* itemProto = objmgr.GetItemPrototype(item_id); + if (!itemProto) + { + PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); + SetSentErrorMessage(true); + return false; + } + + char* c_count = strtok(NULL, " "); + int count = c_count ? atol(c_count) : 10; + + if (count < 0) + return false; + + QueryResult_AutoPtr result; + + // inventory case + uint32 inv_count = 0; + result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM character_inventory WHERE item_template='%u'",item_id); + if (result) + inv_count = (*result)[0].GetUInt32(); + + result=CharacterDatabase.PQuery( + // 0 1 2 3 4 5 + "SELECT ci.item, cibag.slot AS bag, ci.slot, ci.guid, characters.account,characters.name " + "FROM character_inventory AS ci LEFT JOIN character_inventory AS cibag ON (cibag.item=ci.bag),characters " + "WHERE ci.item_template='%u' AND ci.guid = characters.guid LIMIT %u ", + item_id,uint32(count)); + + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 item_guid = fields[0].GetUInt32(); + uint32 item_bag = fields[1].GetUInt32(); + uint32 item_slot = fields[2].GetUInt32(); + uint32 owner_guid = fields[3].GetUInt32(); + uint32 owner_acc = fields[4].GetUInt32(); + std::string owner_name = fields[5].GetCppString(); + + char const* item_pos = 0; + if (Player::IsEquipmentPos(item_bag,item_slot)) + item_pos = "[equipped]"; + else if (Player::IsInventoryPos(item_bag,item_slot)) + item_pos = "[in inventory]"; + else if (Player::IsBankPos(item_bag,item_slot)) + item_pos = "[in bank]"; + else + item_pos = ""; + + PSendSysMessage(LANG_ITEMLIST_SLOT, + item_guid,owner_name.c_str(),owner_guid,owner_acc,item_pos); + } while (result->NextRow()); + + int64 res_count = result->GetRowCount(); + + if (count > res_count) + count-=res_count; + else if (count) + count = 0; + } + + // mail case + uint32 mail_count = 0; + result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM mail_items WHERE item_template='%u'", item_id); + if (result) + mail_count = (*result)[0].GetUInt32(); + + if (count > 0) + { + result=CharacterDatabase.PQuery( + // 0 1 2 3 4 5 6 + "SELECT mail_items.item_guid, mail.sender, mail.receiver, char_s.account, char_s.name, char_r.account, char_r.name " + "FROM mail,mail_items,characters as char_s,characters as char_r " + "WHERE mail_items.item_template='%u' AND char_s.guid = mail.sender AND char_r.guid = mail.receiver AND mail.id=mail_items.mail_id LIMIT %u", + item_id,uint32(count)); + } + else + result = QueryResult_AutoPtr(NULL); + + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 item_guid = fields[0].GetUInt32(); + uint32 item_s = fields[1].GetUInt32(); + uint32 item_r = fields[2].GetUInt32(); + uint32 item_s_acc = fields[3].GetUInt32(); + std::string item_s_name = fields[4].GetCppString(); + uint32 item_r_acc = fields[5].GetUInt32(); + std::string item_r_name = fields[6].GetCppString(); + + char const* item_pos = "[in mail]"; + + PSendSysMessage(LANG_ITEMLIST_MAIL, + item_guid,item_s_name.c_str(),item_s,item_s_acc,item_r_name.c_str(),item_r,item_r_acc,item_pos); + } while (result->NextRow()); + + int64 res_count = result->GetRowCount(); + + if (count > res_count) + count-=res_count; + else if (count) + count = 0; + } + + // auction case + uint32 auc_count = 0; + result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM auctionhouse WHERE item_template='%u'",item_id); + if (result) + auc_count = (*result)[0].GetUInt32(); + + if (count > 0) + { + result=CharacterDatabase.PQuery( + // 0 1 2 3 + "SELECT auctionhouse.itemguid, auctionhouse.itemowner, characters.account, characters.name " + "FROM auctionhouse,characters WHERE auctionhouse.item_template='%u' AND characters.guid = auctionhouse.itemowner LIMIT %u", + item_id,uint32(count)); + } + else + result = QueryResult_AutoPtr(NULL); + + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 item_guid = fields[0].GetUInt32(); + uint32 owner = fields[1].GetUInt32(); + uint32 owner_acc = fields[2].GetUInt32(); + std::string owner_name = fields[3].GetCppString(); + + char const* item_pos = "[in auction]"; + + PSendSysMessage(LANG_ITEMLIST_AUCTION, item_guid, owner_name.c_str(), owner, owner_acc,item_pos); + } while (result->NextRow()); + } + + // guild bank case + uint32 guild_count = 0; + result=CharacterDatabase.PQuery("SELECT COUNT(item_entry) FROM guild_bank_item WHERE item_entry='%u'",item_id); + if (result) + guild_count = (*result)[0].GetUInt32(); + + result=CharacterDatabase.PQuery( + // 0 1 2 + "SELECT gi.item_guid, gi.guildid, guild.name " + "FROM guild_bank_item AS gi, guild WHERE gi.item_entry='%u' AND gi.guildid = guild.guildid LIMIT %u ", + item_id,uint32(count)); + + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 item_guid = fields[0].GetUInt32(); + uint32 guild_guid = fields[1].GetUInt32(); + std::string guild_name = fields[2].GetCppString(); + + char const* item_pos = "[in guild bank]"; + + PSendSysMessage(LANG_ITEMLIST_GUILD,item_guid,guild_name.c_str(),guild_guid,item_pos); + } while (result->NextRow()); + + int64 res_count = result->GetRowCount(); + + if (count > res_count) + count-=res_count; + else if (count) + count = 0; + } + + if (inv_count+mail_count+auc_count+guild_count == 0) + { + SendSysMessage(LANG_COMMAND_NOITEMFOUND); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE,item_id,inv_count+mail_count+auc_count+guild_count,inv_count,mail_count,auc_count,guild_count); + + return true; +} + +bool ChatHandler::HandleListObjectCommand(const char *args) +{ + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry"); + if (!cId) + return false; + + uint32 go_id = atol(cId); + if (!go_id) + { + PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); + SetSentErrorMessage(true); + return false; + } + + GameObjectInfo const * gInfo = objmgr.GetGameObjectInfo(go_id); + if (!gInfo) + { + PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); + SetSentErrorMessage(true); + return false; + } + + char* c_count = strtok(NULL, " "); + int count = c_count ? atol(c_count) : 10; + + if (count < 0) + return false; + + QueryResult_AutoPtr result; + + uint32 obj_count = 0; + result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'",go_id); + if (result) + obj_count = (*result)[0].GetUInt32(); + + if (m_session) + { + Player* pl = m_session->GetPlayer(); + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),go_id,uint32(count)); + } + else + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM gameobject WHERE id = '%u' LIMIT %u", + go_id,uint32(count)); + + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + float x = fields[1].GetFloat(); + float y = fields[2].GetFloat(); + float z = fields[3].GetFloat(); + int mapid = fields[4].GetUInt16(); + + if (m_session) + PSendSysMessage(LANG_GO_LIST_CHAT, guid, guid, gInfo->name, x, y, z, mapid); + else + PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name, x, y, z, mapid); + } while (result->NextRow()); + } + + PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE,go_id,obj_count); + return true; +} + +bool ChatHandler::HandleGameObjectStateCommand(const char *args) +{ + // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args, "Hgameobject"); + if (!cId) + return false; + + uint32 lowguid = atoi(cId); + if (!lowguid) + return false; + + GameObject* gobj = NULL; + + if (GameObjectData const* goData = objmgr.GetGOData(lowguid)) + gobj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, goData->id); + + if (!gobj) + { + PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); + SetSentErrorMessage(true); + return false; + } + + char* ctype = strtok(NULL, " "); + if (!ctype) + return false; + + int32 type = atoi(ctype); + if (type < 0) + { + if (type == -1) + gobj->SendObjectDeSpawnAnim(gobj->GetGUID()); + else if (type == -2) + { + return false; + } + return true; + } + + char* cstate = strtok(NULL, " "); + if (!cstate) + return false; + + int32 state = atoi(cstate); + + if (type < 4) + gobj->SetByteValue(GAMEOBJECT_BYTES_1, type, state); + else if (type == 4) + { + WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4); + data << gobj->GetGUID(); + data << (uint32)(state); + gobj->SendMessageToSet(&data, true); + } + PSendSysMessage("Set gobject type %d state %d", type, state); + + return true; +} + +bool ChatHandler::HandleListCreatureCommand(const char *args) +{ + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hcreature_entry"); + if (!cId) + return false; + + uint32 cr_id = atol(cId); + if (!cr_id) + { + PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); + SetSentErrorMessage(true); + return false; + } + + CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(cr_id); + if (!cInfo) + { + PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id); + SetSentErrorMessage(true); + return false; + } + + char* c_count = strtok(NULL, " "); + int count = c_count ? atol(c_count) : 10; + + if (count < 0) + return false; + + QueryResult_AutoPtr result; + + uint32 cr_count = 0; + result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'",cr_id); + if (result) + cr_count = (*result)[0].GetUInt32(); + + if (m_session) + { + Player* pl = m_session->GetPlayer(); + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u", + pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id,uint32(count)); + } + else + result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u", + cr_id,uint32(count)); + + if (result) + { + do + { + Field *fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + float x = fields[1].GetFloat(); + float y = fields[2].GetFloat(); + float z = fields[3].GetFloat(); + int mapid = fields[4].GetUInt16(); + + if (m_session) + PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name, x, y, z, mapid); + else + PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name, x, y, z, mapid); + } while (result->NextRow()); + } + + PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE,cr_id,cr_count); + return true; +} + +bool ChatHandler::HandleLookupItemCommand(const char *args) +{ + if (!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + wstrToLower(wnamepart); + + bool found = false; + + // Search in `item_template` + for (uint32 id = 0; id < sItemStorage.MaxEntry; id++) + { + ItemPrototype const *pProto = sItemStorage.LookupEntry(id); + if (!pProto) + continue; + + int loc_idx = GetSessionDbLocaleIndex(); + if (loc_idx >= 0) + { + ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); + if (il) + { + if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) + { + std::string name = il->Name[loc_idx]; + + if (Utf8FitTo(name, wnamepart)) + { + if (m_session) + PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str()); + + if (!found) + found = true; + + continue; + } + } + } + } + + std::string name = pProto->Name1; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + { + if (m_session) + PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str()); + + if (!found) + found = true; + } + } + + if (!found) + SendSysMessage(LANG_COMMAND_NOITEMFOUND); + + return true; +} + +bool ChatHandler::HandleLookupItemSetCommand(const char *args) +{ + if (!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wnamepart); + + bool found = false; + + // Search in ItemSet.dbc + for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++) + { + ItemSetEntry const *set = sItemSetStore.LookupEntry(id); + if (set) + { + int loc = GetSessionDbcLocale(); + std::string name = set->name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale()) + continue; + + name = set->name[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + // send item set in "id - [namedlink locale]" format + if (m_session) + PSendSysMessage(LANG_ITEMSET_LIST_CHAT,id,id,name.c_str(),localeNames[loc]); + else + PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE,id,name.c_str(),localeNames[loc]); + + if (!found) + found = true; + } + } + } + if (!found) + SendSysMessage(LANG_COMMAND_NOITEMSETFOUND); + return true; +} + +bool ChatHandler::HandleLookupSkillCommand(const char *args) +{ + if (!*args) + return false; + + // can be NULL in console call + Player* target = getSelectedPlayer(); + + std::string namepart = args; + std::wstring wnamepart; + + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wnamepart); + + bool found = false; + + // Search in SkillLine.dbc + for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++) + { + SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(id); + if (skillInfo) + { + int loc = GetSessionDbcLocale(); + std::string name = skillInfo->name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale()) + continue; + + name = skillInfo->name[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + char valStr[50] = ""; + char const* knownStr = ""; + if (target && target->HasSkill(id)) + { + knownStr = GetTrinityString(LANG_KNOWN); + uint32 curValue = target->GetPureSkillValue(id); + uint32 maxValue = target->GetPureMaxSkillValue(id); + uint32 permValue = target->GetSkillPermBonusValue(id); + uint32 tempValue = target->GetSkillTempBonusValue(id); + + char const* valFormat = GetTrinityString(LANG_SKILL_VALUES); + snprintf(valStr,50,valFormat,curValue,maxValue,permValue,tempValue); + } + + // send skill in "id - [namedlink locale]" format + if (m_session) + PSendSysMessage(LANG_SKILL_LIST_CHAT,id,id,name.c_str(),localeNames[loc],knownStr,valStr); + else + PSendSysMessage(LANG_SKILL_LIST_CONSOLE,id,name.c_str(),localeNames[loc],knownStr,valStr); + + if (!found) + found = true; + } + } + } + if (!found) + SendSysMessage(LANG_COMMAND_NOSKILLFOUND); + return true; +} + +bool ChatHandler::HandleLookupSpellCommand(const char *args) +{ + if (!*args) + return false; + + // can be NULL at console call + Player* target = getSelectedPlayer(); + + std::string namepart = args; + std::wstring wnamepart; + + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wnamepart); + + bool found = false; + + // Search in Spell.dbc + for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++) + { + SpellEntry const *spellInfo = sSpellStore.LookupEntry(id); + if (spellInfo) + { + int loc = GetSessionDbcLocale(); + std::string name = spellInfo->SpellName[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale()) + continue; + + name = spellInfo->SpellName[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + bool known = target && target->HasSpell(id); + bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL); + + uint32 talentCost = GetTalentSpellCost(id); + + bool talent = (talentCost > 0); + bool passive = IsPassiveSpell(id); + bool active = target && target->HasAura(id); + + // unit32 used to prevent interpreting uint8 as char at output + // find rank of learned spell for learning spell, or talent rank + uint32 rank = talentCost ? talentCost : spellmgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id); + + // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format + std::ostringstream ss; + if (m_session) + ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; + else + ss << id << " - " << name; + + // include rank in link name + if (rank) + ss << GetTrinityString(LANG_SPELL_RANK) << rank; + + if (m_session) + ss << " " << localeNames[loc] << "]|h|r"; + else + ss << " " << localeNames[loc]; + + if (talent) + ss << GetTrinityString(LANG_TALENT); + if (passive) + ss << GetTrinityString(LANG_PASSIVE); + if (learn) + ss << GetTrinityString(LANG_LEARN); + if (known) + ss << GetTrinityString(LANG_KNOWN); + if (active) + ss << GetTrinityString(LANG_ACTIVE); + + SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } + } + } + if (!found) + SendSysMessage(LANG_COMMAND_NOSPELLFOUND); + return true; +} + +bool ChatHandler::HandleLookupQuestCommand(const char *args) +{ + if (!*args) + return false; + + // can be NULL at console call + Player* target = getSelectedPlayer(); + + std::string namepart = args; + std::wstring wnamepart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + wstrToLower(wnamepart); + + bool found = false; + + ObjectMgr::QuestMap const& qTemplates = objmgr.GetQuestTemplates(); + for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter) + { + Quest * qinfo = iter->second; + + int loc_idx = GetSessionDbLocaleIndex(); + if (loc_idx >= 0) + { + QuestLocale const *il = objmgr.GetQuestLocale(qinfo->GetQuestId()); + if (il) + { + if (il->Title.size() > loc_idx && !il->Title[loc_idx].empty()) + { + std::string title = il->Title[loc_idx]; + + if (Utf8FitTo(title, wnamepart)) + { + char const* statusStr = ""; + + if (target) + { + QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); + + if (status == QUEST_STATUS_COMPLETE) + { + if (target->GetQuestRewardStatus(qinfo->GetQuestId())) + statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); + else + statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); + } + else if (status == QUEST_STATUS_INCOMPLETE) + statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); + } + + if (m_session) + PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),qinfo->GetQuestLevel(),title.c_str(),statusStr); + else + PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); + + if (!found) + found = true; + + continue; + } + } + } + } + + std::string title = qinfo->GetTitle(); + if (title.empty()) + continue; + + if (Utf8FitTo(title, wnamepart)) + { + char const* statusStr = ""; + + if (target) + { + QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId()); + + if (status == QUEST_STATUS_COMPLETE) + { + if (target->GetQuestRewardStatus(qinfo->GetQuestId())) + statusStr = GetTrinityString(LANG_COMMAND_QUEST_REWARDED); + else + statusStr = GetTrinityString(LANG_COMMAND_QUEST_COMPLETE); + } + else if (status == QUEST_STATUS_INCOMPLETE) + statusStr = GetTrinityString(LANG_COMMAND_QUEST_ACTIVE); + } + + if (m_session) + PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),qinfo->GetQuestLevel(),title.c_str(),statusStr); + else + PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); + + if (!found) + found = true; + } + } + + if (!found) + SendSysMessage(LANG_COMMAND_NOQUESTFOUND); + + return true; +} + +bool ChatHandler::HandleLookupCreatureCommand(const char *args) +{ + if (!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + // converting string that we try to find to lower case + if (!Utf8toWStr (namepart,wnamepart)) + return false; + + wstrToLower (wnamepart); + + bool found = false; + + for (uint32 id = 0; id< sCreatureStorage.MaxEntry; ++id) + { + CreatureInfo const* cInfo = sCreatureStorage.LookupEntry (id); + if (!cInfo) + continue; + + int loc_idx = GetSessionDbLocaleIndex(); + if (loc_idx >= 0) + { + CreatureLocale const *cl = objmgr.GetCreatureLocale (id); + if (cl) + { + if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty ()) + { + std::string name = cl->Name[loc_idx]; + + if (Utf8FitTo (name, wnamepart)) + { + if (m_session) + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); + else + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); + + if (!found) + found = true; + + continue; + } + } + } + } + + std::string name = cInfo->Name; + if (name.empty ()) + continue; + + if (Utf8FitTo(name, wnamepart)) + { + if (m_session) + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name.c_str ()); + else + PSendSysMessage (LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name.c_str ()); + + if (!found) + found = true; + } + } + + if (!found) + SendSysMessage (LANG_COMMAND_NOCREATUREFOUND); + + return true; +} + +bool ChatHandler::HandleLookupObjectCommand(const char *args) +{ + if (!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + wstrToLower(wnamepart); + + bool found = false; + + for (uint32 id = 0; id< sGOStorage.MaxEntry; id++) + { + GameObjectInfo const* gInfo = sGOStorage.LookupEntry(id); + if (!gInfo) + continue; + + int loc_idx = GetSessionDbLocaleIndex(); + if (loc_idx >= 0) + { + GameObjectLocale const *gl = objmgr.GetGameObjectLocale(id); + if (gl) + { + if (gl->Name.size() > loc_idx && !gl->Name[loc_idx].empty()) + { + std::string name = gl->Name[loc_idx]; + + if (Utf8FitTo(name, wnamepart)) + { + if (m_session) + PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); + + if (!found) + found = true; + + continue; + } + } + } + } + + std::string name = gInfo->name; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + { + if (m_session) + PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); + else + PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); + + if (!found) + found = true; + } + } + + if (!found) + SendSysMessage(LANG_COMMAND_NOGAMEOBJECTFOUND); + + return true; +} + +bool ChatHandler::HandleLookupFactionCommand(const char *args) +{ + if (!*args) + return false; + + // Can be NULL at console call + Player *target = getSelectedPlayer (); + + std::string namepart = args; + std::wstring wnamepart; + + if (!Utf8toWStr (namepart,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower (wnamepart); + + bool found = false; + + for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id) + { + FactionEntry const *factionEntry = sFactionStore.LookupEntry (id); + if (factionEntry) + { + FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; + + int loc = GetSessionDbcLocale(); + std::string name = factionEntry->name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale()) + continue; + + name = factionEntry->name[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format + // or "id - [faction] [no reputation]" format + std::ostringstream ss; + if (m_session) + ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << " " << localeNames[loc] << "]|h|r"; + else + ss << id << " - " << name << " " << localeNames[loc]; + + if (repState) // and then target != NULL also + { + ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); + std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]); + + ss << " " << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ")"; + + if (repState->Flags & FACTION_FLAG_VISIBLE) + ss << GetTrinityString(LANG_FACTION_VISIBLE); + if (repState->Flags & FACTION_FLAG_AT_WAR) + ss << GetTrinityString(LANG_FACTION_ATWAR); + if (repState->Flags & FACTION_FLAG_PEACE_FORCED) + ss << GetTrinityString(LANG_FACTION_PEACE_FORCED); + if (repState->Flags & FACTION_FLAG_HIDDEN) + ss << GetTrinityString(LANG_FACTION_HIDDEN); + if (repState->Flags & FACTION_FLAG_INVISIBLE_FORCED) + ss << GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); + if (repState->Flags & FACTION_FLAG_INACTIVE) + ss << GetTrinityString(LANG_FACTION_INACTIVE); + } + else + ss << GetTrinityString(LANG_FACTION_NOREPUTATION); + + SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } + } + } + + if (!found) + SendSysMessage(LANG_COMMAND_FACTION_NOTFOUND); + return true; +} + +bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args) +{ + if (!*args) + return false; + + std::string namepart = args; + std::wstring wnamepart; + + if (!Utf8toWStr(namepart,wnamepart)) + return false; + + // converting string that we try to find to lower case + wstrToLower(wnamepart); + + bool found = false; + + // Search in TaxiNodes.dbc + for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++) + { + TaxiNodesEntry const *nodeEntry = sTaxiNodesStore.LookupEntry(id); + if (nodeEntry) + { + int loc = GetSessionDbcLocale(); + std::string name = nodeEntry->name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = 0; + for (; loc < MAX_LOCALE; ++loc) + { + if (loc == GetSessionDbcLocale()) + continue; + + name = nodeEntry->name[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format + if (m_session) + PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(),localeNames[loc], + nodeEntry->map_id,nodeEntry->x,nodeEntry->y,nodeEntry->z); + else + PSendSysMessage (LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[loc], + nodeEntry->map_id,nodeEntry->x,nodeEntry->y,nodeEntry->z); + + if (!found) + found = true; + } + } + } + if (!found) + SendSysMessage(LANG_COMMAND_NOTAXINODEFOUND); + return true; +} + +bool ChatHandler::HandleLookupMapCommand(const char *args) +{ + if (!*args) + return false; + + /*std::string namepart = args; + std::wstring wnamepart; + + // converting string that we try to find to lower case + if (!Utf8toWStr(namepart, wnamepart)) + return false; + + wstrToLower(wnamepart); + + bool found = false; + + // search in Map.dbc + for (uint32 id = 0; id < sMapStore.GetNumRows(); id++) + { + MapEntry const* MapInfo = sMapStore.LookupEntry(id); + if (MapInfo) + { + uint8 loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale(); + + std::string name = MapInfo->name[loc]; + if (name.empty()) + continue; + + if (!Utf8FitTo(name, wnamepart)) + { + loc = LOCALE_enUS; + for (; loc < MAX_LOCALE; loc++) + { + if (m_session && loc == m_session->GetSessionDbcLocale()) + continue; + + name = MapInfo->name[loc]; + if (name.empty()) + continue; + + if (Utf8FitTo(name, wnamepart)) + break; + } + } + + if (loc < MAX_LOCALE) + { + // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format + std::ostringstream ss; + + if (m_session) + ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << "]"; + else // console + ss << id << " - [" << name << "]"; + + if (MapInfo->IsContinent()) + ss << GetTrinityString(LANG_CONTINENT); + + switch(MapInfo->map_type) + { + case MAP_INSTANCE: ss << GetTrinityString(LANG_INSTANCE); break; + case MAP_BATTLEGROUND: ss << GetTrinityString(LANG_BATTLEGROUND); break; + case MAP_ARENA: ss << GetTrinityString(LANG_ARENA); break; + } + + if (MapInfo->IsRaid()) + ss << GetTrinityString(LANG_RAID); + + if (MapInfo->SupportsHeroicMode()) + ss << GetTrinityString(LANG_HEROIC); + + uint32 ResetTimeRaid = MapInfo->resetTimeRaid; + + std::string ResetTimeRaidStr; + if (ResetTimeRaid) + ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false); + + uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic; + std::string ResetTimeHeroicStr; + if (ResetTimeHeroic) + ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false); + + if (MapInfo->IsMountAllowed()) + ss << GetTrinityString(LANG_MOUNTABLE); + + if (ResetTimeRaid && !ResetTimeHeroic) + PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str()); + else if (!ResetTimeRaid && ResetTimeHeroic) + PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str()); + else if (ResetTimeRaid && ResetTimeHeroic) + PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str()); + else + SendSysMessage(ss.str().c_str()); + + if (!found) + found = true; + } + } + } + + if (!found) + SendSysMessage(LANG_COMMAND_NOMAPFOUND); + */ + return true; +} + +/** \brief GM command level 3 - Create a guild. + * + * This command allows a GM (level 3) to create a guild. + * + * The "args" parameter contains the name of the guild leader + * and then the name of the guild. + * + */ +bool ChatHandler::HandleGuildCreateCommand(const char *args) +{ + if (!*args) + return false; + + // if not guild name only (in "") then player name + Player* target; + if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, &target)) + return false; + + char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; + if (!tailStr) + return false; + + char* guildStr = extractQuotedArg(tailStr); + if (!guildStr) + return false; + + std::string guildname = guildStr; + + if (target->GetGuildId()) + { + SendSysMessage (LANG_PLAYER_IN_GUILD); + return true; + } + + Guild *guild = new Guild; + if (!guild->Create (target,guildname)) + { + delete guild; + SendSysMessage (LANG_GUILD_NOT_CREATED); + SetSentErrorMessage (true); + return false; + } + + objmgr.AddGuild (guild); + return true; +} + +bool ChatHandler::HandleGuildInviteCommand(const char *args) +{ + if (!*args) + return false; + + // if not guild name only (in "") then player name + uint64 target_guid; + if (!extractPlayerTarget(*args != '"' ? (char*)args : NULL, NULL, &target_guid)) + return false; + + char* tailStr = *args != '"' ? strtok(NULL, "") : (char*)args; + if (!tailStr) + return false; + + char* guildStr = extractQuotedArg(tailStr); + if (!guildStr) + return false; + + std::string glName = guildStr; + Guild* targetGuild = objmgr.GetGuildByName (glName); + if (!targetGuild) + return false; + + // player's guild membership checked in AddMember before add + if (!targetGuild->AddMember (target_guid,targetGuild->GetLowestRank ())) + return false; + + return true; +} + +bool ChatHandler::HandleGuildUninviteCommand(const char *args) +{ + Player* target; + uint64 target_guid; + if (!extractPlayerTarget((char*)args,&target,&target_guid)) + return false; + + uint32 glId = target ? target->GetGuildId () : Player::GetGuildIdFromDB (target_guid); + if (!glId) + return false; + + Guild* targetGuild = objmgr.GetGuildById (glId); + if (!targetGuild) + return false; + + targetGuild->DelMember (target_guid); + return true; +} + +bool ChatHandler::HandleGuildRankCommand(const char *args) +{ + char* nameStr; + char* rankStr; + extractOptFirstArg((char*)args,&nameStr,&rankStr); + if (!rankStr) + return false; + + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name)) + return false; + + uint32 glId = target ? target->GetGuildId () : Player::GetGuildIdFromDB (target_guid); + if (!glId) + return false; + + Guild* targetGuild = objmgr.GetGuildById (glId); + if (!targetGuild) + return false; + + uint32 newrank = uint32 (atoi (rankStr)); + if (newrank > targetGuild->GetLowestRank ()) + return false; + + targetGuild->ChangeRank (target_guid,newrank); + return true; +} + +bool ChatHandler::HandleGuildDeleteCommand(const char *args) +{ + if (!*args) + return false; + + char* guildStr = extractQuotedArg((char*)args); + if (!guildStr) + return false; + + std::string gld = guildStr; + + Guild* targetGuild = objmgr.GetGuildByName (gld); + if (!targetGuild) + return false; + + targetGuild->Disband (); + + return true; +} + +bool ChatHandler::HandleGetDistanceCommand(const char *args) +{ + WorldObject* obj = NULL; + + if (*args) + { + uint64 guid = extractGuidFromLink((char*)args); + if (guid) + obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); + + if (!obj) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + } + else + { + obj = getSelectedUnit(); + + if (!obj) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + } + + PSendSysMessage(LANG_DISTANCE, m_session->GetPlayer()->GetDistance(obj), m_session->GetPlayer()->GetDistance2d(obj), m_session->GetPlayer()->GetExactDist(obj), m_session->GetPlayer()->GetExactDist2d(obj)); + return true; +} + +bool ChatHandler::HandleDieCommand(const char* /*args*/) +{ + Unit* target = getSelectedUnit(); + + if (!target || !m_session->GetPlayer()->GetSelection()) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (HasLowerSecurity((Player*)target,0,false)) + return false; + } + + if (target->isAlive()) + { + if (sWorld.getConfig(CONFIG_DIE_COMMAND_MODE)) + m_session->GetPlayer()->Kill(target); + else + m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + return true; +} + +bool ChatHandler::HandleDamageCommand(const char * args) +{ + if (!*args) + return false; + + Unit* target = getSelectedUnit(); + + if (!target || !m_session->GetPlayer()->GetSelection()) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (!target->isAlive()) + return true; + + char* damageStr = strtok((char*)args, " "); + if (!damageStr) + return false; + + int32 damage_int = atoi((char*)damageStr); + if (damage_int <= 0) + return true; + + uint32 damage = damage_int; + + char* schoolStr = strtok((char*)NULL, " "); + + // flat melee damage without resistence/etc reduction + if (!schoolStr) + { + m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (target != m_session->GetPlayer()) + m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_NORMAL, 0); + return true; + } + + uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL; + if (school >= MAX_SPELL_SCHOOL) + return false; + + SpellSchoolMask schoolmask = SpellSchoolMask(1 << school); + + if (schoolmask & SPELL_SCHOOL_MASK_NORMAL) + damage = m_session->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK); + + char* spellStr = strtok((char*)NULL, " "); + + // melee damage by specific school + if (!spellStr) + { + uint32 absorb = 0; + uint32 resist = 0; + + m_session->GetPlayer()->CalcAbsorbResist(target,schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); + + if (damage <= absorb + resist) + return true; + + damage -= absorb + resist; + + m_session->GetPlayer()->DealDamageMods(target,damage,&absorb); + m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false); + m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_NORMALSWING2, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_NORMAL, 0); + return true; + } + + // non-melee damage + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellid = extractSpellIdFromLink((char*)args); + if (!spellid || !sSpellStore.LookupEntry(spellid)) + return false; + + m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage); + return true; +} + +bool ChatHandler::HandleModifyArenaCommand(const char * args) +{ + if (!*args) + return false; + + Player *target = getSelectedPlayer(); + if (!target) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + int32 amount = (uint32)atoi(args); + + target->ModifyArenaPoints(amount); + + PSendSysMessage(LANG_COMMAND_MODIFY_ARENA, GetNameLink(target).c_str(), target->GetArenaPoints()); + + return true; +} + +bool ChatHandler::HandleReviveCommand(const char *args) +{ + Player* target; + uint64 target_guid; + if (!extractPlayerTarget((char*)args,&target,&target_guid)) + return false; + + if (target) + { + target->ResurrectPlayer(target->GetSession()->GetSecurity() > SEC_PLAYER ? 1.0f : 0.5f); + target->SpawnCorpseBones(); + target->SaveToDB(); + } + else + // will resurrected at login without corpse + sObjectAccessor.ConvertCorpseForPlayer(target_guid); + + return true; +} + +bool ChatHandler::HandleAuraCommand(const char *args) +{ + Unit *target = getSelectedUnit(); + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellID = extractSpellIdFromLink((char*)args); + + if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID)) + Aura::TryCreate(spellInfo, target, target); + + return true; +} + +bool ChatHandler::HandleUnAuraCommand(const char *args) +{ + Unit *target = getSelectedUnit(); + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + std::string argstr = args; + if (argstr == "all") + { + target->RemoveAllAuras(); + return true; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spellID = extractSpellIdFromLink((char*)args); + if (!spellID) + return false; + + target->RemoveAurasDueToSpell(spellID); + + return true; +} + +bool ChatHandler::HandleLinkGraveCommand(const char *args) +{ + if (!*args) + return false; + + char* px = strtok((char*)args, " "); + if (!px) + return false; + + uint32 g_id = (uint32)atoi(px); + + uint32 g_team; + + char* px2 = strtok(NULL, " "); + + if (!px2) + g_team = 0; + else if (strncmp(px2,"horde",6) == 0) + g_team = HORDE; + else if (strncmp(px2,"alliance",9) == 0) + g_team = ALLIANCE; + else + return false; + + WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id); + + if (!graveyard) + { + PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, g_id); + SetSentErrorMessage(true); + return false; + } + + Player* player = m_session->GetPlayer(); + + uint32 zoneId = player->GetZoneId(); + + AreaTableEntry const *areaEntry = GetAreaEntryByAreaID(zoneId); + if (!areaEntry || areaEntry->zone !=0) + { + PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id,zoneId); + SetSentErrorMessage(true); + return false; + } + + if (objmgr.AddGraveYardLink(g_id,zoneId,g_team)) + PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id,zoneId); + else + PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id,zoneId); + + return true; +} + +bool ChatHandler::HandleNearGraveCommand(const char *args) +{ + uint32 g_team; + + size_t argslen = strlen(args); + + if (!*args) + g_team = 0; + else if (strncmp((char*)args,"horde",argslen) == 0) + g_team = HORDE; + else if (strncmp((char*)args,"alliance",argslen) == 0) + g_team = ALLIANCE; + else + return false; + + Player* player = m_session->GetPlayer(); + uint32 zone_id = player->GetZoneId(); + + WorldSafeLocsEntry const* graveyard = objmgr.GetClosestGraveYard( + player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(),player->GetMapId(),g_team); + + if (graveyard) + { + uint32 g_id = graveyard->ID; + + GraveYardData const* data = objmgr.FindGraveYardData(g_id,zone_id); + if (!data) + { + PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR,g_id); + SetSentErrorMessage(true); + return false; + } + + g_team = data->team; + + std::string team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM); + + if (g_team == 0) + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (g_team == HORDE) + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (g_team == ALLIANCE) + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id,team_name.c_str(),zone_id); + } + else + { + std::string team_name; + + if (g_team == 0) + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY); + else if (g_team == HORDE) + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE); + else if (g_team == ALLIANCE) + team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE); + + if (g_team == ~uint32(0)) + PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id); + else + PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id,team_name.c_str()); + } + + return true; +} + +//-----------------------Npc Commands----------------------- +bool ChatHandler::HandleNpcAllowMovementCommand(const char* /*args*/) +{ + if (sWorld.getAllowMovement()) + { + sWorld.SetAllowMovement(false); + SendSysMessage(LANG_CREATURE_MOVE_DISABLED); + } + else + { + sWorld.SetAllowMovement(true); + SendSysMessage(LANG_CREATURE_MOVE_ENABLED); + } + return true; +} + +bool ChatHandler::HandleNpcChangeEntryCommand(const char *args) +{ + if (!*args) + return false; + + uint32 newEntryNum = atoi(args); + if (!newEntryNum) + return false; + + Unit* unit = getSelectedUnit(); + if (!unit || unit->GetTypeId() != TYPEID_UNIT) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + Creature* creature = unit->ToCreature(); + if (creature->UpdateEntry(newEntryNum)) + SendSysMessage(LANG_DONE); + else + SendSysMessage(LANG_ERROR); + return true; +} + +bool ChatHandler::HandleNpcInfoCommand(const char* /*args*/) +{ + Creature* target = getSelectedCreature(); + + if (!target) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + uint32 faction = target->getFaction(); + uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 displayid = target->GetDisplayId(); + uint32 nativeid = target->GetNativeDisplayId(); + uint32 Entry = target->GetEntry(); + CreatureInfo const* cInfo = target->GetCreatureInfo(); + + int32 curRespawnDelay = target->GetRespawnTimeEx()-time(NULL); + if (curRespawnDelay < 0) + curRespawnDelay = 0; + std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay,true); + std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(),true); + + PSendSysMessage(LANG_NPCINFO_CHAR, target->GetDBTableGUIDLow(), faction, npcflags, Entry, displayid, nativeid); + PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); + PSendSysMessage(LANG_NPCINFO_HEALTH,target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); + PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction()); + PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(),curRespawnDelayStr.c_str()); + PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid,cInfo->pickpocketLootId,cInfo->SkinLootId); + PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId()); + PSendSysMessage(LANG_NPCINFO_PHASEMASK, target->GetPhaseMask()); + PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor()); + PSendSysMessage(LANG_NPCINFO_POSITION,float(target->GetPositionX()), float(target->GetPositionY()), float(target->GetPositionZ())); + if (const CreatureData* const linked = target->GetLinkedRespawnCreatureData()) + if (CreatureInfo const *master = GetCreatureInfo(linked->id)) + PSendSysMessage(LANG_NPCINFO_LINKGUID, objmgr.GetLinkedRespawnGuid(target->GetDBTableGUIDLow()), linked->id, master->Name); + + if ((npcflags & UNIT_NPC_FLAG_VENDOR)) + { + SendSysMessage(LANG_NPCINFO_VENDOR); + } + if ((npcflags & UNIT_NPC_FLAG_TRAINER)) + { + SendSysMessage(LANG_NPCINFO_TRAINER); + } + + return true; +} + +//play npc emote +bool ChatHandler::HandleNpcPlayEmoteCommand(const char *args) +{ + uint32 emote = atoi((char*)args); + + Creature* target = getSelectedCreature(); + if (!target) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + target->SetUInt32Value(UNIT_NPC_EMOTESTATE,emote); + + return true; +} + +//TODO: NpcCommands that needs to be fixed : + +bool ChatHandler::HandleNpcAddWeaponCommand(const char* /*args*/) +{ + /*if (!*args) + return false; + + uint64 guid = m_session->GetPlayer()->GetSelection(); + if (guid == 0) + { + SendSysMessage(LANG_NO_SELECTION); + return true; + } + + Creature *pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(), guid); + + if (!pCreature) + { + SendSysMessage(LANG_SELECT_CREATURE); + return true; + } + + char* pSlotID = strtok((char*)args, " "); + if (!pSlotID) + return false; + + char* pItemID = strtok(NULL, " "); + if (!pItemID) + return false; + + uint32 ItemID = atoi(pItemID); + uint32 SlotID = atoi(pSlotID); + + ItemPrototype* tmpItem = objmgr.GetItemPrototype(ItemID); + + bool added = false; + if (tmpItem) + { + switch(SlotID) + { + case 1: + pCreature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, ItemID); + added = true; + break; + case 2: + pCreature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_01, ItemID); + added = true; + break; + case 3: + pCreature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_02, ItemID); + added = true; + break; + default: + PSendSysMessage(LANG_ITEM_SLOT_NOT_EXIST,SlotID); + added = false; + break; + } + + if (added) + PSendSysMessage(LANG_ITEM_ADDED_TO_SLOT,ItemID,tmpItem->Name1,SlotID); + } + else + { + PSendSysMessage(LANG_ITEM_NOT_FOUND,ItemID); + return true; + } + */ + return true; +} +//---------------------------------------------------------- + +bool ChatHandler::HandleExploreCheatCommand(const char *args) +{ + if (!*args) + return false; + + int flag = atoi((char*)args); + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + if (flag != 0) + { + PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL,GetNameLink().c_str()); + } + else + { + PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, GetNameLink(chr).c_str()); + if (needReportToTarget(chr)) + ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING,GetNameLink().c_str()); + } + + for (uint8 i=0; iGetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i,0xFFFFFFFF); + } + else + { + m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i,0); + } + } + + return true; +} + +bool ChatHandler::HandleHoverCommand(const char *args) +{ + char* px = strtok((char*)args, " "); + uint32 flag; + if (!px) + flag = 1; + else + flag = atoi(px); + + m_session->GetPlayer()->SetHover(flag); + + if (flag) + SendSysMessage(LANG_HOVER_ENABLED); + else + SendSysMessage(LANG_HOVER_DISABLED); + + return true; +} + +void ChatHandler::HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel) +{ + if (player) + { + player->GiveLevel(newlevel); + player->InitTalentForLevel(); + player->SetUInt32Value(PLAYER_XP,0); + + if (needReportToTarget(player)) + { + if (oldlevel == newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET,GetNameLink().c_str()); + else if (oldlevel < newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP,GetNameLink().c_str(),newlevel); + else // if (oldlevel > newlevel) + ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN,GetNameLink().c_str(),newlevel); + } + } + else + { + // update level and XP at level, all other will be updated at loading + CharacterDatabase.PExecute("UPDATE characters SET level = '%u', xp = 0 WHERE guid = '%u'", newlevel, GUID_LOPART(player_guid)); + } +} + +bool ChatHandler::HandleCharacterLevelCommand(const char *args) +{ + char* nameStr; + char* levelStr; + extractOptFirstArg((char*)args,&nameStr,&levelStr); + if (!levelStr) + return false; + + // exception opt second arg: .character level $name + if (isalpha(levelStr[0])) + { + nameStr = levelStr; + levelStr = NULL; // current level will used + } + + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name)) + return false; + + int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); + int32 newlevel = levelStr ? atoi(levelStr) : oldlevel; + + if (newlevel < 1) + return false; // invalid level + + if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level + newlevel = STRONG_MAX_LEVEL; + + HandleCharacterLevel(target,target_guid,oldlevel,newlevel); + + if (!m_session || m_session->GetPlayer() != target) // including player == NULL + { + std::string nameLink = playerLink(target_name); + PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel); + } + + return true; +} + +bool ChatHandler::HandleLevelUpCommand(const char *args) +{ + char* nameStr; + char* levelStr; + extractOptFirstArg((char*)args,&nameStr,&levelStr); + + // exception opt second arg: .character level $name + if (levelStr && isalpha(levelStr[0])) + { + nameStr = levelStr; + levelStr = NULL; // current level will used + } + + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget(nameStr,&target,&target_guid,&target_name)) + return false; + + int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid); + int32 addlevel = levelStr ? atoi(levelStr) : 1; + int32 newlevel = oldlevel + addlevel; + + if (newlevel < 1) + newlevel = 1; + + if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level + newlevel = STRONG_MAX_LEVEL; + + HandleCharacterLevel(target,target_guid,oldlevel,newlevel); + + if (!m_session || m_session->GetPlayer() != target) // including chr == NULL + { + std::string nameLink = playerLink(target_name); + PSendSysMessage(LANG_YOU_CHANGE_LVL,nameLink.c_str(),newlevel); + } + + return true; +} + +bool ChatHandler::HandleShowAreaCommand(const char *args) +{ + if (!*args) + return false; + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + int area = GetAreaFlagByAreaID(atoi((char*)args)); + int offset = area / 32; + uint32 val = (uint32)(1 << (area % 32)); + + if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val)); + + SendSysMessage(LANG_EXPLORE_AREA); + return true; +} + +bool ChatHandler::HandleHideAreaCommand(const char *args) +{ + if (!*args) + return false; + + Player *chr = getSelectedPlayer(); + if (chr == NULL) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + int area = GetAreaFlagByAreaID(atoi((char*)args)); + int offset = area / 32; + uint32 val = (uint32)(1 << (area % 32)); + + if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE) + { + SendSysMessage(LANG_BAD_VALUE); + SetSentErrorMessage(true); + return false; + } + + uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset); + chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields ^ val)); + + SendSysMessage(LANG_UNEXPLORE_AREA); + return true; +} + +bool ChatHandler::HandleBankCommand(const char* /*args*/) +{ + m_session->SendShowBank(m_session->GetPlayer()->GetGUID()); + + return true; +} + +bool ChatHandler::HandleChangeWeather(const char *args) +{ + if (!*args) + return false; + + //Weather is OFF + if (!sWorld.getConfig(CONFIG_WEATHER)) + { + SendSysMessage(LANG_WEATHER_DISABLED); + SetSentErrorMessage(true); + return false; + } + + //*Change the weather of a cell + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + + if (!px || !py) + return false; + + uint32 type = (uint32)atoi(px); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand + float grade = (float)atof(py); //0 to 1, sending -1 is instand good weather + + Player *player = m_session->GetPlayer(); + uint32 zoneid = player->GetZoneId(); + + Weather* wth = sWorld.FindWeather(zoneid); + + if (!wth) + wth = sWorld.AddWeather(zoneid); + if (!wth) + { + SendSysMessage(LANG_NO_WEATHER); + SetSentErrorMessage(true); + return false; + } + + wth->SetWeather(WeatherType(type), grade); + + return true; +} + +bool ChatHandler::HandleDebugSet32Bit(const char *args) +{ + if (!*args) + return false; + + WorldObject* target = getSelectedObject(); + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + char* px = strtok((char*)args, " "); + char* py = strtok(NULL, " "); + + if (!px || !py) + return false; + + uint32 Opcode = (uint32)atoi(px); + uint32 Value = (uint32)atoi(py); + if (Value > 32) //uint32 = 32 bits + return false; + + sLog.outDebug(GetTrinityString(LANG_SET_32BIT), Opcode, Value); + + uint32 iValue = Value ? 1 << (Value - 1) : 0; + target->SetUInt32Value(Opcode , iValue); + + PSendSysMessage(LANG_SET_32BIT_FIELD, Opcode, iValue); + return true; +} + +bool ChatHandler::HandleTeleAddCommand(const char * args) +{ + if (!*args) + return false; + + Player *player=m_session->GetPlayer(); + if (!player) + return false; + + std::string name = args; + + if (objmgr.GetGameTele(name)) + { + SendSysMessage(LANG_COMMAND_TP_ALREADYEXIST); + SetSentErrorMessage(true); + return false; + } + + GameTele tele; + tele.position_x = player->GetPositionX(); + tele.position_y = player->GetPositionY(); + tele.position_z = player->GetPositionZ(); + tele.orientation = player->GetOrientation(); + tele.mapId = player->GetMapId(); + tele.name = name; + + if (objmgr.AddGameTele(tele)) + { + SendSysMessage(LANG_COMMAND_TP_ADDED); + } + else + { + SendSysMessage(LANG_COMMAND_TP_ADDEDERR); + SetSentErrorMessage(true); + return false; + } + + return true; +} + +bool ChatHandler::HandleTeleDelCommand(const char * args) +{ + if (!*args) + return false; + + std::string name = args; + + if (!objmgr.DeleteGameTele(name)) + { + SendSysMessage(LANG_COMMAND_TELE_NOTFOUND); + SetSentErrorMessage(true); + return false; + } + + SendSysMessage(LANG_COMMAND_TP_DELETED); + return true; +} + +bool ChatHandler::HandleListAurasCommand (const char * /*args*/) +{ + Unit *unit = getSelectedUnit(); + if (!unit) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + char const* talentStr = GetTrinityString(LANG_TALENT); + char const* passiveStr = GetTrinityString(LANG_PASSIVE); + + Unit::AuraApplicationMap const& uAuras = unit->GetAppliedAuras(); + PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size()); + for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr) + { + bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0; + + AuraApplication const * aurApp = itr->second; + Aura const * aura = aurApp->GetBase(); + char const* name = aura->GetSpellProto()->SpellName[GetSessionDbcLocale()]; + + if (m_session) + { + std::ostringstream ss_name; + ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r"; + + PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), aurApp->GetEffectMask(), + aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), + aura->GetDuration(), aura->GetMaxDuration(), + ss_name.str().c_str(), + (aura->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), + IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(aura->GetCasterGUID())); + } + else + { + PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), aurApp->GetEffectMask(), + aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), + aura->GetDuration(), aura->GetMaxDuration(), + name, + (aura->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""), + IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(aura->GetCasterGUID())); + } + } + for (uint16 i = 0; i < TOTAL_AURAS; ++i) + { + Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i)); + if (uAuraList.empty()) continue; + PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); + for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) + { + //bool talent = GetTalentSpellCost((*itr)->GetId()) > 0; + + char const* name = (*itr)->GetSpellProto()->SpellName[GetSessionDbcLocale()]; + + std::ostringstream ss_name; + ss_name << "|cffffffff|Hspell:" << (*itr)->GetId() << "|h[" << name << "]|h|r"; + + PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), + (*itr)->GetAmount()); + } + } + return true; +} + +bool ChatHandler::HandleResetAchievementsCommand (const char * args) +{ + Player* target; + uint64 target_guid; + if (!extractPlayerTarget((char*)args,&target,&target_guid)) + return false; + + if (target) + target->GetAchievementMgr().Reset(); + else + AchievementMgr::DeleteFromDB(GUID_LOPART(target_guid)); + + return true; +} + +bool ChatHandler::HandleResetHonorCommand (const char * args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + target->SetUInt32Value(PLAYER_FIELD_KILLS, 0); + target->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0); + target->SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, 0); + target->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0); + target->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); + target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL); + + return true; +} + +static bool HandleResetStatsOrLevelHelper(Player* player) +{ + ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(player->getClass()); + if (!cEntry) + { + sLog.outError("Class %u not found in DBC (Wrong DBC files?)",player->getClass()); + return false; + } + + uint8 powertype = cEntry->powerType; + + // reset m_form if no aura + if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT)) + player->m_form = FORM_NONE; + + player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); + player->SetFloatValue(UNIT_FIELD_COMBATREACH, DEFAULT_COMBAT_REACH); + + player->setFactionForRace(player->getRace()); + + player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powertype << 24))); + + // reset only if player not in some form; + if (player->m_form == FORM_NONE) + player->InitDisplayIds(); + + player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); + player->SetByteValue(UNIT_FIELD_BYTES_2, 3, player->m_form); + + player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + + //-1 is default value + player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); + + //player->SetUInt32Value(PLAYER_FIELD_BYTES, 0xEEE00000); + return true; +} + +bool ChatHandler::HandleResetLevelCommand(const char * args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + if (!HandleResetStatsOrLevelHelper(target)) + return false; + + // set starting level + uint32 start_level = target->getClass() != CLASS_DEATH_KNIGHT + ? sWorld.getConfig(CONFIG_START_PLAYER_LEVEL) + : sWorld.getConfig(CONFIG_START_HEROIC_PLAYER_LEVEL); + + target->_ApplyAllLevelScaleItemMods(false); + + target->SetLevel(start_level); + target->InitRunes(); + target->InitStatsForLevel(true); + target->InitTaxiNodesForLevel(); + target->InitGlyphsForLevel(); + target->InitTalentForLevel(); + target->SetUInt32Value(PLAYER_XP,0); + + target->_ApplyAllLevelScaleItemMods(true); + + // reset level for pet + if (Pet* pet = target->GetPet()) + pet->SynchronizeLevelWithOwner(); + + return true; +} + +bool ChatHandler::HandleResetStatsCommand(const char * args) +{ + Player* target; + if (!extractPlayerTarget((char*)args,&target)) + return false; + + if (!HandleResetStatsOrLevelHelper(target)) + return false; + + target->InitRunes(); + target->InitStatsForLevel(true); + target->InitTaxiNodesForLevel(); + target->InitGlyphsForLevel(); + target->InitTalentForLevel(); + + return true; +} + +bool ChatHandler::HandleResetSpellsCommand(const char * args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + return false; + + if (target) + { + target->resetSpells(/* bool myClassOnly */); + + ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS); + if (!m_session || m_session->GetPlayer() != target) + PSendSysMessage(LANG_RESET_SPELLS_ONLINE,GetNameLink(target).c_str()); + } + else + { + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",uint32(AT_LOGIN_RESET_SPELLS), GUID_LOPART(target_guid)); + PSendSysMessage(LANG_RESET_SPELLS_OFFLINE,target_name.c_str()); + } + + return true; +} + +bool ChatHandler::HandleResetTalentsCommand(const char * args) +{ + Player* target; + uint64 target_guid; + std::string target_name; + if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name)) + { + // Try reset talents as Hunter Pet + Creature* creature = getSelectedCreature(); + if (!*args && creature && creature->isPet()) + { + Unit *owner = creature->GetOwner(); + if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor(owner->ToPlayer())) + { + ((Pet *)creature)->resetTalents(true); + owner->ToPlayer()->SendTalentsInfoData(true); + + ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS); + if (!m_session || m_session->GetPlayer() != owner->ToPlayer()) + PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink(owner->ToPlayer()).c_str()); + } + return true; + } + + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + if (target) + { + target->resetTalents(true); + target->SendTalentsInfoData(false); + ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS); + if (!m_session || m_session->GetPlayer() != target) + PSendSysMessage(LANG_RESET_TALENTS_ONLINE,GetNameLink(target).c_str()); + + Pet* pet = target->GetPet(); + Pet::resetTalentsForAllPetsOf(target,pet); + if (pet) + target->SendTalentsInfoData(true); + return true; + } + else if (target_guid) + { + uint32 at_flags = AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS; + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'",at_flags, GUID_LOPART(target_guid)); + std::string nameLink = playerLink(target_name); + PSendSysMessage(LANG_RESET_TALENTS_OFFLINE,nameLink.c_str()); + return true; + } + + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; +} + +bool ChatHandler::HandleResetAllCommand(const char * args) +{ + if (!*args) + return false; + + std::string casename = args; + + AtLoginFlags atLogin; + + // Command specially created as single command to prevent using short case names + if (casename == "spells") + { + atLogin = AT_LOGIN_RESET_SPELLS; + sWorld.SendWorldText(LANG_RESETALL_SPELLS); + if (!m_session) + SendSysMessage(LANG_RESETALL_SPELLS); + } + else if (casename == "talents") + { + atLogin = AtLoginFlags(AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS); + sWorld.SendWorldText(LANG_RESETALL_TALENTS); + if (!m_session) + SendSysMessage(LANG_RESETALL_TALENTS); + } + else + { + PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE,args); + SetSentErrorMessage(true); + return false; + } + + CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'",atLogin,atLogin); + + ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, *HashMapHolder::GetLock(), true); + HashMapHolder::MapType const& plist = sObjectAccessor.GetPlayers(); + for (HashMapHolder::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) + itr->second->SetAtLoginFlag(atLogin); + + return true; +} + +bool ChatHandler::HandleServerShutDownCancelCommand(const char* /*args*/) +{ + sWorld.ShutdownCancel(); + return true; +} + +bool ChatHandler::HandleServerShutDownCommand(const char *args) +{ + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + ///- Prevent interpret wrong arg value as 0 secs shutdown time + if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi (exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld.ShutdownServ (time, 0, exitcode); + } + else + sWorld.ShutdownServ(time,0,SHUTDOWN_EXIT_CODE); + return true; +} + +bool ChatHandler::HandleServerRestartCommand(const char *args) +{ + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + ///- Prevent interpret wrong arg value as 0 secs shutdown time + if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0') || time < 0)) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi (exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld.ShutdownServ (time, SHUTDOWN_MASK_RESTART, exitcode); + } + else + sWorld.ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); + return true; +} + +bool ChatHandler::HandleServerIdleRestartCommand(const char *args) +{ + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + ///- Prevent interpret wrong arg value as 0 secs shutdown time + if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0') || time < 0)) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi (exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld.ShutdownServ (time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); + } + else + sWorld.ShutdownServ(time,SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE,RESTART_EXIT_CODE); + return true; +} + +bool ChatHandler::HandleServerIdleShutDownCommand(const char *args) +{ + if (!*args) + return false; + + char* time_str = strtok ((char*) args, " "); + char* exitcode_str = strtok (NULL, ""); + + int32 time = atoi (time_str); + + ///- Prevent interpret wrong arg value as 0 secs shutdown time + if (time == 0 && (time_str[0] != '0' || time_str[1] != '\0') || time < 0) + return false; + + if (exitcode_str) + { + int32 exitcode = atoi (exitcode_str); + + // Handle atoi() errors + if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) + return false; + + // Exit code should be in range of 0-125, 126-255 is used + // in many shells for their own return codes and code > 255 + // is not supported in many others + if (exitcode < 0 || exitcode > 125) + return false; + + sWorld.ShutdownServ (time, SHUTDOWN_MASK_IDLE, exitcode); + } + else + sWorld.ShutdownServ(time,SHUTDOWN_MASK_IDLE,SHUTDOWN_EXIT_CODE); + return true; +} + +bool ChatHandler::HandleQuestAdd(const char *args) +{ + Player* player = getSelectedPlayer(); + if (!player) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // .addquest #entry' + // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hquest"); + if (!cId) + return false; + + uint32 entry = atol(cId); + + Quest const* pQuest = objmgr.GetQuestTemplate(entry); + + if (!pQuest) + { + PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND,entry); + SetSentErrorMessage(true); + return false; + } + + // check item starting quest (it can work incorrectly if added without item in inventory) + for (uint32 id = 0; id < sItemStorage.MaxEntry; id++) + { + ItemPrototype const *pProto = sItemStorage.LookupEntry(id); + if (!pProto) + continue; + + if (pProto->StartQuest == entry) + { + PSendSysMessage(LANG_COMMAND_QUEST_STARTFROMITEM, entry, pProto->ItemId); + SetSentErrorMessage(true); + return false; + } + } + + // ok, normal (creature/GO starting) quest + if (player->CanAddQuest(pQuest, true)) + { + player->AddQuest(pQuest, NULL); + + if (player->CanCompleteQuest(entry)) + player->CompleteQuest(entry); + } + + return true; +} + +bool ChatHandler::HandleQuestRemove(const char *args) +{ + Player* player = getSelectedPlayer(); + if (!player) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // .removequest #entry' + // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hquest"); + if (!cId) + return false; + + uint32 entry = atol(cId); + + Quest const* pQuest = objmgr.GetQuestTemplate(entry); + + if (!pQuest) + { + PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); + SetSentErrorMessage(true); + return false; + } + + // remove all quest entries for 'entry' from quest log + for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) + { + uint32 quest = player->GetQuestSlotQuestId(slot); + if (quest == entry) + { + player->SetQuestSlot(slot,0); + + // we ignore unequippable quest items in this case, its' still be equipped + player->TakeQuestSourceItem(quest, false); + } + } + + // set quest status to not started (will updated in DB at next save) + player->SetQuestStatus(entry, QUEST_STATUS_NONE); + + // reset rewarded for restart repeatable quest + player->getQuestStatusMap()[entry].m_rewarded = false; + + SendSysMessage(LANG_COMMAND_QUEST_REMOVED); + return true; +} + +bool ChatHandler::HandleQuestComplete(const char *args) +{ + Player* player = getSelectedPlayer(); + if (!player) + { + SendSysMessage(LANG_NO_CHAR_SELECTED); + SetSentErrorMessage(true); + return false; + } + + // .quest complete #entry + // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r + char* cId = extractKeyFromLink((char*)args,"Hquest"); + if (!cId) + return false; + + uint32 entry = atol(cId); + + Quest const* pQuest = objmgr.GetQuestTemplate(entry); + + // If player doesn't have the quest + if (!pQuest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE) + { + PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry); + SetSentErrorMessage(true); + return false; + } + + // Add quest items for quests that require items + for (uint8 x = 0; x < QUEST_ITEM_OBJECTIVES_COUNT; ++x) + { + uint32 id = pQuest->ReqItemId[x]; + uint32 count = pQuest->ReqItemCount[x]; + if (!id || !count) + continue; + + uint32 curItemCount = player->GetItemCount(id,true); + + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, id, count-curItemCount); + if (msg == EQUIP_ERR_OK) + { + Item* item = player->StoreNewItem(dest, id, true); + player->SendNewItem(item,count-curItemCount,true,false); + } + } + + // All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10") + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + { + uint32 creature = pQuest->ReqCreatureOrGOId[i]; + uint32 creaturecount = pQuest->ReqCreatureOrGOCount[i]; + + if (uint32 spell_id = pQuest->ReqSpell[i]) + { + for (uint16 z = 0; z < creaturecount; ++z) + player->CastedCreatureOrGO(creature,0,spell_id); + } + else if (creature > 0) + { + if (CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creature)) + for (uint16 z = 0; z < creaturecount; ++z) + player->KilledMonster(cInfo,0); + } + else if (creature < 0) + { + for (uint16 z = 0; z < creaturecount; ++z) + player->CastedCreatureOrGO(creature,0,0); + } + } + + // If the quest requires reputation to complete + if (uint32 repFaction = pQuest->GetRepObjectiveFaction()) + { + uint32 repValue = pQuest->GetRepObjectiveValue(); + uint32 curRep = player->GetReputationMgr().GetReputation(repFaction); + if (curRep < repValue) + if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction)) + player->GetReputationMgr().SetReputation(factionEntry,repValue); + } + + // If the quest requires a SECOND reputation to complete + if (uint32 repFaction = pQuest->GetRepObjectiveFaction2()) + { + uint32 repValue2 = pQuest->GetRepObjectiveValue2(); + uint32 curRep = player->GetReputationMgr().GetReputation(repFaction); + if (curRep < repValue2) + if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction)) + player->GetReputationMgr().SetReputation(factionEntry,repValue2); + } + + // If the quest requires money + int32 ReqOrRewMoney = pQuest->GetRewOrReqMoney(); + if (ReqOrRewMoney < 0) + player->ModifyMoney(-ReqOrRewMoney); + + player->CompleteQuest(entry); + return true; +} + +bool ChatHandler::HandleBanAccountCommand(const char *args) +{ + return HandleBanHelper(BAN_ACCOUNT,args); +} + +bool ChatHandler::HandleBanCharacterCommand(const char *args) +{ + return HandleBanHelper(BAN_CHARACTER,args); +} + +bool ChatHandler::HandleBanIPCommand(const char *args) +{ + return HandleBanHelper(BAN_IP,args); +} + +bool ChatHandler::HandleBanHelper(BanMode mode, const char *args) +{ + if (!*args) + return false; + + char* cnameOrIP = strtok ((char*)args, " "); + if (!cnameOrIP) + return false; + + std::string nameOrIP = cnameOrIP; + + char* duration = strtok (NULL," "); + if (!duration || !atoi(duration)) + return false; + + char* reason = strtok (NULL,""); + if (!reason) + return false; + + switch(mode) + { + case BAN_ACCOUNT: + if (!AccountMgr::normalizeString(nameOrIP)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str()); + SetSentErrorMessage(true); + return false; + } + break; + case BAN_CHARACTER: + if (!normalizePlayerName(nameOrIP)) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + break; + case BAN_IP: + if (!IsIPAddress(nameOrIP.c_str())) + return false; + break; + } + + switch(sWorld.BanAccount(mode, nameOrIP, duration, reason,m_session ? m_session->GetPlayerName() : "")) + { + case BAN_SUCCESS: + if (atoi(duration)>0) + PSendSysMessage(LANG_BAN_YOUBANNED,nameOrIP.c_str(),secsToTimeString(TimeStringToSecs(duration),true).c_str(),reason); + else + PSendSysMessage(LANG_BAN_YOUPERMBANNED,nameOrIP.c_str(),reason); + break; + case BAN_SYNTAX_ERROR: + return false; + case BAN_NOTFOUND: + switch(mode) + { + default: + PSendSysMessage(LANG_BAN_NOTFOUND,"account",nameOrIP.c_str()); + break; + case BAN_CHARACTER: + PSendSysMessage(LANG_BAN_NOTFOUND,"character",nameOrIP.c_str()); + break; + case BAN_IP: + PSendSysMessage(LANG_BAN_NOTFOUND,"ip",nameOrIP.c_str()); + break; + } + SetSentErrorMessage(true); + return false; + } + + return true; +} + +bool ChatHandler::HandleUnBanAccountCommand(const char *args) +{ + return HandleUnBanHelper(BAN_ACCOUNT,args); +} + +bool ChatHandler::HandleUnBanCharacterCommand(const char *args) +{ + return HandleUnBanHelper(BAN_CHARACTER,args); +} + +bool ChatHandler::HandleUnBanIPCommand(const char *args) +{ + return HandleUnBanHelper(BAN_IP,args); +} + +bool ChatHandler::HandleUnBanHelper(BanMode mode, const char *args) +{ + if (!*args) + return false; + + char* cnameOrIP = strtok ((char*)args, " "); + if (!cnameOrIP) + return false; + + std::string nameOrIP = cnameOrIP; + + switch(mode) + { + case BAN_ACCOUNT: + if (!AccountMgr::normalizeString(nameOrIP)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,nameOrIP.c_str()); + SetSentErrorMessage(true); + return false; + } + break; + case BAN_CHARACTER: + if (!normalizePlayerName(nameOrIP)) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + break; + case BAN_IP: + if (!IsIPAddress(nameOrIP.c_str())) + return false; + break; + } + + if (sWorld.RemoveBanAccount(mode,nameOrIP)) + PSendSysMessage(LANG_UNBAN_UNBANNED,nameOrIP.c_str()); + else + PSendSysMessage(LANG_UNBAN_ERROR,nameOrIP.c_str()); + + return true; +} + +bool ChatHandler::HandleBanInfoAccountCommand(const char *args) +{ + if (!*args) + return false; + + char* cname = strtok((char*)args, ""); + if (!cname) + return false; + + std::string account_name = cname; + if (!AccountMgr::normalizeString(account_name)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + + uint32 accountid = accmgr.GetId(account_name); + if (!accountid) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + return true; + } + + return HandleBanInfoHelper(accountid,account_name.c_str()); +} + +bool ChatHandler::HandleBanInfoCharacterCommand(const char *args) +{ + Player* target; + uint64 target_guid; + if (!extractPlayerTarget((char*)args,&target,&target_guid)) + return false; + + uint32 accountid = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid); + + std::string accountname; + if (!accmgr.GetName(accountid,accountname)) + { + PSendSysMessage(LANG_BANINFO_NOCHARACTER); + return true; + } + + return HandleBanInfoHelper(accountid,accountname.c_str()); +} + +bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname) +{ + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate,banreason,bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC",accountid); + if (!result) + { + PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname); + return true; + } + + PSendSysMessage(LANG_BANINFO_BANHISTORY,accountname); + do + { + Field* fields = result->Fetch(); + + time_t unbandate = time_t(fields[3].GetUInt64()); + bool active = false; + if (fields[2].GetBool() && (fields[1].GetUInt64() == (uint64)0 ||unbandate >= time(NULL))) + active = true; + bool permanent = (fields[1].GetUInt64() == (uint64)0); + std::string bantime = permanent?GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[1].GetUInt64(), true); + PSendSysMessage(LANG_BANINFO_HISTORYENTRY, + fields[0].GetString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES):GetTrinityString(LANG_BANINFO_NO), fields[4].GetString(), fields[5].GetString()); + }while (result->NextRow()); + + return true; +} + +bool ChatHandler::HandleBanInfoIPCommand(const char *args) +{ + if (!*args) + return false; + + char* cIP = strtok ((char*)args, ""); + if (!cIP) + return false; + + if (!IsIPAddress(cIP)) + return false; + + std::string IP = cIP; + + LoginDatabase.escape_string(IP); + QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason,bannedby,unbandate-bandate FROM ip_banned WHERE ip = '%s'",IP.c_str()); + if (!result) + { + PSendSysMessage(LANG_BANINFO_NOIP); + return true; + } + + Field *fields = result->Fetch(); + bool permanent = !fields[6].GetUInt64(); + PSendSysMessage(LANG_BANINFO_IPENTRY, + fields[0].GetString(), fields[1].GetString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER):fields[2].GetString(), + permanent ? GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetString(), fields[5].GetString()); + + return true; +} + +bool ChatHandler::HandleBanListCharacterCommand(const char *args) +{ + LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); + + char* cFilter = strtok ((char*)args, " "); + if (!cFilter) + return false; + + std::string filter = cFilter; + LoginDatabase.escape_string(filter); + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"),filter.c_str()); + if (!result) + { + PSendSysMessage(LANG_BANLIST_NOCHARACTER); + return true; + } + + return HandleBanListHelper(result); +} + +bool ChatHandler::HandleBanListAccountCommand(const char *args) +{ + LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); + + char* cFilter = strtok((char*)args, " "); + std::string filter = cFilter ? cFilter : ""; + LoginDatabase.escape_string(filter); + + QueryResult_AutoPtr result; + + if (filter.empty()) + { + result = LoginDatabase.Query("SELECT account.id, username FROM account, account_banned" + " WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id"); + } + else + { + result = LoginDatabase.PQuery("SELECT account.id, username FROM account, account_banned" + " WHERE account.id = account_banned.id AND active = 1 AND username "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'")" GROUP BY account.id", + filter.c_str()); + } + + if (!result) + { + PSendSysMessage(LANG_BANLIST_NOACCOUNT); + return true; + } + + return HandleBanListHelper(result); +} + +bool ChatHandler::HandleBanListHelper(QueryResult_AutoPtr result) +{ + PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT); + + // Chat short output + if (m_session) + { + do + { + Field* fields = result->Fetch(); + uint32 accountid = fields[0].GetUInt32(); + + QueryResult_AutoPtr banresult = LoginDatabase.PQuery("SELECT account.username FROM account,account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id",accountid); + if (banresult) + { + Field* fields2 = banresult->Fetch(); + PSendSysMessage("%s",fields2[0].GetString()); + } + } while (result->NextRow()); + } + // Console wide output + else + { + SendSysMessage(LANG_BANLIST_ACCOUNTS); + SendSysMessage(" ==============================================================================="); + SendSysMessage(LANG_BANLIST_ACCOUNTS_HEADER); + do + { + SendSysMessage("-------------------------------------------------------------------------------"); + Field *fields = result->Fetch(); + uint32 account_id = fields[0].GetUInt32 (); + + std::string account_name; + + // "account" case, name can be get in same query + if (result->GetFieldCount() > 1) + account_name = fields[1].GetCppString(); + // "character" case, name need extract from another DB + else + accmgr.GetName (account_id,account_name); + + // No SQL injection. id is uint32. + QueryResult_AutoPtr banInfo = LoginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id); + if (banInfo) + { + Field *fields2 = banInfo->Fetch(); + do + { + time_t t_ban = fields2[0].GetUInt64(); + tm* aTm_ban = localtime(&t_ban); + + if (fields2[0].GetUInt64() == fields2[1].GetUInt64()) + { + PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", + account_name.c_str(),aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, + fields2[2].GetString(),fields2[3].GetString()); + } + else + { + time_t t_unban = fields2[1].GetUInt64(); + tm* aTm_unban = localtime(&t_unban); + PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", + account_name.c_str(),aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, + aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, + fields2[2].GetString(),fields2[3].GetString()); + } + }while (banInfo->NextRow()); + } + }while (result->NextRow()); + SendSysMessage(" ==============================================================================="); + } + return true; +} + +bool ChatHandler::HandleBanListIPCommand(const char *args) +{ + LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); + + char* cFilter = strtok((char*)args, " "); + std::string filter = cFilter ? cFilter : ""; + LoginDatabase.escape_string(filter); + + QueryResult_AutoPtr result; + + if (filter.empty()) + { + result = LoginDatabase.Query ("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" + " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP())" + " ORDER BY unbandate"); + } + else + { + result = LoginDatabase.PQuery("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned" + " WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP()) AND ip "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'") + " ORDER BY unbandate",filter.c_str()); + } + + if (!result) + { + PSendSysMessage(LANG_BANLIST_NOIP); + return true; + } + + PSendSysMessage(LANG_BANLIST_MATCHINGIP); + // Chat short output + if (m_session) + { + do + { + Field* fields = result->Fetch(); + PSendSysMessage("%s",fields[0].GetString()); + } while (result->NextRow()); + } + // Console wide output + else + { + SendSysMessage(LANG_BANLIST_IPS); + SendSysMessage(" ==============================================================================="); + SendSysMessage(LANG_BANLIST_IPS_HEADER); + do + { + SendSysMessage("-------------------------------------------------------------------------------"); + Field *fields = result->Fetch(); + time_t t_ban = fields[1].GetUInt64(); + tm* aTm_ban = localtime(&t_ban); + if (fields[1].GetUInt64() == fields[2].GetUInt64()) + { + PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|", + fields[0].GetString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, + fields[3].GetString(), fields[4].GetString()); + } + else + { + time_t t_unban = fields[2].GetUInt64(); + tm* aTm_unban = localtime(&t_unban); + PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|", + fields[0].GetString(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min, + aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min, + fields[3].GetString(), fields[4].GetString()); + } + }while (result->NextRow()); + SendSysMessage(" ==============================================================================="); + } + + return true; +} + +bool ChatHandler::HandleRespawnCommand(const char* /*args*/) +{ + Player* pl = m_session->GetPlayer(); + + // accept only explicitly selected target (not implicitly self targeting case) + Unit* target = getSelectedUnit(); + if (pl->GetSelection() && target) + { + if (target->GetTypeId() != TYPEID_UNIT || target->isPet()) + { + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (target->isDead()) + target->ToCreature()->Respawn(); + return true; + } + + CellPair p(Trinity::ComputeCellPair(pl->GetPositionX(), pl->GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::RespawnDo u_do; + Trinity::WorldObjectWorker worker(pl,u_do); + + TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); + cell.Visit(p, obj_worker, *pl->GetMap()); + + return true; +} + +bool ChatHandler::HandleGMFlyCommand(const char *args) +{ + if (!*args) + return false; + + Player *target = getSelectedPlayer(); + if (!target) + target = m_session->GetPlayer(); + + WorldPacket data(12); + if (strncmp(args, "on", 3) == 0) + data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); + else if (strncmp(args, "off", 4) == 0) + data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); + else + { + SendSysMessage(LANG_USE_BOL); + return false; + } + data.append(target->GetPackGUID()); + data << uint32(0); // unknown + target->SendMessageToSet(&data, true); + PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, GetNameLink(target).c_str(), args); + return true; +} + +bool ChatHandler::HandlePDumpLoadCommand(const char *args) +{ + if (!*args) + return false; + + char * file = strtok((char*)args, " "); + if (!file) + return false; + + char * account = strtok(NULL, " "); + if (!account) + return false; + + std::string account_name = account; + if (!AccountMgr::normalizeString(account_name)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + + uint32 account_id = accmgr.GetId(account_name); + if (!account_id) + { + account_id = atoi(account); // use original string + if (!account_id) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + } + + if (!accmgr.GetName(account_id,account_name)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + + char* guid_str = NULL; + char* name_str = strtok(NULL, " "); + + std::string name; + if (name_str) + { + name = name_str; + // normalize the name if specified and check if it exists + if (!normalizePlayerName(name)) + { + PSendSysMessage(LANG_INVALID_CHARACTER_NAME); + SetSentErrorMessage(true); + return false; + } + + if (ObjectMgr::CheckPlayerName(name,true) != CHAR_NAME_SUCCESS) + { + PSendSysMessage(LANG_INVALID_CHARACTER_NAME); + SetSentErrorMessage(true); + return false; + } + + guid_str = strtok(NULL, " "); + } + + uint32 guid = 0; + + if (guid_str) + { + guid = atoi(guid_str); + if (!guid) + { + PSendSysMessage(LANG_INVALID_CHARACTER_GUID); + SetSentErrorMessage(true); + return false; + } + + if (objmgr.GetPlayerAccountIdByGUID(guid)) + { + PSendSysMessage(LANG_CHARACTER_GUID_IN_USE,guid); + SetSentErrorMessage(true); + return false; + } + } + + switch(PlayerDumpReader().LoadDump(file, account_id, name, guid)) + { + case DUMP_SUCCESS: + PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS); + break; + case DUMP_FILE_OPEN_ERROR: + PSendSysMessage(LANG_FILE_OPEN_FAIL,file); + SetSentErrorMessage(true); + return false; + case DUMP_FILE_BROKEN: + PSendSysMessage(LANG_DUMP_BROKEN,file); + SetSentErrorMessage(true); + return false; + case DUMP_TOO_MANY_CHARS: + PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL,account_name.c_str(),account_id); + SetSentErrorMessage(true); + return false; + default: + PSendSysMessage(LANG_COMMAND_IMPORT_FAILED); + SetSentErrorMessage(true); + return false; + } + + return true; +} + +bool ChatHandler::HandlePDumpWriteCommand(const char *args) +{ + if (!*args) + return false; + + char* file = strtok((char*)args, " "); + char* p2 = strtok(NULL, " "); + + if (!file || !p2) + return false; + + uint32 guid; + // character name can't start from number + if (isNumeric(p2[0])) + guid = atoi(p2); + else + { + std::string name = extractPlayerNameFromLink(p2); + if (name.empty()) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + guid = objmgr.GetPlayerGUIDByName(name); + } + + if (!objmgr.GetPlayerAccountIdByGUID(guid)) + { + PSendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + switch(PlayerDumpWriter().WriteDump(file, guid)) + { + case DUMP_SUCCESS: + PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS); + break; + case DUMP_FILE_OPEN_ERROR: + PSendSysMessage(LANG_FILE_OPEN_FAIL,file); + SetSentErrorMessage(true); + return false; + default: + PSendSysMessage(LANG_COMMAND_EXPORT_FAILED); + SetSentErrorMessage(true); + return false; + } + + return true; +} + +bool ChatHandler::HandleMovegensCommand(const char* /*args*/) +{ + Unit* unit = getSelectedUnit(); + if (!unit) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"),unit->GetGUIDLow()); + + MotionMaster* mm = unit->GetMotionMaster(); + for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) + { + MovementGenerator* mg = mm->GetMotionSlot(i); + if (!mg) + { + SendSysMessage("Empty"); + continue; + } + switch(mg->GetMovementGeneratorType()) + { + case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break; + case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break; + case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break; + case ANIMAL_RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); break; + case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break; + case TARGETED_MOTION_TYPE: + { + if (unit->GetTypeId() == TYPEID_PLAYER) + { + TargetedMovementGenerator const* mgen = static_cast const*>(mg); + Unit* target = mgen->GetTarget(); + if (target) + PSendSysMessage(LANG_MOVEGENS_TARGETED_PLAYER,target->GetName(),target->GetGUIDLow()); + else + SendSysMessage(LANG_MOVEGENS_TARGETED_NULL); + } + else + { + TargetedMovementGenerator const* mgen = static_cast const*>(mg); + Unit* target = mgen->GetTarget(); + if (target) + PSendSysMessage(LANG_MOVEGENS_TARGETED_CREATURE,target->GetName(),target->GetGUIDLow()); + else + SendSysMessage(LANG_MOVEGENS_TARGETED_NULL); + } + break; + } + case HOME_MOTION_TYPE: + if (unit->GetTypeId() == TYPEID_UNIT) + { + float x,y,z; + mg->GetDestination(x,y,z); + PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE,x,y,z); + } + else + SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); + break; + case FLIGHT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FLIGHT); break; + case POINT_MOTION_TYPE: + { + float x,y,z; + mg->GetDestination(x,y,z); + PSendSysMessage(LANG_MOVEGENS_POINT,x,y,z); + break; + } + case FLEEING_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FEAR); break; + case DISTRACT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_DISTRACT); break; + default: + PSendSysMessage(LANG_MOVEGENS_UNKNOWN,mg->GetMovementGeneratorType()); + break; + } + } + return true; +} + +bool ChatHandler::HandleServerPLimitCommand(const char *args) +{ + if (*args) + { + char* param = strtok((char*)args, " "); + if (!param) + return false; + + int l = strlen(param); + + if (strncmp(param,"player",l) == 0) + sWorld.SetPlayerSecurityLimit(SEC_PLAYER); + else if (strncmp(param,"moderator",l) == 0) + sWorld.SetPlayerSecurityLimit(SEC_MODERATOR); + else if (strncmp(param,"gamemaster",l) == 0) + sWorld.SetPlayerSecurityLimit(SEC_GAMEMASTER); + else if (strncmp(param,"administrator",l) == 0) + sWorld.SetPlayerSecurityLimit(SEC_ADMINISTRATOR); + else if (strncmp(param,"reset",l) == 0) + sWorld.SetPlayerLimit(sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT)); + else + { + int val = atoi(param); + if (val < 0) + sWorld.SetPlayerSecurityLimit(AccountTypes(uint32(-val))); + else + sWorld.SetPlayerLimit(val); + } + + // kick all low security level players + if (sWorld.GetPlayerSecurityLimit() > SEC_PLAYER) + sWorld.KickAllLess(sWorld.GetPlayerSecurityLimit()); + } + + uint32 pLimit = sWorld.GetPlayerAmountLimit(); + AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit(); + char const* secName = ""; + switch(allowedAccountType) + { + case SEC_PLAYER: secName = "Player"; break; + case SEC_MODERATOR: secName = "Moderator"; break; + case SEC_GAMEMASTER: secName = "Gamemaster"; break; + case SEC_ADMINISTRATOR: secName = "Administrator"; break; + default: secName = ""; break; + } + + PSendSysMessage("Player limits: amount %u, min. security level %s.",pLimit,secName); + + return true; +} + +bool ChatHandler::HandleCastCommand(const char *args) +{ + if (!*args) + return false; + + Unit* target = getSelectedUnit(); + + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spell = extractSpellIdFromLink((char*)args); + if (!spell) + return false; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); + if (!spellInfo) + { + PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + SetSentErrorMessage(true); + return false; + } + + if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer())) + { + PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell); + SetSentErrorMessage(true); + return false; + } + + char* trig_str = strtok(NULL, " "); + if (trig_str) + { + int l = strlen(trig_str); + if (strncmp(trig_str,"triggered",l) != 0) + return false; + } + + bool triggered = (trig_str != NULL); + + m_session->GetPlayer()->CastSpell(target,spell,triggered); + + return true; +} + +bool ChatHandler::HandleCastBackCommand(const char *args) +{ + Creature* caster = getSelectedCreature(); + + if (!caster) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spell = extractSpellIdFromLink((char*)args); + if (!spell || !sSpellStore.LookupEntry(spell)) + { + PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + SetSentErrorMessage(true); + return false; + } + + char* trig_str = strtok(NULL, " "); + if (trig_str) + { + int l = strlen(trig_str); + if (strncmp(trig_str,"triggered",l) != 0) + return false; + } + + bool triggered = (trig_str != NULL); + + caster->SetFacingToObject(m_session->GetPlayer()); + + caster->CastSpell(m_session->GetPlayer(),spell,triggered); + + return true; +} + +bool ChatHandler::HandleCastDistCommand(const char *args) +{ + if (!*args) + return false; + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spell = extractSpellIdFromLink((char*)args); + if (!spell) + return false; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); + if (!spellInfo) + { + PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + SetSentErrorMessage(true); + return false; + } + + if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer())) + { + PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell); + SetSentErrorMessage(true); + return false; + } + + char *distStr = strtok(NULL, " "); + + float dist = 0; + + if (distStr) + sscanf(distStr, "%f", &dist); + + char* trig_str = strtok(NULL, " "); + if (trig_str) + { + int l = strlen(trig_str); + if (strncmp(trig_str,"triggered",l) != 0) + return false; + } + + bool triggered = (trig_str != NULL); + + float x,y,z; + m_session->GetPlayer()->GetClosePoint(x,y,z,dist); + + m_session->GetPlayer()->CastSpell(x,y,z,spell,triggered); + return true; +} + +bool ChatHandler::HandleCastTargetCommand(const char *args) +{ + Creature* caster = getSelectedCreature(); + + if (!caster) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + if (!caster->getVictim()) + { + SendSysMessage(LANG_SELECTED_TARGET_NOT_HAVE_VICTIM); + SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spell = extractSpellIdFromLink((char*)args); + if (!spell || !sSpellStore.LookupEntry(spell)) + { + PSendSysMessage(LANG_COMMAND_NOSPELLFOUND); + SetSentErrorMessage(true); + return false; + } + + char* trig_str = strtok(NULL, " "); + if (trig_str) + { + int l = strlen(trig_str); + if (strncmp(trig_str,"triggered",l) != 0) + return false; + } + + bool triggered = (trig_str != NULL); + + caster->SetFacingToObject(m_session->GetPlayer()); + + caster->CastSpell(caster->getVictim(),spell,triggered); + + return true; +} + +/* +ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator +Without this function 3rd party scripting library will get linking errors (unresolved external) +when attempting to use the PointMovementGenerator +*/ +bool ChatHandler::HandleComeToMeCommand(const char *args) +{ + char* newFlagStr = strtok((char*)args, " "); + + if (!newFlagStr) + return false; + + uint32 newFlags = (uint32)strtoul(newFlagStr, NULL, 0); + + Creature* caster = getSelectedCreature(); + if (!caster) + { + m_session->GetPlayer()->SetUnitMovementFlags(newFlags); + SendSysMessage(LANG_SELECT_CREATURE); + SetSentErrorMessage(true); + return false; + } + + caster->SetUnitMovementFlags(newFlags); + + Player* pl = m_session->GetPlayer(); + + caster->GetMotionMaster()->MovePoint(0, pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ()); + return true; +} + +bool ChatHandler::HandleCastSelfCommand(const char *args) +{ + if (!*args) + return false; + + Unit* target = getSelectedUnit(); + + if (!target) + { + SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); + SetSentErrorMessage(true); + return false; + } + + // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form + uint32 spell = extractSpellIdFromLink((char*)args); + if (!spell) + return false; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); + if (!spellInfo) + return false; + + if (!SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer())) + { + PSendSysMessage(LANG_COMMAND_SPELL_BROKEN,spell); + SetSentErrorMessage(true); + return false; + } + + target->CastSpell(target,spell,false); + + return true; +} + +std::string GetTimeString(uint32 time) +{ + uint16 days = time / DAY, hours = (time % DAY) / HOUR, minute = (time % HOUR) / MINUTE; + std::ostringstream ss; + if (days) ss << days << "d "; + if (hours) ss << hours << "h "; + ss << minute << "m"; + return ss.str(); +} + +bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) +{ + Player* player = getSelectedPlayer(); + if (!player) player = m_session->GetPlayer(); + uint32 counter = 0; + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); + for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) + { + InstanceSave *save = itr->second.save; + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + counter++; + } + } + PSendSysMessage("player binds: %d", counter); + counter = 0; + Group *group = player->GetGroup(); + if (group) + { + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i)); + for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) + { + InstanceSave *save = itr->second.save; + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); counter++; + } + } + } + PSendSysMessage("group binds: %d", counter); + + return true; +} + +bool ChatHandler::HandleInstanceUnbindCommand(const char *args) +{ + if (!*args) + return false; + + std::string cmd = args; + if (cmd == "all") + { + Player* player = getSelectedPlayer(); + if (!player) player = m_session->GetPlayer(); + uint32 counter = 0; + for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { + Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); + for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) + { + if (itr->first != player->GetMapId()) + { + InstanceSave *save = itr->second.save; + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + player->UnbindInstance(itr, Difficulty(i)); + counter++; + } + else + ++itr; + } + } + PSendSysMessage("instances unbound: %d", counter); + } + return true; +} + +bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/) +{ + PSendSysMessage("instances loaded: %d", sMapMgr.GetNumInstances()); + PSendSysMessage("players in instances: %d", sMapMgr.GetNumPlayersInInstances()); + PSendSysMessage("instance saves: %d", sInstanceSaveManager.GetNumInstanceSaves()); + PSendSysMessage("players bound: %d", sInstanceSaveManager.GetNumBoundPlayersTotal()); + PSendSysMessage("groups bound: %d", sInstanceSaveManager.GetNumBoundGroupsTotal()); + return true; +} + +bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/) +{ + Player* pl = m_session->GetPlayer(); + + Map* map = pl->GetMap(); + if (!map->IsDungeon()) + { + PSendSysMessage("Map is not a dungeon."); + SetSentErrorMessage(true); + return false; + } + + if (!((InstanceMap*)map)->GetInstanceData()) + { + PSendSysMessage("Map has no instance data."); + SetSentErrorMessage(true); + return false; + } + + ((InstanceMap*)map)->GetInstanceData()->SaveToDB(); + return true; +} + +bool ChatHandler::HandleInstanceOpenCommand(const char *args) +{ + return HandleInstanceOpenCloseCommand(args,true); +} + +bool ChatHandler::HandleInstanceCloseCommand(const char *args) +{ + return HandleInstanceOpenCloseCommand(args,false); +} + +bool ChatHandler::HandleInstanceOpenCloseCommand(const char *args,bool open) +{ + char *mapIdStr; + char *instanceModeStr; + extractOptFirstArg((char*)args,&mapIdStr,&instanceModeStr); + if (!mapIdStr || !instanceModeStr) + return false; + + uint32 mapid = atoi(mapIdStr); + + InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid); + if (!instance) + { + PSendSysMessage("Invalid map id"); + SetSentErrorMessage(true); + return false; + } + + uint8 status = objmgr.GetAccessRequirement(instance->access_id)->status; + uint8 flag = 0; + + const MapEntry *entry = sMapStore.LookupEntry(mapid); + if (!entry) + return false; + + if (entry->IsDungeon()) + { + if (strcmp(instanceModeStr,"normal")) + flag = DUNGEON_STATUSFLAG_NORMAL; + else if (strcmp(instanceModeStr,"heroic")) + flag = DUNGEON_STATUSFLAG_HEROIC; + else if (strcmp(instanceModeStr,"all")) + flag = DUNGEON_STATUSFLAG_NORMAL & DUNGEON_STATUSFLAG_HEROIC; + else + { + PSendSysMessage("Unrecognized difficulty string"); + SetSentErrorMessage(true); + return false; + } + } + + else if (entry->IsRaid()) + { + if (strcmp(instanceModeStr,"normal")) + flag = RAID_STATUSFLAG_10MAN_NORMAL & RAID_STATUSFLAG_25MAN_NORMAL; + else if (strcmp(instanceModeStr,"heroic")) + flag = RAID_STATUSFLAG_10MAN_HEROIC & RAID_STATUSFLAG_25MAN_HEROIC; + else if (strcmp(instanceModeStr,"10man")) + flag = RAID_STATUSFLAG_10MAN_NORMAL & RAID_STATUSFLAG_10MAN_HEROIC; + else if (strcmp(instanceModeStr,"25man")) + flag = RAID_STATUSFLAG_25MAN_NORMAL & RAID_STATUSFLAG_25MAN_HEROIC; + else if (strcmp(instanceModeStr,"heroic")) + flag = RAID_STATUSFLAG_10MAN_HEROIC & RAID_STATUSFLAG_25MAN_HEROIC; + else if (strcmp(instanceModeStr,"10normal")) + flag = DUNGEON_STATUSFLAG_NORMAL; + else if (strcmp(instanceModeStr,"25normal")) + flag = DUNGEON_STATUSFLAG_HEROIC; + else if (strcmp(instanceModeStr,"10heroic")) + flag = RAID_STATUSFLAG_10MAN_HEROIC; + else if (strcmp(instanceModeStr,"25heroic")) + flag = RAID_STATUSFLAG_25MAN_HEROIC; + else if (strcmp(instanceModeStr,"all")) + flag = RAID_STATUSFLAG_10MAN_NORMAL & RAID_STATUSFLAG_10MAN_HEROIC & RAID_STATUSFLAG_25MAN_NORMAL & RAID_STATUSFLAG_25MAN_HEROIC; + else + { + PSendSysMessage("Unrecognized difficulty string"); + SetSentErrorMessage(true); + return false; + } + } + else + { + PSendSysMessage("Map is not a dungeon/raid"); + SetSentErrorMessage(true); + return false; + } + + if (open) + status |= flag; + else + status &= ~flag; + + WorldDatabase.PExecute("UPDATE access_requirement SET status = '%u' WHERE id = '%u'", status, instance->access_id); + PSendSysMessage("Instance status changed. Don't forget to reload access_requirement table"); + return true; +} + +/// Display the list of GMs +bool ChatHandler::HandleGMListFullCommand(const char* /*args*/) +{ + ///- Get the accounts with GM Level >0 + QueryResult_AutoPtr result = LoginDatabase.Query("SELECT a.username,aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel > 0"); + if (result) + { + SendSysMessage(LANG_GMLIST); + SendSysMessage(" ======================== "); + SendSysMessage(LANG_GMLIST_HEADER); + SendSysMessage(" ======================== "); + + ///- Circle through them. Display username and GM level + do + { + Field *fields = result->Fetch(); + PSendSysMessage("|%15s|%6s|", fields[0].GetString(),fields[1].GetString()); + }while (result->NextRow()); + + PSendSysMessage(" ======================== "); + } + else + PSendSysMessage(LANG_GMLIST_EMPTY); + return true; +} + +/// Define the 'Message of the day' for the realm +bool ChatHandler::HandleServerSetMotdCommand(const char *args) +{ + sWorld.SetMotd(args); + PSendSysMessage(LANG_MOTD_NEW, args); + return true; +} + +/// Set whether we accept new clients +bool ChatHandler::HandleServerSetClosedCommand(const char *args) +{ + std::string arg = args; + + if (strncmp(args, "on", 3) == 0) + { + SendSysMessage(LANG_WORLD_CLOSED); + sWorld.SetClosed(true); + return true; + } + else if (strncmp(args, "off", 4) == 0) + { + SendSysMessage(LANG_WORLD_OPENED); + sWorld.SetClosed(false); + return true; + } + + SendSysMessage(LANG_USE_BOL); + SetSentErrorMessage(true); + return false; +} + +/// Set/Unset the expansion level for an account +bool ChatHandler::HandleAccountSetAddonCommand(const char *args) +{ + ///- Get the command line arguments + char *szAcc = strtok((char*)args," "); + char *szExp = strtok(NULL," "); + + if (!szAcc) + return false; + + std::string account_name; + uint32 account_id; + + if (!szExp) + { + Player* player = getSelectedPlayer(); + if (!player) + return false; + + account_id = player->GetSession()->GetAccountId(); + accmgr.GetName(account_id,account_name); + szExp = szAcc; + } + else + { + ///- Convert Account name to Upper Format + account_name = szAcc; + if (!AccountMgr::normalizeString(account_name)) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + + account_id = accmgr.GetId(account_name); + if (!account_id) + { + PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); + SetSentErrorMessage(true); + return false; + } + + } + + // Let set addon state only for lesser (strong) security level + // or to self account + if (m_session && m_session->GetAccountId () != account_id && + HasLowerSecurityAccount (NULL,account_id,true)) + return false; + + int expansion = atoi(szExp); //get int anyway (0 if error) + if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION)) + return false; + + // No SQL injection + LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",expansion,account_id); + PSendSysMessage(LANG_ACCOUNT_SETADDON,account_name.c_str(),account_id,expansion); + return true; +} + +//Send items by mail +bool ChatHandler::HandleSendItemsCommand(const char *args) +{ + // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12] + Player* receiver; + uint64 receiver_guid; + std::string receiver_name; + if (!extractPlayerTarget((char*)args,&receiver,&receiver_guid,&receiver_name)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char* msgSubject = extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char* msgText = extractQuotedArg(tail2); + if (!msgText) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // extract items + typedef std::pair ItemPair; + typedef std::list< ItemPair > ItemPairs; + ItemPairs items; + + // get all tail string + char* tail = strtok(NULL, ""); + + // get from tail next item str + while (char* itemStr = strtok(tail, " ")) + { + // and get new tail + tail = strtok(NULL, ""); + + // parse item str + char* itemIdStr = strtok(itemStr, ":"); + char* itemCountStr = strtok(NULL, " "); + + uint32 item_id = atoi(itemIdStr); + if (!item_id) + return false; + + ItemPrototype const* item_proto = objmgr.GetItemPrototype(item_id); + if (!item_proto) + { + PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id); + SetSentErrorMessage(true); + return false; + } + + uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1; + if (item_count < 1 || (item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount))) + { + PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count,item_id); + SetSentErrorMessage(true); + return false; + } + + while (item_count > item_proto->GetMaxStackSize()) + { + items.push_back(ItemPair(item_id,item_proto->GetMaxStackSize())); + item_count -= item_proto->GetMaxStackSize(); + } + + items.push_back(ItemPair(item_id,item_count)); + + if (items.size() > MAX_MAIL_ITEMS) + { + PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS); + SetSentErrorMessage(true); + return false; + } + } + + // from console show not existed sender + MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + // fill mail + MailDraft draft(subject, text); + + for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr) + { + if (Item* item = Item::CreateItem(itr->first,itr->second,m_session ? m_session->GetPlayer() : 0)) + { + item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted + draft.AddItem(item); + } + } + + draft.SendMailTo(MailReceiver(receiver,GUID_LOPART(receiver_guid)), sender); + + std::string nameLink = playerLink(receiver_name); + PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; +} + +///Send money by mail +bool ChatHandler::HandleSendMoneyCommand(const char *args) +{ + /// format: name "subject text" "mail text" money + + Player* receiver; + uint64 receiver_guid; + std::string receiver_name; + if (!extractPlayerTarget((char*)args,&receiver,&receiver_guid,&receiver_name)) + return false; + + char* tail1 = strtok(NULL, ""); + if (!tail1) + return false; + + char* msgSubject = extractQuotedArg(tail1); + if (!msgSubject) + return false; + + char* tail2 = strtok(NULL, ""); + if (!tail2) + return false; + + char* msgText = extractQuotedArg(tail2); + if (!msgText) + return false; + + char* money_str = strtok(NULL, ""); + int32 money = money_str ? atoi(money_str) : 0; + if (money <= 0) + return false; + + // msgSubject, msgText isn't NUL after prev. check + std::string subject = msgSubject; + std::string text = msgText; + + // from console show not existed sender + MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM); + + MailDraft(subject, text) + .AddMoney(money) + .SendMailTo(MailReceiver(receiver,GUID_LOPART(receiver_guid)),sender); + + std::string nameLink = playerLink(receiver_name); + PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str()); + return true; +} + +/// Send a message to a player in game +bool ChatHandler::HandleSendMessageCommand(const char *args) +{ + ///- Find the player + Player *rPlayer; + if (!extractPlayerTarget((char*)args, &rPlayer)) + return false; + + char* msg_str = strtok(NULL, ""); + if (!msg_str) + return false; + + ///- Check that he is not logging out. + if (rPlayer->GetSession()->isLogingOut()) + { + SendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + ///- Send the message + //Use SendAreaTriggerMessage for fastest delivery. + rPlayer->GetSession()->SendAreaTriggerMessage("%s", msg_str); + rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r"); + + //Confirmation message + std::string nameLink = GetNameLink(rPlayer); + PSendSysMessage(LANG_SENDMESSAGE,nameLink.c_str(),msg_str); + return true; +} + +bool ChatHandler::HandleFlushArenaPointsCommand(const char * /*args*/) +{ + sBattleGroundMgr.DistributeArenaPoints(); + return true; +} + +bool ChatHandler::HandleModifyGenderCommand(const char *args) +{ + if (!*args) + return false; + + Player *player = getSelectedPlayer(); + + if (!player) + { + PSendSysMessage(LANG_PLAYER_NOT_FOUND); + SetSentErrorMessage(true); + return false; + } + + PlayerInfo const* info = objmgr.GetPlayerInfo(player->getRace(), player->getClass()); + if (!info) + return false; + + char const* gender_str = (char*)args; + int gender_len = strlen(gender_str); + + Gender gender; + + if (!strncmp(gender_str, "male", gender_len)) // MALE + { + if (player->getGender() == GENDER_MALE) + return true; + + gender = GENDER_MALE; + } + else if (!strncmp(gender_str, "female", gender_len)) // FEMALE + { + if (player->getGender() == GENDER_FEMALE) + return true; + + gender = GENDER_FEMALE; + } + else + { + SendSysMessage(LANG_MUST_MALE_OR_FEMALE); + SetSentErrorMessage(true); + return false; + } + + // Set gender + player->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender); + player->SetByteValue(PLAYER_BYTES_3, 0, gender); + + // Change display ID + player->InitDisplayIds(); + + char const* gender_full = gender ? "female" : "male"; + + PSendSysMessage(LANG_YOU_CHANGE_GENDER, GetNameLink(player).c_str(), gender_full); + + if (needReportToTarget(player)) + ChatHandler(player).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, GetNameLink().c_str()); + + return true; +} + +bool ChatHandler::HandleChannelSetPublic(const char *args) +{ + if (!*args) + return false; + std::string channel = strtok((char*)args, " "); + uint32 val = atoi((char*)args); + + if (val) + { + CharacterDatabase.PExecute("UPDATE channels SET m_public = 1 WHERE m_name LIKE '%s'", channel.c_str()); + val = 1; + } + else + { + CharacterDatabase.PExecute("UPDATE channels SET m_public = 0 WHERE m_name LIKE '%s'", channel.c_str()); + val = 0; + } + + PSendSysMessage(LANG_CHANNEL_PUBLIC_CHANGED, channel.c_str(), val); + + return true; +} + + +/*------------------------------------------ + *-------------TRINITY---------------------- + *-------------------------------------*/ + +bool ChatHandler::HandlePlayAllCommand(const char *args) +{ + if (!*args) + return false; + + uint32 soundId = atoi((char*)args); + + if (!sSoundEntriesStore.LookupEntry(soundId)) + { + PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId); + SetSentErrorMessage(true); + return false; + } + + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(soundId) << m_session->GetPlayer()->GetGUID(); + sWorld.SendGlobalMessage(&data); + + PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId); + return true; +} + +bool ChatHandler::HandleFreezeCommand(const char *args) +{ + std::string name; + Player *player; + char *TargetName = strtok((char*)args, " "); //get entered name + if (!TargetName) //if no name entered use target + { + player = getSelectedPlayer(); + if (player) //prevent crash with creature as target + { + name = player->GetName(); + normalizePlayerName(name); + } + } + else // if name entered + { + name = TargetName; + normalizePlayerName(name); + player = objmgr.GetPlayer(name.c_str()); //get player by name + } + + if (!player) + { + SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + + if (player == m_session->GetPlayer()) + { + SendSysMessage(LANG_COMMAND_FREEZE_ERROR); + return true; + } + + //effect + if (player && player != m_session->GetPlayer()) + { + PSendSysMessage(LANG_COMMAND_FREEZE,name.c_str()); + + //stop combat + make player unattackable + duel stop + stop some spells + player->setFaction(35); + player->CombatStop(); + if (player->IsNonMeleeSpellCasted(true)) + player->InterruptNonMeleeSpells(true); + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + player->SetUInt32Value(PLAYER_DUEL_TEAM, 1); + + //if player class = hunter || warlock remove pet if alive + if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) + { + if (Pet *pet = player->GetPet()) + { + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + // not let dismiss dead pet + if (pet && pet->isAlive()) + player->RemovePet(pet,PET_SAVE_NOT_IN_SLOT); + } + } + + //m_session->GetPlayer()->CastSpell(player,spellID,false); + if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(9454)) + Aura::TryCreate(spellInfo, player, player); + + //save player + player->SaveToDB(); + } + return true; +} + +bool ChatHandler::HandleUnFreezeCommand(const char *args) +{ + std::string name; + Player *player; + char *TargetName = strtok((char*)args, " "); //get entered name + if (!TargetName) //if no name entered use target + { + player = getSelectedPlayer(); + if (player) //prevent crash with creature as target + name = player->GetName(); + } + + else // if name entered + { + name = TargetName; + normalizePlayerName(name); + player = objmgr.GetPlayer(name.c_str()); //get player by name + } + + //effect + if (player) + { + PSendSysMessage(LANG_COMMAND_UNFREEZE,name.c_str()); + + //Reset player faction + allow combat + allow duels + player->setFactionForRace(player->getRace()); + player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + //allow movement and spells + player->RemoveAurasDueToSpell(9454); + + //save player + player->SaveToDB(); + } + + if (!player) + { + if (TargetName) + { + //check for offline players + QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT characters.guid FROM characters WHERE characters.name = '%s'",name.c_str()); + if (!result) + { + SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + //if player found: delete his freeze aura + Field *fields=result->Fetch(); + uint64 pguid = fields[0].GetUInt64(); + + CharacterDatabase.PQuery("DELETE FROM character_aura WHERE character_aura.spell = 9454 AND character_aura.guid = '%u'",pguid); + PSendSysMessage(LANG_COMMAND_UNFREEZE,name.c_str()); + return true; + } + else + { + SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + } + + return true; +} + +bool ChatHandler::HandleListFreezeCommand(const char * /*args*/) +{ + //Get names from DB + QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT characters.name FROM characters LEFT JOIN character_aura ON (characters.guid = character_aura.guid) WHERE character_aura.spell = 9454"); + if (!result) + { + SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS); + return true; + } + //Header of the names + PSendSysMessage(LANG_COMMAND_LIST_FREEZE); + + //Output of the results + do + { + Field *fields = result->Fetch(); + std::string fplayers = fields[0].GetCppString(); + PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS,fplayers.c_str()); + } while (result->NextRow()); + + return true; +} + +bool ChatHandler::HandleGroupLeaderCommand(const char *args) +{ + Player* plr = NULL; + Group* group = NULL; + uint64 guid = 0; + char* cname = strtok((char*)args, " "); + + if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid)) + if (group && group->GetLeaderGUID() != guid) + group->ChangeLeader(guid); + + return true; +} + +bool ChatHandler::HandleGroupDisbandCommand(const char *args) +{ + Player* plr = NULL; + Group* group = NULL; + uint64 guid = 0; + char* cname = strtok((char*)args, " "); + + if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid)) + if (group) + group->Disband(); + + return true; +} + +bool ChatHandler::HandleGroupRemoveCommand(const char *args) +{ + Player* plr = NULL; + Group* group = NULL; + uint64 guid = 0; + char* cname = strtok((char*)args, " "); + + if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid, true)) + if (group) + group->RemoveMember(guid, 0); + + return true; +} + +bool ChatHandler::HandlePossessCommand(const char * /*args*/) +{ + Unit *pUnit = getSelectedUnit(); + if (!pUnit) + return false; + + m_session->GetPlayer()->CastSpell(pUnit, 530, true); + return true; +} + +bool ChatHandler::HandleUnPossessCommand(const char * /*args*/) +{ + Unit *pUnit = getSelectedUnit(); + if (!pUnit) + pUnit = m_session->GetPlayer(); + + pUnit->RemoveCharmAuras(); + + return true; +} + +bool ChatHandler::HandleBindSightCommand(const char * /*args*/) +{ + Unit *pUnit = getSelectedUnit(); + if (!pUnit) + return false; + + m_session->GetPlayer()->CastSpell(pUnit, 6277, true); + return true; +} + +bool ChatHandler::HandleUnbindSightCommand(const char * /*args*/) +{ + if (m_session->GetPlayer()->isPossessing()) + return false; + + m_session->GetPlayer()->StopCastingBindSight(); + return true; +} diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp new file mode 100644 index 0000000..b107b35 --- /dev/null +++ b/src/server/game/Combat/HostileRefManager.cpp @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "HostileRefManager.h" +#include "ThreatManager.h" +#include "Unit.h" +#include "DBCStructure.h" +#include "SpellMgr.h" + +HostileRefManager::~HostileRefManager() +{ + deleteReferences(); +} + +//================================================= +// send threat to all my hateres for the pVictim +// The pVictim is hated than by them as well +// use for buffs and healing threat functionality + +void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget) +{ + HostileReference* ref; + + float size = pSingleTarget ? 1.0f : getSize(); // if pSingleTarget do not divide threat + ref = getFirst(); + while (ref != NULL) + { + float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell); + if (pVictim == getOwner()) + ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible + else + ref->getSource()->addThreat(pVictim, threat / size); + ref = ref->next(); + } +} + +//================================================= + +void HostileRefManager::addTempThreat(float fThreat, bool apply) +{ + HostileReference* ref = getFirst(); + + while (ref != NULL) + { + if (apply) + { + if (ref->getTempThreatModifier() == 0.0f) + ref->addTempThreat(fThreat); + } + else + ref->resetTempThreat(); + + ref = ref->next(); + } +} + + +//================================================= + +void HostileRefManager::addThreatPercent(int32 iPercent) +{ + HostileReference* ref; + + ref = getFirst(); + while (ref != NULL) + { + ref->addThreatPercent(iPercent); + ref = ref->next(); + } +} + +//================================================= +// The online / offline status is given to the method. The calculation has to be done before + +void HostileRefManager::setOnlineOfflineState(bool bIsOnline) +{ + HostileReference* ref; + + ref = getFirst(); + while (ref != NULL) + { + ref->setOnlineOfflineState(bIsOnline); + ref = ref->next(); + } +} + +//================================================= +// The online / offline status is calculated and set + +void HostileRefManager::updateThreatTables() +{ + HostileReference* ref = getFirst(); + while (ref && ref->next()) + { + ref->updateOnlineStatus(); + ref = ref->next(); + } +} + +//================================================= +// The references are not needed anymore +// tell the source to remove them from the list and free the mem + +void HostileRefManager::deleteReferences() +{ + HostileReference* ref = getFirst(); + while (ref) + { + HostileReference* nextRef = ref->next(); + ref->removeReference(); + delete ref; + ref = nextRef; + } +} + +//================================================= +// delete one reference, defined by faction + +void HostileRefManager::deleteReferencesForFaction(uint32 faction) +{ + HostileReference* ref = getFirst(); + while (ref) + { + HostileReference* nextRef = ref->next(); + if (ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction) + { + ref->removeReference(); + delete ref; + } + ref = nextRef; + } +} + +//================================================= +// delete one reference, defined by Unit + +void HostileRefManager::deleteReference(Unit *pCreature) +{ + HostileReference* ref = getFirst(); + while (ref) + { + HostileReference* nextRef = ref->next(); + if (ref->getSource()->getOwner() == pCreature) + { + ref->removeReference(); + delete ref; + break; + } + ref = nextRef; + } +} + +//================================================= +// set state for one reference, defined by Unit + +void HostileRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline) +{ + HostileReference* ref = getFirst(); + while (ref) + { + HostileReference* nextRef = ref->next(); + if (ref->getSource()->getOwner() == pCreature) + { + ref->setOnlineOfflineState(bIsOnline); + break; + } + ref = nextRef; + } +} + +//================================================= + diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h new file mode 100644 index 0000000..0a240ad --- /dev/null +++ b/src/server/game/Combat/HostileRefManager.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _HOSTILEREFMANAGER +#define _HOSTILEREFMANAGER + +#include "Common.h" +#include "RefManager.h" + +class Unit; +class ThreatManager; +class HostileReference; +struct SpellEntry; + +//================================================= + +class HostileRefManager : public RefManager +{ + private: + Unit *iOwner; + public: + explicit HostileRefManager(Unit *pOwner) { iOwner = pOwner; } + ~HostileRefManager(); + + Unit* getOwner() { return iOwner; } + + // send threat to all my hateres for the pVictim + // The pVictim is hated than by them as well + // use for buffs and healing threat functionality + void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false); + + void addTempThreat(float fThreat, bool apply); + + void addThreatPercent(int32 iPercent); + + // The references are not needed anymore + // tell the source to remove them from the list and free the mem + void deleteReferences(); + + // Remove specific faction references + void deleteReferencesForFaction(uint32 faction); + + HostileReference* getFirst() { return ((HostileReference*) RefManager::getFirst()); } + + void updateThreatTables(); + + void setOnlineOfflineState(bool bIsOnline); + + // set state for one reference, defined by Unit + void setOnlineOfflineState(Unit *pCreature, bool bIsOnline); + + // delete one reference, defined by Unit + void deleteReference(Unit *pCreature); +}; +//================================================= +#endif + diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp new file mode 100644 index 0000000..fbf5a80 --- /dev/null +++ b/src/server/game/Combat/ThreatManager.cpp @@ -0,0 +1,558 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "ThreatManager.h" +#include "Unit.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "Map.h" +#include "Player.h" +#include "ObjectAccessor.h" +#include "UnitEvents.h" +#include "SpellAuras.h" + +//============================================================== +//================= ThreatCalcHelper =========================== +//============================================================== + +// The pHatingUnit is not used yet +float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell) +{ + if (pThreatSpell) + { + if (pThreatSpell->AttributesEx & SPELL_ATTR_EX_NO_THREAT) + return 0.0f; + + if (Player* modOwner = pHatedUnit->GetSpellModOwner()) + modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, fThreat); + } + + return pHatedUnit->ApplyTotalThreatModifier(fThreat, schoolMask); +} + +//============================================================ +//================= HostileReference ========================== +//============================================================ + +HostileReference::HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat) +{ + iThreat = fThreat; + iTempThreatModifier = 0.0f; + link(pUnit, pThreatManager); + iUnitGuid = pUnit->GetGUID(); + iOnline = true; + iAccessible = true; +} + +//============================================================ +// Tell our refTo (target) object that we have a link +void HostileReference::targetObjectBuildLink() +{ + getTarget()->addHatedBy(this); +} + +//============================================================ +// Tell our refTo (taget) object, that the link is cut +void HostileReference::targetObjectDestroyLink() +{ + getTarget()->removeHatedBy(this); +} + +//============================================================ +// Tell our refFrom (source) object, that the link is cut (Target destroyed) + +void HostileReference::sourceObjectDestroyLink() +{ + setOnlineOfflineState(false); +} + +//============================================================ +// Inform the source, that the status of the reference changed + +void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent) +{ + if (getSource()) + getSource()->processThreatEvent(&pThreatRefStatusChangeEvent); +} + +//============================================================ + +void HostileReference::addThreat(float fModThreat) +{ + iThreat += fModThreat; + // the threat is changed. Source and target unit have to be available + // if the link was cut before relink it again + if (!isOnline()) + updateOnlineStatus(); + if (fModThreat != 0.0f) + { + ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, fModThreat); + fireStatusChanged(event); + } + + if (isValid() && fModThreat >= 0.0f) + { + Unit* victim_owner = getTarget()->GetCharmerOrOwner(); + if (victim_owner && victim_owner->isAlive()) + getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks + } +} + +//============================================================ +// check, if source can reach target and set the status + +void HostileReference::updateOnlineStatus() +{ + bool online = false; + bool accessible = false; + + if (!isValid()) + if (Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid())) + link(target, getSource()); + + // only check for online status if + // ref is valid + // target is no player or not gamemaster + // target is not in flight + if (isValid() && + ((getTarget()->GetTypeId() != TYPEID_PLAYER || !((Player*)getTarget())->isGameMaster()) || + !getTarget()->hasUnitState(UNIT_STAT_IN_FLIGHT))) + { + Creature* creature = getSourceUnit()->ToCreature(); + online = getTarget()->isInAccessiblePlaceFor(creature); + if (!online) + { + if (creature->IsWithinCombatRange(getTarget(), creature->m_CombatDistance)) + online = true; // not accessible but stays online + } + else + accessible = true; + + } + setAccessibleState(accessible); + setOnlineOfflineState(online); +} + +//============================================================ +// set the status and fire the event on status change + +void HostileReference::setOnlineOfflineState(bool pIsOnline) +{ + if (iOnline != pIsOnline) + { + iOnline = pIsOnline; + if (!iOnline) + setAccessibleState(false); // if not online that not accessable as well + + ThreatRefStatusChangeEvent event(UEV_THREAT_REF_ONLINE_STATUS, this); + fireStatusChanged(event); + } +} + +//============================================================ + +void HostileReference::setAccessibleState(bool pIsAccessible) +{ + if (iAccessible != pIsAccessible) + { + iAccessible = pIsAccessible; + + ThreatRefStatusChangeEvent event(UEV_THREAT_REF_ASSECCIBLE_STATUS, this); + fireStatusChanged(event); + } +} + +//============================================================ +// prepare the reference for deleting +// this is called be the target + +void HostileReference::removeReference() +{ + invalidate(); + + ThreatRefStatusChangeEvent event(UEV_THREAT_REF_REMOVE_FROM_LIST, this); + fireStatusChanged(event); +} + +//============================================================ + +Unit* HostileReference::getSourceUnit() +{ + return (getSource()->getOwner()); +} + +//============================================================ +//================ ThreatContainer =========================== +//============================================================ + +void ThreatContainer::clearReferences() +{ + for (std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) + { + (*i)->unlink(); + delete (*i); + } + iThreatList.clear(); +} + +//============================================================ +// Return the HostileReference of NULL, if not found +HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) +{ + HostileReference* result = NULL; + + uint64 guid = pVictim->GetGUID(); + for (std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) + { + if ((*i)->getUnitGuid() == guid) + { + result = (*i); + break; + } + } + + return result; +} + +//============================================================ +// Add the threat, if we find the reference + +HostileReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat) +{ + HostileReference* ref = getReferenceByTarget(pVictim); + if (ref) + ref->addThreat(fThreat); + return ref; +} + +//============================================================ + +void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 iPercent) +{ + if (HostileReference* ref = getReferenceByTarget(pVictim)) + ref->addThreatPercent(iPercent); +} + +//============================================================ +// Check if the list is dirty and sort if necessary + +void ThreatContainer::update() +{ + if (iDirty && iThreatList.size() >1) + { + iThreatList.sort(Trinity::ThreatOrderPred()); + } + iDirty = false; +} + +//============================================================ +// return the next best victim +// could be the current victim + +HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim) +{ + HostileReference* currentRef = NULL; + bool found = false; + bool noPriorityTargetFound = false; + + std::list::const_iterator lastRef = iThreatList.end(); + lastRef--; + + for (std::list::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) + { + currentRef = (*iter); + + Unit* target = currentRef->getTarget(); + assert(target); // if the ref has status online the target must be there ! + + // some units are prefered in comparison to others + if (!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE))) + { + if (iter != lastRef) + { + // current victim is a second choice target, so don't compare threat with it below + if (currentRef == pCurrentVictim) + pCurrentVictim = NULL; + ++iter; + continue; + } + else + { + // if we reached to this point, everyone in the threatlist is a second choice target. In such a situation the target with the highest threat should be attacked. + noPriorityTargetFound = true; + iter = iThreatList.begin(); + continue; + } + } + + if (pAttacker->canCreatureAttack(target)) // skip non attackable currently targets + { + if (pCurrentVictim) // select 1.3/1.1 better target in comparison current target + { + // list sorted and and we check current target, then this is best case + if (pCurrentVictim == currentRef || currentRef->getThreat() <= 1.1f * pCurrentVictim->getThreat()) + { + currentRef = pCurrentVictim; // for second case + found = true; + break; + } + + if (currentRef->getThreat() > 1.3f * pCurrentVictim->getThreat() || + currentRef->getThreat() > 1.1f * pCurrentVictim->getThreat() && + pAttacker->IsWithinMeleeRange(target)) + { //implement 110% threat rule for targets in melee range + found = true; //and 130% rule for targets in ranged distances + break; //for selecting alive targets + } + } + else // select any + { + found = true; + break; + } + } + ++iter; + } + if (!found) + currentRef = NULL; + + return currentRef; +} + +//============================================================ +//=================== ThreatManager ========================== +//============================================================ + +ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(NULL), iOwner(owner), iUpdateTimer(THREAT_UPDATE_INTERVAL) +{ +} + +//============================================================ + +void ThreatManager::clearReferences() +{ + iThreatContainer.clearReferences(); + iThreatOfflineContainer.clearReferences(); + iCurrentVictim = NULL; + iUpdateTimer = THREAT_UPDATE_INTERVAL; +} + +//============================================================ + +void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell) +{ + //function deals with adding threat and adding players and pets into ThreatList + //mobs, NPCs, guards have ThreatList and HateOfflineList + //players and pets have only InHateListOf + //HateOfflineList is used co contain unattackable victims (in-flight, in-water, GM etc.) + + // not to self + if (pVictim == getOwner()) + return; + + // not to GM + if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster())) + return; + + // not to dead and not for dead + if (!pVictim->isAlive() || !getOwner()->isAlive()) + return; + + assert(getOwner()->GetTypeId() == TYPEID_UNIT); + + float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, schoolMask, pThreatSpell); + + // must check > 0.0f, otherwise dead loop + if (threat > 0.0f && pVictim->GetReducedThreatPercent()) + { + uint32 reducedThreadPercent = pVictim->GetReducedThreatPercent(); + + Unit *unit = pVictim->GetMisdirectionTarget(); + if (unit) + if (Aura* pAura = unit->GetAura(63326)) // Glyph of Vigilance + reducedThreadPercent += pAura->GetSpellProto()->EffectBasePoints[0]; + + float reducedThreat = threat * reducedThreadPercent / 100; + threat -= reducedThreat; + if (unit) + _addThreat(unit, reducedThreat); + } + + _addThreat(pVictim, threat); +} + +void ThreatManager::_addThreat(Unit *pVictim, float fThreat) +{ + HostileReference* ref = iThreatContainer.addThreat(pVictim, fThreat); + // Ref is not in the online refs, search the offline refs next + if (!ref) + ref = iThreatOfflineContainer.addThreat(pVictim, fThreat); + + if (!ref) // there was no ref => create a new one + { + // threat has to be 0 here + HostileReference* hostilReference = new HostileReference(pVictim, this, 0); + iThreatContainer.addReference(hostilReference); + hostilReference->addThreat(fThreat); // now we add the real threat + if (pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster()) + hostilReference->setOnlineOfflineState(false); // GM is always offline + } +} + +//============================================================ + +void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 iPercent) +{ + iThreatContainer.modifyThreatPercent(pVictim, iPercent); +} + +//============================================================ + +Unit* ThreatManager::getHostilTarget() +{ + iThreatContainer.update(); + HostileReference* nextVictim = iThreatContainer.selectNextVictim(getOwner()->ToCreature(), getCurrentVictim()); + setCurrentVictim(nextVictim); + return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL; +} + +//============================================================ + +float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList) +{ + float threat = 0.0f; + HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim); + if (!ref && pAlsoSearchOfflineList) + ref = iThreatOfflineContainer.getReferenceByTarget(pVictim); + if (ref) + threat = ref->getThreat(); + return threat; +} + +//============================================================ + +void ThreatManager::tauntApply(Unit* pTaunter) +{ + HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); + if (getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat())) + { + if (ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused + ref->setTempThreat(getCurrentVictim()->getThreat()); + } +} + +//============================================================ + +void ThreatManager::tauntFadeOut(Unit *pTaunter) +{ + HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); + if (ref) + ref->resetTempThreat(); +} + +//============================================================ + +void ThreatManager::setCurrentVictim(HostileReference* pHostileReference) +{ + if (pHostileReference && pHostileReference != iCurrentVictim) + { + iOwner->SendChangeCurrentVictimOpcode(pHostileReference); + } + iCurrentVictim = pHostileReference; +} + +//============================================================ +// The hated unit is gone, dead or deleted +// return true, if the event is consumed + +void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent) +{ + threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager + + HostileReference* hostilReference = threatRefStatusChangeEvent->getReference(); + + switch(threatRefStatusChangeEvent->getType()) + { + case UEV_THREAT_REF_THREAT_CHANGE: + if ((getCurrentVictim() == hostilReference && threatRefStatusChangeEvent->getFValue()<0.0f) || + (getCurrentVictim() != hostilReference && threatRefStatusChangeEvent->getFValue()>0.0f)) + setDirty(true); // the order in the threat list might have changed + break; + case UEV_THREAT_REF_ONLINE_STATUS: + if (!hostilReference->isOnline()) + { + if (hostilReference == getCurrentVictim()) + { + setCurrentVictim(NULL); + setDirty(true); + } + iThreatContainer.remove(hostilReference); + iThreatOfflineContainer.addReference(hostilReference); + } + else + { + if (getCurrentVictim() && hostilReference->getThreat() > (1.1f * getCurrentVictim()->getThreat())) + setDirty(true); + iThreatContainer.addReference(hostilReference); + iThreatOfflineContainer.remove(hostilReference); + } + break; + case UEV_THREAT_REF_REMOVE_FROM_LIST: + if (hostilReference == getCurrentVictim()) + { + setCurrentVictim(NULL); + setDirty(true); + } + iOwner->SendRemoveFromThreatListOpcode(hostilReference); + if (hostilReference->isOnline()) + iThreatContainer.remove(hostilReference); + else + iThreatOfflineContainer.remove(hostilReference); + break; + } +} + +bool ThreatManager::isNeedUpdateToClient(uint32 time) +{ + if (isThreatListEmpty()) + return false; + if (time >= iUpdateTimer) + { + iUpdateTimer = THREAT_UPDATE_INTERVAL; + return true; + } + iUpdateTimer -= time; + return false; +} + +// Reset all aggro without modifying the threadlist. +void ThreatManager::resetAllAggro() +{ + std::list &threatlist = getThreatList(); + if (threatlist.empty()) + return; + + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + { + (*itr)->setThreat(0); + } + + setDirty(true); +} diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h new file mode 100644 index 0000000..2903fe8 --- /dev/null +++ b/src/server/game/Combat/ThreatManager.h @@ -0,0 +1,279 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _THREATMANAGER +#define _THREATMANAGER + +#include "Common.h" +#include "SharedDefines.h" +#include "LinkedReference/Reference.h" +#include "UnitEvents.h" + +#include + +//============================================================== + +class Unit; +class Creature; +class ThreatManager; +struct SpellEntry; + +#define THREAT_UPDATE_INTERVAL 1 * IN_MILLISECONDS // Server should send threat update to client periodically each second + +//============================================================== +// Class to calculate the real threat based + +class ThreatCalcHelper +{ + public: + static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL); +}; + +//============================================================== +class HostileReference : public Reference +{ + public: + HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat); + + //================================================= + void addThreat(float fModThreat); + + void setThreat(float fThreat) { addThreat(fThreat - getThreat()); } + + void addThreatPercent(int32 pPercent) + { + float tmpThreat = iThreat; + tmpThreat = tmpThreat * (pPercent+100.0f) / 100.0f; + addThreat(tmpThreat-iThreat); + } + + float getThreat() const { return iThreat; } + + bool isOnline() const { return iOnline; } + + // The Unit might be in water and the creature can not enter the water, but has range attack + // in this case online = true, but accessible = false + bool isAccessible() const { return iAccessible; } + + // used for temporary setting a threat and reducting it later again. + // the threat modification is stored + void setTempThreat(float fThreat) + { + addTempThreat(fThreat - getThreat()); + } + + void addTempThreat(float fThreat) + { + iTempThreatModifier = fThreat; + if (iTempThreatModifier != 0.0f) + addThreat(iTempThreatModifier); + } + + void resetTempThreat() + { + if (iTempThreatModifier != 0.0f) + { + addThreat(-iTempThreatModifier); + iTempThreatModifier = 0.0f; + } + } + + float getTempThreatModifier() { return iTempThreatModifier; } + + //================================================= + // check, if source can reach target and set the status + void updateOnlineStatus(); + + void setOnlineOfflineState(bool pIsOnline); + + void setAccessibleState(bool pIsAccessible); + //================================================= + + bool operator == (const HostileReference& pHostileReference) const { return pHostileReference.getUnitGuid() == getUnitGuid(); } + + //================================================= + + uint64 getUnitGuid() const { return iUnitGuid; } + + //================================================= + // reference is not needed anymore. realy delete it ! + + void removeReference(); + + //================================================= + + HostileReference* next() { return ((HostileReference*) Reference::next()); } + + //================================================= + + // Tell our refTo (target) object that we have a link + void targetObjectBuildLink(); + + // Tell our refTo (taget) object, that the link is cut + void targetObjectDestroyLink(); + + // Tell our refFrom (source) object, that the link is cut (Target destroyed) + void sourceObjectDestroyLink(); + private: + // Inform the source, that the status of that reference was changed + void fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent); + + Unit* getSourceUnit(); + private: + float iThreat; + float iTempThreatModifier; // used for taunt + uint64 iUnitGuid; + bool iOnline; + bool iAccessible; +}; + +//============================================================== +class ThreatManager; + +class ThreatContainer +{ + private: + std::list iThreatList; + bool iDirty; + protected: + friend class ThreatManager; + + void remove(HostileReference* pRef) { iThreatList.remove(pRef); } + void addReference(HostileReference* pHostileReference) { iThreatList.push_back(pHostileReference); } + void clearReferences(); + // Sort the list if necessary + void update(); + public: + ThreatContainer() { iDirty = false; } + ~ThreatContainer() { clearReferences(); } + + HostileReference* addThreat(Unit* pVictim, float fThreat); + + void modifyThreatPercent(Unit *pVictim, int32 iPercent); + + HostileReference* selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim); + + void setDirty(bool pDirty) { iDirty = pDirty; } + + bool isDirty() { return iDirty; } + + bool empty() { return(iThreatList.empty()); } + + HostileReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); } + + HostileReference* getReferenceByTarget(Unit* pVictim); + + std::list& getThreatList() { return iThreatList; } +}; + +//================================================= + +class ThreatManager +{ + public: + friend class HostileReference; + + explicit ThreatManager(Unit *pOwner); + + ~ThreatManager() { clearReferences(); } + + void clearReferences(); + + void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL); + void modifyThreatPercent(Unit *pVictim, int32 iPercent); + + float getThreat(Unit *pVictim, bool pAlsoSearchOfflineList = false); + + bool isThreatListEmpty() { return iThreatContainer.empty(); } + + void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent); + + bool isNeedUpdateToClient(uint32 time); + + HostileReference* getCurrentVictim() { return iCurrentVictim; } + + Unit* getOwner() { return iOwner; } + + Unit* getHostilTarget(); + + void tauntApply(Unit* pTaunter); + void tauntFadeOut(Unit *pTaunter); + + void setCurrentVictim(HostileReference* pHostileReference); + + void setDirty(bool bDirty) { iThreatContainer.setDirty(bDirty); } + + // Reset all aggro without modifying the threadlist. + void resetAllAggro(); + + // Reset all aggro of unit in threadlist satisfying the predicate. + template void resetAggro(PREDICATE predicate) + { + std::list &threatlist = getThreatList(); + if (threatlist.empty()) + return; + + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + { + HostileReference* ref = (*itr); + + if (predicate(ref->getTarget())) + { + ref->setThreat(0); + setDirty(true); + } + } + } + + // methods to access the lists from the outside to do some dirty manipulation (scriping and such) + // I hope they are used as little as possible. + std::list& getThreatList() { return iThreatContainer.getThreatList(); } + std::list& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); } + ThreatContainer& getOnlineContainer() { return iThreatContainer; } + ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; } + private: + void _addThreat(Unit *pVictim, float fThreat); + + HostileReference* iCurrentVictim; + Unit* iOwner; + uint32 iUpdateTimer; + ThreatContainer iThreatContainer; + ThreatContainer iThreatOfflineContainer; +}; + +//================================================= + +namespace Trinity +{ + // Binary predicate for sorting HostileReferences based on threat value + class ThreatOrderPred + { + public: + ThreatOrderPred(bool ascending = false) : m_ascending(ascending) {} + bool operator() (const HostileReference *a, const HostileReference *b) const + { + return m_ascending ? a->getThreat() < b->getThreat() : a->getThreat() > b->getThreat(); + } + private: + const bool m_ascending; + }; +} +#endif + diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h new file mode 100644 index 0000000..a218e0d --- /dev/null +++ b/src/server/game/Combat/UnitEvents.h @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _UNITEVENTS +#define _UNITEVENTS + +#include "Common.h" + +class ThreatContainer; +class ThreatManager; +class HostileReference; + +//============================================================== +//============================================================== + +enum UNIT_EVENT_TYPE +{ + // Player/Pet changed on/offline status + UEV_THREAT_REF_ONLINE_STATUS = 1<<0, + + // Threat for Player/Pet changed + UEV_THREAT_REF_THREAT_CHANGE = 1<<1, + + // Player/Pet will be removed from list (dead) [for internal use] + UEV_THREAT_REF_REMOVE_FROM_LIST = 1<<2, + + // Player/Pet entered/left water or some other place where it is/was not accessible for the creature + UEV_THREAT_REF_ASSECCIBLE_STATUS = 1<<3, + + // Threat list is going to be sorted (if dirty flag is set) + UEV_THREAT_SORT_LIST = 1<<4, + + // New target should be fetched, could tbe the current target as well + UEV_THREAT_SET_NEXT_TARGET = 1<<5, + + // A new victim (target) was set. Could be NULL + UEV_THREAT_VICTIM_CHANGED = 1<<6, + + // Future use + //UEV_UNIT_KILLED = 1<<7, + + //Future use + //UEV_UNIT_HEALTH_CHANGE = 1<<8, +}; + +#define UEV_THREAT_REF_EVENT_MASK (UEV_THREAT_REF_ONLINE_STATUS | UEV_THREAT_REF_THREAT_CHANGE | UEV_THREAT_REF_REMOVE_FROM_LIST | UEV_THREAT_REF_ASSECCIBLE_STATUS) +#define UEV_THREAT_MANAGER_EVENT_MASK (UEV_THREAT_SORT_LIST | UEV_THREAT_SET_NEXT_TARGET | UEV_THREAT_VICTIM_CHANGED) +#define UEV_ALL_EVENT_MASK (0xffffffff) + +// Future use +//#define UEV_UNIT_EVENT_MASK (UEV_UNIT_KILLED | UEV_UNIT_HEALTH_CHANGE) + +//============================================================== + +class UnitBaseEvent +{ + private: + uint32 iType; + public: + UnitBaseEvent(uint32 pType) { iType = pType; } + uint32 getType() const { return iType; } + bool matchesTypeMask(uint32 pMask) const { return iType & pMask; } + + void setType(uint32 pType) { iType = pType; } + +}; + +//============================================================== + +class ThreatRefStatusChangeEvent : public UnitBaseEvent +{ + private: + HostileReference* iHostileReference; + union + { + float iFValue; + int32 iIValue; + bool iBValue; + }; + ThreatManager* iThreatManager; + public: + ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostileReference = NULL; } + + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; } + + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iFValue = pValue; } + + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iBValue = pValue; } + + int32 getIValue() const { return iIValue; } + + float getFValue() const { return iFValue; } + + bool getBValue() const { return iBValue; } + + void setBValue(bool pValue) { iBValue = pValue; } + + HostileReference* getReference() const { return iHostileReference; } + + void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; } + + ThreatManager* getThreatManager() const { return iThreatManager; } +}; + +//============================================================== + +class ThreatManagerEvent : public ThreatRefStatusChangeEvent +{ + private: + ThreatContainer* iThreatContainer; + public: + ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {} + ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {} + + void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; } + + ThreatContainer* getThreatContainer() const { return iThreatContainer; } +}; + +//============================================================== +#endif + diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp new file mode 100644 index 0000000..9164f55 --- /dev/null +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -0,0 +1,1183 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + +#include "Player.h" +#include "SpellAuras.h" +#include "SpellMgr.h" +#include "GameEventMgr.h" +#include "ObjectMgr.h" +#include "ProgressBar.h" +#include "InstanceData.h" +#include "ConditionMgr.h" + +// Checks if player meets the condition +// Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI) +bool Condition::Meets(Player * player, Unit* targetOverride) +{ + if (!player) + { + sLog.outDebug("Condition player not found"); + return false; // player not present, return false + } + uint32 refId = 0; + bool condMeets = false; + bool sendErrorMsg = false; + refId = mConditionValue3;//value 3 can be a 'quick' reference + switch (mConditionType) + { + case CONDITION_NONE: + condMeets = true; // empty condition, always met + break; + case CONDITION_AURA: + condMeets = player->HasAuraEffect(mConditionValue1, mConditionValue2); + break; + case CONDITION_ITEM: + condMeets = player->HasItemCount(mConditionValue1, mConditionValue2); + break; + case CONDITION_ITEM_EQUIPPED: + condMeets = player->HasItemOrGemWithIdEquipped(mConditionValue1,1); + break; + case CONDITION_ZONEID: + condMeets = player->GetZoneId() == mConditionValue1; + break; + case CONDITION_REPUTATION_RANK: + { + FactionEntry const* faction = sFactionStore.LookupEntry(mConditionValue1); + condMeets = faction && uint32(player->GetReputationMgr().GetRank(faction)) >= int32(mConditionValue2); + break; + } + case CONDITION_ACHIEVEMENT: + { + AchievementEntry const* achievement = GetAchievementStore()->LookupEntry(mConditionValue1); + condMeets = player->GetAchievementMgr().HasAchieved(achievement); + break; + } + case CONDITION_TEAM: + condMeets = player->GetTeam() == mConditionValue1; + break; + case CONDITION_CLASS: + condMeets = player->getClass() == mConditionValue1; + break; + case CONDITION_RACE: + condMeets = player->getRace() == mConditionValue1; + break; + case CONDITION_SKILL: + condMeets = player->HasSkill(mConditionValue1) && player->GetBaseSkillValue(mConditionValue1) >= mConditionValue2; + break; + case CONDITION_QUESTREWARDED: + condMeets = player->GetQuestRewardStatus(mConditionValue1); + break; + case CONDITION_QUESTTAKEN: + { + QuestStatus status = player->GetQuestStatus(mConditionValue1); + condMeets = (status == QUEST_STATUS_INCOMPLETE); + break; + } + case CONDITION_QUEST_NONE: + { + QuestStatus status = player->GetQuestStatus(mConditionValue1); + condMeets = (status == QUEST_STATUS_NONE); + break; + } + case CONDITION_AD_COMMISSION_AURA: + { + Unit::AuraApplicationMap const& auras = player->GetAppliedAuras(); + for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + if ((itr->second->GetBase()->GetSpellProto()->Attributes & 0x1000010) && itr->second->GetBase()->GetSpellProto()->SpellVisual[0] == 3580) + { + condMeets = true; + break; + } + condMeets = false; + break; + } + case CONDITION_NO_AURA: + condMeets = !player->HasAuraEffect(mConditionValue1, mConditionValue2); + break; + case CONDITION_ACTIVE_EVENT: + condMeets = gameeventmgr.IsActiveEvent(mConditionValue1); + break; + case CONDITION_INSTANCE_DATA: + { + Map *map = player->GetMap(); + if (map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData()) + condMeets = ((InstanceMap*)map)->GetInstanceData()->GetData(mConditionValue1) == mConditionValue2; + break; + } + case CONDITION_SPELL_SCRIPT_TARGET: + condMeets = true;//spell target condition is handled in spellsystem, here it is always true + refId = 0;//cant have references! use CONDITION_SOURCE_TYPE_SPELL for it + break; + case CONDITION_CREATURE_TARGET: + { + Unit* target = player->GetSelectedUnit(); + if (targetOverride) + target = targetOverride; + if (target) + if (Creature* cTarget = target->ToCreature()) + if (cTarget->GetEntry() == mConditionValue1) + condMeets = true; + break; + } + case CONDITION_TARGET_HEALTH_BELOW_PCT: + { + Unit* target = player->GetSelectedUnit(); + if (targetOverride) + target = targetOverride; + if (target) + if ((target->GetHealth()*100 / target->GetMaxHealth()) <= mConditionValue1) + condMeets = true; + break; + } + case CONDITION_TARGET_RANGE: + { + if (Unit* target = player->GetSelectedUnit()) + if (player->GetDistance(target) >= mConditionValue1 && (!mConditionValue2 || player->GetDistance(target) <= mConditionValue2)) + condMeets = true; + break; + } + case CONDITION_MAPID: + condMeets = player->GetMapId() == mConditionValue1; + break; + case CONDITION_AREAID: + condMeets = player->GetAreaId() == mConditionValue1; + break; + case CONDITION_ITEM_TARGET: + { + condMeets = true;//handled in Item::IsTargetValidForItemUse + refId = 0;//cant have references for now + break; + } + default: + condMeets = false; + refId = 0; + break; + } + switch (mSourceType) + { + case CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET: + case CONDITION_SOURCE_TYPE_SPELL: + sendErrorMsg = true; + break; + } + + bool refMeets = false; + if (condMeets && refId)//only have to check references if 'this' is met + { + ConditionList ref = sConditionMgr.GetConditionReferences(refId); + refMeets = sConditionMgr.IsPlayerMeetToConditions(player, ref); + }else refMeets = true; + + if (sendErrorMsg && ErrorTextd && (!condMeets || !refMeets))//send special error from DB + player->m_ConditionErrorMsgId = ErrorTextd; + + return condMeets && refMeets; +} + +ConditionMgr::ConditionMgr() +{ +} + +ConditionMgr::~ConditionMgr() +{ + Clean(); +} + +ConditionList ConditionMgr::GetConditionReferences(uint32 refId) +{ + ConditionList conditions; + ConditionReferenceMap::const_iterator ref = m_ConditionReferenceMap.find(refId); + if (ref != m_ConditionReferenceMap.end()) + conditions = (*ref).second; + return conditions; +} + +bool ConditionMgr::IsPlayerMeetToConditionList(Player* player,const ConditionList& conditions, Unit* targetOverride) +{ + std::mapElseGroupMap; + for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i) + { + sLog.outDebug("ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u",(*i)->mConditionType,(*i)->mConditionValue1); + if ((*i)->isLoaded()) + { + std::map::const_iterator itr = ElseGroupMap.find((*i)->mElseGroup); + if (itr == ElseGroupMap.end()) + ElseGroupMap[(*i)->mElseGroup] = true; + else if (!(*itr).second) + continue; + + if ((*i)->mReferenceId)//handle reference + { + ConditionReferenceMap::const_iterator ref = m_ConditionReferenceMap.find((*i)->mReferenceId); + if (ref != m_ConditionReferenceMap.end()) + { + if(!IsPlayerMeetToConditionList(player, (*ref).second, targetOverride)) + ElseGroupMap[(*i)->mElseGroup] = false; + }else{ + sLog.outDebug("IsPlayerMeetToConditionList: Reference template -%u not found", (*i)->mReferenceId);//checked at loading, should never happen + } + + } else//handle normal condition + { + if (!(*i)->Meets(player, targetOverride)) + ElseGroupMap[(*i)->mElseGroup] = false; + } + } + } + for (std::map::const_iterator i = ElseGroupMap.begin(); i != ElseGroupMap.end(); ++i) + if (i->second) + return true; + return false; +} + +bool ConditionMgr::IsPlayerMeetToConditions(Player* player, ConditionList conditions, Unit* targetOverride) +{ + if (conditions.empty()) + return true; + if(player) + player->m_ConditionErrorMsgId = 0; + + sLog.outDebug("ConditionMgr::IsPlayerMeetToConditions"); + bool result = IsPlayerMeetToConditionList(player, conditions, targetOverride); + + if (player && player->m_ConditionErrorMsgId && player->GetSession()) + player->GetSession()->SendNotification(player->m_ConditionErrorMsgId);//m_ConditionErrorMsgId is set only if a condition was not met + + return result; +} + +ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType sType, uint32 uEntry) +{ + ConditionList spellCond; + if (sType > CONDITION_SOURCE_TYPE_NONE && sType < MAX_CONDITIONSOURCETYPE) + { + ConditionMap::const_iterator itr = m_ConditionMap.find(sType); + if (itr != m_ConditionMap.end()) + { + ConditionTypeMap::const_iterator i = (*itr).second.find(uEntry); + if (i != (*itr).second.end()) + { + spellCond = (*i).second; + sLog.outDebug("GetConditionsForNotGroupedEntry: found conditions for type %u and entry %u", uint32(sType), uEntry); + } + } + } + return spellCond; +} + +void ConditionMgr::LoadConditions(bool isReload) +{ + Clean(); + + //must clear all custom handled cases (groupped types) before reload + if (isReload) + { + sLog.outString("Reseting Loot Conditions..."); + LootTemplates_Creature.ResetConditions(); + LootTemplates_Fishing.ResetConditions(); + LootTemplates_Gameobject.ResetConditions(); + LootTemplates_Item.ResetConditions(); + LootTemplates_Mail.ResetConditions(); + LootTemplates_Milling.ResetConditions(); + LootTemplates_Pickpocketing.ResetConditions(); + LootTemplates_Reference.ResetConditions(); + LootTemplates_Skinning.ResetConditions(); + LootTemplates_Disenchant.ResetConditions(); + LootTemplates_Prospecting.ResetConditions(); + LootTemplates_Spell.ResetConditions(); + + sLog.outString("Re-Loading `gossip_menu` Table for Conditions!"); + objmgr.LoadGossipMenu(); + + sLog.outString("Re-Loading `gossip_menu_option` Table for Conditions!"); + objmgr.LoadGossipMenuItems(); + } + + uint32 count = 0; + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, ElseGroup, ConditionTypeOrReference, ConditionValue1, ConditionValue2, ConditionValue3, ErrorTextId FROM conditions"); + + if (!result) + { + barGoLink bar(1); + + bar.step(); + + sLog.outString(); + sLog.outErrorDb(">> Loaded `conditions`, table is empty!"); + return; + } + + barGoLink bar(result->GetRowCount()); + + do + { + bar.step(); + + Field *fields = result->Fetch(); + + Condition* cond = new Condition(); + int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); + cond->mSourceGroup = fields[1].GetUInt32(); + cond->mSourceEntry = fields[2].GetUInt32(); + cond->mElseGroup = fields[3].GetUInt32(); + int32 iConditionTypeOrReference = fields[4].GetInt32(); + cond->mConditionValue1 = fields[5].GetUInt32(); + cond->mConditionValue2 = fields[6].GetUInt32(); + cond->mConditionValue3 = fields[7].GetUInt32(); + cond->ErrorTextd = fields[8].GetUInt32(); + + if (iConditionTypeOrReference >= 0) + cond->mConditionType = ConditionType(iConditionTypeOrReference); + + if (iConditionTypeOrReference < 0)//it has a reference + { + if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip + { + sLog.outErrorDb("Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId); + delete cond; + continue; + } + cond->mReferenceId = uint32(abs(iConditionTypeOrReference)); + + const char* rowType = "reference template"; + if (iSourceTypeOrReferenceId >= 0) + rowType = "reference"; + //check for useless data + if (cond->mConditionValue1) + sLog.outErrorDb("Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->mConditionValue1); + if (cond->mConditionValue2) + sLog.outErrorDb("Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->mConditionValue2); + if (cond->mConditionValue3) + sLog.outErrorDb("Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->mConditionValue3); + if (cond->mSourceGroup && iSourceTypeOrReferenceId < 0) + sLog.outErrorDb("Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->mSourceGroup); + if (cond->mSourceEntry && iSourceTypeOrReferenceId < 0) + sLog.outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->mSourceEntry); + }else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType + { + delete cond; + continue; + } + + if (iSourceTypeOrReferenceId < 0)//it is a reference template + { + uint32 uRefId = abs(iSourceTypeOrReferenceId); + if (m_ConditionReferenceMap.find(uRefId) == m_ConditionReferenceMap.end())//make sure we have a list for our conditions, based on reference id + { + ConditionList mCondList; + m_ConditionReferenceMap[uRefId] = mCondList; + } + m_ConditionReferenceMap[uRefId].push_back(cond);//add to reference storage + count++; + continue; + }//end of reference templates + + cond->mSourceType = ConditionSourceType(iSourceTypeOrReferenceId); + + //if not a reference and SourceType is invalid, skip + if (iConditionTypeOrReference >= 0 && !isSourceTypeValid(cond)) + { + delete cond; + continue; + } + + //Grouping is only allowed for some types (loot templates, gossip menus, gossip items) + if (cond->mSourceGroup && !isGroupable(cond->mSourceType)) + { + sLog.outErrorDb("Condition type %u has not allowed grouping %u!", uint32(cond->mSourceType), cond->mSourceGroup); + delete cond; + continue; + }else if (cond->mSourceGroup) + { + bool bIsDone = false; + //handle grouped conditions + switch (cond->mSourceType) + { + case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Creature.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Disenchant.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Fishing.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Gameobject.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Item.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Mail.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Milling.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Pickpocketing.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Prospecting.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Reference.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Skinning.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE: + bIsDone = addToLootTemplate(cond, LootTemplates_Spell.GetLootForConditionFill(cond->mSourceGroup)); + break; + case CONDITION_SOURCE_TYPE_GOSSIP_MENU: + bIsDone = addToGossipMenus(cond); + break; + case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: + bIsDone = addToGossipMenuItems(cond); + break; + } + if (!bIsDone) + { + sLog.outErrorDb("Not handled grouped condition, SourceGroup %u", cond->mSourceGroup); + delete cond; + } + else + { + m_AllocatedMemory.push_back(cond); + ++count; + } + continue; + } + + //handle not grouped conditions + //make sure we have a storage list for our SourceType + if (m_ConditionMap.find(cond->mSourceType) == m_ConditionMap.end()) + { + ConditionTypeMap mTypeMap; + m_ConditionMap[cond->mSourceType] = mTypeMap;//add new empty list for SourceType + } + + //make sure we have a condition list for our SourceType's entry + if (m_ConditionMap[cond->mSourceType].find(cond->mSourceEntry) == m_ConditionMap[cond->mSourceType].end()) + { + ConditionList mCondList; + m_ConditionMap[cond->mSourceType][cond->mSourceEntry] = mCondList; + } + + //add new Condition to storage based on Type/Entry + m_ConditionMap[cond->mSourceType][cond->mSourceEntry].push_back(cond); + ++count; + } + while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u conditions", count); +} + +bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) +{ + if (!loot) + { + sLog.outErrorDb("ConditionMgr: LootTemplate %u not found", cond->mSourceGroup); + return false; + } + if (loot->addConditionItem(cond)) + return true; + sLog.outErrorDb("ConditionMgr: Item %u not found in LootTemplate %u", cond->mSourceEntry, cond->mSourceGroup); + return false; +} + +bool ConditionMgr::addToGossipMenus(Condition* cond) +{ + GossipMenusMapBoundsNonConst pMenuBounds = objmgr.GetGossipMenusMapBoundsNonConst(cond->mSourceGroup); + + if (pMenuBounds.first != pMenuBounds.second) + { + for (GossipMenusMap::iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr) + { + if ((*itr).second.entry == cond->mSourceGroup && (*itr).second.text_id == cond->mSourceEntry) + { + (*itr).second.conditions.push_back(cond); + return true; + } + } + } + sLog.outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->mSourceGroup); + return false; +} + +bool ConditionMgr::addToGossipMenuItems(Condition* cond) +{ + GossipMenuItemsMapBoundsNonConst pMenuItemBounds = objmgr.GetGossipMenuItemsMapBoundsNonConst(cond->mSourceGroup); + if (pMenuItemBounds.first != pMenuItemBounds.second) + { + for (GossipMenuItemsMap::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) + { + if ((*itr).second.menu_id == cond->mSourceGroup && (*itr).second.id == cond->mSourceEntry) + { + (*itr).second.conditions.push_back(cond); + return true; + } + } + } + sLog.outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->mSourceGroup, cond->mSourceEntry); + return false; +} + +bool ConditionMgr::isSourceTypeValid(Condition* cond) +{ + if (cond->mSourceType == CONDITION_SOURCE_TYPE_NONE || cond->mSourceType >= MAX_CONDITIONSOURCETYPE) + { + sLog.outErrorDb("Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->mSourceType)); + return false; + } + switch (cond->mSourceType) + { + case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE: + { + if (!LootTemplates_Creature.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Creature.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE: + { + if (!LootTemplates_Disenchant.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Disenchant.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE: + { + if (!LootTemplates_Fishing.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Fishing.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE: + { + if (!LootTemplates_Gameobject.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Gameobject.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE: + { + if (!LootTemplates_Item.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Item.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE: + { + if (!LootTemplates_Mail.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Mail.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE: + { + if (!LootTemplates_Milling.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Milling.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE: + { + if (!LootTemplates_Pickpocketing.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Pickpocketing.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE: + { + if (!LootTemplates_Prospecting.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Prospecting.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE: + { + if (!LootTemplates_Reference.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Reference.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE: + { + if (!LootTemplates_Skinning.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Skinning.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE: + { + if (!LootTemplates_Spell.HaveLootFor(cond->mSourceGroup)) + { + sLog.outErrorDb("SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->mSourceGroup); + return false; + } + LootTemplate* loot = LootTemplates_Spell.GetLootForConditionFill(cond->mSourceGroup); + ItemPrototype const* pItemProto = sItemStorage.LookupEntry(cond->mSourceEntry); + if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET: + { + if (cond->mConditionType != CONDITION_SPELL_SCRIPT_TARGET) + { + sLog.outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_SPELL_SCRIPT_TARGET(18) is valid for CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET(14), ignoring.", cond->mSourceEntry, uint32(cond->mConditionType)); + return false; + } + SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry); + + if (!spellProto) + { + sLog.outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry); + return false; + } + + bool targetfound = false; + for (uint8 i = 0; i < 3; ++i) + { + if (spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_SRC || + spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_SRC || + spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_DST || + spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_DST || + spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_NEARBY_ENTRY || + spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_NEARBY_ENTRY || + spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY || + spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY || + spellProto->EffectImplicitTargetA[i] == TARGET_DST_NEARBY_ENTRY || + spellProto->EffectImplicitTargetB[i] == TARGET_DST_NEARBY_ENTRY || + spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_CONE_ENTRY || + spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_CONE_ENTRY) + { + targetfound = true; + break; + } + } + if (!targetfound) + { + sLog.outErrorDb("SourceEntry %u in `condition` table does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DST_NEARBY_ENTRY (46)\ + ,TARGET_UNIT_AREA_ENTRY_SRC(7), TARGET_UNIT_AREA_ENTRY_DST(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)",cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE: + { + if (!sCreatureStorage.LookupEntry(cond->mSourceEntry)) + { + sLog.outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_SPELL: + { + SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry); + if (!spellProto) + { + sLog.outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry); + return false; + } + break; + } + case CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET: + { + if (cond->mConditionType != CONDITION_ITEM_TARGET) + { + sLog.outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_ITEM_TARGET(24) is valid for CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET(18), ignoring.", cond->mSourceEntry, uint32(cond->mConditionType)); + return false; + } + ItemPrototype const *pItemProto = objmgr.GetItemPrototype(cond->mSourceEntry); + if (!pItemProto) + { + sLog.outErrorDb("SourceEntry %u in `condition` table, does not exist in `item_tamplate`, ignoring.", cond->mSourceEntry); + return false; + } + bool bIsItemSpellValid = false; + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + if (SpellEntry const* pSpellInfo = sSpellStore.LookupEntry(pItemProto->Spells[i].SpellId)) + { + if (pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE || + pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) + { + ConditionList conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET, pSpellInfo->Id);//script loading is done before item target loading + if (!conditions.empty()) + break; + + for (int j = 0; j < 3; ++j) + { + if (pSpellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_TARGET_ENEMY || + pSpellInfo->EffectImplicitTargetB[i] == TARGET_UNIT_TARGET_ENEMY || + pSpellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_TARGET_ANY || + pSpellInfo->EffectImplicitTargetB[i] == TARGET_UNIT_TARGET_ANY) + { + bIsItemSpellValid = true; + break; + } + } + if (bIsItemSpellValid) + break; + } + } + } + + if (!bIsItemSpellValid) + { + sLog.outErrorDb("Conditions:ITEM_REQUIRED_TARGET used by item %u does not have implicit target TARGET_CHAIN_DAMAGE(6), TARGET_DUELVSPLAYER(25), already listed in scriptTargets or doesn't have item spelltrigger.", cond->mSourceEntry); + break; + } + break; + } + case CONDITION_SOURCE_TYPE_GOSSIP_MENU: + case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: + case CONDITION_SOURCE_TYPE_NONE: + break; + } + return true; +} +bool ConditionMgr::isConditionTypeValid(Condition* cond) +{ + if (cond->mConditionType == CONDITION_NONE || cond->mConditionType >= MAX_CONDITION) + { + sLog.outErrorDb("Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->mConditionType),cond->mSourceEntry); + return false; + } + switch (cond->mConditionType) + { + case CONDITION_AURA: + { + if (!sSpellStore.LookupEntry(cond->mConditionValue1)) + { + sLog.outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2 > 2) + { + sLog.outErrorDb("Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->mConditionValue2); + return false; + } + break; + } + case CONDITION_ITEM: + { + ItemPrototype const *proto = objmgr.GetItemPrototype(cond->mConditionValue1); + if (!proto) + { + sLog.outErrorDb("Item condition has non existing item (%u), skipped", cond->mConditionValue1); + return false; + } + if (!cond->mConditionValue2) + { + sLog.outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->mConditionValue2); + return false; + } + break; + } + case CONDITION_ITEM_EQUIPPED: + { + ItemPrototype const *proto = objmgr.GetItemPrototype(cond->mConditionValue1); + if (!proto) + { + sLog.outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_ZONEID: + { + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->mConditionValue1); + if (!areaEntry) + { + sLog.outErrorDb("Zone condition has non existing area (%u), skipped", cond->mConditionValue1); + return false; + } + if (areaEntry->zone != 0) + { + sLog.outErrorDb("Zone condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Zone condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_REPUTATION_RANK: + { + FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->mConditionValue1); + if (!factionEntry) + { + sLog.outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->mConditionValue1); + return false; + } + break; + } + case CONDITION_TEAM: + { + if (cond->mConditionValue1 != ALLIANCE && cond->mConditionValue1 != HORDE) + { + sLog.outErrorDb("Team condition specifies unknown team (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Team condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_SKILL: + { + SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(cond->mConditionValue1); + if (!pSkill) + { + sLog.outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2 < 1 || cond->mConditionValue2 > sWorld.GetConfigMaxSkillValue()) + { + sLog.outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->mConditionValue2); + return false; + } + break; + } + case CONDITION_QUESTREWARDED: + case CONDITION_QUESTTAKEN: + case CONDITION_QUEST_NONE: + { + Quest const *Quest = objmgr.GetQuestTemplate(cond->mConditionValue1); + if (!Quest) + { + sLog.outErrorDb("Quest condition specifies non-existing quest (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Quest condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_AD_COMMISSION_AURA: + { + if (cond->mConditionValue1) + sLog.outErrorDb("Quest condition has useless data in value1 (%u)!", cond->mConditionValue1); + if (cond->mConditionValue2) + sLog.outErrorDb("Quest condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_NO_AURA: + { + if (!sSpellStore.LookupEntry(cond->mConditionValue1)) + { + sLog.outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2 > 2) + { + sLog.outErrorDb("Aura condition has non existing effect index (%u) in value2 (must be 0..2), skipped", cond->mConditionValue2); + return false; + } + break; + } + case CONDITION_ACTIVE_EVENT: + { + GameEventMgr::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + if (cond->mConditionValue1 >=events.size() || !events[cond->mConditionValue1].isValid()) + { + sLog.outErrorDb("Active event condition has non existing event id (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Active event condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_ACHIEVEMENT: + { + AchievementEntry const* achievement = GetAchievementStore()->LookupEntry(cond->mConditionValue1); + if (!achievement) + { + sLog.outErrorDb("Achivemen condition has non existing achivement id (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Achivemen condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_CLASS: + { + if (cond->mConditionValue1 >= MAX_CLASSES) + { + sLog.outErrorDb("Class condition has non existing class (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Class condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_RACE: + { + if (cond->mConditionValue1 >= MAX_RACES) + { + sLog.outErrorDb("Race condition has non existing race (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Race condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_SPELL_SCRIPT_TARGET: + { + if (cond->mConditionValue1 >= MAX_SPELL_TARGET_TYPE) + { + sLog.outErrorDb("SpellTarget condition has non existing spell target type (%u), skipped", cond->mConditionValue1); + return false; + } + switch(cond->mConditionValue1) + { + case SPELL_TARGET_TYPE_GAMEOBJECT: + { + if (cond->mConditionValue2 && !sGOStorage.LookupEntry(cond->mConditionValue2)) + { + sLog.outErrorDb("SpellTarget condition has non existing gameobject (%u) as target, skipped", cond->mConditionValue2); + return false; + } + break; + } + case SPELL_TARGET_TYPE_CONTROLLED: + case SPELL_TARGET_TYPE_CREATURE: + case SPELL_TARGET_TYPE_DEAD: + { + if (cond->mConditionValue2 && !sCreatureStorage.LookupEntry(cond->mConditionValue2)) + { + sLog.outErrorDb("SpellTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue2); + return false; + } + const CreatureInfo* cInfo = sCreatureStorage.LookupEntry(cond->mConditionValue2); + + if (cond->mSourceEntry == 30427 && !cInfo->SkinLootId) + { + sLog.outErrorDb("SpellTarget condition has creature entry %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!, skipped", cond->mConditionValue2); + return false; + } + break; + } + } + if (cond->mConditionValue3) + sLog.outErrorDb("SpellTarget condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_CREATURE_TARGET: + { + if (!cond->mConditionValue1 && !sCreatureStorage.LookupEntry(cond->mConditionValue1)) + { + sLog.outErrorDb("CreatureTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("CreatureTarget condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_TARGET_HEALTH_BELOW_PCT: + { + if (cond->mConditionValue1 > 100) + { + sLog.outErrorDb("TargetHealthBelowPct condition has invalid data in value1 (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("TargetHealthBelowPct condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_TARGET_RANGE: + { + if (cond->mConditionValue2 && cond->mConditionValue2 < cond->mConditionValue1)//maxDist can be 0 for infinit max range + { + sLog.outErrorDb("TargetRange condition has max distance closer then min distance, skipped"); + return false; + } + break; + } + case CONDITION_MAPID: + { + MapEntry const * me = sMapStore.LookupEntry(cond->mConditionValue1); + if (!me) + { + sLog.outErrorDb("Map condition has non existing map (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2) + sLog.outErrorDb("Map condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + } + case CONDITION_ITEM_TARGET: + { + if (!cond->mConditionValue1 || cond->mConditionValue1 > MAX_ITEM_REQ_TARGET_TYPE) + { + sLog.outErrorDb("ItemTarget condition has incorrect target type (%u), skipped", cond->mConditionValue1); + return false; + } + if (!cond->mConditionValue2 && !sCreatureStorage.LookupEntry(cond->mConditionValue2)) + { + sLog.outErrorDb("ItemTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue2); + return false; + } + if (cond->mConditionValue3) + sLog.outErrorDb("ItemTarget condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_AREAID: + case CONDITION_INSTANCE_DATA: + break; + } + return true; +} + +void ConditionMgr::Clean() +{ + for (ConditionReferenceMap::iterator itr = m_ConditionReferenceMap.begin(); itr != m_ConditionReferenceMap.end(); ++itr) + { + for (ConditionList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it) + delete *it; + itr->second.clear(); + } + m_ConditionReferenceMap.clear(); + + for (ConditionMap::iterator itr = m_ConditionMap.begin(); itr != m_ConditionMap.end(); ++itr) + { + for (ConditionTypeMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it) + { + for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i) + delete *i; + it->second.clear(); + } + itr->second.clear(); + } + m_ConditionMap.clear(); + + // this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;) + for (std::list::const_iterator itr = m_AllocatedMemory.begin(); itr != m_AllocatedMemory.end(); ++itr) + delete *itr; + m_AllocatedMemory.clear(); +} diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h new file mode 100644 index 0000000..bb9fc27 --- /dev/null +++ b/src/server/game/Conditions/ConditionMgr.h @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_CONDITIONMGR_H +#define TRINITY_CONDITIONMGR_H + +#include "LootMgr.h" + +class Player; +class Unit; +class LootTemplate; + +enum ConditionType +{ // value1 value2 value3 + CONDITION_NONE = 0, // 0 0 0 always true + CONDITION_AURA = 1, // spell_id effindex +referenceID true if has aura of spell_id with effect effindex + CONDITION_ITEM = 2, // item_id count +referenceID true if has #count of item_ids + CONDITION_ITEM_EQUIPPED = 3, // item_id 0 +referenceID true if has item_id equipped + CONDITION_ZONEID = 4, // zone_id 0 +referenceID true if in zone_id + CONDITION_REPUTATION_RANK = 5, // faction_id min_rank +referenceID true if has min_rank for faction_id + CONDITION_TEAM = 6, // player_team 0, +referenceID 469 - Alliance, 67 - Horde) + CONDITION_SKILL = 7, // skill_id skill_value +referenceID true if has skill_value for skill_id + CONDITION_QUESTREWARDED = 8, // quest_id 0 +referenceID true if quest_id was rewarded before + CONDITION_QUESTTAKEN = 9, // quest_id 0, +referenceID true while quest active + CONDITION_AD_COMMISSION_AURA = 10, // 0 0, +referenceID true while one from AD commission aura active + CONDITION_NO_AURA = 11, // spell_id effindex +referenceID true if does not have aura of spell_id with effect effindex + CONDITION_ACTIVE_EVENT = 12, // event_id 0 +referenceID true if event is active + CONDITION_INSTANCE_DATA = 13, // entry data +referenceID true if data is set in current instance + CONDITION_QUEST_NONE = 14, // quest_id 0 +referenceID true if doesn't have quest saved + CONDITION_CLASS = 15, // class 0 +referenceID true if player's class is equal to class + CONDITION_RACE = 16, // race 0 +referenceID true if player's race is equal to race + CONDITION_ACHIEVEMENT = 17, // achievement_id 0 +referenceID true if achievement is complete + CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0 + CONDITION_CREATURE_TARGET = 19, // creature entry 0 +referenceID true if current target is creature with value1 entry + CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 +referenceID true if target's health is below value1 percent, false if over or no target + CONDITION_TARGET_RANGE = 21, // minDistance maxDist +referenceID true if target is closer then minDist and further then maxDist or if max is 0 then max dist is infinit + CONDITION_MAPID = 22, // map_id 0 +referenceID true if in map_id + CONDITION_AREAID = 23, // area_id 0 +referenceID true if in area_id + CONDITION_ITEM_TARGET = 24 // ItemRequiredTargetType, TargetEntry, 0 +}; + +#define MAX_CONDITION 25 // maximum value in ConditionType enum + +enum ConditionSourceType +{ + CONDITION_SOURCE_TYPE_NONE = 0,//DONE + CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE = 1,//DONE + CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE = 2,//DONE + CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE = 3,//DONE + CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE = 4,//DONE + CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE = 5,//DONE + CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE = 6,//DONE + CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE = 7,//DONE + CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE = 8,//DONE + CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE = 9,//DONE + CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE = 10,//DONE + CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE = 11,//DONE + CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE = 12,//DONE + CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET = 13,//DONE + CONDITION_SOURCE_TYPE_GOSSIP_MENU = 14,//DONE + CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION = 15,//DONE + CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE = 16,//DONE + CONDITION_SOURCE_TYPE_SPELL = 17,//DONE + CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET = 18//DONE +}; + +#define MAX_CONDITIONSOURCETYPE 19 + +struct Condition +{ + ConditionSourceType mSourceType; //SourceTypeOrReferenceId + uint32 mSourceGroup; + uint32 mSourceEntry; + uint32 mElseGroup; + ConditionType mConditionType; //ConditionTypeOrReference + uint32 mConditionValue1; + uint32 mConditionValue2; + uint32 mConditionValue3; + uint32 ErrorTextd; + uint32 mReferenceId; + + Condition() + { + mSourceType = CONDITION_SOURCE_TYPE_NONE; + mSourceGroup = 0; + mSourceEntry = 0; + mElseGroup = 0; + mConditionType = CONDITION_NONE; + mConditionValue1 = 0; + mConditionValue2 = 0; + mConditionValue3 = 0; + mReferenceId = 0; + ErrorTextd = 0; + } + bool Meets(Player * player, Unit* targetOverride = NULL); + bool isLoaded() { return mConditionType > CONDITION_NONE || mReferenceId; } +}; + +typedef std::list ConditionList; +typedef std::map ConditionTypeMap; +typedef std::map ConditionMap;//used for all conditions, except references + +typedef std::map ConditionReferenceMap;//only used for references + +class ConditionMgr +{ + friend class ACE_Singleton; + ConditionMgr(); + + public: + ~ConditionMgr(); + + void LoadConditions(bool isReload = false); + bool isConditionTypeValid(Condition* cond); + ConditionList GetConditionReferences(uint32 refId); + + bool IsPlayerMeetToConditions(Player* player, ConditionList conditions, Unit* targetOverride = NULL); + ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sType, uint32 uEntry); + + protected: + ConditionMap m_ConditionMap; + ConditionReferenceMap m_ConditionReferenceMap; + + private: + bool isSourceTypeValid(Condition* cond); + bool addToLootTemplate(Condition* cond, LootTemplate* loot); + bool addToGossipMenus(Condition* cond); + bool addToGossipMenuItems(Condition* cond); + bool IsPlayerMeetToConditionList(Player* player,const ConditionList& conditions, Unit* targetOverride = NULL); + + bool isGroupable(ConditionSourceType sourceType) + { + return (sourceType == CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU || + sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION); + } + + void Clean(); // free up resources + std::list m_AllocatedMemory; // some garbage collection :) +}; + +#define sConditionMgr (*ACE_Singleton::instance()) + +#endif diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h new file mode 100644 index 0000000..6637d6d --- /dev/null +++ b/src/server/game/DataStores/DBCEnums.h @@ -0,0 +1,404 @@ +/* +* Copyright (C) 2005-2009 MaNGOS +* +* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef DBCENUMS_H +#define DBCENUMS_H + +// Client expected level limitation, like as used in DBC item max levels for "until max player level" +// use as default max player level, must be fit max level for used client +// also see MAX_LEVEL and STRONG_MAX_LEVEL define +#define DEFAULT_MAX_LEVEL 80 + +// client supported max level for player/pets/etc. Avoid overflow or client stability affected. +// also see GT_MAX_LEVEL define +#define MAX_LEVEL 100 + +// Server side limitation. Base at used code requirements. +// also see MAX_LEVEL and GT_MAX_LEVEL define +#define STRONG_MAX_LEVEL 255 + +enum BattleGroundBracketId // bracketId for level ranges +{ + BG_BRACKET_ID_FIRST = 0, + BG_BRACKET_ID_LAST = 15 +}; + +// must be max value in PvPDificulty slot+1 +#define MAX_BATTLEGROUND_BRACKETS 16 + +enum AreaTeams +{ + AREATEAM_NONE = 0, + AREATEAM_ALLY = 2, + AREATEAM_HORDE = 4 +}; + +enum AchievementFaction +{ + ACHIEVEMENT_FACTION_HORDE = 0, + ACHIEVEMENT_FACTION_ALLIANCE = 1, + ACHIEVEMENT_FACTION_ANY = -1, +}; + +enum AchievementFlags +{ + ACHIEVEMENT_FLAG_COUNTER = 0x00000001, // Just count statistic (never stop and complete) + ACHIEVEMENT_FLAG_TRACKING = 0x00000002, // Not sent to client - internal use only + ACHIEVEMENT_FLAG_STORE_MAX_VALUE = 0x00000004, // Store only max value? used only in "Reach level xx" + ACHIEVEMENT_FLAG_SUMM = 0x00000008, // Use summ criteria value from all reqirements (and calculate max value) + ACHIEVEMENT_FLAG_MAX_USED = 0x00000010, // Show max criteria (and calculate max value ??) + ACHIEVEMENT_FLAG_REQ_COUNT = 0x00000020, // Use not zero req count (and calculate max value) + ACHIEVEMENT_FLAG_AVERAGE = 0x00000040, // Show as average value (value / time_in_days) depend from other flag (by def use last criteria value) + ACHIEVEMENT_FLAG_BAR = 0x00000080, // Show as progress bar (value / max vale) depend from other flag (by def use last criteria value) + ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, // + ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200, // +}; + +enum AchievementCriteriaCondition +{ + ACHIEVEMENT_CRITERIA_CONDITION_NONE = 0, + ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH = 1, + ACHIEVEMENT_CRITERIA_CONDITION_UNK1 = 2, // only used in "Complete a daily quest every day for five consecutive days" + ACHIEVEMENT_CRITERIA_CONDITION_MAP = 3, // requires you to be on specific map + ACHIEVEMENT_CRITERIA_CONDITION_NO_LOOSE = 4, // only used in "Win 10 arenas without losing" + ACHIEVEMENT_CRITERIA_CONDITION_UNK2 = 9, // unk + ACHIEVEMENT_CRITERIA_CONDITION_UNK3 = 13, // unk +}; + +enum AchievementCriteriaCompletionFlags +{ + ACHIEVEMENT_CRITERIA_FLAG_SHOW_PROGRESS_BAR = 0x00000001, // Show progress as bar + ACHIEVEMENT_CRITERIA_FLAG_HIDE_CRITERIA = 0x00000002, // Not show criteria in client + ACHIEVEMENT_CRITERIA_FLAG_UNK3 = 0x00000004, // BG related?? + ACHIEVEMENT_CRITERIA_FLAG_UNK4 = 0x00000008, // + ACHIEVEMENT_CRITERIA_FLAG_UNK5 = 0x00000010, // not used + ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER = 0x00000020, // Displays counter as money +}; + +enum AchievementCriteriaTimedTypes +{ + ACHIEVEMENT_TIMED_TYPE_EVENT = 1, // Timer is started by internal event with id in timerStartEvent + ACHIEVEMENT_TIMED_TYPE_QUEST = 2, // Timer is started by acceting quest with entry in timerStartEvent + ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER = 5, // Timer is started by casting a spell with entry in timerStartEvent + ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET = 6, // Timer is started by being target of spell with entry in timerStartEvent + ACHIEVEMENT_TIMED_TYPE_CREATURE = 7, // Timer is started by killing creature with entry in timerStartEvent + ACHIEVEMENT_TIMED_TYPE_ITEM = 9, // Timer is started by using item with entry in timerStartEvent + + ACHIEVEMENT_TIMED_TYPE_MAX, +}; + +enum AchievementCriteriaTypes +{ + ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE = 0, + ACHIEVEMENT_CRITERIA_TYPE_WIN_BG = 1, + ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL = 5, + ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL = 7, + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT = 8, + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT = 9, + // you have to complete a daily quest x times in a row + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY = 10, + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE = 11, + ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE = 13, + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST = 14, + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND= 15, + ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP= 16, + ACHIEVEMENT_CRITERIA_TYPE_DEATH= 17, + ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON = 18, + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID = 19, + ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE = 20, + ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER = 23, + ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING = 24, + ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM = 26, + ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST = 27, + ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET = 28, + ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL= 29, + ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE = 30, + ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA = 31, + ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32, + ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33, + ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34, + // TODO: this criteria has additional conditions which can not be found in the dbcs + ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL = 35, + ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36, + // TODO: the archievements 1162 and 1163 requires a special rating which can't be found in the dbc + ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38, + ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING = 39, + ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40, + ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM = 41, + ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM= 42, + ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA = 43, + ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK= 44, + ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT= 45, + ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION= 46, + ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION= 47, + // noted: rewarded as soon as the player payed, not at taking place at the seat + ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP= 48, + ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM = 49, + // TODO: itemlevel is mentioned in text but not present in dbc + ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50, + ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT= 51, + ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS = 52, + ACHIEVEMENT_CRITERIA_TYPE_HK_RACE = 53, + ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE = 54, + ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE = 55, + // TODO: in some cases map not present, and in some cases need do without die + ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS = 56, + ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM = 57, + ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS = 59, + ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS = 60, + ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS = 61, + ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD = 62, + ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING = 63, + ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER = 65, + ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL = 66, + ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY = 67, + ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT = 68, + ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2= 69, + ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL= 70, + ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT = 72, + // TODO: title id is not mentioned in dbc + ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE = 74, + ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS= 75, + ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL = 76, + ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL = 77, + // TODO: creature type (demon, undead etc.) is not stored in dbc + ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE = 78, + ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS= 80, + ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION= 82, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID= 83, + ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS= 84, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD = 85, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED = 86, + ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION = 87, + ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION = 88, + ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS = 89, + ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM = 90, + ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM = 91, + ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED = 93, + ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED = 94, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH = 95, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER = 96, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT = 97, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER = 98, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR = 99, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING = 100, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT = 101, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED = 102, + ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED = 103, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED = 104, + ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED = 105, + ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED = 106, + ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED = 107, + ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN = 108, + ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE = 109, + // TODO: target entry is missing + ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2 = 110, + ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE= 112, + ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113, + ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114, + // 0..115 => 116 criteria types total + ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS = 115, + ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS = 119, + // 120 + // 121 + // 122 + // 123 + // 0..123 => 124 criteria types total + ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 124, +}; + +enum AreaFlags +{ + AREA_FLAG_SNOW = 0x00000001, // snow (only Dun Morogh, Naxxramas, Razorfen Downs and Winterspring) + AREA_FLAG_UNK1 = 0x00000002, // may be necropolis? + AREA_FLAG_UNK2 = 0x00000004, // Only used for areas on map 571 (development before) + AREA_FLAG_SLAVE_CAPITAL = 0x00000008, // city and city subsones + AREA_FLAG_UNK3 = 0x00000010, // can't find common meaning + AREA_FLAG_SLAVE_CAPITAL2 = 0x00000020, // slave capital city flag? + AREA_FLAG_UNK4 = 0x00000040, // many zones have this flag + AREA_FLAG_ARENA = 0x00000080, // arena, both instanced and world arenas + AREA_FLAG_CAPITAL = 0x00000100, // main capital city flag + AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) + AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) + AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled) + AREA_FLAG_NEED_FLY = 0x00001000, // only Netherwing Ledge, Socrethar's Seat, Tempest Keep, The Arcatraz, The Botanica, The Mechanar, Sorrow Wing Point, Dragonspine Ridge, Netherwing Mines, Dragonmaw Base Camp, Dragonmaw Skyway + AREA_FLAG_UNUSED1 = 0x00002000, // not used now (no area/zones with this flag set in 3.0.3) + AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) + AREA_FLAG_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area) + AREA_FLAG_ARENA_INSTANCE = 0x00010000, // used by instanced arenas only + AREA_FLAG_UNUSED2 = 0x00020000, // not used now (no area/zones with this flag set in 3.0.3) + AREA_FLAG_UNK5 = 0x00040000, // only used for Amani Pass, Hatchet Hills + AREA_FLAG_UNK6 = 0x00080000, // Valgarde and Acherus: The Ebon Hold + AREA_FLAG_LOWLEVEL = 0x00100000, // used for some starting areas with area_level <= 15 + AREA_FLAG_TOWN = 0x00200000, // small towns with Inn + AREA_FLAG_UNK7 = 0x00400000, // Warsong Hold, Acherus: The Ebon Hold, New Agamand Inn, Vengeance Landing Inn + AREA_FLAG_UNK8 = 0x00800000, // Westguard Inn, Acherus: The Ebon Hold, Valgarde + AREA_FLAG_OUTDOOR_PVP = 0x01000000, // Wintergrasp and it's subzones + AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors + AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors + AREA_FLAG_OUTDOOR_PVP2 = 0x08000000, // Wintergrasp and it's subzones + AREA_FLAG_NO_FLY_ZONE = 0x20000000 // Marks zones where you cannot fly +}; + +enum Difficulty +{ + REGULAR_DIFFICULTY = 0, + + DUNGEON_DIFFICULTY_NORMAL = 0, + DUNGEON_DIFFICULTY_HEROIC = 1, + DUNGEON_DIFFICULTY_EPIC = 2, + + RAID_DIFFICULTY_10MAN_NORMAL = 0, + RAID_DIFFICULTY_25MAN_NORMAL = 1, + RAID_DIFFICULTY_10MAN_HEROIC = 2, + RAID_DIFFICULTY_25MAN_HEROIC = 3, +}; + +#define MAX_DUNGEON_DIFFICULTY 3 +#define MAX_RAID_DIFFICULTY 4 +#define MAX_DIFFICULTY 4 + +enum SpawnMask +{ + SPAWNMASK_CONTINENT = (1 << REGULAR_DIFFICULTY),// any any maps without spawn modes + + SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL), + SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC), + SPAWNMASK_DUNGEON_ALL = (SPAWNMASK_DUNGEON_NORMAL | SPAWNMASK_DUNGEON_HEROIC), + + SPAWNMASK_RAID_10MAN_NORMAL = (1 << RAID_DIFFICULTY_10MAN_NORMAL), + SPAWNMASK_RAID_25MAN_NORMAL = (1 << RAID_DIFFICULTY_25MAN_NORMAL), + SPAWNMASK_RAID_NORMAL_ALL = (SPAWNMASK_RAID_10MAN_NORMAL | SPAWNMASK_RAID_25MAN_NORMAL), + + SPAWNMASK_RAID_10MAN_HEROIC = (1 << RAID_DIFFICULTY_10MAN_HEROIC), + SPAWNMASK_RAID_25MAN_HEROIC = (1 << RAID_DIFFICULTY_25MAN_HEROIC), + SPAWNMASK_RAID_HEROIC_ALL = (SPAWNMASK_RAID_10MAN_HEROIC | SPAWNMASK_RAID_25MAN_HEROIC), + + SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL), +}; + +enum FactionTemplateFlags +{ + FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP + FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats +}; + +enum FactionMasks +{ + FACTION_MASK_PLAYER = 1, // any player + FACTION_MASK_ALLIANCE = 2, // player or creature from alliance team + FACTION_MASK_HORDE = 4, // player or creature from horde team + FACTION_MASK_MONSTER = 8 // aggressive creature from monster team + // if none flags set then non-aggressive creature +}; + +enum MapTypes // Lua_IsInInstance +{ + MAP_COMMON = 0, // none + MAP_INSTANCE = 1, // party + MAP_RAID = 2, // raid + MAP_BATTLEGROUND = 3, // pvp + MAP_ARENA = 4 // arena +}; + +enum AbilytyLearnType +{ + ABILITY_LEARNED_ON_GET_PROFESSION_SKILL = 1, + ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2 +}; + +enum ItemEnchantmentType +{ + ITEM_ENCHANTMENT_TYPE_NONE = 0, + ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL = 1, + ITEM_ENCHANTMENT_TYPE_DAMAGE = 2, + ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL = 3, + ITEM_ENCHANTMENT_TYPE_RESISTANCE = 4, + ITEM_ENCHANTMENT_TYPE_STAT = 5, + ITEM_ENCHANTMENT_TYPE_TOTEM = 6, + ITEM_ENCHANTMENT_TYPE_USE_SPELL = 7, + ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET = 8 +}; + +enum TotemCategoryType +{ + TOTEM_CATEGORY_TYPE_KNIFE = 1, + TOTEM_CATEGORY_TYPE_TOTEM = 2, + TOTEM_CATEGORY_TYPE_ROD = 3, + TOTEM_CATEGORY_TYPE_PICK = 21, + TOTEM_CATEGORY_TYPE_STONE = 22, + TOTEM_CATEGORY_TYPE_HAMMER = 23, + TOTEM_CATEGORY_TYPE_SPANNER = 24 +}; + +// SummonProperties.dbc, col 1 +enum SummonPropGroup +{ + SUMMON_PROP_GROUP_UNKNOWN1 = 0, // 1160 spells in 3.0.3 + SUMMON_PROP_GROUP_UNKNOWN2 = 1, // 861 spells in 3.0.3 + SUMMON_PROP_GROUP_PETS = 2, // 52 spells in 3.0.3, pets mostly + SUMMON_PROP_GROUP_CONTROLLABLE = 3, // 13 spells in 3.0.3, mostly controllable + SUMMON_PROP_GROUP_UNKNOWN3 = 4 // 86 spells in 3.0.3, taxi/mounts +}; + +// SummonProperties.dbc, col 3 +enum SummonPropType +{ + SUMMON_PROP_TYPE_UNKNOWN = 0, // different summons, 1330 spells in 3.0.3 + SUMMON_PROP_TYPE_SUMMON = 1, // generic summons, 49 spells in 3.0.3 + SUMMON_PROP_TYPE_GUARDIAN = 2, // summon guardian, 393 spells in 3.0.3 + SUMMON_PROP_TYPE_ARMY = 3, // summon army, 5 spells in 3.0.3 + SUMMON_PROP_TYPE_TOTEM = 4, // summon totem, 169 spells in 3.0.3 + SUMMON_PROP_TYPE_CRITTER = 5, // critter/minipet, 195 spells in 3.0.3 + SUMMON_PROP_TYPE_DK = 6, // summon DRW/Ghoul, 2 spells in 3.0.3 + SUMMON_PROP_TYPE_BOMB = 7, // summon bot/bomb, 4 spells in 3.0.3 + SUMMON_PROP_TYPE_PHASING = 8, // something todo with DK prequest line, 2 spells in 3.0.3 + SUMMON_PROP_TYPE_SIEGE_VEH = 9, // summon different vehicles, 14 spells in 3.0.3 + SUMMON_PROP_TYPE_DRAKE_VEH = 10, // summon drake (vehicle), 3 spells + SUMMON_PROP_TYPE_LIGHTWELL = 11 // summon lightwell, 6 spells in 3.0.3 +}; + +// SummonProperties.dbc, col 5 +enum SummonPropFlags +{ + SUMMON_PROP_FLAG_NONE = 0x0000, // 1342 spells in 3.0.3 + SUMMON_PROP_FLAG_UNK1 = 0x0001, // 75 spells in 3.0.3, something unfriendly + SUMMON_PROP_FLAG_UNK2 = 0x0002, // 616 spells in 3.0.3, something friendly + SUMMON_PROP_FLAG_UNK3 = 0x0004, // 22 spells in 3.0.3, no idea... + SUMMON_PROP_FLAG_UNK4 = 0x0008, // 49 spells in 3.0.3, some mounts + SUMMON_PROP_FLAG_UNK5 = 0x0010, // 25 spells in 3.0.3, quest related? + SUMMON_PROP_FLAG_UNK6 = 0x0020, // 0 spells in 3.0.3, unused + SUMMON_PROP_FLAG_UNK7 = 0x0040, // 12 spells in 3.0.3, no idea + SUMMON_PROP_FLAG_UNK8 = 0x0080, // 4 spells in 3.0.3, no idea + SUMMON_PROP_FLAG_UNK9 = 0x0100, // 51 spells in 3.0.3, no idea, many quest related + SUMMON_PROP_FLAG_UNK10 = 0x0200, // 51 spells in 3.0.3, something defensive + SUMMON_PROP_FLAG_UNK11 = 0x0400, // 3 spells, requires something near? + SUMMON_PROP_FLAG_UNK12 = 0x0800, // 30 spells in 3.0.3, no idea + SUMMON_PROP_FLAG_UNK13 = 0x1000, // 8 spells in 3.0.3, siege vehicle + SUMMON_PROP_FLAG_UNK14 = 0x2000, // 2 spells in 3.0.3, escort? +}; + +enum SpellEffectIndex +{ + EFFECT_INDEX_0 = 0, + EFFECT_INDEX_1 = 1, + EFFECT_INDEX_2 = 2 +}; + +#endif diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp new file mode 100755 index 0000000..4ddccd7 --- /dev/null +++ b/src/server/game/DataStores/DBCStores.cpp @@ -0,0 +1,835 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "DBCStores.h" + +#include "Logging/Log.h" +#include "ProgressBar.h" +#include "SharedDefines.h" +#include "SpellMgr.h" + +#include "DBCfmt.h" + +#include + +typedef std::map AreaFlagByAreaID; +typedef std::map AreaFlagByMapID; + +struct WMOAreaTableTripple +{ + WMOAreaTableTripple(int32 r, int32 a, int32 g) : rootId(r), adtId(a), groupId(g) + { + } + + bool operator <(const WMOAreaTableTripple& b) const + { + return memcmp(this, &b, sizeof(WMOAreaTableTripple))<0; + } + + // ordered by entropy; that way memcmp will have a minimal medium runtime + int32 groupId; + int32 rootId; + int32 adtId; +}; + +typedef std::map WMOAreaInfoByTripple; + +DBCStorage sAreaStore(AreaTableEntryfmt); +DBCStorage sAreaGroupStore(AreaGroupEntryfmt); +DBCStorage sAreaPOIStore(AreaPOIEntryfmt); +static AreaFlagByAreaID sAreaFlagByAreaID; +static AreaFlagByMapID sAreaFlagByMapID; // for instances without generated *.map files + +static WMOAreaInfoByTripple sWMOAreaInfoByTripple; + +DBCStorage sAchievementStore(Achievementfmt); +DBCStorage sAchievementCriteriaStore(AchievementCriteriafmt); +DBCStorage sAreaTriggerStore(AreaTriggerEntryfmt); +DBCStorage sAuctionHouseStore(AuctionHouseEntryfmt); +DBCStorage sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt); +DBCStorage sBattlemasterListStore(BattlemasterListEntryfmt); +DBCStorage sBarberShopStyleStore(BarberShopStyleEntryfmt); +DBCStorage sCharStartOutfitStore(CharStartOutfitEntryfmt); +DBCStorage sCharTitlesStore(CharTitlesEntryfmt); +DBCStorage sChatChannelsStore(ChatChannelsEntryfmt); +DBCStorage sChrClassesStore(ChrClassesEntryfmt); +DBCStorage sChrRacesStore(ChrRacesEntryfmt); +DBCStorage sCinematicSequencesStore(CinematicSequencesEntryfmt); +DBCStorage sCreatureDisplayInfoStore(CreatureDisplayInfofmt); +DBCStorage sCreatureFamilyStore(CreatureFamilyfmt); +DBCStorage sCreatureSpellDataStore(CreatureSpellDatafmt); +DBCStorage sCreatureTypeStore(CreatureTypefmt); +DBCStorage sCurrencyTypesStore(CurrencyTypesfmt); + +DBCStorage sDurabilityQualityStore(DurabilityQualityfmt); +DBCStorage sDurabilityCostsStore(DurabilityCostsfmt); + +DBCStorage sEmotesStore(EmotesEntryfmt); +DBCStorage sEmotesTextStore(EmotesTextEntryfmt); + +typedef std::map FactionTeamMap; +static FactionTeamMap sFactionTeamMap; +DBCStorage sFactionStore(FactionEntryfmt); +DBCStorage sFactionTemplateStore(FactionTemplateEntryfmt); + +DBCStorage sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt); +DBCStorage sGemPropertiesStore(GemPropertiesEntryfmt); +DBCStorage sGlyphPropertiesStore(GlyphPropertiesfmt); +DBCStorage sGlyphSlotStore(GlyphSlotfmt); + +DBCStorage sGtBarberShopCostBaseStore(GtBarberShopCostBasefmt); +DBCStorage sGtCombatRatingsStore(GtCombatRatingsfmt); +DBCStorage sGtChanceToMeleeCritBaseStore(GtChanceToMeleeCritBasefmt); +DBCStorage sGtChanceToMeleeCritStore(GtChanceToMeleeCritfmt); +DBCStorage sGtChanceToSpellCritBaseStore(GtChanceToSpellCritBasefmt); +DBCStorage sGtChanceToSpellCritStore(GtChanceToSpellCritfmt); +DBCStorage sGtOCTRegenHPStore(GtOCTRegenHPfmt); +//DBCStorage sGtOCTRegenMPStore(GtOCTRegenMPfmt); -- not used currently +DBCStorage sGtRegenHPPerSptStore(GtRegenHPPerSptfmt); +DBCStorage sGtRegenMPPerSptStore(GtRegenMPPerSptfmt); + +DBCStorage sHolidaysStore(Holidaysfmt); + +DBCStorage sItemStore(Itemfmt); +DBCStorage sItemBagFamilyStore(ItemBagFamilyfmt); +//DBCStorage sItemCondExtCostsStore(ItemCondExtCostsEntryfmt); +//DBCStorage sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently +DBCStorage sItemExtendedCostStore(ItemExtendedCostEntryfmt); +DBCStorage sItemLimitCategoryStore(ItemLimitCategoryEntryfmt); +DBCStorage sItemRandomPropertiesStore(ItemRandomPropertiesfmt); +DBCStorage sItemRandomSuffixStore(ItemRandomSuffixfmt); +DBCStorage sItemSetStore(ItemSetEntryfmt); + +DBCStorage sLFGDungeonStore(LFGDungeonEntryfmt); + +DBCStorage sLockStore(LockEntryfmt); + +DBCStorage sMailTemplateStore(MailTemplateEntryfmt); +DBCStorage sMapStore(MapEntryfmt); + +// DBC used only for initialization sMapDifficultyMap at startup. +DBCStorage sMapDifficultyStore(MapDifficultyEntryfmt); // only for loading +MapDifficultyMap sMapDifficultyMap; + +DBCStorage sMovieStore(MovieEntryfmt); + +DBCStorage sPvPDifficultyStore(PvPDifficultyfmt); + +DBCStorage sQuestSortStore(QuestSortEntryfmt); +DBCStorage sQuestXPStore(QuestXPfmt); +DBCStorage sQuestFactionRewardStore(QuestFactionRewardfmt); +DBCStorage sRandomPropertiesPointsStore(RandomPropertiesPointsfmt); +DBCStorage sScalingStatDistributionStore(ScalingStatDistributionfmt); +DBCStorage sScalingStatValuesStore(ScalingStatValuesfmt); + +DBCStorage sSkillLineStore(SkillLinefmt); +DBCStorage sSkillLineAbilityStore(SkillLineAbilityfmt); + +DBCStorage sSoundEntriesStore(SoundEntriesfmt); + +DBCStorage sSpellItemEnchantmentStore(SpellItemEnchantmentfmt); +DBCStorage sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt); +DBCStorage sSpellStore(SpellEntryfmt); +SpellCategoryStore sSpellCategoryStore; +PetFamilySpellsStore sPetFamilySpellsStore; + +DBCStorage sSpellCastTimesStore(SpellCastTimefmt); +DBCStorage sSpellDifficultyStore(SpellDifficultyfmt); +DBCStorage sSpellDurationStore(SpellDurationfmt); +DBCStorage sSpellFocusObjectStore(SpellFocusObjectfmt); +DBCStorage sSpellRadiusStore(SpellRadiusfmt); +DBCStorage sSpellRangeStore(SpellRangefmt); +DBCStorage sSpellRuneCostStore(SpellRuneCostfmt); +DBCStorage sSpellShapeshiftStore(SpellShapeshiftfmt); +DBCStorage sStableSlotPricesStore(StableSlotPricesfmt); +DBCStorage sSummonPropertiesStore(SummonPropertiesfmt); +DBCStorage sTalentStore(TalentEntryfmt); +TalentSpellPosMap sTalentSpellPosMap; +DBCStorage sTalentTabStore(TalentTabEntryfmt); + +// store absolute bit position for first rank for talent inspect +static uint32 sTalentTabPages[MAX_CLASSES][3]; + +DBCStorage sTaxiNodesStore(TaxiNodesEntryfmt); +TaxiMask sTaxiNodesMask; +TaxiMask sOldContinentsNodesMask; + +// DBC used only for initialization sTaxiPathSetBySource at startup. +TaxiPathSetBySource sTaxiPathSetBySource; +DBCStorage sTaxiPathStore(TaxiPathEntryfmt); + +// DBC used only for initialization sTaxiPathNodeStore at startup. +TaxiPathNodesByPath sTaxiPathNodesByPath; +static DBCStorage sTaxiPathNodeStore(TaxiPathNodeEntryfmt); + +DBCStorage sTotemCategoryStore(TotemCategoryEntryfmt); +DBCStorage sVehicleStore(VehicleEntryfmt); +DBCStorage sVehicleSeatStore(VehicleSeatEntryfmt); +DBCStorage sWMOAreaTableStore(WMOAreaTableEntryfmt); +DBCStorage sWorldMapAreaStore(WorldMapAreaEntryfmt); +DBCStorage sWorldMapOverlayStore(WorldMapOverlayEntryfmt); +DBCStorage sWorldSafeLocsStore(WorldSafeLocsEntryfmt); + +typedef std::list StoreProblemList; + +static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& filename) +{ + sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize); + + // assert must fail after function call + return false; +} + +template +inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, const std::string& dbc_path, const std::string& filename, const std::string * custom_entries = NULL, const std::string * idname = NULL) +{ + // compatibility format and C++ structure sizes + assert(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename)); + + std::string dbc_filename = dbc_path + filename; + SqlDbc * sql = NULL; + if (custom_entries) + sql = new SqlDbc(&filename,custom_entries, idname,storage.GetFormat()); + + if (storage.Load(dbc_filename.c_str(), sql)) + { + bar.step(); + for (uint8 i = 0; i < MAX_LOCALE; ++i) + { + if (!(availableDbcLocales & (1 << i))) + continue; + + std::string dbc_filename_loc = dbc_path + localeNames[i] + "/" + filename; + if (!storage.LoadStringsFrom(dbc_filename_loc.c_str())) + availableDbcLocales &= ~(1<DBC records + sAreaFlagByAreaID.insert(AreaFlagByAreaID::value_type(uint16(area->ID),area->exploreFlag)); + + // fill MapId->DBC records (skip sub zones and continents) + if (area->zone == 0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571) + sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid,area->exploreFlag)); + } + } + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementStore, dbcPath,"Achievement.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAchievementCriteriaStore, dbcPath,"Achievement_Criteria.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaTriggerStore, dbcPath,"AreaTrigger.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaGroupStore, dbcPath,"AreaGroup.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAreaPOIStore, dbcPath,"AreaPOI.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sAuctionHouseStore, dbcPath,"AuctionHouse.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBankBagSlotPricesStore, dbcPath,"BankBagSlotPrices.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBattlemasterListStore, dbcPath,"BattlemasterList.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sBarberShopStyleStore, dbcPath,"BarberShopStyle.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharStartOutfitStore, dbcPath,"CharStartOutfit.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCharTitlesStore, dbcPath,"CharTitles.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChatChannelsStore, dbcPath,"ChatChannels.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrClassesStore, dbcPath,"ChrClasses.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrRacesStore, dbcPath,"ChrRaces.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCinematicSequencesStore, dbcPath,"CinematicSequences.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureDisplayInfoStore, dbcPath,"CreatureDisplayInfo.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureFamilyStore, dbcPath,"CreatureFamily.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureSpellDataStore, dbcPath,"CreatureSpellData.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCreatureTypeStore, dbcPath,"CreatureType.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sCurrencyTypesStore, dbcPath,"CurrencyTypes.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityCostsStore, dbcPath,"DurabilityCosts.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sDurabilityQualityStore, dbcPath,"DurabilityQuality.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sEmotesStore, dbcPath,"Emotes.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sEmotesTextStore, dbcPath,"EmotesText.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionStore, dbcPath,"Faction.dbc"); + for (uint32 i=0; iteam) + { + SimpleFactionsList &flist = sFactionTeamMap[faction->team]; + flist.push_back(i); + } + } + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionTemplateStore, dbcPath,"FactionTemplate.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGameObjectDisplayInfoStore, dbcPath,"GameObjectDisplayInfo.dbc"); + for (uint32 i = 0; i < sGameObjectDisplayInfoStore.GetNumRows(); ++i) + { + if (GameObjectDisplayInfoEntry const * info = sGameObjectDisplayInfoStore.LookupEntry(i)) + { + if (info->maxX < info->minX) + std::swap(*(float*)(&info->maxX), *(float*)(&info->minX)); + if (info->maxY < info->minY) + std::swap(*(float*)(&info->maxY), *(float*)(&info->minY)); + if (info->maxZ < info->minZ) + std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ)); + } + } + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGemPropertiesStore, dbcPath,"GemProperties.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphPropertiesStore, dbcPath,"GlyphProperties.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphSlotStore, dbcPath,"GlyphSlot.dbc"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtBarberShopCostBaseStore,dbcPath,"gtBarberShopCostBase.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtCombatRatingsStore, dbcPath,"gtCombatRatings.dbc"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToMeleeCritBaseStore, dbcPath,"gtChanceToMeleeCritBase.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToMeleeCritStore, dbcPath,"gtChanceToMeleeCrit.dbc"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToSpellCritBaseStore, dbcPath,"gtChanceToSpellCritBase.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtChanceToSpellCritStore, dbcPath,"gtChanceToSpellCrit.dbc"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenHPStore, dbcPath,"gtOCTRegenHP.dbc"); + //LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtOCTRegenMPStore, dbcPath,"gtOCTRegenMP.dbc"); -- not used currently + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtRegenHPPerSptStore, dbcPath,"gtRegenHPPerSpt.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGtRegenMPPerSptStore, dbcPath,"gtRegenMPPerSpt.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sHolidaysStore, dbcPath,"Holidays.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemStore, dbcPath,"Item.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemBagFamilyStore, dbcPath,"ItemBagFamily.dbc"); + //LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemDisplayInfoStore, dbcPath,"ItemDisplayInfo.dbc"); -- not used currently + //LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemCondExtCostsStore, dbcPath,"ItemCondExtCosts.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemExtendedCostStore, dbcPath,"ItemExtendedCost.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemLimitCategoryStore, dbcPath,"ItemLimitCategory.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemRandomPropertiesStore,dbcPath,"ItemRandomProperties.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemRandomSuffixStore, dbcPath,"ItemRandomSuffix.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sItemSetStore, dbcPath,"ItemSet.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sLFGDungeonStore, dbcPath,"LFGDungeons.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sLockStore, dbcPath,"Lock.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMailTemplateStore, dbcPath,"MailTemplate.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapStore, dbcPath,"Map.dbc"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMapDifficultyStore, dbcPath,"MapDifficulty.dbc"); + // fill data + for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i) + if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i)) + sMapDifficultyMap[MAKE_PAIR32(entry->MapId,entry->Difficulty)] = MapDifficulty(entry->resetTime,entry->maxPlayers); + sMapDifficultyStore.Clear(); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMovieStore, dbcPath,"Movie.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore, dbcPath,"QuestSort.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sPvPDifficultyStore, dbcPath,"PvpDifficulty.dbc"); + for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) + if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS) + assert(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestXPStore, dbcPath,"QuestXP.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestFactionRewardStore, dbcPath,"QuestFactionReward.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sRandomPropertiesPointsStore, dbcPath,"RandPropPoints.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatDistributionStore, dbcPath,"ScalingStatDistribution.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatValuesStore, dbcPath,"ScalingStatValues.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineStore, dbcPath,"SkillLine.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineAbilityStore, dbcPath,"SkillLineAbility.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSoundEntriesStore, dbcPath,"SoundEntries.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellStore, dbcPath,"Spell.dbc", &CustomSpellEntryfmt, &CustomSpellEntryIndex); + for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) + { + SpellEntry const * spell = sSpellStore.LookupEntry(i); + if (spell && spell->Category) + sSpellCategoryStore[spell->Category].insert(i); + } + + for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + { + SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); + + if (!skillLine) + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); + + if (spellInfo && IsPassiveSpell(spellInfo->Id)) + { + for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i) + { + CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i); + if (!cFamily) + continue; + + if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1]) + continue; + if (spellInfo->spellLevel) + continue; + + if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL) + continue; + + sPetFamilySpellsStore[i].insert(spellInfo->Id); + } + } + } + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellCastTimesStore, dbcPath,"SpellCastTimes.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDifficultyStore, dbcPath,"SpellDifficulty.dbc", &CustomSpellDifficultyfmt, &CustomSpellDifficultyIndex); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDurationStore, dbcPath,"SpellDuration.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellFocusObjectStore, dbcPath,"SpellFocusObject.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentStore,dbcPath,"SpellItemEnchantment.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentConditionStore,dbcPath,"SpellItemEnchantmentCondition.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRadiusStore, dbcPath,"SpellRadius.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRangeStore, dbcPath,"SpellRange.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRuneCostStore, dbcPath,"SpellRuneCost.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftStore, dbcPath,"SpellShapeshiftForm.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore, dbcPath,"StableSlotPrices.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentStore, dbcPath,"Talent.dbc"); + + // Create Spelldifficulty searcher + for (uint32 i = 0; i < sSpellDifficultyStore.GetNumRows(); ++i) + { + SpellDifficultyEntry const *spellDiff = sSpellDifficultyStore.LookupEntry(i); + if (!spellDiff) + continue; + + SpellDifficultyEntry newEntry; + for (int x = 0; x < MAX_DIFFICULTY; ++x) + { + if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x])) + { + if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values + sLog.outErrorDb("spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x); + newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0 + } else newEntry.SpellID[x] = spellDiff->SpellID[x]; + } + if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0)//id0-1 must be always set! + continue; + + for (int x = 0; x < MAX_DIFFICULTY; ++x) + spellmgr.SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID); + } + + // create talent spells set + for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) + { + TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + if (!talentInfo) continue; + for (int j = 0; j < MAX_TALENT_RANK; j++) + if (talentInfo->RankID[j]) + sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i,j); + } + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentTabStore, dbcPath,"TalentTab.dbc"); + + // prepare fast data access to bit pos of talent ranks for use at inspecting + { + // now have all max ranks (and then bit amount used for store talent ranks in inspect) + for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId) + { + TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); + if (!talentTabInfo) + continue; + + // prevent memory corruption; otherwise cls will become 12 below + if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0) + continue; + + // store class talent tab pages + uint32 cls = 1; + for (uint32 m=1; !(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES; m <<= 1, ++cls) {} + + sTalentTabPages[cls][talentTabInfo->tabpage]=talentTabId; + } + } + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiNodesStore, dbcPath,"TaxiNodes.dbc"); + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathStore, dbcPath,"TaxiPath.dbc"); + for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i) + if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i)) + sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID,entry->price); + uint32 pathCount = sTaxiPathStore.GetNumRows(); + + //## TaxiPathNode.dbc ## Loaded only for initialization different structures + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTaxiPathNodeStore, dbcPath,"TaxiPathNode.dbc"); + // Calculate path nodes count + std::vector pathLength; + pathLength.resize(pathCount); // 0 and some other indexes not used + for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) + if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) + { + if (pathLength[entry->path] < entry->index + 1) + pathLength[entry->path] = entry->index + 1; + } + // Set path length + sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used + for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i) + sTaxiPathNodesByPath[i].resize(pathLength[i]); + // fill data + for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) + if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) + sTaxiPathNodesByPath[entry->path].set(entry->index, entry); + + // Initialize global taxinodes mask + // include existed nodes that have at least single not spell base (scripted) path + { + std::set spellPaths; + for (uint32 i = 1; i < sSpellStore.GetNumRows (); ++i) + if (SpellEntry const* sInfo = sSpellStore.LookupEntry (i)) + for (int j=0; j < 3; ++j) + if (sInfo->Effect[j] == 123 /*SPELL_EFFECT_SEND_TAXI*/) + spellPaths.insert(sInfo->EffectMiscValue[j]); + + memset(sTaxiNodesMask,0,sizeof(sTaxiNodesMask)); + memset(sOldContinentsNodesMask,0,sizeof(sTaxiNodesMask)); + for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i) + { + TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i); + if (!node) + continue; + + TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i); + if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty()) + { + bool ok = false; + for (TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin(); dest_i != src_i->second.end(); ++dest_i) + { + // not spell path + if (spellPaths.find(dest_i->second.ID) == spellPaths.end()) + { + ok = true; + break; + } + } + + if (!ok) + continue; + } + + // valid taxi network node + uint8 field = (uint8)((i - 1) / 32); + uint32 submask = 1<<((i-1)%32); + sTaxiNodesMask[field] |= submask; + + // old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info) + if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94) + sOldContinentsNodesMask[field] |= submask; + + // fix DK node at Ebon Hold + if (i == 315) { + ((TaxiNodesEntry*)node)->MountCreatureID[1] = 32981; + } + } + } + + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTotemCategoryStore, dbcPath,"TotemCategory.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleStore, dbcPath,"Vehicle.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sVehicleSeatStore, dbcPath,"VehicleSeat.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWMOAreaTableStore, dbcPath,"WMOAreaTable.dbc"); + for(uint32 i = 0; i < sWMOAreaTableStore.GetNumRows(); ++i) + { + if(WMOAreaTableEntry const* entry = sWMOAreaTableStore.LookupEntry(i)) + { + sWMOAreaInfoByTripple.insert(WMOAreaInfoByTripple::value_type(WMOAreaTableTripple(entry->rootId, entry->adtId, entry->groupId), entry)); + } + } + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapAreaStore, dbcPath,"WorldMapArea.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldMapOverlayStore, dbcPath,"WorldMapOverlay.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sWorldSafeLocsStore, dbcPath,"WorldSafeLocs.dbc"); + + // error checks + if (bad_dbc_files.size() >= DBCFilesCount) + { + sLog.outError("\nIncorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc",DBCFilesCount,dataPath.c_str()); + exit(1); + } + else if (!bad_dbc_files.empty()) + { + std::string str; + for (std::list::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i) + str += *i + "\n"; + + sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s",(uint32)bad_dbc_files.size(),DBCFilesCount,str.c_str()); + exit(1); + } + + // Check loaded DBC files proper version + if (!sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.5a + !sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a + !sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a + !sItemStore.LookupEntry(56806) || // last gem property added in 3.3.5a + !sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a + !sMapStore.LookupEntry(724) || // last map added in 3.3.5a + !sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a + { + sLog.outError("\nYou have _outdated_ DBC files. Please extract correct versions from current using client."); + exit(1); + } + sLog.outString(); + sLog.outString(">> Initialized %d data stores", DBCFilesCount); +} + +SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember) +{ + for (FactionTeamMap::const_iterator itr = sFactionTeamMap.begin(); itr != sFactionTeamMap.end(); ++itr) + { + if (itr->first == faction) + { + isTeamMember = false; + return &itr->second; + } + for (SimpleFactionsList::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2) + { + if ((*itr2) == faction) + { + isTeamMember = true; + return &itr->second; + } + } + } + return NULL; +} + +char* GetPetName(uint32 petfamily, uint32 dbclang) +{ + if (!petfamily) + return NULL; + CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily); + if (!pet_family) + return NULL; + return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL; +} + +TalentSpellPos const* GetTalentSpellPos(uint32 spellId) +{ + TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId); + if (itr == sTalentSpellPosMap.end()) + return NULL; + + return &itr->second; +} + +uint32 GetTalentSpellCost(uint32 spellId) +{ + if (TalentSpellPos const* pos = GetTalentSpellPos(spellId)) + return pos->rank+1; + + return 0; +} + +int32 GetAreaFlagByAreaID(uint32 area_id) +{ + AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id); + if (i == sAreaFlagByAreaID.end()) + return -1; + + return i->second; +} + +WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid) +{ + WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid)); + if(i == sWMOAreaInfoByTripple.end()) + return NULL; + return i->second; +} + +AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id) +{ + int32 areaflag = GetAreaFlagByAreaID(area_id); + if (areaflag < 0) + return NULL; + + return sAreaStore.LookupEntry(areaflag); +} + +AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id) +{ + if (area_flag) + return sAreaStore.LookupEntry(area_flag); + + if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id)) + return GetAreaEntryByAreaID(mapEntry->linked_zone); + + return NULL; +} + +uint32 GetAreaFlagByMapId(uint32 mapid) +{ + AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid); + if (i == sAreaFlagByMapID.end()) + return 0; + else + return i->second; +} + +uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId) +{ + if (mapid != 530 && mapid != 571) // speed for most cases + return mapid; + + if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId)) + return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id; + + return mapid; +} + +ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) +{ + mapid = GetVirtualMapForMapAndZone(mapid,zoneId); + if (mapid < 2) + return CONTENT_1_60; + + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); + if (!mapEntry) + return CONTENT_1_60; + + switch(mapEntry->Expansion()) + { + default: return CONTENT_1_60; + case 1: return CONTENT_61_70; + case 2: return CONTENT_71_80; + } +} + +ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id) +{ + // not sorted, numbering index from 0 + for (uint32 i = 0; i < sChatChannelsStore.GetNumRows(); ++i) + { + ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i); + if (ch && ch->ChannelID == channel_id) + return ch; + } + return NULL; +} + +bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId) +{ + if (requiredTotemCategoryId == 0) + return true; + if (itemTotemCategoryId == 0) + return false; + + TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId); + if (!itemEntry) + return false; + TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId); + if (!reqEntry) + return false; + + if (itemEntry->categoryType != reqEntry->categoryType) + return false; + + return (itemEntry->categoryMask & reqEntry->categoryMask) == reqEntry->categoryMask; +} + +void Zone2MapCoordinates(float& x,float& y,uint32 zone) +{ + WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); + + // if not listed then map coordinates (instance) + if (!maEntry) + return; + + std::swap(x,y); // at client map coords swapped + x = x*((maEntry->x2-maEntry->x1)/100)+maEntry->x1; + y = y*((maEntry->y2-maEntry->y1)/100)+maEntry->y1; // client y coord from top to down +} + +void Map2ZoneCoordinates(float& x,float& y,uint32 zone) +{ + WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone); + + // if not listed then map coordinates (instance) + if (!maEntry) + return; + + x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100); + y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100); // client y coord from top to down + std::swap(x,y); // client have map coords swapped +} + +MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) +{ + MapDifficultyMap::const_iterator itr = sMapDifficultyMap.find(MAKE_PAIR32(mapId,difficulty)); + return itr != sMapDifficultyMap.end() ? &itr->second : NULL; +} + +PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level) +{ + // prevent out-of-range levels for dbc data + if (level > DEFAULT_MAX_LEVEL) + level = DEFAULT_MAX_LEVEL; + + for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) + if (entry->mapId == mapid && entry->minLevel <= level && entry->maxLevel >= level) + return entry; + + return NULL; +} + +PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id) +{ + for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) + if (entry->mapId == mapid && entry->GetBracketId() == id) + return entry; + + return NULL; +} + +uint32 const* GetTalentTabPages(uint8 cls) +{ + return sTalentTabPages[cls]; +} + +// script support functions + DBCStorage const* GetSoundEntriesStore() { return &sSoundEntriesStore; } + DBCStorage const* GetSpellStore() { return &sSpellStore; } + DBCStorage const* GetSpellRangeStore() { return &sSpellRangeStore; } + DBCStorage const* GetFactionStore() { return &sFactionStore; } + DBCStorage const* GetItemDisplayStore() { return &sItemStore; } + DBCStorage const* GetCreatureDisplayStore() { return &sCreatureDisplayInfoStore; } + DBCStorage const* GetEmotesStore() { return &sEmotesStore; } + DBCStorage const* GetEmotesTextStore() { return &sEmotesTextStore; } + DBCStorage const* GetAchievementStore() { return &sAchievementStore; } diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h new file mode 100644 index 0000000..1bda56f --- /dev/null +++ b/src/server/game/DataStores/DBCStores.h @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_DBCSTORES_H +#define TRINITY_DBCSTORES_H + +#include "Common.h" +#include "DBCStore.h" +#include "DBCStructure.h" + +#include + +typedef std::list SimpleFactionsList; + +SimpleFactionsList const* GetFactionTeamList(uint32 faction, bool &isTeamMember); +char* GetPetName(uint32 petfamily, uint32 dbclang); +uint32 GetTalentSpellCost(uint32 spellId); +TalentSpellPos const* GetTalentSpellPos(uint32 spellId); + +int32 GetAreaFlagByAreaID(uint32 area_id); // -1 if not found +AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id); +AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag,uint32 map_id); +uint32 GetAreaFlagByMapId(uint32 mapid); + +WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid, int32 groupid); + +uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId); + +enum ContentLevels +{ + CONTENT_1_60 = 0, + CONTENT_61_70, + CONTENT_71_80 +}; +ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); + +ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id); + +bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId); + +void Zone2MapCoordinates(float &x, float &y, uint32 zone); +void Map2ZoneCoordinates(float &x, float &y, uint32 zone); + +typedef std::map MapDifficultyMap; +MapDifficulty const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty); + +uint32 const* /*[3]*/ GetTalentTabPages(uint8 cls); + +PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level); +PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id); + +extern DBCStorage sAchievementStore; +extern DBCStorage sAchievementCriteriaStore; +extern DBCStorage sAreaStore;// recommend access using functions +extern DBCStorage sAreaGroupStore; +extern DBCStorage sAreaPOIStore; +extern DBCStorage sAreaTriggerStore; +extern DBCStorage sAuctionHouseStore; +extern DBCStorage sBankBagSlotPricesStore; +extern DBCStorage sBarberShopStyleStore; +extern DBCStorage sBattlemasterListStore; +//extern DBCStorage sChatChannelsStore; -- accessed using function, no usable index +extern DBCStorage sCharStartOutfitStore; +extern DBCStorage sCharTitlesStore; +extern DBCStorage sChrClassesStore; +extern DBCStorage sChrRacesStore; +extern DBCStorage sCinematicSequencesStore; +extern DBCStorage sCreatureDisplayInfoStore; +extern DBCStorage sCreatureFamilyStore; +extern DBCStorage sCreatureSpellDataStore; +extern DBCStorage sCreatureTypeStore; +extern DBCStorage sCurrencyTypesStore; +extern DBCStorage sDurabilityCostsStore; +extern DBCStorage sDurabilityQualityStore; +extern DBCStorage sEmotesStore; +extern DBCStorage sEmotesTextStore; +extern DBCStorage sFactionStore; +extern DBCStorage sFactionTemplateStore; +extern DBCStorage sGameObjectDisplayInfoStore; +extern DBCStorage sGemPropertiesStore; +extern DBCStorage sGlyphPropertiesStore; +extern DBCStorage sGlyphSlotStore; + +extern DBCStorage sGtBarberShopCostBaseStore; +extern DBCStorage sGtCombatRatingsStore; +extern DBCStorage sGtChanceToMeleeCritBaseStore; +extern DBCStorage sGtChanceToMeleeCritStore; +extern DBCStorage sGtChanceToSpellCritBaseStore; +extern DBCStorage sGtChanceToSpellCritStore; +extern DBCStorage sGtOCTRegenHPStore; +//extern DBCStorage sGtOCTRegenMPStore; -- not used currently +extern DBCStorage sGtRegenHPPerSptStore; +extern DBCStorage sGtRegenMPPerSptStore; +extern DBCStorage sHolidaysStore; +extern DBCStorage sItemStore; +extern DBCStorage sItemBagFamilyStore; +//extern DBCStorage sItemDisplayInfoStore; -- not used currently +extern DBCStorage sItemExtendedCostStore; +extern DBCStorage sItemLimitCategoryStore; +extern DBCStorage sItemRandomPropertiesStore; +extern DBCStorage sItemRandomSuffixStore; +extern DBCStorage sItemSetStore; +extern DBCStorage sLFGDungeonStore; +extern DBCStorage sLockStore; +extern DBCStorage sMailTemplateStore; +extern DBCStorage sMapStore; +//extern DBCStorage sMapDifficultyStore; -- use GetMapDifficultyData insteed +extern MapDifficultyMap sMapDifficultyMap; +extern DBCStorage sMovieStore; +extern DBCStorage sQuestSortStore; +extern DBCStorage sQuestXPStore; +extern DBCStorage sQuestFactionRewardStore; +extern DBCStorage sRandomPropertiesPointsStore; +extern DBCStorage sScalingStatDistributionStore; +extern DBCStorage sScalingStatValuesStore; +extern DBCStorage sSkillLineStore; +extern DBCStorage sSkillLineAbilityStore; +extern DBCStorage sSoundEntriesStore; +extern DBCStorage sSpellCastTimesStore; +extern DBCStorage sSpellDifficultyStore; +extern DBCStorage sSpellDurationStore; +extern DBCStorage sSpellFocusObjectStore; +extern DBCStorage sSpellItemEnchantmentStore; +extern DBCStorage sSpellItemEnchantmentConditionStore; +extern SpellCategoryStore sSpellCategoryStore; +extern PetFamilySpellsStore sPetFamilySpellsStore; +extern DBCStorage sSpellRadiusStore; +extern DBCStorage sSpellRangeStore; +extern DBCStorage sSpellRuneCostStore; +extern DBCStorage sSpellShapeshiftStore; +extern DBCStorage sSpellStore; +extern DBCStorage sStableSlotPricesStore; +extern DBCStorage sSummonPropertiesStore; +extern DBCStorage sTalentStore; +extern DBCStorage sTalentTabStore; +extern DBCStorage sTaxiNodesStore; +extern DBCStorage sTaxiPathStore; +extern TaxiMask sTaxiNodesMask; +extern TaxiMask sOldContinentsNodesMask; +extern TaxiPathSetBySource sTaxiPathSetBySource; +extern TaxiPathNodesByPath sTaxiPathNodesByPath; +extern DBCStorage sTotemCategoryStore; +extern DBCStorage sVehicleStore; +extern DBCStorage sVehicleSeatStore; +extern DBCStorage sWMOAreaTableStore; +//extern DBCStorage sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates +extern DBCStorage sWorldMapOverlayStore; +extern DBCStorage sWorldSafeLocsStore; + +void LoadDBCStores(const std::string& dataPath); + +// script support functions + DBCStorage const* GetSoundEntriesStore(); + DBCStorage const* GetSpellStore(); + DBCStorage const* GetSpellRangeStore(); + DBCStorage const* GetFactionStore(); + DBCStorage const* GetItemDisplayStore(); + DBCStorage const* GetCreatureDisplayStore(); + DBCStorage const* GetEmotesStore(); + DBCStorage const* GetEmotesTextStore(); + DBCStorage const* GetAchievementStore(); +#endif diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h new file mode 100644 index 0000000..075bb62 --- /dev/null +++ b/src/server/game/DataStores/DBCStructure.h @@ -0,0 +1,1927 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRINITY_DBCSTRUCTURE_H +#define TRINITY_DBCSTRUCTURE_H + +#include "Common.h" +#include "DBCEnums.h" +#include "Define.h" +#include "Path.h" +#include "Util.h" + +#include +#include +#include + +// Structures using to access raw DBC data and required packing to portability + +// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform +#if defined(__GNUC__) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + +struct AchievementEntry +{ + uint32 ID; // 0 + uint32 factionFlag; // 1 -1=all, 0=horde, 1=alliance + uint32 mapID; // 2 -1=none + //uint32 parentAchievement; // 3 its Achievement parent (can`t start while parent uncomplete, use its Criteria if don`t have own, use its progress on begin) + char *name[16]; // 4-19 + //uint32 name_flags; // 20 + //char *description[16]; // 21-36 + //uint32 desc_flags; // 37 + uint32 categoryId; // 38 + uint32 points; // 39 reward points + //uint32 OrderInCategory; // 40 + uint32 flags; // 41 + //uint32 icon; // 42 icon (from SpellIcon.dbc) + //char *titleReward[16]; // 43-58 + //uint32 titleReward_flags; // 59 + uint32 count; // 60 - need this count of completed criterias (own or referenced achievement criterias) + uint32 refAchievement; // 61 - referenced achievement (counting of all completed criterias) +}; + +struct AchievementCategoryEntry +{ + uint32 ID; // 0 + uint32 parentCategory; // 1 -1 for main category + //char *name[16]; // 2-17 + //uint32 name_flags; // 18 + //uint32 sortOrder; // 19 +}; + +struct AchievementCriteriaEntry +{ + uint32 ID; // 0 + uint32 referredAchievement; // 1 + uint32 requiredType; // 2 + union + { + // ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE = 0 + // TODO: also used for player deaths.. + struct + { + uint32 creatureID; // 3 + uint32 creatureCount; // 4 + } kill_creature; + + // ACHIEVEMENT_CRITERIA_TYPE_WIN_BG = 1 + struct + { + uint32 bgMapID; // 3 + uint32 winCount; // 4 + uint32 additionalRequirement1_type; // 5 additional requirement 1 type + uint32 additionalRequirement1_value; // 6 additional requirement 1 value + uint32 additionalRequirement2_type; // 7 additional requirement 2 type + uint32 additionalRequirement2_value; // 8 additional requirement 1 value + } win_bg; + + // ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL = 5 + struct + { + uint32 unused; // 3 + uint32 level; // 4 + } reach_level; + + // ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL = 7 + struct + { + uint32 skillID; // 3 + uint32 skillLevel; // 4 + } reach_skill_level; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT = 8 + struct + { + uint32 linkedAchievement; // 3 + } complete_achievement; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT = 9 + struct + { + uint32 unused; // 3 + uint32 totalQuestCount; // 4 + } complete_quest_count; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY = 10 + struct + { + uint32 unused; // 3 + uint32 numberOfDays; // 4 + } complete_daily_quest_daily; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE = 11 + struct + { + uint32 zoneID; // 3 + uint32 questCount; // 4 + } complete_quests_in_zone; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST = 14 + struct + { + uint32 unused; // 3 + uint32 questCount; // 4 + } complete_daily_quest; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND = 15 + struct + { + uint32 mapID; // 3 + } complete_battleground; + + // ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP = 16 + struct + { + uint32 mapID; // 3 + } death_at_map; + + // ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON = 18 + struct + { + uint32 manLimit; // 3 + } death_in_dungeon; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID = 19 + struct + { + uint32 groupSize; // 3 can be 5, 10 or 25 + } complete_raid; + + // ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE = 20 + struct + { + uint32 creatureEntry; // 3 + } killed_by_creature; + + // ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING = 24 + struct + { + uint32 unused; // 3 + uint32 fallHeight; // 4 + } fall_without_dying; + + // ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM = 26 + struct + { + uint32 type; // 3, see enum EnviromentalDamage + } death_from; + + // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST = 27 + struct + { + uint32 questID; // 3 + uint32 questCount; // 4 + } complete_quest; + + // ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET = 28 + // ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2 = 69 + struct + { + uint32 spellID; // 3 + uint32 spellCount; // 4 + } be_spell_target; + + // ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL = 29 + // ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2 = 110 + struct + { + uint32 spellID; // 3 + uint32 castCount; // 4 + } cast_spell; + + // ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA = 31 + struct + { + uint32 areaID; // 3 Reference to AreaTable.dbc + uint32 killCount; // 4 + } honorable_kill_at_area; + + // ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32 + struct + { + uint32 mapID; // 3 Reference to Map.dbc + } win_arena; + + // ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33 + struct + { + uint32 mapID; // 3 Reference to Map.dbc + } play_arena; + + // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34 + struct + { + uint32 spellID; // 3 Reference to Map.dbc + } learn_spell; + + // ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36 + struct + { + uint32 itemID; // 3 + uint32 itemCount; // 4 + } own_item; + + // ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37 + struct + { + uint32 unused; // 3 + uint32 count; // 4 + uint32 flag; // 5 4=in a row + } win_rated_arena; + + // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38 + struct + { + uint32 teamtype; // 3 {2,3,5} + } highest_team_rating; + + // ACHIEVEMENT_CRITERIA_TYPE_REACH_TEAM_RATING = 39 + struct + { + uint32 teamtype; // 3 {2,3,5} + uint32 teamrating; // 4 + } reach_team_rating; + + // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40 + struct + { + uint32 skillID; // 3 + uint32 skillLevel; // 4 apprentice=1, journeyman=2, expert=3, artisan=4, master=5, grand master=6 + } learn_skill_level; + + // ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM = 41 + struct + { + uint32 itemID; // 3 + uint32 itemCount; // 4 + } use_item; + + // ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM = 42 + struct + { + uint32 itemID; // 3 + uint32 itemCount; // 4 + } loot_item; + + // ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA = 43 + struct + { + // TODO: This rank is _NOT_ the index from AreaTable.dbc + uint32 areaReference; // 3 + } explore_area; + + // ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK = 44 + struct + { + // TODO: This rank is _NOT_ the index from CharTitles.dbc + uint32 rank; // 3 + } own_rank; + + // ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT = 45 + struct + { + uint32 unused; // 3 + uint32 numberOfSlots; // 4 + } buy_bank_slot; + + // ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION = 46 + struct + { + uint32 factionID; // 3 + uint32 reputationAmount; // 4 Total reputation amount, so 42000 = exalted + } gain_reputation; + + // ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION= 47 + struct + { + uint32 unused; // 3 + uint32 numberOfExaltedFactions; // 4 + } gain_exalted_reputation; + + // ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP = 48 + struct + { + uint32 unused; // 3 + uint32 numberOfVisits; // 4 + } visit_barber; + + // ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM = 49 + // TODO: where is the required itemlevel stored? + struct + { + uint32 itemSlot; // 3 + uint32 count; // 4 + } equip_epic_item; + + // ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50 + struct + { + uint32 rollValue; // 3 + uint32 count; // 4 + } roll_need_on_loot; + // ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT = 51 + struct + { + uint32 rollValue; // 3 + uint32 count; // 4 + } roll_greed_on_loot; + + // ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS = 52 + struct + { + uint32 classID; // 3 + uint32 count; // 4 + } hk_class; + + // ACHIEVEMENT_CRITERIA_TYPE_HK_RACE = 53 + struct + { + uint32 raceID; // 3 + uint32 count; // 4 + } hk_race; + + // ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE = 54 + // TODO: where is the information about the target stored? + struct + { + uint32 emoteID; // 3 enum TextEmotes + uint32 count; // 4 count of emotes, always required special target or requirements + } do_emote; + // ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE = 13 + // ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE = 55 + // ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS = 56 + struct + { + uint32 unused; // 3 + uint32 count; // 4 + uint32 flag; // 5 =3 for battleground healing + uint32 mapid; // 6 + } healing_done; + + // ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM = 57 + struct + { + uint32 itemID; // 3 + uint32 count; // 4 + } equip_item; + + // ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD= 62 + struct + { + uint32 unused; // 3 + uint32 goldInCopper; // 4 + } quest_reward_money; + + // ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY = 67 + struct + { + uint32 unused; // 3 + uint32 goldInCopper; // 4 + } loot_money; + + // ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT = 68 + struct + { + uint32 goEntry; // 3 + uint32 useCount; // 4 + } use_gameobject; + + // ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL = 70 + // TODO: are those special criteria stored in the dbc or do we have to add another sql table? + struct + { + uint32 unused; // 3 + uint32 killCount; // 4 + } special_pvp_kill; + + // ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT = 72 + struct + { + uint32 goEntry; // 3 + uint32 lootCount; // 4 + } fish_in_gameobject; + + // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS = 75 + struct + { + uint32 skillLine; // 3 + uint32 spellCount; // 4 + } learn_skillline_spell; + + // ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL = 76 + struct + { + uint32 unused; // 3 + uint32 duelCount; // 4 + } win_duel; + + // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER = 96 + struct + { + uint32 powerType; // 3 mana=0, 1=rage, 3=energy, 6=runic power + } highest_power; + + // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT = 97 + struct + { + uint32 statType; // 3 4=spirit, 3=int, 2=stamina, 1=agi, 0=strength + } highest_stat; + + // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER = 98 + struct + { + uint32 spellSchool; // 3 + } highest_spellpower; + + // ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING = 100 + struct + { + uint32 ratingType; // 3 + } highest_rating; + + // ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE = 109 + struct + { + uint32 lootType; // 3 3=fishing, 2=pickpocket, 4=disentchant + uint32 lootTypeCount; // 4 + } loot_type; + + // ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE = 112 + struct + { + uint32 skillLine; // 3 + uint32 spellCount; // 4 + } learn_skill_line; + + // ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113 + struct + { + uint32 unused; // 3 + uint32 killCount; // 4 + } honorable_kill; + + struct + { + uint32 field3; // 3 main requirement + uint32 count; // 4 main requirement count + uint32 additionalRequirement1_type; // 5 additional requirement 1 type + uint32 additionalRequirement1_value; // 6 additional requirement 1 value + uint32 additionalRequirement2_type; // 7 additional requirement 2 type + uint32 additionalRequirement2_value; // 8 additional requirement 1 value + } raw; + }; + //char* name[16]; // 9-24 + //uint32 name_flags; // 25 + uint32 completionFlag; // 26 + uint32 timedType; // 27 + uint32 timerStartEvent; // 28 Alway appears with timed events + // for timed spells it is spell id for + // timed kills it is creature id + uint32 timeLimit; // 29 time limit in seconds + //uint32 showOrder; // 30 show order +}; + +struct AreaTableEntry +{ + uint32 ID; // 0 + uint32 mapid; // 1 + uint32 zone; // 2 if 0 then it's zone, else it's zone id of this area + uint32 exploreFlag; // 3, main index + uint32 flags; // 4, unknown value but 312 for all cities + // 5-9 unused + int32 area_level; // 10 + char* area_name[16]; // 11-26 + // 27, string flags, unused + uint32 team; // 28 + + // helpers + bool IsSanctuary() const + { + if (mapid == 609 || ID == 4522 || ID == 4395 || ID == 4553) + return true; + return (flags & AREA_FLAG_SANCTUARY); + } +}; + +struct AreaGroupEntry +{ + uint32 AreaGroupId; // 0 + uint32 AreaId[6]; // 1-6 + uint32 nextGroup; // 7 index of next group +}; + +struct AreaPOIEntry +{ + uint32 id; //0 + uint32 icon[11]; //1-11 + float x; //12 + float y; //13 + float z; //14 + uint32 mapId; //15 + //uint32 val1; //16 + uint32 zoneId; //17 + //char* name[16]; //18-33 + //uint32 name_flag; //34 + //char* name2[16]; //35-50 + //uint32 name_flag2; //51 + uint32 worldState; //52 + //uint32 val2; //53 +}; + +struct AreaTriggerEntry +{ + uint32 id; // 0 m_ID + uint32 mapid; // 1 m_ContinentID + float x; // 2 m_x + float y; // 3 m_y + float z; // 4 m_z + float radius; // 5 m_radius + float box_x; // 6 m_box_length + float box_y; // 7 m_box_width + float box_z; // 8 m_box_heigh + float box_orientation; // 9 m_box_yaw +}; + +struct AuctionHouseEntry +{ + uint32 houseId; // 0 index + uint32 faction; // 1 id of faction.dbc for player factions associated with city + uint32 depositPercent; // 2 1/3 from real + uint32 cutPercent; // 3 + //char* name[16]; // 4-19 + // 20 string flag, unused +}; + +struct BankBagSlotPricesEntry +{ + uint32 ID; + uint32 price; +}; + +struct BarberShopStyleEntry +{ + uint32 Id; // 0 + uint32 type; // 1 value 0 -> hair, value 2 -> facialhair + //char* name[16]; // 2-17 name of hair style + //uint32 name_flags; // 18 + //uint32 unk_name[16]; // 19-34, all empty + //uint32 unk_flags; // 35 + //float CostMultiplier; // 36 values 1 and 0.75 + uint32 race; // 37 race + uint32 gender; // 38 0 -> male, 1 -> female + uint32 hair_id; // 39 real ID to hair/facial hair +}; + +struct BattlemasterListEntry +{ + uint32 id; // 0 + int32 mapid[8]; // 1-8 mapid + uint32 type; // 9 (3 - BG, 4 - arena) + //uint32 canJoinAsGroup; // 10 (0 or 1) + char* name[16]; // 11-26 + //uint32 nameFlags // 27 string flag, unused + uint32 maxGroupSize; // 28 maxGroupSize, used for checking if queue as group + uint32 HolidayWorldStateId; // 29 new 3.1 + //uint32 MinLevel; // 30 + //uint32 SomeLevel; // 31, may be max level +}; + +#define MAX_OUTFIT_ITEMS 24 + +struct CharStartOutfitEntry +{ + //uint32 Id; // 0 + uint32 RaceClassGender; // 1 (UNIT_FIELD_BYTES_0 & 0x00FFFFFF) comparable (0 byte = race, 1 byte = class, 2 byte = gender) + int32 ItemId[MAX_OUTFIT_ITEMS]; // 2-13 + //int32 ItemDisplayId[MAX_OUTFIT_ITEMS]; // 14-25 not required at server side + //int32 ItemInventorySlot[MAX_OUTFIT_ITEMS]; // 26-37 not required at server side + //uint32 Unknown1; // 38, unique values (index-like with gaps ordered in other way as ids) + //uint32 Unknown2; // 39 + //uint32 Unknown3; // 40 +}; + +struct CharTitlesEntry +{ + uint32 ID; // 0, title ids, for example in Quest::GetCharTitleId() + //uint32 unk1; // 1 flags? + char* name[16]; // 2-17 + // 18 string flag, unused + //char* name2[16]; // 19-34, unused + // 35 string flag, unused + uint32 bit_index; // 36 used in PLAYER_CHOSEN_TITLE and 1<